Push mainvolume et musicvolume sliders fonctionnels. Bug sfx
This commit is contained in:
@@ -45,7 +45,6 @@ void Engine::Init() {
|
||||
gluPerspective(45.0f, (float)Width() / (float)Height(), 0.1f, VIEW_DISTANCE);
|
||||
glShadeModel(GL_SMOOTH);
|
||||
|
||||
|
||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
||||
glDisable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
@@ -241,17 +240,21 @@ void Engine::LoadResource() {
|
||||
}
|
||||
|
||||
// Settings
|
||||
m_mainvolume = m_audio.GetMainVolume();
|
||||
m_options.SetMainVolume(m_mainvolume);
|
||||
|
||||
m_musicvolume = m_audio.GetMusicVolume();
|
||||
m_options.SetMusicVolume(m_musicvolume);
|
||||
|
||||
m_sfxvolume = m_audio.GetSfxVolume();
|
||||
m_options.SetSfxVolume(m_sfxvolume);
|
||||
|
||||
m_sensitivity = m_player.GetSensitivity();
|
||||
m_options.SetMouseSensitivity(m_sensitivity);
|
||||
}
|
||||
|
||||
void Engine::UnloadResource() {}
|
||||
|
||||
|
||||
|
||||
void Engine::InstantDamage() {
|
||||
m_player.InflictDamage(0.10f);
|
||||
m_damage = false;
|
||||
@@ -1333,11 +1336,11 @@ void Engine::Render(float elapsedTime) {
|
||||
if (leftright)
|
||||
vstep = Vector3f(m_player.GetPosition().x + m_player.GetDirection().z, m_player.GetPosition().y - 1.7f, m_player.GetPosition().z + m_player.GetDirection().x);
|
||||
else vstep = Vector3f(m_player.GetPosition().x - m_player.GetDirection().z, m_player.GetPosition().y - 1.7f, m_player.GetPosition().z - m_player.GetDirection().x);
|
||||
m_audio.Create3DAudioObj(step, AUDIO_PATH "step.wav", vstep, m_player.GetVelocity(), false, .8f);
|
||||
m_audio.Create3DAudioObj(step, AUDIO_PATH "step.wav", vstep, m_player.GetVelocity(), false, m_sfxvolume);
|
||||
leftright = !leftright;
|
||||
break;
|
||||
case Player::Sound::FALL:
|
||||
m_audio.Create3DAudioObj(step, AUDIO_PATH "hit.wav", m_player.GetPosition(), m_player.GetVelocity(), false, 1.f);
|
||||
m_audio.Create3DAudioObj(step, AUDIO_PATH "hit.wav", m_player.GetPosition(), m_player.GetVelocity(), false, m_sfxvolume);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
@@ -1366,7 +1369,7 @@ void Engine::Render(float elapsedTime) {
|
||||
m_bullets[0] = new Bullet(m_player.GetPOV() + m_player.GetDirection(), m_player.GetDirection());
|
||||
}
|
||||
bulletTime = BULLET_TIME;
|
||||
m_audio.Create3DAudioObj(m_powpow, AUDIO_PATH "pow.wav", m_player.GetPOV(), m_player.GetDirection() * 10, false, .5f);
|
||||
m_audio.Create3DAudioObj(m_powpow, AUDIO_PATH "pow.wav", m_player.GetPOV(), m_player.GetDirection() * 10, false, m_sfxvolume);
|
||||
if (m_flash) { // Coupe le rendering et affiche un frame blanc, pour simuler un flash.
|
||||
glClearColor(.8f, .8f, .8f, 1.f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
@@ -1420,7 +1423,7 @@ void Engine::Render(float elapsedTime) {
|
||||
}
|
||||
static bool died = false;
|
||||
if ((m_player.GetPosition().y < -1.7f || m_player.AmIDead()) && !died) {
|
||||
m_audio.Create3DAudioObj(m_scream, AUDIO_PATH "scream.wav", m_player.GetPOV(), m_player.GetVelocity(), false, 1.f);
|
||||
m_audio.Create3DAudioObj(m_scream, AUDIO_PATH "scream.wav", m_player.GetPOV(), m_player.GetVelocity(), false, m_sfxvolume);
|
||||
died = true;
|
||||
}
|
||||
if (m_player.GetPosition().y < -21.f || died) {
|
||||
@@ -1541,7 +1544,7 @@ void Engine::Render(float elapsedTime) {
|
||||
RemotePlayer* rt = static_cast<RemotePlayer*>(m_players[out.id]);
|
||||
rt->Feed(out);
|
||||
if (rt->AmIDead()) {
|
||||
m_audio.Create3DAudioObj(m_scream, AUDIO_PATH "scream.wav", m_player.GetPOV(), m_player.GetVelocity(), false, 1.f);
|
||||
m_audio.Create3DAudioObj(m_scream, AUDIO_PATH "scream.wav", m_player.GetPOV(), m_player.GetVelocity(), false, m_sfxvolume);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1571,7 +1574,7 @@ void Engine::Render(float elapsedTime) {
|
||||
m_bullets[0] = bult;
|
||||
break;
|
||||
}
|
||||
m_audio.Create3DAudioObj(m_powpow, AUDIO_PATH "pow.wav", bull.pos, bull.dir, false, 1.f);
|
||||
m_audio.Create3DAudioObj(m_powpow, AUDIO_PATH "pow.wav", bull.pos, bull.dir, false, m_sfxvolume);
|
||||
}
|
||||
else SystemNotification("Bullet is kraput.");
|
||||
break;
|
||||
@@ -2146,6 +2149,7 @@ void Engine::MouseMoveEvent(int x, int y) {
|
||||
|
||||
if (m_selectedOption == 0 && m_selectedOptAudioMainBar) {
|
||||
m_mainvolume = normalizedPosition;
|
||||
m_audio.SetMainVolume(m_mainvolume);
|
||||
}
|
||||
else if (m_selectedOption == 0 && m_selectedOptAudioMusicBar) {
|
||||
m_musicvolume = normalizedPosition;
|
||||
@@ -2153,6 +2157,7 @@ void Engine::MouseMoveEvent(int x, int y) {
|
||||
}
|
||||
else if (m_selectedOption == 0 && m_selectedOptAudioSfxBar) {
|
||||
m_sfxvolume = normalizedPosition;
|
||||
m_audio.SetSfxVolume(m_sfxvolume);
|
||||
}
|
||||
else if (m_selectedOption == 2 && m_selectedGameplaySensitivityBar) {
|
||||
m_sensitivity = normalizedPosition;
|
||||
@@ -2286,8 +2291,9 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
|
||||
|
||||
if (m_selectedOption == 0 && x > leftBar && x < rightBar && y > bottomBarPrincipal && y < topBarPrincipal) {
|
||||
m_audio.playSound(AUDIO_PATH "snap.wav");
|
||||
m_mainvolume = normalizedPosition;
|
||||
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");
|
||||
@@ -2297,8 +2303,9 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
|
||||
}
|
||||
else if (m_selectedOption == 0 && x > leftBar && x < rightBar && y > bottomBarEffets && y < topBarEffets) {
|
||||
m_audio.playSound(AUDIO_PATH "snap.wav");
|
||||
m_sfxvolume = normalizedPosition;
|
||||
m_selectedOptAudioSfxBar = true;
|
||||
m_sfxvolume = normalizedPosition;
|
||||
m_audio.SetSfxVolume(m_sfxvolume);
|
||||
}
|
||||
|
||||
// Resolution
|
||||
@@ -2340,6 +2347,7 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
|
||||
else if (normalizedPosition > 1.0f) {
|
||||
normalizedPosition = 1.0f;
|
||||
}
|
||||
|
||||
// Gameplay
|
||||
if (m_selectedOption == 2 && x > leftBar && x < rightBar && y > bottomBarPrincipal && y < topBarPrincipal) {
|
||||
m_audio.playSound(AUDIO_PATH "snap.wav");
|
||||
@@ -2388,21 +2396,33 @@ void Engine::MouseReleaseEvent(const MOUSE_BUTTON& button, int x, int y) {
|
||||
|
||||
switch (button) {
|
||||
case MOUSE_BUTTON_LEFT:
|
||||
if (m_selectedOptAudioMusicBar) {
|
||||
if (m_selectedOption == 0) {
|
||||
if (normalizedPosition < 0.0f) {
|
||||
normalizedPosition = 0.0f;
|
||||
}
|
||||
|
||||
m_musicvolume = normalizedPosition;
|
||||
m_audio.SetMusicVolume(m_musicvolume);
|
||||
}
|
||||
if (m_selectedGameplaySensitivityBar) {
|
||||
if (normalizedPosition < 0.1f) {
|
||||
normalizedPosition = 0.1f;
|
||||
if (m_selectedOptAudioMainBar) {
|
||||
m_mainvolume = normalizedPosition;
|
||||
m_audio.SetMainVolume(m_mainvolume);
|
||||
}
|
||||
else if (m_selectedOptAudioMusicBar) {
|
||||
m_musicvolume = normalizedPosition;
|
||||
m_audio.SetMusicVolume(m_musicvolume);
|
||||
}
|
||||
else if (m_selectedOptAudioSfxBar) {
|
||||
m_sfxvolume = normalizedPosition;
|
||||
m_audio.SetSfxVolume(m_sfxvolume);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (m_selectedGameplaySensitivityBar) {
|
||||
if (normalizedPosition < 0.1f) {
|
||||
normalizedPosition = 0.1f;
|
||||
}
|
||||
|
||||
m_sensitivity = normalizedPosition;
|
||||
m_player.SetSensitivity(m_sensitivity);
|
||||
m_sensitivity = normalizedPosition;
|
||||
m_player.SetSensitivity(m_sensitivity);
|
||||
}
|
||||
}
|
||||
m_mouseL = false;
|
||||
m_block = false;
|
||||
|
Reference in New Issue
Block a user