aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJohannes Schickel2008-04-17 11:59:20 +0000
committerJohannes Schickel2008-04-17 11:59:20 +0000
commit7745100b8d05a9447590042f2b0700583f198ca3 (patch)
tree78f62ae41fd50a6a7acf6ceca2708c33a08d46a4 /engines
parentd4c8d4e18fcb64bed3082caf66ecd9cebf061556 (diff)
downloadscummvm-rg350-7745100b8d05a9447590042f2b0700583f198ca3.tar.gz
scummvm-rg350-7745100b8d05a9447590042f2b0700583f198ca3.tar.bz2
scummvm-rg350-7745100b8d05a9447590042f2b0700583f198ca3.zip
- minor cleanup in script.cpp
- fix for memory leak in Kyra3 - fixed enterNewSceneUnk2 svn-id: r31534
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/kyra_v3.cpp4
-rw-r--r--engines/kyra/scene_v3.cpp2
-rw-r--r--engines/kyra/script.cpp14
3 files changed, 10 insertions, 10 deletions
diff --git a/engines/kyra/kyra_v3.cpp b/engines/kyra/kyra_v3.cpp
index 9975c6c7a1..aa2bd4df94 100644
--- a/engines/kyra/kyra_v3.cpp
+++ b/engines/kyra/kyra_v3.cpp
@@ -61,9 +61,9 @@ KyraEngine_v3::KyraEngine_v3(OSystem *system, const GameFlags &flags) : KyraEngi
_sceneList = 0;
memset(&_mainCharacter, 0, sizeof(_mainCharacter));
_mainCharacter.sceneId = 9;
- _mainCharacter.dlgIndex = 0;
_mainCharacter.unk4 = 0x4C;
_mainCharacter.facing = 5;
+ _mainCharacter.animFrame = 0x57;
_mainCharacter.walkspeed = 5;
memset(_mainCharacter.inventory, -1, sizeof(_mainCharacter.inventory));
_text = 0;
@@ -600,6 +600,8 @@ void KyraEngine_v3::runStartupScript(int script, int unk1) {
while (_scriptInterpreter->validScript(&state))
_scriptInterpreter->runScript(&state);
+
+ _scriptInterpreter->unloadScript(&data);
}
void KyraEngine_v3::openTalkFile(int file) {
diff --git a/engines/kyra/scene_v3.cpp b/engines/kyra/scene_v3.cpp
index 19d5b35f7c..e2227f23e7 100644
--- a/engines/kyra/scene_v3.cpp
+++ b/engines/kyra/scene_v3.cpp
@@ -273,7 +273,7 @@ void KyraEngine_v3::enterNewSceneUnk1(int facing, int unk1, int unk2) {
void KyraEngine_v3::enterNewSceneUnk2(int unk1) {
debugC(9, kDebugLevelMain, "KyraEngine_v3::enterNewSceneUnk2(%d)", unk1);
_unk3 = -1;
- if (_mainCharX == -1 && _mainCharY == -1) {
+ if (_mainCharX == -1 && _mainCharY == -1 && !unk1) {
_mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing];
updateCharacterAnim(0);
refreshAnimObjectsIfNeed();
diff --git a/engines/kyra/script.cpp b/engines/kyra/script.cpp
index af5151f25f..944847e6f3 100644
--- a/engines/kyra/script.cpp
+++ b/engines/kyra/script.cpp
@@ -212,6 +212,9 @@ bool ScriptHelper::runScript(ScriptState *script) {
(this->*(_commands[opcode].proc))(script);
}
+ if (!_continue)
+ script->ip = 0;
+
return _continue;
}
@@ -317,7 +320,6 @@ void ScriptHelper::cmd_pushRetOrPos(ScriptState* script) {
default:
_continue = false;
- script->ip = 0;
break;
}
}
@@ -347,7 +349,6 @@ void ScriptHelper::cmd_popRetOrPos(ScriptState* script) {
case 1:
if (script->sp >= 60) {
_continue = false;
- script->ip = 0;
} else {
script->bp = script->stack[script->sp++];
script->ip = script->dataPtr->data + script->stack[script->sp++];
@@ -356,7 +357,6 @@ void ScriptHelper::cmd_popRetOrPos(ScriptState* script) {
default:
_continue = false;
- script->ip = 0;
break;
}
}
@@ -421,6 +421,7 @@ void ScriptHelper::cmd_negate(ScriptState* script) {
break;
default:
+ warning("Unknown negation func: %d", _parameter);
_continue = false;
break;
}
@@ -536,18 +537,15 @@ void ScriptHelper::cmd_eval(ScriptState* script) {
break;
}
- if (error) {
- script->ip = 0;
+ if (error)
_continue = false;
- } else {
+ else
script->stack[--script->sp] = ret;
- }
}
void ScriptHelper::cmd_setRetAndJmp(ScriptState* script) {
if (script->sp >= 60) {
_continue = false;
- script->ip = 0;
} else {
script->retValue = script->stack[script->sp++];
uint16 temp = script->stack[script->sp++];