1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-02-23 07:45:55 +00:00

Merge branch 'main' (early part) into doc_pause_menu

This commit is contained in:
Dragorn421 2024-09-04 09:32:57 +02:00
commit 1aac857b58
No known key found for this signature in database
GPG key ID: 381AEBAF3D429335
2 changed files with 64 additions and 92 deletions

View file

@ -162,22 +162,22 @@ void KaleidoScope_ProcessPlayerPreRender(PlayState* play);
void KaleidoScope_DrawEquipment(PlayState* play) { void KaleidoScope_DrawEquipment(PlayState* play) {
static s16 sEquipTimer = 0; static s16 sEquipTimer = 0;
PauseContext* pauseCtx = &play->pauseCtx; PauseContext* pauseCtx = &play->pauseCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
Input* input = &play->state.input[0]; Input* input = &play->state.input[0];
u16 i; u16 i;
u16 j; u16 j;
u16 k; u16 k;
u16 bit; u16 bit;
u16 rowStart;
u16 temp; u16 temp;
u16 point; u16 point;
u16 rowStart;
u16 pad;
s16 cursorMoveResult; s16 cursorMoveResult;
u16 cursorItem;
u16 cursorSlot; u16 cursorSlot;
s16 cursorPoint; u16 cursorItem;
s16 cursorX; s16 cursorX;
s16 cursorY; s16 cursorY;
volatile s16 oldCursorPoint; s16 oldCursorPoint;
s16 cursorPoint;
OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_equipment.c", 219); OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_equipment.c", 219);
@ -216,7 +216,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
cursorY = pauseCtx->cursorY[PAUSE_EQUIP]; cursorY = pauseCtx->cursorY[PAUSE_EQUIP];
cursorMoveResult = 0; cursorMoveResult = 0;
while (cursorMoveResult == 0) { do {
if (pauseCtx->stickAdjX < -30) { if (pauseCtx->stickAdjX < -30) {
if (pauseCtx->cursorX[PAUSE_EQUIP] != EQUIP_CURSOR_X_UPG) { if (pauseCtx->cursorX[PAUSE_EQUIP] != EQUIP_CURSOR_X_UPG) {
pauseCtx->cursorX[PAUSE_EQUIP]--; pauseCtx->cursorX[PAUSE_EQUIP]--;
@ -301,15 +301,13 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
} else { } else {
cursorMoveResult = 4; cursorMoveResult = 4;
} }
} } while (cursorMoveResult == 0);
cursorPoint = pauseCtx->cursorPoint[PAUSE_EQUIP]; cursorPoint = pauseCtx->cursorPoint[PAUSE_EQUIP];
cursorY = pauseCtx->cursorY[PAUSE_EQUIP]; cursorY = pauseCtx->cursorY[PAUSE_EQUIP];
if (cursorMoveResult) {}
cursorMoveResult = 0; cursorMoveResult = 0;
while (cursorMoveResult == 0) { do {
if (pauseCtx->stickAdjY > 30) { if (pauseCtx->stickAdjY > 30) {
if (pauseCtx->cursorY[PAUSE_EQUIP] != 0) { if (pauseCtx->cursorY[PAUSE_EQUIP] != 0) {
pauseCtx->cursorY[PAUSE_EQUIP]--; pauseCtx->cursorY[PAUSE_EQUIP]--;
@ -359,7 +357,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
} else { } else {
cursorMoveResult = 4; cursorMoveResult = 4;
} }
} } while (cursorMoveResult == 0);
} else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { } else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) {
if (pauseCtx->stickAdjX > 30) { if (pauseCtx->stickAdjX > 30) {
pauseCtx->nameDisplayTimer = 0; pauseCtx->nameDisplayTimer = 0;
@ -397,19 +395,15 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
cursorY = cursorY + 1; cursorY = cursorY + 1;
cursorPoint = cursorPoint + 4; cursorPoint = cursorPoint + 4;
if (cursorY < 4) { if (cursorY >= 4) {
continue; cursorY = 0;
cursorPoint = cursorX + 1;
cursorX = cursorPoint;
if (cursorX >= 4) {
KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT);
break;
}
} }
cursorY = 0;
cursorPoint = cursorX + 1;
cursorX = cursorPoint;
if (cursorX < 4) {
continue;
}
KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT);
break;
} }
} }
} else { // cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT } else { // cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT
@ -440,19 +434,15 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
cursorY = cursorY + 1; cursorY = cursorY + 1;
cursorPoint = cursorPoint + 4; cursorPoint = cursorPoint + 4;
if (cursorY < 4) { if (cursorY >= 4) {
continue; cursorY = 0;
cursorPoint = cursorX - 1;
cursorX = cursorPoint;
if (cursorX < 0) {
KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT);
break;
}
} }
cursorY = 0;
cursorPoint = cursorX - 1;
cursorX = cursorPoint;
if (cursorX >= 0) {
continue;
}
KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT);
break;
} }
} }
} }
@ -696,7 +686,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
gSPSegment(POLY_OPA_DISP++, 0x08, pauseCtx->iconItemSegment); gSPSegment(POLY_OPA_DISP++, 0x08, pauseCtx->iconItemSegment);
gSPSegment(POLY_OPA_DISP++, 0x09, pauseCtx->iconItem24Segment); gSPSegment(POLY_OPA_DISP++, 0x09, pauseCtx->iconItem24Segment);
gSPSegment(POLY_OPA_DISP++, 0x0A, pauseCtx->nameSegment); gSPSegment(POLY_OPA_DISP++, 0x0A, pauseCtx->nameSegment);
gSPSegment(POLY_OPA_DISP++, 0x0B, play->interfaceCtx.mapSegment); gSPSegment(POLY_OPA_DISP++, 0x0B, interfaceCtx->mapSegment);
gSPSegment(POLY_OPA_DISP++, 0x0C, pauseCtx->iconItemAltSegment); gSPSegment(POLY_OPA_DISP++, 0x0C, pauseCtx->iconItemAltSegment);
// Draw player prerender onto the equip page // Draw player prerender onto the equip page

