summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2009-10-03 11:42:48 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:16 +0000
commit50d9e8eab7934e0b76c04ef4a300f0fe93d4f7f5 (patch)
treefe963ef7588cb6086dab611d184e11d324048a65 /src/cgame
parentc37ba185e89c73bc33e9ac19ee840c5e5ed49bb3 (diff)
* Replace reams of BG_Find* functions with: BG_Buildable, BG_Class, BG_Weapon,
BG_Upgrade * Move "overrides/*" to "configs/" and remove all the overriden data from bg_misc.c, instead requiring it to be in the cfg files * Add cfg files to source control * Clean up some naming and typing issues
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_buildable.c43
-rw-r--r--src/cgame/cg_draw.c18
-rw-r--r--src/cgame/cg_event.c20
-rw-r--r--src/cgame/cg_main.c12
-rw-r--r--src/cgame/cg_players.c30
-rw-r--r--src/cgame/cg_predict.c2
-rw-r--r--src/cgame/cg_servercmds.c8
-rw-r--r--src/cgame/cg_tutorial.c24
-rw-r--r--src/cgame/cg_view.c10
-rw-r--r--src/cgame/cg_weapons.c22
10 files changed, 95 insertions, 94 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c
index 00e2c2c2..03e43e17 100644
--- a/src/cgame/cg_buildable.c
+++ b/src/cgame/cg_buildable.c
@@ -108,7 +108,7 @@ static void CG_Creep( centity_t *cent )
float size, frac;
trace_t tr;
vec3_t temp, origin;
- int scaleUpTime = BG_FindBuildTimeForBuildable( cent->currentState.modelindex );
+ int scaleUpTime = BG_Buildable( cent->currentState.modelindex )->buildTime;
int time;
time = cent->currentState.time;
@@ -338,7 +338,7 @@ void CG_InitBuildables( void )
for( i = BA_NONE + 1; i < BA_NUM_BUILDABLES; i++ )
{
- buildableName = BG_FindNameForBuildable( i );
+ buildableName = BG_Buildable( i )->name;
//animation.cfg
Com_sprintf( filename, sizeof( filename ), "models/buildables/%s/animation.cfg", buildableName );
@@ -353,7 +353,8 @@ void CG_InitBuildables( void )
//models
for( j = 0; j <= 3; j++ )
{
- if( ( modelFile = BG_FindModelsForBuildable( i, j ) ) )
+ modelFile = BG_BuildableConfig( i )->models[ j ];
+ if( strlen( modelFile ) > 0 )
cg_buildables[ i ].models[ j ] = trap_R_RegisterModel( modelFile );
}
@@ -375,7 +376,7 @@ void CG_InitBuildables( void )
else
{
//file doesn't exist - use default
- if( BG_FindTeamForBuildable( i ) == TEAM_ALIENS )
+ if( BG_Buildable( i )->team == TEAM_ALIENS )
cg_buildables[ i ].sounds[ j ].sound = defaultAlienSounds[ j ];
else
cg_buildables[ i ].sounds[ j ].sound = defaultHumanSounds[ j ];
@@ -447,7 +448,7 @@ static void CG_RunBuildableLerpFrame( centity_t *cent )
{
if( cg_debugRandom.integer )
CG_Printf( "Sound for animation %d for a %s\n",
- newAnimation, BG_FindHumanNameForBuildable( buildable ) );
+ newAnimation, BG_Buildable( buildable )->humanName );
trap_S_StartSound( cent->lerpOrigin, cent->currentState.number, CHAN_AUTO,
cg_buildables[ buildable ].sounds[ newAnimation ].sound );
@@ -505,7 +506,7 @@ static void CG_BuildableAnimation( centity_t *cent, int *old, int *now, float *b
CG_Printf( "%d->%d l:%d t:%d %s(%d)\n",
cent->oldBuildableAnim, cent->buildableAnim,
es->legsAnim, es->torsoAnim,
- BG_FindHumanNameForBuildable( es->modelindex ), es->number );
+ BG_Buildable( es->modelindex )->humanName, es->number );
if( cent->buildableAnim == es->torsoAnim || es->legsAnim & ANIM_FORCEBIT )
cent->buildableAnim = cent->oldBuildableAnim = es->legsAnim;
@@ -585,7 +586,7 @@ void CG_GhostBuildable( buildable_t buildable )
memset( &ent, 0, sizeof( ent ) );
- BG_FindBBoxForBuildable( buildable, mins, maxs );
+ BG_BuildableBoundingBox( buildable, mins, maxs );
BG_PositionBuildableRelativeToPlayer( ps, mins, maxs, CG_Trace, entity_origin, angles, &tr );
@@ -593,7 +594,7 @@ void CG_GhostBuildable( buildable_t buildable )
mins, maxs, ent.axis, ent.origin );
//offset on the Z axis if required
- VectorMA( ent.origin, BG_FindZOffsetForBuildable( buildable ), tr.plane.normal, ent.origin );
+ VectorMA( ent.origin, BG_BuildableConfig( buildable )->zOffset, tr.plane.normal, ent.origin );
VectorCopy( ent.origin, ent.lightingOrigin );
VectorCopy( ent.origin, ent.oldorigin ); // don't positionally lerp at all
@@ -606,7 +607,7 @@ void CG_GhostBuildable( buildable_t buildable )
ent.customShader = cgs.media.redBuildShader;
//rescale the model
- scale = BG_FindModelScaleForBuildable( buildable );
+ scale = BG_BuildableConfig( buildable )->modelScale;
if( scale != 1.0f )
{
@@ -631,7 +632,7 @@ CG_BuildableParticleEffects
static void CG_BuildableParticleEffects( centity_t *cent )
{
entityState_t *es = &cent->currentState;
- team_t team = BG_FindTeamForBuildable( es->modelindex );
+ team_t team = BG_Buildable( es->modelindex )->team;
int health = es->generic1 & B_HEALTH_MASK;
float healthFrac = (float)health / B_HEALTH_MASK;
@@ -840,7 +841,7 @@ static void CG_BuildableStatusDisplay( centity_t *cent )
entityState_t *hit;
int anim;
- if( BG_FindTeamForBuildable( es->modelindex ) == TEAM_ALIENS )
+ if( BG_Buildable( es->modelindex )->team == TEAM_ALIENS )
bs = &cgs.alienBuildStat;
else
bs = &cgs.humanBuildStat;
@@ -855,7 +856,7 @@ static void CG_BuildableStatusDisplay( centity_t *cent )
Vector4Copy( bs->foreColor, color );
// trace for center point
- BG_FindBBoxForBuildable( es->modelindex, mins, maxs );
+ BG_BuildableBoundingBox( es->modelindex, mins, maxs );
// hack for shrunken barricades
anim = es->torsoAnim & ~( ANIM_FORCEBIT | ANIM_TOGGLEBIT );
@@ -907,7 +908,7 @@ static void CG_BuildableStatusDisplay( centity_t *cent )
if( tr.entityNum < MAX_CLIENTS || ( hit->eType == ET_BUILDABLE &&
( !( es->eFlags & EF_B_SPAWNED ) ||
- BG_FindTransparentTestForBuildable( hit->modelindex ) ) ) )
+ BG_Buildable( hit->modelindex )->transparentTest ) ) )
{
entNum = tr.entityNum;
VectorCopy( tr.endpos, trOrigin );
@@ -1063,7 +1064,7 @@ static void CG_BuildableStatusDisplay( centity_t *cent )
int healthMax;
int healthPoints;
- healthMax = BG_FindHealthForBuildable( es->modelindex );
+ healthMax = BG_Buildable( es->modelindex )->health;
healthPoints = (int)( healthScale * healthMax );
if( health > 0 && healthPoints < 1 )
healthPoints = 1;
@@ -1118,8 +1119,8 @@ static qboolean CG_PlayerIsBuilder( buildable_t buildable )
case WP_ABUILD:
case WP_ABUILD2:
case WP_HBUILD:
- return BG_FindTeamForBuildable( buildable ) ==
- BG_FindTeamForWeapon( cg.predictedPlayerState.weapon );
+ return BG_Buildable( buildable )->team ==
+ BG_Weapon( cg.predictedPlayerState.weapon )->team;
default:
return qfalse;
@@ -1190,7 +1191,7 @@ void CG_Buildable( centity_t *cent )
vec3_t surfNormal, xNormal, mins, maxs;
vec3_t refNormal = { 0.0f, 0.0f, 1.0f };
float rotAngle;
- team_t team = BG_FindTeamForBuildable( es->modelindex );
+ team_t team = BG_Buildable( es->modelindex )->team;
float scale;
int health;
float healthScale;
@@ -1217,7 +1218,7 @@ void CG_Buildable( centity_t *cent )
VectorCopy( es->origin2, surfNormal );
VectorCopy( es->angles, angles );
- BG_FindBBoxForBuildable( es->modelindex, mins, maxs );
+ BG_BuildableBoundingBox( es->modelindex, mins, maxs );
if( es->pos.trType == TR_STATIONARY )
{
@@ -1247,7 +1248,7 @@ void CG_Buildable( centity_t *cent )
}
//offset on the Z axis if required
- VectorMA( ent.origin, BG_FindZOffsetForBuildable( es->modelindex ), surfNormal, ent.origin );
+ VectorMA( ent.origin, BG_BuildableConfig( es->modelindex )->zOffset, surfNormal, ent.origin );
VectorCopy( ent.origin, ent.oldorigin ); // don't positionally lerp at all
VectorCopy( ent.origin, ent.lightingOrigin );
@@ -1272,7 +1273,7 @@ void CG_Buildable( centity_t *cent )
CG_BuildableAnimation( cent, &ent.oldframe, &ent.frame, &ent.backlerp );
//rescale the model
- scale = BG_FindModelScaleForBuildable( es->modelindex );
+ scale = BG_BuildableConfig( es->modelindex )->modelScale;
if( scale != 1.0f )
{
@@ -1387,7 +1388,7 @@ void CG_Buildable( centity_t *cent )
weaponInfo_t *weapon = &cg_weapons[ es->weapon ];
if( cg.time - cent->muzzleFlashTime > MUZZLE_FLASH_TIME ||
- BG_FindProjTypeForBuildable( es->modelindex ) == WP_TESLAGEN )
+ BG_Buildable( es->modelindex )->turretProjType == WP_TESLAGEN )
{
if( weapon->wim[ WPM_PRIMARY ].flashDlightColor[ 0 ] ||
weapon->wim[ WPM_PRIMARY ].flashDlightColor[ 1 ] ||
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index a84f3730..8e42e4ca 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -530,7 +530,7 @@ static void CG_DrawPlayerClipsRing( rectDef_t *rect, vec4_t color, qhandle_t sha
default:
if( ps->weaponstate == WEAPON_RELOADING )
{
- maxDelay = (float)BG_FindReloadTimeForWeapon( cent->currentState.weapon );
+ maxDelay = (float)BG_Weapon( cent->currentState.weapon )->reloadTime;
progress = ( maxDelay - (float)ps->weaponTime ) / maxDelay;
color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF );
@@ -756,13 +756,13 @@ 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 ) &&
- cg.predictedPlayerState.stats[ STAT_TEAM ] == BG_FindTeamForBuildable( es->modelindex ) )
+ if( es->eType == ET_BUILDABLE && BG_Buildable( es->modelindex )->usable &&
+ cg.predictedPlayerState.stats[ STAT_TEAM ] == BG_Buildable( es->modelindex )->team )
{
//hack to prevent showing the usable buildable when you aren't carrying an energy weapon
if( ( es->modelindex == BA_H_REACTOR || es->modelindex == BA_H_REPEATER ) &&
- ( !BG_FindUsesEnergyForWeapon( cg.snap->ps.weapon ) ||
- BG_FindInfinteAmmoForWeapon( cg.snap->ps.weapon ) ) )
+ ( !BG_Weapon( cg.snap->ps.weapon )->usesEnergy ||
+ BG_Weapon( cg.snap->ps.weapon )->infiniteAmmo ) )
return;
trap_R_SetColor( color );
@@ -2092,7 +2092,7 @@ void CG_DrawWeaponIcon( rectDef_t *rect, vec4_t color )
ps = &cg.snap->ps;
weapon = BG_GetPlayerWeapon( ps );
- BG_FindAmmoForWeapon( weapon, &maxAmmo, NULL );
+ maxAmmo = BG_Weapon( weapon )->maxAmmo;
// don't display if dead
if( cg.predictedPlayerState.stats[ STAT_HEALTH ] <= 0 )
@@ -2103,7 +2103,7 @@ void CG_DrawWeaponIcon( rectDef_t *rect, vec4_t color )
CG_RegisterWeapon( weapon );
- if( ps->clips == 0 && !BG_FindInfinteAmmoForWeapon( weapon ) )
+ if( ps->clips == 0 && !BG_Weapon( weapon )->infiniteAmmo )
{
float ammoPercent = (float)ps->ammo / (float)maxAmmo;
@@ -2161,7 +2161,7 @@ static void CG_DrawCrosshair( void )
return;
if( cg_drawCrosshair.integer == CROSSHAIR_RANGEDONLY &&
- !BG_FindLongRangedForWeapon( weapon ) )
+ !BG_Weapon( weapon )->longRanged )
return;
if( ( cg.snap->ps.persistant[ PERS_SPECSTATE ] != SPECTATOR_NOT ) ||
@@ -2990,7 +2990,7 @@ static void CG_Draw2D( void )
UI_Text_Paint( 320 - w / 2, 440, 0.7f, color, SPECTATOR_STRING, 0, 0, ITEM_TEXTSTYLE_SHADOWED );
}
else
- menu = Menus_FindByName( BG_FindHudNameForClass( cg.predictedPlayerState.stats[ STAT_CLASS ] ) );
+ menu = Menus_FindByName( BG_ClassConfig( cg.predictedPlayerState.stats[ STAT_CLASS ] )->hudName );
if( !( cg.snap->ps.stats[ STAT_STATE ] & SS_INFESTING ) &&
!( cg.snap->ps.stats[ STAT_STATE ] & SS_HOVELING ) && menu &&
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index 65f728d3..2aa0a13c 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -276,49 +276,49 @@ static void CG_Obituary( entityState_t *ent )
case MOD_LEVEL1_CLAW:
message = "was swiped by";
Com_sprintf( className, 64, "'s %s",
- BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL1 ) );
+ BG_ClassConfig( PCL_ALIEN_LEVEL1 )->humanName );
message2 = className;
break;
case MOD_LEVEL2_CLAW:
message = "was clawed by";
Com_sprintf( className, 64, "'s %s",
- BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL2 ) );
+ BG_ClassConfig( PCL_ALIEN_LEVEL2 )->humanName );
message2 = className;
break;
case MOD_LEVEL2_ZAP:
message = "was zapped by";
Com_sprintf( className, 64, "'s %s",
- BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL2 ) );
+ BG_ClassConfig( PCL_ALIEN_LEVEL2 )->humanName );
message2 = className;
break;
case MOD_LEVEL3_CLAW:
message = "was chomped by";
Com_sprintf( className, 64, "'s %s",
- BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL3 ) );
+ BG_ClassConfig( PCL_ALIEN_LEVEL3 )->humanName );
message2 = className;
break;
case MOD_LEVEL3_POUNCE:
message = "was pounced upon by";
Com_sprintf( className, 64, "'s %s",
- BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL3 ) );
+ BG_ClassConfig( PCL_ALIEN_LEVEL3 )->humanName );
message2 = className;
break;
case MOD_LEVEL3_BOUNCEBALL:
message = "was sniped by";
Com_sprintf( className, 64, "'s %s",
- BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL3 ) );
+ BG_ClassConfig( PCL_ALIEN_LEVEL3 )->humanName );
message2 = className;
break;
case MOD_LEVEL4_CLAW:
message = "was mauled by";
Com_sprintf( className, 64, "'s %s",
- BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL4 ) );
+ BG_ClassConfig( PCL_ALIEN_LEVEL4 )->humanName );
message2 = className;
break;
case MOD_LEVEL4_TRAMPLE:
message = "should have gotten out of the way of";
Com_sprintf( className, 64, "'s %s",
- BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL4 ) );
+ BG_ClassConfig( PCL_ALIEN_LEVEL4 )->humanName );
message2 = className;
break;
case MOD_LEVEL4_CRUSH:
@@ -333,7 +333,7 @@ static void CG_Obituary( entityState_t *ent )
case MOD_LEVEL1_PCLOUD:
message = "was gassed by";
Com_sprintf( className, 64, "'s %s",
- BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL1 ) );
+ BG_ClassConfig( PCL_ALIEN_LEVEL1 )->humanName );
message2 = className;
break;
@@ -477,7 +477,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
if( cg.snap->ps.persistant[ PERS_SPECSTATE ] != SPECTATOR_NOT )
steptime = 200;
else
- steptime = BG_FindSteptimeForClass( cg.snap->ps.stats[ STAT_CLASS ] );
+ steptime = BG_Class( cg.snap->ps.stats[ STAT_CLASS ] )->steptime;
es = &cent->currentState;
event = es->event & ~EV_EVENT_BITS;
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 10769252..9dd1a953 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -465,13 +465,13 @@ static void CG_SetUIVars( void )
for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ )
{
if( BG_InventoryContainsWeapon( i, cg.snap->ps.stats ) &&
- BG_FindPurchasableForWeapon( i ) )
+ BG_Weapon( i )->purchasable )
strcat( carriageCvar, va( "W%d ", i ) );
}
for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ )
{
if( BG_InventoryContainsUpgrade( i, cg.snap->ps.stats ) &&
- BG_FindPurchasableForUpgrade( i ) )
+ BG_Upgrade( i )->purchasable )
strcat( carriageCvar, va( "U%d ", i ) );
}
strcat( carriageCvar, "$" );
@@ -984,8 +984,8 @@ static void CG_RegisterClients( void )
//precache all the models/sounds/etc
for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ )
{
- CG_PrecacheClientInfo( i, BG_FindModelNameForClass( i ),
- BG_FindSkinNameForClass( i ) );
+ CG_PrecacheClientInfo( i, BG_ClassConfig( i )->modelName,
+ BG_ClassConfig( i )->skinName );
cg.charModelFraction = (float)i / (float)PCL_NUM_CLASSES;
trap_UpdateScreen( );
@@ -1792,8 +1792,8 @@ void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum )
cgs.media.outlineShader = trap_R_RegisterShader( "outline" );
// load overrides
- BG_InitClassOverrides( );
- BG_InitBuildableOverrides( );
+ BG_InitClassConfigs( );
+ BG_InitBuildableConfigs( );
BG_InitAllowedGameElements( );
// Dynamic memory
diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c
index cbbc0277..dcbe86db 100644
--- a/src/cgame/cg_players.c
+++ b/src/cgame/cg_players.c
@@ -635,8 +635,8 @@ static int CG_GetCorpseNum( class_t class )
char *modelName;
char *skinName;
- modelName = BG_FindModelNameForClass( class );
- skinName = BG_FindSkinNameForClass( class );
+ modelName = BG_ClassConfig( class )->modelName;
+ skinName = BG_ClassConfig( class )->skinName;
for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ )
{
@@ -645,8 +645,8 @@ static int CG_GetCorpseNum( class_t class )
if( !match->infoValid )
continue;
- if( !Q_stricmp( modelName, match->modelName )
- && !Q_stricmp( skinName, match->skinName ) )
+ if( !Q_stricmp( modelName, match->modelName ) &&
+ !Q_stricmp( skinName, match->skinName ) )
{
// this clientinfo is identical, so use it's handles
return i;
@@ -1608,7 +1608,7 @@ static qboolean CG_PlayerShadow( centity_t *cent, float *shadowPlane, class_t cl
entityState_t *es = &cent->currentState;
vec3_t surfNormal = { 0.0f, 0.0f, 1.0f };
- BG_FindBBoxForClass( class, mins, maxs, NULL, NULL, NULL );
+ BG_ClassBoundingBox( class, mins, maxs, NULL, NULL, NULL );
mins[ 2 ] = 0.0f;
maxs[ 2 ] = 2.0f;
@@ -1654,7 +1654,7 @@ static qboolean CG_PlayerShadow( centity_t *cent, float *shadowPlane, class_t cl
// without taking a spot in the cg_marks array
CG_ImpactMark( cgs.media.shadowMarkShader, trace.endpos, trace.plane.normal,
cent->pe.legs.yawAngle, 0.0f, 0.0f, 0.0f, alpha, qfalse,
- 24.0f * BG_FindShadowScaleForClass( class ), qtrue );
+ 24.0f * BG_ClassConfig( class )->shadowScale, qtrue );
return qtrue;
}
@@ -1677,7 +1677,7 @@ static void CG_PlayerSplash( centity_t *cent, class_t class )
if( !cg_shadows.integer )
return;
- BG_FindBBoxForClass( class, mins, maxs, NULL, NULL, NULL );
+ BG_ClassBoundingBox( class, mins, maxs, NULL, NULL, NULL );
VectorCopy( cent->lerpOrigin, end );
end[ 2 ] += mins[ 2 ];
@@ -1707,7 +1707,7 @@ static void CG_PlayerSplash( centity_t *cent, class_t class )
CG_ImpactMark( cgs.media.wakeMarkShader, trace.endpos, trace.plane.normal,
cent->pe.legs.yawAngle, 1.0f, 1.0f, 1.0f, 1.0f, qfalse,
- 32.0f * BG_FindShadowScaleForClass( class ), qtrue );
+ 32.0f * BG_ClassConfig( class )->shadowScale, qtrue );
}
@@ -1897,7 +1897,7 @@ void CG_Player( centity_t *cent )
{
vec3_t mins, maxs;
- BG_FindBBoxForClass( class, mins, maxs, NULL, NULL, NULL );
+ BG_ClassBoundingBox( class, mins, maxs, NULL, NULL, NULL );
CG_DrawBoundingBox( cent->lerpOrigin, mins, maxs );
}
@@ -1996,7 +1996,7 @@ void CG_Player( centity_t *cent )
else
VectorCopy( es->angles2, surfNormal );
- BG_FindBBoxForClass( class, mins, maxs, NULL, NULL, NULL );
+ BG_ClassBoundingBox( class, mins, maxs, NULL, NULL, NULL );
VectorMA( legs.origin, -TRACE_DEPTH, surfNormal, end );
VectorMA( legs.origin, 1.0f, surfNormal, start );
@@ -2012,7 +2012,7 @@ void CG_Player( centity_t *cent )
}
//rescale the model
- scale = BG_FindModelScaleForClass( class );
+ scale = BG_ClassConfig( class )->modelScale;
if( scale != 1.0f )
{
@@ -2024,7 +2024,7 @@ void CG_Player( centity_t *cent )
}
//offset on the Z axis if required
- VectorMA( legs.origin, BG_FindZOffsetForClass( class ), surfNormal, legs.origin );
+ VectorMA( legs.origin, BG_ClassConfig( class )->zOffset, surfNormal, legs.origin );
VectorCopy( legs.origin, legs.lightingOrigin );
VectorCopy( legs.origin, legs.oldorigin ); // don't positionally lerp at all
@@ -2158,7 +2158,7 @@ void CG_Corpse( centity_t *cent )
memset( &head, 0, sizeof( head ) );
VectorCopy( cent->lerpOrigin, origin );
- BG_FindBBoxForClass( es->clientNum, liveZ, NULL, NULL, deadZ, NULL );
+ BG_ClassBoundingBox( es->clientNum, liveZ, NULL, NULL, deadZ, NULL );
origin[ 2 ] -= ( liveZ[ 2 ] - deadZ[ 2 ] );
VectorCopy( es->angles, cent->lerpAngles );
@@ -2225,11 +2225,11 @@ void CG_Corpse( centity_t *cent )
VectorCopy( origin, legs.lightingOrigin );
legs.shadowPlane = shadowPlane;
legs.renderfx = renderfx;
- legs.origin[ 2 ] += BG_FindZOffsetForClass( es->clientNum );
+ legs.origin[ 2 ] += BG_ClassConfig( es->clientNum )->zOffset;
VectorCopy( legs.origin, legs.oldorigin ); // don't positionally lerp at all
//rescale the model
- scale = BG_FindModelScaleForClass( es->clientNum );
+ scale = BG_ClassConfig( es->clientNum )->modelScale;
if( scale != 1.0f )
{
diff --git a/src/cgame/cg_predict.c b/src/cgame/cg_predict.c
index 5c8ef974..94dc34a9 100644
--- a/src/cgame/cg_predict.c
+++ b/src/cgame/cg_predict.c
@@ -138,7 +138,7 @@ static void CG_ClipMoveToEntities ( const vec3_t start, const vec3_t mins,
bmaxs[ 2 ] = zu;
if( i == cg_numSolidEntities )
- BG_FindBBoxForClass( ( ent->misc >> 8 ) & 0xFF, bmins, bmaxs, NULL, NULL, NULL );
+ BG_ClassBoundingBox( ( ent->misc >> 8 ) & 0xFF, bmins, bmaxs, NULL, NULL, NULL );
cmodel = trap_CM_TempBoxModel( bmins, bmaxs );
VectorCopy( vec3_origin, angles );
diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c
index 813820f3..6c45fcb1 100644
--- a/src/cgame/cg_servercmds.c
+++ b/src/cgame/cg_servercmds.c
@@ -840,7 +840,7 @@ void CG_Menu( int menu, int arg )
case MN_A_CANTEVOLVE:
shortMsg = va( "You cannot evolve to %s",
- BG_FindHumanNameForClassNum( arg ) );
+ BG_ClassConfig( arg )->humanName );
type = DT_ARMOURYEVOLVE;
break;
@@ -856,19 +856,19 @@ void CG_Menu( int menu, int arg )
case MN_A_CLASSNOTSPAWN:
shortMsg = va( "You cannot spawn as %s",
- BG_FindHumanNameForClassNum( arg ) );
+ BG_ClassConfig( arg )->humanName );
type = DT_ARMOURYEVOLVE;
break;
case MN_A_CLASSNOTALLOWED:
shortMsg = va( "%s is not allowed",
- BG_FindHumanNameForClassNum( arg ) );
+ BG_ClassConfig( arg )->humanName );
type = DT_ARMOURYEVOLVE;
break;
case MN_A_CLASSNOTATSTAGE:
shortMsg = va( "%s is not allowed at Stage %d",
- BG_FindHumanNameForClassNum( arg ),
+ BG_ClassConfig( arg )->humanName,
cgs.alienStage + 1 );
type = DT_ARMOURYEVOLVE;
break;
diff --git a/src/cgame/cg_tutorial.c b/src/cgame/cg_tutorial.c
index 03aaa59e..2de0af9d 100644
--- a/src/cgame/cg_tutorial.c
+++ b/src/cgame/cg_tutorial.c
@@ -162,7 +162,7 @@ static entityState_t *CG_BuildableInRange( playerState_t *ps, float *healthFract
}
if( es->eType == ET_BUILDABLE &&
- ps->stats[ STAT_TEAM ] == BG_FindTeamForBuildable( es->modelindex ) )
+ ps->stats[ STAT_TEAM ] == BG_Buildable( es->modelindex )->team )
return es;
else
return NULL;
@@ -183,12 +183,12 @@ static void CG_AlienBuilderText( char *text, playerState_t *ps )
Q_strcat( text, MAX_TUTORIAL_TEXT,
va( "Press %s to place the %s\n",
CG_KeyNameForCommand( "+attack" ),
- BG_FindHumanNameForBuildable( buildable ) ) );
+ BG_Buildable( buildable )->humanName ) );
Q_strcat( text, MAX_TUTORIAL_TEXT,
va( "Press %s to cancel placing the %s\n",
CG_KeyNameForCommand( "+button5" ),
- BG_FindHumanNameForBuildable( buildable ) ) );
+ BG_Buildable( buildable )->humanName ) );
}
else
{
@@ -360,12 +360,12 @@ static void CG_HumanCkitText( char *text, playerState_t *ps )
Q_strcat( text, MAX_TUTORIAL_TEXT,
va( "Press %s to place the %s\n",
CG_KeyNameForCommand( "+attack" ),
- BG_FindHumanNameForBuildable( buildable ) ) );
+ BG_Buildable( buildable )->humanName ) );
Q_strcat( text, MAX_TUTORIAL_TEXT,
va( "Press %s to cancel placing the %s\n",
CG_KeyNameForCommand( "+button5" ),
- BG_FindHumanNameForBuildable( buildable ) ) );
+ BG_Buildable( buildable )->humanName ) );
}
else
{
@@ -428,7 +428,7 @@ static void CG_HumanText( char *text, playerState_t *ps )
upgrade = cg.weaponSelect - 32;
}
- if( !ps->ammo && !ps->clips && !BG_FindInfinteAmmoForWeapon( ps->weapon ) )
+ if( !ps->ammo && !ps->clips && !BG_Weapon( ps->weapon )->infiniteAmmo )
{
//no ammo
switch( ps->weapon )
@@ -469,14 +469,14 @@ static void CG_HumanText( char *text, playerState_t *ps )
Q_strcat( text, MAX_TUTORIAL_TEXT,
va( "Press %s to fire the %s\n",
CG_KeyNameForCommand( "+attack" ),
- BG_FindHumanNameForWeapon( ps->weapon ) ) );
+ BG_Weapon( ps->weapon )->humanName ) );
break;
case WP_MASS_DRIVER:
Q_strcat( text, MAX_TUTORIAL_TEXT,
va( "Press %s to fire the %s\n",
CG_KeyNameForCommand( "+attack" ),
- BG_FindHumanNameForWeapon( ps->weapon ) ) );
+ BG_Weapon( ps->weapon )->humanName ) );
Q_strcat( text, MAX_TUTORIAL_TEXT,
va( "Hold %s to zoom\n",
@@ -487,7 +487,7 @@ static void CG_HumanText( char *text, playerState_t *ps )
Q_strcat( text, MAX_TUTORIAL_TEXT,
va( "Hold %s to activate the %s\n",
CG_KeyNameForCommand( "+attack" ),
- BG_FindHumanNameForWeapon( ps->weapon ) ) );
+ BG_Weapon( ps->weapon )->humanName ) );
break;
case WP_LUCIFER_CANNON:
@@ -498,7 +498,7 @@ static void CG_HumanText( char *text, playerState_t *ps )
Q_strcat( text, MAX_TUTORIAL_TEXT,
va( "Press %s to fire the %s\n",
CG_KeyNameForCommand( "+button5" ),
- BG_FindHumanNameForWeapon( ps->weapon ) ) );
+ BG_Weapon( ps->weapon )->humanName ) );
break;
case WP_HBUILD:
@@ -518,7 +518,7 @@ static void CG_HumanText( char *text, playerState_t *ps )
CG_KeyNameForCommand( "weapnext" ) ) );
if( upgrade == UP_NONE ||
- ( upgrade > UP_NONE && BG_FindUsableForUpgrade( upgrade ) ) )
+ ( upgrade > UP_NONE && BG_Upgrade( upgrade )->usable ) )
{
Q_strcat( text, MAX_TUTORIAL_TEXT,
va( "Press %s to use the %s\n",
@@ -532,7 +532,7 @@ static void CG_HumanText( char *text, playerState_t *ps )
Q_strcat( text, MAX_TUTORIAL_TEXT,
va( "Press %s to use your %s\n",
CG_KeyNameForCommand( "itemact medkit" ),
- BG_FindHumanNameForUpgrade( UP_MEDKIT ) ) );
+ BG_Upgrade( UP_MEDKIT )->humanName ) );
}
Q_strcat( text, MAX_TUTORIAL_TEXT,
diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c
index 15b9bc06..7d4693a8 100644
--- a/src/cgame/cg_view.c
+++ b/src/cgame/cg_view.c
@@ -353,7 +353,7 @@ static void CG_StepOffset( void )
BG_GetClientNormal( ps, normal );
- steptime = BG_FindSteptimeForClass( ps->stats[ STAT_CLASS ] );
+ steptime = BG_Class( ps->stats[ STAT_CLASS ] )->steptime;
// smooth out stair climbing
timeDelta = cg.time - cg.stepTime;
@@ -460,7 +460,7 @@ static void CG_OffsetFirstPersonView( void )
if( cg.snap->ps.persistant[ PERS_SPECSTATE ] != SPECTATOR_NOT )
bob2 = 0.0f;
else
- bob2 = BG_FindBobForClass( cg.predictedPlayerState.stats[ STAT_CLASS ] );
+ bob2 = BG_Class( cg.predictedPlayerState.stats[ STAT_CLASS ] )->bob;
#define LEVEL4_FEEDBACK 10.0f
@@ -699,7 +699,7 @@ static int CG_CalcFov( void )
else
{
// don't lock the fov globally - we need to be able to change it
- attribFov = BG_FindFovForClass( cg.predictedPlayerState.stats[ STAT_CLASS ] );
+ attribFov = BG_Class( cg.predictedPlayerState.stats[ STAT_CLASS ] )->fov;
fov_x = attribFov;
if ( fov_x < 1 )
@@ -721,7 +721,7 @@ static int CG_CalcFov( void )
}
// account for zooms
- zoomFov = BG_FindZoomFovForWeapon( cg.predictedPlayerState.weapon );
+ zoomFov = BG_Weapon( cg.predictedPlayerState.weapon )->zoomFov;
if ( zoomFov < 1 )
zoomFov = 1;
else if ( zoomFov > attribFov )
@@ -729,7 +729,7 @@ static int CG_CalcFov( void )
// only do all the zoom stuff if the client CAN zoom
// FIXME: zoom control is currently hard coded to BUTTON_ATTACK2
- if( BG_WeaponCanZoom( cg.predictedPlayerState.weapon ) )
+ if( BG_Weapon( cg.predictedPlayerState.weapon )->canZoom )
{
if ( cg.zoomed )
{
diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c
index 3b0d6f2f..1c08d4fd 100644
--- a/src/cgame/cg_weapons.c
+++ b/src/cgame/cg_weapons.c
@@ -49,15 +49,15 @@ void CG_RegisterUpgrade( int upgradeNum )
memset( upgradeInfo, 0, sizeof( *upgradeInfo ) );
upgradeInfo->registered = qtrue;
- if( !BG_FindNameForUpgrade( upgradeNum ) )
+ if( strlen( BG_Upgrade( upgradeNum )->name ) <= 0 )
CG_Error( "Couldn't find upgrade %i", upgradeNum );
- upgradeInfo->humanName = BG_FindHumanNameForUpgrade( upgradeNum );
+ upgradeInfo->humanName = BG_Upgrade( upgradeNum )->humanName;
//la la la la la, i'm not listening!
if( upgradeNum == UP_GRENADE )
upgradeInfo->upgradeIcon = cg_weapons[ WP_GRENADE ].weaponIcon;
- else if( ( icon = BG_FindIconForUpgrade( upgradeNum ) ) )
+ else if( ( icon = BG_Upgrade( upgradeNum )->icon ) )
upgradeInfo->upgradeIcon = trap_R_RegisterShader( icon );
}
@@ -714,17 +714,17 @@ void CG_RegisterWeapon( int weaponNum )
memset( weaponInfo, 0, sizeof( *weaponInfo ) );
weaponInfo->registered = qtrue;
- if( !BG_FindNameForWeapon( weaponNum ) )
+ if( strlen( BG_Weapon( weaponNum )->name ) <= 0 )
CG_Error( "Couldn't find weapon %i", weaponNum );
- Com_sprintf( path, MAX_QPATH, "models/weapons/%s/weapon.cfg", BG_FindNameForWeapon( weaponNum ) );
+ Com_sprintf( path, MAX_QPATH, "models/weapons/%s/weapon.cfg", BG_Weapon( weaponNum )->name );
- weaponInfo->humanName = BG_FindHumanNameForWeapon( weaponNum );
+ weaponInfo->humanName = BG_Weapon( weaponNum )->humanName;
if( !CG_ParseWeaponFile( path, weaponInfo ) )
Com_Printf( S_COLOR_RED "ERROR: failed to parse %s\n", path );
- Com_sprintf( path, MAX_QPATH, "models/weapons/%s/animation.cfg", BG_FindNameForWeapon( weaponNum ) );
+ Com_sprintf( path, MAX_QPATH, "models/weapons/%s/animation.cfg", BG_Weapon( weaponNum )->name );
if( !CG_ParseWeaponAnimationFile( path, weaponInfo ) )
Com_Printf( S_COLOR_RED "ERROR: failed to parse %s\n", path );
@@ -868,7 +868,7 @@ static void CG_CalculateWeaponPosition( vec3_t origin, vec3_t angles )
// gun angles from bobbing
// bob amount is class dependant
- bob = BG_FindBobForClass( cg.predictedPlayerState.stats[ STAT_CLASS ] );
+ bob = BG_Class( cg.predictedPlayerState.stats[ STAT_CLASS ] )->bob;
if( bob != 0 )
{
@@ -1299,7 +1299,7 @@ static qboolean CG_UpgradeSelectable( upgrade_t upgrade )
if( !BG_InventoryContainsUpgrade( upgrade, cg.snap->ps.stats ) )
return qfalse;
- return BG_FindUsableForUpgrade( upgrade );
+ return BG_Upgrade( upgrade )->usable;
}
@@ -1344,7 +1344,7 @@ void CG_DrawItemSelect( rectDef_t *rect, vec4_t color )
if( !BG_InventoryContainsWeapon( i, cg.snap->ps.stats ) )
continue;
- if( !ps->ammo && !ps->clips && !BG_FindInfinteAmmoForWeapon( i ) )
+ if( !ps->ammo && !ps->clips && !BG_Weapon( i )->infiniteAmmo )
colinfo[ numItems ] = 1;
else
colinfo[ numItems ] = 0;
@@ -1363,7 +1363,7 @@ void CG_DrawItemSelect( rectDef_t *rect, vec4_t color )
if( !BG_InventoryContainsUpgrade( i, cg.snap->ps.stats ) )
continue;
colinfo[ numItems ] = 0;
- if( !BG_FindUsableForUpgrade ( i ) )
+ if( !BG_Upgrade( i )->usable )
colinfo[ numItems ] = 2;
if( i == cg.weaponSelect - 32 )