aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2011-10-15 13:45:35 +1100
committerPaul Gilbert2011-10-15 13:46:38 +1100
commitf0245ef09a86d91a382f6baf3156d071b7f187d1 (patch)
treef4e59fd85f348ddf11459ac8f4a17c27d6c81320 /engines
parenta606312c2267946ced002d2fe1853879927e2473 (diff)
downloadscummvm-rg350-f0245ef09a86d91a382f6baf3156d071b7f187d1.tar.gz
scummvm-rg350-f0245ef09a86d91a382f6baf3156d071b7f187d1.tar.bz2
scummvm-rg350-f0245ef09a86d91a382f6baf3156d071b7f187d1.zip
TSAGE: Implemented SceneMessage class to show messages before fading in a scene
This is used by Blue Force to display 'The Next Day' messages.
Diffstat (limited to 'engines')
-rw-r--r--engines/tsage/blue_force/blueforce_logic.cpp72
-rw-r--r--engines/tsage/blue_force/blueforce_logic.h17
-rw-r--r--engines/tsage/blue_force/blueforce_scenes1.cpp8
-rw-r--r--engines/tsage/blue_force/blueforce_scenes1.h1
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();