diff options
author | Paul Gilbert | 2013-07-06 15:25:34 -0400 |
---|---|---|
committer | Paul Gilbert | 2013-07-06 15:25:34 -0400 |
commit | 4a201ba6cfbe47598bb3676adf08a2b5ac3ca6da (patch) | |
tree | 20218c71b4735f976334b39700a00bd13965f211 /engines/tsage | |
parent | d4435e441a5e908818334cb51116a7e9d67f6916 (diff) | |
download | scummvm-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')
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.cpp | 42 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.h | 8 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes1.cpp | 10 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes1.h | 1 |
4 files changed, 27 insertions, 34 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); } /*--------------------------------------------------------------------------*/ diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 5a0eecc56c..24434568ad 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -280,12 +280,10 @@ enum MazeDirection { MAZEDIR_NONE = 0, MAZEDIR_NORTH = 1, MAZEDIR_NORTHEAST = 2, MAZEDIR_SOUTHEAST = 4, MAZEDIR_SOUTH = 5, MAZEDIR_SOUTHWEST = 6, MAZEDIR_WEST = 7, MAZEDIR_NORTHWEST = 8 }; -class MazeUI: public SavedObject { +class MazeUI: public SceneObject { private: void clear(); public: - // Position on screen to show map - Rect _displayBounds; // The dimensions (in cells) of the entire maze map Rect _mapBounds; @@ -307,16 +305,18 @@ public: public: MazeUI(); virtual ~MazeUI(); + void setDisplayBounds(const Rect &r); bool setMazePosition(const Common::Point &pt); void load(int resNum); - void draw(); int getCellFromPixelXY(const Common::Point &pt); int getCellFromCellXY(const Common::Point &p); int pixelToCellXY(Common::Point &pt); virtual Common::String getClassName() { return "MazeUI"; } void synchronize(Serializer &s); + virtual void reposition(); + virtual void draw(); }; class SceneAreaObject: public SceneArea { diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 853638ffd6..59736989ee 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -869,7 +869,6 @@ Scene1200::Scene1200() { _field418 = 0; _field41A = 0; _fixupMaze = false; - _drawMaze = true; } void Scene1200::synchronize(Serializer &s) { @@ -881,7 +880,6 @@ void Scene1200::synchronize(Serializer &s) { s.syncAsSint16LE(_field418); s.syncAsSint16LE(_field41A); s.syncAsSint16LE(_fixupMaze); - s.syncAsSint16LE(_drawMaze); } Scene1200::LaserPanel::LaserPanel() { @@ -1037,7 +1035,6 @@ void Scene1200::LaserPanel::postInit(SceneObjectList *OwnerList) { _jumper3.init(3); R2_GLOBALS._player._canWalk = false; - scene->_drawMaze = false; } void Scene1200::LaserPanel::remove() { @@ -1057,10 +1054,8 @@ void Scene1200::LaserPanel::remove() { _actor2.remove(); SceneArea::remove(); R2_GLOBALS._insetUp--; - // R2_GLOBALS._player._canWalk = true; - scene->_drawMaze = true; } void Scene1200::LaserPanel::process(Event &event) { @@ -1139,7 +1134,6 @@ void Scene1200::postInit(SceneObjectList *OwnerList) { _mazeUI.load(1); _mazeUI.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); - _mazeUI.draw(); R2_GLOBALS._player.enableControl(); _item1.setDetails(Rect(0, 0, 320, 200), 1200, 0, 1, 2, 1, NULL); @@ -1551,16 +1545,12 @@ void Scene1200::dispatch() { if (_fixupMaze) { _mazeUI.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); - _mazeUI.draw(); warning("_gfxManager.sub294AC(unk);"); warning("tmpRect.sub14DF3();"); _fixupMaze = false; } - if (_drawMaze) - _mazeUI.draw(); - if (_field414 != 0) { tmpRect.set(110, 20, 210, 120); _field414--; diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index 08fcd69d6f..1b6ca768ef 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -158,7 +158,6 @@ public: int _field418; int _field41A; bool _fixupMaze; - bool _drawMaze; Scene1200(); void synchronize(Serializer &s); |