diff options
author | Max Horn | 2004-01-31 22:12:35 +0000 |
---|---|---|
committer | Max Horn | 2004-01-31 22:12:35 +0000 |
commit | 9fe1aaa9215e2ca540c859f2647629453a9f70d6 (patch) | |
tree | 97ad41bee6b591d61dfc5ebeffebcb7514e8c692 | |
parent | a67aca5b19b45bee2dd27b1186248bc9acf79684 (diff) | |
download | scummvm-rg350-9fe1aaa9215e2ca540c859f2647629453a9f70d6.tar.gz scummvm-rg350-9fe1aaa9215e2ca540c859f2647629453a9f70d6.tar.bz2 scummvm-rg350-9fe1aaa9215e2ca540c859f2647629453a9f70d6.zip |
renamed _saveLoadCompatible to _saveTemporaryState; make use of requestLoad/requestSave
svn-id: r12691
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | scumm/debugger.cpp | 9 | ||||
-rw-r--r-- | scumm/saveload.cpp | 10 | ||||
-rw-r--r-- | scumm/script_v5.cpp | 6 | ||||
-rw-r--r-- | scumm/script_v6.cpp | 4 | ||||
-rw-r--r-- | scumm/script_v8.cpp | 6 | ||||
-rw-r--r-- | scumm/scumm.h | 4 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 26 |
8 files changed, 29 insertions, 37 deletions
@@ -174,7 +174,6 @@ SCUMM Or constantly (well, at least whenever the camera moves) redraw the text. That would require buffering the text; maybe the blast text code could be reused for this... -* Rename _saveLoadCompatible variable to something sensible, like _saveTemporaryState Broken Sword 2 ============== diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp index f8484ee0d9..86571a2751 100644 --- a/scumm/debugger.cpp +++ b/scumm/debugger.cpp @@ -214,9 +214,7 @@ bool ScummDebugger::Cmd_LoadGame(int argc, const char **argv) { if (argc > 1) { int slot = atoi(argv[1]); - _vm->_saveLoadSlot = slot; - _vm->_saveLoadFlag = 2; - _vm->_saveLoadCompatible = false; + _vm->requestLoad(slot); _detach_now = true; return false; @@ -230,10 +228,7 @@ bool ScummDebugger::Cmd_SaveGame(int argc, const char **argv) { if (argc > 2) { int slot = atoi(argv[1]); - strcpy(_vm->_saveLoadName, argv[2]); - _vm->_saveLoadSlot = slot; - _vm->_saveLoadFlag = 1; - _vm->_saveLoadCompatible = false; + _vm->requestSave(slot, argv[2]); } else DebugPrintf("Syntax: savegame <slotnum> <name>\n"); diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index 0d5e272159..424f1c07d7 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -49,9 +49,9 @@ struct SaveGameHeader { }; -void ScummEngine::requestSave(int slot, const char *name) { +void ScummEngine::requestSave(int slot, const char *name, bool compatible) { _saveLoadSlot = slot; - _saveLoadCompatible = false; + _saveTemporaryState = compatible; _saveLoadFlag = 1; // 1 for save assert(name); strcpy(_saveLoadName, name); @@ -59,7 +59,7 @@ void ScummEngine::requestSave(int slot, const char *name) { void ScummEngine::requestLoad(int slot) { _saveLoadSlot = slot; - _saveLoadCompatible = false; + _saveTemporaryState = false; _saveLoadFlag = 2; // 2 for load } @@ -136,7 +136,7 @@ bool ScummEngine::loadState(int slot, bool compat, SaveFileManager *mgr) { // If we don't have iMUSE at all we may as well stop the sounds. The previous // default behavior here was to stopAllSounds on all state restores. - if (!_imuse || _saveSound || !_saveLoadCompatible) + if (!_imuse || _saveSound || !_saveTemporaryState) _sound->stopAllSounds(); _sound->stopCD(); @@ -767,7 +767,7 @@ void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) { AudioCD.play(info.track, info.numLoops, info.start, info.duration); } - if (_imuse && (_saveSound || !_saveLoadCompatible)) { + if (_imuse && (_saveSound || !_saveTemporaryState)) { _imuse->save_or_load(s, this); _imuse->setMasterVolume(ConfMan.getInt("master_volume")); _imuse->set_music_volume(ConfMan.getInt("music_volume")); diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp index 52343096f4..61eee97429 100644 --- a/scumm/script_v5.cpp +++ b/scumm/script_v5.cpp @@ -1158,13 +1158,13 @@ void ScummEngine_v5::o5_saveLoadGame() { result = 0; break; case 0x40: // load - if (loadState(slot, _saveLoadCompatible)) + if (loadState(slot, _saveTemporaryState)) result = 3; // sucess else result = 5; // failed to load break; case 0x80: // save - if (saveState(slot, _saveLoadCompatible)) + if (saveState(slot, _saveTemporaryState)) result = 0; else result = 2; @@ -1899,7 +1899,7 @@ void ScummEngine_v5::o5_roomOps() { _saveLoadFlag = getVarOrDirectByte(PARAM_1); _saveLoadSlot = getVarOrDirectByte(PARAM_2); _saveLoadSlot = 99; /* use this slot */ - _saveLoadCompatible = true; + _saveTemporaryState = true; break; case 10: // SO_ROOM_FADE a = getVarOrDirectWord(PARAM_1); diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index b53011919d..a94f3a22e3 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -1685,7 +1685,7 @@ void ScummEngine_v6::o6_roomOps() { break; case 180: // SO_ROOM_SAVEGAME - _saveLoadCompatible = true; + _saveTemporaryState = true; _saveLoadSlot = pop(); _saveLoadFlag = pop(); if (_gameId == GID_TENTACLE) @@ -1768,7 +1768,7 @@ void ScummEngine_v6::o6_roomOps() { _scriptPointer += len + 1; _saveLoadFlag = pop(); _saveLoadSlot = 99; - _saveLoadCompatible = true; + _saveTemporaryState = true; break; default: error("o6_roomOps: default case %d", op); diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index 2d40dc2b62..a5936ccf5c 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -914,12 +914,12 @@ void ScummEngine_v8::o8_roomOps() { setPalette(a); break; case 0x5D: // SO_ROOM_SAVE_GAME Save game - _saveLoadCompatible = true; + _saveTemporaryState = true; _saveLoadSlot = 1; _saveLoadFlag = 1; break; case 0x5E: // SO_ROOM_LOAD_GAME Load game - _saveLoadCompatible = true; + _saveTemporaryState = true; _saveLoadSlot = 1; _saveLoadFlag = 2; break; @@ -1361,7 +1361,7 @@ void ScummEngine_v8::o8_kernelSetFunctions() { // saveGameRead _saveLoadSlot = args[1]; _saveLoadFlag = 2; - _saveLoadCompatible = false; + _saveTemporaryState = false; warning("Sgl: %d", args[1]); break; } diff --git a/scumm/scumm.h b/scumm/scumm.h index b9a746963d..b541bca4c9 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -468,7 +468,7 @@ protected: // Save/Load class - some of this may be GUI byte _saveLoadFlag, _saveLoadSlot; uint32 _lastSaveTime; - bool _saveLoadCompatible; + bool _saveTemporaryState; char _saveLoadName[32]; bool saveState(int slot, bool compat, SaveFileManager *mgr); @@ -497,7 +497,7 @@ public: bool getSavegameName(int slot, char *desc, SaveFileManager *mgr); void listSavegames(bool *marks, int num, SaveFileManager *mgr); - void requestSave(int slot, const char *name); + void requestSave(int slot, const char *name, bool compatible = false); void requestLoad(int slot); protected: diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 57167e59d0..a5a6f9c06a 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -374,7 +374,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS _saveLoadFlag = 0; _saveLoadSlot = 0; _lastSaveTime = 0; - _saveLoadCompatible = false; + _saveTemporaryState = false; memset(_saveLoadName, 0, sizeof(_saveLoadName)); _maxHeapThreshold = 0; _minHeapThreshold = 0; @@ -771,9 +771,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS // Load game from specified slot, if any if (ConfMan.hasKey("save_slot")) { - _saveLoadSlot = ConfMan.getInt("save_slot"); - _saveLoadFlag = 2; - _saveLoadCompatible = false; + requestLoad(ConfMan.getInt("save_slot")); } loadLanguageBundle(); @@ -996,7 +994,7 @@ void ScummEngine::launch() { // If requested, load a save game instead of running the boot script - if (_saveLoadFlag != 2 || !loadState(_saveLoadSlot, _saveLoadCompatible)) { + if (_saveLoadFlag != 2 || !loadState(_saveLoadSlot, _saveTemporaryState)) { int args[16]; memset(args, 0, sizeof(args)); args[0] = _bootParam; @@ -1390,7 +1388,7 @@ int ScummEngine::scummLoop(int delta) { _saveLoadSlot = 0; sprintf(_saveLoadName, "Autosave %d", _saveLoadSlot); _saveLoadFlag = 1; - _saveLoadCompatible = false; + _saveTemporaryState = false; } if (VAR_GAME_LOADED != 0xFF) @@ -1402,30 +1400,30 @@ load_game: char filename[256]; if (_saveLoadFlag == 1) { - success = saveState(_saveLoadSlot, _saveLoadCompatible); + success = saveState(_saveLoadSlot, _saveTemporaryState); if (!success) errMsg = "Failed to save game state to file:\n\n%s"; // Ender: Disabled for small_header games, as can overwrite game // variables (eg, Zak256 cashcard values). Temp disabled for V8 // because of odd timing issue with scripts and the variable reset - if (success && _saveLoadCompatible && !(_features & GF_SMALL_HEADER) && _version < 8) + if (success && _saveTemporaryState && !(_features & GF_SMALL_HEADER) && _version < 8) VAR(VAR_GAME_LOADED) = 201; } else { - success = loadState(_saveLoadSlot, _saveLoadCompatible); + success = loadState(_saveLoadSlot, _saveTemporaryState); if (!success) errMsg = "Failed to load game state from file:\n\n%s"; // Ender: Disabled for small_header games, as can overwrite game // variables (eg, Zak256 cashcard values). - if (success && _saveLoadCompatible && !(_features & GF_SMALL_HEADER)) + if (success && _saveTemporaryState && !(_features & GF_SMALL_HEADER)) VAR(VAR_GAME_LOADED) = 203; } - makeSavegameName(filename, _saveLoadSlot, _saveLoadCompatible); + makeSavegameName(filename, _saveLoadSlot, _saveTemporaryState); if (!success) { displayError(false, errMsg, filename); - } else if (_saveLoadFlag == 1 && _saveLoadSlot != 0 && !_saveLoadCompatible) { + } else if (_saveLoadFlag == 1 && _saveLoadSlot != 0 && !_saveTemporaryState) { // Display "Save successful" message, except for auto saves #ifdef __PALM_OS__ char buf[256]; // 1024 is too big overflow the stack @@ -1607,7 +1605,7 @@ void ScummEngine::parseEvents() { switch(event.event_code) { case OSystem::EVENT_KEYDOWN: - if (event.kbd.keycode >= '0' && event.kbd.keycode<='9' + if (event.kbd.keycode >= '0' && event.kbd.keycode <= '9' && (event.kbd.flags == OSystem::KBD_ALT || event.kbd.flags == OSystem::KBD_CTRL)) { _saveLoadSlot = event.kbd.keycode - '0'; @@ -1618,7 +1616,7 @@ void ScummEngine::parseEvents() { sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot); _saveLoadFlag = (event.kbd.flags == OSystem::KBD_ALT) ? 1 : 2; - _saveLoadCompatible = false; + _saveTemporaryState = false; } else if (event.kbd.flags == OSystem::KBD_CTRL) { if (event.kbd.keycode == 'f') _fastMode ^= 1; |