35
|
1 #include "task_base.h"
|
|
2 #include "task_object.h"
|
|
3 #include "Sankaku.h"
|
|
4
|
|
5 SchedDefineTask1(State411, state411);
|
|
6
|
|
7 static int
|
|
8 state411(SchedTask *smanager, void *rbuf, void *wbuf)
|
|
9 {
|
|
10 int length;
|
|
11 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
|
|
12 player *jiki = (player*)smanager->get_input(rbuf, 1);
|
|
13
|
|
14 if (p->dt2 > 356)
|
|
15 {
|
|
16 p->vx = -1;
|
|
17 }
|
|
18 if (p->dt2 < -398)
|
|
19 {
|
|
20 p->vx = 1;
|
|
21 }
|
|
22 if ((p->dt1) % 62 == 0) {
|
|
23 length = 1;
|
|
24 smanager->set_outputSize(1, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
|
|
25 smanager->setup_outputData();
|
|
26 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 1);
|
|
27 sprite->flag = true;
|
|
28 sprite->length = length;
|
|
29
|
|
30 Putenemy(41,
|
|
31 p->x,
|
|
32 p->y,
|
|
33 (int) -Mycos(p->dt1 / 16) * 4 /
|
|
34 SANKAKU,
|
|
35 (int) -Mysin(p->dt1 / 16) * 4 /
|
|
36 SANKAKU, STATE7, &sprite->data[0]);
|
|
37 }
|
|
38 if ((p->dt1) % 13 == 0) {
|
|
39 length = 1;
|
|
40 smanager->set_outputSize(1, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
|
|
41 smanager->setup_outputData();
|
|
42 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 1);
|
|
43 sprite->flag = true;
|
|
44 sprite->length = length;
|
|
45
|
|
46 Puttama(11, p->x + 32,
|
|
47 p->y + 32, &sprite->data[0]);
|
|
48 }
|
|
49 p->dt2 += p->vx;
|
|
50 p->dt1 += p->dt2 / 4;
|
|
51
|
|
52 p->x = jiki->x - 16 +
|
|
53 Mycos(p->dt1 / 16) * 128 / SANKAKU;
|
|
54 p->y = jiki->y - 16 +
|
|
55 Mysin(p->dt1 / 16) * 128 / SANKAKU;
|
|
56 if (p->x < 0)
|
|
57 {
|
|
58 p->x = 0;
|
|
59 }
|
|
60 if (p->x > 260)
|
|
61 {
|
|
62 p->x = 260;
|
|
63 }
|
|
64 if (p->y < 0)
|
|
65 {
|
|
66 p->y = 0;
|
|
67 }
|
|
68 if (p->y > 232)
|
|
69 {
|
|
70 p->y = 232;
|
|
71 }
|
|
72 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
|
|
73
|
|
74 *q = *p;
|
|
75 return 0;
|
|
76 }
|