trash assembly, old d3d renderers (d3d7/d3d9/fakegl), projects and makefile broken in this commit

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3742 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2011-03-03 12:57:34 +00:00
parent 79497a07f7
commit 85fc11e682
29 changed files with 13 additions and 17360 deletions

View file

@ -180,8 +180,7 @@ endif
CLIENT_DIR=$(BASE_DIR)/client CLIENT_DIR=$(BASE_DIR)/client
GL_DIR=$(BASE_DIR)/gl GL_DIR=$(BASE_DIR)/gl
D3D7_DIR=$(BASE_DIR)/d3d D3D_DIR=$(BASE_DIR)/d3d
D3D9_DIR=$(BASE_DIR)/d3d9
SERVER_DIR=$(BASE_DIR)/server SERVER_DIR=$(BASE_DIR)/server
COMMON_DIR=$(BASE_DIR)/common COMMON_DIR=$(BASE_DIR)/common
HTTP_DIR=$(BASE_DIR)/http HTTP_DIR=$(BASE_DIR)/http
@ -197,13 +196,6 @@ 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 $< DO_CC=@echo $< && $(CC) $(ALL_CFLAGS) -o $@ -c $<
ifeq ($(USEASM),true)
ifdef windir
DO_AS=$(CC) $(BASE_CFLAGS) $(WCFLAGS) -x assembler-with-cpp -o $@ -c $< $(CFLAGS)
else
DO_AS=$(CC) $(BASE_CFLAGS) $(WCFLAGS) -x assembler-with-cpp -DELF -o $@ -c $< $(CFLAGS)
endif
endif
ifeq ($(FTE_TARGET),vc) ifeq ($(FTE_TARGET),vc)
BASELDFLAGS= BASELDFLAGS=
@ -251,34 +243,6 @@ GLSLDFLAGS=-L/usr/X11R6/lib -lMesaGL -lglide -lvga
XLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext $(IMAGELDFLAGS) XLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext $(IMAGELDFLAGS)
SLDFLAGS=-lvga 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
ifeq ($(FTE_TARGET),vc) ifeq ($(FTE_TARGET),vc)
WARNINGFLAGS=-W3 -D_CRT_SECURE_NO_WARNINGS WARNINGFLAGS=-W3 -D_CRT_SECURE_NO_WARNINGS
GNUC_FUNCS= GNUC_FUNCS=
@ -288,7 +252,7 @@ else
GNUC_FUNCS= -Dstrnicmp=strncasecmp -Dstricmp=strcasecmp -D_vsnprintf=vsnprintf -D_snprintf=snprintf GNUC_FUNCS= -Dstrnicmp=strncasecmp -Dstricmp=strcasecmp -D_vsnprintf=vsnprintf -D_snprintf=snprintf
endif endif
BASE_CFLAGS=$(BASE_ASM_CFLAGS) $(WARNINGFLAGS) $(GNUC_FUNCS) -I$(CLIENT_DIR) -I$(SERVER_DIR) -I$(COMMON_DIR) -I$(GL_DIR) -I$(D3D9_DIR) -I$(D3D7_DIR) -I$(PROGS_DIR) -I$(LIBS_DIR) -I$(LIBS_DIR)/dxsdk7/include -I$(LIBS_DIR)/dxsdk9/include -I$(LIBS_DIR)/sdl/include -I/usr/include/SDL -I$(LIBS_DIR)/sdl/include/SDL -I./libs/freetype2/include -I./libs/freetype2/include/freetype -I./libs/speex $(SVNREVISION) BASE_CFLAGS=$(WARNINGFLAGS) $(GNUC_FUNCS) -I$(CLIENT_DIR) -I$(SERVER_DIR) -I$(COMMON_DIR) -I$(GL_DIR) -I$(D3D_DIR) -I$(PROGS_DIR) -I$(LIBS_DIR) -I$(LIBS_DIR)/dxsdk9/include -I$(LIBS_DIR)/sdl/include -I/usr/include/SDL -I$(LIBS_DIR)/sdl/include/SDL -I./libs/freetype2/include -I./libs/freetype2/include/freetype -I./libs/speex $(SVNREVISION)
CLIENT_ONLY_CFLAGS=-DCLIENTONLY CLIENT_ONLY_CFLAGS=-DCLIENTONLY
SERVER_ONLY_CFLAGS=-DSERVERONLY SERVER_ONLY_CFLAGS=-DSERVERONLY
JOINT_CFLAGS= JOINT_CFLAGS=
@ -334,7 +298,7 @@ GLCFLAGS=-DGLQUAKE
D3DCFLAGS=-DD3DQUAKE D3DCFLAGS=-DD3DQUAKE
NPQTVCFLAGS=-DNPQTV NPQTVCFLAGS=-DNPQTV
CLIENT_OBJS = $(CLIENT_ASM_OBJS) \ CLIENT_OBJS = \
textedit.o \ textedit.o \
fragstats.o \ fragstats.o \
teamplay.o \ teamplay.o \
@ -498,7 +462,7 @@ WINDOWSSERVERONLY_OBJS = \
svmodel.o \ svmodel.o \
sv_sys_win.o sv_sys_win.o
COMMON_OBJS = $(COMMON_ASM_OBJS) \ COMMON_OBJS = \
com_mesh.o \ com_mesh.o \
com_phys_ode.o \ com_phys_ode.o \
common.o \ common.o \
@ -580,7 +544,7 @@ ifeq ($(FTE_TARGET),win32_SDL)
else else
GL_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 ./libs/mingw-libs/libSDL.a ./libs/mingw-libs/libSDLmain.a -mwindows -ldxguid -lwinmm -lole32 $(GLLDFLAGS) `sdl-config --libs` GL_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 ./libs/mingw-libs/libSDL.a ./libs/mingw-libs/libSDLmain.a -mwindows -ldxguid -lwinmm -lole32 $(GLLDFLAGS) `sdl-config --libs`
endif endif
GL_CFLAGS=-D_MINGW_VFPRINTF -D_SDL -I./libs/ -I./libs/mingw-libs/ -I./libs/dxsdk7/include/ -I./libs/mingw-libs $(GLCFLAGS) `sdl-config --cflags` GL_CFLAGS=-D_MINGW_VFPRINTF -D_SDL -I./libs/ -I./libs/mingw-libs/ -I./libs/mingw-libs $(GLCFLAGS) `sdl-config --cflags`
GLB_DIR=gl_mgw_sdl$(BITS) GLB_DIR=gl_mgw_sdl$(BITS)
GLCL_DIR=glcl_mgw_sdl$(BITS) GLCL_DIR=glcl_mgw_sdl$(BITS)
@ -595,7 +559,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 resources.o
M_CFLAGS=$(D3DCFLAGS) -D_MINGW_VFPRINTF -D_SDL -I./libs/ -I./libs/mingw-libs/ -I./libs/dxsdk7/include/ -I./libs/mingw-libs $(GLCFLAGS) `sdl-config --cflags` -D_MERGED_SDL 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
M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS)
ifdef windir ifdef windir
@ -609,7 +573,7 @@ ifeq ($(FTE_TARGET),win32_SDL)
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
D3D_CFLAGS=$(D3DCFLAGS) -D_MINGW_VFPRINTF -D_SDL -DNO_XFLIP -I./libs/ -I./libs/mingw-libs/ -I./libs/dxsdk7/include/ -I./libs/mingw-libs `sdl-config --cflags` D3D_CFLAGS=$(D3DCFLAGS) -D_MINGW_VFPRINTF -D_SDL -DNO_XFLIP -I./libs/ -I./libs/mingw-libs/ -I./libs/mingw-libs `sdl-config --cflags`
D3DB_DIR=d3d_mgw D3DB_DIR=d3d_mgw
D3DCL_DIR=d3dcl_mgw D3DCL_DIR=d3dcl_mgw
@ -626,7 +590,7 @@ ifeq ($(FTE_TARGET),win64_SDL)
else else
GL_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 ./libs/mingw64-libs/libSDL.a ./libs/mingw64-libs/libSDLmain.a -mwindows -ldxguid -lwinmm -lole32 $(GLLDFLAGS) `sdl-config --libs` GL_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 ./libs/mingw64-libs/libSDL.a ./libs/mingw64-libs/libSDLmain.a -mwindows -ldxguid -lwinmm -lole32 $(GLLDFLAGS) `sdl-config --libs`
endif endif
GL_CFLAGS=-D_SDL -I./libs/ -I./libs/mingw64-libs/ -I./libs/dxsdk7/include/ -I./libs/mingw64-libs $(GLCFLAGS) `sdl-config --cflags` GL_CFLAGS=-D_SDL -I./libs/ -I./libs/mingw64-libs/ -I./libs/mingw64-libs $(GLCFLAGS) `sdl-config --cflags`
GLB_DIR=gl_mgw_sdl$(BITS) GLB_DIR=gl_mgw_sdl$(BITS)
GLCL_DIR=glcl_mgw_sdl$(BITS) GLCL_DIR=glcl_mgw_sdl$(BITS)
@ -641,7 +605,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 resources.o
M_CFLAGS= $(D3DCFLAGS) -D_MINGW_VFPRINTF -D_SDL -I./libs/ -I./libs/mingw64-libs/ -I./libs/dxsdk7/include/ -I./libs/mingw64-libs $(GLCFLAGS) `sdl-config --cflags` -D_MERGED_SDL 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
M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS)
ifdef windir ifdef windir
@ -678,7 +642,7 @@ ifeq ($(FTE_TARGET),vc)
MCL_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 MCL_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
M_CFLAGS=$(GLCFLAGS) $(W32_CFLAGS) $(D3DCFLAGS) M_CFLAGS=$(GLCFLAGS) $(W32_CFLAGS) $(D3DCFLAGS)
MB_DIR=m_vc MB_DIR=m_vc
M_LDFLAGS=$(GLLDFLAGS) libs/jpeg.lib libs/libpng.lib libs/zlib.lib uuid.lib gdi32.lib ole32.lib libs/dxsdk7/lib/dxguid.lib /subsystem:windows M_LDFLAGS=$(GLLDFLAGS) libs/jpeg.lib libs/libpng.lib libs/zlib.lib uuid.lib gdi32.lib ole32.lib /subsystem:windows
endif endif
ifeq ($(FTE_TARGET),win32) ifeq ($(FTE_TARGET),win32)
@ -699,11 +663,7 @@ ifeq ($(FTE_TARGET),win32)
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 resources.o
ifeq ($(USEASM),true)
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 sys_dosa.o resources.o
else
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 resources.o
endif
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
@ -711,11 +671,7 @@ endif
GLB_DIR=gl_mgw GLB_DIR=gl_mgw
GLCL_DIR=glcl_mgw GLCL_DIR=glcl_mgw
ifeq ($(USEASM),true)
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_dosa.o npplug.o sys_npqtv.o sys_plugfte.o ../../ftequake/npapi.def
else
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 npplug.o sys_npqtv.o sys_plugfte.o ../../ftequake/npapi.def
endif
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
@ -723,11 +679,7 @@ endif
NPQTVB_DIR=npqtv_mgw NPQTVB_DIR=npqtv_mgw
NPQTVCL_DIR=npqtvcl_mgw NPQTVCL_DIR=npqtvcl_mgw
ifeq ($(USEASM),true)
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 sys_dosa.o resources.o
else
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 resources.o
endif
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
@ -765,11 +717,7 @@ ifeq ($(FTE_TARGET),win64)
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 resources.o
ifeq ($(USEASM),true)
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 sys_dosa.o resources.o
else
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 resources.o
endif
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
@ -777,11 +725,7 @@ endif
GLB_DIR=gl_mgw64 GLB_DIR=gl_mgw64
GLCL_DIR=glcl_mgw64 GLCL_DIR=glcl_mgw64
ifeq ($(USEASM),true)
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_dosa.o npplug.o sys_npqtv.o sys_plugfte.o ../../ftequake/npapi.def
else
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 npplug.o sys_npqtv.o sys_plugfte.o ../../ftequake/npapi.def
endif
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
@ -789,11 +733,7 @@ endif
NPQTVB_DIR=npqtv_mgw64 NPQTVB_DIR=npqtv_mgw64
NPQTVCL_DIR=npqtvcl_mgw64 NPQTVCL_DIR=npqtvcl_mgw64
ifeq ($(USEASM),true)
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 sys_dosa.o resources.o
else
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 resources.o
endif
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
@ -820,11 +760,7 @@ ifeq ($(FTE_TARGET),bsd)
SV_DIR=sv_linux SV_DIR=sv_linux
SV_LDFLAGS=-lz -ldl SV_LDFLAGS=-lz -ldl
ifeq ($(USEASM),true)
GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o sys_dosa.o
else
GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o
endif
GL_EXE_NAME=../fteqw.gl GL_EXE_NAME=../fteqw.gl
GLCL_EXE_NAME=../fteqwcl.gl GLCL_EXE_NAME=../fteqwcl.gl
GL_LDFLAGS= -L/usr/local/lib $(GLLDFLAGS) $(GLXLDFLAGS) -lXxf86vm -lpthread GL_LDFLAGS= -L/usr/local/lib $(GLLDFLAGS) $(GLXLDFLAGS) -lXxf86vm -lpthread
@ -832,11 +768,7 @@ endif
GLB_DIR=gl_bsd GLB_DIR=gl_bsd
GLCL_DIR=glcl_bsd GLCL_DIR=glcl_bsd
ifeq ($(USEASM),true)
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o sys_dosa.o
else
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o
endif
M_EXE_NAME=../fteqw M_EXE_NAME=../fteqw
MCL_EXE_NAME=../fteqwcl MCL_EXE_NAME=../fteqwcl
M_LDFLAGS=$(GLLDFLAGS) $(GLXLDFLAGS) -lXxf86vm -lpthread M_LDFLAGS=$(GLLDFLAGS) $(GLXLDFLAGS) -lXxf86vm -lpthread
@ -854,9 +786,6 @@ ifneq ($(shell echo $(FTE_TARGET)|grep linux),)
SV_EXE_NAME=../fteqw.sv$(BITS) SV_EXE_NAME=../fteqw.sv$(BITS)
GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidlinuxglx.o snd_alsa.o snd_linux.o cd_linux.o sys_linux.o GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidlinuxglx.o snd_alsa.o snd_linux.o cd_linux.o sys_linux.o
ifeq ($(USEASM),true)
GLCL_OBJS+= sys_dosa.o
endif
GL_EXE_NAME=../fteqw.gl$(BITS) GL_EXE_NAME=../fteqw.gl$(BITS)
GLCL_EXE_NAME=../fteqwcl.gl$(BITS) GLCL_EXE_NAME=../fteqwcl.gl$(BITS)
GL_LDFLAGS=$(GLLDFLAGS) $(GLXLDFLAGS) -lXxf86vm -lXxf86dga GL_LDFLAGS=$(GLLDFLAGS) $(GLXLDFLAGS) -lXxf86vm -lXxf86dga
@ -865,9 +794,6 @@ endif
GLCL_DIR=glcl_linux$(BITS) GLCL_DIR=glcl_linux$(BITS)
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidlinuxglx.o snd_linux.o snd_alsa.o cd_linux.o sys_linux.o MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidlinuxglx.o snd_linux.o snd_alsa.o cd_linux.o sys_linux.o
ifeq ($(USEASM),true)
MCL_OBJS+= sys_dosa.o
endif
M_EXE_NAME=../fteqw$(BITS) M_EXE_NAME=../fteqw$(BITS)
MCL_EXE_NAME=../fteqwcl$(BITS) MCL_EXE_NAME=../fteqwcl$(BITS)
M_LDFLAGS=$(GLLDFLAGS) $(GLXLDFLAGS) -lXxf86vm -lXxf86dga M_LDFLAGS=$(GLLDFLAGS) $(GLXLDFLAGS) -lXxf86vm -lXxf86dga
@ -947,11 +873,7 @@ ifeq ($(FTE_TARGET),cygwin)
SV_DIR=sv_cygwin SV_DIR=sv_cygwin
SV_LDFLAGS=-lz SV_LDFLAGS=-lz
ifeq ($(USEASM),true)
GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o sys_dosa.o
else
GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o
endif
GL_EXE_NAME=../fteqwglcyg.exe GL_EXE_NAME=../fteqwglcyg.exe
GLCL_EXE_NAME=../fteqwclglcyg.exe GLCL_EXE_NAME=../fteqwclglcyg.exe
GL_LDFLAGS=$(GLLDFLAGS) $(GLXLDFLAGS) GL_LDFLAGS=$(GLLDFLAGS) $(GLXLDFLAGS)
@ -959,11 +881,7 @@ endif
GLB_DIR=gl_cygwin GLB_DIR=gl_cygwin
GLCL_DIR=glcl_cygwin GLCL_DIR=glcl_cygwin
ifeq ($(USEASM),true)
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o sys_dosa.o
else
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o
endif
M_EXE_NAME=../fteqwcyg.exe M_EXE_NAME=../fteqwcyg.exe
MCL_EXE_NAME=../fteqwclcyg.exe MCL_EXE_NAME=../fteqwclcyg.exe
M_LDFLAGS=$(GLLDFLAGS) $(GLXLDFLAGS) M_LDFLAGS=$(GLLDFLAGS) $(GLXLDFLAGS)
@ -1012,7 +930,7 @@ ifneq ($(OUT_DIR),)
endif endif
VPATH = $(BASE_DIR) : $(CLIENT_DIR) : $(GL_DIR) : $(COMMON_DIR) : $(SERVER_DIR) : $(HTTP_DIR) : $(BASE_DIR)/irc : $(BASE_DIR)/email : $(QUX_DIR) : $(PROGS_DIR) : $(SNDCODEC_DIR) : $(D3D7_DIR) : $(D3D9_DIR) VPATH = $(BASE_DIR) : $(CLIENT_DIR) : $(GL_DIR) : $(COMMON_DIR) : $(SERVER_DIR) : $(HTTP_DIR) : $(BASE_DIR)/irc : $(BASE_DIR)/email : $(QUX_DIR) : $(PROGS_DIR) : $(SNDCODEC_DIR) : $(D3D_DIR)
# This is for linking the FTE icon to the MinGW target # This is for linking the FTE icon to the MinGW target
$(OUT_DIR)/resources.o : winquake.rc $(OUT_DIR)/resources.o : winquake.rc

View file

