summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_view.c28
-rw-r--r--src/game/bg_pmove.c49
-rw-r--r--src/game/g_active.c17
-rw-r--r--src/game/g_buildable.c10
-rw-r--r--src/game/g_weapon.c27
-rw-r--r--src/game/tremulous.h14
6 files changed, 75 insertions, 70 deletions
diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c
index ae7cf7bb..16a16478 100644
--- a/src/cgame/cg_view.c
+++ b/src/cgame/cg_view.c
@@ -503,26 +503,24 @@ static void CG_OffsetFirstPersonView( void )
#define LEVEL3_FEEDBACK 20.0f
//provide some feedback for pouncing
- if( cg.predictedPlayerState.weapon == WP_ALEVEL3 ||
- cg.predictedPlayerState.weapon == WP_ALEVEL3_UPG )
+ if( ( cg.predictedPlayerState.weapon == WP_ALEVEL3 ||
+ cg.predictedPlayerState.weapon == WP_ALEVEL3_UPG ) &&
+ cg.predictedPlayerState.stats[ STAT_MISC ] > 0 )
{
- if( cg.predictedPlayerState.stats[ STAT_MISC ] > 0 )
- {
- float fraction1, fraction2;
- vec3_t forward;
-
- AngleVectors( angles, forward, NULL, NULL );
- VectorNormalize( forward );
+ float fraction1, fraction2;
+ vec3_t forward;
- fraction1 = (float)( cg.time - cg.weapon2Time ) / (float)LEVEL3_POUNCE_CHARGE_TIME;
+ AngleVectors( angles, forward, NULL, NULL );
+ VectorNormalize( forward );
- if( fraction1 > 1.0f )
- fraction1 = 1.0f;
+ fraction1 = (float)cg.predictedPlayerState.stats[ STAT_MISC ] /
+ LEVEL3_POUNCE_TIME_UPG;
+ if( fraction1 > 1.0f )
+ fraction1 = 1.0f;
- fraction2 = -sin( fraction1 * M_PI / 2 );
+ fraction2 = -sin( fraction1 * M_PI / 2 );
- VectorMA( origin, LEVEL3_FEEDBACK * fraction2, forward, origin );
- }
+ VectorMA( origin, LEVEL3_FEEDBACK * fraction2, forward, origin );
}
#define STRUGGLE_DIST 5.0f
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index a80bb5ab..167f40a1 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -520,11 +520,13 @@ PM_CheckPounce
*/
static qboolean PM_CheckPounce( void )
{
+ int jumpMagnitude;
+
if( pm->ps->weapon != WP_ALEVEL3 &&
pm->ps->weapon != WP_ALEVEL3_UPG )
return qfalse;
- // we were pouncing, but we've landed
+ // We were pouncing, but we've landed
if( pm->ps->groundEntityNum != ENTITYNUM_NONE &&
( pm->ps->pm_flags & PMF_CHARGE ) )
{
@@ -532,31 +534,34 @@ static qboolean PM_CheckPounce( void )
return qfalse;
}
- // we're building up for a pounce
+ // We're building up for a pounce
if( pm->cmd.buttons & BUTTON_ATTACK2 )
{
pm->ps->pm_flags &= ~PMF_CHARGE;
return qfalse;
}
- // already a pounce in progress
- if( pm->ps->pm_flags & PMF_CHARGE )
- return qfalse;
-
- if( pm->ps->stats[ STAT_MISC ] == 0 )
+ // Can't start a pounce
+ if( ( pm->ps->pm_flags & PMF_CHARGE ) ||
+ pm->ps->stats[ STAT_MISC ] < LEVEL3_POUNCE_TIME_MIN ||
+ pm->ps->groundEntityNum == ENTITYNUM_NONE )
return qfalse;
- pml.groundPlane = qfalse; // jumping away
+ // Give the player forward velocity and simulate a jump
+ pml.groundPlane = qfalse;
pml.walking = qfalse;
-
pm->ps->pm_flags |= PMF_CHARGE;
-
pm->ps->groundEntityNum = ENTITYNUM_NONE;
-
- VectorMA( pm->ps->velocity, pm->ps->stats[ STAT_MISC ], pml.forward, pm->ps->velocity );
-
+ if( pm->ps->weapon == WP_ALEVEL3 )
+ jumpMagnitude = pm->ps->stats[ STAT_MISC ] *
+ LEVEL3_POUNCE_JUMP_MAG / LEVEL3_POUNCE_TIME;
+ else
+ jumpMagnitude = pm->ps->stats[ STAT_MISC ] *
+ LEVEL3_POUNCE_JUMP_MAG_UPG / LEVEL3_POUNCE_TIME_UPG;
+ VectorMA( pm->ps->velocity, jumpMagnitude, pml.forward, pm->ps->velocity );
PM_AddEvent( EV_JUMP );
+ // Play jumping animation
if( pm->cmd.forwardmove >= 0 )
{
if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
@@ -2783,6 +2788,24 @@ static void PM_Weapon( void )
qboolean attack2 = qfalse;
qboolean attack3 = qfalse;
+ // Charging for a pounce or canceling a pounce
+ if( pm->ps->weapon == WP_ALEVEL3 || pm->ps->weapon == WP_ALEVEL3_UPG )
+ {
+ int max;
+
+ max = pm->ps->weapon == WP_ALEVEL3 ? LEVEL3_POUNCE_TIME :
+ LEVEL3_POUNCE_TIME_UPG;
+ if( pm->cmd.buttons & BUTTON_ATTACK2 )
+ pm->ps->stats[ STAT_MISC ] += pml.msec;
+ else
+ pm->ps->stats[ STAT_MISC ] -= pml.msec;
+
+ if( pm->ps->stats[ STAT_MISC ] > max )
+ pm->ps->stats[ STAT_MISC ] = max;
+ else if( pm->ps->stats[ STAT_MISC ] < 0 )
+ pm->ps->stats[ STAT_MISC ] = 0;
+ }
+
// Set overcharging flag so other players can hear warning
pm->ps->eFlags &= ~EF_WARN_CHARGE;
if( pm->ps->weapon == WP_LUCIFER_CANNON &&
diff --git a/src/game/g_active.c b/src/game/g_active.c
index ba1e28c8..56d773ee 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -587,23 +587,6 @@ void ClientTimerActions( gentity_t *ent, int msec )
else if( client->ps.stats[ STAT_STAMINA ] < -MAX_STAMINA )
client->ps.stats[ STAT_STAMINA ] = -MAX_STAMINA;
- //client is charging up for a pounce
- if( client->ps.weapon == WP_ALEVEL3 || client->ps.weapon == WP_ALEVEL3_UPG )
- {
- int pounceSpeed = 0;
-
- if( client->ps.weapon == WP_ALEVEL3 )
- pounceSpeed = LEVEL3_POUNCE_SPEED;
- else if( client->ps.weapon == WP_ALEVEL3_UPG )
- pounceSpeed = LEVEL3_POUNCE_UPG_SPEED;
-
- if( client->ps.stats[ STAT_MISC ] < pounceSpeed && ucmd->buttons & BUTTON_ATTACK2 )
- client->ps.stats[ STAT_MISC ] += ( 100.0f / (float)LEVEL3_POUNCE_CHARGE_TIME ) * pounceSpeed;
-
- if( client->ps.stats[ STAT_MISC ] > pounceSpeed )
- client->ps.stats[ STAT_MISC ] = pounceSpeed;
- }
-
//client is charging up for a... charge
if( client->ps.weapon == WP_ALEVEL4 )
{
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 7a8cd126..133559d7 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -2077,11 +2077,11 @@ qboolean HMGTurret_TrackEnemy( gentity_t *self )
RotatePointAroundVector( dirToTarget, xNormal, dttAdjusted, -rotAngle );
vectoangles( dirToTarget, self->turretAim );
- //if pointing at a valid target (not necessarily the original) return true
- VectorMA( self->s.pos.trBase, MGTURRET_RANGE, dirToTarget, end );
- trap_Trace( &tr, self->s.pos.trBase, NULL, NULL, end,
- self->s.number, MASK_SHOT );
- return HMGTurret_CheckTarget( self, g_entities + tr.entityNum, qfalse );
+ //fire if target is within accuracy
+ return ( abs( angularDiff[ YAW ] ) - angularSpeed <=
+ MGTURRET_ACCURACY_TO_FIRE ) &&
+ ( abs( angularDiff[ PITCH ] ) - angularSpeed <=
+ MGTURRET_ACCURACY_TO_FIRE );
}
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index 1955ec6d..b8c0b80d 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -1296,19 +1296,18 @@ CheckPounceAttack
*/
qboolean CheckPounceAttack( gentity_t *ent )
{
- trace_t tr;
+ trace_t tr;
gentity_t *traceEnt;
- int damage;
- int payload;
+ int damage, timeMax, payload;
if( ent->client->pmext.pouncePayload <= 0 )
return qfalse;
- // in case the goon lands on his target, he get's one shot after landing
+ // In case the goon lands on his target, he get's one shot after landing
payload = ent->client->pmext.pouncePayload;
if( !( ent->client->ps.pm_flags & PMF_CHARGE ) )
ent->client->pmext.pouncePayload = 0;
-
+
if( ent->client->ps.weaponTime > 0 )
return qfalse;
@@ -1316,28 +1315,28 @@ qboolean CheckPounceAttack( gentity_t *ent )
AngleVectors( ent->client->ps.viewangles, forward, right, up );
CalcMuzzlePoint( ent, forward, right, up, muzzle );
+ // Trace from muzzle to see what we hit
G_WideTrace( &tr, ent, LEVEL3_POUNCE_RANGE, LEVEL3_POUNCE_WIDTH,
LEVEL3_POUNCE_WIDTH, &traceEnt );
-
if( traceEnt == NULL )
return qfalse;
- // send blood impact
+ // Send blood impact
if( traceEnt->takedamage )
WideBloodSpurt( ent, traceEnt, &tr );
if( !traceEnt->takedamage )
return qfalse;
-
- damage = (int)( ( (float)payload / (float)LEVEL3_POUNCE_SPEED )
- * LEVEL3_POUNCE_DMG );
-
+
+ // Deal damage
+ timeMax = ent->client->ps.weapon == WP_ALEVEL3 ? LEVEL3_POUNCE_TIME :
+ LEVEL3_POUNCE_TIME_UPG;
+ damage = payload * LEVEL3_POUNCE_DMG / timeMax;
ent->client->pmext.pouncePayload = 0;
-
G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage,
- DAMAGE_NO_LOCDAMAGE, MOD_LEVEL3_POUNCE );
+ DAMAGE_NO_LOCDAMAGE, MOD_LEVEL3_POUNCE );
- ent->client->ps.weaponTime += LEVEL3_POUNCE_TIME;
+ ent->client->ps.weaponTime += LEVEL3_POUNCE_REPEAT;
return qtrue;
}
diff --git a/src/game/tremulous.h b/src/game/tremulous.h
index 38292c69..a0f0908a 100644
--- a/src/game/tremulous.h
+++ b/src/game/tremulous.h
@@ -97,12 +97,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define LEVEL3_POUNCE_DMG ADM(100)
#define LEVEL3_POUNCE_RANGE 64.0f
#define LEVEL3_POUNCE_WIDTH 14.0f
-#define LEVEL3_POUNCE_SPEED 700
-#define LEVEL3_POUNCE_UPG_SPEED 800
-#define LEVEL3_POUNCE_SPEED_MOD 0.75f
-#define LEVEL3_POUNCE_CHARGE_TIME 700
-#define LEVEL3_POUNCE_CHARGE_MIN 400
-#define LEVEL3_POUNCE_TIME 400
+#define LEVEL3_POUNCE_TIME 700 // msec for full Dragoon pounce
+#define LEVEL3_POUNCE_TIME_UPG 600 // msec for full Adv. Dragoon pounce
+#define LEVEL3_POUNCE_TIME_MIN 200 // msec before which pounce cancels
+#define LEVEL3_POUNCE_REPEAT 400 // msec before a new pounce starts
+#define LEVEL3_POUNCE_SPEED_MOD 0.75f // walking speed modifier for pounce charging
+#define LEVEL3_POUNCE_JUMP_MAG 700 // Dragoon pounce jump power
+#define LEVEL3_POUNCE_JUMP_MAG_UPG 800 // Adv. Dragoon pounce jump power
#define LEVEL3_BOUNCEBALL_DMG ADM(110)
#define LEVEL3_BOUNCEBALL_REPEAT 1000
#define LEVEL3_BOUNCEBALL_SPEED 1000.0f
@@ -560,6 +561,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define MGTURRET_SPLASHRADIUS 100
#define MGTURRET_ANGULARSPEED 12
#define MGTURRET_ANGULARSPEED_GRAB 8
+#define MGTURRET_ACCURACY_TO_FIRE 0
#define MGTURRET_VERTICALCAP 30 // +/- maximum pitch
#define MGTURRET_REPEAT 150
#define MGTURRET_K_SCALE 1.0f