annotate spe/chara_state31.cc @ 55:2c33aa6a4a37

debug global_alloc.but new bugs appear
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Fri, 28 Jan 2011 19:05:00 +0900
parents f4140672ef9f
children cfd42ee2ad28
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
1 #include "task_base.h"
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
2 #include "task_object.h"
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
4 SchedDefineTask1(State31, state31);
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 static int
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
7 state31(SchedTask *smanager, void *rbuf, void *wbuf)
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 {
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
9 int part3_f = (int)smanager->get_param(2);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
10
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
11 int length;
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
13 CHARACTER *kyeenemyno = (CHARACTER*)smanager->get_input(rbuf, 1);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
14 int count = *(int*)smanager->get_input(rbuf, 2);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
15 int rinkf1 = *(int*)smanager->get_input(rbuf, 3);
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
17 if((part3_f == FALSE) || (kyeenemyno->f == FALSE))
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 {
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
19 length = 1;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
20 smanager->set_outputSize(2, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
21 smanager->setup_outputData();
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
22 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
23 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 2);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
24 sprite->flag = true;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
25 sprite->length = length;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
26
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
27 Bom(p->x, p->y, &sprite->data[0]);
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 p->f = FALSE;
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
29 p->task = DELETE_CHARA;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
30
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
31 *q = *p;
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 return 0;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 if(rinkf1 == 0)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 p->x = kyeenemyno->x + 40;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 p->y = kyeenemyno->y + 28;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 p->dt2 = 0;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 if(rinkf1 == 5)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 {
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
43 length = 1;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
44 smanager->set_outputSize(2, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
45 smanager->setup_outputData();
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
46 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 2);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
47 sprite->flag = true;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
48 sprite->length = length;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
49
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 p->x = kyeenemyno->x + 52;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 p->y = kyeenemyno->y;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 count++;
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
53 PutSprite(count, p->x - 4, p->y - 20, 80 + p->dt2 % 4, &sprite->data[0]);
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 p->dt2++;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 if(rinkf1 == 6)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 if(p->y < 240 - 40)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 p->y += 6;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 else
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 {
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
64 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
65 *q = *p;
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 return 0;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 }
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
68 length = 1;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
69 smanager->set_outputSize(2, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
70 smanager->setup_outputData();
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
71 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 2);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
72 sprite->flag = true;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
73 sprite->length = length;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
74
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 count++;
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
76
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
77 PutSprite(count, p->x - 4, p->y - 20, 90 + p->dt2 % 4, &sprite->data[0]);
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 p->dt2++;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 if(rinkf1 == 7)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 {
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
82 length = 1;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
83 smanager->set_outputSize(2, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
84 smanager->setup_outputData();
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
85 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
86 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 2);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
87 sprite->flag = true;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
88 sprite->length = length;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
89
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
90 Putenemy(22, p->x + 14, p->y + 14, 0, 0, STATE40, &sprite->data[0]);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
91 *q = *p;
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 return 0;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 if(rinkf1 == 11)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 if(p->y + 20 != p->y)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 p->y--;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 else
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 {
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
102 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
103 *q = *p;
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 return 0;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 }
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
106 length = 1;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
107 smanager->set_outputSize(2, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
108 smanager->setup_outputData();
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
109 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 2);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
110 sprite->flag = true;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
111 sprite->length = length;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
112
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 count++;
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
114 PutSprite(count, p->x + 8, p->y + 44, 58 + p->dt2 % 4, &sprite->data[0]);
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 p->dt2++;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 }
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
117 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
118 int *w_count = (int*)smanager->get_output(wbuf, 1);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
119
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
120 *q = *p;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
121 *w_count = count;
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 return 0;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 }