X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FSounds.cpp;h=c2d4eb714863b86e334d5a86aa51e0b94318f843;hb=cc92cb7b7f9b87cb791c504bf930d622d74db368;hp=6bb69700acfa31ee5a6146aba3ab32e4d8b8ad17;hpb=5509b55dbc13227bdc7b97f2934fa71dad02cc66;p=lugaru.git diff --git a/Source/Sounds.cpp b/Source/Sounds.cpp index 6bb6970..c2d4eb7 100644 --- a/Source/Sounds.cpp +++ b/Source/Sounds.cpp @@ -23,6 +23,11 @@ along with Lugaru. If not, see . struct OPENAL_SAMPLE *samp[sounds_count]; +extern XYZ envsound[30]; +extern float envsoundvol[30]; +extern int numenvsounds; +extern float envsoundlife[30]; + int footstepsound, footstepsound2, footstepsound3, footstepsound4; int channels[100]; @@ -69,8 +74,15 @@ void loadAllSounds() OPENAL_Stream_SetMode(samp[i], OPENAL_LOOP_NORMAL); } -void -emit_sound_at(int soundid, const XYZ &pos, float vol) +void addEnvSound(XYZ coords, float vol, float life) +{ + envsound[numenvsounds] = coords; + envsoundvol[numenvsounds] = vol; + envsoundlife[numenvsounds] = life; + numenvsounds++; +} + +void emit_sound_at(int soundid, const XYZ &pos, float vol) { PlaySoundEx (soundid, samp[soundid], NULL, true); OPENAL_3D_SetAttributes_ (channels[soundid], pos, NULL); @@ -78,16 +90,14 @@ emit_sound_at(int soundid, const XYZ &pos, float vol) OPENAL_SetPaused (channels[soundid], false); } -void -emit_sound_np(int soundid, float vol) +void emit_sound_np(int soundid, float vol) { PlaySoundEx (soundid, samp[soundid], NULL, true); OPENAL_SetVolume (channels[soundid], vol); OPENAL_SetPaused (channels[soundid], false); } -void -emit_stream_at(int soundid, const XYZ &pos, float vol) +void emit_stream_at(int soundid, const XYZ &pos, float vol) { PlayStreamEx (soundid, samp[soundid], NULL, true); OPENAL_3D_SetAttributes_ (channels[soundid], pos, NULL); @@ -95,23 +105,19 @@ emit_stream_at(int soundid, const XYZ &pos, float vol) OPENAL_SetPaused (channels[soundid], false); } -void -emit_stream_np(int soundid, float vol) +void emit_stream_np(int soundid, float vol) { PlayStreamEx (soundid, samp[soundid], NULL, true); OPENAL_SetVolume (channels[soundid], vol); OPENAL_SetPaused (channels[soundid], false); } -void -resume_stream(int soundid) +void resume_stream(int soundid) { OPENAL_SetPaused (channels[soundid], false); } -void -pause_sound(int soundid) +void pause_sound(int soundid) { OPENAL_SetPaused (channels[soundid], true); } -