- HITTARGET/MASTER/TRACER now set the puff's pointer(s) within P_SpawnPuff.

- PUFFGETSOWNER, for the sake of compatibility, maintains override for target.
This commit is contained in:
MajorCooke 2014-12-27 14:15:14 -06:00
parent 6f994cb3e7
commit 519ff8b7d1
3 changed files with 13 additions and 17 deletions

View file

@ -133,7 +133,7 @@ enum EPuffFlags
PF_NORANDOMZ = 16 PF_NORANDOMZ = 16
}; };
AActor *P_SpawnPuff (AActor *source, const PClass *pufftype, fixed_t x, fixed_t y, fixed_t z, angle_t dir, int updown, int flags = 0); AActor *P_SpawnPuff (AActor *source, const PClass *pufftype, fixed_t x, fixed_t y, fixed_t z, angle_t dir, int updown, int flags = 0, AActor *vict = NULL);
void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, angle_t dir, int damage, AActor *originator); void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, angle_t dir, int damage, AActor *originator);
void P_BloodSplatter (fixed_t x, fixed_t y, fixed_t z, AActor *originator); void P_BloodSplatter (fixed_t x, fixed_t y, fixed_t z, AActor *originator);
void P_BloodSplatter2 (fixed_t x, fixed_t y, fixed_t z, AActor *originator); void P_BloodSplatter2 (fixed_t x, fixed_t y, fixed_t z, AActor *originator);

View file

@ -3761,14 +3761,7 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance,
puffFlags |= PF_HITTHINGBLEED; puffFlags |= PF_HITTHINGBLEED;
// We must pass the unreplaced puff type here // We must pass the unreplaced puff type here
puff = P_SpawnPuff(t1, pufftype, hitx, hity, hitz, angle - ANG180, 2, puffFlags | PF_HITTHING); puff = P_SpawnPuff(t1, pufftype, hitx, hity, hitz, angle - ANG180, 2, puffFlags | PF_HITTHING, trace.Actor);
}
if (puffDefaults != NULL && trace.Actor != NULL && puff != NULL)
{
if (puffDefaults->flags7 && MF7_HITTARGET) puff->target = trace.Actor;
if (puffDefaults->flags7 && MF7_HITMASTER) puff->master = trace.Actor;
if (puffDefaults->flags7 && MF7_HITTRACER) puff->tracer = trace.Actor;
} }
// Allow puffs to inflict poison damage, so that hitscans can poison, too. // Allow puffs to inflict poison damage, so that hitscans can poison, too.
@ -4211,14 +4204,9 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
} }
if (spawnpuff) if (spawnpuff)
{ {
P_SpawnPuff(source, puffclass, x, y, z, (source->angle + angleoffset) - ANG90, 1, puffflags); P_SpawnPuff(source, puffclass, x, y, z, (source->angle + angleoffset) - ANG90, 1, puffflags, hitactor);
}
if (hitactor != NULL && puffDefaults != NULL && thepuff != NULL)
{
if (puffDefaults->flags7 & MF7_HITTARGET) thepuff->target = hitactor;
if (puffDefaults->flags7 & MF7_HITMASTER) thepuff->master = hitactor;
if (puffDefaults->flags7 & MF7_HITTRACER) thepuff->tracer = hitactor;
} }
if (puffDefaults && puffDefaults->PoisonDamage > 0 && puffDefaults->PoisonDuration != INT_MIN) if (puffDefaults && puffDefaults->PoisonDamage > 0 && puffDefaults->PoisonDuration != INT_MIN)
{ {
P_PoisonMobj(hitactor, thepuff ? thepuff : source, source, puffDefaults->PoisonDamage, puffDefaults->PoisonDuration, puffDefaults->PoisonPeriod, puffDefaults->PoisonDamageType); P_PoisonMobj(hitactor, thepuff ? thepuff : source, source, puffDefaults->PoisonDamage, puffDefaults->PoisonDuration, puffDefaults->PoisonPeriod, puffDefaults->PoisonDamageType);

View file

@ -4930,7 +4930,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
// P_SpawnPuff // P_SpawnPuff
// //
AActor *P_SpawnPuff (AActor *source, const PClass *pufftype, fixed_t x, fixed_t y, fixed_t z, angle_t dir, int updown, int flags) AActor *P_SpawnPuff (AActor *source, const PClass *pufftype, fixed_t x, fixed_t y, fixed_t z, angle_t dir, int updown, int flags, AActor *vict)
{ {
AActor *puff; AActor *puff;
@ -4940,10 +4940,18 @@ AActor *P_SpawnPuff (AActor *source, const PClass *pufftype, fixed_t x, fixed_t
puff = Spawn (pufftype, x, y, z, ALLOW_REPLACE); puff = Spawn (pufftype, x, y, z, ALLOW_REPLACE);
if (puff == NULL) return NULL; if (puff == NULL) return NULL;
//Moved puff creation and target/master/tracer setting to here.
if (puff && vict)
{
if (puff->flags7 & MF7_HITTARGET) puff->target = vict;
if (puff->flags7 & MF7_HITMASTER) puff->master = vict;
if (puff->flags7 & MF7_HITTRACER) puff->tracer = vict;
}
// [BB] If the puff came from a player, set the target of the puff to this player. // [BB] If the puff came from a player, set the target of the puff to this player.
if ( puff && (puff->flags5 & MF5_PUFFGETSOWNER)) if ( puff && (puff->flags5 & MF5_PUFFGETSOWNER))
puff->target = source; puff->target = source;
if (source != NULL) puff->angle = R_PointToAngle2(x, y, source->x, source->y); if (source != NULL) puff->angle = R_PointToAngle2(x, y, source->x, source->y);
// If a puff has a crash state and an actor was not hit, // If a puff has a crash state and an actor was not hit,