diff --git a/code/cgame/cg_main.c b/code/cgame/cg_main.c index 369ad2cedf..8c2ff6ce30 100644 --- a/code/cgame/cg_main.c +++ b/code/cgame/cg_main.c @@ -184,6 +184,12 @@ vmCvar_t pmove_fixed; //vmCvar_t cg_pmove_fixed; vmCvar_t pmove_msec; vmCvar_t pmove_JumpVelocity; +vmCvar_t pmove_JumpVelocityMax; +vmCvar_t pmove_JumpVelocityScaleAdd; +vmCvar_t pmove_JumpVelocityTimeThreshold; +vmCvar_t pmove_DoubleJump; +vmCvar_t pmove_StepHeight; +vmCvar_t pmove_Overbounce; vmCvar_t pmove_WishSpeed; vmCvar_t pmove_WalkAccel; vmCvar_t pmove_AirAccel; @@ -406,6 +412,12 @@ static cvarTable_t cvarTable[] = { { &pmove_fixed, "pmove_fixed", "0", CVAR_SYSTEMINFO}, { &pmove_msec, "pmove_msec", "8", CVAR_SYSTEMINFO}, { &pmove_JumpVelocity, "pmove_JumpVelocity", "275", CVAR_SYSTEMINFO}, + { &pmove_JumpVelocityMax, "pmove_JumpVelocityMax", "700", CVAR_SYSTEMINFO}, + { &pmove_JumpVelocityScaleAdd, "pmove_JumpVelocityScaleAdd", "275", CVAR_SYSTEMINFO}, + { &pmove_JumpVelocityTimeThreshold, "pmove_JumpVelocityTimeThreshold", "500.0", CVAR_SYSTEMINFO}, + { &pmove_DoubleJump, "pmove_DoubleJump", "0", CVAR_SYSTEMINFO}, + { &pmove_StepHeight, "pmove_StepHeight", "22", CVAR_SYSTEMINFO}, + { &pmove_Overbounce, "pmove_Overbounce", "0", CVAR_SYSTEMINFO}, { &pmove_WishSpeed, "pmove_WishSpeed", "400", CVAR_SYSTEMINFO}, { &pmove_WalkAccel, "pmove_WalkAccel", "10", CVAR_SYSTEMINFO}, { &pmove_AirAccel, "pmove_AirAccel", "1", CVAR_SYSTEMINFO}, diff --git a/code/game/bg_local.h b/code/game/bg_local.h index 7833be1a86..4d3f30aea3 100644 --- a/code/game/bg_local.h +++ b/code/game/bg_local.h @@ -72,6 +72,12 @@ qboolean PM_SlideMove( qboolean gravity ); void PM_StepSlideMove( qboolean gravity ); extern vmCvar_t pmove_JumpVelocity; +extern vmCvar_t pmove_JumpVelocityMax; +extern vmCvar_t pmove_JumpVelocityScaleAdd; +extern vmCvar_t pmove_JumpVelocityTimeThreshold; +extern vmCvar_t pmove_DoubleJump; +extern vmCvar_t pmove_StepHeight; +extern vmCvar_t pmove_Overbounce; extern vmCvar_t pmove_WishSpeed; extern vmCvar_t pmove_WalkAccel; extern vmCvar_t pmove_AirAccel; diff --git a/code/game/bg_pmove.c b/code/game/bg_pmove.c index c3aeef45b5..e31da525e9 100644 --- a/code/game/bg_pmove.c +++ b/code/game/bg_pmove.c @@ -371,6 +371,17 @@ static qboolean PM_CheckJump( void ) { pm->ps->groundEntityNum = ENTITYNUM_NONE; pm->ps->velocity[2] = pmove_JumpVelocity.value; // JUMP_VELOCITY + // Double jump + if (pmove_DoubleJump.integer) { + float jump_zvel; + jump_zvel = Com_Clamp( 0, + pmove_JumpVelocityMax.value, + pm->ps->velocity[2] * pmove_JumpVelocityScaleAdd.value); + + if (pm->ps->stats[STAT_JUMPTIME] > 0) + pm->ps->velocity[2] += jump_zvel; + } + pm->ps->stats[STAT_JUMPTIME] = pmove_JumpVelocityTimeThreshold.value; PM_AddEvent( EV_JUMP ); if ( pm->cmd.forwardmove >= 0 ) { @@ -519,8 +530,10 @@ static void PM_WaterMove( void ) { PM_ClipVelocity (pm->ps->velocity, pml.groundTrace.plane.normal, pm->ps->velocity, OVERCLIP ); - VectorNormalize(pm->ps->velocity); - VectorScale(pm->ps->velocity, vel, pm->ps->velocity); + if ( pmove_Overbounce.integer || VectorLength(pm->ps->velocity) > 1 ) { + VectorNormalize(pm->ps->velocity); + VectorScale(pm->ps->velocity, vel, pm->ps->velocity); + } } PM_SlideMove( qfalse ); @@ -785,9 +798,10 @@ static void PM_WalkMove( void ) { PM_ClipVelocity (pm->ps->velocity, pml.groundTrace.plane.normal, pm->ps->velocity, OVERCLIP ); - // don't decrease velocity when going up or down a slope - VectorNormalize(pm->ps->velocity); - VectorScale(pm->ps->velocity, vel, pm->ps->velocity); + if ( pmove_Overbounce.integer || VectorLength(pm->ps->velocity) > 1 ) { + VectorNormalize(pm->ps->velocity); + VectorScale(pm->ps->velocity, vel, pm->ps->velocity); + } // don't do anything if standing still if (!pm->ps->velocity[0] && !pm->ps->velocity[1]) { @@ -1779,6 +1793,14 @@ static void PM_DropTimers( void ) { pm->ps->torsoTimer = 0; } } + + // drop post-jump counter + if ( pm->ps->stats[STAT_JUMPTIME] > 0 ) { + pm->ps->stats[STAT_JUMPTIME] -= pml.msec; + if ( pm->ps->stats[STAT_JUMPTIME] < 0 ) { + pm->ps->stats[STAT_JUMPTIME] = 0; + } + } } /* diff --git a/code/game/bg_public.h b/code/game/bg_public.h index 30690185d4..09a75f3772 100644 --- a/code/game/bg_public.h +++ b/code/game/bg_public.h @@ -210,7 +210,8 @@ typedef enum { STAT_ARMOR, STAT_DEAD_YAW, // look this direction when dead (FIXME: get rid of?) STAT_CLIENTS_READY, // bit mask of clients wishing to exit the intermission (FIXME: configstring?) - STAT_MAX_HEALTH // health / armor limit, changeable by handicap + STAT_MAX_HEALTH, // health / armor limit, changeable by handicap + STAT_JUMPTIME } statIndex_t; diff --git a/code/game/bg_slidemove.c b/code/game/bg_slidemove.c index 9228ada446..33013ddb00 100644 --- a/code/game/bg_slidemove.c +++ b/code/game/bg_slidemove.c @@ -258,7 +258,7 @@ void PM_StepSlideMove( qboolean gravity ) { } VectorCopy(start_o, down); - down[2] -= STEPSIZE; + down[2] -= pmove_StepHeight.value; pm->trace (&trace, start_o, pm->mins, pm->maxs, down, pm->ps->clientNum, pm->tracemask); VectorSet(up, 0, 0, 1); // never step up when you still have up velocity @@ -271,7 +271,7 @@ void PM_StepSlideMove( qboolean gravity ) { //VectorCopy (pm->ps->velocity, down_v); VectorCopy (start_o, up); - up[2] += STEPSIZE; + up[2] += pmove_StepHeight.value;; // test the player position if they were a stepheight higher pm->trace (&trace, start_o, pm->mins, pm->maxs, up, pm->ps->clientNum, pm->tracemask); diff --git a/code/game/g_local.h b/code/game/g_local.h index 8861079e22..2b6fb6aca8 100644 --- a/code/game/g_local.h +++ b/code/game/g_local.h @@ -745,6 +745,12 @@ extern vmCvar_t g_smoothClients; extern vmCvar_t pmove_fixed; extern vmCvar_t pmove_msec; extern vmCvar_t pmove_JumpVelocity; +extern vmCvar_t pmove_JumpVelocityMax; +extern vmCvar_t pmove_JumpVelocityScaleAdd; +extern vmCvar_t pmove_JumpVelocityTimeThreshold; +extern vmCvar_t pmove_DoubleJump; +extern vmCvar_t pmove_StepHeight; +extern vmCvar_t pmove_Overbounce; extern vmCvar_t pmove_WishSpeed; extern vmCvar_t pmove_WalkAccel; extern vmCvar_t pmove_AirAccel; diff --git a/code/game/g_main.c b/code/game/g_main.c index 5f1de0dbe8..78b13c42de 100644 --- a/code/game/g_main.c +++ b/code/game/g_main.c @@ -80,6 +80,12 @@ vmCvar_t g_smoothClients; vmCvar_t pmove_fixed; vmCvar_t pmove_msec; vmCvar_t pmove_JumpVelocity; +vmCvar_t pmove_JumpVelocityMax; +vmCvar_t pmove_JumpVelocityScaleAdd; +vmCvar_t pmove_JumpVelocityTimeThreshold; +vmCvar_t pmove_DoubleJump; +vmCvar_t pmove_StepHeight; +vmCvar_t pmove_Overbounce; vmCvar_t pmove_WishSpeed; vmCvar_t pmove_WalkAccel; vmCvar_t pmove_AirAccel; @@ -279,6 +285,13 @@ static cvarTable_t gameCvarTable[] = { { &pmove_msec, "pmove_msec", "8", CVAR_SYSTEMINFO, 0, qfalse}, { &pmove_WishSpeed, "pmove_WishSpeed", "400", CVAR_SYSTEMINFO,0, qfalse}, { &pmove_JumpVelocity, "pmove_JumpVelocity", "275", CVAR_SYSTEMINFO, 0, qfalse}, + { &pmove_JumpVelocityMax, "pmove_JumpVelocityMax", "700", CVAR_SYSTEMINFO, 0, qfalse}, + { &pmove_JumpVelocityScaleAdd, "pmove_JumpVelocityScaleAdd", "0.4", CVAR_SYSTEMINFO, 0, qfalse}, + { &pmove_JumpVelocityTimeThreshold, "pmove_JumpVelocityTimeThreshold", "500.0", CVAR_SYSTEMINFO, 0, qfalse}, + { &pmove_DoubleJump, "pmove_DoubleJump", "0", CVAR_SYSTEMINFO, 0, qfalse}, + { &pmove_StepHeight, "pmove_StepHeight", "22", CVAR_SYSTEMINFO, 0, qfalse}, + { &pmove_Overbounce, "pmove_Overbounce", "0", CVAR_SYSTEMINFO, 0, qfalse}, + { &pmove_WalkAccel, "pmove_WalkAccel", "10", CVAR_SYSTEMINFO,0, qfalse}, { &pmove_AirAccel, "pmove_AirAccel", "1", CVAR_SYSTEMINFO, 0, qfalse}, { &pmove_WaterAccel, "pmove_WaterAccel", "4", CVAR_SYSTEMINFO, 0, qfalse},