diff options
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.cpp | 124 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.h | 50 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes0.cpp | 12 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes0.h | 2 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes1.cpp | 217 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes1.h | 47 |
6 files changed, 442 insertions, 10 deletions
diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index 87e1597e1d..5f635da02f 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -31,7 +31,7 @@ namespace tSage { void BlueForceGame::start() { // Start the game - _globals->_sceneManager.changeScene(20); + _globals->_sceneManager.changeScene(109); _globals->_events.setCursor(CURSOR_WALK); } @@ -50,6 +50,8 @@ Scene *BlueForceGame::createScene(int sceneNumber) { // Tsnunami Title Screen #2 return new BF_Scene100(); case 109: + // Introduction Bar Room + return new BF_Scene109(); case 110: case 114: case 115: @@ -125,4 +127,124 @@ Scene *BlueForceGame::createScene(int sceneNumber) { } } +/*--------------------------------------------------------------------------*/ + +ObjArray::ObjArray(): EventHandler() { + _inUse = false; + clear(); +} + +void ObjArray::clear() { + for (int i = 0; i < OBJ_ARRAY_SIZE; ++i) + _objList[i] = NULL; +} + +void ObjArray::synchronize(Serializer &s) { + EventHandler::synchronize(s); + for (int i = 0; i < OBJ_ARRAY_SIZE; ++i) + SYNC_POINTER(_objList[i]); +} + +void ObjArray::process(Event &event) { + if (_inUse) + error("Array error"); + _inUse = true; + + for (int i = 0; i < OBJ_ARRAY_SIZE; ++i) { + if (_objList[i]) + _objList[i]->process(event); + } + + _inUse = false; +} + +void ObjArray::dispatch() { + if (_inUse) + error("Array error"); + _inUse = true; + + for (int i = 0; i < OBJ_ARRAY_SIZE; ++i) { + if (_objList[i]) + _objList[i]->dispatch(); + } + + _inUse = false; +} + +/*--------------------------------------------------------------------------*/ + +SceneExt::SceneExt(): Scene() { + warning("TODO: dword_503AA/dword_503AE/dword_53030"); + + _field372 = 0; + _field37C = NULL; +} + +void SceneExt::postInit(SceneObjectList *OwnerList) { + Scene::postInit(OwnerList); + if (BF_GLOBALS._v4CEA2) { + // Blank out the bottom portion of the screen + BF_GLOBALS._v51C24 = BF_INTERFACE_Y; + + Rect r(0, BF_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT); + BF_GLOBALS.gfxManager().getSurface().fillRect(r, 0); + } +} + +void SceneExt::process(Event &event) { + _objArray2.process(event); + if (!event.handled) + Scene::process(event); +} + +void SceneExt::dispatch() { + _objArray1.dispatch(); + + if (_field37A) { + if ((--_field37A == 0) && BF_GLOBALS._v4CEA2) { + if (BF_GLOBALS._v4E238 && (BF_GLOBALS._v4CF9E == 1)) { + warning("sub_1B052"); + } + + _field37A = 0; + } + } + + Scene::dispatch(); +} + +void SceneExt::loadScene(int sceneNum) { + Scene::loadScene(sceneNum); + warning("TODO: word_51C38/word_51C3C"); +} + +/*--------------------------------------------------------------------------*/ + +GameScene::GameScene() { + +} + +void GameScene::postInit(SceneObjectList *OwnerList) { + _field794 = 0; + _field412 = 1; + SceneExt::postInit(OwnerList); +} + +void GameScene::remove() { + SceneExt::remove(); + if (_field794 == 1) { + for (SynchronizedList<SceneObject *>::iterator i = BF_GLOBALS._sceneObjects->begin(); + i != BF_GLOBALS._sceneObjects->end(); ++i) + (*i)->remove(); + + BF_GLOBALS._sceneObjects->draw(); + BF_GLOBALS._scenePalette.loadPalette(2); + BF_GLOBALS._v51C44 = 1; + BF_GLOBALS._v51C42 = 1; + } + + BF_GLOBALS._scenePalette._field412 = 1; +} + + } // End of namespace tSage diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h index 9237e50a13..6cfbe9120a 100644 --- a/engines/tsage/blue_force/blueforce_logic.h +++ b/engines/tsage/blue_force/blueforce_logic.h @@ -29,6 +29,8 @@ #include "tsage/scenes.h" #include "tsage/globals.h" +#define BF_INTERFACE_Y 168 + namespace tSage { class BlueForceGame: public Game { @@ -37,6 +39,54 @@ public: virtual Scene *createScene(int sceneNumber); }; +#define OBJ_ARRAY_SIZE 10 +class ObjArray: public EventHandler { +public: + EventHandler *_objList[OBJ_ARRAY_SIZE]; + bool _inUse; +public: + ObjArray(); + void clear(); + + virtual Common::String getClassName() { return "ObjArray"; } + virtual void synchronize(Serializer &s); + virtual void process(Event &event); + virtual void dispatch(); +}; + +class SceneExt: public Scene { +public: + ObjArray _objArray1, _objArray2; + int _field372; + int _field37A; + EventHandler *_field37C; +public: + SceneExt(); + + virtual Common::String getClassName() { return "SceneExt"; } + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void process(Event &event); + virtual void dispatch(); + virtual void loadScene(int sceneNum); + virtual void proc13() { warning("TODO: SceneExt::proc13"); } +}; + +class GameScene: public SceneExt { +public: + int _field412; + int _field794; +public: + GameScene(); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); +}; + +class BlueAnimatedSpeaker: public Speaker { +public: +}; + + } // End of namespace tSage #endif diff --git a/engines/tsage/blue_force/blueforce_scenes0.cpp b/engines/tsage/blue_force/blueforce_scenes0.cpp index 3eaa2bfdab..5f271d4185 100644 --- a/engines/tsage/blue_force/blueforce_scenes0.cpp +++ b/engines/tsage/blue_force/blueforce_scenes0.cpp @@ -33,7 +33,7 @@ namespace tSage { *--------------------------------------------------------------------------*/ void BF_Scene20::Action1::signal() { - BF_Scene20 *scene = (BF_Scene20 *)_globals->_sceneManager._scene; + BF_Scene20 *scene = (BF_Scene20 *)BF_GLOBALS._sceneManager._scene; static byte black[3] = { 0, 0, 0 }; switch (_actionIndex++) { @@ -42,7 +42,7 @@ void BF_Scene20::Action1::signal() { break; case 1: _sound.play(1); - _globals->_scenePalette.addRotation(64, 127, -1, 1, this); + BF_GLOBALS._scenePalette.addRotation(64, 127, -1, 1, this); break; case 2: scene->_object1.setVisage(22); @@ -88,7 +88,7 @@ void BF_Scene20::Action1::signal() { setDelay(1); break; case 3: - _globals->_scenePalette.addFader(scene->_scenePalette._palette, 256, 8, this); + BF_GLOBALS._scenePalette.addFader(scene->_scenePalette._palette, 256, 8, this); break; case 4: setDelay(60); @@ -105,10 +105,10 @@ void BF_Scene20::Action1::signal() { setDelay(120); break; case 7: - _globals->_scenePalette.addFader(black, 1, 5, this); + BF_GLOBALS._scenePalette.addFader(black, 1, 5, this); break; case 8: - _globals->_sceneManager.changeScene(100); + BF_GLOBALS._sceneManager.changeScene(100); remove(); break; } @@ -121,8 +121,6 @@ void BF_Scene20::postInit(SceneObjectList *OwnerList) { Scene::postInit(); setZoomPercents(60, 85, 200, 100); - preloadVisage(21); - preloadVisage(22); _scenePalette.loadPalette(1); _scenePalette.loadPalette(22); diff --git a/engines/tsage/blue_force/blueforce_scenes0.h b/engines/tsage/blue_force/blueforce_scenes0.h index c176a17110..182a45fe49 100644 --- a/engines/tsage/blue_force/blueforce_scenes0.h +++ b/engines/tsage/blue_force/blueforce_scenes0.h @@ -34,7 +34,7 @@ namespace tSage { -class BF_Scene20 : public Scene { +class BF_Scene20 : public SceneExt { /* Actions */ class Action1 : public Action { private: diff --git a/engines/tsage/blue_force/blueforce_scenes1.cpp b/engines/tsage/blue_force/blueforce_scenes1.cpp index 0f0ab6c1c3..8e744a4ee3 100644 --- a/engines/tsage/blue_force/blueforce_scenes1.cpp +++ b/engines/tsage/blue_force/blueforce_scenes1.cpp @@ -192,4 +192,221 @@ void BF_Scene100::signal() { } } +/*-------------------------------------------------------------------------- + * Scene 109 - Introduction Bar Room + * + *--------------------------------------------------------------------------*/ + +void BF_Scene109::Action1::signal() { + BF_Scene109 *scene = (BF_Scene109 *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + setDelay(30); + break; + case 1: + BF_GLOBALS._sound1.play(12); + BF_GLOBALS._sceneObjects->draw(); + BF_GLOBALS._scenePalette.loadPalette(2); + BF_GLOBALS._scenePalette.refresh(); + setDelay(10); + break; + case 2: + scene->_text.setup(BF_19840515, this); + break; + case 3: + BF_GLOBALS._v51C44 = 1; + scene->loadScene(115); + + scene->_protaginist2.show(); + scene->_protaginist2.setPriority(133); + scene->_protaginist1.show(); + scene->_bartender.show(); + scene->_object1.show(); + scene->_object6.show(); + scene->_object6.setAction(&scene->_action3); + scene->_object2.show(); + scene->_object9.show(); + scene->_object9.setAction(&scene->_action2); + + BF_GLOBALS._v501FC = 170; + setDelay(60); + break; + case 4: + scene->_bartender.setAction(&scene->_sequenceManager4, NULL, 109, &scene->_bartender, &scene->_object2, NULL); + scene->_protaginist1.setAction(&scene->_sequenceManager5, NULL, 107, &scene->_protaginist1, NULL); + scene->_protaginist2.setAction(&scene->_sequenceManager6, this, 106, &scene->_protaginist2, NULL); + break; + case 5: + scene->setAction(&scene->_sequenceManager6, this, 105, &scene->_object10, NULL); + break; + case 6: + scene->_object10.remove(); + scene->setAction(&scene->_sequenceManager6, this, 100, &scene->_object10, NULL); + break; + case 7: + scene->_object7.setAction(&scene->_sequenceManager7, NULL, 103, &scene->_object7, NULL); + scene->_object5.setAction(&scene->_sequenceManager8, this, 102, &scene->_object5, NULL); + scene->_protaginist2.setAction(&scene->_sequenceManager6, NULL, 104, &scene->_protaginist2, &scene->_bartender, NULL); + break; + case 8: + scene->setAction(&scene->_sequenceManager8, this, 101, &scene->_object5, &scene->_protaginist1, NULL); + break; + case 9: + scene->_protaginist1.setAction(&scene->_sequenceManager5, this, 98, &scene->_protaginist1, NULL); + scene->_object7.setAction(&scene->_sequenceManager7, NULL, 99, &scene->_object7, NULL); + break; + case 10: + scene->_sceneMode = 1; + remove(); + break; + } +} + +void BF_Scene109::Action2::signal() { + BF_Scene109 *scene = (BF_Scene109 *)BF_GLOBALS._sceneManager._scene; + scene->setAction(&scene->_sequenceManager2, this, 3117, &scene->_object9, NULL); +} + +void BF_Scene109::Action3::signal() { + BF_Scene109 *scene = (BF_Scene109 *)BF_GLOBALS._sceneManager._scene; + scene->setAction(&scene->_sequenceManager3, this, 108, &scene->_object6, NULL); +} + +/*--------------------------------------------------------------------------*/ + +BF_Scene109::Text::Text(): SceneText() { + _action = NULL; + _frameNumber = 0; + _diff = 0; +} + +void BF_Scene109::Text::setup(const Common::String &msg, Action *action) { + _frameNumber = BF_GLOBALS._events.getFrameNumber(); + _diff = 180; + _action = action; + _fontNumber = 4; + _width = 300; + _textMode = ALIGN_CENTER; + _color1 = BF_GLOBALS._scenePalette._colors.background; + _color2 = _color3 = 0; + + SceneText::setup(msg); + + // Center the text on-screen + reposition(); + _bounds.center(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2); + + // Set the new position + _position.x = _bounds.left; + _position.y = _bounds.top; +} + +void BF_Scene109::Text::synchronize(Serializer &s) { + SceneText::synchronize(s); + SYNC_POINTER(_action); + s.syncAsUint32LE(_frameNumber); + s.syncAsSint16LE(_diff); +} + +void BF_Scene109::Text::dispatch() { + if (_diff) { + uint32 frameNumber = BF_GLOBALS._events.getFrameNumber(); + if (_frameNumber < frameNumber) { + _diff -= frameNumber - _frameNumber; + _frameNumber = frameNumber; + + if (_diff <= 0) { + // Time has expired, so remove the text and signal the designated action + remove(); + if (_action) + _action->signal(); + } + } + } +} + +/*--------------------------------------------------------------------------*/ + +BF_Scene109::BF_Scene109(): GameScene() { +} + +void BF_Scene109::postInit(SceneObjectList *OwnerList) { + GameScene::postInit(OwnerList); + loadScene(999); + + _protaginist2.postInit(); + _protaginist2.setVisage(119); + _protaginist2.setFrame(11); + _protaginist2.setFrame2(133); + _protaginist2.setPosition(Common::Point(165, 124)); + _protaginist2.hide(); + + _protaginist1.postInit(); + _protaginist1.setVisage(118); + _protaginist1.setStrip(1); + _protaginist1.setFrame(8); + _protaginist1.setFrame2(132); + _protaginist1.setPosition(Common::Point(143, 125)); + _protaginist1.hide(); + + _bartender.postInit(); + _bartender.setVisage(121); + _bartender.setStrip(2); + _bartender.setFrame(1); + _bartender.setPriority(-1); + _bartender.setPosition(Common::Point(92, 64)); + _bartender.hide(); + + _object1.postInit(); + _object1.setVisage(121); + _object1.setStrip(6); + _object1.setFrame(1); + _object1.setPriority(-1); + _object1.setPosition(Common::Point(110, 64)); + _object1.hide(); + + _object6.postInit(); + _object6.setVisage(120); + _object6.setStrip(2); + _object6.setFrame(5); + _object6.setPriority(-1); + _object6.setPosition(Common::Point(127, 97)); + _object6.hide(); + + _object2.postInit(); + _object2.setVisage(121); + _object2.setStrip(5); + _object2.setFrame(1); + _object2.setPriority(-1); + _object2.setPosition(Common::Point(104, 64)); + _object2.hide(); + + _object9.postInit(); + _object9.setVisage(115); + _object9.setStrip(4); + _object9.setFrame(1); + _object9.setPosition(Common::Point(262, 29)); + _object9.hide(); + + _object5.postInit(); + _object5.hide(); + + _object7.postInit(); + _object7.hide(); + + _object10.postInit(); + _object10.hide(); + + BF_GLOBALS._player.disableControl(); + setAction(&_action1); +} + +void BF_Scene109::signal() { + if (_sceneMode == 1) { + BF_GLOBALS._scenePalette.clearListeners(); + BF_GLOBALS._sceneManager.changeScene(110); + } +} + } // End of namespace tSage diff --git a/engines/tsage/blue_force/blueforce_scenes1.h b/engines/tsage/blue_force/blueforce_scenes1.h index 16d327fe9f..b3d16ab878 100644 --- a/engines/tsage/blue_force/blueforce_scenes1.h +++ b/engines/tsage/blue_force/blueforce_scenes1.h @@ -52,7 +52,6 @@ class BF_Scene100: public Scene { }; class Action2: public ActionExt { public: - virtual Common::String getClassName() { return "BF100Action2"; } virtual void signal(); }; public: @@ -68,6 +67,52 @@ public: virtual void signal(); }; +class BF_Scene109: public GameScene { + /* Actions */ + class Action1: public Action { + public: + virtual void signal(); + }; + class Action2: public Action { + public: + virtual void signal(); + }; + class Action3: public Action { + public: + virtual void signal(); + }; + + /* Texts */ + class Text: public SceneText { + public: + Action *_action; + uint32 _frameNumber; + int _diff; + public: + Text(); + void setup(const Common::String &msg, Action *action); + + virtual Common::String getClassName() { return "BF109Text"; } + virtual void synchronize(Serializer &s); + virtual void dispatch(); + }; +public: + SequenceManager _sequenceManager1, _sequenceManager2, _sequenceManager3; + SequenceManager _sequenceManager4, _sequenceManager5, _sequenceManager6; + SequenceManager _sequenceManager7, _sequenceManager8; + SceneObject _object1, _object2, _protaginist2, _protaginist1, _object5; + SceneObject _object6, _object7, _bartender, _object9, _object10; + Text _text; + BlueAnimatedSpeaker _speaker; + Action1 _action1; + Action _action2, _action3; +public: + BF_Scene109(); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + } // End of namespace tSage #endif |