| 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; |
nothing calls this directly
no test coverage detected