comparison ppe/Atari.cc @ 2:6382d8f6a973

not working.
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Tue, 14 Dec 2010 00:54:07 +0900
parents
children a87dd72ce1b3
comparison
equal deleted inserted replaced
1:b4c797eee72a 2:6382d8f6a973
1 #include "Atari.h"
2 #include "tobject.h"
3 #include "Func.h"
4
5 SchedDefineTask(Atari);
6
7 static int
8 run(SchedTask *smanager, void *rbuf, void *wbuf)
9 {
10 int w = (int)smanager->get_param(0);
11 int h = (int)smanager->get_param(1);
12 int enemycount = (int)smanager->get_param(2);
13 int bomend = (int)smanager->get_param(3);
14 int tama_lv1_end = (int)smanager->get_param(4);
15 int tama_lv2_end = (int)smanager->get_param(5);
16 int laser_lv1_end = (int)smanager->get_param(6);
17 int infg_level = (int)smanager->get_param(7);
18
19 CollisionPropertyPtr property
20 = (CollisionPropertyPtr)smanager->get_input(rbuf, 0);
21
22 player *jiki = &property->jiki;
23 CHARACTER *p = &property->p;
24 tama1 *tlv3 = &property->tlv3;
25 stge lg = property->lg;
26 stge infg = property->infg;
27
28 tama1 *tama_lv1 = property->tama_lv1;
29 tama2 *tama_lv2 = property->tama_lv2;
30 laser *laser_lv1 = property->laser_lv1;
31 laser *laser_lv2 = property->laser_lv2;
32 laser *laser_lv3 = property->laser_lv3;
33 bomchar *bchar = property->bchar;
34
35 int i1, ex, ey;
36 int n;
37 ex = p->x;
38 ey = p->y;
39
40 //自機やられ
41 #ifndef INVISIBLE_MODE
42 if ((ex < jiki->x + 128 / 2) && (ex + w > jiki->x + 128 / 2)
43 && (ey < jiki->y + 128 / 2) && (ey + h > jiki->y + 128 / 2)
44 && jiki->muteki == 0) {
45 Bom(jiki->x + 16, jiki->y + 16, bomend, bchar);
46 jiki->bf = FALSE;
47 jiki->zanki--;
48 jiki->muteki = 120;
49
50 infg.stg = 0;
51 infg_level--;
52 if (infg_level < 0)
53 infg_level = 0;
54
55 property->infg = infg;
56 smanager->swap();
57 return 0;
58 }
59 #endif
60
61 if (p->tama == TRUE)
62 goto jumping;
63 for (i1 = 0; i1 < tama_lv1_end + 1; i1++) {
64
65 if ((tama_lv1[i1].x + 64 + 64 > ex)
66 && (ex + w > tama_lv1[i1].x + 16)
67 && (tama_lv1[i1].y + 128 > ey) && (tama_lv1[i1].y < ey + h)
68 && (tama_lv1[i1].r != -1)) {
69 tama_lv1[i1].r = -1;
70 p->vit -= TAMALV1P;
71 infg.stg++;
72 if (p->vit <= 0) {
73 infg.stg += 4;
74 Bom(p->x, p->y, bomend, bchar);
75 enemycount += (p->score *
76 ((infg.stg / 128) + infg_level + 1));
77 p->state = delete_chara;
78 p->collision = noaction;
79 p->f = FALSE;
80
81 property->infg = infg;
82 smanager->swap();
83 return 0;
84 }
85 }
86 if ((tama_lv1[i1].x + 64 > ex) && (ex + w > tama_lv1[i1].x)
87 && (tama_lv1[i1].y + 128 > ey) && (tama_lv1[i1].y < ey + h)
88 && (tama_lv1[i1].l != -1)) {
89 tama_lv1[i1].l = -1;
90 p->vit -= TAMALV1P;
91 infg.stg++;
92 if (p->vit <= 0) {
93 infg.stg += 4;
94 Bom(p->x, p->y, bomend, bchar);
95 enemycount += (p->score *
96 ((infg.stg / 128) + infg_level + 1));
97 p->state = delete_chara;
98 p->collision = noaction;
99 p->f = FALSE;
100
101 property->infg = infg;
102 smanager->swap();
103 return 0;
104 }
105 }
106 }
107
108 for (i1 = 0; i1 < tama_lv2_end + 1; i1++) {
109 if ((tama_lv2[i1].x + 128 + 64 > ex)
110 && (ex + w > tama_lv2[i1].x + 128)
111 && (tama_lv2[i1].y + 192 > ey) && (tama_lv2[i1].y < ey + h)
112 && (tama_lv2[i1].rr != -1)) {
113 tama_lv2[i1].rr = -1;
114 p->vit -= TAMALV2P;
115 infg.stg++;
116 if (p->vit <= 0) {
117 infg.stg += 4;
118 Bom(p->x, p->y, bomend, bchar);
119 enemycount += (p->score *
120 ((infg.stg / 128) + infg_level + 1));
121 p->state = delete_chara;
122 p->collision = noaction;
123 p->f = FALSE;
124
125 property->infg = infg;
126 smanager->swap();
127 return 0;
128 }
129 }
130
131 if ((tama_lv2[i1].x + 64 + 64 > ex)
132 && (ex + w > tama_lv2[i1].x + 16)
133 && (tama_lv2[i1].y - 32 + 192 > ey)
134 && (tama_lv2[i1].y - 32 < ey + h)
135 && (tama_lv2[i1].sr != -1)) {
136 tama_lv2[i1].sr = -1;
137 p->vit -= TAMALV2P;
138 infg.stg++;
139 if (p->vit <= 0) {
140 infg.stg += 4;
141 Bom(p->x, p->y, bomend, bchar);
142 enemycount += (p->score *
143 ((infg.stg / 128) + infg_level + 1));
144 p->state = delete_chara;
145 p->collision = noaction;
146 p->f = FALSE;
147
148 property->infg = infg;
149 smanager->swap();
150 return 0;
151 }
152 }
153 if ((tama_lv2[i1].x + 64 > ex) && (ex + w > tama_lv2[i1].x)
154 && (tama_lv2[i1].y - 32 + 192 > ey)
155 && (tama_lv2[i1].y - 32 < ey + h)
156 && (tama_lv2[i1].sl != -1)) {
157 tama_lv2[i1].sl = -1;
158 p->vit -= TAMALV2P;
159 infg.stg++;
160 if (p->vit <= 0) {
161 infg.stg += 4;
162 Bom(p->x, p->y, bomend, bchar);
163 enemycount += (p->score *
164 ((infg.stg / 128) + infg_level + 1));
165 p->state = delete_chara;
166 p->collision = noaction;
167 p->f = FALSE;
168
169 property->infg = infg;
170 smanager->swap();
171 return 0;
172 }
173 }
174 if ((tama_lv2[i1].x - 64 + 64 > ex)
175 && (ex + w > tama_lv2[i1].x - 64)
176 && (tama_lv2[i1].y + 192 > ey) && (tama_lv2[i1].y < ey + h)
177 && (tama_lv2[i1].ll != -1)) {
178 tama_lv2[i1].ll = -1;
179 p->vit -= TAMALV2P;
180 infg.stg++;
181 if (p->vit <= 0) {
182 infg.stg += 4;
183 Bom(p->x, p->y, bomend, bchar);
184 enemycount += (p->score *
185 ((infg.stg / 128) + infg_level + 1));
186 p->state = delete_chara;
187 p->collision = noaction;
188 p->f = FALSE;
189
190 property->infg = infg;
191 smanager->swap();
192 return 0;
193 }
194 }
195 }
196 if ((tlv3[0].r > 0) && (jiki->x < ex + w) && (jiki->x + 128 > ex)
197 && (jiki->y > ey + h)) {
198 p->vit -= TAMALV3P;
199 infg.stg++;
200 if (p->vit <= 0) {
201 infg.stg += 4;
202 Bom(p->x, p->y, bomend, bchar);
203 enemycount += (p->score *
204 ((infg.stg / 128) + infg_level + 1));
205 p->state = delete_chara;
206 p->collision = noaction;
207 p->f = FALSE;
208
209 property->infg = infg;
210 smanager->swap();
211 return 0;
212 }
213 }
214 jumping:
215 if ((tlv3[0].r > 0) && (jiki->x < ex + w) && (jiki->x + 128 > ex)
216 && (jiki->y + 128 > ey) && (jiki->y < ey + h)) {
217 p->vit -= TAMALV3P;
218 infg.stg++;
219 if (p->vit <= 0) {
220 infg.stg += 4;
221 Bom(p->x, p->y, bomend, bchar);
222 enemycount += (p->score *
223 ((infg.stg / 128) + infg_level + 1));
224 p->state = delete_chara;
225 p->collision = noaction;
226 p->f = FALSE;
227
228 property->infg = infg;
229 smanager->swap();
230 return 0;
231 }
232 }
233 /*laser lv1 */
234 for (i1 = 0; i1 < laser_lv1_end + 1; i1++) {
235 n = laser_lv1[i1].r * 128 / 4096;
236
237 if ((laser_lv1[i1].x + n > ex) && (ex + w > laser_lv1[i1].x)
238 && (laser_lv1[i1].y + n > ey) && (laser_lv1[i1].y < ey + h)
239 && (laser_lv1[i1].r != -1)) {
240 laser_lv1[i1].r = -1;
241 laser_lv1[i1].y = -1;
242 p->vit -= LASERLV1P;
243 infg.stg++;
244 if (p->vit <= 0) {
245 infg.stg += 4;
246 Bom(p->x, p->y, bomend, bchar);
247 enemycount += (p->score *
248 ((infg.stg / 128) + infg_level + 1));
249 p->state = delete_chara;
250 p->collision = noaction;
251 p->f = FALSE;
252
253 property->infg = infg;
254 smanager->swap();
255 return 0;
256 }
257 }
258 }
259 /*shield(laser lv2) */
260 if ((p->tama == TRUE) && (lg.stg > 0) &&
261 (laser_lv2[0].x + 128 > ex) && (ex + w > laser_lv2[0].x - 128)
262 && (laser_lv2[0].y + 128 > ey) && (laser_lv2[0].y - 128 < ey + h)
263 && (laser_lv2[0].r != 0)) {
264 p->vit -= LASERLV2P;
265 lg.stg -= 26;
266 infg.stg++;
267 if (p->vit <= 0) {
268 infg.stg += 4;
269 Bom(p->x, p->y, bomend, bchar);
270 enemycount += (p->score *
271 ((infg.stg / 128) + infg_level + 1));
272 p->state = delete_chara;
273 p->collision = noaction;
274 p->f = FALSE;
275
276 property->lg = lg;
277 property->infg = infg;
278 smanager->swap();
279 return 0;
280 }
281 }
282 /*bomber(laser lv3) */
283 if (laser_lv3[0].r < 62) {
284 for (i1 = 1; i1 < 128; i1++) {
285 if ((laser_lv3[i1].x + 128 > ex) && (ex + w > laser_lv3[i1].x)
286 && (laser_lv3[i1].y + 128 > ey)
287 && (laser_lv3[i1].y < ey + h)
288 && (laser_lv3[i1].r > 0)) {
289 tama_lv2[i1].rr = -1;
290 p->vit -= LASERLV3P;
291 infg.stg++;
292 if (p->vit <= 0) {
293 infg.stg += 4;
294 Bom(p->x, p->y, bomend, bchar);
295 enemycount += (p->score *
296 ((infg.stg / 128) + infg_level + 1));
297 p->state = delete_chara;
298 p->collision = noaction;
299 p->f = FALSE;
300
301 property->infg = infg;
302 smanager->swap();
303 return 0;
304 }
305 }
306 }
307 }
308 property->infg = infg;
309 smanager->swap();
310 return 0;
311 }