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

Method PlayNext

ogsr_engine/xrGame/PHSoundPlayer.cpp:47–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47void CPHSoundPlayer::PlayNext(SGameMtlPair* mtl_pair, Fvector* pos, bool check_vel, float* vol)
48{
49 if (check_vel)
50 {
51 Fvector vel;
52 m_object->PHGetLinearVell(vel);
53 if (vel.square_magnitude() <= 0.05f)
54 return;
55 }
56
57 if (auto found = m_next_snd_time.find(mtl_pair); found != m_next_snd_time.end() && found->second > Device.dwTimeGlobal)
58 return;
59
60 auto& snd = GET_RANDOM(mtl_pair->CollideSounds);
61 // Половина от времени звука, поэтому умножаем не на 1000, а на 500.
62 m_next_snd_time[mtl_pair] = Device.dwTimeGlobal + iFloor(snd.get_length_sec() * 500.0f);
63
64 Fvector2* range = nullptr;
65 Fvector2 dist = m_object->CollideSndDist();
66 if (dist.x >= 0.f || dist.y >= 0.f)
67 {
68 if (dist.x < 0.f)
69 dist.x = snd.get_params()->min_distance;
70 if (dist.y < 0.f)
71 dist.y = snd.get_params()->max_distance;
72 range = &dist;
73 }
74
75 snd.play_no_feedback(nullptr, 0, 0, pos, vol, nullptr, range);
76}

Callers 1

TContactShotMarkFunction · 0.80

Calls 8

CollideSndDistMethod · 0.80
PHGetLinearVellMethod · 0.45
square_magnitudeMethod · 0.45
findMethod · 0.45
endMethod · 0.45
get_length_secMethod · 0.45
get_paramsMethod · 0.45
play_no_feedbackMethod · 0.45

Tested by

no test coverage detected