MCPcopy Create free account
hub / github.com/doldecomp/mkdd / getAngleToRand

Method getAngleToRand

src/Shiraiwa/MapObjWanwan.cpp:516–538  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

514 mVel.y = 0.0f;
515}
516f32 TMapObjWanwan::getAngleToRand() {
517 JGeometry::TVec3f posDiff, backPos;
518 posDiff.sub(mObjData->position, mPos);
519 f32 angle = mAttackAngle;
520
521 getWanwanBackPos(&backPos);
522 backPos.sub(mObjData->position);
523
524 JGeometry::TVec3f zDir;
525 mRotMtx.getZDir(zDir);
526
527 if ((zDir.dotZX(posDiff) < 0.0f)
528 && (backPos.length() > mChainLength * 0.8f))
529 {
530 f32 a = std::atan2f(posDiff.x, posDiff.z);
531 a += getRandRadius(90, 20);
532 angle = a;
533 for (; angle < -F_PI; angle += F_TAU);
534 for (; angle >= F_PI; angle -= F_TAU);
535
536 }
537 return angle;
538}
539
540f32 TMapObjWanwan::getRandRadius(u8 max, u8 min) {
541 u32 range = max - min;

Callers

nothing calls this directly

Calls 5

dotZXMethod · 0.80
atan2fFunction · 0.50
subMethod · 0.45
getZDirMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected