- fixing some issues. Level transitions in Duke are working now.

This commit is contained in:
Christoph Oelckers 2020-09-04 00:20:32 +02:00
parent e5e8c02f1d
commit 77f96a1c75
5 changed files with 17 additions and 9 deletions

View file

@ -236,7 +236,7 @@ void ChangeLevel(MapRecord* map, int skill)
{
Net_WriteByte(DEM_CHANGEMAP);
Net_WriteByte(skill);
Net_WriteString(map->labelName);
Net_WriteString(map? map->labelName : nullptr);
}
//---------------------------------------------------------------------------

View file

@ -139,7 +139,9 @@ static void GameTicker()
g_nextskill = -1;
FX_StopAllSounds();
FX_SetReverb(0);
gi->NextLevel(currentLevel, -1);
gi->FreeLevelData();
gamestate = GS_LEVEL;
gi->NextLevel(g_nextmap, -1);
break;
case ga_completed:
@ -149,7 +151,8 @@ static void GameTicker()
{
// if the same level is restarted, skip any progression stuff like summary screens or cutscenes.
gi->FreeLevelData();
gi->NextLevel(currentLevel, g_nextskill);
gamestate = GS_LEVEL;
gi->NextLevel(g_nextmap, g_nextskill);
}
else
gi->LevelCompleted(g_nextmap, g_nextskill);
@ -157,13 +160,15 @@ static void GameTicker()
case ga_nextlevel:
gi->FreeLevelData();
gi->NextLevel(currentLevel, g_nextskill);
gamestate = GS_LEVEL;
gi->NextLevel(g_nextmap, g_nextskill);
break;
case ga_newgame:
FX_StopAllSounds();
FX_SetReverb(0);
gi->FreeLevelData();
gamestate = GS_LEVEL;
gi->NewGame(g_nextmap, g_nextskill);
break;
@ -289,6 +294,7 @@ void Display()
switch (gamestate)
{
case GS_MENUSCREEN:
case GS_FULLCONSOLE:
gi->DrawBackground();
break;
@ -314,6 +320,7 @@ void Display()
break;
default:
twod->ClearScreen();
break;
}
@ -392,7 +399,7 @@ void TryRunTics (void)
bool doWait = cl_capfps || pauseext || (r_NoInterpolate && !M_IsAnimated());
// get real tics
if (doWait && gamestate != GS_INTERMISSION) // GS_INTERMISSION needs uncapped frame rate.
if (doWait && gamestate != GS_INTERMISSION && gamestate != GS_INTRO) // GS_INTERMISSION needs uncapped frame rate.
{
entertic = I_WaitForTic (oldentertics);
}

View file

@ -415,8 +415,8 @@ class ScreenJobRunner
int index = -1;
float screenfade;
bool clearbefore;
uint64_t startTime = -1;
uint64_t lastTime = -1;
int64_t startTime = -1;
int64_t lastTime = -1;
int actionState;
int terminateState;
@ -474,7 +474,7 @@ public:
auto now = I_nsTime();
bool processed = job.job->ProcessInput();
bool skiprequest = inputState.CheckAllInput() && !processed;
if (startTime == -1) startTime = now;
if (startTime == -1) lastTime = startTime = now;
if (M_Active())
{

View file

@ -879,6 +879,7 @@ public:
int Frame(uint64_t clock, bool skiprequest)
{
Printf("Clock = %llu\n", clock);
if (clock == 0) S_PlayBonusMusic();
twod->ClearScreen();
int currentclock = int(clock * 120 / 1'000'000'000);

View file

@ -166,7 +166,7 @@ void GameInterface::NextLevel(MapRecord* map, int skill)
{
ud.m_player_skill = skill + 1;
int res = enterlevel(map, 0);
if (!res) gameaction = ga_startup;
if (res) gameaction = ga_startup;
}
//---------------------------------------------------------------------------