mirror of
https://github.com/ENSL/NS.git
synced 2024-11-22 20:51:35 +00:00
Merge pull request #11 from JonnyPower/macos
Macos Support & Travis windows compile seems to work fine - merging.
This commit is contained in:
commit
dd3e9e2b4e
19 changed files with 100 additions and 28 deletions
23
.travis.yml
Normal file
23
.travis.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
language: cpp
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
script: cd main/source/linux && make
|
||||
env: OPJ_CI_ARCH=i386
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-multilib
|
||||
- g++-multilib
|
||||
- libc6-i386
|
||||
- libcurl4-openssl-dev:i386
|
||||
- libpng12-dev:i386
|
||||
|
||||
- os: osx
|
||||
compiler: clang
|
||||
before_script:
|
||||
- export CC=clang
|
||||
- export CPLUS=clang++
|
||||
script: cd main/source/linux && make
|
|
@ -75,6 +75,12 @@ LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH" gdb ./hl_linux r -game ns -dev -steam
|
|||
```
|
||||
Due to the new engine and the nature of Linux I had to make a lot of changes! You can find them with grep -Ril `@Linux`.
|
||||
|
||||
For MacOS & lldb:
|
||||
```
|
||||
DYLD_LIBRARY_PATH=".:$DYLD_LIBRARY_PATH" /Applications/Xcode.app/Contents/Developer/usr/bin/lldb -- ./hl_osx r -game ns -dev -steam -windowed
|
||||
```
|
||||
Have to use XCode's lldb to get around https://stackoverflow.com/a/33589760 (Lack of environment variables). `-windowed` as windowed mode makes it easier to deal with crashes on MacOS.
|
||||
|
||||
### Hosting a server
|
||||
|
||||
Since servers are really rare at this point in time here is a tutorial how to set up an [Natural Selection] server with [hlds].
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
|
||||
using namespace vgui;
|
||||
|
||||
class Cursor;
|
||||
class ScorePanel;
|
||||
class SpectatorPanel;
|
||||
class CCommandMenu;
|
||||
|
|
|
@ -334,7 +334,7 @@ public:
|
|||
void SetCustomDecalFrames( int nFrames );
|
||||
int GetCustomDecalFrames( void );
|
||||
|
||||
void CBasePlayer::TabulateAmmo( void );
|
||||
void TabulateAmmo( void );
|
||||
|
||||
float m_flStartCharge;
|
||||
float m_flAmmoStartCharge;
|
||||
|
|
|
@ -183,7 +183,7 @@ const char *CHalfLifeTeamplay::SetDefaultPlayerTeam( CBasePlayer *pPlayer )
|
|||
// update the current player of the team he is joining
|
||||
const char* theTeamName = pPlayer->TeamID();
|
||||
|
||||
if ( theTeamName == '\0' || !IsValidTeam( theTeamName ) || defaultteam.value )
|
||||
if ( theTeamName[0] == '\0' || !IsValidTeam( theTeamName ) || defaultteam.value )
|
||||
{
|
||||
const char *pTeamName = NULL;
|
||||
|
||||
|
|
0
main/source/includes/lpng1251/configure
vendored
Normal file → Executable file
0
main/source/includes/lpng1251/configure
vendored
Normal file → Executable file
|
@ -60,10 +60,10 @@ ifeq ($(OS),Darwin)
|
|||
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)"
|
||||
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)"
|
||||
endif
|
||||
LINK ?= $(CXX)
|
||||
LINK ?= $(CPLUS)
|
||||
endif
|
||||
|
||||
CLINK=$(CC)
|
||||
|
@ -88,9 +88,9 @@ endif
|
|||
|
||||
ifeq ($(OS),Darwin)
|
||||
# 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_I686+=-march=pentium-m -mfpmath=387
|
||||
ARCH_CFLAGS_AMD+=-mfpmath=387
|
||||
ARCH_CFLAGS_I486+=-mno-sse -mfpmath=387 -target i386-apple-darwin -DCMAKE_OSX_ARCHITECTURES=i386
|
||||
ARCH_CFLAGS_I686+=-mno-sse -mfpmath=387 -target i386-apple-darwin -DCMAKE_OSX_ARCHITECTURES=i386
|
||||
ARCH_CFLAGS_AMD+=-mno-sse -mfpmath=387 -target i386-apple-darwin -DCMAKE_OSX_ARCHITECTURES=i386
|
||||
endif
|
||||
|
||||
|
||||
|
@ -100,7 +100,7 @@ BASE_CFLAGS=-fpermissive -fno-strict-aliasing -DNDEBUG -DPOSIX -D_POSIX -DLINUX
|
|||
BASE_CFLAGS+=-w
|
||||
|
||||
ifeq ($(OS),Darwin)
|
||||
BASE_CFLAGS += -DOSX -D_OSX -fvisibility=hidden
|
||||
BASE_CFLAGS += -DOSX -D_OSX -fvisibility=hidden -target i386-apple-darwin -DCMAKE_OSX_ARCHITECTURES=i386
|
||||
else
|
||||
BASE_CFLAGS+= -DLINUX -D_LINUX
|
||||
endif
|
||||
|
@ -109,7 +109,7 @@ DEDICATED_CFLAGS="-DDEDICATED -DSWDS"
|
|||
ifeq ($(OS),Darwin)
|
||||
SHLIBEXT=dylib
|
||||
SHLIBCFLAGS=
|
||||
SHLIBLDFLAGS="-shared -gdwarf-2 -g2"
|
||||
SHLIBLDFLAGS="-shared -gdwarf-2 -g2 -DCMAKE_OSX_ARCHITECTURES=i386 -target i386-apple-darwin"
|
||||
else
|
||||
SHLIBEXT=so
|
||||
SHLIBCFLAGS=
|
||||
|
@ -131,7 +131,8 @@ all: build_dir targets
|
|||
TARGETS=
|
||||
|
||||
TARGETS+= \
|
||||
ns \
|
||||
particles \
|
||||
ns \
|
||||
hl_cdll \
|
||||
|
||||
build_dir:
|
||||
|
@ -140,6 +141,8 @@ build_dir:
|
|||
|
||||
targets: $(TARGETS)
|
||||
|
||||
particles:
|
||||
cd ../particles && make && cd ../linux && cp ../particles/libpart* .
|
||||
|
||||
hl_cdll: build_dir
|
||||
$(MAKE_hl_cdll) ARCH=i686 CC=$(CC) CPLUS=$(CPLUS) CPP_LIB="$(CPP_LIB)" BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) SOURCE_DIR=$(SOURCE_DIR) ENGINE_SRC_DIR=$(ENGINE_SRC_DIR) MOD_SRC_DIR=$(MOD_SRC_DIR) COMMON_SRC_DIR=$(COMMON_SRC_DIR) BASE_CFLAGS="$(BASE_CFLAGS)" PUBLIC_SRC_DIR=$(PUBLIC_SRC_DIR) DBG_SRC_DIR=$(DBG_SRC_DIR) ARCH_CFLAGS="$(ARCH_CFLAGS_I686)" GAME_SHARED_SRC_DIR=$(GAME_SHARED_SRC_DIR) CLINK=$(CLINK) PM_SRC_DIR=$(PM_SRC_DIR) SHLIBEXT=$(SHLIBEXT) SHLIBCFLAGS=$(SHLIBCFLAGS) SHLIBLDFLAGS=$(SHLIBLDFLAGS) CFG=$(CFG) OS=$(OS)
|
||||
|
@ -148,4 +151,5 @@ ns: build_dir
|
|||
$(MAKE_HL_LIB) CC=$(CC) ARCH=$(ARCH) CPP_LIB="$(CPP_LIB)" BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) SOURCE_DIR=$(SOURCE_DIR) ENGINE_SRC_DIR=$(ENGINE_SRC_DIR) COMMON_SRC_DIR=$(COMMON_SRC_DIR) PM_SRC_DIR=$(PM_SRC_DIR) GAME_SHARED_SRC_DIR=$(GAME_SHARED_SRC_DIR) GAMEDB_SRC_DIR=$(GAMEDB_SRC_DIR) BASE_CFLAGS="$(BASE_CFLAGS)" SHLIBEXT=$(SHLIBEXT) SHLIBCFLAGS=$(SHLIBCFLAGS) SHLIBLDFLAGS=$(SHLIBLDFLAGS) PUBLIC_SRC_DIR=$(PUBLIC_SRC_DIR) CFG=$(CFG) OS=$(OS) ARCH_CFLAGS="$(ARCH_CFLAGS_I686)"
|
||||
|
||||
clean:
|
||||
make -f ../particles/Makefile clean
|
||||
-rm -rf $(BUILD_OBJ_DIR)
|
||||
|
|
|
@ -13,6 +13,7 @@ HL_SERVER_SRC_DIR=$(SOURCE_DIR)/dlls
|
|||
GAME_SHARED_SRC_DIR=$(SOURCE_DIR)/game_shared
|
||||
PM_SHARED_SRC_DIR=$(SOURCE_DIR)/pm_shared
|
||||
TEXTREP_SRC_DIR=$(SOURCE_DIR)/textrep
|
||||
PARTICLES_SRC_DIR=$(SOURCE_DIR)/particles
|
||||
|
||||
TEXTREP_OBJ_DIR=$(HL1_OBJ_DIR)/textrep
|
||||
UTIL_OBJ_DIR=$(HL1_OBJ_DIR)/util
|
||||
|
@ -30,7 +31,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
|
||||
|
||||
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 vgui.dylib -L. -lSDL2-2.0.0 -L. libparticleMP.a
|
||||
else
|
||||
LDFLAGS=$(SHLIBLDFLAGS) $(CPP_LIB) -lpng -lz -lfmod-3.75 -L$(CFG) vgui.so -L. libSDL2-2.0.so.0 -L. libparticleMP.a
|
||||
endif
|
||||
|
|
|
@ -30,7 +30,12 @@ MOD_INCLUDEDIRS=-I$(UTIL_SRC_DIR) -I$(GAME_SHARED_SRC_DIR) -I$(HLDLL_SRC_DIR) -I
|
|||
UTIL_INCLUDEDIRS = -I../ -I../util
|
||||
TEXTREP_INCLUDEDIRS=..
|
||||
|
||||
ifeq ($(OS),Darwin)
|
||||
LDFLAGS=-lm -lcurl -lstdc++ -L. libparticleMP.a
|
||||
else
|
||||
LDFLAGS=-lm -lcurl -lstdc++ -L. libparticleMP.a
|
||||
endif
|
||||
|
||||
DO_HLDLL_CC=$(CC) $(HLDLL_INCLUDEDIRS) $(CFLAGS) -o $@ -c $<
|
||||
DO_PM_CC=$(CC) $(PM_INCLUDEDIRS) $(CFLAGS) -o $@ -c $<
|
||||
DO_GAME_SHARED_CC=$(CC) $(GAME_SHARED_INCLUDEDIRS) $(CFLAGS) -o $@ -c $<
|
||||
|
|
Binary file not shown.
BIN
main/source/linux/libpng12.dylib
Executable file
BIN
main/source/linux/libpng12.dylib
Executable file
Binary file not shown.
BIN
main/source/linux/vgui.dylib
Normal file
BIN
main/source/linux/vgui.dylib
Normal file
Binary file not shown.
|
@ -5659,7 +5659,7 @@ string AvHHud::GetRankTitle(bool inShowUnspentLevels) const
|
|||
{
|
||||
string theText;
|
||||
|
||||
char* theTeamName = this->GetIsMarine() ? "Marine" : "Alien";
|
||||
char const* theTeamName = this->GetIsMarine() ? "Marine" : "Alien";
|
||||
int theCurrentLevel = this->GetHUDExperienceLevel();
|
||||
|
||||
char theCharArray[512];
|
||||
|
|
|
@ -454,7 +454,8 @@ void CollisionChecker::SetIgnoreEntityClass(int ignore_entity_class)
|
|||
|
||||
int CollisionChecker::GetContentsAtPoint(const nspoint_t& point) const
|
||||
{
|
||||
return GetContents(&PointCollisionTest(point));
|
||||
PointCollisionTest tmp = PointCollisionTest(point);
|
||||
return GetContents(&tmp);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
@ -468,14 +469,16 @@ int CollisionChecker::GetWorldContentsAtPoint(const nspoint_t& point) const
|
|||
|
||||
int CollisionChecker::GetAllEntityContentsAtPoint(const nspoint_t& point) const
|
||||
{
|
||||
return GetAllEntityContents(&PointCollisionTest(point));
|
||||
PointCollisionTest tmp = PointCollisionTest(point);
|
||||
return GetAllEntityContents(&tmp);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
int CollisionChecker::GetSingleEntityContentsAtPoint(const nspoint_t& point, int entity_index) const
|
||||
{
|
||||
return GetSingleEntityContents(&PointCollisionTest(point),entity_index);
|
||||
PointCollisionTest tmp = PointCollisionTest(point);
|
||||
return GetSingleEntityContents(&tmp, entity_index);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
@ -486,28 +489,32 @@ const static nspoint_t CYLINDER_UP_DEFAULT = {0,0,1.0f};
|
|||
|
||||
int CollisionChecker::GetContentsInCylinder(const nspoint_t& base, float radius, float height) const
|
||||
{
|
||||
return GetContents(&CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height));
|
||||
CylinderCollisionTest tmp = CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height);
|
||||
return GetContents(&tmp);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
int CollisionChecker::GetWorldContentsInCylinder(const nspoint_t& base, float radius, float height) const
|
||||
{
|
||||
return GetSingleEntityContents(&CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height),WORLD_ENTITY);
|
||||
CylinderCollisionTest tmp = CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height);
|
||||
return GetSingleEntityContents(&tmp, WORLD_ENTITY);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
int CollisionChecker::GetAllEntityContentsInCylinder(const nspoint_t& base, float radius, float height) const
|
||||
{
|
||||
return GetAllEntityContents(&CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height));
|
||||
CylinderCollisionTest tmp = CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height);
|
||||
return GetAllEntityContents(&tmp);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
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);
|
||||
CylinderCollisionTest tmp = CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height);
|
||||
return GetSingleEntityContents(&tmp,entity_index);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
@ -516,28 +523,32 @@ int CollisionChecker::GetSingleEntityContentsInCylinder(const nspoint_t& base, f
|
|||
|
||||
int CollisionChecker::GetContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs) const
|
||||
{
|
||||
return GetContents(&AABBCollisionTest(mins,maxs));
|
||||
AABBCollisionTest tmp = AABBCollisionTest(mins,maxs);
|
||||
return GetContents(&tmp);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
int CollisionChecker::GetWorldContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs) const
|
||||
{
|
||||
return GetSingleEntityContents(&AABBCollisionTest(mins,maxs),WORLD_ENTITY);
|
||||
AABBCollisionTest tmp = AABBCollisionTest(mins,maxs);
|
||||
return GetSingleEntityContents(&tmp, WORLD_ENTITY);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
int CollisionChecker::GetAllEntityContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs) const
|
||||
{
|
||||
return GetAllEntityContents(&AABBCollisionTest(mins,maxs));
|
||||
AABBCollisionTest tmp = AABBCollisionTest(mins,maxs);
|
||||
return GetAllEntityContents(&tmp);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
int CollisionChecker::GetSingleEntityContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs, int entity_index) const
|
||||
{
|
||||
return GetSingleEntityContents(&AABBCollisionTest(mins,maxs),entity_index);
|
||||
AABBCollisionTest tmp = AABBCollisionTest(mins,maxs);
|
||||
return GetSingleEntityContents(&tmp,entity_index);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
|
|
@ -11,12 +11,21 @@ GLUT_HOME =/usr/local/contrib/unmoderated
|
|||
|
||||
MP = #-mp -DPARTICLE_MP
|
||||
|
||||
OS:=$(shell uname)
|
||||
|
||||
# Make it real fast on an Origin 2000.
|
||||
#LNO =-LNO:opt=1:fusion=2:fission=2:fusion_peeling_limit=2048:cs1=32K:cs2=8M
|
||||
COPT = $(MP) -O3 $(LNO) -fPIC
|
||||
|
||||
CFLAGS = $(COPT) $(COMPFLAGS) -I. -I.. -I$(GLUT_HOME)/include -I/usr/include/c++/4.8/ -I../common -I../public -I../pm_shared -I../engine
|
||||
|
||||
ifeq ($(OS),Darwin)
|
||||
SLIBB = libtool -static *.o -o libparticleMP.a
|
||||
CFLAGS += -target i386-apple-darwin -DCMAKE_OSX_ARCHITECTURES=i386
|
||||
else
|
||||
SLIBB = ar clq $@ $(POBJS)
|
||||
endif
|
||||
|
||||
POBJS =action_api.o actions.o HLRender.o opengl.o system.o
|
||||
|
||||
ALL = libparticleMP.a
|
||||
|
@ -31,7 +40,7 @@ all: $(ALL)
|
|||
|
||||
libparticleMP.a: $(POBJS)
|
||||
rm -f $@
|
||||
ar clq $@ $(POBJS)
|
||||
$(SLIBB)
|
||||
|
||||
SPDir:
|
||||
(make)
|
||||
|
|
Binary file not shown.
|
@ -9,9 +9,16 @@
|
|||
#ifdef WIN32
|
||||
// This is for something in gl.h.
|
||||
#include <windows.h>
|
||||
#else
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenGL/gl.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
// XXX #include <iostream.h>
|
||||
|
||||
// Emit OpenGL calls to draw the particles. These are drawn with
|
||||
|
|
|
@ -133,7 +133,14 @@ void loadImages( const int icon_number, std::vector<vgui::BitmapTGA*>& images )
|
|||
std::string extension = ".tga";
|
||||
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);
|
||||
icon_name = "0x" + icon_name;
|
||||
|
||||
|
|
|
@ -34,12 +34,12 @@ public:
|
|||
|
||||
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)
|
||||
{
|
||||
sprintf_s(this->mString, "%s", inString.mString);
|
||||
sprintf_s(this->mString, sizeof(this->mString), "%s", inString.mString);
|
||||
}
|
||||
|
||||
bool operator ==(const CString& inString) const
|
||||
|
|
Loading…
Reference in a new issue