aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/animator_v3.cpp2
-rw-r--r--engines/kyra/kyra_v3.cpp11
-rw-r--r--engines/kyra/kyra_v3.h7
-rw-r--r--engines/kyra/scene_v3.cpp6
-rw-r--r--engines/kyra/screen.cpp5
-rw-r--r--engines/kyra/script_v3.cpp115
6 files changed, 124 insertions, 22 deletions
diff --git a/engines/kyra/animator_v3.cpp b/engines/kyra/animator_v3.cpp
index 9d6c42f084..70d0df0acd 100644
--- a/engines/kyra/animator_v3.cpp
+++ b/engines/kyra/animator_v3.cpp
@@ -322,7 +322,7 @@ void KyraEngine_v3::updateCharacterAnim(int charId) {
_animObjects[i].needRefresh = true;
}
- obj = deleteAnimListEntry(_animList, obj);
+ _animList = deleteAnimListEntry(_animList, obj);
if (_animList)
_animList = addToAnimListSorted(_animList, obj);
else
diff --git a/engines/kyra/kyra_v3.cpp b/engines/kyra/kyra_v3.cpp
index f26584462b..0de35a0d20 100644
--- a/engines/kyra/kyra_v3.cpp
+++ b/engines/kyra/kyra_v3.cpp
@@ -218,15 +218,9 @@ int KyraEngine_v3::go() {
break;
case 3:
- _soundDigital->beginFadeOut(_musicSoundChannel, 60);
- _screen->fadeToBlack();
- _soundDigital->stopSound(_musicSoundChannel);
- _musicSoundChannel = -1;
- uninitMainMenu();
- running = false;
- break;
-
default:
+ fadeOutMusic(60);
+ _screen->fadeToBlack();
uninitMainMenu();
quitGame();
running = false;
@@ -421,7 +415,6 @@ void KyraEngine_v3::startup() {
musicUpdate(0);
memset(_flagsTable, 0, sizeof(_flagsTable));
- setGameFlag(0x216);
_gamePlayBuffer = new uint8[64000];
musicUpdate(0);
diff --git a/engines/kyra/kyra_v3.h b/engines/kyra/kyra_v3.h
index 75c43bca7a..5c112f42a4 100644
--- a/engines/kyra/kyra_v3.h
+++ b/engines/kyra/kyra_v3.h
@@ -283,7 +283,7 @@ private:
ScriptData _sceneScriptData;
WSAMovieV2 *_wsaSlots[10];
- bool _sceneSpecialScriptState[10];
+ bool _specialSceneScriptState[10];
ScriptState _sceneSpecialScripts[10];
uint32 _sceneSpecialScriptsTimer[10];
@@ -371,7 +371,12 @@ private:
int o3_setGameFlag(ScriptState *script);
int o3_setSceneFilename(ScriptState *script);
int o3_getRand(ScriptState *script);
+ int o3_defineRoomEntrance(ScriptState *script);
+ int o3_defineSceneAnim(ScriptState *script);
int o3_defineScene(ScriptState *script);
+ int o3_setSpecialSceneScriptState(ScriptState *script);
+ int o3_clearSpecialSceneScriptState(ScriptState *script);
+ int o3_querySpecialSceneScriptState(ScriptState *script);
int o3_setHiddenItemsEntry(ScriptState *script);
int o3_getHiddenItemsEntry(ScriptState *script);
int o3_dummy(ScriptState *script);
diff --git a/engines/kyra/scene_v3.cpp b/engines/kyra/scene_v3.cpp
index 66ad58d3ef..822bf3c8cd 100644
--- a/engines/kyra/scene_v3.cpp
+++ b/engines/kyra/scene_v3.cpp
@@ -152,7 +152,7 @@ void KyraEngine_v3::enterNewScene(uint16 sceneId, int facing, int unk1, int unk2
musicUpdate(0);
//XXX setCommandLineRestoreTimer(-1);
_sceneScriptState.regs[3] = 1;
- //XXX enterNewSceneUnk1();
+ enterNewSceneUnk2(unk3);
if (queryGameFlag(0)) {
_runFlag = false;
} else {
@@ -261,7 +261,7 @@ void KyraEngine_v3::enterNewSceneUnk1(int facing, int unk1, int unk2) {
_mainCharacter.y1 = _mainCharacter.y2 = y2;
initSceneAnims(unk2);
- if (_mainCharacter.sceneId == 9 && _soundDigital->isPlaying(_musicSoundChannel))
+ if (_mainCharacter.sceneId == 9 && !_soundDigital->isPlaying(_musicSoundChannel))
playMusicTrack(_sceneList[_mainCharacter.sceneId].sound, 0);
if (!unk2)
playMusicTrack(_sceneList[_mainCharacter.sceneId].sound, 0);
@@ -421,7 +421,7 @@ void KyraEngine_v3::initSceneScript(int unk1) {
_screen->loadBitmap(filename, 3, 3, 0);
musicUpdate(0);
- Common::set_to(_sceneSpecialScriptState, _sceneSpecialScriptState+ARRAYSIZE(_sceneSpecialScriptState), false);
+ Common::set_to(_specialSceneScriptState, _specialSceneScriptState+ARRAYSIZE(_specialSceneScriptState), false);
_sceneEnterX1 = 160;
_sceneEnterY1 = 0;
_sceneEnterX2 = 296;
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index cf1e068e9e..9f0c58e4a6 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -1143,9 +1143,8 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int
_dsScaleH = 0x100;
}
- if ((flags & 0x2000) && _vm->gameFlags().gameID == GI_KYRA2) {
+ if ((flags & 0x2000) && _vm->gameFlags().gameID != GI_KYRA1)
va_arg(args, int);
- }
static const DsMarginSkipFunc dsMarginFunc[] = {
&Screen::drawShapeMarginNoScaleUpwind,
@@ -1258,7 +1257,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int
uint16 frameSize = READ_LE_UINT16(src); src += 2;
- int colorTableColors = ((_vm->gameFlags().gameID == GI_KYRA2) && (shapeFlags & 4)) ? *src++ : 16;
+ int colorTableColors = ((_vm->gameFlags().gameID != GI_KYRA2) && (shapeFlags & 4)) ? *src++ : 16;
if (!(flags & 0x8000) && (shapeFlags & 1))
_dsTable2 = src;
diff --git a/engines/kyra/script_v3.cpp b/engines/kyra/script_v3.cpp
index b43ba4e7d1..f346c6a857 100644
--- a/engines/kyra/script_v3.cpp
+++ b/engines/kyra/script_v3.cpp
@@ -25,6 +25,8 @@
#include "kyra/kyra_v3.h"
#include "kyra/script.h"
+#include "kyra/screen_v3.h"
+#include "kyra/wsamovie.h"
#include "common/endian.h"
@@ -72,6 +74,92 @@ int KyraEngine_v3::o3_getRand(ScriptState *script) {
return _rnd.getRandomNumberRng(stackPos(0), stackPos(1));
}
+int KyraEngine_v3::o3_defineRoomEntrance(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_defineRoomEntrance(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
+ switch (stackPos(0)) {
+ case 0:
+ _sceneEnterX1 = stackPos(1);
+ _sceneEnterY1 = stackPos(2);
+ break;
+
+ case 1:
+ _sceneEnterX2 = stackPos(1);
+ _sceneEnterY2 = stackPos(2);
+ break;
+
+ case 2:
+ _sceneEnterX3 = stackPos(1);
+ _sceneEnterY3 = stackPos(2);
+ break;
+
+ case 3:
+ _sceneEnterX4 = stackPos(1);
+ _sceneEnterY4 = stackPos(2);
+ break;
+
+ default:
+ break;
+ }
+ return 0;
+}
+
+int KyraEngine_v3::o3_defineSceneAnim(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_defineSceneAnim(%p) (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, '%s')",
+ (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7),
+ stackPos(8), stackPos(9), stackPos(10), stackPos(11), stackPosString(12));
+ const int animId = stackPos(0);
+ SceneAnim &anim = _sceneAnims[animId];
+
+ musicUpdate(0);
+
+ uint16 flags = anim.flags = stackPos(1);
+ int x = anim.x = stackPos(2);
+ int y = anim.y = stackPos(3);
+ int x2 = anim.x2 = stackPos(4);
+ int y2 = anim.y2 = stackPos(5);
+ int w = anim.width = stackPos(6);
+ int h = anim.height = stackPos(7);
+ anim.unk10 = stackPos(8);
+ anim.specialSize = stackPos(9);
+ anim.unk14 = stackPos(10);
+ anim.shapeIndex = stackPos(11);
+ const char *filename = stackPosString(12);
+
+ if (filename)
+ strcpy(anim.filename, filename);
+
+ if (flags & 8) {
+ _sceneAnimMovie[animId]->open(filename, 1, 0);
+ musicUpdate(0);
+ if (_sceneAnimMovie[animId]->opened()) {
+ anim.wsaFlag = 1;
+ if (x2 == -1)
+ x2 = _sceneAnimMovie[animId]->xAdd();
+ if (y2 == -1)
+ y2 = _sceneAnimMovie[animId]->xAdd();
+ if (w == -1)
+ w = _sceneAnimMovie[animId]->width();
+ if (h == -1)
+ h = _sceneAnimMovie[animId]->height();
+ if (x == -1)
+ x = (w >> 1) + x2;
+ if (y == -1)
+ y = y2 + h - 1;
+
+ anim.x = x;
+ anim.y = y;
+ anim.x2 = x2;
+ anim.y2 = y2;
+ anim.width = w;
+ anim.height = h;
+ }
+ }
+
+ musicUpdate(0);
+
+ return 9;
+}
+
int KyraEngine_v3::o3_defineScene(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_defineScene(%p) (%d, '%s', %d, %d, %d, %d, %d, %d)",
(const void *)script, stackPos(0), stackPosString(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7));
@@ -98,6 +186,23 @@ int KyraEngine_v3::o3_defineScene(ScriptState *script) {
return 0;
}
+int KyraEngine_v3::o3_setSpecialSceneScriptState(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setSpecialSceneScriptState(%p) (%d)", (const void *)script, stackPos(0));
+ _specialSceneScriptState[stackPos(0)] = 1;
+ return 1;
+}
+
+int KyraEngine_v3::o3_clearSpecialSceneScriptState(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_clearSpecialSceneScriptState(%p) (%d)", (const void *)script, stackPos(0));
+ _specialSceneScriptState[stackPos(0)] = 0;
+ return 0;
+}
+
+int KyraEngine_v3::o3_querySpecialSceneScriptState(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_querySpecialSceneScriptState(%p) (%d)", (const void *)script, stackPos(0));
+ return _specialSceneScriptState[stackPos(0)];
+}
+
int KyraEngine_v3::o3_setHiddenItemsEntry(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setHiddenItemsEntry(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
return (_hiddenItems[stackPos(0)] = (uint16)stackPos(1));
@@ -255,11 +360,11 @@ void KyraEngine_v3::setupOpcodeTable() {
OpcodeUnImpl(),
// 0x6c
Opcode(o3_dummy),
- OpcodeUnImpl(),
+ Opcode(o3_defineRoomEntrance),
OpcodeUnImpl(),
OpcodeUnImpl(),
// 0x70
- OpcodeUnImpl(),
+ Opcode(o3_defineSceneAnim),
Opcode(o3_dummy),
OpcodeUnImpl(),
Opcode(o3_dummy),
@@ -297,10 +402,10 @@ void KyraEngine_v3::setupOpcodeTable() {
OpcodeUnImpl(),
Opcode(o3_dummy),
Opcode(o3_dummy),
- OpcodeUnImpl(),
+ Opcode(o3_setSpecialSceneScriptState),
// 0x90
- OpcodeUnImpl(),
- OpcodeUnImpl(),
+ Opcode(o3_clearSpecialSceneScriptState),
+ Opcode(o3_querySpecialSceneScriptState),
Opcode(o3_dummy),
Opcode(o3_setHiddenItemsEntry),
// 0x94