Lots of stuff.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@684 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2004-12-24 08:45:56 +00:00
parent aceb5aabcd
commit 4b0395e079
67 changed files with 1643 additions and 892 deletions

View file

@ -26,7 +26,7 @@ XLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext -lpng -ljpeg
SLDFLAGS=-lvga 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 CLIENT_ONLY_CFLAGS=$(BASE_CFLAGS) -DCLIENTONLY
SERVER_ONLY_CFLAGS=$(BASE_CFLAGS) -DSERVERONLY SERVER_ONLY_CFLAGS=$(BASE_CFLAGS) -DSERVERONLY
JOINT_CFLAGS=$(BASE_CFLAGS) JOINT_CFLAGS=$(BASE_CFLAGS)

View file

@ -29,7 +29,7 @@ QUX_DIR=$(BASE_DIR)/qux
RELEASE_DIR=$(BASE_DIR)/release RELEASE_DIR=$(BASE_DIR)/release
DEBUG_DIR=$(BASE_DIR)/debug DEBUG_DIR=$(BASE_DIR)/debug
DO_CC=$(CC) $(CFLAGS) -o $@ -c $< DO_CC=$(CC) $(BASE_CFLAGS) $(CFLAGS) -o $@ -c $<
ifeq ($(USEASM),true) ifeq ($(USEASM),true)
ifdef windir ifdef windir
DO_AS=$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $< DO_AS=$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
@ -50,14 +50,31 @@ ifeq ($(USEASM),true)
CLIENT_ASM_OBJS = \ CLIENT_ASM_OBJS = \
snd_mixa.o 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 else
BASE_ASM_CFLAGS = -DNOASM BASE_ASM_CFLAGS = -DNOASM
endif 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 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=$(BASE_CFLAGS) -DCLIENTONLY CLIENT_ONLY_CFLAGS=-DCLIENTONLY
SERVER_ONLY_CFLAGS=$(BASE_CFLAGS) -DSERVERONLY SERVER_ONLY_CFLAGS=-DSERVERONLY
JOINT_CFLAGS=$(BASE_CFLAGS) JOINT_CFLAGS=
DEBUG_CFLAGS=-ggdb -g DEBUG_CFLAGS=-ggdb -g
RELEASE_CFLAGS=-O6 -s -fno-strict-aliasing -ffast-math -funroll-loops -fexpensive-optimizations $(CPUOPTIMIZATIONS) RELEASE_CFLAGS=-O6 -s -fno-strict-aliasing -ffast-math -funroll-loops -fexpensive-optimizations $(CPUOPTIMIZATIONS)
GLCFLAGS=-DGLQUAKE GLCFLAGS=-DGLQUAKE
@ -130,22 +147,18 @@ CLIENT_OBJS = $(CLIENT_ASM_OBJS) \
m_x.o \ m_x.o \
x_reqs.o \ x_reqs.o \
x_res.o \ x_res.o \
pr_menu.o \ pr_menu.o
SOFTWARE_OBJS = \ SOFTWARE_OBJS = $(SOFTWARE_ASM_OBJS) \
sw_screen.o \ sw_screen.o \
sw_draw.o \ sw_draw.o \
sw_model.o \ sw_model.o \
r_aclip.o \ r_aclip.o \
r_aclipa.o \
r_alias.o \ r_alias.o \
r_aliasa.o \
r_bsp.o \ r_bsp.o \
r_draw.o \ r_draw.o \
r_drawa.o \
r_edge.o \ r_edge.o \
r_edgea.o \
r_light.o \ r_light.o \
r_main.o \ r_main.o \
r_misc.o \ r_misc.o \
@ -153,79 +166,67 @@ SOFTWARE_OBJS = \
r_sprite.o \ r_sprite.o \
r_surf.o \ r_surf.o \
r_vars.o \ r_vars.o \
r_varsa.o \
\
d_draw.o \
d_draw16.o \
d_edge.o \ d_edge.o \
d_fill.o \ d_fill.o \
d_init.o \ d_init.o \
d_modech.o \ d_modech.o \
d_part.o \ d_part.o \
d_parta.o \
d_polyse.o \ d_polyse.o \
d_polysa.o \
d_scan.o \ d_scan.o \
d_scana.o \
d_sky.o \ d_sky.o \
d_spr8.o \
d_sprite.o \ d_sprite.o \
d_surf.o \ d_surf.o \
d_trans.o \ d_trans.o \
d_vars.o \ d_vars.o \
d_varsa.o \
d_zpoint.o \ d_zpoint.o \
\ nonintel.o
nonintel.o \
surf16.o \
surf8.o
GLQUAKE_OBJS = \ GLQUAKE_OBJS = \
gl_alias.o \ gl_alias.o \
gl_draw.o \ gl_draw.o \
gl_model.o \ gl_model.o \
gl_ngraph.o \ gl_ngraph.o \
gl_rlight.o \ gl_rlight.o \
gl_rmain.o \ gl_rmain.o \
gl_rmisc.o \ gl_rmisc.o \
gl_rsurf.o \ gl_rsurf.o \
ltface.o \ ltface.o \
gl_screen.o \ gl_screen.o \
gl_backend.o \ gl_backend.o \
gl_shader.o \ gl_shader.o \
gl_warp.o \ gl_warp.o \
gl_ppl.o \ gl_ppl.o \
gl_vidcommon.o \ gl_vidcommon.o \
gl_hlmdl.o gl_hlmdl.o
MP3_OBJS = \ MP3_OBJS = \
fixed.o \ fixed.o \
bit.o \ bit.o \
timer.o \ timer.o \
stream.o \ stream.o \
frame.o \ frame.o \
synth.o \ synth.o \
decoder.o \ decoder.o \
layer12.o \ layer12.o \
layer3.o \ layer3.o \
huffman.o \ huffman.o \
mymad.o mymad.o
PROGS_OBJS = \ PROGS_OBJS = \
comprout.o \ comprout.o \
hash.o \ hash.o \
initlib.o \ initlib.o \
pr_edict.o \ pr_edict.o \
pr_exec.o \ pr_exec.o \
pr_multi.o \ pr_multi.o \
qcc_cmdlib.o \ qcc_cmdlib.o \
qccmain.o \ qccmain.o \
qcc_pr_comp.o \ qcc_pr_comp.o \
qcc_pr_lex.o \ qcc_pr_lex.o \
qcdecomp.o \ qcdecomp.o \
qcd_main.o qcd_main.o
SERVER_OBJS = \ SERVER_OBJS = \
pr_cmds.o \ pr_cmds.o \
sv_master.o \ sv_master.o \
sv_init.o \ sv_init.o \
@ -259,23 +260,23 @@ SERVER_OBJS = \
sv_pop3.o \ sv_pop3.o \
sv_smtp.o sv_smtp.o
SERVERONLY_OBJS = \ SERVERONLY_OBJS = \
svmodel.o \ svmodel.o \
sv_sys_unix.o sv_sys_unix.o
COMMON_OBJS = $(COMMON_ASM_OBJS) \ COMMON_OBJS = $(COMMON_ASM_OBJS) \
common.o \ common.o \
cvar.o \ cvar.o \
cmd.o \ cmd.o \
crc.o \ crc.o \
mathlib.o \ mathlib.o \
huff.o \ huff.o \
md4.o \ md4.o \
md5.o \ md5.o \
net_chan.o \ net_chan.o \
net_wins.o \ net_wins.o \
zone.o \ zone.o \
gl_q2bsp.o \ gl_q2bsp.o \
glmod_doom.o \ glmod_doom.o \
pmove.o \ pmove.o \
pmovetst.o \ pmovetst.o \
@ -293,7 +294,34 @@ ifeq ($(FTE_TARGET), win32)
GL_CFLAGS=$(GLCFLAGS) GL_CFLAGS=$(GLCFLAGS)
GLB_DIR=gl_mgw GLB_DIR=gl_mgw
GLCL_DIR=glcl_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 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 GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o
GL_EXE_NAME=../fteqw_sdl.gl GL_EXE_NAME=../fteqw_sdl.gl
GLCL_EXE_NAME=../fteqwcl_sdl.gl GLCL_EXE_NAME=../fteqwcl_sdl.gl
@ -306,11 +334,24 @@ endif
GL_CFLAGS=$(GLCFLAGS) GL_CFLAGS=$(GLCFLAGS)
GLB_DIR=gl_sdl GLB_DIR=gl_sdl
GLCL_DIR=glcl_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 endif
all: help 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 #NQPROT_DIR=$(BASE_DIR)/nqnet
#HTTP_DIR=$(BASE_DIR)/http #HTTP_DIR=$(BASE_DIR)/http
@ -330,9 +371,8 @@ $(OUT_DIR)/%.o : %.s
$(DO_AS) $(DO_AS)
endif endif
$(OUT_DIR)/$(EXE_NAME): $(addprefix $(OUT_DIR)/, $(foreach ol, $(OBJS), $($(ol))))
$(OUT_DIR)/$(EXE_NAME): $(addprefix $(OUT_DIR)/, $(OBJS)) $(CC) $(CFLAGS) -o $@ $(addprefix $(OUT_DIR)/, $(foreach ol, $(OBJS), $($(ol)))) $(LDFLAGS)
$(CC) $(CFLAGS) -o $@ $(addprefix $(OUT_DIR)/, $(OBJS)) $(LDFLAGS)
_out-rel: _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)" $(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)" $(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: _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: _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 _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 _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) SV_OBJS=$(COMMON_OBJS) $(NQPROT_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(SERVERONLY_OBJS)
@ -371,9 +411,9 @@ sv-dbg:
glcl-tmp: 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: 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: glcl-rel:
$(MAKE) -f Makefile.SDL glcl-tmp TYPE=_cl-rel OUT_DIR="$(RELEASE_DIR)/$(GLCL_DIR)" $(MAKE) -f Makefile.SDL glcl-tmp TYPE=_cl-rel OUT_DIR="$(RELEASE_DIR)/$(GLCL_DIR)"
@ -384,6 +424,41 @@ gl-rel:
gl-dbg: gl-dbg:
$(MAKE) -f Makefile.SDL gl-tmp TYPE=_clsv-dbg OUT_DIR="$(DEBUG_DIR)/$(GLB_DIR)" $(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 ifdef windir
debugdir: debugdir:
@-mkdir $(subst /,\, $(OUT_DIR)) @-mkdir $(subst /,\, $(OUT_DIR))

View file

@ -45,241 +45,246 @@ NQPROT_OBJS = \
$(OUT_DIR)/net_nqwin.o \ $(OUT_DIR)/net_nqwin.o \
$(OUT_DIR)/net_vcr.o $(OUT_DIR)/net_vcr.o
CLIENT_OBJS = \ CLIENT_OBJS = \
$(OUT_DIR)/textedit.o \ textedit.o \
$(OUT_DIR)/teamplay.o \ teamplay.o \
$(OUT_DIR)/zqtp.o \ zqtp.o \
$(OUT_DIR)/cl_demo.o \ cl_demo.o \
$(OUT_DIR)/cl_ents.o \ cl_ents.o \
$(OUT_DIR)/clq2_ents.o \ clq2_ents.o \
$(OUT_DIR)/cl_input.o \ cl_input.o \
$(OUT_DIR)/cl_main.o \ cl_main.o \
$(OUT_DIR)/cl_parse.o \ cl_parse.o \
$(OUT_DIR)/cl_pred.o \ cl_pred.o \
$(OUT_DIR)/cl_tent.o \ cl_tent.o \
$(OUT_DIR)/cl_cam.o \ cl_cam.o \
$(OUT_DIR)/cl_ui.o \ cl_ui.o \
$(OUT_DIR)/cl_screen.o \ cl_screen.o \
$(OUT_DIR)/clq2_cin.o \ clq2_cin.o \
$(OUT_DIR)/qvm.o \ qvm.o \
$(OUT_DIR)/irc_cl.o \ irc_cl.o \
$(OUT_DIR)/ftp_cl.o \ ftp_cl.o \
$(OUT_DIR)/http_cl.o \ http_cl.o \
$(OUT_DIR)/console.o \ console.o \
$(OUT_DIR)/image.o \ image.o \
$(OUT_DIR)/in_win.o \ in_win.o \
$(OUT_DIR)/keys.o \ keys.o \
$(OUT_DIR)/menu.o \ menu.o \
$(OUT_DIR)/m_master.o \ m_master.o \
$(OUT_DIR)/m_multi.o \ m_multi.o \
$(OUT_DIR)/m_items.o \ m_items.o \
$(OUT_DIR)/m_options.o \ m_options.o \
$(OUT_DIR)/m_single.o \ m_single.o \
$(OUT_DIR)/m_script.o \ m_script.o \
$(OUT_DIR)/m_mp3.o \ m_mp3.o \
$(OUT_DIR)/roq_read.o \ roq_read.o \
$(OUT_DIR)/net_master.o \ net_master.o \
$(OUT_DIR)/nonintel.o \ nonintel.o \
$(OUT_DIR)/r_bulleten.o \ r_bulleten.o \
$(OUT_DIR)/r_part.o \ r_part.o \
$(OUT_DIR)/r_partset.o \ r_partset.o \
$(OUT_DIR)/renderer.o \ renderer.o \
$(OUT_DIR)/renderque.o \ renderque.o \
$(OUT_DIR)/sbar.o \ sbar.o \
$(OUT_DIR)/skin.o \ skin.o \
$(OUT_DIR)/snd_dma.o \ snd_dma.o \
$(OUT_DIR)/snd_mem.o \ snd_mem.o \
$(OUT_DIR)/snd_mix.o \ snd_mix.o \
$(OUT_DIR)/snd_mp3.o \ snd_mp3.o \
$(OUT_DIR)/snd_ov.o \ snd_ov.o \
$(OUT_DIR)/valid.o \ valid.o \
$(OUT_DIR)/view.o \ view.o \
$(OUT_DIR)/wad.o \ wad.o \
$(OUT_DIR)/cd_win.o \ cd_win.o \
$(OUT_DIR)/fragstats.o \ fragstats.o \
$(OUT_DIR)/clsys_win.o \ clsys_win.o \
$(OUT_DIR)/snd_win.o \ snd_win.o \
\ \
$(OUT_DIR)/pop3noti.o \ pop3noti.o \
$(OUT_DIR)/imapnoti.o \ imapnoti.o \
\ \
$(OUT_DIR)/m_x.o \ m_x.o \
$(OUT_DIR)/x_reqs.o \ x_reqs.o \
$(OUT_DIR)/x_res.o \ x_res.o \
\ \
$(OUT_DIR)/snd_mixa.o snd_mixa.o
#\ #\
# $(OUT_DIR)/sys_dosa.o # sys_dosa.o
SOFTWARE_OBJS = \ SOFTWARE_OBJS = \
$(OUT_DIR)/sw_screen.o \ sw_screen.o \
$(OUT_DIR)/sw_draw.o \ sw_draw.o \
$(OUT_DIR)/sw_model.o \ sw_model.o \
$(OUT_DIR)/r_aclip.o \ r_aclip.o \
$(OUT_DIR)/r_aclipa.o \ r_aclipa.o \
$(OUT_DIR)/r_alias.o \ r_alias.o \
$(OUT_DIR)/r_aliasa.o \ r_aliasa.o \
$(OUT_DIR)/r_bsp.o \ r_bsp.o \
$(OUT_DIR)/r_draw.o \ r_draw.o \
$(OUT_DIR)/r_drawa.o \ r_drawa.o \
$(OUT_DIR)/r_edge.o \ r_edge.o \
$(OUT_DIR)/r_edgea.o \ r_edgea.o \
$(OUT_DIR)/r_light.o \ r_light.o \
$(OUT_DIR)/r_main.o \ r_main.o \
$(OUT_DIR)/r_misc.o \ r_misc.o \
$(OUT_DIR)/r_sky.o \ r_sky.o \
$(OUT_DIR)/r_sprite.o \ r_sprite.o \
$(OUT_DIR)/r_surf.o \ r_surf.o \
$(OUT_DIR)/r_vars.o \ r_vars.o \
$(OUT_DIR)/r_varsa.o \ r_varsa.o \
\ \
$(OUT_DIR)/d_draw.o \ d_draw.o \
$(OUT_DIR)/d_draw16.o \ d_draw16.o \
$(OUT_DIR)/d_edge.o \ d_edge.o \
$(OUT_DIR)/d_fill.o \ d_fill.o \
$(OUT_DIR)/d_init.o \ d_init.o \
$(OUT_DIR)/d_modech.o \ d_modech.o \
$(OUT_DIR)/d_part.o \ d_part.o \
$(OUT_DIR)/d_parta.o \ d_parta.o \
$(OUT_DIR)/d_polyse.o \ d_polyse.o \
$(OUT_DIR)/d_polysa.o \ d_polysa.o \
$(OUT_DIR)/d_scan.o \ d_scan.o \
$(OUT_DIR)/d_scana.o \ d_scana.o \
$(OUT_DIR)/d_sky.o \ d_sky.o \
$(OUT_DIR)/d_spr8.o \ d_spr8.o \
$(OUT_DIR)/d_sprite.o \ d_sprite.o \
$(OUT_DIR)/d_surf.o \ d_surf.o \
$(OUT_DIR)/d_trans.o \ d_trans.o \
$(OUT_DIR)/d_vars.o \ d_vars.o \
$(OUT_DIR)/d_varsa.o \ d_varsa.o \
$(OUT_DIR)/d_zpoint.o \ d_zpoint.o \
\ \
$(OUT_DIR)/r_efrag.o \ r_efrag.o \
$(OUT_DIR)/surf16.o \ surf16.o \
$(OUT_DIR)/surf8.o surf8.o
# $(OUT_DIR)/d_copy.o \ # d_copy.o \
X11_OBJS = $(OUT_DIR)/vid_x.o X11_OBJS = vid_x.o
W32_OBJS = $(OUT_DIR)/vid_win2.o \ W32_OBJS = vid_win2.o \
$(OUT_DIR)/vid_ddraw.o \ vid_ddraw.o \
$(OUT_DIR)/vid_dib.o vid_dib.o
GLQUAKE_OBJS = \ GLQUAKE_OBJS = \
$(OUT_DIR)/gl_alias.o \ gl_alias.o \
$(OUT_DIR)/gl_ppl.o \ gl_ppl.o \
$(OUT_DIR)/gl_draw.o \ gl_draw.o \
$(OUT_DIR)/gl_model.o \ gl_model.o \
$(OUT_DIR)/gl_ngraph.o \ gl_ngraph.o \
$(OUT_DIR)/gl_rlight.o \ gl_rlight.o \
$(OUT_DIR)/gl_rmain.o \ gl_rmain.o \
$(OUT_DIR)/gl_rmisc.o \ gl_rmisc.o \
$(OUT_DIR)/glmod_doom.o \ glmod_doom.o \
$(OUT_DIR)/ltface.o \ ltface.o \
$(OUT_DIR)/gl_rsurf.o \ gl_rsurf.o \
$(OUT_DIR)/gl_vidcommon.o \ gl_vidcommon.o \
$(OUT_DIR)/gl_screen.o \ gl_screen.o \
$(OUT_DIR)/gl_backend.o \ gl_backend.o \
$(OUT_DIR)/gl_warp.o \ gl_warp.o \
$(OUT_DIR)/gl_hlmdl.o gl_hlmdl.o
# $(OUT_DIR)/gl_refrag.o \ # gl_refrag.o \
GLW32_OBJS = $(OUT_DIR)/gl_vidnt.o GLW32_OBJS = gl_vidnt.o
GLX_OBJS = $(OUT_DIR)/gl_vidlinuxglx.o GLX_OBJS = gl_vidlinuxglx.o
GLS_OBJS = $(OUT_DIR)/gl_vidlinux.o GLS_OBJS = gl_vidlinux.o
MP3_OBJS = \ MP3_OBJS = \
$(OUT_DIR)/fixed.o \ fixed.o \
$(OUT_DIR)/bit.o \ bit.o \
$(OUT_DIR)/timer.o \ timer.o \
$(OUT_DIR)/stream.o \ stream.o \
$(OUT_DIR)/frame.o \ frame.o \
$(OUT_DIR)/synth.o \ synth.o \
$(OUT_DIR)/decoder.o \ decoder.o \
$(OUT_DIR)/layer12.o \ layer12.o \
$(OUT_DIR)/layer3.o \ layer3.o \
$(OUT_DIR)/huffman.o \ huffman.o \
$(OUT_DIR)/mymad.o mymad.o
PROGS_OBJS = \ PROGS_OBJS = \
$(OUT_DIR)/comprout.o \ comprout.o \
$(OUT_DIR)/hash.o \ hash.o \
$(OUT_DIR)/initlib.o \ initlib.o \
$(OUT_DIR)/pr_edict.o \ pr_edict.o \
$(OUT_DIR)/pr_exec.o \ pr_exec.o \
$(OUT_DIR)/pr_multi.o \ pr_multi.o \
$(OUT_DIR)/qcc_cmdlib.o \ qcc_cmdlib.o \
$(OUT_DIR)/QccMain.o \ QccMain.o \
$(OUT_DIR)/qcc_pr_comp.o \ qcc_pr_comp.o \
$(OUT_DIR)/qcc_pr_lex.o \ qcc_pr_lex.o \
$(OUT_DIR)/qcdecomp.o \ qcdecomp.o \
$(OUT_DIR)/qcd_main.o qcd_main.o
SERVER_OBJS = \ SERVER_OBJS = \
$(OUT_DIR)/pr_cmds.o \ pr_cmds.o \
$(OUT_DIR)/sv_master.o \ sv_master.o \
$(OUT_DIR)/sv_init.o \ sv_init.o \
$(OUT_DIR)/sv_main.o \ sv_main.o \
$(OUT_DIR)/sv_nchan.o \ sv_nchan.o \
$(OUT_DIR)/sv_ents.o \ sv_ents.o \
$(OUT_DIR)/sv_send.o \ sv_send.o \
$(OUT_DIR)/sv_move.o \ sv_move.o \
$(OUT_DIR)/sv_phys.o \ sv_phys.o \
$(OUT_DIR)/sv_user.o \ sv_user.o \
$(OUT_DIR)/sv_mvd.o \ sv_mvd.o \
$(OUT_DIR)/sv_ccmds.o \ sv_ccmds.o \
$(OUT_DIR)/sv_rankin.o \ sv_rankin.o \
$(OUT_DIR)/sv_chat.o \ sv_chat.o \
$(OUT_DIR)/sv_demo.o \ sv_demo.o \
$(OUT_DIR)/world.o \ world.o \
$(OUT_DIR)/worlda.o \ worlda.o \
$(OUT_DIR)/net_preparse.o \ net_preparse.o \
$(OUT_DIR)/savegame.o \ savegame.o \
$(OUT_DIR)/svq2_ents.o \ svq2_ents.o \
$(OUT_DIR)/svq2_game.o \ svq2_game.o \
$(OUT_DIR)/snd_vc.o \ snd_vc.o \
$(OUT_DIR)/snd_voicecodecs.o \ snd_voicecodecs.o \
$(OUT_DIR)/g711.o \ g711.o \
$(OUT_DIR)/g721.o \ g721.o \
$(OUT_DIR)/g723_24.o \ g723_24.o \
$(OUT_DIR)/g723_40.o \ g723_40.o \
$(OUT_DIR)/g72x.o \ g72x.o \
$(OUT_DIR)/webgen.o \ webgen.o \
$(OUT_DIR)/ftpserver.o \ ftpserver.o \
$(OUT_DIR)/httpserver.o \ httpserver.o \
$(OUT_DIR)/sv_pop3.o \ sv_pop3.o \
$(OUT_DIR)/sv_smtp.o sv_smtp.o
SERVERONLY_OBJS = \ SERVERONLY_OBJS = \
$(OUT_DIR)/svmodel.o \ svmodel.o \
$(OUT_DIR)/svsys_win.o svsys_win.o
COMMON_OBJS = \ COMMON_OBJS = \
$(OUT_DIR)/common.o \ common.o \
$(OUT_DIR)/cvar.o \ cvar.o \
$(OUT_DIR)/cmd.o \ cmd.o \
$(OUT_DIR)/crc.o \ crc.o \
$(OUT_DIR)/mathlib.o \ mathlib.o \
$(OUT_DIR)/math.o \ math.o \
$(OUT_DIR)/md4.o \ md4.o \
$(OUT_DIR)/md5.o \ md5.o \
$(OUT_DIR)/huff.o \ huff.o \
$(OUT_DIR)/q2pmove.o \ q2pmove.o \
$(OUT_DIR)/net_chan.o \ net_chan.o \
$(OUT_DIR)/net_win.o \ net_win.o \
$(OUT_DIR)/zone.o \ zone.o \
$(OUT_DIR)/gl_q2bsp.o \ gl_q2bsp.o \
$(OUT_DIR)/q1bsp.o \ q1bsp.o \
$(OUT_DIR)/pmove.o \ pmove.o \
$(OUT_DIR)/pmovetst.o \ pmovetst.o \
$(OUT_DIR)/iwebiface.o \ iwebiface.o \
$(OUT_DIR)/translate.o translate.o
VPATH=$(CLIENT_DIR):$(COMMON_DIR)
all: all-rel all-dbg all: all-rel all-dbg
$(OUT_DIR)/image.o : $(CLIENT_DIR)/image.c .o : $(subst /, ,$(VPATH)) $@
$(DO_CC) $(DO_CC)
#$(OUT_DIR)/image.o : $(CLIENT_DIR)/image.c
# $(DO_CC)
$(OUT_DIR)/sw_screen.o : $(SW_DIR)/sw_screen.c $(OUT_DIR)/sw_screen.o : $(SW_DIR)/sw_screen.c
$(DO_CC) $(DO_CC)
$(OUT_DIR)/sw_draw.o : $(SW_DIR)/sw_draw.c $(OUT_DIR)/sw_draw.o : $(SW_DIR)/sw_draw.c

View file

@ -1592,8 +1592,8 @@ void CL_ParseProjectiles (int modelindex, qboolean nails2)
pr->origin[0] = ( ( bits[0] + ((bits[1]&15)<<8) ) <<1) - 4096; pr->origin[0] = ( ( bits[0] + ((bits[1]&15)<<8) ) <<1) - 4096;
pr->origin[1] = ( ( (bits[1]>>4) + (bits[2]<<4) ) <<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->origin[2] = ( ( bits[3] + ((bits[4]&15)<<8) ) <<1) - 4096;
pr->angles[0] = 360*(bits[4]>>4)/16; pr->angles[0] = 360*((int)bits[4]>>4)/16.0f;
pr->angles[1] = 360*bits[5]/256; pr->angles[1] = 360*(int)bits[5]/256.0f;
} }
} }
@ -1633,6 +1633,11 @@ void CL_LinkProjectiles (void)
#endif #endif
VectorCopy (pr->origin, ent->origin); VectorCopy (pr->origin, ent->origin);
VectorCopy (pr->angles, ent->angles); 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;
} }
} }

