- some more opcodes for wsa and tim sequences

- adding some code to inputSceneChange

svn-id: r31132
This commit is contained in:
Florian Kagerer 2008-03-15 20:24:26 +00:00
parent f88a2923cd
commit fd7ed046bb
4 changed files with 78 additions and 20 deletions

View File

@ -1294,26 +1294,28 @@ int KyraEngine_v2::inputSceneChange(int x, int y, int unk1, int unk2) {
}
}
int strId = 0;
int vocH = _flags.isTalkie ? 131 : -1;
if (_pathfinderFlag) {
if (findItem(curScene, 13) >= 0 && _unk3 <= -3) {
//XXX
_pathfinderFlag = 0;
return 0;
if (findItem(curScene, 13) >= 0 && _unk3 <= -3) {
strId = 252;
} else if (_itemInHand == 72) {
//XXX
_pathfinderFlag = 0;
return 0;
strId = 257;
} else if (findItem(curScene, 72) >= 0 && _unk3 <= -3) {
//XXX
_pathfinderFlag = 0;
return 0;
} else if (0/*XXX*/) {
//XXX
_pathfinderFlag = 0;
return 0;
strId = 256;
} else if (getInventoryItemSlot(72) != -1 && _unk3 <= -3) {
strId = 257;
}
}
if (strId) {
updateCharFacing();
objectChat(getTableString(strId, _cCodeBuffer, 1), 0, vocH, strId);
_pathfinderFlag = 0;
return 0;
}
if (ABS(_mainCharacter.x1 - x) < 4 || ABS(_mainCharacter.y1 - y) < 2)
return 0;
@ -2111,9 +2113,9 @@ void KyraEngine_v2::setupOpcodeTable() {
OpcodeUnImpl(),
Opcode(o2_displayWsaFrame),
// 0x18
Opcode(o2_displayWsaSequentialFrames),
Opcode(o2_displayWsaSequentialFramesLooping),
Opcode(o2_wsaOpen),
OpcodeUnImpl(),
Opcode(o2_displayWsaSequentialFrames),
OpcodeUnImpl(),
// 0x1c
OpcodeUnImpl(),
@ -2257,7 +2259,7 @@ void KyraEngine_v2::setupOpcodeTable() {
Opcode(o2_npcChat),
// 0x8c
Opcode(o2_deinitObject),
OpcodeUnImpl(),
Opcode(o2_playTimSequence),
Opcode(o2_makeBookOrCauldronAppear),
Opcode(o2_setSpecialSceneScriptState),
// 0x90

View File

@ -824,6 +824,7 @@ protected:
uint8 *tim_loadFile(const char *filename, uint8 *buffer, int32 bufferSize);
void tim_releaseBuffer(uint8 *buffer);
void tim_processSequence(uint8 *timBuffer, int loop);
void tim_playFullSequence(const char *filename);
int tim_o_dummy_r0(uint8 *ptr);
int tim_o_dummy_r1(uint8 *ptr);
@ -947,8 +948,9 @@ protected:
int o2_showChapterMessage(ScriptState *script);
int o2_wsaClose(ScriptState *script);
int o2_displayWsaFrame(ScriptState *script);
int o2_displayWsaSequentialFrames(ScriptState *script);
int o2_displayWsaSequentialFramesLooping(ScriptState *script);
int o2_wsaOpen(ScriptState *script);
int o2_displayWsaSequentialFrames(ScriptState *script);
int o2_checkForItem(ScriptState *script);
int o2_defineItem(ScriptState *script);
int o2_removeItemFromInventory(ScriptState *script);
@ -1015,6 +1017,7 @@ protected:
int o2_initObject(ScriptState *script);
int o2_npcChat(ScriptState *script);
int o2_deinitObject(ScriptState *script);
int o2_playTimSequence(ScriptState *script);
int o2_makeBookOrCauldronAppear(ScriptState *script);
int o2_setSpecialSceneScriptState(ScriptState *script);
int o2_clearSpecialSceneScriptState(ScriptState *script);

View File

@ -190,8 +190,8 @@ int KyraEngine_v2::o2_displayWsaFrame(ScriptState *script) {
return 0;
}
int KyraEngine_v2::o2_displayWsaSequentialFrames(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_displayWsaSequentialFrames(%p) (%d, %d, %d, %d, %d, %d, %d, %d)", (const void *)script,
int KyraEngine_v2::o2_displayWsaSequentialFramesLooping(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_displayWsaSequentialFramesLooping(%p) (%d, %d, %d, %d, %d, %d, %d, %d)", (const void *)script,
stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7));
int startFrame = stackPos(0);
int endFrame = stackPos(1);
@ -253,6 +253,33 @@ int KyraEngine_v2::o2_wsaOpen(ScriptState *script) {
return 0;
}
int KyraEngine_v2::o2_displayWsaSequentialFrames(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_displayWsaSequentialFrames(%p) (%d, %d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6));
uint16 frameDelay = stackPos(2) * _tickLength;
uint16 currentFrame = stackPos(3);
uint16 lastFrame = stackPos(4);
uint16 index = stackPos(5);
uint16 copyParam = stackPos(6) | 0xc000;
_wsaSlots[index]->setX(stackPos(0));
_wsaSlots[index]->setY(stackPos(1));
_wsaSlots[index]->setDrawPage(0);
_screen->hideMouse();
while (currentFrame <= lastFrame) {
uint32 endTime = _system->getMillis() + frameDelay;
_wsaSlots[index]->displayFrame(currentFrame++, copyParam);
_screen->updateScreen();
delayUntil(endTime);
}
_screen->showMouse();
return 0;
}
int KyraEngine_v2::o2_checkForItem(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_checkForItem(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
return findItem(stackPos(0), stackPos(1)) == -1 ? 0 : 1;
@ -924,6 +951,12 @@ int KyraEngine_v2::o2_deinitObject(ScriptState *script) {
return 0;
}
int KyraEngine_v2::o2_playTimSequence(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_playTimSequence(%p) ('%s')", (const void *)script, stackPosString(0));
tim_playFullSequence(stackPosString(0));
return 0;
}
int KyraEngine_v2::o2_makeBookOrCauldronAppear(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_makeBookOrCauldronAppear(%p) (%d)", (const void *)script, stackPos(0));
seq_makeBookOrCauldronAppear(stackPos(0));

View File

@ -176,6 +176,26 @@ void KyraEngine_v2::tim_processSequence(uint8 *timBuffer, int loop) {
}
void KyraEngine_v2::tim_playFullSequence(const char *filename) {
uint8 *ptr = tim_loadFile(filename, 0, 0);
if (!ptr)
return;
_objectChatFinished = 0;
while (ptr && !_objectChatFinished) {
if (ptr)
tim_processSequence(ptr, 0);
if (_timChatText)
updateWithText();
else
update();
}
if (ptr)
tim_releaseBuffer(ptr);
}
int KyraEngine_v2::tim_o_dummy_r0(uint8 *ptr) {
return 0;
}