Skip to content

Commit

Permalink
Use ref_sound::create instead of GEnv.Sound->create
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Dec 4, 2023
1 parent 746132a commit 83b277d
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 33 deletions.
8 changes: 4 additions & 4 deletions src/xrGame/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Level_load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/xrGame/ai/crow/ai_crow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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());
Expand All @@ -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); }
Expand Down
6 changes: 3 additions & 3 deletions src/xrGame/ai/monsters/burer/burer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
5 changes: 2 additions & 3 deletions src/xrGame/ai/monsters/controller/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 2 additions & 4 deletions src/xrGame/ai/monsters/pseudogigant/pseudo_gigant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ai/monsters/scanning_ability_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
20 changes: 10 additions & 10 deletions src/xrGame/ui/UIActorMenuInitialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions src/xrUICore/Buttons/UI3tButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 83b277d

Please sign in to comment.