diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_local.h | 4 | ||||
-rw-r--r-- | src/cgame/cg_view.c | 54 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 2 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 10 | ||||
-rw-r--r-- | src/game/bg_public.h | 2 | ||||
-rw-r--r-- | src/game/g_client.c | 22 |
6 files changed, 91 insertions, 3 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; diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index d9d66ceb..30d71fa9 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -336,6 +336,9 @@ static float PM_CmdScale( usercmd_t *cmd ) { modifier *= (float)( pm->ps->stats[ STAT_STAMINA ] + 1000 ) / 500.0f; } + if( pm->ps->pm_type == PM_GRABBED ) + modifier = 0.0f; + if( !BG_ClassHasAbility( pm->ps->stats[ STAT_PCLASS ], SCA_CANJUMP ) ) cmd->upmove = 0; @@ -466,6 +469,13 @@ static qboolean PM_CheckJump( void ) return qfalse; } + //can't jump whilst grabbed + if( pm->ps->pm_type == PM_GRABBED ) + { + pm->cmd.upmove = 0; + return qfalse; + } + // must wait for jump to be released if ( pm->ps->pm_flags & PMF_JUMP_HELD ) { // clear upmove so cmdscale doesn't lower running speed diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 6f8454c2..2195db13 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -139,8 +139,8 @@ typedef enum { PM_NORMAL, // can accelerate and turn PM_NOCLIP, // noclip movement PM_SPECTATOR, // still run into walls - PM_DEAD, // no acceleration or turning, but free falling PM_GRABBED, // like dead, but for when the player is still live + PM_DEAD, // no acceleration or turning, but free falling PM_FREEZE, // stuck in place with no control PM_INTERMISSION, // no movement or status bar PM_SPINTERMISSION // no movement or status bar diff --git a/src/game/g_client.c b/src/game/g_client.c index bf8a8af2..48e3842a 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1287,7 +1287,8 @@ after the first ClientBegin, and after each respawn Initializes all non-persistant parts of playerState ============ */ -void ClientSpawn( gentity_t *ent, gentity_t *spawn ) { +void ClientSpawn( gentity_t *ent, gentity_t *spawn ) +{ int index; vec3_t spawn_origin, spawn_angles; gclient_t *client; @@ -1527,6 +1528,25 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn ) { G_SetOrigin( ent, spawn_origin ); VectorCopy( spawn_origin, client->ps.origin ); +#define UP_VEL 150.0f +#define F_VEL 50.0f + + //give aliens some spawn velocity + if( client->ps.stats[ STAT_PTEAM ] == PTE_DROIDS ) + { + if( spawnPoint->s.origin2[ 2 ] > 0.0f ) + { + vec3_t forward, dir; + + AngleVectors( spawn_angles, forward, NULL, NULL ); + VectorScale( forward, F_VEL, forward ); + VectorAdd( spawn->s.origin2, forward, dir ); + VectorNormalize( dir ); + + VectorScale( dir, UP_VEL, client->ps.velocity ); + } + } + // the respawned flag will be cleared after the attack and jump keys come up client->ps.pm_flags |= PMF_RESPAWNED; |