diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 9f4646ee3..d3261dc65 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,7 @@ August 6, 2009 +- Added TELEFRAG_DAMAGE constant, and changed the two places that still used + 1000 as the threshold for god mode damage to use it instead. (Players with + MF2_INVULNERABLE set already used 1000000 as their threshold.) - Added MF6_NOTELEPORT flag. - Fixed: M_QuitResponse() tried to play a sound even when none was specified in the gameinfo. diff --git a/src/doomdef.h b/src/doomdef.h index 44cfb7a2a..108435605 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -58,6 +58,9 @@ typedef enum // State updates, number of tics / second. #define TICRATE 35 +// Amount of damage done by a telefrag. +#define TELEFRAG_DAMAGE 1000000 + // The current state of the game: whether we are // playing, gazing at the intermission screen, // the game final animation, or a demo. diff --git a/src/g_doom/a_painelemental.cpp b/src/g_doom/a_painelemental.cpp index c6bac8ae9..bf0d0501b 100644 --- a/src/g_doom/a_painelemental.cpp +++ b/src/g_doom/a_painelemental.cpp @@ -113,7 +113,7 @@ void A_PainShootSkull (AActor *self, angle_t angle, const PClass *spawntype) (other->z < other->Sector->floorplane.ZatPoint (other->x, other->y))) { // kill it immediately - P_DamageMobj (other, self, self, 1000000, NAME_None); // ^ + P_DamageMobj (other, self, self, TELEFRAG_DAMAGE, NAME_None);// ^ return; // | } // phares @@ -122,7 +122,7 @@ void A_PainShootSkull (AActor *self, angle_t angle, const PClass *spawntype) if (!P_CheckPosition (other, other->x, other->y)) { // kill it immediately - P_DamageMobj (other, self, self, 1000000, NAME_None); + P_DamageMobj (other, self, self, TELEFRAG_DAMAGE, NAME_None); return; } diff --git a/src/g_heretic/a_hereticartifacts.cpp b/src/g_heretic/a_hereticartifacts.cpp index 32e3ab9e5..d9c08ec1a 100644 --- a/src/g_heretic/a_hereticartifacts.cpp +++ b/src/g_heretic/a_hereticartifacts.cpp @@ -28,7 +28,7 @@ bool AArtiTomeOfPower::Use (bool pickup) { // Failed if (!(Owner->player->MorphStyle & MORPH_FAILNOTELEFRAG)) { - P_DamageMobj (Owner, NULL, NULL, 1000000, NAME_Telefrag); + P_DamageMobj (Owner, NULL, NULL, TELEFRAG_DAMAGE, NAME_Telefrag); } } else diff --git a/src/g_heretic/a_hereticweaps.cpp b/src/g_heretic/a_hereticweaps.cpp index 8c2d18f60..2ae66599f 100644 --- a/src/g_heretic/a_hereticweaps.cpp +++ b/src/g_heretic/a_hereticweaps.cpp @@ -357,7 +357,7 @@ int AMaceFX4::DoSpecialDamage (AActor *target, int damage) return -1; } } - return 1000000; // Something's gonna die + return TELEFRAG_DAMAGE; // Something's gonna die } //---------------------------------------------------------------------------- diff --git a/src/g_raven/a_minotaur.cpp b/src/g_raven/a_minotaur.cpp index e6b2a159d..747ee6be1 100644 --- a/src/g_raven/a_minotaur.cpp +++ b/src/g_raven/a_minotaur.cpp @@ -471,7 +471,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurRoam) if (self1->StartTime >= 0 && (level.maptime - self1->StartTime) >= MAULATORTICS) { - P_DamageMobj (self1, NULL, NULL, 1000000, NAME_None); + P_DamageMobj (self1, NULL, NULL, TELEFRAG_DAMAGE, NAME_None); return; } @@ -587,7 +587,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurChase) if (self1->StartTime >= 0 && (level.maptime - self1->StartTime) >= MAULATORTICS) { - P_DamageMobj (self1, NULL, NULL, 1000000, NAME_None); + P_DamageMobj (self1, NULL, NULL, TELEFRAG_DAMAGE, NAME_None); return; } diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index 644941eb5..a76fd1437 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -441,7 +441,7 @@ void cht_DoCheat (player_t *player, int cheat) // Don't allow this in deathmatch even with cheats enabled, because it's // a very very cheap kill. P_LineAttack (player->mo, player->mo->angle, PLAYERMISSILERANGE, - P_AimLineAttack (player->mo, player->mo->angle, PLAYERMISSILERANGE), 1000000, + P_AimLineAttack (player->mo, player->mo->angle, PLAYERMISSILERANGE), TELEFRAG_DAMAGE, NAME_MDK, NAME_BulletPuff); } break; @@ -1042,7 +1042,7 @@ void cht_Suicide (player_t *plyr) { plyr->mo->flags |= MF_SHOOTABLE; plyr->mo->flags2 &= ~MF2_INVULNERABLE; - P_DamageMobj (plyr->mo, plyr->mo, plyr->mo, 1000000, NAME_Suicide); + P_DamageMobj (plyr->mo, plyr->mo, plyr->mo, TELEFRAG_DAMAGE, NAME_Suicide); if (plyr->mo->health <= 0) plyr->mo->flags &= ~MF_SHOOTABLE; } } diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index e15f4bbd9..6f54445ec 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -889,7 +889,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage } // Spectral targets only take damage from spectral projectiles. - if (target->flags4 & MF4_SPECTRAL && damage < 1000000) + if (target->flags4 & MF4_SPECTRAL && damage < TELEFRAG_DAMAGE) { if (inflictor == NULL || !(inflictor->flags4 & MF4_SPECTRAL)) { @@ -915,7 +915,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage } return; } - if ((target->flags2 & MF2_INVULNERABLE) && damage < 1000000 && !(flags & DMG_FORCED)) + if ((target->flags2 & MF2_INVULNERABLE) && damage < TELEFRAG_DAMAGE && !(flags & DMG_FORCED)) { // actor is invulnerable if (target->player == NULL) { @@ -1103,22 +1103,17 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage if (!(flags & DMG_FORCED)) { - if ((target->flags2 & MF2_INVULNERABLE) && damage < 1000000) + if (damage < TELEFRAG_DAMAGE && ((target->flags2 & MF2_INVULNERABLE) || + (target->player->cheats & CF_GODMODE))) { // player is invulnerable, so don't hurt him return; } - if (damage < 1000 && ((target->player->cheats & CF_GODMODE) - || (target->player->mo->flags2 & MF2_INVULNERABLE))) - { - return; - } - // [RH] Avoid friendly fire if enabled if (source != NULL && player != source->player && target->IsTeammate (source)) { FriendlyFire = true; - if (damage < 1000000) + if (damage < TELEFRAG_DAMAGE) { // Still allow telefragging :-( damage = (int)((float)damage * level.teamdamage); if (damage <= 0) @@ -1437,7 +1432,8 @@ void P_PoisonDamage (player_t *player, AActor *source, int damage, { return; } - if (target->flags2&MF2_INVULNERABLE && damage < 1000000) + if (damage < TELEFRAG_DAMAGE && ((target->flags2 & MF2_INVULNERABLE) || + (player->cheats & CF_GODMODE))) { // target is invulnerable return; } @@ -1446,11 +1442,6 @@ void P_PoisonDamage (player_t *player, AActor *source, int damage, // Take half damage in trainer mode damage = FixedMul(damage, G_SkillProperty(SKILLP_DamageFactor)); } - if(damage < 1000 && ((player->cheats&CF_GODMODE) - || (player->mo->flags2 & MF2_INVULNERABLE))) - { - return; - } if (damage >= player->health && (G_SkillProperty(SKILLP_AutoUseHealth) || deathmatch) && !player->morphTics) diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 79cc49e29..1ce33214e 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -1003,7 +1003,7 @@ FUNC(LS_DamageThing) } else { // If zero damage, guarantee a kill - P_DamageMobj (it, NULL, NULL, 1000000, MODtoDamageType (arg1)); + P_DamageMobj (it, NULL, NULL, TELEFRAG_DAMAGE, MODtoDamageType (arg1)); } } @@ -1147,7 +1147,7 @@ FUNC(LS_Thing_Destroy) { AActor *temp = iterator.Next (); if (actor->flags & MF_SHOOTABLE) - P_DamageMobj (actor, NULL, it, arg1 ? 1000000 : actor->health, NAME_None); + P_DamageMobj (actor, NULL, it, arg1 ? TELEFRAG_DAMAGE : actor->health, NAME_None); actor = temp; } } diff --git a/src/p_map.cpp b/src/p_map.cpp index 58076a293..abd4d3f66 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -355,7 +355,7 @@ bool P_TeleportMove (AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefr // [RH] Some Heretic/Hexen monsters can telestomp if (StompAlwaysFrags && !(th->flags6 & MF6_NOTELEFRAG)) { - P_DamageMobj (th, thing, thing, 1000000, NAME_Telefrag, DMG_THRUSTLESS); + P_DamageMobj (th, thing, thing, TELEFRAG_DAMAGE, NAME_Telefrag, DMG_THRUSTLESS); continue; } return false; @@ -421,7 +421,7 @@ void P_PlayerStartStomp (AActor *actor) if (actor->z + actor->height < th->z) continue; // underneath - P_DamageMobj (th, actor, actor, 1000000, NAME_Telefrag); + P_DamageMobj (th, actor, actor, TELEFRAG_DAMAGE, NAME_Telefrag); } } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index fc65306f0..a990dd8c7 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1098,7 +1098,7 @@ bool AActor::Massacre () do { prevhealth = health; - P_DamageMobj (this, NULL, NULL, 1000000, NAME_Massacre); + P_DamageMobj (this, NULL, NULL, TELEFRAG_DAMAGE, NAME_Massacre); } while (health != prevhealth && health > 0); //abort if the actor wasn't hurt. return true; @@ -2000,13 +2000,13 @@ void P_MonsterFallingDamage (AActor *mo) vel = abs(mo->velz); if (vel > 35*FRACUNIT) { // automatic death - damage = 1000000; + damage = TELEFRAG_DAMAGE; } else { damage = ((vel - (23*FRACUNIT))*6)>>FRACBITS; } - damage = 1000000; // always kill 'em + damage = TELEFRAG_DAMAGE; // always kill 'em P_DamageMobj (mo, NULL, NULL, damage, NAME_Falling); } diff --git a/src/p_spec.cpp b/src/p_spec.cpp index f740815a5..e977a2999 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -142,7 +142,7 @@ bool CheckIfExitIsGood (AActor *self, level_info_t *info) // Is this a deathmatch game and we're not allowed to exit? if ((deathmatch || alwaysapplydmflags) && (dmflags & DF_NO_EXIT)) { - P_DamageMobj (self, self, self, 1000000, NAME_Exit); + P_DamageMobj (self, self, self, TELEFRAG_DAMAGE, NAME_Exit); return false; } // Is this a singleplayer game and the next map is part of the same hub and we're dead?