From 28fda441c8e28635e4c54b973f2ef5694da5fda1 Mon Sep 17 00:00:00 2001 From: Spoike Date: Sun, 23 Jan 2005 17:49:42 +0000 Subject: [PATCH] Reworked quite a bit of 2d code... well, fps, speed and clock at least git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@824 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/Makefile.SDL | 489 -------------------------------------- engine/client/cl_main.c | 8 +- engine/client/cl_screen.c | 163 +++++++++++-- engine/client/cl_tent.c | 2 +- engine/client/screen.h | 4 +- engine/client/skin.c | 8 + engine/client/snd_win.c | 2 +- engine/client/view.c | 2 +- engine/common/qvm.c | 16 +- engine/gl/gl_screen.c | 76 ------ 10 files changed, 172 insertions(+), 598 deletions(-) delete mode 100644 engine/Makefile.SDL diff --git a/engine/Makefile.SDL b/engine/Makefile.SDL deleted file mode 100644 index 1a3f386b9..000000000 --- a/engine/Makefile.SDL +++ /dev/null @@ -1,489 +0,0 @@ -CC=gcc - -CPUOPTIMIZATIONS= - -BASE_DIR=. - -ifeq ($(FTE_TARGET),) -# ifdef windir -# FTE_TARGET=win32 -# endif - - FTE_TARGET ?= sdl -endif - - -CLIENT_DIR=$(BASE_DIR)/client -GL_DIR=$(BASE_DIR)/gl -SW_DIR=$(BASE_DIR)/sw -SERVER_DIR=$(BASE_DIR)/server -COMMON_DIR=$(BASE_DIR)/common -NQPROT_DIR=$(BASE_DIR)/nqnet -HTTP_DIR=$(BASE_DIR)/http -LIBS_DIR=$(BASE_DIR)/libs -PROGS_DIR=$(BASE_DIR)/qclib -SNDCODEC_DIR=$(BASE_DIR)/sndcodec -MP3_DIR=$(BASE_DIR)/../mp3/libmad -QUX_DIR=$(BASE_DIR)/qux - -RELEASE_DIR=$(BASE_DIR)/release -DEBUG_DIR=$(BASE_DIR)/debug - -DO_CC=$(CC) $(BASE_CFLAGS) $(CFLAGS) -o $@ -c $< -ifeq ($(USEASM),true) - ifdef windir - DO_AS=$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $< - else - DO_AS=$(CC) $(CFLAGS) -x assembler-with-cpp -DELF -o $@ -c $< - endif -endif -BASELDFLAGS=-lm -lz -GLXLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext -lpng -ljpeg -lXxf86vm -GLSLDFLAGS=-L/usr/X11R6/lib -lMesaGL -lglide -lvga -XLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext -lpng -ljpeg -SLDFLAGS=-lvga - -ifeq ($(USEASM),true) - COMMON_ASM_OBJS = \ - worlda.o \ - math.o - - CLIENT_ASM_OBJS = \ - snd_mixa.o - - SOFTWARE_ASM_OBJS = \ - r_aclipa.o \ - r_aliasa.o \ - r_drawa.o \ - r_edgea.o \ - r_varsa.o \ - d_draw.o \ - d_draw16.o \ - d_parta.o \ - d_polysa.o \ - d_scana.o \ - d_spr8.o \ - d_varsa.o \ - surf16.o \ - surf8.o - -else - BASE_ASM_CFLAGS = -DNOASM -endif - -BASE_CFLAGS=$(BASE_ASM_CFLAGS) -Wall -Dstrnicmp=strncasecmp -Dstricmp=strcasecmp -I$(CLIENT_DIR) -I$(SERVER_DIR) -I$(COMMON_DIR) -I$(SW_DIR) -I$(GL_DIR) -I$(PROGS_DIR) -I$(LIBS_DIR) -I$(QUX_DIR) -I$(LIBS_DIR)/dxsdk7/include -I/usr/X11R6/include -I$(LIBS_DIR)/sdl/include -I$(LIBS_DIR)/sdl/include/SDL -D_vsnprintf=vsnprintf -D_snprintf=snprintf -CLIENT_ONLY_CFLAGS=-DCLIENTONLY -SERVER_ONLY_CFLAGS=-DSERVERONLY -JOINT_CFLAGS= -DEBUG_CFLAGS=-ggdb -g -RELEASE_CFLAGS=-O6 -s -fno-strict-aliasing -ffast-math -funroll-loops -fexpensive-optimizations $(CPUOPTIMIZATIONS) -GLCFLAGS=-DGLQUAKE -SWCFLAGS=-DSWQUAKE - -NQPROT_OBJS = \ - net_main.o \ - net_loop.o \ - net_dgrm.o \ - net_udp.o \ - net_wipx.o \ - net_vcr.o - -CLIENT_OBJS = $(CLIENT_ASM_OBJS) \ - textedit.o \ - fragstats.o \ - teamplay.o \ - zqtp.o \ - cl_demo.o \ - cl_ents.o \ - clq2_ents.o \ - cl_input.o \ - cl_main.o \ - cl_parse.o \ - cl_pred.o \ - cl_tent.o \ - cl_cam.o \ - cl_screen.o \ - cl_ui.o \ - qvm.o \ - ircclient.o \ - console.o \ - image.o \ - keys.o \ - menu.o \ - m_master.o \ - m_multi.o \ - m_items.o \ - m_options.o \ - m_single.o \ - m_script.o \ - m_mp3.o \ - roq_read.o \ - clq2_cin.o \ - net_master.o \ - r_bulleten.o \ - r_part.o \ - r_partset.o \ - r_efrag.o \ - renderer.o \ - renderque.o \ - sbar.o \ - skin.o \ - snd_dma.o \ - snd_mem.o \ - snd_mix.o \ - snd_mp3.o \ - snd_ov.o \ - valid.o \ - view.o \ - wad.o \ - \ - pop3noti.o \ - imapnoti.o \ - \ - ftpclient.o \ - httpclient.o \ - \ - \ - m_x.o \ - x_reqs.o \ - x_res.o \ - pr_menu.o - - -SOFTWARE_OBJS = $(SOFTWARE_ASM_OBJS) \ - sw_screen.o \ - sw_draw.o \ - sw_model.o \ - r_aclip.o \ - r_alias.o \ - r_bsp.o \ - r_draw.o \ - r_edge.o \ - r_light.o \ - r_main.o \ - r_misc.o \ - r_sky.o \ - r_sprite.o \ - r_surf.o \ - r_vars.o \ - d_edge.o \ - d_fill.o \ - d_init.o \ - d_modech.o \ - d_part.o \ - d_polyse.o \ - d_scan.o \ - d_sky.o \ - d_sprite.o \ - d_surf.o \ - d_trans.o \ - d_vars.o \ - d_zpoint.o \ - nonintel.o - -GLQUAKE_OBJS = \ - gl_alias.o \ - gl_draw.o \ - gl_model.o \ - gl_ngraph.o \ - gl_rlight.o \ - gl_rmain.o \ - gl_rmisc.o \ - gl_rsurf.o \ - ltface.o \ - gl_screen.o \ - gl_backend.o \ - gl_shader.o \ - gl_warp.o \ - gl_ppl.o \ - gl_vidcommon.o \ - gl_hlmdl.o - -MP3_OBJS = \ - fixed.o \ - bit.o \ - timer.o \ - stream.o \ - frame.o \ - synth.o \ - decoder.o \ - layer12.o \ - layer3.o \ - huffman.o \ - mymad.o - -PROGS_OBJS = \ - comprout.o \ - hash.o \ - initlib.o \ - pr_edict.o \ - pr_exec.o \ - pr_multi.o \ - qcc_cmdlib.o \ - qccmain.o \ - qcc_pr_comp.o \ - qcc_pr_lex.o \ - qcdecomp.o \ - qcd_main.o - -SERVER_OBJS = \ - pr_cmds.o \ - sv_master.o \ - sv_init.o \ - sv_main.o \ - sv_nchan.o \ - sv_ents.o \ - sv_send.o \ - sv_move.o \ - sv_phys.o \ - sv_user.o \ - sv_mvd.o \ - sv_ccmds.o \ - sv_rankin.o \ - sv_chat.o \ - sv_demo.o \ - world.o \ - net_preparse.o \ - savegame.o \ - svq2_ents.o \ - svq2_game.o \ - snd_vc.o \ - snd_voicecodecs.o \ - g711.o \ - g721.o \ - g723_24.o \ - g723_40.o \ - g72x.o \ - webgen.o \ - ftpserver.o \ - httpserver.o \ - sv_pop3.o \ - sv_smtp.o - -SERVERONLY_OBJS = \ - svmodel.o \ - sv_sys_unix.o - -COMMON_OBJS = $(COMMON_ASM_OBJS) \ - common.o \ - cvar.o \ - cmd.o \ - crc.o \ - mathlib.o \ - huff.o \ - md4.o \ - md5.o \ - net_chan.o \ - net_wins.o \ - zone.o \ - gl_q2bsp.o \ - glmod_doom.o \ - pmove.o \ - pmovetst.o \ - iwebiface.o \ - translate.o \ - plugin.o \ - q1bsp.o \ - q2pmove.o - -ifeq ($(FTE_TARGET), win32) - GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidnt.o snd_win.o cd_win.o in_win.o sys_win.o sys_dosa.o - GL_EXE_NAME=../fteglqw.exe - GLCL_EXE_NAME=../fteglqwcl.exe - GL_LDFLAGS=$(GLLDFLAGS) -ldxguid -lwsock32 -lwinmm -lgdi32 -lole32 - GL_CFLAGS=$(GLCFLAGS) - GLB_DIR=gl_mgw - GLCL_DIR=glcl_mgw - -ifeq ($(USEASM),true) - SWCL_OBJS=$(SOFTWARE_OBJS) vid_ddraw.o vid_dib.o vid_win2.o snd_win.o cd_win.o in_win.o sys_win.o sys_dosa.o -else - SWCL_OBJS=$(SOFTWARE_OBJS) vid_ddraw.o vid_dib.o vid_win2.o snd_win.o cd_win.o in_win.o sys_win.o -endif - SW_EXE_NAME=../fteswqw.exe - SWCL_EXE_NAME=../fteswqwcl.exe - SW_LDFLAGS=$(SWLDFLAGS) -ldxguid -lwsock32 -lwinmm -lgdi32 -lole32 - SW_CFLAGS=$(SWCFLAGS) - SWB_DIR=sw_mgw - SWCL_DIR=swcl_mgw - -ifeq ($(USEASM),true) - MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidnt.o vid_ddraw.o vid_dib.o vid_win2.o snd_win.o cd_win.o in_win.o sys_win.o sys_dosa.o -else - MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidnt.o vid_ddraw.o vid_dib.o vid_win2.o snd_win.o cd_win.o in_win.o sys_win.o -endif - M_EXE_NAME=../fteqw.exe - MCL_EXE_NAME=../fteqwcl.exe - M_LDFLAGS=$(GLLDFLAGS) -ldxguid -lwsock32 -lwinmm -lgdi32 -lole32 - M_CFLAGS=$(SWCFLAGS) $(GLCFLAGS) - MB_DIR=m_mgw - MCL_DIR=mcl_mgw - -else -#if FTE_TARGET != win32 (so sdl builds then) - - - GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o - GL_EXE_NAME=../fteqw_sdl.gl - GLCL_EXE_NAME=../fteqwcl_sdl.gl -ifdef windir - GL_LDFLAGS=$(GLLDFLAGS) -lmingw32 -lwsock32 `sdl-config --libs` -else - GL_LDFLAGS=$(GLLDFLAGS) -lpng -ljpeg `sdl-config --libs` -endif - GL_CFLAGS=$(GLCFLAGS) `sdl-config --cflags` - GLB_DIR=gl_sdl - GLCL_DIR=glcl_sdl - - SWCL_OBJS=$(SOFTWARE_OBJS) vid_sdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o - SW_EXE_NAME=../fteqw_sdl.sw - SWCL_EXE_NAME=../fteqwcl_sdl.sw -ifdef windir - SW_LDFLAGS=$(SWLDFLAGS) -lmingw32 -lwsock32 -lSDLmain -lSDL -else - #pthread is needed because of SDL. - SW_LDFLAGS=$(SWLDFLAGS) `sdl-config --libs` -lpng -ljpeg -lSDLmain -endif - SW_CFLAGS=$(SWCFLAGS) `sdl-config --cflags` - SWB_DIR=sw_mgw - SWCL_DIR=swcl_mgw -endif - -all: help - -VPATH = $(BASE_DIR) : $(CLIENT_DIR) : $(GL_DIR) : $(COMMON_DIR) : $(SW_DIR) : $(SERVER_DIR) : $(NQPROT_DIR) : $(HTTP_DIR) : $(BASE_DIR)/irc : $(BASE_DIR)/email : $(QUX_DIR) : $(PROGS_DIR) : $(SNDCODEC_DIR) - -#NQPROT_DIR=$(BASE_DIR)/nqnet -#HTTP_DIR=$(BASE_DIR)/http -#LIBS_DIR=$(BASE_DIR)/libs -#PROGS_DIR=$(BASE_DIR)/qclib -#SNDCODEC_DIR=$(BASE_DIR)/sndcodec -#DEBUG_DIR=$(BASE_DIR)/debug -#MP3_DIR=$(BASE_DIR)/../mp3/libmad -#RELEASE_DIR=$(BASE_DIR)/release -#QUX_DIR=$(BASE_DIR)/qux - -$(OUT_DIR)/%.o : %.c - $(DO_CC) - -ifeq ($(USEASM),true) -$(OUT_DIR)/%.o : %.s - $(DO_AS) -endif - -$(OUT_DIR)/$(EXE_NAME): $(addprefix $(OUT_DIR)/, $(foreach ol, $(OBJS), $($(ol)))) - $(CC) $(CFLAGS) -o $@ $(addprefix $(OUT_DIR)/, $(foreach ol, $(OBJS), $($(ol)))) $(LDFLAGS) - -_out-rel: - $(MAKE) -f Makefile.SDL $(OUT_DIR)/$(EXE_NAME) EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" CFLAGS="$(CFLAGS) $(RELEASE_CFLAGS)" LDFLAGS="$(BASELDFLAGS) $(LDFLAGS)" OBJS="$(OBJS)" - strip --strip-all $(OUT_DIR)/$(EXE_NAME) - -_out-dbg: - $(MAKE) -f Makefile.SDL $(OUT_DIR)/$(EXE_NAME) EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" CFLAGS="$(CFLAGS) $(DEBUG_CFLAGS)" LDFLAGS="$(BASELDFLAGS) $(LDFLAGS)" OBJS="$(OBJS)" - -_cl-rel: - $(MAKE) -f Makefile.SDL _out-rel EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" CFLAGS="$(CLIENT_ONLY_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)" SOBJS="$(SOBJS)" OBJS="SOBJS COMMON_OBJS NQPROT_OBJS CLIENT_OBJS PROGS_OBJS" - -_cl-dbg: - $(MAKE) -f Makefile.SDL _out-dbg EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" CFLAGS="$(CLIENT_ONLY_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)" SOBJS="$(SOBJS)" OBJS="SOBJS COMMON_OBJS NQPROT_OBJS CLIENT_OBJS PROGS_OBJS" - -_clsv-rel: reldir - $(MAKE) -f Makefile.SDL _out-rel EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" CFLAGS="$(JOINT_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)" SOBJS="$(SOBJS)" OBJS="SOBJS COMMON_OBJS NQPROT_OBJS CLIENT_OBJS PROGS_OBJS SERVER_OBJS" - -_clsv-dbg: debugdir - $(MAKE) -f Makefile.SDL _out-dbg EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" CFLAGS="$(JOINT_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)" 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_EXE_NAME=fteqwsv -SV_LDFLAGS= -SV_CFLAGS=$(SERVER_ONLY_CFLAGS) -SV_DIR=server -sv-tmp: - $(MAKE) -f Makefile.SDL $(TYPE) OUT_DIR="$(OUT_DIR)" EXE_NAME="$(SV_EXE_NAME)" CFLAGS="$(SV_CFLAGS)" LDFLAGS="$(SV_LDFLAGS)" OBJS="$(SV_OBJS)" -sv-rel: - $(MAKE) -f Makefile.SDL sv-tmp TYPE=_out-rel OUT_DIR="$(RELEASE_DIR)/$(SV_DIR)" -sv-dbg: - $(MAKE) -f Makefile.SDL sv-tmp TYPE=_out-dbg OUT_DIR="$(DEBUG_DIR)/$(SV_DIR)" - - - - - -glcl-tmp: - $(MAKE) -f Makefile.SDL $(TYPE) OUT_DIR="$(OUT_DIR)" EXE_NAME="$(GLCL_EXE_NAME)" CFLAGS="$(GL_CFLAGS)" LDFLAGS="$(GL_LDFLAGS)" SOBJS="$(GLCL_OBJS)" -gl-tmp: - $(MAKE) -f Makefile.SDL $(TYPE) OUT_DIR="$(OUT_DIR)" EXE_NAME="$(GL_EXE_NAME)" CFLAGS="$(GL_CFLAGS)" LDFLAGS="$(GL_LDFLAGS)" SOBJS="$(GLCL_OBJS)" - -glcl-rel: - $(MAKE) -f Makefile.SDL glcl-tmp TYPE=_cl-rel OUT_DIR="$(RELEASE_DIR)/$(GLCL_DIR)" -glcl-dbg: - $(MAKE) -f Makefile.SDL glcl-tmp TYPE=_cl-dbg OUT_DIR="$(DEBUG_DIR)/$(GLCL_DIR)" -gl-rel: - $(MAKE) -f Makefile.SDL gl-tmp TYPE=_clsv-rel OUT_DIR="$(RELEASE_DIR)/$(GLB_DIR)" -gl-dbg: - $(MAKE) -f Makefile.SDL gl-tmp TYPE=_clsv-dbg OUT_DIR="$(DEBUG_DIR)/$(GLB_DIR)" - - - - -swcl-tmp: - $(MAKE) -f Makefile.SDL $(TYPE) OUT_DIR="$(OUT_DIR)" EXE_NAME="$(SWCL_EXE_NAME)" CFLAGS="$(SW_CFLAGS)" LDFLAGS="$(SW_LDFLAGS)" SOBJS="$(SWCL_OBJS)" -sw-tmp: - $(MAKE) -f Makefile.SDL $(TYPE) OUT_DIR="$(OUT_DIR)" EXE_NAME="$(SW_EXE_NAME)" CFLAGS="$(SW_CFLAGS)" LDFLAGS="$(SW_LDFLAGS)" SOBJS="$(SWCL_OBJS)" - -swcl-rel: - $(MAKE) -f Makefile.SDL swcl-tmp TYPE=_cl-rel OUT_DIR="$(RELEASE_DIR)/$(SWCL_DIR)" -swcl-dbg: - $(MAKE) -f Makefile.SDL swcl-tmp TYPE=_cl-dbg OUT_DIR="$(DEBUG_DIR)/$(SWCL_DIR)" -sw-rel: - $(MAKE) -f Makefile.SDL sw-tmp TYPE=_clsv-rel OUT_DIR="$(RELEASE_DIR)/$(SWB_DIR)" -sw-dbg: - $(MAKE) -f Makefile.SDL sw-tmp TYPE=_clsv-dbg OUT_DIR="$(DEBUG_DIR)/$(SWB_DIR)" - - - -mcl-tmp: - $(MAKE) -f Makefile.SDL $(TYPE) OUT_DIR="$(OUT_DIR)" EXE_NAME="$(MCL_EXE_NAME)" CFLAGS="$(M_CFLAGS)" LDFLAGS="$(M_LDFLAGS)" SOBJS="$(MCL_OBJS)" -mcl-rel: - $(MAKE) -f Makefile.SDL mcl-tmp TYPE=_cl-rel OUT_DIR="$(RELEASE_DIR)/$(MCL_DIR)" -mcl-dbg: - $(MAKE) -f Makefile.SDL mcl-tmp TYPE=_cl-dbg OUT_DIR="$(DEBUG_DIR)/$(MCL_DIR)" - - -m-tmp: - $(MAKE) -f Makefile.SDL $(TYPE) OUT_DIR="$(OUT_DIR)" EXE_NAME="$(M_EXE_NAME)" CFLAGS="$(M_CFLAGS)" LDFLAGS="$(M_LDFLAGS)" SOBJS="$(MCL_OBJS)" -m-rel: - $(MAKE) -f Makefile.SDL m-tmp TYPE=_clsv-rel OUT_DIR="$(RELEASE_DIR)/$(MCL_DIR)" -m-dbg: - $(MAKE) -f Makefile.SDL m-tmp TYPE=_clsv-dbg OUT_DIR="$(DEBUG_DIR)/$(MCL_DIR)" - - -ifdef windir -debugdir: - @-mkdir $(subst /,\, $(OUT_DIR)) -reldir: - @-mkdir $(subst /,\, $(OUT_DIR)) -else -reldir: - @-mkdir $(RELEASE_DIR) - @-mkdir $(OUT_DIR) -debugdir: - @-mkdir $(DEBUG_DIR) - @-mkdir $(OUT_DIR) -endif - -help: - @-echo "Specfic targets:" - @-echo "clean - removes all output (use make dirs afterwards)" - @-echo "all - make all the targets possible" - @-echo "" - @-echo "Normal targets:" - @-echo "(each of these targets must have the postfix -rel or -dbg)" - @-echo "sv" - @-echo "gl" - -clean: - -rm -f -r $(RELEASE_DIR) - -rm -f -r $(DEBUG_DIR) - diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 9abbe546f..2e8b6c608 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -166,9 +166,7 @@ int host_hunklevel; qbyte *host_basepal; qbyte *host_colormap; -cvar_t host_speeds = {"host_speeds","0"}; // set for running times -cvar_t show_fps = {"show_fps","0"}; // set for running times -cvar_t show_ups = {"show_ups","0"}; // set for running times +cvar_t host_speeds = {"host_speeds","0"}; // set for running times #ifdef CRAZYDEBUGGING cvar_t developer = {"developer","1"}; #else @@ -2227,7 +2225,8 @@ void CL_Init (void) // // register our commands // - Cvar_Register (&show_fps, cl_screengroup); + CLSCR_Init(); + Cvar_Register (&host_speeds, cl_controlgroup); Cvar_Register (&developer, cl_controlgroup); @@ -2744,6 +2743,7 @@ CL_RequestNextDownload(); if (host_speeds.value) time1 = Sys_DoubleTime (); + TP_CheckVars(); if (SCR_UpdateScreen) { extern mleaf_t *r_viewleaf; diff --git a/engine/client/cl_screen.c b/engine/client/cl_screen.c index 42a25462d..09678b1e9 100644 --- a/engine/client/cl_screen.c +++ b/engine/client/cl_screen.c @@ -105,7 +105,6 @@ extern cvar_t scr_showpause; extern cvar_t scr_printspeed; extern cvar_t scr_allowsnap; extern cvar_t scr_sshot_type; -extern cvar_t show_fps; extern cvar_t crosshair; extern cvar_t con_height; @@ -136,6 +135,30 @@ float oldsbar = 0; void SCR_ScreenShot_f (void); void SCR_RSShot_f (void); +cvar_t show_fps = {"show_fps", "0"}; +cvar_t show_fps_x = {"show_fps_x", "-1"}; +cvar_t show_fps_y = {"show_fps_y", "-1"}; +cvar_t show_clock = {"cl_clock", "0"}; +cvar_t show_clock_x = {"cl_clock_x", "0"}; +cvar_t show_clock_y = {"cl_clock_y", "-1"}; +cvar_t show_speed = {"show_speed", "0"}; +cvar_t show_speed_x = {"show_speed_x", "-1"}; +cvar_t show_speed_y = {"show_speed_y", "-9"}; + +extern char cl_screengroup[]; +void CLSCR_Init(void) +{ + Cvar_Register(&show_fps, cl_screengroup); + Cvar_Register(&show_fps_x, cl_screengroup); + Cvar_Register(&show_fps_y, cl_screengroup); + Cvar_Register(&show_clock, cl_screengroup); + Cvar_Register(&show_clock_x, cl_screengroup); + Cvar_Register(&show_clock_y, cl_screengroup); + Cvar_Register(&show_speed, cl_screengroup); + Cvar_Register(&show_speed_x, cl_screengroup); + Cvar_Register(&show_speed_y, cl_screengroup); +} + /* =============================================================================== @@ -932,6 +955,16 @@ void SCR_DrawNet (void) Draw_Pic (scr_vrect.x+64, scr_vrect.y, scr_net); } +void SCR_StringXY(char *str, float x, float y) +{ + if (x < 0) + x = vid.width - strlen(str)*8; + if (y < 0) + y = vid.height - sb_lines - 8; + + Draw_String(x, y, str); +} + void SCR_DrawFPS (void) { extern cvar_t show_fps; @@ -939,49 +972,59 @@ void SCR_DrawFPS (void) double t; extern int fps_count; static float lastfps; - int x, y; - char st[80]; + char str[80]; if (!show_fps.value) return; t = Sys_DoubleTime(); - if ((t - lastframetime) >= 1.0) { + if ((t - lastframetime) >= 1.0) + { lastfps = fps_count/(t - lastframetime); fps_count = 0; lastframetime = t; } - sprintf(st, "%3.1f FPS", lastfps); - x = vid.width - strlen(st) * 8 - 8; - y = vid.height - sb_lines - 8; -// Draw_TileClear(x, y, strlen(st) * 8, 8); - Draw_String(x, y, st); + sprintf(str, "%3.1f FPS", lastfps); + SCR_StringXY(str, show_fps_x.value, show_fps_y.value); } void SCR_DrawUPS (void) { - extern cvar_t show_ups; + extern cvar_t show_speed; static double lastupstime; double t; static float lastups; - int x, y; - char st[80]; + char str[80]; - if (!show_ups.value) + if (!show_speed.value) return; t = Sys_DoubleTime(); - if ((t - lastupstime) >= 1.0) { + if ((t - lastupstime) >= 1.0) + { lastups = sqrt((cl.simvel[0][0]*cl.simvel[0][0]) + (cl.simvel[0][1]*cl.simvel[0][1])); lastupstime = t; } - sprintf(st, "%3.1f UPS", lastups); - x = vid.width - strlen(st) * 8 - 8; - y = vid.height - sb_lines - 16; -// Draw_TileClear(x, y, strlen(st) * 8, 8); - Draw_String(x, y, st); + sprintf(str, "%3.1f UPS", lastups); + SCR_StringXY(str, show_speed_x.value, show_speed_y.value); +} + +void SCR_DrawClock(void) +{ + struct tm *newtime; + time_t long_time; + char str[16]; + + if (!show_clock.value) + return; + + time( &long_time ); + newtime = localtime( &long_time ); + strftime( str, sizeof(str)-1, "%H:%M ", newtime); + + SCR_StringXY(str, show_clock_x.value, show_clock_y.value); } @@ -1752,3 +1795,85 @@ void SCR_TileClear (void) } } } + + + +// The 2d refresh stuff. +void SCR_DrawTwoDimensional(int uimenu, qboolean nohud) +{ + RSpeedMark(); + // + // draw any areas not covered by the refresh + // + if (!nohud) + SCR_TileClear (); + +#ifdef RGLQUAKE + if (r_netgraph.value) + GLR_NetGraph (); +#endif + + if (scr_drawdialog) + { +#ifdef PLUGINS + if (!nohud) + Plug_SBar (); +#endif + SCR_ShowPics_Draw(); + Draw_FadeScreen (); + SCR_DrawNotifyString (); + scr_copyeverything = true; + } + else if (scr_drawloading) + { + SCR_DrawLoading (); +#ifdef PLUGINS + Plug_SBar (); +#endif + SCR_ShowPics_Draw(); + } + else if (cl.intermission == 1 && key_dest == key_game) + { + Sbar_IntermissionOverlay (); + M_Draw (uimenu); + } + else if (cl.intermission == 2 && key_dest == key_game) + { + Sbar_FinaleOverlay (); + SCR_CheckDrawCenterString (); + } + else if (cl.intermission == 3 && key_dest == key_game) + { + } + else + { + if (!nohud) + { + Draw_Crosshair(); + + SCR_DrawRam (); + SCR_DrawNet (); + SCR_DrawFPS (); + SCR_DrawUPS (); + SCR_DrawClock(); + SCR_DrawTurtle (); + SCR_DrawPause (); +#ifdef PLUGINS + Plug_SBar (); +#endif + SCR_ShowPics_Draw(); + } + else + SCR_DrawFPS (); + SCR_CheckDrawCenterString (); +// qglTexEnvi ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); +#ifdef TEXTEDITOR + if (editoractive) + Editor_Draw(); +#endif + M_Draw (uimenu); + SCR_DrawConsole (false); + } + + RSpeedEnd(RSPEED_2D); +} diff --git a/engine/client/cl_tent.c b/engine/client/cl_tent.c index 33364a45d..251219d8f 100644 --- a/engine/client/cl_tent.c +++ b/engine/client/cl_tent.c @@ -1837,7 +1837,7 @@ void CL_UpdateBeams (void) continue; // if coming from the player, update the start position - if (b->flags & 1 && b->entity == cl.playernum[0]+1) // entity 0 is the world + if (b->flags & 1 && b->entity == (autocam[0]?spec_track[0]:(cl.playernum[0]+1))) // entity 0 is the world { // VectorSubtract(cl.simorg, b->start, org); // VectorAdd(b->end, org, b->end); //move the end point by simorg-start diff --git a/engine/client/screen.h b/engine/client/screen.h index 39ae7004c..6efcd2b7c 100644 --- a/engine/client/screen.h +++ b/engine/client/screen.h @@ -75,12 +75,12 @@ void SCR_DrawNotifyString (void); void SCR_CheckDrawCenterString (void); void SCR_DrawRam (void); void SCR_DrawNet (void); -void SCR_DrawFPS (void); -void SCR_DrawUPS (void); void SCR_DrawTurtle (void); void SCR_DrawPause (void); void SCR_VRectForPlayer(vrect_t *vrect, int pnum); //returns a region for the player's view +void CLSCR_Init(void); //basically so I can register a few friendly cvars. + //TEI_SHOWLMP2 stuff void SCR_ShowPics_Draw(void); void SCR_ShowPic_Create(void); diff --git a/engine/client/skin.c b/engine/client/skin.c index 2d75a8b8b..ced9ab877 100644 --- a/engine/client/skin.c +++ b/engine/client/skin.c @@ -498,6 +498,14 @@ void Skin_NextDownload (void) } } +//called from a few places when some skin cheat is applied. +//flushes all player skins. +void Skin_FlushPlayers(void) +{ //wipe the skin info + int i; + for (i = 0; i < MAX_CLIENTS; i++) + cl.players[i].skin = NULL; +} /* ========== diff --git a/engine/client/snd_win.c b/engine/client/snd_win.c index 4cc9b3322..9c0403a5e 100644 --- a/engine/client/snd_win.c +++ b/engine/client/snd_win.c @@ -72,7 +72,7 @@ LPDIRECTSOUNDBUFFER pDSBuf, pDSPBuf; */ HINSTANCE hInstDS; -qboolean SNDDMA_InitDirect (soundcardinfo_t *sc); +sndinitstat SNDDMA_InitDirect (soundcardinfo_t *sc); qboolean SNDDMA_InitWav (soundcardinfo_t *sc); diff --git a/engine/client/view.c b/engine/client/view.c index efd2698c0..ee4d965ee 100644 --- a/engine/client/view.c +++ b/engine/client/view.c @@ -456,7 +456,7 @@ void V_cshift_f (void) cl.cshifts[CSHIFT_SERVER].destcolor[1] = atoi(Cmd_Argv(2)); cl.cshifts[CSHIFT_SERVER].destcolor[2] = atoi(Cmd_Argv(3)); cl.cshifts[CSHIFT_SERVER].percent = atoi(Cmd_Argv(4)); - + return; } cshift_empty.destcolor[0] = atoi(Cmd_Argv(1)); cshift_empty.destcolor[1] = atoi(Cmd_Argv(2)); diff --git a/engine/common/qvm.c b/engine/common/qvm.c index ad6747384..b303206ea 100644 --- a/engine/common/qvm.c +++ b/engine/common/qvm.c @@ -66,13 +66,16 @@ struct vm_s { }; - +typedef struct { + int (EXPORT_FN *func)(int, ...); +} engineexport_t; #ifdef _WIN32 #include "winquake.h" void *Sys_LoadDLL(const char *name, void **vmMain, int (EXPORT_FN *syscall)(int arg, ... )) { - void (*dllEntry)(int (EXPORT_FN *)(int arg,...)); + engineexport_t exp; + void (*dllEntry)(engineexport_t *); char dllname[MAX_OSPATH]; HINSTANCE hVM; @@ -108,7 +111,8 @@ void *Sys_LoadDLL(const char *name, void **vmMain, int (EXPORT_FN *syscall)(int return NULL; } - dllEntry(syscall); + exp.func = syscall; + dllEntry(&exp); *vmMain=(void *)GetProcAddress(hVM, "vmMain"); if(!*vmMain) @@ -135,7 +139,8 @@ void Sys_UnloadDLL(void *handle) #include void *Sys_LoadDLL(const char *name, void **vmMain, int (EXPORT_FN *syscall)(int arg, ... )) { - void (*dllEntry)(int (EXPORT_FN *)(int arg,...)); + engineexport_t exp; + void (*dllEntry)(engineexport_t *); char dllname[MAX_OSPATH]; void *hVM; @@ -171,7 +176,8 @@ void *Sys_LoadDLL(const char *name, void **vmMain, int (EXPORT_FN *syscall)(int return NULL; } - dllEntry(syscall); + exp.func = syscall; + (*dllEntry)(&exp); *vmMain=(void *)dlsym(hVM, "vmMain"); if(!*vmMain) diff --git a/engine/gl/gl_screen.c b/engine/gl/gl_screen.c index 7a059cfe4..773b0f7ec 100644 --- a/engine/gl/gl_screen.c +++ b/engine/gl/gl_screen.c @@ -111,82 +111,6 @@ void RSpeedShow(void) } } -void SCR_DrawTwoDimensional(int uimenu, qboolean nohud) -{ - RSpeedMark(); - // - // draw any areas not covered by the refresh - // - if (!nohud) - SCR_TileClear (); - - if (r_netgraph.value) - GLR_NetGraph (); - - if (scr_drawdialog) - { -#ifdef PLUGINS - if (!nohud) - Plug_SBar (); -#endif - SCR_ShowPics_Draw(); - Draw_FadeScreen (); - SCR_DrawNotifyString (); - scr_copyeverything = true; - } - else if (scr_drawloading) - { - SCR_DrawLoading (); -#ifdef PLUGINS - Plug_SBar (); -#endif - SCR_ShowPics_Draw(); - } - else if (cl.intermission == 1 && key_dest == key_game) - { - Sbar_IntermissionOverlay (); - M_Draw (uimenu); - } - else if (cl.intermission == 2 && key_dest == key_game) - { - Sbar_FinaleOverlay (); - SCR_CheckDrawCenterString (); - } - else if (cl.intermission == 3 && key_dest == key_game) - { - } - else - { - if (!nohud) - { - Draw_Crosshair(); - - SCR_DrawRam (); - SCR_DrawNet (); - SCR_DrawFPS (); - SCR_DrawUPS (); - SCR_DrawTurtle (); - SCR_DrawPause (); -#ifdef PLUGINS - Plug_SBar (); -#endif - SCR_ShowPics_Draw(); - } - else - SCR_DrawFPS (); - SCR_CheckDrawCenterString (); - qglTexEnvi ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); -#ifdef TEXTEDITOR - if (editoractive) - Editor_Draw(); -#endif - M_Draw (uimenu); - SCR_DrawConsole (false); - } - - RSpeedEnd(RSPEED_2D); -} - /* ================== SCR_UpdateScreen