[Scummvm-cvs-logs] SF.net SVN: scummvm: [31147] scummvm/trunk/engines/kyra

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Sun Mar 16 18:16:17 CET 2008


Revision: 31147
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31147&view=rev
Author:   athrxx
Date:     2008-03-16 10:16:17 -0700 (Sun, 16 Mar 2008)

Log Message:
-----------
- implement zanthIdleChat()
- bug fix for zanthRandomChat()

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/kyra_v2.cpp
    scummvm/trunk/engines/kyra/kyra_v2.h
    scummvm/trunk/engines/kyra/scene_v2.cpp
    scummvm/trunk/engines/kyra/text_v2.cpp

Modified: scummvm/trunk/engines/kyra/kyra_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-03-16 15:35:12 UTC (rev 31146)
+++ scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-03-16 17:16:17 UTC (rev 31147)
@@ -1593,14 +1593,14 @@
 		0x04, 0x06, 0x07, 0x08, 0x04, 0x09, 0x0A, 0x0B, 0xFF, 0x00
 	};
 
-	if (queryGameFlag(0x159))
+	if (queryGameFlag(0x159 && _flags.isTalkie))
 		return;
 
 	static bool scriptAnimation = false;
-	//if (!scriptAnimation) {
-	//	scriptAnimation = true;
-	//	sub_2715D();
-	//} else {
+	if (!scriptAnimation && _flags.isTalkie) {
+		scriptAnimation = true;
+		zanthIdleChat();
+	} else {
 		scriptAnimation = false;
 		if (_loadedZTable > 8)
 			return;
@@ -1619,7 +1619,7 @@
 
 		runIdleScript(script);
 		_lastIdleScript = script;
-	//}
+	}
 }
 
 void KyraEngine_v2::runIdleScript(int script) {

Modified: scummvm/trunk/engines/kyra/kyra_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.h	2008-03-16 15:35:12 UTC (rev 31146)
+++ scummvm/trunk/engines/kyra/kyra_v2.h	2008-03-16 17:16:17 UTC (rev 31147)
@@ -799,6 +799,7 @@
 
 	void zanthSceneStartupChat();
 	void zanthRandomChat();
+	void zanthIdleChat();
 	void updateDlgBuffer();
 	void loadDlgHeader(int &csEntry, int &vocH, int &scIndex1, int &scIndex2);
 	void processDialogue(int dlgOffset, int vocH = 0, int csEntry = 0);
@@ -1095,7 +1096,7 @@
 
 	uint8 *_unkBuf500Bytes;
 	uint8 *_unkBuf200kByte;
-	bool _unkFlag1;
+	bool _chatAltFlag;
 	int _unk3, _unk4, _unk5;
 	bool _unkSceneScreenFlag1;
 	bool _unkHandleSceneChangeFlag;

Modified: scummvm/trunk/engines/kyra/scene_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_v2.cpp	2008-03-16 15:35:12 UTC (rev 31146)
+++ scummvm/trunk/engines/kyra/scene_v2.cpp	2008-03-16 17:16:17 UTC (rev 31147)
@@ -86,7 +86,7 @@
 		_sound->beginFadeOut();
 	}
 	
-	_unkFlag1 = false;
+	_chatAltFlag = false;
 
 	if (!unk3) {
 		_scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData);

Modified: scummvm/trunk/engines/kyra/text_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/text_v2.cpp	2008-03-16 15:35:12 UTC (rev 31146)
+++ scummvm/trunk/engines/kyra/text_v2.cpp	2008-03-16 17:16:17 UTC (rev 31147)
@@ -394,7 +394,8 @@
 }
 
 void KyraEngine_v2::zanthSceneStartupChat() {
-	int tableIndex = _mainCharacter.sceneId - READ_LE_UINT16(&_ingameTalkObjIndex[5 + _newChapterFile]);
+	int lowest = _flags.isTalkie ? 6 : 5;
+	int tableIndex = _mainCharacter.sceneId - READ_LE_UINT16(&_ingameTalkObjIndex[lowest + _newChapterFile]);
 	if (queryGameFlag(0x159) || _newSceneDlgState[tableIndex])
 		return;
 
@@ -410,7 +411,8 @@
 }
 
 void KyraEngine_v2::zanthRandomChat() {
-	int tableIndex = _mainCharacter.sceneId - READ_LE_UINT16(&_ingameTalkObjIndex[5 + _newChapterFile]);
+	int lowest = _flags.isTalkie ? 6 : 5;
+	int tableIndex = (_mainCharacter.sceneId - READ_LE_UINT16(&_ingameTalkObjIndex[lowest + _newChapterFile])) << 2;
 	if (queryGameFlag(0x164))
 		return;
 
@@ -418,18 +420,40 @@
 	updateDlgBuffer();
 	loadDlgHeader(csEntry, vocH, scIndex1, unused);
 
-	if (_unkFlag1) {
-		_unkFlag1 = 0;
+	if (_chatAltFlag) {
+		_chatAltFlag = 0;
 		tableIndex += 2;
 	} else {
-		_unkFlag1 = 1;
+		_chatAltFlag = 1;
 	}
 
-	uint8 bufferIndex = 8 + scIndex1 * 6 + tableIndex * 2;
+	uint8 bufferIndex = 8 + scIndex1 * 6 + tableIndex;
 	int offs = READ_LE_UINT16(_dlgBuffer + bufferIndex);
 	processDialogue(offs, vocH, csEntry);
 }
 
+void KyraEngine_v2::zanthIdleChat() {
+	int lowest = _flags.isTalkie ? 6 : 5;
+	int tableIndex = (_mainCharacter.sceneId - READ_LE_UINT16(&_ingameTalkObjIndex[lowest + _newChapterFile])) << 2;
+	if (queryGameFlag(0x164))
+		return;
+
+	int csEntry, vocH, scIndex1, unused;
+	updateDlgBuffer();
+	loadDlgHeader(csEntry, vocH, scIndex1, unused);
+
+	if (_chatAltFlag) {
+		_chatAltFlag = 0;
+		tableIndex += 2;
+	} else {
+		_chatAltFlag = 1;
+	}
+	
+	uint8 bufferIndex = 8 + scIndex1 * 6 + tableIndex;
+	int offs = READ_LE_UINT16(_dlgBuffer + bufferIndex);
+	processDialogue(offs, vocH, csEntry);
+}
+
 void KyraEngine_v2::updateDlgBuffer() {
 	static const char DlgFileTemplate[] = "CH**-S**.DLG";
 	char filename[13];
@@ -700,7 +724,7 @@
 	memset(_newSceneDlgState, 0, 32);
 	for (int i = 0; i < 19; i++)
 		memset(_conversationState[i], -1, 14);
-	_unkFlag1 = false;
+	_chatAltFlag = false;
 	_mainCharacter.dlgIndex = dlgIndex;
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list