diff options
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.cpp | 72 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.h | 17 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes1.cpp | 8 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes1.h | 1 |
4 files changed, 93 insertions, 5 deletions
diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index d413c2e035..22e50bb050 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -1391,6 +1391,78 @@ void NamedHotspot::synchronize(Serializer &s) { s.syncAsSint16LE(_talkLineNum); } +/*--------------------------------------------------------------------------*/ + +void SceneMessage::remove() { + SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; + if (scene->_focusObject == this) + scene->_focusObject = NULL; + + Action::remove(); +} + +void SceneMessage::signal() { + SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + scene->_focusObject = this; + BF_GLOBALS._events.setCursor(CURSOR_WALK); + draw(); + setDelay(180); + break; + case 1: + clear(); + remove(); + break; + default: + break; + } +} + +void SceneMessage::process(Event &event) { + if ((event.eventType == EVENT_BUTTON_DOWN) || + ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_RETURN))) { + signal(); + } +} + + +void SceneMessage::draw() { + GfxSurface &surface = BF_GLOBALS._screenSurface; + + // Clear the game area + surface.fillRect(Rect(0, 0, SCREEN_WIDTH, BF_INTERFACE_Y), 0); + + // Disable scene fade in + BF_GLOBALS._paneRefreshFlag[0] = 0; + + // Set up the font + GfxFont &font = BF_GLOBALS._gfxManagerInstance._font; + BF_GLOBALS._scenePalette.setEntry(font._colors.foreground, 255, 255, 255); + BF_GLOBALS._scenePalette.setPalette(font._colors.foreground, 1); + + // Write out the message + Rect textRect(0, BF_INTERFACE_Y / 2 - (font.getHeight() / 2), SCREEN_WIDTH, + BF_INTERFACE_Y / 2 + (font.getHeight() / 2)); + BF_GLOBALS._gfxManagerInstance._font.writeLines(_message.c_str(), textRect, ALIGN_CENTER); + + // TODO: Ideally, saving and loading should be disabled here until the message display is complete +} + +void SceneMessage::clear() { + // Fade out the text display + static const uint32 black = 0; + BF_GLOBALS._scenePalette.fade((const byte *)&black, false, 100); + + // Refresh the background + BF_GLOBALS._paneRefreshFlag[0] = 0; + + // Set up to fade in the game scene + g_globals->_sceneManager._fadeMode = FADEMODE_GRADUAL; + g_globals->_sceneManager._hasPalette = true; +} + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h index 2ebfc19c26..ee5f153cfa 100644 --- a/engines/tsage/blue_force/blueforce_logic.h +++ b/engines/tsage/blue_force/blueforce_logic.h @@ -204,7 +204,7 @@ public: bool _savedCanWalk; int _field37A; - FocusObject *_focusObject; + EventHandler *_focusObject; Visage _cursorVisage; Rect _v51C34; @@ -356,6 +356,21 @@ public: } }; +class SceneMessage: public Action { +private: + Common::String _message; + + void draw(); + void clear(); +public: + void setup(const Common::String &msg) { _message = msg; } + + virtual Common::String getClassName() { return "SceneMessage"; } + virtual void remove(); + virtual void signal(); + virtual void process(Event &event); +}; + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_scenes1.cpp b/engines/tsage/blue_force/blueforce_scenes1.cpp index da950adafe..32e8d6c200 100644 --- a/engines/tsage/blue_force/blueforce_scenes1.cpp +++ b/engines/tsage/blue_force/blueforce_scenes1.cpp @@ -1095,9 +1095,9 @@ void Scene180::postInit(SceneObjectList *OwnerList) { if ((BF_GLOBALS._bookmark == bLyleStoppedBy) && (BF_GLOBALS._dayNumber == 1)) { BF_GLOBALS._v501FC = 87; BF_GLOBALS._v501FA = _sceneBounds.left; -// _unk.setupText(THE_NEXT_DAY); + _sceneMessage.setup(THE_NEXT_DAY); _sceneMode = 6; -// setAction(&_unk); + setAction(&_sceneMessage, this); BF_GLOBALS._driveFromScene = 4; BF_GLOBALS._driveToScene = 4; BF_GLOBALS._mapLocationId = 4; @@ -1105,9 +1105,9 @@ void Scene180::postInit(SceneObjectList *OwnerList) { ((BF_GLOBALS._bookmark == bDoneAtLyles) && (BF_GLOBALS._dayNumber == 4))) { BF_GLOBALS._v501FC = 87; BF_GLOBALS._v501FA = _sceneBounds.left; -// _unk.setupText(THE_NEXT_DAY); + _sceneMessage.setup(THE_NEXT_DAY); _sceneMode = 6; -// setAction(&_unk); + setAction(&_sceneMessage, this); } else if (BF_GLOBALS._dayNumber == 0) { BF_GLOBALS._player.setPosition(Common::Point(0, 150)); _garageExit.postInit(); diff --git a/engines/tsage/blue_force/blueforce_scenes1.h b/engines/tsage/blue_force/blueforce_scenes1.h index 372706987a..8cf55d1b56 100644 --- a/engines/tsage/blue_force/blueforce_scenes1.h +++ b/engines/tsage/blue_force/blueforce_scenes1.h @@ -203,6 +203,7 @@ public: NamedHotspot _curb, _sky; GarageExit _garageExit; ASoundExt _sound1; + SceneMessage _sceneMessage; int _fieldC56; Scene180(); |