[Scummvm-cvs-logs] CVS: scummvm/queen cutaway.cpp,1.91,1.92 graphics.cpp,1.57,1.58 logic.cpp,1.136,1.137 logic.h,1.90,1.91 sound.cpp,1.19,1.20 sound.h,1.8,1.9 talk.cpp,1.60,1.61 xref.txt,1.49,1.50

Gregory Montoir cyx at users.sourceforge.net
Sat Dec 20 08:56:01 CET 2003


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

Modified Files:
	cutaway.cpp graphics.cpp logic.cpp logic.h sound.cpp sound.h 
	talk.cpp xref.txt 
Log Message:
some code to play the 'room background sfx' (equivalent to sfxplay(NULLstr))

Index: cutaway.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.cpp,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- cutaway.cpp	12 Dec 2003 10:33:34 -0000	1.91
+++ cutaway.cpp	20 Dec 2003 16:54:46 -0000	1.92
@@ -1366,7 +1366,7 @@
 		char voiceFileName[MAX_STRING_SIZE];
 		findCdCut(_basename, index, voiceFileName);
 		strcat(voiceFileName, "1");
-		_vm->sound()->sfxPlay(voiceFileName);
+		_vm->sound()->playSfx(voiceFileName);
 	}
 
 	int i;

Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- graphics.cpp	19 Dec 2003 09:22:19 -0000	1.57
+++ graphics.cpp	20 Dec 2003 16:54:46 -0000	1.58
@@ -131,12 +131,6 @@
 				frameNum = nextFrame;
 			}
 			anim.speed = anim.string.curPos->speed / 4;
-
-			// play memory sfx and move on to next frame
-			if(frameNum > 500) {
-				frameNum -= 500;
-				// XXX _sound->sfxplay(NULLstr);
-			}
 		}
 	}
 	else {
@@ -469,6 +463,10 @@
 
 			if (pbs->animating) {
 				pbs->animOneStep();
+				if (pbs->frameNum > 500) {
+					pbs->frameNum -= 500;
+					_vm->sound()->playSfx(_vm->logic()->currentRoomSfx());
+				}
 			}
 			if (pbs->moving) {
 				int16 j;
@@ -765,8 +763,10 @@
 		else {
 			++_index;
 		}
-		// Play BKG SFX
-		// XXX if(bamsfx==2 && SFXTOGGLE) sfxplay(NULLstr);
+
+		if (bdb->sfx == 2) {
+			_vm->sound()->playSfx(_vm->logic()->currentRoomSfx());
+		}
 	}
 }
 
@@ -808,10 +808,10 @@
 			_screenShaked = true;
 			break;
 		case 2: // play background sfx
-			// XXX if(SFXTOGGLE) sfxplay(NULLstr);
+			_vm->sound()->playSfx(_vm->logic()->currentRoomSfx());
 			break;
 		case 3: // play background sfx and shake screen
-			// XXX if(SFXTOGGLE) sfxplay(NULLstr);
+			_vm->sound()->playSfx(_vm->logic()->currentRoomSfx());
 			OSystem::instance()->set_shake_pos(3);
 			_screenShaked = true;
 			break;

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -d -r1.136 -r1.137
--- logic.cpp	19 Dec 2003 09:22:20 -0000	1.136
+++ logic.cpp	20 Dec 2003 16:54:46 -0000	1.137
@@ -2958,7 +2958,7 @@
 	lightningBob->y = 0;
 
 	// 23/2/95 - Play lightning SFX
-	// XXX sfxplay(NULLstr);
+	_vm->sound()->playSfx(_vm->logic()->currentRoomSfx());
 
 	_vm->graphics()->bankUnpack(18, lightningBob->frameNum, 15);
 	_vm->graphics()->bankUnpack(4,  planeBob    ->frameNum, 15);

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.h,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- logic.h	13 Dec 2003 20:05:28 -0000	1.90
+++ logic.h	20 Dec 2003 16:54:46 -0000	1.91
@@ -107,6 +107,7 @@
 	uint16 currentRoomData() const { return _roomData[_currentRoom]; }
 	ObjectDescription *objectDescription(uint16 objNum) const { return &_objectDescription[objNum]; }
 	uint16 objectDescriptionCount() const { return _numObjDesc; }
+	uint16 currentRoomSfx() const { return _sfxName[_currentRoom]; }
 
 	uint16 joeFacing() const { return _joe.facing; }
 	uint16 joeX() const { return _joe.x; }

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/sound.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- sound.cpp	14 Dec 2003 04:07:22 -0000	1.19
+++ sound.cpp	20 Dec 2003 16:54:46 -0000	1.20
@@ -135,6 +135,27 @@
 		_vm->input()->delay(10);
 }
 
+void Sound::playSfx(uint16 sfx) {
+	if (sfx != 0) {
+		char name[13];
+		strcpy(name, _sfxName[sfx - 1]);
+		strcat(name, ".SB");
+		sfxPlay(name);
+	}
+}
+
+void Sound::playSfx(const char *base) {
+	char name[13];
+	strcpy(name, base);
+	// alter filename to add zeros and append ".SB"
+	for (int i = 0; i < 8; i++) {
+		if (name[i] == ' ')
+			name[i] = '0';
+	}
+	strcat(name, ".SB");
+	sfxPlay(name);
+}
+
 void Sound::playSong(int16 songNum) {
 	if (songNum == STOP_MUSIC) {
 		_vm->music()->stopSong();
@@ -145,7 +166,7 @@
 
 	if (_tune[newTune - 1].sfx[0]) {
 		if (sfxOn())
-			sfxPlay(_sfxName[_tune[newTune - 1].sfx[0] - 1]);
+			playSfx(_tune[newTune - 1].sfx[0]);
 		return;
 	}
 
@@ -174,57 +195,27 @@
 
 
 int SBSound::playSound(byte *sound, uint32 size) {
-	byte flags = 0 | SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE;
+	byte flags = SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE;
 	return _mixer->playRaw(&_sfxHandle, sound, size, 11025, flags);
 }
 
-void SBSound::sfxPlay(const char *base) {
-	char name[13];
-	strcpy(name, base);
-	//alter filename to add zeros and append ".SB"
-	for (int i = 0; i < 8; i++) {
-		if (name[i] == ' ')
-			name[i] = '0';
-	}
-	strcat(name, ".SB");
-
-	waitSfxFinished();
-	
+void SBSound::sfxPlay(const char *name) {
+	waitSfxFinished();	
 	if (_vm->resource()->exists(name)) 
 		playSound(_vm->resource()->loadFileMalloc(name, SB_HEADER_SIZE), _vm->resource()->fileSize(name) - SB_HEADER_SIZE);
 }
 
 #ifdef USE_MAD
-void MP3Sound::sfxPlay(const char *base) {
-	char name[13];
-	strcpy(name, base);
-	//alter filename to add zeros and append ".SB"
-	for (int i = 0; i < 8; i++) {
-		if (name[i] == ' ')
-			name[i] = '0';
-	}
-	strcat(name, ".SB");
-	
+void MP3Sound::sfxPlay(const char *name) {
 	waitSfxFinished();
-
 	if (_vm->resource()->exists(name)) 
 		_mixer->playMP3(&_sfxHandle, _vm->resource()->giveCompressedSound(name), _vm->resource()->fileSize(name));
 }
 #endif
 
 #ifdef USE_VORBIS
-void OGGSound::sfxPlay(const char *base) {
-	char name[13];
-	strcpy(name, base);
-	//alter filename to add zeros and append ".SB"
-	for (int i = 0; i < 8; i++) {
-		if (name[i] == ' ')
-			name[i] = '0';
-	}
-	strcat(name, ".SB");
-
-	waitSfxFinished();
-	
+void OGGSound::sfxPlay(const char *name) {
+	waitSfxFinished();	
 	if (_vm->resource()->exists(name)) {
 		OggVorbis_File *oggFile = new OggVorbis_File;
 		file_info *f = new file_info;

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/sound.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- sound.h	11 Dec 2003 22:16:35 -0000	1.8
+++ sound.h	20 Dec 2003 16:54:46 -0000	1.9
@@ -53,9 +53,11 @@
 public:
 	Sound(SoundMixer *mixer, QueenEngine *vm);
 	virtual ~Sound(); 
-	virtual void sfxPlay(const char *base) = 0;
+	virtual void sfxPlay(const char *name) = 0;
 	static Sound *giveSound(SoundMixer *mixer, QueenEngine *vm, uint8 compression);
 	void waitSfxFinished();
+	void playSfx(uint16 sfx);
+	void playSfx(const char *base);
 	void playSong(int16 songNum);
 
 	bool sfxOn()			{ return _sfxToggle; }
@@ -94,13 +96,13 @@
 class SilentSound : public Sound {
 public:
 	SilentSound(SoundMixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
-	void sfxPlay(const char *base) { }
+	void sfxPlay(const char *name) { }
 };
 
 class SBSound : public Sound {
 public:
 	SBSound(SoundMixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
-	void sfxPlay(const char *base);
+	void sfxPlay(const char *name);
 protected:
 	int playSound(byte *sound, uint32 size);
 };
@@ -109,7 +111,7 @@
 class MP3Sound : public Sound {
 public:
 	MP3Sound(SoundMixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
-	void sfxPlay(const char *base);
+	void sfxPlay(const char *name);
 };
 #endif
 
@@ -117,7 +119,7 @@
 class OGGSound : public Sound {
 public:
 	OGGSound(SoundMixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
-	void sfxPlay(const char *base);
+	void sfxPlay(const char *name);
 };
 #endif
 } // End of namespace Queen

Index: talk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- talk.cpp	12 Dec 2003 10:33:34 -0000	1.60
+++ talk.cpp	20 Dec 2003 16:54:46 -0000	1.61
@@ -748,10 +748,7 @@
 
 		if (frame > 500) {
 			frame -= 500;
-			// XXX #ifdef __DOS__
-			// XXX 					if(SFXTOGGLE)
-			// XXX 						sfxplay(NULLstr);
-			// XXX #endif
+			_vm->sound()->playSfx(_vm->logic()->currentRoomSfx());
 		}
 
 		if (torso) {
@@ -905,7 +902,7 @@
 	// debug(0, "Sentence segment '%*s' is said by person '%s' and voice file '%s' is played",
 	//		length, segment, person->name, voiceFileName);
 
-	_vm->sound()->sfxPlay(voiceFileName);
+	_vm->sound()->playSfx(voiceFileName);
 	//debug(0, "Playing voice file '%s'", voiceFileName);
 
 	int faceDirectionCommand = 0;

Index: xref.txt
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/xref.txt,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- xref.txt	19 Dec 2003 09:22:20 -0000	1.49
+++ xref.txt	20 Dec 2003 16:54:46 -0000	1.50
@@ -333,7 +333,7 @@
 alter_current_volume()
 playsong()					Sound::playSong()
 sfxbusy()					Sound::waitSfxFinished()
-sfxplay()					Sound::sfxPlay()
+sfxplay()					Sound::playSfx()
 -
 song[]						Sound::_song[]
 tunelist[]					Sound::_tune[]





More information about the Scummvm-git-logs mailing list