]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_main.c
turn font size snapping into a float
[xonotic/darkplaces.git] / snd_main.c
index 4d4bf704db54132541787447f283430737558d13..40a8c187f60ff330a5dfbdf58277aceef22901eb 100644 (file)
@@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "snd_ogg.h"
 #include "snd_modplug.h"
 #include "csprogs.h"
+#include "cl_collision.h"
 
 
 #define SND_MIN_SPEED 8000
@@ -169,7 +170,7 @@ cvar_t snd_spatialization_control = {CVAR_SAVE, "snd_spatialization_control", "0
 cvar_t snd_spatialization_occlusion = {CVAR_SAVE, "snd_spatialization_occlusion", "1", "enable occlusion testing on spatialized sounds, which simply quiets sounds that are blocked by the world"};
 
 // Cvars declared in snd_main.h (shared with other snd_*.c files)
-cvar_t _snd_mixahead = {CVAR_SAVE, "_snd_mixahead", "0.11", "how much sound to mix ahead of time"};
+cvar_t _snd_mixahead = {CVAR_SAVE, "_snd_mixahead", "0.15", "how much sound to mix ahead of time"};
 cvar_t snd_swapstereo = {CVAR_SAVE, "snd_swapstereo", "0", "swaps left/right speakers for old ISA soundblaster cards"};
 extern cvar_t v_flipped;
 cvar_t snd_channellayout = {0, "snd_channellayout", "0", "channel layout. Can be 0 (auto - snd_restart needed), 1 (standard layout), or 2 (ALSA layout)"};
@@ -1251,8 +1252,10 @@ void SND_Spatialize(channel_t *ch, qboolean isstatic)
                }
                else if (cl.entities[ch->entnum].state_current.active)
                {
+                       dp_model_t *model;
                        //Con_Printf("-- entnum %i origin %f %f %f neworigin %f %f %f\n", ch->entnum, ch->origin[0], ch->origin[1], ch->origin[2], cl.entities[ch->entnum].state_current.origin[0], cl.entities[ch->entnum].state_current.origin[1], cl.entities[ch->entnum].state_current.origin[2]);
-                       if (cl.entities[ch->entnum].state_current.modelindex && cl.model_precache[cl.entities[ch->entnum].state_current.modelindex] && cl.model_precache[cl.entities[ch->entnum].state_current.modelindex]->soundfromcenter)
+                       model = CL_GetModelByIndex(cl.entities[ch->entnum].state_current.modelindex);
+                       if (model && model->soundfromcenter)
                                VectorMAM(0.5f, cl.entities[ch->entnum].render.mins, 0.5f, cl.entities[ch->entnum].render.maxs, ch->origin);
                        else
                                Matrix4x4_OriginFromMatrix(&cl.entities[ch->entnum].render.matrix, ch->origin);
@@ -1463,7 +1466,8 @@ int S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float f
                        if (ch->entnum == entnum && (ch->entchannel == entchannel || entchannel == -1) )
                        {
                                S_SetChannelVolume(ch_idx, fvol);
-                               ch->dist_mult = attenuation / (64.0f * snd_soundradius.value);
+                               ch->dist_mult = attenuation / snd_soundradius.value;
+                               SND_Spatialize(ch, false);
                                return ch_idx;
                        }
                }