diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index dbd50d87d..273f70c48 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1651,7 +1651,7 @@ enum short SoundAngle(int x, int y); //void PlaySound(int num, short angle, short vol); -int _PlaySound(int num, DSWActor* sprite, PLAYER* player, const vec3_t *const pos, int flags, int channel, EChanFlags sndflags); +int _PlaySound(int num, DSWActor* sprite, PLAYER* player, const DVector3 *const pos, int flags, int channel, EChanFlags sndflags); void InitAmbient(int num, DSWActor* actor); inline void PlaySound(int num, PLAYER* player, int flags, int channel = 8, EChanFlags sndflags = CHANF_NONE) @@ -1662,19 +1662,10 @@ inline void PlaySound(int num, int flags, int channel = 8, EChanFlags sndflags = { _PlaySound(num, nullptr, nullptr, nullptr, flags, channel, sndflags); } -inline void PlaySound(int num, vec3_t *pos, int flags, int channel = 8, EChanFlags sndflags = CHANF_NONE) -{ - _PlaySound(num, nullptr, nullptr, pos, flags, channel, sndflags); -} -inline void PlaySound(int num, const vec3_t &pos, int flags, int channel = 8, EChanFlags sndflags = CHANF_NONE) +inline void PlaySound(int num, const DVector3 &pos, int flags, int channel = 8, EChanFlags sndflags = CHANF_NONE) { _PlaySound(num, nullptr, nullptr, &pos, flags, channel, sndflags); } -inline void PlaySound(int num, const DVector3& pos, int flags, int channel = 8, EChanFlags sndflags = CHANF_NONE) -{ - vec3_t ppos = { int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint) }; - _PlaySound(num, nullptr, nullptr, &ppos, flags, channel, sndflags); -} int _PlayerSound(int num, PLAYER* pp); inline int PlayerSound(int num, int flags, PLAYER* pp) { return _PlayerSound(num, pp); } diff --git a/source/games/sw/src/sounds.cpp b/source/games/sw/src/sounds.cpp index 80bad59b7..8f921c058 100644 --- a/source/games/sw/src/sounds.cpp +++ b/source/games/sw/src/sounds.cpp @@ -625,13 +625,13 @@ void GameInterface::UpdateSounds(void) // //========================================================================== -int _PlaySound(int num, DSWActor* actor, PLAYER* pp, const vec3_t* const ppos, int flags, int channel, EChanFlags cflags) +int _PlaySound(int num, DSWActor* actor, PLAYER* pp, const DVector3* const ppos, int flags, int channel, EChanFlags cflags) { if (Prediction || !SoundEnabled() || !soundEngine->isValidSoundId(num)) return -1; auto sps = actor; - auto pos = ppos ? *ppos : vec3_t(0, 0, 0); + auto pos = ppos ? *ppos : DVector3(0, 0, 0); auto vp = &voc[num]; int sourcetype = SOURCE_None; @@ -643,13 +643,13 @@ int _PlaySound(int num, DSWActor* actor, PLAYER* pp, const vec3_t* const ppos, i { if (actor && !ppos) { - pos = actor->int_pos(); + pos = actor->spr.pos; actor = nullptr; sourcetype = SOURCE_Unattached; } else if (pp && !ppos) { - pos = pp->int_ppos(); + pos = pp->pos; pp = nullptr; sourcetype = SOURCE_Unattached; } diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 7b35c0f81..a30a49289 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -11647,7 +11647,7 @@ int InitSwordAttack(PLAYER* pp) { case ZILLA_RUN_R0: SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, daang); - PlaySound(DIGI_SWORDCLANK, hit.int_hitpos(), v3df_none); + PlaySound(DIGI_SWORDCLANK, hit.hitpos, v3df_none); break; case TRASHCAN: if (hitActor->user.WaitTics <= 0) @@ -11656,7 +11656,7 @@ int InitSwordAttack(PLAYER* pp) ChangeState(hitActor, s_TrashCanPain); } SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, daang); - PlaySound(DIGI_SWORDCLANK, hit.int_hitpos(), v3df_none); + PlaySound(DIGI_SWORDCLANK, hit.hitpos, v3df_none); PlaySound(DIGI_TRASHLID, hitActor, v3df_none); break; case PACHINKO1: @@ -11665,7 +11665,7 @@ int InitSwordAttack(PLAYER* pp) case PACHINKO4: case 623: SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, daang); - PlaySound(DIGI_SWORDCLANK, hit.int_hitpos(), v3df_none); + PlaySound(DIGI_SWORDCLANK, hit.hitpos, v3df_none); break; } } @@ -11710,7 +11710,7 @@ int InitSwordAttack(PLAYER* pp) else { SpawnSwordSparks(pp, hit.hitSector, hit.hitWall, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, daang); - PlaySound(DIGI_SWORDCLANK, hit.int_hitpos(), v3df_none); + PlaySound(DIGI_SWORDCLANK, hit.hitpos, v3df_none); } } } @@ -11817,7 +11817,7 @@ int InitFistAttack(PLAYER* pp) { case ZILLA_RUN_R0: SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, daang); - PlaySound(DIGI_ARMORHIT, hit.int_hitpos(), v3df_none); + PlaySound(DIGI_ARMORHIT, hit.hitpos, v3df_none); break; case TRASHCAN: if (hitActor->user.WaitTics <= 0) @@ -11826,7 +11826,7 @@ int InitFistAttack(PLAYER* pp) ChangeState(hitActor, s_TrashCanPain); } SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, daang); - PlaySound(DIGI_ARMORHIT, hit.int_hitpos(), v3df_none); + PlaySound(DIGI_ARMORHIT, hit.hitpos, v3df_none); PlaySound(DIGI_TRASHLID, hitActor, v3df_none); break; case PACHINKO1: @@ -11835,7 +11835,7 @@ int InitFistAttack(PLAYER* pp) case PACHINKO4: case 623: SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, daang); - PlaySound(DIGI_ARMORHIT, hit.int_hitpos(), v3df_none); + PlaySound(DIGI_ARMORHIT, hit.hitpos, v3df_none); break; } } @@ -11863,7 +11863,7 @@ int InitFistAttack(PLAYER* pp) case 5063: case 4947: SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, daang); - PlaySound(DIGI_ARMORHIT, hit.int_hitpos(), v3df_none); + PlaySound(DIGI_ARMORHIT, hit.hitpos, v3df_none); if (RandomRange(1000) > 700) PlayerUpdateHealth(pp,1); // Give some health hitActor->spr.cstat |= (CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); @@ -11893,7 +11893,7 @@ int InitFistAttack(PLAYER* pp) else { SpawnSwordSparks(pp, hit.hitSector, hit.hitWall, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, daang); - PlaySound(DIGI_ARMORHIT, hit.int_hitpos(), v3df_none); + PlaySound(DIGI_ARMORHIT, hit.hitpos, v3df_none); if (PlayerTakeDamage(pp, nullptr)) { PlayerUpdateHealth(pp, -(RandomRange(2<<8)>>8));