View file

@ -136,7 +136,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
s16 cursorX; s16 cursorX;
s16 cursorY; s16 cursorY;
s16 oldCursorPoint; s16 oldCursorPoint;
s16 moveCursorResult; s16 cursorMoveResult;
OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_item.c", 234); OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_item.c", 234);
@ -149,7 +149,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) &&
(pauseCtx->pageIndex == PAUSE_ITEM)) { (pauseCtx->pageIndex == PAUSE_ITEM)) {
moveCursorResult = 0; cursorMoveResult = 0;
oldCursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM]; oldCursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM];
cursorItem = pauseCtx->cursorItem[PAUSE_ITEM]; cursorItem = pauseCtx->cursorItem[PAUSE_ITEM];
@ -162,10 +162,6 @@ 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];
@ -173,13 +169,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
PRINTF("now=%d ccc=%d\n", cursorPoint, cursorItem); PRINTF("now=%d ccc=%d\n", cursorPoint, cursorItem);
#if OOT_DEBUG do {
// Seems necessary to match
if (pauseCtx->cursorX[PAUSE_ITEM]) {}
if (gSaveContext.save.info.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]) {}
#endif
while (moveCursorResult == 0) {
// input says move left // input says move left
if (pauseCtx->stickAdjX < -30) { if (pauseCtx->stickAdjX < -30) {
// if not left-most // if not left-most
@ -191,7 +181,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
// if there's an item there, stop there // if there's an item there, stop there
if (gSaveContext.save.info.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != if (gSaveContext.save.info.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] !=
ITEM_NONE) { ITEM_NONE) {
moveCursorResult = 1; cursorMoveResult = 1;
} }
} else { } else {
// move the cursor to its initial horizontal position and try find an item on the next line // move the cursor to its initial horizontal position and try find an item on the next line
@ -217,7 +207,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT);
moveCursorResult = 2; cursorMoveResult = 2;
} }
} }
} else if (pauseCtx->stickAdjX > 30) { } else if (pauseCtx->stickAdjX > 30) {
@ -227,7 +217,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
if (gSaveContext.save.info.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != if (gSaveContext.save.info.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] !=
ITEM_NONE) { ITEM_NONE) {
moveCursorResult = 1; cursorMoveResult = 1;
} }
} else { } else {
pauseCtx->cursorX[PAUSE_ITEM] = cursorX; pauseCtx->cursorX[PAUSE_ITEM] = cursorX;
@ -250,18 +240,18 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT);
moveCursorResult = 2; cursorMoveResult = 2;
} }
} }
} }
} } while (cursorMoveResult == 0);
if (moveCursorResult == 1) { if (cursorMoveResult == 1) {
cursorItem = gSaveContext.save.info.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]; cursorItem = gSaveContext.save.info.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]];
} }
PRINTF("【X cursor=%d(%) (cur_xpt=%d)(ok_fg=%d)(ccc=%d)(key_angle=%d)】 ", PRINTF("【X cursor=%d(%) (cur_xpt=%d)(ok_fg=%d)(ccc=%d)(key_angle=%d)】 ",
pauseCtx->cursorPoint[PAUSE_ITEM], pauseCtx->cursorX[PAUSE_ITEM], moveCursorResult, cursorItem, pauseCtx->cursorPoint[PAUSE_ITEM], pauseCtx->cursorX[PAUSE_ITEM], cursorMoveResult, cursorItem,
pauseCtx->cursorSpecialPos); pauseCtx->cursorSpecialPos);
} }
} else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { } else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) {
@ -278,25 +268,21 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint;
pauseCtx->cursorX[PAUSE_ITEM] = cursorX; pauseCtx->cursorX[PAUSE_ITEM] = cursorX;
pauseCtx->cursorY[PAUSE_ITEM] = cursorY; pauseCtx->cursorY[PAUSE_ITEM] = cursorY;
moveCursorResult = 1; cursorMoveResult = 1;
break; break;
} }
cursorY += 1; cursorY += 1;
cursorPoint += ITEM_GRID_COLS; cursorPoint += ITEM_GRID_COLS;
if (cursorY < ITEM_GRID_ROWS) { if (cursorY >= ITEM_GRID_ROWS) {
continue; cursorY = 0;
cursorPoint = cursorX + 1;
cursorX = cursorPoint;
if (cursorX >= ITEM_GRID_COLS) {
KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT);
break;
}
} }
cursorY = 0;
cursorPoint = cursorX + 1;
cursorX = cursorPoint;
if (cursorX < ITEM_GRID_COLS) {
continue;
}
KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT);
break;
} }
} }
} else { } else {
@ -314,25 +300,21 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint;
pauseCtx->cursorX[PAUSE_ITEM] = cursorX; pauseCtx->cursorX[PAUSE_ITEM] = cursorX;
pauseCtx->cursorY[PAUSE_ITEM] = cursorY; pauseCtx->cursorY[PAUSE_ITEM] = cursorY;
moveCursorResult = 1; cursorMoveResult = 1;
break; break;
} }
cursorY += 1; cursorY += 1;
cursorPoint += ITEM_GRID_COLS; cursorPoint += ITEM_GRID_COLS;
if (cursorY < ITEM_GRID_ROWS) { if (cursorY >= ITEM_GRID_ROWS) {
continue; cursorY = 0;
cursorPoint = cursorX - 1;
cursorX = cursorPoint;
if (cursorX < 0) {
KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT);
break;
}
} }
cursorY = 0;
cursorPoint = cursorX - 1;
cursorX = cursorPoint;
if (cursorX >= 0) {
continue;
}
KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT);
break;
} }
} }
} }
@ -340,11 +322,11 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
if (pauseCtx->cursorSpecialPos == 0) { if (pauseCtx->cursorSpecialPos == 0) {
if (cursorItem != PAUSE_ITEM_NONE) { if (cursorItem != PAUSE_ITEM_NONE) {
if (ABS(pauseCtx->stickAdjY) > 30) { if (ABS(pauseCtx->stickAdjY) > 30) {
moveCursorResult = 0; cursorMoveResult = 0;
cursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM]; cursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM];
cursorY = pauseCtx->cursorY[PAUSE_ITEM]; cursorY = pauseCtx->cursorY[PAUSE_ITEM];
while (moveCursorResult == 0) { do {
if (pauseCtx->stickAdjY > 30) { if (pauseCtx->stickAdjY > 30) {
if (pauseCtx->cursorY[PAUSE_ITEM] != 0) { if (pauseCtx->cursorY[PAUSE_ITEM] != 0) {
pauseCtx->cursorY[PAUSE_ITEM]--; pauseCtx->cursorY[PAUSE_ITEM]--;
@ -352,13 +334,13 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
if (gSaveContext.save.info.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != if (gSaveContext.save.info.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] !=
ITEM_NONE) { ITEM_NONE) {
moveCursorResult = 1; cursorMoveResult = 1;
} }
} else { } else {
pauseCtx->cursorY[PAUSE_ITEM] = cursorY; pauseCtx->cursorY[PAUSE_ITEM] = cursorY;
pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint;
moveCursorResult = 2; cursorMoveResult = 2;
} }
} else if (pauseCtx->stickAdjY < -30) { } else if (pauseCtx->stickAdjY < -30) {
if (pauseCtx->cursorY[PAUSE_ITEM] < (ITEM_GRID_ROWS - 1)) { if (pauseCtx->cursorY[PAUSE_ITEM] < (ITEM_GRID_ROWS - 1)) {
@ -367,20 +349,20 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
if (gSaveContext.save.info.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != if (gSaveContext.save.info.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] !=
ITEM_NONE) { ITEM_NONE) {
moveCursorResult = 1; cursorMoveResult = 1;
} }
} else { } else {
pauseCtx->cursorY[PAUSE_ITEM] = cursorY; pauseCtx->cursorY[PAUSE_ITEM] = cursorY;
pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint;
moveCursorResult = 2; cursorMoveResult = 2;
} }
} }
} } while (cursorMoveResult == 0);
cursorPoint = PAUSE_ITEM; cursorPoint = PAUSE_ITEM;
PRINTF("【Y cursor=%d(%) (cur_ypt=%d)(ok_fg=%d)(ccc=%d)】 ", pauseCtx->cursorPoint[cursorPoint], PRINTF("【Y cursor=%d(%) (cur_ypt=%d)(ok_fg=%d)(ccc=%d)】 ", pauseCtx->cursorPoint[cursorPoint],
pauseCtx->cursorY[PAUSE_ITEM], moveCursorResult, cursorItem); pauseCtx->cursorY[PAUSE_ITEM], cursorMoveResult, cursorItem);
} }
} }
@ -388,9 +370,9 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
pauseCtx->cursorColorSet = 4; pauseCtx->cursorColorSet = 4;
if (moveCursorResult == 1) { if (cursorMoveResult == 1) {
cursorItem = gSaveContext.save.info.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]; cursorItem = gSaveContext.save.info.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]];
} else if (moveCursorResult != 2) { } else if (cursorMoveResult != 2) {
cursorItem = gSaveContext.save.info.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]; cursorItem = gSaveContext.save.info.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]];
} }