aboutsummaryrefslogtreecommitdiff
path: root/engines/bbvs
diff options
context:
space:
mode:
authorColin Snover2017-11-08 16:41:29 -0600
committerColin Snover2017-11-10 09:57:03 -0600
commit972c45398679fb4e983d6092122939389487fa55 (patch)
treed2082b75f317e28a1de994fdcf75199931a0d998 /engines/bbvs
parent51329c0dc6ee56d8b843f058aa3257ec9f30b71a (diff)
downloadscummvm-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')
-rw-r--r--engines/bbvs/bbvs.cpp26
-rw-r--r--engines/bbvs/logic.cpp4
-rw-r--r--engines/bbvs/minigames/bbant.cpp80
-rw-r--r--engines/bbvs/scene.cpp6
-rw-r--r--engines/bbvs/walk.cpp22
5 files changed, 69 insertions, 69 deletions
diff --git a/engines/bbvs/bbvs.cpp b/engines/bbvs/bbvs.cpp
index 74518d5a3e..f5daa602ac 100644
--- a/engines/bbvs/bbvs.cpp
+++ b/engines/bbvs/bbvs.cpp
@@ -496,8 +496,8 @@ void BbvsEngine::buildDrawList(DrawList &drawList) {
Animation *anim = sceneObject->anim;
if (anim) {
drawList.add(anim->frameSpriteIndices[sceneObject->frameIndex],
- (sceneObject->x >> 16) - _cameraPos.x, (sceneObject->y >> 16) - _cameraPos.y,
- sceneObject->y >> 16);
+ (sceneObject->x / 65536) - _cameraPos.x, (sceneObject->y / 65536) - _cameraPos.y,
+ sceneObject->y / 65536);
}
}
@@ -774,8 +774,8 @@ void BbvsEngine::updateScene(bool clicked) {
SceneObject *sceneObject = &_sceneObjects[i];
if (sceneObject->anim) {
Common::Rect frameRect = sceneObject->anim->frameRects1[sceneObject->frameIndex];
- const int objY = sceneObject->y >> 16;
- frameRect.translate(sceneObject->x >> 16, objY);
+ const int objY = sceneObject->y / 65536;
+ frameRect.translate(sceneObject->x / 65536, objY);
if (lastPriority <= objY && frameRect.width() > 0 && frameRect.contains(_mousePos)) {
lastPriority = objY;
_activeItemIndex = i;
@@ -898,7 +898,7 @@ void BbvsEngine::updateScene(bool clicked) {
if (_beavisObject->anim) {
Common::Rect frameRect = _beavisObject->anim->frameRects2[_beavisObject->frameIndex];
- frameRect.translate(_beavisObject->x >> 16, (_beavisObject->y >> 16) + 1);
+ frameRect.translate(_beavisObject->x / 65536, (_beavisObject->y / 65536) + 1);
if (!frameRect.isEmpty() && frameRect.contains(_walkMousePos))
_walkMousePos.y = frameRect.bottom;
}
@@ -938,7 +938,7 @@ bool BbvsEngine::performActionCommand(ActionCommand *actionCommand) {
{
SceneObject *sceneObject = &_sceneObjects[actionCommand->sceneObjectIndex];
debug(5, "[%s] walks from (%d, %d) to (%d, %d)", sceneObject->sceneObjectDef->name,
- sceneObject->x >> 16, sceneObject->y >> 16, actionCommand->walkDest.x, actionCommand->walkDest.y);
+ sceneObject->x / 65536, sceneObject->y / 65536, actionCommand->walkDest.x, actionCommand->walkDest.y);
walkObject(sceneObject, actionCommand->walkDest, actionCommand->param);
}
return true;
@@ -946,8 +946,8 @@ bool BbvsEngine::performActionCommand(ActionCommand *actionCommand) {
case kActionCmdMoveObject:
{
SceneObject *sceneObject = &_sceneObjects[actionCommand->sceneObjectIndex];
- sceneObject->x = actionCommand->walkDest.x << 16;
- sceneObject->y = actionCommand->walkDest.y << 16;
+ sceneObject->x = actionCommand->walkDest.x * 65536;
+ sceneObject->y = actionCommand->walkDest.y * 65536;
sceneObject->xIncr = 0;
sceneObject->yIncr = 0;
sceneObject->walkCount = 0;
@@ -1074,7 +1074,7 @@ bool BbvsEngine::processCurrAction() {
if (sceneObject->walkDestPt.x != -1) {
debug(5, "waiting for walk to finish");
actionsFinished = false;
- } else if ((int16)(sceneObject->x >> 16) != soAction->walkDest.x || (int16)(sceneObject->y >> 16) != soAction->walkDest.y) {
+ } else if ((int16)(sceneObject->x / 65536) != soAction->walkDest.x || (int16)(sceneObject->y / 65536) != soAction->walkDest.y) {
debug(5, "starting to walk");
sceneObject->walkDestPt = soAction->walkDest;
actionsFinished = false;
@@ -1214,8 +1214,8 @@ void BbvsEngine::updateCommon() {
}
if (!_currAction && _buttheadObject) {
- int16 buttheadX = _buttheadObject->x >> 16;
- int16 buttheadY = _buttheadObject->y >> 16;
+ int16 buttheadX = _buttheadObject->x / 65536;
+ int16 buttheadY = _buttheadObject->y / 65536;
CameraInit *cameraInit = _gameModule->getCameraInit(_currCameraNum);
for (int i = 0; i < 8; ++i) {
if (cameraInit->rects[i].contains(buttheadX, buttheadY)) {
@@ -1252,8 +1252,8 @@ void BbvsEngine::updateCommon() {
// Check if Butthead is inside a scene exit
if (_newSceneNum == 0 && !_currAction && _buttheadObject) {
- int16 buttheadX = _buttheadObject->x >> 16;
- int16 buttheadY = _buttheadObject->y >> 16;
+ int16 buttheadX = _buttheadObject->x / 65536;
+ int16 buttheadY = _buttheadObject->y / 65536;
for (int i = 0; i < _gameModule->getSceneExitsCount(); ++i) {
SceneExit *sceneExit = _gameModule->getSceneExit(i);
if (sceneExit->rect.contains(buttheadX, buttheadY)) {
diff --git a/engines/bbvs/logic.cpp b/engines/bbvs/logic.cpp
index 2f9925f7a0..47f8dd938b 100644
--- a/engines/bbvs/logic.cpp
+++ b/engines/bbvs/logic.cpp
@@ -82,7 +82,7 @@ bool BbvsEngine::evalCondition(Conditions &conditions) {
break;
case kCondIsButtheadAtBgObject:
result = _buttheadObject &&
- _gameModule->getBgObject(condition.value2)->rect.contains(_buttheadObject->x >> 16, _buttheadObject->y >> 16);
+ _gameModule->getBgObject(condition.value2)->rect.contains(_buttheadObject->x / 65536, _buttheadObject->y / 65536);
break;
case kCondIsNotSceneVisited:
result = _sceneVisited[_currSceneNum] == 0;
@@ -209,7 +209,7 @@ int BbvsEngine::evalDialogCondition(Conditions &conditions) {
break;
case kCondIsButtheadAtBgObject:
success = _buttheadObject &&
- _gameModule->getBgObject(condition.value2)->rect.contains(_buttheadObject->x >> 16, _buttheadObject->y >> 16);
+ _gameModule->getBgObject(condition.value2)->rect.contains(_buttheadObject->x / 65536, _buttheadObject->y / 65536);
break;
case kCondIsNotSceneVisited:
success = _sceneVisited[_currSceneNum] == 0;
diff --git a/engines/bbvs/minigames/bbant.cpp b/engines/bbvs/minigames/bbant.cpp
index 72c2d62b13..5310d53357 100644
--- a/engines/bbvs/minigames/bbant.cpp
+++ b/engines/bbvs/minigames/bbant.cpp
@@ -85,7 +85,7 @@ void MinigameBbAnt::buildDrawList1(DrawList &drawList) {
Obj *obj = &_objects[i];
if (obj->kind) {
drawList.add(obj->anim->frameIndices[obj->frameIndex],
- _stompX + (obj->x >> 16), _stompY + (obj->y >> 16),
+ _stompX + (obj->x / 65536), _stompY + (obj->y / 65536),
obj->priority);
}
}
@@ -256,8 +256,8 @@ void MinigameBbAnt::initObjects1() {
for (int i = 3; i < 12; ++i) {
const ObjInit *objInit = getObjInit(i - 3);
_objects[i].kind = 6;
- _objects[i].x = objInit->x << 16;
- _objects[i].y = objInit->y << 16;
+ _objects[i].x = objInit->x * 65536;
+ _objects[i].y = objInit->y * 65536;
_objects[i].xIncr = 0;
_objects[i].yIncr = 0;
_objects[i].anim = objInit->anim1;
@@ -429,7 +429,7 @@ bool MinigameBbAnt::updateStatus1(int mouseX, int mouseY, uint mouseButtons) {
if ((mouseButtons & kLeftButtonClicked) && _objects[2].status == 0 && isMagGlassAtBeavisLeg(2)) {
if (_vm->getRandom(10) == 1 && !isAnySoundPlaying(kSoundTbl4, 10))
playSound(16);
- insertSmokeObj(_objects[0].x << 16, _objects[0].y << 16);
+ insertSmokeObj(_objects[0].x * 65536, _objects[0].y * 65536);
}
if (_skullBugCtr > 0) {
@@ -515,8 +515,8 @@ bool MinigameBbAnt::updateStatus2(int mouseX, int mouseY, uint mouseButtons) {
Obj *obj = &_objects[i];
if (obj->status == 13) {
const ObjInit *objInit = getObjInit(i - 3);
- obj->x = objInit->x << 16;
- obj->y = objInit->y << 16;
+ obj->x = objInit->x * 65536;
+ obj->y = objInit->y * 65536;
obj->anim = objInit->anim3;
obj->frameIndex = 0;
obj->ticks = _objects[0].anim->frameTicks[0];
@@ -588,7 +588,7 @@ void MinigameBbAnt::insertBugSmokeObj(int x, int y, int bugObjIndex) {
obj->priority = 950;
if (bugObj->status >= 4 && (bugObj->status <= 6 || bugObj->status == 8)) {
obj->xIncr = 0;
- obj->yIncr = -0x10000;
+ obj->yIncr = (-1 * 65536);
} else {
obj->xIncr = bugObj->xIncr / 8;
obj->yIncr = bugObj->yIncr / 8;
@@ -648,11 +648,11 @@ void MinigameBbAnt::insertBugObj(int kind, int animIndexIncr, int always0, int x
obj->field30 = field30;
obj->animIndexIncr = animIndexIncr;
obj->kind = kind;
- obj->x = x << 16;
- obj->y = y << 16;
+ obj->x = x * 65536;
+ obj->y = y * 65536;
obj->priority = 610;
- obj->xIncr = kPosIncrTbl1[0].x << 16;
- obj->yIncr = kPosIncrTbl1[0].y << 16;
+ obj->xIncr = kPosIncrTbl1[0].x * 65536;
+ obj->yIncr = kPosIncrTbl1[0].y * 65536;
obj->anim = objKindAnimTable[0];
obj->frameIndex = 0;
obj->ticks = obj->anim->frameTicks[0];
@@ -692,8 +692,8 @@ void MinigameBbAnt::updateBugObjAnim(int objIndex) {
break;
}
const ObjAnimation * const *objKindAnimTable = getObjKindAnimTable(obj->kind);
- obj->xIncr = kPosIncrTbl1[obj->animIndexIncr].x << 16;
- obj->yIncr = kPosIncrTbl1[obj->animIndexIncr].y << 16;
+ obj->xIncr = kPosIncrTbl1[obj->animIndexIncr].x * 65536;
+ obj->yIncr = kPosIncrTbl1[obj->animIndexIncr].y * 65536;
obj->anim = objKindAnimTable[obj->animIndexIncr];
obj->frameIndex = 0;
obj->ticks = obj->anim->frameTicks[0];
@@ -711,8 +711,8 @@ void MinigameBbAnt::updateObjAnim2(int objIndex) {
if (obj->animIndexIncr >= 8)
obj->animIndexIncr %= 8;
const ObjAnimation * const *objKindAnimTable = getObjKindAnimTable(obj->kind);
- obj->xIncr = kPosIncrTbl1[obj->animIndex + obj->animIndexIncr].x << 16;
- obj->yIncr = kPosIncrTbl1[obj->animIndex + obj->animIndexIncr].y << 16;
+ obj->xIncr = kPosIncrTbl1[obj->animIndex + obj->animIndexIncr].x * 65536;
+ obj->yIncr = kPosIncrTbl1[obj->animIndex + obj->animIndexIncr].y * 65536;
obj->anim = objKindAnimTable[obj->animIndex + obj->animIndexIncr];
obj->frameIndex = 0;
obj->ticks = obj->anim->frameTicks[0];
@@ -730,8 +730,8 @@ bool MinigameBbAnt::isBugOutOfScreen(int objIndex) {
Obj *obj = &_objects[objIndex];
return
- obj->x < -0xa0000 || obj->x > (330 << 16) ||
- obj->y < -0xa0000 || obj->y > (250 << 16);
+ obj->x < (-10 * 65536) || obj->x > (330 * 65536) ||
+ obj->y < (-10 * 65536) || obj->y > (250 * 65536);
}
void MinigameBbAnt::updateObjAnim3(int objIndex) {
@@ -743,8 +743,8 @@ void MinigameBbAnt::updateObjAnim3(int objIndex) {
if (obj->animIndexIncr > 7)
obj->animIndexIncr = 0;
const ObjAnimation * const *objKindAnimTable = getObjKindAnimTable(obj->kind);
- obj->xIncr = kPosIncrTbl1[obj->animIndexIncr].x << 16;
- obj->yIncr = kPosIncrTbl1[obj->animIndexIncr].y << 16;
+ obj->xIncr = kPosIncrTbl1[obj->animIndexIncr].x * 65536;
+ obj->yIncr = kPosIncrTbl1[obj->animIndexIncr].y * 65536;
obj->anim = objKindAnimTable[obj->animIndexIncr];
}
@@ -824,8 +824,8 @@ void MinigameBbAnt::updateBugObj1(int objIndex) {
_objects[obj->otherObjIndex].y = obj->y;
if (isBugOutOfScreen(objIndex)) {
_objects[obj->otherObjIndex].status = 13;
- _objects[obj->otherObjIndex].x = (500 << 16);
- _objects[obj->otherObjIndex].y = (500 << 16);
+ _objects[obj->otherObjIndex].x = (500 * 65536);
+ _objects[obj->otherObjIndex].y = (500 * 65536);
removeBugObj(objIndex);
--_counter1;
}
@@ -847,8 +847,8 @@ void MinigameBbAnt::updateBugObj1(int objIndex) {
if (flag1) {
const ObjAnimation * const *objKindAnimTable = getObjKindAnimTable(obj->kind);
obj->status = 7;
- obj->xIncr = kPosIncrTbl2[obj->animIndexIncr].x << 16;
- obj->yIncr = kPosIncrTbl2[obj->animIndexIncr].y << 16;
+ obj->xIncr = kPosIncrTbl2[obj->animIndexIncr].x * 65536;
+ obj->yIncr = kPosIncrTbl2[obj->animIndexIncr].y * 65536;
obj->anim = objKindAnimTable[obj->animIndexIncr + 8];
obj->frameIndex = 0;
obj->ticks = obj->anim->frameTicks[0];
@@ -873,8 +873,8 @@ void MinigameBbAnt::updateBugObj1(int objIndex) {
obj->anim = obj->anim2;
obj->frameIndex = obj->frameIndex2;
obj->ticks = obj->ticks2;
- obj->xIncr = kPosIncrTbl1[obj->animIndex + obj->animIndexIncr].x << 16;
- obj->yIncr = kPosIncrTbl1[obj->animIndex + obj->animIndexIncr].y << 16;
+ obj->xIncr = kPosIncrTbl1[obj->animIndex + obj->animIndexIncr].x * 65536;
+ obj->yIncr = kPosIncrTbl1[obj->animIndex + obj->animIndexIncr].y * 65536;
obj->priority = 610;
}
break;
@@ -931,7 +931,7 @@ void MinigameBbAnt::updateFootObj(int objIndex) {
case 1:
obj->xIncr = -0x8000;
- obj->yIncr = -0x40000;
+ obj->yIncr = (-4 * 65536);
obj->status = 2;
_stompCounter1 += 5;
_stompCounter2 = 100;
@@ -941,9 +941,9 @@ void MinigameBbAnt::updateFootObj(int objIndex) {
obj->x += obj->xIncr;
obj->y += obj->yIncr;
obj->yIncr += 0x2000;
- if (obj->y < (20 << 16)) {
+ if (obj->y < (20 * 65536)) {
obj->xIncr = 0x8000;
- obj->yIncr = (7 << 16);
+ obj->yIncr = (7 * 65536);
obj->status = 3;
}
break;
@@ -953,8 +953,8 @@ void MinigameBbAnt::updateFootObj(int objIndex) {
obj->y += obj->yIncr;
obj->yIncr += 0x2000;
if (obj->y >= 0x4B0000) {
- obj->x = (40 << 16);
- obj->y = (75 << 16);
+ obj->x = (40 * 65536);
+ obj->y = (75 * 65536);
obj->status = 4;
_stompDelay1 = 6;
_stompY = 0;
@@ -1023,15 +1023,15 @@ bool MinigameBbAnt::isBugAtCandy(int objIndex, int &candyObjIndex) {
if (obj->kind >= 1 && obj->kind <= 4) {
const BBRect &frameRect1 = obj->anim->frameRects[obj->frameIndex];
- const int obj1X1 = frameRect1.x + (obj->x >> 16);
- const int obj1Y1 = frameRect1.y + (obj->y >> 16);
+ const int obj1X1 = frameRect1.x + (obj->x / 65536);
+ const int obj1Y1 = frameRect1.y + (obj->y / 65536);
const int obj1X2 = obj1X1 + frameRect1.width;
const int obj1Y2 = obj1Y1 + frameRect1.height;
for (int i = 3; i < 12 && !result; ++i) {
Obj *obj2 = &_objects[i];
const BBRect &frameRect2 = obj->anim->frameRects[obj2->frameIndex]; // sic
- const int obj2X1 = (obj2->x >> 16) + frameRect2.x;
- const int obj2Y1 = (obj2->y >> 16) + frameRect2.y;
+ const int obj2X1 = (obj2->x / 65536) + frameRect2.x;
+ const int obj2Y1 = (obj2->y / 65536) + frameRect2.y;
const int obj2X2 = obj2X1 + frameRect2.width;
const int obj2Y2 = obj2Y1 + frameRect2.height;
if (obj2->status == 9 && obj1X1 <= obj2X2 && obj1X2 >= obj2X1 && obj1Y1 <= obj2Y2 && obj1Y2 >= obj2Y1) {
@@ -1055,8 +1055,8 @@ bool MinigameBbAnt::isMagGlassAtBug(int objIndex) {
const int obj1X2 = obj1X1 + frameRect1.width;
const int obj1Y2 = obj1Y1 + frameRect1.height;
const BBRect &frameRect2 = obj->anim->frameRects[obj->frameIndex];
- const int obj2X1 = (obj->x >> 16) + frameRect2.x;
- const int obj2Y1 = (obj->y >> 16) + frameRect2.y;
+ const int obj2X1 = (obj->x / 65536) + frameRect2.x;
+ const int obj2Y1 = (obj->y / 65536) + frameRect2.y;
const int obj2X2 = obj2X1 + frameRect2.width;
const int obj2Y2 = obj2Y1 + frameRect2.height;
if (obj2X2 >= obj1X1 && obj1X2 >= obj2X1 && obj1Y1 <= obj2Y2 && obj1Y2 >= obj2Y1)
@@ -1076,8 +1076,8 @@ bool MinigameBbAnt::isMagGlassAtBeavisLeg(int objIndex) {
const int obj1X2 = obj1X1 + frameRect1.width;
const int obj1Y2 = obj1Y1 + frameRect1.height;
const BBRect &frameRect2 = obj->anim->frameRects[obj->frameIndex];
- const int obj2X1 = (obj->x >> 16) + frameRect2.x;
- const int obj2Y1 = (obj->y >> 16) + frameRect2.y;
+ const int obj2X1 = (obj->x / 65536) + frameRect2.x;
+ const int obj2Y1 = (obj->y / 65536) + frameRect2.y;
const int obj2X2 = obj2X1 + frameRect2.width;
const int obj2Y2 = obj2Y1 + frameRect2.height;
if (obj2X2 >= obj1X1 && obj1X2 >= obj2X1 && obj1Y1 <= obj2Y2 && obj1Y2 >= obj2Y1)
@@ -1089,8 +1089,8 @@ bool MinigameBbAnt::testObj5(int objIndex) {
Obj *obj = &_objects[objIndex];
bool result = false;
if (obj->kind >= 1 && obj->kind <= 5) {
- const int x = obj->x >> 16;
- const int y = obj->y >> 16;
+ const int x = obj->x / 65536;
+ const int y = obj->y / 65536;
if (x < 0 || x >= 110 || y < 0 || y >= 110) {
obj->flag = 0;
} else if (!obj->flag) {
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;
diff --git a/engines/bbvs/walk.cpp b/engines/bbvs/walk.cpp
index f3207be1a8..ea47c24080 100644
--- a/engines/bbvs/walk.cpp
+++ b/engines/bbvs/walk.cpp
@@ -48,8 +48,8 @@ void BbvsEngine::startWalkObject(SceneObject *sceneObject) {
return;
initWalkAreas(sceneObject);
- _sourceWalkAreaPt.x = sceneObject->x >> 16;
- _sourceWalkAreaPt.y = sceneObject->y >> 16;
+ _sourceWalkAreaPt.x = sceneObject->x / 65536;
+ _sourceWalkAreaPt.y = sceneObject->y / 65536;
_sourceWalkArea = getWalkAreaAtPos(_sourceWalkAreaPt);
if (!_sourceWalkArea)
@@ -107,8 +107,8 @@ void BbvsEngine::updateWalkObject(SceneObject *sceneObject) {
}
void BbvsEngine::walkObject(SceneObject *sceneObject, const Common::Point &destPt, int walkSpeed) {
- int deltaX = destPt.x - (sceneObject->x >> 16);
- int deltaY = destPt.y - (sceneObject->y >> 16);
+ int deltaX = destPt.x - (sceneObject->x / 65536);
+ int deltaY = destPt.y - (sceneObject->y / 65536);
float distance = (float)sqrt((double)(deltaX * deltaX + deltaY * deltaY));
// NOTE The original doesn't have this check but without it the whole pathfinding breaks
if (distance > 0.0f) {
@@ -190,19 +190,19 @@ WalkInfo *BbvsEngine::addWalkInfo(int16 x, int16 y, int delta, int direction, in
}
void BbvsEngine::initWalkAreas(SceneObject *sceneObject) {
- int16 objX = sceneObject->x >> 16;
- int16 objY = sceneObject->y >> 16;
+ int16 objX = sceneObject->x / 65536;
+ int16 objY = sceneObject->y / 65536;
Common::Rect rect;
bool doRect = false;
Common::Rect *workWalkableRects;
if (_buttheadObject == sceneObject && _beavisObject->anim) {
rect = _beavisObject->anim->frameRects2[_beavisObject->frameIndex];
- rect.translate(_beavisObject->x >> 16, 1 + (_beavisObject->y >> 16));
+ rect.translate(_beavisObject->x / 65536, 1 + (_beavisObject->y / 65536));
doRect = !rect.isEmpty();
} else if (_buttheadObject->anim) {
rect = _buttheadObject->anim->frameRects2[_buttheadObject->frameIndex];
- rect.translate(_buttheadObject->x >> 16, 1 + (_buttheadObject->y >> 16));
+ rect.translate(_buttheadObject->x / 65536, 1 + (_buttheadObject->y / 65536));
doRect = !rect.isEmpty();
}
@@ -293,8 +293,8 @@ bool BbvsEngine::canButtheadWalkToDest(const Common::Point &destPt) {
_walkReachedDestArea = false;
initWalkAreas(_buttheadObject);
- srcPt.x = _buttheadObject->x >> 16;
- srcPt.y = _buttheadObject->y >> 16;
+ srcPt.x = _buttheadObject->x / 65536;
+ srcPt.y = _buttheadObject->y / 65536;
_sourceWalkArea = getWalkAreaAtPos(srcPt);
if (_sourceWalkArea) {
_destWalkArea = getWalkAreaAtPos(destPt);
@@ -441,7 +441,7 @@ void BbvsEngine::updateWalkableRects() {
Animation *anim = sceneObject->anim;
if (anim && _buttheadObject != sceneObject && _beavisObject != sceneObject) {
Common::Rect rect = sceneObject->anim->frameRects2[sceneObject->frameIndex];
- rect.translate(sceneObject->x >> 16, sceneObject->y >> 16);
+ rect.translate(sceneObject->x / 65536, sceneObject->y / 65536);
int count = _walkableRectsCount;
_walkableRectsCount = 0;
for (int j = 0; j < count; ++j)