From 90d47ea07751b1761fe5a66d60e673d81692d720 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Sat, 16 Mar 2024 16:42:37 +1000 Subject: [PATCH] Remove key-specific BIT macro --- qcsrc/common/mapobjects/func/door.qc | 4 ++-- qcsrc/common/mapobjects/misc/keys.qc | 8 ++++---- qcsrc/common/mapobjects/misc/keys.qh | 5 ----- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/qcsrc/common/mapobjects/func/door.qc b/qcsrc/common/mapobjects/func/door.qc index 0250b48cf..25e9ba844 100644 --- a/qcsrc/common/mapobjects/func/door.qc +++ b/qcsrc/common/mapobjects/func/door.qc @@ -752,9 +752,9 @@ spawnfunc(func_door) { // Quake 1 and QL keys compatibility if (this.spawnflags & SPAWNFLAGS_GOLD_KEY) - this.itemkeys |= ITEM_KEY_BIT(0); + this.itemkeys |= BIT(0); if (this.spawnflags & SPAWNFLAGS_SILVER_KEY) - this.itemkeys |= ITEM_KEY_BIT(1); + this.itemkeys |= BIT(1); SetMovedir(this); diff --git a/qcsrc/common/mapobjects/misc/keys.qc b/qcsrc/common/mapobjects/misc/keys.qc index 1b2b88e05..b98ed6df2 100644 --- a/qcsrc/common/mapobjects/misc/keys.qc +++ b/qcsrc/common/mapobjects/misc/keys.qc @@ -227,9 +227,9 @@ spawnfunc(item_key) // find default model string _model = string_null; - if (this.itemkeys <= ITEM_KEY_BIT(2) || this.itemkeys == 0xffffff) { + if (this.itemkeys <= BIT(2) || this.itemkeys == 0xffffff) { _model = "models/keys/key.md3"; - } else if (this.itemkeys >= ITEM_KEY_BIT(3) && this.itemkeys <= ITEM_KEY_BIT(5)) { + } else if (this.itemkeys >= BIT(3) && this.itemkeys <= BIT(5)) { _model = "models/keys/key.md3"; // FIXME: replace it by a keycard model! } else if (this.model == "") { objerror(this, "item_key doesn't have a default model for this key and a custom one was not specified!"); @@ -277,7 +277,7 @@ Don't use this entity on new maps! Use item_key instead. */ spawnfunc(item_key1) { - this.itemkeys = ITEM_KEY_BIT(1); + this.itemkeys = BIT(1); spawnfunc_item_key(this); } @@ -295,7 +295,7 @@ Don't use this entity on new maps! Use item_key instead. */ spawnfunc(item_key2) { - this.itemkeys = ITEM_KEY_BIT(0); + this.itemkeys = BIT(0); spawnfunc_item_key(this); } diff --git a/qcsrc/common/mapobjects/misc/keys.qh b/qcsrc/common/mapobjects/misc/keys.qh index 50be5f8db..b381b5455 100644 --- a/qcsrc/common/mapobjects/misc/keys.qh +++ b/qcsrc/common/mapobjects/misc/keys.qh @@ -1,10 +1,5 @@ #pragma once -/** - * Returns the bit ID of a key - */ -#define ITEM_KEY_BIT(n) ( bitshift(1, n) ) - #define ITEM_KEY_MAX 24 /** -- 2.39.2