diff options
author | Filippos Karapetis | 2014-04-27 21:11:12 +0300 |
---|---|---|
committer | Filippos Karapetis | 2014-04-27 21:20:01 +0300 |
commit | 76950bf0ac210ecc31e798ce34de9a3f010371b2 (patch) | |
tree | 3daaa94d4cd73178e0c479850b5c5a18bbdbba2f /engines/mads/dragonsphere | |
parent | 4d159955a1eb79eb625d8e8dcb0c38d7a0a235ec (diff) | |
download | scummvm-rg350-76950bf0ac210ecc31e798ce34de9a3f010371b2.tar.gz scummvm-rg350-76950bf0ac210ecc31e798ce34de9a3f010371b2.tar.bz2 scummvm-rg350-76950bf0ac210ecc31e798ce34de9a3f010371b2.zip |
MADS: Add skeleton classes for Phantom and Dragonsphere
Diffstat (limited to 'engines/mads/dragonsphere')
-rw-r--r-- | engines/mads/dragonsphere/dragonsphere_scenes.cpp | 112 | ||||
-rw-r--r-- | engines/mads/dragonsphere/dragonsphere_scenes.h | 125 | ||||
-rw-r--r-- | engines/mads/dragonsphere/game_dragonsphere.cpp | 172 | ||||
-rw-r--r-- | engines/mads/dragonsphere/game_dragonsphere.h | 99 |
4 files changed, 508 insertions, 0 deletions
diff --git a/engines/mads/dragonsphere/dragonsphere_scenes.cpp b/engines/mads/dragonsphere/dragonsphere_scenes.cpp new file mode 100644 index 0000000000..fd4fcc183c --- /dev/null +++ b/engines/mads/dragonsphere/dragonsphere_scenes.cpp @@ -0,0 +1,112 @@ +/* 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/compression.h" +#include "mads/resources.h" +#include "mads/scene.h" +#include "mads/dragonsphere/game_dragonsphere.h" +#include "mads/dragonsphere/dragonsphere_scenes.h" + +namespace MADS { + +namespace Dragonsphere { + +SceneLogic *SceneFactory::createScene(MADSEngine *vm) { + Scene &scene = vm->_game->_scene; + + // TODO + //scene.addActiveVocab(NOUN_DROP); + + // TODO: Just return a dummy scene for now + return new DummyScene(vm); + + switch (scene._nextSceneId) { + // Scene group #1 + case 101: + // TODO + + // Scene group #2 + // TODO + + // Scene group #3 + // TODO + + // Scene group #8 + // TODO + + default: + error("Invalid scene %d called", scene._nextSceneId); + } +} + +/*------------------------------------------------------------------------*/ + +DragonsphereScene::DragonsphereScene(MADSEngine *vm) : SceneLogic(vm), + _globals(static_cast<GameDragonsphere *>(vm->_game)->_globals), + _game(*static_cast<GameDragonsphere *>(vm->_game)), + _action(vm->_game->_scene._action) { +} + +Common::String DragonsphereScene::formAnimName(char sepChar, int suffixNum) { + return Resources::formatName(_scene->_currentSceneId, sepChar, suffixNum, + EXT_NONE, ""); +} + +/*------------------------------------------------------------------------*/ + +void SceneInfoDragonsphere::loadCodes(MSurface &depthSurface, int variant) { + File f(Resources::formatName(RESPREFIX_RM, _sceneId, ".DAT")); + MadsPack codesPack(&f); + Common::SeekableReadStream *stream = codesPack.getItemStream(variant + 1); + + loadCodes(depthSurface, stream); + + delete stream; + f.close(); +} + +void SceneInfoDragonsphere::loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) { + byte *destP = depthSurface.getData(); + byte *endP = depthSurface.getBasePtr(0, depthSurface.h); + + byte runLength = stream->readByte(); + while (destP < endP && runLength > 0) { + byte runValue = stream->readByte(); + + // Write out the run length + Common::fill(destP, destP + runLength, runValue); + destP += runLength; + + // Get the next run length + runLength = stream->readByte(); + } + + if (destP < endP) + Common::fill(destP, endP, 0); +} + +} // End of namespace Dragonsphere + +} // End of namespace MADS diff --git a/engines/mads/dragonsphere/dragonsphere_scenes.h b/engines/mads/dragonsphere/dragonsphere_scenes.h new file mode 100644 index 0000000000..596a59e879 --- /dev/null +++ b/engines/mads/dragonsphere/dragonsphere_scenes.h @@ -0,0 +1,125 @@ +/* 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_DRAGONSPHERE_SCENES_H +#define MADS_DRAGONSPHERE_SCENES_H + +#include "common/scummsys.h" +#include "mads/game.h" +#include "mads/scene.h" +#include "mads/dragonsphere/game_dragonsphere.h" +//#include "mads/dragonsphere/globals_dragonsphere.h" + + +namespace MADS { + +namespace Dragonsphere { + +enum Noun { + NOUN_LOOK_AT = 0x0D1, + // TODO +}; + +class SceneFactory { +public: + static SceneLogic *createScene(MADSEngine *vm); +}; + +/** + * Specialized base class for Dragonsphere game scenes + */ +class DragonsphereScene : public SceneLogic { +protected: + DragonsphereGlobals &_globals; + GameDragonsphere &_game; + MADSAction &_action; + + /** + * Forms an animation resource name + */ + Common::String formAnimName(char sepChar, int suffixNum); + + /** + * Plays appropriate sound for entering varous rooms + */ + void lowRoomsEntrySound(); +public: + /** + * Constructor + */ + DragonsphereScene(MADSEngine *vm); + + void sub7178C(); +}; + +class SceneInfoDragonsphere : public SceneInfo { + friend class SceneInfo; +protected: + virtual void loadCodes(MSurface &depthSurface, int variant); + + virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream); + + /** + * Constructor + */ + SceneInfoDragonsphere(MADSEngine *vm) : SceneInfo(vm) {} +}; + +// TODO: Temporary, remove once implemented properly +class Scene1xx : public DragonsphereScene { +protected: + /** + * Plays an appropriate sound when entering a scene + */ + void sceneEntrySound() {} + + /** + *Sets the AA file to use for the scene + */ + void setAAName() {} + + /** + * Updates the prefix used for getting player sprites for the scene + */ + void setPlayerSpritesPrefix() {} +public: + Scene1xx(MADSEngine *vm) : DragonsphereScene(vm) {} +}; + +// TODO: Temporary, remove once implemented properly +class DummyScene: public Scene1xx { +public: + DummyScene(MADSEngine *vm) : Scene1xx(vm) {} + + virtual void setup() {} + virtual void enter() {} + virtual void step() {} + virtual void preActions() {} + virtual void actions() {} + virtual void synchronize(Common::Serializer &s) {} +}; + +} // End of namespace Dragonsphere + +} // End of namespace MADS + +#endif /* MADS_DRAGONSPHERE_SCENES_H */ diff --git a/engines/mads/dragonsphere/game_dragonsphere.cpp b/engines/mads/dragonsphere/game_dragonsphere.cpp new file mode 100644 index 0000000000..7d3864e680 --- /dev/null +++ b/engines/mads/dragonsphere/game_dragonsphere.cpp @@ -0,0 +1,172 @@ +/* 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/game.h" +#include "mads/screen.h" +#include "mads/msurface.h" +#include "mads/dragonsphere/game_dragonsphere.h" +//#include "mads/nebular/dialogs_nebular.h" +//#include "mads/nebular/globals_nebular.h" +#include "mads/dragonsphere/dragonsphere_scenes.h" + +namespace MADS { + +namespace Dragonsphere { + +GameDragonsphere::GameDragonsphere(MADSEngine *vm): Game(vm) { + _surface = new MSurface(MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); + _storyMode = STORYMODE_NAUGHTY; +} + +ProtectionResult GameDragonsphere::checkCopyProtection() { + /* + // DEBUG: Flag copy protection failure + _globals[5] = -1; + + if (!ConfMan.getBool("copy_protection")) + return true; + + * DEBUG: Disabled for now + CopyProtectionDialog *dlg = new CopyProtectionDialog(_vm, false); + dlg->show(); + delete dlg; + */ + + // DEBUG: Return that copy protection failed + return PROTECTION_SUCCEED; +} + +void GameDragonsphere::initialiseGlobals() { + //int count, count2; + //int bad; + + _globals.reset(); + //_globals[kTalkInanimateCount] = 8; + + /* Section #1 variables */ + // TODO + + /* Section #2 variables */ + // TODO + + /* Section #3 variables */ + // TODO + + /* Section #4 variables */ + // TODO + + /* Section #5 variables */ + // TODO + + /* Section #6 variables */ + // TODO + + /* Section #9 variables */ + // TODO + + _player._facing = FACING_NORTH; + _player._turnToFacing = FACING_NORTH; + + //Player::preloadSequences("RXM", 1); + //Player::preloadSequences("ROX", 1); +} + +void GameDragonsphere::setSectionHandler() { + delete _sectionHandler; + + switch (_sectionNumber) { + case 1: + _sectionHandler = new Section1Handler(_vm); + break; + case 2: + _sectionHandler = new Section2Handler(_vm); + break; + case 3: + _sectionHandler = new Section3Handler(_vm); + break; + case 4: + _sectionHandler = new Section4Handler(_vm); + break; + case 5: + _sectionHandler = new Section5Handler(_vm); + break; + case 6: + _sectionHandler = new Section6Handler(_vm); + break; + case 7: + _sectionHandler = new Section7Handler(_vm); + break; + case 8: + _sectionHandler = new Section8Handler(_vm); + break; + default: + break; + } +} + +void GameDragonsphere::checkShowDialog() { + // TODO: Copied from Nebular + if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globals[5]) { + _player.releasePlayerSprites(); + _vm->_dialogs->showDialog(); + _vm->_dialogs->_pendingDialog = DIALOG_NONE; + } +} + +void GameDragonsphere::doObjectAction() { + // TODO: Copied from Nebular + //Scene &scene = _scene; + MADSAction &action = _scene._action; + //Dialogs &dialogs = *_vm->_dialogs; + //int id; + + action._inProgress = false; +} + +void GameDragonsphere::unhandledAction() { + // TODO +} + +void GameDragonsphere::step() { + if (_player._visible && _player._stepEnabled && !_player._moving && + (_player._facing == _player._turnToFacing)) { + + // TODO + } + +} + +void GameDragonsphere::synchronize(Common::Serializer &s, bool phase1) { + Game::synchronize(s, phase1); + + // TODO: Copied from Nebular + if (!phase1) { + _globals.synchronize(s); + } +} + +} // End of namespace Dragonsphere + +} // End of namespace MADS diff --git a/engines/mads/dragonsphere/game_dragonsphere.h b/engines/mads/dragonsphere/game_dragonsphere.h new file mode 100644 index 0000000000..dd96146285 --- /dev/null +++ b/engines/mads/dragonsphere/game_dragonsphere.h @@ -0,0 +1,99 @@ +/* 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_GAME_DRAGONSPHERE_H +#define MADS_GAME_DRAGONSPHERE_H + +#include "common/scummsys.h" +#include "mads/game.h" +#include "mads/globals.h" +//#include "mads/nebular/globals_nebular.h" + +namespace MADS { + +namespace Dragonsphere { + +// TODO: Adapt for Dragonsphere's difficulty setting +enum StoryMode { STORYMODE_NAUGHTY = 1, STORYMODE_NICE = 2 }; + +enum InventoryObject { OBJ_NONE = -1 + // TODO +}; + +// HACK: A stub for now, remove from here once it's implemented properly +class DragonsphereGlobals: public Globals { +public: + DragonsphereGlobals() {} +}; + +class GameDragonsphere: public Game { + friend class Game; +protected: + GameDragonsphere(MADSEngine *vm); + + virtual ProtectionResult checkCopyProtection(); + + virtual void initialiseGlobals(); + + virtual void setSectionHandler(); + + virtual void checkShowDialog(); +public: + DragonsphereGlobals _globals; + StoryMode _storyMode; + + virtual Globals &globals() { return _globals; } + + virtual void doObjectAction(); + + virtual void unhandledAction(); + + virtual void step(); + + virtual void synchronize(Common::Serializer &s, bool phase1); +}; + + +class Section1Handler: public SectionHandler { +public: + Section1Handler(MADSEngine *vm): SectionHandler(vm) {} + + // TODO: Properly implement handler methods + virtual void preLoadSection() {} + virtual void sectionPtr2() {} + virtual void postLoadSection() {} +}; + +// TODO: Properly implement handler classes +typedef Section1Handler Section2Handler; +typedef Section1Handler Section3Handler; +typedef Section1Handler Section4Handler; +typedef Section1Handler Section5Handler; +typedef Section1Handler Section6Handler; +typedef Section1Handler Section7Handler; +typedef Section1Handler Section8Handler; + +} // End of namespace Nebular + +} // End of namespace MADS + +#endif /* MADS_GAME_DRAGONSPHERE_H */ |