| 759 | } |
| 760 | |
| 761 | static U32 xEntRotMove(xEntMotion* motion, xScene* sc, F32 dt, xEntFrame* frame) |
| 762 | { |
| 763 | xEntMechData* mech = &motion->mech; |
| 764 | xEntMotionMechData* mkasst = &motion->asset->mech; |
| 765 | U32 last; |
| 766 | F32 tmradj = motion->tmr + (dt * 0.5f); |
| 767 | F32 rem = mkasst->rot_tm - tmradj; |
| 768 | F32 speed; |
| 769 | xEntAsset* easst; |
| 770 | |
| 771 | if (motion->tmr + dt >= mkasst->rot_tm) |
| 772 | { |
| 773 | if ((mech->state == 1) || (mkasst->type == 2) && (mech->state == 0)) |
| 774 | { |
| 775 | *mech->rotptr = mech->brot; |
| 776 | } |
| 777 | else |
| 778 | { |
| 779 | *mech->rotptr = mech->arot; |
| 780 | } |
| 781 | |
| 782 | last = 1; |
| 783 | } |
| 784 | else |
| 785 | { |
| 786 | if ((mech->state == 1) || (mkasst->type == 2 && (mech->state == 0))) |
| 787 | { |
| 788 | if ((tmradj < mkasst->rot_acc_tm) && (mkasst->rot_acc_tm > 1e-05f)) |
| 789 | { |
| 790 | speed = (mech->sr * tmradj) / mkasst->rot_acc_tm; |
| 791 | } |
| 792 | else if ((tmradj > mech->trfd) && (mkasst->rot_dec_tm > 1e-05f)) |
| 793 | { |
| 794 | speed = (mech->sr * rem) / mkasst->rot_dec_tm; |
| 795 | } |
| 796 | else |
| 797 | { |
| 798 | speed = mech->sr; |
| 799 | } |
| 800 | } |
| 801 | else if ((tmradj < mkasst->rot_dec_tm) && (mkasst->rot_dec_tm > 1e-05f)) |
| 802 | { |
| 803 | speed = (mech->sr * tmradj) / mkasst->rot_dec_tm; |
| 804 | } |
| 805 | else if ((tmradj > mech->trbd) && (mkasst->rot_acc_tm > 1e-05f)) |
| 806 | { |
| 807 | speed = (mech->sr * rem) / mkasst->rot_acc_tm; |
| 808 | } |
| 809 | else |
| 810 | { |
| 811 | speed = mech->sr; |
| 812 | } |
| 813 | |
| 814 | *motion->mech.rotptr = xAngleClamp(speed * dt + *mech->rotptr); |
| 815 | |
| 816 | last = 0; |
| 817 | } |
| 818 |
no test coverage detected