diff --git a/soh/soh/Enhancements/accessible-actors/AccessibleActorList.cpp b/soh/soh/Enhancements/accessible-actors/AccessibleActorList.cpp index a25a611f4..64eab6409 100644 --- a/soh/soh/Enhancements/accessible-actors/AccessibleActorList.cpp +++ b/soh/soh/Enhancements/accessible-actors/AccessibleActorList.cpp @@ -5,35 +5,26 @@ #include #include -#include #include #include #include #include -#include "overlays/actors/ovl_Boss_Goma/z_boss_goma.h" -std::vector buttonList = { BTN_A, BTN_B, BTN_CUP, BTN_CDOWN, BTN_CLEFT, BTN_CRIGHT, BTN_L, - BTN_Z, BTN_R, BTN_START, BTN_DUP, BTN_DDOWN, BTN_DLEFT, BTN_DRIGHT }; -// Declarations specific to chests. -#include "overlays/actors/ovl_En_Box/z_en_box.h" extern "C" { +#include "overlays/actors/ovl_Obj_Switch/z_obj_switch.h" +#include "overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h" +#include "overlays/actors/ovl_Boss_Goma/z_boss_goma.h" +#include "overlays/actors/ovl_En_Karebaba/z_en_karebaba.h" +#include "overlays/actors/ovl_En_Box/z_en_box.h" +#include "overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h" +#include "overlays/actors/ovl_En_Dog/z_en_dog.h" void EnBox_WaitOpen(EnBox*, PlayState*); -} -// Declarations specific to Babas. -#include "overlays/actors/ovl_En_Karebaba/z_en_karebaba.h" -extern "C" { - void EnKarebaba_DeadItemDrop(EnKarebaba*, PlayState*); -} -// Declarations specific to Torches -#include "overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h" -// Declarations specific to dogs -#include "overlays/actors/ovl_En_Dog/z_en_dog.h" -extern "C" { void EnDog_FollowPlayer(EnDog*, PlayState*); s8 EnDog_CanFollow(EnDog*, PlayState*); } + // User data for the general helper VA. typedef struct { s16 currentScene; @@ -240,14 +231,17 @@ void accessible_larva(AccessibleActor* actor) { } } +void accessible_eiyer(AccessibleActor* actor) { + if (GET_PLAYER(actor->play)->actor.world.pos.y > actor->actor->world.pos.y - 8) { + ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_IT_FISHING_REEL_SLOW, false); + } else { + ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_IT_FISHING_REEL_HIGH, false); + } +} + void accessible_door(AccessibleActor* actor) { ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_OC_DOOR_OPEN, false); } -void accessible_va_prototype(AccessibleActor* actor) { - - Player* player = GET_PLAYER(actor->play); - ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_IT_BOMB_EXPLOSION, false); -} void accessible_maruta(AccessibleActor* actor) { if (actor->actor->params == 1) { @@ -551,6 +545,13 @@ void accessible_sticks(AccessibleActor* actor) { } } +void accessible_jabu_switch(AccessibleActor* actor) { + int type = actor->actor->params & 0xFF; + if (type == YELLOW_TALL_1 || type == YELLOW_TALL_2) { + actor->policy.aimAssist.isProvider = true; + } +} + void accessible_jabu_elevator(AccessibleActor* actor) { if ((actor->actor->params & 0xFF) == 2 && actor->xzDistToPlayer > 50) { ActorAccessibility_PlaySoundForActor(actor, 0, NA_SE_PL_LAND_LADDER, false); @@ -627,8 +628,8 @@ void accessible_audio_compass(AccessibleActor* actor) { OSContPad* trackerButtonsPressed = std::dynamic_pointer_cast(Ship::Context::GetInstance()->GetControlDeck())->GetPads(); AudioCompassData* data = (AudioCompassData*)actor->userData; - bool compassCombo = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & buttonList[11] && - trackerButtonsPressed[0].button & buttonList[6]; + bool compassCombo = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & BTN_DDOWN && + trackerButtonsPressed[0].button & BTN_L; actor->world.pos = player->actor.world.pos; actor->world.pos.z -= 50; @@ -786,7 +787,7 @@ void ActorAccessibility_InitActors() { ActorAccessibility_InitPolicy(&policy, "Ruto", NULL, NA_SE_VO_RT_LAUGH_0); policy.n = 40; - policy.pitch = 0.7; + policy.pitch = 1.1; ActorAccessibility_AddSupportedActor(ACTOR_EN_RU1, policy); ActorAccessibility_InitPolicy(&policy, "Bean patch", NULL, NA_SE_EN_MUSI_SINK); @@ -835,7 +836,7 @@ void ActorAccessibility_InitActors() { ActorAccessibility_AddSupportedActor(ACTOR_OBJ_SWITCH, policy); ActorAccessibility_InitPolicy(&policy, "Jabu Switch", NULL, NA_SE_EV_DIAMOND_SWITCH); policy.volume = 0.6; - policy.distance = 2000; + policy.distance = 1000; policy.ydist = 300; ActorAccessibility_AddSupportedActor(ACTOR_BG_BDAN_SWITCH, policy); ActorAccessibility_InitPolicy(&policy, "Jabu Elevator", accessible_jabu_elevator, 0); @@ -897,6 +898,14 @@ void ActorAccessibility_InitActors() { ActorAccessibility_AddSupportedActor(ACTOR_EN_GOMA, policy); ActorAccessibility_InitPolicy(&policy, "small jellyfish", NULL, NA_SE_EN_BIRI_FLY); ActorAccessibility_AddSupportedActor(ACTOR_EN_BILI, policy); + ActorAccessibility_InitPolicy(&policy, "stinger", accessible_eiyer, 0); + policy.n = 1; + policy.distance = 1000; + policy.ydist = 200; + ActorAccessibility_AddSupportedActor(ACTOR_EN_EIYER, policy); + ActorAccessibility_InitPolicy(&policy, "bubble", NULL, NA_SE_EN_DAIOCTA_SPLASH); + policy.ydist = 200; + ActorAccessibility_AddSupportedActor(ACTOR_EN_BUBBLE, policy); ActorAccessibility_InitPolicy(&policy, "tentacle obstacle", NULL, NA_SE_EN_BALINADE_THUNDER); policy.distance = 100; ActorAccessibility_AddSupportedActor(ACTOR_EN_BX, policy); @@ -1000,9 +1009,12 @@ void ActorAccessibility_InitActors() { ActorAccessibility_AddVirtualActor(list, VA_MARKER, { { -1958, 20, -1297 } }); list = ActorAccessibility_GetVirtualActorList(SCENE_JABU_JABU, 2); - AccessibleActor* temp = ActorAccessibility_AddVirtualActor(list, VA_MARKER, { { -260, -445, -3377 } }); // green tentacle hole - temp->policy.distance = 100; - temp->policy.sound = NA_SE_EN_OCTAROCK_BUBLE; + AccessibleActor* temp = ActorAccessibility_AddVirtualActor(list, VA_MARKER, { { -260, -400, -3377 } }); // green tentacle hole + temp->policy.distance = 200; + temp->policy.sound = NA_SE_EN_DAIOCTA_DEAD; + temp = ActorAccessibility_AddVirtualActor(list, VA_MARKER, { { 230, -400, -3211 } }); // ruto hole + temp->policy.distance = 200; + temp->policy.sound = NA_SE_VO_RT_FALL; list = ActorAccessibility_GetVirtualActorList(SCENE_CASTLE_COURTYARD_GUARDS_DAY, 0); // hyrule courtyard ActorAccessibility_AddVirtualActor(list, VA_MARKER, { { 1734.0, 0.0, 140.514 } }); diff --git a/soh/soh/Enhancements/accessible-actors/ActorAccessibility.cpp b/soh/soh/Enhancements/accessible-actors/ActorAccessibility.cpp index f78033a23..c6bb99bd9 100644 --- a/soh/soh/Enhancements/accessible-actors/ActorAccessibility.cpp +++ b/soh/soh/Enhancements/accessible-actors/ActorAccessibility.cpp @@ -20,9 +20,6 @@ #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/audio/AudioDecoder.h" -std::vector buttons = { BTN_A, BTN_B, BTN_CUP, BTN_CDOWN, BTN_CLEFT, BTN_CRIGHT, BTN_L, - BTN_Z, BTN_R, BTN_START, BTN_DUP, BTN_DDOWN, BTN_DLEFT, BTN_DRIGHT }; - extern "C" { extern PlayState* gPlayState; extern bool freezeGame; @@ -102,9 +99,7 @@ class ActorAccessibility { static ActorAccessibility* aa; uint64_t ActorAccessibility_GetNextID() { - uint64_t result = aa->nextActorID; - aa->nextActorID++; - return result; + return aa->nextActorID++; } // Hooks for game-interactor. @@ -128,8 +123,8 @@ void ActorAccessibility_OnGameStillFrozen() { if (aa->extractSfx) ActorAccessibility_HandleSoundExtractionMode(gPlayState); } -void ActorAccessibility_Init() { +void ActorAccessibility_Init() { aa = new ActorAccessibility(); aa->glossary = new AudioGlossaryData(); aa->isOn = CVarGetInteger(CVAR_SETTING("A11yAudioInteraction"), 0); @@ -342,18 +337,14 @@ void ActorAccessibility_StopAllVirtualActors(VirtualActorList* list) { ActorAccessibility_StopAllSounds((void*)&(*i)); } void ActorAccessibility_RunAccessibilityForActor(PlayState* play, AccessibleActor* actor) { - Player* player = GET_PLAYER(play); actor->play = play; - if (ActorAccessibility_IsRealActor(actor)) + if (ActorAccessibility_IsRealActor(actor)) { ActorAccessibility_CopyParamsFromRealActor(actor); - - else { - // Perform calculations that the game would normally take care of for real actors. + } else { + Player* player = GET_PLAYER(play); f32 w = 0.0f; // Set actor->projectedPos. SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &actor->world.pos, &actor->projectedPos, &w); - // Set actor->xzDistToPlayer. - actor->xzDistToPlayer = Math_Vec3f_DistXZ(&actor->world.pos, &player->actor.world.pos); actor->xyzDistToPlayer = Math_Vec3f_DistXYZ(&actor->world.pos, &player->actor.world.pos); actor->yDistToPlayer = fabs((actor->world.pos.y) - (player->actor.world.pos.y)); @@ -375,14 +366,15 @@ void ActorAccessibility_RunAccessibilityForActor(PlayState* play, AccessibleActo if (aa->glossary->GlossaryStarted) { aa->glossary->frameCount++; } - if (actor->frameCount != 1 && (actor->frameCount - 1) % actor->policy.n != 0) + if (actor->frameCount % actor->policy.n) return; if (!actor->policy.runsAlways && actor->xyzDistToPlayer > actor->policy.distance) { return; } - if (actor->isDrawn == 0 && actor->actor->id != 406 && actor->actor->id != 302 && !aa->glossary->GlossaryStarted) + if (actor->isDrawn == 0 && actor->actor->id != ACTOR_EN_IT && actor->actor->id != ACTOR_EN_OKARINA_TAG && !aa->glossary->GlossaryStarted) return; if (actor->policy.aimAssist.isProvider) { + Player* player = GET_PLAYER(play); if (player->stateFlags1 & PLAYER_STATE1_FIRST_PERSON && (player->stateFlags1 & PLAYER_STATE1_USING_BOOMERANG || player->stateFlags1 & PLAYER_STATE1_ITEM_IN_HAND)) { ActorAccessibility_SetSoundPitch(actor, 9, actor->aimAssist.pitch); @@ -395,9 +387,10 @@ void ActorAccessibility_RunAccessibilityForActor(PlayState* play, AccessibleActo actor->aimAssist.framesSinceAimAssist = 0; 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. + } else { + // Make sure there's no delay the next time you draw your bow or whatever. + actor->aimAssist.framesSinceAimAssist = 32768; + } } if (actor->policy.callback != NULL) @@ -406,7 +399,6 @@ void ActorAccessibility_RunAccessibilityForActor(PlayState* play, AccessibleActo ActorAccessibility_PlaySoundForActor(actor, 0, actor->policy.sound, false); } void ActorAccessibility_RunAccessibilityForAllActors(PlayState* play) { - Player* player = GET_PLAYER(play); if (play->sceneNum != aa->currentScene) { ActorAccessibility_StopAllVirtualActors(aa->currentEverywhere); @@ -461,9 +453,7 @@ void ActorAccessibility_RunAccessibilityForAllActors(PlayState* play) { } void ActorAccessibility_AudioGlossary(PlayState* play) { - if (aa->glossary->GlossaryStarted) { - freezeActors = true; AccessibleActor glossaryActor = (*aa->glossary->current).second; ActorAccessibility_CopyParamsFromRealActor(&glossaryActor); @@ -479,8 +469,8 @@ void ActorAccessibility_AudioGlossary(PlayState* play) { OSContPad* trackerButtonsPressed = std::dynamic_pointer_cast(Ship::Context::GetInstance()->GetControlDeck())->GetPads(); - bool comboStartGlossary = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & buttons[10] && - trackerButtonsPressed[0].button & buttons[6]; + bool comboStartGlossary = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & BTN_DUP && + trackerButtonsPressed[0].button & BTN_L; if (comboStartGlossary) { aa->glossary->GlossaryStarted = true; aa->glossary->current = aa->accessibleActorList.begin(); @@ -489,8 +479,8 @@ void ActorAccessibility_AudioGlossary(PlayState* play) { SpeechSynthesizer::Instance->Speak((*aa->glossary->current).second.policy.englishName, GetLanguageCode()); return; } - bool comboNextGlossary = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & buttons[13] && - trackerButtonsPressed[0].button & buttons[6]; + bool comboNextGlossary = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & BTN_DRIGHT && + trackerButtonsPressed[0].button & BTN_L; if (comboNextGlossary && aa->glossary->GlossaryStarted) { aa->glossary->current++; if (aa->glossary->current == aa->accessibleActorList.end()) { @@ -499,8 +489,8 @@ void ActorAccessibility_AudioGlossary(PlayState* play) { aa->glossary->cooldown = 5; SpeechSynthesizer::Instance->Speak((*aa->glossary->current).second.policy.englishName, GetLanguageCode()); } - bool comboPrevGlossary = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & buttons[12] && - trackerButtonsPressed[0].button & buttons[6]; + bool comboPrevGlossary = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & BTN_DLEFT && + trackerButtonsPressed[0].button & BTN_L; if (comboPrevGlossary && aa->glossary->GlossaryStarted) { if (aa->glossary->current != aa->accessibleActorList.begin()) { aa->glossary->current--; @@ -509,8 +499,8 @@ void ActorAccessibility_AudioGlossary(PlayState* play) { SpeechSynthesizer::Instance->Speak((*aa->glossary->current).second.policy.englishName, GetLanguageCode()); } - bool comboDisableGlossary = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & buttons[11] && - trackerButtonsPressed[0].button & buttons[6]; + bool comboDisableGlossary = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & BTN_DDOWN && + trackerButtonsPressed[0].button & BTN_L; if (comboDisableGlossary) { aa->glossary->cooldown = 0; aa->glossary->GlossaryStarted = false; @@ -626,7 +616,6 @@ void ActorAccessibility_AnnounceRoomNumber(PlayState* play) { // 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; f32 slope = Math_SinS(angle) / Math_CosS(angle) * 1.0; @@ -666,15 +655,15 @@ bool ActorAccessibility_InitAudio() { return true; } void ActorAccessibility_ShutdownAudio() { - if (aa->isOn == 0) - return; - delete aa->audioEngine; + if (aa->isOn) { + delete aa->audioEngine; + aa->isOn = 0; + } } void ActorAccessibility_MixAccessibleAudioWithGameAudio(int16_t* ogBuffer, uint32_t nFrames) { - if (aa->isOn == 0) - return; - - aa->audioEngine->mix(ogBuffer, nFrames); + if (aa->isOn) { + aa->audioEngine->mix(ogBuffer, nFrames); + } } // Map one of the game's sfx to a path which as understood by the external audio engine. The returned token is a // short hex string that can be passed directly to the audio engine. diff --git a/soh/soh/Enhancements/accessible-actors/accessibility_cues.cpp b/soh/soh/Enhancements/accessible-actors/accessibility_cues.cpp index 64f45a25f..769b6526f 100644 --- a/soh/soh/Enhancements/accessible-actors/accessibility_cues.cpp +++ b/soh/soh/Enhancements/accessible-actors/accessibility_cues.cpp @@ -115,12 +115,6 @@ class Incline : protected TerrainCueSound { return; } ActorAccessibility_SetSoundPitch(this, 0, 0.5 + (1 - pitchModifier)); - /*currentPitch += 0.1; - if (currentPitch >= 2.0) { - stop(); - currentPitch = 0.5; - restFrames = 5; - }*/ } void setPitchModifier(float modifier) { pitchModifier = modifier; @@ -1251,8 +1245,7 @@ class TerrainCueDirection { } if (pos.y < prevPos.y && fabs(pos.y - prevPos.y) < 20 && fabs(pos.y - prevPos.y) > 1.2 && player->stateFlags1 != PLAYER_STATE1_CLIMBING_LADDER) { - // This is a decline. - // discorver top + // This is a decline. discover top Vec3f_ top = pos; while ((pos.y < prevPos.y && fabs(pos.y - prevPos.y) < 20 && fabs(pos.y - prevPos.y) > 1.2 && @@ -1398,9 +1391,6 @@ void accessible_va_terrain_cue(AccessibleActor* actor) { Player* player = GET_PLAYER(actor->play); if (state->previousAction != currentState) { - // Audio_PlaySoundGeneral(NA_SE_EV_DIAMOND_SWITCH, &player->actor.world.pos, 4, &actor->basePitch, - // &actor->baseVolume, - // &actor->currentReverb); switch (currentState) { case DO_ACTION_CHECK: SpeechSynthesizer::Instance->Speak("Check", GetLanguageCode()); @@ -1421,11 +1411,7 @@ void accessible_va_terrain_cue(AccessibleActor* actor) { SpeechSynthesizer::Instance->Speak("Speak", GetLanguageCode()); break; case DO_ACTION_STOP: - SpeechSynthesizer::Instance->Speak("Stop", - GetLanguageCode()); // possibly disable? not sure what it does - break; - default: - SpeechSynthesizer::Instance->Speak(" ", GetLanguageCode()); + SpeechSynthesizer::Instance->Speak("Stop", GetLanguageCode()); break; }