@ -1,229 +0,0 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//
// snd_mixa.s
// x86 assembly-language sound code
//
#include "asm_i386.h"
#include "quakeasm.h"
#define NOSOUNDASM //we no longer use any of this code, now that we have multiple sound cards.
#if !defined(NOSOUNDASM) && id386
.text
//----------------------------------------------------------------------
// 8-bit sound-mixing code
//----------------------------------------------------------------------
#define ch 4+16
#define sc 8+16
#define count 12+16
#if 0
// This code isn't maintained. It needs the snd_scaletable references removed.
// snd_scaletable[x][y] -> x * 8 * y
.globl C(SND_PaintChannelFrom8)
C(SND_PaintChannelFrom8):
pushl %esi // preserve register variables
pushl %edi
pushl %ebx
pushl %ebp
// int data;
// short *lscale, *rscale;
// unsigned char *sfx;
// int i;
movl ch(%esp),%ebx
movl sc(%esp),%esi
// if (ch->leftvol > 255)
// ch->leftvol = 255;
// if (ch->rightvol > 255)
// ch->rightvol = 255;
movl ch_vol(%ebx),%eax
movl ch_vol(%ebx),%edx
cmpl $255,%eax
jna LLeftSet
movl $255,%eax
LLeftSet:
cmpl $255,%edx
jna LRightSet
movl $255,%edx
LRightSet:
// lscale = snd_scaletable[ch->leftvol >> 3];
// rscale = snd_scaletable[ch->rightvol >> 3];
// sfx = (signed char *)sc->data + ch->pos;
// ch->pos += count;
andl $0xF8,%eax
addl $(sfxc_data),%esi
andl $0xF8,%edx
movl ch_pos(%ebx),%edi
movl count(%esp),%ecx
addl %edi,%esi
shll $7,%eax
addl %ecx,%edi
shll $7,%edx
movl %edi,ch_pos(%ebx)
addl $(C(snd_scaletable)),%eax
addl $(C(snd_scaletable)),%edx
subl %ebx,%ebx
movb -1(%esi,%ecx,1),%bl
testl $1,%ecx
jz LMix8Loop
movl (%eax,%ebx,4),%edi
movl (%edx,%ebx,4),%ebp
addl C(paintbuffer)+psp_left-psp_size(,%ecx,psp_size),%edi
addl C(paintbuffer)+psp_right-psp_size(,%ecx,psp_size),%ebp
movl %edi,C(paintbuffer)+psp_left-psp_size(,%ecx,psp_size)
movl %ebp,C(paintbuffer)+psp_right-psp_size(,%ecx,psp_size)
movb -2(%esi,%ecx,1),%bl
decl %ecx
jz LDone
// for (i=0 ; i<count ; i++)
// {
LMix8Loop:
// data = sfx[i];
// paintbuffer[i].left += lscale[data];
// paintbuffer[i].right += rscale[data];
movl (%eax,%ebx,4),%edi
movl (%edx,%ebx,4),%ebp
addl C(paintbuffer)+psp_left-psp_size(,%ecx,psp_size),%edi
addl C(paintbuffer)+psp_right-psp_size(,%ecx,psp_size),%ebp
movb -2(%esi,%ecx,1),%bl
movl %edi,C(paintbuffer)+psp_left-psp_size(,%ecx,psp_size)
movl %ebp,C(paintbuffer)+psp_right-psp_size(,%ecx,psp_size)
movl (%eax,%ebx,4),%edi
movl (%edx,%ebx,4),%ebp
movb -3(%esi,%ecx,1),%bl
addl C(paintbuffer)+psp_left-psp_size*2(,%ecx,psp_size),%edi
addl C(paintbuffer)+psp_right-psp_size*2(,%ecx,psp_size),%ebp
movl %edi,C(paintbuffer)+psp_left-psp_size*2(,%ecx,psp_size)
movl %ebp,C(paintbuffer)+psp_right-psp_size*2(,%ecx,psp_size)
// }
subl $2,%ecx
jnz LMix8Loop
LDone:
popl %ebp
popl %ebx
popl %edi
popl %esi
ret
//----------------------------------------------------------------------
// Transfer of stereo buffer to 16-bit DMA buffer code
//----------------------------------------------------------------------
//runs backwards.
//otherwise same algorthm as c
//i = ecx
.globl C(Snd_WriteLinearBlastStereo16)
C(Snd_WriteLinearBlastStereo16):
pushl %esi // preserve register variables
pushl %edi
pushl %ebx
// int i;
// int val;
movl C(cursndcard),%ecx // DMW was snd_linear_count
movl C(snd_p),%ebx
movl C(snd_vol),%esi
movl C(snd_out),%edi
movl 0(%ecx),%ecx // DMW dereference pointer (I think)
// for (i=0 ; i<snd_linear_count ; i+=2)
// {
LWLBLoopTop:
// val = (snd_p[i]*snd_vol)>>8;
// if (val > 0x7fff)
// snd_out[i] = 0x7fff;
// else if (val < (short)0x8000)
// snd_out[i] = (short)0x8000;
// else
// snd_out[i] = val;
movl -8(%ebx,%ecx,4),%eax
imull %esi,%eax
sarl $8,%eax
cmpl $0x7FFF,%eax
jg LClampHigh
cmpl $0xFFFF8000,%eax
jnl LClampDone
movl $0xFFFF8000,%eax
jmp LClampDone
LClampHigh:
movl $0x7FFF,%eax
LClampDone:
// val = (snd_p[i+1]*snd_vol)>>8;
// if (val > 0x7fff)
// snd_out[i+1] = 0x7fff;
// else if (val < (short)0x8000)
// snd_out[i+1] = (short)0x8000;
// else
// snd_out[i+1] = val;
movl -4(%ebx,%ecx,4),%edx
imull %esi,%edx
sarl $8,%edx
cmpl $0x7FFF,%edx
jg LClampHigh2
cmpl $0xFFFF8000,%edx
jnl LClampDone2
movl $0xFFFF8000,%edx
jmp LClampDone2
LClampHigh2:
movl $0x7FFF,%edx
LClampDone2:
shll $16,%edx
andl $0xFFFF,%eax
orl %eax,%edx
movl %edx,-4(%edi,%ecx,2)
// }
subl $2,%ecx
jnz LWLBLoopTop
// snd_p += snd_linear_count;
popl %ebx
popl %edi
popl %esi
ret
#endif
#endif // id386

View file

@ -1,95 +0,0 @@
//
// sys_dosa.s
// x86 assembly-language DOS-dependent routines.
#include "asm_i386.h"
#include "quakeasm.h"
.data
.align 4
fpenv:
.long 0, 0, 0, 0, 0, 0, 0, 0
.text
.globl C(MaskExceptions)
C(MaskExceptions):
fnstenv fpenv
orl $0x3F,fpenv
fldenv fpenv
ret
#if 0
.globl C(unmaskexceptions)
C(unmaskexceptions):
fnstenv fpenv
andl $0xFFFFFFE0,fpenv
fldenv fpenv
ret
#endif
.data
.align 4
.globl ceil_cw, single_cw, full_cw, cw, pushed_cw
ceil_cw: .long 0
single_cw: .long 0
full_cw: .long 0
cw: .long 0
pushed_cw: .long 0
.text
.globl C(Sys_LowFPPrecision)
C(Sys_LowFPPrecision):
fldcw single_cw
ret
.globl C(Sys_HighFPPrecision)
C(Sys_HighFPPrecision):
fldcw full_cw
ret
.globl C(Sys_PushFPCW_SetHigh)
C(Sys_PushFPCW_SetHigh):
fnstcw pushed_cw
fldcw full_cw
ret
.globl C(Sys_PopFPCW)
C(Sys_PopFPCW):
fldcw pushed_cw
ret
.globl C(Sys_SetFPCW)
C(Sys_SetFPCW):
fnstcw cw
movl cw,%eax
#if id386
andb $0xF0,%ah
orb $0x03,%ah // round mode, 64-bit precision
#endif
movl %eax,full_cw
#if id386
andb $0xF0,%ah
orb $0x0C,%ah // chop mode, single precision
#endif
movl %eax,single_cw
#if id386
andb $0xF0,%ah
orb $0x08,%ah // ceil mode, single precision
#endif
movl %eax,ceil_cw
ret

View file

