summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cgame/cg_draw.c3
-rw-r--r--src/cgame/cg_ents.c14
-rw-r--r--src/cgame/cg_local.h24
-rw-r--r--src/cgame/cg_main.c32
-rw-r--r--src/cgame/cg_players.c141
-rw-r--r--src/game/g_client.c2
-rw-r--r--src/game/g_main.c26
7 files changed, 117 insertions, 125 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 5efe2862..229f2994 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -928,7 +928,8 @@ static void CG_DrawUsableBuildable( rectDef_t *rect, qhandle_t shader, vec4_t co
es = &cg_entities[ trace.entityNum ].currentState;
- if( es->eType == ET_BUILDABLE && BG_FindUsableForBuildable( es->modelindex ) )
+ if( ( es->eType == ET_BUILDABLE && BG_FindUsableForBuildable( es->modelindex ) ) ||
+ cg.nearbyCorpse )
{
trap_R_SetColor( color );
CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c
index cea7e935..6283e7ff 100644
--- a/src/cgame/cg_ents.c
+++ b/src/cgame/cg_ents.c
@@ -963,6 +963,7 @@ void CG_AddPacketEntities( void )
cg.ep.numHumanBuildables = 0;
cg.ep.numAlienClients = 0;
cg.ep.numHumanClients = 0;
+ cg.nearbyCorpse = qfalse;
for( num = 0 ; num < cg.snap->numEntities ; num++ )
{
@@ -998,6 +999,19 @@ void CG_AddPacketEntities( void )
cg.ep.numHumanClients++;
}
}
+ else if( cent->currentState.eType == ET_CORPSE )
+ {
+#define INFEST_RADIUS 64.0f
+
+ if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS &&
+ Distance( cg.refdef.vieworg, cent->lerpOrigin ) < INFEST_RADIUS )
+ {
+ if( cent->currentState.eType == ET_CORPSE &&
+ ( cent->currentState.powerups == cg.predictedPlayerState.clientNum ||
+ cent->currentState.powerups == 65535 ) )
+ cg.nearbyCorpse = qtrue;
+ }
+ }
}
//Com_Printf( "%d %d\n", cgIP.numAlienClients, cgIP.numHumanClients );
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 23bf1867..9f14d58e 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -751,6 +751,7 @@ typedef struct
int numConsoleLines;
qboolean consoleValid;
+ qboolean nearbyCorpse;
} cg_t;
@@ -931,6 +932,24 @@ typedef struct
} cgMedia_t;
+//TA: media used for armour switching stuff
+typedef struct
+{
+ qhandle_t bsuitLegsModel;
+ qhandle_t bsuitTorsoModel;
+ qhandle_t bsuitLegsSkin;
+ qhandle_t bsuitTorsoSkin;
+
+ qhandle_t helmetModel;
+ qhandle_t helmetSkin;
+
+ qhandle_t larmourLegsSkin;
+
+ qhandle_t carmourTorsoSkin;
+ qhandle_t clarmourTorsoSkin;
+ qhandle_t larmourTorsoSkin;
+} cgArmourMedia_t;
+
// The client game static (cgs) structure hold everything
// loaded or calculated from the gamestate. It will NOT
// be cleared when a tournement restart is done, allowing
@@ -1013,7 +1032,8 @@ typedef struct
qhandle_t activeCursor;
// media
- cgMedia_t media;
+ cgMedia_t media;
+ cgArmourMedia_t amedia;
} cgs_t;
//==============================================================================
@@ -1239,7 +1259,7 @@ void CG_Corpse( centity_t *cent );
void CG_ResetPlayerEntity( centity_t *cent );
void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, int team );
void CG_NewClientInfo( int clientNum );
-void CG_PrecacheClientInfo( int clientNum );
+void CG_PrecacheClientInfo( int clientNum, char *model, char *skin, char *headModel, char *headSkin );
sfxHandle_t CG_CustomSound( int clientNum, const char *soundName );
//
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index ae295975..ce687fcb 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -870,6 +870,8 @@ CG_RegisterClients
*/
static void CG_RegisterClients( void )
{
+ char buffer[ MAX_INFO_STRING ];
+ char *s;
int i;
cg.charModelFraction = 0.0f;
@@ -877,18 +879,32 @@ static void CG_RegisterClients( void )
//precache all the models/sounds/etc
for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ )
{
- const char *clientInfo;
-
- clientInfo = CG_ConfigString( CS_PRECACHES + i );
- if( !clientInfo[0] )
- continue;
+ CG_PrecacheClientInfo( i, BG_FindModelNameForClass( i ),
+ BG_FindSkinNameForClass( i ),
+ BG_FindModelNameForClass( i ),
+ BG_FindSkinNameForClass( i ) );
- CG_PrecacheClientInfo( i );
-
- cg.charModelFraction = (float)i / (float)( PCL_NUM_CLASSES - 1 );
+ cg.charModelFraction = (float)i / (float)PCL_NUM_CLASSES;
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.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.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" );
+
+ cg.charModelFraction = 1.0f;
+ trap_UpdateScreen( );
+
//load all the clientinfos of clients already connected to the server
for( i = 0; i < MAX_CLIENTS; i++ )
{
diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c
index 2ab59e1f..277a8ea9 100644
--- a/src/cgame/cg_players.c
+++ b/src/cgame/cg_players.c
@@ -708,107 +708,37 @@ static void CG_SetDeferredClientInfo( clientInfo_t *ci )
CG_PrecacheClientInfo
======================
*/
-void CG_PrecacheClientInfo( int clientNum )
+void CG_PrecacheClientInfo( int clientNum, char *model, char *skin, char *headModel, char *headSkin )
{
clientInfo_t *ci;
clientInfo_t newInfo;
- const char *configstring;
const char *v;
char *slash;
ci = &cgs.corpseinfo[ clientNum ];
- //CG_Printf( "%d %d\n", clientNum, (clientNum - MAX_CLIENTS ) );
-
- configstring = CG_ConfigString( clientNum + CS_PRECACHES );
- if( !configstring[ 0 ] )
- return; // player just left
-
- // build into a temp buffer so the defer checks can use
// the old value
memset( &newInfo, 0, sizeof( newInfo ) );
- // isolate the player's name
- v = Info_ValueForKey( configstring, "n" );
- Q_strncpyz( newInfo.name, v, sizeof( newInfo.name ) );
-
- // colors
- v = Info_ValueForKey( configstring, "c1" );
- CG_ColorFromString( v, newInfo.color1 );
-
- v = Info_ValueForKey( configstring, "c2" );
- CG_ColorFromString( v, newInfo.color2 );
-
- // bot skill
- v = Info_ValueForKey( configstring, "skill" );
- newInfo.botSkill = atoi( v );
-
- // handicap
- v = Info_ValueForKey( configstring, "hc" );
- newInfo.handicap = atoi( v );
-
- // wins
- v = Info_ValueForKey( configstring, "w" );
- newInfo.wins = atoi( v );
-
- // losses
- v = Info_ValueForKey( configstring, "l" );
- newInfo.losses = atoi( v );
-
- // team
- v = Info_ValueForKey( configstring, "t" );
- newInfo.team = atoi( v );
-
- // team task
- v = Info_ValueForKey( configstring, "tt" );
- newInfo.teamTask = atoi( v );
-
- // team leader
- v = Info_ValueForKey( configstring, "tl" );
- newInfo.teamLeader = atoi( v );
-
- v = Info_ValueForKey( configstring, "g_redteam" );
- Q_strncpyz( newInfo.redTeam, v, MAX_TEAMNAME );
-
- v = Info_ValueForKey( configstring, "g_blueteam" );
- Q_strncpyz( newInfo.blueTeam, v, MAX_TEAMNAME );
-
// model
- v = Info_ValueForKey( configstring, "model" );
- Q_strncpyz( newInfo.modelName, v, sizeof( newInfo.modelName ) );
+ Q_strncpyz( newInfo.modelName, model, sizeof( newInfo.modelName ) );
- slash = strchr( newInfo.modelName, '/' );
- if( !slash )
- {
- // modelName didn not include a skin name
+ // modelName didn not include a skin name
+ if( !skin )
Q_strncpyz( newInfo.skinName, "default", sizeof( newInfo.skinName ) );
- }
else
- {
- Q_strncpyz( newInfo.skinName, slash + 1, sizeof( newInfo.skinName ) );
- // truncate modelName
- *slash = 0;
- }
+ Q_strncpyz( newInfo.skinName, skin, sizeof( newInfo.skinName ) );
//CG_Printf( "PCI: %s\n", v );
// head model
- v = Info_ValueForKey( configstring, "hmodel" );
- Q_strncpyz( newInfo.headModelName, v, sizeof( newInfo.headModelName ) );
+ Q_strncpyz( newInfo.headModelName, headModel, sizeof( newInfo.headModelName ) );
- slash = strchr( newInfo.headModelName, '/' );
-
- if( !slash )
- {
- // modelName didn not include a skin name
+ // modelName didn not include a skin name
+ if( !headSkin )
Q_strncpyz( newInfo.headSkinName, "default", sizeof( newInfo.headSkinName ) );
- }
else
- {
- Q_strncpyz( newInfo.headSkinName, slash + 1, sizeof( newInfo.headSkinName ) );
- // truncate modelName
- *slash = 0;
- }
+ Q_strncpyz( newInfo.headSkinName, headSkin, sizeof( newInfo.headSkinName ) );
newInfo.deferred = qfalse;
newInfo.infoValid = qtrue;
@@ -1999,6 +1929,7 @@ void CG_Player( centity_t *cent )
float scale;
vec3_t tempAxis[ 3 ], tempAxis2[ 3 ];
vec3_t angles;
+ int held = es->modelindex;
// the client number is stored in clientNum. It can't be derived
// from the entity number, because a single client may have
@@ -2081,8 +2012,20 @@ void CG_Player( centity_t *cent )
//
if( !ci->nonsegmented )
{
- legs.hModel = ci->legsModel;
- legs.customSkin = ci->legsSkin;
+ if( held & ( 1 << UP_BATTLESUIT ) )
+ {
+ legs.hModel = cgs.amedia.bsuitLegsModel;
+ legs.customSkin = cgs.amedia.bsuitLegsSkin;
+ }
+ else
+ {
+ legs.hModel = ci->legsModel;
+
+ if( held & ( 1 << UP_LIMBARMOUR ) )
+ legs.customSkin = cgs.amedia.larmourLegsSkin;
+ else
+ legs.customSkin = ci->legsSkin;
+ }
}
else
{
@@ -2142,12 +2085,28 @@ void CG_Player( centity_t *cent )
//
// add the torso
//
- torso.hModel = ci->torsoModel;
+ if( held & ( 1 << UP_BATTLESUIT ) )
+ {
+ torso.hModel = cgs.amedia.bsuitTorsoModel;
+ torso.customSkin = cgs.amedia.bsuitTorsoSkin;
+ }
+ 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;
+ }
+
if( !torso.hModel )
return;
- torso.customSkin = ci->torsoSkin;
-
VectorCopy( cent->lerpOrigin, torso.lightingOrigin );
CG_PositionRotatedEntityOnTag( &torso, &legs, ci->legsModel, "tag_torso" );
@@ -2160,12 +2119,20 @@ void CG_Player( centity_t *cent )
//
// add the head
//
- head.hModel = ci->headModel;
+ if( held & ( 1 << UP_HELMET ) )
+ {
+ head.hModel = cgs.amedia.helmetModel;
+ head.customSkin = cgs.amedia.helmetSkin;
+ }
+ else
+ {
+ head.hModel = ci->headModel;
+ head.customSkin = ci->headSkin;
+ }
+
if( !head.hModel )
return;
- head.customSkin = ci->headSkin;
-
VectorCopy( cent->lerpOrigin, head.lightingOrigin );
CG_PositionRotatedEntityOnTag( &head, &torso, ci->torsoModel, "tag_head" );
diff --git a/src/game/g_client.c b/src/game/g_client.c
index edd2ebed..317dde15 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -707,7 +707,7 @@ void SpawnCorpse( gentity_t *ent )
body->timestamp = level.time;
body->s.event = 0;
body->r.contents = CONTENTS_CORPSE;
- body->clipmask = CONTENTS_SOLID | CONTENTS_PLAYERCLIP;
+ body->clipmask = MASK_DEADSOLID;
body->s.clientNum = ent->client->ps.stats[ STAT_PCLASS ];
body->nonSegModel = ent->client->ps.persistant[ PERS_STATE ] & PS_NONSEGMODEL;
diff --git a/src/game/g_main.c b/src/game/g_main.c
index d77abc86..dbaef63b 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -325,31 +325,6 @@ void G_FindTeams( void )
G_Printf( "%i teams with %i entities\n", c, c2 );
}
-/*
-=================
-G_RegisterPlayerModels
-=================
-*/
-void G_RegisterPlayerModels( void )
-{
- char buffer[ MAX_INFO_STRING ];
- char *s;
- int i;
-
- for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ )
- {
- Com_sprintf( buffer, MAX_INFO_STRING, "%s/%s",
- BG_FindModelNameForClass( i ), BG_FindSkinNameForClass( i ) );
- s = va( "n\\%s%d\\t\\%i\\model\\%s\\hmodel\\%s\\g_redteam\\%s\\"
- "g_blueteam\\%s\\c1\\%s\\hc\\%i\\w\\%i\\l\\%i\\tt\\%d\\tl\\%d",
- "precache", i, 0, buffer, buffer, 0, 0, "7", 100, 0, 0, 0, 0);
-
- trap_SetConfigstring( CS_PRECACHES + i, s );
- }
-
-}
-
-
void G_RemapTeamShaders( )
{
}
@@ -501,7 +476,6 @@ void G_InitGame( int levelTime, int randomSeed, int restart )
G_FindTeams( );
//TA:
- G_RegisterPlayerModels( );
G_InitDamageLocations( );
G_Printf( "-----------------------------------\n" );