summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configs/buildables/acid_tube.cfg5
-rw-r--r--configs/buildables/arm.cfg5
-rw-r--r--configs/buildables/barricade.cfg5
-rw-r--r--configs/buildables/booster.cfg5
-rw-r--r--configs/buildables/dcc.cfg5
-rw-r--r--configs/buildables/eggpod.cfg5
-rw-r--r--configs/buildables/hive.cfg5
-rw-r--r--configs/buildables/hovel.cfg5
-rw-r--r--configs/buildables/medistat.cfg5
-rw-r--r--configs/buildables/mgturret.cfg7
-rw-r--r--configs/buildables/overmind.cfg5
-rw-r--r--configs/buildables/reactor.cfg5
-rw-r--r--configs/buildables/repeater.cfg5
-rw-r--r--configs/buildables/telenode.cfg5
-rw-r--r--configs/buildables/tesla.cfg5
-rw-r--r--configs/buildables/trapper.cfg5
-rw-r--r--configs/classes/builder.cfg16
-rw-r--r--configs/classes/builderupg.cfg16
-rw-r--r--configs/classes/human_base.cfg16
-rw-r--r--configs/classes/human_bsuit.cfg16
-rw-r--r--configs/classes/level0.cfg16
-rw-r--r--configs/classes/level1.cfg16
-rw-r--r--configs/classes/level1upg.cfg16
-rw-r--r--configs/classes/level2.cfg16
-rw-r--r--configs/classes/level2upg.cfg16
-rw-r--r--configs/classes/level3.cfg16
-rw-r--r--configs/classes/level3upg.cfg16
-rw-r--r--configs/classes/level4.cfg16
-rw-r--r--configs/classes/spectator.cfg16
-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
-rw-r--r--src/game/bg_misc.c2653
-rw-r--r--src/game/bg_pmove.c67
-rw-r--r--src/game/bg_public.h256
-rw-r--r--src/game/g_active.c24
-rw-r--r--src/game/g_buildable.c138
-rw-r--r--src/game/g_client.c29
-rw-r--r--src/game/g_cmds.c116
-rw-r--r--src/game/g_combat.c12
-rw-r--r--src/game/g_main.c12
-rw-r--r--src/game/g_physics.c8
-rw-r--r--src/game/g_spawn.c3
-rw-r--r--src/game/g_trigger.c7
-rw-r--r--src/game/g_weapon.c15
-rw-r--r--src/ui/ui_main.c113
53 files changed, 1055 insertions, 2877 deletions
diff --git a/configs/buildables/acid_tube.cfg b/configs/buildables/acid_tube.cfg
new file mode 100644
index 00000000..e44ed48f
--- /dev/null
+++ b/configs/buildables/acid_tube.cfg
@@ -0,0 +1,5 @@
+model 0 models/buildables/acid_tube/acid_tube.md3
+modelScale 0.6
+mins -15 -15 -15
+maxs 15 15 15
+zOffset -8.5
diff --git a/configs/buildables/arm.cfg b/configs/buildables/arm.cfg
new file mode 100644
index 00000000..3e45fc29
--- /dev/null
+++ b/configs/buildables/arm.cfg
@@ -0,0 +1,5 @@
+model 0 models/buildables/arm/arm.md3
+modelScale 1.0
+mins -40 -40 -13
+maxs 40 40 50
+zOffset -2.0
diff --git a/configs/buildables/barricade.cfg b/configs/buildables/barricade.cfg
new file mode 100644
index 00000000..56146478
--- /dev/null
+++ b/configs/buildables/barricade.cfg
@@ -0,0 +1,5 @@
+model 0 models/buildables/barricade/barricade.md3
+modelScale 1.0
+mins -35 -35 -15
+maxs 35 35 60
+zOffset 0
diff --git a/configs/buildables/booster.cfg b/configs/buildables/booster.cfg
new file mode 100644
index 00000000..b0903df5
--- /dev/null
+++ b/configs/buildables/booster.cfg
@@ -0,0 +1,5 @@
+model 0 models/buildables/booster/booster.md3
+modelScale 1.0
+mins -26 -26 -9
+maxs 26 26 9
+zOffset 0
diff --git a/configs/buildables/dcc.cfg b/configs/buildables/dcc.cfg
new file mode 100644
index 00000000..932e3023
--- /dev/null
+++ b/configs/buildables/dcc.cfg
@@ -0,0 +1,5 @@
+model 0 models/buildables/dcc/dcc.md3
+modelScale 1.0
+mins -35 -35 -13
+maxs 35 35 47
+zOffset 0
diff --git a/configs/buildables/eggpod.cfg b/configs/buildables/eggpod.cfg
new file mode 100644
index 00000000..71cb6c70
--- /dev/null
+++ b/configs/buildables/eggpod.cfg
@@ -0,0 +1,5 @@
+model 0 models/buildables/eggpod/eggpod.md3
+modelScale 1.0
+mins -15 -15 -15
+maxs 15 15 15
+zOffset 0
diff --git a/configs/buildables/hive.cfg b/configs/buildables/hive.cfg
new file mode 100644
index 00000000..b700f6ed
--- /dev/null
+++ b/configs/buildables/hive.cfg
@@ -0,0 +1,5 @@
+model 0 models/buildables/hive/hive.md3
+modelScale 1.0
+mins -35 -35 -25
+maxs 35 35 25
+zOffset 0
diff --git a/configs/buildables/hovel.cfg b/configs/buildables/hovel.cfg
new file mode 100644
index 00000000..5e2922c9
--- /dev/null
+++ b/configs/buildables/hovel.cfg
@@ -0,0 +1,5 @@
+model 0 models/buildables/hovel/hovel.md3
+modelScale 1.0
+mins -50 -50 -20
+maxs 50 50 20
+zOffset 0
diff --git a/configs/buildables/medistat.cfg b/configs/buildables/medistat.cfg
new file mode 100644
index 00000000..179a0528
--- /dev/null
+++ b/configs/buildables/medistat.cfg
@@ -0,0 +1,5 @@
+model 0 models/buildables/medistat/medistat.md3
+modelScale 1.0
+mins -35 -35 -7
+maxs 35 35 4
+zOffset 0
diff --git a/configs/buildables/mgturret.cfg b/configs/buildables/mgturret.cfg
new file mode 100644
index 00000000..83a23093
--- /dev/null
+++ b/configs/buildables/mgturret.cfg
@@ -0,0 +1,7 @@
+model 0 models/buildables/mgturret/turret_base.md3
+model 1 models/buildables/mgturret/turret_barrel.md3
+model 2 models/buildables/mgturret/turret_top.md3
+modelScale 1.0
+mins -25 -25 -20
+maxs 25 25 20
+zOffset 0
diff --git a/configs/buildables/overmind.cfg b/configs/buildables/overmind.cfg
new file mode 100644
index 00000000..f9baca5d
--- /dev/null
+++ b/configs/buildables/overmind.cfg
@@ -0,0 +1,5 @@
+model 0 models/buildables/overmind/overmind.md3
+modelScale 1.0
+mins -45 -45 -15
+maxs 45 45 95
+zOffset 0
diff --git a/configs/buildables/reactor.cfg b/configs/buildables/reactor.cfg
new file mode 100644
index 00000000..d724c44f
--- /dev/null
+++ b/configs/buildables/reactor.cfg
@@ -0,0 +1,5 @@
+model 0 models/buildables/reactor/reactor.md3
+mins -41 -41 -15
+maxs 41 41 95
+zOffset -2.0
+modelScale 0.85
diff --git a/configs/buildables/repeater.cfg b/configs/buildables/repeater.cfg
new file mode 100644
index 00000000..eec28243
--- /dev/null
+++ b/configs/buildables/repeater.cfg
@@ -0,0 +1,5 @@
+model 0 models/buildables/repeater/repeater.md3
+modelScale 1.0
+mins -15 -15 -15
+maxs 15 15 25
+zOffset 0
diff --git a/configs/buildables/telenode.cfg b/configs/buildables/telenode.cfg
new file mode 100644
index 00000000..173a92f1
--- /dev/null
+++ b/configs/buildables/telenode.cfg
@@ -0,0 +1,5 @@
+model 0 models/buildables/telenode/telenode.md3
+modelScale 1.0
+mins -40 -40 -4
+maxs 40 40 6
+zOffset 0
diff --git a/configs/buildables/tesla.cfg b/configs/buildables/tesla.cfg
new file mode 100644
index 00000000..36d1e33a
--- /dev/null
+++ b/configs/buildables/tesla.cfg
@@ -0,0 +1,5 @@
+model 0 models/buildables/tesla/tesla.md3
+modelScale 1.0
+mins -22 -22 -40
+maxs 22 22 40
+zOffset 0
diff --git a/configs/buildables/trapper.cfg b/configs/buildables/trapper.cfg
new file mode 100644
index 00000000..0c3f0d01
--- /dev/null
+++ b/configs/buildables/trapper.cfg
@@ -0,0 +1,5 @@
+model 0 models/buildables/trapper/trapper.md3
+modelScale 1.0
+mins -15 -15 -15
+maxs 15 15 15
+zOffset 0
diff --git a/configs/classes/builder.cfg b/configs/classes/builder.cfg
new file mode 100644
index 00000000..d06fec6f
--- /dev/null
+++ b/configs/classes/builder.cfg
@@ -0,0 +1,16 @@
+name "Granger"
+model builder
+modelScale 1.0
+skin default
+shadowScale 1.0
+hud alien_builder_hud
+
+mins -20 -20 -20
+maxs 20 20 20
+crouchMaxs 20 20 20
+deadMins -20 -20 -4
+deadMaxs 20 20 4
+zOffset 0.0
+
+viewheight 0
+crouchViewheight 0
diff --git a/configs/classes/builderupg.cfg b/configs/classes/builderupg.cfg
new file mode 100644
index 00000000..6762d97a
--- /dev/null
+++ b/configs/classes/builderupg.cfg
@@ -0,0 +1,16 @@
+name "Advanced Granger"
+model builder
+modelScale 1.25
+skin advanced
+shadowScale 1.25
+hud alien_builder_hud
+
+mins -25 -25 -25
+maxs 25 25 25
+crouchMaxs 25 25 25
+deadMins -25 -25 -4
+deadMaxs 25 25 4
+zOffset 0.0
+
+viewheight 0
+crouchViewheight 0
diff --git a/configs/classes/human_base.cfg b/configs/classes/human_base.cfg
new file mode 100644
index 00000000..a6e51ff5
--- /dev/null
+++ b/configs/classes/human_base.cfg
@@ -0,0 +1,16 @@
+name "Human Base"
+model human_base
+modelScale 1.0
+skin default
+shadowScale 1.0
+hud human_hud
+
+mins -15 -15 -24
+maxs 15 15 32
+crouchMaxs 15 15 16
+deadMins -15 -15 -4
+deadMaxs 15 15 4
+zOffset 0.0
+
+viewheight 26
+crouchViewheight 12
diff --git a/configs/classes/human_bsuit.cfg b/configs/classes/human_bsuit.cfg
new file mode 100644
index 00000000..b14f3a89
--- /dev/null
+++ b/configs/classes/human_bsuit.cfg
@@ -0,0 +1,16 @@
+name "Human Battlesuit"
+model human_bsuit
+modelScale 1.0
+skin default
+shadowScale 1.0
+hud human_hud
+
+mins -15 -15 -38
+maxs 15 15 38
+crouchMaxs 15 15 38
+deadMins -15 -15 -4
+deadMaxs 15 15 4
+zOffset -16.0
+
+viewheight 35
+crouchViewheight 35
diff --git a/configs/classes/level0.cfg b/configs/classes/level0.cfg
new file mode 100644
index 00000000..fbfefffc
--- /dev/null
+++ b/configs/classes/level0.cfg
@@ -0,0 +1,16 @@
+name "Dretch"
+model level0
+modelScale 1.0
+skin default
+shadowScale 0.3
+hud alien_general_hud
+
+mins -15 -15 -15
+maxs 15 15 15
+crouchMaxs 15 15 15
+deadMins -15 -15 -15
+deadMaxs 15 15 15
+zOffset -8.0
+
+viewheight 0
+crouchViewheight 0
diff --git a/configs/classes/level1.cfg b/configs/classes/level1.cfg
new file mode 100644
index 00000000..81daae31
--- /dev/null
+++ b/configs/classes/level1.cfg
@@ -0,0 +1,16 @@
+name "Basilisk"
+model level1
+modelScale 1.0
+skin default
+shadowScale 1.0
+hud alien_general_hud
+
+mins -18 -18 -18
+maxs 18 18 18
+crouchMaxs 18 18 18
+deadMins -18 -18 -4
+deadMaxs 18 18 4
+zOffset 0.0
+
+viewheight 0
+crouchViewheight 0
diff --git a/configs/classes/level1upg.cfg b/configs/classes/level1upg.cfg
new file mode 100644
index 00000000..9448694a
--- /dev/null
+++ b/configs/classes/level1upg.cfg
@@ -0,0 +1,16 @@
+name "Advanced Basilisk"
+model level1
+modelScale 1.1666
+skin upgrade
+shadowScale 1.0
+hud alien_general_hud
+
+mins -21 -21 -21
+maxs 21 21 21
+crouchMaxs 21 21 21
+deadMins -21 -21 -4.666
+deadMaxs 21 21 4.666
+zOffset 0.0
+
+viewheight 0
+crouchViewheight 0
diff --git a/configs/classes/level2.cfg b/configs/classes/level2.cfg
new file mode 100644
index 00000000..e5d54b2d
--- /dev/null
+++ b/configs/classes/level2.cfg
@@ -0,0 +1,16 @@
+name "Marauder"
+model level2
+modelScale 1.0
+skin default
+shadowScale 1.0
+hud alien_general_hud
+
+mins -25 -25 -22
+maxs 25 25 16
+crouchMaxs 25 25 16
+deadMins -25 -25 -4
+deadMaxs 25 25 4
+zOffset 0.0
+
+viewheight 10
+crouchViewheight 10
diff --git a/configs/classes/level2upg.cfg b/configs/classes/level2upg.cfg
new file mode 100644
index 00000000..2d11d274
--- /dev/null
+++ b/configs/classes/level2upg.cfg
@@ -0,0 +1,16 @@
+name "Advanced Marauder"
+model level2
+modelScale 1.1
+skin adv
+shadowScale 1.0
+hud alien_general_hud
+
+mins -26 -26 -24
+maxs 26 26 18
+crouchMaxs 26 26 18
+deadMins -26 -26 -4
+deadMaxs 26 26 4
+zOffset 0.0
+
+viewheight 12
+crouchViewheight 12
diff --git a/configs/classes/level3.cfg b/configs/classes/level3.cfg
new file mode 100644
index 00000000..100b4c16
--- /dev/null
+++ b/configs/classes/level3.cfg
@@ -0,0 +1,16 @@
+name "Dragoon"
+model level3
+modelScale 1.0
+skin default
+shadowScale 1.0
+hud alien_general_hud
+
+mins -26 -26 -23
+maxs 26 26 32
+crouchMaxs 26 26 32
+deadMins -26 -26 -4
+deadMaxs 26 26 4
+zOffset 0.0
+
+viewheight 24
+crouchViewheight 24
diff --git a/configs/classes/level3upg.cfg b/configs/classes/level3upg.cfg
new file mode 100644
index 00000000..683c5722
--- /dev/null
+++ b/configs/classes/level3upg.cfg
@@ -0,0 +1,16 @@
+name "Advanced Dragoon"
+model level3
+modelScale 1.25
+skin adv
+shadowScale 1.0
+hud alien_general_hud
+
+mins -32 -32 -29
+maxs 32 32 38
+crouchMaxs 32 32 38
+deadMins -32 -32 -4
+deadMaxs 32 32 4
+zOffset 0.0
+
+viewheight 27
+crouchViewheight 27
diff --git a/configs/classes/level4.cfg b/configs/classes/level4.cfg
new file mode 100644
index 00000000..0cab3567
--- /dev/null
+++ b/configs/classes/level4.cfg
@@ -0,0 +1,16 @@
+name "Tyrant"
+model level4
+modelScale 1.0
+skin default
+shadowScale 2.0
+hud alien_general_hud
+
+mins -32 -32 -22
+maxs 32 32 70
+crouchMaxs 32 32 70
+deadMins -32 -32 -34
+deadMaxs 32 32 34
+zOffset 0.0
+
+viewheight 35
+crouchViewheight 35
diff --git a/configs/classes/spectator.cfg b/configs/classes/spectator.cfg
new file mode 100644
index 00000000..f7efc1f3
--- /dev/null
+++ b/configs/classes/spectator.cfg
@@ -0,0 +1,16 @@
+name "Spectator"
+model ""
+modelScale 1.0
+skin ""
+shadowScale 1.0
+hud ""
+
+mins -12 -12 -12
+maxs 12 12 12
+crouchMaxs 12 12 12
+deadMins -12 -12 -12
+deadMaxs 12 12 12
+zOffset 0.0
+
+viewheight 0
+crouchViewheight 0
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 )
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 6c63d648..5177957c 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -32,7 +32,7 @@ void trap_FS_Write( const void *buffer, int len, fileHandle_t f );
void trap_FS_FCloseFile( fileHandle_t f );
void trap_FS_Seek( fileHandle_t f, long offset, fsOrigin_t origin ); // fsOrigin_t
-buildableAttributes_t bg_buildableList[ ] =
+static const buildableAttributes_t bg_buildableList[ ] =
{
{
BA_A_SPAWN, //int buildNum;
@@ -42,11 +42,6 @@ buildableAttributes_t bg_buildableList[ ] =
"and protect the Overmind. Without any of these, the Overmind "
"is left nearly defenseless and defeat is imminent.",
"team_alien_spawn", //char *entityName;
- { "models/buildables/eggpod/eggpod.md3", 0, 0, 0 },
- 1.0f, //float modelScale;
- { -15, -15, -15 }, //vec3_t mins;
- { 15, 15, 15 }, //vec3_t maxs;
- 0.0f, //float zOffset;
TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
ASPAWN_BP, //int buildPoints;
@@ -71,7 +66,7 @@ buildableAttributes_t bg_buildableList[ ] =
ASPAWN_CREEPSIZE, //int creepSize;
qfalse, //qboolean dccTest;
qfalse, //qboolean transparentTest;
- qfalse, //qboolean reactorTest;
+ qfalse, //qboolean uniqueTest;
ASPAWN_VALUE, //int value;
},
{
@@ -82,11 +77,6 @@ buildableAttributes_t bg_buildableList[ ] =
"threatening the spawns and Overmind. Barricades will shrink "
"to allow aliens to pass over them, however.",
"team_alien_barricade",//char *entityName;
- { "models/buildables/barricade/barricade.md3", 0, 0, 0 },
- 1.0f, //float modelScale;
- { -35, -35, -15 }, //vec3_t mins;
- { 35, 35, 60 }, //vec3_t maxs;
- 0.0f, //float zOffset;
TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
BARRICADE_BP, //int buildPoints;
@@ -111,7 +101,7 @@ buildableAttributes_t bg_buildableList[ ] =
BARRICADE_CREEPSIZE, //int creepSize;
qfalse, //qboolean dccTest;
qfalse, //qboolean transparentTest;
- qfalse, //qboolean reactorTest;
+ qfalse, //qboolean uniqueTest;
BARRICADE_VALUE, //int value;
},
{
@@ -123,11 +113,6 @@ buildableAttributes_t bg_buildableList[ ] =
"The booster also increases the rate of health regeneration for "
"any nearby aliens.",
"team_alien_booster", //char *entityName;
- { "models/buildables/booster/booster.md3", 0, 0, 0 },
- 1.0f, //float modelScale;
- { -26, -26, -9 }, //vec3_t mins;
- { 26, 26, 9 }, //vec3_t maxs;
- 0.0f, //float zOffset;
TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
BOOSTER_BP, //int buildPoints;
@@ -152,7 +137,7 @@ buildableAttributes_t bg_buildableList[ ] =
BOOSTER_CREEPSIZE, //int creepSize;
qfalse, //qboolean dccTest;
qtrue, //qboolean transparentTest;
- qfalse, //qboolean reactorTest;
+ qfalse, //qboolean uniqueTest;
BOOSTER_VALUE, //int value;
},
{
@@ -163,11 +148,6 @@ buildableAttributes_t bg_buildableList[ ] =
"are highly effective when used in conjunction with a trapper "
"to hold the victim in place.",
"team_alien_acid_tube",//char *entityName;
- { "models/buildables/acid_tube/acid_tube.md3", 0, 0, 0 },
- 1.0f, //float modelScale;
- { -25, -25, -25 }, //vec3_t mins;
- { 25, 25, 25 }, //vec3_t maxs;
- -15.0f, //float zOffset;
TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
ACIDTUBE_BP, //int buildPoints;
@@ -192,7 +172,7 @@ buildableAttributes_t bg_buildableList[ ] =
ACIDTUBE_CREEPSIZE, //int creepSize;
qfalse, //qboolean dccTest;
qfalse, //qboolean transparentTest;
- qfalse, //qboolean reactorTest;
+ qfalse, //qboolean uniqueTest;
ACIDTUBE_VALUE, //int value;
},
{
@@ -202,11 +182,6 @@ buildableAttributes_t bg_buildableList[ ] =
"Houses millions of tiny insectoid aliens. When a human "
"approaches this structure, the insectoids attack.",
"team_alien_hive", //char *entityName;
- { "models/buildables/acid_tube/acid_tube.md3", 0, 0, 0 },
- 1.0f, //float modelScale;
- { -35, -35, -25 }, //vec3_t mins;
- { 35, 35, 25 }, //vec3_t maxs;
- -15.0f, //float zOffset;
TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
HIVE_BP, //int buildPoints;
@@ -231,7 +206,7 @@ buildableAttributes_t bg_buildableList[ ] =
HIVE_CREEPSIZE, //int creepSize;
qfalse, //qboolean dccTest;
qfalse, //qboolean transparentTest;
- qfalse, //qboolean reactorTest;
+ qfalse, //qboolean uniqueTest;
HIVE_VALUE, //int value;
},
{
@@ -242,11 +217,6 @@ buildableAttributes_t bg_buildableList[ ] =
"sight. This hinders their movement, making them an easy target "
"for other defensive structures or aliens.",
"team_alien_trapper", //char *entityName;
- { "models/buildables/trapper/trapper.md3", 0, 0, 0 },
- 1.0f, //float modelScale;
- { -15, -15, -15 }, //vec3_t mins;
- { 15, 15, 15 }, //vec3_t maxs;
- 0.0f, //float zOffset;
TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
TRAPPER_BP, //int buildPoints;
@@ -271,7 +241,7 @@ buildableAttributes_t bg_buildableList[ ] =
TRAPPER_CREEPSIZE, //int creepSize;
qfalse, //qboolean dccTest;
qtrue, //qboolean transparentTest;
- qfalse, //qboolean reactorTest;
+ qfalse, //qboolean uniqueTest;
TRAPPER_VALUE, //int value;
},
{
@@ -282,11 +252,6 @@ buildableAttributes_t bg_buildableList[ ] =
"in its vicinity. It must be protected at all costs, since its "
"death will render alien structures defenseless.",
"team_alien_overmind", //char *entityName;
- { "models/buildables/overmind/overmind.md3", 0, 0, 0 },
- 1.0f, //float modelScale;
- { -45, -45, -15 }, //vec3_t mins;
- { 45, 45, 95 }, //vec3_t maxs;
- 0.0f, //float zOffset;
TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
OVERMIND_BP, //int buildPoints;
@@ -311,7 +276,7 @@ buildableAttributes_t bg_buildableList[ ] =
OVERMIND_CREEPSIZE, //int creepSize;
qfalse, //qboolean dccTest;
qfalse, //qboolean transparentTest;
- qtrue, //qboolean reactorTest;
+ qtrue, //qboolean uniqueTest;
OVERMIND_VALUE, //int value;
},
{
@@ -322,11 +287,6 @@ buildableAttributes_t bg_buildableList[ ] =
"the alien base is under attack. It may be entered or "
"exited at any time.",
"team_alien_hovel", //char *entityName;
- { "models/buildables/hovel/hovel.md3", 0, 0, 0 },
- 1.0f, //float modelScale;
- { -50, -50, -20 }, //vec3_t mins;
- { 50, 50, 20 }, //vec3_t maxs;
- 0.0f, //float zOffset;
TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
HOVEL_BP, //int buildPoints;
@@ -351,7 +311,7 @@ buildableAttributes_t bg_buildableList[ ] =
HOVEL_CREEPSIZE, //int creepSize;
qfalse, //qboolean dccTest;
qfalse, //qboolean transparentTest;
- qtrue, //qboolean reactorTest;
+ qtrue, //qboolean uniqueTest;
HOVEL_VALUE, //int value;
},
{
@@ -362,11 +322,6 @@ buildableAttributes_t bg_buildableList[ ] =
"to enter the battle arena. Without any of these the humans "
"cannot spawn and defeat is imminent.",
"team_human_spawn", //char *entityName;
- { "models/buildables/telenode/telenode.md3", 0, 0, 0 },
- 1.0f, //float modelScale;
- { -40, -40, -4 }, //vec3_t mins;
- { 40, 40, 4 }, //vec3_t maxs;
- 0.0f, //float zOffset;
TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
HSPAWN_BP, //int buildPoints;
@@ -391,7 +346,7 @@ buildableAttributes_t bg_buildableList[ ] =
0, //int creepSize;
qfalse, //qboolean dccTest;
qtrue, //qboolean transparentTest;
- qfalse, //qboolean reactorTest;
+ qfalse, //qboolean uniqueTest;
HSPAWN_VALUE, //int value;
},
{
@@ -403,11 +358,6 @@ buildableAttributes_t bg_buildableList[ ] =
"It may only be used by one person at a time. This structure "
"also issues medkits.",
"team_human_medistat", //char *entityName;
- { "models/buildables/medistat/medistat.md3", 0, 0, 0 },
- 1.0f, //float modelScale;
- { -35, -35, -7 }, //vec3_t mins;
- { 35, 35, 7 }, //vec3_t maxs;
- 0.0f, //float zOffset;
TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
MEDISTAT_BP, //int buildPoints;
@@ -432,7 +382,7 @@ buildableAttributes_t bg_buildableList[ ] =
0, //int creepSize;
qfalse, //qboolean dccTest;
qtrue, //qboolean transparentTest;
- qfalse, //qboolean reactorTest;
+ qfalse, //qboolean uniqueTest;
MEDISTAT_VALUE, //int value;
},
{
@@ -443,13 +393,6 @@ buildableAttributes_t bg_buildableList[ ] =
"but slow to begin firing. Should always be "
"backed up by physical support.",
"team_human_mgturret", //char *entityName;
- { "models/buildables/mgturret/turret_base.md3",
- "models/buildables/mgturret/turret_barrel.md3",
- "models/buildables/mgturret/turret_top.md3", 0 },
- 1.0f, //float modelScale;
- { -25, -25, -20 }, //vec3_t mins;
- { 25, 25, 20 }, //vec3_t maxs;
- 0.0f, //float zOffset;
TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
MGTURRET_BP, //int buildPoints;
@@ -474,7 +417,7 @@ buildableAttributes_t bg_buildableList[ ] =
0, //int creepSize;
qfalse, //qboolean dccTest;
qtrue, //qboolean transparentTest;
- qfalse, //qboolean reactorTest;
+ qfalse, //qboolean uniqueTest;
MGTURRET_VALUE, //int value;
},
{
@@ -485,11 +428,6 @@ buildableAttributes_t bg_buildableList[ ] =
"instantly and always hits its target. It is effective against smaller "
"aliens and for consolidating basic defense.",
"team_human_tesla", //char *entityName;
- { "models/buildables/tesla/tesla.md3", 0, 0, 0 },
- 1.0f, //float modelScale;
- { -22, -22, -40 }, //vec3_t mins;
- { 22, 22, 40 }, //vec3_t maxs;
- 0.0f, //float zOffset;
TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
TESLAGEN_BP, //int buildPoints;
@@ -514,7 +452,7 @@ buildableAttributes_t bg_buildableList[ ] =
0, //int creepSize;
qfalse, //qboolean dccTest;
qtrue, //qboolean transparentTest;
- qfalse, //qboolean reactorTest;
+ qfalse, //qboolean uniqueTest;
TESLAGEN_VALUE, //int value;
},
{
@@ -525,11 +463,6 @@ buildableAttributes_t bg_buildableList[ ] =
"human structures. Each Defence Computer built increases "
"repair rate slightly.",
"team_human_dcc", //char *entityName;
- { "models/buildables/dcc/dcc.md3", 0, 0, 0 },
- 1.0f, //float modelScale;
- { -35, -35, -13 }, //vec3_t mins;
- { 35, 35, 47 }, //vec3_t maxs;
- 0.0f, //float zOffset;
TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
DC_BP, //int buildPoints;
@@ -554,7 +487,7 @@ buildableAttributes_t bg_buildableList[ ] =
0, //int creepSize;
qfalse, //qboolean dccTest;
qfalse, //qboolean transparentTest;
- qfalse, //qboolean reactorTest;
+ qfalse, //qboolean uniqueTest;
DC_VALUE, //int value;
},
{
@@ -565,11 +498,6 @@ buildableAttributes_t bg_buildableList[ ] =
"to upgrade the basic human equipment. A range of upgrades "
"and weapons are available for sale from the armoury.",
"team_human_armoury", //char *entityName;
- { "models/buildables/arm/arm.md3", 0, 0, 0 },
- 1.0f, //float modelScale;
- { -40, -40, -13 }, //vec3_t mins;
- { 40, 40, 50 }, //vec3_t maxs;
- 0.0f, //float zOffset;
TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
ARMOURY_BP, //int buildPoints;
@@ -594,7 +522,7 @@ buildableAttributes_t bg_buildableList[ ] =
0, //int creepSize;
qfalse, //qboolean dccTest;
qfalse, //qboolean transparentTest;
- qfalse, //qboolean reactorTest;
+ qfalse, //qboolean uniqueTest;
ARMOURY_VALUE, //int value;
},
{
@@ -605,11 +533,6 @@ buildableAttributes_t bg_buildableList[ ] =
"The reactor provides power for all the human structures either "
"directly or via repeaters. Only one reactor can be built at a time.",
"team_human_reactor", //char *entityName;
- { "models/buildables/reactor/reactor.md3", 0, 0, 0 },
- 1.0f, //float modelScale;
- { -50, -50, -15 }, //vec3_t mins;
- { 50, 50, 95 }, //vec3_t maxs;
- 0.0f, //float zOffset;
TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
REACTOR_BP, //int buildPoints;
@@ -634,7 +557,7 @@ buildableAttributes_t bg_buildableList[ ] =
0, //int creepSize;
qfalse, //qboolean dccTest;
qfalse, //qboolean transparentTest;
- qtrue, //qboolean reactorTest;
+ qtrue, //qboolean uniqueTest;
REACTOR_VALUE, //int value;
},
{
@@ -645,11 +568,6 @@ buildableAttributes_t bg_buildableList[ ] =
"to remote locations, so that bases may be built far "
"from the reactor.",
"team_human_repeater", //char *entityName;
- { "models/buildables/repeater/repeater.md3", 0, 0, 0 },
- 1.0f, //float modelScale;
- { -15, -15, -15 }, //vec3_t mins;
- { 15, 15, 25 }, //vec3_t maxs;
- 0.0f, //float zOffset;
TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
REPEATER_BP, //int buildPoints;
@@ -674,775 +592,122 @@ buildableAttributes_t bg_buildableList[ ] =
0, //int creepSize;
qfalse, //qboolean dccTest;
qfalse, //qboolean transparentTest;
- qfalse, //qboolean reactorTest;
+ qfalse, //qboolean uniqueTest;
REPEATER_VALUE, //int value;
}
};
int bg_numBuildables = sizeof( bg_buildableList ) / sizeof( bg_buildableList[ 0 ] );
-//separate from bg_buildableList to work around char struct init bug
-buildableAttributeOverrides_t bg_buildableOverrideList[ BA_NUM_BUILDABLES ];
+static const buildableAttributes_t nullBuildable = { 0 };
/*
==============
-BG_FindValueOfBuildable
+BG_BuildableByName
==============
*/
-int BG_FindValueOfBuildable( int bclass )
+const buildableAttributes_t *BG_BuildableByName( const char *name )
{
int i;
for( i = 0; i < bg_numBuildables; i++ )
{
- if( bg_buildableList[ i ].buildNum == bclass )
- return bg_buildableList[ i ].value;
+ if( !Q_stricmp( bg_buildableList[ i ].name, name ) )
+ return &bg_buildableList[ i ];
}
- return 0;
+ return &nullBuildable;
}
/*
==============
-BG_FindBuildNumForName
+BG_BuildableByEntityName
==============
*/
-int BG_FindBuildNumForName( char *name )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( !Q_stricmp( bg_buildableList[ i ].buildName, name ) )
- return bg_buildableList[ i ].buildNum;
- }
-
- //wimp out
- return BA_NONE;
-}
-
-/*
-==============
-BG_FindBuildNumForEntityName
-==============
-*/
-int BG_FindBuildNumForEntityName( char *name )
+const buildableAttributes_t *BG_BuildableByEntityName( const char *name )
{
int i;
for( i = 0; i < bg_numBuildables; i++ )
{
if( !Q_stricmp( bg_buildableList[ i ].entityName, name ) )
- return bg_buildableList[ i ].buildNum;
- }
-
- //wimp out
- return BA_NONE;
-}
-
-/*
-==============
-BG_FindNameForBuildNum
-==============
-*/
-char *BG_FindNameForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- return bg_buildableList[ i ].buildName;
+ return &bg_buildableList[ i ];
}
- //wimp out
- return 0;
+ return &nullBuildable;
}
/*
==============
-BG_FindHumanNameForBuildNum
+BG_Buildable
==============
*/
-char *BG_FindHumanNameForBuildable( int bclass )
+const buildableAttributes_t *BG_Buildable( buildable_t buildable )
{
int i;
for( i = 0; i < bg_numBuildables; i++ )
{
- if( bg_buildableList[ i ].buildNum == bclass )
- return bg_buildableList[ i ].humanName;
+ if( bg_buildableList[ i ].number == buildable )
+ return &bg_buildableList[ i ];
}
- //wimp out
- return 0;
+ return &nullBuildable;
}
/*
==============
-BG_FindInfoForBuildable
+BG_BuildableAllowedInStage
==============
*/
-char *BG_FindInfoForBuildable( int bclass )
+qboolean BG_BuildableAllowedInStage( buildable_t buildable,
+ stage_t stage )
{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- return bg_buildableList[ i ].info;
- }
-
- //wimp out
- return 0;
-}
-
-/*
-==============
-BG_FindEntityNameForBuildNum
-==============
-*/
-char *BG_FindEntityNameForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- return bg_buildableList[ i ].entityName;
- }
+ int stages = BG_Buildable( buildable )->stages;
- //wimp out
- return 0;
+ if( stages & ( 1 << stage ) )
+ return qtrue;
+ else
+ return qfalse;
}
-/*
-==============
-BG_FindModelsForBuildNum
-==============
-*/
-char *BG_FindModelsForBuildable( int bclass, int modelNum )
-{
- int i;
-
- if( bg_buildableOverrideList[ bclass ].models[ modelNum ][ 0 ] != 0 )
- return bg_buildableOverrideList[ bclass ].models[ modelNum ];
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- return bg_buildableList[ i ].models[ modelNum ];
- }
-
- //wimp out
- return 0;
-}
+static buildableConfig_t bg_buildableConfigList[ BA_NUM_BUILDABLES ];
/*
==============
-BG_FindModelScaleForBuildable
+BG_BuildableConfig
==============
*/
-float BG_FindModelScaleForBuildable( int bclass )
+buildableConfig_t *BG_BuildableConfig( buildable_t buildable )
{
- int i;
-
- if( bg_buildableOverrideList[ bclass ].modelScale != 0.0f )
- return bg_buildableOverrideList[ bclass ].modelScale;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- return bg_buildableList[ i ].modelScale;
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindModelScaleForBuildable( %d )\n", bclass );
- return 1.0f;
+ return &bg_buildableConfigList[ buildable ];
}
/*
==============
-BG_FindBBoxForBuildable
+BG_BuildableBoundingBox
==============
*/
-void BG_FindBBoxForBuildable( int bclass, vec3_t mins, vec3_t maxs )
+void BG_BuildableBoundingBox( buildable_t buildable,
+ vec3_t mins, vec3_t maxs )
{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- if( mins != NULL )
- {
- VectorCopy( bg_buildableList[ i ].mins, mins );
-
- if( VectorLength( bg_buildableOverrideList[ bclass ].mins ) )
- VectorCopy( bg_buildableOverrideList[ bclass ].mins, mins );
- }
-
- if( maxs != NULL )
- {
- VectorCopy( bg_buildableList[ i ].maxs, maxs );
-
- if( VectorLength( bg_buildableOverrideList[ bclass ].maxs ) )
- VectorCopy( bg_buildableOverrideList[ bclass ].maxs, maxs );
- }
-
- return;
- }
- }
+ buildableConfig_t *buildableConfig = BG_BuildableConfig( buildable );
if( mins != NULL )
- VectorCopy( bg_buildableList[ 0 ].mins, mins );
+ VectorCopy( buildableConfig->mins, mins );
if( maxs != NULL )
- VectorCopy( bg_buildableList[ 0 ].maxs, maxs );
-}
-
-/*
-==============
-BG_FindZOffsetForBuildable
-==============
-*/
-float BG_FindZOffsetForBuildable( int bclass )
-{
- int i;
-
- if( bg_buildableOverrideList[ bclass ].zOffset != 0.0f )
- return bg_buildableOverrideList[ bclass ].zOffset;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].zOffset;
- }
- }
-
- return 0.0f;
-}
-
-/*
-==============
-BG_FindTrajectoryForBuildable
-==============
-*/
-trType_t BG_FindTrajectoryForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].traj;
- }
- }
-
- return TR_GRAVITY;
-}
-
-/*
-==============
-BG_FindBounceForBuildable
-==============
-*/
-float BG_FindBounceForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].bounce;
- }
- }
-
- return 0.0;
-}
-
-/*
-==============
-BG_FindBuildPointsForBuildable
-==============
-*/
-int BG_FindBuildPointsForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].buildPoints;
- }
- }
-
- return 1000;
-}
-
-/*
-==============
-BG_FindStagesForBuildable
-==============
-*/
-qboolean BG_FindStagesForBuildable( int bclass, stage_t stage )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- if( bg_buildableList[ i ].stages & ( 1 << stage ) )
- return qtrue;
- else
- return qfalse;
- }
- }
-
- return qfalse;
-}
-
-/*
-==============
-BG_FindHealthForBuildable
-==============
-*/
-int BG_FindHealthForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].health;
- }
- }
-
- return 1000;
-}
-
-/*
-==============
-BG_FindRegenRateForBuildable
-==============
-*/
-int BG_FindRegenRateForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].regenRate;
- }
- }
-
- return 0;
-}
-
-/*
-==============
-BG_FindSplashDamageForBuildable
-==============
-*/
-int BG_FindSplashDamageForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].splashDamage;
- }
- }
-
- return 50;
-}
-
-/*
-==============
-BG_FindSplashRadiusForBuildable
-==============
-*/
-int BG_FindSplashRadiusForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].splashRadius;
- }
- }
-
- return 200;
-}
-
-/*
-==============
-BG_FindMODForBuildable
-==============
-*/
-int BG_FindMODForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].meansOfDeath;
- }
- }
-
- return MOD_UNKNOWN;
-}
-
-/*
-==============
-BG_FindTeamForBuildable
-==============
-*/
-int BG_FindTeamForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].team;
- }
- }
-
- return TEAM_NONE;
-}
-
-/*
-==============
-BG_FindBuildWeaponForBuildable
-==============
-*/
-weapon_t BG_FindBuildWeaponForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].buildWeapon;
- }
- }
-
- return BA_NONE;
-}
-
-/*
-==============
-BG_FindAnimForBuildable
-==============
-*/
-int BG_FindAnimForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].idleAnim;
- }
- }
-
- return BANIM_IDLE1;
-}
-
-/*
-==============
-BG_FindNextThinkForBuildable
-==============
-*/
-int BG_FindNextThinkForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].nextthink;
- }
- }
-
- return 100;
-}
-
-/*
-==============
-BG_FindBuildTimeForBuildable
-==============
-*/
-int BG_FindBuildTimeForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].buildTime;
- }
- }
-
- return 10000;
-}
-
-/*
-==============
-BG_FindUsableForBuildable
-==============
-*/
-qboolean BG_FindUsableForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].usable;
- }
- }
-
- return qfalse;
-}
-
-/*
-==============
-BG_FindFireSpeedForBuildable
-==============
-*/
-int BG_FindFireSpeedForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].turretFireSpeed;
- }
- }
-
- return 1000;
-}
-
-/*
-==============
-BG_FindRangeForBuildable
-==============
-*/
-int BG_FindRangeForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].turretRange;
- }
- }
-
- return 1000;
-}
-
-/*
-==============
-BG_FindProjTypeForBuildable
-==============
-*/
-weapon_t BG_FindProjTypeForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].turretProjType;
- }
- }
-
- return WP_NONE;
-}
-
-/*
-==============
-BG_FindMinNormalForBuildable
-==============
-*/
-float BG_FindMinNormalForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].minNormal;
- }
- }
-
- return 0.707f;
-}
-
-/*
-==============
-BG_FindInvertNormalForBuildable
-==============
-*/
-qboolean BG_FindInvertNormalForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].invertNormal;
- }
- }
-
- return qfalse;
-}
-
-/*
-==============
-BG_FindCreepTestForBuildable
-==============
-*/
-int BG_FindCreepTestForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].creepTest;
- }
- }
-
- return qfalse;
-}
-
-/*
-==============
-BG_FindCreepSizeForBuildable
-==============
-*/
-int BG_FindCreepSizeForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].creepSize;
- }
- }
-
- return CREEP_BASESIZE;
-}
-
-/*
-==============
-BG_FindDCCTestForBuildable
-==============
-*/
-int BG_FindDCCTestForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].dccTest;
- }
- }
-
- return qfalse;
-}
-
-/*
-==============
-BG_FindUniqueTestForBuildable
-==============
-*/
-int BG_FindUniqueTestForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].reactorTest;
- }
- }
-
- return qfalse;
-}
-
-/*
-==============
-BG_FindOverrideForBuildable
-==============
-*/
-static buildableAttributeOverrides_t *BG_FindOverrideForBuildable( int bclass )
-{
- return &bg_buildableOverrideList[ bclass ];
-}
-
-/*
-==============
-BG_FindTransparentTestForBuildable
-==============
-*/
-qboolean BG_FindTransparentTestForBuildable( int bclass )
-{
- int i;
-
- for( i = 0; i < bg_numBuildables; i++ )
- {
- if( bg_buildableList[ i ].buildNum == bclass )
- {
- return bg_buildableList[ i ].transparentTest;
- }
- }
- return qfalse;
+ VectorCopy( buildableConfig->maxs, maxs );
}
/*
======================
BG_ParseBuildableFile
-Parses a configuration file describing a builable
+Parses a configuration file describing a buildable
======================
*/
-static qboolean BG_ParseBuildableFile( const char *filename, buildableAttributeOverrides_t *bao )
+static qboolean BG_ParseBuildableFile( const char *filename, buildableConfig_t *bc )
{
char *text_p;
int i;
@@ -1451,12 +716,24 @@ static qboolean BG_ParseBuildableFile( const char *filename, buildableAttributeO
char text[ 20000 ];
fileHandle_t f;
float scale;
+ int defined = 0;
+ enum
+ {
+ MODEL = 1 << 0,
+ MODELSCALE = 1 << 1,
+ MINS = 1 << 2,
+ MAXS = 1 << 3,
+ ZOFFSET = 1 << 4
+ };
// load the file
len = trap_FS_FOpenFile( filename, &f, FS_READ );
if( len < 0 )
+ {
+ Com_Printf( S_COLOR_RED "ERROR: Buildable file %s doesn't exist\n", filename );
return qfalse;
+ }
if( len == 0 || len >= sizeof( text ) - 1 )
{
@@ -1503,8 +780,9 @@ static qboolean BG_ParseBuildableFile( const char *filename, buildableAttributeO
if( !token )
break;
- Q_strncpyz( bao->models[ index ], token, sizeof( bao->models[ 0 ] ) );
+ Q_strncpyz( bc->models[ index ], token, sizeof( bc->models[ 0 ] ) );
+ defined |= MODEL;
continue;
}
else if( !Q_stricmp( token, "modelScale" ) )
@@ -1518,8 +796,9 @@ static qboolean BG_ParseBuildableFile( const char *filename, buildableAttributeO
if( scale < 0.0f )
scale = 0.0f;
- bao->modelScale = scale;
+ bc->modelScale = scale;
+ defined |= MODELSCALE;
continue;
}
else if( !Q_stricmp( token, "mins" ) )
@@ -1530,9 +809,10 @@ static qboolean BG_ParseBuildableFile( const char *filename, buildableAttributeO
if( !token )
break;
- bao->mins[ i ] = atof( token );
+ bc->mins[ i ] = atof( token );
}
+ defined |= MINS;
continue;
}
else if( !Q_stricmp( token, "maxs" ) )
@@ -1543,9 +823,10 @@ static qboolean BG_ParseBuildableFile( const char *filename, buildableAttributeO
if( !token )
break;
- bao->maxs[ i ] = atof( token );
+ bc->maxs[ i ] = atof( token );
}
+ defined |= MAXS;
continue;
}
else if( !Q_stricmp( token, "zOffset" ) )
@@ -1558,8 +839,9 @@ static qboolean BG_ParseBuildableFile( const char *filename, buildableAttributeO
offset = atof( token );
- bao->zOffset = offset;
+ bc->zOffset = offset;
+ defined |= ZOFFSET;
continue;
}
@@ -1568,51 +850,52 @@ static qboolean BG_ParseBuildableFile( const char *filename, buildableAttributeO
return qfalse;
}
+ if( !( defined & MODEL ) ) token = "model";
+ else if( !( defined & MODELSCALE ) ) token = "modelScale";
+ else if( !( defined & MINS ) ) token = "mins";
+ else if( !( defined & MAXS ) ) token = "maxs";
+ else if( !( defined & ZOFFSET ) ) token = "zOffset";
+ else token = "";
+
+ if( strlen( token ) > 0 )
+ {
+ Com_Printf( S_COLOR_RED "ERROR: %s not defined in %s\n",
+ token, filename );
+ return qfalse;
+ }
+
return qtrue;
}
/*
===============
-BG_InitBuildableOverrides
-
-Set any overrides specfied by file
+BG_InitBuildableConfigs
===============
*/
-void BG_InitBuildableOverrides( void )
+void BG_InitBuildableConfigs( void )
{
- int i;
- buildableAttributeOverrides_t *bao;
+ int i;
+ buildableConfig_t *bc;
for( i = BA_NONE + 1; i < BA_NUM_BUILDABLES; i++ )
{
- bao = BG_FindOverrideForBuildable( i );
+ bc = BG_BuildableConfig( i );
+ Com_Memset( bc, 0, sizeof( buildableConfig_t ) );
- BG_ParseBuildableFile( va( "overrides/buildables/%s.cfg", BG_FindNameForBuildable( i ) ), bao );
+ BG_ParseBuildableFile( va( "configs/buildables/%s.cfg",
+ BG_Buildable( i )->name ), bc );
}
}
////////////////////////////////////////////////////////////////////////////////
-classAttributes_t bg_classList[ ] =
+static const classAttributes_t bg_classList[ ] =
{
{
PCL_NONE, //int classnum;
"spectator", //char *className;
- "Spectator", //char *humanName;
"",
- "", //char *modelname;
- 1.0f, //float modelScale;
- "", //char *skinname;
- 1.0f, //float shadowScale;
- "", //char *hudname;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
- { -12, -12, -12 }, //vec3_t mins;
- { 12, 12, 12 }, //vec3_t maxs;
- { 12, 12, 12 }, //vec3_t crouchmaxs;
- { -12, -12, -12 }, //vec3_t deadmins;
- { 12, 12, 12 }, //vec3_t deadmaxs;
- 0.0f, //float zOffset
- 0, 0, //int viewheight, crouchviewheight;
0, //int health;
0.0f, //float fallDamage;
0, //int regenRate;
@@ -1637,22 +920,9 @@ classAttributes_t bg_classList[ ] =
{
PCL_ALIEN_BUILDER0, //int classnum;
"builder", //char *className;
- "Builder", //char *humanName;
"Responsible for building and maintaining all the alien structures. "
"Has a weak melee slash attack.",
- "builder", //char *modelname;
- 1.0f, //float modelScale;
- "default", //char *skinname;
- 1.0f, //float shadowScale;
- "alien_builder_hud", //char *hudname;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
- { -15, -15, -20 }, //vec3_t mins;
- { 15, 15, 20 }, //vec3_t maxs;
- { 15, 15, 20 }, //vec3_t crouchmaxs;
- { -15, -15, -4 }, //vec3_t deadmins;
- { 15, 15, 4 }, //vec3_t deadmaxs;
- 0.0f, //float zOffset
- 0, 0, //int viewheight, crouchviewheight;
ABUILDER_HEALTH, //int health;
0.2f, //float fallDamage;
ABUILDER_REGEN, //int regenRate;
@@ -1677,23 +947,10 @@ classAttributes_t bg_classList[ ] =
{
PCL_ALIEN_BUILDER0_UPG, //int classnum;
"builderupg", //char *classname;
- "Advanced Builder", //char *humanname;
"Similar to the base Granger, except that in addition to "
"being able to build structures it has a spit attack "
"that slows victims and the ability to crawl on walls.",
- "builder", //char *modelname;
- 1.0f, //float modelScale;
- "advanced", //char *skinname;
- 1.0f, //float shadowScale;
- "alien_builder_hud", //char *hudname;
( 1 << S2 )|( 1 << S3 ), //int stages
- { -20, -20, -20 }, //vec3_t mins;
- { 20, 20, 20 }, //vec3_t maxs;
- { 20, 20, 20 }, //vec3_t crouchmaxs;
- { -20, -20, -4 }, //vec3_t deadmins;
- { 20, 20, 4 }, //vec3_t deadmaxs;
- 0.0f, //float zOffset
- 0, 0, //int viewheight, crouchviewheight;
ABUILDER_UPG_HEALTH, //int health;
0.2f, //float fallDamage;
ABUILDER_UPG_REGEN, //int regenRate;
@@ -1718,22 +975,9 @@ classAttributes_t bg_classList[ ] =
{
PCL_ALIEN_LEVEL0, //int classnum;
"level0", //char *classname;
- "Dretch", //char *humanname;
"Has a lethal reflexive bite and the ability to crawl on "
"walls and ceilings.",
- "jumper", //char *modelname;
- 0.2f, //float modelScale;
- "default", //char *skinname;
- 0.3f, //float shadowScale;
- "alien_general_hud", //char *hudname;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
- { -15, -15, -15 }, //vec3_t mins;
- { 15, 15, 15 }, //vec3_t maxs;
- { 15, 15, 15 }, //vec3_t crouchmaxs;
- { -15, -15, -4 }, //vec3_t deadmins;
- { 15, 15, 4 }, //vec3_t deadmaxs;
- -8.0f, //float zOffset
- 0, 0, //int viewheight, crouchviewheight;
LEVEL0_HEALTH, //int health;
0.0f, //float fallDamage;
LEVEL0_REGEN, //int regenRate;
@@ -1758,24 +1002,11 @@ classAttributes_t bg_classList[ ] =
{
PCL_ALIEN_LEVEL1, //int classnum;
"level1", //char *classname;
- "Basilisk", //char *humanname;
"A support class able to crawl on walls and ceilings. Its melee "
"attack is most effective when combined with the ability to grab "
"and hold its victims in place. Provides a weak healing aura "
"that accelerates the healing rate of nearby aliens.",
- "spitter", //char *modelname;
- 0.6f, //float modelScale;
- "default", //char *skinname;
- 1.0f, //float shadowScale;
- "alien_general_hud", //char *hudname;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
- { -18, -18, -18 }, //vec3_t mins;
- { 18, 18, 18 }, //vec3_t maxs;
- { 18, 18, 18 }, //vec3_t crouchmaxs;
- { -18, -18, -4 }, //vec3_t deadmins;
- { 18, 18, 4 }, //vec3_t deadmaxs;
- 0.0f, //float zOffset
- 0, 0, //int viewheight, crouchviewheight;
LEVEL1_HEALTH, //int health;
0.0f, //float fallDamage;
LEVEL1_REGEN, //int regenRate;
@@ -1800,24 +1031,11 @@ classAttributes_t bg_classList[ ] =
{
PCL_ALIEN_LEVEL1_UPG, //int classnum;
"level1upg", //char *classname;
- "Advanced Basilisk", //char *humanname;
"In addition to the basic Basilisk abilities, the Advanced "
"Basilisk sprays a poisonous gas which disorients any "
"nearby humans. Has a strong healing aura that "
"that accelerates the healing rate of nearby aliens.",
- "spitter", //char *modelname;
- 0.7f, //float modelScale;
- "blue", //char *skinname;
- 1.0f, //float shadowScale;
- "alien_general_hud", //char *hudname;
( 1 << S2 )|( 1 << S3 ), //int stages
- { -20, -20, -20 }, //vec3_t mins;
- { 20, 20, 20 }, //vec3_t maxs;
- { 20, 20, 20 }, //vec3_t crouchmaxs;
- { -20, -20, -4 }, //vec3_t deadmins;
- { 20, 20, 4 }, //vec3_t deadmaxs;
- 0.0f, //float zOffset
- 0, 0, //int viewheight, crouchviewheight;
LEVEL1_UPG_HEALTH, //int health;
0.0f, //float fallDamage;
LEVEL1_UPG_REGEN, //int regenRate;
@@ -1842,22 +1060,9 @@ classAttributes_t bg_classList[ ] =
{
PCL_ALIEN_LEVEL2, //int classnum;
"level2", //char *classname;
- "Marauder", //char *humanname;
"Has a melee attack and the ability to jump off walls. This "
"allows the Marauder to gather great speed in enclosed areas.",
- "tarantula", //char *modelname;
- 0.75f, //float modelScale;
- "default", //char *skinname;
- 1.0f, //float shadowScale;
- "alien_general_hud", //char *hudname;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
- { -22, -22, -22 }, //vec3_t mins;
- { 22, 22, 22 }, //vec3_t maxs;
- { 22, 22, 22 }, //vec3_t crouchmaxs;
- { -22, -22, -4 }, //vec3_t deadmins;
- { 22, 22, 4 }, //vec3_t deadmaxs;
- 0.0f, //float zOffset
- 10, 10, //int viewheight, crouchviewheight;
LEVEL2_HEALTH, //int health;
0.0f, //float fallDamage;
LEVEL2_REGEN, //int regenRate;
@@ -1882,22 +1087,9 @@ classAttributes_t bg_classList[ ] =
{
PCL_ALIEN_LEVEL2_UPG, //int classnum;
"level2upg", //char *classname;
- "Advanced Marauder", //char *humanname;
"The Advanced Marauder has all the abilities of the basic Marauder "
"with the addition of an area effect electric shock attack.",
- "tarantula", //char *modelname;
- 0.9f, //float modelScale;
- "red", //char *skinname;
- 1.0f, //float shadowScale;
- "alien_general_hud", //char *hudname;
( 1 << S2 )|( 1 << S3 ), //int stages
- { -24, -24, -24 }, //vec3_t mins;
- { 24, 24, 24 }, //vec3_t maxs;
- { 24, 24, 24 }, //vec3_t crouchmaxs;
- { -24, -24, -4 }, //vec3_t deadmins;
- { 24, 24, 4 }, //vec3_t deadmaxs;
- 0.0f, //float zOffset
- 12, 12, //int viewheight, crouchviewheight;
LEVEL2_UPG_HEALTH, //int health;
0.0f, //float fallDamage;
LEVEL2_UPG_REGEN, //int regenRate;
@@ -1922,23 +1114,10 @@ classAttributes_t bg_classList[ ] =
{
PCL_ALIEN_LEVEL3, //int classnum;
"level3", //char *classname;
- "Dragoon", //char *humanname;
"Possesses a melee attack and the pounce ability, which may "
"be used as both an attack and a means to reach remote "
"locations inaccessible from the ground.",
- "prowl", //char *modelname;
- 1.0f, //float modelScale;
- "default", //char *skinname;
- 1.0f, //float shadowScale;
- "alien_general_hud", //char *hudname;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
- { -32, -32, -21 }, //vec3_t mins;
- { 32, 32, 21 }, //vec3_t maxs;
- { 32, 32, 21 }, //vec3_t crouchmaxs;
- { -32, -32, -4 }, //vec3_t deadmins;
- { 32, 32, 4 }, //vec3_t deadmaxs;
- 0.0f, //float zOffset
- 24, 24, //int viewheight, crouchviewheight;
LEVEL3_HEALTH, //int health;
0.0f, //float fallDamage;
LEVEL3_REGEN, //int regenRate;
@@ -1963,23 +1142,10 @@ classAttributes_t bg_classList[ ] =
{
PCL_ALIEN_LEVEL3_UPG, //int classnum;
"level3upg", //char *classname;
- "Advanced Dragoon", //char *humanname;
"In addition to the basic Dragoon abilities, the Advanced "
"Dragoon has 3 barbs which may be used to attack humans "
"from a distance.",
- "prowl", //char *modelname;
- 1.0f, //float modelScale;
- "default", //char *skinname;
- 1.0f, //float shadowScale;
- "alien_general_hud", //char *hudname;
( 1 << S2 )|( 1 << S3 ), //int stages
- { -32, -32, -21 }, //vec3_t mins;
- { 32, 32, 21 }, //vec3_t maxs;
- { 32, 32, 21 }, //vec3_t crouchmaxs;
- { -32, -32, -4 }, //vec3_t deadmins;
- { 32, 32, 4 }, //vec3_t deadmaxs;
- 0.0f, //float zOffset
- 27, 27, //int viewheight, crouchviewheight;
LEVEL3_UPG_HEALTH, //int health;
0.0f, //float fallDamage;
LEVEL3_UPG_REGEN, //int regenRate;
@@ -2004,24 +1170,11 @@ classAttributes_t bg_classList[ ] =
{
PCL_ALIEN_LEVEL4, //int classnum;
"level4", //char *classname;
- "Tyrant", //char *humanname;
"A large alien with a strong melee attack, this class can "
"also charge at enemy humans and structures, inflicting "
"great damage. Any humans or their structures caught under "
"a falling Tyrant will be crushed by its weight.",
- "mofo", //char *modelname;
- 1.0f, //float modelScale;
- "default", //char *skinname;
- 2.0f, //float shadowScale;
- "alien_general_hud", //char *hudname;
( 1 << S3 ), //int stages
- { -30, -30, -20 }, //vec3_t mins;
- { 30, 30, 20 }, //vec3_t maxs;
- { 30, 30, 20 }, //vec3_t crouchmaxs;
- { -15, -15, -4 }, //vec3_t deadmins;
- { 15, 15, 4 }, //vec3_t deadmaxs;
- 0.0f, //float zOffset
- 35, 35, //int viewheight, crouchviewheight;
LEVEL4_HEALTH, //int health;
0.0f, //float fallDamage;
LEVEL4_REGEN, //int regenRate;
@@ -2046,21 +1199,8 @@ classAttributes_t bg_classList[ ] =
{
PCL_HUMAN, //int classnum;
"human_base", //char *classname;
- "Human", //char *humanname;
"",
- "sarge", //char *modelname;
- 1.0f, //float modelScale;
- "default", //char *skinname;
- 1.0f, //float shadowScale;
- "human_hud", //char *hudname;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
- { -15, -15, -24 }, //vec3_t mins;
- { 15, 15, 32 }, //vec3_t maxs;
- { 15, 15, 16 }, //vec3_t crouchmaxs;
- { -15, -15, -4 }, //vec3_t deadmins;
- { 15, 15, 4 }, //vec3_t deadmaxs;
- -2.0f, //float zOffset
- 26, 12, //int viewheight, crouchviewheight;
100, //int health;
1.0f, //float fallDamage;
0, //int regenRate;
@@ -2085,21 +1225,8 @@ classAttributes_t bg_classList[ ] =
{
PCL_HUMAN_BSUIT, //int classnum;
"human_bsuit", //char *classname;
- "Battlesuit", //char *humanname;
"",
- "keel", //char *modelname;
- 1.0f, //float modelScale;
- "default", //char *skinname;
- 1.0f, //float shadowScale;
- "human_hud", //char *hudname;
( 1 << S3 ), //int stages
- { -15, -15, -38 }, //vec3_t mins;
- { 15, 15, 38 }, //vec3_t maxs;
- { 15, 15, 38 }, //vec3_t crouchmaxs;
- { -15, -15, -4 }, //vec3_t deadmins;
- { 15, 15, 4 }, //vec3_t deadmaxs;
- -16.0f, //float zOffset
- 35, 35, //int viewheight, crouchviewheight;
100, //int health;
1.0f, //float fallDamage;
0, //int regenRate;
@@ -2124,661 +1251,96 @@ classAttributes_t bg_classList[ ] =
},
};
-int bg_numPclasses = sizeof( bg_classList ) / sizeof( bg_classList[ 0 ] );
+int bg_numClasses = sizeof( bg_classList ) / sizeof( bg_classList[ 0 ] );
-//separate from bg_classList to work around char struct init bug
-classAttributeOverrides_t bg_classOverrideList[ PCL_NUM_CLASSES ];
+static const classAttributes_t nullClass = { 0 };
/*
==============
-BG_FindClassNumForName
+BG_ClassByName
==============
*/
-int BG_FindClassNumForName( char *name )
+const classAttributes_t *BG_ClassByName( const char *name )
{
int i;
- for( i = 0; i < bg_numPclasses; i++ )
+ for( i = 0; i < bg_numClasses; i++ )
{
- if( !Q_stricmp( bg_classList[ i ].className, name ) )
- return bg_classList[ i ].classNum;
+ if( !Q_stricmp( bg_classList[ i ].name, name ) )
+ return &bg_classList[ i ];
}
- //wimp out
- return PCL_NONE;
+ return &nullClass;
}
/*
==============
-BG_FindNameForClassNum
+BG_Class
==============
*/
-char *BG_FindNameForClassNum( int pclass )
+const classAttributes_t *BG_Class( class_t class )
{
int i;
- for( i = 0; i < bg_numPclasses; i++ )
+ for( i = 0; i < bg_numClasses; i++ )
{
- if( bg_classList[ i ].classNum == pclass )
- return bg_classList[ i ].className;
+ if( bg_classList[ i ].number == class )
+ return &bg_classList[ i ];
}
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindNameForClassNum\n" );
- //wimp out
- return 0;
+ return &nullClass;
}
/*
==============
-BG_FindHumanNameForClassNum
+BG_ClassAllowedInStage
==============
*/
-char *BG_FindHumanNameForClassNum( int pclass )
+qboolean BG_ClassAllowedInStage( class_t class,
+ stage_t stage )
{
- int i;
-
- if( bg_classOverrideList[ pclass ].humanName[ 0 ] != 0 )
- return bg_classOverrideList[ pclass ].humanName;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- return bg_classList[ i ].humanName;
- }
+ int stages = BG_Class( class )->stages;
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindHumanNameForClassNum\n" );
- //wimp out
- return 0;
+ return stages & ( 1 << stage );
}
-/*
-==============
-BG_FindInfoForClassNum
-==============
-*/
-char *BG_FindInfoForClassNum( int pclass )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- return bg_classList[ i ].info;
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindInfoForClassNum\n" );
- //wimp out
- return 0;
-}
-
-/*
-==============
-BG_FindModelNameForClass
-==============
-*/
-char *BG_FindModelNameForClass( int pclass )
-{
- int i;
-
- if( bg_classOverrideList[ pclass ].modelName[ 0 ] != 0 )
- return bg_classOverrideList[ pclass ].modelName;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- return bg_classList[ i ].modelName;
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindModelNameForClass\n" );
- //note: must return a valid modelName!
- return bg_classList[ 0 ].modelName;
-}
+static classConfig_t bg_classConfigList[ PCL_NUM_CLASSES ];
/*
==============
-BG_FindModelScaleForClass
+BG_ClassConfig
==============
*/
-float BG_FindModelScaleForClass( int pclass )
+classConfig_t *BG_ClassConfig( class_t class )
{
- int i;
-
- if( bg_classOverrideList[ pclass ].modelScale != 0.0f )
- return bg_classOverrideList[ pclass ].modelScale;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].modelScale;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindModelScaleForClass( %d )\n", pclass );
- return 1.0f;
-}
-
-/*
-==============
-BG_FindSkinNameForClass
-==============
-*/
-char *BG_FindSkinNameForClass( int pclass )
-{
- int i;
-
- if( bg_classOverrideList[ pclass ].skinName[ 0 ] != 0 )
- return bg_classOverrideList[ pclass ].skinName;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- return bg_classList[ i ].skinName;
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindSkinNameForClass\n" );
- //note: must return a valid modelName!
- return bg_classList[ 0 ].skinName;
-}
-
-/*
-==============
-BG_FindShadowScaleForClass
-==============
-*/
-float BG_FindShadowScaleForClass( int pclass )
-{
- int i;
-
- if( bg_classOverrideList[ pclass ].shadowScale != 0.0f )
- return bg_classOverrideList[ pclass ].shadowScale;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].shadowScale;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindShadowScaleForClass( %d )\n", pclass );
- return 1.0f;
-}
-
-/*
-==============
-BG_FindHudNameForClass
-==============
-*/
-char *BG_FindHudNameForClass( int pclass )
-{
- int i;
-
- if( bg_classOverrideList[ pclass ].hudName[ 0 ] != 0 )
- return bg_classOverrideList[ pclass ].hudName;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- return bg_classList[ i ].hudName;
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindHudNameForClass\n" );
- //note: must return a valid hudName!
- return bg_classList[ 0 ].hudName;
-}
-
-/*
-==============
-BG_FindStagesForClass
-==============
-*/
-qboolean BG_FindStagesForClass( int pclass, stage_t stage )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- if( bg_classList[ i ].stages & ( 1 << stage ) )
- return qtrue;
- else
- return qfalse;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindStagesForClass\n" );
- return qfalse;
+ return &bg_classConfigList[ class ];
}
/*
==============
-BG_FindBBoxForClass
+BG_ClassBoundingBox
==============
*/
-void BG_FindBBoxForClass( int pclass, vec3_t mins, vec3_t maxs, vec3_t cmaxs, vec3_t dmins, vec3_t dmaxs )
+void BG_ClassBoundingBox( class_t class,
+ 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( VectorLength( bg_classOverrideList[ pclass ].mins ) )
- VectorCopy( bg_classOverrideList[ pclass ].mins, mins );
- }
-
- if( maxs != NULL )
- {
- VectorCopy( bg_classList[ i ].maxs, maxs );
-
- if( VectorLength( bg_classOverrideList[ pclass ].maxs ) )
- VectorCopy( bg_classOverrideList[ pclass ].maxs, maxs );
- }
-
- if( cmaxs != NULL )
- {
- VectorCopy( bg_classList[ i ].crouchMaxs, cmaxs );
-
- if( VectorLength( bg_classOverrideList[ pclass ].crouchMaxs ) )
- VectorCopy( bg_classOverrideList[ pclass ].crouchMaxs, cmaxs );
- }
-
- if( dmins != NULL )
- {
- VectorCopy( bg_classList[ i ].deadMins, dmins );
-
- if( VectorLength( bg_classOverrideList[ pclass ].deadMins ) )
- VectorCopy( bg_classOverrideList[ pclass ].deadMins, dmins );
- }
-
- if( dmaxs != NULL )
- {
- VectorCopy( bg_classList[ i ].deadMaxs, dmaxs );
-
- if( VectorLength( bg_classOverrideList[ pclass ].deadMaxs ) )
- VectorCopy( bg_classOverrideList[ pclass ].deadMaxs, dmaxs );
- }
-
- return;
- }
- }
+ classConfig_t *classConfig = BG_ClassConfig( class );
if( mins != NULL )
- VectorCopy( bg_classList[ 0 ].mins, mins );
+ VectorCopy( classConfig->mins, mins );
if( maxs != NULL )
- VectorCopy( bg_classList[ 0 ].maxs, maxs );
+ VectorCopy( classConfig->maxs, maxs );
if( cmaxs != NULL )
- VectorCopy( bg_classList[ 0 ].crouchMaxs, cmaxs );
+ VectorCopy( classConfig->crouchMaxs, cmaxs );
if( dmins != NULL )
- VectorCopy( bg_classList[ 0 ].deadMins, dmins );
+ VectorCopy( classConfig->deadMins, dmins );
if( dmaxs != NULL )
- VectorCopy( bg_classList[ 0 ].deadMaxs, dmaxs );
-}
-
-/*
-==============
-BG_FindZOffsetForClass
-==============
-*/
-float BG_FindZOffsetForClass( int pclass )
-{
- int i;
-
- if( bg_classOverrideList[ pclass ].zOffset != 0.0f )
- return bg_classOverrideList[ pclass ].zOffset;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].zOffset;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindZOffsetForClass\n" );
- return 0.0f;
-}
-
-/*
-==============
-BG_FindViewheightForClass
-==============
-*/
-void BG_FindViewheightForClass( int pclass, int *viewheight, int *cViewheight )
-{
- int i;
- int vh = 0;
- int cvh = 0;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- vh = bg_classList[ i ].viewheight;
- cvh = bg_classList[ i ].crouchViewheight;
- break;
- }
- }
-
- if( bg_classOverrideList[ pclass ].viewheight != 0 )
- vh = bg_classOverrideList[ pclass ].viewheight;
- if( bg_classOverrideList[ pclass ].crouchViewheight != 0 )
- cvh = bg_classOverrideList[ pclass ].crouchViewheight;
-
-
- if( vh == 0 )
- vh = bg_classList[ 0 ].viewheight;
- if( cvh == 0 )
- cvh = bg_classList[ 0 ].crouchViewheight;
-
- if( viewheight != NULL )
- *viewheight = vh;
- if( cViewheight != NULL )
- *cViewheight = cvh;
-}
-
-/*
-==============
-BG_FindHealthForClass
-==============
-*/
-int BG_FindHealthForClass( int pclass )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].health;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindHealthForClass\n" );
- return 100;
-}
-
-/*
-==============
-BG_FindFallDamageForClass
-==============
-*/
-float BG_FindFallDamageForClass( int pclass )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].fallDamage;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindFallDamageForClass\n" );
- return 100;
-}
-
-/*
-==============
-BG_FindRegenRateForClass
-==============
-*/
-int BG_FindRegenRateForClass( int pclass )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].regenRate;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindRegenRateForClass\n" );
- return 0;
-}
-
-/*
-==============
-BG_FindFovForClass
-==============
-*/
-int BG_FindFovForClass( int pclass )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].fov;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindFovForClass\n" );
- return 90;
-}
-
-/*
-==============
-BG_FindBobForClass
-==============
-*/
-float BG_FindBobForClass( int pclass )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].bob;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindBobForClass\n" );
- return 0.002;
-}
-
-/*
-==============
-BG_FindBobCycleForClass
-==============
-*/
-float BG_FindBobCycleForClass( int pclass )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].bobCycle;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindBobCycleForClass\n" );
- return 1.0f;
-}
-
-/*
-==============
-BG_FindSpeedForClass
-==============
-*/
-float BG_FindSpeedForClass( int pclass )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].speed;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindSpeedForClass\n" );
- return 1.0f;
-}
-
-/*
-==============
-BG_FindAccelerationForClass
-==============
-*/
-float BG_FindAccelerationForClass( int pclass )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].acceleration;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindAccelerationForClass\n" );
- return 10.0f;
-}
-
-/*
-==============
-BG_FindAirAccelerationForClass
-==============
-*/
-float BG_FindAirAccelerationForClass( int pclass )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].airAcceleration;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindAirAccelerationForClass\n" );
- return 1.0f;
-}
-
-/*
-==============
-BG_FindFrictionForClass
-==============
-*/
-float BG_FindFrictionForClass( int pclass )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].friction;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindFrictionForClass\n" );
- return 6.0f;
-}
-
-/*
-==============
-BG_FindStopSpeedForClass
-==============
-*/
-float BG_FindStopSpeedForClass( int pclass )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].stopSpeed;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindStopSpeedForClass\n" );
- return 100.0f;
-}
-
-/*
-==============
-BG_FindJumpMagnitudeForClass
-==============
-*/
-float BG_FindJumpMagnitudeForClass( int pclass )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].jumpMagnitude;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindJumpMagnitudeForClass\n" );
- return 270.0f;
-}
-
-/*
-==============
-BG_FindKnockbackScaleForClass
-==============
-*/
-float BG_FindKnockbackScaleForClass( int pclass )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].knockbackScale;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindKnockbackScaleForClass\n" );
- return 1.0f;
-}
-
-/*
-==============
-BG_FindSteptimeForClass
-==============
-*/
-int BG_FindSteptimeForClass( int pclass )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].steptime;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindSteptimeForClass\n" );
- return 200;
+ VectorCopy( classConfig->deadMaxs, dmaxs );
}
/*
@@ -2786,61 +1348,11 @@ int BG_FindSteptimeForClass( int pclass )
BG_ClassHasAbility
==============
*/
-qboolean BG_ClassHasAbility( int pclass, int ability )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return ( bg_classList[ i ].abilities & ability );
- }
- }
-
- return qfalse;
-}
-
-/*
-==============
-BG_FindStartWeaponForClass
-==============
-*/
-weapon_t BG_FindStartWeaponForClass( int pclass )
+qboolean BG_ClassHasAbility( class_t class, int ability )
{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].startWeapon;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindStartWeaponForClass\n" );
- return WP_NONE;
-}
-
-/*
-==============
-BG_FindBuildDistForClass
-==============
-*/
-float BG_FindBuildDistForClass( int pclass )
-{
- int i;
+ int abilities = BG_Class( class )->abilities;
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].buildDist;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindBuildDistForClass\n" );
- return 0.0f;
+ return abilities & ability;
}
/*
@@ -2848,7 +1360,9 @@ float BG_FindBuildDistForClass( int pclass )
BG_ClassCanEvolveFromTo
==============
*/
-int BG_ClassCanEvolveFromTo( int fclass, int tclass, int credits, int stage,
+int BG_ClassCanEvolveFromTo( class_t fclass,
+ class_t tclass,
+ int credits, int stage,
int cost )
{
int i, j, best, value;
@@ -2857,9 +1371,9 @@ int BG_ClassCanEvolveFromTo( int fclass, int tclass, int credits, int stage,
fclass == tclass )
return -1;
- for( i = 0; i < bg_numPclasses; i++ )
+ for( i = 0; i < bg_numClasses; i++ )
{
- if( bg_classList[ i ].classNum != fclass )
+ if( bg_classList[ i ].number != fclass )
continue;
best = credits + 1;
@@ -2868,11 +1382,11 @@ int BG_ClassCanEvolveFromTo( int fclass, int tclass, int credits, int stage,
int thruClass, evolveCost;
thruClass = bg_classList[ i ].children[ j ];
- if( thruClass == PCL_NONE || !BG_FindStagesForClass( thruClass, stage ) ||
+ if( thruClass == PCL_NONE || !BG_ClassAllowedInStage( thruClass, stage ) ||
!BG_ClassIsAllowed( thruClass ) )
continue;
- evolveCost = BG_FindCostOfClass( thruClass ) * ALIEN_CREDITS_PER_FRAG;
+ evolveCost = BG_Class( thruClass )->cost * ALIEN_CREDITS_PER_FRAG;
if( thruClass == tclass )
value = cost + evolveCost;
else
@@ -2895,21 +1409,21 @@ int BG_ClassCanEvolveFromTo( int fclass, int tclass, int credits, int stage,
BG_AlienCanEvolve
==============
*/
-qboolean BG_AlienCanEvolve( int pclass, int credits, int stage )
+qboolean BG_AlienCanEvolve( class_t class, int credits, int stage )
{
int i, j, tclass;
- for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ )
+ for( i = 0; i < bg_numClasses; i++ )
{
- if( bg_classList[ i ].classNum != pclass )
+ if( bg_classList[ i ].number != class )
continue;
for( j = 0; j < 3; j++ )
{
tclass = bg_classList[ i ].children[ j ];
- if( tclass != PCL_NONE && BG_FindStagesForClass( tclass, stage ) &&
+ if( tclass != PCL_NONE && BG_ClassAllowedInStage( tclass, stage ) &&
BG_ClassIsAllowed( tclass ) &&
- credits >= BG_FindCostOfClass( tclass ) * ALIEN_CREDITS_PER_FRAG )
+ credits >= BG_Class( tclass )->cost * ALIEN_CREDITS_PER_FRAG )
return qtrue;
}
@@ -2920,59 +1434,6 @@ qboolean BG_AlienCanEvolve( int pclass, int credits, int stage )
return qfalse;
}
-
-/*
-==============
-BG_FindValueOfClass
-==============
-*/
-int BG_FindValueOfClass( int pclass )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].value;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindValueOfClass\n" );
- return 0;
-}
-
-/*
-==============
-BG_FindCostOfClass
-==============
-*/
-int BG_FindCostOfClass( int pclass )
-{
- int i;
-
- for( i = 0; i < bg_numPclasses; i++ )
- {
- if( bg_classList[ i ].classNum == pclass )
- {
- return bg_classList[ i ].cost;
- }
- }
-
- Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindCostOfClass\n" );
- return 0;
-}
-
-/*
-==============
-BG_FindOverrideForClass
-==============
-*/
-static classAttributeOverrides_t *BG_FindOverrideForClass( int pclass )
-{
- return &bg_classOverrideList[ pclass ];
-}
-
/*
======================
BG_ParseClassFile
@@ -2980,7 +1441,7 @@ BG_ParseClassFile
Parses a configuration file describing a class
======================
*/
-static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides_t *cao )
+static qboolean BG_ParseClassFile( const char *filename, classConfig_t *cc )
{
char *text_p;
int i;
@@ -2989,7 +1450,24 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
char text[ 20000 ];
fileHandle_t f;
float scale = 0.0f;
-
+ int defined = 0;
+ enum
+ {
+ MODEL = 1 << 0,
+ SKIN = 1 << 1,
+ HUD = 1 << 2,
+ MODELSCALE = 1 << 3,
+ SHADOWSCALE = 1 << 4,
+ MINS = 1 << 5,
+ MAXS = 1 << 6,
+ DEADMINS = 1 << 7,
+ DEADMAXS = 1 << 8,
+ CROUCHMAXS = 1 << 9,
+ VIEWHEIGHT = 1 << 10,
+ CVIEWHEIGHT = 1 << 11,
+ ZOFFSET = 1 << 12,
+ NAME = 1 << 13
+ };
// load the file
len = trap_FS_FOpenFile( filename, &f, FS_READ );
@@ -3028,8 +1506,9 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
if( !token )
break;
- Q_strncpyz( cao->modelName, token, sizeof( cao->modelName ) );
+ Q_strncpyz( cc->modelName, token, sizeof( cc->modelName ) );
+ defined |= MODEL;
continue;
}
else if( !Q_stricmp( token, "skin" ) )
@@ -3038,8 +1517,9 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
if( !token )
break;
- Q_strncpyz( cao->skinName, token, sizeof( cao->skinName ) );
+ Q_strncpyz( cc->skinName, token, sizeof( cc->skinName ) );
+ defined |= SKIN;
continue;
}
else if( !Q_stricmp( token, "hud" ) )
@@ -3048,8 +1528,9 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
if( !token )
break;
- Q_strncpyz( cao->hudName, token, sizeof( cao->hudName ) );
+ Q_strncpyz( cc->hudName, token, sizeof( cc->hudName ) );
+ defined |= HUD;
continue;
}
else if( !Q_stricmp( token, "modelScale" ) )
@@ -3063,8 +1544,9 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
if( scale < 0.0f )
scale = 0.0f;
- cao->modelScale = scale;
+ cc->modelScale = scale;
+ defined |= MODELSCALE;
continue;
}
else if( !Q_stricmp( token, "shadowScale" ) )
@@ -3078,8 +1560,9 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
if( scale < 0.0f )
scale = 0.0f;
- cao->shadowScale = scale;
+ cc->shadowScale = scale;
+ defined |= SHADOWSCALE;
continue;
}
else if( !Q_stricmp( token, "mins" ) )
@@ -3090,9 +1573,10 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
if( !token )
break;
- cao->mins[ i ] = atof( token );
+ cc->mins[ i ] = atof( token );
}
+ defined |= MINS;
continue;
}
else if( !Q_stricmp( token, "maxs" ) )
@@ -3103,9 +1587,10 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
if( !token )
break;
- cao->maxs[ i ] = atof( token );
+ cc->maxs[ i ] = atof( token );
}
+ defined |= MAXS;
continue;
}
else if( !Q_stricmp( token, "deadMins" ) )
@@ -3116,9 +1601,10 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
if( !token )
break;
- cao->deadMins[ i ] = atof( token );
+ cc->deadMins[ i ] = atof( token );
}
+ defined |= DEADMINS;
continue;
}
else if( !Q_stricmp( token, "deadMaxs" ) )
@@ -3129,9 +1615,10 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
if( !token )
break;
- cao->deadMaxs[ i ] = atof( token );
+ cc->deadMaxs[ i ] = atof( token );
}
+ defined |= DEADMAXS;
continue;
}
else if( !Q_stricmp( token, "crouchMaxs" ) )
@@ -3142,21 +1629,24 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
if( !token )
break;
- cao->crouchMaxs[ i ] = atof( token );
+ cc->crouchMaxs[ i ] = atof( token );
}
+ defined |= CROUCHMAXS;
continue;
}
else if( !Q_stricmp( token, "viewheight" ) )
{
token = COM_Parse( &text_p );
- cao->viewheight = atoi( token );
+ cc->viewheight = atoi( token );
+ defined |= VIEWHEIGHT;
continue;
}
else if( !Q_stricmp( token, "crouchViewheight" ) )
{
token = COM_Parse( &text_p );
- cao->crouchViewheight = atoi( token );
+ cc->crouchViewheight = atoi( token );
+ defined |= CVIEWHEIGHT;
continue;
}
else if( !Q_stricmp( token, "zOffset" ) )
@@ -3169,8 +1659,9 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
offset = atof( token );
- cao->zOffset = offset;
+ cc->zOffset = offset;
+ defined |= ZOFFSET;
continue;
}
else if( !Q_stricmp( token, "name" ) )
@@ -3179,8 +1670,9 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
if( !token )
break;
- Q_strncpyz( cao->humanName, token, sizeof( cao->humanName ) );
+ Q_strncpyz( cc->humanName, token, sizeof( cc->humanName ) );
+ defined |= NAME;
continue;
}
@@ -3189,32 +1681,54 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
return qfalse;
}
+ if( !( defined & MODEL ) ) token = "model";
+ else if( !( defined & SKIN ) ) token = "skin";
+ else if( !( defined & HUD ) ) token = "hud";
+ else if( !( defined & MODELSCALE ) ) token = "modelScale";
+ else if( !( defined & SHADOWSCALE ) ) token = "shadowScale";
+ else if( !( defined & MINS ) ) token = "mins";
+ else if( !( defined & MAXS ) ) token = "maxs";
+ else if( !( defined & DEADMINS ) ) token = "deadMins";
+ else if( !( defined & DEADMAXS ) ) token = "deadMaxs";
+ else if( !( defined & CROUCHMAXS ) ) token = "crouchMaxs";
+ else if( !( defined & VIEWHEIGHT ) ) token = "viewheight";
+ else if( !( defined & CVIEWHEIGHT ) ) token = "crouchViewheight";
+ else if( !( defined & ZOFFSET ) ) token = "zOffset";
+ else if( !( defined & NAME ) ) token = "name";
+ else token = "";
+
+ if( strlen( token ) > 0 )
+ {
+ Com_Printf( S_COLOR_RED "ERROR: %s not defined in %s\n",
+ token, filename );
+ return qfalse;
+ }
+
return qtrue;
}
/*
===============
-BG_InitClassOverrides
-
-Set any overrides specfied by file
+BG_InitClassConfigs
===============
*/
-void BG_InitClassOverrides( void )
+void BG_InitClassConfigs( void )
{
- int i;
- classAttributeOverrides_t *cao;
+ int i;
+ classConfig_t *cc;
- for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ )
+ for( i = PCL_NONE; i < PCL_NUM_CLASSES; i++ )
{
- cao = BG_FindOverrideForClass( i );
+ cc = BG_ClassConfig( i );
- BG_ParseClassFile( va( "overrides/classes/%s.cfg", BG_FindNameForClassNum( i ) ), cao );
+ BG_ParseClassFile( va( "configs/classes/%s.cfg",
+ BG_Class( i )->name ), cc );
}
}
////////////////////////////////////////////////////////////////////////////////
-weaponAttributes_t bg_weapons[ ] =
+static const weaponAttributes_t bg_weapons[ ] =
{
{
WP_BLASTER, //int weaponNum;
@@ -3222,7 +1736,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
0, //int slots;
"blaster", //char *weaponName;
- "Blaster", //char *weaponHumanName;
+ "Blaster", //char *humanName;
"",
0, //int maxAmmo;
0, //int maxClips;
@@ -3247,7 +1761,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"rifle", //char *weaponName;
- "Rifle", //char *weaponHumanName;
+ "Rifle", //char *humanName;
"Basic weapon. Cased projectile weapon, with a slow clip based "
"reload system.",
RIFLE_CLIPSIZE, //int maxAmmo;
@@ -3273,7 +1787,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"shotgun", //char *weaponName;
- "Shotgun", //char *weaponHumanName;
+ "Shotgun", //char *humanName;
"Close range weapon that is useful against larger foes. "
"It has a slow repeat rate, but can be devastatingly "
"effective.",
@@ -3300,7 +1814,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"flamer", //char *weaponName;
- "Flame Thrower", //char *weaponHumanName;
+ "Flame Thrower", //char *humanName;
"Sprays fire at its target. It is powered by compressed "
"gas. The relatively low rate of fire means this weapon is most "
"effective against static targets.",
@@ -3327,7 +1841,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"chaingun", //char *weaponName;
- "Chaingun", //char *weaponHumanName;
+ "Chaingun", //char *humanName;
"Belt drive, cased projectile weapon. It has a high repeat "
"rate but a wide firing angle and is therefore relatively "
"inaccurate.",
@@ -3354,7 +1868,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"mdriver", //char *weaponName;
- "Mass Driver", //char *weaponHumanName;
+ "Mass Driver", //char *humanName;
"A portable magnetic accelerator capable of launching "
"metallic slugs at extremely high velocity. Damage is dealt to "
"all targets in the line of fire until the slug comes to a halt "
@@ -3382,7 +1896,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"prifle", //char *weaponName;
- "Pulse Rifle", //char *weaponHumanName;
+ "Pulse Rifle", //char *humanName;
"An energy weapon that fires rapid pulses of concentrated energy.",
PRIFLE_CLIPS, //int maxAmmo;
PRIFLE_MAXCLIPS, //int maxClips;
@@ -3407,7 +1921,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"lcannon", //char *weaponName;
- "Lucifer Cannon", //char *weaponHumanName;
+ "Lucifer Cannon", //char *humanName;
"Blaster technology scaled up to deliver devastating power. "
"Primary fire must be charged before firing. It has a quick "
"secondary attack that does not require charging.",
@@ -3434,7 +1948,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"lgun", //char *weaponName;
- "Las Gun", //char *weaponHumanName;
+ "Las Gun", //char *humanName;
"Slightly more powerful than the basic rifle, rapidly fires "
"small packets of energy.",
LASGUN_AMMO, //int maxAmmo;
@@ -3460,7 +1974,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"psaw", //char *weaponName;
- "Pain Saw", //char *weaponHumanName;
+ "Pain Saw", //char *humanName;
"Similar to a chainsaw, but instead of a chain it has an "
"electric arc capable of dealing a great deal of damage at "
"close range.",
@@ -3487,7 +2001,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_NONE, //int slots;
"grenade", //char *weaponName;
- "Grenade", //char *weaponHumanName;
+ "Grenade", //char *humanName;
"",
1, //int maxAmmo;
0, //int maxClips;
@@ -3512,7 +2026,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"ckit", //char *weaponName;
- "Construction Kit", //char *weaponHumanName;
+ "Construction Kit", //char *humanName;
"Used for building structures. This includes "
"spawns, power and basic defense. More structures become "
"available with new stages.",
@@ -3539,7 +2053,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"abuild", //char *weaponName;
- "Alien build weapon", //char *weaponHumanName;
+ "Alien build weapon", //char *humanName;
"",
0, //int maxAmmo;
0, //int maxClips;
@@ -3564,7 +2078,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"abuildupg", //char *weaponName;
- "Alien build weapon2",//char *weaponHumanName;
+ "Alien build weapon2",//char *humanName;
"",
0, //int maxAmmo;
0, //int maxClips;
@@ -3589,7 +2103,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"level0", //char *weaponName;
- "Bite", //char *weaponHumanName;
+ "Bite", //char *humanName;
"",
0, //int maxAmmo;
0, //int maxClips;
@@ -3614,7 +2128,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"level1", //char *weaponName;
- "Claws", //char *weaponHumanName;
+ "Claws", //char *humanName;
"",
0, //int maxAmmo;
0, //int maxClips;
@@ -3639,7 +2153,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"level1upg", //char *weaponName;
- "Claws Upgrade", //char *weaponHumanName;
+ "Claws Upgrade", //char *humanName;
"",
0, //int maxAmmo;
0, //int maxClips;
@@ -3664,7 +2178,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"level2", //char *weaponName;
- "Bite", //char *weaponHumanName;
+ "Bite", //char *humanName;
"",
0, //int maxAmmo;
0, //int maxClips;
@@ -3689,7 +2203,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"level2upg", //char *weaponName;
- "Zap", //char *weaponHumanName;
+ "Zap", //char *humanName;
"",
0, //int maxAmmo;
0, //int maxClips;
@@ -3714,7 +2228,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"level3", //char *weaponName;
- "Pounce", //char *weaponHumanName;
+ "Pounce", //char *humanName;
"",
0, //int maxAmmo;
0, //int maxClips;
@@ -3739,7 +2253,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"level3upg", //char *weaponName;
- "Pounce (upgrade)", //char *weaponHumanName;
+ "Pounce (upgrade)", //char *humanName;
"",
3, //int maxAmmo;
0, //int maxClips;
@@ -3764,7 +2278,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"level4", //char *weaponName;
- "Charge", //char *weaponHumanName;
+ "Charge", //char *humanName;
"",
0, //int maxAmmo;
0, //int maxClips;
@@ -3789,7 +2303,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"lockblob", //char *weaponName;
- "Lock Blob", //char *weaponHumanName;
+ "Lock Blob", //char *humanName;
"",
0, //int maxAmmo;
0, //int maxClips;
@@ -3814,7 +2328,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"hive", //char *weaponName;
- "Hive", //char *weaponHumanName;
+ "Hive", //char *humanName;
"",
0, //int maxAmmo;
0, //int maxClips;
@@ -3839,7 +2353,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"mgturret", //char *weaponName;
- "Machinegun Turret", //char *weaponHumanName;
+ "Machinegun Turret", //char *humanName;
"",
0, //int maxAmmo;
0, //int maxClips;
@@ -3864,7 +2378,7 @@ weaponAttributes_t bg_weapons[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"teslagen", //char *weaponName;
- "Tesla Generator", //char *weaponHumanName;
+ "Tesla Generator", //char *humanName;
"",
0, //int maxAmmo;
0, //int maxClips;
@@ -3887,446 +2401,63 @@ weaponAttributes_t bg_weapons[ ] =
int bg_numWeapons = sizeof( bg_weapons ) / sizeof( bg_weapons[ 0 ] );
-/*
-==============
-BG_FindPriceForWeapon
-==============
-*/
-int BG_FindPriceForWeapon( int weapon )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- {
- return bg_weapons[ i ].price;
- }
- }
-
- return 100;
-}
+static const weaponAttributes_t nullWeapon = { 0 };
/*
==============
-BG_FindStagesForWeapon
+BG_WeaponByName
==============
*/
-qboolean BG_FindStagesForWeapon( int weapon, stage_t stage )
+const weaponAttributes_t *BG_WeaponByName( const char *name )
{
int i;
for( i = 0; i < bg_numWeapons; i++ )
{
- if( bg_weapons[ i ].weaponNum == weapon )
+ if( !Q_stricmp( bg_weapons[ i ].name, name ) )
{
- if( bg_weapons[ i ].stages & ( 1 << stage ) )
- return qtrue;
- else
- return qfalse;
+ return &bg_weapons[ i ];
}
}
- return qfalse;
+ return &nullWeapon;
}
/*
==============
-BG_FindSlotsForWeapon
+BG_Weapon
==============
*/
-int BG_FindSlotsForWeapon( int weapon )
+const weaponAttributes_t *BG_Weapon( weapon_t weapon )
{
int i;
for( i = 0; i < bg_numWeapons; i++ )
{
- if( bg_weapons[ i ].weaponNum == weapon )
+ if( bg_weapons[ i ].number == weapon )
{
- return bg_weapons[ i ].slots;
+ return &bg_weapons[ i ];
}
}
- return SLOT_WEAPON;
+ return &nullWeapon;
}
/*
==============
-BG_FindNameForWeapon
+BG_WeaponAllowedInStage
==============
*/
-char *BG_FindNameForWeapon( int weapon )
+qboolean BG_WeaponAllowedInStage( weapon_t weapon, stage_t stage )
{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- return bg_weapons[ i ].weaponName;
- }
+ int stages = BG_Weapon( weapon )->stages;
- //wimp out
- return 0;
-}
-
-/*
-==============
-BG_FindWeaponNumForName
-==============
-*/
-int BG_FindWeaponNumForName( char *name )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( !Q_stricmp( bg_weapons[ i ].weaponName, name ) )
- return bg_weapons[ i ].weaponNum;
- }
-
- //wimp out
- return WP_NONE;
-}
-
-/*
-==============
-BG_FindHumanNameForWeapon
-==============
-*/
-char *BG_FindHumanNameForWeapon( int weapon )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- return bg_weapons[ i ].weaponHumanName;
- }
-
- //wimp out
- return 0;
-}
-
-/*
-==============
-BG_FindInfoForWeapon
-==============
-*/
-char *BG_FindInfoForWeapon( int weapon )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- return bg_weapons[ i ].info;
- }
-
- //wimp out
- return 0;
-}
-
-/*
-==============
-BG_FindAmmoForWeapon
-==============
-*/
-void BG_FindAmmoForWeapon( int weapon, int *maxAmmo, int *maxClips )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- {
- if( maxAmmo != NULL )
- *maxAmmo = bg_weapons[ i ].maxAmmo;
- if( maxClips != NULL )
- *maxClips = bg_weapons[ i ].maxClips;
-
- //no need to keep going
- break;
- }
- }
-}
-
-/*
-==============
-BG_FindInfinteAmmoForWeapon
-==============
-*/
-qboolean BG_FindInfinteAmmoForWeapon( int weapon )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- {
- return bg_weapons[ i ].infiniteAmmo;
- }
- }
-
- return qfalse;
-}
-
-/*
-==============
-BG_FindUsesEnergyForWeapon
-==============
-*/
-qboolean BG_FindUsesEnergyForWeapon( int weapon )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- {
- return bg_weapons[ i ].usesEnergy;
- }
- }
-
- return qfalse;
-}
-
-/*
-==============
-BG_FindRepeatRate1ForWeapon
-==============
-*/
-int BG_FindRepeatRate1ForWeapon( int weapon )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- return bg_weapons[ i ].repeatRate1;
- }
-
- return 1000;
-}
-
-/*
-==============
-BG_FindRepeatRate2ForWeapon
-==============
-*/
-int BG_FindRepeatRate2ForWeapon( int weapon )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- return bg_weapons[ i ].repeatRate2;
- }
-
- return 1000;
-}
-
-/*
-==============
-BG_FindRepeatRate3ForWeapon
-==============
-*/
-int BG_FindRepeatRate3ForWeapon( int weapon )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- return bg_weapons[ i ].repeatRate3;
- }
-
- return 1000;
-}
-
-/*
-==============
-BG_FindReloadTimeForWeapon
-==============
-*/
-int BG_FindReloadTimeForWeapon( int weapon )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- {
- return bg_weapons[ i ].reloadTime;
- }
- }
-
- return 1000;
-}
-
-/*
-==============
-BG_FindKnockbackScaleForWeapon
-==============
-*/
-float BG_FindKnockbackScaleForWeapon( int weapon )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- {
- return bg_weapons[ i ].knockbackScale;
- }
- }
-
- return 1.0f;
-}
-
-/*
-==============
-BG_WeaponHasAltMode
-==============
-*/
-qboolean BG_WeaponHasAltMode( int weapon )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- {
- return bg_weapons[ i ].hasAltMode;
- }
- }
-
- return qfalse;
-}
-
-/*
-==============
-BG_WeaponHasThirdMode
-==============
-*/
-qboolean BG_WeaponHasThirdMode( int weapon )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- {
- return bg_weapons[ i ].hasThirdMode;
- }
- }
-
- return qfalse;
-}
-
-/*
-==============
-BG_WeaponCanZoom
-==============
-*/
-qboolean BG_WeaponCanZoom( int weapon )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- {
- return bg_weapons[ i ].canZoom;
- }
- }
-
- return qfalse;
-}
-
-/*
-==============
-BG_FindZoomFovForWeapon
-==============
-*/
-float BG_FindZoomFovForWeapon( int weapon )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- {
- return bg_weapons[ i ].zoomFov;
- }
- }
-
- return qfalse;
-}
-
-/*
-==============
-BG_FindPurchasableForWeapon
-==============
-*/
-qboolean BG_FindPurchasableForWeapon( int weapon )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- {
- return bg_weapons[ i ].purchasable;
- }
- }
-
- return qfalse;
-}
-
-/*
-==============
-BG_FindLongRangeForWeapon
-==============
-*/
-qboolean BG_FindLongRangedForWeapon( int weapon )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- {
- return bg_weapons[ i ].longRanged;
- }
- }
-
- return qfalse;
-}
-
-/*
-==============
-BG_FindTeamForWeapon
-==============
-*/
-team_t BG_FindTeamForWeapon( int weapon )
-{
- int i;
-
- for( i = 0; i < bg_numWeapons; i++ )
- {
- if( bg_weapons[ i ].weaponNum == weapon )
- {
- return bg_weapons[ i ].team;
- }
- }
-
- return TEAM_NONE;
+ return stages & ( 1 << stage );
}
////////////////////////////////////////////////////////////////////////////////
-upgradeAttributes_t bg_upgrades[ ] =
+static const upgradeAttributes_t bg_upgrades[ ] =
{
{
UP_LIGHTARMOUR, //int upgradeNum;
@@ -4334,7 +2465,7 @@ upgradeAttributes_t bg_upgrades[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_TORSO|SLOT_ARMS|SLOT_LEGS, //int slots;
"larmour", //char *upgradeName;
- "Light Armour", //char *upgradeHumanName;
+ "Light Armour", //char *humanName;
"Protective armour that helps to defend against light alien melee "
"attacks.",
"icons/iconu_larmour",
@@ -4348,7 +2479,7 @@ upgradeAttributes_t bg_upgrades[ ] =
( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_HEAD, //int slots;
"helmet", //char *upgradeName;
- "Helmet", //char *upgradeHumanName;
+ "Helmet", //char *humanName;
"In addition to protecting your head, the helmet provides a "
"scanner indicating the presence of any friendly or hostile "
"lifeforms and structures in your immediate vicinity.",
@@ -4363,7 +2494,7 @@ upgradeAttributes_t bg_upgrades[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_NONE, //int slots;
"medkit", //char *upgradeName;
- "Medkit", //char *upgradeHumanName;
+ "Medkit", //char *humanName;
"",
"icons/iconu_atoxin",
qfalse, //qboolean purchasable
@@ -4376,7 +2507,7 @@ upgradeAttributes_t bg_upgrades[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_BACKPACK, //int slots;
"battpack", //char *upgradeName;
- "Battery Pack", //char *upgradeHumanName;
+ "Battery Pack", //char *humanName;
"Back-mounted battery pack that permits storage of one and a half "
"times the normal energy capacity for energy weapons.",
"icons/iconu_battpack",
@@ -4390,7 +2521,7 @@ upgradeAttributes_t bg_upgrades[ ] =
( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_BACKPACK, //int slots;
"jetpack", //char *upgradeName;
- "Jet Pack", //char *upgradeHumanName;
+ "Jet Pack", //char *humanName;
"Back-mounted jet pack that enables the user to fly to remote "
"locations. It is very useful against alien spawns in hard "
"to reach spots.",
@@ -4405,7 +2536,7 @@ upgradeAttributes_t bg_upgrades[ ] =
( 1 << S3 ), //int stages
SLOT_HEAD|SLOT_TORSO|SLOT_ARMS|SLOT_LEGS|SLOT_BACKPACK, //int slots;
"bsuit", //char *upgradeName;
- "Battlesuit", //char *upgradeHumanName;
+ "Battlesuit", //char *humanName;
"A full body armour that is highly effective at repelling alien attacks. "
"It allows the user to enter hostile situations with a greater degree "
"of confidence.",
@@ -4420,7 +2551,7 @@ upgradeAttributes_t bg_upgrades[ ] =
( 1 << S2 )|( 1 << S3 ),//int stages
SLOT_NONE, //int slots;
"gren", //char *upgradeName;
- "Grenade", //char *upgradeHumanName;
+ "Grenade", //char *humanName;
"A small incendinary device ideal for damaging tightly packed "
"alien structures. Has a five second timer.",
0,
@@ -4434,7 +2565,7 @@ upgradeAttributes_t bg_upgrades[ ] =
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
SLOT_NONE, //int slots;
"ammo", //char *upgradeName;
- "Ammunition", //char *upgradeHumanName;
+ "Ammunition", //char *humanName;
"Ammunition for the currently held weapon.",
0,
qtrue, //qboolean purchasable
@@ -4445,218 +2576,58 @@ upgradeAttributes_t bg_upgrades[ ] =
int bg_numUpgrades = sizeof( bg_upgrades ) / sizeof( bg_upgrades[ 0 ] );
-/*
-==============
-BG_FindPriceForUpgrade
-==============
-*/
-int BG_FindPriceForUpgrade( int upgrade )
-{
- int i;
-
- for( i = 0; i < bg_numUpgrades; i++ )
- {
- if( bg_upgrades[ i ].upgradeNum == upgrade )
- {
- return bg_upgrades[ i ].price;
- }
- }
-
- return 100;
-}
+static const upgradeAttributes_t nullUpgrade = { 0 };
/*
==============
-BG_FindStagesForUpgrade
+BG_UpgradeByName
==============
*/
-qboolean BG_FindStagesForUpgrade( int upgrade, stage_t stage )
+const upgradeAttributes_t *BG_UpgradeByName( const char *name )
{
int i;
for( i = 0; i < bg_numUpgrades; i++ )
{
- if( bg_upgrades[ i ].upgradeNum == upgrade )
+ if( !Q_stricmp( bg_upgrades[ i ].name, name ) )
{
- if( bg_upgrades[ i ].stages & ( 1 << stage ) )
- return qtrue;
- else
- return qfalse;
+ return &bg_upgrades[ i ];
}
}
- return qfalse;
+ return &nullUpgrade;
}
/*
==============
-BG_FindSlotsForUpgrade
+BG_Upgrade
==============
*/
-int BG_FindSlotsForUpgrade( int upgrade )
+const upgradeAttributes_t *BG_Upgrade( upgrade_t upgrade )
{
int i;
for( i = 0; i < bg_numUpgrades; i++ )
{
- if( bg_upgrades[ i ].upgradeNum == upgrade )
+ if( bg_upgrades[ i ].number == upgrade )
{
- return bg_upgrades[ i ].slots;
+ return &bg_upgrades[ i ];
}
}
- return SLOT_NONE;
-}
-
-/*
-==============
-BG_FindNameForUpgrade
-==============
-*/
-char *BG_FindNameForUpgrade( int upgrade )
-{
- int i;
-
- for( i = 0; i < bg_numUpgrades; i++ )
- {
- if( bg_upgrades[ i ].upgradeNum == upgrade )
- return bg_upgrades[ i ].upgradeName;
- }
-
- //wimp out
- return 0;
-}
-
-/*
-==============
-BG_FindUpgradeNumForName
-==============
-*/
-int BG_FindUpgradeNumForName( char *name )
-{
- int i;
-
- for( i = 0; i < bg_numUpgrades; i++ )
- {
- if( !Q_stricmp( bg_upgrades[ i ].upgradeName, name ) )
- return bg_upgrades[ i ].upgradeNum;
- }
-
- //wimp out
- return UP_NONE;
-}
-
-/*
-==============
-BG_FindHumanNameForUpgrade
-==============
-*/
-char *BG_FindHumanNameForUpgrade( int upgrade )
-{
- int i;
-
- for( i = 0; i < bg_numUpgrades; i++ )
- {
- if( bg_upgrades[ i ].upgradeNum == upgrade )
- return bg_upgrades[ i ].upgradeHumanName;
- }
-
- //wimp out
- return 0;
-}
-
-/*
-==============
-BG_FindInfoForUpgrade
-==============
-*/
-char *BG_FindInfoForUpgrade( int upgrade )
-{
- int i;
-
- for( i = 0; i < bg_numUpgrades; i++ )
- {
- if( bg_upgrades[ i ].upgradeNum == upgrade )
- return bg_upgrades[ i ].info;
- }
-
- //wimp out
- return 0;
+ return &nullUpgrade;
}
/*
==============
-BG_FindIconForUpgrade
+BG_UpgradeAllowedInStage
==============
*/
-char *BG_FindIconForUpgrade( int upgrade )
+qboolean BG_UpgradeAllowedInStage( upgrade_t upgrade, stage_t stage )
{
- int i;
+ int stages = BG_Upgrade( upgrade )->stages;
- for( i = 0; i < bg_numUpgrades; i++ )
- {
- if( bg_upgrades[ i ].upgradeNum == upgrade )
- return bg_upgrades[ i ].icon;
- }
-
- //wimp out
- return 0;
-}
-
-/*
-==============
-BG_FindPurchasableForUpgrade
-==============
-*/
-qboolean BG_FindPurchasableForUpgrade( int upgrade )
-{
- int i;
-
- for( i = 0; i < bg_numUpgrades; i++ )
- {
- if( bg_upgrades[ i ].upgradeNum == upgrade )
- return bg_upgrades[ i ].purchasable;
- }
-
- return qfalse;
-}
-
-/*
-==============
-BG_FindUsableForUpgrade
-==============
-*/
-qboolean BG_FindUsableForUpgrade( int upgrade )
-{
- int i;
-
- for( i = 0; i < bg_numUpgrades; i++ )
- {
- if( bg_upgrades[ i ].upgradeNum == upgrade )
- return bg_upgrades[ i ].usable;
- }
-
- return qfalse;
-}
-
-/*
-==============
-BG_FindTeamForUpgrade
-==============
-*/
-team_t BG_FindTeamForUpgrade( int upgrade )
-{
- int i;
-
- for( i = 0; i < bg_numUpgrades; i++ )
- {
- if( bg_upgrades[ i ].upgradeNum == upgrade )
- {
- return bg_upgrades[ i ].team;
- }
- }
-
- return TEAM_NONE;
+ return stages & ( 1 << stage );
}
////////////////////////////////////////////////////////////////////////////////
@@ -5137,7 +3108,8 @@ qboolean BG_WeaponIsFull( weapon_t weapon, int stats[ ], int ammo, int clips )
{
int maxAmmo, maxClips;
- BG_FindAmmoForWeapon( weapon, &maxAmmo, &maxClips );
+ maxAmmo = BG_Weapon( weapon )->maxAmmo;
+ maxClips = BG_Weapon( weapon )->maxClips;
if( BG_InventoryContainsUpgrade( UP_BATTPACK, stats ) )
maxAmmo *= BATTPACK_MODIFIER;
@@ -5159,10 +3131,10 @@ void BG_AddWeaponToInventory( int weapon, int stats[ ] )
else
stats[ STAT_WEAPONS2 ] |= 1 << ( weapon - 16 );
- if( stats[ STAT_SLOTS ] & BG_FindSlotsForWeapon( weapon ) )
+ if( stats[ STAT_SLOTS ] & BG_Weapon( weapon )->slots )
Com_Printf( S_COLOR_YELLOW "WARNING: Held items conflict with weapon %d\n", weapon );
- stats[ STAT_SLOTS ] |= BG_FindSlotsForWeapon( weapon );
+ stats[ STAT_SLOTS ] |= BG_Weapon( weapon )->slots;
}
/*
@@ -5179,7 +3151,7 @@ void BG_RemoveWeaponFromInventory( int weapon, int stats[ ] )
else
stats[ STAT_WEAPONS2 ] &= ~( 1 << ( weapon - 16 ) );
- stats[ STAT_SLOTS ] &= ~BG_FindSlotsForWeapon( weapon );
+ stats[ STAT_SLOTS ] &= ~BG_Weapon( weapon )->slots;
}
/*
@@ -5209,10 +3181,10 @@ void BG_AddUpgradeToInventory( int item, int stats[ ] )
{
stats[ STAT_ITEMS ] |= ( 1 << item );
- if( stats[ STAT_SLOTS ] & BG_FindSlotsForUpgrade( item ) )
+ if( stats[ STAT_SLOTS ] & BG_Upgrade( item )->slots )
Com_Printf( S_COLOR_YELLOW "WARNING: Held items conflict with upgrade %d\n", item );
- stats[ STAT_SLOTS ] |= BG_FindSlotsForUpgrade( item );
+ stats[ STAT_SLOTS ] |= BG_Upgrade( item )->slots;
}
/*
@@ -5226,7 +3198,7 @@ void BG_RemoveUpgradeFromInventory( int item, int stats[ ] )
{
stats[ STAT_ITEMS ] &= ~( 1 << item );
- stats[ STAT_SLOTS ] &= ~BG_FindSlotsForUpgrade( item );
+ stats[ STAT_SLOTS ] &= ~BG_Upgrade( item )->slots;
}
/*
@@ -5368,7 +3340,7 @@ void BG_PositionBuildableRelativeToPlayer( const playerState_t *ps,
VectorCopy( ps->viewangles, angles );
VectorCopy( ps->origin, playerOrigin );
- buildDist = BG_FindBuildDistForClass( ps->stats[ STAT_CLASS ] );
+ buildDist = BG_Class( ps->stats[ STAT_CLASS ] )->buildDist;
AngleVectors( angles, forward, NULL, NULL );
ProjectPointOnPlane( forward, forward, playerNormal );
@@ -5402,17 +3374,22 @@ int BG_GetValueOfPlayer( playerState_t *ps )
{
int i, worth = 0;
- worth = BG_FindValueOfClass( ps->stats[ STAT_CLASS] );
+ worth = BG_Class( ps->stats[ STAT_CLASS ] )->value;
// Humans have worth from their equipment as well
if( ps->stats[ STAT_TEAM ] == TEAM_HUMANS )
{
for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ )
+ {
if( BG_InventoryContainsUpgrade( i, ps->stats ) )
- worth += BG_FindPriceForUpgrade( i );
+ worth += BG_Upgrade( i )->price;
+ }
+
for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ )
+ {
if( BG_InventoryContainsWeapon( i, ps->stats ) )
- worth += BG_FindPriceForWeapon( i );
+ worth += BG_Weapon( i )->price;
+ }
}
return worth;
@@ -5482,7 +3459,7 @@ qboolean BG_HasEnergyWeapon( playerState_t *ps )
for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ )
{
if( !BG_InventoryContainsWeapon( i, ps->stats ) ||
- !BG_FindUsesEnergyForWeapon( i ) )
+ !BG_Weapon( i )->usesEnergy )
continue;
return qtrue;
@@ -5561,10 +3538,10 @@ void BG_ParseCSVEquipmentList( const char *string, weapon_t *weapons, int weapon
q++;
if( weaponsSize )
- weapons[ i ] = BG_FindWeaponNumForName( q );
+ weapons[ i ] = BG_WeaponByName( q )->number;
if( upgradesSize )
- upgrades[ j ] = BG_FindUpgradeNumForName( q );
+ upgrades[ j ] = BG_UpgradeByName( q )->number;
if( weaponsSize && weapons[ i ] == WP_NONE &&
upgradesSize && upgrades[ j ] == UP_NONE )
@@ -5624,7 +3601,7 @@ void BG_ParseCSVClassList( const char *string, class_t *classes, int classesSize
while( *q == ' ' )
q++;
- classes[ i ] = BG_FindClassNumForName( q );
+ classes[ i ] = BG_ClassByName( q )->number;
if( classes[ i ] == PCL_NONE )
Com_Printf( S_COLOR_YELLOW "WARNING: unknown class %s\n", q );
@@ -5674,7 +3651,7 @@ void BG_ParseCSVBuildableList( const char *string, buildable_t *buildables, int
while( *q == ' ' )
q++;
- buildables[ i ] = BG_FindClassNumForName( q );
+ buildables[ i ] = BG_ClassByName( q )->number;
if( buildables[ i ] == BA_NONE )
Com_Printf( S_COLOR_YELLOW "WARNING: unknown buildable %s\n", q );
@@ -5818,9 +3795,9 @@ qboolean BG_ClientListTest( clientList_t *list, int clientNum )
if( clientNum < 0 || clientNum >= MAX_CLIENTS || !list )
return qfalse;
if( clientNum < 32 )
- return ( ( list->lo & ( 1 << clientNum ) ) != 0 );
+ return ( ( list->lo & ( 1 << clientNum ) ) != 0 );
else
- return ( ( list->hi & ( 1 << ( clientNum - 32 ) ) ) != 0 );
+ return ( ( list->hi & ( 1 << ( clientNum - 32 ) ) ) != 0 );
}
/*
@@ -5833,7 +3810,7 @@ void BG_ClientListAdd( clientList_t *list, int clientNum )
if( clientNum < 0 || clientNum >= MAX_CLIENTS || !list )
return;
if( clientNum < 32 )
- list->lo |= ( 1 << clientNum );
+ list->lo |= ( 1 << clientNum );
else
list->hi |= ( 1 << ( clientNum - 32 ) );
}
@@ -5848,7 +3825,7 @@ void BG_ClientListRemove( clientList_t *list, int clientNum )
if( clientNum < 0 || clientNum >= MAX_CLIENTS || !list )
return;
if( clientNum < 32 )
- list->lo &= ~( 1 << clientNum );
+ list->lo &= ~( 1 << clientNum );
else
list->hi &= ~( 1 << ( clientNum - 32 ) );
}
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index 0d493858..df5e5450 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -286,8 +286,8 @@ static void PM_Friction( void )
// if getting knocked back, no friction
if( !( pm->ps->pm_flags & PMF_TIME_KNOCKBACK ) )
{
- float stopSpeed = BG_FindStopSpeedForClass( pm->ps->stats[ STAT_CLASS ] );
- float friction = BG_FindFrictionForClass( pm->ps->stats[ STAT_CLASS ] );
+ float stopSpeed = BG_Class( pm->ps->stats[ STAT_CLASS ] )->stopSpeed;
+ float friction = BG_Class( pm->ps->stats[ STAT_CLASS ] )->friction;
// when landing a dodge, extra friction
if( pm->ps->pm_flags & PMF_TIME_LAND )
@@ -449,7 +449,7 @@ static float PM_CmdScale( usercmd_t *cmd )
if( pm->ps->pm_type != PM_SPECTATOR && pm->ps->pm_type != PM_NOCLIP )
{
- if( BG_FindJumpMagnitudeForClass( pm->ps->stats[ STAT_CLASS ] ) == 0.0f )
+ if( BG_Class( pm->ps->stats[ STAT_CLASS ] )->jumpMagnitude == 0.0f )
cmd->upmove = 0;
//prevent speed distortions for non ducking classes
@@ -675,7 +675,7 @@ static qboolean PM_CheckWallJump( void )
VectorMA( dir, upFraction, refNormal, dir );
VectorNormalize( dir );
- VectorMA( pm->ps->velocity, BG_FindJumpMagnitudeForClass( pm->ps->stats[ STAT_CLASS ] ),
+ VectorMA( pm->ps->velocity, BG_Class( pm->ps->stats[ STAT_CLASS ] )->jumpMagnitude,
dir, pm->ps->velocity );
//for a long run of wall jumps the velocity can get pretty large, this caps it
@@ -713,7 +713,7 @@ static qboolean PM_CheckJump( void )
{
vec3_t normal;
- if( BG_FindJumpMagnitudeForClass( pm->ps->stats[ STAT_CLASS ] ) == 0.0f )
+ if( BG_Class( pm->ps->stats[ STAT_CLASS ] )->jumpMagnitude == 0.0f )
return qfalse;
if( BG_ClassHasAbility( pm->ps->stats[ STAT_CLASS ], SCA_WALLJUMPER ) )
@@ -770,7 +770,7 @@ static qboolean PM_CheckJump( void )
// jump away from wall
BG_GetClientNormal( pm->ps, normal );
- VectorMA( pm->ps->velocity, BG_FindJumpMagnitudeForClass( pm->ps->stats[ STAT_CLASS ] ),
+ VectorMA( pm->ps->velocity, BG_Class( pm->ps->stats[ STAT_CLASS ] )->jumpMagnitude,
normal, pm->ps->velocity );
PM_AddEvent( EV_JUMP );
@@ -903,7 +903,7 @@ static qboolean PM_CheckDodge( void )
forward[ 2 ] = 0.0f;
// Dodge magnitude is based on the jump magnitude scaled by the modifiers
- jump = BG_FindJumpMagnitudeForClass( pm->ps->stats[ STAT_CLASS ] );
+ jump = BG_Class( pm->ps->stats[ STAT_CLASS ] )->jumpMagnitude;
if( pm->cmd.rightmove && pm->cmd.forwardmove )
jump *= ( 0.5f * M_SQRT2 );
@@ -1183,7 +1183,7 @@ static void PM_AirMove( void )
// not on ground, so little effect on velocity
PM_Accelerate( wishdir, wishspeed,
- BG_FindAirAccelerationForClass( pm->ps->stats[ STAT_CLASS ] ) );
+ BG_Class( pm->ps->stats[ STAT_CLASS ] )->airAcceleration );
// we may have a ground plane that is very steep, even
// though we don't have a groundentity
@@ -1281,9 +1281,9 @@ static void PM_ClimbMove( void )
// when a player gets hit, they temporarily lose
// full control, which allows them to be moved a bit
if( ( pml.groundTrace.surfaceFlags & SURF_SLICK ) || pm->ps->pm_flags & PMF_TIME_KNOCKBACK )
- accelerate = BG_FindAirAccelerationForClass( pm->ps->stats[ STAT_CLASS ] );
+ accelerate = BG_Class( pm->ps->stats[ STAT_CLASS ] )->airAcceleration;
else
- accelerate = BG_FindAccelerationForClass( pm->ps->stats[ STAT_CLASS ] );
+ accelerate = BG_Class( pm->ps->stats[ STAT_CLASS ] )->acceleration;
PM_Accelerate( wishdir, wishspeed, accelerate );
@@ -1399,9 +1399,9 @@ static void PM_WalkMove( void )
// when a player gets hit, they temporarily lose
// full control, which allows them to be moved a bit
if( ( pml.groundTrace.surfaceFlags & SURF_SLICK ) || pm->ps->pm_flags & PMF_TIME_KNOCKBACK )
- accelerate = BG_FindAirAccelerationForClass( pm->ps->stats[ STAT_CLASS ] );
+ accelerate = BG_Class( pm->ps->stats[ STAT_CLASS ] )->airAcceleration;
else
- accelerate = BG_FindAccelerationForClass( pm->ps->stats[ STAT_CLASS ] );
+ accelerate = BG_Class( pm->ps->stats[ STAT_CLASS ] )->acceleration;
PM_Accelerate( wishdir, wishspeed, accelerate );
@@ -2410,8 +2410,9 @@ static void PM_CheckDuck (void)
vec3_t PCmins, PCmaxs, PCcmaxs;
int PCvh, PCcvh;
- BG_FindBBoxForClass( pm->ps->stats[ STAT_CLASS ], PCmins, PCmaxs, PCcmaxs, NULL, NULL );
- BG_FindViewheightForClass( pm->ps->stats[ STAT_CLASS ], &PCvh, &PCcvh );
+ BG_ClassBoundingBox( pm->ps->stats[ STAT_CLASS ], PCmins, PCmaxs, PCcmaxs, NULL, NULL );
+ PCvh = BG_ClassConfig( pm->ps->stats[ STAT_CLASS ] )->viewheight;
+ PCcvh = BG_ClassConfig( pm->ps->stats[ STAT_CLASS ] )->crouchViewheight;
if( pm->ps->persistant[ PERS_SPECSTATE ] != SPECTATOR_NOT )
PCcvh = PCvh;
@@ -2644,7 +2645,7 @@ static void PM_Footsteps( void )
}
}
- bobmove *= BG_FindBobCycleForClass( pm->ps->stats[ STAT_CLASS ] );
+ bobmove *= BG_Class( pm->ps->stats[ STAT_CLASS ] )->bobCycle;
if( pm->ps->stats[ STAT_STATE ] & SS_SPEEDBOOST )
bobmove *= HUMAN_SPRINT_MODIFIER;
@@ -3010,15 +3011,15 @@ static void PM_Weapon( void )
return;
}
- BG_FindAmmoForWeapon( pm->ps->weapon, NULL, &maxClips );
+ maxClips = BG_Weapon( pm->ps->weapon )->maxClips;
// check for out of ammo
- if( !pm->ps->ammo && !pm->ps->clips && !BG_FindInfinteAmmoForWeapon( pm->ps->weapon ) )
+ if( !pm->ps->ammo && !pm->ps->clips && !BG_Weapon( pm->ps->weapon )->infiniteAmmo )
{
if( ( pm->cmd.buttons & BUTTON_ATTACK ) ||
- ( BG_WeaponHasAltMode( pm->ps->weapon ) &&
+ ( BG_Weapon( pm->ps->weapon )->hasAltMode &&
( pm->cmd.buttons & BUTTON_ATTACK2 ) ) ||
- ( BG_WeaponHasThirdMode( pm->ps->weapon ) &&
+ ( BG_Weapon( pm->ps->weapon )->hasThirdMode &&
( pm->cmd.buttons & BUTTON_USE_HOLDABLE ) ) )
{
PM_AddEvent( EV_NOAMMO );
@@ -3039,10 +3040,10 @@ static void PM_Weapon( void )
if( maxClips > 0 )
{
pm->ps->clips--;
- BG_FindAmmoForWeapon( pm->ps->weapon, &pm->ps->ammo, NULL );
+ pm->ps->ammo = BG_Weapon( pm->ps->weapon )->maxAmmo;
}
- if( BG_FindUsesEnergyForWeapon( pm->ps->weapon ) &&
+ if( BG_Weapon( pm->ps->weapon )->usesEnergy &&
BG_InventoryContainsUpgrade( UP_BATTPACK, pm->ps->stats ) )
pm->ps->ammo *= BATTPACK_MODIFIER;
@@ -3062,7 +3063,7 @@ static void PM_Weapon( void )
PM_StartTorsoAnim( TORSO_DROP );
PM_StartWeaponAnim( WANIM_RELOAD );
- pm->ps->weaponTime += BG_FindReloadTimeForWeapon( pm->ps->weapon );
+ pm->ps->weaponTime += BG_Weapon( pm->ps->weapon )->reloadTime;
return;
}
@@ -3169,7 +3170,7 @@ static void PM_Weapon( void )
// fire events for non auto weapons
if( attack3 )
{
- if( BG_WeaponHasThirdMode( pm->ps->weapon ) )
+ if( BG_Weapon( pm->ps->weapon )->hasThirdMode )
{
//hacky special case for slowblob
if( pm->ps->weapon == WP_ALEVEL3_UPG && !pm->ps->ammo )
@@ -3180,7 +3181,7 @@ static void PM_Weapon( void )
pm->ps->generic1 = WPM_TERTIARY;
PM_AddEvent( EV_FIRE_WEAPON3 );
- addTime = BG_FindRepeatRate3ForWeapon( pm->ps->weapon );
+ addTime = BG_Weapon( pm->ps->weapon )->repeatRate3;
}
else
{
@@ -3192,11 +3193,11 @@ static void PM_Weapon( void )
}
else if( attack2 )
{
- if( BG_WeaponHasAltMode( pm->ps->weapon ) )
+ if( BG_Weapon( pm->ps->weapon )->hasAltMode )
{
pm->ps->generic1 = WPM_SECONDARY;
PM_AddEvent( EV_FIRE_WEAPON2 );
- addTime = BG_FindRepeatRate2ForWeapon( pm->ps->weapon );
+ addTime = BG_Weapon( pm->ps->weapon )->repeatRate2;
}
else
{
@@ -3210,7 +3211,7 @@ static void PM_Weapon( void )
{
pm->ps->generic1 = WPM_PRIMARY;
PM_AddEvent( EV_FIRE_WEAPON );
- addTime = BG_FindRepeatRate1ForWeapon( pm->ps->weapon );
+ addTime = BG_Weapon( pm->ps->weapon )->repeatRate1;
}
// fire events for autohit weapons
@@ -3221,14 +3222,14 @@ static void PM_Weapon( void )
case WP_ALEVEL0:
pm->ps->generic1 = WPM_PRIMARY;
PM_AddEvent( EV_FIRE_WEAPON );
- addTime = BG_FindRepeatRate1ForWeapon( pm->ps->weapon );
+ addTime = BG_Weapon( pm->ps->weapon )->repeatRate1;
break;
case WP_ALEVEL3:
case WP_ALEVEL3_UPG:
pm->ps->generic1 = WPM_SECONDARY;
PM_AddEvent( EV_FIRE_WEAPON2 );
- addTime = BG_FindRepeatRate2ForWeapon( pm->ps->weapon );
+ addTime = BG_Weapon( pm->ps->weapon )->repeatRate2;
break;
default:
@@ -3325,7 +3326,7 @@ static void PM_Weapon( void )
pm->ps->weaponstate = WEAPON_FIRING;
// take an ammo away if not infinite
- if( !BG_FindInfinteAmmoForWeapon( pm->ps->weapon ) ||
+ if( !BG_Weapon( pm->ps->weapon )->infiniteAmmo ||
( pm->ps->weapon == WP_ALEVEL3_UPG && attack3 ) )
{
// Special case for lcannon
@@ -3567,7 +3568,7 @@ void PmoveSingle( pmove_t *pmove )
// set the firing flag for continuous beam weapons
if( !(pm->ps->pm_flags & PMF_RESPAWNED) && pm->ps->pm_type != PM_INTERMISSION &&
( pm->cmd.buttons & BUTTON_ATTACK ) &&
- ( ( pm->ps->ammo > 0 || pm->ps->clips > 0 ) || BG_FindInfinteAmmoForWeapon( pm->ps->weapon ) ) )
+ ( ( pm->ps->ammo > 0 || pm->ps->clips > 0 ) || BG_Weapon( pm->ps->weapon )->infiniteAmmo ) )
pm->ps->eFlags |= EF_FIRING;
else
pm->ps->eFlags &= ~EF_FIRING;
@@ -3575,7 +3576,7 @@ void PmoveSingle( pmove_t *pmove )
// set the firing flag for continuous beam weapons
if( !(pm->ps->pm_flags & PMF_RESPAWNED) && pm->ps->pm_type != PM_INTERMISSION &&
( pm->cmd.buttons & BUTTON_ATTACK2 ) &&
- ( ( pm->ps->ammo > 0 || pm->ps->clips > 0 ) || BG_FindInfinteAmmoForWeapon( pm->ps->weapon ) ) )
+ ( ( pm->ps->ammo > 0 || pm->ps->clips > 0 ) || BG_Weapon( pm->ps->weapon )->infiniteAmmo ) )
pm->ps->eFlags |= EF_FIRING2;
else
pm->ps->eFlags &= ~EF_FIRING2;
@@ -3583,7 +3584,7 @@ void PmoveSingle( pmove_t *pmove )
// set the firing flag for continuous beam weapons
if( !(pm->ps->pm_flags & PMF_RESPAWNED) && pm->ps->pm_type != PM_INTERMISSION &&
( pm->cmd.buttons & BUTTON_USE_HOLDABLE ) &&
- ( ( pm->ps->ammo > 0 || pm->ps->clips > 0 ) || BG_FindInfinteAmmoForWeapon( pm->ps->weapon ) ) )
+ ( ( pm->ps->ammo > 0 || pm->ps->clips > 0 ) || BG_Weapon( pm->ps->weapon )->infiniteAmmo ) )
pm->ps->eFlags |= EF_FIRING3;
else
pm->ps->eFlags &= ~EF_FIRING3;
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index cdfe2467..f9527d37 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -903,31 +903,13 @@ typedef enum
// player class record
typedef struct
{
- int classNum;
+ class_t number;
- char *className;
- char *humanName;
+ char *name;
char *info;
- char *modelName;
- float modelScale;
- char *skinName;
- float shadowScale;
-
- char *hudName;
-
int stages;
- vec3_t mins;
- vec3_t maxs;
- vec3_t crouchMaxs;
- vec3_t deadMins;
- vec3_t deadMaxs;
- float zOffset;
-
- int viewheight;
- int crouchViewheight;
-
int health;
float fallDamage;
int regenRate;
@@ -973,7 +955,7 @@ typedef struct
int viewheight;
int crouchViewheight;
float zOffset;
-} classAttributeOverrides_t;
+} classConfig_t;
//stages
typedef enum
@@ -988,56 +970,49 @@ typedef enum
// buildable item record
typedef struct
{
- int buildNum;
+ buildable_t number;
- char *buildName;
- char *humanName;
- char *info;
- char *entityName;
-
- char *models[ MAX_BUILDABLE_MODELS ];
- float modelScale;
-
- vec3_t mins;
- vec3_t maxs;
- float zOffset;
+ char *name;
+ char *humanName;
+ char *info;
+ char *entityName;
- trType_t traj;
- float bounce;
+ trType_t traj;
+ float bounce;
- int buildPoints;
- int stages;
+ int buildPoints;
+ int stages;
- int health;
- int regenRate;
+ int health;
+ int regenRate;
- int splashDamage;
- int splashRadius;
+ int splashDamage;
+ int splashRadius;
- int meansOfDeath;
+ int meansOfDeath;
- int team;
- weapon_t buildWeapon;
+ team_t team;
+ weapon_t buildWeapon;
- int idleAnim;
+ int idleAnim;
- int nextthink;
- int buildTime;
- qboolean usable;
+ int nextthink;
+ int buildTime;
+ qboolean usable;
- int turretRange;
- int turretFireSpeed;
- weapon_t turretProjType;
+ int turretRange;
+ int turretFireSpeed;
+ weapon_t turretProjType;
- float minNormal;
- qboolean invertNormal;
+ float minNormal;
+ qboolean invertNormal;
- qboolean creepTest;
- int creepSize;
+ qboolean creepTest;
+ int creepSize;
- qboolean dccTest;
- qboolean transparentTest;
- qboolean reactorTest;
+ qboolean dccTest;
+ qboolean transparentTest;
+ qboolean uniqueTest;
int value;
} buildableAttributes_t;
@@ -1050,20 +1025,20 @@ typedef struct
vec3_t mins;
vec3_t maxs;
float zOffset;
-} buildableAttributeOverrides_t;
+} buildableConfig_t;
// weapon record
typedef struct
{
- int weaponNum;
+ weapon_t number;
int price;
int stages;
int slots;
- char *weaponName;
- char *weaponHumanName;
+ char *name;
+ char *humanName;
char *info;
int maxAmmo;
@@ -1092,15 +1067,15 @@ typedef struct
// upgrade record
typedef struct
{
- int upgradeNum;
+ upgrade_t number;
int price;
int stages;
int slots;
- char *upgradeName;
- char *upgradeHumanName;
+ char *name;
+ char *humanName;
char *info;
char *icon;
@@ -1135,119 +1110,44 @@ int BG_PlayerPoisonCloudTime( playerState_t *ps );
weapon_t BG_GetPlayerWeapon( playerState_t *ps );
qboolean BG_HasEnergyWeapon( playerState_t *ps );
-int BG_FindValueOfBuildable( int bclass );
-int BG_FindBuildNumForName( char *name );
-int BG_FindBuildNumForEntityName( char *name );
-char *BG_FindNameForBuildable( int bclass );
-char *BG_FindHumanNameForBuildable( int bclass );
-char *BG_FindEntityNameForBuildable( int bclass );
-char *BG_FindInfoForBuildable( int bclass );
-char *BG_FindModelsForBuildable( int bclass, int modelNum );
-float BG_FindModelScaleForBuildable( int bclass );
-void BG_FindBBoxForBuildable( int bclass, vec3_t mins, vec3_t maxs );
-float BG_FindZOffsetForBuildable( int pclass );
-int BG_FindHealthForBuildable( int bclass );
-int BG_FindRegenRateForBuildable( int bclass );
-trType_t BG_FindTrajectoryForBuildable( int bclass );
-float BG_FindBounceForBuildable( int bclass );
-int BG_FindBuildPointsForBuildable( int bclass );
-qboolean BG_FindStagesForBuildable( int bclass, stage_t stage );
-int BG_FindSplashDamageForBuildable( int bclass );
-int BG_FindSplashRadiusForBuildable( int bclass );
-int BG_FindMODForBuildable( int bclass );
-int BG_FindTeamForBuildable( int bclass );
-weapon_t BG_FindBuildWeaponForBuildable( int bclass );
-int BG_FindAnimForBuildable( int bclass );
-int BG_FindNextThinkForBuildable( int bclass );
-int BG_FindBuildTimeForBuildable( int bclass );
-qboolean BG_FindUsableForBuildable( int bclass );
-int BG_FindRangeForBuildable( int bclass );
-int BG_FindFireSpeedForBuildable( int bclass );
-weapon_t BG_FindProjTypeForBuildable( int bclass );
-float BG_FindMinNormalForBuildable( int bclass );
-qboolean BG_FindInvertNormalForBuildable( int bclass );
-int BG_FindCreepTestForBuildable( int bclass );
-int BG_FindCreepSizeForBuildable( int bclass );
-int BG_FindDCCTestForBuildable( int bclass );
-int BG_FindUniqueTestForBuildable( int bclass );
-qboolean BG_FindTransparentTestForBuildable( int bclass );
-void BG_InitBuildableOverrides( void );
-
-int BG_FindClassNumForName( char *name );
-char *BG_FindNameForClassNum( int pclass );
-char *BG_FindHumanNameForClassNum( int pclass );
-char *BG_FindInfoForClassNum( int pclass );
-char *BG_FindModelNameForClass( int pclass );
-float BG_FindModelScaleForClass( int pclass );
-char *BG_FindSkinNameForClass( int pclass );
-float BG_FindShadowScaleForClass( int pclass );
-char *BG_FindHudNameForClass( int pclass );
-qboolean BG_FindStagesForClass( int pclass, stage_t stage );
-void BG_FindBBoxForClass( int pclass, vec3_t mins, vec3_t maxs, vec3_t cmaxs, vec3_t dmins, vec3_t dmaxs );
-float BG_FindZOffsetForClass( int pclass );
-void BG_FindViewheightForClass( int pclass, int *viewheight, int *cViewheight );
-int BG_FindHealthForClass( int pclass );
-float BG_FindFallDamageForClass( int pclass );
-int BG_FindRegenRateForClass( int pclass );
-int BG_FindFovForClass( int pclass );
-float BG_FindBobForClass( int pclass );
-float BG_FindBobCycleForClass( int pclass );
-float BG_FindSpeedForClass( int pclass );
-float BG_FindAccelerationForClass( int pclass );
-float BG_FindAirAccelerationForClass( int pclass );
-float BG_FindFrictionForClass( int pclass );
-float BG_FindStopSpeedForClass( int pclass );
-float BG_FindJumpMagnitudeForClass( int pclass );
-float BG_FindKnockbackScaleForClass( int pclass );
-int BG_FindSteptimeForClass( int pclass );
-qboolean BG_ClassHasAbility( int pclass, int ability );
-weapon_t BG_FindStartWeaponForClass( int pclass );
-float BG_FindBuildDistForClass( int pclass );
-int BG_ClassCanEvolveFromTo( int fclass, int tclass, int credits, int alienStage, int num );
-qboolean BG_AlienCanEvolve( int pclass, int credits, int alienStage );
-int BG_FindCostOfClass( int pclass );
-int BG_FindValueOfClass( int pclass );
-void BG_InitClassOverrides( void );
-
-int BG_FindPriceForWeapon( int weapon );
-qboolean BG_FindStagesForWeapon( int weapon, stage_t stage );
-int BG_FindSlotsForWeapon( int weapon );
-char *BG_FindNameForWeapon( int weapon );
-int BG_FindWeaponNumForName( char *name );
-char *BG_FindHumanNameForWeapon( int weapon );
-char *BG_FindInfoForWeapon( int weapon );
-char *BG_FindModelsForWeapon( int weapon, int modelNum );
-char *BG_FindIconForWeapon( int weapon );
-char *BG_FindCrosshairForWeapon( int weapon );
-int BG_FindCrosshairSizeForWeapon( int weapon );
-void BG_FindAmmoForWeapon( int weapon, int *maxAmmo, int *maxClips );
-qboolean BG_FindInfinteAmmoForWeapon( int weapon );
-qboolean BG_FindUsesEnergyForWeapon( int weapon );
-int BG_FindRepeatRate1ForWeapon( int weapon );
-int BG_FindRepeatRate2ForWeapon( int weapon );
-int BG_FindRepeatRate3ForWeapon( int weapon );
-int BG_FindReloadTimeForWeapon( int weapon );
-float BG_FindKnockbackScaleForWeapon( int weapon );
-qboolean BG_WeaponHasAltMode( int weapon );
-qboolean BG_WeaponHasThirdMode( int weapon );
-qboolean BG_WeaponCanZoom( int weapon );
-float BG_FindZoomFovForWeapon( int weapon );
-qboolean BG_FindPurchasableForWeapon( int weapon );
-qboolean BG_FindLongRangedForWeapon( int weapon );
-int BG_FindBuildDelayForWeapon( int weapon );
-team_t BG_FindTeamForWeapon( int weapon );
-
-int BG_FindPriceForUpgrade( int upgrade );
-qboolean BG_FindStagesForUpgrade( int upgrade, stage_t stage );
-int BG_FindSlotsForUpgrade( int upgrade );
-char *BG_FindNameForUpgrade( int upgrade );
-int BG_FindUpgradeNumForName( char *name );
-char *BG_FindHumanNameForUpgrade( int upgrade );
-char *BG_FindInfoForUpgrade( int upgrade );
-char *BG_FindIconForUpgrade( int upgrade );
-qboolean BG_FindPurchasableForUpgrade( int upgrade );
-qboolean BG_FindUsableForUpgrade( int upgrade );
-team_t BG_FindTeamForUpgrade( int upgrade );
+const buildableAttributes_t *BG_BuildableByName( const char *name );
+const buildableAttributes_t *BG_BuildableByEntityName( const char *name );
+const buildableAttributes_t *BG_Buildable( buildable_t buildable );
+qboolean BG_BuildableAllowedInStage( buildable_t buildable,
+ stage_t stage );
+
+buildableConfig_t *BG_BuildableConfig( buildable_t buildable );
+void BG_BuildableBoundingBox( buildable_t buildable,
+ vec3_t mins, vec3_t maxs );
+void BG_InitBuildableConfigs( void );
+
+const classAttributes_t *BG_ClassByName( const char *name );
+const classAttributes_t *BG_Class( class_t class );
+qboolean BG_ClassAllowedInStage( class_t class,
+ stage_t stage );
+
+classConfig_t *BG_ClassConfig( class_t class );
+
+void BG_ClassBoundingBox( class_t class, vec3_t mins,
+ vec3_t maxs, vec3_t cmaxs,
+ vec3_t dmins, vec3_t dmaxs );
+qboolean BG_ClassHasAbility( class_t class, int ability );
+int BG_ClassCanEvolveFromTo( class_t fclass,
+ class_t tclass,
+ int credits, int alienStage, int num );
+qboolean BG_AlienCanEvolve( class_t class, int credits, int alienStage );
+
+void BG_InitClassConfigs( void );
+
+const weaponAttributes_t *BG_WeaponByName( const char *name );
+const weaponAttributes_t *BG_Weapon( weapon_t weapon );
+qboolean BG_WeaponAllowedInStage( weapon_t weapon,
+ stage_t stage );
+
+const upgradeAttributes_t *BG_UpgradeByName( const char *name );
+const upgradeAttributes_t *BG_Upgrade( upgrade_t upgrade );
+qboolean BG_UpgradeAllowedInStage( upgrade_t upgrade,
+ stage_t stage );
// content masks
#define MASK_ALL (-1)
diff --git a/src/game/g_active.c b/src/game/g_active.c
index dc681996..7b03ce0f 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -201,7 +201,7 @@ static int GetClientMass( gentity_t *ent )
int entMass = 75;
if( ent->client->pers.teamSelection == TEAM_ALIENS )
- entMass = BG_FindHealthForClass( ent->client->pers.classSelection );
+ entMass = BG_Class( ent->client->pers.classSelection )->health;
else if( ent->client->pers.teamSelection == TEAM_HUMANS )
{
if( BG_InventoryContainsUpgrade( UP_BATTLESUIT, ent->client->ps.stats ) )
@@ -333,7 +333,7 @@ void G_TouchTriggers( gentity_t *ent )
if( ent->client->ps.stats[ STAT_HEALTH ] <= 0 )
return;
- BG_FindBBoxForClass( ent->client->ps.stats[ STAT_CLASS ],
+ BG_ClassBoundingBox( ent->client->ps.stats[ STAT_CLASS ],
pmins, pmaxs, NULL, NULL, NULL );
VectorAdd( ent->client->ps.origin, pmins, mins );
@@ -464,7 +464,7 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd )
if( queued )
client->ps.pm_flags |= PMF_QUEUED;
- client->ps.speed = BG_FindSpeedForClass( client->ps.stats[ STAT_CLASS ] );
+ client->ps.speed = BG_Class( client->ps.stats[ STAT_CLASS ] )->speed;
client->ps.stats[ STAT_STAMINA ] = 0;
client->ps.stats[ STAT_MISC ] = 0;
client->ps.stats[ STAT_BUILDABLE ] = 0;
@@ -634,7 +634,7 @@ void ClientTimerActions( gentity_t *ent, int msec )
// Set validity bit on buildable
if( ( client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) > BA_NONE )
{
- int dist = BG_FindBuildDistForClass( ent->client->ps.stats[ STAT_CLASS ] );
+ int dist = BG_Class( ent->client->ps.stats[ STAT_CLASS ] )->buildDist;
vec3_t dummy;
if( G_CanBuild( ent, client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT,
@@ -783,14 +783,14 @@ void ClientTimerActions( gentity_t *ent, int msec )
if( ( ent->lastRegenTime + ALIEN_REGEN_NOCREEP_TIME ) < level.time )
{
ent->health +=
- BG_FindRegenRateForClass( client->ps.stats[ STAT_CLASS ] );
+ BG_Class( client->ps.stats[ STAT_CLASS ] )->regenRate;
ent->lastRegenTime = level.time;
}
}
else
{
ent->health += modifier *
- BG_FindRegenRateForClass( client->ps.stats[ STAT_CLASS ] );
+ BG_Class( client->ps.stats[ STAT_CLASS ] )->regenRate;
ent->lastRegenTime = level.time;
}
}
@@ -804,7 +804,7 @@ void ClientTimerActions( gentity_t *ent, int msec )
level.surrenderTeam == TEAM_ALIENS )
{
G_Damage( ent, NULL, NULL, NULL, NULL,
- BG_FindRegenRateForClass( client->ps.stats[ STAT_CLASS ] ),
+ BG_Class( client->ps.stats[ STAT_CLASS ] )->regenRate,
DAMAGE_NO_ARMOR, MOD_SUICIDE );
}
else if( client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS &&
@@ -819,7 +819,7 @@ void ClientTimerActions( gentity_t *ent, int msec )
{
int maxAmmo;
- BG_FindAmmoForWeapon( WP_ALEVEL3_UPG, &maxAmmo, NULL );
+ maxAmmo = BG_Weapon( WP_ALEVEL3_UPG )->maxAmmo;
if( client->ps.ammo < maxAmmo )
{
@@ -898,11 +898,11 @@ void ClientEvents( gentity_t *ent, int oldEventSequence )
else if( fallDistance > 1.0f )
fallDistance = 1.0f;
- damage = (int)( (float)BG_FindHealthForClass( class ) *
- BG_FindFallDamageForClass( class ) * fallDistance );
+ damage = (int)( (float)BG_Class( class )->health *
+ BG_Class( class )->fallDamage * fallDistance );
VectorSet( dir, 0, 0, 1 );
- BG_FindBBoxForClass( class, mins, NULL, NULL, NULL, NULL );
+ BG_ClassBoundingBox( class, mins, NULL, NULL, NULL, NULL );
mins[ 0 ] = mins[ 1 ] = 0.0f;
VectorAdd( client->ps.origin, mins, point );
@@ -1482,7 +1482,7 @@ void ClientThink_real( gentity_t *ent )
}
// set speed
- client->ps.speed = g_speed.value * BG_FindSpeedForClass( client->ps.stats[ STAT_CLASS ] );
+ client->ps.speed = g_speed.value * BG_Class( client->ps.stats[ STAT_CLASS ] )->speed;
if( client->lastCreepSlowTime + CREEP_TIMEOUT < level.time )
client->ps.stats[ STAT_STATE ] &= ~SS_CREEPSLOWED;
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 1e575a93..c4b1f120 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -73,7 +73,7 @@ gentity_t *G_CheckSpawnPoint( int spawnNum, vec3_t origin, vec3_t normal,
vec3_t localOrigin;
trace_t tr;
- BG_FindBBoxForBuildable( spawn, mins, maxs );
+ BG_BuildableBoundingBox( spawn, mins, maxs );
if( spawn == BA_A_SPAWN )
{
@@ -102,7 +102,7 @@ gentity_t *G_CheckSpawnPoint( int spawnNum, vec3_t origin, vec3_t normal,
}
else if( spawn == BA_H_SPAWN )
{
- BG_FindBBoxForClass( PCL_HUMAN, cmins, cmaxs, NULL, NULL, NULL );
+ BG_ClassBoundingBox( PCL_HUMAN, cmins, cmaxs, NULL, NULL, NULL );
VectorCopy( origin, localOrigin );
localOrigin[ 2 ] += maxs[ 2 ] + fabs( cmins[ 2 ] ) + 1.0f;
@@ -472,7 +472,7 @@ static void G_CreepSlow( gentity_t *self )
int i, num;
gentity_t *enemy;
buildable_t buildable = self->s.modelindex;
- float creepSize = (float)BG_FindCreepSizeForBuildable( buildable );
+ float creepSize = (float)BG_Buildable( buildable )->creepSize;
VectorSet( range, creepSize, creepSize, creepSize );
@@ -541,7 +541,7 @@ void AGeneric_CreepRecede( gentity_t *self )
self->s.time = -( level.time -
(int)( (float)CREEP_SCALEDOWN_TIME *
( 1.0f - ( (float)( level.time - self->buildTime ) /
- (float)BG_FindBuildTimeForBuildable( self->s.modelindex ) ) ) ) );
+ (float)BG_Buildable( self->s.modelindex )->buildTime ) ) ) );
}
//creep is still receeding
@@ -609,12 +609,12 @@ void AGeneric_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, i
!self->deconstruct )
G_TeamCommand( TEAM_ALIENS,
va( "print \"%s ^3DESTROYED^7 by teammate %s^7\n\"",
- BG_FindHumanNameForBuildable( self->s.modelindex ),
+ BG_Buildable( self->s.modelindex )->humanName,
attacker->client->pers.netname ) );
G_LogPrintf( "Decon: %i %i %i: %s destroyed %s by %s\n",
attacker->client->ps.clientNum, self->s.modelindex, mod,
attacker->client->pers.netname,
- BG_FindNameForBuildable( self->s.modelindex ),
+ BG_Buildable( self->s.modelindex )->name,
modNames[ mod ] );
}
}
@@ -653,7 +653,7 @@ A generic think function for Alien buildables
void AGeneric_Think( gentity_t *self )
{
self->powered = G_IsOvermindBuilt( );
- self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
+ self->nextthink = level.time + BG_Buildable( self->s.modelindex )->nextthink;
AGeneric_CreepCheck( self );
}
@@ -741,7 +741,7 @@ void ASpawn_Think( gentity_t *self )
G_CreepSlow( self );
- self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
+ self->nextthink = level.time + BG_Buildable( self->s.modelindex )->nextthink;
}
@@ -839,7 +839,7 @@ void AOvermind_Think( gentity_t *self )
G_CreepSlow( self );
- self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
+ self->nextthink = level.time + BG_Buildable( self->s.modelindex )->nextthink;
}
@@ -897,11 +897,13 @@ void ABarricade_Shrink( gentity_t *self, qboolean shrink )
}
return;
}
- if ( !shrink &&
- ( !self->shrunkTime ||
- level.time < self->shrunkTime + BARRICADE_SHRINKTIMEOUT ) )
+
+ if ( !shrink && ( !self->shrunkTime ||
+ level.time < self->shrunkTime + BARRICADE_SHRINKTIMEOUT ) )
return;
- BG_FindBBoxForBuildable( BA_A_BARRICADE, self->r.mins, self->r.maxs );
+
+ BG_BuildableBoundingBox( BA_A_BARRICADE, self->r.mins, self->r.maxs );
+
if ( shrink )
{
self->r.maxs[ 2 ] = (int)( self->r.maxs[ 2 ] * BARRICADE_SHRINKPROP );
@@ -933,7 +935,7 @@ void ABarricade_Shrink( gentity_t *self, qboolean shrink )
if ( self->spawned && self->health > 0 &&
anim != BANIM_CONSTRUCT1 && anim != BANIM_CONSTRUCT2 )
{
- G_SetIdleBuildableAnim( self, BG_FindAnimForBuildable( BA_A_BARRICADE ) );
+ G_SetIdleBuildableAnim( self, BG_Buildable( BA_A_BARRICADE )->idleAnim );
G_SetBuildableAnim( self, BANIM_ATTACK2, qtrue );
}
}
@@ -1017,7 +1019,7 @@ void AAcidTube_Think( gentity_t *self )
gentity_t *enemy;
self->powered = G_IsOvermindBuilt( );
- self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
+ self->nextthink = level.time + BG_Buildable( self->s.modelindex )->nextthink;
VectorAdd( self->s.origin, range, maxs );
VectorSubtract( self->s.origin, range, mins );
@@ -1108,7 +1110,7 @@ Think function for Alien Hive
void AHive_Think( gentity_t *self )
{
self->powered = G_IsOvermindBuilt( );
- self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
+ self->nextthink = level.time + BG_Buildable( self->s.modelindex )->nextthink;
AGeneric_CreepCheck( self );
@@ -1204,8 +1206,8 @@ qboolean AHovel_Blocked( gentity_t *hovel, gentity_t *player, qboolean provideEx
float displacement;
trace_t tr;
- BG_FindBBoxForBuildable( BA_A_HOVEL, NULL, hovelMaxs );
- BG_FindBBoxForClass( player->client->ps.stats[ STAT_CLASS ],
+ BG_BuildableBoundingBox( BA_A_HOVEL, NULL, hovelMaxs );
+ BG_ClassBoundingBox( player->client->ps.stats[ STAT_CLASS ],
mins, maxs, NULL, NULL, NULL );
VectorCopy( hovel->s.origin2, normal );
@@ -1439,11 +1441,11 @@ void ATrapper_FireOnEnemy( gentity_t *self, int firespeed, float range )
gentity_t *enemy = self->enemy;
vec3_t dirToTarget;
vec3_t halfAcceleration, thirdJerk;
- float distanceToTarget = BG_FindRangeForBuildable( self->s.modelindex );
+ float distanceToTarget = BG_Buildable( self->s.modelindex )->turretRange;
int lowMsec = 0;
int highMsec = (int)( (
( ( distanceToTarget * LOCKBLOB_SPEED ) +
- ( distanceToTarget * BG_FindSpeedForClass( enemy->client->ps.stats[ STAT_CLASS ] ) ) ) /
+ ( distanceToTarget * BG_Class( enemy->client->ps.stats[ STAT_CLASS ] )->speed ) ) /
( LOCKBLOB_SPEED * LOCKBLOB_SPEED ) ) * 1000.0f );
VectorScale( enemy->acceleration, 1.0f / 2.0f, halfAcceleration );
@@ -1561,11 +1563,11 @@ think function for Alien Defense
*/
void ATrapper_Think( gentity_t *self )
{
- int range = BG_FindRangeForBuildable( self->s.modelindex );
- int firespeed = BG_FindFireSpeedForBuildable( self->s.modelindex );
+ int range = BG_Buildable( self->s.modelindex )->turretRange;
+ int firespeed = BG_Buildable( self->s.modelindex )->turretFireSpeed;
self->powered = G_IsOvermindBuilt( );
- self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
+ self->nextthink = level.time + BG_Buildable( self->s.modelindex )->nextthink;
AGeneric_CreepCheck( self );
@@ -1829,7 +1831,7 @@ void HMedistat_Think( gentity_t *self )
gentity_t *player;
qboolean occupied = qfalse;
- self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
+ self->nextthink = level.time + BG_Buildable( self->s.modelindex )->nextthink;
//clear target's healing flag
if( self->enemy && self->enemy->client )
@@ -2093,7 +2095,7 @@ Think function for MG turret
void HMGTurret_Think( gentity_t *self )
{
self->nextthink = level.time +
- BG_FindNextThinkForBuildable( self->s.modelindex );
+ BG_Buildable( self->s.modelindex )->nextthink;
// Turn off client side muzzle flashes
self->s.eFlags &= ~EF_FIRING;
@@ -2144,7 +2146,7 @@ void HMGTurret_Think( gentity_t *self )
FireWeapon( self );
self->s.eFlags |= EF_FIRING;
- self->count = level.time + BG_FindFireSpeedForBuildable( self->s.modelindex );
+ self->count = level.time + BG_Buildable( self->s.modelindex )->turretFireSpeed;
G_AddEvent( self, EV_FIRE_WEAPON, 0 );
G_SetBuildableAnim( self, BANIM_ATTACK1, qfalse );
}
@@ -2166,7 +2168,7 @@ Think function for Tesla Generator
*/
void HTeslaGen_Think( gentity_t *self )
{
- self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
+ self->nextthink = level.time + BG_Buildable( self->s.modelindex )->nextthink;
//if not powered don't do anything and check again for power next think
if( !( self->powered = G_FindPower( self ) ) )
@@ -2314,12 +2316,12 @@ void HSpawn_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
!self->deconstruct )
G_TeamCommand( TEAM_HUMANS,
va( "print \"%s ^3DESTROYED^7 by teammate %s^7\n\"",
- BG_FindHumanNameForBuildable( self->s.modelindex ),
+ BG_Buildable( self->s.modelindex )->humanName,
attacker->client->pers.netname ) );
G_LogPrintf( "Decon: %i %i %i: %s destroyed %s by %s\n",
attacker->client->ps.clientNum, self->s.modelindex, mod,
attacker->client->pers.netname,
- BG_FindNameForBuildable( self->s.modelindex ),
+ BG_Buildable( self->s.modelindex )->name,
modNames[ mod ] );
}
}
@@ -2359,7 +2361,7 @@ void HSpawn_Think( gentity_t *self )
}
}
- self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
+ self->nextthink = level.time + BG_Buildable( self->s.modelindex )->nextthink;
}
@@ -2389,7 +2391,7 @@ void G_BuildableTouchTriggers( gentity_t *ent )
if( ent->health <= 0 )
return;
- BG_FindBBoxForBuildable( ent->s.modelindex, bmins, bmaxs );
+ BG_BuildableBoundingBox( ent->s.modelindex, bmins, bmaxs );
VectorAdd( ent->s.origin, bmins, mins );
VectorAdd( ent->s.origin, bmaxs, maxs );
@@ -2436,9 +2438,9 @@ General think function for buildables
*/
void G_BuildableThink( gentity_t *ent, int msec )
{
- int bHealth = BG_FindHealthForBuildable( ent->s.modelindex );
- int bRegen = BG_FindRegenRateForBuildable( ent->s.modelindex );
- int bTime = BG_FindBuildTimeForBuildable( ent->s.modelindex );
+ int bHealth = BG_Buildable( ent->s.modelindex )->health;
+ int bRegen = BG_Buildable( ent->s.modelindex )->regenRate;
+ int bTime = BG_Buildable( ent->s.modelindex )->buildTime;
//toggle spawned flag for buildables
if( !ent->spawned && ent->health > 0 )
@@ -2585,11 +2587,11 @@ static qboolean G_BuildablesIntersect( buildable_t a, vec3_t originA,
vec3_t minsA, maxsA;
vec3_t minsB, maxsB;
- BG_FindBBoxForBuildable( a, minsA, maxsA );
+ BG_BuildableBoundingBox( a, minsA, maxsA );
VectorAdd( minsA, originA, minsA );
VectorAdd( maxsA, originA, maxsA );
- BG_FindBBoxForBuildable( b, minsB, maxsB );
+ BG_BuildableBoundingBox( b, minsB, maxsB );
VectorAdd( minsB, originB, minsB );
VectorAdd( maxsB, originB, maxsB );
@@ -2725,8 +2727,8 @@ static itemBuildError_t G_SufficientBPAvailable( buildable_t buildable,
int numBuildables = 0;
int pointsYielded = 0;
gentity_t *ent;
- team_t team = BG_FindTeamForBuildable( buildable );
- int buildPoints = BG_FindBuildPointsForBuildable( buildable );
+ team_t team = BG_Buildable( buildable )->team;
+ int buildPoints = BG_Buildable( buildable )->buildPoints;
int remainingBP, remainingSpawns;
qboolean collision = qfalse;
int collisionCount = 0;
@@ -2853,14 +2855,14 @@ static itemBuildError_t G_SufficientBPAvailable( buildable_t buildable,
if( repeaterInRange )
repeaterInRangeCount--;
- pointsYielded += BG_FindBuildPointsForBuildable( ent->s.modelindex );
+ pointsYielded += BG_Buildable( ent->s.modelindex )->buildPoints;
level.numBuildablesForRemoval++;
}
- else if( BG_FindUniqueTestForBuildable( ent->s.modelindex ) &&
+ else if( BG_Buildable( ent->s.modelindex )->uniqueTest &&
ent->s.modelindex == buildable )
{
// If it's a unique buildable, it must be replaced by the same type
- pointsYielded += BG_FindBuildPointsForBuildable( ent->s.modelindex );
+ pointsYielded += BG_Buildable( ent->s.modelindex )->buildPoints;
level.numBuildablesForRemoval++;
}
}
@@ -2889,7 +2891,7 @@ static itemBuildError_t G_SufficientBPAvailable( buildable_t buildable,
level.numBuildablesForRemoval++ )
{
ent = level.markedBuildables[ level.numBuildablesForRemoval ];
- pointsYielded += BG_FindBuildPointsForBuildable( ent->s.modelindex );
+ pointsYielded += BG_Buildable( ent->s.modelindex )->buildPoints;
}
for( i = 0; i < level.numBuildablesForRemoval; i++ )
@@ -2957,7 +2959,7 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance
// Stop all buildables from interacting with traces
G_SetBuildableLinkState( qfalse );
- BG_FindBBoxForBuildable( buildable, mins, maxs );
+ BG_BuildableBoundingBox( buildable, mins, maxs );
BG_PositionBuildableRelativeToPlayer( ps, mins, maxs, trap_Trace, entity_origin, angles, &tr1 );
trap_Trace( &tr2, entity_origin, mins, maxs, entity_origin, ent->s.number, MASK_PLAYERSOLID );
@@ -2966,8 +2968,8 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance
VectorCopy( entity_origin, origin );
VectorCopy( tr1.plane.normal, normal );
- minNormal = BG_FindMinNormalForBuildable( buildable );
- invert = BG_FindInvertNormalForBuildable( buildable );
+ minNormal = BG_Buildable( buildable )->minNormal;
+ invert = BG_Buildable( buildable )->invertNormal;
//can we build at this angle?
if( !( normal[ 2 ] >= minNormal || ( invert && normal[ 2 ] <= -minNormal ) ) )
@@ -2981,7 +2983,7 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance
reason = IBE_NORMAL;
contents = trap_PointContents( entity_origin, -1 );
- buildPoints = BG_FindBuildPointsForBuildable( buildable );
+ buildPoints = BG_Buildable( buildable )->buildPoints;
if( ent->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS )
{
@@ -2997,7 +2999,7 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance
}
//check there is creep near by for building on
- if( BG_FindCreepTestForBuildable( buildable ) )
+ if( BG_Buildable( buildable )->creepTest )
{
if( !G_IsCreepHere( entity_origin ) )
reason = IBE_NOCREEP;
@@ -3008,7 +3010,7 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance
vec3_t builderMins, builderMaxs;
//this assumes the adv builder is the biggest thing that'll use the hovel
- BG_FindBBoxForClass( PCL_ALIEN_BUILDER0_UPG, builderMins, builderMaxs, NULL, NULL, NULL );
+ BG_ClassBoundingBox( PCL_ALIEN_BUILDER0_UPG, builderMins, builderMaxs, NULL, NULL, NULL );
if( APropHovel_Blocked( angles, origin, normal, ent ) )
reason = IBE_HOVELEXIT;
@@ -3031,7 +3033,7 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance
}
//this buildable requires a DCC
- if( BG_FindDCCTestForBuildable( buildable ) && !G_IsDCCBuilt( ) )
+ if( BG_Buildable( buildable )->dccTest && !G_IsDCCBuilt( ) )
reason = IBE_NODCC;
//check that there is a parent reactor when building a repeater
@@ -3057,7 +3059,7 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance
reason = IBE_PERMISSION;
// Can we only have one of these?
- if( BG_FindUniqueTestForBuildable( buildable ) )
+ if( BG_Buildable( buildable )->uniqueTest )
{
tempent = G_FindBuildable( buildable );
if( tempent && !tempent->deconstruct )
@@ -3119,10 +3121,10 @@ static gentity_t *G_Build( gentity_t *builder, buildable_t buildable, vec3_t ori
built = G_Spawn();
built->s.eType = ET_BUILDABLE;
built->killedBy = ENTITYNUM_NONE;
- built->classname = BG_FindEntityNameForBuildable( buildable );
+ built->classname = BG_Buildable( buildable )->entityName;
built->s.modelindex = buildable;
- built->buildableTeam = built->s.modelindex2 = BG_FindTeamForBuildable( buildable );
- BG_FindBBoxForBuildable( buildable, built->r.mins, built->r.maxs );
+ built->buildableTeam = built->s.modelindex2 = BG_Buildable( buildable )->team;
+ BG_BuildableBoundingBox( buildable, built->r.mins, built->r.maxs );
// detect the buildable's normal vector
if( !builder->client )
@@ -3135,7 +3137,7 @@ static gentity_t *G_Build( gentity_t *builder, buildable_t buildable, vec3_t ori
{
VectorCopy( builder->s.origin2, normal );
}
- else if( BG_FindTrajectoryForBuildable( buildable ) == TR_BUOYANCY )
+ else if( BG_Buildable( buildable )->traj == TR_BUOYANCY )
VectorSet( normal, 0.0f, 0.0f, -1.0f );
else
VectorSet( normal, 0.0f, 0.0f, 1.0f );
@@ -3153,11 +3155,11 @@ static gentity_t *G_Build( gentity_t *builder, buildable_t buildable, vec3_t ori
built->health = 1;
- built->splashDamage = BG_FindSplashDamageForBuildable( buildable );
- built->splashRadius = BG_FindSplashRadiusForBuildable( buildable );
- built->splashMethodOfDeath = BG_FindMODForBuildable( buildable );
+ built->splashDamage = BG_Buildable( buildable )->splashDamage;
+ built->splashRadius = BG_Buildable( buildable )->splashRadius;
+ built->splashMethodOfDeath = BG_Buildable( buildable )->meansOfDeath;
- built->nextthink = BG_FindNextThinkForBuildable( buildable );
+ built->nextthink = BG_Buildable( buildable )->nextthink;
built->takedamage = qtrue;
built->spawned = qfalse;
@@ -3166,9 +3168,9 @@ static gentity_t *G_Build( gentity_t *builder, buildable_t buildable, vec3_t ori
// build instantly in cheat mode
if( builder->client && g_cheats.integer )
{
- built->health = BG_FindHealthForBuildable( buildable );
+ built->health = BG_Buildable( buildable )->health;
built->buildTime = built->s.time =
- level.time - BG_FindBuildTimeForBuildable( buildable );
+ level.time - BG_Buildable( buildable )->buildTime;
}
//things that vary for each buildable that aren't in the dbase
@@ -3281,7 +3283,7 @@ static gentity_t *G_Build( gentity_t *builder, buildable_t buildable, vec3_t ori
built->r.contents = CONTENTS_BODY;
built->clipmask = MASK_PLAYERSOLID;
built->enemy = NULL;
- built->s.weapon = BG_FindProjTypeForBuildable( buildable );
+ built->s.weapon = BG_Buildable( buildable )->turretProjType;
if( builder->client )
built->builtBy = builder->client->ps.clientNum;
@@ -3299,18 +3301,18 @@ static gentity_t *G_Build( gentity_t *builder, buildable_t buildable, vec3_t ori
VectorCopy( angles, built->s.angles );
built->s.angles[ PITCH ] = 0.0f;
built->s.angles2[ YAW ] = angles[ YAW ];
- built->s.pos.trType = BG_FindTrajectoryForBuildable( buildable );
+ built->s.pos.trType = BG_Buildable( buildable )->traj;
built->s.pos.trTime = level.time;
- built->physicsBounce = BG_FindBounceForBuildable( buildable );
+ built->physicsBounce = BG_Buildable( buildable )->bounce;
built->s.groundEntityNum = -1;
built->s.generic1 = (int)( ( (float)built->health /
- (float)BG_FindHealthForBuildable( buildable ) ) * B_HEALTH_MASK );
+ (float)BG_Buildable( buildable )->health ) * B_HEALTH_MASK );
if( built->s.generic1 < 0 )
built->s.generic1 = 0;
- if( BG_FindTeamForBuildable( built->s.modelindex ) == TEAM_ALIENS )
+ if( BG_Buildable( buildable )->team == TEAM_ALIENS )
{
built->powered = qtrue;
built->s.eFlags |= EF_B_POWERED;
@@ -3324,7 +3326,7 @@ static gentity_t *G_Build( gentity_t *builder, buildable_t buildable, vec3_t ori
G_AddEvent( built, EV_BUILD_CONSTRUCT, 0 );
- G_SetIdleBuildableAnim( built, BG_FindAnimForBuildable( buildable ) );
+ G_SetIdleBuildableAnim( built, BG_Buildable( buildable )->idleAnim );
if( built->builtBy >= 0 )
G_SetBuildableAnim( built, BANIM_CONSTRUCT1, qtrue );
@@ -3344,7 +3346,7 @@ qboolean G_BuildIfValid( gentity_t *ent, buildable_t buildable )
float dist;
vec3_t origin;
- dist = BG_FindBuildDistForClass( ent->client->ps.stats[ STAT_CLASS ] );
+ dist = BG_Class( ent->client->ps.stats[ STAT_CLASS ] )->buildDist;
switch( G_CanBuild( ent, buildable, dist, origin ) )
{
@@ -3439,7 +3441,7 @@ static void G_FinishSpawningBuildable( gentity_t *ent )
built->takedamage = qtrue;
built->spawned = qtrue; //map entities are already spawned
- built->health = BG_FindHealthForBuildable( buildable );
+ built->health = BG_Buildable( buildable )->health;
built->s.eFlags |= EF_B_SPAWNED;
// drop towards normal surface
diff --git a/src/game/g_client.c b/src/game/g_client.c
index eec9d3eb..01f5dbb2 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -316,7 +316,7 @@ gentity_t *G_SelectAlienSpawnPoint( vec3_t preference )
spot = NULL;
while( ( spot = G_Find( spot, FOFS( classname ),
- BG_FindEntityNameForBuildable( BA_A_SPAWN ) ) ) != NULL )
+ BG_Buildable( BA_A_SPAWN )->entityName ) ) != NULL )
{
if( !spot->spawned )
continue;
@@ -365,7 +365,7 @@ gentity_t *G_SelectHumanSpawnPoint( vec3_t preference )
spot = NULL;
while( ( spot = G_Find( spot, FOFS( classname ),
- BG_FindEntityNameForBuildable( BA_H_SPAWN ) ) ) != NULL )
+ BG_Buildable( BA_H_SPAWN )->entityName ) ) != NULL )
{
if( !spot->spawned )
continue;
@@ -688,7 +688,7 @@ void SpawnCorpse( gentity_t *ent )
ent->health = 0;
//change body dimensions
- BG_FindBBoxForClass( ent->client->ps.stats[ STAT_CLASS ], NULL, NULL, NULL, body->r.mins, body->r.maxs );
+ BG_ClassBoundingBox( ent->client->ps.stats[ STAT_CLASS ], NULL, NULL, NULL, body->r.mins, body->r.maxs );
vDiff = body->r.mins[ 2 ] - ent->r.mins[ 2 ];
//drop down to match the *model* origins of ent and body
@@ -1021,8 +1021,8 @@ void ClientUserinfoChanged( int clientNum )
// set model
if( client->ps.stats[ STAT_CLASS ] == PCL_HUMAN_BSUIT )
{
- Com_sprintf( buffer, MAX_QPATH, "%s/%s", BG_FindModelNameForClass( PCL_HUMAN_BSUIT ),
- BG_FindSkinNameForClass( PCL_HUMAN_BSUIT ) );
+ Com_sprintf( buffer, MAX_QPATH, "%s/%s", BG_ClassConfig( PCL_HUMAN_BSUIT )->modelName,
+ BG_ClassConfig( PCL_HUMAN_BSUIT )->skinName );
}
else if( client->pers.classSelection == PCL_NONE )
{
@@ -1030,13 +1030,13 @@ void ClientUserinfoChanged( int clientNum )
//model details to that of the spawning class or the info change will not be
//registered and an axis appears instead of the player model. There is zero chance
//the player can spawn with the battlesuit, hence this choice.
- Com_sprintf( buffer, MAX_QPATH, "%s/%s", BG_FindModelNameForClass( PCL_HUMAN_BSUIT ),
- BG_FindSkinNameForClass( PCL_HUMAN_BSUIT ) );
+ Com_sprintf( buffer, MAX_QPATH, "%s/%s", BG_ClassConfig( PCL_HUMAN_BSUIT )->modelName,
+ BG_ClassConfig( PCL_HUMAN_BSUIT )->skinName );
}
else
{
- Com_sprintf( buffer, MAX_QPATH, "%s/%s", BG_FindModelNameForClass( client->pers.classSelection ),
- BG_FindSkinNameForClass( client->pers.classSelection ) );
+ Com_sprintf( buffer, MAX_QPATH, "%s/%s", BG_ClassConfig( client->pers.classSelection )->modelName,
+ BG_ClassConfig( client->pers.classSelection )->skinName );
}
Q_strncpyz( model, buffer, sizeof( model ) );
@@ -1045,7 +1045,7 @@ void ClientUserinfoChanged( int clientNum )
{
//model segmentation
Com_sprintf( filename, sizeof( filename ), "models/players/%s/animation.cfg",
- BG_FindModelNameForClass( client->pers.classSelection ) );
+ BG_ClassConfig( client->pers.classSelection )->modelName );
if( G_NonSegModel( filename ) )
client->ps.persistant[ PERS_STATE ] |= PS_NONSEGMODEL;
@@ -1428,11 +1428,11 @@ 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.classSelection, ent->r.mins, ent->r.maxs, NULL, NULL, NULL );
+ BG_ClassBoundingBox( ent->client->pers.classSelection, ent->r.mins, ent->r.maxs, NULL, NULL, NULL );
if( client->sess.spectatorState == SPECTATOR_NOT )
client->pers.maxHealth = client->ps.stats[ STAT_MAX_HEALTH ] =
- BG_FindHealthForClass( ent->client->pers.classSelection );
+ BG_Class( ent->client->pers.classSelection )->health;
else
client->pers.maxHealth = client->ps.stats[ STAT_MAX_HEALTH ] = 100;
@@ -1444,11 +1444,12 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
weapon = client->pers.humanItemSelection;
}
else if( client->sess.spectatorState == SPECTATOR_NOT )
- weapon = BG_FindStartWeaponForClass( ent->client->pers.classSelection );
+ weapon = BG_Class( ent->client->pers.classSelection )->startWeapon;
else
weapon = WP_NONE;
- BG_FindAmmoForWeapon( weapon, &maxAmmo, &maxClips );
+ maxAmmo = BG_Weapon( weapon )->maxAmmo;
+ maxClips = BG_Weapon( weapon )->maxClips;
BG_AddWeaponToInventory( weapon, client->ps.stats );
client->ps.ammo = maxAmmo;
client->ps.clips = maxClips;
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 89183be0..755356b1 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -385,12 +385,13 @@ void Cmd_Give_f( gentity_t *ent )
gclient_t *client = ent->client;
if( client->ps.weapon != WP_ALEVEL3_UPG &&
- BG_FindInfinteAmmoForWeapon( client->ps.weapon ) )
+ BG_Weapon( client->ps.weapon )->infiniteAmmo )
return;
- BG_FindAmmoForWeapon( client->ps.weapon, &maxAmmo, &maxClips );
+ maxAmmo = BG_Weapon( client->ps.weapon )->maxAmmo;
+ maxClips = BG_Weapon( client->ps.weapon )->maxClips;
- if( BG_FindUsesEnergyForWeapon( client->ps.weapon ) &&
+ if( BG_Weapon( client->ps.weapon )->usesEnergy &&
BG_InventoryContainsUpgrade( UP_BATTPACK, client->ps.stats ) )
maxAmmo = (int)( (float)maxAmmo * BATTPACK_MODIFIER );
@@ -1461,8 +1462,8 @@ static qboolean G_RoomForClassChange( gentity_t *ent, class_t class, vec3_t newO
float maxHorizGrowth;
class_t oldClass = ent->client->ps.stats[ STAT_CLASS ];
- BG_FindBBoxForClass( oldClass, fromMins, fromMaxs, NULL, NULL, NULL );
- BG_FindBBoxForClass( class, toMins, toMaxs, NULL, NULL, NULL );
+ BG_ClassBoundingBox( oldClass, fromMins, fromMaxs, NULL, NULL, NULL );
+ BG_ClassBoundingBox( class, toMins, toMaxs, NULL, NULL, NULL );
VectorCopy( ent->s.origin, newOrigin );
@@ -1529,7 +1530,7 @@ void Cmd_Class_f( gentity_t *ent )
clientNum = ent->client - level.clients;
trap_Argv( 1, s, sizeof( s ) );
- newClass = BG_FindClassNumForName( s );
+ newClass = BG_ClassByName( s )->number;
if( ent->client->sess.spectatorState != SPECTATOR_NOT )
{
@@ -1551,7 +1552,7 @@ void Cmd_Class_f( gentity_t *ent )
return;
}
- if( !BG_FindStagesForClass( newClass, g_alienStage.integer ) )
+ if( !BG_ClassAllowedInStage( newClass, g_alienStage.integer ) )
{
G_TriggerMenu2( ent->client->ps.clientNum, MN_A_CLASSNOTATSTAGE, newClass );
return;
@@ -1567,12 +1568,12 @@ void Cmd_Class_f( gentity_t *ent )
else if( ent->client->pers.teamSelection == TEAM_HUMANS )
{
//set the item to spawn with
- if( !Q_stricmp( s, BG_FindNameForWeapon( WP_MACHINEGUN ) ) &&
+ if( !Q_stricmp( s, BG_Weapon( WP_MACHINEGUN )->name ) &&
BG_WeaponIsAllowed( WP_MACHINEGUN ) )
{
ent->client->pers.humanItemSelection = WP_MACHINEGUN;
}
- else if( !Q_stricmp( s, BG_FindNameForWeapon( WP_HBUILD ) ) &&
+ else if( !Q_stricmp( s, BG_Weapon( WP_HBUILD )->name ) &&
BG_WeaponIsAllowed( WP_HBUILD ) )
{
ent->client->pers.humanItemSelection = WP_HBUILD;
@@ -1661,7 +1662,7 @@ void Cmd_Class_f( gentity_t *ent )
int oldBoostTime = -1;
ent->client->pers.evolveHealthFraction = (float)ent->client->ps.stats[ STAT_HEALTH ] /
- (float)BG_FindHealthForClass( currentClass );
+ (float)BG_Class( currentClass )->health;
if( ent->client->pers.evolveHealthFraction < 0.0f )
ent->client->pers.evolveHealthFraction = 0.0f;
@@ -1780,9 +1781,7 @@ void Cmd_Destroy_f( gentity_t *ent )
// Don't allow destruction of buildables that cannot be rebuilt
if( G_TimeTilSuddenDeath( ) <= 0 )
- {
return;
- }
if( !g_markDeconstruct.integer && ent->client->ps.stats[ STAT_MISC ] > 0 )
{
@@ -1803,14 +1802,14 @@ void Cmd_Destroy_f( gentity_t *ent )
{
G_TeamCommand( ent->client->pers.teamSelection,
va( "print \"%s ^3DECONSTRUCTED^7 by %s^7\n\"",
- BG_FindHumanNameForBuildable( traceEnt->s.modelindex ),
+ BG_Buildable( traceEnt->s.modelindex )->humanName,
ent->client->pers.netname ) );
G_LogPrintf( "Decon: %i %i 0: %s deconstructed %s\n",
ent->client->ps.clientNum,
traceEnt->s.modelindex,
ent->client->pers.netname,
- BG_FindNameForBuildable( traceEnt->s.modelindex ) );
+ BG_Buildable( traceEnt->s.modelindex )->humanName );
G_Damage( traceEnt, ent, ent, forward, tr.endpos, ent->health, 0, MOD_SUICIDE );
G_FreeEntity( traceEnt );
@@ -1819,7 +1818,7 @@ void Cmd_Destroy_f( gentity_t *ent )
if( !g_cheats.integer )
{
ent->client->ps.stats[ STAT_MISC ] +=
- BG_FindBuildTimeForBuildable( traceEnt->s.modelindex );
+ BG_Buildable( traceEnt->s.modelindex )->buildTime;
}
}
}
@@ -1849,8 +1848,8 @@ void Cmd_ActivateItem_f( gentity_t *ent )
return;
}
- upgrade = BG_FindUpgradeNumForName( s );
- weapon = BG_FindWeaponNumForName( s );
+ upgrade = BG_UpgradeByName( s )->number;
+ weapon = BG_WeaponByName( s )->number;
if( upgrade != UP_NONE && BG_InventoryContainsUpgrade( upgrade, ent->client->ps.stats ) )
BG_ActivateUpgrade( upgrade, ent->client->ps.stats );
@@ -1875,11 +1874,11 @@ Deactivate an item
*/
void Cmd_DeActivateItem_f( gentity_t *ent )
{
- char s[ MAX_TOKEN_CHARS ];
- int upgrade;
+ char s[ MAX_TOKEN_CHARS ];
+ upgrade_t upgrade;
trap_Argv( 1, s, sizeof( s ) );
- upgrade = BG_FindUpgradeNumForName( s );
+ upgrade = BG_UpgradeByName( s )->number;
if( BG_InventoryContainsUpgrade( upgrade, ent->client->ps.stats ) )
BG_DeactivateUpgrade( upgrade, ent->client->ps.stats );
@@ -1895,12 +1894,13 @@ Cmd_ToggleItem_f
*/
void Cmd_ToggleItem_f( gentity_t *ent )
{
- char s[ MAX_TOKEN_CHARS ];
- int upgrade, weapon;
+ char s[ MAX_TOKEN_CHARS ];
+ weapon_t weapon;
+ upgrade_t upgrade;
trap_Argv( 1, s, sizeof( s ) );
- upgrade = BG_FindUpgradeNumForName( s );
- weapon = BG_FindWeaponNumForName( s );
+ upgrade = BG_UpgradeByName( s )->number;
+ weapon = BG_WeaponByName( s )->number;
if( weapon != WP_NONE )
{
@@ -1940,8 +1940,8 @@ void Cmd_Buy_f( gentity_t *ent )
trap_Argv( 1, s, sizeof( s ) );
- weapon = BG_FindWeaponNumForName( s );
- upgrade = BG_FindUpgradeNumForName( s );
+ weapon = BG_WeaponByName( s )->number;
+ upgrade = BG_UpgradeByName( s )->number;
// Seems odd to let people 'buy ammo' from a Reactor but allow this
// and make sure we only give energy ammo in this case
@@ -1954,7 +1954,7 @@ void Cmd_Buy_f( gentity_t *ent )
else
{
if( upgrade == UP_AMMO &&
- BG_FindUsesEnergyForWeapon( ent->client->ps.weapon ) )
+ BG_Weapon( ent->client->ps.weapon )->usesEnergy )
G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOENERGYAMMOHERE );
else
G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOARMOURYHERE );
@@ -1971,35 +1971,35 @@ void Cmd_Buy_f( gentity_t *ent )
}
//can afford this?
- if( BG_FindPriceForWeapon( weapon ) > (short)ent->client->ps.persistant[ PERS_CREDIT ] )
+ if( BG_Weapon( weapon )->price > (short)ent->client->ps.persistant[ PERS_CREDIT ] )
{
G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOFUNDS );
return;
}
//have space to carry this?
- if( BG_FindSlotsForWeapon( weapon ) & ent->client->ps.stats[ STAT_SLOTS ] )
+ if( BG_Weapon( weapon )->slots & ent->client->ps.stats[ STAT_SLOTS ] )
{
G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOSLOTS );
return;
}
// Only humans can buy stuff
- if( BG_FindTeamForWeapon( weapon ) != TEAM_HUMANS )
+ if( BG_Weapon( weapon )->team != TEAM_HUMANS )
{
trap_SendServerCommand( ent-g_entities, "print \"You can't buy alien items\n\"" );
return;
}
//are we /allowed/ to buy this?
- if( !BG_FindPurchasableForWeapon( weapon ) )
+ if( !BG_Weapon( weapon )->purchasable )
{
trap_SendServerCommand( ent-g_entities, "print \"You can't buy this item\n\"" );
return;
}
//are we /allowed/ to buy this?
- if( !BG_FindStagesForWeapon( weapon, g_humanStage.integer ) || !BG_WeaponIsAllowed( weapon ) )
+ if( !BG_WeaponAllowedInStage( weapon, g_humanStage.integer ) || !BG_WeaponIsAllowed( weapon ) )
{
trap_SendServerCommand( ent-g_entities, "print \"You can't buy this item\n\"" );
return;
@@ -2011,9 +2011,10 @@ void Cmd_Buy_f( gentity_t *ent )
//add to inventory
BG_AddWeaponToInventory( weapon, ent->client->ps.stats );
- BG_FindAmmoForWeapon( weapon, &maxAmmo, &maxClips );
+ maxAmmo = BG_Weapon( weapon )->maxAmmo;
+ maxClips = BG_Weapon( weapon )->maxClips;
- if( BG_FindUsesEnergyForWeapon( weapon ) &&
+ if( BG_Weapon( weapon )->usesEnergy &&
BG_InventoryContainsUpgrade( UP_BATTPACK, ent->client->ps.stats ) )
maxAmmo *= BATTPACK_MODIFIER;
@@ -2026,7 +2027,7 @@ void Cmd_Buy_f( gentity_t *ent )
ent->client->ps.stats[ STAT_MISC ] = 0;
//subtract from funds
- G_AddCreditToClient( ent->client, -(short)BG_FindPriceForWeapon( weapon ), qfalse );
+ G_AddCreditToClient( ent->client, -(short)BG_Weapon( weapon )->price, qfalse );
}
else if( upgrade != UP_NONE )
{
@@ -2038,35 +2039,35 @@ void Cmd_Buy_f( gentity_t *ent )
}
//can afford this?
- if( BG_FindPriceForUpgrade( upgrade ) > (short)ent->client->ps.persistant[ PERS_CREDIT ] )
+ if( BG_Upgrade( upgrade )->price > (short)ent->client->ps.persistant[ PERS_CREDIT ] )
{
G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOFUNDS );
return;
}
//have space to carry this?
- if( BG_FindSlotsForUpgrade( upgrade ) & ent->client->ps.stats[ STAT_SLOTS ] )
+ if( BG_Upgrade( upgrade )->slots & ent->client->ps.stats[ STAT_SLOTS ] )
{
G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOSLOTS );
return;
}
// Only humans can buy stuff
- if( BG_FindTeamForUpgrade( upgrade ) != TEAM_HUMANS )
+ if( BG_Upgrade( upgrade )->team != TEAM_HUMANS )
{
trap_SendServerCommand( ent-g_entities, "print \"You can't buy alien items\n\"" );
return;
}
//are we /allowed/ to buy this?
- if( !BG_FindPurchasableForUpgrade( upgrade ) )
+ if( !BG_Upgrade( upgrade )->purchasable )
{
trap_SendServerCommand( ent-g_entities, "print \"You can't buy this item\n\"" );
return;
}
//are we /allowed/ to buy this?
- if( !BG_FindStagesForUpgrade( upgrade, g_humanStage.integer ) || !BG_UpgradeIsAllowed( upgrade ) )
+ if( !BG_UpgradeAllowedInStage( upgrade, g_humanStage.integer ) || !BG_UpgradeIsAllowed( upgrade ) )
{
trap_SendServerCommand( ent-g_entities, "print \"You can't buy this item\n\"" );
return;
@@ -2098,7 +2099,7 @@ void Cmd_Buy_f( gentity_t *ent )
G_GiveClientMaxAmmo( ent, qtrue );
//subtract from funds
- G_AddCreditToClient( ent->client, -(short)BG_FindPriceForUpgrade( upgrade ), qfalse );
+ G_AddCreditToClient( ent->client, -(short)BG_Upgrade( upgrade )->price, qfalse );
}
else
G_TriggerMenu( ent->client->ps.clientNum, MN_H_UNKNOWNITEM );
@@ -2117,7 +2118,8 @@ void Cmd_Sell_f( gentity_t *ent )
{
char s[ MAX_TOKEN_CHARS ];
int i;
- int weapon, upgrade;
+ weapon_t weapon;
+ upgrade_t upgrade;
trap_Argv( 1, s, sizeof( s ) );
@@ -2128,8 +2130,8 @@ void Cmd_Sell_f( gentity_t *ent )
return;
}
- weapon = BG_FindWeaponNumForName( s );
- upgrade = BG_FindUpgradeNumForName( s );
+ weapon = BG_WeaponByName( s )->number;
+ upgrade = BG_UpgradeByName( s )->number;
if( weapon != WP_NONE )
{
@@ -2139,7 +2141,7 @@ void Cmd_Sell_f( gentity_t *ent )
return;
//are we /allowed/ to sell this?
- if( !BG_FindPurchasableForWeapon( weapon ) )
+ if( !BG_Weapon( weapon )->purchasable )
{
trap_SendServerCommand( ent-g_entities, "print \"You can't sell this weapon\n\"" );
return;
@@ -2158,7 +2160,7 @@ void Cmd_Sell_f( gentity_t *ent )
BG_RemoveWeaponFromInventory( weapon, ent->client->ps.stats );
//add to funds
- G_AddCreditToClient( ent->client, (short)BG_FindPriceForWeapon( weapon ), qfalse );
+ G_AddCreditToClient( ent->client, (short)BG_Weapon( weapon )->price, qfalse );
}
//if we have this weapon selected, force a new selection
@@ -2168,7 +2170,7 @@ void Cmd_Sell_f( gentity_t *ent )
else if( upgrade != UP_NONE )
{
//are we /allowed/ to sell this?
- if( !BG_FindPurchasableForUpgrade( upgrade ) )
+ if( !BG_Upgrade( upgrade )->purchasable )
{
trap_SendServerCommand( ent-g_entities, "print \"You can't sell this item\n\"" );
return;
@@ -2198,7 +2200,7 @@ void Cmd_Sell_f( gentity_t *ent )
G_GiveClientMaxAmmo( ent, qtrue );
//add to funds
- G_AddCreditToClient( ent->client, (short)BG_FindPriceForUpgrade( upgrade ), qfalse );
+ G_AddCreditToClient( ent->client, (short)BG_Upgrade( upgrade )->price, qfalse );
}
}
else if( !Q_stricmp( s, "weapons" ) )
@@ -2218,12 +2220,12 @@ void Cmd_Sell_f( gentity_t *ent )
}
if( BG_InventoryContainsWeapon( i, ent->client->ps.stats ) &&
- BG_FindPurchasableForWeapon( i ) )
+ BG_Weapon( i )->purchasable )
{
BG_RemoveWeaponFromInventory( i, ent->client->ps.stats );
//add to funds
- G_AddCreditToClient( ent->client, (short)BG_FindPriceForWeapon( i ), qfalse );
+ G_AddCreditToClient( ent->client, (short)BG_Weapon( i )->price, qfalse );
}
//if we have this weapon selected, force a new selection
@@ -2237,7 +2239,7 @@ void Cmd_Sell_f( gentity_t *ent )
{
//remove upgrade if carried
if( BG_InventoryContainsUpgrade( i, ent->client->ps.stats ) &&
- BG_FindPurchasableForUpgrade( i ) )
+ BG_Upgrade( i )->purchasable )
{
// shouldn't really need to test for this, but just to be safe
@@ -2260,7 +2262,7 @@ void Cmd_Sell_f( gentity_t *ent )
G_GiveClientMaxAmmo( ent, qtrue );
//add to funds
- G_AddCreditToClient( ent->client, (short)BG_FindPriceForUpgrade( i ), qfalse );
+ G_AddCreditToClient( ent->client, (short)BG_Upgrade( i )->price, qfalse );
}
}
}
@@ -2299,7 +2301,7 @@ void Cmd_Build_f( gentity_t *ent )
trap_Argv( 1, s, sizeof( s ) );
- buildable = BG_FindBuildNumForName( s );
+ buildable = BG_BuildableByName( s )->number;
if( G_TimeTilSuddenDeath( ) <= 0 )
{
@@ -2310,14 +2312,14 @@ void Cmd_Build_f( gentity_t *ent )
team = ent->client->ps.stats[ STAT_TEAM ];
if( buildable != BA_NONE &&
- ( ( 1 << ent->client->ps.weapon ) & BG_FindBuildWeaponForBuildable( buildable ) ) &&
+ ( ( 1 << ent->client->ps.weapon ) & BG_Buildable( buildable )->buildWeapon ) &&
!( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING ) &&
!( ent->client->ps.stats[ STAT_STATE ] & SS_HOVELING ) &&
BG_BuildableIsAllowed( buildable ) &&
- ( ( team == TEAM_ALIENS && BG_FindStagesForBuildable( buildable, g_alienStage.integer ) ) ||
- ( team == TEAM_HUMANS && BG_FindStagesForBuildable( buildable, g_humanStage.integer ) ) ) )
+ ( ( team == TEAM_ALIENS && BG_BuildableAllowedInStage( buildable, g_alienStage.integer ) ) ||
+ ( team == TEAM_HUMANS && BG_BuildableAllowedInStage( buildable, g_humanStage.integer ) ) ) )
{
- dist = BG_FindBuildDistForClass( ent->client->ps.stats[ STAT_CLASS ] );
+ dist = BG_Class( ent->client->ps.stats[ STAT_CLASS ] )->buildDist;
//these are the errors displayed when the builder first selects something to use
switch( G_CanBuild( ent, buildable, dist, origin ) )
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index a19b8604..683bb3e1 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -155,13 +155,13 @@ float G_RewardAttackers( gentity_t *self )
}
else if( self->s.eType == ET_BUILDABLE )
{
- value = BG_FindValueOfBuildable( self->s.modelindex );
+ value = BG_Buildable( self->s.modelindex )->value;
// only give partial credits for a buildable not yet completed
if( !self->spawned )
{
value *= (float)( level.time - self->buildTime ) /
- BG_FindBuildTimeForBuildable( self->s.modelindex );
+ BG_Buildable( self->s.modelindex )->buildTime;
}
team = self->buildableTeam;
@@ -782,7 +782,7 @@ void G_InitDamageLocations( void )
for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ )
{
- modelName = BG_FindModelNameForClass( i );
+ modelName = BG_ClassConfig( i )->modelName;
Com_sprintf( filename, sizeof( filename ),
"models/players/%s/locdamage.cfg", modelName );
@@ -810,7 +810,7 @@ void G_InitDamageLocations( void )
for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ )
{
- modelName = BG_FindNameForUpgrade( i );
+ modelName = BG_Upgrade( i )->name;
Com_sprintf( filename, sizeof( filename ), "armour/%s.armour", modelName );
len = trap_FS_FOpenFile( filename, &fileHandle, FS_READ );
@@ -911,13 +911,13 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
if( inflictor->s.weapon != WP_NONE )
{
knockback = (int)( (float)knockback *
- BG_FindKnockbackScaleForWeapon( inflictor->s.weapon ) );
+ BG_Weapon( inflictor->s.weapon )->knockbackScale );
}
if( targ->client )
{
knockback = (int)( (float)knockback *
- BG_FindKnockbackScaleForClass( targ->client->ps.stats[ STAT_CLASS ] ) );
+ BG_Class( targ->client->ps.stats[ STAT_CLASS ] )->knockbackScale );
}
if( knockback > 200 )
diff --git a/src/game/g_main.c b/src/game/g_main.c
index b48c81e7..6643b52e 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -615,8 +615,8 @@ void G_InitGame( int levelTime, int randomSeed, int restart )
// general initialization
G_FindTeams( );
- BG_InitClassOverrides( );
- BG_InitBuildableOverrides( );
+ BG_InitClassConfigs( );
+ BG_InitBuildableConfigs( );
G_InitDamageLocations( );
G_InitMapRotations( );
G_InitSpawnQueue( &level.alienSpawnQueue );
@@ -1125,16 +1125,16 @@ void G_CalculateBuildPoints( void )
if( buildable == BA_A_OVERMIND && ent->spawned && ent->health > 0 )
level.overmindPresent = qtrue;
- if( BG_FindTeamForBuildable( buildable ) == TEAM_HUMANS )
+ if( BG_Buildable( buildable )->team == TEAM_HUMANS )
{
- level.humanBuildPoints -= BG_FindBuildPointsForBuildable( buildable );
+ level.humanBuildPoints -= BG_Buildable( buildable )->buildPoints;
if( ent->powered )
- level.humanBuildPointsPowered -= BG_FindBuildPointsForBuildable( buildable );
+ level.humanBuildPointsPowered -= BG_Buildable( buildable )->buildPoints;
}
else
{
- level.alienBuildPoints -= BG_FindBuildPointsForBuildable( buildable );
+ level.alienBuildPoints -= BG_Buildable( buildable )->buildPoints;
}
}
}
diff --git a/src/game/g_physics.c b/src/game/g_physics.c
index a053cc81..57635199 100644
--- a/src/game/g_physics.c
+++ b/src/game/g_physics.c
@@ -45,8 +45,8 @@ static void G_Bounce( gentity_t *ent, trace_t *trace )
if( ent->s.eType == ET_BUILDABLE )
{
- minNormal = BG_FindMinNormalForBuildable( ent->s.modelindex );
- invert = BG_FindInvertNormalForBuildable( ent->s.modelindex );
+ minNormal = BG_Buildable( ent->s.modelindex )->minNormal;
+ invert = BG_Buildable( ent->s.modelindex )->invertNormal;
}
else
minNormal = 0.707f;
@@ -94,9 +94,9 @@ void G_Physics( gentity_t *ent, int msec )
{
if( ent->s.eType == ET_BUILDABLE )
{
- if( ent->s.pos.trType != BG_FindTrajectoryForBuildable( ent->s.modelindex ) )
+ if( ent->s.pos.trType != BG_Buildable( ent->s.modelindex )->turretProjType )
{
- ent->s.pos.trType = BG_FindTrajectoryForBuildable( ent->s.modelindex );
+ ent->s.pos.trType = BG_Buildable( ent->s.modelindex )->turretProjType;
ent->s.pos.trTime = level.time;
}
}
diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c
index 07e3407f..6bad35a2 100644
--- a/src/game/g_spawn.c
+++ b/src/game/g_spawn.c
@@ -324,7 +324,8 @@ qboolean G_CallSpawn( gentity_t *ent )
}
//check buildable spawn functions
- if( ( buildable = BG_FindBuildNumForEntityName( ent->classname ) ) != BA_NONE )
+ buildable = BG_BuildableByEntityName( ent->classname )->number;
+ if( buildable != BA_NONE )
{
// don't spawn built-in buildings if we are using a custom layout
if( level.layout[ 0 ] && Q_stricmp( level.layout, "*BUILTIN*" ) )
diff --git a/src/game/g_trigger.c b/src/game/g_trigger.c
index 7e208667..c3d4681c 100644
--- a/src/game/g_trigger.c
+++ b/src/game/g_trigger.c
@@ -1087,10 +1087,10 @@ void trigger_ammo_touch( gentity_t *self, gentity_t *other, trace_t *trace )
if( other->client->ps.weaponstate != WEAPON_READY )
return;
- if( BG_FindUsesEnergyForWeapon( other->client->ps.weapon ) && self->spawnflags & 2 )
+ if( BG_Weapon( other->client->ps.weapon )->usesEnergy && self->spawnflags & 2 )
return;
- if( !BG_FindUsesEnergyForWeapon( other->client->ps.weapon ) && self->spawnflags & 4 )
+ if( !BG_Weapon( other->client->ps.weapon )->usesEnergy && self->spawnflags & 4 )
return;
if( self->spawnflags & 1 )
@@ -1098,7 +1098,8 @@ void trigger_ammo_touch( gentity_t *self, gentity_t *other, trace_t *trace )
else
self->timestamp = level.time + FRAMETIME;
- BG_FindAmmoForWeapon( other->client->ps.weapon, &maxAmmo, &maxClips );
+ maxAmmo = BG_Weapon( other->client->ps.weapon )->maxAmmo;
+ maxClips = BG_Weapon( other->client->ps.weapon )->maxClips;
if( ( other->client->ps.ammo + self->damage ) > maxAmmo )
{
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index b420e876..0e8e308a 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -94,15 +94,16 @@ void G_GiveClientMaxAmmo( gentity_t *ent, qboolean buyingEnergyAmmo )
{
qboolean energyWeapon;
- energyWeapon = BG_FindUsesEnergyForWeapon( i );
+ energyWeapon = BG_Weapon( i )->usesEnergy;
if( !BG_InventoryContainsWeapon( i, ent->client->ps.stats ) ||
- BG_FindInfinteAmmoForWeapon( i ) ||
+ BG_Weapon( i )->infiniteAmmo ||
BG_WeaponIsFull( i, ent->client->ps.stats,
ent->client->ps.ammo, ent->client->ps.clips ) ||
( buyingEnergyAmmo && !energyWeapon ) )
continue;
- BG_FindAmmoForWeapon( i, &maxAmmo, &maxClips );
+ maxAmmo = BG_Weapon( i )->maxAmmo;
+ maxClips = BG_Weapon( i )->maxClips;
// Apply battery pack modifier
if( energyWeapon &&
@@ -825,7 +826,7 @@ void cancelBuildFire( gentity_t *ent )
return;
}
- bHealth = BG_FindHealthForBuildable( traceEnt->s.modelindex );
+ bHealth = BG_Buildable( traceEnt->s.modelindex )->health;
traceEnt->health += HBUILD_HEALRATE;
if( traceEnt->health >= bHealth )
{
@@ -867,7 +868,7 @@ void buildFire( gentity_t *ent, dynMenu_t menu )
if( !g_cheats.integer )
{
ent->client->ps.stats[ STAT_MISC ] +=
- BG_FindBuildTimeForBuildable( buildable );
+ BG_Buildable( buildable )->buildTime;
}
ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE;
@@ -1131,7 +1132,7 @@ void G_UpdateZaps( gentity_t *ent )
if( ( ( enemy->client &&
enemy->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) ||
( enemy->s.eType == ET_BUILDABLE &&
- BG_FindTeamForBuildable( enemy->s.modelindex ) == TEAM_HUMANS ) ) &&
+ BG_Buildable( enemy->s.modelindex )->team == TEAM_HUMANS ) ) &&
enemy->health > 0 )
{
@@ -1340,7 +1341,7 @@ void G_CrushAttack( gentity_t *ent, gentity_t *victim )
return;
// Deal velocity based damage to target
- jump = BG_FindJumpMagnitudeForClass( ent->client->ps.stats[ STAT_CLASS ] );
+ jump = BG_Class( ent->client->ps.stats[ STAT_CLASS ] )->jumpMagnitude;
damage = ( ent->client->pmext.fallVelocity + jump ) *
-LEVEL4_CRUSH_DAMAGE_PER_V;
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c
index 5907a3ef..a5168bdb 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -1549,61 +1549,61 @@ static void UI_DrawInfoPane( menuItem_t *item, rectDef_t *rect, float text_x, fl
if( value < 1 )
{
s = va( "%s\n\n%s",
- BG_FindHumanNameForClassNum( item->v.pclass ),
- BG_FindInfoForClassNum( item->v.pclass ) );
+ BG_ClassConfig( item->v.pclass )->humanName,
+ BG_Class( item->v.pclass )->info );
}
else
{
s = va( "%s\n\n%s\n\nFrags: %d",
- BG_FindHumanNameForClassNum( item->v.pclass ),
- BG_FindInfoForClassNum( item->v.pclass ),
+ BG_ClassConfig( item->v.pclass )->humanName,
+ BG_Class( item->v.pclass )->info,
value );
}
break;
case INFOTYPE_WEAPON:
- value = BG_FindPriceForWeapon( item->v.weapon );
+ value = BG_Weapon( item->v.weapon )->price;
if( value == 0 )
{
s = va( "%s\n\n%s\n\nCredits: Free",
- BG_FindHumanNameForWeapon( item->v.weapon ),
- BG_FindInfoForWeapon( item->v.weapon ) );
+ BG_Weapon( item->v.weapon )->humanName,
+ BG_Weapon( item->v.weapon )->info );
}
else
{
s = va( "%s\n\n%s\n\nCredits: %d",
- BG_FindHumanNameForWeapon( item->v.weapon ),
- BG_FindInfoForWeapon( item->v.weapon ),
+ BG_Weapon( item->v.weapon )->humanName,
+ BG_Weapon( item->v.weapon )->info,
value );
}
break;
case INFOTYPE_UPGRADE:
- value = BG_FindPriceForUpgrade( item->v.upgrade );
+ value = BG_Upgrade( item->v.upgrade )->price;
if( value == 0 )
{
s = va( "%s\n\n%s\n\nCredits: Free",
- BG_FindHumanNameForUpgrade( item->v.upgrade ),
- BG_FindInfoForUpgrade( item->v.upgrade ) );
+ BG_Upgrade( item->v.upgrade )->humanName,
+ BG_Upgrade( item->v.upgrade )->info );
}
else
{
s = va( "%s\n\n%s\n\nCredits: %d",
- BG_FindHumanNameForUpgrade( item->v.upgrade ),
- BG_FindInfoForUpgrade( item->v.upgrade ),
+ BG_Upgrade( item->v.upgrade )->humanName,
+ BG_Upgrade( item->v.upgrade )->info,
value );
}
break;
case INFOTYPE_BUILDABLE:
- value = BG_FindBuildPointsForBuildable( item->v.buildable );
+ value = BG_Buildable( item->v.buildable )->buildPoints;
- switch( BG_FindTeamForBuildable( item->v.buildable ) )
+ switch( BG_Buildable( item->v.buildable )->team )
{
case TEAM_ALIENS:
string = "Sentience";
@@ -1620,14 +1620,14 @@ static void UI_DrawInfoPane( menuItem_t *item, rectDef_t *rect, float text_x, fl
if( value == 0 )
{
s = va( "%s\n\n%s",
- BG_FindHumanNameForBuildable( item->v.buildable ),
- BG_FindInfoForBuildable( item->v.buildable ) );
+ BG_Buildable( item->v.buildable )->humanName,
+ BG_Buildable( item->v.buildable )->info );
}
else
{
s = va( "%s\n\n%s\n\n%s: %d",
- BG_FindHumanNameForBuildable( item->v.buildable ),
- BG_FindInfoForBuildable( item->v.buildable ),
+ BG_Buildable( item->v.buildable )->humanName,
+ BG_Buildable( item->v.buildable )->info,
string, value );
}
@@ -2166,10 +2166,10 @@ static void UI_AddClass( class_t class )
{
uiInfo.alienClassList[ uiInfo.alienClassCount ].text =
- String_Alloc( BG_FindHumanNameForClassNum( class ) );
+ String_Alloc( BG_ClassConfig( class )->humanName );
uiInfo.alienClassList[ uiInfo.alienClassCount ].cmd =
- String_Alloc( va( "cmd class %s\n", BG_FindNameForClassNum( class ) ) );
+ String_Alloc( va( "cmd class %s\n", BG_Class( class )->name ) );
uiInfo.alienClassList[ uiInfo.alienClassCount ].type = INFOTYPE_CLASS;
uiInfo.alienClassList[ uiInfo.alienClassCount ].v.pclass = class;
@@ -2190,7 +2190,7 @@ static void UI_LoadAlienClasses( void )
UI_AddClass( PCL_ALIEN_LEVEL0 );
if( BG_ClassIsAllowed( PCL_ALIEN_BUILDER0_UPG ) &&
- BG_FindStagesForClass( PCL_ALIEN_BUILDER0_UPG, UI_GetCurrentAlienStage( ) ) )
+ BG_ClassAllowedInStage( PCL_ALIEN_BUILDER0_UPG, UI_GetCurrentAlienStage( ) ) )
UI_AddClass( PCL_ALIEN_BUILDER0_UPG );
else if( BG_ClassIsAllowed( PCL_ALIEN_BUILDER0 ) )
UI_AddClass( PCL_ALIEN_BUILDER0 );
@@ -2204,9 +2204,9 @@ UI_AddItem
static void UI_AddItem( weapon_t weapon )
{
uiInfo.humanItemList[ uiInfo.humanItemCount ].text =
- String_Alloc( BG_FindHumanNameForWeapon( weapon ) );
+ String_Alloc( BG_Weapon( weapon )->humanName );
uiInfo.humanItemList[ uiInfo.humanItemCount ].cmd =
- String_Alloc( va( "cmd class %s\n", BG_FindNameForWeapon( weapon ) ) );
+ String_Alloc( va( "cmd class %s\n", BG_Weapon( weapon )->name ) );
uiInfo.humanItemList[ uiInfo.humanItemCount ].type = INFOTYPE_WEAPON;
uiInfo.humanItemList[ uiInfo.humanItemCount ].v.weapon = weapon;
@@ -2224,6 +2224,7 @@ static void UI_LoadHumanItems( void )
if( BG_WeaponIsAllowed( WP_MACHINEGUN ) )
UI_AddItem( WP_MACHINEGUN );
+
if( BG_WeaponIsAllowed( WP_HBUILD ) )
UI_AddItem( WP_HBUILD );
}
@@ -2300,30 +2301,30 @@ static void UI_LoadHumanArmouryBuys( void )
for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ )
{
if( uiInfo.weapons & ( 1 << i ) )
- slots |= BG_FindSlotsForWeapon( i );
+ slots |= BG_Weapon( i )->slots;
}
for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ )
{
if( uiInfo.upgrades & ( 1 << i ) )
- slots |= BG_FindSlotsForUpgrade( i );
+ slots |= BG_Upgrade( i )->slots;
}
uiInfo.humanArmouryBuyCount = 0;
for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ )
{
- if( BG_FindTeamForWeapon( i ) == TEAM_HUMANS &&
- BG_FindPurchasableForWeapon( i ) &&
- BG_FindStagesForWeapon( i, stage ) &&
+ if( BG_Weapon( i )->team == TEAM_HUMANS &&
+ BG_Weapon( i )->purchasable &&
+ BG_WeaponAllowedInStage( i, stage ) &&
BG_WeaponIsAllowed( i ) &&
- !( BG_FindSlotsForWeapon( i ) & slots ) &&
+ !( BG_Weapon( i )->slots & slots ) &&
!( uiInfo.weapons & ( 1 << i ) ) )
{
uiInfo.humanArmouryBuyList[ j ].text =
- String_Alloc( BG_FindHumanNameForWeapon( i ) );
+ String_Alloc( BG_Weapon( i )->humanName );
uiInfo.humanArmouryBuyList[ j ].cmd =
- String_Alloc( va( "cmd buy %s\n", BG_FindNameForWeapon( i ) ) );
+ String_Alloc( va( "cmd buy %s\n", BG_Weapon( i )->name ) );
uiInfo.humanArmouryBuyList[ j ].type = INFOTYPE_WEAPON;
uiInfo.humanArmouryBuyList[ j ].v.weapon = i;
@@ -2335,17 +2336,17 @@ static void UI_LoadHumanArmouryBuys( void )
for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ )
{
- if( BG_FindTeamForUpgrade( i ) == TEAM_HUMANS &&
- BG_FindPurchasableForUpgrade( i ) &&
- BG_FindStagesForUpgrade( i, stage ) &&
+ if( BG_Upgrade( i )->team == TEAM_HUMANS &&
+ BG_Upgrade( i )->purchasable &&
+ BG_UpgradeAllowedInStage( i, stage ) &&
BG_UpgradeIsAllowed( i ) &&
- !( BG_FindSlotsForUpgrade( i ) & slots ) &&
+ !( BG_Upgrade( i )->slots & slots ) &&
!( uiInfo.upgrades & ( 1 << i ) ) )
{
uiInfo.humanArmouryBuyList[ j ].text =
- String_Alloc( BG_FindHumanNameForUpgrade( i ) );
+ String_Alloc( BG_Upgrade( i )->humanName );
uiInfo.humanArmouryBuyList[ j ].cmd =
- String_Alloc( va( "cmd buy %s\n", BG_FindNameForUpgrade( i ) ) );
+ String_Alloc( va( "cmd buy %s\n", BG_Upgrade( i )->name ) );
uiInfo.humanArmouryBuyList[ j ].type = INFOTYPE_UPGRADE;
uiInfo.humanArmouryBuyList[ j ].v.upgrade = i;
@@ -2372,9 +2373,9 @@ static void UI_LoadHumanArmourySells( void )
{
if( uiInfo.weapons & ( 1 << i ) )
{
- uiInfo.humanArmourySellList[ j ].text = String_Alloc( BG_FindHumanNameForWeapon( i ) );
+ uiInfo.humanArmourySellList[ j ].text = String_Alloc( BG_Weapon( i )->humanName );
uiInfo.humanArmourySellList[ j ].cmd =
- String_Alloc( va( "cmd sell %s\n", BG_FindNameForWeapon( i ) ) );
+ String_Alloc( va( "cmd sell %s\n", BG_Weapon( i )->name ) );
uiInfo.humanArmourySellList[ j ].type = INFOTYPE_WEAPON;
uiInfo.humanArmourySellList[ j ].v.weapon = i;
@@ -2388,9 +2389,9 @@ static void UI_LoadHumanArmourySells( void )
{
if( uiInfo.upgrades & ( 1 << i ) )
{
- uiInfo.humanArmourySellList[ j ].text = String_Alloc( BG_FindHumanNameForUpgrade( i ) );
+ uiInfo.humanArmourySellList[ j ].text = String_Alloc( BG_Upgrade( i )->humanName );
uiInfo.humanArmourySellList[ j ].cmd =
- String_Alloc( va( "cmd sell %s\n", BG_FindNameForUpgrade( i ) ) );
+ String_Alloc( va( "cmd sell %s\n", BG_Upgrade( i )->name ) );
uiInfo.humanArmourySellList[ j ].type = INFOTYPE_UPGRADE;
uiInfo.humanArmourySellList[ j ].v.upgrade = i;
@@ -2444,9 +2445,9 @@ static void UI_LoadAlienUpgrades( void )
{
if( BG_ClassCanEvolveFromTo( class, i, credits, stage, 0 ) >= 0 )
{
- uiInfo.alienUpgradeList[ j ].text = String_Alloc( BG_FindHumanNameForClassNum( i ) );
+ uiInfo.alienUpgradeList[ j ].text = String_Alloc( BG_ClassConfig( i )->humanName );
uiInfo.alienUpgradeList[ j ].cmd =
- String_Alloc( va( "cmd class %s\n", BG_FindNameForClassNum( i ) ) );
+ String_Alloc( va( "cmd class %s\n", BG_Class( i )->name ) );
uiInfo.alienUpgradeList[ j ].type = INFOTYPE_CLASS;
uiInfo.alienUpgradeList[ j ].v.pclass = i;
@@ -2474,15 +2475,15 @@ static void UI_LoadAlienBuilds( void )
for( i = BA_NONE + 1; i < BA_NUM_BUILDABLES; i++ )
{
- if( BG_FindTeamForBuildable( i ) == TEAM_ALIENS &&
- BG_FindBuildWeaponForBuildable( i ) & uiInfo.weapons &&
- BG_FindStagesForBuildable( i, stage ) &&
+ if( BG_Buildable( i )->team == TEAM_ALIENS &&
+ BG_Buildable( i )->buildWeapon & uiInfo.weapons &&
+ BG_BuildableAllowedInStage( i, stage ) &&
BG_BuildableIsAllowed( i ) )
{
uiInfo.alienBuildList[ j ].text =
- String_Alloc( BG_FindHumanNameForBuildable( i ) );
+ String_Alloc( BG_Buildable( i )->humanName );
uiInfo.alienBuildList[ j ].cmd =
- String_Alloc( va( "cmd build %s\n", BG_FindNameForBuildable( i ) ) );
+ String_Alloc( va( "cmd build %s\n", BG_Buildable( i )->name ) );
uiInfo.alienBuildList[ j ].type = INFOTYPE_BUILDABLE;
uiInfo.alienBuildList[ j ].v.buildable = i;
@@ -2510,15 +2511,15 @@ static void UI_LoadHumanBuilds( void )
for( i = BA_NONE + 1; i < BA_NUM_BUILDABLES; i++ )
{
- if( BG_FindTeamForBuildable( i ) == TEAM_HUMANS &&
- BG_FindBuildWeaponForBuildable( i ) & uiInfo.weapons &&
- BG_FindStagesForBuildable( i, stage ) &&
+ if( BG_Buildable( i )->team == TEAM_HUMANS &&
+ BG_Buildable( i )->buildWeapon & uiInfo.weapons &&
+ BG_BuildableAllowedInStage( i, stage ) &&
BG_BuildableIsAllowed( i ) )
{
uiInfo.humanBuildList[ j ].text =
- String_Alloc( BG_FindHumanNameForBuildable( i ) );
+ String_Alloc( BG_Buildable( i )->humanName );
uiInfo.humanBuildList[ j ].cmd =
- String_Alloc( va( "cmd build %s\n", BG_FindNameForBuildable( i ) ) );
+ String_Alloc( va( "cmd build %s\n", BG_Buildable( i )->name ) );
uiInfo.humanBuildList[ j ].type = INFOTYPE_BUILDABLE;
uiInfo.humanBuildList[ j ].v.buildable = i;
@@ -3845,7 +3846,7 @@ void UI_Init( qboolean inGameLoad )
{
int start;
- BG_InitClassOverrides( );
+ BG_InitClassConfigs( );
BG_InitAllowedGameElements( );
uiInfo.inGameLoad = inGameLoad;