mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-20 09:21:09 +00:00
[sound] Use vec4f_t for api functions
Fixes a few vec3_t/vec4f_t FIXMEs.
This commit is contained in:
parent
1d1a59ac94
commit
da42aaf423
9 changed files with 34 additions and 36 deletions
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <QF/plugin.h>
|
||||
#include <QF/qtypes.h>
|
||||
#include <QF/simd/types.h>
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue