Credit goes to Xycaleth for finding/fixing this.
In JKA, players can jump-crouch through some patches, where it's an angle. This fixes that problem.
In bg_pmove.c, find:
Code:
static void PM_CheckDuck (void)
Above that, add:
Code:
static qboolean PM_CanStand ( void )
{
qboolean canStand = qtrue;
float x, y;
trace_t trace;
const vec3_t lineMins = { -5.0f, -5.0f, -2.5f };
const vec3_t lineMaxs = { 5.0f, 5.0f, 0.0f };
for ( x = pm->mins[0] + 5.0f; canStand && x <= (pm->maxs[0] - 5.0f); x += 10.0f )
{
for ( y = pm->mins[1] + 5.0f; y <= (pm->maxs[1] - 5.0f); y += 10.0f )
{
vec3_t start = { x, y, pm->maxs[2] };
vec3_t end = { x, y, pm->ps->standheight };
VectorAdd (start, pm->ps->origin, start);
VectorAdd (end, pm->ps->origin, end);
pm->trace (&trace, start, lineMins, lineMaxs, end, pm->ps->clientNum, pm->tracemask);
if ( trace.allsolid || trace.fraction < 1.0f )
{
canStand = qfalse;
break;
}
}
}
return canStand;
}
In the
PM_CheckDuck function, find:
Code:
else if (pm->ps->pm_flags & PMF_ROLLING)
{
// try to stand up
pm->maxs[2] = pm->ps->standheight;//DEFAULT_MAXS_2;
pm->trace (&trace, pm->ps->origin, pm->mins, pm->maxs, pm->ps->origin, pm->ps->clientNum, pm->tracemask );
if (!trace.allsolid)
pm->ps->pm_flags &= ~PMF_ROLLING;
}
Replace with:
Code:
else if (pm->ps->pm_flags & PMF_ROLLING)
{
if ( PM_CanStand() )
{
pm->maxs[2] = pm->ps->standheight;
pm->ps->pm_flags &= ~PMF_ROLLING;
}
}
Find:
Code:
else
{ // stand up if possible
if (pm->ps->pm_flags & PMF_DUCKED)
{
// try to stand up
pm->maxs[2] = pm->ps->standheight;//DEFAULT_MAXS_2;
pm->trace (&trace, pm->ps->origin, pm->mins, pm->maxs, pm->ps->origin, pm->ps->clientNum, pm->tracemask );
if (!trace.allsolid)
pm->ps->pm_flags &= ~PMF_DUCKED;
}
}
Replace with:
Code:
else
{ // stand up if possible
if (pm->ps->pm_flags & PMF_DUCKED)
{
if ( PM_CanStand() )
{
pm->maxs[2] = pm->ps->standheight;
pm->ps->pm_flags &= ~PMF_DUCKED;
}
}
}
And...that should be it.