From 37b788b7ddb679f32653be326ae96ad9132feb1f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 24 Feb 2014 00:20:53 -0500 Subject: MADS: Added skeleton framework for game scene classes --- engines/mads/dialogs.cpp | 12 +++ engines/mads/dialogs.h | 17 ++++ engines/mads/game.cpp | 53 ++++++++++-- engines/mads/game.h | 20 +++-- engines/mads/mads.cpp | 3 + engines/mads/mads.h | 2 + engines/mads/module.mk | 2 + engines/mads/nebular/nebular_scenes.cpp | 49 +++++++++++ engines/mads/nebular/nebular_scenes.h | 91 +++++++++++++++++++++ engines/mads/nebular/nebular_scenes8.cpp | 50 ++++++++++++ engines/mads/nebular/nebular_scenes8.h | 55 +++++++++++++ engines/mads/palette.cpp | 2 +- engines/mads/palette.h | 1 + engines/mads/scene.cpp | 105 +++++++++++++++++++++++- engines/mads/scene.h | 134 ++++++++++++++++++++++++++++++- 15 files changed, 577 insertions(+), 19 deletions(-) create mode 100644 engines/mads/nebular/nebular_scenes.cpp create mode 100644 engines/mads/nebular/nebular_scenes.h create mode 100644 engines/mads/nebular/nebular_scenes8.cpp create mode 100644 engines/mads/nebular/nebular_scenes8.h diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index 34a0b86abc..fd42eb5db0 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -329,4 +329,16 @@ void MessageDialog::show() { } } +/*------------------------------------------------------------------------*/ + +Dialogs *Dialogs::init(MADSEngine *vm) { + if (vm->getGameID() == GType_RexNebular) + return new Dialogs(vm); + + error("Unknown game"); +} + +Dialogs::Dialogs(MADSEngine *vm): _vm(vm) { +} + } // End of namespace MADS diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index 0945ad9436..f77590deee 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -168,6 +168,23 @@ public: void show(); }; +enum DialogId { + DIALOG_NONE = 0, DIALOG_GAME_MENU = 1, DIALOG_SAVE = 2, DIALOG_RESTORE = 3, + DIALOG_OPTIONS = 4, DIALOG_DIFFICULTY = 5, DIALOG_ERROR = 6 +}; + +class Dialogs { +private: + MADSEngine *_vm; + + Dialogs(MADSEngine *vm); +public: + static Dialogs *init(MADSEngine *vm); +public: + Common::Point _defaultPosition; + DialogId _pendingDialog; +}; + } // End of namespace MADS #endif /* MADS_DIALOGS_H */ diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 3acbd41ba6..14dbcde01f 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -37,13 +37,15 @@ Game *Game::init(MADSEngine *vm) { return nullptr; } -Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr) { +Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _scene(vm) { _sectionNumber = _priorSectionNumber = 0; _difficultyLevel = DIFFICULTY_HARD; _saveSlot = -1; _statusFlag = 0; _sectionHandler = nullptr; _v1 = _v2 = 0; + _v3 = _v4 = 0; + _v5 = _v6 = 0; } Game::~Game() { @@ -71,15 +73,15 @@ void Game::run() { if (_saveSlot == -1 && protectionResult != -1 && protectionResult != -2) { initSection(_scene._sectionNum); _statusFlag = _scene._sectionNum != 1; - _pendingDialog = DIALOG_DIFFICULTY; + _vm->_dialogs->_pendingDialog = DIALOG_DIFFICULTY; showDialog(); - _pendingDialog = DIALOG_NONE; + _vm->_dialogs->_pendingDialog = DIALOG_NONE; _vm->_events->freeCursors(); _scene._priorSectionNum = 0; _scene._priorSceneId = 0; - _scene._sectionNum2 = -1; + _scene._sectionNumPrior = -1; _scene._currentSceneId = -1; } @@ -105,7 +107,7 @@ void Game::gameLoop() { _scene.clearSprites(true); - if (_scene._sectionNum == _scene._sectionNum2) { + if (_scene._sectionNum == _scene._sectionNumPrior) { sectionLoop(); } @@ -113,14 +115,47 @@ void Game::gameLoop() { _vm->_events->resetCursor(); _vm->_events->freeCursors(); _vm->_sound->closeDriver(); - } _vm->_palette->close(); } void Game::sectionLoop() { - + while (!_vm->shouldQuit() && _statusFlag && _scene._sectionNum == _scene._sectionNumPrior) { + + 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.loadScene(); + + _v4 = 0; + _player._stepEnabled = true; + _player._visible = true; + _vm->_dialogs->_defaultPosition = Common::Point(-1, -1); + _scene.addVisitedScene(_scene._nextSceneId); + + // TODO: main section loop logic goes here + + // Clear the scene + _scene.free(); + _scene._sectionNum = _scene._nextSceneId / 100; + + // TODO: sub_1DD46(3) + + // Check whether to show a dialog + if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globalFlags[5]) { + _scene.releasePlayerSprites(); + showDialog(); + _vm->_dialogs->_pendingDialog = DIALOG_NONE; + } + } + } } void Game::initSection(int sectionNumber) { @@ -202,6 +237,10 @@ void InventoryObject::load(Common::SeekableReadStream &f) { Player::Player() { _direction = 8; _newDirection = 8; + _spritesLoaded = false; + _spriteListStart = _numSprites = 0; + _stepEnabled = false; + _visible = false; } } // End of namespace MADS diff --git a/engines/mads/game.h b/engines/mads/game.h index 4a8daed6ca..58b6ff968a 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -38,11 +38,6 @@ enum Difficulty { DIFFICULTY_HARD = 1, DIFFICULTY_MEDIUM = 2, DIFFICULTY_EASY = 3 }; -enum DialogId { - DIALOG_NONE = 0, DIALOG_GAME_MENU = 1, DIALOG_SAVE = 2, DIALOG_RESTORE = 3, - DIALOG_OPTIONS = 4, DIALOG_DIFFICULTY = 5, DIALOG_ERROR = 6 -}; - class InventoryObject { public: int _descId; @@ -67,6 +62,12 @@ class Player { public: int _direction; int _newDirection; + bool _spritesLoaded; + int _spriteListStart; + int _numSprites; + bool _stepEnabled; + bool _spritesChanged; + bool _visible; public: Player(); }; @@ -76,6 +77,7 @@ protected: MADSEngine *_vm; public: SectionHandler(MADSEngine *vm): _vm(vm) {} + virtual ~SectionHandler() {} virtual void preLoadSection() = 0; virtual void sectionPtr2() = 0; @@ -104,10 +106,14 @@ protected: Scene _scene; int _saveSlot; int _statusFlag; - DialogId _pendingDialog; SectionHandler *_sectionHandler; int _v1; int _v2; + int _v3; + int _v4; + int _v5; + int _v6; + byte *_quotes; /** * Constructor @@ -172,6 +178,8 @@ public: * Run the game */ void run(); + + Player &player() { return _player; } }; } // End of namespace MADS diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 3a121d082b..db73ec7d23 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -43,6 +43,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : _textWindowStill = false; _debugger = nullptr; + _dialogs = nullptr; _events = nullptr; _font = nullptr; _game = nullptr; @@ -55,6 +56,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : MADSEngine::~MADSEngine() { delete _debugger; + delete _dialogs; delete _events; delete _font; delete _game; @@ -77,6 +79,7 @@ void MADSEngine::initialise() { ResourcesManager::init(this); _debugger = new Debugger(this); + _dialogs = Dialogs::init(this); _events = new EventsManager(this); _palette = new Palette(this); _font = new Font(this); diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 5166b7b2b1..b3a05dc56c 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -31,6 +31,7 @@ #include "engines/engine.h" #include "graphics/surface.h" #include "mads/debugger.h" +#include "mads/dialogs.h" #include "mads/events.h" #include "mads/font.h" #include "mads/game.h" @@ -88,6 +89,7 @@ protected: virtual bool hasFeature(EngineFeature f) const; public: Debugger *_debugger; + Dialogs *_dialogs; EventsManager *_events; Font *_font; Game *_game; diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 9219d04fdc..a729533bcc 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -4,6 +4,8 @@ MODULE_OBJS := \ nebular/dialogs_nebular.o \ nebular/game_nebular.o \ nebular/sound_nebular.o \ + nebular/nebular_scenes.o \ + nebular/nebular_scenes8.o \ assets.o \ compression.o \ debugger.o \ diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp new file mode 100644 index 0000000000..efd831a4b7 --- /dev/null +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -0,0 +1,49 @@ +/* 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 "common/config-manager.h" +#include "mads/mads.h" +#include "mads/scene.h" +#include "mads/nebular/nebular_scenes.h" +#include "mads/nebular/nebular_scenes8.h" + +namespace MADS { + +namespace Nebular { + +SceneLogic *SceneFactory::createScene(Scene *scene) { + scene->addActiveVocab(NOUN_DROP); + scene->addActiveVocab(NOUN_DOLLOP); + scene->addActiveVocab(NOUN_DASH); + scene->addActiveVocab(NOUN_SPLASH); + scene->addActiveVocab(NOUN_ALCOHOL); + + // TODO: Implement all the game scenes + assert(scene->_nextSceneId == 804); + + return new Scene804(scene); +} + +} // End of namespace Nebular + +} // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h new file mode 100644 index 0000000000..28d24f090f --- /dev/null +++ b/engines/mads/nebular/nebular_scenes.h @@ -0,0 +1,91 @@ +/* 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_NEBULAR_SCENES_H +#define MADS_NEBULAR_SCENES_H + +#include "common/scummsys.h" +#include "mads/game.h" +#include "mads/scene.h" + +namespace MADS { + +namespace Nebular { + +enum Noun { + NOUN_BLOWGUN = 0x29, + NOUN_BURGER = 0x35, + NOUN_CHAIR = 0x47, + NOUN_DEAD_FISH = 0x65, + NOUN_DOOR = 0x6E, + NOUN_EAT = 0x75, + NOUN_EXAMINE = 0x7D, + NOUN_FRONT_WINDOW = 0x8E, + NOUN_FUZZY_DICE = 0x91, + NOUN_HOSE_DOWN = 0x0A6, + NOUN_HOTPANTS = 0x0A7, + NOUN_HULL = 0x0A8, + NOUN_HURL = 0x0A9, + NOUN_IGNITE = 0x0B4, + NOUN_INFLATE = 0x0B5, + NOUN_INSERT = 0x0B6, + NOUN_INSPECT = 0x0B7, + NOUN_JUNGLE = 0x0B8, + NOUN_LIFE_SUPPORT_SECTION = 0x0CC, + NOUN_LOG = 0x0D0, + NOUN_LOOK_AT = 0x0D1, + NOUN_LOOK_IN = 0x0D2, + NOUN_LOOK_THROUGH = 0x0D3, + NOUN_MONKEY = 0x0E3, + NOUN_OUTER_HULL = 0x0F8, + NOUN_OUTSIDE = 0x0F9, + NOUN_PEER_THROUGH = 0x103, + NOUN_PLANT_STALK = 0x10F, + NOUN_READ = 0x11F, + NOUN_REFRIDGERATOR = 0x122, + NOUN_ROBO_KITCHEN = 0x127, + NOUN_SHIELD_ACCESS_PANEL = 0x135, + NOUN_SHIELD_MODULATOR = 0x137, + NOUN_SHOOT = 0x13A, + NOUN_SIT_IN = 0x13F, + NOUN_SMELL = 0x147, + NOUN_STUFFED_FISH = 0x157, + NOUN_VIEW_SCREEN = 0x180, + NOUN_CAPTIVE_CREATURE = 0x1C3, + NOUN_NATIVE_WOMAN = 0x1DC, + NOUN_ALCOHOL = 0x310, + NOUN_DOLLOP = 0x3AC, + NOUN_DROP = 0x3AD, + NOUN_DASH = 0x3AE, + NOUN_SPLASH = 0x3AF +}; + +class SceneFactory { +public: + static SceneLogic *createScene(Scene *scene); +}; + +} // End of namespace Nebular + +} // End of namespace MADS + +#endif /* MADS_NEBULAR_SCENES_H */ diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp new file mode 100644 index 0000000000..8feabc8037 --- /dev/null +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -0,0 +1,50 @@ +/* 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/nebular/nebular_scenes8.h" + +namespace MADS { + +namespace Nebular { + +void Scene804::setup() { +} + +void Scene804::enter() { +} + +void Scene804::step() { +} + +void Scene804::preActions() { +} + +void Scene804::actions() { +} + +void Scene804::postActions() { +} + +} // End of namespace Nebular + +} // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h new file mode 100644 index 0000000000..11bb8b0d81 --- /dev/null +++ b/engines/mads/nebular/nebular_scenes8.h @@ -0,0 +1,55 @@ +/* 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_NEBULAR_SCENES8_H +#define MADS_NEBULAR_SCENES8_H + +#include "common/scummsys.h" +#include "mads/game.h" +#include "mads/scene.h" + +namespace MADS { + +namespace Nebular { + +class Scene804: public SceneLogic { +public: + Scene804(Scene *scene): SceneLogic(scene) {} + + virtual void setup(); + + virtual void enter(); + + virtual void step(); + + virtual void preActions(); + + virtual void actions(); + + virtual void postActions(); +}; + +} // End of namespace Nebular + +} // End of namespace MADS + +#endif /* MADS_NEBULAR_SCENES8_H */ diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 8ec43b90b9..5438c782aa 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -293,7 +293,7 @@ void Palette::initRange(byte *palette) { int varE = vbx; int var10 = vdx; do { - int vdx = 0; + vdx = 0; do { int vcx = 0; int var4 = vdx; diff --git a/engines/mads/palette.h b/engines/mads/palette.h index b5588fecd6..14cebc7092 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -24,6 +24,7 @@ #define MADS_PALETTE_H #include "common/scummsys.h" +#include "common/stream.h" namespace MADS { diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index cf7ba6c674..46190d12be 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -22,16 +22,26 @@ #include "common/scummsys.h" #include "mads/scene.h" +#include "mads/mads.h" +#include "mads/nebular/nebular_scenes.h" namespace MADS { -Scene::Scene() { +Scene::Scene(MADSEngine *vm): _vm(vm) { _sectionNum = 1; - _sectionNum2 = -1; + _sectionNumPrior = -1; _priorSectionNum = 0; _priorSceneId = 0; _nextSceneId = 0; _currentSceneId = 0; + _vocabCount = 0; + _vocabBuffer = nullptr; + _sceneLogic = nullptr; +} + +Scene::~Scene() { + delete[] _vocabBuffer; + delete _sceneLogic; } void Scene::clearSprites(bool flag) { @@ -45,6 +55,86 @@ void Scene::clearSprites(bool flag) { _spriteSlots.push_back(SpriteSlot(ST_FULL_SCREEN_REFRESH, -1)); } +/** + * Releases any sprites used by the player + */ +void Scene::releasePlayerSprites() { + Player &player = _vm->_game->player(); + + if (player._spritesLoaded && player._numSprites > 0) { + int spriteEnd = player._spriteListStart + player._numSprites - 1; + do { + deleteSpriteEntry(spriteEnd); + } while (--spriteEnd >= player._spriteListStart); + } +} + +void Scene::deleteSpriteEntry(int listIndex) { + delete _spriteList[listIndex]; + _spriteList.remove_at(listIndex); +} + +void Scene::clearDynamicHotspots() { + _dynamicHotspots.clear(); + _dynamicHotspotsChanged = false; +} + +void Scene::clearVocab() { + freeVocab(); + _vocabCount = 0; +} + +void Scene::freeVocab() { + delete[] _vocabBuffer; + _vocabBuffer = nullptr; +} + +void Scene::addActiveVocab(int vocabId) { + if (activeVocabIndexOf(vocabId) == -1) { + assert(_activeVocabs.size() < 200); + _activeVocabs.push_back(vocabId); + } +} + +int Scene::activeVocabIndexOf(int vocabId) { + for (uint i = 0; i < _activeVocabs.size(); ++i) { + if (_activeVocabs[i] == vocabId) + return i; + } + + return -1; +} + +void Scene::addVisitedScene(int sceneId) { + if (!visitedScenesExists(sceneId)) + _visitedScenes.push_back(sceneId); +} + +bool Scene::visitedScenesExists(int sceneId) { + for (int i = 0; i < _visitedScenes.size(); ++i) { + if (_visitedScenes[i] == sceneId) + return true; + } + + return false; +} + +void Scene::loadScene() { + delete _sceneLogic; + + switch (_vm->getGameID()) { + case GType_RexNebular: + _sceneLogic = Nebular::SceneFactory::createScene(this); + break; + default: + error("Unknown game"); + } +} + +void Scene::free() { + warning("TODO: Scene::free"); +} + /*------------------------------------------------------------------------*/ SpriteSlot::SpriteSlot() { @@ -74,4 +164,15 @@ TextDisplay::TextDisplay() { _col1 = _col2 = 0; } +/*------------------------------------------------------------------------*/ + +DynamicHotspot::DynamicHotspot() { + _seqIndex = 0; + _facing = 0; + _descId = 0; + _field14 = 0; + _articleNumber = 0; + _cursor = 0; +} + } // End of namespace MADS diff --git a/engines/mads/scene.h b/engines/mads/scene.h index e2afd081b3..9f4f392289 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -26,6 +26,7 @@ #include "common/scummsys.h" #include "common/array.h" #include "common/rect.h" +#include "mads/assets.h" namespace MADS { @@ -62,32 +63,159 @@ public: TextDisplay(); }; +class DynamicHotspot { +public: + int _seqIndex; + Common::Rect _bounds; + Common::Point _feetPos; + int _facing; + int _descId; + int _field14; + int _articleNumber; + int _cursor; + + DynamicHotspot(); +}; + #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: + /** + * Free the voculary list buffer + */ + void freeVocab(); + + /** + * Return the index of a given Vocab in the active vocab list + */ + int activeVocabIndexOf(int vocabId); + + /** + * Returns true if a given Scene Id exists in the listed of previously visited scenes. + */ + bool visitedScenesExists(int sceneId); +protected: + MADSEngine *_vm; public: + SceneLogic *_sceneLogic; int _priorSectionNum; int _sectionNum; - int _sectionNum2; + int _sectionNumPrior; int _priorSceneId; int _nextSceneId; int _currentSceneId; TextDisplay _textDisplay[TEXT_DISPLAY_COUNT]; Common::Array _spriteSlots; - Common::Array _spriteList; + Common::Array _spriteList; int _spriteListIndex; + Common::Array _dynamicHotspots; + bool _dynamicHotspotsChanged; + byte *_vocabBuffer; + int _vocabCount; + Common::Array _activeVocabs; + Common::Array _visitedScenes; /** * Constructor */ - Scene(); + Scene(MADSEngine *vm); + + /** + * Destructor + */ + ~Scene(); /** * Initialise the sprite data * @param flag Also reset sprite list */ void clearSprites(bool flag); + + /** + * Delete any sprites used by the player + */ + void releasePlayerSprites(); + + /** + * Delete a sprite entry + */ + void deleteSpriteEntry(int listIndex); + + /** + * Clear the dynamic hotspot list + */ + void clearDynamicHotspots(); + + /** + * Clear the vocabulary list + */ + void clearVocab(); + + /** + * Add a given vocab entry to the active list + */ + void addActiveVocab(int vocabId); + + /** + * Add a scene to the visited scene list if it doesn't already exist + */ + void addVisitedScene(int sceneId); + + /** + * Loads the scene logic for a given scene + */ + void loadScene(); + + /** + * Clear the data for the scene + */ + void free(); }; } // End of namespace MADS -- cgit v1.2.3