- P_DamageMobj() now returns the amount of damage actually done so that the bleed functions
can perform based on the amount of damage actually taken after all modifications are done to it. However, if the damage is canceled away, blood will still spawn for the original damage amount rather than the modified amount. SVN r4012 (trunk)
This commit is contained in:
parent
60fb004a78
commit
549712e719
26 changed files with 148 additions and 136 deletions
102
src/p_map.cpp
102
src/p_map.cpp
|
|
@ -966,12 +966,13 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
|
|||
thing->vely += tm.thing->vely;
|
||||
if ((thing->velx + thing->vely) > 3*FRACUNIT)
|
||||
{
|
||||
int newdam;
|
||||
damage = (tm.thing->Mass / 100) + 1;
|
||||
P_DamageMobj (thing, tm.thing, tm.thing, damage, tm.thing->DamageType);
|
||||
P_TraceBleed (damage, thing, tm.thing);
|
||||
newdam = P_DamageMobj (thing, tm.thing, tm.thing, damage, tm.thing->DamageType);
|
||||
P_TraceBleed (newdam > 0 ? newdam : damage, thing, tm.thing);
|
||||
damage = (thing->Mass / 100) + 1;
|
||||
P_DamageMobj (tm.thing, thing, thing, damage >> 2, tm.thing->DamageType);
|
||||
P_TraceBleed (damage, tm.thing, thing);
|
||||
newdam = P_DamageMobj (tm.thing, thing, thing, damage >> 2, tm.thing->DamageType);
|
||||
P_TraceBleed (newdam > 0 ? newdam : damage, tm.thing, thing);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1149,10 +1150,10 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
|
|||
}
|
||||
|
||||
damage = tm.thing->GetMissileDamage (3, 2);
|
||||
P_DamageMobj (thing, tm.thing, tm.thing->target, damage, tm.thing->DamageType);
|
||||
int newdam = P_DamageMobj (thing, tm.thing, tm.thing->target, damage, tm.thing->DamageType);
|
||||
if (!(tm.thing->flags3 & MF3_BLOODLESSIMPACT))
|
||||
{
|
||||
P_TraceBleed (damage, thing, tm.thing);
|
||||
P_TraceBleed (newdam > 0 ? newdam : damage, thing, tm.thing);
|
||||
}
|
||||
if (thing->flags2 & MF2_PUSHABLE
|
||||
&& !(tm.thing->flags2 & MF2_CANNOTPUSH))
|
||||
|
|
@ -1180,7 +1181,7 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
|
|||
damage = tm.thing->GetMissileDamage ((tm.thing->flags4 & MF4_STRIFEDAMAGE) ? 3 : 7, 1);
|
||||
if ((damage > 0) || (tm.thing->flags6 & MF6_FORCEPAIN))
|
||||
{
|
||||
P_DamageMobj (thing, tm.thing, tm.thing->target, damage, tm.thing->DamageType);
|
||||
int newdam = P_DamageMobj (thing, tm.thing, tm.thing->target, damage, tm.thing->DamageType);
|
||||
if (damage > 0)
|
||||
{
|
||||
if ((tm.thing->flags5 & MF5_BLOODSPLATTER) &&
|
||||
|
|
@ -1194,7 +1195,7 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
|
|||
}
|
||||
if (!(tm.thing->flags3 & MF3_BLOODLESSIMPACT))
|
||||
{
|
||||
P_TraceBleed (damage, thing, tm.thing);
|
||||
P_TraceBleed (newdam > 0 ? newdam : damage, thing, tm.thing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3612,13 +3613,42 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
|
|||
// We must pass the unreplaced puff type here
|
||||
puff = P_SpawnPuff (t1, pufftype, hitx, hity, hitz, angle - ANG180, 2, flags|PF_HITTHING);
|
||||
}
|
||||
|
||||
// Allow puffs to inflict poison damage, so that hitscans can poison, too.
|
||||
if (puffDefaults->PoisonDamage > 0 && puffDefaults->PoisonDuration != INT_MIN)
|
||||
{
|
||||
P_PoisonMobj(trace.Actor, puff ? puff : t1, t1, puffDefaults->PoisonDamage, puffDefaults->PoisonDuration, puffDefaults->PoisonPeriod, puffDefaults->PoisonDamageType);
|
||||
}
|
||||
|
||||
// [GZ] If MF6_FORCEPAIN is set, we need to call P_DamageMobj even if damage is 0!
|
||||
// Note: The puff may not yet be spawned here so we must check the class defaults, not the actor.
|
||||
int newdam = damage;
|
||||
if (damage || (puffDefaults->flags6 & MF6_FORCEPAIN))
|
||||
{
|
||||
int dmgflags = DMG_INFLICTOR_IS_PUFF | pflag;
|
||||
// Allow MF5_PIERCEARMOR on a weapon as well.
|
||||
if (t1->player != NULL && (dmgflags & DMG_PLAYERATTACK) && t1->player->ReadyWeapon != NULL &&
|
||||
t1->player->ReadyWeapon->flags5 & MF5_PIERCEARMOR)
|
||||
{
|
||||
dmgflags |= DMG_NO_ARMOR;
|
||||
}
|
||||
|
||||
if (puff == NULL)
|
||||
{
|
||||
// Since the puff is the damage inflictor we need it here
|
||||
// regardless of whether it is displayed or not.
|
||||
puff = P_SpawnPuff (t1, pufftype, hitx, hity, hitz, angle - ANG180, 2, flags|PF_HITTHING|PF_TEMPORARY);
|
||||
killPuff = true;
|
||||
}
|
||||
newdam = P_DamageMobj (trace.Actor, puff ? puff : t1, t1, damage, damageType, dmgflags);
|
||||
}
|
||||
if (!(puffDefaults->flags3&MF3_BLOODLESSIMPACT))
|
||||
{
|
||||
if (!bloodsplatter && !axeBlood &&
|
||||
!(trace.Actor->flags & MF_NOBLOOD) &&
|
||||
!(trace.Actor->flags2 & (MF2_INVULNERABLE|MF2_DORMANT)))
|
||||
{
|
||||
P_SpawnBlood (hitx, hity, hitz, angle - ANG180, damage, trace.Actor);
|
||||
P_SpawnBlood (hitx, hity, hitz, angle - ANG180, newdam > 0 ? newdam : damage, trace.Actor);
|
||||
}
|
||||
|
||||
if (damage)
|
||||
|
|
@ -3639,38 +3669,10 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
|
|||
}
|
||||
}
|
||||
// [RH] Stick blood to walls
|
||||
P_TraceBleed (damage, trace.X, trace.Y, trace.Z,
|
||||
P_TraceBleed (newdam > 0 ? newdam : damage, trace.X, trace.Y, trace.Z,
|
||||
trace.Actor, srcangle, srcpitch);
|
||||
}
|
||||
}
|
||||
|
||||
// Allow puffs to inflict poison damage, so that hitscans can poison, too.
|
||||
if (puffDefaults->PoisonDamage > 0 && puffDefaults->PoisonDuration != INT_MIN)
|
||||
{
|
||||
P_PoisonMobj(trace.Actor, puff ? puff : t1, t1, puffDefaults->PoisonDamage, puffDefaults->PoisonDuration, puffDefaults->PoisonPeriod, puffDefaults->PoisonDamageType);
|
||||
}
|
||||
|
||||
// [GZ] If MF6_FORCEPAIN is set, we need to call P_DamageMobj even if damage is 0!
|
||||
// Note: The puff may not yet be spawned here so we must check the class defaults, not the actor.
|
||||
if (damage || (puffDefaults->flags6 & MF6_FORCEPAIN))
|
||||
{
|
||||
int dmgflags = DMG_INFLICTOR_IS_PUFF | pflag;
|
||||
// Allow MF5_PIERCEARMOR on a weapon as well.
|
||||
if (t1->player != NULL && (dmgflags & DMG_PLAYERATTACK) && t1->player->ReadyWeapon != NULL &&
|
||||
t1->player->ReadyWeapon->flags5 & MF5_PIERCEARMOR)
|
||||
{
|
||||
dmgflags |= DMG_NO_ARMOR;
|
||||
}
|
||||
|
||||
if (puff == NULL)
|
||||
{
|
||||
// Since the puff is the damage inflictor we need it here
|
||||
// regardless of whether it is displayed or not.
|
||||
puff = P_SpawnPuff (t1, pufftype, hitx, hity, hitz, angle - ANG180, 2, flags|PF_HITTHING|PF_TEMPORARY);
|
||||
killPuff = true;
|
||||
}
|
||||
P_DamageMobj (trace.Actor, puff ? puff : t1, t1, damage, damageType, dmgflags);
|
||||
}
|
||||
if (victim != NULL)
|
||||
{
|
||||
*victim = trace.Actor;
|
||||
|
|
@ -3995,6 +3997,7 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
|
|||
{
|
||||
fixed_t x, y, z;
|
||||
bool spawnpuff;
|
||||
bool bleed = false;
|
||||
int puffflags = PF_HITTHING;
|
||||
|
||||
x = x1 + FixedMul (RailHits[i].Distance, vx);
|
||||
|
|
@ -4012,8 +4015,7 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
|
|||
puffflags |= PF_HITTHINGBLEED; // [XA] Allow for puffs to jump to XDeath state.
|
||||
if(!(puffDefaults->flags3 & MF3_BLOODLESSIMPACT))
|
||||
{
|
||||
P_SpawnBlood (x, y, z, (source->angle + angleoffset) - ANG180, damage, RailHits[i].HitActor);
|
||||
P_TraceBleed (damage, x, y, z, RailHits[i].HitActor, source->angle, pitch);
|
||||
bleed = true;
|
||||
}
|
||||
}
|
||||
if (spawnpuff)
|
||||
|
|
@ -4021,7 +4023,12 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
|
|||
if (puffDefaults && puffDefaults->PoisonDamage > 0 && puffDefaults->PoisonDuration != INT_MIN)
|
||||
P_PoisonMobj(RailHits[i].HitActor, thepuff ? thepuff : source, source, puffDefaults->PoisonDamage, puffDefaults->PoisonDuration, puffDefaults->PoisonPeriod, puffDefaults->PoisonDamageType);
|
||||
|
||||
P_DamageMobj (RailHits[i].HitActor, thepuff? thepuff:source, source, damage, damagetype, DMG_INFLICTOR_IS_PUFF);
|
||||
int newdam = P_DamageMobj (RailHits[i].HitActor, thepuff? thepuff:source, source, damage, damagetype, DMG_INFLICTOR_IS_PUFF);
|
||||
if (bleed)
|
||||
{
|
||||
P_SpawnBlood (x, y, z, (source->angle + angleoffset) - ANG180, newdam > 0 ? newdam : damage, RailHits[i].HitActor);
|
||||
P_TraceBleed (newdam > 0 ? newdam : damage, x, y, z, RailHits[i].HitActor, source->angle, pitch);
|
||||
}
|
||||
}
|
||||
|
||||
// Spawn a decal or puff at the point where the trace ended.
|
||||
|
|
@ -4551,16 +4558,17 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b
|
|||
double velz;
|
||||
double thrust;
|
||||
int damage = (int)points;
|
||||
int newdam = damage;
|
||||
|
||||
if (!(flags & RADF_NODAMAGE))
|
||||
P_DamageMobj (thing, bombspot, bombsource, damage, bombmod);
|
||||
newdam = P_DamageMobj (thing, bombspot, bombsource, damage, bombmod);
|
||||
else if (thing->player == NULL && !(flags & RADF_NOIMPACTDAMAGE))
|
||||
thing->flags2 |= MF2_BLASTED;
|
||||
|
||||
if (!(thing->flags & MF_ICECORPSE))
|
||||
{
|
||||
if (!(flags & RADF_NODAMAGE) && !(bombspot->flags3 & MF3_BLOODLESSIMPACT))
|
||||
P_TraceBleed (damage, thing, bombspot);
|
||||
P_TraceBleed (newdam > 0 ? newdam : damage, thing, bombspot);
|
||||
|
||||
if (!(flags & RADF_NODAMAGE) || !(bombspot->flags2 & MF2_NODMGTHRUST))
|
||||
{
|
||||
|
|
@ -4616,8 +4624,8 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b
|
|||
damage = Scale(damage, thing->GetClass()->Meta.GetMetaFixed(AMETA_RDFactor, FRACUNIT), FRACUNIT);
|
||||
if (damage > 0)
|
||||
{
|
||||
P_DamageMobj (thing, bombspot, bombsource, damage, bombmod);
|
||||
P_TraceBleed (damage, thing, bombspot);
|
||||
int newdam = P_DamageMobj (thing, bombspot, bombsource, damage, bombmod);
|
||||
P_TraceBleed (newdam > 0 ? newdam : damage, thing, bombspot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4819,7 +4827,7 @@ void P_DoCrunch (AActor *thing, FChangePosition *cpos)
|
|||
|
||||
if ((cpos->crushchange > 0) && !(level.maptime & 3))
|
||||
{
|
||||
P_DamageMobj (thing, NULL, NULL, cpos->crushchange, NAME_Crush);
|
||||
int newdam = P_DamageMobj (thing, NULL, NULL, cpos->crushchange, NAME_Crush);
|
||||
|
||||
// spray blood in a random direction
|
||||
if (!(thing->flags2&(MF2_INVULNERABLE|MF2_DORMANT)))
|
||||
|
|
@ -4829,7 +4837,7 @@ void P_DoCrunch (AActor *thing, FChangePosition *cpos)
|
|||
PalEntry bloodcolor = thing->GetBloodColor();
|
||||
const PClass *bloodcls = thing->GetBloodType();
|
||||
|
||||
P_TraceBleed (cpos->crushchange, thing);
|
||||
P_TraceBleed (newdam > 0 ? newdam : cpos->crushchange, thing);
|
||||
if (cl_bloodtype <= 1 && bloodcls != NULL)
|
||||
{
|
||||
AActor *mo;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue