Cleanups, wine fixes, generic stuff, added makefile directive for use of gccs -combine option.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3753 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2011-03-12 13:51:40 +00:00
parent 2ae63321f7
commit fcb7dbd04b
31 changed files with 339 additions and 559 deletions

View file

@ -195,7 +195,20 @@ PROFILE_DIR=$(BASE_DIR)/profile
ALL_CFLAGS=$(HAVECONFIG) $(CFLAGS) $(BASE_CFLAGS) $(WCFLAGS) ALL_CFLAGS=$(HAVECONFIG) $(CFLAGS) $(BASE_CFLAGS) $(WCFLAGS)
DO_CC=@echo $< && $(CC) $(ALL_CFLAGS) -o $@ -c $< #cheap compile-everything-in-one-unit (compile becomes preprocess only)
ifneq ($(WPO),)
LTO_CC= -E
LTO_LD= -combine -fwhole-program -x c
LTO_END=ltoxnone
LTO_START=ltoxc
endif
#proper/consistant link-time optimisations (requires gcc 4.5+ or so)
ifneq ($(LTO),)
LTO_CC=-flto
LTO_LD=-flto
endif
DO_CC=@echo $< && $(CC) $(LTO_CC) $(ALL_CFLAGS) -o $@ -c $<
ifeq ($(FTE_TARGET),vc) ifeq ($(FTE_TARGET),vc)
BASELDFLAGS= BASELDFLAGS=
@ -536,7 +549,7 @@ ifeq ($(FTE_TARGET),win32_SDL)
LIBS_DIR=./libs/ LIBS_DIR=./libs/
#the defaults for sdl come first #the defaults for sdl come first
GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o resources.o GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(LTO_END) resources.o $(LTO_START)
GL_EXE_NAME=../fteqw_sdl_gl.exe GL_EXE_NAME=../fteqw_sdl_gl.exe
GLCL_EXE_NAME=../fteqwcl_sdl.exe GLCL_EXE_NAME=../fteqwcl_sdl.exe
ifdef windir ifdef windir
@ -548,7 +561,7 @@ ifeq ($(FTE_TARGET),win32_SDL)
GLB_DIR=gl_mgw_sdl$(BITS) GLB_DIR=gl_mgw_sdl$(BITS)
GLCL_DIR=glcl_mgw_sdl$(BITS) GLCL_DIR=glcl_mgw_sdl$(BITS)
SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(WINDOWSSERVERONLY_OBJS) resources.o SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(WINDOWSSERVERONLY_OBJS) $(LTO_END) resources.o $(LTO_START)
SV_EXE_NAME=../fteqw_sdl_sv.exe SV_EXE_NAME=../fteqw_sdl_sv.exe
SV_CFLAGS=$(SERVER_ONLY_CFLAGS) -D_SDL SV_CFLAGS=$(SERVER_ONLY_CFLAGS) -D_SDL
SV_LDFLAGS=./libs/mingw-libs/libz.a -lm -lmingw32 -lws2_32 -lwinmm SV_LDFLAGS=./libs/mingw-libs/libz.a -lm -lmingw32 -lws2_32 -lwinmm
@ -558,7 +571,7 @@ ifeq ($(FTE_TARGET),win32_SDL)
MB_DIR=m_mgw_sdl$(BITS) MB_DIR=m_mgw_sdl$(BITS)
M_EXE_NAME=../fteqw_sdl.exe M_EXE_NAME=../fteqw_sdl.exe
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o resources.o MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(LTO_END) resources.o $(LTO_START)
M_CFLAGS=$(D3DCFLAGS) -D_MINGW_VFPRINTF -D_SDL -I./libs/ -I./libs/mingw-libs/ -I./libs/mingw-libs $(GLCFLAGS) `sdl-config --cflags` -D_MERGED_SDL -I./libs/dxsdk7/include/ M_CFLAGS=$(D3DCFLAGS) -D_MINGW_VFPRINTF -D_SDL -I./libs/ -I./libs/mingw-libs/ -I./libs/mingw-libs $(GLCFLAGS) `sdl-config --cflags` -D_MERGED_SDL -I./libs/dxsdk7/include/
M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS)
@ -569,7 +582,7 @@ ifeq ($(FTE_TARGET),win32_SDL)
M_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 ./libs/mingw-libs/libSDL.a ./libs/mingw-libs/libSDLmain.a -mwindows -ldxguid -lwinmm -lole32 $(MLDFLAGS) `sdl-config --libs` $(IMAGELDFLAGS) M_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 ./libs/mingw-libs/libSDL.a ./libs/mingw-libs/libSDLmain.a -mwindows -ldxguid -lwinmm -lole32 $(MLDFLAGS) `sdl-config --libs` $(IMAGELDFLAGS)
endif endif
D3DCL_OBJS=$(D3DQUAKE_OBJS) snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o resources.o $(D3DONLY_OBJS) D3DCL_OBJS=$(D3DQUAKE_OBJS) snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(D3DONLY_OBJS) $(LTO_END) resources.o $(LTO_START)
D3D_EXE_NAME=../fted3dqw.exe D3D_EXE_NAME=../fted3dqw.exe
D3DCL_EXE_NAME=../fted3dclqw.exe D3DCL_EXE_NAME=../fted3dclqw.exe
D3D_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 ./libs/mingw-libs/libSDL.a ./libs/mingw-libs/libSDLmain.a -mwindows -ldxguid -lwinmm -lole32 D3D_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 ./libs/mingw-libs/libSDL.a ./libs/mingw-libs/libSDLmain.a -mwindows -ldxguid -lwinmm -lole32
@ -582,7 +595,7 @@ ifeq ($(FTE_TARGET),win64_SDL)
LIBS_DIR=./libs/ LIBS_DIR=./libs/
#the defaults for sdl come first #the defaults for sdl come first
GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o resources.o GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(LTO_END) resources.o $(LTO_START)
GL_EXE_NAME=../fteqw_sdl_gl64.exe GL_EXE_NAME=../fteqw_sdl_gl64.exe
GLCL_EXE_NAME=../fteqwcl_sdl64.exe GLCL_EXE_NAME=../fteqwcl_sdl64.exe
ifdef windir ifdef windir
@ -594,7 +607,7 @@ ifeq ($(FTE_TARGET),win64_SDL)
GLB_DIR=gl_mgw_sdl$(BITS) GLB_DIR=gl_mgw_sdl$(BITS)
GLCL_DIR=glcl_mgw_sdl$(BITS) GLCL_DIR=glcl_mgw_sdl$(BITS)
SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(WINDOWSSERVERONLY_OBJS) resources.o SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(WINDOWSSERVERONLY_OBJS) $(LTO_END) resources.o $(LTO_START)
SV_EXE_NAME=../fteqw_sdl_sv64.exe SV_EXE_NAME=../fteqw_sdl_sv64.exe
SV_CFLAGS=$(SERVER_ONLY_CFLAGS) -D_SDL SV_CFLAGS=$(SERVER_ONLY_CFLAGS) -D_SDL
SV_LDFLAGS=./libs/mingw64-libs/libz.a -lm -lmingw32 -lws2_32 -lwinmm SV_LDFLAGS=./libs/mingw64-libs/libz.a -lm -lmingw32 -lws2_32 -lwinmm
@ -604,7 +617,7 @@ ifeq ($(FTE_TARGET),win64_SDL)
MB_DIR=m_mgw_sdl$(BITS) MB_DIR=m_mgw_sdl$(BITS)
M_EXE_NAME=../fteqw_sdl64.exe M_EXE_NAME=../fteqw_sdl64.exe
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o resources.o MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(LTO_END) resources.o $(LTO_START)
M_CFLAGS= $(D3DCFLAGS) -D_MINGW_VFPRINTF -D_SDL -I./libs/ -I./libs/mingw64-libs/ -I./libs/mingw64-libs $(GLCFLAGS) `sdl-config --cflags` -D_MERGED_SDL -I./libs/dxsdk7/include/ M_CFLAGS= $(D3DCFLAGS) -D_MINGW_VFPRINTF -D_SDL -I./libs/ -I./libs/mingw64-libs/ -I./libs/mingw64-libs $(GLCFLAGS) `sdl-config --cflags` -D_MERGED_SDL -I./libs/dxsdk7/include/
M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS)
@ -659,11 +672,11 @@ ifeq ($(FTE_TARGET),win32)
LIBS_DIR = $(BASE_DIR)/libs LIBS_DIR = $(BASE_DIR)/libs
SV_EXE_NAME=../fteqwsv.exe SV_EXE_NAME=../fteqwsv.exe
SV_LDFLAGS=$(LIBS_DIR)/mingw-libs/zlib.lib -lws2_32 -lwinmm SV_LDFLAGS=$(LIBS_DIR)/mingw-libs/zlib.lib -lws2_32 -lwinmm
SV_DIR=sv_mingw V_DIR=sv_mingw
SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(WINDOWSSERVERONLY_OBJS) fs_win32.o resources.o SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(WINDOWSSERVERONLY_OBJS) fs_win32.o $(LTO_END) resources.o $(LTO_START)
GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o resources.o GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o $(LTO_END) resources.o $(LTO_START)
GL_EXE_NAME=../fteglqw.exe GL_EXE_NAME=../fteglqw.exe
GLCL_EXE_NAME=../fteglqwcl.exe GLCL_EXE_NAME=../fteglqwcl.exe
GL_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 GL_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32
@ -671,7 +684,7 @@ ifeq ($(FTE_TARGET),win32)
GLB_DIR=gl_mgw GLB_DIR=gl_mgw
GLCL_DIR=glcl_mgw GLCL_DIR=glcl_mgw
NPQTVCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o npplug.o sys_npqtv.o sys_plugfte.o ../../ftequake/npapi.def NPQTVCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o sys_npqtv.o sys_plugfte.o $(LTO_END) npplug.o ../../ftequake/npapi.def $(LTO_START)
NPQTV_DLL_NAME=../npqtv.dll NPQTV_DLL_NAME=../npqtv.dll
NPQTVCL_DLL_NAME=../npqtvcl.dll NPQTVCL_DLL_NAME=../npqtvcl.dll
NPQTV_LDFLAGS=--enable-stdcall-fixup $(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 -shared NPQTV_LDFLAGS=--enable-stdcall-fixup $(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 -shared
@ -679,7 +692,7 @@ ifeq ($(FTE_TARGET),win32)
NPQTVB_DIR=npqtv_mgw NPQTVB_DIR=npqtv_mgw
NPQTVCL_DIR=npqtvcl_mgw NPQTVCL_DIR=npqtvcl_mgw
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o resources.o MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o $(LTO_END) resources.o $(LTO_START)
M_EXE_NAME=../fteqw.exe M_EXE_NAME=../fteqw.exe
MCL_EXE_NAME=../fteqwcl.exe MCL_EXE_NAME=../fteqwcl.exe
M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32
@ -687,7 +700,7 @@ ifeq ($(FTE_TARGET),win32)
MB_DIR=m_mgw MB_DIR=m_mgw
MCL_DIR=mcl_mgw MCL_DIR=mcl_mgw
D3DCL_OBJS=$(D3DQUAKE_OBJS) snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o resources.o $(D3DONLY_OBJS) fs_win32.o D3DCL_OBJS=$(D3DQUAKE_OBJS) snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o $(D3DONLY_OBJS) fs_win32.o $(LTO_END) resources.o $(LTO_START)
D3D_EXE_NAME=../fted3dqw.exe D3D_EXE_NAME=../fted3dqw.exe
D3DCL_EXE_NAME=../fted3dclqw.exe D3DCL_EXE_NAME=../fted3dclqw.exe
D3D_LDFLAGS=$(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 D3D_LDFLAGS=$(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32
@ -714,10 +727,10 @@ ifeq ($(FTE_TARGET),win64)
SV_EXE_NAME=../fteqwsv64.exe SV_EXE_NAME=../fteqwsv64.exe
SV_LDFLAGS=$(LIBS_DIR)/mingw64-libs/libz.a -lws2_32 -lwinmm SV_LDFLAGS=$(LIBS_DIR)/mingw64-libs/libz.a -lws2_32 -lwinmm
SV_DIR=sv_mingw64 SV_DIR=sv_mingw64
SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(WINDOWSSERVERONLY_OBJS) fs_win32.o resources.o SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(WINDOWSSERVERONLY_OBJS) fs_win32.o $(LTO_END) resources.o $(LTO_START)
GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o resources.o GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o $(LTO_END) resources.o $(LTO_START)
GL_EXE_NAME=../fteglqw64.exe GL_EXE_NAME=../fteglqw64.exe
GLCL_EXE_NAME=../fteglqwcl64.exe GLCL_EXE_NAME=../fteglqwcl64.exe
GL_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 GL_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32
@ -725,7 +738,7 @@ ifeq ($(FTE_TARGET),win64)
GLB_DIR=gl_mgw64 GLB_DIR=gl_mgw64
GLCL_DIR=glcl_mgw64 GLCL_DIR=glcl_mgw64
NPQTVCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o npplug.o sys_npqtv.o sys_plugfte.o ../../ftequake/npapi.def NPQTVCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o sys_npqtv.o sys_plugfte.o $(LTO_END) npplug.o ../../ftequake/npapi.def $(LTO_START)
NPQTV_DLL_NAME=../npqtv64.dll NPQTV_DLL_NAME=../npqtv64.dll
NPQTVCL_DLL_NAME=../npqtvcl64.dll NPQTVCL_DLL_NAME=../npqtvcl64.dll
NPQTV_LDFLAGS=--enable-stdcall-fixup $(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 -shared NPQTV_LDFLAGS=--enable-stdcall-fixup $(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 -shared
@ -733,7 +746,7 @@ ifeq ($(FTE_TARGET),win64)
NPQTVB_DIR=npqtv_mgw64 NPQTVB_DIR=npqtv_mgw64
NPQTVCL_DIR=npqtvcl_mgw64 NPQTVCL_DIR=npqtvcl_mgw64
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o resources.o MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o $(LTO_END) resources.o $(LTO_START)
M_EXE_NAME=../fteqw64.exe M_EXE_NAME=../fteqw64.exe
MCL_EXE_NAME=../fteqwcl64.exe MCL_EXE_NAME=../fteqwcl64.exe
M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32
@ -741,7 +754,7 @@ ifeq ($(FTE_TARGET),win64)
MB_DIR=m_mgw64 MB_DIR=m_mgw64
MCL_DIR=mcl_mgw64 MCL_DIR=mcl_mgw64
D3DCL_OBJS=$(D3DQUAKE_OBJS) snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o resources.o $(D3DONLY_OBJS) fs_win32.o D3DCL_OBJS=$(D3DQUAKE_OBJS) snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o $(D3DONLY_OBJS) fs_win32.o $(LTO_END) resources.o $(LTO_START)
D3D_EXE_NAME=../fted3dqw64.exe D3D_EXE_NAME=../fted3dqw64.exe
D3DCL_EXE_NAME=../fted3dclqw64.exe D3DCL_EXE_NAME=../fted3dclqw64.exe
D3D_LDFLAGS=$(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 D3D_LDFLAGS=$(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32
@ -986,9 +999,9 @@ PRECOMPHEADERS ?= $(OUT_DIR)/quakedef.h.gch
#god knows how gcc loads the list properly. #god knows how gcc loads the list properly.
#or at least I hope he does. It makes no sence to mortals. #or at least I hope he does. It makes no sence to mortals.
DO_LD ?= $(CC) -o $@ $(WCFLAGS) $(CFLAGS) DO_LD ?= $(CC) -o $@ $(LTO_LD) $(WCFLAGS) $(CFLAGS)
$(OUT_DIR)/$(EXE_NAME): $(PRECOMPHEADERS) $(addprefix $(OUT_DIR)/, $(CUSTOMOBJS) $(foreach ol, $(OBJS), $($(ol)))) $(OUT_DIR)/$(EXE_NAME): $(PRECOMPHEADERS) $(foreach fn, $(CUSTOMOBJS) $(foreach ol, $(OBJS), $($(ol))),$(if $(findstring ltox,$(fn)),,$(OUT_DIR)/$(fn)))
$(DO_LD) $(addprefix $(OUT_DIR)/, $(CUSTOMOBJS) $(foreach ol, $(OBJS), $($(ol)))) $(LDFLAGS) $(DO_LD) $(foreach fn, $(CUSTOMOBJS) $(foreach ol, $(OBJS) $(LTO_END), $($(ol))),$(if $(findstring ltox,$(fn)),$(subst ltox,-x ,$(fn)),$(OUT_DIR)/$(fn)) ) -x none $(LDFLAGS)
_out-rel: _out-rel:
$(MAKE) $(OUT_DIR)/$(EXE_NAME) EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" WCFLAGS="$(WCFLAGS) $(RELEASE_CFLAGS)" LDFLAGS="$(BASELDFLAGS) $(LDFLAGS) $(RELEASE_LDFLAGS)" OBJS="$(OBJS)" $(MAKE) $(OUT_DIR)/$(EXE_NAME) EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" WCFLAGS="$(WCFLAGS) $(RELEASE_CFLAGS)" LDFLAGS="$(BASELDFLAGS) $(LDFLAGS) $(RELEASE_LDFLAGS)" OBJS="$(OBJS)"

View file

@ -2244,7 +2244,6 @@ static struct
}; };
int image_width, image_height; int image_width, image_height;
qbyte *COM_LoadFile (char *path, int usehunk);
//fixme: should probably get rid of the 'Mod' prefix, and use something more suitable. //fixme: should probably get rid of the 'Mod' prefix, and use something more suitable.
texid_t R_LoadHiResTexture(char *name, char *subpath, unsigned int flags) texid_t R_LoadHiResTexture(char *name, char *subpath, unsigned int flags)
{ {

View file

@ -63,8 +63,6 @@ cvar_t m_threshold_noforce = SCVAR("m_threshold_noforce", "0");
cvar_t cl_keypad = SCVAR("cl_keypad", "0"); cvar_t cl_keypad = SCVAR("cl_keypad", "0");
extern cvar_t cl_forcesplitclient; extern cvar_t cl_forcesplitclient;
qboolean Key_MouseShouldBeFree(void);
typedef struct { typedef struct {
union { union {
HANDLE rawinputhandle; HANDLE rawinputhandle;

View file

@ -30,7 +30,7 @@ void Editor_Key(int key, int unicode);
#define KEY_MODIFIERSTATES 8 #define KEY_MODIFIERSTATES 8
#define MAXCMDLINE 256 #define MAXCMDLINE 256
char key_lines[32][MAXCMDLINE]; unsigned char key_lines[32][MAXCMDLINE];
int key_linepos; int key_linepos;
int shift_down=false; int shift_down=false;
int key_lastpress; int key_lastpress;

View file

@ -19,8 +19,6 @@ typedef struct {
char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1]; char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
int loadable[MAX_SAVEGAMES]; int loadable[MAX_SAVEGAMES];
menubutton_t *VARGS MC_AddConsoleCommandf(menu_t *menu, int x, int y, char *text, char *command, ...);
void M_ScanSaves (void) void M_ScanSaves (void)
{ {
int i, j; int i, j;

View file

@ -296,6 +296,7 @@ menubutton_t *MC_AddConsoleCommand(menu_t *menu, int x, int y, const char *text,
menubutton_t *MC_AddConsoleCommandQBigFont(menu_t *menu, int x, int y, const char *text, const char *command); menubutton_t *MC_AddConsoleCommandQBigFont(menu_t *menu, int x, int y, const char *text, const char *command);
mpic_t *QBigFontWorks(void); mpic_t *QBigFontWorks(void);
menubutton_t *MC_AddConsoleCommandHexen2BigFont(menu_t *menu, int x, int y, const char *text, const char *command); menubutton_t *MC_AddConsoleCommandHexen2BigFont(menu_t *menu, int x, int y, const char *text, const char *command);
menubutton_t *VARGS MC_AddConsoleCommandf(menu_t *menu, int x, int y, const char *text, char *command, ...);
menubutton_t *MC_AddCommand(menu_t *menu, int x, int y, char *text, qboolean (*command) (union menuoption_s *,struct menu_s *,int)); menubutton_t *MC_AddCommand(menu_t *menu, int x, int y, char *text, qboolean (*command) (union menuoption_s *,struct menu_s *,int));
menucombo_t *MC_AddCombo(menu_t *menu, int x, int y, const char *caption, const char **text, int initialvalue); menucombo_t *MC_AddCombo(menu_t *menu, int x, int y, const char *caption, const char **text, int initialvalue);
menubutton_t *MC_AddCommand(menu_t *menu, int x, int y, char *text, qboolean (*command) (union menuoption_s *,struct menu_s *,int)); menubutton_t *MC_AddCommand(menu_t *menu, int x, int y, char *text, qboolean (*command) (union menuoption_s *,struct menu_s *,int));

View file

@ -6,11 +6,12 @@
texid_t missing_texture; texid_t missing_texture;
static mpic_t *conback; static mpic_t *conback;
static mpic_t *draw_backtile; static mpic_t *draw_backtile;
static mpic_t *draw_fill, *draw_fill_trans; static shader_t *shader_draw_fill, *shader_draw_fill_trans;
mpic_t *draw_disc; mpic_t *draw_disc;
shader_t *shader_brighten; shader_t *shader_brighten;
shader_t *shader_polyblend; shader_t *shader_polyblend;
shader_t *shader_menutint;
static mesh_t draw_mesh; static mesh_t draw_mesh;
static vecV_t draw_mesh_xyz[4]; static vecV_t draw_mesh_xyz[4];
@ -91,14 +92,14 @@ void R2D_Init(void)
if (!draw_backtile) if (!draw_backtile)
draw_backtile = Draw_SafeCachePic ("gfx/menu/backtile.lmp"); draw_backtile = Draw_SafeCachePic ("gfx/menu/backtile.lmp");
draw_fill = R_RegisterShader("fill_opaque", shader_draw_fill = R_RegisterShader("fill_opaque",
"{\n" "{\n"
"{\n" "{\n"
"map $whiteimage\n" "map $whiteimage\n"
"rgbgen vertex\n" "rgbgen vertex\n"
"}\n" "}\n"
"}\n"); "}\n");
draw_fill_trans = R_RegisterShader("fill_trans", shader_draw_fill_trans = R_RegisterShader("fill_trans",
"{\n" "{\n"
"{\n" "{\n"
"map $whiteimage\n" "map $whiteimage\n"
@ -127,6 +128,60 @@ void R2D_Init(void)
"}\n" "}\n"
"}\n" "}\n"
); );
shader_menutint = R_RegisterShader("menutint_glsl",
"{\n"
"if $glsl && gl_menutint_shader != 0\n"
"[\n"
"glslprogram\n"
"{\n"
"#ifdef VERTEX_SHADER\n"
"\
varying vec2 texcoord;\
uniform vec3 rendertexturescale;\
void main(void)\
{\
texcoord.x = gl_MultiTexCoord0.x*rendertexturescale.x;\
texcoord.y = (1-gl_MultiTexCoord0.y)*rendertexturescale.y;\
gl_Position = ftransform();\
}\
\n"
"#endif\n"
"#ifdef FRAGMENT_SHADER\n"
"\
varying vec2 texcoord;\
uniform vec3 colorparam;\
uniform sampler2D source;\
uniform int invert;\
const vec3 lumfactors = vec3(0.299, 0.587, 0.114);\
const vec3 invertvec = vec3(1.0, 1.0, 1.0);\
void main(void)\
{\
vec3 texcolor = texture2D(source, texcoord).rgb;\
float luminance = dot(lumfactors, texcolor);\
texcolor = vec3(luminance, luminance, luminance);\
texcolor *= colorparam;\
texcolor = (invert > 0) ? (invertvec - texcolor) : texcolor;\
gl_FragColor = vec4(texcolor, 1.0);\
}\n"
"#endif\n"
"}\n"
"param cvari r_menutint_inverse invert\n"
"param cvar3f r_menutint colorparam\n"
"param texture 0 source\n"
"param rendertexturescale rendertexturescale\n"
"{\n"
"map $currentrender\n"
"}\n"
"][\n"
"{\n"
"map $whitetexture\n"
"blendfunc gl_dst_color gl_zero\n"
"rgbgen const $r_menutint\n"
"}\n"
"]\n"
"}\n"
);
Cvar_Hook(&gl_font, R2D_Font_Callback); Cvar_Hook(&gl_font, R2D_Font_Callback);
Cvar_Hook(&vid_conautoscale, R2D_Conautoscale_Callback); Cvar_Hook(&vid_conautoscale, R2D_Conautoscale_Callback);
@ -234,9 +289,9 @@ void R2D_FillBlock(int x, int y, int w, int h)
draw_mesh_xyz[3][1] = y+h; draw_mesh_xyz[3][1] = y+h;
if (draw_mesh_colors[0][3] != 1) if (draw_mesh_colors[0][3] != 1)
BE_DrawMesh_Single(draw_fill_trans, &draw_mesh, NULL, &draw_fill_trans->defaulttextures); BE_DrawMesh_Single(shader_draw_fill_trans, &draw_mesh, NULL, &shader_draw_fill_trans->defaulttextures);
else else
BE_DrawMesh_Single(draw_fill, &draw_mesh, NULL, &draw_fill->defaulttextures); BE_DrawMesh_Single(shader_draw_fill, &draw_mesh, NULL, &shader_draw_fill->defaulttextures);
} }
void R2D_ScalePic (int x, int y, int width, int height, mpic_t *pic) void R2D_ScalePic (int x, int y, int width, int height, mpic_t *pic)
@ -567,4 +622,13 @@ void R2D_BrightenScreen (void)
RSpeedEnd(RSPEED_PALETTEFLASHES); RSpeedEnd(RSPEED_PALETTEFLASHES);
} }
//for menus
void R2D_FadeScreen (void)
{
R2D_ScalePic(0, 0, vid.width, vid.height, shader_menutint);
Sbar_Changed();
}
#endif #endif

View file

@ -74,8 +74,6 @@ int OV_DecodeSome(sfx_t *s, int minlength);
void OV_CancelDecoder(sfx_t *s); void OV_CancelDecoder(sfx_t *s);
qboolean OV_StartDecode(unsigned char *start, unsigned long length, ovdecoderbuffer_t *buffer); qboolean OV_StartDecode(unsigned char *start, unsigned long length, ovdecoderbuffer_t *buffer);
qbyte *COM_LoadFile (char *path, int usehunk);
sfxcache_t *S_LoadOVSound (sfx_t *s, qbyte *data, int datalen, int sndspeed) sfxcache_t *S_LoadOVSound (sfx_t *s, qbyte *data, int datalen, int sndspeed)
{ {
//char namebuffer[MAX_OSPATH]; //unreferenced //char namebuffer[MAX_OSPATH]; //unreferenced

View file

@ -101,8 +101,6 @@ extern cvar_t cl_chasecam;
float v_dmg_time[MAX_SPLITS], v_dmg_roll[MAX_SPLITS], v_dmg_pitch[MAX_SPLITS]; float v_dmg_time[MAX_SPLITS], v_dmg_roll[MAX_SPLITS], v_dmg_pitch[MAX_SPLITS];
extern int in_forward, in_forward2, in_back;
frame_t *view_frame; frame_t *view_frame;
player_state_t *view_message; player_state_t *view_message;

View file

@ -65,7 +65,6 @@ void W_CleanupName (const char *in, char *out)
W_LoadWadFile W_LoadWadFile
==================== ====================
*/ */
qbyte *COM_LoadFile (char *path, int usehunk);
void W_LoadWadFile (char *filename) void W_LoadWadFile (char *filename)
{ {
lumpinfo_t *lump_p; lumpinfo_t *lump_p;

View file

@ -396,6 +396,8 @@ qbyte *FS_LoadMallocFile (const char *path);
int FS_LoadFile(char *name, void **file); int FS_LoadFile(char *name, void **file);
void FS_FreeFile(void *file); void FS_FreeFile(void *file);
qbyte *COM_LoadFile (const char *path, int usehunk);
qboolean COM_LoadMapPackFile(const char *name, int offset); qboolean COM_LoadMapPackFile(const char *name, int offset);
void COM_FlushTempoaryPacks(void); void COM_FlushTempoaryPacks(void);

View file

@ -8,6 +8,7 @@
#include <errno.h> #include <errno.h>
#include "fs.h" #include "fs.h"
#include "shader.h"
#if defined(MINGW) && defined(_SDL) #if defined(MINGW) && defined(_SDL)
#include "./mingw-libs/SDL_syswm.h" // mingw sdl cross binary complains off sys_parentwindow #include "./mingw-libs/SDL_syswm.h" // mingw sdl cross binary complains off sys_parentwindow
@ -1633,10 +1634,7 @@ void COM_Gamedir (const char *dir)
} }
} }
{
extern void Shader_Init(void);
Shader_Init(); //FIXME! Shader_Init(); //FIXME!
}
COM_Effectinfo_Clear(); COM_Effectinfo_Clear();

View file

@ -20,8 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h" #include "quakedef.h"
extern float pm_stepheight;
movevars_t movevars; movevars_t movevars;
playermove_t pmove; playermove_t pmove;

View file

@ -267,7 +267,6 @@ void QCBUILTIN PF_buf_cvarlist (progfuncs_t *prinst, struct globalvars_s *pr_gl
void QCBUILTIN PF_whichpack (progfuncs_t *prinst, struct globalvars_s *pr_globals); void QCBUILTIN PF_whichpack (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_fclose_progs (progfuncs_t *prinst); void PF_fclose_progs (progfuncs_t *prinst);
char *PF_VarString (progfuncs_t *prinst, int first, struct globalvars_s *pr_globals);
int QCEditor (progfuncs_t *prinst, char *filename, int line, int nump, char **parms); int QCEditor (progfuncs_t *prinst, char *filename, int line, int nump, char **parms);
void PF_Common_RegisterCvars(void); void PF_Common_RegisterCvars(void);

View file

@ -175,6 +175,42 @@ enum
}; };
IDirect3DVertexDeclaration9 *vertexdecls[D3D_VDEC_MAX]; IDirect3DVertexDeclaration9 *vertexdecls[D3D_VDEC_MAX];
static void BE_ApplyTMUState(unsigned int tu, unsigned int flags)
{
if ((flags ^ shaderstate.tmuflags[tu]) & SHADER_PASS_CLAMP)
{
shaderstate.tmuflags[tu] ^= SHADER_PASS_CLAMP;
if (flags & SHADER_PASS_CLAMP)
{
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_ADDRESSW, D3DTADDRESS_CLAMP);
}
else
{
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP);
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP);
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_ADDRESSW, D3DTADDRESS_WRAP);
}
}
if ((flags ^ shaderstate.tmuflags[tu]) & SHADER_PASS_NOMIPMAP)
{
shaderstate.tmuflags[tu] ^= SHADER_PASS_NOMIPMAP;
/*lightmaps don't use mipmaps*/
if (flags & SHADER_PASS_NOMIPMAP)
{
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
}
else
{
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
}
}
}
void D3DBE_Reset(qboolean before) void D3DBE_Reset(qboolean before)
{ {
@ -289,42 +325,11 @@ void D3DBE_Reset(qboolean before)
IDirect3DDevice9_CreateVertexBuffer(pD3DDev9, shaderstate.dynst_size, D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &shaderstate.dynst_buff[tmu], NULL); IDirect3DDevice9_CreateVertexBuffer(pD3DDev9, shaderstate.dynst_size, D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &shaderstate.dynst_buff[tmu], NULL);
IDirect3DDevice9_CreateVertexBuffer(pD3DDev9, shaderstate.dyncol_size, D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &shaderstate.dyncol_buff, NULL); IDirect3DDevice9_CreateVertexBuffer(pD3DDev9, shaderstate.dyncol_size, D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &shaderstate.dyncol_buff, NULL);
IDirect3DDevice9_CreateIndexBuffer(pD3DDev9, shaderstate.dynidx_size, D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, D3DFMT_QINDEX, D3DPOOL_DEFAULT, &shaderstate.dynidx_buff, NULL); IDirect3DDevice9_CreateIndexBuffer(pD3DDev9, shaderstate.dynidx_size, D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, D3DFMT_QINDEX, D3DPOOL_DEFAULT, &shaderstate.dynidx_buff, NULL);
}
}
static void BE_ApplyTMUState(unsigned int tu, unsigned int flags) for (i = 0; i < MAX_TMUS; i++)
{ {
if ((flags ^ shaderstate.tmuflags[tu]) & SHADER_PASS_CLAMP) shaderstate.tmuflags[i] = ~0;
{ BE_ApplyTMUState(i, 0);
shaderstate.tmuflags[tu] ^= SHADER_PASS_CLAMP;
if (flags & SHADER_PASS_CLAMP)
{
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_ADDRESSW, D3DTADDRESS_CLAMP);
}
else
{
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP);
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP);
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_ADDRESSW, D3DTADDRESS_WRAP);
}
}
if ((flags ^ shaderstate.tmuflags[tu]) & SHADER_PASS_NOMIPMAP)
{
shaderstate.tmuflags[tu] ^= SHADER_PASS_NOMIPMAP;
/*lightmaps don't use mipmaps*/
if (flags & SHADER_PASS_NOMIPMAP)
{
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
}
else
{
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
IDirect3DDevice9_SetSamplerState(pD3DDev9, tu, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
} }
} }
} }
@ -479,11 +484,6 @@ void D3DBE_Init(void)
shaderstate.shaderbits = ~0; shaderstate.shaderbits = ~0;
D3DBE_ApplyShaderBits(0); D3DBE_ApplyShaderBits(0);
for (i = 0; i < MAX_TMUS; i++)
{
shaderstate.tmuflags[i] = ~0;
BE_ApplyTMUState(i, 0);
}
} }
static void allocvertexbuffer(IDirect3DVertexBuffer9 *buff, unsigned int bmaxsize, unsigned int *offset, void **data, unsigned int bytes) static void allocvertexbuffer(IDirect3DVertexBuffer9 *buff, unsigned int bmaxsize, unsigned int *offset, void **data, unsigned int bytes)
@ -665,11 +665,19 @@ static void SelectPassTexture(unsigned int tu, shaderpass_t *pass)
if (tu == 0) if (tu == 0)
{ {
if (shaderstate.passsinglecolour) if (shaderstate.passsinglecolour)
{
if (shaderstate.passcolour == D3DCOLOR_RGBA(255,255,255,255))
{
IDirect3DDevice9_SetTextureStageState(pD3DDev9, tu, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, tu, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
}
else
{ {
IDirect3DDevice9_SetTextureStageState(pD3DDev9, tu, D3DTSS_COLORARG2, D3DTA_CONSTANT); IDirect3DDevice9_SetTextureStageState(pD3DDev9, tu, D3DTSS_COLORARG2, D3DTA_CONSTANT);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, tu, D3DTSS_ALPHAARG2, D3DTA_CONSTANT); IDirect3DDevice9_SetTextureStageState(pD3DDev9, tu, D3DTSS_ALPHAARG2, D3DTA_CONSTANT);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, tu, D3DTSS_CONSTANT, shaderstate.passcolour); IDirect3DDevice9_SetTextureStageState(pD3DDev9, tu, D3DTSS_CONSTANT, shaderstate.passcolour);
} }
}
else else
{ {
IDirect3DDevice9_SetTextureStageState(pD3DDev9, tu, D3DTSS_COLORARG2, D3DTA_DIFFUSE); IDirect3DDevice9_SetTextureStageState(pD3DDev9, tu, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
@ -736,11 +744,10 @@ static void colourgenbyte(const shaderpass_t *pass, int cnt, const byte_vec4_t *
break; break;
case RGB_GEN_IDENTITY_LIGHTING: case RGB_GEN_IDENTITY_LIGHTING:
//compensate for overbrights //compensate for overbrights
block = D3DCOLOR_RGBA(255, 255, 255, 255); //shaderstate.identitylighting
while((cnt)--) while((cnt)--)
{ {
dst[cnt][0] = 255;//shaderstate.identitylighting; ((D3DCOLOR*)dst)[cnt] = block;
dst[cnt][1] = 255;//shaderstate.identitylighting;
dst[cnt][2] = 255;//shaderstate.identitylighting;
} }
break; break;
default: default:

View file

@ -103,6 +103,29 @@ static void D3D9_RoundDimensions(int *scaled_width, int *scaled_height, qboolean
*scaled_height = 1; *scaled_height = 1;
} }
#if 0
static void D3D_MipMap (qbyte *out, int outwidth, int outheight, qbyte *in, int inwidth, int inheight)
{
int i, j;
qbyte *inrow;
//with npot
int rowwidth = inwidth*4; //rowwidth is the byte width of the input
inrow = in;
for (i=0 ; i<outheight ; i++, inrow+=rowwidth*2)
{
for (in = inrow, j=0 ; j<outwidth ; j++, out+=4, in+=8)
{
out[0] = (in[0] + in[4] + in[rowwidth+0] + in[rowwidth+4])>>2;
out[1] = (in[1] + in[5] + in[rowwidth+1] + in[rowwidth+5])>>2;
out[2] = (in[2] + in[6] + in[rowwidth+2] + in[rowwidth+6])>>2;
out[3] = (in[3] + in[7] + in[rowwidth+3] + in[rowwidth+7])>>2;
}
}
}
#endif
static void Upload_Texture_32(LPDIRECT3DTEXTURE9 tex, unsigned int *data, int width, int height, unsigned int flags) static void Upload_Texture_32(LPDIRECT3DTEXTURE9 tex, unsigned int *data, int width, int height, unsigned int flags)
{ {
int x, y; int x, y;
@ -110,19 +133,14 @@ static void Upload_Texture_32(LPDIRECT3DTEXTURE9 tex, unsigned int *data, int wi
unsigned char swapbuf[4]; unsigned char swapbuf[4];
unsigned char swapbuf2[4]; unsigned char swapbuf2[4];
D3DLOCKED_RECT lock; D3DLOCKED_RECT lock;
int i;
D3DSURFACE_DESC desc; D3DSURFACE_DESC desc;
IDirect3DTexture9_GetLevelDesc(tex, 0, &desc); IDirect3DTexture9_GetLevelDesc(tex, 0, &desc);
IDirect3DTexture9_LockRect(tex, 0, &lock, NULL, D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY); IDirect3DTexture9_LockRect(tex, 0, &lock, NULL, D3DLOCK_NOSYSLOCK|D3DLOCK_DISCARD);
if (width == desc.Width && height == desc.Height) if (width == desc.Width && height == desc.Height)
{
// if (desc.lPitch == twidth*4)
// {
// memcpy(desc.lpSurface, data, width*height*4);
// }
// else
{ {
for (y = 0; y < height; y++) for (y = 0; y < height; y++)
{ {
@ -137,7 +155,6 @@ static void Upload_Texture_32(LPDIRECT3DTEXTURE9 tex, unsigned int *data, int wi
data += width; data += width;
} }
} }
}
else else
{ {
int x, y; int x, y;
@ -157,17 +174,27 @@ static void Upload_Texture_32(LPDIRECT3DTEXTURE9 tex, unsigned int *data, int wi
row[x] = *(unsigned int*)swapbuf; row[x] = *(unsigned int*)swapbuf;
} }
} }
//mimic opengl and draw it white
// memset(desc.lpSurface, 255, twidth*theight*4);
} }
IDirect3DTexture9_UnlockRect(tex, 0); #if 0 //D3DUSAGE_AUTOGENMIPMAP so this isn't needed
if (!(flags & IF_NOMIPMAP)) if (!(flags & IF_NOMIPMAP))
IDirect3DBaseTexture9_GenerateMipSubLevels(tex); {
int max = IDirect3DTexture9_GetLevelCount(tex);
for (i = 1; i < max; i++)
{
width = desc.Width;
height = desc.Height;
data = lock.pBits;
IDirect3DTexture9_LockRect(tex, i, &lock, NULL, D3DLOCK_NOSYSLOCK|D3DLOCK_DISCARD);
IDirect3DTexture9_GetLevelDesc(tex, i, &desc);
D3D_MipMap(lock.pBits, desc.Width, desc.Height, data, width, height);
IDirect3DTexture9_UnlockRect(tex, i-1);
}
IDirect3DTexture9_UnlockRect(tex, i-1);
}
else
#endif
IDirect3DTexture9_UnlockRect(tex, 0);
} }
//create a basic shader from a 32bit image //create a basic shader from a 32bit image
@ -190,7 +217,7 @@ static LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_32(d3dtexture_t *tex, unsigned in
newsurf = tex->tex.ptr; newsurf = tex->tex.ptr;
if (!newsurf) if (!newsurf)
IDirect3DDevice9_CreateTexture(pD3DDev9, nwidth, nheight, 0, ((flags & IF_NOMIPMAP)?0:D3DUSAGE_AUTOGENMIPMAP), D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &newsurf, NULL); IDirect3DDevice9_CreateTexture(pD3DDev9, nwidth, nheight, (flags & IF_NOMIPMAP)?1:0, ((flags & IF_NOMIPMAP)?0:D3DUSAGE_AUTOGENMIPMAP), D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &newsurf, NULL);
if (!newsurf) if (!newsurf)
return NULL; return NULL;

View file

@ -604,7 +604,7 @@ static void initD3D9(HWND hWnd, rendererstate_t *info)
numadaptors = IDirect3D9_GetAdapterCount(pD3D); numadaptors = IDirect3D9_GetAdapterCount(pD3D);
for (i = 0; i < numadaptors; i++) for (i = 0; i < numadaptors; i++)
{ //try each adaptor in turn until we get one that actually works { //NVIDIA's debug app requires that we use a specific device
memset(&inf, 0, sizeof(inf)); memset(&inf, 0, sizeof(inf));
err = IDirect3D9_GetAdapterIdentifier(pD3D, i, 0, &inf); err = IDirect3D9_GetAdapterIdentifier(pD3D, i, 0, &inf);
if (strstr(inf.Description, "PerfHUD")) if (strstr(inf.Description, "PerfHUD"))
@ -681,8 +681,6 @@ static qboolean D3D9_VID_Init(rendererstate_t *info, unsigned char *palette)
} }
ShowWindow(mainwindow, SW_NORMAL); ShowWindow(mainwindow, SW_NORMAL);
//IDirect3DDevice9_Clear(pD3DDev9, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 1, 0);
//IDirect3DDevice9_Present(pD3DDev9, NULL, NULL, NULL, NULL);
IDirect3DDevice9_Clear(pD3DDev9, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); IDirect3DDevice9_Clear(pD3DDev9, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
IDirect3DDevice9_BeginScene(pD3DDev9); IDirect3DDevice9_BeginScene(pD3DDev9);
@ -701,9 +699,6 @@ static qboolean D3D9_VID_Init(rendererstate_t *info, unsigned char *palette)
vid_initializing = false; vid_initializing = false;
//IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRENDERSTATE_DITHERENABLE, FALSE);
//IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRENDERSTATE_SPECULARENABLE, FALSE);
//IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRENDERSTATE_TEXTUREPERSPECTIVE, TRUE);
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_LIGHTING, FALSE); IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_LIGHTING, FALSE);
GetWindowRect(mainwindow, &window_rect); GetWindowRect(mainwindow, &window_rect);
@ -1043,9 +1038,6 @@ static void (D3D9_Draw_Fill) (int x, int y, int w, int h, unsigned int c)
static void (D3D9_Draw_FillRGB) (int x, int y, int w, int h, float r, float g, float b) static void (D3D9_Draw_FillRGB) (int x, int y, int w, int h, float r, float g, float b)
{ {
} }
static void (D3D9_Draw_FadeScreen) (void)
{
}
static void (D3D9_Draw_BeginDisc) (void); static void (D3D9_Draw_BeginDisc) (void);
static void (D3D9_Draw_EndDisc) (void); static void (D3D9_Draw_EndDisc) (void);
@ -1186,7 +1178,7 @@ rendererinfo_t d3drendererinfo =
R2D_TileClear, R2D_TileClear,
D3D9_Draw_Fill, D3D9_Draw_Fill,
D3D9_Draw_FillRGB, D3D9_Draw_FillRGB,
D3D9_Draw_FadeScreen, R2D_FadeScreen,
D3D9_Draw_BeginDisc, D3D9_Draw_BeginDisc,
D3D9_Draw_EndDisc, D3D9_Draw_EndDisc,

View file

@ -48,15 +48,6 @@ void GLMod_FloodFillSkin( qbyte *skin, int skinwidth, int skinheight );
extern char loadname[32]; // for hunk tags extern char loadname[32]; // for hunk tags
int numTempColours;
byte_vec4_t *tempColours;
int numTempVertexCoords;
vec3_t *tempVertexCoords;
int numTempNormals;
vec3_t *tempNormals;
extern cvar_t gl_ati_truform; extern cvar_t gl_ati_truform;
extern cvar_t r_vertexdlights; extern cvar_t r_vertexdlights;
extern cvar_t mod_md3flags; extern cvar_t mod_md3flags;

View file

@ -705,60 +705,6 @@ void GLDraw_Fill (int x, int y, int w, int h, unsigned int c)
} }
//============================================================================= //=============================================================================
/*
================
Draw_FadeScreen
================
*/
vec3_t fadecolor;
int faderender;
void GLR_Menutint_Callback (struct cvar_s *var, char *oldvalue)
{
// parse r_menutint and clear defaults
faderender = GL_DST_COLOR;
if (var->string[0])
SCR_StringToRGB(var->string, fadecolor, 1);
else
faderender = 0;
// bounds check and inverse check
if (faderender)
{
if (fadecolor[0] < 0)
{
faderender = GL_ONE_MINUS_DST_COLOR;
fadecolor[0] = -(fadecolor[0]);
}
if (fadecolor[1] < 0)
{
faderender = GL_ONE_MINUS_DST_COLOR;
fadecolor[1] = -(fadecolor[1]);
}
if (fadecolor[2] < 0)
{
faderender = GL_ONE_MINUS_DST_COLOR;
fadecolor[2] = -(fadecolor[2]);
}
}
}
void GLDraw_FadeScreen (void)
{
extern shader_t *scenepp_mt_shader;
if (!faderender)
return;
R2D_ScalePic(0, 0, vid.width, vid.height, scenepp_mt_shader);
Sbar_Changed();
}
//=============================================================================
/* /*
================ ================
Draw_BeginDisc Draw_BeginDisc
@ -836,190 +782,6 @@ void GL_Set2D (void)
} }
} }
#if 0
void MediaGL_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *palette) //bottom up
{
if (!TEXVALID(filmtexture))
{
filmtexture=GL_AllocNewTexture();
}
GL_Set2D ();
GL_Bind(filmtexture);
GL_Upload8Pal24(framedata, palette, inwidth, inheight, IF_NOMIPMAP|IF_NOALPHA); //we may need to rescale the image
// glTexImage2D (GL_TEXTURE_2D, 0, 3, roqfilm->width, roqfilm->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, framedata);
// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
qglDisable(GL_BLEND);
qglDisable(GL_ALPHA_TEST);
qglBegin(GL_QUADS);
qglTexCoord2f(0, 0);
qglVertex2f(0, 0);
qglTexCoord2f(0, 1);
qglVertex2f(0, vid.height);
qglTexCoord2f(1, 1);
qglVertex2f(vid.width, vid.height);
qglTexCoord2f(1, 0);
qglVertex2f(vid.width, 0);
qglEnd();
qglEnable(GL_ALPHA_TEST);
SCR_SetUpToDrawConsole();
if (scr_con_current)
SCR_DrawConsole (false);
M_Draw(0);
}
void MediaGL_ShowFrameRGBA_32(qbyte *framedata, int inwidth, int inheight)//top down
{
if (!TEXVALID(filmtexture))
{
filmtexture=GL_AllocNewTexture();
}
GL_Set2D ();
PPL_RevertToKnownState();
GL_Bind(filmtexture);
GL_Upload32("", (unsigned *)framedata, inwidth, inheight, IF_NOMIPMAP|IF_NOALPHA|IF_NOGAMMA); //we may need to rescale the image
qglDisable(GL_BLEND);
qglDisable(GL_ALPHA_TEST);
qglEnable(GL_TEXTURE_2D);
qglBegin(GL_QUADS);
qglTexCoord2f(0, 0);
qglVertex2f(0, 0);
qglTexCoord2f(0, 1);
qglVertex2f(0, vid.height);
qglTexCoord2f(1, 1);
qglVertex2f(vid.width, vid.height);
qglTexCoord2f(1, 0);
qglVertex2f(vid.width, 0);
qglEnd();
qglEnable(GL_ALPHA_TEST);
SCR_SetUpToDrawConsole();
if (scr_con_current)
SCR_DrawConsole (false);
}
int filmnwidth = 640;
int filmnheight = 640;
void MediaGL_ShowFrameBGR_24_Flip(qbyte *framedata, int inwidth, int inheight)
{
//we need these as we resize it as we convert to rgba
int y, x;
int v;
unsigned int f, fstep;
qbyte *src, *dest;
dest = uploadmemorybufferintermediate;
//change from bgr bottomup to rgba topdown
for (filmnwidth = 1; filmnwidth < inwidth; filmnwidth*=2)
;
for (filmnheight = 1; filmnheight < inheight; filmnheight*=2)
;
if (filmnwidth > 512)
filmnwidth = 512;
if (filmnheight > 512)
filmnheight = 512;
if (inwidth*inheight > sizeofuploadmemorybufferintermediate/4)
Sys_Error("MediaGL_ShowFrameBGR_24_Flip: image too big (%i*%i)", inwidth, inheight);
for (y=1 ; y<=filmnheight ; y++)
{
v = ((filmnheight - y)*(float)inheight/filmnheight);
src = framedata + v*(inwidth*3);
{
f = 0;
fstep = ((inwidth)*0x10000)/filmnwidth;
for (x=filmnwidth ; x&3 ; x--) //do the odd ones first. (bigger condition)
{
*dest++ = src[(f>>16)*3+2];
*dest++ = src[(f>>16)*3+1];
*dest++ = src[(f>>16)*3+0];
*dest++ = 255;
f += fstep;
}
for ( ; x ; x-=4) //loop through the remaining chunks.
{
dest[0] = src[(f>>16)*3+2];
dest[1] = src[(f>>16)*3+1];
dest[2] = src[(f>>16)*3+0];
dest[3] = 255;
f += fstep;
dest[4] = src[(f>>16)*3+2];
dest[5] = src[(f>>16)*3+1];
dest[6] = src[(f>>16)*3+0];
dest[7] = 255;
f += fstep;
dest[8] = src[(f>>16)*3+2];
dest[9] = src[(f>>16)*3+1];
dest[10] = src[(f>>16)*3+0];
dest[11] = 255;
f += fstep;
dest[12] = src[(f>>16)*3+2];
dest[13] = src[(f>>16)*3+1];
dest[14] = src[(f>>16)*3+0];
dest[15] = 255;
f += fstep;
dest += 16;
}
}
}
if (!TEXVALID(filmtexture))
{
filmtexture=GL_AllocNewTexture();
}
GL_Set2D ();
GL_Bind(filmtexture);
GL_Upload32("", (unsigned *)uploadmemorybufferintermediate, filmnwidth, filmnheight, IF_NOMIPMAP|IF_NOALPHA|IF_NOGAMMA); //we may need to rescale the image
qglDisable(GL_BLEND);
qglDisable(GL_ALPHA_TEST);
qglBegin(GL_QUADS);
qglTexCoord2f(0, 0);
qglVertex2f(0, 0);
qglTexCoord2f(0, 1);
qglVertex2f(0, vid.height);
qglTexCoord2f(1, 1);
qglVertex2f(vid.width, vid.height);
qglTexCoord2f(1, 0);
qglVertex2f(vid.width, 0);
qglEnd();
qglEnable(GL_ALPHA_TEST);
SCR_SetUpToDrawConsole();
if (scr_con_current)
SCR_DrawConsole (false);
}
#endif
//==================================================================== //====================================================================
/* /*
@ -1038,13 +800,6 @@ texid_t GL_FindTexture (char *identifier)
image_height = glt->height; image_height = glt->height;
return glt->texnum; return glt->texnum;
} }
/*
for (glt=gltextures ; glt ; glt=glt->next)
{
if (!strcmp (identifier, glt->identifier))
return glt->texnum;
}
*/
return r_nulltex; return r_nulltex;
} }
@ -1221,7 +976,7 @@ static void Image_Resample32Lerp(const void *indata, int inwidth, int inheight,
GL_ResampleTexture GL_ResampleTexture
================ ================
*/ */
void GL_ResampleTexture (unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight) static void GL_ResampleTexture (unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight)
{ {
int i, j; int i, j;
unsigned *inrow; unsigned *inrow;
@ -1264,7 +1019,7 @@ void GL_ResampleTexture (unsigned *in, int inwidth, int inheight, unsigned *out,
GL_Resample8BitTexture -- JACK GL_Resample8BitTexture -- JACK
================ ================
*/ */
void GL_Resample8BitTexture (unsigned char *in, int inwidth, int inheight, unsigned char *out, int outwidth, int outheight) static void GL_Resample8BitTexture (unsigned char *in, int inwidth, int inheight, unsigned char *out, int outwidth, int outheight)
{ {
int i, j; int i, j;
unsigned char *inrow; unsigned char *inrow;
@ -1296,7 +1051,7 @@ GL_MipMap
Operates in place, quartering the size of the texture Operates in place, quartering the size of the texture
================ ================
*/ */
void GL_MipMap (qbyte *in, int width, int height) static void GL_MipMap (qbyte *in, int width, int height)
{ {
int i, j; int i, j;
qbyte *out; qbyte *out;
@ -1393,7 +1148,7 @@ GL_MipMap8Bit
Mipping for 8 bit textures Mipping for 8 bit textures
================ ================
*/ */
void GL_MipMap8Bit (qbyte *in, int width, int height) static void GL_MipMap8Bit (qbyte *in, int width, int height)
{ {
int i, j; int i, j;
qbyte *out; qbyte *out;
@ -1588,7 +1343,7 @@ void GL_Upload32_Int (char *name, unsigned *data, int width, int height, unsigne
if (scaled_height < 1) if (scaled_height < 1)
scaled_height = 1; scaled_height = 1;
miplevel++; miplevel++;
qglTexImage2D (GL_TEXTURE_2D, miplevel, samples, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled); qglTexImage2D (GL_TEXTURE_2D, miplevel, samples, scaled_width, scaled_height, 0, glcolormode, GL_UNSIGNED_BYTE, scaled);
} }
} }
if (gl_config.arb_texture_compression && gl_compress.value && gl_savecompressedtex.value && name && !(flags&IF_NOMIPMAP)) if (gl_config.arb_texture_compression && gl_compress.value && gl_savecompressedtex.value && name && !(flags&IF_NOMIPMAP))
@ -2634,7 +2389,6 @@ texid_t GL_LoadTexture32_BGRA (char *identifier, int width, int height, unsigned
texid_t GL_LoadCompressed(char *name) texid_t GL_LoadCompressed(char *name)
{ {
qbyte *COM_LoadFile (char *path, int usehunk);
unsigned char *file; unsigned char *file;
gltexture_t *glt; gltexture_t *glt;
char inname[MAX_OSPATH]; char inname[MAX_OSPATH];
@ -2763,5 +2517,4 @@ texid_t GL_LoadPicTexture (qpic_t *pic)
return GL_LoadTexture ("", pic->width, pic->height, pic->data, IF_NOMIPMAP, 1); return GL_LoadTexture ("", pic->width, pic->height, pic->data, IF_NOMIPMAP, 1);
} }
/****************************************/
#endif #endif

View file

@ -30,7 +30,6 @@ void GLDraw_BeginDisc (void);
void GLDraw_EndDisc (void); void GLDraw_EndDisc (void);
void GLDraw_FillRGB (int x, int y, int w, int h, float r, float g, float b); void GLDraw_FillRGB (int x, int y, int w, int h, float r, float g, float b);
void GLDraw_Fill (int x, int y, int w, int h, unsigned int c); void GLDraw_Fill (int x, int y, int w, int h, unsigned int c);
void GLDraw_FadeScreen (void);
void GLDraw_Crosshair(void); void GLDraw_Crosshair(void);
void GLDraw_LevelPic (mpic_t *pic); void GLDraw_LevelPic (mpic_t *pic);
@ -44,6 +43,7 @@ void R2D_SubPic(int x, int y, int width, int height, mpic_t *pic, int srcx, int
void R2D_ConsoleBackground (int firstline, int lastline, qboolean forceopaque); void R2D_ConsoleBackground (int firstline, int lastline, qboolean forceopaque);
void R2D_EditorBackground (void); void R2D_EditorBackground (void);
void R2D_TileClear (int x, int y, int w, int h); void R2D_TileClear (int x, int y, int w, int h);
void R2D_FadeScreen (void);
void R2D_Init(void); void R2D_Init(void);
void R2D_Shutdown(void); void R2D_Shutdown(void);

View file

@ -105,7 +105,6 @@ cvar_t r_xflip = SCVAR("leftisright", "0");
extern cvar_t scr_fov; extern cvar_t scr_fov;
shader_t *scenepp_waterwarp; shader_t *scenepp_waterwarp;
shader_t *scenepp_mt_shader;
// post processing stuff // post processing stuff
texid_t sceneblur_texture; texid_t sceneblur_texture;
@ -270,78 +269,12 @@ void GL_InitFisheyeFov(void)
} }
} }
void GL_InitSceneProcessingShaders_MenuTint(void)
{
extern cvar_t gl_menutint_shader;
if (gl_config.arb_shader_objects && gl_menutint_shader.ival)
{
scenepp_mt_shader = R_RegisterShader("menutint",
"{\n"
"glslprogram\n"
"{\n"
"#ifdef VERTEX_SHADER\n"
"\
varying vec2 texcoord;\
uniform vec3 rendertexturescale;\
void main(void)\
{\
texcoord.x = gl_MultiTexCoord0.x*rendertexturescale.x;\
texcoord.y = (1-gl_MultiTexCoord0.y)*rendertexturescale.y;\
gl_Position = ftransform();\
}\
\n"
"#endif\n"
"#ifdef FRAGMENT_SHADER\n"
"\
varying vec2 texcoord;\
uniform vec3 colorparam;\
uniform sampler2D source;\
uniform int invert;\
const vec3 lumfactors = vec3(0.299, 0.587, 0.114);\
const vec3 invertvec = vec3(1.0, 1.0, 1.0);\
void main(void)\
{\
vec3 texcolor = texture2D(source, texcoord).rgb;\
float luminance = dot(lumfactors, texcolor);\
texcolor = vec3(luminance, luminance, luminance);\
texcolor *= colorparam;\
texcolor = (invert > 0) ? (invertvec - texcolor) : texcolor;\
gl_FragColor = vec4(texcolor, 1.0);\
}\n"
"#endif\n"
"}\n"
"param cvari r_menutint_inverse invert\n"
"param cvar3f r_menutint colorparam\n"
"param texture 0 source\n"
"{\n"
"map $currentrender\n"
"}\n"
"param rendertexturescale rendertexturescale\n"
"}");
}
else
{
scenepp_mt_shader = R_RegisterShader("menutint",
"{\n"
"{\n"
"map $whitetexture\n"
"blendfunc gl_dst_color gl_zero\n"
"rgbgen const $r_menutint\n"
"}\n"
"}\n"
);
}
}
void GL_InitSceneProcessingShaders (void) void GL_InitSceneProcessingShaders (void)
{ {
if (gl_config.arb_shader_objects) if (gl_config.arb_shader_objects)
{ {
GL_InitSceneProcessingShaders_WaterWarp(); GL_InitSceneProcessingShaders_WaterWarp();
GL_InitFisheyeFov(); GL_InitFisheyeFov();
GL_InitSceneProcessingShaders_MenuTint();
} }
} }

View file

@ -446,7 +446,7 @@ extern cvar_t gl_bump, v_contrast, r_drawflat;
extern cvar_t r_stains, r_stainfadetime, r_stainfadeammount; extern cvar_t r_stains, r_stainfadetime, r_stainfadeammount;
// callback defines // callback defines
extern cvar_t gl_font, r_menutint; extern cvar_t gl_font;
extern cvar_t vid_conautoscale, vid_conheight, vid_conwidth; extern cvar_t vid_conautoscale, vid_conheight, vid_conwidth;
extern cvar_t crosshair, crosshairimage, crosshaircolor, r_skyboxname; extern cvar_t crosshair, crosshairimage, crosshaircolor, r_skyboxname;
extern cvar_t r_floorcolour, r_wallcolour, r_floortexture, r_walltexture; extern cvar_t r_floorcolour, r_wallcolour, r_floortexture, r_walltexture;
@ -454,7 +454,6 @@ extern cvar_t r_fastskycolour;
void GLCrosshairimage_Callback(struct cvar_s *var, char *oldvalue); void GLCrosshairimage_Callback(struct cvar_s *var, char *oldvalue);
void GLCrosshair_Callback(struct cvar_s *var, char *oldvalue); void GLCrosshair_Callback(struct cvar_s *var, char *oldvalue);
void GLCrosshaircolor_Callback(struct cvar_s *var, char *oldvalue); void GLCrosshaircolor_Callback(struct cvar_s *var, char *oldvalue);
void GLR_Menutint_Callback (struct cvar_s *var, char *oldvalue);
void GLV_Gamma_Callback(struct cvar_s *var, char *oldvalue); void GLV_Gamma_Callback(struct cvar_s *var, char *oldvalue);
void GLR_DeInit (void) void GLR_DeInit (void)
@ -469,7 +468,6 @@ void GLR_DeInit (void)
Cvar_Unhook(&crosshairimage); Cvar_Unhook(&crosshairimage);
Cvar_Unhook(&crosshaircolor); Cvar_Unhook(&crosshaircolor);
Cvar_Unhook(&r_skyboxname); Cvar_Unhook(&r_skyboxname);
Cvar_Unhook(&r_menutint);
Cvar_Unhook(&vid_conautoscale); Cvar_Unhook(&vid_conautoscale);
Cvar_Unhook(&vid_conheight); Cvar_Unhook(&vid_conheight);
Cvar_Unhook(&vid_conwidth); Cvar_Unhook(&vid_conwidth);
@ -500,7 +498,6 @@ void GLR_Init (void)
Cvar_Hook(&crosshair, GLCrosshair_Callback); Cvar_Hook(&crosshair, GLCrosshair_Callback);
Cvar_Hook(&crosshairimage, GLCrosshairimage_Callback); Cvar_Hook(&crosshairimage, GLCrosshairimage_Callback);
Cvar_Hook(&crosshaircolor, GLCrosshaircolor_Callback); Cvar_Hook(&crosshaircolor, GLCrosshaircolor_Callback);
Cvar_Hook(&r_menutint, GLR_Menutint_Callback);
// Cvar_Hook(&r_floorcolour, GLR_Floorcolour_Callback); // Cvar_Hook(&r_floorcolour, GLR_Floorcolour_Callback);
// Cvar_Hook(&r_fastskycolour, GLR_Fastskycolour_Callback); // Cvar_Hook(&r_fastskycolour, GLR_Fastskycolour_Callback);
// Cvar_Hook(&r_wallcolour, GLR_Wallcolour_Callback); // Cvar_Hook(&r_wallcolour, GLR_Wallcolour_Callback);

View file

@ -230,6 +230,24 @@ static qboolean Shader_EvaluateCondition(char **ptr)
else if (!Q_stricmp(token, "normalmap") ) else if (!Q_stricmp(token, "normalmap") )
conditiontrue = conditiontrue == !!gl_bump.value; conditiontrue = conditiontrue == !!gl_bump.value;
else if (!Q_stricmp(token, "glsl") )
{
#ifdef GLQUAKE
conditiontrue = conditiontrue == ((qrenderer == QR_OPENGL) && gl_config.arb_shader_objects);
#else
conditiontrue = conditiontrue == false;
#endif
}
else if (!Q_stricmp(token, "hlsl") )
{
#ifdef D3DQUAKE
conditiontrue = conditiontrue == false;//((qrenderer == QR_DIRECT3D) && gl_config.arb_shader_objects);
#else
conditiontrue = conditiontrue == false;
#endif
}
// GCC hates these within if statements "error: expected '}' before 'else'" // GCC hates these within if statements "error: expected '}' before 'else'"
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma message("shader fixme") #pragma message("shader fixme")
@ -244,10 +262,12 @@ static qboolean Shader_EvaluateCondition(char **ptr)
conditiontrue = conditiontrue == false; conditiontrue = conditiontrue == false;
else if (!Q_stricmp(token, "loweroverlay") ) else if (!Q_stricmp(token, "loweroverlay") )
conditiontrue = conditiontrue == false; conditiontrue = conditiontrue == false;
else else
{
Con_Printf("Unrecognised builtin shader condition '%s'\n", token);
conditiontrue = conditiontrue == false; conditiontrue = conditiontrue == false;
} }
}
else else
{ {
cv = Cvar_Get(token, "", 0, "Shader Conditions"); cv = Cvar_Get(token, "", 0, "Shader Conditions");
@ -280,6 +300,11 @@ static qboolean Shader_EvaluateCondition(char **ptr)
conditiontrue = conditiontrue == !!cv->value; conditiontrue = conditiontrue == !!cv->value;
} }
} }
token = COM_ParseExt ( ptr, false );
if (!strcmp(token, "&&"))
return Shader_EvaluateCondition(ptr) && conditiontrue;
if (!strcmp(token, "||"))
return Shader_EvaluateCondition(ptr) || conditiontrue;
return conditiontrue; return conditiontrue;
} }
@ -2636,6 +2661,7 @@ void Shader_Readpass (shader_t *shader, char **ptr)
} }
else if (!Q_stricmp(token, "if")) else if (!Q_stricmp(token, "if"))
{ {
int nest = 0;
qboolean conditionistrue = Shader_EvaluateCondition(ptr); qboolean conditionistrue = Shader_EvaluateCondition(ptr);
while (*ptr) while (*ptr)
@ -2644,7 +2670,18 @@ void Shader_Readpass (shader_t *shader, char **ptr)
if ( !token[0] ) if ( !token[0] )
continue; continue;
else if (token[0] == ']') else if (token[0] == ']')
{
if (--nest <= 0)
{
nest++;
if (!strcmp(token, "]["))
conditionistrue = !conditionistrue;
else
break; break;
}
}
else if (token[0] == '[')
nest++;
else if (conditionistrue) else if (conditionistrue)
{ {
Shader_Parsetok (shader, pass, shaderpasskeys, token, ptr); Shader_Parsetok (shader, pass, shaderpasskeys, token, ptr);
@ -3487,8 +3524,7 @@ void Shader_DefaultBSPQ1(char *shortname, shader_t *s, const void *args)
"}\n" "}\n"
); );
} }
#ifdef GLQUAKE else
else if (qrenderer == QR_OPENGL && gl_config.arb_shader_objects)
{ {
builtin = ( builtin = (
"{\n" "{\n"
@ -3499,6 +3535,7 @@ void Shader_DefaultBSPQ1(char *shortname, shader_t *s, const void *args)
"tcmod turb 0 0 3 0.1\n" "tcmod turb 0 0 3 0.1\n"
"if r_wateralpha != 1\n" "if r_wateralpha != 1\n"
"[\n" "[\n"
"alphagen const $r_wateralpha\n"
"blendfunc gl_src_alpha gl_one_minus_src_alpha\n" "blendfunc gl_src_alpha gl_one_minus_src_alpha\n"
"]\n" "]\n"
"}\n" "}\n"
@ -3506,35 +3543,6 @@ void Shader_DefaultBSPQ1(char *shortname, shader_t *s, const void *args)
"}\n" "}\n"
); );
} }
#endif
else if (r_wateralpha.value < 1)
{
builtin = (
"{\n"
"{\n"
"map $diffuse\n"
"tcmod turb 0 0 3 0.1\n"
"alphagen const $r_wateralpha\n"
"blendfunc blend\n"
"}\n"
"sort blend\n"
"surfaceparm nodlight\n"
"}\n"
);
}
else
{
builtin = (
"{\n"
"{\n"
"map $diffuse\n"
"tcmod turb 0 0 3 0.1\n"
"}\n"
"sort blend\n"
"surfaceparm nodlight\n"
"}\n"
);
}
} }
if (!builtin && !strncmp(shortname, "sky", 3)) if (!builtin && !strncmp(shortname, "sky", 3))
{ {
@ -3823,6 +3831,7 @@ static void Shader_ReadShader(shader_t *s, char *shadersource)
break; break;
else if (!Q_stricmp(token, "if")) else if (!Q_stricmp(token, "if"))
{ {
int nest = 0;
qboolean conditionistrue = Shader_EvaluateCondition(&shadersource); qboolean conditionistrue = Shader_EvaluateCondition(&shadersource);
while (shadersource) while (shadersource)
@ -3831,7 +3840,18 @@ static void Shader_ReadShader(shader_t *s, char *shadersource)
if ( !token[0] ) if ( !token[0] )
continue; continue;
else if (token[0] == ']') else if (token[0] == ']')
{
if (--nest <= 0)
{
nest++;
if (!strcmp(token, "]["))
conditionistrue = !conditionistrue;
else
break; break;
}
}
else if (token[0] == '[')
nest++;
else if (conditionistrue) else if (conditionistrue)
{ {
if (token[0] == '{') if (token[0] == '{')

View file

@ -1078,7 +1078,7 @@ rendererinfo_t openglrendererinfo = {
R2D_TileClear, R2D_TileClear,
GLDraw_Fill, GLDraw_Fill,
GLDraw_FillRGB, GLDraw_FillRGB,
GLDraw_FadeScreen, R2D_FadeScreen,
GLDraw_BeginDisc, GLDraw_BeginDisc,
GLDraw_EndDisc, GLDraw_EndDisc,

View file

@ -621,7 +621,7 @@ qboolean VID_SetFullDIBMode (rendererstate_t *info)
return true; return true;
} }
extern int gammaworks; extern qboolean gammaworks;
static void ReleaseGL(void); static void ReleaseGL(void);
static qboolean CreateMainWindow(rendererstate_t *info) static qboolean CreateMainWindow(rendererstate_t *info)
{ {

View file

@ -155,7 +155,6 @@ char *SaveEnts(progfuncs_t *progfuncs, char *mem, int *size, int mode);
int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags); int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags);
char *SaveEnt (progfuncs_t *progfuncs, char *buf, int *size, struct edict_s *ed); char *SaveEnt (progfuncs_t *progfuncs, char *buf, int *size, struct edict_s *ed);
struct edict_s *RestoreEnt (progfuncs_t *progfuncs, char *buf, int *size, struct edict_s *ed); struct edict_s *RestoreEnt (progfuncs_t *progfuncs, char *buf, int *size, struct edict_s *ed);
char *PF_VarString (int first);
void PR_StackTrace (progfuncs_t *progfuncs); void PR_StackTrace (progfuncs_t *progfuncs);
extern int noextensions; extern int noextensions;

View file

@ -319,6 +319,7 @@ typedef struct temp_s {
pbool used; pbool used;
unsigned int size; unsigned int size;
} temp_t; } temp_t;
void QCC_PurgeTemps(void);
//not written //not written
typedef struct QCC_def_s typedef struct QCC_def_s

View file

@ -1370,6 +1370,10 @@ static void QCC_FreeTemps(void)
#else #else
#define QCC_FreeTemps() #define QCC_FreeTemps()
#endif #endif
void QCC_PurgeTemps(void)
{
functemps = NULL;
}
//temps that are still in use over a function call can be considered dodgy. //temps that are still in use over a function call can be considered dodgy.
//we need to remap these to locally defined temps, on return from the function so we know we got them all. //we need to remap these to locally defined temps, on return from the function so we know we got them all.

View file

@ -11,8 +11,6 @@ char QCC_copyright[1024];
int QCC_packid; int QCC_packid;
char QCC_Packname[5][128]; char QCC_Packname[5][128];
extern QCC_def_t *functemps; //floats/strings/funcs/ents...
extern int optres_test1; extern int optres_test1;
extern int optres_test2; extern int optres_test2;
@ -2965,7 +2963,7 @@ void QCC_main (int argc, char **argv) //as part of the quake engine
numtemps = 0; numtemps = 0;
functemps=NULL; QCC_PurgeTemps();
strings = (void *)qccHunkAlloc(sizeof(char) * MAX_STRINGS); strings = (void *)qccHunkAlloc(sizeof(char) * MAX_STRINGS);
strofs = 1; strofs = 1;

View file

@ -1896,8 +1896,6 @@ static void SV_CustomTEnt_Spawn(int index, float *org, float *org2, int count, f
int externcallsdepth; int externcallsdepth;
void PR_MoveParms(int progs1, int progs2); //from 2 to 1
float PR_LoadAditionalProgs(char *s); float PR_LoadAditionalProgs(char *s);
static void QCBUILTIN PF_addprogs(progfuncs_t *prinst, globalvars_t *pr_globals) static void QCBUILTIN PF_addprogs(progfuncs_t *prinst, globalvars_t *pr_globals)

View file

@ -27,11 +27,6 @@ Encode a client frame onto the network channel
============================================================================= =============================================================================
*/ */
void SV_Q2BSP_FatPVS (vec3_t org);
/* /*
================== ==================
MSG_WriteDeltaEntity MSG_WriteDeltaEntity