diff options
Diffstat (limited to 'engines/tsage/blue_force/blueforce_scenes8.cpp')
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes8.cpp | 590 |
1 files changed, 590 insertions, 0 deletions
diff --git a/engines/tsage/blue_force/blueforce_scenes8.cpp b/engines/tsage/blue_force/blueforce_scenes8.cpp index 55ea403874..fddfc0a966 100644 --- a/engines/tsage/blue_force/blueforce_scenes8.cpp +++ b/engines/tsage/blue_force/blueforce_scenes8.cpp @@ -795,6 +795,596 @@ void Scene830::dispatch() { } } +/*-------------------------------------------------------------------------- + * Scene 840 - Boat Rentals + * + *--------------------------------------------------------------------------*/ + +void Scene840::Object2::postInit(SceneObjectList *OwnerList) { + FocusObject::postInit(OwnerList); + + if (BF_INVENTORY.getObjectScene(INV_RENTAL_KEYS) != 1) { + _rentalKeys.postInit(); + _rentalKeys.setVisage(840); + _rentalKeys.setStrip(2); + _rentalKeys.setFrame(3); + _rentalKeys.setPosition(Common::Point(120, 132)); + _rentalKeys.fixPriority(255); + _rentalKeys.setDetails(840, 52, 8, -1, 2, NULL); + } + + if (BF_INVENTORY.getObjectScene(INV_WAVE_KEYS) != 1) { + _waveKeys.postInit(); + _waveKeys.setVisage(840); + _waveKeys.setStrip(2); + _waveKeys.setFrame(2); + _waveKeys.setPosition(Common::Point(201, 91)); + _waveKeys.fixPriority(255); + _waveKeys.setDetails(840, 53, 8, -1, 2, NULL); + } + + _v1B4 = _v1B6 = 0; +} + +void Scene840::Object2::remove() { + Scene840 *scene = (Scene840 *)BF_GLOBALS._sceneManager._scene; + + _rentalKeys.remove(); + _waveKeys.remove(); + BF_GLOBALS._player.disableControl(); + + scene->_sceneMode = 8412; + scene->setAction(&scene->_sequenceManager1, scene, 8412, &BF_GLOBALS._player, NULL); +} + +void Scene840::Object2::process(Event &event) { + if (BF_GLOBALS._player._enabled) { + if (_bounds.contains(event.mousePos)) { + CursorType cursorId = BF_GLOBALS._events.getCursor(); + BF_GLOBALS._events.setCursor(cursorId); + + if ((event.eventType == EVENT_BUTTON_DOWN) && (cursorId == CURSOR_WALK) && (event.btnState == 3)) { + BF_GLOBALS._events.setCursor(CURSOR_USE); + event.handled = true; + } + } else if (event.mousePos.y < 168) { + BF_GLOBALS._events.setCursor(_img); + if (event.eventType == EVENT_BUTTON_DOWN) { + event.handled = true; + remove(); + } + } + } + + FocusObject::process(event); +} + +bool Scene840::Object2::startAction(CursorType action, Event &event) { + switch (action) { + case CURSOR_LOOK: + if ((event.mousePos.y > 43) && (event.mousePos.y < 92)) { + if (event.mousePos.x < 135) { + SceneItem::display2(840, 54); + return true; + } else if (event.mousePos.x < 183) { + SceneItem::display2(840, 57); + return true; + } + } else if ((event.mousePos.y > 91) && (event.mousePos.y < 132)) { + if (event.mousePos.x > 182) { + SceneItem::display2(840, 58); + return true; + } else if (event.mousePos.x > 134) { + SceneItem::display2(840, 57); + return true; + } + } + break; + case INV_WAVE_KEYS: + if ((BF_GLOBALS._dayNumber != 4) || (BF_GLOBALS._bookmark != bEndDayThree)) + SceneItem::display(840, 47); + else { + BF_GLOBALS._uiElements.addScore(50); + + if (BF_INVENTORY.getObjectScene(INV_RENTAL_KEYS) == 1) { + // Replace rental keys + _rentalKeys.postInit(); + _rentalKeys.setVisage(840); + _rentalKeys.setStrip(2); + _rentalKeys.setFrame(3); + _rentalKeys.setPosition(Common::Point(120, 132)); + _rentalKeys.fixPriority(255); + _rentalKeys.setDetails(840, 52, 8, -1, 2, NULL); + } + + if (BF_INVENTORY.getObjectScene(INV_WAVE_KEYS) == 1) { + // Replace wave keys + _waveKeys.postInit(); + _waveKeys.setVisage(840); + _waveKeys.setStrip(2); + _waveKeys.setFrame(2); + _waveKeys.setPosition(Common::Point(201, 91)); + _waveKeys.fixPriority(255); + _waveKeys.setDetails(840, 53, 8, -1, 2, NULL); + } + + BF_INVENTORY.setObjectScene(INV_WAVE_KEYS, 0); + BF_INVENTORY.setObjectScene(INV_RENTAL_KEYS, 0); + } + return true; + default: + break; + } + + return FocusObject::startAction(action, event); +} + +bool Scene840::Object2::RentalKeys::startAction(CursorType action, Event &event) { + Scene840 *scene = (Scene840 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if ((BF_GLOBALS._dayNumber == 4) && (BF_GLOBALS._bookmark >= bEndDayThree)) { + SceneItem::display2(840, 9); + } else { + SceneItem::display2(840, 55); + BF_INVENTORY.setObjectScene(INV_RENTAL_KEYS, 1); + BF_GLOBALS._uiElements.addScore(30); + + scene->_object2._v1B4 = 1; + remove(); + } + return true; + default: + return NamedObject::startAction(action, event); + } +} + +bool Scene840::Object2::WaveKeys::startAction(CursorType action, Event &event) { + Scene840 *scene = (Scene840 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (scene->_field1AC2) { + SceneItem::display(840, 56); + BF_INVENTORY.setObjectScene(INV_WAVE_KEYS, 1); + BF_GLOBALS._uiElements.addScore(50); + scene->_object2._v1B6 = 1; + remove(); + } else { + SceneItem::display2(840, 9); + } + return true; + default: + return NamedObject::startAction(action, event); + } +} + +bool Scene840::Object6::startAction(CursorType action, Event &event) { + Scene840 *scene = (Scene840 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + scene->_object1.postInit(); + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 8410; + scene->setAction(&scene->_sequenceManager1, scene, 8410, &scene->_object1, &BF_GLOBALS._player, NULL); + return true; + case CURSOR_USE: + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 8411; + scene->setAction(&scene->_sequenceManager1, scene, 8411, &BF_GLOBALS._player, NULL); + return true; + case INV_WAVE_KEYS: + case INV_RENTAL_KEYS: + if ((BF_GLOBALS._dayNumber == 4) && (BF_GLOBALS._bookmark == bEndDayThree)) { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 8417; + scene->setAction(&scene->_sequenceManager1, scene, 8417, &BF_GLOBALS._player, NULL); + } else { + SceneItem::display2(840, 47); + } + return true; + default: + return NamedObject::startAction(action, event); + } +} + +bool Scene840::Carter::startAction(CursorType action, Event &event) { + Scene840 *scene = (Scene840 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_TALK: + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 1; + + if ((BF_GLOBALS._player._position.x != 219) || (BF_GLOBALS._player._position.y != 129)) { + Common::Point pt(219, 129); + PlayerMover *mover = new PlayerMover(); + BF_GLOBALS._player.addMover(mover, &pt, scene); + } else { + scene->signal(); + } + return true; + case INV_RENTAL_COUPON: { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 6; + + Common::Point pt(219, 129); + PlayerMover *mover = new PlayerMover(); + BF_GLOBALS._player.addMover(mover, &pt, scene); + return true; + } + case INV_NICKEL: + ++BF_GLOBALS._v4CEB6; + BF_GLOBALS._player.disableControl(); + + if (BF_INVENTORY.getObjectScene(INV_WAVE_KEYS) == 1) { + if (!BF_GLOBALS.getFlag(fGotPointsForCombo)) { + BF_GLOBALS._uiElements.addScore(50); + BF_GLOBALS.setFlag(fGotPointsForCombo); + } + } + + scene->_sceneMode = 8407; + scene->setAction(&scene->_sequenceManager1, scene, 8407, &BF_GLOBALS._player, NULL); + return true; + case INV_CARTER_NOTE: + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 8402; + + if (!BF_GLOBALS._v4CEB6) { + scene->setAction(&scene->_sequenceManager1, scene, 8402, &BF_GLOBALS._player, &scene->_carter, NULL); + } else { + scene->setAction(&scene->_sequenceManager1, scene, 8414, &BF_GLOBALS._player, &scene->_carter, NULL); + } + return true; + default: + return NamedObject::startAction(action, event); + } +} + +/*--------------------------------------------------------------------------*/ + +bool Scene840::Coins::startAction(CursorType action, Event &event) { + Scene840 *scene = (Scene840 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 8404; + scene->setAction(&scene->_sequenceManager1, scene, BF_GLOBALS.getFlag(onDuty) ? 8415 : 8404, + &BF_GLOBALS._player, NULL); + return true; + default: + return NamedHotspot::startAction(action, event); + } +} + +bool Scene840::Exit::startAction(CursorType action, Event &event) { + ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 315, 150); + return true; +} + +/*--------------------------------------------------------------------------*/ + +Scene840::Scene840(): PalettedScene() { + _field1ABC = 1; + _field1ABE = 0; + _field1AC0 = 0; + _field1AC2 = 0; + _field1AC4 = 0; + _field1AC6 = (BF_GLOBALS._dayNumber > 3) ? 1 : 0; +} + +void Scene840::synchronize(Serializer &s) { + PalettedScene::synchronize(s); + error("TODO"); +} + +void Scene840::postInit(SceneObjectList *OwnerList) { + PalettedScene::postInit(OwnerList); + BF_GLOBALS._sound1.changeSound(41); + loadScene(840); + _field1ABA = 0; + + if (BF_GLOBALS._dayNumber == 0) { + // Debugging mode setup + BF_GLOBALS._dayNumber = 4; + BF_INVENTORY.setObjectScene(INV_NICKEL, 1); + BF_INVENTORY.setObjectScene(INV_RENTAL_COUPON, 1); + } + + setZoomPercents(0, 90, 110, 100); + _exit.setDetails(Rect(310, 133, 320, 167), 840, -1, -1, -1, 1, NULL); + + _stripManager.addSpeaker(&_gameTextSpeaker); + _stripManager.addSpeaker(&_jakeJacketSpeaker); + _stripManager.addSpeaker(&_jakeUniformSpeaker); + _stripManager.addSpeaker(&_carterSpeaker); + + BF_GLOBALS._player.postInit(); + BF_GLOBALS._player.changeZoom(-1); + BF_GLOBALS._player._moveDiff.x = BF_GLOBALS.getFlag(onDuty) ? 8 : 7; + + _object5.postInit(); + _object5.setVisage(840); + _object5.setStrip(3); + _object5.setPosition(Common::Point(157, 81)); + _object5.setDetails(840, 0, 1, 2, 1, NULL); + + _carter.postInit(); + _carter.setVisage(843); + _carter.setStrip(6); + _carter.fixPriority(110); + _carter.setPosition(Common::Point(262, 128)); + _carter.changeZoom(-1); + + _item14.setDetails(1, 840, 29, 30, 31, 1); + _item2.setDetails(Rect(6, 5, 85, 31), 840, 16, 14, 12, 1, NULL); + _item3.setDetails(Rect(91, 7, 102, 26), 840, 17, 14, 12, 1, NULL); + _item4.setDetails(Rect(6, 49, 80, 67), 840, 18, 15, 13, 1, NULL); + _item5.setDetails(Rect(80, 29, 100, 65), 840, 19, 15, 13, 1, NULL); + _item6.setDetails(Rect(104, 32, 127, 78), 840, 20, 15, 13, 1, NULL); + _item7.setDetails(Rect(1, 106, 35, 166), 840, 21, 15, 13, 1, NULL); + _item9.setDetails(Rect(205, 17, 251, 60), 840, 23, 15, 13, 1, NULL); + _item10.setDetails(Rect(199, 56, 236, 80), 840, 24, 14, 12, 1, NULL); + _item11.setDetails(Rect(256, 94, 319, 118), 840, 25, 15, 13, 1, NULL); + _item18.setDetails(6, 840, 38, 39, 40, 1); + _carter.setDetails(840, 3, 4, 5, 1, NULL); + _item8.setDetails(Rect(259, 4, 319, 87), 840, 22, 15, 13, 1, NULL); + _item15.setDetails(2, 840, 32, 33, 34, 1); + _coins.setDetails(3, 840, -1, 6, 7, 1); + _item16.setDetails(4, 840, 44, 45, 46, 1); + _item17.setDetails(5, 840, 26, 27, 28, 1); + _item12.setDetails(7, 840, 35, 36, 37, 1); + _item13.setDetails(Rect(0, 0, SCREEN_WIDTH - 1, BF_INTERFACE_Y), 840, 41, 42, 43, 1, NULL); + + if (BF_INVENTORY.getObjectScene(INV_RENTAL_KEYS) == 1) { + _object6.postInit(); + _object6.setVisage(840); + _object6.setStrip(4); + _object6.setFrame(1); + _object6.setPosition(Common::Point(250, 83)); + _object6.fixPriority(120); + _object6.setDetails(840, -1, 8, 9, 2, NULL); + _field1AC0 = 1; + } + + _sceneMode = BF_GLOBALS.getFlag(onDuty) ? 8401 : 8400; + setAction(&_sequenceManager1, this, _sceneMode, &BF_GLOBALS._player, NULL); + + if (BF_GLOBALS.getFlag(fWithLyle)) { + _lyle.postInit(); + _lyle.setAction(&_sequenceManager2, NULL, 8405, &_lyle, NULL); + } +} + +void Scene840::signal() { + switch (_sceneMode) { + case 1: + // Talking to Carter + BF_GLOBALS._player._strip = 7; + BF_GLOBALS._player._frame = 1; + _sceneMode = 3; + + switch (BF_GLOBALS._dayNumber) { + case 1: + if (_field1ABA == 1) { + _stripManager.start(BF_GLOBALS.getFlag(onDuty) ? 8430 : 8406, this); + } else if (!BF_GLOBALS.getFlag(onDuty)) { + _stripManager.start(!BF_GLOBALS._v4CEB6 ? 8400 : 8406, this); + } else if (BF_GLOBALS._bookmark < bStartOfGame) { + _stripManager.start(!BF_GLOBALS._v4CEB6 ? 8429 : 8430, this); + } else if (BF_GLOBALS._bookmark < bCalledToDomesticViolence) { + _stripManager.start(!BF_GLOBALS._v4CEB6 ? 8402 : 8401, this); + } else { + _stripManager.start(!BF_GLOBALS._v4CEB6 ? 8404 : 8403, this); + } + break; + case 2: + _stripManager.start(!BF_GLOBALS._v4CEB6 ? 8405 : 8430, this); + break; + case 3: + if (!BF_GLOBALS._v4CEB6) { + _stripManager.start(BF_GLOBALS.getFlag(fWithLyle) ? 8409 : 8411, this); + } else if (_field1ABA == 1) { + _stripManager.start(8406, this); + } else if (BF_GLOBALS.getFlag(fWithLyle)) { + _stripManager.start(BF_GLOBALS.getFlag(fCarterMetLyle) ? 8415 : 8414, this); + } else { + _stripManager.start(8413, this); + } + + BF_GLOBALS.setFlag(fTalkedCarterDay3); + break; + case 4: + if (!BF_GLOBALS._v4CEB6) { + if (BF_GLOBALS.getFlag(fTalkedCarterDay3)) { + if (BF_GLOBALS.getFlag(fWithLyle)) + _stripManager.start(BF_GLOBALS.getFlag(fCarterMetLyle) ? 8415 : 8414, this); + else + _stripManager.start(8413, this); + } else if (BF_GLOBALS.getFlag(fWithLyle)) { + _stripManager.start(BF_GLOBALS.getFlag(fCarterMetLyle) ? 8431 : 8409, this); + } else { + _stripManager.start(8411, this); + } + } else if (_field1ABA == 1) { + _stripManager.start(8406, this); + } else if (!BF_GLOBALS.getFlag(fWithLyle)) { + _stripManager.start(8413, this); + } else { + _stripManager.start(BF_GLOBALS.getFlag(fCarterMetLyle) ? 8415 : 8414, this); + } + break; + case 5: + _stripManager.start((_field1ABA == 1) ? 8406 : 8413, this); + break; + default: + break; + } + + _field1ABA = 1; + break; + case 2: + BF_GLOBALS._sceneManager.changeScene(830); + BF_GLOBALS._sound1.changeSound(10); + break; + case 3: + case 8404: + case 8416: + BF_GLOBALS._player.enableControl(); + break; + case 4: + _sceneMode = 8403; + _object6.postInit(); + _object6.setDetails(840, -1, 8, 9, 2, NULL); + setAction(&_sequenceManager1, this, 8403, &_carter, &_object6, NULL); + break; + case 5: + _sceneMode = 8408; + setAction(&_sequenceManager1, this, 8408, &BF_GLOBALS._player, &_carter, &_object5, NULL); + _field1AC2 = 1; + break; + case 6: + BF_GLOBALS._player._strip = 7; + BF_GLOBALS._player._frame = 1; + + if ((BF_GLOBALS._dayNumber == 4) && (BF_GLOBALS._bookmark >= bEndDayThree)) { + _stripManager.start(8440, this); + _sceneMode = 3; + } else if (BF_GLOBALS._sceneObjects->contains(&_object6)) { + _stripManager.start(8442, this); + _sceneMode = 3; + } else if (_field1AC6) { + _sceneMode = 4; + _stripManager.start(BF_GLOBALS.getFlag(fWithLyle) ? 8424 : 8410, this); + } else { + _sceneMode = 3; + _stripManager.start(8436, this); + } + break; + case 8400: + case 8401: + BF_GLOBALS._player._strip = 7; + BF_GLOBALS._player._frame = 1; + BF_GLOBALS._player.enableControl(); + break; + case 8402: + BF_GLOBALS._player.enableControl(); + BF_GLOBALS._uiElements.addScore(30); + BF_INVENTORY.setObjectScene(INV_CARTER_NOTE, 3); + BF_INVENTORY.setObjectScene(INV_BASEBALL_CARD, 1); + BF_INVENTORY.setObjectScene(INV_RENTAL_COUPON, 1); + break; + case 8403: + BF_GLOBALS._uiElements.addScore(30); + _sceneMode = 3; + _field1AC0 = 1; + _stripManager.start(8441, this); + break; + case 8407: + if (((BF_GLOBALS._dayNumber == 4) && (BF_GLOBALS._bookmark >= bEndDayThree)) || + (BF_INVENTORY.getObjectScene(INV_WAVE_KEYS) == 1)) { + _sceneMode = 8416; + setAction(&_sequenceManager1, this, 8416, &BF_GLOBALS._player, NULL); + } else { + _stripManager.start(_field1ABE + 8419, this); + _sceneMode = 5; + + if (++_field1ABE == 4) + _field1ABE = 1; + } + break; + case 8408: + if (_field1AC0) { + BF_GLOBALS._player.enableControl(); + } else { + _sceneMode = 8409; + setAction(&_sequenceManager1, this, 8409, &BF_GLOBALS._player, &_carter, &_object5, NULL); + } + break; + case 8409: + _field1AC2 = 0; + _sceneMode = 3; + _stripManager.start(8423, this); + break; + case 8410: + BF_GLOBALS._player.enableControl(); + _object1.remove(); + break; + case 8411: + BF_GLOBALS._player.enableControl(); + _object2.postInit(); + _object2.setVisage(840); + _object2.setStrip(2); + _object2.setPosition(Common::Point(160, 140)); + _object2.fixPriority(254); + _object2.setDetails(840, 50, 8, 51); + break; + case 8412: + if (_object2._v1B6) { + _sceneMode = 8409; + setAction(&_sequenceManager1, this, 8409, &BF_GLOBALS._player, &_carter, &_object5, NULL); + } else if (!_object2._v1B4) { + BF_GLOBALS._player.enableControl(); + } else { + _sceneMode = 3; + _field1AC0 = 1; + + if (BF_GLOBALS._dayNumber == 5) { + _stripManager.start(8425, this); + } else { + _stripManager.start(BF_GLOBALS.getFlag(INV_NICKEL) ? 8417 : 8416, this); + } + } + break; + case 8413: + BF_GLOBALS._uiElements.addScore(50); + _sceneMode = 8409; + setAction(&_sequenceManager1, this, 8409, &BF_GLOBALS._player, &_carter, &_object5, NULL); + break; + case 8417: + _field1ABA = 1; + BF_GLOBALS._uiElements.addScore(50); + BF_INVENTORY.setObjectScene(INV_WAVE_KEYS, 0); + BF_INVENTORY.setObjectScene(INV_RENTAL_KEYS, 0); + BF_GLOBALS._player.enableControl(); + break; + } +} + +void Scene840::process(Event &event) { + SceneExt::process(event); + + if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (_exit.contains(event.mousePos)) { + GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_E); + BF_GLOBALS._events.setCursor(surface); + } else { + // In case an exit cursor was being shown, restore the previously selected cursor + CursorType cursorId = BF_GLOBALS._events.getCursor(); + BF_GLOBALS._events.setCursor(cursorId); + } + } +} + +void Scene840::dispatch() { + SceneExt::dispatch(); + + if (_field1ABC && (BF_GLOBALS._player._position.x > 310) && !_action) { + _field1ABC = 0; + BF_GLOBALS._player.disableControl(); + _sceneMode = 2; + ADD_PLAYER_MOVER(350, 150); + + if (BF_GLOBALS.getFlag(fWithLyle)) { + _lyle.setAction(&_sequenceManager2, NULL, 8406, &_lyle, NULL); + } + } +} + } // End of namespace BlueForce } // End of namespace TsAGE |