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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun Jan 27 03:05:37 CET 2008


Revision: 30645
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30645&view=rev
Author:   lordhoto
Date:     2008-01-26 18:05:37 -0800 (Sat, 26 Jan 2008)

Log Message:
-----------
Commit patch #1869752 "KYRA: HoF startup patch for towns and floppy". (Slightly modified)

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

Modified: scummvm/trunk/engines/kyra/kyra.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra.cpp	2008-01-26 19:25:04 UTC (rev 30644)
+++ scummvm/trunk/engines/kyra/kyra.cpp	2008-01-27 02:05:37 UTC (rev 30645)
@@ -162,6 +162,10 @@
 			_lang = 2;
 			break;
 
+		case Common::JA_JPN:
+			_lang = 3;
+			break;
+
 		default:
 			warning("unsupported language, switching back to English");
 			_lang = 0;

Modified: scummvm/trunk/engines/kyra/kyra_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-01-26 19:25:04 UTC (rev 30644)
+++ scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-01-27 02:05:37 UTC (rev 30645)
@@ -67,6 +67,7 @@
 	_newChapterFile = 1;
 	_oldTalkFile = -1;
 	_currentTalkFile = 0;
+	_lastSfxTrack = -1;
 	_handItemSet = -1;
 	_lastProcessedSceneScript = 0;
 	_specialSceneScriptRunFlag = false;
@@ -212,19 +213,21 @@
 	_screen->setMouseCursor(0, 0, getShapePtr(0));
 
 	_screenBuffer = new uint8[64000];
+	_unkBuf200kByte = new uint8[200000];
 
+	loadChapterBuffer(_newChapterFile);	
+
 	loadCCodeBuffer("C_CODE.XXX");
-	loadOptionsBuffer("OPTIONS.XXX");
-	loadChapterBuffer(_newChapterFile);
+	
+	if (_flags.isTalkie) {
+		loadOptionsBuffer("OPTIONS.XXX");
 
-	_unkBuf200kByte = new uint8[200000];
+		showMessageFromCCode(265, 150, 0);
+		openTalkFile(0);
+		_currentTalkFile = 1;
+		openTalkFile(1);
+	}
 
-	showMessageFromCCode(265, 150, 0);
-
-	openTalkFile(0);
-	_currentTalkFile = 1;
-	openTalkFile(1);
-
 	showMessage(0, 207);
 
 	_screen->setShapePages(5, 3);
@@ -806,7 +809,7 @@
 const char *KyraEngine_v2::getTableString(int id, const uint8 *buffer, int decode) {
 	const char *string = (const char*)getTableEntry(buffer, id);
 
-	if (decode) {
+	if (decode && _flags.lang != Common::JA_JPN) {
 		decodeString1(string, _internStringBuf);
 		decodeString2(_internStringBuf, _internStringBuf);
 		string = _internStringBuf;
@@ -920,15 +923,18 @@
 
 	strcpy(src, getTableString(str1, _cCodeBuffer, 1));
 
-	while (*src != 0x20)
+	if (_flags.lang != Common::JA_JPN) {
+		while (*src != 0x20)
+			++src;
 		++src;
-	++src;
-
-	*src = toupper(*src);
+		*src = toupper(*src);
+	}
+	
 	strcpy((char*)_unkBuf500Bytes, src);
 
 	if (str2 > 0) {
-		strcat((char*)_unkBuf500Bytes, " ");
+		if (_flags.lang != Common::JA_JPN)
+			strcat((char*)_unkBuf500Bytes, " ");
 		strcat((char*)_unkBuf500Bytes, getTableString(str2, _cCodeBuffer, 1));
 	}
 
@@ -1013,23 +1019,29 @@
 	char filename[12];
 	strcpy(filename, "_NPC.EMC");
 
-	switch (_lang) {
-	case 0:
-		filename[5] = 'E';
-		break;
+	if (_flags.platform != Common::kPlatformPC || _flags.isTalkie) {
+		switch (_lang) {
+		case 0:
+			filename[5] = 'E';
+			break;
 
-	case 1:
-		filename[5] = 'F';
-		break;
+		case 1:
+			filename[5] = 'F';
+			break;
 
-	case 2:
-		filename[5] = 'G';
-		break;
+		case 2:
+			filename[5] = 'G';
+			break;
 
-	default:
-		break;
-	};
+		case 3:
+			filename[5] = 'J';
+			break;
 
+		default:
+			break;
+		};
+	}
+
 	_scriptInterpreter->loadScript(filename, &_npcScriptData, &_opcodes);
 }
 
@@ -1552,10 +1564,33 @@
 }
 
 void KyraEngine_v2::playVoice(int high, int low) {
+	if (!_flags.isTalkie)
+		return;
 	int vocFile = high * 10000 + low * 10;
 	snd_playVoiceFile(vocFile);
 }
 
+void KyraEngine_v2::snd_playSoundEffect(int track) {
+	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine_v2::snd_playSoundEffect(%d)", track);
+	
+	if (track == 10)
+		track = _lastSfxTrack;
+
+	if (track == 10 || track == -1)
+		return;
+
+	_lastSfxTrack = track;
+
+	int16 vocIndex = (int16) READ_LE_UINT16(&_ingameSoundIndex[track * 2]);
+	if (vocIndex != -1)
+		_sound->voicePlay(_ingameSoundList[vocIndex]);
+	else if (_flags.platform == Common::kPlatformPC) 
+		// TODO ?? Maybe there is a way to let users select whether they want
+		// voc, midi or adl sfx (even though it makes no sense to choose anything but voc).
+		// For now this is used as a fallback only (if no voc file exists).
+		KyraEngine::snd_playSoundEffect(track);
+}
+
 #pragma mark -
 
 void KyraEngine_v2::loadInvWsa(const char *filename, int run, int delayTime, int page, int sfx, int sFrame, int flags) {

Modified: scummvm/trunk/engines/kyra/kyra_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.h	2008-01-26 19:25:04 UTC (rev 30644)
+++ scummvm/trunk/engines/kyra/kyra_v2.h	2008-01-27 02:05:37 UTC (rev 30645)
@@ -642,11 +642,13 @@
 	int _oldTalkFile;
 	int _currentTalkFile;
 	void openTalkFile(int newFile);
+	int _lastSfxTrack;
 
 	virtual void snd_playVoiceFile(int id);
 	void snd_loadSoundFile(int id);
 
 	void playVoice(int high, int low);
+	void snd_playSoundEffect(int track);
 
 	// timer
 	void timerFunc2(int);
@@ -869,6 +871,10 @@
 	int _cdaTrackTableFinaleSize;
 	const char *const *_sequenceSoundList;
 	int _sequenceSoundListSize;
+	const char *const *_ingameSoundList;
+	int _ingameSoundListSize;
+	const uint16 *_ingameSoundIndex;
+	int _ingameSoundIndexSize;
 	const char *const *_sequenceStrings;
 	int _sequenceStringsSize;
 	int _sequenceStringsDuration[33];

Modified: scummvm/trunk/engines/kyra/resource.h
===================================================================
--- scummvm/trunk/engines/kyra/resource.h	2008-01-26 19:25:04 UTC (rev 30644)
+++ scummvm/trunk/engines/kyra/resource.h	2008-01-27 02:05:37 UTC (rev 30645)
@@ -236,6 +236,8 @@
 	k2SeqplayFinaleCDA,
 
 	k2IngamePakFiles,
+	k2IngameSfxFiles,
+	k2IngameSfxIndex,
 	k2IngameTracks,
 	k2IngameCDA,
 

Modified: scummvm/trunk/engines/kyra/scene_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_v2.cpp	2008-01-26 19:25:04 UTC (rev 30644)
+++ scummvm/trunk/engines/kyra/scene_v2.cpp	2008-01-27 02:05:37 UTC (rev 30645)
@@ -35,9 +35,11 @@
 void KyraEngine_v2::enterNewScene(uint16 newScene, int facing, int unk1, int unk2, int unk3) {
 	if (_newChapterFile != _currentTalkFile) {
 		_currentTalkFile = _newChapterFile;
-		showMessageFromCCode(265, 150, 0);
-		_screen->updateScreen();
-		openTalkFile(_currentTalkFile);
+		if (_flags.isTalkie) {
+			showMessageFromCCode(265, 150, 0);
+			_screen->updateScreen();
+			openTalkFile(_currentTalkFile);
+		}
 		showMessage(0, 207);
 		_screen->updateScreen();
 	}
@@ -425,7 +427,7 @@
 	
 	strcpy(filename, _sceneList[sceneId].filename);
 	strcat(filename, ".");
-	strcat(filename, _scriptLangExt[_lang]);
+	strcat(filename, _scriptLangExt[(_flags.platform == Common::kPlatformPC && !_flags.isTalkie) ? 0 : _lang]);
 	
 	assert(_res->getFileSize(filename));
 	_scriptInterpreter->loadScript(filename, &_sceneScriptData, &_opcodes);

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2008-01-26 19:25:04 UTC (rev 30644)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2008-01-27 02:05:37 UTC (rev 30645)
@@ -35,7 +35,7 @@
 
 namespace Kyra {
 
-#define RESFILE_VERSION 18
+#define RESFILE_VERSION 19
 
 bool StaticResource::checkKyraDat() {
 	Common::File kyraDat;
@@ -239,6 +239,8 @@
 
 		// Ingame
 		{ k2IngamePakFiles, kStringList, "I_PAKFILES.TXT" },
+		{ k2IngameSfxFiles, kStringList, "I_SFXFILES.TXT" },
+		{ k2IngameSfxIndex, kRawData, "I_SFXINDEX.TRA" },		
 		{ k2IngameTracks, kStringList, "I_TRACKS.TRA" },
 		{ k2IngameCDA, kRawData, "I_TRACKS.CDA" },
 
@@ -914,6 +916,8 @@
 	_ingamePakList = _staticres->loadStrings(k2IngamePakFiles, _ingamePakListSize);
 	_sequenceStrings = _staticres->loadStrings(k2SeqplayStrings, _sequenceStringsSize);
 	_sequenceSoundList = _staticres->loadStrings(k2SeqplaySfxFiles, _sequenceSoundListSize);
+	_ingameSoundList = _staticres->loadStrings(k2IngameSfxFiles, _ingameSoundListSize);
+	_ingameSoundIndex = (const uint16*) _staticres->loadRawData(k2IngameSfxIndex, _ingameSoundIndexSize);
 	_musicFileListIntro = _staticres->loadStrings(k2SeqplayIntroTracks, _musicFileListIntroSize);
 	_musicFileListIngame = _staticres->loadStrings(k2IngameTracks, _musicFileListIngameSize);
 	_musicFileListFinale = _staticres->loadStrings(k2SeqplayFinaleTracks, _musicFileListFinaleSize);
@@ -1340,17 +1344,19 @@
 const char *KyraEngine_v2::_languageExtension[] = {
 	"ENG",
 	"FRE",
-	"GER"/*,
+	"GER",/*,
 	"ITA",		Italian and Spanish was never included
 	"SPA"*/
+	"JPN"
 };
 
 const char *KyraEngine_v2::_scriptLangExt[] = {
 	"EMC",
 	"FMC",
-	"GMC"/*,
+	"GMC",/*,
 	"IMC",		Italian and Spanish was never included
 	"SMC"*/
+	"JMC"
 };
 
 const int KyraEngine_v2::_characterFrameTable[] = {


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