aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/mads/mads.cpp4
-rw-r--r--engines/mads/mads.h1
-rw-r--r--engines/mads/nebular/nebular_scenes.cpp3
-rw-r--r--engines/mads/nebular/nebular_scenes.h1
-rw-r--r--engines/mads/nebular/nebular_scenes1.cpp52
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