From dba1eb2bfe3eb5fdfc8f1ef58eebab853734d27d Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 13 Sep 2018 09:19:18 +1000 Subject: [PATCH] Move item_key to mapobjects --- qcsrc/common/mapobjects/misc/_mod.inc | 1 + qcsrc/common/mapobjects/misc/_mod.qh | 1 + .../mapobjects/misc/keys.qc} | 21 ++++++++++++------- .../mapobjects/misc/keys.qh} | 0 qcsrc/common/mapobjects/trigger/keylock.qc | 9 +++++++- qcsrc/common/mapobjects/trigger/keylock.qh | 9 -------- qcsrc/common/mapobjects/triggers.qc | 3 --- qcsrc/server/_mod.inc | 1 - qcsrc/server/_mod.qh | 1 - 9 files changed, 23 insertions(+), 23 deletions(-) rename qcsrc/{server/item_key.qc => common/mapobjects/misc/keys.qc} (95%) rename qcsrc/{server/item_key.qh => common/mapobjects/misc/keys.qh} (100%) diff --git a/qcsrc/common/mapobjects/misc/_mod.inc b/qcsrc/common/mapobjects/misc/_mod.inc index 498f6c521..c7f1619ad 100644 --- a/qcsrc/common/mapobjects/misc/_mod.inc +++ b/qcsrc/common/mapobjects/misc/_mod.inc @@ -2,5 +2,6 @@ #include #include #include +#include #include #include diff --git a/qcsrc/common/mapobjects/misc/_mod.qh b/qcsrc/common/mapobjects/misc/_mod.qh index 3415919f8..617db807b 100644 --- a/qcsrc/common/mapobjects/misc/_mod.qh +++ b/qcsrc/common/mapobjects/misc/_mod.qh @@ -2,5 +2,6 @@ #include #include #include +#include #include #include diff --git a/qcsrc/server/item_key.qc b/qcsrc/common/mapobjects/misc/keys.qc similarity index 95% rename from qcsrc/server/item_key.qc rename to qcsrc/common/mapobjects/misc/keys.qc index 2bfdc49b7..2c8574249 100644 --- a/qcsrc/server/item_key.qc +++ b/qcsrc/common/mapobjects/misc/keys.qc @@ -1,12 +1,15 @@ -#include "item_key.qh" +#include "keys.qh" -#include "../common/mapobjects/subs.qh" -#include -#include "../common/monsters/_mod.qh" -#include "../common/notifications/all.qh" -#include "../common/util.qh" -#include "../lib/warpzone/util_server.qh" +#ifdef CSQC +bool item_keys_usekey(entity l, entity p) +{ + int valid = (l.itemkeys & p.itemkeys); // TODO: itemkeys isn't networked or anything! + l.itemkeys &= ~valid; // only some of the needed keys were given + return valid != 0; +} +#endif +#ifdef SVQC /* TODO: - add an unlock sound (here to trigger_keylock and to func_door) @@ -18,7 +21,7 @@ TODO: bool item_keys_usekey(entity l, entity p) { - int valid = l.itemkeys & PS(p).itemkeys; + int valid = l.itemkeys & p.itemkeys; if (!valid) { // player has none of the needed keys @@ -285,3 +288,5 @@ spawnfunc(item_key2) this.itemkeys = ITEM_KEY_BIT(0); spawnfunc_item_key(this); } + +#endif diff --git a/qcsrc/server/item_key.qh b/qcsrc/common/mapobjects/misc/keys.qh similarity index 100% rename from qcsrc/server/item_key.qh rename to qcsrc/common/mapobjects/misc/keys.qh diff --git a/qcsrc/common/mapobjects/trigger/keylock.qc b/qcsrc/common/mapobjects/trigger/keylock.qc index 67db14421..f7ecd7c1f 100644 --- a/qcsrc/common/mapobjects/trigger/keylock.qc +++ b/qcsrc/common/mapobjects/trigger/keylock.qc @@ -30,7 +30,14 @@ void trigger_keylock_touch(entity this, entity toucher) // check silver key if(this.itemkeys) - key_used = item_keys_usekey(this, toucher); + { +#ifdef SVQC + entity store = PS(toucher); +#elif defined(CSQC) + entity store = toucher; +#endif + key_used = item_keys_usekey(this, store); + } if(this.itemkeys) { diff --git a/qcsrc/common/mapobjects/trigger/keylock.qh b/qcsrc/common/mapobjects/trigger/keylock.qh index 904c3fa3d..6f70f09be 100644 --- a/qcsrc/common/mapobjects/trigger/keylock.qh +++ b/qcsrc/common/mapobjects/trigger/keylock.qh @@ -1,10 +1 @@ #pragma once - -#ifdef CSQC -bool item_keys_usekey(entity l, entity p) -{ - int valid = (l.itemkeys & p.itemkeys); // TODO: itemkeys isn't networked or anything! - l.itemkeys &= ~valid; // only some of the needed keys were given - return valid != 0; -} -#endif diff --git a/qcsrc/common/mapobjects/triggers.qc b/qcsrc/common/mapobjects/triggers.qc index c7ed6643d..6a2095999 100644 --- a/qcsrc/common/mapobjects/triggers.qc +++ b/qcsrc/common/mapobjects/triggers.qc @@ -1,7 +1,4 @@ #include "triggers.qh" -#ifdef SVQC - #include -#endif void SUB_DontUseTargets(entity this, entity actor, entity trigger) { } diff --git a/qcsrc/server/_mod.inc b/qcsrc/server/_mod.inc index 429117ad0..2ec838695 100644 --- a/qcsrc/server/_mod.inc +++ b/qcsrc/server/_mod.inc @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include diff --git a/qcsrc/server/_mod.qh b/qcsrc/server/_mod.qh index 2bbfb7204..cc27baf12 100644 --- a/qcsrc/server/_mod.qh +++ b/qcsrc/server/_mod.qh @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include -- 2.39.2