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

Function notify_triggers

src/SB/Game/zEntCruiseBubble.cpp:487–540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

485 }
486
487 void notify_triggers(xScene& s, const xSphere& o, const xVec3& dir)
488 {
489 zEntTrigger** it = (zEntTrigger**)s.trigs;
490 zEntTrigger** end = it + s.num_trigs;
491 for (; it != end; ++it)
492 {
493 zEntTrigger& trig = **it;
494
495 if (xBaseIsEnabled(&trig))
496 {
497 zEntTriggerAsset(trig);
498
499 bool want_enter = false;
500 bool want_exit = false;
501 xLinkAsset* link = trig.link;
502 xLinkAsset* end_link = link + trig.linkCount;
503 for (; link != end_link; ++link)
504 {
505 if (link->srcEvent == eEventEnterCruise)
506 {
507 want_enter = true;
508 }
509 else if (link->srcEvent == eEventExitCruise)
510 {
511 want_exit = true;
512 }
513 }
514 want_enter = want_enter && !(trig.entered & 0x2);
515 want_exit = want_exit && (trig.entered & 0x2);
516
517 if (want_enter || want_exit)
518 {
519 bool inside = zEntTriggerHitsSphere(trig, o, dir);
520 if (inside)
521 {
522 trig.entered |= 0x2;
523 }
524 else
525 {
526 trig.entered &= 0xfffffffd;
527 }
528
529 if (want_enter && inside)
530 {
531 zEntEvent(&trig, eEventEnterCruise);
532 }
533 else if (want_exit && !inside)
534 {
535 zEntEvent(&trig, eEventExitCruise);
536 }
537 }
538 }
539 }
540 }
541
542 void exit_triggers(xScene& s)
543 {

Callers 3

stopMethod · 0.70
abortMethod · 0.70
updateMethod · 0.70

Calls 3

xBaseIsEnabledFunction · 0.85
zEntTriggerHitsSphereFunction · 0.85
zEntEventFunction · 0.50

Tested by

no test coverage detected