2009-03-15 22:58:20 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
|
|
Copyright (C) 2000, 2003 - Matt Saettler (EDuke Enhancements)
|
|
|
|
Copyright (C) 2004, 2007 - EDuke32 developers
|
|
|
|
|
|
|
|
This file is part of EDuke32
|
|
|
|
|
|
|
|
EDuke32 is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// Stripped sounds.c for use in Mapster32, breaks all ties to game & music
|
|
|
|
|
|
|
|
//#include <conio.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2009-04-26 05:57:42 +00:00
|
|
|
|
2009-07-27 05:33:12 +00:00
|
|
|
#include "compat.h"
|
|
|
|
|
2009-03-15 22:58:20 +00:00
|
|
|
#include "fx_man.h"
|
|
|
|
//#include "music.h"
|
|
|
|
//#include "duke3d.h"
|
2009-07-27 05:33:12 +00:00
|
|
|
#include "util_lib.h"
|
2009-03-15 22:58:20 +00:00
|
|
|
#include "osd.h"
|
|
|
|
|
|
|
|
#include "cache1d.h"
|
|
|
|
#include "macros.h"
|
|
|
|
#include "mathutil.h"
|
|
|
|
#include "build.h" // vec3_t
|
|
|
|
|
|
|
|
#include "sounds_mapster32.h"
|
|
|
|
|
|
|
|
#define LOUDESTVOLUME 150
|
|
|
|
#define MUSICANDSFX 5
|
|
|
|
|
|
|
|
static char SM32_havesound = 0;
|
2009-07-09 02:29:48 +00:00
|
|
|
|
2009-03-17 21:57:30 +00:00
|
|
|
char SoundToggle = 1;
|
|
|
|
int32_t NumVoices = 32;
|
2009-03-15 22:58:20 +00:00
|
|
|
|
|
|
|
int32_t backflag,g_numEnvSoundsPlaying;
|
|
|
|
|
|
|
|
void MUSIC_Update(void) {} // needed when linking
|
|
|
|
|
|
|
|
void S_TestSoundCallback(uint32_t);
|
|
|
|
extern void initprintf(const char *f, ...);
|
|
|
|
|
|
|
|
/*
|
|
|
|
===================
|
|
|
|
=
|
|
|
|
= SoundStartup
|
|
|
|
=
|
|
|
|
===================
|
|
|
|
*/
|
|
|
|
|
2009-07-27 05:33:12 +00:00
|
|
|
|
2009-03-15 22:58:20 +00:00
|
|
|
int32_t S_SoundStartup(void)
|
|
|
|
{
|
2009-07-27 05:33:12 +00:00
|
|
|
int32_t status;
|
|
|
|
int32_t fxdevicetype;
|
|
|
|
void * initdata = 0;
|
2009-03-15 22:58:20 +00:00
|
|
|
|
|
|
|
// TODO: read config
|
2009-03-17 21:57:30 +00:00
|
|
|
int32_t FXVolume=220, /*NumVoices=32,*/ NumChannels=2, NumBits=16, MixRate, ReverseStereo=0;
|
2009-03-15 22:58:20 +00:00
|
|
|
#if defined(_WIN32)
|
|
|
|
MixRate = 44100;
|
|
|
|
#else
|
|
|
|
MixRate = 48000;
|
|
|
|
#endif
|
2009-07-27 05:33:12 +00:00
|
|
|
fxdevicetype = ASS_AutoDetect;
|
2009-03-15 22:58:20 +00:00
|
|
|
|
2009-07-27 05:33:12 +00:00
|
|
|
#ifdef WIN32
|
|
|
|
initdata = (void *) win_gethwnd();
|
|
|
|
#endif
|
2009-03-15 22:58:20 +00:00
|
|
|
|
2009-07-27 05:33:12 +00:00
|
|
|
status = FX_Init(fxdevicetype, NumVoices, NumChannels, NumBits, MixRate, initdata);
|
2009-03-15 22:58:20 +00:00
|
|
|
if (status == FX_Ok)
|
|
|
|
{
|
|
|
|
FX_SetVolume(FXVolume);
|
2009-07-27 05:33:12 +00:00
|
|
|
FX_SetReverseStereo(ReverseStereo);
|
2009-03-15 22:58:20 +00:00
|
|
|
status = FX_SetCallBack(S_TestSoundCallback);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (status != FX_Ok)
|
|
|
|
{
|
|
|
|
initprintf("Sound startup error: %s", FX_ErrorString(FX_Error));
|
|
|
|
return -2;
|
|
|
|
}
|
|
|
|
|
|
|
|
SM32_havesound = 1;
|
2009-07-27 05:33:12 +00:00
|
|
|
|
2009-03-15 22:58:20 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
===================
|
|
|
|
=
|
|
|
|
= SoundShutdown
|
|
|
|
=
|
|
|
|
===================
|
|
|
|
*/
|
|
|
|
|
|
|
|
void S_SoundShutdown(void)
|
|
|
|
{
|
|
|
|
int32_t status;
|
|
|
|
|
|
|
|
if (!SM32_havesound)
|
|
|
|
return;
|
|
|
|
|
|
|
|
status = FX_Shutdown();
|
|
|
|
if (status != FX_Ok)
|
|
|
|
initprintf("Sound shutdown error: %s", FX_ErrorString(FX_Error));
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t S_LoadSound(uint32_t num)
|
|
|
|
{
|
|
|
|
int32_t fp = -1, l;
|
|
|
|
|
|
|
|
if (!SM32_havesound) return 0;
|
|
|
|
if (num >= MAXSOUNDS || SoundToggle == 0) return 0;
|
|
|
|
|
|
|
|
if (g_sounds[num].filename == NULL)
|
|
|
|
{
|
|
|
|
OSD_Printf(OSD_ERROR "Sound (#%d) not defined!\n",num);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g_sounds[num].filename1) fp = kopen4load(g_sounds[num].filename1,pathsearchmode);
|
|
|
|
if (fp == -1) fp = kopen4load(g_sounds[num].filename,pathsearchmode);
|
|
|
|
if (fp == -1)
|
|
|
|
{
|
|
|
|
OSD_Printf(OSDTEXT_RED "Sound %s(#%d) not found!\n",g_sounds[num].filename,num);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
l = kfilelength(fp);
|
|
|
|
g_sounds[num].soundsiz = l;
|
|
|
|
|
|
|
|
g_sounds[num].lock = 200;
|
|
|
|
|
|
|
|
allocache((intptr_t *)&g_sounds[num].ptr,l,(char *)&g_sounds[num].lock);
|
|
|
|
kread(fp, g_sounds[num].ptr , l);
|
|
|
|
kclose(fp);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern vec3_t pos;
|
|
|
|
extern int16_t ang, cursectnum;
|
|
|
|
|
2009-08-06 10:12:13 +00:00
|
|
|
int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
|
2009-03-15 22:58:20 +00:00
|
|
|
{
|
2009-03-17 21:57:30 +00:00
|
|
|
int32_t sndist, cx, cy, cz, j/*,k*/;
|
2009-03-15 22:58:20 +00:00
|
|
|
int32_t pitche,pitchs,cs;
|
|
|
|
int32_t voice, sndang, ca, pitch;
|
|
|
|
|
|
|
|
// if(num != 358) return 0;
|
|
|
|
|
|
|
|
if (num >= MAXSOUNDS ||
|
2009-04-13 06:53:03 +00:00
|
|
|
!SM32_havesound ||
|
2009-03-15 22:58:20 +00:00
|
|
|
// ((g_sounds[num].m&8) && ud.lockout) ||
|
2009-04-13 06:53:03 +00:00
|
|
|
SoundToggle == 0 ||
|
|
|
|
g_sounds[num].num > 3 ||
|
|
|
|
FX_VoiceAvailable(g_sounds[num].pr) == 0)
|
|
|
|
return -1;
|
2009-03-15 22:58:20 +00:00
|
|
|
|
|
|
|
if (g_sounds[num].m&128)
|
|
|
|
{
|
|
|
|
S_PlaySound(num);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g_sounds[num].m&4)
|
|
|
|
{
|
|
|
|
for (j=0; j<MAXSOUNDS; j++)
|
|
|
|
// for (k=0; k<g_sounds[j].num; k++)
|
2009-04-13 06:53:03 +00:00
|
|
|
if ((g_sounds[j].num > 0) && (g_sounds[j].m&4))
|
|
|
|
return -1;
|
2009-03-15 22:58:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cx = pos->x;
|
|
|
|
cy = pos->y;
|
|
|
|
cz = pos->z;
|
|
|
|
cs = cursectnum;
|
|
|
|
ca = ang;
|
|
|
|
|
|
|
|
sndist = FindDistance3D((cx-pos->x),(cy-pos->y),(cz-pos->z)>>4);
|
|
|
|
|
|
|
|
if (i >= 0 && (g_sounds[num].m&16) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9)
|
|
|
|
sndist = divscale14(sndist,(SHT+1));
|
|
|
|
|
|
|
|
pitchs = g_sounds[num].ps;
|
|
|
|
pitche = g_sounds[num].pe;
|
|
|
|
cx = klabs(pitche-pitchs);
|
|
|
|
|
|
|
|
if (cx)
|
|
|
|
{
|
|
|
|
if (pitchs < pitche)
|
|
|
|
pitch = pitchs + (rand()%cx);
|
|
|
|
else pitch = pitche + (rand()%cx);
|
|
|
|
}
|
|
|
|
else pitch = pitchs;
|
|
|
|
|
|
|
|
sndist += g_sounds[num].vo;
|
|
|
|
if (sndist < 0) sndist = 0;
|
|
|
|
if (cs > -1 && sndist && PN != MUSICANDSFX && !cansee(cx,cy,cz-(24<<8),cs,SX,SY,SZ-(24<<8),SECT))
|
|
|
|
sndist += sndist>>5;
|
2009-04-13 06:53:03 +00:00
|
|
|
/*
|
|
|
|
switch (num)
|
|
|
|
{
|
|
|
|
case PIPEBOMB_EXPLODE:
|
|
|
|
case LASERTRIP_EXPLODE:
|
|
|
|
case RPG_EXPLODE:
|
|
|
|
if (sndist > (6144))
|
|
|
|
sndist = 6144;
|
|
|
|
if (g_player[screenpeek].ps->cursectnum > -1 && sector[g_player[screenpeek].ps->cursectnum].lotag == 2)
|
|
|
|
pitch -= 1024;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
*/
|
|
|
|
if (cursectnum > -1 && sector[cursectnum].lotag == 2 && (g_sounds[num].m&4) == 0)
|
|
|
|
pitch = -768;
|
|
|
|
if (sndist > 31444 && PN != MUSICANDSFX)
|
|
|
|
return -1;
|
2009-03-15 22:58:20 +00:00
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
|
|
|
|
if (g_sounds[num].num > 0 && PN != MUSICANDSFX)
|
|
|
|
{
|
|
|
|
if (g_sounds[num].SoundOwner[0].i == i) S_StopSound(num);
|
|
|
|
else if (g_sounds[num].num > 1) S_StopSound(num);
|
|
|
|
// else if (A_CheckEnemySprite(&sprite[i]) && sprite[i].extra <= 0) S_StopSound(num);
|
|
|
|
}
|
|
|
|
|
|
|
|
sndang = 2048 + ca - getangle(cx-pos->x,cy-pos->y);
|
|
|
|
sndang &= 2047;
|
|
|
|
|
|
|
|
if (g_sounds[num].ptr == 0)
|
|
|
|
{
|
|
|
|
if (S_LoadSound(num) == 0) return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (g_sounds[num].lock < 200)
|
|
|
|
g_sounds[num].lock = 200;
|
|
|
|
else g_sounds[num].lock++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g_sounds[num].m&16) sndist = 0;
|
|
|
|
|
|
|
|
if (sndist < ((255-LOUDESTVOLUME)<<6))
|
|
|
|
sndist = ((255-LOUDESTVOLUME)<<6);
|
|
|
|
|
|
|
|
if (g_sounds[num].m&1)
|
|
|
|
{
|
|
|
|
if (g_sounds[num].num > 0) return -1;
|
|
|
|
|
2009-07-27 05:33:12 +00:00
|
|
|
voice = FX_PlayLoopedAuto(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1,
|
|
|
|
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num);
|
2009-03-15 22:58:20 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-07-27 05:33:12 +00:00
|
|
|
voice = FX_PlayAuto3D(g_sounds[ num ].ptr, g_sounds[num].soundsiz, pitch,sndang>>4,sndist>>6, g_sounds[num].pr, num);
|
2009-03-15 22:58:20 +00:00
|
|
|
}
|
|
|
|
|
2009-07-24 02:31:34 +00:00
|
|
|
if (voice >= FX_Ok)
|
2009-03-15 22:58:20 +00:00
|
|
|
{
|
|
|
|
g_sounds[num].SoundOwner[g_sounds[num].num].i = i;
|
|
|
|
g_sounds[num].SoundOwner[g_sounds[num].num].voice = voice;
|
|
|
|
g_sounds[num].num++;
|
|
|
|
}
|
|
|
|
else g_sounds[num].lock--;
|
|
|
|
return (voice);
|
|
|
|
}
|
|
|
|
|
|
|
|
void S_PlaySound(int32_t num)
|
|
|
|
{
|
|
|
|
int32_t pitch,pitche,pitchs,cx;
|
|
|
|
int32_t voice;
|
|
|
|
|
|
|
|
if (!SM32_havesound) return;
|
|
|
|
if (SoundToggle==0) return;
|
|
|
|
// if ((g_sounds[num].m&8) && ud.lockout) return;
|
|
|
|
if (FX_VoiceAvailable(g_sounds[num].pr) == 0) return;
|
|
|
|
if (num < 0 || num > MAXSOUNDS-1 || !g_sounds[num].filename)
|
|
|
|
{
|
|
|
|
OSD_Printf("WARNING: invalid sound #%d\n",num);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
pitchs = g_sounds[num].ps;
|
|
|
|
pitche = g_sounds[num].pe;
|
|
|
|
cx = klabs(pitche-pitchs);
|
|
|
|
|
|
|
|
if (cx)
|
|
|
|
{
|
|
|
|
if (pitchs < pitche)
|
|
|
|
pitch = pitchs + (rand()%cx);
|
|
|
|
else pitch = pitche + (rand()%cx);
|
|
|
|
}
|
|
|
|
else pitch = pitchs;
|
|
|
|
|
|
|
|
if (g_sounds[num].ptr == 0)
|
|
|
|
{
|
|
|
|
if (S_LoadSound(num) == 0) return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (g_sounds[num].lock < 200)
|
|
|
|
g_sounds[num].lock = 200;
|
|
|
|
else g_sounds[num].lock++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g_sounds[num].m&1)
|
|
|
|
{
|
2009-07-27 05:33:12 +00:00
|
|
|
voice = FX_PlayLoopedAuto(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1,
|
|
|
|
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].soundsiz,num);
|
2009-03-15 22:58:20 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-07-27 05:33:12 +00:00
|
|
|
voice = FX_PlayAuto3D(g_sounds[ num ].ptr, g_sounds[num].soundsiz, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
|
2009-03-15 22:58:20 +00:00
|
|
|
}
|
|
|
|
|
2009-07-24 02:31:34 +00:00
|
|
|
if (voice >= FX_Ok)// return;
|
2009-03-15 22:58:20 +00:00
|
|
|
{
|
|
|
|
g_sounds[num].SoundOwner[g_sounds[num].num].voice = voice;
|
|
|
|
g_sounds[num].num++;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
g_sounds[num].lock--;
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t A_PlaySound(uint32_t num, int32_t i)
|
|
|
|
{
|
|
|
|
if (num >= MAXSOUNDS) return -1;
|
|
|
|
if (i < 0)
|
|
|
|
{
|
|
|
|
S_PlaySound(num);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-08-06 10:12:13 +00:00
|
|
|
return S_PlaySound3D(num,i, (vec3_t *)&sprite[i]);
|
2009-03-15 22:58:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void S_StopSound(int32_t num)
|
|
|
|
{
|
|
|
|
if (num >= 0 && num < MAXSOUNDS)
|
|
|
|
if (g_sounds[num].num > 0)
|
|
|
|
{
|
|
|
|
FX_StopSound(g_sounds[num].SoundOwner[g_sounds[num].num-1].voice);
|
|
|
|
S_TestSoundCallback(num);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void S_StopEnvSound(int32_t num,int32_t i)
|
|
|
|
{
|
|
|
|
int32_t j, k;
|
|
|
|
|
|
|
|
if (num >= 0 && num < MAXSOUNDS)
|
|
|
|
if (g_sounds[num].num > 0)
|
|
|
|
{
|
|
|
|
k = g_sounds[num].num;
|
|
|
|
for (j=0; j<k; j++)
|
|
|
|
if (g_sounds[num].SoundOwner[j].i == i)
|
|
|
|
{
|
|
|
|
FX_StopSound(g_sounds[num].SoundOwner[j].voice);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void S_Pan3D(void)
|
|
|
|
{
|
|
|
|
int32_t sndist, sx, sy, sz, cx, cy, cz;
|
|
|
|
int32_t sndang,ca,j,k,i,cs;
|
|
|
|
|
|
|
|
g_numEnvSoundsPlaying = 0;
|
|
|
|
|
|
|
|
cx = pos.x;
|
|
|
|
cy = pos.y;
|
|
|
|
cz = pos.z;
|
|
|
|
cs = cursectnum;
|
|
|
|
ca = ang;
|
|
|
|
|
|
|
|
for (j=0; j<MAXSOUNDS; j++)
|
|
|
|
for (k=0; k<g_sounds[j].num; k++)
|
|
|
|
{
|
|
|
|
i = g_sounds[j].SoundOwner[k].i;
|
|
|
|
|
|
|
|
sx = sprite[i].x;
|
|
|
|
sy = sprite[i].y;
|
|
|
|
sz = sprite[i].z;
|
|
|
|
|
|
|
|
sndang = 2048 + ca - getangle(cx-sx,cy-sy);
|
|
|
|
sndang &= 2047;
|
|
|
|
sndist = FindDistance3D((cx-sx),(cy-sy),(cz-sz)>>4);
|
|
|
|
if (i >= 0 && (g_sounds[j].m&16) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9)
|
|
|
|
sndist = divscale14(sndist,(SHT+1));
|
|
|
|
|
|
|
|
sndist += g_sounds[j].vo;
|
|
|
|
if (sndist < 0) sndist = 0;
|
|
|
|
|
|
|
|
if (cs > -1 && sndist && PN != MUSICANDSFX && !cansee(cx,cy,cz-(24<<8),cs,sx,sy,sz-(24<<8),SECT))
|
|
|
|
sndist += sndist>>5;
|
|
|
|
|
|
|
|
if (PN == MUSICANDSFX && SLT < 999)
|
|
|
|
g_numEnvSoundsPlaying++;
|
2009-04-13 06:53:03 +00:00
|
|
|
/*
|
|
|
|
switch (j)
|
|
|
|
{
|
|
|
|
case PIPEBOMB_EXPLODE:
|
|
|
|
case LASERTRIP_EXPLODE:
|
|
|
|
case RPG_EXPLODE:
|
|
|
|
if (sndist > (6144)) sndist = (6144);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
*/
|
|
|
|
if (sndist > 31444 && PN != MUSICANDSFX)
|
2009-03-15 22:58:20 +00:00
|
|
|
{
|
2009-04-13 06:53:03 +00:00
|
|
|
S_StopSound(j);
|
|
|
|
continue;
|
|
|
|
}
|
2009-03-15 22:58:20 +00:00
|
|
|
// }
|
|
|
|
|
|
|
|
if (g_sounds[j].ptr == 0 && S_LoadSound(j) == 0) continue;
|
|
|
|
if (g_sounds[j].m&16) sndist = 0;
|
|
|
|
|
|
|
|
if (sndist < ((255-LOUDESTVOLUME)<<6))
|
|
|
|
sndist = ((255-LOUDESTVOLUME)<<6);
|
|
|
|
|
2009-07-26 19:01:39 +00:00
|
|
|
FX_Pan3D(g_sounds[j].SoundOwner[k].voice,sndang>>4,sndist>>6);
|
2009-03-15 22:58:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void S_TestSoundCallback(uint32_t num)
|
|
|
|
{
|
|
|
|
int32_t i,j,k;
|
|
|
|
|
|
|
|
k = g_sounds[num].num;
|
|
|
|
|
|
|
|
if (k > 0)
|
|
|
|
{
|
|
|
|
if ((g_sounds[num].m&16) == 0)
|
|
|
|
for (j=0; j<k; j++)
|
|
|
|
{
|
|
|
|
i = g_sounds[num].SoundOwner[j].i;
|
|
|
|
if (sprite[i].picnum == MUSICANDSFX && sector[sprite[i].sectnum].lotag < 3 && sprite[i].lotag < 999)
|
|
|
|
{
|
|
|
|
// ActorExtra[i].temp_data[0] = 0;
|
2009-03-17 21:57:30 +00:00
|
|
|
sprite[i].filler &= (~1);
|
2009-03-15 22:58:20 +00:00
|
|
|
if ((j + 1) < k)
|
|
|
|
{
|
|
|
|
g_sounds[num].SoundOwner[j].voice = g_sounds[num].SoundOwner[k-1].voice;
|
|
|
|
g_sounds[num].SoundOwner[j].i = g_sounds[num].SoundOwner[k-1].i;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_sounds[num].num--;
|
|
|
|
g_sounds[num].SoundOwner[k-1].i = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_sounds[num].lock--;
|
|
|
|
}
|
|
|
|
|
|
|
|
void S_ClearSoundLocks(void)
|
|
|
|
{
|
|
|
|
int32_t i;
|
|
|
|
|
|
|
|
for (i=0; i<MAXSOUNDS; i++)
|
|
|
|
if (g_sounds[i].lock >= 200)
|
|
|
|
g_sounds[i].lock = 199;
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t A_CheckSoundPlaying(int32_t i, int32_t num)
|
|
|
|
{
|
|
|
|
UNREFERENCED_PARAMETER(i);
|
|
|
|
if (num < 0) num=0; // FIXME
|
|
|
|
return (g_sounds[num].num > 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t S_CheckSoundPlaying(int32_t i, int32_t num)
|
|
|
|
{
|
|
|
|
if (i == -1)
|
|
|
|
{
|
2009-09-09 07:19:14 +00:00
|
|
|
if (g_sounds[num].lock >= 200)
|
2009-03-15 22:58:20 +00:00
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return(g_sounds[num].num);
|
|
|
|
}
|