- Impelemented opcode 155: o2_stopSceneAnimation

- fixed crash while switching chapters

svn-id: r31139
This commit is contained in:
Johannes Schickel 2008-03-16 13:31:18 +00:00
parent bbecd439c1
commit 2a95c653eb
4 changed files with 24 additions and 3 deletions

View File

@ -799,10 +799,8 @@ void KyraEngine_v2::delay(uint32 amount, bool updateGame, bool isMainLoop) {
update();
}
if (amount > 0 )
_system->delayMillis(amount > 10 ? 10 : amount);
} while (!_skipFlag && _system->getMillis() < start + amount && !_quitFlag);
}
@ -2275,7 +2273,7 @@ void KyraEngine_v2::setupOpcodeTable() {
Opcode(o2_customChat),
Opcode(o2_customChatFinish),
OpcodeUnImpl(),
OpcodeUnImpl(),
Opcode(o2_stopSceneAnimation),
// 0x9c
OpcodeUnImpl(),
OpcodeUnImpl(),

View File

@ -1031,6 +1031,7 @@ protected:
int o2_mushroomEffect(ScriptState *script);
int o2_customChat(ScriptState *script);
int o2_customChatFinish(ScriptState *script);
int o2_stopSceneAnimation(ScriptState *script);
int o2_processPaletteIndex(ScriptState *script);
int o2_getBoolFromStack(ScriptState *script);
int o2_setVocHigh(ScriptState *script);

View File

@ -72,6 +72,8 @@ bool ScriptHelper::loadScript(const char *filename, ScriptData *scriptData, cons
return false;
}
memset(scriptData, 0, sizeof(ScriptData));
uint32 formBlockSize = file.getFORMBlockSize();
if (formBlockSize == (uint32)-1) {
error("No FORM chunk found in file: '%s'", filename);

View File

@ -1100,6 +1100,26 @@ int KyraEngine_v2::o2_customChatFinish(ScriptState *script) {
return 0;
}
int KyraEngine_v2::o2_stopSceneAnimation(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_stopSceneAnimation(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
const int index = 1+stackPos(0);
AnimObj &obj = _animObjects[index];
restorePage3();
obj.shapeIndex3 = 0xFFFF;
obj.animNum = 0xFFFF;
obj.needRefresh = 1;
obj.unk8 = 1;
if (stackPos(1))
refreshAnimObjectsIfNeed();
obj.enabled = false;
_animList = deleteAnimListEntry(_animList, &_animObjects[index]);
if (_sceneAnimMovie[index]->opened())
_sceneAnimMovie[index]->close();
return 0;
}
int KyraEngine_v2::o2_processPaletteIndex(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_processPaletteIndex(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5));
uint8 *palette = _screen->getPalette(0);