diff --git a/language.version b/language.version index ab8fb2745..5d75bfcb2 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1244 \cu(Mon Feb 2 14:31:59 CET 2026)\c-"; -SWWM_SHORTVER="\cw1.3pre r1244 \cu(2026-02-02 14:31:59)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1245 \cu(Mon Feb 23 16:18:38 CET 2026)\c-"; +SWWM_SHORTVER="\cw1.3pre r1245 \cu(2026-02-23 16:18:38)\c-"; diff --git a/zscript/utility/swwm_utility_math.zsc b/zscript/utility/swwm_utility_math.zsc index 98e3bc32f..94300db82 100644 --- a/zscript/utility/swwm_utility_math.zsc +++ b/zscript/utility/swwm_utility_math.zsc @@ -7,12 +7,6 @@ Struct SWWMProjectionData int viewx, viewy, vieww, viewh; } -Struct SWWMFRNGState -{ - bool init; - uint x, y, z, w, v, d; -} - extend Class SWWMUtility { // cache some data that requires trig and quat math @@ -450,68 +444,6 @@ extend Class SWWMUtility double yscale = dist*len; return angle, pitch, yscale; } - - // XORWOW-based PRNG, the best and fastest we can really use in ZScript due to lack of 64-bit integers - private static uint XORWOW( SWWMFRNGState &rss ) - { - if ( !rss.init ) - { - rss.x = 123456789; - rss.y = 362436069; - rss.z = 521288629; - rss.w = 88675123; - rss.v = 5783321; - rss.d = 6615241; - rss.init = true; - } - uint t = rss.v; - uint s = rss.x; - rss.v = rss.w; - rss.w = rss.z; - rss.z = rss.y; - rss.y = s; - t ^= t>>2; - t ^= t<<1; - t ^= s^(s<<4); - rss.x = t; - rss.d += 362437; - return t+rss.d; - } - - // the public-callable functions - static uint FastRand( SWWMFRNGState &rss, uint mod = 0 ) - { - uint rslt = XORWOW(rss); - if ( mod ) return rslt%mod; - return rslt; - } - - static int FastRandRange( SWWMFRNGState &rss, int low, int high ) - { - if ( low >= high ) ThrowAbortException("FastRandomRange called with low >= high"); - uint range = uint(high-low); - int rslt = int(FastRand(rss,range)); - return low+rslt; - } - - static double FastFRand( SWWMFRNGState &rss ) - { - uint rslt = XORWOW(rss); - return rslt/double(uint.max); - } - - static Vector3 FastVRand( SWWMFRNGState &rss ) - { - double ang = FastFRand(rss)*360; - double pt = 90-FastFRand(rss)*180; - return (cos(ang)*cos(pt),sin(ang)*cos(pt),-sin(pt)); - } - - static Vector2 FastVRand2D( SWWMFRNGState &rss ) - { - double ang = FastFRand(rss)*360; - return (cos(ang),sin(ang)); - } } // ultrafast PRNG for a bunch of UI stuff