diff options
author | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-07-07 22:31:39 +0000 |
---|---|---|
committer | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-07-07 22:31:39 +0000 |
commit | 80e25417be92abff3053a4d8f209349a16e6d334 (patch) | |
tree | 1058d52d8de3d7115cf5b018e00408b0db8c5341 /code/renderer | |
parent | afbf4dd0c3999e58f59b3d4e3dd4b93d6abe8fd0 (diff) | |
download | ioquake3-aero-80e25417be92abff3053a4d8f209349a16e6d334.tar.gz ioquake3-aero-80e25417be92abff3053a4d8f209349a16e6d334.zip |
* Rename voip cvar to cl_voip
* s/#if USE_VOIP/#ifdef USE_VOIP/
* Add generalised runtime cvar range checking, currently on [sv|cl]_voip,
dedicated and a bunch of r_ variables
git-svn-id: svn://svn.icculus.org/quake3/trunk@1420 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/renderer')
-rw-r--r-- | code/renderer/tr_init.c | 30 | ||||
-rw-r--r-- | code/renderer/tr_public.h | 1 |
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 ); |