]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/util.qc
load animblending info from txt file
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / util.qc
index 0056050cccf1450d02bdac55e02e2304e1714c88..bb2fcba0abacc5ecef45730709add23a735e5468 100644 (file)
@@ -901,8 +901,8 @@ float cvar_settemp(string tmp_cvar, string tmp_value)
 
 float cvar_settemp_restore()
 {
-       float i;
-       entity e;
+       float i = 0;
+       entity e = world;
        while((e = find(e, classname, "saved_cvar_value")))
        {
                if(cvar_type(e.netname))
@@ -1476,8 +1476,12 @@ float isGametypeInFilter(float gt, float tp, float ts, string pattern)
                if(strstrofs(strcat(",", pattern, ","), subpattern, 0) < 0)
                if(strstrofs(strcat(",", pattern, ","), subpattern2, 0) < 0)
                if(strstrofs(strcat(",", pattern, ","), subpattern3, 0) < 0)
-               if((!subpattern4) || strstrofs(strcat(",", pattern, ","), subpattern4, 0) < 0)
-                       return 0;
+               {
+                       if not(subpattern4)
+                               return 0;
+                       if(strstrofs(strcat(",", pattern, ","), subpattern4, 0) < 0)
+                               return 0;
+               }
        }
        return 1;
 }
@@ -2007,9 +2011,16 @@ float get_model_parameters(string m, float sk)
        get_model_parameters_weight = -1;
        get_model_parameters_age = -1;
        get_model_parameters_desc = string_null;
+       get_model_parameters_bone_upperbody = string_null;
+       get_model_parameters_bone_weapon = string_null;
+       get_model_parameters_fixbone = 0;
 
        if not(m)
                return 1;
+
+       if(substring(m, -9, 5) == "_lod1" || substring(m, -9, 5) == "_lod2")
+               m = strcat(substring(m, 0, -10), substring(m, -4, -1));
+
        if(sk < 0)
        {
                if(substring(m, -4, -1) != ".txt")
@@ -2058,6 +2069,12 @@ float get_model_parameters(string m, float sk)
                        get_model_parameters_weight = stof(s);
                if(c == "age")
                        get_model_parameters_age = stof(s);
+               if(c == "bone_upperbody")
+                       get_model_parameters_bone_upperbody = s;
+               if(c == "bone_weapon")
+                       get_model_parameters_bone_weapon = s;
+               if(c == "fixbone")
+                       get_model_parameters_fixbone = stof(s);
        }
 
        while((s = fgets(fh)))