This fixes S_CheckSoundPlaying() and makes CON_IFSOUND work correctly in scripts that run during menus. These changes together fix the exchange between Duke and Lani at the end of episode 3 of Duke3D.

git-svn-id: https://svn.eduke32.com/eduke32@7279 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-12-15 01:39:25 +00:00
parent 5102281e0e
commit 06ac4f88b9
7 changed files with 15 additions and 15 deletions

View file

@ -3090,7 +3090,7 @@ ACTOR_STATIC void G_MoveWeapons(void)
case COOLEXPLOSION1__STATIC: case COOLEXPLOSION1__STATIC:
{ {
if (pSprite->picnum == COOLEXPLOSION1) if (pSprite->picnum == COOLEXPLOSION1)
if (!S_CheckSoundPlaying(spriteNum, WIERDSHOT_FLY)) if (!S_CheckSoundPlaying(WIERDSHOT_FLY))
A_PlaySound(WIERDSHOT_FLY, spriteNum); A_PlaySound(WIERDSHOT_FLY, spriteNum);
int spriteXvel = pSprite->xvel; int spriteXvel = pSprite->xvel;
@ -5227,7 +5227,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5
} }
else else
*/ */
if (!S_CheckSoundPlaying(spriteNum,ITEM_SPLASH)) if (!S_CheckSoundPlaying(ITEM_SPLASH))
A_PlaySound(ITEM_SPLASH,spriteNum); A_PlaySound(ITEM_SPLASH,spriteNum);
} }
if (pData[0] == 3) if (pData[0] == 3)
@ -6020,7 +6020,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
{ {
if ((pSector->floorstat&1) == 0 && (pSector->ceilingstat&1) == 0) if ((pSector->floorstat&1) == 0 && (pSector->ceilingstat&1) == 0)
{ {
if (!S_CheckSoundPlaying(spriteNum,actor[spriteNum].lastv.x)) if (!S_CheckSoundPlaying(actor[spriteNum].lastv.x))
A_PlaySound(actor[spriteNum].lastv.x,spriteNum); A_PlaySound(actor[spriteNum].lastv.x,spriteNum);
} }
else if (ud.monsters_off == 0 && pSector->floorpal == 0 && (pSector->floorstat&1) && rnd(8)) else if (ud.monsters_off == 0 && pSector->floorpal == 0 && (pSector->floorstat&1) && rnd(8))

View file

@ -6725,6 +6725,7 @@ MAIN_LOOP_RESTART:
else else
#endif #endif
{ {
S_Cleanup();
MUSIC_Update(); MUSIC_Update();
G_HandleLocalKeys(); G_HandleLocalKeys();
} }

View file

@ -3143,7 +3143,7 @@ badindex:
CON_ERRPRINTF("invalid sound %d\n", vm.pUSprite->yvel); CON_ERRPRINTF("invalid sound %d\n", vm.pUSprite->yvel);
continue; continue;
} }
if (!S_CheckSoundPlaying(vm.spriteNum, vm.pSprite->yvel)) if (!S_CheckSoundPlaying(vm.pSprite->yvel))
A_PlaySound(vm.pSprite->yvel, vm.spriteNum); A_PlaySound(vm.pSprite->yvel, vm.spriteNum);
continue; continue;
@ -3206,7 +3206,7 @@ badindex:
CON_ERRPRINTF("invalid sound %d\n", (int32_t)*insptr); CON_ERRPRINTF("invalid sound %d\n", (int32_t)*insptr);
continue; continue;
} }
VM_CONDITIONAL(S_CheckSoundPlaying(vm.spriteNum, *insptr)); VM_CONDITIONAL(S_CheckSoundPlaying(*insptr));
// VM_DoConditional(SoundOwner[*insptr][0].ow == vm.spriteNum); // VM_DoConditional(SoundOwner[*insptr][0].ow == vm.spriteNum);
continue; continue;
@ -4229,7 +4229,7 @@ badindex:
switch (tw) switch (tw)
{ {
case CON_SOUNDONCE: case CON_SOUNDONCE:
if (!S_CheckSoundPlaying(vm.spriteNum, soundNum)) if (!S_CheckSoundPlaying(soundNum))
{ {
fallthrough__; fallthrough__;
case CON_SOUND: A_PlaySound((int16_t)soundNum, vm.spriteNum); case CON_SOUND: A_PlaySound((int16_t)soundNum, vm.spriteNum);
@ -4237,10 +4237,10 @@ badindex:
continue; continue;
case CON_GLOBALSOUND: A_PlaySound((int16_t)soundNum, g_player[screenpeek].ps->i); continue; case CON_GLOBALSOUND: A_PlaySound((int16_t)soundNum, g_player[screenpeek].ps->i); continue;
case CON_STOPSOUND: case CON_STOPSOUND:
if (S_CheckSoundPlaying(vm.spriteNum, soundNum)) if (S_CheckSoundPlaying(soundNum))
S_StopSound((int16_t)soundNum); S_StopSound((int16_t)soundNum);
continue; continue;
case CON_SCREENSOUND: A_PlaySound(soundNum, -1); continue; case CON_SCREENSOUND: S_PlaySound(soundNum); continue;
} }
} }
continue; continue;

