Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit fe9f922

Browse files
committed
Updated entities that call playsound so they play at position instead of wrapping in SceneMan::TargetDistanceScalar
1 parent 39ff5cd commit fe9f922

File tree

10 files changed

+43
-43
lines changed

10 files changed

+43
-43
lines changed

Entities/ACrab.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2346,7 +2346,7 @@ void ACrab::Update()
23462346
if (!pDevice->IsFull() && m_Controller.IsState(WEAPON_RELOAD))
23472347
{
23482348
pDevice->Reload();
2349-
m_DeviceSwitchSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
2349+
m_DeviceSwitchSound.Play(m_Pos);
23502350

23512351
// Interrupt sharp aiming
23522352
m_SharpAimTimer.Reset();
@@ -2581,7 +2581,7 @@ void ACrab::Update()
25812581

25822582
// Play the stride sound, if applicable
25832583
if (playStride)
2584-
m_StrideSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
2584+
m_StrideSound.Play(m_Pos);
25852585
}
25862586
// JUMPING
25872587
else if ((m_pRFGLeg || m_pRBGLeg) && m_MoveState == JUMP)

Entities/ACraft.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ void ACraft::OpenHatch()
591591
m_HatchTimer.Reset();
592592

593593
// PSCHHT
594-
m_HatchOpenSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
594+
m_HatchOpenSound.Play(m_Pos);
595595
}
596596
}
597597

@@ -618,7 +618,7 @@ void ACraft::CloseHatch()
618618
m_NewInventory.clear();
619619

620620
// PSCHHT
621-
m_HatchOpenSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
621+
m_HatchOpenSound.Play(m_Pos);
622622
}
623623
}
624624

@@ -777,7 +777,7 @@ void ACraft::DropAllInventory()
777777
{
778778
if (m_HatchState != OPENING)
779779
{
780-
m_HatchOpenSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
780+
m_HatchOpenSound.Play(m_Pos);
781781
g_MovableMan.RegisterAlarmEvent(AlarmEvent(m_Pos, m_Team, 0.4));
782782
m_HatchTimer.Reset();
783783
}
@@ -846,7 +846,7 @@ void ACraft::Update()
846846
// TODO: HELLA GHETTO, REWORK
847847
if (m_CrashTimer.GetElapsedSimTimeMS() > 500)
848848
{
849-
m_CrashSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
849+
m_CrashSound.Play(m_Pos);
850850
m_CrashTimer.Reset();
851851
}
852852
}
@@ -918,7 +918,7 @@ void ACraft::Update()
918918
m_Status = DYING;
919919
m_HatchState = OPENING;
920920
m_HatchTimer.Reset();
921-
m_HatchOpenSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
921+
m_HatchOpenSound.Play(m_Pos);
922922
}
923923
*/
924924
/////////////////////////////////////////

Entities/AEmitter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ void AEmitter::Destroy(bool notInherited)
294294
*/
295295
// Stop playback of sounds gracefully
296296
if (m_EmissionSound.IsBeingPlayed())
297-
m_EndSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
297+
m_EndSound.Play(m_Pos);
298298
else
299299
m_EndSound.Stop();
300300

@@ -434,15 +434,15 @@ void AEmitter::Update()
434434
if (!m_WasEmitting)
435435
{
436436
// Start playing the sound
437-
m_EmissionSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
437+
m_EmissionSound.Play(m_Pos);
438438

439439
// Reset the timers of all emissions so they will start/stop at the correct relative offsets from now
440440
for (list<Emission *>::iterator eItr = m_EmissionList.begin(); eItr != m_EmissionList.end(); ++eItr)
441441
(*eItr)->ResetEmissionTimers();
442442
}
443443
// Update the distance attenuation
444444
else
445-
m_EmissionSound.UpdateAttenuation(g_SceneMan.TargetDistanceScalar(m_Pos));
445+
m_EmissionSound.SetPosition(m_Pos);
446446

447447
// Get the parent root of this AEmitter
448448
// TODO: Potentially get this once outside instead, like in attach/detach")
@@ -461,7 +461,7 @@ void AEmitter::Update()
461461
if (m_BurstTriggered && (m_BurstSpacing <= 0 || m_BurstTimer.IsPastSimMS(m_BurstSpacing)))
462462
{
463463
// Play burst sound
464-
m_BurstSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
464+
m_BurstSound.Play(m_Pos);
465465
// Start timing until next burst
466466
m_BurstTimer.Reset();
467467
}
@@ -617,7 +617,7 @@ void AEmitter::Update()
617617
{
618618
m_EmissionSound.Stop();
619619
m_BurstSound.Stop();
620-
m_EndSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
620+
m_EndSound.Play(m_Pos);
621621
m_WasEmitting = false;
622622
}
623623
}

