diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 6ecec0474..f329dad58 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -178,7 +178,6 @@ void FTA(int q, struct player_struct* p) //========================================================================== // // Draws the background -// todo: split up to have dedicated functions for both cases. // //========================================================================== diff --git a/source/games/duke/src/gameloop.cpp b/source/games/duke/src/gameloop.cpp index 82338d37a..98e3e7e6c 100644 --- a/source/games/duke/src/gameloop.cpp +++ b/source/games/duke/src/gameloop.cpp @@ -109,23 +109,6 @@ void prediction() getpackets(); #endif } -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -static int menuloop(void) -{ - FX_StopAllSounds(); - while (menuactive != MENU_Off) - { - handleevents(); - drawbackground(); - videoNextPage(); - } - return 0; -} //--------------------------------------------------------------------------- // @@ -317,7 +300,6 @@ int moveloop() bool GameTicker() { - handleevents(); if (ps[myconnectindex].gm == MODE_DEMO) { M_ClearMenus(); @@ -429,10 +411,13 @@ void app_loop() M_StartControlPanel(false); M_SetMenu(NAME_Mainmenu); - if (menuloop()) + FX_StopAllSounds(); + + while (menuactive != MENU_Off) { - FX_StopAllSounds(); - continue; + handleevents(); + drawbackground(); + videoNextPage(); } } @@ -444,6 +429,7 @@ void app_loop() bool res; do { + handleevents(); res = GameTicker(); videoNextPage(); } while (!res); diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index a96a4d277..0025a3a0e 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -768,20 +768,9 @@ void resettimevars(void) // //--------------------------------------------------------------------------- -void newgame(MapRecord* map, int sk) +static void donewgame(MapRecord* map, int sk) { auto p = &ps[0]; - handleevents(); - ready2send = 0; - -#if 0 - if (ud.m_recstat != 2 && ud.last_level >= 0 && ud.multimode > 1 && ud.coop != 1) - dobonus(1); - - if (isRR() && !isRRRA() && map->levelNumber == levelnum(0, 6)) - dobonus(0); -#endif - show_shareware = 26 * 34; ud.nextLevel = map; @@ -791,11 +780,6 @@ void newgame(MapRecord* map, int sk) ud.last_level = -1; - if (!isRR() && map->levelNumber == levelnum(3, 0) && (ud.multimode < 2)) - { - e4intro([](bool) {}); - } - p->zoom = 768; p->gm = 0; M_ClearMenus(); @@ -850,6 +834,31 @@ void newgame(MapRecord* map, int sk) } } +void newgame(MapRecord* map, int sk) +{ + handleevents(); + ready2send = 0; + + auto completion = [=](bool) + { + if (!isRR() && map->levelNumber == levelnum(3, 0) && (ud.multimode < 2)) + { + e4intro([=](bool) { donewgame(map, sk); }); + } + else donewgame(map, sk); + }; + + if (ud.m_recstat != 2 && ud.last_level >= 0 && ud.multimode > 1 && ud.coop != 1) + dobonus(1, completion); + +#if 0 // this is one lousy hack job that's hopefully not needed anymore. + else if (isRR() && !isRRRA() && map->levelNumber == levelnum(0, 6)) + dobonus(0, completion); +#endif + + else completion(false); +} + //--------------------------------------------------------------------------- // //