Fix playing ambient sounds at max volume for split sec on entering their range.

This is done by always calling FX_PlayAuto3D() to play such sounds. It now
additionally takes a third argument 'loophow', permissible values being
FX_ONESHOT and FX_LOOP.

git-svn-id: https://svn.eduke32.com/eduke32@3631 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-03-31 18:58:17 +00:00
parent cbfd2eb438
commit a6a4e30bbc
12 changed files with 81 additions and 48 deletions

View file

@ -1284,6 +1284,7 @@ ACTOR_STATIC void G_MoveFX(void)
int32_t j; int32_t j;
for (SPRITES_OF(STAT_FX, j)) for (SPRITES_OF(STAT_FX, j))
// XXX: PN is sprite[*i*].picnum
if (PN == MUSICANDSFX && j != i && sprite[j].lotag < 999 && if (PN == MUSICANDSFX && j != i && sprite[j].lotag < 999 &&
actor[j].t_data[0] == 1 && actor[j].t_data[0] == 1 &&
dist(&sprite[j], &sprite[peekps->i]) > x) dist(&sprite[j], &sprite[peekps->i]) > x)

View file

@ -49,6 +49,12 @@ enum FX_ERRORS
FX_MultiVocError, FX_MultiVocError,
}; };
enum FX_LOOP_HOW
{
FX_ONESHOT = -1,
FX_LOOP = 0,
};
#define FX_MUSIC_PRIORITY INT_MAX #define FX_MUSIC_PRIORITY INT_MAX
const char *FX_ErrorString( int32_t ErrorNumber ); const char *FX_ErrorString( int32_t ErrorNumber );
@ -93,7 +99,7 @@ int32_t FX_PlayAuto( char *ptr, uint32_t ptrlength, int32_t pitchoffset, int32_t
int32_t FX_PlayLoopedAuto( char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend, int32_t FX_PlayLoopedAuto( char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend,
int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority,
uint32_t callbackval ); uint32_t callbackval );
int32_t FX_PlayAuto3D( char *ptr, uint32_t ptrlength, int32_t pitchoffset, int32_t angle, int32_t distance, int32_t FX_PlayAuto3D( char *ptr, uint32_t ptrlength, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance,
int32_t priority, uint32_t callbackval ); int32_t priority, uint32_t callbackval );
int32_t FX_PlayRaw( char *ptr, uint32_t length, unsigned rate, int32_t FX_PlayRaw( char *ptr, uint32_t length, unsigned rate,

View file

@ -355,6 +355,7 @@ int32_t MV_PlayFLAC3D
( (
char *ptr, char *ptr,
uint32_t ptrlength, uint32_t ptrlength,
int32_t loophow,
int32_t pitchoffset, int32_t pitchoffset,
int32_t angle, int32_t angle,
int32_t distance, int32_t distance,
@ -390,7 +391,7 @@ int32_t MV_PlayFLAC3D
right = MV_PanTable[ angle ][ volume ].right; right = MV_PanTable[ angle ][ volume ].right;
mid = max( 0, 255 - distance ); mid = max( 0, 255 - distance );
status = MV_PlayFLAC(ptr, ptrlength, pitchoffset, -1, -1, mid, left, right, priority, callbackval); status = MV_PlayFLAC(ptr, ptrlength, pitchoffset, loophow, -1, mid, left, right, priority, callbackval);
return status; return status;
} }

View file

@ -491,6 +491,7 @@ int32_t MV_PlayWAV3D
( (
char *ptr, char *ptr,
uint32_t length, uint32_t length,
int32_t loophow,
int32_t pitchoffset, int32_t pitchoffset,
int32_t angle, int32_t angle,
int32_t distance, int32_t distance,
@ -526,7 +527,7 @@ int32_t MV_PlayWAV3D
right = MV_PanTable[ angle ][ volume ].right; right = MV_PanTable[ angle ][ volume ].right;
mid = max(0, 255 - distance); mid = max(0, 255 - distance);
status = MV_PlayWAV(ptr, length, -1, -1, pitchoffset, mid, left, right, priority, callbackval); status = MV_PlayWAV(ptr, length, loophow, -1, pitchoffset, mid, left, right, priority, callbackval);
return status; return status;
} }
@ -677,6 +678,7 @@ int32_t MV_PlayVOC3D
( (
char *ptr, char *ptr,
uint32_t ptrlength, uint32_t ptrlength,
int32_t loophow,
int32_t pitchoffset, int32_t pitchoffset,
int32_t angle, int32_t angle,
int32_t distance, int32_t distance,
@ -712,7 +714,7 @@ int32_t MV_PlayVOC3D
right = MV_PanTable[ angle ][ volume ].right; right = MV_PanTable[ angle ][ volume ].right;
mid = max(0, 255 - distance); mid = max(0, 255 - distance);
status = MV_PlayVOC(ptr, ptrlength, -1, -1, pitchoffset, mid, left, right, priority, callbackval); status = MV_PlayVOC(ptr, ptrlength, loophow, -1, pitchoffset, mid, left, right, priority, callbackval);
return status; return status;
} }

View file

@ -644,7 +644,7 @@ int32_t FX_PlayVOC3D
{ {
int32_t handle; int32_t handle;
handle = MV_PlayVOC3D(ptr, ptrlength, pitchoffset, angle, distance, handle = MV_PlayVOC3D(ptr, ptrlength, FX_ONESHOT, pitchoffset, angle, distance,
priority, callbackval); priority, callbackval);
if (handle < MV_Ok) if (handle < MV_Ok)
{ {
@ -677,7 +677,7 @@ int32_t FX_PlayWAV3D
{ {
int32_t handle; int32_t handle;
handle = MV_PlayWAV3D(ptr, ptrlength, pitchoffset, angle, distance, handle = MV_PlayWAV3D(ptr, ptrlength, FX_ONESHOT, pitchoffset, angle, distance,
priority, callbackval); priority, callbackval);
if (handle < MV_Ok) if (handle < MV_Ok)
{ {
@ -966,8 +966,9 @@ int32_t FX_PlayLoopedAuto(char *ptr, uint32_t length, int32_t loopstart, int32_t
Function: FX_PlayAuto3D Function: FX_PlayAuto3D
Play a positioned sound, autodetecting the format. Play a positioned sound, autodetecting the format.
<loophow>: one of FX_LOOP or FX_ONESHOT.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int32_t FX_PlayAuto3D(char *ptr, uint32_t length, int32_t pitchoffset, int32_t angle, int32_t FX_PlayAuto3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle,
int32_t distance, int32_t priority, uint32_t callbackval) int32_t distance, int32_t priority, uint32_t callbackval)
{ {
int32_t handle = -1; int32_t handle = -1;
@ -975,21 +976,21 @@ int32_t FX_PlayAuto3D(char *ptr, uint32_t length, int32_t pitchoffset, int32_t a
switch (FX_AutoDetectFormat(ptr)) switch (FX_AutoDetectFormat(ptr))
{ {
case VOC: case VOC:
handle = MV_PlayVOC3D(ptr, length, pitchoffset, angle, distance, priority, callbackval); handle = MV_PlayVOC3D(ptr, length, loophow, pitchoffset, angle, distance, priority, callbackval);
break; break;
case WAV: case WAV:
handle = MV_PlayWAV3D(ptr, length, pitchoffset, angle, distance, priority, callbackval); handle = MV_PlayWAV3D(ptr, length, loophow, pitchoffset, angle, distance, priority, callbackval);
break; break;
case Vorbis: case Vorbis:
#ifdef HAVE_VORBIS #ifdef HAVE_VORBIS
handle = MV_PlayVorbis3D(ptr, length, pitchoffset, angle, distance, priority, callbackval); handle = MV_PlayVorbis3D(ptr, length, loophow, pitchoffset, angle, distance, priority, callbackval);
#else #else
MV_Printf("FX_PlayAuto3D: OggVorbis support not included in this binary.\n"); MV_Printf("FX_PlayAuto3D: OggVorbis support not included in this binary.\n");
#endif #endif
break; break;
case FLAC: case FLAC:
#ifdef HAVE_FLAC #ifdef HAVE_FLAC
handle = MV_PlayFLAC3D(ptr, length, pitchoffset, angle, distance, priority, callbackval); handle = MV_PlayFLAC3D(ptr, length, loophow, pitchoffset, angle, distance, priority, callbackval);
#else #else
MV_Printf("FX_PlayAuto3D: FLAC support not included in this binary.\n"); MV_Printf("FX_PlayAuto3D: FLAC support not included in this binary.\n");
#endif #endif

View file

@ -139,22 +139,22 @@ int32_t MV_PlayRaw( char *ptr, uint32_t length,
char *loopstart, char *loopend, unsigned rate, int32_t pitchoffset, char *loopstart, char *loopend, unsigned rate, int32_t pitchoffset,
int32_t vol, int32_t left, int32_t right, int32_t priority, int32_t vol, int32_t left, int32_t right, int32_t priority,
uint32_t callbackval ); uint32_t callbackval );
int32_t MV_PlayWAV3D( char *ptr, uint32_t length, int32_t pitchoffset, int32_t angle, int32_t distance, int32_t MV_PlayWAV3D( char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance,
int32_t priority, uint32_t callbackval ); int32_t priority, uint32_t callbackval );
int32_t MV_PlayWAV( char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t MV_PlayWAV( char *ptr, uint32_t length, int32_t loopstart, int32_t loopend,
int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority,
uint32_t callbackval ); uint32_t callbackval );
int32_t MV_PlayVOC3D( char *ptr, uint32_t length, int32_t pitchoffset, int32_t angle, int32_t distance, int32_t MV_PlayVOC3D( char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance,
int32_t priority, uint32_t callbackval ); int32_t priority, uint32_t callbackval );
int32_t MV_PlayVOC( char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t MV_PlayVOC( char *ptr, uint32_t length, int32_t loopstart, int32_t loopend,
int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority,
uint32_t callbackval ); uint32_t callbackval );
int32_t MV_PlayVorbis3D( char *ptr, uint32_t length, int32_t pitchoffset, int32_t angle, int32_t distance, int32_t MV_PlayVorbis3D( char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance,
int32_t priority, uint32_t callbackval ); int32_t priority, uint32_t callbackval );
int32_t MV_PlayVorbis( char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t MV_PlayVorbis( char *ptr, uint32_t length, int32_t loopstart, int32_t loopend,
int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority,
uint32_t callbackval ); uint32_t callbackval );
int32_t MV_PlayFLAC3D( char *ptr, uint32_t length, int32_t pitchoffset, int32_t angle, int32_t distance, int32_t MV_PlayFLAC3D( char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance,
int32_t priority, uint32_t callbackval ); int32_t priority, uint32_t callbackval );
int32_t MV_PlayFLAC( char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t MV_PlayFLAC( char *ptr, uint32_t length, int32_t loopstart, int32_t loopend,
int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority,

View file

@ -315,6 +315,7 @@ int32_t MV_PlayVorbis3D
( (
char *ptr, char *ptr,
uint32_t ptrlength, uint32_t ptrlength,
int32_t loophow,
int32_t pitchoffset, int32_t pitchoffset,
int32_t angle, int32_t angle,
int32_t distance, int32_t distance,
@ -350,7 +351,7 @@ int32_t MV_PlayVorbis3D
right = MV_PanTable[ angle ][ volume ].right; right = MV_PanTable[ angle ][ volume ].right;
mid = max( 0, 255 - distance ); mid = max( 0, 255 - distance );
status = MV_PlayVorbis(ptr, ptrlength, -1, -1, pitchoffset, mid, left, right, priority, callbackval); status = MV_PlayVorbis(ptr, ptrlength, loophow, -1, pitchoffset, mid, left, right, priority, callbackval);
return status; return status;
} }

View file

@ -685,7 +685,7 @@ void Net_ParsePacketCommon(uint8_t *pbuf, int32_t packbufleng, int32_t serverpac
if (ud.config.SoundToggle == 0 || ud.lockout == 1 || ud.config.FXDevice < 0 || !(ud.config.VoiceToggle & 4)) if (ud.config.SoundToggle == 0 || ud.lockout == 1 || ud.config.FXDevice < 0 || !(ud.config.VoiceToggle & 4))
break; break;
FX_PlayAuto3D((char *)RTS_GetSound(pbuf[1]-1),RTS_SoundLength(pbuf[1]-1),0,0,0,255,-pbuf[1]); FX_PlayAuto3D((char *)RTS_GetSound(pbuf[1]-1),RTS_SoundLength(pbuf[1]-1),FX_ONESHOT,0,0,0,255,-pbuf[1]);
g_RTSPlaying = 7; g_RTSPlaying = 7;
break; break;

View file

@ -46,7 +46,7 @@ int32_t A_CallSound(int32_t sn,int32_t whatsprite)
for (SPRITES_OF_SECT(sn, i)) for (SPRITES_OF_SECT(sn, i))
{ {
if (PN == MUSICANDSFX && (unsigned)SLT < 1000) if (PN == MUSICANDSFX && (unsigned)SLT < 1000) // XXX: in other places, 999
{ {
if (whatsprite == -1) whatsprite = i; if (whatsprite == -1) whatsprite = i;

View file

@ -267,9 +267,11 @@ int32_t S_PlayMusic(const char *fn, const int32_t sel)
} }
else else
{ {
if ((MusicVoice = FX_PlayLoopedAuto(MusicPtr, MusicLen, 0, 0, 0, ud.config.MusicVolume, int32_t mvol = ud.config.MusicVolume;
ud.config.MusicVolume, ud.config.MusicVolume, MusicVoice = FX_PlayLoopedAuto(MusicPtr, MusicLen, 0, 0,
FX_MUSIC_PRIORITY, MUSIC_ID)) > FX_Ok) 0, mvol, mvol, mvol,
FX_MUSIC_PRIORITY, MUSIC_ID);
if (MusicVoice > FX_Ok)
MusicIsWaveform = 1; MusicIsWaveform = 1;
} }
return (alt != 0); return (alt != 0);
@ -351,7 +353,7 @@ void S_Cleanup(void)
// MUSICANDSFX uses t_data[0] to control restarting the sound // MUSICANDSFX uses t_data[0] to control restarting the sound
// ST_2_UNDERWATER // ST_2_UNDERWATER
if (i != -1 && sprite[i].picnum == MUSICANDSFX && sector[sprite[i].sectnum].lotag < 3 && sprite[i].lotag < 999) if (i != -1 && S_IsAmbientSFX(i) && sector[sprite[i].sectnum].lotag < 3)
actor[i].t_data[0] = 0; actor[i].t_data[0] = 0;
g_sounds[num].SoundOwner[j].ow = -1; g_sounds[num].SoundOwner[j].ow = -1;
@ -509,7 +511,7 @@ static int32_t S_CalcDistAndAng(int32_t i, int32_t num, int32_t camsect, int32_t
} }
} }
if ((g_sounds[num].m&16) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9) // ST_9_SLIDING_ST_DOOR if ((g_sounds[num].m&16) == 0 && S_IsAmbientSFX(i) && (sector[SECT].lotag&0xff) < 9) // ST_9_SLIDING_ST_DOOR
sndist = divscale14(sndist, SHT+1); sndist = divscale14(sndist, SHT+1);
sound_further_processing: sound_further_processing:
@ -544,7 +546,6 @@ sound_further_processing:
int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos) int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
{ {
int32_t j = 0; int32_t j = 0;
int32_t cs, ca;
int32_t sndist, sndang, explosionp; int32_t sndist, sndang, explosionp;
int32_t voice, pitch; int32_t voice, pitch;
@ -558,11 +559,12 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
ud.config.FXDevice < 0 || ud.config.FXDevice < 0 ||
((g_sounds[num].m&8) && ud.lockout) || ((g_sounds[num].m&8) && ud.lockout) ||
ud.config.SoundToggle == 0 || ud.config.SoundToggle == 0 ||
/* g_sounds[num].num >= MAXSOUNDINSTANCES ||*/ // g_sounds[num].num >= MAXSOUNDINSTANCES ||
(unsigned)i >= MAXSPRITES || (unsigned)i >= MAXSPRITES ||
FX_VoiceAvailable(g_sounds[num].pr) == 0 || FX_VoiceAvailable(g_sounds[num].pr) == 0 ||
(myps->timebeforeexit > 0 && myps->timebeforeexit <= GAMETICSPERSEC*3) || (myps->timebeforeexit > 0 && myps->timebeforeexit <= GAMETICSPERSEC*3) ||
(myps->gm&MODE_MENU)) return -1; (myps->gm&MODE_MENU))
return -1;
if (g_sounds[num].m&128) // Duke-Tag sound if (g_sounds[num].m&128) // Duke-Tag sound
{ {
@ -600,10 +602,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
return -1; return -1;
} }
cs = CAMERA(sect); explosionp = S_CalcDistAndAng(i, num, CAMERA(sect), CAMERA(ang), &CAMERA(pos), pos, &sndist, &sndang);
ca = CAMERA(ang);
explosionp = S_CalcDistAndAng(i, num, cs, ca, &CAMERA(pos), pos, &sndist, &sndang);
pitch = S_GetPitch(num); pitch = S_GetPitch(num);
peekps = g_player[screenpeek].ps; peekps = g_player[screenpeek].ps;
@ -655,21 +654,30 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
return -1; return -1;
} }
if (g_sounds[num].m&1)
{ {
if ((g_sounds[num].m&32) && g_sounds[num].num > 0) const int32_t repeatp = (g_sounds[num].m&1);
const int32_t ambsfxp = S_IsAmbientSFX(i);
if (repeatp && (g_sounds[num].m&32) && g_sounds[num].num > 0)
{ {
g_soundlocks[num]--; g_soundlocks[num]--;
return -1; return -1;
} }
voice = FX_PlayLoopedAuto(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1, if (repeatp && !ambsfxp)
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,(num * MAXSOUNDINSTANCES) + j); {
} voice = FX_PlayLoopedAuto(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1,
else pitch, sndist>>6, sndist>>6, 0, // XXX: why is 'right' 0?
{ g_sounds[num].pr, (num * MAXSOUNDINSTANCES) + j);
voice = FX_PlayAuto3D(g_sounds[ num ].ptr, g_sounds[num].soundsiz, pitch,sndang>>4,sndist>>6, g_sounds[num].pr, }
(num * MAXSOUNDINSTANCES) + j); else
{
// Ambient MUSICANDSFX always start playing using the 3D routines!
voice = FX_PlayAuto3D(g_sounds[num].ptr, g_sounds[num].soundsiz,
ambsfxp ? FX_LOOP : FX_ONESHOT,
pitch, sndang>>4, sndist>>6,
g_sounds[num].pr, (num * MAXSOUNDINSTANCES) + j);
}
} }
if (voice <= FX_Ok) if (voice <= FX_Ok)
@ -683,6 +691,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
g_sounds[num].SoundOwner[j].voice = voice; g_sounds[num].SoundOwner[j].voice = voice;
g_sounds[num].SoundOwner[j].sndist = sndist>>6; g_sounds[num].SoundOwner[j].sndist = sndist>>6;
g_sounds[num].SoundOwner[j].clock = totalclock; g_sounds[num].SoundOwner[j].clock = totalclock;
return voice; return voice;
} }
@ -729,10 +738,14 @@ int32_t S_PlaySound(int32_t num)
return -1; return -1;
} }
voice = (g_sounds[num].m&1) ? if (g_sounds[num].m&1)
FX_PlayLoopedAuto(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1, voice = FX_PlayLoopedAuto(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1,
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].soundsiz, (num * MAXSOUNDINSTANCES) + j) : pitch, LOUDESTVOLUME, LOUDESTVOLUME, LOUDESTVOLUME,
FX_PlayAuto3D(g_sounds[ num ].ptr, g_sounds[num].soundsiz, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, (num * MAXSOUNDINSTANCES) + j); g_sounds[num].soundsiz, (num * MAXSOUNDINSTANCES) + j);
else
voice = FX_PlayAuto3D(g_sounds[num].ptr, g_sounds[num].soundsiz, FX_ONESHOT,
pitch, 0, 255-LOUDESTVOLUME,
g_sounds[num].pr, (num * MAXSOUNDINSTANCES) + j);
if (voice <= FX_Ok) if (voice <= FX_Ok)
{ {
@ -864,9 +877,10 @@ void S_Update(void)
S_CalcDistAndAng(i, num, cs, ca, c, (const vec3_t *)&sprite[i], &sndist, &sndang); S_CalcDistAndAng(i, num, cs, ca, c, (const vec3_t *)&sprite[i], &sndist, &sndang);
if (PN == MUSICANDSFX && SLT < 999) if (S_IsAmbientSFX(i))
g_numEnvSoundsPlaying++; g_numEnvSoundsPlaying++;
// AMBIENT_SOUND
FX_Pan3D(g_sounds[num].SoundOwner[k].voice, sndang>>4, sndist>>6); FX_Pan3D(g_sounds[num].SoundOwner[k].voice, sndang>>4, sndist>>6);
g_sounds[num].SoundOwner[k].sndist = sndist>>6; g_sounds[num].SoundOwner[k].sndist = sndist>>6;
} }

View file

@ -95,4 +95,9 @@ void S_StopMusic(void);
void S_Update(void); void S_Update(void);
void S_ChangeSoundPitch(int32_t num, int32_t i, int32_t pitchoffset); void S_ChangeSoundPitch(int32_t num, int32_t i, int32_t pitchoffset);
static inline int32_t S_IsAmbientSFX(int32_t i)
{
return (sprite[i].picnum==MUSICANDSFX && sprite[i].lotag < 999);
}
#endif #endif

View file

@ -259,14 +259,16 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
if (g_sounds[num].m&1) if (g_sounds[num].m&1)
{ {
if (g_sounds[num].num > 0) return -1; if (g_sounds[num].num > 0)
return -1;
voice = FX_PlayLoopedAuto(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1, voice = FX_PlayLoopedAuto(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1,
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num); pitch, sndist>>6, sndist>>6, 0, g_sounds[num].pr, num);
} }
else else
{ {
voice = FX_PlayAuto3D(g_sounds[ num ].ptr, g_sounds[num].soundsiz, pitch,sndang>>4,sndist>>6, g_sounds[num].pr, num); voice = FX_PlayAuto3D(g_sounds[num].ptr, g_sounds[num].soundsiz, FX_ONESHOT,
pitch, sndang>>4, sndist>>6, g_sounds[num].pr, num);
} }
if (voice >= FX_Ok) if (voice >= FX_Ok)
@ -324,7 +326,7 @@ void S_PlaySound(int32_t num)
} }
else else
{ {
voice = FX_PlayAuto3D(g_sounds[num].ptr, g_sounds[num].soundsiz, voice = FX_PlayAuto3D(g_sounds[num].ptr, g_sounds[num].soundsiz, FX_ONESHOT,
pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num); pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
} }