summaryrefslogtreecommitdiff
path: root/src/game/bg_misc.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2009-10-03 11:42:48 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:16 +0000
commit50d9e8eab7934e0b76c04ef4a300f0fe93d4f7f5 (patch)
treefe963ef7588cb6086dab611d184e11d324048a65 /src/game/bg_misc.c
parentc37ba185e89c73bc33e9ac19ee840c5e5ed49bb3 (diff)
* Replace reams of BG_Find* functions with: BG_Buildable, BG_Class, BG_Weapon,
BG_Upgrade * Move "overrides/*" to "configs/" and remove all the overriden data from bg_misc.c, instead requiring it to be in the cfg files * Add cfg files to source control * Clean up some naming and typing issues
Diffstat (limited to 'src/game/bg_misc.c')
-rw-r--r--src/game/bg_misc.c2653
1 files changed, 315 insertions, 2338 deletions
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 ) );
}