[Scummvm-cvs-logs] CVS: scummvm/queen graphics.cpp,1.78,1.79 graphics.h,1.59,1.60

Gregory Montoir cyx at users.sourceforge.net
Sat Jan 10 08:24:01 CET 2004


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

Modified Files:
	graphics.cpp graphics.h 
Log Message:
workaround for final room sound issues

Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- graphics.cpp	9 Jan 2004 15:14:15 -0000	1.78
+++ graphics.cpp	10 Jan 2004 16:23:34 -0000	1.79
@@ -1151,6 +1151,19 @@
 }
 
 
+void BamScene::playSfx() {
+	// FIXME - we don't play all sfx here. This is only necessary for
+	// the fight bam, where the number of 'sfx bam frames' is too much 
+	// important / too much closer. The original game does not have
+	// this problem since their playSfx() function returns immediately
+	// if a sound is already begin played.
+	if (_lastSoundIndex == 0 || _index - _lastSoundIndex >= SFX_SKIP) {
+		_vm->sound()->playSfx(_vm->logic()->currentRoomSfx());
+		_lastSoundIndex = _index;
+	}
+}
+
+
 void BamScene::prepareAnimation() {
 	_obj1 = _vm->graphics()->bob(BOB_OBJ1);
 	_obj1->clear();
@@ -1165,6 +1178,7 @@
 	_objfx->active = true;
 
 	_index = 0;
+	_lastSoundIndex = 0;
 }
 
 
@@ -1196,7 +1210,7 @@
 		}
 
 		if (bdb->sfx == 2) {
-			_vm->sound()->playSfx(_vm->logic()->currentRoomSfx());
+			playSfx();
 		}
 	}
 }
@@ -1238,15 +1252,15 @@
 			_screenShaked = true;
 			break;
 		case 2: // play background sfx
-			_vm->sound()->playSfx(_vm->logic()->currentRoomSfx());
+			playSfx();
 			break;
 		case 3: // play background sfx and shake screen
-			_vm->sound()->playSfx(_vm->logic()->currentRoomSfx());
+			playSfx();
 			OSystem::instance()->set_shake_pos(3);
 			_screenShaked = true;
 			break;
 		case 99: // end of BAM data
-			_index = 0;
+			_lastSoundIndex = _index = 0;
 			const BamDataBlock *data[] = {
 				_fight1Data, 
 				_fight2Data,

Index: graphics.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.h,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- graphics.h	9 Jan 2004 13:36:37 -0000	1.59
+++ graphics.h	10 Jan 2004 16:23:34 -0000	1.60
@@ -187,6 +187,7 @@
 
 	BamScene(QueenEngine *vm);
 	
+	void playSfx();
 	void prepareAnimation();
 	void updateCarAnimation();
 	void updateFightAnimation();
@@ -203,6 +204,10 @@
 		F_REQ_STOP = 2
 	};
 
+	enum {
+		SFX_SKIP = 8
+	};
+
 	uint16 _flag, _index;
 
 private:
@@ -224,6 +229,7 @@
 	BobSlot *_objfx;
 	bool _screenShaked;
 	const BamDataBlock *_fightData;
+	uint16 _lastSoundIndex;
 
 	QueenEngine *_vm;
 





More information about the Scummvm-git-logs mailing list