mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 20:58:07 +03:00
sound: pause sounds in the inventory instead of stopping (#818)
Resolves #717.
This commit is contained in:
parent
f529df2fe8
commit
1fdc545ed4
8 changed files with 82 additions and 4 deletions
|
@ -2,6 +2,7 @@
|
|||
- added an option to enable TR2+ jump-twist and somersault animations (#88)
|
||||
- added the ability to unbind the sidestep left and sidestep right keys (#766)
|
||||
- added a cheat to explode Lara like in TR2 and TR3 (#793)
|
||||
- fixed sounds stopping instead of pausing if game sounds in inventory are disabled (#717)
|
||||
|
||||
## [2.14](https://github.com/rr-/Tomb1Main/compare/2.13.2...2.14) - 2023-04-05
|
||||
- added Spanish localization to the config tool
|
||||
|
|
|
@ -339,6 +339,7 @@ Not all options are turned on by default. Refer to `Tomb1Main_ConfigTool.exe` fo
|
|||
- fixed game audio not muting when game is minimized
|
||||
- fixed underwater ambient sound effect not playing
|
||||
- fixed sound effects playing rapidly in sound menu if input held down
|
||||
- fixed sounds stopping instead of pausing when using the inventory or pausing
|
||||
|
||||
#### Mods
|
||||
- added ability to adjust Lara's starting health (easy no damage mod)
|
||||
|
|
|
@ -148,8 +148,7 @@ bool Game_Pause(void)
|
|||
Output_SetupAboveWater(false);
|
||||
|
||||
Music_Pause();
|
||||
Sound_StopAmbientSounds();
|
||||
Sound_StopAllSamples();
|
||||
Sound_PauseAll();
|
||||
g_GameInfo.status |= GMS_IN_PAUSE;
|
||||
|
||||
Output_FadeToSemiBlack(true);
|
||||
|
@ -157,6 +156,7 @@ bool Game_Pause(void)
|
|||
Output_FadeToTransparent(true);
|
||||
|
||||
Music_Unpause();
|
||||
Sound_UnpauseAll();
|
||||
Requester_Remove(&m_PauseRequester);
|
||||
Game_Pause_RemoveText();
|
||||
g_GameInfo.status &= ~GMS_IN_PAUSE;
|
||||
|
|
|
@ -368,8 +368,7 @@ static int32_t Inv_ConstructAndDisplay(int inv_mode)
|
|||
|
||||
if (!g_Config.enable_music_in_inventory && g_InvMode != INV_TITLE_MODE) {
|
||||
Music_Pause();
|
||||
Sound_StopAmbientSounds();
|
||||
Sound_StopAllSamples();
|
||||
Sound_PauseAll();
|
||||
} else {
|
||||
Sound_ResetAmbient();
|
||||
Sound_UpdateEffects();
|
||||
|
@ -883,6 +882,7 @@ static int32_t Inv_ConstructAndDisplay(int inv_mode)
|
|||
|
||||
if (!g_Config.enable_music_in_inventory && g_InvMode != INV_TITLE_MODE) {
|
||||
Music_Unpause();
|
||||
Sound_UnpauseAll();
|
||||
}
|
||||
|
||||
if (start_demo) {
|
||||
|
|
|
@ -519,6 +519,16 @@ void Sound_LoadSamples(
|
|||
S_Audio_SamplesLoad(num_samples, sample_pointers, sizes);
|
||||
}
|
||||
|
||||
void Sound_PauseAll(void)
|
||||
{
|
||||
S_Audio_SampleSoundPauseAll();
|
||||
}
|
||||
|
||||
void Sound_UnpauseAll(void)
|
||||
{
|
||||
S_Audio_SampleSoundUnpauseAll();
|
||||
}
|
||||
|
||||
void Sound_StopAllSamples(void)
|
||||
{
|
||||
S_Audio_SampleSoundCloseAll();
|
||||
|
|
|
@ -13,6 +13,8 @@ bool Sound_StopEffect(int32_t sfx_num, PHD_3DPOS *pos);
|
|||
void Sound_UpdateEffects(void);
|
||||
void Sound_ResetEffects(void);
|
||||
void Sound_StopAmbientSounds(void);
|
||||
void Sound_PauseAll(void);
|
||||
void Sound_UnpauseAll(void);
|
||||
void Sound_StopAllSamples(void);
|
||||
void Sound_SetMasterVolume(int8_t volume);
|
||||
void Sound_LoadSamples(
|
||||
|
|
|
@ -30,6 +30,10 @@ bool S_Audio_SamplesLoad(size_t count, const char **contents, size_t *sizes);
|
|||
int S_Audio_SampleSoundPlay(
|
||||
int sample_id, int volume, float pitch, int pan, bool is_looped);
|
||||
bool S_Audio_SampleSoundIsPlaying(int sound_id);
|
||||
bool S_Audio_SampleSoundPause(int sound_id);
|
||||
bool S_Audio_SampleSoundPauseAll(void);
|
||||
bool S_Audio_SampleSoundUnpause(int sound_id);
|
||||
bool S_Audio_SampleSoundUnpauseAll(void);
|
||||
bool S_Audio_SampleSoundClose(int sound_id);
|
||||
bool S_Audio_SampleSoundCloseAll(void);
|
||||
bool S_Audio_SampleSoundSetPan(int sound_id, int pan);
|
||||
|
|
|
@ -504,6 +504,66 @@ bool S_Audio_SampleSoundIsPlaying(int sound_id)
|
|||
return m_SampleSounds[sound_id].is_playing;
|
||||
}
|
||||
|
||||
bool S_Audio_SampleSoundPause(int sound_id)
|
||||
{
|
||||
if (!g_AudioDeviceID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_SampleSounds[sound_id].is_playing) {
|
||||
SDL_LockAudioDevice(g_AudioDeviceID);
|
||||
m_SampleSounds[sound_id].is_playing = false;
|
||||
SDL_UnlockAudioDevice(g_AudioDeviceID);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool S_Audio_SampleSoundPauseAll(void)
|
||||
{
|
||||
if (!g_AudioDeviceID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int sound_id = 0; sound_id < AUDIO_MAX_ACTIVE_SAMPLES; sound_id++) {
|
||||
if (m_SampleSounds[sound_id].is_used) {
|
||||
S_Audio_SampleSoundPause(sound_id);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool S_Audio_SampleSoundUnpause(int sound_id)
|
||||
{
|
||||
if (!g_AudioDeviceID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_SampleSounds[sound_id].is_playing) {
|
||||
SDL_LockAudioDevice(g_AudioDeviceID);
|
||||
m_SampleSounds[sound_id].is_playing = true;
|
||||
SDL_UnlockAudioDevice(g_AudioDeviceID);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool S_Audio_SampleSoundUnpauseAll(void)
|
||||
{
|
||||
if (!g_AudioDeviceID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int sound_id = 0; sound_id < AUDIO_MAX_ACTIVE_SAMPLES; sound_id++) {
|
||||
if (m_SampleSounds[sound_id].is_used) {
|
||||
S_Audio_SampleSoundUnpause(sound_id);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool S_Audio_SampleSoundClose(int sound_id)
|
||||
{
|
||||
if (!g_AudioDeviceID || sound_id < 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue