diff options
author | Paul Gilbert | 2014-03-21 23:36:56 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-03-21 23:36:56 -0400 |
commit | 202d4ad4f1980bc7367e22ad1061b7b270991692 (patch) | |
tree | 7e40063dc7f574a34bed6bfc5880a94c1a28b86f | |
parent | 2090987b81615af4cda189a462bc04cd22d7a180 (diff) | |
download | scummvm-rg350-202d4ad4f1980bc7367e22ad1061b7b270991692.tar.gz scummvm-rg350-202d4ad4f1980bc7367e22ad1061b7b270991692.tar.bz2 scummvm-rg350-202d4ad4f1980bc7367e22ad1061b7b270991692.zip |
MADS: Implemented more of scene 103 code
-rw-r--r-- | engines/mads/mads.cpp | 4 | ||||
-rw-r--r-- | engines/mads/mads.h | 1 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes.cpp | 3 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes.h | 1 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes1.cpp | 52 |
5 files changed, 59 insertions, 2 deletions
diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 781fd7d01d..d6cd901a4c 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -107,4 +107,8 @@ int MADSEngine::getRandomNumber(int maxNumber) { return _randomSource.getRandomNumber(maxNumber); } +int MADSEngine::hypotenuse(int xv, int yv) { + return (int)sqrt((double)(xv * xv + yv * yv)); +} + } // End of namespace MADS diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 3152e84f25..e9da307bbf 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -116,6 +116,7 @@ public: uint32 getGameFeatures() const; int getRandomNumber(int maxNumber); + int hypotenuse(int xv, int yv); }; } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index b9d244dd11..42a44a2b51 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -67,7 +67,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { NebularScene::NebularScene(MADSEngine *vm) : SceneLogic(vm), _globals(static_cast<GameNebular *>(vm->_game)->_globals), - _game(*static_cast<GameNebular *>(vm->_game)) { + _game(*static_cast<GameNebular *>(vm->_game)), + _action(vm->_game->_scene._action) { } Common::String NebularScene::formAnimName(char sepChar, int suffixNum) { diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 13e3597335..6b2b101c62 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -106,6 +106,7 @@ class NebularScene : public SceneLogic { protected: Globals &_globals; GameNebular &_game; + MADSAction &_action; /** * Forms an animation resoucre name diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 86cac3b8e4..1ee1990cdd 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -150,7 +150,7 @@ void Scene103::enter() { _globals._spriteIndexes[2], false, 6, 0, 0, 25); _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_FRAME_INDEX, 2, 72); _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle( - _globals._spriteIndexes[3], _scene, false, 8); + _globals._spriteIndexes[3], false, 6, 0, 1, 37); _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_FRAME_INDEX, 2, 73); _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle( @@ -212,6 +212,45 @@ void Scene103::enter() { } void Scene103::step() { + Common::Point pt; + int dist; + + switch (_vm->_game->_abortTimers) { + case 70: + _vm->_game->_player._stepEnabled = true; + break; + + case 72: + pt = _vm->_game->_player._playerPos; + dist = _vm->hypotenuse(pt.x - 58, pt.y - 93); + _vm->_sound->command(27, (dist * -128 / 378) + 127); + break; + + case 73: + pt = _vm->_game->_player._playerPos; + dist = _vm->hypotenuse(pt.x - 266, pt.y - 81); + _vm->_sound->command(27, (dist * -127 / 378) + 127); + break; + + default: + break; + } + + if (_globals._frameTime <= _scene->_frameStartTime) { + pt = _vm->_game->_player._playerPos; + int dist = _vm->hypotenuse(pt.x - 79, pt.y - 137); + _vm->_sound->command(29, (dist * -127 / 378) + 127); + + pt = _vm->_game->_player._playerPos; + dist = _vm->hypotenuse(pt.x - 69, pt.y - 80); + _vm->_sound->command(30, (dist * -127 / 378) + 127); + + pt = _vm->_game->_player._playerPos; + dist = _vm->hypotenuse(pt.x - 266, pt.y - 138); + _vm->_sound->command(32, (dist * -127 / 378) + 127); + + _globals._frameTime = _scene->_frameStartTime + _vm->_game->_player._ticksAmount; + } } void Scene103::preActions() { @@ -221,6 +260,17 @@ void Scene103::actions() { } void Scene103::postActions() { + if (_action.isAction(27) && !_action.isAction(13)) { + Dialog::show(0x2841); + _action._inProgress = false; + } else { + if (_action.isAction(7, 85, 144)) { + Common::String msg = _game.getQuote(73); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, + 34, 0, 120, msg); + _action._inProgress = false; + } + } } } // End of namespace Nebular |