From 67d48123f8ec5a3790b62d7c2c43f81e1b4f7345 Mon Sep 17 00:00:00 2001 From: cadmic Date: Thu, 16 Jan 2025 09:55:43 -0800 Subject: [PATCH 1/7] [iQue] z_message: work around EGCS bug --- Makefile | 2 +- include/z64message.h | 2 +- src/code/z_message.c | 238 +++++++++++++++++++++++-------------------- 3 files changed, 128 insertions(+), 114 deletions(-) diff --git a/Makefile b/Makefile index 6586f3c09a2..f78e15a9371 100644 --- a/Makefile +++ b/Makefile @@ -579,7 +579,7 @@ EGCS_O_FILES += $(BUILD_DIR)/src/code/z_actor.o EGCS_O_FILES += $(BUILD_DIR)/src/code/z_common_data.o EGCS_O_FILES += $(BUILD_DIR)/src/code/z_construct.o EGCS_O_FILES += $(BUILD_DIR)/src/code/z_kanfont.o -# EGCS_O_FILES += $(BUILD_DIR)/src/code/z_message.o +EGCS_O_FILES += $(BUILD_DIR)/src/code/z_message.o EGCS_O_FILES += $(BUILD_DIR)/src/code/z_parameter.o EGCS_O_FILES += $(BUILD_DIR)/src/code/z_sram.o EGCS_O_FILES += $(BUILD_DIR)/src/overlays/actors/ovl_En_Mag/z_en_mag.o diff --git a/include/z64message.h b/include/z64message.h index ad2e19f5473..9160db0120d 100644 --- a/include/z64message.h +++ b/include/z64message.h @@ -209,7 +209,7 @@ typedef struct Font { /* 0x3C88 */ u64 force_structure_alignment_font; }; union { - /* 0xDC88 */ char msgBuf[1280]; + /* 0xDC88 */ u8 msgBuf[1280]; /* 0xDC88 */ u16 msgBufWide[640]; /* 0xDC88 */ u64 force_structure_alignment_msg; }; diff --git a/src/code/z_message.c b/src/code/z_message.c index f775929a644..f64820a94df 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -10,6 +10,19 @@ #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ "ntsc-1.0:80 ntsc-1.1:80 ntsc-1.2:80 pal-1.0:128 pal-1.1:128" +#if !PLATFORM_IQUE +#define MSG_BUF_DECODED(msgCtx) ((msgCtx)->msgBufDecoded) +#define MSG_BUF_DECODED_WIDE(msgCtx) ((msgCtx)->msgBufDecodedWide) +#define MSG_BUF(font) ((font)->msgBuf) +#define MSG_BUF_WIDE(font) ((font)->msgBufWide) +#else +// Workaround for EGCS internal compiler error (see docs/compilers.md) +#define MSG_BUF_DECODED(msgCtx) ((u8*)(msgCtx)->msgBufDecoded) +#define MSG_BUF_DECODED_WIDE(msgCtx) ((u16*)(msgCtx)->msgBufDecodedWide) +#define MSG_BUF(font) ((u8*)(font)->msgBuf) +#define MSG_BUF_WIDE(font) ((u16*)(font)->msgBufWide) +#endif + #if !PLATFORM_GC #define OCARINA_BUTTON_A_PRIM_1_R 80 #define OCARINA_BUTTON_A_PRIM_1_G 150 @@ -1089,7 +1102,7 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { charTexIdx = 0; for (i = 0; i < msgCtx->textDrawPos; i++) { - character = msgCtx->msgBufDecodedWide[i]; + character = MSG_BUF_DECODED_WIDE(msgCtx)[i]; switch (character) { case MESSAGE_WIDE_NEWLINE: @@ -1103,7 +1116,7 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { } break; case MESSAGE_WIDE_COLOR: - Message_SetTextColor(msgCtx, msgCtx->msgBufDecodedWide[++i]); + Message_SetTextColor(msgCtx, MSG_BUF_DECODED_WIDE(msgCtx)[++i]); break; case MESSAGE_WIDE_CHAR_SPACE: msgCtx->textPosX += MESSAGE_SPACE_WIDTH; @@ -1124,7 +1137,7 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { *gfxP = gfx; return; case MESSAGE_WIDE_SHIFT: - msgCtx->textPosX += msgCtx->msgBufDecodedWide[++i]; + msgCtx->textPosX += MSG_BUF_DECODED_WIDE(msgCtx)[++i]; break; case MESSAGE_WIDE_TEXTID: msgCtx->textboxEndType = TEXTBOX_ENDTYPE_HAS_NEXT; @@ -1142,7 +1155,7 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { msgCtx->msgMode < MSGMODE_SCARECROW_LONG_RECORDING_START))) { j = i; while (true) { - character = msgCtx->msgBufDecodedWide[j]; + character = MSG_BUF_DECODED_WIDE(msgCtx)[j]; if ((character != MESSAGE_WIDE_QUICKTEXT_DISABLE) && (character != MESSAGE_WIDE_PERSISTENT) && (character != MESSAGE_WIDE_EVENT) && (character != MESSAGE_WIDE_BOX_BREAK_DELAYED) && (character != MESSAGE_WIDE_AWAIT_BUTTON_PRESS) && (character != MESSAGE_WIDE_BOX_BREAK) && @@ -1170,7 +1183,7 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { break; case MESSAGE_WIDE_BOX_BREAK_DELAYED: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { - msgCtx->stateTimer = msgCtx->msgBufDecodedWide[++i]; + msgCtx->stateTimer = MSG_BUF_DECODED_WIDE(msgCtx)[++i]; msgCtx->msgMode = MSGMODE_TEXT_DELAYED_BREAK; } *gfxP = gfx; @@ -1180,13 +1193,13 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { case MESSAGE_WIDE_SFX: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING && !sMessageHasSetSfx) { sMessageHasSetSfx = true; - Audio_PlaySfxGeneral(msgCtx->msgBufDecodedWide[i + 1], &gSfxDefaultPos, 4, + Audio_PlaySfxGeneral(MSG_BUF_DECODED_WIDE(msgCtx)[i + 1], &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } i++; break; case MESSAGE_WIDE_ITEM_ICON: - i = Message_DrawItemIcon(play, msgCtx->msgBufDecodedWide[i + 1], &gfx, i); + i = Message_DrawItemIcon(play, MSG_BUF_DECODED_WIDE(msgCtx)[i + 1], &gfx, i); break; case MESSAGE_WIDE_BACKGROUND: // clang-format off @@ -1248,7 +1261,7 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { msgCtx->textPosX += 32; break; case MESSAGE_WIDE_TEXT_SPEED: - msgCtx->textDelay = msgCtx->msgBufDecodedWide[++i]; + msgCtx->textDelay = MSG_BUF_DECODED_WIDE(msgCtx)[++i]; break; case MESSAGE_WIDE_UNSKIPPABLE: msgCtx->textUnskippable = true; @@ -1296,7 +1309,7 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; msgCtx->textboxEndType = TEXTBOX_ENDTYPE_FADING; - msgCtx->stateTimer = msgCtx->msgBufDecodedWide[++i]; + msgCtx->stateTimer = MSG_BUF_DECODED_WIDE(msgCtx)[++i]; Font_LoadMessageBoxIcon(font, TEXTBOX_ICON_SQUARE); if (play->csCtx.state == CS_STATE_IDLE) { Interface_SetDoAction(play, DO_ACTION_RETURN); @@ -1418,7 +1431,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { charTexIdx = 0; for (i = 0; i < msgCtx->textDrawPos; i++) { - character = msgCtx->msgBufDecoded[i]; + character = MSG_BUF_DECODED(msgCtx)[i]; switch (character) { case MESSAGE_NEWLINE: @@ -1432,7 +1445,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { msgCtx->textPosY += R_TEXT_LINE_SPACING; break; case MESSAGE_COLOR: - Message_SetTextColor(msgCtx, msgCtx->msgBufDecoded[++i] & 0xF); + Message_SetTextColor(msgCtx, MSG_BUF_DECODED(msgCtx)[++i] & 0xF); break; case MESSAGE_CHAR_SPACE: msgCtx->textPosX += MESSAGE_SPACE_WIDTH; @@ -1453,7 +1466,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { *gfxP = gfx; return; case MESSAGE_SHIFT: - msgCtx->textPosX += msgCtx->msgBufDecoded[++i]; + msgCtx->textPosX += MSG_BUF_DECODED(msgCtx)[++i]; break; case MESSAGE_TEXTID: msgCtx->textboxEndType = TEXTBOX_ENDTYPE_HAS_NEXT; @@ -1471,7 +1484,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { msgCtx->msgMode < MSGMODE_SCARECROW_LONG_RECORDING_START))) { j = i; while (true) { - character = msgCtx->msgBufDecoded[j]; + character = MSG_BUF_DECODED(msgCtx)[j]; if (character == MESSAGE_SHIFT) { j += 2; } else if ((character != MESSAGE_QUICKTEXT_DISABLE) && (character != MESSAGE_PERSISTENT) && @@ -1501,7 +1514,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { break; case MESSAGE_BOX_BREAK_DELAYED: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { - msgCtx->stateTimer = msgCtx->msgBufDecoded[++i]; + msgCtx->stateTimer = MSG_BUF_DECODED(msgCtx)[++i]; msgCtx->msgMode = MSGMODE_TEXT_DELAYED_BREAK; } *gfxP = gfx; @@ -1510,10 +1523,10 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; msgCtx->textboxEndType = TEXTBOX_ENDTYPE_FADING; - PRINTF(T("タイマー (%x) (%x)", "Timer (%x) (%x)"), msgCtx->msgBufDecoded[i + 1], - msgCtx->msgBufDecoded[i + 2]); - msgCtx->stateTimer = msgCtx->msgBufDecoded[++i] << 8; - msgCtx->stateTimer |= msgCtx->msgBufDecoded[++i]; + PRINTF(T("タイマー (%x) (%x)", "Timer (%x) (%x)"), MSG_BUF_DECODED(msgCtx)[i + 1], + MSG_BUF_DECODED(msgCtx)[i + 2]); + msgCtx->stateTimer = MSG_BUF_DECODED(msgCtx)[++i] << 8; + msgCtx->stateTimer |= MSG_BUF_DECODED(msgCtx)[++i]; PRINTF(T("合計wct=%x(%d)\n", " Total wct=%x(%d)\n"), msgCtx->stateTimer, msgCtx->stateTimer); } *gfxP = gfx; @@ -1522,15 +1535,15 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING && !sMessageHasSetSfx) { sMessageHasSetSfx = true; PRINTF(T("サウンド(SE)\n", "Sound (SE)\n")); - sfxHi = msgCtx->msgBufDecoded[i + 1]; + sfxHi = MSG_BUF_DECODED(msgCtx)[i + 1]; sfxHi <<= 8; - Audio_PlaySfxGeneral(sfxHi | msgCtx->msgBufDecoded[i + 2], &gSfxDefaultPos, 4, + Audio_PlaySfxGeneral(sfxHi | MSG_BUF_DECODED(msgCtx)[i + 2], &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } i += 2; break; case MESSAGE_ITEM_ICON: - i = Message_DrawItemIcon(play, msgCtx->msgBufDecoded[i + 1], &gfx, i); + i = Message_DrawItemIcon(play, MSG_BUF_DECODED(msgCtx)[i + 1], &gfx, i); break; case MESSAGE_BACKGROUND: // clang-format off @@ -1592,7 +1605,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { msgCtx->textPosX += 32; break; case MESSAGE_TEXT_SPEED: - msgCtx->textDelay = msgCtx->msgBufDecoded[++i]; + msgCtx->textDelay = MSG_BUF_DECODED(msgCtx)[++i]; break; case MESSAGE_UNSKIPPABLE: msgCtx->textUnskippable = true; @@ -1640,7 +1653,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; msgCtx->textboxEndType = TEXTBOX_ENDTYPE_FADING; - msgCtx->stateTimer = msgCtx->msgBufDecoded[++i]; + msgCtx->stateTimer = MSG_BUF_DECODED(msgCtx)[++i]; Font_LoadMessageBoxIcon(font, TEXTBOX_ICON_SQUARE); if (play->csCtx.state == 0) { Interface_SetDoAction(play, DO_ACTION_RETURN); @@ -1747,7 +1760,7 @@ void Message_Decode(PlayState* play) { if (gSaveContext.language == LANGUAGE_JPN && !sTextIsCredits) { // Japanese text (NTSC only) while (true) { - curCharWide = msgCtx->msgBufDecodedWide[decodedBufPos] = font->msgBufWide[msgCtx->msgBufPos]; + curCharWide = MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = MSG_BUF_WIDE(font)[msgCtx->msgBufPos]; if (curCharWide == MESSAGE_WIDE_BOX_BREAK || curCharWide == MESSAGE_WIDE_TEXTID || curCharWide == MESSAGE_WIDE_BOX_BREAK_DELAYED || curCharWide == MESSAGE_WIDE_EVENT || @@ -1764,10 +1777,11 @@ void Message_Decode(PlayState* play) { } } if (curCharWide == MESSAGE_WIDE_TEXTID) { - sNextTextId = msgCtx->msgBufDecodedWide[++decodedBufPos] = font->msgBufWide[msgCtx->msgBufPos + 1]; + sNextTextId = MSG_BUF_DECODED_WIDE(msgCtx)[++decodedBufPos] = + MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 1]; } if (curCharWide == MESSAGE_WIDE_BOX_BREAK_DELAYED) { - msgCtx->msgBufDecodedWide[++decodedBufPos] = font->msgBufWide[msgCtx->msgBufPos + 1]; + MSG_BUF_DECODED_WIDE(msgCtx)[++decodedBufPos] = MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 1]; msgCtx->msgBufPos += 2; } msgCtx->decodedTextLen = decodedBufPos; @@ -1787,7 +1801,7 @@ void Message_Decode(PlayState* play) { for (i = 0; i < playerNameLen; i++) { curCharWide = gSaveContext.save.info.playerData.playerName[i]; fontBuf = &font->fontBuf[(curCharWide * 32) << 2]; // fake - msgCtx->msgBufDecodedWide[decodedBufPos + i] = MESSAGE_WIDE_NAME; + MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos + i] = MESSAGE_WIDE_NAME; for (j = 0; j < FONT_CHAR_TEX_SIZE; j += 4) { font->charTexBuf[charTexIdx + j + 0] = fontBuf[j + 0]; @@ -1823,17 +1837,17 @@ void Message_Decode(PlayState* play) { for (i = 0; i < 4; i++) { Font_LoadCharWide(font, digits[i] + MESSAGE_WIDE_CHAR_ZERO, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecodedWide[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; + MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; decodedBufPos++; if (i == 1) { Font_LoadCharWide(font, MESSAGE_WIDE_CHAR_MINUTES, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecodedWide[decodedBufPos] = MESSAGE_WIDE_CHAR_MINUTES; + MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = MESSAGE_WIDE_CHAR_MINUTES; decodedBufPos++; } else if (i == 3) { Font_LoadCharWide(font, MESSAGE_WIDE_CHAR_SECONDS, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecodedWide[decodedBufPos] = MESSAGE_WIDE_CHAR_SECONDS; + MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = MESSAGE_WIDE_CHAR_SECONDS; } } } else if (curCharWide == MESSAGE_WIDE_POINTS) { @@ -1862,7 +1876,7 @@ void Message_Decode(PlayState* play) { if (loadChar) { Font_LoadCharWide(font, digits[i] + MESSAGE_WIDE_CHAR_ZERO, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecodedWide[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; + MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; decodedBufPos++; } } @@ -1890,7 +1904,7 @@ void Message_Decode(PlayState* play) { if (loadChar) { Font_LoadCharWide(font, digits[i] + MESSAGE_WIDE_CHAR_ZERO, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecodedWide[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; + MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; decodedBufPos++; } } @@ -1908,21 +1922,21 @@ void Message_Decode(PlayState* play) { if (i == 1 || digits[i] != 0) { Font_LoadCharWide(font, digits[i] + MESSAGE_WIDE_CHAR_ZERO, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecodedWide[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; + MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; decodedBufPos++; } } decodedBufPos--; } else if (curCharWide == MESSAGE_WIDE_HIGHSCORE) { - value = HIGH_SCORE(font->msgBufWide[++msgCtx->msgBufPos] & 0xFF); - if ((font->msgBufWide[msgCtx->msgBufPos] & 0xFF) == HS_FISHING) { + value = HIGH_SCORE(MSG_BUF_WIDE(font)[++msgCtx->msgBufPos] & 0xFF); + if ((MSG_BUF_WIDE(font)[msgCtx->msgBufPos] & 0xFF) == HS_FISHING) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { value &= 0x7F; } else { - value = ((HIGH_SCORE(font->msgBufWide[msgCtx->msgBufPos]) & 0xFF000000) >> 0x18) & 0x7F; + value = ((HIGH_SCORE(MSG_BUF_WIDE(font)[msgCtx->msgBufPos]) & 0xFF000000) >> 0x18) & 0x7F; } } - switch (font->msgBufWide[msgCtx->msgBufPos] & 0xFF) { + switch (MSG_BUF_WIDE(font)[msgCtx->msgBufPos] & 0xFF) { case HS_HBA: case HS_POE_POINTS: case HS_FISHING: @@ -1950,7 +1964,7 @@ void Message_Decode(PlayState* play) { if (loadChar) { Font_LoadCharWide(font, digits[i] + MESSAGE_WIDE_CHAR_ZERO, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecodedWide[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; + MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; decodedBufPos++; } } @@ -1980,17 +1994,17 @@ void Message_Decode(PlayState* play) { for (i = 0; i < 4; i++) { Font_LoadCharWide(font, digits[i] + MESSAGE_WIDE_CHAR_ZERO, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecodedWide[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; + MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; decodedBufPos++; if (i == 1) { Font_LoadCharWide(font, MESSAGE_WIDE_CHAR_MINUTES, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecodedWide[decodedBufPos] = MESSAGE_WIDE_CHAR_MINUTES; + MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = MESSAGE_WIDE_CHAR_MINUTES; decodedBufPos++; } else if (i == 3) { Font_LoadCharWide(font, MESSAGE_WIDE_CHAR_SECONDS, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecodedWide[decodedBufPos] = MESSAGE_WIDE_CHAR_SECONDS; + MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = MESSAGE_WIDE_CHAR_SECONDS; } } break; @@ -2014,28 +2028,28 @@ void Message_Decode(PlayState* play) { for (i = 0; i < 4; i++) { Font_LoadCharWide(font, digits[i] + MESSAGE_WIDE_CHAR_ZERO, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecodedWide[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; + MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; decodedBufPos++; if (i == 1) { Font_LoadCharWide(font, MESSAGE_WIDE_CHAR_HOURS, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecodedWide[decodedBufPos] = MESSAGE_WIDE_CHAR_HOURS; + MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = MESSAGE_WIDE_CHAR_HOURS; decodedBufPos++; } else if (i == 3) { Font_LoadCharWide(font, MESSAGE_WIDE_CHAR_MINUTES, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecodedWide[decodedBufPos] = MESSAGE_WIDE_CHAR_MINUTES; + MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = MESSAGE_WIDE_CHAR_MINUTES; } } } else if (curCharWide == MESSAGE_WIDE_ITEM_ICON) { - msgCtx->msgBufDecodedWide[++decodedBufPos] = font->msgBufWide[msgCtx->msgBufPos + 1]; - Message_LoadItemIcon(play, font->msgBufWide[msgCtx->msgBufPos + 1], R_TEXTBOX_Y + 10); + MSG_BUF_DECODED_WIDE(msgCtx)[++decodedBufPos] = MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 1]; + Message_LoadItemIcon(play, MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 1], R_TEXTBOX_Y + 10); } else if (curCharWide == MESSAGE_WIDE_BACKGROUND) { - msgCtx->textboxBackgroundIdx = font->msgBufWide[msgCtx->msgBufPos + 1] * 2; - msgCtx->textboxBackgroundForeColorIdx = (font->msgBufWide[msgCtx->msgBufPos + 2] & 0xF000) >> 12; - msgCtx->textboxBackgroundBackColorIdx = (font->msgBufWide[msgCtx->msgBufPos + 2] & 0xF00) >> 8; - msgCtx->textboxBackgroundYOffsetIdx = (font->msgBufWide[msgCtx->msgBufPos + 2] & 0xF0) >> 4; - msgCtx->textboxBackgroundUnkArg = font->msgBufWide[msgCtx->msgBufPos + 2] & 0xF; + msgCtx->textboxBackgroundIdx = MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 1] * 2; + msgCtx->textboxBackgroundForeColorIdx = (MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 2] & 0xF000) >> 12; + msgCtx->textboxBackgroundBackColorIdx = (MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 2] & 0xF00) >> 8; + msgCtx->textboxBackgroundYOffsetIdx = (MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 2] & 0xF0) >> 4; + msgCtx->textboxBackgroundUnkArg = MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 2] & 0xF; DMA_REQUEST_SYNC(msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE, (uintptr_t)_message_texture_staticSegmentRomStart + msgCtx->textboxBackgroundIdx * MESSAGE_TEXTURE_STATIC_TEX_SIZE, @@ -2048,7 +2062,7 @@ void Message_Decode(PlayState* play) { msgCtx->msgBufPos += 2; R_TEXTBOX_BG_YPOS = R_TEXTBOX_Y + 8; } else if (curCharWide == MESSAGE_WIDE_COLOR) { - msgCtx->msgBufDecodedWide[++decodedBufPos] = font->msgBufWide[++msgCtx->msgBufPos] & 0xF; + MSG_BUF_DECODED_WIDE(msgCtx)[++decodedBufPos] = MSG_BUF_WIDE(font)[++msgCtx->msgBufPos] & 0xF; } else if (curCharWide == MESSAGE_WIDE_NEWLINE) { numLines++; } else if (curCharWide != MESSAGE_WIDE_QUICKTEXT_ENABLE && curCharWide != MESSAGE_WIDE_QUICKTEXT_DISABLE && @@ -2056,11 +2070,11 @@ void Message_Decode(PlayState* play) { curCharWide != MESSAGE_WIDE_PERSISTENT && curCharWide != MESSAGE_WIDE_UNSKIPPABLE) { if (curCharWide == MESSAGE_WIDE_FADE) { sTextFade = true; - msgCtx->msgBufDecodedWide[++decodedBufPos] = font->msgBufWide[++msgCtx->msgBufPos] & 0xFF; + MSG_BUF_DECODED_WIDE(msgCtx)[++decodedBufPos] = MSG_BUF_WIDE(font)[++msgCtx->msgBufPos] & 0xFF; } else if (curCharWide == MESSAGE_WIDE_SHIFT || curCharWide == MESSAGE_WIDE_TEXT_SPEED) { - msgCtx->msgBufDecodedWide[++decodedBufPos] = font->msgBufWide[++msgCtx->msgBufPos] & 0xFF; + MSG_BUF_DECODED_WIDE(msgCtx)[++decodedBufPos] = MSG_BUF_WIDE(font)[++msgCtx->msgBufPos] & 0xFF; } else if (curCharWide == MESSAGE_WIDE_SFX) { - msgCtx->msgBufDecodedWide[++decodedBufPos] = font->msgBufWide[++msgCtx->msgBufPos]; + MSG_BUF_DECODED_WIDE(msgCtx)[++decodedBufPos] = MSG_BUF_WIDE(font)[++msgCtx->msgBufPos]; } else if (curCharWide == MESSAGE_WIDE_TWO_CHOICE) { msgCtx->choiceNum = 2; } else if (curCharWide == MESSAGE_WIDE_THREE_CHOICE) { @@ -2079,7 +2093,7 @@ void Message_Decode(PlayState* play) { { // English text for NTSC, eng/ger/fra text for PAL while (true) { - curChar = msgCtx->msgBufDecoded[decodedBufPos] = font->msgBuf[msgCtx->msgBufPos]; + curChar = MSG_BUF_DECODED(msgCtx)[decodedBufPos] = MSG_BUF(font)[msgCtx->msgBufPos]; if (curChar == MESSAGE_BOX_BREAK || curChar == MESSAGE_TEXTID || curChar == MESSAGE_BOX_BREAK_DELAYED || curChar == MESSAGE_EVENT || curChar == MESSAGE_END) { @@ -2098,15 +2112,15 @@ void Message_Decode(PlayState* play) { } } if (curChar == MESSAGE_TEXTID) { - PRINTF("NZ_NEXTMSG=%x, %x, %x\n", font->msgBuf[msgCtx->msgBufPos], - font->msgBuf[msgCtx->msgBufPos + 1], font->msgBuf[msgCtx->msgBufPos + 2]); - value = msgCtx->msgBufDecoded[++decodedBufPos] = font->msgBuf[msgCtx->msgBufPos + 1]; - msgCtx->msgBufDecoded[++decodedBufPos] = font->msgBuf[msgCtx->msgBufPos + 2]; + PRINTF("NZ_NEXTMSG=%x, %x, %x\n", MSG_BUF(font)[msgCtx->msgBufPos], + MSG_BUF(font)[msgCtx->msgBufPos + 1], MSG_BUF(font)[msgCtx->msgBufPos + 2]); + value = MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[msgCtx->msgBufPos + 1]; + MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[msgCtx->msgBufPos + 2]; value <<= 8; - sNextTextId = msgCtx->msgBufDecoded[decodedBufPos] | value; + sNextTextId = MSG_BUF_DECODED(msgCtx)[decodedBufPos] | value; } if (curChar == MESSAGE_BOX_BREAK_DELAYED) { - msgCtx->msgBufDecoded[++decodedBufPos] = font->msgBuf[msgCtx->msgBufPos + 1]; + MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[msgCtx->msgBufPos + 1]; msgCtx->msgBufPos += 2; } msgCtx->decodedTextLen = decodedBufPos; @@ -2146,7 +2160,7 @@ void Message_Decode(PlayState* play) { charTexIdx += FONT_CHAR_TEX_SIZE; } PRINTF("%x ", curChar); - msgCtx->msgBufDecoded[decodedBufPos] = curChar; + MSG_BUF_DECODED(msgCtx)[decodedBufPos] = curChar; decodedBufPos++; } decodedBufPos--; @@ -2177,17 +2191,17 @@ void Message_Decode(PlayState* play) { for (i = 0; i < 4; i++) { Font_LoadChar(font, digits[i] + '0' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecoded[decodedBufPos] = digits[i] + '0'; + MSG_BUF_DECODED(msgCtx)[decodedBufPos] = digits[i] + '0'; decodedBufPos++; if (i == 1) { Font_LoadChar(font, '"' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecoded[decodedBufPos] = '"'; + MSG_BUF_DECODED(msgCtx)[decodedBufPos] = '"'; decodedBufPos++; } else if (i == 3) { Font_LoadChar(font, '"' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecoded[decodedBufPos] = '"'; + MSG_BUF_DECODED(msgCtx)[decodedBufPos] = '"'; } } } else if (curChar == MESSAGE_POINTS) { @@ -2217,7 +2231,7 @@ void Message_Decode(PlayState* play) { } if (loadChar) { Font_LoadChar(font, digits[i] + '0' - ' ', charTexIdx); - msgCtx->msgBufDecoded[decodedBufPos] = digits[i] + '0'; + MSG_BUF_DECODED(msgCtx)[decodedBufPos] = digits[i] + '0'; charTexIdx += FONT_CHAR_TEX_SIZE; decodedBufPos++; } @@ -2248,7 +2262,7 @@ void Message_Decode(PlayState* play) { if (loadChar) { Font_LoadChar(font, digits[i] + '0' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecoded[decodedBufPos] = digits[i] + '0'; + MSG_BUF_DECODED(msgCtx)[decodedBufPos] = digits[i] + '0'; PRINTF("%x(%x) ", digits[i] + '0' - ' ', digits[i]); decodedBufPos++; } @@ -2268,16 +2282,16 @@ void Message_Decode(PlayState* play) { if (i == 1 || digits[i] != 0) { Font_LoadChar(font, digits[i] + '0' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecoded[decodedBufPos] = digits[i] + '0'; + MSG_BUF_DECODED(msgCtx)[decodedBufPos] = digits[i] + '0'; PRINTF("%x(%x) ", digits[i] + '0' - ' ', digits[i]); decodedBufPos++; } } decodedBufPos--; } else if (curChar == MESSAGE_HIGHSCORE) { - value = HIGH_SCORE((u8)font->msgBuf[++msgCtx->msgBufPos]); - PRINTF(T("ランキング=%d\n", "Highscore=%d\n"), font->msgBuf[msgCtx->msgBufPos]); - if ((font->msgBuf[msgCtx->msgBufPos] & 0xFF) == HS_FISHING) { + value = HIGH_SCORE((u8)MSG_BUF(font)[++msgCtx->msgBufPos]); + PRINTF(T("ランキング=%d\n", "Highscore=%d\n"), MSG_BUF(font)[msgCtx->msgBufPos]); + if ((MSG_BUF(font)[msgCtx->msgBufPos] & 0xFF) == HS_FISHING) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { value &= 0x7F; } else { @@ -2285,13 +2299,13 @@ void Message_Decode(PlayState* play) { //! handling?), and the mask is applied to the high score index instead of the high score value //! so this always shows HIGH_SCORE(0). Only the PRINTF is wrong, the following line is correct. PRINTF("HI_SCORE( kanfont->mbuff.nes_mes_buf[message->rdp] & 0xff000000 ) = %x\n", - HIGH_SCORE(font->msgBufWide[msgCtx->msgBufPos] & 0xFF000000)); - value = ((HIGH_SCORE((u8)font->msgBuf[msgCtx->msgBufPos]) & 0xFF000000) >> 0x18) & 0x7F; + HIGH_SCORE(MSG_BUF_WIDE(font)[msgCtx->msgBufPos] & 0xFF000000)); + value = ((HIGH_SCORE((u8)MSG_BUF(font)[msgCtx->msgBufPos]) & 0xFF000000) >> 0x18) & 0x7F; } value = SQ((f32)value) * 0.0036f + 0.5f; PRINTF("score=%d\n", value); } - switch (font->msgBuf[msgCtx->msgBufPos] & 0xFF) { + switch (MSG_BUF(font)[msgCtx->msgBufPos] & 0xFF) { case HS_HBA: case HS_POE_POINTS: case HS_FISHING: @@ -2318,7 +2332,7 @@ void Message_Decode(PlayState* play) { } if (loadChar) { Font_LoadChar(font, digits[i] + '0' - ' ', charTexIdx); - msgCtx->msgBufDecoded[decodedBufPos] = digits[i] + '0'; + MSG_BUF_DECODED(msgCtx)[decodedBufPos] = digits[i] + '0'; charTexIdx += FONT_CHAR_TEX_SIZE; decodedBufPos++; } @@ -2349,17 +2363,17 @@ void Message_Decode(PlayState* play) { for (i = 0; i < 4; i++) { Font_LoadChar(font, digits[i] + '0' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecoded[decodedBufPos] = digits[i] + '0'; + MSG_BUF_DECODED(msgCtx)[decodedBufPos] = digits[i] + '0'; decodedBufPos++; if (i == 1) { Font_LoadChar(font, '"' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecoded[decodedBufPos] = '"'; + MSG_BUF_DECODED(msgCtx)[decodedBufPos] = '"'; decodedBufPos++; } else if (i == 3) { Font_LoadChar(font, '"' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecoded[decodedBufPos] = '"'; + MSG_BUF_DECODED(msgCtx)[decodedBufPos] = '"'; } } break; @@ -2384,34 +2398,34 @@ void Message_Decode(PlayState* play) { for (i = 0; i < 4; i++) { Font_LoadChar(font, digits[i] + '0' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecoded[decodedBufPos] = digits[i] + '0'; + MSG_BUF_DECODED(msgCtx)[decodedBufPos] = digits[i] + '0'; decodedBufPos++; if (i == 1) { Font_LoadChar(font, ':' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - msgCtx->msgBufDecoded[decodedBufPos] = ':'; + MSG_BUF_DECODED(msgCtx)[decodedBufPos] = ':'; decodedBufPos++; } } decodedBufPos--; } else if (curChar == MESSAGE_ITEM_ICON) { - msgCtx->msgBufDecoded[++decodedBufPos] = font->msgBuf[msgCtx->msgBufPos + 1]; - PRINTF("ITEM_NO=(%d) (%d)\n", msgCtx->msgBufDecoded[decodedBufPos], - font->msgBuf[msgCtx->msgBufPos + 1]); - Message_LoadItemIcon(play, font->msgBuf[msgCtx->msgBufPos + 1], R_TEXTBOX_Y + 10); + MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[msgCtx->msgBufPos + 1]; + PRINTF("ITEM_NO=(%d) (%d)\n", MSG_BUF_DECODED(msgCtx)[decodedBufPos], + MSG_BUF(font)[msgCtx->msgBufPos + 1]); + Message_LoadItemIcon(play, MSG_BUF(font)[msgCtx->msgBufPos + 1], R_TEXTBOX_Y + 10); } else if (curChar == MESSAGE_BACKGROUND) { - msgCtx->textboxBackgroundIdx = font->msgBuf[msgCtx->msgBufPos + 1] * 2; + msgCtx->textboxBackgroundIdx = MSG_BUF(font)[msgCtx->msgBufPos + 1] * 2; #if OOT_VERSION < PAL_1_0 //! @bug Wrong shift amounts cause textboxBackgroundForeColorIdx and textboxBackgroundBackColorIdx //! to always be 0. Fortunately MESSAGE_BACKGROUND is only present in unused messages. - msgCtx->textboxBackgroundForeColorIdx = (font->msgBuf[msgCtx->msgBufPos + 2] & 0xF0) >> 12; - msgCtx->textboxBackgroundBackColorIdx = (font->msgBuf[msgCtx->msgBufPos + 2] & 0xF) >> 8; + msgCtx->textboxBackgroundForeColorIdx = (MSG_BUF(font)[msgCtx->msgBufPos + 2] & 0xF0) >> 12; + msgCtx->textboxBackgroundBackColorIdx = (MSG_BUF(font)[msgCtx->msgBufPos + 2] & 0xF) >> 8; #else - msgCtx->textboxBackgroundForeColorIdx = (font->msgBuf[msgCtx->msgBufPos + 2] & 0xF0) >> 4; - msgCtx->textboxBackgroundBackColorIdx = font->msgBuf[msgCtx->msgBufPos + 2] & 0xF; + msgCtx->textboxBackgroundForeColorIdx = (MSG_BUF(font)[msgCtx->msgBufPos + 2] & 0xF0) >> 4; + msgCtx->textboxBackgroundBackColorIdx = MSG_BUF(font)[msgCtx->msgBufPos + 2] & 0xF; #endif - msgCtx->textboxBackgroundYOffsetIdx = (font->msgBuf[msgCtx->msgBufPos + 3] & 0xF0) >> 4; - msgCtx->textboxBackgroundUnkArg = font->msgBuf[msgCtx->msgBufPos + 3] & 0xF; + msgCtx->textboxBackgroundYOffsetIdx = (MSG_BUF(font)[msgCtx->msgBufPos + 3] & 0xF0) >> 4; + msgCtx->textboxBackgroundUnkArg = MSG_BUF(font)[msgCtx->msgBufPos + 3] & 0xF; DMA_REQUEST_SYNC(msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE, (uintptr_t)_message_texture_staticSegmentRomStart + msgCtx->textboxBackgroundIdx * MESSAGE_TEXTURE_STATIC_TEX_SIZE, @@ -2427,7 +2441,7 @@ void Message_Decode(PlayState* play) { R_TEXT_INIT_XPOS = 50; #endif } else if (curChar == MESSAGE_COLOR) { - msgCtx->msgBufDecoded[++decodedBufPos] = font->msgBuf[++msgCtx->msgBufPos]; + MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[++msgCtx->msgBufPos]; } else if (curChar == MESSAGE_NEWLINE) { numLines++; } else if (curChar != MESSAGE_QUICKTEXT_ENABLE && curChar != MESSAGE_QUICKTEXT_DISABLE && @@ -2436,17 +2450,17 @@ void Message_Decode(PlayState* play) { if (curChar == MESSAGE_FADE) { sTextFade = true; PRINTF("NZ_TIMER_END (key_off_flag=%d)\n", sTextFade); - msgCtx->msgBufDecoded[++decodedBufPos] = font->msgBuf[++msgCtx->msgBufPos]; + MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[++msgCtx->msgBufPos]; } else if (curChar == MESSAGE_FADE2) { sTextFade = true; PRINTF("NZ_BGM (key_off_flag=%d)\n", sTextFade); - msgCtx->msgBufDecoded[++decodedBufPos] = font->msgBuf[++msgCtx->msgBufPos]; - msgCtx->msgBufDecoded[++decodedBufPos] = font->msgBuf[++msgCtx->msgBufPos]; + MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[++msgCtx->msgBufPos]; + MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[++msgCtx->msgBufPos]; } else if (curChar == MESSAGE_SHIFT || curChar == MESSAGE_TEXT_SPEED) { - msgCtx->msgBufDecoded[++decodedBufPos] = font->msgBuf[++msgCtx->msgBufPos] & 0xFF; + MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[++msgCtx->msgBufPos] & 0xFF; } else if (curChar == MESSAGE_SFX) { - msgCtx->msgBufDecoded[++decodedBufPos] = font->msgBuf[++msgCtx->msgBufPos]; - msgCtx->msgBufDecoded[++decodedBufPos] = font->msgBuf[++msgCtx->msgBufPos]; + MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[++msgCtx->msgBufPos]; + MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[++msgCtx->msgBufPos]; } else if (curChar == MESSAGE_TWO_CHOICE) { msgCtx->choiceNum = 2; } else if (curChar == MESSAGE_THREE_CHOICE) { @@ -2528,11 +2542,11 @@ void Message_OpenText(PlayState* play, u16 textId) { if ((B_80121220 != NULL) && (B_80121220->unk_60 != NULL) && B_80121220->unk_60(&play->msgCtx.font)) { } else { - DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_staff_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_staff_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", UNK_LINE); } #else - DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_staff_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_staff_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", 1954); #endif } else { @@ -2544,11 +2558,11 @@ void Message_OpenText(PlayState* play, u16 textId) { if ((B_80121220 != NULL) && (B_80121220->unk_64 != NULL) && B_80121220->unk_64(&play->msgCtx.font)) { } else { - DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", UNK_LINE); } #else - DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", UNK_LINE); #endif } else { @@ -2558,11 +2572,11 @@ void Message_OpenText(PlayState* play, u16 textId) { if ((B_80121220 != NULL) && (B_80121220->unk_68 != NULL) && B_80121220->unk_68(&play->msgCtx.font)) { } else { - DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", UNK_LINE); } #else - DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", UNK_LINE); #endif } @@ -2574,11 +2588,11 @@ void Message_OpenText(PlayState* play, u16 textId) { if ((B_80121220 != NULL) && (B_80121220->unk_64 != NULL) && B_80121220->unk_64(&play->msgCtx.font)) { } else { - DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", UNK_LINE); } #else - DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", 1966); #endif } else if (gSaveContext.language == LANGUAGE_GER) { @@ -2589,11 +2603,11 @@ void Message_OpenText(PlayState* play, u16 textId) { if ((B_80121220 != NULL) && (B_80121220->unk_64 != NULL) && B_80121220->unk_68(&play->msgCtx.font)) { } else { - DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_ger_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_ger_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", UNK_LINE); } #else - DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_ger_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_ger_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", 1978); #endif } else { @@ -2604,11 +2618,11 @@ void Message_OpenText(PlayState* play, u16 textId) { if ((B_80121220 != NULL) && (B_80121220->unk_64 != NULL) && B_80121220->unk_6C_PAL(&play->msgCtx.font)) { } else { - DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_fra_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_fra_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", UNK_LINE); } #else - DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_fra_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_fra_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", 1990); #endif } @@ -4259,7 +4273,7 @@ void Message_Update(PlayState* play) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); #if OOT_NTSC if (gSaveContext.language == LANGUAGE_JPN && !sTextIsCredits) { - Message_ContinueTextbox(play, msgCtx->msgBufDecodedWide[msgCtx->textDrawPos]); + Message_ContinueTextbox(play, MSG_BUF_DECODED_WIDE(msgCtx)[msgCtx->textDrawPos]); } else { Message_ContinueTextbox(play, sNextTextId); } From 99975f38393a4ad26f754f12c87b56e03a2eee5f Mon Sep 17 00:00:00 2001 From: cadmic Date: Thu, 16 Jan 2025 10:01:58 -0800 Subject: [PATCH 2/7] [iQue] z_message: finish matching --- include/z64interface.h | 2 +- include/z64message.h | 2 +- include/z64save.h | 2 +- src/code/z_message.c | 312 +++++++++++++++++++++++++++-------------- 4 files changed, 213 insertions(+), 105 deletions(-) diff --git a/include/z64interface.h b/include/z64interface.h index e9284499ab4..26785506d10 100644 --- a/include/z64interface.h +++ b/include/z64interface.h @@ -80,7 +80,7 @@ typedef struct InterfaceContext { /* 0x0134 */ u8* doActionSegment; /* 0x0138 */ u8* iconItemSegment; /* 0x013C */ u8* mapSegment; - /* 0x0140 */ u8 mapPalette[32]; + /* 0x0140 */ char mapPalette[32]; /* 0x0160 */ DmaRequest dmaRequest_160; /* 0x0180 */ DmaRequest dmaRequest_180; /* 0x01A0 */ char unk_1A0[0x20]; diff --git a/include/z64message.h b/include/z64message.h index 9160db0120d..415ab80ac71 100644 --- a/include/z64message.h +++ b/include/z64message.h @@ -255,7 +255,7 @@ typedef struct MessageContext { /* 0xE3E4 */ u8 textboxEndType; // original name : "select" /* 0xE3E5 */ u8 choiceIndex; /* 0xE3E6 */ u8 choiceNum; // textboxes that are not choice textboxes have a choiceNum of 1 - /* 0xE3E7 */ u8 stateTimer; + /* 0xE3E7 */ char stateTimer; /* 0xE3E8 */ u16 textDelayTimer; /* 0xE3EA */ u16 textDelay; /* 0xE3EA */ u16 lastPlayedSong; // original references : "Ocarina_Flog" , "Ocarina_Free" diff --git a/include/z64save.h b/include/z64save.h index fb8767b0a19..62107df5ed8 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -212,7 +212,7 @@ typedef enum WorldMapArea { typedef struct SavePlayerData { /* 0x00 0x001C */ char newf[6]; // string "ZELDAZ" /* 0x06 0x0022 */ u16 deaths; - /* 0x08 0x0024 */ char playerName[8]; + /* 0x08 0x0024 */ u8 playerName[8]; /* 0x10 0x002C */ s16 n64ddFlag; /* 0x12 0x002E */ s16 healthCapacity; // "max_life" /* 0x14 0x0030 */ s16 health; // "now_life" diff --git a/src/code/z_message.c b/src/code/z_message.c index f64820a94df..ee315b261ce 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -108,13 +108,13 @@ s32 sCharTexScale; s16 sTextFade = false; // original name: key_off_flag ? -u8 D_8014B2F4 = 0; +char D_8014B2F4 = 0; s16 sOcarinaButtonIndexBufPos = 0; s16 sOcarinaButtonIndexBufLen = 0; -u8 sTextboxSkipped = false; +char sTextboxSkipped = false; u16 sNextTextId = 0; @@ -306,9 +306,9 @@ void Message_ResetOcarinaNoteState(void) { void Message_UpdateOcarinaMemoryGame(PlayState* play) { MessageContext* msgCtx = &play->msgCtx; - play->msgCtx.msgMode++; + msgCtx->msgMode++; - if (play->msgCtx.msgMode == MSGMODE_MEMORY_GAME_PLAYER_PLAYING) { + if (msgCtx->msgMode == MSGMODE_MEMORY_GAME_PLAYER_PLAYING) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT); msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff(); msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0; @@ -359,7 +359,7 @@ void Message_CloseTextbox(PlayState* play) { } } -void Message_HandleChoiceSelection(PlayState* play, u8 numChoices) { +void Message_HandleChoiceSelection(PlayState* play, char numChoices) { static s16 sAnalogStickHeld = false; MessageContext* msgCtx = &play->msgCtx; Input* input = &play->state.input[0]; @@ -367,21 +367,23 @@ void Message_HandleChoiceSelection(PlayState* play, u8 numChoices) { if (input->rel.stick_y >= 30 && !sAnalogStickHeld) { sAnalogStickHeld = true; msgCtx->choiceIndex--; - if (msgCtx->choiceIndex > 128) { + // NOLINTBEGIN + if (msgCtx->choiceIndex > 128) msgCtx->choiceIndex = 0; - } else { + else Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - } + // NOLINTEND } else if (input->rel.stick_y <= -30 && !sAnalogStickHeld) { sAnalogStickHeld = true; msgCtx->choiceIndex++; - if (msgCtx->choiceIndex > numChoices) { + // NOLINTBEGIN + if (msgCtx->choiceIndex > numChoices) msgCtx->choiceIndex = numChoices; - } else { + else Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - } + // NOLINTEND } else if (ABS(input->rel.stick_y) < 30) { sAnalogStickHeld = false; } @@ -457,7 +459,7 @@ void Message_GrowTextbox(MessageContext* msgCtx) { R_TEXTBOX_TEXWIDTH = texWidth + 0.5f; R_TEXTBOX_TEXHEIGHT = texHeight + 0.5f; // Adjust x pos - R_TEXTBOX_X = (R_TEXTBOX_X_TARGET + R_TEXTBOX_WIDTH_TARGET) - (R_TEXTBOX_WIDTH / 2); + R_TEXTBOX_X = R_TEXTBOX_WIDTH_TARGET - (R_TEXTBOX_WIDTH / 2) + R_TEXTBOX_X_TARGET; } #if OOT_NTSC @@ -479,11 +481,15 @@ void Message_FindMessageJPN(PlayState* play, u16 textId) { nextSeg = messageTableEntry->segment; font->msgOffset = foundSeg - seg; font->msgLength = nextSeg - foundSeg; + PRINTF(T(" メッセージが,見つかった!!! = %x (data=%x) (data0=%x) (data1=%x) (data2=%x) (data3=%x)\n", + "Message found!!! = %x (data=%x) (data0=%x) (data1=%x) (data2=%x) (data3=%x)\n"), + textId, font->msgOffset, font->msgLength, foundSeg, seg, nextSeg); return; } messageTableEntry++; } + PRINTF(T(" メッセージが,見つからなかった!!! = %x\n", "Message not found!!! = %x\n"), textId); messageTableEntry = sJpnMessageEntryTablePtr; foundSeg = messageTableEntry->segment; @@ -511,11 +517,15 @@ void Message_FindMessageNES(PlayState* play, u16 textId) { nextSeg = messageTableEntry->segment; font->msgOffset = foundSeg - seg; font->msgLength = nextSeg - foundSeg; + PRINTF(T(" メッセージが,見つかった!!! = %x (data=%x) (data0=%x) (data1=%x) (data2=%x) (data3=%x)\n", + "Message found!!! = %x (data=%x) (data0=%x) (data1=%x) (data2=%x) (data3=%x)\n"), + textId, font->msgOffset, font->msgLength, foundSeg, seg, nextSeg); return; } messageTableEntry++; } + PRINTF(T(" メッセージが,見つからなかった!!! = %x\n", "Message not found!!! = %x\n"), textId); messageTableEntry = sNesMessageEntryTablePtr; foundSeg = messageTableEntry->segment; @@ -810,6 +820,10 @@ void Message_DrawTextboxIcon(PlayState* play, Gfx** p, s16 x, s16 y) { G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); +#if PLATFORM_IQUE + R_TEXT_CHAR_SCALE = 80; +#endif + sCharTexSize = 16.0f * ((f32)R_TEXT_CHAR_SCALE / 100.0f); sCharTexScale = 1024.0f / ((f32)R_TEXT_CHAR_SCALE / 100.0f); @@ -1015,7 +1029,7 @@ u16 Message_DrawItemIcon(PlayState* play, u16 itemId, Gfx** p, u16 i) { void Message_HandleOcarina(PlayState* play) { MessageContext* msgCtx = &play->msgCtx; - if (play->msgCtx.msgMode == MSGMODE_TEXT_DISPLAYING) { + if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { play->msgCtx.ocarinaMode = OCARINA_MODE_01; if (msgCtx->ocarinaAction == OCARINA_ACTION_SCARECROW_LONG_RECORDING) { @@ -1028,8 +1042,7 @@ void Message_HandleOcarina(PlayState* play) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT); AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT); msgCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff(); - sOcarinaButtonIndexBufPos = sOcarinaButtonIndexBufLen = 0; - msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos; + msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = sOcarinaButtonIndexBufLen = 0; Message_ResetOcarinaNoteState(); msgCtx->stateTimer = 3; msgCtx->msgMode = MSGMODE_SCARECROW_LONG_PLAYBACK; @@ -1043,8 +1056,7 @@ void Message_HandleOcarina(PlayState* play) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT); AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT); msgCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff(); - sOcarinaButtonIndexBufPos = sOcarinaButtonIndexBufLen = 0; - msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos; + msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = sOcarinaButtonIndexBufLen = 0; Message_ResetOcarinaNoteState(); msgCtx->stateTimer = 3; msgCtx->msgMode = MSGMODE_SCARECROW_SPAWN_PLAYBACK; @@ -1089,8 +1101,8 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { u16 charTexIdx; Gfx* gfx = *gfxP; - play->msgCtx.textPosX = R_TEXT_INIT_XPOS; - play->msgCtx.textPosY = R_TEXT_INIT_YPOS; + msgCtx->textPosX = R_TEXT_INIT_XPOS; + msgCtx->textPosY = R_TEXT_INIT_YPOS; if (msgCtx->textBoxType == TEXTBOX_TYPE_NONE_NO_SHADOW) { msgCtx->textColorR = msgCtx->textColorG = msgCtx->textColorB = 0; @@ -1154,16 +1166,15 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { (msgCtx->msgMode >= MSGMODE_OCARINA_STARTING && msgCtx->msgMode < MSGMODE_SCARECROW_LONG_RECORDING_START))) { j = i; - while (true) { + for (;;) { character = MSG_BUF_DECODED_WIDE(msgCtx)[j]; - if ((character != MESSAGE_WIDE_QUICKTEXT_DISABLE) && (character != MESSAGE_WIDE_PERSISTENT) && - (character != MESSAGE_WIDE_EVENT) && (character != MESSAGE_WIDE_BOX_BREAK_DELAYED) && - (character != MESSAGE_WIDE_AWAIT_BUTTON_PRESS) && (character != MESSAGE_WIDE_BOX_BREAK) && - (character != MESSAGE_WIDE_END)) { - j++; - } else { + if ((character == MESSAGE_WIDE_QUICKTEXT_DISABLE) || (character == MESSAGE_WIDE_PERSISTENT) || + (character == MESSAGE_WIDE_EVENT) || (character == MESSAGE_WIDE_BOX_BREAK_DELAYED) || + (character == MESSAGE_WIDE_AWAIT_BUTTON_PRESS) || (character == MESSAGE_WIDE_BOX_BREAK) || + (character == MESSAGE_WIDE_END)) { break; } + j++; } i = j - 1; msgCtx->textDrawPos = i + 1; @@ -1222,7 +1233,7 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { gfx++, (msgCtx->textPosX + 1) << 2, (R_TEXTBOX_BG_YPOS + sTextboxBackgroundYOffsets[msgCtx->textboxBackgroundYOffsetIdx]) << 2, (msgCtx->textPosX + 96 + 1) << 2, - (R_TEXTBOX_BG_YPOS + sTextboxBackgroundYOffsets[msgCtx->textboxBackgroundYOffsetIdx] + 48) << 2, + (R_TEXTBOX_BG_YPOS + 48 + sTextboxBackgroundYOffsets[msgCtx->textboxBackgroundYOffsetIdx]) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); gDPLoadTextureBlock_4b(gfx++, msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE + 0x900, G_IM_FMT_I, 96, @@ -1232,7 +1243,7 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { gfx++, (msgCtx->textPosX + 96 + 1) << 2, (R_TEXTBOX_BG_YPOS + sTextboxBackgroundYOffsets[msgCtx->textboxBackgroundYOffsetIdx]) << 2, (msgCtx->textPosX + 96 + 1 + 96 + 1) << 2, - (R_TEXTBOX_BG_YPOS + sTextboxBackgroundYOffsets[msgCtx->textboxBackgroundYOffsetIdx] + 48) << 2, + (R_TEXTBOX_BG_YPOS + 48 + sTextboxBackgroundYOffsets[msgCtx->textboxBackgroundYOffsetIdx]) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); gDPPipeSync(gfx++); @@ -1352,7 +1363,7 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { msgCtx->textPosX -= 2; break; } - if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING && i + 1 == msgCtx->textDrawPos && + if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING && i == msgCtx->textDrawPos - 1 && msgCtx->textDelayTimer == msgCtx->textDelay) { Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -1414,7 +1425,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { Font* font = &play->msgCtx.font; Gfx* gfx = *gfxP; - play->msgCtx.textPosX = R_TEXT_INIT_XPOS; + msgCtx->textPosX = R_TEXT_INIT_XPOS; if (!sTextIsCredits) { msgCtx->textPosY = R_TEXT_INIT_YPOS; } else { @@ -1483,18 +1494,17 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { (msgCtx->msgMode >= MSGMODE_OCARINA_STARTING && msgCtx->msgMode < MSGMODE_SCARECROW_LONG_RECORDING_START))) { j = i; - while (true) { + for (;;) { character = MSG_BUF_DECODED(msgCtx)[j]; if (character == MESSAGE_SHIFT) { - j += 2; - } else if ((character != MESSAGE_QUICKTEXT_DISABLE) && (character != MESSAGE_PERSISTENT) && - (character != MESSAGE_EVENT) && (character != MESSAGE_BOX_BREAK_DELAYED) && - (character != MESSAGE_AWAIT_BUTTON_PRESS) && (character != MESSAGE_BOX_BREAK) && - (character != MESSAGE_END)) { j++; - } else { + } else if ((character == MESSAGE_QUICKTEXT_DISABLE) || (character == MESSAGE_PERSISTENT) || + (character == MESSAGE_EVENT) || (character == MESSAGE_BOX_BREAK_DELAYED) || + (character == MESSAGE_AWAIT_BUTTON_PRESS) || (character == MESSAGE_BOX_BREAK) || + (character == MESSAGE_END)) { break; } + j++; } i = j - 1; msgCtx->textDrawPos = i + 1; @@ -1566,7 +1576,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { gfx++, (msgCtx->textPosX + 1) << 2, (R_TEXTBOX_BG_YPOS + sTextboxBackgroundYOffsets[msgCtx->textboxBackgroundYOffsetIdx]) << 2, (msgCtx->textPosX + 96 + 1) << 2, - (R_TEXTBOX_BG_YPOS + sTextboxBackgroundYOffsets[msgCtx->textboxBackgroundYOffsetIdx] + 48) << 2, + (R_TEXTBOX_BG_YPOS + 48 + sTextboxBackgroundYOffsets[msgCtx->textboxBackgroundYOffsetIdx]) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); gDPLoadTextureBlock_4b(gfx++, msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE + 0x900, G_IM_FMT_I, 96, @@ -1576,7 +1586,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { gfx++, (msgCtx->textPosX + 96 + 1) << 2, (R_TEXTBOX_BG_YPOS + sTextboxBackgroundYOffsets[msgCtx->textboxBackgroundYOffsetIdx]) << 2, (msgCtx->textPosX + 96 + 1 + 96 + 1) << 2, - (R_TEXTBOX_BG_YPOS + sTextboxBackgroundYOffsets[msgCtx->textboxBackgroundYOffsetIdx] + 48) << 2, + (R_TEXTBOX_BG_YPOS + 48 + sTextboxBackgroundYOffsets[msgCtx->textboxBackgroundYOffsetIdx]) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); gDPPipeSync(gfx++); @@ -1681,11 +1691,18 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { *gfxP = gfx; return; default: - if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING && i + 1 == msgCtx->textDrawPos && + if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING && i == msgCtx->textDrawPos - 1 && msgCtx->textDelayTimer == msgCtx->textDelay) { Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } + +#if PLATFORM_IQUE + if (!sTextIsCredits) { + R_TEXT_CHAR_SCALE = 100; + } +#endif + Message_DrawTextChar(play, &font->charTexBuf[charTexIdx], &gfx); charTexIdx += FONT_CHAR_TEX_SIZE; @@ -1709,8 +1726,8 @@ void Message_LoadItemIcon(PlayState* play, u16 itemId, s16 y) { InterfaceContext* interfaceCtx = &play->interfaceCtx; if (itemId == ITEM_DUNGEON_MAP) { - interfaceCtx->mapPalette[30] = 0xFF; - interfaceCtx->mapPalette[31] = 0xFF; + interfaceCtx->mapPalette[30] = -1; + interfaceCtx->mapPalette[31] = -1; } if (itemId < ITEM_MEDALLION_FOREST) { R_TEXTBOX_ICON_XPOS = R_TEXT_INIT_XPOS - sIconItem32XOffsets[gSaveContext.language]; @@ -1742,7 +1759,7 @@ void Message_Decode(PlayState* play) { s16 decodedBufPos = 0; s16 numLines = 0; s16 digits[4]; - f32 timeInSeconds; + s32 pad; s16 playerNameLen; s16 loadChar; u16 value; @@ -1752,14 +1769,14 @@ void Message_Decode(PlayState* play) { u8* fontBuf; #endif - play->msgCtx.textDelayTimer = 0; - play->msgCtx.textUnskippable = play->msgCtx.textDelay = play->msgCtx.textDelayTimer = 0; + msgCtx->textDelayTimer = 0; + msgCtx->textUnskippable = msgCtx->textDelay = msgCtx->textDelayTimer = 0; sTextFade = false; #if OOT_NTSC if (gSaveContext.language == LANGUAGE_JPN && !sTextIsCredits) { // Japanese text (NTSC only) - while (true) { + for (;;) { curCharWide = MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = MSG_BUF_WIDE(font)[msgCtx->msgBufPos]; if (curCharWide == MESSAGE_WIDE_BOX_BREAK || curCharWide == MESSAGE_WIDE_TEXTID || @@ -1789,8 +1806,7 @@ void Message_Decode(PlayState* play) { msgCtx->textDrawPos = msgCtx->decodedTextLen; } break; - } - if (curCharWide == MESSAGE_WIDE_NAME) { + } else if (curCharWide == MESSAGE_WIDE_NAME) { // Substitute the player name control character for the file's player name. for (playerNameLen = ARRAY_COUNT(gSaveContext.save.info.playerData.playerName); playerNameLen > 0; playerNameLen--) { @@ -1798,10 +1814,12 @@ void Message_Decode(PlayState* play) { break; } } + PRINTF(T("\n名前 = ", "\nName = ")); for (i = 0; i < playerNameLen; i++) { curCharWide = gSaveContext.save.info.playerData.playerName[i]; - fontBuf = &font->fontBuf[(curCharWide * 32) << 2]; // fake + PRINTF("(%x), ", curCharWide); MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos + i] = MESSAGE_WIDE_NAME; + fontBuf = &font->fontBuf[(curCharWide * 32) << 2]; // fake for (j = 0; j < FONT_CHAR_TEX_SIZE; j += 4) { font->charTexBuf[charTexIdx + j + 0] = fontBuf[j + 0]; @@ -1815,6 +1833,7 @@ void Message_Decode(PlayState* play) { } else if (curCharWide == MESSAGE_WIDE_MARATHON_TIME || curCharWide == MESSAGE_WIDE_RACE_TIME) { // Convert the values of the appropriate timer to digits and add the // digits to the decoded buffer in place of the control character. + PRINTF(T("\nEVENTタイマー = \n", "\nEVENT timer = \n")); digits[0] = digits[1] = digits[2] = 0; if (curCharWide == MESSAGE_WIDE_RACE_TIME) { digits[3] = gSaveContext.timerSeconds; @@ -1835,6 +1854,7 @@ void Message_Decode(PlayState* play) { } for (i = 0; i < 4; i++) { + PRINTF("rpc[%d] = %x\n", i, digits[i] + MESSAGE_WIDE_CHAR_ZERO); Font_LoadCharWide(font, digits[i] + MESSAGE_WIDE_CHAR_ZERO, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; @@ -1853,6 +1873,7 @@ void Message_Decode(PlayState* play) { } else if (curCharWide == MESSAGE_WIDE_POINTS) { // Convert the values of the current minigame score to digits and // add the digits to the decoded buffer in place of the control character. + PRINTF(T("\n流鏑馬スコア = ", "\nYabusame score = ")); digits[0] = digits[1] = digits[2] = 0; digits[3] = gSaveContext.minigameScore; @@ -1884,6 +1905,8 @@ void Message_Decode(PlayState* play) { } else if (curCharWide == MESSAGE_WIDE_TOKENS) { // Convert the current number of collected gold skulltula tokens to digits and // add the digits to the decoded buffer in place of the control character. + PRINTF(T("\n金スタ合計数 = %d", "\nTotal number of gold stars = %d"), + gSaveContext.save.info.inventory.gsTokens); digits[0] = digits[1] = 0; digits[2] = gSaveContext.save.info.inventory.gsTokens; @@ -1910,6 +1933,7 @@ void Message_Decode(PlayState* play) { } decodedBufPos--; } else if (curCharWide == MESSAGE_WIDE_FISH_INFO) { + PRINTF(T("\n釣り堀魚サイズ = ", "\nFishing hole fish size = ")); digits[0] = 0; digits[1] = gSaveContext.minigameScore; @@ -1931,9 +1955,25 @@ void Message_Decode(PlayState* play) { value = HIGH_SCORE(MSG_BUF_WIDE(font)[++msgCtx->msgBufPos] & 0xFF); if ((MSG_BUF_WIDE(font)[msgCtx->msgBufPos] & 0xFF) == HS_FISHING) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { +#if !PLATFORM_IQUE + PRINTF("HI_SCORE(kanfont->mbuff.message_buf[message->rdp]) = %x\n", + HIGH_SCORE(MSG_BUF_WIDE(font)[msgCtx->msgBufPos])); +#else + PRINTF("HI_SCORE(((unshort *)(kanfont->mbuff.message_buf))[message->rdp]) = %x\n", + HIGH_SCORE(MSG_BUF_WIDE(font)[msgCtx->msgBufPos])); +#endif value &= 0x7F; } else { - value = ((HIGH_SCORE(MSG_BUF_WIDE(font)[msgCtx->msgBufPos]) & 0xFF000000) >> 0x18) & 0x7F; +#if !PLATFORM_IQUE + PRINTF("HI_SCORE( kanfont->mbuff.message_buf[message->rdp]) = %x\n", + HIGH_SCORE(MSG_BUF_WIDE(font)[msgCtx->msgBufPos])); +#else + PRINTF( + "HI_SCORE( ((unshort *)(kanfont->mbuff.message_buf))[message->rdp]) & 0xff000000 = %x\n", + HIGH_SCORE(MSG_BUF_WIDE(font)[msgCtx->msgBufPos]) & 0xFF000000); +#endif + value = ((HIGH_SCORE(MSG_BUF_WIDE(font)[msgCtx->msgBufPos]) & 0xFF000000) >> 0x18); + value &= 0x7F; } } switch (MSG_BUF_WIDE(font)[msgCtx->msgBufPos] & 0xFF) { @@ -2010,22 +2050,22 @@ void Message_Decode(PlayState* play) { break; } } else if (curCharWide == MESSAGE_WIDE_TIME) { + PRINTF(T("\nゼルダ時間 = ", "\nZelda time = ")); digits[0] = 0; - timeInSeconds = gSaveContext.save.dayTime * (24.0f * 60.0f / 0x10000); - - digits[1] = timeInSeconds / 60.0f; + digits[1] = (gSaveContext.save.dayTime * (24.0f * 60.0f / 0x10000)) / 60.0f; while (digits[1] >= 10) { digits[0]++; digits[1] -= 10; } digits[2] = 0; - digits[3] = (s16)timeInSeconds % 60; + digits[3] = (s16)(gSaveContext.save.dayTime * (24.0f * 60.0f / 0x10000)) % 60; while (digits[3] >= 10) { digits[2]++; digits[3] -= 10; } for (i = 0; i < 4; i++) { + PRINTF("rpc[%d] = %x\n", i, digits[i] + MESSAGE_WIDE_CHAR_ZERO); Font_LoadCharWide(font, digits[i] + MESSAGE_WIDE_CHAR_ZERO, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; @@ -2043,9 +2083,12 @@ void Message_Decode(PlayState* play) { } } else if (curCharWide == MESSAGE_WIDE_ITEM_ICON) { MSG_BUF_DECODED_WIDE(msgCtx)[++decodedBufPos] = MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 1]; + PRINTF("ITEM_NO=(%d) (%d)\n", MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos], + MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 1]); Message_LoadItemIcon(play, MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 1], R_TEXTBOX_Y + 10); } else if (curCharWide == MESSAGE_WIDE_BACKGROUND) { msgCtx->textboxBackgroundIdx = MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 1] * 2; + PRINTF("mes_board=%d\n"); msgCtx->textboxBackgroundForeColorIdx = (MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 2] & 0xF000) >> 12; msgCtx->textboxBackgroundBackColorIdx = (MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 2] & 0xF00) >> 8; msgCtx->textboxBackgroundYOffsetIdx = (MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 2] & 0xF0) >> 4; @@ -2070,6 +2113,7 @@ void Message_Decode(PlayState* play) { curCharWide != MESSAGE_WIDE_PERSISTENT && curCharWide != MESSAGE_WIDE_UNSKIPPABLE) { if (curCharWide == MESSAGE_WIDE_FADE) { sTextFade = true; + PRINTF("Z_TIMER_END (key_off_flag=%d)\n", sTextFade); MSG_BUF_DECODED_WIDE(msgCtx)[++decodedBufPos] = MSG_BUF_WIDE(font)[++msgCtx->msgBufPos] & 0xFF; } else if (curCharWide == MESSAGE_WIDE_SHIFT || curCharWide == MESSAGE_WIDE_TEXT_SPEED) { MSG_BUF_DECODED_WIDE(msgCtx)[++decodedBufPos] = MSG_BUF_WIDE(font)[++msgCtx->msgBufPos] & 0xFF; @@ -2092,7 +2136,7 @@ void Message_Decode(PlayState* play) { #endif { // English text for NTSC, eng/ger/fra text for PAL - while (true) { + for (;;) { curChar = MSG_BUF_DECODED(msgCtx)[decodedBufPos] = MSG_BUF(font)[msgCtx->msgBufPos]; if (curChar == MESSAGE_BOX_BREAK || curChar == MESSAGE_TEXTID || curChar == MESSAGE_BOX_BREAK_DELAYED || @@ -2100,6 +2144,8 @@ void Message_Decode(PlayState* play) { // Textbox decoding ends with any of the above text control characters msgCtx->msgMode = MSGMODE_TEXT_DISPLAYING; msgCtx->textDrawPos = 1; + +#if !PLATFORM_IQUE R_TEXT_INIT_YPOS = R_TEXTBOX_Y + 8; PRINTF("JJ=%d\n", numLines); if (msgCtx->textBoxType != TEXTBOX_TYPE_NONE_BOTTOM) { @@ -2111,6 +2157,20 @@ void Message_Decode(PlayState* play) { R_TEXT_INIT_YPOS = (u16)(R_TEXTBOX_Y + 16); } } +#else + R_TEXT_INIT_YPOS = R_TEXTBOX_Y + 6; + PRINTF("JJ=%d\n", numLines); + if (msgCtx->textBoxType != TEXTBOX_TYPE_NONE_BOTTOM) { + if (numLines == 0) { + R_TEXT_INIT_YPOS = (u16)(R_TEXTBOX_Y + 18); + } else if (numLines == 1) { + R_TEXT_INIT_YPOS = (u16)(R_TEXTBOX_Y + 12); + } else if (numLines == 2) { + R_TEXT_INIT_YPOS = (u16)(R_TEXTBOX_Y + 8); + } + } +#endif + if (curChar == MESSAGE_TEXTID) { PRINTF("NZ_NEXTMSG=%x, %x, %x\n", MSG_BUF(font)[msgCtx->msgBufPos], MSG_BUF(font)[msgCtx->msgBufPos + 1], MSG_BUF(font)[msgCtx->msgBufPos + 2]); @@ -2298,9 +2358,16 @@ void Message_Decode(PlayState* play) { //! @bug Should use msgBuf instead of msgBufWide (copy-paste error from Japanese text //! handling?), and the mask is applied to the high score index instead of the high score value //! so this always shows HIGH_SCORE(0). Only the PRINTF is wrong, the following line is correct. +#if !PLATFORM_IQUE PRINTF("HI_SCORE( kanfont->mbuff.nes_mes_buf[message->rdp] & 0xff000000 ) = %x\n", HIGH_SCORE(MSG_BUF_WIDE(font)[msgCtx->msgBufPos] & 0xFF000000)); - value = ((HIGH_SCORE((u8)MSG_BUF(font)[msgCtx->msgBufPos]) & 0xFF000000) >> 0x18) & 0x7F; +#else + PRINTF("HI_SCORE( ((unsigned char*)(kanfont->mbuff.nes_mes_buf))[message->rdp] & 0xff000000 ) " + "= %x\n", + HIGH_SCORE(MSG_BUF_WIDE(font)[msgCtx->msgBufPos] & 0xFF000000)); +#endif + value = ((HIGH_SCORE((u8)MSG_BUF(font)[msgCtx->msgBufPos]) & 0xFF000000) >> 0x18); + value &= 0x7F; } value = SQ((f32)value) * 0.0036f + 0.5f; PRINTF("score=%d\n", value); @@ -2381,15 +2448,13 @@ void Message_Decode(PlayState* play) { } else if (curChar == MESSAGE_TIME) { PRINTF(T("\nゼルダ時間 = ", "\nZelda time = ")); digits[0] = 0; - timeInSeconds = gSaveContext.save.dayTime * (24.0f * 60.0f / 0x10000); - - digits[1] = timeInSeconds / 60.0f; + digits[1] = (gSaveContext.save.dayTime * (24.0f * 60.0f / 0x10000)) / 60.0f; while (digits[1] >= 10) { digits[0]++; digits[1] -= 10; } digits[2] = 0; - digits[3] = (s16)timeInSeconds % 60; + digits[3] = (s16)(gSaveContext.save.dayTime * (24.0f * 60.0f / 0x10000)) % 60; while (digits[3] >= 10) { digits[2]++; digits[3] -= 10; @@ -2466,7 +2531,21 @@ void Message_Decode(PlayState* play) { } else if (curChar == MESSAGE_THREE_CHOICE) { msgCtx->choiceNum = 3; } else if (curChar != MESSAGE_CHAR_SPACE) { +#if !PLATFORM_IQUE Font_LoadChar(font, curChar - ' ', charTexIdx); +#else + u8 nextChar; + + if (curChar == 0xAA) { + nextChar = MSG_BUF(font)[++msgCtx->msgBufPos]; + Font_LoadChar(font, nextChar - ' ', charTexIdx); + } else if (curChar >= 0xA0) { + nextChar = MSG_BUF(font)[++msgCtx->msgBufPos]; + Font_LoadCharCHN(font, ((curChar << 8) | nextChar) - 0xA001, charTexIdx); + } else { + Font_LoadChar(font, curChar - ' ', charTexIdx); + } +#endif charTexIdx += FONT_CHAR_TEX_SIZE; } } @@ -2506,8 +2585,13 @@ void Message_OpenText(PlayState* play, u16 textId) { #endif } else { R_TEXT_CHAR_SCALE = 75; +#if !PLATFORM_IQUE R_TEXT_LINE_SPACING = 12; R_TEXT_INIT_XPOS = 65; +#else + R_TEXT_LINE_SPACING = 16; + R_TEXT_INIT_XPOS = 60; +#endif } if (textId == 0xC2 || textId == 0xFA) { // Increments text id based on piece of heart count, assumes the piece of heart text is all @@ -2685,8 +2769,8 @@ void Message_StartTextbox(PlayState* play, u16 textId, Actor* actor) { } void Message_ContinueTextbox(PlayState* play, u16 textId) { - s32 pad; MessageContext* msgCtx = &play->msgCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; #if PLATFORM_N64 s32 pad2[3]; #endif @@ -2704,7 +2788,7 @@ void Message_ContinueTextbox(PlayState* play, u16 textId) { msgCtx->textboxEndType = msgCtx->msgBufPos = msgCtx->unk_E3D0 = msgCtx->textDrawPos = msgCtx->textDelayTimer = 0; msgCtx->textColorAlpha = 255; - if (YREG(31) == 0 && play->interfaceCtx.unk_1FA == 0) { + if (YREG(31) == 0 && interfaceCtx->unk_1FA == 0) { Interface_SetDoAction(play, DO_ACTION_NEXT); } msgCtx->textboxColorAlphaCurrent = msgCtx->textboxColorAlphaTarget; @@ -2727,7 +2811,7 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) { (1 << OCARINA_SONG_SCARECROW_SPAWN), }; MessageContext* msgCtx = &play->msgCtx; - s32 textId; + Font* font = &msgCtx->font; s16 j; s16 i; s16 noStopDoAction; @@ -2759,11 +2843,9 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) { noStopDoAction = false; if (ocarinaActionId >= 0x893) { Message_OpenText(play, ocarinaActionId); // You played the [song name] - textId = ocarinaActionId + 0x86E; } else if (ocarinaActionId == OCARINA_ACTION_MEMORY_GAME) { msgCtx->ocarinaAction = ocarinaActionId; Message_OpenText(play, 0x86D); // Play using [A] and [C]. - textId = ocarinaActionId + 0x86E; } else if (ocarinaActionId == OCARINA_ACTION_FREE_PLAY || ocarinaActionId >= OCARINA_ACTION_CHECK_SARIA) { PRINTF("ocarina_set 000000000000000000 = %d\n", ocarinaActionId); msgCtx->ocarinaAction = ocarinaActionId; @@ -2773,10 +2855,8 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) { } if (ocarinaActionId == OCARINA_ACTION_SCARECROW_SPAWN_PLAYBACK) { Message_OpenText(play, 0x86F); // Ocarina - textId = ocarinaActionId + 0x86E; } else { Message_OpenText(play, 0x86E); // Play using [A] and [C]; [B] to Stop. - textId = ocarinaActionId + 0x86E; } } else { msgCtx->ocarinaAction = ocarinaActionId; @@ -2784,15 +2864,14 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) { if (ocarinaActionId >= OCARINA_ACTION_PLAYBACK_MINUET) { PRINTF("222222222\n"); Message_OpenText(play, 0x86D); // Play using [A] and [C]. - textId = ocarinaActionId + 0x86E; } else { PRINTF("333333333\n"); - textId = ocarinaActionId + 0x86E; - Message_OpenText(play, textId); // Play using [A] and [C]; [B] to Stop. + Message_OpenText(play, ocarinaActionId + 0x86E); // Play using [A] and [C]; [B] to Stop. } } msgCtx->talkActor = NULL; - PRINTF(T("オカリナモード = %d (%x)\n", "Ocarina Mode = %d (%x)\n"), msgCtx->ocarinaAction, textId); + PRINTF(T("オカリナモード = %d (%x)\n", "Ocarina Mode = %d (%x)\n"), msgCtx->ocarinaAction, + ocarinaActionId + 0x86E); msgCtx->textDelayTimer = 0; play->msgCtx.ocarinaMode = OCARINA_MODE_00; R_TEXTBOX_X = 34; @@ -2802,12 +2881,14 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) { R_TEXTBOX_WIDTH = 256; R_TEXTBOX_HEIGHT = 64; msgCtx->stateTimer = 0; - if (YREG(12) != 0) { + // NOLINTBEGIN + if (YREG(12) != 0) msgCtx->msgMode = MSGMODE_TEXT_NEXT_MSG; - } else { + else { msgCtx->stateTimer = 2; msgCtx->msgMode = MSGMODE_TEXT_CONTINUING; } + // NOLINTEND msgCtx->textboxColorAlphaCurrent = msgCtx->textboxColorAlphaTarget; if (!noStopDoAction) { Interface_LoadActionLabelB(play, DO_ACTION_STOP); @@ -2832,8 +2913,7 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT); AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT); msgCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff(); - sOcarinaButtonIndexBufPos = sOcarinaButtonIndexBufLen = 0; - msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos; + msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = sOcarinaButtonIndexBufLen = 0; Message_ResetOcarinaNoteState(); msgCtx->stateTimer = 3; msgCtx->msgMode = MSGMODE_SCARECROW_LONG_PLAYBACK; @@ -2841,8 +2921,9 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) { gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); } - for (k = 0, j = 0; j < 48; j++, k += FONT_CHAR_TEX_SIZE) { - Font_LoadCharWide(&play->msgCtx.font, MESSAGE_WIDE_CHAR_SPACE, k); + for (k = 0, j = 0; j < 48; j++) { + Font_LoadCharWide(font, MESSAGE_WIDE_CHAR_SPACE, k); + k += FONT_CHAR_TEX_SIZE; } } @@ -2913,6 +2994,10 @@ void Message_DrawTextBox(PlayState* play, Gfx** p) { G_TX_NOLOD, G_TX_NOLOD); } +#if PLATFORM_IQUE + R_TEXTBOX_TEXHEIGHT = 442; +#endif + gSPTextureRectangle(gfx++, R_TEXTBOX_X << 2, R_TEXTBOX_Y << 2, (R_TEXTBOX_X + R_TEXTBOX_WIDTH) << 2, (R_TEXTBOX_Y + R_TEXTBOX_HEIGHT) << 2, G_TX_RENDERTILE, 0, 0, R_TEXTBOX_TEXWIDTH << 1, R_TEXTBOX_TEXHEIGHT << 1); @@ -2984,18 +3069,18 @@ void Message_DrawMain(PlayState* play, Gfx** p) { NA_BGM_OCA_NOCTURNE, NA_BGM_OCA_LIGHT, NA_BGM_OCA_SARIA, NA_BGM_OCA_EPONA, NA_BGM_OCA_ZELDA, NA_BGM_OCA_SUNS, NA_BGM_OCA_TIME, NA_BGM_OCA_STORM, }; - InterfaceContext* interfaceCtx = &play->interfaceCtx; MessageContext* msgCtx = &play->msgCtx; - u16 buttonIndexPos; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + Font* font = &msgCtx->font; Player* player = GET_PLAYER(play); - s32 pad; + Input* input = &play->state.input[0]; Gfx* gfx = *p; s16 r; s16 g; s16 b; u16 i; u16 notePosX; - u16 pad1; + u16 buttonIndexPos; u16 j; gSPSegment(gfx++, 0x02, play->interfaceCtx.parameterSegment); @@ -3024,8 +3109,9 @@ void Message_DrawMain(PlayState* play, Gfx** p) { break; case MSGMODE_TEXT_CONTINUING: if (msgCtx->stateTimer == 1) { - for (j = 0, i = 0; i < 48; i++, j += FONT_CHAR_TEX_SIZE) { - Font_LoadCharWide(&play->msgCtx.font, MESSAGE_WIDE_CHAR_SPACE, j); + for (j = 0, i = 0; i < 48; i++) { + Font_LoadCharWide(font, MESSAGE_WIDE_CHAR_SPACE, j); + j += FONT_CHAR_TEX_SIZE; } DRAW_TEXT(play, &gfx, sTextIsCredits); } @@ -3047,8 +3133,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0; play->msgCtx.ocarinaMode = OCARINA_MODE_01; Message_ResetOcarinaNoteState(); - sOcarinaNoteFlashTimer = 3; sOcarinaNoteFlashColorIndex = 1; + sOcarinaNoteFlashTimer = 3; if (msgCtx->msgMode == MSGMODE_OCARINA_STARTING) { if (msgCtx->ocarinaAction == OCARINA_ACTION_UNK_0 || msgCtx->ocarinaAction == OCARINA_ACTION_FREE_PLAY || @@ -3084,7 +3170,9 @@ void Message_DrawMain(PlayState* play, Gfx** p) { case MSGMODE_OCARINA_PLAYING: msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff(); if (msgCtx->ocarinaStaff->pos) { +#if DEBUG_FEATURES PRINTF("locate=%d onpu_pt=%d\n", msgCtx->ocarinaStaff->pos, sOcarinaButtonIndexBufPos); +#endif #if OOT_VERSION >= PAL_1_0 if (msgCtx->ocarinaStaff->pos == 1 && sOcarinaButtonIndexBufPos == 8) { sOcarinaButtonIndexBufPos = 0; @@ -3175,7 +3263,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); msgCtx->stateTimer = 10; msgCtx->msgMode = MSGMODE_OCARINA_FAIL; - } else if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) { + } else if (CHECK_BTN_ALL(input->press.button, BTN_B)) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); play->msgCtx.ocarinaMode = OCARINA_MODE_04; Message_CloseTextbox(play); @@ -3482,11 +3570,12 @@ void Message_DrawMain(PlayState* play, Gfx** p) { PRINTF_COLOR_YELLOW(); PRINTF("Ocarina_PC_Wind=%d(%d) ☆☆☆ ", OCARINA_ACTION_CHECK_MINUET, msgCtx->ocarinaAction - OCARINA_ACTION_CHECK_MINUET); - if (msgCtx->lastPlayedSong == (msgCtx->ocarinaAction - OCARINA_ACTION_CHECK_MINUET)) { + // NOLINTBEGIN + if (msgCtx->lastPlayedSong == (msgCtx->ocarinaAction - OCARINA_ACTION_CHECK_MINUET)) play->msgCtx.ocarinaMode = OCARINA_MODE_03; - } else { + else play->msgCtx.ocarinaMode = msgCtx->lastPlayedSong - 1; - } + // NOLINTEND } else { PRINTF_COLOR_GREEN(); PRINTF("Ocarina_C_Wind=%d(%d) ☆☆☆ ", OCARINA_ACTION_PLAYBACK_MINUET, @@ -3506,11 +3595,12 @@ void Message_DrawMain(PlayState* play, Gfx** p) { case MSGMODE_SONG_DEMONSTRATION: msgCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff(); if (msgCtx->ocarinaStaff->state == 0) { - if (msgCtx->msgMode == MSGMODE_DISPLAY_SONG_PLAYED) { + // NOLINTBEGIN + if (msgCtx->msgMode == MSGMODE_DISPLAY_SONG_PLAYED) msgCtx->msgMode = MSGMODE_DISPLAY_SONG_PLAYED_TEXT_BEGIN; - } else { + else msgCtx->msgMode = MSGMODE_SONG_DEMONSTRATION_DONE; - } + // NOLINTEND PRINTF("onpu_buff[%d]=%x\n", msgCtx->ocarinaStaff->pos, sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos]); } else { @@ -3581,7 +3671,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { if (((u32)msgCtx->ocarinaStaff->pos != 0) && (sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) { if (sOcarinaButtonIndexBufLen >= 8) { - for (buttonIndexPos = sOcarinaButtonIndexBufLen - 8, i = 0; i < 8; i++, buttonIndexPos++) { + for (i = 0, buttonIndexPos = sOcarinaButtonIndexBufLen - 8; i < 8; i++, buttonIndexPos++) { sOcarinaButtonIndexBuf[buttonIndexPos] = sOcarinaButtonIndexBuf[buttonIndexPos + 1]; } sOcarinaButtonIndexBufLen--; @@ -3597,8 +3687,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { sOcarinaButtonIndexBufPos = 0; } } - if (msgCtx->ocarinaStaff->state == OCARINA_RECORD_OFF || - CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) { + if (msgCtx->ocarinaStaff->state == OCARINA_RECORD_OFF || CHECK_BTN_ALL(input->press.button, BTN_B)) { if (sOcarinaButtonIndexBufLen != 0) { PRINTF(T("録音終了!!!!!!!!! message->info->status=%d \n", "Recording complete!!!!!!!!! message->info->status=%d \n"), @@ -3632,7 +3721,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { if (((u32)msgCtx->ocarinaStaff->pos != 0) && (sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) { if (sOcarinaButtonIndexBufLen >= 8) { - for (buttonIndexPos = sOcarinaButtonIndexBufLen - 8, i = 0; i < 8; i++, buttonIndexPos++) { + for (i = 0, buttonIndexPos = sOcarinaButtonIndexBufLen - 8; i < 8; i++, buttonIndexPos++) { sOcarinaButtonIndexBuf[buttonIndexPos] = sOcarinaButtonIndexBuf[buttonIndexPos + 1]; } sOcarinaButtonIndexBufLen--; @@ -3689,7 +3778,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { PRINTF_RST(); PRINTF("\n====================================================================\n"); } else if (msgCtx->ocarinaStaff->state == OCARINA_RECORD_REJECTED || - CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) { + CHECK_BTN_ALL(input->press.button, BTN_B)) { PRINTF(T("すでに存在する曲吹いた!!! \n", "Played an existing song!!! \n")); AudioOcarina_SetRecordingState(OCARINA_RECORD_OFF); Audio_PlaySfxGeneral(NA_SE_SY_OCARINA_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -3877,7 +3966,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { if (msgCtx->msgMode == MSGMODE_SONG_PLAYBACK) { g = msgCtx->ocarinaAction - OCARINA_ACTION_PLAYBACK_MINUET; r = gOcarinaSongButtons[g].numButtons; - for (notePosX = R_OCARINA_BUTTONS_XPOS, i = 0; i < r; i++, notePosX += R_OCARINA_BUTTONS_XPOS_OFFSET) { + for (notePosX = R_OCARINA_BUTTONS_XPOS, i = 0; i < r; i++) { gDPPipeSync(gfx++); gDPSetPrimColor(gfx++, 0, 0, 150, 150, 150, 150); gDPSetEnvColor(gfx++, 10, 10, 10, 0); @@ -3891,12 +3980,13 @@ void Message_DrawMain(PlayState* play, Gfx** p) { (notePosX + 16) << 2, (R_OCARINA_BUTTONS_YPOS(gOcarinaSongButtons[g].buttonsIndex[i]) + 16) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + notePosX += R_OCARINA_BUTTONS_XPOS_OFFSET; } } if (msgCtx->msgMode != MSGMODE_SCARECROW_LONG_RECORDING_START && msgCtx->msgMode != MSGMODE_MEMORY_GAME_START) { - for (notePosX = R_OCARINA_BUTTONS_XPOS, i = 0; i < 8; i++, notePosX += R_OCARINA_BUTTONS_XPOS_OFFSET) { + for (notePosX = R_OCARINA_BUTTONS_XPOS, i = 0; i < 8; i++) { if (sOcarinaButtonIndexBuf[i] == OCARINA_BTN_INVALID) { break; } @@ -3928,6 +4018,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { (notePosX + 16) << 2, (R_OCARINA_BUTTONS_YPOS(sOcarinaButtonIndexBuf[i]) + 16) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + notePosX += R_OCARINA_BUTTONS_XPOS_OFFSET; } } } @@ -4047,7 +4138,7 @@ void Message_Update(PlayState* play) { #if OOT_VERSION < GC_US static s32 sUnknown = 0; #endif - static u8 D_80153D74 = 0; + static char D_80153D74 = 0; MessageContext* msgCtx = &play->msgCtx; InterfaceContext* interfaceCtx = &play->interfaceCtx; Player* player = GET_PLAYER(play); @@ -4161,9 +4252,9 @@ void Message_Update(PlayState* play) { R_TEXTBOX_Y_TARGET = sTextboxLowerYPositions[var]; } +#if OOT_NTSC && !PLATFORM_IQUE R_TEXTBOX_X_TARGET = sTextboxXPositions[var]; R_TEXTBOX_END_YPOS = sTextboxEndIconYOffset[var] + R_TEXTBOX_Y_TARGET; -#if OOT_NTSC if (gSaveContext.language == LANGUAGE_JPN && !sTextIsCredits) { R_TEXT_CHOICE_YPOS(0) = R_TEXTBOX_Y_TARGET + 7; R_TEXT_CHOICE_YPOS(1) = R_TEXTBOX_Y_TARGET + 25; @@ -4174,11 +4265,28 @@ void Message_Update(PlayState* play) { R_TEXT_CHOICE_YPOS(1) = R_TEXTBOX_Y_TARGET + 32; R_TEXT_CHOICE_YPOS(2) = R_TEXTBOX_Y_TARGET + 44; } -#else +#elif OOT_PAL + R_TEXTBOX_X_TARGET = sTextboxXPositions[var]; + R_TEXTBOX_END_YPOS = sTextboxEndIconYOffset[var] + R_TEXTBOX_Y_TARGET; R_TEXT_CHOICE_YPOS(0) = R_TEXTBOX_Y_TARGET + 20; R_TEXT_CHOICE_YPOS(1) = R_TEXTBOX_Y_TARGET + 32; R_TEXT_CHOICE_YPOS(2) = R_TEXTBOX_Y_TARGET + 44; +#elif PLATFORM_IQUE + R_TEXTBOX_END_YPOS = sTextboxEndIconYOffset[var] + R_TEXTBOX_Y_TARGET; + R_TEXTBOX_Y_TARGET -= 10; + R_TEXTBOX_X_TARGET = sTextboxXPositions[var]; + if (gSaveContext.language == LANGUAGE_JPN && !sTextIsCredits) { + R_TEXT_CHOICE_YPOS(0) = R_TEXTBOX_Y_TARGET + 7; + R_TEXT_CHOICE_YPOS(1) = R_TEXTBOX_Y_TARGET + 25; + R_TEXT_CHOICE_YPOS(2) = R_TEXTBOX_Y_TARGET + 43; + + } else { + R_TEXT_CHOICE_YPOS(0) = R_TEXTBOX_Y_TARGET + 23; + R_TEXT_CHOICE_YPOS(1) = R_TEXTBOX_Y_TARGET + 39; + R_TEXT_CHOICE_YPOS(2) = R_TEXTBOX_Y_TARGET + 55; + } #endif + PRINTF("message->msg_disp_type=%x\n", msgCtx->textBoxProperties & 0xF0); if (msgCtx->textBoxType == TEXTBOX_TYPE_NONE_BOTTOM || msgCtx->textBoxType == TEXTBOX_TYPE_NONE_NO_SHADOW) { @@ -4224,7 +4332,7 @@ void Message_Update(PlayState* play) { break; case MSGMODE_TEXT_DISPLAYING: if (msgCtx->textBoxType != TEXTBOX_TYPE_NONE_BOTTOM && YREG(31) == 0 && - CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B) && !msgCtx->textUnskippable) { + CHECK_BTN_ALL(input->press.button, BTN_B) && !msgCtx->textUnskippable) { sTextboxSkipped = true; msgCtx->textDrawPos = msgCtx->decodedTextLen; } From 30e75f4277a5dfb9db50e8c994d6fdfc1f75771d Mon Sep 17 00:00:00 2001 From: cadmic Date: Mon, 20 Jan 2025 14:57:27 -0800 Subject: [PATCH 3/7] Yabusame -> Horseback archery --- src/code/z_message.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/code/z_message.c b/src/code/z_message.c index ee315b261ce..d900140d4bf 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -1873,7 +1873,7 @@ void Message_Decode(PlayState* play) { } else if (curCharWide == MESSAGE_WIDE_POINTS) { // Convert the values of the current minigame score to digits and // add the digits to the decoded buffer in place of the control character. - PRINTF(T("\n流鏑馬スコア = ", "\nYabusame score = ")); + PRINTF(T("\n流鏑馬スコア = ", "\nHorseback archery score = ")); digits[0] = digits[1] = digits[2] = 0; digits[3] = gSaveContext.minigameScore; @@ -2267,7 +2267,7 @@ void Message_Decode(PlayState* play) { } else if (curChar == MESSAGE_POINTS) { // Convert the values of the current minigame score to digits and // add the digits to the decoded buffer in place of the control character. - PRINTF(T("\n流鏑馬スコア = %d\n", "\nYabusame score = %d\n"), gSaveContext.minigameScore); + PRINTF(T("\n流鏑馬スコア = %d\n", "\nHorseback archery score = %d\n"), gSaveContext.minigameScore); digits[0] = digits[1] = digits[2] = 0; digits[3] = gSaveContext.minigameScore; From 2c105184712c397fbc435975dd281e4f095483b9 Mon Sep 17 00:00:00 2001 From: cadmic Date: Mon, 20 Jan 2025 14:58:01 -0800 Subject: [PATCH 4/7] Add missing PRINTF parameter --- src/code/z_message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/code/z_message.c b/src/code/z_message.c index d900140d4bf..16284091f8f 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -2088,7 +2088,7 @@ void Message_Decode(PlayState* play) { Message_LoadItemIcon(play, MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 1], R_TEXTBOX_Y + 10); } else if (curCharWide == MESSAGE_WIDE_BACKGROUND) { msgCtx->textboxBackgroundIdx = MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 1] * 2; - PRINTF("mes_board=%d\n"); + PRINTF("mes_board=%d\n", msgCtx->textboxBackgroundIdx); msgCtx->textboxBackgroundForeColorIdx = (MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 2] & 0xF000) >> 12; msgCtx->textboxBackgroundBackColorIdx = (MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 2] & 0xF00) >> 8; msgCtx->textboxBackgroundYOffsetIdx = (MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 2] & 0xF0) >> 4; From c1ac9c2ea08fe18598e15a7191fbce1bca433281 Mon Sep 17 00:00:00 2001 From: cadmic Date: Mon, 20 Jan 2025 15:00:23 -0800 Subject: [PATCH 5/7] Collapse for loops --- src/code/z_message.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/code/z_message.c b/src/code/z_message.c index 16284091f8f..70315380e1e 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -1165,8 +1165,7 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { if (i + 1 == msgCtx->textDrawPos && (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING || (msgCtx->msgMode >= MSGMODE_OCARINA_STARTING && msgCtx->msgMode < MSGMODE_SCARECROW_LONG_RECORDING_START))) { - j = i; - for (;;) { + for (j = i;; j++) { character = MSG_BUF_DECODED_WIDE(msgCtx)[j]; if ((character == MESSAGE_WIDE_QUICKTEXT_DISABLE) || (character == MESSAGE_WIDE_PERSISTENT) || (character == MESSAGE_WIDE_EVENT) || (character == MESSAGE_WIDE_BOX_BREAK_DELAYED) || @@ -1174,7 +1173,6 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { (character == MESSAGE_WIDE_END)) { break; } - j++; } i = j - 1; msgCtx->textDrawPos = i + 1; @@ -1493,8 +1491,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { if (i + 1 == msgCtx->textDrawPos && (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING || (msgCtx->msgMode >= MSGMODE_OCARINA_STARTING && msgCtx->msgMode < MSGMODE_SCARECROW_LONG_RECORDING_START))) { - j = i; - for (;;) { + for (j = i;; j++) { character = MSG_BUF_DECODED(msgCtx)[j]; if (character == MESSAGE_SHIFT) { j++; @@ -1504,7 +1501,6 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { (character == MESSAGE_END)) { break; } - j++; } i = j - 1; msgCtx->textDrawPos = i + 1; From d7ea0203a1ceaf5885e592318fbace6319ef31c3 Mon Sep 17 00:00:00 2001 From: cadmic Date: Mon, 20 Jan 2025 16:14:05 -0800 Subject: [PATCH 6/7] Better-looking macros --- src/code/z_message.c | 258 +++++++++++++++++++++---------------------- 1 file changed, 127 insertions(+), 131 deletions(-) diff --git a/src/code/z_message.c b/src/code/z_message.c index 70315380e1e..4d02706bd08 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -11,16 +11,16 @@ "ntsc-1.0:80 ntsc-1.1:80 ntsc-1.2:80 pal-1.0:128 pal-1.1:128" #if !PLATFORM_IQUE -#define MSG_BUF_DECODED(msgCtx) ((msgCtx)->msgBufDecoded) -#define MSG_BUF_DECODED_WIDE(msgCtx) ((msgCtx)->msgBufDecodedWide) -#define MSG_BUF(font) ((font)->msgBuf) -#define MSG_BUF_WIDE(font) ((font)->msgBufWide) +#define MSG_BUF_DECODED (msgCtx->msgBufDecoded) +#define MSG_BUF_DECODED_WIDE (msgCtx->msgBufDecodedWide) +#define MSG_BUF (font->msgBuf) +#define MSG_BUF_WIDE (font->msgBufWide) #else // Workaround for EGCS internal compiler error (see docs/compilers.md) -#define MSG_BUF_DECODED(msgCtx) ((u8*)(msgCtx)->msgBufDecoded) -#define MSG_BUF_DECODED_WIDE(msgCtx) ((u16*)(msgCtx)->msgBufDecodedWide) -#define MSG_BUF(font) ((u8*)(font)->msgBuf) -#define MSG_BUF_WIDE(font) ((u16*)(font)->msgBufWide) +#define MSG_BUF_DECODED ((u8*)msgCtx->msgBufDecoded) +#define MSG_BUF_DECODED_WIDE ((u16*)msgCtx->msgBufDecodedWide) +#define MSG_BUF ((u8*)font->msgBuf) +#define MSG_BUF_WIDE ((u16*)font->msgBufWide) #endif #if !PLATFORM_GC @@ -1114,7 +1114,7 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { charTexIdx = 0; for (i = 0; i < msgCtx->textDrawPos; i++) { - character = MSG_BUF_DECODED_WIDE(msgCtx)[i]; + character = MSG_BUF_DECODED_WIDE[i]; switch (character) { case MESSAGE_WIDE_NEWLINE: @@ -1128,7 +1128,7 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { } break; case MESSAGE_WIDE_COLOR: - Message_SetTextColor(msgCtx, MSG_BUF_DECODED_WIDE(msgCtx)[++i]); + Message_SetTextColor(msgCtx, MSG_BUF_DECODED_WIDE[++i]); break; case MESSAGE_WIDE_CHAR_SPACE: msgCtx->textPosX += MESSAGE_SPACE_WIDTH; @@ -1149,7 +1149,7 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { *gfxP = gfx; return; case MESSAGE_WIDE_SHIFT: - msgCtx->textPosX += MSG_BUF_DECODED_WIDE(msgCtx)[++i]; + msgCtx->textPosX += MSG_BUF_DECODED_WIDE[++i]; break; case MESSAGE_WIDE_TEXTID: msgCtx->textboxEndType = TEXTBOX_ENDTYPE_HAS_NEXT; @@ -1166,7 +1166,7 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { (msgCtx->msgMode >= MSGMODE_OCARINA_STARTING && msgCtx->msgMode < MSGMODE_SCARECROW_LONG_RECORDING_START))) { for (j = i;; j++) { - character = MSG_BUF_DECODED_WIDE(msgCtx)[j]; + character = MSG_BUF_DECODED_WIDE[j]; if ((character == MESSAGE_WIDE_QUICKTEXT_DISABLE) || (character == MESSAGE_WIDE_PERSISTENT) || (character == MESSAGE_WIDE_EVENT) || (character == MESSAGE_WIDE_BOX_BREAK_DELAYED) || (character == MESSAGE_WIDE_AWAIT_BUTTON_PRESS) || (character == MESSAGE_WIDE_BOX_BREAK) || @@ -1192,7 +1192,7 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { break; case MESSAGE_WIDE_BOX_BREAK_DELAYED: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { - msgCtx->stateTimer = MSG_BUF_DECODED_WIDE(msgCtx)[++i]; + msgCtx->stateTimer = MSG_BUF_DECODED_WIDE[++i]; msgCtx->msgMode = MSGMODE_TEXT_DELAYED_BREAK; } *gfxP = gfx; @@ -1202,13 +1202,13 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { case MESSAGE_WIDE_SFX: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING && !sMessageHasSetSfx) { sMessageHasSetSfx = true; - Audio_PlaySfxGeneral(MSG_BUF_DECODED_WIDE(msgCtx)[i + 1], &gSfxDefaultPos, 4, - &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + Audio_PlaySfxGeneral(MSG_BUF_DECODED_WIDE[i + 1], &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } i++; break; case MESSAGE_WIDE_ITEM_ICON: - i = Message_DrawItemIcon(play, MSG_BUF_DECODED_WIDE(msgCtx)[i + 1], &gfx, i); + i = Message_DrawItemIcon(play, MSG_BUF_DECODED_WIDE[i + 1], &gfx, i); break; case MESSAGE_WIDE_BACKGROUND: // clang-format off @@ -1270,7 +1270,7 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { msgCtx->textPosX += 32; break; case MESSAGE_WIDE_TEXT_SPEED: - msgCtx->textDelay = MSG_BUF_DECODED_WIDE(msgCtx)[++i]; + msgCtx->textDelay = MSG_BUF_DECODED_WIDE[++i]; break; case MESSAGE_WIDE_UNSKIPPABLE: msgCtx->textUnskippable = true; @@ -1318,7 +1318,7 @@ void Message_DrawTextWide(PlayState* play, Gfx** gfxP) { if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; msgCtx->textboxEndType = TEXTBOX_ENDTYPE_FADING; - msgCtx->stateTimer = MSG_BUF_DECODED_WIDE(msgCtx)[++i]; + msgCtx->stateTimer = MSG_BUF_DECODED_WIDE[++i]; Font_LoadMessageBoxIcon(font, TEXTBOX_ICON_SQUARE); if (play->csCtx.state == CS_STATE_IDLE) { Interface_SetDoAction(play, DO_ACTION_RETURN); @@ -1440,7 +1440,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { charTexIdx = 0; for (i = 0; i < msgCtx->textDrawPos; i++) { - character = MSG_BUF_DECODED(msgCtx)[i]; + character = MSG_BUF_DECODED[i]; switch (character) { case MESSAGE_NEWLINE: @@ -1454,7 +1454,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { msgCtx->textPosY += R_TEXT_LINE_SPACING; break; case MESSAGE_COLOR: - Message_SetTextColor(msgCtx, MSG_BUF_DECODED(msgCtx)[++i] & 0xF); + Message_SetTextColor(msgCtx, MSG_BUF_DECODED[++i] & 0xF); break; case MESSAGE_CHAR_SPACE: msgCtx->textPosX += MESSAGE_SPACE_WIDTH; @@ -1475,7 +1475,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { *gfxP = gfx; return; case MESSAGE_SHIFT: - msgCtx->textPosX += MSG_BUF_DECODED(msgCtx)[++i]; + msgCtx->textPosX += MSG_BUF_DECODED[++i]; break; case MESSAGE_TEXTID: msgCtx->textboxEndType = TEXTBOX_ENDTYPE_HAS_NEXT; @@ -1492,7 +1492,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { (msgCtx->msgMode >= MSGMODE_OCARINA_STARTING && msgCtx->msgMode < MSGMODE_SCARECROW_LONG_RECORDING_START))) { for (j = i;; j++) { - character = MSG_BUF_DECODED(msgCtx)[j]; + character = MSG_BUF_DECODED[j]; if (character == MESSAGE_SHIFT) { j++; } else if ((character == MESSAGE_QUICKTEXT_DISABLE) || (character == MESSAGE_PERSISTENT) || @@ -1520,7 +1520,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { break; case MESSAGE_BOX_BREAK_DELAYED: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { - msgCtx->stateTimer = MSG_BUF_DECODED(msgCtx)[++i]; + msgCtx->stateTimer = MSG_BUF_DECODED[++i]; msgCtx->msgMode = MSGMODE_TEXT_DELAYED_BREAK; } *gfxP = gfx; @@ -1529,10 +1529,9 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; msgCtx->textboxEndType = TEXTBOX_ENDTYPE_FADING; - PRINTF(T("タイマー (%x) (%x)", "Timer (%x) (%x)"), MSG_BUF_DECODED(msgCtx)[i + 1], - MSG_BUF_DECODED(msgCtx)[i + 2]); - msgCtx->stateTimer = MSG_BUF_DECODED(msgCtx)[++i] << 8; - msgCtx->stateTimer |= MSG_BUF_DECODED(msgCtx)[++i]; + PRINTF(T("タイマー (%x) (%x)", "Timer (%x) (%x)"), MSG_BUF_DECODED[i + 1], MSG_BUF_DECODED[i + 2]); + msgCtx->stateTimer = MSG_BUF_DECODED[++i] << 8; + msgCtx->stateTimer |= MSG_BUF_DECODED[++i]; PRINTF(T("合計wct=%x(%d)\n", " Total wct=%x(%d)\n"), msgCtx->stateTimer, msgCtx->stateTimer); } *gfxP = gfx; @@ -1541,15 +1540,15 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING && !sMessageHasSetSfx) { sMessageHasSetSfx = true; PRINTF(T("サウンド(SE)\n", "Sound (SE)\n")); - sfxHi = MSG_BUF_DECODED(msgCtx)[i + 1]; + sfxHi = MSG_BUF_DECODED[i + 1]; sfxHi <<= 8; - Audio_PlaySfxGeneral(sfxHi | MSG_BUF_DECODED(msgCtx)[i + 2], &gSfxDefaultPos, 4, + Audio_PlaySfxGeneral(sfxHi | MSG_BUF_DECODED[i + 2], &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } i += 2; break; case MESSAGE_ITEM_ICON: - i = Message_DrawItemIcon(play, MSG_BUF_DECODED(msgCtx)[i + 1], &gfx, i); + i = Message_DrawItemIcon(play, MSG_BUF_DECODED[i + 1], &gfx, i); break; case MESSAGE_BACKGROUND: // clang-format off @@ -1611,7 +1610,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { msgCtx->textPosX += 32; break; case MESSAGE_TEXT_SPEED: - msgCtx->textDelay = MSG_BUF_DECODED(msgCtx)[++i]; + msgCtx->textDelay = MSG_BUF_DECODED[++i]; break; case MESSAGE_UNSKIPPABLE: msgCtx->textUnskippable = true; @@ -1659,7 +1658,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; msgCtx->textboxEndType = TEXTBOX_ENDTYPE_FADING; - msgCtx->stateTimer = MSG_BUF_DECODED(msgCtx)[++i]; + msgCtx->stateTimer = MSG_BUF_DECODED[++i]; Font_LoadMessageBoxIcon(font, TEXTBOX_ICON_SQUARE); if (play->csCtx.state == 0) { Interface_SetDoAction(play, DO_ACTION_RETURN); @@ -1773,7 +1772,7 @@ void Message_Decode(PlayState* play) { if (gSaveContext.language == LANGUAGE_JPN && !sTextIsCredits) { // Japanese text (NTSC only) for (;;) { - curCharWide = MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = MSG_BUF_WIDE(font)[msgCtx->msgBufPos]; + curCharWide = MSG_BUF_DECODED_WIDE[decodedBufPos] = MSG_BUF_WIDE[msgCtx->msgBufPos]; if (curCharWide == MESSAGE_WIDE_BOX_BREAK || curCharWide == MESSAGE_WIDE_TEXTID || curCharWide == MESSAGE_WIDE_BOX_BREAK_DELAYED || curCharWide == MESSAGE_WIDE_EVENT || @@ -1790,11 +1789,10 @@ void Message_Decode(PlayState* play) { } } if (curCharWide == MESSAGE_WIDE_TEXTID) { - sNextTextId = MSG_BUF_DECODED_WIDE(msgCtx)[++decodedBufPos] = - MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 1]; + sNextTextId = MSG_BUF_DECODED_WIDE[++decodedBufPos] = MSG_BUF_WIDE[msgCtx->msgBufPos + 1]; } if (curCharWide == MESSAGE_WIDE_BOX_BREAK_DELAYED) { - MSG_BUF_DECODED_WIDE(msgCtx)[++decodedBufPos] = MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 1]; + MSG_BUF_DECODED_WIDE[++decodedBufPos] = MSG_BUF_WIDE[msgCtx->msgBufPos + 1]; msgCtx->msgBufPos += 2; } msgCtx->decodedTextLen = decodedBufPos; @@ -1814,7 +1812,7 @@ void Message_Decode(PlayState* play) { for (i = 0; i < playerNameLen; i++) { curCharWide = gSaveContext.save.info.playerData.playerName[i]; PRINTF("(%x), ", curCharWide); - MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos + i] = MESSAGE_WIDE_NAME; + MSG_BUF_DECODED_WIDE[decodedBufPos + i] = MESSAGE_WIDE_NAME; fontBuf = &font->fontBuf[(curCharWide * 32) << 2]; // fake for (j = 0; j < FONT_CHAR_TEX_SIZE; j += 4) { @@ -1853,17 +1851,17 @@ void Message_Decode(PlayState* play) { PRINTF("rpc[%d] = %x\n", i, digits[i] + MESSAGE_WIDE_CHAR_ZERO); Font_LoadCharWide(font, digits[i] + MESSAGE_WIDE_CHAR_ZERO, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; + MSG_BUF_DECODED_WIDE[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; decodedBufPos++; if (i == 1) { Font_LoadCharWide(font, MESSAGE_WIDE_CHAR_MINUTES, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = MESSAGE_WIDE_CHAR_MINUTES; + MSG_BUF_DECODED_WIDE[decodedBufPos] = MESSAGE_WIDE_CHAR_MINUTES; decodedBufPos++; } else if (i == 3) { Font_LoadCharWide(font, MESSAGE_WIDE_CHAR_SECONDS, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = MESSAGE_WIDE_CHAR_SECONDS; + MSG_BUF_DECODED_WIDE[decodedBufPos] = MESSAGE_WIDE_CHAR_SECONDS; } } } else if (curCharWide == MESSAGE_WIDE_POINTS) { @@ -1893,7 +1891,7 @@ void Message_Decode(PlayState* play) { if (loadChar) { Font_LoadCharWide(font, digits[i] + MESSAGE_WIDE_CHAR_ZERO, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; + MSG_BUF_DECODED_WIDE[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; decodedBufPos++; } } @@ -1923,7 +1921,7 @@ void Message_Decode(PlayState* play) { if (loadChar) { Font_LoadCharWide(font, digits[i] + MESSAGE_WIDE_CHAR_ZERO, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; + MSG_BUF_DECODED_WIDE[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; decodedBufPos++; } } @@ -1942,37 +1940,37 @@ void Message_Decode(PlayState* play) { if (i == 1 || digits[i] != 0) { Font_LoadCharWide(font, digits[i] + MESSAGE_WIDE_CHAR_ZERO, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; + MSG_BUF_DECODED_WIDE[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; decodedBufPos++; } } decodedBufPos--; } else if (curCharWide == MESSAGE_WIDE_HIGHSCORE) { - value = HIGH_SCORE(MSG_BUF_WIDE(font)[++msgCtx->msgBufPos] & 0xFF); - if ((MSG_BUF_WIDE(font)[msgCtx->msgBufPos] & 0xFF) == HS_FISHING) { + value = HIGH_SCORE(MSG_BUF_WIDE[++msgCtx->msgBufPos] & 0xFF); + if ((MSG_BUF_WIDE[msgCtx->msgBufPos] & 0xFF) == HS_FISHING) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { #if !PLATFORM_IQUE PRINTF("HI_SCORE(kanfont->mbuff.message_buf[message->rdp]) = %x\n", - HIGH_SCORE(MSG_BUF_WIDE(font)[msgCtx->msgBufPos])); + HIGH_SCORE(MSG_BUF_WIDE[msgCtx->msgBufPos])); #else PRINTF("HI_SCORE(((unshort *)(kanfont->mbuff.message_buf))[message->rdp]) = %x\n", - HIGH_SCORE(MSG_BUF_WIDE(font)[msgCtx->msgBufPos])); + HIGH_SCORE(MSG_BUF_WIDE[msgCtx->msgBufPos])); #endif value &= 0x7F; } else { #if !PLATFORM_IQUE PRINTF("HI_SCORE( kanfont->mbuff.message_buf[message->rdp]) = %x\n", - HIGH_SCORE(MSG_BUF_WIDE(font)[msgCtx->msgBufPos])); + HIGH_SCORE(MSG_BUF_WIDE[msgCtx->msgBufPos])); #else PRINTF( "HI_SCORE( ((unshort *)(kanfont->mbuff.message_buf))[message->rdp]) & 0xff000000 = %x\n", - HIGH_SCORE(MSG_BUF_WIDE(font)[msgCtx->msgBufPos]) & 0xFF000000); + HIGH_SCORE(MSG_BUF_WIDE[msgCtx->msgBufPos]) & 0xFF000000); #endif - value = ((HIGH_SCORE(MSG_BUF_WIDE(font)[msgCtx->msgBufPos]) & 0xFF000000) >> 0x18); + value = ((HIGH_SCORE(MSG_BUF_WIDE[msgCtx->msgBufPos]) & 0xFF000000) >> 0x18); value &= 0x7F; } } - switch (MSG_BUF_WIDE(font)[msgCtx->msgBufPos] & 0xFF) { + switch (MSG_BUF_WIDE[msgCtx->msgBufPos] & 0xFF) { case HS_HBA: case HS_POE_POINTS: case HS_FISHING: @@ -2000,7 +1998,7 @@ void Message_Decode(PlayState* play) { if (loadChar) { Font_LoadCharWide(font, digits[i] + MESSAGE_WIDE_CHAR_ZERO, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; + MSG_BUF_DECODED_WIDE[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; decodedBufPos++; } } @@ -2030,17 +2028,17 @@ void Message_Decode(PlayState* play) { for (i = 0; i < 4; i++) { Font_LoadCharWide(font, digits[i] + MESSAGE_WIDE_CHAR_ZERO, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; + MSG_BUF_DECODED_WIDE[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; decodedBufPos++; if (i == 1) { Font_LoadCharWide(font, MESSAGE_WIDE_CHAR_MINUTES, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = MESSAGE_WIDE_CHAR_MINUTES; + MSG_BUF_DECODED_WIDE[decodedBufPos] = MESSAGE_WIDE_CHAR_MINUTES; decodedBufPos++; } else if (i == 3) { Font_LoadCharWide(font, MESSAGE_WIDE_CHAR_SECONDS, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = MESSAGE_WIDE_CHAR_SECONDS; + MSG_BUF_DECODED_WIDE[decodedBufPos] = MESSAGE_WIDE_CHAR_SECONDS; } } break; @@ -2064,31 +2062,30 @@ void Message_Decode(PlayState* play) { PRINTF("rpc[%d] = %x\n", i, digits[i] + MESSAGE_WIDE_CHAR_ZERO); Font_LoadCharWide(font, digits[i] + MESSAGE_WIDE_CHAR_ZERO, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; + MSG_BUF_DECODED_WIDE[decodedBufPos] = digits[i] + MESSAGE_WIDE_CHAR_ZERO; decodedBufPos++; if (i == 1) { Font_LoadCharWide(font, MESSAGE_WIDE_CHAR_HOURS, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = MESSAGE_WIDE_CHAR_HOURS; + MSG_BUF_DECODED_WIDE[decodedBufPos] = MESSAGE_WIDE_CHAR_HOURS; decodedBufPos++; } else if (i == 3) { Font_LoadCharWide(font, MESSAGE_WIDE_CHAR_MINUTES, charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos] = MESSAGE_WIDE_CHAR_MINUTES; + MSG_BUF_DECODED_WIDE[decodedBufPos] = MESSAGE_WIDE_CHAR_MINUTES; } } } else if (curCharWide == MESSAGE_WIDE_ITEM_ICON) { - MSG_BUF_DECODED_WIDE(msgCtx)[++decodedBufPos] = MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 1]; - PRINTF("ITEM_NO=(%d) (%d)\n", MSG_BUF_DECODED_WIDE(msgCtx)[decodedBufPos], - MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 1]); - Message_LoadItemIcon(play, MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 1], R_TEXTBOX_Y + 10); + MSG_BUF_DECODED_WIDE[++decodedBufPos] = MSG_BUF_WIDE[msgCtx->msgBufPos + 1]; + PRINTF("ITEM_NO=(%d) (%d)\n", MSG_BUF_DECODED_WIDE[decodedBufPos], MSG_BUF_WIDE[msgCtx->msgBufPos + 1]); + Message_LoadItemIcon(play, MSG_BUF_WIDE[msgCtx->msgBufPos + 1], R_TEXTBOX_Y + 10); } else if (curCharWide == MESSAGE_WIDE_BACKGROUND) { - msgCtx->textboxBackgroundIdx = MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 1] * 2; + msgCtx->textboxBackgroundIdx = MSG_BUF_WIDE[msgCtx->msgBufPos + 1] * 2; PRINTF("mes_board=%d\n", msgCtx->textboxBackgroundIdx); - msgCtx->textboxBackgroundForeColorIdx = (MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 2] & 0xF000) >> 12; - msgCtx->textboxBackgroundBackColorIdx = (MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 2] & 0xF00) >> 8; - msgCtx->textboxBackgroundYOffsetIdx = (MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 2] & 0xF0) >> 4; - msgCtx->textboxBackgroundUnkArg = MSG_BUF_WIDE(font)[msgCtx->msgBufPos + 2] & 0xF; + msgCtx->textboxBackgroundForeColorIdx = (MSG_BUF_WIDE[msgCtx->msgBufPos + 2] & 0xF000) >> 12; + msgCtx->textboxBackgroundBackColorIdx = (MSG_BUF_WIDE[msgCtx->msgBufPos + 2] & 0xF00) >> 8; + msgCtx->textboxBackgroundYOffsetIdx = (MSG_BUF_WIDE[msgCtx->msgBufPos + 2] & 0xF0) >> 4; + msgCtx->textboxBackgroundUnkArg = MSG_BUF_WIDE[msgCtx->msgBufPos + 2] & 0xF; DMA_REQUEST_SYNC(msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE, (uintptr_t)_message_texture_staticSegmentRomStart + msgCtx->textboxBackgroundIdx * MESSAGE_TEXTURE_STATIC_TEX_SIZE, @@ -2101,7 +2098,7 @@ void Message_Decode(PlayState* play) { msgCtx->msgBufPos += 2; R_TEXTBOX_BG_YPOS = R_TEXTBOX_Y + 8; } else if (curCharWide == MESSAGE_WIDE_COLOR) { - MSG_BUF_DECODED_WIDE(msgCtx)[++decodedBufPos] = MSG_BUF_WIDE(font)[++msgCtx->msgBufPos] & 0xF; + MSG_BUF_DECODED_WIDE[++decodedBufPos] = MSG_BUF_WIDE[++msgCtx->msgBufPos] & 0xF; } else if (curCharWide == MESSAGE_WIDE_NEWLINE) { numLines++; } else if (curCharWide != MESSAGE_WIDE_QUICKTEXT_ENABLE && curCharWide != MESSAGE_WIDE_QUICKTEXT_DISABLE && @@ -2110,11 +2107,11 @@ void Message_Decode(PlayState* play) { if (curCharWide == MESSAGE_WIDE_FADE) { sTextFade = true; PRINTF("Z_TIMER_END (key_off_flag=%d)\n", sTextFade); - MSG_BUF_DECODED_WIDE(msgCtx)[++decodedBufPos] = MSG_BUF_WIDE(font)[++msgCtx->msgBufPos] & 0xFF; + MSG_BUF_DECODED_WIDE[++decodedBufPos] = MSG_BUF_WIDE[++msgCtx->msgBufPos] & 0xFF; } else if (curCharWide == MESSAGE_WIDE_SHIFT || curCharWide == MESSAGE_WIDE_TEXT_SPEED) { - MSG_BUF_DECODED_WIDE(msgCtx)[++decodedBufPos] = MSG_BUF_WIDE(font)[++msgCtx->msgBufPos] & 0xFF; + MSG_BUF_DECODED_WIDE[++decodedBufPos] = MSG_BUF_WIDE[++msgCtx->msgBufPos] & 0xFF; } else if (curCharWide == MESSAGE_WIDE_SFX) { - MSG_BUF_DECODED_WIDE(msgCtx)[++decodedBufPos] = MSG_BUF_WIDE(font)[++msgCtx->msgBufPos]; + MSG_BUF_DECODED_WIDE[++decodedBufPos] = MSG_BUF_WIDE[++msgCtx->msgBufPos]; } else if (curCharWide == MESSAGE_WIDE_TWO_CHOICE) { msgCtx->choiceNum = 2; } else if (curCharWide == MESSAGE_WIDE_THREE_CHOICE) { @@ -2133,7 +2130,7 @@ void Message_Decode(PlayState* play) { { // English text for NTSC, eng/ger/fra text for PAL for (;;) { - curChar = MSG_BUF_DECODED(msgCtx)[decodedBufPos] = MSG_BUF(font)[msgCtx->msgBufPos]; + curChar = MSG_BUF_DECODED[decodedBufPos] = MSG_BUF[msgCtx->msgBufPos]; if (curChar == MESSAGE_BOX_BREAK || curChar == MESSAGE_TEXTID || curChar == MESSAGE_BOX_BREAK_DELAYED || curChar == MESSAGE_EVENT || curChar == MESSAGE_END) { @@ -2168,15 +2165,15 @@ void Message_Decode(PlayState* play) { #endif if (curChar == MESSAGE_TEXTID) { - PRINTF("NZ_NEXTMSG=%x, %x, %x\n", MSG_BUF(font)[msgCtx->msgBufPos], - MSG_BUF(font)[msgCtx->msgBufPos + 1], MSG_BUF(font)[msgCtx->msgBufPos + 2]); - value = MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[msgCtx->msgBufPos + 1]; - MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[msgCtx->msgBufPos + 2]; + PRINTF("NZ_NEXTMSG=%x, %x, %x\n", MSG_BUF[msgCtx->msgBufPos], MSG_BUF[msgCtx->msgBufPos + 1], + MSG_BUF[msgCtx->msgBufPos + 2]); + value = MSG_BUF_DECODED[++decodedBufPos] = MSG_BUF[msgCtx->msgBufPos + 1]; + MSG_BUF_DECODED[++decodedBufPos] = MSG_BUF[msgCtx->msgBufPos + 2]; value <<= 8; - sNextTextId = MSG_BUF_DECODED(msgCtx)[decodedBufPos] | value; + sNextTextId = MSG_BUF_DECODED[decodedBufPos] | value; } if (curChar == MESSAGE_BOX_BREAK_DELAYED) { - MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[msgCtx->msgBufPos + 1]; + MSG_BUF_DECODED[++decodedBufPos] = MSG_BUF[msgCtx->msgBufPos + 1]; msgCtx->msgBufPos += 2; } msgCtx->decodedTextLen = decodedBufPos; @@ -2216,7 +2213,7 @@ void Message_Decode(PlayState* play) { charTexIdx += FONT_CHAR_TEX_SIZE; } PRINTF("%x ", curChar); - MSG_BUF_DECODED(msgCtx)[decodedBufPos] = curChar; + MSG_BUF_DECODED[decodedBufPos] = curChar; decodedBufPos++; } decodedBufPos--; @@ -2247,17 +2244,17 @@ void Message_Decode(PlayState* play) { for (i = 0; i < 4; i++) { Font_LoadChar(font, digits[i] + '0' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED(msgCtx)[decodedBufPos] = digits[i] + '0'; + MSG_BUF_DECODED[decodedBufPos] = digits[i] + '0'; decodedBufPos++; if (i == 1) { Font_LoadChar(font, '"' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED(msgCtx)[decodedBufPos] = '"'; + MSG_BUF_DECODED[decodedBufPos] = '"'; decodedBufPos++; } else if (i == 3) { Font_LoadChar(font, '"' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED(msgCtx)[decodedBufPos] = '"'; + MSG_BUF_DECODED[decodedBufPos] = '"'; } } } else if (curChar == MESSAGE_POINTS) { @@ -2287,7 +2284,7 @@ void Message_Decode(PlayState* play) { } if (loadChar) { Font_LoadChar(font, digits[i] + '0' - ' ', charTexIdx); - MSG_BUF_DECODED(msgCtx)[decodedBufPos] = digits[i] + '0'; + MSG_BUF_DECODED[decodedBufPos] = digits[i] + '0'; charTexIdx += FONT_CHAR_TEX_SIZE; decodedBufPos++; } @@ -2318,7 +2315,7 @@ void Message_Decode(PlayState* play) { if (loadChar) { Font_LoadChar(font, digits[i] + '0' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED(msgCtx)[decodedBufPos] = digits[i] + '0'; + MSG_BUF_DECODED[decodedBufPos] = digits[i] + '0'; PRINTF("%x(%x) ", digits[i] + '0' - ' ', digits[i]); decodedBufPos++; } @@ -2338,16 +2335,16 @@ void Message_Decode(PlayState* play) { if (i == 1 || digits[i] != 0) { Font_LoadChar(font, digits[i] + '0' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED(msgCtx)[decodedBufPos] = digits[i] + '0'; + MSG_BUF_DECODED[decodedBufPos] = digits[i] + '0'; PRINTF("%x(%x) ", digits[i] + '0' - ' ', digits[i]); decodedBufPos++; } } decodedBufPos--; } else if (curChar == MESSAGE_HIGHSCORE) { - value = HIGH_SCORE((u8)MSG_BUF(font)[++msgCtx->msgBufPos]); - PRINTF(T("ランキング=%d\n", "Highscore=%d\n"), MSG_BUF(font)[msgCtx->msgBufPos]); - if ((MSG_BUF(font)[msgCtx->msgBufPos] & 0xFF) == HS_FISHING) { + value = HIGH_SCORE((u8)MSG_BUF[++msgCtx->msgBufPos]); + PRINTF(T("ランキング=%d\n", "Highscore=%d\n"), MSG_BUF[msgCtx->msgBufPos]); + if ((MSG_BUF[msgCtx->msgBufPos] & 0xFF) == HS_FISHING) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { value &= 0x7F; } else { @@ -2356,19 +2353,19 @@ void Message_Decode(PlayState* play) { //! so this always shows HIGH_SCORE(0). Only the PRINTF is wrong, the following line is correct. #if !PLATFORM_IQUE PRINTF("HI_SCORE( kanfont->mbuff.nes_mes_buf[message->rdp] & 0xff000000 ) = %x\n", - HIGH_SCORE(MSG_BUF_WIDE(font)[msgCtx->msgBufPos] & 0xFF000000)); + HIGH_SCORE(MSG_BUF_WIDE[msgCtx->msgBufPos] & 0xFF000000)); #else PRINTF("HI_SCORE( ((unsigned char*)(kanfont->mbuff.nes_mes_buf))[message->rdp] & 0xff000000 ) " "= %x\n", - HIGH_SCORE(MSG_BUF_WIDE(font)[msgCtx->msgBufPos] & 0xFF000000)); + HIGH_SCORE(MSG_BUF_WIDE[msgCtx->msgBufPos] & 0xFF000000)); #endif - value = ((HIGH_SCORE((u8)MSG_BUF(font)[msgCtx->msgBufPos]) & 0xFF000000) >> 0x18); + value = ((HIGH_SCORE((u8)MSG_BUF[msgCtx->msgBufPos]) & 0xFF000000) >> 0x18); value &= 0x7F; } value = SQ((f32)value) * 0.0036f + 0.5f; PRINTF("score=%d\n", value); } - switch (MSG_BUF(font)[msgCtx->msgBufPos] & 0xFF) { + switch (MSG_BUF[msgCtx->msgBufPos] & 0xFF) { case HS_HBA: case HS_POE_POINTS: case HS_FISHING: @@ -2395,7 +2392,7 @@ void Message_Decode(PlayState* play) { } if (loadChar) { Font_LoadChar(font, digits[i] + '0' - ' ', charTexIdx); - MSG_BUF_DECODED(msgCtx)[decodedBufPos] = digits[i] + '0'; + MSG_BUF_DECODED[decodedBufPos] = digits[i] + '0'; charTexIdx += FONT_CHAR_TEX_SIZE; decodedBufPos++; } @@ -2426,17 +2423,17 @@ void Message_Decode(PlayState* play) { for (i = 0; i < 4; i++) { Font_LoadChar(font, digits[i] + '0' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED(msgCtx)[decodedBufPos] = digits[i] + '0'; + MSG_BUF_DECODED[decodedBufPos] = digits[i] + '0'; decodedBufPos++; if (i == 1) { Font_LoadChar(font, '"' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED(msgCtx)[decodedBufPos] = '"'; + MSG_BUF_DECODED[decodedBufPos] = '"'; decodedBufPos++; } else if (i == 3) { Font_LoadChar(font, '"' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED(msgCtx)[decodedBufPos] = '"'; + MSG_BUF_DECODED[decodedBufPos] = '"'; } } break; @@ -2459,34 +2456,33 @@ void Message_Decode(PlayState* play) { for (i = 0; i < 4; i++) { Font_LoadChar(font, digits[i] + '0' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED(msgCtx)[decodedBufPos] = digits[i] + '0'; + MSG_BUF_DECODED[decodedBufPos] = digits[i] + '0'; decodedBufPos++; if (i == 1) { Font_LoadChar(font, ':' - ' ', charTexIdx); charTexIdx += FONT_CHAR_TEX_SIZE; - MSG_BUF_DECODED(msgCtx)[decodedBufPos] = ':'; + MSG_BUF_DECODED[decodedBufPos] = ':'; decodedBufPos++; } } decodedBufPos--; } else if (curChar == MESSAGE_ITEM_ICON) { - MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[msgCtx->msgBufPos + 1]; - PRINTF("ITEM_NO=(%d) (%d)\n", MSG_BUF_DECODED(msgCtx)[decodedBufPos], - MSG_BUF(font)[msgCtx->msgBufPos + 1]); - Message_LoadItemIcon(play, MSG_BUF(font)[msgCtx->msgBufPos + 1], R_TEXTBOX_Y + 10); + MSG_BUF_DECODED[++decodedBufPos] = MSG_BUF[msgCtx->msgBufPos + 1]; + PRINTF("ITEM_NO=(%d) (%d)\n", MSG_BUF_DECODED[decodedBufPos], MSG_BUF[msgCtx->msgBufPos + 1]); + Message_LoadItemIcon(play, MSG_BUF[msgCtx->msgBufPos + 1], R_TEXTBOX_Y + 10); } else if (curChar == MESSAGE_BACKGROUND) { - msgCtx->textboxBackgroundIdx = MSG_BUF(font)[msgCtx->msgBufPos + 1] * 2; + msgCtx->textboxBackgroundIdx = MSG_BUF[msgCtx->msgBufPos + 1] * 2; #if OOT_VERSION < PAL_1_0 //! @bug Wrong shift amounts cause textboxBackgroundForeColorIdx and textboxBackgroundBackColorIdx //! to always be 0. Fortunately MESSAGE_BACKGROUND is only present in unused messages. - msgCtx->textboxBackgroundForeColorIdx = (MSG_BUF(font)[msgCtx->msgBufPos + 2] & 0xF0) >> 12; - msgCtx->textboxBackgroundBackColorIdx = (MSG_BUF(font)[msgCtx->msgBufPos + 2] & 0xF) >> 8; + msgCtx->textboxBackgroundForeColorIdx = (MSG_BUF[msgCtx->msgBufPos + 2] & 0xF0) >> 12; + msgCtx->textboxBackgroundBackColorIdx = (MSG_BUF[msgCtx->msgBufPos + 2] & 0xF) >> 8; #else - msgCtx->textboxBackgroundForeColorIdx = (MSG_BUF(font)[msgCtx->msgBufPos + 2] & 0xF0) >> 4; - msgCtx->textboxBackgroundBackColorIdx = MSG_BUF(font)[msgCtx->msgBufPos + 2] & 0xF; + msgCtx->textboxBackgroundForeColorIdx = (MSG_BUF[msgCtx->msgBufPos + 2] & 0xF0) >> 4; + msgCtx->textboxBackgroundBackColorIdx = MSG_BUF[msgCtx->msgBufPos + 2] & 0xF; #endif - msgCtx->textboxBackgroundYOffsetIdx = (MSG_BUF(font)[msgCtx->msgBufPos + 3] & 0xF0) >> 4; - msgCtx->textboxBackgroundUnkArg = MSG_BUF(font)[msgCtx->msgBufPos + 3] & 0xF; + msgCtx->textboxBackgroundYOffsetIdx = (MSG_BUF[msgCtx->msgBufPos + 3] & 0xF0) >> 4; + msgCtx->textboxBackgroundUnkArg = MSG_BUF[msgCtx->msgBufPos + 3] & 0xF; DMA_REQUEST_SYNC(msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE, (uintptr_t)_message_texture_staticSegmentRomStart + msgCtx->textboxBackgroundIdx * MESSAGE_TEXTURE_STATIC_TEX_SIZE, @@ -2502,7 +2498,7 @@ void Message_Decode(PlayState* play) { R_TEXT_INIT_XPOS = 50; #endif } else if (curChar == MESSAGE_COLOR) { - MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[++msgCtx->msgBufPos]; + MSG_BUF_DECODED[++decodedBufPos] = MSG_BUF[++msgCtx->msgBufPos]; } else if (curChar == MESSAGE_NEWLINE) { numLines++; } else if (curChar != MESSAGE_QUICKTEXT_ENABLE && curChar != MESSAGE_QUICKTEXT_DISABLE && @@ -2511,17 +2507,17 @@ void Message_Decode(PlayState* play) { if (curChar == MESSAGE_FADE) { sTextFade = true; PRINTF("NZ_TIMER_END (key_off_flag=%d)\n", sTextFade); - MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[++msgCtx->msgBufPos]; + MSG_BUF_DECODED[++decodedBufPos] = MSG_BUF[++msgCtx->msgBufPos]; } else if (curChar == MESSAGE_FADE2) { sTextFade = true; PRINTF("NZ_BGM (key_off_flag=%d)\n", sTextFade); - MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[++msgCtx->msgBufPos]; - MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[++msgCtx->msgBufPos]; + MSG_BUF_DECODED[++decodedBufPos] = MSG_BUF[++msgCtx->msgBufPos]; + MSG_BUF_DECODED[++decodedBufPos] = MSG_BUF[++msgCtx->msgBufPos]; } else if (curChar == MESSAGE_SHIFT || curChar == MESSAGE_TEXT_SPEED) { - MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[++msgCtx->msgBufPos] & 0xFF; + MSG_BUF_DECODED[++decodedBufPos] = MSG_BUF[++msgCtx->msgBufPos] & 0xFF; } else if (curChar == MESSAGE_SFX) { - MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[++msgCtx->msgBufPos]; - MSG_BUF_DECODED(msgCtx)[++decodedBufPos] = MSG_BUF(font)[++msgCtx->msgBufPos]; + MSG_BUF_DECODED[++decodedBufPos] = MSG_BUF[++msgCtx->msgBufPos]; + MSG_BUF_DECODED[++decodedBufPos] = MSG_BUF[++msgCtx->msgBufPos]; } else if (curChar == MESSAGE_TWO_CHOICE) { msgCtx->choiceNum = 2; } else if (curChar == MESSAGE_THREE_CHOICE) { @@ -2533,10 +2529,10 @@ void Message_Decode(PlayState* play) { u8 nextChar; if (curChar == 0xAA) { - nextChar = MSG_BUF(font)[++msgCtx->msgBufPos]; + nextChar = MSG_BUF[++msgCtx->msgBufPos]; Font_LoadChar(font, nextChar - ' ', charTexIdx); } else if (curChar >= 0xA0) { - nextChar = MSG_BUF(font)[++msgCtx->msgBufPos]; + nextChar = MSG_BUF[++msgCtx->msgBufPos]; Font_LoadCharCHN(font, ((curChar << 8) | nextChar) - 0xA001, charTexIdx); } else { Font_LoadChar(font, curChar - ' ', charTexIdx); @@ -2622,11 +2618,11 @@ void Message_OpenText(PlayState* play, u16 textId) { if ((B_80121220 != NULL) && (B_80121220->unk_60 != NULL) && B_80121220->unk_60(&play->msgCtx.font)) { } else { - DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_staff_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF, (uintptr_t)_staff_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", UNK_LINE); } #else - DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_staff_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF, (uintptr_t)_staff_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", 1954); #endif } else { @@ -2638,11 +2634,11 @@ void Message_OpenText(PlayState* play, u16 textId) { if ((B_80121220 != NULL) && (B_80121220->unk_64 != NULL) && B_80121220->unk_64(&play->msgCtx.font)) { } else { - DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", UNK_LINE); } #else - DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", UNK_LINE); #endif } else { @@ -2652,11 +2648,11 @@ void Message_OpenText(PlayState* play, u16 textId) { if ((B_80121220 != NULL) && (B_80121220->unk_68 != NULL) && B_80121220->unk_68(&play->msgCtx.font)) { } else { - DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", UNK_LINE); } #else - DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", UNK_LINE); #endif } @@ -2668,11 +2664,11 @@ void Message_OpenText(PlayState* play, u16 textId) { if ((B_80121220 != NULL) && (B_80121220->unk_64 != NULL) && B_80121220->unk_64(&play->msgCtx.font)) { } else { - DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", UNK_LINE); } #else - DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", 1966); #endif } else if (gSaveContext.language == LANGUAGE_GER) { @@ -2683,11 +2679,11 @@ void Message_OpenText(PlayState* play, u16 textId) { if ((B_80121220 != NULL) && (B_80121220->unk_64 != NULL) && B_80121220->unk_68(&play->msgCtx.font)) { } else { - DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_ger_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF, (uintptr_t)_ger_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", UNK_LINE); } #else - DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_ger_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF, (uintptr_t)_ger_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", 1978); #endif } else { @@ -2698,11 +2694,11 @@ void Message_OpenText(PlayState* play, u16 textId) { if ((B_80121220 != NULL) && (B_80121220->unk_64 != NULL) && B_80121220->unk_6C_PAL(&play->msgCtx.font)) { } else { - DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_fra_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF, (uintptr_t)_fra_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", UNK_LINE); } #else - DMA_REQUEST_SYNC(MSG_BUF(font), (uintptr_t)_fra_message_data_staticSegmentRomStart + font->msgOffset, + DMA_REQUEST_SYNC(MSG_BUF, (uintptr_t)_fra_message_data_staticSegmentRomStart + font->msgOffset, font->msgLength, "../z_message_PAL.c", 1990); #endif } @@ -4377,7 +4373,7 @@ void Message_Update(PlayState* play) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); #if OOT_NTSC if (gSaveContext.language == LANGUAGE_JPN && !sTextIsCredits) { - Message_ContinueTextbox(play, MSG_BUF_DECODED_WIDE(msgCtx)[msgCtx->textDrawPos]); + Message_ContinueTextbox(play, MSG_BUF_DECODED_WIDE[msgCtx->textDrawPos]); } else { Message_ContinueTextbox(play, sNextTextId); } From b2c16a6ad7a1d94ec291d4b80793f3b35f6192b3 Mon Sep 17 00:00:00 2001 From: cadmic Date: Mon, 20 Jan 2025 16:49:40 -0800 Subject: [PATCH 7/7] gold stars -> gold skulls --- src/code/z_message.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/code/z_message.c b/src/code/z_message.c index 4d02706bd08..41b8498252f 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -1899,7 +1899,7 @@ void Message_Decode(PlayState* play) { } else if (curCharWide == MESSAGE_WIDE_TOKENS) { // Convert the current number of collected gold skulltula tokens to digits and // add the digits to the decoded buffer in place of the control character. - PRINTF(T("\n金スタ合計数 = %d", "\nTotal number of gold stars = %d"), + PRINTF(T("\n金スタ合計数 = %d", "\nTotal number of gold skulls = %d"), gSaveContext.save.info.inventory.gsTokens); digits[0] = digits[1] = 0; digits[2] = gSaveContext.save.info.inventory.gsTokens; @@ -2293,7 +2293,7 @@ void Message_Decode(PlayState* play) { } else if (curChar == MESSAGE_TOKENS) { // Convert the current number of collected gold skulltula tokens to digits and // add the digits to the decoded buffer in place of the control character. - PRINTF(T("\n金スタ合計数 = %d", "\nTotal number of gold stars = %d"), + PRINTF(T("\n金スタ合計数 = %d", "\nTotal number of gold skulls = %d"), gSaveContext.save.info.inventory.gsTokens); digits[0] = digits[1] = 0; digits[2] = gSaveContext.save.info.inventory.gsTokens;