[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.130,1.131 actor.h,1.71,1.72 script.h,1.81,1.82 sfuncs.cpp,1.114,1.115

Eugene Sandulenko sev at users.sourceforge.net
Sat May 21 18:24:42 CEST 2005


Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32761

Modified Files:
	actor.cpp actor.h script.h sfuncs.cpp 
Log Message:
Implement sfSimulSpeech2 which is used in lodge when talking to Sakka.
Fixed sfSimulSpeech(), so it plays voices with CD version.


Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- actor.cpp	18 May 2005 19:07:07 -0000	1.130
+++ actor.cpp	22 May 2005 01:20:46 -0000	1.131
@@ -1749,7 +1749,7 @@
 	_activeSpeech.slowModeCharIndex = 0;
 }
 
-void Actor::simulSpeech(const char *string, uint16 *actorIds, int actorIdsCount, int speechFlags) {
+void Actor::simulSpeech(const char *string, uint16 *actorIds, int actorIdsCount, int speechFlags, int sampleResourceId) {
 	int i;
 	
 	if (_vm->getGameType() == GType_IHNM) {
@@ -1769,7 +1769,7 @@
 	_activeSpeech.strings[0] = string;
 	_activeSpeech.stringsCount = 1;
 	_activeSpeech.speechFlags = speechFlags;
-	_activeSpeech.sampleResourceId = -1;
+	_activeSpeech.sampleResourceId = sampleResourceId;
 	_activeSpeech.playing = false;
 	_activeSpeech.slowModeCharIndex = 0;
 	

Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.h,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- actor.h	18 May 2005 18:28:09 -0000	1.71
+++ actor.h	22 May 2005 01:20:46 -0000	1.72
@@ -486,7 +486,7 @@
 //	speech 
 	void actorSpeech(uint16 actorId, const char **strings, int stringsCount, uint16 sampleResourceId, int speechFlags);
 	void nonActorSpeech(const char **strings, int stringsCount, int speechFlags);
-	void simulSpeech(const char *string, uint16 *actorIds, int actorIdsCount, int speechFlags);
+	void simulSpeech(const char *string, uint16 *actorIds, int actorIdsCount, int speechFlags, int sampleResourceId);
 	void setSpeechColor(int speechColor, int outlineColor) {
 		_activeSpeech.speechColor[0] = speechColor;
 		_activeSpeech.outlineColor[0] = outlineColor;

Index: script.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.h,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- script.h	18 May 2005 18:28:09 -0000	1.81
+++ script.h	22 May 2005 01:20:47 -0000	1.82
@@ -509,7 +509,7 @@
 	void sfCheckUserInterrupt(SCRIPTFUNC_PARAMS);
 	void sfScriptWalkRelative(SCRIPTFUNC_PARAMS);
 	void sfScriptMoveRelative(SCRIPTFUNC_PARAMS);
-	void SF_simulSpeech2(SCRIPTFUNC_PARAMS);
+	void sfSimulSpeech2(SCRIPTFUNC_PARAMS);
 	void sfPlacard(SCRIPTFUNC_PARAMS);
 	void sfPlacardOff(SCRIPTFUNC_PARAMS);
 	void sfSetProtagState(SCRIPTFUNC_PARAMS);

Index: sfuncs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sfuncs.cpp,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -d -r1.114 -r1.115
--- sfuncs.cpp	18 May 2005 18:28:10 -0000	1.114
+++ sfuncs.cpp	22 May 2005 01:20:47 -0000	1.115
@@ -97,7 +97,7 @@
 		OPCODE(sfCheckUserInterrupt),
 		OPCODE(sfScriptWalkRelative),
 		OPCODE(sfScriptMoveRelative),
-		OPCODE(SF_simulSpeech2),
+		OPCODE(sfSimulSpeech2),
 		OPCODE(sfPlacard),
 		OPCODE(sfPlacardOff),
 		OPCODE(sfSetProtagState),
@@ -808,6 +808,7 @@
 	int i;
 	uint16 actorsIds[ACTOR_SPEECH_ACTORS_MAX];
 	const char *string;
+	int16 sampleResourceId = -1;
 
 	stringId = thread->pop();
 	actorsCount = thread->pop();
@@ -820,7 +821,14 @@
 	
 	string = thread->_strings->getString(stringId);
 
-	_vm->_actor->simulSpeech(string, actorsIds, actorsCount, 0);
+	if (thread->_voiceLUT->voices) {
+		sampleResourceId = thread->_voiceLUT->voices[stringId];
+		if (sampleResourceId <= 0 || sampleResourceId > 4000)
+			sampleResourceId = -1;
+	}
+
+	_vm->_actor->simulSpeech(string, actorsIds, actorsCount, 0, sampleResourceId);
+	thread->wait(kWaitTypeSpeech);
 }
 
 // Script function #36 (0x24) ?
@@ -1118,11 +1126,35 @@
 }
 
 // Script function #47 (0x2F)
-void Script::SF_simulSpeech2(SCRIPTFUNC_PARAMS) {
-	for (int i = 0; i < nArgs; i++)
-		thread->pop();
+void Script::sfSimulSpeech2(SCRIPTFUNC_PARAMS) {
+	int16 stringId;
+	int16 actorsCount;
+	int16 speechFlags;
+	int i;
+	uint16 actorsIds[ACTOR_SPEECH_ACTORS_MAX];
+	const char *string;
+	int16 sampleResourceId = -1;
 
-	error(0, "STUB: SF_simulSpeech2(), %d args", nArgs);
+	stringId = thread->pop();
+	actorsCount = thread->pop();
+	speechFlags = thread->pop();
+
+	if (actorsCount > ACTOR_SPEECH_ACTORS_MAX)
+		error("sfSimulSpeech2 actorsCount=0x%X exceed ACTOR_SPEECH_ACTORS_MAX", actorsCount);
+
+	for (i = 0; i < actorsCount; i++)
+		actorsIds[i] = thread->pop();
+	
+	string = thread->_strings->getString(stringId);
+
+	if (thread->_voiceLUT->voices) {
+		sampleResourceId = thread->_voiceLUT->voices[stringId];
+		if (sampleResourceId <= 0 || sampleResourceId > 4000)
+			sampleResourceId = -1;
+	}
+
+	_vm->_actor->simulSpeech(string, actorsIds, actorsCount, speechFlags, sampleResourceId);
+	thread->wait(kWaitTypeSpeech);
 }
 
 static TEXTLIST_ENTRY *placardTextEntry;





More information about the Scummvm-git-logs mailing list