1
0
Fork 0
forked from fte/fteqw

Fix issues with falling out of the world or so, on large maps.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5452 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2019-04-20 15:46:35 +00:00
parent c22a6b707a
commit 21186f9c11

View file

@ -1223,12 +1223,24 @@ static void PM_NudgePosition (void)
int i; int i;
static float sign[5] = {0, -1/8.0, 1/8.0, -2/8.0, 2/8.0}; static float sign[5] = {0, -1/8.0, 1/8.0, -2/8.0, 2/8.0};
VectorCopy (pmove.origin, base); //really we want to just use this here
//base[i] = MSG_FromCoord(MSG_ToCoord(pmove.origin[i], movevars.coordsize), movevars.coordsize);
if (movevars.coordsize) for (i=0 ; i<3 ; i++) //but it has overflow issues, so do things the painful way instead.
base[i] = MSG_FromCoord(MSG_ToCoord(base[i], movevars.coordsize), movevars.coordsize); //higher precision or at least with more accurate rounding //this stuff is so annoying because we're trying to avoid biasing the position towards 0. you'll see the effects of that if you use a low forwardspeed or low sv_gamespeed etc, but its also noticable with default settings too.
if (movevars.coordsize == 4) //float precision on the network. no need to truncate.
VectorCopy (pmove.origin, base);
else if (movevars.coordsize) //1/8th precision, but don't truncate because that screws everything up.
{
for (i=0 ; i<3 ; i++)
{
if (pmove.origin[i] >= 0)
base[i] = (qintptr_t)(pmove.origin[i]*8+0.5f) / 8.0;
else
base[i] = (qintptr_t)(pmove.origin[i]*8-0.5f) / 8.0;
}
}
else for (i=0 ; i<3 ; i++) else for (i=0 ; i<3 ; i++)
base[i] = ((int) (pmove.origin[i] * 8)) * 0.125; //legacy compat, which biases towards the origin. base[i] = ((qintptr_t) (pmove.origin[i] * 8)) * 0.125; //legacy compat, which biases towards the origin.
// VectorCopy (base, pmove.origin); // VectorCopy (base, pmove.origin);