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

Function zCameraFreeLookSetGoals

src/SB/Game/zCamera.cpp:570–679  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

568}
569
570void zCameraFreeLookSetGoals(xCamera* cam, F32 pitch_s, F32& dgoal, F32& hgoal, F32& pitch_goal,
571 F32& lktm, F32 dt)
572{
573 if (zcam_bbounce != 0)
574 {
575 if (zcam_highbounce != 0)
576 {
577 dgoal = ::GetCurrentD();
578 hgoal = ::GetCurrentH();
579 pitch_goal = ::GetCurrentPitch();
580 return;
581 }
582
583 dgoal = zcam_near != 0 ? 3.5f : ::GetCurrentD();
584 hgoal = zcam_near != 0 ? 2.4f : ::GetCurrentH();
585
586 F32 newPitchGoal;
587 if (zcam_longbounce != 0)
588 {
589 F32 len = xsqrt(zcam_playervel->x * zcam_playervel->x +
590 zcam_playervel->y * zcam_playervel->y +
591 zcam_playervel->z * zcam_playervel->z);
592
593 bool lenValid = false;
594 if (zcam_playervel != NULL)
595 {
596 if (len != 0.0f)
597 {
598 lenValid = true;
599 }
600 }
601
602 if (lenValid)
603 {
604 newPitchGoal =
605 (cam->mat.at.x * zcam_playervel->x + cam->mat.at.y * zcam_playervel->y +
606 cam->mat.at.z * zcam_playervel->z) /
607 len;
608 newPitchGoal = 0.0f < newPitchGoal ? 0.0f : newPitchGoal;
609 newPitchGoal = -newPitchGoal;
610 }
611 else
612 {
613 newPitchGoal = 0.0f;
614 }
615
616 if (zcam_near != 0)
617 {
618 newPitchGoal = 3.1415928f * (20.0f * newPitchGoal + 20.0f) / 180.0f;
619 }
620 else
621 {
622 newPitchGoal = 0.5235988f;
623 }
624
625 pitch_goal = newPitchGoal;
626 }
627 else

Callers

nothing calls this directly

Calls 4

GetCurrentDFunction · 0.85
GetCurrentHFunction · 0.85
GetCurrentPitchFunction · 0.85
xsqrtFunction · 0.85

Tested by

no test coverage detected