- added S_PlaySound3D variant receiving a float vector

This commit is contained in:
Christoph Oelckers 2022-09-13 19:48:44 +02:00
parent e31f10be8a
commit 4956062b22
2 changed files with 10 additions and 6 deletions

View file

@ -348,7 +348,7 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
{
uint8_t switchpal;
int lotag, hitag, picnum, correctdips, numdips;
int sx, sy;
DVector2 pos;
if (wwal == nullptr && act == nullptr) return 0;
correctdips = 1;
@ -359,8 +359,7 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
lotag = act->spr.lotag;
if (lotag == 0) return 0;
hitag = act->spr.hitag;
sx = act->int_pos().X;
sy = act->int_pos().Y;
pos = act->spr.pos.XY();
picnum = act->spr.picnum;
switchpal = act->spr.pal;
}
@ -369,8 +368,7 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
lotag = wwal->lotag;
if (lotag == 0) return 0;
hitag = wwal->hitag;
sx = wwal->wall_int_pos().X;
sy = wwal->wall_int_pos().Y;
pos = wwal->pos;
picnum = wwal->picnum;
switchpal = wwal->pal;
}
@ -681,7 +679,7 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
setnextmap(false);
}
vec3_t v = { sx, sy, ps[snum].player_int_pos().Z };
DVector3 v(pos, ps[snum].pos.Z);
switch (picnum)
{
default:

View file

@ -41,6 +41,12 @@ void S_WorldTourMappingsForOldSounds();
int S_PlaySound(int num, int channel = CHAN_AUTO, EChanFlags flags = 0, float vol =0.8f);
int S_PlaySound3D(int num, DDukeActor* spriteNum, const vec3_t& pos, int channel = CHAN_AUTO, EChanFlags flags = 0);
inline int S_PlaySound3D(int num, DDukeActor* spriteNum, const DVector3& pos, int channel = CHAN_AUTO, EChanFlags flags = 0)
{
vec3_t v( pos.X * worldtoint, pos.Y * worldtoint, pos.Z * zworldtoint);
return S_PlaySound3D(num, spriteNum, v, channel, flags);
}
int S_PlayActorSound(int soundNum, DDukeActor* spriteNum, int channel = CHAN_AUTO, EChanFlags flags = 0);
void S_MenuSound(void);