Mercurial > hg > Members > koba > t_dandy
comparison ppe/chara_state601.cc @ 35:c122e3d2302e
add all state task.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 09 Jan 2011 14:28:44 +0900 |
parents | |
children | 6626e451a09d |
comparison
equal
deleted
inserted
replaced
34:7aaaaf5dde40 | 35:c122e3d2302e |
---|---|
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 { | |
9 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); | |
10 player *jiki = (player*)smanager->get_input(rbuf, 1); | |
11 | |
12 int length = 1; | |
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->dt2++; | |
21 if (p->x < jiki->x) | |
22 p->vx++; | |
23 if (p->x > jiki->x) | |
24 p->vx--; | |
25 p->x += p->vx; | |
26 Putenemy(6, p->x + 16 + rand() % 32, | |
27 p->y, 0, rand() % 4, STATE400, &sprite->data[0]); | |
28 if (p->x < 0) | |
29 p->x = 0; | |
30 if (p->x > 260) | |
31 p->x = 260; | |
32 if (p->y < 0) | |
33 p->y = 0; | |
34 if (p->y > 232) | |
35 p->y = 232; | |
36 if (p->dt2 > 800) { | |
37 p->task = STATE602; | |
38 } | |
39 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0); | |
40 | |
41 *q = *p; | |
42 return 0; | |
43 } |