Skip to content

Commit

Permalink
- when a damaging sector's damage interval is 0, instantly kill the p…
Browse files Browse the repository at this point in the history
…layer instead of dividing by 0
  • Loading branch information
madame-rachelle committed Jun 23, 2020
1 parent ece526a commit 90895d1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/playsim/p_spec.cpp
Expand Up @@ -452,9 +452,15 @@ void P_PlayerInSpecialSector (player_t *player, sector_t * sector)
player->hazardtype = sector->damagetype;
player->hazardinterval = sector->damageinterval;
}
else if (Level->time % sector->damageinterval == 0)
else if ((sector->damageinterval == 0) || (Level->time % sector->damageinterval == 0))
{
if (!(player->cheats & (CF_GODMODE|CF_GODMODE2))) P_DamageMobj(player->mo, NULL, NULL, sector->damageamount, sector->damagetype);
if (!(player->cheats & (CF_GODMODE | CF_GODMODE2)))
{
if (sector->damageinterval == 0 && sector->damageamount > 0) // level designer seems to be a bit of a sadist, we're going to just instantly kill the player if damageamount is above 0.
P_DamageMobj(player->mo, NULL, NULL, TELEFRAG_DAMAGE, sector->damagetype);
else
P_DamageMobj(player->mo, NULL, NULL, sector->damageamount, sector->damagetype);
}
if ((sector->Flags & SECF_ENDLEVEL) && player->health <= 10 && (!deathmatch || !(dmflags & DF_NO_EXIT)))
{
Level->ExitLevel(0, false);
Expand Down

0 comments on commit 90895d1

Please sign in to comment.