comparison spe/chara_state3.cc @ 49:f4140672ef9f

fix.
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Fri, 21 Jan 2011 22:18:28 +0900
parents c330ded6d728
children cfd42ee2ad28
comparison
equal deleted inserted replaced
45:e01948ce859a 49:f4140672ef9f
1 #include "chara_state3.h" 1 #include "task_base.h"
2 #include "tobject.h" 2 #include "task_object.h"
3 #include "../ObjectType.h"
3 4
4 SchedDefineTask(STATE3); 5 SchedDefineTask1(State3, state3);
5 6
6 static int 7 static int
7 run(SchedTask *smanager, void *rbuf, void *wbuf) 8 state3(SchedTask *smanager, void *rbuf, void *wbuf)
8 { 9 {
10 int length;
9 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); 11 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
10 12
11 p->x += p->vx; 13 p->x += p->vx;
12 p->y += p->vy; 14 p->y += p->vy;
13 if((p->dt1 == 60) || 15 if((p->dt1 == 60) ||
14 (p->dt1 == 90) || 16 (p->dt1 == 90) ||
15 (p->dt1 == 30)) 17 (p->dt1 == 30))
16 { 18 {
17 Puttama(0, p->x, p->y); 19 length = 1;
20 smanager->set_outputSize(1, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
21 smanager->setup_outputData();
22 ObjContainerPtr tama = (ObjContainerPtr)smanager->get_output(wbuf, 1);
23 tama->flag = true;
24 tama->length = length;
25
26 Puttama(0, p->x, p->y, &tama->data[0]);
18 } 27 }
28 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
29
19 p->dt1++; 30 p->dt1++;
20
21 p->task = STATE3; 31 p->task = STATE3;
22 smanager->swap(); 32
33 *q = *p;
23 return 0; 34 return 0;
24 } 35 }