From 134122335b1dd982df146e847e42d3be40c5010c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 6 Jan 2020 02:41:47 +0100 Subject: [PATCH] - first attempt to compile on a Mac This could have gone better, there's far too many warnings here --- CMakeLists.txt | 3 +- source/CMakeLists.txt | 55 ++++++++++--------- source/blood/CMakeLists.txt | 7 +++ source/blood/src/actor.cpp | 2 +- source/blood/src/aiunicult.cpp | 2 +- source/blood/src/levels.h | 4 +- source/blood/src/loadsave.h | 2 +- source/blood/src/sfx.cpp | 2 +- source/blood/src/triggers.cpp | 2 +- source/build/include/build.h | 3 - source/build/src/sdlayer.cpp | 2 + source/common/console/c_cvars.h | 14 ++--- source/common/filesystem/resourcefile.h | 8 +-- source/common/gamecvars.h | 2 +- source/common/textures/textures.h | 1 + source/common/utility/cmdlib.h | 11 ++++ source/common/utility/printf.h | 11 ++++ source/duke3d/CMakeLists.txt | 7 +++ source/duke3d/src/anim.cpp | 3 +- source/duke3d/src/gameexec.cpp | 2 +- source/duke3d/src/sounds.cpp | 2 +- source/exhumed/CMakeLists.txt | 7 +++ source/glbackend/gl_renderstate.h | 2 +- source/platform/posix/cocoa/i_main.mm | 5 +- source/platform/posix/cocoa/i_system.mm | 5 -- source/platform/posix/cocoa/i_video.mm | 1 - source/platform/posix/cocoa/st_console.mm | 1 - source/platform/posix/cocoa/st_start.mm | 1 - source/platform/posix/osx/iwadpicker_cocoa.mm | 1 - source/rr/CMakeLists.txt | 7 +++ source/rr/src/anim.cpp | 2 - source/rr/src/duke3d.h | 2 +- source/sw/CMakeLists.txt | 7 +++ source/sw/src/actor.cpp | 6 -- source/sw/src/border.cpp | 8 +-- source/sw/src/cheats.cpp | 6 +- source/sw/src/common.cpp | 2 - source/sw/src/sector.cpp | 3 +- 38 files changed, 122 insertions(+), 89 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8dfead964..5f0b52b25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -228,7 +228,7 @@ if( MSVC ) # Most of these need to be cleaned out. The source is currently infested with far too much conditional compilation which is a constant source of problems. - set( ALL_C_FLAGS "${ALL_C_FLAGS} /DRENDERTYPESDL=1 /DMIXERTYPEWIN=1 /DSDL_USEFOLDER /DSDL_TARGET=2 /DUSE_OPENGL=1 /DSTARTUP_WINDOW /DUSE_LIBVPX /DNOASM=1 /DWIN32" ) + set( ALL_C_FLAGS "${ALL_C_FLAGS} /DUSE_OPENGL=1 /DUSE_LIBVPX /DNOASM=1 /DWIN32" ) # The CMake configurations set /GR and /MD by default, which conflict with our settings. string(REPLACE "/MD " " " CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE} ) @@ -248,6 +248,7 @@ else() else() set( ALL_C_FLAGS "-ffp-contract=off" ) endif() + set( ALL_C_FLAGS "${ALL_C_FLAGS} -DUSE_OPENGL=1 -DNOASM=1" ) # /DUSE_LIBVPX fixme: Set up libvpx if ( UNIX ) include(CheckSymbolExists) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 75e0233ef..67c2ced51 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -23,8 +23,11 @@ if( DEM_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) endif() endif() +# Build does not work with signed chars! if (MSVC) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /J" ) +else() + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -funsigned-char -Wno-missing-braces -Wno-char-subscripts" ) endif() option( DYN_FLUIDSYNTH "Dynamically load fluidsynth" ON ) @@ -66,12 +69,12 @@ if( WIN32 ) set( DX_dinput8_LIBRARY dinput8 ) - if( X64 ) + if( X64 ) link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../platform/Windows/lib/64) else() link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../platform/Windows/lib/32) endif() - + set( PROJECT_LIBRARIES opengl32 wsock32 @@ -85,9 +88,9 @@ if( WIN32 ) ws2_32 setupapi oleaut32 - dbghelp + dbghelp legacy_stdio_definitions - + shlwapi version imm32 @@ -104,11 +107,11 @@ if( WIN32 ) # this local library crap needs to go away. Sadly there doesn't seem to be anything to get a working libvpx that doesn't force linking with MinGW dependencies. libvpx libcompat-to-msvc - - ) - - + ) + + + if( NOT DEM_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) set( PROJECT_LIBRARIES ${PROJECT_LIBRARIES} DelayImp ) @@ -367,12 +370,12 @@ endif() # Check for thread_local keyword, it's optional at the moment -CHECK_CXX_SOURCE_COMPILES("thread_local int i; int main() { i = 0; }" - HAVE_THREAD_LOCAL) +#CHECK_CXX_SOURCE_COMPILES("thread_local int i; int main() { i = 0; }" +# HAVE_THREAD_LOCAL) -if( NOT HAVE_THREAD_LOCAL ) - message( SEND_ERROR "C++ compiler doesn't support thread_local storage duration specifier" ) -endif() +#if( NOT HAVE_THREAD_LOCAL ) +# message( SEND_ERROR "C++ compiler doesn't support thread_local storage duration specifier" ) +#endif() # Check for functions that may or may not exist. @@ -560,7 +563,7 @@ endif() add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h COMMAND re2c --no-generation-date -s -o ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h ${CMAKE_CURRENT_SOURCE_DIR}/common/utility/sc_man_scanner.re DEPENDS re2c ${CMAKE_CURRENT_SOURCE_DIR}/common/utility/sc_man_scanner.re ) - + include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) @@ -657,7 +660,7 @@ set( FASTMATH_SOURCES # The rest is only here because it is C, not C++ common/utility/strnatcmp.c common/rendering/gl_load/gl_load.c - + gitinfo.cpp ) @@ -671,7 +674,7 @@ set (PCH_SOURCES glbackend/gl_palmanager.cpp glbackend/gl_texture.cpp glbackend/hw_draw2d.cpp - + thirdparty/src/base64.cpp thirdparty/src/sjson.cpp thirdparty/src/fix16.cpp @@ -684,7 +687,7 @@ set (PCH_SOURCES #thirdparty/imgui/imgui_impl_opengl3.cpp #thirdparty/imgui/imgui_impl_sdl.cpp #thirdparty/imgui/imgui_widgets.cpp - + # Todo: Split out the license-safe code from this. build/src/a-c.cpp build/src/animvpx.cpp @@ -707,7 +710,7 @@ set (PCH_SOURCES build/src/tiles.cpp build/src/timer.cpp build/src/voxmodel.cpp - + common/animlib.cpp common/rts.cpp common/gameconfigfile.cpp @@ -728,14 +731,14 @@ set (PCH_SOURCES common/2d/v_draw.cpp common/2d/v_drawtext.cpp common/2d/renderstyle.cpp - + common/fonts/font.cpp common/fonts/hexfont.cpp common/fonts/singlelumpfont.cpp common/fonts/v_font.cpp common/fonts/v_text.cpp common/fonts/fontchars.cpp - + common/console/c_cvars.cpp common/console/c_console.cpp common/console/c_consolebuffer.cpp @@ -745,7 +748,7 @@ set (PCH_SOURCES common/console/c_dispatch.cpp common/console/d_event.cpp common/console/c_con.cpp - + common/utility/i_time.cpp common/utility/name.cpp common/utility/cmdlib.cpp @@ -795,12 +798,12 @@ set (PCH_SOURCES common/music/music_config.cpp common/music/music_midi_base.cpp common/music/s_advsound.cpp - + common/sound/backend/oalsound.cpp common/sound/backend/i_sound.cpp common/sound/s_sound.cpp common/sound/s_environment.cpp - + common/menu/imagescroller.cpp common/menu/joystickmenu.cpp common/menu/listmenu.cpp @@ -812,11 +815,11 @@ set (PCH_SOURCES common/menu/messagebox.cpp common/menu/optionmenu.cpp common/menu/resolutionmenu.cpp - + #common/input/i_joystick.cpp #common/input/i_input.cpp common/input/m_joy.cpp - + common/rendering/r_videoscale.cpp common/rendering/v_framebuffer.cpp common/rendering/v_video.cpp @@ -908,7 +911,7 @@ include_directories( ${CMAKE_BINARY_DIR}/libraries/gdtoa - #${SYSTEM_SOURCES_DIR} + #${SYSTEM_SOURCES_DIR} ) add_dependencies( ${PROJECT_NAME} revision_check ) diff --git a/source/blood/CMakeLists.txt b/source/blood/CMakeLists.txt index dc90a3cc8..fa1d60d7b 100644 --- a/source/blood/CMakeLists.txt +++ b/source/blood/CMakeLists.txt @@ -1,7 +1,13 @@ cmake_minimum_required( VERSION 3.1.0 ) +require_stricmp() +require_strnicmp() + +# Build does not work with signed chars! if (MSVC) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /J" ) +else() + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -funsigned-char -Wno-missing-braces -Wno-char-subscripts" ) endif() include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/../../build/include" ) @@ -13,6 +19,7 @@ include_directories( "${ZLIB_INCLUDE_DIR}" "${ZMUSIC_INCLUDE_DIR}" "${BZIP2_INCL endif() include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/../build/include ${CMAKE_CURRENT_SOURCE_DIR}/../audiolib/include ${CMAKE_CURRENT_SOURCE_DIR}/../libsmackerdec/include diff --git a/source/blood/src/actor.cpp b/source/blood/src/actor.cpp index 68524e33f..db14951ee 100644 --- a/source/blood/src/actor.cpp +++ b/source/blood/src/actor.cpp @@ -6904,7 +6904,7 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6, int y = gHitInfo.hity-mulscale(a5, 16, 14); int z = gHitInfo.hitz-mulscale(a6, 256, 14); short nSector = gHitInfo.hitsect; - char nSurf = kSurfNone; + unsigned char nSurf = kSurfNone; if (nRange == 0 || approxDist(gHitInfo.hitx-pShooter->x, gHitInfo.hity-pShooter->y) < nRange) { switch (hit) diff --git a/source/blood/src/aiunicult.cpp b/source/blood/src/aiunicult.cpp index 8f0a0b621..388bf9799 100644 --- a/source/blood/src/aiunicult.cpp +++ b/source/blood/src/aiunicult.cpp @@ -1987,7 +1987,7 @@ bool genDudePrepare(spritetype* pSprite, int propId) { pSprite->clipdist = ClipRange((pSprite->xrepeat + pSprite->yrepeat) >> 1, 4, 120); if (propId) break; - fallthrough__; + break; } } diff --git a/source/blood/src/levels.h b/source/blood/src/levels.h index 1d6aec8e2..de8c09a5f 100644 --- a/source/blood/src/levels.h +++ b/source/blood/src/levels.h @@ -35,8 +35,8 @@ BEGIN_BLD_NS #pragma pack(push, 1) struct GAMEOPTIONS { - char nGameType; - char nDifficulty; + unsigned char nGameType; + unsigned char nDifficulty; int nEpisode; int nLevel; char zLevelName[BMAX_PATH]; diff --git a/source/blood/src/loadsave.h b/source/blood/src/loadsave.h index 847970aec..a0d3e610d 100644 --- a/source/blood/src/loadsave.h +++ b/source/blood/src/loadsave.h @@ -36,7 +36,7 @@ public: LoadSave() { loadSaves.Push(this); } - //~LoadSave() { } + virtual ~LoadSave() = default; virtual void Save(void); virtual void Load(void); void Read(void *, int); diff --git a/source/blood/src/sfx.cpp b/source/blood/src/sfx.cpp index 52e8cecdc..b7f93b69f 100644 --- a/source/blood/src/sfx.cpp +++ b/source/blood/src/sfx.cpp @@ -42,7 +42,7 @@ class BloodSoundEngine : public SoundEngine { // client specific parts of the sound engine go in this class. void CalcPosVel(int type, const void* source, const float pt[3], int channum, int chanflags, FSoundID chanSound, FVector3* pos, FVector3* vel, FSoundChan *channel) override; - TArray ReadSound(int lumpnum); + TArray ReadSound(int lumpnum) override; public: BloodSoundEngine() diff --git a/source/blood/src/triggers.cpp b/source/blood/src/triggers.cpp index bfdb9c0d2..1c7080a7f 100644 --- a/source/blood/src/triggers.cpp +++ b/source/blood/src/triggers.cpp @@ -1055,7 +1055,7 @@ void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT event) case 4: for (int i = 0; i < 8; i++) pPlayer->hasKey[i] = false; if (pXSprite->data2) break; - fallthrough__; + break; } break; diff --git a/source/build/include/build.h b/source/build/include/build.h index ad86a7cf6..b138a106a 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -1105,8 +1105,6 @@ enum cutsceneflags { CUTSCENE_TEXTUREFILTER = 4, }; -#ifdef USE_OPENGL - enum { TEXFILTER_OFF = 0, // GL_NEAREST TEXFILTER_ON = 5, // GL_LINEAR_MIPMAP_LINEAR @@ -1137,7 +1135,6 @@ extern int32_t glrendmode; extern int32_t r_rortexture; extern int32_t r_rortexturerange; extern int32_t r_rorphase; -#endif void hicinit(void); void hicsetpalettetint(int32_t palnum, char r, char g, char b, char sr, char sg, char sb, polytintflags_t effect); diff --git a/source/build/src/sdlayer.cpp b/source/build/src/sdlayer.cpp index f492945c6..7bd9f7376 100644 --- a/source/build/src/sdlayer.cpp +++ b/source/build/src/sdlayer.cpp @@ -1,8 +1,10 @@ // SDL interface layer for the Build Engine // Use SDL 1.2 or 2.0 from http://www.libsdl.org +#ifdef _WIN32 #include #include +#endif #include #include #include diff --git a/source/common/console/c_cvars.h b/source/common/console/c_cvars.h index 56c3131fa..aefec9ed8 100644 --- a/source/common/console/c_cvars.h +++ b/source/common/console/c_cvars.h @@ -300,13 +300,13 @@ class FFloatCVar : public FBaseCVar public: FFloatCVar (const char *name, float def, uint32_t flags, void (*callback)(FFloatCVar &)=NULL, const char* descr = nullptr); - virtual ECVarType GetRealType () const; + virtual ECVarType GetRealType () const override; - virtual UCVarValue GetGenericRep (ECVarType type) const; - virtual UCVarValue GetFavoriteRep (ECVarType *type) const; - virtual UCVarValue GetGenericRepDefault (ECVarType type) const; - virtual UCVarValue GetFavoriteRepDefault (ECVarType *type) const; - virtual void SetGenericRepDefault (UCVarValue value, ECVarType type); + virtual UCVarValue GetGenericRep (ECVarType type) const override ; + virtual UCVarValue GetFavoriteRep (ECVarType *type) const override; + virtual UCVarValue GetGenericRepDefault (ECVarType type) const override; + virtual UCVarValue GetFavoriteRepDefault (ECVarType *type) const override; + virtual void SetGenericRepDefault (UCVarValue value, ECVarType type) override; const char *GetHumanString(int precision) const override; float operator= (float floatval) @@ -315,7 +315,7 @@ public: inline float operator *() const { return Value; } protected: - virtual void DoSet (UCVarValue value, ECVarType type); + virtual void DoSet (UCVarValue value, ECVarType type) override; public: // for the menu code which still needs variable references. (Cannot change everything at once.) float Value; diff --git a/source/common/filesystem/resourcefile.h b/source/common/filesystem/resourcefile.h index 5a83f6d9f..922416c04 100644 --- a/source/common/filesystem/resourcefile.h +++ b/source/common/filesystem/resourcefile.h @@ -139,9 +139,9 @@ struct FUncompressedLump : public FResourceLump { int Position; - virtual FileReader *GetReader(); + FileReader *GetReader() override; int ValidateCache() override; - virtual int GetFileOffset() { return Position; } + virtual int GetFileOffset() override { return Position; } }; @@ -188,9 +188,9 @@ struct FClonedLump : public FResourceLump { parent = lump; } - void* Lock() { return parent->Lock(); } + void* Lock() override { return parent->Lock(); } void Unlock(bool mayfree) override { parent->Unlock(mayfree); } - void* Get() { return parent->Get(); } + void* Get() override { return parent->Get(); } int ValidateCache() override { return parent->ValidateCache(); } }; diff --git a/source/common/gamecvars.h b/source/common/gamecvars.h index 61ae4f9c9..3b5859113 100644 --- a/source/common/gamecvars.h +++ b/source/common/gamecvars.h @@ -1,4 +1,4 @@ -#pragma once; +#pragma once #include "c_cvars.h" EXTERN_CVAR(Bool, cl_crosshair) diff --git a/source/common/textures/textures.h b/source/common/textures/textures.h index bd808b745..ba7621719 100644 --- a/source/common/textures/textures.h +++ b/source/common/textures/textures.h @@ -487,6 +487,7 @@ struct BuildArtFile { filename = std::move(other.filename); RawData = std::move(other.RawData); + return *this; } }; diff --git a/source/common/utility/cmdlib.h b/source/common/utility/cmdlib.h index 56c1382eb..c99553f38 100644 --- a/source/common/utility/cmdlib.h +++ b/source/common/utility/cmdlib.h @@ -12,6 +12,17 @@ #include #include "zstring.h" +#if !defined(GUID_DEFINED) +#define GUID_DEFINED +typedef struct _GUID +{ + uint32_t Data1; + uint16_t Data2; + uint16_t Data3; + uint8_t Data4[8]; +} GUID; +#endif + template char(&_ArraySizeHelper(T(&array)[N]))[N]; diff --git a/source/common/utility/printf.h b/source/common/utility/printf.h index b2511ec8f..96cc51765 100644 --- a/source/common/utility/printf.h +++ b/source/common/utility/printf.h @@ -52,6 +52,12 @@ int DPrintf (int level, const char *format, ...) ATTRIBUTE((format(printf,2,3))) void OSD_Printf(const char *format, ...) ATTRIBUTE((format(printf,1,2))); +// Sometimes compilers can be really stupid... (but why do I have to globally silence the warning to make the compiler shut up here...???) +#if defined(__GNUC__) || defined(__clang__) +//#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" +#endif + template inline void initprintf(const char *format, Args&&... args) //ATTRIBUTE((format(printf,1,2))) { @@ -65,6 +71,11 @@ inline void buildprintf(const char *format, Args&&... args) //ATTRIBUTE((format( OSD_Printf(format, std::forward(args)...); } +/* +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif + */ inline void initputs(const char *s) diff --git a/source/duke3d/CMakeLists.txt b/source/duke3d/CMakeLists.txt index 9d5319995..9b8f91578 100644 --- a/source/duke3d/CMakeLists.txt +++ b/source/duke3d/CMakeLists.txt @@ -1,7 +1,13 @@ cmake_minimum_required( VERSION 3.1.0 ) +require_stricmp() +require_strnicmp() + +# Build does not work with signed chars! if (MSVC) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /J" ) +else() + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -funsigned-char -Wno-missing-braces -Wno-char-subscripts" ) endif() include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/../../build/include" ) @@ -13,6 +19,7 @@ include_directories( "${ZLIB_INCLUDE_DIR}" "${ZMUSIC_INCLUDE_DIR}" "${BZIP2_INCL endif() include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/../build/include ${CMAKE_CURRENT_SOURCE_DIR}/../audiolib/include ${CMAKE_CURRENT_SOURCE_DIR}/../libsmackerdec/include diff --git a/source/duke3d/src/anim.cpp b/source/duke3d/src/anim.cpp index 7b6fadd5e..660fc3ca2 100644 --- a/source/duke3d/src/anim.cpp +++ b/source/duke3d/src/anim.cpp @@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "animlib.h" #include "cmdlib.h" #include "compat.h" +#include "build.h" #include "../glbackend/glbackend.h" @@ -406,9 +407,7 @@ int32_t Anim_Play(const char *fn) #endif // ANM playback --- v v v --- -#ifdef USE_OPENGL int32_t ogltexfiltermode = hw_texfilter; -#endif TArray buffer; auto fr = fileSystem.OpenFileReader(fn, 0); diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index cc20c851a..1ae2cb404 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -1261,7 +1261,7 @@ void Screen_Play(void) #if !defined LUNATIC #if defined __GNUC__ || defined __clang__ -# define CON_USE_COMPUTED_GOTO +// # define CON_USE_COMPUTED_GOTO does not work anymore with some of the changes. #endif #ifdef CON_USE_COMPUTED_GOTO diff --git a/source/duke3d/src/sounds.cpp b/source/duke3d/src/sounds.cpp index a35defd22..f0740f0c4 100644 --- a/source/duke3d/src/sounds.cpp +++ b/source/duke3d/src/sounds.cpp @@ -35,7 +35,7 @@ class DukeSoundEngine : public SoundEngine { // client specific parts of the sound engine go in this class. void CalcPosVel(int type, const void* source, const float pt[3], int channum, int chanflags, FSoundID chanSound, FVector3* pos, FVector3* vel, FSoundChan *chan) override; - TArray ReadSound(int lumpnum); + TArray ReadSound(int lumpnum) override; public: DukeSoundEngine() diff --git a/source/exhumed/CMakeLists.txt b/source/exhumed/CMakeLists.txt index d80b8d87f..25a40c030 100644 --- a/source/exhumed/CMakeLists.txt +++ b/source/exhumed/CMakeLists.txt @@ -1,7 +1,13 @@ cmake_minimum_required( VERSION 3.1.0 ) +require_stricmp() +require_strnicmp() + +# Build does not work with signed chars! if (MSVC) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /J" ) +else() + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -funsigned-char -Wno-missing-braces -Wno-char-subscripts" ) endif() include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/../../build/include" ) @@ -13,6 +19,7 @@ include_directories( "${ZLIB_INCLUDE_DIR}" "${ZMUSIC_INCLUDE_DIR}" "${BZIP2_INCL endif() include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/../build/include ${CMAKE_CURRENT_SOURCE_DIR}/../libsmackerdec/include ${CMAKE_CURRENT_SOURCE_DIR}/../thirdparty/include diff --git a/source/glbackend/gl_renderstate.h b/source/glbackend/gl_renderstate.h index 1807e55b7..4f623e672 100644 --- a/source/glbackend/gl_renderstate.h +++ b/source/glbackend/gl_renderstate.h @@ -1,6 +1,6 @@ #pragma once -#include "PalEntry.h" +#include "palentry.h" #include "gl_buffers.h" #include "renderstyle.h" class PolymostShader; diff --git a/source/platform/posix/cocoa/i_main.mm b/source/platform/posix/cocoa/i_main.mm index d0108d2a7..6cdcb676f 100644 --- a/source/platform/posix/cocoa/i_main.mm +++ b/source/platform/posix/cocoa/i_main.mm @@ -32,19 +32,18 @@ */ #include "i_common.h" -#include "s_sound.h" +#include "s_soundinternal.h" #include #include "c_console.h" #include "c_cvars.h" #include "cmdlib.h" -#include "d_main.h" #include "i_system.h" #include "m_argv.h" #include "st_console.h" #include "version.h" -#include "doomerrors.h" +#include "printf.h" #include "s_music.h" diff --git a/source/platform/posix/cocoa/i_system.mm b/source/platform/posix/cocoa/i_system.mm index e28443490..52e5626bf 100644 --- a/source/platform/posix/cocoa/i_system.mm +++ b/source/platform/posix/cocoa/i_system.mm @@ -36,11 +36,6 @@ #include #include -#include "d_protocol.h" -#include "doomdef.h" -#include "doomerrors.h" -#include "doomstat.h" -#include "g_game.h" #include "gameconfigfile.h" #include "i_sound.h" #include "i_system.h" diff --git a/source/platform/posix/cocoa/i_video.mm b/source/platform/posix/cocoa/i_video.mm index b06fb0bb8..b89e99457 100644 --- a/source/platform/posix/cocoa/i_video.mm +++ b/source/platform/posix/cocoa/i_video.mm @@ -44,7 +44,6 @@ #include "v_video.h" #include "bitmap.h" #include "c_dispatch.h" -#include "doomstat.h" #include "hardware.h" #include "i_system.h" #include "m_argv.h" diff --git a/source/platform/posix/cocoa/st_console.mm b/source/platform/posix/cocoa/st_console.mm index 93d0a1320..fbf9931de 100644 --- a/source/platform/posix/cocoa/st_console.mm +++ b/source/platform/posix/cocoa/st_console.mm @@ -33,7 +33,6 @@ #include "i_common.h" -#include "d_main.h" #include "st_console.h" #include "v_text.h" #include "version.h" diff --git a/source/platform/posix/cocoa/st_start.mm b/source/platform/posix/cocoa/st_start.mm index feaa5412f..2dd98293f 100644 --- a/source/platform/posix/cocoa/st_start.mm +++ b/source/platform/posix/cocoa/st_start.mm @@ -36,7 +36,6 @@ #import #include "c_cvars.h" -#include "doomtype.h" #include "st_console.h" #include "st_start.h" #include "doomerrors.h" diff --git a/source/platform/posix/osx/iwadpicker_cocoa.mm b/source/platform/posix/osx/iwadpicker_cocoa.mm index fd9c60014..3c5189d46 100644 --- a/source/platform/posix/osx/iwadpicker_cocoa.mm +++ b/source/platform/posix/osx/iwadpicker_cocoa.mm @@ -34,7 +34,6 @@ */ #include "cmdlib.h" -#include "d_main.h" #include "version.h" #include "c_cvars.h" #include "m_argv.h" diff --git a/source/rr/CMakeLists.txt b/source/rr/CMakeLists.txt index 6d77db574..451dca968 100644 --- a/source/rr/CMakeLists.txt +++ b/source/rr/CMakeLists.txt @@ -1,7 +1,13 @@ cmake_minimum_required( VERSION 3.1.0 ) +require_stricmp() +require_strnicmp() + +# Build does not work with signed chars! if (MSVC) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /J" ) +else() + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -funsigned-char -Wno-missing-braces -Wno-char-subscripts" ) endif() include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/../../build/include" ) @@ -13,6 +19,7 @@ include_directories( "${ZLIB_INCLUDE_DIR}" "${ZMUSIC_INCLUDE_DIR}" "${BZIP2_INCL endif() include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/../build/include ${CMAKE_CURRENT_SOURCE_DIR}/../audiolib/include ${CMAKE_CURRENT_SOURCE_DIR}/../libsmackerdec/include diff --git a/source/rr/src/anim.cpp b/source/rr/src/anim.cpp index 59aef53e9..0c08ae27a 100644 --- a/source/rr/src/anim.cpp +++ b/source/rr/src/anim.cpp @@ -440,9 +440,7 @@ int32_t Anim_Play(const char *fn) #endif // ANM playback --- v v v --- -#ifdef USE_OPENGL int32_t ogltexfiltermode = hw_texfilter; -#endif auto fr = fileSystem.OpenFileReader(fn, 0); if (!fr.isOpen()) diff --git a/source/rr/src/duke3d.h b/source/rr/src/duke3d.h index 9b33fa3f7..0b73ca1e5 100644 --- a/source/rr/src/duke3d.h +++ b/source/rr/src/duke3d.h @@ -153,7 +153,7 @@ struct GameInterface : ::GameInterface void set_hud_scale(int size) override; FString statFPS() override; GameStats getStats() override; - void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags); + void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags) override; void MenuOpened() override; void MenuSound(EMenuSounds snd) override; void MenuClosed() override; diff --git a/source/sw/CMakeLists.txt b/source/sw/CMakeLists.txt index 287891785..4e7b8df9d 100644 --- a/source/sw/CMakeLists.txt +++ b/source/sw/CMakeLists.txt @@ -1,7 +1,13 @@ cmake_minimum_required( VERSION 3.1.0 ) +require_stricmp() +require_strnicmp() + +# Build does not work with signed chars! if (MSVC) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /J" ) +else() + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -funsigned-char -Wno-missing-braces -Wno-char-subscripts" ) endif() include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/../../build/include" ) @@ -13,6 +19,7 @@ include_directories( "${ZLIB_INCLUDE_DIR}" "${ZMUSIC_INCLUDE_DIR}" "${BZIP2_INCL endif() include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/../build/include ${CMAKE_CURRENT_SOURCE_DIR}/../audiolib/include ${CMAKE_CURRENT_SOURCE_DIR}/../libsmackerdec/include diff --git a/source/sw/src/actor.cpp b/source/sw/src/actor.cpp index ec231b0ec..1057561c2 100644 --- a/source/sw/src/actor.cpp +++ b/source/sw/src/actor.cpp @@ -300,7 +300,6 @@ DoActorDie(short SpriteNum, short weapon) void DoDebrisCurrent(SPRITEp sp) { - int xvect, yvect; int nx, ny; int ret=0; USERp u = User[sp - sprite]; @@ -400,9 +399,7 @@ DoActorSectorDamage(short SpriteNum) int move_debris(short SpriteNum, int xchange, int ychange, int zchange) { - SPRITEp sp = &sprite[SpriteNum]; USERp u = User[SpriteNum]; - int nx, ny; u->ret = move_sprite(SpriteNum, xchange, ychange, zchange, u->ceiling_dist, u->floor_dist, 0, ACTORMOVETICS); @@ -622,7 +619,6 @@ int DoActorBeginSlide(short SpriteNum, short ang, short vel, short dec) { USERp u = User[SpriteNum]; - SPRITEp sp = User[SpriteNum]->SpriteP; SET(u->Flags, SPR_SLIDING); @@ -642,7 +638,6 @@ int DoActorSlide(short SpriteNum) { USERp u = User[SpriteNum]; - SPRITEp sp = User[SpriteNum]->SpriteP; int nx, ny; nx = u->slide_vel * (int) sintable[NORM_ANGLE(u->slide_ang + 512)] >> 14; @@ -670,7 +665,6 @@ int DoActorBeginJump(short SpriteNum) { USERp u = User[SpriteNum]; - SPRITEp sp = User[SpriteNum]->SpriteP; SET(u->Flags, SPR_JUMPING); RESET(u->Flags, SPR_FALLING); diff --git a/source/sw/src/border.cpp b/source/sw/src/border.cpp index e1d982cf5..5807cad41 100644 --- a/source/sw/src/border.cpp +++ b/source/sw/src/border.cpp @@ -146,7 +146,6 @@ void SetConsoleDmost(void) { int ystart; - int xstart; int i; int adj=0; @@ -289,8 +288,7 @@ void DrawBorderShade(PLAYERp pp, short shade_num, short wx1, short wy1, short wx void BorderShade(PLAYERp pp, SWBOOL refresh) { - int i, j, k, l, wx1, wx2, wy1, wy2; - PANEL_SPRITEp psp; + int wx1, wx2, wy1, wy2; uint8_t lines; wx1 = windowxy1.x - 1; @@ -457,7 +455,6 @@ static void BorderSetView(PLAYERp, int *Xdim, int *Ydim, int *ScreenSize) static void BorderRefresh(PLAYERp pp) { - int i, j; int x, x2, y, y2; BORDER_INFO *b; @@ -521,9 +518,7 @@ BorderRefresh(PLAYERp pp) void SetBorder(PLAYERp pp, int value) { - int diff; int Xdim, Ydim, ScreenSize; - SWBOOL set_view = TRUE; if (pp != Player + myconnectindex) return; @@ -566,7 +561,6 @@ void SetBorder(PLAYERp pp, int value) void SetRedrawScreen(PLAYERp pp) { - int i, j; BORDER_INFO *b; if (pp != Player + myconnectindex) diff --git a/source/sw/src/cheats.cpp b/source/sw/src/cheats.cpp index b1e04bb45..f36d3c62c 100644 --- a/source/sw/src/cheats.cpp +++ b/source/sw/src/cheats.cpp @@ -269,7 +269,7 @@ void ItemCheat(PLAYERp pp, const char *cheat_string) PlayerUpdateKeys(pp); } -VOID HealCheat(PLAYERp pp, const char *cheat_string) +void HealCheat(PLAYERp pp, const char *cheat_string) { short pnum; const char *str = nullptr; @@ -283,7 +283,7 @@ VOID HealCheat(PLAYERp pp, const char *cheat_string) if (str) PutStringInfo(pp, GStrings(str)); } -VOID SortKeyCheat(PLAYERp pp, const char *sKey) +void SortKeyCheat(PLAYERp pp, const char *sKey) { const char *sTemp = ""; @@ -341,7 +341,7 @@ VOID SortKeyCheat(PLAYERp pp, const char *sKey) KeysCheat(pp, sTemp); } -VOID KeysCheat(PLAYERp pp, const char *cheat_string) +void KeysCheat(PLAYERp pp, const char *cheat_string) { // Get KEYS PLAYERp p; diff --git a/source/sw/src/common.cpp b/source/sw/src/common.cpp index 6674ce4b9..00877fbec 100644 --- a/source/sw/src/common.cpp +++ b/source/sw/src/common.cpp @@ -4,8 +4,6 @@ #ifdef _WIN32 # include "windows_inc.h" -#elif defined __APPLE__ -# include "osxbits.h" #endif #include "common.h" diff --git a/source/sw/src/sector.cpp b/source/sw/src/sector.cpp index ce7f5fdf2..08417e912 100644 --- a/source/sw/src/sector.cpp +++ b/source/sw/src/sector.cpp @@ -2141,10 +2141,9 @@ OperateTripTrigger(PLAYERp pp) if (pp == Player+myconnectindex) PlayerSound(DIGI_ANCIENTSECRET, v3df_dontpan|v3df_doppler|v3df_follow,pp); - sprintf(ds, GStrings("TXTS_SECRET")); SECRET_Trigger(pp->cursectnum); - PutStringInfo(pp, ds); + PutStringInfo(pp, GStrings("TXTS_SECRET")); // always give to the first player Player->SecretsFound++; sectp->lotag = 0;