Skip to content

Commit

Permalink
adds frequncy and pitch to aim assist
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryanoberlein committed Jan 19, 2024
1 parent 66d17f6 commit 08cdcd6
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion soh/soh/Enhancements/accessible-actors/ActorAccessibility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,23 @@ int ActorAccessibility_GetRandomStartingFrameCount(int min, int max) {
//Aim cue support.
void ActorAccessibility_ProvideAimAssistForActor(AccessibleActor* actor)
{

Player* player = GET_PLAYER(actor->play);
// 16384
s32 angle = player->actor.focus.rot.x;
angle = angle / -14000.0 * 16384;
s32 yIntercept = ((Math_SinS(angle) / Math_CosS(angle)) * actor->xzDistToPlayer)+player->actor.focus.pos.y;
s32 yHight = actor->actor->world.pos.y + 30;
if ((yIntercept) > yHight + 30) {
actor->aimAssist.pitch = 1.5;
} else if ((yIntercept) < yHight - 30) {
actor->aimAssist.pitch = 0.5;
}
s32 yDiff = fabs(yIntercept-yHight);
if (yDiff > 300) {
actor->aimAssist.frequency = 30;
} else {
actor->aimAssist.frequency = 1 + (uint8_t)(yDiff / 5);
}
}

//External audio engine stuff.
Expand Down

0 comments on commit 08cdcd6

Please sign in to comment.