aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Brown2003-04-22 04:40:30 +0000
committerJames Brown2003-04-22 04:40:30 +0000
commita8dfcb4edad9ae2db35a85f6f9c7416d14d74931 (patch)
treedf8f9a9666c30f727d5c48f7bfc5ae063851e289
parentb3ac1bf20e1ff6bdce327f9f5016554e8be3963b (diff)
downloadscummvm-rg350-a8dfcb4edad9ae2db35a85f6f9c7416d14d74931.tar.gz
scummvm-rg350-a8dfcb4edad9ae2db35a85f6f9c7416d14d74931.tar.bz2
scummvm-rg350-a8dfcb4edad9ae2db35a85f6f9c7416d14d74931.zip
Add somewhat hacky 'restart' command to debugger. Still needs work :)
svn-id: r7071
-rw-r--r--scumm/debugger.cpp23
-rw-r--r--scumm/debugger.h1
-rw-r--r--scumm/scummvm.cpp26
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) {