From 154e1063150be76ab337436b568cffabf774c0a6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 6 Jan 2016 14:16:42 +0100 Subject: [PATCH] - make better use of the damageinterval value for Strife's delayed damage. --- src/d_player.h | 1 + src/p_spec.cpp | 9 +++++---- src/p_user.cpp | 6 ++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index dc5b27a2b..38879a63a 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -422,6 +422,7 @@ public: int killcount, itemcount, secretcount; // for intermission int damagecount, bonuscount;// for screen flashing int hazardcount; // for delayed Strife damage + int hazardinterval; // Frequency of damage infliction FName hazardtype; // Damage type of last hazardous damage encounter. int poisoncount; // screen flash for poison damage FName poisontype; // type of poison damage to apply diff --git a/src/p_spec.cpp b/src/p_spec.cpp index aa6e0235b..101309651 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -453,14 +453,15 @@ void P_PlayerInSpecialSector (player_t *player, sector_t * sector) } if (sector->Flags & SECF_ENDGODMODE) player->cheats &= ~CF_GODMODE; - if (level.time % sector->damageinterval == 0 && (ironfeet == NULL || pr_playerinspecialsector() < sector->leakydamage)) + if ((ironfeet == NULL || pr_playerinspecialsector() < sector->leakydamage)) { if (sector->Flags & SECF_HAZARD) { player->hazardcount += sector->damageamount; player->hazardtype = sector->damagetype; + player->hazardinterval = sector->damageinterval; } - else + else if (level.time % sector->damageinterval == 0) { P_DamageMobj(player->mo, NULL, NULL, sector->damageamount, sector->damagetype); if ((sector->Flags & SECF_ENDLEVEL) && player->health <= 10 && (!deathmatch || !(dmflags & DF_NO_EXIT))) @@ -1232,7 +1233,7 @@ void P_InitSectorSpecial(sector_t *sector, int special, bool nothinkers) break; case sDamage_Hellslime: - P_SetupSectorDamage(sector, 2, 1, 0, NAME_Slime, SECF_HAZARD); + P_SetupSectorDamage(sector, 2, 32, 0, NAME_Slime, SECF_HAZARD); break; case Damage_InstantDeath: @@ -1241,7 +1242,7 @@ void P_InitSectorSpecial(sector_t *sector, int special, bool nothinkers) break; case sDamage_SuperHellslime: - P_SetupSectorDamage(sector, 4, 1, 0, NAME_Slime, SECF_HAZARD); + P_SetupSectorDamage(sector, 4, 32, 0, NAME_Slime, SECF_HAZARD); break; case Sector_Hidden: diff --git a/src/p_user.cpp b/src/p_user.cpp index e60b82039..ba987d393 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -363,6 +363,7 @@ player_t &player_t::operator=(const player_t &p) bonuscount = p.bonuscount; hazardcount = p.hazardcount; hazardtype = p.hazardtype; + hazardinterval = p.hazardinterval; poisoncount = p.poisoncount; poisontype = p.poisontype; poisonpaintype = p.poisonpaintype; @@ -2599,7 +2600,7 @@ void P_PlayerThink (player_t *player) if (player->hazardcount) { player->hazardcount--; - if (!(level.time & 31) && player->hazardcount > 16*TICRATE) + if (!(level.time % player->hazardinterval) && player->hazardcount > 16*TICRATE) P_DamageMobj (player->mo, NULL, NULL, 5, player->hazardtype); } @@ -3015,7 +3016,8 @@ void player_t::Serialize (FArchive &arc) << oldbuttons; if (SaveVersion >= 4929) { - arc << hazardtype; + arc << hazardtype + << hazardinterval; } bool IsBot = false; if (SaveVersion >= 4514)