diff --git a/docs/rh-log.txt b/docs/rh-log.txt index f29f2fa17..4fc95183a 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,16 @@ July 12, 2008 (Changes by Graf Zahl) +- Fixed: Friendly spectral monsters should be able to hurt unfriendly ones + and vice versa. +- Fixed: In deathmatch specral missiles spawned by players should hurt other + players. +- Fixed: SpectralLightningBigBall didn't set the proper owner for the lightning + projectiles it spawned. +- Changed the EntityBoss's attack function to call the equivalent spectre + functions instead of duplicating their code. +- Gave many of Strife's code pointers that only had a number as name more + meaningful names. +- Fixed: All spectral attacks must set 'health' first before P_CheckMissileSpawn + is called. - Added a compatibility option to play sector sounds from the precalculated center because some maps apparently abuse the behavior to make the sound play somewhere where it can't be heard by the player to fake silent movement. diff --git a/src/g_strife/a_alienspectres.cpp b/src/g_strife/a_alienspectres.cpp index b8e83e172..ef061909b 100644 --- a/src/g_strife/a_alienspectres.cpp +++ b/src/g_strife/a_alienspectres.cpp @@ -10,17 +10,17 @@ #include "gstrings.h" static FRandom pr_spectrespawn ("AlienSpectreSpawn"); -static FRandom pr_212e4 ("212e4"); +static FRandom pr_spectrechunk ("212e4"); void A_SentinelBob (AActor *); -void A_20538 (AActor *); +void A_SpectreMelee (AActor *); void A_SpotLightning (AActor *); -void A_212e4 (AActor *); -void A_2134c (AActor *); -void A_204d0 (AActor *); -void A_204a4 (AActor *); -void A_20314 (AActor *); -void A_20334 (AActor *); +void A_SpectreChunkSmall (AActor *); +void A_SpectreChunkLarge (AActor *); +void A_Spectre2Attack (AActor *); +void A_Spectre4Attack (AActor *); +void A_Spectre5Attack (AActor *); +void A_Spectre3Attack (AActor *); void A_AlienSpectreDeath (AActor *); void A_AlertMonsters (AActor *); @@ -51,7 +51,7 @@ FState AAlienSpectre1::States[] = #define S_ALIEN_MELEE (S_ALIEN_CHASE+11) // 809 S_BRIGHT (ALN1, 'J', 4, A_FaceTarget, &States[S_ALIEN_MELEE+1]), - S_BRIGHT (ALN1, 'I', 4, A_20538, &States[S_ALIEN_MELEE+2]), + S_BRIGHT (ALN1, 'I', 4, A_SpectreMelee, &States[S_ALIEN_MELEE+2]), S_BRIGHT (ALN1, 'H', 4, NULL, &States[S_ALIEN_CHASE+2]), #define S_ALIEN_MISSILE (S_ALIEN_MELEE+3) // 812 @@ -63,20 +63,20 @@ FState AAlienSpectre1::States[] = S_NORMAL (ALN1, 'J', 2, A_Pain, &States[S_ALIEN_CHASE+6]), #define S_ALIEN_DIE (S_ALIEN_PAIN+1) // 816 - S_BRIGHT (AL1P, 'A', 6, A_212e4, &States[S_ALIEN_DIE+1]), + S_BRIGHT (AL1P, 'A', 6, A_SpectreChunkSmall, &States[S_ALIEN_DIE+1]), S_BRIGHT (AL1P, 'B', 6, A_Scream, &States[S_ALIEN_DIE+2]), - S_BRIGHT (AL1P, 'C', 6, A_212e4, &States[S_ALIEN_DIE+3]), + S_BRIGHT (AL1P, 'C', 6, A_SpectreChunkSmall, &States[S_ALIEN_DIE+3]), S_BRIGHT (AL1P, 'D', 6, NULL, &States[S_ALIEN_DIE+4]), S_BRIGHT (AL1P, 'E', 6, NULL, &States[S_ALIEN_DIE+5]), - S_BRIGHT (AL1P, 'F', 6, A_212e4, &States[S_ALIEN_DIE+6]), + S_BRIGHT (AL1P, 'F', 6, A_SpectreChunkSmall, &States[S_ALIEN_DIE+6]), S_BRIGHT (AL1P, 'G', 6, NULL, &States[S_ALIEN_DIE+7]), - S_BRIGHT (AL1P, 'H', 6, A_212e4, &States[S_ALIEN_DIE+8]), + S_BRIGHT (AL1P, 'H', 6, A_SpectreChunkSmall, &States[S_ALIEN_DIE+8]), S_BRIGHT (AL1P, 'I', 6, NULL, &States[S_ALIEN_DIE+9]), S_BRIGHT (AL1P, 'J', 6, NULL, &States[S_ALIEN_DIE+10]), S_BRIGHT (AL1P, 'K', 6, NULL, &States[S_ALIEN_DIE+11]), S_BRIGHT (AL1P, 'L', 5, NULL, &States[S_ALIEN_DIE+12]), S_BRIGHT (AL1P, 'M', 5, NULL, &States[S_ALIEN_DIE+13]), - S_BRIGHT (AL1P, 'N', 5, A_2134c, &States[S_ALIEN_DIE+14]), + S_BRIGHT (AL1P, 'N', 5, A_SpectreChunkLarge, &States[S_ALIEN_DIE+14]), S_BRIGHT (AL1P, 'O', 5, NULL, &States[S_ALIEN_DIE+15]), S_BRIGHT (AL1P, 'P', 5, NULL, &States[S_ALIEN_DIE+16]), S_BRIGHT (AL1P, 'Q', 5, NULL, &States[S_ALIEN_DIE+17]), @@ -84,17 +84,17 @@ FState AAlienSpectre1::States[] = #define S_ALIEN2_MISSILE (S_ALIEN_DIE+18) // 852 S_NORMAL (ALN1, 'F', 4, A_FaceTarget, &States[S_ALIEN2_MISSILE+1]), - S_NORMAL (ALN1, 'I', 4, A_204d0, &States[S_ALIEN2_MISSILE+2]), + S_NORMAL (ALN1, 'I', 4, A_Spectre2Attack, &States[S_ALIEN2_MISSILE+2]), S_NORMAL (ALN1, 'E', 4, NULL, &States[S_ALIEN_CHASE+10]), #define S_ALIEN4_MISSILE (S_ALIEN2_MISSILE+3) // 884 S_NORMAL (ALN1, 'F', 4, A_FaceTarget, &States[S_ALIEN4_MISSILE+1]), - S_NORMAL (ALN1, 'I', 4, A_204a4, &States[S_ALIEN4_MISSILE+2]), + S_NORMAL (ALN1, 'I', 4, A_Spectre4Attack, &States[S_ALIEN4_MISSILE+2]), S_NORMAL (ALN1, 'E', 4, NULL, &States[S_ALIEN_CHASE+10]), #define S_ALIEN5_MISSILE (S_ALIEN4_MISSILE+3) // 887 S_NORMAL (ALN1, 'F', 4, A_FaceTarget, &States[S_ALIEN5_MISSILE+1]), - S_NORMAL (ALN1, 'I', 4, A_20314, &States[S_ALIEN5_MISSILE+2]), + S_NORMAL (ALN1, 'I', 4, A_Spectre5Attack, &States[S_ALIEN5_MISSILE+2]), S_NORMAL (ALN1, 'E', 4, NULL, &States[S_ALIEN_CHASE]) }; @@ -195,12 +195,12 @@ FState AAlienSpectre3::States[] = #define S_ALIEN3_MELEE (S_ALIEN3_CHASE+11) // 877 S_NORMAL (ALN1, 'J', 4, A_FaceTarget, &States[S_ALIEN3_MELEE+1]), - S_NORMAL (ALN1, 'I', 4, A_20538, &States[S_ALIEN3_MELEE+2]), + S_NORMAL (ALN1, 'I', 4, A_SpectreMelee, &States[S_ALIEN3_MELEE+2]), S_NORMAL (ALN1, 'C', 4, NULL, &States[S_ALIEN3_CHASE+2]), #define S_ALIEN3_MISSILE (S_ALIEN3_MELEE+3) // 880 S_NORMAL (ALN1, 'F', 4, A_FaceTarget, &States[S_ALIEN3_MISSILE+1]), - S_NORMAL (ALN1, 'I', 4, A_20334, &States[S_ALIEN3_MISSILE+2]), + S_NORMAL (ALN1, 'I', 4, A_Spectre3Attack, &States[S_ALIEN3_MISSILE+2]), S_NORMAL (ALN1, 'E', 4, NULL, &States[S_ALIEN3_CHASE+10]), #define S_ALIEN3_PAIN (S_ALIEN3_MISSILE+3) // 883 @@ -371,7 +371,7 @@ void A_SpawnSpectre5 (AActor *actor) GenericSpectreSpawn (actor, RUNTIME_CLASS(AAlienSpectre5)); } -void A_212e4 (AActor *self) +void A_SpectreChunkSmall (AActor *self) { AActor *foo = Spawn (self->x, self->y, self->z + 10*FRACUNIT, ALLOW_REPLACE); @@ -379,17 +379,17 @@ void A_212e4 (AActor *self) { int t; - t = pr_212e4() & 15; - foo->momx = (t - (pr_212e4() & 7)) << FRACBITS; + t = pr_spectrechunk() & 15; + foo->momx = (t - (pr_spectrechunk() & 7)) << FRACBITS; - t = pr_212e4() & 15; - foo->momy = (t - (pr_212e4() & 7)) << FRACBITS; + t = pr_spectrechunk() & 15; + foo->momy = (t - (pr_spectrechunk() & 7)) << FRACBITS; - foo->momz = (pr_212e4() & 15) << FRACBITS; + foo->momz = (pr_spectrechunk() & 15) << FRACBITS; } } -void A_2134c (AActor *self) +void A_SpectreChunkLarge (AActor *self) { AActor *foo = Spawn (self->x, self->y, self->z + 10*FRACUNIT, ALLOW_REPLACE); @@ -397,65 +397,61 @@ void A_2134c (AActor *self) { int t; - t = pr_212e4() & 7; - foo->momx = (t - (pr_212e4() & 15)) << FRACBITS; + t = pr_spectrechunk() & 7; + foo->momx = (t - (pr_spectrechunk() & 15)) << FRACBITS; - t = pr_212e4() & 7; - foo->momy = (t - (pr_212e4() & 15)) << FRACBITS; + t = pr_spectrechunk() & 7; + foo->momy = (t - (pr_spectrechunk() & 15)) << FRACBITS; - foo->momz = (pr_212e4() & 7) << FRACBITS; + foo->momz = (pr_spectrechunk() & 7) << FRACBITS; } } -void A_204a4 (AActor *self) +void A_Spectre4Attack (AActor *self) { if (self->target != NULL) { - AActor *missile = P_SpawnMissile (self, self->target, RUNTIME_CLASS(ASpectralLightningBigV2)); + AActor *missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT, + self, self->target, RUNTIME_CLASS(ASpectralLightningBigV2), false); if (missile != NULL) { missile->tracer = self->target; missile->health = -2; + P_CheckMissileSpawn(missile); } } } -void A_204d0 (AActor *self) +void A_Spectre2Attack (AActor *self) { if (self->target != NULL) { - AActor *missile = P_SpawnMissile (self, self->target, RUNTIME_CLASS(ASpectralLightningH3)); + AActor *missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT, + self, self->target, RUNTIME_CLASS(ASpectralLightningH3), false); if (missile != NULL) { missile->health = -2; + P_CheckMissileSpawn(missile); } } } -void A_20314 (AActor *self) +void A_Spectre5Attack (AActor *self) { if (self->target != NULL) { - AActor *missile = P_SpawnMissile (self, self->target, RUNTIME_CLASS(ASpectralLightningBigBall2)); + AActor *missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT, + self, self->target, RUNTIME_CLASS(ASpectralLightningBigBall2), false); if (missile != NULL) { missile->health = -2; + P_CheckMissileSpawn(missile); } } } -void A_20424 (AActor *self) -{ - self->angle += ANGLE_90; - P_SpawnSubMissile (self, RUNTIME_CLASS(ASpectralLightningH3), self); - self->angle += ANGLE_180; - P_SpawnSubMissile (self, RUNTIME_CLASS(ASpectralLightningH3), self); - self->angle += ANGLE_90; - P_SpawnSubMissile (self, RUNTIME_CLASS(ASpectralLightningH3), self); -} - -void A_20334 (AActor *self) +void A_Spectre3Attack (AActor *self) { if (self->target == NULL) return; diff --git a/src/g_strife/a_entityboss.cpp b/src/g_strife/a_entityboss.cpp index 762a2983e..b87f62118 100644 --- a/src/g_strife/a_entityboss.cpp +++ b/src/g_strife/a_entityboss.cpp @@ -8,15 +8,19 @@ static FRandom pr_entity ("Entity"); -void A_SpawnEntity (AActor *); -void A_200e0 (AActor *); -void A_20c74 (AActor *); +void A_SpotLightning (AActor *); -void A_20538 (AActor *); -void A_212e4 (AActor *); -void A_2134c (AActor *); -void A_20334 (AActor *); -void A_204d0 (AActor *); +void A_SpawnEntity (AActor *); +void A_EntityAttack (AActor *); +void A_SpawnSubEntities (AActor *); + +void A_SpectreMelee (AActor *); +void A_SpectreChunkSmall (AActor *); +void A_SpectreChunkLarge (AActor *); +void A_Spectre2Attack (AActor *); +void A_Spectre3Attack (AActor *); +void A_Spectre4Attack (AActor *); +void A_Spectre5Attack (AActor *); void A_SentinelBob (AActor *); void A_TossGib (AActor *); @@ -85,18 +89,18 @@ public: FState AEntityBoss::States[] = { #define S_ENTITY_SPAWN 0 - S_NORMAL (MNAM, 'A', 100, NULL, &States[S_ENTITY_SPAWN+1]), - S_BRIGHT (MNAM, 'B', 60, NULL, &States[S_ENTITY_SPAWN+2]), - S_BRIGHT (MNAM, 'C', 4, NULL, &States[S_ENTITY_SPAWN+3]), - S_BRIGHT (MNAM, 'D', 4, NULL, &States[S_ENTITY_SPAWN+4]), - S_BRIGHT (MNAM, 'E', 4, NULL, &States[S_ENTITY_SPAWN+5]), - S_BRIGHT (MNAM, 'F', 4, NULL, &States[S_ENTITY_SPAWN+6]), - S_BRIGHT (MNAM, 'G', 4, NULL, &States[S_ENTITY_SPAWN+7]), - S_BRIGHT (MNAM, 'H', 4, NULL, &States[S_ENTITY_SPAWN+8]), - S_BRIGHT (MNAM, 'I', 4, NULL, &States[S_ENTITY_SPAWN+9]), - S_BRIGHT (MNAM, 'J', 4, NULL, &States[S_ENTITY_SPAWN+10]), - S_BRIGHT (MNAM, 'K', 4, NULL, &States[S_ENTITY_SPAWN+11]), - S_BRIGHT (MNAM, 'L', 4, NULL, &States[S_ENTITY_SPAWN+12]), + S_NORMAL (MNAM, 'A', 100, NULL, &States[S_ENTITY_SPAWN+1]), + S_BRIGHT (MNAM, 'B', 60, NULL, &States[S_ENTITY_SPAWN+2]), + S_BRIGHT (MNAM, 'C', 4, NULL, &States[S_ENTITY_SPAWN+3]), + S_BRIGHT (MNAM, 'D', 4, NULL, &States[S_ENTITY_SPAWN+4]), + S_BRIGHT (MNAM, 'E', 4, NULL, &States[S_ENTITY_SPAWN+5]), + S_BRIGHT (MNAM, 'F', 4, NULL, &States[S_ENTITY_SPAWN+6]), + S_BRIGHT (MNAM, 'G', 4, NULL, &States[S_ENTITY_SPAWN+7]), + S_BRIGHT (MNAM, 'H', 4, NULL, &States[S_ENTITY_SPAWN+8]), + S_BRIGHT (MNAM, 'I', 4, NULL, &States[S_ENTITY_SPAWN+9]), + S_BRIGHT (MNAM, 'J', 4, NULL, &States[S_ENTITY_SPAWN+10]), + S_BRIGHT (MNAM, 'K', 4, NULL, &States[S_ENTITY_SPAWN+11]), + S_BRIGHT (MNAM, 'L', 4, NULL, &States[S_ENTITY_SPAWN+12]), S_BRIGHT (MNAL, 'A', 4, A_Look, &States[S_ENTITY_SPAWN+13]), S_BRIGHT (MNAL, 'B', 4, A_SentinelBob, &States[S_ENTITY_SPAWN+12]), @@ -115,25 +119,25 @@ FState AEntityBoss::States[] = #define S_ENTITY_MELEE (S_ENTITY_SEE+11) S_BRIGHT (MNAL, 'J', 4, A_FaceTarget, &States[S_ENTITY_MELEE+1]), - S_BRIGHT (MNAL, 'I', 4, A_20538, &States[S_ENTITY_MELEE+2]), + S_BRIGHT (MNAL, 'I', 4, A_SpectreMelee, &States[S_ENTITY_MELEE+2]), S_BRIGHT (MNAL, 'C', 4, NULL, &States[S_ENTITY_SEE+2]), #define S_ENTITY_MISSILE (S_ENTITY_MELEE+3) S_BRIGHT (MNAL, 'F', 4, A_FaceTarget, &States[S_ENTITY_MISSILE+1]), - S_BRIGHT (MNAL, 'I', 4, A_200e0, &States[S_ENTITY_MISSILE+2]), + S_BRIGHT (MNAL, 'I', 4, A_EntityAttack, &States[S_ENTITY_MISSILE+2]), S_BRIGHT (MNAL, 'E', 4, NULL, &States[S_ENTITY_SEE+10]), #define S_ENTITY_PAIN (S_ENTITY_MISSILE+3) S_BRIGHT (MNAL, 'J', 2, A_Pain, &States[S_ENTITY_SEE+6]), #define S_ENTITY_DIE (S_ENTITY_PAIN+1) - S_BRIGHT (MNAL, 'L', 7, A_212e4, &States[S_ENTITY_DIE+1]), + S_BRIGHT (MNAL, 'L', 7, A_SpectreChunkSmall, &States[S_ENTITY_DIE+1]), S_BRIGHT (MNAL, 'M', 7, A_Scream, &States[S_ENTITY_DIE+2]), - S_BRIGHT (MNAL, 'N', 7, A_212e4, &States[S_ENTITY_DIE+3]), - S_BRIGHT (MNAL, 'O', 7, A_212e4, &States[S_ENTITY_DIE+4]), - S_BRIGHT (MNAL, 'P', 7, A_2134c, &States[S_ENTITY_DIE+5]), - S_BRIGHT (MNAL, 'Q', 64, A_212e4, &States[S_ENTITY_DIE+6]), - S_BRIGHT (MNAL, 'Q', 6, A_20c74, NULL), + S_BRIGHT (MNAL, 'N', 7, A_SpectreChunkSmall, &States[S_ENTITY_DIE+3]), + S_BRIGHT (MNAL, 'O', 7, A_SpectreChunkSmall, &States[S_ENTITY_DIE+4]), + S_BRIGHT (MNAL, 'P', 7, A_SpectreChunkLarge, &States[S_ENTITY_DIE+5]), + S_BRIGHT (MNAL, 'Q', 64, A_SpectreChunkSmall, &States[S_ENTITY_DIE+6]), + S_BRIGHT (MNAL, 'Q', 6, A_SpawnSubEntities, NULL), }; IMPLEMENT_ACTOR (AEntityBoss, Strife, 128, 0) @@ -212,12 +216,12 @@ FState AEntitySecond::States[] = #define S_ENTITY2_MELEE (S_ENTITY2_SEE+6) S_BRIGHT (MNAL, 'S', 4, A_FaceTarget, &States[S_ENTITY2_MELEE+1]), - S_BRIGHT (MNAL, 'R', 4, A_20538, &States[S_ENTITY2_MELEE+2]), + S_BRIGHT (MNAL, 'R', 4, A_SpectreMelee, &States[S_ENTITY2_MELEE+2]), S_BRIGHT (MNAL, 'T', 4, A_SentinelBob, &States[S_ENTITY2_SEE+1]), #define S_ENTITY2_MISSILE (S_ENTITY2_MELEE+3) S_BRIGHT (MNAL, 'W', 4, A_FaceTarget, &States[S_ENTITY2_MISSILE+1]), - S_BRIGHT (MNAL, 'U', 4, A_204d0, &States[S_ENTITY2_MISSILE+2]), + S_BRIGHT (MNAL, 'U', 4, A_Spectre2Attack, &States[S_ENTITY2_MISSILE+2]), S_BRIGHT (MNAL, 'V', 4, A_SentinelBob, &States[S_ENTITY2_SEE+4]), #define S_ENTITY2_PAIN (S_ENTITY2_MISSILE+3) @@ -286,62 +290,31 @@ void A_SubEntityDeath (AActor *self) } } -void A_200e0 (AActor *self) +void A_EntityAttack (AActor *self) { - AActor *bar; - // Apparent Strife bug: Case 5 was unreachable because they used % 5 instead of % 6. // I've fixed that by making case 1 duplicate it, since case 1 did nothing. switch (pr_entity() % 5) { case 0: - if (self->target != NULL) - { - bar = Spawn (self->x, self->y, ONFLOORZ, ALLOW_REPLACE); - bar->threshold = 25; - bar->target = self; - bar->tracer = self->target; - bar->health = -2; - } + A_SpotLightning(self); break; case 2: - if (self->target != NULL) - { - bar = P_SpawnMissile (self, self->target, RUNTIME_CLASS(ASpectralLightningH3)); - if (bar != NULL) - { - bar->health = -2; - } - } + A_Spectre2Attack (self); break; case 3: - A_20334 (self); + A_Spectre3Attack (self); break; case 4: - if (self->target != NULL) - { - bar = P_SpawnMissile (self, self->target, RUNTIME_CLASS(ASpectralLightningBigV2)); - if (bar != NULL) - { - bar->health = -2; - bar->tracer = self->target; - } - } + A_Spectre4Attack (self); break; case 1: case 5: - if (self->target != NULL) - { - bar = P_SpawnMissile (self, self->target, RUNTIME_CLASS(ASpectralLightningBigBall2)); - if (bar != NULL) - { - bar->health = -2; - } - } + A_Spectre5Attack (self); break; } } @@ -358,7 +331,7 @@ void A_SpawnEntity (AActor *self) } } -void A_20c74 (AActor *selfa) +void A_SpawnSubEntities (AActor *selfa) { AEntityBoss *self = static_cast(selfa); AEntitySecond *second; diff --git a/src/g_strife/a_loremaster.cpp b/src/g_strife/a_loremaster.cpp index a1174b842..806d82019 100644 --- a/src/g_strife/a_loremaster.cpp +++ b/src/g_strife/a_loremaster.cpp @@ -11,9 +11,9 @@ static FRandom pr_atk1 ("FooMelee"); void A_SentinelBob (AActor *); void A_SpawnSpectre5 (AActor *); -void A_20538 (AActor *); -void A_20598 (AActor *); -void A_205b0 (AActor *); +void A_SpectreMelee (AActor *); +void A_LoremasterAttack (AActor *); +void A_LoremasterChain (AActor *); // Loremaster (aka Priest) -------------------------------------------------- @@ -42,12 +42,12 @@ FState ALoremaster::States[] = #define S_PRIEST_MELEE (S_PRIEST_RUN+8) S_NORMAL (PRST, 'E', 4, A_FaceTarget, &States[S_PRIEST_MELEE+1]), - S_NORMAL (PRST, 'F', 4, A_20538, &States[S_PRIEST_MELEE+2]), + S_NORMAL (PRST, 'F', 4, A_SpectreMelee, &States[S_PRIEST_MELEE+2]), S_NORMAL (PRST, 'E', 4, A_SentinelBob, &States[S_PRIEST_RUN]), #define S_PRIEST_MISSILE (S_PRIEST_MELEE+3) S_NORMAL (PRST, 'E', 4, A_FaceTarget, &States[S_PRIEST_MISSILE+1]), - S_NORMAL (PRST, 'F', 4, A_20598, &States[S_PRIEST_MISSILE+2]), + S_NORMAL (PRST, 'F', 4, A_LoremasterAttack, &States[S_PRIEST_MISSILE+2]), S_NORMAL (PRST, 'E', 4, A_SentinelBob, &States[S_PRIEST_RUN]), #define S_PRIEST_DIE (S_PRIEST_MISSILE+3) @@ -125,7 +125,7 @@ public: FState ALoreShot::States[] = { - S_NORMAL (OCLW, 'A', 2, A_205b0, &States[0]), + S_NORMAL (OCLW, 'A', 2, A_LoremasterChain, &States[0]), S_NORMAL (CCLW, 'A', 6, NULL, NULL) }; @@ -184,7 +184,7 @@ IMPLEMENT_ACTOR (ALoreShot2, Strife, -1, 0) PROP_SeeSound ("loremaster/active") END_DEFAULTS -void A_20538 (AActor *self) +void A_SpectreMelee (AActor *self) { int damage; @@ -197,7 +197,7 @@ void A_20538 (AActor *self) P_TraceBleed (damage, self->target, self); } -void A_20598 (AActor *self) +void A_LoremasterAttack (AActor *self) { if (self->target != NULL) { @@ -205,7 +205,7 @@ void A_20598 (AActor *self) } } -void A_205b0 (AActor *self) +void A_LoremasterChain (AActor *self) { S_Sound (self, CHAN_BODY, "loremaster/active", 1, ATTN_NORM); Spawn (self->x, self->y, self->z, ALLOW_REPLACE); diff --git a/src/g_strife/a_spectral.cpp b/src/g_strife/a_spectral.cpp index 248d6f1cf..1621fab53 100644 --- a/src/g_strife/a_spectral.cpp +++ b/src/g_strife/a_spectral.cpp @@ -7,11 +7,12 @@ #include "m_random.h" #include "a_strifeglobal.h" -void A_201fc (AActor *); +void A_SpectralLightning (AActor *); void A_AlertMonsters (AActor *); void A_Countdown (AActor *); void A_Tracer2 (AActor *); +AActor *P_SpawnSubMissile (AActor *source, PClass *type, AActor *target); // Container for all spectral lightning deaths ------------------------------ @@ -96,13 +97,13 @@ END_DEFAULTS // Spectral Lightning (Horizontal #1) --------------------------------------- -void A_2046c (AActor *); +void A_SpectralLightningTail (AActor *); FState ASpectralLightningH1::States[] = { S_BRIGHT (ZAP6, 'A', 4, NULL, &States[1]), - S_BRIGHT (ZAP6, 'B', 4, A_2046c, &States[2]), - S_BRIGHT (ZAP6, 'C', 4, A_2046c, &States[0]) + S_BRIGHT (ZAP6, 'B', 4, A_SpectralLightningTail, &States[2]), + S_BRIGHT (ZAP6, 'C', 4, A_SpectralLightningTail, &States[0]) }; IMPLEMENT_ACTOR (ASpectralLightningH1, Strife, -1, 0) @@ -147,7 +148,7 @@ IMPLEMENT_ACTOR (ASpectralLightningHTail, Strife, -1, 0) PROP_RenderStyle (STYLE_Add) END_DEFAULTS -void A_2046c (AActor *self) +void A_SpectralLightningTail (AActor *self) { AActor *foo = Spawn (self->x - self->momx, self->y - self->momy, self->z, ALLOW_REPLACE); @@ -157,15 +158,15 @@ void A_2046c (AActor *self) // Spectral Lightning (Big Ball #1) ----------------------------------------- -void A_20424 (AActor *); +void A_SpectralBigBallLightning (AActor *); FState ASpectralLightningBigBall1::States[] = { - S_BRIGHT (ZAP7, 'A', 4, A_20424, &States[1]), - S_BRIGHT (ZAP7, 'B', 4, A_20424, &States[2]), - S_BRIGHT (ZAP7, 'C', 6, A_20424, &States[3]), - S_BRIGHT (ZAP7, 'D', 6, A_20424, &States[4]), - S_BRIGHT (ZAP7, 'E', 6, A_20424, &States[0]), + S_BRIGHT (ZAP7, 'A', 4, A_SpectralBigBallLightning, &States[1]), + S_BRIGHT (ZAP7, 'B', 4, A_SpectralBigBallLightning, &States[2]), + S_BRIGHT (ZAP7, 'C', 6, A_SpectralBigBallLightning, &States[3]), + S_BRIGHT (ZAP7, 'D', 6, A_SpectralBigBallLightning, &States[4]), + S_BRIGHT (ZAP7, 'E', 6, A_SpectralBigBallLightning, &States[0]), }; IMPLEMENT_ACTOR (ASpectralLightningBigBall1, Strife, -1, 0) @@ -180,6 +181,18 @@ IMPLEMENT_ACTOR (ASpectralLightningBigBall1, Strife, -1, 0) PROP_MaxStepHeight (4) END_DEFAULTS + +void A_SpectralBigBallLightning (AActor *self) +{ + self->angle += ANGLE_90; + P_SpawnSubMissile (self, RUNTIME_CLASS(ASpectralLightningH3), self->target); + self->angle += ANGLE_180; + P_SpawnSubMissile (self, RUNTIME_CLASS(ASpectralLightningH3), self->target); + self->angle += ANGLE_90; + P_SpawnSubMissile (self, RUNTIME_CLASS(ASpectralLightningH3), self->target); +} + + // Spectral Lightning (Big Ball #2 - less damaging) ------------------------- IMPLEMENT_STATELESS_ACTOR (ASpectralLightningBigBall2, Strife, -1, 0) @@ -224,7 +237,7 @@ END_DEFAULTS FState ASpectralLightningSpot::States[] = { S_BRIGHT (ZAP5, 'A', 4, A_Countdown, &States[1]), - S_BRIGHT (ZAP5, 'B', 4, A_201fc, &States[2]), + S_BRIGHT (ZAP5, 'B', 4, A_SpectralLightning, &States[2]), S_BRIGHT (ZAP5, 'C', 4, A_Countdown, &States[3]), S_BRIGHT (ZAP5, 'D', 4, A_Countdown, &States[0]), }; @@ -275,7 +288,7 @@ END_DEFAULTS static FRandom pr_zap5 ("Zap5"); -void A_201fc (AActor *self) +void A_SpectralLightning (AActor *self) { AActor *flash; fixed_t x, y; diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index 07c004454..0b7fbd0e4 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -1408,6 +1408,22 @@ AActor *P_SpawnSubMissile (AActor *source, PClass *type, AActor *target) other->momx = FixedMul (other->Speed, finecosine[source->angle >> ANGLETOFINESHIFT]); other->momy = FixedMul (other->Speed, finesine[source->angle >> ANGLETOFINESHIFT]); + if (other->flags4 & MF4_SPECTRAL) + { + if (source->flags & MF_MISSILE && source->flags4 & MF4_SPECTRAL) + { + other->health = source->health; + } + else if (target->player != NULL) + { + other->health = -1; + } + else + { + other->health = -2; + } + } + if (P_CheckMissileSpawn (other)) { angle_t pitch = P_AimLineAttack (source, source->angle, 1024*FRACUNIT); @@ -2226,7 +2242,6 @@ void A_FireSigil1 (AActor *actor) void A_FireSigil2 (AActor *actor) { - AActor *spot; player_t *player = actor->player; if (player == NULL || player->ReadyWeapon == NULL) @@ -2235,11 +2250,7 @@ void A_FireSigil2 (AActor *actor) P_DamageMobj (actor, actor, NULL, 2*4, 0, DMG_NO_ARMOR); S_Sound (actor, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM); - spot = P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ASpectralLightningH1)); - if (spot != NULL) - { - spot->health = -1; - } + P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ASpectralLightningH1)); } //============================================================================ @@ -2267,7 +2278,6 @@ void A_FireSigil3 (AActor *actor) spot = P_SpawnSubMissile (actor, RUNTIME_CLASS(ASpectralLightningBall1), actor); if (spot != NULL) { - spot->health = -1; spot->z = actor->z + 32*FRACUNIT; } } @@ -2299,7 +2309,6 @@ void A_FireSigil4 (AActor *actor) if (spot != NULL) { spot->tracer = linetarget; - spot->health = -1; } } else @@ -2309,7 +2318,6 @@ void A_FireSigil4 (AActor *actor) { spot->momx += FixedMul (spot->Speed, finecosine[actor->angle >> ANGLETOFINESHIFT]); spot->momy += FixedMul (spot->Speed, finesine[actor->angle >> ANGLETOFINESHIFT]); - spot->health = -1; } } } @@ -2322,7 +2330,6 @@ void A_FireSigil4 (AActor *actor) void A_FireSigil5 (AActor *actor) { - AActor *spot; player_t *player = actor->player; if (player == NULL || player->ReadyWeapon == NULL) @@ -2331,11 +2338,7 @@ void A_FireSigil5 (AActor *actor) P_DamageMobj (actor, actor, NULL, 5*4, 0, DMG_NO_ARMOR); S_Sound (actor, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM); - spot = P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ASpectralLightningBigBall1)); - if (spot != NULL) - { - spot->health = -1; - } + P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ASpectralLightningBigBall1)); } //============================================================================ diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 0b29ce8de..f6142d74f 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -920,12 +920,12 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage { if (player != NULL) { - if (inflictor->health == -1) + if (!deathmatch && inflictor->health == -1) return; } else if (target->flags4 & MF4_SPECTRAL) { - if (inflictor->health == -2) + if (inflictor->health == -2 && !target->IsHostile(inflictor)) return; } } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 6a88e67d3..1d81916d5 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -4773,6 +4773,9 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, MissileActor->momy = FixedMul (vy, speed); MissileActor->momz = FixedMul (vz, speed); + if (MissileActor->flags4 & MF4_SPECTRAL) + MissileActor->health = -1; + if (P_CheckMissileSpawn (MissileActor)) { return MissileActor; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 2546b3070..478eaad55 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -236,10 +236,9 @@ static void DoAttack (AActor *self, bool domelee, bool domissile) const PClass * ti=PClass::FindClass(MissileName); if (ti) { - // Although there is a P_SpawnMissileZ function its - // aiming is much too bad to be of any use + // This seemingly senseless code is needed for proper aiming. self->z+=MissileHeight-32*FRACUNIT; - AActor * missile = P_SpawnMissile (self, self->target, ti); + AActor * missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT, self, self->target, ti, false); self->z-=MissileHeight-32*FRACUNIT; if (missile) @@ -254,6 +253,7 @@ static void DoAttack (AActor *self, bool domelee, bool domissile) { missile->health=-2; } + P_CheckMissileSpawn(missile); } } } @@ -937,10 +937,9 @@ void A_CustomComboAttack (AActor *self) const PClass * ti=PClass::FindClass(MissileName); if (ti) { - // Although there is a P_SpawnMissileZ function its - // aiming is much too bad to be of any use + // This seemingly senseless code is needed for proper aiming. self->z+=SpawnHeight-32*FRACUNIT; - AActor * missile = P_SpawnMissile (self, self->target, ti); + AActor * missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT, self, self->target, ti, false); self->z-=SpawnHeight-32*FRACUNIT; if (missile) @@ -955,6 +954,7 @@ void A_CustomComboAttack (AActor *self) { missile->health=-2; } + P_CheckMissileSpawn(missile); } } } @@ -1095,7 +1095,6 @@ void A_FireCustomMissile (AActor * self) misl->momx = FixedMul (missilespeed, finecosine[an]); misl->momy = FixedMul (missilespeed, finesine[an]); } - if (misl->flags4&MF4_SPECTRAL) misl->health=-1; } } }