From da735c0e8727fd7be3d9015f1e3eda5836cccaa4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 3 Jan 2019 08:27:41 +0100 Subject: [PATCH] - initialize the PlayerPawn members only used by scripts through the script variable interface. The goal here is to eliminate the native PlayerPawn class, after all, so this will be needed anyway. --- src/d_player.h | 2 +- src/namedef.h | 4 ++++ src/scripting/thingdef_properties.cpp | 11 ++++++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 978c70bc4..2b67ead99 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -146,13 +146,13 @@ public: FName Face; // Doom status bar face (when used) FName Portrait; FName Slot[10]; - double HexenArmor[5]; // Everything below this point is only used by scripted code. int RunHealth; TObjPtr InvFirst; // first inventory item displayed on inventory bar double ForwardMove1, ForwardMove2; double SideMove1, SideMove2; + double HexenArmor[5]; PClassActor *FlechetteType; }; diff --git a/src/namedef.h b/src/namedef.h index d1d064a6a..4eb36e30c 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -1032,6 +1032,10 @@ xx(PickupSound) xx(ColorRangeStart) xx(ColorRangeEnd) xx(InvFirst) +xx(ForwardMove1) +xx(ForwardMove2) +xx(SideMove1) +xx(SideMove2) xx(BlueCard) xx(YellowCard) diff --git a/src/scripting/thingdef_properties.cpp b/src/scripting/thingdef_properties.cpp index a709b8e31..05f3c61a9 100644 --- a/src/scripting/thingdef_properties.cpp +++ b/src/scripting/thingdef_properties.cpp @@ -1541,11 +1541,11 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, spawnclass, L, PlayerPawn) DEFINE_CLASS_PROPERTY_PREFIX(player, forwardmove, F_f, PlayerPawn) { PROP_DOUBLE_PARM(m, 0); - defaults->ForwardMove1 = defaults->ForwardMove2 = m; + defaults->FloatVar(NAME_ForwardMove1) = defaults->FloatVar(NAME_ForwardMove2) = m; if (PROP_PARM_COUNT > 1) { PROP_DOUBLE_PARM(m2, 1); - defaults->ForwardMove2 = m2; + defaults->FloatVar(NAME_ForwardMove2) = m2; } } @@ -1555,11 +1555,11 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, forwardmove, F_f, PlayerPawn) DEFINE_CLASS_PROPERTY_PREFIX(player, sidemove, F_f, PlayerPawn) { PROP_DOUBLE_PARM(m, 0); - defaults->SideMove1 = defaults->SideMove2 = m; + defaults->FloatVar(NAME_SideMove1) = defaults->FloatVar(NAME_SideMove2) = m; if (PROP_PARM_COUNT > 1) { PROP_DOUBLE_PARM(m2, 1); - defaults->SideMove2 = m2; + defaults->FloatVar(NAME_SideMove2) = m2; } } @@ -1666,7 +1666,8 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, hexenarmor, FFFFF, PlayerPawn) for (int i = 0; i < 5; i++) { PROP_DOUBLE_PARM(val, i); - defaults->HexenArmor[i] = val; + auto hexarmor = &defaults->FloatVar(NAME_HexenArmor); + hexarmor[i] = val; } }