diff options
author | Colin Snover | 2017-11-08 16:41:29 -0600 |
---|---|---|
committer | Colin Snover | 2017-11-10 09:57:03 -0600 |
commit | 972c45398679fb4e983d6092122939389487fa55 (patch) | |
tree | d2082b75f317e28a1de994fdcf75199931a0d998 /engines/bbvs/scene.cpp | |
parent | 51329c0dc6ee56d8b843f058aa3257ec9f30b71a (diff) | |
download | scummvm-rg350-972c45398679fb4e983d6092122939389487fa55.tar.gz scummvm-rg350-972c45398679fb4e983d6092122939389487fa55.tar.bz2 scummvm-rg350-972c45398679fb4e983d6092122939389487fa55.zip |
BBVS: Remove all bit shifts of potentially negative integers
Previous patches that removed shifts of constant negative values
to eliminate UB were valid, but did not correct all places where
this engine was potentially bit shifting negative values. There is
no reason to not just use multiplication and division and let the
compiler make the right choice for optimisation for an
architecture, so that is what this patch does.
Diffstat (limited to 'engines/bbvs/scene.cpp')
-rw-r--r-- | engines/bbvs/scene.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/engines/bbvs/scene.cpp b/engines/bbvs/scene.cpp index 5d22ba0cc5..74bbe0618d 100644 --- a/engines/bbvs/scene.cpp +++ b/engines/bbvs/scene.cpp @@ -118,8 +118,8 @@ void BbvsEngine::initScene(bool sounds) { sceneObject->animIndex = soInit->animIndex; sceneObject->frameIndex = sceneObject->anim->frameCount - 1; sceneObject->frameTicks = 1; - sceneObject->x = soInit->x << 16; - sceneObject->y = soInit->y << 16; + sceneObject->x = soInit->x * 65536; + sceneObject->y = soInit->y * 65536; } } @@ -142,7 +142,7 @@ void BbvsEngine::initScene(bool sounds) { int minDistance = 0xFFFFFF; for (int cameraNum = 0; cameraNum < 4; ++cameraNum) { CameraInit *cameraInit = _gameModule->getCameraInit(cameraNum); - int curDistance = ABS(cameraInit->cameraPos.x - (int)(_buttheadObject->x >> 16) + 160); + int curDistance = ABS(cameraInit->cameraPos.x - (int)(_buttheadObject->x / 65536) + 160); if (curDistance < minDistance) { minDistance = curDistance; _currCameraNum = cameraNum; |