feat: Compileable Mac OS

This commit is contained in:
jonnypower 2018-04-24 23:15:48 -07:00
parent b7625be69a
commit ea2a5833b7
13 changed files with 25 additions and 26 deletions

View file

@ -35,7 +35,6 @@
using namespace vgui; using namespace vgui;
class Cursor;
class ScorePanel; class ScorePanel;
class SpectatorPanel; class SpectatorPanel;
class CCommandMenu; class CCommandMenu;

View file

@ -334,7 +334,7 @@ public:
void SetCustomDecalFrames( int nFrames ); void SetCustomDecalFrames( int nFrames );
int GetCustomDecalFrames( void ); int GetCustomDecalFrames( void );
void CBasePlayer::TabulateAmmo( void ); void TabulateAmmo( void );
float m_flStartCharge; float m_flStartCharge;
float m_flAmmoStartCharge; float m_flAmmoStartCharge;

View file

@ -183,7 +183,7 @@ const char *CHalfLifeTeamplay::SetDefaultPlayerTeam( CBasePlayer *pPlayer )
// update the current player of the team he is joining // update the current player of the team he is joining
const char* theTeamName = pPlayer->TeamID(); const char* theTeamName = pPlayer->TeamID();
if ( theTeamName == '\0' || !IsValidTeam( theTeamName ) || defaultteam.value ) if ( (int)(size_t)theTeamName == '\0' || !IsValidTeam( theTeamName ) || defaultteam.value )
{ {
const char *pTeamName = NULL; const char *pTeamName = NULL;

View file

@ -60,10 +60,10 @@ ifeq ($(OS),Darwin)
ifeq ($(origin CC), default) ifeq ($(origin CC), default)
CC ="$(COMPILER_BIN_DIR)/clang -Qunused-arguments -isysroot $(SDKROOT) -mmacosx-version-min=10.5 -fasm-blocks -I$(SDKROOT)/usr/include/malloc $(ARCH_FLAGS)" CC ="$(COMPILER_BIN_DIR)/clang -Qunused-arguments -isysroot $(SDKROOT) -mmacosx-version-min=10.5 -fasm-blocks -I$(SDKROOT)/usr/include/malloc $(ARCH_FLAGS)"
endif endif
ifeq ($(origin CXX), default) ifeq ($(origin CPLUS), default)
CPLUS ="$(COMPILER_BIN_DIR)/clang++ -Qunused-arguments -isysroot $(SDKROOT) -mmacosx-version-min=10.5 -fasm-blocks -I$(SDKROOT)/usr/include/malloc $(ARCH_FLAGS)" CPLUS ="$(COMPILER_BIN_DIR)/clang++ -Qunused-arguments -isysroot $(SDKROOT) -mmacosx-version-min=10.5 -fasm-blocks -I$(SDKROOT)/usr/include/malloc $(ARCH_FLAGS)"
endif endif
LINK ?= $(CXX) LINK ?= $(CPLUS)
endif endif
CLINK=$(CC) CLINK=$(CC)
@ -88,8 +88,8 @@ endif
ifeq ($(OS),Darwin) ifeq ($(OS),Darwin)
# force 387 for FP math so the precision between win32 and linux and osx match # force 387 for FP math so the precision between win32 and linux and osx match
ARCH_CFLAGS_I486+=-march=pentium-m -mfpmath=387 ARCH_CFLAGS_I486+=-target i386-apple-darwin16.7.0 -DCMAKE_OSX_ARCHITECTURES=i386
ARCH_CFLAGS_I686+=-march=pentium-m -mfpmath=387 ARCH_CFLAGS_I686+=-target i386-apple-darwin16.7.0 -DCMAKE_OSX_ARCHITECTURES=i386
ARCH_CFLAGS_AMD+=-mfpmath=387 ARCH_CFLAGS_AMD+=-mfpmath=387
endif endif
@ -100,7 +100,7 @@ BASE_CFLAGS=-fpermissive -fno-strict-aliasing -DNDEBUG -DPOSIX -D_POSIX -DLINUX
BASE_CFLAGS+=-w BASE_CFLAGS+=-w
ifeq ($(OS),Darwin) ifeq ($(OS),Darwin)
BASE_CFLAGS += -DOSX -D_OSX -fvisibility=hidden BASE_CFLAGS += -DOSX -D_OSX -fvisibility=hidden -DCMAKE_OSX_ARCHITECTURES=i386
else else
BASE_CFLAGS+= -DLINUX -D_LINUX BASE_CFLAGS+= -DLINUX -D_LINUX
endif endif
@ -109,7 +109,7 @@ DEDICATED_CFLAGS="-DDEDICATED -DSWDS"
ifeq ($(OS),Darwin) ifeq ($(OS),Darwin)
SHLIBEXT=dylib SHLIBEXT=dylib
SHLIBCFLAGS= SHLIBCFLAGS=
SHLIBLDFLAGS="-shared -gdwarf-2 -g2" SHLIBLDFLAGS="-shared -gdwarf-2 -g2 -DCMAKE_OSX_ARCHITECTURES=i386 -target i386-apple-darwin16.7.0"
else else
SHLIBEXT=so SHLIBEXT=so
SHLIBCFLAGS= SHLIBCFLAGS=

View file

@ -30,7 +30,7 @@ CFLAGS=$(BASE_CFLAGS) $(ARCH_CFLAGS) -DCLIENT_DLL -I/usr/include/malloc -D_snwpr
INCLUDEDIRS= -I$(HL_SRC_DIR) -I$(NS_MOD_SRC_DIR) -I$(COMMON_SRC_DIR) -I$(PUBLIC_SRC_DIR) -I$(PM_SHARED_SRC_DIR) -I../engine -I$(GAME_SHARED_SRC_DIR) -I../external/ -I../particles -I../includes/fmodapi375linux/api/inc -I$(HL_SERVER_SRC_DIR) -I$(HL_SRC_DIR)/cl_dll -I$(VGUI_INCLUDE_DIR) -I$(UI_INCLUDE_DIR) -I$(UTIL_SRC_DIR) -I../ -I../includes/fmodapi375linux/api -I../includes/lpng1251 INCLUDEDIRS= -I$(HL_SRC_DIR) -I$(NS_MOD_SRC_DIR) -I$(COMMON_SRC_DIR) -I$(PUBLIC_SRC_DIR) -I$(PM_SHARED_SRC_DIR) -I../engine -I$(GAME_SHARED_SRC_DIR) -I../external/ -I../particles -I../includes/fmodapi375linux/api/inc -I$(HL_SERVER_SRC_DIR) -I$(HL_SRC_DIR)/cl_dll -I$(VGUI_INCLUDE_DIR) -I$(UI_INCLUDE_DIR) -I$(UTIL_SRC_DIR) -I../ -I../includes/fmodapi375linux/api -I../includes/lpng1251
ifeq ($(OS),Darwin) ifeq ($(OS),Darwin)
LDFLAGS=$(SHLIBLDFLAGS) $(CPP_LIB) -framework Carbon $(CFG)/vgui.dylib -L. -lSDL2-2.0.0 LDFLAGS=$(SHLIBLDFLAGS) $(CPP_LIB) -L. libpng12.dylib -lz -framework Carbon $(CFG)/vgui.dylib -L. -lSDL2-2.0.0 -L. libparticleMP.a
else else
LDFLAGS=$(SHLIBLDFLAGS) $(CPP_LIB) -lpng -lz -lfmod-3.75 -L$(CFG) vgui.so -L. libSDL2-2.0.so.0 -L. libparticleMP.a LDFLAGS=$(SHLIBLDFLAGS) $(CPP_LIB) -lpng -lz -lfmod-3.75 -L$(CFG) vgui.so -L. libSDL2-2.0.so.0 -L. libparticleMP.a
endif endif

Binary file not shown.

Binary file not shown.

BIN
main/source/linux/libpng12.dylib Executable file

Binary file not shown.

View file

@ -5659,7 +5659,7 @@ string AvHHud::GetRankTitle(bool inShowUnspentLevels) const
{ {
string theText; string theText;
char* theTeamName = this->GetIsMarine() ? "Marine" : "Alien"; char const* theTeamName = this->GetIsMarine() ? "Marine" : "Alien";
int theCurrentLevel = this->GetHUDExperienceLevel(); int theCurrentLevel = this->GetHUDExperienceLevel();
char theCharArray[512]; char theCharArray[512];

View file

@ -454,7 +454,7 @@ void CollisionChecker::SetIgnoreEntityClass(int ignore_entity_class)
int CollisionChecker::GetContentsAtPoint(const nspoint_t& point) const int CollisionChecker::GetContentsAtPoint(const nspoint_t& point) const
{ {
return GetContents(&PointCollisionTest(point)); return GetContents(new PointCollisionTest(point));
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@ -468,14 +468,14 @@ int CollisionChecker::GetWorldContentsAtPoint(const nspoint_t& point) const
int CollisionChecker::GetAllEntityContentsAtPoint(const nspoint_t& point) const int CollisionChecker::GetAllEntityContentsAtPoint(const nspoint_t& point) const
{ {
return GetAllEntityContents(&PointCollisionTest(point)); return GetAllEntityContents(new PointCollisionTest(point));
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
int CollisionChecker::GetSingleEntityContentsAtPoint(const nspoint_t& point, int entity_index) const int CollisionChecker::GetSingleEntityContentsAtPoint(const nspoint_t& point, int entity_index) const
{ {
return GetSingleEntityContents(&PointCollisionTest(point),entity_index); return GetSingleEntityContents(new PointCollisionTest(point),entity_index);
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@ -486,28 +486,28 @@ const static nspoint_t CYLINDER_UP_DEFAULT = {0,0,1.0f};
int CollisionChecker::GetContentsInCylinder(const nspoint_t& base, float radius, float height) const int CollisionChecker::GetContentsInCylinder(const nspoint_t& base, float radius, float height) const
{ {
return GetContents(&CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height)); return GetContents(new CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height));
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
int CollisionChecker::GetWorldContentsInCylinder(const nspoint_t& base, float radius, float height) const int CollisionChecker::GetWorldContentsInCylinder(const nspoint_t& base, float radius, float height) const
{ {
return GetSingleEntityContents(&CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height),WORLD_ENTITY); return GetSingleEntityContents(new CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height),WORLD_ENTITY);
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
int CollisionChecker::GetAllEntityContentsInCylinder(const nspoint_t& base, float radius, float height) const int CollisionChecker::GetAllEntityContentsInCylinder(const nspoint_t& base, float radius, float height) const
{ {
return GetAllEntityContents(&CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height)); return GetAllEntityContents(new CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height));
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
int CollisionChecker::GetSingleEntityContentsInCylinder(const nspoint_t& base, float radius, float height, int entity_index) const int CollisionChecker::GetSingleEntityContentsInCylinder(const nspoint_t& base, float radius, float height, int entity_index) const
{ {
return GetSingleEntityContents(&CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height),entity_index); return GetSingleEntityContents(new CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height),entity_index);
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@ -516,28 +516,28 @@ int CollisionChecker::GetSingleEntityContentsInCylinder(const nspoint_t& base, f
int CollisionChecker::GetContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs) const int CollisionChecker::GetContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs) const
{ {
return GetContents(&AABBCollisionTest(mins,maxs)); return GetContents(new AABBCollisionTest(mins,maxs));
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
int CollisionChecker::GetWorldContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs) const int CollisionChecker::GetWorldContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs) const
{ {
return GetSingleEntityContents(&AABBCollisionTest(mins,maxs),WORLD_ENTITY); return GetSingleEntityContents(new AABBCollisionTest(mins,maxs),WORLD_ENTITY);
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
int CollisionChecker::GetAllEntityContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs) const int CollisionChecker::GetAllEntityContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs) const
{ {
return GetAllEntityContents(&AABBCollisionTest(mins,maxs)); return GetAllEntityContents(new AABBCollisionTest(mins,maxs));
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
int CollisionChecker::GetSingleEntityContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs, int entity_index) const int CollisionChecker::GetSingleEntityContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs, int entity_index) const
{ {
return GetSingleEntityContents(&AABBCollisionTest(mins,maxs),entity_index); return GetSingleEntityContents(new AABBCollisionTest(mins,maxs),entity_index);
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------

View file

@ -11,7 +11,7 @@
#include <windows.h> #include <windows.h>
#endif #endif
#include <GL/gl.h> #include <OpenGL/gl.h>
// XXX #include <iostream.h> // XXX #include <iostream.h>
// Emit OpenGL calls to draw the particles. These are drawn with // Emit OpenGL calls to draw the particles. These are drawn with

View file

@ -133,7 +133,7 @@ void loadImages( const int icon_number, std::vector<vgui::BitmapTGA*>& images )
std::string extension = ".tga"; std::string extension = ".tga";
std::string icon_name; std::string icon_name;
unsigned char icon_bytes[2] = { (icon_number >> 8) & 0xFF, icon_number & 0xFF }; unsigned char icon_bytes[2] = { static_cast<unsigned char>((icon_number >> 8) & 0xFF), static_cast<unsigned char>(icon_number & 0xFF )};
MakeHexPairsFromBytes(icon_bytes,icon_name,2); MakeHexPairsFromBytes(icon_bytes,icon_name,2);
icon_name = "0x" + icon_name; icon_name = "0x" + icon_name;

View file

@ -34,12 +34,12 @@ public:
void operator =(const string& inString) void operator =(const string& inString)
{ {
sprintf_s(this->mString, "%s", inString.c_str()); sprintf_s(this->mString, sizeof(this->mString), "%s", inString.c_str());
} }
void operator =(const CString& inString) void operator =(const CString& inString)
{ {
sprintf_s(this->mString, "%s", inString.mString); sprintf_s(this->mString, sizeof(this->mString), "%s", inString.mString);
} }
bool operator ==(const CString& inString) const bool operator ==(const CString& inString) const