| 563 | } |
| 564 | |
| 565 | void ItemFlyTurtle::moveNormal(CrsGround &rGround) { |
| 566 | mHeight = sStdHeight; |
| 567 | switch(mMoveState) { |
| 568 | case 0: |
| 569 | mHeight = sWaitHeight; |
| 570 | break; |
| 571 | case 3: |
| 572 | mHeight = sSearchHeight; |
| 573 | break; |
| 574 | case 4: |
| 575 | mHeight = sAttackHeight; |
| 576 | break; |
| 577 | } |
| 578 | f32 moveY = mDisScaleAnm.y * mHeightOffset + mNowHeight; |
| 579 | |
| 580 | JGeometry::TVec3f kartPos; |
| 581 | ObjUtility::getKartPos(mTargetKartNo, &kartPos); |
| 582 | if(mHeight == 0.0f) { |
| 583 | ObjUtility::getKartPos(mOwnerNum,&kartPos); |
| 584 | moveY = kartPos.y; |
| 585 | } |
| 586 | else if(mMoveState == 3 || mMoveState == 4) { |
| 587 | moveY = kartPos.y; |
| 588 | } |
| 589 | f32 moveVelY = mPos.y - moveY; |
| 590 | f32 add = 0.0f; |
| 591 | f32 dstAbs = JMAAbs(mHeight - moveVelY); |
| 592 | f32 absDst = dstAbs > add + mHeight ? add + mHeight : dstAbs; |
| 593 | f32 len = mVel.length(); |
| 594 | |
| 595 | |
| 596 | if(moveVelY < mHeight) { |
| 597 | if(moveVelY < 0.0f) |
| 598 | mPos.y = moveY; |
| 599 | mVel.y += (absDst * sHeightYVelAddUp); |
| 600 | } |
| 601 | else { |
| 602 | f32 yVelAddDown = sHeightYVelAddDown; |
| 603 | if(mMoveState == 4) |
| 604 | yVelAddDown = sAttackHeightYVelAddDown; |
| 605 | else if (mMoveState == 3) |
| 606 | yVelAddDown = sSearchHeightYVelAddDown; |
| 607 | |
| 608 | mVel.y -= (absDst * yVelAddDown); |
| 609 | } |
| 610 | |
| 611 | f32 velY = mVel.y; |
| 612 | if(len > JMAAbs(velY)) { |
| 613 | mVel.y = 0.0f; |
| 614 | stVecNormalize(mVel); |
| 615 | f32 len2 = len*len; |
| 616 | f32 velY2 = velY*velY; |
| 617 | f32 len = JMAFastSqrt(len2-velY2); |
| 618 | |
| 619 | mVel.scale(len); |
| 620 | mVel.y = velY; |
| 621 | } |
| 622 |
nothing calls this directly
no test coverage detected