]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Sounds.cpp
Removed all modifications of Account active from outside Account
[lugaru.git] / Source / Sounds.cpp
index 9905a0fed08de113e3c66d4379813e19e4a0bfb5..735d93975fc58780c86bb929177a9378158a9a48 100644 (file)
@@ -1,30 +1,34 @@
 /*
-Copyright (C) 2010 - Lugaru authors
+Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
 
 This file is part of Lugaru.
 
-Lugaru is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
+Lugaru is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
+Lugaru is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-See the GNU General Public License for more details.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+along with Lugaru.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "Quaternions.h"
 #include "Sounds.h"
 #include "openal_wrapper.h"
+#include "Utils/Folders.h"
 
 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];
@@ -54,10 +58,9 @@ static int snd_mode(int snd)
 void loadAllSounds()
 {
     for (int i = 0; i < sounds_count; i++) {
-        char buf[64];
-        snprintf(buf, 64, ":Data:Sounds:%s", sound_data[i]);
+        std::string buf = std::string("Sounds/") + sound_data[i];
         samp[i] = OPENAL_Sample_Load(OPENAL_FREE,
-                                     ConvertFileName(buf),
+                                     Folders::getResourcePath(buf).c_str(),
                                      snd_mode(i),
                                      0, 0);
     }
@@ -71,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);
@@ -80,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);
@@ -97,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);
 }
-