Entities/AHuman.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ bool AHuman::EquipFirearm(bool doEquip)
902902
EquipShieldInBGArm();
903903

904904
// Play the device switching sound
905-
m_DeviceSwitchSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
905+
m_DeviceSwitchSound.Play(m_Pos);
906906
}
907907

908908
return true;
@@ -964,7 +964,7 @@ bool AHuman::EquipDeviceInGroup(string group, bool doEquip)
964964
EquipShieldInBGArm();
965965

966966
// Play the device switching sound
967-
m_DeviceSwitchSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
967+
m_DeviceSwitchSound.Play(m_Pos);
968968
}
969969

970970
return true;
@@ -1026,7 +1026,7 @@ bool AHuman::EquipLoadedFirearmInGroup(string group, string excludeGroup, bool d
10261026
EquipShieldInBGArm();
10271027

10281028
// Play the device switching sound
1029-
m_DeviceSwitchSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
1029+
m_DeviceSwitchSound.Play(m_Pos);
10301030
}
10311031

10321032
return true;
@@ -1088,7 +1088,7 @@ bool AHuman::EquipNamedDevice(const string name, bool doEquip)
10881088
EquipShieldInBGArm();
10891089

10901090
// Play the device switching sound
1091-
m_DeviceSwitchSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
1091+
m_DeviceSwitchSound.Play(m_Pos);
10921092
}
10931093

10941094
return true;
@@ -1152,7 +1152,7 @@ bool AHuman::EquipThrowable(bool doEquip)
11521152
EquipShieldInBGArm();
11531153

11541154
// Play the device switching sound
1155-
m_DeviceSwitchSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
1155+
m_DeviceSwitchSound.Play(m_Pos);
11561156
}
11571157

11581158
return true;
@@ -1214,7 +1214,7 @@ bool AHuman::EquipDiggingTool(bool doEquip)
12141214
EquipShieldInBGArm();
12151215

12161216
// Play the device switching sound
1217-
m_DeviceSwitchSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
1217+
m_DeviceSwitchSound.Play(m_Pos);
12181218
}
12191219

12201220
return true;
@@ -1309,7 +1309,7 @@ bool AHuman::EquipShield()
13091309
EquipShieldInBGArm();
13101310

13111311
// Play the device switching sound
1312-
m_DeviceSwitchSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
1312+
m_DeviceSwitchSound.Play(m_Pos);
13131313

13141314
return true;
13151315
}
@@ -1381,7 +1381,7 @@ bool AHuman::EquipShieldInBGArm()
13811381
// Play the device switching sound only if activity is running
13821382
if (g_ActivityMan.ActivityRunning())
13831383
{
1384-
m_DeviceSwitchSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
1384+
m_DeviceSwitchSound.Play(m_Pos);
13851385
}
13861386

13871387
return true;
@@ -3412,7 +3412,7 @@ void AHuman::Update()
34123412
pDevice->Reload();
34133413
if (m_pBGArm && m_pBGArm->IsAttached())
34143414
m_pBGArm->SetHandPos(m_Pos + m_HolsterOffset.GetXFlipped(m_HFlipped));
3415-
m_DeviceSwitchSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
3415+
m_DeviceSwitchSound.Play(m_Pos);
34163416

34173417
// Interrupt sharp aiming
34183418
m_SharpAimTimer.Reset();
@@ -3729,7 +3729,7 @@ void AHuman::Update()
37293729
m_Inventory.push_back(m_pItemInReach);
37303730
}
37313731
m_PieNeedsUpdate = true;
3732-
m_DeviceSwitchSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
3732+
m_DeviceSwitchSound.Play(m_Pos);
37333733
}
37343734
}
37353735

@@ -3795,7 +3795,7 @@ void AHuman::Update()
37953795

37963796
// Play the stride sound, if applicable
37973797
if (playStride && !m_ArmClimbing[FGROUND] && !m_ArmClimbing[BGROUND])
3798-
m_StrideSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
3798+
m_StrideSound.Play(m_Pos);
37993799

