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

waltervn at users.sourceforge.net waltervn at users.sourceforge.net
Sun Apr 26 01:31:04 CEST 2009


Revision: 40147
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40147&view=rev
Author:   waltervn
Date:     2009-04-25 23:31:03 +0000 (Sat, 25 Apr 2009)

Log Message:
-----------
SCI: DoSync should work now, but the lip-syncing mechanism also needs DoAudio
(currently stubbed), so it hasn't been tested yet.
so it hasn't been tested yet.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/ksound.cpp
    scummvm/trunk/engines/sci/engine/script.cpp
    scummvm/trunk/engines/sci/engine/vm.h
    scummvm/trunk/engines/sci/scicore/resource.cpp
    scummvm/trunk/engines/sci/scicore/resource.h

Modified: scummvm/trunk/engines/sci/engine/ksound.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/ksound.cpp	2009-04-25 17:58:23 UTC (rev 40146)
+++ scummvm/trunk/engines/sci/engine/ksound.cpp	2009-04-25 23:31:03 UTC (rev 40147)
@@ -1002,21 +1002,16 @@
 		s->sound.soundSync = (ResourceSync *)s->resmgr->findResource(kResourceTypeSync, UKPV(2), 1);
 
 		if (s->sound.soundSync) {
-			Object *obj = obj_get(s, argv[1]);
-			s->sound.soundSync->startSync(obj);
+			s->sound.soundSync->startSync(s, argv[1]);
 		} else {
 			// Notify the scripts to stop sound sync
-			//Object *obj = obj_get(s, argv[1]);
-			// TODO: Convert the following from Greg's code to SCI's code
-			//obj.setPropertyN(_objOfs[0x33], 0xFFFF);	// Greg's
-			//obj->variables[s->game_obj.offset[0x33]] = 0xFFFF;	// something like this?
+			PUT_SEL32V(argv[1], syncCue, -1);
 		}
 		break;
 	case 1:	// next sync
 		//printf("kDoSync: next sync\n");
 		if (s->sound.soundSync) {
-			Object *obj = obj_get(s, argv[1]);
-			s->sound.soundSync->nextSync(obj);
+			s->sound.soundSync->nextSync(s, argv[1]);
 		}
 		break;
 	case 2:	// stop sync

Modified: scummvm/trunk/engines/sci/engine/script.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/script.cpp	2009-04-25 17:58:23 UTC (rev 40146)
+++ scummvm/trunk/engines/sci/engine/script.cpp	2009-04-25 23:31:03 UTC (rev 40147)
@@ -208,6 +208,8 @@
 	FIND_SELECTOR(nodePtr);
 	FIND_SELECTOR(flags);
 	FIND_SELECTOR(points);
+	FIND_SELECTOR(syncCue);
+	FIND_SELECTOR(syncTime);
 }
 
 int sci_hexdump(byte *data, int length, int offsetplus) {

Modified: scummvm/trunk/engines/sci/engine/vm.h
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.h	2009-04-25 17:58:23 UTC (rev 40146)
+++ scummvm/trunk/engines/sci/engine/vm.h	2009-04-25 23:31:03 UTC (rev 40147)
@@ -380,6 +380,9 @@
 	Selector flags;
 
 	Selector points; /* Used by AvoidPath() */
+
+	Selector syncCue; /* Used by DoSync() */
+	Selector syncTime; /* Used by DoSync() */
 }; /* Contains selector IDs for a few selected selectors */
 
 struct ViewObject {

Modified: scummvm/trunk/engines/sci/scicore/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/resource.cpp	2009-04-25 17:58:23 UTC (rev 40146)
+++ scummvm/trunk/engines/sci/scicore/resource.cpp	2009-04-25 23:31:03 UTC (rev 40147)
@@ -28,6 +28,8 @@
 #include "common/util.h"
 #include "common/debug.h"
 
+#include "sci/engine/state.h"
+#include "sci/engine/kernel.h"
 #include "sci/tools.h"
 #include "sci/sci_memory.h"
 #include "sci/scicore/resource.h"
@@ -1167,35 +1169,30 @@
 	return error;
 }
 
-void ResourceSync::startSync(Object *obj) {
-	_syncTime = _syncCue = 0xFFFF;
-	// TODO: Convert the following from Greg's code to SCI's code
-	//obj.setPropertyN(g_sci->_objOfs[0x33], 0);	// Greg's
-	//obj->variables[s->game_obj.offset[0x33]] = 0;	// something like this?
+void ResourceSync::startSync(EngineState *s, reg_t obj) {
+	_syncTime = _syncCue = -1;
+	PUT_SEL32V(obj, syncCue, 0);
 	_ptr = (uint16 *)data;
 	//syncStarted = true;	// not used
 }
 
-void ResourceSync::nextSync(Object *obj) {
+void ResourceSync::nextSync(EngineState *s, reg_t obj) {
 	if (_ptr) {
-		_syncTime = READ_LE_UINT16(_ptr);
-		if (_syncTime == 0xFFFF) {
+		_syncTime = (int16)READ_LE_UINT16(_ptr);
+		if (_syncTime == -1) {
 			stopSync();
 		} else {
-			_syncCue = READ_LE_UINT16(_ptr + 1);
+			_syncCue = (int16)READ_LE_UINT16(_ptr + 1);
 			_ptr += 2;
 		}
-		// TODO: Convert the following from Greg's code to SCI's code
-		//obj.setPropertyN(g_sci->_objOfs[0x32], _syncTime);	// Greg's
-		//obj->variables[s->game_obj.offset[0x32]] = _syncTime;	// something like this?
-		//obj.setPropertyN(g_sci->_objOfs[0x33], _syncCue);		// Greg's
-		//obj->variables[s->game_obj.offset[0x33]] = _syncCue;	// something like this?
+		PUT_SEL32V(obj, syncTime, _syncTime);
+		PUT_SEL32V(obj, syncCue, _syncCue);
 	}
 }
 //--------------------------------
 void ResourceSync::stopSync() {
 	_ptr = 0;
-	_syncCue = 0xFFFF;
+	_syncCue = -1;
 	//syncStarted = false;	// not used
 }
 

Modified: scummvm/trunk/engines/sci/scicore/resource.h
===================================================================
--- scummvm/trunk/engines/sci/scicore/resource.h	2009-04-25 17:58:23 UTC (rev 40146)
+++ scummvm/trunk/engines/sci/scicore/resource.h	2009-04-25 23:31:03 UTC (rev 40147)
@@ -307,13 +307,13 @@
 	ResourceSync() {}
 	~ResourceSync() {}
 
-	void startSync(Object *obj);
-	void nextSync(Object *obj);
+	void startSync(EngineState *s, reg_t obj);
+	void nextSync(EngineState *s, reg_t obj);
 	void stopSync();
 
 protected:
 	uint16 *_ptr;
-	uint16 _syncTime, _syncCue;
+	int16 _syncTime, _syncCue;
 	//bool _syncStarted;	// not used
 };
 


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