1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-02 22:14:33 +00:00

Parameter/Item Misc Cleanup (#1201)

* Misc parameter cleanup

* More cleanup

* More cleanup

* ia4, more readable

* More comments

* PR Suggestion
This commit is contained in:
engineer124 2022-04-24 00:41:17 +10:00 committed by GitHub
parent 924c10d2d3
commit 1e03b662f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 148 additions and 121 deletions

View file

@ -3826,7 +3826,7 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) {
}
func_80832698(this, NA_SE_VO_LI_TAKEN_AWAY);
globalCtx->unk_11DE9 = 1;
globalCtx->unk_11DE9 = true;
func_80078884(NA_SE_OC_ABYSS);
} else if ((this->unk_8A1 != 0) && ((this->unk_8A1 >= 2) || (this->invincibilityTimer == 0))) {
u8 sp5C[] = { 2, 1, 1 };
@ -12056,7 +12056,7 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) {
} else {
if ((this->getItemId == GI_HEART_CONTAINER_2) || (this->getItemId == GI_HEART_CONTAINER) ||
((this->getItemId == GI_HEART_PIECE) &&
((gSaveContext.inventory.questItems & 0xF0000000) == 0x40000000))) {
((gSaveContext.inventory.questItems & 0xF0000000) == (4 << QUEST_HEART_PIECE_COUNT)))) {
temp1 = NA_BGM_HEART_GET | 0x900;
} else {
temp1 = temp2 = (this->getItemId == GI_HEART_PIECE) ? NA_BGM_SMALL_ITEM_GET : NA_BGM_ITEM_GET | 0x900;

View file

@ -70,7 +70,7 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
s16 pad1;
s16 phi_v1;
s16 pad2;
s16 phi_s0_2;
s16 cursorItem;
s16 sp208[3];
OPEN_DISPS(gfxCtx, "../z_kaleido_collect.c", 248);
@ -141,33 +141,33 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
if (pauseCtx->cursorPoint[PAUSE_QUEST] != 0x18) {
if (CHECK_QUEST_ITEM(pauseCtx->cursorPoint[PAUSE_QUEST])) {
if (pauseCtx->cursorPoint[PAUSE_QUEST] < 6) {
phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x66;
osSyncPrintf("000 ccc=%d\n", phi_s0_2);
cursorItem = ITEM_MEDALLION_FOREST + pauseCtx->cursorPoint[PAUSE_QUEST];
osSyncPrintf("000 ccc=%d\n", cursorItem);
} else if (pauseCtx->cursorPoint[PAUSE_QUEST] < 0x12) {
phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x54;
osSyncPrintf("111 ccc=%d\n", phi_s0_2);
cursorItem = ITEM_SCALE_GOLDEN + pauseCtx->cursorPoint[PAUSE_QUEST];
osSyncPrintf("111 ccc=%d\n", cursorItem);
} else {
phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x5A;
osSyncPrintf("222 ccc=%d (%d, %d, %d)\n", phi_s0_2, pauseCtx->cursorPoint[PAUSE_QUEST],
cursorItem = ITEM_SONG_MINUET + pauseCtx->cursorPoint[PAUSE_QUEST];
osSyncPrintf("222 ccc=%d (%d, %d, %d)\n", cursorItem, pauseCtx->cursorPoint[PAUSE_QUEST],
0x12, 0x6C);
}
} else {
phi_s0_2 = PAUSE_ITEM_NONE;
cursorItem = PAUSE_ITEM_NONE;
osSyncPrintf("999 ccc=%d (%d, %d)\n", PAUSE_ITEM_NONE, pauseCtx->cursorPoint[PAUSE_QUEST],
0x18);
}
} else {
if ((gSaveContext.inventory.questItems & 0xF0000000) != 0) {
phi_s0_2 = 0x72;
cursorItem = ITEM_HEART_CONTAINER;
} else {
phi_s0_2 = PAUSE_ITEM_NONE;
cursorItem = PAUSE_ITEM_NONE;
}
osSyncPrintf("888 ccc=%d (%d, %d, %x)\n", phi_s0_2, pauseCtx->cursorPoint[PAUSE_QUEST], 0x72,
gSaveContext.inventory.questItems & 0xF0000000);
osSyncPrintf("888 ccc=%d (%d, %d, %x)\n", cursorItem, pauseCtx->cursorPoint[PAUSE_QUEST],
ITEM_HEART_CONTAINER, gSaveContext.inventory.questItems & 0xF0000000);
}
sp216 = pauseCtx->cursorPoint[PAUSE_QUEST];
pauseCtx->cursorItem[pauseCtx->pageIndex] = phi_s0_2;
pauseCtx->cursorItem[pauseCtx->pageIndex] = cursorItem;
pauseCtx->cursorSlot[pauseCtx->pageIndex] = sp216;
}
@ -221,12 +221,12 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
KaleidoScope_SetCursorVtx(pauseCtx, sp216 * 4, pauseCtx->questVtx);
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
if (CHECK_QUEST_ITEM(pauseCtx->cursorPoint[PAUSE_QUEST])) {
phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x5A;
cursorItem = ITEM_SONG_MINUET + pauseCtx->cursorPoint[PAUSE_QUEST];
} else {
phi_s0_2 = PAUSE_ITEM_NONE;
cursorItem = PAUSE_ITEM_NONE;
}
sp216 = pauseCtx->cursorPoint[PAUSE_QUEST];
pauseCtx->cursorItem[pauseCtx->pageIndex] = phi_s0_2;
pauseCtx->cursorItem[pauseCtx->pageIndex] = cursorItem;
pauseCtx->cursorSlot[pauseCtx->pageIndex] = sp216;
}
} else {
@ -239,17 +239,17 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
if (CHECK_QUEST_ITEM(pauseCtx->cursorPoint[PAUSE_QUEST])) {
if (pauseCtx->cursorPoint[PAUSE_QUEST] < 6) {
phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x66;
cursorItem = ITEM_MEDALLION_FOREST + pauseCtx->cursorPoint[PAUSE_QUEST];
} else if (pauseCtx->cursorPoint[PAUSE_QUEST] < 0xC) {
phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x4E;
cursorItem = ITEM_BOMB_BAG_30 + pauseCtx->cursorPoint[PAUSE_QUEST];
} else {
phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x69;
cursorItem = ITEM_MEDALLION_SPIRIT + pauseCtx->cursorPoint[PAUSE_QUEST];
}
} else {
phi_s0_2 = PAUSE_ITEM_NONE;
cursorItem = PAUSE_ITEM_NONE;
}
sp216 = pauseCtx->cursorPoint[PAUSE_QUEST];
pauseCtx->cursorItem[pauseCtx->pageIndex] = phi_s0_2;
pauseCtx->cursorItem[pauseCtx->pageIndex] = cursorItem;
pauseCtx->cursorSlot[pauseCtx->pageIndex] = sp216;
}
}
@ -324,7 +324,7 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
}
}
if (CHECK_QUEST_ITEM(sp218)) {
if (CHECK_QUEST_ITEM(QUEST_MEDALLION_FOREST + sp218)) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
gDPSetEnvColor(POLY_OPA_DISP++, D_8082A0D8[sp218], D_8082A0E4[sp218], D_8082A0F0[sp218], 0);
@ -349,8 +349,8 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
for (sp218 = 0; sp218 < QUEST_KOKIRI_EMERALD - QUEST_SONG_MINUET; sp218++, sp21A += 4) {
if (CHECK_QUEST_ITEM(sp218 + QUEST_SONG_MINUET)) {
if ((sp218 + QUEST_SONG_MINUET) == sp216) {
if (CHECK_QUEST_ITEM(QUEST_SONG_MINUET + sp218)) {
if ((QUEST_SONG_MINUET + sp218) == sp216) {
pauseCtx->questVtx[sp21A + 0].v.ob[0] = pauseCtx->questVtx[sp21A + 2].v.ob[0] =
pauseCtx->questVtx[sp21A + 0].v.ob[0] - 2;
@ -376,7 +376,7 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
for (sp218 = 0; sp218 < 3; sp218++, sp21A += 4) {
if (CHECK_QUEST_ITEM(sp218 + 0x12)) {
if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD + sp218)) {
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0);
KaleidoScope_DrawQuadTextureRGBA32(gfxCtx, gItemIcons[ITEM_KOKIRI_EMERALD + sp218], 24, 24, 0);
}
@ -386,7 +386,7 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
for (sp218 = 0; sp218 < 3; sp218++, sp21A += 4) {
if (CHECK_QUEST_ITEM(sp218 + 0x15)) {
if (CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY + sp218)) {
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
KaleidoScope_DrawQuadTextureRGBA32(gfxCtx, gItemIcons[ITEM_STONE_OF_AGONY + sp218], 24, 24, 0);
@ -429,7 +429,7 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
}
}
if ((gSaveContext.inventory.questItems >> 0x1C) != 0) {
if ((gSaveContext.inventory.questItems >> QUEST_HEART_PIECE_COUNT) != 0) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
@ -445,7 +445,9 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0);
POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(
POLY_OPA_DISP, gItemIcons[0x79 + (((gSaveContext.inventory.questItems & 0xF0000000) & 0xF0000000) >> 0x1C)],
POLY_OPA_DISP,
gItemIcons[0x79 +
(((gSaveContext.inventory.questItems & 0xF0000000) & 0xF0000000) >> QUEST_HEART_PIECE_COUNT)],
48, 48, 0);
}

View file

@ -302,8 +302,9 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) {
KaleidoScope_DrawDigit(globalCtx, spD8[3], 165, 185);
// Heart Pieces (X / 4)
KaleidoScope_DrawDigit(globalCtx, ((gSaveContext.inventory.questItems & 0xF0000000) & 0xF0000000) >> 0x1C, 210,
185);
KaleidoScope_DrawDigit(globalCtx,
((gSaveContext.inventory.questItems & 0xF0000000) & 0xF0000000) >> QUEST_HEART_PIECE_COUNT,
210, 185);
// 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
@ -394,13 +395,13 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) {
case 0x5C:
if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
if ((((gSaveContext.inventory.questItems & 0xF0000000) & 0xF0000000) >> 0x1C) != 0) {
gSaveContext.inventory.questItems -= 0x10000000;
if ((((gSaveContext.inventory.questItems & 0xF0000000) & 0xF0000000) >> QUEST_HEART_PIECE_COUNT) != 0) {
gSaveContext.inventory.questItems -= (1 << QUEST_HEART_PIECE_COUNT);
}
} else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) ||
CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
if ((gSaveContext.inventory.questItems & 0xF0000000) <= 0x40000000) {
gSaveContext.inventory.questItems += 0x10000000;
if ((gSaveContext.inventory.questItems & 0xF0000000) <= (4 << QUEST_HEART_PIECE_COUNT)) {
gSaveContext.inventory.questItems += (1 << QUEST_HEART_PIECE_COUNT);
}
}
break;