From 4da23516718c3ac45f86d7010866f825cfc5ec8f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 22 Apr 2020 20:42:13 +0200 Subject: [PATCH] - fixed compile errors in POSIX platform code. --- src/CMakeLists.txt | 3 +++ src/common/engine/i_interface.h | 9 +++++++++ src/common/engine/startupinfo.h | 3 +++ src/common/menu/menustate.h | 10 ++++++++++ src/d_iwad.cpp | 1 + src/d_main.cpp | 2 +- src/d_main.h | 6 ------ src/doomstat.h | 9 +-------- src/posix/cocoa/i_input.mm | 4 +++- src/posix/cocoa/i_main.mm | 1 + src/posix/cocoa/st_console.mm | 2 +- src/posix/osx/iwadpicker_cocoa.mm | 1 + src/posix/sdl/i_input.cpp | 4 +++- src/posix/sdl/i_main.cpp | 1 + src/posix/unix/gtk_dialogs.cpp | 1 + src/rendering/hwrenderer/scene/hw_walls.cpp | 6 ++++-- src/rendering/hwrenderer/utility/hw_draw2d.cpp | 1 + src/win32/i_system.cpp | 1 + 18 files changed, 45 insertions(+), 20 deletions(-) create mode 100644 src/common/menu/menustate.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a89a6cc7d8..02b4638f7c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -605,6 +605,7 @@ file( GLOB HEADER_FILES common/console/*.h common/utility/*.h common/engine/*.h + common/menu/*.h common/fonts/*.h common/objects/*.h common/filesystem/*.h @@ -1251,6 +1252,7 @@ include_directories( . common/utility common/console common/engine + common/menu common/fonts common/objects common/rendering @@ -1457,6 +1459,7 @@ source_group("Common\\Utility" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/ source_group("Common\\Engine" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/engine/.+") source_group("Common\\2D" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/2d/.+") source_group("Common\\Objects" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/objects/.+") +source_group("Common\\Menu" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/menu/.+") source_group("Common\\Fonts" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/fonts/.+") source_group("Common\\File System" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/filesystem/.+") source_group("Common\\Scripting" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/scripting/.+") diff --git a/src/common/engine/i_interface.h b/src/common/engine/i_interface.h index ff26d18a80..134cae975a 100644 --- a/src/common/engine/i_interface.h +++ b/src/common/engine/i_interface.h @@ -1,5 +1,6 @@ #pragma once +#include "zstring.h" struct SystemCallbacks { @@ -13,3 +14,11 @@ struct SystemCallbacks }; extern SystemCallbacks *sysCallbacks; + +struct WadStuff +{ + FString Path; + FString Name; +}; + + diff --git a/src/common/engine/startupinfo.h b/src/common/engine/startupinfo.h index cbabba4004..53f79e8800 100644 --- a/src/common/engine/startupinfo.h +++ b/src/common/engine/startupinfo.h @@ -1,5 +1,8 @@ #pragma once +#include +#include "zstring.h" + struct FStartupInfo { FString Name; diff --git a/src/common/menu/menustate.h b/src/common/menu/menustate.h new file mode 100644 index 0000000000..5dfd386095 --- /dev/null +++ b/src/common/menu/menustate.h @@ -0,0 +1,10 @@ +#pragma once + +enum EMenuState : int +{ + MENU_Off, // Menu is closed + MENU_On, // Menu is opened + MENU_WaitKey, // Menu is opened and waiting for a key in the controls menu + MENU_OnNoPause, // Menu is opened but does not pause the game +}; +extern EMenuState menuactive; // Menu overlayed? diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index ddbb853d8a..bbecbf81b4 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -47,6 +47,7 @@ #include "engineerrors.h" #include "v_text.h" #include "findfile.h" +#include "i_interface.h" CVAR (Bool, queryiwad, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG); CVAR (String, defaultiwad, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG); diff --git a/src/d_main.cpp b/src/d_main.cpp index 0720aaddee..eaae9b22e0 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -2685,7 +2685,7 @@ void System_CrashInfo(char* buffer, size_t bufflen, const char *lfstr) buffer += mysnprintf(buffer, buffend - buffer, "%s%sviewx = %f", lfstr, lfstr, vp.Pos.X); buffer += mysnprintf(buffer, buffend - buffer, "%sviewy = %f", lfstr, vp.Pos.Y); buffer += mysnprintf(buffer, buffend - buffer, "%sviewz = %f", lfstr, vp.Pos.Z); - buffer += mysnprintf(buffer, buffend - buffer, "%sviewangle = %f", lfstr, vp.Angles.Yaw); + buffer += mysnprintf(buffer, buffend - buffer, "%sviewangle = %f", lfstr, vp.Angles.Yaw.Degrees); } } buffer += mysnprintf(buffer, buffend - buffer, "%s", lfstr); diff --git a/src/d_main.h b/src/d_main.h index 92691c8375..ce8d9d778e 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -66,12 +66,6 @@ extern const char *D_DrawIcon; extern uint32_t r_renderercaps; -struct WadStuff -{ - FString Path; - FString Name; -}; - struct FIWADInfo { FString Name; // Title banner text for this IWAD diff --git a/src/doomstat.h b/src/doomstat.h index 879dcd83a9..873301c980 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -105,16 +105,9 @@ EXTERN_CVAR (Float, snd_musicvolume) // maximum volume for music // Status flags for refresh. // -enum EMenuState : int -{ - MENU_Off, // Menu is closed - MENU_On, // Menu is opened - MENU_WaitKey, // Menu is opened and waiting for a key in the controls menu - MENU_OnNoPause, // Menu is opened but does not pause the game -}; +#include "menustate.h" extern bool automapactive; // In AutoMap mode? -extern EMenuState menuactive; // Menu overlayed? extern int paused; // Game Pause? extern bool pauseext; diff --git a/src/posix/cocoa/i_input.mm b/src/posix/cocoa/i_input.mm index 87199d8b68..b3315f804f 100644 --- a/src/posix/cocoa/i_input.mm +++ b/src/posix/cocoa/i_input.mm @@ -44,6 +44,8 @@ #include "dikeys.h" #include "v_video.h" #include "i_interface.h" +#include "menustate.h" +#include "engineerrors.h" EXTERN_CVAR(Int, m_use_mouse) @@ -77,7 +79,7 @@ void CheckGUICapture() if (wantCapt != GUICapture) { GUICapture = wantCapt; - if (wantCapt && Keyboard != NULL) + if (wantCapt) { buttonMap.ResetButtonStates(); } diff --git a/src/posix/cocoa/i_main.mm b/src/posix/cocoa/i_main.mm index 071ab34d37..f33b206fdf 100644 --- a/src/posix/cocoa/i_main.mm +++ b/src/posix/cocoa/i_main.mm @@ -45,6 +45,7 @@ #include "version.h" #include "printf.h" #include "s_music.h" +#include "engineerrors.h" #define ZD_UNUSED(VARIABLE) ((void)(VARIABLE)) diff --git a/src/posix/cocoa/st_console.mm b/src/posix/cocoa/st_console.mm index 6212079e2e..b4c0878c8d 100644 --- a/src/posix/cocoa/st_console.mm +++ b/src/posix/cocoa/st_console.mm @@ -346,7 +346,7 @@ void FConsoleWindow::SetTitleText() } NSTextField* titleText = [[NSTextField alloc] initWithFrame:titleTextRect]; - [titleText setStringValue:[NSString stringWithCString:GameStartupInfo.Name + [titleText setStringValue:[NSString stringWithCString:GameStartupInfo.Name.GetChars() encoding:NSISOLatin1StringEncoding]]; [titleText setAlignment:NSCenterTextAlignment]; [titleText setTextColor:RGB(GameStartupInfo.FgColor)]; diff --git a/src/posix/osx/iwadpicker_cocoa.mm b/src/posix/osx/iwadpicker_cocoa.mm index a5d8298418..8670ec2bd3 100644 --- a/src/posix/osx/iwadpicker_cocoa.mm +++ b/src/posix/osx/iwadpicker_cocoa.mm @@ -39,6 +39,7 @@ #include "m_argv.h" #include "gameconfigfile.h" #include "engineerrors.h" +#include "i_interface.h" #include #include diff --git a/src/posix/sdl/i_input.cpp b/src/posix/sdl/i_input.cpp index 5d0cdf31b8..ad2181ae6a 100644 --- a/src/posix/sdl/i_input.cpp +++ b/src/posix/sdl/i_input.cpp @@ -43,6 +43,8 @@ #include "utf8.h" #include "keydef.h" #include "i_interface.h" +#include "engineerrors.h" +#include "i_interface.h" static void I_CheckGUICapture (); @@ -170,7 +172,7 @@ static void I_CheckGUICapture () if (wantCapt != GUICapture) { GUICapture = wantCapt; - if (wantCapt && Keyboard != NULL) + if (wantCapt) { buttonMap.ResetButtonStates(); } diff --git a/src/posix/sdl/i_main.cpp b/src/posix/sdl/i_main.cpp index b0e4514623..7fc179a510 100644 --- a/src/posix/sdl/i_main.cpp +++ b/src/posix/sdl/i_main.cpp @@ -48,6 +48,7 @@ #include "cmdlib.h" #include "engineerrors.h" #include "i_system.h" +#include "i_interface.h" // MACROS ------------------------------------------------------------------ diff --git a/src/posix/unix/gtk_dialogs.cpp b/src/posix/unix/gtk_dialogs.cpp index 903e05f0b3..b5fbfdd386 100644 --- a/src/posix/unix/gtk_dialogs.cpp +++ b/src/posix/unix/gtk_dialogs.cpp @@ -60,6 +60,7 @@ typedef enum #include "version.h" #include "startupinfo.h" #include "cmdlib.h" +#include "i_interface.h" EXTERN_CVAR (Bool, queryiwad); diff --git a/src/rendering/hwrenderer/scene/hw_walls.cpp b/src/rendering/hwrenderer/scene/hw_walls.cpp index eecca476e8..eb907770fd 100644 --- a/src/rendering/hwrenderer/scene/hw_walls.cpp +++ b/src/rendering/hwrenderer/scene/hw_walls.cpp @@ -459,8 +459,10 @@ void HWWall::PutWall(HWDrawInfo *di, bool translucent) Colormap.Clear(); } - if (di->isFullbrightScene() || (Colormap.LightColor.isWhite() && lightlevel == 255)) - flags &= ~HWF_GLOW; + if (di->isFullbrightScene() || (Colormap.LightColor.isWhite() && lightlevel == 255)) + { + flags &= ~HWF_GLOW; + } if (!screen->BuffersArePersistent()) { diff --git a/src/rendering/hwrenderer/utility/hw_draw2d.cpp b/src/rendering/hwrenderer/utility/hw_draw2d.cpp index d0010ef0d7..9404c9f869 100644 --- a/src/rendering/hwrenderer/utility/hw_draw2d.cpp +++ b/src/rendering/hwrenderer/utility/hw_draw2d.cpp @@ -188,6 +188,7 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state) switch (cmd.mType) { + default: case F2DDrawer::DrawTypeTriangles: state.DrawIndexed(DT_Triangles, cmd.mIndexIndex, cmd.mIndexCount); break; diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 39b4394e3e..4a2ddcdf3c 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -84,6 +84,7 @@ #include "i_system.h" #include "bitmap.h" #include "cmdlib.h" +#include "i_interface.h" // MACROS ------------------------------------------------------------------