Fix namebox bug when reloading the map mid-script (#8073)

This commit is contained in:
FosterProgramming 2025-10-30 09:13:22 +01:00 committed by GitHub
parent 9717c53afa
commit 44dc720260
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 0 deletions

View File

@ -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);

View File

@ -94,6 +94,12 @@ u32 GetNameboxWindowId(void)
return sNameboxWindowId;
}
void ResetNameboxData(void)
{
sNameboxWindowId = WINDOW_NONE;
gSpeakerName = NULL;
}
void DestroyNamebox(void)
{
if (sNameboxWindowId == WINDOW_NONE)

View File

@ -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;