From 44dc72026001a2074ec5c757a12aaabd17efff67 Mon Sep 17 00:00:00 2001 From: FosterProgramming Date: Thu, 30 Oct 2025 09:13:22 +0100 Subject: [PATCH] Fix namebox bug when reloading the map mid-script (#8073) --- include/field_name_box.h | 1 + src/field_name_box.c | 6 ++++++ src/menu.c | 2 ++ 3 files changed, 9 insertions(+) diff --git a/include/field_name_box.h b/include/field_name_box.h index dc990c8592..6350330d0f 100644 --- a/include/field_name_box.h +++ b/include/field_name_box.h @@ -9,6 +9,7 @@ extern const u8 *const gSpeakerNamesTable[]; void TrySpawnNamebox(u32 tileNum); u32 GetNameboxWindowId(void); +void ResetNameboxData(void); void DestroyNamebox(void); void FillNamebox(void); void DrawNamebox(u32 windowId, u32 tileNum, bool32 copyToVram); diff --git a/src/field_name_box.c b/src/field_name_box.c index a3deb84b13..4c51f89d85 100644 --- a/src/field_name_box.c +++ b/src/field_name_box.c @@ -94,6 +94,12 @@ u32 GetNameboxWindowId(void) return sNameboxWindowId; } +void ResetNameboxData(void) +{ + sNameboxWindowId = WINDOW_NONE; + gSpeakerName = NULL; +} + void DestroyNamebox(void) { if (sNameboxWindowId == WINDOW_NONE) diff --git a/src/menu.c b/src/menu.c index b771635de4..30c7255993 100644 --- a/src/menu.c +++ b/src/menu.c @@ -5,6 +5,7 @@ #include "decompress.h" #include "dma3.h" #include "event_data.h" +#include "field_name_box.h" #include "field_weather.h" #include "graphics.h" #include "main.h" @@ -146,6 +147,7 @@ static const struct MenuInfoIcon sMenuInfoIcons[] = void InitStandardTextBoxWindows(void) { + ResetNameboxData(); InitWindows(sStandardTextBox_WindowTemplates); sStartMenuWindowId = WINDOW_NONE; sMapNamePopupWindowId = WINDOW_NONE;