[Scummvm-cvs-logs] SF.net SVN: scummvm:[52514] scummvm/trunk/engines/sci

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sat Sep 4 10:51:11 CEST 2010


Revision: 52514
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52514&view=rev
Author:   m_kiewitz
Date:     2010-09-04 08:51:10 +0000 (Sat, 04 Sep 2010)

Log Message:
-----------
SCI: doing detectDoSoundType() properly sci0early

checking, if sound resources are sci0early or late for sci0early games instead of hardcoding lsl2

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/features.cpp
    scummvm/trunk/engines/sci/resource.cpp
    scummvm/trunk/engines/sci/resource.h

Modified: scummvm/trunk/engines/sci/engine/features.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/features.cpp	2010-09-04 08:28:53 UTC (rev 52513)
+++ scummvm/trunk/engines/sci/engine/features.cpp	2010-09-04 08:51:10 UTC (rev 52514)
@@ -138,12 +138,9 @@
 SciVersion GameFeatures::detectDoSoundType() {
 	if (_doSoundType == SCI_VERSION_NONE) {
 		if (getSciVersion() == SCI_VERSION_0_EARLY) {
-			// This game is using early SCI0 sound code (different headers than
-			// SCI0 late)
-			if (g_sci->getGameId() == GID_LSL2)
-				_doSoundType = SCI_VERSION_0_LATE;
-			else
-				_doSoundType = SCI_VERSION_0_EARLY;
+			// Almost all of the SCI0EARLY games use different sound resources than
+			//  SCI0LATE. Although the last SCI0EARLY game (lsl2) uses SCI0LATE resources
+			_doSoundType = g_sci->getResMan()->detectEarlySound() ? SCI_VERSION_0_EARLY : SCI_VERSION_0_LATE;
 #ifdef ENABLE_SCI32
 		} else if (getSciVersion() >= SCI_VERSION_2_1) {
 			_doSoundType = SCI_VERSION_2_1;

Modified: scummvm/trunk/engines/sci/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource.cpp	2010-09-04 08:28:53 UTC (rev 52513)
+++ scummvm/trunk/engines/sci/resource.cpp	2010-09-04 08:51:10 UTC (rev 52514)
@@ -2148,6 +2148,19 @@
 	return false;
 }
 
+// is called on SCI0EARLY games to make sure that sound resources are in fact also SCI0EARLY
+bool ResourceManager::detectEarlySound() {
+	Resource *res = findResource(ResourceId(kResourceTypeSound, 1), 0);
+	if (res) {
+		if (res->size >= 0x22) {
+			if (READ_LE_UINT16(res->data + 0x1f) == 0) // channel 15 voice count + play mask is 0 in SCI0LATE
+				if (res->data[0x21] == 0) // last byte right before actual data is 0 as well
+					return false; // these 2 bytes are 
+		}
+	}
+	return true;
+}
+
 // Functions below are based on PD code by Brian Provinciano (SCI Studio)
 bool ResourceManager::hasOldScriptHeader() {
 	Resource *res = findResource(ResourceId(kResourceTypeScript, 0), 0);

Modified: scummvm/trunk/engines/sci/resource.h
===================================================================
--- scummvm/trunk/engines/sci/resource.h	2010-09-04 08:28:53 UTC (rev 52513)
+++ scummvm/trunk/engines/sci/resource.h	2010-09-04 08:51:10 UTC (rev 52514)
@@ -345,6 +345,8 @@
 	bool detectFontExtended();
 	// Detects, if SCI1.1 game uses palette merging
 	bool detectForPaletteMergingForSci11();
+	// Detects, if SCI0EARLY game also has SCI0EARLY sound resources
+	bool detectEarlySound();
 
 	/**
 	 * Finds the internal Sierra ID of the current game from script 0.


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