mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-30 14:14:43 +00:00
SCUMM: Fix UB shifting negative integers in Actor
This commit is contained in:
parent
1871c7dfea
commit
57084b4a1b
@ -565,13 +565,13 @@ int Actor::actorWalkStep() {
|
|||||||
_pos.y -= 1;
|
_pos.y -= 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tmpX = (_pos.x << 16) + _walkdata.xfrac + (_walkdata.deltaXFactor >> 8) * _scalex;
|
tmpX = (_pos.x * (1 << 16)) + _walkdata.xfrac + (_walkdata.deltaXFactor / 256) * _scalex;
|
||||||
_walkdata.xfrac = (uint16)tmpX;
|
_walkdata.xfrac = (uint16)tmpX;
|
||||||
_pos.x = (tmpX >> 16);
|
_pos.x = (tmpX / (1 << 16));
|
||||||
|
|
||||||
tmpY = (_pos.y << 16) + _walkdata.yfrac + (_walkdata.deltaYFactor >> 8) * _scaley;
|
tmpY = (_pos.y * (1 << 16)) + _walkdata.yfrac + (_walkdata.deltaYFactor / 256) * _scaley;
|
||||||
_walkdata.yfrac = (uint16)tmpY;
|
_walkdata.yfrac = (uint16)tmpY;
|
||||||
_pos.y = (tmpY >> 16);
|
_pos.y = (tmpY / (1 << 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ABS(_pos.x - _walkdata.cur.x) > distX) {
|
if (ABS(_pos.x - _walkdata.cur.x) > distX) {
|
||||||
|
Loading…
Reference in New Issue
Block a user