5
|
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 "tokuten.h"
|
|
9 #include "collision.h"
|
|
10 #include "bom.h"
|
|
11 #include "count2.h"
|
|
12 #include "sgoex.h"
|
|
13 #include "TaskManager.h"
|
|
14 #include "Func.h"
|
|
15 #include "property.h"
|
|
16
|
|
17 extern SpriteTable sptable[DEFOBJ];
|
|
18 extern TaskManager *tmanager;
|
|
19
|
|
20 CollisionPropertyPtr
|
19
|
21 get_property()
|
5
|
22 {
|
8
|
23 CollisionPropertyPtr property = (CollisionPropertyPtr)tmanager->allocate(sizeof(CollisionProperty));
|
19
|
24
|
8
|
25 property->bomend = bomend;
|
5
|
26 property->enemycount = 0;
|
19
|
27 property->infg_level = infg_level;
|
5
|
28
|
|
29 property->lg = lg;
|
|
30 property->infg = infg;
|
19
|
31 property->jiki = jiki;
|
|
32 property->tlv3 = tlv3[0];
|
5
|
33
|
19
|
34 memcpy(property->tama_lv1, tama_lv1, sizeof(tama1)*20);
|
|
35 memcpy(property->tama_lv2, tama_lv2, sizeof(tama2)*20);
|
|
36 memcpy(property->laser_lv1, laser_lv1, sizeof(laser)*20);
|
|
37 memcpy(property->laser_lv2, laser_lv2, sizeof(laser)*20);
|
|
38 memcpy(property->laser_lv3, laser_lv3, sizeof(laser)*128);
|
|
39 memcpy(property->bchar, bchar, sizeof(bomchar)*100);
|
5
|
40
|
|
41 return property;
|
|
42 }
|
|
43
|
|
44 void
|
19
|
45 free_property(SchedTask *s, void *prop, void *arg)
|
5
|
46 {
|
|
47 CollisionPropertyPtr property = (CollisionPropertyPtr)prop;
|
|
48
|
8
|
49 if(bomend > property->bomend) {
|
|
50 bomend = property->bomend;
|
5
|
51 }
|
8
|
52 if(lg.stg > property->lg.stg) {
|
5
|
53 lg.stg -= 26;
|
|
54 }
|
8
|
55 infg_level = property->infg_level;
|
5
|
56 enemycount += property->enemycount;
|
|
57
|
7
|
58 jiki.bf = property->jiki.bf;
|
|
59 jiki.zanki = property->jiki.zanki;
|
|
60 jiki.muteki = property->jiki.muteki;
|
8
|
61
|
5
|
62 infg = property->infg;
|
|
63
|
|
64 memcpy(tama_lv1, property->tama_lv1, sizeof(tama1)*20);
|
|
65 memcpy(tama_lv2, property->tama_lv2, sizeof(tama2)*20);
|
|
66 memcpy(laser_lv1, property->laser_lv1, sizeof(laser)*20);
|
|
67 memcpy(bchar, property->bchar, sizeof(bomchar)*100);
|
|
68
|
8
|
69 free(prop);
|
5
|
70 }
|
|
71
|
|
72
|
19
|
73 CHARACTER*
|
|
74 atari(CHARACTER *p)
|
5
|
75 {
|
|
76 int w, h, charno;
|
19
|
77 CollisionPropertyPtr property = get_property();
|
5
|
78
|
|
79 charno = p->charano;
|
|
80 w = sptable[charno].w;
|
|
81 h = sptable[charno].h;
|
|
82
|
|
83 HTaskPtr collision_task = tmanager->create_task(ATARI);
|
|
84
|
|
85 collision_task->set_param(0,(memaddr)w);
|
|
86 collision_task->set_param(1,(memaddr)h);
|
19
|
87 collision_task->set_param(2,(memaddr)tama_lv1_end);
|
|
88 collision_task->set_param(3,(memaddr)tama_lv2_end);
|
|
89 collision_task->set_param(4,(memaddr)laser_lv1_end);
|
5
|
90
|
28
|
91 collision_task->add_inData(p, sizeof(CHARACTER));
|
5
|
92 collision_task->add_inData(property, sizeof(CollisionProperty));
|
28
|
93 collision_task->add_outData(p, sizeof(CHARACTER));
|
5
|
94 collision_task->add_outData(property, sizeof(CollisionProperty));
|
19
|
95 collision_task->set_post(free_property, (void*)property, NULL);
|
5
|
96
|
|
97 collision_task->set_cpu(SPE_ANY);
|
|
98 collision_task->spawn();
|
|
99
|
|
100 return p;
|
|
101 }
|