mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
GLK: ADVSYS: Added code for loading savegames from launcher
This commit is contained in:
parent
f80c11cf34
commit
acc90002f6
@ -22,11 +22,15 @@
|
||||
|
||||
#include "glk/advsys/advsys.h"
|
||||
#include "common/translation.h"
|
||||
#include "common/config-manager.h"
|
||||
|
||||
namespace Glk {
|
||||
namespace AdvSys {
|
||||
|
||||
void AdvSys::runGame() {
|
||||
// Check for savegame
|
||||
_saveSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
|
||||
|
||||
if (!initialize()) {
|
||||
GUIErrorMessage(_("Could not start AdvSys game"));
|
||||
return;
|
||||
@ -37,6 +41,13 @@ void AdvSys::runGame() {
|
||||
// Run game startup
|
||||
execute(_initCodeOffset);
|
||||
|
||||
if (_saveSlot != -1) {
|
||||
Common::ErrorCode err = loadGameState(_saveSlot).getCode();
|
||||
_saveSlot = -1;
|
||||
if (err != Common::kNoError)
|
||||
print(_("Sorry, the savegame couldn't be restored"));
|
||||
}
|
||||
|
||||
// Gameplay loop
|
||||
while (!shouldQuit() && !shouldRestart()) {
|
||||
// Run update code
|
||||
|
@ -31,7 +31,10 @@ bool GlkInterface::initialize() {
|
||||
}
|
||||
|
||||
void GlkInterface::print(const Common::String &msg) {
|
||||
glk_put_string_stream(glk_window_get_stream(_window), msg.c_str());
|
||||
// Don't print out text if loading a savegame directly from the launcher, since we don't
|
||||
// want any of the intro text displayed by the startup code to show
|
||||
if (_saveSlot == -1)
|
||||
glk_put_string_stream(glk_window_get_stream(_window), msg.c_str());
|
||||
}
|
||||
|
||||
void GlkInterface::print(int number) {
|
||||
|
@ -35,6 +35,8 @@ namespace AdvSys {
|
||||
class GlkInterface : public GlkAPI {
|
||||
private:
|
||||
winid_t _window;
|
||||
protected:
|
||||
int _saveSlot;
|
||||
protected:
|
||||
/**
|
||||
* GLK initialization
|
||||
@ -61,7 +63,8 @@ public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
GlkInterface(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gameDesc) {}
|
||||
GlkInterface(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gameDesc),
|
||||
_saveSlot(-1) {}
|
||||
};
|
||||
|
||||
} // End of namespace AdvSys
|
||||
|
@ -310,12 +310,12 @@ void VM::opYORN() {
|
||||
|
||||
void VM::opSAVE() {
|
||||
if (saveGame().getCode() != Common::kNoError)
|
||||
print("Sorry, the savegame couldn't be created");
|
||||
print(_("Sorry, the savegame couldn't be created"));
|
||||
}
|
||||
|
||||
void VM::opRESTORE() {
|
||||
if (saveGame().getCode() != Common::kNoError)
|
||||
print("Sorry, the savegame couldn't be restored");
|
||||
print(_("Sorry, the savegame couldn't be restored"));
|
||||
}
|
||||
|
||||
void VM::opARG() {
|
||||
|
Loading…
Reference in New Issue
Block a user