summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/bg_misc.c40
-rw-r--r--src/game/bg_public.h2
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;