aboutsummaryrefslogtreecommitdiffstats
path: root/code/renderer
diff options
context:
space:
mode:
Diffstat (limited to 'code/renderer')
-rw-r--r--code/renderer/tr_init.c30
-rw-r--r--code/renderer/tr_public.h1
2 files changed, 4 insertions, 27 deletions
diff --git a/code/renderer/tr_init.c b/code/renderer/tr_init.c
index d838c61..492b924 100644
--- a/code/renderer/tr_init.c
+++ b/code/renderer/tr_init.c
@@ -159,30 +159,6 @@ int max_polys;
cvar_t *r_maxpolyverts;
int max_polyverts;
-static void AssertCvarRange( cvar_t *cv, float minVal, float maxVal, qboolean shouldBeIntegral )
-{
- if ( shouldBeIntegral )
- {
- if ( ( int ) cv->value != cv->integer )
- {
- ri.Printf( PRINT_WARNING, "WARNING: cvar '%s' must be integral (%f)\n", cv->name, cv->value );
- ri.Cvar_Set( cv->name, va( "%d", cv->integer ) );
- }
- }
-
- if ( cv->value < minVal )
- {
- ri.Printf( PRINT_WARNING, "WARNING: cvar '%s' out of range (%f < %f)\n", cv->name, cv->value, minVal );
- ri.Cvar_Set( cv->name, va( "%f", minVal ) );
- }
- else if ( cv->value > maxVal )
- {
- ri.Printf( PRINT_WARNING, "WARNING: cvar '%s' out of range (%f > %f)\n", cv->name, cv->value, maxVal );
- ri.Cvar_Set( cv->name, va( "%f", maxVal ) );
- }
-}
-
-
/*
** InitOpenGL
**
@@ -918,7 +894,7 @@ void R_Register( void )
r_picmip = ri.Cvar_Get ("r_picmip", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_roundImagesDown = ri.Cvar_Get ("r_roundImagesDown", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_colorMipLevels = ri.Cvar_Get ("r_colorMipLevels", "0", CVAR_LATCH );
- AssertCvarRange( r_picmip, 0, 16, qtrue );
+ ri.Cvar_CheckRange( r_picmip, 0, 16, qtrue );
r_detailTextures = ri.Cvar_Get( "r_detailtextures", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_texturebits = ri.Cvar_Get( "r_texturebits", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_colorbits = ri.Cvar_Get( "r_colorbits", "0", CVAR_ARCHIVE | CVAR_LATCH );
@@ -944,7 +920,7 @@ void R_Register( void )
// temporary latched variables that can only change over a restart
//
r_displayRefresh = ri.Cvar_Get( "r_displayRefresh", "0", CVAR_LATCH );
- AssertCvarRange( r_displayRefresh, 0, 200, qtrue );
+ ri.Cvar_CheckRange( r_displayRefresh, 0, 200, qtrue );
r_fullbright = ri.Cvar_Get ("r_fullbright", "0", CVAR_LATCH|CVAR_CHEAT );
r_mapOverBrightBits = ri.Cvar_Get ("r_mapOverBrightBits", "2", CVAR_LATCH );
r_intensity = ri.Cvar_Get ("r_intensity", "1", CVAR_LATCH );
@@ -957,7 +933,7 @@ void R_Register( void )
r_lodbias = ri.Cvar_Get( "r_lodbias", "0", CVAR_ARCHIVE );
r_flares = ri.Cvar_Get ("r_flares", "0", CVAR_ARCHIVE );
r_znear = ri.Cvar_Get( "r_znear", "4", CVAR_CHEAT );
- AssertCvarRange( r_znear, 0.001f, 200, qtrue );
+ ri.Cvar_CheckRange( r_znear, 0.001f, 200, qtrue );
r_zproj = ri.Cvar_Get( "r_zproj", "64", CVAR_ARCHIVE );
r_stereoSeparation = ri.Cvar_Get( "r_stereoSeparation", "64", CVAR_ARCHIVE );
r_ignoreGLErrors = ri.Cvar_Get( "r_ignoreGLErrors", "1", CVAR_ARCHIVE );
diff --git a/code/renderer/tr_public.h b/code/renderer/tr_public.h
index 6cefe16..c6846a9 100644
--- a/code/renderer/tr_public.h
+++ b/code/renderer/tr_public.h
@@ -131,6 +131,7 @@ typedef struct {
cvar_t *(*Cvar_Get)( const char *name, const char *value, int flags );
void (*Cvar_Set)( const char *name, const char *value );
+ void (*Cvar_CheckRange)( cvar_t *cv, float minVal, float maxVal, qboolean shouldBeIntegral );
void (*Cmd_AddCommand)( const char *name, void(*cmd)(void) );
void (*Cmd_RemoveCommand)( const char *name );