z_kaleido_item.c Ok and Documented (Pause Menu Item Page) (#1027)

* import wip from kaleido

* small cleanup

* add for-loop comments

* pr review 1

* spacing

* Update src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c

Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>

Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>
This commit is contained in:
engineer124 2022-09-26 23:37:00 -04:00 committed by GitHub
parent 363a7cda46
commit ee82e65c1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 1054 additions and 117 deletions

View File

@ -149,7 +149,7 @@ Gfx object_dns_DL_001A50[] = {
};
```
Using `0x08000000` with `gsDPLoadTextureBlock` signals that this display list is expecting a texture in segment 8. What kind of texture is it expecting? We can look at the arguments after the `0x08000000`. It's looking for an RBGA16 texture with dimensions of 8x8, so we can define these textures in the XML like so:
Using `0x08000000` with `gsDPLoadTextureBlock` signals that this display list is expecting a texture in segment 8. What kind of texture is it expecting? We can look at the arguments after the `0x08000000`. It's looking for an RGBA16 texture with dimensions of 8x8, so we can define these textures in the XML like so:
```xml
<Texture Name="object_dns_Tex_0028E8" OutName="tex_0028E8" Format="rgba16" Width="8" Height="8" Offset="0x28E8" />

View File

@ -1807,13 +1807,13 @@ Vec3s* OLib_Vec3fDiffBinAng(Vec3s* dest, Vec3f* a, Vec3f* b);
void OLib_DbCameraVec3fDiff(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode);
void OLib_DbCameraVec3fSum(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode);
// void func_8010CB80(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10);
// void func_8010CD98(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10);
Gfx* func_8010CD98(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy);
// void func_8010CFBC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11, UNK_TYPE2 param_12, UNK_TYPE2 param_13, UNK_TYPE2 param_14);
// void func_8010D2D4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11);
// void func_8010D480(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11, UNK_TYPE2 param_12, UNK_TYPE2 param_13, UNK_TYPE2 param_14, UNK_TYPE4 param_15, UNK_TYPE4 param_16);
// void func_8010D7D0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10);
// void func_8010D9F4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11, UNK_TYPE4 param_12, UNK_TYPE2 param_13, UNK_TYPE2 param_14);
// void func_8010DC58(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5);
Gfx* func_8010DC58(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, u16 i);
// void func_8010DE38(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6);
// void func_8010E028(void);
// void func_8010E968(void);
@ -1903,7 +1903,7 @@ void func_80122BA4(PlayState* play, struct_80122D44_arg1* arg1, s32 arg2, s32 al
void func_80122C20(PlayState* play, struct_80122D44_arg1* arg1);
void func_80122D44(PlayState* play, struct_80122D44_arg1* arg1);
u8 Player_MaskIdToItemId(s32 maskIdMinusOne);
u8 Player_GetCurMaskItemId(PlayState* play);
s32 Player_GetCurMaskItemId(PlayState* play);
void func_80122F28(Player* player);
s32 func_80122F9C(PlayState* play);
s32 func_80122FCC(PlayState* play);
@ -2402,7 +2402,7 @@ void func_8014D304(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_
// void func_8014D7B4(void);
void func_80150A84(PlayState* play);
void func_80150D08(PlayState* play, u32 uParm2);
// void func_801514B0(void);
void func_801514B0(PlayState* play, u16 arg1, u8 arg2);
void Message_StartTextbox(PlayState* play, u16 textId, Actor* Actor);
void func_80151938(PlayState* play, u16 textId);
void func_80151A68(PlayState* play, u16 textId);

View File

@ -444,15 +444,15 @@ typedef struct {
/* 0x22C */ s32 unk_22C;
/* 0x230 */ s32 stickRelX;
/* 0x234 */ s32 stickRelY;
/* 0x238 */ s16 unk_238[5];
/* 0x242 */ s16 unk_242[5];
/* 0x24C */ s16 unk_24C[5];
/* 0x238 */ s16 cursorPoint[5];
/* 0x242 */ s16 cursorX[5];
/* 0x24C */ s16 cursorY[5];
/* 0x256 */ s16 unk_256;
/* 0x258 */ s16 unk_258;
/* 0x25A */ s16 unk_25A;
/* 0x258 */ s16 cursorSpecialPos;
/* 0x25A */ s16 pageSwitchTimer;
/* 0x25C */ u16 unk_25C;
/* 0x25E */ u16 cursorItem[5];
/* 0x268 */ u16 unk_268[5];
/* 0x268 */ u16 cursorSlot[5];
/* 0x272 */ u16 equipTargetItem;
/* 0x274 */ u16 equipTargetSlot;
/* 0x276 */ u16 equipTargetCBtn;
@ -461,8 +461,8 @@ typedef struct {
/* 0x27C */ s16 equipAnimAlpha;
/* 0x27E */ s16 unk_27E;
/* 0x280 */ u16 unk_280;
/* 0x282 */ u16 unk_282;
/* 0x284 */ s16 unk_284;
/* 0x282 */ u16 nameColorSet;
/* 0x284 */ s16 cursorColorSet;
/* 0x286 */ s16 unk_286;
/* 0x288 */ f32 unk_288;
/* 0x28C */ f32 unk_28C;
@ -476,9 +476,9 @@ typedef struct {
/* 0x2B6 */ u8 unk_2B6;
/* 0x2B7 */ u8 unk_2B7;
/* 0x2B8 */ u8 unk_2B8;
/* 0x2B9 */ u8 unk_2B9;
/* 0x2BA */ s16 unk_2BA;
/* 0x2BC */ s16 unk_2BC;
/* 0x2B9 */ u8 itemDescriptionOn; // helpful description of item given through a message box
/* 0x2BA */ s16 equipAnimScale; // scale of item icon while moving being equipped to c-button
/* 0x2BC */ s16 equipAnimShrinkRate; // rate the scale is shrinking for the item icon while moving being equipped to c-button
/* 0x2BE */ s16 unk_2BE[5];
/* 0x2C8 */ u16 unk_2C8;
/* 0x2CA */ s16 unk_2CA;

View File

@ -285,7 +285,7 @@ typedef enum {
/* 0xF2 */ ITEM_F2,
/* 0xFD */ ITEM_FD = 0xFD,
/* 0xFF */ ITEM_NONE = 0xFF
} ItemID;
} ItemId;
#define BOTTLE_FIRST 0
#define BOTTLE_MAX 6
@ -428,7 +428,7 @@ typedef enum {
/* 0xB8 */ GI_TINGLE_MAP_GREAT_BAY,
/* 0xB9 */ GI_TINGLE_MAP_STONE_TOWER,
/* 0xBA */ GI_MAX
} GetItemID;
} GetItemId;
typedef enum {
/* 0x00 */ GID_BOTTLE,

View File

@ -33,12 +33,12 @@ void func_800F4A10(PlayState* play) {
for (i = 9; i >= 0; i--) {
if ((gSaveContext.save.playerData.owlActivationFlags >> i) & 1) {
pauseCtx->worldMapPoints[i] = 1;
pauseCtx->unk_238[4] = i;
pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = i;
}
}
if ((gSaveContext.save.playerData.owlActivationFlags >> 4) & 1) {
pauseCtx->unk_238[4] = 4;
pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = 4;
}
}
@ -82,7 +82,7 @@ void KaleidoSetup_Update(PlayState* play) {
!(play->actorCtx.flags & ACTORCTX_FLAG_2)) {
if ((play->actorCtx.unk268 == 0) && CHECK_BTN_ALL(input->press.button, BTN_START)) {
gSaveContext.unk_3F26 = gSaveContext.unk_3F22;
pauseCtx->unk_2B9 = 0;
pauseCtx->itemDescriptionOn = false;
pauseCtx->state = 1;
func_800F4A10(play);
pauseCtx->mode = pauseCtx->pageIndex * 2 + 1;
@ -122,23 +122,23 @@ void KaleidoSetup_Init(PlayState* play) {
pauseCtx->unk_20C = 936.0f;
pauseCtx->unk_220 = -314.0f;
pauseCtx->unk_238[PAUSE_MAP] = XREG(94) + 3;
pauseCtx->cursorPoint[PAUSE_MAP] = XREG(94) + 3;
pauseCtx->unk_258 = 11;
pauseCtx->unk_25A = 0;
pauseCtx->cursorSpecialPos = PAUSE_CURSOR_PAGE_RIGHT;
pauseCtx->pageSwitchTimer = 0;
pauseCtx->cursorItem[PAUSE_ITEM] = 999;
pauseCtx->cursorItem[PAUSE_ITEM] = PAUSE_ITEM_NONE;
pauseCtx->cursorItem[PAUSE_MAP] = XREG(94) + 3;
pauseCtx->cursorItem[PAUSE_QUEST] = 999;
pauseCtx->cursorItem[PAUSE_MASK] = 999;
pauseCtx->cursorItem[PAUSE_QUEST] = PAUSE_ITEM_NONE;
pauseCtx->cursorItem[PAUSE_MASK] = PAUSE_ITEM_NONE;
pauseCtx->unk_268[PAUSE_ITEM] = 0;
pauseCtx->unk_268[PAUSE_MAP] = XREG(94) + 3;
pauseCtx->cursorSlot[PAUSE_ITEM] = 0;
pauseCtx->cursorSlot[PAUSE_MAP] = XREG(94) + 3;
pauseCtx->unk_284 = 2;
pauseCtx->cursorColorSet = 2;
pauseCtx->unk_2A0 = -1;
pauseCtx->unk_2BA = 320;
pauseCtx->unk_2BC = 40;
pauseCtx->equipAnimScale = 320;
pauseCtx->equipAnimShrinkRate = 40;
pauseCtx->promptAlpha = 100;
View_Init(&pauseCtx->view, play->state.gfxCtx);

View File

@ -270,7 +270,7 @@ void func_8014D62C(PlayState* play, s32* arg1, f32* arg2, s16* arg3) {
if ((func_8010A0A4(play) != 0) || (play->sceneNum == 0x4F)) {
phi_v0 = 0xA;
} else {
phi_v0 = pauseCtx->unk_238[PAUSE_WORLD_MAP];
phi_v0 = pauseCtx->cursorPoint[PAUSE_WORLD_MAP];
}
temp_s6 = D_801D0250[phi_v0];

View File

@ -257,7 +257,7 @@ void Message_LoadAreaTextNES(PlayState* play, s32* offset, f32* arg2, s16* decod
if ((func_8010A0A4(play) != 0) || (play->sceneNum == SCENE_SECOM)) {
currentArea = 10;
} else {
currentArea = play->pauseCtx.unk_238[PAUSE_WORLD_MAP];
currentArea = play->pauseCtx.cursorPoint[PAUSE_WORLD_MAP];
}
stringLimit = D_801D07C4[currentArea];

View File

@ -274,7 +274,7 @@ u8 Player_MaskIdToItemId(s32 maskIdMinusOne) {
return sMaskItemIds[maskIdMinusOne];
}
u8 Player_GetCurMaskItemId(PlayState* play) {
s32 Player_GetCurMaskItemId(PlayState* play) {
Player* player = GET_PLAYER(play);
if (player->currentMask != PLAYER_MASK_NONE) {

View File

@ -922,11 +922,7 @@ void EnFsn_DeterminePrice(EnFsn* this, PlayState* play) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_16) {
itemActionParam = func_80123810(play);
if (itemActionParam > PLAYER_AP_NONE) {
if (player->heldItemButton == 0) {
buttonItem = CUR_FORM_EQUIP(player->heldItemButton);
} else {
buttonItem = gSaveContext.save.equips.buttonItems[0][player->heldItemButton];
}
buttonItem = GET_CUR_FORM_BTN_ITEM(player->heldItemButton);
this->price = (buttonItem < ITEM_MOON_TEAR) ? gItemPrices[buttonItem] : 0;
if (this->price > 0) {
player->actor.textId = 0x29EF;

View File

@ -34,10 +34,10 @@ s16 sCurRow = 0;
// Geometry of the highlights for the selected section
typedef struct {
/* 0 */ s16 screenX;
/* 1 */ s16 screenY;
/* 2 */ s16 width;
} SectionPosition;
/* 0x0 */ s16 screenX;
/* 0x2 */ s16 screenY;
/* 0x4 */ s16 width;
} SectionPosition; // size = 0x6;
// clang-format off
SectionPosition sSectionPositions[] = {

File diff suppressed because it is too large Load Diff

View File

@ -3,14 +3,25 @@
#include "global.h"
#define PAUSE_ITEM_NONE 999
#define PAUSE_CURSOR_PAGE_LEFT 10
#define PAUSE_CURSOR_PAGE_RIGHT 11
typedef enum {
/* 0x00 */ PAUSE_ITEM,
/* 0x01 */ PAUSE_MAP,
/* 0x02 */ PAUSE_QUEST,
/* 0x03 */ PAUSE_MASK,
/* 0x04 */ PAUSE_WORLD_MAP
/* 0 */ PAUSE_ITEM,
/* 1 */ PAUSE_MAP,
/* 2 */ PAUSE_QUEST,
/* 3 */ PAUSE_MASK,
/* 4 */ PAUSE_WORLD_MAP
} PauseMenuPage;
typedef enum {
/* 0 */ PAUSE_EQUIP_C_LEFT,
/* 1 */ PAUSE_EQUIP_C_DOWN,
/* 2 */ PAUSE_EQUIP_C_RIGHT
} PauseEquipCButton;
typedef enum {
/* 0 */ DEBUG_EDITOR_NONE,
/* 1 */ DEBUG_EDITOR_INVENTORY_INIT,
@ -21,6 +32,17 @@ typedef enum {
#define PAUSE_PROMPT_YES 0
#define PAUSE_PROMPT_NO 4
// NES
void KaleidoScope_MoveCursorToSpecialPos(PlayState* play, s16 cursorSpecialPos);
void KaleidoScope_DrawQuadTextureRGBA32(GraphicsContext* gfxCtx, void* texture, u16 width, u16 height, u16 point);
void func_80821A04(PlayState* play);
// Item
void KaleidoScope_SetCursorVtx(PauseContext* pauseCtx, u16 index, Vtx* vtx);
void KaleidoScope_DrawItemSelect(PlayState* play);
void KaleidoScope_UpdateItemCursor(PlayState* play);
void KaleidoScope_UpdateItemEquip(PlayState* play);
// Debug
void KaleidoScope_DrawInventoryEditor(PlayState* play);
void KaleidoScope_UpdateInventoryEditor(PlayState* play);

View File

@ -318,11 +318,11 @@ s32 D_8082BEB8[] = { 0, 0 };
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821958.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821984.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_MoveCursorToSpecialPos.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821A04.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821AD4.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_DrawQuadTextureRGBA32.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821CC4.s")

View File

@ -4204,11 +4204,11 @@
0x808190C4:("KaleidoScope_DrawDigit",),
0x80819238:("KaleidoScope_DrawInventoryEditor",),
0x80819F04:("KaleidoScope_UpdateInventoryEditor",),
0x8081B240:("func_8081B240",),
0x8081B6BC:("func_8081B6BC",),
0x8081B6EC:("func_8081B6EC",),
0x8081BCA8:("func_8081BCA8",),
0x8081C684:("func_8081C684",),
0x8081B240:("KaleidoScope_DrawAmmoCount",),
0x8081B6BC:("KaleidoScope_SetCursorVtx",),
0x8081B6EC:("KaleidoScope_DrawItemSelect",),
0x8081BCA8:("KaleidoScope_UpdateItemCursor",),
0x8081C684:("KaleidoScope_UpdateItemEquip",),
0x8081D240:("func_8081D240",),
0x8081D6DC:("func_8081D6DC",),
0x8081E118:("func_8081E118",),
@ -4221,9 +4221,9 @@
0x80821900:("func_80821900",),
0x8082192C:("func_8082192C",),
0x80821958:("func_80821958",),
0x80821984:("func_80821984",),
0x80821984:("KaleidoScope_MoveCursorToSpecialPos",),
0x80821A04:("func_80821A04",),
0x80821AD4:("func_80821AD4",),
0x80821AD4:("KaleidoScope_DrawQuadTextureRGBA32",),
0x80821CC4:("func_80821CC4",),
0x80821D84:("func_80821D84",),
0x80821F30:("func_80821F30",),

View File

@ -4693,16 +4693,16 @@
0x8082B388:("sRowFirstSections","UNK_TYPE2","",0x2),
0x8082B3AC:("sPrevDBtnInput","UNK_TYPE4","",0x4),
0x8082B3B0:("sHeldDBtnTimer","UNK_TYPE4","",0x4),
0x8082B3C0:("D_8082B3C0","UNK_TYPE2","",0x2),
0x8082B3C4:("D_8082B3C4","UNK_TYPE2","",0x2),
0x8082B3C8:("D_8082B3C8","UNK_TYPE2","",0x2),
0x8082B3CC:("D_8082B3CC","UNK_TYPE1","",0x1),
0x8082B444:("D_8082B444","UNK_TYPE1","",0x1),
0x8082B454:("D_8082B454","UNK_TYPE1","",0x1),
0x8082B47C:("D_8082B47C","UNK_TYPE1","",0x1),
0x8082B484:("D_8082B484","UNK_TYPE1","",0x1),
0x8082B48C:("D_8082B48C","UNK_TYPE1","",0x1),
0x8082B494:("D_8082B494","UNK_TYPE2","",0x2),
0x8082B3C0:("sEquipState","UNK_TYPE2","",0x2),
0x8082B3C4:("sEquipMagicArrowSlotHoldTimer","UNK_TYPE2","",0x2),
0x8082B3C8:("sEquipAnimTimer","UNK_TYPE2","",0x2),
0x8082B3CC:("gPlayerFormSlotRestrictions","UNK_TYPE1","",0x1),
0x8082B444:("sAmmoRectLeft","UNK_TYPE1","",0x1),
0x8082B454:("sAmmoRectHeight","UNK_TYPE1","",0x1),
0x8082B47C:("sPlayerFormItems","UNK_TYPE1","",0x1),
0x8082B484:("sCButtonPosX","UNK_TYPE1","",0x1),
0x8082B48C:("sCButtonPosY","UNK_TYPE1","",0x1),
0x8082B494:("sEquipMagicArrowBowSlotHoldTimer","UNK_TYPE2","",0x2),
0x8082B4A0:("D_8082B4A0","UNK_TYPE4","",0x4),
0x8082B4AC:("D_8082B4AC","UNK_TYPE1","",0x1),
0x8082B4BC:("D_8082B4BC","UNK_TYPE1","",0x1),