Fixes ocarina textbox flashing (#1589)

This commit is contained in:
Christopher Leggett 2022-09-26 03:01:58 -04:00 committed by GitHub
parent 7758749770
commit ee505fc47d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 2 deletions

View File

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