correction sfx

This commit is contained in:
MarcEricMartel
2023-12-14 14:02:29 -05:00
parent 383a19cbd2
commit 1af88ba3e3
3 changed files with 40 additions and 21 deletions

View File

@@ -1248,6 +1248,7 @@ void Engine::DisplayGraphicsMenu(float centerX, float centerY) {
void Engine::Render(float elapsedTime) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
m_audio.CleanupSFX();
if (m_gamestate == GameState::SPLASH) {
if (m_splashTime > 0.0f) {
@@ -2206,7 +2207,7 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
float bottomThird = centerY + Height() * 0.198f;
if (x > leftButton && x < rightButton && y > bottomFirst && y < topFirst) {
m_audio.playSound(AUDIO_PATH "snap.wav");
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
if (m_selectedPlayOptions) {
m_gamestate = GameState::PLAY;
m_audio.ToggleMusicState(m_gamestate);
@@ -2216,7 +2217,7 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
}
}
else if (x > leftButton && x < rightButton && y > bottomSecond && y < topSecond) {
m_audio.playSound(AUDIO_PATH "snap.wav");
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
if (m_selectedPlayOptions) {
m_gamestate = GameState::LOBBY;
m_settingUsername = true;
@@ -2226,7 +2227,7 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
}
}
else if (x > leftButton && x < rightButton && y > bottomThird && y < topThird) {
m_audio.playSound(AUDIO_PATH "snap.wav");
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
if (m_selectedPlayOptions) {
m_selectedPlayOptions = false;
}
@@ -2257,19 +2258,19 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
float bottomBack = centerY + Height() * 0.2f;
if (x > leftAudio && x < rightAudio && y > bottomAudio && y < topAudio) {
m_audio.playSound(AUDIO_PATH "snap.wav");
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
m_selectedOption = 0; // Volume
}
else if (x > leftGraph && x < rightGraph && y > bottomGraph && y < topGraph) {
m_audio.playSound(AUDIO_PATH "snap.wav");
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
m_selectedOption = 1; // Graphics
}
else if (x > leftGameplay && x < rightGameplay && y > bottomGameplay && y < topGameplay) {
m_audio.playSound(AUDIO_PATH "snap.wav");
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
m_selectedOption = 2; // Gameplay
}
else if (x > leftBack && x < rightBack && y > bottomBack && y < topBack) {
m_audio.playSound(AUDIO_PATH "snap.wav");
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
m_gamestate = GameState::MAIN_MENU;
}
@@ -2290,19 +2291,19 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
float normalizedPosition = (x - leftBar) / barLength;
if (m_selectedOption == 0 && x > leftBar && x < rightBar && y > bottomBarPrincipal && y < topBarPrincipal) {
m_audio.playSound(AUDIO_PATH "snap.wav");
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
m_selectedOptAudioMainBar = true;
m_mainvolume = normalizedPosition;
m_audio.SetMainVolume(m_mainvolume);
}
else if (m_selectedOption == 0 && x > leftBar && x < rightBar && y > bottomBarMusique && y < topBarMusique) {
m_audio.playSound(AUDIO_PATH "snap.wav");
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
m_selectedOptAudioMusicBar = true;
m_musicvolume = normalizedPosition;
m_audio.SetMusicVolume(m_musicvolume);
}
else if (m_selectedOption == 0 && x > leftBar && x < rightBar && y > bottomBarEffets && y < topBarEffets) {
m_audio.playSound(AUDIO_PATH "snap.wav");
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
m_selectedOptAudioSfxBar = true;
m_sfxvolume = normalizedPosition;
m_audio.SetSfxVolume(m_sfxvolume);
@@ -2325,19 +2326,19 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
float bottomChkUHD = centerY;
if (m_selectedOption == 1 && leftChk && x < rightChk && y > bottomChkHD && y < topChkHD) {
m_audio.playSound(AUDIO_PATH "snap.wav");
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
m_resolution = HD;
}
else if (m_selectedOption == 1 && x > leftChk && x < rightChk && y > bottomChkFHD && y < topChkFHD) {
m_audio.playSound(AUDIO_PATH "snap.wav");
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
m_resolution = FHD;
}
else if (m_selectedOption == 1 && x > leftChk && x < rightChk && y > bottomChkQHD && y < topChkQHD) {
m_audio.playSound(AUDIO_PATH "snap.wav");
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
m_resolution = QHD;
}
else if (m_selectedOption == 1 && x > leftChk && x < rightChk && y > bottomChkUHD && y < topChkUHD) {
m_audio.playSound(AUDIO_PATH "snap.wav");
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
m_resolution = UHD;
}
@@ -2350,7 +2351,7 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
// Gameplay
if (m_selectedOption == 2 && x > leftBar && x < rightBar && y > bottomBarPrincipal && y < topBarPrincipal) {
m_audio.playSound(AUDIO_PATH "snap.wav");
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
m_selectedGameplaySensitivityBar = true;
m_sensitivity = normalizedPosition;
m_player.SetSensitivity(m_sensitivity);
@@ -2368,12 +2369,12 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
float bottomMainMenu = centerY - Height() * 0.4415f;
if (x > leftResume && x < rightResume && y > bottomResume && y < topResume) {
m_audio.playSound(AUDIO_PATH "snap.wav");
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
m_gamestate = GameState::PLAY;
m_audio.ToggleMusicState(m_gamestate);
}
else if (x > leftMainMenu && x < rightMainMenu && y > bottomMainMenu && y < topMainMenu) {
m_audio.playSound(AUDIO_PATH "snap.wav");
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
m_gamestate = GameState::MAIN_MENU;
m_selectedPlayOptions = false;
m_audio.ToggleMusicState(m_gamestate);