]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Improve the tag counting macro
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Jan 2012 20:09:13 +0000 (22:09 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Jan 2012 20:09:13 +0000 (22:09 +0200)
qcsrc/client/damage.qc
qcsrc/common/util.qh

index 9130f972a96287940b082df877c4a02dd0e6ddfb..ffa11e0b6a971a7934dfba4d9e536d92d3a565c0 100644 (file)
@@ -304,8 +304,8 @@ void DamageEffect(vector hitorg, float dmg, float type, float specnum, float ent
        FOR_EACH_TAG(self)
        {
                // go through all tags on the player model, choose the one closest to the damage origin
-               if(!closest || vlen(hitorg - gettaginfo(self, i)) <= vlen(hitorg - gettaginfo(self, closest)))
-                       closest = i;
+               if(!closest || vlen(hitorg - gettaginfo(self, tagnum)) <= vlen(hitorg - gettaginfo(self, closest)))
+                       closest = tagnum;
        }
        gettaginfo(self, closest); // set gettaginfo_name
 
index f4f8970d5fba4f03f37e5caf8d1f1e9b89504931..311f402e78dcac0b174ae44a78f55a9b756cbb71 100644 (file)
@@ -281,6 +281,6 @@ entity ReadCSQCEntity()
 void Shutdown();
 
 #ifndef MENUQC
-// loop that goes through all the bones of a model
-#define FOR_EACH_TAG(v) for(i = 1, gettaginfo(v, i);; i++, gettaginfo(v, i)) if not(gettaginfo_name) break; else
+// loops through the tags of model v using counter tagnum
+#define FOR_EACH_TAG(v) float tagnum; for(tagnum = 1, gettaginfo(v, tagnum);; tagnum++, gettaginfo(v, tagnum)) if not(gettaginfo_name) break; else
 #endif