1 /*
2 * This file is part of 'Garden of coloured lights'.
3 *
4 * 'Garden of coloured lights' is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * 'Garden of coloured lights' is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with 'Garden of coloured lights'. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18
19 #include "system.h"
20 #include "config.h"
21
22 #include "allegro.h"
23
24 #include "globvars.h"
25
26 #include "palette.h"
27 #include "game.h"
28 #include "input.h"
29
30 #include "display.h"
31
32 #include "stuff.h"
33
34 #define TRANS_MODE drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
35 #define END_TRANS_MODE drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
36
37 extern RGB palet[2][256];
38
39 RGB splash_palette[256];
40
41 BITMAP *splash_bitmap;
42
43 RLE_SPRITE *icon_RLEs[30]; // externed in display_init
44
45 extern struct RLE_STRUCT eRLE_flower[5][50];
46
47 extern struct RLE_STRUCT RLE_multi[WPN_TYPES][8];
48
49 RLE_SPRITE *player_icon_RLE;
50
51 void key_box (const char ktext[], int command);
52 int acceptable_char (int scode);
53 void define_keys (void);
54 int ship_select (void);
55 void print_wpn_name (int x, int y, int w);
56 void print_wpn_text (int x, int y, int w);
57 void print_standard_names (int x, int y, int w);
58
59
60 void congratulations (void);
61 void congrat_wait (int waiting);
62
63
64 char skippable_column (int colm);
65
66
67 extern volatile unsigned char ticked;
68
69 extern BITMAP *display;
70
71 int menu_select;
72 int key_wait;
73
74 int counter2;
75 int flower_dir;
76
77 enum
78 {
79 MENU_START,
80 MENU_DIFFICULTY,
81 MENU_AUDIO,
82 MENU_JOY_OR_KEYS,
83 MENU_KEYS,
84 MENU_CALIBRATE,
85 MENU_EXIT
86 };
87
88
89 int standard_config[6][3] = {
90 {WPN_SCATTER, WPN_CANNON, WPN_SEEKER},
91 {WPN_MGUN, WPN_RECT, WPN_BLADE},
92 {WPN_LWBEAM, WPN_CANNON, WPN_SEEKER},
93 {WPN_SCATTER, WPN_SWBEAM, WPN_EIGHT},
94 {WPN_LWBEAM, WPN_SWBEAM, WPN_BLADE},
95 {WPN_EIGHT, WPN_SEEKER, WPN_BLADE}
96
97 };
98
99 void reset_menu_palette (void);
100 void run_menu_background (void);
101
102 int custom_config[3];
103
104
105
106 #define NO_CFLOWERS 7
107
108 int cflower_x[NO_CFLOWERS];
109 int cflower_y[NO_CFLOWERS];
110 int cflower_y_offset[NO_CFLOWERS];
111 int cflower_centre_col[NO_CFLOWERS];
112 int cflower_centre_size[NO_CFLOWERS];
113 int cflower_col[NO_CFLOWERS][2];
114 int cflower_out1[NO_CFLOWERS][2];
115 int cflower_out2[NO_CFLOWERS][2];
116 int cflower_angle[NO_CFLOWERS][2];
117 int cflower_petals[NO_CFLOWERS][2];
118 int cflower_rot[NO_CFLOWERS][2];
119 int cflower_rot_inc[NO_CFLOWERS][2];
120 int made_cflower;
121
122 void run_cflowers (void);
123 void new_cflower (int f);
124 void cflower_poly4 (BITMAP * target, int x1, int y1, int x2, int y2, int x3,
125 int y3, int x4, int y4, int col);
126 void init_cflowers (void);
127
128
129
reset_menu_palette(void)130 void reset_menu_palette (void)
131 {
132
133 clear_bitmap (screen);
134 vsync ();
135 clear_bitmap (display);
136
137 arena.target_palette = 0;
138 set_base_palette ();
139
140 set_base_palette ();
141 int newpal = build_new_palette (arena.change_palette, 0, 0, 0);
142 vsync ();
143 // clear_bitmap(screen);
144 set_palette (palet[newpal]);
145 }
146
147
148
startup_menu(void)149 void startup_menu (void)
150 {
151 reset_menu_palette ();
152
153 // get custom config from initfile
154 custom_config[0] = WPN_SCATTER;
155 custom_config[1] = WPN_CANNON;
156 custom_config[2] = WPN_SEEKER;
157
158 menu_select = 0;
159 key_wait = 30;
160
161 int counter;
162
163 counter = 0;
164 counter2 = 0;
165
166 flower_dir = pos_or_neg (1);
167
168 arena.difficulty = 0;
169
170 int y1 = 170;
171 int y2 = 190 + menu_select * 30;
172 int y3 = 218 + menu_select * 30;
173 int y4 = 218 + menu_select * 30;
174
175 int anykey = 0;
176
177 int i;
178
179 while (TRUE)
180 {
181 clear_bitmap (display);
182 run_menu_background ();
183
184 counter += 4;
185 if (counter >= 40)
186 counter = 0;
187
188 counter2++;
189 if (counter2 >= 256)
190 counter2 = 0;
191
192 textprintf_centre_ex (display, font, 320, 90, -1, -1,
193 "G A R D E N O F C O L O U R E D L I G H T S");
194 textprintf_ex (display, font, 10, 460, -1, -1,
195 "VERSION %s", PACKAGE_VERSION);
196 if (options.tourist > 0)
197 {/* One plays in (cheat) tourist mode */
198 textprintf_centre_ex (display, font, 320, 130, -1, -1,
199 "TOURIST MODE: STAGE %i", options.tourist);
200 }
201 // textprintf_centre_ex(display, font, 320, 80, -1, -1, "C O L O U R E D L I G H T S");
202 // textprintf_centre_ex(display, font, 320, 110, -1, -1, "remember 5 seconds!");
203
204 int my = 240;
205 const int line_break = 30;
206 const int bo_up = 10;
207 const int bo_down = 15;
208 int line_num = 0;
209 int entry_y;
210
211 y1 = my - 23;
212 y2 = my - 10 + menu_select * 30;
213 y3 = my + 19 + menu_select * 30;
214 y4 = my + 150;
215
216
217 // rectfill(display, 370, y1, 600, y2, COL_COL1);
218 rectfill (display, 370, y2 + 5, 640, y3 - 2, COL_BACK4);
219 rect (display, 368, y2 + 3, 641, y3 - 0, COL_BACK3);
220 // rectfill(display, 370, y3, 600, y4, TRANS_DGREEN);
221
222 textprintf_ex (display, font, 400, my, -1, -1, "START GAME");
223 line_num ++;
224
225 entry_y = my + line_num * line_break;
226 switch (arena.difficulty)
227 {
228 case 0:
229 textprintf_ex (display, font, 400, entry_y, -1, -1, "DIFFICULTY - NORMAL");
230 break;
231 case 1:
232 textprintf_ex (display, font, 400, entry_y, -1, -1, "DIFFICULTY - HARD");
233 break;
234 case 2:
235 textprintf_ex (display, font, 400, entry_y, -1, -1, "DIFFICULTY - PUNISHMENT");
236 break;
237 }
238 line_num++;
239
240 entry_y = my + line_num * line_break;
241 if (options.sound_init != 0)
242 {
243 textprintf_ex (display, font, 400, entry_y, -1, -1, "SFX VOLUME - %d%%", (int)((options.sound_volume + 1.28) / 2.55));
244 }
245 else
246 { textprintf_ex (display, font, 400, entry_y, -1, -1, "NO SOUND");
247 drawing_mode (DRAW_MODE_TRANS, NULL, 0, 0);
248 rectfill (display, 399, entry_y - bo_up, 530, entry_y + bo_down, CONVERT_WHITE_TO_GREY);
249 drawing_mode (DRAW_MODE_SOLID, NULL, 0, 0);
250 }
251 line_num++;
252
253 entry_y = my + line_num * line_break;
254 if (options.joystick)
255 {
256 if (options.key_or_joy == 1)
257 textprintf_ex (display, font, 400, entry_y, -1, -1, "CONTROLS - JOYSTICK");
258 else
259 textprintf_ex (display, font, 400, entry_y, -1, -1, "CONTROLS - KEYBOARD");
260 }
261 else
262 {
263 textprintf_ex (display, font, 400, entry_y, -1, -1, "NO JOYSTICK");
264 drawing_mode (DRAW_MODE_TRANS, NULL, 0, 0);
265 rectfill (display, 399, entry_y - bo_up, 530, entry_y + bo_down, CONVERT_WHITE_TO_GREY);
266 drawing_mode (DRAW_MODE_SOLID, NULL, 0, 0);
267
268 }
269 line_num++;
270 // textprintf_ex(display [2], font, 400, 260, -1, -1, "STAGE - %i", arena.starting_level);
271 entry_y = my + line_num * line_break;
272 textprintf_ex (display, font, 400, entry_y, -1, -1, "SET KEYS");
273 line_num++;
274
275 entry_y = my + line_num * line_break;
276 if (options.joystick)
277 textprintf_ex (display, font, 400, entry_y, -1, -1,
278 "CALIBRATE JOYSTICK");
279 else
280 {
281 textprintf_ex (display, font, 400, entry_y, -1, -1, "NO JOYSTICK");
282 drawing_mode (DRAW_MODE_TRANS, NULL, 0, 0);
283 rectfill (display, 399, entry_y - bo_up, 530, entry_y + bo_down, CONVERT_WHITE_TO_GREY);
284 drawing_mode (DRAW_MODE_SOLID, NULL, 0, 0);
285 }
286 line_num++;
287
288 entry_y = my + line_num * line_break;
289 textprintf_ex (display, font, 400, entry_y, -1, -1, "EXIT");
290
291 my = 270;
292
293 y2 = my + 7 + arena.just_got_highscore * 30;
294 y3 = my + 29 + arena.just_got_highscore * 30;
295
296 if (arena.just_got_highscore > 0)
297 {
298 rectfill (display, 0, y2 - 5, 250, y3, COL_COL3);
299 rect (display, -1, y2 - 5 - 2, 250 + 2, y3 + 2, COL_COL4);
300 }
301
302 textprintf_right_ex (display, font, 137, my, -1, -1, "HIGH");
303 textprintf_ex (display, font, 157, my, -1, -1, "SCORES");
304
305 textprintf_right_ex (display, font, 137, my + 40, -1, -1, "NORMAL");
306 textprintf_ex (display, font, 157, my + 40, -1, -1, "%i",
307 options.highscore[0]);
308
309 textprintf_right_ex (display, font, 137, my + 70, -1, -1, "HARD");
310 textprintf_ex (display, font, 157, my + 70, -1, -1, "%i",
311 options.highscore[1]);
312
313 textprintf_right_ex (display, font, 137, my + 100, -1, -1, "PUNISHMENT");
314 textprintf_ex (display, font, 157, my + 100, -1, -1, "%i",
315 options.highscore[2]);
316
317 if ( ( keypressed() ) && key_wait == 0)
318 {
319 int pressed_key = readkey() >> 8;
320 clear_keybuf();
321 if (pressed_key == KEY_UP || pressed_key == KEY_8_PAD)
322 {
323 menu_pressed_up:
324 menu_select--;
325 if (menu_select < 0)
326 menu_select = MENU_EXIT;
327 if (menu_select == MENU_CALIBRATE && options.joystick == 0)
328 goto menu_pressed_up;
329 if (menu_select == MENU_JOY_OR_KEYS && options.joystick == 0)
330 goto menu_pressed_up;
331 if (menu_select == MENU_AUDIO && options.sound_init == 0)
332 goto menu_pressed_up;
333 key_wait = 7;
334 }
335 if (pressed_key == KEY_DOWN || pressed_key == KEY_2_PAD)
336 {
337 menu_pressed_down:
338 menu_select++;
339 if (menu_select > MENU_EXIT)
340 menu_select = 0;
341 if (menu_select == MENU_CALIBRATE && options.joystick == 0)
342 goto menu_pressed_down;
343 if (menu_select == MENU_JOY_OR_KEYS && options.joystick == 0)
344 goto menu_pressed_down;
345 if (menu_select == MENU_AUDIO && options.sound_init == 0)
346 goto menu_pressed_down;
347 key_wait = 7;
348 }
349 if (pressed_key == KEY_LEFT || pressed_key == KEY_4_PAD)
350 {
351 if (menu_select == MENU_JOY_OR_KEYS)
352 {
353 if (options.key_or_joy == 0)
354 options.key_or_joy = 1;
355 else
356 options.key_or_joy = 0;
357 }
358 if (menu_select == MENU_DIFFICULTY)
359 {
360 arena.difficulty--;
361 if (arena.difficulty < 0)
362 arena.difficulty = 0;
363 }
364 if (menu_select == MENU_AUDIO)
365 {
366 int new_volume = (int)((options.sound_volume + 13) / 26);
367 new_volume = (new_volume - 1 + 11) % 11;
368 options.sound_volume = (int)(new_volume * 25.5);
369 }
370 key_wait = 11;
371 }
372 if (pressed_key == KEY_RIGHT || pressed_key == KEY_6_PAD)
373 {
374 if (menu_select == MENU_JOY_OR_KEYS)
375 {
376 if (options.key_or_joy == 0)
377 options.key_or_joy = 1;
378 else
379 options.key_or_joy = 0;
380 }
381 if (menu_select == MENU_DIFFICULTY)
382 {
383 arena.difficulty++;
384 if (arena.difficulty > 2)
385 arena.difficulty = 2;
386 }
387 if (menu_select == MENU_AUDIO)
388 {
389 int new_volume = (int)((options.sound_volume + 13) / 26);
390 new_volume = (new_volume + 1) % 11;
391 options.sound_volume = (int)(new_volume * 25.5);
392 }
393 key_wait = 11;
394 }
395
396 if (pressed_key == KEY_ESC)
397 exit(0);
398
399 if (pressed_key == KEY_ENTER || pressed_key == KEY_SPACE || pressed_key == KEY_Z)
400 {
401 if (menu_select == MENU_EXIT)
402 exit(0);
403
404 if (menu_select == MENU_KEYS)
405 {
406 key_wait = 10;
407 define_keys ();
408 key_wait = 10;
409 }
410
411 if (menu_select == MENU_CALIBRATE)
412 {
413 jstick_calibrate ();
414 key_wait = 20;
415 ticked = 0;
416 }
417
418 if (menu_select == MENU_START)
419 {
420 ticked = 0;
421 key_wait = 30;
422 if (ship_select () == 1)
423 {
424 clear_bitmap (display);
425 new_game ();
426 game_loop ();
427 if (arena.level == 5)
428 congratulations ();
429 reset_menu_palette ();
430 key_wait = 10; // was 1
431 flower_dir *= -1;
432 ticked = 0;
433 }
434 else
435 key_wait = 20;
436 }
437 else
438 key_wait = 20;
439 }
440 }//endif (keypressed() && key_wait == 0)
441 else
442 {
443 int keys_before = 1;
444 if (keypressed())
445 {
446 clear_keybuf(); /* we are not interested in keys in the queue */
447 rest(20);
448 }
449 else
450 {
451 keys_before = 0; /* there were no keys pressed before */
452 rest(10);
453 }
454
455 jstick_to_keypressed();
456 key_wait -= 2;
457 if ( ( !keypressed() && !keys_before ) || key_wait <= 0)
458 {/* we can process next keypress since the previous keypress has ended */
459 key_wait = 0;
460 }
461 }
462
463 textprintf_right_ex (display, font, 625, 460, -1, -1, "COPYRIGHT 2007 LINLEY HENZELL");
464
465 do
466 {
467 rest(5);
468 }
469 while (ticked == 0);
470 ticked = 0;
471
472 vsync ();
473 blit (display, screen, 0, 0, 0, 0, 640, 480);
474
475
476 /*
477
478
479 if (key_wait == 0)
480 {
481 if (key[KEY_UP] || key[KEY_8_PAD])
482 {
483 menu_select--;
484 if (menu_select < 0)
485 menu_select = MENU_EXIT;
486 if (menu_select == MENU_CALIBRATE && options.joystick == 0)
487 menu_select = MENU_KEYS;
488 if (menu_select == MENU_JOY_OR_KEYS && options.joystick == 0)
489 menu_select = MENU_JOY_OR_KEYS - 1;
490 key_wait = 7;
491 }
492 if (key[KEY_DOWN] || key[KEY_2_PAD])
493 {
494 menu_select++;
495 if (menu_select > MENU_EXIT)
496 menu_select = 0;
497 if (menu_select == MENU_CALIBRATE && options.joystick == 0)
498 menu_select = MENU_EXIT;
499 if (menu_select == MENU_JOY_OR_KEYS && options.joystick == 0)
500 menu_select = MENU_KEYS;
501 key_wait = 7;
502 }
503 if (key[KEY_LEFT] || key[KEY_4_PAD])
504 {
505 if (menu_select == MENU_JOY_OR_KEYS)
506 {
507 if (options.key_or_joy == 0)
508 options.key_or_joy = 1;
509 else
510 options.key_or_joy = 0;
511 }
512 if (menu_select == MENU_DIFFICULTY)
513 {
514 arena.difficulty--;
515 if (arena.difficulty < 0)
516 arena.difficulty = 0;
517 }
518 key_wait = 7;
519 }
520 if (key[KEY_RIGHT] || key[KEY_6_PAD])
521 {
522 if (menu_select == MENU_JOY_OR_KEYS)
523 {
524 if (options.key_or_joy == 0)
525 options.key_or_joy = 1;
526 else
527 options.key_or_joy = 0;
528 }
529 if (menu_select == MENU_DIFFICULTY)
530 {
531 arena.difficulty++;
532 if (arena.difficulty > 2)
533 arena.difficulty = 2;
534 }
535 key_wait = 7;
536 }
537
538 if (key[KEY_ENTER] || key[KEY_SPACE] || key[KEY_Z])
539 {
540 if (menu_select == MENU_EXIT)
541 exit (0);
542
543 if (menu_select == MENU_KEYS)
544 {
545 key_wait = 10;
546 define_keys ();
547 key_wait = 10;
548 }
549
550 if (menu_select == MENU_CALIBRATE)
551 {
552 jstick_calibrate ();
553 key_wait = 20;
554 ticked = 0;
555 }
556
557 if (menu_select == MENU_START)
558 {
559 ticked = 0;
560 key_wait = 30;
561 if (ship_select () == 1)
562 {
563 clear_bitmap (display);
564 new_game ();
565 game_loop ();
566 if (arena.level == 5)
567 congratulations ();
568 reset_menu_palette ();
569 key_wait = 10; // was 1
570 flower_dir *= -1;
571 ticked = 0;
572 }
573 else
574 key_wait = 20;
575 }
576 else
577 key_wait = 20;
578 }
579 }
580 else
581 key_wait--;
582
583
584 // rectfill(display, 360, 430, 635, 461, TRANS_SH1_IN);
585
586 textprintf_right_ex (display, font, 625, 460, -1, -1, "COPYRIGHT 2007 LINLEY HENZELL");
587
588
589
590 do
591 {
592 thing++;
593 }
594 while (ticked == 0);
595 ticked = 0;
596
597 vsync ();
598 blit (display, screen, 0, 0, 0, 0, 640, 480); */
599
600
601
602 };
603
604
605 }
606
define_keys(void)607 void define_keys (void)
608 {
609
610 key_box ("PRESS KEY FOR UP", CKEY_UP);
611 key_box ("PRESS KEY FOR LEFT", CKEY_LEFT);
612 key_box ("PRESS KEY FOR RIGHT", CKEY_RIGHT);
613 key_box ("PRESS KEY FOR DOWN", CKEY_DOWN);
614 key_box ("PRESS KEY FOR FIRE 1", CKEY_FIRE1);
615 key_box ("PRESS KEY FOR FIRE 2", CKEY_FIRE2);
616 key_box ("PRESS KEY FOR FIRE 3", CKEY_FIRE3);
617 key_box ("PRESS KEY FOR SLOW", CKEY_SLOW);
618
619 set_config_int ("Misc", "key_up", player.key[CKEY_UP]);
620 set_config_int ("Misc", "key_left", player.key[CKEY_LEFT]);
621 set_config_int ("Misc", "key_right", player.key[CKEY_RIGHT]);
622 set_config_int ("Misc", "key_down", player.key[CKEY_DOWN]);
623 set_config_int ("Misc", "key_fire1", player.key[CKEY_FIRE1]);
624 set_config_int ("Misc", "key_fire2", player.key[CKEY_FIRE2]);
625 set_config_int ("Misc", "key_fire3", player.key[CKEY_FIRE3]);
626 set_config_int ("Misc", "key_slow", player.key[CKEY_SLOW]);
627 }
628
629
key_box(const char ktext[],int command)630 void key_box (const char ktext[], int command)
631 {
632 rectfill (display, 210, 200, 430, 250, COL_OUTLINE);
633 rect (display, 211, 201, 429, 249, COL_COL1);
634
635 textprintf_centre_ex (display, font, 320, 222, -1, -1, "%s", ktext);
636
637 vsync ();
638 blit (display, screen, 0, 0, 0, 0, 640, 480);
639
640 int inputted = KEY_ESC;
641
642 int i;
643 int anykey = 0;
644
645 do
646 {
647 rest(200);
648 clear_keybuf();
649 while (keypressed() != TRUE)
650 rest(20);
651 inputted = readkey() >> 8; /* the conversion to the right key format */
652 }/* if inputted is acceptable, then we want out of this loop */
653 while (acceptable_char(inputted) != 1);
654 player.key[command] = inputted;
655 }
656
657
658
659
660
ship_select(void)661 int ship_select (void)
662 {
663
664 int row = 0;
665 int column[4] = { 0, WPN_SCATTER, WPN_CANNON, WPN_SEEKER };
666 int i, j, k;
667 int out_count = 0;
668
669 int x1, y1, anykey, out;
670 char column_changed = 0;
671
672 while (TRUE)
673 {
674
675 clear_to_color (display, COL_OUTLINE);
676
677 counter += 4;
678 if (counter >= 40)
679 counter = 0;
680
681 out_count += 32;
682 out_count &= 1023;
683
684 y1 = 170;
685 x1 = 55;
686
687 int col1;
688 int col2;
689
690 // TRANS_MODE
691 for (i = 1; i < 4; i++)
692 {
693 col1 = COL_BACK2;
694 col2 = COL_BACK3;
695 if (skippable_column (column[i]))
696 {
697 col1 = COL_BACK2;
698 col2 = COL_BACK3;
699 rectfill (display, 5 + x1 + column[i] * 60, y1 + 110,
700 34 + x1 + column[i] * 60, 460, col1);
701 rect (display, 5 + x1 + column[i] * 60 - 2, y1 + 110 - 2,
702 34 + x1 + column[i] * 60 + 2, 460 + 2, col2);
703 }
704 else
705 {
706 rectfill (display, -3 + x1 + column[i] * 60, y1 + (i + 1) * 60 - 4,
707 42 + x1 + column[i] * 60, y1 + (i + 1) * 60 + 39 + 4, col1);
708 rect (display, -3 + x1 + column[i] * 60 - 2,
709 y1 + (i + 1) * 60 - 2 - 4, 42 + x1 + column[i] * 60 + 2,
710 y1 + (i + 1) * 60 + 41 + 4, col2);
711 }
712 }
713 // END_TRANS_MODE
714
715 for (j = 0; j < 4; j++)
716 {
717 if (row == j)
718 {
719 TRANS_MODE
720 rectfill (display, 0, y1 + j * 60 + 10, 640, y1 + 30 + j * 60,
721 TRANS_ORANGE_IN);
722 hline (display, 0, y1 + j * 60 + 9, 640, TRANS_ORANGE_OUT);
723 hline (display, 0, y1 + 31 + j * 60, 640, TRANS_ORANGE_OUT);
724 END_TRANS_MODE
725 }
726 for (i = 0; i < 9; i++)
727 {
728 // if (j == 0)
729 if (j == 0)
730 {
731
732 if (i > 0 && i < 7)
733 {
734 draw_rle_sprite (display, player_icon_RLE, 20 + x1 + i * 60 - 11,
735 20 + y1 + j * 60 - 15);
736 for (k = 0; k < 3; k++)
737 {
738 draw_rle_sprite (display,
739 RLE_multi[standard_config[i - 1][k]][0].sprite,
740 20 + x1 + i * 60 -
741 RLE_multi[standard_config[i - 1][k]][0].x,
742 20 + y1 + j * 60 -
743 RLE_multi[standard_config[i - 1][k]][0].y +
744 30 + k * 15);
745 }
746 }
747 if (i == 7)
748 {
749 draw_rle_sprite (display, player_icon_RLE, 20 + x1 + i * 60 - 11,
750 20 + y1 + j * 60 - 15);
751 for (k = 0; k < 3; k++)
752 {
753 draw_rle_sprite (display, RLE_multi[custom_config[k]][0].sprite,
754 20 + x1 + i * 60 -
755 RLE_multi[custom_config[k]][0].x,
756 20 + y1 + j * 60 -
757 RLE_multi[custom_config[k]][0].y + 30 +
758 k * 15);
759 }
760 }
761 if (i == 8)
762 {
763 textprintf_centre_ex (display, font, 20 + x1 + i * 60,
764 13 + y1 + j * 60, -1, -1, "EXIT");
765 }
766 if (i == 0)
767 {
768 textprintf_centre_ex (display, font, 20 + x1 + i * 60,
769 13 + y1 + j * 60, -1, -1, "HELP");
770 }
771
772 continue;
773 }
774
775 if (column[j] == i)
776 {
777 // rectfill(display, x1 + i * 60, y1 + j * 60, x1 + 40 + i * 60, y1 + 40 + j * 60, COL_COL3);
778 draw_rle_sprite (display, RLE_multi[i][0].sprite,
779 20 + x1 + i * 60 - RLE_multi[i][0].x,
780 20 + y1 + j * 60 - RLE_multi[i][0].y);
781
782 // draw_rle_sprite(display, icon_RLEs [i], x1 + i * 60, y1 + j * 60);
783 }
784 else
785 {
786 //rectfill(display, x1 + i * 60, y1 + j * 60, x1 + 40 + i * 60, y1 + 40 + j * 60, COL_COL4);
787 draw_rle_sprite (display, RLE_multi[i][0].sprite,
788 20 + x1 + i * 60 - RLE_multi[i][0].x,
789 20 + y1 + j * 60 - RLE_multi[i][0].y);
790 // draw_rle_sprite(display, RLE_multi [i] [0].sprite, 20 + x1 + i * 60 - RLE_multi [0] [k].x, 20 + y1 + j * 60 - RLE_multi [i] [0].y);
791 // draw_rle_sprite(display, icon_RLEs [i], x1 + i * 60, y1 + j * 60);
792 }
793
794 // rectfill(display, x1 + i * 60, y1 + j * 60, x1 + 40 + i * 60, y1 + 40 + j * 60, COL_COL4);
795
796 }
797 if (j == 0)
798 y1 += 60;
799 }
800
801 TRANS_MODE y1 = 170;
802
803 for (j = 0; j < 4; j++)
804 {
805 if (j == 0)
806 {
807 if (column[0] > 0 && column[0] < 8)
808 {
809 rect (display, x1 + (column[j] * 60), y1 + j * 60,
810 x1 + (column[j] * 60) + 39, y1 + j * 60 + 92,
811 TRANS_YELLOW_OUT);
812 rect (display, x1 + (column[j] * 60) + 1, y1 + j * 60 + 1,
813 x1 + (column[j] * 60) + 38, y1 + j * 60 + 91,
814 TRANS_YELLOW_IN);
815 rect (display, x1 + (column[j] * 60) + 2, y1 + j * 60 + 2,
816 x1 + (column[j] * 60) + 37, y1 + j * 60 + 90,
817 TRANS_YELLOW_OUT);
818 }
819 else
820 {
821 rect (display, x1 + (column[j] * 60) - 4, y1 + j * 60,
822 x1 + (column[j] * 60) + 43, y1 + j * 60 + 39,
823 TRANS_YELLOW_OUT);
824 rect (display, x1 + (column[j] * 60) - 3, y1 + j * 60 + 1,
825 x1 + (column[j] * 60) + 42, y1 + j * 60 + 38,
826 TRANS_YELLOW_IN);
827 rect (display, x1 + (column[j] * 60) - 2, y1 + j * 60 + 2,
828 x1 + (column[j] * 60) + 41, y1 + j * 60 + 37,
829 TRANS_YELLOW_OUT);
830 }
831 }
832 else
833 {
834 rect (display, x1 + (column[j] * 60), y1 + j * 60,
835 x1 + (column[j] * 60) + 39, y1 + j * 60 + 39, TRANS_YELLOW_OUT);
836 rect (display, x1 + (column[j] * 60) + 1, y1 + j * 60 + 1,
837 x1 + (column[j] * 60) + 38, y1 + j * 60 + 38, TRANS_YELLOW_IN);
838 rect (display, x1 + (column[j] * 60) + 2, y1 + j * 60 + 2,
839 x1 + (column[j] * 60) + 37, y1 + j * 60 + 37, TRANS_YELLOW_OUT);
840 }
841
842 if (row == j)
843 {
844 out = xpart (out_count, 6);
845 if (row == 0)
846 {
847 out += 10;
848 if (column[0] > 0 && column[0] < 8)
849 {
850 rect (display, x1 + (column[j] * 60) - out, y1 + j * 60 - out,
851 x1 + (column[j] * 60) + 39 + out, y1 + j * 60 + 92 + out,
852 TRANS_ORANGE_OUT);
853 rect (display, x1 + (column[j] * 60) + 1 - out,
854 y1 + j * 60 + 1 - out, x1 + (column[j] * 60) + 38 + out,
855 y1 + j * 60 + 91 + out, TRANS_ORANGE_IN);
856 rect (display, x1 + (column[j] * 60) + 2 - out,
857 y1 + j * 60 + 2 - out, x1 + (column[j] * 60) + 37 + out,
858 y1 + j * 60 + 90 + out, TRANS_ORANGE_OUT);
859 }
860 else
861 {
862 rect (display, x1 + (column[j] * 60) - out, y1 + j * 60 - out,
863 x1 + (column[j] * 60) + 39 + out, y1 + j * 60 + 39 + out,
864 TRANS_ORANGE_OUT);
865 rect (display, x1 + (column[j] * 60) + 1 - out,
866 y1 + j * 60 + 1 - out, x1 + (column[j] * 60) + 38 + out,
867 y1 + j * 60 + 38 + out, TRANS_ORANGE_IN);
868 rect (display, x1 + (column[j] * 60) + 2 - out,
869 y1 + j * 60 + 2 - out, x1 + (column[j] * 60) + 37 + out,
870 y1 + j * 60 + 37 + out, TRANS_ORANGE_OUT);
871 }
872 }
873 else
874 {
875 rect (display, x1 + (column[j] * 60) - out, y1 + j * 60 - out,
876 x1 + (column[j] * 60) + 39 + out, y1 + j * 60 + 39 + out,
877 TRANS_ORANGE_OUT);
878 rect (display, x1 + (column[j] * 60) + 1 - out,
879 y1 + j * 60 + 1 - out, x1 + (column[j] * 60) + 38 + out,
880 y1 + j * 60 + 38 + out, TRANS_ORANGE_IN);
881 rect (display, x1 + (column[j] * 60) + 2 - out,
882 y1 + j * 60 + 2 - out, x1 + (column[j] * 60) + 37 + out,
883 y1 + j * 60 + 37 + out, TRANS_ORANGE_OUT);
884 }
885
886 }
887
888 if (j > 0 || (column[0] > 0 && column[0] < 8))
889 {
890 if (j == 0)
891 {
892 vline (display, x1 + (column[j] * 60) + 19, y1 + j * 60 + 92,
893 y1 + j * 60 + 101, TRANS_YELLOW_IN);
894 vline (display, x1 + (column[j] * 60) + 18, y1 + j * 60 + 91,
895 y1 + j * 60 + 102, TRANS_YELLOW_OUT);
896 vline (display, x1 + (column[j] * 60) + 20, y1 + j * 60 + 90,
897 y1 + j * 60 + 102, TRANS_YELLOW_OUT);
898
899 vline (display, x1 + (column[j + 1] * 60) + 19, y1 + j * 60 + 102,
900 y1 + j * 60 + 121, TRANS_YELLOW_IN);
901 vline (display, x1 + (column[j + 1] * 60) + 18, y1 + j * 60 + 100,
902 y1 + j * 60 + 120, TRANS_YELLOW_OUT);
903 vline (display, x1 + (column[j + 1] * 60) + 20, y1 + j * 60 + 100,
904 y1 + j * 60 + 119, TRANS_YELLOW_OUT);
905
906 hline (display, x1 + (column[j] * 60) + 19, y1 + j * 60 + 101,
907 x1 + (column[j + 1] * 60) + 19, TRANS_YELLOW_IN);
908 hline (display, x1 + (column[j] * 60) + 19, y1 + j * 60 + 102,
909 x1 + (column[j + 1] * 60) + 19, TRANS_YELLOW_OUT);
910 hline (display, x1 + (column[j] * 60) + 19, y1 + j * 60 + 100,
911 x1 + (column[j + 1] * 60) + 19, TRANS_YELLOW_OUT);
912 }
913 else
914 {
915 if (j < 3)
916 {
917 vline (display, x1 + (column[j] * 60) + 19, y1 + j * 60 + 38,
918 y1 + j * 60 + 48, TRANS_YELLOW_IN);
919 vline (display, x1 + (column[j] * 60) + 18, y1 + j * 60 + 38,
920 y1 + j * 60 + 49, TRANS_YELLOW_OUT);
921 vline (display, x1 + (column[j] * 60) + 20, y1 + j * 60 + 38,
922 y1 + j * 60 + 49, TRANS_YELLOW_OUT);
923
924 vline (display, x1 + (column[j + 1] * 60) + 19, y1 + j * 60 + 48,
925 y1 + j * 60 + 61, TRANS_YELLOW_IN);
926 vline (display, x1 + (column[j + 1] * 60) + 18, y1 + j * 60 + 47,
927 y1 + j * 60 + 61, TRANS_YELLOW_OUT);
928 vline (display, x1 + (column[j + 1] * 60) + 20, y1 + j * 60 + 47,
929 y1 + j * 60 + 61, TRANS_YELLOW_OUT);
930
931 hline (display, x1 + (column[j] * 60) + 19, y1 + j * 60 + 48,
932 x1 + (column[j + 1] * 60) + 19, TRANS_YELLOW_IN);
933 hline (display, x1 + (column[j] * 60) + 19, y1 + j * 60 + 47,
934 x1 + (column[j + 1] * 60) + 19, TRANS_YELLOW_OUT);
935 hline (display, x1 + (column[j] * 60) + 19, y1 + j * 60 + 49,
936 x1 + (column[j + 1] * 60) + 19, TRANS_YELLOW_OUT);
937 }
938 }
939 }
940
941 if (j == 0)
942 y1 += 60;
943
944
945 }
946
947
948 END_TRANS_MODE if (row > 0)
949 {
950 if (column[row] < 3 || column[row] > 6)
951 textprintf_right_ex (display, font, 280, 40, -1, -1, "FAST WEAPON:");
952 else
953 textprintf_right_ex (display, font, 280, 40, -1, -1, "SLOW WEAPON:");
954 print_wpn_name (290, 40, column[row]);
955 print_wpn_text (290, 80, column[row]);
956
957 if (column[row] == 0 || column[row] > 6)
958 textprintf_ex (display, font, 290, 130, -1, -1, "ONE ONLY");
959
960 }
961
962 if (row == 0 && column[0] == 0)
963 {
964 textprintf_centre_ex (display, font, 320, 20, -1, -1,
965 "SELECT YOUR ARMAMENT");
966 textprintf_centre_ex (display, font, 320, 60, -1, -1,
967 "SELECT A STANDARD CONFIGURATION ALONG THE TOP ROW");
968 textprintf_centre_ex (display, font, 320, 80, -1, -1,
969 "OR CUSTOMISE BY CHOOSING SPECIFIC WEAPONS");
970 textprintf_centre_ex (display, font, 320, 100, -1, -1,
971 "ON THE OTHER ROWS");
972 textprintf_centre_ex (display, font, 320, 130, -1, -1,
973 "PRESS FIRE 1 TO BEGIN");
974 }
975
976 if (row == 0 && column[0] == 8)
977 {
978 textprintf_centre_ex (display, font, 320, 40, -1, -1,
979 "PRESS FIRE 1 TO EXIT");
980 }
981
982 if (row == 0 && column[0] > 0 && column[0] < 8)
983 {
984 if (column[0] == 7)
985 textprintf_centre_ex (display, font, 320, 40, -1, -1,
986 "SPECIAL CONFIGURATION");
987 else
988 {
989 if (column[0] == 6)
990 textprintf_centre_ex (display, font, 320, 40, -1, -1,
991 "CHALLENGE CONFIGURATION");
992 else
993 textprintf_centre_ex (display, font, 320, 40, -1, -1,
994 "STANDARD CONFIGURATION");
995 }
996 print_standard_names (320, 80, column[row] - 1);
997
998 }
999 /*
1000 poll_joystick();
1001 if (joy[0].stick[options.joy_stick].axis[0].d1)
1002 { simulate_keypress(KEY_LEFT << 8); }
1003 if (joy[0].stick[options.joy_stick].axis[0].d2)
1004 { simulate_keypress(KEY_RIGHT << 8); }
1005 if (joy[0].stick[options.joy_stick].axis[1].d1)
1006 { simulate_keypress(KEY_UP << 8); }
1007 if (joy[0].stick[options.joy_stick].axis[1].d2)
1008 { simulate_keypress(KEY_DOWN << 8); }
1009 if (joy[0].button[options.joy_button[0]].b)
1010 { simulate_keypress(KEY_ENTER << 8); }*/
1011
1012 if ( ( keypressed() ) && key_wait == 0)
1013 {
1014 int pressed_key = readkey() >> 8;
1015 clear_keybuf();
1016 if (pressed_key == KEY_UP || pressed_key == KEY_8_PAD)
1017 {
1018 row--;
1019 if (row < 0)
1020 row = 3;
1021 key_wait = 7;
1022 }
1023 if (pressed_key == KEY_DOWN || pressed_key == KEY_2_PAD)
1024 {
1025 row++;
1026 if (row > 3)
1027 row = 0;
1028 key_wait = 7;
1029 }
1030 if (pressed_key == KEY_LEFT || pressed_key == KEY_4_PAD)
1031 {
1032 do
1033 {
1034 column[row]--;
1035 if (column[row] < 0)
1036 column[row] = 8;
1037 column_changed = 1;
1038 }
1039 while (row > 0 && skippable_column (column[row])
1040 && ((column[row] == column[1]) + (column[row] == column[2]) +
1041 (column[row] == column[3]) > 1));
1042 key_wait = 7;
1043 }
1044 if (pressed_key == KEY_RIGHT || pressed_key == KEY_6_PAD)
1045 {
1046 do
1047 {
1048 column[row]++;
1049 if (column[row] > 8)
1050 column[row] = 0;
1051 column_changed = 1;
1052 }
1053 while (row > 0 && skippable_column (column[row])
1054 && ((column[row] == column[1]) + (column[row] == column[2]) +
1055 (column[row] == column[3]) > 1));
1056 key_wait = 7;
1057 }
1058
1059 if (column_changed == 1)
1060 {
1061 column_changed = 0;
1062 if (row > 0 && column[0] <= 7)
1063 {
1064 column[0] = 7;
1065 custom_config[0] = column[1];
1066 custom_config[1] = column[2];
1067 custom_config[2] = column[3];
1068 }
1069
1070 if (row == 0)
1071 {
1072 if (column[0] > 0 && column[0] < 7)
1073 {
1074 column[1] = standard_config[column[0] - 1][0];
1075 column[2] = standard_config[column[0] - 1][1];
1076 column[3] = standard_config[column[0] - 1][2];
1077 }
1078 if (column[0] == 7)
1079 {
1080 column[1] = custom_config[0];
1081 column[2] = custom_config[1];
1082 column[3] = custom_config[2];
1083 }
1084 }
1085
1086 }
1087
1088 if (pressed_key == KEY_ESC)
1089 return 0;
1090
1091 if (pressed_key == KEY_ENTER || pressed_key == KEY_SPACE || pressed_key == KEY_Z)
1092 {
1093 if (row == 0 && column[0] == 8)
1094 return 0;
1095 break;
1096 }
1097 }//endif (keypressed() && key_wait == 0)
1098 else
1099 {
1100 int keys_before = 1;
1101 if (keypressed())
1102 clear_keybuf(); /* we are not interested in keys in the queue */
1103 else
1104 keys_before = 0; /* there were no keys pressed before */
1105
1106 rest(20);
1107
1108 jstick_to_keypressed();
1109 key_wait -= 2;
1110 if ( ( !keypressed() && !keys_before ) || key_wait <= 0)
1111 {/* we can process next keypress since the previous keypress has ended */
1112 key_wait = 0;
1113 }
1114 }
1115
1116 /*
1117 do
1118 {
1119 rest(5);
1120 }
1121 while (ticked == 0);
1122 */
1123 ticked = 0;
1124
1125 vsync ();
1126 blit (display, screen, 0, 0, 0, 0, 640, 480);
1127
1128
1129
1130 };
1131
1132 player.orbitals = 3;
1133 player.orbital_angle = 0;
1134
1135 for (i = 0; i < 3; i++)
1136 {
1137 player.weapon[i] = column[i + 1];
1138 player.wx[i] = -1000;
1139 player.wy[i] = -1000;
1140 player.wstatus[i] = 0;
1141 player.wstyle[i] = WSTYLE_ORBITAL;
1142 player.wtype[i] = FAST_WEAPON;
1143
1144 switch (player.weapon[i])
1145 {
1146 case WPN_MGUN:
1147 player.wstyle[i] = WSTYLE_FRONT;
1148 player.orbitals--;
1149 break;
1150 case WPN_BLADE:
1151 player.wstyle[i] = WSTYLE_BLADE;
1152 player.blade_index = i;
1153 player.orbitals--;
1154 break;
1155 case WPN_EIGHT:
1156 player.ring_index = i;
1157 break;
1158 case WPN_LWBEAM:
1159 // player.beam_index = i;
1160 break;
1161 case WPN_CANNON:
1162 player.wtype[i] = SLOW_WEAPON;
1163 break;
1164 case WPN_RECT:
1165 player.wtype[i] = SLOW_WEAPON;
1166 break;
1167 case WPN_SWBEAM:
1168 player.wtype[i] = SLOW_WEAPON;
1169 break;
1170 case WPN_SEEKER:
1171 player.wtype[i] = SLOW_WEAPON;
1172 break;
1173
1174
1175
1176 }
1177
1178
1179 }
1180
1181 return 1;
1182
1183 }
1184
skippable_column(int colm)1185 char skippable_column (int colm)
1186 {
1187 switch (colm)
1188 {
1189 case WPN_MGUN:
1190 return 1;
1191 case WPN_BLADE:
1192 return 1;
1193 case WPN_EIGHT:
1194 return 1;
1195 }
1196
1197 return 0;
1198
1199 }
1200
1201
acceptable_char(int scode)1202 int acceptable_char (int scode)
1203 {
1204
1205 switch (scode)
1206 {
1207 case KEY_ESC:
1208 key_wait = 7;
1209 return 0;
1210 case KEY_ENTER:
1211 case KEY_ENTER_PAD:
1212 key_wait = 7;
1213 return 0;
1214 }
1215 return 1;
1216
1217 }
1218
print_wpn_name(int x,int y,int w)1219 void print_wpn_name (int x, int y, int w)
1220 {
1221
1222 switch (w)
1223 {
1224 case WPN_CANNON:
1225 textprintf_ex (display, font, x, y, -1, -1, "VAPOUR ORB");
1226 break;
1227 case WPN_MGUN:
1228 textprintf_ex (display, font, x, y, -1, -1, "SOLAR BITE");
1229 break;
1230 case WPN_SCATTER:
1231 textprintf_ex (display, font, x, y, -1, -1, "SUNSHOWER");
1232 break;
1233 case WPN_SEEKER:
1234 textprintf_ex (display, font, x, y, -1, -1, "WORMS OF TORMENT");
1235 break;
1236 case WPN_EIGHT:
1237 textprintf_ex (display, font, x, y, -1, -1, "EIGHT MOUTHS OF HELL");
1238 break;
1239 case WPN_LWBEAM:
1240 textprintf_ex (display, font, x, y, -1, -1, "ENDURING FILAMENT");
1241 break;
1242 case WPN_SWBEAM:
1243 textprintf_ex (display, font, x, y, -1, -1, "SUDDEN FILAMENT");
1244 break;
1245 case WPN_RECT:
1246 textprintf_ex (display, font, x, y, -1, -1, "EYE OF RECTIFICATION");
1247 break;
1248 case WPN_BLADE:
1249 textprintf_ex (display, font, x, y, -1, -1, "TOOTH OF XOM");
1250 break;
1251
1252 }
1253
1254 }
1255
print_wpn_text(int x,int y,int w)1256 void print_wpn_text (int x, int y, int w)
1257 {
1258
1259 switch (w)
1260 {
1261 case WPN_CANNON:
1262 textprintf_ex (display, font, x, y, -1, -1, "VERY EFFECTIVE AGAINST");
1263 textprintf_ex (display, font, x, y + 15, -1, -1,
1264 "SINGLE LARGE TARGETS");
1265 break;
1266 case WPN_MGUN:
1267 textprintf_ex (display, font, x, y, -1, -1, "PRECISE STRIKE AGAINST");
1268 textprintf_ex (display, font, x, y + 15, -1, -1, "SMALL TARGETS");
1269 break;
1270 case WPN_SCATTER:
1271 textprintf_ex (display, font, x, y, -1, -1, "SCATTERED FIRE AGAINST");
1272 textprintf_ex (display, font, x, y + 15, -1, -1, "SMALL TARGETS");
1273 break;
1274 case WPN_SEEKER:
1275 textprintf_ex (display, font, x, y, -1, -1, "LOCKS ON TO");
1276 textprintf_ex (display, font, x, y + 15, -1, -1, "MULTIPLE TARGETS");
1277 textprintf_ex (display, font, x, y + 30, -1, -1, "BEHIND YOU");
1278 break;
1279 case WPN_RECT:
1280 textprintf_ex (display, font, x, y, -1, -1, "POWERFUL AREA STRIKE");
1281 textprintf_ex (display, font, x, y + 15, -1, -1,
1282 "AGAINST MULTIPLE TARGETS");
1283 break;
1284 case WPN_LWBEAM:
1285 textprintf_ex (display, font, x, y, -1, -1, "PIERCES MULTIPLE TARGETS");
1286 break;
1287 case WPN_SWBEAM:
1288 textprintf_ex (display, font, x, y, -1, -1, "PIERCES MULTIPLE TARGETS");
1289 textprintf_ex (display, font, x, y + 15, -1, -1, "FOR GREAT DAMAGE");
1290 break;
1291 case WPN_EIGHT:
1292 textprintf_ex (display, font, x, y, -1, -1, "MOVE AND FIRE IN");
1293 textprintf_ex (display, font, x, y + 15, -1, -1,
1294 "ALL EIGHT DIRECTIONS");
1295 break;
1296 case WPN_BLADE:
1297 textprintf_ex (display, font, x, y, -1, -1, "TAP TO SLASH");
1298 textprintf_ex (display, font, x, y + 15, -1, -1, "HOLD TO SWING");
1299 break;
1300 }
1301 }
1302
1303
print_standard_names(int x,int y,int w)1304 void print_standard_names (int x, int y, int w)
1305 {
1306
1307 switch (w)
1308 {
1309 case 0:
1310 textprintf_centre_ex (display, font, x, y, -1, -1, "FIGHTER TYPE");
1311 break;
1312 case 1:
1313 textprintf_centre_ex (display, font, x, y, -1, -1, "RIOT TYPE");
1314 break;
1315 case 2:
1316 textprintf_centre_ex (display, font, x, y, -1, -1, "FILAMENT TYPE 1");
1317 break;
1318 case 3:
1319 textprintf_centre_ex (display, font, x, y, -1, -1, "FILAMENT TYPE 2");
1320 break;
1321 case 4:
1322 textprintf_centre_ex (display, font, x, y, -1, -1, "PURE TYPE");
1323 break;
1324 case 5:
1325 textprintf_centre_ex (display, font, x, y, -1, -1, "ARENA TYPE");
1326 break;
1327 case 6:
1328 textprintf_centre_ex (display, font, x, y, -1, -1, "CUSTOM TYPE");
1329 break;
1330 }
1331 }
1332
1333
run_menu_background(void)1334 void run_menu_background (void)
1335 {
1336
1337 static int flower_counter = 0;
1338
1339 // if (counter2 & 1)
1340 flower_counter += flower_dir;
1341 if (flower_counter >= 40)
1342 flower_counter = 0;
1343 if (flower_counter < 0)
1344 flower_counter = 39;
1345
1346 int x = 275;
1347 int y = 150;
1348
1349 draw_rle_sprite (display, eRLE_flower[0][flower_counter].sprite,
1350 x - eRLE_flower[0][flower_counter].x + 42 + 3,
1351 y - eRLE_flower[0][flower_counter].y + 47);
1352
1353 // vline(display, 320, 0, 480, COL_WHITE);
1354
1355
1356 }
1357
congratulations(void)1358 void congratulations (void)
1359 {
1360
1361 clear_bitmap (screen);
1362 vsync ();
1363 clear_bitmap (display);
1364
1365 arena.target_palette = BASECOL_CFLOWER;
1366 set_base_palette ();
1367
1368 int newpal = build_new_palette (arena.change_palette, 0, 0, 0);
1369 vsync ();
1370 set_palette (palet[newpal]);
1371
1372 int y;
1373 int y_int = 35;
1374
1375 int c_count = 0;
1376
1377 init_cflowers ();
1378
1379 do
1380 {
1381
1382 run_cflowers ();
1383
1384 y = 90;
1385
1386 textprintf_centre_ex (display, font, 320, y, -1, -1,
1387 "C O N G R A T U L A T I O N S ! !");
1388
1389 y += y_int * 2;
1390
1391 if (c_count >= 100)
1392 textprintf_centre_ex (display, font, 320, y, -1, -1,
1393 "YOU HAVE CLEANSED THE INNER GARDEN,");
1394 y += y_int;
1395
1396 if (c_count >= 200)
1397 textprintf_centre_ex (display, font, 320, y, -1, -1,
1398 "RAIDED THE FLEET,");
1399 y += y_int;
1400
1401 if (c_count >= 300)
1402 textprintf_centre_ex (display, font, 320, y, -1, -1,
1403 "TRAVERSED THE OUTER REGIONS,");
1404
1405 y += y_int;
1406 if (c_count >= 400)
1407 textprintf_centre_ex (display, font, 320, y, -1, -1,
1408 "AND ELIMINATED THE SOURCE OF THE PARASITES.");
1409
1410 y += y_int * 2;
1411 if (c_count >= 550)
1412 {
1413 switch (arena.difficulty)
1414 {
1415 case 0:
1416 textprintf_centre_ex (display, font, 320, y, -1, -1,
1417 "BUT CAN YOU DEFEAT A MORE CHALLENGING LEVEL?");
1418 break;
1419 case 1:
1420 textprintf_centre_ex (display, font, 320, y, -1, -1,
1421 "YOUR ACHIEVEMENT IS IMPRESSIVE!");
1422 break;
1423 case 2:
1424 textprintf_centre_ex (display, font, 320, y, -1, -1,
1425 "YOUR WORK HERE IS COMPLETE.");
1426 break;
1427 }
1428 }
1429
1430 if (c_count >= 700)
1431 {
1432 y += y_int * 2;
1433 textprintf_centre_ex (display, font, 320, y, -1, -1,
1434 "PRESS SPACE TO CONTINUE");
1435
1436 TRANS_MODE
1437 rectfill (display, 100, y, 500, y + 15, CONVERT_WHITE_TO_GREY);
1438 END_TRANS_MODE if (key[KEY_SPACE])
1439 break;
1440 }
1441
1442 blit (display, screen, 0, 0, 0, 0, 640, 480);
1443
1444 do
1445 {
1446 rest (5);
1447 }
1448 while (ticked == 0);
1449
1450 ticked--;
1451 c_count++;
1452 if (c_count > 30000)
1453 c_count = 30000;
1454
1455 }
1456 while (TRUE);
1457
1458 clear_bitmap (screen);
1459 rest (200);
1460
1461
1462
1463
1464 clear_bitmap (screen);
1465 vsync ();
1466 clear_bitmap (display);
1467
1468 arena.target_palette = BASECOL_L1_SPRING;
1469 set_base_palette ();
1470
1471 newpal = build_new_palette (arena.change_palette, 0, 0, 0);
1472 vsync ();
1473 set_palette (palet[newpal]);
1474
1475
1476
1477 }
1478
init_cflowers(void)1479 void init_cflowers (void)
1480 {
1481 int i;
1482
1483 for (i = 0; i < NO_CFLOWERS; i++)
1484 {
1485 new_cflower (i);
1486
1487 cflower_y[i] = -100 - (i * 100);
1488 }
1489
1490 made_cflower = 20 * 100 * -1;
1491
1492 }
1493
run_cflowers(void)1494 void run_cflowers (void)
1495 {
1496
1497 clear_to_color (display, COL_OUTLINE);
1498
1499 int i, j;
1500
1501 int k = 0;
1502
1503 int angle, y;
1504
1505 for (i = 0; i < NO_CFLOWERS; i++)
1506 {
1507 if (cflower_y[i] > 550 && made_cflower >= 100)
1508 {
1509 new_cflower (i);
1510 made_cflower = 0;
1511 }
1512 cflower_y[i] += 2;
1513 made_cflower += 2;
1514
1515 cflower_rot[i][k] += cflower_rot_inc[i][k];
1516 cflower_rot[i][k] &= 1023;
1517
1518 angle = cflower_rot[i][k];
1519
1520 if (i == NO_CFLOWERS - 1)
1521 continue;
1522
1523 y = cflower_y[i] + cflower_y_offset[i];
1524
1525 for (j = 0; j < cflower_petals[i][k]; j++)
1526 {
1527
1528 cflower_poly4 (display,
1529 cflower_x[i], y,
1530 cflower_x[i] + xpart (angle + cflower_angle[i][k],
1531 cflower_out1[i][k]),
1532 y + ypart (angle + cflower_angle[i][k],
1533 cflower_out1[i][k]),
1534 cflower_x[i] + xpart (angle, cflower_out2[i][k]),
1535 y + ypart (angle, cflower_out2[i][k]),
1536 cflower_x[i] + xpart (angle - cflower_angle[i][k],
1537 cflower_out1[i][k]),
1538 y + ypart (angle - cflower_angle[i][k],
1539 cflower_out1[i][k]), cflower_col[i][k]);
1540
1541 circlefill (display, cflower_x[i], y, cflower_centre_size[i],
1542 cflower_centre_col[i]);
1543 circle (display, cflower_x[i], y, cflower_centre_size[i], COL_OUTLINE);
1544
1545 angle += ANGLE_1 / cflower_petals[i][k];
1546
1547 }
1548
1549
1550 }
1551
1552
1553 }
1554
new_cflower(int f)1555 void new_cflower (int f)
1556 {
1557 cflower_x[f] = 320 - grand (150) - grand (150) + grand (150) + grand (150);
1558 cflower_y[f] = -100;
1559 cflower_y_offset[f] = grand (10);
1560 cflower_centre_col[f] = COL_COL1 + grand (8);
1561 if (grand (3) == 0)
1562 cflower_centre_col[f] = COL_WHITE;
1563 cflower_centre_size[f] = 6 + grand (5);
1564 cflower_col[f][0] = COL_COL1 + grand (9);
1565 cflower_out1[f][0] = 25 + grand (10); // inner corners of petal
1566 cflower_out2[f][0] = 36 + grand (10); // end of petal
1567 cflower_angle[f][0] = ANGLE_32 + grand (ANGLE_32); // angle of inner corners
1568 cflower_petals[f][0] = 3 + grand (2) + grand (2) + grand (2) + grand (2);
1569 cflower_rot_inc[f][0] = pos_or_neg (3 + grand (8));
1570 cflower_rot[f][0] = grand (ANGLE_1);
1571
1572 }
1573
1574
1575
1576
cflower_poly4(BITMAP * target,int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4,int col)1577 void cflower_poly4 (BITMAP * target, int x1, int y1, int x2, int y2, int x3,
1578 int y3, int x4, int y4, int col)
1579 {
1580
1581 int points[8];
1582 points[0] = x1;
1583 points[1] = y1;
1584 points[2] = x2;
1585 points[3] = y2;
1586 points[4] = x3;
1587 points[5] = y3;
1588 points[6] = x4;
1589 points[7] = y4;
1590
1591 polygon (target, 4, points, col);
1592
1593 }
1594
1595
1596 /*
1597 void loading_screen(void)
1598 {
1599
1600 splash_bitmap = load_bitmap("gfx//splash.bmp", splash_palette);
1601
1602 if (splash_bitmap == NULL)
1603 {
1604 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
1605 allegro_message("Failed to load in bitmap! (File not found?)
1606 %s", "splash.bmp");
1607 exit(1);
1608 }
1609
1610 BITMAP *wait_bitmap = load_bitmap("gfx//wait.bmp", splash_palette);
1611
1612 if (wait_bitmap == NULL)
1613 {
1614 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
1615 allegro_message("Failed to load in bitmap! (File not found?)
1616 %s", "wait.bmp");
1617 exit(1);
1618 }
1619
1620
1621 set_palette(splash_palette);
1622
1623 vsync();
1624 blit(splash_bitmap, screen, 0, 0, 0, 0, 640, 480);
1625 // blit(wait_bitmap, screen, 0, 0, 0, 0, 440, 300);
1626 draw_sprite(screen, wait_bitmap, 440, 300);
1627
1628 destroy_bitmap(wait_bitmap);
1629
1630
1631 }*/
1632
1633 /*
1634 void loading_screen_wait(void)
1635 {
1636
1637 BITMAP *press_bitmap = load_bitmap("gfx//press.bmp", splash_palette);
1638
1639 if (press_bitmap == NULL)
1640 {
1641 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
1642 allegro_message("Failed to load in bitmap! (File not found?)
1643 %s", "press.bmp");
1644 exit(1);
1645 }
1646
1647 vsync();
1648 blit(splash_bitmap, screen, 0, 0, 0, 0, 640, 480);
1649 draw_sprite(screen, press_bitmap, 390, 320);
1650
1651 do
1652 {
1653 if (key [KEY_ESC])
1654 exit(0);
1655 } while (key [KEY_SPACE] == 0);
1656
1657 destroy_bitmap(splash_bitmap);
1658 destroy_bitmap(press_bitmap);
1659
1660 vsync();
1661 clear_bitmap(screen);
1662 init_palette();
1663
1664 }
1665 */
1666