From 5e96bdeba5ed88ed8cb2d4dfdefe8f9314f7c46e Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Tue, 9 Jan 2024 17:47:15 +0000 Subject: [PATCH] Various changes/fixes to z_parameter (#7) --- mm/include/z64interface.h | 23 +- mm/src/code/stubs.c | 147 ----------- mm/src/code/z_message.c | 6 +- mm/src/code/z_parameter.c | 243 ++++++++++-------- .../ovl_kaleido_scope/z_kaleido_item.c | 18 +- .../ovl_kaleido_scope/z_kaleido_scope_NES.c | 9 +- 6 files changed, 163 insertions(+), 283 deletions(-) diff --git a/mm/include/z64interface.h b/mm/include/z64interface.h index 401ab72af..d6b65f96b 100644 --- a/mm/include/z64interface.h +++ b/mm/include/z64interface.h @@ -10,7 +10,8 @@ typedef enum { /* 1 */ EQUIP_SLOT_C_LEFT, /* 2 */ EQUIP_SLOT_C_DOWN, /* 3 */ EQUIP_SLOT_C_RIGHT, - /* 4 */ EQUIP_SLOT_A + /* 4 */ EQUIP_SLOT_A, + /* 5 */ EQUIP_SLOT_MAX } EquipSlot; typedef enum { @@ -127,16 +128,12 @@ typedef enum { } StoryType; typedef enum { - /* 0 */ A_BUTTON_ACTION, - /* 1 */ B_BUTTON_ACTION, - /* 2 */ START_BUTTON_ACTION, - /* 3 */ CLOCK_TIMER -} ActionBtn; - -typedef enum { - /* 0 */ ACTION_MAIN, - /* 1 */ ACTION_SUB -} ActionType; + /* 0 */ DO_ACTION_SEG_A, + /* 1 */ DO_ACTION_SEG_B, + /* 2 */ DO_ACTION_SEG_START, + /* 3 */ DO_ACTION_SEG_CLOCK, + /* 4 */ DO_ACTION_SEG_MAX +} DoActionSegmentIndex; typedef struct { char* mainTex; @@ -149,7 +146,7 @@ typedef struct { /* 0x16C */ Vtx* beatingHeartVtx; /* 0x170 */ u8* parameterSegment; /* 0x174 */ ActionLabel* doActionSegment; - /* 0x178 */ u8* iconItemSegment; + /* 0x178 */ char** iconItemSegment; /* 0x17C */ u8* mapSegment; /* 0x180 */ u8* unk_180; // unused segment? /* 0x184 */ DmaRequest dmaRequest; @@ -272,7 +269,7 @@ void Inventory_UpdateItem(struct PlayState* play, s16 slot, s16 item); void Interface_SetAButtonDoAction(struct PlayState* play, u16 aButtonDoAction); void Interface_SetBButtonDoAction(struct PlayState* play, s16 bButtonDoAction); void Interface_SetTatlCall(struct PlayState* play, u16 tatlCallState); -void Interface_LoadButtonDoActionLabel(struct PlayState* play, s16 doAction, s16 button, s16 state); +void Interface_LoadBButtonDoActionLabel(struct PlayState* play, s16 bButtonDoAction); s32 Health_ChangeBy(struct PlayState* play, s16 healthChange); void Health_GiveHearts(s16 hearts); void Rupees_ChangeBy(s16 rupeeChange); diff --git a/mm/src/code/stubs.c b/mm/src/code/stubs.c index 8927089d9..990f399d7 100644 --- a/mm/src/code/stubs.c +++ b/mm/src/code/stubs.c @@ -153,153 +153,6 @@ TexturePtr gCircleTex[] = { 0x000005CF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, }; -u8 gPlayerFormItemRestrictions[PLAYER_FORM_MAX][114] /*= { - {0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x01,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x01,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x01,0x01}, -{0x01,0x00,0x00,0x00}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x01,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x01,0x01,0x00}, -{0x00,0x00,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x01,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x01}, -{0x00,0x00,0x00,0x01}, -{0x01,0x00,0x00,0x00}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x00,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x01,0x01,0x01}, -{0x01,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -{0x00,0x00,0x00,0x00}, -}*/; - u8 gPictoPhotoI8[PICTO_PHOTO_SIZE]; u8 D_80784600[0x56200]; diff --git a/mm/src/code/z_message.c b/mm/src/code/z_message.c index 202dd6575..6265033e8 100644 --- a/mm/src/code/z_message.c +++ b/mm/src/code/z_message.c @@ -3109,7 +3109,7 @@ void Message_OpenText(PlayState* play, u16 textId) { } if (textId == 0xFF) { - Interface_LoadButtonDoActionLabel(play, DO_ACTION_STOP, B_BUTTON_ACTION, ACTION_MAIN); + Interface_LoadBButtonDoActionLabel(play, DO_ACTION_STOP); play->msgCtx.hudVisibility = gSaveContext.hudVisibility; Interface_SetHudVisibility(HUD_VISIBILITY_A_B_C); gSaveContext.save.unk_06 = 20; @@ -3580,7 +3580,7 @@ void Message_DisplayOcarinaStaffImpl(PlayState* play, u16 ocarinaAction) { msgCtx->textboxColorAlphaCurrent = msgCtx->textboxColorAlphaTarget; if (!noStop) { - Interface_LoadButtonDoActionLabel(play, DO_ACTION_STOP, B_BUTTON_ACTION, ACTION_MAIN); + Interface_LoadBButtonDoActionLabel(play, DO_ACTION_STOP); noStop = gSaveContext.hudVisibility; Interface_SetHudVisibility(HUD_VISIBILITY_B_ALT); gSaveContext.hudVisibility = noStop; @@ -5710,7 +5710,7 @@ void Message_Update(PlayState* play) { Message_CloseTextbox(play); play->msgCtx.ocarinaMode = OCARINA_MODE_END; gSaveContext.prevHudVisibility = HUD_VISIBILITY_A_B; - Interface_LoadButtonDoActionLabel(play, DO_ACTION_STOP, B_BUTTON_ACTION, ACTION_MAIN); + Interface_LoadBButtonDoActionLabel(play, DO_ACTION_STOP); GameState_SetFramerateDivisor(&play->state, 2); if (ShrinkWindow_Letterbox_GetSizeTarget() != 0) { ShrinkWindow_Letterbox_SetSizeTarget(0); diff --git a/mm/src/code/z_parameter.c b/mm/src/code/z_parameter.c index c626e66db..6f9790a38 100644 --- a/mm/src/code/z_parameter.c +++ b/mm/src/code/z_parameter.c @@ -1,6 +1,7 @@ #include "global.h" #include "PR/gs2dex.h" #include "sys_cfb.h" +// #include "z64malloc.h" // 2S2H [Port] Don't want this anymore #include "z64snap.h" #include "z64view.h" #include "z64voice.h" @@ -13,18 +14,55 @@ #include "overlays/actors/ovl_En_Mm3/z_en_mm3.h" #include "interface/week_static/week_static.h" #include "BenPort.h" - #include +// #region 2S2H [Port] Asset tables we can pull from instead of from ROM #define dgEmptyTexture "__OTR__textures/virtual/gEmptyTexture" static const ALIGN_ASSET(2) char gEmptyTexture[] = dgEmptyTexture; -static u8* sCounterDigits[] = { - (u8*)gCounterDigit0Tex, (u8*)gCounterDigit1Tex, (u8*)gCounterDigit2Tex, (u8*)gCounterDigit3Tex, - (u8*)gCounterDigit4Tex, (u8*)gCounterDigit5Tex, (u8*)gCounterDigit6Tex, (u8*)gCounterDigit7Tex, - (u8*)gCounterDigit8Tex, (u8*)gCounterDigit9Tex, +static const char* sCounterDigits[] = { + gCounterDigit0Tex, gCounterDigit1Tex, gCounterDigit2Tex, gCounterDigit3Tex, gCounterDigit4Tex, + gCounterDigit5Tex, gCounterDigit6Tex, gCounterDigit7Tex, gCounterDigit8Tex, gCounterDigit9Tex, }; +static const char* sDoWeekTable[] = { + gClockDay1stTex, + gClockDay2ndTex, + gClockDayFinalTex, +}; + +// Not static so its visible in z_kaleido_item +const char* gAmmoDigitTextures[10] = { + gAmmoDigit0Tex, gAmmoDigit1Tex, gAmmoDigit2Tex, gAmmoDigit3Tex, gAmmoDigit4Tex, + gAmmoDigit5Tex, gAmmoDigit6Tex, gAmmoDigit7Tex, gAmmoDigit8Tex, gAmmoDigit9Tex, +}; + +static const char* doActionTbl[] = { + gDoActionAttackENGTex, gDoActionCheckENGTex, gDoActionEnterENGTex, gDoActionReturnENGTex, gDoActionOpenENGTex, + gDoActionJumpENGTex, gDoActionDecideENGTex, gDoActionDiveENGTex, gDoActionFasterENGTex, gDoActionThrowENGTex, + gDoActionNaviENGTex, gDoActionClimbENGTex, gDoActionDropENGTex, gDoActionDownENGTex, gDoActionQuitENGTex, + gDoActionSpeakENGTex, gDoActionNextENGTex, gDoActionGrabENGTex, gDoActionStopENGTex, gDoActionPutAwayENGTex, + gDoActionReelENGTex, gDoActionInfoENGTex, gDoActionWarpENGTex, gDoActionSnapENGTex, gDoActionExplodeENGTex, + gDoActionDanceENGTex, gDoActionMarchENGTex, gDoActionNum1ENGTex, gDoActionNum2ENGTex, gDoActionNum3ENGTex, + gDoActionNum4ENGTex, gDoActionNum5ENGTex, gDoActionNum6ENGTex, gDoActionNum7ENGTex, gDoActionNum8ENGTex, + gDoActionCurlENGTex, gDoActionSurfaceENGTex, gDoActionSwimENGTex, gDoActionPunchENGTex, gDoActionPoundENGTex, + gDoActionHookENGTex, gDoActionShootENGTex, +}; + +static const char* emptyCButtonArrows[] = { + gEmptyCLeftArrowTex, gEmptyCDownArrowTex, gEmptyCRightArrowTex, +}; + +u8 gPlayerFormItemRestrictions[PLAYER_FORM_MAX][114] = { + { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, + { 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, + { 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, + { 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, + { 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, + // {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, extra bytes at the end of data.s? +}; +// #endregion + typedef enum { /* 0 */ PICTO_BOX_STATE_OFF, // Not using the pictograph /* 1 */ PICTO_BOX_STATE_LENS, // Looking through the lens of the pictograph @@ -921,12 +959,6 @@ u32 Interface_GetCompressedTimerDigits(s16 timerId) { (timerArr[4] << 4) | timerArr[5]; } -static const char* sDoWeekTable[] = { - gClockDay1stTex, - gClockDay2ndTex, - gClockDayFinalTex, -}; - void Interface_NewDay(PlayState* play, s32 day) { s32 pad; s16 i = day - 1; @@ -936,7 +968,12 @@ void Interface_NewDay(PlayState* play, s32 day) { i = 0; } - play->interfaceCtx.doActionSegment[CLOCK_TIMER].mainTex = sDoWeekTable[i]; + // #region 2S2H [Port] + // Loads day number from week_static for the three-day clock + // DmaMgr_SendRequest0((void*)(play->interfaceCtx.doActionSegment + 0x780), + // SEGMENT_ROM_START_OFFSET(week_static, i * 0x510), 0x510); + play->interfaceCtx.doActionSegment[DO_ACTION_SEG_CLOCK].mainTex = sDoWeekTable[i]; + // #endregion // i is used to store sceneId for (i = 0; i < ARRAY_COUNT(gSaveContext.save.saveInfo.permanentSceneFlags); i++) { @@ -2382,7 +2419,7 @@ void Interface_UpdateButtonsPart1(PlayState* play) { Message_CloseTextbox(play); if (play->msgCtx.choiceIndex != 0) { Audio_PlaySfx_MessageCancel(); - Interface_LoadButtonDoActionLabel(play, DO_ACTION_STOP, B_BUTTON_ACTION, ACTION_MAIN); + Interface_LoadBButtonDoActionLabel(play, DO_ACTION_STOP); Interface_SetHudVisibility(HUD_VISIBILITY_A_B); sPictoState = PICTO_BOX_STATE_LENS; REMOVE_QUEST_ITEM(QUEST_PICTOGRAPH); @@ -2421,7 +2458,7 @@ void Interface_UpdateButtonsPart1(PlayState* play) { } else if (play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON) { // Related to pictograph if (!CHECK_QUEST_ITEM(QUEST_PICTOGRAPH)) { - Interface_LoadButtonDoActionLabel(play, DO_ACTION_STOP, B_BUTTON_ACTION, ACTION_MAIN); + Interface_LoadBButtonDoActionLabel(play, DO_ACTION_STOP); Interface_SetHudVisibility(HUD_VISIBILITY_A_B); sPictoState = PICTO_BOX_STATE_LENS; } else { @@ -2489,9 +2526,12 @@ void Interface_InitMinigame(PlayState* play) { void Interface_LoadItemIconImpl(PlayState* play, u8 btn) { InterfaceContext* interfaceCtx = &play->interfaceCtx; - - void* tex = ResourceMgr_LoadTexOrDListByName(gItemIcons[(s32)GET_CUR_FORM_BTN_ITEM(btn)]); - memcpy(&interfaceCtx->iconItemSegment[(u32)btn * 0x1000], tex, 0x1000); + + // #region 2S2H [Port] + // CmpDma_LoadFile(SEGMENT_ROM_START(icon_item_static_yar), GET_CUR_FORM_BTN_ITEM(btn), + // &interfaceCtx->iconItemSegment[(u32)btn * 0x1000], 0x1000); + interfaceCtx->iconItemSegment[btn] = gItemIcons[GET_CUR_FORM_BTN_ITEM(btn)]; + // #endregion } void Interface_LoadItemIcon(PlayState* play, u8 btn) { @@ -3288,30 +3328,30 @@ void Interface_LoadAButtonDoActionLabel(InterfaceContext* interfaceCtx, u16 acti } if (action != DO_ACTION_NONE) { - osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, 1); - DmaMgr_SendRequestImpl(&interfaceCtx->dmaRequest, - (u32)interfaceCtx->doActionSegment + (loadOffset * DO_ACTION_TEX_SIZE), - (u32)SEGMENT_ROM_START(do_action_static) + (action * DO_ACTION_TEX_SIZE), - DO_ACTION_TEX_SIZE, 0, &interfaceCtx->loadQueue, OS_MESG_PTR(NULL)); - osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK); + // #region 2S2H [Port] + // osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, 1); + // DmaMgr_SendRequestImpl(&interfaceCtx->dmaRequest, + // (u32)interfaceCtx->doActionSegment + (loadOffset * DO_ACTION_TEX_SIZE), + // (u32)SEGMENT_ROM_START(do_action_static) + (action * DO_ACTION_TEX_SIZE), + // DO_ACTION_TEX_SIZE, 0, &interfaceCtx->loadQueue, OS_MESG_PTR(NULL)); + // osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK); + if (loadOffset) { + interfaceCtx->doActionSegment[DO_ACTION_SEG_A].subTex = doActionTbl[action]; + } else { + interfaceCtx->doActionSegment[DO_ACTION_SEG_A].mainTex = doActionTbl[action]; + } } else { - gSegments[0x09] = PHYSICAL_TO_VIRTUAL(interfaceCtx->doActionSegment); - Interface_MemSetZeroed(Lib_SegmentedToVirtual(sDoActionTextures[loadOffset]), 0x60); + // gSegments[0x09] = PHYSICAL_TO_VIRTUAL(interfaceCtx->doActionSegment); + // Interface_MemSetZeroed(Lib_SegmentedToVirtual(sDoActionTextures[loadOffset]), 0x60); + if (loadOffset) { + interfaceCtx->doActionSegment[DO_ACTION_SEG_A].subTex = gEmptyTexture; + } else { + interfaceCtx->doActionSegment[DO_ACTION_SEG_A].mainTex = gEmptyTexture; + } + // #endregion } } -static const char* doActionTbl[] = { - gDoActionAttackENGTex, gDoActionCheckENGTex, gDoActionEnterENGTex, gDoActionReturnENGTex, gDoActionOpenENGTex, - gDoActionJumpENGTex, gDoActionDecideENGTex, gDoActionDiveENGTex, gDoActionFasterENGTex, gDoActionThrowENGTex, - gDoActionNaviENGTex, gDoActionClimbENGTex, gDoActionDropENGTex, gDoActionDownENGTex, gDoActionQuitENGTex, - gDoActionSpeakENGTex, gDoActionNextENGTex, gDoActionGrabENGTex, gDoActionStopENGTex, gDoActionPutAwayENGTex, - gDoActionReelENGTex, gDoActionInfoENGTex, gDoActionWarpENGTex, gDoActionSnapENGTex, gDoActionExplodeENGTex, - gDoActionDanceENGTex, gDoActionMarchENGTex, gDoActionNum1ENGTex, gDoActionNum2ENGTex, gDoActionNum3ENGTex, - gDoActionNum4ENGTex, gDoActionNum5ENGTex, gDoActionNum6ENGTex, gDoActionNum7ENGTex, gDoActionNum8ENGTex, - gDoActionCurlENGTex, gDoActionSurfaceENGTex, gDoActionSwimENGTex, gDoActionPunchENGTex, gDoActionPoundENGTex, - gDoActionHookENGTex, gDoActionShootENGTex, -}; - void Interface_SetAButtonDoAction(PlayState* play, u16 aButtonDoAction) { InterfaceContext* interfaceCtx = &play->interfaceCtx; PauseContext* pauseCtx = &play->pauseCtx; @@ -3320,7 +3360,7 @@ void Interface_SetAButtonDoAction(PlayState* play, u16 aButtonDoAction) { interfaceCtx->aButtonDoAction = aButtonDoAction; interfaceCtx->aButtonState = A_BTN_STATE_1; interfaceCtx->aButtonRoll = 0.0f; - Interface_LoadButtonDoActionLabel(play, aButtonDoAction, A_BUTTON_ACTION, ACTION_SUB); + Interface_LoadAButtonDoActionLabel(interfaceCtx, aButtonDoAction, 1); if (pauseCtx->state != PAUSE_STATE_OFF) { interfaceCtx->aButtonState = A_BTN_STATE_3; } @@ -3339,7 +3379,14 @@ void Interface_SetBButtonDoAction(PlayState* play, s16 bButtonDoAction) { } else { interfaceCtx->bButtonDoAction = bButtonDoAction; if (interfaceCtx->bButtonDoAction != DO_ACTION_NONE) { - Interface_LoadButtonDoActionLabel(play, interfaceCtx->bButtonDoAction, B_BUTTON_ACTION, ACTION_SUB); + // #region 2S2H [Port] + // osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, 1); + // DmaMgr_SendRequestImpl(&interfaceCtx->dmaRequest, interfaceCtx->doActionSegment + 0x600, + // (bButtonDoAction * 0x180) + SEGMENT_ROM_START(do_action_static), 0x180, 0, + // &interfaceCtx->loadQueue, NULL); + // osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK); + interfaceCtx->doActionSegment[DO_ACTION_SEG_B].subTex = doActionTbl[bButtonDoAction]; + // #endregion } interfaceCtx->bButtonDoActionActive = true; @@ -3371,30 +3418,21 @@ void Interface_SetTatlCall(PlayState* play, u16 tatlCallState) { } } -void Interface_LoadButtonDoActionLabel(PlayState* play, s16 action, s16 button, s16 state) { - static void* sDoActionTextures[] = { gDoActionAttackENGTex, gDoActionCheckENGTex }; +void Interface_LoadBButtonDoActionLabel(PlayState* play, s16 bButtonDoAction) { InterfaceContext* interfaceCtx = &play->interfaceCtx; + + interfaceCtx->unk_224 = bButtonDoAction; - // OTRTODO: Validate btn states Eg. A_BTN_STATE_4 - if (action >= DO_ACTION_MAX) { - action = DO_ACTION_NONE; - } + // #region 2S2H [Port] + // osCreateMesgQueue(&play->interfaceCtx.loadQueue, &play->interfaceCtx.loadMsg, 1); + // DmaMgr_SendRequestImpl(&interfaceCtx->dmaRequest, interfaceCtx->doActionSegment + 0x480, + // (bButtonDoAction * 0x180) + SEGMENT_ROM_START(do_action_static), 0x180, 0, + // &interfaceCtx->loadQueue, OS_MESG_PTR(NULL)); + // osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK); + interfaceCtx->doActionSegment[DO_ACTION_SEG_B].mainTex = doActionTbl[bButtonDoAction]; + // #endregion - if (button == 1) { - interfaceCtx->unk_224 = action; - interfaceCtx->unk_222 = 1; - } - - char* path = action != DO_ACTION_NONE ? doActionTbl[action] : gEmptyTexture; - - switch (state) { - case 0: - interfaceCtx->doActionSegment[button].mainTex = path; - break; - case 1: - interfaceCtx->doActionSegment[button].subTex = path; - break; - } + interfaceCtx->unk_222 = 1; } /** @@ -4052,7 +4090,7 @@ void Interface_DrawItemButtons(PlayState* play) { gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment[START_BUTTON_ACTION].mainTex, + gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment[DO_ACTION_SEG_START].mainTex, G_IM_FMT_IA, DO_ACTION_TEX_WIDTH, DO_ACTION_TEX_HEIGHT, 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(OVERLAY_DISP++, 0x01F8, 0x0054, 0x02D4, 0x009C, G_TX_RENDERTILE, 0, 0, 0x04A6, 0x04A6); @@ -4112,7 +4150,7 @@ void Interface_DrawItemButtons(PlayState* play) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 240, 0, interfaceCtx->cRightAlpha); } OVERLAY_DISP = - Gfx_DrawTexRectIA8(OVERLAY_DISP, gButtonBackgroundTex, 0x20, 0x20, D_801BF9D4[temp], D_801BF9DC[temp], + Gfx_DrawTexRectIA8(OVERLAY_DISP, emptyCButtonArrows[temp - 1], 0x20, 0x20, D_801BF9D4[temp], D_801BF9DC[temp], D_801BFAF4[temp], D_801BFAF4[temp], D_801BF9E4[temp] * 2, D_801BF9E4[temp] * 2); } } @@ -4138,12 +4176,6 @@ void Interface_DrawItemIconTexture(PlayState* play, TexturePtr texture, s16 butt s16 D_801BFB04[] = { 0xA2, 0xE4, 0xFA, 0x110 }; s16 D_801BFB0C[] = { 0x23, 0x23, 0x33, 0x23 }; -// Not static so its visible in z_kaleido_item -const char* gAmmoDigitTextures[10] = { - gAmmoDigit0Tex, gAmmoDigit1Tex, gAmmoDigit2Tex, gAmmoDigit3Tex, gAmmoDigit4Tex, - gAmmoDigit5Tex, gAmmoDigit6Tex, gAmmoDigit7Tex, gAmmoDigit8Tex, gAmmoDigit9Tex, -}; - void Interface_DrawAmmoCount(PlayState* play, s16 button, s16 alpha) { u8 i; u16 ammo; @@ -4200,7 +4232,7 @@ void Interface_DrawAmmoCount(PlayState* play, s16 button, s16 alpha) { } // Draw lower digit (ones) - OVERLAY_DISP = Gfx_DrawTexRectIA8(OVERLAY_DISP, gAmmoDigitTextures[i], 8, 8, + OVERLAY_DISP = Gfx_DrawTexRectIA8(OVERLAY_DISP, gAmmoDigitTextures[ammo], 8, 8, D_801BFB04[button] + 6, D_801BFB0C[button], 8, 8, 1 << 10, 1 << 10); } @@ -4219,13 +4251,12 @@ void Interface_DrawBButtonIcons(PlayState* play) { if ((interfaceCtx->unk_222 == 0) && (player->stateFlags3 & PLAYER_STATE3_1000000)) { if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_DISABLED) { - gSPInvalidateTexCache(OVERLAY_DISP++, interfaceCtx->iconItemSegment); - Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment, EQUIP_SLOT_B); + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment[EQUIP_SLOT_B], EQUIP_SLOT_B); gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - // BENTODO - // Interface_DrawAmmoCount(play, EQUIP_SLOT_B, interfaceCtx->bAlpha); + + Interface_DrawAmmoCount(play, EQUIP_SLOT_B, interfaceCtx->bAlpha); } } else if ((!interfaceCtx->bButtonDoActionActive && (interfaceCtx->unk_222 == 0)) || ((interfaceCtx->bButtonDoActionActive && @@ -4235,7 +4266,7 @@ void Interface_DrawBButtonIcons(PlayState* play) { (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_DEKU_NUT))) { if ((player->transformation == PLAYER_FORM_FIERCE_DEITY) || (player->transformation == PLAYER_FORM_HUMAN)) { if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NONE) { - Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment, EQUIP_SLOT_B); + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment[EQUIP_SLOT_B], EQUIP_SLOT_B); if ((player->stateFlags1 & PLAYER_STATE1_800000) || CHECK_WEEKEVENTREG(WEEKEVENTREG_08_01) || (play->bButtonAmmoPlusOne >= 2)) { gDPPipeSync(OVERLAY_DISP++); @@ -4258,7 +4289,7 @@ void Interface_DrawBButtonIcons(PlayState* play) { gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha); - gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment[B_BUTTON_ACTION].mainTex, G_IM_FMT_IA, 48, + gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment[DO_ACTION_SEG_B].mainTex, G_IM_FMT_IA, 48, 16, 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); @@ -4273,7 +4304,7 @@ void Interface_DrawBButtonIcons(PlayState* play) { gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha); - gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment[B_BUTTON_ACTION].subTex, G_IM_FMT_IA, 48, + gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment[DO_ACTION_SEG_B].subTex, G_IM_FMT_IA, 48, 16, 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); @@ -4302,7 +4333,7 @@ void Interface_DrawCButtonIcons(PlayState* play) { if (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) < ITEM_F0) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->cLeftAlpha); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment + 0x1000, EQUIP_SLOT_C_LEFT); + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment[EQUIP_SLOT_C_LEFT], EQUIP_SLOT_C_LEFT); gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); @@ -4315,7 +4346,7 @@ void Interface_DrawCButtonIcons(PlayState* play) { if (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) < ITEM_F0) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->cDownAlpha); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment + 0x2000, EQUIP_SLOT_C_DOWN); + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment[EQUIP_SLOT_C_DOWN], EQUIP_SLOT_C_DOWN); gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); @@ -4328,7 +4359,7 @@ void Interface_DrawCButtonIcons(PlayState* play) { if (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) < ITEM_F0) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->cRightAlpha); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment + 0x3000, EQUIP_SLOT_C_RIGHT); + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment[EQUIP_SLOT_C_RIGHT], EQUIP_SLOT_C_RIGHT); gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); @@ -4394,10 +4425,10 @@ void Interface_DrawAButton(PlayState* play) { // Draw Action Label if (((interfaceCtx->aButtonState <= A_BTN_STATE_1) || (interfaceCtx->aButtonState == A_BTN_STATE_3))) { - OVERLAY_DISP = Gfx_DrawTexQuad4b(OVERLAY_DISP, interfaceCtx->doActionSegment[A_BUTTON_ACTION].mainTex, 3, + OVERLAY_DISP = Gfx_DrawTexQuad4b(OVERLAY_DISP, interfaceCtx->doActionSegment[DO_ACTION_SEG_A].mainTex, 3, DO_ACTION_TEX_WIDTH, DO_ACTION_TEX_HEIGHT, 0); } else { - OVERLAY_DISP = Gfx_DrawTexQuad4b(OVERLAY_DISP, interfaceCtx->doActionSegment[A_BUTTON_ACTION].subTex, 3, + OVERLAY_DISP = Gfx_DrawTexQuad4b(OVERLAY_DISP, interfaceCtx->doActionSegment[DO_ACTION_SEG_A].subTex, 3, DO_ACTION_TEX_WIDTH, DO_ACTION_TEX_HEIGHT, 0); } @@ -4463,10 +4494,9 @@ void Interface_DrawPauseMenuEquippingIcons(PlayState* play) { } gSPVertex(OVERLAY_DISP++, &pauseCtx->cursorVtx[16], 4, 0); - // BENTODO - // gDPLoadTextureBlock(OVERLAY_DISP++, gMagicArrowEquipEffectTex, G_IM_FMT_IA, G_IM_SIZ_8b, 32, 32, 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); + gDPLoadTextureBlock(OVERLAY_DISP++, gMagicArrowEquipEffectTex, G_IM_FMT_IA, G_IM_SIZ_8b, 32, 32, 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); } gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0); @@ -4488,6 +4518,7 @@ void Interface_DrawClock(PlayState* play) { CLOCK_TIME(10, 0), CLOCK_TIME(11, 0), CLOCK_TIME(12, 0), CLOCK_TIME(13, 0), CLOCK_TIME(14, 0), CLOCK_TIME(15, 0), CLOCK_TIME(16, 0), CLOCK_TIME(17, 0), CLOCK_TIME(18, 0), CLOCK_TIME(19, 0), CLOCK_TIME(20, 0), CLOCK_TIME(21, 0), CLOCK_TIME(22, 0), CLOCK_TIME(23, 0), CLOCK_TIME(24, 0) - 1, + CLOCK_TIME(0, 0), // 2S2H [Port] This was removed in the minibuild, not sure why }; static TexturePtr sThreeDayClockHourTextures[] = { gThreeDayClockHour12Tex, gThreeDayClockHour1Tex, gThreeDayClockHour2Tex, gThreeDayClockHour3Tex, @@ -4612,7 +4643,7 @@ void Interface_DrawClock(PlayState* play) { //! resulting in this reading into the next texture. This results in a white //! dot in the bottom center of the clock. For the three-day clock, this is //! covered by the diamond. However, it can be seen by the final-hours clock. - OVERLAY_DISP = Gfx_DrawTexRect4b(OVERLAY_DISP, gThreeDayClockBorderTex, 4, 64, 48, 96, 168, 128, 50, 1, 6, + OVERLAY_DISP = Gfx_DrawTexRect4b(OVERLAY_DISP, gThreeDayClockBorderTex, 4, 64, 50, 96, 168, 128, 50, 1, 6, 0, 1 << 10, 1 << 10); if (((CURRENT_DAY >= 4) || @@ -4717,7 +4748,7 @@ void Interface_DrawClock(PlayState* play) { gDPPipeSync(OVERLAY_DISP++); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 155, sThreeDayClockAlpha); - OVERLAY_DISP = Gfx_DrawTexRectIA8(OVERLAY_DISP, interfaceCtx->doActionSegment[CLOCK_TIMER].mainTex, 48, + OVERLAY_DISP = Gfx_DrawTexRectIA8(OVERLAY_DISP, interfaceCtx->doActionSegment[DO_ACTION_SEG_CLOCK].mainTex, 48, 27, 137, 192, 48, 27, 1 << 10, 1 << 10); /** @@ -4875,8 +4906,7 @@ void Interface_DrawClock(PlayState* play) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 155, sThreeDayClockAlpha); gSP1Quadrangle(OVERLAY_DISP++, 4, 6, 7, 5, 0); - __gSPDisplayList(OVERLAY_DISP++, - 0x0E000000 + ((uintptr_t)&D_0E000000.setScissor - (uintptr_t)&D_0E000000) + 1); + gSPDisplayList(OVERLAY_DISP++, D_0E000000_TO_SEGMENTED(setScissor)); // Final Hours if ((CURRENT_DAY >= 4) || @@ -6311,8 +6341,6 @@ TexturePtr sStoryTLUTs[] = { }; void Interface_Draw(PlayState* play) { - // BENTODO: there is a crash somewhere here - // return; s32 pad; InterfaceContext* interfaceCtx = &play->interfaceCtx; Player* player = GET_PLAYER(play); @@ -6329,11 +6357,8 @@ void Interface_Draw(PlayState* play) { OPEN_DISPS(play->state.gfxCtx); gSPSegment(OVERLAY_DISP++, 0x02, interfaceCtx->parameterSegment); - // BENTODO: Find if this is the correct button - - // BENTODO CRASH - gSPSegment(OVERLAY_DISP++, 0x09, interfaceCtx->doActionSegment[A_BUTTON_ACTION].mainTex); - gSPSegment(OVERLAY_DISP++, 0x08, interfaceCtx->iconItemSegment); + gSPSegment(OVERLAY_DISP++, 0x09, interfaceCtx->doActionSegment[DO_ACTION_SEG_A].mainTex); + gSPSegment(OVERLAY_DISP++, 0x08, interfaceCtx->iconItemSegment[EQUIP_SLOT_B]); gSPSegment(OVERLAY_DISP++, 0x0B, interfaceCtx->mapSegment); if (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) { @@ -6444,7 +6469,7 @@ void Interface_Draw(PlayState* play) { gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha); gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255); - gDPLoadTextureBlock(OVERLAY_DISP++, gGoldSkulltulaCounterIconTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 24, 18, + gDPLoadTextureBlock(OVERLAY_DISP++, gGoldSkulltulaCounterIconTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 24, 24, // 2S2H [Port] This last 24 was 18 in the minibuild, not sure why 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(OVERLAY_DISP++, 80, 748, 176, 820, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); @@ -6714,8 +6739,7 @@ void Interface_Draw(PlayState* play) { gDPPipeSync(OVERLAY_DISP++); gSPDisplayList(OVERLAY_DISP++, sScreenFillSetupDL); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, interfaceCtx->screenFillAlpha); - - __gSPDisplayList(OVERLAY_DISP++, 0x0E000000 + ((uintptr_t)&D_0E000000.fillRect - (uintptr_t)&D_0E000000) + 1); + gSPDisplayList(OVERLAY_DISP++, D_0E000000_TO_SEGMENTED(fillRect)); } CLOSE_DISPS(play->state.gfxCtx); @@ -7264,25 +7288,28 @@ void Interface_Init(PlayState* play) { interfaceCtx->healthTimer = 200; parameterStaticSize = SEGMENT_ROM_SIZE(parameter_static); + // #region 2S2H [Port] interfaceCtx->parameterSegment = THA_AllocTailAlign16(&play->state.tha, parameterStaticSize); - // OTRTODO - // DmaMgr_SendRequest0(interfaceCtx->parameterSegment, SEGMENT_ROM_START(parameter_static), parameterStaticSize); + // DmaMgr_SendRequest0(interfaceCtx->parameterSegment, SEGMENT_ROM_START(parameter_static), parameterStaticSize); // 2S2H [Port] TODO - interfaceCtx->doActionSegment = THA_AllocTailAlign16(&play->state.tha, sizeof(ActionLabel) * 4); - for (size_t id = 0; id < 4; id++) { + interfaceCtx->doActionSegment = THA_AllocTailAlign16(&play->state.tha, sizeof(ActionLabel) * DO_ACTION_SEG_MAX); + for (size_t id = 0; id < DO_ACTION_SEG_MAX; id++) { ActionLabel lbl = { gEmptyTexture, gEmptyTexture }; interfaceCtx->doActionSegment[id] = lbl; } - - interfaceCtx->doActionSegment[A_BUTTON_ACTION].mainTex = doActionTbl[0]; - interfaceCtx->doActionSegment[A_BUTTON_ACTION].subTex = doActionTbl[1]; - interfaceCtx->doActionSegment[START_BUTTON_ACTION].mainTex = doActionTbl[3]; // DmaMgr_SendRequest0(interfaceCtx->doActionSegment, SEGMENT_ROM_START(do_action_static), 0x300); + interfaceCtx->doActionSegment[DO_ACTION_SEG_A].mainTex = doActionTbl[0]; + interfaceCtx->doActionSegment[DO_ACTION_SEG_A].subTex = doActionTbl[1]; // DmaMgr_SendRequest0(interfaceCtx->doActionSegment + 0x300, SEGMENT_ROM_START(do_action_static) + 0x480, 0x180); + interfaceCtx->doActionSegment[DO_ACTION_SEG_START].mainTex = doActionTbl[3]; Interface_NewDay(play, CURRENT_DAY); - interfaceCtx->iconItemSegment = THA_AllocTailAlign16(&play->state.tha, 0x4000); + interfaceCtx->iconItemSegment = THA_AllocTailAlign16(&play->state.tha, sizeof(char*) * EQUIP_SLOT_MAX); + for (size_t id = 0; id < EQUIP_SLOT_MAX; id++) { + interfaceCtx->iconItemSegment[id] = gEmptyTexture; + } + // #endregion if (CUR_FORM_EQUIP(EQUIP_SLOT_B) < ITEM_F0) { Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); diff --git a/mm/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c b/mm/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c index 8f007d974..94171bb29 100644 --- a/mm/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c +++ b/mm/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c @@ -308,17 +308,21 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { pauseCtx->itemVtx[j + 0].v.ob[1] - 32; } } - int itemId = gSaveContext.save.saveInfo.inventory.items[i]; - // BENTODO re add when the table is in C - if (CHECK_QUEST_ITEM(itemId) /*|| !gPlayerFormItemRestrictions[GET_PLAYER_FORM][(s32)itemId] */) { + // #region 2S2H [Port] Originally this was done in KaleidoScope_Update, but now we are using gSPGrayscale on the fly + // It reads odd here to assign a u8 to a u16, then cast it to s32 for gPlayerFormItemRestrictions + // but this matches the behavior of the original code + u16 itemId = gSaveContext.save.saveInfo.inventory.items[i]; + if (!gPlayerFormItemRestrictions[GET_PLAYER_FORM][(s32)itemId]) { gDPSetGrayscaleColor(POLY_OPA_DISP++, 109, 109, 109, 255); gSPGrayscale(POLY_OPA_DISP++, true); } gSPVertex(POLY_OPA_DISP++, &pauseCtx->itemVtx[j + 0], 4, 0); - KaleidoScope_DrawTexQuadRGBA32(play->state.gfxCtx, gItemIcons[itemId], 32, 32, 0); - gSPGrayscale(POLY_OPA_DISP++, false); - //KaleidoScope_DrawTexQuadRGBA32( - // play->state.gfxCtx, gItemIcons[((void)0, gSaveContext.save.saveInfo.inventory.items[i])], 32, 32, 0); + KaleidoScope_DrawTexQuadRGBA32( + play->state.gfxCtx, gItemIcons[((void)0, gSaveContext.save.saveInfo.inventory.items[i])], 32, 32, 0); + if (!gPlayerFormItemRestrictions[GET_PLAYER_FORM][(s32)itemId]) { + gSPGrayscale(POLY_OPA_DISP++, false); + } + // #endregion } } diff --git a/mm/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/mm/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c index f0cca8e2b..53b168825 100644 --- a/mm/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c +++ b/mm/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c @@ -2933,7 +2933,7 @@ void KaleidoScope_UpdateOpening(PlayState* play) { pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; pauseCtx->state++; // PAUSE_STATE_MAIN pauseCtx->alpha = 255; - Interface_LoadButtonDoActionLabel(play, DO_ACTION_RETURN, B_BUTTON_ACTION, ACTION_MAIN); + Interface_LoadBButtonDoActionLabel(play, DO_ACTION_RETURN); } else if (pauseCtx->switchPageTimer == 64) { pauseCtx->pageIndex = sPageSwitchNextPageIndex[pauseCtx->nextPageMode]; pauseCtx->nextPageMode = (pauseCtx->pageIndex * 2) + 1; @@ -3007,9 +3007,8 @@ void KaleidoScope_Update(PlayState* play) { for (itemId = 0; itemId <= ITEM_BOW_FIRE; itemId++) { if (!gPlayerFormItemRestrictions[GET_PLAYER_FORM][(s32)itemId]) { - //void* tex = ResourceMgr_LoadTexOrDListByName(gItemIcons[(s32)itemId]); - //KaleidoScope_GrayOutTextureRGBA32(tex, 0x400); - //KaleidoScope_GrayOutTextureRGBA32(Lib_SegmentedToVirtual(gItemIcons[(s32)itemId]), 0x400); + // 2S2H [Port] This is now handled by gSPGrayscale in KaleidoScope_DrawItemSelect + // KaleidoScope_GrayOutTextureRGBA32(Lib_SegmentedToVirtual(gItemIcons[(s32)itemId]), 0x400); } } @@ -3745,7 +3744,7 @@ void KaleidoScope_Update(PlayState* play) { func_80143324(play, &play->skyboxCtx, play->skyboxId); if ((msgCtx->msgMode != 0) && (msgCtx->currentTextId == 0xFF)) { - Interface_LoadButtonDoActionLabel(play, DO_ACTION_STOP, B_BUTTON_ACTION, ACTION_MAIN); + Interface_LoadBButtonDoActionLabel(play, DO_ACTION_STOP); Interface_SetAButtonDoAction(play, DO_ACTION_STOP); Interface_SetHudVisibility(HUD_VISIBILITY_A_B_C); } else {