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

Function soundEffectCB

src/SB/Game/zAssetTypes.cpp:513–596  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

511}
512
513static U32 soundEffectCB(U32 cbenum, xAnimActiveEffect* acteffect, xAnimSingle* single,
514 void* object)
515{
516 U32 sndhandle = 0;
517 U32 vil_SID = 0;
518 S32 vil_result;
519
520 if (cbenum == 1)
521 {
522 xEnt* ent_tmp = (xEnt*)object;
523 zAnimFxSound* snd = (zAnimFxSound*)(acteffect->Effect + 1);
524 if (ent_tmp == NULL)
525 {
526 vil_result = 0;
527 }
528 else if (ent_tmp->baseType == eBaseTypeNPC)
529 {
530 vil_result = ((zNPCCommon*)ent_tmp)->SndPlayFromAFX(snd, &vil_SID);
531 }
532 else
533 {
534 vil_result = 0;
535 }
536
537 if (vil_result > 0)
538 {
539 sndhandle = vil_SID;
540 }
541 else if (vil_result < 0)
542 {
543 sndhandle = 0;
544 }
545 else
546 {
547 U32 id = snd->ID;
548 U32 newId;
549 F32 volFactor;
550
551 static U32 footSelector = 0;
552 footSelector++;
553 if (id == 0x42B584CB || id == 0x56E1F71E || id == 0x331BDF8F)
554 {
555 newId = 0;
556 volFactor = 1.0f;
557
558 switch (id)
559 {
560 case 0x42B584CB:
561 {
562 newId = footSelector % 2 ? s_sbFootSoundA : s_sbFootSoundB;
563 volFactor = 0.6f;
564 break;
565 }
566 case 0x56E1F71E:
567 {
568 newId = footSelector % 2 ? s_scFootSoundA : s_scFootSoundB;
569 volFactor = 0.4f;
570 break;

Callers

nothing calls this directly

Calls 4

xSndStopFunction · 0.85
SndPlayFromAFXMethod · 0.80
xSndPlay3DFunction · 0.70
xSndPlayFunction · 0.50

Tested by

no test coverage detected