]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/util.qc
Merge remote branch 'origin/master' into samual/updatecommands
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / util.qc
index 105b7e7768f84136062ae6087a0b19a9dbb77419..5bb7943fe6d920923e998f3977c45be3c6ccf8d3 100644 (file)
@@ -1074,8 +1074,8 @@ vector rgb_to_hsv(vector rgb)
        float mi, ma;
        vector hsv;
 
-       mi = min3(rgb_x, rgb_y, rgb_z);
-       ma = max3(rgb_x, rgb_y, rgb_z);
+       mi = min(rgb_x, rgb_y, rgb_z);
+       ma = max(rgb_x, rgb_y, rgb_z);
 
        hsv_x = rgb_mi_ma_to_hue(rgb, mi, ma);
        hsv_z = ma;
@@ -1098,8 +1098,8 @@ vector rgb_to_hsl(vector rgb)
        float mi, ma;
        vector hsl;
 
-       mi = min3(rgb_x, rgb_y, rgb_z);
-       ma = max3(rgb_x, rgb_y, rgb_z);
+       mi = min(rgb_x, rgb_y, rgb_z);
+       ma = max(rgb_x, rgb_y, rgb_z);
 
        hsl_x = rgb_mi_ma_to_hue(rgb, mi, ma);
        
@@ -2108,16 +2108,22 @@ float lowestbit(float f)
        return f;
 }
 
-// used by gamecommand/clientcommand system
-float GetFilteredNumber(string input)
+string strlimitedlen(string input, string truncation, float strip_colors, float limit)
 {
-       float output;
-       
-       if(substring(input, 0, 1) == "#")
-               output = stof(substring(input, 1, -1));
+       if(strlen((strip_colors ? strdecolorize(input) : input)) <= limit)
+               return input;
        else
-               output = stof(input);
-               
-       //print(strcat("input: ", input, ", output: ", ftos(output), ",\n"));
-       return output;
-}
\ No newline at end of file
+               return strcat(substring(input, 0, (strlen(input) - strlen(truncation))), truncation);
+}
+
+#ifdef CSQC
+entity ReadCSQCEntity()
+{
+       float f;
+       f = ReadShort();
+       if(f == 0)
+               return world;
+       return findfloat(world, entnum, f);
+}
+#endif
+