diff --git a/source/games/exhumed/src/exhumed.cpp b/source/games/exhumed/src/exhumed.cpp index 103e57bc9..78acdbbb1 100644 --- a/source/games/exhumed/src/exhumed.cpp +++ b/source/games/exhumed/src/exhumed.cpp @@ -208,7 +208,7 @@ void DoRedAlert(int nVal) { if (nVal) { - PlayFXAtXYZ(StaticSound[kSoundAlarm], ac->int_pos().X, ac->int_pos().Y, ac->int_pos().Z); + PlayFXAtXYZ(StaticSound[kSoundAlarm], ac->spr.pos); AddFlash(ac->sector(), ac->spr.pos, 192); } } diff --git a/source/games/exhumed/src/fish.cpp b/source/games/exhumed/src/fish.cpp index e40bd1f20..3f96ab482 100644 --- a/source/games/exhumed/src/fish.cpp +++ b/source/games/exhumed/src/fish.cpp @@ -272,7 +272,7 @@ void AIFish::Damage(RunListEvent* ev) BuildFishLimb(pActor, i); } - PlayFXAtXYZ(StaticSound[kSound40], pActor->int_pos().X, pActor->int_pos().Y, pActor->int_pos().Z); + PlayFXAtXYZ(StaticSound[kSound40], pActor->spr.pos); DestroyFish(pActor); } else diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index 7b9c6a000..928326564 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -606,9 +606,7 @@ int CheckSectorSprites(sectortype* pSector, int nVal) if (pActor->spr.statnum == 100 && PlayerList[GetPlayerFromActor(pActor)].nHealth <= 0) { PlayFXAtXYZ(StaticSound[kSoundJonFDie], - pActor->int_pos().X, - pActor->int_pos().Y, - pActor->int_pos().Z, + pActor->spr.pos, CHANF_NONE, 0x4000); } } @@ -836,7 +834,7 @@ void AIElev::Tick(RunListEvent* ev) SetQuake(pElevSpr, 30); } - PlayFXAtXYZ(StaticSound[kSound26], pElevSpr->int_pos().X, pElevSpr->int_pos().Y, pElevSpr->int_pos().Z); + PlayFXAtXYZ(StaticSound[kSound26], pElevSpr->spr.pos); } if (var_18 & 0x4) diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 28b716744..6b52cb0b3 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -983,7 +983,7 @@ void AIPlayer::Tick(RunListEvent* ev) pPlayerActor->spr.yvel = 0; StopActorSound(pPlayerActor); - PlayFXAtXYZ(StaticSound[kSoundJonFDie], pPlayerActor->int_pos().X, pPlayerActor->int_pos().Y, pPlayerActor->int_pos().Z, CHANF_NONE, 1); // CHECKME + PlayFXAtXYZ(StaticSound[kSoundJonFDie], pPlayerActor->spr.pos, CHANF_NONE, 1); // CHECKME } else { diff --git a/source/games/exhumed/src/queen.cpp b/source/games/exhumed/src/queen.cpp index e3cf83ed0..7bf6ece4c 100644 --- a/source/games/exhumed/src/queen.cpp +++ b/source/games/exhumed/src/queen.cpp @@ -685,7 +685,7 @@ void BuildQueenHead(int nQueen) auto pActor2 = insertActor(pSector, 121); - pActor2->spr.pos.XY() = pActor->spr.pos(); + pActor2->spr.pos.XY() = pActor->spr.pos.XY(); pActor2->spr.pos.Z = pSector->floorz; pActor2->spr.clipdist = 70; pActor2->spr.xrepeat = 80; @@ -1368,9 +1368,7 @@ void AIQueen::Tick(RunListEvent* ev) PlayFXAtXYZ( StaticSound[kSound40], - pActor->int_pos().X, - pActor->int_pos().Y, - pActor->int_pos().Z); + pActor->spr.pos); BuildQueenHead(nQueen); diff --git a/source/games/exhumed/src/sound.cpp b/source/games/exhumed/src/sound.cpp index 8ec71f791..d8da65b47 100644 --- a/source/games/exhumed/src/sound.cpp +++ b/source/games/exhumed/src/sound.cpp @@ -549,9 +549,7 @@ void GameInterface::UpdateSounds() // //========================================================================== -int soundx, soundy, soundz; - -void PlayFX2(int nSound, DExhumedActor* pActor, int sectf, EChanFlags chanflags, int sprflags) +void PlayFX2(int nSound, DExhumedActor* pActor, int sectf, EChanFlags chanflags, int sprflags, const DVector3* soundpos) { if (!SoundEnabled()) return; if ((nSound&0x1ff) >= kMaxSounds || !soundEngine->isValidSoundId((nSound & 0x1ff)+1)) @@ -565,10 +563,9 @@ void PlayFX2(int nSound, DExhumedActor* pActor, int sectf, EChanFlags chanflags, { fullvol = (sprflags & 0x2000) != 0; hiprio = (sprflags & 0x4000) != 0; - soundx = pActor->int_pos().X; - soundy = pActor->int_pos().Y; - soundz = pActor->int_pos().Z; + soundpos = &pActor->spr.pos; } + if (!soundpos) return; int nVolume = 255; @@ -588,8 +585,7 @@ void PlayFX2(int nSound, DExhumedActor* pActor, int sectf, EChanFlags chanflags, GetSpriteSoundPitch(&nVolume, &nPitch); - vec3_t v = { soundx, soundy, soundz }; - FVector3 vv = GetSoundPos(v); + FVector3 vv = GetSoundPos(*soundpos); // Check if this sound is allowed to play or if it must stop some other sound. if (!forcePlay) @@ -652,12 +648,9 @@ void PlayFX2(int nSound, DExhumedActor* pActor, int sectf, EChanFlags chanflags, // //========================================================================== -void PlayFXAtXYZ(int ax, int x, int y, int z, EChanFlags chanflags, int sectf) +void PlayFXAtXYZ(int ax, const DVector3& pos, EChanFlags chanflags, int sectf) { - soundx = x; - soundy = y; - soundz = z; - PlayFX2(ax, nullptr, sectf, chanflags); + PlayFX2(ax, nullptr, sectf, chanflags, 0, &pos); } //========================================================================== diff --git a/source/games/exhumed/src/sound.h b/source/games/exhumed/src/sound.h index 29f9b5ebf..5187713e8 100644 --- a/source/games/exhumed/src/sound.h +++ b/source/games/exhumed/src/sound.h @@ -130,9 +130,9 @@ int LoadSound(const char* sound); void BendAmbientSound(); void CheckAmbience(sectortype* pSector); -void PlayFX2(int nSound, DExhumedActor* nSprite, int sectf = 0, EChanFlags chanflags = CHANF_NONE, int sprflags = 0); +void PlayFX2(int nSound, DExhumedActor* nSprite, int sectf = 0, EChanFlags chanflags = CHANF_NONE, int sprflags = 0, const DVector3* soundpos = nullptr); -void PlayFXAtXYZ(int nSound, int x, int y, int z, EChanFlags chanflags = CHANF_NONE, int sectf = 0); +void PlayFXAtXYZ(int nSound, const DVector3& pos, EChanFlags chanflags = CHANF_NONE, int sectf = 0); inline void D3PlayFX(int nSound, DExhumedActor* actor, int flags = 0) { PlayFX2(nSound, actor, 0, CHANF_NONE, flags); diff --git a/source/games/exhumed/src/switch.cpp b/source/games/exhumed/src/switch.cpp index 4f509e7ba..952f2957d 100644 --- a/source/games/exhumed/src/switch.cpp +++ b/source/games/exhumed/src/switch.cpp @@ -290,7 +290,7 @@ void AISWStepOn::TouchFloor(RunListEvent* ev) if (var_14 != sRunChannels[nChannel].c) { auto pWall = pSector->firstWall(); - PlayFXAtXYZ(StaticSound[nSwitchSound], pWall->wall_int_pos().X, pWall->wall_int_pos().Y, pSector->int_floorz()); + PlayFXAtXYZ(StaticSound[nSwitchSound], DVector3(pWall->pos, pSector->floorz)); assert(sRunChannels[nChannel].c < 8); @@ -442,8 +442,7 @@ void AISWPressSector::Use(RunListEvent* ev) { if (SwitchData[nSwitch].nKeyMask) { - auto& pos = PlayerList[nPlayer].pActor->int_pos(); - PlayFXAtXYZ(StaticSound[nSwitchSound], pos.X, pos.Y, 0, CHANF_LISTENERZ); + PlayFXAtXYZ(StaticSound[nSwitchSound], PlayerList[nPlayer].pActor->spr.pos, CHANF_LISTENERZ); StatusMessage(300, GStrings("TXT_EX_NEEDKEY")); } @@ -510,7 +509,7 @@ void AISWPressWall::Use(RunListEvent* ev) auto pWall = SwitchData[nSwitch].pWall; auto pSector = SwitchData[nSwitch].pSector; - PlayFXAtXYZ(StaticSound[nSwitchSound], pWall->wall_int_pos().X, pWall->wall_int_pos().Y, 0, CHANF_LISTENERZ); + PlayFXAtXYZ(StaticSound[nSwitchSound], DVector3(pWall->pos, 0), CHANF_LISTENERZ); } END_PS_NS