- first attempt to compile on a Mac

This could have gone better, there's far too many warnings here
This commit is contained in:
Christoph Oelckers 2020-01-06 02:41:47 +01:00
parent e45cf19936
commit 134122335b
38 changed files with 122 additions and 89 deletions

View file

@ -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)

View file

@ -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 )
@ -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.

View file

@ -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

View file

@ -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)

View file

@ -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;
}
}

View file

@ -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];

View file

@ -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);

View file

@ -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<uint8_t> ReadSound(int lumpnum);
TArray<uint8_t> ReadSound(int lumpnum) override;
public:
BloodSoundEngine()

View file

@ -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;

View file

@ -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);

View file

@ -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 <Windows.h>
#include <CommCtrl.h>
#endif
#include <signal.h>
#include <string>
#include <stdexcept>

View file

@ -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;

View file

@ -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(); }
};

View file

@ -1,4 +1,4 @@
#pragma once;
#pragma once
#include "c_cvars.h"
EXTERN_CVAR(Bool, cl_crosshair)

View file

@ -487,6 +487,7 @@ struct BuildArtFile
{
filename = std::move(other.filename);
RawData = std::move(other.RawData);
return *this;
}
};

View file

@ -12,6 +12,17 @@
#include <stdarg.h>
#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 <typename T, size_t N>
char(&_ArraySizeHelper(T(&array)[N]))[N];

View file

@ -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<class... Args>
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>(args)...);
}
/*
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop
#endif
*/
inline void initputs(const char *s)

View file

@ -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

View file

@ -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<uint8_t> buffer;
auto fr = fileSystem.OpenFileReader(fn, 0);

View file

@ -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

View file

@ -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<uint8_t> ReadSound(int lumpnum);
TArray<uint8_t> ReadSound(int lumpnum) override;
public:
DukeSoundEngine()

View file

@ -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

View file

@ -1,6 +1,6 @@
#pragma once
#include "PalEntry.h"
#include "palentry.h"
#include "gl_buffers.h"
#include "renderstyle.h"
class PolymostShader;

View file

@ -32,19 +32,18 @@
*/
#include "i_common.h"
#include "s_sound.h"
#include "s_soundinternal.h"
#include <sys/sysctl.h>
#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"

View file

@ -36,11 +36,6 @@
#include <fnmatch.h>
#include <sys/sysctl.h>
#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"

View file

@ -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"

View file

@ -33,7 +33,6 @@
#include "i_common.h"
#include "d_main.h"
#include "st_console.h"
#include "v_text.h"
#include "version.h"

View file

@ -36,7 +36,6 @@
#import <Foundation/NSRunLoop.h>
#include "c_cvars.h"
#include "doomtype.h"
#include "st_console.h"
#include "st_start.h"
#include "doomerrors.h"

View file

@ -34,7 +34,6 @@
*/
#include "cmdlib.h"
#include "d_main.h"
#include "version.h"
#include "c_cvars.h"
#include "m_argv.h"

View file

@ -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

View file

@ -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())

View file

@ -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;

View file

@ -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

View file

@ -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);

View file

@ -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)

View file

@ -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;

View file

@ -4,8 +4,6 @@
#ifdef _WIN32
# include "windows_inc.h"
#elif defined __APPLE__
# include "osxbits.h"
#endif
#include "common.h"

View file

@ -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;