@ -224,9 +224,6 @@ void Sys_Quit (void)
void Sys_Init(void) void Sys_Init(void)
{ {
#if id386
Sys_SetFPCW();
#endif
} }
void Sys_Error (const char *error, ...) void Sys_Error (const char *error, ...)
@ -573,7 +570,6 @@ char *Sys_ConsoleInput(void)
return NULL; return NULL;
} }
#if !id386
void Sys_HighFPPrecision (void) void Sys_HighFPPrecision (void)
{ {
} }
@ -581,7 +577,6 @@ void Sys_HighFPPrecision (void)
void Sys_LowFPPrecision (void) void Sys_LowFPPrecision (void)
{ {
} }
#endif
int main (int c, char **v) int main (int c, char **v)
{ {

View file

@ -277,10 +277,6 @@ static HANDLE tevent;
void Sys_InitFloatTime (void); void Sys_InitFloatTime (void);
void VARGS MaskExceptions (void);
void Sys_PopFPCW (void);
void Sys_PushFPCW_SetHigh (void);
int VARGS Sys_DebugLog(char *file, char *fmt, ...) int VARGS Sys_DebugLog(char *file, char *fmt, ...)
{ {
FILE *fd; FILE *fd;
@ -648,12 +644,6 @@ void Sys_Init (void)
} }
#endif #endif
#ifndef SERVERONLY
MaskExceptions ();
Sys_SetFPCW ();
#endif
#if 0 #if 0
if (!QueryPerformanceFrequency (&PerformanceFreq)) if (!QueryPerformanceFrequency (&PerformanceFreq))
Sys_Error ("No hardware timer available"); Sys_Error ("No hardware timer available");
@ -1789,7 +1779,6 @@ qboolean Sys_GetDesktopParameters(int *width, int *height, int *bpp, int *refres
} }
#if !id386 //these couldn't be found... (it is a masm thing, right?)
void Sys_HighFPPrecision (void) void Sys_HighFPPrecision (void)
{ {
} }
@ -1805,7 +1794,6 @@ void VARGS Sys_SetFPCW (void)
void VARGS MaskExceptions (void) void VARGS MaskExceptions (void)
{ {
} }
#endif
#ifdef MULTITHREAD #ifdef MULTITHREAD
/* Thread creation calls */ /* Thread creation calls */

View file

@ -1,118 +0,0 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//
// sys_wina.s
// x86 assembly-language Win-dependent routines.
#include "asm_i386.h"
#include "quakeasm.h"
#ifndef NOASM
//@@@ should be id386-dependent, and have an equivalent C path
.data
.align 4
fpenv:
.long 0, 0, 0, 0, 0, 0, 0, 0
.text
.globl C(MaskExceptions)
C(MaskExceptions):
fnstenv fpenv
orl $0x3F,fpenv
fldenv fpenv
ret
#if 0
.globl C(unmaskexceptions)
C(unmaskexceptions):
fnstenv fpenv
andl $0xFFFFFFE0,fpenv
fldenv fpenv
ret
#endif
.data
.align 4
.globl ceil_cw, single_cw, full_cw, cw, pushed_cw
ceil_cw: .long 0
single_cw: .long 0
full_cw: .long 0
cw: .long 0
pushed_cw: .long 0
.text
.globl C(Sys_LowFPPrecision)
C(Sys_LowFPPrecision):
fldcw single_cw
ret
.globl C(Sys_HighFPPrecision)
C(Sys_HighFPPrecision):
fldcw full_cw
ret
.globl C(Sys_PushFPCW_SetHigh)
C(Sys_PushFPCW_SetHigh):
fnstcw pushed_cw
fldcw full_cw
ret
.globl C(Sys_PopFPCW)
C(Sys_PopFPCW):
fldcw pushed_cw
ret
.globl C(Sys_SetFPCW)
C(Sys_SetFPCW):
fnstcw cw
movl cw,%eax
#if id386
andb $0xF0,%ah
orb $0x03,%ah // round mode, 64-bit precision
#endif
movl %eax,full_cw
#if id386
andb $0xF0,%ah
orb $0x0C,%ah // chop mode, single precision
#endif
movl %eax,single_cw
#if id386
andb $0xF0,%ah
orb $0x08,%ah // ceil mode, single precision
#endif
movl %eax,ceil_cw
ret
#endif

View file

@ -1,98 +0,0 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __ASM_I386__
#define __ASM_I386__
#if defined(CYGORELF) || defined(ELF)
#define C(label) label
#else
#define C(label) _##label
#endif
//
// !!! note that this file must match the corresponding C structures at all
// times !!!
//
// plane_t structure
// !!! if this is changed, it must be changed in model.h too !!!
// !!! if the size of this is changed, the array lookup in SV_HullPointContents
// must be changed too !!!
#define pl_normal 0
#define pl_dist 12
#define pl_type 16
#define pl_signbits 17
#define pl_pad 18
#define pl_size 20
// hull_t structure
// !!! if this is changed, it must be changed in model.h too !!!
#define hu_clipnodes 0
#define hu_planes 4
#define hu_firstclipnode 8
#define hu_lastclipnode 12
#define hu_clip_mins 16
#define hu_clip_maxs 28
#define hu_available 40
#define hu_size 44
// dnode_t structure
// !!! if this is changed, it must be changed in bspfile.h too !!!
#define nd_planenum 0
#define nd_children 4
#define nd_mins 8
#define nd_maxs 20
#define nd_firstface 32
#define nd_numfaces 36
#define nd_size 40
// sfxcache_t structure
// !!! if this is changed, it much be changed in sound.h too !!!
#define sfxc_length 0
#define sfxc_loopstart 4
#define sfxc_speed 8
#define sfxc_width 12
#define sfxc_stereo 16
#define sfxc_data 20
// channel_t structure
// !!! if this is changed, it much be changed in sound.h too !!!
#define MAXSOUNDCHANNELS 6
#define ch_sfx 0
#define ch_vol ch_sfx+4
#define ch_end ch_vol+4*MAXSOUNDCHANNELS
#define ch_pos ch_end+4
#define ch_looping ch_looping+4
#define ch_entnum ch_entnum+4
#define ch_entchannel ch_entchannel+4
#define ch_origin ch_origin+4
#define ch_dist_mult ch_dist_mult+4
#define ch_master_vol ch_master_vol+4
#define ch_size ch_size+4
// portable_samplepair_t structure
// !!! if this is changed, it much be changed in sound.h too !!!
#define psp_left 0
#define psp_right 4
#define psp_size 8
#endif

View file

@ -61,7 +61,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// #define AVAIL_OPENAL /* Jogi's OpenAL support */ // #define AVAIL_OPENAL /* Jogi's OpenAL support */
#endif #endif
#define AVAIL_MASM
#if defined(MINGW) || defined(MACOSX) #if defined(MINGW) || defined(MACOSX)
#define AVAIL_PNGLIB #define AVAIL_PNGLIB
@ -104,9 +103,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef NO_OGG #ifdef NO_OGG
#undef AVAIL_OGGVORBIS #undef AVAIL_OGGVORBIS
#endif #endif
#if defined(NO_MASM) || !defined(_WIN32)
#undef AVAIL_MASM
#endif
#if defined(NO_FREETYPE) #if defined(NO_FREETYPE)
#undef AVAIL_FREETYPE #undef AVAIL_FREETYPE
#endif #endif
@ -114,14 +110,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//#define AVAIL_FREETYPE //#define AVAIL_FREETYPE
//set any additional defines or libs in win32 //set any additional defines or libs in win32
#ifndef AVAIL_MASM
#ifdef _WIN32
#define NOASM
#else
#undef AVAIL_MASM //fixme
#endif
#endif
#define SVRANKING #define SVRANKING
#ifdef MINIMAL #ifdef MINIMAL
@ -130,7 +118,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef AVAIL_JPEGLIB //no jpeg support #undef AVAIL_JPEGLIB //no jpeg support
#undef AVAIL_PNGLIB //no png support #undef AVAIL_PNGLIB //no png support
#undef USE_MADLIB //no internal mp3 playing #undef USE_MADLIB //no internal mp3 playing
#undef USE_D3D //no d3d support
#define NOMEDIA //NO playing of avis/cins/roqs #define NOMEDIA //NO playing of avis/cins/roqs
#define MD3MODELS //we DO want to use quake3 alias models. This might be a minimal build, but we still want this. #define MD3MODELS //we DO want to use quake3 alias models. This might be a minimal build, but we still want this.
@ -240,10 +227,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif #endif
#endif #endif
#if !defined(AVAIL_D3D) || !defined(GLQUAKE)
#undef USE_D3D
#endif
#ifdef NPQTV #ifdef NPQTV
#undef TEXTEDITOR #undef TEXTEDITOR
#undef WEBSERVER #undef WEBSERVER
@ -367,17 +350,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif #endif
#if (defined(_M_IX86) || defined(__i386__)) && !defined(id386) && !defined(__amd64__) && !defined(_AMD64_) #if (defined(_M_IX86) || defined(__i386__)) && !defined(__amd64__) && !defined(_AMD64_)
#define id386 1
#else
#define id386 0
#endif
#if defined(NOASM) // no asm in dedicated server
#undef id386
#endif
#if id386
#define UNALIGNED_OK 1 // set to 0 if unaligned accesses are not supported #define UNALIGNED_OK 1 // set to 0 if unaligned accesses are not supported
#else #else
#define UNALIGNED_OK 0 #define UNALIGNED_OK 0

View file

@ -3130,9 +3130,6 @@ void COM_Version_f (void)
#ifdef D3DQUAKE #ifdef D3DQUAKE
Con_Printf("Direct3D available\n"); Con_Printf("Direct3D available\n");
#endif #endif
#ifdef USE_D3D
Con_Printf("FakeGL available\n");
#endif
#ifdef _SDL #ifdef _SDL
Con_Printf("SDL version: %d.%d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL); Con_Printf("SDL version: %d.%d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);

View file

@ -1,370 +0,0 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//
// math.s
// x86 assembly-language math routines.
#include "asm_i386.h"
#include "quakeasm.h"
#if id386
.data
.align 4
Ljmptab: .long Lcase0, Lcase1, Lcase2, Lcase3
.long Lcase4, Lcase5, Lcase6, Lcase7
.text
// TODO: rounding needed?
// stack parameter offset
#define val 4
.globl C(Invert24To16)
C(Invert24To16):
movl val(%esp),%ecx
movl $0x100,%edx // 0x10000000000 as dividend
cmpl %edx,%ecx
jle LOutOfRange
subl %eax,%eax
divl %ecx
ret
LOutOfRange:
movl $0xFFFFFFFF,%eax
ret
#define EMINS 4+4
#define EMAXS 4+8
#define P 4+12
.align 2
.globl C(BoxOnPlaneSide)
C(BoxOnPlaneSide):
pushl %ebx
movl P(%esp),%edx
movl EMINS(%esp),%ecx
xorl %eax,%eax
movl EMAXS(%esp),%ebx
movb pl_signbits(%edx),%al
cmpb $8,%al
jge Lerror
flds pl_normal(%edx) // p->normal[0]
fld %st(0) // p->normal[0] | p->normal[0]
jmp Ljmptab(,%eax,4)
//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
//dist2= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
Lcase0:
fmuls (%ebx) // p->normal[0]*emaxs[0] | p->normal[0]
flds pl_normal+4(%edx) // p->normal[1] | p->normal[0]*emaxs[0] |
// p->normal[0]
fxch %st(2) // p->normal[0] | p->normal[0]*emaxs[0] |
// p->normal[1]
fmuls (%ecx) // p->normal[0]*emins[0] |
// p->normal[0]*emaxs[0] | p->normal[1]
fxch %st(2) // p->normal[1] | p->normal[0]*emaxs[0] |
// p->normal[0]*emins[0]
fld %st(0) // p->normal[1] | p->normal[1] |
// p->normal[0]*emaxs[0] |
// p->normal[0]*emins[0]
fmuls 4(%ebx) // p->normal[1]*emaxs[1] | p->normal[1] |
// p->normal[0]*emaxs[0] |
// p->normal[0]*emins[0]
flds pl_normal+8(%edx) // p->normal[2] | p->normal[1]*emaxs[1] |
// p->normal[1] | p->normal[0]*emaxs[0] |
// p->normal[0]*emins[0]
fxch %st(2) // p->normal[1] | p->normal[1]*emaxs[1] |
// p->normal[2] | p->normal[0]*emaxs[0] |
// p->normal[0]*emins[0]
fmuls 4(%ecx) // p->normal[1]*emins[1] |
// p->normal[1]*emaxs[1] |
// p->normal[2] | p->normal[0]*emaxs[0] |
// p->normal[0]*emins[0]
fxch %st(2) // p->normal[2] | p->normal[1]*emaxs[1] |
// p->normal[1]*emins[1] |
// p->normal[0]*emaxs[0] |
// p->normal[0]*emins[0]
fld %st(0) // p->normal[2] | p->normal[2] |
// p->normal[1]*emaxs[1] |
// p->normal[1]*emins[1] |
// p->normal[0]*emaxs[0] |
// p->normal[0]*emins[0]
fmuls 8(%ebx) // p->normal[2]*emaxs[2] |
// p->normal[2] |
// p->normal[1]*emaxs[1] |
// p->normal[1]*emins[1] |
// p->normal[0]*emaxs[0] |
// p->normal[0]*emins[0]
fxch %st(5) // p->normal[0]*emins[0] |
// p->normal[2] |
// p->normal[1]*emaxs[1] |
// p->normal[1]*emins[1] |
// p->normal[0]*emaxs[0] |
// p->normal[2]*emaxs[2]
faddp %st(0),%st(3) //p->normal[2] |
// p->normal[1]*emaxs[1] |
// p->normal[1]*emins[1]+p->normal[0]*emins[0]|
// p->normal[0]*emaxs[0] |
// p->normal[2]*emaxs[2]
fmuls 8(%ecx) //p->normal[2]*emins[2] |
// p->normal[1]*emaxs[1] |
// p->normal[1]*emins[1]+p->normal[0]*emins[0]|
// p->normal[0]*emaxs[0] |
// p->normal[2]*emaxs[2]
fxch %st(1) //p->normal[1]*emaxs[1] |
// p->normal[2]*emins[2] |
// p->normal[1]*emins[1]+p->normal[0]*emins[0]|
// p->normal[0]*emaxs[0] |
// p->normal[2]*emaxs[2]
faddp %st(0),%st(3) //p->normal[2]*emins[2] |
// p->normal[1]*emins[1]+p->normal[0]*emins[0]|
// p->normal[0]*emaxs[0]+p->normal[1]*emaxs[1]|
// p->normal[2]*emaxs[2]
fxch %st(3) //p->normal[2]*emaxs[2] +
// p->normal[1]*emins[1]+p->normal[0]*emins[0]|
// p->normal[0]*emaxs[0]+p->normal[1]*emaxs[1]|
// p->normal[2]*emins[2]
faddp %st(0),%st(2) //p->normal[1]*emins[1]+p->normal[0]*emins[0]|
// dist1 | p->normal[2]*emins[2]
jmp LSetSides
//dist1= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
Lcase1:
fmuls (%ecx) // emins[0]
flds pl_normal+4(%edx)
fxch %st(2)
fmuls (%ebx) // emaxs[0]
fxch %st(2)
fld %st(0)
fmuls 4(%ebx) // emaxs[1]
flds pl_normal+8(%edx)
fxch %st(2)
fmuls 4(%ecx) // emins[1]
fxch %st(2)
fld %st(0)
fmuls 8(%ebx) // emaxs[2]
fxch %st(5)
faddp %st(0),%st(3)
fmuls 8(%ecx) // emins[2]
fxch %st(1)
faddp %st(0),%st(3)
fxch %st(3)
faddp %st(0),%st(2)
jmp LSetSides
//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
//dist2= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
Lcase2:
fmuls (%ebx) // emaxs[0]
flds pl_normal+4(%edx)
fxch %st(2)
fmuls (%ecx) // emins[0]
fxch %st(2)
fld %st(0)
fmuls 4(%ecx) // emins[1]
flds pl_normal+8(%edx)
fxch %st(2)
fmuls 4(%ebx) // emaxs[1]
fxch %st(2)
fld %st(0)
fmuls 8(%ebx) // emaxs[2]
fxch %st(5)
faddp %st(0),%st(3)
fmuls 8(%ecx) // emins[2]
fxch %st(1)
faddp %st(0),%st(3)
fxch %st(3)
faddp %st(0),%st(2)
jmp LSetSides
//dist1= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
Lcase3:
fmuls (%ecx) // emins[0]
flds pl_normal+4(%edx)
fxch %st(2)
fmuls (%ebx) // emaxs[0]
fxch %st(2)
fld %st(0)
fmuls 4(%ecx) // emins[1]
flds pl_normal+8(%edx)
fxch %st(2)
fmuls 4(%ebx) // emaxs[1]
fxch %st(2)
fld %st(0)
fmuls 8(%ebx) // emaxs[2]
fxch %st(5)
faddp %st(0),%st(3)
fmuls 8(%ecx) // emins[2]
fxch %st(1)
faddp %st(0),%st(3)
fxch %st(3)
faddp %st(0),%st(2)
jmp LSetSides
//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
//dist2= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
Lcase4:
fmuls (%ebx) // emaxs[0]
flds pl_normal+4(%edx)
fxch %st(2)
fmuls (%ecx) // emins[0]
fxch %st(2)
fld %st(0)
fmuls 4(%ebx) // emaxs[1]
flds pl_normal+8(%edx)
fxch %st(2)
fmuls 4(%ecx) // emins[1]
fxch %st(2)
fld %st(0)
fmuls 8(%ecx) // emins[2]
fxch %st(5)
faddp %st(0),%st(3)
fmuls 8(%ebx) // emaxs[2]
fxch %st(1)
faddp %st(0),%st(3)
fxch %st(3)
faddp %st(0),%st(2)
jmp LSetSides
//dist1= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
Lcase5:
fmuls (%ecx) // emins[0]
flds pl_normal+4(%edx)
fxch %st(2)
fmuls (%ebx) // emaxs[0]
fxch %st(2)
fld %st(0)
fmuls 4(%ebx) // emaxs[1]
flds pl_normal+8(%edx)
fxch %st(2)
fmuls 4(%ecx) // emins[1]
fxch %st(2)
fld %st(0)
fmuls 8(%ecx) // emins[2]
fxch %st(5)
faddp %st(0),%st(3)
fmuls 8(%ebx) // emaxs[2]
fxch %st(1)
faddp %st(0),%st(3)
fxch %st(3)
faddp %st(0),%st(2)
jmp LSetSides
//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
//dist2= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
Lcase6:
fmuls (%ebx) // emaxs[0]
flds pl_normal+4(%edx)
fxch %st(2)
fmuls (%ecx) // emins[0]
fxch %st(2)
fld %st(0)
fmuls 4(%ecx) // emins[1]
flds pl_normal+8(%edx)
fxch %st(2)
fmuls 4(%ebx) // emaxs[1]
fxch %st(2)
fld %st(0)
fmuls 8(%ecx) // emins[2]
fxch %st(5)
faddp %st(0),%st(3)
fmuls 8(%ebx) // emaxs[2]
fxch %st(1)
faddp %st(0),%st(3)
fxch %st(3)
faddp %st(0),%st(2)
jmp LSetSides
//dist1= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
Lcase7:
fmuls (%ecx) // emins[0]
flds pl_normal+4(%edx)
fxch %st(2)
fmuls (%ebx) // emaxs[0]
fxch %st(2)
fld %st(0)
fmuls 4(%ecx) // emins[1]
flds pl_normal+8(%edx)
fxch %st(2)
fmuls 4(%ebx) // emaxs[1]
fxch %st(2)
fld %st(0)
fmuls 8(%ecx) // emins[2]
fxch %st(5)
faddp %st(0),%st(3)
fmuls 8(%ebx) // emaxs[2]
fxch %st(1)
faddp %st(0),%st(3)
fxch %st(3)
faddp %st(0),%st(2)
LSetSides:
// sides = 0;
// if (dist1 >= p->dist)
// sides = 1;
// if (dist2 < p->dist)
// sides |= 2;
faddp %st(0),%st(2) // dist1 | dist2
fcomps pl_dist(%edx)
xorl %ecx,%ecx
fnstsw %ax
fcomps pl_dist(%edx)
andb $1,%ah
xorb $1,%ah
addb %ah,%cl
fnstsw %ax
andb $1,%ah
addb %ah,%ah
addb %ah,%cl
// return sides;
popl %ebx
movl %ecx,%eax // return status
ret
Lerror:
call C(BOPS_Error)
#endif // id386

View file

@ -172,8 +172,6 @@ void VARGS BOPS_Error (void)
Sys_Error ("BoxOnPlaneSide: Bad signbits"); Sys_Error ("BoxOnPlaneSide: Bad signbits");
} }
#if !id386
/* /*
================== ==================
BoxOnPlaneSide BoxOnPlaneSide
@ -281,8 +279,6 @@ if (sides == 0)
return sides; return sides;
} }
#endif
@ -694,8 +690,6 @@ int GreatestCommonDivisor (int i1, int i2)
} }
#if !id386
// TODO: move to nonintel.c // TODO: move to nonintel.c
/* /*
@ -715,7 +709,6 @@ fixed16_t Invert24To16(fixed16_t val)
(((double)0x10000 * (double)0x1000000 / (double)val) + 0.5); (((double)0x10000 * (double)0x1000000 / (double)val) + 0.5);
} }
#endif

View file

@ -23,8 +23,6 @@ void Q1BSP_CheckHullNodes(hull_t *hull)
} }
} }
#if !id386
/* /*
================== ==================
SV_HullPointContents SV_HullPointContents
@ -54,9 +52,6 @@ static int Q1_HullPointContents (hull_t *hull, int num, vec3_t p)
return num; return num;
} }
#else
int VARGS Q1_HullPointContents (hull_t *hull, int num, vec3_t p);
#endif // !id386

View file

@ -1,58 +0,0 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//
// quakeasm.h: general asm header file
//
#ifdef _WIN32
#define __i386__ 1
#endif
#if defined(NOASM)
#define id386 0
#else
#ifdef __i386__
#define id386 1
#else
#define id386 0
#endif
#endif
#ifdef MQUAKE
#define GLQUAKE
#endif
// !!! must be kept the same as in d_iface.h !!!
#define TRANSPARENT_COLOR 255
#ifndef NeXT
.extern C(paintbuffer)
// .extern C(snd_linear_count)
.extern C(cursndcard)
.extern C(snd_p)
.extern C(snd_vol)
.extern C(snd_out)
.extern C(vright)
.extern C(vup)
.extern C(vpn)
.extern C(BOPS_Error)
#endif

View file

@ -85,10 +85,6 @@ void Sys_ServerActivity(void);
void Sys_SendKeyEvents (void); void Sys_SendKeyEvents (void);
// Perform Key_Event () callbacks until the input que is empty // Perform Key_Event () callbacks until the input que is empty
void Sys_LowFPPrecision (void);
void Sys_HighFPPrecision (void);
void VARGS Sys_SetFPCW (void);
int Sys_EnumerateFiles (const char *gpath, const char *match, int (*func)(const char *, int, void *), void *parm); int Sys_EnumerateFiles (const char *gpath, const char *match, int (*func)(const char *, int, void *), void *parm);
qboolean Sys_GetDesktopParameters(int *width, int *height, int *bpp, int *refreshrate); qboolean Sys_GetDesktopParameters(int *width, int *height, int *bpp, int *refreshrate);

View file

@ -1,828 +0,0 @@
#include "quakedef.h"
#ifdef D3DQUAKE
#include "d3dquake.h"
#define MAX_WIDTH 512
#define MAX_HEIGHT 512
void *d3dexplosiontexture;
void *d3dballtexture;
LPDIRECTDRAWSURFACE7 draw_chars_tex;
mpic_t *conback_tex;
typedef struct d3dcachepic_s
{
char name[MAX_QPATH];
mpic_t pic;
} d3dcachepic_t;
#define MAX_CACHED_PICS 512 //a temporary solution
d3dcachepic_t d3dmenu_cachepics[MAX_CACHED_PICS];
int d3dmenu_numcachepics;
typedef struct {
float x, y, z;
int colour;
float s, t;
} d3dquadvert_t;
d3dquadvert_t d3dquadvert[4];
index_t d3dquadindexes[6] = {
0, 1, 2,
0, 2, 3
};
//pD3DDev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX2, d3dstate.vertbuf, d3dstate.numverts, d3dstate.indexbuf, d3dstate.numindicies, 0);
static void Upload_Texture_32(LPDIRECTDRAWSURFACE7 surf, unsigned int *data, int width, int height)
{
int x, y;
unsigned int *dest;
unsigned char swapbuf[4];
unsigned char swapbuf2[4];
DDSURFACEDESC2 desc;
memset(&desc, 0, sizeof(desc));
surf->lpVtbl->Lock(surf, NULL, &desc, DDLOCK_NOSYSLOCK|DDLOCK_WAIT|DDLOCK_WRITEONLY|DDLOCK_DISCARDCONTENTS, NULL);
if (width == desc.dwWidth && height == desc.dwHeight)
{
// if (desc.lPitch == twidth*4)
// {
// memcpy(desc.lpSurface, data, width*height*4);
// }
// else
{
for (y = 0; y < desc.dwHeight; y++)
{
dest = (unsigned int *)((char *)desc.lpSurface + desc.lPitch*y);
for (x = 0; x < desc.dwWidth; x++)
{
*(unsigned int*)swapbuf2 = *(unsigned int*)swapbuf = data[x];
swapbuf[0] = swapbuf2[2];
swapbuf[2] = swapbuf2[0];
dest[x] = *(unsigned int*)swapbuf;
}
data += width;
}
}
}
else
{
int x, y;
int iny;
unsigned int *row, *inrow;
for (y = 0; y < desc.dwHeight; y++)
{
row = (unsigned int*)((char *)desc.lpSurface + desc.lPitch*y);
iny = (y * height) / desc.dwHeight;
inrow = data + width*iny;
for (x = 0; x < desc.dwWidth; x++)
{
*(unsigned int*)swapbuf2 = *(unsigned int*)swapbuf = inrow[(x * width)/desc.dwWidth];
swapbuf[0] = swapbuf2[2];
swapbuf[2] = swapbuf2[0];
row[x] = *(unsigned int*)swapbuf;
}
}
//mimic opengl and draw it white
// memset(desc.lpSurface, 255, twidth*theight*4);
}
surf->lpVtbl->Unlock(surf, NULL);
}
void D3D7_MipMap (qbyte *out, qbyte *in, int width, int height)
{
int i, j;
width <<=2;
height >>= 1;
for (i=0 ; i<height ; i++, in+=width)
{
for (j=0 ; j<width ; j+=8, out+=4, in+=8)
{
out[0] = (in[0] + in[4] + in[width+0] + in[width+4])>>2;
out[1] = (in[1] + in[5] + in[width+1] + in[width+5])>>2;
out[2] = (in[2] + in[6] + in[width+2] + in[width+6])>>2;
out[3] = (in[3] + in[7] + in[width+3] + in[width+7])>>2;
}
}
}
//create a basic shader from a 32bit image
void *D3D7_LoadTexture_32(char *name, unsigned int *data, int width, int height, int flags)
{
static unsigned char mipdata[(MAX_WIDTH/2)*(MAX_HEIGHT/2)][4];
DWORD tflags;
DWORD twidth = width;
DWORD theight = height;
D3DX_SURFACEFORMAT tformat = D3DX_SF_A8R8G8B8;
LPDIRECTDRAWSURFACE7 newsurf;
DWORD nummips;
/* if (!(flags & TF_MANDATORY))
{
Con_Printf("Texture upload missing flags\n");
return NULL;
}
*/
if (flags & TF_MIPMAP)
tflags = 0;
else
tflags = D3DX_TEXTURE_NOMIPMAP;
D3DXCreateTexture(pD3DDev, &tflags, &twidth, &theight, &tformat, NULL, &newsurf, &nummips);
if (!newsurf)
return NULL;
if (tformat != D3DX_SF_A8R8G8B8)
Sys_Error("Couldn't create a d3d texture with a usable texture format");
Upload_Texture_32(newsurf, data, width, height);
if (flags & TF_MIPMAP)
{
LPDIRECTDRAWSURFACE7 miptex;
LPDIRECTDRAWSURFACE7 lasttex;
DDSCAPS2 caps;
memset(&caps, 0, sizeof(caps));
caps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP;
newsurf->lpVtbl->GetAttachedSurface(newsurf, &caps, &miptex);
while (miptex)
{
D3D7_MipMap(mipdata, data, width, height);
data = mipdata;
width/=2;
height/=2;
Upload_Texture_32(miptex, mipdata, width, height);
lasttex = miptex;
miptex->lpVtbl->GetAttachedSurface(miptex, &caps, &miptex);
lasttex->lpVtbl->Release(lasttex);
}
}
return newsurf;
}
//create a basic shader from an 8bit image with 24bit palette
void *D3D7_LoadTexture_8_Pal24(char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette, int transparentpix)
{
//just expands it to 32bpp and passes it on
static unsigned char out[MAX_WIDTH*MAX_HEIGHT][4];
int i;
if (!(flags & TF_ALPHA))
transparentpix = 256;
if (width*height > MAX_WIDTH*MAX_HEIGHT)
Sys_Error("GL_Upload8_Pal24: too big");
for (i = width*height; i >= 0 ; i--)
{
out[i][0] = palette[data[i]*3+0];
out[i][1] = palette[data[i]*3+1];
out[i][2] = palette[data[i]*3+2];
out[i][3] = 255*(data[i] != transparentpix);
}
return D3D7_LoadTexture_32(name, (unsigned int*)out, width, height, flags);
}
void *D3D7_LoadTexture_8_Pal32(char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette)
{
//just expands it to 32bpp and passes it on
static unsigned char out[MAX_WIDTH*MAX_HEIGHT][4];
int i;
if (width*height > MAX_WIDTH*MAX_HEIGHT)
Sys_Error("GL_Upload8_Pal24: too big");
for (i = width*height; i >= 0 ; i--)
{
out[i][0] = palette[data[i]*4+0];
out[i][1] = palette[data[i]*4+1];
out[i][2] = palette[data[i]*4+2];
out[i][3] = palette[data[i]*4+3];
}
return D3D7_LoadTexture_32(name, (unsigned int*)out, width, height, flags);
}
void D3D7_UnloadTexture(LPDIRECTDRAWSURFACE7 tex)
{
tex->lpVtbl->Release(tex);
}
static qbyte exptexture[16][16] =
{
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0},
{0,0,0,1,1,1,1,1,3,1,1,2,1,0,0,0},
{0,0,0,1,1,1,1,4,4,4,5,4,2,1,1,0},
{0,0,1,1,6,5,5,8,6,8,3,6,3,2,1,0},
{0,0,1,5,6,7,5,6,8,8,8,3,3,1,0,0},
{0,0,0,1,6,8,9,9,9,9,4,6,3,1,0,0},
{0,0,2,1,7,7,9,9,9,9,5,3,1,0,0,0},
{0,0,2,4,6,8,9,9,9,9,8,6,1,0,0,0},
{0,0,2,2,3,5,6,8,9,8,8,4,4,1,0,0},
{0,0,1,2,4,1,8,7,8,8,6,5,4,1,0,0},
{0,1,1,1,7,8,1,6,7,5,4,7,1,0,0,0},
{0,1,2,1,1,5,1,3,4,3,1,1,0,0,0,0},
{0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
};
void D3D7_InitParticleTexture (void)
{
#define PARTICLETEXTURESIZE 64
int x,y;
float dx, dy, d;
qbyte data[PARTICLETEXTURESIZE*PARTICLETEXTURESIZE][4];
//Explosion texture
for (x=0 ; x<16 ; x++)
{
for (y=0 ; y<16 ; y++)
{
data[y*16+x][0] = 255;
data[y*16+x][1] = 255;
data[y*16+x][2] = 255;
data[y*16+x][3] = exptexture[x][y]*255/9.0;
}
}
d3dexplosiontexture = D3D7_LoadTexture_32("", (unsigned int*)data, 16, 16, TF_ALPHA|TF_NOTBUMPMAP|TF_NOMIPMAP);
memset(data, 255, sizeof(data));
for (y = 0;y < PARTICLETEXTURESIZE;y++)
{
dy = (y - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1);
for (x = 0;x < PARTICLETEXTURESIZE;x++)
{
dx = (x - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1);
d = 256 * (1 - (dx*dx+dy*dy));
d = bound(0, d, 255);
data[y*PARTICLETEXTURESIZE+x][3] = (qbyte) d;
}
}
d3dballtexture = D3D7_LoadTexture_32("", (unsigned int*)data, PARTICLETEXTURESIZE, PARTICLETEXTURESIZE, TF_ALPHA|TF_NOTBUMPMAP|TF_NOMIPMAP);
}
mpic_t *(D3D7_Draw_SafePicFromWad) (char *name)
{
LPDIRECTDRAWSURFACE7 *p;
d3dcachepic_t *pic;
qpic_t *qpic;
int i;
for (i = 0; i < d3dmenu_numcachepics; i++)
{
if (!strcmp(d3dmenu_cachepics[i].name, name))
return &d3dmenu_cachepics[i].pic;
}
qpic = (qpic_t *)W_SafeGetLumpName (name);
if (!qpic)
{
return NULL;
}
SwapPic (qpic);
pic = &d3dmenu_cachepics[d3dmenu_numcachepics++];
Q_strncpyz (pic->name, name, sizeof(pic->name));
pic->pic.width = qpic->width;
pic->pic.height = qpic->height;
p = (LPDIRECTDRAWSURFACE7*)&pic->pic.d.data;
if (!strcmp(name, "conchars"))
*p = draw_chars_tex;
else
{
*p = (LPDIRECTDRAWSURFACE7)Mod_LoadReplacementTexture(pic->name, "wad", false, true, true);
if (!*p)
*p = D3D7_LoadTexture_8_Pal24(name, (unsigned char*)(qpic+1), qpic->width, qpic->height, TF_NOMIPMAP|TF_ALPHA|TF_NOTBUMPMAP, host_basepal, 255);
}
// Con_Printf("Fixme: D3D_Draw_SafePicFromWad\n");
return &pic->pic;
}
mpic_t *(D3D7_Draw_SafeCachePic) (char *path)
{
LPDIRECTDRAWSURFACE7 *p;
d3dcachepic_t *pic;
qpic_t *qpic;
int i;
for (i = 0; i < d3dmenu_numcachepics; i++)
{
if (!strcmp(d3dmenu_cachepics[i].name, path))
return &d3dmenu_cachepics[i].pic;
}
qpic = (qpic_t *)COM_LoadTempFile (path);
if (!qpic)
{
return NULL;
}
SwapPic (qpic);
pic = &d3dmenu_cachepics[d3dmenu_numcachepics++];
Q_strncpyz (pic->name, path, sizeof(pic->name));
pic->pic.width = qpic->width;
pic->pic.height = qpic->height;
p = (LPDIRECTDRAWSURFACE7*)&pic->pic.d.data;
*p = (LPDIRECTDRAWSURFACE7)Mod_LoadReplacementTexture(pic->name, "gfx", false, true, true);
if (!*p)
*p = D3D7_LoadTexture_8_Pal24(path, (unsigned char*)(qpic+1), qpic->width, qpic->height, TF_NOMIPMAP|TF_ALPHA|TF_NOTBUMPMAP, host_basepal, 255);
// Con_Printf("Fixme: D3D_Draw_SafeCachePic\n");
return &pic->pic;
}
mpic_t *(D3D7_Draw_CachePic) (char *path)
{
mpic_t *pic;
pic = D3D7_Draw_SafeCachePic(path);
if (!pic)
Sys_Error("Couldn't load picture %s", path);
return pic;
}
void (D3D7_Draw_ReInit) (void)
{
d3dmenu_numcachepics = 0;
draw_chars = W_SafeGetLumpName ("conchars");
draw_chars_tex = (LPDIRECTDRAWSURFACE7)Mod_LoadReplacementTexture("conchars", "gfx", false, true, true);
if (!draw_chars_tex)
{
if (draw_chars)
draw_chars_tex = D3D7_LoadTexture_8_Pal24("conchars", draw_chars, 128, 128, TF_NOMIPMAP|TF_ALPHA|TF_NOTBUMPMAP, host_basepal, 0);
if (!draw_chars_tex)
draw_chars_tex = (LPDIRECTDRAWSURFACE7)Mod_LoadHiResTexture("gfx/2d/bigchars.tga", NULL, false, true, false); //try q3 path
if (!draw_chars_tex)
draw_chars_tex = (LPDIRECTDRAWSURFACE7)Mod_LoadHiResTexture("pics/conchars.pcx", NULL, false, true, false); //try low res q2 path
if (!draw_chars_tex)
{
extern qbyte default_conchar[11356];
int width, height;
int i;
qbyte *image;
image = ReadTargaFile(default_conchar, sizeof(default_conchar), &width, &height, false);
for (i = 0; i < width*height; i++)
{
image[i*4+3] = image[i*4];
image[i*4+0] = 255;
image[i*4+1] = 255;
image[i*4+2] = 255;
}
draw_chars_tex = D3D7_LoadTexture_32("charset", (void*)image, width, height, TF_NOMIPMAP|TF_ALPHA|TF_NOTBUMPMAP);
}
}
//now emit the conchars picture as if from a wad.
strcpy(d3dmenu_cachepics[d3dmenu_numcachepics].name, "conchars");
d3dmenu_cachepics[d3dmenu_numcachepics].pic.width = 128;
d3dmenu_cachepics[d3dmenu_numcachepics].pic.height = 128;
*(int *)&d3dmenu_cachepics[d3dmenu_numcachepics].pic.d.data = (int)draw_chars_tex;
d3dmenu_numcachepics++;
conback_tex = D3D7_Draw_SafeCachePic("gfx/conback.lmp");
Plug_DrawReloadImages();
D3D7_InitParticleTexture();
}
void (D3D7_Draw_Init) (void)
{
D3D7_Draw_ReInit();
}
void (D3D7_Draw_Character) (int x, int y, unsigned int num)
{
int row;
int col;
float frow, fcol, size;
#define char_instep 0
num &= 255;
if (num == ' ')
return;
row = num>>4;
col = num&15;
frow = row*0.0625+char_instep;
fcol = col*0.0625+char_instep;
size = 0.0625-char_instep*2;
d3dquadvert[0].x = x;
d3dquadvert[0].y = y;
d3dquadvert[0].z = 0;
d3dquadvert[0].colour = 0xffffffff;
d3dquadvert[0].s = fcol;
d3dquadvert[0].t = frow;
d3dquadvert[1].x = x+8;
d3dquadvert[1].y = y;
d3dquadvert[1].z = 0;
d3dquadvert[1].colour = 0xffffffff;
d3dquadvert[1].s = fcol+size;
d3dquadvert[1].t = frow;
d3dquadvert[2].x = x+8;
d3dquadvert[2].y = y+8;
d3dquadvert[2].z = 0;
d3dquadvert[2].colour = 0xffffffff;
d3dquadvert[2].s = fcol+size;
d3dquadvert[2].t = frow+size;
d3dquadvert[3].x = x;
d3dquadvert[3].y = y+8;
d3dquadvert[3].z = 0;
d3dquadvert[3].colour = 0xffffffff;
d3dquadvert[3].s = fcol;
d3dquadvert[3].t = frow+size;
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, draw_chars_tex);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_TEXCOORDINDEX, 0);
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dquadvert, 4, d3dquadindexes, 6, 0);
}
void (D3D7_Draw_ColouredCharacter) (int x, int y, unsigned int num)
{
int row;
int col;
float frow, fcol, size;
unsigned int imgcolour;
unsigned char *c = (unsigned char *)&imgcolour;
#define char_instep 0
if (num&0xffff == ' ')
return;
col = (num & CON_FGMASK) >> CON_FGSHIFT;
c[0] = consolecolours[col].fb*255;
c[1] = consolecolours[col].fg*255;
c[2] = consolecolours[col].fr*255;
c[3] = (num & CON_HALFALPHA)?128:255;
num &= 0xff;
row = num>>4;
col = num&15;
frow = row*0.0625+char_instep;
fcol = col*0.0625+char_instep;
size = 0.0625-char_instep*2;
d3dquadvert[0].x = x;
d3dquadvert[0].y = y;
d3dquadvert[0].z = 0;
d3dquadvert[0].colour = imgcolour;
d3dquadvert[0].s = fcol;
d3dquadvert[0].t = frow;
d3dquadvert[1].x = x+8;
d3dquadvert[1].y = y;
d3dquadvert[1].z = 0;
d3dquadvert[1].colour = imgcolour;
d3dquadvert[1].s = fcol+size;
d3dquadvert[1].t = frow;
d3dquadvert[2].x = x+8;
d3dquadvert[2].y = y+8;
d3dquadvert[2].z = 0;
d3dquadvert[2].colour = imgcolour;
d3dquadvert[2].s = fcol+size;
d3dquadvert[2].t = frow+size;
d3dquadvert[3].x = x;
d3dquadvert[3].y = y+8;
d3dquadvert[3].z = 0;
d3dquadvert[3].colour = imgcolour;
d3dquadvert[3].s = fcol;
d3dquadvert[3].t = frow+size;
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, draw_chars_tex);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_TEXCOORDINDEX, 0);
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dquadvert, 4, d3dquadindexes, 6, 0);
}
void (D3D7_Draw_String) (int x, int y, const qbyte *str)
{
while(*str)
{
D3D7_Draw_Character(x, y, *str++);
x+=8;
}
}
void (D3D7_Draw_Alt_String) (int x, int y, const qbyte *str)
{
while(*str)
{
D3D7_Draw_Character(x, y, *str++ | 128);
x+=8;
}
}
void (D3D7_Draw_Crosshair) (void)
{
D3D7_Draw_Character(vid.width/2 - 4, vid.height/2 - 4, '+');
}
void (D3D7_Draw_DebugChar) (qbyte num)
{
Sys_Error("D3D function not implemented\n");
}
void (D3D7_Draw_TransPicTranslate) (int x, int y, int w, int h, qbyte *pic, qbyte *translation)
{
// Sys_Error("D3D function not implemented\n");
}
void (D3D7_Draw_TileClear) (int x, int y, int w, int h)
{
// Sys_Error("D3D function not implemented\n");
}
void (D3D7_Draw_Fill_I) (int x, int y, int w, int h, unsigned int imgcolour)
{
d3dquadvert[0].x = x;
d3dquadvert[0].y = y;
d3dquadvert[0].z = 0;
d3dquadvert[0].colour = imgcolour;
d3dquadvert[0].s = 0;
d3dquadvert[0].t = 0;
d3dquadvert[1].x = x+w;
d3dquadvert[1].y = y;
d3dquadvert[1].z = 0;
d3dquadvert[1].colour = imgcolour;
d3dquadvert[1].s = 0;
d3dquadvert[1].t = 0;
d3dquadvert[2].x = x+w;
d3dquadvert[2].y = y+h;
d3dquadvert[2].z = 0;
d3dquadvert[2].colour = imgcolour;
d3dquadvert[2].s = 0;
d3dquadvert[2].t = 0;
d3dquadvert[3].x = x;
d3dquadvert[3].y = y+h;
d3dquadvert[3].z = 0;
d3dquadvert[3].colour = imgcolour;
d3dquadvert[3].s = 0;
d3dquadvert[3].t = 0;
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, NULL);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHATESTENABLE, FALSE );
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHABLENDENABLE, TRUE );
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA);
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA);
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dquadvert, 4, d3dquadindexes, 6, 0);
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHABLENDENABLE, FALSE );
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHATESTENABLE, TRUE );
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
}
void (D3D7_Draw_FillRGB) (int x, int y, int w, int h, float r, float g, float b)
{
char colours[4];
colours[0] = b*255;
colours[1] = g*255;
colours[2] = r*255;
colours[3] = 255;
D3D7_Draw_Fill_I(x, y, w, h, *(unsigned int*)colours);
}
void (D3D7_Draw_Fill) (int x, int y, int w, int h, unsigned int c)
{
D3D7_Draw_FillRGB(x, y, w, h, host_basepal[c*3+0]/255.0f, host_basepal[c*3+1]/255.0f, host_basepal[c*3+2]/255.0f);
}
void (D3D7_Draw_FadeScreen) (void)
{
// Sys_Error("D3D function not implemented\n");
}
void (D3D7_Draw_BeginDisc) (void)
{
// Sys_Error("D3D function not implemented\n");
}
void (D3D7_Draw_EndDisc) (void)
{
// Sys_Error("D3D function not implemented\n");
}
static int imgcolour;
void (D3D7_Draw_Fill_Colours) (int x, int y, int w, int h)
{
D3D7_Draw_Fill_I(x, y, w, h, imgcolour);
}
void (D3D7_Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic)
{
LPDIRECTDRAWSURFACE7 *p;
if (!conback_tex)
return;
if (!pic)
return;
d3dquadvert[0].x = x;
d3dquadvert[0].y = y;
d3dquadvert[0].z = 0;
d3dquadvert[0].colour = imgcolour;
d3dquadvert[0].s = s1;// - 3.0/pic->width;
d3dquadvert[0].t = t1;
d3dquadvert[1].x = x+w;
d3dquadvert[1].y = y;
d3dquadvert[1].z = 0;
d3dquadvert[1].colour = imgcolour;
d3dquadvert[1].s = s2;// - 3.0/pic->width;
d3dquadvert[1].t = t1;
d3dquadvert[2].x = x+w;
d3dquadvert[2].y = y+h;
d3dquadvert[2].z = 0;
d3dquadvert[2].colour = imgcolour;
d3dquadvert[2].s = s2;// - 3.0/pic->width;
d3dquadvert[2].t = t2;
d3dquadvert[3].x = x;
d3dquadvert[3].y = y+h;
d3dquadvert[3].z = 0;
d3dquadvert[3].colour = imgcolour;
d3dquadvert[3].s = s1;// - 3.0/pic->width;
d3dquadvert[3].t = t2;
p = (LPDIRECTDRAWSURFACE7*)&pic->d.data;
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, *p);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_TEXCOORDINDEX, 0);
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dquadvert, 4, d3dquadindexes, 6, 0);
}
void (D3D7_Draw_ScalePic) (int x, int y, int width, int height, mpic_t *pic)
{
D3D7_Draw_Image(x, y, width, height, 0, 0, 1, 1, pic);
}
void (D3D7_Draw_SubPic) (int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height)
{
float s, t;
float sw, tw;
if (!pic)
return;
s = (float)srcx/pic->width;
t = (float)srcy/pic->height;
sw = (float)width/pic->width;
tw = (float)height/pic->height;
D3D7_Draw_Image(x, y, width, height, s, t, s+sw, t+tw, pic);
}
void (D3D7_Draw_TransPic) (int x, int y, mpic_t *pic)
{
if (!pic)
return;
D3D7_Draw_Image(x, y, pic->width, pic->height, 0, 0, 1, 1, pic);
}
void (D3D7_Draw_Pic) (int x, int y, mpic_t *pic)
{
if (!pic)
return;
D3D7_Draw_Image(x, y, pic->width, pic->height, 0, 0, 1, 1, pic);
}
void (D3D7_Draw_ImageColours) (float r, float g, float b, float a)
{
unsigned char *c = (unsigned char *)&imgcolour;
c[0] = b*255;
c[1] = g*255;
c[2] = r*255;
c[3] = a*255;
}
void (D3D7_Draw_ConsoleBackground) (int firstline, int lastline, qboolean forceopaque)
{
D3D7_Draw_ImageColours(1,1,1,1);
D3D7_Draw_Image(0, 0, vid.width, lastline, 0, 1 - (float)lastline/vid.height, 1, 1, conback_tex);
}
void (D3D7_Draw_EditorBackground) (int lines)
{
D3D7_Draw_ConsoleBackground(0, lines, false);
}
void (D3D7_Media_ShowFrameBGR_24_Flip) (qbyte *framedata, int inwidth, int inheight)
{
mpic_t pic;
LPDIRECTDRAWSURFACE7 *p;
p = (LPDIRECTDRAWSURFACE7*)&pic.d.data;
*p = D3D7_LoadTexture_32("", (unsigned int*)framedata, inwidth, inheight, TF_NOMIPMAP|TF_NOALPHA|TF_NOTBUMPMAP);
D3D7_Set2D ();
D3D7_Draw_ImageColours(1,1,1,1);
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHATESTENABLE, FALSE );
D3D7_Draw_Image(0, 0, vid.width, vid.height, 0, 1, 1, 0, &pic);
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHATESTENABLE, TRUE );
D3D7_UnloadTexture(*p);
} //input is bottom up...
void (D3D7_Media_ShowFrameRGBA_32) (qbyte *framedata, int inwidth, int inheight)
{
mpic_t pic;
LPDIRECTDRAWSURFACE7 *p;
pic.width = inwidth;
pic.height = inheight;
pic.flags = 0;
p = (LPDIRECTDRAWSURFACE7*)&pic.d.data;
*p = D3D7_LoadTexture_32("", (unsigned int*)framedata, inwidth, inheight, TF_NOMIPMAP|TF_NOALPHA|TF_NOTBUMPMAP);
D3D7_Set2D ();
D3D7_Draw_ImageColours(1,1,1,1);
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHATESTENABLE, FALSE );
D3D7_Draw_Image(0, 0, vid.width, vid.height, 0, 0, 1, 1, &pic);
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHATESTENABLE, TRUE );
D3D7_UnloadTexture(*p);
} //top down
void (D3D7_Media_ShowFrame8bit) (qbyte *framedata, int inwidth, int inheight, qbyte *palette)
{
mpic_t pic;
LPDIRECTDRAWSURFACE7 *p;
p = (LPDIRECTDRAWSURFACE7*)&pic.d.data;
*p = D3D7_LoadTexture_8_Pal24("", (unsigned char*)framedata, inwidth, inheight, TF_NOMIPMAP|TF_NOALPHA|TF_NOTBUMPMAP, palette, 256);
D3D7_Set2D ();
D3D7_Draw_ImageColours(1,1,1,1);
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHATESTENABLE, FALSE );
D3D7_Draw_Image(0, 0, vid.width, vid.height, 0, 1, 1, 0, &pic);
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHATESTENABLE, TRUE );
D3D7_UnloadTexture(*p);
} //paletted topdown (framedata is 8bit indexes into palette)
#endif

