📄 mn_menu.c
字号:
} y += ITEM_HEIGHT; item++; } y = CurrentMenu->y+(CurrentItPos*ITEM_HEIGHT)+SELECTOR_YOFFSET; selName = MenuTime&16 ? "M_SLCTR1" : "M_SLCTR2"; V_DrawPatch(x+SELECTOR_XOFFSET, y, W_CacheLumpName(selName, PU_CACHE)); }}//---------------------------------------------------------------------------//// PROC DrawMainMenu////---------------------------------------------------------------------------static void DrawMainMenu(void){ int frame; frame = (MenuTime/5)%7; V_DrawPatch(88, 0, W_CacheLumpName("M_HTIC", PU_CACHE));// Old Gold skull positions: (40, 10) and (232, 10) V_DrawPatch(37, 80, W_CacheLumpNum(MauloBaseLump+(frame+2)%7, PU_CACHE)); V_DrawPatch(278, 80, W_CacheLumpNum(MauloBaseLump+frame, PU_CACHE));}//==========================================================================//// DrawClassMenu////==========================================================================static void DrawClassMenu(void){ pclass_t class; static char *boxLumpName[3] = { "m_fbox", "m_cbox", "m_mbox" }; static char *walkLumpName[3] = { "m_fwalk1", "m_cwalk1", "m_mwalk1" }; MN_DrTextB("CHOOSE CLASS:", 34, 24); class = (pclass_t)CurrentMenu->items[CurrentItPos].option; V_DrawPatch(174, 8, W_CacheLumpName(boxLumpName[class], PU_CACHE)); V_DrawPatch(174+24, 8+12, W_CacheLumpNum(W_GetNumForName(walkLumpName[class]) +((MenuTime>>3)&3), PU_CACHE));}//---------------------------------------------------------------------------//// PROC DrawSkillMenu////---------------------------------------------------------------------------static void DrawSkillMenu(void){ MN_DrTextB("CHOOSE SKILL LEVEL:", 74, 16);}//---------------------------------------------------------------------------//// PROC DrawFilesMenu////---------------------------------------------------------------------------static void DrawFilesMenu(void){// clear out the quicksave/quickload stuff quicksave = 0; quickload = 0; P_ClearMessage(&players[consoleplayer]);}//---------------------------------------------------------------------------//// PROC DrawLoadMenu////---------------------------------------------------------------------------static void DrawLoadMenu(void){ MN_DrTextB("LOAD GAME", 160-MN_TextBWidth("LOAD GAME")/2, 10); if(!slottextloaded) { MN_LoadSlotText(); } DrawFileSlots(&LoadMenu);}//---------------------------------------------------------------------------//// PROC DrawSaveMenu////---------------------------------------------------------------------------static void DrawSaveMenu(void){ MN_DrTextB("SAVE GAME", 160-MN_TextBWidth("SAVE GAME")/2, 10); if(!slottextloaded) { MN_LoadSlotText(); } DrawFileSlots(&SaveMenu);}//===========================================================================//// MN_LoadSlotText//// For each slot, looks for save games and reads the description field.////===========================================================================void MN_LoadSlotText(void){ int slot; FILE *fp; char name[100]; char versionText[HXS_VERSION_TEXT_LENGTH]; char description[HXS_DESCRIPTION_LENGTH]; boolean found; for(slot = 0; slot < 6; slot++) { found = false; sprintf(name, "%shex%d.hxs", SavePath, slot); fp = fopen(name, "rb"); if(fp) { fread(description, HXS_DESCRIPTION_LENGTH, 1, fp); fread(versionText, HXS_VERSION_TEXT_LENGTH, 1, fp); fclose(fp); if(!strcmp(versionText, HXS_VERSION_TEXT)) { found = true; } } if(found) { memcpy(SlotText[slot], description, SLOTTEXTLEN); SlotStatus[slot] = 1; } else { memset(SlotText[slot], 0, SLOTTEXTLEN); SlotStatus[slot] = 0; } } slottextloaded = true;}//---------------------------------------------------------------------------//// PROC DrawFileSlots////---------------------------------------------------------------------------static void DrawFileSlots(Menu_t *menu){ int i; int x; int y; x = menu->x; y = menu->y; for(i = 0; i < 6; i++) { V_DrawPatch(x, y, W_CacheLumpName("M_FSLOT", PU_CACHE)); if(SlotStatus[i]) { MN_DrTextA(SlotText[i], x+5, y+5); } y += ITEM_HEIGHT; }}//---------------------------------------------------------------------------//// PROC DrawOptionsMenu////---------------------------------------------------------------------------static void DrawOptionsMenu(void){ if(messageson) { MN_DrTextB("ON", 196, 50); } else { MN_DrTextB("OFF", 196, 50); } DrawSlider(&OptionsMenu, 3, 10, mouseSensitivity);}//---------------------------------------------------------------------------//// PROC DrawOptions2Menu////---------------------------------------------------------------------------static void DrawOptions2Menu(void){ DrawSlider(&Options2Menu, 1, 9, screenblocks-3); DrawSlider(&Options2Menu, 3, 16, snd_MaxVolume); DrawSlider(&Options2Menu, 5, 16, snd_MusicVolume);}//---------------------------------------------------------------------------//// PROC SCQuitGame////---------------------------------------------------------------------------static void SCQuitGame(int option){ MenuActive = false; askforquit = true; typeofask = 1; //quit game if(!netgame && !demoplayback) { paused = true; }}//---------------------------------------------------------------------------//// PROC SCEndGame////---------------------------------------------------------------------------static void SCEndGame(int option){ if(demoplayback) { return; } if(SCNetCheck(3)) { MenuActive = false; askforquit = true; typeofask = 2; //endgame if(!netgame && !demoplayback) { paused = true; } }}//---------------------------------------------------------------------------//// PROC SCMessages////---------------------------------------------------------------------------static void SCMessages(int option){ messageson ^= 1; if(messageson) { P_SetMessage(&players[consoleplayer], "MESSAGES ON", true); } else { P_SetMessage(&players[consoleplayer], "MESSAGES OFF", true); } S_StartSound(NULL, SFX_CHAT);}//===========================================================================//// SCNetCheck////===========================================================================static boolean SCNetCheck(int option){ if(!netgame) { return true; } switch(option) { case 1: // new game P_SetMessage(&players[consoleplayer], "YOU CAN'T START A NEW GAME IN NETPLAY!", true); break; case 2: // load game P_SetMessage(&players[consoleplayer], "YOU CAN'T LOAD A GAME IN NETPLAY!", true); break; case 3: // end game P_SetMessage(&players[consoleplayer], "YOU CAN'T END A GAME IN NETPLAY!", true); break; } MenuActive = false; S_StartSound(NULL, SFX_CHAT); return false;}//===========================================================================//// SCNetCheck2////===========================================================================static void SCNetCheck2(int option){ SCNetCheck(option); return;}//---------------------------------------------------------------------------//// PROC SCLoadGame////---------------------------------------------------------------------------static void SCLoadGame(int option){ if(!SlotStatus[option]) { // Don't try to load from an empty slot return; } G_LoadGame(option); MN_DeactivateMenu(); BorderNeedRefresh = true; if(quickload == -1) { quickload = option+1; P_ClearMessage(&players[consoleplayer]); }}//---------------------------------------------------------------------------//// PROC SCSaveGame////---------------------------------------------------------------------------static void SCSaveGame(int option){ char *ptr; if(!FileMenuKeySteal) { FileMenuKeySteal = true; strcpy(oldSlotText, SlotText[option]); ptr = SlotText[option]; while(*ptr) { ptr++; } *ptr = '['; *(ptr+1) = 0; SlotStatus[option]++; currentSlot = option; slotptr = ptr-SlotText[option]; return; } else { G_SaveGame(option, SlotText[option]); FileMenuKeySteal = false; MN_DeactivateMenu(); } BorderNeedRefresh = true; if(quicksave == -1) { quicksave = option+1; P_ClearMessage(&players[consoleplayer]); }}//==========================================================================//// SCClass////==========================================================================static void SCClass(int option){ if(netgame) { P_SetMessage(&players[consoleplayer], "YOU CAN'T START A NEW GAME FROM WITHIN A NETGAME!", true); return; } MenuPClass = option; switch(MenuPClass) { case PCLASS_FIGHTER: SkillMenu.x = 120; SkillItems[0].text = "SQUIRE"; SkillItems[1].text = "KNIGHT"; SkillItems[2].text = "WARRIOR"; SkillItems[3].text = "BERSERKER"; SkillItems[4].text = "TITAN"; break; case PCLASS_CLERIC: SkillMenu.x = 116; SkillItems[0].text = "ALTAR BOY"; SkillItems[1].text = "ACOLYTE"; SkillItems[2].text = "PRIEST"; SkillItems[3].text = "CARDINAL"; SkillItems[4].text = "POPE"; break; case PCLASS_MAGE: SkillMenu.x = 112; SkillItems[0].text = "APPRENTICE"; SkillItems[1].text = "ENCHANTER"; SkillItems[2].text = "SORCERER"; SkillItems[3].text = "WARLOCK"; SkillItems[4].text = "ARCHIMAGE"; break; } SetMenu(MENU_SKILL);}//---------------------------------------------------------------------------//// PROC SCSkill////---------------------------------------------------------------------------static void SCSkill(int option){ extern int SB_state; PlayerClass[consoleplayer] = MenuPClass; G_DeferredNewGame(option); SB_SetClassData(); SB_state = -1; MN_DeactivateMenu();}//---------------------------------------------------------------------------//// PROC SCMouseSensi////---------------------------------------------------------------------------static void SCMouseSensi(int option){ if(option == RIGHT_DIR) { if(mouseSensitivity < 9) { mouseSensitivity++; } } else if(mouseSensitivity) { mouseSensitivity--; }}//---------------------------------------------------------------------------//// PROC SCSfxVolume////---------------------------------------------------------------------------static void SCSfxVolume(int option){ if(option == RIGHT_DIR) { if(snd_MaxVolume < 15) { snd_MaxVolume++; } } else if(snd_MaxVolume) { snd_MaxVolume--; } soundchanged = true; // we'll set it when we leave the menu}//---------------------------------------------------------------------------//// PROC SCMusicVolume////---------------------------------------------------------------------------static void SCMusicVolume(int option){ if(option == RIGHT_DIR) { if(snd_MusicVolume < 15) { snd_MusicVolume++; } } else if(snd_MusicVolume) { snd_MusicVolume--; } S_SetMusicVolume();}//---------------------------------------------------------------------------//// PROC SCScreenSize////---------------------------------------------------------------------------static void SCScreenSize(int option){ if(option == RIGHT_DIR) { if(screenblocks < 11) { screenblocks++; } } else if(screenblocks > 3) { screenblocks--; } R_SetViewSize(screenblocks, detailLevel);}//---------------------------------------------------------------------------//// PROC SCInfo////---------------------------------------------------------------------------static void SCInfo(int option){ InfoType = 1; S_StartSound(NULL, SFX_DOOR_LIGHT_CLOSE); if(!netgame && !demoplayback) { paused = true; }}//---------------------------------------------------------------------------//// FUNC MN_Responder////---------------------------------------------------------------------------boolean MN_Responder(event_t *event){ int key; int i; MenuItem_t *item; extern boolean automapactive; static boolean shiftdown; extern void H2_StartTitle(void); extern void G_CheckDemoStatus(void); char *textBuffer; if(event->data1 == KEY_RSHIFT) { shiftdown = (event->type == ev_keydown); } if(event->type != ev_keydown) { return(false); } key = event->data1; if(InfoType) { if(shareware) { InfoType = (InfoType+1)%5;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -