From a8dfcb4edad9ae2db35a85f6f9c7416d14d74931 Mon Sep 17 00:00:00 2001 From: James Brown Date: Tue, 22 Apr 2003 04:40:30 +0000 Subject: Add somewhat hacky 'restart' command to debugger. Still needs work :) svn-id: r7071 --- scumm/debugger.cpp | 23 +++++++++++++++++++++++ scumm/debugger.h | 1 + scumm/scummvm.cpp | 26 ++++++++++++++------------ 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp index 9ffd3b24db..d35d94a997 100644 --- a/scumm/debugger.cpp +++ b/scumm/debugger.cpp @@ -77,6 +77,7 @@ void ScummDebugger::attach(Scumm *s, char *entry) { DCmd_Register("continue", &ScummDebugger::Cmd_Exit); DCmd_Register("exit", &ScummDebugger::Cmd_Exit); DCmd_Register("quit", &ScummDebugger::Cmd_Exit); + DCmd_Register("restart", &ScummDebugger::Cmd_Restart); DCmd_Register("actor", &ScummDebugger::Cmd_Actor); DCmd_Register("actors", &ScummDebugger::Cmd_PrintActor); @@ -291,6 +292,28 @@ bool ScummDebugger::Cmd_Exit(int argc, const char **argv) { return false; } +bool ScummDebugger::Cmd_Restart(int argc, const char **argv) { + // Reset some stuff + _s->_currentRoom = 0; + _s->_currentScript = 0xFF; + _s->killAllScriptsExceptCurrent(); + _s->setShake(0); + _s->_sound->stopAllSounds(); + + // Reinit things + _s->allocateArrays(); // Reallocate arrays + _s->readIndexFile(); // Reread index (reset objectstate etc) + _s->createResource(rtTemp, 6, 500); // Create temp buffer + _s->initScummVars(); // Reinit scumm variables + _s->_sound->setupSound(); // Reinit sound engine + + // Re-run bootscript + _s->runScript(1, 0, 0, &_s->_bootParam); + + _detach_now = true; + return false; +} + bool ScummDebugger::Cmd_Room(int argc, const char **argv) { if (argc > 1) { int room = atoi(argv[1]); diff --git a/scumm/debugger.h b/scumm/debugger.h index c84f21f870..db6b13b84c 100644 --- a/scumm/debugger.h +++ b/scumm/debugger.h @@ -73,6 +73,7 @@ protected: bool Cmd_Room(int argc, const char **argv); bool Cmd_LoadGame(int argc, const char **argv); bool Cmd_SaveGame(int argc, const char **argv); + bool Cmd_Restart(int argc, const char **argv); bool Cmd_PrintActor(int argc, const char **argv); bool Cmd_PrintBox(int argc, const char **argv); diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 3de3ab4271..42695b9fba 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -354,8 +354,6 @@ void Scumm::scummInit() { a->initActor(1); } - _vars[VAR_CHARINC] = 4; - _numNestedScripts = 0; vm.cutSceneStackPointer = 0; @@ -386,11 +384,7 @@ void Scumm::scummInit() { virtscr[0].xstart = 0; if (!(_features & GF_AFTER_V7)) { - _vars[VAR_V5_DRAWFLAGS] = 11; - _vars[VAR_59] = 3; - // Setup light - _vars[VAR_CURRENT_LIGHTS] = LIGHTMODE_actor_base | LIGHTMODE_actor_color | LIGHTMODE_screen; _flashlightXStrips = 7; _flashlightYStrips = 7; _flashlight.buffer = NULL; @@ -415,8 +409,6 @@ void Scumm::scummInit() { _varwatch = -1; _screenStartStrip = 0; - _vars[VAR_TALK_ACTOR] = 0; - _talkDelay = 0; _keepText = false; @@ -449,9 +441,6 @@ void Scumm::scummInit() { initScummVars(); - if (!(_features & GF_AFTER_V6)) - _vars[VAR_V5_TALK_STRING_Y] = -0x50; - getGraphicsPerformance(); _sound->_current_cache = 0; @@ -461,6 +450,9 @@ void Scumm::scummInit() { void Scumm::initScummVars() { + if (!(_features & GF_AFTER_V6)) + _vars[VAR_V5_TALK_STRING_Y] = -0x50; + if (!(_features & GF_AFTER_V7)) { _vars[VAR_CURRENTDRIVE] = 0; _vars[VAR_FIXEDDISK] = true; @@ -471,16 +463,26 @@ void Scumm::initScummVars() { _vars[VAR_SOUNDPARAM] = 0; _vars[VAR_SOUNDPARAM2] = 0; _vars[VAR_SOUNDPARAM3] = 0; + if (_features & GF_AFTER_V6) _vars[VAR_V6_EMSSPACE] = 10000; + + _vars[VAR_V5_DRAWFLAGS] = 11; + _vars[VAR_59] = 3; + + // Setup light + _vars[VAR_CURRENT_LIGHTS] = LIGHTMODE_actor_base | LIGHTMODE_actor_color | LIGHTMODE_screen; } else { - _vars[VAR_V6_EMSSPACE] = 10000; + _vars[VAR_V6_EMSSPACE] = 10000; } if (_features & GF_AFTER_V8) { // Fixme: How do we deal with non-cd installs? _vars[VAR_CURRENTDISK] = 1; _vars[VAR_LANGUAGE] = _language; } + + _vars[VAR_CHARINC] = 4; + _vars[VAR_TALK_ACTOR] = 0; } void Scumm::checkRange(int max, int min, int no, const char *str) { -- cgit v1.2.3