mirror of
https://github.com/rh-hideout/pokeemerald-expansion.git
synced 2026-03-21 18:04:50 -05:00
Clear out text printer when closing dialogue windows (#8848)
Co-authored-by: Hedara <hedara90@gmail.com>
This commit is contained in:
parent
f32883f38a
commit
9a09de66dd
|
|
@ -282,6 +282,7 @@ void DrawStdWindowFrame(u8 windowId, bool8 copyToVram)
|
|||
|
||||
void ClearDialogWindowAndFrame(u8 windowId, bool8 copyToVram)
|
||||
{
|
||||
DeactivateSingleTextPrinter(windowId, WINDOW_TEXT_PRINTER);
|
||||
CallWindowFunction(windowId, WindowFunc_ClearDialogWindowAndFrame);
|
||||
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
|
||||
ClearWindowTilemap(windowId);
|
||||
|
|
|
|||
|
|
@ -2747,6 +2747,8 @@ static void FreeFinishedTextPrinters(void)
|
|||
void DeactivateSingleTextPrinter(u32 id, enum TextPrinterType type)
|
||||
{
|
||||
struct TextPrinter *currentPrinter = sFirstTextPrinter;
|
||||
bool32 foundPrinter = FALSE;
|
||||
// This loop cannot exit early because a single window/sprite group can have multiple printers attached to it
|
||||
while (currentPrinter != NULL)
|
||||
{
|
||||
switch (type)
|
||||
|
|
@ -2756,6 +2758,7 @@ void DeactivateSingleTextPrinter(u32 id, enum TextPrinterType type)
|
|||
{
|
||||
currentPrinter->isInUse = FALSE;
|
||||
currentPrinter = NULL;
|
||||
foundPrinter = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2763,10 +2766,11 @@ void DeactivateSingleTextPrinter(u32 id, enum TextPrinterType type)
|
|||
}
|
||||
break;
|
||||
case SPRITE_TEXT_PRINTER:
|
||||
if (currentPrinter->printerTemplate.type == SPRITE_TEXT_PRINTER && currentPrinter->printerTemplate.spriteId == id)
|
||||
if (currentPrinter->printerTemplate.type == SPRITE_TEXT_PRINTER && currentPrinter->printerTemplate.firstSprite == id)
|
||||
{
|
||||
currentPrinter->isInUse = FALSE;
|
||||
currentPrinter = NULL;
|
||||
foundPrinter = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2776,5 +2780,6 @@ void DeactivateSingleTextPrinter(u32 id, enum TextPrinterType type)
|
|||
}
|
||||
}
|
||||
|
||||
FreeFinishedTextPrinters();
|
||||
if (foundPrinter)
|
||||
FreeFinishedTextPrinters();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user