From 3182569fb8c7413b97f9660890d9df1ff1988358 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 2 Dec 2018 18:43:38 +0100 Subject: [PATCH] - scriptified the decision making of the invuseall CCMD. Custom items had no way to adjust to this - and it also was the last native access to ItemFlags. --- src/d_net.cpp | 6 ++++-- wadsrc/static/zscript/inventory/inv_misc.txt | 3 +++ wadsrc/static/zscript/inventory/inventory.txt | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/d_net.cpp b/src/d_net.cpp index 583b99ebf..ac4f512f5 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -63,6 +63,7 @@ #include "g_levellocals.h" #include "events.h" #include "i_time.h" +#include "vm.h" EXTERN_CVAR (Int, disableautosave) EXTERN_CVAR (Int, autosavecount) @@ -2253,9 +2254,10 @@ void Net_DoCommand (int type, uint8_t **stream, int player) while (item != NULL) { AInventory *next = item->Inventory; - if (item->ItemFlags & IF_INVBAR && !(item->IsKindOf(pitype))) + IFVIRTUALPTR(item, AInventory, UseAll) { - players[player].mo->UseInventory (item); + VMValue param[] = { item, players[player].mo }; + VMCall(func, param, 2, nullptr, 0); } item = next; } diff --git a/wadsrc/static/zscript/inventory/inv_misc.txt b/wadsrc/static/zscript/inventory/inv_misc.txt index 4761408b3..7aa60227d 100644 --- a/wadsrc/static/zscript/inventory/inv_misc.txt +++ b/wadsrc/static/zscript/inventory/inv_misc.txt @@ -132,6 +132,9 @@ class PuzzleItem : Inventory return false; } + override void UseAll(Actor user) + { + } override bool ShouldStay () { diff --git a/wadsrc/static/zscript/inventory/inventory.txt b/wadsrc/static/zscript/inventory/inventory.txt index 2166c8630..86c5527f6 100644 --- a/wadsrc/static/zscript/inventory/inventory.txt +++ b/wadsrc/static/zscript/inventory/inventory.txt @@ -934,6 +934,11 @@ class Inventory : Actor native virtual version("2.4") ui void AlterWeaponSprite(VisStyle vis, in out int changed) {} virtual void OwnerDied() {} virtual Color GetBlend () { return 0; } + + virtual void UseAll(Actor user) + { + if (bInvBar) user.UseInventory(self); + } //=========================================================================== //