[Scummvm-cvs-logs] CVS: scummvm/bs2 anims.cpp,1.21,1.22 controls.cpp,1.21,1.22 function.cpp,1.20,1.21 mouse.cpp,1.19,1.20 sound.cpp,1.19,1.20 speech.cpp,1.25,1.26 startup.cpp,1.16,1.17

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Tue Sep 30 23:37:04 CEST 2003


Update of /cvsroot/scummvm/scummvm/bs2
In directory sc8-pr-cvs1:/tmp/cvs-serv31754

Modified Files:
	anims.cpp controls.cpp function.cpp mouse.cpp sound.cpp 
	speech.cpp startup.cpp 
Log Message:
ScummVM naming conventions and cleanup in the Sword2Sound class.


Index: anims.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/anims.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- anims.cpp	30 Sep 2003 14:37:42 -0000	1.21
+++ anims.cpp	1 Oct 2003 06:36:24 -0000	1.22
@@ -563,7 +563,7 @@
 			else
 				strcpy(speechFile, "speech.clu");
 
-			sequence_text_list[line].speechBufferSize = g_sound->PreFetchCompSpeech((char *) speechFile, wavId, &sequence_text_list[line].speech_mem);
+			sequence_text_list[line].speechBufferSize = g_sound->preFetchCompSpeech((char *) speechFile, wavId, &sequence_text_list[line].speech_mem);
 			if (sequence_text_list[line].speechBufferSize) {
 				// ok, we've got speech!
 				speechRunning = 1;
@@ -670,14 +670,14 @@
 
 	leadIn += sizeof(_standardHeader);
 	// wav data gets copied to sound memory
-	rv = g_sound->PlayFx(0, leadIn, 0, 0, RDSE_FXLEADIN);
+	rv = g_sound->playFx(0, leadIn, 0, 0, RDSE_FXLEADIN);
 
 	if (rv)
-		debug(5, "SFX ERROR: PlayFx() returned %.8x", rv);
+		debug(5, "SFX ERROR: playFx() returned %.8x", rv);
 
 	res_man.close(params[0]);
 
-	// fade out any music that is currently playing (James22july97)
+	// fade out any music that is currently playing
 	FN_stop_music(NULL);
 
 	// continue script
@@ -750,7 +750,7 @@
 	FN_stop_music(NULL);
 
 	// pause sfx during sequence, except the one used for lead-in music
-	g_sound->PauseFxForSequence();
+	g_sound->pauseFxForSequence();
 
 	if (sequenceTextLines && g_sword2->_gameId == GID_SWORD2)
 		rv = PlaySmacker(filename, sequenceSpeechArray, leadOut);
@@ -758,7 +758,7 @@
 		rv = PlaySmacker(filename, NULL, leadOut);
 
 	// unpause sound fx again, in case we're staying in same location
-	g_sound->UnpauseFx();
+	g_sound->unpauseFx();
 
 	// close the lead-out music resource
 

Index: controls.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/controls.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- controls.cpp	30 Sep 2003 09:27:26 -0000	1.21
+++ controls.cpp	1 Oct 2003 06:36:24 -0000	1.22
@@ -787,12 +787,12 @@
 		_objectLabelsSwitch->setValue(pointerTextSelected != 0);
 		_subtitlesSwitch->setValue(subtitles != 0);
 		_reverseStereoSwitch->setValue(stereoReversed != 0);
-		_musicSwitch->setValue(g_sound->IsMusicMute() == 0);
-		_speechSwitch->setValue(g_sound->IsSpeechMute() == 0);
-		_fxSwitch->setValue(g_sound->IsFxMute() == 0);
-		_musicSlider->setValue(g_sound->GetMusicVolume());
-		_speechSlider->setValue(g_sound->GetSpeechVolume());
-		_fxSlider->setValue(g_sound->GetFxVolume());
+		_musicSwitch->setValue(g_sound->isMusicMute() == 0);
+		_speechSwitch->setValue(g_sound->isSpeechMute() == 0);
+		_fxSwitch->setValue(g_sound->isFxMute() == 0);
+		_musicSlider->setValue(g_sound->getMusicVolume());
+		_speechSlider->setValue(g_sound->getSpeechVolume());
+		_fxSlider->setValue(g_sound->getFxVolume());
 		_gfxSlider->setValue(GetRenderType());
 		_gfxPreview->setState(GetRenderType());
 	}
@@ -851,13 +851,13 @@
 
 		if (widget == _reverseStereoSwitch) {
 			if (result != stereoReversed)
-				g_sound->ReverseStereo();
+				g_sound->reverseStereo();
 			stereoReversed = result;
 		} else if (widget == _musicSwitch) {
-			g_sound->MuteMusic(result);
+			g_sound->muteMusic(result);
 		} else if (widget == _musicSlider) {
-			g_sound->SetMusicVolume(result);
-			g_sound->MuteMusic(result == 0);
+			g_sound->setMusicVolume(result);
+			g_sound->muteMusic(result == 0);
 			_musicSwitch->setValue(result != 0);
 		} else if (widget == _speechSlider) {
 			_speechSwitch->setValue(result != 0);
@@ -868,12 +868,12 @@
 			UpdateGraphicsLevel(result);
 		} else if (widget == _okButton) {
 			// Apply the changes
-			g_sound->MuteMusic(_musicSwitch->getValue() == 0);
-			g_sound->MuteSpeech(_speechSwitch->getValue() == 0);
-			g_sound->MuteFx(_fxSwitch->getValue() == 0);
-			g_sound->SetMusicVolume(_musicSlider->getValue());
-			g_sound->SetSpeechVolume(_speechSlider->getValue());
-			g_sound->SetFxVolume(_fxSlider->getValue());
+			g_sound->muteMusic(_musicSwitch->getValue() == 0);
+			g_sound->muteSpeech(_speechSwitch->getValue() == 0);
+			g_sound->muteFx(_fxSwitch->getValue() == 0);
+			g_sound->setMusicVolume(_musicSlider->getValue());
+			g_sound->setSpeechVolume(_speechSlider->getValue());
+			g_sound->setFxVolume(_fxSlider->getValue());
 
 			UpdateGraphicsLevel(_gfxSlider->getValue());
 
@@ -1467,12 +1467,12 @@
 	delete fp;
 	delete mgr;
 	
-	g_sound->SetMusicVolume(buff[0]);
-	g_sound->SetSpeechVolume(buff[1]);
-	g_sound->SetFxVolume(buff[2]);
-	g_sound->MuteMusic(buff[3]);
-	g_sound->MuteSpeech(buff[4]);
-	g_sound->MuteFx(buff[5]);
+	g_sound->setMusicVolume(buff[0]);
+	g_sound->setSpeechVolume(buff[1]);
+	g_sound->setFxVolume(buff[2]);
+	g_sound->muteMusic(buff[3]);
+	g_sound->muteSpeech(buff[4]);
+	g_sound->muteFx(buff[5]);
 
 	UpdateGraphicsLevel(buff[6]);
 
@@ -1481,7 +1481,7 @@
 	pointerTextSelected = buff[8];
 
 	if (buff[9] != stereoReversed)
-		g_sound->ReverseStereo();
+		g_sound->reverseStereo();
 
 	stereoReversed = buff[9];
 	return 0;
@@ -1495,12 +1495,12 @@
 	
 	sprintf(filename, "%s-settings.dat", g_sword2->_game_name);
 
-	buff[0] = g_sound->GetMusicVolume();
-	buff[1] = g_sound->GetSpeechVolume();
-	buff[2] = g_sound->GetFxVolume();
-	buff[3] = g_sound->IsMusicMute();
-	buff[4] = g_sound->IsSpeechMute();
-	buff[5] = g_sound->IsFxMute();
+	buff[0] = g_sound->getMusicVolume();
+	buff[1] = g_sound->getSpeechVolume();
+	buff[2] = g_sound->getFxVolume();
+	buff[3] = g_sound->isMusicMute();
+	buff[4] = g_sound->isSpeechMute();
+	buff[5] = g_sound->isFxMute();
 	buff[6] = GetRenderType();
 	buff[7] = subtitles;
 	buff[8] = pointerTextSelected;

Index: function.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/function.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- function.cpp	30 Sep 2003 09:27:26 -0000	1.20
+++ function.cpp	1 Oct 2003 06:36:25 -0000	1.21
@@ -398,9 +398,9 @@
 
 		g_sound->saveMusicState();
 
-		g_sound->MuteFx(1);
-		g_sound->MuteSpeech(1);
-		g_sound->StopMusic();
+		g_sound->muteFx(1);
+		g_sound->muteSpeech(1);
+		g_sound->stopMusic();
 
 		memcpy(oldPal, palCopy, 1024);
 		memset(tmpPal, 0, 1024);
@@ -421,13 +421,13 @@
 		pars[1] = FX_SPOT;
 		FN_play_music(pars);
 
-		music_length = 1000 * g_sound->MusicTimeRemaining();
+		music_length = 1000 * g_sound->musicTimeRemaining();
 
 		debug(0, "Credits music length: ~%d ms", music_length);
 
 		CloseMenuImmediately();
 
-		while (g_sound->MusicTimeRemaining()) {
+		while (g_sound->musicTimeRemaining()) {
 			EraseBackBuffer();
 			SetNeedRedraw();
 
@@ -454,8 +454,8 @@
 		Build_display();
 		WaitForFade();
 
-		g_sound->MuteFx(0);
-		g_sound->MuteSpeech(0);
+		g_sound->muteFx(0);
+		g_sound->muteSpeech(0);
 	}
 
 	// FIXME: This probably isn't the correct way of shutting down ScummVM

Index: mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/mouse.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- mouse.cpp	30 Sep 2003 09:27:26 -0000	1.19
+++ mouse.cpp	1 Oct 2003 06:36:25 -0000	1.20
@@ -171,7 +171,6 @@
 	_mouseEvent *me;
 	int j, hit;
 	uint8 *icon;
-	uint32 rv;	// for drivers return value
 	int32 pars[2];
 	uint32 icon_list[5] = {
 		OPTIONS_ICON,
@@ -215,9 +214,7 @@
 					}
 				}
 
-				rv = g_sound->PauseFx();
-				if (rv != RD_OK)
-					debug(5, "ERROR: PauseFx() returned %.8x in SystemMenu()", rv);
+				g_sound->pauseFx();
 
 				// NB. Need to keep a safe copy of
 				// 'looping_music_id' for savegame & for
@@ -282,7 +279,6 @@
 				if (this_screen.new_palette != 99) {
 					// '0' means put back game screen
 					// palette; see Build_display.cpp
-					// (James17jun97)
 
 					SetFullPalette(0);
 
@@ -293,9 +289,7 @@
 				} else
 					this_screen.new_palette = 1;
 
-				rv = g_sound->UnpauseFx();
-				if (rv != RD_OK)
-					debug(5, "ERROR: UnpauseFx() returned %.8x in SystemMenu()", rv);
+				g_sound->unpauseFx();
 
 				// If there was looping music before coming
 				// into the control panels then restart it!

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/sound.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- sound.cpp	30 Sep 2003 09:27:26 -0000	1.19
+++ sound.cpp	1 Oct 2003 06:36:25 -0000	1.20
@@ -91,7 +91,7 @@
 			break;
 		case FX_SPOT2:
 			// Once the Fx has finished remove it from the queue.
-			if (g_sound->IsFxOpen(j + 1))
+			if (g_sound->isFxOpen(j + 1))
 				fxq[j].resource = 0;
 			break;
 		}
@@ -112,7 +112,7 @@
 		data = res_man.open(fxq[j].resource);
 		data += sizeof(_standardHeader);
 		// wav data gets copied to sound memory
-		rv = g_sound->PlayFx(id, data, fxq[j].volume, fxq[j].pan, RDSE_FXSPOT);
+		rv = g_sound->playFx(id, data, fxq[j].volume, fxq[j].pan, RDSE_FXSPOT);
 		// release the sample
 		res_man.close(fxq[j].resource);
 	} else {
@@ -122,15 +122,15 @@
 
 		if (fxq[j].type == FX_RANDOM) {
 			// Not looped
-			rv = g_sound->PlayFx(id, NULL, fxq[j].volume, fxq[j].pan, RDSE_FXSPOT);
+			rv = g_sound->playFx(id, NULL, fxq[j].volume, fxq[j].pan, RDSE_FXSPOT);
 		} else {
 			// Looped
-			rv = g_sound->PlayFx(id, NULL, fxq[j].volume, fxq[j].pan, RDSE_FXLOOP);
+			rv = g_sound->playFx(id, NULL, fxq[j].volume, fxq[j].pan, RDSE_FXLOOP);
 		}
 	}
 
 	if (rv)
-		debug(5, "SFX ERROR: PlayFx() returned %.8x", rv);
+		debug(5, "SFX ERROR: playFx() returned %.8x", rv);
 }
 
 // called from script only
@@ -231,10 +231,10 @@
 		data += sizeof(_standardHeader);
 
 		// copy it to sound memory, using position in queue as 'id'
-		rv = g_sound->OpenFx(id, data);
+		rv = g_sound->openFx(id, data);
 
 		if (rv)
-			debug(5, "SFX ERROR: OpenFx() returned %.8x", rv);
+			debug(5, "SFX ERROR: openFx() returned %.8x", rv);
 
 		// release the sample
 		res_man.close(fxq[j].resource);
@@ -269,9 +269,9 @@
 
 	debug(5, "FN_set_fx_vol_and_pan(%d, %d, %d)", params[0], params[1], params[2]);
 
-	// SetFxVolumePan(int32 id, uint8 vol, uint8 pan);
+	// setFxIdVolumePan(int32 id, uint8 vol, uint8 pan);
 	// driver fx_id is 1 + <pos in queue>
-	g_sound->SetFxVolumePan(1 + params[0], params[1], params[2]);
+	g_sound->setFxIdVolumePan(1 + params[0], params[1], params[2]);
 	return IR_CONT;
 }
 
@@ -283,7 +283,7 @@
 	//		1 new volume (0..16)
 
 	// SetFxIdVolume(int32 id, uint8 vol);
-	g_sound->SetFxIdVolume(1 + params[0], params[1]);
+	g_sound->setFxIdVolume(1 + params[0], params[1]);
 	return IR_CONT;
 }
 
@@ -304,10 +304,10 @@
 		id = (uint32) j + 1;		// because 0 is not a valid id
 
 		// stop fx & remove sample from sound memory
-		rv = g_sound->CloseFx(id);
+		rv = g_sound->closeFx(id);
 
 		if (rv)
-			debug(5, "SFX ERROR: CloseFx() returned %.8x", rv);
+			debug(5, "SFX ERROR: closeFx() returned %.8x", rv);
 	}
 
 	// remove from queue
@@ -330,34 +330,12 @@
 
 void Clear_fx_queue(void) {
 	// stop all fx & remove the samples from sound memory
-	g_sound->ClearAllFx();
+	g_sound->clearAllFx();
 
 	// clean out the queue
 	Init_fx_queue();
 }
 
-// ===========================================================================
-//	int32 StreamMusic(uint8 *filename, int32 loopFlag)
-//
-//	Streams music from the file defined by filename.  The loopFlag should
-//	be set to RDSE_FXLOOP if the music is to loop back to the start.
-//	Otherwise, it should be RDSE_FXSPOT.
-//	The return value must be checked for any problems.
-//
-// ---------------------------------------------------------------------------
-//
-//	int32 PauseMusic(void)
-//
-//	Stops the music dead in it's tracks.
-//
-// ---------------------------------------------------------------------------
-//
-//	int32 UnpauseMusic(void)
-//
-//	Re-starts the music from where it was stopped.
-//
-// ===========================================================================
-
 int32 FN_prepare_music(int32 *params) {
 	return IR_CONT;
 }
@@ -406,10 +384,10 @@
 			strcpy(filename, "music.clu");
 	}
 
-	rv = g_sound->StreamCompMusic(filename, params[0], loopFlag);
+	rv = g_sound->streamCompMusic(filename, params[0], loopFlag);
 
 	if (rv)
-		debug(5, "ERROR: StreamCompMusic(%s, %d, %d) returned error 0x%.8x", filename, params[0], loopFlag, rv);
+		debug(5, "ERROR: streamCompMusic(%s, %d, %d) returned error 0x%.8x", filename, params[0], loopFlag, rv);
 
 	return IR_CONT;
 }
@@ -418,13 +396,13 @@
 	// params:	none
 
 	looping_music_id = 0;		// clear the 'looping' flag
-	g_sound->StopMusic();
+	g_sound->stopMusic();
 	return IR_CONT;
 }
 
 void Kill_music(void) {			// James22aug97
 	looping_music_id = 0;		// clear the 'looping' flag
-	g_sound->StopMusic();
+	g_sound->stopMusic();
 }
 
 int32 FN_check_music_playing(int32 *params) {
@@ -434,39 +412,19 @@
 	// or 0 if no music playing
 
 	// in seconds, rounded up to the nearest second
-	RESULT = g_sound->MusicTimeRemaining();
+	RESULT = g_sound->musicTimeRemaining();
 
 	return IR_CONT;
 }
 
 void PauseAllSound(void) {
-	uint32	rv;
-
-	rv = g_sound->PauseMusic();
-	if (rv != RD_OK)
-		debug(5, "ERROR: PauseMusic() returned %.8x in PauseAllSound()", rv);
-
-	rv = g_sound->PauseSpeech();
-	if (rv != RD_OK)
-		debug(5, "ERROR: PauseSpeech() returned %.8x in PauseAllSound()", rv);
-
-	rv = g_sound->PauseFx();
-	if (rv != RD_OK)
-		debug(5, "ERROR: PauseFx() returned %.8x in PauseAllSound()", rv);
+	g_sound->pauseMusic();
+	g_sound->pauseSpeech();
+	g_sound->pauseFx();
 }
 
 void UnpauseAllSound(void) {
-	uint32	rv;
-
-	rv = g_sound->UnpauseMusic();
-	if (rv != RD_OK)
-		debug(5, "ERROR: UnpauseMusic() returned %.8x in UnpauseAllSound()", rv);
-
-	rv = g_sound->UnpauseSpeech();
-	if (rv != RD_OK)
-		debug(5, "ERROR: UnpauseSpeech() returned %.8x in UnpauseAllSound()", rv);
-
-	rv = g_sound->UnpauseFx();
- 	if (rv != RD_OK)
-		debug(5, "ERROR: UnpauseFx() returned %.8x in UnpauseAllSound()", rv);
+	g_sound->unpauseMusic();
+	g_sound->unpauseSpeech();
+	g_sound->unpauseFx();
 }

Index: speech.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/speech.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- speech.cpp	30 Sep 2003 09:27:26 -0000	1.25
+++ speech.cpp	1 Oct 2003 06:36:25 -0000	1.26
@@ -968,7 +968,7 @@
 		// New fudge to wait for smacker samples to finish
 		// since they can over-run into the game
 
-		if (g_sound->GetSpeechStatus() != RDSE_SAMPLEFINISHED)
+		if (g_sound->getSpeechStatus() != RDSE_SAMPLEFINISHED)
 			return IR_REPEAT;
 		
 		// New fudge for 'fx' subtitles
@@ -1199,7 +1199,7 @@
 				strcpy(speechFile, "speech.clu");
 
 			// Load speech but don't start playing yet
-			rv = g_sound->PlayCompSpeech(speechFile, params[S_WAV], SPEECH_VOLUME, speech_pan);
+			rv = g_sound->playCompSpeech(speechFile, params[S_WAV], SPEECH_VOLUME, speech_pan);
 			if (rv == RD_OK) {
 				// ok, we've got something to play
 				// (2 means not playing yet - see below)
@@ -1207,7 +1207,7 @@
 
 				// set it playing now (we might want to do
 				// this next cycle, don't know yet)
-				g_sound->UnpauseSpeech();
+				g_sound->unpauseSpeech();
 			} else {
 				debug(5, "ERROR: PlayCompSpeech(speechFile=\"%s\", wav=%d (res=%d pos=%d)) returned %.8x", speechFile, params[S_WAV], text_res, local_text, rv);
 			}
@@ -1247,7 +1247,7 @@
 				// if playing a sample
 				if (!unpause_zone) {
 					// if we're at a quiet bit
-					if (g_sound->AmISpeaking() == RDSE_QUIET) {
+					if (g_sound->amISpeaking() == RDSE_QUIET) {
 						// restart from frame 0
 						// ('closed mouth' frame)
 						ob_graphic->anim_pc = 0;
@@ -1277,11 +1277,11 @@
 
 	// if playing a sample (note that value of '2' means about to play!)
 
-	if (speechRunning==1) {
+	if (speechRunning == 1) {
 		if (!unpause_zone) {
-			// has it finished?	James25feb97
-			if (g_sound->GetSpeechStatus() == RDSE_SAMPLEFINISHED)
-				speechFinished=1;
+			// has it finished?
+			if (g_sound->getSpeechStatus() == RDSE_SAMPLEFINISHED)
+				speechFinished = 1;
 		} else
 			unpause_zone--;
 	} else if (speechRunning == 0 && speech_time) {
@@ -1289,7 +1289,7 @@
 		// ends the speech
 
 		// if no sample then we're using speech_time to end speech
-		// naturally	James25feb97
+		// naturally
 
 		speech_time--;
 		if (!speech_time)
@@ -1315,7 +1315,7 @@
 		// mouse click, after click_delay has expired -> end the speech
  		// we ignore mouse releases
 
-#ifdef _SWORD2_DEBUG	// (James26jun97)
+#ifdef _SWORD2_DEBUG
 		// if testing text & speech
 		if (SYSTEM_TESTING_TEXT) {
 			// and RB used to click past text
@@ -1334,12 +1334,12 @@
 			me = MouseEvent();
 		} while (me);
 
-		speechFinished = 1;	// James25feb97
+		speechFinished = 1;
 
 		// if speech sample playing
 		if (speechRunning) {
 			// halt the sample prematurely
-			g_sound->StopSpeechSword2();
+			g_sound->stopSpeech();
 		}
 	}
 

Index: startup.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/startup.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- startup.cpp	30 Sep 2003 14:37:42 -0000	1.16
+++ startup.cpp	1 Oct 2003 06:36:25 -0000	1.17
@@ -255,8 +255,8 @@
 			FN_stop_music(NULL);
 
 			// halt the sample prematurely
-			g_sound->UnpauseSpeech();
-			g_sound->StopSpeechSword2();
+			g_sound->unpauseSpeech();
+			g_sound->stopSpeech();
 
 			// clean out all resources & flags, ready for a total
 			// restart (James24mar97)





More information about the Scummvm-git-logs mailing list