- when a damaging sector's damage interval is 0, instantly kill the player instead of dividing by 0

This commit is contained in:
Rachael Alexanderson 2020-06-23 13:12:14 -04:00
parent ece526a99c
commit 90895d154b

View file

@ -452,9 +452,15 @@ void P_PlayerInSpecialSector (player_t *player, sector_t * sector)
player->hazardtype = sector->damagetype; player->hazardtype = sector->damagetype;
player->hazardinterval = sector->damageinterval; 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))) if ((sector->Flags & SECF_ENDLEVEL) && player->health <= 10 && (!deathmatch || !(dmflags & DF_NO_EXIT)))
{ {
Level->ExitLevel(0, false); Level->ExitLevel(0, false);