]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Use a different and smarter way to go through the bones of a model. The previous...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Jan 2012 19:51:04 +0000 (21:51 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Jan 2012 19:51:04 +0000 (21:51 +0200)
qcsrc/client/damage.qc
qcsrc/common/util.qh
qcsrc/server/mutators/sandbox.qc

index ae7440500752c4d7af02eb93816609215dc181a2..9130f972a96287940b082df877c4a02dd0e6ddfb 100644 (file)
@@ -301,7 +301,7 @@ void DamageEffect(vector hitorg, float dmg, float type, float specnum, float ent
        }
 
        float closest;
-       for(i = 0; gettaginfo(self, i); i++)
+       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)))
index 6d4eb61130b13fd26a75948fb28ff8b2c75d8721..f4f8970d5fba4f03f37e5caf8d1f1e9b89504931 100644 (file)
@@ -279,3 +279,8 @@ entity ReadCSQCEntity()
 
 // generic shutdown handler
 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
+#endif
index 66377d1d84aade6398814d045f04926cefdc7d17..e7f51aa887f7931445f0006452db6110a7e8928f 100644 (file)
@@ -744,7 +744,7 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                                                        print_to(self, strcat("^2SANDBOX - INFO: ^7Object is owned by \"^7", e.netname, "^7\", created \"^3", e.message, "^7\", last edited \"^3", e.message2, "^7\""));
                                                        return TRUE;
                                                case "mesh":
-                                                       for(i = 1; gettaginfo(e, i); i++)
+                                                       FOR_EACH_TAG(e)
                                                                s = strcat(s, "^7\"^5", gettaginfo_name, "^7\", ");
                                                        print_to(self, strcat("^2SANDBOX - INFO: ^7Object mesh is \"^3", e.model, "^7\" at animation frame ^3", ftos(e.frame), " ^7containing the following tags: ", s));
                                                        return TRUE;