diff options
author | Paul Gilbert | 2014-03-05 21:36:02 -0500 |
---|---|---|
committer | Paul Gilbert | 2014-03-05 21:36:02 -0500 |
commit | 73a7140be775693533db183f353fc9c82c14fa53 (patch) | |
tree | 7185ff4097757a91be2f4add4fc640df1d18fd81 | |
parent | a0e955d8d327afa83ad96fe1ce765eeba0ce561f (diff) | |
download | scummvm-rg350-73a7140be775693533db183f353fc9c82c14fa53.tar.gz scummvm-rg350-73a7140be775693533db183f353fc9c82c14fa53.tar.bz2 scummvm-rg350-73a7140be775693533db183f353fc9c82c14fa53.zip |
MADS: Starting implementation of scene group 8
-rw-r--r-- | engines/mads/game.h | 2 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes.cpp | 18 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes.h | 6 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes8.cpp | 24 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes8.h | 19 | ||||
-rw-r--r-- | engines/mads/player.h | 1 | ||||
-rw-r--r-- | engines/mads/resources.cpp | 45 | ||||
-rw-r--r-- | engines/mads/resources.h | 3 | ||||
-rw-r--r-- | engines/mads/scene.cpp | 2 | ||||
-rw-r--r-- | engines/mads/scene_data.cpp | 6 | ||||
-rw-r--r-- | engines/mads/scene_data.h | 3 |
11 files changed, 115 insertions, 14 deletions
diff --git a/engines/mads/game.h b/engines/mads/game.h index 5330cd3138..aa3c38596c 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -65,7 +65,6 @@ protected: int _v5; int _v6; bool _updateSceneFlag; - Common::String _aaName; bool _playerSpritesFlag; int _objectHiliteVocabIdx; @@ -117,6 +116,7 @@ public: AbortTimerMode _abortTimersMode; AbortTimerMode _abortTimersMode2; uint32 _priorFrameTimer; + Common::String _aaName; public: virtual ~Game(); diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index efd831a4b7..e1dec2c34c 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -31,17 +31,19 @@ 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); +SceneLogic *SceneFactory::createScene(MADSEngine *vm) { + Scene &scene = vm->_game->_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); + assert(scene._nextSceneId == 804); - return new Scene804(scene); + return new Scene804(vm); } } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 28d24f090f..1997202fbd 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -31,6 +31,10 @@ namespace MADS { namespace Nebular { +enum { + SEX_MALE = 0, SEX_FEMALE = 2 +}; + enum Noun { NOUN_BLOWGUN = 0x29, NOUN_BURGER = 0x35, @@ -81,7 +85,7 @@ enum Noun { class SceneFactory { public: - static SceneLogic *createScene(Scene *scene); + static SceneLogic *createScene(MADSEngine *vm); }; } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 8feabc8037..ee06dd00d3 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -21,12 +21,36 @@ */ #include "common/scummsys.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 { +void Scene8xx::setup1() { + _vm->_sound->command(5); + if ((_vm->_game->_globalFlags[178] && !_vm->_game->_globalFlags[179]) || + _scene->_nextSceneId == 804 || _scene->_nextSceneId == 805 || + _scene->_nextSceneId == 808 || _scene->_nextSceneId == 810) { + _vm->_game->_player._spritesPrefix = ""; + } else { + _vm->_game->_player._spritesPrefix = _vm->_game->_globalFlags[0] + == SEX_FEMALE ? "ROX" : "RXM"; + } + + _vm->_palette->setEntry(16, 0x0A, 0x3F, 0x3F); + _vm->_palette->setEntry(17, 0x0A, 0x2D, 0x2D); +} + +void Scene8xx::setup2() { + _vm->_game->_aaName = Resources::formatAAName(5); +} + +/*------------------------------------------------------------------------*/ + void Scene804::setup() { } diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h index 11bb8b0d81..3f5d2744fa 100644 --- a/engines/mads/nebular/nebular_scenes8.h +++ b/engines/mads/nebular/nebular_scenes8.h @@ -31,9 +31,24 @@ namespace MADS { namespace Nebular { -class Scene804: public SceneLogic { +class Scene8xx : public SceneLogic { +protected: + /** + * Initial setup code shared by several scenes + */ + void setup1(); + + /** + * Initial setup code shared by several scenes + */ + void setup2(); public: - Scene804(Scene *scene): SceneLogic(scene) {} + Scene8xx(MADSEngine *vm) : SceneLogic(vm) {} +}; + +class Scene804: public Scene8xx { +public: + Scene804(MADSEngine *vm) : Scene8xx(vm) {} virtual void setup(); diff --git a/engines/mads/player.h b/engines/mads/player.h index cff131342d..896b8d5b16 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -65,6 +65,7 @@ public: uint32 _priorTimer; int _unk3; bool _forceRefresh; + Common::String _spritesPrefix; public: Player(MADSEngine *vm); diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index 8cfc1a290a..5e490c2719 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -303,6 +303,47 @@ Common::String Resources::formatName(RESPREFIX resType, int id, const Common::St return result; } +Common::String Resources::formatName(int prefix, char asciiCh, int id, EXTTYPE extType, + const Common::String &suffix) { + Common::String result; + if (prefix <= 0) { + result = "*"; + } + else { + result = Common::String::format("%s%.3d", + (prefix < 100) ? "*SC" : "*RM", prefix); + } + + result += Common::String::format("%c%d", asciiCh, id); + if (!suffix.empty()) + result += suffix; + + switch (extType) { + case EXT_SS: + result += ".SS"; + break; + case EXT_AA: + result += ".AA"; + break; + case EXT_DAT: + result += ".DAT"; + break; + case EXT_HH: + result += ".HH"; + break; + case EXT_ART: + result += ".ART"; + break; + case EXT_INT: + result += ".INT"; + break; + default: + break; + } + + return result; +} + Common::String Resources::formatResource(const Common::String &resName, const Common::String &hagFilename) { // int v1 = 0, v2 = 0; @@ -316,6 +357,10 @@ Common::String Resources::formatResource(const Common::String &resName, } } +Common::String Resources::formatAAName(int idx) { + return formatName(0, 'I', idx, EXT_AA, ""); +} + /*------------------------------------------------------------------------*/ void File::openFile(const Common::String &filename) { diff --git a/engines/mads/resources.h b/engines/mads/resources.h index 8fed0ab437..01f6490ecc 100644 --- a/engines/mads/resources.h +++ b/engines/mads/resources.h @@ -47,7 +47,10 @@ public: static void init(MADSEngine *vm); static Common::String formatName(RESPREFIX resType, int id, const Common::String &ext); + static Common::String formatName(int prefix, char asciiCh, int id, + EXTTYPE extType, const Common::String &suffix); static Common::String formatResource(const Common::String &resName, const Common::String &hagFilename); + static Common::String formatAAName(int idx); }; /** diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 7359562180..b285229926 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -107,7 +107,7 @@ void Scene::loadSceneLogic() { switch (_vm->getGameID()) { case GType_RexNebular: - _sceneLogic = Nebular::SceneFactory::createScene(this); + _sceneLogic = Nebular::SceneFactory::createScene(_vm); break; default: error("Unknown game"); diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 00632f6d2e..58fa36e037 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -715,4 +715,10 @@ void SceneInfoNebular::loadCodes(MSurface &depthSurface) { f.close(); } +/*------------------------------------------------------------------------*/ + +SceneLogic::SceneLogic(MADSEngine *vm) : _vm(vm) { + _scene = &_vm->_game->_scene; +} + } // End of namespace MADS diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index ce785e76ae..c4b6610e85 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -207,12 +207,13 @@ public: class SceneLogic { protected: + MADSEngine *_vm; Scene *_scene; public: /** * Constructor */ - SceneLogic(Scene *scene): _scene(scene) {} + SceneLogic(MADSEngine *vm); /** * Destructor |