aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2014-05-02 21:29:33 -0400
committerPaul Gilbert2014-05-02 21:29:33 -0400
commita54aeaccce5d3db455a0017ce302065b29e6c215 (patch)
tree29fd9a012c6033887eebba460fb60cbd9803501f /engines
parentdbbd7feab727e463f4aed0e9b496aaca99efddcd (diff)
downloadscummvm-rg350-a54aeaccce5d3db455a0017ce302065b29e6c215.tar.gz
scummvm-rg350-a54aeaccce5d3db455a0017ce302065b29e6c215.tar.bz2
scummvm-rg350-a54aeaccce5d3db455a0017ce302065b29e6c215.zip
MADS: Misc savegame fixes and added meta query info
Diffstat (limited to 'engines')
-rw-r--r--engines/mads/detection.cpp9
-rw-r--r--engines/mads/events.cpp3
-rw-r--r--engines/mads/events.h3
-rw-r--r--engines/mads/game.cpp5
-rw-r--r--engines/mads/game_data.cpp2
-rw-r--r--engines/mads/mads.cpp8
6 files changed, 20 insertions, 10 deletions
diff --git a/engines/mads/detection.cpp b/engines/mads/detection.cpp
index 49253f0e3a..971acde024 100644
--- a/engines/mads/detection.cpp
+++ b/engines/mads/detection.cpp
@@ -31,6 +31,7 @@
#include "common/system.h"
#include "graphics/colormasks.h"
#include "graphics/surface.h"
+#include "mads/events.h"
#include "mads/game.h"
#define MAX_SAVES 99
@@ -168,10 +169,16 @@ SaveStateDescriptor MADSMetaEngine::querySaveMetaInfos(const char *target, int s
Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(filename);
if (f) {
+ MADS::MADSSavegameHeader header;
+ MADS::Game::readSavegameHeader(f, header);
delete f;
// Create the return descriptor
- SaveStateDescriptor desc(slot, "");
+ SaveStateDescriptor desc(slot, header._saveName);
+ desc.setThumbnail(header._thumbnail);
+ desc.setSaveDate(header._year, header._month, header._day);
+ desc.setSaveTime(header._hour, header._minute);
+ desc.setPlayTime(header._totalFrames * GAME_FRAME_TIME);
return desc;
}
diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp
index 6ec16402ef..5d6a16ff1f 100644
--- a/engines/mads/events.cpp
+++ b/engines/mads/events.cpp
@@ -28,9 +28,6 @@
#include "mads/events.h"
#include "mads/scene.h"
-#define GAME_FRAME_RATE 50
-#define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE)
-
namespace MADS {
EventsManager::EventsManager(MADSEngine *vm) {
diff --git a/engines/mads/events.h b/engines/mads/events.h
index 6428108709..5f9a899f65 100644
--- a/engines/mads/events.h
+++ b/engines/mads/events.h
@@ -34,6 +34,9 @@ namespace MADS {
enum CursorType { CURSOR_NONE = 0, CURSOR_ARROW = 1, CURSOR_WAIT = 2, CURSOR_GO_DOWN = 3,
CURSOR_GO_UP = 4, CURSOR_GO_LEFT = 5, CURSOR_GO_RIGHT = 6 };
+#define GAME_FRAME_RATE 50
+#define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE)
+
class MADSEngine;
class EventsManager {
diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp
index 36b0c315d7..a63fec424e 100644
--- a/engines/mads/game.cpp
+++ b/engines/mads/game.cpp
@@ -519,7 +519,7 @@ const char *const SAVEGAME_STR = "MADS";
bool Game::readSavegameHeader(Common::InSaveFile *in, MADSSavegameHeader &header) {
char saveIdentBuffer[SAVEGAME_STR_SIZE + 1];
- header._thumbnail = NULL;
+ header._thumbnail = nullptr;
// Validate the header Id
in->read(saveIdentBuffer, SAVEGAME_STR_SIZE + 1);
@@ -558,7 +558,8 @@ void Game::writeSavegameHeader(Common::OutSaveFile *out, MADSSavegameHeader &hea
out->writeByte(MADS_SAVEGAME_VERSION);
// Write savegame name
- out->write(header._saveName.c_str(), header._saveName.size() + 1);
+ out->write(header._saveName.c_str(), header._saveName.size());
+ out->writeByte('\0');
// Get the active palette
uint8 thumbPalette[256 * 3];
diff --git a/engines/mads/game_data.cpp b/engines/mads/game_data.cpp
index 4a9d02c75f..0e2dcec70f 100644
--- a/engines/mads/game_data.cpp
+++ b/engines/mads/game_data.cpp
@@ -47,7 +47,7 @@ bool VisitedScenes::exists(int sceneId) {
}
void VisitedScenes::synchronize(Common::Serializer &s) {
- SynchronizedList:synchronize(s);
+ SynchronizedList::synchronize(s);
s.syncAsByte(_sceneRevisited);
}
diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp
index 29db804f16..a099f5904e 100644
--- a/engines/mads/mads.cpp
+++ b/engines/mads/mads.cpp
@@ -122,13 +122,15 @@ int MADSEngine::hypotenuse(int xv, int yv) {
}
bool MADSEngine::canLoadGameStateCurrently() {
- return !_game->_winStatus && !_game->globals()[5]
- && _dialogs->_pendingDialog == DIALOG_NONE;
+ return !_game->_winStatus && !_game->globals()[5]
+ && _dialogs->_pendingDialog == DIALOG_NONE
+ && _events->_cursorId == CURSOR_ARROW;
}
bool MADSEngine::canSaveGameStateCurrently() {
return !_game->_winStatus && !_game->globals()[5]
- && _dialogs->_pendingDialog == DIALOG_NONE;
+ && _dialogs->_pendingDialog == DIALOG_NONE
+ && _events->_cursorId == CURSOR_ARROW;
}
/**