Mercurial > hg > Members > koba > t_dandy
comparison ppe/chara_state7.cc @ 31:ccb8d9956a1e
add multi container function.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 31 Dec 2010 19:19:13 +0900 |
parents | c4210c1053e8 |
children | 39e643fc4f90 |
comparison
equal
deleted
inserted
replaced
30:427e1aac0bd7 | 31:ccb8d9956a1e |
---|---|
1 #include "task_base.h" | 1 #include "task_base.h" |
2 #include "task_object.h" | 2 #include "task_object.h" |
3 #include "../ObjectType.h" | |
3 | 4 |
4 SchedDefineTask(State7); | 5 SchedDefineTask(State7); |
5 | 6 |
6 static int | 7 static int |
7 run(SchedTask *smanager, void *rbuf, void *wbuf) | 8 run(SchedTask *smanager, void *rbuf, void *wbuf) |
8 { | 9 { |
9 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); | 10 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); |
10 TamaContainerPtr tama = (TamaContainerPtr)smanager->get_input(rbuf, 1); | 11 int length = 1; |
12 | |
13 smanager->set_outputSize(1, sizeof(ObjContainer)+sizeof(ObjData)*(length-1)); | |
14 smanager->setup_outputData(); | |
15 | |
16 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0); | |
17 ObjContainerPtr tama = (ObjContainerPtr)smanager->get_output(wbuf, 1); | |
18 tama->flag = false; | |
11 | 19 |
12 p->x += p->vx; | 20 p->x += p->vx; |
13 p->y += p->vy; | 21 p->y += p->vy; |
14 if((p->dt1 == 60) || (p->dt1 == 90) | 22 if((p->dt1 == 60) || (p->dt1 == 90) |
15 || (p->dt1 == 30)) | 23 || (p->dt1 == 30)) |
16 { | 24 { |
17 Puttama(1, p->x, p->y, tama); | 25 tama->flag = true; |
26 tama->type = Tama; | |
27 tama->length = length; | |
28 | |
29 | |
30 Puttama(1, p->x, p->y, &tama->data[0]); | |
18 } | 31 } |
19 p->dt1++; | 32 p->dt1++; |
20 p->task = STATE7; | 33 p->task = STATE7; |
21 smanager->swap(); | 34 |
35 *q = *p; | |
22 return 0; | 36 return 0; |
23 } | 37 } |