From 76ab92f8ec6735c81dc80bb1ea836599f38abe2c Mon Sep 17 00:00:00 2001 From: Florian Kagerer Date: Mon, 9 Mar 2009 01:57:42 +0000 Subject: LOL: added scene animations (like that fountain right at the start) svn-id: r39251 --- engines/kyra/lol.h | 4 +++- engines/kyra/scene_lol.cpp | 17 +++++++++++++++++ engines/kyra/script_lol.cpp | 10 +++++++++- engines/kyra/timer_lol.cpp | 8 ++++---- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index 3e7ab12547..ad24ec5ecf 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -312,7 +312,7 @@ private: void timerProcessMonsters(int timerNum); void timerSub3(int timerNum); void timerSub4(int timerNum); - void timerSub5(int timerNum); + void timerUpdateSceneAnims(int timerNum); void timerSub6(int timerNum); void timerUpdatePortraitAnimations(int skipUpdate); void timerUpdateLampState(int timerNum); @@ -526,6 +526,7 @@ private: int olol_getGlobalVar(EMCState *script); int olol_setGlobalVar(EMCState *script); int olol_triggerDoorSwitch(EMCState *script); + int olol_updateSceneAnimations(EMCState *script); int olol_mapShapeToBlock(EMCState *script); int olol_resetBlockShapeAssignment(EMCState *script); int olol_initMonster(EMCState *script); @@ -729,6 +730,7 @@ private: void drawDecorations(int index); void drawIceShapes(int index, int iceShapeIndex); void drawScriptShapes(int pageNum); + void updateSceneAnimations(int block, int wall, int val); void updateSceneWindow(); void setSequenceGui(int x, int y, int w, int h, int enableFlags); diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index 3525a5a0df..2e0db82a04 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -1138,6 +1138,23 @@ void LoLEngine::drawScene(int pageNum) { _sceneUpdateRequired = false; } +void LoLEngine::updateSceneAnimations(int block, int wall, int val) { + if (wall == -1) { + for (int i = 0; i < 4; i++) + _levelBlockProperties[block].walls[i] = val; + if (_wllBuffer4[val] == 17) { + _levelBlockProperties[block].flags &= 0xef; + _levelBlockProperties[block].flags |= 0x20; + } else { + _levelBlockProperties[block].flags &= 0xdf; + } + } else { + _levelBlockProperties[block].walls[wall] = val; + } + + checkSceneUpdateNeed(block); +} + void LoLEngine::updateSceneWindow() { _screen->hideMouse(); _screen->copyRegion(112, 0, 112, 0, 176, 120, 0, _sceneDrawPage2, Screen::CR_NO_P_CHECK); diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index 31414f3b50..77a83ea91c 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -582,6 +582,14 @@ int LoLEngine::olol_triggerDoorSwitch(EMCState *script) { return 1; } +int LoLEngine::olol_updateSceneAnimations(EMCState *script) { + debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_updateSceneAnimations(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); + int block = stackPos(0); + int wall = stackPos(1); + updateSceneAnimations(block, wall, _levelBlockProperties[block].walls[(wall == -1) ? 0 : wall] == stackPos(2) ? stackPos(3) : stackPos(2)); + return 0; +} + int LoLEngine::olol_mapShapeToBlock(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_mapShapeToBlock(%p) (%d)", (const void *)script, stackPos(0)); return assignLevelShapes(stackPos(0)); @@ -1209,7 +1217,7 @@ void LoLEngine::setupOpcodeTable() { OpcodeUnImpl(); // 0x34 - OpcodeUnImpl(); + Opcode(olol_updateSceneAnimations); Opcode(olol_mapShapeToBlock); Opcode(olol_resetBlockShapeAssignment); OpcodeUnImpl(); diff --git a/engines/kyra/timer_lol.cpp b/engines/kyra/timer_lol.cpp index 98a4f2845b..58270b112c 100644 --- a/engines/kyra/timer_lol.cpp +++ b/engines/kyra/timer_lol.cpp @@ -42,9 +42,9 @@ void LoLEngine::setupTimers() { _timer->setNextRun(0x11, _system->getMillis() + 3 * _tickLength); _timer->addTimer(3, TimerV2(timerSub3), 15, true); _timer->addTimer(4, TimerV2(timerSub4), 1, true); - _timer->addTimer(0x50, TimerV2(timerSub5), 0, false); - _timer->addTimer(0x51, TimerV2(timerSub5), 0, false); - _timer->addTimer(0x52, TimerV2(timerSub5), 0, false); + _timer->addTimer(0x50, TimerV2(timerUpdateSceneAnims), 0, false); + _timer->addTimer(0x51, TimerV2(timerUpdateSceneAnims), 0, false); + _timer->addTimer(0x52, TimerV2(timerUpdateSceneAnims), 0, false); _timer->addTimer(8, TimerV2(timerSub6), 1200, true); _timer->addTimer(9, TimerV2(timerUpdatePortraitAnimations), 10, true); _timer->addTimer(10, TimerV2(timerUpdateLampState), 360, true); @@ -119,7 +119,7 @@ void LoLEngine::timerSub4(int timerNum) { } -void LoLEngine::timerSub5(int timerNum) { +void LoLEngine::timerUpdateSceneAnims(int timerNum) { runLevelScript(0x401 + (timerNum & 0x0f), -1); } -- cgit v1.2.3