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

Function trigger_sound

src/SB/Game/zTalkBox.cpp:560–664  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

558 static bool trigger_sound(const xtextbox::jot& j)
559 {
560 if (shared.quitting)
561 {
562 shared.sounds.clear();
563 speak_stop();
564 return true;
565 }
566
567 sound_context& c = *(sound_context*)j.context;
568
569 switch (c.action)
570 {
571 case sound_context::ACTION_PUSH:
572 break;
573 case sound_context::ACTION_POP:
574 if (shared.sounds.size() > 0)
575 {
576 shared.sounds.pop();
577 }
578 break;
579 case sound_context::ACTION_SET:
580 shared.sounds.clear();
581 speak_stop();
582 break;
583 }
584
585 if (c.id == 0)
586 {
587 return true;
588 }
589
590 F32 vol = c.volume.left;
591 if (vol > c.volume.right)
592 {
593 vol = vol;
594 }
595 else
596 {
597 vol = c.volume.right;
598 }
599 shared.sounds.play(c.id, shared.volume * vol, 0.0f, 0x80, 0,
600 (U32)&shared.stream_locked[shared.next_stream], SND_CAT_DIALOG);
601
602 shared.next_stream ^= 1;
603
604 zNPCCommon* npc = NULL;
605 xEnt* player = NULL;
606 ztalkbox& talk = *shared.active;
607
608 switch (c.speaker)
609 {
610 case 0:
611 break;
612 case 1:
613 player = (xEnt*)&globals.player.ent;
614 break;
615 case 2:
616 npc = talk.npc;
617 break;

Callers

nothing calls this directly

Calls 10

speak_stopFunction · 0.85
zSceneFindObjectFunction · 0.85
xGroupGetCountFunction · 0.85
xGroupGetItemPtrFunction · 0.85
xEntIsVisibleFunction · 0.85
popMethod · 0.80
zEntPlayerSpeakStartFunction · 0.70
clearMethod · 0.45
sizeMethod · 0.45
SpeakStartMethod · 0.45

Tested by

no test coverage detected