aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorJohannes Schickel2008-04-20 12:34:16 +0000
committerJohannes Schickel2008-04-20 12:34:16 +0000
commit78c675278b1a232d2058b2d85eb089bfdec64b12 (patch)
tree1047453830111b2526f2784f187964ac3d822866 /engines/kyra
parente1ef6c9e9d7106e75415f8ba7cd78552ef229512 (diff)
downloadscummvm-rg350-78c675278b1a232d2058b2d85eb089bfdec64b12.tar.gz
scummvm-rg350-78c675278b1a232d2058b2d85eb089bfdec64b12.tar.bz2
scummvm-rg350-78c675278b1a232d2058b2d85eb089bfdec64b12.zip
Implemented opcodes:
- 64: o3_checkInRect - 87: o3_stopMusic - 88: o3_playMusicTrack svn-id: r31595
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/kyra_v3.cpp5
-rw-r--r--engines/kyra/kyra_v3.h8
-rw-r--r--engines/kyra/script_v3.cpp43
3 files changed, 47 insertions, 9 deletions
diff --git a/engines/kyra/kyra_v3.cpp b/engines/kyra/kyra_v3.cpp
index 9bca12cdb9..af0e8687e4 100644
--- a/engines/kyra/kyra_v3.cpp
+++ b/engines/kyra/kyra_v3.cpp
@@ -464,9 +464,8 @@ void KyraEngine_v3::playStudioSFX(const char *str) {
void KyraEngine_v3::preinit() {
debugC(9, kDebugLevelMain, "KyraEngine_v3::preinit()");
- _unkBuffer1040Bytes = new uint8[1040];
- _itemBuffer1 = new uint8[72];
- _itemBuffer2 = new uint8[144];
+ _itemBuffer1 = new int8[72];
+ _itemBuffer2 = new int8[144];
initMouseShapes();
initItems();
diff --git a/engines/kyra/kyra_v3.h b/engines/kyra/kyra_v3.h
index 0a24e52f39..5706e0f575 100644
--- a/engines/kyra/kyra_v3.h
+++ b/engines/kyra/kyra_v3.h
@@ -258,8 +258,8 @@ private:
uint8 *getTableEntry(uint8 *buffer, int id);
// items
- uint8 *_itemBuffer1;
- uint8 *_itemBuffer2;
+ int8 *_itemBuffer1;
+ int8 *_itemBuffer2;
struct Item {
uint16 id;
uint16 sceneId;
@@ -505,7 +505,6 @@ private:
int _newShapeDelay;
// unk
- uint8 *_unkBuffer1040Bytes;
uint8 *_costPalBuffer;
uint8 *_screenBuffer;
uint8 *_gfxBackUpRect;
@@ -541,6 +540,9 @@ private:
int o3_badConscienceChat(ScriptState *script);
int o3_delay(ScriptState *script);
int o3_setSceneFilename(ScriptState *script);
+ int o3_checkInRect(ScriptState *script);
+ int o3_stopMusic(ScriptState *script);
+ int o3_playMusicTrack(ScriptState *script);
int o3_playSoundEffect(ScriptState *script);
int o3_getRand(ScriptState *script);
int o3_defineRoomEntrance(ScriptState *script);
diff --git a/engines/kyra/script_v3.cpp b/engines/kyra/script_v3.cpp
index 4eca162734..ddab206790 100644
--- a/engines/kyra/script_v3.cpp
+++ b/engines/kyra/script_v3.cpp
@@ -206,6 +206,43 @@ int KyraEngine_v3::o3_setSceneFilename(ScriptState *script) {
return 0;
}
+int KyraEngine_v3::o3_checkInRect(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_checkInRect(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script,
+ stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5));
+ const int x1 = stackPos(0);
+ const int y1 = stackPos(1);
+ const int x2 = stackPos(2);
+ const int y2 = stackPos(3);
+ int x = stackPos(4), y = stackPos(5);
+ if (_itemInHand >= 0) {
+ const int8 *desc = &_itemBuffer2[_itemInHand*2];
+ x -= 12;
+ x += desc[0];
+ y -= 19;
+ y += desc[1];
+ }
+
+ if (x >= x1 && x <= x2 && y >= y1 && y <= y2) {
+ //XXX
+ return 1;
+ } else {
+ //XXX
+ return 0;
+ }
+}
+
+int KyraEngine_v3::o3_stopMusic(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_stopMusic(%p) ()", (const void *)script);
+ stopMusicTrack();
+ return 0;
+}
+
+int KyraEngine_v3::o3_playMusicTrack(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_playMusicTrack(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
+ playMusicTrack(stackPos(0), stackPos(1));
+ return 0;
+}
+
int KyraEngine_v3::o3_playSoundEffect(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_playSoundEffect(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
playSoundEffect(stackPos(0), stackPos(1));
@@ -519,7 +556,7 @@ void KyraEngine_v3::setupOpcodeTable() {
OpcodeUnImpl(),
OpcodeUnImpl(),
// 0x40
- OpcodeUnImpl(),
+ Opcode(o3_checkInRect),
OpcodeUnImpl(),
OpcodeUnImpl(),
Opcode(o3_dummy),
@@ -547,9 +584,9 @@ void KyraEngine_v3::setupOpcodeTable() {
Opcode(o3_dummy),
Opcode(o3_dummy),
OpcodeUnImpl(),
- OpcodeUnImpl(),
+ Opcode(o3_stopMusic),
// 0x58
- OpcodeUnImpl(),
+ Opcode(o3_playMusicTrack),
Opcode(o3_playSoundEffect),
OpcodeUnImpl(),
OpcodeUnImpl(),