0
|
1 #include <stdlib.h>
|
|
2 #include "object.h"
|
|
3 #include "count2.h"
|
|
4 #include "sound.h"
|
|
5 #include "bom.h"
|
|
6 #include "sankaku.h"
|
|
7 //#include "libps.h"
|
|
8 #include "sgoex.h"
|
|
9 #include "debug.h"
|
|
10 extern int SsUtKeyOn(int vabId, int prog, int tone, int note, int fine, int voll, int vlor);
|
|
11
|
|
12
|
|
13 /*
|
|
14 * debugging
|
|
15 */
|
|
16 extern SGO_PAD pad[2];
|
|
17
|
|
18 player jiki = { 60, 200, 3, 0, FALSE, 120, 3, 3 };
|
|
19
|
|
20 laser laser_lv1[20];
|
|
21 laser laser_lv2[20];
|
|
22 stge lg = { 4096 };
|
|
23 stge pg = { 4096 };
|
|
24
|
|
25 int infg_level = { 0 };
|
|
26
|
|
27 stge infg = { 1 };
|
|
28
|
|
29 tama1 tama_lv1[20];
|
|
30 tama2 tama_lv2[20];
|
|
31 tama1 tlv3[3];
|
|
32
|
|
33 int py;
|
|
34 int bomcount = { 0 };
|
|
35 int charcount = { 0 };
|
|
36 int bania;
|
|
37
|
|
38 int pointkakudo(int playerno);
|
|
39
|
|
40 int bf = { 0 };
|
|
41
|
|
42 int tama_lv1_end = { -1 };
|
|
43 int tama_lv2_end = { -1 };
|
|
44 int laser_lv1_end = { -1 };
|
|
45 int laser_lv2_end = { -1 };
|
|
46
|
|
47 laser laser_lv3[64] = { {0, 0, 0, 0, 64, 0} };
|
|
48
|
|
49 int se_key[6] = { -1, -1, -1, -1, -1, -1 };
|
|
50
|
|
51 void Player(int playerno)
|
|
52 {
|
|
53 int i;
|
|
54 float wariai1, wariai2;
|
|
55 /*
|
|
56 if (jiki.zanki > 0) {
|
|
57 DefSprite(194, "remainder.bmp", 8 * (jiki.zanki - 1), 8, 480, effect);
|
|
58 count++;
|
|
59 PutSprite(count, 128, 224, 194);
|
|
60 }
|
|
61 */
|
|
62 if (jiki.bf == FALSE) {
|
|
63 Bom(jiki.x, jiki.y);
|
|
64 return;
|
|
65 }
|
|
66 /*時機無敵時間計算 */
|
|
67 if (jiki.muteki > 0 && jiki.bf == TRUE) {
|
|
68 count++;
|
|
69 // PutSprite(count, jiki.x + 16, jiki.y + 16, 193);
|
|
70 PutSpriteEx(193, jiki.x + 16, jiki.y + 16, 2, 2, 1);
|
|
71 count++;
|
|
72 // PutSprite(count, jiki.x + 16, jiki.y + 16, 193);
|
|
73 PutSpriteEx(193, jiki.x + 16, jiki.y + 16, 2, 2, 1);
|
|
74
|
|
75 jiki.muteki--;
|
|
76 }
|
|
77 /*コントローラ上限値-------------------------------- */
|
|
78 maxf(pad[0].right, 3);
|
|
79 maxf(pad[0].left, 3);
|
|
80 maxf(pad[0].up, 3);
|
|
81 maxf(pad[0].down, 3);
|
|
82
|
|
83
|
|
84 /*自機の動き---------------------------------------- */
|
|
85 jiki.x += pad[0].right - pad[0].left;
|
|
86 jiki.y += pad[0].down - pad[0].up;
|
|
87
|
|
88
|
|
89 /*自機の動き---------------------------------------- */
|
|
90 mini(jiki.x, 0);
|
|
91 maxf(jiki.x, 1688 - 128);
|
|
92 mini(jiki.y, 0);
|
|
93 maxf(jiki.y, 964 - 128);
|
|
94
|
|
95 if (pad[0].right > 0) {
|
|
96 if (charcount < 0)
|
|
97 charcount = 0;
|
|
98 else
|
|
99 charcount++;
|
|
100 }
|
|
101 if (pad[0].left > 0) {
|
|
102 if (charcount > 0)
|
|
103 charcount = 0;
|
|
104 else
|
|
105 charcount--;
|
|
106 }
|
|
107 if ((pad[0].left == 0) && (pad[0].right == 0))
|
|
108 charcount = 0;
|
|
109 jiki.ch =
|
|
110 3 * (charcount < 3) * (charcount > -3) + 2 * (charcount <
|
|
111 -3) * (charcount >=
|
|
112 -15) +
|
|
113 1 * (charcount < -15)
|
|
114 + 4 * (charcount > 3) * (charcount <= 15) + 5 * (charcount > 15);
|
|
115
|
|
116
|
|
117 /*玉レベル1登録------------------------------------ */
|
|
118 if ((pad[0].k4 % 3 == 1) && (pad[0].k3 % 3 == 0)) {
|
|
119
|
|
120 PlaySdlMixer(0, SHOT_A);// output sound
|
|
121 //se_voice[0] = SsUtKeyOn(vab[SHOT_A], 0, 0, 65, 0, 60, 60);
|
|
122 pad[0].k4 = 1;
|
|
123 tama_lv1_end++;
|
|
124 i = tama_lv1_end;
|
|
125
|
|
126 tama_lv1[i].x = jiki.x;
|
|
127 tama_lv1[i].y = jiki.y;
|
|
128 tama_lv1[i].r = 1;
|
|
129 tama_lv1[i].l = 1;
|
|
130
|
|
131 if (pg.stg <= MAXP)
|
|
132 pg.stg += 1;
|
|
133 }
|
|
134 /*玉レベル2登録------------------------------------ */
|
|
135 if ((pad[0].k3 % 3 == 1) && (pad[0].k4 == 0) && (pg.stg > 64)) {
|
|
136
|
|
137 PlaySdlMixer(0, SHOT_B);// output sound
|
|
138 //se_key[1] = SsUtKeyOn(vab[SHOT_B], 0, 0, 65, 0, 80, 80);
|
|
139 se_key[1] = SsUtKeyOn(vab[SHOT_B], 0, 0, 65, 0, 80, 80);
|
|
140 pad[0].k3 = 1;
|
|
141 tama_lv2_end++;
|
|
142 i = tama_lv2_end;
|
|
143
|
|
144 tama_lv2[i].x = jiki.x;
|
|
145 tama_lv2[i].y = jiki.y;
|
|
146 tama_lv2[i].rr = 1;
|
|
147 tama_lv2[i].sr = 1;
|
|
148 tama_lv2[i].sl = 1;
|
|
149 tama_lv2[i].ll = 1;
|
|
150
|
|
151 pg.stg -= 64;
|
|
152 }
|
|
153 /*玉レベル3登録------------------------------------- */
|
|
154 if ((pad[0].k3 % 5 > 0) && (pad[0].k4 % 5 > 0)) {
|
|
155 pad[0].k3 = 1;
|
|
156 pad[0].k4 = 1;
|
|
157 i = 0;
|
|
158 while (tlv3[i].y != -1) {
|
|
159 i++;
|
|
160 }
|
|
161 if ((i < 1) && (pg.stg > 2000)) {
|
|
162 PlaySdlMixer(0,SHOT_C); // re-za-
|
|
163 //se_voice[0] = SsUtKeyOn(vab[SHOT_C], 0, 0, 65, 0, 75, 75);
|
|
164 se_voice[0] = SsUtKeyOn(vab[SHOT_C], 0, 0, 65, 0, 75, 75);
|
|
165 tlv3[i].x = jiki.x;
|
|
166 tlv3[i].y = jiki.y;
|
|
167 pg.stg -= 2000;
|
|
168 tlv3[i].r = 90;
|
|
169 jiki.muteki = 4;
|
|
170 }
|
|
171 }
|
|
172 /*押してないときの玉ゲージ回復---------------------- */
|
|
173 if ((pad[0].k3 == 0) && (pad[0].k4 == 0))
|
|
174 if (pg.stg <= MAXP)
|
|
175 pg.stg += 4;
|
|
176 /*玉レベル1表示------------------------------ */
|
|
177 for (i = 0; i < tama_lv1_end + 1; i++) {
|
|
178 tama_lv1[i].y -= 64;
|
|
179 if (tama_lv1[i].r == 1) {
|
|
180 count++;
|
|
181 PutSprite(count, tama_lv1[i].x + 64, tama_lv1[i].y, 6);
|
|
182 }
|
|
183 if (tama_lv1[i].l == 1) {
|
|
184 count++;
|
|
185 PutSprite(count, tama_lv1[i].x, tama_lv1[i].y, 7);
|
|
186 }
|
|
187 if (tama_lv1[i].y < 0) {
|
|
188 if (tama_lv1_end == i) {
|
|
189 tama_lv1_end--;
|
|
190 break;
|
|
191 }
|
|
192 if (tama_lv1_end > i) {
|
|
193 tama_lv1[i] = tama_lv1[tama_lv1_end];
|
|
194 tama_lv1_end--;
|
|
195 i--;
|
|
196 }
|
|
197 }
|
|
198 }
|
|
199 /*玉レベル2表示------------------------------ */
|
|
200 for (i = 0; i < tama_lv2_end + 1; i++) {
|
|
201 tama_lv2[i].y -= 64;
|
|
202 if (tama_lv2[i].rr == 1) {
|
|
203 count++;
|
|
204 PutSprite(count, tama_lv2[i].x + 128, tama_lv2[i].y-96, 8);
|
|
205 }
|
|
206 if (tama_lv2[i].sr == 1) {
|
|
207 count++;
|
|
208 PutSprite(count, tama_lv2[i].x + 64, tama_lv2[i].y - 192, 8);
|
|
209 }
|
|
210 if (tama_lv2[i].sl == 1) {
|
|
211 count++;
|
|
212 PutSprite(count, tama_lv2[i].x, tama_lv2[i].y - 192, 8);
|
|
213 }
|
|
214 if (tama_lv2[i].ll == 1) {
|
|
215 count++;
|
|
216 PutSprite(count, tama_lv2[i].x - 64, tama_lv2[i].y-92, 8);
|
|
217 }
|
|
218 if (tama_lv2[i].y < 0) {
|
|
219 if (tama_lv2_end == i) {
|
|
220 tama_lv2_end--;
|
|
221 break;
|
|
222 }
|
|
223 if (tama_lv2_end > i) {
|
|
224 tama_lv2[i] = tama_lv2[tama_lv2_end];
|
|
225 tama_lv2_end--;
|
|
226 i--;
|
|
227 }
|
|
228 }
|
|
229 }
|
|
230 /*玉レベル3表示----------------------------------- */
|
|
231 if (tlv3[0].r > 0) {
|
|
232 /*波動砲本体 */
|
|
233 tlv3[0].x = jiki.x + 96;
|
|
234 tlv3[0].y = jiki.y;
|
|
235 count++;
|
|
236 // PutSprite(count, tlv3[0].x, tlv3[0].y - 128, 9);
|
|
237 PutSpriteEx(9, tlv3[0].x, tlv3[0].y - 128, tlv3[0].r *2 /45, 3, 1);
|
|
238
|
|
239
|
|
240 /*干渉部分 */
|
|
241 //DefSprite(39, 0, 16, 112 - ((tlv3[0].r % 8) / 2) * 16, 16, 16,
|
|
242 // 480);
|
|
243
|
|
244 /*波動砲干渉部分 */
|
|
245 count++;
|
|
246 // PutSprite(count, jiki.x + 16, jiki.y + 32, 39);
|
|
247 PutSpriteEx(39, jiki.x + 16, jiki.y + 32, 2, 2, 1);
|
|
248
|
|
249 /*終了フラグ */
|
|
250 tlv3[0].r--;
|
|
251 if (tlv3[0].r == 0)
|
|
252 tlv3[0].y = -1;
|
|
253 }
|
|
254 /* } */
|
|
255 /*玉ゲージの中身表示------------------------- */
|
|
256 wariai2 = pg.stg;
|
|
257 wariai1 = wariai2 / 4096.0;
|
|
258 py = 64.0 * wariai1;
|
|
259
|
|
260 //DefSprite(11, "offensivepower_gauge.bmp", 8, py, 480, effect);
|
|
261 count++;
|
|
262 //PutSprite(count, 0, 240 - 96 + 64 - py, 11);
|
|
263 /*レーザーゲージの中身表示------------------------ */
|
|
264 wariai2 = lg.stg;
|
|
265 wariai1 = wariai2 / 4096.0;
|
|
266 py = 64.0 * wariai1;
|
|
267 //DefSprite(15, "diffensivepower_gauge.bmp", 9, py, 480, effect);
|
|
268
|
|
269 count++;
|
|
270 //PutSprite(count, 18, 240 - 105, 15);
|
|
271 /*インフレゲージ------------------------------------- */
|
|
272 if (infg.stg > 640) {
|
|
273 infg.stg = 0;
|
|
274 infg_level++;
|
|
275 if (infg_level > 11) {
|
|
276 infg_level = 11;
|
|
277 infg.stg = 640;
|
|
278 }
|
|
279 }
|
|
280 py = infg.stg / 8;
|
|
281 //DefSprite(49, "inflation_meter.bmp", 16, py, 320, effect);
|
|
282
|
|
283 #define REGULATION_PUTSIZE_X 5
|
|
284 count++;
|
|
285 //PutSprite(count, REGULATION_PUTSIZE_X + 4 - 7, 24 + 83 - py, 49);
|
|
286 count++;
|
|
287 //PutSprite(count, REGULATION_PUTSIZE_X + 0, 40 + 80, 200 + infg_level);
|
|
288
|
|
289 /*バーニアアニメーション----------------------------- */
|
|
290 bania++;
|
|
291 bania %= 3;
|
|
292 //DefSprite(12, "burner.bmp", 16, 16, 480, effect);
|
|
293 count++;
|
|
294 //PutSprite(count, jiki.x + 8, jiki.y + 32, 12);
|
|
295
|
|
296 /*照準コントロール----------------------------------- */
|
|
297 if (pad[0].r1 % 2 == 1) {
|
|
298 pad[0].r1 = 1;
|
|
299 jiki.point += 10;
|
|
300 }
|
|
301 if (pad[0].l1 % 2 == 1) {
|
|
302 pad[0].l1 = 1;
|
|
303 jiki.point -= 10;
|
|
304 }
|
|
305 jiki.point %= 360;
|
|
306 int siny = 50 * Mysin(jiki.point - 90) / SANKAKU;
|
|
307 int cosx = 30 + 50 * Mycos(jiki.point - 90) / SANKAKU;
|
|
308 count++;
|
|
309 DefSpriteEx(13, 4, 64);
|
|
310 // PutSprite(count, jiki.x + 16, jiki.y, 13);
|
|
311 PutSpriteEx(13, jiki.x + cosx, jiki.y + siny, 2, 2, jiki.point);
|
|
312 /*押してないときレーザーゲージ回復------------------- */
|
|
313
|
|
314 if ((pad[0].k1 == 0) && (pad[0].k0 == 0))
|
|
315 if (lg.stg <= MAXP)
|
|
316 lg.stg += 4;
|
|
317 /*レーザーレベル1登録------------------------------- */
|
|
318 if ((pad[0].k1 % 3 == 1) && (pad[0].k0 == 0) && (lg.stg > 16)) {
|
|
319 PlaySdlMixer(0, RING) ; // RING
|
|
320
|
|
321 //se_key[3] = SsUtKeyOn(vab[LASER_A], 0, 0, 65, 0, 50, 50);
|
|
322 pad[0].k1 = 1;
|
|
323 laser_lv1_end++;
|
|
324 i = laser_lv1_end;
|
|
325
|
|
326 laser_lv1[i].sx = 32 * Mysin(jiki.point) / SANKAKU;
|
|
327 laser_lv1[i].sy = 32 * Mycos(jiki.point) / SANKAKU;
|
|
328 laser_lv1[i].x = jiki.x + 128;
|
|
329 laser_lv1[i].y = jiki.y + 128;
|
|
330 laser_lv1[i].r = 1000;
|
|
331 laser_lv1[i].s = 0.08;
|
|
332 lg.stg -= 16;
|
|
333 }
|
|
334 /*--------------------------------------------------*/
|
|
335 for (i = 0; i < laser_lv1_end + 1; i++) {
|
|
336 if (laser_lv1[i].r != -1) {
|
|
337 laser_lv1[i].y -= laser_lv1[i].sy;
|
|
338 laser_lv1[i].x += laser_lv1[i].sx;
|
|
339 laser_lv1[i].r += 100;
|
|
340 laser_lv1[i].s += 0.05;
|
|
341 count++;
|
|
342 DefSpriteEx(16, 16, 16);
|
|
343 // PutSprite(count, laser_lv1[i].x, laser_lv1[i].y, 16);
|
|
344 PutSpriteEx(16, laser_lv1[i].x, laser_lv1[i].y, laser_lv1[i].s, laser_lv1[i].s, 1);
|
|
345 }
|
|
346 if (waku(laser_lv1[i].x, laser_lv1[i].y)) {
|
|
347 if (laser_lv1_end == i) {
|
|
348 laser_lv1_end--;
|
|
349 break;
|
|
350 }
|
|
351 if (laser_lv1_end > i) {
|
|
352 laser_lv1[i] = laser_lv1[laser_lv1_end];
|
|
353 laser_lv1_end--;
|
|
354 i--;
|
|
355 }
|
|
356 }
|
|
357 }
|
|
358 /*レーザーレベル2登録------------------------------- */
|
|
359 if ((pad[0].k1 == 0) && (pad[0].k0 != 0) && (lg.stg > 200)) {
|
|
360 PlaySdlMixer(0, NEW) ;// SHIELD
|
|
361
|
|
362 if (laser_lv2[0].r == 0) {
|
|
363 laser_lv2[0].r = 1;
|
|
364 lg.stg -= 100;
|
|
365 } else {
|
|
366 laser_lv2[0].r %= 45;
|
|
367 laser_lv2[0].r++;
|
|
368 lg.stg -= 10;
|
|
369 }
|
|
370 } else {
|
|
371 laser_lv2[0].r = 0;
|
|
372 }
|
|
373 /*------------------------------------*/
|
|
374 if (laser_lv2[0].r != 0) {
|
|
375 laser_lv2[0].x = jiki.x + 128 + 256 * Mysin(jiki.point) / SANKAKU;
|
|
376 laser_lv2[0].y = jiki.y + 128 - 256 * Mycos(jiki.point) / SANKAKU;
|
|
377 count++;
|
|
378 // PutSprite(count, laser_lv2[0].x, laser_lv2[0].y, 17);
|
|
379 PutSpriteEx(17, laser_lv2[0].x, laser_lv2[0].y, 2, 2, laser_lv2[0].r * 8);
|
|
380 }
|
|
381
|
|
382 /*ここに特殊兵器ボムの関数をよろしく*/
|
|
383 /*発射準備 (laser_lv3[playerno][0] は、爆発発生の種。)*/
|
|
384 if ((pad[0].k1 > 0) && (pad[0].k0 > 0)
|
|
385 && (lg.stg > 2400) && (laser_lv3[0].r > 61)) {
|
|
386 PlaySdlMixer(0, BOM) ;// BOM
|
|
387 //se_voice[0] = SsUtKeyOn(vab[LASER_C], 0, 0, 65, 0, 70, 70);
|
|
388
|
|
389 laser_lv3[0].x = jiki.x + 256 * Mysin(jiki.point) / SANKAKU;
|
|
390 laser_lv3[0].y = jiki.y - 256 * Mycos(jiki.point) / SANKAKU;
|
|
391 laser_lv3[0].r = 0;
|
|
392 lg.stg -= 2400;
|
|
393 jiki.muteki = 60;
|
|
394 }
|
|
395 if (laser_lv3[0].r < 62) { /*ボムフラグ継続か */
|
|
396 laser_lv3[0].r++;
|
|
397 if (laser_lv3[0].r % 2 == 0) { /*爆風発生 */
|
|
398 laser_lv3[1 + laser_lv3[0].r / 2].r = 8;
|
|
399 laser_lv3[1 + laser_lv3[0].r / 2].x =
|
|
400 laser_lv3[0].x + rand() % 640 - 320;
|
|
401 laser_lv3[1 + laser_lv3[0].r / 2].y =
|
|
402 laser_lv3[0].y + rand() % 640 - 320;
|
|
403 }
|
|
404 }
|
|
405 /*ボムノアニメーション */
|
|
406 for (i = 1; i < 32; i++) {
|
|
407 if (laser_lv3[i].r > 0) {
|
|
408 laser_lv3[i].r--;
|
|
409 count++;
|
|
410 // PutSprite(count, laser_lv3[i].x, laser_lv3[i].y,
|
|
411 // 47 - (laser_lv3[i].r));
|
|
412 PutSpriteEx(47 - (laser_lv3[i].r), laser_lv3[i].x, laser_lv3[i].y, 4, 4, 1);
|
|
413 }
|
|
414 }
|
|
415 }
|