MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / play_sound

Function play_sound

src/SB/Game/zDiscoFloor.cpp:231–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229namespace
230{
231 void play_sound(z_disco_floor& df)
232 {
233 xVec3 var_48;
234
235 xVec3Sub(&var_48, &df.bound.center, (xVec3*)&globals.player.ent.model->Mat->pos);
236
237 if (xVec3Length2(&var_48) < SQR(df.bound.r) * SQR(1.5f) * SQR(1.5f))
238 {
239 df.curr_note++;
240
241 if (df.curr_note >= 5)
242 {
243 df.curr_note = 5.0f * -xurand() - 5.0f;
244 }
245
246 F32 pitch = (df.curr_note >= 0) ? close_encounters[df.curr_note] :
247 blues_scale[(S32)(6.0f * xurand() - 0.01f)];
248 F32 pitch_offset = pitch;
249
250 if (df.transition_delay < 0.05f)
251 {
252 pitch_offset += 17.0f;
253 }
254 else if (df.transition_delay > 1.0f)
255 {
256 pitch_offset += -10.0f;
257 }
258 else
259 {
260 F32 tmp = (df.transition_delay - 0.05f);
261 tmp /= 0.95f;
262 tmp = (1.0f - tmp) * 27.0f;
263 tmp += -10.0f;
264
265 pitch_offset += tmp;
266 }
267
268 xSndPlay3D(xStrHash("Disco_6_Alt"), 0.231f, pitch_offset, 0, 0, &df.bound.center,
269 0.75f * df.bound.r, 1.5f * df.bound.r, SND_CAT_GAME, 0.0f);
270
271 df.sound_delay = 0.0f;
272 }
273 }
274
275 size_t state_byte_size(size_t mask_size);
276

Callers 1

update_transitionFunction · 0.70

Calls 5

xVec3SubFunction · 0.85
xVec3Length2Function · 0.85
xurandFunction · 0.85
xSndPlay3DFunction · 0.70
xStrHashFunction · 0.50

Tested by

no test coverage detected