[Scummvm-cvs-logs] scummvm master -> 5df2e08c1668c6649f7817688ce1ce198e563083
bluegr
bluegr at gmail.com
Mon Jan 19 22:56:10 CET 2015
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
dcac5be493 ZVISION: Simplify the checks in the location changing code
5df2e08c16 ZVISION: Fix bug #6771 (unable to leave room when loading a game)
Commit: dcac5be493a98764239619d5da60d6bc0f608383
https://github.com/scummvm/scummvm/commit/dcac5be493a98764239619d5da60d6bc0f608383
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-01-19T23:54:41+02:00
Commit Message:
ZVISION: Simplify the checks in the location changing code
Changed paths:
engines/zvision/scripting/script_manager.cpp
diff --git a/engines/zvision/scripting/script_manager.cpp b/engines/zvision/scripting/script_manager.cpp
index df74fd6..bcc1f0a 100644
--- a/engines/zvision/scripting/script_manager.cpp
+++ b/engines/zvision/scripting/script_manager.cpp
@@ -564,12 +564,16 @@ void ScriptManager::ChangeLocationReal() {
assert(_nextLocation.world != 0);
debug(1, "Changing location to: %c %c %c %c %u", _nextLocation.world, _nextLocation.room, _nextLocation.node, _nextLocation.view, _nextLocation.offset);
- if (_nextLocation.world == 'g' && _nextLocation.room == 'j' && !ConfMan.getBool("originalsaveload")) {
- if ((_nextLocation.node == 's' || _nextLocation.node == 'r') && _nextLocation.view == 'e') {
+ const bool enteringMenu = (_nextLocation.world == 'g' && _nextLocation.room == 'j');
+ const bool leavingMenu = (_currentLocation.world == 'g' && _currentLocation.room == 'j');
+ const bool isSaveScreen = (enteringMenu && _nextLocation.node == 's' && _nextLocation.view == 'e');
+ const bool isRestoreScreen = (enteringMenu && _nextLocation.node == 'r' && _nextLocation.view == 'e');
+
+ if (enteringMenu && !ConfMan.getBool("originalsaveload")) {
+ if (isSaveScreen || isRestoreScreen) {
// Hook up the ScummVM save/restore dialog
- bool isSave = (_nextLocation.node == 's');
- bool gameSavedOrLoaded = _engine->getSaveManager()->scummVMSaveLoadDialog(isSave);
- if (!gameSavedOrLoaded || isSave) {
+ bool gameSavedOrLoaded = _engine->getSaveManager()->scummVMSaveLoadDialog(isSaveScreen);
+ if (!gameSavedOrLoaded || isSaveScreen) {
// Reload the current room
_nextLocation.world = _currentLocation.world;
_nextLocation.room = _currentLocation.room;
@@ -590,30 +594,26 @@ void ScriptManager::ChangeLocationReal() {
_engine->setRenderDelay(2);
- if (getStateValue(StateKey_World) != 'g' || getStateValue(StateKey_Room) != 'j') {
- if (_nextLocation.world != 'g' || _nextLocation.room != 'j') {
+ if (!enteringMenu) {
+ if (!leavingMenu) {
setStateValue(StateKey_LastWorld, getStateValue(StateKey_World));
setStateValue(StateKey_LastRoom, getStateValue(StateKey_Room));
setStateValue(StateKey_LastNode, getStateValue(StateKey_Node));
setStateValue(StateKey_LastView, getStateValue(StateKey_View));
setStateValue(StateKey_LastViewPos, getStateValue(StateKey_ViewPos));
- } else {
- setStateValue(StateKey_Menu_LastWorld, getStateValue(StateKey_World));
- setStateValue(StateKey_Menu_LastRoom, getStateValue(StateKey_Room));
- setStateValue(StateKey_Menu_LastNode, getStateValue(StateKey_Node));
- setStateValue(StateKey_Menu_LastView, getStateValue(StateKey_View));
- setStateValue(StateKey_Menu_LastViewPos, getStateValue(StateKey_ViewPos));
}
+ } else {
+ setStateValue(StateKey_Menu_LastWorld, getStateValue(StateKey_World));
+ setStateValue(StateKey_Menu_LastRoom, getStateValue(StateKey_Room));
+ setStateValue(StateKey_Menu_LastNode, getStateValue(StateKey_Node));
+ setStateValue(StateKey_Menu_LastView, getStateValue(StateKey_View));
+ setStateValue(StateKey_Menu_LastViewPos, getStateValue(StateKey_ViewPos));
}
- if (_nextLocation.world == 'g' && _nextLocation.room == 'j') {
- if (_nextLocation.node == 's' && _nextLocation.view == 'e' && _currentLocation.world != 'g') {
- _engine->getSaveManager()->prepareSaveBuffer();
- }
- } else {
- if (_currentLocation.world == 'g' && _currentLocation.room == 'j') {
- _engine->getSaveManager()->flushSaveBuffer();
- }
+ if (isSaveScreen && !leavingMenu) {
+ _engine->getSaveManager()->prepareSaveBuffer();
+ } else if (leavingMenu) {
+ _engine->getSaveManager()->flushSaveBuffer();
}
setStateValue(StateKey_World, _nextLocation.world);
Commit: 5df2e08c1668c6649f7817688ce1ce198e563083
https://github.com/scummvm/scummvm/commit/5df2e08c1668c6649f7817688ce1ce198e563083
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-01-19T23:54:42+02:00
Commit Message:
ZVISION: Fix bug #6771 (unable to leave room when loading a game)
Avoid overwriting the previous location when loading a saved game
Changed paths:
engines/zvision/scripting/script_manager.cpp
engines/zvision/scripting/script_manager.h
diff --git a/engines/zvision/scripting/script_manager.cpp b/engines/zvision/scripting/script_manager.cpp
index bcc1f0a..34376ce 100644
--- a/engines/zvision/scripting/script_manager.cpp
+++ b/engines/zvision/scripting/script_manager.cpp
@@ -74,7 +74,7 @@ void ScriptManager::initialize() {
void ScriptManager::update(uint deltaTimeMillis) {
if (_currentLocation.node != _nextLocation.node || _currentLocation.room != _nextLocation.room ||
_currentLocation.view != _nextLocation.view || _currentLocation.world != _nextLocation.world) {
- ChangeLocationReal();
+ ChangeLocationReal(false);
}
updateNodes(deltaTimeMillis);
@@ -560,7 +560,7 @@ void ScriptManager::changeLocation(char _world, char _room, char _node, char _vi
}
}
-void ScriptManager::ChangeLocationReal() {
+void ScriptManager::ChangeLocationReal(bool isLoading) {
assert(_nextLocation.world != 0);
debug(1, "Changing location to: %c %c %c %c %u", _nextLocation.world, _nextLocation.room, _nextLocation.node, _nextLocation.view, _nextLocation.offset);
@@ -595,7 +595,7 @@ void ScriptManager::ChangeLocationReal() {
_engine->setRenderDelay(2);
if (!enteringMenu) {
- if (!leavingMenu) {
+ if (!isLoading && !leavingMenu) {
setStateValue(StateKey_LastWorld, getStateValue(StateKey_World));
setStateValue(StateKey_LastRoom, getStateValue(StateKey_Room));
setStateValue(StateKey_LastNode, getStateValue(StateKey_Node));
@@ -809,7 +809,7 @@ void ScriptManager::deserialize(Common::SeekableReadStream *stream) {
_nextLocation = nextLocation;
- ChangeLocationReal();
+ ChangeLocationReal(true);
_engine->setRenderDelay(10);
setStateValue(StateKey_RestoreFlag, 1);
diff --git a/engines/zvision/scripting/script_manager.h b/engines/zvision/scripting/script_manager.h
index f6201c3..6d025bf 100644
--- a/engines/zvision/scripting/script_manager.h
+++ b/engines/zvision/scripting/script_manager.h
@@ -273,7 +273,7 @@ private:
bool execScope(ScriptScope &scope);
/** Perform change location */
- void ChangeLocationReal();
+ void ChangeLocationReal(bool isLoading);
int8 inventoryGetCount();
void inventorySetCount(int8 cnt);
More information about the Scummvm-git-logs
mailing list