-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.c
executable file
·1246 lines (1169 loc) · 30.9 KB
/
menu.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/***********************************************************
* K O U L E S *
*----------------------------------------------------------*
* C1995 JAHUSOFT *
* Jan Hubicka *
* Dukelskych Bojovniku 1944 *
* 390 03 Tabor *
* Czech Republic *
* Phone: 0041-361-32613 *
* eMail: [email protected] *
*----------------------------------------------------------*
* Copyright(c)1995,1996 by Jan Hubicka.See README for *
* licence details. *
*----------------------------------------------------------*
* menu.c *
* GUI menuing system *
***********************************************************/
/* Changes for joystick "accelerate by deflection" *
* (c) 1997 by Ludvik Tesar (Ludv\'{\i}k Tesa\v{r}) *
************************LT*********************************/
#include "koules.h"
#include "net.h"
#include "client.h"
#ifdef JOYSTICK
#include <sys/ioctl.h>
#endif
//DKS
#include "sdl/input.h"
//DKS
#include "sdl/interface.h"
#include "sound.h"
typedef struct
{
char *text;
void (*func) ();
}
Menu;
typedef struct
{
int x, y, *number, max, min;
int line;
void (*func) ();
}
Numbers;
int ssound = 1;
static Numbers minim[2], maxim[2];
static int nmenu;
static int nnumbers;
static Menu menu[20];
static int selected = 0;
static float mx1, my1, mx1p, my1p;
static float mx2, my2, mx2p, my2p;
static int mtime;
static char playertext[] = " 1 PLAYER";
static char leveltext[] = "LEVEL 000 ";
#define YPOSITION(i) (MAPHEIGHT/2+20-5*nmenu+10*i)
#define XPOSITION(i) (MAPWIDTH/2-4*strlen(menu[i].text))
#define XPOSITION1(i) (MAPWIDTH/2+4*strlen(menu[i].text))
static int player, keynum, lastplayer;
#ifdef JOYSTICK
static int joystick, joypos;
static struct JS_DATA_TYPE js_data;
#endif
#ifdef GP2X
//DKS - ADDED FOR SHOWING VOLUME
static char volstr[20] = "";
#endif
//DKS - added this to tell if we are in the damned actual game or in the main menu
// , to facilitate whether we should draw scores along bottom
int in_actual_game = 0;
static void main_menu ();
static void change_menu ();
#ifdef JOYSTICK
static void
calibrate_init ()
{
int status;
long tmpl;
if (joystickdevice[joystick]<0)
{
printf("Joystick %c not found during initialization.", joystick+'A');
joystickplayer[joystick] = -2;
gamemode = MENU;
change_menu ();
return;
}
status = ioctl (joystickdevice[joystick], JS_GET_TIMELIMIT, &tmpl);
if (status == -1)
{
perror ("Joystick");
joystickplayer[joystick] = -2;
gamemode = MENU;
change_menu ();
return;
}
tmpl = 10; /* 10miliseconds */
status = ioctl (joystickdevice[joystick], JS_SET_TIMELIMIT, &tmpl);
if (status == -1)
{
perror ("Joystick");
joystickplayer[joystick] = -2;
gamemode = MENU;
change_menu ();
return;
}
}
#endif
static void
player_change ()
{
player = (selected - 2) / 2;
lastplayer = (selected - 2) / 2;
#ifdef MOUSE
if (player == mouseplayer)
return;
#endif
#ifdef JOYSTICK
if (player == joystickplayer[0])
{
joystick = 0;
joypos = 0;
gamemode = JOY;
calibrate_init ();
return;
}
if (player == joystickplayer[1])
{
joystick = 1;
joypos = 0;
gamemode = JOY;
calibrate_init ();
return;
}
#endif
keynum = 0;
gamemode = KEYS;
}
static void
control_change ()
{
int player;
player = (selected - 1) / 2;
#ifdef NETSUPPORT
if (client && !control[player])
return;
#endif
#ifdef MOUSE
if(mouseplayer<0) mouseplayer=-1;
if(mouseplayer>=nrockets) mouseplayer=-1;
#endif
#ifdef JOYSTICK
if(joystickplayer[0]<0) joystickplayer[0]=-1;
if(joystickplayer[0]>=nrockets) joystickplayer[0]=-1;
if(joystickplayer[1]<0) joystickplayer[1]=-1;
if(joystickplayer[1]>=nrockets) joystickplayer[1]=-1;
#ifdef NETSUPPORT
if(client && !control[joystickplayer[0]]) joystickplayer[0]=-1;
if(client && !control[joystickplayer[1]]) joystickplayer[1]=-1;
if (client && !control[player])
return;
#endif
#endif
#ifdef NETSUPPORT
if(client && !control[mouseplayer]) mouseplayer=-1;
#endif
if (rotation[player]==1)
{
rotation[player] = 0;
#ifdef MOUSE
if (mouseplayer == -1 && !nomouse) mouseplayer = player;
#ifdef JOYSTICK
else goto maybejoystick;
/* mouse couldn't be chosen, but let's offer joystick if available*/
#endif
}
else if (player == mouseplayer)
{
mouseplayer = -1;
#endif
#ifdef JOYSTICK
maybejoystick:;
if((joystickplayer[0] == -1)&&(joystickdevice[0]>=0))
{
joystickplayer[0]=player;
joystickmul[0]=JOYMUL1;
}
else if((joystickplayer[1] == -1)&&(joystickdevice[1]>=0))
{
joystickplayer[1]=player;
joystickmul[1]=JOYMUL1;
}
}
else if(player==joystickplayer[0])
{
if(joystickmul[0]==JOYMUL1)joystickmul[0]=JOYMUL2;
else
{
joystickplayer[0]=-1;
if((joystickplayer[1] == -1)&&(joystickdevice[1]>=0))
{
joystickplayer[1]=player;
joystickmul[1]=JOYMUL1;
}
}
}
else if(player==joystickplayer[1])
{
if(joystickmul[1]==JOYMUL1)joystickmul[1]=JOYMUL2;
else joystickplayer[1]=-1;
#endif
}
else if (rotation[player]==0)
{
rotation[player] = 1;
}
change_menu ();
}
void
start ()
{
int i;
#ifdef JOYSTICK
if (joystickplayer[0] >= 0 && !calibrated[0])
{
joystick = 0;
joypos = 0;
gamemode = JOY;
calibrate_init ();
return;
}
if (joystickplayer[1] >= 1 && !calibrated[1])
{
joystick = 1;
joypos = 0;
gamemode = JOY;
calibrate_init ();
return;
}
#endif
for (i = 0; i < nrockets; i++)
{
object[i].score = 0;
#ifdef JOYSTICK
if(joystickplayer[0]==i)
{
object[i].joymulx = joystickmul[0]/center[0][0];
object[i].joymuly = joystickmul[0]/center[0][1];
object[i].joythresh = joystickthresh[0];
}
else if(joystickplayer[1]==i)
{
object[i].joymulx = joystickmul[1]/center[1][0];
object[i].joymuly = joystickmul[1]/center[1][1];
object[i].joythresh = joystickthresh[1];
}
#endif
}
sound = ssound;
gamemode = GAME;
in_actual_game = 1;
gameplan_init ();
init_objects ();
}
//DKS - limited to two players on handhelds
//static void
//playerchange ()
//{
///* nrockets++;
// if (nrockets > 5)
// nrockets = 1; */
// playertext[1] = nrockets + '0';
//}
static void
playerchange ()
{
// nrockets++;
if (nrockets > 2)
nrockets = 2;
else if (nrockets < 1)
nrockets = 1;
playertext[1] = nrockets + '0';
//DKS - next line fixed a bug when one player is playing in deathmatch mode
if (nrockets == 1)
gameplan = COOPERATIVE;
}
static void
levelchange ()
{
sprintf (leveltext, "LEVEL %03i ", lastlevel + 1);
}
static void
quit ()
{
#ifdef NETSUPPORT
if (client)
CQuit ("Selected quit in main menu");
#endif
//DKS - added saving here:
save_rc();
uninitialize ();
exit (0);
}
static void
fit_selector ()
{
mtime = MENUTIME;
mx1p = (XPOSITION (selected) - 2 - mx1) / mtime;
mx2p = (XPOSITION1 (selected) + 1 - mx2) / mtime;
my1p = (YPOSITION (selected) - 2 - my1) / mtime;
my2p = (YPOSITION (selected) + 8 + 0 - my2) / mtime;
}
static void
to_main_menu ()
{
save_rc ();
main_menu ();
}
static void
change_menu ()
{
static char s[2][5][40], *s1;
int i;
#ifdef NETSUPPORT
if (client)
{
menu[0].text = "START GAME";
menu[0].func = start_game;
}
else
#endif
{
menu[0].text = "BACK TO MAIN MENU";
menu[0].func = to_main_menu;
}
nnumbers = 0;
for (i = 0; i < nrockets; i++)
{
#ifdef NETSUPPORT
if (control[i] == 0 && client)
s1 = "REMOTE";
else
#endif
#ifdef MOUSE
if (i == mouseplayer)
s1 = "MOUSE";
else
#endif
#ifdef JOYSTICK
if (i == joystickplayer[0])
{
if(joystickmul[0]==JOYMUL1)s1 = "JOYSTICK A button";
else s1 = "JOYSTICK A deflection";
}
else if (i == joystickplayer[1])
{
if(joystickmul[1]==JOYMUL1)s1 = "JOYSTICK B button";
else s1 = "JOYSTICK B deflection";
}
else
#endif
if (rotation[i])
s1 = "ROTATION KEYBOARD";
else
s1 = "KEYBOARD";
sprintf (s[0][i], "PLAYER %i:%s", i + 1, s1);
#ifdef NETSUPPORT
if (control[i] == 0 && client)
sprintf (s[1][i], " ");
else
#endif
#ifdef JOYSTICK
if (i == joystickplayer[0])
sprintf (s[1][i], "CALIBRATE");
else if (i == joystickplayer[1])
sprintf (s[1][i], "CALIBRATE");
else
#endif
#ifdef MOUSE
if (i == mouseplayer)
sprintf (s[1][i], " ");
else
#endif
sprintf (s[1][i], "CHANGE KEYS");
menu[i * 2 + 1].text = s[0][i];
menu[i * 2 + 2].text = s[1][i];
menu[i * 2 + 1].func = control_change;
menu[i * 2 + 2].func = player_change;
}
nmenu = nrockets * 2 + 1;
if (selected >= nmenu)
selected = 0;
fit_selector ();
}
static void
deathmatch ()
{
gameplan = DEATHMATCH;
main_menu ();
}
static void
cooperative ()
{
gameplan = COOPERATIVE;
main_menu ();
}
static void
setsound ()
{
#ifdef SOUND
//DKS disabled
// if (sndinit)
// ssound = !ssound;
#endif
main_menu ();
}
void
setanalog ()
{
analog_enabled ^= 1;
to_main_menu();
}
void
setgsensor ()
{
gsensor_enabled ^= 1;
to_main_menu();
}
static void
setmusic ()
{
toggle_music();
to_main_menu();
}
static void
veryhard ()
{
difficulty = 0;
main_menu ();
}
static void
hard ()
{
difficulty = 1;
main_menu ();
}
static void
medium ()
{
difficulty = 2;
main_menu ();
}
static void
easy ()
{
difficulty = 3;
main_menu ();
}
static void
veryeasy ()
{
difficulty = 4;
main_menu ();
}
static void
change_mode ()
{
//DKS
if (nrockets == 1) {
gamemode = COOPERATIVE;
return;
}
nnumbers = 0;
//DKS
// menu[0].text = "DEATH MATCH(DOOM)";
menu[0].text = "DEATH MATCH";
menu[0].func = deathmatch;
menu[1].text = "COOPERATIVE";
menu[1].func = cooperative;
nmenu = 2;
//DKS
// selected = 1;
selected = (gameplan==COOPERATIVE) ? 1 : 0;
fit_selector ();
}
static void
change_obtiznost ()
{
menu[0].text = "NIGHTMARE";
menu[0].func = veryhard;
menu[1].text = "HARD";
menu[1].func = hard;
menu[2].text = "MEDIUM";
menu[2].func = medium;
menu[3].text = "EASY";
menu[3].func = easy;
menu[4].text = "VERY EASY";
menu[4].func = veryeasy;
nnumbers = 0;
nmenu = 5;
//DKS - why does it it not select the current difficulty!?
// selected = 2;
selected = difficulty;
fit_selector ();
}
#ifdef GCW
static void
nmain_menu ()
{
nnumbers = 2;
//DKS simplified the menu:
nmenu = 9;
menu[0].text = "START GAME";
menu[0].func = start;
menu[1].text = playertext;
menu[1].func = playerchange;
minim[0].x = XPOSITION (1);
minim[0].y = YPOSITION (1);
minim[0].line = 1;
minim[0].number = &nrockets;
//DKS
// minim[0].max = 5;
minim[0].max = 2;
minim[0].min = 1;
minim[0].func = playerchange;
maxim[0].x = XPOSITION (1) + 8 * 2;
maxim[0].y = YPOSITION (1);
maxim[0].line = 1;
maxim[0].number = &nrockets;
// maxim[0].max = 5;
maxim[0].max = 2;
maxim[0].min = 1;
maxim[0].func = playerchange;
playerchange ();
levelchange ();
menu[2].text = leveltext;
// menu[2].func = playerchange;
menu[2].func = levelchange;
minim[1].x = XPOSITION (2) + 7 * 7;
minim[1].y = YPOSITION (2);
minim[1].line = 2;
minim[1].number = &lastlevel;
minim[1].max = maxlevel;
minim[1].min = 0;
minim[1].func = levelchange;
maxim[1].x = XPOSITION (2) + 11 * 7;
maxim[1].y = YPOSITION (2);
maxim[1].line = 2;
maxim[1].number = &lastlevel;
maxim[1].max = maxlevel;
maxim[1].min = 0;
maxim[1].func = levelchange;
nnumbers = 2;
menu[3].text = "DIFFICULTY";
menu[3].func = change_obtiznost;
// menu[4].text = "GAME MODE";
menu[4].text = "MULTI-PLAYER GAME MODE";
menu[4].func = change_mode;
//DKS - awful hack to allow displaying of grayed-out text for this option
#define MENU_LINE_FOR_MULTIPLAYER_GAME_MODE 4
menu[5].text = music_enabled ? "MUSIC: ENABLED" : "MUSIC: DISABLED";
menu[5].func = setmusic;
menu[6].text = analog_enabled ? "ANALOG STICK: ENABLED" : "ANALOG STICK: DISABLED";
menu[6].func = setanalog;
menu[7].text = gsensor_enabled ? "G-SENSOR: ENABLED" : "G-SENSOR: DISABLED";
menu[7].func = setgsensor;
menu[8].text = "QUIT";
menu[8].func = quit;
selected = 0;
fit_selector ();
}
#else // non-GCW platform, i.e. this below is made for Dingoo A320 for now:
static void
nmain_menu ()
{
nnumbers = 2;
//DKS simplified the menu:
nmenu = 7;
menu[0].text = "START GAME";
menu[0].func = start;
menu[1].text = playertext;
menu[1].func = playerchange;
minim[0].x = XPOSITION (1);
minim[0].y = YPOSITION (1);
minim[0].line = 1;
minim[0].number = &nrockets;
//DKS
// minim[0].max = 5;
minim[0].max = 2;
minim[0].min = 1;
minim[0].func = playerchange;
maxim[0].x = XPOSITION (1) + 8 * 2;
maxim[0].y = YPOSITION (1);
maxim[0].line = 1;
maxim[0].number = &nrockets;
// maxim[0].max = 5;
maxim[0].max = 2;
maxim[0].min = 1;
maxim[0].func = playerchange;
playerchange ();
levelchange ();
menu[2].text = leveltext;
// menu[2].func = playerchange;
menu[2].func = levelchange;
minim[1].x = XPOSITION (2) + 7 * 7;
minim[1].y = YPOSITION (2);
minim[1].line = 2;
minim[1].number = &lastlevel;
minim[1].max = maxlevel;
minim[1].min = 0;
minim[1].func = levelchange;
maxim[1].x = XPOSITION (2) + 11 * 7;
maxim[1].y = YPOSITION (2);
maxim[1].line = 2;
maxim[1].number = &lastlevel;
maxim[1].max = maxlevel;
maxim[1].min = 0;
maxim[1].func = levelchange;
nnumbers = 2;
menu[3].text = "DIFFICULTY";
menu[3].func = change_obtiznost;
// menu[4].text = "GAME MODE";
menu[4].text = "MULTI-PLAYER GAME MODE";
menu[4].func = change_mode;
menu[5].text = music_enabled ? "MUSIC: ENABLED" : "MUSIC: DISABLED";
menu[5].func = setmusic;
menu[6].text = "QUIT";
menu[6].func = quit;
selected = 0;
fit_selector ();
}
#endif
/***************************************************************************/
#ifdef NETSUPPORT
extern void register_players ();
extern void start_game ();
int nplayers = 1, maxnplayers = 5;
static void
nplayerchange ()
{
playertext[1] = nplayers + '0';
}
void
setnplayers (int n)
{
nrockets = n;
maxnplayers = MAXROCKETS - nrockets;
if (minim[0].number == &nplayers)
{
minim[0].max = maxnplayers;
if (nplayers > maxnplayers)
nplayers = maxnplayers;
}
nplayerchange ();
}
void
cmenu2 (unsigned char *message, int size)
{
printf ("entering change menu");
change_menu ();
gamemode = MENU;
}
static void
cmain_menu ()
{
nnumbers = 1;
nmenu = 4;
menu[0].text = "REGISTER PLAYERS";
menu[0].func = register_players;
menu[1].text = playertext;
menu[1].func = nplayerchange;
minim[0].x = XPOSITION (1);
minim[0].y = YPOSITION (1);
minim[0].line = 1;
minim[0].number = &nplayers;
minim[0].max = maxnplayers;
minim[0].min = 1;
minim[0].func = nplayerchange;
maxim[0].x = XPOSITION (1) + 8 * 2;
maxim[0].y = YPOSITION (1);
maxim[0].line = 1;
maxim[0].number = &nplayers;
maxim[0].max = maxnplayers;
maxim[0].min = 1;
maxim[0].func = nplayerchange;
nplayerchange ();
#ifdef SOUND
//DKS
//menu[2].text = ssound ? "SOUND ON" : (sndinit ? "SOUND OFF" : "SOUND OFF-NOT INITIALIZED");
menu[2].text = ssound ? "SOUND AVAILABLE" : (sndinit ? "SOUND OFF" : "SOUND OFF-NOT INITIALIZED");
#else
menu[2].text = "SOUND OFF(NOT AVAIABLE)";
#endif
menu[2].func = setsound;
menu[3].text = "QUIT";
menu[3].func = quit;
selected = 0;
fit_selector ();
}
#endif
/***************************************************************************/
static void
main_menu ()
{
//DKS - added to determine if we are actually playing a game or in the menu
in_actual_game = 0;
#ifdef NETSUPPORT
if (client)
cmain_menu ();
else
#endif
nmain_menu ();
}
void
init_menu ()
{
mx1 = 10;
mx2 = MAPWIDTH - 10;
my2 = 10;
my2 = MAPHEIGHT - 10;
ssound = sound;
playertext[1] = nrockets + '0';
//DKS - fixing bug starting 1-player game in deathmatch mode
if (nrockets == 1) gamemode = COOPERATIVE;
main_menu ();
}
//DKS - modified & replaced
//void
//draw_menu (CONST int draw)
//{
// int i;
// sound = 0;
// if (draw)
// {
// levelchange ();
// DrawRectangle ((int) mx1, (int) my1, (int) mx2, (int) my2, ball (2));
// DrawRectangle ((int) mx1 + 1, (int) my1 + 1, (int) mx2 + 1, (int) my2 + 1, ball (20));
// DrawBlackMaskedText (MAPWIDTH / 2 - 8 * 4 + 1, 1, "THE GAME");
// DrawBlackMaskedText (MAPWIDTH / 2 - 10 * 4 + 1, 11, "K O U L E S");
// DrawBlackMaskedText (MAPWIDTH / 2 - 2 * 4 + 1, 21, "BY");
// DrawBlackMaskedText (MAPWIDTH / 2 - 8 * 4 + 1, 31, "JAHUSOFT");
// DrawBlackMaskedText (MAPWIDTH / 2 - 30 * 4 + 1, 46, "PRESS P FOR PAUSE / H FOR HELP");
//#ifdef __OS2__
// DrawBlackMaskedText (MAPWIDTH / 2 - 28 * 4, 40, "OS/2 Warp VERSION BY T.A.K.K");
//#endif
// DrawWhiteMaskedText (MAPWIDTH / 2 - 8 * 4, 0, "THE GAME");
// DrawWhiteMaskedText (MAPWIDTH / 2 - 10 * 4, 10, "K O U L E S");
// DrawWhiteMaskedText (MAPWIDTH / 2 - 2 * 4, 20, "BY");
// DrawWhiteMaskedText (MAPWIDTH / 2 - 8 * 4, 30, "JAHUSOFT");
// DrawWhiteMaskedText (MAPWIDTH / 2 - 30 * 4, 45, "PRESS P FOR PAUSE / H FOR HELP");
//#ifdef __OS2__
// DrawWhiteMaskedText (MAPWIDTH / 2 - 28 * 4, 40, "OS/2 Warp VERSION BY T.A.K.K");
//#endif
// for (i = 0; i < nnumbers; i++)
// {
// Line (minim[i].x, minim[i].y + 3, minim[i].x + 6, minim[i].y + 3, ball (2));
// Line (minim[i].x + 3, minim[i].y + 0, minim[i].x, minim[i].y + 3, ball (2));
// Line (minim[i].x + 4, minim[i].y + 0, minim[i].x + 1, minim[i].y + 3, ball (2));
// Line (minim[i].x + 3, minim[i].y + 6, minim[i].x, minim[i].y + 3, ball (2));
// Line (minim[i].x + 4, minim[i].y + 6, minim[i].x + 1, minim[i].y + 3, ball (2));
// Line (maxim[i].x + 2, maxim[i].y + 3, maxim[i].x + 8, maxim[i].y + 3, ball (2));
// Line (maxim[i].x + 5, maxim[i].y + 0, maxim[i].x + 8, maxim[i].y + 3, ball (2));
// Line (maxim[i].x + 4, maxim[i].y + 0, maxim[i].x + 7, maxim[i].y + 3, ball (2));
// Line (maxim[i].x + 5, maxim[i].y + 6, maxim[i].x + 8, maxim[i].y + 3, ball (2));
// Line (maxim[i].x + 4, maxim[i].y + 6, maxim[i].x + 7, maxim[i].y + 3, ball (2));
// }
// for (i = 0; i < nmenu; i++)
// {
// DrawBlackMaskedText ((int) XPOSITION (i) + 1, (int) YPOSITION (i) + 1, menu[i].text);
// DrawWhiteMaskedText ((int) XPOSITION (i), (int) YPOSITION (i), menu[i].text);
// }
// }
// if (mtime)
// {
// mtime--;
// my1 += my1p;
// mx1 += mx1p;
// my2 += my2p;
// mx2 += mx2p;
// }
//}
void
draw_menu (CONST int draw)
{
in_actual_game = 0; // DKS - added to determine whether we're in the actual game or in the menu
int i;
//DKS Sound on by default
//sound = 0;
sound = 1;
if (draw)
{
levelchange ();
DrawRectangle (physicalscreen, (int) mx1, (int) my1, (int) mx2, (int) my2, ball (2));
DrawRectangle (physicalscreen, (int) mx1 + 1, (int) my1 + 1, (int) mx2 + 1, (int) my2 + 1, ball (20));
DrawBlackMaskedText (physicalscreen, MAPWIDTH / 2 - 8 * 4 + 1, 1, "THE GAME");
DrawBlackMaskedText (physicalscreen, MAPWIDTH / 2 - 10 * 4 + 1, 11, "K O U L E S");
// DrawBlackMaskedText (physicalscreen, MAPWIDTH / 2 - 11 * 4 + 1, 21, "BY JAHUSOFT");
DrawBlackMaskedText (physicalscreen, MAPWIDTH / 2 - 14 * 4 + 1, 21, "By Jan Hubicka");
#ifdef GP2X
DrawBlackMaskedText (physicalscreen, MAPWIDTH / 2 - 27 * 4 + 1, 41, "GP2X VERSION BY SENOR QUACK");
#elif DINGOO
DrawBlackMaskedText (physicalscreen, MAPWIDTH / 2 - 27 * 4 + 1, 41, "DINGOO VERSION BY SENOR QUACK");
#elif GCW
DrawBlackMaskedText (physicalscreen, MAPWIDTH / 2 - 35 * 4 + 1, 41, "SDL conversion & GCW port: senquack");
#endif
//DKS - disabled help, it's pretty useless
// DrawBlackMaskedText (physicalscreen, MAPWIDTH / 2 - 33 * 4 + 1, 46, "PRESS L FOR HELP / START TO PAUSE");
// DrawBlackMaskedText (physicalscreen, MAPWIDTH / 2 - 20 * 4 + 1, 46, "PRESS START TO PAUSE");
DrawBlackMaskedText (physicalscreen, MAPWIDTH / 2 - 27 * 4 + 1, 51, "Music: DST @ nosoapradio.us");
DrawBlackMaskedText (physicalscreen, MAPWIDTH / 2 - 30 * 4 + 1, 61, "(Creative Commons 3.0 License)");
DrawWhiteMaskedText (physicalscreen, MAPWIDTH / 2 - 8 * 4, 0, "THE GAME");
DrawWhiteMaskedText (physicalscreen, MAPWIDTH / 2 - 10 * 4, 10, "K O U L E S");
// DrawWhiteMaskedText (physicalscreen, MAPWIDTH / 2 - 11 * 4, 20, "BY JAHUSOFT");
DrawWhiteMaskedText (physicalscreen, MAPWIDTH / 2 - 14 * 4, 20, "By Jan Hubicka");
#ifdef GP2X
DrawWhiteMaskedText (physicalscreen, MAPWIDTH / 2 - 28 * 4, 40, "GP2X VERSION BY SENOR QUACK");
#elif DINGOO
DrawWhiteMaskedText (physicalscreen, MAPWIDTH / 2 - 30 * 4, 40, "DINGOO VERSION BY SENOR QUACK");
#elif GCW
DrawWhiteMaskedText (physicalscreen, MAPWIDTH / 2 - 35 * 4, 40, "SDL conversion & GCW port: senquack");
#endif
// DrawWhiteMaskedText (physicalscreen, MAPWIDTH / 2 - 33 * 4, 45, "PRESS L FOR HELP / START TO PAUSE");
// DrawWhiteMaskedText (physicalscreen, MAPWIDTH / 2 - 20 * 4, 46, "PRESS START TO PAUSE");
DrawWhiteMaskedText (physicalscreen, MAPWIDTH / 2 - 27 * 4, 50, "Music: DST @ nosoapradio.us");
DrawWhiteMaskedText (physicalscreen, MAPWIDTH / 2 - 30 * 4, 60, "(Creative Commons 3.0 License)");
if (gsensor_enabled) {
DrawBlackMaskedText (physicalscreen, MAPWIDTH / 2 - 31 * 4 + 1, 210 + 1, "PRESS L+R TO RE-CENTER G-SENSOR");
DrawWhiteMaskedText (physicalscreen, MAPWIDTH / 2 - 31 * 4, 210, "PRESS L+R TO RE-CENTER G-SENSOR");
}
for (i = 0; i < nnumbers; i++)
{
Line (physicalscreen, minim[i].x, minim[i].y + 3, minim[i].x + 6, minim[i].y + 3, ball (2));
Line (physicalscreen, minim[i].x + 3, minim[i].y + 0, minim[i].x, minim[i].y + 3, ball (2));
Line (physicalscreen, minim[i].x + 4, minim[i].y + 0, minim[i].x + 1, minim[i].y + 3, ball (2));
Line (physicalscreen, minim[i].x + 3, minim[i].y + 6, minim[i].x, minim[i].y + 3, ball (2));
Line (physicalscreen, minim[i].x + 4, minim[i].y + 6, minim[i].x + 1, minim[i].y + 3, ball (2));
Line (physicalscreen, maxim[i].x + 2, maxim[i].y + 3, maxim[i].x + 8, maxim[i].y + 3, ball (2));
Line (physicalscreen, maxim[i].x + 5, maxim[i].y + 0, maxim[i].x + 8, maxim[i].y + 3, ball (2));
Line (physicalscreen, maxim[i].x + 4, maxim[i].y + 0, maxim[i].x + 7, maxim[i].y + 3, ball (2));
Line (physicalscreen, maxim[i].x + 5, maxim[i].y + 6, maxim[i].x + 8, maxim[i].y + 3, ball (2));
Line (physicalscreen, maxim[i].x + 4, maxim[i].y + 6, maxim[i].x + 7, maxim[i].y + 3, ball (2));
}
for (i = 0; i < nmenu; i++)
{
DrawBlackMaskedText (physicalscreen, (int) XPOSITION (i) + 1, (int) YPOSITION (i) + 1, menu[i].text);
// DKS - awful hack to allow some grayed-out menu options
#ifdef GCW
if (i == MENU_LINE_FOR_MULTIPLAYER_GAME_MODE && nrockets == 1) {
DrawGrayMaskedText (physicalscreen, (int) XPOSITION (i), (int) YPOSITION (i), menu[i].text);
} else {
DrawWhiteMaskedText (physicalscreen, (int) XPOSITION (i), (int) YPOSITION (i), menu[i].text);
}
#else
DrawWhiteMaskedText (physicalscreen, (int) XPOSITION (i), (int) YPOSITION (i), menu[i].text);
#endif
}
#ifdef GP2X
//ADDED TO SHOW CURRENT VOLUME
if (sound) {
if ((int) cur_volume == 128) {
sprintf(volstr, "VOLUME: %d (MAX)", (int) (cur_volume) );
} else {
sprintf(volstr, "VOLUME: %d", (int) (cur_volume) );
}
DrawBlackMaskedText(physicalscreen, 1 + 1, MAPHEIGHT - 10 + 1, volstr);
DrawWhiteMaskedText(physicalscreen, 1, MAPHEIGHT - 10, volstr);
}
#endif
}
if (mtime)
{
mtime--;
my1 += my1p;
mx1 += mx1p;
my2 += my2p;
mx2 += mx2p;
}
}
static int inctime, changed, waittime;
static void
increase (int i)
{
changed = 1;
if (waittime)
{
waittime--;
return;
}
waittime = inctime;
if (inctime > 1)
inctime--;
else
(*maxim[i].number) += 2;
(*maxim[i].number)++;
if (*maxim[i].number > maxim[i].max)
*maxim[i].number = maxim[i].max;
#ifdef SOUND
if (ssound && inctime != 1)
play_sound (S_CREATOR2);
#endif
maxim[i].func ();
//DKS disabled saving here
//save_rc ();
}
static void
decrease (int i)
{
changed = 1;
if (waittime)
{
waittime--;
return;
}
waittime = inctime;
if (inctime > 1)
inctime--;
else
(*maxim[i].number) -= 2;
(*minim[i].number)--;
if (*minim[i].number < minim[i].min)
*minim[i].number = minim[i].min;
#ifdef SOUND
if (ssound && inctime != 1)
play_sound (S_CREATOR2);
#endif
minim[i].func ();
//DKS disabled saving here
//save_rc ();
}
void
menu_keys ()
{
static int enter;
int ent = 0;
static int esc;
#ifdef MOUSE
static int button;
int but = 0;
#endif
if (maxim[1].max != maxlevel && !client)