diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_players.c | 13 | ||||
-rw-r--r-- | src/game/bg_misc.c | 139 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 43 | ||||
-rw-r--r-- | src/game/bg_public.h | 16 | ||||
-rw-r--r-- | src/game/g_client.c | 5 |
5 files changed, 155 insertions, 61 deletions
diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index f2b1aaff..fcd464d1 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -1947,6 +1947,7 @@ void CG_Corpse( centity_t *cent ) int renderfx; qboolean shadow; float shadowPlane; + vec3_t origin, liveZ, deadZ; //if this is the first time the function has been run set cent->corpseNum cent->corpseNum = CG_GetCorpseNum( cent->currentState.clientNum ); @@ -1967,6 +1968,10 @@ void CG_Corpse( centity_t *cent ) memset( &torso, 0, sizeof(torso) ); memset( &head, 0, sizeof(head) ); + VectorCopy( cent->lerpOrigin, origin ); + BG_FindBBoxForClass( cent->currentState.clientNum, liveZ, NULL, NULL, deadZ, NULL ); + origin[ 2 ] -= ( liveZ[ 2 ] - deadZ[ 2 ] ); + // get the rotation information CG_PlayerAngles( cent, legs.axis, torso.axis, head.axis ); @@ -2003,9 +2008,9 @@ void CG_Corpse( centity_t *cent ) legs.hModel = ci->legsModel; legs.customSkin = ci->legsSkin; - VectorCopy( cent->lerpOrigin, legs.origin ); + VectorCopy( origin, legs.origin ); - VectorCopy( cent->lerpOrigin, legs.lightingOrigin ); + VectorCopy( origin, legs.lightingOrigin ); legs.shadowPlane = shadowPlane; legs.renderfx = renderfx; VectorCopy (legs.origin, legs.oldorigin); // don't positionally lerp at all @@ -2028,7 +2033,7 @@ void CG_Corpse( centity_t *cent ) torso.customSkin = ci->torsoSkin; - VectorCopy( cent->lerpOrigin, torso.lightingOrigin ); + VectorCopy( origin, torso.lightingOrigin ); CG_PositionRotatedEntityOnTag( &torso, &legs, ci->legsModel, "tag_torso"); @@ -2047,7 +2052,7 @@ void CG_Corpse( centity_t *cent ) } head.customSkin = ci->headSkin; - VectorCopy( cent->lerpOrigin, head.lightingOrigin ); + VectorCopy( origin, head.lightingOrigin ); CG_PositionRotatedEntityOnTag( &head, &torso, ci->torsoModel, "tag_head"); 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 ); |