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

Method SndPlayFromAFX

src/SB/Game/zNPCTypeCommon.cpp:3000–3037  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2998}
2999
3000S32 zNPCCommon::SndPlayFromAFX(zAnimFxSound* afxsnd, U32* sid_played)
3001{
3002 en_NPC_SOUND sndtype;
3003 F32 radius;
3004 U32 aidToPlay;
3005 U32 xsid;
3006 NPCSndProp* sprop;
3007
3008 sndtype =
3009 NPCS_SndTypeFromHash(afxsnd->ID, this->cfg_npc->snd_trax, this->cfg_npc->snd_traxShare);
3010 xsid = NPCS_SndOkToPlay(sndtype); // Already returns S32
3011 if ((S32)xsid == 0) // U32 in dwarf but needs to be compared as S32
3012 {
3013 xsid = -1;
3014 }
3015 else
3016 {
3017 sprop = NPCS_SndFindProps(sndtype);
3018
3019 radius = this->cfg_npc->rad_sound;
3020 if (sndtype == NPC_STYP_BOGUS)
3021 {
3022 aidToPlay = afxsnd->ID;
3023 }
3024 else
3025 {
3026 aidToPlay =
3027 NPCS_SndPickSimilar(sndtype, this->cfg_npc->snd_trax, this->cfg_npc->snd_traxShare);
3028 }
3029 aidToPlay = this->SndStart(aidToPlay, sprop, radius);
3030 if (sid_played != 0x0)
3031 {
3032 *sid_played = aidToPlay;
3033 }
3034 xsid = 1;
3035 }
3036 return xsid;
3037}
3038
3039S32 zNPCCommon::SndPlayFromSFX(xSFX* sfx, U32* sid_played)
3040{

Callers 1

soundEffectCBFunction · 0.80

Calls 5

SndStartMethod · 0.95
NPCS_SndOkToPlayFunction · 0.85
NPCS_SndTypeFromHashFunction · 0.70
NPCS_SndFindPropsFunction · 0.70
NPCS_SndPickSimilarFunction · 0.70

Tested by

no test coverage detected