- make better use of the damageinterval value for Strife's delayed damage.

This commit is contained in:
Christoph Oelckers 2016-01-06 14:16:42 +01:00
parent 990323fb26
commit 154e106315
3 changed files with 10 additions and 6 deletions

View file

@ -422,6 +422,7 @@ public:
int killcount, itemcount, secretcount; // for intermission int killcount, itemcount, secretcount; // for intermission
int damagecount, bonuscount;// for screen flashing int damagecount, bonuscount;// for screen flashing
int hazardcount; // for delayed Strife damage int hazardcount; // for delayed Strife damage
int hazardinterval; // Frequency of damage infliction
FName hazardtype; // Damage type of last hazardous damage encounter. FName hazardtype; // Damage type of last hazardous damage encounter.
int poisoncount; // screen flash for poison damage int poisoncount; // screen flash for poison damage
FName poisontype; // type of poison damage to apply FName poisontype; // type of poison damage to apply

View file

@ -453,14 +453,15 @@ void P_PlayerInSpecialSector (player_t *player, sector_t * sector)
} }
if (sector->Flags & SECF_ENDGODMODE) player->cheats &= ~CF_GODMODE; 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) if (sector->Flags & SECF_HAZARD)
{ {
player->hazardcount += sector->damageamount; player->hazardcount += sector->damageamount;
player->hazardtype = sector->damagetype; 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); 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)))
@ -1232,7 +1233,7 @@ void P_InitSectorSpecial(sector_t *sector, int special, bool nothinkers)
break; break;
case sDamage_Hellslime: case sDamage_Hellslime:
P_SetupSectorDamage(sector, 2, 1, 0, NAME_Slime, SECF_HAZARD); P_SetupSectorDamage(sector, 2, 32, 0, NAME_Slime, SECF_HAZARD);
break; break;
case Damage_InstantDeath: case Damage_InstantDeath:
@ -1241,7 +1242,7 @@ void P_InitSectorSpecial(sector_t *sector, int special, bool nothinkers)
break; break;
case sDamage_SuperHellslime: case sDamage_SuperHellslime:
P_SetupSectorDamage(sector, 4, 1, 0, NAME_Slime, SECF_HAZARD); P_SetupSectorDamage(sector, 4, 32, 0, NAME_Slime, SECF_HAZARD);
break; break;
case Sector_Hidden: case Sector_Hidden:

View file

@ -363,6 +363,7 @@ player_t &player_t::operator=(const player_t &p)
bonuscount = p.bonuscount; bonuscount = p.bonuscount;
hazardcount = p.hazardcount; hazardcount = p.hazardcount;
hazardtype = p.hazardtype; hazardtype = p.hazardtype;
hazardinterval = p.hazardinterval;
poisoncount = p.poisoncount; poisoncount = p.poisoncount;
poisontype = p.poisontype; poisontype = p.poisontype;
poisonpaintype = p.poisonpaintype; poisonpaintype = p.poisonpaintype;
@ -2599,7 +2600,7 @@ void P_PlayerThink (player_t *player)
if (player->hazardcount) if (player->hazardcount)
{ {
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); P_DamageMobj (player->mo, NULL, NULL, 5, player->hazardtype);
} }
@ -3015,7 +3016,8 @@ void player_t::Serialize (FArchive &arc)
<< oldbuttons; << oldbuttons;
if (SaveVersion >= 4929) if (SaveVersion >= 4929)
{ {
arc << hazardtype; arc << hazardtype
<< hazardinterval;
} }
bool IsBot = false; bool IsBot = false;
if (SaveVersion >= 4514) if (SaveVersion >= 4514)