diff options
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.cpp | 22 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.h | 5 | ||||
-rw-r--r-- | engines/tsage/core.cpp | 10 | ||||
-rw-r--r-- | engines/tsage/core.h | 3 |
4 files changed, 37 insertions, 3 deletions
diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index 616a7738af..c91007e768 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -567,7 +567,7 @@ void SceneExt::checkGun() { BF_GLOBALS._sound3.play(4); } -void SceneExt::display(CursorType action) { +bool SceneExt::display(CursorType action) { switch (action) { case CURSOR_LOOK: SceneItem::display2(9000, BF_GLOBALS._randomSource.getRandomNumber(2)); @@ -584,8 +584,12 @@ void SceneExt::display(CursorType action) { default: if (action < BF_LAST_INVENT) SceneItem::display2(9002, (int)action); + else + return false; break; } + + return true; } void SceneExt::gunDisplay() { @@ -687,8 +691,22 @@ void SceneHandlerExt::process(Event &event) { } SceneHandler::process(event); +} - // TODO: All the new stuff from Blue Force +void SceneHandlerExt::playerAction(Event &event) { + if (BF_GLOBALS._events.getCursor() == INV_DOG_WHISTLE) { + SceneItem::display2(1, 6); + event.handled = true; + } +} + +void SceneHandlerExt::processEnd(Event &event) { + // Check for a fallback text display for the given cursor/item being used in the scene + if (!event.handled && BF_GLOBALS._sceneManager._scene) { + CursorType cursor = BF_GLOBALS._events.getCursor(); + if (((SceneExt *)BF_GLOBALS._sceneManager._scene)->display(cursor)) + event.handled = true; + } } /*--------------------------------------------------------------------------*/ diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h index b2cab69402..11719e7128 100644 --- a/engines/tsage/blue_force/blueforce_logic.h +++ b/engines/tsage/blue_force/blueforce_logic.h @@ -169,7 +169,7 @@ public: void addTimer(Timer *timer) { _timerList.add(timer); } void removeTimer(Timer *timer) { _timerList.remove(timer); } - void display(CursorType action); + bool display(CursorType action); }; class GroupedScene: public SceneExt { @@ -187,6 +187,9 @@ class SceneHandlerExt: public SceneHandler { public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void process(Event &event); + + virtual void playerAction(Event &event); + virtual void processEnd(Event &event); }; class BlueForceInvObjectList : public InvObjectList { diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 7dff8c0d89..87c43090d2 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -3787,6 +3787,13 @@ void SceneHandler::process(Event &event) { // Mouse press handling if (_globals->_player._uiEnabled && (event.eventType == EVENT_BUTTON_DOWN) && !_globals->_sceneItems.empty()) { + // Check if the mouse is on the player + if (_globals->_player.contains(event.mousePos)) { + playerAction(event); + if (event.handled) + return; + } + // Scan the item list to find one the mouse is within SynchronizedList<SceneItem *>::iterator i = _globals->_sceneItems.begin(); while ((i != _globals->_sceneItems.end()) && !(*i)->contains(event.mousePos)) @@ -3807,6 +3814,9 @@ void SceneHandler::process(Event &event) { } } + // Handle any fallback text display + processEnd(event); + // Handle player processing _globals->_player.process(event); } diff --git a/engines/tsage/core.h b/engines/tsage/core.h index 0ea9936b30..5cfaf5c890 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -863,6 +863,9 @@ public: int _delayTicks; Common::String _saveName; uint32 _prevFrameNumber; +protected: + virtual void playerAction(Event &event) {} + virtual void processEnd(Event &event) {} public: SceneHandler(); void registerHandler(); |