Fix annoying bug with ambient creature sound timer

This commit is contained in:
nukeykt 2019-11-04 02:32:02 +09:00 committed by Christoph Oelckers
parent 4e21cf5cbf
commit 6f9cdaccfc
4 changed files with 27 additions and 19 deletions

View file

@ -2092,6 +2092,8 @@ static void GameMove(void)
bobangle &= kAngleMask;
}
UpdateCreepySounds();
// loc_120E9:
totalmoves++;
moveframes--;

View file

@ -345,7 +345,7 @@ void InitFX(void)
nTotalSoundBytes = 0;
nSoundCount = 0;
nCreepyTimer = 450;
nCreepyTimer = kCreepyCount;
#if 0
int status = FX_Init(FXDevice, NumVoices, NumChannels, NumBits, MixRate);
@ -817,9 +817,13 @@ void UpdateSounds()
}
}
}
}
if (!nFreeze && levelnum != 20)
{
void UpdateCreepySounds()
{
if (levelnum == 20)
return;
spritetype *pSprite = &sprite[PlayerList[nLocalPlayer].nSprite];
nCreepyTimer--;
if (nCreepyTimer <= 0)
{
@ -838,8 +842,7 @@ void UpdateSounds()
PlayFXAtXYZ(vsi, pSprite->x+vdx, pSprite->y+vax, pSprite->z, pSprite->sectnum);
}
}
nCreepyTimer = 450;
}
nCreepyTimer = kCreepyCount;
}
}
@ -1153,7 +1156,7 @@ short PlayFX2(unsigned short nSound, short nSprite)
// Nuke: added nSprite >= 0 check
if (nSprite != nLocalSpr && nSprite >= 0 && (sprite[nSprite].cstat&257))
nCreepyTimer = 450;
nCreepyTimer = kCreepyCount;
return v14;
}

View file

@ -7,6 +7,8 @@
#define kMaxSoundNameLen 8
#define kMaxActiveSounds 8
#define kCreepyCount 150
enum {
kSound0 = 0,
kSound1,
@ -91,6 +93,7 @@ extern short StaticSound[];
void UpdateSounds();
void UpdateCreepySounds();
void InitFX();
void UnInitFX();

View file

@ -213,7 +213,7 @@ static void analyzesprites()
{
spritetype *pTarget = &sprite[besttarget];
nCreepyTimer = 450;
nCreepyTimer = kCreepyCount;
if (!cansee(x, y, z, nSector, pTarget->x, pTarget->y, pTarget->z - GetSpriteHeight(besttarget), pTarget->sectnum))
{