Simplifies the function signature of CustomMessage_RetrieveIfExists.

This commit is contained in:
Christopher Leggett 2022-07-17 15:11:16 -04:00
parent 69d2b5b3a3
commit 98c771cf2c
No known key found for this signature in database
GPG Key ID: 7093AE5FF7037D79
3 changed files with 6 additions and 4 deletions

View File

@ -1513,13 +1513,15 @@ extern "C" int Randomizer_GetCustomGetItemMessage(GetItemID giid, char* buffer,
return CopyStringToCharBuffer(getItemText, buffer, maxBufferSize);
}
extern "C" int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx, char* buffer, const int maxBufferSize) {
extern "C" int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx) {
MessageContext* msgCtx = &globalCtx->msgCtx;
Font* font = &msgCtx->font;
char* buffer = font->msgBuf;
const int maxBufferSize = sizeof(font->msgBuf);
if (gSaveContext.n64ddFlag) {
if (msgCtx->textId == 0xF8) {
if (msgCtx->msgLength = font->msgLength = Randomizer_GetCustomGetItemMessage(
(GetItemID)GET_PLAYER(globalCtx)->getItemId, font->msgBuf, sizeof(font->msgBuf))) {
(GetItemID)GET_PLAYER(globalCtx)->getItemId, buffer, maxBufferSize)) {
font->charTexBuf[0] = 0x23;
return true;
} else {

View File

@ -97,7 +97,7 @@ s32 GetItemIDFromGetItemID(s32 getItemId);
s32 GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum);
s32 GetRandomizedItemIdFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogId);
int Randomizer_GetCustomGetItemMessage(GetItemID giid, char* buffer, const int maxBufferSize);
int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx, char* buffer, const int maxBufferSize);
int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx);
#endif
#endif

View File

@ -1662,7 +1662,7 @@ void Message_OpenText(GlobalContext* globalCtx, u16 textId) {
gSaveContext.eventInf[0] = gSaveContext.eventInf[1] = gSaveContext.eventInf[2] = gSaveContext.eventInf[3] = 0;
}
if (CustomMessage_RetrieveIfExists(globalCtx, font->msgBuf, sizeof(font->msgBuf))) {
if (CustomMessage_RetrieveIfExists(globalCtx)) {
osSyncPrintf("Found custom message");
} else if (sTextIsCredits) {
Message_FindCreditsMessage(globalCtx, textId);