mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 16:03:24 +00:00
MADS: Misc savegame fixes and added meta query info
This commit is contained in:
parent
dbbd7feab7
commit
a54aeaccce
@ -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;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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 {
|
||||
|
@ -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];
|
||||
|
@ -47,7 +47,7 @@ bool VisitedScenes::exists(int sceneId) {
|
||||
}
|
||||
|
||||
void VisitedScenes::synchronize(Common::Serializer &s) {
|
||||
SynchronizedList:synchronize(s);
|
||||
SynchronizedList::synchronize(s);
|
||||
s.syncAsByte(_sceneRevisited);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user