aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage/ringworld2/ringworld2_logic.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2013-07-06 15:25:34 -0400
committerPaul Gilbert2013-07-06 15:25:34 -0400
commit4a201ba6cfbe47598bb3676adf08a2b5ac3ca6da (patch)
tree20218c71b4735f976334b39700a00bd13965f211 /engines/tsage/ringworld2/ringworld2_logic.cpp
parentd4435e441a5e908818334cb51116a7e9d67f6916 (diff)
downloadscummvm-rg350-4a201ba6cfbe47598bb3676adf08a2b5ac3ca6da.tar.gz
scummvm-rg350-4a201ba6cfbe47598bb3676adf08a2b5ac3ca6da.tar.bz2
scummvm-rg350-4a201ba6cfbe47598bb3676adf08a2b5ac3ca6da.zip
TSAGE: Fix to show player on top of maze correctly in R2R scene 1200
Diffstat (limited to 'engines/tsage/ringworld2/ringworld2_logic.cpp')
-rw-r--r--engines/tsage/ringworld2/ringworld2_logic.cpp42
1 files changed, 23 insertions, 19 deletions
diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp
index b7034fd49c..ebb09a7e08 100644
--- a/engines/tsage/ringworld2/ringworld2_logic.cpp
+++ b/engines/tsage/ringworld2/ringworld2_logic.cpp
@@ -1303,6 +1303,7 @@ void MazeUI::synchronize(Serializer &s) {
}
void MazeUI::load(int resNum) {
+ postInit();
clear();
_resNum = resNum;
@@ -1324,8 +1325,8 @@ void MazeUI::load(int resNum) {
_mapData = g_resourceManager->getResource(RT17, resNum, 1);
_mapOffset.y = _mapOffset.x = 0;
- _cellsVisible.x = (_displayBounds.width() + _cellSize.x - 1) / _cellSize.x;
- _cellsVisible.y = (_displayBounds.height() + _cellSize.y - 1) / _cellSize.y;
+ _cellsVisible.x = (_bounds.width() + _cellSize.x - 1) / _cellSize.x;
+ _cellsVisible.y = (_bounds.height() + _cellSize.y - 1) / _cellSize.y;
_mapImagePitch = (_cellsVisible.x + 1) * _cellSize.x;
_mapImage.create(_mapImagePitch, _cellSize.y);
@@ -1359,25 +1360,28 @@ bool MazeUI::setMazePosition(const Common::Point &pt) {
retval = true;
}
- if (_mapOffset.x + _displayBounds.width() > _mapBounds.right) {
- _mapOffset.x = _mapBounds.right - _displayBounds.width();
+ if (_mapOffset.x + _bounds.width() > _mapBounds.right) {
+ _mapOffset.x = _mapBounds.right - _bounds.width();
retval = true;
}
- if (_mapOffset.y + _displayBounds.height() > _mapBounds.bottom) {
- _mapOffset.y = _mapBounds.bottom - _displayBounds.height();
+ if (_mapOffset.y + _bounds.height() > _mapBounds.bottom) {
+ _mapOffset.y = _mapBounds.bottom - _bounds.height();
retval = true;
}
return retval;
}
+void MazeUI::reposition() {
+}
+
void MazeUI::draw() {
int yPos = 0;
int ySize;
Visage visage;
- _cellsVisible.y = ((_mapOffset.y % _cellSize.y) + _displayBounds.height() +
+ _cellsVisible.y = ((_mapOffset.y % _cellSize.y) + _bounds.height() +
(_cellSize.y - 1)) / _cellSize.y;
// Loop to handle the cell rows of the visible display area one at a time
@@ -1411,24 +1415,24 @@ void MazeUI::draw() {
if (yPos == 0) {
// First line of the map to be displayed - only the bottom portion of that
// first cell row may be visible
- yPos = _displayBounds.top;
+ yPos = _bounds.top;
ySize = _cellSize.y - (_mapOffset.y % _cellSize.y);
Rect srcBounds(_mapOffset.x % _cellSize.x, _mapOffset.y % _cellSize.y,
- (_mapOffset.x % _cellSize.x) + _displayBounds.width(), _cellSize.y);
- Rect destBounds(_displayBounds.left, yPos, _displayBounds.right, yPos + ySize);
+ (_mapOffset.x % _cellSize.x) + _bounds.width(), _cellSize.y);
+ Rect destBounds(_bounds.left, yPos, _bounds.right, yPos + ySize);
R2_GLOBALS.gfxManager().copyFrom(_mapImage, srcBounds, destBounds);
} else {
- if ((yPos + _cellSize.y) < _displayBounds.bottom) {
+ if ((yPos + _cellSize.y) < _bounds.bottom) {
ySize = _cellSize.y;
} else {
- ySize = _displayBounds.bottom - yPos;
+ ySize = _bounds.bottom - yPos;
}
Rect srcBounds(_mapOffset.x % _cellSize.x, 0,
- (_mapOffset.x % _cellSize.x) + _displayBounds.width(), ySize);
- Rect destBounds(_displayBounds.left, yPos, _displayBounds.right, yPos + ySize);
+ (_mapOffset.x % _cellSize.x) + _bounds.width(), ySize);
+ Rect destBounds(_bounds.left, yPos, _bounds.right, yPos + ySize);
R2_GLOBALS.gfxManager().copyFrom(_mapImage, srcBounds, destBounds);
}
@@ -1436,11 +1440,11 @@ void MazeUI::draw() {
}
int MazeUI::getCellFromPixelXY(const Common::Point &pt) {
- if (!_displayBounds.contains(pt))
+ if (!_bounds.contains(pt))
return -1;
- int cellX = (pt.x - _displayBounds.left + _mapOffset.x) / _cellSize.x;
- int cellY = (pt.y - _displayBounds.top + _mapOffset.y) / _cellSize.y;
+ int cellX = (pt.x - _bounds.left + _mapOffset.x) / _cellSize.x;
+ int cellY = (pt.y - _bounds.top + _mapOffset.y) / _cellSize.y;
if ((cellX >= 0) && (cellY >= 0) && (cellX < _mapCells.x) && (cellY < _mapCells.y))
return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * cellY + cellX) * 2);
@@ -1468,8 +1472,8 @@ int MazeUI::pixelToCellXY(Common::Point &pt) {
}
void MazeUI::setDisplayBounds(const Rect &r) {
- _displayBounds = r;
- _displayBounds.clip(g_globals->gfxManager()._bounds);
+ _bounds = r;
+ _bounds.clip(g_globals->gfxManager()._bounds);
}
/*--------------------------------------------------------------------------*/