Added pm_pground by Tonik, just some copy/paste, hope nothing broke :P

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2590 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Molgrum 2007-08-14 17:07:40 +00:00
parent 55cf7068fd
commit f5c9311935
6 changed files with 35 additions and 7 deletions

View File

@ -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");

View File

@ -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);
}
}
}

View File

@ -92,6 +92,7 @@ typedef struct {
int walljump;
qboolean slidefix;
qboolean airstep;
qboolean pground;
qboolean slidyslopes;
int stepheight;
} movevars_t;

View File

@ -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);

View File

@ -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);

View File

@ -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);