From 2a3714cd9beda5a2cc4bc0b0476fa78a883d5b5c Mon Sep 17 00:00:00 2001 From: Demur Rumed Date: Thu, 17 Apr 2025 01:19:09 +0000 Subject: [PATCH] change direction from degrees to 8-way cardinal names --- soh/soh/Enhancements/tts/tts.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/tts/tts.cpp b/soh/soh/Enhancements/tts/tts.cpp index 54e3aa079..a7579e586 100644 --- a/soh/soh/Enhancements/tts/tts.cpp +++ b/soh/soh/Enhancements/tts/tts.cpp @@ -180,10 +180,16 @@ void RegisterOnInterfaceUpdateHook() { if (CHECK_BTN_ALL(gPlayState->state.input->press.button, BTN_CUSTOM_MODIFIER1)) { Player* player = GET_PLAYER(gPlayState); if (player != NULL) { - char ttsAnnounceBuf[16]; - int angle = (int)(player->actor.world.rot.y / (65536 / 360.0)); - int annouceBuf = snprintf(ttsAnnounceBuf, sizeof(ttsAnnounceBuf), "facing %d", angle); - SpeechSynthesizer::Instance->Speak(ttsAnnounceBuf, "en-US"); + u16 angle = (u16)player->actor.world.rot.y; + const char* ttsAnnounce = (angle > 0xf000 || angle < 0x1000) ? "south" + : angle < 0x3000 ? "southeast" + : angle < 0x5000 ? "east" + : angle < 0x7000 ? "northeast" + : angle < 0x9000 ? "north" + : angle < 0xB000 ? "northwest" + : angle < 0xD000 ? "west" + : "southwest"; + SpeechSynthesizer::Instance->Speak(ttsAnnounce, "en-US"); } }