diff --git a/include/functions.h b/include/functions.h index 8fea94015..84d1c49be 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1925,8 +1925,7 @@ void Inventory_UpdateBottleItem(GlobalContext* globalCtx, u8 item, u8 btn); s32 Inventory_ConsumeFairy(GlobalContext* globalCtx); void Inventory_UpdateItem(GlobalContext* globalCtx, s16 slot, s16 item); // void func_801153C8(void); -// void Interface_LoadActionLabel(void); -void Interface_SetDoAction(GlobalContext* globalCtx, u16 arg1); +void Interface_SetDoAction(GlobalContext* globalCtx, u16 action); // void func_801155B4(void); // void Interface_SetNaviCall(void); void func_80115844(GlobalContext* globalCtx, s16 param_2); diff --git a/include/z64.h b/include/z64.h index 8702b0a4c..0cd2a969a 100644 --- a/include/z64.h +++ b/include/z64.h @@ -574,48 +574,48 @@ typedef struct { } PauseContext; // size = 0x2D0 typedef enum { - /* 0x00 */ DO_ACTION_UNK00, - /* 0x01 */ DO_ACTION_UNK01, - /* 0x02 */ DO_ACTION_UNK02, - /* 0x03 */ DO_ACTION_UNK03, - /* 0x04 */ DO_ACTION_UNK04, - /* 0x05 */ DO_ACTION_UNK05, + /* 0x00 */ DO_ACTION_ATTACK, + /* 0x01 */ DO_ACTION_CHECK, + /* 0x02 */ DO_ACTION_ENTER, + /* 0x03 */ DO_ACTION_RETURN, + /* 0x04 */ DO_ACTION_OPEN, + /* 0x05 */ DO_ACTION_JUMP, /* 0x06 */ DO_ACTION_DECIDE, - /* 0x07 */ DO_ACTION_UNK07, - /* 0x08 */ DO_ACTION_UNK08, - /* 0x09 */ DO_ACTION_UNK09, + /* 0x07 */ DO_ACTION_DIVE, + /* 0x08 */ DO_ACTION_FASTER, + /* 0x09 */ DO_ACTION_THROW, /* 0x0A */ DO_ACTION_NONE, // in do_action_static, the texture at this position is NAVI, however this value is in practice the "No Action" value - /* 0x0B */ DO_ACTION_UNK0B, - /* 0x0C */ DO_ACTION_UNK0C, - /* 0x0D */ DO_ACTION_UNK0D, - /* 0x0E */ DO_ACTION_UNK0E, - /* 0x0F */ DO_ACTION_UNK0F, + /* 0x0B */ DO_ACTION_CLIMB, + /* 0x0C */ DO_ACTION_DROP, + /* 0x0D */ DO_ACTION_DOWN, + /* 0x0E */ DO_ACTION_QUIT, + /* 0x0F */ DO_ACTION_SPEAK, /* 0x10 */ DO_ACTION_NEXT, - /* 0x11 */ DO_ACTION_UNK11, - /* 0x12 */ DO_ACTION_UNK12, - /* 0x13 */ DO_ACTION_UNK13, - /* 0x14 */ DO_ACTION_UNK14, - /* 0x15 */ DO_ACTION_UNK15, - /* 0x16 */ DO_ACTION_UNK16, - /* 0x17 */ DO_ACTION_UNK17, - /* 0x18 */ DO_ACTION_UNK18, - /* 0x19 */ DO_ACTION_UNK19, - /* 0x1A */ DO_ACTION_UNK1A, - /* 0x1B */ DO_ACTION_UNK1B, - /* 0x1C */ DO_ACTION_UNK1C, - /* 0x1D */ DO_ACTION_UNK1D, - /* 0x1E */ DO_ACTION_UNK1E, - /* 0x1F */ DO_ACTION_UNK1F, - /* 0x20 */ DO_ACTION_UNK20, - /* 0x21 */ DO_ACTION_UNK21, - /* 0x22 */ DO_ACTION_UNK22, - /* 0x23 */ DO_ACTION_UNK23, - /* 0x24 */ DO_ACTION_UNK24, - /* 0x25 */ DO_ACTION_UNK25, - /* 0x26 */ DO_ACTION_UNK26, - /* 0x27 */ DO_ACTION_UNK27, - /* 0x28 */ DO_ACTION_UNK28, - /* 0x29 */ DO_ACTION_UNK29, + /* 0x11 */ DO_ACTION_GRAB, + /* 0x12 */ DO_ACTION_STOP, + /* 0x13 */ DO_ACTION_PUTAWAY, + /* 0x14 */ DO_ACTION_REEL, + /* 0x15 */ DO_ACTION_INFO, + /* 0x16 */ DO_ACTION_WARP, + /* 0x17 */ DO_ACTION_SNAP, + /* 0x18 */ DO_ACTION_EXPLODE, + /* 0x19 */ DO_ACTION_DANCE, + /* 0x1A */ DO_ACTION_MARCH, + /* 0x1B */ DO_ACTION_1, + /* 0x1C */ DO_ACTION_2, + /* 0x1D */ DO_ACTION_3, + /* 0x1E */ DO_ACTION_4, + /* 0x1F */ DO_ACTION_5, + /* 0x20 */ DO_ACTION_6, + /* 0x21 */ DO_ACTION_7, + /* 0x22 */ DO_ACTION_8, + /* 0x23 */ DO_ACTION_CURL, + /* 0x24 */ DO_ACTION_SURFACE, + /* 0x25 */ DO_ACTION_SWIM, + /* 0x26 */ DO_ACTION_PUNCH, + /* 0x27 */ DO_ACTION_POUND, + /* 0x28 */ DO_ACTION_HOOK, + /* 0x29 */ DO_ACTION_SHOOT, /* 0x2A */ DO_ACTION_MAX } DoAction; diff --git a/src/code/z_message.c b/src/code/z_message.c index 68634e1a3..784c97977 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -343,9 +343,9 @@ void func_80151938(GlobalContext* globalCtx, u16 textId) { if (interfaceCtx->unk_222 == 0) { if (textId != 0x1B93) { - Interface_SetDoAction(globalCtx, 0x10); + Interface_SetDoAction(globalCtx, DO_ACTION_NEXT); } else if (textId != 0xF8) { - Interface_SetDoAction(globalCtx, 6); + Interface_SetDoAction(globalCtx, DO_ACTION_DECIDE); } } msgCtx->unk1203C = msgCtx->unk1203A; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 8f38dd618..3d47f35e8 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -13,6 +13,11 @@ void func_801663C4(u8* arg0, u8* arg1, u32 arg2); extern Gfx D_0E0001C8[]; // Display List extern Gfx D_0E0002E0[]; // Display List +// TODO extract this information from the texture definitions themselves +#define DO_ACTION_TEX_WIDTH 48 +#define DO_ACTION_TEX_HEIGHT 16 +#define DO_ACTION_TEX_SIZE ((DO_ACTION_TEX_WIDTH * DO_ACTION_TEX_HEIGHT) / 2) // (sizeof(gCheckDoActionENGTex)) + typedef struct { /* 0x00 */ u8 scene; /* 0x01 */ u8 flags1; @@ -2981,9 +2986,10 @@ void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 l if (action != DO_ACTION_NONE) { osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, 1); - DmaMgr_SendRequestImpl(&interfaceCtx->dmaRequest_184, (u32)interfaceCtx->doActionSegment + (loadOffset * 0x180), - (u32)SEGMENT_ROM_START(do_action_static) + (action * 0x180), 0x180, 0, - &interfaceCtx->loadQueue, 0); + DmaMgr_SendRequestImpl(&interfaceCtx->dmaRequest_184, + (u32)interfaceCtx->doActionSegment + (loadOffset * DO_ACTION_TEX_SIZE), + (u32)SEGMENT_ROM_START(do_action_static) + (action * DO_ACTION_TEX_SIZE), + DO_ACTION_TEX_SIZE, 0, &interfaceCtx->loadQueue, 0); osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK); return; } @@ -3708,9 +3714,9 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment + 0x300, G_IM_FMT_IA, 48, 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); + gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE * 2, G_IM_FMT_IA, + DO_ACTION_TEX_WIDTH, DO_ACTION_TEX_HEIGHT, 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); gSPTextureRectangle(OVERLAY_DISP++, 0x01F8, 0x0054, 0x02D4, 0x009C, G_TX_RENDERTILE, 0, 0, 0x04A6, 0x04A6); } } @@ -4028,10 +4034,13 @@ void func_80118BA4(GlobalContext* globalCtx) { gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[8], 4, 0); + // Draw Action Label if (((interfaceCtx->unk_210 < 2) || (interfaceCtx->unk_210 == 3))) { - OVERLAY_DISP = func_8010DE38(OVERLAY_DISP, interfaceCtx->doActionSegment, 3, 0x30, 0x10, 0); + OVERLAY_DISP = + func_8010DE38(OVERLAY_DISP, interfaceCtx->doActionSegment, 3, DO_ACTION_TEX_WIDTH, DO_ACTION_TEX_HEIGHT, 0); } else { - OVERLAY_DISP = func_8010DE38(OVERLAY_DISP, interfaceCtx->doActionSegment + 0x180, 3, 0x30, 0x10, 0); + OVERLAY_DISP = func_8010DE38(OVERLAY_DISP, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE, 3, + DO_ACTION_TEX_WIDTH, DO_ACTION_TEX_HEIGHT, 0); } CLOSE_DISPS(globalCtx->state.gfxCtx);