From 8299f91cd17f315a4bcdaa2930a679565945e594 Mon Sep 17 00:00:00 2001 From: inkoalawetrust <56005600+inkoalawetrust@users.noreply.github.com> Date: Sat, 22 Feb 2025 15:07:45 +0200 Subject: [PATCH] Exposed more of the Ceiling thinker. - Exposed the rest of the ceiling member fields and getters. - Added an IsCrusher() method. - Added getOldDirection() getter. - Fixed Door direction enum. - Forgot to make Plat readonly on previous commit. --- src/playsim/mapthinkers/a_ceiling.cpp | 25 +++++++++++++++ src/playsim/mapthinkers/a_ceiling.h | 17 +++++----- wadsrc/static/zscript/doombase.zs | 46 ++++++++++++++++++++------- 3 files changed, 68 insertions(+), 20 deletions(-) diff --git a/src/playsim/mapthinkers/a_ceiling.cpp b/src/playsim/mapthinkers/a_ceiling.cpp index 1afdf4509e..c2205fca96 100644 --- a/src/playsim/mapthinkers/a_ceiling.cpp +++ b/src/playsim/mapthinkers/a_ceiling.cpp @@ -72,6 +72,31 @@ void DCeiling::Serialize(FSerializer &arc) .Enum("crushmode", m_CrushMode); } +DEFINE_FIELD(DCeiling, m_Type) +DEFINE_FIELD(DCeiling, m_BottomHeight) +DEFINE_FIELD(DCeiling, m_TopHeight) +DEFINE_FIELD(DCeiling, m_Speed) +DEFINE_FIELD(DCeiling, m_Speed1) +DEFINE_FIELD(DCeiling, m_Speed2) +DEFINE_FIELD(DCeiling, m_Silent) +DEFINE_FIELD(DCeiling, m_CrushMode) + +DEFINE_ACTION_FUNCTION(DCeiling, getCrush) +{ + PARAM_SELF_PROLOGUE(DCeiling); + ACTION_RETURN_INT(self->getCrush()); +} +DEFINE_ACTION_FUNCTION(DCeiling, getDirection) +{ + PARAM_SELF_PROLOGUE(DCeiling); + ACTION_RETURN_INT(self->getDirection()); +} +DEFINE_ACTION_FUNCTION(DCeiling, getOldDirection) +{ + PARAM_SELF_PROLOGUE(DCeiling); + ACTION_RETURN_INT(self->getOldDirection()); +} + //============================================================================ // // diff --git a/src/playsim/mapthinkers/a_ceiling.h b/src/playsim/mapthinkers/a_ceiling.h index 2954fb1185..92b0c22bb0 100644 --- a/src/playsim/mapthinkers/a_ceiling.h +++ b/src/playsim/mapthinkers/a_ceiling.h @@ -47,6 +47,14 @@ public: crushSlowdown = 2 }; + ECeiling m_Type; + double m_BottomHeight; + double m_TopHeight; + double m_Speed; + double m_Speed1; // [RH] dnspeed of crushers + double m_Speed2; // [RH] upspeed of crushers + ECrushMode m_CrushMode; + int m_Silent; void Construct(sector_t *sec); void Construct(sector_t *sec, double speed1, double speed2, int silent); @@ -56,17 +64,10 @@ public: int getCrush() const { return m_Crush; } int getDirection() const { return m_Direction; } + int getOldDirection() const { return m_OldDirection; } protected: - ECeiling m_Type; - double m_BottomHeight; - double m_TopHeight; - double m_Speed; - double m_Speed1; // [RH] dnspeed of crushers - double m_Speed2; // [RH] upspeed of crushers int m_Crush; - ECrushMode m_CrushMode; - int m_Silent; int m_Direction; // 1 = up, 0 = waiting, -1 = down // [RH] Need these for BOOM-ish transferring ceilings diff --git a/wadsrc/static/zscript/doombase.zs b/wadsrc/static/zscript/doombase.zs index c1de2203ba..0f153628ae 100644 --- a/wadsrc/static/zscript/doombase.zs +++ b/wadsrc/static/zscript/doombase.zs @@ -675,16 +675,16 @@ class Plat : MovingFloor native bool IsLift() const { return m_Type == platDownWaitUpStay || m_Type == platDownWaitUpStayStone; } - native double m_Speed; - native double m_Low; - native double m_High; - native int m_Wait; - native int m_Count; - native EPlatState m_Status; + native readonly double m_Speed; + native readonly double m_Low; + native readonly double m_High; + native readonly int m_Wait; + native readonly int m_Count; + native readonly EPlatState m_Status; native readonly EPlatState m_OldStatus; - native int m_Crush; - native int m_Tag; - native EPlatType m_Type; + native readonly int m_Crush; + native readonly int m_Tag; + native readonly EPlatType m_Type; } class MovingCeiling : Mover native @@ -711,9 +711,9 @@ class Door : MovingCeiling native // 1 = up, 0 = waiting at top, -1 = down enum EDirection { - dirUp, + dirDown = -1, dirWait, - dirDown + dirUp, } native readonly int m_Direction; @@ -813,7 +813,29 @@ class Ceiling : MovingCeiling native crushHexen = 1, crushSlowdown = 2 } - + + // 1 = up, 0 = waiting, -1 = down + enum EDirection + { + dirDown = -1, + dirWait, + dirUp, + } + + native readonly ECeiling m_Type; + native readonly double m_BottomHeight; + native readonly double m_TopHeight; + native readonly double m_Speed; + native readonly double m_Speed1; // [RH] dnspeed of crushers + native readonly double m_Speed2; // [RH] upspeed of crushers + native readonly ECrushMode m_CrushMode; + native readonly int m_Silent; + + bool IsCrusher() const { return m_Type == ceilCrushAndRaise || m_Type == ceilLowerAndCrush || m_Type == ceilCrushRaiseAndStay; } + native int getCrush() const; + native int getDirection() const; + native int getOldDirection() const; + deprecated("3.8", "Use Level.CreateCeiling() instead") static bool CreateCeiling(sector sec, int type, line ln, double speed, double speed2, double height = 0, int crush = -1, int silent = 0, int change = 0, int crushmode = crushDoom) { return level.CreateCeiling(sec, type, ln, speed, speed2, height, crush, silent, change, crushmode);