aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/mads/game.h5
-rw-r--r--engines/mads/game_data.cpp62
-rw-r--r--engines/mads/game_data.h52
-rw-r--r--engines/mads/hotspots.cpp6
-rw-r--r--engines/mads/hotspots.h4
-rw-r--r--engines/mads/inventory.cpp92
-rw-r--r--engines/mads/inventory.h87
-rw-r--r--engines/mads/messages.cpp23
-rw-r--r--engines/mads/messages.h1
-rw-r--r--engines/mads/module.mk2
-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
-rw-r--r--engines/mads/palette.cpp6
-rw-r--r--engines/mads/scene.h2
-rw-r--r--engines/mads/sequence.cpp15
-rw-r--r--engines/mads/sequence.h7
21 files changed, 515 insertions, 158 deletions
diff --git a/engines/mads/game.h b/engines/mads/game.h
index 01f23605d5..8e1559ed21 100644
--- a/engines/mads/game.h
+++ b/engines/mads/game.h
@@ -27,6 +27,7 @@
#include "common/str-array.h"
#include "mads/scene.h"
#include "mads/game_data.h"
+#include "mads/inventory.h"
#include "mads/player.h"
namespace MADS {
@@ -64,9 +65,7 @@ protected:
int _saveSlot;
int _statusFlag;
SectionHandler *_sectionHandler;
- VisitedScenes _visitedScenes;
Common::StringArray _quotes;
- int _v3;
int _v5;
int _v6;
bool _updateSceneFlag;
@@ -117,9 +116,11 @@ public:
int _priorSectionNumber;
int _currentSectionNumber;
InventoryObjects _objects;
+ VisitedScenes _visitedScenes;
Scene _scene;
int _v1;
int _v2;
+ int _v3;
int _v4;
int _abortTimers;
int _abortTimers2;
diff --git a/engines/mads/game_data.cpp b/engines/mads/game_data.cpp
index cbc8f93a4b..0f41692e2c 100644
--- a/engines/mads/game_data.cpp
+++ b/engines/mads/game_data.cpp
@@ -31,7 +31,9 @@
namespace MADS {
void VisitedScenes::add(int sceneId) {
- if (!exists(sceneId))
+ _sceneRevisited = exists(sceneId);
+
+ if (!_sceneRevisited)
push_back(sceneId);
}
@@ -44,62 +46,4 @@ bool VisitedScenes::exists(int sceneId) {
return false;
}
-void InventoryObject::load(Common::SeekableReadStream &f) {
- _descId = f.readUint16LE();
- _roomNumber = f.readUint16LE();
- _article = f.readByte();
- _vocabCount = f.readByte();
-
- for (int i = 0; i < 3; ++i) {
- _vocabList[i]._actionFlags1 = f.readByte();
- _vocabList[i]._actionFlags2 = f.readByte();
- _vocabList[i]._vocabId = f.readUint16LE();
- }
-
- f.skip(4); // field12
- f.read(&_mutilateString[0], 10);
- f.skip(16);
-}
-
-/*------------------------------------------------------------------------*/
-
-void InventoryObjects::load() {
- File f("*OBJECTS.DAT");
-
- // Get the total numer of inventory objects
- int count = f.readUint16LE();
- reserve(count);
-
- // Read in each object
- for (int i = 0; i < count; ++i) {
- InventoryObject obj;
- obj.load(f);
- push_back(obj);
-
- // If it's for the player's inventory, add the index to the inventory list
- if (obj._roomNumber == PLAYER_INVENTORY) {
- _inventoryList.push_back(i);
- assert(_inventoryList.size() <= 32);
- }
- }
-}
-
-void InventoryObjects::setData(int objIndex, int id, const byte *p) {
- // TODO: This whole method seems weird. Check it out more thoroughly once
- // more of the engine is implemented
- for (int i = 0; i < (int)size(); ++i) {
- InventoryObject &obj = (*this)[i];
- if (obj._vocabList[0]._actionFlags1 <= i)
- break;
-
- if (obj._mutilateString[6 + i] == id) {
- (*this)[objIndex]._objFolder = p;
- }
- }
-}
-
-void InventoryObjects::setRoom(int objectId, int roomNumber) {
- warning("TODO: setObjectRoom");
-}
-
} // End of namespace MADS
diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h
index 56ab3665e3..7674beed81 100644
--- a/engines/mads/game_data.h
+++ b/engines/mads/game_data.h
@@ -34,6 +34,11 @@ class Game;
class VisitedScenes: public Common::Array<int> {
public:
/**
+ * Stores true when a previously visited scene is revisited
+ */
+ bool _sceneRevisited;
+
+ /**
* Returns true if a given Scene Id exists in the listed of previously visited scenes.
*/
bool exists(int sceneId);
@@ -44,53 +49,6 @@ public:
void add(int sceneId);
};
-class InventoryObject {
-public:
- int _descId;
- int _roomNumber;
- int _article;
- int _vocabCount;
- struct {
- int _actionFlags1;
- int _actionFlags2;
- int _vocabId;
- } _vocabList[3];
- char _mutilateString[10]; // ???
- const byte *_objFolder; // ???
-
- /**
- * Loads the data for a given object
- */
- void load(Common::SeekableReadStream &f);
-};
-
-class InventoryObjects: public Common::Array<InventoryObject> {
-private:
- MADSEngine *_vm;
-public:
- Common::Array<int> _inventoryList;
-
- /**
- * Constructor
- */
- InventoryObjects(MADSEngine *vm): _vm(vm) {}
-
- /**
- * Loads the game's object list
- */
- void load();
-
- /**
- * Set the associated data? pointer with an inventory object
- */
- void setData(int objIndex, int id, const byte *p);
-
- /**
- * Sets the room number
- */
- void setRoom(int objectId, int roomNumber);
-};
-
class SectionHandler {
protected:
MADSEngine *_vm;
diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp
index a3660dfd81..d754c47fe3 100644
--- a/engines/mads/hotspots.cpp
+++ b/engines/mads/hotspots.cpp
@@ -139,4 +139,10 @@ void DynamicHotspots::refresh() {
}
}
+/*------------------------------------------------------------------------*/
+
+void Hotspots::activate(int hotspotId, bool active) {
+ warning("TODO: Hotspots::activate");
+}
+
} // End of namespace MADS
diff --git a/engines/mads/hotspots.h b/engines/mads/hotspots.h
index acbc72d60d..0dcde1d14b 100644
--- a/engines/mads/hotspots.h
+++ b/engines/mads/hotspots.h
@@ -82,6 +82,10 @@ public:
Hotspot(Common::SeekableReadStream &f);
};
+class Hotspots : public Common::Array<Hotspot> {
+public:
+ void activate(int hotspotId, bool active);
+};
} // End of namespace MADS
diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp
new file mode 100644
index 0000000000..89eaaadb1b
--- /dev/null
+++ b/engines/mads/inventory.cpp
@@ -0,0 +1,92 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/scummsys.h"
+#include "mads/mads.h"
+#include "mads/inventory.h"
+
+namespace MADS {
+
+void InventoryObject::load(Common::SeekableReadStream &f) {
+ _descId = f.readUint16LE();
+ _roomNumber = f.readUint16LE();
+ _article = f.readByte();
+ _vocabCount = f.readByte();
+
+ for (int i = 0; i < 3; ++i) {
+ _vocabList[i]._actionFlags1 = f.readByte();
+ _vocabList[i]._actionFlags2 = f.readByte();
+ _vocabList[i]._vocabId = f.readUint16LE();
+ }
+
+ f.skip(4); // field12
+ f.read(&_mutilateString[0], 10);
+ f.skip(16);
+}
+
+/*------------------------------------------------------------------------*/
+
+void InventoryObjects::load() {
+ File f("*OBJECTS.DAT");
+
+ // Get the total numer of inventory objects
+ int count = f.readUint16LE();
+ reserve(count);
+
+ // Read in each object
+ for (int i = 0; i < count; ++i) {
+ InventoryObject obj;
+ obj.load(f);
+ push_back(obj);
+
+ // If it's for the player's inventory, add the index to the inventory list
+ if (obj._roomNumber == PLAYER_INVENTORY) {
+ _inventoryList.push_back(i);
+ assert(_inventoryList.size() <= 32);
+ }
+ }
+}
+
+void InventoryObjects::setData(int objIndex, int id, const byte *p) {
+ // TODO: This whole method seems weird. Check it out more thoroughly once
+ // more of the engine is implemented
+ for (int i = 0; i < (int)size(); ++i) {
+ InventoryObject &obj = (*this)[i];
+ if (obj._vocabList[0]._actionFlags1 <= i)
+ break;
+
+ if (obj._mutilateString[6 + i] == id) {
+ (*this)[objIndex]._objFolder = p;
+ }
+ }
+}
+
+void InventoryObjects::setRoom(int objectId, int roomNumber) {
+ warning("TODO: setObjectRoom");
+}
+
+bool InventoryObjects::isInRoom(int objectId) const {
+ return (*this)[objectId]._roomNumber == _vm->_game->_scene._currentSceneId;
+}
+
+
+} // End of namespace MADS
diff --git a/engines/mads/inventory.h b/engines/mads/inventory.h
new file mode 100644
index 0000000000..57ae43b059
--- /dev/null
+++ b/engines/mads/inventory.h
@@ -0,0 +1,87 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef MADS_INVENTORY_H
+#define MADS_INVENTORY_H
+
+#include "common/scummsys.h"
+#include "common/array.h"
+
+namespace MADS {
+
+class MADSEngine;
+
+class InventoryObject {
+public:
+ int _descId;
+ int _roomNumber;
+ int _article;
+ int _vocabCount;
+ struct {
+ int _actionFlags1;
+ int _actionFlags2;
+ int _vocabId;
+ } _vocabList[3];
+ char _mutilateString[10]; // ???
+ const byte *_objFolder; // ???
+
+ /**
+ * Loads the data for a given object
+ */
+ void load(Common::SeekableReadStream &f);
+};
+
+class InventoryObjects: public Common::Array<InventoryObject> {
+private:
+ MADSEngine *_vm;
+public:
+ Common::Array<int> _inventoryList;
+
+ /**
+ * Constructor
+ */
+ InventoryObjects(MADSEngine *vm): _vm(vm) {}
+
+ /**
+ * Loads the game's object list
+ */
+ void load();
+
+ /**
+ * Set the associated data? pointer with an inventory object
+ */
+ void setData(int objIndex, int id, const byte *p);
+
+ /**
+ * Sets the room number
+ */
+ void setRoom(int objectId, int roomNumber);
+
+ /**
+ * Returns true if a given object is in the player's current scene
+ */
+ bool isInRoom(int objectId) const;
+};
+
+} // End of namespace MADS
+
+#endif /* MADS_INVENTORY_H */
diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp
index 21463aa58a..a9ce093c1f 100644
--- a/engines/mads/messages.cpp
+++ b/engines/mads/messages.cpp
@@ -283,6 +283,29 @@ void KernelMessages::delay(uint32 priorFrameTime, uint32 currentTime) {
}
}
+void KernelMessages::setQuoted(int msgIndex, int numTicks, bool quoted) {
+ if (msgIndex >= 0) {
+ KernelMessage &msg = _entries[msgIndex];
+
+ msg._flags |= KMSG_SCROLL;
+ if (quoted)
+ msg._flags |= KMSG_QUOTED;
+
+ msg._msgOffset = 0;
+ msg._numTicks = numTicks;
+ msg._frameTimer2 = _vm->_game->_scene._frameStartTime;
+ msg._asciiChar = msg._msg[0];
+ msg._asciiChar2 = msg._msg[1];
+
+ if (msg._flags & KMSG_PLAYER_TIMEOUT) {
+ msg._frameTimer2 = _vm->_game->_player._priorTimer +
+ _vm->_game->_player._ticksAmount;
+ }
+
+ msg._frameTimer = msg._frameTimer2;
+ }
+}
+
/*------------------------------------------------------------------------*/
TextDisplay::TextDisplay() {
diff --git a/engines/mads/messages.h b/engines/mads/messages.h
index 340f33ef46..205cbf8f30 100644
--- a/engines/mads/messages.h
+++ b/engines/mads/messages.h
@@ -88,6 +88,7 @@ public:
void update();
void processText(int msgIndex);
void delay(uint32 priorFrameTime, uint32 currentTime);
+ void setQuoted(int msgIndex, int numTicks, bool quoted);
};
class TextDisplay {
diff --git a/engines/mads/module.mk b/engines/mads/module.mk
index a65519faea..76d80bc3e3 100644
--- a/engines/mads/module.mk
+++ b/engines/mads/module.mk
@@ -6,6 +6,7 @@ MODULE_OBJS := \
nebular/globals_nebular.o \
nebular/sound_nebular.o \
nebular/nebular_scenes.o \
+ nebular/nebular_scenes1.o \
nebular/nebular_scenes8.o \
action.o \
animation.o \
@@ -20,6 +21,7 @@ MODULE_OBJS := \
game_data.o \
hotspots.o \
interface.o \
+ inventory.o \
mads.o \
messages.o \
msurface.o \
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;
}
diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp
index 8f803d109f..d7301bb369 100644
--- a/engines/mads/palette.cpp
+++ b/engines/mads/palette.cpp
@@ -386,9 +386,9 @@ void Palette::setPalette(const byte *colors, uint start, uint num) {
}
void Palette::setEntry(byte palIndex, byte r, byte g, byte b) {
- _mainPalette[palIndex * 3] = r;
- _mainPalette[palIndex * 3 + 1] = g;
- _mainPalette[palIndex * 3 + 2] = b;
+ _mainPalette[palIndex * 3] = VGA_COLOR_TRANS(r);
+ _mainPalette[palIndex * 3 + 1] = VGA_COLOR_TRANS(g);
+ _mainPalette[palIndex * 3 + 2] = VGA_COLOR_TRANS(b);
setPalette((const byte *)&_mainPalette[palIndex * 3], palIndex, 1);
}
diff --git a/engines/mads/scene.h b/engines/mads/scene.h
index 0b20fb077f..f96cb592e2 100644
--- a/engines/mads/scene.h
+++ b/engines/mads/scene.h
@@ -93,7 +93,7 @@ public:
KernelMessages _kernelMessages;
Common::String _talkFont;
int _textSpacing;
- Common::Array<Hotspot> _hotspots;
+ Hotspots _hotspots;
ScreenObjects _screenObjects;
ImageInterEntries _imageInterEntries;
DirtyAreas _dirtyAreas;
diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp
index 1b4f8a9e6e..6418a03477 100644
--- a/engines/mads/sequence.cpp
+++ b/engines/mads/sequence.cpp
@@ -412,6 +412,21 @@ int SequenceList::addSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, i
true, 100, depth - 1, 1, ANIMTYPE_CYCLED, 0, 0);
}
+int SequenceList::addReverseSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks,
+ int triggerCountdown, int timeoutTicks, int extraTicks) {
+ Scene &scene = _vm->_game->_scene;
+
+ SpriteAsset *asset = scene._sprites[srcSpriteIdx];
+ MSprite *spriteFrame = asset->getFrame(0);
+ int depth = scene._depthSurface.getDepth(Common::Point(
+ spriteFrame->_offset.x + (spriteFrame->w / 2),
+ spriteFrame->_offset.y + (spriteFrame->h / 2)));
+
+ return add(srcSpriteIdx, flipped, asset->getCount(), triggerCountdown, timeoutTicks, extraTicks,
+ numTicks, 0, 0, true, 100, depth - 1, -1, ANIMTYPE_CYCLED, 0, 0);
+}
+
+
int SequenceList::startCycle(int srcSpriteIndex, bool flipped, int cycleIndex) {
int result = addSpriteCycle(srcSpriteIndex, flipped, INDEFINITE_TIMEOUT, 0, 0, 0);
if (result >= 0)
diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h
index 85e4f660e5..a62ad7ee7a 100644
--- a/engines/mads/sequence.h
+++ b/engines/mads/sequence.h
@@ -93,6 +93,7 @@ public:
int add(int spriteListIndex, bool flipped, int frameIndex, int triggerCountdown, int delayTicks,
int extraTicks, int numTicks, int msgX, int msgY, bool nonFixed, char scale, uint8 depth,
int frameInc, SpriteAnimType animType, int numSprites, int frameStart);
+
int addTimer(int time, int abortVal);
void remove(int seqIndex);
void setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot);
@@ -103,7 +104,11 @@ public:
void scan();
void setDepth(int seqIndex, int depth);
void setMsgPosition(int seqIndex, const Common::Point &pt);
- int addSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks);
+ int addSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks,
+ int triggerCountdown = 0, int timeoutTicks = 0, int extraTicks = 0);
+ int addReverseSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks,
+ int triggerCountdown = 0, int timeoutTicks = 0, int extraTicks = 0);
+
int startCycle(int srcSpriteIdx, bool flipped, int cycleIndex);
int startReverseCycle(int srcSpriteIndex, bool flipped, int numTicks, int triggerCountdown,
int timeoutTicks, int extraTicks);