1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-02-10 14:35:46 +00:00

Match retail ovl_kaleido_scope (#1931)

* WIP

* cleanup

* small progress

* small cleanup

* Finish retail ovl_kaleido_scope

* GREG + markPoint -> markPoint + GREG

---------

Co-authored-by: engineer124 <engineer124engineer124@gmail.com>
This commit is contained in:
cadmic 2024-03-23 09:58:02 -07:00 committed by GitHub
parent 39de6ce293
commit 8456e4be8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 41 additions and 26 deletions

View file

@ -464,10 +464,11 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
} }
if (pauseCtx->state == PAUSE_STATE_MAIN) { if (pauseCtx->state == PAUSE_STATE_MAIN) {
sp21A += 4;
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
sp21A += 4;
if ((pauseCtx->cursorSpecialPos == 0) && (sp216 >= 6) && (sp216 < 0x12)) { if ((pauseCtx->cursorSpecialPos == 0) && (sp216 >= 6) && (sp216 < 0x12)) {
if ((pauseCtx->mainState < PAUSE_MAIN_STATE_3) || (pauseCtx->mainState == PAUSE_MAIN_STATE_5) || if ((pauseCtx->mainState < PAUSE_MAIN_STATE_3) || (pauseCtx->mainState == PAUSE_MAIN_STATE_5) ||
(pauseCtx->mainState == PAUSE_MAIN_STATE_8)) { (pauseCtx->mainState == PAUSE_MAIN_STATE_8)) {
@ -484,7 +485,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
pauseCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff(); pauseCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff();
if (pauseCtx->ocarinaStaff->pos != 0) { if (pauseCtx->ocarinaStaff->pos != 0) {
if (D_8082A11C + 1 == pauseCtx->ocarinaStaff->pos) { if (D_8082A11C == (pauseCtx->ocarinaStaff->pos - 1)) {
D_8082A11C++; D_8082A11C++;
D_8082A124[pauseCtx->ocarinaStaff->pos - 1] = pauseCtx->ocarinaStaff->buttonIndex; D_8082A124[pauseCtx->ocarinaStaff->pos - 1] = pauseCtx->ocarinaStaff->buttonIndex;
} }
@ -660,16 +661,16 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
} }
phi_s0 = 0; cursorItem = 0;
for (sp21A = 0; sp21A < 3; sp21A++, sp218 += 4) { for (sp21A = 0; sp21A < 3; sp21A++, sp218 += 4) {
if ((sp21A >= 2) || (sp208[sp21A] != 0) || (phi_s0 != 0)) { if ((sp21A >= 2) || (sp208[sp21A] != 0) || (cursorItem != 0)) {
gDPLoadTextureBlock(POLY_OPA_DISP++, ((u8*)gCounterDigit0Tex + (8 * 16 * sp208[sp21A])), G_IM_FMT_I, gDPLoadTextureBlock(POLY_OPA_DISP++, ((u8*)gCounterDigit0Tex + (8 * 16 * sp208[sp21A])), G_IM_FMT_I,
G_IM_SIZ_8b, 8, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_IM_SIZ_8b, 8, 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); G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, sp218, sp218 + 2, sp218 + 3, sp218 + 1, 0); gSP1Quadrangle(POLY_OPA_DISP++, sp218, sp218 + 2, sp218 + 3, sp218 + 1, 0);
phi_s0 = 1; cursorItem = 1;
} }
} }
} }

View file

@ -16,8 +16,6 @@ static u8 sEquipmentItemOffsets[] = {
0x00, 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x00, 0x06, 0x07, 0x08, 0x00, 0x09, 0x0A, 0x0B, 0x00, 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x00, 0x06, 0x07, 0x08, 0x00, 0x09, 0x0A, 0x0B,
}; };
static s16 sEquipTimer = 0;
void KaleidoScope_DrawEquipmentImage(PlayState* play, void* source, u32 width, u32 height) { void KaleidoScope_DrawEquipmentImage(PlayState* play, void* source, u32 width, u32 height) {
PauseContext* pauseCtx = &play->pauseCtx; PauseContext* pauseCtx = &play->pauseCtx;
u8* curTexture; u8* curTexture;
@ -119,6 +117,7 @@ void KaleidoScope_DrawPlayerWork(PlayState* play) {
void KaleidoScope_ProcessPlayerPreRender(PlayState* play); void KaleidoScope_ProcessPlayerPreRender(PlayState* play);
void KaleidoScope_DrawEquipment(PlayState* play) { void KaleidoScope_DrawEquipment(PlayState* play) {
static s16 sEquipTimer = 0;
PauseContext* pauseCtx = &play->pauseCtx; PauseContext* pauseCtx = &play->pauseCtx;
Input* input = &play->state.input[0]; Input* input = &play->state.input[0];
u16 i; u16 i;
@ -437,8 +436,8 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
cursorSlot = pauseCtx->cursorPoint[PAUSE_EQUIP]; cursorSlot = pauseCtx->cursorPoint[PAUSE_EQUIP];
pauseCtx->cursorItem[PAUSE_EQUIP] = cursorItem;
pauseCtx->cursorSlot[PAUSE_EQUIP] = cursorSlot; pauseCtx->cursorSlot[PAUSE_EQUIP] = cursorSlot;
pauseCtx->cursorItem[PAUSE_EQUIP] = cursorItem;
PRINTF("kscope->select_name[Display_Equipment] = %d\n", pauseCtx->cursorItem[PAUSE_EQUIP]); PRINTF("kscope->select_name[Display_Equipment] = %d\n", pauseCtx->cursorItem[PAUSE_EQUIP]);
@ -552,8 +551,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
if (LINK_AGE_IN_YEARS == YEARS_CHILD) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
point = CUR_UPG_VALUE(sChildUpgrades[i]); point = CUR_UPG_VALUE(sChildUpgrades[i]);
if (1) {} if (((u32)point != 0) && (CUR_UPG_VALUE(sChildUpgrades[i]) != 0)) {
if ((point != 0) && (CUR_UPG_VALUE(sChildUpgrades[i]) != 0)) {
KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx,
gItemIcons[sChildUpgradeItemBases[i] + point - 1], ITEM_ICON_WIDTH, gItemIcons[sChildUpgradeItemBases[i] + point - 1], ITEM_ICON_WIDTH,
ITEM_ICON_HEIGHT, 0); ITEM_ICON_HEIGHT, 0);
@ -606,7 +604,5 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
Gfx_SetupDL_42Opa(play->state.gfxCtx); Gfx_SetupDL_42Opa(play->state.gfxCtx);
KaleidoScope_DrawEquipmentImage(play, pauseCtx->playerSegment, PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT); KaleidoScope_DrawEquipmentImage(play, pauseCtx->playerSegment, PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT);
if (gUpgradeMasks[0]) {}
CLOSE_DISPS(play->state.gfxCtx, "../z_kaleido_equipment.c", 609); CLOSE_DISPS(play->state.gfxCtx, "../z_kaleido_equipment.c", 609);
} }

View file

@ -118,6 +118,10 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
pauseCtx->stickAdjX = 40; pauseCtx->stickAdjX = 40;
} }
#if !OOT_DEBUG
if (&gSaveContext) {}
#endif
if (ABS(pauseCtx->stickAdjX) > 30) { if (ABS(pauseCtx->stickAdjX) > 30) {
cursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM]; cursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM];
cursorX = pauseCtx->cursorX[PAUSE_ITEM]; cursorX = pauseCtx->cursorX[PAUSE_ITEM];
@ -125,9 +129,11 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
PRINTF("now=%d ccc=%d\n", cursorPoint, cursorItem); PRINTF("now=%d ccc=%d\n", cursorPoint, cursorItem);
#if OOT_DEBUG
// Seems necessary to match // Seems necessary to match
if (pauseCtx->cursorX[PAUSE_ITEM]) {} if (pauseCtx->cursorX[PAUSE_ITEM]) {}
if (gSaveContext.save.info.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]) {} if (gSaveContext.save.info.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]) {}
#endif
while (moveCursorResult == 0) { while (moveCursorResult == 0) {
if (pauseCtx->stickAdjX < -30) { if (pauseCtx->stickAdjX < -30) {

View file

@ -495,7 +495,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) {
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
if (HREG(15) == 0) { if (!OOT_DEBUG || (HREG(15) == 0)) {
gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_POINT); gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_POINT);
gDPLoadTLUT_pal256(POLY_OPA_DISP++, gWorldMapImageTLUT); gDPLoadTLUT_pal256(POLY_OPA_DISP++, gWorldMapImageTLUT);
@ -540,11 +540,13 @@ void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) {
POLY_OPA_DISP = gfx; POLY_OPA_DISP = gfx;
} }
#if OOT_DEBUG
if (HREG(15) == 2) { if (HREG(15) == 2) {
HREG(15) = 1; HREG(15) = 1;
HREG(14) = 6100; HREG(14) = 6100;
HREG(13) = 5300; HREG(13) = 5300;
} }
#endif
if (ZREG(38) == 0) { if (ZREG(38) == 0) {
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);

View file

@ -406,6 +406,8 @@ Gfx* KaleidoScope_QuadTextureIA8(Gfx* gfx, void* texture, s16 width, s16 height,
void KaleidoScope_OverridePalIndexCI4(u8* texture, s32 size, s32 targetIndex, s32 newIndex) { void KaleidoScope_OverridePalIndexCI4(u8* texture, s32 size, s32 targetIndex, s32 newIndex) {
s32 i; s32 i;
s32 index1;
s32 index2;
targetIndex &= 0xF; targetIndex &= 0xF;
newIndex &= 0xF; newIndex &= 0xF;
@ -415,9 +417,6 @@ void KaleidoScope_OverridePalIndexCI4(u8* texture, s32 size, s32 targetIndex, s3
} }
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
s32 index1;
s32 index2;
index1 = index2 = texture[i]; index1 = index2 = texture[i];
index1 = (index1 >> 4) & 0xF; index1 = (index1 >> 4) & 0xF;
@ -519,7 +518,9 @@ void KaleidoScope_SwitchPage(PauseContext* pauseCtx, u8 pt) {
void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) { void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) {
if ((pauseCtx->debugState == 0) && CHECK_BTN_ALL(input->press.button, BTN_L)) { if ((pauseCtx->debugState == 0) && CHECK_BTN_ALL(input->press.button, BTN_L)) {
#if OOT_DEBUG
pauseCtx->debugState = 1; pauseCtx->debugState = 1;
#endif
return; return;
} }
@ -556,21 +557,20 @@ void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) {
void KaleidoScope_DrawCursor(PlayState* play, u16 pageIndex) { void KaleidoScope_DrawCursor(PlayState* play, u16 pageIndex) {
PauseContext* pauseCtx = &play->pauseCtx; PauseContext* pauseCtx = &play->pauseCtx;
u16 temp; s32 pad;
OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_scope_PAL.c", 955); OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_scope_PAL.c", 955);
temp = pauseCtx->mainState; if (((((u32)pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) || (pauseCtx->mainState == PAUSE_MAIN_STATE_8)) &&
if ((((pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) || (temp == PAUSE_MAIN_STATE_8)) &&
(pauseCtx->state == PAUSE_STATE_MAIN)) || (pauseCtx->state == PAUSE_STATE_MAIN)) ||
((pauseCtx->pageIndex == PAUSE_QUEST) && ((pauseCtx->pageIndex == PAUSE_QUEST) &&
((temp < PAUSE_MAIN_STATE_3) || (temp == PAUSE_MAIN_STATE_5) || (temp == PAUSE_MAIN_STATE_8)))) { ((pauseCtx->mainState < PAUSE_MAIN_STATE_3) || (pauseCtx->mainState == PAUSE_MAIN_STATE_5) ||
(pauseCtx->mainState == PAUSE_MAIN_STATE_8)))) {
if (pauseCtx->pageIndex == pageIndex) {
s16 i; s16 i;
s16 j; s16 j;
if (pauseCtx->pageIndex == pageIndex) {
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
@ -1279,6 +1279,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) {
ITEM_NAME_TEX_HEIGHT, 0); ITEM_NAME_TEX_HEIGHT, 0);
} }
#if OOT_DEBUG
if (pauseCtx->pageIndex == PAUSE_MAP) { if (pauseCtx->pageIndex == PAUSE_MAP) {
if (YREG(7) != 0) { if (YREG(7) != 0) {
PRINTF(VT_FGCOL(YELLOW)); PRINTF(VT_FGCOL(YELLOW));
@ -1291,6 +1292,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) {
gAreaGsFlags[D_8082AE30[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]]); gAreaGsFlags[D_8082AE30[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]]);
} }
} }
#endif
if ((pauseCtx->pageIndex == PAUSE_MAP) && !sInDungeonScene) { if ((pauseCtx->pageIndex == PAUSE_MAP) && !sInDungeonScene) {
if (GET_GS_FLAGS(D_8082AE30[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]) == if (GET_GS_FLAGS(D_8082AE30[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]) ==
@ -1913,7 +1915,6 @@ void KaleidoScope_InitVertices(PlayState* play, GraphicsContext* gfxCtx) {
PauseContext* pauseCtx = &play->pauseCtx; PauseContext* pauseCtx = &play->pauseCtx;
s16 phi_t1; s16 phi_t1;
s16 phi_t2; s16 phi_t2;
s16 phi_t2_2;
s16 phi_t3; s16 phi_t3;
s16 phi_t4; s16 phi_t4;
s16 phi_t5; s16 phi_t5;
@ -2282,7 +2283,7 @@ void KaleidoScope_InitVertices(PlayState* play, GraphicsContext* gfxCtx) {
pauseCtx->questVtx = GRAPH_ALLOC(gfxCtx, 188 * sizeof(Vtx)); pauseCtx->questVtx = GRAPH_ALLOC(gfxCtx, 188 * sizeof(Vtx));
for (phi_t4 = 0, phi_t3 = 0; phi_t3 < 47; phi_t3++, phi_t4 += 4) { for (phi_t4 = 0, phi_t3 = 0; phi_t3 < 47; phi_t3++, phi_t4 += 4) {
phi_t2_2 = D_8082B1F8[phi_t3]; s16 phi_t2_2 = D_8082B1F8[phi_t3];
if ((phi_t3 < 6) || (phi_t3 >= 41)) { if ((phi_t3 < 6) || (phi_t3 >= 41)) {
pauseCtx->questVtx[phi_t4 + 0].v.ob[0] = pauseCtx->questVtx[phi_t4 + 2].v.ob[0] = D_8082B138[phi_t3]; pauseCtx->questVtx[phi_t4 + 0].v.ob[0] = pauseCtx->questVtx[phi_t4 + 2].v.ob[0] = D_8082B138[phi_t3];
@ -3289,6 +3290,9 @@ void KaleidoScope_Update(PlayState* play) {
pauseCtx->unk_204 = -434.0f; pauseCtx->unk_204 = -434.0f;
} }
break; break;
default:
break;
} }
break; break;

View file

@ -127,7 +127,13 @@ void PauseMapMark_DrawForDungeon(PlayState* play) {
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
Matrix_Push(); Matrix_Push();
Matrix_Translate(GREG(92) + markPoint->x, GREG(93) + markPoint->y, 0.0f, MTXMODE_APPLY);
#if OOT_DEBUG
Matrix_Translate(markPoint->x + GREG(92), markPoint->y + GREG(93), 0.0f, MTXMODE_APPLY);
#else
Matrix_Translate(markPoint->x, markPoint->y, 0.0f, MTXMODE_APPLY);
#endif
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_lmap_mark.c", 272), gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_lmap_mark.c", 272),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);