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
383 CleanupControlPanel();
\r
385 UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
391 CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
403 which=HandleMenu(&MainItems,&MainMenu[0],NULL);
\r
408 // EASTER EGG FOR SPEAR OF DESTINY!
\r
410 if (Keyboard[sc_I] && Keyboard[sc_D])
\r
413 StartCPMusic (XJAZNAZI_MUS);
\r
414 UnCacheLump(OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
415 UnCacheLump(BACKDROP_LUMP_START,BACKDROP_LUMP_END);
\r
420 CA_CacheGrChunk (IDGUYS1PIC);
\r
421 VWB_DrawPic(0,0,IDGUYS1PIC);
\r
422 UNCACHEGRCHUNK(IDGUYS1PIC);
\r
424 CA_CacheGrChunk (IDGUYS2PIC);
\r
425 VWB_DrawPic(0,80,IDGUYS2PIC);
\r
426 UNCACHEGRCHUNK(IDGUYS2PIC);
\r
430 CA_CacheGrChunk (IDGUYSPALETTE);
\r
431 VL_FadeIn(0,255,grsegs[IDGUYSPALETTE],30);
\r
432 UNCACHEGRCHUNK(IDGUYSPALETTE);
\r
434 while (Keyboard[sc_I] || Keyboard[sc_D]);
\r
435 IN_ClearKeysDown();
\r
440 CacheLump(BACKDROP_LUMP_START,BACKDROP_LUMP_END);
\r
441 CacheLump(OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
443 StartCPMusic (MENUSONG);
\r
452 if (MainMenu[viewscores].routine == NULL)
\r
465 // DEALLOCATE ALL SOUNDS!
\r
470 start = STARTPCSOUNDS;
\r
473 start = STARTADLIBSOUNDS;
\r
477 if (SoundMode != sdm_Off)
\r
478 for (i=0;i<NUMSOUNDS;i++,start++)
\r
479 if (audiosegs[start])
\r
480 MM_SetPurge (&(memptr)audiosegs[start],3); // make purgable
\r
487 StartCPMusic(INTROSONG);
\r
488 VL_FadeOut(0,255,0,0,0,10);
\r
505 // "EXIT OPTIONS" OR "NEW GAME" EXITS
\r
507 } while(!StartGame);
\r
510 // DEALLOCATE EVERYTHING
\r
512 CleanupControlPanel();
\r
515 // CHANGE MAINMENU ITEM
\r
517 if (startgame || loadedgame)
\r
520 MainMenu[viewscores].routine = NULL;
\r
522 _fstrcpy(MainMenu[viewscores].string,STR_EG);
\r
527 // RETURN/START GAME EXECUTION
\r
530 UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
536 ////////////////////////
\r
538 // DRAW MAIN MENU SCREEN
\r
540 void DrawMainMenu(void)
\r
543 CA_CacheScreen(S_OPTIONSPIC);
\r
547 VWB_DrawPic(112,184,C_MOUSELBACKPIC);
\r
549 VWB_DrawPic(84,0,C_OPTIONSPIC);
\r
552 DrawWindow(MENU_X-8,MENU_Y-3,MENU_W+8,MENU_H,BKGDCOLOR);
\r
554 DrawWindow(MENU_X-8,MENU_Y-3,MENU_W,MENU_H,BKGDCOLOR);
\r
559 // CHANGE "GAME" AND "DEMO"
\r
566 _fstrcpy(&MainMenu[backtodemo].string,STR_GAME);
\r
568 _fstrcpy(&MainMenu[backtodemo].string[8],STR_GAME);
\r
572 CA_CacheGrChunk(C_MRETGAMEPIC);
\r
573 VWB_DrawPic(12*8,20*8,C_MRETGAMEPIC);
\r
574 UNCACHEGRCHUNK(C_MRETGAMEPIC);
\r
575 CA_CacheGrChunk(C_MENDGAMEPIC);
\r
576 VWB_DrawPic(12*8,18*8,C_MENDGAMEPIC);
\r
577 UNCACHEGRCHUNK(C_MENDGAMEPIC);
\r
579 MainMenu[backtodemo].active=2;
\r
585 _fstrcpy(&MainMenu[backtodemo].string,STR_BD);
\r
587 _fstrcpy(&MainMenu[backtodemo].string[8],STR_DEMO);
\r
590 CA_CacheGrChunk(C_MRETDEMOPIC);
\r
591 VWB_DrawPic(12*8,20*8,C_MRETDEMOPIC);
\r
592 UNCACHEGRCHUNK(C_MRETDEMOPIC);
\r
593 CA_CacheGrChunk(C_MSCORESPIC);
\r
594 VWB_DrawPic(12*8,18*8,C_MSCORESPIC);
\r
595 UNCACHEGRCHUNK(C_MSCORESPIC);
\r
597 MainMenu[backtodemo].active=1;
\r
600 DrawMenu(&MainItems,&MainMenu[0]);
\r
606 ////////////////////////////////////////////////////////////////////
\r
610 ////////////////////////////////////////////////////////////////////
\r
611 void CP_ReadThis(void)
\r
613 StartCPMusic(CORNER_MUS);
\r
615 StartCPMusic(MENUSONG);
\r
623 ////////////////////////////////////////////////////////////////////
\r
627 ////////////////////////////////////////////////////////////////////
\r
632 geninterrupt(0x10);
\r
634 while (!Keyboard[sc_Escape])
\r
635 IN_ClearKeysDown();
\r
638 VL_SetVGAPlaneMode ();
\r
639 VL_TestPaletteSet ();
\r
640 VL_SetPalette (&gamepal);
\r
646 ////////////////////////////////////////////////////////////////////
\r
648 // CHECK QUICK-KEYS & QUIT (WHILE IN A GAME)
\r
650 ////////////////////////////////////////////////////////////////////
\r
651 int CP_CheckQuick(unsigned scancode)
\r
659 CA_CacheGrChunk(STARTFONT+1);
\r
663 if (GetYorN(7,8,C_JAPQUITPIC))
\r
665 if (Confirm(ENDGAMESTR))
\r
668 playstate = ex_died;
\r
669 pickquick = gamestate.lives = 0;
\r
672 DrawAllPlayBorder();
\r
675 MainMenu[savegame].active = 0;
\r
682 if (SaveGamesAvail[LSItems.curpos] && pickquick)
\r
684 CA_CacheGrChunk(STARTFONT+1);
\r
686 Message(STR_SAVING"...");
\r
693 CA_CacheGrChunk(STARTFONT+1);
\r
694 CA_CacheGrChunk(C_CURSOR1PIC);
\r
695 CA_CacheGrChunk(C_CURSOR2PIC);
\r
696 CA_CacheGrChunk(C_DISKLOADING1PIC);
\r
697 CA_CacheGrChunk(C_DISKLOADING2PIC);
\r
698 CA_CacheGrChunk(C_SAVEGAMEPIC);
\r
699 CA_CacheGrChunk(C_MOUSELBACKPIC);
\r
701 CacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
\r
702 CA_CacheGrChunk(C_CURSOR1PIC);
\r
707 StartCPMusic(MENUSONG);
\r
708 pickquick=CP_SaveGame(0);
\r
710 SETFONTCOLOR(0,15);
\r
711 IN_ClearKeysDown();
\r
714 if (!startgame && !loadedgame)
\r
721 playstate = ex_abort;
\r
722 lasttimecount = TimeCount;
\r
725 Mouse(MDelta); // Clear accumulated mouse movement
\r
727 PM_CheckMainMem ();
\r
730 UNCACHEGRCHUNK(C_CURSOR1PIC);
\r
731 UNCACHEGRCHUNK(C_CURSOR2PIC);
\r
732 UNCACHEGRCHUNK(C_DISKLOADING1PIC);
\r
733 UNCACHEGRCHUNK(C_DISKLOADING2PIC);
\r
734 UNCACHEGRCHUNK(C_SAVEGAMEPIC);
\r
735 UNCACHEGRCHUNK(C_MOUSELBACKPIC);
\r
737 UnCacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
\r
746 if (SaveGamesAvail[LSItems.curpos] && pickquick)
\r
748 char string[100]=STR_LGC;
\r
751 CA_CacheGrChunk(STARTFONT+1);
\r
754 strcat(string,SaveGameNames[LSItems.curpos]);
\r
755 strcat(string,"\"?");
\r
757 if (Confirm(string))
\r
760 DrawAllPlayBorder();
\r
766 CA_CacheGrChunk(STARTFONT+1);
\r
767 CA_CacheGrChunk(C_CURSOR1PIC);
\r
768 CA_CacheGrChunk(C_CURSOR2PIC);
\r
769 CA_CacheGrChunk(C_DISKLOADING1PIC);
\r
770 CA_CacheGrChunk(C_DISKLOADING2PIC);
\r
771 CA_CacheGrChunk(C_LOADGAMEPIC);
\r
772 CA_CacheGrChunk(C_MOUSELBACKPIC);
\r
774 CA_CacheGrChunk(C_CURSOR1PIC);
\r
775 CacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
\r
780 StartCPMusic(MENUSONG);
\r
781 pickquick=CP_LoadGame(0);
\r
783 SETFONTCOLOR(0,15);
\r
784 IN_ClearKeysDown();
\r
787 if (!startgame && !loadedgame)
\r
794 playstate = ex_abort;
\r
796 lasttimecount = TimeCount;
\r
799 Mouse(MDelta); // Clear accumulated mouse movement
\r
800 PM_CheckMainMem ();
\r
803 UNCACHEGRCHUNK(C_CURSOR1PIC);
\r
804 UNCACHEGRCHUNK(C_CURSOR2PIC);
\r
805 UNCACHEGRCHUNK(C_DISKLOADING1PIC);
\r
806 UNCACHEGRCHUNK(C_DISKLOADING2PIC);
\r
807 UNCACHEGRCHUNK(C_LOADGAMEPIC);
\r
808 UNCACHEGRCHUNK(C_MOUSELBACKPIC);
\r
810 UnCacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
\r
819 CA_CacheGrChunk(STARTFONT+1);
\r
825 if (GetYorN(7,8,C_QUITMSGPIC))
\r
828 if (Confirm(ENDGAMESTR))
\r
830 if (Confirm(endStrings[US_RndT()&0x7+(US_RndT()&1)]))
\r
843 // SHUT-UP THE ADLIB
\r
845 for (i=1;i<=0xf5;i++)
\r
850 DrawAllPlayBorder();
\r
860 ////////////////////////////////////////////////////////////////////
\r
862 // END THE CURRENT GAME
\r
864 ////////////////////////////////////////////////////////////////////
\r
865 int CP_EndGame(void)
\r
868 if (!GetYorN(7,8,C_JAPQUITPIC))
\r
870 if (!Confirm(ENDGAMESTR))
\r
874 pickquick = gamestate.lives = 0;
\r
875 playstate = ex_died;
\r
878 MainMenu[savegame].active = 0;
\r
879 MainMenu[viewscores].routine=CP_ViewScores;
\r
881 _fstrcpy(MainMenu[viewscores].string,STR_VS);
\r
889 ////////////////////////////////////////////////////////////////////
\r
891 // VIEW THE HIGH SCORES
\r
893 ////////////////////////////////////////////////////////////////////
\r
894 void CP_ViewScores(void)
\r
899 UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
900 StartCPMusic (XAWARD_MUS);
\r
902 StartCPMusic (ROSTER_MUS);
\r
906 VW_UpdateScreen ();
\r
912 StartCPMusic(MENUSONG);
\r
916 CacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
\r
917 CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
922 ////////////////////////////////////////////////////////////////////
\r
924 // START A NEW GAME
\r
926 ////////////////////////////////////////////////////////////////////
\r
927 void CP_NewGame(void)
\r
932 UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
942 which=HandleMenu(&NewEitems,&NewEmenu[0],NULL);
\r
950 if (!EpisodeSelect[which/2])
\r
952 SD_PlaySound (NOWAYSND);
\r
953 Message("Please select \"Read This!\"\n"
\r
954 "from the Options menu to\n"
\r
955 "find out how to order this\n"
\r
956 "episode from Apogee.");
\r
957 IN_ClearKeysDown();
\r
975 // ALREADY IN A GAME?
\r
979 if (!GetYorN(7,8,C_JAPNEWGAMEPIC))
\r
981 if (!Confirm(CURGAME))
\r
994 // ALREADY IN A GAME?
\r
996 CacheLump (NEWGAME_LUMP_START,NEWGAME_LUMP_END);
\r
999 if (!Confirm(CURGAME))
\r
1002 UnCacheLump (NEWGAME_LUMP_START,NEWGAME_LUMP_END);
\r
1003 CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1010 which=HandleMenu(&NewItems,&NewMenu[0],DrawNewGameDiff);
\r
1017 UnCacheLump (NEWGAME_LUMP_START,NEWGAME_LUMP_END);
\r
1018 CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1024 NewGame(which,episode);
\r
1029 // CHANGE "READ THIS!" TO NORMAL COLOR
\r
1033 MainMenu[readthis].active=1;
\r
1040 UnCacheLump (NEWGAME_LUMP_START,NEWGAME_LUMP_END);
\r
1041 CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1047 /////////////////////
\r
1049 // DRAW NEW EPISODE MENU
\r
1051 void DrawNewEpisode(void)
\r
1056 CA_CacheScreen(S_EPISODEPIC);
\r
1059 VWB_DrawPic(112,184,C_MOUSELBACKPIC);
\r
1061 DrawWindow(NE_X-4,NE_Y-4,NE_W+8,NE_H+8,BKGDCOLOR);
\r
1062 SETFONTCOLOR(READHCOLOR,BKGDCOLOR);
\r
1066 US_CPrint("Cual episodio jugar?");
\r
1068 US_CPrint("Which episode to play?");
\r
1072 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
1073 DrawMenu(&NewEitems,&NewEmenu[0]);
\r
1076 VWB_DrawPic(NE_X+32,NE_Y+i*26,C_EPISODE1PIC+i);
\r
1078 VW_UpdateScreen();
\r
1084 /////////////////////
\r
1086 // DRAW NEW GAME MENU
\r
1088 void DrawNewGame(void)
\r
1091 CA_CacheScreen(S_SKILLPIC);
\r
1094 VWB_DrawPic(112,184,C_MOUSELBACKPIC);
\r
1096 SETFONTCOLOR(READHCOLOR,BKGDCOLOR);
\r
1102 US_Print("Eres macho?");
\r
1104 US_Print("How tough are you?");
\r
1107 VWB_DrawPic (PrintX,PrintY,C_HOWTOUGHPIC);
\r
1110 DrawWindow(NM_X-5,NM_Y-10,NM_W,NM_H,BKGDCOLOR);
\r
1113 DrawMenu(&NewItems,&NewMenu[0]);
\r
1114 DrawNewGameDiff(NewItems.curpos);
\r
1115 VW_UpdateScreen();
\r
1121 ////////////////////////
\r
1123 // DRAW NEW GAME GRAPHIC
\r
1125 void DrawNewGameDiff(int w)
\r
1127 VWB_DrawPic(NM_X+185,NM_Y+7,w+C_BABYMODEPIC);
\r
1131 ////////////////////////////////////////////////////////////////////
\r
1133 // HANDLE SOUND MENU
\r
1135 ////////////////////////////////////////////////////////////////////
\r
1136 void CP_Sound(void)
\r
1142 UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1143 CacheLump (SOUND_LUMP_START,SOUND_LUMP_END);
\r
1152 which=HandleMenu(&SndItems,&SndMenu[0],NULL);
\r
1154 // HANDLE MENU CHOICES
\r
1162 if (SoundMode!=sdm_Off)
\r
1164 SD_WaitSoundDone();
\r
1165 SD_SetSoundMode(sdm_Off);
\r
1170 if (SoundMode!=sdm_PC)
\r
1172 SD_WaitSoundDone();
\r
1173 SD_SetSoundMode(sdm_PC);
\r
1174 CA_LoadAllSounds();
\r
1180 if (SoundMode!=sdm_AdLib)
\r
1182 SD_WaitSoundDone();
\r
1183 SD_SetSoundMode(sdm_AdLib);
\r
1184 CA_LoadAllSounds();
\r
1191 // DIGITIZED SOUND
\r
1194 if (DigiMode!=sds_Off)
\r
1196 SD_SetDigiDevice(sds_Off);
\r
1201 if (DigiMode!=sds_SoundSource)
\r
1203 SD_SetDigiDevice(sds_SoundSource);
\r
1209 if (DigiMode!=sds_SoundBlaster)
\r
1211 SD_SetDigiDevice(sds_SoundBlaster);
\r
1221 if (MusicMode!=smm_Off)
\r
1223 SD_SetMusicMode(smm_Off);
\r
1229 if (MusicMode!=smm_AdLib)
\r
1231 SD_SetMusicMode(smm_AdLib);
\r
1234 StartCPMusic(MENUSONG);
\r
1238 } while(which>=0);
\r
1243 UnCacheLump (SOUND_LUMP_START,SOUND_LUMP_END);
\r
1244 CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1249 //////////////////////
\r
1251 // DRAW THE SOUND MENU
\r
1253 void DrawSoundMenu(void)
\r
1259 CA_CacheScreen(S_SOUNDPIC);
\r
1262 // DRAW SOUND MENU
\r
1265 VWB_DrawPic(112,184,C_MOUSELBACKPIC);
\r
1267 DrawWindow(SM_X-8,SM_Y1-3,SM_W,SM_H1,BKGDCOLOR);
\r
1268 DrawWindow(SM_X-8,SM_Y2-3,SM_W,SM_H2,BKGDCOLOR);
\r
1269 DrawWindow(SM_X-8,SM_Y3-3,SM_W,SM_H3,BKGDCOLOR);
\r
1273 // IF NO ADLIB, NON-CHOOSENESS!
\r
1275 if (!AdLibPresent && !SoundBlasterPresent)
\r
1277 SndMenu[2].active=SndMenu[10].active=SndMenu[11].active=0;
\r
1280 if (!SoundSourcePresent)
\r
1281 SndMenu[6].active=0;
\r
1283 if (!SoundBlasterPresent)
\r
1284 SndMenu[7].active=0;
\r
1286 if (!SoundSourcePresent && !SoundBlasterPresent)
\r
1287 SndMenu[5].active=0;
\r
1289 DrawMenu(&SndItems,&SndMenu[0]);
\r
1291 VWB_DrawPic(100,SM_Y1-20,C_FXTITLEPIC);
\r
1292 VWB_DrawPic(100,SM_Y2-20,C_DIGITITLEPIC);
\r
1293 VWB_DrawPic(100,SM_Y3-20,C_MUSICTITLEPIC);
\r
1296 for (i=0;i<SndItems.amount;i++)
\r
1298 if (i!=3 && i!=4 && i!=8 && i!=9)
\r
1300 if (SndMenu[i].string[0])
\r
1304 // DRAW SELECTED/NOT SELECTED GRAPHIC BUTTONS
\r
1312 case 0: if (SoundMode==sdm_Off) on=1; break;
\r
1313 case 1: if (SoundMode==sdm_PC) on=1; break;
\r
1314 case 2: if (SoundMode==sdm_AdLib) on=1; break;
\r
1317 // DIGITIZED SOUND
\r
1319 case 5: if (DigiMode==sds_Off) on=1; break;
\r
1320 case 6: if (DigiMode==sds_SoundSource) on=1; break;
\r
1321 case 7: if (DigiMode==sds_SoundBlaster) on=1; break;
\r
1326 case 10: if (MusicMode==smm_Off) on=1; break;
\r
1327 case 11: if (MusicMode==smm_AdLib) on=1; break;
\r
1331 VWB_DrawPic(SM_X+24,SM_Y1+i*13+2,C_SELECTEDPIC);
\r
1333 VWB_DrawPic(SM_X+24,SM_Y1+i*13+2,C_NOTSELECTEDPIC);
\r
1336 DrawMenuGun(&SndItems);
\r
1337 VW_UpdateScreen();
\r
1342 // DRAW LOAD/SAVE IN PROGRESS
\r
1344 void DrawLSAction(int which)
\r
1351 DrawWindow(LSA_X,LSA_Y,LSA_W,LSA_H,TEXTCOLOR);
\r
1352 DrawOutline(LSA_X,LSA_Y,LSA_W,LSA_H,0,HIGHLIGHT);
\r
1353 VWB_DrawPic(LSA_X+8,LSA_Y+5,C_DISKLOADING1PIC);
\r
1356 SETFONTCOLOR(0,TEXTCOLOR);
\r
1361 US_Print(STR_LOADING"...");
\r
1363 US_Print(STR_SAVING"...");
\r
1365 VW_UpdateScreen();
\r
1369 ////////////////////////////////////////////////////////////////////
\r
1371 // LOAD SAVED GAMES
\r
1373 ////////////////////////////////////////////////////////////////////
\r
1374 int CP_LoadGame(int quick)
\r
1376 int handle,which,exit=0;
\r
1380 strcpy(name,SaveName);
\r
1387 which=LSItems.curpos;
\r
1389 if (SaveGamesAvail[which])
\r
1391 name[7]=which+'0';
\r
1392 handle=open(name,O_BINARY);
\r
1393 lseek(handle,32,SEEK_SET);
\r
1395 LoadTheGame(handle,0,0);
\r
1413 UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1414 CacheLump (LOADSAVE_LUMP_START,LOADSAVE_LUMP_END);
\r
1417 DrawLoadSaveScreen(0);
\r
1421 which=HandleMenu(&LSItems,&LSMenu[0],TrackWhichGame);
\r
1422 if (which>=0 && SaveGamesAvail[which])
\r
1425 name[7]=which+'0';
\r
1427 handle=open(name,O_BINARY);
\r
1428 lseek(handle,32,SEEK_SET);
\r
1433 LoadTheGame(handle,LSA_X+8,LSA_Y+5);
\r
1439 // CHANGE "READ THIS!" TO NORMAL COLOR
\r
1444 MainMenu[readthis].active=1;
\r
1452 } while(which>=0);
\r
1457 UnCacheLump (LOADSAVE_LUMP_START,LOADSAVE_LUMP_END);
\r
1458 CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1465 ///////////////////////////////////
\r
1467 // HIGHLIGHT CURRENT SELECTED ENTRY
\r
1469 void TrackWhichGame(int w)
\r
1471 static int lastgameon=0;
\r
1473 PrintLSEntry(lastgameon,TEXTCOLOR);
\r
1474 PrintLSEntry(w,HIGHLIGHT);
\r
1480 ////////////////////////////
\r
1482 // DRAW THE LOAD/SAVE SCREEN
\r
1484 void DrawLoadSaveScreen(int loadsave)
\r
1494 VWB_DrawPic(112,184,C_MOUSELBACKPIC);
\r
1495 DrawWindow(LSM_X-10,LSM_Y-5,LSM_W,LSM_H,BKGDCOLOR);
\r
1499 VWB_DrawPic(60,0,C_LOADGAMEPIC);
\r
1501 VWB_DrawPic(60,0,C_SAVEGAMEPIC);
\r
1503 for (i=0;i<10;i++)
\r
1504 PrintLSEntry(i,TEXTCOLOR);
\r
1506 DrawMenu(&LSItems,&LSMenu[0]);
\r
1507 VW_UpdateScreen();
\r
1513 ///////////////////////////////////////////
\r
1515 // PRINT LOAD/SAVE GAME ENTRY W/BOX OUTLINE
\r
1517 void PrintLSEntry(int w,int color)
\r
1519 SETFONTCOLOR(color,BKGDCOLOR);
\r
1520 DrawOutline(LSM_X+LSItems.indent,LSM_Y+w*13,LSM_W-LSItems.indent-15,11,color,color);
\r
1521 PrintX=LSM_X+LSItems.indent+2;
\r
1522 PrintY=LSM_Y+w*13+1;
\r
1525 if (SaveGamesAvail[w])
\r
1526 US_Print(SaveGameNames[w]);
\r
1528 US_Print(" - "STR_EMPTY" -");
\r
1534 ////////////////////////////////////////////////////////////////////
\r
1536 // SAVE CURRENT GAME
\r
1538 ////////////////////////////////////////////////////////////////////
\r
1539 int CP_SaveGame(int quick)
\r
1541 int handle,which,exit=0;
\r
1542 unsigned nwritten;
\r
1543 char name[13],input[32];
\r
1546 strcpy(name,SaveName);
\r
1553 which=LSItems.curpos;
\r
1555 if (SaveGamesAvail[which])
\r
1557 name[7]=which+'0';
\r
1559 handle=creat(name,S_IREAD|S_IWRITE);
\r
1561 strcpy(input,&SaveGameNames[which][0]);
\r
1563 _dos_write(handle,(void far *)input,32,&nwritten);
\r
1564 lseek(handle,32,SEEK_SET);
\r
1565 SaveTheGame(handle,0,0);
\r
1574 UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1575 CacheLump (LOADSAVE_LUMP_START,LOADSAVE_LUMP_END);
\r
1578 DrawLoadSaveScreen(1);
\r
1582 which=HandleMenu(&LSItems,&LSMenu[0],TrackWhichGame);
\r
1586 // OVERWRITE EXISTING SAVEGAME?
\r
1588 if (SaveGamesAvail[which])
\r
1590 if (!GetYorN(7,8,C_JAPSAVEOVERPIC))
\r
1592 if (!Confirm(GAMESVD))
\r
1595 DrawLoadSaveScreen(1);
\r
1600 DrawLoadSaveScreen(1);
\r
1601 PrintLSEntry(which,HIGHLIGHT);
\r
1602 VW_UpdateScreen();
\r
1607 strcpy(input,&SaveGameNames[which][0]);
\r
1608 name[7]=which+'0';
\r
1611 if (!SaveGamesAvail[which])
\r
1612 VWB_Bar(LSM_X+LSItems.indent+1,LSM_Y+which*13+1,LSM_W-LSItems.indent-16,10,BKGDCOLOR);
\r
1613 VW_UpdateScreen();
\r
1615 if (US_LineInput(LSM_X+LSItems.indent+2,LSM_Y+which*13+1,input,input,true,31,LSM_W-LSItems.indent-30))
\r
1617 SaveGamesAvail[which]=1;
\r
1618 strcpy(&SaveGameNames[which][0],input);
\r
1621 handle=creat(name,S_IREAD|S_IWRITE);
\r
1622 _dos_write(handle,(void far *)input,32,&nwritten);
\r
1623 lseek(handle,32,SEEK_SET);
\r
1626 SaveTheGame(handle,LSA_X+8,LSA_Y+5);
\r
1635 VWB_Bar(LSM_X+LSItems.indent+1,LSM_Y+which*13+1,LSM_W-LSItems.indent-16,10,BKGDCOLOR);
\r
1636 PrintLSEntry(which,HIGHLIGHT);
\r
1637 VW_UpdateScreen();
\r
1638 SD_PlaySound(ESCPRESSEDSND);
\r
1646 } while(which>=0);
\r
1651 UnCacheLump (LOADSAVE_LUMP_START,LOADSAVE_LUMP_END);
\r
1652 CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1659 ////////////////////////////////////////////////////////////////////
\r
1661 // CALIBRATE JOYSTICK
\r
1663 ////////////////////////////////////////////////////////////////////
\r
1664 int CalibrateJoystick(void)
\r
1671 unsigned xmin,ymin,xmax,ymax,jb;
\r
1676 VWB_DrawPic(CALX,CALY,C_JOY0PIC);
\r
1678 DrawWindow(CALX-5,CALY-5,CALW,CALH,TEXTCOLOR);
\r
1679 DrawOutline(CALX-5,CALY-5,CALW,CALH,0,HIGHLIGHT);
\r
1680 SETFONTCOLOR(0,TEXTCOLOR);
\r
1682 WindowX = PrintX = CALX;
\r
1685 WindowY = PrintY = CALY;
\r
1686 US_Print(" "STR_CALIB"\n "STR_JOYST"\n");
\r
1687 VWB_DrawPic(CALX+40,CALY+30,C_JOY1PIC);
\r
1689 US_Print(STR_MOVEJOY);
\r
1690 SETFONTCOLOR(BKGDCOLOR,TEXTCOLOR);
\r
1691 US_Print(" "STR_ESCEXIT);
\r
1693 VW_UpdateScreen();
\r
1697 jb=IN_JoyButtons();
\r
1698 if (Keyboard[sc_Escape])
\r
1701 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))
\r
1707 SD_PlaySound(SHOOTSND);
\r
1708 IN_GetJoyAbs(joystickport,&xmin,&ymin);
\r
1712 VWB_DrawPic(CALX,CALY,C_JOY1PIC);
\r
1714 DrawWindow(CALX-5,CALY-5,CALW,CALH,TEXTCOLOR);
\r
1715 DrawOutline(CALX-5,CALY-5,CALW,CALH,0,HIGHLIGHT);
\r
1716 SETFONTCOLOR(0,TEXTCOLOR);
\r
1720 US_Print(" "STR_CALIB"\n "STR_JOYST"\n");
\r
1721 VWB_DrawPic(CALX+40,CALY+30,C_JOY2PIC);
\r
1723 US_Print(STR_MOVEJOY2);
\r
1724 SETFONTCOLOR(BKGDCOLOR,TEXTCOLOR);
\r
1725 US_Print(" "STR_ESCEXIT);
\r
1727 VW_UpdateScreen();
\r
1731 jb=IN_JoyButtons();
\r
1732 if (Keyboard[sc_Escape])
\r
1735 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))
\r
1740 IN_GetJoyAbs(joystickport,&xmax,&ymax);
\r
1741 SD_PlaySound(SHOOTSND);
\r
1743 while (IN_JoyButtons());
\r
1746 // ASSIGN ACTUAL VALUES HERE
\r
1748 if ((xmin != xmax) && (ymin != ymax))
\r
1749 IN_SetupJoy(joystickport,xmin,xmax,ymin,ymax);
\r
1757 ////////////////////////////////////////////////////////////////////
\r
1759 // DEFINE CONTROLS
\r
1761 ////////////////////////////////////////////////////////////////////
\r
1762 void CP_Control(void)
\r
1764 #define CTL_SPC 70
\r
1765 enum {MOUSEENABLE,JOYENABLE,USEPORT2,PADENABLE,MOUSESENS,CUSTOMIZE};
\r
1770 UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1771 CacheLump (CONTROL_LUMP_START,CONTROL_LUMP_END);
\r
1780 which=HandleMenu(&CtlItems,&CtlMenu[0],NULL);
\r
1788 CusItems.curpos=-1;
\r
1793 joystickenabled^=1;
\r
1794 if (joystickenabled)
\r
1795 if (!CalibrateJoystick())
\r
1796 joystickenabled = 0;
\r
1798 CusItems.curpos=-1;
\r
1821 } while(which>=0);
\r
1826 UnCacheLump (CONTROL_LUMP_START,CONTROL_LUMP_END);
\r
1827 CacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
\r
1832 ////////////////////////////////
\r
1834 // DRAW MOUSE SENSITIVITY SCREEN
\r
1836 void DrawMouseSens(void)
\r
1839 CA_CacheScreen(S_MOUSESENSPIC);
\r
1842 VWB_DrawPic(112,184,C_MOUSELBACKPIC);
\r
1844 DrawWindow(10,80,300,43,BKGDCOLOR);
\r
1846 DrawWindow(10,80,300,30,BKGDCOLOR);
\r
1852 SETFONTCOLOR(READCOLOR,BKGDCOLOR);
\r
1853 US_CPrint(STR_MOUSEADJ);
\r
1855 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
1859 US_Print(STR_SLOW);
\r
1861 US_Print(STR_FAST);
\r
1865 US_Print(STR_SLOW);
\r
1867 US_Print(STR_FAST);
\r
1871 VWB_Bar(60,97,200,10,TEXTCOLOR);
\r
1872 DrawOutline(60,97,200,10,0,HIGHLIGHT);
\r
1873 DrawOutline(60+20*mouseadjustment,97,20,10,0,READCOLOR);
\r
1874 VWB_Bar(61+20*mouseadjustment,98,19,9,READHCOLOR);
\r
1876 VW_UpdateScreen();
\r
1881 ///////////////////////////
\r
1883 // ADJUST MOUSE SENSITIVITY
\r
1885 void MouseSensitivity(void)
\r
1891 oldMA=mouseadjustment;
\r
1895 ReadAnyControl(&ci);
\r
1900 if (mouseadjustment)
\r
1902 mouseadjustment--;
\r
1903 VWB_Bar(60,97,200,10,TEXTCOLOR);
\r
1904 DrawOutline(60,97,200,10,0,HIGHLIGHT);
\r
1905 DrawOutline(60+20*mouseadjustment,97,20,10,0,READCOLOR);
\r
1906 VWB_Bar(61+20*mouseadjustment,98,19,9,READHCOLOR);
\r
1907 VW_UpdateScreen();
\r
1908 SD_PlaySound(MOVEGUN1SND);
\r
1909 while(Keyboard[sc_LeftArrow]);
\r
1916 if (mouseadjustment<9)
\r
1918 mouseadjustment++;
\r
1919 VWB_Bar(60,97,200,10,TEXTCOLOR);
\r
1920 DrawOutline(60,97,200,10,0,HIGHLIGHT);
\r
1921 DrawOutline(60+20*mouseadjustment,97,20,10,0,READCOLOR);
\r
1922 VWB_Bar(61+20*mouseadjustment,98,19,9,READHCOLOR);
\r
1923 VW_UpdateScreen();
\r
1924 SD_PlaySound(MOVEGUN1SND);
\r
1925 while(Keyboard[sc_RightArrow]);
\r
1932 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))
\r
1934 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("debugmode"))
\r
1938 if (ci.button0 || Keyboard[sc_Space] || Keyboard[sc_Enter])
\r
1941 if (ci.button1 || Keyboard[sc_Escape])
\r
1948 mouseadjustment=oldMA;
\r
1949 SD_PlaySound(ESCPRESSEDSND);
\r
1952 SD_PlaySound(SHOOTSND);
\r
1959 ///////////////////////////
\r
1961 // DRAW CONTROL MENU SCREEN
\r
1963 void DrawCtlScreen(void)
\r
1969 CA_CacheScreen(S_CONTROLPIC);
\r
1973 VWB_DrawPic(80,0,C_CONTROLPIC);
\r
1974 VWB_DrawPic(112,184,C_MOUSELBACKPIC);
\r
1975 DrawWindow(CTL_X-8,CTL_Y-5,CTL_W,CTL_H,BKGDCOLOR);
\r
1979 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
1981 if (JoysPresent[0])
\r
1982 CtlMenu[1].active=
\r
1983 CtlMenu[2].active=
\r
1984 CtlMenu[3].active=1;
\r
1986 CtlMenu[2].active=CtlMenu[3].active=joystickenabled;
\r
1990 CtlMenu[4].active=
\r
1991 CtlMenu[0].active=1;
\r
1994 CtlMenu[4].active=mouseenabled;
\r
1997 DrawMenu(&CtlItems,&CtlMenu[0]);
\r
2000 x=CTL_X+CtlItems.indent-24;
\r
2003 VWB_DrawPic(x,y,C_SELECTEDPIC);
\r
2005 VWB_DrawPic(x,y,C_NOTSELECTEDPIC);
\r
2008 if (joystickenabled)
\r
2009 VWB_DrawPic(x,y,C_SELECTEDPIC);
\r
2011 VWB_DrawPic(x,y,C_NOTSELECTEDPIC);
\r
2015 VWB_DrawPic(x,y,C_SELECTEDPIC);
\r
2017 VWB_DrawPic(x,y,C_NOTSELECTEDPIC);
\r
2020 if (joypadenabled)
\r
2021 VWB_DrawPic(x,y,C_SELECTEDPIC);
\r
2023 VWB_DrawPic(x,y,C_NOTSELECTEDPIC);
\r
2026 // PICK FIRST AVAILABLE SPOT
\r
2028 if (CtlItems.curpos<0 || !CtlMenu[CtlItems.curpos].active)
\r
2030 if (CtlMenu[i].active)
\r
2032 CtlItems.curpos=i;
\r
2036 DrawMenuGun(&CtlItems);
\r
2037 VW_UpdateScreen();
\r
2041 ////////////////////////////////////////////////////////////////////
\r
2043 // CUSTOMIZE CONTROLS
\r
2045 ////////////////////////////////////////////////////////////////////
\r
2046 enum {FIRE,STRAFE,RUN,OPEN};
\r
2047 char mbarray[4][3]={"b0","b1","b2","b3"},
\r
2048 order[4]={RUN,OPEN,FIRE,STRAFE};
\r
2051 void CustomControls(void)
\r
2056 DrawCustomScreen();
\r
2059 which=HandleMenu(&CusItems,&CusMenu[0],FixupCustom);
\r
2063 DefineMouseBtns();
\r
2078 } while(which>=0);
\r
2086 ////////////////////////
\r
2088 // DEFINE THE MOUSE BUTTONS
\r
2090 void DefineMouseBtns(void)
\r
2092 CustomCtrls mouseallowed={0,1,1,1};
\r
2093 EnterCtrlData(2,&mouseallowed,DrawCustMouse,PrintCustMouse,MOUSE);
\r
2097 ////////////////////////
\r
2099 // DEFINE THE JOYSTICK BUTTONS
\r
2101 void DefineJoyBtns(void)
\r
2103 CustomCtrls joyallowed={1,1,1,1};
\r
2104 EnterCtrlData(5,&joyallowed,DrawCustJoy,PrintCustJoy,JOYSTICK);
\r
2108 ////////////////////////
\r
2110 // DEFINE THE KEYBOARD BUTTONS
\r
2112 void DefineKeyBtns(void)
\r
2114 CustomCtrls keyallowed={1,1,1,1};
\r
2115 EnterCtrlData(8,&keyallowed,DrawCustKeybd,PrintCustKeybd,KEYBOARDBTNS);
\r
2119 ////////////////////////
\r
2121 // DEFINE THE KEYBOARD BUTTONS
\r
2123 void DefineKeyMove(void)
\r
2125 CustomCtrls keyallowed={1,1,1,1};
\r
2126 EnterCtrlData(10,&keyallowed,DrawCustKeys,PrintCustKeys,KEYBOARDMOVE);
\r
2130 ////////////////////////
\r
2132 // ENTER CONTROL DATA FOR ANY TYPE OF CONTROL
\r
2134 enum {FWRD,RIGHT,BKWD,LEFT};
\r
2135 int moveorder[4]={LEFT,RIGHT,FWRD,BKWD};
\r
2137 void EnterCtrlData(int index,CustomCtrls *cust,void (*DrawRtn)(int),void (*PrintRtn)(int),int type)
\r
2139 int j,exit,tick,redraw,which,x,picked;
\r
2144 PrintY=CST_Y+13*index;
\r
2145 IN_ClearKeysDown();
\r
2149 // FIND FIRST SPOT IN ALLOWED ARRAY
\r
2152 if (cust->allowed[j])
\r
2162 x=CST_START+CST_SPC*which;
\r
2163 DrawWindow(5,PrintY-1,310,13,BKGDCOLOR);
\r
2166 DrawWindow(x-2,PrintY,CST_SPC,11,TEXTCOLOR);
\r
2167 DrawOutline(x-2,PrintY,CST_SPC,11,0,HIGHLIGHT);
\r
2168 SETFONTCOLOR(0,TEXTCOLOR);
\r
2171 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
2172 VW_UpdateScreen();
\r
2177 ReadAnyControl(&ci);
\r
2179 if (type==MOUSE || type==JOYSTICK)
\r
2180 if (IN_KeyDown(sc_Enter)||IN_KeyDown(sc_Control)||IN_KeyDown(sc_Alt))
\r
2182 IN_ClearKeysDown();
\r
2183 ci.button0=ci.button1=false;
\r
2187 // CHANGE BUTTON VALUE?
\r
2189 if ((ci.button0|ci.button1|ci.button2|ci.button3)||
\r
2190 ((type==KEYBOARDBTNS||type==KEYBOARDMOVE) && LastScan==sc_Enter))
\r
2192 tick=TimeCount=picked=0;
\r
2193 SETFONTCOLOR(0,TEXTCOLOR);
\r
2197 int button,result=0;
\r
2200 if (type==KEYBOARDBTNS||type==KEYBOARDMOVE)
\r
2201 IN_ClearKeysDown();
\r
2211 VWB_Bar(x,PrintY+1,CST_SPC-2,10,TEXTCOLOR);
\r
2216 SD_PlaySound(HITWALLSND);
\r
2220 VW_UpdateScreen();
\r
2224 // WHICH TYPE OF INPUT DO WE PROCESS?
\r
2233 case 1: result=1; break;
\r
2234 case 2: result=2; break;
\r
2235 case 4: result=3; break;
\r
2244 if (order[which]==buttonmouse[z])
\r
2246 buttonmouse[z]=bt_nobutton;
\r
2250 buttonmouse[result-1]=order[which];
\r
2252 SD_PlaySound(SHOOTDOORSND);
\r
2257 if (ci.button0) result=1;
\r
2259 if (ci.button1) result=2;
\r
2261 if (ci.button2) result=3;
\r
2263 if (ci.button3) result=4;
\r
2271 if (order[which]==buttonjoy[z])
\r
2273 buttonjoy[z]=bt_nobutton;
\r
2277 buttonjoy[result-1]=order[which];
\r
2279 SD_PlaySound(SHOOTDOORSND);
\r
2283 case KEYBOARDBTNS:
\r
2286 buttonscan[order[which]]=LastScan;
\r
2289 IN_ClearKeysDown();
\r
2293 case KEYBOARDMOVE:
\r
2296 dirscan[moveorder[which]]=LastScan;
\r
2299 IN_ClearKeysDown();
\r
2307 if (IN_KeyDown(sc_Escape))
\r
2315 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
2321 if (ci.button1 || IN_KeyDown(sc_Escape))
\r
2325 // MOVE TO ANOTHER SPOT?
\r
2335 } while(!cust->allowed[which]);
\r
2337 SD_PlaySound(MOVEGUN1SND);
\r
2338 while(ReadAnyControl(&ci),ci.dir!=dir_None);
\r
2339 IN_ClearKeysDown();
\r
2348 } while(!cust->allowed[which]);
\r
2350 SD_PlaySound(MOVEGUN1SND);
\r
2351 while(ReadAnyControl(&ci),ci.dir!=dir_None);
\r
2352 IN_ClearKeysDown();
\r
2360 SD_PlaySound(ESCPRESSEDSND);
\r
2362 DrawWindow(5,PrintY-1,310,13,BKGDCOLOR);
\r
2366 ////////////////////////
\r
2368 // FIXUP GUN CURSOR OVERDRAW SHIT
\r
2370 void FixupCustom(int w)
\r
2372 static int lastwhich=-1;
\r
2373 int y=CST_Y+26+w*13;
\r
2376 VWB_Hlin(7,32,y-1,DEACTIVE);
\r
2377 VWB_Hlin(7,32,y+12,BORD2COLOR);
\r
2379 VWB_Hlin(7,32,y-2,BORDCOLOR);
\r
2380 VWB_Hlin(7,32,y+13,BORDCOLOR);
\r
2382 VWB_Hlin(7,32,y-2,BORD2COLOR);
\r
2383 VWB_Hlin(7,32,y+13,BORD2COLOR);
\r
2388 case 0: DrawCustMouse(1); break;
\r
2389 case 3: DrawCustJoy(1); break;
\r
2390 case 6: DrawCustKeybd(1); break;
\r
2391 case 8: DrawCustKeys(1);
\r
2397 y=CST_Y+26+lastwhich*13;
\r
2398 VWB_Hlin(7,32,y-1,DEACTIVE);
\r
2399 VWB_Hlin(7,32,y+12,BORD2COLOR);
\r
2401 VWB_Hlin(7,32,y-2,BORDCOLOR);
\r
2402 VWB_Hlin(7,32,y+13,BORDCOLOR);
\r
2404 VWB_Hlin(7,32,y-2,BORD2COLOR);
\r
2405 VWB_Hlin(7,32,y+13,BORD2COLOR);
\r
2411 case 0: DrawCustMouse(0); break;
\r
2412 case 3: DrawCustJoy(0); break;
\r
2413 case 6: DrawCustKeybd(0); break;
\r
2414 case 8: DrawCustKeys(0);
\r
2422 ////////////////////////
\r
2424 // DRAW CUSTOMIZE SCREEN
\r
2426 void DrawCustomScreen(void)
\r
2432 CA_CacheScreen(S_CUSTOMPIC);
\r
2436 PrintY = CST_Y+26;
\r
2440 US_Print("\n\n\n");
\r
2444 US_Print("\n\n\n");
\r
2448 US_Print("\n\n\n");
\r
2454 VWB_DrawPic(112,184,C_MOUSELBACKPIC);
\r
2456 VWB_DrawPic(80,0,C_CUSTOMIZEPIC);
\r
2461 SETFONTCOLOR(READCOLOR,BKGDCOLOR);
\r
2467 US_CPrint("Mouse\n");
\r
2469 PrintY = CST_Y+13;
\r
2470 VWB_DrawPic (128,48,C_MOUSEPIC);
\r
2473 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
2475 PrintX=CST_START-16;
\r
2476 US_Print(STR_CRUN);
\r
2477 PrintX=CST_START-16+CST_SPC*1;
\r
2478 US_Print(STR_COPEN);
\r
2479 PrintX=CST_START-16+CST_SPC*2;
\r
2480 US_Print(STR_CFIRE);
\r
2481 PrintX=CST_START-16+CST_SPC*3;
\r
2482 US_Print(STR_CSTRAFE"\n");
\r
2485 US_Print(STR_CRUN);
\r
2486 PrintX=CST_START+CST_SPC*1;
\r
2487 US_Print(STR_COPEN);
\r
2488 PrintX=CST_START+CST_SPC*2;
\r
2489 US_Print(STR_CFIRE);
\r
2490 PrintX=CST_START+CST_SPC*3;
\r
2491 US_Print(STR_CSTRAFE"\n");
\r
2494 DrawWindow(5,PrintY-1,310,13,BKGDCOLOR);
\r
2503 SETFONTCOLOR(READCOLOR,BKGDCOLOR);
\r
2504 US_CPrint("Joystick/Gravis GamePad\n");
\r
2507 VWB_DrawPic (40,88,C_JOYSTICKPIC);
\r
2511 VWB_DrawPic (112,120,C_KEYBOARDPIC);
\r
2514 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
2516 PrintX=CST_START-16;
\r
2517 US_Print(STR_CRUN);
\r
2518 PrintX=CST_START-16+CST_SPC*1;
\r
2519 US_Print(STR_COPEN);
\r
2520 PrintX=CST_START-16+CST_SPC*2;
\r
2521 US_Print(STR_CFIRE);
\r
2522 PrintX=CST_START-16+CST_SPC*3;
\r
2523 US_Print(STR_CSTRAFE"\n");
\r
2526 US_Print(STR_CRUN);
\r
2527 PrintX=CST_START+CST_SPC*1;
\r
2528 US_Print(STR_COPEN);
\r
2529 PrintX=CST_START+CST_SPC*2;
\r
2530 US_Print(STR_CFIRE);
\r
2531 PrintX=CST_START+CST_SPC*3;
\r
2532 US_Print(STR_CSTRAFE"\n");
\r
2534 DrawWindow(5,PrintY-1,310,13,BKGDCOLOR);
\r
2543 SETFONTCOLOR(READCOLOR,BKGDCOLOR);
\r
2544 US_CPrint("Keyboard\n");
\r
2548 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
2550 PrintX=CST_START-16;
\r
2551 US_Print(STR_CRUN);
\r
2552 PrintX=CST_START-16+CST_SPC*1;
\r
2553 US_Print(STR_COPEN);
\r
2554 PrintX=CST_START-16+CST_SPC*2;
\r
2555 US_Print(STR_CFIRE);
\r
2556 PrintX=CST_START-16+CST_SPC*3;
\r
2557 US_Print(STR_CSTRAFE"\n");
\r
2560 US_Print(STR_CRUN);
\r
2561 PrintX=CST_START+CST_SPC*1;
\r
2562 US_Print(STR_COPEN);
\r
2563 PrintX=CST_START+CST_SPC*2;
\r
2564 US_Print(STR_CFIRE);
\r
2565 PrintX=CST_START+CST_SPC*3;
\r
2566 US_Print(STR_CSTRAFE"\n");
\r
2568 DrawWindow(5,PrintY-1,310,13,BKGDCOLOR);
\r
2574 // KEYBOARD MOVE KEYS
\r
2576 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
2579 US_Print(STR_LEFT);
\r
2581 US_Print(STR_RIGHT);
\r
2583 US_Print(STR_FRWD);
\r
2585 US_Print(STR_BKWD"\n");
\r
2588 US_Print(STR_LEFT);
\r
2589 PrintX=CST_START+CST_SPC*1;
\r
2590 US_Print(STR_RIGHT);
\r
2591 PrintX=CST_START+CST_SPC*2;
\r
2592 US_Print(STR_FRWD);
\r
2593 PrintX=CST_START+CST_SPC*3;
\r
2594 US_Print(STR_BKWD"\n");
\r
2596 DrawWindow(5,PrintY-1,310,13,BKGDCOLOR);
\r
2600 // PICK STARTING POINT IN MENU
\r
2602 if (CusItems.curpos<0)
\r
2603 for (i=0;i<CusItems.amount;i++)
\r
2604 if (CusMenu[i].active)
\r
2606 CusItems.curpos=i;
\r
2611 VW_UpdateScreen();
\r
2616 void PrintCustMouse(int i)
\r
2621 if (order[i]==buttonmouse[j])
\r
2623 PrintX=CST_START+CST_SPC*i;
\r
2624 US_Print(mbarray[j]);
\r
2629 void DrawCustMouse(int hilight)
\r
2637 SETFONTCOLOR(color,BKGDCOLOR);
\r
2639 if (!mouseenabled)
\r
2641 SETFONTCOLOR(DEACTIVE,BKGDCOLOR);
\r
2642 CusMenu[0].active=0;
\r
2645 CusMenu[0].active=1;
\r
2647 PrintY=CST_Y+13*2;
\r
2649 PrintCustMouse(i);
\r
2652 void PrintCustJoy(int i)
\r
2657 if (order[i]==buttonjoy[j])
\r
2659 PrintX=CST_START+CST_SPC*i;
\r
2660 US_Print(mbarray[j]);
\r
2665 void DrawCustJoy(int hilight)
\r
2673 SETFONTCOLOR(color,BKGDCOLOR);
\r
2675 if (!joystickenabled)
\r
2677 SETFONTCOLOR(DEACTIVE,BKGDCOLOR);
\r
2678 CusMenu[3].active=0;
\r
2681 CusMenu[3].active=1;
\r
2683 PrintY=CST_Y+13*5;
\r
2689 void PrintCustKeybd(int i)
\r
2691 PrintX=CST_START+CST_SPC*i;
\r
2692 US_Print(IN_GetScanName(buttonscan[order[i]]));
\r
2695 void DrawCustKeybd(int hilight)
\r
2703 SETFONTCOLOR(color,BKGDCOLOR);
\r
2705 PrintY=CST_Y+13*8;
\r
2707 PrintCustKeybd(i);
\r
2710 void PrintCustKeys(int i)
\r
2712 PrintX=CST_START+CST_SPC*i;
\r
2713 US_Print(IN_GetScanName(dirscan[moveorder[i]]));
\r
2716 void DrawCustKeys(int hilight)
\r
2724 SETFONTCOLOR(color,BKGDCOLOR);
\r
2726 PrintY=CST_Y+13*10;
\r
2732 ////////////////////////////////////////////////////////////////////
\r
2734 // CHANGE SCREEN VIEWING SIZE
\r
2736 ////////////////////////////////////////////////////////////////////
\r
2737 void CP_ChangeView(void)
\r
2739 int exit=0,oldview,newview;
\r
2743 WindowX=WindowY=0;
\r
2746 newview=oldview=viewwidth/16;
\r
2747 DrawChangeView(oldview);
\r
2752 ReadAnyControl(&ci);
\r
2760 ShowViewSize(newview);
\r
2761 VW_UpdateScreen();
\r
2762 SD_PlaySound(HITWALLSND);
\r
2771 ShowViewSize(newview);
\r
2772 VW_UpdateScreen();
\r
2773 SD_PlaySound(HITWALLSND);
\r
2779 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))
\r
2781 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("debugmode"))
\r
2785 if (ci.button0 || Keyboard[sc_Enter])
\r
2788 if (ci.button1 || Keyboard[sc_Escape])
\r
2790 viewwidth=oldview*16;
\r
2791 SD_PlaySound(ESCPRESSEDSND);
\r
2799 if (oldview!=newview)
\r
2801 SD_PlaySound (SHOOTSND);
\r
2802 Message(STR_THINK"...");
\r
2803 NewViewSize(newview);
\r
2811 /////////////////////////////
\r
2813 // DRAW THE CHANGEVIEW SCREEN
\r
2815 void DrawChangeView(int view)
\r
2818 CA_CacheScreen(S_CHANGEPIC);
\r
2820 ShowViewSize(view);
\r
2822 VWB_Bar(0,160,320,40,VIEWCOLOR);
\r
2823 ShowViewSize(view);
\r
2828 SETFONTCOLOR(HIGHLIGHT,BKGDCOLOR);
\r
2830 US_CPrint(STR_SIZE1"\n");
\r
2831 US_CPrint(STR_SIZE2"\n");
\r
2832 US_CPrint(STR_SIZE3);
\r
2834 VW_UpdateScreen();
\r
2840 ////////////////////////////////////////////////////////////////////
\r
2842 // QUIT THIS INFERNAL GAME!
\r
2844 ////////////////////////////////////////////////////////////////////
\r
2845 void CP_Quit(void)
\r
2851 if (GetYorN(7,11,C_QUITMSGPIC))
\r
2855 if (Confirm(ENDGAMESTR))
\r
2857 if (Confirm(endStrings[US_RndT()&0x7+(US_RndT()&1)]))
\r
2862 VW_UpdateScreen();
\r
2867 // SHUT-UP THE ADLIB
\r
2869 for (i=1;i<=0xf5;i++)
\r
2878 ////////////////////////////////////////////////////////////////////
\r
2880 // HANDLE INTRO SCREEN (SYSTEM CONFIG)
\r
2882 ////////////////////////////////////////////////////////////////////
\r
2883 void IntroScreen(void)
\r
2887 #define MAINCOLOR 0x4f
\r
2888 #define EMSCOLOR 0x4f
\r
2889 #define XMSCOLOR 0x4f
\r
2893 #define MAINCOLOR 0x6c
\r
2894 #define EMSCOLOR 0x6c
\r
2895 #define XMSCOLOR 0x6c
\r
2898 #define FILLCOLOR 14
\r
2900 long memory,emshere,xmshere;
\r
2901 int i,num,ems[10]={100,200,300,400,500,600,700,800,900,1000},
\r
2902 xms[10]={100,200,300,400,500,600,700,800,900,1000},
\r
2903 main[10]={32,64,96,128,160,192,224,256,288,320};
\r
2907 // DRAW MAIN MEMORY
\r
2909 memory=(1023l+mminfo.nearheap+mminfo.farheap)/1024l;
\r
2910 for (i=0;i<10;i++)
\r
2911 if (memory>=main[i])
\r
2912 VWB_Bar(49,163-8*i,6,5,MAINCOLOR-i);
\r
2916 // DRAW EMS MEMORY
\r
2920 emshere=4l*EMSPagesAvail;
\r
2921 for (i=0;i<10;i++)
\r
2922 if (emshere>=ems[i])
\r
2923 VWB_Bar(89,163-8*i,6,5,EMSCOLOR-i);
\r
2927 // DRAW XMS MEMORY
\r
2931 xmshere=4l*XMSPagesAvail;
\r
2932 for (i=0;i<10;i++)
\r
2933 if (xmshere>=xms[i])
\r
2934 VWB_Bar(129,163-8*i,6,5,XMSCOLOR-i);
\r
2941 VWB_Bar(164,82,12,2,FILLCOLOR);
\r
2943 if (JoysPresent[0] || JoysPresent[1])
\r
2944 VWB_Bar(164,105,12,2,FILLCOLOR);
\r
2946 if (AdLibPresent && !SoundBlasterPresent)
\r
2947 VWB_Bar(164,128,12,2,FILLCOLOR);
\r
2949 if (SoundBlasterPresent)
\r
2950 VWB_Bar(164,151,12,2,FILLCOLOR);
\r
2952 if (SoundSourcePresent)
\r
2953 VWB_Bar(164,174,12,2,FILLCOLOR);
\r
2957 ////////////////////////////////////////////////////////////////////
\r
2958 ////////////////////////////////////////////////////////////////////
\r
2960 // SUPPORT ROUTINES
\r
2962 ////////////////////////////////////////////////////////////////////
\r
2963 ////////////////////////////////////////////////////////////////////
\r
2965 ////////////////////////////////////////////////////////////////////
\r
2967 // Clear Menu screens to dark red
\r
2969 ////////////////////////////////////////////////////////////////////
\r
2970 void ClearMScreen(void)
\r
2973 VWB_Bar(0,0,320,200,BORDCOLOR);
\r
2975 VWB_DrawPic(0,0,C_BACKDROPPIC);
\r
2980 ////////////////////////////////////////////////////////////////////
\r
2982 // Un/Cache a LUMP of graphics
\r
2984 ////////////////////////////////////////////////////////////////////
\r
2985 void CacheLump(int lumpstart,int lumpend)
\r
2989 for (i=lumpstart;i<=lumpend;i++)
\r
2990 CA_CacheGrChunk(i);
\r
2994 void UnCacheLump(int lumpstart,int lumpend)
\r
2998 for (i=lumpstart;i<=lumpend;i++)
\r
3000 UNCACHEGRCHUNK(i);
\r
3004 ////////////////////////////////////////////////////////////////////
\r
3006 // Draw a window for a menu
\r
3008 ////////////////////////////////////////////////////////////////////
\r
3009 void DrawWindow(int x,int y,int w,int h,int wcolor)
\r
3011 VWB_Bar(x,y,w,h,wcolor);
\r
3012 DrawOutline(x,y,w,h,BORD2COLOR,DEACTIVE);
\r
3016 void DrawOutline(int x,int y,int w,int h,int color1,int color2)
\r
3018 VWB_Hlin(x,x+w,y,color2);
\r
3019 VWB_Vlin(y,y+h,x,color2);
\r
3020 VWB_Hlin(x,x+w,y+h,color1);
\r
3021 VWB_Vlin(y,y+h,x+w,color1);
\r
3025 ////////////////////////////////////////////////////////////////////
\r
3027 // Setup Control Panel stuff - graphics, etc.
\r
3029 ////////////////////////////////////////////////////////////////////
\r
3030 void SetupControlPanel(void)
\r
3038 // CACHE GRAPHICS & SOUNDS
\r
3040 CA_CacheGrChunk(STARTFONT+1);
\r
3042 CacheLump(CONTROLS_LUMP_START,CONTROLS_LUMP_END);
\r
3044 CacheLump(BACKDROP_LUMP_START,BACKDROP_LUMP_END);
\r
3047 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
3052 CA_LoadAllSounds();
\r
3054 MainMenu[savegame].active=1;
\r
3057 // SEE WHICH SAVE GAME FILES ARE AVAILABLE & READ STRING IN
\r
3059 strcpy(name,SaveName);
\r
3060 if (!findfirst(name,&f,0))
\r
3063 which=f.ff_name[7]-'0';
\r
3069 SaveGamesAvail[which]=1;
\r
3070 handle=open(f.ff_name,O_BINARY);
\r
3071 read(handle,temp,32);
\r
3073 strcpy(&SaveGameNames[which][0],temp);
\r
3075 } while(!findnext(&f));
\r
3085 ////////////////////////////////////////////////////////////////////
\r
3087 // Clean up all the Control Panel stuff
\r
3089 ////////////////////////////////////////////////////////////////////
\r
3090 void CleanupControlPanel(void)
\r
3093 UnCacheLump(CONTROLS_LUMP_START,CONTROLS_LUMP_END);
\r
3095 UnCacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
\r
3102 ////////////////////////////////////////////////////////////////////
\r
3104 // Handle moving gun around a menu
\r
3106 ////////////////////////////////////////////////////////////////////
\r
3107 int HandleMenu(CP_iteminfo *item_i,CP_itemtype far *items,void (*routine)(int w))
\r
3110 static int redrawitem=1,lastitem=-1;
\r
3111 int i,x,y,basey,exit,which,shape,timer;
\r
3115 which=item_i->curpos;
\r
3117 basey=item_i->y-2;
\r
3120 VWB_DrawPic(x,y,C_CURSOR1PIC);
\r
3121 SetTextColor(items+which,1);
\r
3124 PrintX=item_i->x+item_i->indent;
\r
3125 PrintY=item_i->y+which*13;
\r
3126 US_Print((items+which)->string);
\r
3129 // CALL CUSTOM ROUTINE IF IT IS NEEDED
\r
3133 VW_UpdateScreen();
\r
3135 shape=C_CURSOR1PIC;
\r
3139 IN_ClearKeysDown();
\r
3145 // CHANGE GUN SHAPE
\r
3147 if (TimeCount>timer)
\r
3150 if (shape==C_CURSOR1PIC)
\r
3152 shape=C_CURSOR2PIC;
\r
3157 shape=C_CURSOR1PIC;
\r
3160 VWB_DrawPic(x,y,shape);
\r
3163 VW_UpdateScreen();
\r
3169 // SEE IF ANY KEYS ARE PRESSED FOR INITIAL CHAR FINDING
\r
3177 // CHECK FOR SCREEN CAPTURE
\r
3180 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))
\r
3182 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("debugmode"))
\r
3190 for (i=which+1;i<item_i->amount;i++)
\r
3191 if ((items+i)->active && (items+i)->string[0]==key)
\r
3193 EraseGun(item_i,items,x,y,which);
\r
3195 DrawGun(item_i,items,x,&y,which,basey,routine);
\r
3197 IN_ClearKeysDown();
\r
3202 // DIDN'T FIND A MATCH FIRST TIME THRU. CHECK AGAIN.
\r
3206 for (i=0;i<which;i++)
\r
3207 if ((items+i)->active && (items+i)->string[0]==key)
\r
3209 EraseGun(item_i,items,x,y,which);
\r
3211 DrawGun(item_i,items,x,&y,which,basey,routine);
\r
3212 IN_ClearKeysDown();
\r
3221 ReadAnyControl(&ci);
\r
3224 ////////////////////////////////////////////////
\r
3230 EraseGun(item_i,items,x,y,which);
\r
3233 // ANIMATE HALF-STEP
\r
3235 if (which && (items+which-1)->active)
\r
3238 DrawHalfStep(x,y);
\r
3242 // MOVE TO NEXT AVAILABLE SPOT
\r
3247 which=item_i->amount-1;
\r
3250 } while(!(items+which)->active);
\r
3252 DrawGun(item_i,items,x,&y,which,basey,routine);
\r
3254 // WAIT FOR BUTTON-UP OR DELAY NEXT MOVE
\r
3259 ////////////////////////////////////////////////
\r
3265 EraseGun(item_i,items,x,y,which);
\r
3267 // ANIMATE HALF-STEP
\r
3269 if (which!=item_i->amount-1 && (items+which+1)->active)
\r
3272 DrawHalfStep(x,y);
\r
3277 if (which==item_i->amount-1)
\r
3281 } while(!(items+which)->active);
\r
3283 DrawGun(item_i,items,x,&y,which,basey,routine);
\r
3286 // WAIT FOR BUTTON-UP OR DELAY NEXT MOVE
\r
3293 Keyboard[sc_Space] ||
\r
3294 Keyboard[sc_Enter])
\r
3298 Keyboard[sc_Escape])
\r
3304 IN_ClearKeysDown();
\r
3307 // ERASE EVERYTHING
\r
3309 if (lastitem!=which)
\r
3311 VWB_Bar(x-1,y,25,16,BKGDCOLOR);
\r
3312 PrintX=item_i->x+item_i->indent;
\r
3313 PrintY=item_i->y+which*13;
\r
3314 US_Print((items+which)->string);
\r
3322 VW_UpdateScreen();
\r
3324 item_i->curpos=which;
\r
3331 // CALL THE ROUTINE
\r
3333 if ((items+which)->routine!=NULL)
\r
3337 (items+which)->routine(0);
\r
3342 SD_PlaySound(ESCPRESSEDSND);
\r
3346 return 0; // JUST TO SHUT UP THE ERROR MESSAGES!
\r
3351 // ERASE GUN & DE-HIGHLIGHT STRING
\r
3353 void EraseGun(CP_iteminfo *item_i,CP_itemtype far *items,int x,int y,int which)
\r
3355 VWB_Bar(x-1,y,25,16,BKGDCOLOR);
\r
3356 SetTextColor(items+which,0);
\r
3358 PrintX=item_i->x+item_i->indent;
\r
3359 PrintY=item_i->y+which*13;
\r
3360 US_Print((items+which)->string);
\r
3361 VW_UpdateScreen();
\r
3366 // DRAW HALF STEP OF GUN TO NEXT POSITION
\r
3368 void DrawHalfStep(int x,int y)
\r
3370 VWB_DrawPic(x,y,C_CURSOR1PIC);
\r
3371 VW_UpdateScreen();
\r
3372 SD_PlaySound(MOVEGUN1SND);
\r
3374 while(TimeCount<8);
\r
3379 // DRAW GUN AT NEW POSITION
\r
3381 void DrawGun(CP_iteminfo *item_i,CP_itemtype far *items,int x,int *y,int which,int basey,void (*routine)(int w))
\r
3383 VWB_Bar(x-1,*y,25,16,BKGDCOLOR);
\r
3384 *y=basey+which*13;
\r
3385 VWB_DrawPic(x,*y,C_CURSOR1PIC);
\r
3386 SetTextColor(items+which,1);
\r
3388 PrintX=item_i->x+item_i->indent;
\r
3389 PrintY=item_i->y+which*13;
\r
3390 US_Print((items+which)->string);
\r
3393 // CALL CUSTOM ROUTINE IF IT IS NEEDED
\r
3397 VW_UpdateScreen();
\r
3398 SD_PlaySound(MOVEGUN2SND);
\r
3401 ////////////////////////////////////////////////////////////////////
\r
3403 // DELAY FOR AN AMOUNT OF TICS OR UNTIL CONTROLS ARE INACTIVE
\r
3405 ////////////////////////////////////////////////////////////////////
\r
3406 void TicDelay(int count)
\r
3414 ReadAnyControl(&ci);
\r
3415 } while(TimeCount<count && ci.dir!=dir_None);
\r
3419 ////////////////////////////////////////////////////////////////////
\r
3423 ////////////////////////////////////////////////////////////////////
\r
3424 void DrawMenu(CP_iteminfo *item_i,CP_itemtype far *items)
\r
3426 int i,which=item_i->curpos;
\r
3429 WindowX=PrintX=item_i->x+item_i->indent;
\r
3430 WindowY=PrintY=item_i->y;
\r
3434 for (i=0;i<item_i->amount;i++)
\r
3436 SetTextColor(items+i,which==i);
\r
3438 PrintY=item_i->y+i*13;
\r
3439 if ((items+i)->active)
\r
3440 US_Print((items+i)->string);
\r
3443 SETFONTCOLOR(DEACTIVE,BKGDCOLOR);
\r
3444 US_Print((items+i)->string);
\r
3445 SETFONTCOLOR(TEXTCOLOR,BKGDCOLOR);
\r
3453 ////////////////////////////////////////////////////////////////////
\r
3455 // SET TEXT COLOR (HIGHLIGHT OR NO)
\r
3457 ////////////////////////////////////////////////////////////////////
\r
3458 void SetTextColor(CP_itemtype far *items,int hlight)
\r
3461 {SETFONTCOLOR(color_hlite[items->active],BKGDCOLOR);}
\r
3463 {SETFONTCOLOR(color_norml[items->active],BKGDCOLOR);}
\r
3467 ////////////////////////////////////////////////////////////////////
\r
3469 // WAIT FOR CTRLKEY-UP OR BUTTON-UP
\r
3471 ////////////////////////////////////////////////////////////////////
\r
3472 void WaitKeyUp(void)
\r
3475 while(ReadAnyControl(&ci), ci.button0|
\r
3479 Keyboard[sc_Space]|
\r
3480 Keyboard[sc_Enter]|
\r
3481 Keyboard[sc_Escape]);
\r
3485 ////////////////////////////////////////////////////////////////////
\r
3487 // READ KEYBOARD, JOYSTICK AND MOUSE FOR INPUT
\r
3489 ////////////////////////////////////////////////////////////////////
\r
3490 void ReadAnyControl(ControlInfo *ci)
\r
3492 int mouseactive=0;
\r
3495 IN_ReadControl(0,ci);
\r
3499 int mousey,mousex;
\r
3502 // READ MOUSE MOTION COUNTERS
\r
3503 // RETURN DIRECTION
\r
3505 // CHECK MOUSE BUTTONS
\r
3511 if (mousey<CENTER-SENSITIVE)
\r
3513 ci->dir=dir_North;
\r
3519 if (mousey>CENTER+SENSITIVE)
\r
3521 ci->dir=dir_South;
\r
3527 if (mousex<CENTER-SENSITIVE)
\r
3535 if (mousex>CENTER+SENSITIVE)
\r
3543 if (IN_MouseButtons())
\r
3545 ci->button0=IN_MouseButtons()&1;
\r
3546 ci->button1=IN_MouseButtons()&2;
\r
3547 ci->button2=IN_MouseButtons()&4;
\r
3548 ci->button3=false;
\r
3553 if (joystickenabled && !mouseactive)
\r
3558 INL_GetJoyDelta(joystickport,&jx,&jy);
\r
3559 if (jy<-SENSITIVE)
\r
3560 ci->dir=dir_North;
\r
3563 ci->dir=dir_South;
\r
3565 if (jx<-SENSITIVE)
\r
3571 jb=IN_JoyButtons();
\r
3576 if (joypadenabled)
\r
3582 ci->button2=ci->button3=false;
\r
3588 ////////////////////////////////////////////////////////////////////
\r
3590 // DRAW DIALOG AND CONFIRM YES OR NO TO QUESTION
\r
3592 ////////////////////////////////////////////////////////////////////
\r
3593 int Confirm(char far *string)
\r
3595 int xit=0,i,x,y,tick=0,time,whichsnd[2]={ESCPRESSEDSND,SHOOTSND};
\r
3599 IN_ClearKeysDown();
\r
3610 if (TimeCount>=10)
\r
3615 VWB_Bar(x,y,8,13,TEXTCOLOR);
\r
3622 VW_UpdateScreen();
\r
3628 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))
\r
3633 } while(!Keyboard[sc_S] && !Keyboard[sc_N] && !Keyboard[sc_Escape]);
\r
3635 } while(!Keyboard[sc_Y] && !Keyboard[sc_N] && !Keyboard[sc_Escape]);
\r
3639 if (Keyboard[sc_S])
\r
3645 while(Keyboard[sc_S] || Keyboard[sc_N] || Keyboard[sc_Escape]);
\r
3649 if (Keyboard[sc_Y])
\r
3655 while(Keyboard[sc_Y] || Keyboard[sc_N] || Keyboard[sc_Escape]);
\r
3658 IN_ClearKeysDown();
\r
3659 SD_PlaySound(whichsnd[xit]);
\r
3664 ////////////////////////////////////////////////////////////////////
\r
3666 // DRAW MESSAGE & GET Y OR N
\r
3668 ////////////////////////////////////////////////////////////////////
\r
3669 int GetYorN(int x,int y,int pic)
\r
3671 int xit=0,whichsnd[2]={ESCPRESSEDSND,SHOOTSND};
\r
3674 CA_CacheGrChunk(pic);
\r
3675 VWB_DrawPic(x * 8,y * 8,pic);
\r
3676 UNCACHEGRCHUNK(pic);
\r
3677 VW_UpdateScreen();
\r
3678 IN_ClearKeysDown();
\r
3683 if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))
\r
3688 } while(!Keyboard[sc_S] && !Keyboard[sc_N] && !Keyboard[sc_Escape]);
\r
3690 } while(!Keyboard[sc_Y] && !Keyboard[sc_N] && !Keyboard[sc_Escape]);
\r
3694 if (Keyboard[sc_S])
\r
3700 while(Keyboard[sc_S] || Keyboard[sc_N] || Keyboard[sc_Escape]);
\r
3704 if (Keyboard[sc_Y])
\r
3710 while(Keyboard[sc_Y] || Keyboard[sc_N] || Keyboard[sc_Escape]);
\r
3713 IN_ClearKeysDown();
\r
3714 SD_PlaySound(whichsnd[xit]);
\r
3720 ////////////////////////////////////////////////////////////////////
\r
3722 // PRINT A MESSAGE IN A WINDOW
\r
3724 ////////////////////////////////////////////////////////////////////
\r
3725 void Message(char far *string)
\r
3727 int h=0,w=0,mw=0,i,x,y,time;
\r
3728 fontstruct _seg *font;
\r
3731 CA_CacheGrChunk (STARTFONT+1);
\r
3733 font=grsegs[STARTFONT+fontnumber];
\r
3735 for (i=0;i<_fstrlen(string);i++)
\r
3736 if (string[i]=='\n')
\r
3744 w+=font->width[string[i]];
\r
3749 PrintY=(WindowH/2)-h/2;
\r
3750 PrintX=WindowX=160-mw/2;
\r
3752 DrawWindow(WindowX-5,PrintY-5,mw+10,h+10,TEXTCOLOR);
\r
3753 DrawOutline(WindowX-5,PrintY-5,mw+10,h+10,0,HIGHLIGHT);
\r
3754 SETFONTCOLOR(0,TEXTCOLOR);
\r
3756 VW_UpdateScreen();
\r
3760 ////////////////////////////////////////////////////////////////////
\r
3762 // THIS MAY BE FIXED A LITTLE LATER...
\r
3764 ////////////////////////////////////////////////////////////////////
\r
3765 static int lastmusic;
\r
3767 void StartCPMusic(int song)
\r
3771 if (audiosegs[STARTMUSIC + lastmusic]) // JDC
\r
3772 MM_FreePtr ((memptr *)&audiosegs[STARTMUSIC + lastmusic]);
\r
3778 MM_BombOnError (false);
\r
3779 CA_CacheAudioChunk(STARTMUSIC + chunk);
\r
3780 MM_BombOnError (true);
\r
3785 MM_SetLock(&((memptr)audiosegs[STARTMUSIC + chunk]),true);
\r
3786 SD_StartMusic((MusicGroup far *)audiosegs[STARTMUSIC + chunk]);
\r
3790 void FreeMusic (void)
\r
3792 if (audiosegs[STARTMUSIC + lastmusic]) // JDC
\r
3793 MM_FreePtr ((memptr *)&audiosegs[STARTMUSIC + lastmusic]);
\r
3797 ///////////////////////////////////////////////////////////////////////////
\r
3799 // IN_GetScanName() - Returns a string containing the name of the
\r
3800 // specified scan code
\r
3802 ///////////////////////////////////////////////////////////////////////////
\r
3804 IN_GetScanName(ScanCode scan)
\r
3809 for (s = ExtScanCodes,p = ExtScanNames;*s;p++,s++)
\r
3813 return(ScanNames[scan]);
\r
3817 ///////////////////////////////////////////////////////////////////////////
\r
3819 // CHECK FOR PAUSE KEY (FOR MUSIC ONLY)
\r
3821 ///////////////////////////////////////////////////////////////////////////
\r
3822 void CheckPause(void)
\r
3826 switch(SoundStatus)
\r
3828 case 0: SD_MusicOn(); break;
\r
3829 case 1: SD_MusicOff(); break;
\r
3834 IN_ClearKeysDown();
\r
3840 ///////////////////////////////////////////////////////////////////////////
\r
3842 // DRAW GUN CURSOR AT CORRECT POSITION IN MENU
\r
3844 ///////////////////////////////////////////////////////////////////////////
\r
3845 void DrawMenuGun(CP_iteminfo *iteminfo)
\r
3851 y=iteminfo->y+iteminfo->curpos*13-2;
\r
3852 VWB_DrawPic(x,y,C_CURSOR1PIC);
\r
3856 ///////////////////////////////////////////////////////////////////////////
\r
3858 // DRAW SCREEN TITLE STRIPES
\r
3860 ///////////////////////////////////////////////////////////////////////////
\r
3861 void DrawStripes(int y)
\r
3864 VWB_Bar(0,y,320,24,0);
\r
3865 VWB_Hlin(0,319,y+22,STRIPE);
\r
3867 VWB_Bar(0,y,320,22,0);
\r
3868 VWB_Hlin(0,319,y+23,0);
\r
3872 void ShootSnd(void)
\r
3874 SD_PlaySound(SHOOTSND);
\r
3878 ///////////////////////////////////////////////////////////////////////////
\r
3880 // CHECK FOR EPISODES
\r
3882 ///////////////////////////////////////////////////////////////////////////
\r
3883 void CheckForEpisodes(void)
\r
3888 // JAPANESE VERSION
\r
3892 if (!findfirst("*.WJ1",&f,FA_ARCH))
\r
3894 strcpy(extension,"WJ1");
\r
3896 if (!findfirst("*.WJ6",&f,FA_ARCH))
\r
3898 strcpy(extension,"WJ6");
\r
3900 strcat(configname,extension);
\r
3901 strcat(SaveName,extension);
\r
3902 strcat(PageFileName,extension);
\r
3903 strcat(audioname,extension);
\r
3904 strcat(demoname,extension);
\r
3905 EpisodeSelect[1] =
\r
3906 EpisodeSelect[2] =
\r
3907 EpisodeSelect[3] =
\r
3908 EpisodeSelect[4] =
\r
3909 EpisodeSelect[5] = 1;
\r
3912 Quit("NO JAPANESE WOLFENSTEIN 3-D DATA FILES to be found!");
\r
3920 if (!findfirst("*.WL6",&f,FA_ARCH))
\r
3922 strcpy(extension,"WL6");
\r
3923 NewEmenu[2].active =
\r
3924 NewEmenu[4].active =
\r
3925 NewEmenu[6].active =
\r
3926 NewEmenu[8].active =
\r
3927 NewEmenu[10].active =
\r
3928 EpisodeSelect[1] =
\r
3929 EpisodeSelect[2] =
\r
3930 EpisodeSelect[3] =
\r
3931 EpisodeSelect[4] =
\r
3932 EpisodeSelect[5] = 1;
\r
3935 if (!findfirst("*.WL3",&f,FA_ARCH))
\r
3937 strcpy(extension,"WL3");
\r
3938 NewEmenu[2].active =
\r
3939 NewEmenu[4].active =
\r
3940 EpisodeSelect[1] =
\r
3941 EpisodeSelect[2] = 1;
\r
3951 if (!findfirst("*.SOD",&f,FA_ARCH))
\r
3953 strcpy(extension,"SOD");
\r
3956 Quit("NO SPEAR OF DESTINY DATA FILES TO BE FOUND!");
\r
3958 if (!findfirst("*.SDM",&f,FA_ARCH))
\r
3960 strcpy(extension,"SDM");
\r
3963 Quit("NO SPEAR OF DESTINY DEMO DATA FILES TO BE FOUND!");
\r
3967 if (!findfirst("*.WL1",&f,FA_ARCH))
\r
3969 strcpy(extension,"WL1");
\r
3972 Quit("NO WOLFENSTEIN 3-D DATA FILES to be found!");
\r
3975 strcat(configname,extension);
\r
3976 strcat(SaveName,extension);
\r
3977 strcat(PageFileName,extension);
\r
3978 strcat(audioname,extension);
\r
3979 strcat(demoname,extension);
\r
3982 strcat(helpfilename,extension);
\r
3984 strcat(endfilename,extension);
\r