diff options
author | Paul Gilbert | 2013-06-29 23:01:45 -0400 |
---|---|---|
committer | Paul Gilbert | 2013-06-29 23:01:45 -0400 |
commit | 5eaa253732e5caa1def4da8bca4c1916a6919c89 (patch) | |
tree | 2240650c0312bd050ead211655bcfc97199cf8b5 /engines/tsage | |
parent | 4bc868c89668d0d7391530928ac1402aafbf1e1b (diff) | |
download | scummvm-rg350-5eaa253732e5caa1def4da8bca4c1916a6919c89.tar.gz scummvm-rg350-5eaa253732e5caa1def4da8bca4c1916a6919c89.tar.bz2 scummvm-rg350-5eaa253732e5caa1def4da8bca4c1916a6919c89.zip |
TSAGE: Renaming of derived R2R scene 3500 Maze UI
Diffstat (limited to 'engines/tsage')
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.cpp | 40 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.h | 13 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes3.cpp | 78 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes3.h | 8 |
4 files changed, 70 insertions, 69 deletions
diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index c17fcc9900..9231225487 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -1278,9 +1278,12 @@ void SceneAreaObject::setDetails(int resNum, int lookLineNum, int talkLineNum, i MazeUI::MazeUI() { _mapData = NULL; - _field12 = _field14 = 0; - _mapCells.x = _mapCells.y = _cellSize.x = _cellSize.y = _cellOffset.x = _cellOffset.y = 0; - _resNum = _cellsResNum = _field36 = _field38 = _mapImagePitch = _field40 = 0; + _cellsVisible.x = _cellsVisible.y = 0; + _mapCells.x = _mapCells.y = 0; + _cellSize.x = _cellSize.y = 0; + _cellOffset.x = _cellOffset.y = 0; + _resNum = _cellsResNum = 0; + _frameCount = _resCount = _mapImagePitch = _unused = 0; } MazeUI::~MazeUI() { @@ -1294,13 +1297,9 @@ void MazeUI::synchronize(Serializer &s) { if (s.isLoading()) load(_resNum); - s.syncAsSint16LE(_field12); - s.syncAsSint16LE(_field14); s.syncAsSint16LE(_cellOffset.x); s.syncAsSint16LE(_cellOffset.y); - s.syncAsSint16LE(_field36); - s.syncAsSint16LE(_field38); - s.syncAsSint16LE(_field40); + s.syncAsSint16LE(_unused); } void MazeUI::load(int resNum) { @@ -1312,8 +1311,8 @@ void MazeUI::load(int resNum) { _cellsResNum = resNum + 1000; _mapCells.x = READ_LE_UINT16(header + 2); _mapCells.y = READ_LE_UINT16(header + 4); - _field36 = 10; - _field38 = _field36 << 3; + _frameCount = 10; + _resCount = _frameCount << 3; Visage visage; visage.setVisage(_cellsResNum, 1); @@ -1325,10 +1324,10 @@ void MazeUI::load(int resNum) { _mapData = g_resourceManager->getResource(RT17, resNum, 1); _cellOffset.y = _cellOffset.x = 0; - _field12 = (_displayBounds.width() + _cellSize.x - 1) / _cellSize.x; - _field14 = (_displayBounds.height() + _cellSize.y - 1) / _cellSize.y; + _cellsVisible.x = (_displayBounds.width() + _cellSize.x - 1) / _cellSize.x; + _cellsVisible.y = (_displayBounds.height() + _cellSize.y - 1) / _cellSize.y; - _mapImagePitch = (_field12 + 1) * _cellSize.x; + _mapImagePitch = (_cellsVisible.x + 1) * _cellSize.x; _mapImage.create(_mapImagePitch, _cellSize.y); _mapBounds = Rect(0, 0, _cellSize.x * _mapCells.x, _cellSize.y * _mapCells.y); @@ -1348,8 +1347,7 @@ void MazeUI::clear() { bool MazeUI::setMazePosition(const Common::Point &pt) { bool retval = false; - _cellOffset.x = pt.x; - _cellOffset.y = pt.y; + _cellOffset = pt; if (_cellOffset.x < _mapBounds.top) { _cellOffset.x = _mapBounds.top; @@ -1379,17 +1377,17 @@ void MazeUI::draw() { int yInc; Visage visage; - for (int yp = 0; yp < _field14; yp += yInc) { + for (int yp = 0; yp < _cellsVisible.y; yp += yInc) { int y = yp + _cellOffset.y / _cellSize.y; - for (int idx = 0; idx > _field12; ++idx) { + for (int idx = 0; idx > _cellsVisible.x; ++idx) { int x = _cellOffset.x / _cellSize.x + idx; int cell = getCellFromCellXY(Common::Point(x, y)); if (cell >= 0) { - int frameNum = (cell % _field36) + 1; - int rlbNum = (cell % _field38) / _field36 + 1; - int resNum = _cellsResNum + (cell / _field38); + int frameNum = (cell % _frameCount) + 1; + int rlbNum = (cell % _resCount) / _frameCount + 1; + int resNum = _cellsResNum + (cell / _resCount); visage.setVisage(resNum, rlbNum); GfxSurface frame = visage.getFrame(frameNum); @@ -1434,7 +1432,7 @@ int MazeUI::getCellFromPixelXY(const Common::Point &pt) { int cellY = (pt.y - _displayBounds.top + _cellOffset.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); + return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * cellY + cellX) * 2); return -1; } diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index a40d4fe24e..76bea81065 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -280,23 +280,26 @@ class MazeUI: public SavedObject { private: void clear(); public: + // Position on screen to show map Rect _displayBounds; + // The dimensions (in cells) of the entire maze map Rect _mapBounds; + // Encoded cell map specifying the features of the maze byte *_mapData; + // Image surface used to store a line of the map for rendering GfxSurface _mapImage; - int _field12; - int _field14; + Common::Point _cellsVisible; Common::Point _mapCells; Common::Point _cellSize; Common::Point _cellOffset; int _resNum; int _cellsResNum; - int _field36; - int _field38; + int _frameCount; + int _resCount; int _mapImagePitch; - int _field40; + int _unused; public: MazeUI(); virtual ~MazeUI(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 2e81bebc04..2b42cbd63f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -3054,26 +3054,26 @@ void Scene3500::Actor7::sub109693(Common::Point Pt) { /*--------------------------------------------------------------------------*/ -int Scene3500::MazeUI3500::sub1097C9(int arg1) { - return (_cellSize.x / 2) + arg1 - (arg1 % _cellSize.x); +int Scene3500::MazeUI3500::cellFromX(int x) { + return (_cellSize.x / 2) + x - (x % _cellSize.x); } -int Scene3500::MazeUI3500::sub1097EF(int arg1) { - return (_cellSize.y / 2) + arg1 - (arg1 % _cellSize.y); +int Scene3500::MazeUI3500::cellFromY(int y) { + return (_cellSize.y / 2) + y - (y % _cellSize.y); } -int Scene3500::MazeUI3500::sub109C09(Common::Point pt) { - int vx = pt.x / _cellSize.x; - int vy = pt.y / _cellSize.y; +int Scene3500::MazeUI3500::getCellFromMapXY(Common::Point pt) { + int cellX = pt.x / _cellSize.x; + int cellY = pt.y / _cellSize.y; - if ((vx >= 0) && (_mapCells.x > vx) && (_mapCells.y > vy)) { - return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * vy + vx) * 2); + if ((cellX >= 0) && (cellY >= 0) && (cellX < _mapCells.x) && (cellY < _mapCells.y)) { + return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * cellY + cellX) * 2); } else return -1; } -int Scene3500::MazeUI3500::sub109C5E(Common::Point &p) { - int retVal = setMazePosition(p); +bool Scene3500::MazeUI3500::seteMazePosition2(Common::Point &p) { + bool retVal = setMazePosition(p); p = _cellOffset; return retVal; @@ -3224,9 +3224,9 @@ void Scene3500::Action1::signal() { setDelay(1); break; case 4: { - int si = scene->_mazeUI.sub109C09(Common::Point(scene->_position1.x + 70, scene->_position1.y + 46)); - int var2 = scene->_mazeUI.sub1097C9(scene->_position1.x + 70) - 70; - int var4 = scene->_mazeUI.sub1097EF(scene->_position1.y + 46) - 46; + int si = scene->_mazeUI.getCellFromMapXY(Common::Point(scene->_position1.x + 70, scene->_position1.y + 46)); + int var2 = scene->_mazeUI.cellFromX(scene->_position1.x + 70) - 70; + int var4 = scene->_mazeUI.cellFromY(scene->_position1.y + 46) - 46; int di = abs(var2 - scene->_position1.x); int var6 = abs(var4 - scene->_position1.y); @@ -3361,12 +3361,12 @@ void Scene3500::Action1::signal() { case 0: // No break on purpose case 4: - scene->_position1.x = scene->_mazeUI.sub1097C9(scene->_position1.x + 70) - 70; + scene->_position1.x = scene->_mazeUI.cellFromX(scene->_position1.x + 70) - 70; break; case 2: // No break on purpose case 6: - scene->_position1.y = scene->_mazeUI.sub1097EF(scene->_position1.y + 46) - 46; + scene->_position1.y = scene->_mazeUI.cellFromY(scene->_position1.y + 46) - 46; break; default: break; @@ -3824,15 +3824,15 @@ void Scene3500::dispatch() { var127A = _position1.x; di = _position1.y; - var_4 = _mazeUI.sub1097C9(70) - 70; - var_6 = _mazeUI.sub1097EF(_position1.y + 46) - 46; + var_4 = _mazeUI.cellFromX(70) - 70; + var_6 = _mazeUI.cellFromY(_position1.y + 46) - 46; var_8 = abs(var_4 - var127A); var_a = abs(var_6 - di); dx = 0; switch (_field1276) { case 0: - tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, 46)); + tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, 46)); if ( ((tmpVar == 2) || (tmpVar == 3) || (tmpVar == 6) || (tmpVar == 1)) || (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 > 3)) ) { R2_GLOBALS._sound2.play(339); @@ -3843,9 +3843,9 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_6 = _mazeUI.sub1097EF(di + 46) - 46; + var_6 = _mazeUI.cellFromY(di + 46) - 46; di = _position1.y - _field126E; - dx = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + dx = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4)) && (tmpVar != dx)) { di = var_6; R2_GLOBALS._sound2.play(339); @@ -3865,9 +3865,9 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_6 = _mazeUI.sub1097EF(di + 46) - 46; + var_6 = _mazeUI.cellFromY(di + 46) - 46; var_a = abs(var_6 - di); - tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if ( (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4)) && (di <= var_6) && (_position1.y>= var_6)) || (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15)) && (_field126E >= var_a) && (_field126E > 3) && (_action1._field24 != 0)) ) { @@ -3898,7 +3898,7 @@ void Scene3500::dispatch() { } break; case 2: - tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if ( ((tmpVar == 12) || (tmpVar == 13) || (tmpVar == 11) || (tmpVar == 16) || (tmpVar == 31)) || (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)) && (var_a > 3)) ) { R2_GLOBALS._sound2.play(339); @@ -3909,9 +3909,9 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_4 = _mazeUI.sub1097C9(var127A + 70) - 70; + var_4 = _mazeUI.cellFromX(var127A + 70) - 70; var127A = _position1.x + _field126E; - dx = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + dx = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15)) && (tmpVar != dx)) { var127A = var_4; R2_GLOBALS._sound2.play(339); @@ -3931,9 +3931,9 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_4 = _mazeUI.sub1097C9(var127A + 70) - 70; + var_4 = _mazeUI.cellFromX(var127A + 70) - 70; var_8 = abs(var127A - var_4); - tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, tmpVar + 46)); + tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, tmpVar + 46)); if ( (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15)) && (var127A >= var_4) && (_position1.x <= var_4)) || (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)) && (_field126E >= var_8) && (_field126E <= 3) && (_action1._field24 != 0)) ) { var127A = var_4; @@ -3964,7 +3964,7 @@ void Scene3500::dispatch() { } break; case 4: - tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if ( ((tmpVar == 2) || (tmpVar == 3) || (tmpVar == 6) || (tmpVar == 1)) || (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 > 3)) ) { R2_GLOBALS._sound2.play(339); @@ -3975,9 +3975,9 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_6 = _mazeUI.sub1097EF(di + 46) - 46; + var_6 = _mazeUI.cellFromY(di + 46) - 46; di = _position1.y + _field126E; - dx = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + dx = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5)) && (tmpVar == dx)) { R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; @@ -4005,9 +4005,9 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_6 = _mazeUI.sub1097EF(di + 46) - 46; + var_6 = _mazeUI.cellFromY(di + 46) - 46; var_a = abs(di - var_6); - tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if ( (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5)) && (di >= var_6) && (_position1.y <= var_6)) || (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15)) && (_field126E >= var_a) && (_field126E <= 3) && (_action1._field24 != 0)) ){ if ((tmpVar != 23) && (tmpVar != 24) && (tmpVar != 4) && (tmpVar != 14) && (tmpVar != 15)) @@ -4049,7 +4049,7 @@ void Scene3500::dispatch() { } break; case 6: - tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if ( ((tmpVar == 12) || (tmpVar == 13) || (tmpVar == 11) || (tmpVar == 16) || (tmpVar == 31)) || (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4)) && (var_a > 3)) ) { R2_GLOBALS._sound2.play(339); @@ -4060,9 +4060,9 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_4 = _mazeUI.sub1097C9(var127A + 70) - 70; + var_4 = _mazeUI.cellFromX(var127A + 70) - 70; var127A = _position1.x - _field126E; - dx = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + dx = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14)) && (tmpVar != dx)) { var127A = var_4; R2_GLOBALS._sound2.play(339); @@ -4082,9 +4082,9 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_4 = _mazeUI.sub1097C9(var127A + 70) - 70; + var_4 = _mazeUI.cellFromX(var127A + 70) - 70; var_8 = abs(var_4 - var127A); - tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if ( (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14)) && (var127A <= var_4) && (_position1.x >= var_4)) || (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4)) && (_field126E >= var_8) && (_field126E <= 3) && (_action1._field24 != 0)) ) { var127A = var_4; @@ -4121,7 +4121,7 @@ void Scene3500::dispatch() { if (_field1284 < 2) { _position1.x = var127A; _position1.y = di; - if (_mazeUI.sub109C5E(_position1) != 0) { + if (_mazeUI.seteMazePosition2(_position1) != 0) { _field1272 = 0; _field126E = 0; _field1270 = 0; diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.h b/engines/tsage/ringworld2/ringworld2_scenes3.h index 60168c790f..6d7347d6db 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -635,10 +635,10 @@ class Scene3500 : public SceneExt { class MazeUI3500 : public MazeUI { public: - int sub1097C9(int arg1); - int sub1097EF(int arg1); - int sub109C09(Common::Point pt); - int sub109C5E(Common::Point &p); + int cellFromX(int arg1); + int cellFromY(int arg1); + int getCellFromMapXY(Common::Point pt); + bool seteMazePosition2(Common::Point &p); }; public: Action1 _action1; |