Skip to content

Commit

Permalink
- Exhumed: Avoid masking sound flags into the sprite index.
Browse files Browse the repository at this point in the history
This put a hard 4096 sprites limit into the engine. It's also a blocker for refactoring.
  • Loading branch information
coelckers committed Sep 12, 2021
1 parent d82b7ff commit 9991e66
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion source/games/exhumed/src/player.cpp
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion source/games/exhumed/src/runlist.cpp
Expand Up @@ -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;
Expand Down
7 changes: 3 additions & 4 deletions source/games/exhumed/src/sound.cpp
Expand Up @@ -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))
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions source/games/exhumed/src/sound.h
Expand Up @@ -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);

Expand Down

0 comments on commit 9991e66

Please sign in to comment.