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 "tokuten.h"
|
|
9 #include "collision.h"
|
|
10 #include "bom.h"
|
|
11 #include "count2.h"
|
|
12 #include "sound.h"
|
|
13 #include "sgoex.h"
|
|
14
|
|
15 extern SpriteTable sptable[DEFOBJ];
|
|
16
|
|
17
|
|
18 CHARACTER * atari(CHARACTER *p)
|
|
19 {
|
|
20 int i1, h, w, ex, ey, charno;
|
|
21 int n;
|
|
22 ex = p->x;
|
|
23 ey = p->y;
|
|
24 charno = p->charano;
|
|
25 w = sptable[charno].w;
|
|
26 h = sptable[charno].h;
|
|
27 //i2 = playerno;
|
|
28
|
|
29 //自機やられ
|
|
30 #ifndef INVISIBLE_MODE
|
|
31 if ((ex < jiki.x + 128 / 2) && (ex + w > jiki.x + 128 / 2)
|
|
32 && (ey < jiki.y + 128 / 2) && (ey + h > jiki.y + 128 / 2)
|
|
33 && jiki.muteki == 0) {
|
|
34 //se_voice[0] = SsUtKeyOn(vab[JIKIOUT], 0, 0, 65, 0, 60, 60);
|
|
35 Bom(jiki.x + 16, jiki.y + 16);
|
|
36 jiki.bf = FALSE;
|
|
37 jiki.zanki--;
|
|
38 jiki.muteki = 120;
|
|
39
|
|
40 infg.stg = 0;
|
|
41 infg_level--;
|
|
42 if (infg_level < 0)
|
|
43 infg_level = 0;
|
|
44 return p;
|
|
45 }
|
|
46 #endif
|
|
47
|
|
48 if (p->tama == TRUE)
|
|
49 goto jumping;
|
|
50 for (i1 = 0; i1 < tama_lv1_end + 1; i1++) {
|
|
51
|
|
52 if ((tama_lv1[i1].x + 64 + 64 > ex)
|
|
53 && (ex + w > tama_lv1[i1].x + 16)
|
|
54 && (tama_lv1[i1].y + 128 > ey) && (tama_lv1[i1].y < ey + h)
|
|
55 && (tama_lv1[i1].r != -1)) {
|
|
56 tama_lv1[i1].r = -1;
|
|
57 p->vit -= TAMALV1P;
|
|
58 infg.stg++;
|
|
59 if (p->vit <= 0) {
|
|
60 infg.stg += 4;
|
|
61 Bom(p->x, p->y);
|
|
62 enemycount += (p->score *
|
|
63 ((infg.stg / 128) + infg_level + 1));
|
|
64 p->state = delete_chara;
|
|
65 p->collision = noaction;
|
|
66 p->f = FALSE;
|
|
67 return p;
|
|
68 }
|
|
69 }
|
|
70 if ((tama_lv1[i1].x + 64 > ex) && (ex + w > tama_lv1[i1].x)
|
|
71 && (tama_lv1[i1].y + 128 > ey) && (tama_lv1[i1].y < ey + h)
|
|
72 && (tama_lv1[i1].l != -1)) {
|
|
73 tama_lv1[i1].l = -1;
|
|
74 p->vit -= TAMALV1P;
|
|
75 infg.stg++;
|
|
76 if (p->vit <= 0) {
|
|
77 infg.stg += 4;
|
|
78 Bom(p->x, p->y);
|
|
79 enemycount += (p->score *
|
|
80 ((infg.stg / 128) + infg_level + 1));
|
|
81 p->state = delete_chara;
|
|
82 p->collision = noaction;
|
|
83 p->f = FALSE;
|
|
84 return p;
|
|
85 }
|
|
86 }
|
|
87 }
|
|
88
|
|
89 for (i1 = 0; i1 < tama_lv2_end + 1; i1++) {
|
|
90 if ((tama_lv2[i1].x + 128 + 64 > ex)
|
|
91 && (ex + w > tama_lv2[i1].x + 128)
|
|
92 && (tama_lv2[i1].y + 192 > ey) && (tama_lv2[i1].y < ey + h)
|
|
93 && (tama_lv2[i1].rr != -1)) {
|
|
94 tama_lv2[i1].rr = -1;
|
|
95 p->vit -= TAMALV2P;
|
|
96 infg.stg++;
|
|
97 if (p->vit <= 0) {
|
|
98 infg.stg += 4;
|
|
99 Bom(p->x, p->y);
|
|
100 enemycount += (p->score *
|
|
101 ((infg.stg / 128) + infg_level + 1));
|
|
102 p->state = delete_chara;
|
|
103 p->collision = noaction;
|
|
104 p->f = FALSE;
|
|
105 return p;
|
|
106 }
|
|
107 }
|
|
108
|
|
109 if ((tama_lv2[i1].x + 64 + 64 > ex)
|
|
110 && (ex + w > tama_lv2[i1].x + 16)
|
|
111 && (tama_lv2[i1].y - 32 + 192 > ey)
|
|
112 && (tama_lv2[i1].y - 32 < ey + h)
|
|
113 && (tama_lv2[i1].sr != -1)) {
|
|
114 tama_lv2[i1].sr = -1;
|
|
115 p->vit -= TAMALV2P;
|
|
116 infg.stg++;
|
|
117 if (p->vit <= 0) {
|
|
118 infg.stg += 4;
|
|
119 Bom(p->x, p->y);
|
|
120 enemycount += (p->score *
|
|
121 ((infg.stg / 128) + infg_level + 1));
|
|
122 p->state = delete_chara;
|
|
123 p->collision = noaction;
|
|
124 p->f = FALSE;
|
|
125 return p;
|
|
126 }
|
|
127 }
|
|
128 if ((tama_lv2[i1].x + 64 > ex) && (ex + w > tama_lv2[i1].x)
|
|
129 && (tama_lv2[i1].y - 32 + 192 > ey)
|
|
130 && (tama_lv2[i1].y - 32 < ey + h)
|
|
131 && (tama_lv2[i1].sl != -1)) {
|
|
132 tama_lv2[i1].sl = -1;
|
|
133 p->vit -= TAMALV2P;
|
|
134 infg.stg++;
|
|
135 if (p->vit <= 0) {
|
|
136 infg.stg += 4;
|
|
137 Bom(p->x, p->y);
|
|
138 enemycount += (p->score *
|
|
139 ((infg.stg / 128) + infg_level + 1));
|
|
140 p->state = delete_chara;
|
|
141 p->collision = noaction;
|
|
142 p->f = FALSE;
|
|
143 return p;
|
|
144 }
|
|
145 }
|
|
146 if ((tama_lv2[i1].x - 64 + 64 > ex)
|
|
147 && (ex + w > tama_lv2[i1].x - 64)
|
|
148 && (tama_lv2[i1].y + 192 > ey) && (tama_lv2[i1].y < ey + h)
|
|
149 && (tama_lv2[i1].ll != -1)) {
|
|
150 tama_lv2[i1].ll = -1;
|
|
151 p->vit -= TAMALV2P;
|
|
152 infg.stg++;
|
|
153 if (p->vit <= 0) {
|
|
154 infg.stg += 4;
|
|
155 Bom(p->x, p->y);
|
|
156 enemycount += (p->score *
|
|
157 ((infg.stg / 128) + infg_level + 1));
|
|
158 p->state = delete_chara;
|
|
159 p->collision = noaction;
|
|
160 p->f = FALSE;
|
|
161 return p;
|
|
162 }
|
|
163 }
|
|
164 }
|
|
165 if ((tlv3[0].r > 0) && (jiki.x < ex + w) && (jiki.x + 128 > ex)
|
|
166 && (jiki.y > ey + h)) {
|
|
167 p->vit -= TAMALV3P;
|
|
168 infg.stg++;
|
|
169 if (p->vit <= 0) {
|
|
170 infg.stg += 4;
|
|
171 Bom(p->x, p->y);
|
|
172 enemycount += (p->score *
|
|
173 ((infg.stg / 128) + infg_level + 1));
|
|
174 p->state = delete_chara;
|
|
175 p->collision = noaction;
|
|
176 p->f = FALSE;
|
|
177 return p;
|
|
178 }
|
|
179 }
|
|
180 jumping:
|
|
181 if ((tlv3[0].r > 0) && (jiki.x < ex + w) && (jiki.x + 128 > ex)
|
|
182 && (jiki.y + 128 > ey) && (jiki.y < ey + h)) {
|
|
183 p->vit -= TAMALV3P;
|
|
184 infg.stg++;
|
|
185 if (p->vit <= 0) {
|
|
186 infg.stg += 4;
|
|
187 Bom(p->x, p->y);
|
|
188 enemycount += (p->score *
|
|
189 ((infg.stg / 128) + infg_level + 1));
|
|
190 p->state = delete_chara;
|
|
191 p->collision = noaction;
|
|
192 p->f = FALSE;
|
|
193 return p;
|
|
194 }
|
|
195 }
|
|
196 /*laser lv1 */
|
|
197 for (i1 = 0; i1 < laser_lv1_end + 1; i1++) {
|
|
198 n = laser_lv1[i1].r * 128 / 4096;
|
|
199
|
|
200 if ((laser_lv1[i1].x + n > ex) && (ex + w > laser_lv1[i1].x)
|
|
201 && (laser_lv1[i1].y + n > ey) && (laser_lv1[i1].y < ey + h)
|
|
202 && (laser_lv1[i1].r != -1)) {
|
|
203 laser_lv1[i1].r = -1;
|
|
204 laser_lv1[i1].y = -1;
|
|
205 p->vit -= LASERLV1P;
|
|
206 infg.stg++;
|
|
207 if (p->vit <= 0) {
|
|
208 infg.stg += 4;
|
|
209 Bom(p->x, p->y);
|
|
210 enemycount += (p->score *
|
|
211 ((infg.stg / 128) + infg_level + 1));
|
|
212 p->state = delete_chara;
|
|
213 p->collision = noaction;
|
|
214 p->f = FALSE;
|
|
215 return p;
|
|
216 }
|
|
217 }
|
|
218 }
|
|
219 /*shield(laser lv2) */
|
|
220 if ((p->tama == TRUE) && (lg.stg > 0) &&
|
|
221 (laser_lv2[0].x + 128 > ex) && (ex + w > laser_lv2[0].x - 128)
|
|
222 && (laser_lv2[0].y + 128 > ey) && (laser_lv2[0].y - 128 < ey + h)
|
|
223 && (laser_lv2[0].r != 0)) {
|
|
224 p->vit -= LASERLV2P;
|
|
225 lg.stg -= 26;
|
|
226 infg.stg++;
|
|
227 if (p->vit <= 0) {
|
|
228 infg.stg += 4;
|
|
229 Bom(p->x, p->y);
|
|
230 enemycount += (p->score *
|
|
231 ((infg.stg / 128) + infg_level + 1));
|
|
232 p->state = delete_chara;
|
|
233 p->collision = noaction;
|
|
234 p->f = FALSE;
|
|
235 return p;
|
|
236 }
|
|
237 }
|
|
238 /*bomber(laser lv3) */
|
|
239 if (laser_lv3[0].r < 62) {
|
|
240 for (i1 = 1; i1 < 128; i1++) {
|
|
241 if ((laser_lv3[i1].x + 128 > ex) && (ex + w > laser_lv3[i1].x)
|
|
242 && (laser_lv3[i1].y + 128 > ey)
|
|
243 && (laser_lv3[i1].y < ey + h)
|
|
244 && (laser_lv3[i1].r > 0)) {
|
|
245 tama_lv2[i1].rr = -1;
|
|
246 p->vit -= LASERLV3P;
|
|
247 infg.stg++;
|
|
248 if (p->vit <= 0) {
|
|
249 infg.stg += 4;
|
|
250 Bom(p->x, p->y);
|
|
251 enemycount += (p->score *
|
|
252 ((infg.stg / 128) + infg_level + 1));
|
|
253 p->state = delete_chara;
|
|
254 p->collision = noaction;
|
|
255 p->f = FALSE;
|
|
256 return p;
|
|
257 }
|
|
258 }
|
|
259 }
|
|
260 }
|
|
261 return p;
|
|
262 }
|