- more restructuring of asynchronously playing sequences.

This commit is contained in:
Christoph Oelckers 2020-07-18 22:38:19 +02:00
parent c767ead84f
commit e97e663b49
3 changed files with 33 additions and 39 deletions

View file

@ -178,7 +178,6 @@ void FTA(int q, struct player_struct* p)
//========================================================================== //==========================================================================
// //
// Draws the background // Draws the background
// todo: split up to have dedicated functions for both cases.
// //
//========================================================================== //==========================================================================

View file

@ -109,23 +109,6 @@ void prediction()
getpackets(); getpackets();
#endif #endif
} }
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
static int menuloop(void)
{
FX_StopAllSounds();
while (menuactive != MENU_Off)
{
handleevents();
drawbackground();
videoNextPage();
}
return 0;
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
@ -317,7 +300,6 @@ int moveloop()
bool GameTicker() bool GameTicker()
{ {
handleevents();
if (ps[myconnectindex].gm == MODE_DEMO) if (ps[myconnectindex].gm == MODE_DEMO)
{ {
M_ClearMenus(); M_ClearMenus();
@ -429,10 +411,13 @@ void app_loop()
M_StartControlPanel(false); M_StartControlPanel(false);
M_SetMenu(NAME_Mainmenu); M_SetMenu(NAME_Mainmenu);
if (menuloop())
{
FX_StopAllSounds(); FX_StopAllSounds();
continue;
while (menuactive != MENU_Off)
{
handleevents();
drawbackground();
videoNextPage();
} }
} }
@ -444,6 +429,7 @@ void app_loop()
bool res; bool res;
do do
{ {
handleevents();
res = GameTicker(); res = GameTicker();
videoNextPage(); videoNextPage();
} while (!res); } while (!res);

View file

@ -768,20 +768,9 @@ void resettimevars(void)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void newgame(MapRecord* map, int sk) static void donewgame(MapRecord* map, int sk)
{ {
auto p = &ps[0]; 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; show_shareware = 26 * 34;
ud.nextLevel = map; ud.nextLevel = map;
@ -791,11 +780,6 @@ void newgame(MapRecord* map, int sk)
ud.last_level = -1; ud.last_level = -1;
if (!isRR() && map->levelNumber == levelnum(3, 0) && (ud.multimode < 2))
{
e4intro([](bool) {});
}
p->zoom = 768; p->zoom = 768;
p->gm = 0; p->gm = 0;
M_ClearMenus(); 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);
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// //