- Exhumed: fixed map startuo

This commit is contained in:
Christoph Oelckers 2020-08-23 12:59:01 +02:00
parent 5c7b613aa7
commit 212b3ae0f9
3 changed files with 22 additions and 19 deletions

View file

@ -813,7 +813,9 @@ public:
{ {
return; return;
} }
#ifdef _DEBUG
nLevelBest = kMap20; nLevelBest = kMap20;
#endif
if (nLevel < 1) nLevel = 1; if (nLevel < 1) nLevel = 1;
if (nLevelNew < 1) nLevelNew = nLevel; if (nLevelNew < 1) nLevelNew = nLevel;
@ -848,7 +850,7 @@ void TextOverlay::ComputeCinemaText()
void TextOverlay::ReadyCinemaText(uint16_t nVal) void TextOverlay::ReadyCinemaText(uint16_t nVal)
{ {
FStringf label("TXT_EX_LASTLEVEL%d", nVal + 1); FStringf label("TXT_EX_CINEMA%d", nVal + 1);
label = GStrings(label); label = GStrings(label);
screentext = label.Split("\n"); screentext = label.Split("\n");
ComputeCinemaText(); ComputeCinemaText();

View file

@ -65,35 +65,37 @@ void DrawClock();
int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk); int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk);
void DoTitle(CompletionFunc completion); void DoTitle(CompletionFunc completion);
int levelnew = -1; static int FinishLevel(TArray<JobDesc> &jobs)
void FinishLevel(TArray<JobDesc> jobs)
{ {
if (levelnum > nBestLevel) { if (levelnum > nBestLevel) {
nBestLevel = levelnum - 1; nBestLevel = levelnum - 1;
} }
levelnew = levelnum + 1;
StopAllSounds(); StopAllSounds();
bCamera = false; bCamera = false;
nMapMode = 0; nMapMode = 0;
if (levelnum != kMap20 && EndLevel != 2) STAT_Update(levelnum == kMap20);
if (levelnum != kMap20)
{
if (EndLevel != 2)
{ {
// There's really no choice but to enter an active wait loop here to make the sound play out. // There's really no choice but to enter an active wait loop here to make the sound play out.
PlayLocalSound(StaticSound[59], 0, true, CHANF_UI); PlayLocalSound(StaticSound[59], 0, true, CHANF_UI);
int nTicks = totalclock + 12; int nTicks = totalclock + 12;
while (nTicks > (int)totalclock) { HandleAsync(); } while (nTicks > (int)totalclock) { HandleAsync(); }
} }
}
else nPlayerLives[0] = 0; else nPlayerLives[0] = 0;
DoAfterCinemaScene(levelnum, jobs); DoAfterCinemaScene(levelnum, jobs);
return levelnum == kMap20? -1 : levelnum + 1;
} }
void showmap(short nLevel, short nLevelNew, short nLevelBest, TArray<JobDesc> jobs) static void showmap(short nLevel, short nLevelNew, short nLevelBest, TArray<JobDesc> &jobs)
{ {
if (nLevelNew == 5 && !(nCinemaSeen & 1)) { if (nLevelNew == 5 && !(nCinemaSeen & 1)) {
nCinemaSeen |= 1; nCinemaSeen |= 1;
@ -175,18 +177,17 @@ void CheckProgression()
{ {
TArray<JobDesc> jobs; TArray<JobDesc> jobs;
bool startlevel = false; bool startlevel = false;
int mylevelnew = levelnew; int mylevelnew = -1;
levelnew = -1;
if (GameAction >= 0) if (GameAction >= 0)
{ {
if (GameAction < 1000) if (GameAction < 1000)
{ {
// start a new game on the given level // start a new game on the given level
GameAction = -1;
mylevelnew = GameAction; mylevelnew = GameAction;
GameAction = -1;
InitNewGame(); InitNewGame();
if (mylevelnew > 0) STAT_StartNewGame("Exhumed", 1);
if (mylevelnew != 0) nBestLevel = mylevelnew - 1; if (mylevelnew != 0) nBestLevel = mylevelnew - 1;
} }
else else
@ -200,7 +201,7 @@ void CheckProgression()
else if (EndLevel) else if (EndLevel)
{ {
if (levelnum == 0) startmainmenu(); if (levelnum == 0) startmainmenu();
else FinishLevel(jobs); else mylevelnew = FinishLevel(jobs);
EndLevel = false; EndLevel = false;
} }
if (mylevelnew > -1 && mylevelnew < kMap20) if (mylevelnew > -1 && mylevelnew < kMap20)
@ -239,6 +240,7 @@ void CheckProgression()
if (selectedlevelnew == 11) nCinemaSeen |= 2; if (selectedlevelnew == 11) nCinemaSeen |= 2;
if (mylevelnew != selectedlevelnew) STAT_Cancel(); if (mylevelnew != selectedlevelnew) STAT_Cancel();
else STAT_NewLevel(currentLevel->labelName);
} }
}); });
} }
@ -284,14 +286,13 @@ int GameInterface::app_main()
case GS_STARTUP: case GS_STARTUP:
totalclock = 0; totalclock = 0;
ototalclock = 0; ototalclock = 0;
levelnew = -1;
GameAction = -1; GameAction = -1;
EndLevel = false; EndLevel = false;
if (userConfig.CommandMap.IsNotEmpty()) if (userConfig.CommandMap.IsNotEmpty())
{ {
auto map = FindMapByName(userConfig.CommandMap); auto map = FindMapByName(userConfig.CommandMap);
if (map) levelnew = map->levelNumber; if (map) GameAction = map->levelNumber;
userConfig.CommandMap = ""; userConfig.CommandMap = "";
continue; continue;
} }
@ -322,7 +323,6 @@ int GameInterface::app_main()
catch (CRecoverableError& err) catch (CRecoverableError& err)
{ {
// Clear all progression sensitive variables here. // Clear all progression sensitive variables here.
levelnew = -1;
GameAction = -1; GameAction = -1;
EndLevel = false; EndLevel = false;
C_FullConsole(); C_FullConsole();

View file

@ -184,6 +184,7 @@ void InitLevel(int level)
if (!LoadLevel(level)) { if (!LoadLevel(level)) {
I_Error("Can't load level %d...\n", level); I_Error("Can't load level %d...\n", level);
} }
currentLevel = FindMapByLevelNum(level);
for (int i = 0; i < nTotalPlayers; i++) for (int i = 0; i < nTotalPlayers; i++)
{ {