-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path3D_MENU.C
3846 lines (3052 loc) · 81.1 KB
/
3D_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
#include "3d_def.h"
#include "jm_tp.h"
#include "jm_io.h"
#pragma hdrstop
// As is, this switch will not work ... the data associated with this
// is not saved out correctly.
//
//#define CACHE_KEY_DATA
//
// End game message
//
char far EndGameStr[] = {" End current game?\n"
" Are you sure (Y or N)?"
};
#define ENDGAMESTR (EndGameStr)
char far QuitToDosStr[] = {" Quit to DOS?\n"
" Are you sure (Y or N)?"
};
//#define FREEFONT(fontnum) {MM_SetPurge (&(memptr)grsegs[fontnum],3);}
#define FREEFONT(fontnum) {if (fontnum != STARTFONT+2 && grsegs[fontnum]) UNCACHEGRCHUNK(fontnum);}
boolean EscPressed = false;
int lastmenumusic;
//===========================================================================
//
// PRIVATE PROTOTYPES
//
//===========================================================================
void CP_ReadThis(void);
void CP_OrderingInfo(void);
void DrawEpisodePic(int w);
void DrawAllSoundLights(int which);
void ReadGameNames(void);
void FreeMusic(void);
void CP_GameOptions(void);
void DrawGopMenu(void);
void CalibrateJoystick(void);
void ExitGame(void);
void CP_Switches(void);
void DrawSwitchMenu(void);
void DrawAllSwitchLights(int which);
void DrawSwitchDescription(int which);
extern boolean refresh_screen;
//===========================================================================
//
// LOCAL DATA...
//
//===========================================================================
CP_iteminfo
far MainItems= {MENU_X,MENU_Y,12,MM_READ_THIS,0,9,{77, 1,154,9,1}},
far GopItems= {MENU_X,MENU_Y+30,4,0,0,9,{77, 1,154,9,1}},
far SndItems= {SM_X,SM_Y,12,0,0,7, {87,-1,144,7,1}},
far LSItems= {LSM_X,LSM_Y,10,0,0,8, {86,-1,144,8,1}},
far CtlItems= {CTL_X,CTL_Y,7,-1,0,9, {87,1,174,9,1}},
far CusItems= {CST_X,CST_Y+7,6,-1,0,15,{54,-1,203,7,1}},
far NewEitems= {NE_X,NE_Y,11,0,0,16, {43,-2,119,16,1}},
far NewItems= {NM_X,NM_Y,4,1,0,16, {60,-2,105,16,1}},
far SwitchItems= {MENU_X,MENU_Y+25,4,0,0,9,{87,-1,132,7,1}};
#pragma warn -sus
CP_itemtype far MainMenu[]=
{
{AT_ENABLED,"NEW MISSION",CP_NewGame,COAL_FONT},
{AT_READIT,"ORDERING INFO",CP_OrderingInfo},
{AT_READIT,"INSTRUCTIONS",CP_ReadThis},
{AT_ENABLED,"STORY",CP_BlakeStoneSaga},
{AT_DISABLED,"",0},
{AT_ENABLED,"GAME OPTIONS",CP_GameOptions},
{AT_ENABLED,"HIGH SCORES",CP_ViewScores},
{AT_ENABLED,"LOAD MISSION",CP_LoadGame},
{AT_DISABLED,"SAVE MISSION",CP_SaveGame},
{AT_DISABLED,"",0},
{AT_ENABLED,"BACK TO DEMO",CP_ExitOptions},
{AT_ENABLED,"LOGOFF",0}
},
far GopMenu[]=
{
{AT_ENABLED,"SOUND",CP_Sound},
{AT_ENABLED,"CONTROLS",CP_Control},
{AT_ENABLED,"CHANGE VIEW",CP_ChangeView},
{AT_ENABLED,"SWITCHES",CP_Switches},
},
far SndMenu[]=
{
{AT_ENABLED,"NONE",0},
{AT_ENABLED,"PC SPEAKER",0},
{AT_ENABLED,"ADLIB/SOUND BLASTER",0},
{AT_DISABLED,"",0},
{AT_DISABLED,"",0},
{AT_ENABLED,"NONE",0},
{AT_ENABLED,"DISNEY SOUND SOURCE",0},
{AT_ENABLED,"SOUND BLASTER",0},
{AT_DISABLED,"",0},
{AT_DISABLED,"",0},
{AT_ENABLED,"NONE",0},
{AT_ENABLED,"ADLIB/SOUND BLASTER",0}
},
far CtlMenu[]=
{
{AT_DISABLED,"MOUSE ENABLED",0},
{AT_DISABLED,"JOYSTICK ENABLED",0},
{AT_DISABLED,"USE JOYSTICK PORT 2",0},
{AT_DISABLED,"GRAVIS GAMEPAD ENABLED",0},
{AT_DISABLED,"CALIBRATE JOYSTICK",0},
{AT_DISABLED,"MOUSE SENSITIVITY",MouseSensitivity},
{AT_ENABLED,"CUSTOMIZE CONTROLS",CustomControls}
},
far SwitchMenu[]=
{
{AT_ENABLED,"LIGHTING",0},
{AT_ENABLED,"REBA ATTACK INFO",0},
{AT_ENABLED,"SHOW CEILINGS",0},
{AT_ENABLED,"SHOW FLOORS",0}
},
#pragma warn +sus
#if 0
far NewEmenu[]=
{
{AT_ENABLED,"MISSION 1:\n"
"STAR INSTITUTE",0},
{AT_NON_SELECTABLE,"MISSION 2:\n"
"FLOATING FORTRESS",0},
{AT_NON_SELECTABLE,"MISSION 3:\n"
"UNDERGROUND NETWORK",0},
{AT_NON_SELECTABLE,"MISSION 4:\n"
"STAR PORT",0},
{AT_NON_SELECTABLE,"MISSION 5:\n"
"HABITAT II",0},
{AT_NON_SELECTABLE,"MISSION 6:\n"
"SATELLITE DEFENSE",0},
},
#endif
far NewMenu[]=
{
{AT_ENABLED,"LEVEL 1:\n"
"NOVICE AGENT",0},
{AT_ENABLED,"LEVEL 2:\n"
"SKILLED AGENT",0},
{AT_ENABLED,"LEVEL 3:\n"
"EXPERT AGENT",0},
{AT_ENABLED,"LEVEL 4:\n"
"VETERAN AGENT",0}
},
far LSMenu[]=
{
{AT_ENABLED,"",0},
{AT_ENABLED,"",0},
{AT_ENABLED,"",0},
{AT_ENABLED,"",0},
{AT_ENABLED,"",0},
{AT_ENABLED,"",0},
{AT_ENABLED,"",0},
{AT_ENABLED,"",0},
{AT_ENABLED,"",0},
{AT_ENABLED,"",0}
},
far CusMenu[]=
{
{AT_ENABLED,"",0},
{0,"",0},
{AT_ENABLED,"",0},
{0,"",0},
{AT_ENABLED,"",0},
{AT_ENABLED,"",0}
}
;
int color_hlite[]=
{
HIGHLIGHT_DISABLED_COLOR,
HIGHLIGHT_TEXT_COLOR,
READHCOLOR,
HIGHLIGHT_DEACTIAVED_COLOR,
};
int color_norml[]=
{
DISABLED_TEXT_COLOR,
ENABLED_TEXT_COLOR,
READCOLOR,
DEACTIAVED_TEXT_COLOR,
};
int EpisodeSelect[6]={1};
int SaveGamesAvail[10],StartGame,SoundStatus=1,pickquick;
char far SaveGameNames[10][GAME_DESCRIPTION_LEN+1],far SaveName[13]="SAVEGAM?.";
////////////////////////////////////////////////////////////////////
//
// INPUT MANAGER SCANCODE TABLES
//
////////////////////////////////////////////////////////////////////
#ifndef CACHE_KEY_DATA
static byte
far * far ScanNames[] = // Scan code names with single chars
{
"?","?","1","2","3","4","5","6","7","8","9","0","-","+","?","?",
"Q","W","E","R","T","Y","U","I","O","P","[","]","|","?","A","S",
"D","F","G","H","J","K","L",";","\"","?","?","?","Z","X","C","V",
"B","N","M",",",".","/","?","?","?","?","?","?","?","?","?","?",
"?","?","?","?","?","?","?","?","\xf","?","-","\x15","5","\x11","+","?",
"\x13","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?",
"?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?",
"?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?"
}, // DEBUG - consolidate these
far ExtScanCodes[] = // Scan codes with >1 char names
{
1,0xe,0xf,0x1d,0x2a,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,
0x3f,0x40,0x41,0x42,0x43,0x44,0x57,0x59,0x46,0x1c,0x36,
0x37,0x38,0x47,0x49,0x4f,0x51,0x52,0x53,0x45,0x48,
0x50,0x4b,0x4d,0x00
},
far * far ExtScanNames[] = // Names corresponding to ExtScanCodes
{
"ESC","BKSP","TAB","CTRL","LSHFT","SPACE","CAPSLK","F1","F2","F3","F4",
"F5","F6","F7","F8","F9","F10","F11","F12","SCRLK","ENTER","RSHFT",
"PRTSC","ALT","HOME","PGUP","END","PGDN","INS","DEL","NUMLK","UP",
"DOWN","LEFT","RIGHT",""
};
#else
byte far *ScanNames, far * ExtScanNames;
ScanCode far *ExtScanCodes;
#endif
static byte special_keys[] =
{
sc_Tilde,sc_Plus,sc_Minus,sc_L,sc_P,sc_M,sc_S,sc_I,sc_Q,sc_W,sc_E,sc_Enter,sc_1,sc_2,sc_3,sc_4,sc_5,sc_Tab
};
//-------------------------------------------------------------------------
// HelpScreens()
//-------------------------------------------------------------------------
void HelpScreens()
{
#ifndef ID_CACHE_HELP
HelpPresenter("HELP.TXT",false,0,true);
#else
HelpPresenter(NULL,false,HELPTEXT,true);
#endif
}
//-------------------------------------------------------------------------
// HelpPresenter()
//-------------------------------------------------------------------------
void HelpPresenter(char *fname,boolean continue_keys, unsigned id_cache, boolean startmusic)
{
#define FULL_VIEW_WIDTH 19
PresenterInfo pi;
short oldwidth;
memset(&pi,0,sizeof(pi));
pi.flags = TPF_SHOW_PAGES;
if (continue_keys)
pi.flags |= TPF_CONTINUE;
VW_FadeOut();
// Change view size to MAX! (scaler clips shapes on smaller views)
//
oldwidth = viewwidth/16;
if (oldwidth != FULL_VIEW_WIDTH)
NewViewSize(FULL_VIEW_WIDTH);
// Draw help border
//
CacheLump(H_TOPWINDOWPIC,H_BOTTOMINFOPIC);
VWB_DrawPic (0,0,H_TOPWINDOWPIC);
VWB_DrawPic (0,8,H_LEFTWINDOWPIC);
VWB_DrawPic (312,8,H_RIGHTWINDOWPIC);
VWB_DrawPic (8,176,H_BOTTOMINFOPIC);
UnCacheLump(H_TOPWINDOWPIC,H_BOTTOMINFOPIC);
// Setup for text presenter
//
pi.xl=8;
pi.yl=8;
pi.xh=311;
pi.yh=175;
pi.ltcolor=0x7b;
pi.bgcolor=0x7d;
pi.dkcolor=0x7f;
pi.shcolor=0x00;
pi.fontnumber=4;
if (continue_keys)
pi.infoline = (char far *)" UP / DN - PAGES ENTER - CONTINUES ESC - EXITS";
else
pi.infoline = (char far *)" UP / DN - PAGES ESC - EXITS";
if (startmusic)
StartCPMusic(TEXTSONG);
// Load, present, and free help text.
//
TP_LoadScript(fname,&pi,id_cache);
TP_Presenter(&pi);
TP_FreeScript(&pi,id_cache);
MenuFadeOut();
// Reset view size
//
if (oldwidth != FULL_VIEW_WIDTH)
NewViewSize(oldwidth);
if (startmusic && TPscan==sc_Escape)
StartCPMusic(MENUSONG);
IN_ClearKeysDown();
}
//--------------------------------------------------------------------------
// US_ControlPanel() - Control Panel! Ta Da!
//--------------------------------------------------------------------------
void US_ControlPanel(byte scancode)
{
int which;
#ifdef CACHE_KEY_DATA
CA_CacheGrChunk(SCANNAMES_DATA);
CA_CacheGrChunk(EXTSCANNAMES_DATA);
CA_CacheGrChunk(EXTSCANCODES_DATA);
ScanNames = grsegs[SCANNAMES_DATA];
ExtScanNames = grsegs[EXTSCANNAMES_DATA];
ExtScanCodes = grsegs[EXTSCANCODES_DATA];
#else
//
// This code doesn't correctly save the table data -- it saves garbage
// for SCANNAMES and EXTSCANCODES...
//
// IO_WriteFile("SCANNAME.BIN",ScanNames,sizeof(ScanNames));
// IO_WriteFile("EXTSCNAM.BIN",ExtScanNames,sizeof(ExtScanNames));
// IO_WriteFile("EXTSCCOD.BIN",ExtScanCodes,sizeof(ExtScanCodes));
#endif
if (ingame)
if (CP_CheckQuick(scancode))
return;
SetupControlPanel();
StartCPMusic(MENUSONG);
//
// F-KEYS FROM WITHIN GAME
//
switch(scancode)
{
case sc_F1:
CleanupControlPanel();
HelpScreens();
return;
case sc_F2:
CP_SaveGame(0);
goto finishup;
case sc_F3:
CP_LoadGame(0);
// refresh_screen=false;
goto finishup;
case sc_F4:
CP_Sound();
goto finishup;
case sc_F5:
CP_ChangeView();
goto finishup;
case sc_F6:
CP_Control();
goto finishup;
finishup:
CleanupControlPanel();
return;
}
DrawMainMenu();
MenuFadeIn();
StartGame=0;
//
// MAIN MENU LOOP
//
do
{
which=HandleMenu(&MainItems,&MainMenu[0],NULL);
switch(which)
{
case MM_VIEW_SCORES:
if (MainMenu[MM_VIEW_SCORES].routine == NULL)
if (CP_EndGame())
StartGame=1;
DrawMainMenu();
MenuFadeIn();
break;
case -1:
case MM_LOGOFF:
CP_Quit();
break;
default:
if (!StartGame)
{
DrawMainMenu();
MenuFadeIn();
}
}
//
// "EXIT OPTIONS" OR "NEW GAME" EXITS
//
} while(!StartGame);
//
// DEALLOCATE EVERYTHING
//
CleanupControlPanel();
if (!loadedgame)
StopMusic();
//
// CHANGE MAINMENU ITEM
//
if (startgame || loadedgame)
{
#pragma warn -sus
MainMenu[MM_VIEW_SCORES].routine = NULL;
_fstrcpy(MainMenu[MM_VIEW_SCORES].string,"END GAME");
#pragma warn +sus
}
if (ingame && loadedgame)
refresh_screen=false;
#ifdef CACHE_KEY_DATA
FREEFONT(SCANNAMES_DATA);
FREEFONT(EXTSCANNAMES_DATA);
FREEFONT(EXTSCANCODES_DATA);
#endif
// RETURN/START GAME EXECUTION
}
//--------------------------------------------------------------------------
// DrawMainMenu(void)
//--------------------------------------------------------------------------
void DrawMainMenu(void)
{
ControlPanelFree();
CA_CacheScreen (BACKGROUND_SCREENPIC);
ControlPanelAlloc();
ClearMScreen();
DrawMenuTitle("MAIN OPTIONS");
DrawInstructions(IT_STANDARD);
//
// CHANGE "MISSION" AND "DEMO"
//
if (ingame)
{
_fstrcpy(&MainMenu[MM_BACK_TO_DEMO].string[8],"MISSION");
MainMenu[MM_BACK_TO_DEMO].active=AT_READIT;
}
else
{
_fstrcpy(&MainMenu[MM_BACK_TO_DEMO].string[8],"DEMO");
MainMenu[MM_BACK_TO_DEMO].active=AT_ENABLED;
}
fontnumber = 4; // COAL
DrawMenu(&MainItems,&MainMenu[0]);
VW_UpdateScreen();
}
//--------------------------------------------------------------------------
// READ THIS!
//--------------------------------------------------------------------------
void CP_ReadThis(void)
{
ControlPanelFree();
HelpScreens();
ControlPanelAlloc();
}
//--------------------------------------------------------------------------
// CP_OrderingInfo()
//--------------------------------------------------------------------------
void CP_OrderingInfo(void)
{
ControlPanelFree();
#ifndef ID_CACHE_HELP
HelpPresenter("ORDER.TXT",false,0,true);
#else
HelpPresenter(NULL,false,ORDERTEXT,true);
#endif
ControlPanelAlloc();
}
//-------------------------------------------------------------------------
// CP_BlakeStoneSaga()
//-------------------------------------------------------------------------
void CP_BlakeStoneSaga()
{
ControlPanelFree();
#ifndef ID_CACHE_HELP
HelpPresenter("SAGA.TXT",false,0,true);
#else
HelpPresenter(NULL,false,SAGATEXT,true);
#endif
ControlPanelAlloc();
}
//--------------------------------------------------------------------------
// CP_CheckQuick() - CHECK QUICK-KEYS & QUIT (WHILE IN A GAME)
//--------------------------------------------------------------------------
int CP_CheckQuick(unsigned scancode)
{
switch(scancode)
{
// END GAME
//
case sc_F7:
VW_ScreenToScreen (displayofs,bufferofs,80,160);
CA_CacheGrChunk(STARTFONT+1);
WindowH=160;
if (Confirm(ENDGAMESTR))
{
playstate = ex_died;
pickquick = gamestate.lives = 0;
}
WindowH=200;
fontnumber=4;
return(1);
// QUICKSAVE
//
case sc_F8:
if (SaveGamesAvail[LSItems.curpos] && pickquick)
{
char string[100]="Quick Save will overwrite:\n\"";
CA_CacheGrChunk(STARTFONT+1);
_fstrcat(string,SaveGameNames[LSItems.curpos]);
strcat(string,"\"?");
VW_ScreenToScreen (displayofs,bufferofs,80,160);
#if IN_DEVELOPMENT
if (TestQuickSave || Confirm(string))
{
if (TestQuickSave)
TestQuickSave--;
#else
if (Confirm(string))
{
#endif
CA_CacheGrChunk(STARTFONT+1);
CP_SaveGame(1);
fontnumber=4;
}
else
refresh_screen=false;
}
else
{
CA_CacheGrChunk(STARTFONT+1);
VW_FadeOut ();
StartCPMusic(MENUSONG);
pickquick=CP_SaveGame(0);
lasttimecount = TimeCount;
if (MousePresent)
Mouse(MDelta); // Clear accumulated mouse movement
}
return(1);
// QUICKLOAD
//
case sc_F9:
if (SaveGamesAvail[LSItems.curpos] && pickquick)
{
char string[100]="Quick Load:\n\"";
CA_CacheGrChunk(STARTFONT+1);
_fstrcat(string,SaveGameNames[LSItems.curpos]);
strcat(string,"\"?");
VW_ScreenToScreen (displayofs,bufferofs,80,160);
if (Confirm(string))
CP_LoadGame(1);
else
{
refresh_screen=false;
return(1);
}
fontnumber=4;
}
else
{
CA_CacheGrChunk(STARTFONT+1);
VW_FadeOut ();
StartCPMusic(MENUSONG);
pickquick=CP_LoadGame(0);
lasttimecount = TimeCount;
if (MousePresent)
Mouse(MDelta); // Clear accumulated mouse movement
PM_CheckMainMem ();
}
if (pickquick)
refresh_screen=false;
return(1);
// QUIT
//
case sc_F10:
CA_CacheGrChunk(STARTFONT+1);
VW_ScreenToScreen (displayofs,bufferofs,80,160);
WindowX=WindowY=0;
WindowW=320;
WindowH=160;
if (Confirm(QuitToDosStr))
ExitGame();
refresh_screen=false;
WindowH=200;
fontnumber=4;
return(1);
}
return(0);
}
//--------------------------------------------------------------------------
// END THE CURRENT GAME
//--------------------------------------------------------------------------
int CP_EndGame(void)
{
if (!Confirm(ENDGAMESTR))
return 0;
pickquick = gamestate.lives = 0;
playstate = ex_died;
InstantQuit = 1;
#if 0
#pragma warn -sus
MainMenu[MM_VIEW_SCORES].routine=&CP_ViewScores;
_fstrcpy(MainMenu[MM_VIEW_SCORES].string,"HIGH SCORES");
#pragma warn +sus
#endif
return 1;
}
//--------------------------------------------------------------------------
// CP_ViewScores() - VIEW THE HIGH SCORES
//--------------------------------------------------------------------------
void CP_ViewScores(void)
{
fontnumber=4;
StartCPMusic(ROSTER_MUS);
DrawHighScores ();
VW_UpdateScreen ();
MenuFadeIn();
fontnumber=1;
IN_Ack();
StartCPMusic(MENUSONG);
MenuFadeOut();
}
//--------------------------------------------------------------------------
// CP_NewGame() - START A NEW GAME
//--------------------------------------------------------------------------
void CP_NewGame(void)
{
int which,episode;
DrawMenuTitle("Difficulty Level");
DrawInstructions(IT_STANDARD);
#if 0
firstpart:
DrawNewEpisode();
do
{
which=HandleMenu(&NewEitems,&NewEmenu[0],DrawEpisodePic);
switch(which)
{
case -1:
MenuFadeOut();
return;
default:
if (!EpisodeSelect[which])
{
SD_PlaySound (NOWAYSND);
CacheMessage(READTHIS_TEXT);
IN_ClearKeysDown();
IN_Ack();
VL_Bar(35,69,250,62,TERM_BACK_COLOR);
DrawNewEpisode();
which = 0;
}
else
{
episode = which;
which = 1;
}
break;
}
} while (!which);
ShootSnd();
#else
episode = 0;
#endif
#if 0
//
// ALREADY IN A GAME?
//
if (ingame)
if (!Confirm(CURGAME))
{
MenuFadeOut();
return;
}
#endif
secondpart:
MenuFadeOut();
if (ingame)
CA_CacheScreen(BACKGROUND_SCREENPIC);
DrawNewGame();
which=HandleMenu(&NewItems,&NewMenu[0],DrawNewGameDiff);
if (which<0)
{
MenuFadeOut();
#if 0
goto firstpart;
#else
return;
#endif
}
ShootSnd();
MenuFadeOut();
ControlPanelFree();
if (Breifing(BT_INTRO,episode))
{
CA_CacheScreen (BACKGROUND_SCREENPIC);
ControlPanelAlloc();
goto secondpart;
}
StartGame=1;
NewGame(which,episode);
//
// CHANGE "READ THIS!" TO NORMAL COLOR
//
MainMenu[MM_READ_THIS].active=AT_ENABLED;
}
//---------------------------------------------------------------------------
// DrawMenuTitle() - Draws the menu title
//---------------------------------------------------------------------------
void DrawMenuTitle(char *title)
{
fontnumber = 3;
CA_CacheGrChunk(STARTFONT+3);
PrintX = WindowX = 32;
PrintY = WindowY = 32;
WindowW = 244;
WindowH = 20;
SETFONTCOLOR(TERM_SHADOW_COLOR,TERM_BACK_COLOR);
US_PrintCentered(title);
WindowX = 32-1;
WindowY = 32-1;
SETFONTCOLOR(ENABLED_TEXT_COLOR,TERM_BACK_COLOR);
US_PrintCentered(title);
FREEFONT(STARTFONT+3);
}
//---------------------------------------------------------------------------
// DrawInstructions() - Draws instructions centered at the bottom of
// the view screen.
//
// NOTES: Orginal font number or font color is not maintained.
//---------------------------------------------------------------------------
void DrawInstructions(inst_type Type)
{
#define INSTRUCTIONS_Y_POS 154+10
char *instr[MAX_INSTRUCTIONS] = {{"UP/DN SELECTS - ENTER CHOOSES - ESC EXITS"},
{"PRESS ANY KEY TO CONTINUE"},
{"ENTER YOUR NAME AND PRESS ENTER"},
{"RT/LF ARROW SELECTS - ENTER CHOOSES"}};
fontnumber = 2;
WindowX = 48;
WindowY = INSTRUCTIONS_Y_POS;
WindowW = 236;
WindowH = 8;
VWB_Bar(WindowX,WindowY-1,WindowW,WindowH,TERM_BACK_COLOR);
SETFONTCOLOR(TERM_SHADOW_COLOR,TERM_BACK_COLOR);
US_PrintCentered(instr[Type]);
WindowX--;
WindowY--;
SETFONTCOLOR(INSTRUCTIONS_TEXT_COLOR,TERM_BACK_COLOR);
US_PrintCentered(instr[Type]);
}
#if 0
//--------------------------------------------------------------------------
// DrawNewEpisode() - DRAW NEW EPISODE MENU
//--------------------------------------------------------------------------
void DrawNewEpisode(void)
{
ClearMScreen();
DrawMenuTitle("CHOOSE A MISSION");
DrawInstructions(IT_STANDARD);
PrintY=51;
WindowX=58;
fontnumber = 2; // six point font
DrawMenu(&NewEitems,&NewEmenu7[0]);
DrawEpisodePic(NewEitems.curpos);
VW_UpdateScreen();
MenuFadeIn();
WaitKeyUp();
}
#endif
//--------------------------------------------------------------------------
// DrawNewGame() - DRAW NEW GAME MENU
//--------------------------------------------------------------------------
void DrawNewGame(void)
{
ClearMScreen();
DrawMenuTitle("DIFFICULTY LEVEL");
DrawInstructions(IT_STANDARD);
fontnumber = 2; // six point font
DrawMenu(&NewItems,&NewMenu[0]);
DrawNewGameDiff(NewItems.curpos);
px=48;
py=INSTRUCTIONS_Y_POS-24;
ShPrint(" HIGHER DIFFICULTY LEVELS CONTAIN",TERM_SHADOW_COLOR,false);
px=48;
py+=6;
ShPrint(" MORE, STRONGER ENEMIES",TERM_SHADOW_COLOR,false);
VW_UpdateScreen();
MenuFadeIn();
WaitKeyUp();
}
//--------------------------------------------------------------------------
// DRAW NEW GAME GRAPHIC
//--------------------------------------------------------------------------
void DrawNewGameDiff(int w)
{
VWB_DrawPic(192,77,w+C_BABYMODEPIC);
}
//--------------------------------------------------------------------------
// DRAW NEW GAME GRAPHIC
//--------------------------------------------------------------------------
void DrawEpisodePic(int w)
{
VWB_DrawPic(176,72,w+C_EPISODE1PIC);
}
//--------------------------------------------------------------------------
// CP_GameOptions() - DRAW THE GAME OPTIONS MENU
//--------------------------------------------------------------------------
void CP_GameOptions(void)
{
int which,i;
CA_CacheScreen (BACKGROUND_SCREENPIC);
DrawGopMenu();