summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2001-08-28 18:35:20 +0000
committerTim Angus <tim@ngus.net>2001-08-28 18:35:20 +0000
commit0ec416c5c51458d1faac712884c2d7cbddd2eb43 (patch)
tree04dd2d2387857a7d5583f70a13bd5b6717796420 /src/game
parent5af435dc4a2c87798f1b72b1e113209e1d1c2de4 (diff)
Ceiling eggs
Diffstat (limited to 'src/game')
-rw-r--r--src/game/bg_misc.c106
-rw-r--r--src/game/bg_public.h7
-rw-r--r--src/game/g_buildable.c29
-rw-r--r--src/game/g_client.c15
-rw-r--r--src/game/g_cmds.c27
-rw-r--r--src/game/g_local.h4
6 files changed, 155 insertions, 33 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 4741f15d..408be48c 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -1165,6 +1165,8 @@ buildableAttributes_t bg_buildableList[ ] =
0, //int turretFireSpeed;
0, //int turretRange;
WP_NONE, //weapon_t turretProjType;
+ 0.5f, //float minNormal;
+ qtrue, //qboolean invertNormal;
qfalse, //qboolean creepTest;
qfalse //qboolean reactorTest;
},
@@ -1189,6 +1191,8 @@ buildableAttributes_t bg_buildableList[ ] =
0, //int turretFireSpeed;
0, //int turretRange;
WP_NONE, //weapon_t turretProjType;
+ 0.707f, //float minNormal;
+ qfalse, //qboolean invertNormal;
qtrue, //qboolean creepTest;
qfalse //qboolean reactorTest;
},
@@ -1213,6 +1217,8 @@ buildableAttributes_t bg_buildableList[ ] =
1500, //int turretFireSpeed;
500, //int turretRange;
WP_SAWBLADE_LAUNCHER, //weapon_t turretProjType;
+ 0.707f, //float minNormal;
+ qfalse, //qboolean invertNormal;
qtrue, //qboolean creepTest;
qfalse //qboolean reactorTest;
},
@@ -1237,6 +1243,8 @@ buildableAttributes_t bg_buildableList[ ] =
0, //int turretFireSpeed;
0, //int turretRange;
WP_NONE, //weapon_t turretProjType;
+ 0.707f, //float minNormal;
+ qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
qtrue //qboolean reactorTest;
},
@@ -1261,6 +1269,8 @@ buildableAttributes_t bg_buildableList[ ] =
0, //int turretFireSpeed;
0, //int turretRange;
WP_NONE, //weapon_t turretProjType;
+ 0.707f, //float minNormal;
+ qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
qfalse //qboolean reactorTest;
},
@@ -1285,6 +1295,8 @@ buildableAttributes_t bg_buildableList[ ] =
500, //int turretFireSpeed;
500, //int turretRange;
WP_PLASMAGUN, //weapon_t turretProjType;
+ 0.707f, //float minNormal;
+ qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
qfalse //qboolean reactorTest;
},
@@ -1309,6 +1321,8 @@ buildableAttributes_t bg_buildableList[ ] =
50, //int turretFireSpeed;
300, //int turretRange;
WP_MACHINEGUN, //weapon_t turretProjType;
+ 0.707f, //float minNormal;
+ qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
qfalse //qboolean reactorTest;
},
@@ -1333,6 +1347,8 @@ buildableAttributes_t bg_buildableList[ ] =
4000, //int turretFireSpeed;
1500, //int turretRange;
WP_RAILGUN, //weapon_t turretProjType;
+ 0.707f, //float minNormal;
+ qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
qfalse //qboolean reactorTest;
},
@@ -1357,6 +1373,8 @@ buildableAttributes_t bg_buildableList[ ] =
0, //int turretFireSpeed;
0, //int turretRange;
WP_NONE, //weapon_t turretProjType;
+ 0.707f, //float minNormal;
+ qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
qfalse //qboolean reactorTest;
},
@@ -1381,6 +1399,8 @@ buildableAttributes_t bg_buildableList[ ] =
0, //int turretFireSpeed;
0, //int turretRange;
WP_NONE, //weapon_t turretProjType;
+ 0.707f, //float minNormal;
+ qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
qtrue //qboolean reactorTest;
},
@@ -1405,6 +1425,8 @@ buildableAttributes_t bg_buildableList[ ] =
0, //int turretFireSpeed;
0, //int turretRange;
WP_NONE, //weapon_t turretProjType;
+ 0.707f, //float minNormal;
+ qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
qfalse //qboolean reactorTest;
},
@@ -1429,6 +1451,8 @@ buildableAttributes_t bg_buildableList[ ] =
0, //int turretFireSpeed;
0, //int turretRange;
WP_NONE, //weapon_t turretProjType;
+ 0.707f, //float minNormal;
+ qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
qfalse //qboolean reactorTest;
}
@@ -1844,6 +1868,46 @@ weapon_t BG_FindProjTypeForBuildable( int bclass )
/*
==============
+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
==============
*/
@@ -1901,6 +1965,7 @@ classAttributes_t bg_classList[ ] =
0, //int armor;
SCA_TAKESFALLDAMAGE|SCA_FOVWARPS, //int abilities;
50.0f, //float buildDist;
+ 1000.0f, //float launchSpeed;
80, //int fov;
0.015f, //float bob;
350, //int steptime;
@@ -1925,6 +1990,7 @@ classAttributes_t bg_classList[ ] =
10, //int armor;
SCA_CANJUMP|SCA_FOVWARPS, //int abilities;
50.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
110, //int fov;
0.005f, //float bob;
200, //int steptime;
@@ -1949,6 +2015,7 @@ classAttributes_t bg_classList[ ] =
40, //int armor;
SCA_TAKESFALLDAMAGE|SCA_FOVWARPS, //int abilities;
50.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
90, //int fov;
0.015f, //float bob;
350, //int steptime;
@@ -1973,6 +2040,7 @@ classAttributes_t bg_classList[ ] =
40, //int armor;
SCA_CANJUMP|SCA_FOVWARPS, //int abilities;
50.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
120, //int fov;
0.002f, //float bob;
350, //int steptime;
@@ -1997,6 +2065,7 @@ classAttributes_t bg_classList[ ] =
40, //int armor;
SCA_CANJUMP|SCA_FOVWARPS, //int abilities;
50.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
100, //int fov;
0.015f, //float bob;
350, //int steptime;
@@ -2021,6 +2090,7 @@ classAttributes_t bg_classList[ ] =
0, //int armor;
SCA_WALLCLIMBER|SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
140, //int fov;
0.0f, //float bob;
25, //int steptime;
@@ -2045,6 +2115,7 @@ classAttributes_t bg_classList[ ] =
5, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
120, //int fov;
0.001f, //float bob;
25, //int steptime;
@@ -2069,6 +2140,7 @@ classAttributes_t bg_classList[ ] =
10, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
120, //int fov;
0.0005f, //float bob;
25, //int steptime;
@@ -2093,6 +2165,7 @@ classAttributes_t bg_classList[ ] =
20, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
130, //int fov;
0.0f, //float bob;
60, //int steptime;
@@ -2117,6 +2190,7 @@ classAttributes_t bg_classList[ ] =
30, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
130, //int fov;
0.0f, //float bob;
60, //int steptime;
@@ -2141,6 +2215,7 @@ classAttributes_t bg_classList[ ] =
40, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
120, //int fov;
0.0f, //float bob;
200, //int steptime;
@@ -2165,6 +2240,7 @@ classAttributes_t bg_classList[ ] =
50, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
120, //int fov;
0.0f, //float bob;
200, //int steptime;
@@ -2189,6 +2265,7 @@ classAttributes_t bg_classList[ ] =
60, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
120, //int fov;
0.0f, //float bob;
200, //int steptime;
@@ -2213,6 +2290,7 @@ classAttributes_t bg_classList[ ] =
0, //int armor;
SCA_WALLCLIMBER|SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
90, //int fov;
0.0f, //float bob;
25, //int steptime;
@@ -2237,6 +2315,7 @@ classAttributes_t bg_classList[ ] =
50, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
100, //int fov;
0.0f, //float bob;
25, //int steptime;
@@ -2261,6 +2340,7 @@ classAttributes_t bg_classList[ ] =
50, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
100, //int fov;
0.0f, //float bob;
25, //int steptime;
@@ -2285,6 +2365,7 @@ classAttributes_t bg_classList[ ] =
50, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
110, //int fov;
0.0f, //float bob;
25, //int steptime;
@@ -2309,6 +2390,7 @@ classAttributes_t bg_classList[ ] =
50, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
110, //int fov;
0.0f, //float bob;
25, //int steptime;
@@ -2333,6 +2415,7 @@ classAttributes_t bg_classList[ ] =
50, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
130, //int fov;
0.0f, //float bob;
25, //int steptime;
@@ -2357,6 +2440,7 @@ classAttributes_t bg_classList[ ] =
50, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
130, //int fov;
0.0f, //float bob;
25, //int steptime;
@@ -2381,6 +2465,7 @@ classAttributes_t bg_classList[ ] =
50, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
130, //int fov;
0.0f, //float bob;
25, //int steptime;
@@ -2405,6 +2490,7 @@ classAttributes_t bg_classList[ ] =
0, //int armor;
SCA_TAKESFALLDAMAGE|SCA_CANJUMP, //int abilities;
80.0f, //float buildDist;
+ 0.0f, //float launchSpeed;
90, //int fov;
0.002f, //float bob;
200, //int steptime;
@@ -2739,6 +2825,26 @@ float BG_FindBuildDistForClass( int pclass )
/*
==============
+BG_FindLaunchSpeedForClass
+==============
+*/
+float BG_FindLaunchSpeedForClass( int pclass )
+{
+ int i;
+
+ for( i = 0; i < bg_numPclasses; i++ )
+ {
+ if( bg_classList[ i ].classNum == pclass )
+ {
+ return bg_classList[ i ].launchSpeed;
+ }
+ }
+
+ return 0.0f;
+}
+
+/*
+==============
BG_ClassCanEvolveFromTo
==============
*/
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index 1c068d35..1a78753a 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -832,6 +832,7 @@ typedef struct
int abilities;
float buildDist;
+ float launchSpeed;
int fov;
float bob;
@@ -879,6 +880,9 @@ typedef struct
int turretRange;
weapon_t turretProjType;
+ float minNormal;
+ qboolean invertNormal;
+
qboolean creepTest;
qboolean reactorTest;
} buildableAttributes_t;
@@ -948,6 +952,8 @@ int BG_FindNextThinkForBuildable( int bclass );
int BG_FindFireSpeedForBuildable( int bclass );
int BG_FindRangeForBuildable( int bclass );
weapon_t BG_FindProjTypeForBuildable( int bclass );
+float BG_FindMinNormalForBuildable( int bclass );
+qboolean BG_FindInvertNormalForBuildable( int bclass );
int BG_FindCreepTestForBuildable( int bclass );
int BG_FindUniqueTestForBuildable( int bclass );
@@ -965,6 +971,7 @@ float BG_FindStickyForClass( int pclass );
int BG_FindSteptimeForClass( int pclass );
qboolean BG_ClassHasAbility( int pclass, int ability );
float BG_FindBuildDistForClass( int pclass );
+float BG_FindLaunchSpeedForClass( int pclass );
qboolean BG_ClassCanEvolveFromTo( int fclass, int tclass );
int BG_FindEvolveTimeForClass( int pclass );
int BG_FindValueOfClass( int pclass );
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index bd1332e2..289a65eb 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -1111,12 +1111,12 @@ void HSpawn_Think( gentity_t *self )
/*
================
-itemFits
+G_itemFits
Checks to see if an item fits in a specific area
================
*/
-itemBuildError_t itemFits( gentity_t *ent, buildable_t buildable, int distance )
+itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance )
{
vec3_t forward;
vec3_t angles;
@@ -1149,10 +1149,8 @@ itemBuildError_t itemFits( gentity_t *ent, buildable_t buildable, int distance )
if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_DROIDS )
{
//droid criteria
- if( level.droidBuildPoints - BG_FindBuildPointsForBuildable( buildable ) < 0 )
- reason = IBE_NOASSERT;
-
//check there is creep near by for building on
+
if( BG_FindCreepTestForBuildable( buildable ) )
{
for ( i = 1, tempent = g_entities + i; i < level.num_entities; i++, tempent++ )
@@ -1198,12 +1196,15 @@ itemBuildError_t itemFits( gentity_t *ent, buildable_t buildable, int distance )
}
}
}
+
+ if( level.droidBuildPoints - BG_FindBuildPointsForBuildable( buildable ) < 0 )
+ reason = IBE_NOASSERT;
+
+ G_Printf( "%d %d\n", level.droidBuildPoints );
}
else if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
{
//human criteria
- if( level.humanBuildPoints - BG_FindBuildPointsForBuildable( buildable ) < 0 )
- reason = IBE_NOPOWER;
closestPower = g_entities + 1; //FIXME
@@ -1274,6 +1275,9 @@ itemBuildError_t itemFits( gentity_t *ent, buildable_t buildable, int distance )
}
}
}
+
+ if( level.humanBuildPoints - BG_FindBuildPointsForBuildable( buildable ) < 0 )
+ reason = IBE_NOPOWER;
}
return reason;
@@ -1282,12 +1286,13 @@ itemBuildError_t itemFits( gentity_t *ent, buildable_t buildable, int distance )
/*
================
-Build_Item
+G_buildItem
-Spawns an item and tosses it forward
+Spawns a buildable
================
*/
-gentity_t *Build_Item( gentity_t *ent, buildable_t buildable, int distance ) {
+gentity_t *G_buildItem( gentity_t *ent, buildable_t buildable, int distance, float speed )
+{
vec3_t forward;
vec3_t angles;
vec3_t origin;
@@ -1410,6 +1415,10 @@ gentity_t *Build_Item( gentity_t *ent, buildable_t buildable, int distance ) {
built->s.pos.trType = BG_FindTrajectoryForBuildable( buildable );
built->physicsBounce = BG_FindBounceForBuildable( buildable );
built->s.pos.trTime = level.time;
+ AngleVectors( ent->s.apos.trBase, built->s.pos.trDelta, NULL, NULL );
+
+ VectorScale( built->s.pos.trDelta, speed, built->s.pos.trDelta );
+ VectorSet( built->s.origin2, 0.0f, 0.0f, 1.0f );
G_AddEvent( built, EV_BUILD_CONSTRUCT, BANIM_CONSTRUCT1 );
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 9a6d1226..d9928cc4 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -384,23 +384,16 @@ gentity_t *SelectTremulousSpawnPoint( int team, vec3_t origin, vec3_t angles )
//no available spots
if( !spot )
- {
return NULL;
- }
-
- // find a single player start spot
- if (!spot) {
- //G_Error( "Couldn't find a spawn point" );
- }
//TA: why isn't spot->s.origin being set?
- VectorCopy (spot->s.pos.trBase, origin);
- VectorCopy (spot->s.angles, angles);
+ VectorCopy( spot->s.pos.trBase, origin );
+ VectorCopy( spot->s.angles, angles );
if( team == PTE_DROIDS )
- origin[2] += 40;
+ VectorMA( origin, 40.0f, spot->s.origin2, origin );
else if( team == PTE_HUMANS )
- origin[2] += 29;
+ VectorMA( origin, 29.0f, spot->s.origin2, origin );
return spot;
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 29b1f27c..35a453a4 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -2004,23 +2004,30 @@ Cmd_Build_f
void Cmd_Build_f( gentity_t *ent )
{
char s[ MAX_TOKEN_CHARS ];
+ char s1[ MAX_TOKEN_CHARS ];
buildable_t buildable;
weapon_t weapon;
- float dist;
+ float dist, speed, maxspeed;
trap_Argv( 1, s, sizeof( s ) );
+ trap_Argv( 2, s1, sizeof( s1 ) );
buildable = BG_FindBuildNumForName( s );
+ speed = atof( s1 );
+ maxspeed = BG_FindLaunchSpeedForClass( ent->client->ps.stats[ STAT_PCLASS ] );
+
+ if( speed > maxspeed )
+ speed = maxspeed;
if( buildable != BA_NONE &&
( 1 << ent->client->ps.weapon ) & BG_FindBuildWeaponForBuildable( buildable ) )
{
dist = BG_FindBuildDistForClass( ent->client->ps.stats[ STAT_PCLASS ] );
- switch( itemFits( ent, buildable, dist ) )
+ switch( G_itemFits( ent, buildable, dist ) )
{
case IBE_NONE:
- Build_Item( ent, buildable, dist );
+ G_buildItem( ent, buildable, dist, speed );
break;
case IBE_NOCREEP:
@@ -2039,11 +2046,6 @@ void Cmd_Build_f( gentity_t *ent )
G_AddPredictableEvent( ent, EV_MENU, MN_D_HIVEMIND );
break;
- case IBE_SPWNWARN:
- G_AddPredictableEvent( ent, EV_MENU, MN_D_SPWNWARN );
- Build_Item( ent, buildable, dist );
- break;
-
case IBE_REACTOR:
G_AddPredictableEvent( ent, EV_MENU, MN_H_REACTOR );
break;
@@ -2063,14 +2065,19 @@ void Cmd_Build_f( gentity_t *ent )
G_AddPredictableEvent( ent, EV_MENU, MN_H_NOPOWER );
break;
+ case IBE_SPWNWARN:
+ G_AddPredictableEvent( ent, EV_MENU, MN_D_SPWNWARN );
+ G_buildItem( ent, buildable, dist, speed );
+ break;
+
case IBE_RPLWARN:
G_AddPredictableEvent( ent, EV_MENU, MN_H_RPLWARN );
- Build_Item( ent, buildable, dist );
+ G_buildItem( ent, buildable, dist, speed );
break;
case IBE_RPTWARN:
G_AddPredictableEvent( ent, EV_MENU, MN_H_RPTWARN );
- Build_Item( ent, buildable, dist );
+ G_buildItem( ent, buildable, dist, speed );
break;
}
}
diff --git a/src/game/g_local.h b/src/game/g_local.h
index bd77686e..0fcfdc75 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -540,8 +540,8 @@ typedef enum
IBE_MAXERRORS
} itemBuildError_t;
-itemBuildError_t itemFits( gentity_t *ent, buildable_t buildable, int distance );
-gentity_t *Build_Item( gentity_t *ent, buildable_t buildable, int distance );
+itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance );
+gentity_t *G_buildItem( gentity_t *ent, buildable_t buildable, int distance, float speed );
void G_setBuildableAnim( gentity_t *ent, buildableAnimNumber_t anim );
void G_setIdleBuildableAnim( gentity_t *ent, buildableAnimNumber_t anim );