mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-26 00:40:56 +00:00
Fix annoying bug with ambient creature sound timer
This commit is contained in:
parent
4e21cf5cbf
commit
6f9cdaccfc
4 changed files with 27 additions and 19 deletions
|
@ -2092,6 +2092,8 @@ static void GameMove(void)
|
||||||
bobangle &= kAngleMask;
|
bobangle &= kAngleMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateCreepySounds();
|
||||||
|
|
||||||
// loc_120E9:
|
// loc_120E9:
|
||||||
totalmoves++;
|
totalmoves++;
|
||||||
moveframes--;
|
moveframes--;
|
||||||
|
|
|
@ -345,7 +345,7 @@ void InitFX(void)
|
||||||
|
|
||||||
nTotalSoundBytes = 0;
|
nTotalSoundBytes = 0;
|
||||||
nSoundCount = 0;
|
nSoundCount = 0;
|
||||||
nCreepyTimer = 450;
|
nCreepyTimer = kCreepyCount;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
int status = FX_Init(FXDevice, NumVoices, NumChannels, NumBits, MixRate);
|
int status = FX_Init(FXDevice, NumVoices, NumChannels, NumBits, MixRate);
|
||||||
|
@ -817,29 +817,32 @@ void UpdateSounds()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!nFreeze && levelnum != 20)
|
void UpdateCreepySounds()
|
||||||
|
{
|
||||||
|
if (levelnum == 20)
|
||||||
|
return;
|
||||||
|
spritetype *pSprite = &sprite[PlayerList[nLocalPlayer].nSprite];
|
||||||
|
nCreepyTimer--;
|
||||||
|
if (nCreepyTimer <= 0)
|
||||||
{
|
{
|
||||||
nCreepyTimer--;
|
if (nCreaturesLeft > 0 && !(SectFlag[nPlayerViewSect[nLocalPlayer]]&0x2000))
|
||||||
if (nCreepyTimer <= 0)
|
|
||||||
{
|
{
|
||||||
if (nCreaturesLeft > 0 && !(SectFlag[nPlayerViewSect[nLocalPlayer]]&0x2000))
|
int vsi = seq_GetFrameSound(SeqOffsets[kSeqCreepy], totalmoves%SeqSize[SeqOffsets[kSeqCreepy]]);
|
||||||
|
if (vsi >= 0 && (vsi&0x1ff) < kMaxSounds)
|
||||||
{
|
{
|
||||||
int vsi = seq_GetFrameSound(SeqOffsets[kSeqCreepy], totalmoves%SeqSize[SeqOffsets[kSeqCreepy]]);
|
int vdx = (totalmoves+32)&31;
|
||||||
if (vsi >= 0 && (vsi&0x1ff) < kMaxSounds)
|
if (totalmoves & 1)
|
||||||
{
|
vdx = -vdx;
|
||||||
int vdx = (totalmoves+32)&31;
|
int vax = (totalmoves+32)&63;
|
||||||
if (totalmoves & 1)
|
if (totalmoves & 2)
|
||||||
vdx = -vdx;
|
vax = -vax;
|
||||||
int vax = (totalmoves+32)&63;
|
|
||||||
if (totalmoves & 2)
|
|
||||||
vax = -vax;
|
|
||||||
|
|
||||||
PlayFXAtXYZ(vsi, pSprite->x+vdx, pSprite->y+vax, pSprite->z, pSprite->sectnum);
|
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
|
// Nuke: added nSprite >= 0 check
|
||||||
if (nSprite != nLocalSpr && nSprite >= 0 && (sprite[nSprite].cstat&257))
|
if (nSprite != nLocalSpr && nSprite >= 0 && (sprite[nSprite].cstat&257))
|
||||||
nCreepyTimer = 450;
|
nCreepyTimer = kCreepyCount;
|
||||||
|
|
||||||
return v14;
|
return v14;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#define kMaxSoundNameLen 8
|
#define kMaxSoundNameLen 8
|
||||||
#define kMaxActiveSounds 8
|
#define kMaxActiveSounds 8
|
||||||
|
|
||||||
|
#define kCreepyCount 150
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kSound0 = 0,
|
kSound0 = 0,
|
||||||
kSound1,
|
kSound1,
|
||||||
|
@ -91,6 +93,7 @@ extern short StaticSound[];
|
||||||
|
|
||||||
|
|
||||||
void UpdateSounds();
|
void UpdateSounds();
|
||||||
|
void UpdateCreepySounds();
|
||||||
|
|
||||||
void InitFX();
|
void InitFX();
|
||||||
void UnInitFX();
|
void UnInitFX();
|
||||||
|
|
|
@ -213,7 +213,7 @@ static void analyzesprites()
|
||||||
{
|
{
|
||||||
spritetype *pTarget = &sprite[besttarget];
|
spritetype *pTarget = &sprite[besttarget];
|
||||||
|
|
||||||
nCreepyTimer = 450;
|
nCreepyTimer = kCreepyCount;
|
||||||
|
|
||||||
if (!cansee(x, y, z, nSector, pTarget->x, pTarget->y, pTarget->z - GetSpriteHeight(besttarget), pTarget->sectnum))
|
if (!cansee(x, y, z, nSector, pTarget->x, pTarget->y, pTarget->z - GetSpriteHeight(besttarget), pTarget->sectnum))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue