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

Function xEntSldMove

src/SB/Core/x/xEntMotion.cpp:699–759  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

697}
698
699static U32 xEntSldMove(xEntMotion* motion, xScene* sc, F32 dt, xEntFrame* frame)
700{
701 xEntMechData* mech = &motion->mech;
702 xEntMotionAsset* mkasst = motion->asset;
703 U32 last;
704 F32 tmradj = motion->tmr + (dt * 0.5f);
705 F32 rem = mkasst->mech.sld_tm - tmradj;
706 F32 speed;
707
708 if (motion->tmr + dt >= mkasst->mech.sld_tm)
709 {
710 if (mech->state == 0)
711 {
712 xVec3Sub(&frame->dpos, &mech->bpos, &frame->mat.pos);
713 }
714 else
715 {
716 xVec3Sub(&frame->dpos, &mech->apos, &frame->mat.pos);
717 }
718
719 last = 1;
720 }
721 else
722 {
723 if (mech->state == 0)
724 {
725 if ((tmradj < mkasst->mech.sld_acc_tm) && (mkasst->mech.sld_acc_tm > 1e-05f))
726 {
727 speed = (mech->ss * tmradj) / mkasst->mech.sld_acc_tm;
728 }
729 else if ((tmradj > mech->tsfd) && (mkasst->mech.sld_dec_tm > 1e-05f))
730 {
731 speed = (mech->ss * rem) / mkasst->mech.sld_dec_tm;
732 }
733 else
734 {
735 speed = mech->ss;
736 }
737 }
738 else if ((tmradj < mkasst->mech.sld_dec_tm) && (mkasst->mech.sld_dec_tm > 1e-05f))
739 {
740 speed = (mech->ss * tmradj) / mkasst->mech.sld_dec_tm;
741 }
742 else if ((tmradj > mech->tsbd) && (mkasst->mech.sld_acc_tm > 1e-05f))
743 {
744 speed = (mech->ss * rem) / mkasst->mech.sld_acc_tm;
745 }
746 else
747 {
748 speed = mech->ss;
749 }
750
751 xVec3SMul(&frame->dpos, &mech->dir, speed * dt);
752
753 last = 0;
754 }
755
756 frame->mode |= 2;

Callers 1

xEntMechMoveFunction · 0.70

Calls 2

xVec3SubFunction · 0.85
xVec3SMulFunction · 0.85

Tested by

no test coverage detected