diff options
author | Bendegúz Nagy | 2016-08-23 15:39:05 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | 2bdabc3b7afe9ba857bfc2be7ac638a566d09bf4 (patch) | |
tree | b2717c0e92cc1260d0f08e5dd428409ed7f904b2 /engines | |
parent | 2199f879bdcd27806e304782423e2b3e838d6bbc (diff) | |
download | scummvm-rg350-2bdabc3b7afe9ba857bfc2be7ac638a566d09bf4.tar.gz scummvm-rg350-2bdabc3b7afe9ba857bfc2be7ac638a566d09bf4.tar.bz2 scummvm-rg350-2bdabc3b7afe9ba857bfc2be7ac638a566d09bf4.zip |
DM: Add target and original platform to save files
Diffstat (limited to 'engines')
-rw-r--r-- | engines/dm/detection.cpp | 30 | ||||
-rw-r--r-- | engines/dm/dm.cpp | 7 | ||||
-rw-r--r-- | engines/dm/dm.h | 52 | ||||
-rw-r--r-- | engines/dm/loadsave.cpp | 17 | ||||
-rw-r--r-- | engines/dm/sounds.cpp | 4 | ||||
-rw-r--r-- | engines/dm/sounds.h | 2 |
6 files changed, 73 insertions, 39 deletions
diff --git a/engines/dm/detection.cpp b/engines/dm/detection.cpp index 7f506ac478..ebdae4ea1f 100644 --- a/engines/dm/detection.cpp +++ b/engines/dm/detection.cpp @@ -40,7 +40,7 @@ static const PlainGameDescriptor DMGames[] = { {0, 0} }; -static const ADGameDescription gameDescriptions[] = { +static const DMADGameDescription gameDescriptions[] = { { "dm", "Amiga 2.0v English", { @@ -48,7 +48,11 @@ static const ADGameDescription gameDescriptions[] = { {"Dungeon.dat", 0, "43a213da8eda413541dd12f90ce202f6", 25006}, AD_LISTEND }, - Common::EN_ANY, Common::kPlatformAmiga, ADGF_NO_FLAGS, GUIO1(GUIO_NONE) + Common::EN_ANY, Common::kPlatformAmiga, ADGF_NO_FLAGS, GUIO1(GUIO_NONE), + k_saveTarget_DM21, k_saveFormat_dm_amiga__2_x_pc98_x68000_fm_towns_csb_atari_st, k_savePlatform_amiga, + { k_saveTarget_DM21, k_saveTarget_endOfList }, + { k_saveFormat_dm_amiga__2_x_pc98_x68000_fm_towns_csb_atari_st, k_saveFormat_endOfList}, + { k_savePlatform_accept_any} }, { "dm", "Atari ???v English", @@ -57,22 +61,16 @@ static const ADGameDescription gameDescriptions[] = { {"Dungeon.dat", 0, "be9468b460515741babec9a70501e2e9", 33286}, AD_LISTEND }, - Common::EN_ANY, Common::kPlatformAtariST, ADGF_NO_FLAGS, GUIO1(GUIO_NONE) + Common::EN_ANY, Common::kPlatformAtariST, ADGF_NO_FLAGS, GUIO1(GUIO_NONE), + k_saveTarget_DM21, k_saveFormat_dm_amiga__2_x_pc98_x68000_fm_towns_csb_atari_st, k_savePlatform_atari_st, + { k_saveTarget_DM21, k_saveTarget_endOfList}, + { k_saveFormat_dm_amiga__2_x_pc98_x68000_fm_towns_csb_atari_st, k_saveFormat_endOfList}, + { k_savePlatform_accept_any } }, AD_TABLE_END_MARKER }; -static ADGameDescription fallbackDesc = { - "dm", - "Unknown version", - AD_ENTRY1(0, 0), // This should always be AD_ENTRY1(0, 0) in the fallback descriptor - Common::UNK_LANG, - Common::kPlatformDOS, - ADGF_NO_FLAGS, - GUIO1(GUIO_NONE) -}; - static const ADExtraGuiOptionsMap optionsList[] = { AD_EXTRA_GUI_OPTIONS_TERMINATOR @@ -81,7 +79,7 @@ static const ADExtraGuiOptionsMap optionsList[] = { class DMMetaEngine : public AdvancedMetaEngine { public: - DMMetaEngine() : AdvancedMetaEngine(DM::gameDescriptions, sizeof(ADGameDescription), DMGames, optionsList) { + DMMetaEngine() : AdvancedMetaEngine(DM::gameDescriptions, sizeof(DMADGameDescription), DMGames, optionsList) { _singleId = "dm"; } @@ -93,11 +91,9 @@ public: return "Dummy"; } - virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const { return gameDescriptions; } - virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { if (desc) - *engine = new DM::DMEngine(syst, desc); + *engine = new DM::DMEngine(syst, (DMADGameDescription*)desc); return desc != nullptr; } diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index bfb6147f9f..ceb3ae5ef9 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -146,7 +146,7 @@ int16 M38_distance(int16 mapx1, int16 mapy1, int16 mapx2, int16 mapy2) { return ABS(mapx1 - mapx2) + ABS(mapy1 - mapy2); } -DMEngine::DMEngine(OSystem *syst, const ADGameDescription *desc) : Engine(syst), _console(nullptr), _gameVersion(desc) { +DMEngine::DMEngine(OSystem *syst, const DMADGameDescription *desc) : Engine(syst), _console(nullptr), _gameVersion(desc) { // register random source _rnd = new Common::RandomSource("dm"); @@ -166,7 +166,6 @@ DMEngine::DMEngine(OSystem *syst, const ADGameDescription *desc) : Engine(syst), _sound = nullptr; _engineShouldQuit = false; - _g528_saveFormat = k_FORMAT_NONE; _g526_dungeonId = 0; _g298_newGame = 0; @@ -520,7 +519,7 @@ void DMEngine::f2_gameloop() { } _system->delayMillis(2); - if (++vblankCounter >= _g318_waitForInputMaxVerticalBlankCount * 5) + if (++vblankCounter >= _g318_waitForInputMaxVerticalBlankCount * 4) _g321_stopWaitingForPlayerInput = true; } while (!_g321_stopWaitingForPlayerInput || !_g301_gameTimeTicking); @@ -1082,5 +1081,5 @@ void DMEngine::f445_STARTEND_fuseSequenceUpdate() { The ending animation when Lord Chaos is fused plays too quickly because the execution speed is not limited */ } -Common::Language DMEngine::getGameLanguage() { return _gameVersion->language; } +Common::Language DMEngine::getGameLanguage() { return _gameVersion->_desc.language; } } // End of namespace DM diff --git a/engines/dm/dm.h b/engines/dm/dm.h index 98e8cb8a07..e115c8f803 100644 --- a/engines/dm/dm.h +++ b/engines/dm/dm.h @@ -58,12 +58,47 @@ class ProjExpl; class DialogMan; class SoundMan; -enum SaveFormat { - k_FORMAT_NONE = 0, - k_FORMAT_DM_ATARI_ST = 1, - k_FORMAT_DM_AMIGA_2X_PC98_X68000_FM_TOWNS_CSB_ATARI_ST = 2, - k_FORMAT_DM_APPLE_IIGS = 3, - k_FORMAT_DM_AMIGA_36_PC_CSB_AMIGA_PC98_X68000_FM_TOWNS = 5, +enum OriginalSaveFormat { + k_saveFormat_accept_any = -1, + k_saveFormat_endOfList = 0, + k_saveFormat_dm_atari_st = 1, + k_saveFormat_dm_amiga__2_x_pc98_x68000_fm_towns_csb_atari_st = 2, + k_saveFormat_dm_apple_iigs = 3, + k_saveFormat_dm_amiga_36_pc_csb_amiga_pc98_x68000_fm_towns = 5, + k_saveFormat_total +}; + +enum OriginalSavePlatform { + k_savePlatform_accept_any = -1, + k_savePlatform_endOfList = 0, + k_savePlatform_atari_st = 1, // @ C1_PLATFORM_ATARI_ST + k_savePlatform_apple_iigs = 2, // @ C2_PLATFORM_APPLE_IIGS + k_savePlatform_amiga = 3, // @ C3_PLATFORM_AMIGA + k_savePlatform_pc98 = 5, // @ C5_PLATFORM_PC98 + k_savePlatform_x68000 = 6, // @ C6_PLATFORM_X68000 + k_savePlatform_fm_towns_en = 7, // @ C7_PLATFORM_FM_TOWNS_EN + k_savePlatform_fm_towns_jp = 8, // @ C8_PLATFORM_FM_TOWNS_JP + k_savePlatform_pc = 9, // @ C9_PLATFORM_PC + k_savePlatform_total +}; + +enum SaveTarget { + k_saveTarget_accept_any = -1, + k_saveTarget_endOfList = 0, + k_saveTarget_DM21 = 1, + k_saveTarget_total +}; + +struct DMADGameDescription { + ADGameDescription _desc; + + SaveTarget _saveTargetToWrite; + OriginalSaveFormat _origSaveFormatToWrite; + OriginalSavePlatform _origPlatformToWrite; + + SaveTarget _saveTargetToAccept[k_saveTarget_total + 1]; + OriginalSaveFormat _saveFormatToAccept[k_saveFormat_total + 1]; + OriginalSavePlatform _origPlatformToAccept[k_savePlatform_total + 1]; }; void warning(bool repeat, const char *s, ...); @@ -212,7 +247,7 @@ class DMEngine : public Engine { bool writeCompleteSaveFile(int16 slot, Common::String &desc, int16 saveAndPlayChoice); void f439_drawEntrance(); // @ F0439_STARTEND_DrawEntrance public: - explicit DMEngine(OSystem *syst, const ADGameDescription *gameDesc); + explicit DMEngine(OSystem *syst, const DMADGameDescription *gameDesc); ~DMEngine(); virtual bool hasFeature(EngineFeature f) const; @@ -241,14 +276,13 @@ public: Common::Language getGameLanguage(); private: - SaveFormat _g528_saveFormat; // @ G0528_i_Format uint16 _g526_dungeonId; // @ G0526_ui_DungeonID byte *_g562_entranceDoorAnimSteps[10]; // @ G0562_apuc_Bitmap_EntranceDoorAnimationSteps byte *_g564_interfaceCredits; // @ G0564_puc_Graphic5_InterfaceCredits Common::RandomSource *_rnd; byte *_savedScreenForOpenEntranceDoors; // ad-hoc HACK - const ADGameDescription *_gameVersion; + const DMADGameDescription *_gameVersion; bool _canLoadFromGMM; public: Console *_console; diff --git a/engines/dm/loadsave.cpp b/engines/dm/loadsave.cpp index 09b4d70c01..4d486cfbd6 100644 --- a/engines/dm/loadsave.cpp +++ b/engines/dm/loadsave.cpp @@ -53,8 +53,11 @@ LoadgameResponse DMEngine::f435_loadgame(int16 slot) { Common::InSaveFile *file = nullptr; struct { - SaveFormat _saveFormat; + SaveTarget _saveTarget; int32 _saveVersion; + OriginalSaveFormat _saveFormat; + OriginalSavePlatform _savePlatform; + int32 _gameId; uint16 _dungeonId; } dmSaveHeader; @@ -65,8 +68,6 @@ LoadgameResponse DMEngine::f435_loadgame(int16 slot) { file = saveFileManager->openForLoading(fileName); } - dmSaveHeader._saveFormat = k_FORMAT_DM_AMIGA_2X_PC98_X68000_FM_TOWNS_CSB_ATARI_ST; - if (_g298_newGame) { //L1366_B_FadePalette = !F0428_DIALOG_RequireGameDiskInDrive_NoDialogDrawn(C0_DO_NOT_FORCE_DIALOG_DM_CSB, true); _g524_restartGameAllowed = false; @@ -79,8 +80,11 @@ LoadgameResponse DMEngine::f435_loadgame(int16 slot) { warning(false, "MISSING CODE: missing check for matching format and platform in save in f435_loadgame"); - dmSaveHeader._saveFormat = (SaveFormat)file->readSint32BE(); + + dmSaveHeader._saveTarget = (SaveTarget)file->readSint32BE(); dmSaveHeader._saveVersion = file->readSint32BE(); + dmSaveHeader._saveFormat = (OriginalSaveFormat)file->readSint32BE(); + dmSaveHeader._savePlatform = (OriginalSavePlatform)file->readSint32BE(); dmSaveHeader._gameId = file->readSint32BE(); dmSaveHeader._dungeonId = file->readUint16BE(); @@ -135,7 +139,6 @@ LoadgameResponse DMEngine::f435_loadgame(int16 slot) { _displayMan->f436_STARTEND_FadeToPalette(_displayMan->_g347_paletteTopAndBottomScreen); } } else { - _g528_saveFormat = dmSaveHeader._saveFormat; _g526_dungeonId = dmSaveHeader._dungeonId; _g524_restartGameAllowed = true; @@ -295,8 +298,10 @@ bool DMEngine::writeCompleteSaveFile(int16 saveSlot, Common::String& saveDescrip writeSaveGameHeader(file, saveDescription); - file->writeSint32BE(_g528_saveFormat); + file->writeSint32BE(_gameVersion->_saveTargetToWrite); file->writeSint32BE(1); // save version + file->writeSint32BE(_gameVersion->_origSaveFormatToWrite); + file->writeSint32BE(_gameVersion->_origPlatformToWrite); file->writeSint32BE(_g525_gameId); file->writeUint16BE(_g526_dungeonId); diff --git a/engines/dm/sounds.cpp b/engines/dm/sounds.cpp index ad9bc09f97..c041715fd3 100644 --- a/engines/dm/sounds.cpp +++ b/engines/dm/sounds.cpp @@ -39,8 +39,8 @@ namespace DM { -SoundMan* SoundMan::getSoundMan(DMEngine* vm, const ADGameDescription* gameVersion) { - switch (gameVersion->platform) { +SoundMan* SoundMan::getSoundMan(DMEngine* vm, const DMADGameDescription* gameVersion) { + switch (gameVersion->_desc.platform) { default: warning(false, "Unknown platform, using default Amiga SoundMan"); case Common::kPlatformAmiga: return new SoundMan(vm); case Common::kPlatformAtariST: return new SoundMan_Atari(vm); diff --git a/engines/dm/sounds.h b/engines/dm/sounds.h index 8dfb3afa6c..adbc019027 100644 --- a/engines/dm/sounds.h +++ b/engines/dm/sounds.h @@ -68,7 +68,7 @@ protected: public: virtual ~SoundMan(); - static SoundMan *getSoundMan(DMEngine *vm, const ADGameDescription *gameVersion); + static SoundMan *getSoundMan(DMEngine *vm, const DMADGameDescription *gameVersion); SoundData _gK24_soundData[k34_D13_soundCount]; // @ K0024_as_SoundData Common::Queue<PendingSound> _pendingSounds; |