mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-02 06:41:51 +00:00
DRASCULA: Add possibility to load and save games using GMM
This commit is contained in:
parent
9527139deb
commit
c095cb31d1
3
NEWS
3
NEWS
@ -35,8 +35,9 @@ For a more comprehensive changelog of the latest experimental code, see:
|
||||
- Added save/load from General Main Menu.
|
||||
|
||||
Drascula:
|
||||
- Add handling of the master volume and fix volume synchronization between
|
||||
- Added handling of the master volume and fix volume synchronization between
|
||||
the game and ScummVM options.
|
||||
- Added possibility to load and save games using GMM.
|
||||
|
||||
1.9.1 (YYYY-MM-DD)
|
||||
General:
|
||||
|
@ -76,7 +76,8 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam
|
||||
framesWithoutAction = 0;
|
||||
term_int = 0;
|
||||
currentChapter = 0;
|
||||
_loadedDifferentChapter = 0;
|
||||
_loadedDifferentChapter = false;
|
||||
_canSaveLoad = false;
|
||||
musicStopped = 0;
|
||||
FrameSSN = 0;
|
||||
globalSpeed = 0;
|
||||
@ -230,7 +231,7 @@ DrasculaEngine::~DrasculaEngine() {
|
||||
|
||||
bool DrasculaEngine::hasFeature(EngineFeature f) const {
|
||||
return
|
||||
(f == kSupportsRTL);
|
||||
(f == kSupportsRTL || f == kSupportsLoadingDuringRuntime || f == kSupportsSavingDuringRuntime);
|
||||
}
|
||||
|
||||
Common::Error DrasculaEngine::run() {
|
||||
@ -575,6 +576,7 @@ bool DrasculaEngine::runCurrentChapter() {
|
||||
playMusic(roomMusic);
|
||||
}
|
||||
|
||||
_canSaveLoad = true;
|
||||
delay(25);
|
||||
#ifndef _WIN32_WCE
|
||||
// FIXME
|
||||
@ -585,6 +587,9 @@ bool DrasculaEngine::runCurrentChapter() {
|
||||
// events in the wince port.
|
||||
updateEvents();
|
||||
#endif
|
||||
_canSaveLoad = false;
|
||||
if (_loadedDifferentChapter)
|
||||
return true;
|
||||
|
||||
if (!_menuScreen && takeObject == 1)
|
||||
checkObjects();
|
||||
@ -663,7 +668,11 @@ bool DrasculaEngine::runCurrentChapter() {
|
||||
|
||||
_menuBar = (_mouseY < 24 && !_menuScreen) ? true : false;
|
||||
|
||||
_canSaveLoad = true;
|
||||
Common::KeyCode key = getScan();
|
||||
_canSaveLoad = false;
|
||||
if (_loadedDifferentChapter)
|
||||
return true;
|
||||
if (key == Common::KEYCODE_F1 && !_menuScreen) {
|
||||
selectVerb(kVerbLook);
|
||||
} else if (key == Common::KEYCODE_F2 && !_menuScreen) {
|
||||
@ -881,7 +890,7 @@ void DrasculaEngine::delay(int ms) {
|
||||
_system->delayMillis(10);
|
||||
updateEvents();
|
||||
_system->updateScreen();
|
||||
} while (_system->getMillis() < end && !shouldQuit());
|
||||
} while (_system->getMillis() < end && !shouldQuit() && !_loadedDifferentChapter);
|
||||
}
|
||||
|
||||
void DrasculaEngine::pause(int duration) {
|
||||
|
@ -327,6 +327,11 @@ public:
|
||||
|
||||
virtual void syncSoundSettings();
|
||||
|
||||
virtual Common::Error loadGameState(int slot);
|
||||
virtual bool canLoadGameStateCurrently();
|
||||
virtual Common::Error saveGameState(int slot, const Common::String &desc);
|
||||
virtual bool canSaveGameStateCurrently();
|
||||
|
||||
Common::RandomSource *_rnd;
|
||||
const DrasculaGameDescription *_gameDescription;
|
||||
uint32 getFeatures() const;
|
||||
@ -457,6 +462,7 @@ public:
|
||||
int currentChapter;
|
||||
bool _loadedDifferentChapter;
|
||||
int _currentSaveSlot;
|
||||
bool _canSaveLoad;
|
||||
int _color;
|
||||
int musicStopped;
|
||||
int _mouseX, _mouseY, _leftMouseButton, _rightMouseButton;
|
||||
@ -497,10 +503,10 @@ public:
|
||||
bool scummVMSaveLoadDialog(bool isSave);
|
||||
Common::String enterName(Common::String &selectedName);
|
||||
void loadSaveNames();
|
||||
void saveGame(int slot, Common::String &desc);
|
||||
void saveGame(int slot, const Common::String &desc);
|
||||
bool loadGame(int slot);
|
||||
void checkForOldSaveGames();
|
||||
void convertSaveGame(int slot, Common::String &desc);
|
||||
void convertSaveGame(int slot, const Common::String &desc);
|
||||
|
||||
void print_abc(const char *, int, int);
|
||||
void delay(int ms);
|
||||
|
@ -138,7 +138,7 @@ SaveStateDescriptor loadMetaData(Common::ReadStream *s, int slot, bool setPlayTi
|
||||
return desc;
|
||||
}
|
||||
|
||||
void saveMetaData(Common::WriteStream *s, Common::String &desc) {
|
||||
void saveMetaData(Common::WriteStream *s, const Common::String &desc) {
|
||||
TimeDate curTime;
|
||||
g_system->getTimeAndDate(curTime);
|
||||
|
||||
@ -155,7 +155,7 @@ void saveMetaData(Common::WriteStream *s, Common::String &desc) {
|
||||
s->writeUint32LE(playTime);
|
||||
}
|
||||
|
||||
void DrasculaEngine::convertSaveGame(int slot, Common::String &desc) {
|
||||
void DrasculaEngine::convertSaveGame(int slot, const Common::String &desc) {
|
||||
Common::String oldFileName = Common::String::format("%s%02d", _targetName.c_str(), slot);
|
||||
Common::String newFileName = Common::String::format("%s.%03d", _targetName.c_str(), slot);
|
||||
Common::InSaveFile *oldFile = _saveFileMan->openForLoading(oldFileName);
|
||||
@ -188,6 +188,26 @@ void DrasculaEngine::convertSaveGame(int slot, Common::String &desc) {
|
||||
_saveFileMan->removeSavefile(oldFileName);
|
||||
}
|
||||
|
||||
Common::Error DrasculaEngine::loadGameState(int slot) {
|
||||
// The boolean returned by loadGame() indicates if loading is in the same
|
||||
// chapter or in a different one. Thus it does not indicate an error.
|
||||
loadGame(slot);
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
bool DrasculaEngine::canLoadGameStateCurrently() {
|
||||
return _canSaveLoad;
|
||||
}
|
||||
|
||||
Common::Error DrasculaEngine::saveGameState(int slot, const Common::String &desc) {
|
||||
saveGame(slot, desc);
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
bool DrasculaEngine::canSaveGameStateCurrently() {
|
||||
return _canSaveLoad;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the first 10 save names, to be used in Drascula's save/load screen
|
||||
*/
|
||||
@ -205,7 +225,7 @@ void DrasculaEngine::loadSaveNames() {
|
||||
}
|
||||
}
|
||||
|
||||
void DrasculaEngine::saveGame(int slot, Common::String &desc) {
|
||||
void DrasculaEngine::saveGame(int slot, const Common::String &desc) {
|
||||
Common::OutSaveFile *out;
|
||||
int l;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user