forest cue feedback, fix aim assist

This commit is contained in:
Demur Rumed 2025-06-30 04:34:34 +00:00
commit 7574d4e4cb
2 changed files with 20 additions and 10 deletions

View file

@ -91,7 +91,7 @@ void accessible_switch(AccessibleActor* actor) {
return; return;
} }
if (scale.y >= 33.0f / 200.0f) { if (scale.y >= 33.0f / 200.0f) {
if (actor->play->sceneNum == 0 && actor->play->roomCtx.curRoom.num == 5 && actor->xzDistToPlayer < 20) { if (actor->play->sceneNum == SCENE_DEKU_TREE && actor->play->roomCtx.curRoom.num == 5 && actor->xzDistToPlayer < 20) {
ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_EV_DIAMOND_SWITCH); ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_EV_DIAMOND_SWITCH);
} }
if ((actor->frameCount & 31) != 0) { if ((actor->frameCount & 31) != 0) {
@ -106,11 +106,16 @@ void accessible_switch(AccessibleActor* actor) {
ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_IT_HAMMER_HIT); ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_IT_HAMMER_HIT);
} }
} else if ((actor->actor->params & 7) == OBJSWITCH_TYPE_EYE) { } else if ((actor->actor->params & 7) == OBJSWITCH_TYPE_EYE) {
if (sw->eyeTexIndex == 0) { s32 subType = (actor->actor->params >> 4) & 7;
if (subType != 0 || sw->eyeTexIndex == 0) {
actor->policy.aimAssist.isProvider = AIM_SHOOT; actor->policy.aimAssist.isProvider = AIM_SHOOT;
actor->policy.ydist = 1000; actor->policy.ydist = 1000;
// prevent hearing yellow eye in forest temple block puzzle heard on top floor
if (!(actor->play->sceneNum == SCENE_FOREST_TEMPLE && actor->play->roomCtx.curRoom.num == 11 &&
actor->pos.y < player->actor.world.pos.y - 100)) {
ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_EV_FOOT_SWITCH); ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_EV_FOOT_SWITCH);
} }
}
} else if (actor->xyzDistToPlayer < 1000) { } else if (actor->xyzDistToPlayer < 1000) {
actor->policy.aimAssist.isProvider = AIM_ALL; actor->policy.aimAssist.isProvider = AIM_ALL;
actor->policy.ydist = 1000; actor->policy.ydist = 1000;
@ -726,12 +731,17 @@ void ActorAccessibility_InitActors() {
if ((actor->frameCount & 31) == 0) { if ((actor->frameCount & 31) == 0) {
ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_EV_TRAP_BOUND); ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_EV_TRAP_BOUND);
} }
} else if (po->index == sBgPoEventPuzzleState && (actor->frameCount & 63) == 0) { } else if (po->index == sBgPoEventPuzzleState) {
actor->policy.aimAssist.isProvider = AIM_BOW;
if ((actor->frameCount & 63) == 0) {
ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_EN_PO_CRY); ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_EN_PO_CRY);
} }
} else {
actor->policy.aimAssist.isProvider = 0;
}
}); });
policy.aimAssist.isProvider = AIM_BOW; policy.aimAssist.isProvider = AIM_BOW;
policy.aimAssist.tolerance = 50.0f; policy.aimAssist.tolerance = 40.0f;
policy.n = 1; policy.n = 1;
policy.ydist = 1000; policy.ydist = 1000;
policy.distance = 1000; policy.distance = 1000;
@ -969,7 +979,7 @@ void ActorAccessibility_InitActors() {
policy.pitch = 1.3; policy.pitch = 1.3;
ActorAccessibility_AddSupportedActor(VA_CLIMB, policy); ActorAccessibility_AddSupportedActor(VA_CLIMB, policy);
ActorAccessibility_InitPolicy(&policy, "Door", [](AccessibleActor* actor) { ActorAccessibility_InitPolicy(&policy, "Door", [](AccessibleActor* actor) {
if (((actor->actor->params >> 7) & 7) == DOOR_LOCKED) { if (((actor->actor->params >> 7) & 7) == DOOR_LOCKED && !Flags_GetSwitch(actor->play, actor->actor->params & 0x3F)) {
ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_EV_CHAIN_KEY_UNLOCK_B); ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_EV_CHAIN_KEY_UNLOCK_B);
} else { } else {
ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_OC_DOOR_OPEN); ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_OC_DOOR_OPEN);

View file

@ -517,7 +517,7 @@ void ActorAccessibility_GeneralHelper(PlayState* play) {
bool compassOn = false; bool compassOn = false;
if (aa->prevPos.x == player->actor.world.pos.x && aa->prevPos.z == player->actor.world.pos.z) { if (aa->prevPos.x == player->actor.world.pos.x && aa->prevPos.z == player->actor.world.pos.z) {
if (aa->prevYaw != player->yaw) { if (ABS(aa->prevYaw - player->yaw) > 0x400) {
compassOn = true; compassOn = true;
aa->prevYaw = player->yaw; aa->prevYaw = player->yaw;
} }
@ -722,7 +722,7 @@ AimAssistProps ActorAccessibility_ProvideAimAssistForActor(AccessibleActor* acto
s32 angle = player->actor.focus.rot.x; s32 angle = player->actor.focus.rot.x;
angle = angle / -14000.0 * 16384; angle = angle / -14000.0 * 16384;
f32 cos_angle = Math_CosS(angle); f32 cos_angle = Math_CosS(angle);
f32 slope = cos_angle <= 0.01 ? 1.0f : std::max(Math_SinS(angle) / cos_angle, 1.0f); f32 slope = cos_angle == 0.0f ? 0.0f : Math_SinS(angle) / cos_angle;
s32 yIntercept = slope * actor->xzDistToPlayer + player->actor.focus.pos.y; s32 yIntercept = slope * actor->xzDistToPlayer + player->actor.focus.pos.y;
s32 yHeight = actor->pos.y + 25; s32 yHeight = actor->pos.y + 25;
AimAssistProps aimAssistProps; AimAssistProps aimAssistProps;
@ -735,7 +735,7 @@ AimAssistProps ActorAccessibility_ProvideAimAssistForActor(AccessibleActor* acto
} }
s32 yDiff = fabs(yIntercept - yHeight); s32 yDiff = fabs(yIntercept - yHeight);
if (yIntercept - yHeight > 0) { if (yIntercept - yHeight > 0) {
s32 correction = (1 - 1 / slope) * 100; s32 correction = 100.0f - 100.0f / std::max(slope, 1.0f);
yDiff = std::max(yDiff - correction, 0); yDiff = std::max(yDiff - correction, 0);
} }
if (yDiff > 300) { if (yDiff > 300) {