TITANIC: Renamed GlobalSound methods to AmbientSound

This commit is contained in:
Paul Gilbert 2017-10-13 18:03:30 -04:00
parent 1d8ccbe1ea
commit c339e3261d
12 changed files with 65 additions and 65 deletions

View File

@ -465,7 +465,7 @@ bool CGameObject::isSoundActive(int handle) const {
return false;
}
void CGameObject::playGlobalSound(const CString &resName, VolumeMode mode, bool initialMute, bool repeated,
void CGameObject::playAmbientSound(const CString &resName, VolumeMode mode, bool initialMute, bool repeated,
int handleIndex, Audio::Mixer::SoundType soundType) {
if (handleIndex < 0 || handleIndex > 3)
return;
@ -524,7 +524,7 @@ void CGameObject::setSoundVolume(int handle, uint percent, uint seconds) {
}
}
void CGameObject::stopGlobalSound(bool transition, int handleIndex) {
void CGameObject::stopAmbientSound(bool transition, int handleIndex) {
CGameManager *gameManager = getGameManager();
if (!gameManager)
return;
@ -550,7 +550,7 @@ void CGameObject::stopGlobalSound(bool transition, int handleIndex) {
}
}
void CGameObject::setGlobalSoundVolume(VolumeMode mode, uint seconds, int handleIndex) {
void CGameObject::setAmbientSoundVolume(VolumeMode mode, uint seconds, int handleIndex) {
CGameManager *gameManager = getGameManager();
if (!gameManager)
return;
@ -559,7 +559,7 @@ void CGameObject::setGlobalSoundVolume(VolumeMode mode, uint seconds, int handle
if (handleIndex == -1) {
// Iterate through calling the method for each handle
for (int idx = 0; idx < 3; ++idx)
setGlobalSoundVolume(mode, seconds, idx);
setAmbientSoundVolume(mode, seconds, idx);
} else if (handleIndex >= 0 && handleIndex <= 3 && _soundHandles[handleIndex] != -1) {
uint newVolume = sound._soundManager.getModeVolume(mode);
sound.setVolume(_soundHandles[handleIndex], newVolume, seconds);

View File

@ -254,7 +254,7 @@ protected:
void setSoundVolume(int handle, uint percent, uint seconds);
/**
* Plays a sound, and saves it's handle in the global sound handles list
* Plays an ambient sound, and saves it's handle in the ambient sound handles list
* @param resName Filename of sound to play
* @param mode Volume mode level
* @param initialMute If set, sound transitions in from mute over 2 seconds
@ -262,23 +262,23 @@ protected:
* @param handleIndex Slot 0 to 3 in the shared sound handle list to store the sound's handle
* @param soundType Specifies whether the sound is a sound effect or music
*/
void playGlobalSound(const CString &resName, VolumeMode mode, bool initialMute, bool repeated,
void playAmbientSound(const CString &resName, VolumeMode mode, bool initialMute, bool repeated,
int handleIndex, Audio::Mixer::SoundType soundType = Audio::Mixer::kMusicSoundType);
/**
* Stops a sound saved in the global sound handle list
* Stops playing an ambient sound
* @param transition If set, the sound transitions to silent before stopping
* @param handleIndex Index of sound to stop. If -1, all global sounds are stopped
* @param handleIndex Index of sound to stop. If -1, all ambient sounds are stopped
*/
void stopGlobalSound(bool transition, int handleIndex);
void stopAmbientSound(bool transition, int handleIndex);
/**
* Updates the volume for a global sound based on the specified mode's volume
* Updates the volume for an ambient sound based on the specified mode's volume
* @param mode Volume level mode
* @param seconds Number of seconds to transition to new volume
* @param handleIndex Index of global sound to update. If -1, all global sounds are updated
* @param handleIndex Index of ambient sound to update. If -1, all ambient sounds are updated
*/
void setGlobalSoundVolume(VolumeMode mode, uint seconds, int handleIndex);
void setAmbientSoundVolume(VolumeMode mode, uint seconds, int handleIndex);
/**
* Stops sound channel 3 or 0

View File

@ -57,13 +57,13 @@ bool CCredits::SignalObject(CSignalObject *msg) {
}
bool CCredits::TimerMsg(CTimerMsg *msg) {
stopGlobalSound(true, -1);
stopAmbientSound(true, -1);
setVisible(true);
loadSound(TRANSLATE("a#16.wav", "a#11.wav"));
loadSound(TRANSLATE("a#24.wav", "a#19.wav"));
if (playCutscene(0, 18)) {
playGlobalSound(TRANSLATE("a#16.wav", "a#11.wav"), VOL_NORMAL, false, false, 0);
playAmbientSound(TRANSLATE("a#16.wav", "a#11.wav"), VOL_NORMAL, false, false, 0);
if (playCutscene(19, 642)) {
playSound(TRANSLATE("a#24.wav", "a#19.wav"));
playCutscene(643, 750);
@ -77,7 +77,7 @@ bool CCredits::TimerMsg(CTimerMsg *msg) {
setVisible(false);
petShow();
enableMouse();
stopGlobalSound(true, -1);
stopAmbientSound(true, -1);
return true;
}

View File

@ -44,7 +44,7 @@ void CEndCreditText::load(SimpleFile *file) {
}
bool CEndCreditText::ActMsg(CActMsg *msg) {
playGlobalSound(TRANSLATE("z#41.wav", "z#573.wav"), VOL_NORMAL, false, false, 0);
playAmbientSound(TRANSLATE("z#41.wav", "z#573.wav"), VOL_NORMAL, false, false, 0);
createCredits();
_flag = true;
return true;
@ -64,7 +64,7 @@ bool CEndCreditText::FrameMsg(CFrameMsg *msg) {
}
bool CEndCreditText::TimerMsg(CTimerMsg *msg) {
setGlobalSoundVolume(VOL_MUTE, 2, -1);
setAmbientSoundVolume(VOL_MUTE, 2, -1);
sleep(1000);
quitGame();
return true;

View File

@ -45,11 +45,11 @@ void CEndCredits::load(SimpleFile *file) {
bool CEndCredits::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
if (_flag) {
deinit();
stopGlobalSound(true, -1);
stopAmbientSound(true, -1);
_flag = false;
} else {
loadSound(TRANSLATE("z#41.wav", "z#573.wav"));
playGlobalSound(TRANSLATE("z#41.wav", "z#573.wav"), VOL_NORMAL, false, false, 0);
playAmbientSound(TRANSLATE("z#41.wav", "z#573.wav"), VOL_NORMAL, false, false, 0);
_flag = true;
}

View File

@ -56,7 +56,7 @@ bool CEndExplodeShip::ActMsg(CActMsg *msg) {
} else if (msg->_action == "TakeOff") {
loadSound(TRANSLATE("a#31.wav", "a#26.wav"));
loadSound(TRANSLATE("a#14.wav", "a#7.wav"));
playGlobalSound(TRANSLATE("a#13.wav", "a#6.wav"), VOL_NORMAL, true, true, 0);
playAmbientSound(TRANSLATE("a#13.wav", "a#6.wav"), VOL_NORMAL, true, true, 0);
addTimer(1, 10212, 0);
}
@ -72,7 +72,7 @@ bool CEndExplodeShip::TimerMsg(CTimerMsg *msg) {
}
if (msg->_actionVal == 3) {
setGlobalSoundVolume(VOL_MUTE, 2, -1);
setAmbientSoundVolume(VOL_MUTE, 2, -1);
CActMsg actMsg(_isExploding ? "ExplodeCredits" : "Credits");
actMsg.execute("EndGameCredits");
}

View File

@ -62,7 +62,7 @@ bool CEndSequenceControl::TimerMsg(CTimerMsg *msg) {
}
bool CEndSequenceControl::MovieEndMsg(CMovieEndMsg *msg) {
setGlobalSoundVolume(VOL_MUTE, 2, -1);
setAmbientSoundVolume(VOL_MUTE, 2, -1);
changeView("TheEnd.Node 3.N");
addTimer(2, 1000, 0);
return true;
@ -72,7 +72,7 @@ bool CEndSequenceControl::EnterRoomMsg(CEnterRoomMsg *msg) {
petHide();
disableMouse();
addTimer(1, 1000, 0);
playGlobalSound(TRANSLATE("a#15.wav", "a#8.wav"), VOL_NORMAL, true, true, 0, Audio::Mixer::kSpeechSoundType);
playAmbientSound(TRANSLATE("a#15.wav", "a#8.wav"), VOL_NORMAL, true, true, 0, Audio::Mixer::kSpeechSoundType);
return true;
}

View File

@ -83,8 +83,8 @@ bool CPhonograph::PhonographPlayMsg(CPhonographPlayMsg *msg) {
_isPlaying = true;
msg->_value = 1;
} else {
stopGlobalSound(false, -1);
playGlobalSound(cylinderMsg._name, VOL_QUIET, true, true, 0);
stopAmbientSound(false, -1);
playAmbientSound(cylinderMsg._name, VOL_QUIET, true, true, 0);
_isPlaying = true;
msg->_value = 1;
}
@ -107,7 +107,7 @@ bool CPhonograph::PhonographStopMsg(CPhonographStopMsg *msg) {
CStopMusicMsg stopMsg;
stopMsg.execute(this);
} else {
stopGlobalSound(msg->_leavingRoom, -1);
stopAmbientSound(msg->_leavingRoom, -1);
}
msg->_cylinderPresent = true;
}

View File

@ -190,23 +190,23 @@ bool CLift::StatusChangeMsg(CStatusChangeMsg *msg) {
bool CLift::MovieEndMsg(CMovieEndMsg *msg) {
switch (msg->_endFrame) {
case 108:
setGlobalSoundVolume(VOL_MUTE, 1, 0);
setGlobalSoundVolume(VOL_QUIET, 1, 1);
setAmbientSoundVolume(VOL_MUTE, 1, 0);
setAmbientSoundVolume(VOL_QUIET, 1, 1);
break;
case 190:
setGlobalSoundVolume(VOL_MUTE, 1, 1);
setGlobalSoundVolume(VOL_QUIET, 1, 2);
setAmbientSoundVolume(VOL_MUTE, 1, 1);
setAmbientSoundVolume(VOL_QUIET, 1, 2);
break;
case 407:
setGlobalSoundVolume(VOL_MUTE, 1, 2);
setGlobalSoundVolume(VOL_QUIET, 1, 1);
setAmbientSoundVolume(VOL_MUTE, 1, 2);
setAmbientSoundVolume(VOL_QUIET, 1, 1);
break;
case 489:
setGlobalSoundVolume(VOL_MUTE, 1, 1);
setGlobalSoundVolume(VOL_QUIET, 1, 0);
setAmbientSoundVolume(VOL_MUTE, 1, 1);
setAmbientSoundVolume(VOL_QUIET, 1, 0);
break;
default: {
@ -252,17 +252,17 @@ bool CLift::EnterRoomMsg(CEnterRoomMsg *msg) {
}
if (floorNum < 20) {
playGlobalSound(TRANSLATE("z#520.wav", "z#259.wav"), VOL_QUIET, true, true, 0);
playGlobalSound(TRANSLATE("z#519.wav", "z#258.wav"), VOL_MUTE, false, true, 1);
playGlobalSound(TRANSLATE("z#518.wav", "z#257.wav"), VOL_MUTE, false, true, 2);
playAmbientSound(TRANSLATE("z#520.wav", "z#259.wav"), VOL_QUIET, true, true, 0);
playAmbientSound(TRANSLATE("z#519.wav", "z#258.wav"), VOL_MUTE, false, true, 1);
playAmbientSound(TRANSLATE("z#518.wav", "z#257.wav"), VOL_MUTE, false, true, 2);
} else if (floorNum < 28) {
playGlobalSound(TRANSLATE("z#520.wav", "z#259.wav"), VOL_MUTE, false, true, 0);
playGlobalSound(TRANSLATE("z#519.wav", "z#258.wav"), VOL_QUIET, true, true, 1);
playGlobalSound(TRANSLATE("z#518.wav", "z#257.wav"), VOL_MUTE, false, true, 2);
playAmbientSound(TRANSLATE("z#520.wav", "z#259.wav"), VOL_MUTE, false, true, 0);
playAmbientSound(TRANSLATE("z#519.wav", "z#258.wav"), VOL_QUIET, true, true, 1);
playAmbientSound(TRANSLATE("z#518.wav", "z#257.wav"), VOL_MUTE, false, true, 2);
} else {
playGlobalSound(TRANSLATE("z#520.wav", "z#259.wav"), VOL_MUTE, false, true, 0);
playGlobalSound(TRANSLATE("z#519.wav", "z#258.wav"), VOL_MUTE, false, true, 1);
playGlobalSound(TRANSLATE("z#518.wav", "z#257.wav"), VOL_QUIET, true, true, 2);
playAmbientSound(TRANSLATE("z#520.wav", "z#259.wav"), VOL_MUTE, false, true, 0);
playAmbientSound(TRANSLATE("z#519.wav", "z#258.wav"), VOL_MUTE, false, true, 1);
playAmbientSound(TRANSLATE("z#518.wav", "z#257.wav"), VOL_QUIET, true, true, 2);
}
}
@ -270,7 +270,7 @@ bool CLift::EnterRoomMsg(CEnterRoomMsg *msg) {
}
bool CLift::LeaveRoomMsg(CLeaveRoomMsg *msg) {
stopGlobalSound(true, -1);
stopAmbientSound(true, -1);
CPetControl *pet = getPetControl();
if (pet->getRoomsElevatorNum() == 4 && _hasHead && !_hasCorrectHead) {

View File

@ -77,7 +77,7 @@ bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) {
} else if (classNum == 3 || (msg->_newStatus > 4 && classNum != 1)) {
petDisplayMessage(1, CLASS_NOT_ALLOWED_AT_DEST);
} else if (newDest > _destination) {
playGlobalSound(TRANSLATE("z#74.wav", "z#605.wav"), VOL_QUIET, true, true, 0);
playAmbientSound(TRANSLATE("z#74.wav", "z#605.wav"), VOL_QUIET, true, true, 0);
CString name = getName();
changeView(name == "PelleratorObject2" ?
@ -180,7 +180,7 @@ bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) {
playMovie(264, 264, MOVIE_NOTIFY_OBJECT);
_destination = newDest;
} else if (newDest < _destination) {
playGlobalSound(TRANSLATE("z#74.wav", "z#605.wav"), VOL_QUIET, true, true, 0);
playAmbientSound(TRANSLATE("z#74.wav", "z#605.wav"), VOL_QUIET, true, true, 0);
CString name = getName();
changeView(name == "PelleratorObject2" ?
@ -341,7 +341,7 @@ bool CPellerator::EnterRoomMsg(CEnterRoomMsg *msg) {
bool CPellerator::MovieEndMsg(CMovieEndMsg *msg) {
setVisible(false);
stopGlobalSound(true, -1);
stopAmbientSound(true, -1);
switch (_destination) {
case 0:

View File

@ -70,7 +70,7 @@ bool CAutoMusicPlayerBase::TimerMsg(CTimerMsg *msg) {
bool CAutoMusicPlayerBase::LoadSuccessMsg(CLoadSuccessMsg *msg) {
if (_isEnabled)
playGlobalSound(_filename, _volumeMode, _initialMute, true, 0,
playAmbientSound(_filename, _volumeMode, _initialMute, true, 0,
Audio::Mixer::kMusicSoundType);
return true;
@ -79,22 +79,22 @@ bool CAutoMusicPlayerBase::LoadSuccessMsg(CLoadSuccessMsg *msg) {
bool CAutoMusicPlayerBase::ChangeMusicMsg(CChangeMusicMsg *msg) {
if (_isEnabled && msg->_action == MUSIC_STOP) {
_isEnabled = false;
stopGlobalSound(_transition, -1);
stopAmbientSound(_transition, -1);
}
if (!msg->_filename.empty()) {
_filename = msg->_filename;
if (_isEnabled) {
stopGlobalSound(_transition, -1);
playGlobalSound(_filename, _volumeMode, _initialMute, true, 0,
stopAmbientSound(_transition, -1);
playAmbientSound(_filename, _volumeMode, _initialMute, true, 0,
Audio::Mixer::kMusicSoundType);
}
}
if (!_isEnabled && msg->_action == MUSIC_START) {
_isEnabled = true;
playGlobalSound(_filename, _volumeMode, _initialMute, true, 0,
playAmbientSound(_filename, _volumeMode, _initialMute, true, 0,
Audio::Mixer::kMusicSoundType);
}

View File

@ -99,22 +99,22 @@ bool CSeasonalMusicPlayer::ArboretumGateMsg(CArboretumGateMsg *msg) {
bool CSeasonalMusicPlayer::ChangeMusicMsg(CChangeMusicMsg *msg) {
if (_isEnabled && msg->_action == MUSIC_STOP) {
_isEnabled = false;
stopGlobalSound(_transition, -1);
stopAmbientSound(_transition, -1);
}
if (!msg->_filename.empty()) {
if (_isSummer) {
setGlobalSoundVolume(VOL_MUTE, 2, 0);
setGlobalSoundVolume(VOL_QUIET, 2, 1);
setAmbientSoundVolume(VOL_MUTE, 2, 0);
setAmbientSoundVolume(VOL_QUIET, 2, 1);
} else if (_isAutumn) {
setGlobalSoundVolume(VOL_MUTE, 2, 1);
setGlobalSoundVolume(VOL_QUIET, 2, 2);
setAmbientSoundVolume(VOL_MUTE, 2, 1);
setAmbientSoundVolume(VOL_QUIET, 2, 2);
} else if (_isWinter) {
setGlobalSoundVolume(VOL_MUTE, 2, 2);
setGlobalSoundVolume(VOL_QUIET, 2, 3);
setAmbientSoundVolume(VOL_MUTE, 2, 2);
setAmbientSoundVolume(VOL_QUIET, 2, 3);
} else if (_isSpring) {
setGlobalSoundVolume(VOL_MUTE, 2, 3);
setGlobalSoundVolume(VOL_QUIET, 2, 0);
setAmbientSoundVolume(VOL_MUTE, 2, 3);
setAmbientSoundVolume(VOL_QUIET, 2, 0);
}
}
@ -124,10 +124,10 @@ bool CSeasonalMusicPlayer::ChangeMusicMsg(CChangeMusicMsg *msg) {
loadSound(TRANSLATE("c#63.wav", "c#46.wav"));
loadSound(TRANSLATE("c#65.wav", "c#48.wav"));
loadSound(TRANSLATE("c#62.wav", "c#47.wav"));
playGlobalSound(TRANSLATE("c#64.wav", "c#47.wav"), _springMode, _isSpring, true, 0);
playGlobalSound(TRANSLATE("c#63.wav", "c#46.wav"), _summerMode, _isSummer, true, 1);
playGlobalSound(TRANSLATE("c#65.wav", "c#48.wav"), _autumnMode, _isAutumn, true, 2);
playGlobalSound(TRANSLATE("c#62.wav", "c#47.wav"), _winterMode, _isWinter, true, 3);
playAmbientSound(TRANSLATE("c#64.wav", "c#47.wav"), _springMode, _isSpring, true, 0);
playAmbientSound(TRANSLATE("c#63.wav", "c#46.wav"), _summerMode, _isSummer, true, 1);
playAmbientSound(TRANSLATE("c#65.wav", "c#48.wav"), _autumnMode, _isAutumn, true, 2);
playAmbientSound(TRANSLATE("c#62.wav", "c#47.wav"), _winterMode, _isWinter, true, 3);
}
return true;