⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 m_menu.c

📁 PIXIL is a small footprint operating environment, complete with PDA PIM applications, a browser and
💻 C
📖 第 1 页 / 共 3 页
字号:
{    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 == '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 == '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"//void M_DrawReadThis1(void){    inhelpscreens = true;    switch ( gamemode )    {      case commercial:	V_DrawPatchDirect (0,0,0,W_CacheLumpName("HELP",PU_CACHE));	break;      case shareware:      case registered:      case retail:	V_DrawPatchDirect (0,0,0,W_CacheLumpName("HELP1",PU_CACHE));	break;      default:	break;    }    return;}//// Read This Menus - optional second page.//void M_DrawReadThis2(void){    inhelpscreens = true;    switch ( gamemode )    {      case retail:      case commercial:	// This hack keeps us from having to change menus.	V_DrawPatchDirect (0,0,0,W_CacheLumpName("CREDIT",PU_CACHE));	break;      case shareware:      case registered:	V_DrawPatchDirect (0,0,0,W_CacheLumpName("HELP2",PU_CACHE));	break;      default:	break;    }    return;}//// Change Sfx & Music volumes//void M_DrawSound(void){    V_DrawPatchDirect (60,38,0,W_CacheLumpName("M_SVOL",PU_CACHE));    M_DrawThermo(SoundDef.x,SoundDef.y+LINEHEIGHT*(sfx_vol+1),		 16,snd_SfxVolume);    M_DrawThermo(SoundDef.x,SoundDef.y+LINEHEIGHT*(music_vol+1),		 16,snd_MusicVolume);}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//void M_DrawMainMenu(void){    V_DrawPatchDirect (94,2,0,W_CacheLumpName("M_DOOM",PU_CACHE));}//// M_NewGame//void M_DrawNewGame(void){    V_DrawPatchDirect (96,14,0,W_CacheLumpName("M_NEWG",PU_CACHE));    V_DrawPatchDirect (54,38,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;void M_DrawEpisode(void){    V_DrawPatchDirect (54,38,0,W_CacheLumpName("M_EPISOD",PU_CACHE));}void M_VerifyNightmare(int ch){    if (ch != '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"};void M_DrawOptions(void){    V_DrawPatchDirect (108,15,0,W_CacheLumpName("M_OPTTTL",PU_CACHE));	    V_DrawPatchDirect (OptionsDef.x + 175,OptionsDef.y+LINEHEIGHT*detail,0,		       W_CacheLumpName(detailNames[detailLevel],PU_CACHE));    V_DrawPatchDirect (OptionsDef.x + 120,OptionsDef.y+LINEHEIGHT*messages,0,		       W_CacheLumpName(msgNames[showMessages],PU_CACHE));    M_DrawThermo(OptionsDef.x,OptionsDef.y+LINEHEIGHT*(mousesens+1),		 10,mouseSensitivity);	    M_DrawThermo(OptionsDef.x,OptionsDef.y+LINEHEIGHT*(scrnsize+1),		 9,screenSize);}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 != '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};void M_QuitResponse(int ch){    if (ch != 'y')	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){  // 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-2))+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?    fprintf( stderr, "M_ChangeDetail: low detail mode n.a.\n");    return;        /*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//voidM_DrawThermo( int	x,  int	y,  int	thermWidth,  int	thermDot ){    int		xx;    int		i;    xx = x;    V_DrawPatchDirect (xx,y,0,W_CacheLumpName("M_THERML",PU_CACHE));    xx += 8;    for (i=0;i<thermWidth;i++)    {	V_DrawPatchDirect (xx,y,0,W_CacheLumpName("M_THERMM",PU_CACHE));	xx += 8;    }    V_DrawPatchDirect (xx,y,0,W_CacheLumpName("M_THERMR",PU_CACHE));    V_DrawPatchDirect ((x+8) + thermDot*8,y,		       0,W_CacheLumpName("M_THERMO",PU_CACHE));}voidM_DrawEmptyCell( menu_t*	menu,  int		item ){    V_DrawPatchDirect (menu->x - 10,        menu->y+item*LINEHEIGHT - 1, 0,		       W_CacheLumpName("M_CELL1",PU_CACHE));}voidM_DrawSelCell( menu_t*	menu,  int		item ){    V_DrawPatchDirect (menu->x - 10,        menu->y+item*LINEHEIGHT - 1, 0,		       W_CacheLumpName("M_CELL2",PU_CACHE));}voidM_StartMessage( char*		string,  void*		routine,  boolean	input ){    messageLastMenuActive = menuactive;    messageToPrint = 1;    messageString = string;    messageRoutine = routine;    messageNeedsInput = input;    menuactive = true;    return;}void M_StopMessage(void){    menuactive = messageLastMenuActive;    messageToPrint = 0;}//// Find string width from hu_font chars//int M_StringWidth(char* string){    int             i;    int             w = 0;    int             c;	    for (i = 0;i < strlen(string);i++)    {	c = toupper(string[i]) - HU_FONTSTART;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -