mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
When teleporting silently, also set g_player[].ps->bobposx/y to the new position
This fixes an integer overflow when a distance is calculated later. git-svn-id: https://svn.eduke32.com/eduke32@2785 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
3e4357c6a4
commit
7f409f08bb
2 changed files with 4 additions and 2 deletions
|
@ -3247,8 +3247,8 @@ ACTOR_STATIC void G_MoveTransports(void)
|
|||
if ((g_player[p].ps->jetpack_on == 0) || (g_player[p].ps->jetpack_on && TEST_SYNC_KEY(g_player[p].sync->bits, SK_JUMP)) ||
|
||||
(g_player[p].ps->jetpack_on && TEST_SYNC_KEY(g_player[p].sync->bits, SK_CROUCH)))
|
||||
{
|
||||
g_player[p].ps->opos.x = g_player[p].ps->pos.x += sprite[OW].x-SX;
|
||||
g_player[p].ps->opos.y = g_player[p].ps->pos.y += sprite[OW].y-SY;
|
||||
g_player[p].ps->bobposx = g_player[p].ps->opos.x = g_player[p].ps->pos.x += sprite[OW].x-SX;
|
||||
g_player[p].ps->bobposy = g_player[p].ps->opos.y = g_player[p].ps->pos.y += sprite[OW].y-SY;
|
||||
|
||||
if (g_player[p].ps->jetpack_on && (TEST_SYNC_KEY(g_player[p].sync->bits, SK_JUMP) || g_player[p].ps->jetpack_on < 11))
|
||||
g_player[p].ps->pos.z = sprite[OW].z-6144;
|
||||
|
|
|
@ -4686,6 +4686,8 @@ void P_ProcessInput(int32_t snum)
|
|||
}
|
||||
else p->weapon_sway = p->bobcounter;
|
||||
|
||||
// NOTE: This overflows if the difference is too great, e.g. used to do
|
||||
// that when teleported by silent SE7s.
|
||||
s->xvel = ksqrt((p->pos.x-p->bobposx)*(p->pos.x-p->bobposx)+(p->pos.y-p->bobposy)*(p->pos.y-p->bobposy));
|
||||
|
||||
if (p->on_ground)
|
||||
|
|
Loading…
Reference in a new issue