From e506df40ce78b982362fcd7aadd26c987f3255c5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 16 Sep 2011 17:30:39 +1000 Subject: [PATCH] TSAGE: Implemented Blue Force scene 840 - Boat Rentals --- engines/tsage/blue_force/blueforce_logic.cpp | 64 ++ engines/tsage/blue_force/blueforce_logic.h | 15 +- .../tsage/blue_force/blueforce_scenes8.cpp | 590 ++++++++++++++++++ engines/tsage/blue_force/blueforce_scenes8.h | 69 ++ .../tsage/blue_force/blueforce_speakers.cpp | 26 + engines/tsage/blue_force/blueforce_speakers.h | 7 + engines/tsage/globals.cpp | 2 + engines/tsage/globals.h | 1 + 8 files changed, 773 insertions(+), 1 deletion(-) diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index 51e0551071d..7ee5588548e 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -140,6 +140,8 @@ Scene *BlueForceGame::createScene(int sceneNumber) { // Outside Boat Rentals return new Scene830(); case 840: + // Boat Rentals + return new Scene840(); case 850: case 860: case 870: @@ -430,6 +432,12 @@ void NamedObject::setDetails(int resNum, int lookLineNum, int talkLineNum, int u } } +void NamedObject::setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { + _resNum = resNum; + _lookLineNum = lookLineNum; + _talkLineNum = talkLineNum; + _useLineNum = useLineNum; +} /*--------------------------------------------------------------------------*/ @@ -514,6 +522,62 @@ void FollowerObject::setup(SceneObject *object, int visage, int frameNum, int yD /*--------------------------------------------------------------------------*/ +FocusObject::FocusObject(): NamedObject() { + _img = surfaceFromRes(1, 5, 7); +} + +void FocusObject::postInit(SceneObjectList *OwnerList) { + NamedObject::postInit(OwnerList); + _resNum = 560; + _lookLineNum = 43; + _talkLineNum = 44; + _useLineNum = -1; + _v90 = 0; + _v92 = 1; + + SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; + scene->_eventHandler = this; + BF_GLOBALS._sceneItems.push_front(this); +} + +void FocusObject::synchronize(Serializer &s) { + NamedObject::synchronize(s); + s.syncAsSint16LE(_v90); + s.syncAsSint16LE(_v92); +} + +void FocusObject::remove() { + BF_GLOBALS._sceneItems.remove(this); + + SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; + if (scene->_eventHandler == this) + scene->_eventHandler = NULL; + + BF_GLOBALS._events.setCursor(BF_GLOBALS._events.getCursor()); + NamedObject::remove(); +} + +void FocusObject::process(Event &event) { + if (BF_GLOBALS._player._enabled) { + if (_bounds.contains(event.mousePos)) { + 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) { + BF_GLOBALS._events.setCursor(_img); + if (event.eventType == EVENT_BUTTON_DOWN) { + event.handled = true; + remove(); + } + } + } +} + +/*--------------------------------------------------------------------------*/ + SceneExt::SceneExt(): Scene() { _stripManager._onBegin = SceneExt::startStrip; _stripManager._onEnd = SceneExt::endStrip; diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h index 373a81e0fa2..96e19d4b8cf 100644 --- a/engines/tsage/blue_force/blueforce_logic.h +++ b/engines/tsage/blue_force/blueforce_logic.h @@ -109,6 +109,7 @@ public: virtual bool startAction(CursorType action, Event &event); void setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item); + void setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum); }; class CountdownObject: public NamedObject { @@ -127,7 +128,7 @@ public: SceneObject *_object; FollowerObject(); - virtual Common::String getClassName() { return "SceneObjectExt4"; } + virtual Common::String getClassName() { return "FollowerObject"; } virtual void synchronize(Serializer &s); virtual void remove(); virtual void dispatch(); @@ -136,6 +137,18 @@ public: void setup(SceneObject *object, int visage, int frameNum, int yDiff); }; +class FocusObject: public NamedObject { +public: + int _v90, _v92; + GfxSurface _img; + + FocusObject(); + virtual void postInit(SceneObjectList *OwnerList); + virtual void synchronize(Serializer &s); + virtual void remove(); + virtual void process(Event &event); +}; + enum ExitFrame { EXITFRAME_N = 1, EXITFRAME_NE = 2, EXITFRAME_E = 3, EXITFRAME_SE = 4, EXITFRAME_S = 5, EXITFRAME_SW = 6, EXITFRAME_W = 7, EXITFRAME_NW = 8 }; diff --git a/engines/tsage/blue_force/blueforce_scenes8.cpp b/engines/tsage/blue_force/blueforce_scenes8.cpp index 55ea403874f..fddfc0a9665 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 diff --git a/engines/tsage/blue_force/blueforce_scenes8.h b/engines/tsage/blue_force/blueforce_scenes8.h index 05e2173a9be..122c562ca9c 100644 --- a/engines/tsage/blue_force/blueforce_scenes8.h +++ b/engines/tsage/blue_force/blueforce_scenes8.h @@ -153,6 +153,75 @@ public: virtual void dispatch(); }; +class Scene840: public PalettedScene { + /* Items */ + class Coins: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Exit: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Objects */ + class Object2: public FocusObject { + class RentalKeys: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class WaveKeys: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + public: + RentalKeys _rentalKeys; + WaveKeys _waveKeys; + int _v1B4, _v1B6; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void process(Event &event); + virtual bool startAction(CursorType action, Event &event); + }; + class Object6: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Carter: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + +public: + SequenceManager _sequenceManager1, _sequenceManager2; + NamedObject _object1; + Object2 _object2; + NamedObject _object5; + Object6 _object6; + Carter _carter; + NamedObject _lyle; + Coins _coins; + NamedHotspot _item2, _item3, _item4, _item5, _item6; + NamedHotspot _item7, _item8, _item9, _item10, _item11; + NamedHotspot _item12, _item13, _item14, _item15; + NamedHotspot _item16, _item17, _item18; + Exit _exit; + SpeakerGameText _gameTextSpeaker; + SpeakerJakeJacket _jakeJacketSpeaker; + SpeakerJakeUniform _jakeUniformSpeaker; + SpeakerCarter _carterSpeaker; + int _field1ABA, _field1ABC, _field1ABE, _field1AC0; + int _field1AC2, _field1AC4, _field1AC6; + + Scene840(); + virtual void synchronize(Serializer &s); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); +}; + } // End of namespace BlueForce diff --git a/engines/tsage/blue_force/blueforce_speakers.cpp b/engines/tsage/blue_force/blueforce_speakers.cpp index 59736bec8f9..65db250c9d7 100644 --- a/engines/tsage/blue_force/blueforce_speakers.cpp +++ b/engines/tsage/blue_force/blueforce_speakers.cpp @@ -397,6 +397,32 @@ void SpeakerSkipB::setText(const Common::String &msg) { _object2.fixCountdown(8, _numFrames); } +/*--------------------------------------------------------------------------*/ + +SpeakerCarter::SpeakerCarter(): VisualSpeaker() { + _color1 = 89; + _color2 = 95; + _speakerName = "CARTER"; +} + +void SpeakerCarter::setText(const Common::String &msg) { + _removeObject1 = _removeObject2 = true; + + _object1.postInit(); + _object1.setVisage(844); + _object1.setStrip2(8); + _object1.fixPriority(254); + _object1.setPosition(Common::Point(78, 166)); + + _object2.postInit(); + _object2.setVisage(844); + _object2.fixPriority(255); + _object2.setPosition(Common::Point(78, 166)); + + VisualSpeaker::setText(msg); + _object2.fixCountdown(8, _numFrames); +} + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_speakers.h b/engines/tsage/blue_force/blueforce_speakers.h index 56832a2ee84..37b8050ef06 100644 --- a/engines/tsage/blue_force/blueforce_speakers.h +++ b/engines/tsage/blue_force/blueforce_speakers.h @@ -155,6 +155,13 @@ public: virtual void setText(const Common::String &msg); }; +class SpeakerCarter: public VisualSpeaker { +public: + SpeakerCarter(); + + virtual Common::String getClassName() { return "SpeakerCarter"; } + virtual void setText(const Common::String &msg); +}; } // End of namespace BlueForce diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 6f0223f6dbe..0519c2da2bd 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -206,6 +206,7 @@ void BlueForceGlobals::synchronize(Serializer &s) { s.syncAsSint16LE(_clip1Bullets); s.syncAsSint16LE(_clip2Bullets); s.syncAsSint16LE(_v4CEB4); + s.syncAsSint16LE(_v4CEB6); } void BlueForceGlobals::reset() { @@ -237,6 +238,7 @@ void BlueForceGlobals::reset() { _clip1Bullets = 8; _clip2Bullets = 8; _v4CEB4 = 0; + _v4CEB6 = 0; } bool BlueForceGlobals::getHasBullets() { diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index ac3b313ca64..7f82bba114f 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -170,6 +170,7 @@ public: int _dayNumber; int _v4CEA4; int _v4CEB4; + int _v4CEB6; int _deathReason; int _driveFromScene; int _driveToScene;