aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/kyra/animator_mr.cpp2
-rw-r--r--engines/kyra/kyra_hof.cpp4
-rw-r--r--engines/kyra/kyra_hof.h12
-rw-r--r--engines/kyra/kyra_mr.h10
-rw-r--r--engines/kyra/kyra_v2.h12
-rw-r--r--engines/kyra/saveload_hof.cpp4
-rw-r--r--engines/kyra/saveload_mr.cpp4
-rw-r--r--engines/kyra/script_hof.cpp53
-rw-r--r--engines/kyra/script_mr.cpp52
-rw-r--r--engines/kyra/script_v2.cpp44
-rw-r--r--engines/kyra/text_hof.cpp6
-rw-r--r--engines/kyra/text_mr.cpp8
12 files changed, 85 insertions, 126 deletions
diff --git a/engines/kyra/animator_mr.cpp b/engines/kyra/animator_mr.cpp
index 15c4db346c..ab3d347549 100644
--- a/engines/kyra/animator_mr.cpp
+++ b/engines/kyra/animator_mr.cpp
@@ -415,7 +415,7 @@ void KyraEngine_MR::showIdleAnim() {
return;
if (!_nextIdleType && !talkObjectsInCurScene()) {
- malcolmRandomChat();
+ randomSceneChat();
} else {
static const char *facingTable[] = {
"A", "R", "R", "FR", "FX", "FL", "L", "L"
diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp
index fad7717e5b..d682bdac13 100644
--- a/engines/kyra/kyra_hof.cpp
+++ b/engines/kyra/kyra_hof.cpp
@@ -129,7 +129,7 @@ KyraEngine_HoF::KyraEngine_HoF(OSystem *system, const GameFlags &flags) : KyraEn
_conversationState[i] = new int8[14];
_npcTalkChpIndex = _npcTalkDlgIndex = -1;
_mainCharacter.dlgIndex = 0;
- setNewDlgIndex(-1);
+ setDlgIndex(-1);
_bookMaxPage = 6;
_bookCurPage = 0;
@@ -1470,7 +1470,7 @@ void KyraEngine_HoF::showIdleAnim() {
static bool scriptAnimation = false;
if (!scriptAnimation && _flags.isTalkie) {
scriptAnimation = true;
- zanthRandomIdleChat();
+ randomSceneChat();
} else {
scriptAnimation = false;
if (_characterShapeFile > 8)
diff --git a/engines/kyra/kyra_hof.h b/engines/kyra/kyra_hof.h
index 1b49d42004..ec35eee3e4 100644
--- a/engines/kyra/kyra_hof.h
+++ b/engines/kyra/kyra_hof.h
@@ -605,12 +605,12 @@ protected:
void startDialogue(int dlgIndex);
void zanthSceneStartupChat();
- void zanthRandomIdleChat();
+ void randomSceneChat();
void updateDlgBuffer();
void loadDlgHeader(int &csEntry, int &vocH, int &scIndex1, int &scIndex2);
void processDialogue(int dlgOffset, int vocH = 0, int csEntry = 0);
void npcChatSequence(const char *str, int objectId, int vocHigh = -1, int vocLow = -1);
- void setNewDlgIndex(int dlgIndex);
+ void setDlgIndex(int dlgIndex);
int _npcTalkChpIndex;
int _npcTalkDlgIndex;
@@ -731,7 +731,6 @@ protected:
int o2_checkForItem(EMCState *script);
int o2_loadSoundFile(EMCState *script);
int o2_removeItemSlotFromInventory(EMCState *script);
- int o2_defineItem(EMCState *script);
int o2_removeItemFromInventory(EMCState *script);
int o2_countItemInInventory(EMCState *script);
int o2_countItemsInScene(EMCState *script);
@@ -758,15 +757,13 @@ protected:
int o2_restoreInventoryGfx(EMCState *script);
int o2_setSceneAnimPos2(EMCState *script);
int o2_fadeScenePal(EMCState *script);
- int o2_enterNewSceneEx(EMCState *script);
+ int o2_enterNewScene(EMCState *script);
int o2_switchScene(EMCState *script);
- int o2_getShapeFlag1(EMCState *script);
int o2_setPathfinderFlag(EMCState *script);
int o2_getSceneExitToFacing(EMCState *script);
int o2_setLayerFlag(EMCState *script);
int o2_setZanthiaPos(EMCState *script);
int o2_loadMusicTrack(EMCState *script);
- int o2_playWanderScoreViaMap(EMCState *script);
int o2_playSoundEffect(EMCState *script);
int o2_setSceneAnimPos(EMCState *script);
int o2_blockInRegion(EMCState *script);
@@ -784,9 +781,6 @@ protected:
int o2_addToSceneAnimPosAndUpdate(EMCState *script);
int o2_useItemOnMainChar(EMCState *script);
int o2_startDialogue(EMCState *script);
- int o2_zanthRandomChat(EMCState *script);
- int o2_setupDialogue(EMCState *script);
- int o2_getDlgIndex(EMCState *script);
int o2_addCauldronStateTableEntry(EMCState *script);
int o2_setCountDown(EMCState *script);
int o2_getCountDown(EMCState *script);
diff --git a/engines/kyra/kyra_mr.h b/engines/kyra/kyra_mr.h
index 028208ae6f..20f6334bdf 100644
--- a/engines/kyra/kyra_mr.h
+++ b/engines/kyra/kyra_mr.h
@@ -405,7 +405,7 @@ private:
byte _newSceneDlgState[40];
int8 _conversationState[30][30];
bool _chatAltFlag;
- void setDlgIndex(uint16 index);
+ void setDlgIndex(int index);
void updateDlgIndex();
Common::SeekableReadStream *_cnvFile;
@@ -434,7 +434,7 @@ private:
int o3d_updateAnim(EMCState *script);
int o3d_delay(EMCState *script);
- void malcolmRandomChat();
+ void randomSceneChat();
void runDialog(int dlgIndex, int funcNum);
// conscience
@@ -521,7 +521,6 @@ private:
int o3_objectChat(EMCState *script);
int o3_checkForItem(EMCState *script);
int o3_resetInventory(EMCState *script);
- int o3_defineItem(EMCState *script);
int o3_removeInventoryItemInstances(EMCState *script);
int o3_countInventoryItemInstances(EMCState *script);
int o3_npcChatSequence(EMCState *script);
@@ -544,10 +543,8 @@ private:
int o3_enableInventory(EMCState *script);
int o3_enterNewScene(EMCState *script);
int o3_switchScene(EMCState *script);
- int o3_getShapeFlag1(EMCState *script);
int o3_setMalcolmPos(EMCState *script);
int o3_stopMusic(EMCState *script);
- int o3_playWanderScoreViaMap(EMCState *script);
int o3_playSoundEffect(EMCState *script);
int o3_getScore(EMCState *script);
int o3_blockOutRegion(EMCState *script);
@@ -559,9 +556,6 @@ private:
int o3_updateSceneAnim(EMCState *script);
int o3_runActorScript(EMCState *script);
int o3_runDialog(EMCState *script);
- int o3_malcolmRandomChat(EMCState *script);
- int o3_setDlgIndex(EMCState *script);
- int o3_getDlgIndex(EMCState *script);
int o3_setConversationState(EMCState *script);
int o3_getConversationState(EMCState *script);
int o3_changeChapter(EMCState *script);
diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h
index 3f68c71ae7..01697651dc 100644
--- a/engines/kyra/kyra_v2.h
+++ b/engines/kyra/kyra_v2.h
@@ -310,7 +310,7 @@ protected:
// character
struct Character {
uint16 sceneId;
- uint16 dlgIndex;
+ int16 dlgIndex;
uint8 height;
uint8 facing;
uint16 animFrame;
@@ -347,6 +347,10 @@ protected:
EMCData _chatScriptData;
EMCState _chatScriptState;
+ virtual void setDlgIndex(int dlgIndex) = 0;
+
+ virtual void randomSceneChat() = 0;
+
// unknown
int _unk3, _unk4, _unk5;
bool _unkSceneScreenFlag1;
@@ -359,6 +363,7 @@ protected:
int o2_getCharacterScene(EMCState *script);
int o2_trySceneChange(EMCState *script);
int o2_moveCharacter(EMCState *script);
+ int o2_defineItem(EMCState *script);
int o2_queryGameFlag(EMCState *script);
int o2_resetGameFlag(EMCState *script);
int o2_setGameFlag(EMCState *script);
@@ -371,9 +376,14 @@ protected:
int o2_showMouse(EMCState *script);
int o2_delay(EMCState *script);
int o2_update(EMCState *script);
+ int o2_getShapeFlag1(EMCState *script);
+ int o2_playWanderScoreViaMap(EMCState *script);
int o2_getRand(EMCState *script);
int o2_setDeathHandler(EMCState *script);
int o2_waitForConfirmationClick(EMCState *script);
+ int o2_randomSceneChat(EMCState *script);
+ int o2_setDlgIndex(EMCState *script);
+ int o2_getDlgIndex(EMCState *script);
int o2_defineRoomEntrance(EMCState *script);
int o2_runAnimationScript(EMCState *script);
int o2_setSpecialSceneScriptRunTime(EMCState *script);
diff --git a/engines/kyra/saveload_hof.cpp b/engines/kyra/saveload_hof.cpp
index 283e40acaa..954cbccfa9 100644
--- a/engines/kyra/saveload_hof.cpp
+++ b/engines/kyra/saveload_hof.cpp
@@ -73,7 +73,7 @@ void KyraEngine_HoF::saveGame(const char *fileName, const char *saveName) {
out->writeSint16BE(_cauldronUseCount);
out->writeUint16BE(_mainCharacter.sceneId);
- out->writeUint16BE(_mainCharacter.dlgIndex);
+ out->writeSint16BE(_mainCharacter.dlgIndex);
out->writeByte(_mainCharacter.height);
out->writeByte(_mainCharacter.facing);
out->writeUint16BE(_mainCharacter.animFrame);
@@ -205,7 +205,7 @@ void KyraEngine_HoF::loadGame(const char *fileName) {
in.seek(6, SEEK_CUR);
_mainCharacter.sceneId = in.readUint16();
- _mainCharacter.dlgIndex = in.readUint16();
+ _mainCharacter.dlgIndex = in.readSint16();
_mainCharacter.height = in.readByte();
_mainCharacter.facing = in.readByte();
_mainCharacter.animFrame = in.readUint16();
diff --git a/engines/kyra/saveload_mr.cpp b/engines/kyra/saveload_mr.cpp
index e4e63c4599..8b727862a5 100644
--- a/engines/kyra/saveload_mr.cpp
+++ b/engines/kyra/saveload_mr.cpp
@@ -60,7 +60,7 @@ void KyraEngine_MR::saveGame(const char *fileName, const char *saveName) {
out->write(_scoreFlagTable, sizeof(_scoreFlagTable));
out->writeUint16BE(_mainCharacter.sceneId);
- out->writeUint16BE(_mainCharacter.dlgIndex);
+ out->writeSint16BE(_mainCharacter.dlgIndex);
out->writeByte(_mainCharacter.height);
out->writeByte(_mainCharacter.facing);
out->writeUint16BE(_mainCharacter.animFrame);
@@ -169,7 +169,7 @@ void KyraEngine_MR::loadGame(const char *fileName) {
in.read(_scoreFlagTable, sizeof(_scoreFlagTable));
_mainCharacter.sceneId = in.readUint16();
- _mainCharacter.dlgIndex = in.readUint16();
+ _mainCharacter.dlgIndex = in.readSint16();
_mainCharacter.height = in.readByte();
_mainCharacter.facing = in.readByte();
_mainCharacter.animFrame = in.readUint16();
diff --git a/engines/kyra/script_hof.cpp b/engines/kyra/script_hof.cpp
index a0f278ef4c..45d1e6cc87 100644
--- a/engines/kyra/script_hof.cpp
+++ b/engines/kyra/script_hof.cpp
@@ -426,21 +426,6 @@ int KyraEngine_HoF::o2_removeItemSlotFromInventory(EMCState *script) {
return 0;
}
-int KyraEngine_HoF::o2_defineItem(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_defineItem(%p) (%d, %d, %d, %d)", (const void *)script,
- stackPos(0), stackPos(1), stackPos(2), stackPos(3));
- int freeItem = findFreeItem();
-
- if (freeItem >= 0) {
- _itemList[freeItem].id = stackPos(0);
- _itemList[freeItem].x = stackPos(1);
- _itemList[freeItem].y = stackPos(2);
- _itemList[freeItem].sceneId = stackPos(3);
- }
-
- return freeItem;
-}
-
int KyraEngine_HoF::o2_removeItemFromInventory(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_removeItemFromInventory(%p) (%d)", (const void *)script, stackPos(0));
uint16 item = stackPos(0);
@@ -670,8 +655,8 @@ int KyraEngine_HoF::o2_fadeScenePal(EMCState *script) {
return 0;
}
-int KyraEngine_HoF::o2_enterNewSceneEx(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_enterNewSceneEx(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0),
+int KyraEngine_HoF::o2_enterNewScene(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_enterNewScene(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0),
stackPos(1), stackPos(2), stackPos(3), stackPos(4));
int skipNpcScript = stackPos(3);
@@ -701,11 +686,6 @@ int KyraEngine_HoF::o2_switchScene(EMCState *script) {
return 0;
}
-int KyraEngine_HoF::o2_getShapeFlag1(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_getShapeFlag1(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
- return _screen->getShapeFlag1(stackPos(0), stackPos(1));
-}
-
int KyraEngine_HoF::o2_setPathfinderFlag(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_setPathfinderFlag(%p) (%d)", (const void *)script, stackPos(0));
_pathfinderFlag = stackPos(0);
@@ -755,12 +735,6 @@ int KyraEngine_HoF::o2_loadMusicTrack(EMCState *script) {
return 0;
}
-int KyraEngine_HoF::o2_playWanderScoreViaMap(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_playWanderScoreViaMap(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
- snd_playWanderScoreViaMap(stackPos(0), stackPos(1));
- return 0;
-}
-
int KyraEngine_HoF::o2_playSoundEffect(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_playSoundEffect(%p) (%d)", (const void *)script, stackPos(0));
snd_playSoundEffect(stackPos(0));
@@ -1000,23 +974,6 @@ int KyraEngine_HoF::o2_startDialogue(EMCState *script) {
return 0;
}
-int KyraEngine_HoF::o2_zanthRandomChat(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_zanthRandomChat(%p)", (const void *)script);
- zanthRandomIdleChat();
- return 0;
-}
-
-int KyraEngine_HoF::o2_setupDialogue(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_setupDialogue(%p) (%d)", (const void *)script, stackPos(0));
- setNewDlgIndex(stackPos(0));
- return 0;
-}
-
-int KyraEngine_HoF::o2_getDlgIndex(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_setNewDlgIndex(%p) (%d)", (const void *)script, stackPos(0));
- return _mainCharacter.dlgIndex;
-}
-
int KyraEngine_HoF::o2_addCauldronStateTableEntry(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_addCauldronStateTableEntry(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
return addToCauldronStateTable(stackPos(0), stackPos(1)) ? 1 : 0;
@@ -1656,7 +1613,7 @@ void KyraEngine_HoF::setupOpcodeTable() {
Opcode(o2_dummy);
Opcode(o2_dummy);
// 0x50
- Opcode(o2_enterNewSceneEx);
+ Opcode(o2_enterNewScene);
Opcode(o2_switchScene);
Opcode(o2_getShapeFlag1);
Opcode(o2_setPathfinderFlag);
@@ -1703,8 +1660,8 @@ void KyraEngine_HoF::setupOpcodeTable() {
// 0x74
Opcode(o2_useItemOnMainChar);
Opcode(o2_startDialogue);
- Opcode(o2_zanthRandomChat);
- Opcode(o2_setupDialogue);
+ Opcode(o2_randomSceneChat);
+ Opcode(o2_setDlgIndex);
// 0x78
Opcode(o2_getDlgIndex);
Opcode(o2_defineScene);
diff --git a/engines/kyra/script_mr.cpp b/engines/kyra/script_mr.cpp
index f7063999a8..247913a984 100644
--- a/engines/kyra/script_mr.cpp
+++ b/engines/kyra/script_mr.cpp
@@ -217,18 +217,6 @@ int KyraEngine_MR::o3_resetInventory(EMCState *script) {
return 0;
}
-int KyraEngine_MR::o3_defineItem(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_defineItem(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3));
- int freeItem = findFreeItem();
- if (freeItem != -1) {
- _itemList[freeItem].id = stackPos(0);
- _itemList[freeItem].x = stackPos(1);
- _itemList[freeItem].y = stackPos(2);
- _itemList[freeItem].sceneId = stackPos(3);
- }
- return freeItem;
-}
-
int KyraEngine_MR::o3_removeInventoryItemInstances(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_removeInventoryItemInstances(%p) (%d)", (const void *)script, stackPos(0));
const int item = stackPos(0);
@@ -717,11 +705,6 @@ int KyraEngine_MR::o3_switchScene(EMCState *script) {
return 0;
}
-int KyraEngine_MR::o3_getShapeFlag1(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_getShapeFlag1(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
- return _screen->getShapeFlag1(stackPos(0), stackPos(1));
-}
-
int KyraEngine_MR::o3_setMalcolmPos(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setMalcolmPos(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
_mainCharX = stackPos(0);
@@ -741,12 +724,6 @@ int KyraEngine_MR::o3_stopMusic(EMCState *script) {
return 0;
}
-int KyraEngine_MR::o3_playWanderScoreViaMap(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_playWanderScoreViaMap(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
- snd_playWanderScoreViaMap(stackPos(0), stackPos(1));
- return 0;
-}
-
int KyraEngine_MR::o3_playSoundEffect(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_playSoundEffect(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
snd_playSoundEffect(stackPos(0), stackPos(1));
@@ -902,23 +879,6 @@ int KyraEngine_MR::o3_runDialog(EMCState *script) {
return 0;
}
-int KyraEngine_MR::o3_malcolmRandomChat(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_malcolmRandomChat(%p) ()", (const void *)script);
- malcolmRandomChat();
- return 0;
-}
-
-int KyraEngine_MR::o3_setDlgIndex(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setDlgIndex(%p) (%d)", (const void *)script, stackPos(0));
- setDlgIndex(stackPos(0));
- return 0;
-}
-
-int KyraEngine_MR::o3_getDlgIndex(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_getDlgIndex(%p) ()", (const void *)script);
- return _mainCharacter.dlgIndex;
-}
-
int KyraEngine_MR::o3_setConversationState(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setConversationState(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
int id = stackPos(0);
@@ -1167,7 +1127,7 @@ void KyraEngine_MR::setupOpcodeTable() {
Opcode(o3_checkForItem);
Opcode(o3_dummy);
Opcode(o3_resetInventory);
- Opcode(o3_defineItem);
+ Opcode(o2_defineItem);
// 0x24
Opcode(o3_removeInventoryItemInstances);
Opcode(o3_countInventoryItemInstances);
@@ -1226,7 +1186,7 @@ void KyraEngine_MR::setupOpcodeTable() {
// 0x50
Opcode(o3_enterNewScene);
Opcode(o3_switchScene);
- Opcode(o3_getShapeFlag1);
+ Opcode(o2_getShapeFlag1);
Opcode(o3_dummy);
// 0x54
Opcode(o3_dummy);
@@ -1234,7 +1194,7 @@ void KyraEngine_MR::setupOpcodeTable() {
Opcode(o3_setMalcolmPos);
Opcode(o3_stopMusic);
// 0x58
- Opcode(o3_playWanderScoreViaMap);
+ Opcode(o2_playWanderScoreViaMap);
Opcode(o3_playSoundEffect);
Opcode(o3_getScore);
OpcodeUnImpl();
@@ -1271,10 +1231,10 @@ void KyraEngine_MR::setupOpcodeTable() {
// 0x74
Opcode(o3_runActorScript);
Opcode(o3_runDialog);
- Opcode(o3_malcolmRandomChat);
- Opcode(o3_setDlgIndex);
+ Opcode(o2_randomSceneChat);
+ Opcode(o2_setDlgIndex);
// 0x78
- Opcode(o3_getDlgIndex);
+ Opcode(o2_getDlgIndex);
Opcode(o2_defineScene);
Opcode(o3_setConversationState);
OpcodeUnImpl();
diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp
index 2f16a23731..81cb1becef 100644
--- a/engines/kyra/script_v2.cpp
+++ b/engines/kyra/script_v2.cpp
@@ -76,6 +76,21 @@ int KyraEngine_v2::o2_moveCharacter(EMCState *script) {
return 0;
}
+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));
+ int freeItem = findFreeItem();
+
+ if (freeItem >= 0) {
+ _itemList[freeItem].id = stackPos(0);
+ _itemList[freeItem].x = stackPos(1);
+ _itemList[freeItem].y = stackPos(2);
+ _itemList[freeItem].sceneId = stackPos(3);
+ }
+
+ return freeItem;
+}
+
int KyraEngine_v2::o2_queryGameFlag(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_queryGameFlag(%p) (%d)", (const void *)script, stackPos(0));
return queryGameFlag(stackPos(0));
@@ -174,6 +189,17 @@ int KyraEngine_v2::o2_update(EMCState *script) {
return 0;
}
+int KyraEngine_v2::o2_getShapeFlag1(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getShapeFlag1(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
+ return screen()->getShapeFlag1(stackPos(0), stackPos(1));
+}
+
+int KyraEngine_v2::o2_playWanderScoreViaMap(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_playWanderScoreViaMap(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
+ snd_playWanderScoreViaMap(stackPos(0), stackPos(1));
+ return 0;
+}
+
int KyraEngine_v2::o2_getRand(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getRand(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
assert(stackPos(0) < stackPos(1));
@@ -210,6 +236,24 @@ int KyraEngine_v2::o2_waitForConfirmationClick(EMCState *script) {
return 1;
}
+int KyraEngine_v2::o2_randomSceneChat(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_randomSceneChat(%p)", (const void *)script);
+ randomSceneChat();
+ return 0;
+}
+
+int KyraEngine_v2::o2_setDlgIndex(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setDlgIndex(%p) (%d)", (const void *)script, stackPos(0));
+ setDlgIndex(stackPos(0));
+ return 0;
+}
+
+int KyraEngine_v2::o2_getDlgIndex(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getDlgIndex(%p) ()", (const void *)script);
+ return _mainCharacter.dlgIndex;
+}
+
+
int KyraEngine_v2::o2_defineRoomEntrance(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_defineRoomEntrance(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
switch (stackPos(0)) {
diff --git a/engines/kyra/text_hof.cpp b/engines/kyra/text_hof.cpp
index 8def912926..dd1796dd02 100644
--- a/engines/kyra/text_hof.cpp
+++ b/engines/kyra/text_hof.cpp
@@ -412,7 +412,7 @@ void KyraEngine_HoF::zanthSceneStartupChat() {
_newSceneDlgState[tableIndex] = 1;
}
-void KyraEngine_HoF::zanthRandomIdleChat() {
+void KyraEngine_HoF::randomSceneChat() {
int lowest = _flags.isTalkie ? 6 : 5;
int tableIndex = (_mainCharacter.sceneId - READ_LE_UINT16(&_ingameTalkObjIndex[lowest + _newChapterFile])) << 2;
if (queryGameFlag(0x164))
@@ -512,7 +512,7 @@ void KyraEngine_HoF::processDialogue(int dlgOffset, int vocH, int csEntry) {
} else if (cmd == 4) {
csEntry = READ_LE_UINT16(_dlgBuffer + offs);
- setNewDlgIndex(csEntry);
+ setDlgIndex(csEntry);
offs += 2;
} else {
@@ -677,7 +677,7 @@ void KyraEngine_HoF::npcChatSequence(const char *str, int objectId, int vocHigh,
setNextIdleAnimTimer();
}
-void KyraEngine_HoF::setNewDlgIndex(int dlgIndex) {
+void KyraEngine_HoF::setDlgIndex(int dlgIndex) {
if (dlgIndex == _mainCharacter.dlgIndex)
return;
memset(_newSceneDlgState, 0, 32);
diff --git a/engines/kyra/text_mr.cpp b/engines/kyra/text_mr.cpp
index b1c2bc9eec..309637303a 100644
--- a/engines/kyra/text_mr.cpp
+++ b/engines/kyra/text_mr.cpp
@@ -556,10 +556,10 @@ void KyraEngine_MR::loadDlgHeader(int &vocHighBase, int &vocHighIndex, int &inde
index2 = _cnvFile->readSint16LE();
}
-void KyraEngine_MR::setDlgIndex(uint16 index) {
+void KyraEngine_MR::setDlgIndex(int index) {
debugC(9, kDebugLevelMain, "KyraEngine_MR::setDlgIndex(%d)", index);
if (_mainCharacter.dlgIndex != index) {
- Common::set_to(_newSceneDlgState, _newSceneDlgState+ARRAYSIZE(_newSceneDlgState), 0);
+ memset(_newSceneDlgState, 0, sizeof(_newSceneDlgState));
memset(_conversationState, -1, sizeof(_conversationState));
_chatAltFlag = false;
_mainCharacter.dlgIndex = index;
@@ -746,8 +746,8 @@ void KyraEngine_MR::npcChatSequence(const char *str, int object, int vocHigh, in
_chatObject= - 1;
}
-void KyraEngine_MR::malcolmRandomChat() {
- debugC(9, kDebugLevelMain, "KyraEngine_MR::malcolmRandomChat()");
+void KyraEngine_MR::randomSceneChat() {
+ debugC(9, kDebugLevelMain, "KyraEngine_MR::randomSceneChat()");
updateDlgBuffer();
int index = (_mainCharacter.sceneId - _chapterLowestScene[_currentChapter]) * 2;