void MultiSendMsgDialog (void) { CMenu m (1); int choice; if (!(gameData.app.nGameMode & GM_MULTI)) return; gameData.multigame.msg.szMsg [0] = 0; // Get rid of old contents m.AddInput (gameData.multigame.msg.szMsg, MAX_MESSAGE_LEN - 1); choice = m.Menu (NULL, TXT_SEND_MESSAGE); if ((choice > -1) && (strlen (gameData.multigame.msg.szMsg) > 0)) { gameData.multigame.msg.nReceiver = 100; HUDInitMessage ("%s '%s'", TXT_SENDING, gameData.multigame.msg.szMsg); MultiMessageFeedback (); } }
//returns flag, true means quit menu int ExecMainMenuOption (int nChoice) { CFileSelector fs; if (nChoice == mainOpts.nNew) { gameOpts->app.bSinglePlayer = 0; NewGameMenu (); } else if (nChoice == mainOpts.nSingle) { gameOpts->app.bSinglePlayer = 1; NewGameMenu (); } else if (nChoice == mainOpts.nLoad) { if (!saveGameManager.Load (0, 0, 0, NULL)) SetFunctionMode (FMODE_MENU); } #if DBG else if (nChoice == mainOpts.nLoadDirect) { CMenu m (1); char szLevel [10] = ""; int nLevel; m.AddInput (szLevel, sizeof (szLevel), NULL); m.Menu (NULL, "Enter level to load", NULL, NULL); nLevel = atoi (m [0].m_text); if (nLevel && (nLevel >= gameData.missions.nLastSecretLevel) && (nLevel <= gameData.missions.nLastLevel)) { paletteManager.DisableEffect (); StartNewGame (nLevel); } } #endif else if (nChoice == mainOpts.nMulti) MultiplayerMenu (); else if (nChoice == mainOpts.nConfig) ConfigMenu (); else if (nChoice == mainOpts.nPilots) { gameStates.gfx.bOverride = 0; SelectPlayer (); } else if (nChoice == mainOpts.nDemo) { char demoPath [FILENAME_LEN], demoFile [FILENAME_LEN]; sprintf (demoPath, "%s%s*.dem", gameFolders.szDemoDir, *gameFolders.szDemoDir ? "/" : ""); if (fs.FileSelector (TXT_SELECT_DEMO, demoPath, demoFile, 1)) NDStartPlayback (demoFile); } else if (nChoice == mainOpts.nScores) { paletteManager.DisableEffect (); ScoresView (-1); } else if (nChoice == mainOpts.nMovies) PlayMenuMovie (); else if (nChoice == mainOpts.nSongs) PlayMenuSong (); else if (nChoice == mainOpts.nCredits) { paletteManager.DisableEffect (); songManager.StopAll (); creditsManager.Show (NULL); } else if (nChoice == mainOpts.nHelp) ShowHelp (); else if (nChoice == mainOpts.nQuit) { paletteManager.DisableEffect (); SetFunctionMode (FMODE_EXIT); } else if (nChoice == mainOpts.nOrder) ShowOrderForm (); else return 0; return 1; }
void NewGameMenu (void) { CMenu menu; int optSelMsn, optMsnName, optLevelText, optLevel, optLaunch, optLoadout; int nMission = gameData.missions.nLastMission, bMsnLoaded = 0; int i, choice = 0; char szDifficulty [50]; char szLevelText [32]; char szLevel [5]; #if DBG int optLives; char szLives [5]; #endif static int nPlayerMaxLevel = 1; static int nLevel = 0; if (gameStates.app.bNostalgia) { LegacyNewGameMenu (); return; } gameStates.app.bD1Mission = 0; gameStates.app.bD1Data = 0; gameOpts->app.nVersionFilter = 3; SetDataVersion (-1); if (nMission < 0) gameFolders.szMsnSubDir [0] = '\0'; else if (gameOpts->app.bSinglePlayer) { if (!strstr (gameFolders.szMsnSubDir, "single/")) nMission = -1; gameFolders.szMsnSubDir [0] = '\0'; } hogFileManager.UseMission (""); for (;;) { menu.Destroy (); menu.Create (15); optSelMsn = menu.AddMenu (TXT_SEL_MISSION, KEY_I, HTX_MULTI_MISSION); optMsnName = menu.AddText ((nMission < 0) ? TXT_NONE_SELECTED : gameData.missions.list [nMission].szMissionName, 0); if ((nMission >= 0) && (nPlayerMaxLevel > 1)) { sprintf (szLevelText, "%s (1-%d)", TXT_LEVEL_, nPlayerMaxLevel); Assert (strlen (szLevelText) < 100); optLevelText = menu.AddText (szLevelText, 0); menu [optLevelText].m_bRebuild = 1; sprintf (szLevel, "%d", nLevel); optLevel = menu.AddInput (szLevel, 4, HTX_MULTI_LEVEL); } else optLevel = -1; #if DBG menu.AddText (""); menu.AddText ("Initial Lives:"); sprintf (szLives, "%d", gameStates.gameplay.nInitialLives); optLives = menu.AddInput (szLives, 4); #endif menu.AddText (" ", 0); sprintf (szDifficulty + 1, TXT_DIFFICULTY2, MENU_DIFFICULTY_TEXT (gameStates.app.nDifficultyLevel)); *szDifficulty = *(TXT_DIFFICULTY2 - 1); nOptDifficulty = menu.AddSlider (szDifficulty + 1, gameStates.app.nDifficultyLevel, 0, 4, KEY_D, HTX_GPLAY_DIFFICULTY); menu.AddText ("", 0); optLoadout = menu.AddMenu (TXT_LOADOUT_OPTION, KEY_B, HTX_MULTI_LOADOUT); if (nMission >= 0) { menu.AddText ("", 0); optLaunch = menu.AddMenu (TXT_LAUNCH_GAME, KEY_L, ""); menu [optLaunch].m_bCentered = 1; } else optLaunch = -1; i = menu.Menu (NULL, TXT_NEWGAME_MENUTITLE, NewGameMenuCallback, &choice); if (i < 0) { SetFunctionMode (FMODE_MENU); return; } if (choice == optLoadout) LoadoutOptionsMenu (); else if (choice == optSelMsn) { i = SelectAndLoadMission (0, NULL); if (i >= 0) { bMsnLoaded = 1; nMission = i; nLevel = 1; PrintLog (" getting highest level allowed to play\n"); nPlayerMaxLevel = GetHighestLevel (); if (nPlayerMaxLevel > gameData.missions.nLastLevel) nPlayerMaxLevel = gameData.missions.nLastLevel; } } else if (choice == optLevel) { i = atoi (menu [optLevel].m_text); #if DBG if (!i || (i < -gameData.missions.nSecretLevels) || (i > nPlayerMaxLevel)) #else if ((i <= 0) || (i > nPlayerMaxLevel)) #endif MsgBox (NULL, NULL, 1, TXT_OK, TXT_INVALID_LEVEL); else if (nLevel == i) break; else nLevel = i; } else if (nMission >= 0) { if ((optLevel > 0) && !(nLevel = atoi (menu [optLevel].m_text))) { MsgBox (NULL, NULL, 1, TXT_OK, TXT_INVALID_LEVEL); nLevel = 1; } else break; } #if DBG else { i = atoi (menu [optLives].m_text); if (i > 0) gameStates.gameplay.nInitialLives = min (i, 255); } #endif } i = menu [nOptDifficulty].m_value; if (gameStates.app.nDifficultyLevel != i) { gameStates.app.nDifficultyLevel = i; gameData.bosses.InitGateIntervals (); } SavePlayerProfile (); paletteManager.DisableEffect (); if (!bMsnLoaded) LoadMission (nMission); if (!StartNewGame (nLevel)) SetFunctionMode (FMODE_MENU); }
void LegacyNewGameMenu (void) { int nNewLevel, nHighestPlayerLevel; int nMissions; CStack<char*> m (MAX_MISSIONS); int i, choice = 0, nFolder = -1, nDefaultMission = 0; CListBox lb; static int nMission = -1; static const char *menuTitles [4]; menuTitles [0] = TXT_NEW_GAME; menuTitles [1] = TXT_NEW_D1GAME; menuTitles [2] = TXT_NEW_D2GAME; menuTitles [3] = TXT_NEW_GAME; gameStates.app.bD1Mission = 0; gameStates.app.bD1Data = 0; SetDataVersion (-1); if ((nMission < 0) || gameOpts->app.bSinglePlayer) gameFolders.szMsnSubDir [0] = '\0'; hogFileManager.UseMission (""); do { nMissions = BuildMissionList (0, nFolder); if (nMissions < 1) return; for (i = 0; i < nMissions; i++) { m.Push (gameData.missions.list [i].szMissionName); if (!stricmp (m [i], gameConfig.szLastMission)) nDefaultMission = i; } nMission = lb.ListBox (menuTitles [gameOpts->app.nVersionFilter], m, nDefaultMission); GameFlushInputs (); if (nMission == -1) return; //abort! nFolder = nMission; } while (!gameData.missions.list [nMission].nDescentVersion); strcpy (gameConfig.szLastMission, m [nMission]); if (!LoadMission (nMission)) { MsgBox (NULL, NULL, 1, TXT_OK, TXT_ERROR_MSNFILE); return; } gameStates.app.bD1Mission = (gameData.missions.list [nMission].nDescentVersion == 1); gameData.missions.nLastMission = nMission; nNewLevel = 1; PrintLog (" getting highest level allowed to play\n"); nHighestPlayerLevel = GetHighestLevel (); if (nHighestPlayerLevel > gameData.missions.nLastLevel) nHighestPlayerLevel = gameData.missions.nLastLevel; if (nHighestPlayerLevel > 1) { CMenu m (2); char szInfo [80]; char szNumber [10]; try_again: sprintf (szInfo, "%s %d", TXT_START_ANY_LEVEL, nHighestPlayerLevel); m.AddText (szInfo, 0); strcpy (szNumber, "1"); m.AddInput (szNumber, 10, ""); choice = m.Menu (NULL, TXT_SELECT_START_LEV); if ((choice == -1) || !m [1].m_text [0]) return; nNewLevel = atoi (m [1].m_text); if ((nNewLevel <= 0) || (nNewLevel > nHighestPlayerLevel)) { m [0].SetText (const_cast<char*> (TXT_ENTER_TO_CONT)); MsgBox (NULL, NULL, 1, TXT_OK, TXT_INVALID_LEVEL); goto try_again; } } SavePlayerProfile (); if (!DifficultyMenu ()) return; paletteManager.DisableEffect (); if (!StartNewGame (nNewLevel)) SetFunctionMode (FMODE_MENU); }
void HandleTestKey(int key) { switch (key) { case KEYDBGGED + KEY_0: ShowWeaponStatus (); break; #ifdef SHOW_EXIT_PATH case KEYDBGGED + KEY_1: MarkPathToExit (); break; #endif case KEYDBGGED + KEY_Y: DoReactorDestroyedStuff(NULL); break; case KEYDBGGED + KEY_ALTED + KEY_D: networkData.nNetLifeKills=4000; networkData.nNetLifeKilled=5; MultiAddLifetimeKills (); break; case KEY_BACKSPACE: case KEY_CTRLED + KEY_BACKSPACE: case KEY_ALTED + KEY_BACKSPACE: case KEY_ALTED + KEY_CTRLED + KEY_BACKSPACE: case KEY_SHIFTED + KEY_BACKSPACE: case KEY_SHIFTED + KEY_ALTED + KEY_BACKSPACE: case KEY_SHIFTED + KEY_CTRLED + KEY_BACKSPACE: case KEY_SHIFTED + KEY_CTRLED + KEY_ALTED + KEY_BACKSPACE: Int3 (); break; case KEY_CTRLED + KEY_ALTED + KEY_ENTER: exit (0); break; case KEYDBGGED + KEY_S: audio.Reset (); break; case KEYDBGGED + KEY_P: if (gameStates.app.bGameSuspended & SUSP_ROBOTS) gameStates.app.bGameSuspended &= ~SUSP_ROBOTS; //robots move else gameStates.app.bGameSuspended |= SUSP_ROBOTS; //robots don't move break; case KEYDBGGED + KEY_K: LOCALPLAYER.shields = 1; MultiSendShields (); break; // a virtual kill case KEYDBGGED + KEY_SHIFTED + KEY_K: LOCALPLAYER.shields = -1; MultiSendShields (); break; // an actual kill case KEYDBGGED + KEY_X: LOCALPLAYER.lives++; break; // Extra life cheat key. case KEYDBGGED + KEY_H: // if (!(gameData.app.nGameMode & GM_MULTI)) { LOCALPLAYER.flags ^= PLAYER_FLAGS_CLOAKED; if (LOCALPLAYER.flags & PLAYER_FLAGS_CLOAKED) { if (gameData.app.nGameMode & GM_MULTI) MultiSendCloak (); AIDoCloakStuff (); LOCALPLAYER.cloakTime = gameData.time.xGame; #if TRACE console.printf (CON_DBG, "You are cloaked!\n"); #endif } else #if TRACE console.printf (CON_DBG, "You are DE-cloaked!\n"); #endif // } break; case KEYDBGGED + KEY_R: gameStates.app.cheats.bRobotsFiring = !gameStates.app.cheats.bRobotsFiring; break; case KEYDBGGED + KEY_R + KEY_SHIFTED: KillAllRobots (1); break; //flythrough keys #if DBG case KEYDBGGED + KEY_LAPOSTRO: showViewTextTimer = 0x30000; ObjectGotoNextViewer (); break; case KEYDBGGED + KEY_CTRLED + KEY_LAPOSTRO: showViewTextTimer = 0x30000; ObjectGotoPrevViewer (); break; #endif case KEYDBGGED + KEY_SHIFTED + KEY_LAPOSTRO: gameData.objs.viewerP=gameData.objs.consoleP; break; #if DBG case KEYDBGGED + KEY_O: ToggleOutlineMode (); break; #endif case KEYDBGGED + KEY_T: *Toggle_var = !*Toggle_var; #if TRACE console.printf (CON_DBG, "Variable at %08x set to %i\n", Toggle_var, *Toggle_var); #endif break; case KEYDBGGED + KEY_L: if (++gameStates.render.nLighting >= 2) gameStates.render.nLighting = 0; break; case KEYDBGGED + KEY_SHIFTED + KEY_L: xBeamBrightness = 0x38000 - xBeamBrightness; break; case KEY_PAD5: slew_stop (); break; case KEYDBGGED + KEY_F4: { //tCollisionData hitData; //CFixVector p0 = {-0x1d99a7, -0x1b20000, 0x186ab7f}; //CFixVector p1 = {-0x217865, -0x1b20000, 0x187de3e}; //FindHitpoint(&hitData, &p0, 0x1b9, &p1, 0x40000, 0x0, NULL, -1); break; } case KEYDBGGED + KEY_M: gameStates.app.bDebugSpew = !gameStates.app.bDebugSpew; if (gameStates.app.bDebugSpew) { mopen(0, 8, 1, 78, 16, "Debug Spew"); HUDInitMessage("Debug Spew: ON"); } else { mclose(0); HUDInitMessage("Debug Spew: OFF"); } break; case KEYDBGGED + KEY_C: paletteManager.SaveEffectAndReset (); DoCheatMenu (); paletteManager.LoadEffect (); break; case KEYDBGGED + KEY_SHIFTED + KEY_A: DoMegaWowPowerup(10); break; case KEYDBGGED + KEY_A: { DoMegaWowPowerup(200); // if (gameData.app.nGameMode & GM_MULTI) { // MsgBox(NULL, 1, "Damn", "CHEATER!\nYou cannot use the\nmega-thing in network mode."); // gameData.multigame.msg.nReceiver = 100; // Send to everyone... // sprintf(gameData.multigame.msg.szMsg, "%s cheated!", LOCALPLAYER.callsign); // } else { // DoMegaWowPowerup (); // } break; } case KEYDBGGED + KEY_F: gameStates.render.bShowFrameRate = !gameStates.render.bShowFrameRate; break; case KEYDBGGED + KEY_SPACEBAR: //KEY_F7: // Toggle physics flying slew_stop (); GameFlushInputs (); if (gameData.objs.consoleP->info.controlType != CT_FLYING) { FlyInit(gameData.objs.consoleP); gameStates.app.bGameSuspended &= ~SUSP_ROBOTS; //robots move } else { slew_init(gameData.objs.consoleP); //start CPlayerData slewing gameStates.app.bGameSuspended |= SUSP_ROBOTS; //robots don't move } break; case KEYDBGGED + KEY_COMMA: gameStates.render.xZoom = FixMul(gameStates.render.xZoom, 62259); break; case KEYDBGGED + KEY_PERIOD: gameStates.render.xZoom = FixMul(gameStates.render.xZoom, 68985); break; case KEYDBGGED + KEY_P + KEY_SHIFTED: Debug_pause = 1; break; case KEYDBGGED + KEY_B: { CMenu m (1); char text [FILENAME_LEN] = ""; int item; m.AddInput (text, FILENAME_LEN); item = m.Menu (NULL, "Briefing to play?"); if (item != -1) briefing.Run (text, 1); break; } case KEYDBGGED + KEY_F5: ToggleMovieSaving (); break; case KEYDBGGED + KEY_SHIFTED + KEY_F5: { extern int Movie_fixed_frametime; Movie_fixed_frametime = !Movie_fixed_frametime; break; } case KEYDBGGED + KEY_ALTED + KEY_F5: gameData.time.xGame = I2X(0x7fff - 840); //will overflow in 14 minutes #if TRACE console.printf (CON_DBG, "gameData.time.xGame bashed to %d secs\n", X2I(gameData.time.xGame)); #endif break; case KEYDBGGED + KEY_SHIFTED + KEY_B: KillEverything (1); break; } }