Aim assist shouldn't make you wait when you first draw your weapon.

This commit is contained in:
Caturria 2024-01-18 21:01:14 -05:00
commit 95e9bb4897
2 changed files with 13 additions and 7 deletions

View file

@ -187,7 +187,7 @@ int ActorAccessibility_GetRandomStartingFrameCount(int min, int max) {
accessibleActor.sceneIndex = 0; accessibleActor.sceneIndex = 0;
for (int i = 0; i < NUM_MANAGED_SOUND_SLOTS; i++) for (int i = 0; i < NUM_MANAGED_SOUND_SLOTS; i++)
accessibleActor.managedSoundSlots[i] = false; accessibleActor.managedSoundSlots[i] = false;
accessibleActor.aimAssist.framesSinceAimAssist = 0; accessibleActor.aimAssist.framesSinceAimAssist = 32768;
accessibleActor.aimAssist.frequency = 10; accessibleActor.aimAssist.frequency = 10;
accessibleActor.aimAssist.pitch = 1.0; accessibleActor.aimAssist.pitch = 1.0;
@ -399,17 +399,23 @@ int ActorAccessibility_GetRandomStartingFrameCount(int min, int max) {
} }
if (actor->isDrawn == 0 && actor->actor->id != 406 && actor->actor->id != 302) if (actor->isDrawn == 0 && actor->actor->id != 406 && actor->actor->id != 302)
return; return;
if (actor->policy.aimAssist.isProvider && player->stateFlags1 & PLAYER_STATE1_FIRST_PERSON && (player->stateFlags1 & PLAYER_STATE1_BOOMERANG_IN_HAND || player->stateFlags1 & PLAYER_STATE1_ITEM_IN_HAND)) if (actor->policy.aimAssist.isProvider) {
{ if (player->stateFlags1 & PLAYER_STATE1_FIRST_PERSON &&
(player->stateFlags1 & PLAYER_STATE1_BOOMERANG_IN_HAND ||
player->stateFlags1 & PLAYER_STATE1_ITEM_IN_HAND)) {
ActorAccessibility_SetSoundPitch(actor, 9, actor->aimAssist.pitch); ActorAccessibility_SetSoundPitch(actor, 9, actor->aimAssist.pitch);
actor->aimAssist.framesSinceAimAssist++; actor->aimAssist.framesSinceAimAssist++;
ActorAccessibility_ProvideAimAssistForActor(actor); ActorAccessibility_ProvideAimAssistForActor(actor);
//The above will have taken care of setting the appropriate frequency and pitch, so we'll take care of the audio here based on those results. // The above will have taken care of setting the appropriate frequency and pitch, so we'll take care of the
// audio here based on those results.
if (actor->aimAssist.framesSinceAimAssist >= actor->aimAssist.frequency) { if (actor->aimAssist.framesSinceAimAssist >= actor->aimAssist.frequency) {
actor->aimAssist.framesSinceAimAssist = 0; actor->aimAssist.framesSinceAimAssist = 0;
ActorAccessibility_PlaySoundForActor(actor, 9, actor->policy.aimAssist.sfx, false); ActorAccessibility_PlaySoundForActor(actor, 9, actor->policy.aimAssist.sfx, false);
} }
} else
actor->aimAssist.framesSinceAimAssist = 32768;//Make sure there's no delay the next time you draw your bow or whatever.
} }
if (actor->policy.callback != NULL) if (actor->policy.callback != NULL)

View file

@ -74,7 +74,7 @@ struct AccessibleActor {
s16 sceneIndex;//If this actor represents a scene transition, then this will contain the destination scene index. Zero otherwise. s16 sceneIndex;//If this actor represents a scene transition, then this will contain the destination scene index. Zero otherwise.
bool managedSoundSlots[NUM_MANAGED_SOUND_SLOTS];//These have their attenuation and panning parameters updated every frame automatically. bool managedSoundSlots[NUM_MANAGED_SOUND_SLOTS];//These have their attenuation and panning parameters updated every frame automatically.
struct { struct {
s16 framesSinceAimAssist; // Allows rate-based vertical aim assist. Incremented every frame for aim assist u16 framesSinceAimAssist; // Allows rate-based vertical aim assist. Incremented every frame for aim assist
// actors. Manually reset by aim assist provider. // actors. Manually reset by aim assist provider.
f32 pitch; // Used to report whether Link is aiming higher or lower than the actor. f32 pitch; // Used to report whether Link is aiming higher or lower than the actor.
u8 frequency; // How often the sound will be played. Lower frequencies indicate that Link's vertical aim is u8 frequency; // How often the sound will be played. Lower frequencies indicate that Link's vertical aim is