From 99d8e12207ee08e8727d0e20e9d81d77aef80d61 Mon Sep 17 00:00:00 2001 From: blingu <36486731+blingu@users.noreply.github.com> Date: Wed, 5 Aug 2020 14:28:12 +0200 Subject: [PATCH 01/16] added partial bsd support (FreeBSD) --- premake5.lua | 632 ++++++++++++++++++++++++++------------------------- 1 file changed, 326 insertions(+), 306 deletions(-) diff --git a/premake5.lua b/premake5.lua index c8190e15..dc64956d 100644 --- a/premake5.lua +++ b/premake5.lua @@ -1,308 +1,328 @@ -newoption { - trigger = "glewdir", - value = "PATH", - description = "Directory of GLEW", - default = "glew-2.1.0" -} - -newoption { - trigger = "glfwdir64", - value = "PATH", - description = "Directory of glfw", - default = "glfw-3.3.2.bin.WIN64", -} - -newoption { - trigger = "glfwdir32", - value = "PATH", - description = "Directory of glfw", - default = "glfw-3.3.2.bin.WIN32", -} - -newoption { - trigger = "with-librw", - description = "Build and use librw from this solution" -} - -newoption { - trigger = "with-opus", - description = "Build with opus" -} - -if(_OPTIONS["with-librw"]) then - Librw = "librw" -else - Librw = os.getenv("LIBRW") or "librw" -end - -function getsys(a) - if a == 'windows' then - return 'win' - end - return a -end - -function getarch(a) - if a == 'x86_64' then - return 'amd64' - elseif a == 'ARM' then - return 'arm' - end - return a -end - -workspace "re3" - language "C++" - configurations { "Debug", "Release" } - location "build" - symbols "Full" - staticruntime "off" - - filter { "system:windows" } - platforms { - "win-x86-RW33_d3d8-mss", - "win-x86-librw_d3d9-mss", - "win-x86-librw_gl3_glfw-mss", - "win-x86-RW33_d3d8-oal", - "win-x86-librw_d3d9-oal", - "win-x86-librw_gl3_glfw-oal", - "win-amd64-librw_d3d9-oal", - "win-amd64-librw_gl3_glfw-oal", - } - - filter { "system:linux" } - platforms { - "linux-x86-librw_gl3_glfw-oal", - "linux-amd64-librw_gl3_glfw-oal", - "linux-arm-librw_gl3_glfw-oal", - } - - filter "configurations:Debug" - defines { "DEBUG" } - - filter "configurations:Release" - defines { "NDEBUG" } - optimize "On" - - filter { "platforms:win*" } - system "windows" - - filter { "platforms:linux*" } - system "linux" - - filter { "platforms:*x86*" } - architecture "x86" - - filter { "platforms:*amd64*" } - architecture "amd64" - - filter { "platforms:*arm*" } - architecture "ARM" - - filter { "platforms:*librw_d3d9*" } - defines { "RW_D3D9" } - if(not _OPTIONS["with-librw"]) then - libdirs { path.join(Librw, "lib/win-%{getarch(cfg.architecture)}-d3d9/%{cfg.buildcfg}") } - end - - filter "platforms:*librw_gl3_glfw*" - defines { "RW_GL3" } - includedirs { path.join(_OPTIONS["glewdir"], "include") } - if(not _OPTIONS["with-librw"]) then - libdirs { path.join(Librw, "lib/%{getsys(cfg.system)}-%{getarch(cfg.architecture)}-gl3/%{cfg.buildcfg}") } - end - - filter "platforms:*x86-librw_gl3_glfw*" - includedirs { path.join(_OPTIONS["glfwdir32"], "include") } - - filter "platforms:*amd64-librw_gl3_glfw*" - includedirs { path.join(_OPTIONS["glfwdir64"], "include") } - - filter "platforms:win*librw_gl3_glfw*" - defines { "GLEW_STATIC" } - - filter {} - - function setpaths (gamepath, exepath, scriptspath) - scriptspath = scriptspath or "" - if (gamepath) then - postbuildcommands { - '{COPY} "%{cfg.buildtarget.abspath}" "' .. gamepath .. scriptspath .. '%{cfg.buildtarget.name}"' - } - debugdir (gamepath) - if (exepath) then - -- Used VS variable $(TargetFileName) because it doesn't accept premake tokens. Does debugcommand even work outside VS?? - debugcommand (gamepath .. "$(TargetFileName)") - dir, file = exepath:match'(.*/)(.*)' - debugdir (gamepath .. (dir or "")) - end - end - --targetdir ("bin/%{prj.name}/" .. scriptspath) - end - -if(_OPTIONS["with-librw"]) then -project "librw" - kind "StaticLib" - targetname "rw" - targetdir "lib/%{cfg.platform}/%{cfg.buildcfg}" - files { path.join(Librw, "src/*.*") } - files { path.join(Librw, "src/*/*.*") } - filter "platforms:*RW33*" - flags { "ExcludeFromBuild" } - filter {} -end - -local function addSrcFiles( prefix ) - return prefix .. "/*cpp", prefix .. "/*.h", prefix .. "/*.c", prefix .. "/*.ico", prefix .. "/*.rc" -end - -project "re3" - kind "WindowedApp" - targetname "re3" - targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}" - - files { addSrcFiles("src") } - files { addSrcFiles("src/animation") } +newoption { + trigger = "glewdir", + value = "PATH", + description = "Directory of GLEW", + default = "glew-2.1.0" +} + +newoption { + trigger = "glfwdir64", + value = "PATH", + description = "Directory of glfw", + default = "glfw-3.3.2.bin.WIN64", +} + +newoption { + trigger = "glfwdir32", + value = "PATH", + description = "Directory of glfw", + default = "glfw-3.3.2.bin.WIN32", +} + +newoption { + trigger = "with-librw", + description = "Build and use librw from this solution" +} + +newoption { + trigger = "with-opus", + description = "Build with opus" +} + +if(_OPTIONS["with-librw"]) then + Librw = "librw" +else + Librw = os.getenv("LIBRW") or "librw" +end + +function getsys(a) + if a == 'windows' then + return 'win' + end + return a +end + +function getarch(a) + if a == 'x86_64' then + return 'amd64' + elseif a == 'ARM' then + return 'arm' + end + return a +end + +workspace "re3" + language "C++" + configurations { "Debug", "Release" } + location "build" + symbols "Full" + staticruntime "off" + + filter { "system:windows" } + platforms { + "win-x86-RW33_d3d8-mss", + "win-x86-librw_d3d9-mss", + "win-x86-librw_gl3_glfw-mss", + "win-x86-RW33_d3d8-oal", + "win-x86-librw_d3d9-oal", + "win-x86-librw_gl3_glfw-oal", + "win-amd64-librw_d3d9-oal", + "win-amd64-librw_gl3_glfw-oal", + } + + filter { "system:linux" } + platforms { + "linux-x86-librw_gl3_glfw-oal", + "linux-amd64-librw_gl3_glfw-oal", + "linux-arm-librw_gl3_glfw-oal", + } + filter { "system:bsd" } + platforms { + "bsd-amd64-librw_gl3_glfw-oal" + } + + filter "configurations:Debug" + defines { "DEBUG" } + + filter "configurations:Release" + defines { "NDEBUG" } + optimize "On" + + filter { "platforms:win*" } + system "windows" + + filter { "platforms:linux*" } + system "linux" + + filter { "platforms:bsd*" } + system "bsd" + + filter { "platforms:*x86*" } + architecture "x86" + + filter { "platforms:*amd64*" } + architecture "amd64" + + filter { "platforms:*arm*" } + architecture "ARM" + + filter { "platforms:*librw_d3d9*" } + defines { "RW_D3D9" } + if(not _OPTIONS["with-librw"]) then + libdirs { path.join(Librw, "lib/win-%{getarch(cfg.architecture)}-d3d9/%{cfg.buildcfg}") } + end + + filter "platforms:*librw_gl3_glfw*" + defines { "RW_GL3" } + includedirs { path.join(_OPTIONS["glewdir"], "include") } + if(not _OPTIONS["with-librw"]) then + libdirs { path.join(Librw, "lib/%{getsys(cfg.system)}-%{getarch(cfg.architecture)}-gl3/%{cfg.buildcfg}") } + end + + filter "platforms:*x86-librw_gl3_glfw*" + includedirs { path.join(_OPTIONS["glfwdir32"], "include") } + + filter "platforms:*amd64-librw_gl3_glfw*" + includedirs { path.join(_OPTIONS["glfwdir64"], "include") } + + filter "platforms:win*librw_gl3_glfw*" + defines { "GLEW_STATIC" } + + filter {} + + function setpaths (gamepath, exepath, scriptspath) + scriptspath = scriptspath or "" + if (gamepath) then + postbuildcommands { + '{COPY} "%{cfg.buildtarget.abspath}" "' .. gamepath .. scriptspath .. '%{cfg.buildtarget.name}"' + } + debugdir (gamepath) + if (exepath) then + -- Used VS variable $(TargetFileName) because it doesn't accept premake tokens. Does debugcommand even work outside VS?? + debugcommand (gamepath .. "$(TargetFileName)") + dir, file = exepath:match'(.*/)(.*)' + debugdir (gamepath .. (dir or "")) + end + end + --targetdir ("bin/%{prj.name}/" .. scriptspath) + end + +if(_OPTIONS["with-librw"]) then +project "librw" + kind "StaticLib" + targetname "rw" + targetdir "lib/%{cfg.platform}/%{cfg.buildcfg}" + files { path.join(Librw, "src/*.*") } + files { path.join(Librw, "src/*/*.*") } + + filter "platforms:bsd*" + includedirs { "/usr/local/include" } + libdirs { "/usr/local/lib" } + + filter "platforms:*RW33*" + flags { "ExcludeFromBuild" } + filter {} +end + +local function addSrcFiles( prefix ) + return prefix .. "/*cpp", prefix .. "/*.h", prefix .. "/*.c", prefix .. "/*.ico", prefix .. "/*.rc" +end + +project "re3" + kind "WindowedApp" + targetname "re3" + targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}" + + files { addSrcFiles("src") } + files { addSrcFiles("src/animation") } files { addSrcFiles("src/audio") } - files { addSrcFiles("src/audio/eax") } - files { addSrcFiles("src/audio/oal") } - files { addSrcFiles("src/control") } - files { addSrcFiles("src/core") } - files { addSrcFiles("src/entities") } - files { addSrcFiles("src/math") } - files { addSrcFiles("src/modelinfo") } - files { addSrcFiles("src/objects") } - files { addSrcFiles("src/peds") } - files { addSrcFiles("src/render") } - files { addSrcFiles("src/rw") } - files { addSrcFiles("src/save") } - files { addSrcFiles("src/skel") } - files { addSrcFiles("src/skel/glfw") } - files { addSrcFiles("src/text") } - files { addSrcFiles("src/vehicles") } - files { addSrcFiles("src/weapons") } - files { addSrcFiles("src/extras") } - - includedirs { "src" } - includedirs { "src/animation" } + files { addSrcFiles("src/audio/eax") } + files { addSrcFiles("src/audio/oal") } + files { addSrcFiles("src/control") } + files { addSrcFiles("src/core") } + files { addSrcFiles("src/entities") } + files { addSrcFiles("src/math") } + files { addSrcFiles("src/modelinfo") } + files { addSrcFiles("src/objects") } + files { addSrcFiles("src/peds") } + files { addSrcFiles("src/render") } + files { addSrcFiles("src/rw") } + files { addSrcFiles("src/save") } + files { addSrcFiles("src/skel") } + files { addSrcFiles("src/skel/glfw") } + files { addSrcFiles("src/text") } + files { addSrcFiles("src/vehicles") } + files { addSrcFiles("src/weapons") } + files { addSrcFiles("src/extras") } + + includedirs { "src" } + includedirs { "src/animation" } includedirs { "src/audio" } - includedirs { "src/audio/eax" } - includedirs { "src/audio/oal" } - includedirs { "src/control" } - includedirs { "src/core" } - includedirs { "src/entities" } - includedirs { "src/math" } - includedirs { "src/modelinfo" } - includedirs { "src/objects" } - includedirs { "src/peds" } - includedirs { "src/render" } - includedirs { "src/rw" } - includedirs { "src/save/" } - includedirs { "src/skel/" } - includedirs { "src/skel/glfw" } - includedirs { "src/text" } - includedirs { "src/vehicles" } - includedirs { "src/weapons" } - includedirs { "src/extras" } - - if _OPTIONS["with-opus"] then - includedirs { "ogg/include" } - includedirs { "opus/include" } - includedirs { "opusfile/include" } - end - - filter "platforms:*mss" - defines { "AUDIO_MSS" } - includedirs { "sdk/milessdk/include" } - libdirs { "sdk/milessdk/lib" } - - if _OPTIONS["with-opus"] then - filter "platforms:win*" - libdirs { "ogg/win32/VS2015/Win32/%{cfg.buildcfg}" } - libdirs { "opus/win32/VS2015/Win32/%{cfg.buildcfg}" } - libdirs { "opusfile/win32/VS2015/Win32/Release-NoHTTP" } - filter {} - defines { "AUDIO_OPUS" } - end - - filter "platforms:*oal" - defines { "AUDIO_OAL" } - - filter {} - if(os.getenv("GTA_III_RE_DIR")) then - setpaths("$(GTA_III_RE_DIR)/", "%(cfg.buildtarget.name)", "") - end - - filter "platforms:win*" - files { addSrcFiles("src/skel/win") } - includedirs { "src/skel/win" } - linkoptions "/SAFESEH:NO" - characterset ("MBCS") - targetextension ".exe" - - filter "platforms:win-x86*oal" - includedirs { "openal-soft/include" } - includedirs { "libsndfile.32/include" } - includedirs { "mpg123.32/include" } - libdirs { "mpg123.32/lib" } - libdirs { "libsndfile.32/lib" } - libdirs { "openal-soft/libs/Win32" } - - filter "platforms:win-amd64*oal" - includedirs { "openal-soft/include" } - includedirs { "libsndfile.64/include" } - includedirs { "mpg123.64/include" } - libdirs { "mpg123.64/lib" } - libdirs { "libsndfile.64/lib" } - libdirs { "openal-soft/libs/Win64" } - - filter "platforms:linux*oal" - links { "openal", "mpg123", "sndfile", "pthread" } - - if _OPTIONS["with-opus"] then - filter {} - links { "libogg" } - links { "opus" } - links { "opusfile" } - end - - filter "platforms:*RW33*" - staticruntime "on" - includedirs { "sdk/rwsdk/include/d3d8" } - libdirs { "sdk/rwsdk/lib/d3d8/release" } - links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp", "rtquat", "rtcharse" } - defines { "RWLIBS" } - linkoptions "/SECTION:_rwcseg,ER!W /MERGE:_rwcseg=.text" - - filter "platforms:*librw*" - defines { "LIBRW" } - files { addSrcFiles("src/fakerw") } - includedirs { "src/fakerw" } - includedirs { Librw } - if(_OPTIONS["with-librw"]) then - libdirs { "lib/%{cfg.platform}/%{cfg.buildcfg}" } - end - links { "rw" } - - filter "platforms:*d3d9*" - links { "d3d9" } - - filter "platforms:*x86*d3d*" - includedirs { "sdk/dx8sdk/include" } - libdirs { "sdk/dx8sdk/lib" } - - filter "platforms:*amd64*d3d9*" - defines { "USE_D3D9" } - - filter "platforms:win-x86*gl3_glfw*" - libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/Win32") } - libdirs { path.join(_OPTIONS["glfwdir32"], "lib-" .. string.gsub(_ACTION or '', "vs", "vc")) } - links { "opengl32", "glew32s", "glfw3" } - - filter "platforms:win-amd64*gl3_glfw*" - libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/x64") } - libdirs { path.join(_OPTIONS["glfwdir64"], "lib-" .. string.gsub(_ACTION or '', "vs", "vc")) } - links { "opengl32", "glew32s", "glfw3" } - - filter "platforms:linux*gl3_glfw*" - links { "GL", "GLEW", "glfw" } + includedirs { "src/audio/eax" } + includedirs { "src/audio/oal" } + includedirs { "src/control" } + includedirs { "src/core" } + includedirs { "src/entities" } + includedirs { "src/math" } + includedirs { "src/modelinfo" } + includedirs { "src/objects" } + includedirs { "src/peds" } + includedirs { "src/render" } + includedirs { "src/rw" } + includedirs { "src/save/" } + includedirs { "src/skel/" } + includedirs { "src/skel/glfw" } + includedirs { "src/text" } + includedirs { "src/vehicles" } + includedirs { "src/weapons" } + includedirs { "src/extras" } + + if _OPTIONS["with-opus"] then + includedirs { "ogg/include" } + includedirs { "opus/include" } + includedirs { "opusfile/include" } + end + + filter "platforms:*mss" + defines { "AUDIO_MSS" } + includedirs { "sdk/milessdk/include" } + libdirs { "sdk/milessdk/lib" } + + if _OPTIONS["with-opus"] then + filter "platforms:win*" + libdirs { "ogg/win32/VS2015/Win32/%{cfg.buildcfg}" } + libdirs { "opus/win32/VS2015/Win32/%{cfg.buildcfg}" } + libdirs { "opusfile/win32/VS2015/Win32/Release-NoHTTP" } + filter {} + defines { "AUDIO_OPUS" } + end + + filter "platforms:*oal" + defines { "AUDIO_OAL" } + + filter {} + if(os.getenv("GTA_III_RE_DIR")) then + setpaths("$(GTA_III_RE_DIR)/", "%(cfg.buildtarget.name)", "") + end + + filter "platforms:win*" + files { addSrcFiles("src/skel/win") } + includedirs { "src/skel/win" } + linkoptions "/SAFESEH:NO" + characterset ("MBCS") + targetextension ".exe" + + filter "platforms:win-x86*oal" + includedirs { "openal-soft/include" } + includedirs { "libsndfile.32/include" } + includedirs { "mpg123.32/include" } + libdirs { "mpg123.32/lib" } + libdirs { "libsndfile.32/lib" } + libdirs { "openal-soft/libs/Win32" } + + filter "platforms:win-amd64*oal" + includedirs { "openal-soft/include" } + includedirs { "libsndfile.64/include" } + includedirs { "mpg123.64/include" } + libdirs { "mpg123.64/lib" } + libdirs { "libsndfile.64/lib" } + libdirs { "openal-soft/libs/Win64" } + + filter "platforms:linux*oal" + links { "openal", "mpg123", "sndfile", "pthread" } + + filter "platforms:linux*oal" + links { "openal", "mpg123", "sndfile", "pthread" } + + if _OPTIONS["with-opus"] then + filter {} + links { "libogg" } + links { "opus" } + links { "opusfile" } + end + + filter "platforms:*RW33*" + staticruntime "on" + includedirs { "sdk/rwsdk/include/d3d8" } + libdirs { "sdk/rwsdk/lib/d3d8/release" } + links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp", "rtquat", "rtcharse" } + defines { "RWLIBS" } + linkoptions "/SECTION:_rwcseg,ER!W /MERGE:_rwcseg=.text" + + filter "platforms:*librw*" + defines { "LIBRW" } + files { addSrcFiles("src/fakerw") } + includedirs { "src/fakerw" } + includedirs { Librw } + if(_OPTIONS["with-librw"]) then + libdirs { "lib/%{cfg.platform}/%{cfg.buildcfg}" } + end + links { "rw" } + + filter "platforms:*d3d9*" + links { "d3d9" } + + filter "platforms:*x86*d3d*" + includedirs { "sdk/dx8sdk/include" } + libdirs { "sdk/dx8sdk/lib" } + + filter "platforms:*amd64*d3d9*" + defines { "USE_D3D9" } + + filter "platforms:win-x86*gl3_glfw*" + libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/Win32") } + libdirs { path.join(_OPTIONS["glfwdir32"], "lib-" .. string.gsub(_ACTION or '', "vs", "vc")) } + links { "opengl32", "glew32s", "glfw3" } + + filter "platforms:win-amd64*gl3_glfw*" + libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/x64") } + libdirs { path.join(_OPTIONS["glfwdir64"], "lib-" .. string.gsub(_ACTION or '', "vs", "vc")) } + links { "opengl32", "glew32s", "glfw3" } + + filter "platforms:linux*gl3_glfw*" + links { "GL", "GLEW", "glfw" } + + filter "platforms:bsd*gl3_glfw*" + links { "GL", "GLEW", "glfw", "sysinfo" } + includedirs { "/usr/local/include" } + libdirs { "/usr/local/lib" } From 7a7b3527932d4ef5ff7d1676f8af022ae28cbdf5 Mon Sep 17 00:00:00 2001 From: blingu <36486731+blingu@users.noreply.github.com> Date: Wed, 5 Aug 2020 14:32:37 +0200 Subject: [PATCH 02/16] added FreeBSD support --- src/core/CdStreamPosix.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/core/CdStreamPosix.cpp b/src/core/CdStreamPosix.cpp index 45fd9832..ff36c18f 100644 --- a/src/core/CdStreamPosix.cpp +++ b/src/core/CdStreamPosix.cpp @@ -150,9 +150,11 @@ CdStreamInit(int32 numChannels) ASSERT(0); return; } - +#ifdef __linux__ _gdwCdStreamFlags = O_RDONLY | O_NOATIME; - +#elif __FreeBSD__ + _gdwCdStreamFlags = O_RDONLY; +#endif // People say it's slower /* if ( fsInfo.f_bsize <= CDSTREAM_SECTOR_SIZE ) @@ -400,9 +402,12 @@ void *CdStreamThread(void *param) if (gCdStreamThreadStatus == 0){ gCdStreamThreadStatus = 1; #endif + +#ifdef __linux__ pid_t tid = syscall(SYS_gettid); int ret = setpriority(PRIO_PROCESS, tid, getpriority(PRIO_PROCESS, getpid()) + 1); - } +#endif + } // spurious wakeup or we sent interrupt signal for flushing if(pChannel->nSectorsToRead == 0) From c4f9bfdc441fb0a0d6bfde208cd1f8192bacc880 Mon Sep 17 00:00:00 2001 From: blingu <36486731+blingu@users.noreply.github.com> Date: Wed, 5 Aug 2020 14:33:50 +0200 Subject: [PATCH 03/16] added FreeBSD support --- src/skel/glfw/glfw.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index a1170c61..643a9e64 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -209,7 +209,11 @@ double psTimer(void) { struct timespec start; +#ifdef __linux__ clock_gettime(CLOCK_MONOTONIC_RAW, &start); +#elif __FreeBSD__ + clock_gettime(CLOCK_MONOTONIC, &start); +#endif return start.tv_sec * 1000.0 + start.tv_nsec/1000000.0; } #endif From 56ea53a5db82887163eb76388ad936f71788490e Mon Sep 17 00:00:00 2001 From: blingu <36486731+blingu@users.noreply.github.com> Date: Wed, 5 Aug 2020 14:35:24 +0200 Subject: [PATCH 04/16] clang throws an error if fixed comparisons are against NULL --- src/audio/sampman_oal.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index 0e173152..5e4b5aba 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -587,16 +587,16 @@ cSampleManager::Initialise(void) } nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] = (uintptr)malloc(nSampleBankSize[SAMPLEBANK_MAIN]); - ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] != NULL); + ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] != 0); - if ( nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] == NULL ) + if ( nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] == 0 ) { Terminate(); return false; } nSampleBankMemoryStartAddress[SAMPLEBANK_PED] = (uintptr)malloc(PED_BLOCKSIZE*MAX_PEDSFX); - ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] != NULL); + ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] != 0); } From 47b7d4a53ab2dd824ce71e12aaf07d4cc595f091 Mon Sep 17 00:00:00 2001 From: blingu <36486731+blingu@users.noreply.github.com> Date: Wed, 5 Aug 2020 14:40:56 +0200 Subject: [PATCH 05/16] Update premake5.lua --- premake5.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/premake5.lua b/premake5.lua index dc64956d..8f5e9ad9 100644 --- a/premake5.lua +++ b/premake5.lua @@ -271,7 +271,7 @@ project "re3" filter "platforms:linux*oal" links { "openal", "mpg123", "sndfile", "pthread" } - filter "platforms:linux*oal" + filter "platforms:bsd*oal" links { "openal", "mpg123", "sndfile", "pthread" } if _OPTIONS["with-opus"] then From 4b6cc0188bcbfa0469d2d1d7ed674945e243b5cb Mon Sep 17 00:00:00 2001 From: blingu <36486731+blingu@users.noreply.github.com> Date: Fri, 7 Aug 2020 17:51:15 +0200 Subject: [PATCH 07/16] Update CdStreamPosix.cpp --- src/core/CdStreamPosix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/CdStreamPosix.cpp b/src/core/CdStreamPosix.cpp index ff36c18f..e114a29a 100644 --- a/src/core/CdStreamPosix.cpp +++ b/src/core/CdStreamPosix.cpp @@ -152,7 +152,7 @@ CdStreamInit(int32 numChannels) } #ifdef __linux__ _gdwCdStreamFlags = O_RDONLY | O_NOATIME; -#elif __FreeBSD__ +#else _gdwCdStreamFlags = O_RDONLY; #endif // People say it's slower From 8392b9ad2fc578fd42dc9b5fa27a5da175bf92f5 Mon Sep 17 00:00:00 2001 From: blingu <36486731+blingu@users.noreply.github.com> Date: Fri, 7 Aug 2020 17:51:43 +0200 Subject: [PATCH 08/16] Update glfw.cpp --- src/skel/glfw/glfw.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 643a9e64..ed442348 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -211,7 +211,7 @@ psTimer(void) struct timespec start; #ifdef __linux__ clock_gettime(CLOCK_MONOTONIC_RAW, &start); -#elif __FreeBSD__ +#else clock_gettime(CLOCK_MONOTONIC, &start); #endif return start.tv_sec * 1000.0 + start.tv_nsec/1000000.0; From ce0633a0c2370ad0e075ca5ae0a65bc7061cc65d Mon Sep 17 00:00:00 2001 From: withmorten Date: Fri, 7 Aug 2020 18:21:05 +0200 Subject: [PATCH 09/16] remove CoUninitialize calls for FIX_BUGS (fixes PIX crash) and don't check return value for CoInitialize --- src/skel/win/win.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 5c5c7ece..6d44ce80 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -1851,7 +1851,11 @@ void PlayMovieInWindow(int cmdShow, const char* szFile) MultiByteToWideChar(CP_ACP, 0, szFile, -1, wFileName, sizeof(wFileName) - 1); // Initialize COM +#ifdef FIX_BUGS // will also return S_FALSE if it has already been inited in the same thread + CoInitialize(nil); +#else JIF(CoInitialize(nil)); +#endif // Get the interface for DirectShow's GraphBuilder JIF(CoCreateInstance(CLSID_FilterGraph, nil, CLSCTX_INPROC, @@ -2225,7 +2229,9 @@ WinMain(HINSTANCE instance, { CloseClip(); - CoUninitialize(); +#ifndef FIX_BUGS + CoUninitialize(); // CoUninitialize should only be called at the shutdown of a program, and by then it doesn't matter +#endif if ( CMenuManager::OS_Language == LANG_FRENCH || CMenuManager::OS_Language == LANG_GERMAN ) PlayMovieInWindow(cmdShow, "movies\\GTAtitlesGER.mpg"); @@ -2260,7 +2266,9 @@ WinMain(HINSTANCE instance, case GS_INIT_ONCE: { CloseClip(); - CoUninitialize(); +#ifndef FIX_BUGS + CoUninitialize(); // CoUninitialize should only be called at the shutdown of a program, and by then it doesn't matter +#endif #ifdef FIX_BUGS // draw one frame because otherwise we'll end up looking at black screen for a while if vsync is on From 2af22cfabc6656c3278ab4eeb473eb4af57fe5f2 Mon Sep 17 00:00:00 2001 From: blingu <36486731+blingu@users.noreply.github.com> Date: Sat, 8 Aug 2020 12:49:38 +0200 Subject: [PATCH 10/16] Update premake5.lua --- premake5.lua | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/premake5.lua b/premake5.lua index 8f5e9ad9..f05a016d 100644 --- a/premake5.lua +++ b/premake5.lua @@ -76,10 +76,6 @@ workspace "re3" "linux-amd64-librw_gl3_glfw-oal", "linux-arm-librw_gl3_glfw-oal", } - filter { "system:bsd" } - platforms { - "bsd-amd64-librw_gl3_glfw-oal" - } filter "configurations:Debug" defines { "DEBUG" } @@ -93,9 +89,6 @@ workspace "re3" filter { "platforms:linux*" } system "linux" - - filter { "platforms:bsd*" } - system "bsd" filter { "platforms:*x86*" } architecture "x86" @@ -154,11 +147,6 @@ project "librw" targetdir "lib/%{cfg.platform}/%{cfg.buildcfg}" files { path.join(Librw, "src/*.*") } files { path.join(Librw, "src/*/*.*") } - - filter "platforms:bsd*" - includedirs { "/usr/local/include" } - libdirs { "/usr/local/lib" } - filter "platforms:*RW33*" flags { "ExcludeFromBuild" } filter {} @@ -271,9 +259,6 @@ project "re3" filter "platforms:linux*oal" links { "openal", "mpg123", "sndfile", "pthread" } - filter "platforms:bsd*oal" - links { "openal", "mpg123", "sndfile", "pthread" } - if _OPTIONS["with-opus"] then filter {} links { "libogg" } @@ -321,8 +306,3 @@ project "re3" filter "platforms:linux*gl3_glfw*" links { "GL", "GLEW", "glfw" } - - filter "platforms:bsd*gl3_glfw*" - links { "GL", "GLEW", "glfw", "sysinfo" } - includedirs { "/usr/local/include" } - libdirs { "/usr/local/lib" } From c50160a992237d5031c730d1048c9cef4d9ac611 Mon Sep 17 00:00:00 2001 From: Blingu Date: Sat, 8 Aug 2020 13:07:55 +0200 Subject: [PATCH 11/16] fixed line formatting --- premake5.lua | 633 ++++++++++++++++++++++++++------------------------- 1 file changed, 327 insertions(+), 306 deletions(-) diff --git a/premake5.lua b/premake5.lua index f05a016d..a84d8ff4 100644 --- a/premake5.lua +++ b/premake5.lua @@ -1,308 +1,329 @@ -newoption { - trigger = "glewdir", - value = "PATH", - description = "Directory of GLEW", - default = "glew-2.1.0" -} - -newoption { - trigger = "glfwdir64", - value = "PATH", - description = "Directory of glfw", - default = "glfw-3.3.2.bin.WIN64", -} - -newoption { - trigger = "glfwdir32", - value = "PATH", - description = "Directory of glfw", - default = "glfw-3.3.2.bin.WIN32", -} - -newoption { - trigger = "with-librw", - description = "Build and use librw from this solution" -} - -newoption { - trigger = "with-opus", - description = "Build with opus" -} - -if(_OPTIONS["with-librw"]) then - Librw = "librw" -else - Librw = os.getenv("LIBRW") or "librw" -end - -function getsys(a) - if a == 'windows' then - return 'win' - end - return a -end - -function getarch(a) - if a == 'x86_64' then - return 'amd64' - elseif a == 'ARM' then - return 'arm' - end - return a -end - -workspace "re3" - language "C++" - configurations { "Debug", "Release" } - location "build" - symbols "Full" - staticruntime "off" - - filter { "system:windows" } - platforms { - "win-x86-RW33_d3d8-mss", - "win-x86-librw_d3d9-mss", - "win-x86-librw_gl3_glfw-mss", - "win-x86-RW33_d3d8-oal", - "win-x86-librw_d3d9-oal", - "win-x86-librw_gl3_glfw-oal", - "win-amd64-librw_d3d9-oal", - "win-amd64-librw_gl3_glfw-oal", - } - - filter { "system:linux" } - platforms { - "linux-x86-librw_gl3_glfw-oal", - "linux-amd64-librw_gl3_glfw-oal", - "linux-arm-librw_gl3_glfw-oal", - } - - filter "configurations:Debug" - defines { "DEBUG" } - - filter "configurations:Release" - defines { "NDEBUG" } - optimize "On" - - filter { "platforms:win*" } - system "windows" - - filter { "platforms:linux*" } - system "linux" - - filter { "platforms:*x86*" } - architecture "x86" - - filter { "platforms:*amd64*" } - architecture "amd64" - - filter { "platforms:*arm*" } - architecture "ARM" - - filter { "platforms:*librw_d3d9*" } - defines { "RW_D3D9" } - if(not _OPTIONS["with-librw"]) then - libdirs { path.join(Librw, "lib/win-%{getarch(cfg.architecture)}-d3d9/%{cfg.buildcfg}") } - end - - filter "platforms:*librw_gl3_glfw*" - defines { "RW_GL3" } - includedirs { path.join(_OPTIONS["glewdir"], "include") } - if(not _OPTIONS["with-librw"]) then - libdirs { path.join(Librw, "lib/%{getsys(cfg.system)}-%{getarch(cfg.architecture)}-gl3/%{cfg.buildcfg}") } - end - - filter "platforms:*x86-librw_gl3_glfw*" - includedirs { path.join(_OPTIONS["glfwdir32"], "include") } - - filter "platforms:*amd64-librw_gl3_glfw*" - includedirs { path.join(_OPTIONS["glfwdir64"], "include") } - - filter "platforms:win*librw_gl3_glfw*" - defines { "GLEW_STATIC" } - - filter {} - - function setpaths (gamepath, exepath, scriptspath) - scriptspath = scriptspath or "" - if (gamepath) then - postbuildcommands { - '{COPY} "%{cfg.buildtarget.abspath}" "' .. gamepath .. scriptspath .. '%{cfg.buildtarget.name}"' - } - debugdir (gamepath) - if (exepath) then - -- Used VS variable $(TargetFileName) because it doesn't accept premake tokens. Does debugcommand even work outside VS?? - debugcommand (gamepath .. "$(TargetFileName)") - dir, file = exepath:match'(.*/)(.*)' - debugdir (gamepath .. (dir or "")) - end - end - --targetdir ("bin/%{prj.name}/" .. scriptspath) - end - -if(_OPTIONS["with-librw"]) then -project "librw" - kind "StaticLib" - targetname "rw" - targetdir "lib/%{cfg.platform}/%{cfg.buildcfg}" - files { path.join(Librw, "src/*.*") } - files { path.join(Librw, "src/*/*.*") } - filter "platforms:*RW33*" - flags { "ExcludeFromBuild" } - filter {} -end - -local function addSrcFiles( prefix ) - return prefix .. "/*cpp", prefix .. "/*.h", prefix .. "/*.c", prefix .. "/*.ico", prefix .. "/*.rc" -end - -project "re3" - kind "WindowedApp" - targetname "re3" - targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}" - - files { addSrcFiles("src") } - files { addSrcFiles("src/animation") } +newoption { + trigger = "glewdir", + value = "PATH", + description = "Directory of GLEW", + default = "glew-2.1.0" +} + +newoption { + trigger = "glfwdir64", + value = "PATH", + description = "Directory of glfw", + default = "glfw-3.3.2.bin.WIN64", +} + +newoption { + trigger = "glfwdir32", + value = "PATH", + description = "Directory of glfw", + default = "glfw-3.3.2.bin.WIN32", +} + +newoption { + trigger = "with-librw", + description = "Build and use librw from this solution" +} + +newoption { + trigger = "with-opus", + description = "Build with opus" +} + +if(_OPTIONS["with-librw"]) then + Librw = "librw" +else + Librw = os.getenv("LIBRW") or "librw" +end + +function getsys(a) + if a == 'windows' then + return 'win' + end + return a +end + +function getarch(a) + if a == 'x86_64' then + return 'amd64' + elseif a == 'ARM' then + return 'arm' + end + return a +end + +workspace "re3" + language "C++" + configurations { "Debug", "Release" } + location "build" + symbols "Full" + staticruntime "off" + + filter { "system:windows" } + platforms { + "win-x86-RW33_d3d8-mss", + "win-x86-librw_d3d9-mss", + "win-x86-librw_gl3_glfw-mss", + "win-x86-RW33_d3d8-oal", + "win-x86-librw_d3d9-oal", + "win-x86-librw_gl3_glfw-oal", + "win-amd64-librw_d3d9-oal", + "win-amd64-librw_gl3_glfw-oal", + } + + filter { "system:linux" } + platforms { + "linux-x86-librw_gl3_glfw-oal", + "linux-amd64-librw_gl3_glfw-oal", + "linux-arm-librw_gl3_glfw-oal", + } + + filter { "system:bsd" } + platforms { + "bsd-amd64-librw_gl3_glfw-oal" + } + + filter "configurations:Debug" + defines { "DEBUG" } + + filter "configurations:Release" + defines { "NDEBUG" } + optimize "On" + + filter { "platforms:win*" } + system "windows" + + filter { "platforms:linux*" } + system "linux" + + filter { "platforms:bsd*" } + system "bsd" + + filter { "platforms:*x86*" } + architecture "x86" + + filter { "platforms:*amd64*" } + architecture "amd64" + + filter { "platforms:*arm*" } + architecture "ARM" + + filter { "platforms:*librw_d3d9*" } + defines { "RW_D3D9" } + if(not _OPTIONS["with-librw"]) then + libdirs { path.join(Librw, "lib/win-%{getarch(cfg.architecture)}-d3d9/%{cfg.buildcfg}") } + end + + filter "platforms:*librw_gl3_glfw*" + defines { "RW_GL3" } + includedirs { path.join(_OPTIONS["glewdir"], "include") } + if(not _OPTIONS["with-librw"]) then + libdirs { path.join(Librw, "lib/%{getsys(cfg.system)}-%{getarch(cfg.architecture)}-gl3/%{cfg.buildcfg}") } + end + + filter "platforms:*x86-librw_gl3_glfw*" + includedirs { path.join(_OPTIONS["glfwdir32"], "include") } + + filter "platforms:*amd64-librw_gl3_glfw*" + includedirs { path.join(_OPTIONS["glfwdir64"], "include") } + + filter "platforms:win*librw_gl3_glfw*" + defines { "GLEW_STATIC" } + + filter {} + + function setpaths (gamepath, exepath, scriptspath) + scriptspath = scriptspath or "" + if (gamepath) then + postbuildcommands { + '{COPY} "%{cfg.buildtarget.abspath}" "' .. gamepath .. scriptspath .. '%{cfg.buildtarget.name}"' + } + debugdir (gamepath) + if (exepath) then + -- Used VS variable $(TargetFileName) because it doesn't accept premake tokens. Does debugcommand even work outside VS?? + debugcommand (gamepath .. "$(TargetFileName)") + dir, file = exepath:match'(.*/)(.*)' + debugdir (gamepath .. (dir or "")) + end + end + --targetdir ("bin/%{prj.name}/" .. scriptspath) + end + +if(_OPTIONS["with-librw"]) then +project "librw" + kind "StaticLib" + targetname "rw" + targetdir "lib/%{cfg.platform}/%{cfg.buildcfg}" + files { path.join(Librw, "src/*.*") } + files { path.join(Librw, "src/*/*.*") } + + filter "platforms:bsd*" + includedirs { "/usr/local/include" } + libdirs { "/usr/local/lib" } + + filter "platforms:*RW33*" + flags { "ExcludeFromBuild" } + filter {} +end + +local function addSrcFiles( prefix ) + return prefix .. "/*cpp", prefix .. "/*.h", prefix .. "/*.c", prefix .. "/*.ico", prefix .. "/*.rc" +end + +project "re3" + kind "WindowedApp" + targetname "re3" + targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}" + + files { addSrcFiles("src") } + files { addSrcFiles("src/animation") } files { addSrcFiles("src/audio") } - files { addSrcFiles("src/audio/eax") } - files { addSrcFiles("src/audio/oal") } - files { addSrcFiles("src/control") } - files { addSrcFiles("src/core") } - files { addSrcFiles("src/entities") } - files { addSrcFiles("src/math") } - files { addSrcFiles("src/modelinfo") } - files { addSrcFiles("src/objects") } - files { addSrcFiles("src/peds") } - files { addSrcFiles("src/render") } - files { addSrcFiles("src/rw") } - files { addSrcFiles("src/save") } - files { addSrcFiles("src/skel") } - files { addSrcFiles("src/skel/glfw") } - files { addSrcFiles("src/text") } - files { addSrcFiles("src/vehicles") } - files { addSrcFiles("src/weapons") } - files { addSrcFiles("src/extras") } - - includedirs { "src" } - includedirs { "src/animation" } + files { addSrcFiles("src/audio/eax") } + files { addSrcFiles("src/audio/oal") } + files { addSrcFiles("src/control") } + files { addSrcFiles("src/core") } + files { addSrcFiles("src/entities") } + files { addSrcFiles("src/math") } + files { addSrcFiles("src/modelinfo") } + files { addSrcFiles("src/objects") } + files { addSrcFiles("src/peds") } + files { addSrcFiles("src/render") } + files { addSrcFiles("src/rw") } + files { addSrcFiles("src/save") } + files { addSrcFiles("src/skel") } + files { addSrcFiles("src/skel/glfw") } + files { addSrcFiles("src/text") } + files { addSrcFiles("src/vehicles") } + files { addSrcFiles("src/weapons") } + files { addSrcFiles("src/extras") } + + includedirs { "src" } + includedirs { "src/animation" } includedirs { "src/audio" } - includedirs { "src/audio/eax" } - includedirs { "src/audio/oal" } - includedirs { "src/control" } - includedirs { "src/core" } - includedirs { "src/entities" } - includedirs { "src/math" } - includedirs { "src/modelinfo" } - includedirs { "src/objects" } - includedirs { "src/peds" } - includedirs { "src/render" } - includedirs { "src/rw" } - includedirs { "src/save/" } - includedirs { "src/skel/" } - includedirs { "src/skel/glfw" } - includedirs { "src/text" } - includedirs { "src/vehicles" } - includedirs { "src/weapons" } - includedirs { "src/extras" } - - if _OPTIONS["with-opus"] then - includedirs { "ogg/include" } - includedirs { "opus/include" } - includedirs { "opusfile/include" } - end - - filter "platforms:*mss" - defines { "AUDIO_MSS" } - includedirs { "sdk/milessdk/include" } - libdirs { "sdk/milessdk/lib" } - - if _OPTIONS["with-opus"] then - filter "platforms:win*" - libdirs { "ogg/win32/VS2015/Win32/%{cfg.buildcfg}" } - libdirs { "opus/win32/VS2015/Win32/%{cfg.buildcfg}" } - libdirs { "opusfile/win32/VS2015/Win32/Release-NoHTTP" } - filter {} - defines { "AUDIO_OPUS" } - end - - filter "platforms:*oal" - defines { "AUDIO_OAL" } - - filter {} - if(os.getenv("GTA_III_RE_DIR")) then - setpaths("$(GTA_III_RE_DIR)/", "%(cfg.buildtarget.name)", "") - end - - filter "platforms:win*" - files { addSrcFiles("src/skel/win") } - includedirs { "src/skel/win" } - linkoptions "/SAFESEH:NO" - characterset ("MBCS") - targetextension ".exe" - - filter "platforms:win-x86*oal" - includedirs { "openal-soft/include" } - includedirs { "libsndfile.32/include" } - includedirs { "mpg123.32/include" } - libdirs { "mpg123.32/lib" } - libdirs { "libsndfile.32/lib" } - libdirs { "openal-soft/libs/Win32" } - - filter "platforms:win-amd64*oal" - includedirs { "openal-soft/include" } - includedirs { "libsndfile.64/include" } - includedirs { "mpg123.64/include" } - libdirs { "mpg123.64/lib" } - libdirs { "libsndfile.64/lib" } - libdirs { "openal-soft/libs/Win64" } - - filter "platforms:linux*oal" - links { "openal", "mpg123", "sndfile", "pthread" } - - if _OPTIONS["with-opus"] then - filter {} - links { "libogg" } - links { "opus" } - links { "opusfile" } - end - - filter "platforms:*RW33*" - staticruntime "on" - includedirs { "sdk/rwsdk/include/d3d8" } - libdirs { "sdk/rwsdk/lib/d3d8/release" } - links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp", "rtquat", "rtcharse" } - defines { "RWLIBS" } - linkoptions "/SECTION:_rwcseg,ER!W /MERGE:_rwcseg=.text" - - filter "platforms:*librw*" - defines { "LIBRW" } - files { addSrcFiles("src/fakerw") } - includedirs { "src/fakerw" } - includedirs { Librw } - if(_OPTIONS["with-librw"]) then - libdirs { "lib/%{cfg.platform}/%{cfg.buildcfg}" } - end - links { "rw" } - - filter "platforms:*d3d9*" - links { "d3d9" } - - filter "platforms:*x86*d3d*" - includedirs { "sdk/dx8sdk/include" } - libdirs { "sdk/dx8sdk/lib" } - - filter "platforms:*amd64*d3d9*" - defines { "USE_D3D9" } - - filter "platforms:win-x86*gl3_glfw*" - libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/Win32") } - libdirs { path.join(_OPTIONS["glfwdir32"], "lib-" .. string.gsub(_ACTION or '', "vs", "vc")) } - links { "opengl32", "glew32s", "glfw3" } - - filter "platforms:win-amd64*gl3_glfw*" - libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/x64") } - libdirs { path.join(_OPTIONS["glfwdir64"], "lib-" .. string.gsub(_ACTION or '', "vs", "vc")) } - links { "opengl32", "glew32s", "glfw3" } - - filter "platforms:linux*gl3_glfw*" - links { "GL", "GLEW", "glfw" } + includedirs { "src/audio/eax" } + includedirs { "src/audio/oal" } + includedirs { "src/control" } + includedirs { "src/core" } + includedirs { "src/entities" } + includedirs { "src/math" } + includedirs { "src/modelinfo" } + includedirs { "src/objects" } + includedirs { "src/peds" } + includedirs { "src/render" } + includedirs { "src/rw" } + includedirs { "src/save/" } + includedirs { "src/skel/" } + includedirs { "src/skel/glfw" } + includedirs { "src/text" } + includedirs { "src/vehicles" } + includedirs { "src/weapons" } + includedirs { "src/extras" } + + if _OPTIONS["with-opus"] then + includedirs { "ogg/include" } + includedirs { "opus/include" } + includedirs { "opusfile/include" } + end + + filter "platforms:*mss" + defines { "AUDIO_MSS" } + includedirs { "sdk/milessdk/include" } + libdirs { "sdk/milessdk/lib" } + + if _OPTIONS["with-opus"] then + filter "platforms:win*" + libdirs { "ogg/win32/VS2015/Win32/%{cfg.buildcfg}" } + libdirs { "opus/win32/VS2015/Win32/%{cfg.buildcfg}" } + libdirs { "opusfile/win32/VS2015/Win32/Release-NoHTTP" } + filter {} + defines { "AUDIO_OPUS" } + end + + filter "platforms:*oal" + defines { "AUDIO_OAL" } + + filter {} + if(os.getenv("GTA_III_RE_DIR")) then + setpaths("$(GTA_III_RE_DIR)/", "%(cfg.buildtarget.name)", "") + end + + filter "platforms:win*" + files { addSrcFiles("src/skel/win") } + includedirs { "src/skel/win" } + linkoptions "/SAFESEH:NO" + characterset ("MBCS") + targetextension ".exe" + + filter "platforms:win-x86*oal" + includedirs { "openal-soft/include" } + includedirs { "libsndfile.32/include" } + includedirs { "mpg123.32/include" } + libdirs { "mpg123.32/lib" } + libdirs { "libsndfile.32/lib" } + libdirs { "openal-soft/libs/Win32" } + + filter "platforms:win-amd64*oal" + includedirs { "openal-soft/include" } + includedirs { "libsndfile.64/include" } + includedirs { "mpg123.64/include" } + libdirs { "mpg123.64/lib" } + libdirs { "libsndfile.64/lib" } + libdirs { "openal-soft/libs/Win64" } + + filter "platforms:linux*oal" + links { "openal", "mpg123", "sndfile", "pthread" } + + filter "platforms:bsd*oal" + links { "openal", "mpg123", "sndfile", "pthread" } + + if _OPTIONS["with-opus"] then + filter {} + links { "libogg" } + links { "opus" } + links { "opusfile" } + end + + filter "platforms:*RW33*" + staticruntime "on" + includedirs { "sdk/rwsdk/include/d3d8" } + libdirs { "sdk/rwsdk/lib/d3d8/release" } + links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp", "rtquat", "rtcharse" } + defines { "RWLIBS" } + linkoptions "/SECTION:_rwcseg,ER!W /MERGE:_rwcseg=.text" + + filter "platforms:*librw*" + defines { "LIBRW" } + files { addSrcFiles("src/fakerw") } + includedirs { "src/fakerw" } + includedirs { Librw } + if(_OPTIONS["with-librw"]) then + libdirs { "lib/%{cfg.platform}/%{cfg.buildcfg}" } + end + links { "rw" } + + filter "platforms:*d3d9*" + links { "d3d9" } + + filter "platforms:*x86*d3d*" + includedirs { "sdk/dx8sdk/include" } + libdirs { "sdk/dx8sdk/lib" } + + filter "platforms:*amd64*d3d9*" + defines { "USE_D3D9" } + + filter "platforms:win-x86*gl3_glfw*" + libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/Win32") } + libdirs { path.join(_OPTIONS["glfwdir32"], "lib-" .. string.gsub(_ACTION or '', "vs", "vc")) } + links { "opengl32", "glew32s", "glfw3" } + + filter "platforms:win-amd64*gl3_glfw*" + libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/x64") } + libdirs { path.join(_OPTIONS["glfwdir64"], "lib-" .. string.gsub(_ACTION or '', "vs", "vc")) } + links { "opengl32", "glew32s", "glfw3" } + + filter "platforms:linux*gl3_glfw*" + links { "GL", "GLEW", "glfw" } + + filter "platforms:bsd*gl3_glfw*" + links { "GL", "GLEW", "glfw", "sysinfo" } + includedirs { "/usr/local/include" } + libdirs { "/usr/local/lib" } From 24a1644b2a1f4cd0b20385fd29acd7be9808e027 Mon Sep 17 00:00:00 2001 From: withmorten Date: Sat, 8 Aug 2020 17:12:23 +0200 Subject: [PATCH 12/16] don't CoUninitialize for NO_MOVIES --- src/skel/win/win.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 6d44ce80..cf4749b1 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -2227,10 +2227,9 @@ WinMain(HINSTANCE instance, case GS_INIT_INTRO_MPEG: { +#ifndef NO_MOVIES CloseClip(); - -#ifndef FIX_BUGS - CoUninitialize(); // CoUninitialize should only be called at the shutdown of a program, and by then it doesn't matter + CoUninitialize(); #endif if ( CMenuManager::OS_Language == LANG_FRENCH || CMenuManager::OS_Language == LANG_GERMAN ) @@ -2265,9 +2264,9 @@ WinMain(HINSTANCE instance, case GS_INIT_ONCE: { +#ifndef NO_MOVIES CloseClip(); -#ifndef FIX_BUGS - CoUninitialize(); // CoUninitialize should only be called at the shutdown of a program, and by then it doesn't matter + CoUninitialize(); #endif #ifdef FIX_BUGS From 5dc7ff98f2b14985693524a7a660990268f30095 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 9 Aug 2020 13:17:05 +0200 Subject: [PATCH 13/16] corona fixes --- src/render/Coronas.cpp | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp index 5bf89403..d2d229f9 100644 --- a/src/render/Coronas.cpp +++ b/src/render/Coronas.cpp @@ -255,7 +255,10 @@ CCoronas::Render(void) CVector spriteCoors; float spritew, spriteh; - if(CSprite::CalcScreenCoors(aCoronas[i].coors, spriteCoors, &spritew, &spriteh, true)){ + if(!CSprite::CalcScreenCoors(aCoronas[i].coors, spriteCoors, &spritew, &spriteh, true)){ + aCoronas[i].offScreen = true; + aCoronas[i].sightClear = false; + }else{ aCoronas[i].offScreen = false; if(spriteCoors.x < 0.0f || spriteCoors.y < 0.0f || @@ -289,10 +292,7 @@ CCoronas::Render(void) } - if(aCoronas[i].fadeAlpha == 0) - continue; - - if(spriteCoors.z < aCoronas[i].drawDist){ + if(aCoronas[i].fadeAlpha && spriteCoors.z < aCoronas[i].drawDist){ float recipz = 1.0f/spriteCoors.z; float fadeDistance = aCoronas[i].drawDist / 2.0f; float distanceFade = spriteCoors.z < fadeDistance ? 1.0f : 1.0f - (spriteCoors.z - fadeDistance)/fadeDistance; @@ -367,9 +367,6 @@ CCoronas::Render(void) recipz, 255); } } - }else{ - aCoronas[i].offScreen = true; - aCoronas[i].sightClear = false; } } } @@ -390,23 +387,24 @@ CCoronas::Render(void) if(!aCoronas[i].hasValue[j] || !aCoronas[i].hasValue[j+1]) continue; - int mod1 = (float)(6 - j) / 6 * 128; - int mod2 = (float)(6 - (j+1)) / 6 * 128; + int alpha1 = (float)(6 - j) / 6 * 128; + int alpha2 = (float)(6 - (j+1)) / 6 * 128; RwIm2DVertexSetScreenX(&vertexbufferX[0], aCoronas[i].prevX[j]); RwIm2DVertexSetScreenY(&vertexbufferX[0], aCoronas[i].prevY[j]); - RwIm2DVertexSetIntRGBA(&vertexbufferX[0], aCoronas[i].prevRed[j] * mod1 / 256, aCoronas[i].prevGreen[j] * mod1 / 256, aCoronas[i].prevBlue[j] * mod1 / 256, 255); + RwIm2DVertexSetIntRGBA(&vertexbufferX[0], aCoronas[i].prevRed[j] * alpha1 / 256, aCoronas[i].prevGreen[j] * alpha1 / 256, aCoronas[i].prevBlue[j] * alpha1 / 256, 255); RwIm2DVertexSetScreenX(&vertexbufferX[1], aCoronas[i].prevX[j+1]); RwIm2DVertexSetScreenY(&vertexbufferX[1], aCoronas[i].prevY[j+1]); - RwIm2DVertexSetIntRGBA(&vertexbufferX[1], aCoronas[i].prevRed[j+1] * mod2 / 256, aCoronas[i].prevGreen[j+1] * mod2 / 256, aCoronas[i].prevBlue[j+1] * mod2 / 256, 255); + RwIm2DVertexSetIntRGBA(&vertexbufferX[1], aCoronas[i].prevRed[j+1] * alpha2 / 256, aCoronas[i].prevGreen[j+1] * alpha2 / 256, aCoronas[i].prevBlue[j+1] * alpha2 / 256, 255); - // BUG: game doesn't do this +#ifdef FIX_BUGS RwIm2DVertexSetScreenZ(&vertexbufferX[0], RwIm2DGetNearScreenZ()); RwIm2DVertexSetCameraZ(&vertexbufferX[0], RwCameraGetNearClipPlane(Scene.camera)); RwIm2DVertexSetRecipCameraZ(&vertexbufferX[0], 1.0f/RwCameraGetNearClipPlane(Scene.camera)); RwIm2DVertexSetScreenZ(&vertexbufferX[1], RwIm2DGetNearScreenZ()); RwIm2DVertexSetCameraZ(&vertexbufferX[1], RwCameraGetNearClipPlane(Scene.camera)); RwIm2DVertexSetRecipCameraZ(&vertexbufferX[1], 1.0f/RwCameraGetNearClipPlane(Scene.camera)); +#endif RwIm2DRenderLine(vertexbufferX, 2, 0, 1); } @@ -425,6 +423,10 @@ CCoronas::RenderReflections(void) CEntity *entity; if(CWeather::WetRoads > 0.0f){ +#ifdef FIX_BUGS + CSprite::InitSpriteBuffer(); +#endif + RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); @@ -435,7 +437,8 @@ CCoronas::RenderReflections(void) for(i = 0; i < NUMCORONAS; i++){ if(aCoronas[i].id == 0 || - aCoronas[i].fadeAlpha == 0 && aCoronas[i].alpha == 0) + aCoronas[i].fadeAlpha == 0 && aCoronas[i].alpha == 0 || + aCoronas[i].reflection == 0) continue; // check if we want a reflection on this corona @@ -450,11 +453,8 @@ CCoronas::RenderReflections(void) } } - if(!aCoronas[i].renderReflection) - continue; - // Don't draw if reflection is too high - if(aCoronas[i].heightAboveRoad < 20.0f){ + if(aCoronas[i].renderReflection && aCoronas[i].heightAboveRoad < 20.0f){ // don't draw if camera is below road if(CCoronas::aCoronas[i].coors.z - aCoronas[i].heightAboveRoad > TheCamera.GetPosition().z) continue; @@ -466,13 +466,14 @@ CCoronas::RenderReflections(void) float spritew, spriteh; if(CSprite::CalcScreenCoors(coors, spriteCoors, &spritew, &spriteh, true)){ float drawDist = 0.75f * aCoronas[i].drawDist; - drawDist = Min(drawDist, 50.0f); + drawDist = Min(drawDist, 55.0f); if(spriteCoors.z < drawDist){ float fadeDistance = drawDist / 2.0f; float distanceFade = spriteCoors.z < fadeDistance ? 1.0f : 1.0f - (spriteCoors.z - fadeDistance)/fadeDistance; distanceFade = clamp(distanceFade, 0.0f, 1.0f); float recipz = 1.0f/RwCameraGetNearClipPlane(Scene.camera); - int intensity = (20.0f - aCoronas[i].heightAboveRoad) * 230.0 * distanceFade*CWeather::WetRoads * 0.05f; + float heightFade = (20.0f - aCoronas[i].heightAboveRoad)/20.0f; + int intensity = distanceFade*heightFade * 230.0 * CWeather::WetRoads; CSprite::RenderBufferedOneXLUSprite( spriteCoors.x, spriteCoors.y, RwIm2DGetNearScreenZ(), From 59d25d3ad8271ec46326a8e69e692e231a4eb076 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 9 Aug 2020 15:45:54 +0200 Subject: [PATCH 14/16] pointlight fixes --- src/render/PointLights.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/render/PointLights.cpp b/src/render/PointLights.cpp index 88b9aaea..0713dc6d 100644 --- a/src/render/PointLights.cpp +++ b/src/render/PointLights.cpp @@ -86,12 +86,11 @@ CPointLights::GenerateLightsAffectingObject(Const CVector *objCoors) ret *= distNorm; }else{ float intensity; + // distance fade if(distNorm < 0.5f) - // near enough intensity = 1.0f; else - // attenuate - intensity = 1.0f - (distNorm - 0.5f)*2.0f; + intensity = 1.0f - (distNorm - 0.5f)/(1.0f - 0.5f); if(distance != 0.0f){ CVector dir = dist / distance; @@ -153,7 +152,7 @@ CPointLights::RenderFogEffect(void) if(aLights[i].fogType != FOG_NORMAL && aLights[i].fogType != FOG_ALWAYS) continue; - fogginess = aLights[i].fogType == FOG_ALWAYS ? 1.0f : CWeather::Foggyness; + fogginess = aLights[i].fogType == FOG_NORMAL ? CWeather::Foggyness : 1.0f; if(fogginess == 0.0f) continue; @@ -198,7 +197,7 @@ CPointLights::RenderFogEffect(void) float distsq = sq(dx) + sq(dy); float linedistsq = distsq - sq(dot); if(dot > 0.0f && dot < FOG_AREA_LENGTH && linedistsq < sq(FOG_AREA_WIDTH)){ - CVector fogcoors(xi, yi, aLights[i].coors.z + 1.0f); + CVector fogcoors(xi, yi, aLights[i].coors.z + 10.0f); if(CWorld::ProcessVerticalLine(fogcoors, fogcoors.z - 20.0f, point, entity, true, false, false, false, true, false, nil)){ // Now same check again in xyz @@ -220,7 +219,7 @@ CPointLights::RenderFogEffect(void) intensity *= 1.0f - sq(Sqrt(linedistsq) / FOG_AREA_WIDTH); if(CSprite::CalcScreenCoors(fogcoors, spriteCoors, &spritew, &spriteh, true)){ - float rotation = (CTimer::GetTimeInMilliseconds()&0x1FFF) * 2*3.14f / 0x1FFF; + float rotation = (CTimer::GetTimeInMilliseconds()&0x1FFF) * 2*3.14f / 0x2000; float size = FogSizes[r>>1]; CSprite::RenderOneXLUSprite_Rotate_Aspect(spriteCoors.x, spriteCoors.y, spriteCoors.z, spritew * size, spriteh * size, @@ -269,7 +268,7 @@ CPointLights::RenderFogEffect(void) CVector fogcoors(xi, yi, point.point.z + 1.6f); if(CSprite::CalcScreenCoors(fogcoors, spriteCoors, &spritew, &spriteh, true)){ - float rotation = (CTimer::GetTimeInMilliseconds()&0x3FFF) * 2*3.14f / 0x3FFF; + float rotation = (CTimer::GetTimeInMilliseconds()&0x3FFF) * 2*3.14f / 0x4000; float size = FogSizes[r>>1]; CSprite::RenderOneXLUSprite_Rotate_Aspect(spriteCoors.x, spriteCoors.y, spriteCoors.z, spritew * size, spriteh * size, From a149d9d511e432fbaa36382407fd14a8524c9e59 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 9 Aug 2020 19:32:32 +0200 Subject: [PATCH 15/16] little timecycle cleanup --- src/render/Timecycle.cpp | 120 +++++++++++++-------------- src/render/Timecycle.h | 172 +++++++++++++++++++-------------------- 2 files changed, 146 insertions(+), 146 deletions(-) diff --git a/src/render/Timecycle.cpp b/src/render/Timecycle.cpp index 162983dd..0d94dbd6 100644 --- a/src/render/Timecycle.cpp +++ b/src/render/Timecycle.cpp @@ -10,42 +10,42 @@ #include "FileMgr.h" #include "Timecycle.h" -int CTimeCycle::m_nAmbientRed[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nAmbientGreen[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nAmbientBlue[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nDirectionalRed[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nDirectionalGreen[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nDirectionalBlue[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nSkyTopRed[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nSkyTopGreen[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nSkyTopBlue[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nSkyBottomRed[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nSunCoreRed[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nSunCoreGreen[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nSunCoreBlue[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nSunCoronaRed[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nAmbientRed[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nAmbientGreen[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nAmbientBlue[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nDirectionalRed[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nDirectionalGreen[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nDirectionalBlue[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nSkyTopRed[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nSkyTopGreen[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nSkyTopBlue[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nSkyBottomRed[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nSunCoreRed[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nSunCoreGreen[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nSunCoreBlue[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nSunCoronaRed[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS]; float CTimeCycle::m_fSunSize[NUMHOURS][NUMWEATHERS]; float CTimeCycle::m_fSpriteSize[NUMHOURS][NUMWEATHERS]; float CTimeCycle::m_fSpriteBrightness[NUMHOURS][NUMWEATHERS]; -short CTimeCycle::m_nShadowStrength[NUMHOURS][NUMWEATHERS]; -short CTimeCycle::m_nLightShadowStrength[NUMHOURS][NUMWEATHERS]; -short CTimeCycle::m_nTreeShadowStrength[NUMHOURS][NUMWEATHERS]; +int16 CTimeCycle::m_nShadowStrength[NUMHOURS][NUMWEATHERS]; +int16 CTimeCycle::m_nLightShadowStrength[NUMHOURS][NUMWEATHERS]; +int16 CTimeCycle::m_nTreeShadowStrength[NUMHOURS][NUMWEATHERS]; float CTimeCycle::m_fFogStart[NUMHOURS][NUMWEATHERS]; float CTimeCycle::m_fFarClip[NUMHOURS][NUMWEATHERS]; float CTimeCycle::m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nLowCloudsRed[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS]; -int CTimeCycle::m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nLowCloudsRed[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS]; +int32 CTimeCycle::m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS]; float CTimeCycle::m_fBlurRed[NUMHOURS][NUMWEATHERS]; float CTimeCycle::m_fBlurGreen[NUMHOURS][NUMWEATHERS]; float CTimeCycle::m_fBlurBlue[NUMHOURS][NUMWEATHERS]; @@ -57,47 +57,47 @@ float CTimeCycle::m_fCurrentAmbientBlue; float CTimeCycle::m_fCurrentDirectionalRed; float CTimeCycle::m_fCurrentDirectionalGreen; float CTimeCycle::m_fCurrentDirectionalBlue; -int CTimeCycle::m_nCurrentSkyTopRed; -int CTimeCycle::m_nCurrentSkyTopGreen; -int CTimeCycle::m_nCurrentSkyTopBlue; -int CTimeCycle::m_nCurrentSkyBottomRed; -int CTimeCycle::m_nCurrentSkyBottomGreen; -int CTimeCycle::m_nCurrentSkyBottomBlue; -int CTimeCycle::m_nCurrentSunCoreRed; -int CTimeCycle::m_nCurrentSunCoreGreen; -int CTimeCycle::m_nCurrentSunCoreBlue; -int CTimeCycle::m_nCurrentSunCoronaRed; -int CTimeCycle::m_nCurrentSunCoronaGreen; -int CTimeCycle::m_nCurrentSunCoronaBlue; +int32 CTimeCycle::m_nCurrentSkyTopRed; +int32 CTimeCycle::m_nCurrentSkyTopGreen; +int32 CTimeCycle::m_nCurrentSkyTopBlue; +int32 CTimeCycle::m_nCurrentSkyBottomRed; +int32 CTimeCycle::m_nCurrentSkyBottomGreen; +int32 CTimeCycle::m_nCurrentSkyBottomBlue; +int32 CTimeCycle::m_nCurrentSunCoreRed; +int32 CTimeCycle::m_nCurrentSunCoreGreen; +int32 CTimeCycle::m_nCurrentSunCoreBlue; +int32 CTimeCycle::m_nCurrentSunCoronaRed; +int32 CTimeCycle::m_nCurrentSunCoronaGreen; +int32 CTimeCycle::m_nCurrentSunCoronaBlue; float CTimeCycle::m_fCurrentSunSize; float CTimeCycle::m_fCurrentSpriteSize; float CTimeCycle::m_fCurrentSpriteBrightness; -int CTimeCycle::m_nCurrentShadowStrength; -int CTimeCycle::m_nCurrentLightShadowStrength; -int CTimeCycle::m_nCurrentTreeShadowStrength; +int32 CTimeCycle::m_nCurrentShadowStrength; +int32 CTimeCycle::m_nCurrentLightShadowStrength; +int32 CTimeCycle::m_nCurrentTreeShadowStrength; float CTimeCycle::m_fCurrentFogStart; float CTimeCycle::m_fCurrentFarClip; float CTimeCycle::m_fCurrentLightsOnGroundBrightness; -int CTimeCycle::m_nCurrentLowCloudsRed; -int CTimeCycle::m_nCurrentLowCloudsGreen; -int CTimeCycle::m_nCurrentLowCloudsBlue; -int CTimeCycle::m_nCurrentFluffyCloudsTopRed; -int CTimeCycle::m_nCurrentFluffyCloudsTopGreen; -int CTimeCycle::m_nCurrentFluffyCloudsTopBlue; -int CTimeCycle::m_nCurrentFluffyCloudsBottomRed; -int CTimeCycle::m_nCurrentFluffyCloudsBottomGreen; -int CTimeCycle::m_nCurrentFluffyCloudsBottomBlue; +int32 CTimeCycle::m_nCurrentLowCloudsRed; +int32 CTimeCycle::m_nCurrentLowCloudsGreen; +int32 CTimeCycle::m_nCurrentLowCloudsBlue; +int32 CTimeCycle::m_nCurrentFluffyCloudsTopRed; +int32 CTimeCycle::m_nCurrentFluffyCloudsTopGreen; +int32 CTimeCycle::m_nCurrentFluffyCloudsTopBlue; +int32 CTimeCycle::m_nCurrentFluffyCloudsBottomRed; +int32 CTimeCycle::m_nCurrentFluffyCloudsBottomGreen; +int32 CTimeCycle::m_nCurrentFluffyCloudsBottomBlue; float CTimeCycle::m_fCurrentBlurRed; float CTimeCycle::m_fCurrentBlurGreen; float CTimeCycle::m_fCurrentBlurBlue; float CTimeCycle::m_fCurrentBlurAlpha; -int CTimeCycle::m_nCurrentFogColourRed; -int CTimeCycle::m_nCurrentFogColourGreen; -int CTimeCycle::m_nCurrentFogColourBlue; +int32 CTimeCycle::m_nCurrentFogColourRed; +int32 CTimeCycle::m_nCurrentFogColourGreen; +int32 CTimeCycle::m_nCurrentFogColourBlue; -int CTimeCycle::m_FogReduction; +int32 CTimeCycle::m_FogReduction; -int CTimeCycle::m_CurrentStoredValue; +int32 CTimeCycle::m_CurrentStoredValue; CVector CTimeCycle::m_VectorToSun[16]; float CTimeCycle::m_fShadowFrontX[16]; float CTimeCycle::m_fShadowFrontY[16]; @@ -227,7 +227,7 @@ CTimeCycle::Update(void) float c2 = (1.0f-timeInterp) * CWeather::InterpolationValue; float c3 = timeInterp * CWeather::InterpolationValue; -#define INTERP(v) v[h1][w1]*c0 + v[h2][w1]*c1 + v[h1][w2]*c2 + v[h2][w2]*c3; +#define INTERP(v) v[h1][w1]*c0 + v[h2][w1]*c1 + v[h1][w2]*c2 + v[h2][w2]*c3 m_nCurrentSkyTopRed = INTERP(m_nSkyTopRed); m_nCurrentSkyTopGreen = INTERP(m_nSkyTopGreen); diff --git a/src/render/Timecycle.h b/src/render/Timecycle.h index 0cb02b67..d5d7b67a 100644 --- a/src/render/Timecycle.h +++ b/src/render/Timecycle.h @@ -2,42 +2,42 @@ class CTimeCycle { - static int m_nAmbientRed[NUMHOURS][NUMWEATHERS]; - static int m_nAmbientGreen[NUMHOURS][NUMWEATHERS]; - static int m_nAmbientBlue[NUMHOURS][NUMWEATHERS]; - static int m_nDirectionalRed[NUMHOURS][NUMWEATHERS]; - static int m_nDirectionalGreen[NUMHOURS][NUMWEATHERS]; - static int m_nDirectionalBlue[NUMHOURS][NUMWEATHERS]; - static int m_nSkyTopRed[NUMHOURS][NUMWEATHERS]; - static int m_nSkyTopGreen[NUMHOURS][NUMWEATHERS]; - static int m_nSkyTopBlue[NUMHOURS][NUMWEATHERS]; - static int m_nSkyBottomRed[NUMHOURS][NUMWEATHERS]; - static int m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS]; - static int m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS]; - static int m_nSunCoreRed[NUMHOURS][NUMWEATHERS]; - static int m_nSunCoreGreen[NUMHOURS][NUMWEATHERS]; - static int m_nSunCoreBlue[NUMHOURS][NUMWEATHERS]; - static int m_nSunCoronaRed[NUMHOURS][NUMWEATHERS]; - static int m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS]; - static int m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS]; + static int32 m_nAmbientRed[NUMHOURS][NUMWEATHERS]; + static int32 m_nAmbientGreen[NUMHOURS][NUMWEATHERS]; + static int32 m_nAmbientBlue[NUMHOURS][NUMWEATHERS]; + static int32 m_nDirectionalRed[NUMHOURS][NUMWEATHERS]; + static int32 m_nDirectionalGreen[NUMHOURS][NUMWEATHERS]; + static int32 m_nDirectionalBlue[NUMHOURS][NUMWEATHERS]; + static int32 m_nSkyTopRed[NUMHOURS][NUMWEATHERS]; + static int32 m_nSkyTopGreen[NUMHOURS][NUMWEATHERS]; + static int32 m_nSkyTopBlue[NUMHOURS][NUMWEATHERS]; + static int32 m_nSkyBottomRed[NUMHOURS][NUMWEATHERS]; + static int32 m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS]; + static int32 m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS]; + static int32 m_nSunCoreRed[NUMHOURS][NUMWEATHERS]; + static int32 m_nSunCoreGreen[NUMHOURS][NUMWEATHERS]; + static int32 m_nSunCoreBlue[NUMHOURS][NUMWEATHERS]; + static int32 m_nSunCoronaRed[NUMHOURS][NUMWEATHERS]; + static int32 m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS]; + static int32 m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS]; static float m_fSunSize[NUMHOURS][NUMWEATHERS]; static float m_fSpriteSize[NUMHOURS][NUMWEATHERS]; static float m_fSpriteBrightness[NUMHOURS][NUMWEATHERS]; - static short m_nShadowStrength[NUMHOURS][NUMWEATHERS]; - static short m_nLightShadowStrength[NUMHOURS][NUMWEATHERS]; - static short m_nTreeShadowStrength[NUMHOURS][NUMWEATHERS]; + static int16 m_nShadowStrength[NUMHOURS][NUMWEATHERS]; + static int16 m_nLightShadowStrength[NUMHOURS][NUMWEATHERS]; + static int16 m_nTreeShadowStrength[NUMHOURS][NUMWEATHERS]; static float m_fFogStart[NUMHOURS][NUMWEATHERS]; static float m_fFarClip[NUMHOURS][NUMWEATHERS]; static float m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS]; - static int m_nLowCloudsRed[NUMHOURS][NUMWEATHERS]; - static int m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS]; - static int m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS]; - static int m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS]; - static int m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS]; - static int m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS]; - static int m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS]; - static int m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS]; - static int m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS]; + static int32 m_nLowCloudsRed[NUMHOURS][NUMWEATHERS]; + static int32 m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS]; + static int32 m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS]; + static int32 m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS]; + static int32 m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS]; + static int32 m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS]; + static int32 m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS]; + static int32 m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS]; + static int32 m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS]; static float m_fBlurRed[NUMHOURS][NUMWEATHERS]; static float m_fBlurGreen[NUMHOURS][NUMWEATHERS]; static float m_fBlurBlue[NUMHOURS][NUMWEATHERS]; @@ -49,48 +49,48 @@ class CTimeCycle static float m_fCurrentDirectionalRed; static float m_fCurrentDirectionalGreen; static float m_fCurrentDirectionalBlue; - static int m_nCurrentSkyTopRed; - static int m_nCurrentSkyTopGreen; - static int m_nCurrentSkyTopBlue; - static int m_nCurrentSkyBottomRed; - static int m_nCurrentSkyBottomGreen; - static int m_nCurrentSkyBottomBlue; - static int m_nCurrentSunCoreRed; - static int m_nCurrentSunCoreGreen; - static int m_nCurrentSunCoreBlue; - static int m_nCurrentSunCoronaRed; - static int m_nCurrentSunCoronaGreen; - static int m_nCurrentSunCoronaBlue; + static int32 m_nCurrentSkyTopRed; + static int32 m_nCurrentSkyTopGreen; + static int32 m_nCurrentSkyTopBlue; + static int32 m_nCurrentSkyBottomRed; + static int32 m_nCurrentSkyBottomGreen; + static int32 m_nCurrentSkyBottomBlue; + static int32 m_nCurrentSunCoreRed; + static int32 m_nCurrentSunCoreGreen; + static int32 m_nCurrentSunCoreBlue; + static int32 m_nCurrentSunCoronaRed; + static int32 m_nCurrentSunCoronaGreen; + static int32 m_nCurrentSunCoronaBlue; static float m_fCurrentSunSize; static float m_fCurrentSpriteSize; static float m_fCurrentSpriteBrightness; - static int m_nCurrentShadowStrength; - static int m_nCurrentLightShadowStrength; - static int m_nCurrentTreeShadowStrength; + static int32 m_nCurrentShadowStrength; + static int32 m_nCurrentLightShadowStrength; + static int32 m_nCurrentTreeShadowStrength; static float m_fCurrentFogStart; static float m_fCurrentFarClip; static float m_fCurrentLightsOnGroundBrightness; - static int m_nCurrentLowCloudsRed; - static int m_nCurrentLowCloudsGreen; - static int m_nCurrentLowCloudsBlue; - static int m_nCurrentFluffyCloudsTopRed; - static int m_nCurrentFluffyCloudsTopGreen; - static int m_nCurrentFluffyCloudsTopBlue; - static int m_nCurrentFluffyCloudsBottomRed; - static int m_nCurrentFluffyCloudsBottomGreen; - static int m_nCurrentFluffyCloudsBottomBlue; + static int32 m_nCurrentLowCloudsRed; + static int32 m_nCurrentLowCloudsGreen; + static int32 m_nCurrentLowCloudsBlue; + static int32 m_nCurrentFluffyCloudsTopRed; + static int32 m_nCurrentFluffyCloudsTopGreen; + static int32 m_nCurrentFluffyCloudsTopBlue; + static int32 m_nCurrentFluffyCloudsBottomRed; + static int32 m_nCurrentFluffyCloudsBottomGreen; + static int32 m_nCurrentFluffyCloudsBottomBlue; static float m_fCurrentBlurRed; static float m_fCurrentBlurGreen; static float m_fCurrentBlurBlue; static float m_fCurrentBlurAlpha; - static int m_nCurrentFogColourRed; - static int m_nCurrentFogColourGreen; - static int m_nCurrentFogColourBlue; + static int32 m_nCurrentFogColourRed; + static int32 m_nCurrentFogColourGreen; + static int32 m_nCurrentFogColourBlue; - static int m_FogReduction; + static int32 m_FogReduction; public: - static int m_CurrentStoredValue; + static int32 m_CurrentStoredValue; static CVector m_VectorToSun[16]; static float m_fShadowFrontX[16]; static float m_fShadowFrontY[16]; @@ -105,40 +105,40 @@ public: static float GetDirectionalRed(void) { return m_fCurrentDirectionalRed; } static float GetDirectionalGreen(void) { return m_fCurrentDirectionalGreen; } static float GetDirectionalBlue(void) { return m_fCurrentDirectionalBlue; } - static int GetSkyTopRed(void) { return m_nCurrentSkyTopRed; } - static int GetSkyTopGreen(void) { return m_nCurrentSkyTopGreen; } - static int GetSkyTopBlue(void) { return m_nCurrentSkyTopBlue; } - static int GetSkyBottomRed(void) { return m_nCurrentSkyBottomRed; } - static int GetSkyBottomGreen(void) { return m_nCurrentSkyBottomGreen; } - static int GetSkyBottomBlue(void) { return m_nCurrentSkyBottomBlue; } - static int GetSunCoreRed(void) { return m_nCurrentSunCoreRed; } - static int GetSunCoreGreen(void) { return m_nCurrentSunCoreGreen; } - static int GetSunCoreBlue(void) { return m_nCurrentSunCoreBlue; } - static int GetSunCoronaRed(void) { return m_nCurrentSunCoronaRed; } - static int GetSunCoronaGreen(void) { return m_nCurrentSunCoronaGreen; } - static int GetSunCoronaBlue(void) { return m_nCurrentSunCoronaBlue; } + static int32 GetSkyTopRed(void) { return m_nCurrentSkyTopRed; } + static int32 GetSkyTopGreen(void) { return m_nCurrentSkyTopGreen; } + static int32 GetSkyTopBlue(void) { return m_nCurrentSkyTopBlue; } + static int32 GetSkyBottomRed(void) { return m_nCurrentSkyBottomRed; } + static int32 GetSkyBottomGreen(void) { return m_nCurrentSkyBottomGreen; } + static int32 GetSkyBottomBlue(void) { return m_nCurrentSkyBottomBlue; } + static int32 GetSunCoreRed(void) { return m_nCurrentSunCoreRed; } + static int32 GetSunCoreGreen(void) { return m_nCurrentSunCoreGreen; } + static int32 GetSunCoreBlue(void) { return m_nCurrentSunCoreBlue; } + static int32 GetSunCoronaRed(void) { return m_nCurrentSunCoronaRed; } + static int32 GetSunCoronaGreen(void) { return m_nCurrentSunCoronaGreen; } + static int32 GetSunCoronaBlue(void) { return m_nCurrentSunCoronaBlue; } static float GetSunSize(void) { return m_fCurrentSunSize; } static float GetSpriteBrightness(void) { return m_fCurrentSpriteBrightness; } static float GetSpriteSize(void) { return m_fCurrentSpriteSize; } - static int GetShadowStrength(void) { return m_nCurrentShadowStrength; } - static int GetLightShadowStrength(void) { return m_nCurrentLightShadowStrength; } + static int32 GetShadowStrength(void) { return m_nCurrentShadowStrength; } + static int32 GetLightShadowStrength(void) { return m_nCurrentLightShadowStrength; } static float GetLightOnGroundBrightness(void) { return m_fCurrentLightsOnGroundBrightness; } static float GetFarClip(void) { return m_fCurrentFarClip; } static float GetFogStart(void) { return m_fCurrentFogStart; } - static int GetLowCloudsRed(void) { return m_nCurrentLowCloudsRed; } - static int GetLowCloudsGreen(void) { return m_nCurrentLowCloudsGreen; } - static int GetLowCloudsBlue(void) { return m_nCurrentLowCloudsBlue; } - static int GetFluffyCloudsTopRed(void) { return m_nCurrentFluffyCloudsTopRed; } - static int GetFluffyCloudsTopGreen(void) { return m_nCurrentFluffyCloudsTopGreen; } - static int GetFluffyCloudsTopBlue(void) { return m_nCurrentFluffyCloudsTopBlue; } - static int GetFluffyCloudsBottomRed(void) { return m_nCurrentFluffyCloudsBottomRed; } - static int GetFluffyCloudsBottomGreen(void) { return m_nCurrentFluffyCloudsBottomGreen; } - static int GetFluffyCloudsBottomBlue(void) { return m_nCurrentFluffyCloudsBottomBlue; } - static int GetFogRed(void) { return m_nCurrentFogColourRed; } - static int GetFogGreen(void) { return m_nCurrentFogColourGreen; } - static int GetFogBlue(void) { return m_nCurrentFogColourBlue; } - static int GetFogReduction(void) { return m_FogReduction; } + static int32 GetLowCloudsRed(void) { return m_nCurrentLowCloudsRed; } + static int32 GetLowCloudsGreen(void) { return m_nCurrentLowCloudsGreen; } + static int32 GetLowCloudsBlue(void) { return m_nCurrentLowCloudsBlue; } + static int32 GetFluffyCloudsTopRed(void) { return m_nCurrentFluffyCloudsTopRed; } + static int32 GetFluffyCloudsTopGreen(void) { return m_nCurrentFluffyCloudsTopGreen; } + static int32 GetFluffyCloudsTopBlue(void) { return m_nCurrentFluffyCloudsTopBlue; } + static int32 GetFluffyCloudsBottomRed(void) { return m_nCurrentFluffyCloudsBottomRed; } + static int32 GetFluffyCloudsBottomGreen(void) { return m_nCurrentFluffyCloudsBottomGreen; } + static int32 GetFluffyCloudsBottomBlue(void) { return m_nCurrentFluffyCloudsBottomBlue; } + static int32 GetFogRed(void) { return m_nCurrentFogColourRed; } + static int32 GetFogGreen(void) { return m_nCurrentFogColourGreen; } + static int32 GetFogBlue(void) { return m_nCurrentFogColourBlue; } + static int32 GetFogReduction(void) { return m_FogReduction; } static void Initialise(void); static void Update(void); From e29e911302ddf8bd4274bd707e73a70122de9d79 Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 10 Aug 2020 17:05:34 +0200 Subject: [PATCH 16/16] update librw --- librw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librw b/librw index 99c15d5e..113d76cf 160000 --- a/librw +++ b/librw @@ -1 +1 @@ -Subproject commit 99c15d5ed78cc112e1055cc89452dd57df28da58 +Subproject commit 113d76cfaaf064447ac936f79d91ea04788fca24