LAB: Fix a bug pointed out by wjp in getObject

This commit is contained in:
Strangerke 2015-12-20 16:15:27 +01:00 committed by Willem Jan Palenstijn
parent 7e047b45b7
commit 6981d750ea
3 changed files with 6 additions and 1 deletions

View File

@ -87,7 +87,7 @@ CloseData *LabEngine::getObject(Common::Point pos, CloseDataPtr closePtr) {
Common::Rect objRect;
while (wrkClosePtr) {
objRect = Common::Rect(_utils->scaleX(wrkClosePtr->_x1), _utils->scaleX(wrkClosePtr->_y1), _utils->scaleX(wrkClosePtr->_x2), _utils->scaleX(wrkClosePtr->_y2));
objRect = _utils->rectScale(wrkClosePtr->_x1, wrkClosePtr->_y1, wrkClosePtr->_x2, wrkClosePtr->_y2);
if (objRect.contains(pos))
return wrkClosePtr;

View File

@ -60,6 +60,10 @@ uint16 Utils::scaleY(uint16 y) {
return ((y * 10) / 24);
}
Common::Rect Utils::rectScale(int16 x1, int16 y1, int16 x2, int16 y2) {
return Common::Rect(scaleX(x1), scaleY(y1), scaleX(x2), scaleY(y2));
}
uint16 Utils::mapScaleX(uint16 x) {
if (_vm->_isHiRes)
return (x - 45);

View File

@ -51,6 +51,7 @@ public:
uint16 scaleX(uint16 x);
uint16 scaleY(uint16 y);
Common::Rect rectScale(int16 x1, int16 y1, int16 x2, int16 y2);
int16 vgaScaleX(int16 x);
int16 vgaScaleY(int16 y);
Common::Rect vgaRectScale(int16 x1, int16 y1, int16 x2, int16 y2);