Skip to content

Commit

Permalink
- add freezetics actor property
Browse files Browse the repository at this point in the history
  • Loading branch information
madame-rachelle committed Sep 3, 2022
1 parent 06ee21c commit ca6a215
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/playsim/actor.h
Expand Up @@ -1200,6 +1200,8 @@ class AActor : public DThinker
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.
Expand Down
2 changes: 2 additions & 0 deletions src/playsim/actorinlines.h
Expand Up @@ -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();
Expand Down
8 changes: 7 additions & 1 deletion src/playsim/p_mobj.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions src/scripting/vmthunks_actors.cpp
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/zscript/actors/actor.zs
Expand Up @@ -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
Expand Down

0 comments on commit ca6a215

Please sign in to comment.