aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/mads/events.cpp1
-rw-r--r--engines/mads/game.cpp100
-rw-r--r--engines/mads/game.h7
-rw-r--r--engines/mads/module.mk1
-rw-r--r--engines/mads/nebular/game_nebular.cpp5
-rw-r--r--engines/mads/nebular/game_nebular.h2
-rw-r--r--engines/mads/palette.cpp4
-rw-r--r--engines/mads/palette.h5
-rw-r--r--engines/mads/scene.cpp35
-rw-r--r--engines/mads/scene.h201
-rw-r--r--engines/mads/scene_data.cpp133
-rw-r--r--engines/mads/scene_data.h227
12 files changed, 490 insertions, 231 deletions
diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp
index 23d2e72eeb..8f177f2c20 100644
--- a/engines/mads/events.cpp
+++ b/engines/mads/events.cpp
@@ -46,6 +46,7 @@ EventsManager::~EventsManager() {
}
void EventsManager::loadCursors(const Common::String &spritesName) {
+ delete _cursorSprites;
_cursorSprites = new SpriteAsset(_vm, spritesName, 0x4000);
}
diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp
index bff0e6e73e..9b60302c7c 100644
--- a/engines/mads/game.cpp
+++ b/engines/mads/game.cpp
@@ -43,9 +43,14 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _scene(vm) {
_saveSlot = -1;
_statusFlag = 0;
_sectionHandler = nullptr;
+ _sectionNumber = 1;
+ _priorSectionNumber = 0;
+ _currentSectionNumber = -1;
_v1 = _v2 = 0;
_v3 = _v4 = 0;
_v5 = _v6 = 0;
+ _aaName = "*I0.AA";
+ _playerSpritesFlag = false;
}
Game::~Game() {
@@ -54,6 +59,7 @@ Game::~Game() {
}
void Game::run() {
+ _statusFlag = true;
int protectionResult = checkCopyProtection();
switch (protectionResult) {
case 1:
@@ -71,17 +77,16 @@ void Game::run() {
}
if (_saveSlot == -1 && protectionResult != -1 && protectionResult != -2) {
- initSection(_scene._sectionNum);
- _statusFlag = _scene._sectionNum != 1;
- _vm->_dialogs->_pendingDialog = DIALOG_DIFFICULTY;
+ initSection(_sectionNumber);
+ _statusFlag = true;
+ _vm->_dialogs->_pendingDialog = DIALOG_DIFFICULTY;
_vm->_dialogs->showDialog();
_vm->_dialogs->_pendingDialog = DIALOG_NONE;
- _vm->_events->freeCursors();
- _scene._priorSectionNum = 0;
+ _priorSectionNumber = 0;
+ _priorSectionNumber = -1;
_scene._priorSceneId = 0;
- _scene._sectionNumPrior = -1;
_scene._currentSceneId = -1;
}
@@ -102,12 +107,12 @@ void Game::gameLoop() {
while (!_vm->shouldQuit() && _statusFlag) {
setSectionHandler();
_sectionHandler->preLoadSection();
- initSection(_scene._sectionNum);
+ initSection(_sectionNumber);
_sectionHandler->postLoadSection();
_scene.clearSprites(true);
- if (_scene._sectionNum == _scene._sectionNumPrior) {
+ if (_sectionNumber == _currentSectionNumber) {
sectionLoop();
}
@@ -121,49 +126,72 @@ void Game::gameLoop() {
}
void Game::sectionLoop() {
- while (!_vm->shouldQuit() && _statusFlag && _scene._sectionNum == _scene._sectionNumPrior) {
+ while (!_vm->shouldQuit() && _statusFlag && _sectionNumber == _currentSectionNumber) {
+ _v1 = 3;
+ _player._spritesChanged = true;
+ _v5 = 0;
+ _v6 = 0;
+ _vm->_events->resetCursor();
- if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globalFlags[5]) {
- _v1 = 3;
- _player._spritesChanged = true;
- _v5 = 0;
- _v6 = 0;
- _vm->_events->resetCursor();
+ _quotes = nullptr;
+ _scene.clearVocab();
+ _scene.loadSceneLogic();
- _quotes = nullptr;
- _scene.clearVocab();
- _scene.loadSceneLogic();
+ _v4 = 0;
+ _player._stepEnabled = true;
+ _player._visible = true;
+ _vm->_dialogs->_defaultPosition = Common::Point(-1, -1);
+ addVisitedScene(_scene._nextSceneId);
- _v4 = 0;
- _player._stepEnabled = true;
- _player._visible = true;
- _vm->_dialogs->_defaultPosition = Common::Point(-1, -1);
- addVisitedScene(_scene._nextSceneId);
+ _scene._screenObjects._v8333C = -1;
+ _scene._screenObjects._v832EC = 0;
+ _scene._screenObjects._yp = 0;
+ _v3 = -1;
- // TODO: main section loop logic goes here
+ _scene._sceneLogic->setup();
+ if (_player._spritesChanged || _v3) {
+ if (_player._spritesLoaded)
+ _scene.releasePlayerSprites();
+ _vm->_palette->resetGamePalette(18, 10);
+ _scene.clearSprites(true);
+ } else {
+ _vm->_palette->initGamePalette();
+ }
- // Clear the scene
- _scene.free();
- _scene._sectionNum = _scene._nextSceneId / 100;
+ // TODO: Further palette init
+
+ //_scene.loadScene(_aaName, _scene._nextSceneId, 0);
+ _vm->_sound->queueNewCommands();
+ if (!_player._spritesLoaded) {
+ _player.loadSprites("");
+ _playerSpritesFlag = false;
+ }
- // TODO: sub_1DD46(3)
- // Check whether to show a dialog
- if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globalFlags[5]) {
- _scene.releasePlayerSprites();
- _vm->_dialogs->showDialog();
- _vm->_dialogs->_pendingDialog = DIALOG_NONE;
- }
+ // TODO: main section loop logic goes here
+
+ // Clear the scene
+ _scene.free();
+ _sectionNumber = _scene._nextSceneId / 100;
+
+ // TODO: sub_1DD46(3)
+
+ // Check whether to show a dialog
+ if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globalFlags[5]) {
+ _scene.releasePlayerSprites();
+ _vm->_dialogs->showDialog();
+ _vm->_dialogs->_pendingDialog = DIALOG_NONE;
}
}
}
void Game::initSection(int sectionNumber) {
- _priorSectionNumber = _sectionNumber;
- _sectionNumber = sectionNumber;
+ _priorSectionNumber = _currentSectionNumber;
+ _currentSectionNumber = sectionNumber;
_vm->_palette->resetGamePalette(18, 10);
_vm->_palette->setLowRange();
+ _vm->_events->loadCursors("*CURSOR.SS");
assert(_vm->_events->_cursorSprites);
_vm->_events->setCursor2((_vm->_events->_cursorSprites->getCount() <= 1) ?
diff --git a/engines/mads/game.h b/engines/mads/game.h
index 4735615d7a..fbac20ce1f 100644
--- a/engines/mads/game.h
+++ b/engines/mads/game.h
@@ -70,6 +70,10 @@ public:
bool _visible;
public:
Player();
+
+ void loadSprites(const Common::String &prefix) {
+ warning("TODO: Player::loadSprites");
+ }
};
class SectionHandler {
@@ -122,6 +126,8 @@ protected:
int _v4;
int _v5;
int _v6;
+ Common::String _aaName;
+ bool _playerSpritesFlag;
/**
* Constructor
@@ -174,6 +180,7 @@ public:
public:
int _sectionNumber;
int _priorSectionNumber;
+ int _currentSectionNumber;
Common::Array<uint16> _globalFlags;
Common::Array<InventoryObject> _objects;
Common::Array<int> _inventoryList;
diff --git a/engines/mads/module.mk b/engines/mads/module.mk
index a729533bcc..09adc9c5bc 100644
--- a/engines/mads/module.mk
+++ b/engines/mads/module.mk
@@ -21,6 +21,7 @@ MODULE_OBJS := \
palette.o \
resources.o \
scene.o \
+ scene_data.o \
sound.o \
user_interface.o
diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp
index 6e2b77d477..34fe0c7d19 100644
--- a/engines/mads/nebular/game_nebular.cpp
+++ b/engines/mads/nebular/game_nebular.cpp
@@ -155,7 +155,7 @@ void GameNebular::initialiseGlobals() {
void GameNebular::setSectionHandler() {
delete _sectionHandler;
- switch (_scene._sectionNum) {
+ switch (_sectionNumber) {
case 1:
_sectionHandler = new Section1Handler(_vm);
break;
@@ -177,6 +177,9 @@ void GameNebular::setSectionHandler() {
case 7:
_sectionHandler = new Section7Handler(_vm);
break;
+ case 8:
+ _sectionHandler = new Section8Handler(_vm);
+ break;
default:
break;
}
diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h
index 9232b26969..6395ba0e4e 100644
--- a/engines/mads/nebular/game_nebular.h
+++ b/engines/mads/nebular/game_nebular.h
@@ -60,7 +60,7 @@ typedef Section1Handler Section4Handler;
typedef Section1Handler Section5Handler;
typedef Section1Handler Section6Handler;
typedef Section1Handler Section7Handler;
-
+typedef Section1Handler Section8Handler;
} // End of namespace Nebular
diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp
index 5438c782aa..7c51842ae2 100644
--- a/engines/mads/palette.cpp
+++ b/engines/mads/palette.cpp
@@ -283,6 +283,10 @@ void Palette::resetGamePalette(int lowRange, int highRange) {
}
}
+void Palette::initGamePalette() {
+ // TODO
+}
+
void Palette::initRange(byte *palette) {
int var6 = 0;
int vdx = 0;
diff --git a/engines/mads/palette.h b/engines/mads/palette.h
index 14cebc7092..d0d7007586 100644
--- a/engines/mads/palette.h
+++ b/engines/mads/palette.h
@@ -175,6 +175,11 @@ public:
void resetGamePalette(int v1, int v2);
/**
+ * Initialises game palette
+ */
+ void initGamePalette();
+
+ /**
* Set the first four palette entries with preset values
*/
void setLowRange();
diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp
index 19071d1352..09e965bac3 100644
--- a/engines/mads/scene.cpp
+++ b/engines/mads/scene.cpp
@@ -28,9 +28,6 @@
namespace MADS {
Scene::Scene(MADSEngine *vm): _vm(vm) {
- _sectionNum = 1;
- _sectionNumPrior = -1;
- _priorSectionNum = 0;
_priorSceneId = 0;
_nextSceneId = 0;
_currentSceneId = 0;
@@ -47,6 +44,7 @@ Scene::Scene(MADSEngine *vm): _vm(vm) {
_verbList.push_back(VerbInit(VERB_PULL, 2, 0));
_verbList.push_back(VerbInit(VERB_CLOSE, 2, 0));
_verbList.push_back(VerbInit(VERB_THROW, 1, 2));
+ Common::fill((byte *)&_nullPalette[0], (byte *)&_nullPalette[3], 0);
}
Scene::~Scene() {
@@ -156,16 +154,43 @@ void Scene::loadVocab() {
InventoryObject &io = _vm->_game->_objects[objIndex];
addActiveVocab(io._descId);
- if (io._vocabCount > 0) {
- // TODO
+ for (int vocabIndex = 0; vocabIndex <io._vocabCount; ++vocabIndex) {
+ addActiveVocab(io._vocabList[vocabIndex]._vocabId);
}
}
+
+ // Load scene hotspot list vocabs and verbs
+ for (uint i = 0; i < _hotspotList.size(); ++i) {
+ addActiveVocab(_hotspotList[i]._vocabId);
+ if (_hotspotList[i]._verbId)
+ addActiveVocab(_hotspotList[i]._verbId);
+ }
+
+ loadVocabStrings();
+}
+
+void Scene::loadVocabStrings() {
+ freeVocab();
+ File f("*VOCAB.DAT");
+
+ byte *d = new byte[ f.size()];
+ f.read(d, f.size());
+
+
+ int vocabId = 1;
+ for (uint strIndex = 0; strIndex < _activeVocabs.size(); ++strIndex) {
+
+ }
}
void Scene::free() {
warning("TODO: Scene::free");
}
+void Scene::setPalette(RGB4 *p) {
+ _scenePalette = p;
+}
+
/*------------------------------------------------------------------------*/
SpriteSlot::SpriteSlot() {
diff --git a/engines/mads/scene.h b/engines/mads/scene.h
index 27bcdb118a..0e788c9ebd 100644
--- a/engines/mads/scene.h
+++ b/engines/mads/scene.h
@@ -27,194 +27,10 @@
#include "common/array.h"
#include "common/rect.h"
#include "mads/assets.h"
+#include "mads/scene_data.h"
namespace MADS {
-enum {
- VERB_LOOK = 3,
- VERB_TAKE = 4,
- VERB_PUSH = 5,
- VERB_OPEN = 6,
- VERB_PUT = 7,
- VERB_TALKTO = 8,
- VERB_GIVE = 9,
- VERB_PULL = 10,
- VERB_CLOSE = 11,
- VERB_THROW = 12,
- VERB_WALKTO = 13
-};
-
-class VerbInit {
-public:
- int _id;
- int _action1;
- int _action2;
-
- VerbInit() {}
- VerbInit(int id, int action1, int action2): _id(id), _action1(action1), _action2(action2) {}
-};
-
-enum SpriteType {
- ST_NONE = 0, ST_FOREGROUND = 1, ST_BACKGROUND = -4,
- ST_FULL_SCREEN_REFRESH = -2, ST_EXPIRED = -1
-};
-
-class SpriteSlot {
-public:
- SpriteType _spriteType;
- int _seqIndex;
- int _spriteListIndex;
- int _frameNumber;
- Common::Point _position;
- int _depth;
- int _scale;
-public:
- SpriteSlot();
- SpriteSlot(SpriteType type, int seqIndex);
-};
-
-class TextDisplay {
-public:
- bool _active;
- int _spacing;
- Common::Rect _bounds;
- int _expire;
- int _col1;
- int _col2;
- Common::String _fontName;
- Common::String _msg;
-
- TextDisplay();
-};
-
-class DynamicHotspot {
-public:
- int _seqIndex;
- Common::Rect _bounds;
- Common::Point _feetPos;
- int _facing;
- int _descId;
- int _field14;
- int _articleNumber;
- int _cursor;
-
- DynamicHotspot();
-};
-
-class SequenceEntry {
-public:
- int _spriteListIndex;
- int _flipped;
- int _frameIndex;
- int _frameStart;
- int _numSprites;
- int _animType;
- int _frameInc;
- int _depth;
- int _scale;
- int _dynamicHotspotIndex;
-
- Common::Point _msgPos;
-
- int _triggerCountdown;
- bool _doneFlag;
- struct {
- int _count;
- int _mode[5];
- int _frameIndex[5];
- int _abortVal[5];
- } _entries;
- int _abortMode;
- int _actionNouns[3];
- int _numTicks;
- int _extraTicks;
- int _timeout;
-
- SequenceEntry();
-};
-
-class KernelMessage {
-public:
- int _flags;
- int _seqInex;
- char _asciiChar;
- char _asciiChar2;
- int _colors;
- Common::Point _posiition;
- int _msgOffset;
- int _numTicks;
- int _frameTimer2;
- int _frameTimer;
- int _timeout;
- int _field1C;
- int _abortMode;
- int _nounList[3];
- Common::String _msg;
-
- KernelMessage();
-};
-
-class Hotspot {
-public:
- Common::Rect _bounds;
- Common::Point _feetPos;
- int _facing;
- int _articleNumber;
- int _cursor;
- int _vocabId;
- int _verbId;
-
- Hotspot();
- Hotspot(Common::SeekableReadStream &f);
-};
-
-#define SPRITE_COUNT 50
-#define TEXT_DISPLAY_COUNT 40
-#define DYNAMIC_HOTSPOT_COUNT 8
-
-class MADSEngine;
-class Scene;
-
-class SceneLogic {
-protected:
- Scene *_scene;
-public:
- /**
- * Constructor
- */
- SceneLogic(Scene *scene): _scene(scene) {}
-
- /**
- * Called to initially setup a scene
- */
- virtual void setup() = 0;
-
- /**
- * Called as the scene is entered (made active)
- */
- virtual void enter() = 0;
-
- /**
- * Called one per frame
- */
- virtual void step() = 0;
-
- /**
- * Called before an action is started
- */
- virtual void preActions() = 0;
-
- /**
- * Handles scene actions
- */
- virtual void actions() = 0;
-
- /**
- * Post-action handling
- */
- virtual void postActions() = 0;
-};
-
class Scene {
private:
/**
@@ -227,13 +43,14 @@ private:
*/
int activeVocabIndexOf(int vocabId);
+ /**
+ * Secondary loading vocab list
+ */
+ void loadVocabStrings();
protected:
MADSEngine *_vm;
public:
SceneLogic *_sceneLogic;
- int _priorSectionNum;
- int _sectionNum;
- int _sectionNumPrior;
int _priorSceneId;
int _nextSceneId;
int _currentSceneId;
@@ -251,6 +68,9 @@ public:
Common::String _talkFont;
int _textSpacing;
Common::Array<Hotspot> _hotspotList;
+ ScreenObjects _screenObjects;
+ RGB4 *_scenePalette;
+ RGB4 _nullPalette[2];
/**
* Constructor
@@ -317,6 +137,11 @@ public:
* Loads the vocab list
*/
void loadVocab();
+
+ /**
+ * Set the scene palette
+ */
+ void setPalette(RGB4 *p);
/**
* Clear the data for the scene
diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp
new file mode 100644
index 0000000000..6821395004
--- /dev/null
+++ b/engines/mads/scene_data.cpp
@@ -0,0 +1,133 @@
+/* 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/scene.h"
+#include "mads/mads.h"
+#include "mads/nebular/nebular_scenes.h"
+
+namespace MADS {
+
+SpriteSlot::SpriteSlot() {
+ _spriteType = ST_NONE;
+ _seqIndex = 0;
+ _spriteListIndex = 0;
+ _frameNumber = 0;
+ _depth = 0;
+ _scale = 0;
+}
+
+SpriteSlot::SpriteSlot(SpriteType type, int seqIndex) {
+ _spriteType = type;
+ _seqIndex = seqIndex;
+ _spriteListIndex = 0;
+ _frameNumber = 0;
+ _depth = 0;
+ _scale = 0;
+}
+
+/*------------------------------------------------------------------------*/
+
+TextDisplay::TextDisplay() {
+ _active = false;
+ _spacing = 0;
+ _expire = 0;
+ _col1 = _col2 = 0;
+}
+
+/*------------------------------------------------------------------------*/
+
+DynamicHotspot::DynamicHotspot() {
+ _seqIndex = 0;
+ _facing = 0;
+ _descId = 0;
+ _field14 = 0;
+ _articleNumber = 0;
+ _cursor = 0;
+}
+
+/*------------------------------------------------------------------------*/
+
+SequenceEntry::SequenceEntry() {
+ _spriteListIndex = 0;
+ _flipped =0;
+ _frameIndex = 0;
+ _frameStart = 0;
+ _numSprites = 0;
+ _animType = 0;
+ _frameInc = 0;
+ _depth = 0;
+ _scale = 0;
+ _dynamicHotspotIndex = -1;
+ _triggerCountdown = 0;
+ _doneFlag = 0;
+ _entries._count = 0;
+ _abortMode = 0;
+ _actionNouns[0] = _actionNouns[1] = _actionNouns[2] = 0;
+ _numTicks = 0;
+ _extraTicks = 0;
+ _timeout = 0;
+}
+
+KernelMessage::KernelMessage() {
+ _flags = 0;
+ _seqInex = 0;
+ _asciiChar = '\0';
+ _asciiChar2 = '\0';
+ _colors = 0;
+ Common::Point _posiition;
+ _msgOffset = 0;
+ _numTicks = 0;
+ _frameTimer2 = 0;
+ _frameTimer = 0;
+ _timeout = 0;
+ _field1C = 0;
+ _abortMode = 0;
+ _nounList[0] = _nounList[1] = _nounList[2] = 0;
+}
+
+/*------------------------------------------------------------------------*/
+
+Hotspot::Hotspot() {
+ _facing = 0;
+ _articleNumber = 0;
+ _cursor = 0;
+ _vocabId = 0;
+ _verbId = 0;
+}
+
+Hotspot::Hotspot(Common::SeekableReadStream &f) {
+ _bounds.left = f.readSint16LE();
+ _bounds.top = f.readSint16LE();
+ _bounds.right = f.readSint16LE();
+ _bounds.bottom = f.readSint16LE();
+ _feetPos.x = f.readSint16LE();
+ _feetPos.y = f.readSint16LE();
+ _facing = f.readByte();
+ _articleNumber = f.readByte();
+ f.skip(1);
+ _cursor = f.readByte();
+ _vocabId = f.readUint16LE();
+ _verbId = f.readUint16LE();
+}
+
+} // End of namespace MADS
diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h
new file mode 100644
index 0000000000..a4950dbc0a
--- /dev/null
+++ b/engines/mads/scene_data.h
@@ -0,0 +1,227 @@
+/* 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_SCENE_DATA_H
+#define MADS_SCENE_DATA_H
+
+#include "common/scummsys.h"
+#include "common/array.h"
+#include "common/rect.h"
+#include "mads/assets.h"
+
+namespace MADS {
+
+enum {
+ VERB_LOOK = 3,
+ VERB_TAKE = 4,
+ VERB_PUSH = 5,
+ VERB_OPEN = 6,
+ VERB_PUT = 7,
+ VERB_TALKTO = 8,
+ VERB_GIVE = 9,
+ VERB_PULL = 10,
+ VERB_CLOSE = 11,
+ VERB_THROW = 12,
+ VERB_WALKTO = 13
+};
+
+class VerbInit {
+public:
+ int _id;
+ int _action1;
+ int _action2;
+
+ VerbInit() {}
+ VerbInit(int id, int action1, int action2): _id(id), _action1(action1), _action2(action2) {}
+};
+
+class ScreenObjects {
+public:
+ int _v8333C;
+ int _v832EC;
+ int _yp;
+};
+
+enum SpriteType {
+ ST_NONE = 0, ST_FOREGROUND = 1, ST_BACKGROUND = -4,
+ ST_FULL_SCREEN_REFRESH = -2, ST_EXPIRED = -1
+};
+
+class SpriteSlot {
+public:
+ SpriteType _spriteType;
+ int _seqIndex;
+ int _spriteListIndex;
+ int _frameNumber;
+ Common::Point _position;
+ int _depth;
+ int _scale;
+public:
+ SpriteSlot();
+ SpriteSlot(SpriteType type, int seqIndex);
+};
+
+class TextDisplay {
+public:
+ bool _active;
+ int _spacing;
+ Common::Rect _bounds;
+ int _expire;
+ int _col1;
+ int _col2;
+ Common::String _fontName;
+ Common::String _msg;
+
+ TextDisplay();
+};
+
+class DynamicHotspot {
+public:
+ int _seqIndex;
+ Common::Rect _bounds;
+ Common::Point _feetPos;
+ int _facing;
+ int _descId;
+ int _field14;
+ int _articleNumber;
+ int _cursor;
+
+ DynamicHotspot();
+};
+
+class SequenceEntry {
+public:
+ int _spriteListIndex;
+ int _flipped;
+ int _frameIndex;
+ int _frameStart;
+ int _numSprites;
+ int _animType;
+ int _frameInc;
+ int _depth;
+ int _scale;
+ int _dynamicHotspotIndex;
+
+ Common::Point _msgPos;
+
+ int _triggerCountdown;
+ bool _doneFlag;
+ struct {
+ int _count;
+ int _mode[5];
+ int _frameIndex[5];
+ int _abortVal[5];
+ } _entries;
+ int _abortMode;
+ int _actionNouns[3];
+ int _numTicks;
+ int _extraTicks;
+ int _timeout;
+
+ SequenceEntry();
+};
+
+class KernelMessage {
+public:
+ int _flags;
+ int _seqInex;
+ char _asciiChar;
+ char _asciiChar2;
+ int _colors;
+ Common::Point _posiition;
+ int _msgOffset;
+ int _numTicks;
+ int _frameTimer2;
+ int _frameTimer;
+ int _timeout;
+ int _field1C;
+ int _abortMode;
+ int _nounList[3];
+ Common::String _msg;
+
+ KernelMessage();
+};
+
+class Hotspot {
+public:
+ Common::Rect _bounds;
+ Common::Point _feetPos;
+ int _facing;
+ int _articleNumber;
+ int _cursor;
+ int _vocabId;
+ int _verbId;
+
+ Hotspot();
+ Hotspot(Common::SeekableReadStream &f);
+};
+
+#define SPRITE_COUNT 50
+#define TEXT_DISPLAY_COUNT 40
+#define DYNAMIC_HOTSPOT_COUNT 8
+
+class MADSEngine;
+class Scene;
+
+class SceneLogic {
+protected:
+ Scene *_scene;
+public:
+ /**
+ * Constructor
+ */
+ SceneLogic(Scene *scene): _scene(scene) {}
+
+ /**
+ * Called to initially setup a scene
+ */
+ virtual void setup() = 0;
+
+ /**
+ * Called as the scene is entered (made active)
+ */
+ virtual void enter() = 0;
+
+ /**
+ * Called one per frame
+ */
+ virtual void step() = 0;
+
+ /**
+ * Called before an action is started
+ */
+ virtual void preActions() = 0;
+
+ /**
+ * Handles scene actions
+ */
+ virtual void actions() = 0;
+
+ /**
+ * Post-action handling
+ */
+ virtual void postActions() = 0;
+};
+
+} // End of namespace MADS
+
+#endif /* MADS_SCENE_DATA_H */