From ca6a2152b94b2e272eea3bc056dcfd7650481bf4 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Tue, 23 Aug 2022 12:06:32 -0400 Subject: [PATCH] - add freezetics actor property --- src/playsim/actor.h | 2 ++ src/playsim/actorinlines.h | 2 ++ src/playsim/p_mobj.cpp | 8 +++++++- src/scripting/vmthunks_actors.cpp | 1 + wadsrc/static/zscript/actors/actor.zs | 1 + 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/playsim/actor.h b/src/playsim/actor.h index bcd08b9c11..7502078ec1 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -1200,6 +1200,8 @@ public: sector_t *BlockingCeiling; // Sector that blocked the last move (ceiling plane slope) sector_t *BlockingFloor; // Sector that blocked the last move (floor plane slope) + uint32_t freezetics; // actor has actions completely frozen (including movement) for this many tics, but they still get Tick() calls + int PoisonDamage; // Damage received per tic from poison. FName PoisonDamageType; // Damage type dealt by poison. int PoisonDuration; // Duration left for receiving poison damage. diff --git a/src/playsim/actorinlines.h b/src/playsim/actorinlines.h index ec1807269b..3fb3676a16 100644 --- a/src/playsim/actorinlines.h +++ b/src/playsim/actorinlines.h @@ -159,6 +159,8 @@ inline DVector3 AActor::Vec3Angle(double length, DAngle angle, double dz, bool a inline bool AActor::isFrozen() const { + if (freezetics > 0) + return true; if (!(flags5 & MF5_NOTIMEFREEZE)) { auto state = Level->isFrozen(); diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index e1fb71a7f7..b328296969 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -332,6 +332,7 @@ void AActor::Serialize(FSerializer &arc) A("damagemultiply", DamageMultiply) A("waveindexxy", WeaveIndexXY) A("weaveindexz", WeaveIndexZ) + A("freezetics", freezetics) A("pdmgreceived", PoisonDamageReceived) A("pdurreceived", PoisonDurationReceived) A("ppreceived", PoisonPeriodReceived) @@ -3374,7 +3375,7 @@ bool AActor::IsOkayToAttack (AActor *link) if (P_CheckSight (this, link)) { // AMageStaffFX2::IsOkayToAttack had an extra check here, generalized with a flag, - // to only allow the check to succeed if the enemy was in a ~84� FOV of the player + // to only allow the check to succeed if the enemy was in a ~84 FOV of the player if (flags3 & MF3_SCREENSEEKER) { DAngle angle = absangle(Friend->AngleTo(link), Friend->Angles.Yaw); @@ -3633,6 +3634,11 @@ void AActor::Tick () static const uint8_t HereticScrollDirs[4] = { 6, 9, 1, 4 }; static const uint8_t HereticSpeedMuls[5] = { 5, 10, 25, 30, 35 }; + if (freezetics > 0) + { + freezetics--; + return; + } AActor *onmo; diff --git a/src/scripting/vmthunks_actors.cpp b/src/scripting/vmthunks_actors.cpp index db2a6535ea..3bdcfe3ad0 100644 --- a/src/scripting/vmthunks_actors.cpp +++ b/src/scripting/vmthunks_actors.cpp @@ -1969,6 +1969,7 @@ DEFINE_FIELD(AActor, BlockingLine) DEFINE_FIELD(AActor, Blocking3DFloor) DEFINE_FIELD(AActor, BlockingCeiling) DEFINE_FIELD(AActor, BlockingFloor) +DEFINE_FIELD(AActor, freezetics) DEFINE_FIELD(AActor, PoisonDamage) DEFINE_FIELD(AActor, PoisonDamageType) DEFINE_FIELD(AActor, PoisonDuration) diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index f1be78e48d..46cbfa75fd 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -258,6 +258,7 @@ class Actor : Thinker native native int16 lightlevel; native readonly int SpawnTime; private native int InventoryID; // internal counter. + native uint freezetics; meta String Obituary; // Player was killed by this actor meta String HitObituary; // Player was killed by this actor in melee