summaryrefslogtreecommitdiffstats
path: root/src/re3.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-05-31 00:33:01 +0200
committeraap <aap@papnet.eu>2019-05-31 00:33:01 +0200
commitc4368b7432b4484d3f086afb5589fcddc62a1915 (patch)
tree2cce45d6ba4feabb229eb349c5b32beb22849d39 /src/re3.cpp
parentadded CCredits (diff)
parentMerge pull request #3 from Fire-Head/master (diff)
downloadre3-c4368b7432b4484d3f086afb5589fcddc62a1915.tar
re3-c4368b7432b4484d3f086afb5589fcddc62a1915.tar.gz
re3-c4368b7432b4484d3f086afb5589fcddc62a1915.tar.bz2
re3-c4368b7432b4484d3f086afb5589fcddc62a1915.tar.lz
re3-c4368b7432b4484d3f086afb5589fcddc62a1915.tar.xz
re3-c4368b7432b4484d3f086afb5589fcddc62a1915.tar.zst
re3-c4368b7432b4484d3f086afb5589fcddc62a1915.zip
Diffstat (limited to '')
-rw-r--r--src/re3.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/re3.cpp b/src/re3.cpp
index 289c7f7a..0d235cc0 100644
--- a/src/re3.cpp
+++ b/src/re3.cpp
@@ -21,15 +21,24 @@ WRAPPER void gtadelete(void *p) { EAXJMP(0x5A07E0); }
void *operator new(size_t sz) { return gtanew(sz); }
void operator delete(void *ptr) noexcept { gtadelete(ptr); }
-// Use our own implementation of rand, stolen from PS2
-
+#if USE_PS2_RAND == TRUE
unsigned __int64 myrand_seed = 1;
+#else
+unsigned long int myrand_seed = 1;
+#endif
int
myrand(void)
{
+#if USE_PS2_RAND == TRUE
+ // Use our own implementation of rand, stolen from PS2
myrand_seed = 0x5851F42D4C957F2D * myrand_seed + 1;
return ((myrand_seed >> 32) & 0x7FFFFFFF);
+#else
+ // or original codewarrior rand
+ myrand_seed = myrand_seed * 1103515245 + 12345;
+ return((myrand_seed >> 16) & 0x7FFF);
+#endif
}
void