📄 m_menu.c
字号:
//
void M_DoSave(int slot)
{
G_SaveGame (slot,savegamestrings[slot]);
M_ClearMenus ();
// PICK QUICKSAVE SLOT YET?
if (quickSaveSlot == -2)
quickSaveSlot = slot;
}
//
// User wants to save. Start string input for M_Responder
//
void M_SaveSelect(int choice)
{
// we are going to be intercepting all chars
saveStringEnter = 1;
saveSlot = choice;
strcpy(saveOldString,savegamestrings[choice]);
if (!strcmp(savegamestrings[choice],EMPTYSTRING))
savegamestrings[choice][0] = 0;
saveCharIndex = strlen(savegamestrings[choice]);
}
//
// Selected from DOOM menu
//
void M_SaveGame (int choice)
{
if (!usergame)
{
M_StartMessage(SAVEDEAD,NULL,false);
return;
}
if (gamestate != GS_LEVEL)
return;
M_SetupNextMenu(&SaveDef);
M_ReadSaveStrings();
}
//
// M_QuickSave
//
char tempstring[80];
void M_QuickSaveResponse(int ch)
{
if (ch == KEY_Y)
{
M_DoSave(quickSaveSlot);
S_StartSound(NULL,sfx_swtchx);
}
}
void M_QuickSave(void)
{
if (!usergame)
{
S_StartSound(NULL,sfx_oof);
return;
}
if (gamestate != GS_LEVEL)
return;
if (quickSaveSlot < 0)
{
M_StartControlPanel();
M_ReadSaveStrings();
M_SetupNextMenu(&SaveDef);
quickSaveSlot = -2; // means to pick a slot now
return;
}
sprintf(tempstring,QSPROMPT,savegamestrings[quickSaveSlot]);
M_StartMessage(tempstring,M_QuickSaveResponse,true);
}
//
// M_QuickLoad
//
void M_QuickLoadResponse(int ch)
{
if (ch == KEY_Y)
{
M_LoadSelect(quickSaveSlot);
S_StartSound(NULL,sfx_swtchx);
}
}
void M_QuickLoad(void)
{
if (netgame)
{
M_StartMessage(QLOADNET,NULL,false);
return;
}
if (quickSaveSlot < 0)
{
M_StartMessage(QSAVESPOT,NULL,false);
return;
}
sprintf(tempstring,QLPROMPT,savegamestrings[quickSaveSlot]);
M_StartMessage(tempstring,M_QuickLoadResponse,true);
}
//
// Read This Menus
// Had a "quick hack to fix romero bug"
//
// DQ start addition
void M_DrawReadThis1(int PixelOffset, PBUFFER RenderBuffer)
// DQ end addition
//void M_DrawReadThis1(void)
{
inhelpscreens = true;
switch ( gamemode )
{
case commercial:
V_DrawPatchDirect (((SCREENWIDTH-320)/2)+0 + PixelOffset/*DQ*/,
((SCREENHEIGHT-200)/2)+0,RenderBuffer/*DQ 0*/, W_CacheLumpName("HELP",PU_CACHE));
break;
case shareware:
case registered:
case retail:
V_DrawPatchDirect (((SCREENWIDTH-320)/2)+0 + PixelOffset/*DQ*/,
((SCREENHEIGHT-200)/2)+0,RenderBuffer/*DQ 0*/, W_CacheLumpName("HELP1",PU_CACHE));
break;
default:
break;
}
return;
}
//
// Read This Menus - optional second page.
//
// DQ start addition
void M_DrawReadThis2(int PixelOffset, PBUFFER RenderBuffer)
// DQ end addition
//void M_DrawReadThis2(void)
{
inhelpscreens = true;
switch ( gamemode )
{
case retail:
case commercial:
// This hack keeps us from having to change menus.
V_DrawPatchDirect (((SCREENWIDTH-320)/2)+0 + PixelOffset/*DQ*/,
((SCREENHEIGHT-200)/2)+0,RenderBuffer/*DQ 0*/, W_CacheLumpName("CREDIT",PU_CACHE));
break;
case shareware:
case registered:
V_DrawPatchDirect (((SCREENWIDTH-320)/2)+0 + PixelOffset/*DQ*/,
((SCREENHEIGHT-200)/2)+0,RenderBuffer/*DQ 0*/, W_CacheLumpName("HELP2",PU_CACHE));
break;
default:
break;
}
return;
}
//
// Change Sfx & Music volumes
//
// DQ start addition
void M_DrawSound(int PixelOffset, PBUFFER RenderBuffer)
// DQ end addition
//void M_DrawSound(void)
{
V_DrawPatchDirect (((SCREENWIDTH-320)/2)+60 + PixelOffset/*DQ*/,
((SCREENHEIGHT-200)/2)+38,RenderBuffer/*DQ 0*/, W_CacheLumpName("M_SVOL",PU_CACHE));
M_DrawThermo(SoundDef.x + PixelOffset/*DQ*/,
SoundDef.y+LINEHEIGHT*(sfx_vol+1),
16,snd_SfxVolume, RenderBuffer/*DQ*/);
M_DrawThermo(SoundDef.x + PixelOffset/*DQ*/,
SoundDef.y+LINEHEIGHT*(music_vol+1),
16,snd_MusicVolume, RenderBuffer/*DQ*/);
}
void M_Sound(int choice)
{
M_SetupNextMenu(&SoundDef);
}
void M_SfxVol(int choice)
{
switch(choice)
{
case 0:
if (snd_SfxVolume)
snd_SfxVolume--;
break;
case 1:
if (snd_SfxVolume < 15)
snd_SfxVolume++;
break;
}
S_SetSfxVolume(snd_SfxVolume /* *8 */);
}
void M_MusicVol(int choice)
{
switch(choice)
{
case 0:
if (snd_MusicVolume)
snd_MusicVolume--;
break;
case 1:
if (snd_MusicVolume < 15)
snd_MusicVolume++;
break;
}
S_SetMusicVolume(snd_MusicVolume /* *8 */);
}
//
// M_DrawMainMenu
//
// DQ start addition
void M_DrawMainMenu(int PixelOffset, PBUFFER RenderBuffer)
// DQ end addition
// void M_DrawMainMenu(void) // original
{
V_DrawPatchDirect (((SCREENWIDTH-320)/2)+94 + PixelOffset/*DQ*/,
((SCREENHEIGHT-200)/2)+2,RenderBuffer/*DQ 0*/, W_CacheLumpName("M_DOOM",PU_CACHE));
}
//
// M_NewGame
//
// DQ start addition
void M_DrawNewGame(int PixelOffset, PBUFFER RenderBuffer)
//void M_DrawNewGame(void)
{
V_DrawPatchDirect (((SCREENWIDTH-320)/2)+96 + PixelOffset/*DQ*/,
((SCREENHEIGHT-200)/2)+14,RenderBuffer/*DQ 0*/, W_CacheLumpName("M_NEWG",PU_CACHE));
V_DrawPatchDirect (((SCREENWIDTH-320)/2)+54 + PixelOffset/*DQ*/,
((SCREENHEIGHT-200)/2)+38,RenderBuffer/*DQ 0*/, W_CacheLumpName("M_SKILL",PU_CACHE));
}
void M_NewGame(int choice)
{
if (netgame && !demoplayback)
{
M_StartMessage(NEWGAME,NULL,false);
return;
}
if ( gamemode == commercial )
M_SetupNextMenu(&NewDef);
else
M_SetupNextMenu(&EpiDef);
}
//
// M_Episode
//
int epi;
// DQ start addition
void M_DrawEpisode(int PixelOffset, PBUFFER RenderBuffer)
// DQ end addition
//void M_DrawEpisode(void)
{
V_DrawPatchDirect (((SCREENWIDTH-320)/2)+54 + PixelOffset/*DQ*/,
((SCREENHEIGHT-200)/2)+38,RenderBuffer/*DQ 0*/, W_CacheLumpName("M_EPISOD",PU_CACHE));
}
void M_VerifyNightmare(int ch)
{
if (ch != KEY_Y)
return;
G_DeferedInitNew(nightmare,epi+1,1);
M_ClearMenus ();
}
void M_ChooseSkill(int choice)
{
if (choice == nightmare)
{
M_StartMessage(NIGHTMARE,M_VerifyNightmare,true);
return;
}
G_DeferedInitNew(choice,epi+1,1);
M_ClearMenus ();
}
void M_Episode(int choice)
{
if ( (gamemode == shareware)
&& choice)
{
M_StartMessage(SWSTRING,NULL,false);
M_SetupNextMenu(&ReadDef1);
return;
}
// Yet another hack...
if ( (gamemode == registered)
&& (choice > 2))
{
fprintf( stderr,
"M_Episode: 4th episode requires UltimateDOOM\n");
choice = 0;
}
epi = choice;
M_SetupNextMenu(&NewDef);
}
//
// M_Options
//
char detailNames[2][9] = {"M_GDHIGH","M_GDLOW"};
char msgNames[2][9] = {"M_MSGOFF","M_MSGON"};
// DQ start addition
void M_DrawOptions(int PixelOffset, PBUFFER RenderBuffer)
// DQ end addition
//void M_DrawOptions(void)
{
V_DrawPatchDirect (((SCREENWIDTH-320)/2)+108 + PixelOffset/*DQ*/,
((SCREENHEIGHT-200)/2)+15,RenderBuffer/*DQ 0*/,
W_CacheLumpName("M_OPTTTL",PU_CACHE));
V_DrawPatchDirect (((SCREENWIDTH-320)/2)+OptionsDef.x + 175 + PixelOffset/*DQ*/,
((SCREENHEIGHT-200)/2)+OptionsDef.y+LINEHEIGHT*detail,RenderBuffer/*DQ 0*/,
W_CacheLumpName(detailNames[detailLevel],PU_CACHE));
V_DrawPatchDirect (((SCREENWIDTH-320)/2)+OptionsDef.x + 120 + PixelOffset/*DQ*/,
((SCREENHEIGHT-200)/2)+OptionsDef.y+LINEHEIGHT*messages,RenderBuffer/*DQ 0*/,
W_CacheLumpName(msgNames[showMessages],PU_CACHE));
M_DrawThermo(OptionsDef.x + PixelOffset/*DQ*/,
OptionsDef.y+LINEHEIGHT*(mousesens+1),
10,mouseSensitivity, RenderBuffer/*DQ*/);
M_DrawThermo(OptionsDef.x + PixelOffset/*DQ*/,
OptionsDef.y+LINEHEIGHT*(scrnsize+1),
9,screenSize, RenderBuffer/*DQ*/);
}
void M_Options(int choice)
{
M_SetupNextMenu(&OptionsDef);
}
//
// Toggle messages on/off
//
void M_ChangeMessages(int choice)
{
// warning: unused parameter `int choice'
choice = 0;
showMessages = 1 - showMessages;
if (!showMessages)
players[consoleplayer].message = MSGOFF;
else
players[consoleplayer].message = MSGON ;
message_dontfuckwithme = true;
}
//
// M_EndGame
//
void M_EndGameResponse(int ch)
{
if (ch != KEY_Y)
return;
currentMenu->lastOn = itemOn;
M_ClearMenus ();
D_StartTitle ();
}
void M_EndGame(int choice)
{
choice = 0;
if (!usergame)
{
S_StartSound(NULL,sfx_oof);
return;
}
if (netgame)
{
M_StartMessage(NETEND,NULL,false);
return;
}
M_StartMessage(ENDGAME,M_EndGameResponse,true);
}
//
// M_ReadThis
//
void M_ReadThis(int choice)
{
choice = 0;
M_SetupNextMenu(&ReadDef1);
}
void M_ReadThis2(int choice)
{
choice = 0;
M_SetupNextMenu(&ReadDef2);
}
void M_FinishReadThis(int choice)
{
choice = 0;
M_SetupNextMenu(&MainDef);
}
//
// M_QuitDOOM
//
int quitsounds[8] =
{
sfx_pldeth,
sfx_dmpain,
sfx_popain,
sfx_slop,
sfx_telept,
sfx_posit1,
sfx_posit3,
sfx_sgtatk
};
int quitsounds2[8] =
{
sfx_vilact,
sfx_getpow,
sfx_boscub,
sfx_slop,
sfx_skeswg,
sfx_kntdth,
sfx_bspact,
sfx_sgtatk
};
char MsgText[256];
void M_QuitResponse(int ch)
{
//WriteDebug("M_QuitResponse...\n");
if (ch != KEY_Y)
{
// sprintf(MsgText, "ch = %c - 0x%02X\n", ch, ch );
// WriteDebug(MsgText);
return;
}
if (!netgame)
{
if (gamemode == commercial)
S_StartSound(NULL,quitsounds2[(gametic>>2)&7]);
else
S_StartSound(NULL,quitsounds[(gametic>>2)&7]);
I_WaitVBL(105);
}
I_Quit ();
}
void M_QuitDOOM(int choice)
{
//WriteDebug("M_QuitDoom...\n");
// We pick index 0 which is language sensitive,
// or one at random, between 1 and maximum number.
if (language != english )
sprintf(endstring,"%s\n\n"DOSY, endmsg[0] );
else
sprintf(endstring,"%s\n\n"DOSY, endmsg[ (gametic%(NUM_QUITMESSAGES-10))+1 ]);
M_StartMessage(endstring,M_QuitResponse,true);
}
void M_ChangeSensitivity(int choice)
{
switch(choice)
{
case 0:
if (mouseSensitivity)
mouseSensitivity--;
break;
case 1:
if (mouseSensitivity < 9)
mouseSensitivity++;
break;
}
}
void M_ChangeDetail(int choice)
{
choice = 0;
//detailLevel = 1 - detailLevel;
// FIXME - does not work. Remove anyway?
sprintf( MsgText, "M_ChangeDetail: low detail mode n.a.\n");
WriteDebug(MsgText);
/*
R_SetViewSize (screenblocks, detailLevel);
if (!detailLevel)
players[consoleplayer].message = DETAILHI;
else
players[consoleplayer].message = DETAILLO;
*/
}
void M_SizeDisplay(int choice)
{
switch(choice)
{
case 0:
if (screenSize > 0)
{
screenblocks--;
screenSize--;
}
break;
case 1:
if (screenSize < 8)
{
screenblocks++;
screenSize++;
}
break;
}
R_SetViewSize (screenblocks, detailLevel);
}
//
// Menu Functions
//
void M_DrawThermo
( int x,
int y,
int thermWidth,
int thermDot,
PBUFFER RenderBuffer) //DQ
//void
//M_DrawThermo
//( int x,
// int y,
// int thermWidth,
// int thermDot )
{
int xx;
int i;
xx = x;
V_DrawPatchDirect (((SCREENWIDTH-320)/2)+xx,((SCREENHEIGHT-200)/2)+y,RenderBuffer/*DQ 0*/, W_CacheLumpName("M_THERML",PU_CACHE));
xx += 8;
for (i=0;i<thermWidth;i++)
{
V_DrawPatchDirect (((SCREENWIDTH-320)/2)+xx,((SCREENHEIGHT-200)/2)+y,RenderBuffer/*DQ 0*/, W_CacheLumpName("M_THERMM",PU_CACHE));
xx += 8;
}
V_DrawPatchDirect (((SCREENWIDTH-320)/2)+xx,((SCREENHEIGHT-200)/2)+y,RenderBuffer/*DQ 0*/, W_CacheLumpName("M_THERMR",PU_CACHE));
V_DrawPatchDirect (((SCREENWIDTH-320)/2)+(x+8) + thermDot*8,((SCREENHEIGHT-200)/2)+y,
RenderBuffer/*DQ 0*/, W_CacheLumpName("M_THERMO",PU_CACHE));
}
void
M_DrawEmptyCell
( menu_t* menu,
int item,
PBUFFER RenderBuffer) //DQ
//void
//M_DrawEmptyCell
//( menu_t* menu,
// int item )
{
V_DrawPatchDirect (((SCREENWIDTH-320)/2)+menu->x - 10,((SCREENHEIGHT-200)/2)+menu->y+item*LINEHEIGHT - 1, RenderBuffer/*DQ 0*/,
W_CacheLumpName("M_CELL1",PU_CACHE));
}
void
M_DrawSelCell
( menu_t* menu,
int item,
PBUFFER RenderBuffer) //DQ
//void
//M_DrawSelCell
//( menu_t* menu,
// int item )
{
V_DrawPatchDirect (((SCREENWIDTH-320)/2)+menu->x - 10,((SCREENHEIGHT-200)/2)+menu->y+item*LINEHEIGHT - 1, RenderBuffer/*DQ 0*/,
W_CacheLumpName("M_CELL2",PU_CACHE));
}
void
M_StartMessage
( char* string,
void* routine,
boolean input )
{
//WriteDebug("M_StartMessage...\n");
//WriteDebug(string);
//WriteDebug("\n");
messageLastMenuActive = menuactive;
messageToPrint = 1;
messageString = string;
messageRoutine = routine;
messageNeedsInput = input;
menuactive = true;
return;
}
void M_StopMessage(void)
{
menuactive = messageLastMenuActive;
messageToPrint = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -