mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 15:22:08 +00:00
- Added HIT* flag detection for bullet and rail attacks.
This commit is contained in:
parent
465d9ab89a
commit
fc05a3bb2f
1 changed files with 18 additions and 2 deletions
|
@ -3746,6 +3746,8 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance,
|
|||
hity = t1->y + FixedMul(vy, dist);
|
||||
hitz = shootz + FixedMul(vz, dist);
|
||||
|
||||
|
||||
|
||||
// Spawn bullet puffs or blood spots, depending on target type.
|
||||
if ((puffDefaults != NULL && puffDefaults->flags3 & MF3_PUFFONACTORS) ||
|
||||
(trace.Actor->flags & MF_NOBLOOD) ||
|
||||
|
@ -3758,6 +3760,13 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance,
|
|||
puff = P_SpawnPuff(t1, pufftype, hitx, hity, hitz, angle - ANG180, 2, puffFlags | PF_HITTHING);
|
||||
}
|
||||
|
||||
if (puffDefaults != NULL && trace.Actor != NULL)
|
||||
{
|
||||
if (puffDefaults->flags7 && MF7_HITTARGET) puffDefaults->target = trace.Actor;
|
||||
if (puffDefaults->flags7 && MF7_HITMASTER) puffDefaults->master = trace.Actor;
|
||||
if (puffDefaults->flags7 && MF7_HITTRACER) puffDefaults->tracer = trace.Actor;
|
||||
}
|
||||
|
||||
// Allow puffs to inflict poison damage, so that hitscans can poison, too.
|
||||
if (puffDefaults != NULL && puffDefaults->PoisonDamage > 0 && puffDefaults->PoisonDuration != INT_MIN)
|
||||
{
|
||||
|
@ -4150,7 +4159,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
|
|||
int flags;
|
||||
|
||||
assert(puffclass != NULL); // Because we set it to a default above
|
||||
AActor *puffDefaults = GetDefaultByType(puffclass->GetReplacement());
|
||||
AActor *puffDefaults = GetDefaultByType(puffclass->GetReplacement()); //Contains all the flags such as FOILINVUL, etc.
|
||||
|
||||
flags = (puffDefaults->flags6 & MF6_NOTRIGGER) ? 0 : TRACE_PCross | TRACE_Impact;
|
||||
rail_data.StopAtInvul = (puffDefaults->flags3 & MF3_FOILINVUL) ? false : true;
|
||||
|
@ -4200,6 +4209,12 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
|
|||
{
|
||||
P_SpawnPuff(source, puffclass, x, y, z, (source->angle + angleoffset) - ANG90, 1, puffflags);
|
||||
}
|
||||
if (hitactor != NULL && puffDefaults != NULL)
|
||||
{
|
||||
if (puffDefaults->flags7 & MF7_HITTARGET) puffDefaults->target = hitactor;
|
||||
if (puffDefaults->flags7 & MF7_HITMASTER) puffDefaults->master = hitactor;
|
||||
if (puffDefaults->flags7 & MF7_HITTRACER) puffDefaults->tracer = hitactor;
|
||||
}
|
||||
if (puffDefaults && puffDefaults->PoisonDamage > 0 && puffDefaults->PoisonDuration != INT_MIN)
|
||||
{
|
||||
P_PoisonMobj(hitactor, thepuff ? thepuff : source, source, puffDefaults->PoisonDamage, puffDefaults->PoisonDuration, puffDefaults->PoisonPeriod, puffDefaults->PoisonDamageType);
|
||||
|
@ -4208,6 +4223,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
|
|||
dmgFlagPass += (puffDefaults->flags3 & MF3_FOILINVUL) ? DMG_FOILINVUL : 0; //[MC]Because the original foilinvul check wasn't working.
|
||||
dmgFlagPass += (puffDefaults->flags7 & MF7_FOILBUDDHA) ? DMG_FOILBUDDHA : 0;
|
||||
int newdam = P_DamageMobj(hitactor, thepuff ? thepuff : source, source, damage, damagetype, dmgFlagPass);
|
||||
|
||||
if (bleed)
|
||||
{
|
||||
P_SpawnBlood(x, y, z, (source->angle + angleoffset) - ANG180, newdam > 0 ? newdam : damage, hitactor);
|
||||
|
|
Loading…
Reference in a new issue