- Exhumed: added a white flash and fixed the accompanying sound when exiting a level.

See #375
This commit is contained in:
Christoph Oelckers 2020-09-11 20:56:46 +02:00
parent 1646e302d2
commit cddd5d3a4c
5 changed files with 34 additions and 25 deletions

View file

@ -54,6 +54,7 @@ extern short bPlayerPan;
extern short bLockPan; extern short bLockPan;
static MapRecord* NextMap;
void uploadCinemaPalettes(); void uploadCinemaPalettes();
int32_t registerosdcommands(void); int32_t registerosdcommands(void);
@ -457,16 +458,32 @@ void GameInterface::Ticker()
else else
{ {
// Wait for the end of level sound to play out, but stop updating the playsim. // Wait for the end of level sound to play out, but stop updating the playsim.
EndLevel--; if (EndLevel == 13)
PlayLocalSound(StaticSound[59], 0, true, CHANF_UI);
if (EndLevel > 1) EndLevel--;
r_NoInterpolate = false; r_NoInterpolate = false;
if (EndLevel == 0) int flash = 7 - abs(EndLevel - 7);
{ videoTintBlood(flash * 30, flash * 30, flash * 30);
auto map = currentLevel->levelNumber == 20? nullptr : FindMapByLevelNum(currentLevel->levelNumber+1); // todo: Use the map record for progression if (EndLevel == 1)
CompleteLevel(map); {
} if (!soundEngine->GetSoundPlayingInfo(SOURCE_None, nullptr, StaticSound[59] + 1))
{
videoTintBlood(0, 0, 0);
CompleteLevel(NextMap);
NextMap = nullptr;
EndLevel = 0;
}
}
} }
} }
void LevelFinished()
{
NextMap = currentLevel->levelNumber == 20 ? nullptr : FindMapByLevelNum(currentLevel->levelNumber + 1); // todo: Use the map record for progression
EndLevel = 13;
}
void ExitGame() void ExitGame()
{ {
ShutDown(); ShutDown();
@ -682,4 +699,9 @@ void LoadTextureState()
TileFiles.InvalidateTile(kEnergy2); TileFiles.InvalidateTile(kEnergy2);
} }
CCMD(endit)
{
LevelFinished();
}
END_PS_NS END_PS_NS

View file

@ -206,6 +206,7 @@ extern char g_modDir[BMAX_PATH];
void G_LoadGroupsInDir(const char* dirname); void G_LoadGroupsInDir(const char* dirname);
void G_DoAutoload(const char* dirname); void G_DoAutoload(const char* dirname);
void DrawRel(int tile, double x, double y, int shade = 0); void DrawRel(int tile, double x, double y, int shade = 0);
void LevelFinished();
// savegame. // savegame.

View file

@ -68,22 +68,8 @@ static void FinishLevel(int lnum, TArray<JobDesc> &jobs)
automapMode = am_off; automapMode = am_off;
STAT_Update(lnum == kMap20); STAT_Update(lnum == kMap20);
if (lnum != kMap20) if (lnum == kMap20)
{ nPlayerLives[0] = 0;
if (EndLevel == 13 && !netgame)
{
// 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 = I_msTime() + 100;
while (nTicks > I_msTime())
{
I_GetEvent();
soundEngine->UpdateSounds(I_GetTime());
}
Net_ClearFifo();
}
}
else nPlayerLives[0] = 0;
DoAfterCinemaScene(lnum-1, jobs); DoAfterCinemaScene(lnum-1, jobs);
} }

View file

@ -1544,7 +1544,7 @@ void DoFinale()
} }
else if (nFinaleStage == 3 && leveltime*4 >= nextstage) else if (nFinaleStage == 3 && leveltime*4 >= nextstage)
{ {
EndLevel = 13; LevelFinished();
} }
} }
else else

View file

@ -1068,7 +1068,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
} }
else else
{ {
EndLevel = 13; LevelFinished();
} }
return; return;
@ -2469,7 +2469,7 @@ do_default_b:
{ {
if (!bInDemo) if (!bInDemo)
{ {
EndLevel = 13; LevelFinished();
} }
DestroyItemAnim(nValB); DestroyItemAnim(nValB);