[Scummvm-git-logs] scummvm master -> 07d9aafb02cd43fb2d65751931ce8e10776c8891

AndywinXp noreply at scummvm.org
Fri Dec 27 12:08:34 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
07d9aafb02 SCUMM: MI1SE: Change speech.info parsing and script offset saving


Commit: 07d9aafb02cd43fb2d65751931ce8e10776c8891
    https://github.com/scummvm/scummvm/commit/07d9aafb02cd43fb2d65751931ce8e10776c8891
Author: AndywinXp (andywinxp at gmail.com)
Date: 2024-12-27T13:08:28+01:00

Commit Message:
SCUMM: MI1SE: Change speech.info parsing and script offset saving

This now matches the disasm but temporarily breaks our current
audio retrieval method. I will work on that separatedly.

Changed paths:
    engines/scumm/script_v5.cpp
    engines/scumm/scumm.h
    engines/scumm/soundse.cpp
    engines/scumm/soundse.h


diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp
index adc166d2660..aa03436cafa 100644
--- a/engines/scumm/script_v5.cpp
+++ b/engines/scumm/script_v5.cpp
@@ -1952,8 +1952,10 @@ void ScummEngine_v5::injectMISESpeech() {
 		_currentScriptSavedForSpeechMI = vm.slot[_currentScript].number;
 		uint16 localScriptOffset;
 
-		if (_currentScriptSavedForSpeechMI >= _numGlobalScripts) {
-			int16 localScriptNumber = _currentScriptSavedForSpeechMI - _numGlobalScripts;
+		int numGlobalScripts = _numGlobalScripts - 1; // It has to be 199 instead of 200
+
+		if (_currentScriptSavedForSpeechMI >= numGlobalScripts) {
+			int16 localScriptNumber = _currentScriptSavedForSpeechMI - numGlobalScripts;
 			if (localScriptNumber > 56)
 				localScriptOffset = 0;
 			else
@@ -1963,8 +1965,8 @@ void ScummEngine_v5::injectMISESpeech() {
 		}
 
 		// TODO: This doesn't work for all scripts, e.g. object scripts
-		_currentScriptOffsetSavedForSpeechMI = _scriptPointer - _scriptOrgPointer - 1 - localScriptOffset;
-		//_currentScriptOffsetSavedForSpeech = vm.slot[_currentScript].offs - 1 - localScriptOffset;	// from disasm
+		//_currentScriptOffsetSavedForSpeechMI = _scriptPointer - _scriptOrgPointer - 1 - localScriptOffset;
+		_currentScriptOffsetSavedForSpeechMI = vm.slot[_currentScript].offs - localScriptOffset; // from disasm
 		_currentSpeechIndexMI = 0;
 
 		// debug("injectMISESpeech: room %d, script %d, offset %d", _currentRoom, _currentScriptSavedForSpeechMI, _currentScriptOffsetSavedForSpeechMI);
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 47be119cb1f..52904266e0f 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -902,9 +902,9 @@ public:
 	int _NESStartStrip = 0;
 
 	/* MI SE injected speech */
-	int16 _currentScriptSavedForSpeechMI = 0;
-	int16 _currentScriptOffsetSavedForSpeechMI = 0;
-	int16 _currentSpeechIndexMI = 0;
+	int32 _currentScriptSavedForSpeechMI = 0;
+	int32 _currentScriptOffsetSavedForSpeechMI = 0;
+	int32 _currentSpeechIndexMI = 0;
 
 protected:
 	int _curPalIndex = 0;
diff --git a/engines/scumm/soundse.cpp b/engines/scumm/soundse.cpp
index 21cd8a9f693..fbdb515d33e 100644
--- a/engines/scumm/soundse.cpp
+++ b/engines/scumm/soundse.cpp
@@ -342,21 +342,25 @@ void SoundSE::initAudioMappingMI() {
 
 	do {
 		AudioEntryMI entry;
-		entry.unk1 = f->readUint16LE();
-		entry.unk2 = f->readUint16LE();
+		entry.hash = f->readUint32LE();
 		entry.room = f->readUint16LE();
 		entry.script = f->readUint16LE();
 		entry.localScriptOffset = f->readUint16LE();
 		entry.messageIndex = f->readUint16LE();
 		entry.isEgoTalking = f->readUint16LE();
 		entry.wait = f->readUint16LE();
+
 		entry.textEnglish = f->readString(0, 256);
-		f->skip(256 * 4); // skip the rest of the text
-		entry.speechFile = f->readString(0, 32);
+		entry.textFrench  = f->readString(0, 256);
+		entry.textItalian = f->readString(0, 256);
+		entry.textGerman  = f->readString(0, 256);
+		entry.textSpanish = f->readString(0, 256);
+
+		entry.speechFile  = f->readString(0, 32);
 		entry.speechFile.toLowercase();
 
-		//debug("unk1 %d, unk2 %d, room %d, script %d, localScriptOffset: %d, messageIndex %d, isEgoTalking: %d, wait: %d, textEnglish '%s', speechFile '%s'",
-		//	  entry.unk1, entry.unk2, entry.room, entry.script,
+		//debug("hash %d, room %d, script %d, localScriptOffset: %d, messageIndex %d, isEgoTalking: %d, wait: %d, textEnglish '%s', speechFile '%s'",
+		//	  entry.hash, entry.room, entry.script,
 		//	  entry.localScriptOffset, entry.messageIndex, entry.isEgoTalking, entry.wait,
 		//	  entry.textEnglish.c_str(), entry.speechFile.c_str());
 
@@ -534,7 +538,7 @@ Audio::AudioStream *SoundSE::getAudioStream(uint32 offset, SoundSEType type) {
 	return createSoundStream(subStream, audioEntry);
 }
 
-uint32 SoundSE::getAudioOffsetForMI(uint16 room, uint16 script, uint16 localScriptOffset, uint16 messageIndex) {
+uint32 SoundSE::getAudioOffsetForMI(int32 room, int32 script, int32 localScriptOffset, int32 messageIndex) {
 	return ((room + script + messageIndex) << 16) | (localScriptOffset & 0xFFFF);
 }
 
diff --git a/engines/scumm/soundse.h b/engines/scumm/soundse.h
index 18a918404cb..ab24059fe4c 100644
--- a/engines/scumm/soundse.h
+++ b/engines/scumm/soundse.h
@@ -56,7 +56,7 @@ public:
 
 	Audio::SeekableAudioStream *getXWBTrack(int track);
 	Audio::AudioStream *getAudioStream(uint32 offset, SoundSEType type);
-	uint32 getAudioOffsetForMI(uint16 room, uint16 script, uint16 localScriptOffset, uint16 messageIndex);
+	uint32 getAudioOffsetForMI(int32 room, int32 script, int32 localScriptOffset, int32 messageIndex);
 
 private:
 	enum AudioCodec {
@@ -102,8 +102,7 @@ private:
 
 	// Used in MI1 + MI2
 	struct AudioEntryMI {
-		uint16 unk1;
-		uint16 unk2;
+		uint32 hash;
 		uint16 room;
 		uint16 script;
 		uint16 localScriptOffset;
@@ -111,11 +110,11 @@ private:
 		uint16 isEgoTalking;        // 1 if ego is talking, 0 otherwise
 		uint16 wait;                // wait time in ms
 		Common::String textEnglish; // 256 bytes, English text
-		// 256 bytes, French text
-		// 256 bytes, Italian text
-		// 256 bytes, German text
-		// 256 bytes, Spanish text
-		Common::String speechFile; // 32 bytes
+		Common::String textFrench;  // 256 bytes, French text
+		Common::String textItalian; // 256 bytes, Italian text
+		Common::String textGerman;  // 256 bytes, German text
+		Common::String textSpanish; // 256 bytes, Spanish text
+		Common::String speechFile;  // 32 bytes
 	};
 
 	//typedef Common::Array<AudioEntryMI> AudioIndexMI;




More information about the Scummvm-git-logs mailing list