diff options
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.cpp | 21 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.h | 4 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes1.cpp | 2 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes3.cpp | 18 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes8.cpp | 2 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes9.cpp | 4 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_ui.cpp | 2 |
7 files changed, 33 insertions, 20 deletions
diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index 5162e10a5c..a13e3b1e57 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -129,6 +129,8 @@ Scene *BlueForceGame::createScene(int sceneNumber) { // Traffic Stop Gang Members return new Scene410(); case 415: + // Searching Truck + return new Scene415(); case 440: case 450: error("Scene group 4 not implemented"); @@ -560,7 +562,7 @@ void FocusObject::postInit(SceneObjectList *OwnerList) { _v92 = 1; SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; - scene->_eventHandler = this; + scene->_focusObject = this; BF_GLOBALS._sceneItems.push_front(this); } @@ -574,8 +576,8 @@ void FocusObject::remove() { BF_GLOBALS._sceneItems.remove(this); SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; - if (scene->_eventHandler == this) - scene->_eventHandler = NULL; + if (scene->_focusObject == this) + scene->_focusObject = NULL; BF_GLOBALS._events.setCursor(BF_GLOBALS._events.getCursor()); NamedObject::remove(); @@ -584,20 +586,27 @@ void FocusObject::remove() { void FocusObject::process(Event &event) { if (BF_GLOBALS._player._enabled) { if (_bounds.contains(event.mousePos)) { + // Reset the cursor back to normal BF_GLOBALS._events.setCursor(BF_GLOBALS._events.getCursor()); + if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == CURSOR_WALK) && (event.btnState == 3)) { BF_GLOBALS._events.setCursor(CURSOR_USE); event.handled = true; } } else if (event.mousePos.y < 168) { + // Change the cursor to an 'Exit' image BF_GLOBALS._events.setCursor(_img); if (event.eventType == EVENT_BUTTON_DOWN) { + // Remove the object from display event.handled = true; remove(); } } } + + if (_action) + _action->process(event); } /*--------------------------------------------------------------------------*/ @@ -610,7 +619,7 @@ SceneExt::SceneExt(): Scene() { _savedPlayerEnabled = false; _savedUiEnabled = false; _savedCanWalk = false; - _eventHandler = NULL; + _focusObject = NULL; _cursorVisage.setVisage(1, 8); } @@ -830,6 +839,10 @@ void SceneHandlerExt::postInit(SceneObjectList *OwnerList) { } void SceneHandlerExt::process(Event &event) { + SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; + if (scene && scene->_focusObject) + scene->_focusObject->process(event); + if (BF_GLOBALS._uiElements._active) { BF_GLOBALS._uiElements.process(event); if (event.handled) diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h index 129b8eafaf..0184c6503b 100644 --- a/engines/tsage/blue_force/blueforce_logic.h +++ b/engines/tsage/blue_force/blueforce_logic.h @@ -181,7 +181,7 @@ public: GfxSurface _img; FocusObject(); - virtual void postInit(SceneObjectList *OwnerList); + virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void synchronize(Serializer &s); virtual void remove(); virtual void process(Event &event); @@ -202,7 +202,7 @@ public: bool _savedCanWalk; int _field37A; - EventHandler *_eventHandler; + FocusObject *_focusObject; Visage _cursorVisage; Rect _v51C34; diff --git a/engines/tsage/blue_force/blueforce_scenes1.cpp b/engines/tsage/blue_force/blueforce_scenes1.cpp index fb111e3fff..2e3a504e0c 100644 --- a/engines/tsage/blue_force/blueforce_scenes1.cpp +++ b/engines/tsage/blue_force/blueforce_scenes1.cpp @@ -675,7 +675,7 @@ void Scene190::signal() { void Scene190::process(Event &event) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_exit.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(3); diff --git a/engines/tsage/blue_force/blueforce_scenes3.cpp b/engines/tsage/blue_force/blueforce_scenes3.cpp index fd2bc17c6a..6edd6d1aaa 100644 --- a/engines/tsage/blue_force/blueforce_scenes3.cpp +++ b/engines/tsage/blue_force/blueforce_scenes3.cpp @@ -523,7 +523,7 @@ void Scene300::signal() { void Scene300::process(Event &event) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_item14.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_NE); @@ -1293,7 +1293,7 @@ void Scene315::signal() { void Scene315::process(Event &event) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_swExit.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW); @@ -2137,7 +2137,7 @@ void Scene340::process(Event &event) { if (!event.handled) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_westExit.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_W); @@ -2434,7 +2434,7 @@ void Scene342::process(Event &event) { if (!event.handled) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_westExit.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_W); @@ -2792,7 +2792,7 @@ void Scene350::process(Event &event) { if (!event.handled) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_swExit.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW); @@ -3989,7 +3989,7 @@ void Scene355::signal() { void Scene355::process(Event &event) { if (BF_GLOBALS._dayNumber == 5) { // Handling for day 5 - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_item12.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_NW); @@ -4047,7 +4047,7 @@ void Scene355::process(Event &event) { } } else { // All other days - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_item2.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(!_modeFlag ? EXITFRAME_SW : EXITFRAME_NE); @@ -5009,7 +5009,7 @@ void Scene370::signal() { void Scene370::process(Event &event) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_exit.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_E); @@ -5471,7 +5471,7 @@ void Scene385::signal() { void Scene385::process(Event &event) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_exit.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW); diff --git a/engines/tsage/blue_force/blueforce_scenes8.cpp b/engines/tsage/blue_force/blueforce_scenes8.cpp index 3b3ff20805..49de0be65c 100644 --- a/engines/tsage/blue_force/blueforce_scenes8.cpp +++ b/engines/tsage/blue_force/blueforce_scenes8.cpp @@ -1365,7 +1365,7 @@ void Scene840::signal() { void Scene840::process(Event &event) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { if (_exit.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_E); BF_GLOBALS._events.setCursor(surface); diff --git a/engines/tsage/blue_force/blueforce_scenes9.cpp b/engines/tsage/blue_force/blueforce_scenes9.cpp index 2bffe5e4db..b4799a67a0 100644 --- a/engines/tsage/blue_force/blueforce_scenes9.cpp +++ b/engines/tsage/blue_force/blueforce_scenes9.cpp @@ -687,7 +687,7 @@ void Scene900::signal() { void Scene900::process(Event &event) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { if (_item4.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_N); BF_GLOBALS._events.setCursor(surface); @@ -870,7 +870,7 @@ void Scene920::signal() { } void Scene920::process(Event &event) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { if (_exitN.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_N); BF_GLOBALS._events.setCursor(surface); diff --git a/engines/tsage/blue_force/blueforce_ui.cpp b/engines/tsage/blue_force/blueforce_ui.cpp index af15c7ec35..a4edffbe39 100644 --- a/engines/tsage/blue_force/blueforce_ui.cpp +++ b/engines/tsage/blue_force/blueforce_ui.cpp @@ -335,7 +335,7 @@ void UIElements::process(Event &event) { _cursorChanged = false; SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; - if (scene->_eventHandler) { + if (scene->_focusObject) { GfxSurface surface = _cursorVisage.getFrame(7); BF_GLOBALS._events.setCursor(surface); } |