diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 911fce1ed2..21637c59b8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -871,7 +871,6 @@ set( NOT_COMPILED_SOURCE_FILES g_strife/a_reaver.cpp g_strife/a_rebels.cpp g_strife/a_sentinel.cpp - g_strife/a_spectral.cpp g_strife/a_stalker.cpp g_strife/a_strifeitems.cpp g_strife/a_strifeweapons.cpp diff --git a/src/actor.h b/src/actor.h index 578b094ed6..06a5e9f118 100644 --- a/src/actor.h +++ b/src/actor.h @@ -674,6 +674,7 @@ public: // Something just touched this actor. virtual void Touch (AActor *toucher); + void CallTouch(AActor *toucher); // Adds the item to this actor's inventory and sets its Owner. virtual void AddInventory (AInventory *item); diff --git a/src/g_strife/a_entityboss.cpp b/src/g_strife/a_entityboss.cpp index 5350229015..7a6b6f0277 100644 --- a/src/g_strife/a_entityboss.cpp +++ b/src/g_strife/a_entityboss.cpp @@ -36,7 +36,6 @@ void A_SpectralMissile (AActor *self, const char *missilename) } } -DECLARE_ACTION(A_SpotLightning) DECLARE_ACTION(A_Spectre3Attack) @@ -49,7 +48,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_EntityAttack) switch (pr_entity() % 5) { case 0: - CALL_ACTION(A_SpotLightning, self); + //CALL_ACTION(A_SpotLightning, self); break; case 2: @@ -57,7 +56,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_EntityAttack) break; case 3: - CALL_ACTION(A_Spectre3Attack, self); + //CALL_ACTION(A_Spectre3Attack, self); break; case 4: diff --git a/src/g_strife/a_programmer.cpp b/src/g_strife/a_programmer.cpp index 07f6a6c4ca..a02848dd2b 100644 --- a/src/g_strife/a_programmer.cpp +++ b/src/g_strife/a_programmer.cpp @@ -94,32 +94,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_ProgrammerMelee) return 0; } -//============================================================================ -// -// A_SpotLightning -// -//============================================================================ - -DEFINE_ACTION_FUNCTION(AActor, A_SpotLightning) -{ - PARAM_SELF_PROLOGUE(AActor); - - AActor *spot; - - if (self->target == NULL) - return 0; - - spot = Spawn("SpectralLightningSpot", self->target->PosAtZ(self->target->floorz), ALLOW_REPLACE); - if (spot != NULL) - { - spot->threshold = 25; - spot->target = self; - spot->FriendPlayer = 0; - spot->tracer = self->target; - } - return 0; -} - //============================================================================ // // A_SpawnProgrammerBase diff --git a/src/g_strife/a_spectral.cpp b/src/g_strife/a_spectral.cpp deleted file mode 100644 index 4bd24bac7d..0000000000 --- a/src/g_strife/a_spectral.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* -#include "actor.h" -#include "m_random.h" -#include "a_action.h" -#include "p_local.h" -#include "s_sound.h" -#include "m_random.h" -#include "a_strifeglobal.h" -#include "vm.h" -*/ - -class ASpectralMonster : public AActor -{ - DECLARE_CLASS (ASpectralMonster, AActor) -public: - void Touch (AActor *toucher); -}; - -IMPLEMENT_CLASS(ASpectralMonster, false, false) - -void ASpectralMonster::Touch (AActor *toucher) -{ - P_DamageMobj (toucher, this, this, 5, NAME_Melee); -} - - -DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightningTail) -{ - PARAM_SELF_PROLOGUE(AActor); - - AActor *foo = Spawn("SpectralLightningHTail", self->Vec3Offset(-self->Vel.X, -self->Vel.Y, 0.), ALLOW_REPLACE); - - foo->Angles.Yaw = self->Angles.Yaw; - foo->FriendPlayer = self->FriendPlayer; - return 0; -} - -DEFINE_ACTION_FUNCTION(AActor, A_SpectralBigBallLightning) -{ - PARAM_SELF_PROLOGUE(AActor); - - PClassActor *cls = PClass::FindActor("SpectralLightningH3"); - if (cls) - { - self->Angles.Yaw += 90.; - P_SpawnSubMissile (self, cls, self->target); - self->Angles.Yaw += 180.; - P_SpawnSubMissile (self, cls, self->target); - self->Angles.Yaw -= 270.; - P_SpawnSubMissile (self, cls, self->target); - } - return 0; -} - -static FRandom pr_zap5 ("Zap5"); - -DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightning) -{ - PARAM_SELF_PROLOGUE(AActor); - - AActor *flash; - - if (self->threshold != 0) - --self->threshold; - - self->Vel.X += pr_zap5.Random2(3); - self->Vel.Y += pr_zap5.Random2(3); - - double xo = pr_zap5.Random2(3) * 50.; - double yo = pr_zap5.Random2(3) * 50.; - - flash = Spawn (self->threshold > 25 ? PClass::FindActor(NAME_SpectralLightningV2) : - PClass::FindActor(NAME_SpectralLightningV1), self->Vec2OffsetZ(xo, yo, ONCEILINGZ), ALLOW_REPLACE); - - flash->target = self->target; - flash->Vel.Z = -18; - flash->FriendPlayer = self->FriendPlayer; - - flash = Spawn(NAME_SpectralLightningV2, self->PosAtZ(ONCEILINGZ), ALLOW_REPLACE); - - flash->target = self->target; - flash->Vel.Z = -18; - flash->FriendPlayer = self->FriendPlayer; - return 0; -} - -// In Strife, this number is stored in the data segment, but it doesn't seem to be -// altered anywhere. -#define TRACEANGLE (19.6875) - -DEFINE_ACTION_FUNCTION(AActor, A_Tracer2) -{ - PARAM_SELF_PROLOGUE(AActor); - - AActor *dest; - double dist; - double slope; - - dest = self->tracer; - - if (!dest || dest->health <= 0 || self->Speed == 0 || !self->CanSeek(dest)) - return 0; - - DAngle exact = self->AngleTo(dest); - DAngle diff = deltaangle(self->Angles.Yaw, exact); - - if (diff < 0) - { - self->Angles.Yaw -= TRACEANGLE; - if (deltaangle(self->Angles.Yaw, exact) > 0) - self->Angles.Yaw = exact; - } - else if (diff > 0) - { - self->Angles.Yaw += TRACEANGLE; - if (deltaangle(self->Angles.Yaw, exact) < 0.) - self->Angles.Yaw = exact; - } - - self->VelFromAngle(); - - if (!(self->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))) - { - // change slope - dist = self->DistanceBySpeed (dest, self->Speed); - if (dest->Height >= 56) - { - slope = (dest->Z()+40 - self->Z()) / dist; - } - else - { - slope = (dest->Z() + self->Height*(2./3) - self->Z()) / dist; - } - if (slope < self->Vel.Z) - { - self->Vel.Z -= 1 / 8.; - } - else - { - self->Vel.Z += 1 / 8.; - } - } - return 0; -} diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index bf1379d3a3..ad6afce608 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -24,7 +24,6 @@ #include "vm.h" // Include all the other Strife stuff here to reduce compile time -#include "a_spectral.cpp" #include "a_coin.cpp" #include "a_crusader.cpp" #include "a_entityboss.cpp" diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 3c3347ec1a..41994c38e7 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -105,8 +105,7 @@ void P_TouchSpecialThing (AActor *special, AActor *toucher) toucher->player->Bot->prev = toucher->player->Bot->dest; toucher->player->Bot->dest = NULL; } - - special->Touch (toucher); + special->CallTouch (toucher); } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index a52ee49769..6f0754a8fa 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1440,6 +1440,25 @@ void AActor::Touch (AActor *toucher) { } +DEFINE_ACTION_FUNCTION(AActor, Touch) +{ + PARAM_SELF_PROLOGUE(AActor); + PARAM_OBJECT(toucher, AActor); + self->Touch(toucher); + return 0; +} + +void AActor::CallTouch(AActor *toucher) +{ + IFVIRTUAL(AActor, Touch) + { + VMValue params[2] = { (DObject*)this, toucher }; + VMFrameStack stack; + stack.Call(func, params, 2, nullptr, 0, nullptr); + } + else Touch(toucher); +} + //============================================================================ // // AActor :: Grind diff --git a/src/p_user.cpp b/src/p_user.cpp index 5f2d19cb4d..1033299e63 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -498,10 +498,13 @@ void player_t::SetLogText (const char *text) { LogText = text; - // Print log text to console - AddToConsole(-1, TEXTCOLOR_GOLD); - AddToConsole(-1, LogText); - AddToConsole(-1, "\n"); + if (mo->CheckLocalView(consoleplayer)) + { + // Print log text to console + AddToConsole(-1, TEXTCOLOR_GOLD); + AddToConsole(-1, LogText); + AddToConsole(-1, "\n"); + } } DEFINE_ACTION_FUNCTION(_PlayerInfo, SetLogText) diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index dd1bec839c..cdcc630b5e 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -268,6 +268,7 @@ class Actor : Thinker native virtual native bool Slam(Actor victim); virtual native bool UseInventory(Inventory item); virtual native bool SpecialBlastHandling (Actor source, double strength); + virtual native void Touch(Actor toucher); virtual int SpecialMissileHit (Actor victim) // for this no native version exists { @@ -617,7 +618,6 @@ class Actor : Thinker native native void A_TossGib(); native void A_SentinelBob(); native void A_SentinelRefire(); - native void A_Tracer2(); native void A_SetShadow(); native void A_ClearShadow(); native void A_GetHurt(); diff --git a/wadsrc/static/zscript/doom/revenant.txt b/wadsrc/static/zscript/doom/revenant.txt index 2fc35c60f2..2fa335a2df 100644 --- a/wadsrc/static/zscript/doom/revenant.txt +++ b/wadsrc/static/zscript/doom/revenant.txt @@ -129,8 +129,6 @@ class RevenantTracerSmoke : Actor extend class Actor { - const TRACEANGLE = (16.875); - void A_SkelMissile() { if (target == null) return; @@ -166,33 +164,12 @@ extend class Actor } } - void A_Tracer() + void A_Tracer2(double traceang = 19.6875) { double dist; double slope; Actor dest; - Actor smoke; - // killough 1/18/98: this is why some missiles do not have smoke - // and some do. Also, internal demos start at random gametics, thus - // the bug in which revenants cause internal demos to go out of sync. - // - // killough 3/6/98: fix revenant internal demo bug by subtracting - // levelstarttic from gametic: - // - // [RH] level.time is always 0-based, so nothing special to do here. - - if (level.time & 3) return; - - // spawn a puff of smoke behind the rocket - SpawnPuff ("BulletPuff", pos, angle, angle, 3); - smoke = Spawn ("RevenantTracerSmoke", Vec3Offset(-Vel.X, -Vel.Y, 0.), ALLOW_REPLACE); - - smoke.Vel.Z = 1.; - smoke.tics -= random[Tracer](0, 3); - if (smoke.tics < 1) - smoke.tics = 1; - // adjust direction dest = tracer; @@ -205,13 +182,13 @@ extend class Actor if (diff < 0) { - angle -= TRACEANGLE; + angle -= traceang; if (deltaangle(angle, exact) > 0) angle = exact; } else if (diff > 0) { - angle += TRACEANGLE; + angle += traceang; if (deltaangle(angle, exact) < 0.) angle = exact; } @@ -238,5 +215,31 @@ extend class Actor Vel.Z += 1. / 8; } } + + void A_Tracer() + { + // killough 1/18/98: this is why some missiles do not have smoke + // and some do. Also, internal demos start at random gametics, thus + // the bug in which revenants cause internal demos to go out of sync. + // + // killough 3/6/98: fix revenant internal demo bug by subtracting + // levelstarttic from gametic: + // + // [RH] level.time is always 0-based, so nothing special to do here. + + if (level.time & 3) return; + + // spawn a puff of smoke behind the rocket + SpawnPuff ("BulletPuff", pos, angle, angle, 3); + Actor smoke = Spawn ("RevenantTracerSmoke", Vec3Offset(-Vel.X, -Vel.Y, 0.), ALLOW_REPLACE); + + smoke.Vel.Z = 1.; + smoke.tics -= random[Tracer](0, 3); + if (smoke.tics < 1) + smoke.tics = 1; + + // The rest of this function was identical with Strife's version, except for the angle being used. + A_Tracer2(16.875); + } } diff --git a/wadsrc/static/zscript/strife/programmer.txt b/wadsrc/static/zscript/strife/programmer.txt index dc88a790f4..9ef9bdeb02 100644 --- a/wadsrc/static/zscript/strife/programmer.txt +++ b/wadsrc/static/zscript/strife/programmer.txt @@ -36,7 +36,6 @@ class Programmer : Actor native void A_ProgrammerMelee (); native void A_SpawnProgrammerBase (); native void A_ProgrammerDeath (); - native void A_SpotLightning(); States { @@ -80,6 +79,27 @@ class Programmer : Actor PRGR X -1 Bright A_ProgrammerDeath; Stop; } + + //============================================================================ + // + // A_SpotLightning + // + //============================================================================ + + void A_SpotLightning() + { + if (target == NULL) return; + + Actor spot = Spawn("SpectralLightningSpot", (target.pos.xy, target.floorz), ALLOW_REPLACE); + if (spot != NULL) + { + spot.threshold = 25; + spot.target = self; + spot.FriendPlayer = 0; + spot.tracer = target; + } + } + } diff --git a/wadsrc/static/zscript/strife/spectral.txt b/wadsrc/static/zscript/strife/spectral.txt index 9ea95ba1d5..0878cff948 100644 --- a/wadsrc/static/zscript/strife/spectral.txt +++ b/wadsrc/static/zscript/strife/spectral.txt @@ -2,7 +2,7 @@ // base for all spectral monsters which hurt when being touched-------------- -class SpectralMonster : Actor native +class SpectralMonster : Actor { Default { @@ -11,6 +11,12 @@ class SpectralMonster : Actor native +SPECTRAL +NOICEDEATH } + + override void Touch (Actor toucher) + { + toucher.DamageMobj (self, self, 5, 'Melee'); + } + //============================================================================ @@ -71,7 +77,26 @@ class SpectralMonster : Actor native Angle -= 90.; } - native void A_SpotLightning (); + //============================================================================ + // + // A_SpotLightning + // + //============================================================================ + + void A_SpotLightning() + { + if (target == null) return; + + Actor spot = Spawn("SpectralLightningSpot", (target.pos.xy, target.floorz), ALLOW_REPLACE); + if (spot != null) + { + spot.threshold = 25; + spot.target = self; + spot.FriendPlayer = 0; + spot.tracer = target; + } + } + } @@ -180,7 +205,6 @@ class SpectralLightningH1 : SpectralLightningBase +SPECTRAL } - native void A_SpectralLightningTail (); States { @@ -189,6 +213,14 @@ class SpectralLightningH1 : SpectralLightningBase ZAP6 BC 4 Bright A_SpectralLightningTail; Loop; } + + void A_SpectralLightningTail () + { + Actor foo = Spawn("SpectralLightningHTail", Vec3Offset(-Vel.X, -Vel.Y, 0.), ALLOW_REPLACE); + + foo.Angle = Angle; + foo.FriendPlayer = FriendPlayer; + } } @@ -245,8 +277,6 @@ class SpectralLightningBigBall1 : SpectralLightningDeath2 +SPECTRAL } - native void A_SpectralBigBallLightning (); - States { Spawn: @@ -254,6 +284,21 @@ class SpectralLightningBigBall1 : SpectralLightningDeath2 ZAP7 CDE 6 Bright A_SpectralBigBallLightning; Loop; } + + void A_SpectralBigBallLightning () + { + Class cls = "SpectralLightningH3"; + if (cls) + { + angle += 90.; + SpawnSubMissile (cls, target); + angle += 180.; + SpawnSubMissile (cls, target); + angle -= 270.; + SpawnSubMissile (cls, target); + } + } + } @@ -315,8 +360,6 @@ class SpectralLightningSpot : SpectralLightningDeath1 Alpha 0.6; } - native void A_SpectralLightning (); - States { Spawn: @@ -325,6 +368,35 @@ class SpectralLightningSpot : SpectralLightningDeath1 ZAP5 CD 4 Bright A_Countdown; Loop; } + + void A_SpectralLightning () + { + if (threshold != 0) + --threshold; + + Vel.X += random2[Zap5](3); + Vel.Y += random2[Zap5](3); + + double xo = random2[Zap5](3) * 50.; + double yo = random2[Zap5](3) * 50.; + + class cls; + if (threshold > 25) cls = "SpectralLightningV2"; + else cls = "SpectralLightningV1"; + + Actor flash = Spawn (cls, Vec2OffsetZ(xo, yo, ONCEILINGZ), ALLOW_REPLACE); + + flash.target = target; + flash.Vel.Z = -18; + flash.FriendPlayer = FriendPlayer; + + flash = Spawn("SpectralLightningV2", (pos.xy, ONCEILINGZ), ALLOW_REPLACE); + + flash.target = target; + flash.Vel.Z = -18; + flash.FriendPlayer = FriendPlayer; + } + } // Sigil Lightning (Big Vertical #1) ---------------------------------------- @@ -357,7 +429,3 @@ class SpectralLightningBigV2 : SpectralLightningBigV1 Damage 60; } } - - - -