1 ////////////////////////////////////////////////////////////////////
\r
4 // by John Romero (C) 1992 Id Software, Inc.
\r
6 ////////////////////////////////////////////////////////////////////
\r
11 // PRIVATE PROTOTYPES
\r
13 void CP_ReadThis(void);
\r
16 #define STARTITEM newgame
\r
20 #define STARTITEM newgame
\r
23 #define STARTITEM readthis
\r
27 char far endStrings[9][80]=
\r
30 {"Dost thou wish to\nleave with such hasty\nabandon?"},
\r
31 {"Chickening out...\nalready?"},
\r
32 {"Press N for more carnage.\nPress Y to be a weenie."},
\r
33 {"So, you think you can\nquit this easily, huh?"},
\r
34 {"Press N to save the world.\nPress Y to abandon it in\nits hour of need."},
\r
35 {"Press N if you are brave.\nPress Y to cower in shame."},
\r
36 {"Heroes, press N.\nWimps, press Y."},
\r
37 {"You are at an intersection.\nA sign says, 'Press Y to quit.'\n>"},
\r
38 {"For guns and glory, press N.\nFor work and worry, press Y."}
\r
53 MainItems={MENU_X,MENU_Y,10,STARTITEM,24},
\r
54 SndItems={SM_X,SM_Y1,12,0,52},
\r
55 LSItems={LSM_X,LSM_Y,10,0,24},
\r
56 CtlItems={CTL_X,CTL_Y,6,-1,56},
\r
57 CusItems={8,CST_Y+13*2,9,-1,0},
\r
58 NewEitems={NE_X,NE_Y,11,0,88},
\r
59 NewItems={NM_X,NM_Y,4,2,24};
\r
71 {1,"",CP_ChangeView},
\r
73 {1,"",CP_ViewScores},
\r
78 {1,STR_NG,CP_NewGame},
\r
79 {1,STR_SD,CP_Sound},
\r
80 {1,STR_CL,CP_Control},
\r
81 {1,STR_LG,CP_LoadGame},
\r
82 {0,STR_SG,CP_SaveGame},
\r
83 {1,STR_CV,CP_ChangeView},
\r
89 {2,"Ve esto!",CP_ReadThis},
\r
91 {2,"Read This!",CP_ReadThis},
\r
97 {1,STR_VS,CP_ViewScores},
\r
141 {0,"",MouseSensitivity},
\r
142 {1,"",CustomControls}
\r
148 {0,STR_SENS,MouseSensitivity},
\r
149 {1,STR_CUSTOM,CustomControls}
\r
189 "Fuga desde Wolfenstein",0},
\r
192 "Operacion Eisenfaust",0},
\r
195 "Muere, Fuhrer, Muere!",0},
\r
198 "Un Negro Secreto",0},
\r
201 "Huellas del Loco",0},
\r
207 "Escape from Wolfenstein",0},
\r
210 "Operation: Eisenfaust",0},
\r
213 "Die, Fuhrer, Die!",0},
\r
216 "A Dark Secret",0},
\r
219 "Trail of the Madman",0},
\r
273 int color_hlite[]={
\r
287 int EpisodeSelect[6]={1};
\r
290 int SaveGamesAvail[10],StartGame,SoundStatus=1,pickquick;
\r
291 char SaveGameNames[10][32],SaveName[13]="SAVEGAM?.";
\r
294 ////////////////////////////////////////////////////////////////////
\r
296 // INPUT MANAGER SCANCODE TABLES
\r
298 ////////////////////////////////////////////////////////////////////
\r
300 *ScanNames[] = // Scan code names with single chars
\r
302 "?","?","1","2","3","4","5","6","7","8","9","0","-","+","?","?",
\r
303 "Q","W","E","R","T","Y","U","I","O","P","[","]","|","?","A","S",
\r
304 "D","F","G","H","J","K","L",";","\"","?","?","?","Z","X","C","V",
\r
305 "B","N","M",",",".","/","?","?","?","?","?","?","?","?","?","?",
\r
306 "?","?","?","?","?","?","?","?","\xf","?","-","\x15","5","\x11","+","?",
\r
307 "\x13","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?",
\r
308 "?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?",
\r
309 "?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?"
\r
310 }, // DEBUG - consolidate these
\r
311 far ExtScanCodes[] = // Scan codes with >1 char names
\r
313 1,0xe,0xf,0x1d,0x2a,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,
\r
314 0x3f,0x40,0x41,0x42,0x43,0x44,0x57,0x59,0x46,0x1c,0x36,
\r
315 0x37,0x38,0x47,0x49,0x4f,0x51,0x52,0x53,0x45,0x48,
\r
316 0x50,0x4b,0x4d,0x00
\r
318 *ExtScanNames[] = // Names corresponding to ExtScanCodes
\r
320 "Esc","BkSp","Tab","Ctrl","LShft","Space","CapsLk","F1","F2","F3","F4",
\r
321 "F5","F6","F7","F8","F9","F10","F11","F12","ScrlLk","Enter","RShft",
\r
322 "PrtSc","Alt","Home","PgUp","End","PgDn","Ins","Del","NumLk","Up",
\r
323 "Down","Left","Right",""
\r
327 ////////////////////////////////////////////////////////////////////
\r
329 // Wolfenstein Control Panel! Ta Da!
\r
331 ////////////////////////////////////////////////////////////////////
\r
332 void US_ControlPanel(byte scancode)
\r
338 if (CP_CheckQuick(scancode))
\r
341 StartCPMusic(MENUSONG);
\r
342 SetupControlPanel();
\r
345 // F-KEYS FROM WITHIN GAME
\r
382 CleanupControlPanel();
\r
384 UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
390 CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
402 which=HandleMenu(&MainItems,&MainMenu[0],NULL);
\r
407 // EASTER EGG FOR SPEAR OF DESTINY!
\r
409 if (Keyboard[sc_I] && Keyboard[sc_D])
\r
412 StartCPMusic (XJAZNAZI_MUS);
\r
413 UnCacheLump(OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
414 UnCacheLump(BACKDROP_LUMP_START,BACKDROP_LUMP_END);
\r
419 CA_CacheGrChunk (IDGUYS1PIC);
\r
420 VWB_DrawPic(0,0,IDGUYS1PIC);
\r
421 UNCACHEGRCHUNK(IDGUYS1PIC);
\r
423 CA_CacheGrChunk (IDGUYS2PIC);
\r
424 VWB_DrawPic(0,80,IDGUYS2PIC);
\r
425 UNCACHEGRCHUNK(IDGUYS2PIC);
\r
429 CA_CacheGrChunk (IDGUYSPALETTE);
\r
430 VL_FadeIn(0,255,grsegs[IDGUYSPALETTE],30);
\r
431 UNCACHEGRCHUNK(IDGUYSPALETTE);
\r
433 while (Keyboard[sc_I] || Keyboard[sc_D]);
\r
434 IN_ClearKeysDown();
\r
439 CacheLump(BACKDROP_LUMP_START,BACKDROP_LUMP_END);
\r
440 CacheLump(OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
442 StartCPMusic (MENUSONG);
\r
451 if (MainMenu[viewscores].routine == NULL)
\r
464 // DEALLOCATE ALL SOUNDS!
\r
469 start = STARTPCSOUNDS;
\r
472 start = STARTADLIBSOUNDS;
\r
476 if (SoundMode != sdm_Off)
\r
477 for (i=0;i<NUMSOUNDS;i++,start++)
\r
478 if (audiosegs[start])
\r
479 MM_SetPurge (&(memptr)audiosegs[start],3); // make purgable
\r
486 StartCPMusic(INTROSONG);
\r
487 VL_FadeOut(0,255,0,0,0,10);
\r
504 // "EXIT OPTIONS" OR "NEW GAME" EXITS
\r
506 } while(!StartGame);
\r
509 // DEALLOCATE EVERYTHING
\r
511 CleanupControlPanel();
\r
514 // CHANGE MAINMENU ITEM
\r
516 if (startgame || loadedgame)
\r
519 MainMenu[viewscores].routine = NULL;
\r
521 _fstrcpy(MainMenu[viewscores].string,STR_EG);
\r
526 // RETURN/START GAME EXECUTION
\r
529 UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
535 ////////////////////////
\r
537 // DRAW MAIN MENU SCREEN
\r
539 void DrawMainMenu(void)
\r
542 CA_CacheScreen(S_OPTIONSPIC);
\r
546 VWB_DrawPic(112,184,C_MOUSELBACKPIC);
\r
548 VWB_DrawPic(84,0,C_OPTIONSPIC);
\r
551 DrawWindow(MENU_X-8,MENU_Y-3,MENU_W+8,MENU_H,BKGDCOLOR);
\r
553 DrawWindow(MENU_X-8,MENU_Y-3,MENU_W,MENU_H,BKGDCOLOR);
\r
558 // CHANGE "GAME" AND "DEMO"
\r
565 _fstrcpy(&MainMenu[backtodemo].string,STR_GAME);
\r
567 _fstrcpy(&MainMenu[backtodemo].string[8],STR_GAME);
\r
571 CA_CacheGrChunk(C_MRETGAMEPIC);
\r
572 VWB_DrawPic(12*8,20*8,C_MRETGAMEPIC);
\r
573 UNCACHEGRCHUNK(C_MRETGAMEPIC);
\r
574 CA_CacheGrChunk(C_MENDGAMEPIC);
\r
575 VWB_DrawPic(12*8,18*8,C_MENDGAMEPIC);
\r
576 UNCACHEGRCHUNK(C_MENDGAMEPIC);
\r
578 MainMenu[backtodemo].active=2;
\r
584 _fstrcpy(&MainMenu[backtodemo].string,STR_BD);
\r
586 _fstrcpy(&MainMenu[backtodemo].string[8],STR_DEMO);
\r
589 CA_CacheGrChunk(C_MRETDEMOPIC);
\r
590 VWB_DrawPic(12*8,20*8,C_MRETDEMOPIC);
\r
591 UNCACHEGRCHUNK(C_MRETDEMOPIC);
\r
592 CA_CacheGrChunk(C_MSCORESPIC);
\r
593 VWB_DrawPic(12*8,18*8,C_MSCORESPIC);
\r
594 UNCACHEGRCHUNK(C_MSCORESPIC);
\r
596 MainMenu[backtodemo].active=1;
\r
599 DrawMenu(&MainItems,&MainMenu[0]);
\r
605 ////////////////////////////////////////////////////////////////////
\r
609 ////////////////////////////////////////////////////////////////////
\r
610 void CP_ReadThis(void)
\r
612 StartCPMusic(CORNER_MUS);
\r
614 StartCPMusic(MENUSONG);
\r
622 ////////////////////////////////////////////////////////////////////
\r
626 ////////////////////////////////////////////////////////////////////
\r
631 geninterrupt(0x10);
\r
633 while (!Keyboard[sc_Escape])
\r
634 IN_ClearKeysDown();
\r
637 VL_SetVGAPlaneMode ();
\r
638 VL_TestPaletteSet ();
\r
639 VL_SetPalette (&gamepal);
\r
645 ////////////////////////////////////////////////////////////////////
\r
647 // CHECK QUICK-KEYS & QUIT (WHILE IN A GAME)
\r
649 ////////////////////////////////////////////////////////////////////
\r
650 int CP_CheckQuick(unsigned scancode)
\r
658 CA_CacheGrChunk(STARTFONT+1);
\r
662 if (GetYorN(7,8,C_JAPQUITPIC))
\r
664 if (Confirm(ENDGAMESTR))
\r
667 playstate = ex_died;
\r
668 pickquick = gamestate.lives = 0;
\r
671 DrawAllPlayBorder();
\r
674 MainMenu[savegame].active = 0;
\r
681 if (SaveGamesAvail[LSItems.curpos] && pickquick)
\r
683 CA_CacheGrChunk(STARTFONT+1);
\r
685 Message(STR_SAVING"...");
\r
692 CA_CacheGrChunk(STARTFONT+1);
\r
693 CA_CacheGrChunk(C_CURSOR1PIC);
\r
694 CA_CacheGrChunk(C_CURSOR2PIC);
\r
695 CA_CacheGrChunk(C_DISKLOADING1PIC);
\r
696 CA_CacheGrChunk(C_DISKLOADING2PIC);
\r
697 CA_CacheGrChunk(C_SAVEGAMEPIC);
\r
698 CA_CacheGrChunk(C_MOUSELBACKPIC);
\r
700 CacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
\r
701 CA_CacheGrChunk(C_CURSOR1PIC);
\r
706 StartCPMusic(MENUSONG);
\r
707 pickquick=CP_SaveGame(0);
\r
709 SETFONTCOLOR(0,15);
\r
710 IN_ClearKeysDown();
\r
713 if (!startgame && !loadedgame)
\r
720 playstate = ex_abort;
\r
721 lasttimecount = TimeCount;
\r
724 Mouse(MDelta); // Clear accumulated mouse movement
\r
726 PM_CheckMainMem ();
\r
729 UNCACHEGRCHUNK(C_CURSOR1PIC);
\r
730 UNCACHEGRCHUNK(C_CURSOR2PIC);
\r
731 UNCACHEGRCHUNK(C_DISKLOADING1PIC);
\r
732 UNCACHEGRCHUNK(C_DISKLOADING2PIC);
\r
733 UNCACHEGRCHUNK(C_SAVEGAMEPIC);
\r
734 UNCACHEGRCHUNK(C_MOUSELBACKPIC);
\r
736 UnCacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
\r
745 if (SaveGamesAvail[LSItems.curpos] && pickquick)
\r
747 char string[100]=STR_LGC;
\r
750 CA_CacheGrChunk(STARTFONT+1);
\r
753 strcat(string,SaveGameNames[LSItems.curpos]);
\r
754 strcat(string,"\"?");
\r
756 if (Confirm(string))
\r
759 DrawAllPlayBorder();
\r
765 CA_CacheGrChunk(STARTFONT+1);
\r
766 CA_CacheGrChunk(C_CURSOR1PIC);
\r
767 CA_CacheGrChunk(C_CURSOR2PIC);
\r
768 CA_CacheGrChunk(C_DISKLOADING1PIC);
\r
769 CA_CacheGrChunk(C_DISKLOADING2PIC);
\r
770 CA_CacheGrChunk(C_LOADGAMEPIC);
\r
771 CA_CacheGrChunk(C_MOUSELBACKPIC);
\r
773 CA_CacheGrChunk(C_CURSOR1PIC);
\r
774 CacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
\r
779 StartCPMusic(MENUSONG);
\r
780 pickquick=CP_LoadGame(0);
\r
782 SETFONTCOLOR(0,15);
\r
783 IN_ClearKeysDown();
\r
786 if (!startgame && !loadedgame)
\r
793 playstate = ex_abort;
\r
795 lasttimecount = TimeCount;
\r
798 Mouse(MDelta); // Clear accumulated mouse movement
\r
799 PM_CheckMainMem ();
\r
802 UNCACHEGRCHUNK(C_CURSOR1PIC);
\r
803 UNCACHEGRCHUNK(C_CURSOR2PIC);
\r
804 UNCACHEGRCHUNK(C_DISKLOADING1PIC);
\r
805 UNCACHEGRCHUNK(C_DISKLOADING2PIC);
\r
806 UNCACHEGRCHUNK(C_LOADGAMEPIC);
\r
807 UNCACHEGRCHUNK(C_MOUSELBACKPIC);
\r
809 UnCacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
\r
818 CA_CacheGrChunk(STARTFONT+1);
\r
824 if (GetYorN(7,8,C_QUITMSGPIC))
\r
827 if (Confirm(ENDGAMESTR))
\r
829 if (Confirm(endStrings[US_RndT()&0x7+(US_RndT()&1)]))
\r
842 // SHUT-UP THE ADLIB
\r
844 for (i=1;i<=0xf5;i++)
\r
849 DrawAllPlayBorder();
\r
859 ////////////////////////////////////////////////////////////////////
\r
861 // END THE CURRENT GAME
\r
863 ////////////////////////////////////////////////////////////////////
\r
864 int CP_EndGame(void)
\r
867 if (!GetYorN(7,8,C_JAPQUITPIC))
\r
869 if (!Confirm(ENDGAMESTR))
\r
873 pickquick = gamestate.lives = 0;
\r
874 playstate = ex_died;
\r
877 MainMenu[savegame].active = 0;
\r
878 MainMenu[viewscores].routine=CP_ViewScores;
\r
880 _fstrcpy(MainMenu[viewscores].string,STR_VS);
\r
888 ////////////////////////////////////////////////////////////////////
\r
890 // VIEW THE HIGH SCORES
\r
892 ////////////////////////////////////////////////////////////////////
\r
893 void CP_ViewScores(void)
\r
898 UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
899 StartCPMusic (XAWARD_MUS);
\r
901 StartCPMusic (ROSTER_MUS);
\r
905 VW_UpdateScreen ();
\r
911 StartCPMusic(MENUSONG);
\r
915 CacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
\r
916 CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
921 ////////////////////////////////////////////////////////////////////
\r
923 // START A NEW GAME
\r
925 ////////////////////////////////////////////////////////////////////
\r
926 void CP_NewGame(void)
\r
931 UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
941 which=HandleMenu(&NewEitems,&NewEmenu[0],NULL);
\r
949 if (!EpisodeSelect[which/2])
\r
951 SD_PlaySound (NOWAYSND);
\r
952 Message("Please select \"Read This!\"\n"
\r
953 "from the Options menu to\n"
\r
954 "find out how to order this\n"
\r
955 "episode from Apogee.");
\r
956 IN_ClearKeysDown();
\r
974 // ALREADY IN A GAME?
\r
978 if (!GetYorN(7,8,C_JAPNEWGAMEPIC))
\r
980 if (!Confirm(CURGAME))
\r
993 // ALREADY IN A GAME?
\r
995 CacheLump (NEWGAME_LUMP_START,NEWGAME_LUMP_END);
\r
998 if (!Confirm(CURGAME))
\r
1001 UnCacheLump (NEWGAME_LUMP_START,NEWGAME_LUMP_END);
\r
1002 CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1009 which=HandleMenu(&NewItems,&NewMenu[0],DrawNewGameDiff);
\r
1016 UnCacheLump (NEWGAME_LUMP_START,NEWGAME_LUMP_END);
\r
1017 CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1023 NewGame(which,episode);
\r
1028 // CHANGE "READ THIS!" TO NORMAL COLOR
\r
1032 MainMenu[readthis].active=1;
\r
1039 UnCacheLump (NEWGAME_LUMP_START,NEWGAME_LUMP_END);
\r
1040 CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1046 /////////////////////
\r
1048 // DRAW NEW EPISODE MENU
\r
1050 void DrawNewEpisode(void)
\r
1055 CA_CacheScreen(S_EPISODEPIC);
\r
1058 VWB_DrawPic(112,184,C_MOUSELBACKPIC);
\r
1060 DrawWindow(NE_X-4,NE_Y-4,NE_W+8,NE_H+8,BKGDCOLOR);
\r
1061 SETFONTCOLOR(READHCOLOR,BKGDCOLOR);
\r
1065 US_CPrint("Cual episodio jugar?");
\r
1067 US_CPrint("Which episode to play?");
\r
1071 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
1072 DrawMenu(&NewEitems,&NewEmenu[0]);
\r
1075 VWB_DrawPic(NE_X+32,NE_Y+i*26,C_EPISODE1PIC+i);
\r
1077 VW_UpdateScreen();
\r
1083 /////////////////////
\r
1085 // DRAW NEW GAME MENU
\r
1087 void DrawNewGame(void)
\r
1090 CA_CacheScreen(S_SKILLPIC);
\r
1093 VWB_DrawPic(112,184,C_MOUSELBACKPIC);
\r
1095 SETFONTCOLOR(READHCOLOR,BKGDCOLOR);
\r
1101 US_Print("Eres macho?");
\r
1103 US_Print("How tough are you?");
\r
1106 VWB_DrawPic (PrintX,PrintY,C_HOWTOUGHPIC);
\r
1109 DrawWindow(NM_X-5,NM_Y-10,NM_W,NM_H,BKGDCOLOR);
\r
1112 DrawMenu(&NewItems,&NewMenu[0]);
\r
1113 DrawNewGameDiff(NewItems.curpos);
\r
1114 VW_UpdateScreen();
\r
1120 ////////////////////////
\r
1122 // DRAW NEW GAME GRAPHIC
\r
1124 void DrawNewGameDiff(int w)
\r
1126 VWB_DrawPic(NM_X+185,NM_Y+7,w+C_BABYMODEPIC);
\r
1130 ////////////////////////////////////////////////////////////////////
\r
1132 // HANDLE SOUND MENU
\r
1134 ////////////////////////////////////////////////////////////////////
\r
1135 void CP_Sound(void)
\r
1141 UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1142 CacheLump (SOUND_LUMP_START,SOUND_LUMP_END);
\r
1151 which=HandleMenu(&SndItems,&SndMenu[0],NULL);
\r
1153 // HANDLE MENU CHOICES
\r
1161 if (SoundMode!=sdm_Off)
\r
1163 SD_WaitSoundDone();
\r
1164 SD_SetSoundMode(sdm_Off);
\r
1169 if (SoundMode!=sdm_PC)
\r
1171 SD_WaitSoundDone();
\r
1172 SD_SetSoundMode(sdm_PC);
\r
1173 CA_LoadAllSounds();
\r
1179 if (SoundMode!=sdm_AdLib)
\r
1181 SD_WaitSoundDone();
\r
1182 SD_SetSoundMode(sdm_AdLib);
\r
1183 CA_LoadAllSounds();
\r
1190 // DIGITIZED SOUND
\r
1193 if (DigiMode!=sds_Off)
\r
1195 SD_SetDigiDevice(sds_Off);
\r
1200 if (DigiMode!=sds_SoundSource)
\r
1202 SD_SetDigiDevice(sds_SoundSource);
\r
1208 if (DigiMode!=sds_SoundBlaster)
\r
1210 SD_SetDigiDevice(sds_SoundBlaster);
\r
1220 if (MusicMode!=smm_Off)
\r
1222 SD_SetMusicMode(smm_Off);
\r
1228 if (MusicMode!=smm_AdLib)
\r
1230 SD_SetMusicMode(smm_AdLib);
\r
1233 StartCPMusic(MENUSONG);
\r
1237 } while(which>=0);
\r
1242 UnCacheLump (SOUND_LUMP_START,SOUND_LUMP_END);
\r
1243 CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1248 //////////////////////
\r
1250 // DRAW THE SOUND MENU
\r
1252 void DrawSoundMenu(void)
\r
1258 CA_CacheScreen(S_SOUNDPIC);
\r
1261 // DRAW SOUND MENU
\r
1264 VWB_DrawPic(112,184,C_MOUSELBACKPIC);
\r
1266 DrawWindow(SM_X-8,SM_Y1-3,SM_W,SM_H1,BKGDCOLOR);
\r
1267 DrawWindow(SM_X-8,SM_Y2-3,SM_W,SM_H2,BKGDCOLOR);
\r
1268 DrawWindow(SM_X-8,SM_Y3-3,SM_W,SM_H3,BKGDCOLOR);
\r
1272 // IF NO ADLIB, NON-CHOOSENESS!
\r
1274 if (!AdLibPresent && !SoundBlasterPresent)
\r
1276 SndMenu[2].active=SndMenu[10].active=SndMenu[11].active=0;
\r
1279 if (!SoundSourcePresent)
\r
1280 SndMenu[6].active=0;
\r
1282 if (!SoundBlasterPresent)
\r
1283 SndMenu[7].active=0;
\r
1285 if (!SoundSourcePresent && !SoundBlasterPresent)
\r
1286 SndMenu[5].active=0;
\r
1288 DrawMenu(&SndItems,&SndMenu[0]);
\r
1290 VWB_DrawPic(100,SM_Y1-20,C_FXTITLEPIC);
\r
1291 VWB_DrawPic(100,SM_Y2-20,C_DIGITITLEPIC);
\r
1292 VWB_DrawPic(100,SM_Y3-20,C_MUSICTITLEPIC);
\r
1295 for (i=0;i<SndItems.amount;i++)
\r
1297 if (i!=3 && i!=4 && i!=8 && i!=9)
\r
1299 if (SndMenu[i].string[0])
\r
1303 // DRAW SELECTED/NOT SELECTED GRAPHIC BUTTONS
\r
1311 case 0: if (SoundMode==sdm_Off) on=1; break;
\r
1312 case 1: if (SoundMode==sdm_PC) on=1; break;
\r
1313 case 2: if (SoundMode==sdm_AdLib) on=1; break;
\r
1316 // DIGITIZED SOUND
\r
1318 case 5: if (DigiMode==sds_Off) on=1; break;
\r
1319 case 6: if (DigiMode==sds_SoundSource) on=1; break;
\r
1320 case 7: if (DigiMode==sds_SoundBlaster) on=1; break;
\r
1325 case 10: if (MusicMode==smm_Off) on=1; break;
\r
1326 case 11: if (MusicMode==smm_AdLib) on=1; break;
\r
1330 VWB_DrawPic(SM_X+24,SM_Y1+i*13+2,C_SELECTEDPIC);
\r
1332 VWB_DrawPic(SM_X+24,SM_Y1+i*13+2,C_NOTSELECTEDPIC);
\r
1335 DrawMenuGun(&SndItems);
\r
1336 VW_UpdateScreen();
\r
1341 // DRAW LOAD/SAVE IN PROGRESS
\r
1343 void DrawLSAction(int which)
\r
1350 DrawWindow(LSA_X,LSA_Y,LSA_W,LSA_H,TEXTCOLOR);
\r
1351 DrawOutline(LSA_X,LSA_Y,LSA_W,LSA_H,0,HIGHLIGHT);
\r
1352 VWB_DrawPic(LSA_X+8,LSA_Y+5,C_DISKLOADING1PIC);
\r
1355 SETFONTCOLOR(0,TEXTCOLOR);
\r
1360 US_Print(STR_LOADING"...");
\r
1362 US_Print(STR_SAVING"...");
\r
1364 VW_UpdateScreen();
\r
1368 ////////////////////////////////////////////////////////////////////
\r
1370 // LOAD SAVED GAMES
\r
1372 ////////////////////////////////////////////////////////////////////
\r
1373 int CP_LoadGame(int quick)
\r
1375 int handle,which,exit=0;
\r
1379 strcpy(name,SaveName);
\r
1386 which=LSItems.curpos;
\r
1388 if (SaveGamesAvail[which])
\r
1390 name[7]=which+'0';
\r
1391 handle=open(name,O_BINARY);
\r
1392 lseek(handle,32,SEEK_SET);
\r
1394 LoadTheGame(handle,0,0);
\r
1412 UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1413 CacheLump (LOADSAVE_LUMP_START,LOADSAVE_LUMP_END);
\r
1416 DrawLoadSaveScreen(0);
\r
1420 which=HandleMenu(&LSItems,&LSMenu[0],TrackWhichGame);
\r
1421 if (which>=0 && SaveGamesAvail[which])
\r
1424 name[7]=which+'0';
\r
1426 handle=open(name,O_BINARY);
\r
1427 lseek(handle,32,SEEK_SET);
\r
1432 LoadTheGame(handle,LSA_X+8,LSA_Y+5);
\r
1438 // CHANGE "READ THIS!" TO NORMAL COLOR
\r
1443 MainMenu[readthis].active=1;
\r
1451 } while(which>=0);
\r
1456 UnCacheLump (LOADSAVE_LUMP_START,LOADSAVE_LUMP_END);
\r
1457 CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1464 ///////////////////////////////////
\r
1466 // HIGHLIGHT CURRENT SELECTED ENTRY
\r
1468 void TrackWhichGame(int w)
\r
1470 static int lastgameon=0;
\r
1472 PrintLSEntry(lastgameon,TEXTCOLOR);
\r
1473 PrintLSEntry(w,HIGHLIGHT);
\r
1479 ////////////////////////////
\r
1481 // DRAW THE LOAD/SAVE SCREEN
\r
1483 void DrawLoadSaveScreen(int loadsave)
\r
1493 VWB_DrawPic(112,184,C_MOUSELBACKPIC);
\r
1494 DrawWindow(LSM_X-10,LSM_Y-5,LSM_W,LSM_H,BKGDCOLOR);
\r
1498 VWB_DrawPic(60,0,C_LOADGAMEPIC);
\r
1500 VWB_DrawPic(60,0,C_SAVEGAMEPIC);
\r
1502 for (i=0;i<10;i++)
\r
1503 PrintLSEntry(i,TEXTCOLOR);
\r
1505 DrawMenu(&LSItems,&LSMenu[0]);
\r
1506 VW_UpdateScreen();
\r
1512 ///////////////////////////////////////////
\r
1514 // PRINT LOAD/SAVE GAME ENTRY W/BOX OUTLINE
\r
1516 void PrintLSEntry(int w,int color)
\r
1518 SETFONTCOLOR(color,BKGDCOLOR);
\r
1519 DrawOutline(LSM_X+LSItems.indent,LSM_Y+w*13,LSM_W-LSItems.indent-15,11,color,color);
\r
1520 PrintX=LSM_X+LSItems.indent+2;
\r
1521 PrintY=LSM_Y+w*13+1;
\r
1524 if (SaveGamesAvail[w])
\r
1525 US_Print(SaveGameNames[w]);
\r
1527 US_Print(" - "STR_EMPTY" -");
\r
1533 ////////////////////////////////////////////////////////////////////
\r
1535 // SAVE CURRENT GAME
\r
1537 ////////////////////////////////////////////////////////////////////
\r
1538 int CP_SaveGame(int quick)
\r
1540 int handle,which,exit=0;
\r
1541 unsigned nwritten;
\r
1542 char name[13],input[32];
\r
1545 strcpy(name,SaveName);
\r
1552 which=LSItems.curpos;
\r
1554 if (SaveGamesAvail[which])
\r
1556 name[7]=which+'0';
\r
1558 handle=creat(name,S_IREAD|S_IWRITE);
\r
1560 strcpy(input,&SaveGameNames[which][0]);
\r
1562 _dos_write(handle,(void far *)input,32,&nwritten);
\r
1563 lseek(handle,32,SEEK_SET);
\r
1564 SaveTheGame(handle,0,0);
\r
1573 UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1574 CacheLump (LOADSAVE_LUMP_START,LOADSAVE_LUMP_END);
\r
1577 DrawLoadSaveScreen(1);
\r
1581 which=HandleMenu(&LSItems,&LSMenu[0],TrackWhichGame);
\r
1585 // OVERWRITE EXISTING SAVEGAME?
\r
1587 if (SaveGamesAvail[which])
\r
1589 if (!GetYorN(7,8,C_JAPSAVEOVERPIC))
\r
1591 if (!Confirm(GAMESVD))
\r
1594 DrawLoadSaveScreen(1);
\r
1599 DrawLoadSaveScreen(1);
\r
1600 PrintLSEntry(which,HIGHLIGHT);
\r
1601 VW_UpdateScreen();
\r
1606 strcpy(input,&SaveGameNames[which][0]);
\r
1607 name[7]=which+'0';
\r
1610 if (!SaveGamesAvail[which])
\r
1611 VWB_Bar(LSM_X+LSItems.indent+1,LSM_Y+which*13+1,LSM_W-LSItems.indent-16,10,BKGDCOLOR);
\r
1612 VW_UpdateScreen();
\r
1614 if (US_LineInput(LSM_X+LSItems.indent+2,LSM_Y+which*13+1,input,input,true,31,LSM_W-LSItems.indent-30))
\r
1616 SaveGamesAvail[which]=1;
\r
1617 strcpy(&SaveGameNames[which][0],input);
\r
1620 handle=creat(name,S_IREAD|S_IWRITE);
\r
1621 _dos_write(handle,(void far *)input,32,&nwritten);
\r
1622 lseek(handle,32,SEEK_SET);
\r
1625 SaveTheGame(handle,LSA_X+8,LSA_Y+5);
\r
1634 VWB_Bar(LSM_X+LSItems.indent+1,LSM_Y+which*13+1,LSM_W-LSItems.indent-16,10,BKGDCOLOR);
\r
1635 PrintLSEntry(which,HIGHLIGHT);
\r
1636 VW_UpdateScreen();
\r
1637 SD_PlaySound(ESCPRESSEDSND);
\r
1645 } while(which>=0);
\r
1650 UnCacheLump (LOADSAVE_LUMP_START,LOADSAVE_LUMP_END);
\r
1651 CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1658 ////////////////////////////////////////////////////////////////////
\r
1660 // CALIBRATE JOYSTICK
\r
1662 ////////////////////////////////////////////////////////////////////
\r
1663 int CalibrateJoystick(void)
\r
1670 unsigned xmin,ymin,xmax,ymax,jb;
\r
1675 VWB_DrawPic(CALX,CALY,C_JOY0PIC);
\r
1677 DrawWindow(CALX-5,CALY-5,CALW,CALH,TEXTCOLOR);
\r
1678 DrawOutline(CALX-5,CALY-5,CALW,CALH,0,HIGHLIGHT);
\r
1679 SETFONTCOLOR(0,TEXTCOLOR);
\r
1681 WindowX = PrintX = CALX;
\r
1684 WindowY = PrintY = CALY;
\r
1685 US_Print(" "STR_CALIB"\n "STR_JOYST"\n");
\r
1686 VWB_DrawPic(CALX+40,CALY+30,C_JOY1PIC);
\r
1688 US_Print(STR_MOVEJOY);
\r
1689 SETFONTCOLOR(BKGDCOLOR,TEXTCOLOR);
\r
1690 US_Print(" "STR_ESCEXIT);
\r
1692 VW_UpdateScreen();
\r
1696 jb=IN_JoyButtons();
\r
1697 if (Keyboard[sc_Escape])
\r
1700 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))
\r
1706 SD_PlaySound(SHOOTSND);
\r
1707 IN_GetJoyAbs(joystickport,&xmin,&ymin);
\r
1711 VWB_DrawPic(CALX,CALY,C_JOY1PIC);
\r
1713 DrawWindow(CALX-5,CALY-5,CALW,CALH,TEXTCOLOR);
\r
1714 DrawOutline(CALX-5,CALY-5,CALW,CALH,0,HIGHLIGHT);
\r
1715 SETFONTCOLOR(0,TEXTCOLOR);
\r
1719 US_Print(" "STR_CALIB"\n "STR_JOYST"\n");
\r
1720 VWB_DrawPic(CALX+40,CALY+30,C_JOY2PIC);
\r
1722 US_Print(STR_MOVEJOY2);
\r
1723 SETFONTCOLOR(BKGDCOLOR,TEXTCOLOR);
\r
1724 US_Print(" "STR_ESCEXIT);
\r
1726 VW_UpdateScreen();
\r
1730 jb=IN_JoyButtons();
\r
1731 if (Keyboard[sc_Escape])
\r
1734 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))
\r
1739 IN_GetJoyAbs(joystickport,&xmax,&ymax);
\r
1740 SD_PlaySound(SHOOTSND);
\r
1742 while (IN_JoyButtons());
\r
1745 // ASSIGN ACTUAL VALUES HERE
\r
1747 if ((xmin != xmax) && (ymin != ymax))
\r
1748 IN_SetupJoy(joystickport,xmin,xmax,ymin,ymax);
\r
1756 ////////////////////////////////////////////////////////////////////
\r
1758 // DEFINE CONTROLS
\r
1760 ////////////////////////////////////////////////////////////////////
\r
1761 void CP_Control(void)
\r
1763 #define CTL_SPC 70
\r
1764 enum {MOUSEENABLE,JOYENABLE,USEPORT2,PADENABLE,MOUSESENS,CUSTOMIZE};
\r
1769 UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1770 CacheLump (CONTROL_LUMP_START,CONTROL_LUMP_END);
\r
1779 which=HandleMenu(&CtlItems,&CtlMenu[0],NULL);
\r
1787 CusItems.curpos=-1;
\r
1792 joystickenabled^=1;
\r
1793 if (joystickenabled)
\r
1794 if (!CalibrateJoystick())
\r
1795 joystickenabled = 0;
\r
1797 CusItems.curpos=-1;
\r
1820 } while(which>=0);
\r
1825 UnCacheLump (CONTROL_LUMP_START,CONTROL_LUMP_END);
\r
1826 CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1831 ////////////////////////////////
\r
1833 // DRAW MOUSE SENSITIVITY SCREEN
\r
1835 void DrawMouseSens(void)
\r
1838 CA_CacheScreen(S_MOUSESENSPIC);
\r
1841 VWB_DrawPic(112,184,C_MOUSELBACKPIC);
\r
1843 DrawWindow(10,80,300,43,BKGDCOLOR);
\r
1845 DrawWindow(10,80,300,30,BKGDCOLOR);
\r
1851 SETFONTCOLOR(READCOLOR,BKGDCOLOR);
\r
1852 US_CPrint(STR_MOUSEADJ);
\r
1854 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
1858 US_Print(STR_SLOW);
\r
1860 US_Print(STR_FAST);
\r
1864 US_Print(STR_SLOW);
\r
1866 US_Print(STR_FAST);
\r
1870 VWB_Bar(60,97,200,10,TEXTCOLOR);
\r
1871 DrawOutline(60,97,200,10,0,HIGHLIGHT);
\r
1872 DrawOutline(60+20*mouseadjustment,97,20,10,0,READCOLOR);
\r
1873 VWB_Bar(61+20*mouseadjustment,98,19,9,READHCOLOR);
\r
1875 VW_UpdateScreen();
\r
1880 ///////////////////////////
\r
1882 // ADJUST MOUSE SENSITIVITY
\r
1884 void MouseSensitivity(void)
\r
1890 oldMA=mouseadjustment;
\r
1894 ReadAnyControl(&ci);
\r
1899 if (mouseadjustment)
\r
1901 mouseadjustment--;
\r
1902 VWB_Bar(60,97,200,10,TEXTCOLOR);
\r
1903 DrawOutline(60,97,200,10,0,HIGHLIGHT);
\r
1904 DrawOutline(60+20*mouseadjustment,97,20,10,0,READCOLOR);
\r
1905 VWB_Bar(61+20*mouseadjustment,98,19,9,READHCOLOR);
\r
1906 VW_UpdateScreen();
\r
1907 SD_PlaySound(MOVEGUN1SND);
\r
1908 while(Keyboard[sc_LeftArrow]);
\r
1915 if (mouseadjustment<9)
\r
1917 mouseadjustment++;
\r
1918 VWB_Bar(60,97,200,10,TEXTCOLOR);
\r
1919 DrawOutline(60,97,200,10,0,HIGHLIGHT);
\r
1920 DrawOutline(60+20*mouseadjustment,97,20,10,0,READCOLOR);
\r
1921 VWB_Bar(61+20*mouseadjustment,98,19,9,READHCOLOR);
\r
1922 VW_UpdateScreen();
\r
1923 SD_PlaySound(MOVEGUN1SND);
\r
1924 while(Keyboard[sc_RightArrow]);
\r
1931 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))
\r
1933 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("debugmode"))
\r
1937 if (ci.button0 || Keyboard[sc_Space] || Keyboard[sc_Enter])
\r
1940 if (ci.button1 || Keyboard[sc_Escape])
\r
1947 mouseadjustment=oldMA;
\r
1948 SD_PlaySound(ESCPRESSEDSND);
\r
1951 SD_PlaySound(SHOOTSND);
\r
1958 ///////////////////////////
\r
1960 // DRAW CONTROL MENU SCREEN
\r
1962 void DrawCtlScreen(void)
\r
1968 CA_CacheScreen(S_CONTROLPIC);
\r
1972 VWB_DrawPic(80,0,C_CONTROLPIC);
\r
1973 VWB_DrawPic(112,184,C_MOUSELBACKPIC);
\r
1974 DrawWindow(CTL_X-8,CTL_Y-5,CTL_W,CTL_H,BKGDCOLOR);
\r
1978 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
1980 if (JoysPresent[0])
\r
1981 CtlMenu[1].active=
\r
1982 CtlMenu[2].active=
\r
1983 CtlMenu[3].active=1;
\r
1985 CtlMenu[2].active=CtlMenu[3].active=joystickenabled;
\r
1989 CtlMenu[4].active=
\r
1990 CtlMenu[0].active=1;
\r
1993 CtlMenu[4].active=mouseenabled;
\r
1996 DrawMenu(&CtlItems,&CtlMenu[0]);
\r
1999 x=CTL_X+CtlItems.indent-24;
\r
2002 VWB_DrawPic(x,y,C_SELECTEDPIC);
\r
2004 VWB_DrawPic(x,y,C_NOTSELECTEDPIC);
\r
2007 if (joystickenabled)
\r
2008 VWB_DrawPic(x,y,C_SELECTEDPIC);
\r
2010 VWB_DrawPic(x,y,C_NOTSELECTEDPIC);
\r
2014 VWB_DrawPic(x,y,C_SELECTEDPIC);
\r
2016 VWB_DrawPic(x,y,C_NOTSELECTEDPIC);
\r
2019 if (joypadenabled)
\r
2020 VWB_DrawPic(x,y,C_SELECTEDPIC);
\r
2022 VWB_DrawPic(x,y,C_NOTSELECTEDPIC);
\r
2025 // PICK FIRST AVAILABLE SPOT
\r
2027 if (CtlItems.curpos<0 || !CtlMenu[CtlItems.curpos].active)
\r
2029 if (CtlMenu[i].active)
\r
2031 CtlItems.curpos=i;
\r
2035 DrawMenuGun(&CtlItems);
\r
2036 VW_UpdateScreen();
\r
2040 ////////////////////////////////////////////////////////////////////
\r
2042 // CUSTOMIZE CONTROLS
\r
2044 ////////////////////////////////////////////////////////////////////
\r
2045 enum {FIRE,STRAFE,RUN,OPEN};
\r
2046 char mbarray[4][3]={"b0","b1","b2","b3"},
\r
2047 order[4]={RUN,OPEN,FIRE,STRAFE};
\r
2050 void CustomControls(void)
\r
2055 DrawCustomScreen();
\r
2058 which=HandleMenu(&CusItems,&CusMenu[0],FixupCustom);
\r
2062 DefineMouseBtns();
\r
2077 } while(which>=0);
\r
2085 ////////////////////////
\r
2087 // DEFINE THE MOUSE BUTTONS
\r
2089 void DefineMouseBtns(void)
\r
2091 CustomCtrls mouseallowed={0,1,1,1};
\r
2092 EnterCtrlData(2,&mouseallowed,DrawCustMouse,PrintCustMouse,MOUSE);
\r
2096 ////////////////////////
\r
2098 // DEFINE THE JOYSTICK BUTTONS
\r
2100 void DefineJoyBtns(void)
\r
2102 CustomCtrls joyallowed={1,1,1,1};
\r
2103 EnterCtrlData(5,&joyallowed,DrawCustJoy,PrintCustJoy,JOYSTICK);
\r
2107 ////////////////////////
\r
2109 // DEFINE THE KEYBOARD BUTTONS
\r
2111 void DefineKeyBtns(void)
\r
2113 CustomCtrls keyallowed={1,1,1,1};
\r
2114 EnterCtrlData(8,&keyallowed,DrawCustKeybd,PrintCustKeybd,KEYBOARDBTNS);
\r
2118 ////////////////////////
\r
2120 // DEFINE THE KEYBOARD BUTTONS
\r
2122 void DefineKeyMove(void)
\r
2124 CustomCtrls keyallowed={1,1,1,1};
\r
2125 EnterCtrlData(10,&keyallowed,DrawCustKeys,PrintCustKeys,KEYBOARDMOVE);
\r
2129 ////////////////////////
\r
2131 // ENTER CONTROL DATA FOR ANY TYPE OF CONTROL
\r
2133 enum {FWRD,RIGHT,BKWD,LEFT};
\r
2134 int moveorder[4]={LEFT,RIGHT,FWRD,BKWD};
\r
2136 void EnterCtrlData(int index,CustomCtrls *cust,void (*DrawRtn)(int),void (*PrintRtn)(int),int type)
\r
2138 int j,exit,tick,redraw,which,x,picked;
\r
2143 PrintY=CST_Y+13*index;
\r
2144 IN_ClearKeysDown();
\r
2148 // FIND FIRST SPOT IN ALLOWED ARRAY
\r
2151 if (cust->allowed[j])
\r
2161 x=CST_START+CST_SPC*which;
\r
2162 DrawWindow(5,PrintY-1,310,13,BKGDCOLOR);
\r
2165 DrawWindow(x-2,PrintY,CST_SPC,11,TEXTCOLOR);
\r
2166 DrawOutline(x-2,PrintY,CST_SPC,11,0,HIGHLIGHT);
\r
2167 SETFONTCOLOR(0,TEXTCOLOR);
\r
2170 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
2171 VW_UpdateScreen();
\r
2176 ReadAnyControl(&ci);
\r
2178 if (type==MOUSE || type==JOYSTICK)
\r
2179 if (IN_KeyDown(sc_Enter)||IN_KeyDown(sc_Control)||IN_KeyDown(sc_Alt))
\r
2181 IN_ClearKeysDown();
\r
2182 ci.button0=ci.button1=false;
\r
2186 // CHANGE BUTTON VALUE?
\r
2188 if ((ci.button0|ci.button1|ci.button2|ci.button3)||
\r
2189 ((type==KEYBOARDBTNS||type==KEYBOARDMOVE) && LastScan==sc_Enter))
\r
2191 tick=TimeCount=picked=0;
\r
2192 SETFONTCOLOR(0,TEXTCOLOR);
\r
2196 int button,result=0;
\r
2199 if (type==KEYBOARDBTNS||type==KEYBOARDMOVE)
\r
2200 IN_ClearKeysDown();
\r
2210 VWB_Bar(x,PrintY+1,CST_SPC-2,10,TEXTCOLOR);
\r
2215 SD_PlaySound(HITWALLSND);
\r
2219 VW_UpdateScreen();
\r
2223 // WHICH TYPE OF INPUT DO WE PROCESS?
\r
2232 case 1: result=1; break;
\r
2233 case 2: result=2; break;
\r
2234 case 4: result=3; break;
\r
2243 if (order[which]==buttonmouse[z])
\r
2245 buttonmouse[z]=bt_nobutton;
\r
2249 buttonmouse[result-1]=order[which];
\r
2251 SD_PlaySound(SHOOTDOORSND);
\r
2256 if (ci.button0) result=1;
\r
2258 if (ci.button1) result=2;
\r
2260 if (ci.button2) result=3;
\r
2262 if (ci.button3) result=4;
\r
2270 if (order[which]==buttonjoy[z])
\r
2272 buttonjoy[z]=bt_nobutton;
\r
2276 buttonjoy[result-1]=order[which];
\r
2278 SD_PlaySound(SHOOTDOORSND);
\r
2282 case KEYBOARDBTNS:
\r
2285 buttonscan[order[which]]=LastScan;
\r
2288 IN_ClearKeysDown();
\r
2292 case KEYBOARDMOVE:
\r
2295 dirscan[moveorder[which]]=LastScan;
\r
2298 IN_ClearKeysDown();
\r
2306 if (IN_KeyDown(sc_Escape))
\r
2314 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
2320 if (ci.button1 || IN_KeyDown(sc_Escape))
\r
2324 // MOVE TO ANOTHER SPOT?
\r
2334 } while(!cust->allowed[which]);
\r
2336 SD_PlaySound(MOVEGUN1SND);
\r
2337 while(ReadAnyControl(&ci),ci.dir!=dir_None);
\r
2338 IN_ClearKeysDown();
\r
2347 } while(!cust->allowed[which]);
\r
2349 SD_PlaySound(MOVEGUN1SND);
\r
2350 while(ReadAnyControl(&ci),ci.dir!=dir_None);
\r
2351 IN_ClearKeysDown();
\r
2359 SD_PlaySound(ESCPRESSEDSND);
\r
2361 DrawWindow(5,PrintY-1,310,13,BKGDCOLOR);
\r
2365 ////////////////////////
\r
2367 // FIXUP GUN CURSOR OVERDRAW SHIT
\r
2369 void FixupCustom(int w)
\r
2371 static int lastwhich=-1;
\r
2372 int y=CST_Y+26+w*13;
\r
2375 VWB_Hlin(7,32,y-1,DEACTIVE);
\r
2376 VWB_Hlin(7,32,y+12,BORD2COLOR);
\r
2378 VWB_Hlin(7,32,y-2,BORDCOLOR);
\r
2379 VWB_Hlin(7,32,y+13,BORDCOLOR);
\r
2381 VWB_Hlin(7,32,y-2,BORD2COLOR);
\r
2382 VWB_Hlin(7,32,y+13,BORD2COLOR);
\r
2387 case 0: DrawCustMouse(1); break;
\r
2388 case 3: DrawCustJoy(1); break;
\r
2389 case 6: DrawCustKeybd(1); break;
\r
2390 case 8: DrawCustKeys(1);
\r
2396 y=CST_Y+26+lastwhich*13;
\r
2397 VWB_Hlin(7,32,y-1,DEACTIVE);
\r
2398 VWB_Hlin(7,32,y+12,BORD2COLOR);
\r
2400 VWB_Hlin(7,32,y-2,BORDCOLOR);
\r
2401 VWB_Hlin(7,32,y+13,BORDCOLOR);
\r
2403 VWB_Hlin(7,32,y-2,BORD2COLOR);
\r
2404 VWB_Hlin(7,32,y+13,BORD2COLOR);
\r
2410 case 0: DrawCustMouse(0); break;
\r
2411 case 3: DrawCustJoy(0); break;
\r
2412 case 6: DrawCustKeybd(0); break;
\r
2413 case 8: DrawCustKeys(0);
\r
2421 ////////////////////////
\r
2423 // DRAW CUSTOMIZE SCREEN
\r
2425 void DrawCustomScreen(void)
\r
2431 CA_CacheScreen(S_CUSTOMPIC);
\r
2435 PrintY = CST_Y+26;
\r
2439 US_Print("\n\n\n");
\r
2443 US_Print("\n\n\n");
\r
2447 US_Print("\n\n\n");
\r
2453 VWB_DrawPic(112,184,C_MOUSELBACKPIC);
\r
2455 VWB_DrawPic(80,0,C_CUSTOMIZEPIC);
\r
2460 SETFONTCOLOR(READCOLOR,BKGDCOLOR);
\r
2466 US_CPrint("Mouse\n");
\r
2468 PrintY = CST_Y+13;
\r
2469 VWB_DrawPic (128,48,C_MOUSEPIC);
\r
2472 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
2474 PrintX=CST_START-16;
\r
2475 US_Print(STR_CRUN);
\r
2476 PrintX=CST_START-16+CST_SPC*1;
\r
2477 US_Print(STR_COPEN);
\r
2478 PrintX=CST_START-16+CST_SPC*2;
\r
2479 US_Print(STR_CFIRE);
\r
2480 PrintX=CST_START-16+CST_SPC*3;
\r
2481 US_Print(STR_CSTRAFE"\n");
\r
2484 US_Print(STR_CRUN);
\r
2485 PrintX=CST_START+CST_SPC*1;
\r
2486 US_Print(STR_COPEN);
\r
2487 PrintX=CST_START+CST_SPC*2;
\r
2488 US_Print(STR_CFIRE);
\r
2489 PrintX=CST_START+CST_SPC*3;
\r
2490 US_Print(STR_CSTRAFE"\n");
\r
2493 DrawWindow(5,PrintY-1,310,13,BKGDCOLOR);
\r
2502 SETFONTCOLOR(READCOLOR,BKGDCOLOR);
\r
2503 US_CPrint("Joystick/Gravis GamePad\n");
\r
2506 VWB_DrawPic (40,88,C_JOYSTICKPIC);
\r
2510 VWB_DrawPic (112,120,C_KEYBOARDPIC);
\r
2513 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
2515 PrintX=CST_START-16;
\r
2516 US_Print(STR_CRUN);
\r
2517 PrintX=CST_START-16+CST_SPC*1;
\r
2518 US_Print(STR_COPEN);
\r
2519 PrintX=CST_START-16+CST_SPC*2;
\r
2520 US_Print(STR_CFIRE);
\r
2521 PrintX=CST_START-16+CST_SPC*3;
\r
2522 US_Print(STR_CSTRAFE"\n");
\r
2525 US_Print(STR_CRUN);
\r
2526 PrintX=CST_START+CST_SPC*1;
\r
2527 US_Print(STR_COPEN);
\r
2528 PrintX=CST_START+CST_SPC*2;
\r
2529 US_Print(STR_CFIRE);
\r
2530 PrintX=CST_START+CST_SPC*3;
\r
2531 US_Print(STR_CSTRAFE"\n");
\r
2533 DrawWindow(5,PrintY-1,310,13,BKGDCOLOR);
\r
2542 SETFONTCOLOR(READCOLOR,BKGDCOLOR);
\r
2543 US_CPrint("Keyboard\n");
\r
2547 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
2549 PrintX=CST_START-16;
\r
2550 US_Print(STR_CRUN);
\r
2551 PrintX=CST_START-16+CST_SPC*1;
\r
2552 US_Print(STR_COPEN);
\r
2553 PrintX=CST_START-16+CST_SPC*2;
\r
2554 US_Print(STR_CFIRE);
\r
2555 PrintX=CST_START-16+CST_SPC*3;
\r
2556 US_Print(STR_CSTRAFE"\n");
\r
2559 US_Print(STR_CRUN);
\r
2560 PrintX=CST_START+CST_SPC*1;
\r
2561 US_Print(STR_COPEN);
\r
2562 PrintX=CST_START+CST_SPC*2;
\r
2563 US_Print(STR_CFIRE);
\r
2564 PrintX=CST_START+CST_SPC*3;
\r
2565 US_Print(STR_CSTRAFE"\n");
\r
2567 DrawWindow(5,PrintY-1,310,13,BKGDCOLOR);
\r
2573 // KEYBOARD MOVE KEYS
\r
2575 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
2578 US_Print(STR_LEFT);
\r
2580 US_Print(STR_RIGHT);
\r
2582 US_Print(STR_FRWD);
\r
2584 US_Print(STR_BKWD"\n");
\r
2587 US_Print(STR_LEFT);
\r
2588 PrintX=CST_START+CST_SPC*1;
\r
2589 US_Print(STR_RIGHT);
\r
2590 PrintX=CST_START+CST_SPC*2;
\r
2591 US_Print(STR_FRWD);
\r
2592 PrintX=CST_START+CST_SPC*3;
\r
2593 US_Print(STR_BKWD"\n");
\r
2595 DrawWindow(5,PrintY-1,310,13,BKGDCOLOR);
\r
2599 // PICK STARTING POINT IN MENU
\r
2601 if (CusItems.curpos<0)
\r
2602 for (i=0;i<CusItems.amount;i++)
\r
2603 if (CusMenu[i].active)
\r
2605 CusItems.curpos=i;
\r
2610 VW_UpdateScreen();
\r
2615 void PrintCustMouse(int i)
\r
2620 if (order[i]==buttonmouse[j])
\r
2622 PrintX=CST_START+CST_SPC*i;
\r
2623 US_Print(mbarray[j]);
\r
2628 void DrawCustMouse(int hilight)
\r
2636 SETFONTCOLOR(color,BKGDCOLOR);
\r
2638 if (!mouseenabled)
\r
2640 SETFONTCOLOR(DEACTIVE,BKGDCOLOR);
\r
2641 CusMenu[0].active=0;
\r
2644 CusMenu[0].active=1;
\r
2646 PrintY=CST_Y+13*2;
\r
2648 PrintCustMouse(i);
\r
2651 void PrintCustJoy(int i)
\r
2656 if (order[i]==buttonjoy[j])
\r
2658 PrintX=CST_START+CST_SPC*i;
\r
2659 US_Print(mbarray[j]);
\r
2664 void DrawCustJoy(int hilight)
\r
2672 SETFONTCOLOR(color,BKGDCOLOR);
\r
2674 if (!joystickenabled)
\r
2676 SETFONTCOLOR(DEACTIVE,BKGDCOLOR);
\r
2677 CusMenu[3].active=0;
\r
2680 CusMenu[3].active=1;
\r
2682 PrintY=CST_Y+13*5;
\r
2688 void PrintCustKeybd(int i)
\r
2690 PrintX=CST_START+CST_SPC*i;
\r
2691 US_Print(IN_GetScanName(buttonscan[order[i]]));
\r
2694 void DrawCustKeybd(int hilight)
\r
2702 SETFONTCOLOR(color,BKGDCOLOR);
\r
2704 PrintY=CST_Y+13*8;
\r
2706 PrintCustKeybd(i);
\r
2709 void PrintCustKeys(int i)
\r
2711 PrintX=CST_START+CST_SPC*i;
\r
2712 US_Print(IN_GetScanName(dirscan[moveorder[i]]));
\r
2715 void DrawCustKeys(int hilight)
\r
2723 SETFONTCOLOR(color,BKGDCOLOR);
\r
2725 PrintY=CST_Y+13*10;
\r
2731 ////////////////////////////////////////////////////////////////////
\r
2733 // CHANGE SCREEN VIEWING SIZE
\r
2735 ////////////////////////////////////////////////////////////////////
\r
2736 void CP_ChangeView(void)
\r
2738 int exit=0,oldview,newview;
\r
2742 WindowX=WindowY=0;
\r
2745 newview=oldview=viewwidth/16;
\r
2746 DrawChangeView(oldview);
\r
2751 ReadAnyControl(&ci);
\r
2759 ShowViewSize(newview);
\r
2760 VW_UpdateScreen();
\r
2761 SD_PlaySound(HITWALLSND);
\r
2770 ShowViewSize(newview);
\r
2771 VW_UpdateScreen();
\r
2772 SD_PlaySound(HITWALLSND);
\r
2778 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))
\r
2780 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("debugmode"))
\r
2784 if (ci.button0 || Keyboard[sc_Enter])
\r
2787 if (ci.button1 || Keyboard[sc_Escape])
\r
2789 viewwidth=oldview*16;
\r
2790 SD_PlaySound(ESCPRESSEDSND);
\r
2798 if (oldview!=newview)
\r
2800 SD_PlaySound (SHOOTSND);
\r
2801 Message(STR_THINK"...");
\r
2802 NewViewSize(newview);
\r
2810 /////////////////////////////
\r
2812 // DRAW THE CHANGEVIEW SCREEN
\r
2814 void DrawChangeView(int view)
\r
2817 CA_CacheScreen(S_CHANGEPIC);
\r
2819 ShowViewSize(view);
\r
2821 VWB_Bar(0,160,320,40,VIEWCOLOR);
\r
2822 ShowViewSize(view);
\r
2827 SETFONTCOLOR(HIGHLIGHT,BKGDCOLOR);
\r
2829 US_CPrint(STR_SIZE1"\n");
\r
2830 US_CPrint(STR_SIZE2"\n");
\r
2831 US_CPrint(STR_SIZE3);
\r
2833 VW_UpdateScreen();
\r
2839 ////////////////////////////////////////////////////////////////////
\r
2841 // QUIT THIS INFERNAL GAME!
\r
2843 ////////////////////////////////////////////////////////////////////
\r
2844 void CP_Quit(void)
\r
2850 if (GetYorN(7,11,C_QUITMSGPIC))
\r
2854 if (Confirm(ENDGAMESTR))
\r
2856 if (Confirm(endStrings[US_RndT()&0x7+(US_RndT()&1)]))
\r
2861 VW_UpdateScreen();
\r
2866 // SHUT-UP THE ADLIB
\r
2868 for (i=1;i<=0xf5;i++)
\r
2877 ////////////////////////////////////////////////////////////////////
\r
2879 // HANDLE INTRO SCREEN (SYSTEM CONFIG)
\r
2881 ////////////////////////////////////////////////////////////////////
\r
2882 void IntroScreen(void)
\r
2886 #define MAINCOLOR 0x4f
\r
2887 #define EMSCOLOR 0x4f
\r
2888 #define XMSCOLOR 0x4f
\r
2892 #define MAINCOLOR 0x6c
\r
2893 #define EMSCOLOR 0x6c
\r
2894 #define XMSCOLOR 0x6c
\r
2897 #define FILLCOLOR 14
\r
2899 long memory,emshere,xmshere;
\r
2900 int i,num,ems[10]={100,200,300,400,500,600,700,800,900,1000},
\r
2901 xms[10]={100,200,300,400,500,600,700,800,900,1000},
\r
2902 main[10]={32,64,96,128,160,192,224,256,288,320};
\r
2906 // DRAW MAIN MEMORY
\r
2908 memory=(1023l+mminfo.nearheap+mminfo.farheap)/1024l;
\r
2909 for (i=0;i<10;i++)
\r
2910 if (memory>=main[i])
\r
2911 VWB_Bar(49,163-8*i,6,5,MAINCOLOR-i);
\r
2915 // DRAW EMS MEMORY
\r
2919 emshere=4l*EMSPagesAvail;
\r
2920 for (i=0;i<10;i++)
\r
2921 if (emshere>=ems[i])
\r
2922 VWB_Bar(89,163-8*i,6,5,EMSCOLOR-i);
\r
2926 // DRAW XMS MEMORY
\r
2930 xmshere=4l*XMSPagesAvail;
\r
2931 for (i=0;i<10;i++)
\r
2932 if (xmshere>=xms[i])
\r
2933 VWB_Bar(129,163-8*i,6,5,XMSCOLOR-i);
\r
2940 VWB_Bar(164,82,12,2,FILLCOLOR);
\r
2942 if (JoysPresent[0] || JoysPresent[1])
\r
2943 VWB_Bar(164,105,12,2,FILLCOLOR);
\r
2945 if (AdLibPresent && !SoundBlasterPresent)
\r
2946 VWB_Bar(164,128,12,2,FILLCOLOR);
\r
2948 if (SoundBlasterPresent)
\r
2949 VWB_Bar(164,151,12,2,FILLCOLOR);
\r
2951 if (SoundSourcePresent)
\r
2952 VWB_Bar(164,174,12,2,FILLCOLOR);
\r
2956 ////////////////////////////////////////////////////////////////////
\r
2957 ////////////////////////////////////////////////////////////////////
\r
2959 // SUPPORT ROUTINES
\r
2961 ////////////////////////////////////////////////////////////////////
\r
2962 ////////////////////////////////////////////////////////////////////
\r
2964 ////////////////////////////////////////////////////////////////////
\r
2966 // Clear Menu screens to dark red
\r
2968 ////////////////////////////////////////////////////////////////////
\r
2969 void ClearMScreen(void)
\r
2972 VWB_Bar(0,0,320,200,BORDCOLOR);
\r
2974 VWB_DrawPic(0,0,C_BACKDROPPIC);
\r
2979 ////////////////////////////////////////////////////////////////////
\r
2981 // Un/Cache a LUMP of graphics
\r
2983 ////////////////////////////////////////////////////////////////////
\r
2984 void CacheLump(int lumpstart,int lumpend)
\r
2988 for (i=lumpstart;i<=lumpend;i++)
\r
2989 CA_CacheGrChunk(i);
\r
2993 void UnCacheLump(int lumpstart,int lumpend)
\r
2997 for (i=lumpstart;i<=lumpend;i++)
\r
2999 UNCACHEGRCHUNK(i);
\r
3003 ////////////////////////////////////////////////////////////////////
\r
3005 // Draw a window for a menu
\r
3007 ////////////////////////////////////////////////////////////////////
\r
3008 void DrawWindow(int x,int y,int w,int h,int wcolor)
\r
3010 VWB_Bar(x,y,w,h,wcolor);
\r
3011 DrawOutline(x,y,w,h,BORD2COLOR,DEACTIVE);
\r
3015 void DrawOutline(int x,int y,int w,int h,int color1,int color2)
\r
3017 VWB_Hlin(x,x+w,y,color2);
\r
3018 VWB_Vlin(y,y+h,x,color2);
\r
3019 VWB_Hlin(x,x+w,y+h,color1);
\r
3020 VWB_Vlin(y,y+h,x+w,color1);
\r
3024 ////////////////////////////////////////////////////////////////////
\r
3026 // Setup Control Panel stuff - graphics, etc.
\r
3028 ////////////////////////////////////////////////////////////////////
\r
3029 void SetupControlPanel(void)
\r
3037 // CACHE GRAPHICS & SOUNDS
\r
3039 CA_CacheGrChunk(STARTFONT+1);
\r
3041 CacheLump(CONTROLS_LUMP_START,CONTROLS_LUMP_END);
\r
3043 CacheLump(BACKDROP_LUMP_START,BACKDROP_LUMP_END);
\r
3046 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
3051 CA_LoadAllSounds();
\r
3053 MainMenu[savegame].active=1;
\r
3056 // SEE WHICH SAVE GAME FILES ARE AVAILABLE & READ STRING IN
\r
3058 strcpy(name,SaveName);
\r
3059 if (!findfirst(name,&f,0))
\r
3062 which=f.ff_name[7]-'0';
\r
3068 SaveGamesAvail[which]=1;
\r
3069 handle=open(f.ff_name,O_BINARY);
\r
3070 read(handle,temp,32);
\r
3072 strcpy(&SaveGameNames[which][0],temp);
\r
3074 } while(!findnext(&f));
\r
3084 ////////////////////////////////////////////////////////////////////
\r
3086 // Clean up all the Control Panel stuff
\r
3088 ////////////////////////////////////////////////////////////////////
\r
3089 void CleanupControlPanel(void)
\r
3092 UnCacheLump(CONTROLS_LUMP_START,CONTROLS_LUMP_END);
\r
3094 UnCacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
\r
3101 ////////////////////////////////////////////////////////////////////
\r
3103 // Handle moving gun around a menu
\r
3105 ////////////////////////////////////////////////////////////////////
\r
3106 int HandleMenu(CP_iteminfo *item_i,CP_itemtype far *items,void (*routine)(int w))
\r
3109 static int redrawitem=1,lastitem=-1;
\r
3110 int i,x,y,basey,exit,which,shape,timer;
\r
3114 which=item_i->curpos;
\r
3116 basey=item_i->y-2;
\r
3119 VWB_DrawPic(x,y,C_CURSOR1PIC);
\r
3120 SetTextColor(items+which,1);
\r
3123 PrintX=item_i->x+item_i->indent;
\r
3124 PrintY=item_i->y+which*13;
\r
3125 US_Print((items+which)->string);
\r
3128 // CALL CUSTOM ROUTINE IF IT IS NEEDED
\r
3132 VW_UpdateScreen();
\r
3134 shape=C_CURSOR1PIC;
\r
3138 IN_ClearKeysDown();
\r
3144 // CHANGE GUN SHAPE
\r
3146 if (TimeCount>timer)
\r
3149 if (shape==C_CURSOR1PIC)
\r
3151 shape=C_CURSOR2PIC;
\r
3156 shape=C_CURSOR1PIC;
\r
3159 VWB_DrawPic(x,y,shape);
\r
3162 VW_UpdateScreen();
\r
3168 // SEE IF ANY KEYS ARE PRESSED FOR INITIAL CHAR FINDING
\r
3176 // CHECK FOR SCREEN CAPTURE
\r
3179 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))
\r
3181 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("debugmode"))
\r
3189 for (i=which+1;i<item_i->amount;i++)
\r
3190 if ((items+i)->active && (items+i)->string[0]==key)
\r
3192 EraseGun(item_i,items,x,y,which);
\r
3194 DrawGun(item_i,items,x,&y,which,basey,routine);
\r
3196 IN_ClearKeysDown();
\r
3201 // DIDN'T FIND A MATCH FIRST TIME THRU. CHECK AGAIN.
\r
3205 for (i=0;i<which;i++)
\r
3206 if ((items+i)->active && (items+i)->string[0]==key)
\r
3208 EraseGun(item_i,items,x,y,which);
\r
3210 DrawGun(item_i,items,x,&y,which,basey,routine);
\r
3211 IN_ClearKeysDown();
\r
3220 ReadAnyControl(&ci);
\r
3223 ////////////////////////////////////////////////
\r
3229 EraseGun(item_i,items,x,y,which);
\r
3232 // ANIMATE HALF-STEP
\r
3234 if (which && (items+which-1)->active)
\r
3237 DrawHalfStep(x,y);
\r
3241 // MOVE TO NEXT AVAILABLE SPOT
\r
3246 which=item_i->amount-1;
\r
3249 } while(!(items+which)->active);
\r
3251 DrawGun(item_i,items,x,&y,which,basey,routine);
\r
3253 // WAIT FOR BUTTON-UP OR DELAY NEXT MOVE
\r
3258 ////////////////////////////////////////////////
\r
3264 EraseGun(item_i,items,x,y,which);
\r
3266 // ANIMATE HALF-STEP
\r
3268 if (which!=item_i->amount-1 && (items+which+1)->active)
\r
3271 DrawHalfStep(x,y);
\r
3276 if (which==item_i->amount-1)
\r
3280 } while(!(items+which)->active);
\r
3282 DrawGun(item_i,items,x,&y,which,basey,routine);
\r
3285 // WAIT FOR BUTTON-UP OR DELAY NEXT MOVE
\r
3292 Keyboard[sc_Space] ||
\r
3293 Keyboard[sc_Enter])
\r
3297 Keyboard[sc_Escape])
\r
3303 IN_ClearKeysDown();
\r
3306 // ERASE EVERYTHING
\r
3308 if (lastitem!=which)
\r
3310 VWB_Bar(x-1,y,25,16,BKGDCOLOR);
\r
3311 PrintX=item_i->x+item_i->indent;
\r
3312 PrintY=item_i->y+which*13;
\r
3313 US_Print((items+which)->string);
\r
3321 VW_UpdateScreen();
\r
3323 item_i->curpos=which;
\r
3330 // CALL THE ROUTINE
\r
3332 if ((items+which)->routine!=NULL)
\r
3336 (items+which)->routine(0);
\r
3341 SD_PlaySound(ESCPRESSEDSND);
\r
3345 return 0; // JUST TO SHUT UP THE ERROR MESSAGES!
\r
3350 // ERASE GUN & DE-HIGHLIGHT STRING
\r
3352 void EraseGun(CP_iteminfo *item_i,CP_itemtype far *items,int x,int y,int which)
\r
3354 VWB_Bar(x-1,y,25,16,BKGDCOLOR);
\r
3355 SetTextColor(items+which,0);
\r
3357 PrintX=item_i->x+item_i->indent;
\r
3358 PrintY=item_i->y+which*13;
\r
3359 US_Print((items+which)->string);
\r
3360 VW_UpdateScreen();
\r
3365 // DRAW HALF STEP OF GUN TO NEXT POSITION
\r
3367 void DrawHalfStep(int x,int y)
\r
3369 VWB_DrawPic(x,y,C_CURSOR1PIC);
\r
3370 VW_UpdateScreen();
\r
3371 SD_PlaySound(MOVEGUN1SND);
\r
3373 while(TimeCount<8);
\r
3378 // DRAW GUN AT NEW POSITION
\r
3380 void DrawGun(CP_iteminfo *item_i,CP_itemtype far *items,int x,int *y,int which,int basey,void (*routine)(int w))
\r
3382 VWB_Bar(x-1,*y,25,16,BKGDCOLOR);
\r
3383 *y=basey+which*13;
\r
3384 VWB_DrawPic(x,*y,C_CURSOR1PIC);
\r
3385 SetTextColor(items+which,1);
\r
3387 PrintX=item_i->x+item_i->indent;
\r
3388 PrintY=item_i->y+which*13;
\r
3389 US_Print((items+which)->string);
\r
3392 // CALL CUSTOM ROUTINE IF IT IS NEEDED
\r
3396 VW_UpdateScreen();
\r
3397 SD_PlaySound(MOVEGUN2SND);
\r
3400 ////////////////////////////////////////////////////////////////////
\r
3402 // DELAY FOR AN AMOUNT OF TICS OR UNTIL CONTROLS ARE INACTIVE
\r
3404 ////////////////////////////////////////////////////////////////////
\r
3405 void TicDelay(int count)
\r
3413 ReadAnyControl(&ci);
\r
3414 } while(TimeCount<count && ci.dir!=dir_None);
\r
3418 ////////////////////////////////////////////////////////////////////
\r
3422 ////////////////////////////////////////////////////////////////////
\r
3423 void DrawMenu(CP_iteminfo *item_i,CP_itemtype far *items)
\r
3425 int i,which=item_i->curpos;
\r
3428 WindowX=PrintX=item_i->x+item_i->indent;
\r
3429 WindowY=PrintY=item_i->y;
\r
3433 for (i=0;i<item_i->amount;i++)
\r
3435 SetTextColor(items+i,which==i);
\r
3437 PrintY=item_i->y+i*13;
\r
3438 if ((items+i)->active)
\r
3439 US_Print((items+i)->string);
\r
3442 SETFONTCOLOR(DEACTIVE,BKGDCOLOR);
\r
3443 US_Print((items+i)->string);
\r
3444 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
3452 ////////////////////////////////////////////////////////////////////
\r
3454 // SET TEXT COLOR (HIGHLIGHT OR NO)
\r
3456 ////////////////////////////////////////////////////////////////////
\r
3457 void SetTextColor(CP_itemtype far *items,int hlight)
\r
3460 {SETFONTCOLOR(color_hlite[items->active],BKGDCOLOR);}
\r
3462 {SETFONTCOLOR(color_norml[items->active],BKGDCOLOR);}
\r
3466 ////////////////////////////////////////////////////////////////////
\r
3468 // WAIT FOR CTRLKEY-UP OR BUTTON-UP
\r
3470 ////////////////////////////////////////////////////////////////////
\r
3471 void WaitKeyUp(void)
\r
3474 while(ReadAnyControl(&ci), ci.button0|
\r
3478 Keyboard[sc_Space]|
\r
3479 Keyboard[sc_Enter]|
\r
3480 Keyboard[sc_Escape]);
\r
3484 ////////////////////////////////////////////////////////////////////
\r
3486 // READ KEYBOARD, JOYSTICK AND MOUSE FOR INPUT
\r
3488 ////////////////////////////////////////////////////////////////////
\r
3489 void ReadAnyControl(ControlInfo *ci)
\r
3491 int mouseactive=0;
\r
3494 IN_ReadControl(0,ci);
\r
3498 int mousey,mousex;
\r
3501 // READ MOUSE MOTION COUNTERS
\r
3502 // RETURN DIRECTION
\r
3504 // CHECK MOUSE BUTTONS
\r
3510 if (mousey<CENTER-SENSITIVE)
\r
3512 ci->dir=dir_North;
\r
3518 if (mousey>CENTER+SENSITIVE)
\r
3520 ci->dir=dir_South;
\r
3526 if (mousex<CENTER-SENSITIVE)
\r
3534 if (mousex>CENTER+SENSITIVE)
\r
3542 if (IN_MouseButtons())
\r
3544 ci->button0=IN_MouseButtons()&1;
\r
3545 ci->button1=IN_MouseButtons()&2;
\r
3546 ci->button2=IN_MouseButtons()&4;
\r
3547 ci->button3=false;
\r
3552 if (joystickenabled && !mouseactive)
\r
3557 INL_GetJoyDelta(joystickport,&jx,&jy);
\r
3558 if (jy<-SENSITIVE)
\r
3559 ci->dir=dir_North;
\r
3562 ci->dir=dir_South;
\r
3564 if (jx<-SENSITIVE)
\r
3570 jb=IN_JoyButtons();
\r
3575 if (joypadenabled)
\r
3581 ci->button2=ci->button3=false;
\r
3587 ////////////////////////////////////////////////////////////////////
\r
3589 // DRAW DIALOG AND CONFIRM YES OR NO TO QUESTION
\r
3591 ////////////////////////////////////////////////////////////////////
\r
3592 int Confirm(char far *string)
\r
3594 int xit=0,i,x,y,tick=0,time,whichsnd[2]={ESCPRESSEDSND,SHOOTSND};
\r
3598 IN_ClearKeysDown();
\r
3609 if (TimeCount>=10)
\r
3614 VWB_Bar(x,y,8,13,TEXTCOLOR);
\r
3621 VW_UpdateScreen();
\r
3627 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))
\r
3632 } while(!Keyboard[sc_S] && !Keyboard[sc_N] && !Keyboard[sc_Escape]);
\r
3634 } while(!Keyboard[sc_Y] && !Keyboard[sc_N] && !Keyboard[sc_Escape]);
\r
3638 if (Keyboard[sc_S])
\r
3644 while(Keyboard[sc_S] || Keyboard[sc_N] || Keyboard[sc_Escape]);
\r
3648 if (Keyboard[sc_Y])
\r
3654 while(Keyboard[sc_Y] || Keyboard[sc_N] || Keyboard[sc_Escape]);
\r
3657 IN_ClearKeysDown();
\r
3658 SD_PlaySound(whichsnd[xit]);
\r
3663 ////////////////////////////////////////////////////////////////////
\r
3665 // DRAW MESSAGE & GET Y OR N
\r
3667 ////////////////////////////////////////////////////////////////////
\r
3668 int GetYorN(int x,int y,int pic)
\r
3670 int xit=0,whichsnd[2]={ESCPRESSEDSND,SHOOTSND};
\r
3673 CA_CacheGrChunk(pic);
\r
3674 VWB_DrawPic(x * 8,y * 8,pic);
\r
3675 UNCACHEGRCHUNK(pic);
\r
3676 VW_UpdateScreen();
\r
3677 IN_ClearKeysDown();
\r
3682 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))
\r
3687 } while(!Keyboard[sc_S] && !Keyboard[sc_N] && !Keyboard[sc_Escape]);
\r
3689 } while(!Keyboard[sc_Y] && !Keyboard[sc_N] && !Keyboard[sc_Escape]);
\r
3693 if (Keyboard[sc_S])
\r
3699 while(Keyboard[sc_S] || Keyboard[sc_N] || Keyboard[sc_Escape]);
\r
3703 if (Keyboard[sc_Y])
\r
3709 while(Keyboard[sc_Y] || Keyboard[sc_N] || Keyboard[sc_Escape]);
\r
3712 IN_ClearKeysDown();
\r
3713 SD_PlaySound(whichsnd[xit]);
\r
3719 ////////////////////////////////////////////////////////////////////
\r
3721 // PRINT A MESSAGE IN A WINDOW
\r
3723 ////////////////////////////////////////////////////////////////////
\r
3724 void Message(char far *string)
\r
3726 int h=0,w=0,mw=0,i,x,y,time;
\r
3727 fontstruct _seg *font;
\r
3730 CA_CacheGrChunk (STARTFONT+1);
\r
3732 font=grsegs[STARTFONT+fontnumber];
\r
3734 for (i=0;i<_fstrlen(string);i++)
\r
3735 if (string[i]=='\n')
\r
3743 w+=font->width[string[i]];
\r
3748 PrintY=(WindowH/2)-h/2;
\r
3749 PrintX=WindowX=160-mw/2;
\r
3751 DrawWindow(WindowX-5,PrintY-5,mw+10,h+10,TEXTCOLOR);
\r
3752 DrawOutline(WindowX-5,PrintY-5,mw+10,h+10,0,HIGHLIGHT);
\r
3753 SETFONTCOLOR(0,TEXTCOLOR);
\r
3755 VW_UpdateScreen();
\r
3759 ////////////////////////////////////////////////////////////////////
\r
3761 // THIS MAY BE FIXED A LITTLE LATER...
\r
3763 ////////////////////////////////////////////////////////////////////
\r
3764 static int lastmusic;
\r
3766 void StartCPMusic(int song)
\r
3770 if (audiosegs[STARTMUSIC + lastmusic]) // JDC
\r
3771 MM_FreePtr ((memptr *)&audiosegs[STARTMUSIC + lastmusic]);
\r
3777 MM_BombOnError (false);
\r
3778 CA_CacheAudioChunk(STARTMUSIC + chunk);
\r
3779 MM_BombOnError (true);
\r
3784 MM_SetLock(&((memptr)audiosegs[STARTMUSIC + chunk]),true);
\r
3785 SD_StartMusic((MusicGroup far *)audiosegs[STARTMUSIC + chunk]);
\r
3789 void FreeMusic (void)
\r
3791 if (audiosegs[STARTMUSIC + lastmusic]) // JDC
\r
3792 MM_FreePtr ((memptr *)&audiosegs[STARTMUSIC + lastmusic]);
\r
3796 ///////////////////////////////////////////////////////////////////////////
\r
3798 // IN_GetScanName() - Returns a string containing the name of the
\r
3799 // specified scan code
\r
3801 ///////////////////////////////////////////////////////////////////////////
\r
3803 IN_GetScanName(ScanCode scan)
\r
3808 for (s = ExtScanCodes,p = ExtScanNames;*s;p++,s++)
\r
3812 return(ScanNames[scan]);
\r
3816 ///////////////////////////////////////////////////////////////////////////
\r
3818 // CHECK FOR PAUSE KEY (FOR MUSIC ONLY)
\r
3820 ///////////////////////////////////////////////////////////////////////////
\r
3821 void CheckPause(void)
\r
3825 switch(SoundStatus)
\r
3827 case 0: SD_MusicOn(); break;
\r
3828 case 1: SD_MusicOff(); break;
\r
3833 IN_ClearKeysDown();
\r
3839 ///////////////////////////////////////////////////////////////////////////
\r
3841 // DRAW GUN CURSOR AT CORRECT POSITION IN MENU
\r
3843 ///////////////////////////////////////////////////////////////////////////
\r
3844 void DrawMenuGun(CP_iteminfo *iteminfo)
\r
3850 y=iteminfo->y+iteminfo->curpos*13-2;
\r
3851 VWB_DrawPic(x,y,C_CURSOR1PIC);
\r
3855 ///////////////////////////////////////////////////////////////////////////
\r
3857 // DRAW SCREEN TITLE STRIPES
\r
3859 ///////////////////////////////////////////////////////////////////////////
\r
3860 void DrawStripes(int y)
\r
3863 VWB_Bar(0,y,320,24,0);
\r
3864 VWB_Hlin(0,319,y+22,STRIPE);
\r
3866 VWB_Bar(0,y,320,22,0);
\r
3867 VWB_Hlin(0,319,y+23,0);
\r
3871 void ShootSnd(void)
\r
3873 SD_PlaySound(SHOOTSND);
\r
3877 ///////////////////////////////////////////////////////////////////////////
\r
3879 // CHECK FOR EPISODES
\r
3881 ///////////////////////////////////////////////////////////////////////////
\r
3882 void CheckForEpisodes(void)
\r
3887 // JAPANESE VERSION
\r
3891 if (!findfirst("*.WJ1",&f,FA_ARCH))
\r
3893 strcpy(extension,"WJ1");
\r
3895 if (!findfirst("*.WJ6",&f,FA_ARCH))
\r
3897 strcpy(extension,"WJ6");
\r
3899 strcat(configname,extension);
\r
3900 strcat(SaveName,extension);
\r
3901 strcat(PageFileName,extension);
\r
3902 strcat(audioname,extension);
\r
3903 strcat(demoname,extension);
\r
3904 EpisodeSelect[1] =
\r
3905 EpisodeSelect[2] =
\r
3906 EpisodeSelect[3] =
\r
3907 EpisodeSelect[4] =
\r
3908 EpisodeSelect[5] = 1;
\r
3911 Quit("NO JAPANESE WOLFENSTEIN 3-D DATA FILES to be found!");
\r
3919 if (!findfirst("*.WL6",&f,FA_ARCH))
\r
3921 strcpy(extension,"WL6");
\r
3922 NewEmenu[2].active =
\r
3923 NewEmenu[4].active =
\r
3924 NewEmenu[6].active =
\r
3925 NewEmenu[8].active =
\r
3926 NewEmenu[10].active =
\r
3927 EpisodeSelect[1] =
\r
3928 EpisodeSelect[2] =
\r
3929 EpisodeSelect[3] =
\r
3930 EpisodeSelect[4] =
\r
3931 EpisodeSelect[5] = 1;
\r
3934 if (!findfirst("*.WL3",&f,FA_ARCH))
\r
3936 strcpy(extension,"WL3");
\r
3937 NewEmenu[2].active =
\r
3938 NewEmenu[4].active =
\r
3939 EpisodeSelect[1] =
\r
3940 EpisodeSelect[2] = 1;
\r
3950 if (!findfirst("*.SOD",&f,FA_ARCH))
\r
3952 strcpy(extension,"SOD");
\r
3955 Quit("NO SPEAR OF DESTINY DATA FILES TO BE FOUND!");
\r
3957 if (!findfirst("*.SDM",&f,FA_ARCH))
\r
3959 strcpy(extension,"SDM");
\r
3962 Quit("NO SPEAR OF DESTINY DEMO DATA FILES TO BE FOUND!");
\r
3966 if (!findfirst("*.WL1",&f,FA_ARCH))
\r
3968 strcpy(extension,"WL1");
\r
3971 Quit("NO WOLFENSTEIN 3-D DATA FILES to be found!");
\r
3974 strcat(configname,extension);
\r
3975 strcat(SaveName,extension);
\r
3976 strcat(PageFileName,extension);
\r
3977 strcat(audioname,extension);
\r
3978 strcat(demoname,extension);
\r
3981 strcat(helpfilename,extension);
\r
3983 strcat(endfilename,extension);
\r