49
|
1 #include "task_base.h"
|
|
2 #include "task_object.h"
|
18
|
3
|
49
|
4 SchedDefineTask1(State12, state12);
|
18
|
5
|
|
6 static int
|
49
|
7 state12(SchedTask *smanager, void *rbuf, void *wbuf)
|
18
|
8 {
|
49
|
9 int fastebos = (int)smanager->get_param(0);
|
|
10 int count = (int)smanager->get_param(1);
|
|
11 int rinkx = (int)smanager->get_param(2);
|
|
12 int rinky = (int)smanager->get_param(3);
|
|
13
|
18
|
14 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
|
49
|
15 int length;
|
|
16 int rinkf2;
|
|
17 int index_count = 0;
|
18
|
18
|
49
|
19 if (fastebos > 60*60) {
|
|
20 length = 2;
|
|
21 smanager->set_outputSize(6, 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, 3);
|
|
26 int *w_rinky = (int*)smanager->get_output(wbuf, 4);
|
|
27 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 6);
|
|
28 sprite->flag = true;
|
|
29 sprite->length = length;
|
|
30
|
|
31 if (p->y > 240+32) {
|
|
32 p->task = DELETE_CHARA;
|
18
|
33 }
|
|
34 p->y += 3;
|
|
35 rinky += 3;
|
|
36 count++;
|
49
|
37
|
|
38 DefSpriteEx(54, 16, 32, &sprite->data[index_count]);
|
|
39 index_count++;
|
|
40 PutSpriteEx(54, p->x, p->y, 2, 2, 1, &sprite->data[index_count]);
|
|
41 p->task = STATE12;
|
|
42
|
|
43 *w_rinky = rinky;
|
|
44 *w_count = count;
|
|
45 *q = *p;
|
18
|
46 return 0;
|
|
47 }
|
49
|
48
|
|
49 player *jiki = (player*)smanager->get_input(rbuf, 1);
|
|
50
|
|
51 if (p->dt1 <= 60) {
|
|
52 length = 2;
|
|
53 smanager->set_outputSize(6, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
|
|
54 smanager->setup_outputData();
|
|
55
|
|
56 if (jiki->x + 15 - rinkx < -5) {
|
18
|
57 p->vx = -0.8;
|
49
|
58 } else if(jiki->x + 15 - rinkx > 5) {
|
|
59 p->vx = +0.8;
|
|
60 } else {
|
|
61 p->vx = 0;
|
18
|
62 }
|
|
63 rinkx = p->x;
|
|
64 rinky = p->y;
|
|
65 }
|
49
|
66
|
|
67 if ((p->dt1 > 60) && (p->dt1 <= 70)) {
|
|
68 if(p->dt1 % 2 == 1) {
|
|
69 length = 5;
|
|
70 smanager->set_outputSize(6, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
|
|
71 smanager->setup_outputData();
|
|
72
|
|
73 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 6);
|
|
74 sprite->flag = true;
|
|
75 sprite->length = length;
|
|
76
|
|
77 Puttama(0, rinkx - 16, rinky, &sprite->data[index_count]);
|
|
78 index_count++;
|
|
79 Puttama(0, rinkx, rinky, &sprite->data[index_count]);
|
|
80 index_count++;
|
|
81 Puttama(0, rinkx + 16, rinky, &sprite->data[index_count]);
|
|
82 index_count++;
|
|
83 } else {
|
|
84 length = 2;
|
|
85 smanager->set_outputSize(6, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
|
|
86 smanager->setup_outputData();
|
18
|
87 }
|
|
88 }
|
49
|
89
|
|
90 if ((p->dt1 > 70) && (p->dt1 <= 180)) {
|
|
91 length = 2;
|
|
92 smanager->set_outputSize(6, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
|
|
93 smanager->setup_outputData();
|
|
94 }
|
|
95
|
|
96 if ((p->dt1 > 180) && (p->dt1 <= 240)) {
|
|
97 if (p->dt1 % 2 == 1) {
|
|
98 length = 4;
|
|
99 smanager->set_outputSize(6, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
|
|
100 smanager->setup_outputData();
|
|
101
|
|
102 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 6);
|
|
103
|
|
104 rinkf2 = 1;
|
|
105 Puttama(2, rinkx - 16, p->y - 32, &sprite->data[index_count]);
|
|
106 index_count++;
|
|
107 Puttama(3, rinkx + 32 - 16, p->y - 32, &sprite->data[index_count]);
|
|
108 index_count++;
|
|
109 } else {
|
|
110 length = 2;
|
|
111 smanager->set_outputSize(6, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
|
|
112 smanager->setup_outputData();
|
|
113
|
|
114 rinkf2 = 2;
|
|
115 }
|
|
116 }
|
|
117
|
|
118 if (p->dt1 > 240) {
|
|
119 rinkf2 = 2;
|
|
120 }
|
|
121
|
|
122 if ((p->dt1 > 240) && (p->dt1 <= 400)) {
|
|
123 length = 4;
|
|
124 smanager->set_outputSize(6, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
|
|
125 smanager->setup_outputData();
|
|
126
|
|
127 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 6);
|
|
128
|
|
129 count++;
|
|
130 PutSprite(count, rinkx - 16, rinky + 32, 58 + p->dt1 % 4, &sprite->data[index_count]);
|
|
131 index_count++;
|
|
132
|
|
133 if (p->dt1 > 300) {
|
|
134 rinkf2 = 3;
|
|
135 if(jiki->x + 15 - rinkx < -5) {
|
|
136 p->vx = -1;
|
|
137 } else if (jiki->x + 15 - rinkx > 5) {
|
|
138 p->vx = +1;
|
|
139 } else {
|
|
140 p->vx = 0;
|
|
141 }
|
|
142 p->x += p->vx;
|
|
143 rinkx = p->x;
|
|
144 rinky = p->y;
|
|
145 Puttama(4, rinkx - 8, rinky + 16, &sprite->data[index_count]);
|
|
146 index_count++;
|
|
147 }
|
|
148 }
|
|
149
|
|
150 if (p->dt1 > 400) {
|
|
151 length = 2;
|
|
152 smanager->set_outputSize(6, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
|
|
153 smanager->setup_outputData();
|
|
154 }
|
|
155
|
|
156 if ((p->dt1 > 400) && (p->dt1 <= 500)) {
|
|
157 rinkf2 = 4;
|
|
158 if (jiki->x + 15 - rinkx > 5) {
|
18
|
159 p->vx = -1;
|
49
|
160 } else if (jiki->x + 15 - rinkx > 5) {
|
|
161 p->vx = +1;
|
|
162 } else {
|
|
163 p->vx = 0;
|
18
|
164 }
|
|
165 p->x += p->vx;
|
|
166 rinkx = p->x;
|
|
167 rinky = p->y;
|
|
168 }
|
49
|
169
|
|
170 if (p->dt1 > 500) {
|
|
171 rinkf2 = 5;
|
|
172 if (jiki->x + 15 - rinkx < -5) {
|
|
173 p->vx = -1;
|
|
174 } else if(jiki->x + 15 - rinkx > 5) {
|
|
175 p->vx = +1;
|
|
176 } else {
|
|
177 p->vx = 0;
|
18
|
178 }
|
49
|
179 p->x += p->vx;
|
|
180 rinkx = p->x;
|
|
181 rinky = p->y;
|
|
182 }
|
|
183 if (p->dt1 > 600) {
|
|
184 rinkf2 = 0;
|
|
185 p->dt1 = 0;
|
|
186 }
|
|
187 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
|
|
188 int *w_count = (int*)smanager->get_output(wbuf, 1);
|
|
189 int *w_fastebos = (int*)smanager->get_output(wbuf, 2);
|
|
190 int *w_rinkx = (int*)smanager->get_output(wbuf, 3);
|
|
191 int *w_rinky = (int*)smanager->get_output(wbuf, 4);
|
|
192 int *w_rinkf2 = (int*)smanager->get_output(wbuf, 5);
|
|
193 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 6);
|
|
194 sprite->flag = true;
|
|
195 sprite->length = length;
|
|
196
|
|
197 fastebos++;
|
|
198 p->dt1++;
|
|
199 count++;
|
|
200
|
|
201 DefSpriteEx(54, 16, 32, &sprite->data[index_count]);
|
|
202 index_count++;
|
|
203 PutSpriteEx(54, p->x, p->y, 2, 2, 1, &sprite->data[index_count]);
|
|
204
|
|
205 *q = *p;
|
|
206 *w_count = count;
|
|
207 *w_fastebos = fastebos;
|
|
208 *w_rinkx = rinkx;
|
|
209 *w_rinky = rinky;
|
|
210 *w_rinkf2 = rinkf2;
|
|
211 return 0;
|
18
|
212 }
|