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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun Dec 20 17:35:37 CET 2009


Revision: 46435
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46435&view=rev
Author:   thebluegr
Date:     2009-12-20 16:35:37 +0000 (Sun, 20 Dec 2009)

Log Message:
-----------
Implemented cmdUpdateCues() in the new sound code and fixed a crash when loading music with a resource number of zero

Modified Paths:
--------------
    scummvm/trunk/engines/sci/resource.cpp
    scummvm/trunk/engines/sci/sfx/soundcmd.cpp

Modified: scummvm/trunk/engines/sci/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource.cpp	2009-12-20 16:23:44 UTC (rev 46434)
+++ scummvm/trunk/engines/sci/resource.cpp	2009-12-20 16:35:37 UTC (rev 46435)
@@ -1809,7 +1809,7 @@
 }
 
 SoundResource::SoundResource(uint32 resNumber, ResourceManager *resMan) : _resMan(resMan) {
-	Resource *res = resNumber ? _resMan->findResource(ResourceId(kResourceTypeSound, resNumber), true) : NULL;
+	Resource *res = _resMan->findResource(ResourceId(kResourceTypeSound, resNumber), true);
 	if (!res)
 		return;
 

Modified: scummvm/trunk/engines/sci/sfx/soundcmd.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/soundcmd.cpp	2009-12-20 16:23:44 UTC (rev 46434)
+++ scummvm/trunk/engines/sci/sfx/soundcmd.cpp	2009-12-20 16:35:37 UTC (rev 46435)
@@ -604,6 +604,9 @@
 }
 
 void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) {
+	if (!obj.segment)
+		return;
+
 #ifdef USE_OLD_MUSIC_FUNCTIONS
 	int signal = 0;
 	int min = 0;
@@ -674,35 +677,32 @@
 		PUT_SEL32V(_segMan, obj, frame, frame);
 	}
 #else
-	// TODO
-#endif
 
-#if 0
-	if (hobj == 0)
+	int slot = _music->findListSlot(obj);
+	if (slot < 0) {
+		warning("cmdUpdateCues: Slot not found");
 		return;
-	Object obj(hobj);
-	HEAPHANDLE hnode = obj.getProperty(44);	// nodePtr
-	if (hnode) {
-		MusicEntry *pSnd = (MusicEntry *)heap2Ptr(hnode);
-		switch (pSnd->signal) {
-		case 0:
-			if (pSnd->dataInc != obj.getProperty(92)) { // dataInc
-				obj.setProperty(92, pSnd->dataInc);	// dataInc
-				obj.setProperty(17, pSnd->dataInc + 127); // signal
-			}
-			break;
-		case 0xFFFF:
-			StopSnd(hobj);
-			break;
-		default:
-			obj.setProperty(17, pSnd->signal);	// signal
+	}
+
+	if (!GET_SEL32(_segMan, obj, nodePtr).isNull()) {
+		int16 signal = GET_SEL32V(_segMan, obj, signal);
+		int16 dataInc = GET_SEL32V(_segMan, obj, dataInc);
+
+		switch (signal) {
+			case 0:
+				PUT_SEL32V(_segMan, obj, signal, dataInc + 127);
+				break;
+			case 0xFFFF:
+				cmdStopHandle(obj, value);
+				break;
+			default:
+				break;
 		}
-		//D13E
-		pSnd->signal = 0;
-		obj.setProperty(94, pSnd->ticker / 3600); // .min
-		obj.setProperty(95, pSnd->ticker % 3600 / 60); // .sec
-		obj.setProperty(96, pSnd->ticker); // .frame
-		obj.setProperty(97, pSnd->volume); // volume
+
+		uint16 ticker = _music->_playList[slot]->ticker;
+		PUT_SEL32V(_segMan, obj, min, ticker / 3600);
+		PUT_SEL32V(_segMan, obj, sec, ticker % 3600 / 60);
+		PUT_SEL32V(_segMan, obj, frame, ticker);
 	}
 #endif
 }


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