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

Function PlayerAbsControl

src/SB/Game/zEntPlayer.cpp:542–1268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

540 }
541
542static void PlayerAbsControl(xEnt* ent, F32 x, F32 z, F32 dt)
543{
544 U32 animUserFlag;
545 U32 blendUserFlag;
546 F32 angle = 0.0f;
547 F32 mag = 1.0f;
548 maxVelmag = 0.0f;
549
550 if (gTrcPad[0].state != TRC_PadInserted)
551 {
552 z = x = 0.0f;
553 }
554
555 if (globals.player.ControlOff || sHackStuckTimer || sCatchCapsuleTimer > 0.15f)
556 {
557 z = x = 0.0f;
558 }
559
560 // F32 scalemag;
561 // F32 dir_dp;
562 // F32 turnfactor;
563 // F32 diffAngle;
564 // F32 autodist2d;
565 // F32 camAngle;
566 xMat4x3* m = &ent->frame->mat;
567 xVec3 euler;
568 xMat3x3GetEuler(m, &euler);
569
570 ent->frame->rot.angle = euler.x >= 0.0f ? euler.x : euler.x + 2 * PI;
571 surfMaxSpeed = 0.0f;
572
573 animUserFlag = ent->model->Anim->Single->State ? ent->model->Anim->Single->State->UserFlags : 0;
574
575 blendUserFlag = ent->model->Anim->Single->Blend && ent->model->Anim->Single->Blend->State ?
576 ent->model->Anim->Single->Blend->State->UserFlags | 0x80000000 :
577 0;
578
579 if (globals.player.KnockIntoAirTimer != 0.0f && (animUserFlag & 0x1e) == 0 &&
580 (animUserFlag & 0x1) == 0)
581 {
582 animUserFlag |= 0x8 | 0x2;
583 animUserFlag &= ~0x80;
584 }
585
586 memset(&ent->frame->dpos, 0, sizeof(xVec3));
587
588 if (!(globals.player.KnockBackTimer || animUserFlag & 0x100))
589 {
590 if (globals.player.ControlOff & 0x4000)
591 {
592 // F32 rot;
593 F32 dx = ent->frame->vel.x * ent->frame->vel.x;
594 F32 dz = ent->frame->vel.z * ent->frame->vel.z;
595
596 if (dx + dz > 0.01f)
597 {
598 ent->frame->mode &= ~0x2;
599

Callers 1

dont_moveFunction · 0.70

Calls 15

memsetFunction · 0.85
xatan2Function · 0.85
DampenControlsFunction · 0.85
xMat4x3CopyFunction · 0.85
strcmpFunction · 0.85
xsqrtFunction · 0.85
icosFunction · 0.85
xMat3x3RotYFunction · 0.85
PlayerSwingUpdateFunction · 0.85
zCameraGetLassoCamFactorFunction · 0.85
zCameraDisableLassoCamFunction · 0.85
zCameraSetLassoCamFactorFunction · 0.85

Tested by

no test coverage detected