diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index b09001c11..4a08120fb 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -1415,6 +1415,7 @@ void CL_CheckServerInfo(void) cl.bunnyspeedcap = Q_atof(Info_ValueForKey(cl.serverinfo, "pm_bunnyspeedcap")); movevars.slidefix = (Q_atof(Info_ValueForKey(cl.serverinfo, "pm_slidefix")) != 0); movevars.airstep = (Q_atof(Info_ValueForKey(cl.serverinfo, "pm_airstep")) != 0); + movevars.pground = (Q_atof(Info_ValueForKey(cl.serverinfo, "pm_pground")) != 0); movevars.walljump = (Q_atof(Info_ValueForKey(cl.serverinfo, "pm_walljump"))); movevars.ktjump = Q_atof(Info_ValueForKey(cl.serverinfo, "pm_ktjump")); s = Info_ValueForKey(cl.serverinfo, "pm_stepheight"); diff --git a/engine/common/pmove.c b/engine/common/pmove.c index a00d88016..817a4b8c8 100644 --- a/engine/common/pmove.c +++ b/engine/common/pmove.c @@ -689,6 +689,12 @@ void PM_AirMove (void) blocked = PM_StepSlideMove (true); else blocked = PM_SlideMove (); + + if (movevars.pground) + { + if (blocked & BLOCKED_FLOOR) + pmove.onground = true; + } } } @@ -719,7 +725,7 @@ void PM_CategorizePosition (void) { pmove.onground = false; } - else + else if (!movevars.pground || pmove.onground) { trace = PM_PlayerTrace (pmove.origin, point); if (trace.fraction == 1 || trace.plane.normal[2] < MIN_STEP_NORMAL) @@ -808,7 +814,7 @@ void PM_CategorizePosition (void) } #endif - if (pmove.onground && pmove.pm_type != PM_FLY && pmove.waterlevel < 2) + if (!movevars.pground && pmove.onground && pmove.pm_type != PM_FLY && pmove.waterlevel < 2) { // snap to ground so that we can't jump higher than we're supposed to if (!trace.startsolid && !trace.allsolid) @@ -869,6 +875,17 @@ void PM_CheckJump (void) PM_ClipVelocity (pmove.velocity, groundplane.normal, pmove.velocity, 1); } + if (!movevars.pground) + { + // check for jump bug + // groundplane normal was set in the call to PM_CategorizePosition + if (pmove.velocity[2] < 0 && DotProduct(pmove.velocity, groundplane.normal) < -0.1) + { + // pmove.velocity is pointing into the ground, clip it + PM_ClipVelocity (pmove.velocity, groundplane.normal, pmove.velocity, 1); + } + } + pmove.onground = false; pmove.velocity[2] += 270; @@ -1125,11 +1142,14 @@ void PM_PlayerMove (float gamespeed) // set onground, watertype, and waterlevel for final spot PM_CategorizePosition (); - // this is to make sure landing sound is not played twice - // and falling damage is calculated correctly - if (pmove.onground && pmove.velocity[2] < -300 - && DotProduct(pmove.velocity, groundplane.normal) < -0.1) + if (!movevars.pground) { - PM_ClipVelocity (pmove.velocity, groundplane.normal, pmove.velocity, 1); + // this is to make sure landing sound is not played twice + // and falling damage is calculated correctly + if (pmove.onground && pmove.velocity[2] < -300 + && DotProduct(pmove.velocity, groundplane.normal) < -0.1) + { + PM_ClipVelocity (pmove.velocity, groundplane.normal, pmove.velocity, 1); + } } } diff --git a/engine/common/pmove.h b/engine/common/pmove.h index 658fd4abc..a56827bda 100644 --- a/engine/common/pmove.h +++ b/engine/common/pmove.h @@ -92,6 +92,7 @@ typedef struct { int walljump; qboolean slidefix; qboolean airstep; + qboolean pground; qboolean slidyslopes; int stepheight; } movevars_t; diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 1359c56d1..5c0ea9615 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -3026,6 +3026,7 @@ void SV_InitLocal (void) extern cvar_t pm_ktjump; extern cvar_t pm_slidefix; extern cvar_t pm_airstep; + extern cvar_t pm_pground; extern cvar_t pm_walljump; extern cvar_t pm_slidyslopes; extern cvar_t pm_stepheight; @@ -3095,6 +3096,7 @@ void SV_InitLocal (void) Cvar_Register (&pm_slidefix, cvargroup_serverphysics); Cvar_Register (&pm_slidyslopes, cvargroup_serverphysics); Cvar_Register (&pm_airstep, cvargroup_serverphysics); + Cvar_Register (&pm_pground, cvargroup_serverphysics); Cvar_Register (&pm_walljump, cvargroup_serverphysics); Cvar_Register (&pm_stepheight, cvargroup_serverphysics); diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index c680494b2..11aca499e 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -59,6 +59,7 @@ cvar_t pm_bunnyspeedcap = SCVARF("pm_bunnyspeedcap", "0", CVAR_SERVERINFO); cvar_t pm_slidefix = SCVARF("pm_slidefix", "0", CVAR_SERVERINFO); cvar_t pm_slidyslopes = SCVARF("pm_slidyslopes", "0", CVAR_SERVERINFO); cvar_t pm_airstep = SCVARF("pm_airstep", "0", CVAR_SERVERINFO); +cvar_t pm_pground = SCVARF("pm_pground", "0", CVAR_SERVERINFO); cvar_t pm_walljump = SCVARF("pm_walljump", "0", CVAR_SERVERINFO); cvar_t pm_stepheight = FCVAR("pm_stepheight", "sv_stepheight", "18", CVAR_SERVERINFO); diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index 36ea54f9a..bfaaabc96 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -78,6 +78,7 @@ extern cvar_t pm_ktjump; extern cvar_t pm_slidefix; extern cvar_t pm_slidyslopes; extern cvar_t pm_airstep; +extern cvar_t pm_pground; extern cvar_t pm_walljump; cvar_t sv_pushplayers = SCVAR("sv_pushplayers", "0"); @@ -4451,6 +4452,7 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean recurse) movevars.ktjump = pm_ktjump.value; movevars.slidefix = (pm_slidefix.value != 0); movevars.airstep = (pm_airstep.value != 0); + movevars.pground = (pm_pground.value != 0); movevars.walljump = (pm_walljump.value); movevars.slidyslopes = (pm_slidyslopes.value!=0); @@ -4613,6 +4615,7 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean recurse) movevars.ktjump = pm_ktjump.value; movevars.slidefix = (pm_slidefix.value != 0); movevars.airstep = (pm_airstep.value != 0); + movevars.pground = (pm_pground.value != 0); movevars.walljump = (pm_walljump.value); movevars.slidyslopes = (pm_slidyslopes.value!=0);