View file

@ -842,6 +842,32 @@ void CL_SendCmd (void)
int clientcount; 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_NONE)
{ {
if (cls.demoplayback == DPB_MVD) if (cls.demoplayback == DPB_MVD)

View file

@ -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_predict_players2 = {"cl_predict_players2", "1"};
cvar_t cl_solid_players = {"cl_solid_players", "1"}; cvar_t cl_solid_players = {"cl_solid_players", "1"};
cvar_t cl_demospeed = {"cl_demospeed", "0"};
cvar_t localid = {"localid", ""}; cvar_t localid = {"localid", ""};
static qboolean allowremotecmd = true; 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 name = {"name", "unnamed", NULL, CVAR_ARCHIVE | CVAR_USERINFO};
cvar_t team = {"team", "", 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 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 topcolor = {"topcolor", "", NULL, CVAR_ARCHIVE | CVAR_USERINFO};
cvar_t bottomcolor = {"bottomcolor", "", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; cvar_t bottomcolor = {"bottomcolor", "", NULL, CVAR_ARCHIVE | CVAR_USERINFO};
cvar_t rate = {"rate", "2500", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; cvar_t rate = {"rate", "2500", NULL, CVAR_ARCHIVE | CVAR_USERINFO};
@ -399,7 +402,16 @@ void CL_SendConnectPacket (
clients = 1; clients = 1;
#endif #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); sprintf(data, "%c%c%c%cconnect", 255, 255, 255, 255);
if (clients>1) //splitscreen 'connect' command specifies the number of userinfos sent. if (clients>1) //splitscreen 'connect' command specifies the number of userinfos sent.
strcat(data, va("%i", clients)); strcat(data, va("%i", clients));
@ -764,6 +776,9 @@ void CL_Disconnect (void)
// stop sounds (especially looping!) // stop sounds (especially looping!)
S_StopAllSounds (true); S_StopAllSounds (true);
#ifdef VM_CGAME
CG_Stop();
#endif
// if running a local server, shut it down // if running a local server, shut it down
if (cls.demoplayback != DPB_NONE) if (cls.demoplayback != DPB_NONE)
@ -866,6 +881,8 @@ void CL_Disconnect (void)
if (!isDedicated) if (!isDedicated)
#endif #endif
SCR_EndLoadingPlaque(); SCR_EndLoadingPlaque();
cls.q2server = 0;
} }
#undef serverrunning #undef serverrunning
@ -1257,10 +1274,7 @@ void CL_SetInfo_f (void)
{ {
#ifdef Q2CLIENT #ifdef Q2CLIENT
if (cls.q2server) if (cls.q2server)
{ cls.resendinfo = true;
MSG_WriteByte (&cls.netchan.message, clcq2_userinfo);
MSG_WriteString (&cls.netchan.message, cls.userinfo);
}
else else
#endif #endif
Cmd_ForwardToServer (); Cmd_ForwardToServer ();
@ -1520,37 +1534,58 @@ void CL_ConnectionlessPacket (void)
if (cls.demoplayback == DPB_NONE) if (cls.demoplayback == DPB_NONE)
Con_TPrintf (TL_ST_COLON, NET_AdrToString (net_from)); 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; unsigned long pext = 0, huffcrc=0;
Con_TPrintf (TLC_S2C_CHALLENGE); Con_TPrintf (TLC_S2C_CHALLENGE);
s = MSG_ReadString (); s = MSG_ReadString ();
COM_Parse(s); 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; 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; 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. {//and if it's not, we're unlikly to be compatable with whatever it is that's talking at us.
#ifdef NQPROT #ifdef NQPROT
CL_ConnectToDarkPlaces(s+9, net_from); CL_ConnectToDarkPlaces(s+9, net_from);
#else #else
Con_Printf("Cannot connect to DarkPlaces\n"); Con_Printf("\nUnable connect to DarkPlaces\n");
#endif #endif
return; return;
} }
#ifdef Q2CLIENT #ifdef Q2CLIENT
cls.q2server = true; cls.q2server = true;
#else
Con_Printf("\nUnable to connect to Quake2\n");
#endif #endif
s+=9; s+=9;
} }
#ifdef Q3CLIENT
else if (!strcmp(com_token, "onnectResponse"))
{
goto client_connect;
}
#endif
#ifdef Q2CLIENT #ifdef Q2CLIENT
else if (!strcmp(com_token, "lient_connect")) else if (!strcmp(com_token, "lient_connect"))
{ {
@ -1605,6 +1640,20 @@ void CL_ConnectionlessPacket (void)
{ {
goto client_connect; 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 else
{ {
Con_TPrintf (TLC_Q2CONLESSPACKET_UNKNOWN, s); Con_TPrintf (TLC_Q2CONLESSPACKET_UNKNOWN, s);
@ -1642,6 +1691,13 @@ void CL_ConnectionlessPacket (void)
} }
#endif #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) if (c == S2C_CONNECTION)
{ {
int compress; int compress;
@ -1715,6 +1771,15 @@ client_connect: //fixme: make function
return; return;
} }
// print command from somewhere // 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) if (c == A2C_PRINT)
{ {
Con_TPrintf (TLC_A2C_PRINT); Con_TPrintf (TLC_A2C_PRINT);
@ -1808,6 +1873,14 @@ void CL_ReadPackets (void)
if (cls.state == ca_disconnected) if (cls.state == ca_disconnected)
continue; //ignore it. We arn't connected. continue; //ignore it. We arn't connected.
#ifdef Q3CLIENT
if (cls.q2server == 2)
{
CLQ3_ParseServerMessage();
continue;
}
#endif
if (cls.demoplayback == DPB_MVD) if (cls.demoplayback == DPB_MVD)
MSG_BeginReading(); MSG_BeginReading();
else if (!Netchan_Process(&cls.netchan)) else if (!Netchan_Process(&cls.netchan))
@ -1852,7 +1925,7 @@ void CL_ReadPackets (void)
// MSG_ReadLong(); // MSG_ReadLong();
#ifdef Q2CLIENT #ifdef Q2CLIENT
if (cls.q2server) if (cls.q2server)
CLQ2_ParseServerMessage (); CLQ2_ParseServerMessage ();
else else
#endif #endif
@ -2074,6 +2147,7 @@ void CL_Init (void)
Cvar_Register (&cfg_save_name, cl_controlgroup); Cvar_Register (&cfg_save_name, cl_controlgroup);
Cvar_Register (&cl_demospeed, "Demo playback");
Cvar_Register (&cl_warncmd, "Warnings"); Cvar_Register (&cl_warncmd, "Warnings");
Cvar_Register (&cl_upspeed, cl_inputgroup); Cvar_Register (&cl_upspeed, cl_inputgroup);
Cvar_Register (&cl_forwardspeed, cl_inputgroup); Cvar_Register (&cl_forwardspeed, cl_inputgroup);
@ -2119,6 +2193,7 @@ void CL_Init (void)
Cvar_Register (&password, cl_controlgroup); Cvar_Register (&password, cl_controlgroup);
Cvar_Register (&spectator, cl_controlgroup); Cvar_Register (&spectator, cl_controlgroup);
Cvar_Register (&skin, cl_controlgroup); Cvar_Register (&skin, cl_controlgroup);
Cvar_Register (&model, cl_controlgroup);
Cvar_Register (&team, cl_controlgroup); Cvar_Register (&team, cl_controlgroup);
Cvar_Register (&topcolor, cl_controlgroup); Cvar_Register (&topcolor, cl_controlgroup);
Cvar_Register (&bottomcolor, cl_controlgroup); Cvar_Register (&bottomcolor, cl_controlgroup);
@ -2429,6 +2504,9 @@ void Host_Frame (float time)
time = recordavi_frametime; time = recordavi_frametime;
#endif #endif
if (cls.demoplayback && cl_demospeed.value>0)
time *= cl_demospeed.value;
#ifndef CLIENTONLY #ifndef CLIENTONLY
RSpeedRemark(); RSpeedRemark();
SV_Frame(time); SV_Frame(time);

View file

@ -111,9 +111,9 @@ extern cvar_t con_height;
qboolean scr_initialized; // ready to draw qboolean scr_initialized; // ready to draw
qpic_t *scr_ram; mpic_t *scr_ram;
qpic_t *scr_net; mpic_t *scr_net;
qpic_t *scr_turtle; mpic_t *scr_turtle;
int scr_fullupdate; int scr_fullupdate;
@ -433,7 +433,7 @@ void SCR_ShowPics_Draw(void)
downloadlist_t *failed; downloadlist_t *failed;
float x, y; float x, y;
showpic_t *sp; showpic_t *sp;
qpic_t *p; mpic_t *p;
for (sp = showpics; sp; sp = sp->next) for (sp = showpics; sp; sp = sp->next)
{ {
x = sp->x; x = sp->x;
@ -747,12 +747,15 @@ void SCR_CrosshairPosition(int pnum, int *x, int *y)
vec3_t start; vec3_t start;
vec3_t right, up, fwds; vec3_t right, up, fwds;
AngleVectors(cl.viewangles[pnum], fwds, right, up); AngleVectors(cl.simangles[pnum], fwds, right, up);
VectorMA(cl.simorg[pnum], 100000, fwds, end);
VectorCopy(cl.simorg[pnum], start);
start[2]+=16;
VectorMA(start, 100000, fwds, end);
memset(&tr, 0, sizeof(tr)); memset(&tr, 0, sizeof(tr));
tr.fraction = 1; 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) if (tr.fraction == 1)
{ {
*x = rect.x + rect.width/2 + cl_crossx.value; *x = rect.x + rect.width/2 + cl_crossx.value;
@ -761,11 +764,10 @@ void SCR_CrosshairPosition(int pnum, int *x, int *y)
} }
else else
{ {
VectorCopy(cl.simorg[pnum], start); start[2]+=cl.viewheight[pnum]/4;
start[2] -= cl.viewheight[pnum]/4; ML_Project(tr.endpos, end, cl.simangles[pnum], start, (float)rect.width/rect.height, r_refdef.fov_y);
ML_Project(tr.endpos, end, cl.viewangles[pnum], start, (float)rect.width/rect.height, r_refdef.fov_y);
*x = rect.x+rect.width*end[0]; *x = rect.x+rect.width*end[0];
*y = rect.y+rect.height*end[1]; *y = rect.y+rect.height*(1-end[1]);
return; return;
} }
} }
@ -955,7 +957,7 @@ DrawPause
*/ */
void SCR_DrawPause (void) void SCR_DrawPause (void)
{ {
qpic_t *pic; mpic_t *pic;
if (!scr_showpause.value) // turn off for screenshots if (!scr_showpause.value) // turn off for screenshots
return; return;
@ -986,7 +988,7 @@ int total_loading_size, current_loading_size, loading_stage;
char levelshotname[MAX_QPATH]; char levelshotname[MAX_QPATH];
void SCR_DrawLoading (void) void SCR_DrawLoading (void)
{ {
qpic_t *pic; mpic_t *pic;
if (!scr_drawloading) if (!scr_drawloading)
return; return;

View file

@ -48,6 +48,9 @@ int VMUI_fopen (char *name, int *handle, int fmode, int owner)
{ {
int i; int i;
if (!handle)
return FS_FLocateFile(name, FSLFRT_LENGTH, NULL);
*handle = 0; *handle = 0;
for (i = 0; i < MAX_VMUI_FILES; i++) for (i = 0; i < MAX_VMUI_FILES; i++)
@ -317,6 +320,14 @@ typedef struct q3refEntity_s {
float rotation; float rotation;
} q3refEntity_t; } 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) void VQ3_AddEntity(const q3refEntity_t *q3)
{ {
entity_t ent; entity_t ent;
@ -333,10 +344,94 @@ void VQ3_AddEntity(const q3refEntity_t *q3)
ent.lerpfrac = ent.lerptime = q3->backlerp; ent.lerpfrac = ent.lerptime = q3->backlerp;
ent.alpha = 1; ent.alpha = 1;
ent.scale = 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); VectorCopy(q3->origin, ent.origin);
V_AddEntity(&ent); 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_STRINGS 8
#define MAX_RENDER_STRING_LENGTH 32 #define MAX_RENDER_STRING_LENGTH 32
@ -359,10 +454,11 @@ typedef struct q3refdef_s {
// text messages for deform text shaders // text messages for deform text shaders
char text[MAX_RENDER_STRINGS][MAX_RENDER_STRING_LENGTH]; char text[MAX_RENDER_STRINGS][MAX_RENDER_STRING_LENGTH];
} q3refdef_t; } q3refdef_t;
void VQ3_RenderView(const q3refdef_t *ref) void VQ3_RenderView(const q3refdef_t *ref)
{ {
VectorCopy(ref->vieworg, r_refdef.vieworg); 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[1] = (atan2(ref->viewaxis[0][1], ref->viewaxis[0][0]) * 180 / M_PI);
r_refdef.viewangles[2] = 0; r_refdef.viewangles[2] = 0;
r_refdef.flags = ref->rdflags; 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.y = ref->y;
r_refdef.vrect.width = ref->width; r_refdef.vrect.width = ref->width;
r_refdef.vrect.height = ref->height; r_refdef.vrect.height = ref->height;
memcpy(cl.q2frame.areabits, ref->areamask, sizeof(cl.q2frame.areabits));
#ifdef RGLQUAKE #ifdef RGLQUAKE
if (qrenderer == QR_OPENGL) if (qrenderer == QR_OPENGL)
{ {
gl_ztrickdisabled|=16;
glDisable(GL_ALPHA_TEST); glDisable(GL_ALPHA_TEST);
glDisable(GL_BLEND); glDisable(GL_BLEND);
} }
@ -383,12 +482,21 @@ void VQ3_RenderView(const q3refdef_t *ref)
#ifdef RGLQUAKE #ifdef RGLQUAKE
if (qrenderer == QR_OPENGL) if (qrenderer == QR_OPENGL)
{ {
gl_ztrickdisabled&=~16;
GL_Set2D (); GL_Set2D ();
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_TexEnv(GL_MODULATE); GL_TexEnv(GL_MODULATE);
} }
#endif #endif
#ifdef RGLQUAKE
if (qrenderer == QR_OPENGL)
{
glDisable(GL_ALPHA_TEST);
glEnable(GL_BLEND);
}
#endif
vid.recalc_refdef = 1; 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 // tag, model, startFrame, endFrame, frac, tagName
if ((int)arg[0] + sizeof(float)*12 >= mask || VM_POINTER(arg[0]) < offset) if ((int)arg[0] + sizeof(float)*12 >= mask || VM_POINTER(arg[0]) < offset)
break; //out of bounds. break; //out of bounds.
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]));
{
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;
}
}
*/
break; break;
case UI_SOUND_PRECACHE: case UI_SOUND_PRECACHE:

View file

@ -167,6 +167,7 @@ typedef struct
usercmd_t cmd[MAX_SPLITS]; // cmd that generated the frame usercmd_t cmd[MAX_SPLITS]; // cmd that generated the frame
double senttime; // time cmd was sent off double senttime; // time cmd was sent off
int delta_sequence; // sequence number to delta from, -1 = full update int delta_sequence; // sequence number to delta from, -1 = full update
int cmd_sequence;
// received from server // received from server
double receivedtime; // time message was received, or -1 double receivedtime; // time message was received, or -1

View file

@ -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... //this is the same order as q3, except that white and black are swapped...
consolecolours_t consolecolours[] = { consolecolours_t consolecolours[] = {
#define CON_WHITEMASK 0*256 //must be constant. things assume this #define CON_WHITEMASK 7*256 //must be constant. things assume this
{1, 1, 1}, {0, 0, 0},
{1, 0, 0}, {1, 0, 0},
{0, 1, 0}, {0, 1, 0},
{1, 1, 0}, {1, 1, 0},
{0.1, 0.1, 1}, //brighten dark blue a little {0.1, 0.1, 1}, //brighten dark blue a little
{1, 0, 1}, {1, 0, 1},
{0, 1, 1}, {0, 1, 1},
{0, 0, 0} {1, 1, 1}
}; };
int con_ormask; int con_ormask;

View file

@ -7,7 +7,7 @@ qboolean bindingactive;
void Draw_TextBox (int x, int y, int width, int lines) void Draw_TextBox (int x, int y, int width, int lines)
{ {
qpic_t *p; mpic_t *p;
int cx, cy; int cx, cy;
int n; 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) void Draw_BigFontString(int x, int y, const char *text)
{ {
int sx, sy; int sx, sy;
qpic_t *p; mpic_t *p;
p = Draw_SafeCachePic ("gfx/menu/bigfont.lmp"); p = Draw_SafeCachePic ("gfx/menu/bigfont.lmp");
while(*text) while(*text)
@ -111,7 +111,7 @@ int dotofs;
void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu) void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu)
{ {
int i; int i;
qpic_t *p; mpic_t *p;
while (option) while (option)
{ {
if (mousemoved && !bindingactive) 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) menupicture_t *MC_AddCenterPicture(menu_t *menu, int y, char *picname)
{ {
int x; int x;
qpic_t *p; mpic_t *p;
if (!qrenderer) if (!qrenderer)
return NULL; return NULL;
@ -1273,7 +1273,7 @@ void M_Menu_Main_f (void)
extern cvar_t m_helpismedia; extern cvar_t m_helpismedia;
menubutton_t *b; menubutton_t *b;
menu_t *mainm; menu_t *mainm;
qpic_t *p; mpic_t *p;
int q1, q2, h2; int q1, q2, h2;

View file

@ -288,7 +288,7 @@ void Media_LoadTrackNames (char *listname);
void M_Media_Draw (void) void M_Media_Draw (void)
{ {
qpic_t *p; mpic_t *p;
mediatrack_t *track; mediatrack_t *track;
int y; int y;
int op, i; int op, i;

View file

@ -10,7 +10,7 @@ void M_Menu_MultiPlayer_f (void)
{ {
menubutton_t *b; menubutton_t *b;
menu_t *menu; menu_t *menu;
qpic_t *p; mpic_t *p;
p = Draw_SafeCachePic("gfx/mp_menu.lmp"); 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]; extern qbyte translationTable[256];
setupmenu_t *info = menu->data; setupmenu_t *info = menu->data;
qpic_t *p; mpic_t *p;
p = Draw_CachePic ("gfx/bigbox.lmp"); p = Draw_CachePic ("gfx/bigbox.lmp");
Draw_TransPic (x-12, y-8, p); Draw_TransPic (x-12, y-8, p);

View file

@ -358,7 +358,10 @@ void M_Menu_FPS_f (void)
#ifdef RGLQUAKE #ifdef RGLQUAKE
extern cvar_t gl_compress, gl_waterripples, gl_detail, gl_bump, gl_2dscale, r_flashblend; extern cvar_t gl_compress, gl_waterripples, gl_detail, gl_bump, gl_2dscale, r_flashblend;
#endif #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; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;

View file

@ -30,7 +30,7 @@ void M_ScanSaves (void)
strcpy (m_filenames[i], "--- UNUSED SLOT ---"); strcpy (m_filenames[i], "--- UNUSED SLOT ---");
loadable[i] = false; 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"); f = fopen (name, "rb");
if (f) if (f)
{ {
@ -150,7 +150,7 @@ void M_Menu_SinglePlayer_f (void)
int q1, q2, h2; int q1, q2, h2;
menubutton_t *b; menubutton_t *b;
menu_t *menu; menu_t *menu;
qpic_t *p; mpic_t *p;
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;

View file

@ -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); 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); 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); 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) void M_DrawTextBox (int x, int y, int width, int lines)
{ {
qpic_t *p; mpic_t *p;
int cx, cy; int cx, cy;
int n; int n;
@ -407,7 +407,7 @@ void M_Keys_Draw (void)
int keys[2]; int keys[2];
char *name; char *name;
int x, y; int x, y;
qpic_t *p; mpic_t *p;
p = Draw_SafeCachePic ("gfx/ttl_cstm.lmp"); p = Draw_SafeCachePic ("gfx/ttl_cstm.lmp");
if (p) if (p)
@ -549,7 +549,7 @@ void M_Menu_Help_f (void)
void M_Help_Draw (void) void M_Help_Draw (void)
{ {
qpic_t *pic; mpic_t *pic;
pic = Draw_SafeCachePic(va(helpstyle, help_page+helppagemin)); pic = Draw_SafeCachePic(va(helpstyle, help_page+helppagemin));
if (!pic) if (!pic)
M_Menu_Main_f (); M_Menu_Main_f ();

View file

@ -35,7 +35,7 @@ void M_Keydown (int key);
void M_Keyup (int key); void M_Keyup (int key);
void M_Draw (int uimenu); void M_Draw (int uimenu);
void M_ToggleMenu_f (void); 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_DrawTextBox (int x, int y, int width, int lines);
void M_Menu_Quit_f (void); void M_Menu_Quit_f (void);
@ -283,12 +283,12 @@ void M_SListKey(int key);
//drawing funcs //drawing funcs
void M_BuildTranslationTable(int top, int bottom); 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);
void M_DrawTransPic (int x, int y, qpic_t *pic); void M_DrawTransPic (int x, int y, mpic_t *pic);
void M_DrawCharacter (int cx, int line, unsigned int num); void M_DrawCharacter (int cx, int line, unsigned int num);
void M_Print (int cx, int cy, qbyte *str); void M_Print (int cx, int cy, qbyte *str);
void M_PrintWhite (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); void M_FindKeysForCommand (char *command, int *twokeys);

View file

@ -14,10 +14,10 @@ extern r_qrenderer_t qrenderer;
extern char *q_renderername; extern char *q_renderername;
extern qpic_t *(*Draw_PicFromWad) (char *name); extern mpic_t *(*Draw_PicFromWad) (char *name);
extern qpic_t *(*Draw_SafePicFromWad) (char *name); extern mpic_t *(*Draw_SafePicFromWad) (char *name);
extern qpic_t *(*Draw_CachePic) (char *path); extern mpic_t *(*Draw_CachePic) (char *path);
extern qpic_t *(*Draw_SafeCachePic) (char *path); extern mpic_t *(*Draw_SafeCachePic) (char *path);
extern void (*Draw_Init) (void); extern void (*Draw_Init) (void);
extern void (*Draw_ReInit) (void); extern void (*Draw_ReInit) (void);
extern void (*Draw_Character) (int x, int y, unsigned int num); 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_Alt_String) (int x, int y, const qbyte *str);
extern void (*Draw_Crosshair) (void); extern void (*Draw_Crosshair) (void);
extern void (*Draw_DebugChar) (qbyte num); extern void (*Draw_DebugChar) (qbyte num);
extern void (*Draw_Pic) (int x, int y, qpic_t *pic); extern void (*Draw_Pic) (int x, int y, mpic_t *pic);
extern void (*Draw_ScalePic) (int x, int y, int width, int height, qpic_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, qpic_t *pic, int srcx, int srcy, int width, int height); 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, qpic_t *pic); extern void (*Draw_TransPic) (int x, int y, mpic_t *pic);
extern void (*Draw_TransPicTranslate) (int x, int y, qpic_t *pic, qbyte *translation); extern void (*Draw_TransPicTranslate) (int x, int y, mpic_t *pic, qbyte *translation);
extern void (*Draw_ConsoleBackground) (int lines); extern void (*Draw_ConsoleBackground) (int lines);
extern void (*Draw_EditorBackground) (int lines); extern void (*Draw_EditorBackground) (int lines);
extern void (*Draw_TileClear) (int x, int y, int w, int h); 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 void (*Draw_EndDisc) (void);
extern qboolean (*Draw_IsCached) (char *picname); //can be null 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 (*Draw_ImageColours) (float r, float g, float b, float a);
extern void (*R_Init) (void); extern void (*R_Init) (void);

View file

@ -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) void PF_CL_precache_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{ {
char *str; char *str;
qpic_t *pic; mpic_t *pic;
str = PR_GetStringOfs(prinst, OFS_PARM0); 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); float *pos = G_VECTOR(OFS_PARM0);
char *picname = PR_GetStringOfs(prinst, OFS_PARM1); 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 *size = G_VECTOR(OFS_PARM2);
float *rgb = G_VECTOR(OFS_PARM3); float *rgb = G_VECTOR(OFS_PARM3);
float alpha = G_FLOAT(OFS_PARM4); 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) void PF_CL_drawgetimagesize (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{ {
char *picname = PR_GetStringOfs(prinst, OFS_PARM0); 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); float *ret = G_VECTOR(OFS_RETURN);

View file

@ -696,19 +696,20 @@ void R_AssosiateEffect_f (void)
int effectnum; int effectnum;
model_t *model; model_t *model;
if ( strstr(modelname, "player") || if (!cls.demoplayback && (
strstr(modelname, "player") ||
strstr(modelname, "eyes") || strstr(modelname, "eyes") ||
strstr(modelname, "flag") || strstr(modelname, "flag") ||
strstr(modelname, "tf_stan") || strstr(modelname, "tf_stan") ||
strstr(modelname, ".bsp") || strstr(modelname, ".bsp") ||
strstr(modelname, "turr")) strstr(modelname, "turr")))
{ {
Con_Printf("Sorry: Not allowed to attach effects to model \"%s\"\n", modelname); Con_Printf("Sorry: Not allowed to attach effects to model \"%s\"\n", modelname);
return; return;
} }
model = Mod_FindName(modelname); 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); Con_Printf("Sorry: You may not assosiate effects with item model \"%s\"\n", modelname);
return; return;
@ -727,10 +728,11 @@ void R_AssosiateTrail_f (void)
int effectnum; int effectnum;
model_t *model; model_t *model;
if ( strstr(modelname, "player") || if (!cls.demoplayback && (
strstr(modelname, "player") ||
strstr(modelname, "eyes") || strstr(modelname, "eyes") ||
strstr(modelname, "flag") || strstr(modelname, "flag") ||
strstr(modelname, "tf_stan")) strstr(modelname, "tf_stan")))
{ {
Con_Printf("Sorry, you can't assosiate trails with model \"%s\"\n", modelname); Con_Printf("Sorry, you can't assosiate trails with model \"%s\"\n", modelname);
return; return;
@ -1190,6 +1192,13 @@ glEnable(GL_DEPTH_TEST);
{ {
// if (st->face->visframe != r_framecount) // if (st->face->visframe != r_framecount)
// continue; // continue;
if (st->face->visframe != r_framecount)
{
st->nexttime = particletime;
continue;
}
while (st->nexttime < particletime) while (st->nexttime < particletime)
{ {
if (!free_particles) if (!free_particles)
@ -1208,7 +1217,7 @@ glEnable(GL_DEPTH_TEST);
if (Length(vdist) > (1024+512)*frandom()) if (Length(vdist) > (1024+512)*frandom())
continue; continue;
VectorMA(org, 0.5, st->face->normal, org);
if (!(cl.worldmodel->hulls->funcs.HullPointContents(cl.worldmodel->hulls, org) & FTECONTENTS_SOLID)) if (!(cl.worldmodel->hulls->funcs.HullPointContents(cl.worldmodel->hulls, org) & FTECONTENTS_SOLID))
{ {
if (st->face->flags & SURF_PLANEBACK) 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)) if (traces-->0&&tr(oldorg, p->org, stop, normal))
{ {
R_AddStain(stop, p->rgb[1]*-10+p->rgb[2]*-10, 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[2]*-10),
p->rgb[0]*-10+p->rgb[1]*-10, (p->rgb[0]*-10+p->rgb[1]*-10),
30*p->alpha); 30*p->alpha*type->stains);
p->die = -1; p->die = -1;
continue; continue;
} }

View file

@ -100,8 +100,9 @@ char *particle_set_spikeset =
"r_part t_gib\n" "r_part t_gib\n"
"{\n" "{\n"
" texture \"particles/bloodtrail\"\n" " texture \"particles/bloodtrail\"\n"
" step 1\n" " step 4\n"
" scale 13\n" " scale 30\n"
" scalefactor 1\n"
" scaledelta 0\n" " scaledelta 0\n"
" alpha 0.7\n" " alpha 0.7\n"
" die 3\n" " die 3\n"
@ -121,12 +122,13 @@ char *particle_set_spikeset =
"{\n" "{\n"
" texture \"particles/bloodtrail\"\n" " texture \"particles/bloodtrail\"\n"
" count 1\n" " count 1\n"
" scale 15\n" " scale 25\n"
" scalefactor 1\n"
" alpha 0.3\n" " alpha 0.3\n"
" die 10\n" " die 10\n"
" randomvel 256\n" " randomvel 256\n"
" veeladd 128\n" " veeladd 128\n"
" red 192\n" " red 112\n"
" green 0\n" " green 0\n"
" blue 0\n" " blue 0\n"
" reddelta -128\n" " reddelta -128\n"
@ -171,7 +173,7 @@ char *particle_set_spikeset =
" count 1\n" " count 1\n"
" scale 15\n" " scale 15\n"
" alpha 0.3\n" " alpha 0.3\n"
" die 10\n" " die 1\n"
" randomvel 32\n" " randomvel 32\n"
" veladd 32\n" " veladd 32\n"
" red 192\n" " red 192\n"
@ -190,7 +192,7 @@ char *particle_set_spikeset =
" count 256\n" " count 256\n"
" scale 1\n" " scale 1\n"
" alpha 0.7\n" " alpha 0.7\n"
" die 10\n" " die 1\n"
" randomvel 512\n" " randomvel 512\n"
" veladd 128\n" " veladd 128\n"
" red 255\n" " red 255\n"
@ -207,13 +209,13 @@ char *particle_set_spikeset =
" count 256\n" " count 256\n"
" scale 1\n" " scale 1\n"
" alpha 0.7\n" " alpha 0.7\n"
" die 10\n" " die 1\n"
" randomvel 512\n" " randomvel 512\n"
" veladd 128\n" " veladd 128\n"
" red 255\n" " red 255\n"
" green 128\n" " green 128\n"
" gravity 800\n" " gravity 800\n"
" clliptype sparks\n" " cliptype sparks\n"
" clipcount 3\n" " clipcount 3\n"
" blend add\n" " blend add\n"
" assoc sparks\n" " assoc sparks\n"
@ -225,7 +227,7 @@ char *particle_set_spikeset =
" count 32\n" " count 32\n"
" scale 1\n" " scale 1\n"
" alpha 0.7\n" " alpha 0.7\n"
" die 10\n" " die 1\n"
" randomvel 512\n" " randomvel 512\n"
" veladd 128\n" " veladd 128\n"
" red 255\n" " red 255\n"

View file

@ -41,7 +41,9 @@ typedef struct entity_s
int keynum; // for matching entities in different frames int keynum; // for matching entities in different frames
vec3_t origin; vec3_t origin;
vec3_t angles; vec3_t angles;
vec3_t axis[3]; vec3_t axis[3];
byte_vec4_t shaderRGBA;
vec3_t oldorigin; vec3_t oldorigin;
vec3_t oldangles; vec3_t oldangles;

View file

@ -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}; static cvar_t vid_stretch = {"vid_stretch","1", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH};
//cvar_t _windowed_mouse = {"_windowed_mouse","1", CVAR_ARCHIVE}; //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}; cvar_t vid_renderer = {"vid_renderer", "", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH};
static cvar_t vid_bpp = {"vid_bpp", "32", 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; qbyte *dest;
// create a simple checkerboard texture for the default // 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->pixbytes = 1;
r_notexture_mip->width = r_notexture_mip->height = 16; r_notexture_mip->width = r_notexture_mip->height = 16;
@ -556,10 +556,10 @@ void Renderer_Init(void)
} }
qpic_t *(*Draw_PicFromWad) (char *name); mpic_t *(*Draw_PicFromWad) (char *name);
qpic_t *(*Draw_SafePicFromWad) (char *name); mpic_t *(*Draw_SafePicFromWad) (char *name);
qpic_t *(*Draw_CachePic) (char *path); mpic_t *(*Draw_CachePic) (char *path);
qpic_t *(*Draw_SafeCachePic) (char *path); mpic_t *(*Draw_SafeCachePic) (char *path);
void (*Draw_Init) (void); void (*Draw_Init) (void);
void (*Draw_ReInit) (void); void (*Draw_ReInit) (void);
void (*Draw_Character) (int x, int y, unsigned int num); 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_Alt_String) (int x, int y, const qbyte *str);
void (*Draw_Crosshair) (void); void (*Draw_Crosshair) (void);
void (*Draw_DebugChar) (qbyte num); void (*Draw_DebugChar) (qbyte num);
void (*Draw_Pic) (int x, int y, qpic_t *pic); void (*Draw_Pic) (int x, int y, mpic_t *pic);
void (*Draw_ScalePic) (int x, int y, int width, int height, qpic_t *pic); void (*Draw_ScalePic) (int x, int y, int width, int height, mpic_t *pic);
void (*Draw_SubPic) (int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height); 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, qpic_t *pic); void (*Draw_TransPic) (int x, int y, mpic_t *pic);
void (*Draw_TransPicTranslate) (int x, int y, qpic_t *pic, qbyte *translation); void (*Draw_TransPicTranslate) (int x, int y, mpic_t *pic, qbyte *translation);
void (*Draw_ConsoleBackground) (int lines); void (*Draw_ConsoleBackground) (int lines);
void (*Draw_EditorBackground) (int lines); void (*Draw_EditorBackground) (int lines);
void (*Draw_TileClear) (int x, int y, int w, int h); 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_BeginDisc) (void);
void (*Draw_EndDisc) (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 (*Draw_ImageColours) (float r, float g, float b, float a);
void (*R_Init) (void); void (*R_Init) (void);
@ -646,10 +646,10 @@ struct {
char *name[4]; char *name[4];
r_qrenderer_t rtype; r_qrenderer_t rtype;
qpic_t *(*Draw_PicFromWad) (char *name); mpic_t *(*Draw_PicFromWad) (char *name);
qpic_t *(*Draw_SafePicFromWad) (char *name); mpic_t *(*Draw_SafePicFromWad) (char *name);
qpic_t *(*Draw_CachePic) (char *path); mpic_t *(*Draw_CachePic) (char *path);
qpic_t *(*Draw_SafeCachePic) (char *path); mpic_t *(*Draw_SafeCachePic) (char *path);
void (*Draw_Init) (void); void (*Draw_Init) (void);
void (*Draw_ReInit) (void); void (*Draw_ReInit) (void);
void (*Draw_Character) (int x, int y, unsigned int num); 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_Alt_String) (int x, int y, const qbyte *str);
void (*Draw_Crosshair) (void); void (*Draw_Crosshair) (void);
void (*Draw_DebugChar) (qbyte num); void (*Draw_DebugChar) (qbyte num);
void (*Draw_Pic) (int x, int y, qpic_t *pic); void (*Draw_Pic) (int x, int y, mpic_t *pic);
void (*Draw_ScalePic) (int x, int y, int width, int height, qpic_t *pic); void (*Draw_ScalePic) (int x, int y, int width, int height, mpic_t *pic);
void (*Draw_SubPic) (int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height); 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, qpic_t *pic); void (*Draw_TransPic) (int x, int y, mpic_t *pic);
void (*Draw_TransPicTranslate) (int x, int y, qpic_t *pic, qbyte *translation); void (*Draw_TransPicTranslate) (int x, int y, mpic_t *pic, qbyte *translation);
void (*Draw_ConsoleBackground) (int lines); void (*Draw_ConsoleBackground) (int lines);
void (*Draw_EditorBackground) (int lines); void (*Draw_EditorBackground) (int lines);
void (*Draw_TileClear) (int x, int y, int w, int h); void (*Draw_TileClear) (int x, int y, int w, int h);
@ -671,7 +671,7 @@ struct {
void (*Draw_BeginDisc) (void); void (*Draw_BeginDisc) (void);
void (*Draw_EndDisc) (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 (*Draw_ImageColours) (float r, float g, float b, float a);
void (*R_Init) (void); void (*R_Init) (void);

View file

@ -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 int sb_updates; // if >= vid.numpages, no update needed
#define STAT_MINUS 10 // num frame for '-' stats digit #define STAT_MINUS 10 // num frame for '-' stats digit
qpic_t *sb_nums[2][11]; mpic_t *sb_nums[2][11];
qpic_t *sb_colon, *sb_slash; mpic_t *sb_colon, *sb_slash;
qpic_t *sb_ibar; mpic_t *sb_ibar;
qpic_t *sb_sbar; mpic_t *sb_sbar;
qpic_t *sb_scorebar; mpic_t *sb_scorebar;
qpic_t *sb_weapons[7][8]; // 0 is active, 1 is owned, 2-5 are flashes mpic_t *sb_weapons[7][8]; // 0 is active, 1 is owned, 2-5 are flashes
qpic_t *sb_ammo[4]; mpic_t *sb_ammo[4];
qpic_t *sb_sigil[4]; mpic_t *sb_sigil[4];
qpic_t *sb_armor[3]; mpic_t *sb_armor[3];
qpic_t *sb_items[32]; 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 // 0 is static, 1 is temporary animation
qpic_t *sb_face_invis; mpic_t *sb_face_invis;
qpic_t *sb_face_quad; mpic_t *sb_face_quad;
qpic_t *sb_face_invuln; mpic_t *sb_face_invuln;
qpic_t *sb_face_invis_invuln; mpic_t *sb_face_invis_invuln;
//rogue pictures. //rogue pictures.
qpic_t *rsb_invbar[2]; mpic_t *rsb_invbar[2];
qpic_t *rsb_weapons[5]; mpic_t *rsb_weapons[5];
qpic_t *rsb_items[2]; mpic_t *rsb_items[2];
qpic_t *rsb_ammo[3]; mpic_t *rsb_ammo[3];
qpic_t *rsb_teambord; mpic_t *rsb_teambord;
//all must be found for any to be used. //all must be found for any to be used.
qboolean sb_showscores; qboolean sb_showscores;
@ -580,9 +580,9 @@ Sbar_Init
qboolean sbar_loaded; qboolean sbar_loaded;
char *failedpic; char *failedpic;
qpic_t *Sbar_PicFromWad(char *name) mpic_t *Sbar_PicFromWad(char *name)
{ {
qpic_t *ret; mpic_t *ret;
ret = Draw_SafePicFromWad(name); ret = Draw_SafePicFromWad(name);
if (ret) if (ret)
@ -743,7 +743,7 @@ void Sbar_Init (void)
Sbar_DrawPic 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); 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. 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); 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 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); 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; int deadcount=0;
#ifdef VM_CG
if (CG_Refresh())
return;
#endif
if (scr_con_current == vid.height) if (scr_con_current == vid.height)
return; // console is full screen return; // console is full screen
@ -1652,7 +1647,7 @@ added by Zoid
*/ */
void Sbar_TeamOverlay (void) void Sbar_TeamOverlay (void)
{ {
qpic_t *pic; mpic_t *pic;
int i, k, l; int i, k, l;
int x, y; int x, y;
char num[12]; char num[12];
@ -1742,7 +1737,7 @@ ping time frags name
*/ */
void Sbar_DeathmatchOverlay (int start) void Sbar_DeathmatchOverlay (int start)
{ {
qpic_t *pic; mpic_t *pic;
int i, k, l; int i, k, l;
int top, bottom; int top, bottom;
int x, y, f; int x, y, f;
@ -1904,7 +1899,7 @@ void Sbar_DeathmatchOverlay (int start)
void Sbar_ChatModeOverlay(void) void Sbar_ChatModeOverlay(void)
{ {
int start =0; int start =0;
qpic_t *pic; mpic_t *pic;
int i, k, l; int i, k, l;
int top, bottom; int top, bottom;
int x, y; int x, y;
@ -2147,7 +2142,7 @@ void Sbar_MiniDeathmatchOverlay (void)
void Sbar_CoopIntermission (void) void Sbar_CoopIntermission (void)
{ {
qpic_t *pic; mpic_t *pic;
int dig; int dig;
int num; int num;
@ -2210,7 +2205,7 @@ Sbar_FinaleOverlay
*/ */
void Sbar_FinaleOverlay (void) void Sbar_FinaleOverlay (void)
{ {
qpic_t *pic; mpic_t *pic;
scr_copyeverything = 1; scr_copyeverything = 1;

View file

@ -1330,6 +1330,9 @@ void S_Update_(soundcardinfo_t *sc)
if (!sound_started)// || (snd_blocked > 0)) if (!sound_started)// || (snd_blocked > 0))
return; return;
if (sc->selfpainting)
return;
// Updates DMA time // Updates DMA time
GetSoundtime(sc); GetSoundtime(sc);

View file

@ -1,4 +1,13 @@
#include "quakedef.h" #include "quakedef.h"
#include "winquake.h"
#include <SDL.h>
extern cvar_t snd_khz;
#define SOUND_BUFFER_SIZE 0x0400
int snd_inited;
soundcardinfo_t *sndcardinfo; soundcardinfo_t *sndcardinfo;
@ -11,6 +20,11 @@ void SNDDMA_Submit(soundcardinfo_t *sc)
} }
void SNDDMA_Shutdown(soundcardinfo_t *sc) void SNDDMA_Shutdown(soundcardinfo_t *sc)
{ {
if (snd_inited)
{
snd_inited = false;
SDL_CloseAudio();
}
} }
int SNDDMA_GetDMAPos(soundcardinfo_t *sc) 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) int SNDDMA_Init(soundcardinfo_t *sc)
{ {
Con_Printf("SDL has no sound code\n"); SDL_AudioSpec desired, obtained;
return 0;
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) void SNDDMA_SetUnderWater(qboolean underwater)

View file

@ -220,7 +220,8 @@ struct soundcardinfo_s { //windows has one defined AFTER directsound
char name[256]; 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; qboolean inactive_sound;

View file

@ -385,7 +385,7 @@ int Sys_EnumerateFiles (char *gpath, char *match, int (*func)(char *, int, void
dir = opendir(truepath); dir = opendir(truepath);
if (!dir) if (!dir)
{ {
Con_Printf("Failed to open dir"); Con_DPrintf("Failed to open dir\n");
return true; return true;
} }
do do
@ -522,7 +522,7 @@ int main (int c, char **v)
parms.memsize = 16*1024*1024; parms.memsize = 16*1024*1024;
j = COM_CheckParm("-mem"); j = COM_CheckParm("-mem");
if (j) if (j && j+1 < com_argc)
parms.memsize = (int) (Q_atof(com_argv[j+1]) * 1024 * 1024); parms.memsize = (int) (Q_atof(com_argv[j+1]) * 1024 * 1024);
parms.membase = malloc (parms.memsize); parms.membase = malloc (parms.memsize);

View file

@ -36,12 +36,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TYP_SOUND 67 #define TYP_SOUND 67
#define TYP_MIPTEX 68 #define TYP_MIPTEX 68
//on disk representation of most q1 images.
typedef struct typedef struct
{ {
int width, height; int width, height;
qbyte data[4]; // variably sized qbyte data[4]; // variably sized
} qpic_t; } 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 typedef struct

View file

@ -96,6 +96,8 @@ struct soundcardinfo_s {
DWORD mmstarttime; DWORD mmstarttime;
DWORD gSndBufSize; DWORD gSndBufSize;
qboolean selfpainting;
qboolean inactive_sound; qboolean inactive_sound;
#ifndef NODIRECTX #ifndef NODIRECTX
qboolean snd_isdirect; qboolean snd_isdirect;

View file

@ -2585,9 +2585,6 @@ static void CL_Say (qboolean team, char *extra)
return; return;
} }
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
SZ_Print (&cls.netchan.message, team ? "say_team " : "say ");
s = TP_ParseMacroString (Cmd_Args()); s = TP_ParseMacroString (Cmd_Args());
Q_strncpyz (text, TP_ParseFunChars (s, true), sizeof(text)); 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)); 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) if (sendtext[0] < 32)
SZ_Print (&cls.netchan.message, "\""); // add quotes so that old servers parse the message correctly SZ_Print (&cls.netchan.message, "\""); // add quotes so that old servers parse the message correctly

View file

@ -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 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 FISH //sw rendering only
#define VM_UI //support userinterfaces within Q3 Virtual Machines #define VM_UI //support userinterfaces within Q3 Virtual Machines
//#define VM_CG //make work
#define ZLIB //zip/pk3 support #define ZLIB //zip/pk3 support
#define WEBSERVER //http/ftp servers #define WEBSERVER //http/ftp servers
#define WEBCLIENT //http/ftp clients. #define WEBCLIENT //http/ftp clients.
@ -127,10 +126,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef AVAIL_ZLIB #undef AVAIL_ZLIB
#endif #endif
#if defined(VM_UI) || defined(VM_CG)
#define VM_ANY
#endif
#ifdef USE_MADLIB //global option. Specify on compiler command line. #ifdef USE_MADLIB //global option. Specify on compiler command line.
#define AVAIL_MP3 //suposedly anti-gpl. don't use in a distributed binary #define AVAIL_MP3 //suposedly anti-gpl. don't use in a distributed binary
#endif #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 #ifdef SERVERONLY //remove options that don't make sense on only a server
#undef Q2CLIENT #undef Q2CLIENT
#undef Q3CLIENT
#undef WEBCLIENT #undef WEBCLIENT
#undef IRCCLIENT #undef IRCCLIENT
#undef EMAILCLIENT #undef EMAILCLIENT
@ -189,6 +185,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif #endif
#if !defined(Q3BSPS) #if !defined(Q3BSPS)
#undef Q3SHADERS #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 #endif
#define PROTOCOLEXTENSIONS #define PROTOCOLEXTENSIONS

View file

@ -760,8 +760,16 @@ void Cmd_Alias_f (void)
} }
} }
} }
a->execlevel = 0; //run at users exec level if (Cmd_FromServer())
a->restriction = 1; //this is possibly a security risk if the admin also changes execlevel {
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); a->value = CopyString (cmd);
} }
@ -883,11 +891,15 @@ void Alias_WriteAliases (FILE *f)
{ {
// if ((cmd->restriction?cmd->restriction:rcon_level.value) > Cmd_ExecLevel) // if ((cmd->restriction?cmd->restriction:rcon_level.value) > Cmd_ExecLevel)
// continue; // continue;
if (cmd->flags & ALIAS_FROMSERVER)
continue;
if (!num) 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, "alias %s \"%s\"\n", cmd->name, cmd->value);
fprintf(f, "restrict %s %i\n", cmd->name, cmd->restriction); if (cmd->restriction != 1) //1 is default
fprintf(f, "aliaslevel %s %i\n", cmd->name, cmd->execlevel); 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++; num++;
} }
} }
@ -1537,6 +1549,14 @@ void Cmd_ForwardToServer (void)
if (cls.demoplayback) if (cls.demoplayback)
return; // not really connected return; // not really connected
#ifdef Q3CLIENT
if (cls.q2server == 2)
{
CL_SendClientCommand("%s %s", Cmd_Argv(0), Cmd_Args());
return;
}
#endif
#ifdef Q2CLIENT #ifdef Q2CLIENT
MSG_WriteByte (&cls.netchan.message, cls.q2server?clcq2_stringcmd:clc_stringcmd); MSG_WriteByte (&cls.netchan.message, cls.q2server?clcq2_stringcmd:clc_stringcmd);
#else #else
@ -1567,6 +1587,14 @@ void Cmd_ForwardToServer_f (void)
if (cls.demoplayback) if (cls.demoplayback)
return; // not really connected return; // not really connected
#ifdef Q3CLIENT
if (cls.q2server == 2)
{
CL_SendClientCommand("%s", Cmd_Args());
return;
}
#endif
if (Cmd_Argc() > 1) if (Cmd_Argc() > 1)
{ {
#ifdef Q2CLIENT #ifdef Q2CLIENT
@ -1696,12 +1724,17 @@ void Cmd_ExecuteString (char *text, int level)
} }
#endif #endif
#ifdef VM_CG
if (CG_Command())
;
else
#endif
#ifdef Q2CLIENT #ifdef Q2CLIENT
if (cls.q2server) if (cls.q2server)
Cmd_ForwardToServer(); Cmd_ForwardToServer();
else else
#endif #endif
if (cl_warncmd.value || developer.value) if (cl_warncmd.value || developer.value)
Con_TPrintf (TL_COMMANDNOTDEFINED, Cmd_Argv(0)); Con_TPrintf (TL_COMMANDNOTDEFINED, Cmd_Argv(0));
} }

View file

@ -818,6 +818,7 @@ void MSG_BeginReading (void)
{ {
msg_readcount = 0; msg_readcount = 0;
msg_badread = false; msg_badread = false;
net_message.currentbit = 0;
} }
int MSG_GetReadCount(void) int MSG_GetReadCount(void)
@ -825,10 +826,140 @@ int MSG_GetReadCount(void)
return msg_readcount; 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 ; i<bits ; i++)
{
val = msg->data[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 ; i<bits-remaining ; i+=8)
{
val = Huff_GetByte(msg->data, &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 // returns -1 and sets msg_badread if no more characters are available
int MSG_ReadChar (void) int MSG_ReadChar (void)
{ {
int c; int c;
if (net_message.packing!=SZ_RAWBYTES)
return (signed char)MSG_ReadBits(8);
if (msg_readcount+1 > net_message.cursize) if (msg_readcount+1 > net_message.cursize)
{ {
@ -844,7 +975,10 @@ int MSG_ReadChar (void)
int MSG_ReadByte (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) if (msg_readcount+1 > net_message.cursize)
{ {
@ -861,6 +995,9 @@ int MSG_ReadByte (void)
int MSG_ReadShort (void) int MSG_ReadShort (void)
{ {
int c; int c;
if (net_message.packing!=SZ_RAWBYTES)
return (short)MSG_ReadBits(16);
if (msg_readcount+2 > net_message.cursize) if (msg_readcount+2 > net_message.cursize)
{ {
@ -879,6 +1016,9 @@ int MSG_ReadShort (void)
int MSG_ReadLong (void) int MSG_ReadLong (void)
{ {
int c; int c;
if (net_message.packing!=SZ_RAWBYTES)
return (int)MSG_ReadBits(32);
if (msg_readcount+4 > net_message.cursize) if (msg_readcount+4 > net_message.cursize)
{ {
@ -905,6 +1045,12 @@ float MSG_ReadFloat (void)
int l; int l;
} dat; } dat;
if (net_message.packing!=SZ_RAWBYTES)
{
dat.l = MSG_ReadBits(32);
return dat.f;
}
if (msg_readcount+4 > net_message.cursize) if (msg_readcount+4 > net_message.cursize)
{ {
msg_badread = true; msg_badread = true;

View file

@ -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 typedef struct sizebuf_s
{ {
qboolean allowoverflow; // if false, do a Sys_Error qboolean allowoverflow; // if false, do a Sys_Error
@ -45,6 +51,8 @@ typedef struct sizebuf_s
qbyte *data; qbyte *data;
int maxsize; int maxsize;
int cursize; int cursize;
int packing;
int currentbit;
} sizebuf_t; } sizebuf_t;
void SZ_Clear (sizebuf_t *buf); void SZ_Clear (sizebuf_t *buf);

View file

@ -206,7 +206,18 @@ cvar_t *Cvar_SetCore (cvar_t *var, char *value, qboolean force)
if (latch && !force) if (latch && !force)
{ {
if (cl_warncmd.value) 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 if (var->latched_string && !strcmp(var->latched_string, value)) //no point, this would force the same
return NULL; return NULL;

View file

@ -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); _snprintf (name, sizeof(name), "textures/%s.wal", in->texture);
out->texture = Mod_LoadWall (name); 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); Con_Printf ("^2Couldn't load %s\n", name);
memcpy(out->texture, &r_notexture_mip, sizeof(r_notexture_mip)); 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->texture = r_notexture_mip; // texture not found
// out->flags = 0; // out->flags = 0;
} }
@ -3503,6 +3503,7 @@ mplane_t *box_planes;
int box_headnode; int box_headnode;
q2cbrush_t *box_brush; q2cbrush_t *box_brush;
mleaf_t *box_leaf; mleaf_t *box_leaf;
model_t box_model;
/* /*
=================== ===================
@ -3520,6 +3521,17 @@ void CM_InitBoxHull (void)
mplane_t *p; mplane_t *p;
q2cbrushside_t *s; 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_headnode = numnodes;
box_planes = &map_planes[numplanes]; box_planes = &map_planes[numplanes];
if (numnodes+6 > MAX_Q2MAP_NODES if (numnodes+6 > MAX_Q2MAP_NODES
@ -3601,6 +3613,11 @@ int CM_HeadnodeForBox (vec3_t mins, vec3_t maxs)
return box_headnode; 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;
}
/* /*
================== ==================

View file

@ -133,6 +133,17 @@ typedef struct
int outgoing_size[MAX_LATENT]; int outgoing_size[MAX_LATENT];
double outgoing_time[MAX_LATENT]; double outgoing_time[MAX_LATENT];
qboolean compress; 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; } netchan_t;
extern int net_drop; // packets dropped before this one extern int net_drop; // packets dropped before this one

View file

@ -94,7 +94,7 @@ void Netchan_Init (void)
// pick a port value that should be nice and random // pick a port value that should be nice and random
#ifdef _WIN32 #ifdef _WIN32
port = ((int)(timeGetTime()*1000) * time(NULL)) & 0xffff; port = (time(NULL)) & 0xffff;
#else #else
port = ((int)(getpid()+getuid()*1000) * time(NULL)) & 0xffff; port = ((int)(getpid()+getuid()*1000) * time(NULL)) & 0xffff;
#endif #endif

View file

@ -590,6 +590,8 @@ qboolean NET_GetLoopPacket (netsrc_t sock, netadr_t *from, sizebuf_t *message)
message->cursize = loop->msgs[i].datalen; message->cursize = loop->msgs[i].datalen;
memset (from, 0, sizeof(*from)); memset (from, 0, sizeof(*from));
from->type = NA_LOOPBACK; from->type = NA_LOOPBACK;
message->packing = SZ_RAWBYTES;
message->currentbit = 0;
return true; return true;
} }
@ -693,6 +695,8 @@ qboolean NET_GetPacket (netsrc_t netsrc)
} }
SockadrToNetadr (&from, &net_from); SockadrToNetadr (&from, &net_from);
net_message.packing = SZ_RAWBYTES;
net_message.currentbit = 0;
net_message.cursize = ret; net_message.cursize = ret;
if (net_message.cursize == sizeof(net_message_buffer) ) if (net_message.cursize == sizeof(net_message_buffer) )
{ {

View file

@ -358,7 +358,7 @@ typedef struct {
plugin_t *plugin; plugin_t *plugin;
char name[64]; char name[64];
qboolean picfromwad; qboolean picfromwad;
qpic_t *pic; mpic_t *pic;
} pluginimagearray_t; } pluginimagearray_t;
int pluginimagearraylen; int pluginimagearraylen;
pluginimagearray_t *pluginimagearray; pluginimagearray_t *pluginimagearray;
@ -369,7 +369,7 @@ int Plug_Draw_LoadImage(void *offset, unsigned int mask, const long *arg)
qboolean fromwad = arg[1]; qboolean fromwad = arg[1];
int i; int i;
qpic_t *pic; mpic_t *pic;
for (i = 0; i < pluginimagearraylen; i++) 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 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) int Plug_Draw_Image(void *offset, unsigned int mask, const long *arg)
{ {
qpic_t *pic; mpic_t *pic;
int i; int i;
if (!qrenderer) if (!qrenderer)
return 0; return 0;
if (!Draw_Image)
return 0;
i = VM_LONG(arg[8]); i = VM_LONG(arg[8]);
if (i < 0 || i >= pluginimagearraylen) if (i < 0 || i >= pluginimagearraylen)
@ -453,24 +453,7 @@ int Plug_Draw_Image(void *offset, unsigned int mask, const long *arg)
else else
pic = Draw_CachePic(pluginimagearray[i].name); pic = Draw_CachePic(pluginimagearray[i].name);
#ifdef RGLQUAKE 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);
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;
}
return 1; return 1;
} }

View file

@ -624,6 +624,11 @@ enum {
// must be power of two // must be power of two
#define Q2UPDATE_MASK (Q2UPDATE_BACKUP-1) #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 // entity_state_t is the information conveyed from the server
// in an update message // in an update message
@ -710,6 +715,8 @@ typedef struct usercmd_s
short forwardmove, sidemove, upmove; short forwardmove, sidemove, upmove;
qbyte impulse; qbyte impulse;
qbyte lightlevel; qbyte lightlevel;
qbyte weapon;
int servertime;
} usercmd_t; } usercmd_t;
typedef struct q1usercmd_s typedef struct q1usercmd_s

View file

@ -211,7 +211,7 @@ BuildCmd=
Major=2 Major=2
Minor=5 Minor=5
Release=5 Release=5
Build=29 Build=32
LanguageID=2057 LanguageID=2057
CharsetID=1252 CharsetID=1252
CompanyName= CompanyName=

View file

@ -159,7 +159,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # 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 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 BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD BASE RSC /l 0x809 /d "_DEBUG"
@ -484,6 +484,10 @@ SOURCE=..\client\cl_cam.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\client\cl_cg.c
# End Source File
# Begin Source File
SOURCE=..\client\cl_demo.c SOURCE=..\client\cl_demo.c
!IF "$(CFG)" == "ftequake - Win32 Release" !IF "$(CFG)" == "ftequake - Win32 Release"
@ -836,6 +840,10 @@ SOURCE=..\client\clq2_ents.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\client\clq3_parse.c
# End Source File
# Begin Source File
SOURCE=..\client\console.c SOURCE=..\client\console.c
!IF "$(CFG)" == "ftequake - Win32 Release" !IF "$(CFG)" == "ftequake - Win32 Release"

View file

@ -94,6 +94,7 @@ typedef struct {
int ofstransforms; int ofstransforms;
//these exist only in the root mesh. //these exist only in the root mesh.
int numtagframes;
int numtags; int numtags;
int ofstags; int ofstags;
} galiasinfo_t; } 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); t = (md3tag_t*)((char*)inf + inf->ofstags);
if (tagnum <= 0 || tagnum > inf->numtags) if (tagnum <= 0 || tagnum > inf->numtags)
return; return;
if (frame < 0 || frame >= inf->numtagframes)
return;
tagnum--; //tagnum 0 is 'use my angles/org' tagnum--; //tagnum 0 is 'use my angles/org'
t += tagnum; t += tagnum;
@ -2606,7 +2609,7 @@ int GLMod_TagNumForName(model_t *model, char *name)
t = (md3tag_t*)((char*)inf + inf->ofstags); t = (md3tag_t*)((char*)inf + inf->ofstags);
for (i = 0; i < inf->numtags; i++) for (i = 0; i < inf->numtags; i++)
{ {
if (!strcmp(t->name, name)) if (!strcmp(t[i].name, name))
return i+1; return i+1;
} }
return 0; return 0;
@ -2693,6 +2696,43 @@ typedef struct {
} md3Shader_t; } md3Shader_t;
//End of Tenebrae 'assistance' //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) void GL_LoadQ3Model(model_t *mod, void *buffer)
{ {
int hunkstart, hunkend, hunktotal; int hunkstart, hunkend, hunktotal;
@ -2738,13 +2778,6 @@ void GL_LoadQ3Model(model_t *mod, void *buffer)
// if (header->version != sdfs) // if (header->version != sdfs)
// Sys_Error("GL_LoadQ3Model: Bad version\n"); // Sys_Error("GL_LoadQ3Model: Bad version\n");
if (header->numSurfaces < 1)
{
mod->type = mod_alias;
return;
}
parent = NULL; parent = NULL;
root = NULL; root = NULL;
@ -2838,7 +2871,7 @@ void GL_LoadQ3Model(model_t *mod, void *buffer)
char name[1024]; char name[1024];
extern int gl_bumpmappingpossible; extern int gl_bumpmappingpossible;
#endif #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; galias->ofsskins = (qbyte *)skin - (qbyte *)galias;
texnum = (galiastexnum_t *)(skin + surf->numShaders); texnum = (galiastexnum_t *)(skin + surf->numShaders);
inshader = (md3Shader_t *)((qbyte *)surf + surf->ofsShaders); inshader = (md3Shader_t *)((qbyte *)surf + surf->ofsShaders);
@ -2850,6 +2883,9 @@ void GL_LoadQ3Model(model_t *mod, void *buffer)
skin->skinwidth = 0; skin->skinwidth = 0;
skin->skinheight = 0; skin->skinheight = 0;
skin->skinspeed = 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 #ifdef Q3SHADERS
texnum->shader = R_RegisterSkin(inshader->name); texnum->shader = R_RegisterSkin(inshader->name);
#else #else
@ -2926,6 +2962,10 @@ void GL_LoadQ3Model(model_t *mod, void *buffer)
surf = (md3Surface_t *)((qbyte *)surf + surf->ofsEnd); surf = (md3Surface_t *)((qbyte *)surf + surf->ofsEnd);
} }
if (!root)
root = Hunk_Alloc(sizeof(galiasinfo_t));
root->numtagframes = header->numFrames;
root->numtags = header->numTags; root->numtags = header->numTags;
root->ofstags = (char*)Hunk_Alloc(header->numTags*sizeof(md3tag_t)*header->numFrames) - (char*)root; 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); memcpy((char*)root+root->ofstags, (char*)header+header->ofsTags, header->numTags*sizeof(md3tag_t)*header->numFrames);

View file

@ -1932,23 +1932,21 @@ void R_ModifyColor ( meshbuffer_t *mb, shaderpass_t *pass )
break; break;
case RGB_GEN_ENTITY: case RGB_GEN_ENTITY:
Con_Printf("RGB_GEN_ENTITY\n"); for ( i = 0; i < numColors; i++, bArray += 4 )
break; {
/* for ( i = 0; i < numColors; i++, bArray += 4 ) {
*(int *)bArray = *(int *)currententity->shaderRGBA; *(int *)bArray = *(int *)currententity->shaderRGBA;
} }
break; break;
*/
case RGB_GEN_ONE_MINUS_ENTITY: case RGB_GEN_ONE_MINUS_ENTITY:
Con_Printf("RGB_GEN_ONE_MINUS_ENTITY\n"); for ( i = 0; i < numColors; i++, bArray += 4 )
break; {
/* for ( i = 0; i < numColors; i++, bArray += 4 ) {
bArray[0] = 255 - currententity->shaderRGBA[0]; bArray[0] = 255 - currententity->shaderRGBA[0];
bArray[1] = 255 - currententity->shaderRGBA[1]; bArray[1] = 255 - currententity->shaderRGBA[1];
bArray[2] = 255 - currententity->shaderRGBA[2]; bArray[2] = 255 - currententity->shaderRGBA[2];
} }
break; break;
*/
case RGB_GEN_VERTEX: case RGB_GEN_VERTEX:
case RGB_GEN_EXACT_VERTEX: case RGB_GEN_EXACT_VERTEX:
memcpy ( bArray, vArray, sizeof(byte_vec4_t)*numColors ); memcpy ( bArray, vArray, sizeof(byte_vec4_t)*numColors );

View file

@ -65,8 +65,8 @@ extern cvar_t gl_savecompressedtex;
extern cvar_t gl_load24bit; extern cvar_t gl_load24bit;
qbyte *draw_chars; // 8*8 graphic characters qbyte *draw_chars; // 8*8 graphic characters
qpic_t *draw_disc; mpic_t *draw_disc;
qpic_t *draw_backtile; mpic_t *draw_backtile;
int translate_texture; int translate_texture;
int char_texture, char_tex2, default_char_texture; int char_texture, char_tex2, default_char_texture;
@ -82,9 +82,9 @@ typedef struct
float sl, tl, sh, th; float sl, tl, sh, th;
} glpic_t; } glpic_t;
qbyte conback_buffer[sizeof(qpic_t) + sizeof(glpic_t)]; qbyte conback_buffer[sizeof(mpic_t) + sizeof(glpic_t)];
qbyte custconback_buffer[sizeof(qpic_t) + sizeof(glpic_t)]; qbyte custconback_buffer[sizeof(mpic_t) + sizeof(glpic_t)];
qpic_t *default_conback = (qpic_t *)&conback_buffer, *conback, *custom_conback = (qpic_t *)&custconback_buffer; mpic_t *default_conback = (mpic_t *)&conback_buffer, *conback, *custom_conback = (mpic_t *)&custconback_buffer;
#include "hash.h" #include "hash.h"
hashtable_t gltexturetable; hashtable_t gltexturetable;
@ -188,7 +188,7 @@ void Scrap_Upload (void)
typedef struct glcachepic_s typedef struct glcachepic_s
{ {
char name[MAX_QPATH]; char name[MAX_QPATH];
qpic_t pic; mpic_t pic;
qbyte padding[32]; // for appended glpic qbyte padding[32]; // for appended glpic
} glcachepic_t; } glcachepic_t;
@ -201,7 +201,7 @@ qbyte menuplyr_pixels[4096];
int pic_texels; int pic_texels;
int pic_count; int pic_count;
qpic_t *GLDraw_IsCached(char *name) mpic_t *GLDraw_IsCached(char *name)
{ {
glcachepic_t *pic; glcachepic_t *pic;
int i; int i;
@ -213,7 +213,7 @@ qpic_t *GLDraw_IsCached(char *name)
return NULL; return NULL;
} }
qboolean Draw_RealPicFromWad (qpic_t *out, char *name) qboolean Draw_RealPicFromWad (mpic_t *out, char *name)
{ {
qpic_t *in; qpic_t *in;
glpic_t *gl; glpic_t *gl;
@ -292,7 +292,7 @@ qboolean Draw_RealPicFromWad (qpic_t *out, char *name)
} }
char *failedpic; //easier this way char *failedpic; //easier this way
qpic_t *GLDraw_SafePicFromWad (char *name) mpic_t *GLDraw_SafePicFromWad (char *name)
{ {
int i; int i;
glcachepic_t *pic; glcachepic_t *pic;
@ -315,20 +315,22 @@ qpic_t *GLDraw_SafePicFromWad (char *name)
return &pic->pic; 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) if (!pic)
Sys_Error ("GLDraw_PicFromWad: failed to load %s", name); Sys_Error ("GLDraw_PicFromWad: failed to load %s", name);
return pic; return pic;
} }
qpic_t *GLDraw_SafeCachePic (char *path) mpic_t *GLDraw_SafeCachePic (char *path)
{ {
int height;
qbyte *data;
glcachepic_t *pic; glcachepic_t *pic;
int i; int i;
qpic_t *dat; qpic_t *qpic;
glpic_t *gl; glpic_t *gl;
for (pic=glmenu_cachepics, i=0 ; i<glmenu_numcachepics ; pic++, i++) for (pic=glmenu_cachepics, i=0 ; i<glmenu_numcachepics ; pic++, i++)
@ -347,80 +349,13 @@ qpic_t *GLDraw_SafeCachePic (char *path)
char *mem; char *mem;
char alternatename[MAX_QPATH]; char alternatename[MAX_QPATH];
_snprintf(alternatename, MAX_QPATH-1, "pics/%s.pcx", path); _snprintf(alternatename, MAX_QPATH-1, "pics/%s.pcx", path);
dat = (qpic_t *)COM_LoadMallocFile (alternatename); data = COM_LoadMallocFile (alternatename);
if (dat) if (data)
{ {
strcpy(pic->name, path); strcpy(pic->name, path);
if ((mem = ReadPCXFile((qbyte *)dat, com_filesize, &pic->pic.width, &pic->pic.height))) if ((mem = ReadPCXFile(data, com_filesize, &pic->pic.width, &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)))
{ {
pic->pic.height = height;
gl = (glpic_t *)pic->pic.data; gl = (glpic_t *)pic->pic.data;
if (!(gl->texnum = Mod_LoadReplacementTexture(alternatename, false, true, false))) 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->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->tl = 0;
gl->th = 1; gl->th = 1;
BZ_Free(dat); BZ_Free(data);
BZ_Free(mem); BZ_Free(mem);
glmenu_numcachepics++; glmenu_numcachepics++;
return &pic->pic; 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 #endif
@ -466,25 +471,26 @@ qpic_t *GLDraw_SafeCachePic (char *path)
} }
} }
*/ */
dat = (qpic_t *)COM_LoadTempFile (path); qpic = (qpic_t *)COM_LoadTempFile (path);
if (!dat) if (!qpic)
{ {
char alternatename[MAX_QPATH]; char alternatename[MAX_QPATH];
sprintf(alternatename, "gfx/%s.lmp", path); sprintf(alternatename, "gfx/%s.lmp", path);
dat = (qpic_t *)COM_LoadTempFile (alternatename); qpic = (qpic_t *)COM_LoadTempFile (alternatename);
if (!dat) if (!qpic)
return GLDraw_SafePicFromWad(path); 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]; char alternatename[MAX_QPATH];
sprintf(alternatename, "gfx/%s.lmp", path); sprintf(alternatename, "gfx/%s.lmp", path);
dat = (qpic_t *)COM_LoadTempFile (alternatename); qpic = (qpic_t *)COM_LoadTempFile (alternatename);
if (!dat) if (!qpic)
return GLDraw_SafePicFromWad(path); return GLDraw_SafePicFromWad(path);
SwapPic (qpic);
} }
// HACK HACK HACK --- we need to keep the bytes for // HACK HACK HACK --- we need to keep the bytes for
@ -492,19 +498,19 @@ qpic_t *GLDraw_SafeCachePic (char *path)
// configuration dialog // configuration dialog
if (!strncmp (path, "gfx/player/", 11) || !strcmp (path, "gfx/menuplyr.lmp")) //these arn't cached. I hate hacks. 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 else
{ {
glmenu_numcachepics++; glmenu_numcachepics++;
Q_strncpyz (pic->name, path, sizeof(pic->name)); Q_strncpyz (pic->name, path, sizeof(pic->name));
} }
pic->pic.width = dat->width; pic->pic.width = qpic->width;
pic->pic.height = dat->height; pic->pic.height = qpic->height;
gl = (glpic_t *)pic->pic.data; gl = (glpic_t *)pic->pic.data;
if (!(gl->texnum = Mod_LoadReplacementTexture(path, false, true, false))) if (!(gl->texnum = Mod_LoadReplacementTexture(path, false, true, false)))
gl->texnum = GL_LoadPicTexture (dat); gl->texnum = GL_LoadPicTexture (qpic);
gl->sl = 0; gl->sl = 0;
gl->sh = 1; gl->sh = 1;
gl->tl = 0; gl->tl = 0;
@ -512,9 +518,9 @@ qpic_t *GLDraw_SafeCachePic (char *path)
return &pic->pic; 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) if (!pic)
Sys_Error ("GLDraw_CachePic: failed to load %s", path); 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); glClear(GL_COLOR_BUFFER_BIT);
{ {
qpic_t *pic = Draw_SafeCachePic ("loading"); mpic_t *pic = Draw_SafeCachePic ("loading");
if (pic) if (pic)
Draw_Pic ( (vid.width - pic->width)/2, Draw_Pic ( (vid.width - pic->width)/2,
(vid.height - 48 - pic->height)/2, pic); (vid.height - 48 - pic->height)/2, pic);
@ -1320,7 +1326,7 @@ void GLDraw_DebugChar (qbyte num)
Draw_Pic 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; glpic_t *gl;
@ -1370,7 +1376,7 @@ void GLDraw_Pic (int x, int y, qpic_t *pic)
#endif #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; glpic_t *gl;
@ -1399,7 +1405,7 @@ void GLDraw_ScalePic (int x, int y, int width, int height, qpic_t *pic)
Draw_AlphaPic 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; glpic_t *gl;
@ -1427,7 +1433,7 @@ void GLDraw_AlphaPic (int x, int y, qpic_t *pic, float alpha)
glDisable (GL_BLEND); 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; glpic_t *gl;
float newsl, newtl, newsh, newth; 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 Draw_TransPic
============= =============
*/ */
void GLDraw_TransPic (int x, int y, qpic_t *pic) void GLDraw_TransPic (int x, int y, mpic_t *pic)
{ {
if (!pic) if (!pic)
return; return;
@ -1511,7 +1517,7 @@ Draw_TransPicTranslate
Only used for the player color selection menu 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; int v, u, c;
unsigned trans[64*64], *dest; 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); 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; glpic_t *gl;

View file

@ -28,11 +28,11 @@ void GLSurf_DeInit (void);
void GLDraw_Character (int x, int y, unsigned int num); void GLDraw_Character (int x, int y, unsigned int num);
void GLDraw_ColouredCharacter (int x, int y, unsigned int num); void GLDraw_ColouredCharacter (int x, int y, unsigned int num);
void GLDraw_DebugChar (qbyte 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_SubPic(int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height);
void GLDraw_Pic (int x, int y, qpic_t *pic); void GLDraw_Pic (int x, int y, mpic_t *pic);
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);
void GLDraw_TransPic (int x, int y, qpic_t *pic); void GLDraw_TransPic (int x, int y, mpic_t *pic);
void GLDraw_TransPicTranslate (int x, int y, qpic_t *pic, qbyte *translation); void GLDraw_TransPicTranslate (int x, int y, mpic_t *pic, qbyte *translation);
void GLDraw_ConsoleBackground (int lines); void GLDraw_ConsoleBackground (int lines);
void GLDraw_EditorBackground (int lines); void GLDraw_EditorBackground (int lines);
void GLDraw_BeginDisc (void); 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_FadeScreen (void);
void GLDraw_String (int x, int y, const qbyte *str); void GLDraw_String (int x, int y, const qbyte *str);
void GLDraw_Alt_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); mpic_t *GLDraw_SafePicFromWad (char *name);
qpic_t *GLDraw_PicFromWad (char *name); mpic_t *GLDraw_PicFromWad (char *name);
qpic_t *GLDraw_SafeCachePic (char *path); mpic_t *GLDraw_SafeCachePic (char *path);
qpic_t *GLDraw_CachePic (char *path); mpic_t *GLDraw_CachePic (char *path);
void GLDraw_Crosshair(void); 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_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);

View file

@ -1481,6 +1481,8 @@ static void PPL_BaseChain_NPR_Sketch(msurface_t *first)
{ {
for (s = first; s ; s=s->texturechain) for (s = first; s ; s=s->texturechain)
{ {
if (!s->polys)
continue;
glBegin(GL_LINE_LOOP); glBegin(GL_LINE_LOOP);
for (i=s->polys->numverts-1; i>=0; i--) for (i=s->polys->numverts-1; i>=0; i--)
glVertex3f( s->polys->verts[i][0]+5*(rand()/(float)RAND_MAX-0.5), 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; int maxshadowlights = gl_maxshadowlights.value;
if (!lightmap)
{
R_PreNewMap();
R_NewMap();
return; // :/
}
if (maxshadowlights < 1) if (maxshadowlights < 1)
maxshadowlights = 1; maxshadowlights = 1;
// if (qglGetError()) // if (qglGetError())

View file

@ -588,7 +588,7 @@ void GLR_DrawEntitiesOnList (void)
switch (currententity->model->type) switch (currententity->model->type)
{ {
case mod_alias: 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); R_DrawGAliasModel (currententity);
break; break;

View file

@ -3106,7 +3106,7 @@ static void GLR_LeafWorldNode (void)
{ {
if (! (areabits[pleaf->area>>3] & (1<<(pleaf->area&7)) ) ) if (! (areabits[pleaf->area>>3] & (1<<(pleaf->area&7)) ) )
{ {
continue; // not visible // continue; // not visible
} }
} }

View file

@ -111,13 +111,14 @@ void RSpeedShow(void)
} }
} }
void SCR_DrawTwoDimensional(int uimenu) void SCR_DrawTwoDimensional(int uimenu, qboolean nohud)
{ {
RSpeedMark(); RSpeedMark();
// //
// draw any areas not covered by the refresh // draw any areas not covered by the refresh
// //
SCR_TileClear (); if (!nohud)
SCR_TileClear ();
if (r_netgraph.value) if (r_netgraph.value)
GLR_NetGraph (); GLR_NetGraph ();
@ -125,7 +126,8 @@ void SCR_DrawTwoDimensional(int uimenu)
if (scr_drawdialog) if (scr_drawdialog)
{ {
#ifdef PLUGINS #ifdef PLUGINS
Plug_SBar (); if (!nohud)
Plug_SBar ();
#endif #endif
SCR_ShowPics_Draw(); SCR_ShowPics_Draw();
Draw_FadeScreen (); Draw_FadeScreen ();
@ -154,19 +156,24 @@ void SCR_DrawTwoDimensional(int uimenu)
{ {
} }
else else
{ {
Draw_Crosshair(); if (!nohud)
{
Draw_Crosshair();
SCR_DrawRam (); SCR_DrawRam ();
SCR_DrawNet (); SCR_DrawNet ();
SCR_DrawFPS (); SCR_DrawFPS ();
SCR_DrawUPS (); SCR_DrawUPS ();
SCR_DrawTurtle (); SCR_DrawTurtle ();
SCR_DrawPause (); SCR_DrawPause ();
#ifdef PLUGINS #ifdef PLUGINS
Plug_SBar (); Plug_SBar ();
#endif #endif
SCR_ShowPics_Draw(); SCR_ShowPics_Draw();
}
else
SCR_DrawFPS ();
SCR_CheckDrawCenterString (); SCR_CheckDrawCenterString ();
glTexEnvi ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); glTexEnvi ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
#ifdef TEXTEDITOR #ifdef TEXTEDITOR
@ -200,6 +207,7 @@ void GLSCR_UpdateScreen (void)
#ifdef TEXTEDITOR #ifdef TEXTEDITOR
extern qboolean editormodal, editoractive; extern qboolean editormodal, editoractive;
#endif #endif
qboolean nohud;
RSpeedMark(); RSpeedMark();
if (block_drawing) if (block_drawing)
@ -328,7 +336,14 @@ void GLSCR_UpdateScreen (void)
// do 3D refresh drawing, and then update the screen // do 3D refresh drawing, and then update the screen
// //
SCR_SetUpToDrawConsole (); 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 (); V_RenderView ();
else else
GL_DoSwap(); GL_DoSwap();
@ -337,7 +352,7 @@ void GLSCR_UpdateScreen (void)
GLR_BrightenScreen(); GLR_BrightenScreen();
SCR_DrawTwoDimensional(uimenu); SCR_DrawTwoDimensional(uimenu, nohud);
GLV_UpdatePalette (); GLV_UpdatePalette ();
#if defined(_WIN32) && defined(RGLQUAKE) #if defined(_WIN32) && defined(RGLQUAKE)

View file

@ -219,13 +219,17 @@ qboolean GLInitialise (char *renderer)
Con_Printf ("Loading renderer dll %s\n", renderer); Con_Printf ("Loading renderer dll %s\n", renderer);
hInstGL = LoadLibrary(opengldllname); hInstGL = LoadLibrary(opengldllname);
if (!hInstGL)
{
hInstGL = LoadLibrary("opengl32");
}
if (!hInstGL) if (!hInstGL)
{ {
Con_Printf ("Couldn't load %s\n", opengldllname); Con_Printf ("Couldn't load %s\n", opengldllname);
return false; return false;
} }
Con_DPrintf ("Loaded renderer dll %s\n", renderer); Con_DPrintf ("Loaded renderer dll %s\n", opengldllname);
// windows dependant // windows dependant
qwglCreateContext = (void *)getwglfunc("wglCreateContext"); qwglCreateContext = (void *)getwglfunc("wglCreateContext");

View file

@ -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 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 all: qcc

View file

@ -757,9 +757,6 @@ PR_ExecuteProgram
*/ */
void PR_ExecuteCode (progfuncs_t *progfuncs, int s) void PR_ExecuteCode (progfuncs_t *progfuncs, int s)
{ {
static dstatement16_t fakeop16;
static dstatement32_t fakeop32;
eval_t *t, *swtch=NULL; eval_t *t, *swtch=NULL;
int swtchtype; int swtchtype;

View file

@ -52,7 +52,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe 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 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" !ELSEIF "$(CFG)" == "qcc - Win32 Debug"
@ -76,7 +76,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe 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 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" !ELSEIF "$(CFG)" == "qcc - Win32 GUIDebug"
@ -101,7 +101,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe 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 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 # SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "qcc - Win32 GUIRelease" !ELSEIF "$(CFG)" == "qcc - Win32 GUIRelease"
@ -127,7 +127,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe 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 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 # SUBTRACT LINK32 /pdb:none
!ENDIF !ENDIF
@ -171,6 +171,8 @@ SOURCE=.\qccgui.c
!ELSEIF "$(CFG)" == "qcc - Win32 Debug" !ELSEIF "$(CFG)" == "qcc - Win32 Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "qcc - Win32 GUIDebug" !ELSEIF "$(CFG)" == "qcc - Win32 GUIDebug"
!ELSEIF "$(CFG)" == "qcc - Win32 GUIRelease" !ELSEIF "$(CFG)" == "qcc - Win32 GUIRelease"
@ -188,6 +190,8 @@ SOURCE=.\qccguistuff.c
!ELSEIF "$(CFG)" == "qcc - Win32 Debug" !ELSEIF "$(CFG)" == "qcc - Win32 Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "qcc - Win32 GUIDebug" !ELSEIF "$(CFG)" == "qcc - Win32 GUIDebug"
!ELSEIF "$(CFG)" == "qcc - Win32 GUIRelease" !ELSEIF "$(CFG)" == "qcc - Win32 GUIRelease"

View file

@ -512,6 +512,7 @@ void QCC_PR_PrintStatement (QCC_dstatement_t *s);
void QCC_PR_Lex (void); void QCC_PR_Lex (void);
// reads the next token into pr_token and classifies its type // 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_PR_ParseType (int newtype);
QCC_type_t *QCC_TypeForName(char *name); QCC_type_t *QCC_TypeForName(char *name);
QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype); QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype);

View file

@ -666,6 +666,7 @@ pbool QCC_OPCodeValid(QCC_opcode_t *op)
QCC_def_t *QCC_PR_Expression (int priority); QCC_def_t *QCC_PR_Expression (int priority);
int QCC_AStatementJumpsTo(int targ, int first, int last); int QCC_AStatementJumpsTo(int targ, int first, int last);
pbool QCC_StatementIsAJump(int stnum, int notifdest);
temp_t *functemps; //floats/strings/funcs/ents... temp_t *functemps; //floats/strings/funcs/ents...
@ -829,9 +830,6 @@ void QCC_FreeOffset(gofs_t ofs, unsigned int size)
freeofs = fofs; freeofs = fofs;
return; return;
QCC_Error(ERR_INTERNAL, "QCC_FreeOffset: not called with end of globals");
} }
static QCC_def_t *QCC_GetTemp(QCC_type_t *type) static QCC_def_t *QCC_GetTemp(QCC_type_t *type)
@ -4821,7 +4819,7 @@ void QCC_PR_ParseStatement (void)
QCC_PR_ParseStatement (); QCC_PR_ParseStatement ();
//this is so that a missing goto at the end of your switch doesn't end up in the jumptable again //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_FreeTemp(QCC_PR_Statement (&pr_opcodes[OP_GOTO], 0, 0, &patch2)); //the P1 statement/the theyforgotthebreak statement.
// QCC_PR_ParseWarning(0, "emitted goto"); // 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 QCC_AStatementJumpsTo(int targ, int first, int last)
{ {
int st; 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 array[64];
char newname[256]; char newname[256];
int a, i, parms; int a, parms;
QCC_def_t *def, *first=NULL; QCC_def_t *def, *first=NULL;
unsigned int maxfield, startfield; unsigned int maxfield, startfield;
QCC_type_t *ftype; 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; def->initialized = true;
((int *)qcc_pr_globals)[def->ofs] = *fieldofs; ((int *)qcc_pr_globals)[def->ofs] = *fieldofs;
*fieldofs += parttype->size; *fieldofs += parttype->size;
for (i = parttype->num_parms; i>0; i--)
parttype=parttype->next;
break; break;
case ev_void: case ev_void:
break; break;

View file

@ -1390,43 +1390,52 @@ void GuiParseCommandLine(char *args)
if (!strnicmp(parameters+paramlen, "-O", 2) || !strnicmp(parameters+paramlen, "/O", 2)) if (!strnicmp(parameters+paramlen, "-O", 2) || !strnicmp(parameters+paramlen, "/O", 2))
{ //strip out all -O { //strip out all -O
if (parameters[paramlen+2] >= '0' && parameters[paramlen+2] <= '3') if (parameters[paramlen+2])
{ {
p = parameters[paramlen+2]-'0'; if (parameters[paramlen+2] >= '0' && parameters[paramlen+2] <= '3')
for (l = 0; optimisations[l].enabled; l++)
{ {
if (optimisations[l].optimisationlevel<=p) p = parameters[paramlen+2]-'0';
optimisations[l].flags |= 8; for (l = 0; optimisations[l].enabled; l++)
else {
optimisations[l].flags &= ~8; if (optimisations[l].optimisationlevel<=p)
optimisations[l].flags |= 8;
else
optimisations[l].flags &= ~8;
}
} }
p=0; else if (!strncmp(parameters+paramlen+2, "no-", 3))
} {
else if (!strncmp(parameters+paramlen+2, "no-", 3)) if (parameters[paramlen+5])
{ {
if (parameters[paramlen+5]) for (p = 0; optimisations[p].enabled; p++)
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))
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; parameters[paramlen+next-args] = ' ';
break; paramlen += l;
} }
} }
else }
{ else
if (parameters[paramlen+2]) {
for (p = 0; optimisations[p].enabled; p++) 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)) if ((*optimisations[p].abbrev && !strcmp(parameters+paramlen+2, optimisations[p].abbrev)) || !strcmp(parameters+paramlen+2, optimisations[p].fullname))
{ {
optimisations[p].flags |= 8; optimisations[p].flags |= 8;
break; break;
} }
}
if (!optimisations[p].enabled) if (!optimisations[p].enabled)
{ {
parameters[paramlen+next-args] = ' '; parameters[paramlen+next-args] = ' ';
paramlen += l; paramlen += l;
}
}
} }
} }
else if (!strnicmp(parameters+paramlen, "-Fno-kce", 8) || !strnicmp(parameters+paramlen, "/Fno-kce", 8)) //keywords stuph else if (!strnicmp(parameters+paramlen, "-Fno-kce", 8) || !strnicmp(parameters+paramlen, "/Fno-kce", 8)) //keywords stuph

View file

@ -2707,22 +2707,12 @@ memset(pr_immediate_string, 0, sizeof(pr_immediate_string));
#endif #endif
QCC_InitData (); 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); QCC_PR_BeginCompilation ((void *)qccHunkAlloc (0x100000), 0x100000);
#if 0
QCC_ReadPoff(qccmprogsdat); p = QCC_CheckParm ("-qc");
#endif if (!p || p >= argc-1 || argv[p+1][0] == '-')
p = QCC_CheckParm ("-srcfile"); p = QCC_CheckParm ("-srcfile");
if (p && p < argc-1 ) if (p && p < argc-1 )
sprintf (qccmprogsdat, "%s%s", qccmsourcedir, argv[p+1]); sprintf (qccmprogsdat, "%s%s", qccmsourcedir, argv[p+1]);
else else
@ -2755,9 +2745,23 @@ memset(pr_immediate_string, 0, sizeof(pr_immediate_string));
} }
#endif #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 == '#') if (*qcc_token == '#')
{ {
void StartNewStyleCompile(void); void StartNewStyleCompile(void);
newstyle:
newstylesource = true; newstylesource = true;
StartNewStyleCompile(); StartNewStyleCompile();
return; return;
@ -2775,7 +2779,7 @@ memset(pr_immediate_string, 0, sizeof(pr_immediate_string));
if (!qccmsrc) if (!qccmsrc)
QCC_Error (ERR_NOOUTPUT, "No destination filename. qcc -help for info."); QCC_Error (ERR_NOOUTPUT, "No destination filename. qcc -help for info.");
strcpy (destfile, qcc_token); strcpy (destfile, qcc_token);
#ifndef QCCONLY #ifndef QCCONLY
p=1; p=1;
@ -3227,6 +3231,7 @@ void Sys_Error(const char *text, ...)
int main (int argc, char **argv) int main (int argc, char **argv)
{ {
int sucess;
progexterns_t ext; progexterns_t ext;
progfuncs_t funcs; progfuncs_t funcs;
progfuncs = &funcs; progfuncs = &funcs;
@ -3238,13 +3243,13 @@ int main (int argc, char **argv)
funcs.parms->WriteFile = QCC_WriteFile; funcs.parms->WriteFile = QCC_WriteFile;
funcs.parms->printf = printf; funcs.parms->printf = printf;
funcs.parms->Sys_Error = Sys_Error; funcs.parms->Sys_Error = Sys_Error;
CompileParams(&funcs, true, argc, argv); sucess = CompileParams(&funcs, true, argc, argv);
qccClearHunk(); qccClearHunk();
#ifdef _WIN32 #ifdef _WIN32
fgetc(stdin); //wait for keypress // fgetc(stdin); //wait for keypress
#endif #endif
return 0; return !sucess;
} }
#endif #endif

View file

@ -76,7 +76,7 @@ void SV_Savegame_f (void)
return; return;
} }
sprintf (name, "%s/%s", com_gamedir, Cmd_Argv(1)); sprintf (name, "%s/saves/%s", com_gamedir, Cmd_Argv(1));
COM_DefaultExtension (name, ".sav"); COM_DefaultExtension (name, ".sav");
Con_TPrintf (STL_SAVEGAMETO, name); Con_TPrintf (STL_SAVEGAMETO, name);
@ -193,7 +193,7 @@ void SV_Loadgame_f(void)
// return; // return;
// } // }
sprintf (filename, "%s/%s", com_gamedir, Cmd_Argv(1)); sprintf (filename, "%s/saves/%s", com_gamedir, Cmd_Argv(1));
COM_DefaultExtension (filename, ".sav"); COM_DefaultExtension (filename, ".sav");
// we can't call SCR_BeginLoadingPlaque, because too much stack space has // 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) if (!cache)
return false; //not visited yet. Ignore the existing caches as fakes. 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"); COM_DefaultExtension (name, ".lvc");
// Con_TPrintf (STL_LOADGAMEFROM, name); // 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"); COM_DefaultExtension (name, ".lvc");
if (!dontharmgame) //save game in progress if (!dontharmgame) //save game in progress
@ -792,7 +792,7 @@ void SV_Savegame_f (void)
if (!*savename || strstr(savename, "..")) if (!*savename || strstr(savename, ".."))
savename = "quicksav"; savename = "quicksav";
sprintf (filename, "%s/%s/info.fsv", com_gamedir, savename); sprintf (filename, "%s/saves/%s/info.fsv", com_gamedir, savename);
COM_CreatePath(filename); COM_CreatePath(filename);
f = fopen(filename, "wt"); f = fopen(filename, "wt");
if (!f) if (!f)
@ -860,7 +860,7 @@ void SV_Savegame_f (void)
{ {
fprintf(f, "%s\n", cache->mapname); 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"); f2 = fopen(filename, "rb");
if (!f2) if (!f2)
break; break;
@ -883,7 +883,7 @@ void SV_Savegame_f (void)
fread(buffer, len, 1, f2); fread(buffer, len, 1, f2);
fclose(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"); f2 = fopen(filename, "wb");
if (!f2) if (!f2)
break; break;
@ -919,7 +919,7 @@ void SV_Loadgame_f (void)
if (!*savename || strstr(savename, "..")) if (!*savename || strstr(savename, ".."))
strcpy(savename, "quicksav"); 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"); f = fopen (filename, "rt");
if (!f) 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"); fi = fopen(filename, "rb");
if (!fi) if (!fi)
{ {
@ -1089,7 +1089,7 @@ void SV_Loadgame_f (void)
fread(buffer, len, 1, fi); fread(buffer, len, 1, fi);
fclose(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"); fo = fopen(filename, "wb");
if (!fo) if (!fo)
{ {

View file

@ -1179,14 +1179,16 @@ void SV_SaveInfo(FILE *f, char *info, char *commandname)
fwrite(" ", 1, 1, f); fwrite(" ", 1, 1, f);
fwrite(command, value-command, 1, f); fwrite(command, value-command, 1, f);
fwrite(" ", 1, 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); fwrite("\n", 1, 1, f);
} }
} }
void SV_SaveInfos(FILE *f) void SV_SaveInfos(FILE *f)
{ {
fwrite("\n", 1, 1, f);
SV_SaveInfo(f, svs.info, "serverinfo"); SV_SaveInfo(f, svs.info, "serverinfo");
fwrite("\n", 1, 1, f);
SV_SaveInfo(f, localinfo, "localinfo"); SV_SaveInfo(f, localinfo, "localinfo");
} }

View file

@ -4687,6 +4687,8 @@ void SV_AirMove (void)
// scale = val->_float; // scale = val->_float;
maxspeed=sv_player->v.maxspeed;//FIXME: This isn't fully compatable code... 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) if (wishspeed > maxspeed*scale)
{ {

View file

@ -50,6 +50,7 @@ int D_SurfaceCacheForRes (int width, int height, int bpp)
if (pix > 64000) if (pix > 64000)
size += (pix-64000)*4; size += (pix-64000)*4;
size*=8;
if (bpp) if (bpp)
return size*bpp; return size*bpp;
return size; return size;

View file

@ -43,7 +43,7 @@ qbyte bottommask[128*131];
qbyte newsky[128*256]; // newsky and topsky both pack in here, 128 bytes qbyte newsky[128*256]; // newsky and topsky both pack in here, 128 bytes
// of newsky on the left of each scan, 128 bytes // of newsky on the left of each scan, 128 bytes
// of topsky on the right, because the low-level // of topsky on the right, because the low-level
// drawers need 256-qbyte scan widths // drawers need 256-byte scan widths
/* /*

View file

@ -40,8 +40,10 @@ typedef struct {
static rectdesc_t r_rectdesc; static rectdesc_t r_rectdesc;
qbyte *draw_chars; // 8*8 graphic characters qbyte *draw_chars; // 8*8 graphic characters
qpic_t *draw_disc; //mpic_t *draw_disc;
qpic_t *draw_backtile; mpic_t *draw_backtile;
void SWDraw_TransPic (int x, int y, mpic_t *pic);
//============================================================================= //=============================================================================
/* Support Routines */ /* Support Routines */
@ -61,16 +63,16 @@ int swmenu_numcachepics;
Draw_CachePic Draw_CachePic
================ ================
*/ */
qpic_t *SWDraw_SafeCachePic (char *extpath) mpic_t *SWDraw_SafeCachePic (char *extpath)
{ {
swcachepic_t *pic; swcachepic_t *pic;
int i; int i;
qpic_t *dat; mpic_t *dat;
char alternatename[MAX_QPATH]; char alternatename[MAX_QPATH];
char path[MAX_QPATH]; char path[MAX_QPATH];
Q_strncpyz(path, extpath, sizeof(path)); Q_strncpyz(path, extpath, sizeof(path));
COM_StripExtension(path, path); COM_StripExtension(path, path);
for (pic=swmenu_cachepics, i=0 ; i<swmenu_numcachepics ; pic++, i++) for (pic=swmenu_cachepics, i=0 ; i<swmenu_numcachepics ; pic++, i++)
if (!strcmp (path, pic->name)) if (!strcmp (path, pic->name))
break; break;
@ -101,13 +103,17 @@ qpic_t *SWDraw_SafeCachePic (char *extpath)
BZ_Free(file); BZ_Free(file);
if (image) if (image)
{ {
dat = Cache_Alloc(&pic->cache, sizeof(qpic_t) + width*height, path); dat = Cache_Alloc(&pic->cache, sizeof(mpic_t) + width*height, path);
dat->width = width; ((mpic_t*)dat)->width = width;
dat->height = height; ((mpic_t*)dat)->height = height;
((mpic_t*)dat)->flags = 0;
for (i = 0; i < width*height; i++) for (i = 0; i < width*height; i++)
{ {
if (image[i*4+3] < 64) // 25% threshhold if (image[i*4+3] < 64) // 25% threshhold
{
((mpic_t*)dat)->flags |= MPIC_ALPHA;
dat->data[i] = 255; dat->data[i] = 255;
}
else else
dat->data[i] = GetPalette(image[i*4], image[i*4+1], image[i*4+2]); 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); BZ_Free(file);
if (image) if (image)
{ {
dat = Cache_Alloc(&pic->cache, sizeof(qpic_t) + width*height, path); dat = Cache_Alloc(&pic->cache, sizeof(mpic_t) + width*height, path);
dat->width = width; ((mpic_t*)dat)->width = width;
dat->height = height; ((mpic_t*)dat)->height = height;
((mpic_t*)dat)->flags = 0;
for (i = 0; i < width*height; i++) for (i = 0; i < width*height; i++)
{ {
if (image[i*4+3] < 64) // 25% threshhold if (image[i*4+3] < 64) // 25% threshhold
{
((mpic_t*)dat)->flags |= MPIC_ALPHA;
dat->data[i] = 255; dat->data[i] = 255;
}
else else
dat->data[i] = GetPalette(image[i*4], image[i*4+1], image[i*4+2]); 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); BZ_Free(file);
if (image) if (image)
{ {
dat = Cache_Alloc(&pic->cache, sizeof(qpic_t) + width*height, path); dat = Cache_Alloc(&pic->cache, sizeof(mpic_t) + width*height, path);
dat->width = width; ((mpic_t*)dat)->width = width;
dat->height = height; ((mpic_t*)dat)->height = height;
((mpic_t*)dat)->flags = 0;
for (i = 0; i < width*height; i++) for (i = 0; i < width*height; i++)
{ {
if (image[i*4+3] < 64) // 25% threshhold if (image[i*4+3] < 64) // 25% threshhold
{
((mpic_t*)dat)->flags |= MPIC_ALPHA;
dat->data[i] = 255; dat->data[i] = 255;
}
else else
dat->data[i] = GetPalette(image[i*4], image[i*4+1], image[i*4+2]); 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); _snprintf(alternatename, MAX_QPATH-1,"%s.lmp", path);
COM_LoadCacheFile (alternatename, &pic->cache); COM_LoadCacheFile (alternatename, &pic->cache);
dat = (qpic_t *)pic->cache.data; dat = pic->cache.data;
if (!dat) if (!dat)
{ {
char alternatename[MAX_QPATH]; char alternatename[MAX_QPATH];
sprintf(alternatename, "gfx/%s.lmp", path); sprintf(alternatename, "gfx/%s.lmp", path);
dat = (qpic_t *)COM_LoadTempFile (alternatename); COM_LoadCacheFile(alternatename, &pic->cache);
dat = pic->cache.data;
if (!dat) if (!dat)
return NULL; return NULL;
// Sys_Error ("Draw_CachePic: failed to load %s", path); // 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; return dat;
} }
qpic_t *SWDraw_CachePic (char *path) mpic_t *SWDraw_CachePic (char *path)
{ {
qpic_t *pic; mpic_t *pic;
pic = SWDraw_SafeCachePic(path); pic = SWDraw_SafeCachePic(path);
if (!pic) if (!pic)
Sys_Error ("Draw_CachePic: failed to load %s", path); Sys_Error ("Draw_CachePic: failed to load %s", path);
@ -212,7 +231,7 @@ qpic_t *SWDraw_CachePic (char *path)
return pic; return pic;
} }
qpic_t *SWDraw_ConcharsMalloc (char *name) mpic_t *SWDraw_ConcharsMalloc (char *name)
{ {
// stupid hack for conchars... // stupid hack for conchars...
qpic_t *dat; qpic_t *dat;
@ -235,14 +254,15 @@ qpic_t *SWDraw_ConcharsMalloc (char *name)
for (j = 0; j < 128*128; j++) for (j = 0; j < 128*128; j++)
dat->data[j] = (draw_chars[j] == 255 || !draw_chars[j]) ? draw_chars[j] ^ 255 : draw_chars[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); // 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); strcpy (pic->name, name);
} }
return pic->cache.data; return pic->cache.data;
} }
qpic_t *SWDraw_MallocPic (char *path) mpic_t *SWDraw_MallocPic (char *path)
{ {
int i; int i;
qpic_t *dat; qpic_t *dat;
@ -265,7 +285,7 @@ qpic_t *SWDraw_MallocPic (char *path)
dat = Cache_Check (&pic->cache); dat = Cache_Check (&pic->cache);
if (dat) if (dat)
return dat; return (mpic_t *)dat;
@ -286,14 +306,15 @@ qpic_t *SWDraw_MallocPic (char *path)
{ {
pic->cache.data = dat; pic->cache.data = dat;
pic->cache.fake = true; pic->cache.fake = true;
dat->width = width; ((mpic_t*)dat)->width = width;
dat->height = height; ((mpic_t*)dat)->height = height;
((mpic_t*)dat)->flags = 0;
for (i = 0; i < width*height; i++) for (i = 0; i < width*height; i++)
dat->data[i] = GetPalette(image[i*4], image[i*4+1], image[i*4+2]); dat->data[i] = GetPalette(image[i*4], image[i*4+1], image[i*4+2]);
BZ_Free(image); BZ_Free(image);
return dat; return (mpic_t *)dat;
} }
BZ_Free(image); BZ_Free(image);
} }
@ -315,22 +336,35 @@ qpic_t *SWDraw_MallocPic (char *path)
SwapPic (dat); 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]; char q2name[MAX_QPATH];
qpic_t *qpic; qpic_t *qpic;
mpic_t *mpic;
if (!strcmp(name, "conchars")) // conchars hack if (!strcmp(name, "conchars")) // conchars hack
return SWDraw_ConcharsMalloc("conchars"); return SWDraw_ConcharsMalloc("conchars");
sprintf(q2name, "pics/%s.pcx", name); sprintf(q2name, "pics/%s.pcx", name);
qpic = SWDraw_MallocPic(q2name); mpic = SWDraw_MallocPic(q2name);
if (qpic) if (mpic)
return qpic; 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 draw_chars = W_SafeGetLumpName ("conchars"); //q1
if (!draw_chars) if (!draw_chars)
{ {
qpic_t *pic; //try q2 mpic_t *pic; //try q2
int i; int i;
int s; 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) if (pic)
{ {
draw_chars = pic->data; draw_chars = pic->data;
@ -409,10 +443,15 @@ void SWDraw_Init (void)
draw_disc = W_SafeGetLumpName ("disc"); draw_disc = W_SafeGetLumpName ("disc");
draw_backtile = W_SafeGetLumpName ("backtile"); draw_backtile = W_SafeGetLumpName ("backtile");
if (!draw_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) 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.width = draw_backtile->width;
r_rectdesc.height = draw_backtile->height; r_rectdesc.height = draw_backtile->height;
r_rectdesc.ptexbytes = draw_backtile->data; r_rectdesc.ptexbytes = draw_backtile->data;
@ -881,7 +920,7 @@ void SWDraw_DebugChar (qbyte num)
Draw_Pic 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; qbyte *dest, *source;
int v, u; int v, u;
@ -889,6 +928,12 @@ void SWDraw_Pic (int x, int y, qpic_t *pic)
if (!pic) if (!pic)
return; return;
if (pic->flags & MPIC_ALPHA)
{
SWDraw_TransPic(x, y, pic);
return;
}
if ((x < 0) || if ((x < 0) ||
(x + pic->width > vid.width) || (x + pic->width > vid.width) ||
(y < 0) || (y < 0) ||
@ -939,14 +984,14 @@ void SWDraw_Pic (int x, int y, qpic_t *pic)
} }
} }
/* /*
============= =============
Draw_SubPic 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; qbyte *dest, *source;
int v, u; 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; 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 ; v<height ; v++)
{
for (u=0 ; u<width ; u++)
if ( (tbyte=source[u]) != TRANSPARENT_COLOR)
dest[u] = tbyte;
dest += vid.rowbytes;
source += pic->width;
}
}
else
{ // unwound
for (v=0 ; v<height ; v++)
{
for (u=0 ; u<width ; u+=8)
{
if ( (tbyte=source[u]) != TRANSPARENT_COLOR)
dest[u] = tbyte;
if ( (tbyte=source[u+1]) != TRANSPARENT_COLOR)
dest[u+1] = tbyte;
if ( (tbyte=source[u+2]) != TRANSPARENT_COLOR)
dest[u+2] = tbyte;
if ( (tbyte=source[u+3]) != TRANSPARENT_COLOR)
dest[u+3] = tbyte;
if ( (tbyte=source[u+4]) != TRANSPARENT_COLOR)
dest[u+4] = tbyte;
if ( (tbyte=source[u+5]) != TRANSPARENT_COLOR)
dest[u+5] = tbyte;
if ( (tbyte=source[u+6]) != TRANSPARENT_COLOR)
dest[u+6] = tbyte;
if ( (tbyte=source[u+7]) != TRANSPARENT_COLOR)
dest[u+7] = tbyte;
}
dest += vid.rowbytes;
source += pic->width;
}
}
}
else if (r_pixbytes == 2)
{
unsigned short *p16dest;
p16dest = (unsigned short *)vid.buffer + y * vid.rowbytes + x;
for (v=0 ; v<height ; v++)
{
for (u=0 ; u<(width) ; u++)
p16dest[u] = d_8to16table[source[u]];
p16dest += vid.rowbytes;
source += pic->width;
}
}
else if (r_pixbytes == 4)
{
unsigned int *p32dest;
p32dest = (unsigned int *)vid.buffer + y * vid.rowbytes + x;
for (v=0 ; v<height ; v++)
{
for (u=0 ; u<(width) ; u++)
p32dest[u] = d_8to32table[source[u]];
p32dest += vid.rowbytes;
source += pic->width;
}
}
}
/*
=============
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) if (r_pixbytes == 1)
{ {
dest = vid.buffer + y * vid.rowbytes + x; 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 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; qbyte *source, tbyte;
int v, u; int v, u;
@ -1163,8 +1307,9 @@ void SWDraw_TransPic (int x, int y, qpic_t *pic)
Draw_TransPicTranslate 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; qbyte *source, tbyte;
int v, u; 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; 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; float xend, yend, xratio, yratio;
if (!pic) if (!pic)
@ -1626,15 +1772,15 @@ void SWDraw_ConsoleBackground (int lines)
qbyte *src; qbyte *src;
qbyte *dest; qbyte *dest;
int f, fstep; int f, fstep;
qpic_t *conback; mpic_t *conback;
char ver[100]; char ver[100];
static char saveback[320*8]; static char saveback[320*8];
conback = SWDraw_SafeCachePic ("gfx/conback.lmp"); conback = (mpic_t *)SWDraw_SafeCachePic ("gfx/conback.lmp");
if (!conback) if (!conback)
conback = SWDraw_SafeCachePic("pics/conback.pcx"); conback = (mpic_t *)SWDraw_SafeCachePic("pics/conback.pcx");
if (!conback) if (!conback)
conback = SWDraw_SafeCachePic ("gfx/menu/conback.lmp"); conback = (mpic_t *)SWDraw_SafeCachePic ("gfx/menu/conback.lmp");
if (!conback) if (!conback)
Sys_Error("gfx/conback.lmp not found\n"); Sys_Error("gfx/conback.lmp not found\n");

View file

@ -26,13 +26,13 @@ void SWDraw_ReInit (void);
void SWDraw_Shutdown(void); void SWDraw_Shutdown(void);
void SWDraw_Character (int x, int y, unsigned int num); void SWDraw_Character (int x, int y, unsigned int num);
void SWDraw_ImageColours (float r, float g, float b, float a); 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_ColouredCharacter (int x, int y, unsigned int num);
void SWDraw_DebugChar (qbyte 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_SubPic(int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height);
void SWDraw_Pic (int x, int y, qpic_t *pic); void SWDraw_Pic (int x, int y, mpic_t *pic);
void SWDraw_TransPic (int x, int y, qpic_t *pic); void SWDraw_TransPic (int x, int y, mpic_t *pic);
void SWDraw_TransPicTranslate (int x, int y, qpic_t *pic, qbyte *translation); void SWDraw_TransPicTranslate (int x, int y, mpic_t *pic, qbyte *translation);
void SWDraw_ConsoleBackground (int lines); void SWDraw_ConsoleBackground (int lines);
void SWDraw_EditorBackground (int lines); void SWDraw_EditorBackground (int lines);
void SWDraw_BeginDisc (void); 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_FadeScreen (void);
void SWDraw_String (int x, int y, const qbyte *str); void SWDraw_String (int x, int y, const qbyte *str);
void SWDraw_Alt_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); mpic_t *SWDraw_SafePicFromWad (char *name);
qpic_t *SWDraw_PicFromWad (char *name); mpic_t *SWDraw_PicFromWad (char *name);
qpic_t *SWDraw_SafeCachePic (char *path); mpic_t *SWDraw_SafeCachePic (char *path);
qpic_t *SWDraw_CachePic (char *path); mpic_t *SWDraw_CachePic (char *path);
void SWDraw_Crosshair(void); void SWDraw_Crosshair(void);