From 480b6ad0ed13bf4c2e250583f07b07ba3432240c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Ro=C3=9F?= Date: Sun, 21 Apr 2024 14:11:45 +0200 Subject: [PATCH 1/7] [Build] Added missing RELEASE preprocessor define in Release build. --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 533276f22..201a50f96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,8 @@ if(WIN32) endif() endif() +add_compile_definitions($<$:RELEASE>) + include_directories("lib" "Descent3" ${PLATFORM_INCLUDES}) # file(GLOB_RECURSE INCS "*.h") From d3d83d3e444833e610c3639c54e78732b21fad1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Ro=C3=9F?= Date: Sun, 21 Apr 2024 14:13:14 +0200 Subject: [PATCH 2/7] [Build] Fixed 'uninitialized local variable' in Release build after last commit. --- model/polymodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/polymodel.cpp b/model/polymodel.cpp index c0788fe4f..15533e52d 100644 --- a/model/polymodel.cpp +++ b/model/polymodel.cpp @@ -2052,7 +2052,7 @@ extern int paged_in_num; int LoadPolyModel(char *filename, int pageable) { char name[256]; char fname[256], pname[256], extname[256]; - int i, polynum; + int i, polynum = -1; CFILE *infile = NULL; int overlay = 0; From 299a46740e53b03cba64937474b3f02eb2db2619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Ro=C3=9F?= Date: Sun, 21 Apr 2024 14:28:51 +0200 Subject: [PATCH 3/7] [Build] Fixed Linux/Mac Release build compilation due to inconsistant #ifdef use that worked only on Windows. --- Descent3/render.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Descent3/render.cpp b/Descent3/render.cpp index 978f817e0..6b12a4534 100644 --- a/Descent3/render.cpp +++ b/Descent3/render.cpp @@ -808,7 +808,7 @@ void BuildRoomListSub(int start_room_num, clip_wnd *wnd, int depth) { } ASSERT(N_render_rooms < MAX_RENDER_ROOMS); -#ifdef _DEBUG +#ifndef RELEASE Mine_depth++; #endif Rooms_visited[start_room_num] = 1; From 9d2496f28bd6f978f96536114177c7610934bc17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Ro=C3=9F?= Date: Sun, 21 Apr 2024 15:14:31 +0200 Subject: [PATCH 4/7] [Build] Only set preprocessor define _DEBUG in Debug builds. Linux and Mac had this set on all build configurations. --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 201a50f96..27883bb67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,13 +28,13 @@ endif() if(UNIX AND NOT APPLE) message("Building for Linux") - add_definitions( -D_DEBUG -D__LINUX__ -DLINUX -D_MAX_PATH=260 -D_MAX_FNAME=256 -D_REENRANT -D__32BIT__ -DHAVEALLOCA_H -D_USE_OGL_ACTIVE_TEXTURES) + add_definitions(-D__LINUX__ -DLINUX -D_MAX_PATH=260 -D_MAX_FNAME=256 -D_REENRANT -D__32BIT__ -DHAVEALLOCA_H -D_USE_OGL_ACTIVE_TEXTURES) set(PLATFORM_INCLUDES "lib/linux" ${SDL_INCLUDE_DIR}) endif() if(APPLE) message("Building for MAC OSX") - add_definitions(-D_DEBUG -D__LINUX__ -DLINUX -D_MAX_PATH=260 -D_MAX_FNAME=256 -D_REENRANT -DMACOSX=1 -D_USE_OGL_ACTIVE_TEXTURES) + add_definitions(-D__LINUX__ -DLINUX -D_MAX_PATH=260 -D_MAX_FNAME=256 -D_REENRANT -DMACOSX=1 -D_USE_OGL_ACTIVE_TEXTURES) set(PLATFORM_INCLUDES "lib/linux" ${SDL_INCLUDE_DIR} "/usr/X11/include") endif() @@ -72,6 +72,7 @@ if(WIN32) endif() add_compile_definitions($<$:RELEASE>) +add_compile_definitions($<$:_DEBUG>) include_directories("lib" "Descent3" ${PLATFORM_INCLUDES}) From fabcdcd84d5cd488229f5ea5a1eca402442e6364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Ro=C3=9F?= Date: Sun, 21 Apr 2024 17:40:22 +0200 Subject: [PATCH 5/7] [Windows] Temporary workaround to keep the window resolution as it was before the changes to fix the preprocessor defines for the Release build. --- win32/winapp.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/win32/winapp.cpp b/win32/winapp.cpp index 428f11a28..f5382de69 100644 --- a/win32/winapp.cpp +++ b/win32/winapp.cpp @@ -251,7 +251,13 @@ oeWin32Application::oeWin32Application(const char *name, unsigned flags, HInstan } else { // initialize main window and display it. #ifdef RELEASE - SetRect(&rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); + // TODO: Fix custom window resolution when original code below is active. + // After the change to properly set RELEASE for Release builds, this call + // breaks resolution of menu screens, videos and ingame huds. + // So for now, we keep the debug version of this call that was active before + // that change and works consistently at least. + //SetRect(&rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); + SetRect(&rect, 0, 0, 640, 480); #else SetRect(&rect, 0, 0, 640, 480); #endif From 94657a5233f257b7917b7331ae82f1bdafd39c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Ro=C3=9F?= Date: Tue, 23 Apr 2024 21:07:27 +0200 Subject: [PATCH 6/7] Revert "[Windows] Temporary workaround to keep the window resolution as it was before the changes to fix the preprocessor defines for the Release build." This reverts commit fabcdcd84d5cd488229f5ea5a1eca402442e6364. --- win32/winapp.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/win32/winapp.cpp b/win32/winapp.cpp index f5382de69..428f11a28 100644 --- a/win32/winapp.cpp +++ b/win32/winapp.cpp @@ -251,13 +251,7 @@ oeWin32Application::oeWin32Application(const char *name, unsigned flags, HInstan } else { // initialize main window and display it. #ifdef RELEASE - // TODO: Fix custom window resolution when original code below is active. - // After the change to properly set RELEASE for Release builds, this call - // breaks resolution of menu screens, videos and ingame huds. - // So for now, we keep the debug version of this call that was active before - // that change and works consistently at least. - //SetRect(&rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); - SetRect(&rect, 0, 0, 640, 480); + SetRect(&rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); #else SetRect(&rect, 0, 0, 640, 480); #endif From a03489c8fbcc4e8be75d84eadba482d5f14cdf66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Ro=C3=9F?= Date: Tue, 23 Apr 2024 21:12:35 +0200 Subject: [PATCH 7/7] [WindowMode] Temporary disabled window mode in Release builds until it's ready for shipping. --- Descent3/winmain.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Descent3/winmain.cpp b/Descent3/winmain.cpp index 7131b22bd..01c5ffe02 100644 --- a/Descent3/winmain.cpp +++ b/Descent3/winmain.cpp @@ -625,10 +625,12 @@ int PASCAL HandledWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR szCmdLine, d3 = new oeD3Win32App(OEAPP_CONSOLE, (HInstance)hInst); } else { unsigned int flags = OEAPP_FULLSCREEN; +#ifndef RELEASE // TODO: remove #ifndef when window mode is ready for primetime if (FindArg("-windowed")) { // switch to windowed mode instead flags = OEAPP_WINDOWED; } +#endif d3 = new oeD3Win32App(flags, (HInstance)hInst); }