aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage/blue_force/blueforce_scenes0.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2011-08-20 19:14:23 +1000
committerPaul Gilbert2011-08-20 19:14:23 +1000
commita21133ed12228e9a818b696bbc148f5b53946a30 (patch)
tree060022b5a1728db495375da269c5b1bc60fecdcc /engines/tsage/blue_force/blueforce_scenes0.cpp
parent0d887aa2459db04daddfd2a150f1d1ae4499091b (diff)
downloadscummvm-rg350-a21133ed12228e9a818b696bbc148f5b53946a30.tar.gz
scummvm-rg350-a21133ed12228e9a818b696bbc148f5b53946a30.tar.bz2
scummvm-rg350-a21133ed12228e9a818b696bbc148f5b53946a30.zip
TSAGE: Implemented Blue Force Scene #50 - Map Scene
Diffstat (limited to 'engines/tsage/blue_force/blueforce_scenes0.cpp')
-rw-r--r--engines/tsage/blue_force/blueforce_scenes0.cpp263
1 files changed, 260 insertions, 3 deletions
diff --git a/engines/tsage/blue_force/blueforce_scenes0.cpp b/engines/tsage/blue_force/blueforce_scenes0.cpp
index cc0f9bb1fd..bf9a7572ae 100644
--- a/engines/tsage/blue_force/blueforce_scenes0.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes0.cpp
@@ -199,14 +199,13 @@ void Scene20::postInit(SceneObjectList *OwnerList) {
*--------------------------------------------------------------------------*/
Scene50::Tooltip::Tooltip(): SavedObject() {
- strcpy(_msg, "");
- _field60 = _field62 = 0;
+ _newSceneNumber = _locationId = 0;
}
void Scene50::Tooltip::synchronize(Serializer &s) {
SavedObject::synchronize(s);
_bounds.synchronize(s);
- s.syncBytes((byte *)&_msg[0], 84);
+ s.syncString(_msg);
}
void Scene50::Tooltip2::signal() {
@@ -237,8 +236,266 @@ void Scene50::Tooltip2::dispatch() {
}
}
+void Scene50::Tooltip::set(const Rect &bounds, int v60, const Common::String &msg, int v62) {
+ _bounds = bounds;
+ _newSceneNumber = v60;
+ _msg = msg;
+ _locationId = v62;
+}
+
+void Scene50::Tooltip::update() {
+ // Set up the text object for the scene with the appropriate settings
+ Scene50 *scene = (Scene50 *)BF_GLOBALS._sceneManager._scene;
+ scene->_text._fontNumber = 10;
+ scene->_text._color1 = BF_GLOBALS._scenePalette._colors.foreground;
+ scene->_text._color2 = BF_GLOBALS._scenePalette._colors.background;
+ scene->_text.setup(_msg);
+
+ int yp = (scene->_text._textSurface.getBounds().height() == 0) ? _bounds.bottom : _bounds.top;
+ scene->_text.setPosition(Common::Point(_bounds.left, yp));
+}
+
+void Scene50::Tooltip::highlight(bool btnDown) {
+ Scene50 *scene = (Scene50 *)BF_GLOBALS._sceneManager._scene;
+
+ scene->_field382 = _newSceneNumber;
+ if ((scene->_field380 != 0) || (scene->_field380 != _newSceneNumber))
+ update();
+
+ if (btnDown) {
+ if ((BF_GLOBALS._bikiniHutState == 14) && BF_GLOBALS.getFlag(98))
+ scene->_sceneNumber = 600;
+ else if (BF_GLOBALS._bikiniHutState == 5)
+ scene->_sceneNumber = 410;
+ else {
+ BF_GLOBALS._v4CEF4 = _newSceneNumber;
+
+ switch (BF_GLOBALS._v4CEF2) {
+ case 330:
+ case 340:
+ case 342:
+ BF_GLOBALS._player.disableControl();
+ if (_locationId != BF_GLOBALS._mapLocationId) {
+ scene->_sceneNumber = 330;
+ } else {
+ scene->_sceneNumber = (BF_GLOBALS._v4CEA2 != 1) || (BF_GLOBALS._bikiniHutState < 1) ||
+ (BF_GLOBALS._bikiniHutState >= 2) ? 342 : 340;
+ }
+ break;
+
+ case 410:
+ case 551:
+ if (BF_GLOBALS.getFlag((BF_GLOBALS._v4CEF2 == 410) ? 41 : 40)) {
+ BF_GLOBALS._mapLocationId = _locationId;
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneNumber = _newSceneNumber;
+ } else {
+ BF_GLOBALS._v4CEA8 = 4;
+ BF_GLOBALS._sceneManager.changeScene(666);
+ return;
+ }
+ break;
+
+ case 300:
+ if (_locationId == 1) {
+ BF_GLOBALS._v4CEF4 = 300;
+ _newSceneNumber = 300;
+ }
+ // Deliberate fall through to default
+ default:
+ BF_GLOBALS._mapLocationId = _locationId;
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneNumber = _newSceneNumber;
+ break;
+ }
+
+ // Signal the scene to change to the new scene
+ scene->_sceneMode = 1;
+ scene->signal();
+ }
+ }
+}
+
/*--------------------------------------------------------------------------*/
+Scene50::Scene50(): SceneExt() {
+ _field382 = 0;
+ _field380 = 0;
+}
+
+void Scene50::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+
+ BF_GLOBALS._interfaceY = 200;
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(830);
+ BF_GLOBALS._player.setStrip(3);
+ BF_GLOBALS._player.setPosition(Common::Point(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2));
+ BF_GLOBALS._player.hide();
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player._uiEnabled = false;
+
+ BF_GLOBALS._scrollFollower = NULL;
+ _text._color1 = 19;
+ _text._color2 = 9;
+ _text._color3 = 9;
+ _text._width = 75;
+ _text._fontNumber = 4;
+ _text._textMode = ALIGN_LEFT;
+ _text.fixPriority(256);
+
+ // Set all the hotspots
+ _location3.set(Rect(10, 92, 24, 105), 180, GRANDMA_FRANNIE, 4);
+ _location2.set(Rect(443, 149, 508, 178), 330, MARINA, 2);
+ _location1.set(Rect(573, 103, 604, 130), 190, POLICE_DEPARTMENT, 1);
+ _location4.set(Rect(313, 21, 325, 33), 114, TONYS_BAR, 8);
+ _location8.set(Rect(69, 79, 82, 88), 580, CHILD_PROTECTIVE_SERVICES, 256);
+ _location6.set(Rect(242, 131, 264, 144), 440, ALLEY_CAT, 64);
+ _location5.set(Rect(383, 57, 402, 70), 380, CITY_HALL_JAIL, 32);
+ _location7.set(Rect(128, 32, 143, 42), 800, JAMISON_RYAN, 128);
+ _location9.set(Rect(349, 125, 359, 132),
+ (BF_GLOBALS._bikiniHutState == 13) || (BF_GLOBALS._bikiniHutState == 14) ? 551 : 550,
+ BIKINI_HUT, 16);
+
+ _item.setBounds(Rect(0, 0, SCREEN_WIDTH * 2, SCREEN_HEIGHT));
+ BF_GLOBALS._sceneItems.push_back(&_item);
+
+ // Find the location to start at
+ int selectedTooltip = BF_GLOBALS._mapLocationId;
+ Tooltip *tooltip = NULL;
+ int xp = 0;
+
+ switch (selectedTooltip) {
+ case 1:
+ tooltip = &_location1;
+ xp = 588;
+ break;
+ case 2:
+ tooltip = &_location2;
+ xp = 475;
+ break;
+ case 4:
+ tooltip = &_location3;
+ xp = 17;
+ break;
+ case 8:
+ tooltip = &_location4;
+ xp = 319;
+ break;
+ case 32:
+ tooltip = &_location5;
+ xp = 392;
+ break;
+ case 64:
+ tooltip = &_location6;
+ xp = 253;
+ break;
+ case 128:
+ tooltip = &_location7;
+ xp = 135;
+ break;
+ case 16:
+ tooltip = &_location9;
+ xp = 354;
+ break;
+ case 256:
+ tooltip = &_location8;
+ xp = 75;
+ break;
+ }
+
+ loadBackground(xp - 160, 0);
+ tooltip->update();
+
+ _timer.set(240, this);
+ _sceneBounds.center(xp, SCREEN_HEIGHT / 2);
+ loadScene(55);
+ _sceneMode = 2;
+}
+
+void Scene50::remove() {
+ // Blank out the screen
+ BF_GLOBALS._screenSurface.fillRect(BF_GLOBALS._screenSurface.getBounds(), 0);
+
+ SceneExt::remove();
+ BF_GLOBALS._v4E238 = 1;
+}
+
+void Scene50::signal() {
+ if (_sceneMode == 1) {
+ // Destination selected
+ if ((BF_GLOBALS._v4CEF2 == 551) && (_sceneNumber != BF_GLOBALS._v4CEF2)) {
+ BF_GLOBALS.setFlag(109);
+ BF_GLOBALS.setFlag(115);
+ BF_GLOBALS.setFlag(121);
+ BF_GLOBALS.setFlag(127);
+ BF_GLOBALS.setFlag(133);
+ }
+
+ if ((BF_GLOBALS._v4CEF2 == 410) && (_sceneNumber != BF_GLOBALS._v4CEF2)) {
+ BF_GLOBALS.setFlag(125);
+ }
+
+ if ((BF_GLOBALS._v4CEF2 == 340) && (_sceneNumber != BF_GLOBALS._v4CEF2)) {
+ BF_GLOBALS.setFlag(123);
+ }
+
+ if ((BF_GLOBALS._v4CEF2 == 380) && (_sceneNumber != BF_GLOBALS._v4CEF2)) {
+ if (BF_GLOBALS._bikiniHutState >= 4)
+ BF_GLOBALS.setFlag(129);
+ if (BF_GLOBALS._bikiniHutState >= 6)
+ BF_GLOBALS.setFlag(131);
+ if (BF_GLOBALS._bikiniHutState == 3) {
+ BF_GLOBALS._v4CEA8 = 19;
+ _sceneNumber = 666;
+ }
+ }
+
+ if ((_sceneNumber == 551) && BF_GLOBALS.getFlag(147))
+ _sceneNumber = 550;
+
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(_sceneNumber);
+
+ } else if (_sceneMode == 2) {
+ // Initial delay complete, time to switch to interactive mode
+ _text.remove();
+ BF_GLOBALS._player.enableControl();
+ _sceneMode = 0;
+ _field380 = 0;
+ }
+}
+
+void Scene50::process(Event &event) {
+ SceneExt::process(event);
+ Common::Point pt(event.mousePos.x + _sceneBounds.left, event.mousePos.y + _sceneBounds.top);
+ bool mouseDown = false;
+ _field382 = 0;
+
+ if ((event.mousePos.x > 270 && (_sceneBounds.right < (SCREEN_WIDTH * 2))))
+ loadBackground(4, 0);
+ else if ((event.mousePos.x < 50) && (_sceneBounds.left > 0))
+ loadBackground(-4, 0);
+ else
+ mouseDown = event.eventType == EVENT_BUTTON_DOWN;
+
+ if (BF_GLOBALS._player._uiEnabled) {
+ Tooltip *tooltipList[9] = { &_location1, &_location2, &_location3, &_location4,
+ &_location5, &_location6, &_location7, &_location8, &_location9 };
+
+ for (int idx = 0; idx < 9; ++idx) {
+ if (tooltipList[idx]->_bounds.contains(pt)) {
+ // Found a tooltip to highlight
+ tooltipList[idx]->highlight(mouseDown);
+ return;
+ }
+ }
+
+ // No hotspot selected, so remove any current tooltip display
+ _text.remove();
+ }
+}
+
} // End of namespace BlueForce
} // End of namespace TsAGE