void M_QuickSave(void) { if (multiplayer) { S_Sound (CHAN_INTERFACE, "player/male/grunt1", 1, ATTN_NONE); M_ClearMenus (); return; } if (!usergame) { S_Sound (CHAN_INTERFACE, "player/male/grunt1", 1, ATTN_NONE); M_ClearMenus (); 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, GStrings(QSPROMPT), savegamestrings[quickSaveSlot]); M_StartMessage (tempstring, M_QuickSaveResponse, true); }
// // M_EndGame // void M_EndGameResponse(int ch) { if (toupper(ch) != 'Y') { M_ClearMenus (); return; } currentMenu->lastOn = itemOn; M_ClearMenus (); D_StartTitle (); CL_QuitNetGame(); }
// // M_EndGame // void M_EndGameResponse(int ch) { if ((!isascii(ch) || toupper(ch) != 'Y') && ch != KEY_JOY4 ) { M_ClearMenus (); return; } currentMenu->lastOn = itemOn; M_ClearMenus (); D_StartTitle (); CL_QuitNetGame(); }
void M_StartGame(int choice) { skill.Set ((float)choice+1); G_DeferedInitNew (CalcMapName (epi+1, 1)); M_ClearMenus (); }
void FSavegameManager::DoSave(int Selected, const char *savegamestring) { if (Selected != 0) { auto node = SaveGames[Selected]; G_SaveGame(node->Filename.GetChars(), savegamestring); } else { // Find an unused filename and save as that FString filename; int i; for (i = 0;; ++i) { filename = G_BuildSaveName("save", i); if (!FileExists(filename)) { break; } } G_SaveGame(filename, savegamestring); } M_ClearMenus(); }
void M_StartGame(int choice) { sv_skill.Set ((float)(choice+1)); sv_gametype = GM_COOP; G_DeferedInitNew (CalcMapName (epi+1, 1)); M_ClearMenus (); }
// // M_Responder calls this when user is finished // [ML] 7 Sept 08: Bringing game saving/loading in from // zdoom 1.22 source, see MAINTAINERS // void M_DoSave (int slot) { G_SaveGame (slot,savegamestrings[slot]); M_ClearMenus (); // PICK QUICKSAVE SLOT YET? if (quickSaveSlot == -2) quickSaveSlot = slot; }
void M_VerifyNightmare(int ch) { if (ch != 'y') return; G_DeferedInitNew((skill_t)nightmare,epi+1,1); M_ClearMenus (); }
void M_VerifyNightmare(int ch) { if (ch != KEY_ENTER) return; G_DeferedInitNew((skill_t)nightmare,::g->epi+1, 1); M_ClearMenus (); }
// // M_EndGame // void M_EndGameResponse(int ch) { if (ch != 'y') return; currentMenu->lastOn = itemOn; M_ClearMenus (); D_StartTitle (); }
// // M_EndGame // void M_EndGameResponse(int ch) { if (ch != KEY_ENTER) return; ::g->currentMenu->lastOn = ::g->itemOn; M_ClearMenus (); D_StartTitle (); }
void M_VerifyNightmare(int ch) { if (ch != 'y' && ch != KEY_JOY4) { M_ClearMenus (); return; } M_StartGame(nightmare); }
void FSavegameManager::LoadSavegame(int Selected) { G_LoadGame(SaveGames[Selected]->Filename.GetChars(), true); if (quickSaveSlot == (FSaveGameNode*)1) { quickSaveSlot = SaveGames[Selected]; } M_ClearMenus(); LastAccessed = Selected; }
void M_ChooseSkill(int choice) { /*if (choice == nightmare) { M_StartMessage(NIGHTMARE,(void *)M_VerifyNightmare,true); return; } */ G_DeferedInitNew((skill_t)choice,epi+1,1); M_ClearMenus (); }
// // User wants to load this game // void M_LoadSelect(int choice) { if( ::g->gamemode != commercial ) { G_LoadGame ( ::g->savegamepaths[ choice ] ); } else { strcpy( DoomLib::loadGamePath, ::g->savegamepaths[ choice ] ); DoomLib::SetCurrentExpansion( DoomLib::idealExpansion ); DoomLib::skipToLoad = true; } M_ClearMenus (); }
// // User wants to load this game // void M_LoadSelect (int choice) { std::string name; G_BuildSaveName (name, choice); G_LoadGame ((char *)name.c_str()); gamestate = gamestate == GS_FULLCONSOLE ? GS_HIDECONSOLE : gamestate; M_ClearMenus (); if (quickSaveSlot == -2) { quickSaveSlot = choice; } }
void M_Episode (int choice) { if ((gameinfo.flags & GI_SHAREWARE) && choice) { M_StartMessage(GStrings(SWSTRING),NULL,false); //M_SetupNextMenu(&ReadDef1); M_ClearMenus (); return; } epi = choice; M_SetupNextMenu(&NewDef); }
void DMenu::Close () { assert(DMenu::CurrentMenu == this); DMenu::CurrentMenu = mParentMenu; Destroy(); if (DMenu::CurrentMenu != NULL) { GC::WriteBarrier(DMenu::CurrentMenu); } else { M_ClearMenus (); } }
// // Selected from DOOM menu // [ML] 7 Sept 08: Bringing game saving/loading in from // zdoom 1.22 source, see MAINTAINERS // void M_SaveGame (int choice) { if (multiplayer && !demoplayback) { M_StartMessage("you can't save while in a net game!\n\npress a key.", NULL,false); M_ClearMenus (); return; } if (!usergame) { M_StartMessage(GStrings(SAVEDEAD),NULL,false); M_ClearMenus (); return; } if (gamestate != GS_LEVEL) return; M_SetupNextMenu(&SaveDef); M_ReadSaveStrings(); }
void M_QuitResponse(int ch) { if (toupper(ch) != 'Y') { M_ClearMenus (); return; } if (!multiplayer) { if (gameinfo.quitSounds) { S_Sound (CHAN_VOICE, gameinfo.quitSounds[(gametic>>2)&7], 1, ATTN_SURROUND); I_WaitVBL (105); } }
void M_QuitResponse(int ch) { if ((!isascii(ch) || toupper(ch) != 'Y') && ch != KEY_JOY4 ) { M_ClearMenus (); return; } if (!multiplayer) { if (gameinfo.quitSounds) { S_Sound(CHAN_INTERFACE, gameinfo.quitSounds[(gametic>>2)&7], 1, ATTN_NONE); I_WaitVBL (105); } }
void M_ChooseSkill(int choice) { /* if (choice == nightmare) { M_StartMessage(NIGHTMARE,M_VerifyNightmare,true); return; } */ if ( ::g->gamemode != commercial ) { static int startLevel = 1; G_DeferedInitNew((skill_t)choice,::g->epi+1, startLevel); M_ClearMenus (); } else { DoomLib::SetCurrentExpansion( DoomLib::idealExpansion ); DoomLib::skipToNew = true; DoomLib::chosenSkill = choice; DoomLib::chosenEpisode = ::g->epi+1; } }
void M_Episode (int choice) { if ((gameinfo.flags & GI_SHAREWARE) && choice) { M_StartMessage(GStrings(SWSTRING),NULL,false); //M_SetupNextMenu(&ReadDef1); M_ClearMenus (); return; } epi = choice; if (gameinfo.gametype & GAME_Heretic) { NewDef.menuitems = HereticNewGameMenu; NewDef.routine = NULL; NewDef.x = 38; NewDef.y = 30; } M_SetupNextMenu(&NewDef); }
void M_StartGame(int choice) { sv_skill.Set ((float)(choice+1)); sv_gametype = GM_COOP; if (gamemode == commercial_bfg) // Funky external loading madness fun time (DOOM 2 BFG) { std::string str = "nerve.wad"; if (epi) { // Load No Rest for The Living Externally epi = 0; G_LoadWad(str); } else { // Check for nerve.wad, if it's loaded re-load with just iwad (DOOM 2 BFG) for (unsigned int i = 2; i < wadfiles.size(); i++) { if (StdStringCompare(str, M_ExtractFileName(wadfiles[i]), true) == 0) { G_LoadWad(wadfiles[1]); } } G_DeferedInitNew (CalcMapName (epi+1, 1)); } } else { G_DeferedInitNew (CalcMapName (epi+1, 1)); } M_ClearMenus (); }
// // P_DialogDoChoice // // [STRIFE] New function // haleyjd 09/05/10: Handles making a choice in a dialog. Installed as the // callback for all items in the dialogmenu structure. // void P_DialogDoChoice(int choice) { int i = 0, nextdialog = 0; boolean candochoice = true; char *message = NULL; mapdlgchoice_t *currentchoice; if(choice == -1) choice = dialogmenu.numitems - 1; currentchoice = &(currentdialog->choices[choice]); I_StartVoice(NULL); // STRIFE-TODO: verify (should stop previous voice I believe) // villsa 09/08/10: converted into for loop for(i = 0; i < MDLG_MAXITEMS; i++) { if(P_PlayerHasItem(dialogplayer, currentchoice->needitems[i]) < currentchoice->needamounts[i]) { candochoice = false; // nope, missing something } } if(choice != dialogmenu.numitems - 1 && candochoice) { int item; message = currentchoice->textok; if(dialogtalkerstates->yes) P_SetMobjState(dialogtalker, dialogtalkerstates->yes); item = currentchoice->giveitem; if(item < 0 || P_GiveItemToPlayer(dialogplayer, states[mobjinfo[item].spawnstate].sprite, item)) { // if successful, take needed items int count = 0; // villsa 09/08/10: converted into for loop for(count = 0; count < MDLG_MAXITEMS; count++) { P_TakeDialogItem(dialogplayer, currentchoice->needitems[count], currentchoice->needamounts[count]); } } else message = DEH_String("You seem to have enough!"); // store next dialog into the talking actor nextdialog = currentchoice->next; if(nextdialog != 0) dialogtalker->miscdata = (byte)(abs(nextdialog)); } else { // not successful message = currentchoice->textno; if(dialogtalkerstates->no) P_SetMobjState(dialogtalker, dialogtalkerstates->no); } if(choice != dialogmenu.numitems - 1) { int objective; char *objlump; if((objective = currentchoice->objective)) { DEH_snprintf(mission_objective, OBJECTIVE_LEN, "log%i", objective); objlump = W_CacheLumpName(mission_objective, PU_CACHE); M_StringCopy(mission_objective, objlump, OBJECTIVE_LEN); } // haleyjd 20130301: v1.31 hack: if first char of message is a period, // clear the player's message. Is this actually used anywhere? if(gameversion == exe_strife_1_31 && message[0] == '.') message = NULL; dialogplayer->message = message; } dialogtalker->angle = dialogtalkerangle; dialogplayer->st_update = true; M_ClearMenus(0); if(nextdialog >= 0 || gameaction == ga_victory) // Macil hack menuindialog = false; else P_DialogStart(dialogplayer); }
static void PickConversationReply () { const char *replyText = NULL; FStrifeDialogueReply *reply = (FStrifeDialogueReply *)ConversationItems[ConversationMenu.lastOn].c.extra; bool takestuff; int i; M_ClearMenus (); CleanupConversationMenu (); if (reply == NULL) { return; } // Check if you have the requisite items for this choice for (i = 0; i < 3; ++i) { if (!CheckStrifeItem (reply->ItemCheck[i], reply->ItemCheckAmount[i])) { // No, you don't. Say so and let the NPC animate negatively. if (reply->QuickNo) { Printf ("%s\n", reply->QuickNo); } ConversationNPC->ConversationAnimation (2); return; } } // Yay, you do! Let the NPC animate affirmatively. ConversationNPC->ConversationAnimation (1); // If this reply gives you something, then try to receive it. takestuff = true; if (reply->GiveType != NULL) { AInventory *item = static_cast<AInventory *> (Spawn (reply->GiveType, 0, 0, 0)); // Items given here should not count as items! if (item->flags & MF_COUNTITEM) { level.total_items--; item->flags &= ~MF_COUNTITEM; } item->flags |= MF_DROPPED; if (!item->TryPickup (players[consoleplayer].mo)) { item->Destroy (); takestuff = false; } } // Take away required items if the give was successful or none was needed. if (takestuff) { for (i = 0; i < 3; ++i) { TakeStrifeItem (reply->ItemCheck[i], reply->ItemCheckAmount[i]); } replyText = reply->QuickYes; } else { replyText = "You seem to have enough!"; } // Update the quest log, if needed. if (reply->LogNumber != 0) { players[consoleplayer].SetLogNumber (reply->LogNumber); } // Does this reply alter the speaker's conversation node? If NextNode is positive, // the next time they talk, the will show the new node. If it is negative, then they // will show the new node right away without terminating the dialogue. if (reply->NextNode != 0) { int rootnode = FindNode (ConversationNPC->GetDefault()->Conversation); if (reply->NextNode < 0) { ConversationNPC->Conversation = StrifeDialogues[rootnode - reply->NextNode - 1]; if (gameaction != ga_slideshow) { P_StartConversation (ConversationNPC, players[consoleplayer].mo); return; } else { S_StopSound (ConversationNPC, CHAN_VOICE); } } else { ConversationNPC->Conversation = StrifeDialogues[rootnode + reply->NextNode - 1]; } } if (replyText != NULL) { Printf ("%s\n", replyText); } ConversationNPC->angle = ConversationNPCAngle; }
static void DrawConversationMenu () { int i, x, y, linesize; assert (DialogueLines != NULL); assert (CurNode != NULL); if (CurNode == NULL) { M_ClearMenus (); return; } if (ConversationPauseTic < gametic) { menuactive = MENU_On; } if (CurNode->Backdrop >= 0) { screen->DrawTexture (TexMan(CurNode->Backdrop), 0, 0, DTA_320x200, true, TAG_DONE); } x = 16 * screen->GetWidth() / 320; y = 16 * screen->GetHeight() / 200; linesize = 10 * CleanYfac; // Dim the screen behind the dialogue (but only if there is no backdrop). if (CurNode->Backdrop <= 0) { for (i = 0; DialogueLines[i].width != -1; ++i) { } screen->Dim (0, 0.45f, 14 * screen->GetWidth() / 320, 13 * screen->GetHeight() / 200, 308 * screen->GetWidth() / 320 - 14 * screen->GetWidth () / 320, CurNode->SpeakerName == NULL ? linesize * i + 6 * CleanYfac : linesize * i + 6 * CleanYfac + linesize * 3/2); } // Dim the screen behind the PC's choices. screen->Dim (0, 0.45f, (24-160) * CleanXfac + screen->GetWidth()/2, (ConversationMenu.y - 2 - 100) * CleanYfac + screen->GetHeight()/2, 272 * CleanXfac, MIN(ConversationMenu.numitems * (gameinfo.gametype & GAME_Raven ? 9 : 8) + 4, 200 - ConversationMenu.y) * CleanYfac); if (CurNode->SpeakerName != NULL) { screen->DrawText (CR_WHITE, x, y, CurNode->SpeakerName, DTA_CleanNoMove, true, TAG_DONE); y += linesize * 3 / 2; } x = 24 * screen->GetWidth() / 320; for (i = 0; DialogueLines[i].width >= 0; ++i) { screen->DrawText (CR_UNTRANSLATED, x, y, DialogueLines[i].string, DTA_CleanNoMove, true, TAG_DONE); y += linesize; } if (ShowGold) { AInventory *coin = ConversationPC->FindInventory (RUNTIME_CLASS(ACoin)); char goldstr[32]; sprintf (goldstr, "%d", coin != NULL ? coin->Amount : 0); screen->DrawText (CR_GRAY, 21, 191, goldstr, DTA_320x200, true, DTA_FillColor, 0, DTA_Alpha, HR_SHADOW, TAG_DONE); screen->DrawTexture (TexMan(((AInventory *)GetDefaultByType (RUNTIME_CLASS(ACoin)))->Icon), 3, 190, DTA_320x200, true, DTA_FillColor, 0, DTA_Alpha, HR_SHADOW, TAG_DONE); screen->DrawText (CR_GRAY, 20, 190, goldstr, DTA_320x200, true, TAG_DONE); screen->DrawTexture (TexMan(((AInventory *)GetDefaultByType (RUNTIME_CLASS(ACoin)))->Icon), 2, 189, DTA_320x200, true, TAG_DONE); } }
// // M_Responder // boolean M_Responder (event_t* ev) { int ch; int i; ch = -1; if (ev->type == ev_keydown) ch = ev->data1; if (ch == -1) return false; // Take care of any messages that need input if (messageToPrint) { if (messageNeedsInput == true && !(ch == ' ' || ch == 'n' || ch == 'y' || ch == KEY_ESCAPE)) return false; menuactive = (boolean)messageLastMenuActive; messageToPrint = 0; if (messageRoutine) messageRoutine(ch); menuactive = false; return true; } // F-Keys if (!menuactive) switch(ch) { case KEY_F1: // Boss key M_StartControlPanel (); if ( gamemode == retail ) currentMenu = &ReadDef2; else currentMenu = &ReadDef1; itemOn = 0; return true; case KEY_F2: // Quicksave //M_QuickSave(); return true; case KEY_F3: // Quickload //M_QuickLoad(); return true; } // Pop-up menu? if (!menuactive) { if (ch == KEY_ESCAPE) { M_StartControlPanel (); return true; } return false; } // Keys usable within menu switch (ch) { case KEY_DOWNARROW: do { if (itemOn+1 > currentMenu->numitems-1) itemOn = 0; else itemOn++; } while(currentMenu->menuitems[itemOn].status==-1); return true; case KEY_UPARROW: do { if (!itemOn) itemOn = currentMenu->numitems-1; else itemOn--; } while(currentMenu->menuitems[itemOn].status==-1); return true; case KEY_LEFTARROW: if (currentMenu->menuitems[itemOn].routine && currentMenu->menuitems[itemOn].status == 2) { currentMenu->menuitems[itemOn].routine(0); } return true; case KEY_RIGHTARROW: if (currentMenu->menuitems[itemOn].routine && currentMenu->menuitems[itemOn].status == 2) { currentMenu->menuitems[itemOn].routine(1); } return true; case KEY_ENTER: if (currentMenu->menuitems[itemOn].routine && currentMenu->menuitems[itemOn].status) { currentMenu->lastOn = itemOn; if (currentMenu->menuitems[itemOn].status == 2) currentMenu->menuitems[itemOn].routine(1); // right arrow else currentMenu->menuitems[itemOn].routine(itemOn); } return true; case KEY_ESCAPE: currentMenu->lastOn = itemOn; M_ClearMenus (); return true; case KEY_BACKSPACE: currentMenu->lastOn = itemOn; if (currentMenu->prevMenu) { currentMenu = currentMenu->prevMenu; itemOn = currentMenu->lastOn; } return true; default: for (i = itemOn+1;i < currentMenu->numitems;i++) if (currentMenu->menuitems[i].alphaKey == ch) { itemOn = (short)i; return true; } for (i = 0;i <= itemOn;i++) if (currentMenu->menuitems[i].alphaKey == ch) { itemOn = (short)i; return true; } break; } return false; }
// // M_Responder // qboolean M_Responder (event_t* ev) { int ch; int i; ch = -1; if (ev->type == ev_joystick && ::g->joywait < I_GetTime()) { if (ev->data3 == -1) { ch = KEY_UPARROW; ::g->joywait = I_GetTime() + 5; } else if (ev->data3 == 1) { ch = KEY_DOWNARROW; ::g->joywait = I_GetTime() + 5; } if (ev->data2 == -1) { ch = KEY_LEFTARROW; ::g->joywait = I_GetTime() + 2; } else if (ev->data2 == 1) { ch = KEY_RIGHTARROW; ::g->joywait = I_GetTime() + 2; } if (ev->data1&1) { ch = KEY_ENTER; ::g->joywait = I_GetTime() + 5; } if (ev->data1&2) { ch = KEY_BACKSPACE; ::g->joywait = I_GetTime() + 5; } } else { if (ev->type == ev_mouse && ::g->mousewait < I_GetTime()) { ::g->mmenu_mousey += ev->data3; if (::g->mmenu_mousey < ::g->lasty-30) { ch = KEY_DOWNARROW; ::g->mousewait = I_GetTime() + 5; ::g->mmenu_mousey = ::g->lasty -= 30; } else if (::g->mmenu_mousey > ::g->lasty+30) { ch = KEY_UPARROW; ::g->mousewait = I_GetTime() + 5; ::g->mmenu_mousey = ::g->lasty += 30; } ::g->mmenu_mousex += ev->data2; if (::g->mmenu_mousex < ::g->lastx-30) { ch = KEY_LEFTARROW; ::g->mousewait = I_GetTime() + 5; ::g->mmenu_mousex = ::g->lastx -= 30; } else if (::g->mmenu_mousex > ::g->lastx+30) { ch = KEY_RIGHTARROW; ::g->mousewait = I_GetTime() + 5; ::g->mmenu_mousex = ::g->lastx += 30; } if (ev->data1&1) { ch = KEY_ENTER; ::g->mousewait = I_GetTime() + 15; } if (ev->data1&2) { ch = KEY_BACKSPACE; ::g->mousewait = I_GetTime() + 15; } } else if (ev->type == ev_keydown) { ch = ev->data1; } } if (ch == -1) return false; // Save Game string input if (::g->saveStringEnter) { switch(ch) { case KEY_BACKSPACE: if (::g->saveCharIndex > 0) { ::g->saveCharIndex--; ::g->savegamestrings[::g->saveSlot][::g->saveCharIndex] = 0; } break; case KEY_ESCAPE: ::g->saveStringEnter = 0; strcpy(&::g->savegamestrings[::g->saveSlot][0],::g->saveOldString); break; case KEY_ENTER: ::g->saveStringEnter = 0; if (::g->savegamestrings[::g->saveSlot][0]) M_DoSave(::g->saveSlot); break; default: ch = toupper(ch); if (ch != 32) if (ch-HU_FONTSTART < 0 || ch-HU_FONTSTART >= HU_FONTSIZE) break; if (ch >= 32 && ch <= 127 && ::g->saveCharIndex < SAVESTRINGSIZE-1 && M_StringWidth(::g->savegamestrings[::g->saveSlot]) < (SAVESTRINGSIZE-2)*8) { ::g->savegamestrings[::g->saveSlot][::g->saveCharIndex++] = ch; ::g->savegamestrings[::g->saveSlot][::g->saveCharIndex] = 0; } break; } return true; } // Take care of any messages that need input if (::g->messageToPrint) { if (::g->messageNeedsInput == true && !(ch == KEY_ENTER || ch == KEY_BACKSPACE || ch == KEY_ESCAPE)) return false; ::g->menuactive = ::g->messageLastMenuActive; ::g->messageToPrint = 0; if (::g->messageRoutine) ::g->messageRoutine(ch); S_StartSound(NULL,sfx_swtchx); return true; } /* if (::g->devparm && ch == KEY_F1) { G_ScreenShot (); return true; } // F-Keys if (!::g->menuactive) switch(ch) { case KEY_MINUS: // Screen size down if (::g->automapactive || ::g->chat_on) return false; //M_SizeDisplay(0); S_StartSound(NULL,sfx_stnmov); return true; case KEY_EQUALS: // Screen size up if (::g->automapactive || ::g->chat_on) return false; //M_SizeDisplay(1); S_StartSound(NULL,sfx_stnmov); return true; case KEY_F1: // Help key M_StartControlPanel (); if ( ::g->gamemode == retail ) ::g->currentMenu = &::g->ReadDef2; else ::g->currentMenu = &::g->ReadDef1; ::g->itemOn = 0; S_StartSound(NULL,sfx_swtchn); return true; case KEY_F2: // Save M_StartControlPanel(); S_StartSound(NULL,sfx_swtchn); M_SaveGame(0); return true; case KEY_F3: // Load M_StartControlPanel(); S_StartSound(NULL,sfx_swtchn); M_LoadGame(0); return true; case KEY_F4: // Sound Volume M_StartControlPanel (); ::g->currentMenu = &::g->SoundDef; ::g->itemOn = sfx_vol; S_StartSound(NULL,sfx_swtchn); return true; case KEY_F5: // Detail toggle M_ChangeDetail(0); S_StartSound(NULL,sfx_swtchn); return true; case KEY_F6: // Quicksave S_StartSound(NULL,sfx_swtchn); M_QuickSave(); return true; case KEY_F7: // End game S_StartSound(NULL,sfx_swtchn); M_EndGame(0); return true; case KEY_F8: // Toggle messages M_ChangeMessages(0); S_StartSound(NULL,sfx_swtchn); return true; case KEY_F9: // Quickload S_StartSound(NULL,sfx_swtchn); M_QuickLoad(); return true; case KEY_F10: // Quit DOOM S_StartSound(NULL,sfx_swtchn); M_QuitDOOM(0); return true; case KEY_F11: // gamma toggle ::g->usegamma++; if (::g->usegamma > 4) ::g->usegamma = 0; ::g->players[::g->consoleplayer].message = gammamsg[::g->usegamma]; I_SetPalette ((byte*)W_CacheLumpName ("PLAYPAL",PU_CACHE_SHARED)); return true; } */ // Pop-up menu? if (!::g->menuactive) { if (ch == KEY_ESCAPE && ( ::g->gamestate == GS_LEVEL || ::g->gamestate == GS_INTERMISSION || ::g->gamestate == GS_FINALE ) ) { M_StartControlPanel (); S_StartSound(NULL,sfx_swtchn); return true; } return false; } // Keys usable within menu switch (ch) { case KEY_DOWNARROW: do { if (::g->itemOn+1 > ::g->currentMenu->numitems-1) ::g->itemOn = 0; else ::g->itemOn++; S_StartSound(NULL,sfx_pstop); } while(::g->currentMenu->menuitems[::g->itemOn].status==-1); return true; case KEY_UPARROW: do { if (!::g->itemOn) ::g->itemOn = ::g->currentMenu->numitems-1; else ::g->itemOn--; S_StartSound(NULL,sfx_pstop); } while(::g->currentMenu->menuitems[::g->itemOn].status==-1); return true; case KEY_LEFTARROW: if (::g->currentMenu->menuitems[::g->itemOn].routine && ::g->currentMenu->menuitems[::g->itemOn].status == 2) { S_StartSound(NULL,sfx_stnmov); ::g->currentMenu->menuitems[::g->itemOn].routine(0); } return true; case KEY_RIGHTARROW: if (::g->currentMenu->menuitems[::g->itemOn].routine && ::g->currentMenu->menuitems[::g->itemOn].status == 2) { S_StartSound(NULL,sfx_stnmov); ::g->currentMenu->menuitems[::g->itemOn].routine(1); } return true; case KEY_ENTER: if (::g->currentMenu->menuitems[::g->itemOn].routine && ::g->currentMenu->menuitems[::g->itemOn].status) { ::g->currentMenu->lastOn = ::g->itemOn; if (::g->currentMenu->menuitems[::g->itemOn].status == 2) { ::g->currentMenu->menuitems[::g->itemOn].routine(1); // right arrow S_StartSound(NULL,sfx_stnmov); } else { ::g->currentMenu->menuitems[::g->itemOn].routine(::g->itemOn); S_StartSound(NULL,sfx_pistol); } } return true; case KEY_ESCAPE: case KEY_BACKSPACE: ::g->currentMenu->lastOn = ::g->itemOn; if (::g->currentMenu->prevMenu) { ::g->currentMenu = ::g->currentMenu->prevMenu; ::g->itemOn = ::g->currentMenu->lastOn; S_StartSound(NULL,sfx_swtchn); } else if ( ::g->currentMenu == &::g->MainDef && ( !::g->demoplayback && ::g->gamestate != GS_DEMOSCREEN ) ) { M_ClearMenus(); ::g->paused = false; } return true; default: for (i = ::g->itemOn+1;i < ::g->currentMenu->numitems;i++) if (::g->currentMenu->menuitems[i].alphaKey == ch) { ::g->itemOn = i; S_StartSound(NULL,sfx_pstop); return true; } for (i = 0;i <= ::g->itemOn;i++) if (::g->currentMenu->menuitems[i].alphaKey == ch) { ::g->itemOn = i; S_StartSound(NULL,sfx_pstop); return true; } break; } return false; }
void M_SetMenu(FName menu, int param) { // some menus need some special treatment switch (menu) { case NAME_Episodemenu: // sent from the player class menu GameStartupInfo.Skill = -1; GameStartupInfo.Episode = -1; GameStartupInfo.PlayerClass = param == -1000? NULL : param == -1? "Random" : GetPrintableDisplayName(PlayerClasses[param].Type).GetChars(); break; case NAME_Skillmenu: // sent from the episode menu if ((gameinfo.flags & GI_SHAREWARE) && param > 0) { // Only Doom and Heretic have multi-episode shareware versions. M_StartMessage(GStrings("SWSTRING"), 1); return; } GameStartupInfo.Episode = param; M_StartupSkillMenu(&GameStartupInfo); // needs player class name from class menu (later) break; case NAME_StartgameConfirm: { // sent from the skill menu for a skill that needs to be confirmed GameStartupInfo.Skill = param; const char *msg = AllSkills[param].MustConfirmText; if (*msg==0) msg = GStrings("NIGHTMARE"); M_StartMessage (msg, 0, NAME_StartgameConfirmed); return; } case NAME_Startgame: // sent either from skill menu or confirmation screen. Skill gets only set if sent from skill menu // Now we can finally start the game. Ugh... GameStartupInfo.Skill = param; case NAME_StartgameConfirmed: G_DeferedInitNew (&GameStartupInfo); if (gamestate == GS_FULLCONSOLE) { gamestate = GS_HIDECONSOLE; gameaction = ga_newgame; } M_ClearMenus (); return; case NAME_Savegamemenu: if (!usergame || (players[consoleplayer].health <= 0 && !multiplayer) || gamestate != GS_LEVEL) { // cannot save outside the game. M_StartMessage (GStrings("SAVEDEAD"), 1); return; } } // End of special checks FMenuDescriptor **desc = MenuDescriptors.CheckKey(menu); if (desc != NULL) { if ((*desc)->mNetgameMessage.IsNotEmpty() && netgame && !demoplayback) { M_StartMessage((*desc)->mNetgameMessage, 1); return; } if ((*desc)->mType == MDESC_ListMenu) { FListMenuDescriptor *ld = static_cast<FListMenuDescriptor*>(*desc); if (ld->mAutoselect >= 0 && ld->mAutoselect < (int)ld->mItems.Size()) { // recursively activate the autoselected item without ever creating this menu. ld->mItems[ld->mAutoselect]->Activate(); } else { const PClass *cls = ld->mClass == NULL? RUNTIME_CLASS(DListMenu) : ld->mClass; DListMenu *newmenu = (DListMenu *)cls->CreateNew(); newmenu->Init(DMenu::CurrentMenu, ld); M_ActivateMenu(newmenu); } } else if ((*desc)->mType == MDESC_OptionsMenu) { FOptionMenuDescriptor *ld = static_cast<FOptionMenuDescriptor*>(*desc); const PClass *cls = ld->mClass == NULL? RUNTIME_CLASS(DOptionMenu) : ld->mClass; DOptionMenu *newmenu = (DOptionMenu *)cls->CreateNew(); newmenu->Init(DMenu::CurrentMenu, ld); M_ActivateMenu(newmenu); } return; } else { const PClass *menuclass = PClass::FindClass(menu); if (menuclass != NULL) { if (menuclass->IsDescendantOf(RUNTIME_CLASS(DMenu))) { DMenu *newmenu = (DMenu*)menuclass->CreateNew(); newmenu->mParentMenu = DMenu::CurrentMenu; M_ActivateMenu(newmenu); return; } } } Printf("Attempting to open menu of unknown type '%s'\n", menu.GetChars()); M_ClearMenus(); }