summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cgame/cg_buildable.c22
-rw-r--r--src/game/bg_misc.c33
-rw-r--r--src/game/bg_public.h2
-rw-r--r--src/game/g_active.c28
-rw-r--r--src/game/g_buildable.c15
-rw-r--r--src/game/g_cmds.c28
-rw-r--r--src/game/g_local.h7
-rw-r--r--src/game/g_weapon.c3
8 files changed, 49 insertions, 89 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c
index 08b91b3c..c550d11a 100644
--- a/src/cgame/cg_buildable.c
+++ b/src/cgame/cg_buildable.c
@@ -295,7 +295,7 @@ void CG_GhostBuildable( buildable_t buildable )
{
refEntity_t ent;
playerState_t *ps;
- vec3_t angles, forward, player_origin, entity_origin, target_origin;
+ vec3_t angles, forward, player_origin, entity_origin, target_origin, normal;
vec3_t mins, maxs, start, end;
float distance;
trace_t tr;
@@ -306,6 +306,7 @@ void CG_GhostBuildable( buildable_t buildable )
VectorCopy( cg.predictedPlayerState.viewangles, angles );
angles[ PITCH ] = 0; // always forward
+ /////FIXME PITCH CAN'T BE ZERO
AngleVectors( angles, forward, NULL, NULL );
VectorCopy( ps->origin, player_origin );
@@ -313,15 +314,28 @@ void CG_GhostBuildable( buildable_t buildable )
distance = BG_FindBuildDistForClass( ps->stats[ STAT_PCLASS ] );
VectorMA( player_origin, distance, forward, entity_origin );
+ if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_WALLCLIMBING )
+ {
+ if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )
+ VectorSet( normal, 0.0f, 0.0f, -1.0f );
+ else
+ VectorCopy( cg.predictedPlayerState.grapplePoint, normal );
+ }
+ else
+ VectorSet( normal, 0.0f, 0.0f, 1.0f );
+
VectorCopy( entity_origin, target_origin );
- entity_origin[ 2 ] += 32;
- target_origin[ 2 ] -= 4096;
+ VectorMA( entity_origin, 32, normal, entity_origin );
+ VectorMA( target_origin, -4096, normal, target_origin );
+/* entity_origin[ 2 ] += 32;
+ target_origin[ 2 ] -= 4096;*/
BG_FindBBoxForBuildable( buildable, mins, maxs );
CG_Trace( &tr, entity_origin, mins, maxs, target_origin, ps->clientNum, MASK_PLAYERSOLID );
VectorCopy( tr.endpos, entity_origin );
- entity_origin[ 2 ] += 0.1f;
+ /*entity_origin[ 2 ] += 0.1f;*/
+ VectorMA( entity_origin, 0.1f, normal, entity_origin );
AngleVectors( angles, forward, NULL, NULL );
VectorCopy( tr.plane.normal, ent.axis[2] );
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 1b25d3ed..2c294919 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -2251,7 +2251,6 @@ 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.005f, //float bob;
350, //int steptime;
@@ -2274,9 +2273,8 @@ classAttributes_t bg_classList[ ] =
12, 12, //int viewheight, crouchviewheight;
75, //int health;
10, //int armor;
- SCA_CANJUMP|SCA_FOVWARPS, //int abilities;
+ SCA_CANJUMP|SCA_FOVWARPS|SCA_WALLCLIMBER, //int abilities;
50.0f, //float buildDist;
- 0.0f, //float launchSpeed;
110, //int fov;
0.005f, //float bob;
200, //int steptime;
@@ -2301,7 +2299,6 @@ 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;
@@ -2326,7 +2323,6 @@ 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;
@@ -2351,7 +2347,6 @@ 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;
@@ -2376,7 +2371,6 @@ 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;
@@ -2401,7 +2395,6 @@ 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;
@@ -2426,7 +2419,6 @@ 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;
@@ -2451,7 +2443,6 @@ 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;
@@ -2476,7 +2467,6 @@ 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;
@@ -2501,7 +2491,6 @@ 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;
@@ -2836,26 +2825,6 @@ 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 d1653cba..cfd603d6 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -827,7 +827,6 @@ typedef struct
int abilities;
float buildDist;
- float launchSpeed;
int fov;
float bob;
@@ -972,7 +971,6 @@ 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_active.c b/src/game/g_active.c
index eba06a2a..e2961acc 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -415,8 +415,6 @@ void ClientTimerActions( gentity_t *ent, int msec )
gclient_t *client;
usercmd_t *ucmd;
int aForward, aRight;
- float maxspeed =
- BG_FindLaunchSpeedForClass( ent->client->ps.stats[ STAT_PCLASS ] );
ucmd = &ent->client->pers.cmd;
@@ -501,36 +499,14 @@ void ClientTimerActions( gentity_t *ent, int msec )
case WP_DBUILD2:
case WP_HBUILD:
case WP_HBUILD2:
- //charge up launch velocity
- if( client->ps.stats[ STAT_MISC ] < maxspeed && ucmd->buttons & BUTTON_ATTACK )
- client->ps.stats[ STAT_MISC ] += ( 100.0f / LAUNCH_TIME ) * maxspeed;
-
- //not holding attack anymore and allowed to launch so build
- if( !( ucmd->buttons & BUTTON_ATTACK ) && client->allowedToLaunch )
- {
- if( !BG_FindInvertNormalForBuildable( client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) )
- client->ps.stats[ STAT_MISC ] = 0;
-
- G_ValidateBuild( ent,
- client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT,
- client->ps.stats[ STAT_MISC ] );
-
- client->ps.stats[ STAT_BUILDABLE ] = BA_NONE;
- client->allowedToLaunch = qfalse;
- client->ps.stats[ STAT_MISC ] = 0;
- }
-
- //cap speed
- if( client->ps.stats[ STAT_MISC ] > maxspeed )
- client->ps.stats[ STAT_MISC ] = maxspeed;
-
//set validity bit on buildable
if( ( client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) > BA_NONE )
{
int dist = BG_FindBuildDistForClass( ent->client->ps.stats[ STAT_PCLASS ] );
vec3_t dummy;
- if( G_itemFits( ent, client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT, dist, dummy ) == IBE_NONE )
+ if( G_itemFits( ent, client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT,
+ dist, dummy ) == IBE_NONE )
client->ps.stats[ STAT_BUILDABLE ] |= SB_VALID_TOGGLEBIT;
else
client->ps.stats[ STAT_BUILDABLE ] &= ~SB_VALID_TOGGLEBIT;
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index c3c74621..9fa2724b 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -1676,7 +1676,7 @@ G_buildItem
Spawns a buildable
================
*/
-gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin, vec3_t angles, float speed )
+gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin, vec3_t angles )
{
gentity_t *built;
@@ -1813,14 +1813,11 @@ gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin
VectorCopy( angles, built->s.angles );
built->s.angles[ PITCH ] = 0.0f;
built->s.angles2[ YAW ] = angles[ YAW ];
- VectorCopy( origin, built->s.origin );
built->s.pos.trType = BG_FindTrajectoryForBuildable( buildable );
built->physicsBounce = BG_FindBounceForBuildable( buildable );
built->s.groundEntityNum = -1;
built->s.pos.trTime = level.time;
- AngleVectors( angles, 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 );
@@ -1835,7 +1832,7 @@ gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin
G_ValidateBuild
=================
*/
-void G_ValidateBuild( gentity_t *ent, buildable_t buildable, float speed )
+void G_ValidateBuild( gentity_t *ent, buildable_t buildable )
{
weapon_t weapon;
float dist;
@@ -1846,7 +1843,7 @@ void G_ValidateBuild( gentity_t *ent, buildable_t buildable, float speed )
switch( G_itemFits( ent, buildable, dist, origin ) )
{
case IBE_NONE:
- G_buildItem( ent, buildable, origin, ent->s.apos.trBase, speed );
+ G_buildItem( ent, buildable, origin, ent->s.apos.trBase );
break;
case IBE_NOASSERT:
@@ -1882,17 +1879,17 @@ void G_ValidateBuild( gentity_t *ent, buildable_t buildable, float speed )
case IBE_SPWNWARN:
G_AddPredictableEvent( ent, EV_MENU, MN_D_SPWNWARN );
- G_buildItem( ent, buildable, origin, ent->s.apos.trBase, speed );
+ G_buildItem( ent, buildable, origin, ent->s.apos.trBase );
break;
case IBE_RPLWARN:
G_AddPredictableEvent( ent, EV_MENU, MN_H_RPLWARN );
- G_buildItem( ent, buildable, origin, ent->s.apos.trBase, speed );
+ G_buildItem( ent, buildable, origin, ent->s.apos.trBase );
break;
case IBE_RPTWARN:
G_AddPredictableEvent( ent, EV_MENU, MN_H_RPTWARN );
- G_buildItem( ent, buildable, origin, ent->s.apos.trBase, speed );
+ G_buildItem( ent, buildable, origin, ent->s.apos.trBase );
break;
}
}
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 65179b7a..1f6c5e68 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -1536,6 +1536,7 @@ void Cmd_TorchOff_f( gentity_t *ent )
ent->client->torch = NULL;
}
+#define NUM_AC 3
/*
=================
@@ -1553,6 +1554,9 @@ void Cmd_Class_f( gentity_t *ent )
int i;
trace_t tr;
vec3_t infestOrigin, infestAngles;
+ int allowedClasses[ NUM_AC ] = { PCL_D_B_BASE,
+ PCL_D_B_LEV1,
+ PCL_D_O_BASE };
clientNum = ent->client - level.clients;
trap_Argv( 1, s, sizeof( s ) );
@@ -1626,9 +1630,19 @@ void Cmd_Class_f( gentity_t *ent )
if( ent->client->pers.pclass != PCL_NONE )
{
- ent->client->sess.sessionTeam = TEAM_FREE;
- ClientUserinfoChanged( clientNum );
- ClientSpawn( ent, NULL );
+ for( i = 0; i < NUM_AC; i++ )
+ {
+ if( allowedClasses[ i ] == ent->client->pers.pclass )
+ {
+ ent->client->sess.sessionTeam = TEAM_FREE;
+ ClientUserinfoChanged( clientNum );
+ ClientSpawn( ent, NULL );
+ return;
+ }
+ }
+
+ ent->client->pers.pclass = PCL_NONE;
+ trap_SendServerCommand( ent-g_entities, va("print \"You cannot spawn as this class\n\"" ) );
}
else
{
@@ -2087,18 +2101,12 @@ void Cmd_Build_f( gentity_t *ent )
char s1[ MAX_TOKEN_CHARS ];
buildable_t buildable;
weapon_t weapon;
- float dist, speed, maxspeed;
+ float dist;
vec3_t origin;
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 ) )
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 20b69176..5b51935a 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -341,9 +341,6 @@ struct gclient_s {
int pouncePayload; //TA: amount of damage pounce attack will do
qboolean allowedToPounce;
-
- int launchSpeed; //TA: speed at which to launch buildable
- qboolean allowedToLaunch;
};
#define MAX_LOCDAMAGE_TEXT 8192
@@ -543,8 +540,8 @@ typedef enum
} itemBuildError_t;
itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance, vec3_t origin );
-gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin, vec3_t angles, float speed );
-void G_ValidateBuild( gentity_t *ent, buildable_t buildable, float speed );
+gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin, vec3_t angles );
+void G_ValidateBuild( gentity_t *ent, buildable_t buildable );
void G_setBuildableAnim( gentity_t *ent, buildableAnimNumber_t anim, qboolean force );
void G_setIdleBuildableAnim( gentity_t *ent, buildableAnimNumber_t anim );
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index 75aebbe9..e36c42c4 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -636,7 +636,8 @@ void Weapon_Build_Fire( gentity_t *ent, dynMenu_t menu )
{
if( ( ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) > BA_NONE )
{
- ent->client->allowedToLaunch = qtrue;
+ G_ValidateBuild( ent, ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT );
+ ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE;
return;
}