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

Method SndStart

src/SB/Game/zNPCTypeCommon.cpp:3085–3174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3083}
3084
3085U32 zNPCCommon::SndStart(U32 aid_toplay, NPCSndProp* sprop, F32 radius)
3086{
3087 F32 pvary = 0.0f;
3088 U32 priority;
3089 U32 owner;
3090 U32 xsid = 0;
3091 F32 vol;
3092 U32 flg_snd;
3093 U32 xsndflags;
3094 static const F32 pitchChoices[7] = { -5.0f, -4.0f, -3.0f, -2.0f, -1.0f, 0.0f, 1.0f };
3095
3096 if (sprop == NULL)
3097 {
3098 sprop = NPCS_SndFindProps(NPC_STYP_BOGUS);
3099 }
3100
3101 flg_snd = sprop->flg_snd & 0xFFFFFF;
3102
3103 if (SQ(radius) < NPCC_ds2_toCam(this->Pos(), NULL))
3104 {
3105 return 0;
3106 }
3107
3108 if ((flg_snd & 0x20000) && this->SndChanIsBusy(1))
3109 {
3110 return 0;
3111 }
3112
3113 if ((flg_snd & 0x8000) && this->SndChanIsBusy(3))
3114 {
3115 return 0;
3116 }
3117
3118 static S32 idx_seq = 0;
3119
3120 if (flg_snd & 0x100)
3121 {
3122 vol = 1.0f;
3123 priority = 0x82;
3124 }
3125 else if (flg_snd & 0x200)
3126 {
3127 vol = 0.85f;
3128 priority = 0x7d;
3129 }
3130 else if (flg_snd & 0x400)
3131 {
3132 vol = 0.7f;
3133 priority = 0x79;
3134 }
3135 else
3136 {
3137 vol = 0.85f;
3138 priority = 0x7d;
3139 }
3140
3141 if (flg_snd & 0x800)
3142 {

Callers 5

SndPlayFromAFXMethod · 0.95
SndPlayFromSFXMethod · 0.95
SndPlayRandomMethod · 0.95
SndQueUpdateMethod · 0.95
EnterMethod · 0.80

Calls 8

PosMethod · 0.95
SndChanIsBusyMethod · 0.95
xUtil_chooseFunction · 0.85
NPCS_SndFindPropsFunction · 0.70
NPCC_ds2_toCamFunction · 0.70
xSndPlay3DFunction · 0.70
NPCS_SndTypePlayedFunction · 0.70
xSndPlayFunction · 0.50

Tested by

no test coverage detected