diff options
-rw-r--r-- | engines/fullpipe/constants.h | 1 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.cpp | 8 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.h | 7 | ||||
-rw-r--r-- | engines/fullpipe/input.cpp | 66 | ||||
-rw-r--r-- | engines/fullpipe/inventory.cpp | 17 | ||||
-rw-r--r-- | engines/fullpipe/inventory.h | 2 | ||||
-rw-r--r-- | engines/tsage/globals.cpp | 4 | ||||
-rw-r--r-- | engines/tsage/globals.h | 2 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.cpp | 2 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes2.cpp | 203 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes2.h | 20 |
11 files changed, 229 insertions, 103 deletions
diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index 4f389f80a8..796764d0a9 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -30,6 +30,7 @@ namespace Fullpipe { #define ANI_INV_MAP 5321 #define ANI_LIFTBUTTON 2751 #define ANI_MAN 322 +#define MSG_CMN_WINARCADE 4778 #define MSG_DISABLESAVES 5201 #define MSG_ENABLESAVES 5202 #define MSG_HMRKICK_METAL 4764 diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 11808e95c2..6a4a587ff7 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -71,6 +71,11 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) _inputController = 0; _inputDisabled = false; + _normalSpeed = true; + + _currentCheat = -1; + _currentCheatPos = 0; + _modalObject = 0; _gameContinue = true; @@ -201,7 +206,8 @@ Common::Error FullpipeEngine::run() { _needRestart = false; } - _system->delayMillis(10); + if (_normalSpeed) + _system->delayMillis(10); _system->updateScreen(); } diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index f688151267..348ac2c9c5 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -127,6 +127,9 @@ public: CInputController *_inputController; bool _inputDisabled; + int _currentCheat; + int _currentCheatPos; + void defHandleKeyDown(int key); SoundList *_currSoundList1[11]; @@ -171,6 +174,7 @@ public: bool _needRestart; bool _flgPlayIntro; int _musicAllowed; + bool _normalSpeed; void enableSaves() { _isSaveAllowed = true; } void disableSaves(ExCommand *ex); @@ -222,6 +226,9 @@ public: void openHelp(); void openMainMenu(); + void winArcade(); + void getAllInventory(); + int lift_getButtonIdP(int objid); public: diff --git a/engines/fullpipe/input.cpp b/engines/fullpipe/input.cpp index 8cc7654f52..c4af54ddc3 100644 --- a/engines/fullpipe/input.cpp +++ b/engines/fullpipe/input.cpp @@ -145,8 +145,72 @@ void FullpipeEngine::setCursor(int id) { _inputController->setCursor(id); } +const char *input_cheats[] = { + "HELP", + "STUFF", + "FASTER", + "OHWAIT", + "MUSOFF", + "" +}; + void FullpipeEngine::defHandleKeyDown(int key) { - warning("STUB: FullpipeEngine::defHandleKeyDown(%d)", key); + if (_currentCheat == -1) { + for (int i = 0; input_cheats[i][0]; i++) + if (toupper(key) == input_cheats[i][0]) { + _currentCheat = i; + _currentCheatPos = 1; + } + + return; + } + + warning("%d %d", _currentCheat, _currentCheatPos); + if (toupper(key) != input_cheats[_currentCheat][_currentCheatPos]) { + _currentCheat = -1; + + return; + } + + _currentCheatPos++; + warning("%d %d", _currentCheat, _currentCheatPos); + + if (!input_cheats[_currentCheat][_currentCheatPos]) { + switch (_currentCheat) { + case 0: // HELP + winArcade(); + break; + case 1: // STUFF + getAllInventory(); + break; + case 2: // FASTER + _normalSpeed = !_normalSpeed; + break; + case 3: // OHWAIT + _gamePaused = 1; + _flgGameIsRunning = 0; + break; + case 4: // MUSOFF + if (_musicAllowed & 2) + setMusicAllowed(_musicAllowed & 0xFFFFFFFD); + else + setMusicAllowed(_musicAllowed | 2); + break; + default: + break; + } + + _currentCheatPos = 0; + _currentCheat = -1; + } +} + +void FullpipeEngine::winArcade() { + ExCommand *ex = new ExCommand(0, 17, MSG_CMN_WINARCADE, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 3; + + ex->postMessage(); + } void FullpipeEngine::updateCursorsCommon() { diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp index 1e229f3408..ccedb57ce2 100644 --- a/engines/fullpipe/inventory.cpp +++ b/engines/fullpipe/inventory.cpp @@ -138,6 +138,10 @@ int CInventory2::getInventoryItemIndexById(int itemId) { return -1; } +int CInventory2::getInventoryPoolItemIdAtIndex(int itemId) { + return _itemsPool[itemId]->id; +} + int CInventory2::getInventoryPoolItemFieldCById(int itemId) { for (uint i = 0; i < _itemsPool.size(); i++) { if (_itemsPool[i]->id == itemId) @@ -417,4 +421,17 @@ int CInventory2::getHoveredItem(Common::Point *point) { return 0; } +void FullpipeEngine::getAllInventory() { + CInventory2 *inv = getGameLoaderInventory(); + + for (uint i = 0; i < inv->getItemsPoolCount(); ++i ) { + int id = inv->getInventoryPoolItemIdAtIndex(i); + + if (inv->getCountItemsWithId(id) < 1) + inv->addItem(id, 1); + } + + inv->rebuildItemRects(); +} + } // End of namespace Fullpipe diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h index f84d27dde5..5f1030398c 100644 --- a/engines/fullpipe/inventory.h +++ b/engines/fullpipe/inventory.h @@ -52,6 +52,7 @@ class CInventory : public CObject { virtual bool load(MfcArchive &file); int getInventoryPoolItemIndexById(int itemId); + uint getItemsPoolCount() { return _itemsPool.size(); } bool setItemFlags(int itemId, int flags); }; @@ -102,6 +103,7 @@ class CInventory2 : public CInventory { void removeItem2(Scene *sceneObj, int itemId, int x, int y, int priority); int getInventoryItemIndexById(int itemId); + int getInventoryPoolItemIdAtIndex(int itemId); int getInventoryPoolItemFieldCById(int itemId); int getCountItemsWithId(int itemId); int getItemFlags(int itemId); diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 8f70c2926e..6976a6b249 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -461,7 +461,7 @@ void Ringworld2Globals::reset() { for (int i = 0; i < 1000; i++) _v566AB[i] = 0; _v56A93 = -1; - _v56A99 = 5; + _balloonAltitude = 5; _scene1925CurrLevel = 0; //_v56A9C _v56A9E = 0; _v56AA0 = 0; @@ -568,7 +568,7 @@ void Ringworld2Globals::synchronize(Serializer &s) { s.syncAsByte(_spillLocation[i]); for (i = 0; i < 1000; ++i) s.syncAsByte(_v566AB[i]); - s.syncAsByte(_v56A99); + s.syncAsByte(_balloonAltitude); for (i = 0; i < 12; ++i) s.syncAsByte(_stripManager_lookupList[i]); diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index cf4649247e..22820d0118 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -280,7 +280,7 @@ public: byte _v566AA; byte _v566AB[1000]; int _v56A93; - byte _v56A99; + byte _balloonAltitude; int _scene1925CurrLevel; //_v56A9C int _v56A9E; byte _v56AA0; diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index ae83c08966..e679b3835c 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -525,6 +525,8 @@ void SceneExt::refreshBackground(int xAmount, int yAmount) { Common::copy(dataP, dataP + (s.w * s.h), destP); _backSurface.unlockSurface(); + R2_GLOBALS._screenSurface.addDirtyRect(_backSurface.getBounds()); + // Free the resource data DEALLOCATE(dataP); } diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index d2c4f3d8c0..5570e3e975 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -4608,15 +4608,19 @@ bool Scene2900::KnobLeft::startAction(CursorType action, Event &event) { switch (action) { case CURSOR_USE: - if (scene->_field416 != 0 || scene->_field414 != 0 || scene->_field425 != scene->_field426) { + if (scene->_field416 || scene->_altitudeChanging || + scene->_field425 != scene->_field426) { + // Let your altitude stablize first SceneItem::display2(2900, 17); - } else if (R2_GLOBALS._v56A99 / 48 == 0) { + } else if (R2_GLOBALS._balloonAltitude / 48 == 0) { + // Maximum altitude SceneItem::display2(2900, 15); } else { + // Increase altitude R2_GLOBALS._sound2.fadeSound(282); - scene->_field414 = 1; - scene->_field41E = -1; - scene->_field426 = 100 - ((R2_GLOBALS._v56A99 / 48) - 1) * 25; + scene->_altitudeChanging = true; + scene->_altitudeMajorChange = -1; + scene->_field426 = 100 - ((R2_GLOBALS._balloonAltitude / 48) - 1) * 25; } break; @@ -4641,15 +4645,19 @@ bool Scene2900::KnobRight::startAction(CursorType action, Event &event) { switch (action) { case CURSOR_USE: - if (scene->_field416 != 0 || scene->_field414 != 0 || scene->_field425 != scene->_field426) { + if (scene->_field416 || scene->_altitudeChanging || + scene->_field425 != scene->_field426) { + // Let your altitude stablize first SceneItem::display2(2900, 17); - } else if (R2_GLOBALS._v56A99 / 48 == 0) { + } else if (R2_GLOBALS._balloonAltitude / 48 >= 3) { + // Altitude is too low - cannot land here SceneItem::display2(2900, 16); } else { + // Decrease altitude R2_GLOBALS._sound2.fadeSound(212); - scene->_field414 = 1; - scene->_field41E = 1; - scene->_field426 = 100 - ((R2_GLOBALS._v56A99 / 48) + 1) * 25; + scene->_altitudeChanging = true; + scene->_altitudeMajorChange = 1; + scene->_field426 = 100 - ((R2_GLOBALS._balloonAltitude / 48) + 1) * 25; } break; @@ -4675,10 +4683,10 @@ void Scene2900::Action1::signal() { Scene2900 *scene = (Scene2900 *)R2_GLOBALS._sceneManager._scene; setDelay(3); - if (scene->_field416 == 0 && scene->_field414 == 0) { + if (!scene->_field416 && !scene->_altitudeChanging) { scene->_field427 = 2; scene->_field412 = 0; - } else if (scene->_field416 != 0) { + } else if (scene->_field416) { R2_GLOBALS._sound2.fadeOut2(NULL); } else if (scene->_field427 == 0) { R2_GLOBALS._sound2.fadeOut2(NULL); @@ -4704,7 +4712,7 @@ Scene2900::Map::Map() { _fieldA = 0; _resNum = 0; _xV = _yV = 0; - _rect = Rect(40, 0, 280, 150); + _bounds = Rect(40, 0, 280, 150); } void Scene2900::Map::load(int resNum) { @@ -4718,58 +4726,67 @@ void Scene2900::Map::load(int resNum) { DEALLOCATE(data); } -Common::Point Scene2900::Map::setPosition(const Common::Point &pos, int v3) { - Rect rect2; - Rect blockRect(0, 0, 160, 100); - int xHalfCount = _mapWidth / 160; - int yHalfCount = _mapHeight / 100; +Common::Point Scene2900::Map::setPosition(const Common::Point &pos, bool initialFlag) { Common::Point p = pos; + Rect updateRect; if (p.x >= 0) { - int xRight = p.x + _rect.width(); + int xRight = p.x + _bounds.width(); if (xRight > _mapWidth) { - p.x = _mapWidth - _rect.width(); + p.x = _mapWidth - _bounds.width(); } } else { p.x = 0; } if (p.y >= 0) { - int yBottom = p.y + _rect.height(); + int yBottom = p.y + _bounds.height(); if (yBottom > _mapHeight) { - p.y = _mapHeight - _rect.height(); + p.y = _mapHeight - _bounds.height(); } } else { p.y = 0; } - if ((p.x != 0 || p.y != 0) && !v3) { - rect2 = _rect; - moveArea(rect2, _xV - p.x, _yV - p.y); + if ((p.x != 0 || p.y != 0) && !initialFlag) { + moveArea(updateRect, _xV - p.x, _yV - p.y); + redraw(&updateRect); + } else { + redraw(); } _xV = p.x; _yV = p.y; - Rect screenRect = _rect; - screenRect.translate(_xV - _rect.left, _yV - _rect.top); + return Common::Point(_xV, _yV); +} + +void Scene2900::Map::redraw(Rect *updateRect) { + int xHalfCount = _mapWidth / 160; + int yHalfCount = _mapHeight / 100; int rlbNum = 0; + Rect blockRect(0, 0, 160, 100); + Rect screenRect = _bounds; + screenRect.translate(_xV - _bounds.left, _yV - _bounds.top); + + Rect modifyRect; + if (updateRect) + modifyRect = *updateRect; + for (int xCtr = 0; xCtr < xHalfCount; ++xCtr) { for (int yCtr = 0; yCtr < yHalfCount; ++yCtr, ++rlbNum) { blockRect.moveTo(160 * xCtr, 100 * yCtr); if (blockRect.intersects(screenRect)) { // The block of the map is at least partially on-screen, so needs drawing - blockRect.translate(_rect.left - _xV, _rect.top - _yV); + blockRect.translate(_bounds.left - _xV, _bounds.top - _yV); byte *data = g_resourceManager->getResource(RES_BITMAP, _resNum, rlbNum); - drawBlock(data, blockRect.left, blockRect.top, _rect, rect2); + drawBlock(data, blockRect.left, blockRect.top, _bounds, modifyRect); DEALLOCATE(data); } } } - - return Common::Point(_xV, _yV); } void Scene2900::Map::synchronize(Serializer &s) { @@ -4777,7 +4794,7 @@ void Scene2900::Map::synchronize(Serializer &s) { s.syncAsUint16LE(_mapHeight); s.syncAsSint16LE(_xV); s.syncAsSint16LE(_yV); - _rect.synchronize(s); + _bounds.synchronize(s); } int Scene2900::Map::adjustRect(Common::Rect &r1, const Common::Rect &r2) { @@ -4812,19 +4829,20 @@ int Scene2900::Map::adjustRect(Common::Rect &r1, const Common::Rect &r2) { return -1; } -void Scene2900::Map::drawBlock(const byte *data, int xp, int yp, const Rect &r1, const Rect &r2) { +void Scene2900::Map::drawBlock(const byte *data, int xp, int yp, + const Rect &bounds, const Rect &updateRect) { Rect blockRect(xp, yp, xp + 160, yp + 100); const byte *src = data; - if (blockRect.intersects(r1)) { - blockRect.clip(r1); + if (blockRect.intersects(bounds)) { + blockRect.clip(bounds); - if (adjustRect(blockRect, r2) != 0) { + if (adjustRect(blockRect, updateRect) != 0) { int width = blockRect.width(); int height = blockRect.height(); src += (blockRect.top - yp) * 160 + blockRect.left - xp; - GfxSurface &surface = R2_GLOBALS.gfxManager().getSurface(); + GfxSurface &surface = R2_GLOBALS._sceneManager._scene->_backSurface; Graphics::Surface s = surface.lockSurface(); for (int yCtr = 0; yCtr < height; ++yCtr, src += 160) { @@ -4833,7 +4851,7 @@ void Scene2900::Map::drawBlock(const byte *data, int xp, int yp, const Rect &r1, } surface.unlockSurface(); - surface.addDirtyRect(blockRect); + R2_GLOBALS.gfxManager().copyFrom(surface, blockRect, blockRect); } } } @@ -4897,30 +4915,30 @@ void Scene2900::Map::moveLine(int xpSrc, int ypSrc, int xpDest, int ypDest, int Scene2900::Scene2900(): SceneExt() { _field412 = 0; - _field414 = 0; - _field416 = 0; + _altitudeChanging = false; + _field416 = false; _offsetPos = Common::Point(550, 550); _field41C = 0; - _field41E = 0; + _altitudeMajorChange = 0; _pos = Common::Point(160, 100); - _field424 = 0; + _newAltitude = 0; _field425 = 100; _field426 = 100; _field427 = 0; - _field8F8 = 0; + _field8F8 = false; } void Scene2900::synchronize(Serializer &s) { s.syncAsSint16LE(_field412); - s.syncAsSint16LE(_field414); + s.syncAsSint16LE(_altitudeChanging); s.syncAsSint16LE(_field416); s.syncAsSint16LE(_field41C); - s.syncAsSint16LE(_field41E); + s.syncAsSint16LE(_altitudeMajorChange); s.syncAsSint16LE(_offsetPos.x); s.syncAsSint16LE(_offsetPos.y); s.syncAsSint16LE(_pos.x); s.syncAsSint16LE(_pos.y); - s.syncAsSint16LE(_field424); + s.syncAsSint16LE(_newAltitude); s.syncAsSint16LE(_field425); s.syncAsSint16LE(_field426); s.syncAsSint16LE(_field427); @@ -4940,6 +4958,7 @@ void Scene2900::postInit(SceneObjectList *OwnerList) { loadScene(2900); SceneExt::postInit(); + R2_GLOBALS._interfaceY = SCREEN_HEIGHT; _leftEdge.setup(2900, 6, 1, 22, 0, 25); _rightEdge.setup(2900, 6, 1, 280, 0, 25); @@ -4971,7 +4990,7 @@ void Scene2900::postInit(SceneObjectList *OwnerList) { _knobLeft.setDetails(Rect(165, 160, 228, 200), 2900, -1, -1, -1, 2, (SceneItem *)NULL); _knobRight.setDetails(Rect(228, 160, 285, 200), 2900, -1, -1, -1, 2, (SceneItem *)NULL); -//**DEBUG** setAction(&_action1); + setAction(&_action1); R2_GLOBALS._player.postInit(); R2_GLOBALS._player.setVisage(2900); R2_GLOBALS._player.setStrip2(3); @@ -4982,7 +5001,7 @@ void Scene2900::postInit(SceneObjectList *OwnerList) { if (R2_GLOBALS._sceneManager._previousScene == 2350 && R2_GLOBALS._balloonPosition.x == 0 && R2_GLOBALS._balloonPosition.y == 0) { - R2_GLOBALS._v56A99 = 5; + R2_GLOBALS._balloonAltitude = 5; _map.setPosition(Common::Point(_offsetPos.x - 120, _offsetPos.y - 100)); _sceneMode = 10; @@ -4995,9 +5014,9 @@ void Scene2900::postInit(SceneObjectList *OwnerList) { _offsetPos.x = R2_GLOBALS._balloonPosition.x + 120; _offsetPos.y = R2_GLOBALS._balloonPosition.y + 100; - if ((R2_GLOBALS._v56A99 % 8) == 0) + if ((R2_GLOBALS._balloonAltitude % 8) == 0) _offsetPos.x -= 70; - else if ((R2_GLOBALS._v56A99 % 8) == 7) + else if ((R2_GLOBALS._balloonAltitude % 8) == 7) _offsetPos.x += 70; if (_offsetPos.x <= 120) @@ -5005,12 +5024,12 @@ void Scene2900::postInit(SceneObjectList *OwnerList) { else if (_offsetPos.x >= 680) _pos.x = _offsetPos.x - 520; - if ((R2_GLOBALS._v56A99 / 6) == 5) + if ((R2_GLOBALS._balloonAltitude / 6) == 5) _offsetPos.y -= 50; if (_offsetPos.y <= 100) _pos.y = _offsetPos.y; - _field425 = _field426 = 100 - (R2_GLOBALS._v56A99 / 48) * 25; + _field425 = _field426 = 100 - (R2_GLOBALS._balloonAltitude / 48) * 25; _map.setPosition(Common::Point(_offsetPos.x - 120, _offsetPos.y - 100)); _sceneMode = 11; @@ -5036,7 +5055,8 @@ void Scene2900::remove() { R2_GLOBALS._sound1.fadeOut2(NULL); R2_GLOBALS._sound2.stop(); - + + R2_GLOBALS._interfaceY = UI_INTERFACE_Y; SceneExt::remove(); } @@ -5057,35 +5077,35 @@ void Scene2900::signal() { void Scene2900::dispatch() { if (_sceneMode == 11) { - _offsetPos.x += balloonData[R2_GLOBALS._v56A99].x; - _offsetPos.y += balloonData[R2_GLOBALS._v56A99].y; - _field41C = balloonData[R2_GLOBALS._v56A99].v3; + _offsetPos.x += balloonData[R2_GLOBALS._balloonAltitude].x; + _offsetPos.y += balloonData[R2_GLOBALS._balloonAltitude].y; + _field41C = balloonData[R2_GLOBALS._balloonAltitude].v3; if (_field41C == 0) { - _field416 = 0; + _field416 = false; } else { - _field416 = 1; - _field414 = 0; - _field41C += R2_GLOBALS._v56A99 / 48; + _field416 = true; + _altitudeChanging = false; + _field41C += R2_GLOBALS._balloonAltitude / 48; _field426 = 100 - (_field41C * 25); } if (_field425 == _field426) { - _field416 = 0; + _field416 = false; } else { - if (_field416 == 0) { - _field425 = _field425 - _field41E; + if (!_field416) { + _field425 = _field425 - _altitudeMajorChange; } else { _field425 = _field425 - _field41C; } - if (_field41C == -1 || _field41E == -1) { + if (_field41C == -1 || _altitudeMajorChange == -1) { if (_altimeterContent._frame == 1) { _altimeterContent.setFrame2(10); } else { _altimeterContent.setFrame2(_altimeterContent._frame - 1); } - } else if (_field41C == -1 || _field41E == 1) { + } else if (_field41C == -1 || _altitudeMajorChange == 1) { if (_altimeterContent._frame == 10) _altimeterContent.setFrame2(1); else @@ -5096,16 +5116,14 @@ void Scene2900::dispatch() { R2_GLOBALS._player.changeZoom(_field425); } - if (_field8F8 == 0) { + if (!_field8F8) { R2_GLOBALS._scenePalette.loadPalette(2950); R2_GLOBALS._scenePalette.refresh(); } - // TODO: Verify param 3 R2_GLOBALS._balloonPosition = _map.setPosition( - Common::Point(_offsetPos.x - 120, _offsetPos.y - 100), - _field8F8 + (_field8F8 ? 1 : 0)); - _field8F8 = 1; + Common::Point(_offsetPos.x - 120, _offsetPos.y - 100), !_field8F8); + _field8F8 = true; if (_offsetPos.x <= 120) _pos.x = _offsetPos.x + 40; @@ -5117,33 +5135,34 @@ void Scene2900::dispatch() { R2_GLOBALS._player.setPosition(_pos); - if ((_offsetPos.y % 100) == 50 && _field416 == 0) { - _field424 = R2_GLOBALS._v56A99; - if (_field414 != 0) { - _field424 += _field41E * 48; - _field414 = 0; + if ((_offsetPos.x % 100) == 50 && (_offsetPos.y % 100) == 50 && !_field416) { + _newAltitude = R2_GLOBALS._balloonAltitude; + if (_altitudeChanging) { + _newAltitude += _altitudeMajorChange * 48; + _altitudeChanging = false; } - if (balloonData[R2_GLOBALS._v56A99].x > 0) { - ++_field424; - } else if (balloonData[R2_GLOBALS._v56A99].x < 0) { - --_field424; + if (balloonData[R2_GLOBALS._balloonAltitude].x > 0) { + ++_newAltitude; + } else if (balloonData[R2_GLOBALS._balloonAltitude].x < 0) { + --_newAltitude; } - if (balloonData[R2_GLOBALS._v56A99].y > 0) { - _field424 += 240; - } else if (balloonData[R2_GLOBALS._v56A99].x < 0) { - _field424 += 8; + if (balloonData[R2_GLOBALS._balloonAltitude].y > 0) { + _newAltitude += 240; + } else if (balloonData[R2_GLOBALS._balloonAltitude].x < 0) { + _newAltitude += 8; } - if (balloonData[R2_GLOBALS._v56A99].v3 > 0) { - _field424 += 48; - } else if (balloonData[R2_GLOBALS._v56A99].v3 < 0) { - _field424 += 208; + if (balloonData[R2_GLOBALS._balloonAltitude].v3 > 0) { + _newAltitude += 48; + } else if (balloonData[R2_GLOBALS._balloonAltitude].v3 < 0) { + _newAltitude += 208; } - R2_GLOBALS._v56A99 = _field424; - if (R2_GLOBALS._v56A99 == 189) { + R2_GLOBALS._balloonAltitude = _newAltitude; + if (R2_GLOBALS._balloonAltitude == 189) { + // Finally reached landing point _sceneMode = 12; R2_GLOBALS._player.disableControl(); @@ -5155,5 +5174,11 @@ void Scene2900::dispatch() { Scene::dispatch(); } +void Scene2900::refreshBackground(int xAmount, int yAmount) { + SceneExt::refreshBackground(xAmount, yAmount); + + _map.redraw(); +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.h b/engines/tsage/ringworld2/ringworld2_scenes2.h index 55c3d55365..a4d309960c 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.h +++ b/engines/tsage/ringworld2/ringworld2_scenes2.h @@ -701,6 +701,8 @@ class Scene2900 : public SceneExt { private: void moveArea(Rect &r, int xAmt, int yAmt); void moveLine(int xpSrc, int ypSrc, int xpDest, int ypDest, int width); + int adjustRect(Common::Rect &r1, const Common::Rect &r2); + void drawBlock(const byte *data, int xp, int yp, const Rect &r1, const Rect &r2); public: int _mapWidth, _mapHeight; int _field4; @@ -709,14 +711,13 @@ class Scene2900 : public SceneExt { int _fieldA; int _resNum; int _xV, _yV; - Rect _rect; + Rect _bounds; Map(); void load(int resNum); - Common::Point setPosition(const Common::Point &pos, int v3 = 0); + Common::Point setPosition(const Common::Point &pos, bool initialFlag = false); void synchronize(Serializer &s); - int adjustRect(Common::Rect &r1, const Common::Rect &r2); - void drawBlock(const byte *data, int xp, int yp, const Rect &r1, const Rect &r2); + void redraw(Rect *updateRect = NULL); }; public: SceneObject _leftEdge; @@ -734,17 +735,17 @@ public: Map _map; int _field412; - int _field414; - int _field416; + bool _altitudeChanging; + bool _field416; int _field41C; - int _field41E; + int _altitudeMajorChange; Common::Point _offsetPos; Common::Point _pos; - int _field424; + int _newAltitude; int _field425; int _field426; int _field427; - int _field8F8; + bool _field8F8; Scene2900(); virtual void synchronize(Serializer &s); @@ -752,6 +753,7 @@ public: virtual void remove(); virtual void signal(); virtual void dispatch(); + virtual void refreshBackground(int xAmount, int yAmount); }; } // End of namespace Ringworld2 |