- 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.)


SVN r1755 (trunk)
This commit is contained in:
Randy Heit 2009-08-07 03:57:03 +00:00
parent a1554799d9
commit 16846fe36d
12 changed files with 29 additions and 32 deletions

View file

@ -1,4 +1,7 @@
August 6, 2009 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. - Added MF6_NOTELEPORT flag.
- Fixed: M_QuitResponse() tried to play a sound even when none was specified - Fixed: M_QuitResponse() tried to play a sound even when none was specified
in the gameinfo. in the gameinfo.

View file

@ -58,6 +58,9 @@ typedef enum
// State updates, number of tics / second. // State updates, number of tics / second.
#define TICRATE 35 #define TICRATE 35
// Amount of damage done by a telefrag.
#define TELEFRAG_DAMAGE 1000000
// The current state of the game: whether we are // The current state of the game: whether we are
// playing, gazing at the intermission screen, // playing, gazing at the intermission screen,
// the game final animation, or a demo. // the game final animation, or a demo.

View file

@ -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))) (other->z < other->Sector->floorplane.ZatPoint (other->x, other->y)))
{ {
// kill it immediately // kill it immediately
P_DamageMobj (other, self, self, 1000000, NAME_None); // ^ P_DamageMobj (other, self, self, TELEFRAG_DAMAGE, NAME_None);// ^
return; // | return; // |
} // phares } // phares
@ -122,7 +122,7 @@ void A_PainShootSkull (AActor *self, angle_t angle, const PClass *spawntype)
if (!P_CheckPosition (other, other->x, other->y)) if (!P_CheckPosition (other, other->x, other->y))
{ {
// kill it immediately // kill it immediately
P_DamageMobj (other, self, self, 1000000, NAME_None); P_DamageMobj (other, self, self, TELEFRAG_DAMAGE, NAME_None);
return; return;
} }

View file

@ -28,7 +28,7 @@ bool AArtiTomeOfPower::Use (bool pickup)
{ // Failed { // Failed
if (!(Owner->player->MorphStyle & MORPH_FAILNOTELEFRAG)) if (!(Owner->player->MorphStyle & MORPH_FAILNOTELEFRAG))
{ {
P_DamageMobj (Owner, NULL, NULL, 1000000, NAME_Telefrag); P_DamageMobj (Owner, NULL, NULL, TELEFRAG_DAMAGE, NAME_Telefrag);
} }
} }
else else

View file

@ -357,7 +357,7 @@ int AMaceFX4::DoSpecialDamage (AActor *target, int damage)
return -1; return -1;
} }
} }
return 1000000; // Something's gonna die return TELEFRAG_DAMAGE; // Something's gonna die
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View file

@ -471,7 +471,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurRoam)
if (self1->StartTime >= 0 && (level.maptime - self1->StartTime) >= MAULATORTICS) 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; return;
} }
@ -587,7 +587,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurChase)
if (self1->StartTime >= 0 && (level.maptime - self1->StartTime) >= MAULATORTICS) 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; return;
} }

View file

@ -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 // Don't allow this in deathmatch even with cheats enabled, because it's
// a very very cheap kill. // a very very cheap kill.
P_LineAttack (player->mo, player->mo->angle, PLAYERMISSILERANGE, 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); NAME_MDK, NAME_BulletPuff);
} }
break; break;
@ -1042,7 +1042,7 @@ void cht_Suicide (player_t *plyr)
{ {
plyr->mo->flags |= MF_SHOOTABLE; plyr->mo->flags |= MF_SHOOTABLE;
plyr->mo->flags2 &= ~MF2_INVULNERABLE; 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; if (plyr->mo->health <= 0) plyr->mo->flags &= ~MF_SHOOTABLE;
} }
} }

View file

