summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/bg_misc.c139
-rw-r--r--src/game/bg_pmove.c43
-rw-r--r--src/game/bg_public.h16
-rw-r--r--src/game/g_client.c5
4 files changed, 146 insertions, 57 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index d168b8da..4db19a08 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -889,15 +889,55 @@ Only in CTF games
int bg_numItems = sizeof(bg_itemlist) / sizeof(bg_itemlist[0]) - 1;
-classModelName_t bg_pModelList[ ] =
+classAttributes_t bg_classList[ ] =
{
- { PCL_D_O_BASE, "klesk" },
- { PCL_D_D_BASE, "orbb" },
- { PCL_D_B_BASE, "lucy" },
- { PCL_H_BASE, "sarge" },
+ {
+ PCL_D_O_BASE,
+ "klesk",
+ "default",
+ { -15, -15, -15 },
+ { 15, 15, 15 },
+ { 15, 15, 15 },
+ { -15, -15, -4 },
+ { 15, 15, 4 },
+ 4, 4
+ },
+ {
+ PCL_D_D_BASE,
+ "orbb",
+ "default",
+ { -15, -15, -15 },
+ { 15, 15 ,15 },
+ { 15, 15 ,15 },
+ { -15, -15, -4 },
+ { 15, 15, 4 },
+ 4, 4
+ },
+ {
+ PCL_D_B_BASE,
+ "lucy",
+ "default",
+ { -15, -15, -20 },
+ { 15, 15, 20 },
+ { 15, 15, 20 },
+ { -15, -15, -4 },
+ { 15, 15, 4 },
+ 12, 12
+ },
+ {
+ PCL_H_BASE,
+ "sarge",
+ "default",
+ { -15, -15, -24 },
+ { 15, 15, 32 },
+ { 15, 15, 16 },
+ { -15, -15, -4 },
+ { 15, 15, 4 },
+ 26, 12
+ }
};
-int bg_numPModels = sizeof( bg_pModelList ) / sizeof( bg_pModelList[ 0 ] );
+int bg_numPclasses = sizeof( bg_classList ) / sizeof( bg_classList[ 0 ] );
/*
==============
@@ -908,18 +948,97 @@ char *BG_FindModelNameForClass( int pclass )
{
int i;
- for( i = 0; i < bg_numPModels; i++ )
+ for( i = 0; i < bg_numPclasses; i++ )
{
- if( bg_pModelList[ i ].classNum == pclass )
- return bg_pModelList[ i ].className;
+ if( bg_classList[ i ].classNum == pclass )
+ return bg_classList[ i ].modelName;
}
//wimp out
- return bg_pModelList[ 0 ].className;
+ return bg_classList[ 0 ].modelName;
}
/*
==============
+BG_FindBBoxForClass
+==============
+*/
+void BG_FindBBoxForClass( int pclass, vec3_t mins, vec3_t maxs, vec3_t cmaxs, vec3_t dmins, vec3_t dmaxs )
+{
+ int i;
+
+ for( i = 0; i < bg_numPclasses; i++ )
+ {
+ if( bg_classList[ i ].classNum == pclass )
+ {
+ if( mins != NULL )
+ VectorCopy( bg_classList[ i ].mins, mins );
+
+ if( maxs != NULL )
+ VectorCopy( bg_classList[ i ].maxs, maxs );
+
+ if( cmaxs != NULL )
+ VectorCopy( bg_classList[ i ].crouchMaxs, cmaxs );
+
+ if( dmins != NULL )
+ VectorCopy( bg_classList[ i ].deadMins, dmins );
+
+ if( dmaxs != NULL )
+ VectorCopy( bg_classList[ i ].deadMaxs, dmaxs );
+
+ return;
+ }
+ }
+
+ if( mins != NULL )
+ VectorCopy( bg_classList[ 0 ].mins, mins );
+
+ if( maxs != NULL )
+ VectorCopy( bg_classList[ 0 ].maxs, maxs );
+
+ if( cmaxs != NULL )
+ VectorCopy( bg_classList[ 0 ].crouchMaxs, cmaxs );
+
+ if( dmins != NULL )
+ VectorCopy( bg_classList[ 0 ].deadMins, dmins );
+
+ if( dmaxs != NULL )
+ VectorCopy( bg_classList[ 0 ].deadMaxs, dmaxs );
+}
+
+/*
+==============
+BG_FindViewheightForClass
+==============
+*/
+void BG_FindViewheightForClass( int pclass, int *viewheight, int *cViewheight )
+{
+ int i;
+
+ 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;
+ }
+ }
+
+ if( viewheight != NULL )
+ *viewheight = bg_classList[ 0 ].viewheight;
+
+ if( cViewheight != NULL )
+ *cViewheight = bg_classList[ 0 ].crouchViewheight;
+}
+
+
+/*
+==============
BG_FindItemForPowerup
==============
*/
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index 767395f8..a2e0bc51 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -1854,47 +1854,8 @@ static void PM_CheckDuck (void)
vec3_t PCmins, PCmaxs, PCcmaxs;
int PCvh, PCcvh;
- switch( pm->ps->stats[ STAT_PCLASS ] )
- {
- case PCL_D_B_BASE:
- VectorSet( PCmins, -15, -15, -20 );
- VectorSet( PCmaxs, 15, 15, 20 );
- VectorSet( PCcmaxs, 15, 15, 20 );
- PCvh = 12;
- PCcvh = 12;
- break;
-
- case PCL_D_O_BASE:
- VectorSet( PCmins, -15, -15, -15 );
- VectorSet( PCmaxs, 15, 15, 15 );
- VectorSet( PCcmaxs, 15, 15, 15 );
- PCvh = 4;
- PCcvh = 4;
- break;
-
- case PCL_D_D_BASE:
- VectorSet( PCmins, -15, -15, -15 );
- VectorSet( PCmaxs, 15, 15, 15 );
- VectorSet( PCcmaxs, 15, 15, 15 );
- PCvh = 4;
- PCcvh = 4;
- break;
-
- case PCL_H_BASE:
- VectorSet( PCmins, -15, -15, -24 );
- VectorSet( PCmaxs, 15, 15, 32 );
- VectorSet( PCcmaxs, 15, 15, 16 );
- PCvh = 26;
- PCcvh = 12;
- break;
-
- default:
- VectorSet( PCmins, -15, -15, MINS_Z );
- VectorSet( PCmaxs, 15, 15, 32 );
- VectorSet( PCcmaxs, 15, 15, 16 );
- PCvh = DEFAULT_VIEWHEIGHT;
- PCcvh = CROUCH_VIEWHEIGHT;
- }
+ BG_FindBBoxForClass( pm->ps->stats[ STAT_PCLASS ], PCmins, PCmaxs, PCcmaxs, NULL, NULL );
+ BG_FindViewheightForClass( pm->ps->stats[ STAT_PCLASS ], &PCvh, &PCcvh );
//TA: iD bug? you can still crouch when you're a spectator
if( pm->ps->persistant[PERS_TEAM] == TEAM_SPECTATOR )
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index feee73b8..a9c61caf 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -697,9 +697,17 @@ typedef struct gitem_s {
//TA: player model precaching
typedef struct
{
- int classNum;
- char *className;
-} classModelName_t;
+ int classNum;
+ char *modelName;
+ char *skinName;
+ vec3_t mins;
+ vec3_t maxs;
+ vec3_t crouchMaxs;
+ vec3_t deadMins;
+ vec3_t deadMaxs;
+ int viewheight;
+ int crouchViewheight;
+} classAttributes_t;
// included in both the game dll and the client
@@ -715,6 +723,8 @@ gitem_t *BG_FindItemForHoldable( holdable_t pw );
//TA:
char *BG_FindModelNameForClass( int pclass );
+void BG_FindBBoxForClass( int pclass, vec3_t mins, vec3_t maxs, vec3_t cmaxs, vec3_t dmins, vec3_t dmaxs );
+void BG_FindViewheightForClass( int pclass, int *viewheight, int *cViewheight );
#define ITEM_INDEX(x) ((x)-bg_itemlist)
qboolean BG_CanItemBeGrabbed( int gametype, const entityState_t *ent, const playerState_t *ps );
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 5e6c4c4e..5d6479c7 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -619,9 +619,8 @@ void CopyToBodyQue( gentity_t *ent ) {
body->health = ent->health = ent->client->ps.stats[STAT_HEALTH];
ent->health = ent->client->ps.stats[STAT_HEALTH] = GIB_HEALTH - 1;
- //FIXME: change body dimensions
- VectorSet( body->r.mins, -15, -15, -15 );
- VectorSet( body->r.maxs, 15, 15, 15 );
+ //change body dimensions
+ BG_FindBBoxForClass( ent->client->ps.stats[ STAT_PCLASS ], NULL, NULL, NULL, body->r.mins, body->r.maxs );
//drop to floor
VectorSet( dest, origin[0], origin[1], origin[2] - 4096 );