diff options
| author | mckinlee <mckinlee@ymail.com> | 2025-12-30 09:20:44 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-30 09:20:44 -0500 |
| commit | 14902f06c46b51e76aed63214fcc481dba5fd953 (patch) | |
| tree | 1d3e37b999b7040985558a3440122b9b883b6275 /mm/src/code | |
| parent | f117e7384700ad217bfd13db77234b05daf041f4 (diff) | |
[Enhancement] Ammo Buyback (#1407)
* initial implementation
* feedback
* feedback 2
Diffstat (limited to 'mm/src/code')
| -rw-r--r-- | mm/src/code/z_message.c | 40 | ||||
| -rw-r--r-- | mm/src/code/z_message_nes.c | 22 |
2 files changed, 47 insertions, 15 deletions
diff --git a/mm/src/code/z_message.c b/mm/src/code/z_message.c index 4ce98b5bd..0be1e96e8 100644 --- a/mm/src/code/z_message.c +++ b/mm/src/code/z_message.c @@ -688,7 +688,9 @@ void func_80148D64(PlayState* play) { } Font_LoadCharNES(play, msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + msgCtx->unk120C2], msgCtx->unk120C4 + (msgCtx->unk120C2 << 7)); - Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + if (GameInteractor_Should(VB_MSG_PLAY_INPUT_COUNT_SOUND, true)) { + Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + } } else if (msgCtx->stickAdjY >= 30) { msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + msgCtx->unk120C2]++; if (msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + msgCtx->unk120C2] > '9') { @@ -696,7 +698,9 @@ void func_80148D64(PlayState* play) { } Font_LoadCharNES(play, msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + msgCtx->unk120C2], msgCtx->unk120C4 + (msgCtx->unk120C2 << 7)); - Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + if (GameInteractor_Should(VB_MSG_PLAY_INPUT_COUNT_SOUND, true)) { + Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + } } else if ((msgCtx->stickAdjX >= 30) && !sAnalogStickHeld) { sAnalogStickHeld = true; msgCtx->unk120C2++; @@ -732,7 +736,9 @@ void func_80149048(PlayState* play) { } Font_LoadCharNES(play, msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + msgCtx->unk120C2], msgCtx->unk120C4 + (msgCtx->unk120C2 << 7)); - Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + if (GameInteractor_Should(VB_MSG_PLAY_INPUT_COUNT_SOUND, true)) { + Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + } } else if (msgCtx->stickAdjY >= 30) { msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + msgCtx->unk120C2]++; if (msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + msgCtx->unk120C2] > '9') { @@ -740,7 +746,9 @@ void func_80149048(PlayState* play) { } Font_LoadCharNES(play, msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + msgCtx->unk120C2], msgCtx->unk120C4 + (msgCtx->unk120C2 << 7)); - Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + if (GameInteractor_Should(VB_MSG_PLAY_INPUT_COUNT_SOUND, true)) { + Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + } } msgCtx->rupeesSelected = (msgCtx->decodedBuffer.schar[msgCtx->unk120C0] - '0') * 10; @@ -758,7 +766,9 @@ void func_801491DC(PlayState* play) { msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + msgCtx->unk120C2] = msgCtx->unk12054[msgCtx->unk120C2] + '0'; Font_LoadCharNES(play, msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + msgCtx->unk120C2], msgCtx->unk120C4 + (msgCtx->unk120C2 << 7)); - Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + if (GameInteractor_Should(VB_MSG_PLAY_INPUT_COUNT_SOUND, true)) { + Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + } } else if (msgCtx->stickAdjY >= 30) { msgCtx->unk12054[msgCtx->unk120C2]++; if (msgCtx->unk12054[msgCtx->unk120C2] > 5) { @@ -767,7 +777,9 @@ void func_801491DC(PlayState* play) { msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + msgCtx->unk120C2] = msgCtx->unk12054[msgCtx->unk120C2] + '0'; Font_LoadCharNES(play, msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + msgCtx->unk120C2], msgCtx->unk120C4 + (msgCtx->unk120C2 << 7)); - Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + if (GameInteractor_Should(VB_MSG_PLAY_INPUT_COUNT_SOUND, true)) { + Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + } } else if ((msgCtx->stickAdjX >= 30) && !sAnalogStickHeld) { sAnalogStickHeld = true; msgCtx->unk120C2++; @@ -801,7 +813,9 @@ void func_80149454(PlayState* play) { msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + msgCtx->unk120C2] = msgCtx->unk12054[msgCtx->unk120C2] + '0'; Font_LoadCharNES(play, msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + msgCtx->unk120C2], msgCtx->unk120C4 + (msgCtx->unk120C2 << 7)); - Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + if (GameInteractor_Should(VB_MSG_PLAY_INPUT_COUNT_SOUND, true)) { + Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + } } else if (msgCtx->stickAdjY >= 30) { msgCtx->unk12054[msgCtx->unk120C2]++; if (msgCtx->unk12054[msgCtx->unk120C2] > 9) { @@ -810,7 +824,9 @@ void func_80149454(PlayState* play) { msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + msgCtx->unk120C2] = msgCtx->unk12054[msgCtx->unk120C2] + '0'; Font_LoadCharNES(play, msgCtx->decodedBuffer.schar[msgCtx->unk120C0 + msgCtx->unk120C2], msgCtx->unk120C4 + (msgCtx->unk120C2 << 7)); - Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + if (GameInteractor_Should(VB_MSG_PLAY_INPUT_COUNT_SOUND, true)) { + Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + } } else if ((msgCtx->stickAdjX >= 30) && !sAnalogStickHeld) { sAnalogStickHeld = true; msgCtx->unk120C2++; @@ -844,7 +860,9 @@ void func_801496C8(PlayState* play) { msgCtx->decodedBuffer.wchar[msgCtx->unk120C0 + msgCtx->unk120C2] = msgCtx->unk12054[msgCtx->unk120C2] + 0x824F; Font_LoadChar(play, msgCtx->decodedBuffer.wchar[msgCtx->unk120C0 + msgCtx->unk120C2], msgCtx->unk120C4 + (msgCtx->unk120C2 << 7)); - Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + if (GameInteractor_Should(VB_MSG_PLAY_INPUT_COUNT_SOUND, true)) { + Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + } } else if (msgCtx->stickAdjY >= 30) { msgCtx->unk12054[msgCtx->unk120C2]++; if (msgCtx->unk12054[msgCtx->unk120C2] >= 4) { @@ -853,7 +871,9 @@ void func_801496C8(PlayState* play) { msgCtx->decodedBuffer.wchar[msgCtx->unk120C0 + msgCtx->unk120C2] = msgCtx->unk12054[msgCtx->unk120C2] + 0x824F; Font_LoadChar(play, msgCtx->decodedBuffer.wchar[msgCtx->unk120C0 + msgCtx->unk120C2], msgCtx->unk120C4 + (msgCtx->unk120C2 << 7)); - Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + if (GameInteractor_Should(VB_MSG_PLAY_INPUT_COUNT_SOUND, true)) { + Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); + } } else if ((msgCtx->stickAdjX >= 30) && !sAnalogStickHeld) { sAnalogStickHeld = true; msgCtx->unk120C2++; diff --git a/mm/src/code/z_message_nes.c b/mm/src/code/z_message_nes.c index 3cdd9a5fb..79f6e7477 100644 --- a/mm/src/code/z_message_nes.c +++ b/mm/src/code/z_message_nes.c @@ -4,6 +4,7 @@ #include "assets/interface/message_texture_static/message_texture_static.h" #include <stdio.h> #include <libultraship/bridge/consolevariablebridge.h> +#include "2s2h/GameInteractor/GameInteractor.h" f32 sNESFontWidths[160] = { 8.0f, 8.0f, 6.0f, 9.0f, 9.0f, 14.0f, 12.0f, 3.0f, 7.0f, 7.0f, 7.0f, 9.0f, 4.0f, 6.0f, 4.0f, 9.0f, @@ -1291,7 +1292,9 @@ void Message_DecodeNES(PlayState* play) { Message_LoadCharNES(play, digits[i] + '0', &charTexIndex, &spA4, decodedBufPos); decodedBufPos++; } - Message_LoadLocalizedRupeesNES(play, &decodedBufPos, &charTexIndex, &spA4); + if (GameInteractor_Should(VB_MSG_LOAD_RUPEES_TEXT, true)) { + Message_LoadLocalizedRupeesNES(play, &decodedBufPos, &charTexIndex, &spA4); + } } else if (curChar == MESSAGE_RUPEES_SELECTED) { digits[0] = digits[1] = 0; digits[2] = msgCtx->rupeesSelected; @@ -1316,7 +1319,9 @@ void Message_DecodeNES(PlayState* play) { decodedBufPos++; } } - Message_LoadRupeesNES(play, &decodedBufPos, &charTexIndex, &spA4, msgCtx->rupeesSelected); + if (GameInteractor_Should(VB_MSG_LOAD_RUPEES_TEXT, true)) { + Message_LoadRupeesNES(play, &decodedBufPos, &charTexIndex, &spA4, msgCtx->rupeesSelected); + } } else if (curChar == MESSAGE_RUPEES_TOTAL) { digits[0] = digits[1] = digits[2] = 0; digits[3] = msgCtx->rupeesTotal; @@ -1344,7 +1349,9 @@ void Message_DecodeNES(PlayState* play) { decodedBufPos++; } } - Message_LoadRupeesNES(play, &decodedBufPos, &charTexIndex, &spA4, msgCtx->rupeesTotal); + if (GameInteractor_Should(VB_MSG_LOAD_RUPEES_TEXT, true)) { + 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 == MESSAGE_STRAY_FAIRIES) { @@ -1499,7 +1506,10 @@ void Message_DecodeNES(PlayState* play) { Message_LoadCharNES(play, digits[i] + '0', &charTexIndex, &spA4, decodedBufPos); decodedBufPos++; } - Message_LoadPluralRupeesNES(play, &decodedBufPos, &charTexIndex, &spA4); + if (GameInteractor_Should(VB_MSG_LOAD_RUPEES_TEXT, true)) { + Message_LoadPluralRupeesNES(play, &decodedBufPos, &charTexIndex, &spA4); + } + } else if (curChar == MESSAGE_INPUT_BOMBER_CODE) { decodedBufPos++; msgCtx->unk120BE = spC6; @@ -1674,7 +1684,9 @@ void Message_DecodeNES(PlayState* play) { spA4 += 16.0f * msgCtx->textCharScale; } } - Message_LoadPluralRupeesNES(play, &decodedBufPos, &charTexIndex, &spA4); + if (GameInteractor_Should(VB_MSG_LOAD_RUPEES_TEXT, true)) { + Message_LoadPluralRupeesNES(play, &decodedBufPos, &charTexIndex, &spA4); + } } else if (curChar == MESSAGE_BOMBER_CODE) { for (i = 0; i < 5; i++) { //! @bug OoB read & write for i == 4, digits array is only 4 elements |
