From 4b0395e07976dc4740002c7f222caf6ef1b015e5 Mon Sep 17 00:00:00 2001 From: Spoike Date: Fri, 24 Dec 2004 08:45:56 +0000 Subject: [PATCH] Lots of stuff. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@684 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/Makefile.Linux | 2 +- engine/Makefile.SDL | 249 +++++++++++++-------- engine/Makefile.mingw | 417 ++++++++++++++++++----------------- engine/client/cl_ents.c | 9 +- engine/client/cl_input.c | 26 +++ engine/client/cl_main.c | 102 ++++++++- engine/client/cl_screen.c | 28 +-- engine/client/cl_ui.c | 235 +++++++++----------- engine/client/client.h | 1 + engine/client/console.c | 6 +- engine/client/m_items.c | 10 +- engine/client/m_mp3.c | 2 +- engine/client/m_multi.c | 4 +- engine/client/m_options.c | 5 +- engine/client/m_single.c | 4 +- engine/client/menu.c | 12 +- engine/client/menu.h | 8 +- engine/client/merged.h | 20 +- engine/client/pr_menu.c | 6 +- engine/client/r_part.c | 29 ++- engine/client/r_partset.c | 20 +- engine/client/render.h | 4 +- engine/client/renderer.c | 44 ++-- engine/client/sbar.c | 65 +++--- engine/client/snd_dma.c | 3 + engine/client/snd_sdl.c | 57 ++++- engine/client/sound.h | 3 +- engine/client/sys_linux.c | 4 +- engine/client/wad.h | 16 +- engine/client/winquake.h | 2 + engine/client/zqtp.c | 12 +- engine/common/bothdefs.h | 17 +- engine/common/cmd.c | 47 +++- engine/common/common.c | 148 ++++++++++++- engine/common/common.h | 8 + engine/common/cvar.c | 13 +- engine/common/gl_q2bsp.c | 25 ++- engine/common/net.h | 11 + engine/common/net_chan.c | 2 +- engine/common/net_wins.c | 4 + engine/common/plugin.c | 29 +-- engine/common/protocol.h | 7 + engine/ftequake/FTEQuake.dev | 2 +- engine/ftequake/ftequake.dsp | 10 +- engine/gl/gl_alias.c | 58 ++++- engine/gl/gl_backend.c | 14 +- engine/gl/gl_draw.c | 224 ++++++++++--------- engine/gl/gl_draw.h | 22 +- engine/gl/gl_ppl.c | 9 + engine/gl/gl_rmain.c | 2 +- engine/gl/gl_rsurf.c | 2 +- engine/gl/gl_screen.c | 45 ++-- engine/gl/gl_vidnt.c | 6 +- engine/qclib/Makefile | 2 + engine/qclib/pr_exec.c | 3 - engine/qclib/qcc.dsp | 12 +- engine/qclib/qcc.h | 1 + engine/qclib/qcc_pr_comp.c | 22 +- engine/qclib/qccgui.c | 59 ++--- engine/qclib/qccmain.c | 43 ++-- engine/server/savegame.c | 20 +- engine/server/sv_ccmds.c | 4 +- engine/server/sv_user.c | 2 + engine/sw/d_surf.c | 1 + engine/sw/r_sky.c | 2 +- engine/sw/sw_draw.c | 236 ++++++++++++++++---- engine/sw/sw_draw.h | 18 +- 67 files changed, 1643 insertions(+), 892 deletions(-) diff --git a/engine/Makefile.Linux b/engine/Makefile.Linux index 89ebc29c2..68ce32631 100644 --- a/engine/Makefile.Linux +++ b/engine/Makefile.Linux @@ -26,7 +26,7 @@ XLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext -lpng -ljpeg SLDFLAGS=-lvga -BASE_CFLAGS=-Wall -Dstrnicmp=strncasecmp -Dstricmp=strcasecmp -I$(CLIENT_DIR) -I$(SERVER_DIR) -I$(COMMON_DIR) -I$(SW_DIR) -I$(GL_DIR) -I$(PROGS_DIR) -I$(LIBS_DIR) -I$(QUX_DIR) -I/usr/X11R6/include -D_vsnprintf=vsnprintf -D_snprintf=snprintf +BASE_CFLAGS=-DWITH_VMODE -Wall -Dstrnicmp=strncasecmp -Dstricmp=strcasecmp -I$(CLIENT_DIR) -I$(SERVER_DIR) -I$(COMMON_DIR) -I$(SW_DIR) -I$(GL_DIR) -I$(PROGS_DIR) -I$(LIBS_DIR) -I$(QUX_DIR) -I/usr/X11R6/include -D_vsnprintf=vsnprintf -D_snprintf=snprintf CLIENT_ONLY_CFLAGS=$(BASE_CFLAGS) -DCLIENTONLY SERVER_ONLY_CFLAGS=$(BASE_CFLAGS) -DSERVERONLY JOINT_CFLAGS=$(BASE_CFLAGS) diff --git a/engine/Makefile.SDL b/engine/Makefile.SDL index 935021753..02fdf4843 100644 --- a/engine/Makefile.SDL +++ b/engine/Makefile.SDL @@ -29,7 +29,7 @@ QUX_DIR=$(BASE_DIR)/qux RELEASE_DIR=$(BASE_DIR)/release DEBUG_DIR=$(BASE_DIR)/debug -DO_CC=$(CC) $(CFLAGS) -o $@ -c $< +DO_CC=$(CC) $(BASE_CFLAGS) $(CFLAGS) -o $@ -c $< ifeq ($(USEASM),true) ifdef windir DO_AS=$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $< @@ -50,14 +50,31 @@ ifeq ($(USEASM),true) CLIENT_ASM_OBJS = \ snd_mixa.o + + SOFTWARE_ASM_OBJS = \ + r_aclipa.o \ + r_aliasa.o \ + r_drawa.o \ + r_edgea.o \ + r_varsa.o \ + d_draw.o \ + d_draw16.o \ + d_parta.o \ + d_polysa.o \ + d_scana.o \ + d_spr8.o \ + d_varsa.o \ + surf16.o \ + surf8.o + else BASE_ASM_CFLAGS = -DNOASM endif -BASE_CFLAGS=$(BASE_ASM_CFLAGS) -DQ3SHADERS -Wall -Dstrnicmp=strncasecmp -Dstricmp=strcasecmp -I$(CLIENT_DIR) -I$(SERVER_DIR) -I$(COMMON_DIR) -I$(SW_DIR) -I$(GL_DIR) -I$(PROGS_DIR) -I$(LIBS_DIR) -I$(QUX_DIR) -I$(LIBS_DIR)/dxsdk7/include -I/usr/X11R6/include -I$(LIBS_DIR)/sdl/include -I$(LIBS_DIR)/sdl/include/SDL -D_vsnprintf=vsnprintf -D_snprintf=snprintf -CLIENT_ONLY_CFLAGS=$(BASE_CFLAGS) -DCLIENTONLY -SERVER_ONLY_CFLAGS=$(BASE_CFLAGS) -DSERVERONLY -JOINT_CFLAGS=$(BASE_CFLAGS) +BASE_CFLAGS=$(BASE_ASM_CFLAGS) -Wall -Dstrnicmp=strncasecmp -Dstricmp=strcasecmp -I$(CLIENT_DIR) -I$(SERVER_DIR) -I$(COMMON_DIR) -I$(SW_DIR) -I$(GL_DIR) -I$(PROGS_DIR) -I$(LIBS_DIR) -I$(QUX_DIR) -I$(LIBS_DIR)/dxsdk7/include -I/usr/X11R6/include -I$(LIBS_DIR)/sdl/include -I$(LIBS_DIR)/sdl/include/SDL -D_vsnprintf=vsnprintf -D_snprintf=snprintf +CLIENT_ONLY_CFLAGS=-DCLIENTONLY +SERVER_ONLY_CFLAGS=-DSERVERONLY +JOINT_CFLAGS= DEBUG_CFLAGS=-ggdb -g RELEASE_CFLAGS=-O6 -s -fno-strict-aliasing -ffast-math -funroll-loops -fexpensive-optimizations $(CPUOPTIMIZATIONS) GLCFLAGS=-DGLQUAKE @@ -130,22 +147,18 @@ CLIENT_OBJS = $(CLIENT_ASM_OBJS) \ m_x.o \ x_reqs.o \ x_res.o \ - pr_menu.o \ + pr_menu.o -SOFTWARE_OBJS = \ +SOFTWARE_OBJS = $(SOFTWARE_ASM_OBJS) \ sw_screen.o \ sw_draw.o \ sw_model.o \ r_aclip.o \ - r_aclipa.o \ r_alias.o \ - r_aliasa.o \ r_bsp.o \ r_draw.o \ - r_drawa.o \ r_edge.o \ - r_edgea.o \ r_light.o \ r_main.o \ r_misc.o \ @@ -153,79 +166,67 @@ SOFTWARE_OBJS = \ r_sprite.o \ r_surf.o \ r_vars.o \ - r_varsa.o \ - \ - d_draw.o \ - d_draw16.o \ d_edge.o \ d_fill.o \ d_init.o \ d_modech.o \ d_part.o \ - d_parta.o \ d_polyse.o \ - d_polysa.o \ d_scan.o \ - d_scana.o \ d_sky.o \ - d_spr8.o \ d_sprite.o \ d_surf.o \ d_trans.o \ d_vars.o \ - d_varsa.o \ d_zpoint.o \ - \ - nonintel.o \ - surf16.o \ - surf8.o + nonintel.o -GLQUAKE_OBJS = \ - gl_alias.o \ - gl_draw.o \ - gl_model.o \ - gl_ngraph.o \ - gl_rlight.o \ - gl_rmain.o \ - gl_rmisc.o \ - gl_rsurf.o \ - ltface.o \ - gl_screen.o \ +GLQUAKE_OBJS = \ + gl_alias.o \ + gl_draw.o \ + gl_model.o \ + gl_ngraph.o \ + gl_rlight.o \ + gl_rmain.o \ + gl_rmisc.o \ + gl_rsurf.o \ + ltface.o \ + gl_screen.o \ gl_backend.o \ - gl_shader.o \ - gl_warp.o \ - gl_ppl.o \ - gl_vidcommon.o \ + gl_shader.o \ + gl_warp.o \ + gl_ppl.o \ + gl_vidcommon.o \ gl_hlmdl.o -MP3_OBJS = \ - fixed.o \ - bit.o \ - timer.o \ - stream.o \ - frame.o \ - synth.o \ - decoder.o \ - layer12.o \ - layer3.o \ - huffman.o \ +MP3_OBJS = \ + fixed.o \ + bit.o \ + timer.o \ + stream.o \ + frame.o \ + synth.o \ + decoder.o \ + layer12.o \ + layer3.o \ + huffman.o \ mymad.o -PROGS_OBJS = \ - comprout.o \ - hash.o \ - initlib.o \ - pr_edict.o \ - pr_exec.o \ - pr_multi.o \ - qcc_cmdlib.o \ - qccmain.o \ - qcc_pr_comp.o \ - qcc_pr_lex.o \ - qcdecomp.o \ +PROGS_OBJS = \ + comprout.o \ + hash.o \ + initlib.o \ + pr_edict.o \ + pr_exec.o \ + pr_multi.o \ + qcc_cmdlib.o \ + qccmain.o \ + qcc_pr_comp.o \ + qcc_pr_lex.o \ + qcdecomp.o \ qcd_main.o -SERVER_OBJS = \ +SERVER_OBJS = \ pr_cmds.o \ sv_master.o \ sv_init.o \ @@ -259,23 +260,23 @@ SERVER_OBJS = \ sv_pop3.o \ sv_smtp.o -SERVERONLY_OBJS = \ - svmodel.o \ +SERVERONLY_OBJS = \ + svmodel.o \ sv_sys_unix.o COMMON_OBJS = $(COMMON_ASM_OBJS) \ - common.o \ - cvar.o \ - cmd.o \ - crc.o \ - mathlib.o \ - huff.o \ - md4.o \ - md5.o \ - net_chan.o \ - net_wins.o \ - zone.o \ - gl_q2bsp.o \ + common.o \ + cvar.o \ + cmd.o \ + crc.o \ + mathlib.o \ + huff.o \ + md4.o \ + md5.o \ + net_chan.o \ + net_wins.o \ + zone.o \ + gl_q2bsp.o \ glmod_doom.o \ pmove.o \ pmovetst.o \ @@ -293,7 +294,34 @@ ifeq ($(FTE_TARGET), win32) GL_CFLAGS=$(GLCFLAGS) GLB_DIR=gl_mgw GLCL_DIR=glcl_mgw + +ifeq ($(USEASM),true) + SWCL_OBJS=$(SOFTWARE_OBJS) vid_ddraw.o vid_dib.o vid_win2.o snd_win.o cd_win.o in_win.o sys_win.o sys_dosa.o else + SWCL_OBJS=$(SOFTWARE_OBJS) vid_ddraw.o vid_dib.o vid_win2.o snd_win.o cd_win.o in_win.o sys_win.o +endif + SW_EXE_NAME=../fteswqw.exe + SWCL_EXE_NAME=../fteswqwcl.exe + SW_LDFLAGS=$(SWLDFLAGS) -ldxguid -lwsock32 -lwinmm -lgdi32 -lole32 + SW_CFLAGS=$(SWCFLAGS) + SWB_DIR=sw_mgw + SWCL_DIR=swcl_mgw + +ifeq ($(USEASM),true) + MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidnt.o vid_ddraw.o vid_dib.o vid_win2.o snd_win.o cd_win.o in_win.o sys_win.o sys_dosa.o +else + MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidnt.o vid_ddraw.o vid_dib.o vid_win2.o snd_win.o cd_win.o in_win.o sys_win.o +endif + M_EXE_NAME=../fteqw.exe + MCL_EXE_NAME=../fteqwcl.exe + M_LDFLAGS=$(GLLDFLAGS) -ldxguid -lwsock32 -lwinmm -lgdi32 -lole32 + M_CFLAGS=$(SWCFLAGS) $(GLCFLAGS) + MB_DIR=m_mgw + MCL_DIR=mcl_mgw + +else + + GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o GL_EXE_NAME=../fteqw_sdl.gl GLCL_EXE_NAME=../fteqwcl_sdl.gl @@ -306,11 +334,24 @@ endif GL_CFLAGS=$(GLCFLAGS) GLB_DIR=gl_sdl GLCL_DIR=glcl_sdl + + SWCL_OBJS=$(SOFTWARE_OBJS) vid_sdl.o snd_sdl.o cd_sdl.o sys_sdl.o + SW_EXE_NAME=../fteswqw.sw + SWCL_EXE_NAME=../fteswqwcl.sw +ifdef windir + SW_LDFLAGS=$(SWLDFLAGS) -lmingw32 -lwsock32 -lSDLmain -lSDL +else + #pthread is needed because of SDL. + SW_LDFLAGS=$(SWLDFLAGS) -lSDLmain -lSDL -lpthread +endif + SW_CFLAGS=$(SWCFLAGS) + SWB_DIR=sw_mgw + SWCL_DIR=swcl_mgw endif all: help -VPATH = $(BASE_DIR) : $(CLIENT_DIR) : $(GL_DIR) : $(COMMON_DIR) : ($SW_DIR) : $(SERVER_DIR) : $(NQPROT_DIR) : $(HTTP_DIR) : $(BASE_DIR)/irc : $(BASE_DIR)/email : $(QUX_DIR) : $(PROGS_DIR) : $(SNDCODEC_DIR) +VPATH = $(BASE_DIR) : $(CLIENT_DIR) : $(GL_DIR) : $(COMMON_DIR) : $(SW_DIR) : $(SERVER_DIR) : $(NQPROT_DIR) : $(HTTP_DIR) : $(BASE_DIR)/irc : $(BASE_DIR)/email : $(QUX_DIR) : $(PROGS_DIR) : $(SNDCODEC_DIR) #NQPROT_DIR=$(BASE_DIR)/nqnet #HTTP_DIR=$(BASE_DIR)/http @@ -330,9 +371,8 @@ $(OUT_DIR)/%.o : %.s $(DO_AS) endif - -$(OUT_DIR)/$(EXE_NAME): $(addprefix $(OUT_DIR)/, $(OBJS)) - $(CC) $(CFLAGS) -o $@ $(addprefix $(OUT_DIR)/, $(OBJS)) $(LDFLAGS) +$(OUT_DIR)/$(EXE_NAME): $(addprefix $(OUT_DIR)/, $(foreach ol, $(OBJS), $($(ol)))) + $(CC) $(CFLAGS) -o $@ $(addprefix $(OUT_DIR)/, $(foreach ol, $(OBJS), $($(ol)))) $(LDFLAGS) _out-rel: $(MAKE) -f Makefile.SDL $(OUT_DIR)/$(EXE_NAME) EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" CFLAGS="$(CFLAGS) $(RELEASE_CFLAGS)" LDFLAGS="$(BASELDFLAGS) $(LDFLAGS)" OBJS="$(OBJS)" @@ -342,16 +382,16 @@ _out-dbg: $(MAKE) -f Makefile.SDL $(OUT_DIR)/$(EXE_NAME) EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" CFLAGS="$(CFLAGS) $(DEBUG_CFLAGS)" LDFLAGS="$(BASELDFLAGS) $(LDFLAGS)" OBJS="$(OBJS)" _cl-rel: - $(MAKE) -f Makefile.SDL _out-rel EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" CFLAGS="$(CLIENT_ONLY_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)" OBJS="$(OBJS) $(COMMON_OBJS) $(NQPROT_OBJS) $(CLIENT_OBJS) $(PROGS_OBJS)" + $(MAKE) -f Makefile.SDL _out-rel EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" CFLAGS="$(CLIENT_ONLY_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)" SOBJS="$(SOBJS)" OBJS="SOBJS COMMON_OBJS NQPROT_OBJS CLIENT_OBJS PROGS_OBJS" _cl-dbg: - $(MAKE) -f Makefile.SDL _out-dbg EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" CFLAGS="$(CLIENT_ONLY_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)" OBJS="$(OBJS) $(COMMON_OBJS) $(NQPROT_OBJS) $(CLIENT_OBJS) $(PROGS_OBJS)" + $(MAKE) -f Makefile.SDL _out-dbg EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" CFLAGS="$(CLIENT_ONLY_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)" SOBJS="$(SOBJS)" OBJS="SOBJS COMMON_OBJS NQPROT_OBJS CLIENT_OBJS PROGS_OBJS" _clsv-rel: reldir - $(MAKE) -f Makefile.SDL _out-rel EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" CFLAGS="$(JOINT_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)" OBJS="$(OBJS) $(COMMON_OBJS) $(NQPROT_OBJS) $(CLIENT_OBJS) $(PROGS_OBJS) $(SERVER_OBJS)" + $(MAKE) -f Makefile.SDL _out-rel EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" CFLAGS="$(JOINT_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)" SOBJS="$(SOBJS)" OBJS="SOBJS COMMON_OBJS NQPROT_OBJS CLIENT_OBJS PROGS_OBJS SERVER_OBJS" _clsv-dbg: debugdir - $(MAKE) -f Makefile.SDL _out-dbg EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" CFLAGS="$(JOINT_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)" OBJS="$(OBJS) $(COMMON_OBJS) $(NQPROT_OBJS) $(CLIENT_OBJS) $(PROGS_OBJS) $(SERVER_OBJS)" + $(MAKE) -f Makefile.SDL _out-dbg EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" CFLAGS="$(JOINT_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)" SOBJS="$(SOBJS)" OBJS="SOBJS COMMON_OBJS NQPROT_OBJS CLIENT_OBJS PROGS_OBJS SERVER_OBJS" SV_OBJS=$(COMMON_OBJS) $(NQPROT_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(SERVERONLY_OBJS) @@ -371,9 +411,9 @@ sv-dbg: glcl-tmp: - $(MAKE) -f Makefile.SDL $(TYPE) OUT_DIR="$(OUT_DIR)" EXE_NAME="$(GLCL_EXE_NAME)" CFLAGS="$(GL_CFLAGS)" LDFLAGS="$(GL_LDFLAGS)" OBJS="$(GLCL_OBJS)" + $(MAKE) -f Makefile.SDL $(TYPE) OUT_DIR="$(OUT_DIR)" EXE_NAME="$(GLCL_EXE_NAME)" CFLAGS="$(GL_CFLAGS)" LDFLAGS="$(GL_LDFLAGS)" SOBJS="$(GLCL_OBJS)" gl-tmp: - $(MAKE) -f Makefile.SDL $(TYPE) OUT_DIR="$(OUT_DIR)" EXE_NAME="$(GL_EXE_NAME)" CFLAGS="$(GL_CFLAGS)" LDFLAGS="$(GL_LDFLAGS)" OBJS="$(GLCL_OBJS)" + $(MAKE) -f Makefile.SDL $(TYPE) OUT_DIR="$(OUT_DIR)" EXE_NAME="$(GL_EXE_NAME)" CFLAGS="$(GL_CFLAGS)" LDFLAGS="$(GL_LDFLAGS)" SOBJS="$(GLCL_OBJS)" glcl-rel: $(MAKE) -f Makefile.SDL glcl-tmp TYPE=_cl-rel OUT_DIR="$(RELEASE_DIR)/$(GLCL_DIR)" @@ -384,6 +424,41 @@ gl-rel: gl-dbg: $(MAKE) -f Makefile.SDL gl-tmp TYPE=_clsv-dbg OUT_DIR="$(DEBUG_DIR)/$(GLB_DIR)" + + + +swcl-tmp: + $(MAKE) -f Makefile.SDL $(TYPE) OUT_DIR="$(OUT_DIR)" EXE_NAME="$(SWCL_EXE_NAME)" CFLAGS="$(SW_CFLAGS)" LDFLAGS="$(SW_LDFLAGS)" SOBJS="SWCL_OBJS" +sw-tmp: + $(MAKE) -f Makefile.SDL $(TYPE) OUT_DIR="$(OUT_DIR)" EXE_NAME="$(SW_EXE_NAME)" CFLAGS="$(SW_CFLAGS)" LDFLAGS="$(SW_LDFLAGS)" SOBJS="SWCL_OBJS" + +swcl-rel: + $(MAKE) -f Makefile.SDL swcl-tmp TYPE=_cl-rel OUT_DIR="$(RELEASE_DIR)/$(SWCL_DIR)" +swcl-dbg: + $(MAKE) -f Makefile.SDL swcl-tmp TYPE=_cl-dbg OUT_DIR="$(DEBUG_DIR)/$(SWCL_DIR)" +sw-rel: + $(MAKE) -f Makefile.SDL sw-tmp TYPE=_clsv-rel OUT_DIR="$(RELEASE_DIR)/$(SWB_DIR)" +sw-dbg: + $(MAKE) -f Makefile.SDL sw-tmp TYPE=_clsv-dbg OUT_DIR="$(DEBUG_DIR)/$(SWB_DIR)" + + + +mcl-tmp: + $(MAKE) -f Makefile.SDL $(TYPE) OUT_DIR="$(OUT_DIR)" EXE_NAME="$(MCL_EXE_NAME)" CFLAGS="$(M_CFLAGS)" LDFLAGS="$(M_LDFLAGS)" SOBJS="$(MCL_OBJS)" +mcl-rel: + $(MAKE) -f Makefile.SDL mcl-tmp TYPE=_cl-rel OUT_DIR="$(RELEASE_DIR)/$(MCL_DIR)" +mcl-dbg: + $(MAKE) -f Makefile.SDL mcl-tmp TYPE=_cl-dbg OUT_DIR="$(DEBUG_DIR)/$(MCL_DIR)" + + +m-tmp: + $(MAKE) -f Makefile.SDL $(TYPE) OUT_DIR="$(OUT_DIR)" EXE_NAME="$(M_EXE_NAME)" CFLAGS="$(M_CFLAGS)" LDFLAGS="$(M_LDFLAGS)" SOBJS="$(MCL_OBJS)" +m-rel: + $(MAKE) -f Makefile.SDL m-tmp TYPE=_clsv-rel OUT_DIR="$(RELEASE_DIR)/$(MCL_DIR)" +m-dbg: + $(MAKE) -f Makefile.SDL m-tmp TYPE=_clsv-dbg OUT_DIR="$(DEBUG_DIR)/$(MCL_DIR)" + + ifdef windir debugdir: @-mkdir $(subst /,\, $(OUT_DIR)) diff --git a/engine/Makefile.mingw b/engine/Makefile.mingw index 22c7df4c9..447643321 100644 --- a/engine/Makefile.mingw +++ b/engine/Makefile.mingw @@ -45,241 +45,246 @@ NQPROT_OBJS = \ $(OUT_DIR)/net_nqwin.o \ $(OUT_DIR)/net_vcr.o CLIENT_OBJS = \ - $(OUT_DIR)/textedit.o \ - $(OUT_DIR)/teamplay.o \ - $(OUT_DIR)/zqtp.o \ - $(OUT_DIR)/cl_demo.o \ - $(OUT_DIR)/cl_ents.o \ - $(OUT_DIR)/clq2_ents.o \ - $(OUT_DIR)/cl_input.o \ - $(OUT_DIR)/cl_main.o \ - $(OUT_DIR)/cl_parse.o \ - $(OUT_DIR)/cl_pred.o \ - $(OUT_DIR)/cl_tent.o \ - $(OUT_DIR)/cl_cam.o \ - $(OUT_DIR)/cl_ui.o \ - $(OUT_DIR)/cl_screen.o \ - $(OUT_DIR)/clq2_cin.o \ - $(OUT_DIR)/qvm.o \ - $(OUT_DIR)/irc_cl.o \ - $(OUT_DIR)/ftp_cl.o \ - $(OUT_DIR)/http_cl.o \ - $(OUT_DIR)/console.o \ - $(OUT_DIR)/image.o \ - $(OUT_DIR)/in_win.o \ - $(OUT_DIR)/keys.o \ - $(OUT_DIR)/menu.o \ - $(OUT_DIR)/m_master.o \ - $(OUT_DIR)/m_multi.o \ - $(OUT_DIR)/m_items.o \ - $(OUT_DIR)/m_options.o \ - $(OUT_DIR)/m_single.o \ - $(OUT_DIR)/m_script.o \ - $(OUT_DIR)/m_mp3.o \ - $(OUT_DIR)/roq_read.o \ - $(OUT_DIR)/net_master.o \ - $(OUT_DIR)/nonintel.o \ - $(OUT_DIR)/r_bulleten.o \ - $(OUT_DIR)/r_part.o \ - $(OUT_DIR)/r_partset.o \ - $(OUT_DIR)/renderer.o \ - $(OUT_DIR)/renderque.o \ - $(OUT_DIR)/sbar.o \ - $(OUT_DIR)/skin.o \ - $(OUT_DIR)/snd_dma.o \ - $(OUT_DIR)/snd_mem.o \ - $(OUT_DIR)/snd_mix.o \ - $(OUT_DIR)/snd_mp3.o \ - $(OUT_DIR)/snd_ov.o \ - $(OUT_DIR)/valid.o \ - $(OUT_DIR)/view.o \ - $(OUT_DIR)/wad.o \ - $(OUT_DIR)/cd_win.o \ - $(OUT_DIR)/fragstats.o \ - $(OUT_DIR)/clsys_win.o \ - $(OUT_DIR)/snd_win.o \ + textedit.o \ + teamplay.o \ + zqtp.o \ + cl_demo.o \ + cl_ents.o \ + clq2_ents.o \ + cl_input.o \ + cl_main.o \ + cl_parse.o \ + cl_pred.o \ + cl_tent.o \ + cl_cam.o \ + cl_ui.o \ + cl_screen.o \ + clq2_cin.o \ + qvm.o \ + irc_cl.o \ + ftp_cl.o \ + http_cl.o \ + console.o \ + image.o \ + in_win.o \ + keys.o \ + menu.o \ + m_master.o \ + m_multi.o \ + m_items.o \ + m_options.o \ + m_single.o \ + m_script.o \ + m_mp3.o \ + roq_read.o \ + net_master.o \ + nonintel.o \ + r_bulleten.o \ + r_part.o \ + r_partset.o \ + renderer.o \ + renderque.o \ + sbar.o \ + skin.o \ + snd_dma.o \ + snd_mem.o \ + snd_mix.o \ + snd_mp3.o \ + snd_ov.o \ + valid.o \ + view.o \ + wad.o \ + cd_win.o \ + fragstats.o \ + clsys_win.o \ + snd_win.o \ \ - $(OUT_DIR)/pop3noti.o \ - $(OUT_DIR)/imapnoti.o \ + pop3noti.o \ + imapnoti.o \ \ - $(OUT_DIR)/m_x.o \ - $(OUT_DIR)/x_reqs.o \ - $(OUT_DIR)/x_res.o \ + m_x.o \ + x_reqs.o \ + x_res.o \ \ - $(OUT_DIR)/snd_mixa.o + snd_mixa.o #\ -# $(OUT_DIR)/sys_dosa.o +# sys_dosa.o SOFTWARE_OBJS = \ - $(OUT_DIR)/sw_screen.o \ - $(OUT_DIR)/sw_draw.o \ - $(OUT_DIR)/sw_model.o \ - $(OUT_DIR)/r_aclip.o \ - $(OUT_DIR)/r_aclipa.o \ - $(OUT_DIR)/r_alias.o \ - $(OUT_DIR)/r_aliasa.o \ - $(OUT_DIR)/r_bsp.o \ - $(OUT_DIR)/r_draw.o \ - $(OUT_DIR)/r_drawa.o \ - $(OUT_DIR)/r_edge.o \ - $(OUT_DIR)/r_edgea.o \ - $(OUT_DIR)/r_light.o \ - $(OUT_DIR)/r_main.o \ - $(OUT_DIR)/r_misc.o \ - $(OUT_DIR)/r_sky.o \ - $(OUT_DIR)/r_sprite.o \ - $(OUT_DIR)/r_surf.o \ - $(OUT_DIR)/r_vars.o \ - $(OUT_DIR)/r_varsa.o \ + sw_screen.o \ + sw_draw.o \ + sw_model.o \ + r_aclip.o \ + r_aclipa.o \ + r_alias.o \ + r_aliasa.o \ + r_bsp.o \ + r_draw.o \ + r_drawa.o \ + r_edge.o \ + r_edgea.o \ + r_light.o \ + r_main.o \ + r_misc.o \ + r_sky.o \ + r_sprite.o \ + r_surf.o \ + r_vars.o \ + r_varsa.o \ \ - $(OUT_DIR)/d_draw.o \ - $(OUT_DIR)/d_draw16.o \ - $(OUT_DIR)/d_edge.o \ - $(OUT_DIR)/d_fill.o \ - $(OUT_DIR)/d_init.o \ - $(OUT_DIR)/d_modech.o \ - $(OUT_DIR)/d_part.o \ - $(OUT_DIR)/d_parta.o \ - $(OUT_DIR)/d_polyse.o \ - $(OUT_DIR)/d_polysa.o \ - $(OUT_DIR)/d_scan.o \ - $(OUT_DIR)/d_scana.o \ - $(OUT_DIR)/d_sky.o \ - $(OUT_DIR)/d_spr8.o \ - $(OUT_DIR)/d_sprite.o \ - $(OUT_DIR)/d_surf.o \ - $(OUT_DIR)/d_trans.o \ - $(OUT_DIR)/d_vars.o \ - $(OUT_DIR)/d_varsa.o \ - $(OUT_DIR)/d_zpoint.o \ + d_draw.o \ + d_draw16.o \ + d_edge.o \ + d_fill.o \ + d_init.o \ + d_modech.o \ + d_part.o \ + d_parta.o \ + d_polyse.o \ + d_polysa.o \ + d_scan.o \ + d_scana.o \ + d_sky.o \ + d_spr8.o \ + d_sprite.o \ + d_surf.o \ + d_trans.o \ + d_vars.o \ + d_varsa.o \ + d_zpoint.o \ \ - $(OUT_DIR)/r_efrag.o \ - $(OUT_DIR)/surf16.o \ - $(OUT_DIR)/surf8.o + r_efrag.o \ + surf16.o \ + surf8.o -# $(OUT_DIR)/d_copy.o \ +# d_copy.o \ -X11_OBJS = $(OUT_DIR)/vid_x.o -W32_OBJS = $(OUT_DIR)/vid_win2.o \ - $(OUT_DIR)/vid_ddraw.o \ - $(OUT_DIR)/vid_dib.o +X11_OBJS = vid_x.o +W32_OBJS = vid_win2.o \ + vid_ddraw.o \ + vid_dib.o GLQUAKE_OBJS = \ - $(OUT_DIR)/gl_alias.o \ - $(OUT_DIR)/gl_ppl.o \ - $(OUT_DIR)/gl_draw.o \ - $(OUT_DIR)/gl_model.o \ - $(OUT_DIR)/gl_ngraph.o \ - $(OUT_DIR)/gl_rlight.o \ - $(OUT_DIR)/gl_rmain.o \ - $(OUT_DIR)/gl_rmisc.o \ - $(OUT_DIR)/glmod_doom.o \ - $(OUT_DIR)/ltface.o \ - $(OUT_DIR)/gl_rsurf.o \ - $(OUT_DIR)/gl_vidcommon.o \ - $(OUT_DIR)/gl_screen.o \ - $(OUT_DIR)/gl_backend.o \ - $(OUT_DIR)/gl_warp.o \ - $(OUT_DIR)/gl_hlmdl.o + gl_alias.o \ + gl_ppl.o \ + gl_draw.o \ + gl_model.o \ + gl_ngraph.o \ + gl_rlight.o \ + gl_rmain.o \ + gl_rmisc.o \ + glmod_doom.o \ + ltface.o \ + gl_rsurf.o \ + gl_vidcommon.o \ + gl_screen.o \ + gl_backend.o \ + gl_warp.o \ + gl_hlmdl.o -# $(OUT_DIR)/gl_refrag.o \ +# gl_refrag.o \ -GLW32_OBJS = $(OUT_DIR)/gl_vidnt.o -GLX_OBJS = $(OUT_DIR)/gl_vidlinuxglx.o -GLS_OBJS = $(OUT_DIR)/gl_vidlinux.o +GLW32_OBJS = gl_vidnt.o +GLX_OBJS = gl_vidlinuxglx.o +GLS_OBJS = gl_vidlinux.o MP3_OBJS = \ - $(OUT_DIR)/fixed.o \ - $(OUT_DIR)/bit.o \ - $(OUT_DIR)/timer.o \ - $(OUT_DIR)/stream.o \ - $(OUT_DIR)/frame.o \ - $(OUT_DIR)/synth.o \ - $(OUT_DIR)/decoder.o \ - $(OUT_DIR)/layer12.o \ - $(OUT_DIR)/layer3.o \ - $(OUT_DIR)/huffman.o \ - $(OUT_DIR)/mymad.o + fixed.o \ + bit.o \ + timer.o \ + stream.o \ + frame.o \ + synth.o \ + decoder.o \ + layer12.o \ + layer3.o \ + huffman.o \ + mymad.o PROGS_OBJS = \ - $(OUT_DIR)/comprout.o \ - $(OUT_DIR)/hash.o \ - $(OUT_DIR)/initlib.o \ - $(OUT_DIR)/pr_edict.o \ - $(OUT_DIR)/pr_exec.o \ - $(OUT_DIR)/pr_multi.o \ - $(OUT_DIR)/qcc_cmdlib.o \ - $(OUT_DIR)/QccMain.o \ - $(OUT_DIR)/qcc_pr_comp.o \ - $(OUT_DIR)/qcc_pr_lex.o \ - $(OUT_DIR)/qcdecomp.o \ - $(OUT_DIR)/qcd_main.o + comprout.o \ + hash.o \ + initlib.o \ + pr_edict.o \ + pr_exec.o \ + pr_multi.o \ + qcc_cmdlib.o \ + QccMain.o \ + qcc_pr_comp.o \ + qcc_pr_lex.o \ + qcdecomp.o \ + qcd_main.o SERVER_OBJS = \ - $(OUT_DIR)/pr_cmds.o \ - $(OUT_DIR)/sv_master.o \ - $(OUT_DIR)/sv_init.o \ - $(OUT_DIR)/sv_main.o \ - $(OUT_DIR)/sv_nchan.o \ - $(OUT_DIR)/sv_ents.o \ - $(OUT_DIR)/sv_send.o \ - $(OUT_DIR)/sv_move.o \ - $(OUT_DIR)/sv_phys.o \ - $(OUT_DIR)/sv_user.o \ - $(OUT_DIR)/sv_mvd.o \ - $(OUT_DIR)/sv_ccmds.o \ - $(OUT_DIR)/sv_rankin.o \ - $(OUT_DIR)/sv_chat.o \ - $(OUT_DIR)/sv_demo.o \ - $(OUT_DIR)/world.o \ - $(OUT_DIR)/worlda.o \ - $(OUT_DIR)/net_preparse.o \ - $(OUT_DIR)/savegame.o \ - $(OUT_DIR)/svq2_ents.o \ - $(OUT_DIR)/svq2_game.o \ - $(OUT_DIR)/snd_vc.o \ - $(OUT_DIR)/snd_voicecodecs.o \ - $(OUT_DIR)/g711.o \ - $(OUT_DIR)/g721.o \ - $(OUT_DIR)/g723_24.o \ - $(OUT_DIR)/g723_40.o \ - $(OUT_DIR)/g72x.o \ - $(OUT_DIR)/webgen.o \ - $(OUT_DIR)/ftpserver.o \ - $(OUT_DIR)/httpserver.o \ - $(OUT_DIR)/sv_pop3.o \ - $(OUT_DIR)/sv_smtp.o + pr_cmds.o \ + sv_master.o \ + sv_init.o \ + sv_main.o \ + sv_nchan.o \ + sv_ents.o \ + sv_send.o \ + sv_move.o \ + sv_phys.o \ + sv_user.o \ + sv_mvd.o \ + sv_ccmds.o \ + sv_rankin.o \ + sv_chat.o \ + sv_demo.o \ + world.o \ + worlda.o \ + net_preparse.o \ + savegame.o \ + svq2_ents.o \ + svq2_game.o \ + snd_vc.o \ + snd_voicecodecs.o \ + g711.o \ + g721.o \ + g723_24.o \ + g723_40.o \ + g72x.o \ + webgen.o \ + ftpserver.o \ + httpserver.o \ + sv_pop3.o \ + sv_smtp.o SERVERONLY_OBJS = \ - $(OUT_DIR)/svmodel.o \ - $(OUT_DIR)/svsys_win.o + svmodel.o \ + svsys_win.o COMMON_OBJS = \ - $(OUT_DIR)/common.o \ - $(OUT_DIR)/cvar.o \ - $(OUT_DIR)/cmd.o \ - $(OUT_DIR)/crc.o \ - $(OUT_DIR)/mathlib.o \ - $(OUT_DIR)/math.o \ - $(OUT_DIR)/md4.o \ - $(OUT_DIR)/md5.o \ - $(OUT_DIR)/huff.o \ - $(OUT_DIR)/q2pmove.o \ - $(OUT_DIR)/net_chan.o \ - $(OUT_DIR)/net_win.o \ - $(OUT_DIR)/zone.o \ - $(OUT_DIR)/gl_q2bsp.o \ - $(OUT_DIR)/q1bsp.o \ - $(OUT_DIR)/pmove.o \ - $(OUT_DIR)/pmovetst.o \ - $(OUT_DIR)/iwebiface.o \ - $(OUT_DIR)/translate.o + common.o \ + cvar.o \ + cmd.o \ + crc.o \ + mathlib.o \ + math.o \ + md4.o \ + md5.o \ + huff.o \ + q2pmove.o \ + net_chan.o \ + net_win.o \ + zone.o \ + gl_q2bsp.o \ + q1bsp.o \ + pmove.o \ + pmovetst.o \ + iwebiface.o \ + translate.o + +VPATH=$(CLIENT_DIR):$(COMMON_DIR) all: all-rel all-dbg -$(OUT_DIR)/image.o : $(CLIENT_DIR)/image.c +.o : $(subst /, ,$(VPATH)) $@ $(DO_CC) +#$(OUT_DIR)/image.o : $(CLIENT_DIR)/image.c +# $(DO_CC) + $(OUT_DIR)/sw_screen.o : $(SW_DIR)/sw_screen.c $(DO_CC) $(OUT_DIR)/sw_draw.o : $(SW_DIR)/sw_draw.c diff --git a/engine/client/cl_ents.c b/engine/client/cl_ents.c index 20e7f4994..f0c7e747f 100644 --- a/engine/client/cl_ents.c +++ b/engine/client/cl_ents.c @@ -1592,8 +1592,8 @@ void CL_ParseProjectiles (int modelindex, qboolean nails2) pr->origin[0] = ( ( bits[0] + ((bits[1]&15)<<8) ) <<1) - 4096; pr->origin[1] = ( ( (bits[1]>>4) + (bits[2]<<4) ) <<1) - 4096; pr->origin[2] = ( ( bits[3] + ((bits[4]&15)<<8) ) <<1) - 4096; - pr->angles[0] = 360*(bits[4]>>4)/16; - pr->angles[1] = 360*bits[5]/256; + pr->angles[0] = 360*((int)bits[4]>>4)/16.0f; + pr->angles[1] = 360*(int)bits[5]/256.0f; } } @@ -1633,6 +1633,11 @@ void CL_LinkProjectiles (void) #endif VectorCopy (pr->origin, ent->origin); VectorCopy (pr->angles, ent->angles); + + ent->angles[0]*=-1; + AngleVectors(ent->angles, ent->axis[0], ent->axis[1], ent->axis[2]); + VectorInverse(ent->axis[1]); + ent->angles[0]*=-1; } } diff --git a/engine/client/cl_input.c b/engine/client/cl_input.c index 4aa2cfc37..13537d049 100644 --- a/engine/client/cl_input.c +++ b/engine/client/cl_input.c @@ -842,6 +842,32 @@ void CL_SendCmd (void) int clientcount; +#ifdef Q3CLIENT + if (cls.q2server==2) + { //guess what? q3 rules don't require network packet limiting! + usercmd_t ncmd; + + memset(&ncmd, 0, sizeof(ncmd)); + ncmd.msec = host_frametime*1000; + + CL_BaseMove (&ncmd, 0); + + // allow mice or other external controllers to add to the move + IN_Move (&ncmd, 0); + + // if we are spectator, try autocam + if (cl.spectator) + Cam_Track(0, &ncmd); + + CL_FinishMove(&ncmd, (int)(host_frametime*1000), 0); + + Cam_FinishMove(0, &ncmd); + + CLQ3_SendCmd(&ncmd); + return; + } +#endif + if (cls.demoplayback != DPB_NONE) { if (cls.demoplayback == DPB_MVD) diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 4cad16eaa..3ee6ac2df 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -81,6 +81,8 @@ cvar_t cl_predict_players = {"cl_predict_players", "1"}; cvar_t cl_predict_players2 = {"cl_predict_players2", "1"}; cvar_t cl_solid_players = {"cl_solid_players", "1"}; +cvar_t cl_demospeed = {"cl_demospeed", "0"}; + cvar_t localid = {"localid", ""}; static qboolean allowremotecmd = true; @@ -93,6 +95,7 @@ cvar_t spectator = {"spectator", "", NULL, CVAR_USERINFO}; cvar_t name = {"name", "unnamed", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; cvar_t team = {"team", "", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; cvar_t skin = {"skin", "", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; +cvar_t model = {"model", "", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; cvar_t topcolor = {"topcolor", "", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; cvar_t bottomcolor = {"bottomcolor", "", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; cvar_t rate = {"rate", "2500", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; @@ -399,7 +402,16 @@ void CL_SendConnectPacket ( clients = 1; #endif +#ifdef Q3CLIENT + if (cls.q2server==2) + { //q3 requires some very strange things. + CLQ3_SendConnectPacket(adr); + return; + } +#endif + sprintf(data, "%c%c%c%cconnect", 255, 255, 255, 255); + if (clients>1) //splitscreen 'connect' command specifies the number of userinfos sent. strcat(data, va("%i", clients)); @@ -764,6 +776,9 @@ void CL_Disconnect (void) // stop sounds (especially looping!) S_StopAllSounds (true); +#ifdef VM_CGAME + CG_Stop(); +#endif // if running a local server, shut it down if (cls.demoplayback != DPB_NONE) @@ -866,6 +881,8 @@ void CL_Disconnect (void) if (!isDedicated) #endif SCR_EndLoadingPlaque(); + + cls.q2server = 0; } #undef serverrunning @@ -1257,10 +1274,7 @@ void CL_SetInfo_f (void) { #ifdef Q2CLIENT if (cls.q2server) - { - MSG_WriteByte (&cls.netchan.message, clcq2_userinfo); - MSG_WriteString (&cls.netchan.message, cls.userinfo); - } + cls.resendinfo = true; else #endif Cmd_ForwardToServer (); @@ -1520,37 +1534,58 @@ void CL_ConnectionlessPacket (void) if (cls.demoplayback == DPB_NONE) Con_TPrintf (TL_ST_COLON, NET_AdrToString (net_from)); -// Con_DPrintf ("%s", net_message.data + 5); +// Con_DPrintf ("%s", net_message.data + 4); - if (c == S2C_CHALLENGE) { + if (c == S2C_CHALLENGE) + { unsigned long pext = 0, huffcrc=0; Con_TPrintf (TLC_S2C_CHALLENGE); s = MSG_ReadString (); COM_Parse(s); - if (!strcmp(com_token, "hallenge")) + if (!strcmp(com_token, "hallengeResponse")) + { +#ifdef Q3CLIENT + cls.q2server = 2; + cls.challenge = atoi(s+17); + CL_SendConnectPacket (0, 0/*, ...*/); + return; +#else + Con_Printf("\nUnable to connect to Quake3\n"); + return; +#endif + } + else if (!strcmp(com_token, "hallenge")) { char *s2; - for (s2 = s; *s; s++) + for (s2 = s+9; *s2; s2++) { - if ((*s < '0' || *s > '9') && *s != '-') + if ((*s2 < '0' || *s2 > '9') && *s2 != '-') break; } - if (*s) + if (*s2) {//and if it's not, we're unlikly to be compatable with whatever it is that's talking at us. #ifdef NQPROT CL_ConnectToDarkPlaces(s+9, net_from); #else - Con_Printf("Cannot connect to DarkPlaces\n"); + Con_Printf("\nUnable connect to DarkPlaces\n"); #endif return; } #ifdef Q2CLIENT cls.q2server = true; +#else + Con_Printf("\nUnable to connect to Quake2\n"); #endif s+=9; } +#ifdef Q3CLIENT + else if (!strcmp(com_token, "onnectResponse")) + { + goto client_connect; + } +#endif #ifdef Q2CLIENT else if (!strcmp(com_token, "lient_connect")) { @@ -1605,6 +1640,20 @@ void CL_ConnectionlessPacket (void) { goto client_connect; } + else if (!strcmp(s, "disconnect")) + { + if (NET_CompareAdr(net_from, cls.netchan.remote_address)) + { + Con_Printf ("disconnect\n"); + CL_Disconnect_f(); + return; + } + else + { + Con_Printf("Ignoring random disconnect command\n"); + return; + } + } else { Con_TPrintf (TLC_Q2CONLESSPACKET_UNKNOWN, s); @@ -1642,6 +1691,13 @@ void CL_ConnectionlessPacket (void) } #endif + if (c == 'd') //note - this conflicts with qw masters, our browser uses a different socket. + { + Con_Printf("Disconnect\n"); + CL_Disconnect_f(); + return; + } + if (c == S2C_CONNECTION) { int compress; @@ -1715,6 +1771,15 @@ client_connect: //fixme: make function return; } // print command from somewhere + if (c == 'p') + { + if (!strncmp(net_message.data+4, "print\n", 6)) + { + Con_TPrintf (TLC_A2C_PRINT); + Con_Print (net_message.data+10); + return; + } + } if (c == A2C_PRINT) { Con_TPrintf (TLC_A2C_PRINT); @@ -1808,6 +1873,14 @@ void CL_ReadPackets (void) if (cls.state == ca_disconnected) continue; //ignore it. We arn't connected. +#ifdef Q3CLIENT + if (cls.q2server == 2) + { + CLQ3_ParseServerMessage(); + continue; + } +#endif + if (cls.demoplayback == DPB_MVD) MSG_BeginReading(); else if (!Netchan_Process(&cls.netchan)) @@ -1852,7 +1925,7 @@ void CL_ReadPackets (void) // MSG_ReadLong(); #ifdef Q2CLIENT - if (cls.q2server) + if (cls.q2server) CLQ2_ParseServerMessage (); else #endif @@ -2074,6 +2147,7 @@ void CL_Init (void) Cvar_Register (&cfg_save_name, cl_controlgroup); + Cvar_Register (&cl_demospeed, "Demo playback"); Cvar_Register (&cl_warncmd, "Warnings"); Cvar_Register (&cl_upspeed, cl_inputgroup); Cvar_Register (&cl_forwardspeed, cl_inputgroup); @@ -2119,6 +2193,7 @@ void CL_Init (void) Cvar_Register (&password, cl_controlgroup); Cvar_Register (&spectator, cl_controlgroup); Cvar_Register (&skin, cl_controlgroup); + Cvar_Register (&model, cl_controlgroup); Cvar_Register (&team, cl_controlgroup); Cvar_Register (&topcolor, cl_controlgroup); Cvar_Register (&bottomcolor, cl_controlgroup); @@ -2429,6 +2504,9 @@ void Host_Frame (float time) time = recordavi_frametime; #endif + if (cls.demoplayback && cl_demospeed.value>0) + time *= cl_demospeed.value; + #ifndef CLIENTONLY RSpeedRemark(); SV_Frame(time); diff --git a/engine/client/cl_screen.c b/engine/client/cl_screen.c index 932d8046e..b713aedb5 100644 --- a/engine/client/cl_screen.c +++ b/engine/client/cl_screen.c @@ -111,9 +111,9 @@ extern cvar_t con_height; qboolean scr_initialized; // ready to draw -qpic_t *scr_ram; -qpic_t *scr_net; -qpic_t *scr_turtle; +mpic_t *scr_ram; +mpic_t *scr_net; +mpic_t *scr_turtle; int scr_fullupdate; @@ -433,7 +433,7 @@ void SCR_ShowPics_Draw(void) downloadlist_t *failed; float x, y; showpic_t *sp; - qpic_t *p; + mpic_t *p; for (sp = showpics; sp; sp = sp->next) { x = sp->x; @@ -747,12 +747,15 @@ void SCR_CrosshairPosition(int pnum, int *x, int *y) vec3_t start; vec3_t right, up, fwds; - AngleVectors(cl.viewangles[pnum], fwds, right, up); - VectorMA(cl.simorg[pnum], 100000, fwds, end); + AngleVectors(cl.simangles[pnum], fwds, right, up); + + VectorCopy(cl.simorg[pnum], start); + start[2]+=16; + VectorMA(start, 100000, fwds, end); memset(&tr, 0, sizeof(tr)); tr.fraction = 1; - cl.worldmodel->hulls->funcs.RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, cl.simorg[pnum], end, &tr); + cl.worldmodel->hulls->funcs.RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, start, end, &tr); if (tr.fraction == 1) { *x = rect.x + rect.width/2 + cl_crossx.value; @@ -761,11 +764,10 @@ void SCR_CrosshairPosition(int pnum, int *x, int *y) } else { - VectorCopy(cl.simorg[pnum], start); - start[2] -= cl.viewheight[pnum]/4; - ML_Project(tr.endpos, end, cl.viewangles[pnum], start, (float)rect.width/rect.height, r_refdef.fov_y); + start[2]+=cl.viewheight[pnum]/4; + ML_Project(tr.endpos, end, cl.simangles[pnum], start, (float)rect.width/rect.height, r_refdef.fov_y); *x = rect.x+rect.width*end[0]; - *y = rect.y+rect.height*end[1]; + *y = rect.y+rect.height*(1-end[1]); return; } } @@ -955,7 +957,7 @@ DrawPause */ void SCR_DrawPause (void) { - qpic_t *pic; + mpic_t *pic; if (!scr_showpause.value) // turn off for screenshots return; @@ -986,7 +988,7 @@ int total_loading_size, current_loading_size, loading_stage; char levelshotname[MAX_QPATH]; void SCR_DrawLoading (void) { - qpic_t *pic; + mpic_t *pic; if (!scr_drawloading) return; diff --git a/engine/client/cl_ui.c b/engine/client/cl_ui.c index 33ae6bf96..accdb024b 100644 --- a/engine/client/cl_ui.c +++ b/engine/client/cl_ui.c @@ -48,6 +48,9 @@ int VMUI_fopen (char *name, int *handle, int fmode, int owner) { int i; + if (!handle) + return FS_FLocateFile(name, FSLFRT_LENGTH, NULL); + *handle = 0; for (i = 0; i < MAX_VMUI_FILES; i++) @@ -317,6 +320,14 @@ typedef struct q3refEntity_s { float rotation; } q3refEntity_t; +#define Q2RF_VIEWERMODEL 2 // don't draw through eyes, only mirrors +#define Q2RF_WEAPONMODEL 4 // only draw through eyes +#define Q2RF_DEPTHHACK 16 // for view weapon Z crunching + + +#define Q3RF_THIRD_PERSON 2 // don't draw through eyes, only mirrors (player bodies, chat sprites) +#define Q3RF_FIRST_PERSON 4 // only draw through eyes (view weapon, damage blood blob) +#define Q3RF_DEPTHHACK 8 // for view weapon Z crunching void VQ3_AddEntity(const q3refEntity_t *q3) { entity_t ent; @@ -333,10 +344,94 @@ void VQ3_AddEntity(const q3refEntity_t *q3) ent.lerpfrac = ent.lerptime = q3->backlerp; ent.alpha = 1; ent.scale = 1; + *(int*)ent.shaderRGBA = *(int*)q3->shaderRGBA; + if (q3->renderfx & Q3RF_DEPTHHACK) + ent.flags |= Q2RF_DEPTHHACK; + if (q3->renderfx & Q3RF_THIRD_PERSON) + { + ent.flags |= Q2RF_VIEWERMODEL; + return; + } + if (q3->renderfx & Q3RF_FIRST_PERSON) + ent.flags |= Q2RF_WEAPONMODEL; VectorCopy(q3->origin, ent.origin); V_AddEntity(&ent); } +int VM_LerpTag(void *out, model_t *model, int f1, int f2, float l2, char *tagname) +{ + int tagnum; + float *ang; + float *org; + + float *org1; + float *ang1; + float *org2; + float *ang2; + + float l1; + + org = (float*)out; + ang = ((float*)out+3); + + l1 = 1-l2; + + + if (Mod_GetTag) + { + if (Mod_TagNumForName) + tagnum = Mod_TagNumForName(model, tagname); + else + tagnum = 0; + Mod_GetTag(model, tagnum, f1, &org1, &ang1); + Mod_GetTag(model, tagnum, f2, &org2, &ang2); + } + else + { + ang1=ang2=NULL; + org1=org2=NULL; //msvc was warning about this not being present. + } + if (ang1 && ang2) + { + org[0] = org1[0]*l1 + org2[0]*l2; + org[1] = org1[1]*l1 + org2[1]*l2; + org[2] = org1[2]*l1 + org2[2]*l2; + + ang[0] = ang1[0]*l1 + ang2[0]*l2; + ang[1] = ang1[1]*l1 + ang2[1]*l2; + ang[2] = ang1[2]*l1 + ang2[2]*l2; + + ang[3] = ang1[3]*l1 + ang2[3]*l2; + ang[4] = ang1[4]*l1 + ang2[4]*l2; + ang[5] = ang1[5]*l1 + ang2[5]*l2; + + ang[6] = ang1[6]*l1 + ang2[6]*l2; + ang[7] = ang1[7]*l1 + ang2[7]*l2; + ang[8] = ang1[8]*l1 + ang2[8]*l2; + + return true; + } + else + { + org[0] = 0; + org[1] = 0; + org[2] = 0; + + ang[0] = 1; + ang[1] = 0; + ang[2] = 0; + + ang[3] = 0; + ang[4] = 1; + ang[5] = 0; + + ang[6] = 0; + ang[7] = 0; + ang[8] = 1; + + return false; + } +} #define MAX_RENDER_STRINGS 8 #define MAX_RENDER_STRING_LENGTH 32 @@ -359,10 +454,11 @@ typedef struct q3refdef_s { // text messages for deform text shaders char text[MAX_RENDER_STRINGS][MAX_RENDER_STRING_LENGTH]; } q3refdef_t; + void VQ3_RenderView(const q3refdef_t *ref) { VectorCopy(ref->vieworg, r_refdef.vieworg); - r_refdef.viewangles[0] = (atan2(ref->viewaxis[0][2], sqrt(ref->viewaxis[0][1]*ref->viewaxis[0][1]+ref->viewaxis[0][0]*ref->viewaxis[0][0])) * 180 / M_PI); + r_refdef.viewangles[0] = -(atan2(ref->viewaxis[0][2], sqrt(ref->viewaxis[0][1]*ref->viewaxis[0][1]+ref->viewaxis[0][0]*ref->viewaxis[0][0])) * 180 / M_PI); r_refdef.viewangles[1] = (atan2(ref->viewaxis[0][1], ref->viewaxis[0][0]) * 180 / M_PI); r_refdef.viewangles[2] = 0; r_refdef.flags = ref->rdflags; @@ -372,9 +468,12 @@ void VQ3_RenderView(const q3refdef_t *ref) r_refdef.vrect.y = ref->y; r_refdef.vrect.width = ref->width; r_refdef.vrect.height = ref->height; + + memcpy(cl.q2frame.areabits, ref->areamask, sizeof(cl.q2frame.areabits)); #ifdef RGLQUAKE if (qrenderer == QR_OPENGL) { + gl_ztrickdisabled|=16; glDisable(GL_ALPHA_TEST); glDisable(GL_BLEND); } @@ -383,12 +482,21 @@ void VQ3_RenderView(const q3refdef_t *ref) #ifdef RGLQUAKE if (qrenderer == QR_OPENGL) { + gl_ztrickdisabled&=~16; GL_Set2D (); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); GL_TexEnv(GL_MODULATE); } #endif + #ifdef RGLQUAKE + if (qrenderer == QR_OPENGL) + { + glDisable(GL_ALPHA_TEST); + glEnable(GL_BLEND); + } +#endif + vid.recalc_refdef = 1; } @@ -623,130 +731,7 @@ long UI_SystemCallsEx(void *offset, unsigned int mask, int fn, const long *arg) // tag, model, startFrame, endFrame, frac, tagName if ((int)arg[0] + sizeof(float)*12 >= mask || VM_POINTER(arg[0]) < offset) break; //out of bounds. - - { - int tagnum; - float *ang; - float *org; - - float *org1; - float *ang1; - float *org2; - float *ang2; - - float l1; - float l2; - - int f1 = VM_LONG(arg[2]); - int f2 = VM_LONG(arg[3]); - - org = (float*)VM_POINTER(arg[0]); - ang = ((float*)VM_POINTER(arg[0])+3); - - l1 = 1-VM_FLOAT(arg[4]); - l2 = VM_FLOAT(arg[4]); - - - if (Mod_GetTag) - { - if (Mod_TagNumForName) - tagnum = Mod_TagNumForName((model_t *)VM_LONG(arg[1]), (char*)VM_POINTER(arg[5])); - else - tagnum = 0; - Mod_GetTag((model_t *)VM_LONG(arg[1]), tagnum, f1, &org1, &ang1); - Mod_GetTag((model_t *)VM_LONG(arg[1]), tagnum, f2, &org2, &ang2); - } - else - ang1=ang2=NULL; - if (ang1 && ang2) - { - org[0] = org1[0]*l1 + org2[0]*l2; - org[1] = org1[1]*l1 + org2[1]*l2; - org[2] = org1[2]*l1 + org2[2]*l2; - - ang[0] = ang1[0]*l1 + ang2[0]*l2; - ang[1] = ang1[1]*l1 + ang2[1]*l2; - ang[2] = ang1[2]*l1 + ang2[2]*l2; - - ang[3] = ang1[3]*l1 + ang2[3]*l2; - ang[4] = ang1[4]*l1 + ang2[4]*l2; - ang[5] = ang1[5]*l1 + ang2[5]*l2; - - ang[6] = ang1[6]*l1 + ang2[6]*l2; - ang[7] = ang1[7]*l1 + ang2[7]*l2; - ang[8] = ang1[8]*l1 + ang2[8]*l2; - } - else - { - org[0] = 0; - org[1] = 0; - org[2] = 0; - - ang[0] = 1; - ang[1] = 0; - ang[2] = 0; - - ang[3] = 0; - ang[4] = 1; - ang[5] = 0; - - ang[6] = 0; - ang[7] = 0; - ang[8] = 1; - } - } -/* - { -#ifdef RGLQUAKE - float *org1; - float *org2; - float l1; - float l2; - -// m3by3_t *ang1; -// m3by3_t *ang2; -#endif - m3by3_t *ang; - float *org; - - org = (float*)VM_POINTER(arg[0]); - ang = (m3by3_t *)((float*)VM_POINTER(arg[0])+3); - - switch(qrenderer) - { -#ifdef RGLQUAKE - case QR_OPENGL: - - GetTag((model_t *)VM_LONG(arg[1]), VM_POINTER(arg[5]), VM_LONG(arg[2]), &org1, &ang1); - GetTag((model_t *)VM_LONG(arg[1]), VM_POINTER(arg[5]), VM_LONG(arg[3]), &org2, &ang2); - - l1 = 1-VM_FLOAT(arg[4]); - l2 = VM_FLOAT(arg[4]); - - org[0] = org1[0]*l1 + org2[0]*l2; - org[1] = org1[1]*l1 + org2[1]*l2; - org[2] = org1[2]*l1 + org2[2]*l2; - - (*ang)[0][0] = (*ang1)[0][0]*l1 + (*ang2)[0][0]*l2; - (*ang)[0][1] = (*ang1)[0][1]*l1 + (*ang2)[0][1]*l2; - (*ang)[0][2] = (*ang1)[0][2]*l1 + (*ang2)[0][2]*l2; - - (*ang)[1][0] = (*ang1)[1][0]*l1 + (*ang2)[1][0]*l2; - (*ang)[1][1] = (*ang1)[1][1]*l1 + (*ang2)[1][1]*l2; - (*ang)[1][2] = (*ang1)[1][2]*l1 + (*ang2)[1][2]*l2; - - (*ang)[2][0] = (*ang1)[2][0]*l1 + (*ang2)[2][0]*l2; - (*ang)[2][1] = (*ang1)[2][1]*l1 + (*ang2)[2][1]*l2; - (*ang)[2][2] = (*ang1)[2][2]*l1 + (*ang2)[2][2]*l2; - break; -#endif - default: - memset(org, 0, sizeof(vec3_t)); - memset(ang, 0, sizeof(m3by3_t)); - break; - } - } - */ + VM_LerpTag(VM_POINTER(arg[0]), (model_t*)VM_LONG(arg[1]), VM_LONG(arg[2]), VM_LONG(arg[3]), VM_FLOAT(arg[4]), VM_POINTER(arg[5])); break; case UI_SOUND_PRECACHE: diff --git a/engine/client/client.h b/engine/client/client.h index 5c8f1581d..af8391866 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -167,6 +167,7 @@ typedef struct usercmd_t cmd[MAX_SPLITS]; // cmd that generated the frame double senttime; // time cmd was sent off int delta_sequence; // sequence number to delta from, -1 = full update + int cmd_sequence; // received from server double receivedtime; // time message was received, or -1 diff --git a/engine/client/console.c b/engine/client/console.c index 01e51de66..250c8c268 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -23,15 +23,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //this is the same order as q3, except that white and black are swapped... consolecolours_t consolecolours[] = { -#define CON_WHITEMASK 0*256 //must be constant. things assume this - {1, 1, 1}, +#define CON_WHITEMASK 7*256 //must be constant. things assume this + {0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {1, 1, 0}, {0.1, 0.1, 1}, //brighten dark blue a little {1, 0, 1}, {0, 1, 1}, - {0, 0, 0} + {1, 1, 1} }; int con_ormask; diff --git a/engine/client/m_items.c b/engine/client/m_items.c index c6f5a29c7..25f3d3696 100644 --- a/engine/client/m_items.c +++ b/engine/client/m_items.c @@ -7,7 +7,7 @@ qboolean bindingactive; void Draw_TextBox (int x, int y, int width, int lines) { - qpic_t *p; + mpic_t *p; int cx, cy; int n; @@ -76,7 +76,7 @@ void Draw_TextBox (int x, int y, int width, int lines) void Draw_BigFontString(int x, int y, const char *text) { int sx, sy; - qpic_t *p; + mpic_t *p; p = Draw_SafeCachePic ("gfx/menu/bigfont.lmp"); while(*text) @@ -111,7 +111,7 @@ int dotofs; void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu) { int i; - qpic_t *p; + mpic_t *p; while (option) { if (mousemoved && !bindingactive) @@ -419,7 +419,7 @@ menupicture_t *MC_AddPicture(menu_t *menu, int x, int y, char *picname) menupicture_t *MC_AddCenterPicture(menu_t *menu, int y, char *picname) { int x; - qpic_t *p; + mpic_t *p; if (!qrenderer) return NULL; @@ -1273,7 +1273,7 @@ void M_Menu_Main_f (void) extern cvar_t m_helpismedia; menubutton_t *b; menu_t *mainm; - qpic_t *p; + mpic_t *p; int q1, q2, h2; diff --git a/engine/client/m_mp3.c b/engine/client/m_mp3.c index 920146cca..07aac5da5 100644 --- a/engine/client/m_mp3.c +++ b/engine/client/m_mp3.c @@ -288,7 +288,7 @@ void Media_LoadTrackNames (char *listname); void M_Media_Draw (void) { - qpic_t *p; + mpic_t *p; mediatrack_t *track; int y; int op, i; diff --git a/engine/client/m_multi.c b/engine/client/m_multi.c index b5c90ee35..8d56c4b87 100644 --- a/engine/client/m_multi.c +++ b/engine/client/m_multi.c @@ -10,7 +10,7 @@ void M_Menu_MultiPlayer_f (void) { menubutton_t *b; menu_t *menu; - qpic_t *p; + mpic_t *p; p = Draw_SafeCachePic("gfx/mp_menu.lmp"); @@ -118,7 +118,7 @@ void MSetup_TransDraw (int x, int y, menucustom_t *option, menu_t *menu) { extern qbyte translationTable[256]; setupmenu_t *info = menu->data; - qpic_t *p; + mpic_t *p; p = Draw_CachePic ("gfx/bigbox.lmp"); Draw_TransPic (x-12, y-8, p); diff --git a/engine/client/m_options.c b/engine/client/m_options.c index 7152fe5df..237efa1df 100644 --- a/engine/client/m_options.c +++ b/engine/client/m_options.c @@ -358,7 +358,10 @@ void M_Menu_FPS_f (void) #ifdef RGLQUAKE extern cvar_t gl_compress, gl_waterripples, gl_detail, gl_bump, gl_2dscale, r_flashblend; #endif - extern cvar_t r_stains, r_bloodstains, r_loadlits, d_smooth, d_mipscale, d_mipcap, r_dynamic, v_contentblend, show_fps;; +#ifdef SWQUAKE + extern cvar_t d_smooth, d_mipscale, d_mipcap; +#endif + extern cvar_t r_stains, r_bloodstains, r_loadlits, r_dynamic, v_contentblend, show_fps; key_dest = key_menu; m_state = m_complex; diff --git a/engine/client/m_single.c b/engine/client/m_single.c index d4384ed97..2de74248e 100644 --- a/engine/client/m_single.c +++ b/engine/client/m_single.c @@ -30,7 +30,7 @@ void M_ScanSaves (void) strcpy (m_filenames[i], "--- UNUSED SLOT ---"); loadable[i] = false; - sprintf (name, "%s/s%i/info.fsv", com_gamedir, i); + sprintf (name, "%s/saves/s%i/info.fsv", com_gamedir, i); f = fopen (name, "rb"); if (f) { @@ -150,7 +150,7 @@ void M_Menu_SinglePlayer_f (void) int q1, q2, h2; menubutton_t *b; menu_t *menu; - qpic_t *p; + mpic_t *p; key_dest = key_menu; m_state = m_complex; diff --git a/engine/client/menu.c b/engine/client/menu.c index 9ac09f9d9..26ce4fce5 100644 --- a/engine/client/menu.c +++ b/engine/client/menu.c @@ -95,12 +95,12 @@ void M_PrintWhite (int cx, int cy, qbyte *str) } } -void M_DrawTransPic (int x, int y, qpic_t *pic) +void M_DrawTransPic (int x, int y, mpic_t *pic) { Draw_TransPic (x + ((vid.width - 320)>>1), y, pic); } -void M_DrawPic (int x, int y, qpic_t *pic) +void M_DrawPic (int x, int y, mpic_t *pic) { Draw_Pic (x + ((vid.width - 320)>>1), y, pic); } @@ -133,7 +133,7 @@ void M_BuildTranslationTable(int top, int bottom) } -void M_DrawTransPicTranslate (int x, int y, qpic_t *pic) +void M_DrawTransPicTranslate (int x, int y, mpic_t *pic) { Draw_TransPicTranslate (x + ((vid.width - 320)>>1), y, pic, translationTable); } @@ -141,7 +141,7 @@ void M_DrawTransPicTranslate (int x, int y, qpic_t *pic) void M_DrawTextBox (int x, int y, int width, int lines) { - qpic_t *p; + mpic_t *p; int cx, cy; int n; @@ -407,7 +407,7 @@ void M_Keys_Draw (void) int keys[2]; char *name; int x, y; - qpic_t *p; + mpic_t *p; p = Draw_SafeCachePic ("gfx/ttl_cstm.lmp"); if (p) @@ -549,7 +549,7 @@ void M_Menu_Help_f (void) void M_Help_Draw (void) { - qpic_t *pic; + mpic_t *pic; pic = Draw_SafeCachePic(va(helpstyle, help_page+helppagemin)); if (!pic) M_Menu_Main_f (); diff --git a/engine/client/menu.h b/engine/client/menu.h index 8acec5c93..b4131fc88 100644 --- a/engine/client/menu.h +++ b/engine/client/menu.h @@ -35,7 +35,7 @@ void M_Keydown (int key); void M_Keyup (int key); void M_Draw (int uimenu); void M_ToggleMenu_f (void); -qpic_t *M_CachePic (char *path); +mpic_t *M_CachePic (char *path); void M_DrawTextBox (int x, int y, int width, int lines); void M_Menu_Quit_f (void); @@ -283,12 +283,12 @@ void M_SListKey(int key); //drawing funcs void M_BuildTranslationTable(int top, int bottom); -void M_DrawTransPicTranslate (int x, int y, qpic_t *pic); -void M_DrawTransPic (int x, int y, qpic_t *pic); +void M_DrawTransPicTranslate (int x, int y, mpic_t *pic); +void M_DrawTransPic (int x, int y, mpic_t *pic); void M_DrawCharacter (int cx, int line, unsigned int num); void M_Print (int cx, int cy, qbyte *str); void M_PrintWhite (int cx, int cy, qbyte *str); -void M_DrawPic (int x, int y, qpic_t *pic); +void M_DrawPic (int x, int y, mpic_t *pic); void M_FindKeysForCommand (char *command, int *twokeys); diff --git a/engine/client/merged.h b/engine/client/merged.h index 5d5a04afd..423749e55 100644 --- a/engine/client/merged.h +++ b/engine/client/merged.h @@ -14,10 +14,10 @@ extern r_qrenderer_t qrenderer; extern char *q_renderername; -extern qpic_t *(*Draw_PicFromWad) (char *name); -extern qpic_t *(*Draw_SafePicFromWad) (char *name); -extern qpic_t *(*Draw_CachePic) (char *path); -extern qpic_t *(*Draw_SafeCachePic) (char *path); +extern mpic_t *(*Draw_PicFromWad) (char *name); +extern mpic_t *(*Draw_SafePicFromWad) (char *name); +extern mpic_t *(*Draw_CachePic) (char *path); +extern mpic_t *(*Draw_SafeCachePic) (char *path); extern void (*Draw_Init) (void); extern void (*Draw_ReInit) (void); extern void (*Draw_Character) (int x, int y, unsigned int num); @@ -26,11 +26,11 @@ extern void (*Draw_String) (int x, int y, const qbyte *str); extern void (*Draw_Alt_String) (int x, int y, const qbyte *str); extern void (*Draw_Crosshair) (void); extern void (*Draw_DebugChar) (qbyte num); -extern void (*Draw_Pic) (int x, int y, qpic_t *pic); -extern void (*Draw_ScalePic) (int x, int y, int width, int height, qpic_t *pic); -extern void (*Draw_SubPic) (int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height); -extern void (*Draw_TransPic) (int x, int y, qpic_t *pic); -extern void (*Draw_TransPicTranslate) (int x, int y, qpic_t *pic, qbyte *translation); +extern void (*Draw_Pic) (int x, int y, mpic_t *pic); +extern void (*Draw_ScalePic) (int x, int y, int width, int height, mpic_t *pic); +extern void (*Draw_SubPic) (int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height); +extern void (*Draw_TransPic) (int x, int y, mpic_t *pic); +extern void (*Draw_TransPicTranslate) (int x, int y, mpic_t *pic, qbyte *translation); extern void (*Draw_ConsoleBackground) (int lines); extern void (*Draw_EditorBackground) (int lines); extern void (*Draw_TileClear) (int x, int y, int w, int h); @@ -40,7 +40,7 @@ extern void (*Draw_BeginDisc) (void); extern void (*Draw_EndDisc) (void); extern qboolean (*Draw_IsCached) (char *picname); //can be null -extern void (*Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, qpic_t *pic); //gl-style scaled/coloured/subpic +extern void (*Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic); //gl-style scaled/coloured/subpic extern void (*Draw_ImageColours) (float r, float g, float b, float a); extern void (*R_Init) (void); diff --git a/engine/client/pr_menu.c b/engine/client/pr_menu.c index 1f1bbe133..c3487dcfe 100644 --- a/engine/client/pr_menu.c +++ b/engine/client/pr_menu.c @@ -509,7 +509,7 @@ void PF_CL_is_cached_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals) void PF_CL_precache_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals) { char *str; - qpic_t *pic; + mpic_t *pic; str = PR_GetStringOfs(prinst, OFS_PARM0); @@ -589,7 +589,7 @@ void PF_CL_drawpic (progfuncs_t *prinst, struct globalvars_s *pr_globals) { float *pos = G_VECTOR(OFS_PARM0); char *picname = PR_GetStringOfs(prinst, OFS_PARM1); - qpic_t *p = Draw_SafeCachePic(picname); + mpic_t *p = Draw_SafeCachePic(picname); float *size = G_VECTOR(OFS_PARM2); float *rgb = G_VECTOR(OFS_PARM3); float alpha = G_FLOAT(OFS_PARM4); @@ -642,7 +642,7 @@ void PF_CL_drawresetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globa void PF_CL_drawgetimagesize (progfuncs_t *prinst, struct globalvars_s *pr_globals) { char *picname = PR_GetStringOfs(prinst, OFS_PARM0); - qpic_t *p = Draw_SafeCachePic(picname); + mpic_t *p = Draw_SafeCachePic(picname); float *ret = G_VECTOR(OFS_RETURN); diff --git a/engine/client/r_part.c b/engine/client/r_part.c index c62463392..0fe889a03 100644 --- a/engine/client/r_part.c +++ b/engine/client/r_part.c @@ -696,19 +696,20 @@ void R_AssosiateEffect_f (void) int effectnum; model_t *model; - if ( strstr(modelname, "player") || + if (!cls.demoplayback && ( + strstr(modelname, "player") || strstr(modelname, "eyes") || strstr(modelname, "flag") || strstr(modelname, "tf_stan") || strstr(modelname, ".bsp") || - strstr(modelname, "turr")) + strstr(modelname, "turr"))) { Con_Printf("Sorry: Not allowed to attach effects to model \"%s\"\n", modelname); return; } model = Mod_FindName(modelname); - if (model->flags & EF_ROTATE) + if (!cls.demoplayback && (model->flags & EF_ROTATE)) { Con_Printf("Sorry: You may not assosiate effects with item model \"%s\"\n", modelname); return; @@ -727,10 +728,11 @@ void R_AssosiateTrail_f (void) int effectnum; model_t *model; - if ( strstr(modelname, "player") || + if (!cls.demoplayback && ( + strstr(modelname, "player") || strstr(modelname, "eyes") || strstr(modelname, "flag") || - strstr(modelname, "tf_stan")) + strstr(modelname, "tf_stan"))) { Con_Printf("Sorry, you can't assosiate trails with model \"%s\"\n", modelname); return; @@ -1190,6 +1192,13 @@ glEnable(GL_DEPTH_TEST); { // if (st->face->visframe != r_framecount) // continue; + + if (st->face->visframe != r_framecount) + { + st->nexttime = particletime; + continue; + } + while (st->nexttime < particletime) { if (!free_particles) @@ -1208,7 +1217,7 @@ glEnable(GL_DEPTH_TEST); if (Length(vdist) > (1024+512)*frandom()) continue; - + VectorMA(org, 0.5, st->face->normal, org); if (!(cl.worldmodel->hulls->funcs.HullPointContents(cl.worldmodel->hulls, org) & FTECONTENTS_SOLID)) { if (st->face->flags & SURF_PLANEBACK) @@ -3079,10 +3088,10 @@ void DrawParticleTypes (void texturedparticles(particle_t *,part_type_t*), void { if (traces-->0&&tr(oldorg, p->org, stop, normal)) { - R_AddStain(stop, p->rgb[1]*-10+p->rgb[2]*-10, - p->rgb[0]*-10+p->rgb[2]*-10, - p->rgb[0]*-10+p->rgb[1]*-10, - 30*p->alpha); + R_AddStain(stop, (p->rgb[1]*-10+p->rgb[2]*-10), + (p->rgb[0]*-10+p->rgb[2]*-10), + (p->rgb[0]*-10+p->rgb[1]*-10), + 30*p->alpha*type->stains); p->die = -1; continue; } diff --git a/engine/client/r_partset.c b/engine/client/r_partset.c index 4eb7f57f3..1e0891130 100644 --- a/engine/client/r_partset.c +++ b/engine/client/r_partset.c @@ -100,8 +100,9 @@ char *particle_set_spikeset = "r_part t_gib\n" "{\n" " texture \"particles/bloodtrail\"\n" -" step 1\n" -" scale 13\n" +" step 4\n" +" scale 30\n" +" scalefactor 1\n" " scaledelta 0\n" " alpha 0.7\n" " die 3\n" @@ -121,12 +122,13 @@ char *particle_set_spikeset = "{\n" " texture \"particles/bloodtrail\"\n" " count 1\n" -" scale 15\n" +" scale 25\n" +" scalefactor 1\n" " alpha 0.3\n" " die 10\n" " randomvel 256\n" " veeladd 128\n" -" red 192\n" +" red 112\n" " green 0\n" " blue 0\n" " reddelta -128\n" @@ -171,7 +173,7 @@ char *particle_set_spikeset = " count 1\n" " scale 15\n" " alpha 0.3\n" -" die 10\n" +" die 1\n" " randomvel 32\n" " veladd 32\n" " red 192\n" @@ -190,7 +192,7 @@ char *particle_set_spikeset = " count 256\n" " scale 1\n" " alpha 0.7\n" -" die 10\n" +" die 1\n" " randomvel 512\n" " veladd 128\n" " red 255\n" @@ -207,13 +209,13 @@ char *particle_set_spikeset = " count 256\n" " scale 1\n" " alpha 0.7\n" -" die 10\n" +" die 1\n" " randomvel 512\n" " veladd 128\n" " red 255\n" " green 128\n" " gravity 800\n" -" clliptype sparks\n" +" cliptype sparks\n" " clipcount 3\n" " blend add\n" " assoc sparks\n" @@ -225,7 +227,7 @@ char *particle_set_spikeset = " count 32\n" " scale 1\n" " alpha 0.7\n" -" die 10\n" +" die 1\n" " randomvel 512\n" " veladd 128\n" " red 255\n" diff --git a/engine/client/render.h b/engine/client/render.h index 9fe7d9ce7..25e17bf47 100644 --- a/engine/client/render.h +++ b/engine/client/render.h @@ -41,7 +41,9 @@ typedef struct entity_s int keynum; // for matching entities in different frames vec3_t origin; vec3_t angles; - vec3_t axis[3]; + vec3_t axis[3]; + + byte_vec4_t shaderRGBA; vec3_t oldorigin; vec3_t oldangles; diff --git a/engine/client/renderer.c b/engine/client/renderer.c index ee94ccf31..9d00b365c 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -104,7 +104,7 @@ cvar_t _vid_wait_override = {"_vid_wait_override", "0", NULL, CVAR_ARCHIVE|CVAR static cvar_t vid_stretch = {"vid_stretch","1", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; //cvar_t _windowed_mouse = {"_windowed_mouse","1", CVAR_ARCHIVE}; -static cvar_t gl_driver = {"gl_driver","OPENGL32", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; //opengl library +static cvar_t gl_driver = {"gl_driver","", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; //opengl library cvar_t vid_renderer = {"vid_renderer", "", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; static cvar_t vid_bpp = {"vid_bpp", "32", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; @@ -387,7 +387,7 @@ void R_InitTextures (void) qbyte *dest; // create a simple checkerboard texture for the default - r_notexture_mip = Hunk_AllocName (sizeof(texture_t) + 16*16+8*8+4*4+2*2, "notexture"); + r_notexture_mip = BZ_Malloc (sizeof(texture_t) + 16*16+8*8+4*4+2*2); r_notexture_mip->pixbytes = 1; r_notexture_mip->width = r_notexture_mip->height = 16; @@ -556,10 +556,10 @@ void Renderer_Init(void) } -qpic_t *(*Draw_PicFromWad) (char *name); -qpic_t *(*Draw_SafePicFromWad) (char *name); -qpic_t *(*Draw_CachePic) (char *path); -qpic_t *(*Draw_SafeCachePic) (char *path); +mpic_t *(*Draw_PicFromWad) (char *name); +mpic_t *(*Draw_SafePicFromWad) (char *name); +mpic_t *(*Draw_CachePic) (char *path); +mpic_t *(*Draw_SafeCachePic) (char *path); void (*Draw_Init) (void); void (*Draw_ReInit) (void); void (*Draw_Character) (int x, int y, unsigned int num); @@ -568,11 +568,11 @@ void (*Draw_String) (int x, int y, const qbyte *str); void (*Draw_Alt_String) (int x, int y, const qbyte *str); void (*Draw_Crosshair) (void); void (*Draw_DebugChar) (qbyte num); -void (*Draw_Pic) (int x, int y, qpic_t *pic); -void (*Draw_ScalePic) (int x, int y, int width, int height, qpic_t *pic); -void (*Draw_SubPic) (int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height); -void (*Draw_TransPic) (int x, int y, qpic_t *pic); -void (*Draw_TransPicTranslate) (int x, int y, qpic_t *pic, qbyte *translation); +void (*Draw_Pic) (int x, int y, mpic_t *pic); +void (*Draw_ScalePic) (int x, int y, int width, int height, mpic_t *pic); +void (*Draw_SubPic) (int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height); +void (*Draw_TransPic) (int x, int y, mpic_t *pic); +void (*Draw_TransPicTranslate) (int x, int y, mpic_t *pic, qbyte *translation); void (*Draw_ConsoleBackground) (int lines); void (*Draw_EditorBackground) (int lines); void (*Draw_TileClear) (int x, int y, int w, int h); @@ -581,7 +581,7 @@ void (*Draw_FadeScreen) (void); void (*Draw_BeginDisc) (void); void (*Draw_EndDisc) (void); -void (*Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, qpic_t *pic); //gl-style scaled/coloured/subpic +void (*Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic); //gl-style scaled/coloured/subpic void (*Draw_ImageColours) (float r, float g, float b, float a); void (*R_Init) (void); @@ -646,10 +646,10 @@ struct { char *name[4]; r_qrenderer_t rtype; - qpic_t *(*Draw_PicFromWad) (char *name); - qpic_t *(*Draw_SafePicFromWad) (char *name); - qpic_t *(*Draw_CachePic) (char *path); - qpic_t *(*Draw_SafeCachePic) (char *path); + mpic_t *(*Draw_PicFromWad) (char *name); + mpic_t *(*Draw_SafePicFromWad) (char *name); + mpic_t *(*Draw_CachePic) (char *path); + mpic_t *(*Draw_SafeCachePic) (char *path); void (*Draw_Init) (void); void (*Draw_ReInit) (void); void (*Draw_Character) (int x, int y, unsigned int num); @@ -658,11 +658,11 @@ struct { void (*Draw_Alt_String) (int x, int y, const qbyte *str); void (*Draw_Crosshair) (void); void (*Draw_DebugChar) (qbyte num); - void (*Draw_Pic) (int x, int y, qpic_t *pic); - void (*Draw_ScalePic) (int x, int y, int width, int height, qpic_t *pic); - void (*Draw_SubPic) (int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height); - void (*Draw_TransPic) (int x, int y, qpic_t *pic); - void (*Draw_TransPicTranslate) (int x, int y, qpic_t *pic, qbyte *translation); + void (*Draw_Pic) (int x, int y, mpic_t *pic); + void (*Draw_ScalePic) (int x, int y, int width, int height, mpic_t *pic); + void (*Draw_SubPic) (int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height); + void (*Draw_TransPic) (int x, int y, mpic_t *pic); + void (*Draw_TransPicTranslate) (int x, int y, mpic_t *pic, qbyte *translation); void (*Draw_ConsoleBackground) (int lines); void (*Draw_EditorBackground) (int lines); void (*Draw_TileClear) (int x, int y, int w, int h); @@ -671,7 +671,7 @@ struct { void (*Draw_BeginDisc) (void); void (*Draw_EndDisc) (void); - void (*Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, qpic_t *pic); //gl-style scaled/coloured/subpic + void (*Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic); //gl-style scaled/coloured/subpic void (*Draw_ImageColours) (float r, float g, float b, float a); void (*R_Init) (void); diff --git a/engine/client/sbar.c b/engine/client/sbar.c index a032dce35..47f21b0e5 100644 --- a/engine/client/sbar.c +++ b/engine/client/sbar.c @@ -65,31 +65,31 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. int sb_updates; // if >= vid.numpages, no update needed #define STAT_MINUS 10 // num frame for '-' stats digit -qpic_t *sb_nums[2][11]; -qpic_t *sb_colon, *sb_slash; -qpic_t *sb_ibar; -qpic_t *sb_sbar; -qpic_t *sb_scorebar; +mpic_t *sb_nums[2][11]; +mpic_t *sb_colon, *sb_slash; +mpic_t *sb_ibar; +mpic_t *sb_sbar; +mpic_t *sb_scorebar; -qpic_t *sb_weapons[7][8]; // 0 is active, 1 is owned, 2-5 are flashes -qpic_t *sb_ammo[4]; -qpic_t *sb_sigil[4]; -qpic_t *sb_armor[3]; -qpic_t *sb_items[32]; +mpic_t *sb_weapons[7][8]; // 0 is active, 1 is owned, 2-5 are flashes +mpic_t *sb_ammo[4]; +mpic_t *sb_sigil[4]; +mpic_t *sb_armor[3]; +mpic_t *sb_items[32]; -qpic_t *sb_faces[7][2]; // 0 is gibbed, 1 is dead, 2-6 are alive +mpic_t *sb_faces[7][2]; // 0 is gibbed, 1 is dead, 2-6 are alive // 0 is static, 1 is temporary animation -qpic_t *sb_face_invis; -qpic_t *sb_face_quad; -qpic_t *sb_face_invuln; -qpic_t *sb_face_invis_invuln; +mpic_t *sb_face_invis; +mpic_t *sb_face_quad; +mpic_t *sb_face_invuln; +mpic_t *sb_face_invis_invuln; //rogue pictures. -qpic_t *rsb_invbar[2]; -qpic_t *rsb_weapons[5]; -qpic_t *rsb_items[2]; -qpic_t *rsb_ammo[3]; -qpic_t *rsb_teambord; +mpic_t *rsb_invbar[2]; +mpic_t *rsb_weapons[5]; +mpic_t *rsb_items[2]; +mpic_t *rsb_ammo[3]; +mpic_t *rsb_teambord; //all must be found for any to be used. qboolean sb_showscores; @@ -580,9 +580,9 @@ Sbar_Init qboolean sbar_loaded; char *failedpic; -qpic_t *Sbar_PicFromWad(char *name) +mpic_t *Sbar_PicFromWad(char *name) { - qpic_t *ret; + mpic_t *ret; ret = Draw_SafePicFromWad(name); if (ret) @@ -743,7 +743,7 @@ void Sbar_Init (void) Sbar_DrawPic ============= */ -void Sbar_DrawPic (int x, int y, qpic_t *pic) +void Sbar_DrawPic (int x, int y, mpic_t *pic) { Draw_Pic (sbar_rect.x + x /* + ((sbar_rect.width - 320)>>1) */, sbar_rect.y + y + (sbar_rect.height-SBAR_HEIGHT), pic); } @@ -755,7 +755,7 @@ Sbar_DrawSubPic JACK: Draws a portion of the picture in the status bar. */ -void Sbar_DrawSubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height) +void Sbar_DrawSubPic(int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height) { Draw_SubPic (sbar_rect.x + x, sbar_rect.y + y+(sbar_rect.height-SBAR_HEIGHT), pic, srcx, srcy, width, height); } @@ -766,7 +766,7 @@ void Sbar_DrawSubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, i Sbar_DrawTransPic ============= */ -void Sbar_DrawTransPic (int x, int y, qpic_t *pic) +void Sbar_DrawTransPic (int x, int y, mpic_t *pic) { Draw_TransPic (sbar_rect.x + x /*+ ((sbar_rect.width - 320)>>1) */, sbar_rect.y + y + (sbar_rect.height-SBAR_HEIGHT), pic); } @@ -1436,11 +1436,6 @@ void Sbar_Draw (void) int deadcount=0; -#ifdef VM_CG - if (CG_Refresh()) - return; -#endif - if (scr_con_current == vid.height) return; // console is full screen @@ -1652,7 +1647,7 @@ added by Zoid */ void Sbar_TeamOverlay (void) { - qpic_t *pic; + mpic_t *pic; int i, k, l; int x, y; char num[12]; @@ -1742,7 +1737,7 @@ ping time frags name */ void Sbar_DeathmatchOverlay (int start) { - qpic_t *pic; + mpic_t *pic; int i, k, l; int top, bottom; int x, y, f; @@ -1904,7 +1899,7 @@ void Sbar_DeathmatchOverlay (int start) void Sbar_ChatModeOverlay(void) { int start =0; - qpic_t *pic; + mpic_t *pic; int i, k, l; int top, bottom; int x, y; @@ -2147,7 +2142,7 @@ void Sbar_MiniDeathmatchOverlay (void) void Sbar_CoopIntermission (void) { - qpic_t *pic; + mpic_t *pic; int dig; int num; @@ -2210,7 +2205,7 @@ Sbar_FinaleOverlay */ void Sbar_FinaleOverlay (void) { - qpic_t *pic; + mpic_t *pic; scr_copyeverything = 1; diff --git a/engine/client/snd_dma.c b/engine/client/snd_dma.c index 6ee8b55f6..f8579af54 100644 --- a/engine/client/snd_dma.c +++ b/engine/client/snd_dma.c @@ -1330,6 +1330,9 @@ void S_Update_(soundcardinfo_t *sc) if (!sound_started)// || (snd_blocked > 0)) return; + if (sc->selfpainting) + return; + // Updates DMA time GetSoundtime(sc); diff --git a/engine/client/snd_sdl.c b/engine/client/snd_sdl.c index 30271089a..b442e4592 100644 --- a/engine/client/snd_sdl.c +++ b/engine/client/snd_sdl.c @@ -1,4 +1,13 @@ #include "quakedef.h" +#include "winquake.h" + +#include + +extern cvar_t snd_khz; + +#define SOUND_BUFFER_SIZE 0x0400 + +int snd_inited; soundcardinfo_t *sndcardinfo; @@ -11,6 +20,11 @@ void SNDDMA_Submit(soundcardinfo_t *sc) } void SNDDMA_Shutdown(soundcardinfo_t *sc) { + if (snd_inited) + { + snd_inited = false; + SDL_CloseAudio(); + } } int SNDDMA_GetDMAPos(soundcardinfo_t *sc) { @@ -24,8 +38,47 @@ void S_UpdateCapture(void) //any ideas how to get microphone input? int SNDDMA_Init(soundcardinfo_t *sc) { - Con_Printf("SDL has no sound code\n"); - return 0; + SDL_AudioSpec desired, obtained; + + MessageBox(NULL, "hello", "fnar", 0); + + if(SDL_InitSubSystem(SDL_INIT_AUDIO)) + { + Con_Print("Couldn't initialize SDL audio subsystem\n"); + MessageBox(NULL, "hjkl", "fnar", 0); + return false; + } + + memset(&desired, 0, sizeof(desired)); + + if (!sc->sn.speed) + { + if (snd_khz.value >= 45) + sc->sn.speed = 48000; + else if (snd_khz.value >= 30) //set by a slider + sc->sn.speed = 44100; + else if (snd_khz.value >= 20) + sc->sn.speed = 22050; + else + sc->sn.speed = 11025; + } + + desired.freq = sc->sn.speed; + desired.channels = 2; + desired.samples = SOUND_BUFFER_SIZE; + desired.format = AUDIO_S16; + desired.callback = paint; + + if ( SDL_OpenAudio(&desired, &obtained) < 0 ) + { + Con_Printf("SDL: SNDDMA_Init: couldn't open sound device (%s).\n", SDL_GetError()); + MessageBox(NULL, "hello", "fghjfghjfgfnar", 0); + return false; + } + snd_inited = true; + SDL_PauseAudio(0); + MessageBox(NULL, "he;'lk'khjllo", "fnghkfghar", 0); + return true; } void SNDDMA_SetUnderWater(qboolean underwater) diff --git a/engine/client/sound.h b/engine/client/sound.h index 243d9b075..d896a3e4e 100644 --- a/engine/client/sound.h +++ b/engine/client/sound.h @@ -220,7 +220,8 @@ struct soundcardinfo_s { //windows has one defined AFTER directsound char name[256]; - + qboolean selfpainting; //allow the sound code to call the right functions when it feels the need. + //sdl uses this and runs multithreaded. qboolean inactive_sound; diff --git a/engine/client/sys_linux.c b/engine/client/sys_linux.c index d06f2f0e5..9dc0c83de 100644 --- a/engine/client/sys_linux.c +++ b/engine/client/sys_linux.c @@ -385,7 +385,7 @@ int Sys_EnumerateFiles (char *gpath, char *match, int (*func)(char *, int, void dir = opendir(truepath); if (!dir) { - Con_Printf("Failed to open dir"); + Con_DPrintf("Failed to open dir\n"); return true; } do @@ -522,7 +522,7 @@ int main (int c, char **v) parms.memsize = 16*1024*1024; j = COM_CheckParm("-mem"); - if (j) + if (j && j+1 < com_argc) parms.memsize = (int) (Q_atof(com_argv[j+1]) * 1024 * 1024); parms.membase = malloc (parms.memsize); diff --git a/engine/client/wad.h b/engine/client/wad.h index 5bb7efb12..b01900e68 100644 --- a/engine/client/wad.h +++ b/engine/client/wad.h @@ -36,12 +36,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define TYP_SOUND 67 #define TYP_MIPTEX 68 +//on disk representation of most q1 images. typedef struct { int width, height; qbyte data[4]; // variably sized } qpic_t; -extern qpic_t *draw_disc; // also used on sbar + +//this is what's actually used. +#define MPIC_ALPHA 1 +typedef struct //use this so we don't have to go slow over pics, and don't have to shift too much data around. +{ + unsigned int width; //keeps alignment (which is handy in 32bit modes) + unsigned short height; + qbyte flags; + qbyte pad; + qbyte data[4]; // variably sized +} mpic_t; + + +extern mpic_t *draw_disc; // also used on sbar typedef struct diff --git a/engine/client/winquake.h b/engine/client/winquake.h index e1f809e86..c7a542c1a 100644 --- a/engine/client/winquake.h +++ b/engine/client/winquake.h @@ -96,6 +96,8 @@ struct soundcardinfo_s { DWORD mmstarttime; DWORD gSndBufSize; + qboolean selfpainting; + qboolean inactive_sound; #ifndef NODIRECTX qboolean snd_isdirect; diff --git a/engine/client/zqtp.c b/engine/client/zqtp.c index fba63744a..ee3a2d226 100644 --- a/engine/client/zqtp.c +++ b/engine/client/zqtp.c @@ -2585,9 +2585,6 @@ static void CL_Say (qboolean team, char *extra) return; } - MSG_WriteByte (&cls.netchan.message, clc_stringcmd); - SZ_Print (&cls.netchan.message, team ? "say_team " : "say "); - s = TP_ParseMacroString (Cmd_Args()); Q_strncpyz (text, TP_ParseFunChars (s, true), sizeof(text)); @@ -2602,6 +2599,15 @@ static void CL_Say (qboolean team, char *extra) } strlcat (sendtext, text, sizeof(sendtext)); +#ifdef Q3CLIENT + if (cls.q2server==2) + { + CL_SendClientCommand("%s %s%s", team ? "say_team " : "say ", extra?extra:"", sendtext); + return; + } +#endif + MSG_WriteByte (&cls.netchan.message, cls.q2server?clcq2_stringcmd:clc_stringcmd); + SZ_Print (&cls.netchan.message, team ? "say_team " : "say "); if (sendtext[0] < 32) SZ_Print (&cls.netchan.message, "\""); // add quotes so that old servers parse the message correctly diff --git a/engine/common/bothdefs.h b/engine/common/bothdefs.h index 727c3d167..ffbc051fe 100644 --- a/engine/common/bothdefs.h +++ b/engine/common/bothdefs.h @@ -90,7 +90,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define NQPROT //server and client are capable of using quake1/netquake protocols. (qw is still prefered. uses the command 'nqconnect') #define FISH //sw rendering only #define VM_UI //support userinterfaces within Q3 Virtual Machines - //#define VM_CG //make work #define ZLIB //zip/pk3 support #define WEBSERVER //http/ftp servers #define WEBCLIENT //http/ftp clients. @@ -127,10 +126,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #undef AVAIL_ZLIB #endif -#if defined(VM_UI) || defined(VM_CG) - #define VM_ANY -#endif - #ifdef USE_MADLIB //global option. Specify on compiler command line. #define AVAIL_MP3 //suposedly anti-gpl. don't use in a distributed binary #endif @@ -159,6 +154,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef SERVERONLY //remove options that don't make sense on only a server #undef Q2CLIENT + #undef Q3CLIENT #undef WEBCLIENT #undef IRCCLIENT #undef EMAILCLIENT @@ -189,6 +185,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif #if !defined(Q3BSPS) #undef Q3SHADERS + #undef Q3CLIENT //reconsider this (later) +#endif + +#ifndef Q3CLIENT + #undef VM_CG // :( +#else + #define VM_CG +#endif + +#if defined(VM_UI) || defined(VM_CG) + #define VM_ANY #endif #define PROTOCOLEXTENSIONS diff --git a/engine/common/cmd.c b/engine/common/cmd.c index 822b3c3d2..3447909ed 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -760,8 +760,16 @@ void Cmd_Alias_f (void) } } } - a->execlevel = 0; //run at users exec level - a->restriction = 1; //this is possibly a security risk if the admin also changes execlevel + if (Cmd_FromServer()) + { + a->execlevel = RESTRICT_SERVER; //server-set aliases MUST run at the server's level. + a->restriction = 1; //and be runnable at the user's level + } + else + { + a->execlevel = 0; //run at users exec level + a->restriction = 1; //this is possibly a security risk if the admin also changes execlevel + } a->value = CopyString (cmd); } @@ -883,11 +891,15 @@ void Alias_WriteAliases (FILE *f) { // if ((cmd->restriction?cmd->restriction:rcon_level.value) > Cmd_ExecLevel) // continue; + if (cmd->flags & ALIAS_FROMSERVER) + continue; if (!num) - fprintf(f, "//////////////////\n//Aliases\n"); + fprintf(f, "\n//////////////////\n//Aliases\n"); fprintf(f, "alias %s \"%s\"\n", cmd->name, cmd->value); - fprintf(f, "restrict %s %i\n", cmd->name, cmd->restriction); - fprintf(f, "aliaslevel %s %i\n", cmd->name, cmd->execlevel); + if (cmd->restriction != 1) //1 is default + fprintf(f, "restrict %s %i\n", cmd->name, cmd->restriction); + if (cmd->execlevel != 0) //0 is default (runs at user's level) + fprintf(f, "aliaslevel %s %i\n", cmd->name, cmd->execlevel); num++; } } @@ -1537,6 +1549,14 @@ void Cmd_ForwardToServer (void) if (cls.demoplayback) return; // not really connected +#ifdef Q3CLIENT + if (cls.q2server == 2) + { + CL_SendClientCommand("%s %s", Cmd_Argv(0), Cmd_Args()); + return; + } +#endif + #ifdef Q2CLIENT MSG_WriteByte (&cls.netchan.message, cls.q2server?clcq2_stringcmd:clc_stringcmd); #else @@ -1567,6 +1587,14 @@ void Cmd_ForwardToServer_f (void) if (cls.demoplayback) return; // not really connected +#ifdef Q3CLIENT + if (cls.q2server == 2) + { + CL_SendClientCommand("%s", Cmd_Args()); + return; + } +#endif + if (Cmd_Argc() > 1) { #ifdef Q2CLIENT @@ -1696,12 +1724,17 @@ void Cmd_ExecuteString (char *text, int level) } #endif +#ifdef VM_CG + if (CG_Command()) + ; + else +#endif #ifdef Q2CLIENT - if (cls.q2server) + if (cls.q2server) Cmd_ForwardToServer(); else #endif - if (cl_warncmd.value || developer.value) + if (cl_warncmd.value || developer.value) Con_TPrintf (TL_COMMANDNOTDEFINED, Cmd_Argv(0)); } diff --git a/engine/common/common.c b/engine/common/common.c index b665d152e..c9b8d1fb4 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -818,6 +818,7 @@ void MSG_BeginReading (void) { msg_readcount = 0; msg_badread = false; + net_message.currentbit = 0; } int MSG_GetReadCount(void) @@ -825,10 +826,140 @@ int MSG_GetReadCount(void) return msg_readcount; } + +/* +============ +MSG_ReadRawBytes +============ +*/ +static int MSG_ReadRawBytes(sizebuf_t *msg, int bits) +{ + int bitmask = 0; + + if (bits <= 8) + { + bitmask = (unsigned char)msg->data[msg_readcount]; + msg_readcount++; + msg->currentbit += 8; + } + else if (bits <= 16) + { + bitmask = (unsigned short)(msg->data[msg_readcount] + + (msg->data[msg_readcount+1] << 8)); + msg_readcount += 2; + msg->currentbit += 16; + } + else if (bits <= 32) + { + bitmask = msg->data[msg_readcount] + + (msg->data[msg_readcount+1] << 8) + + (msg->data[msg_readcount+2] << 16) + + (msg->data[msg_readcount+3] << 24); + msg_readcount += 4; + msg->currentbit += 32; + } + + return bitmask; +} + +/* +============ +MSG_ReadRawBits +============ +*/ +static int MSG_ReadRawBits(sizebuf_t *msg, int bits) + { + int i; + int val; + int bitmask = 0; + + for(i=0 ; idata[msg->currentbit >> 3] >> (msg->currentbit & 7); + msg->currentbit++; + bitmask |= (val & 1) << i; + } + + return bitmask; +} + +/* +============ +MSG_ReadHuffBits +============ +*/ +static int MSG_ReadHuffBits(sizebuf_t *msg, int bits) +{ + int i; + int val; + int bitmask; + int remaining = bits & 7; + + bitmask = MSG_ReadRawBits(msg, remaining); + + for (i=0 ; idata, &msg->currentbit); + bitmask |= val << (i + remaining); + } + + msg_readcount = (msg->currentbit >> 3) + 1; + + return bitmask; +} + +int MSG_ReadBits(int bits) +{ + int i, val; + int bitmask = 0; + qboolean extend = false; + +#ifdef PARANOID + if (!bits || bits < -31 || bits > 32) + Host_EndGame("MSG_ReadBits: bad bits %i", bits ); +#endif + + if (bits < 0) + { + bits = -bits; + extend = true; + } + + switch(net_message.packing) + { + default: + case SZ_BAD: + Sys_Error("MSG_ReadBits: bad net_message.packing"); + break; + case SZ_RAWBYTES: + bitmask = MSG_ReadRawBytes(&net_message, bits); + break; + case SZ_RAWBITS: + bitmask = MSG_ReadRawBits(&net_message, bits); + break; + case SZ_HUFFMAN: + bitmask = MSG_ReadHuffBits(&net_message, bits); + break; + } + + if (extend) + { + if(bitmask & (1 << (bits - 1))) + { + bitmask |= ~((1 << bits) - 1); + } + } + + return bitmask; +} + // returns -1 and sets msg_badread if no more characters are available int MSG_ReadChar (void) { int c; + + if (net_message.packing!=SZ_RAWBYTES) + return (signed char)MSG_ReadBits(8); if (msg_readcount+1 > net_message.cursize) { @@ -844,7 +975,10 @@ int MSG_ReadChar (void) int MSG_ReadByte (void) { - int c; + unsigned char c; + + if (net_message.packing!=SZ_RAWBYTES) + return (unsigned char)MSG_ReadBits(8); if (msg_readcount+1 > net_message.cursize) { @@ -861,6 +995,9 @@ int MSG_ReadByte (void) int MSG_ReadShort (void) { int c; + + if (net_message.packing!=SZ_RAWBYTES) + return (short)MSG_ReadBits(16); if (msg_readcount+2 > net_message.cursize) { @@ -879,6 +1016,9 @@ int MSG_ReadShort (void) int MSG_ReadLong (void) { int c; + + if (net_message.packing!=SZ_RAWBYTES) + return (int)MSG_ReadBits(32); if (msg_readcount+4 > net_message.cursize) { @@ -905,6 +1045,12 @@ float MSG_ReadFloat (void) int l; } dat; + if (net_message.packing!=SZ_RAWBYTES) + { + dat.l = MSG_ReadBits(32); + return dat.f; + } + if (msg_readcount+4 > net_message.cursize) { msg_badread = true; diff --git a/engine/common/common.h b/engine/common/common.h index 2ddaadad0..ecc80e6b9 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -38,6 +38,12 @@ typedef enum {false, true} qboolean; //============================================================================ +typedef enum { + SZ_BAD, + SZ_RAWBYTES, + SZ_RAWBITS, + SZ_HUFFMAN //q3 style packets are horrible. +} sbpacking_t; typedef struct sizebuf_s { qboolean allowoverflow; // if false, do a Sys_Error @@ -45,6 +51,8 @@ typedef struct sizebuf_s qbyte *data; int maxsize; int cursize; + int packing; + int currentbit; } sizebuf_t; void SZ_Clear (sizebuf_t *buf); diff --git a/engine/common/cvar.c b/engine/common/cvar.c index 20cd2985d..dce33ada1 100644 --- a/engine/common/cvar.c +++ b/engine/common/cvar.c @@ -206,7 +206,18 @@ cvar_t *Cvar_SetCore (cvar_t *var, char *value, qboolean force) if (latch && !force) { if (cl_warncmd.value) - Con_Printf (latch, var->name); + { + if (var->latched_string) + { //already latched + if (strcmp(var->latched_string, value)) + Con_Printf (latch, var->name); + } + else + { //new latch + if (strcmp(var->string, value)) + Con_Printf (latch, var->name); + } + } if (var->latched_string && !strcmp(var->latched_string, value)) //no point, this would force the same return NULL; diff --git a/engine/common/gl_q2bsp.c b/engine/common/gl_q2bsp.c index 19773cc2b..aca26857a 100644 --- a/engine/common/gl_q2bsp.c +++ b/engine/common/gl_q2bsp.c @@ -1197,12 +1197,12 @@ void CMod_LoadTexInfo (lump_t *l) //yes I know these load from the same place _snprintf (name, sizeof(name), "textures/%s.wal", in->texture); out->texture = Mod_LoadWall (name); - if (!out->texture) + if (!out->texture || !out->texture->width || !out->texture->height) { - out->texture = Hunk_Alloc(sizeof(texture_t)); + out->texture = Hunk_Alloc(sizeof(texture_t) + 16*16+8*8+4*4+2*2); - Con_Printf ("Couldn't load %s\n", name); - memcpy(out->texture, &r_notexture_mip, sizeof(r_notexture_mip)); + Con_Printf ("^2Couldn't load %s\n", name); + memcpy(out->texture, r_notexture_mip, sizeof(texture_t) + 16*16+8*8+4*4+2*2); // out->texture = r_notexture_mip; // texture not found // out->flags = 0; } @@ -3503,6 +3503,7 @@ mplane_t *box_planes; int box_headnode; q2cbrush_t *box_brush; mleaf_t *box_leaf; +model_t box_model; /* =================== @@ -3520,6 +3521,17 @@ void CM_InitBoxHull (void) mplane_t *p; q2cbrushside_t *s; + + box_model.funcs.FatPVS = Q2BSP_FatPVS; + box_model.funcs.EdictInFatPVS = Q2BSP_EdictInFatPVS; + box_model.funcs.FindTouchedLeafs_Q1 = Q2BSP_FindTouchedLeafs; + box_model.funcs.MarkLights = Q2BSP_MarkLights; + box_model.funcs.LeafPVS = CM_LeafnumPVS; + box_model.funcs.LeafForPoint = CM_ModelPointLeafnum; + + box_model.hulls[0].available = true; + Q2BSP_SetHullFuncs(&box_model.hulls[0]); + box_headnode = numnodes; box_planes = &map_planes[numplanes]; if (numnodes+6 > MAX_Q2MAP_NODES @@ -3601,6 +3613,11 @@ int CM_HeadnodeForBox (vec3_t mins, vec3_t maxs) return box_headnode; } +model_t *CM_TempBoxModel(vec3_t mins, vec3_t maxs) +{ + box_model.hulls[0].firstclipnode = CM_HeadnodeForBox(mins, maxs); + return &box_model; +} /* ================== diff --git a/engine/common/net.h b/engine/common/net.h index b0b2d2e4d..23e669071 100644 --- a/engine/common/net.h +++ b/engine/common/net.h @@ -133,6 +133,17 @@ typedef struct int outgoing_size[MAX_LATENT]; double outgoing_time[MAX_LATENT]; qboolean compress; + +#ifdef Q3CLIENT + int inLength; + char inBuffer[MAX_UDP_PACKET]; + int inFragmentSequence; + + qboolean outFragment; + int outLength; + int outStart; + char outBuffer[MAX_UDP_PACKET]; +#endif } netchan_t; extern int net_drop; // packets dropped before this one diff --git a/engine/common/net_chan.c b/engine/common/net_chan.c index 9c54b3d26..84ac1d1b6 100644 --- a/engine/common/net_chan.c +++ b/engine/common/net_chan.c @@ -94,7 +94,7 @@ void Netchan_Init (void) // pick a port value that should be nice and random #ifdef _WIN32 - port = ((int)(timeGetTime()*1000) * time(NULL)) & 0xffff; + port = (time(NULL)) & 0xffff; #else port = ((int)(getpid()+getuid()*1000) * time(NULL)) & 0xffff; #endif diff --git a/engine/common/net_wins.c b/engine/common/net_wins.c index 9c5f20ae8..3f6d7e7ff 100644 --- a/engine/common/net_wins.c +++ b/engine/common/net_wins.c @@ -590,6 +590,8 @@ qboolean NET_GetLoopPacket (netsrc_t sock, netadr_t *from, sizebuf_t *message) message->cursize = loop->msgs[i].datalen; memset (from, 0, sizeof(*from)); from->type = NA_LOOPBACK; + message->packing = SZ_RAWBYTES; + message->currentbit = 0; return true; } @@ -693,6 +695,8 @@ qboolean NET_GetPacket (netsrc_t netsrc) } SockadrToNetadr (&from, &net_from); + net_message.packing = SZ_RAWBYTES; + net_message.currentbit = 0; net_message.cursize = ret; if (net_message.cursize == sizeof(net_message_buffer) ) { diff --git a/engine/common/plugin.c b/engine/common/plugin.c index e054dbc3e..61785b1f1 100644 --- a/engine/common/plugin.c +++ b/engine/common/plugin.c @@ -358,7 +358,7 @@ typedef struct { plugin_t *plugin; char name[64]; qboolean picfromwad; - qpic_t *pic; + mpic_t *pic; } pluginimagearray_t; int pluginimagearraylen; pluginimagearray_t *pluginimagearray; @@ -369,7 +369,7 @@ int Plug_Draw_LoadImage(void *offset, unsigned int mask, const long *arg) qboolean fromwad = arg[1]; int i; - qpic_t *pic; + mpic_t *pic; for (i = 0; i < pluginimagearraylen; i++) { @@ -430,15 +430,15 @@ void Plug_DrawReloadImages(void) } } -void GLDraw_Image(float x, float y, float w, float h, float s1, float t1, float s2, float t2, qpic_t *pic); -void SWDraw_Image (float xp, float yp, float wp, float hp, float s1, float t1, float s2, float t2, qpic_t *pic); //int Draw_Image (float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t image) int Plug_Draw_Image(void *offset, unsigned int mask, const long *arg) { - qpic_t *pic; + mpic_t *pic; int i; if (!qrenderer) return 0; + if (!Draw_Image) + return 0; i = VM_LONG(arg[8]); if (i < 0 || i >= pluginimagearraylen) @@ -453,24 +453,7 @@ int Plug_Draw_Image(void *offset, unsigned int mask, const long *arg) else pic = Draw_CachePic(pluginimagearray[i].name); -#ifdef RGLQUAKE - switch (qrenderer) - { - case QR_OPENGL: - glEnable(GL_BLEND); - glDisable(GL_DEPTH_TEST); - glDisable(GL_ALPHA_TEST); - GLDraw_Image(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), VM_FLOAT(arg[3]), VM_FLOAT(arg[4]), VM_FLOAT(arg[5]), VM_FLOAT(arg[6]), VM_FLOAT(arg[7]), pic); - break; - } -#endif - - if (Draw_Image) - { - Draw_Image(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), VM_FLOAT(arg[3]), VM_FLOAT(arg[4]), VM_FLOAT(arg[5]), VM_FLOAT(arg[6]), VM_FLOAT(arg[7]), pic); - return 1; - } - + Draw_Image(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), VM_FLOAT(arg[3]), VM_FLOAT(arg[4]), VM_FLOAT(arg[5]), VM_FLOAT(arg[6]), VM_FLOAT(arg[7]), pic); return 1; } diff --git a/engine/common/protocol.h b/engine/common/protocol.h index 867892d4a..a5182e6a6 100644 --- a/engine/common/protocol.h +++ b/engine/common/protocol.h @@ -624,6 +624,11 @@ enum { // must be power of two #define Q2UPDATE_MASK (Q2UPDATE_BACKUP-1) +#define Q3UPDATE_BACKUP 32 // copies of entity_state_t to keep buffered + // must be power of two +#define Q3UPDATE_MASK (Q3UPDATE_BACKUP-1) + + // entity_state_t is the information conveyed from the server // in an update message @@ -710,6 +715,8 @@ typedef struct usercmd_s short forwardmove, sidemove, upmove; qbyte impulse; qbyte lightlevel; + qbyte weapon; + int servertime; } usercmd_t; typedef struct q1usercmd_s diff --git a/engine/ftequake/FTEQuake.dev b/engine/ftequake/FTEQuake.dev index 6339c6909..145c8a55c 100644 --- a/engine/ftequake/FTEQuake.dev +++ b/engine/ftequake/FTEQuake.dev @@ -211,7 +211,7 @@ BuildCmd= Major=2 Minor=5 Release=5 -Build=29 +Build=32 LanguageID=2057 CharsetID=1252 CompanyName= diff --git a/engine/ftequake/ftequake.dsp b/engine/ftequake/ftequake.dsp index af61145e3..8900f10ff 100644 --- a/engine/ftequake/ftequake.dsp +++ b/engine/ftequake/ftequake.dsp @@ -159,7 +159,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client\gltod3d\sdk7\include" /I "..\client\gltod3d\D3DFrame" /I "..\dxsdk\sdk\inc" /I "..\scitech\include" /I "..\client" /D "NQPROT" /D "_DEBUG" /D "GLQUAKE" /D "SERVERDLL" /D "WIN32" /D "_WINDOWS" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /YX /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c -# ADD CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client" /I "../libs/dxsdk7/include" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "GLQUAKE" /D "SWQUAKE" /D "AVAIL_DX7" /D "ZQUAKETEAMPLAY" /Fr /Fp".\MDebug/qwcl.pch" /YX"quakedef.h" /FD /c +# ADD CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client" /I "../libs/dxsdk7/include" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "GLQUAKE" /D "SWQUAKE" /D "AVAIL_DX7" /Fr /Fp".\MDebug/qwcl.pch" /YX"quakedef.h" /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x809 /d "_DEBUG" @@ -484,6 +484,10 @@ SOURCE=..\client\cl_cam.c # End Source File # Begin Source File +SOURCE=..\client\cl_cg.c +# End Source File +# Begin Source File + SOURCE=..\client\cl_demo.c !IF "$(CFG)" == "ftequake - Win32 Release" @@ -836,6 +840,10 @@ SOURCE=..\client\clq2_ents.c # End Source File # Begin Source File +SOURCE=..\client\clq3_parse.c +# End Source File +# Begin Source File + SOURCE=..\client\console.c !IF "$(CFG)" == "ftequake - Win32 Release" diff --git a/engine/gl/gl_alias.c b/engine/gl/gl_alias.c index f5ef6949a..859be8cb9 100644 --- a/engine/gl/gl_alias.c +++ b/engine/gl/gl_alias.c @@ -94,6 +94,7 @@ typedef struct { int ofstransforms; //these exist only in the root mesh. + int numtagframes; int numtags; int ofstags; } galiasinfo_t; @@ -2585,6 +2586,8 @@ void GLMod_GetTag(model_t *model, int tagnum, int frame, float **org, float **ax t = (md3tag_t*)((char*)inf + inf->ofstags); if (tagnum <= 0 || tagnum > inf->numtags) return; + if (frame < 0 || frame >= inf->numtagframes) + return; tagnum--; //tagnum 0 is 'use my angles/org' t += tagnum; @@ -2606,7 +2609,7 @@ int GLMod_TagNumForName(model_t *model, char *name) t = (md3tag_t*)((char*)inf + inf->ofstags); for (i = 0; i < inf->numtags; i++) { - if (!strcmp(t->name, name)) + if (!strcmp(t[i].name, name)) return i+1; } return 0; @@ -2693,6 +2696,43 @@ typedef struct { } md3Shader_t; //End of Tenebrae 'assistance' +//This is a hack. It uses an assuption about q3 player models. +void GL_ParseQ3SkinFile(char *out, char *surfname, char *modelname) +{ + char *f, *p; + char line[256]; + COM_StripExtension(modelname, line); + strcat(line, "_default.skin"); + + f = COM_LoadTempFile2(line); + while(f) + { + f = COM_ParseToken(f); + if (!f) + return; + while(*f == ' ' || *f == '\t') + f++; + if (*f == ',') + { + if (!strcmp(com_token, surfname)) + { + f++; + COM_ParseToken(f); + strcpy(out, com_token); + return; + } + } + + p = strchr(f, '\n'); + if (!p) + f = f+strlen(f); + else + f = p+1; + if (!*f) + break; + } +} + void GL_LoadQ3Model(model_t *mod, void *buffer) { int hunkstart, hunkend, hunktotal; @@ -2738,13 +2778,6 @@ void GL_LoadQ3Model(model_t *mod, void *buffer) // if (header->version != sdfs) // Sys_Error("GL_LoadQ3Model: Bad version\n"); - if (header->numSurfaces < 1) - { - mod->type = mod_alias; - return; - } - - parent = NULL; root = NULL; @@ -2838,7 +2871,7 @@ void GL_LoadQ3Model(model_t *mod, void *buffer) char name[1024]; extern int gl_bumpmappingpossible; #endif - skin = Hunk_Alloc(surf->numShaders*(sizeof(galiasskin_t)+sizeof(galiastexnum_t))); + skin = Hunk_Alloc(surf->numShaders*((sizeof(galiasskin_t)+sizeof(galiastexnum_t)))); galias->ofsskins = (qbyte *)skin - (qbyte *)galias; texnum = (galiastexnum_t *)(skin + surf->numShaders); inshader = (md3Shader_t *)((qbyte *)surf + surf->ofsShaders); @@ -2850,6 +2883,9 @@ void GL_LoadQ3Model(model_t *mod, void *buffer) skin->skinwidth = 0; skin->skinheight = 0; skin->skinspeed = 0; + + if (!*inshader->name) //'fix' the shader by looking the surface name up in a skin file. This isn't perfect, but it does the job for basic models. + GL_ParseQ3SkinFile(inshader->name, surf->name, loadmodel->name); #ifdef Q3SHADERS texnum->shader = R_RegisterSkin(inshader->name); #else @@ -2926,6 +2962,10 @@ void GL_LoadQ3Model(model_t *mod, void *buffer) surf = (md3Surface_t *)((qbyte *)surf + surf->ofsEnd); } + if (!root) + root = Hunk_Alloc(sizeof(galiasinfo_t)); + + root->numtagframes = header->numFrames; root->numtags = header->numTags; root->ofstags = (char*)Hunk_Alloc(header->numTags*sizeof(md3tag_t)*header->numFrames) - (char*)root; memcpy((char*)root+root->ofstags, (char*)header+header->ofsTags, header->numTags*sizeof(md3tag_t)*header->numFrames); diff --git a/engine/gl/gl_backend.c b/engine/gl/gl_backend.c index 9660db159..a2137ca55 100644 --- a/engine/gl/gl_backend.c +++ b/engine/gl/gl_backend.c @@ -1932,23 +1932,21 @@ void R_ModifyColor ( meshbuffer_t *mb, shaderpass_t *pass ) break; case RGB_GEN_ENTITY: - Con_Printf("RGB_GEN_ENTITY\n"); - break; -/* for ( i = 0; i < numColors; i++, bArray += 4 ) { + for ( i = 0; i < numColors; i++, bArray += 4 ) + { *(int *)bArray = *(int *)currententity->shaderRGBA; } break; -*/ + case RGB_GEN_ONE_MINUS_ENTITY: - Con_Printf("RGB_GEN_ONE_MINUS_ENTITY\n"); - break; -/* for ( i = 0; i < numColors; i++, bArray += 4 ) { + for ( i = 0; i < numColors; i++, bArray += 4 ) + { bArray[0] = 255 - currententity->shaderRGBA[0]; bArray[1] = 255 - currententity->shaderRGBA[1]; bArray[2] = 255 - currententity->shaderRGBA[2]; } break; -*/ + case RGB_GEN_VERTEX: case RGB_GEN_EXACT_VERTEX: memcpy ( bArray, vArray, sizeof(byte_vec4_t)*numColors ); diff --git a/engine/gl/gl_draw.c b/engine/gl/gl_draw.c index 06612ce18..3f6a13a1e 100644 --- a/engine/gl/gl_draw.c +++ b/engine/gl/gl_draw.c @@ -65,8 +65,8 @@ extern cvar_t gl_savecompressedtex; extern cvar_t gl_load24bit; qbyte *draw_chars; // 8*8 graphic characters -qpic_t *draw_disc; -qpic_t *draw_backtile; +mpic_t *draw_disc; +mpic_t *draw_backtile; int translate_texture; int char_texture, char_tex2, default_char_texture; @@ -82,9 +82,9 @@ typedef struct float sl, tl, sh, th; } glpic_t; -qbyte conback_buffer[sizeof(qpic_t) + sizeof(glpic_t)]; -qbyte custconback_buffer[sizeof(qpic_t) + sizeof(glpic_t)]; -qpic_t *default_conback = (qpic_t *)&conback_buffer, *conback, *custom_conback = (qpic_t *)&custconback_buffer; +qbyte conback_buffer[sizeof(mpic_t) + sizeof(glpic_t)]; +qbyte custconback_buffer[sizeof(mpic_t) + sizeof(glpic_t)]; +mpic_t *default_conback = (mpic_t *)&conback_buffer, *conback, *custom_conback = (mpic_t *)&custconback_buffer; #include "hash.h" hashtable_t gltexturetable; @@ -188,7 +188,7 @@ void Scrap_Upload (void) typedef struct glcachepic_s { char name[MAX_QPATH]; - qpic_t pic; + mpic_t pic; qbyte padding[32]; // for appended glpic } glcachepic_t; @@ -201,7 +201,7 @@ qbyte menuplyr_pixels[4096]; int pic_texels; int pic_count; -qpic_t *GLDraw_IsCached(char *name) +mpic_t *GLDraw_IsCached(char *name) { glcachepic_t *pic; int i; @@ -213,7 +213,7 @@ qpic_t *GLDraw_IsCached(char *name) return NULL; } -qboolean Draw_RealPicFromWad (qpic_t *out, char *name) +qboolean Draw_RealPicFromWad (mpic_t *out, char *name) { qpic_t *in; glpic_t *gl; @@ -292,7 +292,7 @@ qboolean Draw_RealPicFromWad (qpic_t *out, char *name) } char *failedpic; //easier this way -qpic_t *GLDraw_SafePicFromWad (char *name) +mpic_t *GLDraw_SafePicFromWad (char *name) { int i; glcachepic_t *pic; @@ -315,20 +315,22 @@ qpic_t *GLDraw_SafePicFromWad (char *name) return &pic->pic; } -qpic_t *GLDraw_PicFromWad (char *name) +mpic_t *GLDraw_PicFromWad (char *name) { - qpic_t *pic = GLDraw_SafePicFromWad (name); + mpic_t *pic = GLDraw_SafePicFromWad (name); if (!pic) Sys_Error ("GLDraw_PicFromWad: failed to load %s", name); return pic; } -qpic_t *GLDraw_SafeCachePic (char *path) +mpic_t *GLDraw_SafeCachePic (char *path) { + int height; + qbyte *data; glcachepic_t *pic; int i; - qpic_t *dat; + qpic_t *qpic; glpic_t *gl; for (pic=glmenu_cachepics, i=0 ; iname, path); - if ((mem = ReadPCXFile((qbyte *)dat, com_filesize, &pic->pic.width, &pic->pic.height))) - { - gl = (glpic_t *)pic->pic.data; - if (!(gl->texnum = Mod_LoadReplacementTexture(alternatename, false, true, false))) - gl->texnum = GL_LoadTexture32(path, pic->pic.width, pic->pic.height, (unsigned *)dat, false, false); - gl->sl = 0; - gl->sh = 1; - gl->tl = 0; - gl->th = 1; - - BZ_Free(dat); - BZ_Free(mem); - glmenu_numcachepics++; - return &pic->pic; - } - BZ_Free(dat); - } - } - - { - char *mem; - char alternatename[MAX_QPATH]; - _snprintf(alternatename, MAX_QPATH-1, "%s", path); - dat = (qpic_t *)COM_LoadMallocFile (alternatename); - if (dat) - { - strcpy(pic->name, path); - mem = NULL; - if (!mem) - mem = ReadTargaFile((qbyte *)dat, com_filesize, &pic->pic.width, &pic->pic.height, 0); -#ifdef AVAIL_PNGLIB - if (!mem); - mem = ReadPNGFile((qbyte *)dat, com_filesize, &pic->pic.width, &pic->pic.height); -#endif -#ifdef AVAIL_JPEGLIB - if (!mem) - mem = ReadJPEGFile((qbyte *)dat, com_filesize, &pic->pic.width, &pic->pic.height); -#endif - if (!mem) - mem = ReadPCXFile((qbyte *)dat, com_filesize, &pic->pic.width, &pic->pic.height); - if (mem) - { - gl = (glpic_t *)pic->pic.data; - if (!(gl->texnum = Mod_LoadReplacementTexture(alternatename, false, true, false))) - gl->texnum = GL_LoadTexture32(path, pic->pic.width, pic->pic.height, (unsigned *)dat, false, true); - gl->sl = 0; - gl->sh = 1; - gl->tl = 0; - gl->th = 1; - - BZ_Free(dat); - BZ_Free(mem); - glmenu_numcachepics++; - return &pic->pic; - } - BZ_Free(dat); - } - } - -#ifdef AVAIL_JPEGLIB - { - char *mem; - char alternatename[MAX_QPATH]; - _snprintf(alternatename, MAX_QPATH-1,"%s.jpg", path); - dat = (qpic_t *)COM_LoadMallocFile (alternatename); - if (dat) - { - strcpy(pic->name, path); - if ((mem = ReadJPEGFile((qbyte *)dat, com_filesize, &pic->pic.width, &pic->pic.height))) + if ((mem = ReadPCXFile(data, com_filesize, &pic->pic.width, &height))) { + pic->pic.height = height; gl = (glpic_t *)pic->pic.data; if (!(gl->texnum = Mod_LoadReplacementTexture(alternatename, false, true, false))) gl->texnum = GL_LoadTexture32(path, pic->pic.width, pic->pic.height, (unsigned *)mem, false, false); @@ -429,12 +364,82 @@ qpic_t *GLDraw_SafeCachePic (char *path) gl->tl = 0; gl->th = 1; - BZ_Free(dat); + BZ_Free(data); BZ_Free(mem); glmenu_numcachepics++; return &pic->pic; } - BZ_Free(dat); + BZ_Free(data); + } + } + + { + char *mem; + char alternatename[MAX_QPATH]; + _snprintf(alternatename, MAX_QPATH-1, "%s", path); + data = COM_LoadMallocFile (alternatename); + if (data) + { + strcpy(pic->name, path); + mem = NULL; + if (!mem) + mem = ReadTargaFile((qbyte *)data, com_filesize, &pic->pic.width, &height, 0); +#ifdef AVAIL_PNGLIB + if (!mem); + mem = ReadPNGFile((qbyte *)data, com_filesize, &pic->pic.width, &height); +#endif +#ifdef AVAIL_JPEGLIB + if (!mem) + mem = ReadJPEGFile((qbyte *)data, com_filesize, &pic->pic.width, &height); +#endif + if (!mem) + mem = ReadPCXFile((qbyte *)data, com_filesize, &pic->pic.width, &height); + pic->pic.height = height; + if (mem) + { + gl = (glpic_t *)pic->pic.data; + if (!(gl->texnum = Mod_LoadReplacementTexture(alternatename, false, true, false))) + gl->texnum = GL_LoadTexture32(path, pic->pic.width, pic->pic.height, (unsigned *)mem, false, true); + gl->sl = 0; + gl->sh = 1; + gl->tl = 0; + gl->th = 1; + + BZ_Free(data); + BZ_Free(mem); + glmenu_numcachepics++; + return &pic->pic; + } + BZ_Free(data); + } + } + +#ifdef AVAIL_JPEGLIB + { + char *mem; + char alternatename[MAX_QPATH]; + _snprintf(alternatename, MAX_QPATH-1,"%s.jpg", path); + data = COM_LoadMallocFile (alternatename); + if (data) + { + strcpy(pic->name, path); + if ((mem = ReadJPEGFile(data, com_filesize, &pic->pic.width, &height))) + { + pic->pic.height = height; + gl = (glpic_t *)pic->pic.data; + if (!(gl->texnum = Mod_LoadReplacementTexture(alternatename, false, true, false))) + gl->texnum = GL_LoadTexture32(path, pic->pic.width, pic->pic.height, (unsigned *)mem, false, false); + gl->sl = 0; + gl->sh = 1; + gl->tl = 0; + gl->th = 1; + + BZ_Free(data); + BZ_Free(mem); + glmenu_numcachepics++; + return &pic->pic; + } + BZ_Free(data); } } #endif @@ -466,25 +471,26 @@ qpic_t *GLDraw_SafeCachePic (char *path) } } */ - dat = (qpic_t *)COM_LoadTempFile (path); - if (!dat) + qpic = (qpic_t *)COM_LoadTempFile (path); + if (!qpic) { char alternatename[MAX_QPATH]; sprintf(alternatename, "gfx/%s.lmp", path); - dat = (qpic_t *)COM_LoadTempFile (alternatename); - if (!dat) + qpic = (qpic_t *)COM_LoadTempFile (alternatename); + if (!qpic) return GLDraw_SafePicFromWad(path); } - SwapPic (dat); + SwapPic (qpic); - if (((8+dat->width*dat->height+3)&(~3)) != ((com_filesize+3)&(~3))) //round up to the nearest 4. - { + if (((8+qpic->width*qpic->height+3)&(~3)) != ((com_filesize+3)&(~3))) //round up to the nearest 4. + { //the filesize didn't match what we were expecting, so it can't be a lmp. reject it. char alternatename[MAX_QPATH]; sprintf(alternatename, "gfx/%s.lmp", path); - dat = (qpic_t *)COM_LoadTempFile (alternatename); - if (!dat) + qpic = (qpic_t *)COM_LoadTempFile (alternatename); + if (!qpic) return GLDraw_SafePicFromWad(path); + SwapPic (qpic); } // HACK HACK HACK --- we need to keep the bytes for @@ -492,19 +498,19 @@ qpic_t *GLDraw_SafeCachePic (char *path) // configuration dialog if (!strncmp (path, "gfx/player/", 11) || !strcmp (path, "gfx/menuplyr.lmp")) //these arn't cached. I hate hacks. - memcpy (menuplyr_pixels, dat->data, dat->width*dat->height); + memcpy (menuplyr_pixels, qpic->data, qpic->width*qpic->height); else { glmenu_numcachepics++; Q_strncpyz (pic->name, path, sizeof(pic->name)); } - pic->pic.width = dat->width; - pic->pic.height = dat->height; + pic->pic.width = qpic->width; + pic->pic.height = qpic->height; gl = (glpic_t *)pic->pic.data; if (!(gl->texnum = Mod_LoadReplacementTexture(path, false, true, false))) - gl->texnum = GL_LoadPicTexture (dat); + gl->texnum = GL_LoadPicTexture (qpic); gl->sl = 0; gl->sh = 1; gl->tl = 0; @@ -512,9 +518,9 @@ qpic_t *GLDraw_SafeCachePic (char *path) return &pic->pic; } -qpic_t *GLDraw_CachePic (char *path) +mpic_t *GLDraw_CachePic (char *path) { - qpic_t *pic = GLDraw_SafeCachePic (path); + mpic_t *pic = GLDraw_SafeCachePic (path); if (!pic) Sys_Error ("GLDraw_CachePic: failed to load %s", path); @@ -812,7 +818,7 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n")); glClear(GL_COLOR_BUFFER_BIT); { - qpic_t *pic = Draw_SafeCachePic ("loading"); + mpic_t *pic = Draw_SafeCachePic ("loading"); if (pic) Draw_Pic ( (vid.width - pic->width)/2, (vid.height - 48 - pic->height)/2, pic); @@ -1320,7 +1326,7 @@ void GLDraw_DebugChar (qbyte num) Draw_Pic ============= */ -void GLDraw_Pic (int x, int y, qpic_t *pic) +void GLDraw_Pic (int x, int y, mpic_t *pic) { glpic_t *gl; @@ -1370,7 +1376,7 @@ void GLDraw_Pic (int x, int y, qpic_t *pic) #endif } -void GLDraw_ScalePic (int x, int y, int width, int height, qpic_t *pic) +void GLDraw_ScalePic (int x, int y, int width, int height, mpic_t *pic) { glpic_t *gl; @@ -1399,7 +1405,7 @@ void GLDraw_ScalePic (int x, int y, int width, int height, qpic_t *pic) Draw_AlphaPic ============= */ -void GLDraw_AlphaPic (int x, int y, qpic_t *pic, float alpha) +void GLDraw_AlphaPic (int x, int y, mpic_t *pic, float alpha) { glpic_t *gl; @@ -1427,7 +1433,7 @@ void GLDraw_AlphaPic (int x, int y, qpic_t *pic, float alpha) glDisable (GL_BLEND); } -void GLDraw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height) +void GLDraw_SubPic(int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height) { glpic_t *gl; float newsl, newtl, newsh, newth; @@ -1488,7 +1494,7 @@ void GLDraw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int Draw_TransPic ============= */ -void GLDraw_TransPic (int x, int y, qpic_t *pic) +void GLDraw_TransPic (int x, int y, mpic_t *pic) { if (!pic) return; @@ -1511,7 +1517,7 @@ Draw_TransPicTranslate Only used for the player color selection menu ============= */ -void GLDraw_TransPicTranslate (int x, int y, qpic_t *pic, qbyte *translation) +void GLDraw_TransPicTranslate (int x, int y, mpic_t *pic, qbyte *translation) { int v, u, c; unsigned trans[64*64], *dest; @@ -1695,7 +1701,7 @@ void GLDraw_ImageColours(float r, float g, float b, float a) glColor4f(r, g, b, a); } -void GLDraw_Image(float x, float y, float w, float h, float s1, float t1, float s2, float t2, qpic_t *pic) +void GLDraw_Image(float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic) { glpic_t *gl; diff --git a/engine/gl/gl_draw.h b/engine/gl/gl_draw.h index 5b8f6412e..59afaef7c 100644 --- a/engine/gl/gl_draw.h +++ b/engine/gl/gl_draw.h @@ -28,11 +28,11 @@ void GLSurf_DeInit (void); void GLDraw_Character (int x, int y, unsigned int num); void GLDraw_ColouredCharacter (int x, int y, unsigned int num); void GLDraw_DebugChar (qbyte num); -void GLDraw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height); -void GLDraw_Pic (int x, int y, qpic_t *pic); -void GLDraw_ScalePic (int x, int y, int width, int height, qpic_t *pic); -void GLDraw_TransPic (int x, int y, qpic_t *pic); -void GLDraw_TransPicTranslate (int x, int y, qpic_t *pic, qbyte *translation); +void GLDraw_SubPic(int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height); +void GLDraw_Pic (int x, int y, mpic_t *pic); +void GLDraw_ScalePic (int x, int y, int width, int height, mpic_t *pic); +void GLDraw_TransPic (int x, int y, mpic_t *pic); +void GLDraw_TransPicTranslate (int x, int y, mpic_t *pic, qbyte *translation); void GLDraw_ConsoleBackground (int lines); void GLDraw_EditorBackground (int lines); void GLDraw_BeginDisc (void); @@ -42,12 +42,12 @@ void GLDraw_Fill (int x, int y, int w, int h, int c); void GLDraw_FadeScreen (void); void GLDraw_String (int x, int y, const qbyte *str); void GLDraw_Alt_String (int x, int y, const qbyte *str); -qpic_t *GLDraw_SafePicFromWad (char *name); -qpic_t *GLDraw_PicFromWad (char *name); -qpic_t *GLDraw_SafeCachePic (char *path); -qpic_t *GLDraw_CachePic (char *path); +mpic_t *GLDraw_SafePicFromWad (char *name); +mpic_t *GLDraw_PicFromWad (char *name); +mpic_t *GLDraw_SafeCachePic (char *path); +mpic_t *GLDraw_CachePic (char *path); void GLDraw_Crosshair(void); -void GLDraw_LevelPic (qpic_t *pic); +void GLDraw_LevelPic (mpic_t *pic); void GLDraw_ImageColours(float r, float g, float b, float a); -void GLDraw_Image(float x, float y, float w, float h, float s1, float t1, float s2, float t2, qpic_t *pic); +void GLDraw_Image(float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic); diff --git a/engine/gl/gl_ppl.c b/engine/gl/gl_ppl.c index c2bf1a5aa..c40c820e6 100644 --- a/engine/gl/gl_ppl.c +++ b/engine/gl/gl_ppl.c @@ -1481,6 +1481,8 @@ static void PPL_BaseChain_NPR_Sketch(msurface_t *first) { for (s = first; s ; s=s->texturechain) { + if (!s->polys) + continue; glBegin(GL_LINE_LOOP); for (i=s->polys->numverts-1; i>=0; i--) glVertex3f( s->polys->verts[i][0]+5*(rand()/(float)RAND_MAX-0.5), @@ -3998,6 +4000,13 @@ void PPL_DrawWorld (void) int maxshadowlights = gl_maxshadowlights.value; + if (!lightmap) + { + R_PreNewMap(); + R_NewMap(); + return; // :/ + } + if (maxshadowlights < 1) maxshadowlights = 1; // if (qglGetError()) diff --git a/engine/gl/gl_rmain.c b/engine/gl/gl_rmain.c index 27daf4500..57c427ff5 100644 --- a/engine/gl/gl_rmain.c +++ b/engine/gl/gl_rmain.c @@ -588,7 +588,7 @@ void GLR_DrawEntitiesOnList (void) switch (currententity->model->type) { case mod_alias: - if (!cl.worldmodel || cl.worldmodel->fromgame == fg_doom) + if (r_refdef.flags & 1 || !cl.worldmodel || cl.worldmodel->fromgame == fg_doom) R_DrawGAliasModel (currententity); break; diff --git a/engine/gl/gl_rsurf.c b/engine/gl/gl_rsurf.c index 29cedc2ef..f3429d8bb 100644 --- a/engine/gl/gl_rsurf.c +++ b/engine/gl/gl_rsurf.c @@ -3106,7 +3106,7 @@ static void GLR_LeafWorldNode (void) { if (! (areabits[pleaf->area>>3] & (1<<(pleaf->area&7)) ) ) { - continue; // not visible + // continue; // not visible } } diff --git a/engine/gl/gl_screen.c b/engine/gl/gl_screen.c index 544257ae7..0e4051e01 100644 --- a/engine/gl/gl_screen.c +++ b/engine/gl/gl_screen.c @@ -111,13 +111,14 @@ void RSpeedShow(void) } } -void SCR_DrawTwoDimensional(int uimenu) +void SCR_DrawTwoDimensional(int uimenu, qboolean nohud) { RSpeedMark(); // // draw any areas not covered by the refresh // - SCR_TileClear (); + if (!nohud) + SCR_TileClear (); if (r_netgraph.value) GLR_NetGraph (); @@ -125,7 +126,8 @@ void SCR_DrawTwoDimensional(int uimenu) if (scr_drawdialog) { #ifdef PLUGINS - Plug_SBar (); + if (!nohud) + Plug_SBar (); #endif SCR_ShowPics_Draw(); Draw_FadeScreen (); @@ -154,19 +156,24 @@ void SCR_DrawTwoDimensional(int uimenu) { } else - { - Draw_Crosshair(); + { + if (!nohud) + { + Draw_Crosshair(); - SCR_DrawRam (); - SCR_DrawNet (); - SCR_DrawFPS (); - SCR_DrawUPS (); - SCR_DrawTurtle (); - SCR_DrawPause (); + SCR_DrawRam (); + SCR_DrawNet (); + SCR_DrawFPS (); + SCR_DrawUPS (); + SCR_DrawTurtle (); + SCR_DrawPause (); #ifdef PLUGINS - Plug_SBar (); + Plug_SBar (); #endif - SCR_ShowPics_Draw(); + SCR_ShowPics_Draw(); + } + else + SCR_DrawFPS (); SCR_CheckDrawCenterString (); glTexEnvi ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); #ifdef TEXTEDITOR @@ -200,6 +207,7 @@ void GLSCR_UpdateScreen (void) #ifdef TEXTEDITOR extern qboolean editormodal, editoractive; #endif + qboolean nohud; RSpeedMark(); if (block_drawing) @@ -328,7 +336,14 @@ void GLSCR_UpdateScreen (void) // do 3D refresh drawing, and then update the screen // SCR_SetUpToDrawConsole (); - if (cl.worldmodel && uimenu != 1) + + nohud = false; +#ifdef VM_CG + if (CG_Refresh()) + nohud = true; + else +#endif + if (cl.worldmodel && uimenu != 1) V_RenderView (); else GL_DoSwap(); @@ -337,7 +352,7 @@ void GLSCR_UpdateScreen (void) GLR_BrightenScreen(); - SCR_DrawTwoDimensional(uimenu); + SCR_DrawTwoDimensional(uimenu, nohud); GLV_UpdatePalette (); #if defined(_WIN32) && defined(RGLQUAKE) diff --git a/engine/gl/gl_vidnt.c b/engine/gl/gl_vidnt.c index c1273b7d1..7212bbc32 100644 --- a/engine/gl/gl_vidnt.c +++ b/engine/gl/gl_vidnt.c @@ -219,13 +219,17 @@ qboolean GLInitialise (char *renderer) Con_Printf ("Loading renderer dll %s\n", renderer); hInstGL = LoadLibrary(opengldllname); + if (!hInstGL) + { + hInstGL = LoadLibrary("opengl32"); + } if (!hInstGL) { Con_Printf ("Couldn't load %s\n", opengldllname); return false; } - Con_DPrintf ("Loaded renderer dll %s\n", renderer); + Con_DPrintf ("Loaded renderer dll %s\n", opengldllname); // windows dependant qwglCreateContext = (void *)getwglfunc("wglCreateContext"); diff --git a/engine/qclib/Makefile b/engine/qclib/Makefile index 1ca5f8f0f..641a96ca7 100644 --- a/engine/qclib/Makefile +++ b/engine/qclib/Makefile @@ -1,5 +1,7 @@ QCC_OBJS=qccmain.c qcc_cmdlib.c qcc_pr_comp.c qcc_pr_lex.c comprout.c hash.c qcd_main.c +CC=gcc + all: qcc diff --git a/engine/qclib/pr_exec.c b/engine/qclib/pr_exec.c index ab418323a..cfb744aad 100644 --- a/engine/qclib/pr_exec.c +++ b/engine/qclib/pr_exec.c @@ -757,9 +757,6 @@ PR_ExecuteProgram */ void PR_ExecuteCode (progfuncs_t *progfuncs, int s) { - static dstatement16_t fakeop16; - static dstatement32_t fakeop32; - eval_t *t, *swtch=NULL; int swtchtype; diff --git a/engine/qclib/qcc.dsp b/engine/qclib/qcc.dsp index 24a00278e..b459b2e34 100644 --- a/engine/qclib/qcc.dsp +++ b/engine/qclib/qcc.dsp @@ -52,7 +52,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 ../libs/zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../../../fteqcc.exe" +# ADD LINK32 ../libs/zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../../fteqcc.exe" !ELSEIF "$(CFG)" == "qcc - Win32 Debug" @@ -76,7 +76,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\libs\zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../../../fteqcc.exe" /pdbtype:sept +# ADD LINK32 ..\libs\zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"D:\Quake\qw\src\qco/fteqcc.exe" /pdbtype:sept !ELSEIF "$(CFG)" == "qcc - Win32 GUIDebug" @@ -101,7 +101,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 ..\libs\zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../../../fteqcc.exe" /pdbtype:sept -# ADD LINK32 ..\libs\zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib comdlg32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"../../../fteqcc.exe" /pdbtype:sept +# ADD LINK32 ..\libs\zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib comdlg32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"D:\Quake\qw\src\qco/fteqcc.exe" /pdbtype:sept # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "qcc - Win32 GUIRelease" @@ -127,7 +127,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 ../libs/zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../../../fteqcc.exe" -# ADD LINK32 ../libs/zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib /nologo /subsystem:windows /machine:I386 /out:"../../../fteqcc.exe" +# ADD LINK32 ../libs/zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib /nologo /subsystem:windows /machine:I386 /out:"../../fteqccgui.exe" # SUBTRACT LINK32 /pdb:none !ENDIF @@ -171,6 +171,8 @@ SOURCE=.\qccgui.c !ELSEIF "$(CFG)" == "qcc - Win32 Debug" +# PROP Exclude_From_Build 1 + !ELSEIF "$(CFG)" == "qcc - Win32 GUIDebug" !ELSEIF "$(CFG)" == "qcc - Win32 GUIRelease" @@ -188,6 +190,8 @@ SOURCE=.\qccguistuff.c !ELSEIF "$(CFG)" == "qcc - Win32 Debug" +# PROP Exclude_From_Build 1 + !ELSEIF "$(CFG)" == "qcc - Win32 GUIDebug" !ELSEIF "$(CFG)" == "qcc - Win32 GUIRelease" diff --git a/engine/qclib/qcc.h b/engine/qclib/qcc.h index f15057f0e..d71340fbb 100644 --- a/engine/qclib/qcc.h +++ b/engine/qclib/qcc.h @@ -512,6 +512,7 @@ void QCC_PR_PrintStatement (QCC_dstatement_t *s); void QCC_PR_Lex (void); // reads the next token into pr_token and classifies its type +QCC_type_t *QCC_PR_NewType (char *name, int basictype); QCC_type_t *QCC_PR_ParseType (int newtype); QCC_type_t *QCC_TypeForName(char *name); QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype); diff --git a/engine/qclib/qcc_pr_comp.c b/engine/qclib/qcc_pr_comp.c index 4786f6704..536b95560 100644 --- a/engine/qclib/qcc_pr_comp.c +++ b/engine/qclib/qcc_pr_comp.c @@ -666,6 +666,7 @@ pbool QCC_OPCodeValid(QCC_opcode_t *op) QCC_def_t *QCC_PR_Expression (int priority); int QCC_AStatementJumpsTo(int targ, int first, int last); +pbool QCC_StatementIsAJump(int stnum, int notifdest); temp_t *functemps; //floats/strings/funcs/ents... @@ -829,9 +830,6 @@ void QCC_FreeOffset(gofs_t ofs, unsigned int size) freeofs = fofs; return; - - QCC_Error(ERR_INTERNAL, "QCC_FreeOffset: not called with end of globals"); - } static QCC_def_t *QCC_GetTemp(QCC_type_t *type) @@ -4821,7 +4819,7 @@ void QCC_PR_ParseStatement (void) QCC_PR_ParseStatement (); //this is so that a missing goto at the end of your switch doesn't end up in the jumptable again - if (oldst == numstatements || (QCC_AStatementJumpsTo(numstatements-1, oldst, numstatements-1))) + if (oldst == numstatements || !QCC_StatementIsAJump(numstatements-1, numstatements-1)) { QCC_FreeTemp(QCC_PR_Statement (&pr_opcodes[OP_GOTO], 0, 0, &patch2)); //the P1 statement/the theyforgotthebreak statement. // QCC_PR_ParseWarning(0, "emitted goto"); @@ -5657,6 +5655,18 @@ void QCC_CheckForDeadAndMissingReturns(int first, int last, int rettype) } } +pbool QCC_StatementIsAJump(int stnum, int notifdest) //only the unconditionals. +{ + if (statements[stnum].op == OP_RETURN) + return true; + if (statements[stnum].op == OP_DONE) + return true; + if (statements[stnum].op == OP_GOTO) + if ((int)statements[stnum].a != notifdest) + return true; + return false; +} + int QCC_AStatementJumpsTo(int targ, int first, int last) { int st; @@ -6719,7 +6729,7 @@ QCC_def_t *QCC_PR_DummyFieldDef(QCC_type_t *type, char *name, QCC_def_t *scope, { char array[64]; char newname[256]; - int a, i, parms; + int a, parms; QCC_def_t *def, *first=NULL; unsigned int maxfield, startfield; QCC_type_t *ftype; @@ -6827,8 +6837,6 @@ QCC_def_t *QCC_PR_DummyFieldDef(QCC_type_t *type, char *name, QCC_def_t *scope, def->initialized = true; ((int *)qcc_pr_globals)[def->ofs] = *fieldofs; *fieldofs += parttype->size; - for (i = parttype->num_parms; i>0; i--) - parttype=parttype->next; break; case ev_void: break; diff --git a/engine/qclib/qccgui.c b/engine/qclib/qccgui.c index e14e8bd36..b1cc7f3b7 100644 --- a/engine/qclib/qccgui.c +++ b/engine/qclib/qccgui.c @@ -1390,43 +1390,52 @@ void GuiParseCommandLine(char *args) if (!strnicmp(parameters+paramlen, "-O", 2) || !strnicmp(parameters+paramlen, "/O", 2)) { //strip out all -O - if (parameters[paramlen+2] >= '0' && parameters[paramlen+2] <= '3') + if (parameters[paramlen+2]) { - p = parameters[paramlen+2]-'0'; - for (l = 0; optimisations[l].enabled; l++) + if (parameters[paramlen+2] >= '0' && parameters[paramlen+2] <= '3') { - if (optimisations[l].optimisationlevel<=p) - optimisations[l].flags |= 8; - else - optimisations[l].flags &= ~8; + p = parameters[paramlen+2]-'0'; + for (l = 0; optimisations[l].enabled; l++) + { + if (optimisations[l].optimisationlevel<=p) + optimisations[l].flags |= 8; + else + optimisations[l].flags &= ~8; + } } - p=0; - } - else if (!strncmp(parameters+paramlen+2, "no-", 3)) - { - if (parameters[paramlen+5]) - for (p = 0; optimisations[p].enabled; p++) - if ((*optimisations[p].abbrev && !strcmp(parameters+paramlen+5, optimisations[p].abbrev)) || !strcmp(parameters+paramlen+5, optimisations[p].fullname)) + else if (!strncmp(parameters+paramlen+2, "no-", 3)) + { + if (parameters[paramlen+5]) + { + for (p = 0; optimisations[p].enabled; p++) + if ((*optimisations[p].abbrev && !strcmp(parameters+paramlen+5, optimisations[p].abbrev)) || !strcmp(parameters+paramlen+5, optimisations[p].fullname)) + { + optimisations[p].flags &= ~8; + break; + } + + if (!optimisations[p].enabled) { - optimisations[p].flags &= ~8; - break; + parameters[paramlen+next-args] = ' '; + paramlen += l; } - } - else - { - if (parameters[paramlen+2]) + } + } + else + { for (p = 0; optimisations[p].enabled; p++) if ((*optimisations[p].abbrev && !strcmp(parameters+paramlen+2, optimisations[p].abbrev)) || !strcmp(parameters+paramlen+2, optimisations[p].fullname)) { optimisations[p].flags |= 8; break; } - } - if (!optimisations[p].enabled) - { - parameters[paramlen+next-args] = ' '; - paramlen += l; + if (!optimisations[p].enabled) + { + parameters[paramlen+next-args] = ' '; + paramlen += l; + } + } } } else if (!strnicmp(parameters+paramlen, "-Fno-kce", 8) || !strnicmp(parameters+paramlen, "/Fno-kce", 8)) //keywords stuph diff --git a/engine/qclib/qccmain.c b/engine/qclib/qccmain.c index eacd1cb9c..8316f0f51 100644 --- a/engine/qclib/qccmain.c +++ b/engine/qclib/qccmain.c @@ -2707,22 +2707,12 @@ memset(pr_immediate_string, 0, sizeof(pr_immediate_string)); #endif QCC_InitData (); -#if 0 - p = QCC_CheckParm ("-base"); - if (p && p < argc-1 ) - sprintf (qccmprogsdat, "%s%s", qccmsourcedir, argv[p+1]); - else - { //look for a preprogs.src... :o) - sprintf (qccmprogsdat, "%spreprogs.src", qccmsourcedir); - if (externs->FileSize(qccmprogsdat) <= 0) - sprintf (qccmprogsdat, "%sprogs.src", qccmsourcedir); - } -#endif + QCC_PR_BeginCompilation ((void *)qccHunkAlloc (0x100000), 0x100000); -#if 0 - QCC_ReadPoff(qccmprogsdat); -#endif - p = QCC_CheckParm ("-srcfile"); + + p = QCC_CheckParm ("-qc"); + if (!p || p >= argc-1 || argv[p+1][0] == '-') + p = QCC_CheckParm ("-srcfile"); if (p && p < argc-1 ) sprintf (qccmprogsdat, "%s%s", qccmsourcedir, argv[p+1]); else @@ -2755,9 +2745,23 @@ memset(pr_immediate_string, 0, sizeof(pr_immediate_string)); } #endif + if (QCC_CheckParm ("-qc")) + { + strcpy(destfile, qccmprogsdat); + StripExtension(destfile); + strcat(destfile, ".qco"); + + p = QCC_CheckParm ("-o"); + if (!p || p >= argc-1 || argv[p+1][0] == '-') + if (p && p < argc-1 ) + sprintf (destfile, "%s%s", qccmsourcedir, argv[p+1]); + goto newstyle; + } + if (*qcc_token == '#') { void StartNewStyleCompile(void); +newstyle: newstylesource = true; StartNewStyleCompile(); return; @@ -2775,7 +2779,7 @@ memset(pr_immediate_string, 0, sizeof(pr_immediate_string)); if (!qccmsrc) QCC_Error (ERR_NOOUTPUT, "No destination filename. qcc -help for info."); - strcpy (destfile, qcc_token); + strcpy (destfile, qcc_token); #ifndef QCCONLY p=1; @@ -3227,6 +3231,7 @@ void Sys_Error(const char *text, ...) int main (int argc, char **argv) { + int sucess; progexterns_t ext; progfuncs_t funcs; progfuncs = &funcs; @@ -3238,13 +3243,13 @@ int main (int argc, char **argv) funcs.parms->WriteFile = QCC_WriteFile; funcs.parms->printf = printf; funcs.parms->Sys_Error = Sys_Error; - CompileParams(&funcs, true, argc, argv); + sucess = CompileParams(&funcs, true, argc, argv); qccClearHunk(); #ifdef _WIN32 - fgetc(stdin); //wait for keypress +// fgetc(stdin); //wait for keypress #endif - return 0; + return !sucess; } #endif diff --git a/engine/server/savegame.c b/engine/server/savegame.c index 0ae0fcd43..c35dd58dd 100644 --- a/engine/server/savegame.c +++ b/engine/server/savegame.c @@ -76,7 +76,7 @@ void SV_Savegame_f (void) return; } - sprintf (name, "%s/%s", com_gamedir, Cmd_Argv(1)); + sprintf (name, "%s/saves/%s", com_gamedir, Cmd_Argv(1)); COM_DefaultExtension (name, ".sav"); Con_TPrintf (STL_SAVEGAMETO, name); @@ -193,7 +193,7 @@ void SV_Loadgame_f(void) // return; // } - sprintf (filename, "%s/%s", com_gamedir, Cmd_Argv(1)); + sprintf (filename, "%s/saves/%s", com_gamedir, Cmd_Argv(1)); COM_DefaultExtension (filename, ".sav"); // we can't call SCR_BeginLoadingPlaque, because too much stack space has @@ -480,7 +480,7 @@ qboolean SV_LoadLevelCache(char *level, char *startspot, qboolean ignoreplayers) if (!cache) return false; //not visited yet. Ignore the existing caches as fakes. - sprintf (name, "%s/%s", com_gamedir, level); + sprintf (name, "%s/saves/%s", com_gamedir, level); COM_DefaultExtension (name, ".lvc"); // Con_TPrintf (STL_LOADGAMEFROM, name); @@ -675,7 +675,7 @@ void SV_SaveLevelCache(qboolean dontharmgame) } - sprintf (name, "%s/%s", com_gamedir, cache->mapname); + sprintf (name, "%s/saves/%s", com_gamedir, cache->mapname); COM_DefaultExtension (name, ".lvc"); if (!dontharmgame) //save game in progress @@ -792,7 +792,7 @@ void SV_Savegame_f (void) if (!*savename || strstr(savename, "..")) savename = "quicksav"; - sprintf (filename, "%s/%s/info.fsv", com_gamedir, savename); + sprintf (filename, "%s/saves/%s/info.fsv", com_gamedir, savename); COM_CreatePath(filename); f = fopen(filename, "wt"); if (!f) @@ -860,7 +860,7 @@ void SV_Savegame_f (void) { fprintf(f, "%s\n", cache->mapname); - sprintf (filename, "%s/%s.lvc", com_gamedir, cache->mapname); + sprintf (filename, "%s/saves/%s.lvc", com_gamedir, cache->mapname); f2 = fopen(filename, "rb"); if (!f2) break; @@ -883,7 +883,7 @@ void SV_Savegame_f (void) fread(buffer, len, 1, f2); fclose(f2); - sprintf (filename, "%s/%s/%s.lvc", com_gamedir, savename, cache->mapname); + sprintf (filename, "%s/saves/%s/%s.lvc", com_gamedir, savename, cache->mapname); f2 = fopen(filename, "wb"); if (!f2) break; @@ -919,7 +919,7 @@ void SV_Loadgame_f (void) if (!*savename || strstr(savename, "..")) strcpy(savename, "quicksav"); - sprintf (filename, "%s/%s/info.fsv", com_gamedir, savename); + sprintf (filename, "%s/saves/%s/info.fsv", com_gamedir, savename); f = fopen (filename, "rt"); if (!f) { @@ -1070,7 +1070,7 @@ void SV_Loadgame_f (void) - sprintf (filename, "%s/%s/%s.lvc", com_gamedir, savename, cache->mapname); + sprintf (filename, "%s/saves/%s/%s.lvc", com_gamedir, savename, cache->mapname); fi = fopen(filename, "rb"); if (!fi) { @@ -1089,7 +1089,7 @@ void SV_Loadgame_f (void) fread(buffer, len, 1, fi); fclose(fi); - sprintf (filename, "%s/%s.lvc", com_gamedir, cache->mapname); + sprintf (filename, "%s/saves/%s.lvc", com_gamedir, cache->mapname); fo = fopen(filename, "wb"); if (!fo) { diff --git a/engine/server/sv_ccmds.c b/engine/server/sv_ccmds.c index 8d29a06a6..2c7662c7a 100644 --- a/engine/server/sv_ccmds.c +++ b/engine/server/sv_ccmds.c @@ -1179,14 +1179,16 @@ void SV_SaveInfo(FILE *f, char *info, char *commandname) fwrite(" ", 1, 1, f); fwrite(command, value-command, 1, f); fwrite(" ", 1, 1, f); - fwrite(value, info-value, 1, f); + fwrite(value+1, info-(value+1), 1, f); fwrite("\n", 1, 1, f); } } void SV_SaveInfos(FILE *f) { + fwrite("\n", 1, 1, f); SV_SaveInfo(f, svs.info, "serverinfo"); + fwrite("\n", 1, 1, f); SV_SaveInfo(f, localinfo, "localinfo"); } diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index 42d5d277a..f24f5b1a2 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -4687,6 +4687,8 @@ void SV_AirMove (void) // scale = val->_float; maxspeed=sv_player->v.maxspeed;//FIXME: This isn't fully compatable code... + if (sv_player->v.hasted) + maxspeed*=sv_player->v.hasted; if (wishspeed > maxspeed*scale) { diff --git a/engine/sw/d_surf.c b/engine/sw/d_surf.c index f6f56118e..c1009f15a 100644 --- a/engine/sw/d_surf.c +++ b/engine/sw/d_surf.c @@ -50,6 +50,7 @@ int D_SurfaceCacheForRes (int width, int height, int bpp) if (pix > 64000) size += (pix-64000)*4; + size*=8; if (bpp) return size*bpp; return size; diff --git a/engine/sw/r_sky.c b/engine/sw/r_sky.c index ce8c038d0..7dbab1fe3 100644 --- a/engine/sw/r_sky.c +++ b/engine/sw/r_sky.c @@ -43,7 +43,7 @@ qbyte bottommask[128*131]; qbyte newsky[128*256]; // newsky and topsky both pack in here, 128 bytes // of newsky on the left of each scan, 128 bytes // of topsky on the right, because the low-level - // drawers need 256-qbyte scan widths + // drawers need 256-byte scan widths /* diff --git a/engine/sw/sw_draw.c b/engine/sw/sw_draw.c index 94aabad23..9fdde2141 100644 --- a/engine/sw/sw_draw.c +++ b/engine/sw/sw_draw.c @@ -40,8 +40,10 @@ typedef struct { static rectdesc_t r_rectdesc; qbyte *draw_chars; // 8*8 graphic characters -qpic_t *draw_disc; -qpic_t *draw_backtile; +//mpic_t *draw_disc; +mpic_t *draw_backtile; + +void SWDraw_TransPic (int x, int y, mpic_t *pic); //============================================================================= /* Support Routines */ @@ -61,16 +63,16 @@ int swmenu_numcachepics; Draw_CachePic ================ */ -qpic_t *SWDraw_SafeCachePic (char *extpath) +mpic_t *SWDraw_SafeCachePic (char *extpath) { swcachepic_t *pic; int i; - qpic_t *dat; + mpic_t *dat; char alternatename[MAX_QPATH]; char path[MAX_QPATH]; Q_strncpyz(path, extpath, sizeof(path)); COM_StripExtension(path, path); - + for (pic=swmenu_cachepics, i=0 ; iname)) break; @@ -101,13 +103,17 @@ qpic_t *SWDraw_SafeCachePic (char *extpath) BZ_Free(file); if (image) { - dat = Cache_Alloc(&pic->cache, sizeof(qpic_t) + width*height, path); - dat->width = width; - dat->height = height; + dat = Cache_Alloc(&pic->cache, sizeof(mpic_t) + width*height, path); + ((mpic_t*)dat)->width = width; + ((mpic_t*)dat)->height = height; + ((mpic_t*)dat)->flags = 0; for (i = 0; i < width*height; i++) { if (image[i*4+3] < 64) // 25% threshhold + { + ((mpic_t*)dat)->flags |= MPIC_ALPHA; dat->data[i] = 255; + } else dat->data[i] = GetPalette(image[i*4], image[i*4+1], image[i*4+2]); } @@ -132,13 +138,17 @@ qpic_t *SWDraw_SafeCachePic (char *extpath) BZ_Free(file); if (image) { - dat = Cache_Alloc(&pic->cache, sizeof(qpic_t) + width*height, path); - dat->width = width; - dat->height = height; + dat = Cache_Alloc(&pic->cache, sizeof(mpic_t) + width*height, path); + ((mpic_t*)dat)->width = width; + ((mpic_t*)dat)->height = height; + ((mpic_t*)dat)->flags = 0; for (i = 0; i < width*height; i++) { if (image[i*4+3] < 64) // 25% threshhold + { + ((mpic_t*)dat)->flags |= MPIC_ALPHA; dat->data[i] = 255; + } else dat->data[i] = GetPalette(image[i*4], image[i*4+1], image[i*4+2]); } @@ -163,13 +173,17 @@ qpic_t *SWDraw_SafeCachePic (char *extpath) BZ_Free(file); if (image) { - dat = Cache_Alloc(&pic->cache, sizeof(qpic_t) + width*height, path); - dat->width = width; - dat->height = height; + dat = Cache_Alloc(&pic->cache, sizeof(mpic_t) + width*height, path); + ((mpic_t*)dat)->width = width; + ((mpic_t*)dat)->height = height; + ((mpic_t*)dat)->flags = 0; for (i = 0; i < width*height; i++) { if (image[i*4+3] < 64) // 25% threshhold + { + ((mpic_t*)dat)->flags |= MPIC_ALPHA; dat->data[i] = 255; + } else dat->data[i] = GetPalette(image[i*4], image[i*4+1], image[i*4+2]); } @@ -187,24 +201,29 @@ qpic_t *SWDraw_SafeCachePic (char *extpath) _snprintf(alternatename, MAX_QPATH-1,"%s.lmp", path); COM_LoadCacheFile (alternatename, &pic->cache); - dat = (qpic_t *)pic->cache.data; + dat = pic->cache.data; if (!dat) { char alternatename[MAX_QPATH]; sprintf(alternatename, "gfx/%s.lmp", path); - dat = (qpic_t *)COM_LoadTempFile (alternatename); + COM_LoadCacheFile(alternatename, &pic->cache); + dat = pic->cache.data; if (!dat) return NULL; // Sys_Error ("Draw_CachePic: failed to load %s", path); } - SwapPic (dat); + SwapPic ((qpic_t*)dat); + + ((mpic_t*)dat)->width = ((qpic_t*)dat)->width; + ((mpic_t*)dat)->height = ((qpic_t*)dat)->height; + ((mpic_t*)dat)->flags = 0; return dat; } -qpic_t *SWDraw_CachePic (char *path) +mpic_t *SWDraw_CachePic (char *path) { - qpic_t *pic; + mpic_t *pic; pic = SWDraw_SafeCachePic(path); if (!pic) Sys_Error ("Draw_CachePic: failed to load %s", path); @@ -212,7 +231,7 @@ qpic_t *SWDraw_CachePic (char *path) return pic; } -qpic_t *SWDraw_ConcharsMalloc (char *name) +mpic_t *SWDraw_ConcharsMalloc (char *name) { // stupid hack for conchars... qpic_t *dat; @@ -235,14 +254,15 @@ qpic_t *SWDraw_ConcharsMalloc (char *name) for (j = 0; j < 128*128; j++) dat->data[j] = (draw_chars[j] == 255 || !draw_chars[j]) ? draw_chars[j] ^ 255 : draw_chars[j]; // memcpy (dat->data, draw_chars, 128*128); - dat->width = dat->height = 128; + ((mpic_t*)dat)->width = ((mpic_t*)dat)->height = 128; + ((mpic_t*)dat)->flags = 1; strcpy (pic->name, name); } return pic->cache.data; } -qpic_t *SWDraw_MallocPic (char *path) +mpic_t *SWDraw_MallocPic (char *path) { int i; qpic_t *dat; @@ -265,7 +285,7 @@ qpic_t *SWDraw_MallocPic (char *path) dat = Cache_Check (&pic->cache); if (dat) - return dat; + return (mpic_t *)dat; @@ -286,14 +306,15 @@ qpic_t *SWDraw_MallocPic (char *path) { pic->cache.data = dat; pic->cache.fake = true; - dat->width = width; - dat->height = height; + ((mpic_t*)dat)->width = width; + ((mpic_t*)dat)->height = height; + ((mpic_t*)dat)->flags = 0; for (i = 0; i < width*height; i++) dat->data[i] = GetPalette(image[i*4], image[i*4+1], image[i*4+2]); BZ_Free(image); - return dat; + return (mpic_t *)dat; } BZ_Free(image); } @@ -315,22 +336,35 @@ qpic_t *SWDraw_MallocPic (char *path) SwapPic (dat); - return dat; + ((mpic_t*)dat)->width = dat->width; + ((mpic_t*)dat)->height = dat->height; + ((mpic_t*)dat)->flags = 0; + + return (mpic_t *)dat; } -qpic_t *SWDraw_PicFromWad (char *name) +mpic_t *SWDraw_PicFromWad (char *name) { char q2name[MAX_QPATH]; qpic_t *qpic; + mpic_t *mpic; if (!strcmp(name, "conchars")) // conchars hack return SWDraw_ConcharsMalloc("conchars"); sprintf(q2name, "pics/%s.pcx", name); - qpic = SWDraw_MallocPic(q2name); - if (qpic) - return qpic; + mpic = SWDraw_MallocPic(q2name); + if (mpic) + return mpic; - return W_SafeGetLumpName (name); + qpic = W_SafeGetLumpName (name); + if (!qpic) + return NULL; + + mpic = (mpic_t *)qpic; + mpic->width = qpic->width; + mpic->height = qpic->height; + mpic->flags = memchr (&qpic->data, 255, mpic->width * mpic->height)?MPIC_ALPHA:0; + return mpic; } @@ -347,10 +381,10 @@ void SWDraw_Init (void) draw_chars = W_SafeGetLumpName ("conchars"); //q1 if (!draw_chars) { - qpic_t *pic; //try q2 + mpic_t *pic; //try q2 int i; int s; - pic = SWDraw_MallocPic("pics/conchars.pcx"); //safe from host_hunkmarks... + pic = (mpic_t *)SWDraw_MallocPic("pics/conchars.pcx"); //safe from host_hunkmarks... if (pic) { draw_chars = pic->data; @@ -409,10 +443,15 @@ void SWDraw_Init (void) draw_disc = W_SafeGetLumpName ("disc"); draw_backtile = W_SafeGetLumpName ("backtile"); if (!draw_backtile) - draw_backtile = (qpic_t *)COM_LoadMallocFile("gfx/menu/backtile.lmp"); + draw_backtile = (mpic_t *)COM_LoadMallocFile("gfx/menu/backtile.lmp"); if (draw_backtile) { + { + ((mpic_t*)draw_backtile)->width = ((qpic_t*)draw_backtile)->width; + ((mpic_t*)draw_backtile)->height = ((qpic_t*)draw_backtile)->height; + ((mpic_t*)draw_backtile)->flags = 0; + } r_rectdesc.width = draw_backtile->width; r_rectdesc.height = draw_backtile->height; r_rectdesc.ptexbytes = draw_backtile->data; @@ -881,7 +920,7 @@ void SWDraw_DebugChar (qbyte num) Draw_Pic ============= */ -void SWDraw_Pic (int x, int y, qpic_t *pic) +void SWDraw_Pic (int x, int y, mpic_t *pic) { qbyte *dest, *source; int v, u; @@ -889,6 +928,12 @@ void SWDraw_Pic (int x, int y, qpic_t *pic) if (!pic) return; + if (pic->flags & MPIC_ALPHA) + { + SWDraw_TransPic(x, y, pic); + return; + } + if ((x < 0) || (x + pic->width > vid.width) || (y < 0) || @@ -939,14 +984,14 @@ void SWDraw_Pic (int x, int y, qpic_t *pic) } } - /* ============= Draw_SubPic ============= */ -void SWDraw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height) +void SWDraw_TransSubPic(int x, int y, qpic_t *qpic, int srcx, int srcy, int width, int height) { + mpic_t *pic = (mpic_t *)qpic; qbyte *dest, *source; int v, u; @@ -960,6 +1005,105 @@ void SWDraw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int source = pic->data + srcy * pic->width + srcx; + if (r_pixbytes == 1) + { + qbyte tbyte; + dest = vid.buffer + y * vid.rowbytes + x; + + if (pic->width & 7) + { // general + for (v=0 ; vwidth; + } + } + else + { // unwound + for (v=0 ; vwidth; + } + } + } + else if (r_pixbytes == 2) + { + unsigned short *p16dest; + p16dest = (unsigned short *)vid.buffer + y * vid.rowbytes + x; + + for (v=0 ; vwidth; + } + } + else if (r_pixbytes == 4) + { + unsigned int *p32dest; + p32dest = (unsigned int *)vid.buffer + y * vid.rowbytes + x; + + for (v=0 ; vwidth; + } + } +} +/* +============= +Draw_SubPic +============= +*/ +void SWDraw_SubPic(int x, int y, qpic_t *qpic, int srcx, int srcy, int width, int height) +{ + mpic_t *pic = (mpic_t *)qpic; + qbyte *dest, *source; + int v, u; + + if (pic->flags & MPIC_ALPHA) + { + SWDraw_TransSubPic(x, y, qpic, srcx, srcy, width, height); + return; + } + + if ((x < 0) || + (x + width > vid.width) || + (y < 0) || + (y + height > vid.height)) + { + Sys_Error ("Draw_Pic: bad coordinates"); + } + + source = pic->data + srcy * pic->width + srcx; + if (r_pixbytes == 1) { dest = vid.buffer + y * vid.rowbytes + x; @@ -1005,7 +1149,7 @@ void SWDraw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int Draw_TransPic ============= */ -void SWDraw_TransPic (int x, int y, qpic_t *pic) +void SWDraw_TransPic (int x, int y, mpic_t *pic) { qbyte *source, tbyte; int v, u; @@ -1163,8 +1307,9 @@ void SWDraw_TransPic (int x, int y, qpic_t *pic) Draw_TransPicTranslate ============= */ -void SWDraw_TransPicTranslate (int x, int y, qpic_t *pic, qbyte *translation) +void SWDraw_TransPicTranslate (int x, int y, qpic_t *qpic, qbyte *translation) { + mpic_t *pic = (mpic_t*)qpic; qbyte *source, tbyte; int v, u; @@ -1528,8 +1673,9 @@ void SWDraw_ImageColours (float r, float g, float b, float a) //like glcolour4f SWDraw_Image_Blend = r<1 || b<1 || g<1 || a<1; } -void SWDraw_Image (float xp, float yp, float wp, float hp, float s1, float t1, float s2, float t2, qpic_t *pic) +void SWDraw_Image (float xp, float yp, float wp, float hp, float s1, float t1, float s2, float t2, qpic_t *qpic) { + mpic_t *pic = (mpic_t*)qpic; float xend, yend, xratio, yratio; if (!pic) @@ -1626,15 +1772,15 @@ void SWDraw_ConsoleBackground (int lines) qbyte *src; qbyte *dest; int f, fstep; - qpic_t *conback; + mpic_t *conback; char ver[100]; static char saveback[320*8]; - conback = SWDraw_SafeCachePic ("gfx/conback.lmp"); + conback = (mpic_t *)SWDraw_SafeCachePic ("gfx/conback.lmp"); if (!conback) - conback = SWDraw_SafeCachePic("pics/conback.pcx"); + conback = (mpic_t *)SWDraw_SafeCachePic("pics/conback.pcx"); if (!conback) - conback = SWDraw_SafeCachePic ("gfx/menu/conback.lmp"); + conback = (mpic_t *)SWDraw_SafeCachePic ("gfx/menu/conback.lmp"); if (!conback) Sys_Error("gfx/conback.lmp not found\n"); diff --git a/engine/sw/sw_draw.h b/engine/sw/sw_draw.h index b4e58177c..e0896bd67 100644 --- a/engine/sw/sw_draw.h +++ b/engine/sw/sw_draw.h @@ -26,13 +26,13 @@ void SWDraw_ReInit (void); void SWDraw_Shutdown(void); void SWDraw_Character (int x, int y, unsigned int num); void SWDraw_ImageColours (float r, float g, float b, float a); -void SWDraw_Image (float xp, float yp, float wp, float hp, float s1, float t1, float s2, float t2, qpic_t *pic); +void SWDraw_Image (float xp, float yp, float wp, float hp, float s1, float t1, float s2, float t2, mpic_t *pic); void SWDraw_ColouredCharacter (int x, int y, unsigned int num); void SWDraw_DebugChar (qbyte num); -void SWDraw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height); -void SWDraw_Pic (int x, int y, qpic_t *pic); -void SWDraw_TransPic (int x, int y, qpic_t *pic); -void SWDraw_TransPicTranslate (int x, int y, qpic_t *pic, qbyte *translation); +void SWDraw_SubPic(int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height); +void SWDraw_Pic (int x, int y, mpic_t *pic); +void SWDraw_TransPic (int x, int y, mpic_t *pic); +void SWDraw_TransPicTranslate (int x, int y, mpic_t *pic, qbyte *translation); void SWDraw_ConsoleBackground (int lines); void SWDraw_EditorBackground (int lines); void SWDraw_BeginDisc (void); @@ -42,9 +42,9 @@ void SWDraw_Fill (int x, int y, int w, int h, int c); void SWDraw_FadeScreen (void); void SWDraw_String (int x, int y, const qbyte *str); void SWDraw_Alt_String (int x, int y, const qbyte *str); -qpic_t *SWDraw_SafePicFromWad (char *name); -qpic_t *SWDraw_PicFromWad (char *name); -qpic_t *SWDraw_SafeCachePic (char *path); -qpic_t *SWDraw_CachePic (char *path); +mpic_t *SWDraw_SafePicFromWad (char *name); +mpic_t *SWDraw_PicFromWad (char *name); +mpic_t *SWDraw_SafeCachePic (char *path); +mpic_t *SWDraw_CachePic (char *path); void SWDraw_Crosshair(void);