diff --git a/linker_scripts/code_script.txt b/linker_scripts/code_script.txt index 954e322bfc..73bdb88021 100644 --- a/linker_scripts/code_script.txt +++ b/linker_scripts/code_script.txt @@ -2294,9 +2294,9 @@ SECTIONS ovl_Item_Inbox : AT(RomLocation) { build/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.o(.text) - build/asm/overlays/ovl_Item_Inbox_data.o(.data) + build/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.o(.data) build/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.o(.rodata) - build/asm/overlays/ovl_Item_Inbox_rodata.o(.rodata) + build/src/overlays/actors/ovl_Item_Inbox/z_item_inbox_overlay.o(.ovl) } SegmentEnd = .; SegmentSize = SegmentEnd - SegmentStart; diff --git a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c index e0eac8a834..0cb0bca1c1 100644 --- a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c +++ b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c @@ -9,7 +9,8 @@ void ItemInbox_Destroy(Actor* thisx, GlobalContext* globalCtx); void ItemInbox_Update(Actor* thisx, GlobalContext* globalCtx); void ItemInbox_Draw(Actor* thisx, GlobalContext* globalCtx); -/* +void ItemInbox_Idle(ItemInbox* this, GlobalContext* globalCtx); + const ActorInit Item_Inbox_InitVars = { ACTOR_ITEM_INBOX, ACTORCAT_NPC, @@ -21,14 +22,33 @@ const ActorInit Item_Inbox_InitVars = { (ActorFunc)ItemInbox_Update, (ActorFunc)ItemInbox_Draw }; -*/ -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Item_Inbox_0x809454F0/ItemInbox_Init.asm") +void ItemInbox_Init(Actor* thisx, GlobalContext* globalCtx) { + ItemInbox* this = THIS; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Item_Inbox_0x809454F0/ItemInbox_Destroy.asm") + this->actionFunc = ItemInbox_Idle; + Actor_SetScale(&this->actor, 0.2f); +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Item_Inbox_0x809454F0/func_80945534.asm") +void ItemInbox_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Item_Inbox_0x809454F0/ItemInbox_Update.asm") +void ItemInbox_Idle(ItemInbox* this, GlobalContext* globalCtx) { + if (Actor_GetChestFlag(globalCtx, (this->actor.params >> 8) & 0x1F)) { + Actor_MarkForDeath(&this->actor); + } +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Item_Inbox_0x809454F0/ItemInbox_Draw.asm") +void ItemInbox_Update(Actor* thisx, GlobalContext* globalCtx) { + ItemInbox* this = THIS; + + this->actionFunc(this, globalCtx); +} + +void ItemInbox_Draw(Actor* thisx, GlobalContext* globalCtx) { + ItemInbox* this = THIS; + + func_800B8050(&this->actor, globalCtx, 0); + func_800B8118(&this->actor, globalCtx, 0); + GetItem_Draw(globalCtx, this->actor.params & 0xFF); +} diff --git a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h index 9c9b42b0f1..98f6b79ba5 100644 --- a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h +++ b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h @@ -5,9 +5,11 @@ struct ItemInbox; +typedef void (*ItemInboxActionFunc)(struct ItemInbox*, GlobalContext*); + typedef struct ItemInbox { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x4]; + /* 0x144 */ ItemInboxActionFunc actionFunc; } ItemInbox; // size = 0x148 extern const ActorInit Item_Inbox_InitVars; diff --git a/tables/functions.txt b/tables/functions.txt index 3cdda5fe94..b7c5e1906b 100644 --- a/tables/functions.txt +++ b/tables/functions.txt @@ -7547,7 +7547,7 @@ 0x80945310:("func_80945310",), 0x809454F0:("ItemInbox_Init",), 0x80945524:("ItemInbox_Destroy",), - 0x80945534:("func_80945534",), + 0x80945534:("ItemInbox_Idle",), 0x8094557C:("ItemInbox_Update",), 0x809455A0:("ItemInbox_Draw",), 0x80945650:("EnGe1_Init",),