summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2003-08-27 02:08:28 +0000
committerTim Angus <tim@ngus.net>2003-08-27 02:08:28 +0000
commit4b492e5cbf89108d9f49981ee11e065a57914226 (patch)
tree436a3387387bf52b85c5441b19f5eb546be52511
parentcaf924c83b11c0ccfe08df26935c699423116924 (diff)
* Partial mofo charge ability from centuries ago
-rw-r--r--src/cgame/cg_view.c8
-rw-r--r--src/game/bg_misc.c2
-rw-r--r--src/game/bg_pmove.c43
-rw-r--r--src/game/bg_public.h2
-rw-r--r--src/game/g_active.c26
-rw-r--r--src/game/g_local.h4
-rw-r--r--src/game/g_weapon.c84
-rw-r--r--src/game/tremulous.h5
8 files changed, 132 insertions, 42 deletions
diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c
index f69984bd..80b1101c 100644
--- a/src/cgame/cg_view.c
+++ b/src/cgame/cg_view.c
@@ -484,7 +484,8 @@ static void CG_OffsetFirstPersonView( void )
//provide some feedback for pouncing
if( cg.predictedPlayerState.weapon == WP_POUNCE ||
- cg.predictedPlayerState.weapon == WP_POUNCE_UPG )
+ cg.predictedPlayerState.weapon == WP_POUNCE_UPG ||
+ cg.predictedPlayerState.weapon == WP_GROUND_POUND )
{
if( cg.predictedPlayerState.stats[ STAT_MISC ] > 0 )
{
@@ -494,7 +495,10 @@ static void CG_OffsetFirstPersonView( void )
AngleVectors( angles, forward, NULL, NULL );
VectorNormalize( forward );
- fraction1 = (float)( cg.time - cg.weapon2Time ) / (float)DRAGOON_POUNCE_TIME;
+ if( cg.predictedPlayerState.weapon == WP_GROUND_POUND )
+ fraction1 = (float)( cg.time - cg.weapon2Time ) / (float)BMOFO_CHARGE_TIME;
+ else
+ fraction1 = (float)( cg.time - cg.weapon2Time ) / (float)DRAGOON_POUNCE_TIME;
if( fraction1 > 1.0f )
fraction1 = 1.0f;
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 7311a6a6..7e41c7fa 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -2563,7 +2563,7 @@ weaponAttributes_t bg_weapons[ ] =
BMOFO_KNOCK_REPEAT, //int repeatRate2;
BMOFO_CLAW_REPEAT, //int repeatRate3;
0, //int reloadTime;
- qtrue, //qboolean hasAltMode;
+ qfalse, //qboolean hasAltMode;
qtrue, //qboolean hasThirdMode;
qfalse, //qboolean purchasable;
0, //int buildDelay;
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index 43d6f246..67194f97 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -458,6 +458,36 @@ static void PM_SetMovementDir( void )
/*
=============
+PM_CheckCharge
+=============
+*/
+static void PM_CheckCharge( void )
+{
+ vec3_t forward;
+
+ if( pm->ps->weapon != WP_GROUND_POUND )
+ return;
+
+ if( pm->cmd.buttons & BUTTON_ATTACK2 )
+ {
+ pm->ps->pm_flags &= ~PMF_CHARGE_POUNCE;
+ return;
+ }
+
+ if( pm->ps->pm_flags & PMF_CHARGE_POUNCE )
+ return;
+
+ if( pm->ps->stats[ STAT_MISC ] == 0 )
+ return;
+
+ pm->ps->pm_flags |= PMF_CHARGE_POUNCE;
+
+ AngleVectors( pm->ps->viewangles, forward, NULL, NULL );
+ VectorMA( pm->ps->velocity, pm->ps->stats[ STAT_MISC ], forward, pm->ps->velocity );
+}
+
+/*
+=============
PM_CheckPounce
=============
*/
@@ -470,11 +500,11 @@ static qboolean PM_CheckPounce( void )
if( pm->cmd.buttons & BUTTON_ATTACK2 )
{
- pm->ps->pm_flags &= ~PMF_POUNCE;
+ pm->ps->pm_flags &= ~PMF_CHARGE_POUNCE;
return qfalse;
}
- if( pm->ps->pm_flags & PMF_POUNCE )
+ if( pm->ps->pm_flags & PMF_CHARGE_POUNCE )
return qfalse;
if( pm->ps->stats[ STAT_MISC ] == 0 )
@@ -483,7 +513,7 @@ static qboolean PM_CheckPounce( void )
pml.groundPlane = qfalse; // jumping away
pml.walking = qfalse;
- pm->ps->pm_flags |= PMF_POUNCE;
+ pm->ps->pm_flags |= PMF_CHARGE_POUNCE;
pm->ps->groundEntityNum = ENTITYNUM_NONE;
@@ -529,6 +559,10 @@ static qboolean PM_CheckJump( void )
if( ( pm->ps->weapon == WP_POUNCE || pm->ps->weapon == WP_POUNCE_UPG ) && pm->ps->stats[ STAT_MISC ] > 0 )
return qfalse;
+ //can't jump and charge at the same time
+ if( ( pm->ps->weapon == WP_GROUND_POUND ) && pm->ps->stats[ STAT_MISC ] > 0 )
+ return qfalse;
+
if( ( pm->ps->stats[ STAT_PTEAM ] == PTE_HUMANS ) &&
( pm->ps->stats[ STAT_STAMINA ] < 0 ) )
return qfalse;
@@ -1083,6 +1117,9 @@ static void PM_WalkMove( void )
return;
}
+ //charging
+ PM_CheckCharge( );
+
PM_Friction( );
fmove = pm->cmd.forwardmove;
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index 70cbc944..1e9ffff9 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -139,7 +139,7 @@ typedef enum
#define PMF_FOLLOW 4096 // spectate following another player
#define PMF_SCOREBOARD 8192 // spectate as a scoreboard
#define PMF_INVULEXPAND 16384 // invulnerability sphere set to full size
-#define PMF_POUNCE 32768 //TA: keep track of pouncing
+#define PMF_CHARGE_POUNCE 32768 //TA: keep track of pouncing
#define PMF_ALL_TIMES (PMF_TIME_WATERJUMP|PMF_TIME_LAND|PMF_TIME_KNOCKBACK)
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 10086b41..35fa4c1f 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -484,6 +484,27 @@ void ClientTimerActions( gentity_t *ent, int msec )
client->ps.stats[ STAT_MISC ] = DRAGOON_POUNCE_SPEED;
}
+ //client is charging up for a charge
+ if( client->ps.weapon == WP_GROUND_POUND )
+ {
+ if( client->ps.stats[ STAT_MISC ] < BMOFO_CHARGE_SPEED && ucmd->buttons & BUTTON_ATTACK2 )
+ {
+ client->ps.stats[ STAT_MISC ] += ( 100.0f / (float)BMOFO_CHARGE_TIME ) * BMOFO_CHARGE_SPEED;
+ client->allowedToCharge = qtrue;
+ }
+
+ if( !( ucmd->buttons & BUTTON_ATTACK2 ) )
+ {
+ if( client->ps.stats[ STAT_MISC ] > 0 )
+ client->chargePayload = client->ps.stats[ STAT_MISC ];
+
+ client->ps.stats[ STAT_MISC ] = 0;
+ }
+
+ if( client->ps.stats[ STAT_MISC ] > BMOFO_CHARGE_SPEED )
+ client->ps.stats[ STAT_MISC ] = BMOFO_CHARGE_SPEED;
+ }
+
//client is charging up an lcannon
if( client->ps.weapon == WP_LUCIFER_CANNON )
{
@@ -950,6 +971,11 @@ void ClientThink_real( gentity_t *ent )
pm.autoWeaponHit[ client->ps.weapon ] = CheckPounceAttack( ent );
break;
+ case WP_GROUND_POUND:
+ if( client->ps.weaponTime <= 0 )
+ pm.autoWeaponHit[ client->ps.weapon ] = CheckChargeAttack( ent );
+ break;
+
default:
break;
}
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 471b1b91..dcfbf4be 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -360,6 +360,9 @@ struct gclient_s
int pouncePayload; //TA: amount of damage pounce attack will do
qboolean allowedToPounce;
+ int chargePayload; //TA: amount of damage charge attack will do
+ qboolean allowedToCharge;
+
vec3_t hovelOrigin; //TA: player origin before entering hovel
int lastFlameBall; //TA: s.number of the last flame ball fired
@@ -659,6 +662,7 @@ void SnapVectorTowards( vec3_t v, vec3_t to );
qboolean CheckVenomAttack( gentity_t *ent );
void CheckGrabAttack( gentity_t *ent );
qboolean CheckPounceAttack( gentity_t *ent );
+qboolean CheckChargeAttack( gentity_t *ent );
//
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index 5dfc7c1a..71d1b4c5 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -882,43 +882,60 @@ GROUND POUND
/*
===============
-groundPound
+CheckChargeAttack
===============
*/
-void groundPound( gentity_t *ent )
+qboolean CheckChargeAttack( gentity_t *ent )
{
- int entityList[ MAX_GENTITIES ];
- vec3_t range = { BMOFO_KNOCK_RANGE, BMOFO_KNOCK_RANGE, BMOFO_KNOCK_RANGE };
- vec3_t mins, maxs, dir;
- int i, num;
- gentity_t *humanPlayer;
-
- VectorAdd( ent->client->ps.origin, range, maxs );
- VectorSubtract( ent->client->ps.origin, range, mins );
-
- num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
- for( i = 0; i < num; i++ )
- {
- humanPlayer = &g_entities[ entityList[ i ] ];
+ //FIXME
+ trace_t tr;
+ vec3_t end;
+ gentity_t *tent;
+ gentity_t *traceEnt;
+ int damage;
+
+ if( !ent->client->allowedToCharge )
+ return qfalse;
+
+ // set aiming directions
+ AngleVectors( ent->client->ps.viewangles, forward, right, up );
+
+ CalcMuzzlePoint( ent, forward, right, up, muzzle );
+
+ VectorMA( muzzle, BMOFO_CHARGE_RANGE, forward, end );
+
+ trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT );
+
+ //miss
+ if( tr.fraction >= 1.0 )
+ return qfalse;
- if( humanPlayer->client && humanPlayer->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
- {
- if( !( humanPlayer->client->ps.stats[ STAT_STATE ] & SS_KNOCKEDOVER ) )
- {
- humanPlayer->client->ps.stats[ STAT_STATE ] |= SS_KNOCKEDOVER;
- humanPlayer->client->lastKnockedOverTime = level.time;
- G_AddPredictableEvent( humanPlayer, EV_KNOCKOVER, 0 );
-
- VectorCopy( humanPlayer->client->ps.viewangles, humanPlayer->client->ps.grapplePoint );
-
- //FIXME: fallover anim
- humanPlayer->client->ps.legsAnim =
- ( ( humanPlayer->client->ps.legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | BOTH_DEATH1;
- humanPlayer->client->ps.torsoAnim =
- ( ( humanPlayer->client->ps.torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | BOTH_DEATH1;
- }
- }
+ if( tr.surfaceFlags & SURF_NOIMPACT )
+ return qfalse;
+
+ traceEnt = &g_entities[ tr.entityNum ];
+
+ // send blood impact
+ if( traceEnt->takedamage && traceEnt->client )
+ {
+ tent = G_TempEntity( tr.endpos, EV_MISSILE_HIT );
+ tent->s.otherEntityNum = traceEnt->s.number;
+ tent->s.eventParm = DirToByte( tr.plane.normal );
+ tent->s.weapon = ent->s.weapon;
}
+
+ if( !traceEnt->takedamage )
+ return qfalse;
+
+ damage = (int)( ( (float)ent->client->chargePayload / (float)BMOFO_CHARGE_SPEED ) * BMOFO_CHARGE_DMG );
+
+ G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, DAMAGE_NO_KNOCKBACK, MOD_VENOM );
+
+ ent->client->allowedToCharge = qfalse;
+
+ G_Printf( "charge!\n" );
+
+ return qtrue;
}
//======================================================================
@@ -1008,9 +1025,6 @@ void FireWeapon2( gentity_t *ent )
case WP_DIRECT_ZAP:
directZapFire( ent );
break;
- case WP_GROUND_POUND:
- groundPound( ent );
- break;
case WP_LUCIFER_CANNON:
LCChargeFire( ent, qtrue );
diff --git a/src/game/tremulous.h b/src/game/tremulous.h
index 5c96d6da..47857a97 100644
--- a/src/game/tremulous.h
+++ b/src/game/tremulous.h
@@ -83,6 +83,11 @@
#define BMOFO_REGEN_RANGE 200.0f
#define BMOFO_REGEN_MOD 2.0f
+#define BMOFO_CHARGE_SPEED 5000
+#define BMOFO_CHARGE_TIME 2000
+#define BMOFO_CHARGE_RANGE 48.0f
+#define BMOFO_CHARGE_DMG ADM(300)
+
/*