- clamp player sprite's xvel between 0 and 512 to stop it going into the negative with rapid posx/posy changes due to teleporting.

* With steroids and a controller (controllers have a slightly higher max fvel/svel than a keyboard), I could not get xvel to exceed 503.
* Fixes #123.
This commit is contained in:
Mitchell Richters 2020-08-09 16:24:48 +10:00
parent d731bf4e57
commit cf548e055e

View file

@ -2742,8 +2742,7 @@ void processinput_d(int snum)
playerweaponsway(p, s);
s->xvel =
ksqrt((p->posx - p->bobposx) * (p->posx - p->bobposx) + (p->posy - p->bobposy) * (p->posy - p->bobposy));
s->xvel = clamp(ksqrt((p->posx - p->bobposx) * (p->posx - p->bobposx) + (p->posy - p->bobposy) * (p->posy - p->bobposy)), 0, 512);
if (p->on_ground) p->bobcounter += sprite[p->i].xvel >> 1;
backuppos(p, ud.clipping == 0 && (sector[p->cursectnum].floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS));