35
|
1 #include "task_base.h"
|
|
2 #include "task_object.h"
|
|
3
|
|
4 SchedDefineTask1(State601, state601);
|
|
5
|
|
6 static int
|
|
7 state601(SchedTask *smanager, void *rbuf, void *wbuf)
|
|
8 {
|
65
|
9 long rand1 = (long)smanager->get_param(0);
|
|
10 long rand2 = (long)smanager->get_param(1);
|
38
|
11
|
35
|
12 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
|
|
13 player *jiki = (player*)smanager->get_input(rbuf, 1);
|
|
14
|
|
15 int length = 1;
|
|
16 smanager->set_outputSize(1, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
|
|
17 smanager->setup_outputData();
|
|
18
|
|
19 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 1);
|
|
20 sprite->flag = true;
|
|
21 sprite->length = length;
|
|
22
|
|
23 p->dt2++;
|
|
24 if (p->x < jiki->x)
|
|
25 p->vx++;
|
|
26 if (p->x > jiki->x)
|
|
27 p->vx--;
|
|
28 p->x += p->vx;
|
58
|
29 Putenemy(6, p->x + 16 + rand1 % 32,
|
|
30 p->y, 0, rand2 % 4, STATE400, &sprite->data[0]);
|
35
|
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 if (p->dt2 > 800) {
|
57
|
40 p->state_task = STATE602;
|
35
|
41 }
|
|
42 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
|
|
43
|
|
44 *q = *p;
|
|
45 return 0;
|
|
46 }
|