0
|
1 #include <stdio.h>
|
|
2 #include <stdlib.h>
|
|
3 #include <SDL.h>
|
|
4 #include "SDL_opengl.h"
|
|
5 #include "object.h"
|
|
6 #include "Character.h"
|
|
7 #include "Character_state.h"
|
|
8 #include "count2.h"
|
|
9 #include "schedule.h"
|
|
10 #include "bom.h"
|
|
11 #include "sankaku.h"
|
|
12 #include "sgoex.h"
|
|
13 #include "collision.h"
|
|
14 #include "debug.h"
|
|
15 #include "tama.h"
|
|
16
|
|
17 CHARACTER *kyeenemyno;
|
|
18 CHARACTER *tekino0;
|
|
19 CHARACTER *enemy_part1;
|
|
20 CHARACTER *enemy_part2;
|
|
21 CHARACTER *enemy_part3;
|
|
22 CHARACTER *enemy_part4;
|
|
23 CHARACTER *enemy_part5;
|
|
24
|
|
25 //int tekino0;
|
|
26 int rinkx;
|
|
27 int rinky;
|
|
28 int rinkf1 = 0, rinkf2 = 0;
|
|
29 CHARACTER *asteroiddt[200];
|
|
30 int asteroidi = 0;
|
|
31 int enemyfaste = 0;
|
|
32 int sf;
|
|
33 int amari;
|
|
34 int fastebos = 0;
|
|
35
|
|
36 CHARACTER * noaction(CHARACTER *p)
|
|
37 {
|
|
38 p->state = noaction;
|
|
39 return p;
|
|
40 }
|
|
41
|
|
42 CHARACTER * chara_state0(CHARACTER *p)
|
|
43 {
|
|
44 p->x += p->vx;
|
|
45 p->y += p->vy;
|
|
46 p->state = chara_state0;
|
|
47 //PutSprite(count, p->x, p->y, p->charano);
|
|
48 return p;
|
|
49 }
|
|
50
|
|
51 CHARACTER * chara_state1(CHARACTER *p)
|
|
52 {
|
|
53 p->x -= p->vx;
|
|
54 p->y -= p->vy;
|
|
55 p->state = chara_state1;
|
|
56 //PutSprite(count, p->x, p->y, p->charano);
|
|
57 return p;
|
|
58 }
|
|
59
|
|
60 CHARACTER * chara_state2(CHARACTER *p)
|
|
61 {
|
|
62 p->vy -= 0.25;
|
|
63 p->y += p->vy;
|
|
64 p->state = chara_state2;
|
|
65 //PutSprite(count, p->x, p->y, p->charano);
|
|
66 return p;
|
|
67 }
|
|
68
|
|
69 CHARACTER * chara_state3(CHARACTER *p)
|
|
70 {
|
|
71 p->x += p->vx;
|
|
72 p->y += p->vy;
|
|
73 if((p->dt1 == 60) ||
|
|
74 (p->dt1 == 90) ||
|
|
75 (p->dt1 == 30))
|
|
76 {
|
|
77 Puttama(0, p->x, p->y);
|
|
78 }
|
|
79 p->dt1++;
|
|
80 p->state = chara_state3;
|
|
81 //PutSprite(count, p->x, p->y, p->charano);
|
|
82 return p;
|
|
83 }
|
|
84
|
|
85 CHARACTER * chara_state4(CHARACTER *p)
|
|
86 {
|
|
87 p->y += p->vy;
|
|
88 p->x += p->vx;
|
|
89 if(p->y < jiki.y && p->y + 16 > jiki.y)
|
|
90 {
|
|
91 p->vy = -2;
|
|
92 p->vx = ((jiki.x > p->x) ? 4 : -4);
|
|
93 p->state = chara_state7;
|
|
94 }
|
|
95 else p->state = chara_state4;
|
|
96 //PutSprite(count, p->x, p->y, p->charano);
|
|
97 return p;
|
|
98 }
|
|
99
|
|
100 CHARACTER * chara_state5(CHARACTER *p)
|
|
101 {
|
|
102 p->y += p->vy;
|
|
103 p->x += p->vx;
|
|
104 if(p->y + 96 < jiki.y
|
|
105 && p->y + 128 > jiki.y)
|
|
106 {
|
|
107 p->vy = -2;
|
|
108 p->vx = ((jiki.x > p->x) ? 4 : -4);
|
|
109 p->state = chara_state0;
|
|
110 }
|
|
111 else p->state = chara_state5;
|
|
112 //PutSprite(count, p->x, p->y, p->charano);
|
|
113 return p;
|
|
114 }
|
|
115
|
|
116 CHARACTER * chara_state6(CHARACTER *p)
|
|
117 {
|
|
118 p->y += p->vy;
|
|
119 p->x += p->vx;
|
|
120 if(p->y + 96 < jiki.y
|
|
121 && p->y + 128 > jiki.y)
|
|
122 {
|
|
123 p->vy = 2;
|
|
124 p->vx = ((jiki.x > p->x) ? 4 : -4);
|
|
125 p->state = chara_state0;
|
|
126 }
|
|
127 else p->state = chara_state6;
|
|
128 //PutSprite(count, p->x, p->y, p->charano);
|
|
129 return p;
|
|
130 }
|
|
131
|
|
132 CHARACTER * chara_state7(CHARACTER *p)
|
|
133 {
|
|
134 p->x += p->vx;
|
|
135 p->y += p->vy;
|
|
136 if((p->dt1 == 60) || (p->dt1 == 90)
|
|
137 || (p->dt1 == 30))
|
|
138 {
|
|
139 Puttama(1, p->x, p->y);
|
|
140 }
|
|
141 p->dt1++;
|
|
142 p->state = chara_state7;
|
|
143 //PutSprite(count, p->x, p->y, p->charano);
|
|
144 return p;
|
|
145 }
|
|
146
|
|
147 // state1 boss patern
|
|
148 CHARACTER * chara_state8(CHARACTER *p)
|
|
149 {
|
|
150 if(p->y < 520)
|
|
151 {
|
|
152 tekino0 = p;
|
|
153 kyeenemyno = p;
|
|
154 p->y += p->vy;
|
|
155 count++;
|
|
156 DefSpriteEx(p->charano, 16*4, 32*4);
|
|
157 PutSpriteEx(p->charano, (p->x * 4), (p->y * 4), 0.2, 0.2, 1);
|
|
158 p->dt1 = 512;
|
|
159 p->s = 0.125;
|
|
160 p->state = chara_state8;
|
|
161 return p;
|
|
162 }
|
|
163 p->state = chara_state9;
|
|
164 return p;
|
|
165 }
|
|
166
|
|
167 CHARACTER * chara_state9(CHARACTER *p)
|
|
168 {
|
|
169 if(p->s <= 2)
|
|
170 {
|
|
171 p->s += 0.05;
|
|
172 p->y -= 12;
|
|
173 count++;
|
|
174 DefSpriteEx(54, 16*4, 32*4);
|
|
175 PutSpriteEx(54, (p->x * 4), (p->y * 4), p->s, p->s, 1);
|
|
176 p->state = chara_state9;
|
|
177 return p;
|
|
178 }
|
|
179 count++;
|
|
180 DefSpriteEx(54, 16, 32);
|
|
181 PutSpriteEx(54, p->x, p->y, p->s, p->s, 1);
|
|
182 rinkx = p->x;
|
|
183 rinky = p->y;
|
|
184 Putenemy(5, rinkx - 16, rinky - 16, 1, 0, chara_state10);
|
|
185 Putenemy(5, rinkx - 16, rinky - 16, -1, 0, chara_state10);
|
|
186 p->state = chara_state11;
|
|
187 p->dt1 = 8192;
|
|
188 return p;
|
|
189 }
|
|
190
|
|
191
|
|
192 CHARACTER * chara_state10(CHARACTER *p)
|
|
193 {
|
|
194 if(p->dt1 < 48)
|
|
195 {
|
|
196 p->x += p->vx;
|
|
197 p->y += p->vy;
|
|
198 p->dt1++;
|
|
199 p->state = chara_state10;
|
|
200 //PutSprite(count, p->x, p->y,
|
|
201 return p;
|
|
202 }
|
|
203 rinkf1 = 1;
|
|
204 p->dt1 = rinkx;
|
|
205 p->dt2 = rinky;
|
|
206 p->state = chara_state13;
|
|
207 return p;
|
|
208 }
|
|
209
|
|
210
|
|
211 CHARACTER * chara_state11(CHARACTER *p)
|
|
212 {
|
|
213 if(rinkf1 == 0)
|
|
214 {
|
|
215 count++;
|
|
216 DefSpriteEx(54, 16, 32);
|
|
217 PutSpriteEx(54, p->x, p->y, p->s, p->s, 1);
|
|
218 p->state = chara_state11;
|
|
219 return p;
|
|
220 }
|
|
221 p->dt1 = 0;
|
|
222 p->dt2 = 0;
|
|
223 p->state = chara_state12;
|
|
224 return p;
|
|
225 }
|
|
226
|
|
227 CHARACTER * chara_state12(CHARACTER *p)
|
|
228 {
|
|
229 if(fastebos > 60*60)
|
|
230 {
|
|
231 if(p->y > 240+32)
|
|
232 {
|
|
233 p->state = delete_chara;
|
|
234 }
|
|
235 p->y += 3;
|
|
236 rinky += 3;
|
|
237 count++;
|
|
238 DefSpriteEx(54, 16, 32);
|
|
239 PutSpriteEx(54, p->x, p->y, 2, 2, 1);
|
|
240 p->state = chara_state12;
|
|
241 return p;
|
|
242 }
|
|
243 if(p->dt1 <= 60)
|
|
244 {
|
|
245 if(jiki.x + 15 - rinkx < -5)
|
|
246 {
|
|
247 p->vx = -0.8;
|
|
248 }
|
|
249 else if(jiki.x + 15 - rinkx > 5)
|
|
250 {
|
|
251 p->vx = +0.8;
|
|
252 }
|
|
253 else p->vx = 0;
|
|
254 rinkx = p->x;
|
|
255 rinky = p->y;
|
|
256 }
|
|
257 if((p->dt1 > 60) && (p->dt1 <= 70))
|
|
258 {
|
|
259 if(p->dt1 % 2 == 1)
|
|
260 {
|
|
261 Puttama(0, rinkx - 16, rinky);
|
|
262 Puttama(0, rinkx, rinky);
|
|
263 Puttama(0, rinkx + 16, rinky);
|
|
264 }
|
|
265 }
|
|
266 if((p->dt1 > 180) && (p->dt1 <= 240))
|
|
267 {
|
|
268 if(p->dt1 % 2 == 1)
|
|
269 {
|
|
270 rinkf2 = 1;
|
|
271 Puttama(2, rinkx - 16, p->y - 32);
|
|
272 Puttama(3, rinkx + 32 - 16, p->y - 32);
|
|
273 }
|
|
274 else
|
|
275 {
|
|
276 rinkf2 = 2;
|
|
277 }
|
|
278 }
|
|
279 if(p->dt1 > 240)
|
|
280 {
|
|
281 rinkf2 = 2;
|
|
282 }
|
|
283 if((p->dt1 > 240) && (p->dt1 <= 400))
|
|
284 {
|
|
285 count++;
|
|
286 PutSprite(count, rinkx - 16, rinky + 32,
|
|
287 58 + p->dt1 % 4);
|
|
288 }
|
|
289 if((p->dt1 > 300) && (p->dt1 <= 400))
|
|
290 {
|
|
291 rinkf2 = 3;
|
|
292 if(jiki.x + 15 - rinkx < -5)
|
|
293 {
|
|
294 p->vx = -1;
|
|
295 }
|
|
296 else if(jiki.x + 15 - rinkx > 5)
|
|
297 {
|
|
298 p->vx = +1;
|
|
299 }
|
|
300 else p->vx = 0;
|
|
301 p->x += p->vx;
|
|
302 rinkx = p->x;
|
|
303 rinky = p->y;
|
|
304 Puttama(4, rinkx - 8, rinky + 16);
|
|
305 }
|
|
306 if((p->dt1 > 400) && (p->dt1 <= 500))
|
|
307 {
|
|
308 rinkf2 = 4;
|
|
309 if(jiki.x + 15 - rinkx > 5)
|
|
310 {
|
|
311 p->vx = -1;
|
|
312 }
|
|
313 else if(jiki.x + 15 - rinkx > 5)
|
|
314 {
|
|
315 p->vx = +1;
|
|
316 }
|
|
317 else p->vx = 0;
|
|
318 p->x += p->vx;
|
|
319 rinkx = p->x;
|
|
320 rinky = p->y;
|
|
321 }
|
|
322 if(p->dt1 > 500)
|
|
323 {
|
|
324 rinkf2 = 5;
|
|
325 if(jiki.x + 15 - rinkx < -5)
|
|
326 {
|
|
327 p->vx = -1;
|
|
328 }
|
|
329 else if(jiki.x + 15 - rinkx > 5)
|
|
330 {
|
|
331 p->vx = +1;
|
|
332 }
|
|
333 else p->vx = 0;
|
|
334 p->x += p->vx;
|
|
335 rinkx = p->x;
|
|
336 rinky = p->y;
|
|
337 }
|
|
338 if(p->dt1 > 600)
|
|
339 {
|
|
340 rinkf2 = 0;
|
|
341 p->dt1 = 0;
|
|
342 }
|
|
343 fastebos++;
|
|
344 p->dt1++;
|
|
345 count++;
|
|
346 DefSpriteEx(54, 16, 32);
|
|
347 PutSpriteEx(54, p->x, p->y, 2, 2, 1);
|
|
348 return p;
|
|
349 }
|
|
350
|
|
351
|
|
352 CHARACTER * chara_state13(CHARACTER *p)
|
|
353 {
|
|
354 if(tekino0->f == FALSE){
|
|
355 Bom(p->x, p->y);
|
|
356 p->f = FALSE;
|
|
357 p->state = delete_chara;
|
|
358 p->collision = noaction;
|
|
359 return p;
|
|
360 }
|
|
361
|
|
362 p->x += rinkx - p->dt1;
|
|
363 p->y += rinky - p->dt2;
|
|
364 p->dt1 = rinkx;
|
|
365 p->dt2 = rinky;
|
|
366 if(rinkf2 == 1)
|
|
367 {
|
|
368 if(p->x > rinkx)
|
|
369 {
|
|
370 Puttama(2, p->x + 32, p->y);
|
|
371 }
|
|
372 if(p->x < rinkx)
|
|
373 {
|
|
374 Puttama(3, p->x, p->y);
|
|
375 }
|
|
376 }
|
|
377 if(rinkf2 == 4)
|
|
378 {
|
|
379 count++;
|
|
380 PutSprite(count, p->x, p->y + 56, 58+filpcount % 4);
|
|
381 }
|
|
382 if(rinkf2 == 5)
|
|
383 {
|
|
384 if(p->x > rinkx)
|
|
385 {
|
|
386 Puttama(5, p->x + 8, p->y + 24);
|
|
387 }
|
|
388 if(p->x < rinkx)
|
|
389 {
|
|
390 Puttama(5, p->x + 8, p->y + 24);
|
|
391 }
|
|
392 }
|
|
393 return p;
|
|
394 }
|
|
395
|
|
396
|
|
397 CHARACTER * chara_state20(CHARACTER *p)
|
|
398 {
|
|
399 p->x += p->vx;
|
|
400 p->y += p->vy;
|
|
401 p->vy -= 0.5;
|
|
402 p->vy += 0.4;
|
|
403 return p;
|
|
404 }
|
|
405
|
|
406 CHARACTER * chara_state21(CHARACTER *p)
|
|
407 {
|
|
408 p->x += p->vx;
|
|
409 p->y += p->vy;
|
|
410 p->vx += 0.5;
|
|
411 p->vy += 0.4;
|
|
412 return p;
|
|
413 }
|
|
414
|
|
415 //ここまでgetate boss
|
|
416
|
|
417
|
|
418 CHARACTER * chara_state22(CHARACTER *p)
|
|
419 {
|
|
420 sf = rand() % 4;
|
|
421 if((sf == 0) || (sf == 1))
|
|
422 {
|
|
423 p->x = -35;
|
|
424 p->y = rand() % (120 - 35);
|
|
425 p->vx = (rand() % 4 + 1);
|
|
426 p->vy = rand() % 3 + 1;
|
|
427 p->state = chara_state23;
|
|
428 }
|
|
429 if((sf == 2))
|
|
430 {
|
|
431 p->x = rand() % 290;
|
|
432 p->y = -30;
|
|
433 p->vx = rand() % 3 - 1;
|
|
434 p->vy = (rand() % 4 + 1);
|
|
435 p->state = chara_state23;
|
|
436 }
|
|
437 if(sf == 3)
|
|
438 {
|
|
439 p->x = 320;
|
|
440 p->y = rand() % (120 - 35);
|
|
441 p->vx = (rand() % 4 + 1) * -1;
|
|
442 p->vy = rand() % 3 -1;
|
|
443 p->state = chara_state23;
|
|
444 }
|
|
445 return p;
|
|
446 }
|
|
447
|
|
448 CHARACTER * chara_state23(CHARACTER *p)
|
|
449 {
|
|
450 p=asteroid(p);
|
|
451 return p;
|
|
452 }
|
|
453
|
|
454 CHARACTER * chara_state24(CHARACTER *p)
|
|
455 {
|
|
456 kyeenemyno = p;
|
|
457 tekino0 = 0;
|
|
458 enemy_part1 = p->next;
|
|
459 enemy_part2 = enemy_part1->next;
|
|
460 enemy_part3 = enemy_part2->next;
|
|
461 enemy_part4 = enemy_part3->next;
|
|
462 enemy_part5 = enemy_part4->next;
|
|
463 rinkx = 0;
|
|
464 rinky = 0;
|
|
465 rinkf1 = 0;
|
|
466 rinkf2 = 0;
|
|
467 p->state = chara_state25;
|
|
468 return p;
|
|
469 }
|
|
470
|
|
471 CHARACTER * chara_state25(CHARACTER *p)
|
|
472 {
|
|
473 if(p->dt1 <= 360)
|
|
474 {
|
|
475 p->x = Mycos(p->dt1) * 30 / SANKAKU + 82 + 32;
|
|
476 p->y = Mysin(p->dt1) * 30 / SANKAKU + 30;
|
|
477 }
|
|
478 if(p->dt1 > 360)
|
|
479 {
|
|
480 p->x = Mycos(p->dt1) * 30 * -1 /SANKAKU + 142 + 32;
|
|
481 p->y = Mysin(p->dt1) * 30 / SANKAKU + 30;
|
|
482 }
|
|
483 count++;
|
|
484 PutSprite(count, p->x - 42, p->y, 64);
|
|
485 amari = rand() % 160;
|
|
486 if((amari == 1) && (enemy_part5->f == TRUE))
|
|
487 {
|
|
488 p->state = chara_state26;
|
|
489 rinkf1 = 1;
|
|
490 }
|
|
491 if((amari == 2) && (enemy_part1->f == TRUE))
|
|
492 {
|
|
493 p->state = chara_state27;
|
|
494 rinkf1 = 5;
|
|
495 rinkx = 0;
|
|
496 return p;
|
|
497 }
|
|
498 if((enemy_part5->f == TRUE) && (enemy_part1->f != TRUE))
|
|
499 {
|
|
500 p->state = chara_state28;
|
|
501 }
|
|
502 p->dt1 += 3;
|
|
503 if(p->dt1 == 720)
|
|
504 {
|
|
505 p->dt1 = 0;
|
|
506 }
|
|
507 return p;
|
|
508 }
|
|
509
|
|
510 CHARACTER * chara_state26(CHARACTER *p)
|
|
511 {
|
|
512 if((p->dt2 > 50) && (p->dt2 < 100))
|
|
513 {
|
|
514 rinkf1 = 2;
|
|
515 }
|
|
516 if(p->dt2 > 100)
|
|
517 {
|
|
518 rinkf1 = 3;
|
|
519 }
|
|
520 if(p->dt2 == 400)
|
|
521 {
|
|
522 rinkf1 = 4;
|
|
523 }
|
|
524 count++;
|
|
525 PutSprite(count, p->x - 42, p->y, 64);
|
|
526 if(p->dt2 == 401)
|
|
527 {
|
|
528 p->dt2 = 0;
|
|
529 rinkf1 = 0;
|
|
530 p->state = chara_state25;
|
|
531 return p;
|
|
532 }
|
|
533 p->dt2++;
|
|
534 return p;
|
|
535 }
|
|
536
|
|
537 CHARACTER * chara_state27(CHARACTER *p) //rocket punch
|
|
538 {
|
|
539 if((p->dt2 > 50) && (p->dt2 < 60) && (p->x > -24) && (p->y > -24))
|
|
540 {
|
|
541 rinkf1 = 6;
|
|
542 rinkx -= 4;
|
|
543 p->x -= 4;
|
|
544 p->y -= 4;
|
|
545 }
|
|
546 if(p->dt2 == 80)
|
|
547 {
|
|
548 rinkf1 = 7;
|
|
549 }
|
|
550 if(p->dt2 == 81)
|
|
551 {
|
|
552 rinkf1 = 8;
|
|
553 }
|
|
554 if(p->dt2 == 124)
|
|
555 {
|
|
556 rinkf1 = 9;
|
|
557 }
|
|
558 if(p->dt2 == 400)
|
|
559 {
|
|
560 rinkf1 = 10;
|
|
561 }
|
|
562 if(p->dt2 == 444)
|
|
563 {
|
|
564 rinkf1 = 11;
|
|
565 }
|
|
566 if(p->dt2 == 500)
|
|
567 {
|
|
568 rinkf1 = 12;
|
|
569 }
|
|
570 if((p->dt2 > 80) && (p->dt2 < 200))
|
|
571 {
|
|
572 if((rinkx != 0) && (p->dt2 % 2 == 1))
|
|
573 {
|
|
574 rinkx++;
|
|
575 p->x++;
|
|
576 p->y++;
|
|
577 }
|
|
578 }
|
|
579 count++;
|
|
580 PutSprite(count, p->x - 32, p->y, 6);
|
|
581 if(rinkf1 == 12)
|
|
582 {
|
|
583 p->dt2 = 0;
|
|
584 rinkf1 = 0;
|
|
585 rinkx = 0;
|
|
586 p->state = chara_state25;
|
|
587 return p;
|
|
588 }
|
|
589 p->dt2++;
|
|
590 return p;
|
|
591 }
|
|
592 CHARACTER * chara_state28(CHARACTER *p)
|
|
593 {
|
|
594 if (p->dt1 <= 360)
|
|
595 {
|
|
596 p->x = Mycos(p->dt1) * 30 / SANKAKU + 82 + 32;
|
|
597 p->y = Mysin(p->dt1) * 30 / SANKAKU + 30;
|
|
598 }
|
|
599 if (p->dt1 > 360)
|
|
600 {
|
|
601 p->x = Mycos(p->dt1) * 30 * -1 / SANKAKU + 142 + 32;
|
|
602 p->y = Mysin(p->dt1) * 30 / SANKAKU + 30;
|
|
603 }
|
|
604 count++;
|
|
605 PutSprite(count, p->x - 42, p->y, 64);
|
|
606 if (p->dt1 % 30 == 3)
|
|
607 {
|
|
608 Putenemy(24, p->x + 14,
|
|
609 p->y + 14,
|
|
610 (rand() % 5 + 0.5) * (rand() % 2 ==
|
|
611 1 ? -1 : 1),
|
|
612 (rand() % 5 + 0.5) * (rand() % 2 ==
|
|
613 1 ? -1 : 1), chara_state29);
|
|
614 }
|
|
615 p->dt1 += 3;
|
|
616 return p;
|
|
617 }
|
|
618
|
|
619
|
|
620 CHARACTER * chara_state29(CHARACTER *p)
|
|
621 {
|
|
622 p->x += p->vx;
|
|
623 p->y += p->vy;
|
|
624 if(p->dt1 % 18 == 1)
|
|
625 {
|
|
626 Puttama(0, p->x, p->y);
|
|
627 }
|
|
628 p->dt1++;
|
|
629 return p;
|
|
630 }
|
|
631
|
|
632
|
|
633 CHARACTER * chara_state30(CHARACTER *p)
|
|
634 {
|
|
635 p->x = p->x - 32;
|
|
636 p->y = p->y;
|
|
637 return p;
|
|
638 }
|
|
639
|
|
640 CHARACTER * chara_state31(CHARACTER *p) //right hand
|
|
641 {
|
|
642
|
|
643 if((enemy_part3->f == FALSE) || (kyeenemyno->f == FALSE))
|
|
644 {
|
|
645 Bom(p->x, p->y);
|
|
646 p->f = FALSE;
|
|
647 p->state = delete_chara;
|
|
648 p->collision = noaction;
|
|
649 return p;
|
|
650 }
|
|
651
|
|
652 if(rinkf1 == 0)
|
|
653 {
|
|
654 p->x = kyeenemyno->x + 40;
|
|
655 p->y = kyeenemyno->y + 28;
|
|
656 p->dt2 = 0;
|
|
657 }
|
|
658 if(rinkf1 == 5)
|
|
659 {
|
|
660 p->x = kyeenemyno->x + 52;
|
|
661 p->y = kyeenemyno->y;
|
|
662 count++;
|
|
663 PutSprite(count, p->x - 4, p->y - 20, 80 + p->dt2 % 4);
|
|
664 p->dt2++;
|
|
665 }
|
|
666 if(rinkf1 == 6)
|
|
667 {
|
|
668 if(p->y < 240 - 40)
|
|
669 {
|
|
670 p->y += 6;
|
|
671 }
|
|
672 else
|
|
673 {
|
|
674 return p;
|
|
675 }
|
|
676 count++;
|
|
677 PutSprite(count, p->x - 4, p->y - 20, 90 + p->dt2 % 4);
|
|
678 p->dt2++;
|
|
679 }
|
|
680 if(rinkf1 == 7)
|
|
681 {
|
|
682 Putenemy(22, p->x + 14, p->y + 14, 0, 0, chara_state40);
|
|
683 return p;
|
|
684 }
|
|
685 if(rinkf1 == 11)
|
|
686 {
|
|
687 if(p->y + 20 != p->y)
|
|
688 {
|
|
689 p->y--;
|
|
690 }
|
|
691 else
|
|
692 {
|
|
693 return p;
|
|
694 }
|
|
695 count++;
|
|
696 PutSprite(count, p->x + 8, p->y + 44, 58 + p->dt2 % 4);
|
|
697 p->dt2++;
|
|
698 }
|
|
699 return p;
|
|
700 }
|
|
701
|
|
702
|
|
703 CHARACTER * chara_state32(CHARACTER *p) //left hand
|
|
704 {
|
|
705 if ((enemy_part4->f == FALSE)
|
|
706 || (kyeenemyno->f == FALSE))
|
|
707 {
|
|
708 Bom(p->x, p->y);
|
|
709 p->f = FALSE;
|
|
710 p->state = delete_chara;
|
|
711 p->collision = noaction;
|
|
712 return p;
|
|
713 }
|
|
714 p->x = kyeenemyno->x - 40;
|
|
715 p->y = kyeenemyno->y + 28;
|
|
716 if (rinkf1 == 5)
|
|
717 {
|
|
718 p->x = kyeenemyno->x - 24 + 4;
|
|
719 p->y = kyeenemyno->y + 28;
|
|
720 p->charano = enemystate[20].charano;
|
|
721 }
|
|
722 if (rinkf1 == 11)
|
|
723 {
|
|
724 p->charano = enemystate[14].charano;
|
|
725 }
|
|
726 if (rinkf1 == 7)
|
|
727 {
|
|
728 Putenemy(23, p->x + 14,
|
|
729 p->y + 14, 0, 0, chara_state41);
|
|
730 // rinkf1=8;
|
|
731 return p;
|
|
732 }
|
|
733 return p;
|
|
734 }
|
|
735
|
|
736
|
|
737 CHARACTER * chara_state33(CHARACTER *p) // right shoulder
|
|
738 {
|
|
739 if (kyeenemyno->f == FALSE)
|
|
740 {
|
|
741 Bom(p->x, p->y);
|
|
742 p->f = FALSE;
|
|
743 p->state = delete_chara;
|
|
744 p->collision = noaction;
|
|
745 return p;
|
|
746 }
|
|
747 p->x = kyeenemyno->x + 32;
|
|
748 p->y = kyeenemyno->y;
|
|
749 if (rinkf1 == 5)
|
|
750 {
|
|
751 p->x = kyeenemyno->x + 32 - 4;
|
|
752 p->y = kyeenemyno->y;
|
|
753 p->charano = enemystate[19].charano;
|
|
754 }
|
|
755 if (rinkf1 == 6)
|
|
756 {
|
|
757 p->charano = enemystate[11].charano;
|
|
758 }
|
|
759 return p;
|
|
760 }
|
|
761
|
|
762
|
|
763 CHARACTER * chara_state34(CHARACTER *p) //left shoulder
|
|
764 {
|
|
765 if (kyeenemyno->f == FALSE)
|
|
766 {
|
|
767 Bom(p->x, p->y);
|
|
768 p->f = FALSE;
|
|
769 p->state = delete_chara;
|
|
770 p->collision = noaction;
|
|
771 return p;
|
|
772 }
|
|
773 p->x = kyeenemyno->x - 32;
|
|
774 p->y = kyeenemyno->y;
|
|
775 if (rinkf1 == 5)
|
|
776 {
|
|
777 p->charano = enemystate[21].charano;
|
|
778 }
|
|
779 if (rinkf1 == 6)
|
|
780 {
|
|
781 p->charano = enemystate[12].charano;
|
|
782 }
|
|
783 return p;
|
|
784 }
|
|
785
|
|
786 CHARACTER * chara_state35(CHARACTER *p) // bust
|
|
787 {
|
|
788 if (kyeenemyno->f == FALSE)
|
|
789 {
|
|
790 Bom(p->x, p->y);
|
|
791 p->f = FALSE;
|
|
792 p->state = delete_chara;
|
|
793 p->collision = noaction;
|
|
794 return p;
|
|
795 }
|
|
796 p->x = kyeenemyno->x;
|
|
797 p->y = kyeenemyno->y + 32;
|
|
798 if (rinkf1 == 1)
|
|
799 {
|
|
800 p->charano = enemystate[16].charano;
|
|
801 }
|
|
802 if (rinkf1 == 2)
|
|
803 {
|
|
804 count++;
|
|
805 PutSprite(count, p->x - 10,
|
|
806 p->y + 16,
|
|
807 58 + p->dt2 % 4);
|
|
808 count++;
|
|
809 PutSprite(count, p->x + 10,
|
|
810 p->y + 16,
|
|
811 58 + p->dt2 % 4);
|
|
812 p->dt2++;
|
|
813 }
|
|
814 if (rinkf1 == 3)
|
|
815 {
|
|
816 count++;
|
|
817 PutSprite(count, p->x - 10,
|
|
818 p->y + 16,
|
|
819 58 + p->dt2 % 4);
|
|
820 count++;
|
|
821 PutSprite(count, p->x + 10,
|
|
822 p->y + 16,
|
|
823 58 + p->dt2 % 4);
|
|
824 if (p->dt2 % 20 == 1)
|
|
825 {
|
|
826 Puttama(7, p->x, p->y + 16);
|
|
827 Puttama(7, p->x + 20,
|
|
828 p->y + 16);
|
|
829 }
|
|
830 p->dt2++;
|
|
831 }
|
|
832 if (rinkf1 == 4) {
|
|
833 p->charano = enemystate[15].charano;
|
|
834 p->dt2 = 0;
|
|
835 }
|
|
836 return p;
|
|
837 }
|
|
838
|
|
839
|
|
840 CHARACTER * chara_state40(CHARACTER *p) //arm vulkan
|
|
841 {
|
|
842 if (enemy_part1->f == FALSE)
|
|
843 {
|
|
844 Bom(p->x, p->y);
|
|
845 p->f = FALSE;
|
|
846 p->state = delete_chara;
|
|
847 p->collision = noaction;
|
|
848 return p;
|
|
849 }
|
|
850 if ((rinkf1 == 8) && (p->dt1 % 3 == 1))
|
|
851 {
|
|
852 if ((p->dt2 < 16))
|
|
853 {
|
|
854 p->dt2++;
|
|
855 DefSprite(76, "boss2_rightarm_b", 16, p->dt2, 480, boss);
|
|
856 }
|
|
857 else
|
|
858 {
|
|
859 // rinkf1=9;
|
|
860 return p;
|
|
861 }
|
|
862 }
|
|
863 if (rinkf1 == 9)
|
|
864 {
|
|
865 if (p->dt1 % 15 == 1)
|
|
866 {
|
|
867 Puttama(8, p->x, p->y);
|
|
868 }
|
|
869 }
|
|
870 if (rinkf1 == 10)
|
|
871 {
|
|
872 if (p->dt2 != 0)
|
|
873 {
|
|
874 p->dt2--;
|
|
875 DefSprite(76, "boss2_rightarm_b", 16, p->dt2, 480, boss);
|
|
876 }
|
|
877 else
|
|
878 {
|
|
879 p->f = FALSE;
|
|
880 p->state = delete_chara;
|
|
881 p->collision = noaction;
|
|
882 // rinkf1=11;
|
|
883 }
|
|
884 }
|
|
885 p->dt1++;
|
|
886 return p;
|
|
887 }
|
|
888
|
|
889
|
|
890 CHARACTER * chara_state41(CHARACTER *p) //left arm up arm vulkan
|
|
891 {
|
|
892 if (enemy_part2->f == FALSE)
|
|
893 {
|
|
894 Bom(p->x, p->y);
|
|
895 p->f = FALSE;
|
|
896 p->state = delete_chara;
|
|
897 p->collision = noaction;
|
|
898 return p;
|
|
899 }
|
|
900 p->x = kyeenemyno->x - 20 - 7;
|
|
901 p->y = kyeenemyno->y + 28 + 15;
|
|
902 if ((rinkf1 == 8) && (p->dt1 % 3 == 1))
|
|
903 {
|
|
904 if ((p->dt2 < 16))
|
|
905 {
|
|
906 p->dt2++;
|
|
907 DefSprite(77, "boss2_leftarmbattery", p->dt2, 16, 480, boss); /*左腕アップアーム砲 */
|
|
908 }
|
|
909 else
|
|
910 {
|
|
911 rinkf1 = 9;
|
|
912 return p;
|
|
913 }
|
|
914 }
|
|
915 if (rinkf1 == 9)
|
|
916 {
|
|
917 if (p->dt1 % 15 == 1)
|
|
918 {
|
|
919 Puttama(9 + rand() % 2, p->x, p->y);
|
|
920 }
|
|
921 }
|
|
922 if (rinkf1 == 10)
|
|
923 {
|
|
924 if (p->dt2 != 0)
|
|
925 {
|
|
926 p->dt2--;
|
|
927 DefSprite(77, "boss2_leftarmbattery", p->dt2, 16, 480, boss);
|
|
928 }
|
|
929 else
|
|
930 {
|
|
931 p->f = FALSE;
|
|
932 p->state = delete_chara;
|
|
933 p->collision = noaction;
|
|
934 return p;
|
|
935 // rinkf1=11;
|
|
936 }
|
|
937 }
|
|
938 p->dt1++;
|
|
939 return p;
|
|
940 }
|
|
941
|
|
942
|
|
943 CHARACTER * chara_state400(CHARACTER *p)
|
|
944 {
|
|
945 p->vy++;
|
|
946 p->y += p->vy / 4;
|
|
947 p->state = chara_state400;
|
|
948 return p;
|
|
949 }
|
|
950
|
|
951
|
|
952 CHARACTER * chara_state401(CHARACTER *p)
|
|
953 {
|
|
954 p->vx++;
|
|
955 p->x += p->vx / 8;
|
|
956 if (p->x > (jiki.x - 32))
|
|
957 {
|
|
958 p->vy--;
|
|
959 }
|
|
960 p->y += p->vy / 8;
|
|
961 if (p->dt1 % 50 == 37)
|
|
962 {
|
|
963 Puttama(1, p->x + 8, p->y + 24);
|
|
964 }
|
|
965 p->dt1++;
|
|
966 return p;
|
|
967 }
|
|
968
|
|
969
|
|
970 CHARACTER * chara_state402(CHARACTER *p)
|
|
971 {
|
|
972 p->vx--;
|
|
973 p->x += p->vx / 8;
|
|
974 if (p->x < (jiki.x + 32))
|
|
975 {
|
|
976 p->vy--;
|
|
977 }
|
|
978 p->y += p->vy / 8;
|
|
979 if (p->dt1 % 50 == 37)
|
|
980 {
|
|
981 Puttama(1, p->x + 8, p->y + 24);
|
|
982 }
|
|
983 p->dt1++;
|
|
984 return p;
|
|
985 }
|
|
986
|
|
987
|
|
988 CHARACTER * chara_state410(CHARACTER *p)
|
|
989 {
|
|
990 kyeenemyno = p;
|
|
991 p->state = chara_state411;
|
|
992 return p;
|
|
993 }
|
|
994
|
|
995
|
|
996 CHARACTER * chara_state411(CHARACTER *p)
|
|
997 {
|
|
998 if (p->dt2 > 356)
|
|
999 {
|
|
1000 p->vx = -1;
|
|
1001 }
|
|
1002 if (p->dt2 < -398)
|
|
1003 {
|
|
1004 p->vx = 1;
|
|
1005 }
|
|
1006 if ((p->dt1) % 62 == 0)
|
|
1007 Putenemy(41,
|
|
1008 p->x,
|
|
1009 p->y,
|
|
1010 (int) -Mycos(p->dt1 / 16) * 4 /
|
|
1011 SANKAKU,
|
|
1012 (int) -Mysin(p->dt1 / 16) * 4 /
|
|
1013 SANKAKU, chara_state7);
|
|
1014 if ((p->dt1) % 13 == 0)
|
|
1015 Puttama(11, p->x + 32,
|
|
1016 p->y + 32);
|
|
1017
|
|
1018 p->dt2 += p->vx;
|
|
1019 p->dt1 += p->dt2 / 4;
|
|
1020
|
|
1021 p->x = jiki.x - 16 +
|
|
1022 Mycos(p->dt1 / 16) * 128 / SANKAKU;
|
|
1023 p->y = jiki.y - 16 +
|
|
1024 Mysin(p->dt1 / 16) * 128 / SANKAKU;
|
|
1025 if (p->x < 0)
|
|
1026 {
|
|
1027 p->x = 0;
|
|
1028 }
|
|
1029 if (p->x > 260)
|
|
1030 {
|
|
1031 p->x = 260;
|
|
1032 }
|
|
1033 if (p->y < 0)
|
|
1034 {
|
|
1035 p->y = 0;
|
|
1036 }
|
|
1037 if (p->y > 232)
|
|
1038 {
|
|
1039 p->y = 232;
|
|
1040 }
|
|
1041 return p;
|
|
1042 }
|
|
1043
|
|
1044
|
|
1045 CHARACTER * chara_state500(CHARACTER *p)
|
|
1046 {
|
|
1047 p->s = 0;
|
|
1048
|
|
1049 kyeenemyno = p;
|
|
1050 p->dt2++;
|
|
1051 p->dt2 %= 512;
|
|
1052 p->dt1++;
|
|
1053 count++;
|
|
1054 DefSpriteEx(100, 16, 16);
|
|
1055 // PutSprite(count, enemy[tekino].x + 16,
|
|
1056 // enemy[tekino].y + 16, 100);
|
|
1057 PutSpriteEx(100, p->x + 16, p->y + 16, 2, 2, p->dt1);
|
|
1058
|
|
1059 if (p->dt1 % (5 + p->dt2 / 8) == 1) {
|
|
1060 if (rand() % 2 == 1)
|
|
1061 Putenemy(24, p->x, p->y,
|
|
1062 (rand() % 5 + 0.5) * (rand() % 2 ==
|
|
1063 1 ? -1 : 1),
|
|
1064 (rand() % 5 + 0.5) * (rand() % 2 ==
|
|
1065 1 ? -1 : 1), chara_state501);
|
|
1066 else
|
|
1067 Putenemy(rand() % 2 + 1, p->x,
|
|
1068 p->y,
|
|
1069 (int) Mycos(p->dt1 / 4) * 4 /
|
|
1070 SANKAKU,
|
|
1071 (int) -Mysin(p->dt1 / 4) * 4 /
|
|
1072 SANKAKU, chara_state501);
|
|
1073 }
|
|
1074 if (p->dt1 == 50) {
|
|
1075 /*Putenemy(44,0,0,1,1,411); */
|
|
1076 }
|
|
1077 return p;
|
|
1078 }
|
|
1079
|
|
1080
|
|
1081 CHARACTER * chara_state501(CHARACTER *p)
|
|
1082 {
|
|
1083 p->x += p->vx;
|
|
1084 p->y += p->vy;
|
|
1085 if(p->dt1 % 32 == 1)
|
|
1086 {
|
|
1087 Puttama(11, p->x, p->y);
|
|
1088 }
|
|
1089 p->dt1++;
|
|
1090 return p;
|
|
1091 }
|
|
1092
|
|
1093
|
|
1094 CHARACTER * chara_state600(CHARACTER *p)
|
|
1095 {
|
|
1096 kyeenemyno = p;
|
|
1097 p->dt1 += 30;
|
|
1098 p->dt2++;
|
|
1099 p->dt1 %= 360;
|
|
1100 p->x += Mycos(p->dt1) * 4 / SANKAKU;
|
|
1101 p->y += Mysin(p->dt1) * 4 / SANKAKU;
|
|
1102 Puttama(11, p->x + 16, p->y + 16);
|
|
1103 Puttama(11, p->x + 32, p->y + 48);
|
|
1104 Puttama(11, p->x + 48, p->y + 16);
|
|
1105 if (p->dt2 > 240)
|
|
1106 p->state = chara_state601;
|
|
1107 if (p->x < 0)
|
|
1108 p->x = 0;
|
|
1109 if (p->x > 260)
|
|
1110 p->x = 260;
|
|
1111 if (p->y < 0)
|
|
1112 p->y = 0;
|
|
1113 if (p->y > 232)
|
|
1114 p->y = 232;
|
|
1115 return p;
|
|
1116 }
|
|
1117
|
|
1118
|
|
1119 CHARACTER * chara_state601(CHARACTER *p)
|
|
1120 {
|
|
1121 p->dt2++;
|
|
1122 if (p->x < jiki.x)
|
|
1123 p->vx++;
|
|
1124 if (p->x > jiki.x)
|
|
1125 p->vx--;
|
|
1126 p->x += p->vx;
|
|
1127 Putenemy(6, p->x + 16 + rand() % 32,
|
|
1128 p->y, 0, rand() % 4, chara_state400);
|
|
1129 if (p->x < 0)
|
|
1130 p->x = 0;
|
|
1131 if (p->x > 260)
|
|
1132 p->x = 260;
|
|
1133 if (p->y < 0)
|
|
1134 p->y = 0;
|
|
1135 if (p->y > 232)
|
|
1136 p->y = 232;
|
|
1137 if (p->dt2 > 800) {
|
|
1138 p->state = chara_state602;
|
|
1139 }
|
|
1140 return p;
|
|
1141 }
|
|
1142
|
|
1143
|
|
1144 CHARACTER * chara_state602(CHARACTER *p)
|
|
1145 {
|
|
1146 p->dt2++;
|
|
1147 Putenemy(24, p->x + 14, p->y + 14,
|
|
1148 (rand() % 5 + 0.5) * (rand() % 2 == 1 ? -1 : 1),
|
|
1149 (rand() % 5 + 0.5) * (rand() % 2 == 1 ? -1 : 1),
|
|
1150 chara_state29);
|
|
1151 if (p->dt2 > 1024) {
|
|
1152 p->state = chara_state600;
|
|
1153 p->dt2 = 0;
|
|
1154 }
|
|
1155 return p;
|
|
1156 }
|
|
1157
|
|
1158
|
|
1159 CHARACTER * asteroid(CHARACTER *p)
|
|
1160 {
|
|
1161 int i;
|
|
1162
|
|
1163 asteroiddt[asteroidi] = p;
|
|
1164 // if(asteroidi==0)
|
|
1165 // {
|
|
1166 p->x += p->vx;
|
|
1167 p->y += p->vy;
|
|
1168 // }
|
|
1169 if (asteroidi > 0) {
|
|
1170 for (i = 0; i < asteroidi; i++) {
|
|
1171 if ((asteroiddt[i]->x + 32 > p->x)
|
|
1172 && (p->x + 32 > asteroiddt[i]->x)
|
|
1173 && (asteroiddt[i]->y + 32 > p->y)
|
|
1174 && (asteroiddt[i]->y < p->y + 32)) {
|
|
1175 p->vx *= -1;
|
|
1176 p->vy *= -1;
|
|
1177 }
|
|
1178 }
|
|
1179 }
|
|
1180 asteroidi++;
|
|
1181 return p;
|
|
1182 }
|