diff options
author | aap <aap@papnet.eu> | 2019-05-30 23:55:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-30 23:55:48 +0200 |
commit | a991c99b3a4537c082177c690f4b75001787f913 (patch) | |
tree | ff4354c0a3056af8f580356787982021edf62963 /src/re3.cpp | |
parent | added CText (diff) | |
parent | fixed CParticle crash && RandTable (diff) | |
download | re3-a991c99b3a4537c082177c690f4b75001787f913.tar re3-a991c99b3a4537c082177c690f4b75001787f913.tar.gz re3-a991c99b3a4537c082177c690f4b75001787f913.tar.bz2 re3-a991c99b3a4537c082177c690f4b75001787f913.tar.lz re3-a991c99b3a4537c082177c690f4b75001787f913.tar.xz re3-a991c99b3a4537c082177c690f4b75001787f913.tar.zst re3-a991c99b3a4537c082177c690f4b75001787f913.zip |
Diffstat (limited to 'src/re3.cpp')
-rw-r--r-- | src/re3.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/re3.cpp b/src/re3.cpp index 4f125098..11e8aea7 100644 --- a/src/re3.cpp +++ b/src/re3.cpp @@ -20,15 +20,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 |