diff options
| author | Derek Hensley <hensley.derek58@gmail.com> | 2024-01-19 16:16:57 -0800 |
|---|---|---|
| committer | Eblo <7004497+Eblo@users.noreply.github.com> | 2025-09-13 20:42:31 -0400 |
| commit | 59bb01397dedcc5ee3b78c5eeb59a27287661cb3 (patch) | |
| tree | 6c4c4b718e23f87a6b1287892ecd079547c8c8f7 /mm/src/code | |
| parent | 6b297910fd9ce5cafbc495c065e923a87cd7aa25 (diff) | |
General Cleanup (#1529)
* Cleanup
* vi define cleanup
* kdebugserver
* osmotor
* Remove sqrtf.c
* Move osFlash out of libultra
* PadUtils_Destroy
* BOOT_ADDRESS_ULTRA
* Fault
* Format
* viconfig.h
* More small cleanups
* gfx cleanup
* Format
* Forgot to save
* variables.h
* dListTable -> dListSides
* Fix header includes
Diffstat (limited to 'mm/src/code')
| -rw-r--r-- | mm/src/code/z_bgcheck.c | 1 | ||||
| -rw-r--r-- | mm/src/code/z_demo.c | 6 | ||||
| -rw-r--r-- | mm/src/code/z_message.c | 291 | ||||
| -rw-r--r-- | mm/src/code/z_message_nes.c | 489 | ||||
| -rw-r--r-- | mm/src/code/z_message_staff.c | 147 | ||||
| -rw-r--r-- | mm/src/code/z_play.c | 2 |
6 files changed, 504 insertions, 432 deletions
diff --git a/mm/src/code/z_bgcheck.c b/mm/src/code/z_bgcheck.c index 8ae061329..b9a242d19 100644 --- a/mm/src/code/z_bgcheck.c +++ b/mm/src/code/z_bgcheck.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "fault.h" #include "fixed_point.h" #include "vt.h" diff --git a/mm/src/code/z_demo.c b/mm/src/code/z_demo.c index d85c6bb80..b0a83c0c8 100644 --- a/mm/src/code/z_demo.c +++ b/mm/src/code/z_demo.c @@ -1053,8 +1053,8 @@ void CutsceneCmd_Text(PlayState* play, CutsceneContext* csCtx, CsCmdText* cmd) { // a textbox that is expected to be closed by the user is still open. endFrame = csCtx->curFrame; talkState = Message_GetState(&play->msgCtx); - if ((talkState != TEXT_STATE_CLOSING) && (talkState != TEXT_STATE_NONE) && (talkState != TEXT_STATE_7) && - (talkState != TEXT_STATE_8)) { + if ((talkState != TEXT_STATE_CLOSING) && (talkState != TEXT_STATE_NONE) && + (talkState != TEXT_STATE_SONG_DEMO_DONE) && (talkState != TEXT_STATE_8)) { csCtx->curFrame--; if ((talkState == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { @@ -1097,7 +1097,7 @@ void CutsceneCmd_Text(PlayState* play, CutsceneContext* csCtx, CsCmdText* cmd) { } } - if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { + if ((talkState == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_DisplayOcarinaStaff(play, cmd->textId); } } diff --git a/mm/src/code/z_message.c b/mm/src/code/z_message.c index 4a28d44eb..95ddac7e3 100644 --- a/mm/src/code/z_message.c +++ b/mm/src/code/z_message.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "z64horse.h" #include "z64shrink_window.h" @@ -293,7 +294,8 @@ bool Message_ShouldAdvance(PlayState* play) { MessageContext* msgCtx = &play->msgCtx; Input* controller = CONTROLLER1(&play->state); - if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_10) || (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_11)) { + if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_TWO_CHOICE) || + (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_THREE_CHOICE)) { if (CHECK_BTN_ALL(controller->press.button, BTN_A)) { Audio_PlaySfx(NA_SE_SY_MESSAGE_PASS); } @@ -315,7 +317,8 @@ bool Message_ShouldAdvanceSilent(PlayState* play) { MessageContext* msgCtx = &play->msgCtx; Input* controller = CONTROLLER1(&play->state); - if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_10) || (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_11)) { + if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_TWO_CHOICE) || + (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_THREE_CHOICE)) { return CHECK_BTN_ALL(controller->press.button, BTN_A); } else { return CHECK_BTN_ALL(controller->press.button, BTN_A) || CHECK_BTN_ALL(controller->press.button, BTN_B) || @@ -332,7 +335,7 @@ void Message_CloseTextbox(PlayState* play) { if (play->msgCtx.msgLength != 0) { msgCtx->stateTimer = 2; msgCtx->msgMode = MSGMODE_TEXT_CLOSING; - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_00; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_DEFAULT; Audio_PlaySfx(NA_SE_NONE); } } @@ -716,9 +719,9 @@ void func_80148D64(PlayState* play) { sAnalogStickHeld = false; } - msgCtx->bankRupeesSelected = (msgCtx->decodedBuffer.schar[msgCtx->unk120C0] - '0') * 100; - msgCtx->bankRupeesSelected += (msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + 1] - '0') * 10; - msgCtx->bankRupeesSelected += msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + 2] - '0'; + msgCtx->rupeesSelected = (msgCtx->decodedBuffer.schar[msgCtx->unk120C0] - '0') * 100; + msgCtx->rupeesSelected += (msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + 1] - '0') * 10; + msgCtx->rupeesSelected += msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + 2] - '0'; } void func_80149048(PlayState* play) { @@ -742,7 +745,7 @@ void func_80149048(PlayState* play) { Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); } - msgCtx->bankRupeesSelected = (msgCtx->decodedBuffer.schar[msgCtx->unk120C0] - '0') * 10; + msgCtx->rupeesSelected = (msgCtx->decodedBuffer.schar[msgCtx->unk120C0] - '0') * 10; } void func_801491DC(PlayState* play) { @@ -946,7 +949,7 @@ void Message_GrowTextbox(PlayState* play) { void Message_FindMessage(PlayState* play, u16 textId) { MessageContext* msgCtx = &play->msgCtx; Font* font = &msgCtx->font; - MessageTableEntry* msgEntry = msgCtx->messageEntryTable; + MessageTableEntry* msgEntry = msgCtx->messageTable; const char* segment = msgEntry->segment; const char* foundSegment; const char* nextSegment; @@ -963,7 +966,7 @@ void Message_FindMessage(PlayState* play, u16 textId) { msgEntry++; } - msgEntry = msgCtx->messageEntryTable; + msgEntry = msgCtx->messageTable; foundSegment = msgEntry->segment; msgEntry++; nextSegment = msgEntry->segment; @@ -1195,11 +1198,11 @@ Color_RGB16 D_801CFE74[] = { { 255, 120, 0 }, { 70, 255, 80 }, { 80, 110, 255 }, { 255, 255, 30 }, { 90, 180, 255 }, { 210, 100, 255 }, { 170, 170, 170 }, { 255, 130, 30 }, }; -Color_RGB16 D_801CFEA4[] = { +static Color_RGB16 sColorsNormalJPN[] = { { 255, 60, 60 }, { 70, 255, 80 }, { 80, 90, 255 }, { 255, 255, 50 }, { 80, 150, 255 }, { 255, 150, 180 }, { 170, 170, 170 }, { 255, 130, 30 }, }; -Color_RGB16 D_801CFED4[] = { +static Color_RGB16 sColorsButtonsJPN[] = { { 255, 60, 60 }, { 70, 255, 80 }, { 80, 90, 255 }, { 255, 255, 50 }, { 80, 150, 255 }, { 255, 150, 180 }, { 180, 180, 200 }, { 255, 130, 30 }, }; @@ -1207,12 +1210,12 @@ Color_RGB16 D_801CFF04[] = { { 195, 0, 0 }, { 70, 255, 80 }, { 80, 90, 255 }, { 255, 255, 50 }, { 80, 150, 255 }, { 255, 150, 180 }, { 170, 170, 170 }, { 255, 130, 30 }, }; -Color_RGB16 D_801CFF34[] = { +static Color_RGB16 sColorsBombersNotebookJPN[] = { { 255, 60, 60 }, { 110, 170, 255 }, { 80, 90, 255 }, { 255, 255, 50 }, { 80, 150, 255 }, { 255, 150, 180 }, { 170, 170, 170 }, { 255, 130, 30 }, }; -u8 D_801CFF64[] = { 2, 1, 3, 6, 6, 6, 3, 3, 3, 3, 1, 6 }; +static u8 sButtonColorIndicesJPN[] = { 2, 1, 3, 6, 6, 6, 3, 3, 3, 3, 1, 6 }; #define MESSAGE_ITEM_NONE 9999 @@ -1225,9 +1228,9 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { Gfx* gfx = *gfxP; u16 character; s16 sp130; - s16 sp12E; - s16 sp12C; - s16 sp12A; + s16 prevR; + s16 prevG; + s16 prevB; u16 lookAheadCharacter; play->msgCtx.textPosX = play->msgCtx.unk11F1A[0] + play->msgCtx.unk11FF8; @@ -1299,9 +1302,9 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { msgCtx->textColorB = D_801CFE74[(s16)(character - 0x2001)].b + msgCtx->unk120D4; } } else if (play->pauseCtx.bombersNotebookOpen) { - msgCtx->textColorR = D_801CFF34[(s16)(character - 0x2001)].r; - msgCtx->textColorG = D_801CFF34[(s16)(character - 0x2001)].g; - msgCtx->textColorB = D_801CFF34[(s16)(character - 0x2001)].b; + msgCtx->textColorR = sColorsBombersNotebookJPN[(s16)(character - 0x2001)].r; + msgCtx->textColorG = sColorsBombersNotebookJPN[(s16)(character - 0x2001)].g; + msgCtx->textColorB = sColorsBombersNotebookJPN[(s16)(character - 0x2001)].b; } else if (msgCtx->textBoxType == TEXTBOX_TYPE_1) { msgCtx->textColorR = D_801CFE74[(s16)(character - 0x2001)].r; msgCtx->textColorG = D_801CFE74[(s16)(character - 0x2001)].g; @@ -1311,9 +1314,9 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { msgCtx->textColorG = D_801CFF04[(s16)(character - 0x2001)].g; msgCtx->textColorB = D_801CFF04[(s16)(character - 0x2001)].b; } else { - msgCtx->textColorR = D_801CFEA4[(s16)(character - 0x2001)].r; - msgCtx->textColorG = D_801CFEA4[(s16)(character - 0x2001)].g; - msgCtx->textColorB = D_801CFEA4[(s16)(character - 0x2001)].b; + msgCtx->textColorR = sColorsNormalJPN[(s16)(character - 0x2001)].r; + msgCtx->textColorG = sColorsNormalJPN[(s16)(character - 0x2001)].g; + msgCtx->textColorB = sColorsNormalJPN[(s16)(character - 0x2001)].b; } if ((i + 1) == msgCtx->textDrawPos) { @@ -1401,9 +1404,9 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; if (msgCtx->unk11F0C == 3) { - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_55; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_FADE_STAGES_1; } else { - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_50; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_FADE_NORMAL; } msgCtx->stateTimer = msgCtx->decodedBuffer.wchar[++i]; Font_LoadMessageBoxEndIcon(&play->msgCtx.font, 1); @@ -1417,7 +1420,7 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { case 0x112: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_52; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_FADE_SKIPPABLE; msgCtx->stateTimer = msgCtx->decodedBuffer.wchar[++i]; Font_LoadMessageBoxEndIcon(&play->msgCtx.font, 1); if (play->csCtx.state == CS_STATE_IDLE) { @@ -1502,7 +1505,7 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { break; case 0x202: - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_10; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_TWO_CHOICE; if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->choiceTextId = msgCtx->currentTextId; @@ -1512,7 +1515,7 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { break; case 0x203: - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_11; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_THREE_CHOICE; if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->choiceTextId = msgCtx->currentTextId; @@ -1522,7 +1525,7 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { break; case 0x20C: - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_60; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_INPUT_BANK; if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Font_LoadMessageBoxEndIcon(&play->msgCtx.font, 1); @@ -1530,7 +1533,7 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { break; case 0x220: - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_61; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_INPUT_DOGGY_RACETRACK_BET; if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Font_LoadMessageBoxEndIcon(&play->msgCtx.font, 1); @@ -1538,7 +1541,7 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { break; case 0x221: - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_62; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_INPUT_BOMBER_CODE; if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Font_LoadMessageBoxEndIcon(&play->msgCtx.font, 1); @@ -1548,14 +1551,14 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { case 0x222: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_41; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_PAUSE_MENU; Font_LoadMessageBoxEndIcon(&play->msgCtx.font, 0); Audio_PlaySfx(NA_SE_SY_MESSAGE_END); } break; case 0x225: - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_63; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_INPUT_LOTTERY_CODE; if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Font_LoadMessageBoxEndIcon(&play->msgCtx.font, 1); @@ -1571,7 +1574,7 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { return; } msgCtx->msgMode = MSGMODE_TEXT_DONE; - if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_00) { + if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_DEFAULT) { Audio_PlaySfx(NA_SE_SY_MESSAGE_END); if (character == 0x500) { Font_LoadMessageBoxEndIcon(font, 1); @@ -1592,7 +1595,7 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Audio_PlaySfx(NA_SE_NONE); msgCtx->msgMode = MSGMODE_TEXT_DONE; - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_30; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_PERSISTENT; } *gfxP = gfx; return; @@ -1600,7 +1603,7 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { case 0x103: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_40; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_EVENT; Font_LoadMessageBoxEndIcon(&play->msgCtx.font, 0); Audio_PlaySfx(NA_SE_SY_MESSAGE_END); } @@ -1610,7 +1613,7 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { case 0x230: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_42; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_EVENT2; Font_LoadMessageBoxEndIcon(&play->msgCtx.font, 1); Audio_PlaySfx(NA_SE_SY_MESSAGE_END); } @@ -1642,16 +1645,16 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { } if ((character >= 0x839F) && (character < 0x83AB)) { - sp12E = msgCtx->textColorR; - sp12C = msgCtx->textColorG; - sp12A = msgCtx->textColorB; - msgCtx->textColorR = D_801CFED4[(s16)D_801CFF64[character - 0x839F]].r; - msgCtx->textColorG = D_801CFED4[(s16)D_801CFF64[character - 0x839F]].g; - msgCtx->textColorB = D_801CFED4[(s16)D_801CFF64[character - 0x839F]].b; + prevR = msgCtx->textColorR; + prevG = msgCtx->textColorG; + prevB = msgCtx->textColorB; + msgCtx->textColorR = sColorsButtonsJPN[(s16)sButtonColorIndicesJPN[character - 0x839F]].r; + msgCtx->textColorG = sColorsButtonsJPN[(s16)sButtonColorIndicesJPN[character - 0x839F]].g; + msgCtx->textColorB = sColorsButtonsJPN[(s16)sButtonColorIndicesJPN[character - 0x839F]].b; Message_DrawTextChar(play, &font->charBuf[font->unk_11D88][charTexIndex], &gfx); - msgCtx->textColorR = sp12E; - msgCtx->textColorG = sp12C; - msgCtx->textColorB = sp12A; + msgCtx->textColorR = prevR; + msgCtx->textColorG = prevG; + msgCtx->textColorB = prevB; } else { Message_DrawTextChar(play, &font->charBuf[font->unk_11D88][charTexIndex], &gfx); } @@ -2126,7 +2129,7 @@ void Message_GetTimerDigits(OSTime time, s16 digits[8]) { digits[7] = t; } -void Message_SetupLoadItemIcon(PlayState* play) { +void Message_DecodeHeader(PlayState* play) { Font* font; MessageContext* msgCtx = &play->msgCtx; @@ -2313,15 +2316,13 @@ void Message_LoadOwlWarpText(PlayState* play, s32* offset, f32* arg2, s16* decod *arg2 = sp3C; } -// Counterpart to NES D_801D08D8 -u16 D_801D0268[][3] = { +u16 sTimeSpeedTextJPN[][3] = { { 0x82CD, 0x82E2, 0x82A2 }, { 0x82D3, 0x82C2, 0x82A4 }, { 0x82A8, 0x82BB, 0x82A2 }, }; -// Counterpart to NES D_801D08E4 -u16 D_801D027C[] = { 0x2001, 0x2003, 0x2004, 0x2002 }; +u16 sMaskCodeColorCmdJPN[] = { 0x2001, 0x2003, 0x2004, 0x2002 }; // Counterpart to NES sMaskCodeTextENG u16 D_801D0284[] = { 0x90D4, 0x90C2, 0x89A9, 0x97CE }; @@ -2364,7 +2365,7 @@ void Message_Decode(PlayState* play) { numLines = 0; decodedBufPos = 0; charTexIndex = 0; - Message_SetupLoadItemIcon(play); + Message_DecodeHeader(play); while (true) { curChar = msgCtx->decodedBuffer.wchar[decodedBufPos] = font->msgBuf.wchar[msgCtx->msgBufPos]; @@ -2566,7 +2567,7 @@ void Message_Decode(PlayState* play) { msgCtx->unk120BE = spD2; msgCtx->unk120C0 = decodedBufPos; msgCtx->unk120C2 = 2; - msgCtx->bankRupeesSelected = 0; + msgCtx->rupeesSelected = 0; msgCtx->unk120C4 = charTexIndex; digits[0] = digits[1] = digits[2] = 0; @@ -2577,7 +2578,7 @@ void Message_Decode(PlayState* play) { func_8014CCB4(play, &decodedBufPos, &charTexIndex, &spC0); } else if (curChar == 0x20D) { digits[0] = digits[1] = 0; - digits[2] = msgCtx->bankRupeesSelected; + digits[2] = msgCtx->rupeesSelected; while (digits[2] >= 100) { digits[0]++; @@ -2602,7 +2603,7 @@ void Message_Decode(PlayState* play) { func_8014CCB4(play, &decodedBufPos, &charTexIndex, &spC0); } else if (curChar == 0x20E) { digits[0] = digits[1] = digits[2] = 0; - digits[3] = msgCtx->bankRupees; + digits[3] = msgCtx->rupeesTotal; while (digits[3] >= 1000) { digits[0]++; @@ -2729,7 +2730,7 @@ void Message_Decode(PlayState* play) { msgCtx->unk120BE = spD2; msgCtx->unk120C0 = decodedBufPos; msgCtx->unk120C2 = 0; - msgCtx->bankRupeesSelected = 0; + msgCtx->rupeesSelected = 0; msgCtx->unk120C4 = charTexIndex; digits[0] = digits[1] = digits[2] = 0; for (i = 0; i < 2; i++) { @@ -2742,7 +2743,7 @@ void Message_Decode(PlayState* play) { msgCtx->unk120BE = spD2; msgCtx->unk120C0 = decodedBufPos; msgCtx->unk120C2 = 0; - msgCtx->bankRupeesSelected = 0; + msgCtx->rupeesSelected = 0; msgCtx->unk120C4 = charTexIndex; for (i = 0; i < 5; i++) { @@ -2761,8 +2762,8 @@ void Message_Decode(PlayState* play) { } for (i = 0; i < 3; i++, decodedBufPos++) { - msgCtx->decodedBuffer.wchar[decodedBufPos] = D_801D0268[index][i]; - Font_LoadChar(play, D_801D0268[index][i], charTexIndex); + msgCtx->decodedBuffer.wchar[decodedBufPos] = sTimeSpeedTextJPN[index][i]; + Font_LoadChar(play, sTimeSpeedTextJPN[index][i], charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; } decodedBufPos--; @@ -2775,7 +2776,7 @@ void Message_Decode(PlayState* play) { msgCtx->unk120BE = spD2; msgCtx->unk120C0 = decodedBufPos; msgCtx->unk120C2 = 0; - msgCtx->bankRupeesSelected = 0; + msgCtx->rupeesSelected = 0; msgCtx->unk120C4 = charTexIndex; for (i = 0; i < 3; i++) { @@ -2790,7 +2791,7 @@ void Message_Decode(PlayState* play) { } else if (curChar == 0x226) { for (i = 0; i < 6; i++) { msgCtx->decodedBuffer.wchar[decodedBufPos] = - D_801D027C[((void)0, gSaveContext.save.saveInfo.spiderHouseMaskOrder[i])]; + sMaskCodeColorCmdJPN[((void)0, gSaveContext.save.saveInfo.spiderHouseMaskOrder[i])]; decodedBufPos++; Message_LoadChar(play, i + 0x8250, &charTexIndex, &spC0, decodedBufPos); decodedBufPos++; @@ -2921,8 +2922,8 @@ void Message_Decode(PlayState* play) { } decodedBufPos--; } else if ((curChar >= 0x231) && (curChar < 0x237)) { - msgCtx->decodedBuffer.wchar[decodedBufPos] = - D_801D027C[((void)0, gSaveContext.save.saveInfo.spiderHouseMaskOrder[(s16)(curChar - 0x231)])]; + msgCtx->decodedBuffer.wchar[decodedBufPos] = sMaskCodeColorCmdJPN[( + (void)0, gSaveContext.save.saveInfo.spiderHouseMaskOrder[(s16)(curChar - 0x231)])]; decodedBufPos++; Message_LoadChar( play, @@ -3387,7 +3388,7 @@ void Message_OpenText(PlayState* play, u16 textId) { msgCtx->choiceNum = 0; msgCtx->textUnskippable = false; - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_00; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_DEFAULT; msgCtx->textDrawPos = 0; msgCtx->msgBufPos = 0; msgCtx->decodedTextLen = 0; @@ -3487,7 +3488,7 @@ void func_801514B0(PlayState* play, u16 arg1, u8 arg2) { } msgCtx->choiceNum = 0; msgCtx->textUnskippable = false; - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_00; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_DEFAULT; msgCtx->textDrawPos = 0; msgCtx->msgBufPos = 0; msgCtx->decodedTextLen = 0; @@ -3498,7 +3499,7 @@ void func_801514B0(PlayState* play, u16 arg1, u8 arg2) { msgCtx->unk11F0C = msgCtx->unk11F08 & 0xF; msgCtx->textUnskippable = true; // #region 2S2H [Port] - // DmaMgr_SendRequest0(msgCtx->textboxSegment, SEGMENT_ROM_START(message_static) + (D_801CFC78[0] << 12), 0x1000); + // DmaMgr_SendRequest0(msgCtx->textboxSegment, SEGMENT_ROM_START(message_static) + (D_801CFC78[0] * 0x1000), 0x1000); msgCtx->textboxSegment[TEXTBOX_SEG_TYPE] = gMessageBackgrounds[D_801CFC78[0]]; // #endregion msgCtx->textboxColorRed = 0; @@ -3825,30 +3826,33 @@ u8 Message_GetState(MessageContext* msgCtx) { if (msgCtx->msgMode == MSGMODE_TEXT_DONE) { if (msgCtx->nextTextId != 0xFFFF) { - return TEXT_STATE_1; + return TEXT_STATE_NEXT; } - if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_10) || (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_11)) { + if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_TWO_CHOICE) || + (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_THREE_CHOICE)) { return TEXT_STATE_CHOICE; } - if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_40) || (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_42) || - (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_30)) { - return TEXT_STATE_5; + if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_EVENT) || (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_EVENT2) || + (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_PERSISTENT)) { + return TEXT_STATE_EVENT; } - if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_41) { - return TEXT_STATE_16; + if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_PAUSE_MENU) { + return TEXT_STATE_PAUSE_MENU; } - if ((msgCtx->textboxEndType >= TEXTBOX_ENDTYPE_50) && (msgCtx->textboxEndType <= TEXTBOX_ENDTYPE_57)) { - return TEXT_STATE_3; + if ((msgCtx->textboxEndType >= TEXTBOX_ENDTYPE_FADE_NORMAL) && + (msgCtx->textboxEndType <= TEXTBOX_ENDTYPE_FADE_STAGES_3)) { + return TEXT_STATE_FADING; } - if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_60) || (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_61)) { - return TEXT_STATE_14; + if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_INPUT_BANK) || + (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_INPUT_DOGGY_RACETRACK_BET)) { + return TEXT_STATE_INPUT_RUPEES; } - if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_62) { - return TEXT_STATE_15; + if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_INPUT_BOMBER_CODE) { + return TEXT_STATE_INPUT_BOMBER_CODE; } - if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_63) { - return TEXT_STATE_17; + if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_INPUT_LOTTERY_CODE) { + return TEXT_STATE_INPUT_LOTTERY_CODE; } if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_12) { return TEXT_STATE_18; @@ -3857,10 +3861,10 @@ u8 Message_GetState(MessageContext* msgCtx) { } if (msgCtx->msgMode == MSGMODE_TEXT_AWAIT_NEXT) { - return TEXT_STATE_10; + return TEXT_STATE_AWAITING_NEXT; } if (msgCtx->msgMode == MSGMODE_SONG_DEMONSTRATION_DONE) { - return TEXT_STATE_7; + return TEXT_STATE_SONG_DEMO_DONE; } if ((msgCtx->ocarinaMode == OCARINA_MODE_EVENT) || (msgCtx->msgMode == MSGMODE_37)) { return TEXT_STATE_8; @@ -3882,7 +3886,7 @@ u8 Message_GetState(MessageContext* msgCtx) { return TEXT_STATE_CLOSING; } - return TEXT_STATE_3; + return TEXT_STATE_FADING; } void Message_DrawTextBox(PlayState* play, Gfx** gfxP) { @@ -5202,7 +5206,7 @@ void Message_DrawMain(PlayState* play, Gfx** gfxP) { case MSGMODE_TEXT_DONE: switch (msgCtx->textboxEndType) { - case TEXTBOX_ENDTYPE_60: + case TEXTBOX_ENDTYPE_INPUT_BANK: temp_v0_33 = msgCtx->unk120BE; temp = msgCtx->unk11FFA + (msgCtx->unk11FFC * temp_v0_33); func_80147F18(play, &gfx, @@ -5212,7 +5216,7 @@ void Message_DrawMain(PlayState* play, Gfx** gfxP) { func_80148D64(play); break; - case TEXTBOX_ENDTYPE_61: + case TEXTBOX_ENDTYPE_INPUT_DOGGY_RACETRACK_BET: temp_v0_33 = msgCtx->unk120BE; temp = msgCtx->unk11FFA + (msgCtx->unk11FFC * temp_v0_33); func_80148558(play, &gfx, @@ -5221,7 +5225,7 @@ void Message_DrawMain(PlayState* play, Gfx** gfxP) { func_80149048(play); break; - case TEXTBOX_ENDTYPE_62: + case TEXTBOX_ENDTYPE_INPUT_BOMBER_CODE: temp_v0_33 = msgCtx->unk120BE; temp = msgCtx->unk11FFA + (msgCtx->unk11FFC * temp_v0_33); func_80147F18(play, &gfx, @@ -5231,7 +5235,7 @@ void Message_DrawMain(PlayState* play, Gfx** gfxP) { func_801491DC(play); break; - case TEXTBOX_ENDTYPE_63: + case TEXTBOX_ENDTYPE_INPUT_LOTTERY_CODE: temp_v0_33 = msgCtx->unk120BE; temp = msgCtx->unk11FFA + (msgCtx->unk11FFC * temp_v0_33); func_80147F18(play, &gfx, @@ -5262,11 +5266,11 @@ void Message_DrawMain(PlayState* play, Gfx** gfxP) { Message_DrawText(play, &gfx); switch (msgCtx->textboxEndType) { - case TEXTBOX_ENDTYPE_10: + case TEXTBOX_ENDTYPE_TWO_CHOICE: func_80148CBC(play, &gfx, 1); break; - case TEXTBOX_ENDTYPE_11: + case TEXTBOX_ENDTYPE_THREE_CHOICE: func_80148CBC(play, &gfx, 2); break; @@ -5274,25 +5278,25 @@ void Message_DrawMain(PlayState* play, Gfx** gfxP) { func_80148CBC(play, &gfx, 1); break; - case TEXTBOX_ENDTYPE_30: - case TEXTBOX_ENDTYPE_41: - case TEXTBOX_ENDTYPE_50: - case TEXTBOX_ENDTYPE_52: - case TEXTBOX_ENDTYPE_55: - case TEXTBOX_ENDTYPE_56: - case TEXTBOX_ENDTYPE_57: - case TEXTBOX_ENDTYPE_62: + case TEXTBOX_ENDTYPE_PERSISTENT: + case TEXTBOX_ENDTYPE_PAUSE_MENU: + case TEXTBOX_ENDTYPE_FADE_NORMAL: + case TEXTBOX_ENDTYPE_FADE_SKIPPABLE: + case TEXTBOX_ENDTYPE_FADE_STAGES_1: + case TEXTBOX_ENDTYPE_FADE_STAGES_2: + case TEXTBOX_ENDTYPE_FADE_STAGES_3: + case TEXTBOX_ENDTYPE_INPUT_BOMBER_CODE: break; - case TEXTBOX_ENDTYPE_40: - case TEXTBOX_ENDTYPE_60: - case TEXTBOX_ENDTYPE_61: + case TEXTBOX_ENDTYPE_EVENT: + case TEXTBOX_ENDTYPE_INPUT_BANK: + case TEXTBOX_ENDTYPE_INPUT_DOGGY_RACETRACK_BET: default: Message_DrawTextboxIcon(play, &gfx, 158, (s16)(D_801D03A8[msgCtx->textBoxType] + msgCtx->textboxYTarget)); break; - case TEXTBOX_ENDTYPE_42: + case TEXTBOX_ENDTYPE_EVENT2: Message_DrawTextboxIcon(play, &gfx, 158, (s16)(D_801D03A8[msgCtx->textBoxType] + msgCtx->textboxYTarget)); break; @@ -5581,7 +5585,7 @@ void Message_Update(PlayState* play) { } else if (msgCtx->textBoxPos == 2) { msgCtx->textboxYTarget = sTextboxMidYPositions[var_v1]; } else if (msgCtx->textBoxPos == 7) { - msgCtx->textboxYTarget = 0x9E; + msgCtx->textboxYTarget = 158; } else { msgCtx->textboxYTarget = sTextboxLowerYPositions[var_v1]; } @@ -5590,12 +5594,12 @@ void Message_Update(PlayState* play) { if ((gSaveContext.options.language == LANGUAGE_JPN) && !msgCtx->textIsCredits) { msgCtx->unk11FFE[0] = (s16)(msgCtx->textboxYTarget + 7); - msgCtx->unk11FFE[1] = (s16)(msgCtx->textboxYTarget + 0x19); - msgCtx->unk11FFE[2] = (s16)(msgCtx->textboxYTarget + 0x2B); + msgCtx->unk11FFE[1] = (s16)(msgCtx->textboxYTarget + 25); + msgCtx->unk11FFE[2] = (s16)(msgCtx->textboxYTarget + 43); } else { - msgCtx->unk11FFE[0] = (s16)(msgCtx->textboxYTarget + 0x14); - msgCtx->unk11FFE[1] = (s16)(msgCtx->textboxYTarget + 0x20); - msgCtx->unk11FFE[2] = (s16)(msgCtx->textboxYTarget + 0x2C); + msgCtx->unk11FFE[0] = (s16)(msgCtx->textboxYTarget + 20); + msgCtx->unk11FFE[1] = (s16)(msgCtx->textboxYTarget + 32); + msgCtx->unk11FFE[2] = (s16)(msgCtx->textboxYTarget + 44); } if ((msgCtx->textBoxType == TEXTBOX_TYPE_4) || (msgCtx->textBoxType == TEXTBOX_TYPE_5)) { @@ -5713,10 +5717,11 @@ void Message_Update(PlayState* play) { break; case MSGMODE_TEXT_DONE: - if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_50) || (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_52)) { + if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_FADE_NORMAL) || + (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_FADE_SKIPPABLE)) { msgCtx->stateTimer--; if ((msgCtx->stateTimer == 0) || - ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_52) && Message_ShouldAdvance(play))) { + ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_FADE_SKIPPABLE) && Message_ShouldAdvance(play))) { if (msgCtx->nextTextId != 0xFFFF) { Audio_PlaySfx(NA_SE_SY_MESSAGE_PASS); Message_ContinueTextbox(play, msgCtx->nextTextId); @@ -5729,28 +5734,30 @@ void Message_Update(PlayState* play) { } } } else { - if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_30) || (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_40) || - (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_42) || (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_41)) { + if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_PERSISTENT) || + (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_EVENT) || + (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_EVENT2) || + (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_PAUSE_MENU)) { return; } switch (msgCtx->textboxEndType) { - case TEXTBOX_ENDTYPE_55: + case TEXTBOX_ENDTYPE_FADE_STAGES_1: msgCtx->textColorAlpha += 20; if (msgCtx->textColorAlpha >= 255) { msgCtx->textColorAlpha = 255; - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_56; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_FADE_STAGES_2; } break; - case TEXTBOX_ENDTYPE_56: + case TEXTBOX_ENDTYPE_FADE_STAGES_2: msgCtx->stateTimer--; if (msgCtx->stateTimer == 0) { - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_57; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_FADE_STAGES_3; } break; - case TEXTBOX_ENDTYPE_57: + case TEXTBOX_ENDTYPE_FADE_STAGES_3: msgCtx->textColorAlpha -= 20; if (msgCtx->textColorAlpha <= 0) { msgCtx->textColorAlpha = 0; @@ -5771,11 +5778,11 @@ void Message_Update(PlayState* play) { } break; - case TEXTBOX_ENDTYPE_10: + case TEXTBOX_ENDTYPE_TWO_CHOICE: Message_HandleChoiceSelection(play, 1); break; - case TEXTBOX_ENDTYPE_11: + case TEXTBOX_ENDTYPE_THREE_CHOICE: Message_HandleChoiceSelection(play, 2); break; @@ -5787,7 +5794,7 @@ void Message_Update(PlayState* play) { break; } - if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_10) && + if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_TWO_CHOICE) && (play->msgCtx.ocarinaMode == OCARINA_MODE_ACTIVE)) { if (Message_ShouldAdvance(play)) { if (msgCtx->choiceIndex == 0) { @@ -5797,7 +5804,7 @@ void Message_Update(PlayState* play) { } Message_CloseTextbox(play); } - } else if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_10) && + } else if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_TWO_CHOICE) && (play->msgCtx.ocarinaMode == OCARINA_MODE_PROCESS_SOT)) { if (Message_ShouldAdvance(play)) { if (msgCtx->choiceIndex == 0) { @@ -5812,7 +5819,7 @@ void Message_Update(PlayState* play) { Message_CloseTextbox(play); } } - } else if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_10) && + } else if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_TWO_CHOICE) && (play->msgCtx.ocarinaMode == OCARINA_MODE_PROCESS_INVERTED_TIME)) { if (Message_ShouldAdvance(play)) { if (msgCtx->choiceIndex == 0) { @@ -5831,7 +5838,7 @@ void Message_Update(PlayState* play) { Message_CloseTextbox(play); } } - } else if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_10) && + } else if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_TWO_CHOICE) && (play->msgCtx.ocarinaMode == OCARINA_MODE_PROCESS_DOUBLE_TIME)) { if (Message_ShouldAdvance(play)) { if (msgCtx->choiceIndex == 0) { @@ -5849,9 +5856,9 @@ void Message_Update(PlayState* play) { } Message_CloseTextbox(play); } - } else if ((msgCtx->textboxEndType != TEXTBOX_ENDTYPE_10) || + } else if ((msgCtx->textboxEndType != TEXTBOX_ENDTYPE_TWO_CHOICE) || (pauseCtx->state != PAUSE_STATE_OWL_WARP_CONFIRM)) { - if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_10) && + if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_TWO_CHOICE) && (play->msgCtx.ocarinaMode == OCARINA_MODE_1B)) { if (Message_ShouldAdvance(play)) { if (msgCtx->choiceIndex == 0) { @@ -5863,18 +5870,18 @@ void Message_Update(PlayState* play) { } Message_CloseTextbox(play); } - } else if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_60) || - (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_61) || - (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_10) || - (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_11) || - (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_50) || - (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_52) || - (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_55) || - (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_56) || - (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_57) || - (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_62)) { + } else if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_INPUT_BANK) || + (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_INPUT_DOGGY_RACETRACK_BET) || + (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_TWO_CHOICE) || + (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_THREE_CHOICE) || + (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_FADE_NORMAL) || + (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_FADE_SKIPPABLE) || + (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_FADE_STAGES_1) || + (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_FADE_STAGES_2) || + (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_FADE_STAGES_3) || + (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_INPUT_BOMBER_CODE)) { //! FAKE: debug? - if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_50) {} + if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_FADE_NORMAL) {} } else if (pauseCtx->itemDescriptionOn) { if ((input->rel.stick_x != 0) || (input->rel.stick_y != 0) || CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_B) || @@ -5994,11 +6001,11 @@ void Message_Update(PlayState* play) { pauseCtx->itemDescriptionOn = false; } - if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_30) { - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_00; + if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_PERSISTENT) { + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_DEFAULT; play->msgCtx.ocarinaMode = OCARINA_MODE_WARP; } else { - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_00; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_DEFAULT; } if (EQ_MAX_QUEST_HEART_PIECE_COUNT) { @@ -6240,8 +6247,8 @@ void Message_Update(PlayState* play) { } void Message_SetTables(PlayState* play) { - play->msgCtx.messageEntryTableNes = sMessageTableNES; - play->msgCtx.messageTableStaff = sMessageTableCredits; + play->msgCtx.messageTableNES = sMessageTableNES; + play->msgCtx.messageTableCredits = sMessageTableCredits; } void Message_Init(PlayState* play) { @@ -6255,10 +6262,10 @@ void Message_Init(PlayState* play) { msgCtx->msgMode = MSGMODE_NONE; msgCtx->msgLength = 0; msgCtx->currentTextId = 0; - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_00; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_DEFAULT; msgCtx->choiceIndex = 0; msgCtx->ocarinaAction = msgCtx->textUnskippable = 0; - msgCtx->textColorAlpha = 0xFF; + msgCtx->textColorAlpha = 255; View_Init(&msgCtx->view, play->state.gfxCtx); diff --git a/mm/src/code/z_message_nes.c b/mm/src/code/z_message_nes.c index 92c645992..62dd87c0b 100644 --- a/mm/src/code/z_message_nes.c +++ b/mm/src/code/z_message_nes.c @@ -1,4 +1,5 @@ #include "global.h" +#include "message_data_fmt_nes.h" #include "message_data_static.h" #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #include "assets/interface/message_texture_static/message_texture_static.h" @@ -21,7 +22,7 @@ f32 sNESFontWidths[160] = { void Message_FindMessageNES(PlayState* play, u16 textId) { MessageContext* msgCtx = &play->msgCtx; Font* font = &msgCtx->font; - MessageTableEntry* msgEntry = msgCtx->messageEntryTableNes; + MessageTableEntry* msgEntry = msgCtx->messageTableNES; const char* segment = msgEntry->segment; const char* foundSegment; const char* nextSegment; @@ -44,7 +45,7 @@ void Message_FindMessageNES(PlayState* play, u16 textId) { msgEntry++; } - msgEntry = msgCtx->messageEntryTableNes; + msgEntry = msgCtx->messageTableNES; foundSegment = msgEntry->segment; msgEntry++; nextSegment = msgEntry->segment; @@ -202,7 +203,7 @@ void Message_LoadTimeNES(PlayState* play, u8 curChar, s32* offset, f32* arg3, s1 f32 timeLeftInMinutes; s16 i; - if (curChar == 0xCF) { + if (curChar == MESSAGE_TIME_UNTIL_MOON_CRASH) { timeLeft = TIME_UNTIL_MOON_CRASH; } else { timeLeft = TIME_UNTIL_NEW_DAY; @@ -288,7 +289,7 @@ void Message_LoadOwlWarpTextNES(PlayState* play, s32* offset, f32* arg2, s16* de s32 o = *offset; f32 f = *arg2; s16 i; - u8 currentChar; + u8 curChar; s16 owlWarpId; s16 stringLimit; @@ -301,14 +302,14 @@ void Message_LoadOwlWarpTextNES(PlayState* play, s32* offset, f32* arg2, s16* de for (i = 0; i < stringLimit; i++) { msgCtx->decodedBuffer.schar[p] = sOwlWarpTextENG[owlWarpId][i]; - currentChar = msgCtx->decodedBuffer.schar[p]; - if (currentChar != ' ') { + curChar = msgCtx->decodedBuffer.schar[p]; + if (curChar != ' ') { Font_LoadCharNES(play, sOwlWarpTextENG[owlWarpId][i], o); o += FONT_CHAR_TEX_SIZE; } - currentChar = msgCtx->decodedBuffer.schar[p]; + curChar = msgCtx->decodedBuffer.schar[p]; p++; - f += (sNESFontWidths[currentChar - ' '] * msgCtx->textCharScale); + f += (sNESFontWidths[curChar - ' '] * msgCtx->textCharScale); } p--; @@ -357,32 +358,73 @@ void Message_GetTimerDigitsNES(OSTime time, s16* digits) { } Color_RGB16 D_801D07DC[] = { - { 255, 120, 0 }, { 70, 255, 80 }, { 80, 110, 255 }, { 255, 255, 30 }, - { 90, 180, 255 }, { 210, 100, 255 }, { 170, 170, 170 }, { 255, 130, 30 }, + { 255, 120, 0 }, // MESSAGE_COLOR_RED + { 70, 255, 80 }, // MESSAGE_COLOR_GREEN + { 80, 110, 255 }, // MESSAGE_COLOR_BLUE + { 255, 255, 30 }, // MESSAGE_COLOR_YELLOW + { 90, 180, 255 }, // MESSAGE_COLOR_LIGHTBLUE + { 210, 100, 255 }, // MESSAGE_COLOR_PINK + { 170, 170, 170 }, // MESSAGE_COLOR_SILVER + { 255, 130, 30 }, // MESSAGE_COLOR_ORANGE }; -Color_RGB16 D_801D080C[] = { - { 255, 60, 60 }, { 70, 255, 80 }, { 80, 90, 255 }, { 255, 255, 50 }, - { 80, 150, 255 }, { 255, 150, 180 }, { 170, 170, 170 }, { 255, 130, 30 }, +static Color_RGB16 sColorsNormalNES[] = { + { 255, 60, 60 }, // MESSAGE_COLOR_RED + { 70, 255, 80 }, // MESSAGE_COLOR_GREEN + { 80, 90, 255 }, // MESSAGE_COLOR_BLUE + { 255, 255, 50 }, // MESSAGE_COLOR_YELLOW + { 80, 150, 255 }, // MESSAGE_COLOR_LIGHTBLUE + { 255, 150, 180 }, // MESSAGE_COLOR_PINK + { 170, 170, 170 }, // MESSAGE_COLOR_SILVER + { 255, 130, 30 }, // MESSAGE_COLOR_ORANGE }; -Color_RGB16 D_801D083C[] = { - { 255, 60, 60 }, { 70, 255, 80 }, { 80, 90, 255 }, { 255, 255, 50 }, - { 80, 150, 255 }, { 255, 150, 180 }, { 180, 180, 200 }, { 255, 130, 30 }, +static Color_RGB16 sColorsButtonsNES[] = { + { 255, 60, 60 }, // RED + { 70, 255, 80 }, // GREEN + { 80, 90, 255 }, // BLUE + { 255, 255, 50 }, // YELLOW + { 80, 150, 255 }, // LIGHTBLUE + { 255, 150, 180 }, // PINK + { 180, 180, 200 }, // SILVER + { 255, 130, 30 }, // ORANGE }; Color_RGB16 D_801D086C[] = { - { 195, 0, 0 }, { 70, 255, 80 }, { 80, 90, 255 }, { 255, 255, 50 }, - { 80, 150, 255 }, { 255, 150, 180 }, { 170, 170, 170 }, { 255, 130, 30 }, + { 195, 0, 0 }, // MESSAGE_COLOR_RED + { 70, 255, 80 }, // MESSAGE_COLOR_GREEN + { 80, 90, 255 }, // MESSAGE_COLOR_BLUE + { 255, 255, 50 }, // MESSAGE_COLOR_YELLOW + { 80, 150, 255 }, // MESSAGE_COLOR_LIGHTBLUE + { 255, 150, 180 }, // MESSAGE_COLOR_PINK + { 170, 170, 170 }, // MESSAGE_COLOR_SILVER + { 255, 130, 30 }, // MESSAGE_COLOR_ORANGE }; -Color_RGB16 D_801D089C[] = { - { 255, 60, 60 }, { 110, 170, 255 }, { 80, 90, 255 }, { 255, 255, 50 }, - { 80, 150, 255 }, { 255, 150, 180 }, { 170, 170, 170 }, { 255, 130, 30 }, +static Color_RGB16 sColorsBombersNotebookNES[] = { + { 255, 60, 60 }, // MESSAGE_COLOR_RED + { 110, 170, 255 }, // MESSAGE_COLOR_GREEN + { 80, 90, 255 }, // MESSAGE_COLOR_BLUE + { 255, 255, 50 }, // MESSAGE_COLOR_YELLOW + { 80, 150, 255 }, // MESSAGE_COLOR_LIGHTBLUE + { 255, 150, 180 }, // MESSAGE_COLOR_PINK + { 170, 170, 170 }, // MESSAGE_COLOR_SILVER + { 255, 130, 30 }, // MESSAGE_COLOR_ORANGE }; -u8 D_801D08CC[] = { - 0x02, 0x01, 0x03, 0x06, 0x06, 0x06, 0x03, 0x03, 0x03, 0x03, 0x01, 0x06, +static u8 sButtonColorIndicesNES[] = { + 2, // MESSAGE_BTN_A + 1, // MESSAGE_BTN_B + 3, // MESSAGE_BTN_C + 6, // MESSAGE_BTN_L + 6, // MESSAGE_BTN_R + 6, // MESSAGE_BTN_Z + 3, // MESSAGE_BTN_CUP + 3, // MESSAGE_BTN_CDOWN + 3, // MESSAGE_BTN_CLEFT + 3, // MESSAGE_BTN_CRIGHT + 1, // MESSAGE_Z_TARGET + 6, // MESSAGE_CONTROL_PAD }; void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { @@ -395,9 +437,9 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { Gfx* gfx = *gfxP; u16 character; s16 sp130; - s16 sp12E; - s16 sp12C; - s16 sp12A; + s16 prevR; + s16 prevG; + s16 prevB; msgCtx->textPosX = msgCtx->unk11F1A[0] + msgCtx->unk11FF8; msgCtx->textPosY = msgCtx->unk11FFA; @@ -423,7 +465,7 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { character = msgCtx->decodedBuffer.schar[i]; switch ((u8)character) { - case 0x0: + case MESSAGE_COLOR_DEFAULT: if (play->pauseCtx.bombersNotebookOpen || (msgCtx->textBoxType == TEXTBOX_TYPE_D)) { msgCtx->textColorR = msgCtx->textColorG = msgCtx->textColorB = 0; } else if (msgCtx->textBoxType == TEXTBOX_TYPE_5) { @@ -440,16 +482,16 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { } break; - case 0x1: - case 0x2: - case 0x3: - case 0x4: - case 0x5: - case 0x6: - case 0x7: - case 0x8: + case MESSAGE_COLOR_RED: + case MESSAGE_COLOR_GREEN: + case MESSAGE_COLOR_BLUE: + case MESSAGE_COLOR_YELLOW: + case MESSAGE_COLOR_LIGHTBLUE: + case MESSAGE_COLOR_PINK: + case MESSAGE_COLOR_SILVER: + case MESSAGE_COLOR_ORANGE: if ((msgCtx->msgMode >= MSGMODE_NEW_CYCLE_0) && (msgCtx->msgMode <= MSGMODE_OWL_SAVE_2) && - ((u8)character == 0x2)) { + ((u8)character == MESSAGE_COLOR_GREEN)) { msgCtx->textDrawPos = msgCtx->decodedTextLen; if (msgCtx->unk120D6) { msgCtx->unk120D4 += 25; @@ -482,9 +524,9 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { } } else if (play->pauseCtx.bombersNotebookOpen) { - msgCtx->textColorR = D_801D089C[(s16)((u8)character - 1)].r; - msgCtx->textColorG = D_801D089C[(s16)((u8)character - 1)].g; - msgCtx->textColorB = D_801D089C[(s16)((u8)character - 1)].b; + msgCtx->textColorR = sColorsBombersNotebookNES[(s16)((u8)character - 1)].r; + msgCtx->textColorG = sColorsBombersNotebookNES[(s16)((u8)character - 1)].g; + msgCtx->textColorB = sColorsBombersNotebookNES[(s16)((u8)character - 1)].b; } else if (msgCtx->textBoxType == TEXTBOX_TYPE_1) { msgCtx->textColorR = D_801D07DC[(s16)((u8)character - 1)].r; msgCtx->textColorG = D_801D07DC[(s16)((u8)character - 1)].g; @@ -494,9 +536,9 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { msgCtx->textColorG = D_801D086C[(s16)((u8)character - 1)].g; msgCtx->textColorB = D_801D086C[(s16)((u8)character - 1)].b; } else { - msgCtx->textColorR = D_801D080C[(s16)((u8)character - 1)].r; - msgCtx->textColorG = D_801D080C[(s16)((u8)character - 1)].g; - msgCtx->textColorB = D_801D080C[(s16)((u8)character - 1)].b; + msgCtx->textColorR = sColorsNormalNES[(s16)((u8)character - 1)].r; + msgCtx->textColorG = sColorsNormalNES[(s16)((u8)character - 1)].g; + msgCtx->textColorB = sColorsNormalNES[(s16)((u8)character - 1)].b; } if ((i + 1) == msgCtx->textDrawPos || @@ -505,14 +547,14 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { } break; - case 0x20: // ` ` + case ' ': msgCtx->textPosX += 6; break; - case 0x11: + case MESSAGE_NEWLINE: msgCtx->textPosY += msgCtx->unk11FFC; // fallthrough - case 0x13: + case MESSAGE_CARRIAGE_RETURN: sp130++; msgCtx->textPosX = msgCtx->unk11F1A[sp130] + msgCtx->unk11FF8; @@ -539,8 +581,8 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { } continue; - case 0x10: - case 0x12: + case MESSAGE_BOX_BREAK: + case MESSAGE_BOX_BREAK2: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { if (!msgCtx->textboxSkipped) { Audio_PlaySfx(NA_SE_NONE); @@ -558,16 +600,19 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { *gfxP = gfx; return; - case 0x17: // MESSAGE_QUICKTEXT_ENABLE + case MESSAGE_QUICKTEXT_ENABLE: if ((i + 1) == msgCtx->textDrawPos || ((i + 2) == msgCtx->textDrawPos && CVarGetInteger("gEnhancements.Fixes.ControlCharacters", 0))) { if ((msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) || ((msgCtx->msgMode >= MSGMODE_OCARINA_STARTING) && (msgCtx->msgMode <= MSGMODE_26))) { j = i; while (true) { - if ((msgCtx->decodedBuffer.schar[j] != 0x18) && (msgCtx->decodedBuffer.schar[j] != 0x1A) && - (msgCtx->decodedBuffer.schar[j] != 0x19) && (msgCtx->decodedBuffer.schar[j] != 0xE0) && - (msgCtx->decodedBuffer.schar[j] != 0x10) && (msgCtx->decodedBuffer.schar[j] != 0x12)) { + if ((msgCtx->decodedBuffer.schar[j] != MESSAGE_QUICKTEXT_DISABLE) && + (msgCtx->decodedBuffer.schar[j] != MESSAGE_PERSISTENT) && + (msgCtx->decodedBuffer.schar[j] != MESSAGE_EVENT) && + (msgCtx->decodedBuffer.schar[j] != MESSAGE_EVENT2) && + (msgCtx->decodedBuffer.schar[j] != MESSAGE_BOX_BREAK) && + (msgCtx->decodedBuffer.schar[j] != MESSAGE_BOX_BREAK2)) { j++; continue; } @@ -579,10 +624,10 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { } break; - case 0x18: // MESSAGE_QUICKTEXT_DISABLE + case MESSAGE_QUICKTEXT_DISABLE: break; - case 0x1B: // MESSAGE_BOX_BREAK_DELAYED + case MESSAGE_BOX_BREAK_DELAYED: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { stateTimerHi = msgCtx->decodedBuffer.schar[++i] << 8; stateTimerHi += msgCtx->decodedBuffer.schar[++i]; @@ -592,13 +637,13 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { *gfxP = gfx; return; - case 0x1C: + case MESSAGE_FADE: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; if (msgCtx->unk11F0C == 3) { - msgCtx->textboxEndType = 0x55; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_FADE_STAGES_1; } else { - msgCtx->textboxEndType = 0x50; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_FADE_NORMAL; } stateTimerHi = msgCtx->decodedBuffer.schar[++i] << 8; stateTimerHi += msgCtx->decodedBuffer.schar[++i]; @@ -611,10 +656,10 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { *gfxP = gfx; return; - case 0x1D: + case MESSAGE_FADE_SKIPPABLE: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; - msgCtx->textboxEndType = 0x52; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_FADE_SKIPPABLE; stateTimerHi = msgCtx->decodedBuffer.schar[++i] << 8; stateTimerHi += msgCtx->decodedBuffer.schar[++i]; msgCtx->stateTimer = stateTimerHi; @@ -626,7 +671,7 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { *gfxP = gfx; return; - case 0x1E: // MESSAGE_SFX + case MESSAGE_SFX: if (((i + 1) == msgCtx->textDrawPos || ((i + 2) == msgCtx->textDrawPos && CVarGetInteger("gEnhancements.Fixes.ControlCharacters", 0))) && (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING)) { @@ -641,7 +686,7 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { i += 2; break; - case 0x1F: + case MESSAGE_DELAY: if (((i + 1) == msgCtx->textDrawPos || ((i + 2) == msgCtx->textDrawPos && CVarGetInteger("gEnhancements.Fixes.ControlCharacters", 0))) && (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING)) { @@ -653,7 +698,7 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { i += 2; break; - case 0xA: + case MESSAGE_TEXT_SPEED: i++; character = msgCtx->decodedBuffer.schar[i]; switch ((u8)character) { @@ -674,8 +719,8 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { } break; - case 0xC1: // MESSAGE_BACKGROUND - msgCtx->textPosX = 0x2D; + case MESSAGE_BACKGROUND: + msgCtx->textPosX = 45; if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Audio_PlaySfx(NA_SE_NONE); @@ -688,28 +733,28 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSPTextureRectangle(gfx++, msgCtx->textPosX << 2, (msgCtx->unk12012 + 1) << 2, - (msgCtx->textPosX + 0x60) << 2, (msgCtx->unk12012 + 0x31) << 2, G_TX_RENDERTILE, 0, + (msgCtx->textPosX + 96) << 2, (msgCtx->unk12012 + 49) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); gDPLoadTextureBlock_4b(gfx++, msgCtx->textboxSegment[TEXTBOX_SEG_BG_2], G_IM_FMT_I, 96, 48, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfx++, (msgCtx->textPosX + 0x60) << 2, (msgCtx->unk12012 + 1) << 2, - (msgCtx->textPosX + 0xC1) << 2, (msgCtx->unk12012 + 0x31) << 2, G_TX_RENDERTILE, 0, - 0, 1 << 10, 1 << 10); + gSPTextureRectangle(gfx++, (msgCtx->textPosX + 96) << 2, (msgCtx->unk12012 + 1) << 2, + (msgCtx->textPosX + 193) << 2, (msgCtx->unk12012 + 49) << 2, G_TX_RENDERTILE, 0, 0, + 1 << 10, 1 << 10); gDPPipeSync(gfx++); gDPSetPrimColor(gfx++, 0, 0, 255, 60, 0, msgCtx->textColorAlpha); gDPLoadTextureBlock_4b(gfx++, msgCtx->textboxSegment[TEXTBOX_SEG_BG_1], G_IM_FMT_I, 96, 48, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfx++, msgCtx->textPosX << 2, msgCtx->unk12012 << 2, (msgCtx->textPosX + 0x60) << 2, - (msgCtx->unk12012 + 0x30) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + gSPTextureRectangle(gfx++, msgCtx->textPosX << 2, msgCtx->unk12012 << 2, (msgCtx->textPosX + 96) << 2, + (msgCtx->unk12012 + 48) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); gDPLoadTextureBlock_4b(gfx++, msgCtx->textboxSegment[TEXTBOX_SEG_BG_2], G_IM_FMT_I, 96, 48, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfx++, (msgCtx->textPosX + 0x60) << 2, msgCtx->unk12012 << 2, - (msgCtx->textPosX + 0xC0) << 2, (msgCtx->unk12012 + 0x30) << 2, G_TX_RENDERTILE, 0, - 0, 1 << 10, 1 << 10); + gSPTextureRectangle(gfx++, (msgCtx->textPosX + 96) << 2, msgCtx->unk12012 << 2, + (msgCtx->textPosX + 192) << 2, (msgCtx->unk12012 + 48) << 2, G_TX_RENDERTILE, 0, 0, + 1 << 10, 1 << 10); gDPPipeSync(gfx++); gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, @@ -718,79 +763,79 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { msgCtx->textPosX += 32; break; - case 0xC2: - msgCtx->textboxEndType = 0x10; + case MESSAGE_TWO_CHOICE: + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_TWO_CHOICE; if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->choiceTextId = msgCtx->currentTextId; msgCtx->stateTimer = 4; Font_LoadMessageBoxEndIcon(font, 2); if (msgCtx->unk120D8 != 3) { - msgCtx->unk11FFE[0] = (s16)(msgCtx->textboxYTarget + 0xE); - msgCtx->unk11FFE[1] = (s16)(msgCtx->textboxYTarget + 0x1A); - msgCtx->unk11FFE[2] = (s16)(msgCtx->textboxYTarget + 0x26); + msgCtx->unk11FFE[0] = (s16)(msgCtx->textboxYTarget + 14); + msgCtx->unk11FFE[1] = (s16)(msgCtx->textboxYTarget + 26); + msgCtx->unk11FFE[2] = (s16)(msgCtx->textboxYTarget + 38); } } break; - case 0xC3: - msgCtx->textboxEndType = 0x11; + case MESSAGE_THREE_CHOICE: + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_THREE_CHOICE; if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->choiceTextId = msgCtx->currentTextId; msgCtx->stateTimer = 4; Font_LoadMessageBoxEndIcon(font, 2); if (msgCtx->unk120D8 != 3) { - msgCtx->unk11FFE[0] = (s16)(msgCtx->textboxYTarget + 0xE); - msgCtx->unk11FFE[1] = (s16)(msgCtx->textboxYTarget + 0x1A); - msgCtx->unk11FFE[2] = (s16)(msgCtx->textboxYTarget + 0x26); + msgCtx->unk11FFE[0] = (s16)(msgCtx->textboxYTarget + 14); + msgCtx->unk11FFE[1] = (s16)(msgCtx->textboxYTarget + 26); + msgCtx->unk11FFE[2] = (s16)(msgCtx->textboxYTarget + 38); } } break; - case 0xCC: - msgCtx->textboxEndType = 0x60; + case MESSAGE_INPUT_BANK: + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_INPUT_BANK; if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Font_LoadMessageBoxEndIcon(font, 1); } break; - case 0xD0: - msgCtx->textboxEndType = 0x61; + case MESSAGE_INPUT_DOGGY_RACETRACK_BET: + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_INPUT_DOGGY_RACETRACK_BET; if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Font_LoadMessageBoxEndIcon(font, 1); } break; - case 0xD1: - msgCtx->textboxEndType = 0x62; + case MESSAGE_INPUT_BOMBER_CODE: + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_INPUT_BOMBER_CODE; if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Font_LoadMessageBoxEndIcon(font, 1); } break; - case 0xD2: + case MESSAGE_PAUSE_MENU: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; - msgCtx->textboxEndType = 0x41; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_PAUSE_MENU; Font_LoadMessageBoxEndIcon(font, 0); Audio_PlaySfx(NA_SE_SY_MESSAGE_END); } break; - case 0xD5: - msgCtx->textboxEndType = 0x63; + case MESSAGE_INPUT_LOTTERY_CODE: + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_INPUT_LOTTERY_CODE; if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Font_LoadMessageBoxEndIcon(font, 1); } break; - case 0x15: - case 0xBF: + case MESSAGE_CONTINUE: + case MESSAGE_END: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { if (msgCtx->textBoxType == TEXTBOX_TYPE_3) { Message_HandleOcarina(play); @@ -799,9 +844,9 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { } msgCtx->msgMode = MSGMODE_TEXT_DONE; - if (msgCtx->textboxEndType == 0) { + if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_DEFAULT) { Audio_PlaySfx(NA_SE_SY_MESSAGE_END); - if ((u8)character == 0xBF) { + if ((u8)character == MESSAGE_END) { Font_LoadMessageBoxEndIcon(font, 1); } else { Font_LoadMessageBoxEndIcon(font, 0); @@ -816,29 +861,29 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { *gfxP = gfx; return; - case 0x1A: + case MESSAGE_PERSISTENT: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Audio_PlaySfx(NA_SE_NONE); msgCtx->msgMode = MSGMODE_TEXT_DONE; - msgCtx->textboxEndType = 0x30; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_PERSISTENT; } *gfxP = gfx; return; - case 0x19: + case MESSAGE_EVENT: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; - msgCtx->textboxEndType = 0x40; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_EVENT; Font_LoadMessageBoxEndIcon(font, 0); Audio_PlaySfx(NA_SE_SY_MESSAGE_END); } *gfxP = gfx; return; - case 0xE0: + case MESSAGE_EVENT2: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; - msgCtx->textboxEndType = 0x42; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_EVENT2; Font_LoadMessageBoxEndIcon(font, 1); Audio_PlaySfx(NA_SE_SY_MESSAGE_END); } @@ -870,17 +915,17 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { Audio_PlaySfx(NA_SE_NONE); } - if (((u8)character >= 0xB0) && ((u8)character <= 0xBB)) { - sp12E = msgCtx->textColorR; - sp12C = msgCtx->textColorG; - sp12A = msgCtx->textColorB; - msgCtx->textColorR = D_801D083C[(s16)D_801D08CC[(u8)character - 0xB0]].r; - msgCtx->textColorG = D_801D083C[(s16)D_801D08CC[(u8)character - 0xB0]].g; - msgCtx->textColorB = D_801D083C[(s16)D_801D08CC[(u8)character - 0xB0]].b; + if (((u8)character >= MESSAGE_BTN_A) && ((u8)character <= MESSAGE_CONTROL_PAD)) { + prevR = msgCtx->textColorR; + prevG = msgCtx->textColorG; + prevB = msgCtx->textColorB; + msgCtx->textColorR = sColorsButtonsNES[(s16)sButtonColorIndicesNES[(u8)character - MESSAGE_BTN_A]].r; + msgCtx->textColorG = sColorsButtonsNES[(s16)sButtonColorIndicesNES[(u8)character - MESSAGE_BTN_A]].g; + msgCtx->textColorB = sColorsButtonsNES[(s16)sButtonColorIndicesNES[(u8)character - MESSAGE_BTN_A]].b; Message_DrawTextChar(play, &font->charBuf[font->unk_11D88][charTexIndex], &gfx); - msgCtx->textColorR = sp12E; - msgCtx->textColorG = sp12C; - msgCtx->textColorB = sp12A; + msgCtx->textColorR = prevR; + msgCtx->textColorG = prevG; + msgCtx->textColorB = prevB; } else if (msgCtx->msgMode >= MSGMODE_OWL_SAVE_0) { if ((i < (msgCtx->decodedTextLen - 6)) || (i >= (msgCtx->decodedTextLen - 4))) { Message_DrawTextChar(play, &font->charBuf[font->unk_11D88][charTexIndex], &gfx); @@ -916,14 +961,14 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { break; default: - if (((msgCtx->textboxEndType == 0x62) && (i >= msgCtx->unk120C0) && + if (((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_INPUT_BOMBER_CODE) && (i >= msgCtx->unk120C0) && ((msgCtx->unk120C0 + 4) >= i)) || - ((msgCtx->textboxEndType == 0x63) && (i >= msgCtx->unk120C0) && - ((msgCtx->unk120C0 + 2) >= i)) || - ((msgCtx->textboxEndType == 0x60) && (i >= msgCtx->unk120C0) && + ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_INPUT_LOTTERY_CODE) && + (i >= msgCtx->unk120C0) && ((msgCtx->unk120C0 + 2) >= i)) || + ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_INPUT_BANK) && (i >= msgCtx->unk120C0) && ((msgCtx->unk120C0 + 2) >= i)) || - ((msgCtx->textboxEndType == 0x61) && (i >= msgCtx->unk120C0) && - ((msgCtx->unk120C0 + 1) >= i))) { + ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_INPUT_DOGGY_RACETRACK_BET) && + (i >= msgCtx->unk120C0) && ((msgCtx->unk120C0 + 1) >= i))) { msgCtx->textPosX += (s32)(16.0f * msgCtx->textCharScale); } else { msgCtx->textPosX += (s32)(sNESFontWidths[(u8)character - ' '] * msgCtx->textCharScale); @@ -950,17 +995,17 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { *gfxP = gfx; } -char D_801D08D8[][4] = { +char sTimeSpeedTextENG[][4] = { "Fast", "----", "Slow", }; -u8 D_801D08E4[] = { - 0x01, - 0x03, - 0x04, - 0x02, +u8 sMaskCodeColorCmdENG[] = { + MESSAGE_COLOR_RED, + MESSAGE_COLOR_BLUE, + MESSAGE_COLOR_YELLOW, + MESSAGE_COLOR_GREEN, }; #define RED_STR "RED" @@ -1013,14 +1058,16 @@ void Message_DecodeNES(PlayState* play) { msgCtx->textFade = false; spA4 = 0.0f; font->unk_11D88 = (font->unk_11D88 ^ 1) & 1; - Message_SetupLoadItemIcon(play); + Message_DecodeHeader(play); while (true) { curChar = font->msgBuf.schar[msgCtx->msgBufPos]; msgCtx->decodedBuffer.schar[decodedBufPos] = font->msgBuf.schar[msgCtx->msgBufPos]; - if ((curChar == 0x10) || (curChar == 0x12) || (curChar == 0x1B) || (curChar == 0x1C) || (curChar == 0x1D) || - (curChar == 0x19) || (curChar == 0xE0) || (curChar == 0xBF) || (curChar == 0x15) || (curChar == 0x1A)) { + if ((curChar == MESSAGE_BOX_BREAK) || (curChar == MESSAGE_BOX_BREAK2) || + (curChar == MESSAGE_BOX_BREAK_DELAYED) || (curChar == MESSAGE_FADE) || + (curChar == MESSAGE_FADE_SKIPPABLE) || (curChar == MESSAGE_EVENT) || (curChar == MESSAGE_EVENT2) || + (curChar == MESSAGE_END) || (curChar == MESSAGE_CONTINUE) || (curChar == MESSAGE_PERSISTENT)) { msgCtx->msgMode = MSGMODE_TEXT_DISPLAYING; msgCtx->textDrawPos = 1; if (msgCtx->textBoxType == TEXTBOX_TYPE_3) { @@ -1035,7 +1082,7 @@ void Message_DecodeNES(PlayState* play) { spA4 = 0.0f; - if (curChar == 0x12) { + if (curChar == MESSAGE_BOX_BREAK2) { if ((msgCtx->textBoxType != TEXTBOX_TYPE_3) && (msgCtx->textBoxType != TEXTBOX_TYPE_4)) { if (numLines < 2) { msgCtx->unk11FFA = msgCtx->textboxY + XREG(10); @@ -1060,7 +1107,8 @@ void Message_DecodeNES(PlayState* play) { { s8 requiredScopeTemp; - if ((curChar == 0x1B) || (curChar == 0x1C) || (curChar == 0x1D)) { + if ((curChar == MESSAGE_BOX_BREAK_DELAYED) || (curChar == MESSAGE_FADE) || + (curChar == MESSAGE_FADE_SKIPPABLE)) { //! FAKE: & 0xFFFF to fix regalloc msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[(msgCtx->msgBufPos & 0xFFFF) + 1]; msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[msgCtx->msgBufPos + 2]; @@ -1080,7 +1128,7 @@ void Message_DecodeNES(PlayState* play) { msgCtx->unk120CA = msgCtx->unk120D0; msgCtx->unk120CC = msgCtx->unk120D2; break; - } else if (curChar == 0x16) { + } else if (curChar == MESSAGE_NAME) { // Substitute the player name control character for the file's player name. for (playerNameLen = ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.playerName); playerNameLen > 0; playerNameLen--) { @@ -1115,7 +1163,7 @@ void Message_DecodeNES(PlayState* play) { decodedBufPos++; } decodedBufPos--; - } else if (curChar == 0xC1) { + } else if (curChar == MESSAGE_BACKGROUND) { // #region 2S2H [Port] // DmaMgr_SendRequest0(msgCtx->textboxSegment + 0x1000, SEGMENT_ROM_START(message_texture_static), 0x900); // DmaMgr_SendRequest0(msgCtx->textboxSegment + 0x1900, SEGMENT_ROM_START(message_texture_static) + 0x900, @@ -1128,15 +1176,15 @@ void Message_DecodeNES(PlayState* play) { msgCtx->unk12012 = msgCtx->textboxY + 8; msgCtx->unk11F18 = 1; msgCtx->unk12010 = XREG(47); - } else if (curChar == 0xC2) { + } else if (curChar == MESSAGE_TWO_CHOICE) { msgCtx->unk11F18 = 0; msgCtx->choiceNum = 2; - } else if (curChar == 0xC3) { + } else if (curChar == MESSAGE_THREE_CHOICE) { msgCtx->unk11F18 = 0; msgCtx->choiceNum = 3; - msgCtx->unk11FF8 += 0x16; - } else if (curChar == 0xC4) { - Message_GetTimerDigitsNES(((void)0, gSaveContext.timerCurTimes[curChar - 0xC4]), spA8); + msgCtx->unk11FF8 += 22; + } else if (curChar == MESSAGE_TIMER_POSTMAN) { + Message_GetTimerDigitsNES(((void)0, gSaveContext.timerCurTimes[curChar - MESSAGE_TIMER_POSTMAN]), spA8); loadChar = false; for (i = 0; i < 5; i++) { @@ -1149,9 +1197,10 @@ void Message_DecodeNES(PlayState* play) { } } decodedBufPos--; - } else if ((curChar == 0xC5) || (curChar == 0xC6) || (curChar == 0xC7) || (curChar == 0xC8) || - (curChar == 0xC9)) { - Message_GetTimerDigitsNES(((void)0, gSaveContext.timerCurTimes[curChar - 0xC4]), spA8); + } else if ((curChar == MESSAGE_TIMER_MINIGAME_1) || (curChar == MESSAGE_TIMER_2) || + (curChar == MESSAGE_TIMER_MOON_CRASH) || (curChar == MESSAGE_TIMER_MINIGAME_2) || + (curChar == MESSAGE_TIMER_ENV_HAZARD)) { + Message_GetTimerDigitsNES(((void)0, gSaveContext.timerCurTimes[curChar - MESSAGE_TIMER_POSTMAN]), spA8); loadChar = false; for (i = 0; i < 8; i++) { @@ -1164,7 +1213,7 @@ void Message_DecodeNES(PlayState* play) { } } decodedBufPos--; - } else if (curChar == 0xCA) { + } else if (curChar == MESSAGE_TIME) { digits[0] = 0; digits[1] = TIME_TO_MINUTES_F(CURRENT_TIME) / 60.0f; while (digits[1] >= 10) { @@ -1187,16 +1236,16 @@ void Message_DecodeNES(PlayState* play) { if (i == 1) { Font_LoadCharNES(play, '"', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.schar[decodedBufPos] = 0x22; + msgCtx->decodedBuffer.schar[decodedBufPos] = '"'; decodedBufPos++; } else if (i == 3) { - Font_LoadCharNES(play, 0x27, charTexIndex); + Font_LoadCharNES(play, '\'', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.schar[decodedBufPos] = 0x27; + msgCtx->decodedBuffer.schar[decodedBufPos] = '\''; } } spA4 += 6 * (16.0f * msgCtx->textCharScale); - } else if (curChar == 0xCB) { + } else if (curChar == MESSAGE_CHEST_FLAGS) { digits[0] = digits[1] = digits[2] = 0; digits[3] = Flags_GetAllTreasure(play); @@ -1227,12 +1276,12 @@ void Message_DecodeNES(PlayState* play) { } } decodedBufPos--; - } else if (curChar == 0xCC) { + } else if (curChar == MESSAGE_INPUT_BANK) { decodedBufPos++; msgCtx->unk120BE = spC6; msgCtx->unk120C0 = decodedBufPos; msgCtx->unk120C2 = 2; - msgCtx->bankRupeesSelected = 0; + msgCtx->rupeesSelected = 0; msgCtx->unk120C4 = charTexIndex; digits[0] = digits[1] = digits[2] = 0; @@ -1241,9 +1290,9 @@ void Message_DecodeNES(PlayState* play) { decodedBufPos++; } Message_LoadLocalizedRupeesNES(play, &decodedBufPos, &charTexIndex, &spA4); - } else if (curChar == 0xCD) { + } else if (curChar == MESSAGE_RUPEES_SELECTED) { digits[0] = digits[1] = 0; - digits[2] = msgCtx->bankRupeesSelected; + digits[2] = msgCtx->rupeesSelected; while (digits[2] >= 100) { digits[0]++; @@ -1265,10 +1314,10 @@ void Message_DecodeNES(PlayState* play) { decodedBufPos++; } } - Message_LoadRupeesNES(play, &decodedBufPos, &charTexIndex, &spA4, msgCtx->bankRupeesSelected); - } else if (curChar == 0xCE) { + Message_LoadRupeesNES(play, &decodedBufPos, &charTexIndex, &spA4, msgCtx->rupeesSelected); + } else if (curChar == MESSAGE_RUPEES_TOTAL) { digits[0] = digits[1] = digits[2] = 0; - digits[3] = msgCtx->bankRupees; + digits[3] = msgCtx->rupeesTotal; while (digits[3] >= 1000) { digits[0]++; @@ -1293,10 +1342,10 @@ void Message_DecodeNES(PlayState* play) { decodedBufPos++; } } - Message_LoadRupeesNES(play, &decodedBufPos, &charTexIndex, &spA4, msgCtx->bankRupees); - } else if (curChar == 0xCF) { + Message_LoadRupeesNES(play, &decodedBufPos, &charTexIndex, &spA4, msgCtx->rupeesTotal); + } else if (curChar == MESSAGE_TIME_UNTIL_MOON_CRASH) { Message_LoadTimeNES(play, curChar, &charTexIndex, &spA4, &decodedBufPos); - } else if (curChar == 0xC) { + } else if (curChar == MESSAGE_STRAY_FAIRIES) { digits[0] = digits[1] = 0; digits[2] = gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex]; @@ -1340,7 +1389,7 @@ void Message_DecodeNES(PlayState* play) { decodedBufPos++; Message_LoadCharNES(play, 'h', &charTexIndex, &spA4, decodedBufPos); } - } else if (curChar == 0xD) { + } else if (curChar == MESSAGE_TOKENS) { digits[0] = digits[1] = 0; digits[2] = Inventory_GetSkullTokenCount(play->sceneId); @@ -1384,7 +1433,7 @@ void Message_DecodeNES(PlayState* play) { decodedBufPos++; Message_LoadCharNES(play, 'h', &charTexIndex, &spA4, decodedBufPos); } - } else if (curChar == 0xE) { + } else if (curChar == MESSAGE_POINTS_TENS) { digits[0] = 0; digits[1] = gSaveContext.minigameScore; @@ -1401,7 +1450,7 @@ void Message_DecodeNES(PlayState* play) { } decodedBufPos--; - } else if (curChar == 0xF) { + } else if (curChar == MESSAGE_POINTS_THOUSANDS) { digits[0] = digits[1] = digits[2] = 0; digits[3] = gSaveContext.minigameScore; @@ -1429,12 +1478,12 @@ void Message_DecodeNES(PlayState* play) { } } decodedBufPos--; - } else if (curChar == 0xD0) { + } else if (curChar == MESSAGE_INPUT_DOGGY_RACETRACK_BET) { decodedBufPos++; msgCtx->unk120BE = spC6; msgCtx->unk120C0 = decodedBufPos; msgCtx->unk120C2 = 0; - msgCtx->bankRupeesSelected = 0; + msgCtx->rupeesSelected = 0; msgCtx->unk120C4 = charTexIndex; digits[0] = digits[1] = digits[2] = 0; for (i = 0; i < 2; i++) { @@ -1442,12 +1491,12 @@ void Message_DecodeNES(PlayState* play) { decodedBufPos++; } Message_LoadPluralRupeesNES(play, &decodedBufPos, &charTexIndex, &spA4); - } else if (curChar == 0xD1) { + } else if (curChar == MESSAGE_INPUT_BOMBER_CODE) { decodedBufPos++; msgCtx->unk120BE = spC6; msgCtx->unk120C0 = decodedBufPos; msgCtx->unk120C2 = 0; - msgCtx->bankRupeesSelected = 0; + msgCtx->rupeesSelected = 0; msgCtx->unk120C4 = charTexIndex; for (i = 0; i < 5; i++) { @@ -1456,7 +1505,7 @@ void Message_DecodeNES(PlayState* play) { decodedBufPos++; } decodedBufPos--; - } else if (curChar == 0xD3) { + } else if (curChar == MESSAGE_TIME_SPEED) { if (((void)0, gSaveContext.save.timeSpeedOffset) == 18) { index = 0; } else if (((void)0, gSaveContext.save.timeSpeedOffset) == 0) { @@ -1466,21 +1515,21 @@ void Message_DecodeNES(PlayState* play) { } for (i = 0; i < 4; i++, decodedBufPos++) { - msgCtx->decodedBuffer.schar[decodedBufPos] = D_801D08D8[index][i]; - Font_LoadCharNES(play, D_801D08D8[index][i], charTexIndex); + msgCtx->decodedBuffer.schar[decodedBufPos] = sTimeSpeedTextENG[index][i]; + Font_LoadCharNES(play, sTimeSpeedTextENG[index][i], charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; } decodedBufPos--; spA4 += 3.0f * (16.0f * msgCtx->textCharScale); msgCtx->choiceIndex = index; - } else if (curChar == 0xD4) { + } else if (curChar == MESSAGE_OWL_WARP) { Message_LoadOwlWarpTextNES(play, &charTexIndex, &spA4, &decodedBufPos); - } else if (curChar == 0xD5) { + } else if (curChar == MESSAGE_INPUT_LOTTERY_CODE) { decodedBufPos++; msgCtx->unk120BE = spC6; msgCtx->unk120C0 = decodedBufPos; msgCtx->unk120C2 = 0; - msgCtx->bankRupeesSelected = 0; + msgCtx->rupeesSelected = 0; msgCtx->unk120C4 = charTexIndex; for (i = 0; i < 3; i++) { @@ -1492,18 +1541,21 @@ void Message_DecodeNES(PlayState* play) { decodedBufPos++; } decodedBufPos--; - } else if (curChar == 0xD6) { - for (i = 0; i < 6; i++) { + } else if (curChar == MESSAGE_SPIDER_HOUSE_MASK_CODE) { + for (i = 0; i < ARRAY_COUNT(gSaveContext.save.saveInfo.spiderHouseMaskOrder); i++) { msgCtx->decodedBuffer.schar[decodedBufPos] = - D_801D08E4[((void)0, gSaveContext.save.saveInfo.spiderHouseMaskOrder[i])]; + sMaskCodeColorCmdENG[((void)0, gSaveContext.save.saveInfo.spiderHouseMaskOrder[i])]; decodedBufPos++; Message_LoadCharNES(play, i + '1', &charTexIndex, &spA4, decodedBufPos); decodedBufPos++; } - msgCtx->decodedBuffer.schar[decodedBufPos] = 0; - } else if ((curChar >= 0xD7) && (curChar < 0xDB)) { + msgCtx->decodedBuffer.schar[decodedBufPos] = MESSAGE_COLOR_DEFAULT; + } else if ((curChar >= MESSAGE_STRAY_FAIRIES_LEFT_WOODFALL) && + (curChar <= MESSAGE_STRAY_FAIRIES_LEFT_STONE_TOWER)) { digits[0] = digits[1] = 0; - digits[2] = STRAY_FAIRY_SCATTERED_TOTAL - gSaveContext.save.saveInfo.inventory.strayFairies[curChar - 0xD7]; + digits[2] = + STRAY_FAIRY_SCATTERED_TOTAL - + gSaveContext.save.saveInfo.inventory.strayFairies[curChar - MESSAGE_STRAY_FAIRIES_LEFT_WOODFALL]; while (digits[2] >= 100) { digits[0]++; @@ -1527,7 +1579,7 @@ void Message_DecodeNES(PlayState* play) { spA4 += 16.0f * msgCtx->textCharScale; } } - } else if (curChar == 0xDB) { + } else if (curChar == MESSAGE_POINTS_BOAT_ARCHERY) { digits[0] = digits[1] = digits[2] = 0; digits[3] = gSaveContext.minigameScore; @@ -1558,8 +1610,8 @@ void Message_DecodeNES(PlayState* play) { } } decodedBufPos--; - } else if ((curChar == 0xDC) || (curChar == 0xDD)) { - if (curChar == 0xDC) { + } else if ((curChar == MESSAGE_LOTTERY_CODE) || (curChar == MESSAGE_LOTTERY_CODE_GUESS)) { + if (curChar == MESSAGE_LOTTERY_CODE) { digits[0] = gSaveContext.save.saveInfo.lotteryCodes[CURRENT_DAY - 1][0]; digits[1] = gSaveContext.save.saveInfo.lotteryCodes[CURRENT_DAY - 1][1]; digits[2] = gSaveContext.save.saveInfo.lotteryCodes[CURRENT_DAY - 1][2]; @@ -1577,7 +1629,7 @@ void Message_DecodeNES(PlayState* play) { spA4 += 16.0f * msgCtx->textCharScale; } decodedBufPos--; - } else if (curChar == 0xDE) { + } else if (curChar == MESSAGE_HELD_ITEM_PRICE) { digits[0] = digits[1] = digits[2] = 0; // #region 2S2H [Dpad] if (IS_HELD_DPAD(player->heldItemButton)) { @@ -1614,7 +1666,7 @@ void Message_DecodeNES(PlayState* play) { } } Message_LoadPluralRupeesNES(play, &decodedBufPos, &charTexIndex, &spA4); - } else if (curChar == 0xDF) { + } else if (curChar == MESSAGE_BOMBER_CODE) { for (i = 0; i < 5; i++) { digits[i] = gSaveContext.save.saveInfo.bomberCode[i]; Font_LoadCharNES(play, digits[i] + '0', charTexIndex); @@ -1624,21 +1676,22 @@ void Message_DecodeNES(PlayState* play) { spA4 += 16.0f * msgCtx->textCharScale; } decodedBufPos--; - } else if ((curChar >= 0xE1) && (curChar < 0xE7)) { - msgCtx->decodedBuffer.schar[decodedBufPos++] = - D_801D08E4[((void)0, gSaveContext.save.saveInfo.spiderHouseMaskOrder[(s16)(curChar - 0xE1)])]; - index = sMaskCodeTextLengthENG[((void)0, - gSaveContext.save.saveInfo.spiderHouseMaskOrder[(s16)(curChar - 0xE1)])]; + } else if ((curChar >= MESSAGE_SPIDER_HOUSE_MASK_CODE_1) && (curChar <= MESSAGE_SPIDER_HOUSE_MASK_CODE_6)) { + msgCtx->decodedBuffer.schar[decodedBufPos++] = sMaskCodeColorCmdENG[( + (void)0, + gSaveContext.save.saveInfo.spiderHouseMaskOrder[(s16)(curChar - MESSAGE_SPIDER_HOUSE_MASK_CODE_1)])]; + index = sMaskCodeTextLengthENG[((void)0, gSaveContext.save.saveInfo.spiderHouseMaskOrder[( + s16)(curChar - MESSAGE_SPIDER_HOUSE_MASK_CODE_1)])]; for (playerNameLen = 0; playerNameLen < index; playerNameLen++, decodedBufPos++) { Message_LoadCharNES( play, - sMaskCodeTextENG[((void)0, gSaveContext.save.saveInfo.spiderHouseMaskOrder[(s16)(curChar - 0xE1)])] - [playerNameLen], + sMaskCodeTextENG[((void)0, gSaveContext.save.saveInfo.spiderHouseMaskOrder[( + s16)(curChar - MESSAGE_SPIDER_HOUSE_MASK_CODE_1)])][playerNameLen], &charTexIndex, &spA4, decodedBufPos); } msgCtx->decodedBuffer.schar[decodedBufPos] = 0; - } else if (curChar == 0xE7) { + } else if (curChar == MESSAGE_HOURS_UNTIL_MOON_CRASH) { timeToMoonCrash = TIME_UNTIL_MOON_CRASH; digits[0] = 0; digits[1] = TIME_TO_HOURS_F_ALT(timeToMoonCrash); @@ -1671,16 +1724,16 @@ void Message_DecodeNES(PlayState* play) { decodedBufPos++; Message_LoadCharNES(play, 's', &charTexIndex, &spA4, decodedBufPos); } - } else if (curChar == 0xE8) { + } else if (curChar == MESSAGE_TIME_UNTIL_NEW_DAY) { Message_LoadTimeNES(play, curChar, &charTexIndex, &spA4, &decodedBufPos); - - } else if ((curChar == 0xF0) || (curChar == 0xF1) || (curChar == 0xF2) || (curChar == 0xF8)) { - if (curChar == 0xF8) { + } else if ((curChar == MESSAGE_HS_POINTS_BANK_RUPEES) || (curChar == MESSAGE_HS_POINTS_UNK_1) || + (curChar == MESSAGE_HS_POINTS_FISHING) || (curChar == MESSAGE_HS_UNK_3_LOWER)) { + if (curChar == MESSAGE_HS_UNK_3_LOWER) { value = (s32)HS_GET_HIGH_SCORE_3_LOWER(); } else { - value = HIGH_SCORE(curChar - 0xF0); + value = HIGH_SCORE(curChar - MESSAGE_HS_POINTS_BANK_RUPEES); } - if (curChar == 0xF2) { + if (curChar == MESSAGE_HS_POINTS_FISHING) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { value &= 0x7F; } else { @@ -1717,16 +1770,19 @@ void Message_DecodeNES(PlayState* play) { } } decodedBufPos--; - } else if ((curChar == 0xF7) || (curChar == 0xF9) || (curChar == 0xFA) || (curChar == 0xFB) || - (curChar == 0xFC)) { + } else if ((curChar == MESSAGE_HS_UNK_1) || (curChar == MESSAGE_HS_HORSE_BACK_BALLOON) || + (curChar == MESSAGE_HS_DEKU_PLAYGROUND_DAY_1) || (curChar == MESSAGE_HS_DEKU_PLAYGROUND_DAY_2) || + (curChar == MESSAGE_HS_DEKU_PLAYGROUND_DAY_3)) { var_fs0 = 8.0f; - if (curChar == 0xF7) { + if (curChar == MESSAGE_HS_UNK_1) { Message_GetTimerDigitsNES(GET_HIGH_SCORE(HS_UNK_1), spA8); - } else if (curChar == 0xF9) { + } else if (curChar == MESSAGE_HS_HORSE_BACK_BALLOON) { Message_GetTimerDigitsNES(GET_HIGH_SCORE(HS_HORSE_BACK_BALLOON), spA8); } else { Message_GetTimerDigitsNES( - ((void)0, gSaveContext.save.saveInfo.dekuPlaygroundHighScores[curChar - 0xFA]), spA8); + ((void)0, + gSaveContext.save.saveInfo.dekuPlaygroundHighScores[curChar - MESSAGE_HS_DEKU_PLAYGROUND_DAY_1]), + spA8); } loadChar = false; @@ -1745,8 +1801,9 @@ void Message_DecodeNES(PlayState* play) { } spA4 += var_fs0 * (16.0f * msgCtx->textCharScale); decodedBufPos--; - } else if ((curChar == 0xF3) || (curChar == 0xF4) || (curChar == 0xF5)) { - value = HIGH_SCORE(curChar - 0xF3 + HS_BOAT_ARCHERY); + } else if ((curChar == MESSAGE_HS_TIME_BOAT_ARCHERY) || (curChar == MESSAGE_HS_TIME_HORSE_BACK_BALLOON) || + (curChar == MESSAGE_HS_TIME_LOTTERY_GUESS)) { + value = HIGH_SCORE(curChar - MESSAGE_HS_TIME_BOAT_ARCHERY + HS_BOAT_ARCHERY); digits[0] = digits[1] = digits[2] = 0; digits[3] = value; @@ -1774,13 +1831,13 @@ void Message_DecodeNES(PlayState* play) { msgCtx->decodedBuffer.schar[decodedBufPos] = '"'; decodedBufPos++; } else if (i == 3) { - Font_LoadCharNES(play, 0x27, charTexIndex); + Font_LoadCharNES(play, '\'', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.schar[decodedBufPos] = 0x27; + msgCtx->decodedBuffer.schar[decodedBufPos] = '\''; } } spA4 += 4.0f * (16.0f * msgCtx->textCharScale); - } else if (curChar == 0xF6) { + } else if (curChar == MESSAGE_HS_TOWN_SHOOTING_GALLERY) { digits[0] = digits[1] = digits[2] = 0; digits[3] = HS_GET_TOWN_SHOOTING_GALLERY_HIGH_SCORE(); @@ -1811,8 +1868,9 @@ void Message_DecodeNES(PlayState* play) { } } decodedBufPos--; - } else if ((curChar == 0xFD) || (curChar == 0xFE) || (curChar == 0xFF)) { - index = curChar - 0xFD; + } else if ((curChar == MESSAGE_DEKU_PLAYGROUND_NAME_DAY_1) || (curChar == MESSAGE_DEKU_PLAYGROUND_NAME_DAY_2) || + (curChar == MESSAGE_DEKU_PLAYGROUND_NAME_DAY_3)) { + index = curChar - MESSAGE_DEKU_PLAYGROUND_NAME_DAY_1; for (playerNameLen = 8; playerNameLen > 0; playerNameLen--) { if (((void)0, gSaveContext.save.saveInfo.inventory.dekuPlaygroundPlayerName[index][playerNameLen - 1]) != 0x3E) { @@ -1835,7 +1893,7 @@ void Message_DecodeNES(PlayState* play) { } decodedBufPos += playerNameLen - 1; spA4 += playerNameLen * (16.0f * msgCtx->textCharScale); - } else if (curChar == 0xB) { + } else if (curChar == MESSAGE_HS_BOAT_ARCHERY) { digits[0] = digits[1] = digits[2] = 0; digits[3] = HS_GET_BOAT_ARCHERY_HIGH_SCORE(); @@ -1866,32 +1924,33 @@ void Message_DecodeNES(PlayState* play) { } } decodedBufPos--; - } else if (curChar == 0x14) { + } else if (curChar == MESSAGE_SHIFT) { decodedBufPos--; for (i = 0; i < font->msgBuf.schar[msgCtx->msgBufPos + 1]; i++) { msgCtx->decodedBuffer.schar[++decodedBufPos] = ' '; spA4 += 6.0f; } msgCtx->msgBufPos++; - } else if ((curChar == 0x13) || (curChar == 0x11)) { + } else if ((curChar == MESSAGE_CARRIAGE_RETURN) || (curChar == MESSAGE_NEWLINE)) { msgCtx->unk11F1A[spC6] = 0; if (msgCtx->unk11F18 != 0) { msgCtx->unk11F1A[spC6] = ((msgCtx->textCharScale * 16.0f * 16.0f) - spA4) * 0.5f; } spC6++; spA4 = 0.0f; - if (curChar == 0x11) { + if (curChar == MESSAGE_NEWLINE) { numLines++; } - } else if ((curChar == 0x17) || (curChar == 0x18) || (curChar == 0x1A)) { + } else if ((curChar == MESSAGE_QUICKTEXT_ENABLE) || (curChar == MESSAGE_QUICKTEXT_DISABLE) || + (curChar == MESSAGE_PERSISTENT)) { // pass - } else if (curChar == 0xA) { + } else if (curChar == MESSAGE_TEXT_SPEED) { // Next decoded char is always 0 decodedBufPos++; - } else if (curChar == 0x1C) { + } else if (curChar == MESSAGE_FADE) { // This cannot be reached msgCtx->textFade = true; msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos] & 0xFF; msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos] & 0xFF; - } else if (curChar == 0x1E) { + } else if (curChar == MESSAGE_SFX) { msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos]; msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos]; if (msgCtx->textboxSkipped || (msgCtx->textBoxType == TEXTBOX_TYPE_1) || @@ -1902,14 +1961,14 @@ void Message_DecodeNES(PlayState* play) { sfxHi += (uint8_t)msgCtx->decodedBuffer.schar[decodedBufPos]; Audio_PlaySfx(sfxHi); } - } else if (curChar == 0x1F) { + } else if (curChar == MESSAGE_DELAY) { msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos]; msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos]; - } else if ((curChar != 0x20) && (curChar >= 9)) { + } else if ((curChar != ' ') && (curChar >= 9)) { Font_LoadCharNES(play, curChar, charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; spA4 += sNESFontWidths[curChar - ' '] * msgCtx->textCharScale; - } else if (curChar == 0x20) { + } else if (curChar == ' ') { spA4 += 6.0f; } decodedBufPos++; diff --git a/mm/src/code/z_message_staff.c b/mm/src/code/z_message_staff.c index 4513f3e2c..02954c2e5 100644 --- a/mm/src/code/z_message_staff.c +++ b/mm/src/code/z_message_staff.c @@ -1,11 +1,12 @@ #include "global.h" +#include "message_data_fmt_staff.h" #include "message_data_static.h" #include "assets/interface/message_texture_static/message_texture_static.h" void Message_FindCreditsMessage(PlayState* play, u16 textId) { MessageContext* msgCtx = &play->msgCtx; Font* font = &msgCtx->font; - MessageTableEntry* msgEntry = msgCtx->messageTableStaff; + MessageTableEntry* msgEntry = msgCtx->messageTableCredits; const char* segment = msgEntry->segment; const char* foundSegment; const char* nextSegment; @@ -64,7 +65,7 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { character = msgCtx->decodedBuffer.schar[i]; switch (character) { - case 0x1: // MESSAGE_NEWLINE + case MESSAGE_NEWLINE: msgCtx->textPosX = msgCtx->unk11FF8; if ((msgCtx->choiceNum == 1) || (msgCtx->choiceNum == 3)) { msgCtx->textPosX += 32; @@ -75,14 +76,14 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { msgCtx->textPosY += msgCtx->unk11FFC; break; - case 0x5: // Remnant of MESSAGE_COLOR + case MESSAGE_COLOR: break; case ' ': msgCtx->textPosX += 6; break; - case 0x4: // MESSAGE_BOX_BREAK + case MESSAGE_BOX_BREAK: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { if (!msgCtx->textboxSkipped) { Audio_PlaySfx(NA_SE_NONE); @@ -97,12 +98,12 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { *gfxP = gfx; return; - case 0x6: // MESSAGE_SHIFT + case MESSAGE_SHIFT: msgCtx->textPosX += msgCtx->decodedBuffer.schar[++i]; break; - case 0x7: // MESSAGE_TEXTID - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_20; + case MESSAGE_TEXTID: + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_NEXT; if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Audio_PlaySfx(NA_SE_NONE); msgCtx->msgMode = MSGMODE_TEXT_DONE; @@ -111,7 +112,7 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { *gfxP = gfx; return; - case 0x8: // MESSAGE_QUICKTEXT_ENABLE + case MESSAGE_QUICKTEXT_ENABLE: if (((i + 1) == msgCtx->textDrawPos) && ((msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) || ((msgCtx->msgMode >= MSGMODE_OCARINA_STARTING) && (msgCtx->msgMode <= MSGMODE_26)))) { @@ -122,8 +123,10 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { j += 2; continue; } - if ((character != 9) && (character != 0xA) && (character != 0xB) && (character != 0xC) && - (character != 0xD) && (character != 4) && (character != 2)) { + 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++; continue; } @@ -133,10 +136,10 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { msgCtx->textDrawPos = i + 1; } // fallthrough - case 0x9: // MESSAGE_QUICKTEXT_DISABLE + case MESSAGE_QUICKTEXT_DISABLE: break; - case 0xD: // MESSAGE_AWAIT_BUTTON_PRESS + case MESSAGE_AWAIT_BUTTON_PRESS: if ((i + 1) == msgCtx->textDrawPos) { if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_AWAIT_INPUT; @@ -147,7 +150,7 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { } break; - case 0xC: // MESSAGE_BOX_BREAK_DELAYED + case MESSAGE_BOX_BREAK_DELAYED: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->stateTimer = msgCtx->decodedBuffer.schar[++i]; msgCtx->msgMode = MSGMODE_TEXT_DELAYED_BREAK; @@ -155,17 +158,17 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { *gfxP = gfx; return; - case 0x11: // MESSAGE_FADE2 + case MESSAGE_FADE2: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_50; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_FADE_NORMAL; msgCtx->stateTimer = msgCtx->decodedBuffer.schar[++i] << 8; msgCtx->stateTimer |= msgCtx->decodedBuffer.schar[++i]; } *gfxP = gfx; return; - case 0x12: // MESSAGE_SFX + case MESSAGE_SFX: if ((msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) && !msgCtx->messageHasSetSfx) { msgCtx->messageHasSetSfx = true; sfxHi = msgCtx->decodedBuffer.schar[i + 1]; @@ -175,10 +178,10 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { i += 2; break; - case 0x13: // remnant of MESSAGE_ITEM_ICON + case MESSAGE_ITEM_ICON: break; - case 0x15: // MESSAGE_BACKGROUND + case MESSAGE_BACKGROUND: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Audio_PlaySfx(NA_SE_NONE); } @@ -190,14 +193,14 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSPTextureRectangle(gfx++, (msgCtx->textPosX + 1) << 2, (msgCtx->unk12012 + 1) << 2, - (msgCtx->textPosX + 0x61) << 2, (msgCtx->unk12012 + 0x31) << 2, G_TX_RENDERTILE, 0, - 0, 1 << 10, 1 << 10); + (msgCtx->textPosX + 97) << 2, (msgCtx->unk12012 + 49) << 2, G_TX_RENDERTILE, 0, 0, + 1 << 10, 1 << 10); gDPLoadTextureBlock_4b(gfx++, msgCtx->textboxSegment[TEXTBOX_SEG_BG_2], G_IM_FMT_I, 96, 48, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfx++, (msgCtx->textPosX + 0x61) << 2, (msgCtx->unk12012 + 1) << 2, - (msgCtx->textPosX + 0xC2) << 2, (msgCtx->unk12012 + 0x31) << 2, 0, 0, 0, 1 << 10, + gSPTextureRectangle(gfx++, (msgCtx->textPosX + 97) << 2, (msgCtx->unk12012 + 1) << 2, + (msgCtx->textPosX + 194) << 2, (msgCtx->unk12012 + 49) << 2, 0, 0, 0, 1 << 10, 1 << 10); gDPPipeSync(gfx++); @@ -205,30 +208,30 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { gDPLoadTextureBlock_4b(gfx++, msgCtx->textboxSegment[TEXTBOX_SEG_BG_1], G_IM_FMT_I, 96, 48, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfx++, msgCtx->textPosX << 2, msgCtx->unk12012 << 2, (msgCtx->textPosX + 0x60) << 2, - (msgCtx->unk12012 + 0x30) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + gSPTextureRectangle(gfx++, msgCtx->textPosX << 2, msgCtx->unk12012 << 2, (msgCtx->textPosX + 96) << 2, + (msgCtx->unk12012 + 48) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); gDPLoadTextureBlock_4b(gfx++, msgCtx->textboxSegment[TEXTBOX_SEG_BG_2], G_IM_FMT_I, 96, 48, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfx++, (msgCtx->textPosX + 0x60) << 2, msgCtx->unk12012 << 2, - (msgCtx->textPosX + 0xC0) << 2, (msgCtx->unk12012 + 0x30) << 2, G_TX_RENDERTILE, 0, - 0, 1 << 10, 1 << 10); + gSPTextureRectangle(gfx++, (msgCtx->textPosX + 96) << 2, msgCtx->unk12012 << 2, + (msgCtx->textPosX + 192) << 2, (msgCtx->unk12012 + 48) << 2, G_TX_RENDERTILE, 0, 0, + 1 << 10, 1 << 10); gDPPipeSync(gfx++); gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); - msgCtx->textPosX += 0x20; + msgCtx->textPosX += 32; break; - case 0x14: // MESSAGE_TEXT_SPEED + case MESSAGE_TEXT_SPEED: msgCtx->textDelay = msgCtx->decodedBuffer.schar[++i]; break; - case 0x1A: // MESSAGE_UNSKIPPABLE + case MESSAGE_UNSKIPPABLE: msgCtx->textUnskippable = true; break; - case 0x1B: // MESSAGE_TWO_CHOICE - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_10; + case MESSAGE_TWO_CHOICE: + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_TWO_CHOICE; if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->choiceTextId = msgCtx->currentTextId; msgCtx->stateTimer = 4; @@ -237,8 +240,8 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { } break; - case 0x1C: // MESSAGE_THREE_CHOICE - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_11; + case MESSAGE_THREE_CHOICE: + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_THREE_CHOICE; if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->choiceTextId = msgCtx->currentTextId; msgCtx->stateTimer = 4; @@ -247,10 +250,10 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { } break; - case 0x2: // MESSAGE_END + case MESSAGE_END: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; - if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_00) { + if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_DEFAULT) { Audio_PlaySfx(NA_SE_SY_MESSAGE_END); Font_LoadMessageBoxEndIcon(font, 1); if (play->csCtx.state == CS_STATE_IDLE) { @@ -261,7 +264,7 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { *gfxP = gfx; return; - case 0x10: // MESSAGE_OCARINA + case MESSAGE_OCARINA: if ((i + 1) == msgCtx->textDrawPos) { Message_HandleOcarina(play); *gfxP = gfx; @@ -269,10 +272,10 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { } break; - case 0xE: // MESSAGE_FADE + case MESSAGE_FADE: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_50; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_FADE_NORMAL; msgCtx->stateTimer = msgCtx->decodedBuffer.schar[++i]; Font_LoadMessageBoxEndIcon(font, 1); if (play->csCtx.state == CS_STATE_IDLE) { @@ -282,19 +285,19 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) { *gfxP = gfx; return; - case 0xA: // MESSAGE_PERSISTENT + case MESSAGE_PERSISTENT: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Audio_PlaySfx(NA_SE_NONE); msgCtx->msgMode = MSGMODE_TEXT_DONE; - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_30; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_PERSISTENT; } *gfxP = gfx; return; - case 0xB: // MESSAGE_EVENT + case MESSAGE_EVENT: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { msgCtx->msgMode = MSGMODE_TEXT_DONE; - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_40; + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_EVENT; Font_LoadMessageBoxEndIcon(font, 0); Audio_PlaySfx(NA_SE_SY_MESSAGE_END); } @@ -345,7 +348,8 @@ void Message_DecodeCredits(PlayState* play) { curChar = font->msgBuf.schar[msgCtx->msgBufPos]; msgCtx->decodedBuffer.schar[decodedBufPos] = font->msgBuf.schar[msgCtx->msgBufPos]; - if ((curChar == 4) || (curChar == 7) || (curChar == 0xC) || (curChar == 0xB) || (curChar == 2)) { + if ((curChar == MESSAGE_BOX_BREAK) || (curChar == MESSAGE_TEXTID) || (curChar == MESSAGE_BOX_BREAK_DELAYED) || + (curChar == MESSAGE_EVENT) || (curChar == MESSAGE_END)) { // Textbox decoding ends with any of the above text control characters msgCtx->msgMode = MSGMODE_TEXT_DISPLAYING; msgCtx->textDrawPos = 1; @@ -361,7 +365,7 @@ void Message_DecodeCredits(PlayState* play) { } } - if (curChar == 7) { + if (curChar == MESSAGE_TEXTID) { value = font->msgBuf.schar[msgCtx->msgBufPos + 1]; msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[msgCtx->msgBufPos + 1]; msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[msgCtx->msgBufPos + 2]; @@ -369,7 +373,7 @@ void Message_DecodeCredits(PlayState* play) { msgCtx->nextTextId = msgCtx->decodedBuffer.schar[decodedBufPos] | value; } - if (curChar == 0xC) { + if (curChar == MESSAGE_BOX_BREAK_DELAYED) { msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[msgCtx->msgBufPos + 1]; msgCtx->msgBufPos += 2; } @@ -380,7 +384,7 @@ void Message_DecodeCredits(PlayState* play) { msgCtx->textDrawPos = msgCtx->decodedTextLen; } break; - } else if (curChar == 0xF) { + } else if (curChar == MESSAGE_NAME) { // Substitute the player name control character for the file's player name. for (playerNameLen = ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.playerName); playerNameLen > 0; playerNameLen--) { @@ -416,7 +420,7 @@ void Message_DecodeCredits(PlayState* play) { decodedBufPos++; } decodedBufPos--; - } else if ((curChar == 0x16) || (curChar == 0x17)) { + } else if ((curChar == MESSAGE_MARATHON_TIME) || (curChar == MESSAGE_RACE_TIME)) { digits[0] = digits[1] = digits[2] = 0; if (curChar == 0x17) { digits[3] = gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2]; @@ -455,7 +459,7 @@ void Message_DecodeCredits(PlayState* play) { } } - } else if (curChar == 0x18) { + } else if (curChar == MESSAGE_POINTS) { digits[0] = digits[1] = digits[2] = 0; digits[3] = gSaveContext.minigameScore; @@ -485,8 +489,8 @@ void Message_DecodeCredits(PlayState* play) { } } decodedBufPos--; - } else if (curChar != 0x19) { - if (curChar == 0x1D) { + } else if (curChar != MESSAGE_TOKENS) { + if (curChar == MESSAGE_FISH_INFO) { digits[0] = 0; digits[1] = gSaveContext.minigameScore; @@ -504,7 +508,7 @@ void Message_DecodeCredits(PlayState* play) { } } decodedBufPos--; - } else if (curChar == 0x1E) { + } else if (curChar == MESSAGE_HIGHSCORE) { value = HIGH_SCORE((u8)font->msgBuf.schar[++msgCtx->msgBufPos]); if ((font->msgBuf.schar[msgCtx->msgBufPos] & 0xFF) == HS_FISHING) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { @@ -516,9 +520,9 @@ void Message_DecodeCredits(PlayState* play) { value = SQ((f32)value) * 0.0036f + 0.5f; } switch (font->msgBuf.schar[msgCtx->msgBufPos] & 0xFF) { - case 0: - case 1: - case 2: + case HS_BANK_RUPEES: + case HS_UNK_1: + case HS_FISHING: digits[0] = digits[1] = digits[2] = 0; digits[3] = value; @@ -550,9 +554,9 @@ void Message_DecodeCredits(PlayState* play) { decodedBufPos--; break; - case 3: - case 4: - case 6: + case HS_BOAT_ARCHERY: + case HS_HORSE_BACK_BALLOON: + case HS_SHOOTING_GALLERY: digits[0] = digits[1] = digits[2] = 0; digits[3] = value; @@ -590,7 +594,7 @@ void Message_DecodeCredits(PlayState* play) { default: break; } - } else if (curChar == 0x1F) { + } else if (curChar == MESSAGE_TIME) { digits[0] = 0; timeInSeconds = TIME_TO_MINUTES_F(CURRENT_TIME); @@ -621,10 +625,10 @@ void Message_DecodeCredits(PlayState* play) { } decodedBufPos--; - } else if (curChar == 0x13) { + } else if (curChar == MESSAGE_ITEM_ICON) { msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[msgCtx->msgBufPos + 1]; Message_LoadItemIcon(play, font->msgBuf.schar[msgCtx->msgBufPos + 1], msgCtx->textboxY + 10); - } else if (curChar == 0x15) { + } else if (curChar == MESSAGE_BACKGROUND) { // #region 2S2H [Port] // DmaMgr_SendRequest0(msgCtx->textboxSegment + 0x1000, // (uintptr_t)SEGMENT_ROM_START(message_texture_static) + 0x900, 0x900); @@ -636,27 +640,28 @@ void Message_DecodeCredits(PlayState* play) { msgCtx->msgBufPos += 3; msgCtx->unk12012 = msgCtx->textboxY + 8; numLines = 2; - } else if (curChar == 5) { + } else if (curChar == MESSAGE_COLOR) { msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos]; - } else if (curChar == 1) { + } else if (curChar == MESSAGE_NEWLINE) { numLines++; - } else if ((curChar != 8) && (curChar != 9) && (curChar != 0xD) && (curChar != 0x10) && (curChar != 0xA) && - (curChar != 0x1A)) { - if (curChar == 0xE) { + } else if ((curChar != MESSAGE_QUICKTEXT_ENABLE) && (curChar != MESSAGE_QUICKTEXT_DISABLE) && + (curChar != MESSAGE_AWAIT_BUTTON_PRESS) && (curChar != MESSAGE_OCARINA) && + (curChar != MESSAGE_PERSISTENT) && (curChar != MESSAGE_UNSKIPPABLE)) { + if (curChar == MESSAGE_FADE) { msgCtx->textFade = true; msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos]; - } else if (curChar == 0x11) { + } else if (curChar == MESSAGE_FADE2) { msgCtx->textFade = true; msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos]; msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos]; - } else if ((curChar == 6) || (curChar == 0x14)) { + } else if ((curChar == MESSAGE_SHIFT) || (curChar == MESSAGE_TEXT_SPEED)) { msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos] & 0xFF; - } else if (curChar == 0x12) { + } else if (curChar == MESSAGE_SFX) { msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos]; msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos]; - } else if (curChar == 0x1B) { + } else if (curChar == MESSAGE_TWO_CHOICE) { msgCtx->choiceNum = 2; - } else if (curChar == 0x1C) { + } else if (curChar == MESSAGE_THREE_CHOICE) { msgCtx->choiceNum = 3; } else if (curChar != ' ') { Font_LoadCharNES(play, curChar, charTexIdx); diff --git a/mm/src/code/z_play.c b/mm/src/code/z_play.c index 73af145b0..789e55c98 100644 --- a/mm/src/code/z_play.c +++ b/mm/src/code/z_play.c @@ -1012,7 +1012,7 @@ void Play_UpdateMain(PlayState* this) { if (((gSaveContext.gameMode == GAMEMODE_NORMAL) && (((this->msgCtx.msgMode == MSGMODE_NONE) || (((this->msgCtx.currentTextId == 0xFF) && (this->msgCtx.msgMode == MSGMODE_TEXT_DONE)) && - (this->msgCtx.textboxEndType == TEXTBOX_ENDTYPE_41))) || + (this->msgCtx.textboxEndType == TEXTBOX_ENDTYPE_PAUSE_MENU))) || ((this->msgCtx.currentTextId >= 0x100) && (this->msgCtx.currentTextId <= 0x200)))) && (this->gameOverCtx.state == GAMEOVER_INACTIVE)) { KaleidoSetup_Update(this); |
