From fae975e483877c9336f1d8752e90bab5d1654a05 Mon Sep 17 00:00:00 2001 From: Kiloku Date: Sun, 12 Jan 2025 22:53:02 -0300 Subject: [PATCH] Run Radio Message box calculations to their draw function --- include/sf64mesg.h | 1 + src/engine/fox_radio.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/sf64mesg.h b/include/sf64mesg.h index 275ead10..b70147ed 100644 --- a/include/sf64mesg.h +++ b/include/sf64mesg.h @@ -64,6 +64,7 @@ typedef enum RadioCharacterId { } RadioCharacterId; void Radio_PlayMessage(u16*, RadioCharacterId); +void Radio_CalculatePositions(); void func_radio_800BB388(void); void Radio_Draw(void); diff --git a/src/engine/fox_radio.c b/src/engine/fox_radio.c index 754d5e9d..87ee7f7d 100644 --- a/src/engine/fox_radio.c +++ b/src/engine/fox_radio.c @@ -123,7 +123,12 @@ void Radio_PlayMessage(u16* msg, RadioCharacterId character) { gRadioMsg = msg; gRadioState = 100; - switch (gGameState) { + gRadioMsgId = Message_IdFromPtr(msg); + Audio_PlayVoice(gRadioMsgId); +} + +void Radio_CalculatePositions(){ + switch (gGameState) { case GSTATE_TITLE: gRadioPrintPosY = 176; gRadioPrintPosX = OTRGetRectDimensionFromLeftEdgeOverride(85.0f); @@ -154,9 +159,6 @@ void Radio_PlayMessage(u16* msg, RadioCharacterId character) { gRadioPortraitPosY = 178.0f; break; } - - gRadioMsgId = Message_IdFromPtr(msg); - Audio_PlayVoice(gRadioMsgId); } s32 sRadioUseRedBox; @@ -453,6 +455,8 @@ void func_radio_800BB388(void) { u8* texture; u16* palette; f32 sp30; + + Radio_CalculatePositions(); if ((gGameState != GSTATE_MAP) && (gRadioTextBoxScaleY != 0.0f)) { temp_fa0 = (gRadioTextBoxScaleY / 0.26f) * 3.0f;