diff --git a/include/QF/plugin/snd_render.h b/include/QF/plugin/snd_render.h index bb99df885..8d88163c2 100644 --- a/include/QF/plugin/snd_render.h +++ b/include/QF/plugin/snd_render.h @@ -29,6 +29,7 @@ #include #include +#include struct sfx_s; struct transform_s; @@ -37,8 +38,8 @@ typedef struct snd_render_funcs_s { void (*init) (void); void (*ambient_off) (void); void (*ambient_on) (void); - void (*static_sound) (struct sfx_s *sfx, const vec3_t origin, float vol, float attenuation); - void (*start_sound) (int entnum, int entchannel, struct sfx_s *sfx, const vec3_t origin, float vol, float attenuation); + void (*static_sound) (struct sfx_s *sfx, vec4f_t origin, float vol, float attenuation); + void (*start_sound) (int entnum, int entchannel, struct sfx_s *sfx, const vec4f_t, float vol, float attenuation); void (*local_sound) (const char *s); void (*stop_sound) (int entnum, int entchannel); diff --git a/include/QF/sound.h b/include/QF/sound.h index 3c2968298..7d2227fc4 100644 --- a/include/QF/sound.h +++ b/include/QF/sound.h @@ -33,6 +33,7 @@ */ #include "QF/mathlib.h" +#include "QF/simd/types.h" struct transform_s; @@ -108,7 +109,7 @@ void S_Shutdown (void); \param vol absolute volume of the sound \param attenuation rate of volume dropoff vs distance */ -void S_StartSound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin, +void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec4f_t origin, float vol, float attenuation); /** Create a sound generated by the world. @@ -117,8 +118,7 @@ void S_StartSound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin, \param vol absolute volume of the sound \param attenuation rate of volume dropoff vs distance */ -void S_StaticSound (sfx_t *sfx, const vec3_t origin, float vol, - float attenuation); +void S_StaticSound (sfx_t *sfx, vec4f_t origin, float vol, float attenuation); /** Stop an entity's sound. \param entnum index of entity the sound is associated with. \param entchannel channel to silence diff --git a/include/snd_internal.h b/include/snd_internal.h index fe666f42a..8d95d0615 100644 --- a/include/snd_internal.h +++ b/include/snd_internal.h @@ -392,7 +392,7 @@ void SND_Channels_Init (snd_t *snd); \param attenuation rate of volume dropoff vs distance */ void SND_StartSound (snd_t *snd, int entnum, int entchannel, sfx_t *sfx, - const vec3_t origin, float fvol, float attenuation); + vec4f_t origin, float fvol, float attenuation); /** Create a sound generated by the world. \param snd sound system state @@ -401,7 +401,7 @@ void SND_StartSound (snd_t *snd, int entnum, int entchannel, sfx_t *sfx, \param vol absolute volume of the sound \param attenuation rate of volume dropoff vs distance */ -void SND_StaticSound (snd_t *snd, sfx_t *sfx, const vec3_t origin, float vol, +void SND_StaticSound (snd_t *snd, sfx_t *sfx, vec4f_t origin, float vol, float attenuation); /** Stop an entity's sound. \param snd sound system state diff --git a/libs/audio/renderer/snd_channels.c b/libs/audio/renderer/snd_channels.c index 09e1bda30..492fb430b 100644 --- a/libs/audio/renderer/snd_channels.c +++ b/libs/audio/renderer/snd_channels.c @@ -247,8 +247,7 @@ s_play_f (void *_snd) dsprintf (name, "%s", Cmd_Argv (i)); } sfx = SND_PrecacheSound (snd, name->str); - //FIXME - SND_StartSound (snd, hash++, 0, sfx, &listener_origin[0], 1.0, 1.0); + SND_StartSound (snd, hash++, 0, sfx, listener_origin, 1.0, 1.0); i++; } dstring_delete (name); @@ -273,8 +272,7 @@ s_playcenter_f (void *_snd) dsprintf (name, "%s", Cmd_Argv (i)); } sfx = SND_PrecacheSound (snd, name->str); - //FIXME - SND_StartSound (snd, viewent, 0, sfx, &listener_origin[0], 1.0, 1.0); + SND_StartSound (snd, viewent, 0, sfx, listener_origin, 1.0, 1.0); } dstring_delete (name); } @@ -298,8 +296,7 @@ s_playvol_f (void *_snd) } sfx = SND_PrecacheSound (snd, name->str); vol = atof (Cmd_Argv (i + 1)); - //FIXME - SND_StartSound (snd, hash++, 0, sfx, &listener_origin[0], vol, 1.0); + SND_StartSound (snd, hash++, 0, sfx, listener_origin, vol, 1.0); i += 2; } dstring_delete (name); @@ -617,7 +614,7 @@ snd_check_channels (snd_t *snd, channel_t *target_chan, const channel_t *check, void SND_StartSound (snd_t *snd, int entnum, int entchannel, sfx_t *sfx, - const vec3_t origin, float fvol, float attenuation) + vec4f_t origin, float fvol, float attenuation) { int vol; int looped; @@ -691,7 +688,7 @@ SND_StopSound (snd_t *snd, int entnum, int entchannel) } void -SND_StaticSound (snd_t *snd, sfx_t *sfx, const vec3_t origin, float vol, +SND_StaticSound (snd_t *snd, sfx_t *sfx, vec4f_t origin, float vol, float attenuation) { channel_t *ss; @@ -743,5 +740,5 @@ SND_LocalSound (snd_t *snd, const char *sound) } if (snd_render_data.viewentity) viewent = *snd_render_data.viewentity; - SND_StartSound (snd, viewent, -1, sfx, vec3_origin, 1, 1); + SND_StartSound (snd, viewent, -1, sfx, (vec4f_t) {0, 0, 0, 1}, 1, 1); } diff --git a/libs/audio/renderer/snd_dma.c b/libs/audio/renderer/snd_dma.c index d5714c55a..ecf5b2707 100644 --- a/libs/audio/renderer/snd_dma.c +++ b/libs/audio/renderer/snd_dma.c @@ -392,7 +392,7 @@ s_ambient_on (void) } static void -s_static_sound (sfx_t *sfx, const vec3_t origin, float vol, +s_static_sound (sfx_t *sfx, vec4f_t origin, float vol, float attenuation) { if (!sound_started) @@ -401,7 +401,7 @@ s_static_sound (sfx_t *sfx, const vec3_t origin, float vol, } static void -s_start_sound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin, +s_start_sound (int entnum, int entchannel, sfx_t *sfx, vec4f_t origin, float vol, float attenuation) { if (!sound_started) diff --git a/libs/audio/snd.c b/libs/audio/snd.c index e7c1b0d3b..072fef20f 100644 --- a/libs/audio/snd.c +++ b/libs/audio/snd.c @@ -135,14 +135,14 @@ S_AmbientOn (void) } VISIBLE void -S_StaticSound (sfx_t *sfx, const vec3_t origin, float vol, float attenuation) +S_StaticSound (sfx_t *sfx, vec4f_t origin, float vol, float attenuation) { if (snd_render_funcs) snd_render_funcs->static_sound (sfx, origin, vol, attenuation); } VISIBLE void -S_StartSound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin, +S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec4f_t origin, float vol, float attenuation) { if (snd_render_funcs) diff --git a/libs/client/cl_temp_entities.c b/libs/client/cl_temp_entities.c index fefdb3b35..3b932d3ca 100644 --- a/libs/client/cl_temp_entities.c +++ b/libs/client/cl_temp_entities.c @@ -361,7 +361,7 @@ parse_tent (qmsg_t *net_message, double time, TEntContext_t *ctx, } // sound - S_StartSound (-1, 0, cl_sfx_r_exp3, &position[0], 1, 1); + S_StartSound (-1, 0, cl_sfx_r_exp3, position, 1, 1); // sprite to = new_tent_object (); @@ -383,7 +383,7 @@ parse_tent (qmsg_t *net_message, double time, TEntContext_t *ctx, MSG_ReadCoordV (net_message, &position[0]); colorStart = MSG_ReadByte (net_message); colorLength = MSG_ReadByte (net_message); - S_StartSound (-1, 0, cl_sfx_r_exp3, &position[0], 1, 1); + S_StartSound (-1, 0, cl_sfx_r_exp3, position, 1, 1); clp_funcs->ParticleExplosion2 (position, colorStart, colorLength); dl = R_AllocDlight (0); if (!dl) @@ -402,7 +402,7 @@ parse_tent (qmsg_t *net_message, double time, TEntContext_t *ctx, MSG_ReadCoordV (net_message, color); // OUCH! color[3] = 0.7; clp_funcs->ParticleExplosion (position); - S_StartSound (-1, 0, cl_sfx_r_exp3, &position[0], 1, 1); + S_StartSound (-1, 0, cl_sfx_r_exp3, position, 1, 1); dl = R_AllocDlight (0); if (dl) { VectorCopy (position, dl->origin); @@ -424,7 +424,7 @@ parse_tent (qmsg_t *net_message, double time, TEntContext_t *ctx, case TE_KnightSpike: MSG_ReadCoordV (net_message, &position[0]); clp_funcs->KnightSpikeEffect (position); - S_StartSound (-1, 0, cl_sfx_knighthit, &position[0], 1, 1); + S_StartSound (-1, 0, cl_sfx_knighthit, position, 1, 1); break; case TE_LavaSplash: MSG_ReadCoordV (net_message, &position[0]); @@ -471,7 +471,7 @@ parse_tent (qmsg_t *net_message, double time, TEntContext_t *ctx, } else { sound = cl_sfx_tink1; } - S_StartSound (-1, 0, sound, &position[0], 1, 1); + S_StartSound (-1, 0, sound, position, 1, 1); } break; case TE_SuperSpike: @@ -487,14 +487,14 @@ parse_tent (qmsg_t *net_message, double time, TEntContext_t *ctx, } else { sound = cl_sfx_tink1; } - S_StartSound (-1, 0, sound, &position[0], 1, 1); + S_StartSound (-1, 0, sound, position, 1, 1); } break; case TE_TarExplosion: MSG_ReadCoordV (net_message, &position[0]); clp_funcs->BlobExplosion (position); - S_StartSound (-1, 0, cl_sfx_r_exp3, &position[0], 1, 1); + S_StartSound (-1, 0, cl_sfx_r_exp3, position, 1, 1); break; case TE_Teleport: MSG_ReadCoordV (net_message, &position[0]); @@ -503,7 +503,7 @@ parse_tent (qmsg_t *net_message, double time, TEntContext_t *ctx, case TE_WizSpike: MSG_ReadCoordV (net_message, &position[0]); clp_funcs->WizSpikeEffect (position); - S_StartSound (-1, 0, cl_sfx_wizhit, &position[0], 1, 1); + S_StartSound (-1, 0, cl_sfx_wizhit, position, 1, 1); break; } } diff --git a/nq/source/cl_parse.c b/nq/source/cl_parse.c index de98ec63d..475ede102 100644 --- a/nq/source/cl_parse.c +++ b/nq/source/cl_parse.c @@ -150,7 +150,6 @@ CL_ParseStartSoundPacket (void) { float attenuation; int channel, ent, field_mask, sound_num, volume; - vec3_t pos; field_mask = MSG_ReadByte (net_message); @@ -183,7 +182,8 @@ CL_ParseStartSoundPacket (void) if (ent > MAX_EDICTS) Host_Error ("CL_ParseStartSoundPacket: ent = %i", ent); - MSG_ReadCoordV (net_message, pos); + vec4f_t pos = { 0, 0, 0, 1}; + MSG_ReadCoordV (net_message, (vec_t*)&pos);//FIXME S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume / 255.0, attenuation); @@ -685,9 +685,9 @@ static void CL_ParseStaticSound (int version) { int sound_num, vol, atten; - vec3_t org; + vec4f_t org = { 0, 0, 0, 1 }; - MSG_ReadCoordV (net_message, org); + MSG_ReadCoordV (net_message, (vec_t*)&org);//FIXME if (version == 2) sound_num = MSG_ReadShort (net_message); else diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index 2dfe6e25b..0d3cac20b 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -903,9 +903,9 @@ static void CL_ParseStaticSound (void) { int sound_num, vol, atten; - vec3_t org; + vec4f_t org = { 0, 0, 0, 1 }; - MSG_ReadCoordV (net_message, org); + MSG_ReadCoordV (net_message, (vec_t*)&org);//FIXME sound_num = MSG_ReadByte (net_message); vol = MSG_ReadByte (net_message); atten = MSG_ReadByte (net_message); @@ -920,7 +920,6 @@ CL_ParseStartSoundPacket (void) { float attenuation; int bits, channel, ent, sound_num, volume; - vec3_t pos; bits = MSG_ReadShort (net_message); @@ -936,7 +935,8 @@ CL_ParseStartSoundPacket (void) sound_num = MSG_ReadByte (net_message); - MSG_ReadCoordV (net_message, pos); + vec4f_t pos = { 0, 0, 0, 1 }; + MSG_ReadCoordV (net_message, (vec_t*)&pos);//FIXME ent = (bits >> 3) & 1023; channel = bits & 7;