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 | |
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 |
-rw-r--r-- | premake5.exe | bin | 1156608 -> 1362432 bytes | |||
-rw-r--r-- | premake5.lua | 18 | ||||
-rw-r--r-- | premake5vs17.cmd | 1 | ||||
-rw-r--r-- | src/General.h | 4 | ||||
-rw-r--r-- | src/common.h | 6 | ||||
-rw-r--r-- | src/config.h | 3 | ||||
-rw-r--r-- | src/re3.cpp | 13 | ||||
-rw-r--r-- | src/render/Particle.cpp | 3 | ||||
-rw-r--r-- | src/render/Shadows.cpp | 6 |
9 files changed, 39 insertions, 15 deletions
diff --git a/premake5.exe b/premake5.exe Binary files differindex a4bd4724..9048d51e 100644 --- a/premake5.exe +++ b/premake5.exe diff --git a/premake5.lua b/premake5.lua index 9cc0a880..ae035be3 100644 --- a/premake5.lua +++ b/premake5.lua @@ -1,5 +1,5 @@ workspace "re3" - configurations { "ReleaseCI", "Release", "Debug" } + configurations { "ReleaseCI", "Release", "ReleaseFH", "Debug" } location "build" files { "src/*.*" } @@ -30,7 +30,7 @@ project "re3" filter "configurations:Debug" defines { "DEBUG" } - flags { "StaticRuntime" } + staticruntime "on" symbols "On" debugdir "C:/Users/aap/games/gta3_re" debugcommand "C:/Users/aap/games/gta3_re/gta3.exe" @@ -39,11 +39,21 @@ project "re3" filter "configurations:Release" defines { "NDEBUG" } optimize "On" - flags { "StaticRuntime" } + staticruntime "on" debugdir "C:/Users/aap/games/gta3_re" debugcommand "C:/Users/aap/games/gta3_re/gta3.exe" postbuildcommands "copy /y \"$(TargetPath)\" \"C:\\Users\\aap\\games\\gta3_re\\plugins\\re3.dll\"" + filter "configurations:ReleaseFH" + defines { "NDEBUG" } + symbols "Full" + optimize "off" + staticruntime "on" + debugdir "F:/Rockstar Games/GTAIII" + debugcommand "F:/Rockstar Games/GTAIII/gta3.exe" + targetextension ".asi" + targetdir "F:/Rockstar Games/GTAIII/scripts" filter "configurations:ReleaseCI" defines { "NDEBUG" } optimize "On" - flags { "StaticRuntime" } + staticruntime "on" + diff --git a/premake5vs17.cmd b/premake5vs17.cmd new file mode 100644 index 00000000..b569c559 --- /dev/null +++ b/premake5vs17.cmd @@ -0,0 +1 @@ +premake5 vs2017
\ No newline at end of file diff --git a/src/General.h b/src/General.h index aa52bf4d..f957ab2f 100644 --- a/src/General.h +++ b/src/General.h @@ -45,8 +45,8 @@ public: { return myrand() & 0xFFFF; } // Probably don't want to ever reach high static float GetRandomNumberInRange(float low, float high) - { return low + (high - low)*(GetRandomNumber()/65536.0f); } + { return low + (high - low)*(GetRandomNumber()/float(MYRAND_MAX + 1)); } static Int32 GetRandomNumberInRange(Int32 low, Int32 high) - { return low + (high - low)*(GetRandomNumber()/65536.0f); } + { return low + (high - low)*(GetRandomNumber()/float(MYRAND_MAX + 1)); } }; diff --git a/src/common.h b/src/common.h index a82e4c7f..47dd13f2 100644 --- a/src/common.h +++ b/src/common.h @@ -145,6 +145,12 @@ inline float sq(float x) { return x*x; } #define DEGTORAD(x) ((x) * PI / 180.0f) #define RADTODEG(x) ((x) * 180.0f / PI) +#if USE_PS2_RAND == TRUE +#define MYRAND_MAX 65535 +#else +#define MYRAND_MAX 32767 +#endif + int myrand(void); void mysrand(unsigned int seed); diff --git a/src/config.h b/src/config.h index 94692fa0..c12f2da2 100644 --- a/src/config.h +++ b/src/config.h @@ -53,3 +53,6 @@ enum Config { NUMANTENNAS = 8, }; + +#define GTA3_1_1_PATCH FALSE +#define USE_PS2_RAND FALSE
\ No newline at end of file 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 diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp index bd4f7696..03ff6bb2 100644 --- a/src/render/Particle.cpp +++ b/src/render/Particle.cpp @@ -210,7 +210,7 @@ RwTexture * (&gpRainDropTex)[MAX_RAINDROP_FILES] = *(RwTexture * (*)[MAX_RA RwRaster *gpRainDropRaster[MAX_RAINDROP_FILES]; //Float CParticle::ms_afRandTable[CParticle::RAND_TABLE_SIZE]; // -Float (&CParticle::ms_afRandTable)[CParticle::RAND_TABLE_SIZE] = *(Float (*)[CParticle::RAND_TABLE_SIZE])*(int *)0x6E9878; +Float (&CParticle::ms_afRandTable)[CParticle::RAND_TABLE_SIZE] = *(Float (*)[CParticle::RAND_TABLE_SIZE])*(int *)0x6E98C8; CParticle *CParticle::m_pUnusedListHead; @@ -1853,7 +1853,6 @@ void CParticle::AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatr } STARTPATCHES -return; // causes crash, out temporarily //InjectHook(0x50C410, &CParticle::ctor, PATCH_JUMP); //InjectHook(0x50C420, &CParticle::dtor, PATCH_JUMP); InjectHook(0x50C430, CParticle::ReloadConfig, PATCH_JUMP); diff --git a/src/render/Shadows.cpp b/src/render/Shadows.cpp index 587dda99..81ba75aa 100644 --- a/src/render/Shadows.cpp +++ b/src/render/Shadows.cpp @@ -2,10 +2,6 @@ #include "patcher.h" #include "Shadows.h" -void CShadows::AddPermanentShadow(unsigned char ShadowType, RwTexture* pTexture, CVector* pPosn, float fX1, float fY1, float fX2, float fY2, short nTransparency, unsigned char nRed, unsigned char nGreen, unsigned char nBlue, float fZDistance, unsigned int nTime, float fScale) -{ - ((void (__cdecl *)(unsigned char, RwTexture*, CVector*, float, float, float, float, short, unsigned char, unsigned char, unsigned char, float, unsigned int, float))0x56EC50)(ShadowType, pTexture, pPosn, fX1, fY1, fX2, fY2, nTransparency, nRed, nGreen, nBlue, fZDistance, nTime, fScale); -} - +WRAPPER void CShadows::AddPermanentShadow(unsigned char ShadowType, RwTexture* pTexture, CVector* pPosn, float fX1, float fY1, float fX2, float fY2, short nTransparency, unsigned char nRed, unsigned char nGreen, unsigned char nBlue, float fZDistance, unsigned int nTime, float fScale) { EAXJMP(0x512FD0); } WRAPPER void CShadows::RenderStaticShadows(void) { EAXJMP(0x5145F0); } WRAPPER void CShadows::RenderStoredShadows(void) { EAXJMP(0x514010); } |