[Scummvm-cvs-logs] CVS: scummvm/queen cutaway.cpp,1.21,1.22 cutaway.h,1.9,1.10 defs.h,1.6,1.7 logic.cpp,1.40,1.41 logic.h,1.30,1.31 talk.cpp,1.7,1.8 talk.h,1.5,1.6 xref.txt,1.4,1.5

David Eriksson twogood at users.sourceforge.net
Wed Oct 15 02:24:11 CEST 2003


Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv17016

Modified Files:
	cutaway.cpp cutaway.h defs.h logic.cpp logic.h talk.cpp talk.h 
	xref.txt 
Log Message:
- Make Cutaway use Walk object from Logic
- Added talkSpeed to Logic
- Some more Talk code


Index: cutaway.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- cutaway.cpp	15 Oct 2003 08:46:04 -0000	1.21
+++ cutaway.cpp	15 Oct 2003 09:23:05 -0000	1.22
@@ -58,9 +58,8 @@
 		char *nextFilename,
 		Graphics *graphics,
 		Logic *logic,
-		Resource *resource,
-		Walk *walk) {
-	Cutaway *cutaway = new Cutaway(filename, graphics,logic, resource, walk);
+		Resource *resource) {
+	Cutaway *cutaway = new Cutaway(filename, graphics, logic, resource);
 	cutaway->run(nextFilename);
 	delete cutaway;
 }
@@ -69,9 +68,8 @@
 		const char *filename, 
 		Graphics *graphics,
 		Logic *logic,
-		Resource *resource,
-		Walk *walk) 
-: _graphics(graphics), _logic(logic), _resource(resource), _walk(walk),
+		Resource *resource) 
+: _graphics(graphics), _logic(logic), _resource(resource), _walk(logic->walk()),
 	_quit(false), _personFaceCount(0), _lastSong(0), _songBeforeComic(0) {
 	memset(&_bankNames, 0, sizeof(_bankNames));
 	load(filename); 
@@ -1050,7 +1048,7 @@
 		warning("Cutaway::talk() used but not fully implemented");
 		nextFilename[0] = '\0';
 
-		Talk::talk(_talkFile, nextFilename, _graphics, _logic, _resource);
+		Talk::talk(_talkFile, 0 /* XXX */, nextFilename, _graphics, _logic, _resource);
 	}
 }
 

Index: cutaway.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- cutaway.h	14 Oct 2003 12:37:07 -0000	1.9
+++ cutaway.h	15 Oct 2003 09:23:05 -0000	1.10
@@ -39,8 +39,8 @@
 				char *nextFilename,
 				Graphics *graphics,
 				Logic *logic,
-				Resource *resource,
-				Walk *walk);
+				Resource *resource);
+
 	private:
 		//! Collection of constants used by QueenCutaway
 		enum {
@@ -205,8 +205,7 @@
 				const char *filename, 
 				Graphics *graphics,
 				Logic *logic,
-				Resource *resource,
-				Walk *walk);
+				Resource *resource);
 		~Cutaway();
 
 		//! Run this cutaway object 

Index: defs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/defs.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- defs.h	14 Oct 2003 09:12:00 -0000	1.6
+++ defs.h	15 Oct 2003 09:23:05 -0000	1.7
@@ -105,6 +105,11 @@
 	STATE_DIR_FRONT = 3
 };
 