View file

@ -555,7 +555,6 @@ static void Net_DeleteAllScratchPadSprites()
Net_InitScratchPadSpriteList(); Net_InitScratchPadSpriteList();
} }
static void Net_Error_Disconnect(const char* message) static void Net_Error_Disconnect(const char* message)
{ {
OSD_Printf("Net_Error_Disconnect: %s\n", message); OSD_Printf("Net_Error_Disconnect: %s\n", message);
@ -4769,7 +4768,7 @@ void Net_GetPackets(void)
{ {
timerUpdate(); timerUpdate();
MUSIC_Update(); MUSIC_Update();
S_Update(); S_Cleanup();
G_HandleSpecialKeys(); G_HandleSpecialKeys();

View file

@ -64,7 +64,7 @@ static int32_t G_PlaySoundWhileNoInput(int32_t soundnum)
{ {
S_PlaySound(soundnum); S_PlaySound(soundnum);
I_ClearAllInput(); I_ClearAllInput();
while (S_CheckSoundPlaying(-1, soundnum)) while (S_CheckSoundPlaying(soundnum))
{ {
G_HandleAsync(); G_HandleAsync();
if (I_CheckAllInput()) if (I_CheckAllInput())

View file

@ -970,8 +970,8 @@ bool A_CheckAnySoundPlaying(int spriteNum)
return 0; return 0;
} }
bool S_CheckSoundPlaying(int spriteNum, int soundNum) bool S_CheckSoundPlaying(int soundNum)
{ {
if (EDUKE32_PREDICT_FALSE((unsigned)soundNum > (unsigned)g_highestSoundIdx)) return 0; if (EDUKE32_PREDICT_FALSE((unsigned)soundNum > (unsigned)g_highestSoundIdx)) return false;
return (spriteNum == -1) ? (g_soundlocks[soundNum] > 200) : (g_sounds[soundNum].num != 0); return (g_sounds[soundNum].num != 0);
} }

View file

@ -67,7 +67,7 @@ bool A_CheckSoundPlaying(int spriteNum,int soundNum);
int A_PlaySound(int soundNum, int spriteNum); int A_PlaySound(int soundNum, int spriteNum);
void S_Callback(uint32_t num); void S_Callback(uint32_t num);
bool A_CheckAnySoundPlaying(int spriteNum); bool A_CheckAnySoundPlaying(int spriteNum);
bool S_CheckSoundPlaying(int spriteNum,int soundNum); bool S_CheckSoundPlaying(int soundNum);
void S_Cleanup(void); void S_Cleanup(void);
void S_ClearSoundLocks(void); void S_ClearSoundLocks(void);
int32_t S_LoadSound(uint32_t num); int32_t S_LoadSound(uint32_t num);