X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Futil.qc;h=df54e3536b10acdf149037ddacc8b6c4c133da12;hb=804fe9a9efdb8f1689fa4ac63e3398547b3fa477;hp=3fb2d7e1af3e712a27788d00004b11b5057ae9bb;hpb=b3126a1e33c04b2e318afc6f745d96a41d1f0623;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 3fb2d7e1a..df54e3536 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -372,7 +372,7 @@ void depthfirst(entity start, .entity up, .entity downleft, .entity right, void( } #ifdef GAMEQC -string ScoreString(int pFlags, float pValue) +string ScoreString(int pFlags, float pValue, int rounds_played) { string valstr; float l; @@ -385,6 +385,8 @@ string ScoreString(int pFlags, float pValue) valstr = (pValue < 256 ? count_ordinal(pValue) : _("N/A")); else if(pFlags & SFL_TIME) valstr = TIME_ENCODED_TOSTRING(pValue, true); + else if (rounds_played) + valstr = sprintf("%.1f", pValue / rounds_played); else valstr = ftos(pValue); @@ -442,7 +444,7 @@ vector decompressShortVector(int data) float q = (data & 0x0F80) / 0x80; int len = (data & 0x007F); - //print("\ndecompress: p ", ftos(p)); print("q ", ftos(q)); print("len ", ftos(len), "\n"); + //print("\ndecompress: p:", ftos(p)); print(" q:", ftos(q)); print(" len:", ftos(len), "\n"); if(p == 0) { @@ -455,7 +457,7 @@ vector decompressShortVector(int data) } else { - q = .19634954084936207740 * q; + q = .19634954084936207740 * q; p = .19634954084936207740 * p - 1.57079632679489661922; out.x = cos(q) * cos(p); out.y = sin(q) * cos(p); @@ -491,10 +493,10 @@ float compressShortVector(vector vec) y = 30; } else - y = floor(0.5 + ang.y * 32 / 360) & 31; // 0..360 to 0..32 + y = floor(0.5 + ang.y * 32 / 360) & 31; // 0..360 to 0..32 len = invertLengthLog(vlen(vec)); - //print("compressed: p ", ftos(p)); print("y ", ftos(y)); print("len ", ftos(len), "\n"); + //print("compressed: p:", ftos(p)); print(" y:", ftos(y)); print(" len:", ftos(len), "\n"); return (p * 0x1000) + (y * 0x80) + len; }