49
|
1 #include "task_base.h"
|
|
2 #include "task_object.h"
|
18
|
3
|
49
|
4 SchedDefineTask1(State602, state602);
|
18
|
5
|
|
6 static int
|
49
|
7 state602(SchedTask *smanager, void *rbuf, void *wbuf)
|
18
|
8 {
|
49
|
9 int rand = (int)smanager->get_param(0);
|
|
10
|
18
|
11 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
|
|
12
|
49
|
13 int length = 1;
|
|
14 smanager->set_outputSize(1, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
|
|
15 smanager->setup_outputData();
|
|
16
|
|
17 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 1);
|
|
18 sprite->flag = true;
|
|
19 sprite->length = length;
|
|
20
|
18
|
21 p->dt2++;
|
|
22 Putenemy(24, p->x + 14, p->y + 14,
|
49
|
23 (rand % 5 + 0.5) * (rand % 2 == 1 ? -1 : 1),
|
|
24 (rand % 5 + 0.5) * (rand % 2 == 1 ? -1 : 1),
|
|
25 STATE29, &sprite->data[0]);
|
18
|
26 if (p->dt2 > 1024) {
|
|
27 p->task = STATE600;
|
|
28 p->dt2 = 0;
|
|
29 }
|
49
|
30 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
|
|
31
|
|
32 *q = *p;
|
18
|
33 return 0;
|
|
34 }
|