diff options
author | Bendegúz Nagy | 2016-08-22 17:14:37 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | 2ee50eda35d65a79bc66003edbc28d3bc7600e1f (patch) | |
tree | 7f65ebe2068ed968e1b8287a41c6456c319815ff /engines | |
parent | f9323fe9fae6a45c0a4359775ba0383924a75c47 (diff) | |
download | scummvm-rg350-2ee50eda35d65a79bc66003edbc28d3bc7600e1f.tar.gz scummvm-rg350-2ee50eda35d65a79bc66003edbc28d3bc7600e1f.tar.bz2 scummvm-rg350-2ee50eda35d65a79bc66003edbc28d3bc7600e1f.zip |
DM: Add proper save header
Diffstat (limited to 'engines')
-rw-r--r-- | engines/dm/TODOs/todo.txt | 6 | ||||
-rw-r--r-- | engines/dm/dm.cpp | 3 | ||||
-rw-r--r-- | engines/dm/dm.h | 11 | ||||
-rw-r--r-- | engines/dm/loadsave.cpp | 24 |
4 files changed, 20 insertions, 24 deletions
diff --git a/engines/dm/TODOs/todo.txt b/engines/dm/TODOs/todo.txt index f3030084c5..4bd2d8a970 100644 --- a/engines/dm/TODOs/todo.txt +++ b/engines/dm/TODOs/todo.txt @@ -14,10 +14,8 @@ Todo: I forgot to add a bunch of warning for show/hide mouse pointer and other mouse functions Code stuff todo: - Complete stub methods(blitShrink, blitmask, scroller, etc.) - Save file f433_processCommand140_saveGame fails silently, add error checking - - Add loading from dungeon + Complete stub methods(blitShrink, blitmask, scroller) + Add proper save header, add error handling to it Fix incorrect thumbnail Add translations to f433_processCommand140_saveGame 'LOAD'
\ No newline at end of file diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index 075112b149..236fb76c31 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -166,8 +166,7 @@ DMEngine::DMEngine(OSystem *syst, const ADGameDescription *desc) : Engine(syst), _sound = nullptr; _engineShouldQuit = false; - _g528_saveFormat = 0; - _g527_platform = 0; + _g528_saveFormat = k_FORMAT_NONE; _g526_dungeonId = 0; _g298_newGame = 0; diff --git a/engines/dm/dm.h b/engines/dm/dm.h index 20b7bf8f29..98e8cb8a07 100644 --- a/engines/dm/dm.h +++ b/engines/dm/dm.h @@ -36,6 +36,7 @@ #include "console.h" #include <common/memstream.h> +#include <advancedDetector.h> struct ADGameDescription; @@ -57,6 +58,13 @@ 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, +}; void warning(bool repeat, const char *s, ...); @@ -233,8 +241,7 @@ public: Common::Language getGameLanguage(); private: - int16 _g528_saveFormat; // @ G0528_i_Format - int16 _g527_platform; // @ G0527_i_Platform + 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 diff --git a/engines/dm/loadsave.cpp b/engines/dm/loadsave.cpp index 7857d498d2..09b4d70c01 100644 --- a/engines/dm/loadsave.cpp +++ b/engines/dm/loadsave.cpp @@ -42,9 +42,6 @@ namespace DM { -#define C2_FORMAT_DM_AMIGA_2X_PC98_X68000_FM_TOWNS_CSB_ATARI_ST 2 -#define C3_PLATFORM_AMIGA 3 -#define C10_DUNGEON_DM 10 LoadgameResponse DMEngine::f435_loadgame(int16 slot) { if (slot == -1 && _g298_newGame == k0_modeLoadSavedGame) @@ -56,10 +53,9 @@ LoadgameResponse DMEngine::f435_loadgame(int16 slot) { Common::InSaveFile *file = nullptr; struct { - int16 _saveFormat; - int16 _saveAndPlayChoice; + SaveFormat _saveFormat; + int32 _saveVersion; int32 _gameId; - int16 _platform; uint16 _dungeonId; } dmSaveHeader; @@ -69,9 +65,8 @@ LoadgameResponse DMEngine::f435_loadgame(int16 slot) { file = saveFileManager->openForLoading(fileName); } - _g528_saveFormat = C2_FORMAT_DM_AMIGA_2X_PC98_X68000_FM_TOWNS_CSB_ATARI_ST; - _g527_platform = C3_PLATFORM_AMIGA; - _g526_dungeonId = C10_DUNGEON_DM; + 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; @@ -84,10 +79,9 @@ LoadgameResponse DMEngine::f435_loadgame(int16 slot) { warning(false, "MISSING CODE: missing check for matching format and platform in save in f435_loadgame"); - dmSaveHeader._saveFormat = file->readSint16BE(); - dmSaveHeader._saveAndPlayChoice = file->readSint16BE(); + dmSaveHeader._saveFormat = (SaveFormat)file->readSint32BE(); + dmSaveHeader._saveVersion = file->readSint32BE(); dmSaveHeader._gameId = file->readSint32BE(); - dmSaveHeader._platform = file->readSint16BE(); dmSaveHeader._dungeonId = file->readUint16BE(); _g525_gameId = dmSaveHeader._gameId; @@ -142,7 +136,6 @@ LoadgameResponse DMEngine::f435_loadgame(int16 slot) { } } else { _g528_saveFormat = dmSaveHeader._saveFormat; - _g527_platform = dmSaveHeader._platform; _g526_dungeonId = dmSaveHeader._dungeonId; _g524_restartGameAllowed = true; @@ -302,10 +295,9 @@ bool DMEngine::writeCompleteSaveFile(int16 saveSlot, Common::String& saveDescrip writeSaveGameHeader(file, saveDescription); - file->writeSint16BE(_g528_saveFormat); - file->writeSint16BE(saveAndPlayChoice); + file->writeSint32BE(_g528_saveFormat); + file->writeSint32BE(1); // save version file->writeSint32BE(_g525_gameId); - file->writeSint16BE(_g527_platform); file->writeUint16BE(_g526_dungeonId); // write C0_SAVE_PART_GLOBAL_DATA part |