comparison spe/chara_state13.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_state13.h" 1 #include "task_base.h"
2 #include "tobject.h" 2 #include "task_object.h"
3 3
4 SchedDefineTask(STATE13); 4 SchedDefineTask1(State13, state13);
5 5
6 static int 6 static int
7 run(SchedTask *smanager, void *rbuf, void *wbuf) 7 state13(SchedTask *smanager, void *rbuf, void *wbuf)
8 { 8 {
9 int rinkx = (int)smanager->get_param(0);
10 int rinky = (int)smanager->get_param(1);
11 int filpcount = (int)smanager->get_param(2);
12 int flag = (int)smanager->get_param(3);
13 int count = (int)smanager->get_param(4);
14
15 int length;
9 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); 16 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
17 int rinkf2 = *(int*)smanager->get_input(rbuf, 1);
10 18
11 if(tekino0->f == FALSE){ 19 if(flag == FALSE){
12 Bom(p->x, p->y); 20 length = 1;
21 smanager->set_outputSize(2, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
22 smanager->setup_outputData();
23
24 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
25 int *w_count = (int*)smanager->get_output(wbuf, 1);
26 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 2);
27 sprite->flag = true;
28 sprite->length = length;
29
30 Bom(p->x, p->y, &sprite->data[0]);
13 p->f = FALSE; 31 p->f = FALSE;
14 p->state = delete_chara; 32 p->task = DELETE_CHARA;
15 p->collision = noaction; 33
34 *w_count = count;
35 *q = *p;
16 return 0; 36 return 0;
17 } 37 }
38 length = 1;
39 smanager->set_outputSize(2, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
40 smanager->setup_outputData();
41
42 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
43 int *w_count = (int*)smanager->get_output(wbuf, 1);
44 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 2);
45 sprite->flag = false;
18 46
19 p->x += rinkx - p->dt1; 47 p->x += rinkx - p->dt1;
20 p->y += rinky - p->dt2; 48 p->y += rinky - p->dt2;
21 p->dt1 = rinkx; 49 p->dt1 = rinkx;
22 p->dt2 = rinky; 50 p->dt2 = rinky;
23 if(rinkf2 == 1) 51 if(rinkf2 == 1)
24 { 52 {
25 if(p->x > rinkx) 53 if(p->x > rinkx)
26 { 54 {
27 Puttama(2, p->x + 32, p->y); 55 sprite->flag = true;
56 sprite->length = length;
57 Puttama(2, p->x + 32, p->y, &sprite->data[0]);
28 } 58 }
29 if(p->x < rinkx) 59 if(p->x < rinkx)
30 { 60 {
31 Puttama(3, p->x, p->y); 61 sprite->flag = true;
62 sprite->length = length;
63 Puttama(3, p->x, p->y, &sprite->data[0]);
32 } 64 }
33 } 65 }
34 if(rinkf2 == 4) 66 if(rinkf2 == 4)
35 { 67 {
68 sprite->flag = true;
69 sprite->length = length;
36 count++; 70 count++;
37 PutSprite(count, p->x, p->y + 56, 58+filpcount % 4); 71 PutSprite(count, p->x, p->y + 56, 58+filpcount % 4, &sprite->data[0]);
38 } 72 }
39 if(rinkf2 == 5) 73 if(rinkf2 == 5)
40 { 74 {
41 if(p->x > rinkx) 75 if(p->x > rinkx)
42 { 76 {
43 Puttama(5, p->x + 8, p->y + 24); 77 sprite->flag = true;
78 sprite->length = length;
79 Puttama(5, p->x + 8, p->y + 24, &sprite->data[0]);
44 } 80 }
45 if(p->x < rinkx) 81 if(p->x < rinkx)
46 { 82 {
47 Puttama(5, p->x + 8, p->y + 24); 83 sprite->flag = true;
84 sprite->length = length;
85 Puttama(5, p->x + 8, p->y + 24, &sprite->data[0]);
48 } 86 }
49 } 87 }
88
89 *q = *p;
90 *w_count = count;
50 return 0; 91 return 0;
51 } 92 }