summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2003-08-31 04:46:38 +0000
committerTim Angus <tim@ngus.net>2003-08-31 04:46:38 +0000
commita82ea16a054bc0a4e138cbe617dbbd673e603b35 (patch)
tree8c809b25a426af7ed40f7cc4c3e3240bc037c793 /src
parentc7d3bd75523726fc4f5230a9c23b5f31537fc5a8 (diff)
* Changed the variable names pteam, pclass and pitem to be more descriptive
* Removed defering stuff from model loader * Modified CG_ScanForExistingClientInfo to load from corpseinfo
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_consolecmds.c2
-rw-r--r--src/cgame/cg_local.h5
-rw-r--r--src/cgame/cg_players.c153
-rw-r--r--src/cgame/cg_servercmds.c7
-rw-r--r--src/game/g_active.c6
-rw-r--r--src/game/g_client.c34
-rw-r--r--src/game/g_cmds.c74
-rw-r--r--src/game/g_combat.c6
-rw-r--r--src/game/g_local.h7
-rw-r--r--src/game/g_main.c4
-rw-r--r--src/game/g_weapon.c4
11 files changed, 93 insertions, 209 deletions
diff --git a/src/cgame/cg_consolecmds.c b/src/cgame/cg_consolecmds.c
index 43c78675..1122bee3 100644
--- a/src/cgame/cg_consolecmds.c
+++ b/src/cgame/cg_consolecmds.c
@@ -190,7 +190,6 @@ static consoleCommand_t commands[ ] =
{ "tell_attacker", CG_TellAttacker_f },
{ "tcmd", CG_TargetCommand_f },
{ "decodeMP3", CG_DecodeMP3_f },
- { "loaddeferred", CG_LoadDeferredPlayers }
};
@@ -290,5 +289,4 @@ void CG_InitConsoleCommands( void )
trap_AddCommand( "deconstruct" );
trap_AddCommand( "menu" );
trap_AddCommand( "ui_menu" );
- trap_AddCommand( "loaddefered" ); // spelled wrong, but not changing for demo
}
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index d3aadb32..f6325261 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -383,8 +383,6 @@ typedef struct
char redTeam[ MAX_TEAMNAME ];
char blueTeam[ MAX_TEAMNAME ];
- qboolean deferred;
-
qboolean newAnims; // true if using the new mission pack animations
qboolean fixedlegs; // true if legs yaw is always the same as torso yaw
qboolean fixedtorso; // true if torso never changes yaw
@@ -1262,7 +1260,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, char *model, char *skin, char *headModel, char *headSkin );
+void CG_PrecacheClientInfo( pClass_t class, char *model, char *skin, char *headModel, char *headSkin );
sfxHandle_t CG_CustomSound( int clientNum, const char *soundName );
//
@@ -1299,7 +1297,6 @@ void CG_Trace( trace_t *result, const vec3_t start, const vec3_t mins, co
void CG_CapTrace( trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end,
int skipNumber, int mask );
void CG_PredictPlayerState( void );
-void CG_LoadDeferredPlayers( void );
//
diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c
index 1cce4788..8ce592b1 100644
--- a/src/cgame/cg_players.c
+++ b/src/cgame/cg_players.c
@@ -421,7 +421,7 @@ static qboolean CG_RegisterClientModelname( clientInfo_t *ci, const char *modelN
{
char filename[ MAX_QPATH * 2 ];
- //TA: do this first so the nonsegemented property is set
+ //TA: do this first so the nonsegmented property is set
// load the animations
Com_sprintf( filename, sizeof( filename ), "models/players/%s/animation.cfg", modelName );
if( !CG_ParseAnimationFile( filename, ci ) )
@@ -521,8 +521,7 @@ static void CG_ColorFromString( const char *v, vec3_t color )
===================
CG_LoadClientInfo
-Load it now, taking the disk hits.
-This will usually be deferred to a safe time
+Load it now, taking the disk hits
===================
*/
static void CG_LoadClientInfo( clientInfo_t *ci )
@@ -546,7 +545,7 @@ static void CG_LoadClientInfo( clientInfo_t *ci )
dir = ci->modelName;
fallback = DEFAULT_MODEL;
- for( i = 0 ; i < MAX_CUSTOM_SOUNDS ; i++ )
+ for( i = 0; i < MAX_CUSTOM_SOUNDS; i++ )
{
s = cg_customSoundNames[ i ];
@@ -558,19 +557,14 @@ static void CG_LoadClientInfo( clientInfo_t *ci )
ci->sounds[ i ] = trap_S_RegisterSound( va( "sound/player/%s/%s", fallback, s + 1 ), qfalse );
}
- ci->deferred = qfalse;
-
// reset any existing players and bodies, because they might be in bad
// frames for this new model
- if( clientNum <= MAX_CLIENTS )
+ clientNum = ci - cgs.clientinfo;
+ for( i = 0; i < MAX_GENTITIES; i++ )
{
- clientNum = ci - cgs.clientinfo;
- for( i = 0; i < MAX_GENTITIES; i++ )
- {
- if( cg_entities[ i ].currentState.clientNum == clientNum &&
- cg_entities[ i ].currentState.eType == ET_PLAYER )
- CG_ResetPlayerEntity( &cg_entities[ i ] );
- }
+ if( cg_entities[ i ].currentState.clientNum == clientNum &&
+ cg_entities[ i ].currentState.eType == ET_PLAYER )
+ CG_ResetPlayerEntity( &cg_entities[ i ] );
}
}
@@ -593,6 +587,7 @@ static void CG_CopyClientInfoModel( clientInfo_t *from, clientInfo_t *to )
to->headSkin = from->headSkin;
to->nonSegModel = from->nonSegModel;
to->nonSegSkin = from->nonSegSkin;
+ to->nonsegmented = from->nonsegmented;
to->modelIcon = from->modelIcon;
memcpy( to->animations, from->animations, sizeof( to->animations ) );
@@ -605,13 +600,15 @@ static void CG_CopyClientInfoModel( clientInfo_t *from, clientInfo_t *to )
CG_GetCorpseNum
======================
*/
-static int CG_GetCorpseNum( int pclass )
+static int CG_GetCorpseNum( pClass_t class )
{
int i;
clientInfo_t *match;
char *modelName;
+ char *skinName;
- modelName = BG_FindModelNameForClass( pclass );
+ modelName = BG_FindModelNameForClass( class );
+ skinName = BG_FindSkinNameForClass( class );
for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ )
{
@@ -620,11 +617,8 @@ static int CG_GetCorpseNum( int pclass )
if( !match->infoValid )
continue;
- if( match->deferred )
- continue;
-
if( !Q_stricmp( modelName, match->modelName )
- /*&& !Q_stricmp( modelName, match->skinName )*/ )
+ && !Q_stricmp( skinName, match->skinName ) )
{
// this clientinfo is identical, so use it's handles
return i;
@@ -646,76 +640,41 @@ static qboolean CG_ScanForExistingClientInfo( clientInfo_t *ci )
int i;
clientInfo_t *match;
- for( i = 0 ; i < cgs.maxclients ; i++ )
+ for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ )
{
- match = &cgs.clientinfo[ i ];
+ match = &cgs.corpseinfo[ i ];
+
if( !match->infoValid )
continue;
- if( match->deferred )
- continue;
-
if( !Q_stricmp( ci->modelName, match->modelName ) &&
!Q_stricmp( ci->skinName, match->skinName ) )
{
// this clientinfo is identical, so use it's handles
- ci->deferred = qfalse;
-
CG_CopyClientInfoModel( match, ci );
return qtrue;
}
}
- // nothing matches, so defer the load
+ //TA: shouldn't happen
return qfalse;
}
-/*
-======================
-CG_SetDeferredClientInfo
-
-We aren't going to load it now, so grab some other
-client's info to use until we have some spare time.
-======================
-*/
-static void CG_SetDeferredClientInfo( clientInfo_t *ci )
-{
- int i;
- clientInfo_t *match;
-
- // find the first valid clientinfo and grab its stuff
- for( i = 0; i < cgs.maxclients; i++ )
- {
- match = &cgs.clientinfo[ i ];
- if( !match->infoValid )
- continue;
-
- ci->deferred = qtrue;
- CG_CopyClientInfoModel( match, ci );
- return;
- }
-
- // we should never get here...
- CG_Printf( "CG_SetDeferredClientInfo: no valid clients!\n" );
-
- CG_LoadClientInfo( ci );
-}
-
/*
======================
CG_PrecacheClientInfo
======================
*/
-void CG_PrecacheClientInfo( int clientNum, char *model, char *skin, char *headModel, char *headSkin )
+void CG_PrecacheClientInfo( pClass_t class, char *model, char *skin, char *headModel, char *headSkin )
{
clientInfo_t *ci;
clientInfo_t newInfo;
const char *v;
char *slash;
- ci = &cgs.corpseinfo[ clientNum ];
+ ci = &cgs.corpseinfo[ class ];
// the old value
memset( &newInfo, 0, sizeof( newInfo ) );
@@ -740,8 +699,9 @@ void CG_PrecacheClientInfo( int clientNum, char *model, char *skin, char *headMo
else
Q_strncpyz( newInfo.headSkinName, headSkin, sizeof( newInfo.headSkinName ) );
- newInfo.deferred = qfalse;
newInfo.infoValid = qtrue;
+
+ //TA: actually register the models
CG_LoadClientInfo( &newInfo );
*ci = newInfo;
}
@@ -763,13 +723,12 @@ void CG_NewClientInfo( int clientNum )
ci = &cgs.clientinfo[ clientNum ];
configstring = CG_ConfigString( clientNum + CS_PLAYERS );
- if( !configstring[0] )
+ if( !configstring[ 0 ] )
{
memset( ci, 0, sizeof( *ci ) );
return; // player just left
}
- // build into a temp buffer so the defer checks can use
// the old value
memset( &newInfo, 0, sizeof( newInfo ) );
@@ -859,37 +818,7 @@ void CG_NewClientInfo( int clientNum )
// scan for an existing clientinfo that matches this modelname
// so we can avoid loading checks if possible
if( !CG_ScanForExistingClientInfo( &newInfo ) )
- {
- qboolean forceDefer;
-
- forceDefer = trap_MemoryRemaining( ) < 4000000;
-
- // if we are defering loads, just have it pick the first valid
- //TA: we should only defer models when ABSOLUTELY TOTALLY necessary since models are precached
- if( forceDefer )
- {
- // keep whatever they had if it won't violate team skins
- if ( ci->infoValid && ( !Q_stricmp( newInfo.skinName, ci->skinName ) ) )
- {
- CG_CopyClientInfoModel( ci, &newInfo );
- newInfo.deferred = qtrue;
- }
- else
- {
- // use whatever is available
- CG_SetDeferredClientInfo( &newInfo );
- }
-
- // if we are low on memory, leave them with this model
- if( forceDefer )
- {
- CG_Printf( "Memory is low. Using deferred model.\n" );
- newInfo.deferred = qfalse;
- }
- }
- else
- CG_LoadClientInfo( &newInfo );
- }
+ CG_LoadClientInfo( &newInfo );
// replace whatever was there with the new one
newInfo.infoValid = qtrue;
@@ -899,38 +828,6 @@ void CG_NewClientInfo( int clientNum )
/*
-======================
-CG_LoadDeferredPlayers
-
-Called each frame when a player is dead
-and the scoreboard is up
-so deferred players can be loaded
-======================
-*/
-void CG_LoadDeferredPlayers( void )
-{
- int i;
- clientInfo_t *ci;
-
- // scan for a deferred player to load
- for( i = 0, ci = cgs.clientinfo; i < cgs.maxclients; i++, ci++ )
- {
- if( ci->infoValid && ci->deferred )
- {
- // if we are low on memory, leave it deferred
- if( trap_MemoryRemaining( ) < 4000000 )
- {
- CG_Printf( "Memory is low. Using deferred model.\n" );
- ci->deferred = qfalse;
- continue;
- }
-
- CG_LoadClientInfo( ci );
- }
- }
-}
-
-/*
=============================================================================
PLAYER ANIMATION
@@ -2026,7 +1923,7 @@ void CG_Player( centity_t *cent )
CG_PlayerSprites( cent );
// add the shadow
- //TA: but only for humans
+ //TA: but only for humans FIXME this is dumb
if( team == PTE_HUMANS )
shadow = CG_PlayerShadow( cent, &shadowPlane );
diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c
index 98af076a..e3fee20c 100644
--- a/src/cgame/cg_servercmds.c
+++ b/src/cgame/cg_servercmds.c
@@ -781,13 +781,6 @@ static void CG_ServerCommand( void )
trap_R_RemapShader( CG_Argv( 1 ), CG_Argv( 2 ), CG_Argv( 3 ) );
}
- // loaddeferred can be both a servercmd and a consolecmd
- if( !strcmp( cmd, "loaddefered" ) )
- { // FIXME: spelled wrong, but not changing for demo
- CG_LoadDeferredPlayers( );
- return;
- }
-
// clientLevelShot is sent before taking a special screenshot for
// the menu system during development
if( !strcmp( cmd, "clientLevelShot" ) )
diff --git a/src/game/g_active.c b/src/game/g_active.c
index df67d1a3..564e1f37 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -349,11 +349,11 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd )
if( ( client->buttons & BUTTON_ATTACK ) && !( client->oldbuttons & BUTTON_ATTACK ) )
{
- if( client->pers.pteam == PTE_NONE )
+ if( client->pers.teamSelection == PTE_NONE )
G_TriggerMenu( client->ps.clientNum, MN_TEAM );
- else if( client->pers.pteam == PTE_ALIENS )
+ else if( client->pers.teamSelection == PTE_ALIENS )
G_TriggerMenu( client->ps.clientNum, MN_A_CLASS );
- else if( client->pers.pteam == PTE_HUMANS )
+ else if( client->pers.teamSelection == PTE_HUMANS )
G_TriggerMenu( client->ps.clientNum, MN_H_SPAWN );
}
}
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 5b582458..1789ac4f 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1044,7 +1044,7 @@ void ClientUserinfoChanged( int clientNum )
client->pers.maxHealth = 100;
//hack to force a client update if the config string does not change between spawning
- if( client->pers.pclass == PCL_NONE )
+ if( client->pers.classSelection == PCL_NONE )
client->pers.maxHealth = 0;
// set model
@@ -1053,7 +1053,7 @@ void ClientUserinfoChanged( int clientNum )
Com_sprintf( buffer, MAX_QPATH, "%s/%s", BG_FindModelNameForClass( PCL_H_BSUIT ),
BG_FindSkinNameForClass( PCL_H_BSUIT ) );
}
- else if( client->pers.pclass == PCL_NONE )
+ else if( client->pers.classSelection == PCL_NONE )
{
//This looks hacky and frankly it is. The clientInfo string needs to hold different
//model details to that of the spawning class or the info change will not be
@@ -1064,17 +1064,17 @@ void ClientUserinfoChanged( int clientNum )
}
else
{
- Com_sprintf( buffer, MAX_QPATH, "%s/%s", BG_FindModelNameForClass( client->pers.pclass ),
- BG_FindSkinNameForClass( client->pers.pclass ) );
+ Com_sprintf( buffer, MAX_QPATH, "%s/%s", BG_FindModelNameForClass( client->pers.classSelection ),
+ BG_FindSkinNameForClass( client->pers.classSelection ) );
}
Q_strncpyz( model, buffer, sizeof( model ) );
//don't bother setting model type if spectating
- if( client->pers.pclass != PCL_NONE )
+ if( client->pers.classSelection != PCL_NONE )
{
//model segmentation
Com_sprintf( filename, sizeof( filename ), "models/players/%s/animation.cfg",
- BG_FindModelNameForClass( client->pers.pclass ) );
+ BG_FindModelNameForClass( client->pers.classSelection ) );
if( G_NonSegModel( filename ) )
client->ps.persistant[ PERS_STATE ] |= PS_NONSEGMODEL;
@@ -1289,15 +1289,15 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
index = ent - g_entities;
client = ent->client;
- teamLocal = client->pers.pteam;
+ teamLocal = client->pers.teamSelection;
//TA: only start client if chosen a class and joined a team
- if( client->pers.pclass == PCL_NONE && teamLocal == PTE_NONE )
+ if( client->pers.classSelection == PCL_NONE && teamLocal == PTE_NONE )
{
client->sess.sessionTeam = TEAM_SPECTATOR;
client->sess.spectatorState = SPECTATOR_FREE;
}
- else if( client->pers.pclass == PCL_NONE )
+ else if( client->pers.classSelection == PCL_NONE )
{
client->sess.sessionTeam = TEAM_SPECTATOR;
client->sess.spectatorState = SPECTATOR_LOCKED;
@@ -1374,7 +1374,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
trap_GetUserinfo( index, userinfo, sizeof( userinfo ) );
client->ps.eFlags = flags;
- //Com_Printf( "ent->client->pers->pclass = %i\n", ent->client->pers.pclass );
+ //Com_Printf( "ent->client->pers->pclass = %i\n", ent->client->pers.classSelection );
ent->s.groundEntityNum = ENTITYNUM_NONE;
ent->client = &level.clients[ index ];
@@ -1402,7 +1402,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
client->ps.eFlags = flags;
client->ps.clientNum = index;
- BG_FindBBoxForClass( ent->client->pers.pclass, ent->r.mins, ent->r.maxs, NULL, NULL, NULL );
+ BG_FindBBoxForClass( ent->client->pers.classSelection, ent->r.mins, ent->r.maxs, NULL, NULL, NULL );
hModifier = 1.0f;
@@ -1416,18 +1416,18 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
if( client->sess.sessionTeam != TEAM_SPECTATOR )
client->pers.maxHealth = client->ps.stats[ STAT_MAX_HEALTH ] =
- (int)( (float)BG_FindHealthForClass( ent->client->pers.pclass ) * hModifier );
+ (int)( (float)BG_FindHealthForClass( ent->client->pers.classSelection ) * hModifier );
else
client->pers.maxHealth = client->ps.stats[ STAT_MAX_HEALTH ] = 100;
// clear entity values
- if( ent->client->pers.pclass == PCL_H_BASE )
+ if( ent->client->pers.classSelection == PCL_H_BASE )
{
BG_packWeapon( WP_BLASTER, client->ps.stats );
- weapon = client->pers.pitem;
+ weapon = client->pers.humanItemSelection;
}
else if( client->sess.sessionTeam != TEAM_SPECTATOR )
- weapon = BG_FindStartWeaponForClass( ent->client->pers.pclass );
+ weapon = BG_FindStartWeaponForClass( ent->client->pers.classSelection );
else
weapon = WP_NONE;
@@ -1435,8 +1435,8 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
BG_packWeapon( weapon, client->ps.stats );
BG_packAmmoArray( weapon, client->ps.ammo, client->ps.powerups, ammo, clips, maxClips );
- ent->client->ps.stats[ STAT_PCLASS ] = ent->client->pers.pclass;
- ent->client->ps.stats[ STAT_PTEAM ] = ent->client->pers.pteam;
+ ent->client->ps.stats[ STAT_PCLASS ] = ent->client->pers.classSelection;
+ ent->client->ps.stats[ STAT_PTEAM ] = ent->client->pers.teamSelection;
ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE;
ent->client->ps.stats[ STAT_STATE ] = 0;
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index d1dc7eca..692b54b0 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -344,28 +344,28 @@ void Cmd_Team_f( gentity_t *ent )
//TA: rip out the q3a team system :)
- oldTeam = ent->client->pers.pteam;
+ oldTeam = ent->client->pers.teamSelection;
trap_Argv( 1, s, sizeof( s ) );
if( !strlen( s ) )
{
- trap_SendServerCommand( ent-g_entities, va("print \"team: %i\n\"", ent->client->pers.pteam ) );
+ trap_SendServerCommand( ent-g_entities, va("print \"team: %i\n\"", ent->client->pers.teamSelection ) );
return;
}
if( !Q_stricmp( s, "0" ) || !Q_stricmp( s, "spectate" ) )
- ent->client->pers.pteam = PTE_NONE;
+ ent->client->pers.teamSelection = PTE_NONE;
else if( !Q_stricmp( s, "1" ) || !Q_stricmp( s, "aliens" ) )
- ent->client->pers.pteam = PTE_ALIENS;
+ ent->client->pers.teamSelection = PTE_ALIENS;
else if( !Q_stricmp( s, "2" ) || !Q_stricmp( s, "humans" ) )
- ent->client->pers.pteam = PTE_HUMANS;
+ ent->client->pers.teamSelection = PTE_HUMANS;
- if( oldTeam != ent->client->pers.pteam )
+ if( oldTeam != ent->client->pers.teamSelection )
{
level.bankCredits[ ent->client->ps.clientNum ] = 0;
ent->client->ps.persistant[ PERS_CREDIT ] = 0;
- ent->client->pers.pclass = 0;
+ ent->client->pers.classSelection = 0;
ClientSpawn( ent, NULL, NULL, NULL );
}
@@ -987,7 +987,7 @@ void Cmd_Class_f( gentity_t *ent )
numClasses = 2;
}
- if( ent->client->pers.pteam == PTE_ALIENS &&
+ if( ent->client->pers.teamSelection == PTE_ALIENS &&
!( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING ) &&
!( ent->client->ps.stats[ STAT_STATE ] & SS_HOVELING ) &&
!( ent->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBING ) &&
@@ -997,20 +997,20 @@ void Cmd_Class_f( gentity_t *ent )
if( ent->client->ps.stats[ STAT_PCLASS ] != PCL_NONE )
{
//evolve now
- ent->client->pers.pclass = BG_FindClassNumForName( s );
+ ent->client->pers.classSelection = BG_FindClassNumForName( s );
- if( ent->client->pers.pclass == PCL_NONE )
+ if( ent->client->pers.classSelection == PCL_NONE )
{
trap_SendServerCommand( ent-g_entities, va( "print \"Unknown class\n\"" ) );
return;
}
- numLevels = BG_ClassCanEvolveFromTo( ent->client->ps.stats[ STAT_PCLASS ], ent->client->pers.pclass,
+ numLevels = BG_ClassCanEvolveFromTo( ent->client->ps.stats[ STAT_PCLASS ], ent->client->pers.classSelection,
(short)ent->client->ps.persistant[ PERS_CREDIT ], 0 );
BG_FindBBoxForClass( ent->client->ps.stats[ STAT_PCLASS ],
fromMins, fromMaxs, NULL, NULL, NULL );
- BG_FindBBoxForClass( ent->client->pers.pclass,
+ BG_FindBBoxForClass( ent->client->pers.classSelection,
toMins, toMaxs, NULL, NULL, NULL );
VectorCopy( ent->s.pos.trBase, infestOrigin );
@@ -1023,7 +1023,7 @@ void Cmd_Class_f( gentity_t *ent )
if( tr.fraction == 1.0f )
{
//...check we can evolve to that class
- if( numLevels && BG_FindStagesForClass( ent->client->pers.pclass, g_alienStage.integer ) )
+ if( numLevels && BG_FindStagesForClass( ent->client->pers.classSelection, g_alienStage.integer ) )
{
//remove credit
ent->client->ps.persistant[ PERS_CREDIT ] -= (short)numLevels;
@@ -1035,14 +1035,14 @@ void Cmd_Class_f( gentity_t *ent )
}
else
{
- ent->client->pers.pclass = PCL_NONE;
+ ent->client->pers.classSelection = PCL_NONE;
trap_SendServerCommand( ent-g_entities, va( "print \"You cannot evolve from your current class\n\"" ) );
return;
}
}
else
{
- ent->client->pers.pclass = PCL_NONE;
+ ent->client->pers.classSelection = PCL_NONE;
G_TriggerMenu( clientNum, MN_A_NOEROOM );
return;
}
@@ -1050,16 +1050,16 @@ void Cmd_Class_f( gentity_t *ent )
else
{
//spawning from an egg
- ent->client->pers.pclass = BG_FindClassNumForName( s );
+ ent->client->pers.classSelection = BG_FindClassNumForName( s );
- if( ent->client->pers.pclass != PCL_NONE )
+ if( ent->client->pers.classSelection != PCL_NONE )
{
for( i = 0; i < numClasses; i++ )
{
- if( allowedClasses[ i ] == ent->client->pers.pclass &&
- BG_FindStagesForClass( ent->client->pers.pclass, g_alienStage.integer ) )
+ if( allowedClasses[ i ] == ent->client->pers.classSelection &&
+ BG_FindStagesForClass( ent->client->pers.classSelection, g_alienStage.integer ) )
{
- if( ( spawn = SelectTremulousSpawnPoint( ent->client->pers.pteam, spawn_origin, spawn_angles ) ) &&
+ if( ( spawn = SelectTremulousSpawnPoint( ent->client->pers.teamSelection, spawn_origin, spawn_angles ) ) &&
level.numAlienSpawns > 0 ) //sanity check
{
ent->client->sess.sessionTeam = TEAM_FREE;
@@ -1075,7 +1075,7 @@ void Cmd_Class_f( gentity_t *ent )
}
}
- ent->client->pers.pclass = PCL_NONE;
+ ent->client->pers.classSelection = PCL_NONE;
trap_SendServerCommand( ent-g_entities, va( "print \"You cannot spawn as this class\n\"" ) );
}
else
@@ -1085,7 +1085,7 @@ void Cmd_Class_f( gentity_t *ent )
}
}
}
- else if( ent->client->pers.pteam == PTE_HUMANS )
+ else if( ent->client->pers.teamSelection == PTE_HUMANS )
{
//humans cannot use this command whilst alive
if( ent->client->ps.stats[ STAT_PCLASS ] != PCL_NONE )
@@ -1094,21 +1094,21 @@ void Cmd_Class_f( gentity_t *ent )
return;
}
- ent->client->pers.pclass = PCL_H_BASE;
+ ent->client->pers.classSelection = PCL_H_BASE;
//set the item to spawn with
if( !Q_stricmp( s, BG_FindNameForWeapon( WP_MACHINEGUN ) ) )
- ent->client->pers.pitem = WP_MACHINEGUN;
+ ent->client->pers.humanItemSelection = WP_MACHINEGUN;
else if( !Q_stricmp( s, BG_FindNameForWeapon( WP_HBUILD ) ) )
- ent->client->pers.pitem = WP_HBUILD;
+ ent->client->pers.humanItemSelection = WP_HBUILD;
else
{
- ent->client->pers.pclass = PCL_NONE;
+ ent->client->pers.classSelection = PCL_NONE;
trap_SendServerCommand( ent-g_entities, va( "print \"Unknown starting item\n\"" ) );
return;
}
- if( ( spawn = SelectTremulousSpawnPoint( ent->client->pers.pteam, spawn_origin, spawn_angles ) ) &&
+ if( ( spawn = SelectTremulousSpawnPoint( ent->client->pers.teamSelection, spawn_origin, spawn_angles ) ) &&
level.numHumanSpawns > 0 ) //sanity check
{
ent->client->sess.sessionTeam = TEAM_FREE;
@@ -1121,10 +1121,10 @@ void Cmd_Class_f( gentity_t *ent )
return;
}
}
- else if( ent->client->pers.pteam == PTE_NONE )
+ else if( ent->client->pers.teamSelection == PTE_NONE )
{
//can't use this command unless on a team
- ent->client->pers.pclass = PCL_NONE;
+ ent->client->pers.classSelection = PCL_NONE;
ent->client->sess.sessionTeam = TEAM_FREE;
ClientSpawn( ent, NULL, NULL, NULL );
trap_SendServerCommand( ent-g_entities, va( "print \"Join a team first\n\"" ) );
@@ -1156,7 +1156,7 @@ void Cmd_Destroy_f( gentity_t *ent, qboolean deconstruct )
if( tr.fraction < 1.0 &&
( traceEnt->s.eType == ET_BUILDABLE ) &&
- ( traceEnt->biteam == ent->client->pers.pteam ) &&
+ ( traceEnt->biteam == ent->client->pers.teamSelection ) &&
( ( ent->client->ps.weapon >= WP_ABUILD ) &&
( ent->client->ps.weapon <= WP_HBUILD ) ) )
{
@@ -1192,7 +1192,7 @@ void Cmd_ActivateItem_f( gentity_t *ent )
trap_Argv( 1, s, sizeof( s ) );
upgrade = BG_FindUpgradeNumForName( s );
- if( ent->client->pers.pteam != PTE_HUMANS )
+ if( ent->client->pers.teamSelection != PTE_HUMANS )
return;
if( BG_gotItem( upgrade, ent->client->ps.stats ) )
@@ -1217,7 +1217,7 @@ void Cmd_DeActivateItem_f( gentity_t *ent )
trap_Argv( 1, s, sizeof( s ) );
upgrade = BG_FindUpgradeNumForName( s );
- if( ent->client->pers.pteam != PTE_HUMANS )
+ if( ent->client->pers.teamSelection != PTE_HUMANS )
return;
if( BG_gotItem( upgrade, ent->client->ps.stats ) )
@@ -1240,7 +1240,7 @@ void Cmd_ToggleItem_f( gentity_t *ent )
trap_Argv( 1, s, sizeof( s ) );
upgrade = BG_FindUpgradeNumForName( s );
- if( ent->client->pers.pteam != PTE_HUMANS )
+ if( ent->client->pers.teamSelection != PTE_HUMANS )
return;
if( BG_gotItem( upgrade, ent->client->ps.stats ) )
@@ -1285,7 +1285,7 @@ void Cmd_Buy_f( gentity_t *ent )
trap_Argv( 1, s, sizeof( s ) );
//aliens don't buy stuff
- if( ent->client->pers.pteam != PTE_HUMANS )
+ if( ent->client->pers.teamSelection != PTE_HUMANS )
return;
for ( i = 1, armouryEntity = g_entities + i; i < level.num_entities; i++, armouryEntity++ )
@@ -1499,7 +1499,7 @@ void Cmd_Sell_f( gentity_t *ent )
trap_Argv( 1, s, sizeof( s ) );
//aliens don't sell stuff
- if( ent->client->pers.pteam != PTE_HUMANS )
+ if( ent->client->pers.teamSelection != PTE_HUMANS )
return;
for ( i = 1, armouryEntity = g_entities + i; i < level.num_entities; i++, armouryEntity++ )
@@ -1588,7 +1588,7 @@ void Cmd_Deposit_f( gentity_t *ent )
trap_Argv( 1, s, sizeof( s ) );
- if( ent->client->pers.pteam == PTE_HUMANS )
+ if( ent->client->pers.teamSelection == PTE_HUMANS )
{
for ( i = 1, bankEntity = g_entities + i; i < level.num_entities; i++, bankEntity++ )
{
@@ -1650,7 +1650,7 @@ void Cmd_Withdraw_f( gentity_t *ent )
trap_Argv( 1, s, sizeof( s ) );
- if( ent->client->pers.pteam == PTE_HUMANS )
+ if( ent->client->pers.teamSelection == PTE_HUMANS )
{
for ( i = 1, bankEntity = g_entities + i; i < level.num_entities; i++, bankEntity++ )
{
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index 3372a7fc..f1e47877 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -302,12 +302,12 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
Cmd_Score_f( g_entities + i );
}
- self->client->pers.pclass = 0; //TA: reset the classtype
+ self->client->pers.classSelection = 0; //TA: reset the classtype
self->takedamage = qtrue; // can still be gibbed
self->s.weapon = WP_NONE;
- /*self->s.powerups = 0;*/ //TA: class is encoded into powers in trem
+ /*self->s.powerups = 0;*/ //TA: class is encoded into powerups in trem
self->r.contents = CONTENTS_BODY;
//self->r.contents = CONTENTS_CORPSE;
@@ -815,7 +815,7 @@ dflags these flags are used to control how T_Damage works
void G_SelectiveDamage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
vec3_t dir, vec3_t point, int damage, int dflags, int mod, int team )
{
- if( targ->client && ( team != targ->client->pers.pteam ) )
+ if( targ->client && ( team != targ->client->ps.stats[ STAT_PTEAM ] ) )
G_Damage( targ, inflictor, attacker, dir, point, damage, dflags, mod );
}
diff --git a/src/game/g_local.h b/src/game/g_local.h
index e156d0f0..9e2584b5 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -282,10 +282,9 @@ typedef struct
int teamVoteCount; // to prevent people from constantly calling votes
qboolean teamInfo; // send team overlay updates?
- int pclass; //TA: player class (copied to ent->client->ps.stats[ STAT_PCLASS ] once spawned)
- //not really persistant.. this is just a nice place to stick it :)
- int pitem; //TA: humans have a starting item
- int pteam; //TA: player team (copied to ps.stats[ STAT_PTEAM ])
+ pClass_t classSelection; //TA: player class (copied to ent->client->ps.stats[ STAT_PCLASS ] once spawned)
+ weapon_t humanItemSelection; //TA: humans have a starting item
+ pTeam_t teamSelection; //TA: player team (copied to ps.stats[ STAT_PTEAM ])
} clientPersistant_t;
// this structure is cleared on each ClientSpawn(),
diff --git a/src/game/g_main.c b/src/game/g_main.c
index bc74cfe9..4283b8eb 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -771,14 +771,14 @@ void CalculateRanks( void )
level.numConnectedClients++;
//TA: so we know when the game ends and for team leveling
- if( level.clients[ i ].pers.pteam == PTE_ALIENS )
+ if( level.clients[ i ].ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
{
level.numAlienClients++;
if( level.clients[ i ].sess.sessionTeam != TEAM_SPECTATOR )
level.numLiveAlienClients++;
}
- if( level.clients[ i ].pers.pteam == PTE_HUMANS )
+ if( level.clients[ i ].ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
{
level.numHumanClients++;
if( level.clients[ i ].sess.sessionTeam != TEAM_SPECTATOR )
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index 983d040c..2590503e 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -461,7 +461,7 @@ void cancelBuildFire( gentity_t *ent )
}
//repair buildable
- if( ent->client->pers.pteam == PTE_HUMANS )
+ if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
{
AngleVectors( ent->client->ps.viewangles, forward, NULL, NULL );
VectorMA( ent->client->ps.origin, 100, forward, end );
@@ -471,7 +471,7 @@ void cancelBuildFire( gentity_t *ent )
if( tr.fraction < 1.0 &&
( traceEnt->s.eType == ET_BUILDABLE ) &&
- ( traceEnt->biteam == ent->client->pers.pteam ) &&
+ ( traceEnt->biteam == ent->client->ps.stats[ STAT_PTEAM ] ) &&
( ( ent->client->ps.weapon >= WP_HBUILD2 ) &&
( ent->client->ps.weapon <= WP_HBUILD ) ) )
{