Implements function to return custom message if one exists.

`CustomMessage_RetrieveIfExists` is placed at the very beginning of the z_message_PAL.c `Message_OpenText` if statement after any special changes to textIds are made. This function will either return either true or false and if true it will populate the necessary values of font and msgCtx to display said message. It's placement at the beginning also allows for overriding existing textIds to have new information, which will come in handy later.
This commit is contained in:
Christopher Leggett 2022-07-17 15:02:08 -04:00
commit 69d2b5b3a3
No known key found for this signature in database
GPG key ID: 7093AE5FF7037D79
3 changed files with 35 additions and 3 deletions

View file

@ -1662,7 +1662,9 @@ void Message_OpenText(GlobalContext* globalCtx, u16 textId) {
gSaveContext.eventInf[0] = gSaveContext.eventInf[1] = gSaveContext.eventInf[2] = gSaveContext.eventInf[3] = 0;
}
if (sTextIsCredits) {
if (CustomMessage_RetrieveIfExists(globalCtx, font->msgBuf, sizeof(font->msgBuf))) {
osSyncPrintf("Found custom message");
} else if (sTextIsCredits) {
Message_FindCreditsMessage(globalCtx, textId);
msgCtx->msgLength = font->msgLength;
char* src = (uintptr_t)font->msgOffset;
@ -1735,11 +1737,11 @@ void Message_OpenText(GlobalContext* globalCtx, u16 textId) {
} else {
msgCtx->msgLength = font->msgLength = CopyGanonHintText(font->msgBuf, sizeof(font->msgBuf));
}
} else if (gSaveContext.n64ddFlag && textId == 0xF8) {
} /*else if (gSaveContext.n64ddFlag && textId == 0xF8) {
msgCtx->msgLength = font->msgLength = Randomizer_GetCustomGetItemMessage(
GET_PLAYER(globalCtx)->getItemId, font->msgBuf, sizeof(font->msgBuf));
font->charTexBuf[0] = 0x23;
} else {
}*/ else {
msgCtx->msgLength = font->msgLength;
char* src = (uintptr_t)font->msgOffset;
memcpy(font->msgBuf, src, font->msgLength);