diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index 8c59bdecc1..50eeabaf9c 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -8,7 +8,7 @@ void EnOwl_Destroy(EnOwl* this, GlobalContext* globalCtx); void EnOwl_Update(EnOwl* this, GlobalContext* globalCtx); void EnOwl_Draw(EnOwl* this, GlobalContext* globalCtx); -/* + const ActorInit En_Owl_InitVars = { ACTOR_EN_OWL, ACTORTYPE_NPC, @@ -21,10 +21,221 @@ const ActorInit En_Owl_InitVars = { (ActorFunc)EnOwl_Update, (ActorFunc)EnOwl_Draw, }; -*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Owl/EnOwl_Init.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Owl/EnOwl_Destroy.s") +static InitChainEntry sInitChain[] = { +0xC8500019, 0xB0F40578, 0xB0F807D0, 0x30FC0960 +}; + +static ColliderCylinderInit sColliderInit = { + 0x0A001139, 0x10010000, 0x00000000, 0x00000000, 0x00000000, 0xFFCFFFFF, 0x00000000, 0x00010100, 0x001E0028, 0x00000000, 0x00000000 +}; + +extern SkeletonHeader D_06003F18; +extern SkeletonHeader D_060100B0; +extern AnimationHeader D_060015CC; +extern AnimationHeader D_06003760; + +void func_80ACD0B8(EnOwl* this, ActorFunc, void*, s32, AnimationHeader*, f32); +void func_80ACBA24(EnOwl* this, GlobalContext* globalCtx); +void func_80ACC540(EnOwl* this); +void func_80ACA928(EnOwl* this, GlobalContext* globalCtx); +void func_80ACAB2C(EnOwl* this, GlobalContext* globalCtx); +/* +void SkelAnime_ChangeAnimation(SkelAnime* skelAnime, AnimationHeader* animationseg, f32 playbackSpeed, f32 unk0, + f32 frameCount, u8 unk1, f32 transitionRate);*/ +#define NON_MATCHING +#ifdef NON_MATCHING +void EnOwl_Init(EnOwl* this, GlobalContext* globalCtx, ActorFunc actionFunc, void* arg3, s32 arg4) +{ + u32 sp44; + s32 sp40; + void *sp38; + s32 sp34; + s32 temp_a1; + s32 temp_a3; + s8 temp_v0; + u32 temp_a2; + void *temp_a1_2; + void *temp_v0_2; + u32 phi_a2; + s32 phi_a3; + + Actor_ProcessInitChain(&this->actor, sInitChain); + ActorShape_Init(&this->actor.shape, 0, (void*)0x8003B5EC, 36.0f); + SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06003F18, &D_060015CC, this->drawTbl, this->transitionTbl, 0x15); + SkelAnime_InitSV(globalCtx, &this->skelAnime2, &D_060100B0, &D_06003760, this->drawTbl, this->transitionTbl2, 0x10); + ActorCollider_AllocCylinder(globalCtx, &this->colCylinder); + ActorCollider_InitCylinder(globalCtx, &this->colCylinder, &this->actor, &sColliderInit); + this->actor.sub_98.mass = 0xFF; + this->actor.minVelocityY = -10.0f; + this->actor.unk_4C = 500.0f; + func_80ACD0B8(this, &func_80ACBA24, &func_80ACC540, sp34, &D_06003760, 0.0f); + temp_v0 = 0 & 0xFF; + this->unk_406 = 0; + this->unk_3FC = 0; + this->unk_409 = 0; + this->unk_405 = 4; + this->unk_407 = 0; + this->unk_404 = 0; + this->unk_408 = 4; + phi_a2 = (u32) ((s32) (this->actor.params & 0xFC0) >> 6); + phi_a3 = this->actor.params & 0x3F; + if (this->actor.params != 0xFFF) + { + goto block_2; + } + phi_a2 = 1U; + phi_a3 = 0x20; +block_2: + sp44 = (u32) phi_a2; + sp40 = (s32) phi_a3; + osSyncPrintf(" 会話フクロウ %4x no = %d, sv = %d\n", &this->actor.params, phi_a2, phi_a3); // [36m conversation owl% 4x no =% d, sv =% d \ n [m + temp_a2 = phi_a2; + temp_a3 = phi_a3; + if (temp_a2 == 0) + { + goto block_6; + } + if (temp_a3 >= 0x20) + { + goto block_6; + } + sp44 = temp_a2; + if (Flags_GetSwitch(globalCtx, temp_a3) == 0) + { + goto block_6; + } + osSyncPrintf("savebitでフクロウ退避\n"); // "Escape owl with savebit + Actor_Kill(&this->actor); + return; +block_6: + this->unk_3EE = 0; + this->unk_400 = this->actor.posRot.rot.y; + if ((u32) temp_a2 >= 0xDU) + { + goto block_32; + } + goto **(&jtbl_80ACD7FC + (temp_a2 * 4)); + switch(temp_a2){ + default: + this->unk_40A = 0; + this->actionFunc = sp38; + this->actor.unk_F4 = 4000.0f; + break; + case 1: + this->actionFunc = &func_80ACA928; + break; + case 2: + this->unk_3FC |= 2; + this->unk_3EE = 0x20; + this->actionFunc = &func_80ACAB2C; + break; + case 3: + + + } +case 2: + arg0->unk3FC = (u16) (arg0->unk3FC | 2); + arg0->unk3EE = (u16)0x20; + arg0->unk40C = &func_80ACAB2C; + goto block_33; +case 3: + if (((0x80160000 + 0xE660)->unkEDC & 1) == 0) + { + goto block_13; + } + osSyncPrintf(&D_80ACD694, temp_a2); + Actor_Kill(arg0); + return; +block_13: + arg0->unk40C = &func_80ACACD8; + goto block_33; +case 4: + if (((0x80160000 + 0xE660)->unkEDC & 8) == 0) + { + goto block_16; + } + osSyncPrintf(&D_80ACD6A4, temp_a2); + Actor_Kill(arg0); + return; +block_16: + arg0->unk40C = &func_80ACAE5C; + goto block_33; +case 5: + arg0->unk40C = &func_80ACAFE0; + goto block_33; +case 6: + temp_v0_2 = 0x80160000 + 0xE660; + if ((temp_v0_2->unkEDA & 0x200) != 0) + { + goto block_20; + } + if ((temp_v0_2->unkEDC & 1) != 0) + { + goto block_21; + } +block_20: + osSyncPrintf(&D_80ACD6B4, temp_a2); + Actor_Kill(arg0); + return; +block_21: + arg0->unk40C = &func_80ACB0B0; + goto block_33; +case 7: + arg0->unk40C = &func_80ACB1A0; + Flags_UnsetSwitch(sp54, 0x23, temp_a2); + return; +case 8: + arg0->unk40C = &func_80ACB2B4; + goto block_33; +case 9: + arg0->unk40C = &func_80ACB2B4; + goto block_33; +case 10: + arg0->unk40C = &func_80ACB3E0; + goto block_33; +case 11: + if ((*(void *)0x80127150 & (0x80160000 + 0xE660)->unkA4) != 0) + { + goto block_28; + } + osSyncPrintf(&D_80ACD6C4, temp_a2); + Actor_Kill(arg0); + return; +block_28: + arg0->unk40C = &func_80ACB568; + goto block_33; +case 12: + if ((*(void *)0x80127158 & (0x80160000 + 0xE660)->unkA4) != 0) + { + goto block_31; + } + osSyncPrintf(&D_80ACD6D4, temp_a2); + Actor_Kill(arg0); + return; +block_31: + arg0->unk40C = &func_80ACB6EC; + goto block_33; +block_32: + sp44 = (u32) temp_a2; + osSyncPrintf(&D_80ACD6E4, temp_a2); + osSyncPrintf(&D_80ACD6EC, sp44); + osSyncPrintf(&D_80ACD6F8); + osSyncPrintf(&D_80ACD72C); + arg0->unk3FC = (u16) (arg0->unk3FC | 2); + arg0->unk3EE = (u16)0x20; + arg0->unk40C = &func_80ACA928; +block_33: +} +#else +#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Owl/EnOwl_Init.s") +#endif + +void EnOwl_Destroy(EnOwl* this, GlobalContext* globalCtx) +{ + EnOwl* thisx = this; + ActorCollider_FreeCylinder(globalCtx, &thisx->colCylinder); +} #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Owl/func_80ACA3B8.s") diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.h b/src/overlays/actors/ovl_En_Owl/z_en_owl.h index 7ea9981230..13990bfed8 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.h +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.h @@ -6,7 +6,29 @@ typedef struct { /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x2C8]; + /* 0x014C */ ColliderCylinderMain colCylinder; + /* 0x0198 */ SkelAnime skelAnime; + /* 0x01DC */ Vec3s drawTbl[0x15]; + /* 0x025A */ Vec3s transitionTbl[0x15]; + /* 0x02D8 */ SkelAnime skelAnime2; + /* 0x031C */ Vec3s drawTbl2[0x10]; + /* 0x037C */ Vec3s transitionTbl2[0x10]; + /* 0x03DC */ char unk_3DC[0x12]; + /* 0x03EE */ u16 unk_3EE; + /* 0x03F0 */ char unk_3F0[0xC]; + /* 0x03FC */ u8 unk_3FC; + /* 0x03FD */ char unk_3FD[3]; + /* 0x0400 */ s16 unk_400; + /* 0x0402 */ char unk_402[2]; + /* 0x0404 */ u8 unk_404; + /* 0x0405 */ u8 unk_405; + /* 0x0406 */ u8 unk_406; + /* 0x0407 */ u8 unk_407; + /* 0x0408 */ u8 unk_408; + /* 0x0409 */ u8 unk_409; + /* 0x040A */ s16 unk_40A; + /* 0x040C */ ActorFunc actionFunc; + /* 0x0410 */ void* unk_410; } EnOwl; // size = 0x0414 extern const ActorInit En_Owl_InitVars;