From 83b277d404732b01c21775a0141d8f1359378a05 Mon Sep 17 00:00:00 2001 From: Xottab-DUTY Date: Mon, 4 Dec 2023 07:27:55 +0500 Subject: [PATCH] Use ref_sound::create instead of GEnv.Sound->create --- src/xrGame/Actor.cpp | 8 ++++---- src/xrGame/Level_load.cpp | 2 +- src/xrGame/ai/crow/ai_crow.cpp | 6 +++--- src/xrGame/ai/monsters/burer/burer.cpp | 6 +++--- .../ai/monsters/controller/controller.cpp | 5 ++--- .../poltergeist/poltergeist_telekinesis.cpp | 4 ++-- .../monsters/pseudogigant/pseudo_gigant.cpp | 6 ++---- .../ai/monsters/scanning_ability_inline.h | 2 +- src/xrGame/ui/UIActorMenuInitialize.cpp | 20 +++++++++---------- src/xrUICore/Buttons/UI3tButton.cpp | 4 ++-- 10 files changed, 30 insertions(+), 33 deletions(-) diff --git a/src/xrGame/Actor.cpp b/src/xrGame/Actor.cpp index 389342beb54..985642a8e37 100644 --- a/src/xrGame/Actor.cpp +++ b/src/xrGame/Actor.cpp @@ -409,10 +409,10 @@ void CActor::Load(LPCSTR section) } } - GEnv.Sound->create(sndDie[0], strconcat(buf, *cName(), "\\die0"), st_Effect, SOUND_TYPE_MONSTER_DYING); - GEnv.Sound->create(sndDie[1], strconcat(buf, *cName(), "\\die1"), st_Effect, SOUND_TYPE_MONSTER_DYING); - GEnv.Sound->create(sndDie[2], strconcat(buf, *cName(), "\\die2"), st_Effect, SOUND_TYPE_MONSTER_DYING); - GEnv.Sound->create(sndDie[3], strconcat(buf, *cName(), "\\die3"), st_Effect, SOUND_TYPE_MONSTER_DYING); + sndDie[0].create(strconcat(buf, *cName(), "\\die0"), st_Effect, SOUND_TYPE_MONSTER_DYING); + sndDie[1].create(strconcat(buf, *cName(), "\\die1"), st_Effect, SOUND_TYPE_MONSTER_DYING); + sndDie[2].create(strconcat(buf, *cName(), "\\die2"), st_Effect, SOUND_TYPE_MONSTER_DYING); + sndDie[3].create(strconcat(buf, *cName(), "\\die3"), st_Effect, SOUND_TYPE_MONSTER_DYING); m_HeavyBreathSnd.create( pSettings->r_string(section, "heavy_breath_snd"), st_Effect, SOUND_TYPE_MONSTER_INJURING); diff --git a/src/xrGame/Level_load.cpp b/src/xrGame/Level_load.cpp index 5790e34fda1..b1c6776b38a 100644 --- a/src/xrGame/Level_load.cpp +++ b/src/xrGame/Level_load.cpp @@ -109,7 +109,7 @@ bool CLevel::Load_GameSpecific_After() for (auto I = S.Data.cbegin(); S.Data.cend() != I; ++I) { Sounds_Random.push_back(ref_sound()); - GEnv.Sound->create(Sounds_Random.back(), *I->first, st_Effect, sg_SourceType); + Sounds_Random.back().create(*I->first, st_Effect, sg_SourceType); } Sounds_Random_dwNextTime = Device.TimerAsync() + 50000; Sounds_Random_Enabled = FALSE; diff --git a/src/xrGame/ai/crow/ai_crow.cpp b/src/xrGame/ai/crow/ai_crow.cpp index ea51ad5f520..76b423b236c 100644 --- a/src/xrGame/ai/crow/ai_crow.cpp +++ b/src/xrGame/ai/crow/ai_crow.cpp @@ -59,7 +59,7 @@ void CAI_Crow::SSound::Load(LPCSTR prefix) if (FS.exist(fn, "$game_sounds$", prefix, ".ogg")) { m_Sounds.push_back(ref_sound()); - GEnv.Sound->create(m_Sounds.back(), prefix, st_Effect, sg_SourceType); + m_Sounds.back().create(prefix, st_Effect, sg_SourceType); } for (int i = 0; (i < MAX_SND_COUNT) && (m_Sounds.size() < MAX_SND_COUNT); ++i) { @@ -68,7 +68,7 @@ void CAI_Crow::SSound::Load(LPCSTR prefix) if (FS.exist(fn, "$game_sounds$", name, ".ogg")) { m_Sounds.push_back(ref_sound()); - GEnv.Sound->create(m_Sounds.back(), name, st_Effect, sg_SourceType); + m_Sounds.back().create(name, st_Effect, sg_SourceType); } } R_ASSERT(m_Sounds.size()); @@ -84,7 +84,7 @@ void CAI_Crow::SSound::SetPosition(const Fvector& pos) void CAI_Crow::SSound::Unload() { for (auto& sound : m_Sounds) - GEnv.Sound->destroy(sound); + sound.destroy(); } void cb_OnHitEndPlaying(CBlend* B) { ((CAI_Crow*)B->CallbackParam)->OnHitEndPlaying(B); } diff --git a/src/xrGame/ai/monsters/burer/burer.cpp b/src/xrGame/ai/monsters/burer/burer.cpp index fca7823baa8..bd309137829 100644 --- a/src/xrGame/ai/monsters/burer/burer.cpp +++ b/src/xrGame/ai/monsters/burer/burer.cpp @@ -88,9 +88,9 @@ void CBurer::Load(LPCSTR section) particle_gravi_prepare = pSettings->r_string(section, "Particle_Gravi_Prepare"); particle_tele_object = pSettings->r_string(section, "Particle_Tele_Object"); - GEnv.Sound->create(sound_gravi_wave, pSettings->r_string(section, "sound_gravi_wave"), st_Effect, SOUND_TYPE_WORLD); - GEnv.Sound->create(sound_tele_hold, pSettings->r_string(section, "sound_tele_hold"), st_Effect, SOUND_TYPE_WORLD); - GEnv.Sound->create(sound_tele_throw, pSettings->r_string(section, "sound_tele_throw"), st_Effect, SOUND_TYPE_WORLD); + sound_gravi_wave.create(pSettings->r_string(section, "sound_gravi_wave"), st_Effect, SOUND_TYPE_WORLD); + sound_tele_hold.create(pSettings->r_string(section, "sound_tele_hold"), st_Effect, SOUND_TYPE_WORLD); + sound_tele_throw.create(pSettings->r_string(section, "sound_tele_throw"), st_Effect, SOUND_TYPE_WORLD); m_gravi.cooldown = pSettings->r_u32(section, "Gravi_Cooldown"); m_gravi.min_dist = pSettings->r_float(section, "Gravi_MinDist"); diff --git a/src/xrGame/ai/monsters/controller/controller.cpp b/src/xrGame/ai/monsters/controller/controller.cpp index 8bf4c2d2050..8056787e296 100644 --- a/src/xrGame/ai/monsters/controller/controller.cpp +++ b/src/xrGame/ai/monsters/controller/controller.cpp @@ -82,9 +82,8 @@ void CController::Load(LPCSTR section) // anim().accel_chain_add (eAnimWalkFwd, eAnimRun); // anim().accel_chain_add (eAnimWalkDamaged, eAnimRunDamaged); - GEnv.Sound->create( - control_start_sound, pSettings->r_string(section, "sound_control_start"), st_Effect, SOUND_TYPE_WORLD); - GEnv.Sound->create(control_hit_sound, pSettings->r_string(section, "sound_control_hit"), st_Effect, SOUND_TYPE_WORLD); + control_start_sound.create(pSettings->r_string(section, "sound_control_start"), st_Effect, SOUND_TYPE_WORLD); + control_hit_sound.create(pSettings->r_string(section, "sound_control_hit"), st_Effect, SOUND_TYPE_WORLD); anim().AddReplacedAnim(&m_bDamaged, eAnimStandIdle, eAnimStandDamaged); anim().AddReplacedAnim(&m_bDamaged, eAnimRun, eAnimRunDamaged); diff --git a/src/xrGame/ai/monsters/poltergeist/poltergeist_telekinesis.cpp b/src/xrGame/ai/monsters/poltergeist/poltergeist_telekinesis.cpp index 41ea33f6b56..b5f86cdd79d 100644 --- a/src/xrGame/ai/monsters/poltergeist/poltergeist_telekinesis.cpp +++ b/src/xrGame/ai/monsters/poltergeist/poltergeist_telekinesis.cpp @@ -29,8 +29,8 @@ void CPolterTele::load(LPCSTR section) READ_IF_EXISTS(pSettings, r_u32, section, "Tele_Delay_Between_Objects_Raise_Time", 500); m_pmt_fly_velocity = READ_IF_EXISTS(pSettings, r_float, section, "Tele_Fly_Velocity", 30.f); m_pmt_object_collision_damage = READ_IF_EXISTS(pSettings, r_float, section, "Tele_Collision_Damage", 0.5f); - GEnv.Sound->create(m_sound_tele_hold, pSettings->r_string(section, "sound_tele_hold"), st_Effect, SOUND_TYPE_WORLD); - GEnv.Sound->create(m_sound_tele_throw, pSettings->r_string(section, "sound_tele_throw"), st_Effect, SOUND_TYPE_WORLD); + m_sound_tele_hold.create(pSettings->r_string(section, "sound_tele_hold"), st_Effect, SOUND_TYPE_WORLD); + m_sound_tele_throw.create(pSettings->r_string(section, "sound_tele_throw"), st_Effect, SOUND_TYPE_WORLD); m_state = eWait; m_time = 0; diff --git a/src/xrGame/ai/monsters/pseudogigant/pseudo_gigant.cpp b/src/xrGame/ai/monsters/pseudogigant/pseudo_gigant.cpp index 6e395abc856..8fd18d1dc3d 100644 --- a/src/xrGame/ai/monsters/pseudogigant/pseudo_gigant.cpp +++ b/src/xrGame/ai/monsters/pseudogigant/pseudo_gigant.cpp @@ -200,10 +200,8 @@ void CPseudoGigant::Load(LPCSTR section) // -------------------------------------------------------------------------------- - GEnv.Sound->create( - m_sound_threaten_hit, pSettings->r_string(section, "sound_threaten_hit"), st_Effect, SOUND_TYPE_WORLD); - GEnv.Sound->create(m_sound_start_threaten, pSettings->r_string(section, "sound_threaten_start"), st_Effect, - SOUND_TYPE_MONSTER_ATTACKING); + m_sound_threaten_hit.create(pSettings->r_string(section, "sound_threaten_hit"), st_Effect, SOUND_TYPE_WORLD); + m_sound_start_threaten.create(pSettings->r_string(section, "sound_threaten_start"), st_Effect, SOUND_TYPE_MONSTER_ATTACKING); m_kick_damage = pSettings->r_float(section, "HugeKick_Damage"); m_kick_particles = pSettings->r_string(section, "HugeKick_Particles"); diff --git a/src/xrGame/ai/monsters/scanning_ability_inline.h b/src/xrGame/ai/monsters/scanning_ability_inline.h index 059290ced6a..93acfda946b 100644 --- a/src/xrGame/ai/monsters/scanning_ability_inline.h +++ b/src/xrGame/ai/monsters/scanning_ability_inline.h @@ -18,7 +18,7 @@ void CScanningAbilityAbstract::on_destroy() TEMPLATE_SPECIALIZATION void CScanningAbilityAbstract::load(LPCSTR section) { - GEnv.Sound->create(sound_scan, pSettings->r_string(section, "scan_sound"), st_Effect, SOUND_TYPE_WORLD); + sound_scan.create(pSettings->r_string(section, "scan_sound"), st_Effect, SOUND_TYPE_WORLD); critical_value = pSettings->r_float(section, "scan_critical_value"); scan_radius = pSettings->r_float(section, "scan_radius"); diff --git a/src/xrGame/ui/UIActorMenuInitialize.cpp b/src/xrGame/ui/UIActorMenuInitialize.cpp index 26ee3547382..25c0617118a 100644 --- a/src/xrGame/ui/UIActorMenuInitialize.cpp +++ b/src/xrGame/ui/UIActorMenuInitialize.cpp @@ -459,16 +459,16 @@ void CUIActorMenu::InitSounds(CUIXml& uiXml) { XML_NODE stored_root = uiXml.GetLocalRoot(); uiXml.SetLocalRoot(uiXml.NavigateToNode("action_sounds", 0)); - GEnv.Sound->create(sounds[eSndOpen], uiXml.Read("snd_open", 0, NULL), st_Effect, sg_SourceType); - GEnv.Sound->create(sounds[eSndClose], uiXml.Read("snd_close", 0, NULL), st_Effect, sg_SourceType); - GEnv.Sound->create(sounds[eItemToSlot], uiXml.Read("snd_item_to_slot", 0, NULL), st_Effect, sg_SourceType); - GEnv.Sound->create(sounds[eItemToBelt], uiXml.Read("snd_item_to_belt", 0, NULL), st_Effect, sg_SourceType); - GEnv.Sound->create(sounds[eItemToRuck], uiXml.Read("snd_item_to_ruck", 0, NULL), st_Effect, sg_SourceType); - GEnv.Sound->create(sounds[eProperties], uiXml.Read("snd_properties", 0, NULL), st_Effect, sg_SourceType); - GEnv.Sound->create(sounds[eDropItem], uiXml.Read("snd_drop_item", 0, NULL), st_Effect, sg_SourceType); - GEnv.Sound->create(sounds[eAttachAddon], uiXml.Read("snd_attach_addon", 0, NULL), st_Effect, sg_SourceType); - GEnv.Sound->create(sounds[eDetachAddon], uiXml.Read("snd_detach_addon", 0, NULL), st_Effect, sg_SourceType); - GEnv.Sound->create(sounds[eItemUse], uiXml.Read("snd_item_use", 0, NULL), st_Effect, sg_SourceType); + sounds[eSndOpen].create(uiXml.Read("snd_open", 0, NULL), st_Effect, sg_SourceType); + sounds[eSndClose].create(uiXml.Read("snd_close", 0, NULL), st_Effect, sg_SourceType); + sounds[eItemToSlot].create(uiXml.Read("snd_item_to_slot", 0, NULL), st_Effect, sg_SourceType); + sounds[eItemToBelt].create(uiXml.Read("snd_item_to_belt", 0, NULL), st_Effect, sg_SourceType); + sounds[eItemToRuck].create(uiXml.Read("snd_item_to_ruck", 0, NULL), st_Effect, sg_SourceType); + sounds[eProperties].create(uiXml.Read("snd_properties", 0, NULL), st_Effect, sg_SourceType); + sounds[eDropItem].create(uiXml.Read("snd_drop_item", 0, NULL), st_Effect, sg_SourceType); + sounds[eAttachAddon].create(uiXml.Read("snd_attach_addon", 0, NULL), st_Effect, sg_SourceType); + sounds[eDetachAddon].create(uiXml.Read("snd_detach_addon", 0, NULL), st_Effect, sg_SourceType); + sounds[eItemUse].create(uiXml.Read("snd_item_use", 0, NULL), st_Effect, sg_SourceType); uiXml.SetLocalRoot(stored_root); } diff --git a/src/xrUICore/Buttons/UI3tButton.cpp b/src/xrUICore/Buttons/UI3tButton.cpp index 56474d97e5d..42f4ea6674d 100644 --- a/src/xrUICore/Buttons/UI3tButton.cpp +++ b/src/xrUICore/Buttons/UI3tButton.cpp @@ -34,8 +34,8 @@ void CUI3tButton::OnFocusReceive() PlaySoundH(); } -void CUI3tButton::InitSoundH(LPCSTR sound_file) { GEnv.Sound->create(m_sound_h, sound_file, st_Effect, sg_SourceType); } -void CUI3tButton::InitSoundT(LPCSTR sound_file) { GEnv.Sound->create(m_sound_t, sound_file, st_Effect, sg_SourceType); } +void CUI3tButton::InitSoundH(LPCSTR sound_file) { m_sound_h.create(sound_file, st_Effect, sg_SourceType); } +void CUI3tButton::InitSoundT(LPCSTR sound_file) { m_sound_t.create(sound_file, st_Effect, sg_SourceType); } void CUI3tButton::PlaySoundT() { if (m_sound_t._handle())