diff --git a/spec b/spec index ca0cf9a0dc..c45ba6d01c 100644 --- a/spec +++ b/spec @@ -3724,8 +3724,7 @@ beginseg name "ovl_En_Onpuman" compress include "build/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.o" - include "build/data/ovl_En_Onpuman/ovl_En_Onpuman.data.o" - include "build/data/ovl_En_Onpuman/ovl_En_Onpuman.reloc.o" + include "build/src/overlays/actors/ovl_En_Onpuman/ovl_En_Onpuman_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c b/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c index 25b9c51606..095dbfaa99 100644 --- a/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c +++ b/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c @@ -14,7 +14,8 @@ void EnOnpuman_Init(Actor* thisx, PlayState* play); void EnOnpuman_Destroy(Actor* thisx, PlayState* play); void EnOnpuman_Update(Actor* thisx, PlayState* play); -#if 0 +void func_80B121D8(EnOnpuman* this, PlayState* play); + const ActorInit En_Onpuman_InitVars = { ACTOR_EN_ONPUMAN, ACTORCAT_NPC, @@ -27,29 +28,150 @@ const ActorInit En_Onpuman_InitVars = { (ActorFunc)NULL, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80B12390 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 30, 40, 0, { 0, 0, 0 } }, }; -#endif +void EnOnpuman_Init(Actor* thisx, PlayState* play) { + EnOnpuman* this = THIS; -extern ColliderCylinderInit D_80B12390; + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); + this->actor.flags |= ACTOR_FLAG_2000000; + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + this->actor.colChkInfo.mass = MASS_IMMOVABLE; + Actor_SetScale(&this->actor, 0.01f); + this->actor.targetMode = 6; + this->unk_2A4 = 0; + this->unk_2A0 = NULL; + this->actionFunc = func_80B121D8; + this->actor.velocity.y = -10.0f; + this->actor.terminalVelocity = -10.0f; + this->actor.gravity = -5.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Onpuman/EnOnpuman_Init.s") +void EnOnpuman_Destroy(Actor* thisx, PlayState* play) { + EnOnpuman* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Onpuman/EnOnpuman_Destroy.s") + Collider_DestroyCylinder(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Onpuman/func_80B11F44.s") +Actor* func_80B11F44(PlayState* play) { + Actor* itemAction = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Onpuman/func_80B11F78.s") + if (itemAction != NULL) { + if (itemAction->id != ACTOR_EN_GAKUFU) { + itemAction = itemAction->next; + } + return itemAction; + } + return NULL; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Onpuman/func_80B1202C.s") +void func_80B11F78(EnOnpuman* this, PlayState* play) { + if (play->msgCtx.ocarinaMode == 4) { + this->actionFunc = func_80B121D8; + if (this->actor.cutscene != -1) { + ActorCutscene_Stop(this->actor.cutscene); + } + } else if (play->msgCtx.ocarinaMode == 3) { + play_sound(NA_SE_SY_CORRECT_CHIME); + play->msgCtx.ocarinaMode = 4; + if (this->actor.cutscene != -1) { + ActorCutscene_Stop(this->actor.cutscene); + } + this->actionFunc = func_80B121D8; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Onpuman/func_80B1217C.s") +void func_80B1202C(EnOnpuman* this, PlayState* play2) { + PlayState* play = play2; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Onpuman/func_80B121D8.s") + if ((Message_GetState(&play->msgCtx) == 5) && (Message_ShouldAdvance(play))) { + switch (play->msgCtx.currentTextId) { + case 0x8D4: + this->unk_2A4 |= 1; + func_80151938(play, 0x8DA); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Onpuman/EnOnpuman_Update.s") + case 0x8DA: + func_80151938(play, 0x8D6); + if (this->unk_2A0 != NULL) { + this->unk_2A0->home.rot.x = 0x50; + } + break; + + case 0x8D6: + this->actionFunc = func_80B11F78; + func_80152434(play, 0x3A); + if (this->unk_2A0 != NULL) { + this->unk_2A0->home.rot.x = 0; + } + break; + } + } + if (this->unk_2A4 & 1) { + if (this->actor.cutscene == -1) { + this->unk_2A4 &= ~1; + } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { + this->unk_2A4 &= ~1; + ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + } else { + ActorCutscene_SetIntentToPlay(this->actor.cutscene); + } + } +} + +void func_80B1217C(EnOnpuman* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && (Message_ShouldAdvance(play))) { + this->actionFunc = func_80B121D8; + func_801477B4(play); + } +} + +void func_80B121D8(EnOnpuman* this, PlayState* play) { + s16 yaw; + + if (func_800B8718(&this->actor, &play->state)) { + this->actionFunc = func_80B1202C; + Message_StartTextbox(play, 0x8D4, NULL); + this->unk_2A0 = func_80B11F44(play); + } else if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + this->actionFunc = func_80B1217C; + } else { + yaw = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (this->actor.xzDistToPlayer < 200.0f) { + if (ABS_ALT(yaw) <= 0x4300) { + this->actor.textId = 0x8D3; + func_800B8614(&this->actor, play, 100.0f); + func_800B874C(&this->actor, play, 100.0f, 100.0f); + } + } + } +} + +void EnOnpuman_Update(Actor* thisx, PlayState* play) { + s32 pad; + EnOnpuman* this = THIS; + + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + this->actionFunc(this, play); +} diff --git a/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.h b/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.h index fe20760bb2..88cd1e4df2 100644 --- a/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.h +++ b/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.h @@ -8,9 +8,12 @@ struct EnOnpuman; typedef void (*EnOnpumanActionFunc)(struct EnOnpuman*, PlayState*); typedef struct EnOnpuman { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x164]; - /* 0x02A8 */ EnOnpumanActionFunc actionFunc; + /* 0x000 */ Actor actor; + /* 0x144 */ UNK_TYPE1 pad_144[0x110]; + /* 0x254 */ ColliderCylinder collider; + /* 0x2A0 */ Actor* unk_2A0; + /* 0x2A4 */ u16 unk_2A4; // flags + /* 0x2A8 */ EnOnpumanActionFunc actionFunc; } EnOnpuman; // size = 0x2AC extern const ActorInit En_Onpuman_InitVars;