mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 04:20:42 +00:00
- Blood: back up player state before ending the level, not just before loading the new one.
The latter is too late, the player's actor data may already be stale and invalid here.
This commit is contained in:
parent
8a2385dd89
commit
ca10495d7c
5 changed files with 19 additions and 24 deletions
|
@ -194,20 +194,8 @@ static void GameTicker()
|
|||
case ga_completed:
|
||||
FX_StopAllSounds();
|
||||
FX_SetReverb(0);
|
||||
if (g_nextmap == currentLevel)
|
||||
{
|
||||
// if the same level is restarted, skip any progression stuff like summary screens or cutscenes.
|
||||
gi->FreeLevelData();
|
||||
gameaction = ga_level;
|
||||
gi->NextLevel(g_nextmap, g_nextskill);
|
||||
ResetStatusBar();
|
||||
Net_ClearFifo();
|
||||
}
|
||||
else
|
||||
{
|
||||
gi->LevelCompleted(g_nextmap, g_nextskill);
|
||||
assert(gameaction != ga_nothing);
|
||||
}
|
||||
gi->LevelCompleted(g_nextmap, g_nextskill);
|
||||
assert(gameaction != ga_nothing);
|
||||
break;
|
||||
|
||||
case ga_nextlevel:
|
||||
|
|
|
@ -188,6 +188,12 @@ void ShowScoreboard(int numplayers, const CompletionFunc& completion_)
|
|||
|
||||
void ShowIntermission(MapRecord* fromMap, MapRecord* toMap, SummaryInfo* info, CompletionFunc completion_)
|
||||
{
|
||||
if (fromMap == toMap)
|
||||
{
|
||||
// don't show intermission when restarting the same level.
|
||||
completion_(false);
|
||||
return;
|
||||
}
|
||||
bool bossexit = g_bossexit;
|
||||
g_bossexit = false;
|
||||
|
||||
|
|
|
@ -154,7 +154,6 @@ void StartLevel(MapRecord* level, bool newgame)
|
|||
if (!level) return;
|
||||
gFrameCount = 0;
|
||||
PlayClock = 0;
|
||||
EndLevel();
|
||||
inputState.ClearAllInput();
|
||||
currentLevel = level;
|
||||
|
||||
|
@ -172,14 +171,6 @@ void StartLevel(MapRecord* level, bool newgame)
|
|||
gRedFlagDropped = false;
|
||||
}
|
||||
#endif
|
||||
if (!newgame)
|
||||
{
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
memcpy(&gPlayerTemp[i], &gPlayer[i], sizeof(PLAYER));
|
||||
gHealthTemp[i] = gPlayer[i].actor->x().health;
|
||||
}
|
||||
}
|
||||
//drawLoadingScreen();
|
||||
BloodSpawnSpriteDef sprites;
|
||||
dbLoadMap(currentLevel->fileName, (int*)&startpos.x, (int*)&startpos.y, (int*)&startpos.z, &startang, &startsector, nullptr, sprites);
|
||||
|
|
|
@ -80,7 +80,7 @@ void QuitGame(void);
|
|||
void PreloadCache(void);
|
||||
void ProcessFrame(void);
|
||||
void ScanINIFiles(void);
|
||||
void EndLevel();
|
||||
void EndLevel(bool);
|
||||
|
||||
struct MIRROR
|
||||
{
|
||||
|
|
|
@ -38,6 +38,16 @@ BEGIN_BLD_NS
|
|||
|
||||
void GameInterface::LevelCompleted(MapRecord *map, int skill)
|
||||
{
|
||||
// Save the player state before taking down anything.
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
if (gPlayer[i].actor)
|
||||
{
|
||||
memcpy(&gPlayerTemp[i], &gPlayer[i], sizeof(PLAYER));
|
||||
gHealthTemp[i] = gPlayer[i].actor->x().health;
|
||||
}
|
||||
}
|
||||
|
||||
EndLevel();
|
||||
Mus_Stop();
|
||||
|
||||
|
|
Loading…
Reference in a new issue