diff --git a/README.md b/README.md new file mode 100644 index 00000000..1d5c0afc --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# Half-Life SDK for Xash3D + +Half-Life SDK for Xash3D with some fixes. + +## How to build + +### Windows + +TODO + +### Linux + +TODO + +### OS X + +TODO + +### FreeBSD + +``` + cd dlls + gmake CXX=clang++ CC=clang + cd ../cl_dll + gmake CXX=clang++ CC=clang +``` + diff --git a/cl_dll/Makefile b/cl_dll/Makefile new file mode 100644 index 00000000..983b61c0 --- /dev/null +++ b/cl_dll/Makefile @@ -0,0 +1,89 @@ +CC?=gcc +CXX?=g++ +SRCS+=../dlls/crossbow.cpp +SRCS+=../dlls/crowbar.cpp +SRCS+=../dlls/egon.cpp +SRCS+=./ev_hldm.cpp +SRCS+=../dlls/gauss.cpp +SRCS+=../dlls/handgrenade.cpp +SRCS+=./hl/hl_baseentity.cpp +SRCS+=./hl/hl_events.cpp +SRCS+=./hl/hl_objects.cpp +SRCS+=./hl/hl_weapons.cpp +SRCS+=../dlls/glock.cpp +SRCS+=../dlls/hornetgun.cpp +#SRCS+=../common/interface.cpp +SRCS+=../dlls/mp5.cpp +SRCS+=../dlls/python.cpp +SRCS+=../dlls/rpg.cpp +SRCS+=../dlls/satchel.cpp +SRCS+=../dlls/shotgun.cpp +SRCS+=../dlls/squeakgrenade.cpp +SRCS+=../dlls/tripmine.cpp +#SRCS+=../game_shared/voice_banmgr.cpp +#SRCS+=../game_shared/voice_status.cpp +SRCS+=./ammo.cpp +SRCS+=./ammo_secondary.cpp +SRCS+=./ammohistory.cpp +SRCS+=./battery.cpp +SRCS+=./cdll_int.cpp +SRCS+=./com_weapons.cpp +SRCS+=./death.cpp +SRCS+=./demo.cpp +SRCS+=./entity.cpp +SRCS+=./ev_common.cpp +SRCS+=./events.cpp +SRCS+=./flashlight.cpp +SRCS+=./GameStudioModelRenderer.cpp +SRCS+=./geiger.cpp +SRCS+=./health.cpp +SRCS+=./hud.cpp +SRCS+=./hud_msg.cpp +SRCS+=./hud_redraw.cpp +#SRCS+=./hud_servers.cpp +SRCS+=./hud_spectator.cpp +SRCS+=./hud_update.cpp +SRCS+=./in_camera.cpp +SRCS+=./input.cpp +#SRCS+=./inputw32.cpp +SRCS+=./menu.cpp +SRCS+=./message.cpp +SRCS+=./overview.cpp +SRCS+=./parsemsg.cpp +SRCS_C+=../pm_shared/pm_debug.c +SRCS_C+=../pm_shared/pm_math.c +SRCS_C+=../pm_shared/pm_shared.c +SRCS+=./saytext.cpp +SRCS+=./status_icons.cpp +SRCS+=./statusbar.cpp +SRCS+=./studio_util.cpp +SRCS+=./StudioModelRenderer.cpp +SRCS+=./text_message.cpp +SRCS+=./train.cpp +SRCS+=./tri.cpp +SRCS+=./util.cpp +SRCS+=./view.cpp +SRCS+=./input_xash3d.cpp +SRCS+=./scoreboard.cpp +SRCS+=./MOTD.cpp +INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls +DEFINES = -Wno-write-strings -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL +CFLAGS = -m32 +OBJS = $(SRCS:.cpp=.o) $(SRCS_C:.c=.o) + +LIBS=-lm + +ifeq ($(shell uname -s),Linux) + LIBS=$(LIBS) -ldl +endif + +%.o : %.c + $(CC) $(CFLAGS) $(INCLUDES) $(DEFINES) -fPIC -c $< -o $@ + +%.o : %.cpp + $(CXX) $(CFLAGS) $(INCLUDES) $(DEFINES) -fPIC -c $< -o $@ +client.so : $(OBJS) + $(CXX) $(OBJS) -o client.so -shared -Wl,--no-undefined -fPIC $(LIBS) + +clean: + $(RM) $(OBJS) diff --git a/dlls/Makefile b/dlls/Makefile index 374be650..c75731d5 100644 --- a/dlls/Makefile +++ b/dlls/Makefile @@ -9,7 +9,8 @@ DLLNAME=hl ARCH=i386 #make sure this is the correct compiler for your system -CC=gcc +CC?=gcc +CXX?=g++ DLL_SRCDIR=. ENGINE_SRCDIR=../engine @@ -24,10 +25,10 @@ PM_SHARED_OBJDIR=$(PM_SHARED_SRCDIR)/obj GAME_SHARED_OBJDIR=$(GAME_SHARED_SRCDIR)/obj BASE_CFLAGS= -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \ - -DCLIENT_WEAPONS + -DCLIENT_WEAPONS -DNO_VOICEGAMEMGR #safe optimization -CFLAGS=$(BASE_CFLAGS) -w -m486 -O1 +CFLAGS=$(BASE_CFLAGS) -m32 -w -O1 #full optimization #CFLAGS=$(BASE_CFLAGS) -w -O1 -m486 -ffast-math -funroll-loops \ @@ -46,6 +47,7 @@ SHLIBCFLAGS=-fPIC SHLIBLDFLAGS=-shared DO_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) $(INCLUDEDIRS) -o $@ -c $< +DO_CXX=$(CXX) $(CFLAGS) $(SHLIBCFLAGS) $(INCLUDEDIRS) -o $@ -c $< ############################################################################# # SETUP AND BUILD @@ -53,13 +55,13 @@ DO_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) $(INCLUDEDIRS) -o $@ -c $< ############################################################################# $(DLL_OBJDIR)/%.o: $(DLL_SRCDIR)/%.cpp - $(DO_CC) + $(DO_CXX) $(WPN_SHARED_OBJDIR)/%.o: $(WPN_SHARED_SRCDIR)/%.cpp - $(DO_CC) + $(DO_CXX) $(GAME_SHARED_OBJDIR)/%.o: $(GAME_SHARED_SRCDIR)/%.cpp - $(DO_CC) + $(DO_CXX) $(PM_SHARED_OBJDIR)/%.o: $(PM_SHARED_SRCDIR)/%.c $(DO_CC) @@ -161,14 +163,14 @@ OBJ = \ $(DLL_OBJDIR)/world.o \ $(DLL_OBJDIR)/xen.o \ $(DLL_OBJDIR)/zombie.o \ - $(WPN_SHARED_OBJDIR)/hl_wpn_glock.o \ - $(GAME_SHARED_OBJDIR)/voice_gamemgr.o \ + $(DLL_OBJDIR)/glock.o \ $(PM_SHARED_OBJDIR)/pm_debug.o \ $(PM_SHARED_OBJDIR)/pm_math.o \ - $(PM_SHARED_OBJDIR)/pm_shared.o + $(PM_SHARED_OBJDIR)/pm_shared.o +# $(GAME_SHARED_OBJDIR)/voice_gamemgr.o $(DLLNAME)_$(ARCH).$(SHLIBEXT) : neat $(OBJ) - $(CC) $(CFLAGS) $(SHLIBLDFLAGS) $(LDFLAGS) -o $@ $(OBJ) + $(CXX) $(CFLAGS) $(SHLIBLDFLAGS) $(LDFLAGS) -o $@ $(OBJ) neat: -mkdir $(DLL_OBJDIR) diff --git a/dlls/nodes.cpp b/dlls/nodes.cpp index d512e54c..d72dabb3 100644 --- a/dlls/nodes.cpp +++ b/dlls/nodes.cpp @@ -40,7 +40,7 @@ CGraph WorldGraph; LINK_ENTITY_TO_CLASS( info_node, CNodeEnt ); LINK_ENTITY_TO_CLASS( info_node_air, CNodeEnt ); -#if defined _LINUX && !defined _WIN32 +#if !defined _WIN32 #include #include #define CreateDirectory(p, n) mkdir(p, 0777)