Fix skill sounds when using JAudiolib instead of JFAud

git-svn-id: https://svn.eduke32.com/eduke32@179 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-05-22 01:05:56 +00:00
parent fe88c2d53f
commit 76eb4ada1d
9 changed files with 461 additions and 459 deletions

View file

@ -2870,7 +2870,7 @@ void moveweapons(void)
case COOLEXPLOSION1__STATIC: case COOLEXPLOSION1__STATIC:
if( s->picnum == COOLEXPLOSION1 ) if( s->picnum == COOLEXPLOSION1 )
if( !issoundplaying(WIERDSHOT_FLY) ) if( !issoundplaying(i,WIERDSHOT_FLY) )
spritesound(WIERDSHOT_FLY,i); spritesound(WIERDSHOT_FLY,i);
p = -1; p = -1;
@ -4907,7 +4907,7 @@ void moveexplosions(void) // STATNUM 5
l = getflorzofslope(sect,s->x,s->y)-s->z; l = getflorzofslope(sect,s->x,s->y)-s->z;
if( l > (16<<8) ) KILLIT(i); if( l > (16<<8) ) KILLIT(i);
} }
else */ if (!issoundplaying(ITEM_SPLASH)) else */ if (!issoundplaying(i,ITEM_SPLASH))
spritesound(ITEM_SPLASH,i); spritesound(ITEM_SPLASH,i);
} }
if(t[0] == 3) if(t[0] == 3)
@ -5598,7 +5598,7 @@ void moveeffectors(void) //STATNUM 3
{ {
if( (sc->floorstat&1) == 0 && (sc->ceilingstat&1) == 0 ) if( (sc->floorstat&1) == 0 && (sc->ceilingstat&1) == 0 )
{ {
if( !issoundplaying(hittype[i].lastvx) ) if( !issoundplaying(i,hittype[i].lastvx) )
spritesound(hittype[i].lastvx,i); spritesound(hittype[i].lastvx,i);
} }
else if( ud.monsters_off == 0 && sc->floorpal == 0 && (sc->floorstat&1) && rnd(8) ) else if( ud.monsters_off == 0 && sc->floorpal == 0 && (sc->floorstat&1) && rnd(8) )

View file

@ -349,7 +349,7 @@ extern void onvideomodechange(int newmode);
extern void OnEvent(int iEventID, short sActor,short sPlayer,long lDist); extern void OnEvent(int iEventID, short sActor,short sPlayer,long lDist);
extern int isspritemakingsound(short i, int num); extern int isspritemakingsound(short i, int num);
extern int issoundplaying(int num); extern int issoundplaying(short i, int num);
extern void stopspritesound(short num, short i); extern void stopspritesound(short num, short i);
extern void updatenames(void); extern void updatenames(void);
extern void sendboardname(void); extern void sendboardname(void);

View file

@ -2174,7 +2174,7 @@ void FTA(short q,struct player_struct *p)
pub = NUMPAGES; pub = NUMPAGES;
pus = NUMPAGES; pus = NUMPAGES;
if (p == &ps[screenpeek]) if (p == &ps[screenpeek])
OSD_Printf("%s\n",fta_quotes[q]); OSD_Printf("%s\n",strip_color_codes(fta_quotes[q]));
} }
} }
} else OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,p->ftq); } else OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,p->ftq);
@ -10503,19 +10503,19 @@ void dobonus(char bonusonly)
if( ud.lockout == 0 && !KB_KeyWaiting() ) if( ud.lockout == 0 && !KB_KeyWaiting() )
{ {
sound(ENDSEQVOL3SND5); sound(ENDSEQVOL3SND5);
while(issoundplaying(ENDSEQVOL3SND5)) { handleevents(); getpackets(); } while(issoundplaying(-1,ENDSEQVOL3SND5)) { handleevents(); getpackets(); }
if(KB_KeyWaiting()) goto ENDANM; if(KB_KeyWaiting()) goto ENDANM;
sound(ENDSEQVOL3SND6); sound(ENDSEQVOL3SND6);
while(issoundplaying(ENDSEQVOL3SND6)) { handleevents(); getpackets(); } while(issoundplaying(-1,ENDSEQVOL3SND6)) { handleevents(); getpackets(); }
if(KB_KeyWaiting()) goto ENDANM; if(KB_KeyWaiting()) goto ENDANM;
sound(ENDSEQVOL3SND7); sound(ENDSEQVOL3SND7);
while(issoundplaying(ENDSEQVOL3SND7)) { handleevents(); getpackets(); } while(issoundplaying(-1,ENDSEQVOL3SND7)) { handleevents(); getpackets(); }
if(KB_KeyWaiting()) goto ENDANM; if(KB_KeyWaiting()) goto ENDANM;
sound(ENDSEQVOL3SND8); sound(ENDSEQVOL3SND8);
while(issoundplaying(ENDSEQVOL3SND8)) { handleevents(); getpackets(); } while(issoundplaying(-1,ENDSEQVOL3SND8)) { handleevents(); getpackets(); }
if(KB_KeyWaiting()) goto ENDANM; if(KB_KeyWaiting()) goto ENDANM;
sound(ENDSEQVOL3SND9); sound(ENDSEQVOL3SND9);
while(issoundplaying(ENDSEQVOL3SND9)) { handleevents(); getpackets(); } while(issoundplaying(-1,ENDSEQVOL3SND9)) { handleevents(); getpackets(); }
} }
KB_FlushKeyBoardQueue(); KB_FlushKeyBoardQueue();

View file

@ -3754,7 +3754,7 @@ char parse(void)
case CON_IFSOUND: case CON_IFSOUND:
insptr++; insptr++;
parseifelse( Sound[*insptr].num > 0 ); parseifelse( isspritemakingsound(g_i,*insptr) );
// parseifelse(SoundOwner[*insptr][0].i == g_i); // parseifelse(SoundOwner[*insptr][0].i == g_i);
break; break;

View file

@ -28,7 +28,7 @@ extern "C" {
# include "winlayer.h" # include "winlayer.h"
#endif #endif
#include "osd.h" #include "osd.h"
long numenvsnds; long numenvsnds;
} }
typedef uint64 uint64_t; typedef uint64 uint64_t;
@ -65,7 +65,7 @@ public:
if (fh >= 0) kclose(fh); if (fh >= 0) kclose(fh);
} }
virtual bool IsOpen(void) const { return fh >= 0; } virtual bool IsOpen(void) const { return fh >= 0; }
virtual long Read(long nbytes, void *buf) virtual long Read(long nbytes, void *buf)
{ {
@ -313,7 +313,7 @@ int isspritemakingsound(short i, int num) // if num<0, check if making any sound
return n; return n;
} }
int issoundplaying(int num) int issoundplaying(short i, int num)
{ {
int j,n=0; int j,n=0;
@ -403,7 +403,7 @@ int xyzsound(short num, short i, long x, long y, long z)
} }
if(ps[screenpeek].sound_pitch) if(ps[screenpeek].sound_pitch)
pitch = translatepitch(ps[screenpeek].sound_pitch); pitch = translatepitch(ps[screenpeek].sound_pitch);
/* /*
// XXX: this is shit // XXX: this is shit
if( Sound[num].num > 0 && PN != MUSICANDSFX ) if( Sound[num].num > 0 && PN != MUSICANDSFX )
{ {
@ -411,7 +411,7 @@ int xyzsound(short num, short i, long x, long y, long z)
else if( Sound[num].num > 1 ) stopsound(num); else if( Sound[num].num > 1 ) stopsound(num);
else if( badguy(&sprite[i]) && sprite[i].extra <= 0 ) stopsound(num); else if( badguy(&sprite[i]) && sprite[i].extra <= 0 ) stopsound(num);
} }
*/ */
chan = jfaud->PlaySound(sounds[num], NULL, soundpr[num]); chan = jfaud->PlaySound(sounds[num], NULL, soundpr[num]);
if (!chan) return -1; if (!chan) return -1;

View file

@ -999,7 +999,7 @@ void newgame(char vn,char ln,char sk)
short i; short i;
if(globalskillsound >= 0) if(globalskillsound >= 0)
while(issoundplaying(globalskillsound)) { handleevents(); getpackets(); } while(issoundplaying(-1,globalskillsound)) { handleevents(); getpackets(); }
globalskillsound = -1; globalskillsound = -1;
waitforeverybody(); waitforeverybody();

View file

@ -2032,7 +2032,7 @@ void checkhitsprite(short i,short sn)
sprite[sn].xvel = (sprite[i].xvel>>1)+(sprite[i].xvel>>2); sprite[sn].xvel = (sprite[i].xvel>>1)+(sprite[i].xvel>>2);
sprite[sn].ang -= (SA<<1)+1024; sprite[sn].ang -= (SA<<1)+1024;
SA = getangle(SX-sprite[sn].x,SY-sprite[sn].y)-512; SA = getangle(SX-sprite[sn].x,SY-sprite[sn].y)-512;
if(issoundplaying(POOLBALLHIT) < 2) if(issoundplaying(i,POOLBALLHIT) < 2)
spritesound(POOLBALLHIT,i); spritesound(POOLBALLHIT,i);
} }
else else

View file

@ -624,10 +624,12 @@ void clearsoundlocks(void)
int isspritemakingsound(short i, int num) int isspritemakingsound(short i, int num)
{ {
if (num < 0) num=0; // FIXME if (num < 0) num=0; // FIXME
return issoundplaying(num) > 0; return (Sound[num].num > 0);
} }
int issoundplaying(int num) int issoundplaying(short i, int num)
{ {
return Sound[num].num; if(i == -1)
return (Sound[num].lock != 199);
else return (Sound[num].num);
} }