From 615d945bf94bd29e5ba43b067f1cc3d64b7972c2 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 29 Sep 2022 15:11:03 -0400 Subject: [PATCH] minigame docs --- include/functions.h | 4 +- include/variables.h | 14 +- include/z64.h | 59 +- include/z64save.h | 10 +- src/code/code_8012EC80.c | 2 +- src/code/z_parameter.c | 880 ++++++++++-------- src/overlays/actors/ovl_En_Az/z_en_az.c | 4 +- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 2 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 9 +- .../z_en_horse_game_check.c | 6 +- .../actors/ovl_En_Jc_Mato/z_en_jc_mato.c | 2 +- .../actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c | 10 +- .../actors/ovl_En_Kendo_Js/z_en_kendo_js.c | 10 +- src/overlays/actors/ovl_En_Ma4/z_en_ma4.c | 6 +- .../actors/ovl_En_Mt_tag/z_en_mt_tag.c | 4 +- src/overlays/actors/ovl_En_Ot/z_en_ot.c | 7 +- .../ovl_En_Syateki_Man/z_en_syateki_man.c | 24 +- .../ovl_En_Syateki_Okuta/z_en_syateki_okuta.c | 2 +- .../actors/ovl_En_Tru_Mt/z_en_tru_mt.c | 4 +- src/overlays/actors/ovl_En_Twig/z_en_twig.c | 2 +- .../ovl_Effect_Ss_Extra/z_eff_ss_extra.c | 2 +- src/overlays/gamestates/ovl_select/z_select.c | 2 +- tools/disasm/functions.txt | 10 +- tools/disasm/variables.txt | 14 +- tools/sizes/code_functions.csv | 10 +- 25 files changed, 587 insertions(+), 512 deletions(-) diff --git a/include/functions.h b/include/functions.h index 74ecd75cf..e44e818ad 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1834,7 +1834,7 @@ s32 Inventory_HasItemInBottle(u8 item); void Inventory_UpdateBottleItem(PlayState* play, u8 item, u8 btn); s32 Inventory_ConsumeFairy(PlayState* play); void Inventory_UpdateItem(PlayState* play, s16 slot, s16 item); -void Interface_SetAButtonDoAction(PlayState* play, u16 action); +void Interface_SetAButtonDoAction(PlayState* play, u16 aButtonDoAction); void Interface_SetBButtonDoAction(PlayState* play, s16 bButtonDoAction); void Interface_SetTatlCall(PlayState* play, u16 tatlCallState); void func_80115844(PlayState* play, s16 arg1); @@ -1845,7 +1845,7 @@ void Inventory_ChangeAmmo(s16 item, s16 ammoChange); void Magic_Add(PlayState* play, s16 magicToAdd); void Magic_Reset(PlayState* play); s32 Magic_Consume(PlayState* play, s16 magicToConsume, s16 type); -void Interface_SetPerfectMinigame(PlayState* play, s16 rewardType); +void Interface_SetMinigamePerfect(PlayState* play, s16 minigamePerfectType); void Interface_StartMoonCrash(PlayState* play); void Interface_Draw(PlayState* play); void Interface_Update(PlayState* play); diff --git a/include/variables.h b/include/variables.h index 09bbcfba4..abb01f23a 100644 --- a/include/variables.h +++ b/include/variables.h @@ -1051,7 +1051,7 @@ extern UNK_PTR D_801BF5C0; // extern UNK_TYPE2 D_801BF978; // extern UNK_TYPE2 D_801BF97C; // extern UNK_TYPE4 D_801BF980; -// extern UNK_TYPE1 D_801BF988; +// extern UNK_TYPE1 gScreenFillSetupDL; // extern UNK_TYPE1 D_801BF998; // extern UNK_TYPE2 D_801BF9B0; // extern UNK_TYPE1 D_801BF9B4; @@ -1125,15 +1125,15 @@ extern UNK_PTR D_801BF5C0; // extern UNK_TYPE1 D_801BFC14; // extern UNK_TYPE1 D_801BFC40; // extern UNK_TYPE2 D_801BFC50; -// extern UNK_TYPE2 D_801BFC60; +// extern UNK_TYPE2 sMinigamePerfectType1PrimColorTargets; // extern UNK_TYPE2 D_801BFC62; // extern UNK_TYPE2 D_801BFC64; // extern UNK_TYPE2 D_801BFC6C; // extern UNK_TYPE2 D_801BFC7C; -// extern UNK_TYPE1 D_801BFC8C; +// extern UNK_TYPE1 sMinigamePerfectType2PrimColorTargets; // extern UNK_TYPE2 D_801BFC98; // extern UNK_TYPE2 D_801BFCA8; -// extern UNK_TYPE1 D_801BFCB8; +// extern UNK_TYPE1 sMinigamePerfectType3PrimColorTargets; // extern UNK_TYPE4 D_801BFCC4; // extern UNK_TYPE2 sTimerStateTimer; // extern UNK_TYPE2 sTimerDigits; @@ -1150,9 +1150,9 @@ extern UNK_PTR D_801BF5C0; // extern UNK_TYPE1 D_801BFD24; // extern UNK_TYPE1 D_801BFD2C; // extern UNK_TYPE1 D_801BFD40; -// extern UNK_TYPE1 D_801BFD54; -// extern UNK_TYPE1 D_801BFD64; -// extern UNK_TYPE2 D_801BFD6C; +// extern UNK_TYPE1 sMinigameCountdownTextures; +// extern UNK_TYPE1 sMinigameCountdownTexWidths; +// extern UNK_TYPE2 sMinigameCountdownPrimColors; // extern UNK_TYPE1 D_801BFD84; // extern UNK_TYPE1 D_801BFD8C; // extern UNK_TYPE1 D_801BFD94; diff --git a/include/z64.h b/include/z64.h index 3b7ea09e4..421725167 100644 --- a/include/z64.h +++ b/include/z64.h @@ -545,9 +545,26 @@ typedef enum { /* 30 */ MINIGAME_STATE_30 = 30 } MinigameState; +typedef enum { + /* 0 */ MINIGAME_PERFECT_TYPE_OFF, + /* 1 */ MINIGAME_PERFECT_TYPE_1, + /* 2 */ MINIGAME_PERFECT_TYPE_2, + /* 3 */ MINIGAME_PERFECT_TYPE_3 +} MinigamePerfectType; + +typedef enum { + /* 0 */ MINIGAME_PERFECT_STATE_0, + /* 1 */ MINIGAME_PERFECT_STATE_1, + /* 2 */ MINIGAME_PERFECT_STATE_2, + /* 3 */ MINIGAME_PERFECT_STATE_3, + /* 4 */ MINIGAME_PERFECT_STATE_4, + /* 5 */ MINIGAME_PERFECT_STATE_5, + /* 6 */ MINIGAME_PERFECT_STATE_6 +} MinigamePerfectState; + typedef struct { /* 0x000 */ View view; - /* 0x168 */ Vtx* actionVtx; + /* 0x168 */ Vtx* aButtonVtx; /* 0x16C */ Vtx* beatingHeartVtx; /* 0x170 */ u8* parameterSegment; /* 0x174 */ u8* doActionSegment; @@ -564,7 +581,7 @@ typedef struct { /* 0x212 */ u16 unk_212; /* 0x214 */ u16 unk_214; /* 0x218 */ f32 unk_218; - /* 0x21C */ s16 unk_21C; + /* 0x21C */ s16 bButtonDoActionActive; /* 0x21E */ s16 bButtonDoAction; /* 0x220 */ s16 tatlCalling; /* 0x222 */ s16 unk_222; @@ -586,11 +603,11 @@ typedef struct { /* 0x256 */ s16 unk_256; /* 0x258 */ s16 magicConsumptionTimer; // For certain magic states, 1 unit of magic is consumed every time the timer reaches 0 /* 0x25A */ u8 numHorseBoosts; - /* 0x25C */ u16 unk_25C; - /* 0x25E */ u16 unk_25E; - /* 0x260 */ u16 hbaAmmo; - /* 0x262 */ u16 unk_262; - /* 0x264 */ s16 unk_264; + /* 0x25C */ u16 minigamePoints; // Points to add to the minigame score. Reset to 0 every frame. + /* 0x25E */ u16 minigameHiddenPoints; // Points to add to the secondary set of minigame points not displayed. Reset to 0 every frame. + /* 0x260 */ u16 minigameAmmo; + /* 0x262 */ u16 minigameUnusedPoints; // Associated with other minigame points, unused + /* 0x264 */ s16 screenFillAlpha; /* 0x266 */ s16 aAlpha; /* 0x268 */ s16 bAlpha; /* 0x26A */ s16 cLeftAlpha; @@ -606,21 +623,21 @@ typedef struct { /* 0x27E */ u8 unk_27E; /* 0x27F */ u8 unk_27F; /* 0x280 */ u8 minigameState; - /* 0x282 */ s16 unk_282; - /* 0x284 */ s16 unk_284; + /* 0x282 */ s16 minigameCountdownAlpha; + /* 0x284 */ s16 minigameCountdownScale; /* 0x286 */ s16 isMinigamePerfect; - /* 0x288 */ s16 minigameRewardType; - /* 0x28A */ s16 unk_28A[8]; - /* 0x29A */ u16 unk_29A[8]; - /* 0x2AA */ s16 unk_2AA[8]; - /* 0x2BC */ f32 unk_2BC[8]; - /* 0x2DC */ f32 unk_2DC[8]; - /* 0x2FC */ s16 unk_2FC[4]; - /* 0x304 */ s16 unk_304; - /* 0x306 */ s16 unk_306; - /* 0x308 */ s16 unk_308; - /* 0x30A */ s16 unk_30A; - /* 0x30C */ s16 unk_30C; + /* 0x288 */ s16 minigamePerfectType; + /* 0x28A */ s16 minigamePerfectState[8]; + /* 0x29A */ u16 minigamePerfectLetterDirection[8]; + /* 0x2AA */ s16 minigamePerfectVtxOffset[8]; + /* 0x2BC */ f32 minigamePerfectLetterPosX[8]; + /* 0x2DC */ f32 minigamePerfectLetterPosY[8]; + /* 0x2FC */ s16 minigamePerfectPrimColor[4]; + /* 0x304 */ s16 minigamePerfectLetterCount; + /* 0x306 */ s16 minigamePerfectUnused; + /* 0x308 */ s16 minigamePerfectColorTargetIndex; + /* 0x30A */ s16 minigamePerfectColorTimer; + /* 0x30C */ s16 minigamePerfectTimer; struct { /* 0x30E */ u8 hGauge; /* 0x30F */ u8 bButton; diff --git a/include/z64save.h b/include/z64save.h index f5b3bb93c..73c1eefe7 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -106,6 +106,12 @@ typedef enum { /* 1 */ BOTTLE_TIMER_STATE_COUNTING } BottleTimerState; +typedef enum { + /* 0 */ MINIGAME_STATUS_INACTIVE, + /* 1 */ MINIGAME_STATUS_ACTIVE, + /* 3 */ MINIGAME_STATUS_DONE = 3 +} MinigameStatus; + typedef enum { /* 0 */ HUD_VISIBILITY_IDLE, /* 1 */ HUD_VISIBILITY_NONE, @@ -344,9 +350,9 @@ typedef struct SaveContext { /* 0x3F32 */ s16 magicToConsume; // accumulated magic that is requested to be consumed "magic_used" /* 0x3F34 */ s16 magicToAdd; // accumulated magic that is requested to be added "magic_recovery" /* 0x3F36 */ u16 mapIndex; // "scene_ID" - /* 0x3F38 */ u16 minigameState; // "yabusame_mode" + /* 0x3F38 */ u16 minigameStatus; // "yabusame_mode" /* 0x3F3A */ u16 minigameScore; // "yabusame_total" - /* 0x3F3C */ u16 unk_3F3C; // "yabusame_out_ct" + /* 0x3F3C */ u16 minigameHiddenScore; // "yabusame_out_ct" /* 0x3F3E */ u8 unk_3F3E; // "no_save" /* 0x3F3F */ u8 unk_3F3F; // "flash_flag" /* 0x3F40 */ SaveOptions options; diff --git a/src/code/code_8012EC80.c b/src/code/code_8012EC80.c index 9e821b59c..c16d0a723 100644 --- a/src/code/code_8012EC80.c +++ b/src/code/code_8012EC80.c @@ -480,7 +480,7 @@ s32 Inventory_GetBtnBItem(PlayState* play) { } else if (gSaveContext.unk_1015 == ITEM_NONE) { return ITEM_NONE; } else if (CUR_FORM_EQUIP(EQUIP_SLOT_B) == ITEM_NONE) { - if (play->interfaceCtx.unk_21C != 0) { + if (play->interfaceCtx.bButtonDoActionActive) { if (play->interfaceCtx.bButtonDoAction != DO_ACTION_ATTACK) { return play->interfaceCtx.bButtonDoAction; } diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 8d2c3a075..c4b67e10f 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -13,7 +13,7 @@ s32 func_801234D4(PlayState* play); void func_801663C4(u8* arg0, u8* arg1, u32 arg2); extern Gfx D_0E0001C8[]; // Display List -extern Gfx D_0E0002E0[]; // Display List +extern Gfx D_0E0002E0[]; // gScreenFillDL // TODO extract this information from the texture definitions themselves #define DO_ACTION_TEX_WIDTH 48 @@ -211,7 +211,7 @@ s16 D_801BF97C = 255; f32 D_801BF980 = 1.0f; s32 D_801BF984 = 0; -Gfx D_801BF988[] = { +Gfx gScreenFillSetupDL[] = { gsDPPipeSync(), gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH), @@ -413,152 +413,152 @@ void Interface_InitVertices(PlayState* play) { s16 k; s16 offset; - play->interfaceCtx.actionVtx = GRAPH_ALLOC(play->state.gfxCtx, 108 * sizeof(Vtx)); + play->interfaceCtx.aButtonVtx = GRAPH_ALLOC(play->state.gfxCtx, 108 * sizeof(Vtx)); // clang-format off for (k = 0, i = 0; i < 44; i += 4, k++) { - interfaceCtx->actionVtx[i].v.ob[0] = - interfaceCtx->actionVtx[i + 2].v.ob[0] = D_801BFA04[k]; + interfaceCtx->aButtonVtx[i].v.ob[0] = + interfaceCtx->aButtonVtx[i + 2].v.ob[0] = D_801BFA04[k]; - interfaceCtx->actionVtx[i + 1].v.ob[0] = - interfaceCtx->actionVtx[i + 3].v.ob[0] = interfaceCtx->actionVtx[i].v.ob[0] + D_801BFA1C[k]; + interfaceCtx->aButtonVtx[i + 1].v.ob[0] = + interfaceCtx->aButtonVtx[i + 3].v.ob[0] = interfaceCtx->aButtonVtx[i].v.ob[0] + D_801BFA1C[k]; - interfaceCtx->actionVtx[i].v.ob[1] = - interfaceCtx->actionVtx[i + 1].v.ob[1] = D_801BFA34[k]; + interfaceCtx->aButtonVtx[i].v.ob[1] = + interfaceCtx->aButtonVtx[i + 1].v.ob[1] = D_801BFA34[k]; - interfaceCtx->actionVtx[i + 2].v.ob[1] = - interfaceCtx->actionVtx[i + 3].v.ob[1] = interfaceCtx->actionVtx[i].v.ob[1] - D_801BFA4C[k]; + interfaceCtx->aButtonVtx[i + 2].v.ob[1] = + interfaceCtx->aButtonVtx[i + 3].v.ob[1] = interfaceCtx->aButtonVtx[i].v.ob[1] - D_801BFA4C[k]; - interfaceCtx->actionVtx[i].v.ob[2] = - interfaceCtx->actionVtx[i + 1].v.ob[2] = - interfaceCtx->actionVtx[i + 2].v.ob[2] = - interfaceCtx->actionVtx[i + 3].v.ob[2] = 0; + interfaceCtx->aButtonVtx[i].v.ob[2] = + interfaceCtx->aButtonVtx[i + 1].v.ob[2] = + interfaceCtx->aButtonVtx[i + 2].v.ob[2] = + interfaceCtx->aButtonVtx[i + 3].v.ob[2] = 0; - interfaceCtx->actionVtx[i].v.flag = - interfaceCtx->actionVtx[i + 1].v.flag = - interfaceCtx->actionVtx[i + 2].v.flag = - interfaceCtx->actionVtx[i + 3].v.flag = 0; + interfaceCtx->aButtonVtx[i].v.flag = + interfaceCtx->aButtonVtx[i + 1].v.flag = + interfaceCtx->aButtonVtx[i + 2].v.flag = + interfaceCtx->aButtonVtx[i + 3].v.flag = 0; - interfaceCtx->actionVtx[i].v.tc[0] = - interfaceCtx->actionVtx[i].v.tc[1] = - interfaceCtx->actionVtx[i + 1].v.tc[1] = - interfaceCtx->actionVtx[i + 2].v.tc[0] = 0; + interfaceCtx->aButtonVtx[i].v.tc[0] = + interfaceCtx->aButtonVtx[i].v.tc[1] = + interfaceCtx->aButtonVtx[i + 1].v.tc[1] = + interfaceCtx->aButtonVtx[i + 2].v.tc[0] = 0; - interfaceCtx->actionVtx[i + 1].v.tc[0] = - interfaceCtx->actionVtx[i + 3].v.tc[0] = D_801BFA1C[k] << 5; + interfaceCtx->aButtonVtx[i + 1].v.tc[0] = + interfaceCtx->aButtonVtx[i + 3].v.tc[0] = D_801BFA1C[k] << 5; - interfaceCtx->actionVtx[i + 2].v.tc[1] = - interfaceCtx->actionVtx[i + 3].v.tc[1] = D_801BFA4C[k] << 5; + interfaceCtx->aButtonVtx[i + 2].v.tc[1] = + interfaceCtx->aButtonVtx[i + 3].v.tc[1] = D_801BFA4C[k] << 5; - interfaceCtx->actionVtx[i].v.cn[0] = - interfaceCtx->actionVtx[i + 1].v.cn[0] = - interfaceCtx->actionVtx[i + 2].v.cn[0] = - interfaceCtx->actionVtx[i + 3].v.cn[0] = - interfaceCtx->actionVtx[i].v.cn[1] = - interfaceCtx->actionVtx[i + 1].v.cn[1] = - interfaceCtx->actionVtx[i + 2].v.cn[1] = - interfaceCtx->actionVtx[i + 3].v.cn[1] = - interfaceCtx->actionVtx[i].v.cn[2] = - interfaceCtx->actionVtx[i + 1].v.cn[2] = - interfaceCtx->actionVtx[i + 2].v.cn[2] = - interfaceCtx->actionVtx[i + 3].v.cn[2] = 255; + interfaceCtx->aButtonVtx[i].v.cn[0] = + interfaceCtx->aButtonVtx[i + 1].v.cn[0] = + interfaceCtx->aButtonVtx[i + 2].v.cn[0] = + interfaceCtx->aButtonVtx[i + 3].v.cn[0] = + interfaceCtx->aButtonVtx[i].v.cn[1] = + interfaceCtx->aButtonVtx[i + 1].v.cn[1] = + interfaceCtx->aButtonVtx[i + 2].v.cn[1] = + interfaceCtx->aButtonVtx[i + 3].v.cn[1] = + interfaceCtx->aButtonVtx[i].v.cn[2] = + interfaceCtx->aButtonVtx[i + 1].v.cn[2] = + interfaceCtx->aButtonVtx[i + 2].v.cn[2] = + interfaceCtx->aButtonVtx[i + 3].v.cn[2] = 255; - interfaceCtx->actionVtx[i].v.cn[3] = - interfaceCtx->actionVtx[i + 1].v.cn[3] = - interfaceCtx->actionVtx[i + 2].v.cn[3] = - interfaceCtx->actionVtx[i + 3].v.cn[3] = 255; + interfaceCtx->aButtonVtx[i].v.cn[3] = + interfaceCtx->aButtonVtx[i + 1].v.cn[3] = + interfaceCtx->aButtonVtx[i + 2].v.cn[3] = + interfaceCtx->aButtonVtx[i + 3].v.cn[3] = 255; } - interfaceCtx->actionVtx[1].v.tc[0] = - interfaceCtx->actionVtx[3].v.tc[0] = - interfaceCtx->actionVtx[2].v.tc[1] = - interfaceCtx->actionVtx[3].v.tc[1] = 0x400; + interfaceCtx->aButtonVtx[1].v.tc[0] = + interfaceCtx->aButtonVtx[3].v.tc[0] = + interfaceCtx->aButtonVtx[2].v.tc[1] = + interfaceCtx->aButtonVtx[3].v.tc[1] = 0x400; - interfaceCtx->actionVtx[5].v.tc[0] = - interfaceCtx->actionVtx[7].v.tc[0] = - interfaceCtx->actionVtx[6].v.tc[1] = - interfaceCtx->actionVtx[7].v.tc[1] = 0x400; + interfaceCtx->aButtonVtx[5].v.tc[0] = + interfaceCtx->aButtonVtx[7].v.tc[0] = + interfaceCtx->aButtonVtx[6].v.tc[1] = + interfaceCtx->aButtonVtx[7].v.tc[1] = 0x400; for (j = 0, offset = 2; j < 2; j++, offset -= 2) { for (k = 0; k < 8; k++, i += 4) { - if ((interfaceCtx->minigameRewardType == 1) || ((interfaceCtx->minigameRewardType == 3) && (interfaceCtx->unk_28A[0] == 6))) { - interfaceCtx->actionVtx[i].v.ob[0] = - interfaceCtx->actionVtx[i + 2].v.ob[0] = -((D_801BFA64[k] - offset) + 0x10); + if ((interfaceCtx->minigamePerfectType == MINIGAME_PERFECT_TYPE_1) || ((interfaceCtx->minigamePerfectType == MINIGAME_PERFECT_TYPE_3) && (interfaceCtx->minigamePerfectState[0] == MINIGAME_PERFECT_STATE_6))) { + interfaceCtx->aButtonVtx[i].v.ob[0] = + interfaceCtx->aButtonVtx[i + 2].v.ob[0] = -((D_801BFA64[k] - offset) + 0x10); - interfaceCtx->actionVtx[i + 1].v.ob[0] = - interfaceCtx->actionVtx[i + 3].v.ob[0] = interfaceCtx->actionVtx[i].v.ob[0] + 0x20; + interfaceCtx->aButtonVtx[i + 1].v.ob[0] = + interfaceCtx->aButtonVtx[i + 3].v.ob[0] = interfaceCtx->aButtonVtx[i].v.ob[0] + 0x20; - interfaceCtx->actionVtx[i].v.ob[1] = - interfaceCtx->actionVtx[i + 1].v.ob[1] = (D_801BFA74[k] - offset) + 0x10; + interfaceCtx->aButtonVtx[i].v.ob[1] = + interfaceCtx->aButtonVtx[i + 1].v.ob[1] = (D_801BFA74[k] - offset) + 0x10; - interfaceCtx->actionVtx[i + 2].v.ob[1] = - interfaceCtx->actionVtx[i + 3].v.ob[1] = interfaceCtx->actionVtx[i].v.ob[1] - 0x21; + interfaceCtx->aButtonVtx[i + 2].v.ob[1] = + interfaceCtx->aButtonVtx[i + 3].v.ob[1] = interfaceCtx->aButtonVtx[i].v.ob[1] - 0x21; - } else if ((interfaceCtx->minigameRewardType == 2) || (interfaceCtx->minigameRewardType == 3)) { - interfaceCtx->actionVtx[i].v.ob[0] = - interfaceCtx->actionVtx[i + 2].v.ob[0] = -(interfaceCtx->unk_2AA[k] - offset + 0x10); + } else if ((interfaceCtx->minigamePerfectType == MINIGAME_PERFECT_TYPE_2) || (interfaceCtx->minigamePerfectType == MINIGAME_PERFECT_TYPE_3)) { + interfaceCtx->aButtonVtx[i].v.ob[0] = + interfaceCtx->aButtonVtx[i + 2].v.ob[0] = -(interfaceCtx->minigamePerfectVtxOffset[k] - offset + 0x10); - interfaceCtx->actionVtx[i + 1].v.ob[0] = - interfaceCtx->actionVtx[i + 3].v.ob[0] = interfaceCtx->actionVtx[i].v.ob[0] + 0x20; + interfaceCtx->aButtonVtx[i + 1].v.ob[0] = + interfaceCtx->aButtonVtx[i + 3].v.ob[0] = interfaceCtx->aButtonVtx[i].v.ob[0] + 0x20; - interfaceCtx->actionVtx[i].v.ob[1] = - interfaceCtx->actionVtx[i + 1].v.ob[1] = 0x10 - offset; + interfaceCtx->aButtonVtx[i].v.ob[1] = + interfaceCtx->aButtonVtx[i + 1].v.ob[1] = 0x10 - offset; - interfaceCtx->actionVtx[i + 2].v.ob[1] = - interfaceCtx->actionVtx[i + 3].v.ob[1] = interfaceCtx->actionVtx[i].v.ob[1] - 0x21; + interfaceCtx->aButtonVtx[i + 2].v.ob[1] = + interfaceCtx->aButtonVtx[i + 3].v.ob[1] = interfaceCtx->aButtonVtx[i].v.ob[1] - 0x21; } else { - interfaceCtx->actionVtx[i].v.ob[0] = - interfaceCtx->actionVtx[i + 2].v.ob[0] = -(0xD8 - offset); + interfaceCtx->aButtonVtx[i].v.ob[0] = + interfaceCtx->aButtonVtx[i + 2].v.ob[0] = -(0xD8 - offset); - interfaceCtx->actionVtx[i + 1].v.ob[0] = - interfaceCtx->actionVtx[i + 3].v.ob[0] = interfaceCtx->actionVtx[i].v.ob[0] + 0x20; + interfaceCtx->aButtonVtx[i + 1].v.ob[0] = + interfaceCtx->aButtonVtx[i + 3].v.ob[0] = interfaceCtx->aButtonVtx[i].v.ob[0] + 0x20; - interfaceCtx->actionVtx[i].v.ob[1] = - interfaceCtx->actionVtx[i + 1].v.ob[1] = 0x18 - offset; + interfaceCtx->aButtonVtx[i].v.ob[1] = + interfaceCtx->aButtonVtx[i + 1].v.ob[1] = 0x18 - offset; - interfaceCtx->actionVtx[i + 2].v.ob[1] = - interfaceCtx->actionVtx[i + 3].v.ob[1] = interfaceCtx->actionVtx[i].v.ob[1] - 0x21; + interfaceCtx->aButtonVtx[i + 2].v.ob[1] = + interfaceCtx->aButtonVtx[i + 3].v.ob[1] = interfaceCtx->aButtonVtx[i].v.ob[1] - 0x21; } - interfaceCtx->actionVtx[i].v.ob[2] = - interfaceCtx->actionVtx[i + 1].v.ob[2] = - interfaceCtx->actionVtx[i + 2].v.ob[2] = - interfaceCtx->actionVtx[i + 3].v.ob[2] = 0; + interfaceCtx->aButtonVtx[i].v.ob[2] = + interfaceCtx->aButtonVtx[i + 1].v.ob[2] = + interfaceCtx->aButtonVtx[i + 2].v.ob[2] = + interfaceCtx->aButtonVtx[i + 3].v.ob[2] = 0; - interfaceCtx->actionVtx[i].v.flag = - interfaceCtx->actionVtx[i + 1].v.flag = - interfaceCtx->actionVtx[i + 2].v.flag = - interfaceCtx->actionVtx[i + 3].v.flag = 0; + interfaceCtx->aButtonVtx[i].v.flag = + interfaceCtx->aButtonVtx[i + 1].v.flag = + interfaceCtx->aButtonVtx[i + 2].v.flag = + interfaceCtx->aButtonVtx[i + 3].v.flag = 0; - interfaceCtx->actionVtx[i].v.tc[0] = - interfaceCtx->actionVtx[i].v.tc[1] = - interfaceCtx->actionVtx[i + 1].v.tc[1] = - interfaceCtx->actionVtx[i + 2].v.tc[0] = 0; + interfaceCtx->aButtonVtx[i].v.tc[0] = + interfaceCtx->aButtonVtx[i].v.tc[1] = + interfaceCtx->aButtonVtx[i + 1].v.tc[1] = + interfaceCtx->aButtonVtx[i + 2].v.tc[0] = 0; - interfaceCtx->actionVtx[i + 1].v.tc[0] = - interfaceCtx->actionVtx[i + 3].v.tc[0] = 0x400; + interfaceCtx->aButtonVtx[i + 1].v.tc[0] = + interfaceCtx->aButtonVtx[i + 3].v.tc[0] = 0x400; - interfaceCtx->actionVtx[i + 2].v.tc[1] = - interfaceCtx->actionVtx[i + 3].v.tc[1] = 0x420; + interfaceCtx->aButtonVtx[i + 2].v.tc[1] = + interfaceCtx->aButtonVtx[i + 3].v.tc[1] = 0x420; - interfaceCtx->actionVtx[i].v.cn[0] = - interfaceCtx->actionVtx[i + 1].v.cn[0] = - interfaceCtx->actionVtx[i + 2].v.cn[0] = - interfaceCtx->actionVtx[i + 3].v.cn[0] = - interfaceCtx->actionVtx[i].v.cn[1] = - interfaceCtx->actionVtx[i + 1].v.cn[1] = - interfaceCtx->actionVtx[i + 2].v.cn[1] = - interfaceCtx->actionVtx[i + 3].v.cn[1] = - interfaceCtx->actionVtx[i].v.cn[2] = - interfaceCtx->actionVtx[i + 1].v.cn[2] = - interfaceCtx->actionVtx[i + 2].v.cn[2] = - interfaceCtx->actionVtx[i + 3].v.cn[2] = 255; + interfaceCtx->aButtonVtx[i].v.cn[0] = + interfaceCtx->aButtonVtx[i + 1].v.cn[0] = + interfaceCtx->aButtonVtx[i + 2].v.cn[0] = + interfaceCtx->aButtonVtx[i + 3].v.cn[0] = + interfaceCtx->aButtonVtx[i].v.cn[1] = + interfaceCtx->aButtonVtx[i + 1].v.cn[1] = + interfaceCtx->aButtonVtx[i + 2].v.cn[1] = + interfaceCtx->aButtonVtx[i + 3].v.cn[1] = + interfaceCtx->aButtonVtx[i].v.cn[2] = + interfaceCtx->aButtonVtx[i + 1].v.cn[2] = + interfaceCtx->aButtonVtx[i + 2].v.cn[2] = + interfaceCtx->aButtonVtx[i + 3].v.cn[2] = 255; - interfaceCtx->actionVtx[i].v.cn[3] = - interfaceCtx->actionVtx[i + 1].v.cn[3] = - interfaceCtx->actionVtx[i + 2].v.cn[3] = - interfaceCtx->actionVtx[i + 3].v.cn[3] = 255; + interfaceCtx->aButtonVtx[i].v.cn[3] = + interfaceCtx->aButtonVtx[i + 1].v.cn[3] = + interfaceCtx->aButtonVtx[i + 2].v.cn[3] = + interfaceCtx->aButtonVtx[i + 3].v.cn[3] = 255; } } @@ -2023,14 +2023,16 @@ void func_80111CB4(PlayState* play) { if (play->transitionMode != TRANS_MODE_OFF) { Interface_SetHudVisibility(HUD_VISIBILITY_NONE); - } else if ((gSaveContext.minigameState == 1) && + } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0)) && (Cutscene_GetSceneSetupIndex(play) != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF)) { Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); - } else if ((gSaveContext.minigameState == 1) && (gSaveContext.eventInf[3] & 0x20)) { + } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && + (gSaveContext.eventInf[3] & 0x20)) { Interface_SetHudVisibility(HUD_VISIBILITY_B_MINIMAP); - } else if (!(gSaveContext.save.weekEventReg[0x52] & 8) && (gSaveContext.minigameState == 1)) { + } else if (!(gSaveContext.save.weekEventReg[0x52] & 8) && + (gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE)) { Interface_SetHudVisibility(HUD_VISIBILITY_B); } else if (play->unk_1887C >= 2) { Interface_SetHudVisibility(HUD_VISIBILITY_B); @@ -2083,11 +2085,11 @@ void func_80111CB4(PlayState* play) { if (play->transitionMode != TRANS_MODE_OFF) { Interface_SetHudVisibility(HUD_VISIBILITY_NONE); - } else if ((gSaveContext.minigameState == 1) && + } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0)) && (Cutscene_GetSceneSetupIndex(play) != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF)) { Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); - } else if (gSaveContext.minigameState == 1) { + } else if (gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) { Interface_SetHudVisibility(HUD_VISIBILITY_B); } else if (play->unk_1887C >= 2) { Interface_SetHudVisibility(HUD_VISIBILITY_B); @@ -2151,7 +2153,8 @@ void func_80111CB4(PlayState* play) { D_801BF888 = false; } } - } else if ((gSaveContext.minigameState == 1) && (gSaveContext.save.entrance == ENTRANCE(WATERFALL_RAPIDS, 1)) && + } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && + (gSaveContext.save.entrance == ENTRANCE(WATERFALL_RAPIDS, 1)) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; @@ -2212,20 +2215,20 @@ void Interface_SetSceneRestrictions(PlayState* play) { } while (sRestrictionFlags[i].scene != 0xFF); } -void func_80112AF4(void) { +void Interface_Noop(void) { } void Interface_InitMinigame(PlayState* play) { InterfaceContext* interfaceCtx = &play->interfaceCtx; - gSaveContext.minigameState = 1; + gSaveContext.minigameStatus = MINIGAME_STATUS_ACTIVE; gSaveContext.minigameScore = 0; - gSaveContext.unk_3F3C = 0; + gSaveContext.minigameHiddenScore = 0; sHBAScoreTier = 0; - interfaceCtx->unk_25C = interfaceCtx->unk_25E = interfaceCtx->unk_262 = 0; + interfaceCtx->minigamePoints = interfaceCtx->minigameHiddenPoints = interfaceCtx->minigameUnusedPoints = 0; - interfaceCtx->hbaAmmo = 20; + interfaceCtx->minigameAmmo = 20; } void Interface_LoadItemIconImpl(PlayState* play, u8 btn) { @@ -2905,7 +2908,7 @@ void Inventory_UpdateDeitySwordEquip(PlayState* play) { u8 btn; if (CUR_FORM == PLAYER_FORM_FIERCE_DEITY) { - interfaceCtx->unk_21C = 0; + interfaceCtx->bButtonDoActionActive = false; interfaceCtx->bButtonDoAction = 0; // Is simply checking if (gSaveContext.save.playerForm == PLAYER_FORM_FIERCE_DEITY) @@ -3072,10 +3075,10 @@ void Interface_SetBButtonDoAction(PlayState* play, s16 bButtonDoAction) { osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK); } - interfaceCtx->unk_21C = 1; + interfaceCtx->bButtonDoActionActive = true; } } else { - interfaceCtx->unk_21C = 0; + interfaceCtx->bButtonDoActionActive = false; interfaceCtx->bButtonDoAction = 0; } } @@ -3873,8 +3876,8 @@ void Interface_DrawAmmoCount(PlayState* play, s16 button, s16 alpha) { gDPPipeSync(OVERLAY_DISP++); - if ((button == 0) && (gSaveContext.minigameState == 1)) { - ammo = play->interfaceCtx.hbaAmmo; + if ((button == 0) && (gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE)) { + ammo = play->interfaceCtx.minigameAmmo; } else if ((button == 0) && (play->unk_1887C > 1)) { ammo = play->unk_1887C - 1; } else if (((i == ITEM_BOW) && (AMMO(i) == CUR_CAPACITY(UPG_QUIVER))) || @@ -3926,8 +3929,8 @@ void func_80118084(PlayState* play) { Interface_DrawAmmoCount(play, 0, interfaceCtx->bAlpha); } - } else if (((interfaceCtx->unk_21C == 0) && (interfaceCtx->unk_222 == 0)) || - (((interfaceCtx->unk_21C != 0) && + } else if ((!interfaceCtx->bButtonDoActionActive && (interfaceCtx->unk_222 == 0)) || + ((interfaceCtx->bButtonDoActionActive && ((BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) < ITEM_SWORD_KOKIRI) || (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) > ITEM_SWORD_GILDED)) && BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NONE) && @@ -3943,9 +3946,10 @@ void func_80118084(PlayState* play) { if ((play->sceneNum != SCENE_SYATEKI_MIZU) && (play->sceneNum != SCENE_SYATEKI_MORI) && (play->sceneNum != SCENE_BOWLING) && - ((gSaveContext.minigameState != 1) || + ((gSaveContext.minigameStatus != MINIGAME_STATUS_ACTIVE) || (gSaveContext.save.entrance != ENTRANCE(ROMANI_RANCH, 0))) && - ((gSaveContext.minigameState != 1) || !(gSaveContext.eventInf[3] & 0x20)) && + ((gSaveContext.minigameStatus != MINIGAME_STATUS_ACTIVE) || + !(gSaveContext.eventInf[3] & 0x20)) && (!(gSaveContext.save.weekEventReg[31] & 0x80) || (play->unk_1887C != 0x64))) { Interface_DrawAmmoCount(play, 0, interfaceCtx->bAlpha); } @@ -4060,14 +4064,14 @@ void func_80118BA4(PlayState* play) { gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPPipeSync(OVERLAY_DISP++); - gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[4], 4, 0); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->aButtonVtx[4], 4, 0); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, aAlpha); OVERLAY_DISP = Gfx_DrawQuadTextureIA8(OVERLAY_DISP, gButtonBackgroundTex, 32, 32, 0); gDPPipeSync(OVERLAY_DISP++); Interface_SetView1(play, XREG(31) + 0x17, XREG(31) + 0x44, 190, 235); - gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[0], 4, 0); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->aButtonVtx[0], 4, 0); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 100, 200, 255, interfaceCtx->aAlpha); gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0); @@ -4083,7 +4087,7 @@ void func_80118BA4(PlayState* play) { Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); Matrix_RotateXFApply(interfaceCtx->unk_218 / 10000.0f); gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[8], 4, 0); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->aButtonVtx[8], 4, 0); // Draw Action Label if (((interfaceCtx->unk_210 < 2) || (interfaceCtx->unk_210 == 3))) { @@ -4450,7 +4454,7 @@ void Interface_DrawClock(PlayState* play) { gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[12], 4, 0); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->aButtonVtx[12], 4, 0); gDPLoadTextureBlock_4b(OVERLAY_DISP++, gThreeDayClockStarMinuteTex, G_IM_FMT_I, 16, 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); @@ -4486,7 +4490,7 @@ void Interface_DrawClock(PlayState* play) { gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[16], 4, 0); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->aButtonVtx[16], 4, 0); OVERLAY_DISP = Gfx_DrawQuadTextureIA8(OVERLAY_DISP, gThreeDayClockSunHourTex, 24, 24, 0); @@ -4504,7 +4508,7 @@ void Interface_DrawClock(PlayState* play) { Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[20], 4, 0); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->aButtonVtx[20], 4, 0); OVERLAY_DISP = Gfx_DrawQuadTextureIA8(OVERLAY_DISP, gThreeDayClockMoonHourTex, 24, 24, 0); @@ -4531,7 +4535,7 @@ void Interface_DrawClock(PlayState* play) { gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, D_801BFB2C); - gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[24], 8, 0); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->aButtonVtx[24], 8, 0); OVERLAY_DISP = Gfx_DrawQuadTexture(OVERLAY_DISP, D_801BFB6C[sp1C6], 4, 16, 11, 0); @@ -4555,7 +4559,7 @@ void Interface_DrawClock(PlayState* play) { gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, D_801BFB2C); - gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[32], 8, 0); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->aButtonVtx[32], 8, 0); OVERLAY_DISP = Gfx_DrawQuadTexture(OVERLAY_DISP, D_801BFB6C[sp1C6], 4, 16, 11, 0); @@ -4758,43 +4762,46 @@ void Interface_DrawClock(PlayState* play); #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_DrawClock.s") #endif -void Interface_SetPerfectMinigame(PlayState* play, s16 rewardType) { +void Interface_SetMinigamePerfect(PlayState* play, s16 minigamePerfectType) { InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 i; interfaceCtx->isMinigamePerfect = true; - interfaceCtx->minigameRewardType = rewardType; - interfaceCtx->unk_2FC[0] = 255; - interfaceCtx->unk_2FC[1] = 165; - interfaceCtx->unk_2FC[2] = 55; - interfaceCtx->unk_2FC[3] = 255; - interfaceCtx->unk_30A = 20; - interfaceCtx->unk_308 = 0; - interfaceCtx->unk_304 = 1; - interfaceCtx->unk_30C = 0; + interfaceCtx->minigamePerfectType = minigamePerfectType; + + interfaceCtx->minigamePerfectPrimColor[0] = 255; + interfaceCtx->minigamePerfectPrimColor[1] = 165; + interfaceCtx->minigamePerfectPrimColor[2] = 55; + interfaceCtx->minigamePerfectPrimColor[3] = 255; + interfaceCtx->minigamePerfectColorTimer = 20; + + interfaceCtx->minigamePerfectColorTargetIndex = 0; + interfaceCtx->minigamePerfectLetterCount = 1; + interfaceCtx->minigamePerfectTimer = 0; for (i = 0; i < 8; i++) { - interfaceCtx->unk_2AA[i] = 0; - interfaceCtx->unk_29A[i] = 0; - interfaceCtx->unk_28A[i] = interfaceCtx->unk_2AA[i]; - if (interfaceCtx->minigameRewardType == 1) { - interfaceCtx->unk_2BC[i] = 140.0f; - interfaceCtx->unk_2DC[i] = 100.0f; + interfaceCtx->minigamePerfectLetterDirection[i] = 0; + interfaceCtx->minigamePerfectState[i] = interfaceCtx->minigamePerfectVtxOffset[i] = 0; + if (interfaceCtx->minigamePerfectType == MINIGAME_PERFECT_TYPE_1) { + interfaceCtx->minigamePerfectLetterPosX[i] = 140.0f; + interfaceCtx->minigamePerfectLetterPosY[i] = 100.0f; } else { - interfaceCtx->unk_2DC[i] = 200.0f; - interfaceCtx->unk_2BC[i] = 200.0f; + interfaceCtx->minigamePerfectLetterPosY[i] = 200.0f; + interfaceCtx->minigamePerfectLetterPosX[i] = 200.0f; } } - interfaceCtx->unk_28A[0] = 1; + interfaceCtx->minigamePerfectState[0] = MINIGAME_PERFECT_STATE_1; } -void func_8011B5C0(PlayState* play) { - static u16 D_801BFC50[] = { - 0xC000, 0xE000, 0x0000, 0x2000, 0xA000, 0x8000, 0x6000, 0x4000, - }; - static s16 D_801BFC60[][3] = { - 255, 255, 255, 255, 165, 55, - }; +u16 D_801BFC50[] = { + 0xC000, 0xE000, 0x0000, 0x2000, 0xA000, 0x8000, 0x6000, 0x4000, +}; +s16 sMinigamePerfectType1PrimColorTargets[2][3] = { + { 255, 255, 255 }, + { 255, 165, 55 }, +}; + +void Interface_UpdateMinigamePerfectType1(PlayState* play) { InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 i; s16 count; @@ -4802,72 +4809,84 @@ void func_8011B5C0(PlayState* play) { s16 colorStepG; s16 colorStepB; - for (count = 0, i = 0; i < interfaceCtx->unk_304; i++, count += 4) { - if (interfaceCtx->unk_28A[i] == 1) { - interfaceCtx->unk_29A[i] = D_801BFC50[i] + 0xA000; - interfaceCtx->unk_28A[i] = 2; - } else if (interfaceCtx->unk_28A[i] == 2) { - interfaceCtx->unk_29A[i] -= 0x800; - if (interfaceCtx->unk_29A[i] == D_801BFC50[i]) { - interfaceCtx->unk_28A[i] = 3; + for (count = 0, i = 0; i < interfaceCtx->minigamePerfectLetterCount; i++, count += 4) { + if (interfaceCtx->minigamePerfectState[i] == MINIGAME_PERFECT_STATE_1) { + interfaceCtx->minigamePerfectLetterDirection[i] = D_801BFC50[i] + 0xA000; + interfaceCtx->minigamePerfectState[i] = MINIGAME_PERFECT_STATE_2; + } else if (interfaceCtx->minigamePerfectState[i] == MINIGAME_PERFECT_STATE_2) { + interfaceCtx->minigamePerfectLetterDirection[i] -= 0x800; + if (interfaceCtx->minigamePerfectLetterDirection[i] == D_801BFC50[i]) { + interfaceCtx->minigamePerfectState[i] = MINIGAME_PERFECT_STATE_3; } - } else if (interfaceCtx->unk_28A[i] == 4) { - interfaceCtx->unk_29A[i] -= 0x800; - if (interfaceCtx->unk_29A[i] == (u16)(D_801BFC50[i] - 0x8000)) { - interfaceCtx->unk_28A[i] = 0; + } else if (interfaceCtx->minigamePerfectState[i] == MINIGAME_PERFECT_STATE_4) { + interfaceCtx->minigamePerfectLetterDirection[i] -= 0x800; + if (interfaceCtx->minigamePerfectLetterDirection[i] == (u16)(D_801BFC50[i] - 0x8000)) { + interfaceCtx->minigamePerfectState[i] = MINIGAME_PERFECT_STATE_0; } } } - if ((interfaceCtx->unk_28A[interfaceCtx->unk_304] == 0) && (interfaceCtx->unk_304 < 8)) { - interfaceCtx->unk_28A[interfaceCtx->unk_304] = 1; - interfaceCtx->unk_2BC[interfaceCtx->unk_304] = 140.0f; - interfaceCtx->unk_2DC[interfaceCtx->unk_304] = 100.0f; - interfaceCtx->unk_29A[interfaceCtx->unk_304] = D_801BFC50[interfaceCtx->unk_304] + 0xA000; - interfaceCtx->unk_304++; + if ((interfaceCtx->minigamePerfectState[interfaceCtx->minigamePerfectLetterCount] == MINIGAME_PERFECT_STATE_0) && + (interfaceCtx->minigamePerfectLetterCount < 8)) { + interfaceCtx->minigamePerfectState[interfaceCtx->minigamePerfectLetterCount] = MINIGAME_PERFECT_STATE_1; + interfaceCtx->minigamePerfectLetterPosX[interfaceCtx->minigamePerfectLetterCount] = 140.0f; + interfaceCtx->minigamePerfectLetterPosY[interfaceCtx->minigamePerfectLetterCount] = 100.0f; + interfaceCtx->minigamePerfectLetterDirection[interfaceCtx->minigamePerfectLetterCount] = + D_801BFC50[interfaceCtx->minigamePerfectLetterCount] + 0xA000; + interfaceCtx->minigamePerfectLetterCount++; } - if ((interfaceCtx->unk_304 == 8) && (interfaceCtx->unk_28A[7] == 3)) { + if ((interfaceCtx->minigamePerfectLetterCount == 8) && + (interfaceCtx->minigamePerfectState[7] == MINIGAME_PERFECT_STATE_3)) { - colorStepR = ABS_ALT(interfaceCtx->unk_2FC[0] - D_801BFC60[interfaceCtx->unk_308][0]) / interfaceCtx->unk_30A; - colorStepG = ABS_ALT(interfaceCtx->unk_2FC[1] - D_801BFC60[interfaceCtx->unk_308][1]) / interfaceCtx->unk_30A; - colorStepB = ABS_ALT(interfaceCtx->unk_2FC[2] - D_801BFC60[interfaceCtx->unk_308][2]) / interfaceCtx->unk_30A; + colorStepR = ABS_ALT(interfaceCtx->minigamePerfectPrimColor[0] - + sMinigamePerfectType1PrimColorTargets[interfaceCtx->minigamePerfectColorTargetIndex][0]) / + interfaceCtx->minigamePerfectColorTimer; + colorStepG = ABS_ALT(interfaceCtx->minigamePerfectPrimColor[1] - + sMinigamePerfectType1PrimColorTargets[interfaceCtx->minigamePerfectColorTargetIndex][1]) / + interfaceCtx->minigamePerfectColorTimer; + colorStepB = ABS_ALT(interfaceCtx->minigamePerfectPrimColor[2] - + sMinigamePerfectType1PrimColorTargets[interfaceCtx->minigamePerfectColorTargetIndex][2]) / + interfaceCtx->minigamePerfectColorTimer; - if (interfaceCtx->unk_2FC[0] >= D_801BFC60[interfaceCtx->unk_308][0]) { - interfaceCtx->unk_2FC[0] -= colorStepR; + if (interfaceCtx->minigamePerfectPrimColor[0] >= + sMinigamePerfectType1PrimColorTargets[interfaceCtx->minigamePerfectColorTargetIndex][0]) { + interfaceCtx->minigamePerfectPrimColor[0] -= colorStepR; } else { - interfaceCtx->unk_2FC[0] += colorStepR; + interfaceCtx->minigamePerfectPrimColor[0] += colorStepR; } - if (interfaceCtx->unk_2FC[1] >= D_801BFC60[interfaceCtx->unk_308][1]) { - interfaceCtx->unk_2FC[1] -= colorStepG; + if (interfaceCtx->minigamePerfectPrimColor[1] >= + sMinigamePerfectType1PrimColorTargets[interfaceCtx->minigamePerfectColorTargetIndex][1]) { + interfaceCtx->minigamePerfectPrimColor[1] -= colorStepG; } else { - interfaceCtx->unk_2FC[1] += colorStepG; + interfaceCtx->minigamePerfectPrimColor[1] += colorStepG; } - if (interfaceCtx->unk_2FC[2] >= D_801BFC60[interfaceCtx->unk_308][2]) { - interfaceCtx->unk_2FC[2] -= colorStepB; + if (interfaceCtx->minigamePerfectPrimColor[2] >= + sMinigamePerfectType1PrimColorTargets[interfaceCtx->minigamePerfectColorTargetIndex][2]) { + interfaceCtx->minigamePerfectPrimColor[2] -= colorStepB; } else { - interfaceCtx->unk_2FC[2] += colorStepB; + interfaceCtx->minigamePerfectPrimColor[2] += colorStepB; } - interfaceCtx->unk_30A--; + interfaceCtx->minigamePerfectColorTimer--; - if (interfaceCtx->unk_30A == 0) { - interfaceCtx->unk_30A = 20; - interfaceCtx->unk_308 ^= 1; - interfaceCtx->unk_30C++; + if (interfaceCtx->minigamePerfectColorTimer == 0) { + interfaceCtx->minigamePerfectColorTimer = 20; + interfaceCtx->minigamePerfectColorTargetIndex ^= 1; + interfaceCtx->minigamePerfectTimer++; - if (interfaceCtx->unk_30C == 6) { + if (interfaceCtx->minigamePerfectTimer == 6) { for (i = 0; i < 8; i++) { - interfaceCtx->unk_28A[i] = 4; + interfaceCtx->minigamePerfectState[i] = MINIGAME_PERFECT_STATE_4; } } } } for (count = 0, i = 0; i < 8; i++) { - if (interfaceCtx->unk_28A[i] == 0) { + if (interfaceCtx->minigamePerfectState[i] == MINIGAME_PERFECT_STATE_0) { count++; } } @@ -4883,12 +4902,12 @@ s16 D_801BFC6C[] = { s16 D_801BFC7C[] = { 0x00B4, 0x00B4, 0x00B4, 0x00B4, 0xFF4C, 0xFF4C, 0xFF4C, 0xFF4C, }; -s16 D_801BFC8C[2][3] = { - { 0xFF, 0xFF, 0xFF }, - { 0xFF, 0xA5, 0x37 }, +s16 sMinigamePerfectType2PrimColorTargets[2][3] = { + { 255, 255, 255 }, + { 255, 165, 55 }, }; -void func_8011B9E0(PlayState* play) { +void Interface_UpdateMinigamePerfectType2(PlayState* play) { s16 i; InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 stepVar1; @@ -4897,115 +4916,130 @@ void func_8011B9E0(PlayState* play) { s16 new_var; s16 j = 0; // unused incrementer - for (i = 0; i < interfaceCtx->unk_304; i++, j += 4) { - if (interfaceCtx->unk_28A[i] == 1) { - interfaceCtx->unk_29A[i] = i << 0xD; - interfaceCtx->unk_2BC[i] = 200.0f; - interfaceCtx->unk_2DC[i] = 200.0f; - interfaceCtx->unk_2AA[i] = 0; - interfaceCtx->unk_28A[i] = 2; - } else if (interfaceCtx->unk_28A[i] == 2) { - interfaceCtx->unk_29A[i] -= 0x800; - interfaceCtx->unk_2BC[i] -= 8.0f; - interfaceCtx->unk_2DC[i] -= 8.0f; - if (interfaceCtx->unk_2BC[i] <= 0.0f) { - interfaceCtx->unk_2DC[i] = 0.0f; - interfaceCtx->unk_2BC[i] = 0.0f; - interfaceCtx->unk_28A[i] = 3; + for (i = 0; i < interfaceCtx->minigamePerfectLetterCount; i++, j += 4) { + if (interfaceCtx->minigamePerfectState[i] == MINIGAME_PERFECT_STATE_1) { + interfaceCtx->minigamePerfectLetterDirection[i] = i << 0xD; + interfaceCtx->minigamePerfectLetterPosX[i] = 200.0f; + interfaceCtx->minigamePerfectLetterPosY[i] = 200.0f; + interfaceCtx->minigamePerfectVtxOffset[i] = 0; + interfaceCtx->minigamePerfectState[i] = MINIGAME_PERFECT_STATE_2; + } else if (interfaceCtx->minigamePerfectState[i] == MINIGAME_PERFECT_STATE_2) { + interfaceCtx->minigamePerfectLetterDirection[i] -= 0x800; + interfaceCtx->minigamePerfectLetterPosX[i] -= 8.0f; + interfaceCtx->minigamePerfectLetterPosY[i] -= 8.0f; + if (interfaceCtx->minigamePerfectLetterPosX[i] <= 0.0f) { + interfaceCtx->minigamePerfectLetterPosY[i] = 0.0f; + interfaceCtx->minigamePerfectLetterPosX[i] = 0.0f; + interfaceCtx->minigamePerfectState[i] = MINIGAME_PERFECT_STATE_3; if (i == 7) { - interfaceCtx->unk_30A = 5; - interfaceCtx->unk_28A[7] = 4; - interfaceCtx->unk_28A[6] = interfaceCtx->unk_28A[7]; - interfaceCtx->unk_28A[5] = interfaceCtx->unk_28A[7]; - interfaceCtx->unk_28A[4] = interfaceCtx->unk_28A[7]; - interfaceCtx->unk_28A[3] = interfaceCtx->unk_28A[7]; - interfaceCtx->unk_28A[2] = interfaceCtx->unk_28A[7]; - interfaceCtx->unk_28A[1] = interfaceCtx->unk_28A[7]; - interfaceCtx->unk_28A[0] = interfaceCtx->unk_28A[7]; + interfaceCtx->minigamePerfectColorTimer = 5; + interfaceCtx->minigamePerfectState[7] = MINIGAME_PERFECT_STATE_4; + interfaceCtx->minigamePerfectState[6] = interfaceCtx->minigamePerfectState[7]; + interfaceCtx->minigamePerfectState[5] = interfaceCtx->minigamePerfectState[7]; + interfaceCtx->minigamePerfectState[4] = interfaceCtx->minigamePerfectState[7]; + interfaceCtx->minigamePerfectState[3] = interfaceCtx->minigamePerfectState[7]; + interfaceCtx->minigamePerfectState[2] = interfaceCtx->minigamePerfectState[7]; + interfaceCtx->minigamePerfectState[1] = interfaceCtx->minigamePerfectState[7]; + interfaceCtx->minigamePerfectState[0] = interfaceCtx->minigamePerfectState[7]; } } - } else if (interfaceCtx->unk_28A[i] == 4) { + } else if (interfaceCtx->minigamePerfectState[i] == MINIGAME_PERFECT_STATE_4) { - stepVar1 = ABS_ALT(interfaceCtx->unk_2AA[i] - D_801BFC6C[i]) / interfaceCtx->unk_30A; - if (interfaceCtx->unk_2AA[i] >= D_801BFC6C[i]) { - interfaceCtx->unk_2AA[i] -= stepVar1; + stepVar1 = ABS_ALT(interfaceCtx->minigamePerfectVtxOffset[i] - D_801BFC6C[i]) / + interfaceCtx->minigamePerfectColorTimer; + if (interfaceCtx->minigamePerfectVtxOffset[i] >= D_801BFC6C[i]) { + interfaceCtx->minigamePerfectVtxOffset[i] -= stepVar1; } else { - interfaceCtx->unk_2AA[i] += stepVar1; + interfaceCtx->minigamePerfectVtxOffset[i] += stepVar1; } - } else if (interfaceCtx->unk_28A[i] == 6) { + } else if (interfaceCtx->minigamePerfectState[i] == MINIGAME_PERFECT_STATE_6) { - stepVar1 = ABS_ALT(interfaceCtx->unk_2AA[i] - D_801BFC7C[i]) / interfaceCtx->unk_30A; - if (interfaceCtx->unk_2AA[i] >= D_801BFC7C[i]) { - interfaceCtx->unk_2AA[i] -= stepVar1; + stepVar1 = ABS_ALT(interfaceCtx->minigamePerfectVtxOffset[i] - D_801BFC7C[i]) / + interfaceCtx->minigamePerfectColorTimer; + if (interfaceCtx->minigamePerfectVtxOffset[i] >= D_801BFC7C[i]) { + interfaceCtx->minigamePerfectVtxOffset[i] -= stepVar1; } else { - interfaceCtx->unk_2AA[i] += stepVar1; + interfaceCtx->minigamePerfectVtxOffset[i] += stepVar1; } } } - if ((interfaceCtx->unk_28A[0] == 4) || (interfaceCtx->unk_28A[0] == 6)) { - if (interfaceCtx->unk_28A[0] == 6) { - new_var = interfaceCtx->unk_2FC[3] / interfaceCtx->unk_30A; - interfaceCtx->unk_2FC[3] -= new_var; + if ((interfaceCtx->minigamePerfectState[0] == MINIGAME_PERFECT_STATE_4) || + (interfaceCtx->minigamePerfectState[0] == MINIGAME_PERFECT_STATE_6)) { + if (interfaceCtx->minigamePerfectState[0] == MINIGAME_PERFECT_STATE_6) { + new_var = interfaceCtx->minigamePerfectPrimColor[3] / interfaceCtx->minigamePerfectColorTimer; + interfaceCtx->minigamePerfectPrimColor[3] -= new_var; } - interfaceCtx->unk_30A--; - if (interfaceCtx->unk_30A == 0) { + interfaceCtx->minigamePerfectColorTimer--; + if (interfaceCtx->minigamePerfectColorTimer == 0) { - if (interfaceCtx->unk_28A[0] == 4) { + if (interfaceCtx->minigamePerfectState[0] == MINIGAME_PERFECT_STATE_4) { for (i = 0; i < 8; i++) { - interfaceCtx->unk_28A[i] = 5; + interfaceCtx->minigamePerfectState[i] = MINIGAME_PERFECT_STATE_5; } - interfaceCtx->unk_30A = 20; + interfaceCtx->minigamePerfectColorTimer = 20; } else { for (i = 0; i < 8; i++) { - interfaceCtx->unk_28A[i] = 0; + interfaceCtx->minigamePerfectState[i] = MINIGAME_PERFECT_STATE_0; } - interfaceCtx->isMinigamePerfect = 0; + interfaceCtx->isMinigamePerfect = false; } } } - if (interfaceCtx->unk_28A[interfaceCtx->unk_304] == 0) { - if (interfaceCtx->unk_304 < 8) { - interfaceCtx->unk_28A[interfaceCtx->unk_304] = 1; - interfaceCtx->unk_304++; + if (interfaceCtx->minigamePerfectState[interfaceCtx->minigamePerfectLetterCount] == MINIGAME_PERFECT_STATE_0) { + if (interfaceCtx->minigamePerfectLetterCount < 8) { + interfaceCtx->minigamePerfectState[interfaceCtx->minigamePerfectLetterCount] = MINIGAME_PERFECT_STATE_1; + interfaceCtx->minigamePerfectLetterCount++; } } - if (interfaceCtx->unk_304 == 8) { - if (interfaceCtx->unk_28A[7] == 5) { + if (interfaceCtx->minigamePerfectLetterCount == 8) { + if (interfaceCtx->minigamePerfectState[7] == MINIGAME_PERFECT_STATE_5) { - stepVar1 = ABS_ALT(interfaceCtx->unk_2FC[0] - D_801BFC8C[interfaceCtx->unk_308][0]) / interfaceCtx->unk_30A; - stepVar2 = ABS_ALT(interfaceCtx->unk_2FC[1] - D_801BFC8C[interfaceCtx->unk_308][1]) / interfaceCtx->unk_30A; - stepVar3 = ABS_ALT(interfaceCtx->unk_2FC[2] - D_801BFC8C[interfaceCtx->unk_308][2]) / interfaceCtx->unk_30A; + stepVar1 = + ABS_ALT(interfaceCtx->minigamePerfectPrimColor[0] - + sMinigamePerfectType2PrimColorTargets[interfaceCtx->minigamePerfectColorTargetIndex][0]) / + interfaceCtx->minigamePerfectColorTimer; + stepVar2 = + ABS_ALT(interfaceCtx->minigamePerfectPrimColor[1] - + sMinigamePerfectType2PrimColorTargets[interfaceCtx->minigamePerfectColorTargetIndex][1]) / + interfaceCtx->minigamePerfectColorTimer; + stepVar3 = + ABS_ALT(interfaceCtx->minigamePerfectPrimColor[2] - + sMinigamePerfectType2PrimColorTargets[interfaceCtx->minigamePerfectColorTargetIndex][2]) / + interfaceCtx->minigamePerfectColorTimer; - if (interfaceCtx->unk_2FC[0] >= D_801BFC8C[interfaceCtx->unk_308][0]) { - interfaceCtx->unk_2FC[0] -= stepVar1; + if (interfaceCtx->minigamePerfectPrimColor[0] >= + sMinigamePerfectType2PrimColorTargets[interfaceCtx->minigamePerfectColorTargetIndex][0]) { + interfaceCtx->minigamePerfectPrimColor[0] -= stepVar1; } else { - interfaceCtx->unk_2FC[0] += stepVar1; + interfaceCtx->minigamePerfectPrimColor[0] += stepVar1; } - if (interfaceCtx->unk_2FC[1] >= D_801BFC8C[interfaceCtx->unk_308][1]) { - interfaceCtx->unk_2FC[1] -= stepVar2; + if (interfaceCtx->minigamePerfectPrimColor[1] >= + sMinigamePerfectType2PrimColorTargets[interfaceCtx->minigamePerfectColorTargetIndex][1]) { + interfaceCtx->minigamePerfectPrimColor[1] -= stepVar2; } else { - interfaceCtx->unk_2FC[1] += stepVar2; + interfaceCtx->minigamePerfectPrimColor[1] += stepVar2; } - if (interfaceCtx->unk_2FC[2] >= D_801BFC8C[interfaceCtx->unk_308][2]) { - interfaceCtx->unk_2FC[2] -= stepVar3; + if (interfaceCtx->minigamePerfectPrimColor[2] >= + sMinigamePerfectType2PrimColorTargets[interfaceCtx->minigamePerfectColorTargetIndex][2]) { + interfaceCtx->minigamePerfectPrimColor[2] -= stepVar3; } else { - interfaceCtx->unk_2FC[2] += stepVar3; + interfaceCtx->minigamePerfectPrimColor[2] += stepVar3; } - interfaceCtx->unk_30A--; - if (interfaceCtx->unk_30A == 0) { - interfaceCtx->unk_30A = 20; - interfaceCtx->unk_308 ^= 1; - interfaceCtx->unk_30C++; - if (interfaceCtx->unk_30C == 6) { + interfaceCtx->minigamePerfectColorTimer--; + if (interfaceCtx->minigamePerfectColorTimer == 0) { + interfaceCtx->minigamePerfectColorTimer = 20; + interfaceCtx->minigamePerfectColorTargetIndex ^= 1; + interfaceCtx->minigamePerfectTimer++; + if (interfaceCtx->minigamePerfectTimer == 6) { for (i = 0; i < 8; i++) { - interfaceCtx->unk_28A[i] = 6; + interfaceCtx->minigamePerfectState[i] = MINIGAME_PERFECT_STATE_6; } - interfaceCtx->unk_30A = 5; + interfaceCtx->minigamePerfectColorTimer = 5; } } } @@ -5018,12 +5052,12 @@ s16 D_801BFC98[] = { u16 D_801BFCA8[] = { 0xC000, 0xE000, 0x0000, 0x2000, 0xA000, 0x8000, 0x6000, 0x4000, }; -s16 D_801BFCB8[2][3] = { - { 0xFF, 0xFF, 0xFF }, - { 0xFF, 0xA5, 0x37 }, +s16 sMinigamePerfectType3PrimColorTargets[2][3] = { + { 255, 255, 255 }, + { 255, 165, 55 }, }; -void func_8011BF70(PlayState* play) { +void Interface_UpdateMinigamePerfectType3(PlayState* play) { s16 i; InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 stepVar1; @@ -5032,113 +5066,125 @@ void func_8011BF70(PlayState* play) { s16 stepVar4; s16 j = 0; - for (i = 0; i < interfaceCtx->unk_304; i++, j += 4) { - if (interfaceCtx->unk_28A[i] == 1) { - interfaceCtx->unk_29A[i] = i << 0xD; - interfaceCtx->unk_2BC[i] = 200.0f; - interfaceCtx->unk_2DC[i] = 200.0f; - interfaceCtx->unk_2AA[i] = 0; - interfaceCtx->unk_28A[i] = 2; - } else if (interfaceCtx->unk_28A[i] == 2) { - interfaceCtx->unk_29A[i] -= 0x800; - interfaceCtx->unk_2BC[i] -= 8.0f; - interfaceCtx->unk_2DC[i] -= 8.0f; - if (interfaceCtx->unk_2BC[i] <= 0.0f) { - interfaceCtx->unk_2DC[i] = 0.0f; - interfaceCtx->unk_2BC[i] = 0.0f; - interfaceCtx->unk_28A[i] = 3; + for (i = 0; i < interfaceCtx->minigamePerfectLetterCount; i++, j += 4) { + if (interfaceCtx->minigamePerfectState[i] == MINIGAME_PERFECT_STATE_1) { + interfaceCtx->minigamePerfectLetterDirection[i] = i << 0xD; + interfaceCtx->minigamePerfectLetterPosX[i] = 200.0f; + interfaceCtx->minigamePerfectLetterPosY[i] = 200.0f; + interfaceCtx->minigamePerfectVtxOffset[i] = 0; + interfaceCtx->minigamePerfectState[i] = MINIGAME_PERFECT_STATE_2; + } else if (interfaceCtx->minigamePerfectState[i] == MINIGAME_PERFECT_STATE_2) { + interfaceCtx->minigamePerfectLetterDirection[i] -= 0x800; + interfaceCtx->minigamePerfectLetterPosX[i] -= 8.0f; + interfaceCtx->minigamePerfectLetterPosY[i] -= 8.0f; + if (interfaceCtx->minigamePerfectLetterPosX[i] <= 0.0f) { + interfaceCtx->minigamePerfectLetterPosY[i] = 0.0f; + interfaceCtx->minigamePerfectLetterPosX[i] = 0.0f; + interfaceCtx->minigamePerfectState[i] = MINIGAME_PERFECT_STATE_3; if (i == 7) { - interfaceCtx->unk_28A[7] = 4; - interfaceCtx->unk_30A = 5; - interfaceCtx->unk_28A[6] = interfaceCtx->unk_28A[7]; - interfaceCtx->unk_28A[5] = interfaceCtx->unk_28A[7]; - interfaceCtx->unk_28A[4] = interfaceCtx->unk_28A[7]; - interfaceCtx->unk_28A[3] = interfaceCtx->unk_28A[7]; - interfaceCtx->unk_28A[2] = interfaceCtx->unk_28A[7]; - interfaceCtx->unk_28A[1] = interfaceCtx->unk_28A[7]; - interfaceCtx->unk_28A[0] = interfaceCtx->unk_28A[7]; + interfaceCtx->minigamePerfectState[7] = MINIGAME_PERFECT_STATE_4; + interfaceCtx->minigamePerfectColorTimer = 5; + interfaceCtx->minigamePerfectState[6] = interfaceCtx->minigamePerfectState[7]; + interfaceCtx->minigamePerfectState[5] = interfaceCtx->minigamePerfectState[7]; + interfaceCtx->minigamePerfectState[4] = interfaceCtx->minigamePerfectState[7]; + interfaceCtx->minigamePerfectState[3] = interfaceCtx->minigamePerfectState[7]; + interfaceCtx->minigamePerfectState[2] = interfaceCtx->minigamePerfectState[7]; + interfaceCtx->minigamePerfectState[1] = interfaceCtx->minigamePerfectState[7]; + interfaceCtx->minigamePerfectState[0] = interfaceCtx->minigamePerfectState[7]; } } - } else if (interfaceCtx->unk_28A[i] == 4) { - stepVar1 = ABS_ALT(interfaceCtx->unk_2AA[i] - D_801BFC98[i]) / interfaceCtx->unk_30A; - if (interfaceCtx->unk_2AA[i] >= D_801BFC98[i]) { - interfaceCtx->unk_2AA[i] -= stepVar1; + } else if (interfaceCtx->minigamePerfectState[i] == MINIGAME_PERFECT_STATE_4) { + stepVar1 = ABS_ALT(interfaceCtx->minigamePerfectVtxOffset[i] - D_801BFC98[i]) / + interfaceCtx->minigamePerfectColorTimer; + if (interfaceCtx->minigamePerfectVtxOffset[i] >= D_801BFC98[i]) { + interfaceCtx->minigamePerfectVtxOffset[i] -= stepVar1; } else { - interfaceCtx->unk_2AA[i] += stepVar1; + interfaceCtx->minigamePerfectVtxOffset[i] += stepVar1; } - } else if (interfaceCtx->unk_28A[i] == 6) { - interfaceCtx->unk_29A[i] -= 0x800; - if (interfaceCtx->unk_29A[i] == (u16)(D_801BFCA8[i] - 0x8000)) { - interfaceCtx->unk_28A[i] = 0; + } else if (interfaceCtx->minigamePerfectState[i] == MINIGAME_PERFECT_STATE_6) { + interfaceCtx->minigamePerfectLetterDirection[i] -= 0x800; + if (interfaceCtx->minigamePerfectLetterDirection[i] == (u16)(D_801BFCA8[i] - 0x8000)) { + interfaceCtx->minigamePerfectState[i] = MINIGAME_PERFECT_STATE_0; } } } - if (interfaceCtx->unk_28A[0] == 4) { - interfaceCtx->unk_30A--; - if (interfaceCtx->unk_30A == 0) { + if (interfaceCtx->minigamePerfectState[0] == MINIGAME_PERFECT_STATE_4) { + interfaceCtx->minigamePerfectColorTimer--; + if (interfaceCtx->minigamePerfectColorTimer == 0) { for (i = 0; i < 8; i++) { - interfaceCtx->unk_28A[i] = 5; + interfaceCtx->minigamePerfectState[i] = MINIGAME_PERFECT_STATE_5; } - interfaceCtx->unk_30A = 20; + interfaceCtx->minigamePerfectColorTimer = 20; } } - if ((interfaceCtx->unk_28A[interfaceCtx->unk_304] == 0) && (interfaceCtx->unk_304 < 8)) { - interfaceCtx->unk_28A[interfaceCtx->unk_304] = 1; - interfaceCtx->unk_304++; + if ((interfaceCtx->minigamePerfectState[interfaceCtx->minigamePerfectLetterCount] == MINIGAME_PERFECT_STATE_0) && + (interfaceCtx->minigamePerfectLetterCount < 8)) { + interfaceCtx->minigamePerfectState[interfaceCtx->minigamePerfectLetterCount] = MINIGAME_PERFECT_STATE_1; + interfaceCtx->minigamePerfectLetterCount++; } - if ((interfaceCtx->unk_304 == 8) && (interfaceCtx->unk_28A[7] == 5)) { + if ((interfaceCtx->minigamePerfectLetterCount == 8) && + (interfaceCtx->minigamePerfectState[7] == MINIGAME_PERFECT_STATE_5)) { - stepVar1 = ABS_ALT(interfaceCtx->unk_2FC[0] - D_801BFCB8[interfaceCtx->unk_308][0]) / interfaceCtx->unk_30A; - stepVar2 = ABS_ALT(interfaceCtx->unk_2FC[1] - D_801BFCB8[interfaceCtx->unk_308][1]) / interfaceCtx->unk_30A; - stepVar3 = ABS_ALT(interfaceCtx->unk_2FC[2] - D_801BFCB8[interfaceCtx->unk_308][2]) / interfaceCtx->unk_30A; + stepVar1 = ABS_ALT(interfaceCtx->minigamePerfectPrimColor[0] - + sMinigamePerfectType3PrimColorTargets[interfaceCtx->minigamePerfectColorTargetIndex][0]) / + interfaceCtx->minigamePerfectColorTimer; + stepVar2 = ABS_ALT(interfaceCtx->minigamePerfectPrimColor[1] - + sMinigamePerfectType3PrimColorTargets[interfaceCtx->minigamePerfectColorTargetIndex][1]) / + interfaceCtx->minigamePerfectColorTimer; + stepVar3 = ABS_ALT(interfaceCtx->minigamePerfectPrimColor[2] - + sMinigamePerfectType3PrimColorTargets[interfaceCtx->minigamePerfectColorTargetIndex][2]) / + interfaceCtx->minigamePerfectColorTimer; - if (interfaceCtx->unk_2FC[0] >= D_801BFCB8[interfaceCtx->unk_308][0]) { - interfaceCtx->unk_2FC[0] -= stepVar1; + if (interfaceCtx->minigamePerfectPrimColor[0] >= + sMinigamePerfectType3PrimColorTargets[interfaceCtx->minigamePerfectColorTargetIndex][0]) { + interfaceCtx->minigamePerfectPrimColor[0] -= stepVar1; } else { - interfaceCtx->unk_2FC[0] += stepVar1; + interfaceCtx->minigamePerfectPrimColor[0] += stepVar1; } - if (interfaceCtx->unk_2FC[1] >= D_801BFCB8[interfaceCtx->unk_308][1]) { - interfaceCtx->unk_2FC[1] -= stepVar2; + if (interfaceCtx->minigamePerfectPrimColor[1] >= + sMinigamePerfectType3PrimColorTargets[interfaceCtx->minigamePerfectColorTargetIndex][1]) { + interfaceCtx->minigamePerfectPrimColor[1] -= stepVar2; } else { - interfaceCtx->unk_2FC[1] += stepVar2; + interfaceCtx->minigamePerfectPrimColor[1] += stepVar2; } - if (interfaceCtx->unk_2FC[2] >= D_801BFCB8[interfaceCtx->unk_308][2]) { - interfaceCtx->unk_2FC[2] -= stepVar3; + if (interfaceCtx->minigamePerfectPrimColor[2] >= + sMinigamePerfectType3PrimColorTargets[interfaceCtx->minigamePerfectColorTargetIndex][2]) { + interfaceCtx->minigamePerfectPrimColor[2] -= stepVar3; } else { - interfaceCtx->unk_2FC[2] += stepVar3; + interfaceCtx->minigamePerfectPrimColor[2] += stepVar3; } - interfaceCtx->unk_30A--; - if (interfaceCtx->unk_30A == 0) { - interfaceCtx->unk_30A = 20; - interfaceCtx->unk_308 ^= 1; - interfaceCtx->unk_30C++; - if (interfaceCtx->unk_30C == 6) { + interfaceCtx->minigamePerfectColorTimer--; + if (interfaceCtx->minigamePerfectColorTimer == 0) { + interfaceCtx->minigamePerfectColorTimer = 20; + interfaceCtx->minigamePerfectColorTargetIndex ^= 1; + interfaceCtx->minigamePerfectTimer++; + if (interfaceCtx->minigamePerfectTimer == 6) { for (i = 0; i < 8; i++) { - interfaceCtx->unk_2BC[i] = 140.0f; - interfaceCtx->unk_2DC[i] = 100.0f; - interfaceCtx->unk_29A[i] = D_801BFCA8[i]; - interfaceCtx->unk_28A[i] = 6; + interfaceCtx->minigamePerfectLetterPosX[i] = 140.0f; + interfaceCtx->minigamePerfectLetterPosY[i] = 100.0f; + interfaceCtx->minigamePerfectLetterDirection[i] = D_801BFCA8[i]; + interfaceCtx->minigamePerfectState[i] = MINIGAME_PERFECT_STATE_6; } - interfaceCtx->unk_30A = 5; + interfaceCtx->minigamePerfectColorTimer = 5; } } } j = 0; for (i = 0; i < 8; i++) { - if (interfaceCtx->unk_28A[i] == 0) { + if (interfaceCtx->minigamePerfectState[i] == MINIGAME_PERFECT_STATE_0) { j++; } } if (j == 8) { - interfaceCtx->isMinigamePerfect = 0; + interfaceCtx->isMinigamePerfect = false; } } @@ -5148,10 +5194,10 @@ void Interface_DrawMinigamePerfect(PlayState* play) { gMinigameLetterETex, gMinigameLetterCTex, gMinigameLetterTTex, gMinigameExclamationTex, }; InterfaceContext* interfaceCtx = &play->interfaceCtx; - f32 temp_f22; - f32 temp_f24; + f32 letterX; + f32 letterY; s16 i; - s16 phi_s7; + s16 vtxOffset; OPEN_DISPS(play->state.gfxCtx); @@ -5161,31 +5207,34 @@ void Interface_DrawMinigamePerfect(PlayState* play) { gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); - for (phi_s7 = 0, i = 0; i < 8; phi_s7 += 4, i++) { - if (interfaceCtx->unk_28A[i] != 0) { - temp_f24 = Math_SinS(interfaceCtx->unk_29A[i]) * interfaceCtx->unk_2BC[i]; - temp_f22 = Math_CosS(interfaceCtx->unk_29A[i]) * interfaceCtx->unk_2DC[i]; + for (vtxOffset = 0, i = 0; i < 8; vtxOffset += 4, i++) { + if (interfaceCtx->minigamePerfectState[i] != MINIGAME_PERFECT_STATE_0) { + letterX = + Math_SinS(interfaceCtx->minigamePerfectLetterDirection[i]) * interfaceCtx->minigamePerfectLetterPosX[i]; + letterY = + Math_CosS(interfaceCtx->minigamePerfectLetterDirection[i]) * interfaceCtx->minigamePerfectLetterPosY[i]; gDPPipeSync(OVERLAY_DISP++); - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, interfaceCtx->unk_2FC[3]); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, interfaceCtx->minigamePerfectPrimColor[3]); - Matrix_Translate(temp_f24, temp_f22, 0.0f, MTXMODE_NEW); + Matrix_Translate(letterX, letterY, 0.0f, MTXMODE_NEW); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[phi_s7] + 0x2C, 4, 0); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->aButtonVtx[vtxOffset] + 0x2C, 4, 0); OVERLAY_DISP = Gfx_DrawQuadTexture(OVERLAY_DISP, D_801BFCC4[i], 4, 32, 33, 0); gDPPipeSync(OVERLAY_DISP++); - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, interfaceCtx->unk_2FC[0], interfaceCtx->unk_2FC[1], - interfaceCtx->unk_2FC[2], interfaceCtx->unk_2FC[3]); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, interfaceCtx->minigamePerfectPrimColor[0], + interfaceCtx->minigamePerfectPrimColor[1], interfaceCtx->minigamePerfectPrimColor[2], + interfaceCtx->minigamePerfectPrimColor[3]); - Matrix_Translate(temp_f24, temp_f22, 0.0f, MTXMODE_NEW); + Matrix_Translate(letterX, letterY, 0.0f, MTXMODE_NEW); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[phi_s7] + 0x4C, 4, 0); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->aButtonVtx[vtxOffset] + 0x4C, 4, 0); OVERLAY_DISP = Gfx_DrawQuadTexture(OVERLAY_DISP, D_801BFCC4[i], 4, 32, 33, 0); } @@ -5472,7 +5521,7 @@ void Interface_DrawTimers(PlayState* play) { OSTIME_TO_TIMER(osTime - ((void)0, gSaveContext.timerStartOsTimes[sTimerId]) - ((void)0, gSaveContext.timerPausedOsTimes[sTimerId])); - if ((gSaveContext.minigameState == 1) && + if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0))) { if (gSaveContext.timerStopTimes[sTimerId] >= SECONDS_TO_TIMER(120)) { gSaveContext.timerStopTimes[sTimerId] = SECONDS_TO_TIMER(120); @@ -5573,7 +5622,8 @@ void Interface_DrawTimers(PlayState* play) { osTime = SECONDS_TO_TIMER(0); } - if ((gSaveContext.minigameState == 1) && (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0))) { + if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && + (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0))) { if (osTime >= SECONDS_TO_TIMER(120)) { osTime = SECONDS_TO_TIMER(120); } @@ -5587,7 +5637,8 @@ void Interface_DrawTimers(PlayState* play) { Interface_GetTimerDigits(osTime, sTimerDigits); // Use seconds to determine when to beep - if ((gSaveContext.minigameState == 1) && (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0))) { + if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && + (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0))) { if ((gSaveContext.timerCurTimes[sTimerId] > SECONDS_TO_TIMER(110)) && (sTimerBeepSfxSeconds != sTimerDigits[4])) { play_sound(NA_SE_SY_WARNING_COUNT_E); @@ -5623,7 +5674,7 @@ void Interface_DrawTimers(PlayState* play) { } else { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, 255); } - } else if ((gSaveContext.minigameState == 1) && + } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0))) { if (gSaveContext.timerCurTimes[sTimerId] >= SECONDS_TO_TIMER(110)) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 50, 0, 255); @@ -5787,7 +5838,7 @@ void Interface_DrawMinigameIcons(PlayState* play) { } } - if (gSaveContext.minigameState == 1) { + if (gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) { gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); @@ -5881,17 +5932,14 @@ Color_RGB16 D_801BFD40[] = { { 10, 10, 80 }, { 40, 10, 0 }, }; -// minigameCountdownTexs -TexturePtr D_801BFD54[] = { +TexturePtr sMinigameCountdownTextures[] = { gMinigameCountdown3Tex, gMinigameCountdown2Tex, gMinigameCountdown1Tex, gMinigameCountdownGoTex, }; -// minigameCountdownTexHeights -s16 D_801BFD64[] = { 24, 24, 24, 40 }; -// minigameCountdownPrimColor -Color_RGB16 D_801BFD6C[] = { +s16 sMinigameCountdownTexWidths[] = { 24, 24, 24, 40 }; +Color_RGB16 sMinigameCountdownPrimColors[] = { { 100, 255, 100 }, { 255, 255, 60 }, { 255, 100, 0 }, @@ -6160,39 +6208,41 @@ void Interface_Draw(PlayState* play) { if (((u32)interfaceCtx->minigameState % 2) == 0) { sp2CE = (interfaceCtx->minigameState >> 1) - 1; - sp2C0 = interfaceCtx->unk_284 / 100.0f; + sp2C0 = interfaceCtx->minigameCountdownScale / 100.0f; if (sp2CE == 3) { - interfaceCtx->actionVtx[40].v.ob[0] = interfaceCtx->actionVtx[42].v.ob[0] = -20; - interfaceCtx->actionVtx[41].v.ob[0] = interfaceCtx->actionVtx[43].v.ob[0] = - interfaceCtx->actionVtx[40].v.ob[0] + 40; - interfaceCtx->actionVtx[41].v.tc[0] = interfaceCtx->actionVtx[43].v.tc[0] = 0x500; + interfaceCtx->aButtonVtx[40].v.ob[0] = interfaceCtx->aButtonVtx[42].v.ob[0] = -20; + interfaceCtx->aButtonVtx[41].v.ob[0] = interfaceCtx->aButtonVtx[43].v.ob[0] = + interfaceCtx->aButtonVtx[40].v.ob[0] + 40; + interfaceCtx->aButtonVtx[41].v.tc[0] = interfaceCtx->aButtonVtx[43].v.tc[0] = 0x500; } - interfaceCtx->actionVtx[42].v.tc[1] = interfaceCtx->actionVtx[43].v.tc[1] = 0x400; + interfaceCtx->aButtonVtx[42].v.tc[1] = interfaceCtx->aButtonVtx[43].v.tc[1] = 0x400; func_8012C8D4(play->state.gfxCtx); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetAlphaCompare(OVERLAY_DISP++, G_AC_THRESHOLD); - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, D_801BFD6C[sp2CE].r, D_801BFD6C[sp2CE].g, D_801BFD6C[sp2CE].b, - interfaceCtx->unk_282); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sMinigameCountdownPrimColors[sp2CE].r, + sMinigameCountdownPrimColors[sp2CE].g, sMinigameCountdownPrimColors[sp2CE].b, + interfaceCtx->minigameCountdownAlpha); Matrix_Translate(0.0f, -40.0f, 0.0f, MTXMODE_NEW); Matrix_Scale(sp2C0, sp2C0, 0.0f, MTXMODE_APPLY); gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[0x28], 4, 0); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->aButtonVtx[0x28], 4, 0); - OVERLAY_DISP = Gfx_DrawQuadTextureIA8(OVERLAY_DISP, D_801BFD54[sp2CE], D_801BFD64[sp2CE], 32, 0); + OVERLAY_DISP = Gfx_DrawQuadTextureIA8(OVERLAY_DISP, sMinigameCountdownTextures[sp2CE], + sMinigameCountdownTexWidths[sp2CE], 32, 0); } } else { Interface_DrawClock(play); } } - if (interfaceCtx->isMinigamePerfect != 0) { + if (interfaceCtx->isMinigamePerfect) { Interface_DrawMinigamePerfect(play); } @@ -6281,10 +6331,10 @@ void Interface_Draw(PlayState* play) { } } - if (interfaceCtx->unk_264 != 0) { + if (interfaceCtx->screenFillAlpha != 0) { gDPPipeSync(OVERLAY_DISP++); - gSPDisplayList(OVERLAY_DISP++, D_801BF988); - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, interfaceCtx->unk_264); + gSPDisplayList(OVERLAY_DISP++, gScreenFillSetupDL); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, interfaceCtx->screenFillAlpha); gSPDisplayList(OVERLAY_DISP++, D_0E0002E0); } @@ -6513,12 +6563,12 @@ void Interface_Update(PlayState* play) { if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { if (interfaceCtx->isMinigamePerfect) { - if (interfaceCtx->minigameRewardType == 1) { - func_8011B5C0(play); - } else if (interfaceCtx->minigameRewardType == 2) { - func_8011B9E0(play); - } else if (interfaceCtx->minigameRewardType == 3) { - func_8011BF70(play); + if (interfaceCtx->minigamePerfectType == MINIGAME_PERFECT_TYPE_1) { + Interface_UpdateMinigamePerfectType1(play); + } else if (interfaceCtx->minigamePerfectType == MINIGAME_PERFECT_TYPE_2) { + Interface_UpdateMinigamePerfectType2(play); + } else if (interfaceCtx->minigamePerfectType == MINIGAME_PERFECT_TYPE_3) { + Interface_UpdateMinigamePerfectType3(play); } } } @@ -6531,11 +6581,11 @@ void Interface_Update(PlayState* play) { case MINIGAME_STATE_COUNTDOWN_START_2: // minigame countdown 2 case MINIGAME_STATE_COUNTDOWN_START_1: // minigame countdown 1 case MINIGAME_STATE_COUNTDOWN_START_GO: // minigame countdown Go! - interfaceCtx->unk_282 = 255; - interfaceCtx->unk_284 = 100; + interfaceCtx->minigameCountdownAlpha = 255; + interfaceCtx->minigameCountdownScale = 100; interfaceCtx->minigameState++; if (interfaceCtx->minigameState == MINIGAME_STATE_COUNTDOWN_GO) { - interfaceCtx->unk_284 = 160; + interfaceCtx->minigameCountdownScale = 160; play_sound(NA_SE_SY_START_SHOT); } else { play_sound(NA_SE_SY_WARNING_COUNT_E); @@ -6545,28 +6595,28 @@ void Interface_Update(PlayState* play) { case MINIGAME_STATE_COUNTDOWN_3: case MINIGAME_STATE_COUNTDOWN_2: case MINIGAME_STATE_COUNTDOWN_1: - interfaceCtx->unk_282 -= 10; - interfaceCtx->unk_284 += 3; - if (interfaceCtx->unk_282 < 22) { + interfaceCtx->minigameCountdownAlpha -= 10; + interfaceCtx->minigameCountdownScale += 3; + if (interfaceCtx->minigameCountdownAlpha < 22) { interfaceCtx->minigameState++; } break; case MINIGAME_STATE_COUNTDOWN_GO: - interfaceCtx->unk_282 -= 10; - if (interfaceCtx->unk_282 <= 150) { + interfaceCtx->minigameCountdownAlpha -= 10; + if (interfaceCtx->minigameCountdownAlpha <= 150) { interfaceCtx->minigameState = MINIGAME_STATE_30; } break; case MINIGAME_STATE_20: - interfaceCtx->unk_282 = 0; + interfaceCtx->minigameCountdownAlpha = 0; interfaceCtx->minigameState++; break; case MINIGAME_STATE_21: - interfaceCtx->unk_282++; - if (interfaceCtx->unk_282 >= 18) { + interfaceCtx->minigameCountdownAlpha++; + if (interfaceCtx->minigameCountdownAlpha >= 18) { interfaceCtx->minigameState = MINIGAME_STATE_30; } break; @@ -6683,13 +6733,14 @@ void Interface_Update(PlayState* play) { gSaveContext.timerStates[TIMER_ID_ENV] = TIMER_STATE_OFF; } - // Update Minigame - if (gSaveContext.minigameState == 1) { - gSaveContext.minigameScore += interfaceCtx->unk_25C; - gSaveContext.unk_3F3C += interfaceCtx->unk_25E; - interfaceCtx->unk_25C = 0; - interfaceCtx->unk_25E = 0; + // Update minigame + if (gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) { + gSaveContext.minigameScore += interfaceCtx->minigamePoints; + gSaveContext.minigameHiddenScore += interfaceCtx->minigameHiddenPoints; + interfaceCtx->minigamePoints = 0; + interfaceCtx->minigameHiddenPoints = 0; + // Update horseback archery tier, unused remnant of OoT. if (sHBAScoreTier == 0) { if (gSaveContext.minigameScore >= 1000) { sHBAScoreTier++; @@ -6700,6 +6751,7 @@ void Interface_Update(PlayState* play) { } } + // Get minigame digits sMinigameScoreDigits[0] = sMinigameScoreDigits[1] = 0; sMinigameScoreDigits[2] = 0; sMinigameScoreDigits[3] = gSaveContext.minigameScore; @@ -6856,10 +6908,10 @@ void Interface_Init(PlayState* play) { LifeMeter_Init(play); Map_Init(play); - gSaveContext.minigameState = 3; - interfaceCtx->unk_2FC[0] = 255; - interfaceCtx->unk_2FC[1] = 165; - interfaceCtx->unk_2FC[2] = 55; + gSaveContext.minigameStatus = MINIGAME_STATUS_DONE; + interfaceCtx->minigamePerfectPrimColor[0] = 255; + interfaceCtx->minigamePerfectPrimColor[1] = 165; + interfaceCtx->minigamePerfectPrimColor[2] = 55; if (gSaveContext.eventInf[3] & 0x10) { gSaveContext.eventInf[3] &= (u8)~0x10; diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.c b/src/overlays/actors/ovl_En_Az/z_en_az.c index c96f0532f..07692dc77 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.c +++ b/src/overlays/actors/ovl_En_Az/z_en_az.c @@ -1484,7 +1484,7 @@ void func_80A97D5C(EnAz* this, PlayState* play) { player->stateFlags1 |= PLAYER_STATE1_20; Interface_InitMinigame(play); gSaveContext.minigameScore = (this->unk_374 & 2) ? 25 : 20; - play->interfaceCtx.minigameState = 1; + play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_START_3; if ((this->unk_2FA == 1) || (this->unk_2FA == 3)) { Interface_StartTimer(TIMER_ID_MINIGAME_2, 120); } else if (gSaveContext.save.weekEventReg[25] & 1) { @@ -1498,7 +1498,7 @@ void func_80A97D5C(EnAz* this, PlayState* play) { void func_80A97E48(EnAz* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (play->interfaceCtx.minigameState >= 8) { + if (play->interfaceCtx.minigameState >= MINIGAME_STATE_COUNTDOWN_GO) { player->stateFlags1 &= ~PLAYER_STATE1_20; func_80A97EAC(this, play); } diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 83c2db438..17d15d4e6 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -800,7 +800,7 @@ void func_80962F4C(EnFu* this, PlayState* play) { gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] = SECONDS_TO_TIMER(0); gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; func_801A3098(NA_BGM_GET_ITEM | 0x900); - Interface_SetPerfectMinigame(play, 1); + Interface_SetMinigamePerfect(play, MINIGAME_PERFECT_TYPE_1); this->unk_54A = 3; func_809632D0(this); } diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index b2b67b106..e89834c30 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -2916,22 +2916,23 @@ void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play) { EnHorse_PlayWalkingSound(this); } - if (play->interfaceCtx.hbaAmmo == 0) { + if (play->interfaceCtx.minigameAmmo == 0) { this->hbaTimer++; } sp28 = Audio_IsSequencePlaying(0x41); EnHorse_UpdateHbaRaceInfo(this, play, &sHbaInfo); - if (((this->hbaFlags & 1) || (this->hbaTimer > 45)) && (sp28 != 1) && (gSaveContext.minigameState != 3)) { + if (((this->hbaFlags & 1) || (this->hbaTimer > 45)) && (sp28 != 1) && + (gSaveContext.minigameStatus != MINIGAME_STATUS_DONE)) { gSaveContext.save.cutscene = 0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_64; } - if (play->interfaceCtx.hbaAmmo) {} + if (play->interfaceCtx.minigameAmmo) {} - if (((play->interfaceCtx.hbaAmmo == 0) || (this->hbaFlags & 2)) && (this->hbaFlags & 4)) { + if (((play->interfaceCtx.minigameAmmo == 0) || (this->hbaFlags & 2)) && (this->hbaFlags & 4)) { this->hbaFlags &= ~4; Audio_QueueSeqCmd(0x8041); } diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index 1cce146eb..4c7eb48d6 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -122,7 +122,7 @@ s32 func_808F8CCC(EnHorseGameCheck* this, PlayState* play2) { } Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); - play->interfaceCtx.minigameState = 1; + play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_START_3; this->horse1 = (EnHorse*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -1149.0f, -106.0f, 470.0f, 0, 0x7FFF, 0, ENHORSE_PARAMS(ENHORSE_PARAM_BANDIT, ENHORSE_4)); @@ -212,10 +212,10 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { if ((this->unk_168 > 50) && !(this->unk_164 & 2)) { this->unk_164 |= 2; - } else if ((play->interfaceCtx.minigameState >= 8) && !(this->unk_164 & 1)) { + } else if ((play->interfaceCtx.minigameState >= MINIGAME_STATE_COUNTDOWN_GO) && !(this->unk_164 & 1)) { this->unk_164 |= 1; horse->inRace = true; - } else if ((play->interfaceCtx.minigameState >= 8) && !(this->unk_164 & 8)) { + } else if ((play->interfaceCtx.minigameState >= MINIGAME_STATE_COUNTDOWN_GO) && !(this->unk_164 & 8)) { EnHorse* horse = this->horse1; horse->inRace = true; diff --git a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c index 99c17772c..fd671c66b 100644 --- a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c +++ b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c @@ -94,7 +94,7 @@ s32 EnJcMato_CheckForHit(EnJcMato* this, PlayState* play) { if ((this->collider.base.acFlags & AC_HIT) && !this->hitFlag && (this->actor.colChkInfo.damageEffect == 0xF)) { this->collider.base.acFlags &= ~AC_HIT; Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); - play->interfaceCtx.unk_25C = 1; + play->interfaceCtx.minigamePoints = 1; this->hitFlag = true; return 1; } else { diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c index 73c79f02e..50b7afa2e 100644 --- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c +++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c @@ -284,7 +284,7 @@ void func_80C1410C(EnJgameTsn* this, PlayState* play) { player->stateFlags1 |= 0x20; func_801A2BB8(0x25); - play->interfaceCtx.minigameState = 1; + play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_START_3; Interface_InitMinigame(play); gSaveContext.save.weekEventReg[90] |= 0x20; Interface_StartTimer(TIMER_ID_MINIGAME_2, 120); @@ -294,7 +294,7 @@ void func_80C1410C(EnJgameTsn* this, PlayState* play) { void func_80C1418C(EnJgameTsn* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (play->interfaceCtx.minigameState == 8) { + if (play->interfaceCtx.minigameState == MINIGAME_STATE_COUNTDOWN_GO) { func_80C141DC(this); player->stateFlags1 &= ~0x20; } @@ -478,7 +478,7 @@ void func_80C147B4(EnJgameTsn* this, PlayState* play) { case 0x10A0: case 0x10A1: func_801477B4(play); - gSaveContext.minigameState = 3; + gSaveContext.minigameStatus = MINIGAME_STATUS_DONE; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; gSaveContext.save.weekEventReg[90] &= (u8)~0x20; func_80C144E4(this); @@ -563,14 +563,14 @@ s32 func_80C14BCC(EnJgameTsn* this, PlayState* play) { if (phi_s3 == this->unk_218) { Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); *this->unk_208[phi_s3] |= OBJLUPYGAMELIFT_DISPLAY_CORRECT; - play->interfaceCtx.unk_25C = 1; + play->interfaceCtx.minigamePoints = 1; return true; } if (*this->unk_208[phi_s3] & OBJLUPYGAMELIFT_IGNITE_FIRE) { Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); *this->unk_208[phi_s3] |= OBJLUPYGAMELIFT_DISPLAY_CORRECT; - play->interfaceCtx.unk_25C = 1; + play->interfaceCtx.minigamePoints = 1; } else { *this->unk_208[phi_s3] |= OBJLUPYGAMELIFT_DISPLAY_INCORRECT; Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_ERROR); diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c index ab2bf49cc..6b95a5aee 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c @@ -304,7 +304,7 @@ void func_80B269A4(EnKendoJs* this, PlayState* play) { case 0x272D: func_801477B4(play); - gSaveContext.minigameState = 3; + gSaveContext.minigameStatus = MINIGAME_STATUS_DONE; func_80B276C4(this); func_80B276D8(this, play); break; @@ -334,7 +334,7 @@ void func_80B26AFC(EnKendoJs* this, PlayState* play) { } if ((this->unk_288 == 0x272E) || (this->unk_288 == 0x272F) || (this->unk_288 == 0x2730)) { - gSaveContext.minigameState = 3; + gSaveContext.minigameStatus = MINIGAME_STATUS_DONE; } player->stateFlags1 &= ~0x20; @@ -621,14 +621,14 @@ void func_80B274BC(EnKendoJs* this, PlayState* play) { if (this->unk_28E == 1) { if ((player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) || (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_FINISH)) { - play->interfaceCtx.unk_25C = 3; + play->interfaceCtx.minigamePoints = 3; if (gSaveContext.minigameScore >= 27) { player->stateFlags1 |= 0x20; } } else if (player->meleeWeaponAnimation == PLAYER_MWA_STAB_1H) { - play->interfaceCtx.unk_25C = 2; + play->interfaceCtx.minigamePoints = 2; } else { - play->interfaceCtx.unk_25C = 1; + play->interfaceCtx.minigamePoints = 1; } Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); this->unk_28E = 0; diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c index 2bf81fa36..510c7242d 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -688,7 +688,7 @@ void EnMa4_HorsebackGameTalking(EnMa4* this, PlayState* play) { void EnMa4_InitHorsebackGame(EnMa4* this, PlayState* play) { Player* player = GET_PLAYER(play); - play->interfaceCtx.minigameState = 1; + play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_START_3; Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); gSaveContext.save.weekEventReg[8] |= 1; Interface_InitMinigame(play); @@ -699,7 +699,7 @@ void EnMa4_InitHorsebackGame(EnMa4* this, PlayState* play) { void EnMa4_SetupHorsebackGameWait(EnMa4* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (play->interfaceCtx.minigameState == 8) { + if (play->interfaceCtx.minigameState == MINIGAME_STATE_COUNTDOWN_GO) { this->actionFunc = EnMa4_HorsebackGameWait; player->stateFlags1 &= ~0x20; } @@ -714,7 +714,7 @@ void EnMa4_HorsebackGameWait(EnMa4* this, PlayState* play) { if (this->poppedBalloonCounter != D_80AC0258) { D_80AC0258 = this->poppedBalloonCounter; - play->interfaceCtx.unk_25C = 1; + play->interfaceCtx.minigamePoints = 1; } if ((gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(120)) || diff --git a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c index b90cc04bb..a556c689c 100644 --- a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c +++ b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c @@ -315,11 +315,11 @@ void EnMttag_RaceStart(EnMttag* this, PlayState* play) { } else { if (DECR(this->timer) == 60) { Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); - play->interfaceCtx.minigameState = 1; + play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_START_3; Audio_QueueSeqCmd(NA_BGM_GORON_RACE | 0x8000); play->envCtx.unk_E4 = 0xFE; player->stateFlags1 &= ~0x20; - } else if ((this->timer < 60) && (play->interfaceCtx.minigameState == 8)) { + } else if ((this->timer < 60) && (play->interfaceCtx.minigameState == MINIGAME_STATE_COUNTDOWN_GO)) { this->timer = 0; gSaveContext.eventInf[1] |= 1; this->actionFunc = EnMttag_Race; diff --git a/src/overlays/actors/ovl_En_Ot/z_en_ot.c b/src/overlays/actors/ovl_En_Ot/z_en_ot.c index bf93b729f..3ffb69b28 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c @@ -5,7 +5,6 @@ */ #include "z_en_ot.h" -#include "prevent_bss_reordering.h" #include "objects/object_ot/object_ot.h" #include "objects/gameplay_keep/gameplay_keep.h" @@ -59,9 +58,9 @@ EnOtUnkStruct* func_80B5DF58(EnOtUnkStruct* arg0, u8 arg1, Vec3f* arg2, Vec3s* a void func_80B5E078(PlayState* play, EnOtUnkStruct* arg1, s32 arg2); void func_80B5E1D8(PlayState* play, EnOtUnkStruct* arg1, s32 arg2); -static EnOt* D_80B5E880; -static EnOt* D_80B5E884; -static EnOt* D_80B5E888; +EnOt* D_80B5E880; +EnOt* D_80B5E884; +EnOt* D_80B5E888; const ActorInit En_Ot_InitVars = { ACTOR_EN_OT, diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index b59a2ba33..b47067bed 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -325,7 +325,7 @@ void EnSyatekiMan_Swamp_HandleChoice(EnSyatekiMan* this, PlayState* play) { Message_StartTextbox(play, 0xA31, &this->actor); this->prevTextId = 0xA31; if (this->shootingGameState == SG_GAME_STATE_ONE_MORE_GAME) { - gSaveContext.minigameState = 3; + gSaveContext.minigameStatus = MINIGAME_STATUS_DONE; } this->shootingGameState = SG_GAME_STATE_NOT_PLAYING; @@ -364,7 +364,7 @@ void EnSyatekiMan_Swamp_HandleChoice(EnSyatekiMan* this, PlayState* play) { } if (this->shootingGameState == SG_GAME_STATE_ONE_MORE_GAME) { - gSaveContext.minigameState = 3; + gSaveContext.minigameStatus = MINIGAME_STATUS_DONE; } this->shootingGameState = SG_GAME_STATE_NOT_PLAYING; @@ -391,7 +391,7 @@ void EnSyatekiMan_Swamp_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) play->msgCtx.stateTimer = 4; player->actor.freezeTimer = 0; Interface_InitMinigame(play); - play->interfaceCtx.hbaAmmo = 80; + play->interfaceCtx.minigameAmmo = 80; func_80123F2C(play, 80); this->shootingGameState = SG_GAME_STATE_RUNNING; this->actionFunc = EnSyatekiMan_Swamp_StartGame; @@ -405,7 +405,7 @@ void EnSyatekiMan_Swamp_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) gSaveContext.save.weekEventReg[63] &= (u8)~1; gSaveContext.save.weekEventReg[63] &= (u8)~2; this->actionFunc = EnSyatekiMan_Swamp_Idle; - gSaveContext.minigameState = 3; + gSaveContext.minigameStatus = MINIGAME_STATUS_DONE; this->shootingGameState = SG_GAME_STATE_NONE; } else { // Wanna play again? @@ -425,7 +425,7 @@ void EnSyatekiMan_Swamp_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; player->actor.freezeTimer = 0; - gSaveContext.minigameState = 3; + gSaveContext.minigameStatus = MINIGAME_STATUS_DONE; player->stateFlags1 |= 0x20; this->actionFunc = EnSyatekiMan_Swamp_SetupGiveReward; EnSyatekiMan_Swamp_SetupGiveReward(this, play); @@ -632,7 +632,7 @@ void EnSyatekiMan_Town_HandleChoice(EnSyatekiMan* this, PlayState* play) { if (this->shootingGameState == SG_GAME_STATE_ONE_MORE_GAME) { player->stateFlags3 &= ~0x400; - gSaveContext.minigameState = 3; + gSaveContext.minigameStatus = MINIGAME_STATUS_DONE; } this->shootingGameState = SG_GAME_STATE_NOT_PLAYING; @@ -668,7 +668,7 @@ void EnSyatekiMan_Town_HandleChoice(EnSyatekiMan* this, PlayState* play) { if (this->shootingGameState == SG_GAME_STATE_ONE_MORE_GAME) { player->stateFlags3 &= ~0x400; - gSaveContext.minigameState = 3; + gSaveContext.minigameStatus = MINIGAME_STATUS_DONE; } this->shootingGameState = SG_GAME_STATE_NOT_PLAYING; @@ -799,7 +799,7 @@ void EnSyatekiMan_Town_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; player->actor.freezeTimer = 0; - gSaveContext.minigameState = 3; + gSaveContext.minigameStatus = MINIGAME_STATUS_DONE; this->actionFunc = EnSyatekiMan_Town_SetupGiveReward; EnSyatekiMan_Town_SetupGiveReward(this, play); break; @@ -1081,7 +1081,7 @@ void EnSyatekiMan_Swamp_RunGame(EnSyatekiMan* this, PlayState* play) { func_801A2C20(); this->shootingGameState = SG_GAME_STATE_GIVING_BONUS; if (this->score == 2120) { - Interface_SetPerfectMinigame(play, 2); + Interface_SetMinigamePerfect(play, MINIGAME_PERFECT_TYPE_2); gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_6; this->actionFunc = EnSyatekiMan_Swamp_AddBonusPoints; } else { @@ -1113,7 +1113,7 @@ void EnSyatekiMan_Swamp_EndGame(EnSyatekiMan* this, PlayState* play) { gSaveContext.save.weekEventReg[63] &= (u8)~1; gSaveContext.save.weekEventReg[63] &= (u8)~2; this->shootingGameState = SG_GAME_STATE_NONE; - gSaveContext.minigameState = 3; + gSaveContext.minigameStatus = MINIGAME_STATUS_DONE; this->actionFunc = EnSyatekiMan_Swamp_Idle; return; } @@ -1157,7 +1157,7 @@ void EnSyatekiMan_Swamp_AddBonusPoints(EnSyatekiMan* this, PlayState* play) { sBonusTimer = 0; } else if (sBonusTimer > 10) { gSaveContext.timerStopTimes[TIMER_ID_MINIGAME_1] += SECONDS_TO_TIMER(1); - play->interfaceCtx.unk_25C += 10; + play->interfaceCtx.minigamePoints += 10; this->score += 10; Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); sBonusTimer = 0; @@ -1350,7 +1350,7 @@ void EnSyatekiMan_Town_RunGame(EnSyatekiMan* this, PlayState* play) { this->actionFunc = EnSyatekiMan_Town_EndGame; if (this->score == 50) { func_801A3098(NA_BGM_GET_ITEM | 0x900); - Interface_SetPerfectMinigame(play, 1); + Interface_SetMinigamePerfect(play, MINIGAME_PERFECT_TYPE_1); } } } diff --git a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c index d9059577c..3f6fa6224 100644 --- a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c +++ b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c @@ -370,7 +370,7 @@ void EnSyatekiOkuta_Update(Actor* thisx, PlayState* play) { syatekiMan = (EnSyatekiMan*)this->actor.parent; if (this->unk_2A6 == 1) { Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); - play->interfaceCtx.unk_25C++; + play->interfaceCtx.minigamePoints++; syatekiMan->score++; syatekiMan->perGameVar2.octorokHitType = SG_OCTO_HIT_TYPE_RED; } else { diff --git a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c index ac772a940..aab26a226 100644 --- a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c +++ b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c @@ -165,7 +165,7 @@ s32 func_80B761FC(EnTruMt* this, PlayState* play) { this->unk_3A4 = 0; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOUME_DAMAGE2); } - play->interfaceCtx.unk_25E = 1; + play->interfaceCtx.minigameHiddenPoints = 1; Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 25); return true; } @@ -322,7 +322,7 @@ void func_80B76924(EnTruMt* this) { void func_80B76980(EnTruMt* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (gSaveContext.unk_3F3C >= 10) { + if (gSaveContext.minigameHiddenScore >= 10) { Message_StartTextbox(play, 0x87F, &this->actor); gSaveContext.eventInf[3] |= 0x40; gSaveContext.eventInf[4] |= 1; diff --git a/src/overlays/actors/ovl_En_Twig/z_en_twig.c b/src/overlays/actors/ovl_En_Twig/z_en_twig.c index 5df9cee3c..5d0e014ae 100644 --- a/src/overlays/actors/ovl_En_Twig/z_en_twig.c +++ b/src/overlays/actors/ovl_En_Twig/z_en_twig.c @@ -198,7 +198,7 @@ void func_80AC0D2C(EnTwig* this, PlayState* play) { (s32)(Rand_ZeroOne() * 10.0f) + 20); } play_sound(NA_SE_SY_GET_ITEM); - play->interfaceCtx.unk_25C--; + play->interfaceCtx.minigamePoints--; sRingNotCollected[RACERING_GET_PARAM_FE0(&this->dyna.actor)] = true; if (sCurrentRing == RACERING_GET_PARAM_FE0(&this->dyna.actor)) { s32 i; diff --git a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c index e33b486f4..a88801f7c 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c +++ b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c @@ -92,6 +92,6 @@ void EffectSsExtra_Update(PlayState* play, u32 index, EffectSs* this) { } if (this->rTimer == 1) { - play->interfaceCtx.unk_25C = sScores[this->rScoreIndex]; + play->interfaceCtx.minigamePoints = sScores[this->rScoreIndex]; } } diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 5d418c0fc..69eb3dc98 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -515,7 +515,7 @@ void MapSelect_UpdateMenu(MapSelectState* this) { gSaveContext.timerStopTimes[i] = SECONDS_TO_TIMER(0); gSaveContext.timerPausedOsTimes[i] = 0; } - gSaveContext.minigameState = 0; + gSaveContext.minigameStatus = MINIGAME_STATUS_INACTIVE; if (this->scenes[this->currentScene].loadFunc != NULL) { this->scenes[this->currentScene].loadFunc(this, this->scenes[this->currentScene].entrance, this->opt); diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 9a930c6a8..5211784fd 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2107,7 +2107,7 @@ 0x80110038:("func_80110038",), 0x80111CB4:("func_80111CB4",), 0x801129E4:("Interface_SetSceneRestrictions",), - 0x80112AF4:("func_80112AF4",), + 0x80112AF4:("Interface_Noop",), 0x80112AFC:("Interface_InitMinigame",), 0x80112B40:("Interface_LoadItemIconImpl",), 0x80112BE4:("Interface_LoadItemIcon",), @@ -2151,10 +2151,10 @@ 0x80118BA4:("func_80118BA4",), 0x80119030:("func_80119030",), 0x80119610:("Interface_DrawClock",), - 0x8011B4E0:("Interface_SetPerfectMinigame",), - 0x8011B5C0:("func_8011B5C0",), - 0x8011B9E0:("func_8011B9E0",), - 0x8011BF70:("func_8011BF70",), + 0x8011B4E0:("Interface_SetMinigamePerfect",), + 0x8011B5C0:("Interface_UpdateMinigamePerfectType1",), + 0x8011B9E0:("Interface_UpdateMinigamePerfectType2",), + 0x8011BF70:("Interface_UpdateMinigamePerfectType3",), 0x8011C4C4:("Interface_DrawMinigamePerfect",), 0x8011C808:("Interface_StartMoonCrash",), 0x8011C898:("Interface_GetTimerDigits",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 958b202c9..dbfd4e89b 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -1088,7 +1088,7 @@ 0x801BF978:("D_801BF978","UNK_TYPE4","",0x4), 0x801BF97C:("D_801BF97C","UNK_TYPE4","",0x4), 0x801BF980:("D_801BF980","UNK_TYPE4","",0x4), - 0x801BF988:("D_801BF988","Gfx","[5]",0x28), + 0x801BF988:("gScreenFillSetupDL","Gfx","[5]",0x28), 0x801BF9B0:("D_801BF9B0","UNK_TYPE2","",0x2), 0x801BF9B4:("D_801BF9B4","UNK_TYPE1","",0x1), 0x801BF9BC:("D_801BF9BC","UNK_TYPE1","",0x1), @@ -1153,13 +1153,13 @@ 0x801BFC14:("D_801BFC14","UNK_TYPE1","",0x1), 0x801BFC40:("D_801BFC40","UNK_TYPE1","",0x1), 0x801BFC50:("D_801BFC50","UNK_TYPE2","",0x2), - 0x801BFC60:("D_801BFC60","s16","[6]",0xC), + 0x801BFC60:("sMinigamePerfectType1PrimColorTargets","s16","[6]",0xC), 0x801BFC6C:("D_801BFC6C","UNK_TYPE4","",0x4), 0x801BFC7C:("D_801BFC7C","UNK_TYPE2","",0x2), - 0x801BFC8C:("D_801BFC8C","UNK_TYPE1","",0x1), + 0x801BFC8C:("sMinigamePerfectType2PrimColorTargets","UNK_TYPE1","",0x1), 0x801BFC98:("D_801BFC98","UNK_TYPE2","",0x2), 0x801BFCA8:("D_801BFCA8","UNK_TYPE2","",0x2), - 0x801BFCB8:("D_801BFCB8","UNK_TYPE1","",0x1), + 0x801BFCB8:("sMinigamePerfectType3PrimColorTargets","UNK_TYPE1","",0x1), 0x801BFCC4:("D_801BFCC4","UNK_TYPE4","",0x4), 0x801BFCE4:("sTimerStateTimer","UNK_TYPE4","",0x4), 0x801BFCE8:("sTimerDigits","u16","[8]",0x10), @@ -1170,9 +1170,9 @@ 0x801BFD24:("D_801BFD24","UNK_TYPE1","",0x1), 0x801BFD2C:("D_801BFD2C","UNK_TYPE1","",0x1), 0x801BFD40:("D_801BFD40","UNK_TYPE1","",0x1), - 0x801BFD54:("D_801BFD54","UNK_TYPE1","",0x1), - 0x801BFD64:("D_801BFD64","UNK_TYPE1","",0x1), - 0x801BFD6C:("D_801BFD6C","UNK_TYPE2","",0x2), + 0x801BFD54:("sMinigameCountdownTextures","UNK_TYPE1","",0x1), + 0x801BFD64:("sMinigameCountdownTexWidths","UNK_TYPE1","",0x1), + 0x801BFD6C:("sMinigameCountdownPrimColors","UNK_TYPE2","",0x2), 0x801BFD84:("D_801BFD84","UNK_TYPE1","",0x1), 0x801BFD8C:("D_801BFD8C","UNK_TYPE1","",0x1), 0x801BFD94:("D_801BFD94","UNK_TYPE4","",0x4), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index cab10fda9..b4f269d36 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1621,7 +1621,7 @@ asm/non_matchings/code/z_parameter/Interface_UpdateHudAlphas.s,Interface_UpdateH asm/non_matchings/code/z_parameter/func_80110038.s,func_80110038,0x80110038,0x71F asm/non_matchings/code/z_parameter/func_80111CB4.s,func_80111CB4,0x80111CB4,0x34C asm/non_matchings/code/z_parameter/Interface_SetSceneRestrictions.s,Interface_SetSceneRestrictions,0x801129E4,0x44 -asm/non_matchings/code/z_parameter/func_80112AF4.s,func_80112AF4,0x80112AF4,0x2 +asm/non_matchings/code/z_parameter/Interface_Noop.s,Interface_Noop,0x80112AF4,0x2 asm/non_matchings/code/z_parameter/Interface_InitMinigame.s,Interface_InitMinigame,0x80112AFC,0x11 asm/non_matchings/code/z_parameter/Interface_LoadItemIconImpl.s,Interface_LoadItemIconImpl,0x80112B40,0x29 asm/non_matchings/code/z_parameter/Interface_LoadItemIcon.s,Interface_LoadItemIcon,0x80112BE4,0xA @@ -1665,10 +1665,10 @@ asm/non_matchings/code/z_parameter/func_80118890.s,func_80118890,0x80118890,0xC5 asm/non_matchings/code/z_parameter/func_80118BA4.s,func_80118BA4,0x80118BA4,0x123 asm/non_matchings/code/z_parameter/func_80119030.s,func_80119030,0x80119030,0x178 asm/non_matchings/code/z_parameter/Interface_DrawClock.s,Interface_DrawClock,0x80119610,0x7B4 -asm/non_matchings/code/z_parameter/Interface_SetPerfectMinigame.s,Interface_SetPerfectMinigame,0x8011B4E0,0x38 -asm/non_matchings/code/z_parameter/func_8011B5C0.s,func_8011B5C0,0x8011B5C0,0x108 -asm/non_matchings/code/z_parameter/func_8011B9E0.s,func_8011B9E0,0x8011B9E0,0x164 -asm/non_matchings/code/z_parameter/func_8011BF70.s,func_8011BF70,0x8011BF70,0x155 +asm/non_matchings/code/z_parameter/Interface_SetMinigamePerfect.s,Interface_SetMinigamePerfect,0x8011B4E0,0x38 +asm/non_matchings/code/z_parameter/Interface_UpdateMinigamePerfectType1.s,Interface_UpdateMinigamePerfectType1,0x8011B5C0,0x108 +asm/non_matchings/code/z_parameter/Interface_UpdateMinigamePerfectType2.s,Interface_UpdateMinigamePerfectType2,0x8011B9E0,0x164 +asm/non_matchings/code/z_parameter/Interface_UpdateMinigamePerfectType3.s,Interface_UpdateMinigamePerfectType3,0x8011BF70,0x155 asm/non_matchings/code/z_parameter/Interface_DrawMinigamePerfect.s,Interface_DrawMinigamePerfect,0x8011C4C4,0xD1 asm/non_matchings/code/z_parameter/Interface_StartMoonCrash.s,Interface_StartMoonCrash,0x8011C808,0x24 asm/non_matchings/code/z_parameter/Interface_GetTimerDigits.s,Interface_GetTimerDigits,0x8011C898,0x73