MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / MainMenu

Function MainMenu

Descent3/menu.cpp:715–918  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

713bool FirstGame = false;
714
715int MainMenu() {
716 mmInterface main_menu;
717 bool exit_game = false;
718 bool exit_menu = false;
719
720 // okay over here, we'll decide whether we've finished the training mission and are going into game.
721 if (!Demo_looping && !Demo_restart && !MultiDLLGameStarting) {
722 if (FirstGame) {
723 if (MenuNewGame()) {
724 return 0;
725 }
726 }
727 }
728
729 // setup screen
730 SetScreenMode(SM_MENU);
731 // create interface
732 main_menu.Create();
733 main_menu.AddItem(IDV_NEWGAME, KEY_N, TXT_MENUNEWGAME, MM_STARTMENU_TYPE);
734 main_menu.AddItem(IDV_LOADGAME, KEY_L, TXT_LOADGAME);
735 // #ifndef DEMO
736 main_menu.AddItem(IDV_PLAYDEMO, KEY_D, TXT_VIEWDEMO);
737 // #endif
738 main_menu.AddItem(IDV_OPTIONS, KEY_O, TXT_MENUOPTIONS);
739 main_menu.AddItem(IDV_PILOT, KEY_P, TXT_MENUPILOTS);
740 main_menu.AddItem(IDV_MULTIPLAYER, KEY_M, TXT_MENUMULTIPLAYER);
741 main_menu.AddItem(IDV_CREDITS, KEY_C, TXT_MENUCREDITS);
742 main_menu.AddItem(IDV_QUIT, KEY_Q, TXT_MENUQUIT, MM_ENDMENU_TYPE);
743#ifdef _DEBUG
744 main_menu.AddItem(0, 0, NULL);
745 main_menu.AddItem(IDV_LOADLEVEL, 0, "Load Level");
746#endif
747 // page in ui data.
748 newuiCore_PageInBitmaps();
749 // do special junk.
750
751 // Only check for pilot arg first time, not every tme
752 static bool first_time = true;
753 if (first_time) {
754 int pilotarg = FindArg("+name");
755 if (!pilotarg) {
756 pilotarg = FindArg("-pilot");
757 }
758 if (pilotarg) {
759 char pfilename[_MAX_FNAME];
760 strcpy(pfilename, GameArgs[pilotarg + 1]);
761 strcat(pfilename, ".plt");
762 Current_pilot.set_filename(pfilename);
763 PltReadFile(&Current_pilot, true);
764 }
765 first_time = false;
766 }
767 char pfilename[_MAX_FNAME];
768 Current_pilot.get_filename(pfilename);
769
770 if ((pfilename[0] == '\0') || (strlen(pfilename) == 0) || (!strcmp(pfilename, " ")))
771 PilotSelect();
772

Callers 1

MainLoopFunction · 0.85

Calls 15

SetScreenModeFunction · 0.85
newuiCore_PageInBitmapsFunction · 0.85
PltReadFileFunction · 0.85
PilotSelectFunction · 0.85
SetGameModeFunction · 0.85
ProcessCommandLineFunction · 0.85
SetFunctionModeFunction · 0.85
DoWaitMessageFunction · 0.85
MenuSceneFunction · 0.85
DoMessageBoxFunction · 0.85

Tested by

no test coverage detected