Modular rendering system. Patch by use.less01

This might break MSVC builds. I'll take care of it later
This commit is contained in:
Thilo Schulz 2011-08-01 01:19:55 +00:00
parent 8ab958fab9
commit 40dfcee06e
24 changed files with 335 additions and 186 deletions

253
Makefile
View file

@ -159,6 +159,10 @@ ifndef USE_LOCAL_HEADERS
USE_LOCAL_HEADERS=1 USE_LOCAL_HEADERS=1
endif endif
ifndef USE_RENDERER_DLOPEN
USE_RENDERER_DLOPEN=1
endif
ifndef DEBUG_CFLAGS ifndef DEBUG_CFLAGS
DEBUG_CFLAGS=-g -O0 DEBUG_CFLAGS=-g -O0
endif endif
@ -291,6 +295,10 @@ ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu"))
CLIENT_CFLAGS += -DUSE_CODEC_VORBIS CLIENT_CFLAGS += -DUSE_CODEC_VORBIS
endif endif
ifeq ($(USE_RENDERER_DLOPEN),1)
CLIENT_CFLAGS += -DUSE_RENDERER_DLOPEN
endif
OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer
OPTIMIZE = $(OPTIMIZEVM) -ffast-math OPTIMIZE = $(OPTIMIZEVM) -ffast-math
@ -500,6 +508,10 @@ ifeq ($(PLATFORM),mingw32)
CLIENT_CFLAGS += -DUSE_CODEC_VORBIS CLIENT_CFLAGS += -DUSE_CODEC_VORBIS
endif endif
ifeq ($(USE_RENDERER_DLOPEN),1)
CLIENT_CFLAGS += -DUSE_RENDERER_DLOPEN
endif
ifeq ($(ARCH),x64) ifeq ($(ARCH),x64)
OPTIMIZEVM = -O3 -fno-omit-frame-pointer \ OPTIMIZEVM = -O3 -fno-omit-frame-pointer \
-falign-loops=2 -funroll-loops -falign-jumps=2 -falign-functions=2 \ -falign-loops=2 -funroll-loops -falign-jumps=2 -falign-functions=2 \
@ -856,11 +868,18 @@ ifneq ($(BUILD_SERVER),0)
endif endif
ifneq ($(BUILD_CLIENT),0) ifneq ($(BUILD_CLIENT),0)
ifneq ($(USE_RENDERER_DLOPEN),0)
TARGETS += $(B)/ioquake3$(FULLBINEXT) $(B)/renderer_opengl1_$(SHLIBNAME)
ifneq ($(BUILD_CLIENT_SMP),0)
TARGETS += $(B)/renderer_opengl1_smp_$(SHLIBNAME)
endif
else
TARGETS += $(B)/ioquake3$(FULLBINEXT) TARGETS += $(B)/ioquake3$(FULLBINEXT)
ifneq ($(BUILD_CLIENT_SMP),0) ifneq ($(BUILD_CLIENT_SMP),0)
TARGETS += $(B)/ioquake3-smp$(FULLBINEXT) TARGETS += $(B)/ioquake3-smp$(FULLBINEXT)
endif endif
endif endif
endif
ifneq ($(BUILD_GAME_SO),0) ifneq ($(BUILD_GAME_SO),0)
TARGETS += \ TARGETS += \
@ -961,9 +980,14 @@ $(echo_cmd) "CC $<"
$(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) $(CLIENT_CFLAGS) $(OPTIMIZE) -o $@ -c $< $(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) $(CLIENT_CFLAGS) $(OPTIMIZE) -o $@ -c $<
endef endef
define DO_REF_CC
$(echo_cmd) "REF_CC $<"
$(Q)$(CC) $(SHLIBCFLAGS) $(CFLAGS) $(CLIENT_CFLAGS) $(OPTIMIZE) -o $@ -c $<
endef
define DO_SMP_CC define DO_SMP_CC
$(echo_cmd) "SMP_CC $<" $(echo_cmd) "SMP_CC $<"
$(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) $(CLIENT_CFLAGS) $(OPTIMIZE) -DSMP -o $@ -c $< $(Q)$(CC) $(SHLIBCFLAGS) $(CFLAGS) $(CLIENT_CFLAGS) $(OPTIMIZE) -DSMP -o $@ -c $<
endef endef
define DO_BOT_CC define DO_BOT_CC
@ -1123,6 +1147,8 @@ makedirs:
@if [ ! -d $(B) ];then $(MKDIR) $(B);fi @if [ ! -d $(B) ];then $(MKDIR) $(B);fi
@if [ ! -d $(B)/client ];then $(MKDIR) $(B)/client;fi @if [ ! -d $(B)/client ];then $(MKDIR) $(B)/client;fi
@if [ ! -d $(B)/clientsmp ];then $(MKDIR) $(B)/clientsmp;fi @if [ ! -d $(B)/clientsmp ];then $(MKDIR) $(B)/clientsmp;fi
@if [ ! -d $(B)/renderer ];then $(MKDIR) $(B)/renderer;fi
@if [ ! -d $(B)/renderersmp ];then $(MKDIR) $(B)/renderersmp;fi
@if [ ! -d $(B)/ded ];then $(MKDIR) $(B)/ded;fi @if [ ! -d $(B)/ded ];then $(MKDIR) $(B)/ded;fi
@if [ ! -d $(B)/baseq3 ];then $(MKDIR) $(B)/baseq3;fi @if [ ! -d $(B)/baseq3 ];then $(MKDIR) $(B)/baseq3;fi
@if [ ! -d $(B)/baseq3/cgame ];then $(MKDIR) $(B)/baseq3/cgame;fi @if [ ! -d $(B)/baseq3/cgame ];then $(MKDIR) $(B)/baseq3/cgame;fi
@ -1412,37 +1438,7 @@ Q3OBJ = \
$(B)/client/l_precomp.o \ $(B)/client/l_precomp.o \
$(B)/client/l_script.o \ $(B)/client/l_script.o \
$(B)/client/l_struct.o \ $(B)/client/l_struct.o \
$(B)/client/tr_animation.o \
$(B)/client/tr_backend.o \
$(B)/client/tr_bsp.o \
$(B)/client/tr_cmds.o \
$(B)/client/tr_curve.o \
$(B)/client/tr_flares.o \
$(B)/client/tr_font.o \
$(B)/client/tr_image.o \
$(B)/client/tr_image_png.o \
$(B)/client/tr_image_jpg.o \
$(B)/client/tr_image_bmp.o \
$(B)/client/tr_image_tga.o \
$(B)/client/tr_image_pcx.o \
$(B)/client/tr_init.o \
$(B)/client/tr_light.o \
$(B)/client/tr_main.o \
$(B)/client/tr_marks.o \
$(B)/client/tr_mesh.o \
$(B)/client/tr_model.o \
$(B)/client/tr_model_iqm.o \
$(B)/client/tr_noise.o \
$(B)/client/tr_scene.o \
$(B)/client/tr_shade.o \
$(B)/client/tr_shade_calc.o \
$(B)/client/tr_shader.o \
$(B)/client/tr_shadows.o \
$(B)/client/tr_sky.o \
$(B)/client/tr_surface.o \
$(B)/client/tr_world.o \
\ \
$(B)/client/sdl_gamma.o \
$(B)/client/sdl_input.o \ $(B)/client/sdl_input.o \
$(B)/client/sdl_snd.o \ $(B)/client/sdl_snd.o \
\ \
@ -1450,54 +1446,95 @@ Q3OBJ = \
$(B)/client/con_log.o \ $(B)/client/con_log.o \
$(B)/client/sys_main.o $(B)/client/sys_main.o
Q3ROBJ = \
$(B)/renderer/tr_animation.o \
$(B)/renderer/tr_backend.o \
$(B)/renderer/tr_bsp.o \
$(B)/renderer/tr_cmds.o \
$(B)/renderer/tr_curve.o \
$(B)/renderer/tr_flares.o \
$(B)/renderer/tr_font.o \
$(B)/renderer/tr_image.o \
$(B)/renderer/tr_image_png.o \
$(B)/renderer/tr_image_jpg.o \
$(B)/renderer/tr_image_bmp.o \
$(B)/renderer/tr_image_tga.o \
$(B)/renderer/tr_image_pcx.o \
$(B)/renderer/tr_init.o \
$(B)/renderer/tr_light.o \
$(B)/renderer/tr_main.o \
$(B)/renderer/tr_marks.o \
$(B)/renderer/tr_mesh.o \
$(B)/renderer/tr_model.o \
$(B)/renderer/tr_model_iqm.o \
$(B)/renderer/tr_noise.o \
$(B)/renderer/tr_scene.o \
$(B)/renderer/tr_shade.o \
$(B)/renderer/tr_shade_calc.o \
$(B)/renderer/tr_shader.o \
$(B)/renderer/tr_shadows.o \
$(B)/renderer/tr_sky.o \
$(B)/renderer/tr_surface.o \
$(B)/renderer/tr_world.o \
\
$(B)/renderer/sdl_gamma.o
ifneq ($(USE_RENDERER_DLOPEN), 0)
Q3ROBJ += \
$(B)/renderer/q_shared.o \
$(B)/renderer/puff.o \
$(B)/renderer/q_math.o \
$(B)/renderer/tr_subs.o
endif
ifneq ($(USE_INTERNAL_JPEG),0) ifneq ($(USE_INTERNAL_JPEG),0)
Q3OBJ += \ Q3ROBJ += \
$(B)/client/jaricom.o \ $(B)/renderer/jaricom.o \
$(B)/client/jcapimin.o \ $(B)/renderer/jcapimin.o \
$(B)/client/jcapistd.o \ $(B)/renderer/jcapistd.o \
$(B)/client/jcarith.o \ $(B)/renderer/jcarith.o \
$(B)/client/jccoefct.o \ $(B)/renderer/jccoefct.o \
$(B)/client/jccolor.o \ $(B)/renderer/jccolor.o \
$(B)/client/jcdctmgr.o \ $(B)/renderer/jcdctmgr.o \
$(B)/client/jchuff.o \ $(B)/renderer/jchuff.o \
$(B)/client/jcinit.o \ $(B)/renderer/jcinit.o \
$(B)/client/jcmainct.o \ $(B)/renderer/jcmainct.o \
$(B)/client/jcmarker.o \ $(B)/renderer/jcmarker.o \
$(B)/client/jcmaster.o \ $(B)/renderer/jcmaster.o \
$(B)/client/jcomapi.o \ $(B)/renderer/jcomapi.o \
$(B)/client/jcparam.o \ $(B)/renderer/jcparam.o \
$(B)/client/jcprepct.o \ $(B)/renderer/jcprepct.o \
$(B)/client/jcsample.o \ $(B)/renderer/jcsample.o \
$(B)/client/jctrans.o \ $(B)/renderer/jctrans.o \
$(B)/client/jdapimin.o \ $(B)/renderer/jdapimin.o \
$(B)/client/jdapistd.o \ $(B)/renderer/jdapistd.o \
$(B)/client/jdarith.o \ $(B)/renderer/jdarith.o \
$(B)/client/jdatadst.o \ $(B)/renderer/jdatadst.o \
$(B)/client/jdatasrc.o \ $(B)/renderer/jdatasrc.o \
$(B)/client/jdcoefct.o \ $(B)/renderer/jdcoefct.o \
$(B)/client/jdcolor.o \ $(B)/renderer/jdcolor.o \
$(B)/client/jddctmgr.o \ $(B)/renderer/jddctmgr.o \
$(B)/client/jdhuff.o \ $(B)/renderer/jdhuff.o \
$(B)/client/jdinput.o \ $(B)/renderer/jdinput.o \
$(B)/client/jdmainct.o \ $(B)/renderer/jdmainct.o \
$(B)/client/jdmarker.o \ $(B)/renderer/jdmarker.o \
$(B)/client/jdmaster.o \ $(B)/renderer/jdmaster.o \
$(B)/client/jdmerge.o \ $(B)/renderer/jdmerge.o \
$(B)/client/jdpostct.o \ $(B)/renderer/jdpostct.o \
$(B)/client/jdsample.o \ $(B)/renderer/jdsample.o \
$(B)/client/jdtrans.o \ $(B)/renderer/jdtrans.o \
$(B)/client/jerror.o \ $(B)/renderer/jerror.o \
$(B)/client/jfdctflt.o \ $(B)/renderer/jfdctflt.o \
$(B)/client/jfdctfst.o \ $(B)/renderer/jfdctfst.o \
$(B)/client/jfdctint.o \ $(B)/renderer/jfdctint.o \
$(B)/client/jidctflt.o \ $(B)/renderer/jidctflt.o \
$(B)/client/jidctfst.o \ $(B)/renderer/jidctfst.o \
$(B)/client/jidctint.o \ $(B)/renderer/jidctint.o \
$(B)/client/jmemmgr.o \ $(B)/renderer/jmemmgr.o \
$(B)/client/jmemnobs.o \ $(B)/renderer/jmemnobs.o \
$(B)/client/jquant1.o \ $(B)/renderer/jquant1.o \
$(B)/client/jquant2.o \ $(B)/renderer/jquant2.o \
$(B)/client/jutils.o $(B)/renderer/jutils.o
endif endif
ifeq ($(ARCH),i386) ifeq ($(ARCH),i386)
@ -1656,22 +1693,40 @@ ifeq ($(USE_MUMBLE),1)
endif endif
Q3POBJ += \ Q3POBJ += \
$(B)/client/sdl_glimp.o $(B)/renderer/sdl_glimp.o
Q3POBJ_SMP += \ Q3POBJ_SMP += \
$(B)/clientsmp/sdl_glimp.o $(B)/renderersmp/sdl_glimp.o
$(B)/ioquake3$(FULLBINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN) ifneq ($(USE_RENDERER_DLOPEN),0)
$(B)/ioquake3$(FULLBINEXT): $(Q3OBJ) $(LIBSDLMAIN)
$(echo_cmd) "LD $@" $(echo_cmd) "LD $@"
$(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \ $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \
-o $@ $(Q3OBJ) $(Q3POBJ) \ -o $@ $(Q3OBJ) \
$(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS) $(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS)
$(B)/ioquake3-smp$(FULLBINEXT): $(Q3OBJ) $(Q3POBJ_SMP) $(LIBSDLMAIN) $(B)/renderer_opengl1_$(SHLIBNAME): $(Q3ROBJ) $(Q3POBJ)
$(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3ROBJ) $(Q3POBJ) \
$(THREAD_LIBS) $(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS)
$(B)/renderer_opengl1_smp_$(SHLIBNAME): $(Q3ROBJ) $(Q3POBJ_SMP)
$(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3ROBJ) $(Q3POBJ_SMP) \
$(THREAD_LIBS) $(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS)
else
$(B)/ioquake3$(FULLBINEXT): $(Q3OBJ) $(Q3ROBJ) $(Q3POBJ) $(LIBSDLMAIN)
$(echo_cmd) "LD $@"
$(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \
-o $@ $(Q3OBJ) $(Q3ROBJ) $(Q3POBJ) \
$(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS)
$(B)/ioquake3-smp$(FULLBINEXT): $(Q3OBJ) $(Q3ROBJ) $(Q3POBJ_SMP) $(LIBSDLMAIN)
$(echo_cmd) "LD $@" $(echo_cmd) "LD $@"
$(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) $(THREAD_LDFLAGS) \ $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) $(THREAD_LDFLAGS) \
-o $@ $(Q3OBJ) $(Q3POBJ_SMP) \ -o $@ $(Q3OBJ) $(Q3ROBJ) $(Q3POBJ_SMP) \
$(THREAD_LIBS) $(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS) $(THREAD_LIBS) $(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS)
endif
ifneq ($(strip $(LIBSDLMAIN)),) ifneq ($(strip $(LIBSDLMAIN)),)
ifneq ($(strip $(LIBSDLMAINSRC)),) ifneq ($(strip $(LIBSDLMAINSRC)),)
@ -2175,22 +2230,16 @@ $(B)/client/%.o: $(CMDIR)/%.c
$(B)/client/%.o: $(BLIBDIR)/%.c $(B)/client/%.o: $(BLIBDIR)/%.c
$(DO_BOT_CC) $(DO_BOT_CC)
$(B)/client/%.o: $(JPDIR)/%.c
$(DO_CC)
$(B)/client/%.o: $(SPEEXDIR)/%.c $(B)/client/%.o: $(SPEEXDIR)/%.c
$(DO_CC) $(DO_CC)
$(B)/client/%.o: $(ZDIR)/%.c $(B)/client/%.o: $(ZDIR)/%.c
$(DO_CC) $(DO_CC)
$(B)/client/%.o: $(RDIR)/%.c
$(DO_CC)
$(B)/client/%.o: $(SDLDIR)/%.c $(B)/client/%.o: $(SDLDIR)/%.c
$(DO_CC) $(DO_CC)
$(B)/clientsmp/%.o: $(SDLDIR)/%.c $(B)/renderersmp/%.o: $(SDLDIR)/%.c
$(DO_SMP_CC) $(DO_SMP_CC)
$(B)/client/%.o: $(SYSDIR)/%.c $(B)/client/%.o: $(SYSDIR)/%.c
@ -2203,6 +2252,19 @@ $(B)/client/%.o: $(SYSDIR)/%.rc
$(DO_WINDRES) $(DO_WINDRES)
$(B)/renderer/%.o: $(CMDIR)/%.c
$(DO_REF_CC)
$(B)/renderer/%.o: $(SDLDIR)/%.c
$(DO_REF_CC)
$(B)/renderer/%.o: $(JPDIR)/%.c
$(DO_REF_CC)
$(B)/renderer/%.o: $(RDIR)/%.c
$(DO_REF_CC)
$(B)/ded/%.o: $(ASMDIR)/%.s $(B)/ded/%.o: $(ASMDIR)/%.s
$(DO_AS) $(DO_AS)
@ -2326,7 +2388,7 @@ $(B)/missionpack/qcommon/%.asm: $(CMDIR)/%.c $(Q3LCC)
# MISC # MISC
############################################################################# #############################################################################
OBJ = $(Q3OBJ) $(Q3POBJ) $(Q3POBJ_SMP) $(Q3DOBJ) \ OBJ = $(Q3OBJ) $(Q3POBJ) $(Q3POBJ_SMP) $(Q3ROBJ) $(Q3DOBJ) \
$(MPGOBJ) $(Q3GOBJ) $(Q3CGOBJ) $(MPCGOBJ) $(Q3UIOBJ) $(MPUIOBJ) \ $(MPGOBJ) $(Q3GOBJ) $(Q3CGOBJ) $(MPCGOBJ) $(Q3UIOBJ) $(MPUIOBJ) \
$(MPGVMOBJ) $(Q3GVMOBJ) $(Q3CGVMOBJ) $(MPCGVMOBJ) $(Q3UIVMOBJ) $(MPUIVMOBJ) $(MPGVMOBJ) $(Q3GVMOBJ) $(Q3CGVMOBJ) $(MPCGVMOBJ) $(Q3UIVMOBJ) $(MPUIVMOBJ)
TOOLSOBJ = $(LBURGOBJ) $(Q3CPPOBJ) $(Q3RCCOBJ) $(Q3LCCOBJ) $(Q3ASMOBJ) TOOLSOBJ = $(LBURGOBJ) $(Q3CPPOBJ) $(Q3RCCOBJ) $(Q3LCCOBJ) $(Q3ASMOBJ)
@ -2339,12 +2401,13 @@ copyfiles: release
ifneq ($(BUILD_CLIENT),0) ifneq ($(BUILD_CLIENT),0)
$(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/ioquake3$(FULLBINEXT) $(COPYBINDIR)/ioquake3$(FULLBINEXT) $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/ioquake3$(FULLBINEXT) $(COPYBINDIR)/ioquake3$(FULLBINEXT)
$(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/renderer_opengl1_$(SHLIBNAME) $(COPYBINDIR)/renderer_opengl1_$(SHLIBNAME)
endif endif
# Don't copy the SMP until it's working together with SDL. # Don't copy the SMP until it's working together with SDL.
#ifneq ($(BUILD_CLIENT_SMP),0) ifneq ($(BUILD_CLIENT_SMP),0)
# $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/ioquake3-smp$(FULLBINEXT) $(COPYBINDIR)/ioquake3-smp$(FULLBINEXT) $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/renderer_opengl1_smp_$(SHLIBNAME) $(COPYBINDIR)/renderer_opengl1_smp_$(SHLIBNAME)
#endif endif
ifneq ($(BUILD_SERVER),0) ifneq ($(BUILD_SERVER),0)
@if [ -f $(BR)/ioq3ded$(FULLBINEXT) ]; then \ @if [ -f $(BR)/ioq3ded$(FULLBINEXT) ]; then \

View file

@ -52,8 +52,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define MAX_VIDEO_HANDLES 16 #define MAX_VIDEO_HANDLES 16
extern glconfig_t glConfig;
static void RoQ_init( void ); static void RoQ_init( void );
@ -991,7 +989,7 @@ static void readQuadInfo( byte *qData )
cinTable[currentHandle].drawY = cinTable[currentHandle].CIN_HEIGHT; cinTable[currentHandle].drawY = cinTable[currentHandle].CIN_HEIGHT;
// rage pro is very slow at 512 wide textures, voodoo can't do it at all // rage pro is very slow at 512 wide textures, voodoo can't do it at all
if ( glConfig.hardwareType == GLHW_RAGEPRO || glConfig.maxTextureSize <= 256) { if ( cls.glconfig.hardwareType == GLHW_RAGEPRO || cls.glconfig.maxTextureSize <= 256) {
if (cinTable[currentHandle].drawX>256) { if (cinTable[currentHandle].drawX>256) {
cinTable[currentHandle].drawX = 256; cinTable[currentHandle].drawX = 256;
} }

View file

@ -24,6 +24,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "client.h" #include "client.h"
#include <limits.h> #include <limits.h>
#include "../sys/sys_local.h"
#include "../sys/sys_loadlib.h"
#ifdef USE_MUMBLE #ifdef USE_MUMBLE
#include "libmumblelink.h" #include "libmumblelink.h"
#endif #endif
@ -44,6 +47,8 @@ cvar_t *cl_voipShowMeter;
cvar_t *cl_voip; cvar_t *cl_voip;
#endif #endif
cvar_t *cl_renderer;
cvar_t *cl_nodelta; cvar_t *cl_nodelta;
cvar_t *cl_debugMove; cvar_t *cl_debugMove;
@ -116,6 +121,9 @@ vm_t *cgvm;
// Structure containing functions exported from refresh DLL // Structure containing functions exported from refresh DLL
refexport_t re; refexport_t re;
#ifdef USE_RENDERER_DLOPEN
static void *rendererLib = NULL;
#endif
ping_t cl_pinglist[MAX_PINGREQUESTS]; ping_t cl_pinglist[MAX_PINGREQUESTS];
@ -136,7 +144,6 @@ int serverStatusCount;
void hA3Dg_ExportRenderGeom (refexport_t *incoming_re); void hA3Dg_ExportRenderGeom (refexport_t *incoming_re);
#endif #endif
extern void GLimp_Minimize(void);
extern void SV_BotFrame( int time ); extern void SV_BotFrame( int time );
void CL_CheckForResend( void ); void CL_CheckForResend( void );
void CL_ShowIP_f(void); void CL_ShowIP_f(void);
@ -3163,9 +3170,39 @@ CL_InitRef
void CL_InitRef( void ) { void CL_InitRef( void ) {
refimport_t ri; refimport_t ri;
refexport_t *ret; refexport_t *ret;
#ifdef USE_RENDERER_DLOPEN
GetRefAPI_t GetRefAPI;
char dllName[MAX_OSPATH];
#endif
Com_Printf( "----- Initializing Renderer ----\n" ); Com_Printf( "----- Initializing Renderer ----\n" );
#ifdef USE_RENDERER_DLOPEN
cl_renderer = Cvar_Get("cl_renderer", "opengl1", CVAR_ARCHIVE | CVAR_LATCH);
Com_sprintf(dllName, sizeof(dllName), "renderer_%s_" ARCH_STRING DLL_EXT, cl_renderer->string);
if(!(rendererLib = Sys_LoadDll(dllName)) && strcmp(cl_renderer->string, cl_renderer->resetString))
{
Cvar_ForceReset("cl_renderer");
Com_sprintf(dllName, sizeof(dllName), "renderer_opengl1_" ARCH_STRING DLL_EXT);
rendererLib = Sys_LoadLibrary(dllName);
}
if(!rendererLib)
{
Com_Printf("failed:\n\"%s\"\n", Sys_LibraryError());
Com_Error(ERR_FATAL, "Failed to load renderer");
}
GetRefAPI = Sys_LoadFunction(rendererLib, "GetRefAPI");
if(!GetRefAPI)
{
Com_Error(ERR_FATAL, "Can't load symbol GetRefAPI: '%s'", Sys_LibraryError());
}
#endif
ri.Cmd_AddCommand = Cmd_AddCommand; ri.Cmd_AddCommand = Cmd_AddCommand;
ri.Cmd_RemoveCommand = Cmd_RemoveCommand; ri.Cmd_RemoveCommand = Cmd_RemoveCommand;
ri.Cmd_Argc = Cmd_Argc; ri.Cmd_Argc = Cmd_Argc;
@ -3183,7 +3220,10 @@ void CL_InitRef( void ) {
#endif #endif
ri.Hunk_AllocateTempMemory = Hunk_AllocateTempMemory; ri.Hunk_AllocateTempMemory = Hunk_AllocateTempMemory;
ri.Hunk_FreeTempMemory = Hunk_FreeTempMemory; ri.Hunk_FreeTempMemory = Hunk_FreeTempMemory;
ri.CM_ClusterPVS = CM_ClusterPVS;
ri.CM_DrawDebugSurface = CM_DrawDebugSurface; ri.CM_DrawDebugSurface = CM_DrawDebugSurface;
ri.FS_ReadFile = FS_ReadFile; ri.FS_ReadFile = FS_ReadFile;
ri.FS_FreeFile = FS_FreeFile; ri.FS_FreeFile = FS_FreeFile;
ri.FS_WriteFile = FS_WriteFile; ri.FS_WriteFile = FS_WriteFile;
@ -3193,7 +3233,9 @@ void CL_InitRef( void ) {
ri.FS_FileExists = FS_FileExists; ri.FS_FileExists = FS_FileExists;
ri.Cvar_Get = Cvar_Get; ri.Cvar_Get = Cvar_Get;
ri.Cvar_Set = Cvar_Set; ri.Cvar_Set = Cvar_Set;
ri.Cvar_SetValue = Cvar_SetValue;
ri.Cvar_CheckRange = Cvar_CheckRange; ri.Cvar_CheckRange = Cvar_CheckRange;
ri.Cvar_VariableIntegerValue = Cvar_VariableIntegerValue;
// cinematic stuff // cinematic stuff
@ -3203,6 +3245,17 @@ void CL_InitRef( void ) {
ri.CL_WriteAVIVideoFrame = CL_WriteAVIVideoFrame; ri.CL_WriteAVIVideoFrame = CL_WriteAVIVideoFrame;
ri.IN_Init = IN_Init;
ri.IN_Shutdown = IN_Shutdown;
ri.IN_Restart = IN_Restart;
ri.ftol = Q_ftol;
ri.Sys_SetEnv = Sys_SetEnv;
ri.Sys_GLimpSafeInit = Sys_GLimpSafeInit;
ri.Sys_GLimpInit = Sys_GLimpInit;
ri.Sys_LowPhysicalMemory = Sys_LowPhysicalMemory;
ret = GetRefAPI( REF_API_VERSION, &ri ); ret = GetRefAPI( REF_API_VERSION, &ri );
#if defined __USEA3D && defined __A3D_GEOM #if defined __USEA3D && defined __A3D_GEOM
@ -3555,7 +3608,6 @@ void CL_Init( void ) {
Cmd_AddCommand ("model", CL_SetModel_f ); Cmd_AddCommand ("model", CL_SetModel_f );
Cmd_AddCommand ("video", CL_Video_f ); Cmd_AddCommand ("video", CL_Video_f );
Cmd_AddCommand ("stopvideo", CL_StopVideo_f ); Cmd_AddCommand ("stopvideo", CL_StopVideo_f );
Cmd_AddCommand("minimize", GLimp_Minimize);
CL_InitRef(); CL_InitRef();
SCR_Init (); SCR_Init ();

View file

@ -571,9 +571,9 @@ void SCR_UpdateScreen( void ) {
if( uivm || com_dedicated->integer ) if( uivm || com_dedicated->integer )
{ {
// XXX // XXX
extern cvar_t* r_anaglyphMode; int in_anaglyphMode = Cvar_VariableIntegerValue("r_anaglyphMode");
// if running in stereo, we need to draw the frame twice // if running in stereo, we need to draw the frame twice
if ( cls.glconfig.stereoEnabled || r_anaglyphMode->integer) { if ( cls.glconfig.stereoEnabled || in_anaglyphMode) {
SCR_DrawScreenField( STEREO_LEFT ); SCR_DrawScreenField( STEREO_LEFT );
SCR_DrawScreenField( STEREO_RIGHT ); SCR_DrawScreenField( STEREO_RIGHT );
} else { } else {

View file

@ -3271,37 +3271,6 @@ void Com_Shutdown (void) {
} }
//------------------------------------------------------------------------
/*
=====================
Q_acos
the msvc acos doesn't always return a value between -PI and PI:
int i;
i = 1065353246;
acos(*(float*) &i) == -1.#IND0
This should go in q_math but it is too late to add new traps
to game and ui
=====================
*/
float Q_acos(float c) {
float angle;
angle = acos(c);
if (angle > M_PI) {
return (float)M_PI;
}
if (angle < -M_PI) {
return (float)M_PI;
}
return angle;
}
/* /*
=========================================== ===========================================
command line completion command line completion

View file

@ -1011,3 +1011,32 @@ int Q_isnan( float x )
return (int)( (unsigned int)fi.ui >> 31 ); return (int)( (unsigned int)fi.ui >> 31 );
} }
//------------------------------------------------------------------------
#ifndef Q3_VM
/*
=====================
Q_acos
the msvc acos doesn't always return a value between -PI and PI:
int i;
i = 1065353246;
acos(*(float*) &i) == -1.#IND0
=====================
*/
float Q_acos(float c) {
float angle;
angle = acos(c);
if (angle > M_PI) {
return (float)M_PI;
}
if (angle < -M_PI) {
return (float)M_PI;
}
return angle;
}
#endif

View file

@ -73,6 +73,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// for windows fastcall option // for windows fastcall option
#define QDECL #define QDECL
#define QCALL
//================================================================= WIN64/32 === //================================================================= WIN64/32 ===
@ -84,6 +85,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#undef QDECL #undef QDECL
#define QDECL __cdecl #define QDECL __cdecl
#undef QCALL
#define QCALL __stdcall
#if defined( _MSC_VER ) #if defined( _MSC_VER )
#define OS_STRING "win_msvc64" #define OS_STRING "win_msvc64"
#elif defined __MINGW64__ #elif defined __MINGW64__
@ -108,6 +112,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#undef QDECL #undef QDECL
#define QDECL __cdecl #define QDECL __cdecl
#undef QCALL
#define QCALL __stdcall
#if defined( _MSC_VER ) #if defined( _MSC_VER )
#define OS_STRING "win_msvc" #define OS_STRING "win_msvc"
#elif defined __MINGW32__ #elif defined __MINGW32__
@ -129,6 +136,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#endif #endif
//============================================================== MAC OS X === //============================================================== MAC OS X ===
#if defined(MACOS_X) || defined(__APPLE_CC__) #if defined(MACOS_X) || defined(__APPLE_CC__)

View file

@ -1434,7 +1434,7 @@ static char *CommaParse( char **data_p ) {
if (len == MAX_TOKEN_CHARS) if (len == MAX_TOKEN_CHARS)
{ {
// Com_Printf ("Token exceeded %i chars, discarded.\n", MAX_TOKEN_CHARS); // ri.Printf (PRINT_DEVELOPER, "Token exceeded %i chars, discarded.\n", MAX_TOKEN_CHARS);
len = 0; len = 0;
} }
com_token[len] = 0; com_token[len] = 0;
@ -1463,12 +1463,12 @@ qhandle_t RE_RegisterSkin( const char *name ) {
char surfName[MAX_QPATH]; char surfName[MAX_QPATH];
if ( !name || !name[0] ) { if ( !name || !name[0] ) {
Com_Printf( "Empty name passed to RE_RegisterSkin\n" ); ri.Printf( PRINT_DEVELOPER, "Empty name passed to RE_RegisterSkin\n" );
return 0; return 0;
} }
if ( strlen( name ) >= MAX_QPATH ) { if ( strlen( name ) >= MAX_QPATH ) {
Com_Printf( "Skin name exceeds MAX_QPATH\n" ); ri.Printf( PRINT_DEVELOPER, "Skin name exceeds MAX_QPATH\n" );
return 0; return 0;
} }

View file

@ -2063,7 +2063,7 @@ void R_LoadPNG(const char *name, byte **pic, int *width, int *height)
{ {
CloseBufferedFile(ThePNG); CloseBufferedFile(ThePNG);
Com_Printf(S_COLOR_YELLOW "%s: invalid image size\n", name); ri.Printf( PRINT_WARNING, "%s: invalid image size\n", name );
return; return;
} }

View file

@ -1009,7 +1009,7 @@ void R_Register( void )
r_ignorehwgamma = ri.Cvar_Get( "r_ignorehwgamma", "0", CVAR_ARCHIVE | CVAR_LATCH); r_ignorehwgamma = ri.Cvar_Get( "r_ignorehwgamma", "0", CVAR_ARCHIVE | CVAR_LATCH);
r_mode = ri.Cvar_Get( "r_mode", "3", CVAR_ARCHIVE | CVAR_LATCH ); r_mode = ri.Cvar_Get( "r_mode", "3", CVAR_ARCHIVE | CVAR_LATCH );
r_fullscreen = ri.Cvar_Get( "r_fullscreen", "1", CVAR_ARCHIVE ); r_fullscreen = ri.Cvar_Get( "r_fullscreen", "1", CVAR_ARCHIVE );
r_noborder = Cvar_Get("r_noborder", "0", CVAR_ARCHIVE); r_noborder = ri.Cvar_Get("r_noborder", "0", CVAR_ARCHIVE);
r_customwidth = ri.Cvar_Get( "r_customwidth", "1600", CVAR_ARCHIVE | CVAR_LATCH ); r_customwidth = ri.Cvar_Get( "r_customwidth", "1600", CVAR_ARCHIVE | CVAR_LATCH );
r_customheight = ri.Cvar_Get( "r_customheight", "1024", CVAR_ARCHIVE | CVAR_LATCH ); r_customheight = ri.Cvar_Get( "r_customheight", "1024", CVAR_ARCHIVE | CVAR_LATCH );
r_customPixelAspect = ri.Cvar_Get( "r_customPixelAspect", "1", CVAR_ARCHIVE | CVAR_LATCH ); r_customPixelAspect = ri.Cvar_Get( "r_customPixelAspect", "1", CVAR_ARCHIVE | CVAR_LATCH );
@ -1129,6 +1129,7 @@ void R_Register( void )
ri.Cmd_AddCommand( "screenshot", R_ScreenShot_f ); ri.Cmd_AddCommand( "screenshot", R_ScreenShot_f );
ri.Cmd_AddCommand( "screenshotJPEG", R_ScreenShotJPEG_f ); ri.Cmd_AddCommand( "screenshotJPEG", R_ScreenShotJPEG_f );
ri.Cmd_AddCommand( "gfxinfo", GfxInfo_f ); ri.Cmd_AddCommand( "gfxinfo", GfxInfo_f );
ri.Cmd_AddCommand( "minimize", GLimp_Minimize );
} }
/* /*
@ -1154,7 +1155,7 @@ void R_Init( void ) {
// Swap_Init(); // Swap_Init();
if ( (intptr_t)tess.xyz & 15 ) { if ( (intptr_t)tess.xyz & 15 ) {
Com_Printf( "WARNING: tess.xyz not 16 byte aligned\n" ); ri.Printf( PRINT_WARNING, "tess.xyz not 16 byte aligned\n" );
} }
Com_Memset( tess.constantColor255, 255, sizeof( tess.constantColor255 ) ); Com_Memset( tess.constantColor255, 255, sizeof( tess.constantColor255 ) );
@ -1279,7 +1280,7 @@ Touch all images to make sure they are resident
*/ */
void RE_EndRegistration( void ) { void RE_EndRegistration( void ) {
R_SyncRenderThread(); R_SyncRenderThread();
if (!Sys_LowPhysicalMemory()) { if (!ri.Sys_LowPhysicalMemory()) {
RB_ShowImages(); RB_ShowImages();
} }
} }
@ -1291,7 +1292,12 @@ GetRefAPI
@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@
*/ */
#ifdef USE_RENDERER_DLOPEN
Q_EXPORT refexport_t QDECL *GetRefAPI ( int apiVersion, refimport_t *rimp ) {
#else
refexport_t *GetRefAPI ( int apiVersion, refimport_t *rimp ) { refexport_t *GetRefAPI ( int apiVersion, refimport_t *rimp ) {
#endif
static refexport_t re; static refexport_t re;
ri = *rimp; ri = *rimp;

View file

@ -359,9 +359,9 @@ void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent ) {
} }
// save out the byte packet version // save out the byte packet version
((byte *)&ent->ambientLightInt)[0] = Q_ftol(ent->ambientLight[0]); ((byte *)&ent->ambientLightInt)[0] = ri.ftol(ent->ambientLight[0]);
((byte *)&ent->ambientLightInt)[1] = Q_ftol(ent->ambientLight[1]); ((byte *)&ent->ambientLightInt)[1] = ri.ftol(ent->ambientLight[1]);
((byte *)&ent->ambientLightInt)[2] = Q_ftol(ent->ambientLight[2]); ((byte *)&ent->ambientLightInt)[2] = ri.ftol(ent->ambientLight[2]);
((byte *)&ent->ambientLightInt)[3] = 0xff; ((byte *)&ent->ambientLightInt)[3] = 0xff;
// transform the direction to local space // transform the direction to local space

View file

@ -1306,6 +1306,7 @@ void GLimp_FrontEndSleep( void );
void GLimp_WakeRenderer( void *data ); void GLimp_WakeRenderer( void *data );
void GLimp_LogComment( char *comment ); void GLimp_LogComment( char *comment );
void GLimp_Minimize(void);
// NOTE TTimo linux works with float gamma value, not the gamma table // NOTE TTimo linux works with float gamma value, not the gamma table
// the params won't be used, getting the r_gamma cvar directly // the params won't be used, getting the r_gamma cvar directly

View file

@ -218,7 +218,7 @@ int R_ComputeLOD( trRefEntity_t *ent ) {
} }
flod *= tr.currentModel->numLods; flod *= tr.currentModel->numLods;
lod = Q_ftol(flod); lod = ri.ftol(flod);
if ( lod < 0 ) if ( lod < 0 )
{ {

View file

@ -278,7 +278,7 @@ qhandle_t RE_RegisterModel( const char *name ) {
} }
if ( strlen( name ) >= MAX_QPATH ) { if ( strlen( name ) >= MAX_QPATH ) {
Com_Printf( "Model name exceeds MAX_QPATH\n" ); ri.Printf( PRINT_ALL, "Model name exceeds MAX_QPATH\n" );
return 0; return 0;
} }

View file

@ -131,8 +131,11 @@ typedef struct {
cvar_t *(*Cvar_Get)( const char *name, const char *value, int flags ); cvar_t *(*Cvar_Get)( const char *name, const char *value, int flags );
void (*Cvar_Set)( const char *name, const char *value ); void (*Cvar_Set)( const char *name, const char *value );
void (*Cvar_SetValue) (const char *name, float value);
void (*Cvar_CheckRange)( cvar_t *cv, float minVal, float maxVal, qboolean shouldBeIntegral ); void (*Cvar_CheckRange)( cvar_t *cv, float minVal, float maxVal, qboolean shouldBeIntegral );
int (*Cvar_VariableIntegerValue) (const char *var_name);
void (*Cmd_AddCommand)( const char *name, void(*cmd)(void) ); void (*Cmd_AddCommand)( const char *name, void(*cmd)(void) );
void (*Cmd_RemoveCommand)( const char *name ); void (*Cmd_RemoveCommand)( const char *name );
@ -141,6 +144,8 @@ typedef struct {
void (*Cmd_ExecuteText) (int exec_when, const char *text); void (*Cmd_ExecuteText) (int exec_when, const char *text);
byte *(*CM_ClusterPVS)(int cluster);
// visualization for debugging collision detection // visualization for debugging collision detection
void (*CM_DrawDebugSurface)( void (*drawPoly)(int color, int numPoints, float *points) ); void (*CM_DrawDebugSurface)( void (*drawPoly)(int color, int numPoints, float *points) );
@ -160,12 +165,30 @@ typedef struct {
e_status (*CIN_RunCinematic) (int handle); e_status (*CIN_RunCinematic) (int handle);
void (*CL_WriteAVIVideoFrame)( const byte *buffer, int size ); void (*CL_WriteAVIVideoFrame)( const byte *buffer, int size );
// input event handling
void (*IN_Init)( void );
void (*IN_Shutdown)( void );
void (*IN_Restart)( void );
// math
long (*ftol)(float f);
// system stuff
void (*Sys_SetEnv)( const char *name, const char *value );
void (*Sys_GLimpSafeInit)( void );
void (*Sys_GLimpInit)( void );
qboolean (*Sys_LowPhysicalMemory)( void );
} refimport_t; } refimport_t;
// this is the only function actually exported at the linker level // this is the only function actually exported at the linker level
// If the module can't init to a valid rendering state, NULL will be // If the module can't init to a valid rendering state, NULL will be
// returned. // returned.
#ifdef USE_RENDERER_DLOPEN
typedef refexport_t* (QDECL *GetRefAPI_t) (int apiVersion, refimport_t * rimp);
#else
refexport_t*GetRefAPI( int apiVersion, refimport_t *rimp ); refexport_t*GetRefAPI( int apiVersion, refimport_t *rimp );
#endif
#endif // __TR_PUBLIC_H #endif // __TR_PUBLIC_H

View file

@ -215,7 +215,7 @@ void RE_AddRefEntityToScene( const refEntity_t *ent ) {
static qboolean firstTime = qtrue; static qboolean firstTime = qtrue;
if (firstTime) { if (firstTime) {
firstTime = qfalse; firstTime = qfalse;
Com_DPrintf(S_COLOR_YELLOW "WARNING: RE_AddRefEntityToScene passed a refEntity which has an origin with a NaN component\n"); ri.Printf( PRINT_WARNING, "RE_AddRefEntityToScene passed a refEntity which has an origin with a NaN component\n");
} }
return; return;
} }

View file

@ -233,7 +233,7 @@ static void R_BindAnimatedImage( textureBundle_t *bundle ) {
// it is necessary to do this messy calc to make sure animations line up // it is necessary to do this messy calc to make sure animations line up
// exactly with waveforms of the same frequency // exactly with waveforms of the same frequency
index = Q_ftol(tess.shaderTime * bundle->imageAnimationSpeed * FUNCTABLE_SIZE); index = ri.ftol(tess.shaderTime * bundle->imageAnimationSpeed * FUNCTABLE_SIZE);
index >>= FUNCTABLE_SIZE2; index >>= FUNCTABLE_SIZE2;
if ( index < 0 ) { if ( index < 0 ) {
@ -689,9 +689,9 @@ static void ProjectDlightTexture_scalar( void ) {
} }
} }
clipBits[i] = clip; clipBits[i] = clip;
colors[0] = Q_ftol(floatColor[0] * modulate); colors[0] = ri.ftol(floatColor[0] * modulate);
colors[1] = Q_ftol(floatColor[1] * modulate); colors[1] = ri.ftol(floatColor[1] * modulate);
colors[2] = Q_ftol(floatColor[2] * modulate); colors[2] = ri.ftol(floatColor[2] * modulate);
colors[3] = 255; colors[3] = 255;
} }

View file

@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#endif #endif
#define WAVEVALUE( table, base, amplitude, phase, freq ) ((base) + table[ Q_ftol( ( ( (phase) + tess.shaderTime * (freq) ) * FUNCTABLE_SIZE ) ) & FUNCTABLE_MASK ] * (amplitude)) #define WAVEVALUE( table, base, amplitude, phase, freq ) ((base) + table[ ri.ftol( ( ( (phase) + tess.shaderTime * (freq) ) * FUNCTABLE_SIZE ) ) & FUNCTABLE_MASK ] * (amplitude))
static float *TableForFunc( genFunc_t func ) static float *TableForFunc( genFunc_t func )
{ {
@ -699,7 +699,7 @@ void RB_CalcWaveColor( const waveForm_t *wf, unsigned char *dstColors )
glow = 1; glow = 1;
} }
v = Q_ftol(255 * glow); v = ri.ftol(255 * glow);
color[0] = color[1] = color[2] = v; color[0] = color[1] = color[2] = v;
color[3] = 255; color[3] = 255;
v = *(int *)color; v = *(int *)color;
@ -1180,19 +1180,19 @@ static void RB_CalcDiffuseColor_scalar( unsigned char *colors )
*(int *)&colors[i*4] = ambientLightInt; *(int *)&colors[i*4] = ambientLightInt;
continue; continue;
} }
j = Q_ftol(ambientLight[0] + incoming * directedLight[0]); j = ri.ftol(ambientLight[0] + incoming * directedLight[0]);
if ( j > 255 ) { if ( j > 255 ) {
j = 255; j = 255;
} }
colors[i*4+0] = j; colors[i*4+0] = j;
j = Q_ftol(ambientLight[1] + incoming * directedLight[1]); j = ri.ftol(ambientLight[1] + incoming * directedLight[1]);
if ( j > 255 ) { if ( j > 255 ) {
j = 255; j = 255;
} }
colors[i*4+1] = j; colors[i*4+1] = j;
j = Q_ftol(ambientLight[2] + incoming * directedLight[2]); j = ri.ftol(ambientLight[2] + incoming * directedLight[2]);
if ( j > 255 ) { if ( j > 255 ) {
j = 255; j = 255;
} }

View file

@ -2701,7 +2701,7 @@ qhandle_t RE_RegisterShaderLightMap( const char *name, int lightmapIndex ) {
shader_t *sh; shader_t *sh;
if ( strlen( name ) >= MAX_QPATH ) { if ( strlen( name ) >= MAX_QPATH ) {
Com_Printf( "Shader name exceeds MAX_QPATH\n" ); ri.Printf( PRINT_ALL, "Shader name exceeds MAX_QPATH\n" );
return 0; return 0;
} }
@ -2735,7 +2735,7 @@ qhandle_t RE_RegisterShader( const char *name ) {
shader_t *sh; shader_t *sh;
if ( strlen( name ) >= MAX_QPATH ) { if ( strlen( name ) >= MAX_QPATH ) {
Com_Printf( "Shader name exceeds MAX_QPATH\n" ); ri.Printf( PRINT_ALL, "Shader name exceeds MAX_QPATH\n" );
return 0; return 0;
} }
@ -2765,7 +2765,7 @@ qhandle_t RE_RegisterShaderNoMip( const char *name ) {
shader_t *sh; shader_t *sh;
if ( strlen( name ) >= MAX_QPATH ) { if ( strlen( name ) >= MAX_QPATH ) {
Com_Printf( "Shader name exceeds MAX_QPATH\n" ); ri.Printf( PRINT_ALL, "Shader name exceeds MAX_QPATH\n" );
return 0; return 0;
} }

View file

@ -553,10 +553,10 @@ static void FillCloudBox( const shader_t *shader, int stage )
continue; continue;
} }
sky_mins_subd[0] = Q_ftol(sky_mins[0][i] * HALF_SKY_SUBDIVISIONS); sky_mins_subd[0] = ri.ftol(sky_mins[0][i] * HALF_SKY_SUBDIVISIONS);
sky_mins_subd[1] = Q_ftol(sky_mins[1][i] * HALF_SKY_SUBDIVISIONS); sky_mins_subd[1] = ri.ftol(sky_mins[1][i] * HALF_SKY_SUBDIVISIONS);
sky_maxs_subd[0] = Q_ftol(sky_maxs[0][i] * HALF_SKY_SUBDIVISIONS); sky_maxs_subd[0] = ri.ftol(sky_maxs[0][i] * HALF_SKY_SUBDIVISIONS);
sky_maxs_subd[1] = Q_ftol(sky_maxs[1][i] * HALF_SKY_SUBDIVISIONS); sky_maxs_subd[1] = ri.ftol(sky_maxs[1][i] * HALF_SKY_SUBDIVISIONS);
if ( sky_mins_subd[0] < -HALF_SKY_SUBDIVISIONS ) if ( sky_mins_subd[0] < -HALF_SKY_SUBDIVISIONS )
sky_mins_subd[0] = -HALF_SKY_SUBDIVISIONS; sky_mins_subd[0] = -HALF_SKY_SUBDIVISIONS;

View file

@ -547,7 +547,7 @@ qboolean R_inPVS( const vec3_t p1, const vec3_t p2 ) {
byte *vis; byte *vis;
leaf = R_PointInLeaf( p1 ); leaf = R_PointInLeaf( p1 );
vis = CM_ClusterPVS( leaf->cluster ); vis = ri.CM_ClusterPVS( leaf->cluster ); // why not R_ClusterPVS ??
leaf = R_PointInLeaf( p2 ); leaf = R_PointInLeaf( p2 );
if ( !(vis[leaf->cluster>>3] & (1<<(leaf->cluster&7))) ) { if ( !(vis[leaf->cluster>>3] & (1<<(leaf->cluster&7))) ) {

View file

@ -60,7 +60,7 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
GetVersionEx( &vinfo ); GetVersionEx( &vinfo );
if( vinfo.dwMajorVersion >= 5 && vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) if( vinfo.dwMajorVersion >= 5 && vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT )
{ {
Com_DPrintf( "performing gamma clamp.\n" ); ri.Printf( PRINT_DEVELOPER, "performing gamma clamp.\n" );
for( j = 0 ; j < 3 ; j++ ) for( j = 0 ; j < 3 ; j++ )
{ {
for( i = 0 ; i < 128 ; i++ ) for( i = 0 ; i < 128 ; i++ )

View file

@ -90,7 +90,7 @@ GLimp_Shutdown
*/ */
void GLimp_Shutdown( void ) void GLimp_Shutdown( void )
{ {
IN_Shutdown(); ri.IN_Shutdown();
SDL_QuitSubSystem( SDL_INIT_VIDEO ); SDL_QuitSubSystem( SDL_INIT_VIDEO );
screen = NULL; screen = NULL;
@ -464,10 +464,10 @@ static qboolean GLimp_StartDriverAndSetMode(int mode, qboolean fullscreen, qbool
SDL_VideoDriverName( driverName, sizeof( driverName ) - 1 ); SDL_VideoDriverName( driverName, sizeof( driverName ) - 1 );
ri.Printf( PRINT_ALL, "SDL using driver \"%s\"\n", driverName ); ri.Printf( PRINT_ALL, "SDL using driver \"%s\"\n", driverName );
Cvar_Set( "r_sdlDriver", driverName ); ri.Cvar_Set( "r_sdlDriver", driverName );
} }
if (fullscreen && Cvar_VariableIntegerValue( "in_nograb" ) ) if (fullscreen && ri.Cvar_VariableIntegerValue( "in_nograb" ) )
{ {
ri.Printf( PRINT_ALL, "Fullscreen not allowed with in_nograb 1\n"); ri.Printf( PRINT_ALL, "Fullscreen not allowed with in_nograb 1\n");
ri.Cvar_Set( "r_fullscreen", "0" ); ri.Cvar_Set( "r_fullscreen", "0" );
@ -686,7 +686,7 @@ void GLimp_Init( void )
r_allowResize = ri.Cvar_Get( "r_allowResize", "0", CVAR_ARCHIVE ); r_allowResize = ri.Cvar_Get( "r_allowResize", "0", CVAR_ARCHIVE );
r_centerWindow = ri.Cvar_Get( "r_centerWindow", "0", CVAR_ARCHIVE ); r_centerWindow = ri.Cvar_Get( "r_centerWindow", "0", CVAR_ARCHIVE );
if( Cvar_VariableIntegerValue( "com_abnormalExit" ) ) if( ri.Cvar_VariableIntegerValue( "com_abnormalExit" ) )
{ {
ri.Cvar_Set( "r_mode", va( "%d", R_MODE_FALLBACK ) ); ri.Cvar_Set( "r_mode", va( "%d", R_MODE_FALLBACK ) );
ri.Cvar_Set( "r_fullscreen", "0" ); ri.Cvar_Set( "r_fullscreen", "0" );
@ -694,16 +694,16 @@ void GLimp_Init( void )
ri.Cvar_Set( "com_abnormalExit", "0" ); ri.Cvar_Set( "com_abnormalExit", "0" );
} }
Sys_SetEnv( "SDL_VIDEO_CENTERED", r_centerWindow->integer ? "1" : "" ); ri.Sys_SetEnv( "SDL_VIDEO_CENTERED", r_centerWindow->integer ? "1" : "" );
Sys_GLimpInit( ); ri.Sys_GLimpInit( );
// Create the window and set up the context // Create the window and set up the context
if(GLimp_StartDriverAndSetMode(r_mode->integer, r_fullscreen->integer, r_noborder->integer)) if(GLimp_StartDriverAndSetMode(r_mode->integer, r_fullscreen->integer, r_noborder->integer))
goto success; goto success;
// Try again, this time in a platform specific "safe mode" // Try again, this time in a platform specific "safe mode"
Sys_GLimpSafeInit( ); ri.Sys_GLimpSafeInit( );
if(GLimp_StartDriverAndSetMode(r_mode->integer, r_fullscreen->integer, qfalse)) if(GLimp_StartDriverAndSetMode(r_mode->integer, r_fullscreen->integer, qfalse))
goto success; goto success;
@ -747,7 +747,7 @@ success:
ri.Cvar_Get( "r_availableModes", "", CVAR_ROM ); ri.Cvar_Get( "r_availableModes", "", CVAR_ROM );
// This depends on SDL_INIT_VIDEO, hence having it here // This depends on SDL_INIT_VIDEO, hence having it here
IN_Init( ); ri.IN_Init( );
} }
@ -778,7 +778,7 @@ void GLimp_EndFrame( void )
// Find out the current state // Find out the current state
fullscreen = !!( s->flags & SDL_FULLSCREEN ); fullscreen = !!( s->flags & SDL_FULLSCREEN );
if( r_fullscreen->integer && Cvar_VariableIntegerValue( "in_nograb" ) ) if( r_fullscreen->integer && ri.Cvar_VariableIntegerValue( "in_nograb" ) )
{ {
ri.Printf( PRINT_ALL, "Fullscreen not allowed with in_nograb 1\n"); ri.Printf( PRINT_ALL, "Fullscreen not allowed with in_nograb 1\n");
ri.Cvar_Set( "r_fullscreen", "0" ); ri.Cvar_Set( "r_fullscreen", "0" );
@ -796,9 +796,9 @@ void GLimp_EndFrame( void )
{ {
// SDL_WM_ToggleFullScreen didn't work, so do it the slow way // SDL_WM_ToggleFullScreen didn't work, so do it the slow way
if( !sdlToggled ) if( !sdlToggled )
Cbuf_AddText( "vid_restart" ); ri.Cmd_ExecuteText(EXEC_APPEND, "vid_restart");
IN_Restart( ); ri.IN_Restart( );
} }
r_fullscreen->modified = qfalse; r_fullscreen->modified = qfalse;

View file

@ -464,7 +464,7 @@ static void IN_ActivateMouse( void )
} }
// in_nograb makes no sense in fullscreen mode // in_nograb makes no sense in fullscreen mode
if( !r_fullscreen->integer ) if( !Cvar_VariableIntegerValue("r_fullscreen") )
{ {
if( in_nograb->modified || !mouseActive ) if( in_nograb->modified || !mouseActive )
{ {
@ -492,7 +492,7 @@ static void IN_DeactivateMouse( void )
// Always show the cursor when the mouse is disabled, // Always show the cursor when the mouse is disabled,
// but not when fullscreen // but not when fullscreen
if( !r_fullscreen->integer ) if( !Cvar_VariableIntegerValue("r_fullscreen") )
SDL_ShowCursor( 1 ); SDL_ShowCursor( 1 );
if( !mouseAvailable ) if( !mouseAvailable )
@ -525,7 +525,7 @@ static void IN_DeactivateMouse( void )
// Don't warp the mouse unless the cursor is within the window // Don't warp the mouse unless the cursor is within the window
if( SDL_GetAppState( ) & SDL_APPMOUSEFOCUS ) if( SDL_GetAppState( ) & SDL_APPMOUSEFOCUS )
SDL_WarpMouse( glConfig.vidWidth / 2, glConfig.vidHeight / 2 ); SDL_WarpMouse( cls.glconfig.vidWidth / 2, cls.glconfig.vidHeight / 2 );
mouseActive = qfalse; mouseActive = qfalse;
} }
@ -936,9 +936,9 @@ static void IN_ProcessEvents( void )
char width[32], height[32]; char width[32], height[32];
Com_sprintf( width, sizeof(width), "%d", e.resize.w ); Com_sprintf( width, sizeof(width), "%d", e.resize.w );
Com_sprintf( height, sizeof(height), "%d", e.resize.h ); Com_sprintf( height, sizeof(height), "%d", e.resize.h );
ri.Cvar_Set( "r_customwidth", width ); Cvar_Set( "r_customwidth", width );
ri.Cvar_Set( "r_customheight", height ); Cvar_Set( "r_customheight", height );
ri.Cvar_Set( "r_mode", "-1" ); Cvar_Set( "r_mode", "-1" );
/* wait until user stops dragging for 1 second, so /* wait until user stops dragging for 1 second, so
we aren't constantly recreating the GL context while we aren't constantly recreating the GL context while
he tries to drag...*/ he tries to drag...*/
@ -975,12 +975,12 @@ void IN_Frame( void )
// If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading // If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
loading = !!( clc.state != CA_DISCONNECTED && clc.state != CA_ACTIVE ); loading = !!( clc.state != CA_DISCONNECTED && clc.state != CA_ACTIVE );
if( !r_fullscreen->integer && ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) ) if( !Cvar_VariableIntegerValue("r_fullscreen") && ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) )
{ {
// Console is down in windowed mode // Console is down in windowed mode
IN_DeactivateMouse( ); IN_DeactivateMouse( );
} }
else if( !r_fullscreen->integer && loading ) else if( !Cvar_VariableIntegerValue("r_fullscreen") && loading )
{ {
// Loading in windowed mode // Loading in windowed mode
IN_DeactivateMouse( ); IN_DeactivateMouse( );