38003800
////////////////////////////////////////
38013801
// Arm Climbing if the leg paths failed to find clear spot to restart

Entities/Actor.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ MovableObject * Actor::SwapNextInventory(MovableObject *pSwapIn, bool muteSound)
844844
}
845845

846846
if (playSound && !muteSound)
847-
m_DeviceSwitchSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
847+
m_DeviceSwitchSound.Play(m_Pos);
848848

849849
return pRetDev;
850850
}
@@ -896,7 +896,7 @@ MovableObject * Actor::SwapPrevInventory(MovableObject *pSwapIn)
896896
}
897897

898898
if (playSound)
899-
m_DeviceSwitchSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
899+
m_DeviceSwitchSound.Play(m_Pos);
900900

901901
return pRetDev;
902902
}
@@ -993,7 +993,7 @@ void Actor::GibThis(Vector impactImpulse, float internalBlast, MovableObject *pI
993993
{
994994
// Play death sound
995995
// TODO: Don't attenuate since death is pretty important.. maybe only make this happen for teh brains
996-
m_DeathSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
996+
m_DeathSound.Play(m_Pos);
997997

998998
// Gib all the regular gibs
999999
MOSRotating::GibThis(impactImpulse, internalBlast, pIgnoreMO);
@@ -1555,11 +1555,11 @@ void Actor::Update()
15551555

15561556
if (m_TravelImpulse.GetMagnitude() > m_TravelImpulseDamage / 2)
15571557
{
1558-
m_BodyHitSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
1558+
m_BodyHitSound.Play(m_Pos);
15591559
}
15601560
if (m_TravelImpulse.GetMagnitude() > m_TravelImpulseDamage)
15611561
{
1562-
m_PainSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
1562+
m_PainSound.Play(m_Pos);
15631563
// TODO: IMPROVE AND DON'T HARDCODE
15641564
//m_Health -= 10;
15651565
float impulse = m_TravelImpulse.GetMagnitude() - m_TravelImpulseDamage;
@@ -1630,7 +1630,7 @@ void Actor::Update()
16301630

16311631
if (m_Status != DYING && m_Status != DEAD && floorf(m_Health) <= 0)
16321632
{
1633-
m_DeathSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
1633+
m_DeathSound.Play(m_Pos);
16341634
m_Controller.SetDisabled(true);
16351635
DropAllInventory();
16361636
m_Status = DYING;

Entities/HDFirearm.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ void HDFirearm::Reload()
634634
if (m_FireSound.GetLoopSetting() == -1 && m_FireSound.IsBeingPlayed())
635635
m_FireSound.Stop();
636636

637-
m_ReloadStartSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
637+
m_ReloadStartSound.Play(m_Pos);
638638
m_ReloadTmr.Reset();
639639
m_Reloading = true;
640640
}
@@ -867,7 +867,7 @@ void HDFirearm::Update()
867867
// Sound the extra Round firing sound, if any is defined
868868
if (!playedRoundFireSound && pRound->HasFireSound())
869869
{
870-
pRound->GetFireSound()->Play(g_SceneMan.TargetDistanceScalar(m_Pos));
870+
pRound->GetFireSound()->Play(m_Pos);
871871
playedRoundFireSound = true;
872872
}
873873

@@ -895,7 +895,7 @@ void HDFirearm::Update()
895895
if (m_FireSound.GetLoopSetting() == -1 && m_FireSound.IsBeingPlayed())
896896
m_FireSound.Stop();
897897
898-
m_ReloadStartSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
898+
m_ReloadStartSound.Play(m_Pos);
899899
900900
m_ReloadTmr.Reset();
901901
}
@@ -905,7 +905,7 @@ void HDFirearm::Update()
905905
else if (((m_pMagazine && m_pMagazine->IsEmpty()) || !m_pMagazine) && m_Activated && !m_AlreadyClicked )
906906
{
907907
// Play empty pin click sound.
908-
m_EmptySound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
908+
m_EmptySound.Play(m_Pos);
909909
// Indicate that we have clicked once during the current activation.
910910
m_AlreadyClicked = true;
911911

@@ -920,7 +920,7 @@ void HDFirearm::Update()
920920
if (m_pMagazine)
921921
{
922922
m_pMagazine->Attach(this);
923-
m_ReloadEndSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
923+
m_ReloadEndSound.Play(m_Pos);
924924

925925
m_ActivationTmr.Reset();
926926
m_ActivationTmr.Reset();
@@ -986,7 +986,7 @@ void HDFirearm::Update()
986986
// Play firing sound
987987
// Only start playing if it's not a looping fire sound that is already playing, and if there's a mag
988988
if (!(m_FireSound.GetLoopSetting() == -1 && m_FireSound.IsBeingPlayed()) && m_pMagazine)
989-
m_FireSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
989+
m_FireSound.Play(m_Pos);
990990
}
991991
else {
992992
m_Recoiled = false;

Entities/MOSRotating.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ void MOSRotating::GibThis(Vector impactImpulse, float internalBlast, MovableObje
11681168
m_AllAttachables.clear();
11691169

11701170
// Play the gib sound
1171-
m_GibSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
1171+
m_GibSound.Play(m_Pos);
11721172

11731173
// Flash post effect if it is defined
11741174
if (m_pScreenEffect && m_EffectOnGib && (m_EffectAlwaysShows || !g_SceneMan.ObscuredPoint(m_Pos.GetFloorIntX(), m_Pos.GetFloorIntY())))

Entities/PEmitter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ namespace RTE {
255255
*/
256256
// Stop playback of sounds gracefully
257257
if (m_EmissionSound.IsBeingPlayed())
258-
m_EndSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
258+
m_EndSound.Play(m_Pos);
259259
else
260260
m_EndSound.Stop();
261261

@@ -384,15 +384,15 @@ namespace RTE {
384384
if (!m_WasEmitting)
385385
{
386386
// Start playing the sound
387-
m_EmissionSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
387+
m_EmissionSound.Play(m_Pos);
388388

389389
// Reset the timers of all emissions so they will start/stop at the correct relative offsets from now
390390
for (list<Emission>::iterator eItr = m_EmissionList.begin(); eItr != m_EmissionList.end(); ++eItr)
391391
(*eItr).ResetEmissionTimers();
392392
}
393393
// Update the distance attenuation
394394
else
395-
m_EmissionSound.UpdateAttenuation(g_SceneMan.TargetDistanceScalar(m_Pos));
395+
m_EmissionSound.SetPosition(m_Pos);
396396

397397
// Get the parent root of this PEmitter
398398
// TODO: Potentially get this once outside instead, like in attach/detach")
@@ -411,7 +411,7 @@ namespace RTE {
411411
if (m_BurstTriggered && (m_BurstSpacing <= 0 || m_BurstTimer.IsPastSimMS(m_BurstSpacing)))
412412
{
413413
// Play burst sound
414-
m_BurstSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
414+
m_BurstSound.Play(m_Pos);
415415
// Start timing until next burst
416416
m_BurstTimer.Reset();
417417
}
@@ -521,7 +521,7 @@ namespace RTE {
521521
{
522522
m_EmissionSound.Stop();
523523
m_BurstSound.Stop();
524-
m_EndSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
524+
m_EndSound.Play(m_Pos);
525525
m_WasEmitting = false;
526526
}
527527
}

Entities/ThrownDevice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ namespace RTE {
120120
void ThrownDevice::Activate() {
121121
if (!m_Activated) {
122122
m_ActivationTmr.Reset();
123-
m_ActivationSound.Play(g_SceneMan.TargetDistanceScalar(m_Pos));
123+
m_ActivationSound.Play(m_Pos);
124124
m_Activated = true;
125125
}
126126
}

Managers/SceneMan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,7 @@ bool SceneMan::RevealUnseen(const int posX, const int posY, const int team)
15191519
putpixel(pUnseenLayer->GetBitmap(), scaledX, scaledY, g_KeyColor);
15201520
// Play the reveal sound, if there's not too many already revealed this frame
15211521
if (g_SettingsMan.BlipOnRevealUnseen() && m_pUnseenRevealSound && m_pCurrentScene->GetSeenPixels(team).size() < 5)
1522-
m_pUnseenRevealSound->Play(g_SceneMan.TargetDistanceScalar(Vector(posX, posY)));
1522+
m_pUnseenRevealSound->Play(Vector(posX, posY));
15231523
// Show that we actually cleared an unseen pixel
15241524
return true;
15251525
}

0 commit comments

Comments
 (0)