diff options
| author | Christopher Leggett <chris@leggett.dev> | 2022-09-26 03:01:58 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-26 09:01:58 +0200 |
| commit | ee505fc47db09834a885f547c20ea1cbb92b9f8a (patch) | |
| tree | d8e1d4568868ff5a4f3f400f8e1c4dbeeafea089 /soh/src/code | |
| parent | 7758749770985cfe2a3f466922125599fa3b074f (diff) | |
Fixes ocarina textbox flashing (#1589)
Diffstat (limited to 'soh/src/code')
| -rw-r--r-- | soh/src/code/z_message_PAL.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index 4ed8a3f62..c004d8656 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -1281,8 +1281,15 @@ void Message_Decode(GlobalContext* globalCtx) { MessageContext* msgCtx = &globalCtx->msgCtx; Font* font = &globalCtx->msgCtx.font; - for (u32 i = 0; i < FONT_CHAR_TEX_SIZE * 120; i += FONT_CHAR_TEX_SIZE) { - gSPInvalidateTexCache(globalCtx->state.gfxCtx->polyOpa.p++, &font->charTexBuf[i]); + if ((msgCtx->msgMode >= MSGMODE_OCARINA_STARTING && msgCtx->msgMode <= MSGMODE_OCARINA_AWAIT_INPUT) || msgCtx->textBoxType == TEXTBOX_TYPE_OCARINA) { + // TODO: Figure out what specific textures to invalidate to prevent the ocarina textboxes from flashing + gSPInvalidateTexCache(globalCtx->state.gfxCtx->polyOpa.p++, NULL); + } else { + for (u32 i = 0; i < FONT_CHAR_TEX_SIZE * 120; i += FONT_CHAR_TEX_SIZE) { + if (&font->charTexBuf[i] != NULL) { + gSPInvalidateTexCache(globalCtx->state.gfxCtx->polyOpa.p++, &font->charTexBuf[i]); + } + } } globalCtx->msgCtx.textDelayTimer = 0; @@ -1680,6 +1687,17 @@ void Message_OpenText(GlobalContext* globalCtx, u16 textId) { } sMessageHasSetSfx = D_8014B2F4 = sTextboxSkipped = sTextIsCredits = 0; + if ((msgCtx->msgMode >= MSGMODE_OCARINA_STARTING && msgCtx->msgMode <= MSGMODE_OCARINA_AWAIT_INPUT) || + msgCtx->textBoxType == TEXTBOX_TYPE_OCARINA) { + // TODO: Figure out what specific textures to invalidate to prevent the ocarina textboxes from flashing + gSPInvalidateTexCache(globalCtx->state.gfxCtx->polyOpa.p++, NULL); + } else { + for (u32 i = 0; i < FONT_CHAR_TEX_SIZE * 120; i += FONT_CHAR_TEX_SIZE) { + if (&font->charTexBuf[i] != NULL) { + gSPInvalidateTexCache(globalCtx->state.gfxCtx->polyOpa.p++, &font->charTexBuf[i]); + } + } + } if (textId >= 0x0500 && textId < 0x0600) { // text ids 0500 to 0600 are reserved for credits sTextIsCredits = true; |
