35
|
1 #include "task_base.h"
|
|
2 #include "task_object.h"
|
|
3 #include "Sankaku.h"
|
|
4
|
|
5 SchedDefineTask1(State600, state600);
|
|
6
|
|
7 static int
|
|
8 state600(SchedTask *smanager, void *rbuf, void *wbuf)
|
|
9 {
|
|
10 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
|
|
11
|
|
12 int length = 3;
|
|
13 smanager->set_outputSize(1, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
|
|
14 smanager->setup_outputData();
|
|
15
|
|
16 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 1);
|
|
17 sprite->flag = true;
|
|
18 sprite->length = length;
|
|
19
|
|
20 p->dt1 += 30;
|
|
21 p->dt2++;
|
|
22 p->dt1 %= 360;
|
|
23 p->x += Mycos(p->dt1) * 4 / SANKAKU;
|
|
24 p->y += Mysin(p->dt1) * 4 / SANKAKU;
|
|
25
|
|
26 Puttama(11, p->x + 16, p->y + 16, &sprite->data[0]);
|
|
27 Puttama(11, p->x + 32, p->y + 48, &sprite->data[1]);
|
|
28 Puttama(11, p->x + 48, p->y + 16, &sprite->data[2]);
|
|
29 if (p->dt2 > 240)
|
|
30 p->task = STATE601;
|
|
31 if (p->x < 0)
|
|
32 p->x = 0;
|
|
33 if (p->x > 260)
|
|
34 p->x = 260;
|
|
35 if (p->y < 0)
|
|
36 p->y = 0;
|
|
37 if (p->y > 232)
|
|
38 p->y = 232;
|
|
39
|
|
40 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
|
|
41
|
|
42 *q = *p;
|
|
43 return 0;
|
|
44 }
|