@ -889,7 +889,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
} }
// Spectral targets only take damage from spectral projectiles. // 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)) if (inflictor == NULL || !(inflictor->flags4 & MF4_SPECTRAL))
{ {
@ -915,7 +915,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
} }
return; 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 { // actor is invulnerable
if (target->player == NULL) if (target->player == NULL)
{ {
@ -1103,22 +1103,17 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
if (!(flags & DMG_FORCED)) 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 { // player is invulnerable, so don't hurt him
return; return;
} }
if (damage < 1000 && ((target->player->cheats & CF_GODMODE)
|| (target->player->mo->flags2 & MF2_INVULNERABLE)))
{
return;
}
// [RH] Avoid friendly fire if enabled // [RH] Avoid friendly fire if enabled
if (source != NULL && player != source->player && target->IsTeammate (source)) if (source != NULL && player != source->player && target->IsTeammate (source))
{ {
FriendlyFire = true; FriendlyFire = true;
if (damage < 1000000) if (damage < TELEFRAG_DAMAGE)
{ // Still allow telefragging :-( { // Still allow telefragging :-(
damage = (int)((float)damage * level.teamdamage); damage = (int)((float)damage * level.teamdamage);
if (damage <= 0) if (damage <= 0)
@ -1437,7 +1432,8 @@ void P_PoisonDamage (player_t *player, AActor *source, int damage,
{ {
return; return;
} }
if (target->flags2&MF2_INVULNERABLE && damage < 1000000) if (damage < TELEFRAG_DAMAGE && ((target->flags2 & MF2_INVULNERABLE) ||
(player->cheats & CF_GODMODE)))
{ // target is invulnerable { // target is invulnerable
return; return;
} }
@ -1446,11 +1442,6 @@ void P_PoisonDamage (player_t *player, AActor *source, int damage,
// Take half damage in trainer mode // Take half damage in trainer mode
damage = FixedMul(damage, G_SkillProperty(SKILLP_DamageFactor)); damage = FixedMul(damage, G_SkillProperty(SKILLP_DamageFactor));
} }
if(damage < 1000 && ((player->cheats&CF_GODMODE)
|| (player->mo->flags2 & MF2_INVULNERABLE)))
{
return;
}
if (damage >= player->health if (damage >= player->health
&& (G_SkillProperty(SKILLP_AutoUseHealth) || deathmatch) && (G_SkillProperty(SKILLP_AutoUseHealth) || deathmatch)
&& !player->morphTics) && !player->morphTics)

View file

@ -1003,7 +1003,7 @@ FUNC(LS_DamageThing)
} }
else else
{ // If zero damage, guarantee a kill { // 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 (); AActor *temp = iterator.Next ();
if (actor->flags & MF_SHOOTABLE) 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; actor = temp;
} }
} }

View file

@ -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 // [RH] Some Heretic/Hexen monsters can telestomp
if (StompAlwaysFrags && !(th->flags6 & MF6_NOTELEFRAG)) 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; continue;
} }
return false; return false;
@ -421,7 +421,7 @@ void P_PlayerStartStomp (AActor *actor)
if (actor->z + actor->height < th->z) if (actor->z + actor->height < th->z)
continue; // underneath continue; // underneath
P_DamageMobj (th, actor, actor, 1000000, NAME_Telefrag); P_DamageMobj (th, actor, actor, TELEFRAG_DAMAGE, NAME_Telefrag);
} }
} }

View file

@ -1098,7 +1098,7 @@ bool AActor::Massacre ()
do do
{ {
prevhealth = health; 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. while (health != prevhealth && health > 0); //abort if the actor wasn't hurt.
return true; return true;
@ -2000,13 +2000,13 @@ void P_MonsterFallingDamage (AActor *mo)
vel = abs(mo->velz); vel = abs(mo->velz);
if (vel > 35*FRACUNIT) if (vel > 35*FRACUNIT)
{ // automatic death { // automatic death
damage = 1000000; damage = TELEFRAG_DAMAGE;
} }
else else
{ {
damage = ((vel - (23*FRACUNIT))*6)>>FRACBITS; 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); P_DamageMobj (mo, NULL, NULL, damage, NAME_Falling);
} }

View file

@ -142,7 +142,7 @@ bool CheckIfExitIsGood (AActor *self, level_info_t *info)
// Is this a deathmatch game and we're not allowed to exit? // Is this a deathmatch game and we're not allowed to exit?
if ((deathmatch || alwaysapplydmflags) && (dmflags & DF_NO_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; return false;
} }
// Is this a singleplayer game and the next map is part of the same hub and we're dead? // Is this a singleplayer game and the next map is part of the same hub and we're dead?