From d13e9a044866dc6cbe51e7e07a25e7a4988e09b0 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 13 May 2023 23:46:43 +0200 Subject: [PATCH] Minor cleanups --- qcsrc/common/mutators/mutator/instagib/sv_instagib.qh | 2 -- qcsrc/server/items/items.qc | 10 ++++------ qcsrc/server/weapons/spawning.qc | 9 +++------ qcsrc/server/world.qc | 9 ++++++--- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh index 97d84d49b..ce2f313c0 100644 --- a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh @@ -27,9 +27,7 @@ float autocvar_g_rm_laser_force; bool autocvar_g_instagib; int autocvar_g_instagib_extralives; -/// \brief Time of invisibility powerup in seconds. float autocvar_g_instagib_invisibility_time; -/// \brief Time of speed powerup in seconds. float autocvar_g_instagib_speed_time; IntrusiveList g_instagib_items; diff --git a/qcsrc/server/items/items.qc b/qcsrc/server/items/items.qc index 504ba6e63..c36f84376 100644 --- a/qcsrc/server/items/items.qc +++ b/qcsrc/server/items/items.qc @@ -932,6 +932,8 @@ void item_use(entity this, entity actor, entity trigger) gettouch(this)(this, actor); } +// if defaultrespawntime is 0 get respawntime from the item definition +// if defaultrespawntimejitter is 0 get respawntimejitter from the item definition void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter) { string itemname = def.m_name; @@ -1173,12 +1175,8 @@ void StartItem(entity this, GameItem def) this.classname = def.m_canonical_spawnfunc; - _StartItem( - this, - this.itemdef = def, - 0, // call def.m_respawntime() to get defaultrespawntime - 0 // call def.m_respawntimejitter() to get defaultrespawntimejitter - ); + this.itemdef = def; + _StartItem(this, this.itemdef, 0, 0); } #define IS_SMALL(def) ((def.instanceOfHealth && def == ITEM_HealthSmall) || (def.instanceOfArmor && def == ITEM_ArmorSmall)) diff --git a/qcsrc/server/weapons/spawning.qc b/qcsrc/server/weapons/spawning.qc index dc7b110e2..99049217f 100644 --- a/qcsrc/server/weapons/spawning.qc +++ b/qcsrc/server/weapons/spawning.qc @@ -156,12 +156,9 @@ void weapon_defaultspawnfunc(entity this, Weapon wpn) this.glowmod = colormapPaletteColor(this.owner.clientcolors & 0x0F, true); GameItem def = wpn.m_pickup; - _StartItem( - this, - this.itemdef = def, - this.respawntime, // defaultrespawntime - this.respawntimejitter // defaultrespawntimejitter - ); + this.itemdef = def; + _StartItem(this, this.itemdef, this.respawntime, this.respawntimejitter); + #if 0 // WEAPONTODO if (this.modelindex) { // don't precache if this was removed wpn.wr_init(wpn); diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index ab5786d6c..124ca5afe 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -166,11 +166,14 @@ void cvar_changes_init() { k = bufstr_get(h, i); -#define BADPREFIX(p) if(substring(k, 0, strlen(p)) == p) continue -#define BADPRESUFFIX(p,s) if(substring(k, 0, strlen(p)) == p && substring(k, -strlen(s), -1) == s) continue +#define BADPREFIX_COND(p) (substring(k, 0, strlen(p)) == p) +#define BADSUFFIX_COND(s) (substring(k, -strlen(s), -1) == s) + +#define BADPREFIX(p) if(BADPREFIX_COND(p)) continue +#define BADPRESUFFIX(p, s) if(BADPREFIX_COND(p) && BADSUFFIX_COND(s)) continue #define BADCVAR(p) if(k == p) continue #define BADVALUE(p, val) if (k == p && v == val) continue -#define BADPRESUFFIXVALUE(p,s,val) if(substring(k, 0, strlen(p)) == p && substring(k, -strlen(s), -1) == s && v == val) continue +#define BADPRESUFFIXVALUE(p, s, val) if(BADPREFIX_COND(p) && BADSUFFIX_COND(s) && v == val) continue // general excludes and namespaces for server admin used cvars BADPREFIX("help_"); // PN's server has this listed as changed, let's not rat him out for THAT -- 2.39.2