34
|
1 #include "task_base.h"
|
|
2 #include "task_object.h"
|
|
3 #include "Sankaku.h"
|
|
4
|
|
5 SchedDefineTask1(State28, state28);
|
|
6
|
|
7 static int
|
|
8 state28(SchedTask *smanager, void *rbuf, void *wbuf)
|
|
9 {
|
|
10 int length = 2;
|
|
11 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
|
|
12 int count = *(int*)smanager->get_input(rbuf, 1);
|
|
13
|
|
14 smanager->set_outputSize(4, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
|
|
15 smanager->setup_outputData();
|
|
16
|
|
17 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
|
|
18 int *w_count = (int*)smanager->get_output(wbuf, 1);
|
|
19 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 4);
|
|
20 sprite->flag = true;
|
|
21
|
|
22 if (p->dt1 <= 360)
|
|
23 {
|
|
24 p->x = Mycos(p->dt1) * 30 / SANKAKU + 82 + 32;
|
|
25 p->y = Mysin(p->dt1) * 30 / SANKAKU + 30;
|
|
26 }
|
|
27 if (p->dt1 > 360)
|
|
28 {
|
|
29 p->x = Mycos(p->dt1) * 30 * -1 / SANKAKU + 142 + 32;
|
|
30 p->y = Mysin(p->dt1) * 30 / SANKAKU + 30;
|
|
31 }
|
|
32 count++;
|
|
33 PutSprite(count, p->x - 42, p->y, 64, &sprite->data[0]);
|
|
34 if (p->dt1 % 30 == 3)
|
|
35 {
|
|
36 Putenemy(24, p->x + 14,
|
|
37 p->y + 14,
|
|
38 (rand() % 5 + 0.5) * (rand() % 2 ==
|
|
39 1 ? -1 : 1),
|
|
40 (rand() % 5 + 0.5) * (rand() % 2 ==
|
|
41 1 ? -1 : 1), STATE29, &sprite->data[1]);
|
35
|
42 } else {
|
|
43 length = 1;
|
34
|
44 }
|
|
45 p->dt1 += 3;
|
35
|
46
|
|
47 sprite->length = length;
|
34
|
48 *q = *p;
|
|
49 *w_count = count;
|
|
50 return 0;
|
|
51 }
|