-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathm_menu.c
1284 lines (1047 loc) · 26.2 KB
/
m_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
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
* Copyright 2023, 2024 by
* Frenkel Smeijers
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* DOOM selection menu, options etc. (aka Big Font menus)
* Sliders and icons. Kinda widget stuff.
* Setup Menus.
* Extended HELP screens.
* Dynamic HELP screen.
*
*-----------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdint.h>
#include "compiler.h"
#include "doomdef.h"
#include "d_player.h"
#include "d_englsh.h"
#include "d_main.h"
#include "v_video.h"
#include "w_wad.h"
#include "r_main.h"
#include "hu_stuff.h"
#include "g_game.h"
#include "s_sound.h"
#include "sounds.h"
#include "m_menu.h"
#include "doomtype.h"
#include "am_map.h"
#include "i_system.h"
#include "i_sound.h"
#include "globdata.h"
#define DISABLE_SAVE_GAME
#define DISABLE_SOUND_OPTIONS
//
// MENU TYPEDEFS
//
typedef struct
{
int16_t status; // 0 = no cursor here, 1 = ok, 2 = arrows ok
char name[10];
// choice = menu item #.
// if status = 2,
// choice=0:leftarrow,1:rightarrow
void (*routine)(int16_t choice);
} menuitem_t;
typedef struct menu_s
{
int16_t numitems; // # of menu items
const menuitem_t* menuitems; // menu items
void (*routine)(); // draw routine
int16_t x;
int16_t y; // x,y of menu
const struct menu_s* prevMenu; // previous menu
int16_t previtemOn;
} menu_t;
//
// defaulted values
//
int16_t _g_alwaysRun;
uint16_t _g_gamma;
static boolean messageToPrint; // true = message to be printed
static const char* messageString; // ...and here is the message string!
static boolean messageLastMenuActive;
static const menu_t* currentMenu; // current menudef
static int16_t itemOn; // menu item skull is on (for Big Font menus)
static int16_t skullAnimCounter; // skull animation counter
static int16_t whichSkull; // which skull to draw (he blinks)
boolean _g_menuactive; // The menus are up
static boolean messageNeedsInput; // timed message = no input from user
char _g_savegamestrings[8][8];
int16_t showMessages = 1;
static void (*messageRoutine)(boolean affirmative);
// we are going to be entering a savegame string
#define SKULLXOFF -32
#define LINEHEIGHT 16
// graphic name of skulls
static const char skullName[2][9] = {"M_SKULL1","M_SKULL2"};
// end of externs added for setup menus
//
// PROTOTYPES
//
static void M_NewGame(int16_t choice);
static void M_ChooseSkill(int16_t choice);
static void M_LoadGame(int16_t choice);
static void M_SaveGame(int16_t choice);
static void M_Options(int16_t choice);
static void M_EndGame(int16_t choice);
static void M_QuitDOOM(int16_t choice);
static void M_ChangeMessages(int16_t choice);
static void M_ChangeAlwaysRun(int16_t choice);
static void M_ChangeGamma(int16_t choice);
static void M_SfxVol(int16_t choice);
static void M_MusicVol(int16_t choice);
static void M_Sound(int16_t choice);
static void M_LoadSelect(int16_t choice);
static void M_SaveSelect(int16_t choice);
static void M_ReadSaveStrings(void);
static void M_DrawMainMenu(void);
static void M_DrawNewGame(void);
static void M_DrawOptions(void);
static void M_DrawSound(void);
static void M_DrawLoad(void);
static void M_DrawSave(void);
static void M_SetupNextMenu(const menu_t *menudef);
static void M_DrawThermo(int16_t x, int16_t y, int16_t thermWidth, int16_t thermDot);
static void M_WriteText(int16_t x, int16_t y, const char __far* string);
static int16_t M_StringWidth(const char __far* string);
static int16_t M_StringHeight(const char *string);
static void M_StartMessage(const char *string,void (*routine)(boolean));
static void M_ClearMenus (void);
// end of prototypes added to support Setup Menus and Extended HELP screens
/////////////////////////////////////////////////////////////////////////////
//
// DOOM MENUS
//
/////////////////////////////
//
// MAIN MENU
//
// main_e provides numerical values for which Big Font screen you're on
enum
{
newgame = 0,
options,
#if !defined DISABLE_SAVE_GAME
loadgame,
savegame,
#endif
quitdoom,
main_end
};
//
// MainMenu is the definition of what the main menu Screen should look
// like. Each entry shows that the cursor can land on each item (1), the
// built-in graphic lump (i.e. "M_NGAME") that should be displayed,
// and the program which takes over when an item is selected.
//
static const menuitem_t MainMenu[]=
{
{1,"M_NGAME", M_NewGame},
{1,"M_OPTION",M_Options},
#if !defined DISABLE_SAVE_GAME
{1,"M_LOADG", M_LoadGame},
{1,"M_SAVEG", M_SaveGame},
#endif
{1,"M_QUITG", M_QuitDOOM}
};
static const menu_t MainDef =
{
main_end, // number of menu items
MainMenu, // table that defines menu items
M_DrawMainMenu, // drawing routine
97,64, // initial cursor position
NULL,0,
};
//
// M_DrawMainMenu
//
static void M_DrawMainMenu(void)
{
// CPhipps - patch drawing updated
V_DrawNamePatchScaled(94, 2, "M_DOOM");
}
// numerical values for the New Game menu items
enum
{
killthings,
toorough,
hurtme,
violence,
nightmare,
newg_end
};
// The definitions of the New Game menu
static const menuitem_t NewGameMenu[]=
{
{1,"M_JKILL", M_ChooseSkill},
{1,"M_ROUGH", M_ChooseSkill},
{1,"M_HURT", M_ChooseSkill},
{1,"M_ULTRA", M_ChooseSkill},
{1,"M_NMARE", M_ChooseSkill}
};
static const menu_t NewDef =
{
newg_end, // # of menu items
NewGameMenu, // menuitem_t ->
M_DrawNewGame, // drawing routine ->
48,63, // x,y
&MainDef,0,
};
//
// M_NewGame
//
static void M_DrawNewGame(void)
{
// CPhipps - patch drawing updated
V_DrawNamePatchScaled(96, 14, "M_NEWG");
V_DrawNamePatchScaled(54, 38, "M_SKILL");
}
static void M_NewGame(int16_t choice)
{
UNUSED(choice);
M_SetupNextMenu(&NewDef);
itemOn = 2; //Set hurt me plenty as default difficulty
}
static void M_VerifyNightmare(boolean affirmative)
{
if (affirmative)
G_DeferedInitNew(nightmare);
}
static void M_ChooseSkill(int16_t choice)
{
if (choice == nightmare)
{
M_StartMessage(NIGHTMARE, M_VerifyNightmare);
itemOn = 0;
}
else
{
G_DeferedInitNew(choice);
M_ClearMenus ();
}
}
/////////////////////////////
//
// LOAD GAME MENU
//
// numerical values for the Load Game slots
enum
{
load1,
load2,
load3,
load4,
load5,
load6,
load7,
load8,
load_end
};
// The definitions of the Load Game screen
static const menuitem_t LoadMenue[]=
{
{1,"", M_LoadSelect},
{1,"", M_LoadSelect},
{1,"", M_LoadSelect},
{1,"", M_LoadSelect},
{1,"", M_LoadSelect},
{1,"", M_LoadSelect},
{1,"", M_LoadSelect},
{1,"", M_LoadSelect},
};
static const menu_t LoadDef =
{
load_end,
LoadMenue,
M_DrawLoad,
64,34, //jff 3/15/98 move menu up
&MainDef,2,
};
#define LOADGRAPHIC_Y 8
//
// M_LoadGame & Cie.
//
static void M_DrawSaveLoad(const char* name)
{
int8_t i, j;
V_DrawNamePatchScaled(72 ,LOADGRAPHIC_Y, name);
const patch_t __far* lpatch = W_GetLumpByName("M_LSLEFT");
const patch_t __far* mpatch = W_GetLumpByName("M_LSCNTR");
const patch_t __far* rpatch = W_GetLumpByName("M_LSRGHT");
for (i = 0; i < load_end; i++)
{
//
// Draw border for the savegame description
//
int16_t x = LoadDef.x;
const int16_t y = 27 + 13 * i + 7;
V_DrawPatchNotScaled(x - 8, y, lpatch);
for (j = 0; j < 12; j++)
{
V_DrawPatchNotScaled(x, y, mpatch);
x += 8;
}
V_DrawPatchNotScaled(x, y, rpatch);
M_WriteText(LoadDef.x, y - 7, _g_savegamestrings[i]);
}
Z_ChangeTagToCache(lpatch);
Z_ChangeTagToCache(mpatch);
Z_ChangeTagToCache(rpatch);
}
static void M_DrawLoad(void)
{
M_DrawSaveLoad("M_LOADG");
}
//
// User wants to load this game
//
static void M_LoadSelect(int16_t choice)
{
// CPhipps - Modified so savegame filename is worked out only internal
// to g_game.c, this only passes the slot.
G_LoadGame(choice); // killough 3/16/98: add slot
M_ClearMenus ();
}
//
// Selected from DOOM menu
//
static void M_LoadGame (int16_t choice)
{
UNUSED(choice);
/* killough 5/26/98: exclude during demo recordings
* cph - unless a new demo */
M_SetupNextMenu(&LoadDef);
M_ReadSaveStrings();
}
/////////////////////////////
//
// SAVE GAME MENU
//
// The definitions of the Save Game screen
static const menuitem_t SaveMenu[]=
{
{1,"", M_SaveSelect},
{1,"", M_SaveSelect},
{1,"", M_SaveSelect},
{1,"", M_SaveSelect},
{1,"", M_SaveSelect},
{1,"", M_SaveSelect},
{1,"", M_SaveSelect}, //jff 3/15/98 extend number of slots
{1,"", M_SaveSelect},
};
static const menu_t SaveDef =
{
load_end, // same number of slots as the Load Game screen
SaveMenu,
M_DrawSave,
80,34, //jff 3/15/98 move menu up
&MainDef,3,
};
//
// M_ReadSaveStrings
// read the strings from the savegame files
//
static void M_ReadSaveStrings(void)
{
}
//
// M_SaveGame & Cie.
//
static void M_DrawSave(void)
{
M_DrawSaveLoad("M_SAVEG");
}
//
// M_Responder calls this when user is finished
//
static void M_DoSave(int16_t slot)
{
G_SaveGame (slot);
M_ClearMenus ();
}
//
// User wants to save. Start string input for M_Responder
//
static void M_SaveSelect(int16_t choice)
{
M_DoSave(choice);
}
//
// Selected from DOOM menu
//
static void M_SaveGame (int16_t choice)
{
UNUSED(choice);
// killough 10/6/98: allow savegames during single-player demo playback
if (!_g_usergame && (!_g_demoplayback))
{
M_StartMessage(SAVEDEAD, NULL);
return;
}
if (_g_gamestate != GS_LEVEL)
return;
M_SetupNextMenu(&SaveDef);
M_ReadSaveStrings();
}
/////////////////////////////
//
// QUIT DOOM
//
static void M_QuitResponse(boolean affirmative)
{
if (affirmative)
I_Quit();
}
static void M_QuitDOOM(int16_t choice)
{
UNUSED(choice);
M_StartMessage(QUITMSG, M_QuitResponse);
}
/////////////////////////////
//
// OPTIONS MENU
//
// numerical values for the Options menu items
enum
{ // phares 3/21/98
endgame,
messages,
alwaysrun,
gamma,
#if !defined DISABLE_SOUND_OPTIONS
soundvol,
#endif
opt_end
};
// The definitions of the Options menu
static const menuitem_t OptionsMenu[]=
{
// killough 4/6/98: move setup to be a sub-menu of OPTIONs
{1,"M_ENDGAM", M_EndGame},
{1,"M_MESSG", M_ChangeMessages},
{1,"M_ARUN", M_ChangeAlwaysRun},
{2,"M_GAMMA", M_ChangeGamma},
#if !defined DISABLE_SOUND_OPTIONS
{1,"M_SVOL", M_Sound}
#endif
};
static const menu_t OptionsDef =
{
opt_end,
OptionsMenu,
M_DrawOptions,
60,37,
&MainDef,1,
};
//
// M_Options
//
static const char msgNames[2][9] = {"M_MSGOFF","M_MSGON"};
static void M_DrawOptions(void)
{
// CPhipps - patch drawing updated
// proff/nicolas 09/20/98 -- changed for hi-res
V_DrawNamePatchScaled(108, 15, "M_OPTTTL");
V_DrawNamePatchScaled(OptionsDef.x + 120, OptionsDef.y+LINEHEIGHT*messages, msgNames[showMessages]);
V_DrawNamePatchScaled(OptionsDef.x + 146, OptionsDef.y+LINEHEIGHT*alwaysrun, msgNames[_g_alwaysRun]);
M_DrawThermo(OptionsDef.x + 158, OptionsDef.y+LINEHEIGHT*gamma+2,6,_g_gamma);
}
static void M_Options(int16_t choice)
{
UNUSED(choice);
M_SetupNextMenu(&OptionsDef);
}
/////////////////////////////
//
// SOUND VOLUME MENU
//
// numerical values for the Sound Volume menu items
// The 'empty' slots are where the sliding scales appear.
enum
{
sfx_vol,
sfx_empty1,
music_vol,
sfx_empty2,
sound_end
};
// The definitions of the Sound Volume menu
static const menuitem_t SoundMenu[]=
{
{2,"M_SFXVOL",M_SfxVol},
{-1,"",0},
{2,"M_MUSVOL",M_MusicVol},
{-1,"",0}
};
static const menu_t SoundDef =
{
sound_end,
SoundMenu,
M_DrawSound,
80,64,
&OptionsDef,4,
};
//
// Change Sfx & Music volumes
//
static void M_DrawSound(void)
{
// CPhipps - patch drawing updated
V_DrawNamePatchScaled(60, 38, "M_SVOL");
M_DrawThermo(SoundDef.x, SoundDef.y + LINEHEIGHT * (sfx_vol + 1), 16, snd_SfxVolume);
M_DrawThermo(SoundDef.x, SoundDef.y + LINEHEIGHT * (music_vol + 1), 16, snd_MusicVolume);
}
static void M_Sound(int16_t choice)
{
UNUSED(choice);
M_SetupNextMenu(&SoundDef);
}
static void M_SfxVol(int16_t choice)
{
switch(choice)
{
case 0:
if (snd_SfxVolume)
snd_SfxVolume--;
break;
case 1:
if (snd_SfxVolume < 15)
snd_SfxVolume++;
break;
}
G_SaveSettings();
S_SetSfxVolume(snd_SfxVolume /* *8 */);
}
static void M_MusicVol(int16_t choice)
{
switch(choice)
{
case 0:
if (snd_MusicVolume)
snd_MusicVolume--;
break;
case 1:
if (snd_MusicVolume < 15)
snd_MusicVolume++;
break;
}
G_SaveSettings();
S_SetMusicVolume(snd_MusicVolume /* *8 */);
}
/////////////////////////////
//
// M_EndGame
//
static void M_EndGameResponse(boolean affirmative)
{
if (!affirmative)
return;
// killough 5/26/98: make endgame quit if recording or playing back demo
if (_g_singledemo)
G_CheckDemoStatus();
M_ClearMenus ();
D_StartTitle ();
}
static void M_EndGame(int16_t choice)
{
UNUSED(choice);
M_StartMessage(ENDGAME, M_EndGameResponse);
}
/////////////////////////////
//
// Toggle messages on/off
//
static void M_ChangeMessages(int16_t choice)
{
UNUSED(choice);
showMessages = 1 - showMessages;
_g_player.message = showMessages ? MSGON : MSGOFF;
_g_message_dontfuckwithme = true;
G_SaveSettings();
}
static void M_ChangeAlwaysRun(int16_t choice)
{
UNUSED(choice);
_g_alwaysRun = 1 - _g_alwaysRun;
if (!_g_alwaysRun)
_g_player.message = RUNOFF; // Ty 03/27/98 - externalized
else
_g_player.message = RUNON ; // Ty 03/27/98 - externalized
G_SaveSettings();
}
static void M_ChangeGamma(int16_t choice)
{
switch(choice)
{
case 0:
if (_g_gamma)
_g_gamma--;
break;
case 1:
if (_g_gamma < 5)
_g_gamma++;
break;
}
I_ReloadPalette();
I_SetPalette(0);
G_SaveSettings();
}
//
// End of Original Menus
//
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////
//
// General routines used by the Setup screens.
//
//
// M_InitDefaults()
//
// killough 11/98:
//
// This function converts all setup menu entries consisting of cfg
// variable names, into pointers to the corresponding default[]
// array entry. var.name becomes converted to var.def.
//
static void M_InitDefaults(void)
{
}
//
// End of Setup Screens.
//
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// M_Responder
//
// Examines incoming keystrokes and button pushes and determines some
// action based on the state of the system.
//
boolean M_Responder (event_t* ev)
{
// Process keyboard input
if (ev->type != ev_keydown)
return false; // we can't use the event here
int16_t ch;
switch (ev->data1)
{
case 'a':
case 'h':
ch = KEYD_LEFT;
break;
case 's':
case 'j':
ch = KEYD_DOWN;
break;
case 'd':
case 'k':
ch = KEYD_UP;
break;
case 'f':
case 'l':
ch = KEYD_RIGHT;
break;
default:
ch = ev->data1;
break;
}
// Take care of any messages that need input
if (messageToPrint)
{
if (messageNeedsInput == true &&
!(ch == 'n' || ch == 'y' || ch == key_escape))
return false;
_g_menuactive = messageLastMenuActive;
messageToPrint = false;
if (messageRoutine)
messageRoutine(ch == 'y');
_g_menuactive = false;
S_StartSound(NULL,sfx_swtchx);
return true;
}
// Pop-up Main menu?
if (!_g_menuactive)
{
if (ch == key_escape)
{
M_StartControlPanel ();
S_StartSound(NULL,sfx_swtchn);
return true;
}
return false;
}
// From here on, these navigation keys are used on the BIG FONT menus
// like the Main Menu.
if (ch == key_menu_down)
{
do
{
if (itemOn+1 > currentMenu->numitems-1)
itemOn = 0;
else
itemOn++;
S_StartSound(NULL,sfx_pstop);
}
while(currentMenu->menuitems[itemOn].status==-1);
return true;
}
if (ch == key_menu_up)
{
do
{
if (!itemOn)
itemOn = currentMenu->numitems-1;
else
itemOn--;
S_StartSound(NULL,sfx_pstop);
}
while(currentMenu->menuitems[itemOn].status==-1);
return true;
}
if (ch == key_menu_left)
{
if (currentMenu->menuitems[itemOn].routine &&
currentMenu->menuitems[itemOn].status == 2)
{
S_StartSound(NULL,sfx_stnmov);
currentMenu->menuitems[itemOn].routine(0);
}
return true;
}
if (ch == key_menu_right)
{
if (currentMenu->menuitems[itemOn].routine &&
currentMenu->menuitems[itemOn].status == 2)
{
S_StartSound(NULL,sfx_stnmov);
currentMenu->menuitems[itemOn].routine(1);
}
return true;
}
if (ch == key_menu_enter)
{
if (currentMenu->menuitems[itemOn].routine &&
currentMenu->menuitems[itemOn].status)
{
if (currentMenu->menuitems[itemOn].status == 2)
{
currentMenu->menuitems[itemOn].routine(1); // right arrow
S_StartSound(NULL,sfx_stnmov);
}
else
{
currentMenu->menuitems[itemOn].routine(itemOn);
S_StartSound(NULL,sfx_pistol);
}
}
return true;
}
if (ch == key_menu_escape)
{
M_ClearMenus ();
S_StartSound(NULL,sfx_swtchx);
return true;
}
//Allow being able to go back in menus
if (ch == key_fire)
{
//If the prevMenu == NULL (Such as main menu screen), then just get out of the menu altogether
if(currentMenu->prevMenu == NULL)
{
M_ClearMenus();
}else //Otherwise, change to the parent menu and match the row used to get there.
{
int16_t previtemOn = currentMenu->previtemOn; //Temporarily store this so after menu change, we store the last row it was on.
M_SetupNextMenu(currentMenu->prevMenu);
itemOn = previtemOn;
}
S_StartSound(NULL,sfx_swtchx);
return true;
}
return false;
}
//
// End of M_Responder
//
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// General Routines
//
// This displays the Main menu and gets the menu screens rolling.
// Plus a variety of routines that control the Big Font menu display.
// Plus some initialization for game-dependant situations.
void M_StartControlPanel (void)
{
// intro might call this repeatedly
if (_g_menuactive)
return;
//jff 3/24/98 make default skill menu choice follow -skill or defaultskill
//from command line or config file
//
// killough 10/98:
// Fix to make "always floating" with menu selections, and to always follow