diff options
author | Strangerke | 2011-10-20 00:34:40 +0200 |
---|---|---|
committer | Strangerke | 2011-10-20 00:34:40 +0200 |
commit | 1d3fa7402b5658db9becf27ffcd930ce18c122dd (patch) | |
tree | 4cd23fa10b1e1bfa233508c9a01a2a55a7c08c12 /engines/tsage/blue_force | |
parent | c39e45ff64cde87df04c06e70e02f2c43d1a9136 (diff) | |
download | scummvm-rg350-1d3fa7402b5658db9becf27ffcd930ce18c122dd.tar.gz scummvm-rg350-1d3fa7402b5658db9becf27ffcd930ce18c122dd.tar.bz2 scummvm-rg350-1d3fa7402b5658db9becf27ffcd930ce18c122dd.zip |
TSAGE: Blue Force - Move identical intro Text classes to common game logic
Diffstat (limited to 'engines/tsage/blue_force')
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.cpp | 51 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.h | 14 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes1.cpp | 155 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes1.h | 48 |
4 files changed, 68 insertions, 200 deletions
diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index c461f45d36..48512c774a 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -1474,6 +1474,57 @@ void SceneMessage::clear() { g_globals->_sceneManager._hasPalette = true; } +IntroSceneText::IntroSceneText(): SceneText() { + _action = NULL; + _frameNumber = 0; + _diff = 0; +} + +void IntroSceneText::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 IntroSceneText::synchronize(Serializer &s) { + SceneText::synchronize(s); + SYNC_POINTER(_action); + s.syncAsUint32LE(_frameNumber); + s.syncAsSint16LE(_diff); +} + +void IntroSceneText::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(); + } + } + } +} + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h index ee5f153cfa..d3cff57bd2 100644 --- a/engines/tsage/blue_force/blueforce_logic.h +++ b/engines/tsage/blue_force/blueforce_logic.h @@ -371,6 +371,20 @@ public: virtual void process(Event &event); }; +class IntroSceneText: public SceneText { +public: + Action *_action; + uint32 _frameNumber; + int _diff; +public: + IntroSceneText(); + void setup(const Common::String &msg, Action *action); + + virtual Common::String getClassName() { return "BFIntroText"; } + virtual void synchronize(Serializer &s); + virtual void dispatch(); +}; + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_scenes1.cpp b/engines/tsage/blue_force/blueforce_scenes1.cpp index 6fd2f075de..6361e4e708 100644 --- a/engines/tsage/blue_force/blueforce_scenes1.cpp +++ b/engines/tsage/blue_force/blueforce_scenes1.cpp @@ -299,59 +299,6 @@ void Scene109::Action3::signal() { /*--------------------------------------------------------------------------*/ -Scene109::Text::Text(): SceneText() { - _action = NULL; - _frameNumber = 0; - _diff = 0; -} - -void 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 Scene109::Text::synchronize(Serializer &s) { - SceneText::synchronize(s); - SYNC_POINTER(_action); - s.syncAsUint32LE(_frameNumber); - s.syncAsSint16LE(_diff); -} - -void 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(); - } - } - } -} - -/*--------------------------------------------------------------------------*/ - Scene109::Scene109(): PalettedScene() { } @@ -2371,57 +2318,6 @@ void Scene140::Action1::signal() { } } -Scene140::Text::Text(): SceneText() { - _action = NULL; - _frameNumber = 0; - _diff = 0; -} - -void Scene140::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 Scene140::Text::synchronize(Serializer &s) { - SceneText::synchronize(s); - SYNC_POINTER(_action); - s.syncAsUint32LE(_frameNumber); - s.syncAsSint16LE(_diff); -} - -void Scene140::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(); - } - } - } -} - void Scene140::postInit(SceneObjectList *OwnerList) { SceneExt::postInit(); loadScene(999); @@ -2776,57 +2672,6 @@ void Scene160::Action3::signal() { } } -Scene160::Text::Text(): SceneText() { - _action = NULL; - _frameNumber = 0; - _diff = 0; -} - -void Scene160::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 Scene160::Text::synchronize(Serializer &s) { - SceneText::synchronize(s); - SYNC_POINTER(_action); - s.syncAsUint32LE(_frameNumber); - s.syncAsSint16LE(_diff); -} - -void Scene160::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(); - } - } - } -} - void Scene160::postInit(SceneObjectList *OwnerList) { SceneExt::postInit(); loadScene(160); diff --git a/engines/tsage/blue_force/blueforce_scenes1.h b/engines/tsage/blue_force/blueforce_scenes1.h index 5a621cde26..bdf414ec9b 100644 --- a/engines/tsage/blue_force/blueforce_scenes1.h +++ b/engines/tsage/blue_force/blueforce_scenes1.h @@ -95,27 +95,13 @@ class Scene109: public PalettedScene { 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 _drunk, _object7, _bartender, _object9, _object10; - Text _text; + IntroSceneText _text; Action1 _action1; Action _action2, _action3; public: @@ -361,26 +347,12 @@ class Scene140: public SceneExt { 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 "BF140Text"; } - virtual void synchronize(Serializer &s); - virtual void dispatch(); - }; public: Action1 _action1; ASoundExt _soundExt1; NamedObject _object1; NamedObject _object2; - Text _text; + IntroSceneText _text; void postInit(SceneObjectList *OwnerList); }; @@ -413,27 +385,13 @@ class Scene160: public SceneExt { 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 "BF160Text"; } - virtual void synchronize(Serializer &s); - virtual void dispatch(); - }; public: NamedObject _flag, _kid, _kidBody, _leftOfficer, _grandma, _rightOfficer; ASound _sound1; Action1 _action1; Action2 _action2; Action3 _action3; - Text _text; + IntroSceneText _text; void postInit(SceneObjectList *OwnerList); }; |