From b6239f3b3da789fc996ff3f2310777be9de1e298 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 31 Oct 2011 11:35:04 +1100 Subject: TSAGE: Display UI cursor correctly in R2RW --- engines/tsage/blue_force/blueforce_logic.cpp | 2 +- engines/tsage/events.cpp | 1 - engines/tsage/globals.cpp | 2 +- engines/tsage/ringworld2/ringworld2_logic.cpp | 16 ++++++++++++++++ engines/tsage/ringworld2/ringworld2_logic.h | 7 +++++++ engines/tsage/user_interface.cpp | 11 ++++++++--- 6 files changed, 33 insertions(+), 6 deletions(-) (limited to 'engines') diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index 91fd5d3197..77609715c7 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -955,7 +955,7 @@ void SceneHandlerExt::process(Event &event) { return; } - // If the user clicks the button whislt the introduction is active, prompt for playing the game + // If the user clicks the button whilst the introduction is active, prompt for playing the game if ((BF_GLOBALS._dayNumber == 0) && (event.eventType == EVENT_BUTTON_DOWN)) { // Prompt user for whether to start play or watch introduction BF_GLOBALS._player.enableControl(); diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp index d42b996e41..8958482404 100644 --- a/engines/tsage/events.cpp +++ b/engines/tsage/events.cpp @@ -320,7 +320,6 @@ void EventsClass::setCursor(Graphics::Surface &cursor, int transColor, const Com } void EventsClass::setCursor(GfxSurface &cursor) { - // TODO: Find proper parameters for this form in Blue Force Graphics::Surface s = cursor.lockSurface(); const byte *cursorData = (const byte *)s.getBasePtr(0, 0); diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index bb89a26e37..23898b5449 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -147,7 +147,7 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface case GType_Ringworld2: _inventory = new Ringworld2::Ringworld2InvObjectList(); _game = new Ringworld2::Ringworld2Game(); - _sceneHandler = new SceneHandler(); + _sceneHandler = new Ringworld2::SceneHandlerExt(); break; case GType_Geekwad: diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index f9ac2efcbf..642d265e42 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -224,6 +224,22 @@ void SceneExt::refreshBackground(int xAmount, int yAmount) { /*--------------------------------------------------------------------------*/ +void SceneHandlerExt::postInit(SceneObjectList *OwnerList) { + SceneHandler::postInit(OwnerList); +} + +void SceneHandlerExt::process(Event &event) { + if (T2_GLOBALS._uiElements._active) { + T2_GLOBALS._uiElements.process(event); + if (event.handled) + return; + } + + SceneHandler::process(event); +} + +/*--------------------------------------------------------------------------*/ + DisplayHotspot::DisplayHotspot(int regionId, ...) { _sceneRegionId = regionId; diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index b12978344c..b0f388a2ae 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -73,6 +73,13 @@ public: void clearScreen(); }; +class SceneHandlerExt: public SceneHandler { +public: + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void process(Event &event); +}; + + class DisplayHotspot : public SceneObject { private: Common::Array _actions; diff --git a/engines/tsage/user_interface.cpp b/engines/tsage/user_interface.cpp index f6eae80d9c..9657d25875 100644 --- a/engines/tsage/user_interface.cpp +++ b/engines/tsage/user_interface.cpp @@ -266,7 +266,10 @@ void UICollection::draw() { /*--------------------------------------------------------------------------*/ UIElements::UIElements(): UICollection() { - _cursorVisage.setVisage(1, 5); + if (g_vm->getGameID() == GType_Ringworld2) + _cursorVisage.setVisage(5, 1); + else + _cursorVisage.setVisage(1, 5); g_saver->addLoadNotifier(&UIElements::loadNotifierProc); _characterIndex = 0; } @@ -302,7 +305,8 @@ void UIElements::synchronize(Serializer &s) { } void UIElements::process(Event &event) { - if (_clearScreen && GLOBALS._player._enabled && (GLOBALS._sceneManager._sceneNumber != 50)) { + if (_clearScreen && GLOBALS._player._enabled && + ((g_vm->getGameID() != GType_BlueForce) || (GLOBALS._sceneManager._sceneNumber != 50))) { if (_bounds.contains(event.mousePos)) { // Cursor inside UI area if (!_cursorChanged) { @@ -310,7 +314,8 @@ void UIElements::process(Event &event) { // Inventory icon being displayed, so leave alone } else { // Change to the inventory use cursor - GfxSurface surface = _cursorVisage.getFrame(6); + int cursorId = (g_vm->getGameID() == GType_Ringworld2) ? 11 : 6; + GfxSurface surface = _cursorVisage.getFrame(cursorId); GLOBALS._events.setCursor(surface); } _cursorChanged = true; -- cgit v1.2.3