mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-30 13:21:04 +00:00
- calculate proper distances in the sound code.
The original code didn't factor in that z has a different scale than x and y and use a function with severe precision issues. Fixes #81
This commit is contained in:
parent
e211c7c91f
commit
d0909b8224
1 changed files with 4 additions and 3 deletions
|
@ -197,9 +197,12 @@ static int GetPositionInfo(int spriteNum, int soundNum, int sectNum,
|
|||
int userflags = snd ? snd[kFlags] : 0;
|
||||
int dist_adjust = snd ? snd[kVolAdjust] : 0;
|
||||
|
||||
FVector3 sndorg = GetSoundPos(pos);
|
||||
FVector3 campos = GetSoundPos(cam);
|
||||
|
||||
if (sp->picnum != TILE_APLAYER || sp->yvel != screenpeek)
|
||||
{
|
||||
orgsndist = sndist = FindDistance3D(cam->x - pos->x, cam->y - pos->y, (cam->z - pos->z));
|
||||
orgsndist = sndist = int(16 * (sndorg - campos).Length());
|
||||
|
||||
if ((userflags & (SF_GLOBAL | SF_DTAG)) != SF_GLOBAL && sp->picnum == MUSICANDSFX && sp->lotag < 999 && (sector[sp->sectnum].lotag & 0xff) < ST_9_SLIDING_ST_DOOR)
|
||||
sndist = divscale14(sndist, sp->hitag + 1);
|
||||
|
@ -223,8 +226,6 @@ static int GetPositionInfo(int spriteNum, int soundNum, int sectNum,
|
|||
|
||||
if (sndPos)
|
||||
{
|
||||
FVector3 sndorg = GetSoundPos(pos);
|
||||
FVector3 campos = GetSoundPos(cam);
|
||||
// Now calculate the virtual position in sound system coordinates.
|
||||
FVector3 sndvec = sndorg - campos;
|
||||
if (orgsndist > 0)
|
||||
|
|
Loading…
Reference in a new issue