diff options
author | Colin Snover | 2017-11-29 19:36:28 -0600 |
---|---|---|
committer | Colin Snover | 2017-12-01 19:22:35 -0600 |
commit | 57084b4a1b23e131be7497c4c97c75db060210c9 (patch) | |
tree | e6629d05a06454e04ea25cab172de5558ea539a0 /engines/scumm | |
parent | 1871c7dfea6eaebca98ea89be5e25db0d9b86361 (diff) | |
download | scummvm-rg350-57084b4a1b23e131be7497c4c97c75db060210c9.tar.gz scummvm-rg350-57084b4a1b23e131be7497c4c97c75db060210c9.tar.bz2 scummvm-rg350-57084b4a1b23e131be7497c4c97c75db060210c9.zip |
SCUMM: Fix UB shifting negative integers in Actor
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/actor.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index e3f93e5c97..f48f0ba46b 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -565,13 +565,13 @@ int Actor::actorWalkStep() { _pos.y -= 1; } } 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; - _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; - _pos.y = (tmpY >> 16); + _pos.y = (tmpY / (1 << 16)); } if (ABS(_pos.x - _walkdata.cur.x) > distX) { |