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).
This commit is contained in:
parent
5a2bc12f26
commit
1a05efa8ed
3 changed files with 39 additions and 7 deletions
|
@ -246,15 +246,11 @@ void MainMenuDialog::load() {
|
||||||
|
|
||||||
int slot = _loadDialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
|
int slot = _loadDialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
|
||||||
|
|
||||||
if (slot >= 0) {
|
_engine->setGameToLoadSlot(slot);
|
||||||
// FIXME: For now we just ignore the return
|
|
||||||
// value, which is quite bad since it could
|
if (slot >= 0)
|
||||||
// be a fatal loading error, which renders
|
|
||||||
// the engine unusable.
|
|
||||||
_engine->loadGameState(slot);
|
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kKeysCmd = 'KEYS'
|
kKeysCmd = 'KEYS'
|
||||||
|
|
|
@ -96,6 +96,7 @@ Engine::Engine(OSystem *syst)
|
||||||
_targetName(ConfMan.getActiveDomainName()),
|
_targetName(ConfMan.getActiveDomainName()),
|
||||||
_pauseLevel(0),
|
_pauseLevel(0),
|
||||||
_pauseStartTime(0),
|
_pauseStartTime(0),
|
||||||
|
_saveSlotToLoad(-1),
|
||||||
_engineStartTime(_system->getMillis()),
|
_engineStartTime(_system->getMillis()),
|
||||||
_mainMenuDialog(NULL) {
|
_mainMenuDialog(NULL) {
|
||||||
|
|
||||||
|
@ -396,7 +397,22 @@ void Engine::pauseEngineIntern(bool pause) {
|
||||||
void Engine::openMainMenuDialog() {
|
void Engine::openMainMenuDialog() {
|
||||||
if (!_mainMenuDialog)
|
if (!_mainMenuDialog)
|
||||||
_mainMenuDialog = new MainMenuDialog(this);
|
_mainMenuDialog = new MainMenuDialog(this);
|
||||||
|
|
||||||
|
setGameToLoadSlot(-1);
|
||||||
|
|
||||||
runDialog(*_mainMenuDialog);
|
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();
|
syncSoundSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,6 +453,10 @@ int Engine::runDialog(GUI::Dialog &dialog) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Engine::setGameToLoadSlot(int slot) {
|
||||||
|
_saveSlotToLoad = slot;
|
||||||
|
}
|
||||||
|
|
||||||
void Engine::syncSoundSettings() {
|
void Engine::syncSoundSettings() {
|
||||||
// Sync the engine with the config manager
|
// Sync the engine with the config manager
|
||||||
int soundVolumeMusic = ConfMan.getInt("music_volume");
|
int soundVolumeMusic = ConfMan.getInt("music_volume");
|
||||||
|
|
|
@ -82,6 +82,13 @@ private:
|
||||||
*/
|
*/
|
||||||
int32 _engineStartTime;
|
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:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
@ -185,6 +192,15 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual Common::Error loadGameState(int slot);
|
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.
|
* Indicates whether a game state can be loaded.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue