mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-25 05:21:02 +00:00
* Added LAXTELEFRAGDMG. This flag forces all damage to be factored, regardless being above or below the telefrag threshold.
- This only affects damage calculations being received by the end result. If the original damage was not a million or more, from the start, it will not hurt invulnerable-flagged or kill buddha-flagged monsters. - Fixed: Damage was inconsistent by the time the function checked for player cheats/invulnerability and (monster and player) buddha, yet monster invulnerability checked the original damage prior to factor processing. This means a damage source that intended to damage another below the threshold could accidentally increase with a powerdamage multiplier or the recipient with a weakness for it, resulting in invulnerability/buddha foiling. Now, checks for telefrag damage using the raw original value on player godmode, player/monster invulnerability and buddha.
This commit is contained in:
parent
c1e3c16232
commit
22570e079e
3 changed files with 16 additions and 8 deletions
|
@ -372,6 +372,7 @@ enum ActorFlag7
|
||||||
MF7_FLYCHEAT = 0x00020000, // must be part of the actor so that it can be tracked properly
|
MF7_FLYCHEAT = 0x00020000, // must be part of the actor so that it can be tracked properly
|
||||||
MF7_NODECAL = 0x00040000, // [ZK] Forces puff to have no impact decal
|
MF7_NODECAL = 0x00040000, // [ZK] Forces puff to have no impact decal
|
||||||
MF7_FORCEDECAL = 0x00080000, // [ZK] Forces puff's decal to override the weapon's.
|
MF7_FORCEDECAL = 0x00080000, // [ZK] Forces puff's decal to override the weapon's.
|
||||||
|
MF7_LAXTELEFRAGDMG = 0x00100000, // [MC] Telefrag damage can be reduced.
|
||||||
};
|
};
|
||||||
|
|
||||||
// --- mobj.renderflags ---
|
// --- mobj.renderflags ---
|
||||||
|
|
|
@ -946,6 +946,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
|
||||||
bool forcedPain = false;
|
bool forcedPain = false;
|
||||||
int fakeDamage = 0;
|
int fakeDamage = 0;
|
||||||
int holdDamage = 0;
|
int holdDamage = 0;
|
||||||
|
int rawdamage = damage;
|
||||||
|
|
||||||
if (damage < 0) damage = 0;
|
if (damage < 0) damage = 0;
|
||||||
|
|
||||||
|
@ -980,7 +981,11 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ((target->flags2 & MF2_INVULNERABLE) && (damage < TELEFRAG_DAMAGE) && (!(flags & DMG_FORCED)))
|
// [MC] Changed it to check rawdamage here for consistency, even though that doesn't actually do anything
|
||||||
|
// different here. At any rate, invulnerable is being checked before type factoring, which is then being
|
||||||
|
// checked by player cheats/invul/buddha followed by monster buddha. This is inconsistent. Don't let the
|
||||||
|
// original telefrag damage CHECK (rawdamage) be influenced by outside factors when looking at cheats/invul.
|
||||||
|
if ((target->flags2 & MF2_INVULNERABLE) && (rawdamage < TELEFRAG_DAMAGE) && (!(flags & DMG_FORCED)))
|
||||||
{ // actor is invulnerable
|
{ // actor is invulnerable
|
||||||
if (target->player == NULL)
|
if (target->player == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1040,7 +1045,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (damage < TELEFRAG_DAMAGE) // TELEFRAG_DAMAGE may not be reduced at all or it may not guarantee its effect.
|
if ((rawdamage < TELEFRAG_DAMAGE) || (target->flags7 & MF7_NOTELEFRAGPIERCE)) // TELEFRAG_DAMAGE may only be reduced with NOTELEFRAGPIERCE or it may not guarantee its effect.
|
||||||
{
|
{
|
||||||
if (player && damage > 1)
|
if (player && damage > 1)
|
||||||
{
|
{
|
||||||
|
@ -1218,7 +1223,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
|
||||||
{
|
{
|
||||||
if (player)
|
if (player)
|
||||||
FriendlyFire = true;
|
FriendlyFire = true;
|
||||||
if (damage < TELEFRAG_DAMAGE)
|
if (rawdamage < TELEFRAG_DAMAGE) //Use the original damage to check for telefrag amount. Don't let the now-amplified damagetypes do it.
|
||||||
{ // Still allow telefragging :-(
|
{ // Still allow telefragging :-(
|
||||||
damage = (int)((float)damage * level.teamdamage);
|
damage = (int)((float)damage * level.teamdamage);
|
||||||
if (damage < 0)
|
if (damage < 0)
|
||||||
|
@ -1261,7 +1266,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
|
||||||
if (!(flags & DMG_FORCED))
|
if (!(flags & DMG_FORCED))
|
||||||
{
|
{
|
||||||
// check the real player, not a voodoo doll here for invulnerability effects
|
// check the real player, not a voodoo doll here for invulnerability effects
|
||||||
if ((damage < TELEFRAG_DAMAGE && ((player->mo->flags2 & MF2_INVULNERABLE) ||
|
if ((rawdamage < TELEFRAG_DAMAGE && ((player->mo->flags2 & MF2_INVULNERABLE) ||
|
||||||
(player->cheats & CF_GODMODE))) ||
|
(player->cheats & CF_GODMODE))) ||
|
||||||
(player->cheats & CF_GODMODE2) || (player->mo->flags5 & MF5_NODAMAGE))
|
(player->cheats & CF_GODMODE2) || (player->mo->flags5 & MF5_NODAMAGE))
|
||||||
//Absolutely no hurting if NODAMAGE is involved. Same for GODMODE2.
|
//Absolutely no hurting if NODAMAGE is involved. Same for GODMODE2.
|
||||||
|
@ -1286,7 +1291,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
|
||||||
{
|
{
|
||||||
player->mo->Inventory->AbsorbDamage(damage, mod, newdam);
|
player->mo->Inventory->AbsorbDamage(damage, mod, newdam);
|
||||||
}
|
}
|
||||||
if (damage < TELEFRAG_DAMAGE)
|
if ((rawdamage < TELEFRAG_DAMAGE) || (player->mo->flags7 & MF7_NOTELEFRAGPIERCE)) //rawdamage is never modified.
|
||||||
{
|
{
|
||||||
// if we are telefragging don't let the damage value go below that magic value. Some further checks would fail otherwise.
|
// if we are telefragging don't let the damage value go below that magic value. Some further checks would fail otherwise.
|
||||||
damage = newdam;
|
damage = newdam;
|
||||||
|
@ -1305,7 +1310,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (damage >= player->health && damage < TELEFRAG_DAMAGE
|
if (damage >= player->health && rawdamage < TELEFRAG_DAMAGE
|
||||||
&& (G_SkillProperty(SKILLP_AutoUseHealth) || deathmatch)
|
&& (G_SkillProperty(SKILLP_AutoUseHealth) || deathmatch)
|
||||||
&& !player->morphTics)
|
&& !player->morphTics)
|
||||||
{ // Try to use some inventory health
|
{ // Try to use some inventory health
|
||||||
|
@ -1329,7 +1334,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
|
||||||
// but telefragging should still do enough damage to kill the player)
|
// but telefragging should still do enough damage to kill the player)
|
||||||
// Ignore players that are already dead.
|
// Ignore players that are already dead.
|
||||||
// [MC]Buddha2 absorbs telefrag damage, and anything else thrown their way.
|
// [MC]Buddha2 absorbs telefrag damage, and anything else thrown their way.
|
||||||
if (!(flags & DMG_FORCED) && (((player->cheats & CF_BUDDHA2) || (((player->cheats & CF_BUDDHA) || (player->mo->flags7 & MF7_BUDDHA)) && (damage < TELEFRAG_DAMAGE))) && (player->playerstate != PST_DEAD)))
|
if (!(flags & DMG_FORCED) && (((player->cheats & CF_BUDDHA2) || (((player->cheats & CF_BUDDHA) || (player->mo->flags7 & MF7_BUDDHA)) && (rawdamage < TELEFRAG_DAMAGE))) && (player->playerstate != PST_DEAD)))
|
||||||
{
|
{
|
||||||
// If this is a voodoo doll we need to handle the real player as well.
|
// If this is a voodoo doll we need to handle the real player as well.
|
||||||
player->mo->health = target->health = player->health = 1;
|
player->mo->health = target->health = player->health = 1;
|
||||||
|
@ -1394,7 +1399,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
|
||||||
if (target->health <= 0)
|
if (target->health <= 0)
|
||||||
{
|
{
|
||||||
//[MC]Buddha flag for monsters.
|
//[MC]Buddha flag for monsters.
|
||||||
if (!(flags & DMG_FORCED) && ((target->flags7 & MF7_BUDDHA) && (damage < TELEFRAG_DAMAGE) && ((inflictor == NULL || !(inflictor->flags7 & MF7_FOILBUDDHA)) && !(flags & DMG_FOILBUDDHA))))
|
if (!(flags & DMG_FORCED) && ((target->flags7 & MF7_BUDDHA) && (rawdamage < TELEFRAG_DAMAGE) && ((inflictor == NULL || !(inflictor->flags7 & MF7_FOILBUDDHA)) && !(flags & DMG_FOILBUDDHA))))
|
||||||
{ //FOILBUDDHA or Telefrag damage must kill it.
|
{ //FOILBUDDHA or Telefrag damage must kill it.
|
||||||
target->health = 1;
|
target->health = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,6 +258,8 @@ static FFlagDef ActorFlagDefs[]=
|
||||||
DEFINE_FLAG(MF7, NODECAL, AActor, flags7),
|
DEFINE_FLAG(MF7, NODECAL, AActor, flags7),
|
||||||
DEFINE_FLAG(MF7, FORCEDECAL, AActor, flags7),
|
DEFINE_FLAG(MF7, FORCEDECAL, AActor, flags7),
|
||||||
|
|
||||||
|
DEFINE_FLAG(MF7, LAXTELEFRAGDMG, AActor, flags7),
|
||||||
|
|
||||||
// Effect flags
|
// Effect flags
|
||||||
DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),
|
DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),
|
||||||
DEFINE_FLAG2(FX_ROCKET, ROCKETTRAIL, AActor, effects),
|
DEFINE_FLAG2(FX_ROCKET, ROCKETTRAIL, AActor, effects),
|
||||||
|
|
Loading…
Reference in a new issue