mirror of https://github.com/zeldaret/mm.git
z_kaleido_mask.c Ok and Documented (Pause Menu Mask Page) (#1093)
* import mask docs * cleanup * some PR * fix merge from master * fix merge * move cursor result
This commit is contained in:
parent
15b9f83bd8
commit
b080fb3700
|
|
@ -440,13 +440,12 @@ typedef struct {
|
|||
/* 0x220 */ f32 unk_220;
|
||||
/* 0x224 */ u16 alpha;
|
||||
/* 0x226 */ s16 offsetY;
|
||||
/* 0x228 */ s32 unk_228;
|
||||
/* 0x22C */ s32 unk_22C;
|
||||
/* 0x230 */ s32 stickRelX;
|
||||
/* 0x234 */ s32 stickRelY;
|
||||
/* 0x228 */ UNK_TYPE1 unk_228[0x8];
|
||||
/* 0x230 */ s32 stickAdjX;
|
||||
/* 0x234 */ s32 stickAdjY;
|
||||
/* 0x238 */ s16 cursorPoint[5];
|
||||
/* 0x242 */ s16 cursorX[5];
|
||||
/* 0x24C */ s16 cursorY[5];
|
||||
/* 0x242 */ s16 cursorXIndex[5];
|
||||
/* 0x24C */ s16 cursorYIndex[5];
|
||||
/* 0x256 */ s16 unk_256;
|
||||
/* 0x258 */ s16 cursorSpecialPos;
|
||||
/* 0x25A */ s16 pageSwitchTimer;
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ typedef struct SaveContext {
|
|||
/* 0x3F64 */ f32 screenScale; // "framescale_scale"
|
||||
/* 0x3F68 */ CycleSceneFlags cycleSceneFlags[120]; // Scene flags that are temporarily stored over the duration of a single 3-day cycle
|
||||
/* 0x48C8 */ u16 dungeonIndex; // "scene_id_mix"
|
||||
/* 0x48CA */ u8 maskMaskBit[27]; // "mask_mask_bit", masks given away on the Moon
|
||||
/* 0x48CA */ u8 masksGivenOnMoon[27]; // bit-packed, masks given away on the Moon. "mask_mask_bit"
|
||||
} SaveContext; // size = 0x48C8
|
||||
|
||||
typedef enum ButtonStatus {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* File: flg_set.c
|
||||
* Description: Event Editor, used to view and edit weekEventReg, eventInf and maskMaskBit flags.
|
||||
* Description: Event Editor, used to view and edit weekEventReg, eventInf and masksGivenOnMoon flags.
|
||||
* Controls:
|
||||
* + Left and Right: select different flags/bits in array element
|
||||
* + Up and Down: select array element (byte) 1 up/down
|
||||
|
|
@ -123,9 +123,9 @@ static FlagSetEntry sFlagEntries[] = {
|
|||
{ &gSaveContext.eventInf[6], "event_inf[6]" },
|
||||
{ &gSaveContext.eventInf[7], "event_inf[7]" },
|
||||
|
||||
{ &gSaveContext.maskMaskBit[0], "mask_mask_bit[0]" },
|
||||
{ &gSaveContext.maskMaskBit[1], "mask_mask_bit[1]" },
|
||||
{ &gSaveContext.maskMaskBit[2], "mask_mask_bit[2]" },
|
||||
{ &gSaveContext.masksGivenOnMoon[0], "mask_mask_bit[0]" },
|
||||
{ &gSaveContext.masksGivenOnMoon[1], "mask_mask_bit[1]" },
|
||||
{ &gSaveContext.masksGivenOnMoon[2], "mask_mask_bit[2]" },
|
||||
|
||||
{ NULL, NULL }, // used in the code to detect array end
|
||||
};
|
||||
|
|
|
|||
|
|
@ -292,8 +292,8 @@ void Sram_SaveEndOfCycle(PlayState* play) {
|
|||
gSaveContext.cycleSceneFlags[i].collectible = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.maskMaskBit); i++) {
|
||||
gSaveContext.maskMaskBit[i] = 0;
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.masksGivenOnMoon); i++) {
|
||||
gSaveContext.masksGivenOnMoon[i] = 0;
|
||||
}
|
||||
|
||||
if (gSaveContext.save.weekEventReg[84] & 0x20) {
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ s32 func_80968E38(s32 arg0) {
|
|||
s32 i;
|
||||
s32 count;
|
||||
u8 mask;
|
||||
u8* maskMaskBit = gSaveContext.maskMaskBit;
|
||||
u8* masksGivenOnMoon = gSaveContext.masksGivenOnMoon;
|
||||
|
||||
if (((arg0 < 0) || (arg0 >= 9))) {
|
||||
return 0;
|
||||
|
|
@ -282,21 +282,21 @@ s32 func_80968E38(s32 arg0) {
|
|||
|
||||
arg0 *= 3;
|
||||
for (mask = 1, i = 0; i < 8; i++, mask <<= 1) {
|
||||
if (maskMaskBit[arg0] & mask) {
|
||||
if (masksGivenOnMoon[arg0] & mask) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
arg0++;
|
||||
for (mask = 1, i = 0; i < 8; i++, mask <<= 1) {
|
||||
if (maskMaskBit[arg0] & mask) {
|
||||
if (masksGivenOnMoon[arg0] & mask) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
arg0++;
|
||||
for (mask = 1, i = 0; i < 5; i++, mask <<= 1) {
|
||||
if (maskMaskBit[arg0] & mask) {
|
||||
if (masksGivenOnMoon[arg0] & mask) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
|
@ -373,15 +373,15 @@ s32 EnJs_GetRemainingMasks(void) {
|
|||
}
|
||||
|
||||
void EnJs_TakeMask(s32 actionParams, s32 childType) {
|
||||
u8* maskMaskBit = gSaveContext.maskMaskBit;
|
||||
u8* masksGivenOnMoon = gSaveContext.masksGivenOnMoon;
|
||||
s32 temp = 0;
|
||||
|
||||
if ((childType >= 0) && (childType < 9)) {
|
||||
actionParams -= PLAYER_AP_MASK_TRUTH;
|
||||
childType *= 3;
|
||||
if (actionParams < 8) {
|
||||
maskMaskBit[childType] |= 1 << actionParams;
|
||||
maskMaskBit[temp] |= 1 << actionParams;
|
||||
masksGivenOnMoon[childType] |= 1 << actionParams;
|
||||
masksGivenOnMoon[temp] |= 1 << actionParams;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -389,8 +389,8 @@ void EnJs_TakeMask(s32 actionParams, s32 childType) {
|
|||
childType++;
|
||||
temp++;
|
||||
if (actionParams < 8) {
|
||||
maskMaskBit[childType] |= 1 << actionParams;
|
||||
maskMaskBit[temp] |= 1 << actionParams;
|
||||
masksGivenOnMoon[childType] |= 1 << actionParams;
|
||||
masksGivenOnMoon[temp] |= 1 << actionParams;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -398,8 +398,8 @@ void EnJs_TakeMask(s32 actionParams, s32 childType) {
|
|||
childType++;
|
||||
temp++;
|
||||
if (actionParams < 6) {
|
||||
maskMaskBit[childType] |= 1 << actionParams;
|
||||
maskMaskBit[temp] |= 1 << actionParams;
|
||||
masksGivenOnMoon[childType] |= 1 << actionParams;
|
||||
masksGivenOnMoon[temp] |= 1 << actionParams;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -457,15 +457,15 @@ s32 func_8096933C(s32 arg0) {
|
|||
}
|
||||
|
||||
void func_80969400(s32 arg0) {
|
||||
u8* maskMaskBit = gSaveContext.maskMaskBit;
|
||||
u8* temp_v0 = &gSaveContext.maskMaskBit[arg0 * 3];
|
||||
u8* masksGivenOnMoon = gSaveContext.masksGivenOnMoon;
|
||||
u8* temp_v0 = &gSaveContext.masksGivenOnMoon[arg0 * 3];
|
||||
|
||||
if ((arg0 >= 0) && (arg0 < 9)) {
|
||||
maskMaskBit[0] &= ~temp_v0[0];
|
||||
maskMaskBit[1] &= ~temp_v0[1];
|
||||
masksGivenOnMoon[0] &= ~temp_v0[0];
|
||||
masksGivenOnMoon[1] &= ~temp_v0[1];
|
||||
|
||||
temp_v0[2] &= 0xF;
|
||||
maskMaskBit[2] &= ~temp_v0[2];
|
||||
masksGivenOnMoon[2] &= ~temp_v0[2];
|
||||
|
||||
temp_v0[0] = 0;
|
||||
temp_v0[1] = 0;
|
||||
|
|
|
|||
|
|
@ -663,8 +663,8 @@ void KaleidoScope_UpdateInventoryEditor(PlayState* play) {
|
|||
s16 value;
|
||||
s32 dBtnInput = input->cur.button & (BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT);
|
||||
|
||||
pauseCtx->stickRelX = input->rel.stick_x;
|
||||
pauseCtx->stickRelY = input->rel.stick_y;
|
||||
pauseCtx->stickAdjX = input->rel.stick_x;
|
||||
pauseCtx->stickAdjY = input->rel.stick_y;
|
||||
|
||||
// Handles navigating the menu to different sections with the D-Pad
|
||||
// When the same direction is held, registers the input periodically based on a timer
|
||||
|
|
|
|||
|
|
@ -7,13 +7,6 @@
|
|||
#include "z_kaleido_scope.h"
|
||||
#include "interface/parameter_static/parameter_static.h"
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ EQUIP_STATE_MAGIC_ARROW_GROW_ORB,
|
||||
/* 1 */ EQUIP_STATE_MAGIC_ARROW_MOVE_TO_BOW_SLOT,
|
||||
/* 2 */ EQUIP_STATE_MAGIC_ARROW_HOVER_OVER_BOW_SLOT,
|
||||
/* 3 */ EQUIP_STATE_MOVE_TO_C_BTN
|
||||
} EquipState;
|
||||
|
||||
s16 sEquipState = EQUIP_STATE_MAGIC_ARROW_GROW_ORB;
|
||||
|
||||
// Timer to hold magic arrow icon over magic arrow slot before moving when equipping.
|
||||
|
|
@ -355,8 +348,8 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) {
|
|||
u16 cursorSlot;
|
||||
u8 magicArrowIndex;
|
||||
s16 cursorPoint;
|
||||
s16 cursorX;
|
||||
s16 cursorY;
|
||||
s16 cursorXIndex;
|
||||
s16 cursorYIndex;
|
||||
s16 oldCursorPoint;
|
||||
s16 moveCursorResult;
|
||||
s16 pad2;
|
||||
|
|
@ -366,7 +359,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) {
|
|||
|
||||
if ((pauseCtx->state == 6) && (pauseCtx->unk_200 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM) &&
|
||||
!pauseCtx->itemDescriptionOn) {
|
||||
moveCursorResult = 0;
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_NONE;
|
||||
oldCursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM];
|
||||
|
||||
cursorItem = pauseCtx->cursorItem[PAUSE_ITEM];
|
||||
|
|
@ -376,87 +369,87 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) {
|
|||
// cursor is currently on a slot
|
||||
pauseCtx->cursorColorSet = 2;
|
||||
|
||||
if (ABS_ALT(pauseCtx->stickRelX) > 30) {
|
||||
if (ABS_ALT(pauseCtx->stickAdjX) > 30) {
|
||||
cursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM];
|
||||
cursorX = pauseCtx->cursorX[PAUSE_ITEM];
|
||||
cursorY = pauseCtx->cursorY[PAUSE_ITEM];
|
||||
cursorXIndex = pauseCtx->cursorXIndex[PAUSE_ITEM];
|
||||
cursorYIndex = pauseCtx->cursorYIndex[PAUSE_ITEM];
|
||||
|
||||
// Search for slot to move to
|
||||
while (moveCursorResult == 0) {
|
||||
if (pauseCtx->stickRelX < -30) {
|
||||
while (moveCursorResult == PAUSE_CURSOR_RESULT_NONE) {
|
||||
if (pauseCtx->stickAdjX < -30) {
|
||||
// move cursor left
|
||||
pauseCtx->unk_298 = 4.0f;
|
||||
if (pauseCtx->cursorX[PAUSE_ITEM] != 0) {
|
||||
pauseCtx->cursorX[PAUSE_ITEM]--;
|
||||
if (pauseCtx->cursorXIndex[PAUSE_ITEM] != 0) {
|
||||
pauseCtx->cursorXIndex[PAUSE_ITEM]--;
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM]--;
|
||||
moveCursorResult = 1;
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SLOT;
|
||||
} else {
|
||||
pauseCtx->cursorX[PAUSE_ITEM] = cursorX;
|
||||
pauseCtx->cursorY[PAUSE_ITEM]++;
|
||||
pauseCtx->cursorXIndex[PAUSE_ITEM] = cursorXIndex;
|
||||
pauseCtx->cursorYIndex[PAUSE_ITEM]++;
|
||||
|
||||
if (pauseCtx->cursorY[PAUSE_ITEM] >= 4) {
|
||||
pauseCtx->cursorY[PAUSE_ITEM] = 0;
|
||||
if (pauseCtx->cursorYIndex[PAUSE_ITEM] >= 4) {
|
||||
pauseCtx->cursorYIndex[PAUSE_ITEM] = 0;
|
||||
}
|
||||
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] =
|
||||
pauseCtx->cursorX[PAUSE_ITEM] + (pauseCtx->cursorY[PAUSE_ITEM] * 6);
|
||||
pauseCtx->cursorXIndex[PAUSE_ITEM] + (pauseCtx->cursorYIndex[PAUSE_ITEM] * 6);
|
||||
|
||||
if (pauseCtx->cursorPoint[PAUSE_ITEM] >= 24) {
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] = pauseCtx->cursorX[PAUSE_ITEM];
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] = pauseCtx->cursorXIndex[PAUSE_ITEM];
|
||||
}
|
||||
|
||||
if (cursorY == pauseCtx->cursorY[PAUSE_ITEM]) {
|
||||
pauseCtx->cursorX[PAUSE_ITEM] = cursorX;
|
||||
if (cursorYIndex == pauseCtx->cursorYIndex[PAUSE_ITEM]) {
|
||||
pauseCtx->cursorXIndex[PAUSE_ITEM] = cursorXIndex;
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint;
|
||||
|
||||
KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT);
|
||||
|
||||
moveCursorResult = 2;
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS;
|
||||
}
|
||||
}
|
||||
} else if (pauseCtx->stickRelX > 30) {
|
||||
} else if (pauseCtx->stickAdjX > 30) {
|
||||
// move cursor right
|
||||
pauseCtx->unk_298 = 4.0f;
|
||||
if (pauseCtx->cursorX[PAUSE_ITEM] <= 4) {
|
||||
pauseCtx->cursorX[PAUSE_ITEM]++;
|
||||
if (pauseCtx->cursorXIndex[PAUSE_ITEM] <= 4) {
|
||||
pauseCtx->cursorXIndex[PAUSE_ITEM]++;
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM]++;
|
||||
moveCursorResult = 1;
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SLOT;
|
||||
} else {
|
||||
pauseCtx->cursorX[PAUSE_ITEM] = cursorX;
|
||||
pauseCtx->cursorY[PAUSE_ITEM]++;
|
||||
pauseCtx->cursorXIndex[PAUSE_ITEM] = cursorXIndex;
|
||||
pauseCtx->cursorYIndex[PAUSE_ITEM]++;
|
||||
|
||||
if (pauseCtx->cursorY[PAUSE_ITEM] >= 4) {
|
||||
pauseCtx->cursorY[PAUSE_ITEM] = 0;
|
||||
if (pauseCtx->cursorYIndex[PAUSE_ITEM] >= 4) {
|
||||
pauseCtx->cursorYIndex[PAUSE_ITEM] = 0;
|
||||
}
|
||||
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] =
|
||||
pauseCtx->cursorX[PAUSE_ITEM] + (pauseCtx->cursorY[PAUSE_ITEM] * 6);
|
||||
pauseCtx->cursorXIndex[PAUSE_ITEM] + (pauseCtx->cursorYIndex[PAUSE_ITEM] * 6);
|
||||
|
||||
if (pauseCtx->cursorPoint[PAUSE_ITEM] >= 24) {
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] = pauseCtx->cursorX[PAUSE_ITEM];
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] = pauseCtx->cursorXIndex[PAUSE_ITEM];
|
||||
}
|
||||
|
||||
if (cursorY == pauseCtx->cursorY[PAUSE_ITEM]) {
|
||||
pauseCtx->cursorX[PAUSE_ITEM] = cursorX;
|
||||
if (cursorYIndex == pauseCtx->cursorYIndex[PAUSE_ITEM]) {
|
||||
pauseCtx->cursorXIndex[PAUSE_ITEM] = cursorXIndex;
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint;
|
||||
|
||||
KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT);
|
||||
|
||||
moveCursorResult = 2;
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (moveCursorResult == 1) {
|
||||
if (moveCursorResult == PAUSE_CURSOR_RESULT_SLOT) {
|
||||
cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]];
|
||||
}
|
||||
}
|
||||
} else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) {
|
||||
if (pauseCtx->stickRelX > 30) {
|
||||
if (pauseCtx->stickAdjX > 30) {
|
||||
func_80821A04(play);
|
||||
cursorY = 0;
|
||||
cursorX = 0;
|
||||
cursorYIndex = 0;
|
||||
cursorXIndex = 0;
|
||||
cursorPoint = 0; // top row, left column (SLOT_OCARINA)
|
||||
|
||||
// Search for slot to move to
|
||||
|
|
@ -464,24 +457,24 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) {
|
|||
// Check if current cursor has an item in its slot
|
||||
if (gSaveContext.save.inventory.items[cursorPoint] != ITEM_NONE) {
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint;
|
||||
pauseCtx->cursorX[PAUSE_ITEM] = cursorX;
|
||||
pauseCtx->cursorY[PAUSE_ITEM] = cursorY;
|
||||
moveCursorResult = 1;
|
||||
pauseCtx->cursorXIndex[PAUSE_ITEM] = cursorXIndex;
|
||||
pauseCtx->cursorYIndex[PAUSE_ITEM] = cursorYIndex;
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SLOT;
|
||||
break;
|
||||
}
|
||||
|
||||
// move 1 row down and retry
|
||||
cursorY++;
|
||||
cursorYIndex++;
|
||||
cursorPoint += 6;
|
||||
if (cursorY < 4) {
|
||||
if (cursorYIndex < 4) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// move 1 column right and retry
|
||||
cursorY = 0;
|
||||
cursorPoint = cursorX + 1;
|
||||
cursorX = cursorPoint;
|
||||
if (cursorX < 6) {
|
||||
cursorYIndex = 0;
|
||||
cursorPoint = cursorXIndex + 1;
|
||||
cursorXIndex = cursorPoint;
|
||||
if (cursorXIndex < 6) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -491,35 +484,35 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) {
|
|||
}
|
||||
}
|
||||
} else { // PAUSE_CURSOR_PAGE_RIGHT
|
||||
if (pauseCtx->stickRelX < -30) {
|
||||
if (pauseCtx->stickAdjX < -30) {
|
||||
func_80821A04(play);
|
||||
cursorX = 5;
|
||||
cursorXIndex = 5;
|
||||
cursorPoint = 5; // top row, right columne (SLOT_TRADE_DEED)
|
||||
cursorY = 0;
|
||||
cursorYIndex = 0;
|
||||
|
||||
// Search for slot to move to
|
||||
while (true) {
|
||||
// Check if current cursor has an item in its slot
|
||||
if (gSaveContext.save.inventory.items[cursorPoint] != ITEM_NONE) {
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint;
|
||||
pauseCtx->cursorX[PAUSE_ITEM] = cursorX;
|
||||
pauseCtx->cursorY[PAUSE_ITEM] = cursorY;
|
||||
moveCursorResult = 1;
|
||||
pauseCtx->cursorXIndex[PAUSE_ITEM] = cursorXIndex;
|
||||
pauseCtx->cursorYIndex[PAUSE_ITEM] = cursorYIndex;
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SLOT;
|
||||
break;
|
||||
}
|
||||
|
||||
// move 1 row down and retry
|
||||
cursorY++;
|
||||
cursorYIndex++;
|
||||
cursorPoint += 6;
|
||||
if (cursorY < 4) {
|
||||
if (cursorYIndex < 4) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// move 1 column left and retry
|
||||
cursorY = 0;
|
||||
cursorPoint = cursorX - 1;
|
||||
cursorX = cursorPoint;
|
||||
if (cursorX >= 0) {
|
||||
cursorYIndex = 0;
|
||||
cursorPoint = cursorXIndex - 1;
|
||||
cursorXIndex = cursorPoint;
|
||||
if (cursorXIndex >= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -532,35 +525,35 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) {
|
|||
|
||||
if (pauseCtx->cursorSpecialPos == 0) {
|
||||
// move cursor up/down
|
||||
if (ABS_ALT(pauseCtx->stickRelY) > 30) {
|
||||
moveCursorResult = 0;
|
||||
if (ABS_ALT(pauseCtx->stickAdjY) > 30) {
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_NONE;
|
||||
|
||||
cursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM];
|
||||
cursorY = pauseCtx->cursorY[PAUSE_ITEM];
|
||||
cursorYIndex = pauseCtx->cursorYIndex[PAUSE_ITEM];
|
||||
|
||||
while (moveCursorResult == 0) {
|
||||
if (pauseCtx->stickRelY > 30) {
|
||||
while (moveCursorResult == PAUSE_CURSOR_RESULT_NONE) {
|
||||
if (pauseCtx->stickAdjY > 30) {
|
||||
// move cursor up
|
||||
moveCursorResult = 2;
|
||||
if (pauseCtx->cursorY[PAUSE_ITEM] != 0) {
|
||||
pauseCtx->cursorY[PAUSE_ITEM]--;
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS;
|
||||
if (pauseCtx->cursorYIndex[PAUSE_ITEM] != 0) {
|
||||
pauseCtx->cursorYIndex[PAUSE_ITEM]--;
|
||||
pauseCtx->unk_298 = 4.0f;
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] -= 6;
|
||||
moveCursorResult = 1;
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SLOT;
|
||||
} else {
|
||||
pauseCtx->cursorY[PAUSE_ITEM] = cursorY;
|
||||
pauseCtx->cursorYIndex[PAUSE_ITEM] = cursorYIndex;
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint;
|
||||
}
|
||||
} else if (pauseCtx->stickRelY < -30) {
|
||||
} else if (pauseCtx->stickAdjY < -30) {
|
||||
// move cursor down
|
||||
moveCursorResult = 2;
|
||||
if (pauseCtx->cursorY[PAUSE_ITEM] < 3) {
|
||||
pauseCtx->cursorY[PAUSE_ITEM]++;
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS;
|
||||
if (pauseCtx->cursorYIndex[PAUSE_ITEM] < 3) {
|
||||
pauseCtx->cursorYIndex[PAUSE_ITEM]++;
|
||||
pauseCtx->unk_298 = 4.0f;
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] += 6;
|
||||
moveCursorResult = 1;
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SLOT;
|
||||
} else {
|
||||
pauseCtx->cursorY[PAUSE_ITEM] = cursorY;
|
||||
pauseCtx->cursorYIndex[PAUSE_ITEM] = cursorYIndex;
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint;
|
||||
}
|
||||
}
|
||||
|
|
@ -570,9 +563,9 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) {
|
|||
cursorSlot = pauseCtx->cursorPoint[PAUSE_ITEM];
|
||||
pauseCtx->cursorColorSet = 2;
|
||||
|
||||
if (moveCursorResult == 1) {
|
||||
if (moveCursorResult == PAUSE_CURSOR_RESULT_SLOT) {
|
||||
cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]];
|
||||
} else if (moveCursorResult != 2) {
|
||||
} else if (moveCursorResult != PAUSE_CURSOR_RESULT_SPECIAL_POS) {
|
||||
cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]];
|
||||
}
|
||||
|
||||
|
|
@ -683,7 +676,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) {
|
|||
(msgCtx->msgLength == 0)) {
|
||||
// Give description on item through a message box
|
||||
pauseCtx->itemDescriptionOn = true;
|
||||
if (pauseCtx->cursorY[PAUSE_ITEM] < 2) {
|
||||
if (pauseCtx->cursorYIndex[PAUSE_ITEM] < 2) {
|
||||
func_801514B0(play, 0x1700 + pauseCtx->cursorItem[PAUSE_ITEM], 3);
|
||||
} else {
|
||||
func_801514B0(play, 0x1700 + pauseCtx->cursorItem[PAUSE_ITEM], 1);
|
||||
|
|
|
|||
|
|
@ -1,59 +1,810 @@
|
|||
/*
|
||||
* File: z_kaleido_mask.c
|
||||
* Overlay: ovl_kaleido_scope
|
||||
* Description:
|
||||
* Description: Pause Menu - Mask Page
|
||||
*/
|
||||
|
||||
#include "z_kaleido_scope.h"
|
||||
#include "interface/parameter_static/parameter_static.h"
|
||||
|
||||
extern UNK_TYPE D_02001360;
|
||||
extern UNK_TYPE D_020044A0;
|
||||
extern UNK_TYPE D_02004AA0;
|
||||
extern UNK_TYPE D_0200B998;
|
||||
extern UNK_TYPE D_08062000;
|
||||
extern UNK_TYPE D_08064340;
|
||||
extern UNK_TYPE D_0B000000;
|
||||
extern UNK_TYPE D_0C000000;
|
||||
extern UNK_TYPE D_0C006C00;
|
||||
s16 sMaskEquipState = EQUIP_STATE_MAGIC_ARROW_GROW_ORB;
|
||||
|
||||
s32 D_8082B600 = 0;
|
||||
// Timer to hold magic arrow icon over magic arrow slot before moving when equipping.
|
||||
s16 sMaskEquipMagicArrowSlotHoldTimer = 0;
|
||||
|
||||
s32 D_8082B604 = 0;
|
||||
// Number of frames to move icon from slot to target position when equipping.
|
||||
s16 sMaskEquipAnimTimer = 10;
|
||||
|
||||
s16 D_8082B608 = 10;
|
||||
|
||||
s32 D_8082B60C[] = {
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00010000,
|
||||
0x00000001, 0x00000000, 0x00010000, 0x00000001, 0x00000000, 0x00010000, 0x00000001, 0x00000000,
|
||||
0x00010000, 0x00000001, 0x00000000, 0x00010000, 0x00000001, 0x00000000, 0x00010000, 0x00000001,
|
||||
0x01010101, 0x01010101, 0x01010101, 0x01010101, 0x01010101, 0x01010101,
|
||||
u8 gMaskPlayerFormSlotRestrictions[PLAYER_FORM_MAX][NUM_MASK_SLOTS] = {
|
||||
// Fierce Deity
|
||||
{
|
||||
false, // SLOT_MASK_POSTMAN
|
||||
false, // SLOT_MASK_ALL_NIGHT
|
||||
false, // SLOT_MASK_BLAST
|
||||
false, // SLOT_MASK_STONE
|
||||
false, // SLOT_MASK_GREAT_FAIRY
|
||||
false, // SLOT_MASK_DEKU
|
||||
false, // SLOT_MASK_KEATON
|
||||
false, // SLOT_MASK_BREMEN
|
||||
false, // SLOT_MASK_BUNNY
|
||||
false, // SLOT_MASK_DON_GERO
|
||||
false, // SLOT_MASK_SCENTS
|
||||
false, // SLOT_MASK_GORON
|
||||
false, // SLOT_MASK_ROMANI
|
||||
false, // SLOT_MASK_CIRCUS_LEADER
|
||||
false, // SLOT_MASK_KAFEIS_MASK
|
||||
false, // SLOT_MASK_COUPLE
|
||||
false, // SLOT_MASK_TRUTH
|
||||
false, // SLOT_MASK_ZORA
|
||||
false, // SLOT_MASK_KAMARO
|
||||
false, // SLOT_MASK_GIBDO
|
||||
false, // SLOT_MASK_GARO
|
||||
false, // SLOT_MASK_CAPTAIN
|
||||
false, // SLOT_MASK_GIANT
|
||||
true, // SLOT_MASK_FIERCE_DEITY
|
||||
},
|
||||
// Goron
|
||||
{
|
||||
false, // SLOT_MASK_POSTMAN
|
||||
false, // SLOT_MASK_ALL_NIGHT
|
||||
false, // SLOT_MASK_BLAST
|
||||
false, // SLOT_MASK_STONE
|
||||
false, // SLOT_MASK_GREAT_FAIRY
|
||||
true, // SLOT_MASK_DEKU
|
||||
false, // SLOT_MASK_KEATON
|
||||
false, // SLOT_MASK_BREMEN
|
||||
false, // SLOT_MASK_BUNNY
|
||||
false, // SLOT_MASK_DON_GERO
|
||||
false, // SLOT_MASK_SCENTS
|
||||
true, // SLOT_MASK_GORON
|
||||
false, // SLOT_MASK_ROMANI
|
||||
false, // SLOT_MASK_CIRCUS_LEADER
|
||||
false, // SLOT_MASK_KAFEIS_MASK
|
||||
false, // SLOT_MASK_COUPLE
|
||||
false, // SLOT_MASK_TRUTH
|
||||
true, // SLOT_MASK_ZORA
|
||||
false, // SLOT_MASK_KAMARO
|
||||
false, // SLOT_MASK_GIBDO
|
||||
false, // SLOT_MASK_GARO
|
||||
false, // SLOT_MASK_CAPTAIN
|
||||
false, // SLOT_MASK_GIANT
|
||||
true, // SLOT_MASK_FIERCE_DEITY
|
||||
},
|
||||
// Zora
|
||||
{
|
||||
false, // SLOT_MASK_POSTMAN
|
||||
false, // SLOT_MASK_ALL_NIGHT
|
||||
false, // SLOT_MASK_BLAST
|
||||
false, // SLOT_MASK_STONE
|
||||
false, // SLOT_MASK_GREAT_FAIRY
|
||||
true, // SLOT_MASK_DEKU
|
||||
false, // SLOT_MASK_KEATON
|
||||
false, // SLOT_MASK_BREMEN
|
||||
false, // SLOT_MASK_BUNNY
|
||||
false, // SLOT_MASK_DON_GERO
|
||||
false, // SLOT_MASK_SCENTS
|
||||
true, // SLOT_MASK_GORON
|
||||
false, // SLOT_MASK_ROMANI
|
||||
false, // SLOT_MASK_CIRCUS_LEADER
|
||||
false, // SLOT_MASK_KAFEIS_MASK
|
||||
false, // SLOT_MASK_COUPLE
|
||||
false, // SLOT_MASK_TRUTH
|
||||
true, // SLOT_MASK_ZORA
|
||||
false, // SLOT_MASK_KAMARO
|
||||
false, // SLOT_MASK_GIBDO
|
||||
false, // SLOT_MASK_GARO
|
||||
false, // SLOT_MASK_CAPTAIN
|
||||
false, // SLOT_MASK_GIANT
|
||||
true, // SLOT_MASK_FIERCE_DEITY
|
||||
},
|
||||
// Deku
|
||||
{
|
||||
false, // SLOT_MASK_POSTMAN
|
||||
false, // SLOT_MASK_ALL_NIGHT
|
||||
false, // SLOT_MASK_BLAST
|
||||
false, // SLOT_MASK_STONE
|
||||
false, // SLOT_MASK_GREAT_FAIRY
|
||||
true, // SLOT_MASK_DEKU
|
||||
false, // SLOT_MASK_KEATON
|
||||
false, // SLOT_MASK_BREMEN
|
||||
false, // SLOT_MASK_BUNNY
|
||||
false, // SLOT_MASK_DON_GERO
|
||||
false, // SLOT_MASK_SCENTS
|
||||
true, // SLOT_MASK_GORON
|
||||
false, // SLOT_MASK_ROMANI
|
||||
false, // SLOT_MASK_CIRCUS_LEADER
|
||||
false, // SLOT_MASK_KAFEIS_MASK
|
||||
false, // SLOT_MASK_COUPLE
|
||||
false, // SLOT_MASK_TRUTH
|
||||
true, // SLOT_MASK_ZORA
|
||||
false, // SLOT_MASK_KAMARO
|
||||
false, // SLOT_MASK_GIBDO
|
||||
false, // SLOT_MASK_GARO
|
||||
false, // SLOT_MASK_CAPTAIN
|
||||
false, // SLOT_MASK_GIANT
|
||||
true, // SLOT_MASK_FIERCE_DEITY
|
||||
},
|
||||
// Human
|
||||
{
|
||||
true, // SLOT_MASK_POSTMAN
|
||||
true, // SLOT_MASK_ALL_NIGHT
|
||||
true, // SLOT_MASK_BLAST
|
||||
true, // SLOT_MASK_STONE
|
||||
true, // SLOT_MASK_GREAT_FAIRY
|
||||
true, // SLOT_MASK_DEKU
|
||||
true, // SLOT_MASK_KEATON
|
||||
true, // SLOT_MASK_BREMEN
|
||||
true, // SLOT_MASK_BUNNY
|
||||
true, // SLOT_MASK_DON_GERO
|
||||
true, // SLOT_MASK_SCENTS
|
||||
true, // SLOT_MASK_GORON
|
||||
true, // SLOT_MASK_ROMANI
|
||||
true, // SLOT_MASK_CIRCUS_LEADER
|
||||
true, // SLOT_MASK_KAFEIS_MASK
|
||||
true, // SLOT_MASK_COUPLE
|
||||
true, // SLOT_MASK_TRUTH
|
||||
true, // SLOT_MASK_ZORA
|
||||
true, // SLOT_MASK_KAMARO
|
||||
true, // SLOT_MASK_GIBDO
|
||||
true, // SLOT_MASK_GARO
|
||||
true, // SLOT_MASK_CAPTAIN
|
||||
true, // SLOT_MASK_GIANT
|
||||
true, // SLOT_MASK_FIERCE_DEITY
|
||||
},
|
||||
};
|
||||
|
||||
s32 D_8082B684[] = {
|
||||
0x01010004, 0x02020180, 0x01040210, 0x00100201, 0x00080110, 0x02040220, 0x00400080, 0x00020102, 0x00010240,
|
||||
0x01200108, 0x00200140, 0x02080280, 0x00FF0064, 0x00FF0000, 0x00000064, 0x00FF0000, 0x000000FF, 0x00640000,
|
||||
#define SET_MOON_MASK_BIT(masksGivenOnMoonIndex, masksGivenOnMoonFlag) \
|
||||
((masksGivenOnMoonIndex) << 8 | (masksGivenOnMoonFlag))
|
||||
#define CHECK_GIVEN_MASK_ON_MOON(maskIndex) \
|
||||
(gSaveContext.masksGivenOnMoon[sMasksGivenOnMoonBits[maskIndex] >> 8] & (u8)sMasksGivenOnMoonBits[maskIndex])
|
||||
|
||||
u16 sMasksGivenOnMoonBits[] = {
|
||||
SET_MOON_MASK_BIT(1, 0x1), // SLOT_MASK_POSTMAN
|
||||
SET_MOON_MASK_BIT(0, 0x4), // SLOT_MASK_ALL_NIGHT
|
||||
SET_MOON_MASK_BIT(2, 0x2), // SLOT_MASK_BLAST
|
||||
SET_MOON_MASK_BIT(1, 0x80), // SLOT_MASK_STONE
|
||||
SET_MOON_MASK_BIT(1, 0x4), // SLOT_MASK_GREAT_FAIRY
|
||||
SET_MOON_MASK_BIT(2, 0x10), // SLOT_MASK_DEKU
|
||||
SET_MOON_MASK_BIT(0, 0x10), // SLOT_MASK_KEATON
|
||||
SET_MOON_MASK_BIT(2, 0x1), // SLOT_MASK_BREMEN
|
||||
SET_MOON_MASK_BIT(0, 0x8), // SLOT_MASK_BUNNY
|
||||
SET_MOON_MASK_BIT(1, 0x10), // SLOT_MASK_DON_GERO
|
||||
SET_MOON_MASK_BIT(2, 0x4), // SLOT_MASK_SCENTS
|
||||
SET_MOON_MASK_BIT(2, 0x20), // SLOT_MASK_GORON
|
||||
SET_MOON_MASK_BIT(0, 0x40), // SLOT_MASK_ROMANI
|
||||
SET_MOON_MASK_BIT(0, 0x80), // SLOT_MASK_CIRCUS_LEADER
|
||||
SET_MOON_MASK_BIT(0, 0x2), // SLOT_MASK_KAFEIS_MASK
|
||||
SET_MOON_MASK_BIT(1, 0x2), // SLOT_MASK_COUPLE
|
||||
SET_MOON_MASK_BIT(0, 0x1), // SLOT_MASK_TRUTH
|
||||
SET_MOON_MASK_BIT(2, 0x40), // SLOT_MASK_ZORA
|
||||
SET_MOON_MASK_BIT(1, 0x20), // SLOT_MASK_KAMARO
|
||||
SET_MOON_MASK_BIT(1, 0x8), // SLOT_MASK_GIBDO
|
||||
SET_MOON_MASK_BIT(0, 0x20), // SLOT_MASK_GARO
|
||||
SET_MOON_MASK_BIT(1, 0x40), // SLOT_MASK_CAPTAIN
|
||||
SET_MOON_MASK_BIT(2, 0x8), // SLOT_MASK_GIANT
|
||||
SET_MOON_MASK_BIT(2, 0X80), // SLOT_MASK_FIERCE_DEITY
|
||||
};
|
||||
|
||||
u8 D_8082B6CC[] = { 0x35, 0x33, 0x34, 0x32, 0xFF };
|
||||
s16 sMaskMagicArrowEffectsR[] = { 255, 100, 255 };
|
||||
s16 sMaskMagicArrowEffectsG[] = { 0, 100, 255 };
|
||||
s16 sMaskMagicArrowEffectsB[] = { 0, 255, 100 };
|
||||
|
||||
s16 D_8082B6D4[] = {
|
||||
0x0294,
|
||||
0x0384,
|
||||
0x0474,
|
||||
0x0000,
|
||||
void KaleidoScope_DrawMaskSelect(PlayState* play) {
|
||||
PauseContext* pauseCtx = &play->pauseCtx;
|
||||
u16 i;
|
||||
u16 j;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_MASK] * 4, pauseCtx->maskVtx);
|
||||
|
||||
func_8012C8AC(play->state.gfxCtx);
|
||||
|
||||
// Draw a white box around the items that are equipped on the C buttons
|
||||
// Loop over c-buttons (i) and vtx offset (j)
|
||||
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
|
||||
for (i = 0, j = NUM_MASK_SLOTS * 4; i < 3; i++, j += 4) {
|
||||
if (GET_CUR_FORM_BTN_ITEM(i + 1) != ITEM_NONE) {
|
||||
if (GET_CUR_FORM_BTN_SLOT(i + 1) >= NUM_ITEM_SLOTS) {
|
||||
gSPVertex(POLY_OPA_DISP++, &pauseCtx->maskVtx[j], 4, 0);
|
||||
POLY_OPA_DISP = func_8010DC58(POLY_OPA_DISP, gEquippedItemOutlineTex, 32, 32, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
|
||||
// Draw the item icons
|
||||
// Loop over slots (i) and vtx offset (j)
|
||||
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
||||
for (j = 0, i = 0; i < NUM_MASK_SLOTS; i++, j += 4) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
|
||||
|
||||
if (((void)0, gSaveContext.save.inventory.items[i + NUM_ITEM_SLOTS]) != ITEM_NONE) {
|
||||
if (!CHECK_GIVEN_MASK_ON_MOON(i)) {
|
||||
if ((pauseCtx->unk_200 == 0) && (pauseCtx->pageIndex == PAUSE_MASK) &&
|
||||
(pauseCtx->cursorSpecialPos == 0) &&
|
||||
gMaskPlayerFormSlotRestrictions[(void)0, gSaveContext.save.playerForm][i]) {
|
||||
if ((sMaskEquipState == EQUIP_STATE_MAGIC_ARROW_HOVER_OVER_BOW_SLOT) && (i == SLOT_ARROW_ICE)) {
|
||||
// Possible bug:
|
||||
// Supposed to be `SLOT_BOW`, unchanged from OoT, instead increase size of ice arrow icon
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0,
|
||||
sMaskMagicArrowEffectsR[pauseCtx->equipTargetItem - 0xB5],
|
||||
sMaskMagicArrowEffectsG[pauseCtx->equipTargetItem - 0xB5],
|
||||
sMaskMagicArrowEffectsB[pauseCtx->equipTargetItem - 0xB5], pauseCtx->alpha);
|
||||
|
||||
pauseCtx->maskVtx[j + 0].v.ob[0] = pauseCtx->maskVtx[j + 2].v.ob[0] =
|
||||
pauseCtx->maskVtx[j + 0].v.ob[0] - 2;
|
||||
pauseCtx->maskVtx[j + 1].v.ob[0] = pauseCtx->maskVtx[j + 3].v.ob[0] =
|
||||
pauseCtx->maskVtx[j + 0].v.ob[0] + 32;
|
||||
pauseCtx->maskVtx[j + 0].v.ob[1] = pauseCtx->maskVtx[j + 1].v.ob[1] =
|
||||
pauseCtx->maskVtx[j + 0].v.ob[1] + 2;
|
||||
pauseCtx->maskVtx[j + 2].v.ob[1] = pauseCtx->maskVtx[j + 3].v.ob[1] =
|
||||
pauseCtx->maskVtx[j + 0].v.ob[1] - 32;
|
||||
|
||||
} else if (i == pauseCtx->cursorSlot[PAUSE_MASK]) {
|
||||
// Increase the size of the selected item
|
||||
pauseCtx->maskVtx[j + 0].v.ob[0] = pauseCtx->maskVtx[j + 2].v.ob[0] =
|
||||
pauseCtx->maskVtx[j + 0].v.ob[0] - 2;
|
||||
pauseCtx->maskVtx[j + 1].v.ob[0] = pauseCtx->maskVtx[j + 3].v.ob[0] =
|
||||
pauseCtx->maskVtx[j + 0].v.ob[0] + 32;
|
||||
pauseCtx->maskVtx[j + 0].v.ob[1] = pauseCtx->maskVtx[j + 1].v.ob[1] =
|
||||
pauseCtx->maskVtx[j + 0].v.ob[1] + 2;
|
||||
pauseCtx->maskVtx[j + 2].v.ob[1] = pauseCtx->maskVtx[j + 3].v.ob[1] =
|
||||
pauseCtx->maskVtx[j + 0].v.ob[1] - 32;
|
||||
}
|
||||
}
|
||||
|
||||
gSPVertex(POLY_OPA_DISP++, &pauseCtx->maskVtx[j + 0], 4, 0);
|
||||
KaleidoScope_DrawQuadTextureRGBA32(
|
||||
play->state.gfxCtx, gItemIcons[((void)0, gSaveContext.save.inventory.items[i + NUM_ITEM_SLOTS])],
|
||||
32, 32, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
u8 sMaskPlayerFormItems[] = {
|
||||
ITEM_MASK_FIERCE_DEITY, ITEM_MASK_GORON, ITEM_MASK_ZORA, ITEM_MASK_DEKU, ITEM_NONE,
|
||||
};
|
||||
|
||||
s16 D_8082B6DC[] = {
|
||||
0x044C,
|
||||
0x0398,
|
||||
0x044C,
|
||||
0x0000,
|
||||
};
|
||||
void KaleidoScope_UpdateMaskCursor(PlayState* play) {
|
||||
Input* input = CONTROLLER1(&play->state);
|
||||
PauseContext* pauseCtx = &play->pauseCtx;
|
||||
MessageContext* msgCtx = &play->msgCtx;
|
||||
u16 vtxIndex;
|
||||
u16 cursorItem;
|
||||
u16 cursorSlot;
|
||||
s16 cursorPoint;
|
||||
s16 cursorXIndex;
|
||||
s16 cursorYIndex;
|
||||
s16 oldCursorPoint;
|
||||
s16 moveCursorResult;
|
||||
s16 pad2;
|
||||
|
||||
s16 D_8082B6E4 = 0;
|
||||
pauseCtx->cursorColorSet = 0;
|
||||
pauseCtx->nameColorSet = 0;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081FF80.s")
|
||||
if ((pauseCtx->state == 6) && (pauseCtx->unk_200 == 0) && (pauseCtx->pageIndex == PAUSE_MASK) &&
|
||||
!pauseCtx->itemDescriptionOn) {
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_NONE;
|
||||
oldCursorPoint = pauseCtx->cursorPoint[PAUSE_MASK];
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_808204AC.s")
|
||||
cursorItem = pauseCtx->cursorItem[PAUSE_MASK];
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80820FA4.s")
|
||||
// Move cursor left/right
|
||||
if (pauseCtx->cursorSpecialPos == 0) {
|
||||
// cursor is currently on a slot
|
||||
pauseCtx->cursorColorSet = 2;
|
||||
|
||||
if (ABS_ALT(pauseCtx->stickAdjX) > 30) {
|
||||
cursorPoint = pauseCtx->cursorPoint[PAUSE_MASK];
|
||||
cursorXIndex = pauseCtx->cursorXIndex[PAUSE_MASK];
|
||||
cursorYIndex = pauseCtx->cursorYIndex[PAUSE_MASK];
|
||||
|
||||
// Search for slot to move to
|
||||
while (moveCursorResult == PAUSE_CURSOR_RESULT_NONE) {
|
||||
if (pauseCtx->stickAdjX < -30) {
|
||||
// move cursor left
|
||||
pauseCtx->unk_298 = 4.0f;
|
||||
if (pauseCtx->cursorXIndex[PAUSE_MASK] != 0) {
|
||||
pauseCtx->cursorXIndex[PAUSE_MASK]--;
|
||||
pauseCtx->cursorPoint[PAUSE_MASK]--;
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SLOT;
|
||||
} else {
|
||||
pauseCtx->cursorYIndex[PAUSE_MASK]++;
|
||||
|
||||
if (pauseCtx->cursorYIndex[PAUSE_MASK] >= 4) {
|
||||
pauseCtx->cursorYIndex[PAUSE_MASK] = 0;
|
||||
}
|
||||
|
||||
pauseCtx->cursorPoint[PAUSE_MASK] =
|
||||
pauseCtx->cursorXIndex[PAUSE_MASK] + (pauseCtx->cursorYIndex[PAUSE_MASK] * 6);
|
||||
|
||||
if (pauseCtx->cursorPoint[PAUSE_MASK] >= NUM_MASK_SLOTS) {
|
||||
pauseCtx->cursorPoint[PAUSE_MASK] = pauseCtx->cursorXIndex[PAUSE_MASK];
|
||||
}
|
||||
|
||||
if (cursorYIndex == pauseCtx->cursorYIndex[PAUSE_MASK]) {
|
||||
pauseCtx->cursorXIndex[PAUSE_MASK] = cursorXIndex;
|
||||
pauseCtx->cursorPoint[PAUSE_MASK] = cursorPoint;
|
||||
|
||||
KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT);
|
||||
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS;
|
||||
}
|
||||
}
|
||||
} else if (pauseCtx->stickAdjX > 30) {
|
||||
// move cursor right
|
||||
pauseCtx->unk_298 = 4.0f;
|
||||
if (pauseCtx->cursorXIndex[PAUSE_MASK] <= 4) {
|
||||
pauseCtx->cursorXIndex[PAUSE_MASK]++;
|
||||
pauseCtx->cursorPoint[PAUSE_MASK]++;
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SLOT;
|
||||
} else {
|
||||
pauseCtx->cursorYIndex[PAUSE_MASK]++;
|
||||
|
||||
if (pauseCtx->cursorYIndex[PAUSE_MASK] >= 4) {
|
||||
pauseCtx->cursorYIndex[PAUSE_MASK] = 0;
|
||||
}
|
||||
|
||||
pauseCtx->cursorPoint[PAUSE_MASK] =
|
||||
pauseCtx->cursorXIndex[PAUSE_MASK] + (pauseCtx->cursorYIndex[PAUSE_MASK] * 6);
|
||||
|
||||
if (pauseCtx->cursorPoint[PAUSE_MASK] >= NUM_MASK_SLOTS) {
|
||||
pauseCtx->cursorPoint[PAUSE_MASK] = pauseCtx->cursorXIndex[PAUSE_MASK];
|
||||
}
|
||||
|
||||
if (cursorYIndex == pauseCtx->cursorYIndex[PAUSE_MASK]) {
|
||||
pauseCtx->cursorXIndex[PAUSE_MASK] = cursorXIndex;
|
||||
pauseCtx->cursorPoint[PAUSE_MASK] = cursorPoint;
|
||||
|
||||
KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT);
|
||||
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (moveCursorResult == PAUSE_CURSOR_RESULT_SLOT) {
|
||||
cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_MASK] + NUM_ITEM_SLOTS];
|
||||
if (CHECK_GIVEN_MASK_ON_MOON(pauseCtx->cursorPoint[PAUSE_MASK])) {
|
||||
cursorItem = ITEM_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) {
|
||||
if (pauseCtx->stickAdjX > 30) {
|
||||
func_80821A04(play);
|
||||
cursorYIndex = 0;
|
||||
cursorXIndex = 0;
|
||||
cursorPoint = 0; // top row, left column (SLOT_MASK_POSTMAN)
|
||||
|
||||
// Search for slot to move to
|
||||
while (true) {
|
||||
// Check if current cursor has an item in its slot
|
||||
if ((gSaveContext.save.inventory.items[cursorPoint + NUM_ITEM_SLOTS] != ITEM_NONE) &&
|
||||
!CHECK_GIVEN_MASK_ON_MOON(cursorPoint)) {
|
||||
pauseCtx->cursorPoint[PAUSE_MASK] = cursorPoint;
|
||||
pauseCtx->cursorXIndex[PAUSE_MASK] = cursorXIndex;
|
||||
pauseCtx->cursorYIndex[PAUSE_MASK] = cursorYIndex;
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SLOT;
|
||||
break;
|
||||
}
|
||||
|
||||
// move 1 row down and retry
|
||||
cursorYIndex++;
|
||||
cursorPoint += 6;
|
||||
if (cursorYIndex < 4) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// move 1 column right and retry
|
||||
cursorYIndex = 0;
|
||||
cursorPoint = cursorXIndex + 1;
|
||||
cursorXIndex = cursorPoint;
|
||||
if (cursorXIndex < 6) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// No item available
|
||||
KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else { // PAUSE_CURSOR_PAGE_RIGHT
|
||||
//! FAKE:
|
||||
if (1) {}
|
||||
if (pauseCtx->stickAdjX < -30) {
|
||||
func_80821A04(play);
|
||||
cursorXIndex = 5;
|
||||
cursorPoint = 5; // top row, right column (SLOT_MASK_DEKU)
|
||||
cursorYIndex = 0;
|
||||
|
||||
// Search for slot to move to
|
||||
while (true) {
|
||||
// Check if current cursor has an item in its slot
|
||||
if ((gSaveContext.save.inventory.items[cursorPoint + NUM_ITEM_SLOTS] != ITEM_NONE) &&
|
||||
!CHECK_GIVEN_MASK_ON_MOON(cursorPoint)) {
|
||||
pauseCtx->cursorPoint[PAUSE_MASK] = cursorPoint;
|
||||
pauseCtx->cursorXIndex[PAUSE_MASK] = cursorXIndex;
|
||||
pauseCtx->cursorYIndex[PAUSE_MASK] = cursorYIndex;
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SLOT;
|
||||
break;
|
||||
}
|
||||
|
||||
// move 1 row down and retry
|
||||
cursorYIndex++;
|
||||
cursorPoint += 6;
|
||||
if (cursorYIndex < 4) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// move 1 column left and retry
|
||||
cursorYIndex = 0;
|
||||
cursorPoint = cursorXIndex - 1;
|
||||
cursorXIndex = cursorPoint;
|
||||
if (cursorXIndex >= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// No item available
|
||||
KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pauseCtx->cursorSpecialPos == 0) {
|
||||
// move cursor up/down
|
||||
if (ABS_ALT(pauseCtx->stickAdjY) > 30) {
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_NONE;
|
||||
|
||||
cursorPoint = pauseCtx->cursorPoint[PAUSE_MASK];
|
||||
cursorYIndex = pauseCtx->cursorYIndex[PAUSE_MASK];
|
||||
|
||||
while (moveCursorResult == PAUSE_CURSOR_RESULT_NONE) {
|
||||
if (pauseCtx->stickAdjY > 30) {
|
||||
// move cursor up
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS;
|
||||
if (pauseCtx->cursorYIndex[PAUSE_MASK] != 0) {
|
||||
pauseCtx->unk_298 = 4.0f;
|
||||
pauseCtx->cursorYIndex[PAUSE_MASK]--;
|
||||
pauseCtx->cursorPoint[PAUSE_MASK] -= 6;
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SLOT;
|
||||
} else {
|
||||
pauseCtx->cursorYIndex[PAUSE_MASK] = cursorYIndex;
|
||||
pauseCtx->cursorPoint[PAUSE_MASK] = cursorPoint;
|
||||
}
|
||||
} else if (pauseCtx->stickAdjY < -30) {
|
||||
// move cursor down
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS;
|
||||
if (pauseCtx->cursorYIndex[PAUSE_MASK] < 3) {
|
||||
pauseCtx->unk_298 = 4.0f;
|
||||
pauseCtx->cursorYIndex[PAUSE_MASK]++;
|
||||
pauseCtx->cursorPoint[PAUSE_MASK] += 6;
|
||||
moveCursorResult = PAUSE_CURSOR_RESULT_SLOT;
|
||||
} else {
|
||||
pauseCtx->cursorYIndex[PAUSE_MASK] = cursorYIndex;
|
||||
pauseCtx->cursorPoint[PAUSE_MASK] = cursorPoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cursorSlot = pauseCtx->cursorPoint[PAUSE_MASK];
|
||||
pauseCtx->cursorColorSet = 2;
|
||||
|
||||
if (moveCursorResult == PAUSE_CURSOR_RESULT_SLOT) {
|
||||
cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_MASK] + NUM_ITEM_SLOTS];
|
||||
if (CHECK_GIVEN_MASK_ON_MOON(pauseCtx->cursorPoint[PAUSE_MASK])) {
|
||||
cursorItem = ITEM_NONE;
|
||||
}
|
||||
} else if (moveCursorResult != PAUSE_CURSOR_RESULT_SPECIAL_POS) {
|
||||
cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_MASK] + NUM_ITEM_SLOTS];
|
||||
if (CHECK_GIVEN_MASK_ON_MOON(pauseCtx->cursorPoint[PAUSE_MASK])) {
|
||||
cursorItem = ITEM_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
if (cursorItem == ITEM_NONE) {
|
||||
cursorItem = PAUSE_ITEM_NONE;
|
||||
pauseCtx->cursorColorSet = 0;
|
||||
}
|
||||
|
||||
if ((cursorItem != PAUSE_ITEM_NONE) && (msgCtx->msgLength == 0)) {
|
||||
if (gSaveContext.buttonStatus[EQUIP_SLOT_A] == BTN_DISABLED) {
|
||||
gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_ENABLED;
|
||||
gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE;
|
||||
Interface_SetHudVisibility(HUD_VISIBILITY_ALL);
|
||||
}
|
||||
} else if (gSaveContext.buttonStatus[EQUIP_SLOT_A] != BTN_DISABLED) {
|
||||
gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_DISABLED;
|
||||
gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE;
|
||||
Interface_SetHudVisibility(HUD_VISIBILITY_ALL);
|
||||
}
|
||||
|
||||
pauseCtx->cursorItem[PAUSE_MASK] = cursorItem;
|
||||
pauseCtx->cursorSlot[PAUSE_MASK] = cursorSlot;
|
||||
if (cursorItem != PAUSE_ITEM_NONE) {
|
||||
// Equip item to the C buttons
|
||||
if ((pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && !pauseCtx->itemDescriptionOn &&
|
||||
(pauseCtx->state == 6) && (pauseCtx->unk_200 == 0) &&
|
||||
CHECK_BTN_ANY(input->press.button, BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT)) {
|
||||
|
||||
// Ensure that a mask is not unequipped while being used
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
|
||||
if (((Player_GetCurMaskItemId(play) != ITEM_NONE) &&
|
||||
(Player_GetCurMaskItemId(play) == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT))) ||
|
||||
((sMaskPlayerFormItems[((void)0, gSaveContext.save.playerForm)] != ITEM_NONE) &&
|
||||
(sMaskPlayerFormItems[((void)0, gSaveContext.save.playerForm)] ==
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT)))) {
|
||||
play_sound(NA_SE_SY_ERROR);
|
||||
return;
|
||||
}
|
||||
} else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) {
|
||||
if (((Player_GetCurMaskItemId(play) != ITEM_NONE) &&
|
||||
(Player_GetCurMaskItemId(play) == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN))) ||
|
||||
((sMaskPlayerFormItems[((void)0, gSaveContext.save.playerForm)] != ITEM_NONE) &&
|
||||
(sMaskPlayerFormItems[((void)0, gSaveContext.save.playerForm)] ==
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN)))) {
|
||||
play_sound(NA_SE_SY_ERROR);
|
||||
return;
|
||||
}
|
||||
} else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
|
||||
if (((Player_GetCurMaskItemId(play) != ITEM_NONE) &&
|
||||
(Player_GetCurMaskItemId(play) == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT))) ||
|
||||
((sMaskPlayerFormItems[((void)0, gSaveContext.save.playerForm)] != ITEM_NONE) &&
|
||||
(sMaskPlayerFormItems[((void)0, gSaveContext.save.playerForm)] ==
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT)))) {
|
||||
play_sound(NA_SE_SY_ERROR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((Player_GetEnvTimerType(play) >= PLAYER_ENV_TIMER_UNDERWATER_FLOOR) &&
|
||||
(Player_GetEnvTimerType(play) <= PLAYER_ENV_TIMER_UNDERWATER_FREE) &&
|
||||
((cursorSlot == (SLOT_MASK_DEKU - NUM_ITEM_SLOTS)) ||
|
||||
(cursorSlot == (SLOT_MASK_GORON - NUM_ITEM_SLOTS)))) {
|
||||
play_sound(NA_SE_SY_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
|
||||
pauseCtx->equipTargetCBtn = PAUSE_EQUIP_C_LEFT;
|
||||
} else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) {
|
||||
pauseCtx->equipTargetCBtn = PAUSE_EQUIP_C_DOWN;
|
||||
} else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
|
||||
pauseCtx->equipTargetCBtn = PAUSE_EQUIP_C_RIGHT;
|
||||
}
|
||||
|
||||
// Equip item to the C buttons
|
||||
pauseCtx->equipTargetItem = cursorItem;
|
||||
pauseCtx->equipTargetSlot = cursorSlot + NUM_ITEM_SLOTS;
|
||||
pauseCtx->unk_200 = 0xF;
|
||||
vtxIndex = cursorSlot * 4;
|
||||
pauseCtx->equipAnimX = pauseCtx->maskVtx[vtxIndex].v.ob[0] * 10;
|
||||
pauseCtx->equipAnimY = pauseCtx->maskVtx[vtxIndex].v.ob[1] * 10;
|
||||
pauseCtx->equipAnimAlpha = 255;
|
||||
sMaskEquipMagicArrowSlotHoldTimer = 0;
|
||||
sMaskEquipState = EQUIP_STATE_MOVE_TO_C_BTN;
|
||||
sMaskEquipAnimTimer = 10;
|
||||
play_sound(NA_SE_SY_DECIDE);
|
||||
} else if ((pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && (pauseCtx->state == 6) &&
|
||||
(pauseCtx->unk_200 == 0) && CHECK_BTN_ALL(input->press.button, BTN_A) &&
|
||||
(msgCtx->msgLength == 0)) {
|
||||
// Give description on item through a message box
|
||||
pauseCtx->itemDescriptionOn = true;
|
||||
if (pauseCtx->cursorYIndex[PAUSE_MASK] < 2) {
|
||||
func_801514B0(play, 0x1700 + pauseCtx->cursorItem[PAUSE_MASK], 3);
|
||||
} else {
|
||||
func_801514B0(play, 0x1700 + pauseCtx->cursorItem[PAUSE_MASK], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pauseCtx->cursorItem[PAUSE_MASK] = PAUSE_ITEM_NONE;
|
||||
}
|
||||
|
||||
if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_MASK]) {
|
||||
play_sound(NA_SE_SY_CURSOR);
|
||||
}
|
||||
} else if ((pauseCtx->unk_200 == 0xF) && (pauseCtx->pageIndex == PAUSE_MASK)) {
|
||||
pauseCtx->cursorColorSet = 2;
|
||||
}
|
||||
}
|
||||
|
||||
s16 sMaskCButtonPosX[] = { 660, 900, 1140 };
|
||||
s16 sMaskCButtonPosY[] = { 1100, 920, 1100 };
|
||||
|
||||
void KaleidoScope_UpdateMaskEquip(PlayState* play) {
|
||||
static s16 sMaskEquipMagicArrowBowSlotHoldTimer = 0;
|
||||
PauseContext* pauseCtx = &play->pauseCtx;
|
||||
Vtx* bowItemVtx;
|
||||
u16 offsetX;
|
||||
u16 offsetY;
|
||||
|
||||
// Grow glowing orb when equipping magic arrows
|
||||
if (sMaskEquipState == EQUIP_STATE_MAGIC_ARROW_GROW_ORB) {
|
||||
pauseCtx->equipAnimAlpha += 14;
|
||||
if (pauseCtx->equipAnimAlpha > 255) {
|
||||
pauseCtx->equipAnimAlpha = 254;
|
||||
sMaskEquipState++;
|
||||
}
|
||||
// Hover over magic arrow slot when the next state is reached
|
||||
sMaskEquipMagicArrowSlotHoldTimer = 5;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sMaskEquipState == EQUIP_STATE_MAGIC_ARROW_HOVER_OVER_BOW_SLOT) {
|
||||
sMaskEquipMagicArrowBowSlotHoldTimer--;
|
||||
|
||||
if (sMaskEquipMagicArrowBowSlotHoldTimer == 0) {
|
||||
pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE;
|
||||
pauseCtx->equipTargetSlot = SLOT_BOW;
|
||||
sMaskEquipAnimTimer = 6;
|
||||
pauseCtx->equipAnimScale = 320;
|
||||
pauseCtx->equipAnimShrinkRate = 40;
|
||||
sMaskEquipState++;
|
||||
play_sound(NA_SE_SY_SYNTH_MAGIC_ARROW);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (sMaskEquipState == EQUIP_STATE_MAGIC_ARROW_MOVE_TO_BOW_SLOT) {
|
||||
bowItemVtx = &pauseCtx->itemVtx[12];
|
||||
offsetX = ABS_ALT(pauseCtx->equipAnimX - bowItemVtx->v.ob[0] * 10) / sMaskEquipAnimTimer;
|
||||
offsetY = ABS_ALT(pauseCtx->equipAnimY - bowItemVtx->v.ob[1] * 10) / sMaskEquipAnimTimer;
|
||||
} else {
|
||||
offsetX = ABS_ALT(pauseCtx->equipAnimX - sMaskCButtonPosX[pauseCtx->equipTargetCBtn]) / sMaskEquipAnimTimer;
|
||||
offsetY = ABS_ALT(pauseCtx->equipAnimY - sMaskCButtonPosY[pauseCtx->equipTargetCBtn]) / sMaskEquipAnimTimer;
|
||||
}
|
||||
|
||||
if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipAnimAlpha < 254)) {
|
||||
pauseCtx->equipAnimAlpha += 14;
|
||||
if (pauseCtx->equipAnimAlpha > 255) {
|
||||
pauseCtx->equipAnimAlpha = 254;
|
||||
}
|
||||
sMaskEquipMagicArrowSlotHoldTimer = 5;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sMaskEquipMagicArrowSlotHoldTimer == 0) {
|
||||
pauseCtx->equipAnimScale -= pauseCtx->equipAnimShrinkRate / sMaskEquipAnimTimer;
|
||||
pauseCtx->equipAnimShrinkRate -= pauseCtx->equipAnimShrinkRate / sMaskEquipAnimTimer;
|
||||
|
||||
// Update coordinates of item icon while being equipped
|
||||
if (sMaskEquipState == EQUIP_STATE_MAGIC_ARROW_MOVE_TO_BOW_SLOT) {
|
||||
// target is the bow slot
|
||||
if (pauseCtx->equipAnimX >= (pauseCtx->itemVtx[12].v.ob[0] * 10)) {
|
||||
pauseCtx->equipAnimX -= offsetX;
|
||||
} else {
|
||||
pauseCtx->equipAnimX += offsetX;
|
||||
}
|
||||
|
||||
if (pauseCtx->equipAnimY >= (pauseCtx->itemVtx[12].v.ob[1] * 10)) {
|
||||
pauseCtx->equipAnimY -= offsetY;
|
||||
} else {
|
||||
pauseCtx->equipAnimY += offsetY;
|
||||
}
|
||||
} else {
|
||||
// target is the c button
|
||||
if (pauseCtx->equipAnimX >= sMaskCButtonPosX[pauseCtx->equipTargetCBtn]) {
|
||||
pauseCtx->equipAnimX -= offsetX;
|
||||
} else {
|
||||
pauseCtx->equipAnimX += offsetX;
|
||||
}
|
||||
|
||||
if (pauseCtx->equipAnimY >= sMaskCButtonPosY[pauseCtx->equipTargetCBtn]) {
|
||||
pauseCtx->equipAnimY -= offsetY;
|
||||
} else {
|
||||
pauseCtx->equipAnimY += offsetY;
|
||||
}
|
||||
}
|
||||
|
||||
sMaskEquipAnimTimer--;
|
||||
if (sMaskEquipAnimTimer == 0) {
|
||||
if (sMaskEquipState == EQUIP_STATE_MAGIC_ARROW_MOVE_TO_BOW_SLOT) {
|
||||
sMaskEquipState++;
|
||||
sMaskEquipMagicArrowBowSlotHoldTimer = 4;
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip mask onto c buttons
|
||||
if (pauseCtx->equipTargetCBtn == PAUSE_EQUIP_C_LEFT) {
|
||||
// Swap if mask is already equipped on CDown or CRight.
|
||||
if (pauseCtx->equipTargetSlot == C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN)) {
|
||||
if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) != ITEM_NONE) {
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT);
|
||||
C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT);
|
||||
Interface_LoadItemIcon(play, EQUIP_SLOT_C_DOWN);
|
||||
} else {
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = ITEM_NONE;
|
||||
C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = SLOT_NONE;
|
||||
}
|
||||
} else if (pauseCtx->equipTargetSlot == C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT)) {
|
||||
if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) != ITEM_NONE) {
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT);
|
||||
C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT);
|
||||
Interface_LoadItemIcon(play, EQUIP_SLOT_C_RIGHT);
|
||||
} else {
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = ITEM_NONE;
|
||||
C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT) = SLOT_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
// Equip mask on CLeft
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = pauseCtx->equipTargetItem;
|
||||
C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT) = pauseCtx->equipTargetSlot;
|
||||
Interface_LoadItemIconImpl(play, EQUIP_SLOT_C_LEFT);
|
||||
} else if (pauseCtx->equipTargetCBtn == PAUSE_EQUIP_C_DOWN) {
|
||||
// Swap if mask is already equipped on CLeft or CRight.
|
||||
if (pauseCtx->equipTargetSlot == C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT)) {
|
||||
if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) != ITEM_NONE) {
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN);
|
||||
C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN);
|
||||
Interface_LoadItemIcon(play, EQUIP_SLOT_C_LEFT);
|
||||
} else {
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = ITEM_NONE;
|
||||
C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT) = SLOT_NONE;
|
||||
}
|
||||
} else if (pauseCtx->equipTargetSlot == C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT)) {
|
||||
if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) != ITEM_NONE) {
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN);
|
||||
C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN);
|
||||
Interface_LoadItemIcon(play, EQUIP_SLOT_C_RIGHT);
|
||||
} else {
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = ITEM_NONE;
|
||||
C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT) = SLOT_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
// Equip mask on CDown
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = pauseCtx->equipTargetItem;
|
||||
C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = pauseCtx->equipTargetSlot;
|
||||
Interface_LoadItemIconImpl(play, EQUIP_SLOT_C_DOWN);
|
||||
} else { // (pauseCtx->equipTargetCBtn == PAUSE_EQUIP_C_RIGHT)
|
||||
// Swap if mask is already equipped on CLeft or CDown.
|
||||
if (pauseCtx->equipTargetSlot == C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT)) {
|
||||
if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) != ITEM_NONE) {
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT);
|
||||
C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT);
|
||||
Interface_LoadItemIcon(play, EQUIP_SLOT_C_LEFT);
|
||||
} else {
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = ITEM_NONE;
|
||||
C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT) = SLOT_NONE;
|
||||
}
|
||||
} else if (pauseCtx->equipTargetSlot == C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN)) {
|
||||
if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) != ITEM_NONE) {
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT);
|
||||
C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT);
|
||||
Interface_LoadItemIcon(play, EQUIP_SLOT_C_DOWN);
|
||||
} else {
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = ITEM_NONE;
|
||||
C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = SLOT_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
// Equip mask on CRight
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = pauseCtx->equipTargetItem;
|
||||
C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT) = pauseCtx->equipTargetSlot;
|
||||
Interface_LoadItemIconImpl(play, EQUIP_SLOT_C_RIGHT);
|
||||
}
|
||||
|
||||
// Reset params
|
||||
pauseCtx->unk_200 = 0;
|
||||
sMaskEquipAnimTimer = 10;
|
||||
pauseCtx->equipAnimScale = 320;
|
||||
pauseCtx->equipAnimShrinkRate = 40;
|
||||
}
|
||||
} else {
|
||||
sMaskEquipMagicArrowSlotHoldTimer--;
|
||||
if (sMaskEquipMagicArrowSlotHoldTimer == 0) {
|
||||
pauseCtx->equipAnimAlpha = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,13 @@ typedef enum {
|
|||
/* 2 */ PAUSE_EQUIP_C_RIGHT
|
||||
} PauseEquipCButton;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ EQUIP_STATE_MAGIC_ARROW_GROW_ORB,
|
||||
/* 1 */ EQUIP_STATE_MAGIC_ARROW_MOVE_TO_BOW_SLOT,
|
||||
/* 2 */ EQUIP_STATE_MAGIC_ARROW_HOVER_OVER_BOW_SLOT,
|
||||
/* 3 */ EQUIP_STATE_MOVE_TO_C_BTN
|
||||
} EquipState;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ DEBUG_EDITOR_NONE,
|
||||
/* 1 */ DEBUG_EDITOR_INVENTORY_INIT,
|
||||
|
|
@ -29,6 +36,16 @@ typedef enum {
|
|||
/* 3 */ DEBUG_EDITOR_EVENTS
|
||||
} DebugEditor;
|
||||
|
||||
// To be used for Item-Page cursor and Mask-Page cursor
|
||||
typedef enum {
|
||||
/* 0 */ PAUSE_CURSOR_RESULT_NONE,
|
||||
/* 1 */ PAUSE_CURSOR_RESULT_SLOT,
|
||||
/* 2 */ PAUSE_CURSOR_RESULT_SPECIAL_POS
|
||||
} PauseMoveCursorResult;
|
||||
|
||||
#define NUM_ITEM_SLOTS 24
|
||||
#define NUM_MASK_SLOTS 24
|
||||
|
||||
#define PAUSE_PROMPT_YES 0
|
||||
#define PAUSE_PROMPT_NO 4
|
||||
|
||||
|
|
@ -43,6 +60,11 @@ void KaleidoScope_DrawItemSelect(PlayState* play);
|
|||
void KaleidoScope_UpdateItemCursor(PlayState* play);
|
||||
void KaleidoScope_UpdateItemEquip(PlayState* play);
|
||||
|
||||
// Mask
|
||||
void KaleidoScope_DrawMaskSelect(PlayState* play);
|
||||
void KaleidoScope_UpdateMaskCursor(PlayState* play);
|
||||
void KaleidoScope_UpdateMaskEquip(PlayState* play);
|
||||
|
||||
// Debug
|
||||
void KaleidoScope_DrawInventoryEditor(PlayState* play);
|
||||
void KaleidoScope_UpdateInventoryEditor(PlayState* play);
|
||||
|
|
|
|||
|
|
@ -4214,9 +4214,9 @@
|
|||
0x8081E118:("func_8081E118",),
|
||||
0x8081E7D8:("func_8081E7D8",),
|
||||
0x8081FB1C:("func_8081FB1C",),
|
||||
0x8081FF80:("func_8081FF80",),
|
||||
0x808204AC:("func_808204AC",),
|
||||
0x80820FA4:("func_80820FA4",),
|
||||
0x8081FF80:("KaleidoScope_DrawMaskSelect",),
|
||||
0x808204AC:("KaleidoScope_UpdateMaskCursor",),
|
||||
0x80820FA4:("KaleidoScope_UpdateMaskEquip",),
|
||||
0x80821730:("KaleidoScope_UpdatePrompt",),
|
||||
0x80821900:("func_80821900",),
|
||||
0x8082192C:("func_8082192C",),
|
||||
|
|
|
|||
|
|
@ -4725,15 +4725,15 @@
|
|||
0x8082B5CC:("D_8082B5CC","UNK_TYPE1","",0x1),
|
||||
0x8082B5E0:("D_8082B5E0","UNK_TYPE1","",0x1),
|
||||
0x8082B5F4:("D_8082B5F4","UNK_TYPE2","",0x2),
|
||||
0x8082B600:("D_8082B600","UNK_TYPE2","",0x2),
|
||||
0x8082B604:("D_8082B604","UNK_TYPE2","",0x2),
|
||||
0x8082B608:("D_8082B608","UNK_TYPE2","",0x2),
|
||||
0x8082B60C:("D_8082B60C","UNK_TYPE1","",0x1),
|
||||
0x8082B684:("D_8082B684","UNK_TYPE2","",0x2),
|
||||
0x8082B6CC:("D_8082B6CC","UNK_TYPE1","",0x1),
|
||||
0x8082B6D4:("D_8082B6D4","UNK_TYPE1","",0x1),
|
||||
0x8082B6DC:("D_8082B6DC","UNK_TYPE1","",0x1),
|
||||
0x8082B6E4:("D_8082B6E4","UNK_TYPE2","",0x2),
|
||||
0x8082B600:("sMaskEquipState","UNK_TYPE2","",0x2),
|
||||
0x8082B604:("sMaskEquipMagicArrowSlotHoldTimer","UNK_TYPE2","",0x2),
|
||||
0x8082B608:("sMaskEquipAnimTimer","UNK_TYPE2","",0x2),
|
||||
0x8082B60C:("gMaskPlayerFormSlotRestrictions","UNK_TYPE1","",0x1),
|
||||
0x8082B684:("sMasksGivenOnMoonBits","UNK_TYPE2","",0x2),
|
||||
0x8082B6CC:("sMaskPlayerFormItems","UNK_TYPE1","",0x1),
|
||||
0x8082B6D4:("sMaskCButtonPosX","UNK_TYPE1","",0x1),
|
||||
0x8082B6DC:("sMaskCButtonPosY","UNK_TYPE1","",0x1),
|
||||
0x8082B6E4:("sMaskEquipMagicArrowBowSlotHoldTimer","UNK_TYPE2","",0x2),
|
||||
0x8082B6F0:("sPromptAlphaTargets","UNK_TYPE1","",0x1),
|
||||
0x8082B6F4:("sPromptAlphaTargetIndex","UNK_TYPE2","",0x2),
|
||||
0x8082B6F8:("sPromptAlphaTimer","UNK_TYPE2","",0x2),
|
||||
|
|
|
|||
Loading…
Reference in New Issue