From 0db7c488ead2eefbe029ea6bd09307fda0ba477a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 28 Oct 2015 12:29:46 +0100 Subject: MADS: Phantom: Add scene 305 --- engines/mads/phantom/phantom_scenes.cpp | 2 +- engines/mads/phantom/phantom_scenes3.cpp | 125 +++++++++++++++++++++++++++++++ engines/mads/phantom/phantom_scenes3.h | 22 ++++++ 3 files changed, 148 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/mads/phantom/phantom_scenes.cpp b/engines/mads/phantom/phantom_scenes.cpp index 43c7930a4c..43478e2726 100644 --- a/engines/mads/phantom/phantom_scenes.cpp +++ b/engines/mads/phantom/phantom_scenes.cpp @@ -105,7 +105,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 304: // chandelier return new Scene304(vm); case 305: // chandelier fight, phantom closeup - return new DummyScene(vm); // TODO + return new Scene305(vm); case 306: // chandelier #2 return new DummyScene(vm); // TODO case 307: // catwalk #3 above stage diff --git a/engines/mads/phantom/phantom_scenes3.cpp b/engines/mads/phantom/phantom_scenes3.cpp index 078e009eb0..c82e31ff55 100644 --- a/engines/mads/phantom/phantom_scenes3.cpp +++ b/engines/mads/phantom/phantom_scenes3.cpp @@ -1402,5 +1402,130 @@ void Scene304::handleFightAnimation() { /*------------------------------------------------------------------------*/ +Scene305::Scene305(MADSEngine *vm) : Scene3xx(vm) { + _anim0ActvFl = false; + _anim1ActvFl = false; + _skipFl = false; + _unmaskFl = false; + + _unmaskFrame = -1; +} + +void Scene305::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + s.syncAsByte(_anim0ActvFl); + s.syncAsByte(_anim1ActvFl); + s.syncAsByte(_skipFl); + s.syncAsByte(_unmaskFl); + + s.syncAsSint16LE(_unmaskFrame); +} + +void Scene305::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene305::enter() { + _unmaskFl = false; + _skipFl = false; + _game._player._visible = false; + _anim0ActvFl = false; + _anim1ActvFl = false; + + _scene->_userInterface.setup(kInputLimitedSentences); + _scene->loadSpeech(5); + _game.loadQuoteSet(0x64, 0x65, 0); + + if (_game._player._playerPos.x == 100) { + _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('r', 1), 60); + _scene->_hotspots.activate(NOUN_MASK, false); + _anim1ActvFl = true; + } else if (_game._player._playerPos.x == 200) { + _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('u', 1), 0); + _anim0ActvFl = true; + _scene->_hotspots.activate(NOUN_CANE, false); + } + + sceneEntrySound(); +} + +void Scene305::step() { + if (_anim0ActvFl) + handle_animation_unmask (); + + if (_anim1ActvFl) { + if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 53) + _game._player._stepEnabled = false; + + if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 54 && !_skipFl) { + _scene->playSpeech(5); + _skipFl = true; + } + } + + if (_game._trigger == 60) { + _globals[kPlayerScore] -= 10; + _scene->_userInterface.noInventoryAnim(); + // CHECKME: Not sure about the next function call + _scene->_userInterface.refresh(); + _scene->_nextSceneId = 303; + } +} + +void Scene305::actions() { + if (_action.isAction(VERB_PUSH, NOUN_CANE)) { + _scene->_nextSceneId = 304; + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, NOUN_MASK)) { + _unmaskFl = true; + _game._player._stepEnabled = false; + _action._inProgress = false; + } +} + +void Scene305::preActions() { +} + +void Scene305::handle_animation_unmask() { + if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == _unmaskFrame) + return; + + _unmaskFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame(); + int resetFrame = -1; + + switch (_unmaskFrame) { + case 25: + if (!_unmaskFl) + resetFrame = 0; + + break; + + case 60: + _scene->playSpeech(10); + _scene->_kernelMessages.add(Common::Point(176, 53), 0x1110, 0, 0, 360, _game.getQuote(0x64)); + _scene->_kernelMessages.add(Common::Point(176, 68), 0x1110, 0, 0, 360, _game.getQuote(0x65)); + break; + + case 95: + _scene->_nextSceneId = 306; + break; + + default: + break; + } + + if (resetFrame >= 0) { + _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame); + _unmaskFrame = resetFrame; + } +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Phantom } // End of namespace MADS diff --git a/engines/mads/phantom/phantom_scenes3.h b/engines/mads/phantom/phantom_scenes3.h index 29fb2040cc..8b69900bb0 100644 --- a/engines/mads/phantom/phantom_scenes3.h +++ b/engines/mads/phantom/phantom_scenes3.h @@ -131,6 +131,28 @@ public: virtual void actions(); }; +class Scene305 : public Scene3xx { +private: + bool _anim0ActvFl; + bool _anim1ActvFl; + bool _skipFl; + bool _unmaskFl; + + int _unmaskFrame; + + void handle_animation_unmask(); + +public: + Scene305(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); +}; + } // End of namespace Phantom } // End of namespace MADS -- cgit v1.2.3