summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/bg_misc.c1
-rw-r--r--src/game/g_active.c28
-rw-r--r--src/game/g_buildable.c11
-rw-r--r--src/game/g_cmds.c10
-rw-r--r--src/game/g_local.h5
-rw-r--r--src/game/g_weapon.c8
6 files changed, 44 insertions, 19 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 43aa0359..0270b0d4 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -1092,6 +1092,7 @@ TA: human defense item
"" //sounds
},
+
/*QUAKED upgrade_torch (0 0 1) (-16 -16 -16) (16 16 16)
*/
{
diff --git a/src/game/g_active.c b/src/game/g_active.c
index e4ae4d6a..eba06a2a 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -415,6 +415,8 @@ 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;
@@ -491,12 +493,38 @@ void ClientTimerActions( gentity_t *ent, int msec )
client->ps.stats[ STAT_MISC ] = MAX_POUNCE_SPEED;
}
+#define LAUNCH_TIME 2000
+
switch( client->ps.weapon )
{
case WP_DBUILD:
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 ] );
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 6cd83ff3..d0dd170d 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -1810,19 +1810,12 @@ gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin
G_ValidateBuild
=================
*/
-void G_ValidateBuild( gentity_t *ent, buildable_t buildable )
+void G_ValidateBuild( gentity_t *ent, buildable_t buildable, float speed )
{
weapon_t weapon;
- float dist, speed, maxspeed;
+ float dist;
vec3_t origin;
- speed = 0.0f; //temp hack
-
- maxspeed = BG_FindLaunchSpeedForClass( ent->client->ps.stats[ STAT_PCLASS ] );
-
- if( speed > maxspeed )
- speed = maxspeed;
-
dist = BG_FindBuildDistForClass( ent->client->ps.stats[ STAT_PCLASS ] );
switch( G_itemFits( ent, buildable, dist, origin ) )
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 7c5389fc..65179b7a 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -1805,7 +1805,7 @@ void Cmd_Buy_f( gentity_t *ent )
if( mcuEntity->s.eType != ET_BUILDABLE )
continue;
- if( mcuEntity->s.clientNum == BA_H_MCU )
+ if( mcuEntity->s.modelindex == BA_H_MCU )
{
VectorSubtract( ent->s.pos.trBase, mcuEntity->s.origin, distance );
if( VectorLength( distance ) <= 100 )
@@ -1919,7 +1919,7 @@ void Cmd_Sell_f( gentity_t *ent )
if( mcuEntity->s.eType != ET_BUILDABLE )
continue;
- if( mcuEntity->s.clientNum == BA_H_MCU )
+ if( mcuEntity->s.modelindex == BA_H_MCU )
{
VectorSubtract( ent->s.pos.trBase, mcuEntity->s.origin, distance );
if( VectorLength( distance ) <= 100 )
@@ -1991,7 +1991,7 @@ void Cmd_Deposit_f( gentity_t *ent )
if( bankEntity->s.eType != ET_BUILDABLE )
continue;
- if( bankEntity->s.clientNum == BA_H_BANK )
+ if( bankEntity->s.modelindex == BA_H_BANK )
{
VectorSubtract( ent->s.pos.trBase, bankEntity->s.origin, distance );
if( VectorLength( distance ) <= 100 )
@@ -2046,7 +2046,7 @@ void Cmd_Withdraw_f( gentity_t *ent )
if( bankEntity->s.eType != ET_BUILDABLE )
continue;
- if( bankEntity->s.clientNum == BA_H_BANK )
+ if( bankEntity->s.modelindex == BA_H_BANK )
{
VectorSubtract( ent->s.pos.trBase, bankEntity->s.origin, distance );
if( VectorLength( distance ) <= 100 )
@@ -2112,7 +2112,7 @@ void Cmd_Build_f( gentity_t *ent )
case IBE_RPTWARN:
case IBE_SPWNWARN:
case IBE_NOROOM:
- ent->client->ps.stats[ STAT_BUILDABLE ] = buildable;
+ ent->client->ps.stats[ STAT_BUILDABLE ] = ( buildable | SB_VALID_TOGGLEBIT );
break;
case IBE_NOASSERT:
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 40419f0e..20b69176 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -341,6 +341,9 @@ 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
@@ -541,7 +544,7 @@ typedef enum
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 );
+void G_ValidateBuild( gentity_t *ent, buildable_t buildable, float speed );
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 3d639fd6..75aebbe9 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -636,11 +636,11 @@ void Weapon_Build_Fire( gentity_t *ent, dynMenu_t menu )
{
if( ( ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) > BA_NONE )
{
- ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE;
- G_ValidateBuild( ent, ent->client->ps.stats[ STAT_BUILDABLE ] );
+ ent->client->allowedToLaunch = qtrue;
+ return;
}
- else
- G_AddPredictableEvent( ent, EV_MENU, menu );
+
+ G_AddPredictableEvent( ent, EV_MENU, menu );
}