From 7325e3f0f89a0d2431171fd9381d028f38a256e4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 23 Nov 2016 17:34:36 +0100 Subject: [PATCH] - exported all member fields that make sense. Entirely private ones or classes that are not supposed to be extended were left out. --- src/g_shared/a_artifacts.cpp | 46 +++++++--------------- src/g_shared/a_artifacts.h | 7 ++-- src/g_shared/a_keys.cpp | 2 + src/g_shared/a_pickups.cpp | 2 + src/g_shared/a_puzzleitems.cpp | 2 + src/g_shared/a_weaponpiece.cpp | 3 ++ src/g_shared/a_weapons.cpp | 2 + src/p_states.cpp | 14 +++---- wadsrc/static/zscript/shared/inventory.txt | 40 ++++++++++++++++++- 9 files changed, 75 insertions(+), 43 deletions(-) diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index 7cf05613a..66832c21c 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -56,6 +56,13 @@ void PClassPowerupGiver::ReplaceClassRef(PClass *oldclass, PClass *newclass) } } + +DEFINE_FIELD(APowerupGiver, PowerupType) +DEFINE_FIELD(APowerupGiver, EffectTics) +DEFINE_FIELD(APowerupGiver, BlendColor) +DEFINE_FIELD(APowerupGiver, Mode) +DEFINE_FIELD(APowerupGiver, Strength) + //=========================================================================== // // APowerupGiver :: Use @@ -114,6 +121,11 @@ void APowerupGiver::Serialize(FSerializer &arc) // Powerup ------------------------------------------------------------------- +DEFINE_FIELD(APowerup, EffectTics) +DEFINE_FIELD(APowerup, BlendColor) +DEFINE_FIELD(APowerup, Mode) +DEFINE_FIELD(APowerup, Strength) + //=========================================================================== // // APowerup :: Tick @@ -1184,40 +1196,12 @@ void APowerWeaponLevel2::EndEffect () } } -// Player Speed Trail (used by the Speed Powerup) ---------------------------- - -class APlayerSpeedTrail : public AActor -{ - DECLARE_CLASS (APlayerSpeedTrail, AActor) -public: - void Tick (); -}; - -IMPLEMENT_CLASS(APlayerSpeedTrail, false, false, false, false) - -//=========================================================================== -// -// APlayerSpeedTrail :: Tick -// -//=========================================================================== - -void APlayerSpeedTrail::Tick () -{ - const double fade = .6 / 8; - if (Alpha <= fade) - { - Destroy (); - } - else - { - Alpha -= fade; - } -} - // Speed Powerup ------------------------------------------------------------- IMPLEMENT_CLASS(APowerSpeed, false, false, false, false) +DEFINE_FIELD(APowerSpeed, SpeedFlags) + //=========================================================================== // // APowerSpeed :: Serialize @@ -1280,7 +1264,7 @@ void APowerSpeed::DoEffect () if (Owner->Vel.LengthSquared() <= 12*12) return; - AActor *speedMo = Spawn (Owner->Pos(), NO_REPLACE); + AActor *speedMo = Spawn("PlayerSpeedTrail", Owner->Pos(), NO_REPLACE); if (speedMo) { speedMo->Angles.Yaw = Owner->Angles.Yaw; diff --git a/src/g_shared/a_artifacts.h b/src/g_shared/a_artifacts.h index 85ebc2e81..163094d32 100644 --- a/src/g_shared/a_artifacts.h +++ b/src/g_shared/a_artifacts.h @@ -143,6 +143,7 @@ protected: void Tick (); void EndEffect (); +private: bool HitCenterFrame; }; @@ -281,15 +282,15 @@ public: virtual void Serialize(FSerializer &arc); void SetNoCallUndoMorph() { bNoCallUndoMorph = true; } + // Variables FNameNoInit PlayerClass, MorphFlash, UnMorphFlash; int MorphStyle; + player_t *Player; + bool bNoCallUndoMorph; // Because P_UndoPlayerMorph() can call EndEffect recursively protected: void InitEffect (); void EndEffect (); - // Variables - player_t *Player; - bool bNoCallUndoMorph; // Because P_UndoPlayerMorph() can call EndEffect recursively }; #endif //__A_ARTIFACTS_H__ diff --git a/src/g_shared/a_keys.cpp b/src/g_shared/a_keys.cpp index 69fbe48af..538e26090 100644 --- a/src/g_shared/a_keys.cpp +++ b/src/g_shared/a_keys.cpp @@ -472,6 +472,8 @@ bool P_CheckKeys (AActor *owner, int keynum, bool remote) IMPLEMENT_CLASS(AKey, false, false, false, false) +DEFINE_FIELD(AKey, KeyNumber) + bool AKey::HandlePickup (AInventory *item) { // In single player, you can pick up an infinite number of keys diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index ce8f53d61..c6475cc74 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -1801,6 +1801,8 @@ bool AHealth::TryPickup (AActor *&other) IMPLEMENT_CLASS(AHealthPickup, false, false, false, false) +DEFINE_FIELD(AHealthPickup, autousemode) + //=========================================================================== // // AHealthPickup :: CreateCopy diff --git a/src/g_shared/a_puzzleitems.cpp b/src/g_shared/a_puzzleitems.cpp index d243dc73c..640d5517d 100644 --- a/src/g_shared/a_puzzleitems.cpp +++ b/src/g_shared/a_puzzleitems.cpp @@ -19,6 +19,8 @@ void PClassPuzzleItem::DeriveData(PClass *newclass) IMPLEMENT_CLASS(APuzzleItem, false, false, false, false) +DEFINE_FIELD(APuzzleItem, PuzzleItemNumber) + bool APuzzleItem::HandlePickup (AInventory *item) { // Can't carry more than 1 of each puzzle item in coop netplay diff --git a/src/g_shared/a_weaponpiece.cpp b/src/g_shared/a_weaponpiece.cpp index 7aa9591e9..9edae6906 100644 --- a/src/g_shared/a_weaponpiece.cpp +++ b/src/g_shared/a_weaponpiece.cpp @@ -6,6 +6,9 @@ IMPLEMENT_CLASS(PClassWeaponPiece, false, false, false, false) IMPLEMENT_CLASS(AWeaponHolder, false, false, false, false) +DEFINE_FIELD(AWeaponHolder, PieceMask); +DEFINE_FIELD(AWeaponHolder, PieceWeapon); + void PClassWeaponPiece::ReplaceClassRef(PClass *oldclass, PClass *newclass) { Super::ReplaceClassRef(oldclass, newclass); diff --git a/src/g_shared/a_weapons.cpp b/src/g_shared/a_weapons.cpp index 5f221c5bc..530f8e364 100644 --- a/src/g_shared/a_weapons.cpp +++ b/src/g_shared/a_weapons.cpp @@ -868,6 +868,8 @@ FState *AWeapon::GetStateForButtonName (FName button) IMPLEMENT_CLASS(AWeaponGiver, false, false, false, false) +DEFINE_FIELD(AWeaponGiver, DropAmmoFactor); + void AWeaponGiver::Serialize(FSerializer &arc) { Super::Serialize(arc); diff --git a/src/p_states.cpp b/src/p_states.cpp index b3e9593af..f141cb550 100644 --- a/src/p_states.cpp +++ b/src/p_states.cpp @@ -1071,10 +1071,10 @@ DEFINE_FIELD(FState, Frame) DEFINE_FIELD(FState, UseFlags) DEFINE_FIELD(FState, Misc1) DEFINE_FIELD(FState, Misc2) -DEFINE_FIELD_BIT(FState, StateFlags, bSlow) -DEFINE_FIELD_BIT(FState, StateFlags, bFast) -DEFINE_FIELD_BIT(FState, StateFlags, bFullbright) -DEFINE_FIELD_BIT(FState, StateFlags, bNoDelay) -DEFINE_FIELD_BIT(FState, StateFlags, bSameFrame) -DEFINE_FIELD_BIT(FState, StateFlags, bCanRaise) -DEFINE_FIELD_BIT(FState, StateFlags, bDehacked) +DEFINE_FIELD_BIT(FState, StateFlags, bSlow, STF_SLOW) +DEFINE_FIELD_BIT(FState, StateFlags, bFast, STF_FAST) +DEFINE_FIELD_BIT(FState, StateFlags, bFullbright, STF_FULLBRIGHT) +DEFINE_FIELD_BIT(FState, StateFlags, bNoDelay, STF_NODELAY) +DEFINE_FIELD_BIT(FState, StateFlags, bSameFrame, STF_SAMEFRAME) +DEFINE_FIELD_BIT(FState, StateFlags, bCanRaise, STF_CANRAISE) +DEFINE_FIELD_BIT(FState, StateFlags, bDehacked, STF_DEHACKED) diff --git a/wadsrc/static/zscript/shared/inventory.txt b/wadsrc/static/zscript/shared/inventory.txt index 47f753ca1..048590b39 100644 --- a/wadsrc/static/zscript/shared/inventory.txt +++ b/wadsrc/static/zscript/shared/inventory.txt @@ -204,6 +204,8 @@ class Health : Inventory native class HealthPickup : Inventory native { + native int autousemode; + Default { Inventory.DefMaxAmount; @@ -213,6 +215,8 @@ class HealthPickup : Inventory native class Key : Inventory native { + native uint8 KeyNumber; + Default { +DONTGIB; // Don't disappear due to a crusher @@ -223,6 +227,13 @@ class Key : Inventory native class PowerupGiver : Inventory native { + + native Class PowerupType; + native int EffectTics; // Non-0 to override the powerup's default tics + native color BlendColor; // Non-0 to override the powerup's default blend + native Name Mode; // Meaning depends on powerup - used for Invulnerability and Invisibility + native double Strength; // Meaning depends on powerup - currently used only by Invisibility + Default { Inventory.DefMaxAmount; @@ -232,7 +243,13 @@ class PowerupGiver : Inventory native } } -class Powerup : Inventory native {} +class Powerup : Inventory native +{ + native int EffectTics; + native color BlendColor; + native Name Mode; // Meaning depends on powerup - used for Invulnerability and Invisibility + native double Strength; // Meaning depends on powerup - currently used only by Invisibility +} class PowerInvulnerable : Powerup native { @@ -337,6 +354,8 @@ class PowerWeaponLevel2 : Powerup native class PowerSpeed : Powerup native { + native int SpeedFlags; + Default { Powerup.Duration -45; @@ -348,7 +367,7 @@ class PowerSpeed : Powerup native // Player Speed Trail (used by the Speed Powerup) ---------------------------- -class PlayerSpeedTrail native +class PlayerSpeedTrail : Actor { Default { @@ -357,6 +376,15 @@ class PlayerSpeedTrail native Alpha 0.6; RenderStyle "Translucent"; } + + override void Tick() + { + Alpha -= .6 / 8; + if (Alpha <= 0) + { + Destroy (); + } + } } class PowerMinotaur : Powerup native @@ -477,6 +505,8 @@ class MapRevealer : Inventory native {} class PuzzleItem : Inventory native { + native int PuzzleItemNumber; + Default { +NOGRAVITY @@ -549,6 +579,9 @@ class Weapon : StateProvider native class WeaponGiver : Weapon native { + + native double DropAmmoFactor; + Default { Weapon.AmmoGive1 -1; @@ -558,6 +591,9 @@ class WeaponGiver : Weapon native class WeaponHolder : Inventory native { + native int PieceMask; + native Class PieceWeapon; + Default { +NOBLOCKMAP