From 0c95568d98fe6e23c99361f770a933d17f575b69 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 23 Nov 2016 01:31:48 +0100 Subject: [PATCH] - exported native fields of several more classes. --- src/g_shared/a_armor.cpp | 18 +++++++++ src/g_shared/a_pickups.cpp | 24 +++++++++++- src/g_shared/a_pickups.h | 2 +- src/scripting/decorate/olddecorations.cpp | 2 + src/scripting/vm/vm.h | 1 + wadsrc/static/zscript/shared/inventory.txt | 45 +++++++++++++++++++++- 6 files changed, 89 insertions(+), 3 deletions(-) diff --git a/src/g_shared/a_armor.cpp b/src/g_shared/a_armor.cpp index 8f1116a9e5..e1dd0986e7 100644 --- a/src/g_shared/a_armor.cpp +++ b/src/g_shared/a_armor.cpp @@ -15,6 +15,15 @@ IMPLEMENT_CLASS(ABasicArmorPickup, false, false, false, false) IMPLEMENT_CLASS(ABasicArmorBonus, false, false, true, false) IMPLEMENT_CLASS(AHexenArmor, false, false, false, false) + +DEFINE_FIELD(ABasicArmor, AbsorbCount) +DEFINE_FIELD(ABasicArmor, SavePercent) +DEFINE_FIELD(ABasicArmor, MaxAbsorb) +DEFINE_FIELD(ABasicArmor, MaxFullAbsorb) +DEFINE_FIELD(ABasicArmor, BonusCount) +DEFINE_FIELD(ABasicArmor, ArmorType) +DEFINE_FIELD(ABasicArmor, ActualSaveAmount) + //=========================================================================== // // ABasicArmor :: Serialize @@ -193,6 +202,11 @@ void ABasicArmor::AbsorbDamage (int damage, FName damageType, int &newdamage) } } +DEFINE_FIELD(ABasicArmorPickup, SavePercent) +DEFINE_FIELD(ABasicArmorPickup, MaxAbsorb) +DEFINE_FIELD(ABasicArmorPickup, MaxFullAbsorb) +DEFINE_FIELD(ABasicArmorPickup, SaveAmount) + //=========================================================================== // // ABasicArmorPickup :: Serialize @@ -396,6 +410,10 @@ bool ABasicArmorBonus::Use (bool pickup) return true; } + +DEFINE_FIELD(AHexenArmor, Slots) +DEFINE_FIELD(AHexenArmor, SlotsIncrement) + //=========================================================================== // // AHexenArmor :: Serialize diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index a3abe7cf4c..ce8f53d611 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -88,6 +88,9 @@ void PClassAmmo::DeriveData(PClass *newclass) IMPLEMENT_CLASS(AAmmo, false, false, false, false) +DEFINE_FIELD(AAmmo, BackpackAmount) +DEFINE_FIELD(AAmmo, BackpackMaxAmount) + //=========================================================================== // // AAmmo :: Serialize @@ -483,6 +486,20 @@ IMPLEMENT_POINTERS_START(AInventory) IMPLEMENT_POINTER(Owner) IMPLEMENT_POINTERS_END +DEFINE_FIELD_BIT(AInventory, ItemFlags, bPickupGood, IF_PICKUPGOOD) +DEFINE_FIELD_BIT(AInventory, ItemFlags, bCreateCopyMoved, IF_CREATECOPYMOVED) +DEFINE_FIELD_BIT(AInventory, ItemFlags, bInitEffectFailed, IF_INITEFFECTFAILED) +DEFINE_FIELD(AInventory, Owner) +DEFINE_FIELD(AInventory, Amount) +DEFINE_FIELD(AInventory, MaxAmount) +DEFINE_FIELD(AInventory, InterHubAmount) +DEFINE_FIELD(AInventory, RespawnTics) +DEFINE_FIELD(AInventory, Icon) +DEFINE_FIELD(AInventory, DropTime) +DEFINE_FIELD(AInventory, SpawnPointClass) +DEFINE_FIELD(AInventory, PickupFlash) +DEFINE_FIELD(AInventory, PickupSound) + //=========================================================================== // // AInventory :: Tick @@ -1739,6 +1756,8 @@ void PClassHealth::DeriveData(PClass *newclass) IMPLEMENT_CLASS(AHealth, false, false, false, false) +DEFINE_FIELD(AHealth, PrevHealth) + //=========================================================================== // // AHealth :: PickupMessage @@ -1858,6 +1877,10 @@ void AHealthPickup::Serialize(FSerializer &arc) // Backpack ----------------------------------------------------------------- +IMPLEMENT_CLASS(ABackpackItem, false, false, false, false) + +DEFINE_FIELD(ABackpackItem, bDepleted) + //=========================================================================== // // ABackpackItem :: Serialize @@ -2033,7 +2056,6 @@ void ABackpackItem::DetachFromOwner () // //=========================================================================== -IMPLEMENT_CLASS(ABackpackItem, false, false, false, false) IMPLEMENT_CLASS(AMapRevealer, false, false, false, false) //=========================================================================== diff --git a/src/g_shared/a_pickups.h b/src/g_shared/a_pickups.h index 6dc2d0bc59..ec34404df2 100644 --- a/src/g_shared/a_pickups.h +++ b/src/g_shared/a_pickups.h @@ -429,8 +429,8 @@ class AHealth : public AInventory { DECLARE_CLASS_WITH_META(AHealth, AInventory, PClassHealth) - int PrevHealth; public: + int PrevHealth; virtual bool TryPickup (AActor *&other); virtual const char *PickupMessage (); }; diff --git a/src/scripting/decorate/olddecorations.cpp b/src/scripting/decorate/olddecorations.cpp index a2cbc636bf..7540d45f45 100644 --- a/src/scripting/decorate/olddecorations.cpp +++ b/src/scripting/decorate/olddecorations.cpp @@ -98,6 +98,8 @@ public: IMPLEMENT_CLASS(AFakeInventory, false, false, false, false) +DEFINE_FIELD(AFakeInventory, Respawnable) + // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- diff --git a/src/scripting/vm/vm.h b/src/scripting/vm/vm.h index 10ac4bb7b9..7b05fae36c 100644 --- a/src/scripting/vm/vm.h +++ b/src/scripting/vm/vm.h @@ -4,6 +4,7 @@ #include "zstring.h" #include "autosegs.h" #include "vectors.h" +#include "cmdlib.h" #define MAX_RETURNS 8 // Maximum number of results a function called by script code can return #define MAX_TRY_DEPTH 8 // Maximum number of nested TRYs in a single function diff --git a/wadsrc/static/zscript/shared/inventory.txt b/wadsrc/static/zscript/shared/inventory.txt index 929f826da9..47f753ca16 100644 --- a/wadsrc/static/zscript/shared/inventory.txt +++ b/wadsrc/static/zscript/shared/inventory.txt @@ -1,5 +1,20 @@ class Inventory : Actor native { + + native Actor Owner; // Who owns this item? NULL if it's still a pickup. + native int Amount; // Amount of item this instance has + native int MaxAmount; // Max amount of item this instance can have + native int InterHubAmount; // Amount of item that can be kept between hubs or levels + native int RespawnTics; // Tics from pickup time to respawn time + native TextureID Icon; // Icon to show on status bar or HUD + native int DropTime; // Countdown after dropping + native Class SpawnPointClass; // For respawning like Heretic's mace + native Class PickupFlash; // actor to spawn as pickup flash + native Sound PickupSound; + native bool bPickupGood; + native bool bCreateCopyMoved; + native bool bInitEffectFailed; + Default { Inventory.Amount 1; @@ -73,6 +88,9 @@ class ScoreItem : Inventory native class Ammo : Inventory native { + native int BackpackAmount; + native int BackpackMaxAmount; + Default { +INVENTORY.KEEPDEPLETED @@ -82,6 +100,7 @@ class Ammo : Inventory native class BackpackItem : Inventory native { + native bool bDepleted; } class Armor : Inventory native @@ -94,6 +113,15 @@ class Armor : Inventory native class BasicArmor : Armor native { + + native int AbsorbCount; + native double SavePercent; + native int MaxAbsorb; + native int MaxFullAbsorb; + native int BonusCount; + native Name ArmorType; + native int ActualSaveAmount; + Default { +Inventory.KEEPDEPLETED @@ -121,6 +149,12 @@ class BasicArmorBonus : Armor native class BasicArmorPickup : Armor native { + + native double SavePercent; + native int MaxAbsorb; + native int MaxFullAbsorb; + native int SaveAmount; + Default { +Inventory.AUTOACTIVATE; @@ -130,6 +164,10 @@ class BasicArmorPickup : Armor native class HexenArmor : Armor native { + + native double Slots[5]; + native double SlotsIncrement[4]; + Default { +Inventory.KEEPDEPLETED @@ -139,7 +177,10 @@ class HexenArmor : Armor native class DehackedPickup : Inventory native {} -class FakeInventory : Inventory native {} +class FakeInventory : Inventory native +{ + native bool Respawnable; +} class CustomInventory : StateProvider native { @@ -151,6 +192,8 @@ class CustomInventory : StateProvider native class Health : Inventory native { + native int PrevHealth; + Default { Inventory.Amount 1;