[Scummvm-cvs-logs] scummvm master -> 3f2b5b9e8b9196c9d0e573abf8f8350ec4034b1d
athrxx
athrxx at scummvm.org
Sat Jun 25 16:00:42 CEST 2011
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:
1a05efa8ed GUI: fix bug #2822778
3f2b5b9e8b KYRA: revert d7e700f370c258a5f4786d972af3666b93b71f94
Commit: 1a05efa8eda02eb2c40432e19d77c6e507c86453
https://github.com/scummvm/scummvm/commit/1a05efa8eda02eb2c40432e19d77c6e507c86453
Author: athrxx (athrxx at scummvm.org)
Date: 2011-06-25T06:54:36-07:00
Commit Message:
GUI: fix bug #2822778
(Savegames now get loaded after GMM dialogue execution. This avoids mouse cursor glitches (e.g. mouse cursors which get changed during loadGameState() being popped when the dialogue closes).
Changed paths:
engines/dialogs.cpp
engines/engine.cpp
engines/engine.h
diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp
index 89c07ad..1a077e5 100644
--- a/engines/dialogs.cpp
+++ b/engines/dialogs.cpp
@@ -246,14 +246,10 @@ void MainMenuDialog::load() {
int slot = _loadDialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
- if (slot >= 0) {
- // FIXME: For now we just ignore the return
- // value, which is quite bad since it could
- // be a fatal loading error, which renders
- // the engine unusable.
- _engine->loadGameState(slot);
+ _engine->setGameToLoadSlot(slot);
+
+ if (slot >= 0)
close();
- }
}
enum {
diff --git a/engines/engine.cpp b/engines/engine.cpp
index dde5064..b952f06 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -96,6 +96,7 @@ Engine::Engine(OSystem *syst)
_targetName(ConfMan.getActiveDomainName()),
_pauseLevel(0),
_pauseStartTime(0),
+ _saveSlotToLoad(-1),
_engineStartTime(_system->getMillis()),
_mainMenuDialog(NULL) {
@@ -396,7 +397,22 @@ void Engine::pauseEngineIntern(bool pause) {
void Engine::openMainMenuDialog() {
if (!_mainMenuDialog)
_mainMenuDialog = new MainMenuDialog(this);
+
+ setGameToLoadSlot(-1);
+
runDialog(*_mainMenuDialog);
+
+ // Load savegame after main menu execution
+ // (not from inside the menu loop to avoid
+ // mouse cursor glitches and simliar bugs,
+ // e.g. #2822778).
+ // FIXME: For now we just ignore the return
+ // value, which is quite bad since it could
+ // be a fatal loading error, which renders
+ // the engine unusable.
+ if (_saveSlotToLoad > 0)
+ loadGameState(_saveSlotToLoad);
+
syncSoundSettings();
}
@@ -437,6 +453,10 @@ int Engine::runDialog(GUI::Dialog &dialog) {
return result;
}
+void Engine::setGameToLoadSlot(int slot) {
+ _saveSlotToLoad = slot;
+}
+
void Engine::syncSoundSettings() {
// Sync the engine with the config manager
int soundVolumeMusic = ConfMan.getInt("music_volume");
diff --git a/engines/engine.h b/engines/engine.h
index 06b7f7d..2796df5 100644
--- a/engines/engine.h
+++ b/engines/engine.h
@@ -82,6 +82,13 @@ private:
*/
int32 _engineStartTime;
+ /**
+ * Save slot selected via global main menu.
+ * This slot will be loaded after main menu execution (not from inside
+ * the menu loop, to avoid bugs like #2822778).
+ */
+ int _saveSlotToLoad;
+
public:
@@ -186,6 +193,15 @@ public:
virtual Common::Error loadGameState(int slot);
/**
+ * Sets the game slot for a savegame to be loaded after global
+ * main menu execution. This is to avoid loading a savegame from
+ * inside the menu loop which causes bugs like #2822778.
+ *
+ * @param slot the slot from which a savestate should be loaded.
+ */
+ void setGameToLoadSlot(int slot);
+
+ /**
* Indicates whether a game state can be loaded.
*/
virtual bool canLoadGameStateCurrently();
Commit: 3f2b5b9e8b9196c9d0e573abf8f8350ec4034b1d
https://github.com/scummvm/scummvm/commit/3f2b5b9e8b9196c9d0e573abf8f8350ec4034b1d
Author: athrxx (athrxx at scummvm.org)
Date: 2011-06-25T06:54:37-07:00
Commit Message:
KYRA: revert d7e700f370c258a5f4786d972af3666b93b71f94
The GMM mouse cursor bug has now been fixed inside the GMM and CursorMan code.
Changed paths:
engines/kyra/kyra_hof.cpp
engines/kyra/kyra_lok.cpp
engines/kyra/kyra_mr.cpp
engines/kyra/kyra_v1.cpp
engines/kyra/kyra_v1.h
engines/kyra/lol.cpp
engines/kyra/saveload_hof.cpp
engines/kyra/saveload_lok.cpp
engines/kyra/saveload_lol.cpp
engines/kyra/saveload_mr.cpp
diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp
index 9a4f7bc..5c58e6e 100644
--- a/engines/kyra/kyra_hof.cpp
+++ b/engines/kyra/kyra_hof.cpp
@@ -503,14 +503,6 @@ void KyraEngine_HoF::runLoop() {
int inputFlag = checkInput(_buttonList, true);
removeInputTop();
- if (_updateHandItemCursor) {
- // This works around an issue which would occur when setHandItem(_itemInHand)
- // was called from inside loadGameState(). When loading via GMM the
- // mouse cursor would not be set correctly.
- _updateHandItemCursor = false;
- setHandItem(_itemInHand);
- }
-
update();
if (inputFlag == 198 || inputFlag == 199) {
diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp
index ee67062..7f356f3 100644
--- a/engines/kyra/kyra_lok.cpp
+++ b/engines/kyra/kyra_lok.cpp
@@ -821,14 +821,6 @@ void KyraEngine_LoK::updateMousePointer(bool forceUpdate) {
newY = 4;
}
- if (_updateHandItemCursor) {
- // This works around an issue which would occur when setHandItem(_itemInHand)
- // was called from inside loadGameState(). When loading via GMM the
- // mouse cursor would not be set correctly.
- _updateHandItemCursor = false;
- setHandItem(_itemInHand);
- }
-
if ((newMouseState && _mouseState != newMouseState) || (newMouseState && forceUpdate)) {
_mouseState = newMouseState;
_screen->hideMouse();
diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp
index 973ab25..f5bcd04 100644
--- a/engines/kyra/kyra_mr.cpp
+++ b/engines/kyra/kyra_mr.cpp
@@ -908,14 +908,6 @@ void KyraEngine_MR::runLoop() {
int inputFlag = checkInput(_mainButtonList, true);
removeInputTop();
- if (_updateHandItemCursor) {
- // This works around an issue which would occur when setHandItem(_itemInHand)
- // was called from inside loadGameState(). When loading via GMM the
- // mouse cursor would not be set correctly.
- _updateHandItemCursor = false;
- setHandItem(_itemInHand);
- }
-
update();
_timer->update();
diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp
index f79fabf..3d81368 100644
--- a/engines/kyra/kyra_v1.cpp
+++ b/engines/kyra/kyra_v1.cpp
@@ -56,7 +56,6 @@ KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags)
_gameToLoad = -1;
_mouseState = -1;
- _updateHandItemCursor = false;
_deathHandler = -1;
memset(_flagsTable, 0, sizeof(_flagsTable));
diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h
index 5b4f338..c5bf2d2 100644
--- a/engines/kyra/kyra_v1.h
+++ b/engines/kyra/kyra_v1.h
@@ -343,9 +343,6 @@ protected:
virtual void setHandItem(Item item) = 0;
virtual void removeHandItem() = 0;
- void setDelayedCursorUpdate() { _updateHandItemCursor = true; }
- bool _updateHandItemCursor;
-
// game flags
uint8 _flagsTable[100]; // TODO: check this value
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index c567cbb..2cca4fd 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -935,14 +935,6 @@ void LoLEngine::runLoop() {
checkFloatingPointerRegions();
gui_updateInput();
- if (_updateHandItemCursor) {
- // This works around an issue which would occur when setHandItem(_itemInHand)
- // was called from inside loadGameState(). When loading via GMM the
- // mouse cursor would not be set correctly.
- _updateHandItemCursor = false;
- setHandItem(_itemInHand);
- }
-
update();
if (_sceneUpdateRequired)
diff --git a/engines/kyra/saveload_hof.cpp b/engines/kyra/saveload_hof.cpp
index b395a38..645bd29 100644
--- a/engines/kyra/saveload_hof.cpp
+++ b/engines/kyra/saveload_hof.cpp
@@ -306,7 +306,7 @@ Common::Error KyraEngine_HoF::loadGameState(int slot) {
_mainCharacter.facing = 4;
enterNewScene(_mainCharacter.sceneId, _mainCharacter.facing, 0, 0, 1);
- setDelayedCursorUpdate();
+ setHandItem(_itemInHand);
if (_lastMusicCommand >= 0 && !_unkSceneScreenFlag1)
snd_playWanderScoreViaMap(_lastMusicCommand, 1);
diff --git a/engines/kyra/saveload_lok.cpp b/engines/kyra/saveload_lok.cpp
index 7689a90..34762d4 100644
--- a/engines/kyra/saveload_lok.cpp
+++ b/engines/kyra/saveload_lok.cpp
@@ -170,7 +170,7 @@ Common::Error KyraEngine_LoK::loadGameState(int slot) {
_screen->copyRegion(8, 8, 8, 8, 304, 212, 10, 0);
}
- setDelayedCursorUpdate();
+ setHandItem(_itemInHand);
// Will-O-Wisp uses a different shape size than Brandon's usual
// shape, thus we need to setup the correct size depending on
diff --git a/engines/kyra/saveload_lol.cpp b/engines/kyra/saveload_lol.cpp
index c81ace2..07842ea 100644
--- a/engines/kyra/saveload_lol.cpp
+++ b/engines/kyra/saveload_lol.cpp
@@ -257,7 +257,7 @@ Common::Error LoLEngine::loadGameState(int slot) {
int t = _credits;
_credits = 0;
giveCredits(t, 0);
- setDelayedCursorUpdate();
+ setHandItem(_itemInHand);
loadLevel(_currentLevel);
gui_drawPlayField();
timerSpecialCharacterUpdate(0);
diff --git a/engines/kyra/saveload_mr.cpp b/engines/kyra/saveload_mr.cpp
index 0fd3e52..1393752 100644
--- a/engines/kyra/saveload_mr.cpp
+++ b/engines/kyra/saveload_mr.cpp
@@ -305,7 +305,7 @@ Common::Error KyraEngine_MR::loadGameState(int slot) {
_goodConsciencePosition = false;
enterNewScene(_mainCharacter.sceneId, _mainCharacter.facing, 0, 0, 1);
- setDelayedCursorUpdate();
+ setHandItem(_itemInHand);
if (_lastMusicCommand >= 0 && !_unkSceneScreenFlag1)
snd_playWanderScoreViaMap(_lastMusicCommand, 1);
More information about the Scummvm-git-logs
mailing list