mirror of
https://github.com/zeldaret/mm.git
synced 2025-02-24 15:31:00 +00:00
ovl_Item_Etcetera decompiled (#849)
* ovl_Item_Etcetera decompiled * PR review fixes * PR Review Fixes * pr review fixes * pr review fixes * pr review fixes * final * merge Co-authored-by: SonicDcer <noreply@github.com>
This commit is contained in:
parent
37d3934e2c
commit
c6963e27d0
@ -295,6 +295,7 @@ typedef enum {
|
||||
/* 0x22 */ GI_QUIVER_30,
|
||||
/* 0x23 */ GI_QUIVER_40,
|
||||
/* 0x24 */ GI_QUIVER_50,
|
||||
/* 0x25 */ GI_25 = 0x25,
|
||||
/* 0x28 */ GI_NUTS_1 = 0x28,
|
||||
/* 0x2A */ GI_NUTS_10 = 0x2A,
|
||||
/* 0x32 */ GI_SHIELD_HERO = 0x32,
|
||||
@ -364,13 +365,15 @@ typedef enum {
|
||||
|
||||
typedef enum {
|
||||
/* 0x00 */ GID_BOTTLE,
|
||||
/* 0x02 */ GID_02 = 0x02,
|
||||
/* 0x01 */ GID_01,
|
||||
/* 0x02 */ GID_02,
|
||||
/* 0x03 */ GID_03,
|
||||
/* 0x0A */ GID_COMPASS = 0x0A,
|
||||
/* 0x0E */ GID_0E = 0x0E,
|
||||
/* 0x0F */ GID_0F,
|
||||
/* 0x10 */ GID_MASK_ALL_NIGHT = 0x10,
|
||||
/* 0x11 */ GID_NUTS,
|
||||
/* 0x13 */ GID_13 = 0x13,
|
||||
/* 0x17 */ GID_BOMB_BAG_20 = 0x17,
|
||||
/* 0x18 */ GID_BOMB_BAG_30,
|
||||
/* 0x19 */ GID_BOMB_BAG_40,
|
||||
@ -392,6 +395,11 @@ typedef enum {
|
||||
/* 0x3E */ GID_3E = 0x3E,
|
||||
/* 0x44 */ GID_44 = 0x44,
|
||||
/* 0x45 */ GID_45,
|
||||
/* 0x47 */ GID_47 = 0x47,
|
||||
/* 0x4F */ GID_4F = 0x4F,
|
||||
/* 0x50 */ GID_50,
|
||||
/* 0x51 */ GID_51,
|
||||
/* 0x53 */ GID_53 = 0x53,
|
||||
/* 0x55 */ GID_SWORD_KOKIRI = 0x55,
|
||||
/* 0x66 */ GID_SWORD_RAZOR = 0x66,
|
||||
/* 0x67 */ GID_SWORD_GILDED,
|
||||
|
3
spec
3
spec
@ -1334,8 +1334,7 @@ beginseg
|
||||
name "ovl_Item_Etcetera"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.o"
|
||||
include "build/data/ovl_Item_Etcetera/ovl_Item_Etcetera.data.o"
|
||||
include "build/data/ovl_Item_Etcetera/ovl_Item_Etcetera.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_Item_Etcetera/ovl_Item_Etcetera_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
@ -14,11 +14,12 @@ void ItemEtcetera_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ItemEtcetera_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ItemEtcetera_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
void func_80920044(ItemEtcetera* this, GlobalContext* globalCtx);
|
||||
void ItemEtcetera_WaitForObject(ItemEtcetera* this, GlobalContext* globalCtx);
|
||||
void func_8092009C(ItemEtcetera* this, GlobalContext* globalCtx);
|
||||
void func_809200F8(ItemEtcetera* this, GlobalContext* globalCtx);
|
||||
void ItemEtcetera_DrawThroughLens(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ItemEtcetera_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
void ItemEtcetera_SetupAction(ItemEtcetera* this, ItemEtceteraActionFunc actionFunc);
|
||||
|
||||
#if 0
|
||||
const ActorInit Item_Etcetera_InitVars = {
|
||||
ACTOR_ITEM_ETCETERA,
|
||||
ACTORCAT_PROP,
|
||||
@ -31,22 +32,108 @@ const ActorInit Item_Etcetera_InitVars = {
|
||||
(ActorFunc)NULL,
|
||||
};
|
||||
|
||||
#endif
|
||||
static s16 sObjectIds[] = {
|
||||
OBJECT_GI_BOTTLE, OBJECT_GI_BOTTLE, OBJECT_GI_BOTTLE, OBJECT_GI_BOTTLE, OBJECT_GI_BOTTLE,
|
||||
OBJECT_GI_BOTTLE, OBJECT_GI_KEY, OBJECT_GI_M_ARROW, OBJECT_GI_RUPY, OBJECT_GI_RUPY,
|
||||
OBJECT_GI_RUPY, OBJECT_GI_RUPY, OBJECT_GI_HEARTS, OBJECT_GI_KEY,
|
||||
};
|
||||
static s16 sDrawItemIndices[] = {
|
||||
GID_BOTTLE, GID_BOTTLE, GID_BOTTLE, GID_BOTTLE, GID_BOTTLE, GID_BOTTLE, GID_01,
|
||||
GID_47, GID_4F, GID_50, GID_51, GID_53, GID_13, GID_01,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_Etcetera/ItemEtcetera_SetupAction.s")
|
||||
static s16 sGetItemIds[] = {
|
||||
GI_BOTTLE, GI_BOTTLE, GI_BOTTLE, GI_BOTTLE, GI_BOTTLE, GI_BOTTLE, GI_KEY_SMALL,
|
||||
GI_25, GI_NONE, GI_NONE, GI_NONE, GI_NONE, GI_NONE, GI_NONE,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_Etcetera/ItemEtcetera_Init.s")
|
||||
void ItemEtcetera_SetupAction(ItemEtcetera* this, ItemEtceteraActionFunc actionFunc) {
|
||||
this->actionFunc = actionFunc;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_Etcetera/ItemEtcetera_Destroy.s")
|
||||
void ItemEtcetera_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
ItemEtcetera* this = THIS;
|
||||
s32 type = ITEMETCETERA_GET_FF(&this->actor);
|
||||
s32 objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIds[type]);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_Etcetera/func_80920044.s")
|
||||
if (objBankIndex < 0) {
|
||||
// assert on debug
|
||||
} else {
|
||||
this->objIndex = objBankIndex;
|
||||
}
|
||||
this->giDrawId = sDrawItemIndices[type];
|
||||
this->itemID = sGetItemIds[type];
|
||||
this->futureActionFunc = func_8092009C;
|
||||
this->drawFunc = ItemEtcetera_Draw;
|
||||
Actor_SetScale(&this->actor, 0.25f);
|
||||
ItemEtcetera_SetupAction(this, ItemEtcetera_WaitForObject);
|
||||
switch (type) {
|
||||
case ITEM_ETC_ARROW_FIRE:
|
||||
Actor_SetScale(&this->actor, 0.5f);
|
||||
this->actor.draw = NULL;
|
||||
this->actor.shape.yOffset = 50.0f;
|
||||
break;
|
||||
case ITEM_ETC_RUPEE_GREEN_CHEST_GAME:
|
||||
case ITEM_ETC_RUPEE_BLUE_CHEST_GAME:
|
||||
case ITEM_ETC_RUPEE_RED_CHEST_GAME:
|
||||
case ITEM_ETC_RUPEE_PURPLE_CHEST_GAME:
|
||||
case ITEM_ETC_HEART_PIECE_CHEST_GAME:
|
||||
case ITEM_ETC_KEY_SMALL_CHEST_GAME:
|
||||
Actor_SetScale(&this->actor, 0.5f);
|
||||
this->futureActionFunc = func_809200F8;
|
||||
this->drawFunc = ItemEtcetera_DrawThroughLens;
|
||||
this->actor.world.pos.y += 15.0f;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_Etcetera/func_8092009C.s")
|
||||
void ItemEtcetera_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_Etcetera/func_809200F8.s")
|
||||
void ItemEtcetera_WaitForObject(ItemEtcetera* this, GlobalContext* globalCtx) {
|
||||
if (Object_IsLoaded(&globalCtx->objectCtx, this->objIndex)) {
|
||||
this->actor.objBankIndex = this->objIndex;
|
||||
this->actor.draw = this->drawFunc;
|
||||
this->actionFunc = this->futureActionFunc;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_Etcetera/ItemEtcetera_Update.s")
|
||||
void func_8092009C(ItemEtcetera* this, GlobalContext* globalCtx) {
|
||||
if (Actor_HasParent(&this->actor, globalCtx)) {
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
} else {
|
||||
Actor_PickUp(&this->actor, globalCtx, this->itemID, 30.0f, 50.0f);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_Etcetera/func_80920164.s")
|
||||
void func_809200F8(ItemEtcetera* this, GlobalContext* globalCtx) {
|
||||
if (Flags_GetTreasure(globalCtx, ITEMETCETERA_GET_TREASUREFLAG(&this->actor))) {
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_Etcetera/func_809201BC.s")
|
||||
void ItemEtcetera_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ItemEtcetera* this = THIS;
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
|
||||
void ItemEtcetera_DrawThroughLens(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ItemEtcetera* this = THIS;
|
||||
|
||||
if (globalCtx->actorCtx.unk4 == 100) {
|
||||
func_800B8050(&this->actor, globalCtx, 0);
|
||||
func_800B8118(&this->actor, globalCtx, 0);
|
||||
GetItem_Draw(globalCtx, this->giDrawId);
|
||||
}
|
||||
}
|
||||
|
||||
void ItemEtcetera_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ItemEtcetera* this = THIS;
|
||||
|
||||
func_800B8050(&this->actor, globalCtx, 0);
|
||||
func_800B8118(&this->actor, globalCtx, 0);
|
||||
GetItem_Draw(globalCtx, this->giDrawId);
|
||||
}
|
||||
|
@ -5,12 +5,36 @@
|
||||
|
||||
struct ItemEtcetera;
|
||||
|
||||
#define ITEMETCETERA_GET_FF(thisx) ((thisx)->params & 0xFF)
|
||||
#define ITEMETCETERA_GET_TREASUREFLAG(thisx) (((thisx)->params >> 8) & 0x1F)
|
||||
|
||||
typedef void (*ItemEtceteraActionFunc)(struct ItemEtcetera*, GlobalContext*);
|
||||
|
||||
typedef enum {
|
||||
/* 0x00 */ ITEM_ETC_BOTTLE_1,
|
||||
/* 0x01 */ ITEM_ETC_BOTTLE_2,
|
||||
/* 0x02 */ ITEM_ETC_BOTTLE_3,
|
||||
/* 0x03 */ ITEM_ETC_BOTTLE_4,
|
||||
/* 0x04 */ ITEM_ETC_BOTTLE_5,
|
||||
/* 0x05 */ ITEM_ETC_BOTTLE_6,
|
||||
/* 0x06 */ ITEM_ETC_KEY_SMALL,
|
||||
/* 0x07 */ ITEM_ETC_ARROW_FIRE,
|
||||
/* 0x08 */ ITEM_ETC_RUPEE_GREEN_CHEST_GAME,
|
||||
/* 0x09 */ ITEM_ETC_RUPEE_BLUE_CHEST_GAME,
|
||||
/* 0x0A */ ITEM_ETC_RUPEE_RED_CHEST_GAME,
|
||||
/* 0x0B */ ITEM_ETC_RUPEE_PURPLE_CHEST_GAME,
|
||||
/* 0x0C */ ITEM_ETC_HEART_PIECE_CHEST_GAME,
|
||||
/* 0x0D */ ITEM_ETC_KEY_SMALL_CHEST_GAME
|
||||
} ItemEtceteraType;
|
||||
|
||||
typedef struct ItemEtcetera {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x0144 */ char unk_144[0x10];
|
||||
/* 0x0154 */ ItemEtceteraActionFunc actionFunc;
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ ItemEtceteraActionFunc futureActionFunc;
|
||||
/* 0x148 */ s16 giDrawId;
|
||||
/* 0x14A */ s16 itemID;
|
||||
/* 0x14C */ u8 objIndex;
|
||||
/* 0x150 */ ActorFunc drawFunc;
|
||||
/* 0x154 */ ItemEtceteraActionFunc actionFunc;
|
||||
} ItemEtcetera; // size = 0x158
|
||||
|
||||
extern const ActorInit Item_Etcetera_InitVars;
|
||||
|
Loading…
x
Reference in New Issue
Block a user