summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cgame/cg_local.h15
-rw-r--r--src/cgame/cg_main.c17
-rw-r--r--src/cgame/cg_players.c48
-rw-r--r--src/game/bg_misc.c13
-rw-r--r--src/game/bg_public.h1
-rw-r--r--src/game/g_client.c12
-rw-r--r--src/game/g_cmds.c6
7 files changed, 55 insertions, 57 deletions
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 9f14d58e..cf125215 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -929,17 +929,8 @@ typedef struct
//TA: for wolf trail effects
qhandle_t sparkFlareShader;
-} cgMedia_t;
-
-
-//TA: media used for armour switching stuff
-typedef struct
-{
- qhandle_t bsuitLegsModel;
- qhandle_t bsuitTorsoModel;
- qhandle_t bsuitLegsSkin;
- qhandle_t bsuitTorsoSkin;
+ //TA: media used for armour switching stuff
qhandle_t helmetModel;
qhandle_t helmetSkin;
@@ -948,7 +939,8 @@ typedef struct
qhandle_t carmourTorsoSkin;
qhandle_t clarmourTorsoSkin;
qhandle_t larmourTorsoSkin;
-} cgArmourMedia_t;
+} cgMedia_t;
+
// The client game static (cgs) structure hold everything
// loaded or calculated from the gamestate. It will NOT
@@ -1033,7 +1025,6 @@ typedef struct
// media
cgMedia_t media;
- cgArmourMedia_t amedia;
} cgs_t;
//==============================================================================
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index ce687fcb..f2186543 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -888,19 +888,14 @@ static void CG_RegisterClients( void )
trap_UpdateScreen( );
}
- cgs.amedia.bsuitLegsModel = trap_R_RegisterModel( "models/players/tankjr/lower.md3" );
- cgs.amedia.bsuitTorsoModel = trap_R_RegisterModel( "models/players/tankjr/upper.md3" );
- cgs.amedia.bsuitLegsSkin = trap_R_RegisterShader( "models/players/tankjr/lower_default.skin" );
- cgs.amedia.bsuitTorsoSkin = trap_R_RegisterShader( "models/players/tankjr/upper_default.skin" );
+ cgs.media.helmetModel = trap_R_RegisterModel( "models/players/doom/head.md3" );
+ cgs.media.helmetSkin = trap_R_RegisterSkin( "models/players/doom/head_default.skin" );
- cgs.amedia.helmetModel = trap_R_RegisterModel( "models/players/doom/head.md3" );
- cgs.amedia.helmetSkin = trap_R_RegisterShader( "models/players/doom/head_default.skin" );
-
- cgs.amedia.larmourLegsSkin = trap_R_RegisterShader( "models/players/sarge/lower_red.skin" );
+ cgs.media.larmourLegsSkin = trap_R_RegisterSkin( "models/players/sarge/lower_red.skin" );
- cgs.amedia.carmourTorsoSkin = trap_R_RegisterShader( "models/players/sarge/upper_krusade.skin" );
- cgs.amedia.clarmourTorsoSkin = trap_R_RegisterShader( "models/players/sarge/upper_roderic.skin" );
- cgs.amedia.larmourTorsoSkin = trap_R_RegisterShader( "models/players/sarge/upper_blue.skin" );
+ cgs.media.carmourTorsoSkin = trap_R_RegisterSkin( "models/players/sarge/upper_krusade.skin" );
+ cgs.media.clarmourTorsoSkin = trap_R_RegisterSkin( "models/players/sarge/upper_roderic.skin" );
+ cgs.media.larmourTorsoSkin = trap_R_RegisterSkin( "models/players/sarge/upper_blue.skin" );
cg.charModelFraction = 1.0f;
trap_UpdateScreen( );
diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c
index 277a8ea9..3f285ac1 100644
--- a/src/cgame/cg_players.c
+++ b/src/cgame/cg_players.c
@@ -2012,20 +2012,12 @@ void CG_Player( centity_t *cent )
//
if( !ci->nonsegmented )
{
- if( held & ( 1 << UP_BATTLESUIT ) )
- {
- legs.hModel = cgs.amedia.bsuitLegsModel;
- legs.customSkin = cgs.amedia.bsuitLegsSkin;
- }
- else
- {
- legs.hModel = ci->legsModel;
+ legs.hModel = ci->legsModel;
- if( held & ( 1 << UP_LIMBARMOUR ) )
- legs.customSkin = cgs.amedia.larmourLegsSkin;
- else
- legs.customSkin = ci->legsSkin;
- }
+ if( held & ( 1 << UP_LIMBARMOUR ) )
+ legs.customSkin = cgs.media.larmourLegsSkin;
+ else
+ legs.customSkin = ci->legsSkin;
}
else
{
@@ -2085,24 +2077,16 @@ void CG_Player( centity_t *cent )
//
// add the torso
//
- if( held & ( 1 << UP_BATTLESUIT ) )
- {
- torso.hModel = cgs.amedia.bsuitTorsoModel;
- torso.customSkin = cgs.amedia.bsuitTorsoSkin;
- }
+ torso.hModel = ci->torsoModel;
+
+ if( ( held & ( 1 << UP_LIMBARMOUR ) ) && ( held & ( 1 << UP_CHESTARMOUR ) ) )
+ torso.customSkin = cgs.media.clarmourTorsoSkin;
+ else if( held & ( 1 << UP_CHESTARMOUR ) )
+ torso.customSkin = cgs.media.carmourTorsoSkin;
+ else if( held & ( 1 << UP_LIMBARMOUR ) )
+ torso.customSkin = cgs.media.larmourTorsoSkin;
else
- {
- torso.hModel = ci->torsoModel;
-
- if( ( held & ( 1 << UP_LIMBARMOUR ) ) && ( held & ( 1 << UP_CHESTARMOUR ) ) )
- torso.customSkin = cgs.amedia.clarmourTorsoSkin;
- if( held & ( 1 << UP_CHESTARMOUR ) )
- torso.customSkin = cgs.amedia.carmourTorsoSkin;
- if( held & ( 1 << UP_LIMBARMOUR ) )
- torso.customSkin = cgs.amedia.larmourLegsSkin;
- else
- torso.customSkin = ci->torsoSkin;
- }
+ torso.customSkin = ci->torsoSkin;
if( !torso.hModel )
return;
@@ -2121,8 +2105,8 @@ void CG_Player( centity_t *cent )
//
if( held & ( 1 << UP_HELMET ) )
{
- head.hModel = cgs.amedia.helmetModel;
- head.customSkin = cgs.amedia.helmetSkin;
+ head.hModel = cgs.media.helmetModel;
+ head.customSkin = cgs.media.helmetSkin;
}
else
{
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 893f2f2d..1be34a84 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -1575,6 +1575,19 @@ classAttributes_t bg_classList[ ] =
{ PCL_NONE, PCL_NONE, PCL_NONE }, //int children[ 3 ];
0, //int timetoevolve;
0 //int value;
+ },
+ {
+ //this isn't a real class, but a dummy to force the client to precache the model
+ //FIXME: one day do this in a less hacky fashion
+ PCL_H_BSUIT, "bsuit", "bsuit",
+
+ "keel",
+ 1.0f,
+ "default",
+
+ "bsuit", ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), { 0, 0, 0 }, { 0, 0, 0, },
+ { 0, 0, 0, }, { 0, 0, 0, }, { 0, 0, 0, }, 0, 0, 0, 0, 0, WP_NONE, 0.0f, 0,
+ 0.0f, 0, 1.0f, 1.0f, { PCL_NONE, PCL_NONE, PCL_NONE }, 0, 0
}
};
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index f29f8ca5..7db8669d 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -753,6 +753,7 @@ typedef enum
//human class
PCL_H_BASE,
+ PCL_H_BSUIT,
PCL_NUM_CLASSES
} pClass_t;
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 317dde15..4ea52828 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1110,8 +1110,16 @@ void ClientUserinfoChanged( int clientNum )
client->pers.maxHealth = 0;
// set model
- Com_sprintf( buffer, MAX_QPATH, "%s/%s", BG_FindModelNameForClass( client->pers.pclass ),
- BG_FindSkinNameForClass( client->pers.pclass ) );
+ if( client->ps.stats[ STAT_PCLASS ] == PCL_H_BASE && BG_gotItem( UP_BATTLESUIT, client->ps.stats ) )
+ {
+ Com_sprintf( buffer, MAX_QPATH, "%s/%s", BG_FindModelNameForClass( PCL_H_BSUIT ),
+ BG_FindSkinNameForClass( PCL_H_BSUIT ) );
+ }
+ else
+ {
+ Com_sprintf( buffer, MAX_QPATH, "%s/%s", BG_FindModelNameForClass( client->pers.pclass ),
+ BG_FindSkinNameForClass( client->pers.pclass ) );
+ }
Q_strncpyz( model, buffer, sizeof( model ) );
//model segmentation
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 04888634..96b28f52 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -1452,6 +1452,9 @@ void Cmd_Buy_f( gentity_t *ent )
//if the buyer previously had no items at all, force a new selection
if( numItems == 0 )
G_AddEvent( ent, EV_NEXT_WEAPON, 0 );
+
+ //update ClientInfo
+ ClientUserinfoChanged( ent->client->ps.clientNum );
}
@@ -1531,6 +1534,9 @@ void Cmd_Sell_f( gentity_t *ent )
}
else
trap_SendServerCommand( ent-g_entities, va( "print \"Unknown item\n\"" ) );
+
+ //update ClientInfo
+ ClientUserinfoChanged( ent->client->ps.clientNum );
}
/*