comparison spe/chara_state28.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_state28.h" 1 #include "task_base.h"
2 #include "tobject.h" 2 #include "task_object.h"
3 #include "Sankaku.h"
3 4
4 SchedDefineTask(STATE28); 5 SchedDefineTask1(State28, state28);
5 6
6 static int 7 static int
7 run(SchedTask *smanager, void *rbuf, void *wbuf) 8 state28(SchedTask *smanager, void *rbuf, void *wbuf)
8 { 9 {
10 int rand = (int)smanager->get_param(2);
11
12 int length = 2;
9 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); 13 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
14 int count = *(int*)smanager->get_input(rbuf, 1);
15
16 smanager->set_outputSize(4, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
17 smanager->setup_outputData();
18
19 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
20 int *w_count = (int*)smanager->get_output(wbuf, 1);
21 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 4);
22 sprite->flag = true;
10 23
11 if (p->dt1 <= 360) 24 if (p->dt1 <= 360)
12 { 25 {
13 p->x = Mycos(p->dt1) * 30 / SANKAKU + 82 + 32; 26 p->x = Mycos(p->dt1) * 30 / SANKAKU + 82 + 32;
14 p->y = Mysin(p->dt1) * 30 / SANKAKU + 30; 27 p->y = Mysin(p->dt1) * 30 / SANKAKU + 30;
17 { 30 {
18 p->x = Mycos(p->dt1) * 30 * -1 / SANKAKU + 142 + 32; 31 p->x = Mycos(p->dt1) * 30 * -1 / SANKAKU + 142 + 32;
19 p->y = Mysin(p->dt1) * 30 / SANKAKU + 30; 32 p->y = Mysin(p->dt1) * 30 / SANKAKU + 30;
20 } 33 }
21 count++; 34 count++;
22 PutSprite(count, p->x - 42, p->y, 64); 35 PutSprite(count, p->x - 42, p->y, 64, &sprite->data[0]);
23 if (p->dt1 % 30 == 3) 36 if (p->dt1 % 30 == 3)
24 { 37 {
25 Putenemy(24, p->x + 14, 38 Putenemy(24, p->x + 14,
26 p->y + 14, 39 p->y + 14,
27 (rand() % 5 + 0.5) * (rand() % 2 == 40 (rand % 5 + 0.5) * (rand % 2 ==
28 1 ? -1 : 1), 41 1 ? -1 : 1),
29 (rand() % 5 + 0.5) * (rand() % 2 == 42 (rand % 5 + 0.5) * (rand % 2 ==
30 1 ? -1 : 1), chara_state29); 43 1 ? -1 : 1), STATE29, &sprite->data[1]);
44 } else {
45 length = 1;
31 } 46 }
32 p->dt1 += 3; 47 p->dt1 += 3;
48
49 sprite->length = length;
50 *q = *p;
51 *w_count = count;
33 return 0; 52 return 0;
34 } 53 }