- fixed some initialization issues with the new main loop.

Looks like all map starting cases are working now.
This commit is contained in:
Christoph Oelckers 2020-08-16 22:45:19 +02:00
parent 695d81f88c
commit 85538b467b
3 changed files with 46 additions and 38 deletions

View file

@ -746,6 +746,8 @@ void EndOfLevel()
void GameTicker(void)
{
if (!ExitLevel)
{
if (SavegameLoaded)
{
InitLevelGlobals();
@ -758,11 +760,13 @@ void GameTicker(void)
int SavePlayClock = PlayClock;
InitTimingVars();
PlayClock = SavePlayClock;
ExitLevel = false;
}
else if (NextLevel)
{
InitLevel();
InitRunLevel();
ExitLevel = false;
}
ready2send = 1;
@ -788,6 +792,7 @@ void GameTicker(void)
drawscreen(Player + screenpeek);
ready2send = 0;
}
if (ExitLevel)
{
ExitLevel = false;
@ -812,7 +817,7 @@ int32_t GameInterface::app_main()
try
{
// if the menu initiazed a new game or loaded a savegame, switch to play mode.
if (NewGame || SavegameLoaded) gamestate = GS_LEVEL;
if (SavegameLoaded || NextLevel) gamestate = GS_LEVEL;
handleevents();
updatePauseStatus();

View file

@ -2121,6 +2121,7 @@ void DoSoundSpotMatch(short match, short sound_num, short sound_type);
//
///////////////////////////////////////////////////////////////////////////////////////////
extern SWBOOL NewGame;
extern SWBOOL ExitLevel, FinishedLevel;
extern SWBOOL Warping;
extern uint8_t CommPlayers;

View file

@ -46,6 +46,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mapinfo.h"
#include "jsector.h"
#include "network.h"
#include "gamestate.h"
BEGIN_SW_NS
@ -66,6 +67,7 @@ static void levelwarp(MapRecord *maprec)
NextLevel = maprec;
ExitLevel = TRUE;
if (gamestate == GS_MENUSCREEN || gamestate == GS_FULLCONSOLE) NewGame = true;
sprintf(ds, "%s %s", GStrings("TXT_ENTERING"), maprec->DisplayName());
PutStringInfo(pp, ds);