diff --git a/src/g_hexen/a_flechette.cpp b/src/g_hexen/a_flechette.cpp index 780b6d1ea0..779b9424ca 100644 --- a/src/g_hexen/a_flechette.cpp +++ b/src/g_hexen/a_flechette.cpp @@ -196,11 +196,6 @@ bool AArtiPoisonBagShooter::Use (bool pickup) { mo->tracer = Owner->target; } - // set the health value so that the missile works properly - if (mo->flags4 & MF4_SPECTRAL) - { - mo->health = -2; - } return true; } } diff --git a/src/g_strife/a_alienspectres.cpp b/src/g_strife/a_alienspectres.cpp index 169889b2e1..4626891bbe 100644 --- a/src/g_strife/a_alienspectres.cpp +++ b/src/g_strife/a_alienspectres.cpp @@ -66,7 +66,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Spectre3Attack) foo->velz = -12*FRACUNIT; foo->target = self; - foo->health = -2; + foo->FriendPlayer = 0; foo->tracer = self->target; self->angle -= ANGLE_180 / 20 * 10; diff --git a/src/g_strife/a_entityboss.cpp b/src/g_strife/a_entityboss.cpp index f69d43fc6f..3dfeb3b5a7 100644 --- a/src/g_strife/a_entityboss.cpp +++ b/src/g_strife/a_entityboss.cpp @@ -29,7 +29,6 @@ void A_SpectralMissile (AActor *self, const char *missilename) if (missile != NULL) { missile->tracer = self->target; - missile->health = -2; P_CheckMissileSpawn(missile); } } diff --git a/src/g_strife/a_programmer.cpp b/src/g_strife/a_programmer.cpp index 6a65ef9e37..0f843c55c1 100644 --- a/src/g_strife/a_programmer.cpp +++ b/src/g_strife/a_programmer.cpp @@ -109,7 +109,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpotLightning) { spot->threshold = 25; spot->target = self; - spot->health = -2; + spot->FriendPlayer = 0; spot->tracer = self->target; } } diff --git a/src/g_strife/a_spectral.cpp b/src/g_strife/a_spectral.cpp index 1272d35f87..6e2e6488e1 100644 --- a/src/g_strife/a_spectral.cpp +++ b/src/g_strife/a_spectral.cpp @@ -31,7 +31,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightningTail) AActor *foo = Spawn("SpectralLightningHTail", self->x - self->velx, self->y - self->vely, self->z, ALLOW_REPLACE); foo->angle = self->angle; - foo->health = self->health; + foo->FriendPlayer = self->FriendPlayer; } DEFINE_ACTION_FUNCTION(AActor, A_SpectralBigBallLightning) @@ -69,13 +69,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightning) flash->target = self->target; flash->velz = -18*FRACUNIT; - flash->health = self->health; + flash->FriendPlayer = self->FriendPlayer; flash = Spawn(NAME_SpectralLightningV2, self->x, self->y, ONCEILINGZ, ALLOW_REPLACE); flash->target = self->target; flash->velz = -18*FRACUNIT; - flash->health = self->health; + flash->FriendPlayer = self->FriendPlayer; } // In Strife, this number is stored in the data segment, but it doesn't seem to be diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index 957a5371af..1194f92375 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -530,15 +530,15 @@ AActor *P_SpawnSubMissile (AActor *source, const PClass *type, AActor *target) { if (source->flags & MF_MISSILE && source->flags4 & MF4_SPECTRAL) { - other->health = source->health; + other->FriendPlayer = source->FriendPlayer; } else if (target->player != NULL) { - other->health = -1; + other->FriendPlayer = int(target->player - players) + 1; } else { - other->health = -2; + other->FriendPlayer = 0; } } @@ -925,7 +925,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1) } if (spot != NULL) { - spot->health = -1; + spot->FriendPlayer = int(player-players)+1; spot->target = self; } } diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index de77f27124..955f1eec3d 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -981,12 +981,12 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage { if (player != NULL) { - if (!deathmatch && inflictor->health == -1) + if (!deathmatch && inflictor->FriendPlayer > 0) return; } else if (target->flags4 & MF4_SPECTRAL) { - if (inflictor->health == -2 && !target->IsHostile(inflictor)) + if (inflictor->FriendPlayer == 0 && !target->IsHostile(inflictor)) return; } } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 8ba0a94411..b48ef97326 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -5295,6 +5295,18 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, th->angle = R_PointToAngle2 (0, 0, th->velx, th->vely); + if (th->flags4 & MF4_SPECTRAL) + { + if (owner->player != NULL) + { + th->FriendPlayer = int(owner->player - players) + 1; + } + else + { + th->FriendPlayer = 0; + } + } + return (!checkspawn || P_CheckMissileSpawn (th)) ? th : NULL; } @@ -5319,6 +5331,19 @@ AActor * P_OldSpawnMissile(AActor * source, AActor * owner, AActor * dest, const dist = 1; th->velz = (dest->z - source->z) / dist; + + if (th->flags4 & MF4_SPECTRAL) + { + if (owner->player != NULL) + { + th->FriendPlayer = int(owner->player - players) + 1; + } + else + { + th->FriendPlayer = 0; + } + } + P_CheckMissileSpawn(th); return th; } @@ -5401,6 +5426,19 @@ AActor *P_SpawnMissileAngleZSpeed (AActor *source, fixed_t z, mo->velx = FixedMul (speed, finecosine[angle]); mo->vely = FixedMul (speed, finesine[angle]); mo->velz = velz; + + if (mo->flags4 & MF4_SPECTRAL) + { + if (owner->player != NULL) + { + mo->FriendPlayer = int(owner->player - players) + 1; + } + else + { + mo->FriendPlayer = 0; + } + } + return (!checkspawn || P_CheckMissileSpawn(mo)) ? mo : NULL; } @@ -5512,8 +5550,16 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, MissileActor->velz = (fixed_t)vec.Z; if (MissileActor->flags4 & MF4_SPECTRAL) - MissileActor->health = -1; - + { + if (source->player != NULL) + { + MissileActor->FriendPlayer = int(source->player - players) + 1; + } + else + { + MissileActor->FriendPlayer = 0; + } + } if (P_CheckMissileSpawn (MissileActor)) { return MissileActor; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 71e1661163..4d31f869a3 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -333,11 +333,6 @@ static void DoAttack (AActor *self, bool domelee, bool domissile, { missile->tracer=self->target; } - // set the health value so that the missile works properly - if (missile->flags4&MF4_SPECTRAL) - { - missile->health=-2; - } P_CheckMissileSpawn(missile); } } @@ -967,10 +962,17 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile) // automatic handling of seeker missiles missile->tracer=self->target; } - // set the health value so that the missile works properly + // we must redo the spectral check here because the owner is set after spawning so the FriendPlayer value may be wrong if (missile->flags4&MF4_SPECTRAL) { - missile->health=-2; + if (missile->target != NULL && missile->target->player != NULL) + { + missile->FriendPlayer = int(missile->target->player - players) + 1; + } + else + { + missile->FriendPlayer = 0; + } } P_CheckMissileSpawn(missile); } @@ -1121,11 +1123,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomComboAttack) { missile->tracer=self->target; } - // set the health value so that the missile works properly - if (missile->flags4&MF4_SPECTRAL) - { - missile->health=-2; - } P_CheckMissileSpawn(missile); } }