Difference between revisions of "Boss level ending not triggered if every player is dead"

From DoomWiki.org

[checked revision][checked revision]
(Minor grammar/style, +cat errors and bugs, +nightmare skill or -respawn can bypass)
m (One more grammar fix)
 
Line 7: Line 7:
 
== Technical details ==  
 
== Technical details ==  
  
The code that handles the effects of a boss' death is found the file {{c|p_enemy.c}} inside the function {{c|A_BossDeath}}.  
+
The code that handles the effects of a boss's death is found the file {{c|p_enemy.c}} inside the function {{c|A_BossDeath}}.  
  
 
The relevant code is the following:
 
The relevant code is the following:

Latest revision as of 16:34, 20 December 2018

In a multiplayer game with monsters, killing the episode's final boss will end the level and a text screen will be displayed. The level's ending is normally triggered after the boss's death animation has completed.

Due to a bug, the ending will not be triggered if every player is dead while the boss's death animation finishes. Although this is normal in single player, in multiplayer the players are able to respawn. So, as a result, they remain stuck on the level. There is no way to restart the level unlike when in single player mode, where this happens when the player dies.

This bug does not affect the final boss found in Doom II: Hell on Earth, TNT: Evilution and The Plutonia Experiment. It also does not act as a soft lock condition in "Nightmare!" skill level or with use of the -respawn command line parameter.

Technical details[edit]

The code that handles the effects of a boss's death is found the file p_enemy.c inside the function A_BossDeath.

The relevant code is the following:

   // make sure there is a player alive for victory
   for (i=0 ; i<MAXPLAYERS ; i++)
       if (playeringame[i] && players[i].health > 0)
           break;
   
   if (i==MAXPLAYERS)
       return;	// no one left alive, so do not end game

This code cycles through every player and checks if they have health remaining. If at least one player is alive, the loop will break and the last condition shown here will not be met. In the other case, the function will return and the remaining portion of the function which calls G_ExitLevel will never be executed.

This logic would work correctly if the function was called repetitively after the boss is dead. It would also make sense if the players did not have the ability to respawn and if the level restarted once every player was dead. This behavior was probably coded before the ability to respawn was added into the game.