[Scummvm-cvs-logs] SF.net SVN: scummvm:[52379] scummvm/trunk/engines/sci/sci.cpp
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Wed Aug 25 12:38:09 CEST 2010
Revision: 52379
http://scummvm.svn.sourceforge.net/scummvm/?rev=52379&view=rev
Author: m_kiewitz
Date: 2010-08-25 10:38:09 +0000 (Wed, 25 Aug 2010)
Log Message:
-----------
SCI: making loading from ScummVM menu work correctly
using a trick for indirectly calling GameObject::init and then restoring, fixes text color/font code issues, also removing all the hackery
Modified Paths:
--------------
scummvm/trunk/engines/sci/sci.cpp
Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp 2010-08-25 09:28:29 UTC (rev 52378)
+++ scummvm/trunk/engines/sci/sci.cpp 2010-08-25 10:38:09 UTC (rev 52379)
@@ -270,37 +270,23 @@
}
// Check whether loading a savestate was requested
- int saveSlot = ConfMan.getInt("save_slot");
- if (saveSlot >= 0) {
- reg_t restoreArgv[2] = { NULL_REG, make_reg(0, saveSlot) }; // special call (argv[0] is NULL)
- kRestoreGame(_gamestate, 2, restoreArgv);
+ // Check whether loading a savestate was requested
+ int directSaveSlotLoading = ConfMan.getInt("save_slot");
+ if (directSaveSlotLoading >= 0) {
+ // call GameObject::play (like normally)
+ initStackBaseWithSelector(SELECTOR(play));
+ // We set this, so that the game automatically quit right after init
+ _gamestate->variables[VAR_GLOBAL][4] = TRUE_REG;
- // TODO: The best way to do the following would be to invoke Game::init
- // here and stop when the room is about to be changed, otherwise some
- // game initialization won't take place
+ _gamestate->_executionStackPosChanged = false;
+ run_vm(_gamestate);
- // Set audio language for KQ5CD (bug #3039477)
- if (g_sci->getGameId() == GID_KQ5 && Common::File::exists("AUDIO001.002")) {
- reg_t doAudioArgv[2] = { make_reg(0, 9), make_reg(0, 1) };
- kDoAudio(_gamestate, 2, doAudioArgv);
- }
+ // As soon as we get control again, actually restore the game
+ reg_t restoreArgv[2] = { NULL_REG, make_reg(0, directSaveSlotLoading) }; // special call (argv[0] is NULL)
+ kRestoreGame(_gamestate, 2, restoreArgv);
- // Initialize the game menu, if there is one.
- // This is not done when loading, so we must do it manually.
- reg_t menuBarObj = _gamestate->_segMan->findObjectByName("MenuBar");
- if (menuBarObj.isNull())
- menuBarObj = _gamestate->_segMan->findObjectByName("TheMenuBar"); // LSL2
- if (menuBarObj.isNull())
- menuBarObj = _gamestate->_segMan->findObjectByName("menuBar"); // LSL6
- if (!menuBarObj.isNull()) {
- // Reset abortScriptProcessing before initializing the game menu, so that the
- // VM call performed by invokeSelector will actually run.
- _gamestate->abortScriptProcessing = kAbortNone;
- Object *menuBar = _gamestate->_segMan->getObject(menuBarObj);
- // Invoke the first method (init) of the menuBar object
- invokeSelector(_gamestate, menuBarObj, menuBar->getFuncSelector(0), 0, _gamestate->stack_base);
- _gamestate->abortScriptProcessing = kAbortLoadGame;
- }
+ // this indirectly calls GameObject::init, which will setup menu, text font/color codes etc.
+ // without this games would be pretty badly broken
}
// Show any special warnings for buggy scripts with severe game bugs,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list