diff --git a/engine/Makefile b/engine/Makefile index cbd86249..0ae5e183 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -44,6 +44,9 @@ endif ifndef BUILD_GAME_QVM BUILD_GAME_QVM = endif +ifndef BUILD_BASEGAME + BUILD_BASEGAME = +endif ifndef BUILD_MISSIONPACK BUILD_MISSIONPACK= 0 endif @@ -57,7 +60,7 @@ ifndef BUILD_DEFINES endif # ioquake3 svn version that this is based on -IOQ3_REVISION = 2143 +IOQ3_REVISION = 2210 ############################################################################# # @@ -97,6 +100,34 @@ else endif export CROSS_COMPILING +ifndef VERSION +VERSION=v0.0.0.3 +endif + +ifndef CLIENTBIN +CLIENTBIN=q3rally +endif + +ifndef SERVERBIN +SERVERBIN=q3rally-server +endif + +ifndef BASEGAME +BASEGAME=baseq3r +endif + +ifndef BASEGAME_CFLAGS +BASEGAME_CFLAGS= +endif + +ifndef MISSIONPACK +MISSIONPACK=missionpack +endif + +ifndef MISSIONPACK_CFLAGS +MISSIONPACK_CFLAGS=-DMISSIONPACK +endif + ifndef COPYDIR COPYDIR="/usr/local/games/quake3" endif @@ -234,9 +265,7 @@ ifneq ($(BUILD_CLIENT),0) endif endif -# version info -VERSION=v0.0.0.3 - +# Add svn version info USE_SVN= ifeq ($(wildcard .svn),.svn) SVN_REV=$(shell LANG=C svnversion .) @@ -384,20 +413,20 @@ ifeq ($(PLATFORM),darwin) BASE_CFLAGS = -Wall -Wimplicit -Wstrict-prototypes ifeq ($(ARCH),ppc) - BASE_CFLAGS += -faltivec + BASE_CFLAGS += -arch ppc -faltivec -mmacosx-version-min=10.2 OPTIMIZEVM += -O3 endif ifeq ($(ARCH),ppc64) - BASE_CFLAGS += -faltivec + BASE_CFLAGS += -arch ppc64 -faltivec -mmacosx-version-min=10.2 endif ifeq ($(ARCH),i386) OPTIMIZEVM += -march=prescott -mfpmath=sse # x86 vm will crash without -mstackrealign since MMX instructions will be # used no matter what and they corrupt the frame pointer in VM calls - BASE_CFLAGS += -m32 -mstackrealign + BASE_CFLAGS += -arch i386 -m32 -mstackrealign endif ifeq ($(ARCH),x86_64) - OPTIMIZEVM += -mfpmath=sse + OPTIMIZEVM += -arch x86_64 -mfpmath=sse endif BASE_CFLAGS += -fno-strict-aliasing -DMACOS_X -fno-common -pipe @@ -437,7 +466,7 @@ ifeq ($(PLATFORM),darwin) SHLIBEXT=dylib SHLIBCFLAGS=-fPIC -fno-common - SHLIBLDFLAGS=-dynamiclib $(LDFLAGS) + SHLIBLDFLAGS=-dynamiclib $(LDFLAGS) -Wl,-U,_com_altivec NOTSHLIBCFLAGS=-mdynamic-no-pic @@ -821,47 +850,51 @@ ifndef SHLIBNAME endif ifneq ($(BUILD_SERVER),0) - TARGETS += $(B)/q3rally-server$(FULLBINEXT) + TARGETS += $(B)/$(SERVERBIN)$(FULLBINEXT) endif ifneq ($(BUILD_CLIENT),0) ifneq ($(USE_RENDERER_DLOPEN),0) - TARGETS += $(B)/q3rally$(FULLBINEXT) $(B)/renderer_opengl1_$(SHLIBNAME) + TARGETS += $(B)/$(CLIENTBIN)$(FULLBINEXT) $(B)/renderer_opengl1_$(SHLIBNAME) ifneq ($(BUILD_CLIENT_SMP),0) TARGETS += $(B)/renderer_opengl1_smp_$(SHLIBNAME) endif else - TARGETS += $(B)/q3rally$(FULLBINEXT) + TARGETS += $(B)/$(CLIENTBIN)$(FULLBINEXT) ifneq ($(BUILD_CLIENT_SMP),0) - TARGETS += $(B)/q3rally-smp$(FULLBINEXT) + TARGETS += $(B)/$(CLIENTBIN)-smp$(FULLBINEXT) endif endif endif ifneq ($(BUILD_GAME_SO),0) - TARGETS += \ - $(B)/baseq3r/cgame$(SHLIBNAME) \ - $(B)/baseq3r/qagame$(SHLIBNAME) \ - $(B)/baseq3r/ui$(SHLIBNAME) + ifneq ($(BUILD_BASEGAME),0) + TARGETS += \ + $(B)/$(BASEGAME)/cgame$(SHLIBNAME) \ + $(B)/$(BASEGAME)/qagame$(SHLIBNAME) \ + $(B)/$(BASEGAME)/ui$(SHLIBNAME) + endif ifneq ($(BUILD_MISSIONPACK),0) TARGETS += \ - $(B)/missionpack/cgame$(SHLIBNAME) \ - $(B)/missionpack/qagame$(SHLIBNAME) \ - $(B)/missionpack/ui$(SHLIBNAME) - endif + $(B)/$(MISSIONPACK)/cgame$(SHLIBNAME) \ + $(B)/$(MISSIONPACK)/qagame$(SHLIBNAME) \ + $(B)/$(MISSIONPACK)/ui$(SHLIBNAME) + endif endif ifneq ($(BUILD_GAME_QVM),0) ifneq ($(CROSS_COMPILING),1) - TARGETS += \ - $(B)/baseq3r/vm/cgame.qvm \ - $(B)/baseq3r/vm/qagame.qvm \ - $(B)/baseq3r/vm/ui.qvm + ifneq ($(BUILD_BASEGAME),0) + TARGETS += \ + $(B)/$(BASEGAME)/vm/cgame.qvm \ + $(B)/$(BASEGAME)/vm/qagame.qvm \ + $(B)/$(BASEGAME)/vm/ui.qvm + endif ifneq ($(BUILD_MISSIONPACK),0) TARGETS += \ - $(B)/missionpack/vm/qagame.qvm \ - $(B)/missionpack/vm/cgame.qvm \ - $(B)/missionpack/vm/ui.qvm + $(B)/$(MISSIONPACK)/vm/qagame.qvm \ + $(B)/$(MISSIONPACK)/vm/cgame.qvm \ + $(B)/$(MISSIONPACK)/vm/ui.qvm endif endif endif @@ -916,6 +949,10 @@ else RENDERER_LIBS += -ljpeg endif +ifeq ("$(CC)", $(findstring "$(CC)", "clang" "clang++")) + BASE_CFLAGS += -Qunused-arguments +endif + ifdef DEFAULT_BASEDIR BASE_CFLAGS += -DDEFAULT_BASEDIR=\\\"$(DEFAULT_BASEDIR)\\\" endif @@ -982,49 +1019,49 @@ endif define DO_SHLIB_CC $(echo_cmd) "SHLIB_CC $<" -$(Q)$(CC) $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< +$(Q)$(CC) $(BASEGAME_CFLAGS) $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< $(Q)$(DO_QVM_DEP) endef define DO_GAME_CC $(echo_cmd) "GAME_CC $<" -$(Q)$(CC) -DQAGAME $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< +$(Q)$(CC) $(BASEGAME_CFLAGS) -DQAGAME $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< $(Q)$(DO_QVM_DEP) endef define DO_CGAME_CC $(echo_cmd) "CGAME_CC $<" -$(Q)$(CC) -DCGAME $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< +$(Q)$(CC) $(BASEGAME_CFLAGS) -DCGAME $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< $(Q)$(DO_QVM_DEP) endef define DO_UI_CC $(echo_cmd) "UI_CC $<" -$(Q)$(CC) -DUI $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< +$(Q)$(CC) $(BASEGAME_CFLAGS) -DUI $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< $(Q)$(DO_QVM_DEP) endef define DO_SHLIB_CC_MISSIONPACK $(echo_cmd) "SHLIB_CC_MISSIONPACK $<" -$(Q)$(CC) -DMISSIONPACK $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< +$(Q)$(CC) $(MISSIONPACK_CFLAGS) $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< $(Q)$(DO_QVM_DEP) endef define DO_GAME_CC_MISSIONPACK $(echo_cmd) "GAME_CC_MISSIONPACK $<" -$(Q)$(CC) -DMISSIONPACK -DQAGAME $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< +$(Q)$(CC) $(MISSIONPACK_CFLAGS) -DQAGAME $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< $(Q)$(DO_QVM_DEP) endef define DO_CGAME_CC_MISSIONPACK $(echo_cmd) "CGAME_CC_MISSIONPACK $<" -$(Q)$(CC) -DMISSIONPACK -DCGAME $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< +$(Q)$(CC) $(MISSIONPACK_CFLAGS) -DCGAME $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< $(Q)$(DO_QVM_DEP) endef define DO_UI_CC_MISSIONPACK $(echo_cmd) "UI_CC_MISSIONPACK $<" -$(Q)$(CC) -DMISSIONPACK -DUI $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< +$(Q)$(CC) $(MISSIONPACK_CFLAGS) -DUI $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $< $(Q)$(DO_QVM_DEP) endef @@ -1065,7 +1102,7 @@ release: # an informational message, then start building targets: makedirs @echo "" - @echo "Building Q3Rally in $(B):" + @echo "Building $(CLIENTBIN) in $(B):" ifdef IOQ3_REVISION @echo " IOQ3_REVISION: $(IOQ3_REVISION)" endif @@ -1133,18 +1170,18 @@ makedirs: @if [ ! -d $(B)/renderer ];then $(MKDIR) $(B)/renderer;fi @if [ ! -d $(B)/renderersmp ];then $(MKDIR) $(B)/renderersmp;fi @if [ ! -d $(B)/ded ];then $(MKDIR) $(B)/ded;fi - @if [ ! -d $(B)/baseq3r ];then $(MKDIR) $(B)/baseq3r;fi - @if [ ! -d $(B)/baseq3r/cgame ];then $(MKDIR) $(B)/baseq3r/cgame;fi - @if [ ! -d $(B)/baseq3r/game ];then $(MKDIR) $(B)/baseq3r/game;fi - @if [ ! -d $(B)/baseq3r/ui ];then $(MKDIR) $(B)/baseq3r/ui;fi - @if [ ! -d $(B)/baseq3r/qcommon ];then $(MKDIR) $(B)/baseq3r/qcommon;fi - @if [ ! -d $(B)/baseq3r/vm ];then $(MKDIR) $(B)/baseq3r/vm;fi - @if [ ! -d $(B)/missionpack ];then $(MKDIR) $(B)/missionpack;fi - @if [ ! -d $(B)/missionpack/cgame ];then $(MKDIR) $(B)/missionpack/cgame;fi - @if [ ! -d $(B)/missionpack/game ];then $(MKDIR) $(B)/missionpack/game;fi - @if [ ! -d $(B)/missionpack/ui ];then $(MKDIR) $(B)/missionpack/ui;fi - @if [ ! -d $(B)/missionpack/qcommon ];then $(MKDIR) $(B)/missionpack/qcommon;fi - @if [ ! -d $(B)/missionpack/vm ];then $(MKDIR) $(B)/missionpack/vm;fi + @if [ ! -d $(B)/$(BASEGAME) ];then $(MKDIR) $(B)/$(BASEGAME);fi + @if [ ! -d $(B)/$(BASEGAME)/cgame ];then $(MKDIR) $(B)/$(BASEGAME)/cgame;fi + @if [ ! -d $(B)/$(BASEGAME)/game ];then $(MKDIR) $(B)/$(BASEGAME)/game;fi + @if [ ! -d $(B)/$(BASEGAME)/ui ];then $(MKDIR) $(B)/$(BASEGAME)/ui;fi + @if [ ! -d $(B)/$(BASEGAME)/qcommon ];then $(MKDIR) $(B)/$(BASEGAME)/qcommon;fi + @if [ ! -d $(B)/$(BASEGAME)/vm ];then $(MKDIR) $(B)/$(BASEGAME)/vm;fi + @if [ ! -d $(B)/$(MISSIONPACK) ];then $(MKDIR) $(B)/$(MISSIONPACK);fi + @if [ ! -d $(B)/$(MISSIONPACK)/cgame ];then $(MKDIR) $(B)/$(MISSIONPACK)/cgame;fi + @if [ ! -d $(B)/$(MISSIONPACK)/game ];then $(MKDIR) $(B)/$(MISSIONPACK)/game;fi + @if [ ! -d $(B)/$(MISSIONPACK)/ui ];then $(MKDIR) $(B)/$(MISSIONPACK)/ui;fi + @if [ ! -d $(B)/$(MISSIONPACK)/qcommon ];then $(MKDIR) $(B)/$(MISSIONPACK)/qcommon;fi + @if [ ! -d $(B)/$(MISSIONPACK)/vm ];then $(MKDIR) $(B)/$(MISSIONPACK)/vm;fi @if [ ! -d $(B)/tools ];then $(MKDIR) $(B)/tools;fi @if [ ! -d $(B)/tools/asm ];then $(MKDIR) $(B)/tools/asm;fi @if [ ! -d $(B)/tools/etc ];then $(MKDIR) $(B)/tools/etc;fi @@ -1273,42 +1310,42 @@ $(Q3LCC): $(Q3LCCOBJ) $(Q3RCC) $(Q3CPP) define DO_Q3LCC $(echo_cmd) "Q3LCC $<" -$(Q)$(Q3LCC) $(BUILD_DEFINES) -o $@ $< +$(Q)$(Q3LCC) $(BASEGAME_CFLAGS) $(BUILD_DEFINES) -o $@ $< endef define DO_CGAME_Q3LCC $(echo_cmd) "CGAME_Q3LCC $<" -$(Q)$(Q3LCC) -DCGAME $(BUILD_DEFINES) -o $@ $< +$(Q)$(Q3LCC) $(BASEGAME_CFLAGS) -DCGAME $(BUILD_DEFINES) -o $@ $< endef define DO_GAME_Q3LCC $(echo_cmd) "GAME_Q3LCC $<" -$(Q)$(Q3LCC) -DQAGAME $(BUILD_DEFINES) -o $@ $< +$(Q)$(Q3LCC) $(BASEGAME_CFLAGS) -DQAGAME $(BUILD_DEFINES) -o $@ $< endef define DO_UI_Q3LCC $(echo_cmd) "UI_Q3LCC $<" -$(Q)$(Q3LCC) -DUI $(BUILD_DEFINES) -o $@ $< +$(Q)$(Q3LCC) $(BASEGAME_CFLAGS) -DUI $(BUILD_DEFINES) -o $@ $< endef define DO_Q3LCC_MISSIONPACK $(echo_cmd) "Q3LCC_MISSIONPACK $<" -$(Q)$(Q3LCC) -DMISSIONPACK $(BUILD_DEFINES) -o $@ $< +$(Q)$(Q3LCC) $(MISSIONPACK_CFLAGS) $(BUILD_DEFINES) -o $@ $< endef define DO_CGAME_Q3LCC_MISSIONPACK $(echo_cmd) "CGAME_Q3LCC_MISSIONPACK $<" -$(Q)$(Q3LCC) -DMISSIONPACK -DCGAME $(BUILD_DEFINES) -o $@ $< +$(Q)$(Q3LCC) $(MISSIONPACK_CFLAGS) -DCGAME $(BUILD_DEFINES) -o $@ $< endef define DO_GAME_Q3LCC_MISSIONPACK $(echo_cmd) "GAME_Q3LCC_MISSIONPACK $<" -$(Q)$(Q3LCC) -DMISSIONPACK -DQAGAME $(BUILD_DEFINES) -o $@ $< +$(Q)$(Q3LCC) $(MISSIONPACK_CFLAGS) -DQAGAME $(BUILD_DEFINES) -o $@ $< endef define DO_UI_Q3LCC_MISSIONPACK $(echo_cmd) "UI_Q3LCC_MISSIONPACK $<" -$(Q)$(Q3LCC) -DMISSIONPACK -DUI $(BUILD_DEFINES) -o $@ $< +$(Q)$(Q3LCC) $(MISSIONPACK_CFLAGS) -DUI $(BUILD_DEFINES) -o $@ $< endef @@ -1682,7 +1719,7 @@ Q3POBJ_SMP += \ $(B)/renderersmp/sdl_glimp.o ifneq ($(USE_RENDERER_DLOPEN),0) -$(B)/q3rally$(FULLBINEXT): $(Q3OBJ) $(LIBSDLMAIN) +$(B)/$(CLIENTBIN)$(FULLBINEXT): $(Q3OBJ) $(LIBSDLMAIN) $(echo_cmd) "LD $@" $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \ -o $@ $(Q3OBJ) \ @@ -1698,13 +1735,13 @@ $(B)/renderer_opengl1_smp_$(SHLIBNAME): $(Q3ROBJ) $(Q3POBJ_SMP) $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3ROBJ) $(Q3POBJ_SMP) \ $(THREAD_LIBS) $(LIBSDLMAIN) $(RENDERER_LIBS) $(LIBS) else -$(B)/q3rally$(FULLBINEXT): $(Q3OBJ) $(Q3ROBJ) $(Q3POBJ) $(LIBSDLMAIN) +$(B)/$(CLIENTBIN)$(FULLBINEXT): $(Q3OBJ) $(Q3ROBJ) $(Q3POBJ) $(LIBSDLMAIN) $(echo_cmd) "LD $@" $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \ -o $@ $(Q3OBJ) $(Q3ROBJ) $(Q3POBJ) \ $(LIBSDLMAIN) $(CLIENT_LIBS) $(RENDERER_LIBS) $(LIBS) -$(B)/q3rally-smp$(FULLBINEXT): $(Q3OBJ) $(Q3ROBJ) $(Q3POBJ_SMP) $(LIBSDLMAIN) +$(B)/$(CLIENTBIN)-smp$(FULLBINEXT): $(Q3OBJ) $(Q3ROBJ) $(Q3POBJ_SMP) $(LIBSDLMAIN) $(echo_cmd) "LD $@" $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) $(THREAD_LDFLAGS) \ -o $@ $(Q3OBJ) $(Q3ROBJ) $(Q3POBJ_SMP) \ @@ -1899,7 +1936,7 @@ ifeq ($(PLATFORM),darwin) $(B)/ded/sys_osx.o endif -$(B)/q3rally-server$(FULLBINEXT): $(Q3DOBJ) +$(B)/$(SERVERBIN)$(FULLBINEXT): $(Q3DOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(Q3DOBJ) $(LIBS) @@ -1910,53 +1947,53 @@ $(B)/q3rally-server$(FULLBINEXT): $(Q3DOBJ) ############################################################################# Q3CGOBJ_ = \ - $(B)/baseq3r/cgame/cg_main.o \ - $(B)/baseq3r/cgame/bg_misc.o \ - $(B)/baseq3r/cgame/bg_pmove.o \ - $(B)/baseq3r/cgame/bg_physics.o \ - $(B)/baseq3r/cgame/bg_slidemove.o \ - $(B)/baseq3r/cgame/bg_lib.o \ - $(B)/baseq3r/cgame/bg_wheel_forces.o \ - $(B)/baseq3r/cgame/cg_atmospheric.o \ - $(B)/baseq3r/cgame/cg_consolecmds.o \ - $(B)/baseq3r/cgame/cg_draw.o \ - $(B)/baseq3r/cgame/cg_drawtools.o \ - $(B)/baseq3r/cgame/cg_effects.o \ - $(B)/baseq3r/cgame/cg_ents.o \ - $(B)/baseq3r/cgame/cg_event.o \ - $(B)/baseq3r/cgame/cg_info.o \ - $(B)/baseq3r/cgame/cg_localents.o \ - $(B)/baseq3r/cgame/cg_marks.o \ - $(B)/baseq3r/cgame/cg_particles.o \ - $(B)/baseq3r/cgame/cg_players.o \ - $(B)/baseq3r/cgame/cg_playerstate.o \ - $(B)/baseq3r/cgame/cg_predict.o \ - $(B)/baseq3r/cgame/cg_rally_draw.o \ - $(B)/baseq3r/cgame/cg_rally_drawtools.o \ - $(B)/baseq3r/cgame/cg_rally_hud.o \ - $(B)/baseq3r/cgame/cg_rally_hud2.o \ - $(B)/baseq3r/cgame/cg_rally_platetools.o \ - $(B)/baseq3r/cgame/cg_rally_racetools.o \ - $(B)/baseq3r/cgame/cg_rally_rearweapons.o \ - $(B)/baseq3r/cgame/cg_rally_scripted_objects.o \ - $(B)/baseq3r/cgame/cg_rally_tools.o \ - $(B)/baseq3r/cgame/cg_scoreboard.o \ - $(B)/baseq3r/cgame/cg_servercmds.o \ - $(B)/baseq3r/cgame/cg_snapshot.o \ - $(B)/baseq3r/cgame/cg_view.o \ - $(B)/baseq3r/cgame/cg_weapons.o \ + $(B)/$(BASEGAME)/cgame/cg_main.o \ + $(B)/$(BASEGAME)/cgame/bg_misc.o \ + $(B)/$(BASEGAME)/cgame/bg_pmove.o \ + $(B)/$(BASEGAME)/cgame/bg_physics.o \ + $(B)/$(BASEGAME)/cgame/bg_slidemove.o \ + $(B)/$(BASEGAME)/cgame/bg_lib.o \ + $(B)/$(BASEGAME)/cgame/bg_wheel_forces.o \ + $(B)/$(BASEGAME)/cgame/cg_atmospheric.o \ + $(B)/$(BASEGAME)/cgame/cg_consolecmds.o \ + $(B)/$(BASEGAME)/cgame/cg_draw.o \ + $(B)/$(BASEGAME)/cgame/cg_drawtools.o \ + $(B)/$(BASEGAME)/cgame/cg_effects.o \ + $(B)/$(BASEGAME)/cgame/cg_ents.o \ + $(B)/$(BASEGAME)/cgame/cg_event.o \ + $(B)/$(BASEGAME)/cgame/cg_info.o \ + $(B)/$(BASEGAME)/cgame/cg_localents.o \ + $(B)/$(BASEGAME)/cgame/cg_marks.o \ + $(B)/$(BASEGAME)/cgame/cg_particles.o \ + $(B)/$(BASEGAME)/cgame/cg_players.o \ + $(B)/$(BASEGAME)/cgame/cg_playerstate.o \ + $(B)/$(BASEGAME)/cgame/cg_predict.o \ + $(B)/$(BASEGAME)/cgame/cg_rally_draw.o \ + $(B)/$(BASEGAME)/cgame/cg_rally_drawtools.o \ + $(B)/$(BASEGAME)/cgame/cg_rally_hud.o \ + $(B)/$(BASEGAME)/cgame/cg_rally_hud2.o \ + $(B)/$(BASEGAME)/cgame/cg_rally_platetools.o \ + $(B)/$(BASEGAME)/cgame/cg_rally_racetools.o \ + $(B)/$(BASEGAME)/cgame/cg_rally_rearweapons.o \ + $(B)/$(BASEGAME)/cgame/cg_rally_scripted_objects.o \ + $(B)/$(BASEGAME)/cgame/cg_rally_tools.o \ + $(B)/$(BASEGAME)/cgame/cg_scoreboard.o \ + $(B)/$(BASEGAME)/cgame/cg_servercmds.o \ + $(B)/$(BASEGAME)/cgame/cg_snapshot.o \ + $(B)/$(BASEGAME)/cgame/cg_view.o \ + $(B)/$(BASEGAME)/cgame/cg_weapons.o \ \ - $(B)/baseq3r/qcommon/q_math.o \ - $(B)/baseq3r/qcommon/q_shared.o + $(B)/$(BASEGAME)/qcommon/q_math.o \ + $(B)/$(BASEGAME)/qcommon/q_shared.o -Q3CGOBJ = $(Q3CGOBJ_) $(B)/baseq3r/cgame/cg_syscalls.o +Q3CGOBJ = $(Q3CGOBJ_) $(B)/$(BASEGAME)/cgame/cg_syscalls.o Q3CGVMOBJ = $(Q3CGOBJ_:%.o=%.asm) -$(B)/baseq3r/cgame$(SHLIBNAME): $(Q3CGOBJ) +$(B)/$(BASEGAME)/cgame$(SHLIBNAME): $(Q3CGOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3CGOBJ) -$(B)/baseq3r/vm/cgame.qvm: $(Q3CGVMOBJ) $(CGDIR)/cg_syscalls.asm $(Q3ASM) +$(B)/$(BASEGAME)/vm/cgame.qvm: $(Q3CGVMOBJ) $(CGDIR)/cg_syscalls.asm $(Q3ASM) $(echo_cmd) "Q3ASM $@" $(Q)$(Q3ASM) -o $@ $(Q3CGVMOBJ) $(CGDIR)/cg_syscalls.asm @@ -1965,43 +2002,43 @@ $(B)/baseq3r/vm/cgame.qvm: $(Q3CGVMOBJ) $(CGDIR)/cg_syscalls.asm $(Q3ASM) ############################################################################# MPCGOBJ_ = \ - $(B)/missionpack/cgame/cg_main.o \ - $(B)/missionpack/cgame/bg_misc.o \ - $(B)/missionpack/cgame/bg_pmove.o \ - $(B)/missionpack/cgame/bg_slidemove.o \ - $(B)/missionpack/cgame/bg_lib.o \ - $(B)/missionpack/cgame/cg_consolecmds.o \ - $(B)/missionpack/cgame/cg_newdraw.o \ - $(B)/missionpack/cgame/cg_draw.o \ - $(B)/missionpack/cgame/cg_drawtools.o \ - $(B)/missionpack/cgame/cg_effects.o \ - $(B)/missionpack/cgame/cg_ents.o \ - $(B)/missionpack/cgame/cg_event.o \ - $(B)/missionpack/cgame/cg_info.o \ - $(B)/missionpack/cgame/cg_localents.o \ - $(B)/missionpack/cgame/cg_marks.o \ - $(B)/missionpack/cgame/cg_particles.o \ - $(B)/missionpack/cgame/cg_players.o \ - $(B)/missionpack/cgame/cg_playerstate.o \ - $(B)/missionpack/cgame/cg_predict.o \ - $(B)/missionpack/cgame/cg_scoreboard.o \ - $(B)/missionpack/cgame/cg_servercmds.o \ - $(B)/missionpack/cgame/cg_snapshot.o \ - $(B)/missionpack/cgame/cg_view.o \ - $(B)/missionpack/cgame/cg_weapons.o \ - $(B)/missionpack/ui/ui_shared.o \ + $(B)/$(MISSIONPACK)/cgame/cg_main.o \ + $(B)/$(MISSIONPACK)/cgame/bg_misc.o \ + $(B)/$(MISSIONPACK)/cgame/bg_pmove.o \ + $(B)/$(MISSIONPACK)/cgame/bg_slidemove.o \ + $(B)/$(MISSIONPACK)/cgame/bg_lib.o \ + $(B)/$(MISSIONPACK)/cgame/cg_consolecmds.o \ + $(B)/$(MISSIONPACK)/cgame/cg_newdraw.o \ + $(B)/$(MISSIONPACK)/cgame/cg_draw.o \ + $(B)/$(MISSIONPACK)/cgame/cg_drawtools.o \ + $(B)/$(MISSIONPACK)/cgame/cg_effects.o \ + $(B)/$(MISSIONPACK)/cgame/cg_ents.o \ + $(B)/$(MISSIONPACK)/cgame/cg_event.o \ + $(B)/$(MISSIONPACK)/cgame/cg_info.o \ + $(B)/$(MISSIONPACK)/cgame/cg_localents.o \ + $(B)/$(MISSIONPACK)/cgame/cg_marks.o \ + $(B)/$(MISSIONPACK)/cgame/cg_particles.o \ + $(B)/$(MISSIONPACK)/cgame/cg_players.o \ + $(B)/$(MISSIONPACK)/cgame/cg_playerstate.o \ + $(B)/$(MISSIONPACK)/cgame/cg_predict.o \ + $(B)/$(MISSIONPACK)/cgame/cg_scoreboard.o \ + $(B)/$(MISSIONPACK)/cgame/cg_servercmds.o \ + $(B)/$(MISSIONPACK)/cgame/cg_snapshot.o \ + $(B)/$(MISSIONPACK)/cgame/cg_view.o \ + $(B)/$(MISSIONPACK)/cgame/cg_weapons.o \ + $(B)/$(MISSIONPACK)/ui/ui_shared.o \ \ - $(B)/missionpack/qcommon/q_math.o \ - $(B)/missionpack/qcommon/q_shared.o + $(B)/$(MISSIONPACK)/qcommon/q_math.o \ + $(B)/$(MISSIONPACK)/qcommon/q_shared.o -MPCGOBJ = $(MPCGOBJ_) $(B)/missionpack/cgame/cg_syscalls.o +MPCGOBJ = $(MPCGOBJ_) $(B)/$(MISSIONPACK)/cgame/cg_syscalls.o MPCGVMOBJ = $(MPCGOBJ_:%.o=%.asm) -$(B)/missionpack/cgame$(SHLIBNAME): $(MPCGOBJ) +$(B)/$(MISSIONPACK)/cgame$(SHLIBNAME): $(MPCGOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPCGOBJ) -$(B)/missionpack/vm/cgame.qvm: $(MPCGVMOBJ) $(CGDIR)/cg_syscalls.asm $(Q3ASM) +$(B)/$(MISSIONPACK)/vm/cgame.qvm: $(MPCGVMOBJ) $(CGDIR)/cg_syscalls.asm $(Q3ASM) $(echo_cmd) "Q3ASM $@" $(Q)$(Q3ASM) -o $@ $(MPCGVMOBJ) $(CGDIR)/cg_syscalls.asm @@ -2012,59 +2049,59 @@ $(B)/missionpack/vm/cgame.qvm: $(MPCGVMOBJ) $(CGDIR)/cg_syscalls.asm $(Q3ASM) ############################################################################# Q3GOBJ_ = \ - $(B)/baseq3r/game/g_main.o \ - $(B)/baseq3r/game/ai_chat.o \ - $(B)/baseq3r/game/ai_cmd.o \ - $(B)/baseq3r/game/ai_dmnet.o \ - $(B)/baseq3r/game/ai_dmq3.o \ - $(B)/baseq3r/game/ai_main.o \ - $(B)/baseq3r/game/ai_team.o \ - $(B)/baseq3r/game/ai_vcmd.o \ - $(B)/baseq3r/game/bg_misc.o \ - $(B)/baseq3r/game/bg_pmove.o \ - $(B)/baseq3r/game/bg_physics.o \ - $(B)/baseq3r/game/bg_slidemove.o \ - $(B)/baseq3r/game/bg_lib.o \ - $(B)/baseq3r/game/bg_wheel_forces.o \ - $(B)/baseq3r/game/g_active.o \ - $(B)/baseq3r/game/g_arenas.o \ - $(B)/baseq3r/game/g_bot.o \ - $(B)/baseq3r/game/g_client.o \ - $(B)/baseq3r/game/g_cmds.o \ - $(B)/baseq3r/game/g_combat.o \ - $(B)/baseq3r/game/g_items.o \ - $(B)/baseq3r/game/g_mem.o \ - $(B)/baseq3r/game/g_misc.o \ - $(B)/baseq3r/game/g_missile.o \ - $(B)/baseq3r/game/g_mover.o \ - $(B)/baseq3r/game/g_rally_hazard.o \ - $(B)/baseq3r/game/g_rally_mapents.o \ - $(B)/baseq3r/game/g_rally_mapobjects.o \ - $(B)/baseq3r/game/g_rally_observer_cams.o \ - $(B)/baseq3r/game/g_rally_racetools.o \ - $(B)/baseq3r/game/g_rally_rearweapon.o \ - $(B)/baseq3r/game/g_rally_scripted_objects.o \ - $(B)/baseq3r/game/g_rally_tools.o \ - $(B)/baseq3r/game/g_session.o \ - $(B)/baseq3r/game/g_spawn.o \ - $(B)/baseq3r/game/g_svcmds.o \ - $(B)/baseq3r/game/g_target.o \ - $(B)/baseq3r/game/g_team.o \ - $(B)/baseq3r/game/g_trigger.o \ - $(B)/baseq3r/game/g_utils.o \ - $(B)/baseq3r/game/g_weapon.o \ + $(B)/$(BASEGAME)/game/g_main.o \ + $(B)/$(BASEGAME)/game/ai_chat.o \ + $(B)/$(BASEGAME)/game/ai_cmd.o \ + $(B)/$(BASEGAME)/game/ai_dmnet.o \ + $(B)/$(BASEGAME)/game/ai_dmq3.o \ + $(B)/$(BASEGAME)/game/ai_main.o \ + $(B)/$(BASEGAME)/game/ai_team.o \ + $(B)/$(BASEGAME)/game/ai_vcmd.o \ + $(B)/$(BASEGAME)/game/bg_misc.o \ + $(B)/$(BASEGAME)/game/bg_pmove.o \ + $(B)/$(BASEGAME)/game/bg_physics.o \ + $(B)/$(BASEGAME)/game/bg_slidemove.o \ + $(B)/$(BASEGAME)/game/bg_lib.o \ + $(B)/$(BASEGAME)/game/bg_wheel_forces.o \ + $(B)/$(BASEGAME)/game/g_active.o \ + $(B)/$(BASEGAME)/game/g_arenas.o \ + $(B)/$(BASEGAME)/game/g_bot.o \ + $(B)/$(BASEGAME)/game/g_client.o \ + $(B)/$(BASEGAME)/game/g_cmds.o \ + $(B)/$(BASEGAME)/game/g_combat.o \ + $(B)/$(BASEGAME)/game/g_items.o \ + $(B)/$(BASEGAME)/game/g_mem.o \ + $(B)/$(BASEGAME)/game/g_misc.o \ + $(B)/$(BASEGAME)/game/g_missile.o \ + $(B)/$(BASEGAME)/game/g_mover.o \ + $(B)/$(BASEGAME)/game/g_rally_hazard.o \ + $(B)/$(BASEGAME)/game/g_rally_mapents.o \ + $(B)/$(BASEGAME)/game/g_rally_mapobjects.o \ + $(B)/$(BASEGAME)/game/g_rally_observer_cams.o \ + $(B)/$(BASEGAME)/game/g_rally_racetools.o \ + $(B)/$(BASEGAME)/game/g_rally_rearweapon.o \ + $(B)/$(BASEGAME)/game/g_rally_scripted_objects.o \ + $(B)/$(BASEGAME)/game/g_rally_tools.o \ + $(B)/$(BASEGAME)/game/g_session.o \ + $(B)/$(BASEGAME)/game/g_spawn.o \ + $(B)/$(BASEGAME)/game/g_svcmds.o \ + $(B)/$(BASEGAME)/game/g_target.o \ + $(B)/$(BASEGAME)/game/g_team.o \ + $(B)/$(BASEGAME)/game/g_trigger.o \ + $(B)/$(BASEGAME)/game/g_utils.o \ + $(B)/$(BASEGAME)/game/g_weapon.o \ \ - $(B)/baseq3r/qcommon/q_math.o \ - $(B)/baseq3r/qcommon/q_shared.o + $(B)/$(BASEGAME)/qcommon/q_math.o \ + $(B)/$(BASEGAME)/qcommon/q_shared.o -Q3GOBJ = $(Q3GOBJ_) $(B)/baseq3r/game/g_syscalls.o +Q3GOBJ = $(Q3GOBJ_) $(B)/$(BASEGAME)/game/g_syscalls.o Q3GVMOBJ = $(Q3GOBJ_:%.o=%.asm) -$(B)/baseq3r/qagame$(SHLIBNAME): $(Q3GOBJ) +$(B)/$(BASEGAME)/qagame$(SHLIBNAME): $(Q3GOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3GOBJ) -$(B)/baseq3r/vm/qagame.qvm: $(Q3GVMOBJ) $(GDIR)/g_syscalls.asm $(Q3ASM) +$(B)/$(BASEGAME)/vm/qagame.qvm: $(Q3GVMOBJ) $(GDIR)/g_syscalls.asm $(Q3ASM) $(echo_cmd) "Q3ASM $@" $(Q)$(Q3ASM) -o $@ $(Q3GVMOBJ) $(GDIR)/g_syscalls.asm @@ -2073,49 +2110,49 @@ $(B)/baseq3r/vm/qagame.qvm: $(Q3GVMOBJ) $(GDIR)/g_syscalls.asm $(Q3ASM) ############################################################################# MPGOBJ_ = \ - $(B)/missionpack/game/g_main.o \ - $(B)/missionpack/game/ai_chat.o \ - $(B)/missionpack/game/ai_cmd.o \ - $(B)/missionpack/game/ai_dmnet.o \ - $(B)/missionpack/game/ai_dmq3.o \ - $(B)/missionpack/game/ai_main.o \ - $(B)/missionpack/game/ai_team.o \ - $(B)/missionpack/game/ai_vcmd.o \ - $(B)/missionpack/game/bg_misc.o \ - $(B)/missionpack/game/bg_pmove.o \ - $(B)/missionpack/game/bg_slidemove.o \ - $(B)/missionpack/game/bg_lib.o \ - $(B)/missionpack/game/g_active.o \ - $(B)/missionpack/game/g_arenas.o \ - $(B)/missionpack/game/g_bot.o \ - $(B)/missionpack/game/g_client.o \ - $(B)/missionpack/game/g_cmds.o \ - $(B)/missionpack/game/g_combat.o \ - $(B)/missionpack/game/g_items.o \ - $(B)/missionpack/game/g_mem.o \ - $(B)/missionpack/game/g_misc.o \ - $(B)/missionpack/game/g_missile.o \ - $(B)/missionpack/game/g_mover.o \ - $(B)/missionpack/game/g_session.o \ - $(B)/missionpack/game/g_spawn.o \ - $(B)/missionpack/game/g_svcmds.o \ - $(B)/missionpack/game/g_target.o \ - $(B)/missionpack/game/g_team.o \ - $(B)/missionpack/game/g_trigger.o \ - $(B)/missionpack/game/g_utils.o \ - $(B)/missionpack/game/g_weapon.o \ + $(B)/$(MISSIONPACK)/game/g_main.o \ + $(B)/$(MISSIONPACK)/game/ai_chat.o \ + $(B)/$(MISSIONPACK)/game/ai_cmd.o \ + $(B)/$(MISSIONPACK)/game/ai_dmnet.o \ + $(B)/$(MISSIONPACK)/game/ai_dmq3.o \ + $(B)/$(MISSIONPACK)/game/ai_main.o \ + $(B)/$(MISSIONPACK)/game/ai_team.o \ + $(B)/$(MISSIONPACK)/game/ai_vcmd.o \ + $(B)/$(MISSIONPACK)/game/bg_misc.o \ + $(B)/$(MISSIONPACK)/game/bg_pmove.o \ + $(B)/$(MISSIONPACK)/game/bg_slidemove.o \ + $(B)/$(MISSIONPACK)/game/bg_lib.o \ + $(B)/$(MISSIONPACK)/game/g_active.o \ + $(B)/$(MISSIONPACK)/game/g_arenas.o \ + $(B)/$(MISSIONPACK)/game/g_bot.o \ + $(B)/$(MISSIONPACK)/game/g_client.o \ + $(B)/$(MISSIONPACK)/game/g_cmds.o \ + $(B)/$(MISSIONPACK)/game/g_combat.o \ + $(B)/$(MISSIONPACK)/game/g_items.o \ + $(B)/$(MISSIONPACK)/game/g_mem.o \ + $(B)/$(MISSIONPACK)/game/g_misc.o \ + $(B)/$(MISSIONPACK)/game/g_missile.o \ + $(B)/$(MISSIONPACK)/game/g_mover.o \ + $(B)/$(MISSIONPACK)/game/g_session.o \ + $(B)/$(MISSIONPACK)/game/g_spawn.o \ + $(B)/$(MISSIONPACK)/game/g_svcmds.o \ + $(B)/$(MISSIONPACK)/game/g_target.o \ + $(B)/$(MISSIONPACK)/game/g_team.o \ + $(B)/$(MISSIONPACK)/game/g_trigger.o \ + $(B)/$(MISSIONPACK)/game/g_utils.o \ + $(B)/$(MISSIONPACK)/game/g_weapon.o \ \ - $(B)/missionpack/qcommon/q_math.o \ - $(B)/missionpack/qcommon/q_shared.o + $(B)/$(MISSIONPACK)/qcommon/q_math.o \ + $(B)/$(MISSIONPACK)/qcommon/q_shared.o -MPGOBJ = $(MPGOBJ_) $(B)/missionpack/game/g_syscalls.o +MPGOBJ = $(MPGOBJ_) $(B)/$(MISSIONPACK)/game/g_syscalls.o MPGVMOBJ = $(MPGOBJ_:%.o=%.asm) -$(B)/missionpack/qagame$(SHLIBNAME): $(MPGOBJ) +$(B)/$(MISSIONPACK)/qagame$(SHLIBNAME): $(MPGOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPGOBJ) -$(B)/missionpack/vm/qagame.qvm: $(MPGVMOBJ) $(GDIR)/g_syscalls.asm $(Q3ASM) +$(B)/$(MISSIONPACK)/vm/qagame.qvm: $(MPGVMOBJ) $(GDIR)/g_syscalls.asm $(Q3ASM) $(echo_cmd) "Q3ASM $@" $(Q)$(Q3ASM) -o $@ $(MPGVMOBJ) $(GDIR)/g_syscalls.asm @@ -2125,69 +2162,69 @@ $(B)/missionpack/vm/qagame.qvm: $(MPGVMOBJ) $(GDIR)/g_syscalls.asm $(Q3ASM) ## Q3RALLY UI ############################################################################# -# $(B)/baseq3r/ui/ui_controls2.o -# $(B)/baseq3r/ui/ui_servers2.o -# $(B)/baseq3r/ui/ui_startserver.o +# $(B)/$(BASEGAME)/ui/ui_controls2.o +# $(B)/$(BASEGAME)/ui/ui_servers2.o +# $(B)/$(BASEGAME)/ui/ui_startserver.o Q3UIOBJ_ = \ - $(B)/baseq3r/ui/ui_main.o \ - $(B)/baseq3r/ui/bg_misc.o \ - $(B)/baseq3r/ui/bg_lib.o \ - $(B)/baseq3r/ui/ui_addbots.o \ - $(B)/baseq3r/ui/ui_atoms.o \ - $(B)/baseq3r/ui/ui_cdkey.o \ - $(B)/baseq3r/ui/ui_cinematics.o \ - $(B)/baseq3r/ui/ui_confirm.o \ - $(B)/baseq3r/ui/ui_connect.o \ - $(B)/baseq3r/ui/ui_credits.o \ - $(B)/baseq3r/ui/ui_demo2.o \ - $(B)/baseq3r/ui/ui_display.o \ - $(B)/baseq3r/ui/ui_gameinfo.o \ - $(B)/baseq3r/ui/ui_ingame.o \ - $(B)/baseq3r/ui/ui_loadconfig.o \ - $(B)/baseq3r/ui/ui_menu.o \ - $(B)/baseq3r/ui/ui_mfield.o \ - $(B)/baseq3r/ui/ui_mods.o \ - $(B)/baseq3r/ui/ui_network.o \ - $(B)/baseq3r/ui/ui_options.o \ - $(B)/baseq3r/ui/ui_playermodel.o \ - $(B)/baseq3r/ui/ui_players.o \ - $(B)/baseq3r/ui/ui_playersettings.o \ - $(B)/baseq3r/ui/ui_preferences.o \ - $(B)/baseq3r/ui/ui_qmenu.o \ - $(B)/baseq3r/ui/ui_rally_controls.o \ - $(B)/baseq3r/ui/ui_rally_credits.o \ - $(B)/baseq3r/ui/ui_rally_favorites.o \ - $(B)/baseq3r/ui/ui_rally_gfxloading.o \ - $(B)/baseq3r/ui/ui_rally_options.o \ - $(B)/baseq3r/ui/ui_rally_servers.o \ - $(B)/baseq3r/ui/ui_rally_startserver.o \ - $(B)/baseq3r/ui/ui_rally_tools.o \ - $(B)/baseq3r/ui/ui_removebots.o \ - $(B)/baseq3r/ui/ui_saveconfig.o \ - $(B)/baseq3r/ui/ui_serverinfo.o \ - $(B)/baseq3r/ui/ui_setup.o \ - $(B)/baseq3r/ui/ui_sound.o \ - $(B)/baseq3r/ui/ui_sparena.o \ - $(B)/baseq3r/ui/ui_specifyserver.o \ - $(B)/baseq3r/ui/ui_splevel.o \ - $(B)/baseq3r/ui/ui_sppostgame.o \ - $(B)/baseq3r/ui/ui_spskill.o \ - $(B)/baseq3r/ui/ui_team.o \ - $(B)/baseq3r/ui/ui_teamorders.o \ - $(B)/baseq3r/ui/ui_video.o \ + $(B)/$(BASEGAME)/ui/ui_main.o \ + $(B)/$(BASEGAME)/ui/bg_misc.o \ + $(B)/$(BASEGAME)/ui/bg_lib.o \ + $(B)/$(BASEGAME)/ui/ui_addbots.o \ + $(B)/$(BASEGAME)/ui/ui_atoms.o \ + $(B)/$(BASEGAME)/ui/ui_cdkey.o \ + $(B)/$(BASEGAME)/ui/ui_cinematics.o \ + $(B)/$(BASEGAME)/ui/ui_confirm.o \ + $(B)/$(BASEGAME)/ui/ui_connect.o \ + $(B)/$(BASEGAME)/ui/ui_credits.o \ + $(B)/$(BASEGAME)/ui/ui_demo2.o \ + $(B)/$(BASEGAME)/ui/ui_display.o \ + $(B)/$(BASEGAME)/ui/ui_gameinfo.o \ + $(B)/$(BASEGAME)/ui/ui_ingame.o \ + $(B)/$(BASEGAME)/ui/ui_loadconfig.o \ + $(B)/$(BASEGAME)/ui/ui_menu.o \ + $(B)/$(BASEGAME)/ui/ui_mfield.o \ + $(B)/$(BASEGAME)/ui/ui_mods.o \ + $(B)/$(BASEGAME)/ui/ui_network.o \ + $(B)/$(BASEGAME)/ui/ui_options.o \ + $(B)/$(BASEGAME)/ui/ui_playermodel.o \ + $(B)/$(BASEGAME)/ui/ui_players.o \ + $(B)/$(BASEGAME)/ui/ui_playersettings.o \ + $(B)/$(BASEGAME)/ui/ui_preferences.o \ + $(B)/$(BASEGAME)/ui/ui_qmenu.o \ + $(B)/$(BASEGAME)/ui/ui_rally_controls.o \ + $(B)/$(BASEGAME)/ui/ui_rally_credits.o \ + $(B)/$(BASEGAME)/ui/ui_rally_favorites.o \ + $(B)/$(BASEGAME)/ui/ui_rally_gfxloading.o \ + $(B)/$(BASEGAME)/ui/ui_rally_options.o \ + $(B)/$(BASEGAME)/ui/ui_rally_servers.o \ + $(B)/$(BASEGAME)/ui/ui_rally_startserver.o \ + $(B)/$(BASEGAME)/ui/ui_rally_tools.o \ + $(B)/$(BASEGAME)/ui/ui_removebots.o \ + $(B)/$(BASEGAME)/ui/ui_saveconfig.o \ + $(B)/$(BASEGAME)/ui/ui_serverinfo.o \ + $(B)/$(BASEGAME)/ui/ui_setup.o \ + $(B)/$(BASEGAME)/ui/ui_sound.o \ + $(B)/$(BASEGAME)/ui/ui_sparena.o \ + $(B)/$(BASEGAME)/ui/ui_specifyserver.o \ + $(B)/$(BASEGAME)/ui/ui_splevel.o \ + $(B)/$(BASEGAME)/ui/ui_sppostgame.o \ + $(B)/$(BASEGAME)/ui/ui_spskill.o \ + $(B)/$(BASEGAME)/ui/ui_team.o \ + $(B)/$(BASEGAME)/ui/ui_teamorders.o \ + $(B)/$(BASEGAME)/ui/ui_video.o \ \ - $(B)/baseq3r/qcommon/q_math.o \ - $(B)/baseq3r/qcommon/q_shared.o + $(B)/$(BASEGAME)/qcommon/q_math.o \ + $(B)/$(BASEGAME)/qcommon/q_shared.o -Q3UIOBJ = $(Q3UIOBJ_) $(B)/missionpack/ui/ui_syscalls.o +Q3UIOBJ = $(Q3UIOBJ_) $(B)/$(MISSIONPACK)/ui/ui_syscalls.o Q3UIVMOBJ = $(Q3UIOBJ_:%.o=%.asm) -$(B)/baseq3r/ui$(SHLIBNAME): $(Q3UIOBJ) +$(B)/$(BASEGAME)/ui$(SHLIBNAME): $(Q3UIOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3UIOBJ) -$(B)/baseq3r/vm/ui.qvm: $(Q3UIVMOBJ) $(UIDIR)/ui_syscalls.asm $(Q3ASM) +$(B)/$(BASEGAME)/vm/ui.qvm: $(Q3UIVMOBJ) $(UIDIR)/ui_syscalls.asm $(Q3ASM) $(echo_cmd) "Q3ASM $@" $(Q)$(Q3ASM) -o $@ $(Q3UIVMOBJ) $(UIDIR)/ui_syscalls.asm @@ -2196,26 +2233,26 @@ $(B)/baseq3r/vm/ui.qvm: $(Q3UIVMOBJ) $(UIDIR)/ui_syscalls.asm $(Q3ASM) ############################################################################# MPUIOBJ_ = \ - $(B)/missionpack/ui/ui_main.o \ - $(B)/missionpack/ui/ui_atoms.o \ - $(B)/missionpack/ui/ui_gameinfo.o \ - $(B)/missionpack/ui/ui_players.o \ - $(B)/missionpack/ui/ui_shared.o \ + $(B)/$(MISSIONPACK)/ui/ui_main.o \ + $(B)/$(MISSIONPACK)/ui/ui_atoms.o \ + $(B)/$(MISSIONPACK)/ui/ui_gameinfo.o \ + $(B)/$(MISSIONPACK)/ui/ui_players.o \ + $(B)/$(MISSIONPACK)/ui/ui_shared.o \ \ - $(B)/missionpack/ui/bg_misc.o \ - $(B)/missionpack/ui/bg_lib.o \ + $(B)/$(MISSIONPACK)/ui/bg_misc.o \ + $(B)/$(MISSIONPACK)/ui/bg_lib.o \ \ - $(B)/missionpack/qcommon/q_math.o \ - $(B)/missionpack/qcommon/q_shared.o + $(B)/$(MISSIONPACK)/qcommon/q_math.o \ + $(B)/$(MISSIONPACK)/qcommon/q_shared.o -MPUIOBJ = $(MPUIOBJ_) $(B)/missionpack/ui/ui_syscalls.o +MPUIOBJ = $(MPUIOBJ_) $(B)/$(MISSIONPACK)/ui/ui_syscalls.o MPUIVMOBJ = $(MPUIOBJ_:%.o=%.asm) -$(B)/missionpack/ui$(SHLIBNAME): $(MPUIOBJ) +$(B)/$(MISSIONPACK)/ui$(SHLIBNAME): $(MPUIOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPUIOBJ) -$(B)/missionpack/vm/ui.qvm: $(MPUIVMOBJ) $(UIDIR)/ui_syscalls.asm $(Q3ASM) +$(B)/$(MISSIONPACK)/vm/ui.qvm: $(MPUIVMOBJ) $(UIDIR)/ui_syscalls.asm $(Q3ASM) $(echo_cmd) "Q3ASM $@" $(Q)$(Q3ASM) -o $@ $(MPUIVMOBJ) $(UIDIR)/ui_syscalls.asm @@ -2322,79 +2359,79 @@ endif ## GAME MODULE RULES ############################################################################# -$(B)/baseq3r/cgame/bg_%.o: $(GDIR)/bg_%.c +$(B)/$(BASEGAME)/cgame/bg_%.o: $(GDIR)/bg_%.c $(DO_CGAME_CC) -$(B)/baseq3r/cgame/%.o: $(CGDIR)/%.c +$(B)/$(BASEGAME)/cgame/%.o: $(CGDIR)/%.c $(DO_CGAME_CC) -$(B)/baseq3r/cgame/bg_%.asm: $(GDIR)/bg_%.c $(Q3LCC) +$(B)/$(BASEGAME)/cgame/bg_%.asm: $(GDIR)/bg_%.c $(Q3LCC) $(DO_CGAME_Q3LCC) -$(B)/baseq3r/cgame/%.asm: $(CGDIR)/%.c $(Q3LCC) +$(B)/$(BASEGAME)/cgame/%.asm: $(CGDIR)/%.c $(Q3LCC) $(DO_CGAME_Q3LCC) -$(B)/missionpack/cgame/bg_%.o: $(GDIR)/bg_%.c +$(B)/$(MISSIONPACK)/cgame/bg_%.o: $(GDIR)/bg_%.c $(DO_CGAME_CC_MISSIONPACK) -$(B)/missionpack/cgame/%.o: $(CGDIR)/%.c +$(B)/$(MISSIONPACK)/cgame/%.o: $(CGDIR)/%.c $(DO_CGAME_CC_MISSIONPACK) -$(B)/missionpack/cgame/bg_%.asm: $(GDIR)/bg_%.c $(Q3LCC) +$(B)/$(MISSIONPACK)/cgame/bg_%.asm: $(GDIR)/bg_%.c $(Q3LCC) $(DO_CGAME_Q3LCC_MISSIONPACK) -$(B)/missionpack/cgame/%.asm: $(CGDIR)/%.c $(Q3LCC) +$(B)/$(MISSIONPACK)/cgame/%.asm: $(CGDIR)/%.c $(Q3LCC) $(DO_CGAME_Q3LCC_MISSIONPACK) -$(B)/baseq3r/game/%.o: $(GDIR)/%.c +$(B)/$(BASEGAME)/game/%.o: $(GDIR)/%.c $(DO_GAME_CC) -$(B)/baseq3r/game/%.asm: $(GDIR)/%.c $(Q3LCC) +$(B)/$(BASEGAME)/game/%.asm: $(GDIR)/%.c $(Q3LCC) $(DO_GAME_Q3LCC) -$(B)/missionpack/game/%.o: $(GDIR)/%.c +$(B)/$(MISSIONPACK)/game/%.o: $(GDIR)/%.c $(DO_GAME_CC_MISSIONPACK) -$(B)/missionpack/game/%.asm: $(GDIR)/%.c $(Q3LCC) +$(B)/$(MISSIONPACK)/game/%.asm: $(GDIR)/%.c $(Q3LCC) $(DO_GAME_Q3LCC_MISSIONPACK) -$(B)/baseq3r/ui/bg_%.o: $(GDIR)/bg_%.c +$(B)/$(BASEGAME)/ui/bg_%.o: $(GDIR)/bg_%.c $(DO_UI_CC) -$(B)/baseq3r/ui/%.o: $(Q3UIDIR)/%.c +$(B)/$(BASEGAME)/ui/%.o: $(Q3UIDIR)/%.c $(DO_UI_CC) -$(B)/baseq3r/ui/bg_%.asm: $(GDIR)/bg_%.c $(Q3LCC) +$(B)/$(BASEGAME)/ui/bg_%.asm: $(GDIR)/bg_%.c $(Q3LCC) $(DO_UI_Q3LCC) $(B)/baseq3r/ui/%.asm: $(Q3UIDIR)/%.c $(Q3LCC) $(DO_UI_Q3LCC) -$(B)/missionpack/ui/bg_%.o: $(GDIR)/bg_%.c +$(B)/$(MISSIONPACK)/ui/bg_%.o: $(GDIR)/bg_%.c $(DO_UI_CC_MISSIONPACK) -$(B)/missionpack/ui/%.o: $(UIDIR)/%.c +$(B)/$(MISSIONPACK)/ui/%.o: $(UIDIR)/%.c $(DO_UI_CC_MISSIONPACK) -$(B)/missionpack/ui/bg_%.asm: $(GDIR)/bg_%.c $(Q3LCC) +$(B)/$(MISSIONPACK)/ui/bg_%.asm: $(GDIR)/bg_%.c $(Q3LCC) $(DO_UI_Q3LCC_MISSIONPACK) -$(B)/missionpack/ui/%.asm: $(UIDIR)/%.c $(Q3LCC) +$(B)/$(MISSIONPACK)/ui/%.asm: $(UIDIR)/%.c $(Q3LCC) $(DO_UI_Q3LCC_MISSIONPACK) -$(B)/baseq3r/qcommon/%.o: $(CMDIR)/%.c +$(B)/$(BASEGAME)/qcommon/%.o: $(CMDIR)/%.c $(DO_SHLIB_CC) -$(B)/baseq3r/qcommon/%.asm: $(CMDIR)/%.c $(Q3LCC) +$(B)/$(BASEGAME)/qcommon/%.asm: $(CMDIR)/%.c $(Q3LCC) $(DO_Q3LCC) -$(B)/missionpack/qcommon/%.o: $(CMDIR)/%.c +$(B)/$(MISSIONPACK)/qcommon/%.o: $(CMDIR)/%.c $(DO_SHLIB_CC_MISSIONPACK) -$(B)/missionpack/qcommon/%.asm: $(CMDIR)/%.c $(Q3LCC) +$(B)/$(MISSIONPACK)/qcommon/%.asm: $(CMDIR)/%.c $(Q3LCC) $(DO_Q3LCC_MISSIONPACK) @@ -2409,41 +2446,54 @@ TOOLSOBJ = $(LBURGOBJ) $(Q3CPPOBJ) $(Q3RCCOBJ) $(Q3LCCOBJ) $(Q3ASMOBJ) copyfiles: release - @if [ ! -d $(COPYDIR)/baseq3r ]; then echo "You need to set COPYDIR to where your Quake3 data is!"; fi - -$(MKDIR) -p -m 0755 $(COPYDIR)/baseq3r - -$(MKDIR) -p -m 0755 $(COPYDIR)/missionpack + @if [ ! -d $(COPYDIR)/$(BASENAME) ]; then echo "You need to set COPYDIR to where your Quake3 data is!"; fi +ifneq ($(BUILD_GAME_SO),0) + ifneq ($(BUILD_BASEGAME),0) + -$(MKDIR) -p -m 0755 $(COPYDIR)/$(BASEGAME) + endif + ifneq ($(BUILD_MISSIONPACK),0) + -$(MKDIR) -p -m 0755 $(COPYDIR)/$(MISSIONPACK) + endif +endif ifneq ($(BUILD_CLIENT),0) - $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/q3rally$(FULLBINEXT) $(COPYBINDIR)/q3rally$(FULLBINEXT) + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/$(CLIENTBIN)$(FULLBINEXT) $(COPYBINDIR)/$(CLIENTBIN)$(FULLBINEXT) + ifneq ($(USE_RENDERER_DLOPEN),0) $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/renderer_opengl1_$(SHLIBNAME) $(COPYBINDIR)/renderer_opengl1_$(SHLIBNAME) + endif endif # Don't copy the SMP until it's working together with SDL. ifneq ($(BUILD_CLIENT_SMP),0) + ifneq ($(USE_RENDERER_DLOPEN),0) $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/renderer_opengl1_smp_$(SHLIBNAME) $(COPYBINDIR)/renderer_opengl1_smp_$(SHLIBNAME) + else + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/$(CLIENTBIN)-smp$(FULLBINEXT) $(COPYBINDIR)/$(CLIENTBIN)-smp$(FULLBINEXT) + endif endif ifneq ($(BUILD_SERVER),0) - @if [ -f $(BR)/q3rally-server$(FULLBINEXT) ]; then \ - $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/q3rally-server$(FULLBINEXT) $(COPYBINDIR)/q3rally-server$(FULLBINEXT); \ + @if [ -f $(BR)/$(SERVERBIN)$(FULLBINEXT) ]; then \ + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/$(SERVERBIN)$(FULLBINEXT) $(COPYBINDIR)/$(SERVERBIN)$(FULLBINEXT); \ fi endif ifneq ($(BUILD_GAME_SO),0) - $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/baseq3r/cgame$(SHLIBNAME) \ - $(COPYDIR)/baseq3r/. - $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/baseq3r/qagame$(SHLIBNAME) \ - $(COPYDIR)/baseq3r/. - $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/baseq3r/ui$(SHLIBNAME) \ - $(COPYDIR)/baseq3r/. + ifneq ($(BUILD_BASEGAME),0) + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/$(BASEGAME)/cgame$(SHLIBNAME) \ + $(COPYDIR)/$(BASEGAME)/. + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/$(BASEGAME)/qagame$(SHLIBNAME) \ + $(COPYDIR)/$(BASEGAME)/. + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/$(BASEGAME)/ui$(SHLIBNAME) \ + $(COPYDIR)/$(BASEGAME)/. + endif ifneq ($(BUILD_MISSIONPACK),0) - -$(MKDIR) -p -m 0755 $(COPYDIR)/missionpack - $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/missionpack/cgame$(SHLIBNAME) \ - $(COPYDIR)/missionpack/. - $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/missionpack/qagame$(SHLIBNAME) \ - $(COPYDIR)/missionpack/. - $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/missionpack/ui$(SHLIBNAME) \ - $(COPYDIR)/missionpack/. + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/$(MISSIONPACK)/cgame$(SHLIBNAME) \ + $(COPYDIR)/$(MISSIONPACK)/. + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/$(MISSIONPACK)/qagame$(SHLIBNAME) \ + $(COPYDIR)/$(MISSIONPACK)/. + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/$(MISSIONPACK)/ui$(SHLIBNAME) \ + $(COPYDIR)/$(MISSIONPACK)/. endif endif @@ -2485,16 +2535,22 @@ distclean: clean toolsclean installer: release ifeq ($(PLATFORM),mingw32) - @$(MAKE) VERSION=$(VERSION) -C $(NSISDIR) V=$(V) + @$(MAKE) VERSION=$(VERSION) -C $(NSISDIR) V=$(V) \ + USE_RENDERER_DLOPEN=$(USE_RENDERER_DLOPEN) \ + USE_OPENAL_DLOPEN=$(USE_OPENAL_DLOPEN) \ + USE_CURL_DLOPEN=$(USE_CURL_DLOPEN) \ + USE_INTERNAL_SPEEX=$(USE_INTERNAL_SPEEX) \ + USE_INTERNAL_ZLIB=$(USE_INTERNAL_ZLIB) \ + USE_INTERNAL_JPEG=$(USE_INTERNAL_JPEG) else @$(MAKE) VERSION=$(VERSION) -C $(LOKISETUPDIR) V=$(V) endif dist: - rm -rf q3rally-$(VERSION) - svn export . q3rally-$(VERSION) - tar --owner=root --group=root --force-local -cjf q3rally-$(VERSION).tar.bz2 q3rally-$(VERSION) - rm -rf q3rally-$(VERSION) + rm -rf $(CLIENTBIN)-$(VERSION) + svn export . $(CLIENTBIN)-$(VERSION) + tar --owner=root --group=root --force-local -cjf $(CLIENTBIN)-$(VERSION).tar.bz2 $(CLIENTBIN)-$(VERSION) + rm -rf $(CLIENTBIN)-$(VERSION) ############################################################################# # DEPENDENCIES diff --git a/engine/README b/engine/README index ded561f7..326367be 100644 --- a/engine/README +++ b/engine/README @@ -83,9 +83,17 @@ Makefile.local: BUILD_SERVER - build the 'ioq3ded' server binary BUILD_CLIENT - build the 'ioquake3' client binary BUILD_CLIENT_SMP - build the 'ioquake3-smp' client binary + BUILD_BASEGAME - build the 'baseq3' binaries + BUILD_MISSIONPACK - build the 'missionpack' binaries BUILD_GAME_SO - build the game shared libraries BUILD_GAME_QVM - build the game qvms BUILD_STANDALONE - build binaries suited for stand-alone games + SERVERBIN - rename 'ioq3ded' server binary + CLIENTBIN - rename 'ioquake3' client binary + BASEGAME - rename 'baseq3' + BASEGAME_CFLAGS - custom CFLAGS for basegame + MISSIONPACK - rename 'missionpack' + MISSIONPACK_CFLAGS - custom CFLAGS for missionpack (default '-DMISSIONPACK') USE_OPENAL - use OpenAL where available USE_OPENAL_DLOPEN - link with OpenAL at runtime USE_CURL - use libcurl for http/ftp download support @@ -237,8 +245,9 @@ New cvars red-cyan glasses: 1 red-blue: 2 red-green: 3 + green-magenta: 4 To swap the colors for left and right eye - just add 3 to the value for the wanted + just add 4 to the value for the wanted color combination. For red-blue and red-green you probably want to enable r_greyscale @@ -701,6 +710,7 @@ Maintainers Tim Angus Tony J. White Zachary J. Slater + Zack Middleton Significant contributions from Ryan C. Gordon diff --git a/engine/code/asm/ftola.asm b/engine/code/asm/ftola.asm index 370c12d8..eea9d0e3 100644 --- a/engine/code/asm/ftola.asm +++ b/engine/code/asm/ftola.asm @@ -25,11 +25,11 @@ IFNDEF idx64 .model flat, c ENDIF -; .data +.data -; ifndef idx64 -; fpucw WORD 0F7Fh -; endif +ifndef idx64 + fpucw WORD 0F7Fh +endif .code @@ -51,22 +51,19 @@ ELSE ; qftol using FPU qftolx87m macro src -; not necessary, fpucw is set with _controlfp at startup -; sub esp, 2 -; fnstcw word ptr [esp] -; fldcw fpucw + sub esp, 2 + fnstcw word ptr [esp] + fldcw fpucw fld dword ptr src fistp dword ptr src -; fldcw [esp] + fldcw [esp] mov eax, src -; add esp, 2 + add esp, 2 ret endm qftolx87 PROC -; need this line when storing FPU control word on stack -; qftolx87m [esp + 6] - qftolx87m [esp + 4] + qftolx87m [esp + 6] qftolx87 ENDP qvmftolx87 PROC diff --git a/engine/code/asm/ftola.c b/engine/code/asm/ftola.c index ad197836..6e8ff061 100644 --- a/engine/code/asm/ftola.c +++ b/engine/code/asm/ftola.c @@ -22,6 +22,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "qasm-inline.h" +static const unsigned short fpucw = 0x0C7F; + /* * GNU inline asm ftol conversion functions using SSE or FPU */ @@ -59,14 +61,18 @@ int qvmftolsse(void) long qftolx87(float f) { long retval; + unsigned short oldcw; __asm__ volatile ( + "fnstcw %2\n" + "fldcw %3\n" "flds %1\n" "fistpl %1\n" + "fldcw %2\n" "mov %1, %0\n" : "=r" (retval) - : "m" (f) + : "m" (f), "m" (oldcw), "m" (fpucw) ); return retval; @@ -75,13 +81,18 @@ long qftolx87(float f) int qvmftolx87(void) { int retval; + unsigned short oldcw; __asm__ volatile ( + "fnstcw %1\n" + "fldcw %2\n" "flds (" EDI ", " EBX ", 4)\n" "fistpl (" EDI ", " EBX ", 4)\n" + "fldcw %1\n" "mov (" EDI ", " EBX ", 4), %0\n" : "=r" (retval) + : "m" (oldcw), "m" (fpucw) ); return retval; diff --git a/engine/code/asm/snapvector.asm b/engine/code/asm/snapvector.asm index eca40fe1..22f9b225 100644 --- a/engine/code/asm/snapvector.asm +++ b/engine/code/asm/snapvector.asm @@ -45,41 +45,31 @@ IFDEF idx64 qsnapvectorsse PROC sub rsp, 8 - stmxcsr [rsp] ; save SSE control word - ldmxcsr ssecw ; set to round nearest - - push rdi - mov rdi, rcx ; maskmovdqu uses rdi as implicit memory operand - movaps xmm1, ssemask ; initialize the mask register for maskmovdqu - movups xmm0, [rdi] ; here is stored our vector. Read 4 values in one go + movaps xmm1, ssemask ; initialize the mask register + movups xmm0, [rcx] ; here is stored our vector. Read 4 values in one go + movaps xmm2, xmm0 ; keep a copy of the original data + andps xmm0, xmm1 ; set the fourth value to zero in xmm0 + andnps xmm1, xmm2 ; copy fourth value to xmm1 and set rest to zero cvtps2dq xmm0, xmm0 ; convert 4 single fp to int cvtdq2ps xmm0, xmm0 ; convert 4 int to single fp - maskmovdqu xmm0, xmm1 ; write 3 values back to memory - pop rdi - - ldmxcsr [rsp] ; restore sse control word to old value - add rsp, 8 + orps xmm0, xmm1 ; combine all 4 values again + movups [rcx], xmm0 ; write 3 rounded and 1 unchanged values back to memory ret qsnapvectorsse ENDP ELSE qsnapvectorsse PROC - sub esp, 8 - stmxcsr [esp] ; save SSE control word - ldmxcsr ssecw ; set to round nearest - - push edi - mov edi, dword ptr 16[esp] ; maskmovdqu uses edi as implicit memory operand - movaps xmm1, ssemask ; initialize the mask register for maskmovdqu - movups xmm0, [edi] ; here is stored our vector. Read 4 values in one go + mov eax, dword ptr 4[esp] ; store address of vector in eax + movaps xmm1, ssemask ; initialize the mask register for maskmovdqu + movups xmm0, [eax] ; here is stored our vector. Read 4 values in one go + movaps xmm2, xmm0 ; keep a copy of the original data + andps xmm0, xmm1 ; set the fourth value to zero in xmm0 + andnps xmm1, xmm2 ; copy fourth value to xmm1 and set rest to zero cvtps2dq xmm0, xmm0 ; convert 4 single fp to int cvtdq2ps xmm0, xmm0 ; convert 4 int to single fp - maskmovdqu xmm0, xmm1 ; write 3 values back to memory - pop edi - - ldmxcsr [esp] ; restore sse control word to old value - add esp, 8 + orps xmm0, xmm1 ; combine all 4 values again + movups [eax], xmm0 ; write 3 rounded and 1 unchanged values back to memory ret qsnapvectorsse ENDP @@ -92,14 +82,10 @@ ELSE qsnapvectorx87 PROC mov eax, dword ptr 4[esp] - sub esp, 2 - fnstcw word ptr [esp] - fldcw fpucw qroundx87 [eax] qroundx87 4[eax] qroundx87 8[eax] - fldcw [esp] - add esp, 2 + ret qsnapvectorx87 ENDP ENDIF diff --git a/engine/code/asm/snapvector.c b/engine/code/asm/snapvector.c index 8e9b2868..f0f62466 100644 --- a/engine/code/asm/snapvector.c +++ b/engine/code/asm/snapvector.c @@ -33,55 +33,41 @@ static unsigned char ssemask[16] __attribute__((aligned(16))) = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\x00\x00\x00" }; -static const unsigned int ssecw __attribute__((aligned(16))) = 0x00001F80; -static const unsigned short fpucw = 0x037F; - void qsnapvectorsse(vec3_t vec) { - uint32_t oldcw __attribute__((aligned(16))); - __asm__ volatile ( - "stmxcsr %3\n" - "ldmxcsr %1\n" - "movaps (%0), %%xmm1\n" - "movups (%2), %%xmm0\n" + "movups (%1), %%xmm0\n" + "movaps %%xmm0, %%xmm2\n" + "andps %%xmm1, %%xmm0\n" + "andnps %%xmm2, %%xmm1\n" "cvtps2dq %%xmm0, %%xmm0\n" "cvtdq2ps %%xmm0, %%xmm0\n" - // vec MUST reside in register rdi as maskmovdqu uses - // it as an implicit operand. The "D" constraint makes - // sure of that. - "maskmovdqu %%xmm1, %%xmm0\n" - - "ldmxcsr %3\n" + "orps %%xmm1, %%xmm0\n" + "movups %%xmm0, (%1)\n" : - : "r" (ssemask), "m" (ssecw), "D" (vec), "m" (oldcw) - : "memory", "%xmm0", "%xmm1" + : "r" (ssemask), "r" (vec) + : "memory", "%xmm0", "%xmm1", "%xmm2" ); } #define QROUNDX87(src) \ "flds " src "\n" \ - "fistp " src "\n" \ - "fild " src "\n" \ - "fstp " src "\n" + "fistps " src "\n" \ + "filds " src "\n" \ + "fstps " src "\n" void qsnapvectorx87(vec3_t vec) { __asm__ volatile ( - "sub $2, " ESP "\n" - "fnstcw (" ESP ")\n" - "fldcw %0\n" - QROUNDX87("(%1)") - QROUNDX87("4(%1)") - QROUNDX87("8(%1)") - "fldcw (" ESP ")\n" - "add $2, " ESP "\n" + QROUNDX87("(%0)") + QROUNDX87("4(%0)") + QROUNDX87("8(%0)") : - : "m" (fpucw), "r" (vec) + : "r" (vec) : "memory" ); } diff --git a/engine/code/botlib/be_ai_chat.c b/engine/code/botlib/be_ai_chat.c index 10950e9d..cc489d55 100644 --- a/engine/code/botlib/be_ai_chat.c +++ b/engine/code/botlib/be_ai_chat.c @@ -1173,7 +1173,7 @@ bot_matchpiece_t *BotLoadMatchPieces(source_t *source, char *endtoken) { if (token.type == TT_NUMBER && (token.subtype & TT_INTEGER)) { - if (token.intvalue < 0 || token.intvalue >= MAX_MATCHVARIABLES) + if (token.intvalue >= MAX_MATCHVARIABLES) { SourceError(source, "can't have more than %d match variables\n", MAX_MATCHVARIABLES); FreeSource(source); diff --git a/engine/code/cgame/cg_particles.c b/engine/code/cgame/cg_particles.c index d1672dac..63280695 100644 --- a/engine/code/cgame/cg_particles.c +++ b/engine/code/cgame/cg_particles.c @@ -1703,7 +1703,7 @@ qboolean ValidBloodPool (vec3_t start) CG_Trace (&trace, this_pos, NULL, NULL, end_pos, -1, CONTENTS_SOLID); - if (trace.entityNum < (MAX_ENTITIES - 1)) // may only land on world + if (trace.entityNum < ENTITYNUM_WORLD) // may only land on world return qfalse; if (!(!trace.startsolid && trace.fraction < 1)) diff --git a/engine/code/cgame/cg_view.c b/engine/code/cgame/cg_view.c index 41735a48..337c7eb4 100644 --- a/engine/code/cgame/cg_view.c +++ b/engine/code/cgame/cg_view.c @@ -526,9 +526,7 @@ static int CG_CalcFov( void ) { } } else { f = ( cg.time - cg.zoomTime ) / (float)ZOOM_TIME; - if ( f > 1.0 ) { - fov_x = fov_x; - } else { + if ( f <= 1.0 ) { fov_x = zoomFov + f * ( fov_x - zoomFov ); } } @@ -578,6 +576,10 @@ static void CG_DamageBlendBlob( void ) { int maxTime; refEntity_t ent; + if (!cg_blood.integer) { + return; + } + if ( !cg.damageValue ) { return; } diff --git a/engine/code/client/cl_cgame.c b/engine/code/client/cl_cgame.c index 55eb2dd4..093baa1d 100644 --- a/engine/code/client/cl_cgame.c +++ b/engine/code/client/cl_cgame.c @@ -25,7 +25,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "../botlib/botlib.h" +#ifdef USE_MUMBLE #include "libmumblelink.h" +#endif extern botlib_export_t *botlib_export; @@ -732,13 +734,14 @@ void CL_InitCGame( void ) { Com_sprintf( cl.mapname, sizeof( cl.mapname ), "maps/%s.bsp", mapname ); // load the dll or bytecode - if ( cl_connectedToPureServer != 0 ) { + interpret = Cvar_VariableValue("vm_cgame"); + if(cl_connectedToPureServer) + { // if sv_pure is set we only allow qvms to be loaded - interpret = VMI_COMPILED; - } - else { - interpret = Cvar_VariableValue( "vm_cgame" ); + if(interpret != VMI_COMPILED && interpret != VMI_BYTECODE) + interpret = VMI_COMPILED; } + cgvm = VM_Create( "cgame", CL_CgameSystemCalls, interpret ); if ( !cgvm ) { Com_Error( ERR_DROP, "VM_Create on cgame failed" ); diff --git a/engine/code/client/cl_cin.c b/engine/code/client/cl_cin.c index b28b0e8a..8d6f51c5 100644 --- a/engine/code/client/cl_cin.c +++ b/engine/code/client/cl_cin.c @@ -1293,7 +1293,7 @@ static void RoQShutdown( void ) { /* ================== -SCR_StopCinematic +CIN_StopCinematic ================== */ e_status CIN_StopCinematic(int handle) { @@ -1320,7 +1320,7 @@ e_status CIN_StopCinematic(int handle) { /* ================== -SCR_RunCinematic +CIN_RunCinematic Fetch and decompress the pending frame ================== @@ -1398,8 +1398,7 @@ e_status CIN_RunCinematic (int handle) /* ================== -CL_PlayCinematic - +CIN_PlayCinematic ================== */ int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBits ) { @@ -1421,7 +1420,7 @@ int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBi } } - Com_DPrintf("SCR_PlayCinematic( %s )\n", arg); + Com_DPrintf("CIN_PlayCinematic( %s )\n", arg); Com_Memset(&cin, 0, sizeof(cinematics_t) ); currentHandle = CIN_HandleForVideo(); @@ -1564,8 +1563,7 @@ void CIN_ResampleCinematic(int handle, int *buf2) { /* ================== -SCR_DrawCinematic - +CIN_DrawCinematic ================== */ void CIN_DrawCinematic (int handle) { diff --git a/engine/code/client/cl_curl.c b/engine/code/client/cl_curl.c index b8508248..3debd6ed 100644 --- a/engine/code/client/cl_curl.c +++ b/engine/code/client/cl_curl.c @@ -22,11 +22,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #ifdef USE_CURL #include "client.h" -cvar_t *cl_cURLLib; #ifdef USE_CURL_DLOPEN #include "../sys/sys_loadlib.h" +cvar_t *cl_cURLLib; + char* (*qcurl_version)(void); CURL* (*qcurl_easy_init)(void); @@ -243,7 +244,7 @@ void CL_cURL_BeginDownload( const char *localName, const char *remoteURL ) "%s for writing", clc.downloadTempName); return; } - qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEDATA, clc.download); + if(com_developer->integer) qcurl_easy_setopt(clc.downloadCURL, CURLOPT_VERBOSE, 1); qcurl_easy_setopt(clc.downloadCURL, CURLOPT_URL, clc.downloadURL); diff --git a/engine/code/client/cl_curl.h b/engine/code/client/cl_curl.h index c8d3006a..d1d08b4f 100644 --- a/engine/code/client/cl_curl.h +++ b/engine/code/client/cl_curl.h @@ -24,28 +24,28 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #ifndef __QCURL_H__ #define __QCURL_H__ -extern cvar_t *cl_cURLLib; - #include "../qcommon/q_shared.h" #include "../qcommon/qcommon.h" -#ifdef WIN32 -#define DEFAULT_CURL_LIB "libcurl-3.dll" -#elif defined(MACOS_X) -#define DEFAULT_CURL_LIB "libcurl.dylib" -#else -#define DEFAULT_CURL_LIB "libcurl.so.4" -#define ALTERNATE_CURL_LIB "libcurl.so.3" -#endif - #ifdef USE_LOCAL_HEADERS #include "../libcurl/curl/curl.h" #else #include #endif - #ifdef USE_CURL_DLOPEN +#ifdef WIN32 + #define DEFAULT_CURL_LIB "libcurl-4.dll" + #define ALTERNATE_CURL_LIB "libcurl-3.dll" +#elif defined(MACOS_X) + #define DEFAULT_CURL_LIB "libcurl.dylib" +#else + #define DEFAULT_CURL_LIB "libcurl.so.4" + #define ALTERNATE_CURL_LIB "libcurl.so.3" +#endif + +extern cvar_t *cl_cURLLib; + extern char* (*qcurl_version)(void); extern CURL* (*qcurl_easy_init)(void); diff --git a/engine/code/client/cl_input.c b/engine/code/client/cl_input.c index 67a97c52..65ceb5f1 100644 --- a/engine/code/client/cl_input.c +++ b/engine/code/client/cl_input.c @@ -267,11 +267,6 @@ void IN_Button14Up(void) {IN_KeyUp(&in_buttons[14]);} void IN_Button15Down(void) {IN_KeyDown(&in_buttons[15]);} void IN_Button15Up(void) {IN_KeyUp(&in_buttons[15]);} -void IN_ButtonDown (void) { - IN_KeyDown(&in_buttons[1]);} -void IN_ButtonUp (void) { - IN_KeyUp(&in_buttons[1]);} - void IN_CenterView (void) { cl.viewangles[PITCH] = -SHORT2ANGLE(cl.snap.ps.delta_angles[PITCH]); } diff --git a/engine/code/client/cl_main.c b/engine/code/client/cl_main.c index deaa4120..2606f6d8 100644 --- a/engine/code/client/cl_main.c +++ b/engine/code/client/cl_main.c @@ -55,7 +55,9 @@ cvar_t *cl_nodelta; cvar_t *cl_debugMove; cvar_t *cl_noprint; +#ifdef UPDATE_SERVER_NAME cvar_t *cl_motd; +#endif cvar_t *rcon_client_password; cvar_t *rconAddress; @@ -1522,6 +1524,7 @@ CL_RequestMotd =================== */ void CL_RequestMotd( void ) { +#ifdef UPDATE_SERVER_NAME char info[MAX_INFO_STRING]; if ( !cl_motd->integer ) { @@ -1547,6 +1550,7 @@ void CL_RequestMotd( void ) { Info_SetValueForKey( info, "version", com_version->string ); NET_OutOfBandPrint( NS_CLIENT, cls.updateServer, "getmotd \"%s\"\n", info ); +#endif } /* @@ -2408,6 +2412,7 @@ CL_MotdPacket =================== */ void CL_MotdPacket( netadr_t from ) { +#ifdef UPDATE_SERVER_NAME char *challenge; char *info; @@ -2428,6 +2433,7 @@ void CL_MotdPacket( netadr_t from ) { Q_strncpyz( cls.updateInfoString, info, sizeof( cls.updateInfoString ) ); Cvar_Set( "cl_motdString", challenge ); +#endif } /* @@ -3439,7 +3445,9 @@ void CL_Init( void ) { // register our variables // cl_noprint = Cvar_Get( "cl_noprint", "0", 0 ); +#ifdef UPDATE_SERVER_NAME cl_motd = Cvar_Get ("cl_motd", "1", 0); +#endif cl_timeout = Cvar_Get ("cl_timeout", "200", 0); @@ -3483,7 +3491,7 @@ void CL_Init( void ) { cl_showMouseRate = Cvar_Get ("cl_showmouserate", "0", 0); cl_allowDownload = Cvar_Get ("cl_allowDownload", "0", CVAR_ARCHIVE); -#ifdef USE_CURL +#ifdef USE_CURL_DLOPEN cl_cURLLib = Cvar_Get("cl_cURLLib", DEFAULT_CURL_LIB, CVAR_ARCHIVE); #endif @@ -3755,13 +3763,22 @@ void CL_ServerInfoPacket( netadr_t from, msg_t *msg ) { char *infoString; int prot; char *gamename; + qboolean gameMismatch; infoString = MSG_ReadString( msg ); // if this isn't the correct gamename, ignore it gamename = Info_ValueForKey( infoString, "gamename" ); - if (gamename && *gamename && strcmp(gamename, com_gamename->string)) +#ifdef LEGACY_PROTOCOL + // gamename is optional for legacy protocol + if (com_legacyprotocol->integer && !*gamename) + gameMismatch = qfalse; + else +#endif + gameMismatch = !*gamename || strcmp(gamename, com_gamename->string) != 0; + + if (gameMismatch) { Com_DPrintf( "Game mismatch in info packet: %s\n", infoString ); return; diff --git a/engine/code/client/cl_parse.c b/engine/code/client/cl_parse.c index e269be35..78f4a921 100644 --- a/engine/code/client/cl_parse.c +++ b/engine/code/client/cl_parse.c @@ -538,12 +538,14 @@ void CL_ParseGamestate( msg_t *msg ) { CL_StopRecord_f(); // reinitialize the filesystem if the game directory has changed - if(FS_ConditionalRestart(clc.checksumFeed, qfalse) && !cls.oldGameSet) + if(!cls.oldGameSet && (Cvar_Flags("fs_game") & CVAR_MODIFIED)) { cls.oldGameSet = qtrue; Q_strncpyz(cls.oldGame, oldGame, sizeof(cls.oldGame)); } + FS_ConditionalRestart(clc.checksumFeed, qfalse); + // This used to call CL_StartHunkUsers, but now we enter the download state before loading the // cgame CL_InitDownloads(); diff --git a/engine/code/client/cl_scrn.c b/engine/code/client/cl_scrn.c index b1f60349..42fa62da 100644 --- a/engine/code/client/cl_scrn.c +++ b/engine/code/client/cl_scrn.c @@ -316,7 +316,7 @@ static int SCR_Strlen( const char *str ) { ** SCR_GetBigStringWidth */ int SCR_GetBigStringWidth( const char *str ) { - return SCR_Strlen( str ) * 16; + return SCR_Strlen( str ) * BIGCHAR_WIDTH; } diff --git a/engine/code/client/cl_ui.c b/engine/code/client/cl_ui.c index e65977bd..19223a32 100644 --- a/engine/code/client/cl_ui.c +++ b/engine/code/client/cl_ui.c @@ -765,7 +765,7 @@ intptr_t CL_UISystemCalls( intptr_t *args ) { return 0; case UI_CMD_EXECUTETEXT: - if(args[1] == 0 + if(args[1] == EXEC_NOW && (!strncmp(VMA(2), "snd_restart", 11) || !strncmp(VMA(2), "vid_restart", 11) || !strncmp(VMA(2), "quit", 5))) @@ -1098,13 +1098,14 @@ void CL_InitUI( void ) { vmInterpret_t interpret; // load the dll or bytecode - if ( cl_connectedToPureServer != 0 ) { + interpret = Cvar_VariableValue("vm_ui"); + if(cl_connectedToPureServer) + { // if sv_pure is set we only allow qvms to be loaded - interpret = VMI_COMPILED; - } - else { - interpret = Cvar_VariableValue( "vm_ui" ); + if(interpret != VMI_COMPILED && interpret != VMI_BYTECODE) + interpret = VMI_COMPILED; } + uivm = VM_Create( "ui", CL_UISystemCalls, interpret ); if ( !uivm ) { Com_Error( ERR_FATAL, "VM_Create on UI failed" ); @@ -1118,6 +1119,10 @@ void CL_InitUI( void ) { VM_Call( uivm, UI_INIT, (clc.state >= CA_AUTHORIZING && clc.state < CA_ACTIVE)); } else if (v != UI_API_VERSION) { + // Free uivm now, so UI_SHUTDOWN doesn't get called later. + VM_Free( uivm ); + uivm = NULL; + Com_Error( ERR_DROP, "User Interface is version %d, expected %d", v, UI_API_VERSION ); cls.uiStarted = qfalse; } diff --git a/engine/code/client/client.h b/engine/code/client/client.h index 96f6e977..3204dc84 100644 --- a/engine/code/client/client.h +++ b/engine/code/client/client.h @@ -489,14 +489,6 @@ typedef struct { qboolean wasPressed; // set when down, not cleared when up } kbutton_t; -extern kbutton_t in_mlook, in_klook; -extern kbutton_t in_strafe; -extern kbutton_t in_speed; - -#ifdef USE_VOIP -extern kbutton_t in_voiprecord; -#endif - void CL_InitInput(void); void CL_ShutdownInput(void); void CL_SendCmd (void); diff --git a/engine/code/client/libmumblelink.c b/engine/code/client/libmumblelink.c index 40d1eb1b..c6d6acb0 100644 --- a/engine/code/client/libmumblelink.c +++ b/engine/code/client/libmumblelink.c @@ -115,7 +115,7 @@ int mumble_link(const char* name) close(shmfd); #endif memset(lm, 0, sizeof(LinkedMem)); - mbstowcs(lm->name, name, sizeof(lm->name)); + mbstowcs(lm->name, name, sizeof(lm->name) / sizeof(wchar_t)); return 0; } diff --git a/engine/code/client/snd_dma.c b/engine/code/client/snd_dma.c index 64637df8..0b999a81 100644 --- a/engine/code/client/snd_dma.c +++ b/engine/code/client/snd_dma.c @@ -77,7 +77,6 @@ int s_numSfx = 0; static sfx_t *sfxHash[LOOP_HASH]; cvar_t *s_testsound; -cvar_t *s_khz; cvar_t *s_show; cvar_t *s_mixahead; cvar_t *s_mixPreStep; @@ -1494,7 +1493,6 @@ qboolean S_Base_Init( soundInterface_t *si ) { return qfalse; } - s_khz = Cvar_Get ("s_khz", "22", CVAR_ARCHIVE); s_mixahead = Cvar_Get ("s_mixahead", "0.2", CVAR_ARCHIVE); s_mixPreStep = Cvar_Get ("s_mixPreStep", "0.05", CVAR_ARCHIVE); s_show = Cvar_Get ("s_show", "0", CVAR_CHEAT); diff --git a/engine/code/game/g_cmds.c b/engine/code/game/g_cmds.c index 2f33058c..04d8aaf0 100644 --- a/engine/code/game/g_cmds.c +++ b/engine/code/game/g_cmds.c @@ -1180,7 +1180,7 @@ static void G_VoiceTo( gentity_t *ent, gentity_t *other, int mode, const char *i // no chatting to players in tournements // STONELANCE - removed gametype /* - if ( (g_gametype.integer == GT_TOURNAMENT )) { + if ( g_gametype.integer == GT_TOURNAMENT ) { return; } */ diff --git a/engine/code/game/g_svcmds.c b/engine/code/game/g_svcmds.c index b4bdae08..34593d92 100644 --- a/engine/code/game/g_svcmds.c +++ b/engine/code/game/g_svcmds.c @@ -484,11 +484,11 @@ qboolean ConsoleCommand( void ) { if (g_dedicated.integer) { if (Q_stricmp (cmd, "say") == 0) { - trap_SendServerCommand( -1, va("print \"server: %s\"", ConcatArgs(1) ) ); + trap_SendServerCommand( -1, va("print \"server: %s\n\"", ConcatArgs(1) ) ); return qtrue; } // everything else will also be printed as a say command - trap_SendServerCommand( -1, va("print \"server: %s\"", ConcatArgs(0) ) ); + trap_SendServerCommand( -1, va("print \"server: %s\n\"", ConcatArgs(0) ) ); return qtrue; } diff --git a/engine/code/game/g_trigger.c b/engine/code/game/g_trigger.c index deeaa43d..e212729f 100644 --- a/engine/code/game/g_trigger.c +++ b/engine/code/game/g_trigger.c @@ -398,8 +398,6 @@ void SP_trigger_hurt( gentity_t *self ) { self->damage = 5; } - self->r.contents = CONTENTS_TRIGGER; - self->use = hurt_use; // link in to the world if starting active diff --git a/engine/code/q3_ui/ui_sound.c b/engine/code/q3_ui/ui_sound.c index a7ed9556..982011d8 100644 --- a/engine/code/q3_ui/ui_sound.c +++ b/engine/code/q3_ui/ui_sound.c @@ -38,6 +38,8 @@ SOUND OPTIONS MENU #define ART_FRAMER "menu/art/frame1_r" #define ART_BACK0 "menu/art/back_0" #define ART_BACK1 "menu/art/back_1" +#define ART_ACCEPT0 "menu/art/accept_0" +#define ART_ACCEPT1 "menu/art/accept_1" */ // END @@ -48,12 +50,22 @@ SOUND OPTIONS MENU #define ID_EFFECTSVOLUME 14 #define ID_MUSICVOLUME 15 #define ID_QUALITY 16 -//#define ID_A3D 17 -#define ID_BACK 18 +#define ID_SOUNDSYSTEM 17 +//#define ID_A3D 18 +#define ID_BACK 19 +#define ID_APPLY 20 +#define DEFAULT_SDL_SND_SPEED 22050 static const char *quality_items[] = { - "Low", "High", 0 + "Low", "Medium", "High", NULL +}; + +#define UISND_SDL 0 +#define UISND_OPENAL 1 + +static const char *soundSystem_items[] = { + "SDL", "OpenAL", NULL }; typedef struct { @@ -74,13 +86,21 @@ typedef struct { menuslider_s sfxvolume; menuslider_s musicvolume; + menulist_s soundSystem; menulist_s quality; // menuradiobutton_s a3d; // STONELANCE // menubitmap_s back; +// menubitmap_s apply; menutext_s back; + menutext_s apply; // END + + float sfxvolume_original; + float musicvolume_original; + int soundSystem_original; + int quality_original; } soundOptionsInfo_t; static soundOptionsInfo_t soundOptionsInfo; @@ -114,27 +134,6 @@ static void UI_SoundOptionsMenu_Event( void* ptr, int event ) { UI_PopMenu(); UI_NetworkOptionsMenu(); break; - - case ID_EFFECTSVOLUME: - trap_Cvar_SetValue( "s_volume", soundOptionsInfo.sfxvolume.curvalue / 10 ); - break; - - case ID_MUSICVOLUME: - trap_Cvar_SetValue( "s_musicvolume", soundOptionsInfo.musicvolume.curvalue / 10 ); - break; - - case ID_QUALITY: - if( soundOptionsInfo.quality.curvalue ) { - trap_Cvar_SetValue( "s_khz", 22 ); - trap_Cvar_SetValue( "s_compression", 0 ); - } - else { - trap_Cvar_SetValue( "s_khz", 11 ); - trap_Cvar_SetValue( "s_compression", 1 ); - } - UI_ForceMenuOff(); - trap_Cmd_ExecuteText( EXEC_APPEND, "snd_restart\n" ); - break; /* case ID_A3D: if( soundOptionsInfo.a3d.curvalue ) { @@ -149,9 +148,98 @@ static void UI_SoundOptionsMenu_Event( void* ptr, int event ) { case ID_BACK: UI_PopMenu(); break; + + case ID_APPLY: + trap_Cvar_SetValue( "s_volume", soundOptionsInfo.sfxvolume.curvalue / 10 ); + soundOptionsInfo.sfxvolume_original = soundOptionsInfo.sfxvolume.curvalue; + + trap_Cvar_SetValue( "s_musicvolume", soundOptionsInfo.musicvolume.curvalue / 10 ); + soundOptionsInfo.musicvolume_original = soundOptionsInfo.musicvolume.curvalue; + + // Check if something changed that requires the sound system to be restarted. + if (soundOptionsInfo.quality_original != soundOptionsInfo.quality.curvalue + || soundOptionsInfo.soundSystem_original != soundOptionsInfo.soundSystem.curvalue) + { + int speed; + + switch ( soundOptionsInfo.quality.curvalue ) + { + default: + case 0: + speed = 11025; + break; + case 1: + speed = 22050; + break; + case 2: + speed = 44100; + break; + } + + if (speed == DEFAULT_SDL_SND_SPEED) + speed = 0; + + trap_Cvar_SetValue( "s_sdlSpeed", speed ); + soundOptionsInfo.quality_original = soundOptionsInfo.quality.curvalue; + + trap_Cvar_SetValue( "s_useOpenAL", (soundOptionsInfo.soundSystem.curvalue == UISND_OPENAL) ); + soundOptionsInfo.soundSystem_original = soundOptionsInfo.soundSystem.curvalue; + + UI_ForceMenuOff(); + trap_Cmd_ExecuteText( EXEC_APPEND, "snd_restart\n" ); + } + break; } } +/* +================= +SoundOptions_UpdateMenuItems +================= +*/ +static void SoundOptions_UpdateMenuItems( void ) +{ + if ( soundOptionsInfo.soundSystem.curvalue == UISND_SDL ) + { + soundOptionsInfo.quality.generic.flags &= ~QMF_GRAYED; + } + else + { + soundOptionsInfo.quality.generic.flags |= QMF_GRAYED; + } + + soundOptionsInfo.apply.generic.flags |= QMF_HIDDEN|QMF_INACTIVE; + + if ( soundOptionsInfo.sfxvolume_original != soundOptionsInfo.sfxvolume.curvalue ) + { + soundOptionsInfo.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); + } + if ( soundOptionsInfo.musicvolume_original != soundOptionsInfo.musicvolume.curvalue ) + { + soundOptionsInfo.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); + } + if ( soundOptionsInfo.soundSystem_original != soundOptionsInfo.soundSystem.curvalue ) + { + soundOptionsInfo.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); + } + if ( soundOptionsInfo.quality_original != soundOptionsInfo.quality.curvalue ) + { + soundOptionsInfo.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); + } +} + +/* +================ +SoundOptions_MenuDraw +================ +*/ +void SoundOptions_MenuDraw (void) +{ +//APSFIX - rework this + SoundOptions_UpdateMenuItems(); + + Menu_Draw( &soundOptionsInfo.menu ); +} /* =============== @@ -160,12 +248,14 @@ UI_SoundOptionsMenu_Init */ static void UI_SoundOptionsMenu_Init( void ) { int y; + int speed; memset( &soundOptionsInfo, 0, sizeof(soundOptionsInfo) ); UI_SoundOptionsMenu_Cache(); soundOptionsInfo.menu.wrapAround = qtrue; soundOptionsInfo.menu.fullscreen = qtrue; + soundOptionsInfo.menu.draw = SoundOptions_MenuDraw; soundOptionsInfo.banner.generic.type = MTYPE_BTEXT; soundOptionsInfo.banner.generic.flags = QMF_CENTER_JUSTIFY; @@ -247,7 +337,7 @@ static void UI_SoundOptionsMenu_Init( void ) { soundOptionsInfo.network.color = text_color_normal; // END - y = 240 - 1.5 * (BIGCHAR_HEIGHT + 2); + y = 240 - 2 * (BIGCHAR_HEIGHT + 2); soundOptionsInfo.sfxvolume.generic.type = MTYPE_SLIDER; soundOptionsInfo.sfxvolume.generic.name = "Effects Volume:"; soundOptionsInfo.sfxvolume.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; @@ -269,15 +359,26 @@ static void UI_SoundOptionsMenu_Init( void ) { soundOptionsInfo.musicvolume.minvalue = 0; soundOptionsInfo.musicvolume.maxvalue = 10; + y += BIGCHAR_HEIGHT+2; + soundOptionsInfo.soundSystem.generic.type = MTYPE_SPINCONTROL; + soundOptionsInfo.soundSystem.generic.name = "Sound System:"; + soundOptionsInfo.soundSystem.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; + soundOptionsInfo.soundSystem.generic.callback = UI_SoundOptionsMenu_Event; + soundOptionsInfo.soundSystem.generic.id = ID_SOUNDSYSTEM; + soundOptionsInfo.soundSystem.generic.x = 400; + soundOptionsInfo.soundSystem.generic.y = y; + soundOptionsInfo.soundSystem.itemnames = soundSystem_items; + y += BIGCHAR_HEIGHT+2; soundOptionsInfo.quality.generic.type = MTYPE_SPINCONTROL; - soundOptionsInfo.quality.generic.name = "Sound Quality:"; + soundOptionsInfo.quality.generic.name = "SDL Sound Quality:"; soundOptionsInfo.quality.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; soundOptionsInfo.quality.generic.callback = UI_SoundOptionsMenu_Event; soundOptionsInfo.quality.generic.id = ID_QUALITY; soundOptionsInfo.quality.generic.x = 400; soundOptionsInfo.quality.generic.y = y; soundOptionsInfo.quality.itemnames = quality_items; + /* y += BIGCHAR_HEIGHT+2; soundOptionsInfo.a3d.generic.type = MTYPE_RADIOBUTTON; @@ -300,6 +401,17 @@ static void UI_SoundOptionsMenu_Init( void ) { soundOptionsInfo.back.width = 128; soundOptionsInfo.back.height = 64; soundOptionsInfo.back.focuspic = ART_BACK1; + + soundOptionsInfo.apply.generic.type = MTYPE_BITMAP; + soundOptionsInfo.apply.generic.name = ART_ACCEPT0; + soundOptionsInfo.apply.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_HIDDEN|QMF_INACTIVE; + soundOptionsInfo.apply.generic.callback = UI_SoundOptionsMenu_Event; + soundOptionsInfo.apply.generic.id = ID_APPLY; + soundOptionsInfo.apply.generic.x = 640; + soundOptionsInfo.apply.generic.y = 480-64; + soundOptionsInfo.apply.width = 128; + soundOptionsInfo.apply.height = 64; + soundOptionsInfo.apply.focuspic = ART_ACCEPT1; */ soundOptionsInfo.back.generic.type = MTYPE_PTEXT; soundOptionsInfo.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; @@ -312,6 +424,16 @@ static void UI_SoundOptionsMenu_Init( void ) { soundOptionsInfo.back.style = UI_LEFT | UI_SMALLFONT; // END + soundOptionsInfo.apply.generic.type = MTYPE_PTEXT; + soundOptionsInfo.apply.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_HIDDEN|QMF_INACTIVE; + soundOptionsInfo.apply.generic.x = 620; + soundOptionsInfo.apply.generic.y = 480 - 50; + soundOptionsInfo.apply.generic.id = ID_APPLY; + soundOptionsInfo.apply.generic.callback = UI_SoundOptionsMenu_Event; + soundOptionsInfo.apply.string = "APPLY"; + soundOptionsInfo.apply.color = text_color_normal; + soundOptionsInfo.apply.style = UI_RIGHT | UI_SMALLFONT; + Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.banner ); // STONELANCE /* @@ -325,13 +447,34 @@ static void UI_SoundOptionsMenu_Init( void ) { Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.network ); Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.sfxvolume ); Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.musicvolume ); + Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.soundSystem ); Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.quality ); // Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.a3d ); Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.back ); + Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.apply ); + + soundOptionsInfo.sfxvolume.curvalue = soundOptionsInfo.sfxvolume_original = trap_Cvar_VariableValue( "s_volume" ) * 10; + soundOptionsInfo.musicvolume.curvalue = soundOptionsInfo.musicvolume_original = trap_Cvar_VariableValue( "s_musicvolume" ) * 10; + + if (trap_Cvar_VariableValue( "s_useOpenAL" )) + soundOptionsInfo.soundSystem_original = UISND_OPENAL; + else + soundOptionsInfo.soundSystem_original = UISND_SDL; + + soundOptionsInfo.soundSystem.curvalue = soundOptionsInfo.soundSystem_original; + + speed = trap_Cvar_VariableValue( "s_sdlSpeed" ); + if (!speed) // Check for default + speed = DEFAULT_SDL_SND_SPEED; + + if (speed <= 11025) + soundOptionsInfo.quality_original = 0; + else if (speed <= 22050) + soundOptionsInfo.quality_original = 1; + else // 44100 + soundOptionsInfo.quality_original = 2; + soundOptionsInfo.quality.curvalue = soundOptionsInfo.quality_original; - soundOptionsInfo.sfxvolume.curvalue = trap_Cvar_VariableValue( "s_volume" ) * 10; - soundOptionsInfo.musicvolume.curvalue = trap_Cvar_VariableValue( "s_musicvolume" ) * 10; - soundOptionsInfo.quality.curvalue = !trap_Cvar_VariableValue( "s_compression" ); // soundOptionsInfo.a3d.curvalue = (int)trap_Cvar_VariableValue( "s_usingA3D" ); } @@ -348,6 +491,8 @@ void UI_SoundOptionsMenu_Cache( void ) { trap_R_RegisterShaderNoMip( ART_FRAMER ); trap_R_RegisterShaderNoMip( ART_BACK0 ); trap_R_RegisterShaderNoMip( ART_BACK1 ); + trap_R_RegisterShaderNoMip( ART_ACCEPT0 ); + trap_R_RegisterShaderNoMip( ART_ACCEPT1 ); */ // END } diff --git a/engine/code/q3_ui/ui_video.c b/engine/code/q3_ui/ui_video.c index c8168942..a8835ec8 100644 --- a/engine/code/q3_ui/ui_video.c +++ b/engine/code/q3_ui/ui_video.c @@ -338,7 +338,6 @@ typedef struct { menulist_s lighting; menulist_s allow_extensions; menulist_s texturebits; - menulist_s colordepth; menulist_s geometry; menulist_s filter; menutext_s driverinfo; @@ -357,7 +356,6 @@ typedef struct qboolean fullscreen; int tq; int lighting; - int colordepth; int texturebits; int geometry; int filter; @@ -371,22 +369,22 @@ static graphicsoptions_t s_graphicsoptions; static InitialVideoOptions_s s_ivo_templates[] = { { - 6, qtrue, 3, 0, 2, 2, 2, 1, 0, qtrue + 6, qtrue, 3, 0, 2, 2, 1, 0, qtrue }, { - 4, qtrue, 2, 0, 2, 2, 1, 1, 0, qtrue // JDC: this was tq 3 + 4, qtrue, 2, 0, 2, 1, 1, 0, qtrue // JDC: this was tq 3 }, { - 3, qtrue, 2, 0, 0, 0, 1, 0, 0, qtrue + 3, qtrue, 2, 0, 0, 1, 0, 0, qtrue }, { - 2, qtrue, 1, 0, 1, 0, 0, 0, 0, qtrue + 2, qtrue, 1, 0, 0, 0, 0, 0, qtrue }, { - 2, qtrue, 1, 1, 1, 0, 0, 0, 0, qtrue + 2, qtrue, 1, 1, 0, 0, 0, 0, qtrue }, { - 3, qtrue, 1, 0, 0, 0, 1, 0, 0, qtrue + 3, qtrue, 1, 0, 0, 1, 0, 0, qtrue } }; @@ -540,7 +538,6 @@ GraphicsOptions_GetInitialVideo */ static void GraphicsOptions_GetInitialVideo( void ) { - s_ivo.colordepth = s_graphicsoptions.colordepth.curvalue; s_ivo.driver = s_graphicsoptions.driver.curvalue; s_ivo.mode = s_graphicsoptions.mode.curvalue; s_ivo.fullscreen = s_graphicsoptions.fs.curvalue; @@ -592,8 +589,6 @@ static void GraphicsOptions_CheckConfig( void ) for ( i = 0; i < NUM_IVO_TEMPLATES-1; i++ ) { - if ( s_ivo_templates[i].colordepth != s_graphicsoptions.colordepth.curvalue ) - continue; if ( s_ivo_templates[i].driver != s_graphicsoptions.driver.curvalue ) continue; if ( GraphicsOptions_FindDetectedResolution(s_ivo_templates[i].mode) != s_graphicsoptions.mode.curvalue ) @@ -629,23 +624,12 @@ static void GraphicsOptions_UpdateMenuItems( void ) { s_graphicsoptions.fs.curvalue = 1; s_graphicsoptions.fs.generic.flags |= QMF_GRAYED; - s_graphicsoptions.colordepth.curvalue = 1; } else { s_graphicsoptions.fs.generic.flags &= ~QMF_GRAYED; } - if ( s_graphicsoptions.fs.curvalue == 0 || s_graphicsoptions.driver.curvalue == 1 ) - { - s_graphicsoptions.colordepth.curvalue = 0; - s_graphicsoptions.colordepth.generic.flags |= QMF_GRAYED; - } - else - { - s_graphicsoptions.colordepth.generic.flags &= ~QMF_GRAYED; - } - if ( s_graphicsoptions.allow_extensions.curvalue == 0 ) { if ( s_graphicsoptions.texturebits.curvalue == 0 ) @@ -676,10 +660,6 @@ static void GraphicsOptions_UpdateMenuItems( void ) { s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); } - if ( s_ivo.colordepth != s_graphicsoptions.colordepth.curvalue ) - { - s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); - } if ( s_ivo.driver != s_graphicsoptions.driver.curvalue ) { s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); @@ -825,7 +805,6 @@ static void GraphicsOptions_Event( void* ptr, int event ) { resToRatio[ s_graphicsoptions.mode.curvalue ]; s_graphicsoptions.tq.curvalue = ivo->tq; s_graphicsoptions.lighting.curvalue = ivo->lighting; - s_graphicsoptions.colordepth.curvalue = ivo->colordepth; s_graphicsoptions.texturebits.curvalue = ivo->texturebits; s_graphicsoptions.geometry.curvalue = ivo->geometry; s_graphicsoptions.filter.curvalue = ivo->filter; @@ -977,29 +956,6 @@ static void GraphicsOptions_SetMenuItems( void ) { s_graphicsoptions.geometry.curvalue = 2; } - - switch ( ( int ) trap_Cvar_VariableValue( "r_colorbits" ) ) - { - default: - case 0: - s_graphicsoptions.colordepth.curvalue = 0; - break; - case 16: - s_graphicsoptions.colordepth.curvalue = 1; - break; - case 32: - s_graphicsoptions.colordepth.curvalue = 2; - break; - } - - if ( s_graphicsoptions.fs.curvalue == 0 ) - { - s_graphicsoptions.colordepth.curvalue = 0; - } - if ( s_graphicsoptions.driver.curvalue == 1 ) - { - s_graphicsoptions.colordepth.curvalue = 1; - } } /* @@ -1042,14 +998,6 @@ void GraphicsOptions_MenuInit( void ) NULL }; - static const char *colordepth_names[] = - { - "Default", - "16 bit", - "32 bit", - NULL - }; - static const char *filter_names[] = { "Bilinear", @@ -1213,15 +1161,6 @@ void GraphicsOptions_MenuInit( void ) s_graphicsoptions.mode.generic.id = ID_MODE; y += BIGCHAR_HEIGHT+2; - // references "r_colorbits" - s_graphicsoptions.colordepth.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.colordepth.generic.name = "Color Depth:"; - s_graphicsoptions.colordepth.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; - s_graphicsoptions.colordepth.generic.x = 400; - s_graphicsoptions.colordepth.generic.y = y; - s_graphicsoptions.colordepth.itemnames = colordepth_names; - y += BIGCHAR_HEIGHT+2; - // references/modifies "r_fullscreen" s_graphicsoptions.fs.generic.type = MTYPE_SPINCONTROL; s_graphicsoptions.fs.generic.name = "Fullscreen:"; @@ -1353,7 +1292,6 @@ void GraphicsOptions_MenuInit( void ) Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.allow_extensions ); Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.ratio ); Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.mode ); - Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.colordepth ); Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.fs ); Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.lighting ); Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.geometry ); diff --git a/engine/code/qcommon/common.c b/engine/code/qcommon/common.c index c2fddcbd..59050450 100644 --- a/engine/code/qcommon/common.c +++ b/engine/code/qcommon/common.c @@ -967,12 +967,16 @@ void *Z_TagMalloc( int size, int tag ) { do { if (rover == start) { + // scaned all the way around the list #ifdef ZONE_DEBUG Z_LogHeap(); -#endif - // scaned all the way around the list - Com_Error( ERR_FATAL, "Z_Malloc: failed on allocation of %i bytes from the %s zone", + + Com_Error(ERR_FATAL, "Z_Malloc: failed on allocation of %i bytes from the %s zone: %s, line: %d (%s)", + size, zone == smallzone ? "small" : "main", file, line, label); +#else + Com_Error(ERR_FATAL, "Z_Malloc: failed on allocation of %i bytes from the %s zone", size, zone == smallzone ? "small" : "main"); +#endif return NULL; } if (rover->tag) { @@ -1725,8 +1729,11 @@ void *Hunk_Alloc( int size, ha_pref preference ) { #ifdef HUNK_DEBUG Hunk_Log(); Hunk_SmallLog(); + + Com_Error(ERR_DROP, "Hunk_Alloc failed on %i: %s, line: %d (%s)", size, file, line, label); +#else + Com_Error(ERR_DROP, "Hunk_Alloc failed on %i", size); #endif - Com_Error( ERR_DROP, "Hunk_Alloc failed on %i", size ); } if ( hunk_permanent == &hunk_low ) { @@ -1870,46 +1877,6 @@ void Hunk_ClearTempMemory( void ) { } } -/* -================= -Hunk_Trash -================= -*/ -void Hunk_Trash( void ) { - int length, i, rnd; - char *buf, value; - - return; - - if ( s_hunkData == NULL ) - return; - -#ifdef _DEBUG - Com_Error(ERR_DROP, "hunk trashed"); - return; -#endif - - Cvar_Set("com_jp", "1"); - Hunk_SwapBanks(); - - if ( hunk_permanent == &hunk_low ) { - buf = (void *)(s_hunkData + hunk_permanent->permanent); - } else { - buf = (void *)(s_hunkData + s_hunkTotal - hunk_permanent->permanent ); - } - length = hunk_permanent->permanent; - - if (length > 0x7FFFF) { - //randomly trash data within buf - rnd = random() * (length - 0x7FFFF); - value = 31; - for (i = 0; i < 0x7FFFF; i++) { - value *= 109; - buf[rnd+i] ^= value; - } - } -} - /* =================================================================== @@ -2330,7 +2297,7 @@ A way to force a bus error for development reasons ================= */ static void Com_Crash_f( void ) { - * ( int * ) 0 = 0x12345678; + * ( volatile int * ) 0 = 0x12345678; } /* diff --git a/engine/code/qcommon/cvar.c b/engine/code/qcommon/cvar.c index 6a090d68..9321e9c7 100644 --- a/engine/code/qcommon/cvar.c +++ b/engine/code/qcommon/cvar.c @@ -168,10 +168,15 @@ int Cvar_Flags(const char *var_name) { cvar_t *var; - if(! (var = Cvar_FindVar(var_name)) ) + if(!(var = Cvar_FindVar(var_name))) return CVAR_NONEXISTENT; else - return var->flags; + { + if(var->modified) + return var->flags | CVAR_MODIFIED; + else + return var->flags; + } } /* diff --git a/engine/code/qcommon/files.c b/engine/code/qcommon/files.c index 917a7fa8..94193b8f 100644 --- a/engine/code/qcommon/files.c +++ b/engine/code/qcommon/files.c @@ -1120,7 +1120,7 @@ Returns filesize and an open FILE pointer. */ extern qboolean com_fullyInitialized; -long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_t *file, qboolean uniqueFILE) +long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_t *file, qboolean uniqueFILE, qboolean unpure) { long hash; pack_t *pak; @@ -1229,7 +1229,7 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_ if(search->pack->hashTable[hash]) { // disregard if it doesn't match one of the allowed pure pak files - if(!FS_PakIsPure(search->pack)) + if(!unpure && !FS_PakIsPure(search->pack)) { *file = 0; return -1; @@ -1320,12 +1320,12 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_ // this test can make the search fail although the file is in the directory // I had the problem on https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=8 // turned out I used FS_FileExists instead - if(fs_numServerPaks) + if(!unpure && fs_numServerPaks) { if(!FS_IsExt(filename, ".cfg", len) && // for config files !FS_IsExt(filename, ".menu", len) && // menu files !FS_IsExt(filename, ".game", len) && // menu files - !FS_IsExt(filename, ".cfg", len) && // for journal files + !FS_IsExt(filename, ".dat", len) && // for journal files !FS_IsDemoExt(filename, len)) // demos { *file = 0; @@ -1380,7 +1380,7 @@ long FS_FOpenFileRead(const char *filename, fileHandle_t *file, qboolean uniqueF for(search = fs_searchpaths; search; search = search->next) { - len = FS_FOpenFileReadDir(filename, search, file, uniqueFILE); + len = FS_FOpenFileReadDir(filename, search, file, uniqueFILE, qfalse); if(file == NULL) { @@ -1437,7 +1437,7 @@ vmInterpret_t FS_FindVM(void **startSearch, char *found, int foundlen, const cha if(enableDll) Com_sprintf(dllName, sizeof(dllName), "%s" ARCH_STRING DLL_EXT, name); - Com_sprintf(qvmName, sizeof(dllName), "vm/%s.qvm", name); + Com_sprintf(qvmName, sizeof(qvmName), "vm/%s.qvm", name); lastSearch = *startSearch; if(*startSearch == NULL) @@ -1464,7 +1464,7 @@ vmInterpret_t FS_FindVM(void **startSearch, char *found, int foundlen, const cha } } - if(FS_FOpenFileReadDir(qvmName, search, NULL, qfalse) > 0) + if(FS_FOpenFileReadDir(qvmName, search, NULL, qfalse, qfalse) > 0) { *startSearch = search; return VMI_COMPILED; @@ -1486,7 +1486,7 @@ vmInterpret_t FS_FindVM(void **startSearch, char *found, int foundlen, const cha } } - if(FS_FOpenFileReadDir(qvmName, search, NULL, qfalse) > 0) + if(FS_FOpenFileReadDir(qvmName, search, NULL, qfalse, qfalse) > 0) { *startSearch = search; @@ -1791,7 +1791,7 @@ a null buffer will just return the file length without loading If searchPath is non-NULL search only in that specific search path ============ */ -long FS_ReadFileDir(const char *qpath, void *searchPath, void **buffer) +long FS_ReadFileDir(const char *qpath, void *searchPath, qboolean unpure, void **buffer) { fileHandle_t h; searchpath_t *search; @@ -1864,7 +1864,7 @@ long FS_ReadFileDir(const char *qpath, void *searchPath, void **buffer) else { // look for it in a specific search path only - len = FS_FOpenFileReadDir(qpath, search, &h, qfalse); + len = FS_FOpenFileReadDir(qpath, search, &h, qfalse, unpure); } if ( h == 0 ) { @@ -1923,7 +1923,7 @@ a null buffer will just return the file length without loading */ long FS_ReadFile(const char *qpath, void **buffer) { - return FS_ReadFileDir(qpath, NULL, buffer); + return FS_ReadFileDir(qpath, NULL, qfalse, buffer); } /* @@ -2748,7 +2748,7 @@ void FS_Path_f( void ) { } } } else { - Com_Printf ("%s/%s\n", s->dir->path, s->dir->gamedir ); + Com_Printf ("%s%c%s\n", s->dir->path, PATH_SEP, s->dir->gamedir ); } } @@ -2790,7 +2790,7 @@ qboolean FS_Which(const char *filename, void *searchPath) { searchpath_t *search = searchPath; - if(FS_FOpenFileReadDir(filename, search, NULL, qfalse) > 0) + if(FS_FOpenFileReadDir(filename, search, NULL, qfalse, qfalse) > 0) { if(search->pack) { @@ -4049,13 +4049,13 @@ void FS_Restart( int checksumFeed ) { /* ================= FS_ConditionalRestart -restart if necessary + +Restart if necessary +Return qtrue if restarting due to game directory changed, qfalse otherwise ================= */ qboolean FS_ConditionalRestart(int checksumFeed, qboolean disconnect) { - int retval; - if(fs_gamedirvar->modified) { if(FS_FilenameCompare(lastValidGame, fs_gamedirvar->string) && @@ -4066,13 +4066,8 @@ qboolean FS_ConditionalRestart(int checksumFeed, qboolean disconnect) return qtrue; } else - { fs_gamedirvar->modified = qfalse; - retval = qtrue; - } } - else - retval = qfalse; if(checksumFeed != fs_checksumFeed) FS_Restart(checksumFeed); diff --git a/engine/code/qcommon/msg.c b/engine/code/qcommon/msg.c index 77666c6e..1d06ecf6 100644 --- a/engine/code/qcommon/msg.c +++ b/engine/code/qcommon/msg.c @@ -1190,7 +1190,7 @@ netField_t playerStateFields[] = { PSF(grapplePoint[0]), 0 }, { PSF(grapplePoint[1]), 0 }, { PSF(grapplePoint[2]), 0 }, -{ PSF(jumppad_ent), 10 }, +{ PSF(jumppad_ent), GENTITYNUM_BITS }, { PSF(loopSound), 16 } }; diff --git a/engine/code/qcommon/net_ip.c b/engine/code/qcommon/net_ip.c index 96bed147..4a0960bb 100644 --- a/engine/code/qcommon/net_ip.c +++ b/engine/code/qcommon/net_ip.c @@ -520,20 +520,12 @@ NET_GetPacket Receive one packet ================== */ -#ifdef _DEBUG -int recvfromCount; -#endif - qboolean NET_GetPacket(netadr_t *net_from, msg_t *net_message, fd_set *fdr) { int ret; struct sockaddr_storage from; socklen_t fromlen; int err; - -#ifdef _DEBUG - recvfromCount++; // performance check -#endif if(ip_socket != INVALID_SOCKET && FD_ISSET(ip_socket, fdr)) { @@ -1709,6 +1701,7 @@ void NET_Sleep(int msec) NET_Restart_f ==================== */ -void NET_Restart_f( void ) { - NET_Config( networkingEnabled ); +void NET_Restart_f(void) +{ + NET_Config(qtrue); } diff --git a/engine/code/qcommon/q_platform.h b/engine/code/qcommon/q_platform.h index 8bc2984c..f2baf1c7 100644 --- a/engine/code/qcommon/q_platform.h +++ b/engine/code/qcommon/q_platform.h @@ -179,7 +179,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define OS_STRING "kFreeBSD" #endif +#ifdef __clang__ +#define ID_INLINE static inline +#else #define ID_INLINE inline +#endif + #define PATH_SEP '/' #if defined __i386__ diff --git a/engine/code/qcommon/q_shared.c b/engine/code/qcommon/q_shared.c index 594f3d94..58e2a46d 100644 --- a/engine/code/qcommon/q_shared.c +++ b/engine/code/qcommon/q_shared.c @@ -896,11 +896,12 @@ int Q_isalpha( int c ) qboolean Q_isanumber( const char *s ) { char *p; + double UNUSED_VAR d; if( *s == '\0' ) return qfalse; - strtod( s, &p ); + d = strtod( s, &p ); return *p == '\0'; } diff --git a/engine/code/qcommon/q_shared.h b/engine/code/qcommon/q_shared.h index 53364919..164ca33a 100644 --- a/engine/code/qcommon/q_shared.h +++ b/engine/code/qcommon/q_shared.h @@ -98,6 +98,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #endif #endif +#ifdef __GNUC__ +#define UNUSED_VAR __attribute__((unused)) +#else +#define UNUSED_VAR +#endif + #if (defined _MSC_VER) #define Q_EXPORT __declspec(dllexport) #elif (defined __SUNPRO_C) @@ -320,7 +326,7 @@ typedef enum { #define UI_INVERSE 0x00002000 #define UI_PULSE 0x00004000 -#if defined(_DEBUG) && !defined(BSPC) +#if !defined(NDEBUG) && !defined(BSPC) #define HUNK_DEBUG #endif @@ -977,7 +983,9 @@ default values. #define CVAR_SERVER_CREATED 0x0800 // cvar was created by a server the client connected to. #define CVAR_VM_CREATED 0x1000 // cvar was created exclusively in one of the VMs. #define CVAR_PROTECTED 0x2000 // prevent modifying this var from VMs or the server -#define CVAR_NONEXISTENT 0xFFFFFFFF // Cvar doesn't exist. +// These flags are only returned by the Cvar_Flags() function +#define CVAR_MODIFIED 0x40000000 // Cvar was modified +#define CVAR_NONEXISTENT 0x80000000 // Cvar doesn't exist. // nothing outside the Cvar_*() functions should modify these fields! typedef struct cvar_s cvar_t; diff --git a/engine/code/qcommon/qcommon.h b/engine/code/qcommon/qcommon.h index 01732ffc..afc8ae24 100644 --- a/engine/code/qcommon/qcommon.h +++ b/engine/code/qcommon/qcommon.h @@ -260,7 +260,9 @@ PROTOCOL // NOTE: that stuff only works with two digits protocols extern int demo_protocols[]; -#define UPDATE_SERVER_NAME "dl.q3rally.com" +#if !defined UPDATE_SERVER_NAME && !defined STANDALONE +#define UPDATE_SERVER_NAME "update.quake3arena.com" +#endif // override on command line, config files etc. #ifndef MASTER_SERVER_NAME #define MASTER_SERVER_NAME "master.q3rally.com" @@ -361,7 +363,7 @@ void VM_Free( vm_t *vm ); void VM_Clear(void); void VM_Forced_Unload_Start(void); void VM_Forced_Unload_Done(void); -vm_t *VM_Restart( vm_t *vm ); +vm_t *VM_Restart(vm_t *vm, qboolean unpure); intptr_t QDECL VM_Call( vm_t *vm, int callNum, ... ); @@ -661,7 +663,7 @@ int FS_Read( void *buffer, int len, fileHandle_t f ); void FS_FCloseFile( fileHandle_t f ); // note: you can't just fclose from another DLL, due to MS libc issues -long FS_ReadFileDir(const char *qpath, void *searchPath, void **buffer); +long FS_ReadFileDir(const char *qpath, void *searchPath, qboolean unpure, void **buffer); long FS_ReadFile(const char *qpath, void **buffer); // returns the length of the file // a null buffer will just return the file length without loading @@ -919,7 +921,7 @@ temp file loading */ -#if defined(_DEBUG) && !defined(BSPC) +#if !defined(NDEBUG) && !defined(BSPC) #define ZONE_DEBUG #endif @@ -949,7 +951,6 @@ void *Hunk_AllocateTempMemory( int size ); void Hunk_FreeTempMemory( void *buf ); int Hunk_MemoryRemaining( void ); void Hunk_Log( void); -void Hunk_Trash( void ); void Com_TouchMemory( void ); diff --git a/engine/code/qcommon/unzip.c b/engine/code/qcommon/unzip.c index b307e98d..128502ce 100644 --- a/engine/code/qcommon/unzip.c +++ b/engine/code/qcommon/unzip.c @@ -1250,7 +1250,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len) return UNZ_PARAMERROR; - if ((pfile_in_zip_read_info->read_buffer == NULL)) + if (pfile_in_zip_read_info->read_buffer == NULL) return UNZ_END_OF_LIST_OF_FILE; if (len==0) return 0; diff --git a/engine/code/qcommon/vm.c b/engine/code/qcommon/vm.c index c500aea6..13e41b03 100644 --- a/engine/code/qcommon/vm.c +++ b/engine/code/qcommon/vm.c @@ -363,7 +363,8 @@ VM_LoadQVM Load a .qvm file ================= */ -vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc ) { +vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc, qboolean unpure) +{ int dataLength; int i; char filename[MAX_QPATH]; @@ -376,7 +377,7 @@ vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc ) { Com_sprintf( filename, sizeof(filename), "vm/%s.qvm", vm->name ); Com_Printf( "Loading vm file %s...\n", filename ); - FS_ReadFileDir(filename, vm->searchPath, &header.v); + FS_ReadFileDir(filename, vm->searchPath, unpure, &header.v); if ( !header.h ) { Com_Printf( "Failed.\n" ); @@ -447,13 +448,26 @@ vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc ) { } dataLength = 1 << i; - if( alloc ) { + if(alloc) + { // allocate zero filled space for initialized and uninitialized data - vm->dataBase = Hunk_Alloc( dataLength, h_high ); + vm->dataBase = Hunk_Alloc(dataLength, h_high); vm->dataMask = dataLength - 1; - } else { - // clear the data - Com_Memset( vm->dataBase, 0, dataLength ); + } + else + { + // clear the data, but make sure we're not clearing more than allocated + if(vm->dataMask + 1 != dataLength) + { + VM_Free(vm); + FS_FreeFile(header.v); + + Com_Printf(S_COLOR_YELLOW "Warning: Data region size of %s not matching after " + "VM_Restart()\n", filename); + return NULL; + } + + Com_Memset(vm->dataBase, 0, dataLength); } // copy the intialized data @@ -465,18 +479,36 @@ vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc ) { *(int *)(vm->dataBase + i) = LittleLong( *(int *)(vm->dataBase + i ) ); } - if( header.h->vmMagic == VM_MAGIC_VER2 ) { - vm->numJumpTableTargets = header.h->jtrgLength >> 2; - Com_Printf( "Loading %d jump table targets\n", vm->numJumpTableTargets ); + if(header.h->vmMagic == VM_MAGIC_VER2) + { + int previousNumJumpTableTargets = vm->numJumpTableTargets; - if( alloc ) { - vm->jumpTableTargets = Hunk_Alloc( header.h->jtrgLength, h_high ); - } else { - Com_Memset( vm->jumpTableTargets, 0, header.h->jtrgLength ); + header.h->jtrgLength &= ~0x03; + + vm->numJumpTableTargets = header.h->jtrgLength >> 2; + Com_Printf("Loading %d jump table targets\n", vm->numJumpTableTargets); + + if(alloc) + { + vm->jumpTableTargets = Hunk_Alloc(header.h->jtrgLength, h_high); + } + else + { + if(vm->numJumpTableTargets != previousNumJumpTableTargets) + { + VM_Free(vm); + FS_FreeFile(header.v); + + Com_Printf(S_COLOR_YELLOW "Warning: Jump table size of %s not matching after " + "VM_Restart()\n", filename); + return NULL; + } + + Com_Memset(vm->jumpTableTargets, 0, header.h->jtrgLength); } - Com_Memcpy( vm->jumpTableTargets, (byte *)header.h + header.h->dataOffset + - header.h->dataLength + header.h->litLength, header.h->jtrgLength ); + Com_Memcpy(vm->jumpTableTargets, (byte *) header.h + header.h->dataOffset + + header.h->dataLength + header.h->litLength, header.h->jtrgLength); // byte swap the longs for ( i = 0 ; i < header.h->jtrgLength ; i += 4 ) { @@ -493,9 +525,13 @@ VM_Restart Reload the data, but leave everything else in place This allows a server to do a map_restart without changing memory allocation + +We need to make sure that servers can access unpure QVMs (not contained in any pak) +even if the client is pure, so take "unpure" as argument. ================= */ -vm_t *VM_Restart( vm_t *vm ) { +vm_t *VM_Restart(vm_t *vm, qboolean unpure) +{ vmHeader_t *header; // DLL's can't be restarted in place @@ -513,15 +549,16 @@ vm_t *VM_Restart( vm_t *vm ) { } // load the image - Com_Printf( "VM_Restart()\n" ); + Com_Printf("VM_Restart()\n"); - if( !( header = VM_LoadQVM( vm, qfalse ) ) ) { - Com_Error( ERR_DROP, "VM_Restart failed" ); + if(!(header = VM_LoadQVM(vm, qfalse, unpure))) + { + Com_Error(ERR_DROP, "VM_Restart failed"); return NULL; } // free the original file - FS_FreeFile( header ); + FS_FreeFile(header); return vm; } @@ -592,7 +629,7 @@ vm_t *VM_Create( const char *module, intptr_t (*systemCalls)(intptr_t *), else if(retval == VMI_COMPILED) { vm->searchPath = startSearch; - if((header = VM_LoadQVM(vm, qtrue))) + if((header = VM_LoadQVM(vm, qtrue, qfalse))) break; // VM_Free overwrites the name on failed load @@ -765,14 +802,14 @@ locals from sp ============== */ -intptr_t QDECL VM_Call( vm_t *vm, int callnum, ... ) { +intptr_t QDECL VM_Call( vm_t *vm, int callnum, ... ) +{ vm_t *oldVM; intptr_t r; int i; - if ( !vm ) { - Com_Error( ERR_FATAL, "VM_Call with NULL vm" ); - } + if(!vm || !vm->name[0]) + Com_Error(ERR_FATAL, "VM_Call with NULL vm"); oldVM = currentVM; currentVM = vm; diff --git a/engine/code/qcommon/vm_x86.c b/engine/code/qcommon/vm_x86.c index a303a335..d19763e6 100644 --- a/engine/code/qcommon/vm_x86.c +++ b/engine/code/qcommon/vm_x86.c @@ -24,21 +24,22 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "vm_local.h" #ifdef _WIN32 -#include -#endif + #include +#else + #ifdef __FreeBSD__ + #include + #endif -#ifdef __FreeBSD__ -#include -#endif + #include // for PROT_ stuff -#ifndef _WIN32 -#include // for PROT_ stuff -#endif - -/* need this on NX enabled systems (i386 with PAE kernel or - * noexec32=on x86_64) */ -#if defined(__linux__) || defined(__FreeBSD__) -#define VM_X86_MMAP + /* need this on NX enabled systems (i386 with PAE kernel or + * noexec32=on x86_64) */ + #define VM_X86_MMAP + + // workaround for systems that use the old MAP_ANON macro + #ifndef MAP_ANONYMOUS + #define MAP_ANONYMOUS MAP_ANON + #endif #endif static void VM_Destroy_Compiled(vm_t* self); @@ -442,7 +443,7 @@ static void DoSyscall(void) int *data; #if idx64 int index; - intptr_t args[11]; + intptr_t args[16]; #endif data = (int *) (savedVM->dataBase + programStack + 4); diff --git a/engine/code/qcommon/vm_x86_64.c b/engine/code/qcommon/vm_x86_64.c index 810bdc6f..c1400795 100644 --- a/engine/code/qcommon/vm_x86_64.c +++ b/engine/code/qcommon/vm_x86_64.c @@ -86,8 +86,8 @@ static intptr_t CROSSCALL callAsmCall(intptr_t callProgramStack, int64_t callSys { vm_t *savedVM; intptr_t ret = 0x77; - intptr_t args[11]; -// int iargs[11]; + intptr_t args[16]; +// int iargs[16]; int i; // Dfprintf(stderr, "callAsmCall(%ld, %ld)\n", callProgramStack, callSyscallNum); @@ -100,7 +100,7 @@ static intptr_t CROSSCALL callAsmCall(intptr_t callProgramStack, int64_t callSys args[0] = callSyscallNum; // iargs[0] = callSyscallNum; - for(i = 0; i < 10; ++i) + for(i = 0; i < ARRAY_LEN(args)-1; ++i) { // iargs[i+1] = *(int *)((byte *)currentVM->dataBase + callProgramStack + 8 + 4*i); args[i+1] = *(int *)((byte *)currentVM->dataBase + callProgramStack + 8 + 4*i); diff --git a/engine/code/renderer/tr_bsp.c b/engine/code/renderer/tr_bsp.c index d4168bed..17afd7ec 100644 --- a/engine/code/renderer/tr_bsp.c +++ b/engine/code/renderer/tr_bsp.c @@ -272,11 +272,11 @@ static shader_t *ShaderForShaderNum( int shaderNum, int lightmapNum ) { shader_t *shader; dshader_t *dsh; - shaderNum = LittleLong( shaderNum ); - if ( shaderNum < 0 || shaderNum >= s_worldData.numShaders ) { - ri.Error( ERR_DROP, "ShaderForShaderNum: bad num %i", shaderNum ); + int _shaderNum = LittleLong( shaderNum ); + if ( _shaderNum < 0 || _shaderNum >= s_worldData.numShaders ) { + ri.Error( ERR_DROP, "ShaderForShaderNum: bad num %i", _shaderNum ); } - dsh = &s_worldData.shaders[ shaderNum ]; + dsh = &s_worldData.shaders[ _shaderNum ]; if ( r_vertexLight->integer || glConfig.hardwareType == GLHW_PERMEDIA2 ) { lightmapNum = LIGHTMAP_BY_VERTEX; diff --git a/engine/code/renderer/tr_cmds.c b/engine/code/renderer/tr_cmds.c index abcbe07b..fe3fd133 100644 --- a/engine/code/renderer/tr_cmds.c +++ b/engine/code/renderer/tr_cmds.c @@ -297,7 +297,8 @@ void RE_StretchPic ( float x, float y, float w, float h, #define MODE_RED_CYAN 1 #define MODE_RED_BLUE 2 #define MODE_RED_GREEN 3 -#define MODE_MAX MODE_RED_GREEN +#define MODE_GREEN_MAGENTA 4 +#define MODE_MAX MODE_GREEN_MAGENTA void R_SetColorMode(GLboolean *rgba, stereoFrame_t stereoFrame, int colormode) { @@ -313,16 +314,26 @@ void R_SetColorMode(GLboolean *rgba, stereoFrame_t stereoFrame, int colormode) colormode -= MODE_MAX; } - if(stereoFrame == STEREO_LEFT) - rgba[1] = rgba[2] = GL_FALSE; - else if(stereoFrame == STEREO_RIGHT) + if(colormode == MODE_GREEN_MAGENTA) { - rgba[0] = GL_FALSE; - - if(colormode == MODE_RED_BLUE) + if(stereoFrame == STEREO_LEFT) + rgba[0] = rgba[2] = GL_FALSE; + else if(stereoFrame == STEREO_RIGHT) rgba[1] = GL_FALSE; - else if(colormode == MODE_RED_GREEN) - rgba[2] = GL_FALSE; + } + else + { + if(stereoFrame == STEREO_LEFT) + rgba[1] = rgba[2] = GL_FALSE; + else if(stereoFrame == STEREO_RIGHT) + { + rgba[0] = GL_FALSE; + + if(colormode == MODE_RED_BLUE) + rgba[1] = GL_FALSE; + else if(colormode == MODE_RED_GREEN) + rgba[2] = GL_FALSE; + } } } diff --git a/engine/code/renderer/tr_local.h b/engine/code/renderer/tr_local.h index 3ecde445..58c3e2af 100644 --- a/engine/code/renderer/tr_local.h +++ b/engine/code/renderer/tr_local.h @@ -836,7 +836,7 @@ the bits are allocated as follows: */ #define QSORT_FOGNUM_SHIFT 2 #define QSORT_ENTITYNUM_SHIFT 7 -#define QSORT_SHADERNUM_SHIFT (QSORT_ENTITYNUM_SHIFT+GENTITYNUM_BITS) +#define QSORT_SHADERNUM_SHIFT (QSORT_ENTITYNUM_SHIFT+ENTITYNUM_BITS) #if (QSORT_SHADERNUM_SHIFT+SHADERNUM_BITS) > 32 #error "Need to update sorting, too many bits." #endif diff --git a/engine/code/renderer/tr_main.c b/engine/code/renderer/tr_main.c index b6c83aed..e6ab2533 100644 --- a/engine/code/renderer/tr_main.c +++ b/engine/code/renderer/tr_main.c @@ -1127,7 +1127,7 @@ void R_DecomposeSort( unsigned sort, int *entityNum, shader_t **shader, int *fogNum, int *dlightMap ) { *fogNum = ( sort >> QSORT_FOGNUM_SHIFT ) & 31; *shader = tr.sortedShaders[ ( sort >> QSORT_SHADERNUM_SHIFT ) & (MAX_SHADERS-1) ]; - *entityNum = ( sort >> QSORT_ENTITYNUM_SHIFT ) & (MAX_GENTITIES-1); + *entityNum = ( sort >> QSORT_ENTITYNUM_SHIFT ) & MAX_ENTITIES; *dlightMap = sort & 3; } diff --git a/engine/code/renderer/tr_model_iqm.c b/engine/code/renderer/tr_model_iqm.c index a9144f44..98517d55 100644 --- a/engine/code/renderer/tr_model_iqm.c +++ b/engine/code/renderer/tr_model_iqm.c @@ -92,30 +92,26 @@ static void JointToMatrix( vec4_t rot, vec3_t scale, vec3_t trans, mat[10] = scale[2] * (1.0f - (xx + yy)); mat[11] = trans[2]; } -static void JointToMatrixInverse( vec4_t rot, vec3_t scale, vec3_t trans, - float *mat ) { - float xx = 2.0f * rot[0] * rot[0]; - float yy = 2.0f * rot[1] * rot[1]; - float zz = 2.0f * rot[2] * rot[2]; - float xy = 2.0f * rot[0] * rot[1]; - float xz = 2.0f * rot[0] * rot[2]; - float yz = 2.0f * rot[1] * rot[2]; - float wx = 2.0f * rot[3] * rot[0]; - float wy = 2.0f * rot[3] * rot[1]; - float wz = 2.0f * rot[3] * rot[2]; +static void Matrix34Invert( float *inMat, float *outMat ) +{ + vec3_t trans; + float invSqrLen, *v; - mat[ 0] = scale[0] * (1.0f - (yy + zz)); - mat[ 1] = scale[0] * (xy + wz); - mat[ 2] = scale[2] * (xz - wy); - mat[ 3] = -DotProduct((mat + 0), trans); - mat[ 4] = scale[0] * (xy - wz); - mat[ 5] = scale[1] * (1.0f - (xx + zz)); - mat[ 6] = scale[2] * (yz + wx); - mat[ 7] = -DotProduct((mat + 4), trans); - mat[ 8] = scale[0] * (xz + wy); - mat[ 9] = scale[1] * (yz - wx); - mat[10] = scale[2] * (1.0f - (xx + yy)); - mat[11] = -DotProduct((mat + 8), trans); + outMat[ 0] = inMat[ 0]; outMat[ 1] = inMat[ 4]; outMat[ 2] = inMat[ 8]; + outMat[ 4] = inMat[ 1]; outMat[ 5] = inMat[ 5]; outMat[ 6] = inMat[ 9]; + outMat[ 8] = inMat[ 2]; outMat[ 9] = inMat[ 6]; outMat[10] = inMat[10]; + + v = outMat + 0; invSqrLen = 1.0f / DotProduct(v, v); VectorScale(v, invSqrLen, v); + v = outMat + 4; invSqrLen = 1.0f / DotProduct(v, v); VectorScale(v, invSqrLen, v); + v = outMat + 8; invSqrLen = 1.0f / DotProduct(v, v); VectorScale(v, invSqrLen, v); + + trans[0] = inMat[ 3]; + trans[1] = inMat[ 7]; + trans[2] = inMat[11]; + + outMat[ 3] = -DotProduct(outMat + 0, trans); + outMat[ 7] = -DotProduct(outMat + 4, trans); + outMat[11] = -DotProduct(outMat + 8, trans); } /* @@ -288,9 +284,9 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na LL( triangle->vertex[1] ); LL( triangle->vertex[2] ); - if( triangle->vertex[0] < 0 || triangle->vertex[0] > header->num_vertexes || - triangle->vertex[1] < 0 || triangle->vertex[1] > header->num_vertexes || - triangle->vertex[2] < 0 || triangle->vertex[2] > header->num_vertexes ) { + if( triangle->vertex[0] > header->num_vertexes || + triangle->vertex[1] > header->num_vertexes || + triangle->vertex[2] > header->num_vertexes ) { return qfalse; } } @@ -327,9 +323,7 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na mesh->first_vertex + mesh->num_vertexes > header->num_vertexes || mesh->first_triangle >= header->num_triangles || mesh->first_triangle + mesh->num_triangles > header->num_triangles || - mesh->name < 0 || mesh->name >= header->num_text || - mesh->material < 0 || mesh->material >= header->num_text ) { return qfalse; } @@ -358,7 +352,6 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na if( joint->parent < -1 || joint->parent >= (int)header->num_joints || - joint->name < 0 || joint->name >= (int)header->num_text ) { return qfalse; } @@ -473,36 +466,25 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na mat = jointMats; joint = (iqmJoint_t *)((byte *)header + header->ofs_joints); for( i = 0; i < header->num_joints; i++, joint++ ) { - float tmpMat[12]; + float baseFrame[12], invBaseFrame[12]; - JointToMatrix( joint->rotate, joint->scale, joint->translate, - tmpMat ); + JointToMatrix( joint->rotate, joint->scale, joint->translate, baseFrame ); + Matrix34Invert( baseFrame, invBaseFrame ); - if( joint->parent >= 0 ) { - // premultiply with parent-matrix - Matrix34Multiply( jointMats + 2 * 12 * joint->parent, - tmpMat, mat); - } else { - Com_Memcpy( mat, tmpMat, sizeof(tmpMat) ); + if ( joint->parent >= 0 ) + { + Matrix34Multiply( jointMats + 2 * 12 * joint->parent, baseFrame, mat ); + mat += 12; + Matrix34Multiply( invBaseFrame, jointMats + 2 * 12 * joint->parent + 12, mat ); + mat += 12; } - - mat += 12; - - // compute the inverse matrix by combining the - // inverse scale, rotation and translation - JointToMatrixInverse( joint->rotate, joint->scale, - joint->translate, tmpMat ); - - if( joint->parent >= 0 ) { - // premultiply with inverse parent-matrix - Matrix34Multiply( tmpMat, - jointMats + 2 * 12 * joint->parent + 12, - mat); - } else { - Com_Memcpy( mat, tmpMat, sizeof(tmpMat) ); + else + { + Com_Memcpy( mat, baseFrame, sizeof(baseFrame) ); + mat += 12; + Com_Memcpy( mat, invBaseFrame, sizeof(invBaseFrame) ); + mat += 12; } - - mat += 12; } // calculate pose matrices diff --git a/engine/code/renderer/tr_scene.c b/engine/code/renderer/tr_scene.c index 34e4141d..d1d34e3c 100644 --- a/engine/code/renderer/tr_scene.c +++ b/engine/code/renderer/tr_scene.c @@ -209,6 +209,7 @@ void RE_AddRefEntityToScene( const refEntity_t *ent ) { return; } if ( r_numentities >= MAX_ENTITIES ) { + ri.Printf(PRINT_DEVELOPER, "RE_AddRefEntityToScene: Dropping refEntity, reached MAX_ENTITIES\n"); return; } if ( Q_isnan(ent->origin[0]) || Q_isnan(ent->origin[1]) || Q_isnan(ent->origin[2]) ) { @@ -219,7 +220,7 @@ void RE_AddRefEntityToScene( const refEntity_t *ent ) { } return; } - if ( ent->reType < 0 || ent->reType >= RT_MAX_REF_ENTITY_TYPE ) { + if ( (int)ent->reType < 0 || ent->reType >= RT_MAX_REF_ENTITY_TYPE ) { ri.Error( ERR_DROP, "RE_AddRefEntityToScene: bad reType %i", ent->reType ); } diff --git a/engine/code/renderer/tr_types.h b/engine/code/renderer/tr_types.h index 50f9759a..2706b76b 100644 --- a/engine/code/renderer/tr_types.h +++ b/engine/code/renderer/tr_types.h @@ -25,7 +25,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define MAX_DLIGHTS 32 // can't be increased, because bit flags are used on surfaces -#define MAX_ENTITIES 1023 // can't be increased without changing drawsurf bit packing + +#define ENTITYNUM_BITS 10 // can't be increased without changing drawsurf bit packing +#define MAX_ENTITIES ((1<integer && !*gameName) + gameMismatch = qfalse; + else +#endif + gameMismatch = !*gameName || strcmp(gameName, com_gamename->string) != 0; + + // reject client if the gamename string sent by the client doesn't match ours + if (gameMismatch) { - // reject client if the heartbeat string sent by the client doesn't match ours - if(strcmp(gameName, com_gamename->string)) - { - NET_OutOfBandPrint(NS_SERVER, from, "print\nGame mismatch: This is a %s server\n", - com_gamename->string); - return; - } + NET_OutOfBandPrint(NS_SERVER, from, "print\nGame mismatch: This is a %s server\n", + com_gamename->string); + return; } oldest = 0; diff --git a/engine/code/server/sv_game.c b/engine/code/server/sv_game.c index 2909a3b7..ebfa726c 100644 --- a/engine/code/server/sv_game.c +++ b/engine/code/server/sv_game.c @@ -901,7 +901,7 @@ void SV_RestartGameProgs( void ) { VM_Call( gvm, GAME_SHUTDOWN, qtrue ); // do a restart instead of a free - gvm = VM_Restart( gvm ); + gvm = VM_Restart(gvm, qtrue); if ( !gvm ) { Com_Error( ERR_FATAL, "VM_Restart on game failed" ); } diff --git a/engine/code/server/sv_world.c b/engine/code/server/sv_world.c index 6861ef38..665043a0 100644 --- a/engine/code/server/sv_world.c +++ b/engine/code/server/sv_world.c @@ -672,12 +672,12 @@ int SV_PointContents( const vec3_t p, int passEntityNum ) { hit = SV_GentityNum( touch[i] ); // might intersect, so do an exact clip clipHandle = SV_ClipHandleForEntity( hit ); - angles = hit->s.angles; + angles = hit->r.currentAngles; if ( !hit->r.bmodel ) { angles = vec3_origin; // boxes don't rotate } - c2 = CM_TransformedPointContents (p, clipHandle, hit->s.origin, angles); + c2 = CM_TransformedPointContents (p, clipHandle, hit->r.currentOrigin, angles); contents |= c2; } diff --git a/engine/code/sys/con_tty.c b/engine/code/sys/con_tty.c index 6e5e966c..5feb70b2 100644 --- a/engine/code/sys/con_tty.c +++ b/engine/code/sys/con_tty.c @@ -88,13 +88,14 @@ send "\b \b" static void CON_Back( void ) { char key; + size_t UNUSED_VAR size; key = '\b'; - write(STDOUT_FILENO, &key, 1); + size = write(STDOUT_FILENO, &key, 1); key = ' '; - write(STDOUT_FILENO, &key, 1); + size = write(STDOUT_FILENO, &key, 1); key = '\b'; - write(STDOUT_FILENO, &key, 1); + size = write(STDOUT_FILENO, &key, 1); } /* @@ -145,12 +146,13 @@ static void CON_Show( void ) ttycon_hide--; if (ttycon_hide == 0) { - write(STDOUT_FILENO, "]", 1); + size_t UNUSED_VAR size; + size = write(STDOUT_FILENO, "]", 1); if (TTY_con.cursor) { for (i=0; i= 10.4, not if we're specifically Tiger. +# "8" is the Darwin major kernel version. +TIGERHOST=`uname -r |perl -w -p -e 's/\A(\d+)\..*\Z/$1/; $_ = (($_ >= 8) ? "1" : "0");'` + +# we want to use the oldest available SDK for max compatiblity +unset X86_SDK +unset X86_CFLAGS +unset X86_LDFLAGS +if [ -d /Developer/SDKs/MacOSX10.5.sdk ]; then + X86_SDK=/Developer/SDKs/MacOSX10.5.sdk + X86_CFLAGS="-arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk \ + -DMAC_OS_X_VERSION_MIN_REQUIRED=1050" + X86_LDFLAGS=" -mmacosx-version-min=10.5" +fi + + +echo "Building X86 Client/Dedicated Server against \"$X86_SDK\"" +sleep 3 + +if [ ! -d $DESTDIR ]; then + mkdir -p $DESTDIR +fi + +# For parallel make on multicore boxes... +NCPU=`sysctl -n hw.ncpu` + + +# intel client and server +if [ -d build/release-darwin-x86_64 ]; then + rm -r build/release-darwin-x86_64 +fi +(ARCH=x86_64 CFLAGS=$X86_CFLAGS LDFLAGS=$X86_LDFLAGS make -j$NCPU) || exit 1; + +echo "Creating .app bundle $DESTDIR/$APPBUNDLE" +if [ ! -d $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR ]; then + mkdir -p $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR || exit 1; +fi +if [ ! -d $DESTDIR/$APPBUNDLE/Contents/MacOS/$MPACKDIR ]; then + mkdir -p $DESTDIR/$APPBUNDLE/Contents/MacOS/$MPACKDIR || exit 1; +fi +if [ ! -d $DESTDIR/$APPBUNDLE/Contents/Resources ]; then + mkdir -p $DESTDIR/$APPBUNDLE/Contents/Resources +fi +cp $ICNS $DESTDIR/$APPBUNDLE/Contents/Resources/ioquake3.icns || exit 1; +echo $PKGINFO > $DESTDIR/$APPBUNDLE/Contents/PkgInfo +echo " + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + $BINARY + CFBundleGetInfoString + ioquake3 $Q3_VERSION + CFBundleIconFile + ioquake3.icns + CFBundleIdentifier + org.ioquake.ioquake3 + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ioquake3 + CFBundlePackageType + APPL + CFBundleShortVersionString + $Q3_VERSION + CFBundleSignature + $PKGINFO + CFBundleVersion + $Q3_VERSION + NSExtensions + + NSPrincipalClass + NSApplication + + + " > $DESTDIR/$APPBUNDLE/Contents/Info.plist + +lipo -create -o $DESTDIR/$APPBUNDLE/Contents/MacOS/$BINARY $BIN_OBJ +lipo -create -o $DESTDIR/$APPBUNDLE/Contents/MacOS/$DEDBIN $BIN_DEDOBJ +cp $RENDER_OBJ $DESTDIR/$APPBUNDLE/Contents/MacOS/ +cp $BASE_OBJ $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR/ +cp $MPACK_OBJ $DESTDIR/$APPBUNDLE/Contents/MacOS/$MPACKDIR/ +cp code/libs/macosx/*.dylib $DESTDIR/$APPBUNDLE/Contents/MacOS/ + diff --git a/engine/misc/nsis/Makefile b/engine/misc/nsis/Makefile index 41c77edf..96ef8699 100644 --- a/engine/misc/nsis/Makefile +++ b/engine/misc/nsis/Makefile @@ -1,16 +1,76 @@ -VERSION=1.0_SVN +ifndef VERSION +VERSION=v0.0.0.3 +endif +ifndef RELEASE RELEASE=0 +endif +ifndef ARCH ARCH=x86 +endif +ifndef INSTALLDIR +INSTALLDIR=. +endif +ifndef USE_RENDERER_DLOPEN +USE_RENDERER_DLOPEN=1 +endif +ifndef USE_OPENAL_DLOPEN +USE_OPENAL_DLOPEN=1 +endif +ifndef USE_CURL_DLOPEN +USE_CURL_DLOPEN=0 +endif +ifndef USE_INTERNAL_SPEEX +USE_INTERNAL_SPEEX=1 +endif +ifndef USE_INTERNAL_ZLIB +USE_INTERNAL_ZLIB=1 +endif +ifndef USE_INTERNAL_JPEG +USE_INTERNAL_JPEG=1 +endif + + +ifeq ($(ARCH),x64) + SDLDLL=SDL64.dll +else + SDLDLL=SDL.dll +endif + +DEFINES= +ifeq ($(USE_RENDERER_DLOPEN),1) + DEFINES+= -DUSE_RENDERER_DLOPEN +endif +ifeq ($(USE_OPENAL_DLOPEN),1) + DEFINES+= -DUSE_OPENAL_DLOPEN +endif +ifeq ($(USE_CURL_DLOPEN),1) + DEFINES+= -DUSE_CURL_DLOPEN +endif +ifeq ($(USE_INTERNAL_SPEEX),1) + DEFINES+= -DUSE_INTERNAL_SPEEX +endif +ifeq ($(USE_INTERNAL_ZLIB),1) + DEFINES+= -DUSE_INTERNAL_ZLIB +endif +ifeq ($(USE_INTERNAL_JPEG),1) + DEFINES+= -DUSE_INTERNAL_JPEG +endif + all: q3rally-$(VERSION)-$(RELEASE).$(ARCH).exe -q3rally.nsi: q3rally.nsi.in - sed 's/XXXVERSIONXXX/$(VERSION)/;s/XXXRELEASEXXX/$(RELEASE)/;s/x86/$(ARCH)/g' < $< > $@ +q3rally.$(ARCH).nsi: q3rally.nsi.in + sed 's/XXXVERSIONXXX/$(VERSION)/;s/XXXRELEASEXXX/$(RELEASE)/;s/x86/$(ARCH)/g;s/SDL.dll/$(SDLDLL)/' < $< > $@ -q3rally-$(VERSION)-$(RELEASE).$(ARCH).exe: q3rally.nsi - makensis q3rally.nsi +q3rally-$(VERSION)-$(RELEASE).$(ARCH).exe: q3rally.$(ARCH).nsi + makensis $(DEFINES) q3rally.$(ARCH).nsi clean: - rm -rf *.exe q3rally.nsi + rm -rf *.exe q3rally.$(ARCH).nsi + +install: + mkdir -p $(INSTALLDIR) + mv q3rally-$(VERSION)-$(RELEASE).$(ARCH).exe $(INSTALLDIR) .PHONY: all clean + diff --git a/engine/misc/nsis/q3rally.nsi.in b/engine/misc/nsis/q3rally.nsi.in index 7169fe5d..cd61cc11 100644 --- a/engine/misc/nsis/q3rally.nsi.in +++ b/engine/misc/nsis/q3rally.nsi.in @@ -5,7 +5,7 @@ ; This file is used to automatically build the installers in the ; openSUSE build service, don't break this! ; -; you have to copy SDL.dll, OpenAL32.dll, libcurl-4.dll, and zlib1.dll here manually +; you have to copy SDL.dll and OpenAL32.dll here manually !define VERSION "XXXVERSIONXXX" !define RELEASE "XXXRELEASEXXX" @@ -37,7 +37,7 @@ Name "${GAMENAME} ${VERSION}" ; The file to write -OutFile "${GAME_FSNAME}-${VERSION}-${RELEASE}.exe" +OutFile "${GAME_FSNAME}-${VERSION}-${RELEASE}.x86.exe" ; The default installation directory ; set by Multiuser.nsh @@ -91,11 +91,23 @@ Section "${GAMENAME} ${VERSION}-${RELEASE} (required)" ; Set output path to the installation directory. SetOutPath $INSTDIR +!ifndef USE_INTERNAL_SPEEX + File "libspeex.dll" +!endif +!ifndef USE_INTERNAL_ZLIB File "zlib1.dll" +!endif +!ifndef USE_INTERNAL_JPEG + File "jpeg8c.dll" +!endif ; Put file there File "../../build/release-mingw32-x86/${SERVER}" File "../../build/release-mingw32-x86/${CLIENT}" +!ifdef USE_RENDERER_DLOPEN + File "../../build/release-mingw32-x86/renderer_opengl1_x86.dll" +!endif + File "../../COPYING.txt" File "/oname=README.txt" "../../README" @@ -138,14 +150,7 @@ Section "SDL.dll" SectionEnd -Section "libcurl" - - SetOutPath $INSTDIR - - File "libcurl-4.dll" - -SectionEnd - +!ifdef USE_OPENAL_DLOPEN Section "OpenAL-Soft library" SetOutPath $INSTDIR @@ -153,6 +158,17 @@ Section "OpenAL-Soft library" File "OpenAL32.dll" SectionEnd +!endif + +!ifdef USE_CURL_DLOPEN +Section "libcurl" + + SetOutPath $INSTDIR + + File "libcurl-4.dll" + +SectionEnd +!endif ;-------------------------------- @@ -175,13 +191,23 @@ Section "Uninstall" Delete $INSTDIR\COPYING.txt Delete $INSTDIR\README.txt +!ifndef USE_INTERNAL_SPEEX + Delete $INSTDIR\libspeex.dll +!endif +!ifndef USE_INTERNAL_ZLIB Delete $INSTDIR\zlib1.dll +!endif +!ifndef USE_INTERNAL_JPEG + Delete $INSTDIR\jpeg8c.dll +!endif Delete $INSTDIR\SDL.dll - - Delete $INSTDIR\libcurl-4.dll - +!ifdef USE_OPENAL_DLOPEN Delete $INSTDIR\OpenAL32.dll +!endif +!ifdef USE_CURL_DLOPEN + Delete $INSTDIR\libcurl-4.dll +!endif Delete $INSTDIR\uninstall.exe