mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-19 13:00:11 -07:00
change direction from degrees to 8-way cardinal names
This commit is contained in:
parent
2e25f846bc
commit
2a3714cd9b
1 changed files with 10 additions and 4 deletions
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue