diff options
Diffstat (limited to 'engines/tsage/user_interface.cpp')
-rw-r--r-- | engines/tsage/user_interface.cpp | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/engines/tsage/user_interface.cpp b/engines/tsage/user_interface.cpp index 4bd9e49875..ae34ac0574 100644 --- a/engines/tsage/user_interface.cpp +++ b/engines/tsage/user_interface.cpp @@ -84,7 +84,10 @@ void UIQuestion::showDescription(CursorType cursor) { case GType_Ringworld2: if ((cursor == R2_COM_SCANNER) || (cursor == R2_COM_SCANNER_2)) { // Show communicator - warning("TODO: Communicator"); + Ringworld2::SceneExt *scene = static_cast<Ringworld2::SceneExt *> + (R2_GLOBALS._sceneManager._scene); + if (!scene->_sceneAreas.contains(R2_GLOBALS._scannerDialog)) + R2_GLOBALS._scannerDialog->setup2(4, 1, 1, 160, 125); } else { // Show object description SceneItem::display2(3, (int)cursor); @@ -273,11 +276,29 @@ void UICollection::draw() { Rect(0, UI_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT), Rect(0, UI_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT)); + if (g_vm->getGameID() == GType_Ringworld2) + r2rDrawFrame(); + _clearScreen = 1; g_globals->_sceneManager._scene->_sceneBounds = savedBounds; } } +void UICollection::r2rDrawFrame() { + Visage visage; + visage.setVisage(2, 1); + GfxSurface vertLine = visage.getFrame(1); + GfxSurface horizLine = visage.getFrame(2); + + GLOBALS._screenSurface.copyFrom(horizLine, 0, 0); + GLOBALS._screenSurface.copyFrom(vertLine, 0, 3); + GLOBALS._screenSurface.copyFrom(vertLine, SCREEN_WIDTH - 4, 3); + + // Restrict drawing area to exclude the borders at the edge of the screen + R2_GLOBALS._screenSurface._clipRect = Rect(4, 4, SCREEN_WIDTH - 4, + SCREEN_HEIGHT - 4); +} + /*--------------------------------------------------------------------------*/ UIElements::UIElements(): UICollection() { @@ -286,6 +307,10 @@ UIElements::UIElements(): UICollection() { else _cursorVisage.setVisage(1, 5); g_saver->addLoadNotifier(&UIElements::loadNotifierProc); + + _slotStart = 0; + _scoreValue = 0; + _active = false; } void UIElements::synchronize(Serializer &s) { @@ -399,7 +424,7 @@ void UIElements::setup(const Common::Point &pt) { } // Setup bottom-right hand buttons - xp += 62; + xp = (g_vm->getGameID() == GType_Ringworld2) ? 255 : 253; int yp = (g_vm->getGameID() == GType_BlueForce) ? 16 : 17; _question.setup(1, 4, 7, xp, yp, 255); _question.setEnabled(false); @@ -410,7 +435,7 @@ void UIElements::setup(const Common::Point &pt) { add(&_scrollLeft); _scrollLeft._isLeft = true; - xp += 22; + xp += (g_vm->getGameID() == GType_Ringworld2) ? 21 : 22; _scrollRight.setup(1, 4, 4, xp, yp, 255); add(&_scrollRight); _scrollRight._isLeft = false; @@ -451,7 +476,7 @@ void UIElements::add(UIElement *obj) { /** * Handles updating the visual inventory in the user interface */ -void UIElements::updateInventory() { +void UIElements::updateInventory(int objectNumber) { switch (g_vm->getGameID()) { case GType_BlueForce: // Update the score @@ -480,6 +505,17 @@ void UIElements::updateInventory() { else if (_slotStart > (lastPage - 1)) _slotStart = 0; + // Handle changing the page, if necessary, to ensure an optionally supplied + // object number will be on-screen + if (objectNumber != 0) { + for (uint idx = 0; idx < _itemList.size(); ++idx) { + if (_itemList[idx] == objectNumber) { + _slotStart = idx / 4; + break; + } + } + } + // Handle refreshing slot graphics UIInventorySlot *slotList[4] = { &_slot1, &_slot2, &_slot3, &_slot4 }; |