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