aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/kyra/kyra_hof.cpp1
-rw-r--r--engines/kyra/kyra_hof.h4
-rw-r--r--engines/kyra/kyra_mr.cpp1
-rw-r--r--engines/kyra/kyra_mr.h5
-rw-r--r--engines/kyra/kyra_v2.cpp2
-rw-r--r--engines/kyra/kyra_v2.h6
-rw-r--r--engines/kyra/script_hof.cpp24
-rw-r--r--engines/kyra/script_mr.cpp30
-rw-r--r--engines/kyra/script_v2.cpp22
9 files changed, 35 insertions, 60 deletions
diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp
index d682bdac13..3eac999979 100644
--- a/engines/kyra/kyra_hof.cpp
+++ b/engines/kyra/kyra_hof.cpp
@@ -372,7 +372,6 @@ void KyraEngine_HoF::startup() {
clearCauldronTable();
memset(_inputColorCode, -1, sizeof(_inputColorCode));
memset(_newSceneDlgState, 0, sizeof(_newSceneDlgState));
- memset(_hiddenItems, -1, sizeof(_hiddenItems));
for (int i = 0; i < 23; ++i)
resetCauldronStateTable(i);
diff --git a/engines/kyra/kyra_hof.h b/engines/kyra/kyra_hof.h
index b8fdaf696a..46974c9889 100644
--- a/engines/kyra/kyra_hof.h
+++ b/engines/kyra/kyra_hof.h
@@ -436,7 +436,6 @@ protected:
void setMouseCursor(uint16 item);
uint8 _itemHtDat[176];
- uint16 _hiddenItems[20];
int checkItemCollision(int x, int y);
void updateWaterFlasks();
@@ -728,7 +727,6 @@ protected:
int o2_addItemToInventory(EMCState *script);
int o2_drawShape(EMCState *script);
int o2_addItemToCurScene(EMCState *script);
- int o2_checkForItem(EMCState *script);
int o2_loadSoundFile(EMCState *script);
int o2_removeSlotFromInventory(EMCState *script);
int o2_removeItemFromInventory(EMCState *script);
@@ -801,8 +799,6 @@ protected:
int o2_playTimSequence(EMCState *script);
int o2_makeBookOrCauldronAppear(EMCState *script);
int o2_resetInputColorCode(EMCState *script);
- int o2_setHiddenItemsEntry(EMCState *script);
- int o2_getHiddenItemsEntry(EMCState *script);
int o2_mushroomEffect(EMCState *script);
int o2_customChat(EMCState *script);
int o2_customChatFinish(EMCState *script);
diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp
index b1b8e7b60f..06b07eaf26 100644
--- a/engines/kyra/kyra_mr.cpp
+++ b/engines/kyra/kyra_mr.cpp
@@ -614,7 +614,6 @@ void KyraEngine_MR::startup() {
}
musicUpdate(0);
- memset(_hiddenItems, -1, sizeof(_hiddenItems));
memset(_newSceneDlgState, 0, sizeof(_newSceneDlgState));
memset(_conversationState, -1, sizeof(_conversationState));
diff --git a/engines/kyra/kyra_mr.h b/engines/kyra/kyra_mr.h
index 20f6334bdf..f4d597a04a 100644
--- a/engines/kyra/kyra_mr.h
+++ b/engines/kyra/kyra_mr.h
@@ -250,7 +250,6 @@ private:
// items
int8 *_itemBuffer1;
int8 *_itemBuffer2;
- uint16 _hiddenItems[100];
static const uint8 _trashItemList[];
void removeTrashItems();
@@ -508,7 +507,6 @@ private:
int o3_refreshCharacter(EMCState *script);
int o3_getMalcolmsMood(EMCState *script);
int o3_getCharacterFrameFromFacing(EMCState *script);
- int o3_setCharacterFacingOverwrite(EMCState *script);
int o3_setCharacterFacing(EMCState *script);
int o3_showSceneFileMessage(EMCState *script);
int o3_setCharacterAnimFrameFromFacing(EMCState *script);
@@ -519,7 +517,6 @@ private:
int o3_addItemToInventory(EMCState *script);
int o3_addItemToCurScene(EMCState *script);
int o3_objectChat(EMCState *script);
- int o3_checkForItem(EMCState *script);
int o3_resetInventory(EMCState *script);
int o3_removeInventoryItemInstances(EMCState *script);
int o3_countInventoryItemInstances(EMCState *script);
@@ -562,8 +559,6 @@ private:
int o3_countItemInstances(EMCState *script);
int o3_dialogStartScript(EMCState *script);
int o3_dialogEndScript(EMCState *script);
- int o3_setHiddenItemsEntry(EMCState *script);
- int o3_getHiddenItemsEntry(EMCState *script);
int o3_customChat(EMCState *script);
int o3_customChatFinish(EMCState *script);
int o3_setupSceneAnimObject(EMCState *script);
diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp
index 60b3af2b9e..8070f86eb3 100644
--- a/engines/kyra/kyra_v2.cpp
+++ b/engines/kyra/kyra_v2.cpp
@@ -60,6 +60,8 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags, const Engi
_chatVocLow = -1;
_chatText = 0;
_chatObject = -1;
+
+ memset(_hiddenItems, -1, sizeof(_hiddenItems));
}
KyraEngine_v2::~KyraEngine_v2() {
diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h
index 01697651dc..8fe682b104 100644
--- a/engines/kyra/kyra_v2.h
+++ b/engines/kyra/kyra_v2.h
@@ -287,6 +287,8 @@ protected:
void initItemList(int size);
+ uint16 _hiddenItems[100];
+
Item *_itemList;
int _itemListSize;
@@ -361,8 +363,10 @@ protected:
int o2_getCharacterY(EMCState *script);
int o2_getCharacterFacing(EMCState *script);
int o2_getCharacterScene(EMCState *script);
+ int o2_setCharacterFacingOverwrite(EMCState *script);
int o2_trySceneChange(EMCState *script);
int o2_moveCharacter(EMCState *script);
+ int o2_checkForItem(EMCState *script);
int o2_defineItem(EMCState *script);
int o2_queryGameFlag(EMCState *script);
int o2_resetGameFlag(EMCState *script);
@@ -391,6 +395,8 @@ protected:
int o2_setSpecialSceneScriptState(EMCState *script);
int o2_clearSpecialSceneScriptState(EMCState *script);
int o2_querySpecialSceneScriptState(EMCState *script);
+ int o2_setHiddenItemsEntry(EMCState *script);
+ int o2_getHiddenItemsEntry(EMCState *script);
int o2_disableTimer(EMCState *script);
int o2_enableTimer(EMCState *script);
int o2_setTimerCountdown(EMCState *script);
diff --git a/engines/kyra/script_hof.cpp b/engines/kyra/script_hof.cpp
index 3f134d4199..ff28e08960 100644
--- a/engines/kyra/script_hof.cpp
+++ b/engines/kyra/script_hof.cpp
@@ -107,13 +107,6 @@ int KyraEngine_HoF::o2_setCharacterAnimFrame(EMCState *script) {
return 0;
}
-int KyraEngine_HoF::o2_setCharacterFacing(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_setCharacterFacing(%p) (%d)", (const void *)script, stackPos(0));
- _mainCharacter.facing = stackPos(0);
- _overwriteSceneFacing = 1;
- return 0;
-}
-
int KyraEngine_HoF::o2_customCharacterChat(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_customCharacterChat(%p) ('%s', %d, %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4));
playVoice(_vocHigh, stackPos(4));
@@ -408,11 +401,6 @@ int KyraEngine_HoF::o2_addItemToCurScene(EMCState *script) {
return 0;
}
-int KyraEngine_HoF::o2_checkForItem(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_checkForItem(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
- return findItem(stackPos(0), stackPos(1)) == -1 ? 0 : 1;
-}
-
int KyraEngine_HoF::o2_loadSoundFile(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_loadSoundFile(%p) (%d)", (const void *)script, stackPos(0));
if (_sound->hasSoundFile(stackPos(0)))
@@ -1151,16 +1139,6 @@ int KyraEngine_HoF::o2_resetInputColorCode(EMCState *script) {
return 0;
}
-int KyraEngine_HoF::o2_setHiddenItemsEntry(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_setHiddenItemsEntry(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
- return (_hiddenItems[stackPos(0)] = stackPos(1));
-}
-
-int KyraEngine_HoF::o2_getHiddenItemsEntry(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_getHiddenItemsEntry(%p) (%d)", (const void *)script, stackPos(0));
- return _hiddenItems[stackPos(0)];
-}
-
int KyraEngine_HoF::o2_mushroomEffect(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_mushroomEffect(%p)", (const void *)script);
memcpy(_screen->getPalette(2), _screen->_currentPalette, 768);
@@ -1527,7 +1505,7 @@ void KyraEngine_HoF::setupOpcodeTable() {
OpcodeUnImpl();
Opcode(o2_setCharacterAnimFrame);
// 0x0c
- Opcode(o2_setCharacterFacing);
+ Opcode(o2_setCharacterFacingOverwrite);
Opcode(o2_trySceneChange);
Opcode(o2_moveCharacter);
Opcode(o2_customCharacterChat);
diff --git a/engines/kyra/script_mr.cpp b/engines/kyra/script_mr.cpp
index 247913a984..d0e66141f6 100644
--- a/engines/kyra/script_mr.cpp
+++ b/engines/kyra/script_mr.cpp
@@ -101,13 +101,6 @@ int KyraEngine_MR::o3_getCharacterFrameFromFacing(EMCState *script) {
return _characterFrameTable[_mainCharacter.facing];
}
-int KyraEngine_MR::o3_setCharacterFacingOverwrite(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setCharacterFacingOverwrite(%p) (%d)", (const void *)script, stackPos(0));
- _mainCharacter.facing = stackPos(0);
- _overwriteSceneFacing = true;
- return 0;
-}
-
int KyraEngine_MR::o3_setCharacterFacing(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setCharacterFacing(%p) (%d)", (const void *)script, stackPos(0));
_mainCharacter.facing = stackPos(0);
@@ -206,11 +199,6 @@ int KyraEngine_MR::o3_objectChat(EMCState *script) {
return 0;
}
-int KyraEngine_MR::o3_checkForItem(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_checkForItem(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
- return findItem(stackPos(0), stackPos(1)) == -1 ? 0 : 1;
-}
-
int KyraEngine_MR::o3_resetInventory(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_resetInventory(%p) ()", (const void *)script);
memset(_mainCharacter.inventory, -1, sizeof(_mainCharacter.inventory));
@@ -977,16 +965,6 @@ int KyraEngine_MR::o3_dialogEndScript(EMCState *script) {
return 0;
}
-int KyraEngine_MR::o3_setHiddenItemsEntry(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setHiddenItemsEntry(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
- return (_hiddenItems[stackPos(0)] = (uint16)stackPos(1));
-}
-
-int KyraEngine_MR::o3_getHiddenItemsEntry(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_getHiddenItemsEntry(%p) (%d)", (const void *)script, stackPos(0));
- return (int16)_hiddenItems[stackPos(0)];
-}
-
int KyraEngine_MR::o3_customChat(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_customChat(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
const int id = stackPos(0);
@@ -1099,7 +1077,7 @@ void KyraEngine_MR::setupOpcodeTable() {
Opcode(o3_dummy);
Opcode(o3_getCharacterFrameFromFacing);
// 0x0c
- Opcode(o3_setCharacterFacingOverwrite);
+ Opcode(o2_setCharacterFacingOverwrite);
Opcode(o2_trySceneChange);
Opcode(o2_moveCharacter);
Opcode(o3_setCharacterFacing);
@@ -1124,7 +1102,7 @@ void KyraEngine_MR::setupOpcodeTable() {
Opcode(o3_addItemToCurScene);
Opcode(o3_objectChat);
// 0x20
- Opcode(o3_checkForItem);
+ Opcode(o2_checkForItem);
Opcode(o3_dummy);
Opcode(o3_resetInventory);
Opcode(o2_defineItem);
@@ -1267,9 +1245,9 @@ void KyraEngine_MR::setupOpcodeTable() {
Opcode(o2_clearSpecialSceneScriptState);
Opcode(o2_querySpecialSceneScriptState);
Opcode(o3_dummy);
- Opcode(o3_setHiddenItemsEntry);
+ Opcode(o2_setHiddenItemsEntry);
// 0x94
- Opcode(o3_getHiddenItemsEntry);
+ Opcode(o2_getHiddenItemsEntry);
Opcode(o3_dummy);
Opcode(o3_dummy);
OpcodeUnImpl();
diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp
index 81cb1becef..fcfb34561f 100644
--- a/engines/kyra/script_v2.cpp
+++ b/engines/kyra/script_v2.cpp
@@ -51,6 +51,13 @@ int KyraEngine_v2::o2_getCharacterScene(EMCState *script) {
return _mainCharacter.sceneId;
}
+int KyraEngine_v2::o2_setCharacterFacingOverwrite(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setCharacterFacingOverwrite(%p) (%d)", (const void *)script, stackPos(0));
+ _mainCharacter.facing = stackPos(0);
+ _overwriteSceneFacing = true;
+ return 0;
+}
+
int KyraEngine_v2::o2_trySceneChange(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_trySceneChange(%p) (%d, %d, %d, %d)", (const void *)script,
stackPos(0), stackPos(1), stackPos(2), stackPos(3));
@@ -76,6 +83,11 @@ int KyraEngine_v2::o2_moveCharacter(EMCState *script) {
return 0;
}
+int KyraEngine_v2::o2_checkForItem(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_checkForItem(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
+ return findItem(stackPos(0), stackPos(1)) == -1 ? 0 : 1;
+}
+
int KyraEngine_v2::o2_defineItem(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_defineItem(%p) (%d, %d, %d, %d)", (const void *)script,
stackPos(0), stackPos(1), stackPos(2), stackPos(3));
@@ -339,6 +351,16 @@ int KyraEngine_v2::o2_querySpecialSceneScriptState(EMCState *script) {
return _specialSceneScriptState[stackPos(0)];
}
+int KyraEngine_v2::o2_setHiddenItemsEntry(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setHiddenItemsEntry(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
+ return (_hiddenItems[stackPos(0)] = stackPos(1));
+}
+
+int KyraEngine_v2::o2_getHiddenItemsEntry(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getHiddenItemsEntry(%p) (%d)", (const void *)script, stackPos(0));
+ return (int16)_hiddenItems[stackPos(0)];
+}
+
int KyraEngine_v2::o2_disableTimer(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_disableTimer(%p) (%d)", (const void *)script, stackPos(0));
_timer->disable(stackPos(0));