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

Function MainLoop

Descent3/descent.cpp:534–599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

532// #endif
533
534void MainLoop() {
535 int exit_game = 0;
536
537 while (!exit_game) {
538 if (Dedicated_server && !(Function_mode == GAME_MODE || Function_mode == QUIT_MODE))
539 SetFunctionMode(GAME_MODE);
540
541 switch (Function_mode) {
542 case QUIT_MODE:
543 exit_game = 1;
544 break;
545 case MENU_MODE:
546 exit_game = MainMenu();
547 break;
548 case RESTORE_GAME_MODE: // do special sequencing for load games.
549 SetGameState(GAMESTATE_LOADGAME);
550 PlayGame();
551 break;
552
553 case GAME_MODE:
554 SetGameState(GAMESTATE_NEW);
555 PlayGame(); // Does what is says.
556 break;
557 case LOADDEMO_MODE:
558 SetGameState(GAMESTATE_LOADDEMO);
559 PlayGame();
560 break;
561 case CREDITS_MODE:
562 Credits_Display();
563 Function_mode = MENU_MODE;
564 break;
565 case GAMEGAUGE_MODE:
566 break;
567#ifdef EDITOR
568 case EDITOR_GAME_MODE: // run level and then instead of menus, go to editor.
569 QuickPlayGame();
570 Function_mode = EDITOR_MODE;
571 break;
572 case EDITOR_MODE:
573 SetScreenMode(SM_NULL);
574 exit_game = 1; // this MainLoop call should be issued from editor, so
575 // this should just return to the editor
576 break;
577#endif
578
579 default:
580 Int3(); // Bogus function mode
581 }
582 }
583 // Clean up these items so we don't report them as leaked memory
584 Sound_system.KillSoundLib(true);
585 for (int a = 0; a < MAX_PLAYERS; a++) {
586 Players[a].inventory.Reset(false, INVRESET_ALL);
587 Players[a].counter_measures.Reset(false, INVRESET_ALL);
588 }
589
590#if defined(OEM)
591 if (!Dedicated_server)

Callers 2

RunGameFromEditorFunction · 0.85
Descent3Function · 0.85

Calls 11

SetFunctionModeFunction · 0.85
MainMenuFunction · 0.85
SetGameStateFunction · 0.85
PlayGameFunction · 0.85
Credits_DisplayFunction · 0.85
QuickPlayGameFunction · 0.85
SetScreenModeFunction · 0.85
ShowStaticScreenFunction · 0.85
FreeMultiDLLFunction · 0.85
KillSoundLibMethod · 0.80
ResetMethod · 0.45

Tested by

no test coverage detected