mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-20 16:59:06 +00:00
- minor cleanup in script.cpp
- fix for memory leak in Kyra3 - fixed enterNewSceneUnk2 svn-id: r31534
This commit is contained in:
parent
d4c8d4e18f
commit
7745100b8d
@ -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) {
|
||||
|
@ -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();
|
||||
|
@ -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++];
|
||||
|
Loading…
Reference in New Issue
Block a user