mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-29 04:50:42 +00:00
- changed startnewgame to handle the screen jobs asynchronously.
This commit is contained in:
parent
a3e9ea97a8
commit
a1001c5fdd
3 changed files with 32 additions and 25 deletions
|
@ -55,7 +55,8 @@ static void dowarp(MapRecord *map)
|
||||||
|
|
||||||
if (ps[myconnectindex].gm & MODE_GAME)
|
if (ps[myconnectindex].gm & MODE_GAME)
|
||||||
{
|
{
|
||||||
newgame(map, ud.m_player_skill);
|
ready2send = 0;
|
||||||
|
donewgame(map, ud.m_player_skill);
|
||||||
ps[myconnectindex].gm = MODE_RESTART;
|
ps[myconnectindex].gm = MODE_RESTART;
|
||||||
}
|
}
|
||||||
else startnewgame(map, ud.m_player_skill);
|
else startnewgame(map, ud.m_player_skill);
|
||||||
|
|
|
@ -225,7 +225,8 @@ void e4intro(CompletionFunc completion);
|
||||||
void clearfrags(void);
|
void clearfrags(void);
|
||||||
int exitlevel();
|
int exitlevel();
|
||||||
int enterlevel(MapRecord* mi, int gm);
|
int enterlevel(MapRecord* mi, int gm);
|
||||||
void newgame(MapRecord* mi, int sk);
|
void newgame(MapRecord* mi, int sk, CompletionFunc completion);
|
||||||
|
void donewgame(MapRecord* map, int sk);
|
||||||
void startnewgame(MapRecord* map, int skill);
|
void startnewgame(MapRecord* map, int skill);
|
||||||
void setlocalplayerinput(player_struct *pp);
|
void setlocalplayerinput(player_struct *pp);
|
||||||
void PlayerColorChanged(void);
|
void PlayerColorChanged(void);
|
||||||
|
|
|
@ -771,7 +771,7 @@ void resettimevars(void)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static void donewgame(MapRecord* map, int sk)
|
void donewgame(MapRecord* map, int sk)
|
||||||
{
|
{
|
||||||
auto p = &ps[0];
|
auto p = &ps[0];
|
||||||
show_shareware = 26 * 34;
|
show_shareware = 26 * 34;
|
||||||
|
@ -837,29 +837,33 @@ static void donewgame(MapRecord* map, int sk)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void newgame(MapRecord* map, int sk)
|
void newgame(MapRecord* map, int sk, CompletionFunc completion)
|
||||||
{
|
{
|
||||||
handleevents();
|
handleevents();
|
||||||
ready2send = 0;
|
ready2send = 0;
|
||||||
|
|
||||||
auto completion = [=](bool)
|
auto completion1 = [=](bool res)
|
||||||
{
|
{
|
||||||
if (!isRR() && map->levelNumber == levelnum(3, 0) && (ud.multimode < 2))
|
if (!isRR() && map->levelNumber == levelnum(3, 0) && (ud.multimode < 2))
|
||||||
{
|
{
|
||||||
e4intro([=](bool) { donewgame(map, sk); });
|
e4intro([=](bool) { donewgame(map, sk); if (completion) completion(res); });
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
donewgame(map, sk);
|
||||||
|
if (completion) completion(res);
|
||||||
}
|
}
|
||||||
else donewgame(map, sk);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ud.m_recstat != 2 && ud.last_level >= 0 && ud.multimode > 1 && ud.coop != 1)
|
if (ud.m_recstat != 2 && ud.last_level >= 0 && ud.multimode > 1 && ud.coop != 1)
|
||||||
dobonus(1, completion);
|
dobonus(1, completion1);
|
||||||
|
|
||||||
#if 0 // this is one lousy hack job that's hopefully not needed anymore.
|
#if 0 // this is one lousy hack job that's hopefully not needed anymore.
|
||||||
else if (isRR() && !isRRRA() && map->levelNumber == levelnum(0, 6))
|
else if (isRR() && !isRRRA() && map->levelNumber == levelnum(0, 6))
|
||||||
dobonus(0, completion);
|
dobonus(0, completion1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
else completion(false);
|
else completion1(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -1029,21 +1033,22 @@ int enterlevel(MapRecord *mi, int gamemode)
|
||||||
|
|
||||||
void startnewgame(MapRecord* map, int skill)
|
void startnewgame(MapRecord* map, int skill)
|
||||||
{
|
{
|
||||||
newgame(map, skill);
|
newgame(map, skill, [=](bool)
|
||||||
|
{
|
||||||
if (enterlevel(map, MODE_GAME))
|
if (enterlevel(map, MODE_GAME))
|
||||||
{
|
{
|
||||||
ps[myconnectindex].gm = 0;
|
ps[myconnectindex].gm = 0;
|
||||||
startmainmenu();
|
startmainmenu();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ud.showweapons = cl_showweapon;
|
ud.showweapons = cl_showweapon;
|
||||||
setlocalplayerinput(&ps[myconnectindex]);
|
setlocalplayerinput(&ps[myconnectindex]);
|
||||||
PlayerColorChanged();
|
PlayerColorChanged();
|
||||||
inputState.ClearAllInput();
|
inputState.ClearAllInput();
|
||||||
gamestate = GS_LEVEL;
|
gamestate = GS_LEVEL;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue