diff options
author | Tony J. White <tjw@tjw.org> | 2007-02-25 06:33:35 +0000 |
---|---|---|
committer | Tony J. White <tjw@tjw.org> | 2007-02-25 06:33:35 +0000 |
commit | f8b5af2ae48d77e1ce5e1627362e7504adf4a4b3 (patch) | |
tree | fb0725e1856dc265bc423c86588e6ff326785e6a /src | |
parent | 8c5ffed1cb9a22fff0d65511e4f93e714ecafd53 (diff) |
* add support for "viewheight" and "crouchViewheight" elements to the
class overrides config file
Diffstat (limited to 'src')
-rw-r--r-- | src/game/bg_misc.c | 40 | ||||
-rw-r--r-- | src/game/bg_public.h | 2 |
2 files changed, 32 insertions, 10 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 76616a67..322aaa3b 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -2250,26 +2250,34 @@ BG_FindViewheightForClass void BG_FindViewheightForClass( int pclass, int *viewheight, int *cViewheight ) { int i; + int vh = 0; + int cvh = 0; for( i = 0; i < bg_numPclasses; i++ ) { if( bg_classList[ i ].classNum == pclass ) { - if( viewheight != NULL ) - *viewheight = bg_classList[ i ].viewheight; - - if( cViewheight != NULL ) - *cViewheight = bg_classList[ i ].crouchViewheight; - - return; + vh = bg_classList[ i ].viewheight; + cvh = bg_classList[ i ].crouchViewheight; + break; } } + + if( bg_classOverrideList[ pclass ].viewheight != 0 ) + vh = bg_classOverrideList[ pclass ].viewheight; + if( bg_classOverrideList[ pclass ].crouchViewheight != 0 ) + cvh = bg_classOverrideList[ pclass ].crouchViewheight; - if( viewheight != NULL ) - *viewheight = bg_classList[ 0 ].viewheight; + if( vh == 0 ) + vh = bg_classList[ 0 ].viewheight; + if( cvh == 0 ) + cvh = bg_classList[ 0 ].crouchViewheight; + + if( viewheight != NULL ) + *viewheight = vh; if( cViewheight != NULL ) - *cViewheight = bg_classList[ 0 ].crouchViewheight; + *cViewheight = cvh; } /* @@ -2896,6 +2904,18 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides continue; } + else if( !Q_stricmp( token, "viewheight" ) ) + { + token = COM_Parse( &text_p ); + cao->viewheight = atoi( token ); + continue; + } + else if( !Q_stricmp( token, "crouchViewheight" ) ) + { + token = COM_Parse( &text_p ); + cao->crouchViewheight = atoi( token ); + continue; + } else if( !Q_stricmp( token, "zOffset" ) ) { float offset; diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 90e5eb9d..36e01910 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -954,6 +954,8 @@ typedef struct vec3_t crouchMaxs; vec3_t deadMins; vec3_t deadMaxs; + int viewheight; + int crouchViewheight; float zOffset; } classAttributeOverrides_t; |