diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2015-04-08 21:45:16 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2015-04-08 21:45:16 +0200 |
commit | ee25f4aadf87fa2852bb345062eeecea9e86d1dc (patch) | |
tree | b7dd37970f250812a67c750d63b901c38fbee35f /src/game | |
parent | 0f4407b328c59f132ee5bbf31004d31b81dc3b3b (diff) |
Revert human physics to vq3.
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_misc.c | 4 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 165 | ||||
-rw-r--r-- | src/game/bg_public.h | 3 | ||||
-rw-r--r-- | src/game/g_active.c | 22 | ||||
-rw-r--r-- | src/game/g_buildable.c | 9 | ||||
-rw-r--r-- | src/game/g_client.c | 2 | ||||
-rw-r--r-- | src/game/g_cmds.c | 5 | ||||
-rw-r--r-- | src/game/tremulous.h | 18 |
8 files changed, 6 insertions, 222 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 09da2b8..240f6a5 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -2566,7 +2566,7 @@ static const classAttributes_t bg_classList[ ] = 0.002f, //float bob; 1.0f, //float bobCycle; 100, //int steptime; - 1.0f, //float speed; + 1.25f, //float speed; 10.0f, //float acceleration; 1.0f, //float airAcceleration; 6.0f, //float friction; @@ -2593,7 +2593,7 @@ static const classAttributes_t bg_classList[ ] = 0.002f, //float bob; 1.0f, //float bobCycle; 100, //int steptime; - 1.0f, //float speed; + 1.25f, //float speed; 10.0f, //float acceleration; 1.0f, //float airAcceleration; 6.0f, //float friction; diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 476e195..bdddfc3 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -406,57 +406,6 @@ static float PM_CmdScale( usercmd_t *cmd ) if( pm->ps->stats[ STAT_TEAM ] == TEAM_HUMANS && pm->ps->pm_type == PM_NORMAL ) { - qboolean wasSprinting; - qboolean sprint; - wasSprinting = sprint = pm->ps->stats[ STAT_STATE ] & SS_SPEEDBOOST; - - if( pm->ps->persistant[ PERS_STATE ] & PS_SPRINTTOGGLE ) - { - if( cmd->buttons & BUTTON_SPRINT && - !( pm->ps->pm_flags & PMF_SPRINTHELD ) ) - { - sprint = !sprint; - pm->ps->pm_flags |= PMF_SPRINTHELD; - } - else if( pm->ps->pm_flags & PMF_SPRINTHELD && - !( cmd->buttons & BUTTON_SPRINT ) ) - pm->ps->pm_flags &= ~PMF_SPRINTHELD; - } - else - sprint = cmd->buttons & BUTTON_SPRINT; - - if( sprint ) - pm->ps->stats[ STAT_STATE ] |= SS_SPEEDBOOST; - else if( wasSprinting && !sprint ) - pm->ps->stats[ STAT_STATE ] &= ~SS_SPEEDBOOST; - - // Walk overrides sprint. We keep the state that we want to be sprinting - // (above), but don't apply the modifier, and in g_active we skip taking - // the stamina too. - if( sprint && !( cmd->buttons & BUTTON_WALKING ) ) - modifier *= HUMAN_SPRINT_MODIFIER; - else - modifier *= HUMAN_JOG_MODIFIER; - - if( cmd->forwardmove < 0 ) - { - //can't run backwards - modifier *= HUMAN_BACK_MODIFIER; - } - else if( cmd->rightmove ) - { - //can't move that fast sideways - modifier *= HUMAN_SIDE_MODIFIER; - } - - //must have have stamina to jump - if( pm->ps->stats[ STAT_STAMINA ] < STAMINA_SLOW_LEVEL + STAMINA_JUMP_TAKE ) - cmd->upmove = 0; - - //slow down once stamina depletes - if( pm->ps->stats[ STAT_STAMINA ] <= STAMINA_SLOW_LEVEL ) - modifier *= (float)( pm->ps->stats[ STAT_STAMINA ] + STAMINA_MAX ) / (float)(STAMINA_SLOW_LEVEL + STAMINA_MAX); - if( pm->ps->stats[ STAT_STATE ] & SS_CREEPSLOWED ) { if( BG_InventoryContainsUpgrade( UP_LIGHTARMOUR, pm->ps->stats ) || @@ -957,10 +906,6 @@ static qboolean PM_CheckJump( void ) pm->ps->stats[ STAT_MISC ] > 0 ) return qfalse; - if( ( pm->ps->stats[ STAT_TEAM ] == TEAM_HUMANS ) && - ( pm->ps->stats[ STAT_STAMINA ] < STAMINA_SLOW_LEVEL + STAMINA_JUMP_TAKE ) ) - return qfalse; - //no bunny hopping off a dodge if( pm->ps->stats[ STAT_TEAM ] == TEAM_HUMANS && pm->ps->pm_time ) @@ -999,10 +944,6 @@ static qboolean PM_CheckJump( void ) pml.walking = qfalse; pm->ps->pm_flags |= PMF_JUMP_HELD; - // take some stamina off - if( pm->ps->stats[ STAT_TEAM ] == TEAM_HUMANS ) - pm->ps->stats[ STAT_STAMINA ] -= STAMINA_JUMP_TAKE; - pm->ps->groundEntityNum = ENTITYNUM_NONE; // jump away from wall @@ -1084,108 +1025,6 @@ static qboolean PM_CheckWaterJump( void ) return qtrue; } - -/* -================== -PM_CheckDodge - -Checks the dodge key and starts a human dodge or sprint -================== -*/ -static qboolean PM_CheckDodge( void ) -{ - vec3_t right, forward, velocity = { 0.0f, 0.0f, 0.0f }; - float jump, sideModifier; - int i; - - if( pm->ps->stats[ STAT_TEAM ] != TEAM_HUMANS ) - return qfalse; - - // Landed a dodge - if( ( pm->ps->pm_flags & PMF_CHARGE ) && - pm->ps->groundEntityNum != ENTITYNUM_NONE ) - { - pm->ps->pm_flags = ( pm->ps->pm_flags & ~PMF_CHARGE ) | PMF_TIME_LAND; - pm->ps->pm_time = HUMAN_DODGE_TIMEOUT; - } - - // Reasons why we can't start a dodge or sprint - if( pm->ps->pm_type != PM_NORMAL || pm->ps->stats[ STAT_STAMINA ] < STAMINA_SLOW_LEVEL + STAMINA_DODGE_TAKE || - ( pm->ps->pm_flags & PMF_DUCKED ) ) - return qfalse; - - // Can't dodge forward - if( pm->cmd.forwardmove > 0 ) - return qfalse; - - // Reasons why we can't start a dodge only - if( pm->ps->pm_flags & ( PMF_TIME_LAND | PMF_CHARGE ) || - pm->ps->groundEntityNum == ENTITYNUM_NONE || - !( pm->cmd.buttons & BUTTON_DODGE ) ) - return qfalse; - - // Dodge direction specified with movement keys - if( ( !pm->cmd.rightmove && !pm->cmd.forwardmove ) || pm->cmd.upmove ) - return qfalse; - - AngleVectors( pm->ps->viewangles, NULL, right, NULL ); - forward[ 0 ] = -right[ 1 ]; - forward[ 1 ] = right[ 0 ]; - forward[ 2 ] = 0.0f; - - // Dodge magnitude is based on the jump magnitude scaled by the modifiers - jump = BG_Class( pm->ps->stats[ STAT_CLASS ] )->jumpMagnitude; - if( pm->cmd.rightmove && pm->cmd.forwardmove ) - jump *= ( 0.5f * M_SQRT2 ); - - // Weaken dodge if slowed - if( ( pm->ps->stats[ STAT_STATE ] & SS_SLOWLOCKED ) || - ( pm->ps->stats[ STAT_STATE ] & SS_CREEPSLOWED ) || - ( pm->ps->eFlags & EF_POISONCLOUDED ) ) - sideModifier = HUMAN_DODGE_SLOWED_MODIFIER; - else - sideModifier = HUMAN_DODGE_SIDE_MODIFIER; - - // The dodge sets minimum velocity - if( pm->cmd.rightmove ) - { - if( pm->cmd.rightmove < 0 ) - VectorNegate( right, right ); - VectorMA( velocity, jump * sideModifier, right, velocity ); - } - - if( pm->cmd.forwardmove ) - { - if( pm->cmd.forwardmove < 0 ) - VectorNegate( forward, forward ); - VectorMA( velocity, jump * sideModifier, forward, velocity ); - } - - velocity[ 2 ] = jump * HUMAN_DODGE_UP_MODIFIER; - - // Make sure client has minimum velocity - for( i = 0; i < 3; i++ ) - { - if( ( velocity[ i ] < 0.0f && - pm->ps->velocity[ i ] > velocity[ i ] ) || - ( velocity[ i ] > 0.0f && - pm->ps->velocity[ i ] < velocity[ i ] ) ) - pm->ps->velocity[ i ] = velocity[ i ]; - } - - // Jumped away - pml.groundPlane = qfalse; - pml.walking = qfalse; - pm->ps->groundEntityNum = ENTITYNUM_NONE; - pm->ps->pm_flags |= PMF_CHARGE; - pm->ps->stats[ STAT_STAMINA ] -= STAMINA_DODGE_TAKE; - pm->ps->legsAnim = ( ( pm->ps->legsAnim & ANIM_TOGGLEBIT ) ^ - ANIM_TOGGLEBIT ) | LEGS_JUMP; - PM_AddEvent( EV_JUMP ); - - return qtrue; -} - /* =================== PM_WaterJumpMove @@ -2909,9 +2748,6 @@ static void PM_Footsteps( void ) bobmove *= BG_Class( pm->ps->stats[ STAT_CLASS ] )->bobCycle; - if( pm->ps->stats[ STAT_STATE ] & SS_SPEEDBOOST ) - bobmove *= HUMAN_SPRINT_MODIFIER; - // check for footstep / splash sounds old = pm->ps->bobCycle; pm->ps->bobCycle = (int)( old + bobmove * pml.msec ) & 255; @@ -4169,7 +4005,6 @@ void PmoveSingle( pmove_t *pmove ) PM_DeadMove( ); PM_DropTimers( ); - PM_CheckDodge( ); if( pm->ps->pm_type == PM_JETPACK ) PM_JetPackMove( ); diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 1e9d23c..61da2f7 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -224,13 +224,12 @@ typedef enum STAT_MAX_HEALTH,// health / armor limit, changable by handicap STAT_CLASS, // player class (for aliens AND humans) STAT_TEAM, // player team - STAT_STAMINA, // stamina (human only) STAT_STATE, // client states e.g. wall climbing STAT_MISC, // for uh...misc stuff (pounce, trample, lcannon) STAT_BUILDABLE, // which ghost model to display for building STAT_FALLDIST, // the distance the player fell STAT_VIEWLOCK // direction to lock the view in - // netcode has space for 3 more + // netcode has space for 4 more } statIndex_t; #define SCA_WALLCLIMBER 0x00000001 diff --git a/src/game/g_active.c b/src/game/g_active.c index 0c84f57..2bf6400 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -631,7 +631,6 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) client->ps.pm_flags |= PMF_QUEUED; client->ps.speed = client->pers.flySpeed; - client->ps.stats[ STAT_STAMINA ] = 0; client->ps.stats[ STAT_MISC ] = 0; client->ps.stats[ STAT_BUILDABLE ] = BA_NONE; client->ps.stats[ STAT_CLASS ] = PCL_NONE; @@ -807,26 +806,10 @@ void ClientTimerActions( gentity_t *ent, int msec ) client->ps.stats[ STAT_STATE ] &= ~SS_INVI; } - // Restore or subtract stamina - if( stopped || client->ps.pm_type == PM_JETPACK ) - client->ps.stats[ STAT_STAMINA ] += STAMINA_STOP_RESTORE; - else if( ( client->ps.stats[ STAT_STATE ] & SS_SPEEDBOOST ) && - !( client->buttons & BUTTON_WALKING ) ) // walk overrides sprint - client->ps.stats[ STAT_STAMINA ] -= STAMINA_SPRINT_TAKE; - else if( walking || crouched ) - client->ps.stats[ STAT_STAMINA ] += STAMINA_WALK_RESTORE; - - // Check stamina limits - if( client->ps.stats[ STAT_STAMINA ] > STAMINA_MAX ) - client->ps.stats[ STAT_STAMINA ] = STAMINA_MAX; - else if( client->ps.stats[ STAT_STAMINA ] < -STAMINA_MAX ) - client->ps.stats[ STAT_STAMINA ] = -STAMINA_MAX; - - // Regenerate health and stamina if we have got a Biokit + // Regenerate health if we have got a Biokit if( BG_InventoryContainsUpgrade( UP_BIOKIT, client->ps.stats ) ) { int rate_health = BIOKIT_HEALTH_RATE; - int rate_stamina = BIOKIT_STAMINA_RATE; if( ent->nextRegenTime < level.time && ent->health > 0 && rate_health > 0 && ent->health < client->ps.stats[ STAT_MAX_HEALTH ] ) @@ -840,9 +823,6 @@ void ClientTimerActions( gentity_t *ent, int msec ) ent->nextRegenTime = level.time + 5000/rate_health; ent->client->alreadyRegenerated = qtrue; } - - if( client->ps.stats[ STAT_STAMINA ] + rate_stamina <= STAMINA_MAX ) - client->ps.stats[ STAT_STAMINA ] += rate_stamina; } if( weapon == WP_ABUILD || diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 62aa7c7..d0ba6dc 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -2830,8 +2830,7 @@ void HMedistat_Think( gentity_t *self ) if( player->client && player->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) { - if( ( player->health < player->client->ps.stats[ STAT_MAX_HEALTH ] || - player->client->ps.stats[ STAT_STAMINA ] < STAMINA_MAX ) && + if( player->health < player->client->ps.stats[ STAT_MAX_HEALTH ] && PM_Live( player->client->ps.pm_type ) ) { self->enemy = player; @@ -2861,12 +2860,6 @@ void HMedistat_Think( gentity_t *self ) } else if( self->enemy && self->enemy->client ) //heal! { - if( self->enemy->client->ps.stats[ STAT_STAMINA ] < STAMINA_MAX ) - self->enemy->client->ps.stats[ STAT_STAMINA ] += STAMINA_MEDISTAT_RESTORE; - - if( self->enemy->client->ps.stats[ STAT_STAMINA ] > STAMINA_MAX ) - self->enemy->client->ps.stats[ STAT_STAMINA ] = STAMINA_MAX; - self->enemy->health++; //if they're completely healed, give them a medkit diff --git a/src/game/g_client.c b/src/game/g_client.c index 896a7fc..bfb79b9 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1505,8 +1505,6 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles for( i = 0; i < MAX_CLIENTS; i++ ) ent->credits[ i ] = 0; - client->ps.stats[ STAT_STAMINA ] = STAMINA_MAX; - G_SetOrigin( ent, spawn_origin ); VectorCopy( spawn_origin, client->ps.origin ); diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index f3cada7..74dea71 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -450,7 +450,7 @@ void Cmd_Give_f( gentity_t *ent ) if( trap_Argc( ) < 2 ) { ADMP( "usage: give [what]\n" ); - ADMP( "usage: valid choices are: all, health, funds [amount], stamina, " + ADMP( "usage: valid choices are: all, health, funds [amount], " "poison, gas, ammo\n" ); return; } @@ -487,9 +487,6 @@ void Cmd_Give_f( gentity_t *ent ) G_AddCreditToClient( ent->client, (short)credits, qtrue ); } - if( give_all || Q_stricmp( name, "stamina" ) == 0 ) - ent->client->ps.stats[ STAT_STAMINA ] = STAMINA_MAX; - if( Q_stricmp( name, "poison" ) == 0 ) { if( ent->client->pers.teamSelection == TEAM_HUMANS ) diff --git a/src/game/tremulous.h b/src/game/tremulous.h index 69eb4b1..c50d9a9 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -324,25 +324,7 @@ TREMULOUS EDGE MOD SRC FILE * HUMAN */ -#define HUMAN_SPRINT_MODIFIER 1.28f -#define HUMAN_JOG_MODIFIER 1.1f -#define HUMAN_BACK_MODIFIER 0.8f -#define HUMAN_SIDE_MODIFIER 0.9f -#define HUMAN_DODGE_SIDE_MODIFIER 2.9f -#define HUMAN_DODGE_SLOWED_MODIFIER 0.9f -#define HUMAN_DODGE_UP_MODIFIER 0.5f -#define HUMAN_DODGE_TIMEOUT 500 #define HUMAN_LAND_FRICTION 3.0f -#define STAMINA_STOP_RESTORE 20 -#define STAMINA_WALK_RESTORE 15 -#define STAMINA_MEDISTAT_RESTORE 30 // stacked on STOP or WALK -#define STAMINA_SPRINT_TAKE 8 -#define STAMINA_JUMP_TAKE 250 -#define STAMINA_DODGE_TAKE 250 -#define STAMINA_MAX 1200 -#define STAMINA_BREATHING_LEVEL 0 -#define STAMINA_SLOW_LEVEL -500 -#define STAMINA_BLACKOUT_LEVEL -800 #define HUMAN_SPAWN_REPEAT_TIME 11000 #define HUMAN_REGEN_DAMAGE_TIME 2000 //msec since damage before dcc repairs #define HUMAN_MAX_CREDITS 2000 |