diff --git a/spec b/spec index 0f50af9bea..68a842cae7 100644 --- a/spec +++ b/spec @@ -4938,8 +4938,7 @@ beginseg name "ovl_En_Hit_Tag" compress include "build/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.o" - include "build/data/ovl_En_Hit_Tag/ovl_En_Hit_Tag.data.o" - include "build/data/ovl_En_Hit_Tag/ovl_En_Hit_Tag.reloc.o" + include "build/src/overlays/actors/ovl_En_Hit_Tag/ovl_En_Hit_Tag_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.c b/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.c index 0e61a4937e..3c7eac5ae8 100644 --- a/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.c +++ b/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.c @@ -14,9 +14,8 @@ void EnHitTag_Init(Actor* thisx, GlobalContext* globalCtx); void EnHitTag_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnHitTag_Update(Actor* thisx, GlobalContext* globalCtx); -void func_80BE20E8(EnHitTag* this, GlobalContext* globalCtx); +void EnHitTag_WaitForHit(EnHitTag* this, GlobalContext* globalCtx); -#if 0 const ActorInit En_Hit_Tag_InitVars = { ACTOR_EN_HIT_TAG, ACTORCAT_ITEMACTION, @@ -29,21 +28,65 @@ const ActorInit En_Hit_Tag_InitVars = { (ActorFunc)NULL, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80BE21F0 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_PLAYER, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_PLAYER, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { 16, 32, 0, { 0, 0, 0 } }, }; -#endif +void EnHitTag_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnHitTag* this = THIS; -extern ColliderCylinderInit D_80BE21F0; + Actor_SetScale(&this->actor, 1.0f); + this->actionFunc = EnHitTag_WaitForHit; + Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_UpdateCylinder(&this->actor, &this->collider); + if (Flags_GetSwitch(globalCtx, ENHITTAG_GET_SWITCHFLAG(thisx))) { + Actor_MarkForDeath(&this->actor); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hit_Tag/EnHitTag_Init.s") +void EnHitTag_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnHitTag* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hit_Tag/EnHitTag_Destroy.s") + Collider_DestroyCylinder(globalCtx, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hit_Tag/func_80BE20E8.s") +void EnHitTag_WaitForHit(EnHitTag* this, GlobalContext* globalCtx) { + Vec3f dropLocation; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hit_Tag/EnHitTag_Update.s") + if (this->collider.base.acFlags & AC_HIT) { + play_sound(NA_SE_SY_GET_RUPY); + Actor_MarkForDeath(&this->actor); + dropLocation.x = this->actor.world.pos.x; + dropLocation.y = this->actor.world.pos.y; + dropLocation.z = this->actor.world.pos.z; + + for (i = 0; i < 3; i++) { + Item_DropCollectible(globalCtx, &dropLocation, ITEM00_RUPEE_GREEN); + } + } else { + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } +} + +void EnHitTag_Update(Actor* thisx, GlobalContext* globalCtx) { + EnHitTag* this = THIS; + this->actionFunc(this, globalCtx); +} diff --git a/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.h b/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.h index 9af7edf1fe..2117cb27d9 100644 --- a/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.h +++ b/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.h @@ -7,9 +7,11 @@ struct EnHitTag; typedef void (*EnHitTagActionFunc)(struct EnHitTag*, GlobalContext*); +#define ENHITTAG_GET_SWITCHFLAG(thisx) (s32)(((thisx)->params & 0xFE00) >> 9) + typedef struct EnHitTag { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x4C]; + /* 0x0144 */ ColliderCylinder collider; /* 0x0190 */ EnHitTagActionFunc actionFunc; } EnHitTag; // size = 0x194 diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index dbce96f1ed..080711b1b3 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -16068,7 +16068,7 @@ 0x80BE1E9C:("EnNimotsu_Draw",), 0x80BE2030:("EnHitTag_Init",), 0x80BE20BC:("EnHitTag_Destroy",), - 0x80BE20E8:("func_80BE20E8",), + 0x80BE20E8:("EnHitTag_WaitForHit",), 0x80BE21A0:("EnHitTag_Update",), 0x80BE2260:("func_80BE2260",), 0x80BE2330:("func_80BE2330",),