diff options
author | Paul Gilbert | 2011-09-06 19:55:29 +1000 |
---|---|---|
committer | Paul Gilbert | 2011-09-06 19:55:29 +1000 |
commit | 9908fa3b61bff96a921160b3c90c73e6f2a40ccc (patch) | |
tree | 06457f7606840257052b268eb902d3124eb90828 | |
parent | ad85a25f88f6d060f8477df7a6b5bfec1c620d84 (diff) | |
download | scummvm-rg350-9908fa3b61bff96a921160b3c90c73e6f2a40ccc.tar.gz scummvm-rg350-9908fa3b61bff96a921160b3c90c73e6f2a40ccc.tar.bz2 scummvm-rg350-9908fa3b61bff96a921160b3c90c73e6f2a40ccc.zip |
TSAGE: Some cleanup of Blue Force Scene 300, and implementing Scene 190
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.cpp | 11 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.h | 7 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes1.cpp | 281 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes1.h | 54 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes3.cpp | 13 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes3.h | 1 | ||||
-rw-r--r-- | engines/tsage/converse.cpp | 2 |
7 files changed, 348 insertions, 21 deletions
diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index 048aaf14de..99e3c38850 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -67,8 +67,10 @@ Scene *BlueForceGame::createScene(int sceneNumber) { case 150: case 160: case 180: - case 190: error("Scene group 1 not implemented"); + case 190: + // Front of Police Station + return new Scene190(); case 200: case 210: case 220: @@ -501,6 +503,7 @@ SceneExt::SceneExt(): Scene() { _field372 = 0; _field37A = 0; _eventHandler = NULL; + _cursorVisage.setVisage(1, 8); } void SceneExt::postInit(SceneObjectList *OwnerList) { @@ -598,17 +601,17 @@ void SceneExt::gunDisplay() { /*--------------------------------------------------------------------------*/ -GameScene::GameScene() { +GroupedScene::GroupedScene() { } -void GameScene::postInit(SceneObjectList *OwnerList) { +void GroupedScene::postInit(SceneObjectList *OwnerList) { _field794 = 0; _field412 = 1; SceneExt::postInit(OwnerList); } -void GameScene::remove() { +void GroupedScene::remove() { SceneExt::remove(); if (_field794 == 1) { for (SynchronizedList<SceneObject *>::iterator i = BF_GLOBALS._sceneObjects->begin(); diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h index 762833be41..c4c1b22efd 100644 --- a/engines/tsage/blue_force/blueforce_logic.h +++ b/engines/tsage/blue_force/blueforce_logic.h @@ -137,6 +137,8 @@ public: void setup(SceneObject *object, int visage, int frameNum, int yDiff); }; +enum ExitFrame { EXITFRAME_NE = 2, EXITFRAME_E = 3 }; + class SceneExt: public Scene { private: void gunDisplay(); @@ -145,6 +147,7 @@ public: int _field372; int _field37A; EventHandler *_eventHandler; + Visage _cursorVisage; Rect _v51C34; public: @@ -162,12 +165,12 @@ public: void display(CursorType action); }; -class GameScene: public SceneExt { +class GroupedScene: public SceneExt { public: int _field412; int _field794; public: - GameScene(); + GroupedScene(); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void remove(); diff --git a/engines/tsage/blue_force/blueforce_scenes1.cpp b/engines/tsage/blue_force/blueforce_scenes1.cpp index 7cccb0d284..acb1592abc 100644 --- a/engines/tsage/blue_force/blueforce_scenes1.cpp +++ b/engines/tsage/blue_force/blueforce_scenes1.cpp @@ -346,11 +346,11 @@ void Scene109::Text::dispatch() { /*--------------------------------------------------------------------------*/ -Scene109::Scene109(): GameScene() { +Scene109::Scene109(): GroupedScene() { } void Scene109::postInit(SceneObjectList *OwnerList) { - GameScene::postInit(OwnerList); + GroupedScene::postInit(OwnerList); loadScene(999); _protaginist2.postInit(); @@ -427,6 +427,283 @@ void Scene109::signal() { } } +/*-------------------------------------------------------------------------- + * Scene 190 - Front of Police Station + * + *--------------------------------------------------------------------------*/ + +void Scene190::Object4::startAction(CursorType action) { + Scene190 *scene = (Scene190 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 13; + Common::Point pt(62, 96); + PlayerMover *mover = new PlayerMover(); + BF_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + default: + NamedObject::startAction(action); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene190::Item1::startAction(CursorType action) { + Scene190 *scene = (Scene190 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + scene->setAction(&scene->_action1); + break; + default: + NamedHotspot::startAction(action); + break; + } +} + +void Scene190::Item2::startAction(CursorType action) { + Scene190 *scene = (Scene190 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + scene->_stripManager.start(1900, scene); + break; + default: + NamedHotspot::startAction(action); + break; + } +} + +void Scene190::Exit::startAction(CursorType action) { + Scene190 *scene = (Scene190 *)BF_GLOBALS._sceneManager._scene; + + Common::Point pt(316, 91); + PlayerMover *mover = new PlayerMover(); + BF_GLOBALS._player.addMover(mover, &pt, scene); +} + +/*--------------------------------------------------------------------------*/ + +void Scene190::Action1::signal() { + Scene190 *scene = (Scene190 *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + BF_GLOBALS._player.disableControl(); + setDelay(2); + break; + case 1: { + ADD_MOVER(BF_GLOBALS._player, 165, 91); + break; + } + case 2: + scene->_sound.play(82); + scene->_object2.animate(ANIM_MODE_5, this); + break; + case 3: + ADD_MOVER(BF_GLOBALS._player, 180, 86); + break; + case 4: + scene->_sound.play(82); + scene->_object2.animate(ANIM_MODE_6, this); + break; + case 5: + BF_GLOBALS._sound1.fadeOut2(NULL); + BF_GLOBALS._sceneManager.changeScene(315); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +Scene190::Scene190(): SceneExt() { + _fieldB52 = true; + _cursorVisage.setVisage(1, 8); +} + +void Scene190::postInit(SceneObjectList *OwnerList) { + BF_GLOBALS._dialogCenter.y = 100; + if ((BF_GLOBALS._sceneManager._previousScene == 100) || + (BF_GLOBALS._sceneManager._previousScene == 20)) { +// clearScreen(); + } + if (BF_GLOBALS._dayNumber == 0) + // If at start of game, change to first day + BF_GLOBALS._dayNumber = 1; + + // Load the scene data + loadScene(190); + BF_GLOBALS._scenePalette.loadPalette(2); + + _stripManager.addSpeaker(&_speaker); + BF_GLOBALS._player.postInit(); + BF_GLOBALS._player.disableControl(); + + // Initialise objects + _object2.postInit(); + _object2.setVisage(190); + _object2.setStrip(1); + _object2.setPosition(Common::Point(179, 88)); + + _object3.postInit(); + _object3.setVisage(190); + _object3.setStrip(2); + _object3.fixPriority(200); + _object3.setPosition(Common::Point(170, 31)); + _object3.animate(ANIM_MODE_7, 0, NULL); + _object3.setup(190, 8, 26, 19, 1, NULL); + + if (BF_GLOBALS.getFlag(fWithLyle)) { + BF_GLOBALS._player.setVisage(303); + BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + BF_GLOBALS._player.animate(ANIM_MODE_1, NULL); + BF_GLOBALS._player._moveDiff = Common::Point(3, 1); + + _object4.postInit(); + _object4.setVisage(444); + _object4.setFrame(2); + _object4.setPosition(Common::Point(54, 114)); + _object4.setup(190, -1, -1, -1, 1, NULL); + + switch (BF_GLOBALS._sceneManager._previousScene) { + case 300: { + _sceneMode = 12; + BF_GLOBALS._player.setPosition(Common::Point(316, 91)); + ADD_MOVER(BF_GLOBALS._player, 305, 91); + break; + } + case 315: + _sceneMode = 1901; + setAction(&_sequenceManager, this, 1901, &BF_GLOBALS._player, &_object2, NULL); + break; + case 50: + case 60: + default: + _fieldB52 = false; + BF_GLOBALS._player.setPosition(Common::Point(62, 96)); + BF_GLOBALS._player._strip = 3; + BF_GLOBALS._player.enableControl(); + break; + } + } else { + BF_GLOBALS._player.setVisage(BF_GLOBALS._player._visage); + BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + BF_GLOBALS._player.animate(ANIM_MODE_1, NULL); + + switch (BF_GLOBALS._sceneManager._previousScene) { + case 300: { + if (!BF_GLOBALS.getFlag(onBike)) { + BF_GLOBALS._player._moveDiff = Common::Point(3, 1); + _sceneMode = BF_GLOBALS.getFlag(onDuty) ? 11 : 12; + BF_GLOBALS._player.setVisage(BF_GLOBALS.getFlag(onDuty) ? 1304 : 303); + BF_GLOBALS._player.setPosition(Common::Point(316, 91)); + ADD_MOVER(BF_GLOBALS._player, 305, 91); + } else { + BF_GLOBALS._player.disableControl(); + _sceneMode = BF_GLOBALS.getFlag(onDuty) ? 193 : 191; + setAction(&_sequenceManager, this, 193, &BF_GLOBALS._player, NULL); + } + break; + } + case 315: + BF_GLOBALS._player._moveDiff = Common::Point(3, 1); + _sceneMode = BF_GLOBALS.getFlag(onDuty) ? 1900 : 1901; + setAction(&_sequenceManager, this, _sceneMode, &BF_GLOBALS._player, &_object2, NULL); + break; + case 50: + case 60: + default: + BF_GLOBALS.setFlag(onBike); + BF_GLOBALS._player.disableControl(); + _sceneMode = BF_GLOBALS.getFlag(onDuty) ? 192 : 190; + setAction(&_sequenceManager, this, _sceneMode, &BF_GLOBALS._player, NULL); + break; + } + } + + if (BF_GLOBALS.getFlag(onBike)) { + BF_GLOBALS._sound1.play(BF_GLOBALS.getFlag(onDuty) ? 37 : 29); + } else if (BF_GLOBALS._sceneManager._previousScene != 300) { + BF_GLOBALS._sound1.play(33); + } + + _exit.setup(Rect(310, 50, 320, 125), 190, -1, -1, -1, 1, NULL); + _item2.setup(Rect(108, 1, 111, 94), 190, 7, 11, 18, 1, NULL); + _item4.setup(2, 190, 5, 10, 16, 1); + _item3.setup(1, 190, 4, 10, 15, 1); + _item8.setup(6, 190, 20, 21, 22, 1); + _item1.setup(7, 190, 1, 10, -1, 1); + _item7.setup(5, 190, 0, 10, 12, 1); + _item6.setup(4, 190, 2, 10, 13, 1); + _item5.setup(3, 190, 3, 10, 14, 1); + _item9.setup(Rect(0, 0, 89, 68), 190, 6, 10, 17, 1, NULL); + _item10.setup(Rect(0, 0, SCREEN_WIDTH, BF_INTERFACE_Y), 190, 23, -1, -1, 1, NULL); +} + +void Scene190::signal() { + switch (_sceneMode) { + case 10: + if ((BF_GLOBALS._dayNumber == 2) && (BF_GLOBALS._bookmark < bEndDayOne)) + BF_GLOBALS._sound1.changeSound(49); + BF_GLOBALS._sceneManager.changeScene(300); + break; + case 11: + case 12: + case 1900: + case 1901: + BF_GLOBALS._player.enableControl(); + _fieldB52 = false; + break; + case 13: + case 191: + case 193: + BF_GLOBALS._sceneManager.changeScene(60); + break; + case 190: + case 192: + BF_GLOBALS._sceneManager.changeScene(300); + break; + case 0: + default: + BF_GLOBALS._player.enableControl(); + break; + } +} + +void Scene190::process(Event &event) { + SceneExt::process(event); + + if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + // Check if the cursor is on an exit + if (_exit.contains(event.mousePos)) { + GfxSurface surface = _cursorVisage.getFrame(3); + 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 Scene190::dispatch() { + SceneExt::dispatch(); + + if (!_action && !_fieldB52 && (BF_GLOBALS._player._position.x >= 310) + && !BF_GLOBALS.getFlag(onBike)) { + // Handle walking off to the right side of the screen + BF_GLOBALS._player.disableControl(); + _fieldB52 = true; + _sceneMode = 10; + + ADD_MOVER(BF_GLOBALS._player, 330, BF_GLOBALS._player._position.y); + } +} + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_scenes1.h b/engines/tsage/blue_force/blueforce_scenes1.h index 2b07e2b48f..3f4d1cb3d2 100644 --- a/engines/tsage/blue_force/blueforce_scenes1.h +++ b/engines/tsage/blue_force/blueforce_scenes1.h @@ -79,7 +79,7 @@ public: virtual void signal(); }; -class Scene109: public GameScene { +class Scene109: public GroupedScene { /* Actions */ class Action1: public Action { public: @@ -124,6 +124,58 @@ public: virtual void signal(); }; +class Scene190: public SceneExt { + /* Objects */ + class Object4: public NamedObject { + public: + virtual void startAction(CursorType action); + }; + + /* Items */ + class Item1: public NamedHotspot { + public: + virtual void startAction(CursorType action); + }; + class Item2: public NamedHotspot { + public: + virtual void startAction(CursorType action); + }; + class Exit: public NamedHotspot { + public: + virtual void startAction(CursorType action); + }; + + /* Actions */ + class Action1: public Action { + public: + virtual void signal(); + }; +public: + SequenceManager _sequenceManager; + FollowerObject _object1; + NamedObject _object2, _object3; + Object4 _object4; + Item1 _item1; + Item2 _item2; + NamedHotspot _item3, _item4, _item5, _item6; + NamedHotspot _item7, _item8, _item9, _item10; + Exit _exit; + Action1 _action1; + ASoundExt _sound; + SpeakerGameText _speaker; + bool _fieldB52; + + Scene190(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); + virtual void synchronize(Serializer &s) { + SceneExt::synchronize(s); + s.syncAsSint16LE(_fieldB52); + } +}; + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_scenes3.cpp b/engines/tsage/blue_force/blueforce_scenes3.cpp index fd1e613d00..d9d7590c82 100644 --- a/engines/tsage/blue_force/blueforce_scenes3.cpp +++ b/engines/tsage/blue_force/blueforce_scenes3.cpp @@ -222,8 +222,6 @@ void Scene300::Action5::signal() { Scene300::Scene300(): SceneExt(), _object13(3000), _object14(3001), _object15(3002), _object16(3003) { _field2760 = _field2762 = 0; - - _cursorVisage.setVisage(1, 8); } void Scene300::postInit(SceneObjectList *OwnerList) { @@ -282,12 +280,6 @@ void Scene300::postInit(SceneObjectList *OwnerList) { _object11.setPosition(Common::Point(265, 91)); _object11.hide(); - //***DEBUG*** -BF_GLOBALS.setFlag(2); -BF_GLOBALS._sceneManager._previousScene = 315; // 190; -BF_GLOBALS._player.setVisage(190); -BF_GLOBALS._player.setStrip(1); - switch (BF_GLOBALS._sceneManager._previousScene) { case 50: case 60: @@ -526,11 +518,12 @@ void Scene300::process(Event &event) { SceneExt::process(event); if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + // Check if the cursor is on an exit if (_item14.contains(event.mousePos)) { - GfxSurface surface = _cursorVisage.getFrame(2); + GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_NE); BF_GLOBALS._events.setCursor(surface); } else if (_item15.contains(event.mousePos)) { - GfxSurface surface = _cursorVisage.getFrame(3); + 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 diff --git a/engines/tsage/blue_force/blueforce_scenes3.h b/engines/tsage/blue_force/blueforce_scenes3.h index 4acb424207..fba2d04478 100644 --- a/engines/tsage/blue_force/blueforce_scenes3.h +++ b/engines/tsage/blue_force/blueforce_scenes3.h @@ -97,7 +97,6 @@ private: public: SequenceManager _sequenceManager1, _sequenceManager2; SequenceManager _sequenceManager3, _sequenceManager4; - Visage _cursorVisage; NamedObject _object1; FollowerObject _object2, _object3, _object4, _object5, _object6, _object7; SceneObject _object8, _object9, _object10; diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 615b1c36fd..af9bca238d 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -287,7 +287,7 @@ void SequenceManager::signal() { /* Following indexes were introduced for Blue Force */ case 35: v1 = getNextValue(); - _sceneObject->updateAngle(_objectList[v1]); + _sceneObject->updateAngle(_objectList[v1]->_position); break; case 36: _sceneObject->animate(ANIM_MODE_9, NULL); |