summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2001-09-15 18:45:39 +0000
committerTim Angus <tim@ngus.net>2001-09-15 18:45:39 +0000
commit1b02716b661584dddb150e6346aeed3934be418a (patch)
tree1733f8765c68cc1f28041fa4c86e828fab39b71c /src/cgame
parentcab6cb5c4a989b11e6f45b74f87d84a961235984 (diff)
Trapper tweaks
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_local.h4
-rw-r--r--src/cgame/cg_view.c54
-rw-r--r--src/cgame/cg_weapons.c2
3 files changed, 59 insertions, 1 deletions
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 89ca9e80..90c4320a 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -669,6 +669,10 @@ typedef struct {
vec3_t lastNormal; //TA: view smoothage
vec3_t lastVangles; //TA: view smoothage
smooth_t sList[ MAXSMOOTHS ]; //TA: WW smoothing
+
+ int forwardMoveTime; //TA: for struggling
+ int rightMoveTime;
+ int upMoveTime;
} cg_t;
diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c
index 28ec3094..b70fc0e8 100644
--- a/src/cgame/cg_view.c
+++ b/src/cgame/cg_view.c
@@ -429,6 +429,60 @@ static void CG_OffsetFirstPersonView( void ) {
}
}
+#define STRUGGLE_DIST 5.0f
+#define STRUGGLE_TIME 250
+
+ //allow the player to struggle a little whilst grabbed
+ if( cg.predictedPlayerState.pm_type == PM_GRABBED )
+ {
+ vec3_t forward, right, up;
+ usercmd_t cmd;
+ int cmdNum;
+ float fFraction, rFraction, uFraction;
+ float fFraction2, rFraction2, uFraction2;
+
+ cmdNum = trap_GetCurrentCmdNumber();
+ trap_GetUserCmd( cmdNum, &cmd );
+
+ AngleVectors( angles, forward, right, up );
+
+ fFraction = (float)( cg.time - cg.forwardMoveTime ) / STRUGGLE_TIME;
+ rFraction = (float)( cg.time - cg.rightMoveTime ) / STRUGGLE_TIME;
+ uFraction = (float)( cg.time - cg.upMoveTime ) / STRUGGLE_TIME;
+
+ if( fFraction > 1.0f )
+ fFraction = 1.0f;
+ if( rFraction > 1.0f )
+ rFraction = 1.0f;
+ if( uFraction > 1.0f )
+ uFraction = 1.0f;
+
+ fFraction2 = -sin( fFraction * M_PI / 2 );
+ rFraction2 = -sin( rFraction * M_PI / 2 );
+ uFraction2 = -sin( uFraction * M_PI / 2 );
+
+ if( cmd.forwardmove > 0 )
+ VectorMA( origin, STRUGGLE_DIST * fFraction, forward, origin );
+ else if( cmd.forwardmove < 0 )
+ VectorMA( origin, -STRUGGLE_DIST * fFraction, forward, origin );
+ else
+ cg.forwardMoveTime = cg.time;
+
+ if( cmd.rightmove > 0 )
+ VectorMA( origin, STRUGGLE_DIST * rFraction, right, origin );
+ else if( cmd.rightmove < 0 )
+ VectorMA( origin, -STRUGGLE_DIST * rFraction, right, origin );
+ else
+ cg.rightMoveTime = cg.time;
+
+ if( cmd.upmove > 0 )
+ VectorMA( origin, STRUGGLE_DIST * uFraction, up, origin );
+ else if( cmd.upmove < 0 )
+ VectorMA( origin, -STRUGGLE_DIST * uFraction, up, origin );
+ else
+ cg.upMoveTime = cg.time;
+ }
+
//TA: this *feels* more realisitic for humans
if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_HUMANS )
{
diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c
index fbf44067..9aacd702 100644
--- a/src/cgame/cg_weapons.c
+++ b/src/cgame/cg_weapons.c
@@ -692,7 +692,7 @@ void CG_RegisterWeapon( int weaponNum ) {
break;
case WP_LOCKBLOB_LAUNCHER:
- weaponInfo->missileModel = trap_R_RegisterModel( "models/ammo/sawblade/sawblade.md3" );
+ weaponInfo->missileModel = trap_R_RegisterModel( "models/ammo/trapper/trapper.md3" );
/* weaponInfo->missileSound = trap_S_RegisterSound( "sound/weapons/rocket/rockfly.wav", qfalse );
weaponInfo->missileTrailFunc = CG_RocketTrail;
weaponInfo->missileDlight = 200;