- Exhumed: Avoid masking sound flags into the sprite index.

This put a hard 4096 sprites limit into the engine. It's also a blocker for refactoring.
This commit is contained in:
Christoph Oelckers 2021-09-07 21:30:03 +02:00
parent d82b7ff51c
commit 9991e6665c
4 changed files with 8 additions and 9 deletions

View file

@ -1101,7 +1101,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
short nBlock = sector[nPlayerPushSect[nPlayer]].extra;
int nBlockSprite = sBlockInfo[nBlock].nSprite;
D3PlayFX(StaticSound[kSound23], nBlockSprite | 0x4000);
D3PlayFX(StaticSound[kSound23], nBlockSprite, 0x4000);
}
else
{

View file

@ -1681,7 +1681,7 @@ void runlist_DamageEnemy(int nSprite, int nSprite2, short nDamage)
}
int nDopSprite = nDoppleSprite[nPlayer];
D3PlayFX(StaticSound[kSoundTauntStart + (RandomSize(3) % 5)], nDopSprite | ebx);
D3PlayFX(StaticSound[kSoundTauntStart + (RandomSize(3) % 5)], nDopSprite, ebx);
}
nTauntTimer[nPlayer] = RandomSize(3) + 3;

View file

@ -557,7 +557,7 @@ void GameInterface::UpdateSounds()
int soundx, soundy, soundz;
short soundsect;
void PlayFX2(unsigned short nSound, short nSprite, int sectf, EChanFlags chanflags)
void PlayFX2(unsigned short nSound, short nSprite, int sectf, EChanFlags chanflags, int sprflags)
{
if (!SoundEnabled()) return;
if ((nSound&0x1ff) >= kMaxSounds || !soundEngine->isValidSoundId((nSound & 0x1ff)+1))
@ -569,9 +569,8 @@ void PlayFX2(unsigned short nSound, short nSprite, int sectf, EChanFlags chanfla
bool fullvol = false, hiprio = false;
if (nSprite >= 0)
{
fullvol = (nSprite & 0x2000) != 0;
hiprio = (nSprite & 0x4000) != 0;
nSprite &= 0xfff;
fullvol = (sprflags & 0x2000) != 0;
hiprio = (sprflags & 0x4000) != 0;
soundx = sprite[nSprite].x;
soundy = sprite[nSprite].y;
soundz = sprite[nSprite].z;

View file

@ -131,11 +131,11 @@ int LoadSound(const char* sound);
void BendAmbientSound();
void CheckAmbience(short nSector);
void PlayFX2(unsigned short nSound, short nSprite, int sectf = 0, EChanFlags chanflags = CHANF_NONE);
void PlayFX2(unsigned short nSound, short nSprite, int sectf = 0, EChanFlags chanflags = CHANF_NONE, int sprflags = 0);
void PlayFXAtXYZ(unsigned short nSound, int x, int y, int z, int nSector, EChanFlags chanflags = CHANF_NONE);
inline void D3PlayFX(unsigned short nSound, short nVal)
inline void D3PlayFX(unsigned short nSound, short nVal, short flags = 0)
{
PlayFX2(nSound, nVal);
PlayFX2(nSound, nVal, 0, CHANF_NONE, flags);
}
void StopSpriteSound(short nSprite);