aboutsummaryrefslogtreecommitdiff
path: root/engines/mads/nebular
diff options
context:
space:
mode:
authorPaul Gilbert2014-03-15 17:38:44 -0400
committerPaul Gilbert2014-03-15 17:38:44 -0400
commit10124f6806150aad409f6db9a6c7a60afcb44872 (patch)
tree3e9b0f09e6d72474e1a4721994c17f14351e4185 /engines/mads/nebular
parente00a1b88ca7500516d78f4bad515b5a558af82a6 (diff)
downloadscummvm-rg350-10124f6806150aad409f6db9a6c7a60afcb44872.tar.gz
scummvm-rg350-10124f6806150aad409f6db9a6c7a60afcb44872.tar.bz2
scummvm-rg350-10124f6806150aad409f6db9a6c7a60afcb44872.zip
MADS: Implemented scene 103 setup and needed support methods
Diffstat (limited to 'engines/mads/nebular')
-rw-r--r--engines/mads/nebular/globals_nebular.cpp4
-rw-r--r--engines/mads/nebular/globals_nebular.h4
-rw-r--r--engines/mads/nebular/nebular_scenes.cpp34
-rw-r--r--engines/mads/nebular/nebular_scenes.h17
-rw-r--r--engines/mads/nebular/nebular_scenes1.cpp142
-rw-r--r--engines/mads/nebular/nebular_scenes1.h31
-rw-r--r--engines/mads/nebular/nebular_scenes8.cpp77
7 files changed, 264 insertions, 45 deletions
diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp
index 37ebf5f8d6..3c16cd180b 100644
--- a/engines/mads/nebular/globals_nebular.cpp
+++ b/engines/mads/nebular/globals_nebular.cpp
@@ -34,8 +34,8 @@ Globals::Globals() {
_spriteIndexes.resize(30);
// Initialise game flags
- _chairHotspotIndex = 0;
- _v1 = 0;
+ _v0 = 0;
+ _frameTime = 0;
_v2 = 0;
_v3 = 0;
_v4 = 0;
diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h
index 31340446d2..b2a1f0d497 100644
--- a/engines/mads/nebular/globals_nebular.h
+++ b/engines/mads/nebular/globals_nebular.h
@@ -37,8 +37,8 @@ private:
public:
Common::Array<int> _spriteIndexes;
- int _chairHotspotIndex;
- int _v1;
+ int _v0;
+ uint32 _frameTime;
int _v2;
int _v3;
int _v4;
diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp
index 3587822f19..6644d957ed 100644
--- a/engines/mads/nebular/nebular_scenes.cpp
+++ b/engines/mads/nebular/nebular_scenes.cpp
@@ -61,6 +61,40 @@ Common::String NebularScene::formAnimName(char sepChar, int suffixNum) {
EXT_NONE, "");
}
+void NebularScene::setPlayerSpritesPrefix() {
+ _vm->_sound->command(5);
+ Common::String oldName = _game._player._spritesPrefix;
+ if (_scene->_nextSceneId <= 103 || _scene->_nextSceneId == 111) {
+ if (_globals[0] == SEX_FEMALE) {
+ _game._player._spritesPrefix = "ROX";
+ } else {
+ _game._player._spritesPrefix = "RXM";
+ _globals[0] = SEX_MALE;
+ }
+ } else if (_scene->_nextSceneId <= 110) {
+ _game._player._spritesPrefix = "RXSW";
+ _globals[0] = SEX_UNKNOWN;
+ } else if (_scene->_nextSceneId == 112) {
+ _game._player._spritesPrefix = "";
+ }
+
+ if (oldName == _game._player._spritesPrefix)
+ _game._player._spritesChanged = true;
+ if (_scene->_nextSceneId == 105 || (_scene->_nextSceneId == 109 && _globals[15])) {
+ _game._player._spritesChanged = true;
+ _game._v3 = 0;
+ }
+
+ _game._player._unk3 = 0;
+ _vm->_palette->setEntry(16, 10, 63, 63);
+ _vm->_palette->setEntry(17, 10, 45, 45);
+}
+
+void NebularScene::setAAName() {
+ int idx = (_scene->_nextSceneId > 103 && _scene->_nextSceneId < 112) ? 1 : 0;
+ _game._aaName = Resources::formatAAName(idx);
+}
+
/*------------------------------------------------------------------------*/
void SceneInfoNebular::loadCodes(MSurface &depthSurface) {
diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h
index 5ac708d398..4da8b49996 100644
--- a/engines/mads/nebular/nebular_scenes.h
+++ b/engines/mads/nebular/nebular_scenes.h
@@ -35,7 +35,7 @@ namespace MADS {
namespace Nebular {
enum {
- SEX_MALE = 0, SEX_FEMALE = 2
+ SEX_MALE = 0, SEX_UNKNOWN = 1, SEX_FEMALE = 2
};
enum Noun {
@@ -103,6 +103,21 @@ protected:
* Forms an animation resoucre name
*/
Common::String formAnimName(char sepChar, int suffixNum);
+
+ /**
+ *Sets the AA file to use for the scene
+ */
+ void setAAName();
+
+ /**
+ * Updates the prefix used for getting player sprites for the scene
+ */
+ void setPlayerSpritesPrefix();
+
+ /**
+ * Plays appropriate sound for entering varous rooms
+ */
+ void lowRoomsEntrySound();
public:
/**
* Constructor
diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp
index 1de4eca509..d684f02c84 100644
--- a/engines/mads/nebular/nebular_scenes1.cpp
+++ b/engines/mads/nebular/nebular_scenes1.cpp
@@ -30,6 +30,41 @@ namespace MADS {
namespace Nebular {
+void Scene1xx::sceneEntrySound() {
+ if (_vm->_musicFlag) {
+ switch (_scene->_nextSceneId) {
+ case 101:
+ _vm->_sound->command(11);
+ break;
+ case 102:
+ _vm->_sound->command(12);
+ break;
+ case 103:
+ _vm->_sound->command(3);
+ _vm->_sound->command(25);
+ break;
+ case 109:
+ _vm->_sound->command(13);
+ break;
+ case 110:
+ _vm->_sound->command(10);
+ break;
+ case 111:
+ _vm->_sound->command(3);
+ break;
+ case 112:
+ _vm->_sound->command(15);
+ break;
+ default:
+ if (_scene->_priorSceneId < 104 || _scene->_priorSceneId > 108)
+ _vm->_sound->command(10);
+ break;
+ }
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
void Scene101::setup() {
}
@@ -48,6 +83,113 @@ void Scene101::actions() {
void Scene101::postActions() {
}
+/*------------------------------------------------------------------------*/
+
+void Scene103::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene103::enter() {
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 2));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 3));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 4));
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 5));
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', -1));
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('h', -1));
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('m', -1));
+ _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('t', -1));
+ _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('r', -1));
+ _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('c', -1));
+
+ _globals._spriteIndexes[12] = _scene->_sprites.addSprites("*RXMBD_2");
+ _globals._spriteIndexes[13] = _scene->_sprites.addSprites("*RXMRD_3");
+ _globals._spriteIndexes[15] = _scene->_sequences.addSpriteCycle(
+ _globals._spriteIndexes[0], false, 7, 0, 1, 0);
+ _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(
+ _globals._spriteIndexes[1], false, 6, 0, 2, 0);
+ _scene->_sequences.setDepth(_globals._spriteIndexes[16], 0);
+ _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(
+ _globals._spriteIndexes[2], false, 6, 0, 0, 25);
+ _globals._spriteIndexes[18] = _scene->_sequences.addSubEntry(
+ _globals._spriteIndexes[17], SM_FRAME_INDEX, 2, 72);
+ _globals._spriteIndexes[19] = _scene->_sequences.addSubEntry(
+ _globals._spriteIndexes[17], SM_FRAME_INDEX, 2, 72);
+ int idx = _scene->_sequences.addSubEntry(_globals._spriteIndexes[17],
+ SM_FRAME_INDEX, 2, 73);
+
+ _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(
+ _globals._spriteIndexes[8], false, 8);
+ _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(
+ _globals._spriteIndexes[7], false, 6);
+ _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(
+ _globals._spriteIndexes[4], false, 6);
+ _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(
+ _globals._spriteIndexes[5], false, 6);
+
+ if (_game._objects.isInRoom(OBJ_TIMER_MODULE)) {
+ _vm->_game->_scene._hotspots.activate(371, false);
+ } else {
+ _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(
+ _globals._spriteIndexes[11], false, 6);
+ }
+
+ if (_game._objects.isInRoom(OBJ_REBREATHER)) {
+ _vm->_game->_scene._hotspots.activate(289, false);
+ } else {
+ _globals._spriteIndexes[25] = _scene->_sequences.addSpriteCycle(
+ _globals._spriteIndexes[10], false, 6);
+ }
+
+ if (_globals[11]) {
+ _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle(
+ _globals._spriteIndexes[9], false, 6);
+ _scene->_sequences.setAnimRange(_globals._spriteIndexes[24], -2, -2);
+ _scene->_hotspots.activate(362, false);
+ }
+
+ if (_scene->_priorSceneId != -2)
+ _game._player._playerPos = Common::Point(237, 74);
+ if (_scene->_priorSceneId == 102) {
+ _game._player._stepEnabled = false;
+
+ _globals._spriteIndexes[21] = _scene->_sequences.addReverseSpriteCycle(
+ _globals._spriteIndexes[6], false, 6, 1, 0, 0);
+ _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 70);
+ }
+
+ sceneEntrySound();
+ _vm->_game->loadQuoteSet(70, 51, 71, 7, 73, 0);
+
+ if (!_game._visitedScenes._sceneRevisited) {
+ int msgIndex = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110,
+ 34, 0, 120, _game.getQuote(70));
+ _scene->_kernelMessages.setQuoted(msgIndex, 4, true);
+ }
+
+ if (_scene->_priorSceneId == 102)
+ _vm->_sound->command(20);
+
+ _vm->_palette->setEntry(252, 63, 63, 10);
+ _vm->_palette->setEntry(253, 45, 45, 10);
+ _globals._v0 = 0;
+ _globals._frameTime = _scene->_frameStartTime;
+}
+
+void Scene103::step() {
+}
+
+void Scene103::preActions() {
+}
+
+void Scene103::actions() {
+}
+
+void Scene103::postActions() {
+}
+
} // End of namespace Nebular
} // End of namespace MADS
diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h
index da6a2f0903..6077e1e797 100644
--- a/engines/mads/nebular/nebular_scenes1.h
+++ b/engines/mads/nebular/nebular_scenes1.h
@@ -32,9 +32,36 @@ namespace MADS {
namespace Nebular {
-class Scene101: public NebularScene {
+class Scene1xx : protected NebularScene {
+protected:
+ /**
+ * Plays an appropriate sound when entering a scene
+ */
+ void sceneEntrySound();
public:
- Scene101(MADSEngine *vm) : NebularScene(vm) {}
+ Scene1xx(MADSEngine *vm) : NebularScene(vm) {}
+};
+
+class Scene101: public Scene1xx {
+public:
+ Scene101(MADSEngine *vm) : Scene1xx(vm) {}
+
+ virtual void setup();
+
+ virtual void enter();
+
+ virtual void step();
+
+ virtual void preActions();
+
+ virtual void actions();
+
+ virtual void postActions();
+};
+
+class Scene103 : public Scene1xx {
+public:
+ Scene103(MADSEngine *vm) : Scene1xx(vm) {}
virtual void setup();
diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp
index 2d123660bd..7bc1af9298 100644
--- a/engines/mads/nebular/nebular_scenes8.cpp
+++ b/engines/mads/nebular/nebular_scenes8.cpp
@@ -80,11 +80,13 @@ void Scene804::setup() {
}
void Scene804::enter() {
- _globals._chairHotspotIndex = 0;
- _globals._v1 = _globals._v2 = 0;
- _globals._v3 = _globals._v4 = 0;
+ _globals._frameTime = 0;
+ _globals._v2 = 0;
+ _globals._v3 = 0;
+ _globals._v4 = 0;
_globals._v5 = -1;
- _globals._v6 = _globals._v7 = 0;
+ _globals._v6 = 0;
+ _globals._v7 = 0;
_globals._v8 = 0;
if (_globals[5]) {
// Copy protection failed
@@ -92,43 +94,43 @@ void Scene804::enter() {
_globals[164] = 0;
}
- _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 0));
- _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 1));
- _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 2));
- _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 3));
- _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('x', 4));
- _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('f', 1));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 1));
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('x', 2));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 3));
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('x', 4));
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('f', 1));
_game.loadQuoteSet(791, 0);
if (_globals[165]) {
if (_globals[164]) {
- _globals._spriteIndexes[19] = _scene->_sequences.startCycle(
- _globals._spriteIndexes[4], 0, 1);
+ _globals._spriteIndexes[20] = _scene->_sequences.startCycle(
+ _globals._spriteIndexes[5], 0, 1);
_scene->_sequences.addTimer(60, 100);
} else {
- _globals._spriteIndexes[20] = _scene->_sequences.startCycle(
- _globals._spriteIndexes[5], false, 1);
- _globals._spriteIndexes[21] = _scene->_sequences.startReverseCycle(
- _globals._spriteIndexes[6], false, 4, 0, 0, 0);
+ _globals._spriteIndexes[21] = _scene->_sequences.startCycle(
+ _globals._spriteIndexes[6], false, 1);
+ _globals._spriteIndexes[22] = _scene->_sequences.startReverseCycle(
+ _globals._spriteIndexes[7], false, 4, 0, 0, 0);
_scene->_sequences.addTimer(160, 70);
_game._player._stepEnabled = false;
}
} else {
if (_globals[167] == 0) {
- _globals._spriteIndexes[22] = _scene->_sequences.startCycle(
- _globals._spriteIndexes[7], false, 1);
+ _globals._spriteIndexes[23] = _scene->_sequences.startCycle(
+ _globals._spriteIndexes[8], false, 1);
}
if (_globals[164] == 0) {
- _globals._spriteIndexes[22] = _scene->_sequences.startCycle(
- _globals._spriteIndexes[18], false, 1);
+ _globals._spriteIndexes[23] = _scene->_sequences.startCycle(
+ _globals._spriteIndexes[19], false, 1);
}
- _globals._spriteIndexes[0] = _scene->_sequences.startCycle(
- _globals._spriteIndexes[0], false, 1);
- _scene->_sequences.setMsgPosition(_globals._spriteIndexes[15], Common::Point(133, 139));
- _scene->_sequences.setDepth(_globals._spriteIndexes[15], 8);
+ _globals._spriteIndexes[1] = _scene->_sequences.startCycle(
+ _globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setMsgPosition(_globals._spriteIndexes[16], Common::Point(133, 139));
+ _scene->_sequences.setDepth(_globals._spriteIndexes[16], 8);
}
_scene->loadAnimation(Resources::formatName(804, 'r', 1, EXT_AA, ""));
@@ -142,24 +144,23 @@ void Scene804::enter() {
}
void Scene804::step() {
- if (_globals._chairHotspotIndex) {
+ if (_globals._frameTime) {
if (_scene->_activeAnimation->getCurrentFrame() == 36 && !_globals._v3) {
- _scene->_sequences.remove(_globals._spriteIndexes[15]);
+ _scene->_sequences.remove(_globals._spriteIndexes[16]);
_globals._v3 = -1;
}
if (_scene->_activeAnimation->getCurrentFrame() == 39) {
_globals._v2 = 0;
- if (_globals._v1 == 3)
+ if ((_globals._frameTime / 256) == 3)
_scene->_sequences.addTimer(130, 120);
}
if (!_globals._v2) {
- ++_globals._v1;
+ _globals._frameTime += 0x100;
_globals._v2 = -1;
- if (_globals._v1 >= 4) {
- _globals._chairHotspotIndex = 0;
- _globals._v1 = 0;
+ if ((_globals._frameTime / 256) >= 4) {
+ _globals._frameTime = 0;
_game._player._stepEnabled = true;
} else {
_globals._v5 = 34;
@@ -167,11 +168,11 @@ void Scene804::step() {
}
} else {
if (_globals._v3 && _globals._v2 && _scene->_activeAnimation->getCurrentFrame() == 39) {
- _globals._spriteIndexes[15] = _scene->_sequences.startCycle(
- _globals._spriteIndexes[0], false, 1);
- _scene->_sequences.setMsgPosition(_globals._spriteIndexes[15],
+ _globals._spriteIndexes[16] = _scene->_sequences.startCycle(
+ _globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setMsgPosition(_globals._spriteIndexes[16],
Common::Point(133, 139));
- _scene->_sequences.setDepth(_globals._spriteIndexes[15], 8);
+ _scene->_sequences.setDepth(_globals._spriteIndexes[16], 8);
_globals._v3 = 0;
}
@@ -183,7 +184,7 @@ void Scene804::step() {
if (_game._abortTimers == 70)
_globals._v5 = 42;
if (_scene->_activeAnimation->getCurrentFrame() == 65)
- _scene->_sequences.remove(_globals._spriteIndexes[21]);
+ _scene->_sequences.remove(_globals._spriteIndexes[22]);
switch (_game._storyMode) {
case STORYMODE_NAUGHTY:
@@ -213,7 +214,7 @@ void Scene804::step() {
if (_scene->_activeAnimation->getCurrentFrame() == 34) {
_globals._v5 = 36;
- _scene->_sequences.remove(_globals._spriteIndexes[15]);
+ _scene->_sequences.remove(_globals._spriteIndexes[16]);
}
if (_scene->_activeAnimation->getCurrentFrame() == 37) {
_globals._v5 = 36;
@@ -225,7 +226,7 @@ void Scene804::step() {
_scene->_nextSceneId = 803;
if (_scene->_activeAnimation->getCurrentFrame() == 7 && !_globals[164]) {
- _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1);
+ _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1);
_scene->_sequences.addTimer(20, 110);
_globals[164] = -1;
}