Played around with new map MapVersion1. Was fun ヽ(´▽`)/

This commit is contained in:
stiffly
2016-01-15 11:23:29 +01:00
parent 32634f742e
commit 3e2cb33bc0
3 changed files with 9 additions and 8 deletions
+1 -1
Submodule assets updated: 6cbf2365d4...a3c92ac876
@@ -10,7 +10,6 @@ namespace Events
// Plays a sound on an entity with a SoundEmitter component attached. // Plays a sound on an entity with a SoundEmitter component attached.
// Sound behavior is thereby specified in the SoundEmitter component. // Sound behavior is thereby specified in the SoundEmitter component.
// ?(???)??
struct PlaySoundOnEntity : public Event struct PlaySoundOnEntity : public Event
{ {
EntityID EmitterID = 0; EntityID EmitterID = 0;
+8 -6
View File
@@ -41,8 +41,8 @@ void SoundSystem::stopEmitters()
{ {
std::unordered_map<EntityID, Source*>::iterator it; std::unordered_map<EntityID, Source*>::iterator it;
for (it = m_Sources.begin(); it != m_Sources.end(); it++) { for (it = m_Sources.begin(); it != m_Sources.end(); it++) {
if (getSourceState((*it).second->ALsource) == AL_PLAYING) { if (getSourceState(it->second->ALsource) == AL_PLAYING) {
stopSound((*it).second); stopSound(it->second);
} }
} }
} }
@@ -71,6 +71,7 @@ void SoundSystem::deleteInactiveEmitters()
alDeleteBuffers(1, &it->second->ALsource); alDeleteBuffers(1, &it->second->ALsource);
alDeleteSources(1, &it->second->ALsource); alDeleteSources(1, &it->second->ALsource);
m_World->DeleteEntity(it->first); m_World->DeleteEntity(it->first);
delete it->second;
it = m_Sources.erase(it); it = m_Sources.erase(it);
} }
} else { } else {
@@ -78,6 +79,7 @@ void SoundSystem::deleteInactiveEmitters()
stopSound((*it).second); stopSound((*it).second);
alDeleteBuffers(1, &it->second->ALsource); alDeleteBuffers(1, &it->second->ALsource);
alDeleteSources(1, &it->second->ALsource); alDeleteSources(1, &it->second->ALsource);
delete it->second;
it = m_Sources.erase(it); it = m_Sources.erase(it);
} }
} }
@@ -200,19 +202,19 @@ bool SoundSystem::OnPlaySoundOnPosition(const Events::PlaySoundOnPosition & e)
source->Type = SoundType::SFX; source->Type = SoundType::SFX;
m_Sources[emitterID] = source; m_Sources[emitterID] = source;
playSound(source); playSound(source);
return false; return true;
} }
bool SoundSystem::OnPauseSound(const Events::PauseSound & e) bool SoundSystem::OnPauseSound(const Events::PauseSound & e)
{ {
alSourcePause(m_Sources[e.EmitterID]->ALsource); alSourcePause(m_Sources[e.EmitterID]->ALsource);
return false; return true;
} }
bool SoundSystem::OnStopSound(const Events::StopSound & e) bool SoundSystem::OnStopSound(const Events::StopSound & e)
{ {
alSourceStop(m_Sources[e.EmitterID]->ALsource); alSourceStop(m_Sources[e.EmitterID]->ALsource);
return false; return true;
} }
bool SoundSystem::OnContinueSound(const Events::ContinueSound & e) bool SoundSystem::OnContinueSound(const Events::ContinueSound & e)
@@ -235,7 +237,7 @@ bool SoundSystem::OnPlayBackgroundMusic(const Events::PlayBackgroundMusic & e)
m_Sources[emitterChild] = source; m_Sources[emitterChild] = source;
playSound(source); playSound(source);
} }
return false; return true;
} }
bool SoundSystem::OnSetBGMGain(const Events::SetBGMGain & e) bool SoundSystem::OnSetBGMGain(const Events::SetBGMGain & e)