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 }
559
560 static bool trigger_sound(const xtextbox::jot& j)
561 {
562 if (shared.quitting)
563 {
564 shared.sounds.clear();
565 speak_stop();
566 return true;
567 }
568
569 sound_context& c = *(sound_context*)j.context;
570
571 switch (c.action)
572 {
573 case sound_context::ACTION_PUSH:
574 break;
575 case sound_context::ACTION_POP:
576 if (shared.sounds.size() > 0)
577 {
578 shared.sounds.pop();
579 return 1;
580 }
581 break;
582 case sound_context::ACTION_SET:
583 shared.sounds.clear();
584 speak_stop();
585 return 1;
586 }
587
588 if (c.id == 0)
589 {
590 return true;
591 }
592
593 F32 vol = c.volume.left;
594 if (!(vol > c.volume.right))
595 {
596 vol = c.volume.right;
597 }
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