diff options
author | Matthew Stewart | 2018-06-05 04:18:14 -0400 |
---|---|---|
committer | Eugene Sandulenko | 2018-08-09 08:37:30 +0200 |
commit | 84a30e4dce6bdaf3d40656342e53b5dcd12746be (patch) | |
tree | 32476f0e810340b5947ab44ad9b7059a391ecce0 /engines/startrek/startrek.h | |
parent | c17bef8285086d438a03fcff6ae5f3d15b5532e8 (diff) | |
download | scummvm-rg350-84a30e4dce6bdaf3d40656342e53b5dcd12746be.tar.gz scummvm-rg350-84a30e4dce6bdaf3d40656342e53b5dcd12746be.tar.bz2 scummvm-rg350-84a30e4dce6bdaf3d40656342e53b5dcd12746be.zip |
STARTREK: Preliminary saving/loading
Diffstat (limited to 'engines/startrek/startrek.h')
-rw-r--r-- | engines/startrek/startrek.h | 56 |
1 files changed, 53 insertions, 3 deletions
diff --git a/engines/startrek/startrek.h b/engines/startrek/startrek.h index 52d23c5677..cf678ebd83 100644 --- a/engines/startrek/startrek.h +++ b/engines/startrek/startrek.h @@ -29,11 +29,14 @@ #include "common/random.h" #include "common/rect.h" #include "common/scummsys.h" +#include "common/serializer.h" #include "common/str.h" #include "common/stream.h" #include "common/system.h" #include "common/util.h" +#include "gui/saveload-dialog.h" + #include "engines/engine.h" #include "startrek/action.h" @@ -60,6 +63,32 @@ class Room; typedef String (StarTrekEngine::*TextGetterFunc)(int, uintptr, String *); +const int SAVEGAME_DESCRIPTION_LEN = 30; + +struct SavegameMetadata { + uint32 version; + char description[SAVEGAME_DESCRIPTION_LEN + 1]; + + uint32 saveDate; + uint16 saveTime; + byte saveTimeSecs; + uint32 playTime; + + ::Graphics::Surface *thumbnail; + + void setSaveTimeAndDate(TimeDate time) { + saveDate = ((time.tm_mday & 0xFF) << 24) | (((time.tm_mon + 1) & 0xFF) << 16) | ((time.tm_year + 1900) & 0xFFFF); + saveTime = ((time.tm_hour & 0xFF) << 8) | ((time.tm_min) & 0xFF); + saveTimeSecs = time.tm_sec & 0xFF; + } + + int getDay() { return (saveDate >> 24) & 0xFF; } + int getMonth() { return (saveDate >> 16) & 0xFF; } + int getYear() { return saveDate & 0xFFFF; } + int getHour() { return (saveTime >> 8) & 0xFF; } + int getMinute() { return saveTime & 0xFF; } +}; + const int MAX_MENUBUTTONS = 32; const int TEXTBOX_WIDTH = 26; @@ -79,7 +108,8 @@ enum StarTrekGameFeatures { enum kDebugLevels { kDebugSound = 1 << 0, - kDebugGraphics = 1 << 1 + kDebugGraphics = 1 << 1, + kDebugSavegame = 2 << 1 }; enum GameMode { @@ -209,6 +239,10 @@ private: // Transporter room void runTransportSequence(const Common::String &name); + // Bridge + void initBridge(bool b) {}; // TODO + void cleanupBridge() {}; // TODO + public: StarTrekEngine(OSystem *syst, const StarTrekGameDescription *gamedesc); virtual ~StarTrekEngine(); @@ -314,8 +348,6 @@ public: void unloadMenuButtons(); void chooseMouseBitmapForAction(int action, bool withRedOutline); - void showSaveMenu(); - void showLoadMenu(); void showQuitGamePrompt(int x, int y); void showGameOverMenu(); void showTextConfigurationMenu(bool fromOptionMenu); @@ -333,6 +365,18 @@ private: // Saved value of StarTrekEngine::_keyboardControlsMouse when menus are up bool _keyboardControlsMouseOutsideMenu; + // saveload.cpp +public: + bool showSaveMenu(); + bool showLoadMenu(); + + bool saveGame(int slot, Common::String desc); + bool loadGame(int slot); + + bool saveOrLoadGameData(Common::SeekableReadStream *in, Common::WriteStream *out, SavegameMetadata *meta); + + Common::String getSavegameFilename(int slotId) const; + // Detection related functions public: const StarTrekGameDescription *_gameDescription; @@ -358,6 +402,9 @@ public: int _gameMode; int _lastGameMode; + // NOTE: this has a different meaning than the original game. When non-empty, a new + // room load is triggered, as opposed to original behaviour where this was only read + // when "loadRoom" was called. Common::String _missionToLoad; int _roomIndexToLoad; int _spawnIndexToLoad; @@ -438,6 +485,9 @@ private: SharedPtr<Room> _room; }; +// Static function +bool saveOrLoadMetadata(Common::SeekableReadStream *in, Common::WriteStream *out, SavegameMetadata *meta); + } // End of namespace StarTrek #endif |