View file

@ -1,681 +0,0 @@
#include "quakedef.h"
#ifdef D3DQUAKE
#include "d3dquake.h"
#include "com_mesh.h"
#ifdef _WIN32
#include <malloc.h>
#else
#include <alloca.h>
#endif
extern cvar_t r_fullbrightSkins;
extern cvar_t r_vertexdlights;
typedef struct {
float x, y, z;
float s, t;
} meshvert_t;
typedef struct {
float x, y, z;
unsigned int colour;
float s, t;
} meshcolouredvert_t;
void D3D_DrawMesh(mesh_t *mesh)
{
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG2, D3DTA_CURRENT);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
{
int v;
vec3_t *xyz;
byte_vec4_t *colour;
vec2_t *wm;
xyz = mesh->xyz_array;
wm = mesh->st_array;
colour = mesh->colors_array;
if (colour)
{
meshcolouredvert_t *meshvert = alloca(sizeof(meshcolouredvert_t)*mesh->numvertexes);
for (v = 0; v < mesh->numvertexes; v++, xyz++, wm++, colour++)
{
meshvert[v].x = (*xyz)[0];
meshvert[v].y = (*xyz)[1];
meshvert[v].z = (*xyz)[2];
meshvert[v].colour = *(unsigned int*)colour;
meshvert[v].s = (*wm)[0];
meshvert[v].t = (*wm)[1];
}
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, meshvert, mesh->numvertexes, mesh->indexes, mesh->numindexes, 0);
}
else
{
meshvert_t *meshvert = alloca(sizeof(meshvert_t)*mesh->numvertexes);
for (v = 0; v < mesh->numvertexes; v++, xyz++, wm++)
{
meshvert[v].x = (*xyz)[0];
meshvert[v].y = (*xyz)[1];
meshvert[v].z = (*xyz)[2];
meshvert[v].s = (*wm)[0];
meshvert[v].t = (*wm)[1];
}
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_TEX1, meshvert, mesh->numvertexes, mesh->indexes, mesh->numindexes, 0);
}
}
}
hashtable_t skincolourmapped;
void d3d_GAliasFlushSkinCache(void)
{
int i;
bucket_t *b;
for (i = 0; i < skincolourmapped.numbuckets; i++)
{
while((b = skincolourmapped.bucket[i]))
{
skincolourmapped.bucket[i] = b->next;
BZ_Free(b->data);
}
}
if (skincolourmapped.bucket)
BZ_Free(skincolourmapped.bucket);
skincolourmapped.bucket = NULL;
skincolourmapped.numbuckets = 0;
}
static galiastexnum_t *D3D7_ChooseSkin(galiasinfo_t *inf, char *modelname, int surfnum, entity_t *e)
{
galiasskin_t *skins;
galiastexnum_t *texnums;
int frame;
int tc, bc;
int local;
if (!gl_nocolors.value)
{
if (e->scoreboard)
{
if (!e->scoreboard->skin)
Skin_Find(e->scoreboard);
tc = e->scoreboard->ttopcolor;
bc = e->scoreboard->tbottomcolor;
}
else
{
tc = 1;
bc = 1;
}
if (tc != 1 || bc != 1 || (e->scoreboard && e->scoreboard->skin))
{
int inwidth, inheight;
int tinwidth, tinheight;
char *skinname;
qbyte *original;
galiascolourmapped_t *cm;
char hashname[512];
if (e->scoreboard && e->scoreboard->skin && !gl_nocolors.value)
{
snprintf(hashname, sizeof(hashname), "%s$%s$%i", modelname, e->scoreboard->skin->name, surfnum);
skinname = hashname;
}
else if (surfnum)
{
snprintf(hashname, sizeof(hashname), "%s$%i", modelname, surfnum);
skinname = hashname;
}
else
skinname = modelname;
if (!skincolourmapped.numbuckets)
{
void *buckets = BZ_Malloc(Hash_BytesForBuckets(256));
memset(buckets, 0, Hash_BytesForBuckets(256));
Hash_InitTable(&skincolourmapped, 256, buckets);
}
for (cm = Hash_Get(&skincolourmapped, skinname); cm; cm = Hash_GetNext(&skincolourmapped, skinname, cm))
{
if (cm->tcolour == tc && cm->bcolour == bc && cm->skinnum == e->skinnum)
{
return &cm->texnum;
}
}
if (!inf->numskins)
{
skins = NULL;
texnums = NULL;
}
else
{
skins = (galiasskin_t*)((char *)inf + inf->ofsskins);
if (!skins->texnums)
{
skins = NULL;
texnums = NULL;
}
else
{
if (e->skinnum >= 0 && e->skinnum < inf->numskins)
skins += e->skinnum;
texnums = (galiastexnum_t*)((char *)skins + skins->ofstexnums);
}
}
//colourmap isn't present yet.
cm = BZ_Malloc(sizeof(*cm));
Q_strncpyz(cm->name, skinname, sizeof(cm->name));
Hash_Add(&skincolourmapped, cm->name, cm, &cm->bucket);
cm->tcolour = tc;
cm->bcolour = bc;
cm->skinnum = e->skinnum;
cm->texnum.fullbright = 0;
cm->texnum.base = 0;
#ifdef Q3SHADERS
cm->texnum.shader = NULL;
#endif
if (!texnums)
{ //load just the skin (q2)
/* if (e->scoreboard && e->scoreboard->skin)
{
if (cls.protocol == CP_QUAKE2)
{
original = Skin_Cache32(e->scoreboard->skin);
if (original)
{
inwidth = e->scoreboard->skin->width;
inheight = e->scoreboard->skin->height;
cm->texnum.base = cm->texnum.fullbright = GL_LoadTexture32(e->scoreboard->skin->name, inwidth, inheight, (unsigned int*)original, true, false);
return &cm->texnum;
}
}
else
{
original = Skin_Cache8(e->scoreboard->skin);
if (original)
{
inwidth = e->scoreboard->skin->width;
inheight = e->scoreboard->skin->height;
cm->texnum.base = cm->texnum.fullbright = GL_LoadTexture(e->scoreboard->skin->name, inwidth, inheight, original, true, false);
return &cm->texnum;
}
}
cm->texnum.base = Mod_LoadHiResTexture(e->scoreboard->skin->name, "skins", true, false, true);
return &cm->texnum;
}
*/
return NULL;
}
cm->texnum.bump = texnums[cm->skinnum].bump; //can't colour bumpmapping
if (cls.protocol != CP_QUAKE2 && ((!texnums || !strcmp(modelname, "progs/player.mdl")) && e->scoreboard && e->scoreboard->skin))
{
original = Skin_Cache8(e->scoreboard->skin);
inwidth = e->scoreboard->skin->width;
inheight = e->scoreboard->skin->height;
}
else
{
original = NULL;
inwidth = 0;
inheight = 0;
}
if (!original)
{
if (skins->ofstexels)
{
original = (qbyte *)skins + skins->ofstexels;
inwidth = skins->skinwidth;
inheight = skins->skinheight;
}
else
{
original = NULL;
inwidth = 0;
inheight = 0;
}
}
tinwidth = skins->skinwidth;
tinheight = skins->skinheight;
if (original)
{
int i, j;
qbyte translate[256];
unsigned translate32[256];
static unsigned pixels[512*512];
unsigned *out;
unsigned frac, fracstep;
unsigned scaled_width, scaled_height;
qbyte *inrow;
texnums = &cm->texnum;
texnums->base = 0;
texnums->fullbright = 0;
if (gl_max_size.value <= 0)
gl_max_size.value = 512;
scaled_width = gl_max_size.value < 512 ? gl_max_size.value : 512;
scaled_height = gl_max_size.value < 512 ? gl_max_size.value : 512;
for (i=0 ; i<256 ; i++)
translate[i] = i;
tc<<=4;
bc<<=4;
for (i=0 ; i<16 ; i++)
{
if (tc < 128) // the artists made some backwards ranges. sigh.
translate[TOP_RANGE+i] = tc+i;
else
translate[TOP_RANGE+i] = tc+15-i;
if (bc < 128)
translate[BOTTOM_RANGE+i] = bc+i;
else
translate[BOTTOM_RANGE+i] = bc+15-i;
}
for (i=0 ; i<256 ; i++)
translate32[i] = d_8to24rgbtable[translate[i]];
out = pixels;
fracstep = tinwidth*0x10000/scaled_width;
for (i=0 ; i<scaled_height ; i++, out += scaled_width)
{
inrow = original + inwidth*(i*inheight/scaled_height);
frac = fracstep >> 1;
for (j=0 ; j<scaled_width ; j+=4)
{
out[j] = translate32[inrow[frac>>16]] | 0xff000000;
frac += fracstep;
out[j+1] = translate32[inrow[frac>>16]] | 0xff000000;
frac += fracstep;
out[j+2] = translate32[inrow[frac>>16]] | 0xff000000;
frac += fracstep;
out[j+3] = translate32[inrow[frac>>16]] | 0xff000000;
frac += fracstep;
}
}
texnums->base = D3D7_LoadTexture_32 ("", pixels, scaled_width, scaled_height, 0);
/* texnums->base = texture_extension_number++;
GL_Bind(texnums->base);
qglTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
*/
//now do the fullbrights.
out = pixels;
fracstep = tinwidth*0x10000/scaled_width;
for (i=0 ; i<scaled_height ; i++, out += scaled_width)
{
inrow = original + inwidth*(i*inheight/scaled_height);
frac = fracstep >> 1;
for (j=0 ; j<scaled_width ; j+=1)
{
if (inrow[frac>>16] < 255-vid.fullbright)
((char *) (&out[j]))[3] = 0; //alpha 0
frac += fracstep;
}
}
/* texnums->fullbright = texture_extension_number++;
GL_Bind(texnums->fullbright);
qglTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
*/
}
else
{
skins = (galiasskin_t*)((char *)inf + inf->ofsskins);
if (e->skinnum >= 0 && e->skinnum < inf->numskins)
skins += e->skinnum;
if (!inf->numskins || !skins->texnums)
return NULL;
frame = cl.time*skins->skinspeed;
frame = frame%skins->texnums;
texnums = (galiastexnum_t*)((char *)skins + skins->ofstexnums + frame*sizeof(galiastexnum_t));
memcpy(&cm->texnum, texnums, sizeof(cm->texnum));
}
return &cm->texnum;
}
}
if (!inf->numskins)
return NULL;
skins = (galiasskin_t*)((char *)inf + inf->ofsskins);
if (e->skinnum >= 0 && e->skinnum < inf->numskins)
skins += e->skinnum;
else
{
Con_DPrintf("Skin number out of range\n");
if (!inf->numskins)
return NULL;
}
if (!skins->texnums)
return NULL;
frame = cl.time*skins->skinspeed;
frame = frame%skins->texnums;
texnums = (galiastexnum_t*)((char *)skins + skins->ofstexnums + frame*sizeof(galiastexnum_t));
return texnums;
}
extern vec3_t shadevector;
extern vec3_t ambientlight;
extern vec3_t shadelight;
static void LotsOfLightDirectionHacks(entity_t *e, model_t *m, vec3_t lightaxis[3])
{
int i;
vec3_t dist;
float add;
qboolean nolightdir;
vec3_t lightdir;
if (!(r_refdef.flags & Q2RDF_NOWORLDMODEL))
{
if (e->flags & Q2RF_WEAPONMODEL)
cl.worldmodel->funcs.LightPointValues(cl.worldmodel, r_refdef.vieworg, shadelight, ambientlight, lightdir);
else
cl.worldmodel->funcs.LightPointValues(cl.worldmodel, e->origin, shadelight, ambientlight, lightdir);
}
else
{
ambientlight[0] = ambientlight[1] = ambientlight[2] = shadelight[0] = shadelight[1] = shadelight[2] = 255;
lightdir[0] = 0;
lightdir[1] = 1;
lightdir[2] = 1;
}
if (!r_vertexdlights.value)
{
for (i=0 ; i<dlights_running ; i++)
{
if (cl_dlights[i].radius)
{
VectorSubtract (e->origin,
cl_dlights[i].origin,
dist);
add = cl_dlights[i].radius - Length(dist);
if (add > 0) {
add*=5;
ambientlight[0] += add * cl_dlights[i].color[0];
ambientlight[1] += add * cl_dlights[i].color[1];
ambientlight[2] += add * cl_dlights[i].color[2];
//ZOID models should be affected by dlights as well
shadelight[0] += add * cl_dlights[i].color[0];
shadelight[1] += add * cl_dlights[i].color[1];
shadelight[2] += add * cl_dlights[i].color[2];
}
}
}
}
else
{
}
for (i = 0; i < 3; i++) //clamp light so it doesn't get vulgar.
{
if (ambientlight[i] > 128)
ambientlight[i] = 128;
if (ambientlight[i] + shadelight[i] > 192)
shadelight[i] = 192 - ambientlight[i];
}
if (e->flags & Q2RF_WEAPONMODEL)
{
for (i = 0; i < 3; i++)
{
if (ambientlight[i] < 24)
ambientlight[i] = shadelight[i] = 24;
}
}
//MORE HUGE HACKS! WHEN WILL THEY CEASE!
// clamp lighting so it doesn't overbright as much
// ZOID: never allow players to go totally black
nolightdir = false;
if (m->engineflags & MDLF_PLAYER)
{
float fb = r_fullbrightSkins.value;
if (fb > cls.allow_fbskins)
fb = cls.allow_fbskins;
if (fb < 0)
fb = 0;
if (fb)
{
extern cvar_t r_fb_models;
if (fb >= 1 && r_fb_models.value)
{
ambientlight[0] = ambientlight[1] = ambientlight[2] = 4096;
shadelight[0] = shadelight[1] = shadelight[2] = 4096;
nolightdir = true;
}
else
{
for (i = 0; i < 3; i++)
{
ambientlight[i] = max(ambientlight[i], 8 + fb * 120);
shadelight[i] = max(shadelight[i], 8 + fb * 120);
}
}
}
for (i = 0; i < 3; i++)
{
if (ambientlight[i] < 8)
ambientlight[i] = shadelight[i] = 8;
}
}
if (m->engineflags & MDLF_FLAME)
{
shadelight[0] = shadelight[1] = shadelight[2] = 4096;
ambientlight[0] = ambientlight[1] = ambientlight[2] = 4096;
nolightdir = true;
}
else
{
for (i = 0; i < 3; i++)
{
if (ambientlight[i] > 128)
ambientlight[i] = 128;
shadelight[i] /= 200.0/255;
ambientlight[i] /= 200.0/255;
}
}
if ((e->drawflags & MLS_MASKIN) == MLS_ABSLIGHT)
{
shadelight[0] = shadelight[1] = shadelight[2] = e->abslight;
ambientlight[0] = ambientlight[1] = ambientlight[2] = 0;
}
if ((e->drawflags & MLS_MASKIN) == MLS_FULLBRIGHT || (e->flags & Q2RF_FULLBRIGHT))
{
shadelight[0] = shadelight[1] = shadelight[2] = 255;
ambientlight[0] = ambientlight[1] = ambientlight[2] = 0;
nolightdir = true;
}
//#define SHOWLIGHTDIR
{ //lightdir is absolute, shadevector is relative
shadevector[0] = DotProduct(lightdir, e->axis[0]);
shadevector[1] = DotProduct(lightdir, e->axis[1]);
shadevector[2] = DotProduct(lightdir, e->axis[2]);
if (e->flags & Q2RF_WEAPONMODEL)
{
vec3_t temp;
temp[0] = DotProduct(shadevector, vpn);
temp[1] = DotProduct(shadevector, vright);
temp[2] = DotProduct(shadevector, vup);
VectorCopy(temp, shadevector);
}
VectorNormalize(shadevector);
VectorCopy(shadevector, lightaxis[2]);
VectorVectors(lightaxis[2], lightaxis[1], lightaxis[0]);
VectorInverse(lightaxis[1]);
}
if (e->flags & Q2RF_GLOW)
{
shadelight[0] += sin(cl.time)*0.25;
shadelight[1] += sin(cl.time)*0.25;
shadelight[2] += sin(cl.time)*0.25;
}
//d3d is bgra
//ogl is rgba
//so switch em and use the gl code
add = shadelight[0];
shadelight[0] = shadelight[2];
shadelight[2] = add;
add = ambientlight[0];
ambientlight[0] = ambientlight[2];
ambientlight[2] = add;
}
qboolean R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, int frame2, float lerp, float alpha, float fg1time, float fg2time, qboolean nolightdir);
//draws currententity
void D3D7_DrawAliasModel(void)
{
mesh_t mesh;
extern entity_t *currententity;
entity_t *e = currententity;
galiasinfo_t *inf;
model_t *m;
galiastexnum_t *skin;
int i;
if (r_secondaryview && e->flags & Q2RF_WEAPONMODEL)
return;
{
extern int cl_playerindex;
if (e->scoreboard && e->model == cl.model_precache[cl_playerindex])
{
m = e->scoreboard->model;
if (!m || m->type != mod_alias)
m = e->model;
}
else
m = e->model;
}
if (!(e->flags & Q2RF_WEAPONMODEL))
if (R_CullEntityBox (e, m->mins, m->maxs))
return;
inf = GLMod_Extradata (m);
if (!inf)
return;
LotsOfLightDirectionHacks(e, m, mesh.lightaxis);
{
float matrix[16];
if (e->flags & Q2RF_WEAPONMODEL && r_refdef.currentplayernum>=0)
{ //view weapons need to be rotated onto the screen first
float view[16];
float ent[16];
Matrix4_ModelMatrixFromAxis(view, cl.viewent[r_refdef.currentplayernum].axis[0], cl.viewent[r_refdef.currentplayernum].axis[1], cl.viewent[r_refdef.currentplayernum].axis[2], cl.viewent[r_refdef.currentplayernum].origin);
Matrix4_ModelMatrixFromAxis(ent, e->axis[0], e->axis[1], e->axis[2], e->origin);
Matrix4_Multiply(view, ent, matrix);
}
else
{
Matrix4_ModelMatrixFromAxis(matrix, e->axis[0], e->axis[1], e->axis[2], e->origin);
}
pD3DDev->lpVtbl->SetTransform(pD3DDev, D3DTRANSFORMSTATE_WORLD, (D3DMATRIX*)matrix);
}
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
if (e->flags & Q2RF_DEPTHHACK)
{ //apply the depth hack to stop things from poking into walls.
//(basically moving it closer to the screen)
D3DVIEWPORT7 viewport;
pD3DDev->lpVtbl->GetViewport(pD3DDev, &viewport);
viewport.dvMinZ = 0;
viewport.dvMaxZ = 0.3;
pD3DDev->lpVtbl->SetViewport(pD3DDev, &viewport);
}
for(i = 0;; i++)
{
Alias_GAliasBuildMesh(&mesh, inf, e, e->shaderRGBAf[3], false);
skin = D3D7_ChooseSkin(inf, m->name, e->skinnum, e);
if (!skin)
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, NULL);
else
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, skin->base);
D3D_DrawMesh(&mesh);
if (inf->nextsurf == 0)
break;
inf = (galiasinfo_t*)((char*)inf + inf->nextsurf);
}
if (e->flags & Q2RF_DEPTHHACK)
{
D3DVIEWPORT7 viewport;
pD3DDev->lpVtbl->GetViewport(pD3DDev, &viewport);
viewport.dvMinZ = 0;
viewport.dvMaxZ = 1;
pD3DDev->lpVtbl->SetViewport(pD3DDev, &viewport);
}
{
float matrix[16];
Matrix4_Identity(matrix);
pD3DDev->lpVtbl->SetTransform(pD3DDev, D3DTRANSFORMSTATE_WORLD, (D3DMATRIX*)matrix);
}
}
#endif

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,84 +0,0 @@
#ifndef __D3DQUAKE_H__
#define __D3DQUAKE_H__
#ifdef __GNUC__
#define _inline static inline
#endif
#include "ddraw.h"
#include "d3d.h"
#include "d3dx.h"
#include "glquake.h"
void *D3D7_LoadTexture_32(char *name, unsigned int *data, int width, int height, int flags);
void *D3D7_LoadTexture_8_Pal24(char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette, int transparentpix);
void *D3D7_LoadTexture_8_Pal32(char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette);
/*
#define D3D9_LoadTexture8Pal32(skinname,width,height,data,palette,usemips,alpha) (int)D3D9_LoadTexture_8_Pal32(skinname, data, width, height, (usemips?TF_MIPMAP:TF_NOMIPMAP) | (alpha?TF_ALPHA:TF_NOALPHA) | TF_NOTBUMPMAP, host_basepal)
#define D3D9_LoadTexture(skinname,width,height,data,usemips,alpha) (int)D3D9_LoadTexture_8_Pal24(skinname, data, width, height, (usemips?TF_MIPMAP:TF_NOMIPMAP) | (alpha?TF_ALPHA:TF_NOALPHA) | TF_NOTBUMPMAP, host_basepal, 255)
#define D3D9_LoadTexture32(skinname,width,height,data,usemips,alpha) (int)D3D9_LoadTexture_32(skinname, data, width, height, (usemips?TF_MIPMAP:TF_NOMIPMAP) | (alpha?TF_ALPHA:TF_NOALPHA) | TF_NOTBUMPMAP)
#define D3D9_LoadTextureFB(skinname,width,height,data,usemips,alpha) 0
#define D3D9_LoadTexture8Bump(skinname,width,height,data,usemips,alpha) 0
#define D3D9_FindTexture(name) -1
#define D3D9_LoadCompressed(name) 0
*/
void *D3D9_LoadTexture_32(char *name, unsigned int *data, int width, int height, int flags);
void *D3D9_LoadTexture_8_Pal24(char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette, int transparentpix);
void *D3D9_LoadTexture_8_Pal32(char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette);
#define D3D_LoadTexture8Pal32(skinname,width,height,data,palette,usemips,alpha) (int)(pD3DDev?D3D7_LoadTexture_8_Pal32:D3D9_LoadTexture_8_Pal32)(skinname, data, width, height, (usemips?TF_MIPMAP:TF_NOMIPMAP) | (alpha?TF_ALPHA:TF_NOALPHA) | TF_NOTBUMPMAP, palette)
#define D3D_LoadTexture8Pal24(skinname,width,height,data,palette,usemips,alpha) (int)(pD3DDev?D3D7_LoadTexture_8_Pal24:D3D9_LoadTexture_8_Pal24)(skinname, data, width, height, (usemips?TF_MIPMAP:TF_NOMIPMAP) | (alpha?TF_ALPHA:TF_NOALPHA) | TF_NOTBUMPMAP, palette, 255)
#define D3D_LoadTexture(skinname,width,height,data,usemips,alpha) (int)(pD3DDev?D3D7_LoadTexture_8_Pal24:D3D9_LoadTexture_8_Pal24)(skinname, data, width, height, (usemips?TF_MIPMAP:TF_NOMIPMAP) | (alpha?TF_ALPHA:TF_NOALPHA) | TF_NOTBUMPMAP, host_basepal, 255)
#define D3D_LoadTexture32(skinname,width,height,data,usemips,alpha) (int)(pD3DDev?D3D7_LoadTexture_32:D3D9_LoadTexture_32)(skinname, data, width, height, (usemips?TF_MIPMAP:TF_NOMIPMAP) | (alpha?TF_ALPHA:TF_NOALPHA) | TF_NOTBUMPMAP)
#define D3D_LoadTextureFB(skinname,width,height,data,usemips,alpha) 0
#define D3D_LoadTexture8Bump(skinname,width,height,data,usemips,alpha) 0
#define D3D_FindTexture(name) -1
#define D3D_LoadCompressed(name) 0
extern LPDIRECT3DDEVICE7 pD3DDev;
extern int d_lightstylevalue[256]; // 8.8 fraction of base light value
#define lightmap_bytes 4
extern int numlightmaps;
extern mvertex_t *r_pcurrentvertbase;
#ifndef LMBLOCK_WIDTH
#define LMBLOCK_WIDTH 128
#define LMBLOCK_HEIGHT LMBLOCK_WIDTH
typedef struct glRect_s {
unsigned char l,t,w,h;
} glRect_t;
typedef unsigned char stmap;
typedef struct {
qboolean modified;
qboolean deluxmodified;
glRect_t rectchange;
glRect_t deluxrectchange;
int allocated[LMBLOCK_WIDTH];
qbyte lightmaps[4*LMBLOCK_WIDTH*LMBLOCK_HEIGHT];
qbyte deluxmaps[4*LMBLOCK_WIDTH*LMBLOCK_HEIGHT]; //fixme: make seperate structure for easy disabling with less memory usage.
stmap stainmaps[3*LMBLOCK_WIDTH*LMBLOCK_HEIGHT]; //rgb no a. added to lightmap for added (hopefully) speed.
} lightmapinfo_t;
#endif
extern LPDIRECTDRAWSURFACE7 *lightmap_d3dtextures;
extern LPDIRECTDRAWSURFACE7 *deluxmap_d3dtextures;
extern lightmapinfo_t **lightmap;
extern void *d3dexplosiontexture;
extern void *d3dballtexture;
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,883 +0,0 @@
#include "quakedef.h"
#ifdef D3DQUAKE
#include "winquake.h"
#include "d3d9quake.h"
#define MAX_WIDTH 512
#define MAX_HEIGHT 512
void *d3dexplosiontexture;
void *d3dballtexture;
LPDIRECT3DBASETEXTURE9 d3d9chars_tex;
mpic_t *conback_tex;
extern cvar_t gl_picmip;
extern cvar_t gl_picmip2d;
typedef struct d3dcachepic_s
{
char name[MAX_QPATH];
mpic_t pic;
} d3dcachepic_t;
#define MAX_CACHED_PICS 512 //a temporary solution
d3dcachepic_t d3dmenu_cachepics[MAX_CACHED_PICS];
int d3dmenu_numcachepics;
#ifdef MINGW // these are undefined in MinGW
const unsigned int TF_COLOR = 1;
const unsigned int TF_ALPHA = 2;
const unsigned int TF_MASKED = 4;
const unsigned int TF_MIPMAP = 8;
const unsigned int TF_CLAMP = 16;
const unsigned int TF_ANISOTROPIC = 32;
const unsigned int TF_SPHEREMAP = 64;
const unsigned int TF_CUBEMAP = 128;
const unsigned int TF_NORMALCUBE = 512;
const unsigned int TF_NOTBUMPMAP = 0; //made this up
const unsigned int TF_NOMIPMAP = 0; //made this up
const unsigned int TF_NOALPHA = 0; //made this up
#endif
typedef struct {
float x, y, z;
int colour;
float s, t;
} d3dquadvert_t;
d3dquadvert_t d3d9quadvert[4];
index_t d3d9quadindexes[6] = {
0, 1, 2,
0, 2, 3
};
//pD3DDev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX2, d3dstate.vertbuf, d3dstate.numverts, d3dstate.indexbuf, d3dstate.numindicies, 0);
static void Upload_Texture_32(LPDIRECT3DTEXTURE9 surf, unsigned int *data, int width, int height)
{
int x, y;
unsigned int *dest;
unsigned char swapbuf[4];
unsigned char swapbuf2[4];
D3DLOCKED_RECT lock;
D3DSURFACE_DESC desc;
IDirect3DTexture9_GetLevelDesc(surf, 0, &desc);
IDirect3DTexture9_LockRect(surf, 0, &lock, NULL, DDLOCK_NOSYSLOCK|D3DLOCK_READONLY);
//(surf, NULL, &desc, DDLOCK_NOSYSLOCK|DDLOCK_WAIT|DDLOCK_WRITEONLY|DDLOCK_DISCARDCONTENTS, NULL);
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++)
{
dest = (unsigned int *)((char *)lock.pBits + lock.Pitch*y);
for (x = 0; x < width; x++)
{
*(unsigned int*)swapbuf2 = *(unsigned int*)swapbuf = data[x];
swapbuf[0] = swapbuf2[2];
swapbuf[2] = swapbuf2[0];
dest[x] = *(unsigned int*)swapbuf;
}
data += width;
}
}
}
else
{
int x, y;
int iny;
unsigned int *row, *inrow;
for (y = 0; y < desc.Height; y++)
{
row = (unsigned int*)((char *)lock.pBits + lock.Pitch*y);
iny = (y * height) / desc.Height;
inrow = data + width*iny;
for (x = 0; x < desc.Width; x++)
{
*(unsigned int*)swapbuf2 = *(unsigned int*)swapbuf = inrow[(x * width)/desc.Width];
swapbuf[0] = swapbuf2[2];
swapbuf[2] = swapbuf2[0];
row[x] = *(unsigned int*)swapbuf;
}
}
//mimic opengl and draw it white
// memset(desc.lpSurface, 255, twidth*theight*4);
}
IDirect3DTexture9_UnlockRect(surf, 0);
}
void D3D9_RoundDimensions(int *scaled_width, int *scaled_height, qboolean mipmap)
{
// if (gl_config.arb_texture_non_power_of_two) //NPOT is a simple extension that relaxes errors.
// {
// TRACE(("dbg: GL_RoundDimensions: GL_ARB_texture_non_power_of_two\n"));
// }
// else
{
int width = *scaled_width;
int height = *scaled_height;
for (*scaled_width = 1 ; *scaled_width < width ; *scaled_width<<=1)
;
for (*scaled_height = 1 ; *scaled_height < height ; *scaled_height<<=1)
;
}
if (mipmap)
{
TRACE(("dbg: GL_RoundDimensions: %i\n", gl_picmip.ival));
*scaled_width >>= gl_picmip.ival;
*scaled_height >>= gl_picmip.ival;
}
else
{
*scaled_width >>= gl_picmip2d.ival;
*scaled_height >>= gl_picmip2d.ival;
}
TRACE(("dbg: GL_RoundDimensions: %i\n", gl_max_size.ival));
if (gl_max_size.ival)
{
if (*scaled_width > gl_max_size.ival)
*scaled_width = gl_max_size.ival;
if (*scaled_height > gl_max_size.ival)
*scaled_height = gl_max_size.ival;
}
if (*scaled_width < 1)
*scaled_width = 1;
if (*scaled_height < 1)
*scaled_height = 1;
}
void D3D9_MipMap (qbyte *out, qbyte *in, int width, int height)
{
int i, j;
width <<=2;
height >>= 1;
for (i=0 ; i<height ; i++, in+=width)
{
for (j=0 ; j<width ; j+=8, out+=4, in+=8)
{
out[0] = (in[0] + in[4] + in[width+0] + in[width+4])>>2;
out[1] = (in[1] + in[5] + in[width+1] + in[width+5])>>2;
out[2] = (in[2] + in[6] + in[width+2] + in[width+6])>>2;
out[3] = (in[3] + in[7] + in[width+3] + in[width+7])>>2;
}
}
}
//create a basic shader from a 32bit image
LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_32(char *name, unsigned int *data, int width, int height, int flags)
{
int nwidth, nheight;
LPDIRECT3DTEXTURE9 newsurf;
/*
if (!(flags & TF_MANDATORY))
{
Con_Printf("Texture upload missing flags\n");
return NULL;
}
*/
nwidth = width;
nheight = height;
D3D9_RoundDimensions(&nwidth, &nheight, flags & TF_MIPMAP);
IDirect3DDevice9_CreateTexture(pD3DDev9, nwidth, nheight, 0, 0|((flags & TF_MIPMAP)?D3DUSAGE_AUTOGENMIPMAP:0), D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &newsurf, NULL);
if (!newsurf)
return NULL;
Upload_Texture_32(newsurf, data, width, height);
if (flags & TF_MIPMAP)
IDirect3DBaseTexture9_GenerateMipSubLevels(newsurf);
return (LPDIRECT3DBASETEXTURE9)newsurf;
}
//create a basic shader from an 8bit image with 24bit palette
LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_8_Pal24(char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette, int transparentpix)
{
//just expands it to 32bpp and passes it on
static unsigned char out[MAX_WIDTH*MAX_HEIGHT][4];
int i;
if (!(flags & TF_ALPHA))
transparentpix = 256;
if (width*height > MAX_WIDTH*MAX_HEIGHT)
Sys_Error("GL_Upload8_Pal24: too big");
for (i = width*height; i >= 0 ; i--)
{
out[i][0] = palette[data[i]*3+0];
out[i][1] = palette[data[i]*3+1];
out[i][2] = palette[data[i]*3+2];
out[i][3] = 255*(data[i] != transparentpix);
}
return D3D9_LoadTexture_32(name, (unsigned int*)out, width, height, flags);
}
LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_8_Pal32(char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette)
{
//just expands it to 32bpp and passes it on
static unsigned char out[MAX_WIDTH*MAX_HEIGHT][4];
int i;
if (width*height > MAX_WIDTH*MAX_HEIGHT)
Sys_Error("GL_Upload8_Pal24: too big");
for (i = width*height; i >= 0 ; i--)
{
out[i][0] = palette[data[i]*4+0];
out[i][1] = palette[data[i]*4+1];
out[i][2] = palette[data[i]*4+2];
out[i][3] = palette[data[i]*4+3];
}
return D3D9_LoadTexture_32(name, (unsigned int*)out, width, height, flags);
}
void D3D9_UnloadTexture(LPDIRECT3DBASETEXTURE9 tex)
{
if (tex)
IDirect3DBaseTexture9_Release(tex);
}
static qbyte exptexture[16][16] =
{
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0},
{0,0,0,1,1,1,1,1,3,1,1,2,1,0,0,0},
{0,0,0,1,1,1,1,4,4,4,5,4,2,1,1,0},
{0,0,1,1,6,5,5,8,6,8,3,6,3,2,1,0},
{0,0,1,5,6,7,5,6,8,8,8,3,3,1,0,0},
{0,0,0,1,6,8,9,9,9,9,4,6,3,1,0,0},
{0,0,2,1,7,7,9,9,9,9,5,3,1,0,0,0},
{0,0,2,4,6,8,9,9,9,9,8,6,1,0,0,0},
{0,0,2,2,3,5,6,8,9,8,8,4,4,1,0,0},
{0,0,1,2,4,1,8,7,8,8,6,5,4,1,0,0},
{0,1,1,1,7,8,1,6,7,5,4,7,1,0,0,0},
{0,1,2,1,1,5,1,3,4,3,1,1,0,0,0,0},
{0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
};
void D3D9_InitParticleTexture (void)
{
#define PARTICLETEXTURESIZE 64
int x,y;
float dx, dy, d;
qbyte data[PARTICLETEXTURESIZE*PARTICLETEXTURESIZE][4];
//Explosion texture
for (x=0 ; x<16 ; x++)
{
for (y=0 ; y<16 ; y++)
{
data[y*16+x][0] = 255;
data[y*16+x][1] = 255;
data[y*16+x][2] = 255;
data[y*16+x][3] = exptexture[x][y]*255/9.0;
}
}
d3dexplosiontexture = D3D9_LoadTexture_32("", (unsigned int*)data, 16, 16, TF_ALPHA|TF_NOTBUMPMAP|TF_NOMIPMAP);
memset(data, 255, sizeof(data));
for (y = 0;y < PARTICLETEXTURESIZE;y++)
{
dy = (y - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1);
for (x = 0;x < PARTICLETEXTURESIZE;x++)
{
dx = (x - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1);
d = 256 * (1 - (dx*dx+dy*dy));
d = bound(0, d, 255);
data[y*PARTICLETEXTURESIZE+x][3] = (qbyte) d;
}
}
d3dballtexture = D3D9_LoadTexture_32("", (unsigned int*)data, PARTICLETEXTURESIZE, PARTICLETEXTURESIZE, TF_ALPHA|TF_NOTBUMPMAP|TF_NOMIPMAP);
}
mpic_t *D3D9_Draw_SafePicFromWad (char *name)
{
LPDIRECT3DBASETEXTURE9 *p;
d3dcachepic_t *pic;
qpic_t *qpic;
int i;
for (i = 0; i < d3dmenu_numcachepics; i++)
{
if (!strcmp(d3dmenu_cachepics[i].name, name))
return &d3dmenu_cachepics[i].pic;
}
qpic = (qpic_t *)W_SafeGetLumpName (name);
if (qpic)
SwapPic (qpic);
pic = &d3dmenu_cachepics[d3dmenu_numcachepics];
Q_strncpyz (pic->name, name, sizeof(pic->name));
p = (LPDIRECT3DBASETEXTURE9*)&pic->pic.d.data;
if (!strcmp(name, "conchars"))
{
pic->pic.width = 256;
pic->pic.height = 256;
*p = d3d9chars_tex;
}
else if (qpic)
{
pic->pic.width = qpic->width;
pic->pic.height = qpic->height;
*p = (LPDIRECT3DBASETEXTURE9)Mod_LoadReplacementTexture(pic->name, "wad", false, true, true);
if (!*p)
*p = D3D9_LoadTexture_8_Pal24(name, (unsigned char*)(qpic+1), qpic->width, qpic->height, TF_NOMIPMAP|TF_ALPHA|TF_NOTBUMPMAP, host_basepal, 255);
}
else
{
extern int image_width, image_height;
*p = (LPDIRECT3DBASETEXTURE9)Mod_LoadHiResTexture(pic->name, "wad", false, true, true);
if (!p)
return NULL;
pic->pic.width = image_width;
pic->pic.height = image_height;
}
d3dmenu_numcachepics++;
// Con_Printf("Fixme: D3D9_Draw_SafePicFromWad\n");
return &pic->pic;
}
mpic_t *D3D9_Draw_SafeCachePic (char *path)
{
LPDIRECT3DBASETEXTURE9 *p;
d3dcachepic_t *pic;
qpic_t *qpic;
int i;
for (i = 0; i < d3dmenu_numcachepics; i++)
{
if (!strcmp(d3dmenu_cachepics[i].name, path))
return &d3dmenu_cachepics[i].pic;
}
qpic = (qpic_t *)COM_LoadTempFile (path);
if (qpic)
SwapPic (qpic);
pic = &d3dmenu_cachepics[d3dmenu_numcachepics];
Q_strncpyz (pic->name, path, sizeof(pic->name));
p = (LPDIRECT3DBASETEXTURE9*)&pic->pic.d.data;
if (qpic)
{
pic->pic.width = qpic->width;
pic->pic.height = qpic->height;
*p = (LPDIRECT3DBASETEXTURE9)Mod_LoadReplacementTexture(pic->name, "gfx", false, true, true);
if (!*p && qpic)
*p = D3D9_LoadTexture_8_Pal24(path, (unsigned char*)(qpic+1), qpic->width, qpic->height, TF_NOMIPMAP|TF_ALPHA|TF_NOTBUMPMAP, host_basepal, 255);
}
else
{
extern int image_width, image_height;
*p = (LPDIRECT3DBASETEXTURE9)Mod_LoadHiResTexture(pic->name, "gfx", false, true, true);
if (!*p)
{
return NULL;
}
pic->pic.width = image_width;
pic->pic.height = image_height;
}
d3dmenu_numcachepics++;
// Con_Printf("Fixme: D3D9_Draw_SafeCachePic\n");
return &pic->pic;
}
mpic_t *D3D9_Draw_CachePic (char *path)
{
mpic_t *pic;
pic = D3D9_Draw_SafeCachePic(path);
if (!pic)
Sys_Error("Couldn't load picture %s", path);
return pic;
}
void D3D9_Draw_ReInit (void)
{
d3dmenu_numcachepics = 0;
draw_chars = W_SafeGetLumpName ("conchars");
d3d9chars_tex = (LPDIRECT3DBASETEXTURE9)Mod_LoadReplacementTexture("conchars", "gfx", false, true, true);
if (!d3d9chars_tex)
{
if (draw_chars)
d3d9chars_tex = D3D9_LoadTexture_8_Pal24("conchars", draw_chars, 128, 128, TF_NOMIPMAP|TF_ALPHA|TF_NOTBUMPMAP, host_basepal, 0);
if (!d3d9chars_tex)
d3d9chars_tex = (LPDIRECT3DBASETEXTURE9)Mod_LoadHiResTexture("gfx/2d/bigchars.tga", NULL, false, true, false); //try q3 path
if (!d3d9chars_tex)
d3d9chars_tex = (LPDIRECT3DBASETEXTURE9)Mod_LoadHiResTexture("pics/conchars.pcx", NULL, false, true, false); //try low res q2 path
}
//now emit the conchars picture as if from a wad.
strcpy(d3dmenu_cachepics[d3dmenu_numcachepics].name, "conchars");
d3dmenu_cachepics[d3dmenu_numcachepics].pic.width = 128;
d3dmenu_cachepics[d3dmenu_numcachepics].pic.height = 128;
*(int *)&d3dmenu_cachepics[d3dmenu_numcachepics].pic.d.data = (int)d3d9chars_tex;
d3dmenu_numcachepics++;
conback_tex = D3D9_Draw_SafeCachePic("gfx/conback.lmp");
if (!conback_tex)
conback_tex = D3D9_Draw_SafeCachePic("textures/sfx/logo512.jpg"); //try q3 path
if (!conback_tex)
conback_tex = D3D9_Draw_SafeCachePic("pics/conback.pcx");
Plug_DrawReloadImages();
D3D9_InitParticleTexture();
}
void D3D9_Draw_Init (void)
{
D3D9_Draw_ReInit();
}
void D3D9_Draw_Character (int x, int y, unsigned int num)
{
int row;
int col;
float frow, fcol, size;
#define char_instep 0
num &= 255;
if (num == ' ')
return;
row = num>>4;
col = num&15;
frow = row*0.0625+char_instep;
fcol = col*0.0625+char_instep;
size = 0.0625-char_instep*2;
d3d9quadvert[0].x = x;
d3d9quadvert[0].y = y;
d3d9quadvert[0].z = 0;
d3d9quadvert[0].colour = 0xffffffff;
d3d9quadvert[0].s = fcol;
d3d9quadvert[0].t = frow;
d3d9quadvert[1].x = x+8;
d3d9quadvert[1].y = y;
d3d9quadvert[1].z = 0;
d3d9quadvert[1].colour = 0xffffffff;
d3d9quadvert[1].s = fcol+size;
d3d9quadvert[1].t = frow;
d3d9quadvert[2].x = x+8;
d3d9quadvert[2].y = y+8;
d3d9quadvert[2].z = 0;
d3d9quadvert[2].colour = 0xffffffff;
d3d9quadvert[2].s = fcol+size;
d3d9quadvert[2].t = frow+size;
d3d9quadvert[3].x = x;
d3d9quadvert[3].y = y+8;
d3d9quadvert[3].z = 0;
d3d9quadvert[3].colour = 0xffffffff;
d3d9quadvert[3].s = fcol;
d3d9quadvert[3].t = frow+size;
IDirect3DDevice9_SetTexture(pD3DDev9, 0, d3d9chars_tex);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_TEXCOORDINDEX, 0);
IDirect3DDevice9_SetFVF(pD3DDev9, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1);
IDirect3DDevice9_DrawIndexedPrimitiveUP(pD3DDev9, D3DPT_TRIANGLELIST, 0, 4, 2, d3d9quadindexes, D3DFMT_QINDEX, d3d9quadvert, sizeof(d3d9quadvert[0]));
}
void D3D9_Draw_ColouredCharacter (int x, int y, unsigned int num)
{
int row;
int col;
float frow, fcol, size;
unsigned int imgcolour;
unsigned char *c = (unsigned char *)&imgcolour;
#define char_instep 0
if (num&0xffff == ' ')
return;
col = (num & CON_FGMASK) >> CON_FGSHIFT;
c[0] = consolecolours[col].fb*255;
c[1] = consolecolours[col].fg*255;
c[2] = consolecolours[col].fr*255;
c[3] = (num & CON_HALFALPHA)?128:255;
num &= 0xff;
row = num>>4;
col = num&15;
frow = row*0.0625+char_instep;
fcol = col*0.0625+char_instep;
size = 0.0625-char_instep*2;
d3d9quadvert[0].x = x;
d3d9quadvert[0].y = y;
d3d9quadvert[0].z = 0;
d3d9quadvert[0].colour = imgcolour;
d3d9quadvert[0].s = fcol;
d3d9quadvert[0].t = frow;
d3d9quadvert[1].x = x+8;
d3d9quadvert[1].y = y;
d3d9quadvert[1].z = 0;
d3d9quadvert[1].colour = imgcolour;
d3d9quadvert[1].s = fcol+size;
d3d9quadvert[1].t = frow;
d3d9quadvert[2].x = x+8;
d3d9quadvert[2].y = y+8;
d3d9quadvert[2].z = 0;
d3d9quadvert[2].colour = imgcolour;
d3d9quadvert[2].s = fcol+size;
d3d9quadvert[2].t = frow+size;
d3d9quadvert[3].x = x;
d3d9quadvert[3].y = y+8;
d3d9quadvert[3].z = 0;
d3d9quadvert[3].colour = imgcolour;
d3d9quadvert[3].s = fcol;
d3d9quadvert[3].t = frow+size;
IDirect3DDevice9_SetTexture(pD3DDev9, 0, d3d9chars_tex);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_TEXCOORDINDEX, 0);
IDirect3DDevice9_SetFVF(pD3DDev9, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1);
IDirect3DDevice9_DrawIndexedPrimitiveUP(pD3DDev9, D3DPT_TRIANGLELIST, 0, 4, 2, d3d9quadindexes, D3DFMT_QINDEX, d3d9quadvert, sizeof(d3d9quadvert[0]));
}
void D3D9_Draw_String (int x, int y, const qbyte *str)
{
while(*str)
{
D3D9_Draw_Character(x, y, *str++);
x+=8;
}
}
void D3D9_Draw_Alt_String (int x, int y, const qbyte *str)
{
while(*str)
{
D3D9_Draw_Character(x, y, *str++ | 128);
x+=8;
}
}
void D3D9_Draw_Crosshair (void)
{
D3D9_Draw_Character(vid.width/2 - 4, vid.height/2 - 4, '+');
}
void D3D9_Draw_DebugChar (qbyte num)
{
Sys_Error("D3D function not implemented\n");
}
void D3D9_Draw_TransPicTranslate (int x, int y, int w, int h, qbyte *pic, qbyte *translation)
{
// Sys_Error("D3D function not implemented\n");
}
void D3D9_Draw_TileClear (int x, int y, int w, int h)
{
// Sys_Error("D3D function not implemented\n");
}
void D3D9_Draw_Fill_I (int x, int y, int w, int h, unsigned int imgcolour)
{
d3d9quadvert[0].x = x;
d3d9quadvert[0].y = y;
d3d9quadvert[0].z = 0;
d3d9quadvert[0].colour = imgcolour;
d3d9quadvert[0].s = 0;
d3d9quadvert[0].t = 0;
d3d9quadvert[1].x = x+w;
d3d9quadvert[1].y = y;
d3d9quadvert[1].z = 0;
d3d9quadvert[1].colour = imgcolour;
d3d9quadvert[1].s = 0;
d3d9quadvert[1].t = 0;
d3d9quadvert[2].x = x+w;
d3d9quadvert[2].y = y+h;
d3d9quadvert[2].z = 0;
d3d9quadvert[2].colour = imgcolour;
d3d9quadvert[2].s = 0;
d3d9quadvert[2].t = 0;
d3d9quadvert[3].x = x;
d3d9quadvert[3].y = y+h;
d3d9quadvert[3].z = 0;
d3d9quadvert[3].colour = imgcolour;
d3d9quadvert[3].s = 0;
d3d9quadvert[3].t = 0;
IDirect3DDevice9_SetTexture(pD3DDev9, 0, NULL);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_ALPHATESTENABLE, FALSE );
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_ALPHABLENDENABLE, TRUE );
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
IDirect3DDevice9_SetFVF(pD3DDev9, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1);
IDirect3DDevice9_DrawIndexedPrimitiveUP(pD3DDev9, D3DPT_TRIANGLELIST, 0, 4, 2, d3d9quadindexes, D3DFMT_QINDEX, d3d9quadvert, sizeof(d3d9quadvert[0]));
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_ALPHABLENDENABLE, FALSE );
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_ALPHATESTENABLE, TRUE );
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
}
void D3D9_Draw_FillRGB (int x, int y, int w, int h, float r, float g, float b)
{
char colours[4];
colours[0] = b*255;
colours[1] = g*255;
colours[2] = r*255;
colours[3] = 255;
D3D9_Draw_Fill_I(x, y, w, h, *(unsigned int*)colours);
}
void D3D9_Draw_Fill (int x, int y, int w, int h, unsigned int c)
{
D3D9_Draw_FillRGB(x, y, w, h, host_basepal[c*3+0]/255.0f, host_basepal[c*3+1]/255.0f, host_basepal[c*3+2]/255.0f);
}
void D3D9_Draw_FadeScreen (void)
{
// Sys_Error("D3D function not implemented\n");
}
void D3D9_Draw_BeginDisc (void)
{
// Sys_Error("D3D function not implemented\n");
}
void D3D9_Draw_EndDisc (void)
{
// Sys_Error("D3D function not implemented\n");
}
static int imgcolour;
void D3D9_Draw_Fill_Colours (int x, int y, int w, int h)
{
D3D9_Draw_Fill_I(x, y, w, h, imgcolour);
}
void D3D9_Draw_Image (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic)
{
LPDIRECT3DBASETEXTURE9 *p;
if (!conback_tex)
return;
if (!pic)
return;
d3d9quadvert[0].x = x;
d3d9quadvert[0].y = y;
d3d9quadvert[0].z = 0;
d3d9quadvert[0].colour = imgcolour;
d3d9quadvert[0].s = s1;// - 3.0/pic->width;
d3d9quadvert[0].t = t1;
d3d9quadvert[1].x = x+w;
d3d9quadvert[1].y = y;
d3d9quadvert[1].z = 0;
d3d9quadvert[1].colour = imgcolour;
d3d9quadvert[1].s = s2;// - 3.0/pic->width;
d3d9quadvert[1].t = t1;
d3d9quadvert[2].x = x+w;
d3d9quadvert[2].y = y+h;
d3d9quadvert[2].z = 0;
d3d9quadvert[2].colour = imgcolour;
d3d9quadvert[2].s = s2;// - 3.0/pic->width;
d3d9quadvert[2].t = t2;
d3d9quadvert[3].x = x;
d3d9quadvert[3].y = y+h;
d3d9quadvert[3].z = 0;
d3d9quadvert[3].colour = imgcolour;
d3d9quadvert[3].s = s1;// - 3.0/pic->width;
d3d9quadvert[3].t = t2;
p = (LPDIRECT3DBASETEXTURE9*)&pic->d.data;
IDirect3DDevice9_SetTexture(pD3DDev9, 0, *p);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_TEXCOORDINDEX, 0);
IDirect3DDevice9_SetFVF(pD3DDev9, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1);
IDirect3DDevice9_DrawIndexedPrimitiveUP(pD3DDev9, D3DPT_TRIANGLELIST, 0, 4, 2, d3d9quadindexes, D3DFMT_QINDEX, d3d9quadvert, sizeof(d3d9quadvert[0]));
}
void D3D9_Draw_ScalePic (int x, int y, int width, int height, mpic_t *pic)
{
D3D9_Draw_Image(x, y, width, height, 0, 0, 1, 1, pic);
}
void D3D9_Draw_SubPic (int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height)
{
float s, t;
float sw, tw;
if (!pic)
return;
s = (float)srcx/pic->width;
t = (float)srcy/pic->height;
sw = (float)width/pic->width;
tw = (float)height/pic->height;
D3D9_Draw_Image(x, y, width, height, s, t, s+sw, t+tw, pic);
}
void D3D9_Draw_TransPic (int x, int y, mpic_t *pic)
{
if (!pic)
return;
D3D9_Draw_Image(x, y, pic->width, pic->height, 0, 0, 1, 1, pic);
}
void D3D9_Draw_Pic (int x, int y, mpic_t *pic)
{
if (!pic)
return;
D3D9_Draw_Image(x, y, pic->width, pic->height, 0, 0, 1, 1, pic);
}
void D3D9_Draw_ImageColours (float r, float g, float b, float a)
{
unsigned char *c = (unsigned char *)&imgcolour;
c[0] = b*255;
c[1] = g*255;
c[2] = r*255;
c[3] = a*255;
}
void D3D9_Draw_ConsoleBackground (int firstline, int lastline, qboolean forceopaque)
{
D3D9_Draw_ImageColours(1,1,1,1);
D3D9_Draw_Image(0, 0, vid.width, lastline, 0, 1 - (float)lastline/vid.height, 1, 1, conback_tex);
}
void D3D9_Draw_EditorBackground (int lines)
{
D3D9_Draw_ConsoleBackground(0, lines, false);
}
void D3D9_Media_ShowFrameBGR_24_Flip (qbyte *framedata, int inwidth, int inheight)
{
mpic_t pic;
LPDIRECT3DBASETEXTURE9 *p;
p = (LPDIRECT3DBASETEXTURE9*)&pic.d.data;
*p = D3D9_LoadTexture_32("", (unsigned int*)framedata, inwidth, inheight, TF_NOMIPMAP|TF_NOALPHA|TF_NOTBUMPMAP);
D3D9_Set2D ();
D3D9_Draw_ImageColours(1,1,1,1);
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_ALPHATESTENABLE, FALSE );
D3D9_Draw_Image(0, 0, vid.width, vid.height, 0, 1, 1, 0, &pic);
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_ALPHATESTENABLE, TRUE );
D3D9_UnloadTexture(*p);
} //input is bottom up...
void D3D9_Media_ShowFrameRGBA_32 (qbyte *framedata, int inwidth, int inheight)
{
mpic_t pic;
LPDIRECT3DBASETEXTURE9 *p;
pic.width = inwidth;
pic.height = inheight;
pic.flags = 0;
p = (LPDIRECT3DBASETEXTURE9*)&pic.d;
*p = D3D9_LoadTexture_32("", (unsigned int*)framedata, inwidth, inheight, TF_NOMIPMAP|TF_NOALPHA|TF_NOTBUMPMAP);
D3D9_Set2D ();
D3D9_Draw_ImageColours(1,1,1,1);
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_ALPHATESTENABLE, FALSE );
D3D9_Draw_Image(0, 0, vid.width, vid.height, 0, 0, 1, 1, &pic);
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_ALPHATESTENABLE, TRUE );
D3D9_UnloadTexture(*p);
} //top down
void (D3D9_Media_ShowFrame8bit) (qbyte *framedata, int inwidth, int inheight, qbyte *palette)
{
mpic_t pic;
LPDIRECT3DBASETEXTURE9 *p;
p = (LPDIRECT3DBASETEXTURE9*)&pic.d;
*p = D3D9_LoadTexture_8_Pal24("", (unsigned char*)framedata, inwidth, inheight, TF_NOMIPMAP|TF_NOALPHA|TF_NOTBUMPMAP, palette, 256);
D3D9_Set2D ();
D3D9_Draw_ImageColours(1,1,1,1);
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_ALPHATESTENABLE, FALSE );
D3D9_Draw_Image(0, 0, vid.width, vid.height, 0, 0, 1, 1, &pic);
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_ALPHATESTENABLE, TRUE );
D3D9_UnloadTexture(*p);
} //paletted topdown (framedata is 8bit indexes into palette)
#endif