+enum StateTalk {
+	STATE_TALK_TALK,
+	STATE_TALK_MUTE
+};
+
 
 } // End of namespace Queen
 

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- logic.cpp	15 Oct 2003 08:46:18 -0000	1.40
+++ logic.cpp	15 Oct 2003 09:23:05 -0000	1.41
@@ -28,7 +28,7 @@
 namespace Queen {
 
 Logic::Logic(Resource *resource, Graphics *graphics) 
-	: _resource(resource), _graphics(graphics) {
+	: _resource(resource), _graphics(graphics), _talkSpeed(DEFAULT_TALK_SPEED) {
 	_jas = _resource->loadFile("QUEEN.JAS", 20);
 	_joe.x = _joe.y = 0;
 	_walk = new Walk(this, _graphics);
@@ -573,8 +573,8 @@
 	_joe.y = y;
 }
 
-void Logic::joeWalk(uint16 walk) {
-	_joe.walk = walk;
+void Logic::joeWalk(uint16 walking) {
+	_joe.walk = walking;
 }
 
 void Logic::joeScale(uint16 scale) {
@@ -1375,6 +1375,9 @@
 	return sd;
 }
 
+StateTalk Logic::findStateTalk(uint16 state) {
+	return (state & (1 << 9)) ? STATE_TALK_TALK : STATE_TALK_MUTE;
+}
 
 void Logic::joeSetup() {
 	int i;

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- logic.h	15 Oct 2003 08:46:18 -0000	1.30
+++ logic.h	15 Oct 2003 09:23:05 -0000	1.31
@@ -84,7 +84,7 @@
 	void joeFacing(uint16 dir);
 	void joeX(uint16 x);
 	void joeY(uint16 y);
-	void joeWalk(uint16 walk);
+	void joeWalk(uint16 walking);
 	void joeScale(uint16 scale);
 	void joePrevFacing(uint16 dir);
 	
@@ -126,6 +126,11 @@
 	void animErase(uint16 bobNum);
 
 	StateDirection findStateDirection(uint16 state); // == FIND_STATE(state, "DIR");
+	StateTalk      findStateTalk     (uint16 state); // == FIND_STATE(state, "TALK");
+
+	Walk *walk()	{ return _walk; }
+
+	int talkSpeed() { return _talkSpeed; }
 
 	//! SETUP_JOE(), loads the various bobs needed to animate Joe
 	void joeSetup();
@@ -136,7 +141,6 @@
 	//! FACE_JOE()
 	uint16 joeFace();
 
-
 protected:
 	bool _textToggle;
 	bool _speechToggle;
@@ -198,6 +202,7 @@
 	char **_aFile;	//A_FILEstr
 
 	enum {
+		DEFAULT_TALK_SPEED = 7,
 		GAME_STATE_COUNT = 211
 	};
 
@@ -222,6 +227,8 @@
 	Resource *_resource;
 	Graphics *_graphics;
 	Walk *_walk;
+
+	int _talkSpeed;	// TALKSPD
 
 	void initialise();
 };

Index: talk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- talk.cpp	12 Oct 2003 19:16:48 -0000	1.7
+++ talk.cpp	15 Oct 2003 09:23:05 -0000	1.8
@@ -34,12 +34,13 @@
 
 void Talk::talk(
 		const char *filename, 
+		int personInRoom,
 		char *cutawayFilename,
 		Graphics *graphics,
 		Logic *logic,
 		Resource *resource) {
 	Talk *talk = new Talk(graphics, logic, resource);
-	talk->talk(filename, cutawayFilename);
+	talk->talk(filename, personInRoom, cutawayFilename);
 	delete talk;
 }
 
@@ -72,7 +73,7 @@
 
 
 
-void Talk::talk(const char *filename, char *cutawayFilename) {
+void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
 	_oldSelectedSentenceIndex = 0;
 	_oldSelectedSentenceValue = 0;
 
@@ -81,6 +82,16 @@
 	cutawayFilename[0] = '\0';
 
 	// XXX S=SUBJECT[1];
+
+	int roomStart = _logic->roomData(_logic->currentRoom());
+	ObjectData *data = _logic->objectData(roomStart + personInRoom);
+
+	if (data->name <= 0)	// disabled!
+		return;
+
+	if (data->entryObj > 0)
+		return;
+	
 	// XXX R=ROOM_DATA[ROOM];
 	// XXX if(OBJECT_DATA[NOUN2+R][0]<=0) return;
 	// XXX if(OBJECT_DATA[NOUN2+R][4]>0) return;
@@ -99,6 +110,9 @@
 	
 	load(filename);
 
+	//Person person;
+	//_logic->personSetData(
+	
 	char personName[MAX_STRING_SIZE];
 	// XXX SET_PERSON_DATA(N,NAMEstr,0);
 	int bobNum = 1; // XXX P_BNUM;
@@ -566,6 +580,18 @@
 	return personWalking;
 }
 
+int Talk::countSpaces(const char *segment) {
+	int tmp = 0;
+
+	while (*segment++)
+		tmp++;
+	
+	if (tmp < 10)
+		tmp = 10;
+
+	return (tmp * 2) / _logic->talkSpeed();
+}
+
 void Talk::speakSegment(
 		const char *segment, 
 		int length,
@@ -582,6 +608,23 @@
 
 	debug(0, "Playing voice file '%s'", voiceFileName);
 
+
+	if (SPEAK_PAUSE == command) {
+		for (int i = 0; i < 10; i++) {
+			if (_quit)
+				break;
+			_graphics->update();
+		}
+		return;
+	}
+
+	//int spaces = countSpaces(segment);
+
+	if (scumm_stricmp(person, "JOE")) {
+	}
+	else {
+
+	}
 
 }
 

Index: talk.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- talk.h	12 Oct 2003 19:16:48 -0000	1.5
+++ talk.h	15 Oct 2003 09:23:05 -0000	1.6
@@ -36,7 +36,8 @@
 	//! Public interface to run a talk from a file
 	static void talk(
 		const char *filename,
-		char *cutawayFilename,
+		int personInRoom,
+		char *cutawayFilename, 
 		Graphics *graphics,
 		Logic *logic,
 		Resource *resource);
@@ -140,7 +141,7 @@
 	~Talk();
 
 	//! Perform talk in file and return a cutaway filename
-	void talk(const char *filename, char *cutawayFilename);
+	void talk(const char *filename, int personInRoom, char *cutawayFilename);
 
 	//! Load talk data from .dog file 
 	void load(const char *filename);
@@ -174,6 +175,8 @@
 		int command,
 		const char *voiceFilePrefix,
 		int index);
+
+	int countSpaces(const char *segment);
 
 	static int splitOption(const char *str, char optionText[5][MAX_STRING_SIZE]);
 

Index: xref.txt
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/xref.txt,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- xref.txt	15 Oct 2003 08:47:13 -0000	1.4
+++ xref.txt	15 Oct 2003 09:23:05 -0000	1.5
@@ -294,10 +294,10 @@
 ====
 MAKE_SPEAK_BOB
 MOVE_SPEAK
-SPEAK						Talk::?
-SPEAK_SUB
-talk						Talk::run
-TALK_PROC
+SPEAK						Talk::speak
+SPEAK_SUB					Talk::speakSegment
+talk						Talk::talk
+TALK_PROC					Talk::talk
 -
 A1,A12
 TALK_SELECTED





More information about the Scummvm-git-logs mailing list