]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Minor cleanups
authorterencehill <piuntn@gmail.com>
Sat, 13 May 2023 21:46:43 +0000 (23:46 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 13 May 2023 21:46:43 +0000 (23:46 +0200)
qcsrc/common/mutators/mutator/instagib/sv_instagib.qh
qcsrc/server/items/items.qc
qcsrc/server/weapons/spawning.qc
qcsrc/server/world.qc

index 97d84d49be10bcb6dc9f2ae7af05d0f8a4956e0d..ce2f313c01860e7182052cef2ed3228dc8c28486 100644 (file)
@@ -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;
index 504ba6e6380e75981958ddc55eb95411d7f2effa..c36f843762092ade68858ee1c6fe130b6b8aa604 100644 (file)
@@ -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))
index dc7b110e2cc2857da219b18290871de34cc515f0..99049217f3a12e8a854ddd7f1dd6f45e0f32fc6c 100644 (file)
@@ -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);
index ab5786d6cfec27b1a27e3f24ef488ff3e8977a8b..124ca5afe85f32bf06e9f925a1372b2e8d56e8f8 100644 (file)
@@ -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