View file

@ -1,728 +0,0 @@
#include "quakedef.h"
#ifdef D3DQUAKE
#include "d3d9quake.h"
#ifdef _WIN32
#include <malloc.h>
#else
#include <alloca.h>
#endif
extern cvar_t r_fullbrightSkins;
extern cvar_t r_vertexdlights;
typedef struct {
float x, y, z;
float s, t;
} meshvert_t;
typedef struct {
float x, y, z;
unsigned int colour;
float s, t;
} meshcolouredvert_t;
void D3D9_DrawMesh(mesh_t *mesh)
{
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG2, D3DTA_CURRENT);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
{
int v;
vec3_t *xyz;
byte_vec4_t *colour;
vec2_t *wm;
xyz = mesh->xyz_array;
wm = mesh->st_array;
colour = mesh->colors_array;
if (colour)
{
meshcolouredvert_t *meshvert = alloca(sizeof(meshcolouredvert_t)*mesh->numvertexes);
for (v = 0; v < mesh->numvertexes; v++, xyz++, wm++, colour++)
{
meshvert[v].x = (*xyz)[0];
meshvert[v].y = (*xyz)[1];
meshvert[v].z = (*xyz)[2];
meshvert[v].colour = *(unsigned int*)colour;
meshvert[v].s = (*wm)[0];
meshvert[v].t = (*wm)[1];
}
IDirect3DDevice9_SetFVF(pD3DDev9, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1);
IDirect3DDevice9_DrawIndexedPrimitiveUP(pD3DDev9, D3DPT_TRIANGLELIST, 0, mesh->numvertexes, mesh->numindexes/3, mesh->indexes, D3DFMT_QINDEX, meshvert, sizeof(meshvert[0]));
}
else
{
meshvert_t *meshvert = alloca(sizeof(meshvert_t)*mesh->numvertexes);
for (v = 0; v < mesh->numvertexes; v++, xyz++, wm++)
{
meshvert[v].x = (*xyz)[0];
meshvert[v].y = (*xyz)[1];
meshvert[v].z = (*xyz)[2];
meshvert[v].s = (*wm)[0];
meshvert[v].t = (*wm)[1];
}
IDirect3DDevice9_SetFVF(pD3DDev9, D3DFVF_XYZ|D3DFVF_TEX1);
IDirect3DDevice9_DrawIndexedPrimitiveUP(pD3DDev9, D3DPT_TRIANGLELIST, 0, mesh->numvertexes, mesh->numindexes/3, mesh->indexes, D3DFMT_QINDEX, meshvert, sizeof(meshvert[0]));
}
}
}
hashtable_t skincolourmapped;
void d3d9_GAliasFlushSkinCache(void)
{
int i;
bucket_t *b;
for (i = 0; i < skincolourmapped.numbuckets; i++)
{
while((b = skincolourmapped.bucket[i]))
{
skincolourmapped.bucket[i] = b->next;
BZ_Free(b->data);
}
}
if (skincolourmapped.bucket)
BZ_Free(skincolourmapped.bucket);
skincolourmapped.bucket = NULL;
skincolourmapped.numbuckets = 0;
}
static galiastexnum_t *D3D9_ChooseSkin(galiasinfo_t *inf, char *modelname, int surfnum, entity_t *e)
{
galiasskin_t *skins;
galiastexnum_t *texnums;
int frame;
int tc, bc;
if (!gl_nocolors.value)
{
if (e->scoreboard)
{
if (!e->scoreboard->skin)
Skin_Find(e->scoreboard);
tc = e->scoreboard->ttopcolor;
bc = e->scoreboard->tbottomcolor;
}
else
{
tc = 1;
bc = 1;
}
if (tc != 1 || bc != 1 || (e->scoreboard && e->scoreboard->skin))
{
int inwidth, inheight;
int tinwidth, tinheight;
char *skinname;
qbyte *original;
galiascolourmapped_t *cm;
char hashname[512];
if (e->scoreboard && e->scoreboard->skin && !gl_nocolors.value)
{
snprintf(hashname, sizeof(hashname), "%s$%s$%i", modelname, e->scoreboard->skin->name, surfnum);
skinname = hashname;
}
else if (surfnum)
{
snprintf(hashname, sizeof(hashname), "%s$%i", modelname, surfnum);
skinname = hashname;
}
else
skinname = modelname;
if (!skincolourmapped.numbuckets)
{
void *buckets = BZ_Malloc(Hash_BytesForBuckets(256));
memset(buckets, 0, Hash_BytesForBuckets(256));
Hash_InitTable(&skincolourmapped, 256, buckets);
}
for (cm = Hash_Get(&skincolourmapped, skinname); cm; cm = Hash_GetNext(&skincolourmapped, skinname, cm))
{
if (cm->tcolour == tc && cm->bcolour == bc && cm->skinnum == e->skinnum)
{
return &cm->texnum;
}
}
if (!inf->numskins)
{
skins = NULL;
texnums = NULL;
}
else
{
skins = (galiasskin_t*)((char *)inf + inf->ofsskins);
if (!skins->texnums)
{
skins = NULL;
texnums = NULL;
}
else
{
if (e->skinnum >= 0 && e->skinnum < inf->numskins)
skins += e->skinnum;
texnums = (galiastexnum_t*)((char *)skins + skins->ofstexnums);
}
}
//colourmap isn't present yet.
cm = BZ_Malloc(sizeof(*cm));
Q_strncpyz(cm->name, skinname, sizeof(cm->name));
Hash_Add(&skincolourmapped, cm->name, cm, &cm->bucket);
cm->tcolour = tc;
cm->bcolour = bc;
cm->skinnum = e->skinnum;
cm->texnum.fullbright = 0;
cm->texnum.base = 0;
#ifdef Q3SHADERS
cm->texnum.shader = NULL;
#endif
if (!texnums)
{ //load just the skin (q2)
/* if (e->scoreboard && e->scoreboard->skin)
{
if (cls.protocol == CP_QUAKE2)
{
original = Skin_Cache32(e->scoreboard->skin);
if (original)
{
inwidth = e->scoreboard->skin->width;
inheight = e->scoreboard->skin->height;
cm->texnum.base = cm->texnum.fullbright = GL_LoadTexture32(e->scoreboard->skin->name, inwidth, inheight, (unsigned int*)original, true, false);
return &cm->texnum;
}
}
else
{
original = Skin_Cache8(e->scoreboard->skin);
if (original)
{
inwidth = e->scoreboard->skin->width;
inheight = e->scoreboard->skin->height;
cm->texnum.base = cm->texnum.fullbright = GL_LoadTexture(e->scoreboard->skin->name, inwidth, inheight, original, true, false);
return &cm->texnum;
}
}
cm->texnum.base = Mod_LoadHiResTexture(e->scoreboard->skin->name, "skins", true, false, true);
return &cm->texnum;
}
*/
return NULL;
}
cm->texnum.bump = texnums[cm->skinnum].bump; //can't colour bumpmapping
if (cls.protocol != CP_QUAKE2 && ((!texnums || !strcmp(modelname, "progs/player.mdl")) && e->scoreboard && e->scoreboard->skin))
{
original = Skin_Cache8(e->scoreboard->skin);
inwidth = e->scoreboard->skin->width;
inheight = e->scoreboard->skin->height;
}
else
{
original = NULL;
inwidth = 0;
inheight = 0;
}
if (!original)
{
if (skins->ofstexels)
{
original = (qbyte *)skins + skins->ofstexels;
inwidth = skins->skinwidth;
inheight = skins->skinheight;
}
else
{
original = NULL;
inwidth = 0;
inheight = 0;
}
}
tinwidth = skins->skinwidth;
tinheight = skins->skinheight;
if (original)
{
int i, j;
qbyte translate[256];
unsigned translate32[256];
static unsigned pixels[512*512];
unsigned *out;
unsigned frac, fracstep;
unsigned scaled_width, scaled_height;
qbyte *inrow;
texnums = &cm->texnum;
texnums->base = 0;
texnums->fullbright = 0;
if (gl_max_size.value <= 0)
gl_max_size.value = 512;
scaled_width = gl_max_size.value < 512 ? gl_max_size.value : 512;
scaled_height = gl_max_size.value < 512 ? gl_max_size.value : 512;
#if 1
{
for (i=0 ; i<256 ; i++)
translate32[i] = d_8to24rgbtable[i];
for (i = 0; i < 16; i++)
{
if (tc >= 16)
{
//assumption: row 0 is pure white.
*((unsigned char*)&translate32[TOP_RANGE+i]+0) = (((tc&0xff0000)>>16)**((unsigned char*)&d_8to24rgbtable[i]+0))>>8;
*((unsigned char*)&translate32[TOP_RANGE+i]+1) = (((tc&0x00ff00)>> 8)**((unsigned char*)&d_8to24rgbtable[i]+1))>>8;
*((unsigned char*)&translate32[TOP_RANGE+i]+2) = (((tc&0x0000ff)>> 0)**((unsigned char*)&d_8to24rgbtable[i]+2))>>8;
*((unsigned char*)&translate32[TOP_RANGE+i]+3) = 0xff;
}
else
{
if (tc < 8)
translate32[TOP_RANGE+i] = d_8to24rgbtable[(tc<<4)+i];
else
translate32[BOTTOM_RANGE+i] = d_8to24rgbtable[(tc<<4)+15-i];
}
if (bc >= 16)
{
*((unsigned char*)&translate32[BOTTOM_RANGE+i]+0) = (((bc&0xff0000)>>16)**((unsigned char*)&d_8to24rgbtable[i]+0))>>8;
*((unsigned char*)&translate32[BOTTOM_RANGE+i]+1) = (((bc&0x00ff00)>> 8)**((unsigned char*)&d_8to24rgbtable[i]+1))>>8;
*((unsigned char*)&translate32[BOTTOM_RANGE+i]+2) = (((bc&0x0000ff)>> 0)**((unsigned char*)&d_8to24rgbtable[i]+2))>>8;
*((unsigned char*)&translate32[BOTTOM_RANGE+i]+3) = 0xff;
}
else
{
if (bc < 8)
translate32[BOTTOM_RANGE+i] = d_8to24rgbtable[(bc<<4)+i];
else
translate32[BOTTOM_RANGE+i] = d_8to24rgbtable[(bc<<4)+15-i];
}
}
}
#else
for (i=0 ; i<256 ; i++)
translate[i] = i;
tc<<=4;
bc<<=4;
for (i=0 ; i<16 ; i++)
{
if (tc < 128) // the artists made some backwards ranges. sigh.
translate[TOP_RANGE+i] = tc+i;
else
translate[TOP_RANGE+i] = tc+15-i;
if (bc < 128)
translate[BOTTOM_RANGE+i] = bc+i;
else
translate[BOTTOM_RANGE+i] = bc+15-i;
}
for (i=0 ; i<256 ; i++)
translate32[i] = d_8to24rgbtable[translate[i]];
#endif
out = pixels;
fracstep = tinwidth*0x10000/scaled_width;
for (i=0 ; i<scaled_height ; i++, out += scaled_width)
{
inrow = original + inwidth*(i*inheight/scaled_height);
frac = fracstep >> 1;
for (j=0 ; j<scaled_width ; j+=4)
{
out[j] = translate32[inrow[frac>>16]] | 0xff000000;
frac += fracstep;
out[j+1] = translate32[inrow[frac>>16]] | 0xff000000;
frac += fracstep;
out[j+2] = translate32[inrow[frac>>16]] | 0xff000000;
frac += fracstep;
out[j+3] = translate32[inrow[frac>>16]] | 0xff000000;
frac += fracstep;
}
}
texnums->base = D3D9_LoadTexture_32 ("", pixels, scaled_width, scaled_height, TF_NOTBUMPMAP);
/* texnums->base = texture_extension_number++;
GL_Bind(texnums->base);
qglTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
*/
//now do the fullbrights.
out = pixels;
fracstep = tinwidth*0x10000/scaled_width;
for (i=0 ; i<scaled_height ; i++, out += scaled_width)
{
inrow = original + inwidth*(i*inheight/scaled_height);
frac = fracstep >> 1;
for (j=0 ; j<scaled_width ; j+=1)
{
if (inrow[frac>>16] < 255-vid.fullbright)
((char *) (&out[j]))[3] = 0; //alpha 0
frac += fracstep;
}
}
/* texnums->fullbright = texture_extension_number++;
GL_Bind(texnums->fullbright);
qglTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
*/
}
else
{
skins = (galiasskin_t*)((char *)inf + inf->ofsskins);
if (e->skinnum >= 0 && e->skinnum < inf->numskins)
skins += e->skinnum;
if (!inf->numskins || !skins->texnums)
return NULL;
frame = cl.time*skins->skinspeed;
frame = frame%skins->texnums;
texnums = (galiastexnum_t*)((char *)skins + skins->ofstexnums + frame*sizeof(galiastexnum_t));
memcpy(&cm->texnum, texnums, sizeof(cm->texnum));
}
return &cm->texnum;
}
}
if (!inf->numskins)
return NULL;
skins = (galiasskin_t*)((char *)inf + inf->ofsskins);
if (e->skinnum >= 0 && e->skinnum < inf->numskins)
skins += e->skinnum;
else
{
Con_DPrintf("Skin number out of range\n");
if (!inf->numskins)
return NULL;
}
if (!skins->texnums)
return NULL;
frame = cl.time*skins->skinspeed;
frame = frame%skins->texnums;
texnums = (galiastexnum_t*)((char *)skins + skins->ofstexnums + frame*sizeof(galiastexnum_t));
return texnums;
}
extern vec3_t shadevector;
extern vec3_t ambientlight;
extern vec3_t shadelight;
static void LotsOfLightDirectionHacks(entity_t *e, model_t *m, vec3_t lightaxis[3])
{
int i;
vec3_t dist;
float add;
qboolean nolightdir;
vec3_t lightdir;
if (!(r_refdef.flags & Q2RDF_NOWORLDMODEL))
{
if (e->flags & Q2RF_WEAPONMODEL)
cl.worldmodel->funcs.LightPointValues(cl.worldmodel, r_refdef.vieworg, shadelight, ambientlight, lightdir);
else
cl.worldmodel->funcs.LightPointValues(cl.worldmodel, e->origin, shadelight, ambientlight, lightdir);
}
else
{
ambientlight[0] = ambientlight[1] = ambientlight[2] = shadelight[0] = shadelight[1] = shadelight[2] = 255;
lightdir[0] = 0;
lightdir[1] = 1;
lightdir[2] = 1;
}
if (!r_vertexdlights.value)
{
for (i=0 ; i<dlights_running ; i++)
{
if (cl_dlights[i].radius)
{
VectorSubtract (e->origin,
cl_dlights[i].origin,
dist);
add = cl_dlights[i].radius - Length(dist);
if (add > 0) {
add*=5;
ambientlight[0] += add * cl_dlights[i].color[0];
ambientlight[1] += add * cl_dlights[i].color[1];
ambientlight[2] += add * cl_dlights[i].color[2];
//ZOID models should be affected by dlights as well
shadelight[0] += add * cl_dlights[i].color[0];
shadelight[1] += add * cl_dlights[i].color[1];
shadelight[2] += add * cl_dlights[i].color[2];
}
}
}
}
else
{
}
for (i = 0; i < 3; i++) //clamp light so it doesn't get vulgar.
{
if (ambientlight[i] > 128)
ambientlight[i] = 128;
if (ambientlight[i] + shadelight[i] > 192)
shadelight[i] = 192 - ambientlight[i];
}
if (e->flags & Q2RF_WEAPONMODEL)
{
for (i = 0; i < 3; i++)
{
if (ambientlight[i] < 24)
ambientlight[i] = shadelight[i] = 24;
}
}
//MORE HUGE HACKS! WHEN WILL THEY CEASE!
// clamp lighting so it doesn't overbright as much
// ZOID: never allow players to go totally black
nolightdir = false;
if (m->engineflags & MDLF_PLAYER)
{
float fb = r_fullbrightSkins.value;
if (fb > cls.allow_fbskins)
fb = cls.allow_fbskins;
if (fb < 0)
fb = 0;
if (fb)
{
extern cvar_t r_fb_models;
if (fb >= 1 && r_fb_models.value)
{
ambientlight[0] = ambientlight[1] = ambientlight[2] = 4096;
shadelight[0] = shadelight[1] = shadelight[2] = 4096;
nolightdir = true;
}
else
{
for (i = 0; i < 3; i++)
{
ambientlight[i] = max(ambientlight[i], 8 + fb * 120);
shadelight[i] = max(shadelight[i], 8 + fb * 120);
}
}
}
for (i = 0; i < 3; i++)
{
if (ambientlight[i] < 8)
ambientlight[i] = shadelight[i] = 8;
}
}
if (m->engineflags & MDLF_FLAME)
{
shadelight[0] = shadelight[1] = shadelight[2] = 4096;
ambientlight[0] = ambientlight[1] = ambientlight[2] = 4096;
nolightdir = true;
}
else
{
for (i = 0; i < 3; i++)
{
if (ambientlight[i] > 128)
ambientlight[i] = 128;
shadelight[i] /= 200.0/255;
ambientlight[i] /= 200.0/255;
}
}
if ((e->drawflags & MLS_MASKIN) == MLS_ABSLIGHT)
{
shadelight[0] = shadelight[1] = shadelight[2] = e->abslight;
ambientlight[0] = ambientlight[1] = ambientlight[2] = 0;
}
if ((e->drawflags & MLS_MASKIN) == MLS_FULLBRIGHT || (e->flags & Q2RF_FULLBRIGHT))
{
shadelight[0] = shadelight[1] = shadelight[2] = 255;
ambientlight[0] = ambientlight[1] = ambientlight[2] = 0;
nolightdir = true;
}
//#define SHOWLIGHTDIR
{ //lightdir is absolute, shadevector is relative
shadevector[0] = DotProduct(lightdir, e->axis[0]);
shadevector[1] = DotProduct(lightdir, e->axis[1]);
shadevector[2] = DotProduct(lightdir, e->axis[2]);
if (e->flags & Q2RF_WEAPONMODEL)
{
vec3_t temp;
temp[0] = DotProduct(shadevector, vpn);
temp[1] = DotProduct(shadevector, vright);
temp[2] = DotProduct(shadevector, vup);
VectorCopy(temp, shadevector);
}
VectorNormalize(shadevector);
VectorCopy(shadevector, lightaxis[2]);
VectorVectors(lightaxis[2], lightaxis[1], lightaxis[0]);
VectorInverse(lightaxis[1]);
}
if (e->flags & Q2RF_GLOW)
{
shadelight[0] += sin(cl.time)*0.25;
shadelight[1] += sin(cl.time)*0.25;
shadelight[2] += sin(cl.time)*0.25;
}
//d3d is bgra
//ogl is rgba
//so switch em and use the gl code
add = shadelight[0];
shadelight[0] = shadelight[2];
shadelight[2] = add;
add = ambientlight[0];
ambientlight[0] = ambientlight[2];
ambientlight[2] = add;
}
qboolean R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, int frame2, float lerp, float alpha, float fg1time, float fg2time, qboolean nolightdir);
//draws currententity
void D3D9_DrawAliasModel(void)
{
mesh_t mesh;
extern entity_t *currententity;
entity_t *e = currententity;
galiasinfo_t *inf;
model_t *m;
galiastexnum_t *skin;
int i;
if (r_secondaryview && e->flags & Q2RF_WEAPONMODEL)
return;
{
extern int cl_playerindex;
if (e->scoreboard && e->model == cl.model_precache[cl_playerindex])
{
m = e->scoreboard->model;
if (!m || m->type != mod_alias)
m = e->model;
}
else
m = e->model;
}
if (!(e->flags & Q2RF_WEAPONMODEL))
if (R_CullEntityBox (e, m->mins, m->maxs))
return;
inf = GLMod_Extradata (m);
if (!inf)
return;
LotsOfLightDirectionHacks(e, m, mesh.lightaxis);
{
float matrix[16];
if (e->flags & Q2RF_WEAPONMODEL && r_refdef.currentplayernum>=0)
{ //view weapons need to be rotated onto the screen first
float view[16];
float ent[16];
Matrix4_ModelMatrixFromAxis(view, cl.viewent[r_refdef.currentplayernum].axis[0], cl.viewent[r_refdef.currentplayernum].axis[1], cl.viewent[r_refdef.currentplayernum].axis[2], cl.viewent[r_refdef.currentplayernum].origin);
Matrix4_ModelMatrixFromAxis(ent, e->axis[0], e->axis[1], e->axis[2], e->origin);
Matrix4_Multiply(view, ent, matrix);
}
else
{
Matrix4_ModelMatrixFromAxis(matrix, e->axis[0], e->axis[1], e->axis[2], e->origin);
}
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_WORLD, (D3DMATRIX*)matrix);
}
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
if (e->flags & Q2RF_DEPTHHACK)
{ //apply the depth hack to stop things from poking into walls.
//(basically moving it closer to the screen)
D3DVIEWPORT9 viewport;
IDirect3DDevice9_GetViewport(pD3DDev9, &viewport);
viewport.MinZ = 0;
viewport.MaxZ = 0.3;
IDirect3DDevice9_SetViewport(pD3DDev9, &viewport);
}
IDirect3DDevice9_SetSamplerState(pD3DDev9, 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
IDirect3DDevice9_SetSamplerState(pD3DDev9, 0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
IDirect3DDevice9_SetSamplerState(pD3DDev9, 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
for(i = 0;; i++)
{
Alias_GAliasBuildMesh(&mesh, inf, e, e->shaderRGBAf[3], 0);
skin = D3D9_ChooseSkin(inf, m->name, e->skinnum, e);
if (!skin)
IDirect3DDevice9_SetTexture(pD3DDev9, 0, NULL);
else
IDirect3DDevice9_SetTexture(pD3DDev9, 0, skin->base);
D3D9_DrawMesh(&mesh);
if (inf->nextsurf == 0)
break;
inf = (galiasinfo_t*)((char*)inf + inf->nextsurf);
}
IDirect3DDevice9_SetSamplerState(pD3DDev9, 0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
IDirect3DDevice9_SetSamplerState(pD3DDev9, 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
IDirect3DDevice9_SetSamplerState(pD3DDev9, 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
if (e->flags & Q2RF_DEPTHHACK)
{
D3DVIEWPORT9 viewport;
IDirect3DDevice9_GetViewport(pD3DDev9, &viewport);
viewport.MinZ = 0;
viewport.MaxZ = 1;
IDirect3DDevice9_SetViewport(pD3DDev9, &viewport);
}
{
float matrix[16];
Matrix4_Identity(matrix);
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_WORLD, (D3DMATRIX*)matrix);
}
}
#endif

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,164 +0,0 @@
#ifdef MINGW
#include "ddraw.h" // resolve DDLOCK_NOSYSLOCK
#endif
#ifndef D3D9QUAKE_H
#define D3D9QUAKE_H
#include "d3d9.h"
#include "com_mesh.h"
#include "glquake.h"
//
// d3d9_draw.c
//
void D3D9_Draw_Alt_String (int x, int y, const qbyte *str);
mpic_t* D3D9_Draw_CachePic (char *path);
void D3D9_Draw_Character (int x, int y, unsigned int num);
void D3D9_Draw_ColouredCharacter (int x, int y, unsigned int num);
void D3D9_Draw_ConsoleBackground (int firstline, int lastline, qboolean forceopaque);
void D3D9_Draw_DebugChar (qbyte num);
void D3D9_Draw_EditorBackground (int lines);
void D3D9_Draw_Image (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic);
void D3D9_Draw_ImageColours (float r, float g, float b, float a);
mpic_t* D3D9_Draw_SafeCachePic (char *path);
mpic_t* D3D9_Draw_SafePicFromWad (char *name);
void D3D9_Draw_ScalePic (int x, int y, int width, int height, mpic_t *pic);
void D3D9_Draw_String (int x, int y, const qbyte *str);
void D3D9_Draw_SubPic (int x, int y, int width, int height, mpic_t *pic, int srcx, int srcy, int srcwidth, int srcheight);
void D3D9_Draw_TileClear (int x, int y, int w, int h);
void D3D9_InitParticleTexture (void);
LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_32 (char *name, unsigned int *data, int width, int height, int flags);
LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_8_Pal24 (char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette, int transparentpix);
LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_8_Pal32 (char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette);
void D3D9_Media_ShowFrame8bit (qbyte *framedata, int inwidth, int inheight, qbyte *palette);
void D3D9_Media_ShowFrameBGR_24_Flip (qbyte *framedata, int inwidth, int inheight);
void D3D9_Media_ShowFrameRGBA_32 (qbyte *framedata, int inwidth, int inheight);
void D3D9_MipMap (qbyte *out, qbyte *in, int width, int height);
void D3D9_RoundDimensions (int *scaled_width, int *scaled_height, qboolean mipmap);
void D3D9_UnloadTexture (LPDIRECT3DBASETEXTURE9 tex);
static void Upload_Texture_32(LPDIRECT3DTEXTURE9 surf, unsigned int *data, int width, int height);
//
// d3d9_mesh.c
//
void D3D9_DrawAliasModel (void);
void D3D9_DrawMesh (mesh_t *mesh);
void d3d9_GAliasFlushSkinCache (void);
static void LotsOfLightDirectionHacks (entity_t *e, model_t *m, vec3_t lightaxis[3]);
//
// d3d9_rmain.c
//
void D3D9_BaseBModelTextures (entity_t *e);
/*
void D3D9_DrawParticleBeam (beamseg_t *b, part_type_t *type);
void D3D9_DrawParticleBeamUT (beamseg_t *b, part_type_t *type);
void D3D9_DrawParticleBlob (particle_t *p, part_type_t *type);
void D3D9_DrawParticleSpark (particle_t *p, part_type_t *type);
*/
void D3D9_DrawParticles (float ptime);
static void D3D9_DrawSpriteModel (entity_t *e);
void D3D9_DrawTextureChains (void);
void D3D9_DrawWorld (void);
void D3D9_R_DrawEntitiesOnList (void);
void D3D9_R_ReInit (void);
void D3D9_R_RenderScene (void);
static void D3D9_RecursiveQ2WorldNode (mnode_t *node);
static void D3D9_RecursiveWorldNode (mnode_t *node);
void D3D9_SetupFrame (void);
qboolean D3D9_ShouldDraw (void);
void D3D9R_DrawSprite(int count, void **e, void *parm);
void IDirect3DDevice9_DrawIndexedPrimitive7 (LPDIRECT3DDEVICE9 pD3DDev9, int mode, int fvf, void *verts, int numverts, index_t *indicies, int numindicies, int wasted);
//
// d3d9_rsurf.c
//
int D3D9_AllocBlock (int w, int h, int *x, int *y);
void D3D9_BuildLightmaps (void);
void D3D9_BuildSurfaceDisplayList (msurface_t *fa);
void D3D9_CreateSurfaceLightmap (msurface_t *surf, int shift);
void D3D9_DrawSkyMesh(int pass, int texture, void *verts, int numverts, void *indicies, int numelements);
int D3D9_FillBlock (int texnum, int w, int h, int x, int y);
LPDIRECT3DTEXTURE9 D3D9_NewLightmap (void);
//void D3D9R_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest, stmap *stainsrc, int shift);
void D3D9R_RenderDynamicLightmaps (msurface_t *fa, int shift);
//
// vid_d3d9.c
//
void D3D9_D_BeginDirectRect (int x, int y, qbyte *pbitmap, int width, int height);
void D3D9_D_EndDirectRect (int x, int y, int width, int height);
void D3D9_Mod_ClearAll (void);
void* D3D9_Mod_Extradata (struct model_s *mod);
struct model_s* D3D9_Mod_FindName (char *name);
struct model_s* D3D9_Mod_ForName (char *name, qboolean crash);
void D3D9_Mod_Init (void);
void D3D9_Mod_NowLoadExternal (void);
int D3D9_Mod_SkinForName (struct model_s *model, char *name);
void D3D9_Mod_Think (void);
void D3D9_Mod_TouchModel (char *name);
qboolean D3D9_R_CheckSky (void);
void D3D9_Set2D (void);
void D3D9_VID_ForceLockState (int lk);
int D3D9_VID_ForceUnlockedAndReturnState (void);
void D3D9_VID_LockBuffer (void);
void D3D9_VID_UnlockBuffer (void);
static LRESULT WINAPI D3D9_WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
texid_t D3D9_LoadTexture (char *identifier, int width, int height, enum uploadfmt fmt, void *data, unsigned int flags);
texid_t D3D9_LoadTexture8Pal24 (char *identifier, int width, int height, qbyte *data, qbyte *palette24, unsigned int flags);
texid_t D3D9_LoadTexture8Pal32 (char *identifier, int width, int height, qbyte *data, qbyte *palette32, unsigned int flags);
texid_t D3D9_LoadCompressed (char *name);
texid_t D3D9_FindTexture (char *identifier);
texid_t D3D9_AllocNewTexture (int w, int h);
void D3D9_Upload (texid_t tex, char *name, enum uploadfmt fmt, void *data, void *palette, int width, int height, unsigned int flags);
void D3D9_DestroyTexture (texid_t tex);
extern LPDIRECT3DDEVICE9 pD3DDev9;
extern int d_lightstylevalue[256]; // 8.8 fraction of base light value
#define lightmap_bytes 4
extern int numlightmaps;
extern mvertex_t *r_pcurrentvertbase;
#ifndef LMBLOCK_WIDTH
#define LMBLOCK_WIDTH 128
#define LMBLOCK_HEIGHT LMBLOCK_WIDTH
typedef struct glRect_s {
unsigned char l,t,w,h;
} glRect_t;
typedef unsigned char stmap;
typedef struct {
qboolean modified;
qboolean deluxmodified;
glRect_t rectchange;
glRect_t deluxrectchange;
int allocated[LMBLOCK_WIDTH];
qbyte lightmaps[4*LMBLOCK_WIDTH*LMBLOCK_HEIGHT];
qbyte deluxmaps[4*LMBLOCK_WIDTH*LMBLOCK_HEIGHT]; //fixme: make seperate structure for easy disabling with less memory usage.
stmap stainmaps[3*LMBLOCK_WIDTH*LMBLOCK_HEIGHT]; //rgb no a. added to lightmap for added (hopefully) speed.
} lightmapinfo_t;
#endif
extern LPDIRECT3DTEXTURE9 *lightmap_d3d9textures;
extern LPDIRECT3DTEXTURE9 *deluxmap_d3d9textures;
extern lightmapinfo_t **lightmap;
extern void *d3dexplosiontexture;
extern void *d3dballtexture;
extern index_t dummyindex;
#if sizeof_index_t == 2
#define D3DFMT_QINDEX D3DFMT_INDEX16
#else
#define D3DFMT_QINDEX D3DFMT_INDEX32
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -514,7 +514,7 @@ void R_RotateForEntity (float *modelview, const entity_t *e, const model_t *mod)
{ {
/*FIXME: no bob*/ /*FIXME: no bob*/
float simpleview[16]; float simpleview[16];
vec3_t ang, f, r, u; vec3_t ang;
ang[0] = 0; ang[0] = 0;
ang[1] = 0; ang[1] = 0;
ang[2] = gl_screenangle.value; ang[2] = gl_screenangle.value;

View file

@ -93,10 +93,6 @@ extern cvar_t vid_wndalpha;
typedef enum {MS_WINDOWED, MS_FULLSCREEN, MS_FULLDIB, MS_UNINIT} modestate_t; typedef enum {MS_WINDOWED, MS_FULLSCREEN, MS_FULLDIB, MS_UNINIT} modestate_t;
#ifdef USE_D3D
void D3DInitialize(void);
void d3dSetMode(int fullscreen, int width, int height, int bpp, int zbpp);
#endif
BOOL bSetupPixelFormat(HDC hDC); BOOL bSetupPixelFormat(HDC hDC);
//qboolean VID_SetWindowedMode (int modenum); //qboolean VID_SetWindowedMode (int modenum);
@ -872,26 +868,6 @@ qboolean VID_AttachGL (rendererstate_t *info)
{ //make sure we can get a valid renderer. { //make sure we can get a valid renderer.
do do
{ {
#ifdef USE_D3D
if (!Q_strcasecmp(info->glrenderer, "D3D"))
{
int zbpp = info->bpp > 16 ? 24 : 16;
gl_canstencil = false;
TRACE(("dbg: VID_AttachGL: D3DInitialize\n"));
D3DInitialize(); //replacement of GLInitialise, to get the function pointers set up.
if (COM_CheckParm("-zbpp"))
{
zbpp = Q_atoi(com_argv[COM_CheckParm("-zbpp")+1]);
}
TRACE(("dbg: VID_AttachGL: d3dSetMode\n"));
d3dSetMode(info->fullscreen, info->width, info->height, info->bpp, zbpp); //d3d cheats to get it's dimensions and stuff... One that we can currently live with though.
maindc = GetDC(mainwindow);
Con_Printf(CON_NOTICE "OpenGL to Direct3D wrapper enabled\n"); //green to make it show.
break;
}
#endif
TRACE(("dbg: VID_AttachGL: GLInitialise\n")); TRACE(("dbg: VID_AttachGL: GLInitialise\n"));
if (GLInitialise(info->glrenderer)) if (GLInitialise(info->glrenderer))
{ {

File diff suppressed because it is too large Load diff