MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / Init

Method Init

ogsr_engine/xrGame/CarSound.cpp:22–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20
21CCar::SCarSound::~SCarSound() {}
22void CCar::SCarSound::Init()
23{
24 CInifile* ini = smart_cast<IKinematics*>(pcar->Visual())->LL_UserData();
25 if (ini->section_exist("car_sound") && ini->line_exist("car_sound", "snd_volume"))
26 {
27 volume = ini->r_float("car_sound", "snd_volume");
28
29 snd_engine.create(ini->r_string("car_sound", "snd_name"), st_Effect, sg_SourceType); //
30 snd_engine_start.create(READ_IF_EXISTS(ini, r_string, "car_sound", "engine_start", "car\\test_car_start"), st_Effect, sg_SourceType);
31 snd_engine_stop.create(READ_IF_EXISTS(ini, r_string, "car_sound", "engine_stop", "car\\test_car_stop"), st_Effect, sg_SourceType);
32 float fengine_start_delay = READ_IF_EXISTS(ini, r_float, "car_sound", "engine_sound_start_dellay", 0.25f);
33 engine_start_delay = iFloor((snd_engine_start._handle() ? iFloor(snd_engine_start.get_length_sec() * 1000.0f) : 1.f) * fengine_start_delay);
34 if (ini->line_exist("car_sound", "relative_pos"))
35 {
36 relative_pos.set(ini->r_fvector3("car_sound", "relative_pos"));
37 }
38 if (ini->line_exist("car_sound", "transmission_switch"))
39 {
40 snd_transmission.create(ini->r_string("car_sound", "transmission_switch"), st_Effect, sg_SourceType);
41 }
42 }
43 else
44 {
45 Msg("! Car doesn't contain sound params");
46 }
47 eCarSound = sndOff;
48}
49void CCar::SCarSound::SetSoundPosition(ref_sound& snd)
50{
51 VERIFY(!ph_world->Processing());

Callers

nothing calls this directly

Calls 12

MsgFunction · 0.85
LL_UserDataMethod · 0.80
VisualMethod · 0.80
section_existMethod · 0.80
line_existMethod · 0.80
_handleMethod · 0.80
r_floatMethod · 0.45
createMethod · 0.45
r_stringMethod · 0.45
get_length_secMethod · 0.45
setMethod · 0.45
r_fvector3Method · 0.45

Tested by

no test coverage detected