summaryrefslogtreecommitdiff
path: root/src/SSystem/SComponent/c_math.cpp
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2025-06-01 16:05:42 -0400
committerLagoLunatic <LagoLunatic@users.noreply.github.com>2025-06-01 16:05:42 -0400
commitcdfaa05635dc5e4857eede2e1cb66ad37751032e (patch)
treebafe0677a9d83c9f61b055b08e359277f81f3c8f /src/SSystem/SComponent/c_math.cpp
parent63a92eaa88967ecc21420cb085c69dedf1f839f7 (diff)
More demo work, cleanup
Diffstat (limited to 'src/SSystem/SComponent/c_math.cpp')
-rw-r--r--src/SSystem/SComponent/c_math.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/SSystem/SComponent/c_math.cpp b/src/SSystem/SComponent/c_math.cpp
index ddfffd9d..363b8647 100644
--- a/src/SSystem/SComponent/c_math.cpp
+++ b/src/SSystem/SComponent/c_math.cpp
@@ -199,3 +199,16 @@ void cM_initRnd2(int p0, int p1, int p2) {
r12 = p1;
r22 = p2;
}
+
+#if VERSION == VERSION_DEMO
+float cM_rnd2(void) {
+ r02 = (r02 * 0xAB) % 0x763D;
+ r12 = (r12 * 0xAC) % 0x7663;
+ r22 = (r22 * 0xAA) % 0x7673;
+ return std::fabsf(std::fmodf(r02 / 30269.0f + r12 / 30307.0f + r22 / 30323.0f, 1.0));
+}
+
+float cM_rndFX2(float f) {
+ return f * (cM_rnd2() - 0.5f) * 2.0f;
+}
+#endif