- 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;
}
#ifdef _DEBUG
nLevelBest = kMap20;
#endif
if (nLevel < 1) nLevel = 1;
if (nLevelNew < 1) nLevelNew = nLevel;
@ -848,7 +850,7 @@ void TextOverlay::ComputeCinemaText()
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);
screentext = label.Split("\n");
ComputeCinemaText();

View file

@ -65,35 +65,37 @@ void DrawClock();
int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk);
void DoTitle(CompletionFunc completion);
int levelnew = -1;
void FinishLevel(TArray<JobDesc> jobs)
static int FinishLevel(TArray<JobDesc> &jobs)
{
if (levelnum > nBestLevel) {
nBestLevel = levelnum - 1;
}
levelnew = levelnum + 1;
StopAllSounds();
bCamera = false;
nMapMode = 0;
if (levelnum != kMap20 && EndLevel != 2)
STAT_Update(levelnum == kMap20);
if (levelnum != kMap20)
{
// 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);
int nTicks = totalclock + 12;
while (nTicks > (int)totalclock) { HandleAsync(); }
if (EndLevel != 2)
{
// 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);
int nTicks = totalclock + 12;
while (nTicks > (int)totalclock) { HandleAsync(); }
}
}
else nPlayerLives[0] = 0;
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)) {
nCinemaSeen |= 1;
@ -175,18 +177,17 @@ void CheckProgression()
{
TArray<JobDesc> jobs;
bool startlevel = false;
int mylevelnew = levelnew;
levelnew = -1;
int mylevelnew = -1;
if (GameAction >= 0)
{
if (GameAction < 1000)
{
// start a new game on the given level
GameAction = -1;
mylevelnew = GameAction;
GameAction = -1;
InitNewGame();
if (mylevelnew > 0) STAT_StartNewGame("Exhumed", 1);
if (mylevelnew != 0) nBestLevel = mylevelnew - 1;
}
else
@ -200,7 +201,7 @@ void CheckProgression()
else if (EndLevel)
{
if (levelnum == 0) startmainmenu();
else FinishLevel(jobs);
else mylevelnew = FinishLevel(jobs);
EndLevel = false;
}
if (mylevelnew > -1 && mylevelnew < kMap20)
@ -239,6 +240,7 @@ void CheckProgression()
if (selectedlevelnew == 11) nCinemaSeen |= 2;
if (mylevelnew != selectedlevelnew) STAT_Cancel();
else STAT_NewLevel(currentLevel->labelName);
}
});
}
@ -284,14 +286,13 @@ int GameInterface::app_main()
case GS_STARTUP:
totalclock = 0;
ototalclock = 0;
levelnew = -1;
GameAction = -1;
EndLevel = false;
if (userConfig.CommandMap.IsNotEmpty())
{
auto map = FindMapByName(userConfig.CommandMap);
if (map) levelnew = map->levelNumber;
if (map) GameAction = map->levelNumber;
userConfig.CommandMap = "";
continue;
}
@ -322,7 +323,6 @@ int GameInterface::app_main()
catch (CRecoverableError& err)
{
// Clear all progression sensitive variables here.
levelnew = -1;
GameAction = -1;
EndLevel = false;
C_FullConsole();

View file

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