TONY: Implemented support for loading savegames directly from the launcher.

It's not perfect.. the startup screen briefly flashes, and Tony briefly disappears when you do a first action afterwards.
This commit is contained in:
Paul Gilbert 2012-05-18 22:57:25 +10:00
parent d67a5162ad
commit bcaeacf124
3 changed files with 13 additions and 7 deletions

View file

@ -767,8 +767,6 @@ void ActionThread(CORO_PARAM, const void *param) {
debugC(DEBUG_DETAILED, kTonyDebugActions, "Action Process %d ended", CoroScheduler.getCurrentPID());
CORO_KILL_SELF();
CORO_END_CODE;
}
@ -780,6 +778,7 @@ void ActionThread(CORO_PARAM, const void *param) {
void ShutUpActionThread(CORO_PARAM, const void *param) {
// COROUTINE
CORO_BEGIN_CONTEXT;
int slotNumber;
CORO_END_CONTEXT(_ctx);
uint32 pid = *(const uint32 *)param;
@ -790,7 +789,13 @@ void ShutUpActionThread(CORO_PARAM, const void *param) {
GLOBALS.bExecutingAction = false;
CORO_KILL_SELF();
if (_vm->_initialLoadSlotNumber != -1) {
_ctx->slotNumber = _vm->_initialLoadSlotNumber;
_vm->_initialLoadSlotNumber = -1;
CORO_INVOKE_1(_vm->LoadState, _ctx->slotNumber);
}
CORO_END_CODE;
}

View file

@ -38,6 +38,7 @@ TonyEngine *_vm;
TonyEngine::TonyEngine(OSystem *syst, const TonyGameDescription *gameDesc) : Engine(syst),
_gameDescription(gameDesc), _randomSource("tony") {
_vm = this;
_loadSlotNumber = -1;
DebugMan.addDebugChannel(kTonyDebugAnimations, "animations", "Animations debugging");
DebugMan.addDebugChannel(kTonyDebugActions, "actions", "Actions debugging");
@ -45,11 +46,11 @@ TonyEngine::TonyEngine(OSystem *syst, const TonyGameDescription *gameDesc) : Eng
DebugMan.addDebugChannel(kTonyDebugMusic, "music", "Music debugging");
// Set up load slot number
_loadSlotNumber = -1;
_initialLoadSlotNumber = -1;
if (ConfMan.hasKey("save_slot")) {
int slotNumber = ConfMan.getInt("save_slot");
if (slotNumber >= 0 && slotNumber <= 99)
_loadSlotNumber = slotNumber;
_initialLoadSlotNumber = slotNumber;
}
}

View file

@ -78,8 +78,6 @@ struct VoiceHeader {
class TonyEngine : public Engine {
private:
int _loadSlotNumber;
Common::ErrorCode Init();
void InitMusic();
void CloseMusic();
@ -122,6 +120,8 @@ public:
bool m_bDrawLocation;
int m_startTime;
uint16 *m_curThumbnail;
int _initialLoadSlotNumber;
int _loadSlotNumber;
// Bounding box list manager
RMGameBoxes _theBoxes;