diff --git a/include/functions.h b/include/functions.h index 0bb53fe0c5..be85d86423 100644 --- a/include/functions.h +++ b/include/functions.h @@ -979,7 +979,7 @@ CollisionHeader* BgCheck_GetActorMeshHeader(CollisionContext* colCtx, s32 index) // void func_800C3C94(void); f32 func_800C3D50(s32 arg0, CollisionContext* colCtx, s32 arg2, CollisionPoly** arg3, s32* arg4, Vec3f* pos, Actor* actor, s32 arg7, f32 arg8, s32 arg9); // void func_800C3F40(void); -// void func_800C3FA0(void); +f32 func_800C3FA0(CollisionContext* colCtx, CollisionPoly** arg1, Vec3f* arg2); f32 func_800C4000(GlobalContext* globalCtx, CollisionContext* colCtx, s32* arg2, Vec3f* arg3); // void func_800C4058(void); f32 func_800C40B4(CollisionContext* colCtx, CollisionPoly** arg1, s32* arg2, Vec3f* pos); @@ -2742,7 +2742,7 @@ s32 func_8013E5CC(Vec3f* param_1, Vec3s* param_2, Vec3f* param_3, Vec3f* param_4 // void func_8013E8F8(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7); s32 func_8013E950(Vec3f* param_1, Vec3f* param_2, s16 param_3, Vec3f* param_4, Vec3f* param_5, s16* param_6, s16* param_7, s16* param_8, s16* param_9, u16 param_10, u16 param_11, u16 param_12, u16 param_13); // void func_8013EC10(void); -// void func_8013EC44(void); +void func_8013EC44(f32 arg0, u8 arg1, u8 arg2, u8 arg3); void func_8013ECE0(f32 xyzDistToPlayerSq, u8 arg1, u8 arg2, u8 arg3); void func_8013ED9C(void); void func_8013EDD0(void); @@ -3007,8 +3007,8 @@ void func_80165438(UNK_PTR param_1); // void func_80165608(void); // void func_80165630(void); // void func_80165658(void); -// void func_8016566C(void); -// void func_80165690(void); +void func_8016566C(s32 arg0); +void func_80165690(void); // void func_801656A4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8); // void func_80165DCC(void); // void func_80165DF0(void); @@ -3044,7 +3044,7 @@ void func_80169600(GlobalContext* globalCtx, s16 param_2); // void func_80169668(void); Camera* Play_GetCamera(GlobalContext* globalCtx, s16 index); s32 Play_CameraSetAtEye(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye); -// void func_8016981C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); +void func_8016981C(GlobalContext* globalCtx, s16 arg1, Vec3f* arg2, Vec3f* arg3, Vec3f* arg4); // void func_80169940(void); // void func_80169988(void); void func_801699D4(GlobalContext* globalCtx, s16 arg1, s16 arg2); diff --git a/include/variables.h b/include/variables.h index d7f22e7762..b0b3e5c8c8 100644 --- a/include/variables.h +++ b/include/variables.h @@ -3258,7 +3258,7 @@ extern u8 actorCutsceneWaiting[16]; // extern UNK_TYPE1 D_801F4E08; extern u8 actorCutsceneNextCutscenes[16]; // extern UNK_TYPE1 D_801F4E20; -// extern UNK_TYPE1 D_801F4E30; +extern u8 D_801F4E30; // extern UNK_TYPE1 D_801F4E31; // extern UNK_TYPE1 D_801F4E32; // extern UNK_TYPE1 D_801F4E38; @@ -3920,7 +3920,7 @@ extern UNK_TYPE D_04015FA0; extern UNK_TYPE D_04016360; extern UNK_TYPE D_0401A4D0; extern UNK_TYPE D_0401A538; -extern UNK_TYPE D_0401A620; +extern Gfx D_0401A620[]; extern Gfx D_0401C430[]; extern UNK_TYPE D_0401F740; extern UNK_TYPE D_0401F7C0; @@ -3932,7 +3932,8 @@ extern UNK_TYPE D_04023100; extern UNK_TYPE D_04023130; extern Gfx D_04023210[]; extern UNK_TYPE D_04023288; -extern UNK_TYPE D_04023348; +extern Gfx D_04023348[]; +extern Gfx D_04023428[]; extern UNK_TYPE D_04025850; extern UNK_TYPE D_04025DD0; extern UNK_TYPE D_040281DC; diff --git a/spec b/spec index 4eb2b0eb64..e09614dbe0 100644 --- a/spec +++ b/spec @@ -2548,9 +2548,11 @@ beginseg name "ovl_Boss_02" compress include "build/src/overlays/actors/ovl_Boss_02/z_boss_02.o" - include "build/data/ovl_Boss_02/ovl_Boss_02.data.o" - include "build/data/ovl_Boss_02/ovl_Boss_02.bss.o" - include "build/data/ovl_Boss_02/ovl_Boss_02.reloc.o" + #ifdef NON_MATCHING + include "build/src/overlays/actors/ovl_Boss_02/ovl_Boss_02_reloc.o" + #else + include "build/data/ovl_Boss_02/ovl_Boss_02.reloc.o" + #endif endseg beginseg diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index df36e8e2d8..6b3c944f4b 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -5,6 +5,8 @@ */ #include "z_boss_02.h" +#include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" +#include "overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h" #define FLAGS 0x00000035 @@ -15,12 +17,59 @@ void Boss02_Destroy(Actor* thisx, GlobalContext* globalCtx); void Boss02_Update(Actor* thisx, GlobalContext* globalCtx); void Boss02_Draw(Actor* thisx, GlobalContext* globalCtx); +void func_809DAA74(Boss02* this, GlobalContext* globalCtx); void func_809DAA98(Boss02* this, GlobalContext* globalCtx); +void func_809DAAA8(Boss02* this, GlobalContext* globalCtx); void func_809DAB78(Boss02* this, GlobalContext* globalCtx); +void func_809DC218(Actor* thisx, GlobalContext* globalCtx); +void func_809DC78C(Actor* thisx, GlobalContext* globalCtx); +void func_809DD0A8(Actor* thisx, GlobalContext* globalCtx); +void func_809DD0CC(GlobalContext* globalCtx); +void func_809DD2F8(GlobalContext* globalCtx); +void func_809DD934(Boss02* this, GlobalContext* globalCtx); +void func_809DEAC4(Boss02* this, GlobalContext* globalCtx); -#if 0 -// static DamageTable sDamageTable = { -static DamageTable D_809DF550 = { +extern Gfx D_06000230[]; +extern Gfx D_060002E0[]; +extern UNK_TYPE D_060003A0; +extern UNK_TYPE D_060041A0; +extern UNK_TYPE D_06008650; +extern SkeletonHeader D_06009B10; +extern AnimationHeader D_06009C78; +extern Gfx D_0600ECF0[]; +extern Gfx D_0600EF90[]; +extern Gfx D_0600F310[]; +extern Gfx D_0600F690[]; +extern Gfx D_0600FA10[]; +extern Gfx D_0600FD90[]; +extern Gfx D_06010110[]; +extern Gfx D_06010490[]; +extern Gfx D_06010810[]; +extern Gfx D_06010B90[]; +extern Gfx D_06010F10[]; +extern Gfx D_06011290[]; +extern Gfx D_06011610[]; +extern Gfx D_06011990[]; +extern Gfx D_06011D10[]; +extern Gfx D_06012090[]; +extern Gfx D_06012410[]; +extern Gfx D_06012790[]; +extern Gfx D_06012B10[]; +extern Gfx D_06012E90[]; +extern Gfx D_06013210[]; +extern Gfx D_06013590[]; + +static u8 D_809E0420; +static u8 D_809E0421; +static u8 D_809E0422; +static Boss02* D_809E0424; +static Boss02* D_809E0428; +static Boss02* D_809E042C; +static u8 D_809E0430; +static DoorWarp1* D_809E0434; +static Boss02Effects D_809E0438[150]; + +static DamageTable sDamageTable1 = { /* Deku Nut */ DMG_ENTRY(0, 0x0), /* Deku Stick */ DMG_ENTRY(1, 0xF), /* Horse trample */ DMG_ENTRY(0, 0x0), @@ -55,8 +104,7 @@ static DamageTable D_809DF550 = { /* Powder Keg */ DMG_ENTRY(1, 0xF), }; -// static DamageTable sDamageTable = { -static DamageTable D_809DF570 = { +static DamageTable sDamageTable2 = { /* Deku Nut */ DMG_ENTRY(0, 0x0), /* Deku Stick */ DMG_ENTRY(1, 0xF), /* Horse trample */ DMG_ENTRY(0, 0x0), @@ -103,186 +151,2144 @@ const ActorInit Boss_02_InitVars = { (ActorFunc)Boss02_Draw, }; -// static ColliderJntSphElementInit sJntSphElementsInit[22] = { -static ColliderJntSphElementInit D_809DF614[22] = { +static f32 D_809DF5B0 = 1.0f; + +static s16 D_809DF5B4[] = { + 0, 195, 190, 185, 180, 175, 170, 165, 160, 155, 150, 145, 140, 135, 130, 125, 120, 115, 110, 105, 100, 95, 90, 0, +}; + +static s16 D_809DF5E4[] = { + 0, 196, 192, 188, 184, 180, 176, 172, 168, 164, 160, 156, 152, 148, 144, 140, 136, 132, 128, 124, 120, 116, 112, +}; + +static ColliderJntSphElementInit sJntSphElementsInit1[22] = { { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 1, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 2, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 3, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 4, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 5, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 6, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 7, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 8, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 9, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 10, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 11, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 12, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 13, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 14, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 15, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 16, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 17, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 18, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 19, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 20, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 21, { { 0, 0, 0 }, 85 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 0, { { 0, 0, 0 }, 130 }, 100 }, }, }; -// static ColliderJntSphInit sJntSphInit = { -static ColliderJntSphInit D_809DF92C = { - { COLTYPE_METAL, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_PLAYER, OC2_TYPE_1, COLSHAPE_JNTSPH, }, - 22, D_809DF614, // sJntSphElementsInit, +static ColliderJntSphInit sJntSphInit1 = { + { + COLTYPE_METAL, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_HARD | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_PLAYER, + OC2_TYPE_1, + COLSHAPE_JNTSPH, + }, + 22, + sJntSphElementsInit1, }; -// static ColliderJntSphElementInit sJntSphElementsInit[2] = { -static ColliderJntSphElementInit D_809DF93C[2] = { +static ColliderJntSphElementInit sJntSphElementsInit2[2] = { { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 0, { { 0, 0, 0 }, 130 }, 100 }, }, { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 22, { { 0, 0, 0 }, 110 }, 100 }, }, }; -// static ColliderJntSphInit sJntSphInit = { -static ColliderJntSphInit D_809DF984 = { - { COLTYPE_HIT0, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_PLAYER, OC2_TYPE_1, COLSHAPE_JNTSPH, }, - 2, D_809DF93C, // sJntSphElementsInit, +static ColliderJntSphInit sJntSphInit2 = { + { + COLTYPE_HIT0, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_PLAYER, + OC2_TYPE_1, + COLSHAPE_JNTSPH, + }, + 2, + sJntSphElementsInit2, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_809DF994 = { - { COLTYPE_METAL, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x04, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_METAL, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_HARD | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK2, + { 0xF7CFFFFF, 0x04, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 150, 200, 0, { 0, 0, 0 } }, }; +static Vec3f D_809DF9C0[] = { + { 0.0f, -200.0f, 1000.0f }, { 0.0f, 500.0f, 1000.0f }, { 0.0f, 1000.0f, 1000.0f }, + { 1000.0f, 500.0f, 1000.0f }, { 1000.0f, 1000.0f, -1000.0f }, { -1000.0f, 500.0f, -1000.0f }, + { -1000.0f, 500.0f, 1000.0f }, { -1000.0f, -1000.0f, -1000.0f }, { -1000.0f, -1000.0f, -1000.0f }, +}; + +static Vec3f D_809DFA2C[] = { + { 0.0f, -200.0f, -800.0f }, { 0.0f, 800.0f, -800.0f }, { 800.0f, 300.0f, -800.0f }, + { -800.0f, 800.0f, 0.0f }, { -800.0f, -1000.0f, 0.0f }, { -800.0f, -1000.0f, 0.0f }, + { -800.0f, -1000.0f, 0.0f }, { -800.0f, -1000.0f, 0.0f }, { -800.0f, -1000.0f, 0.0f }, +}; + +void func_809DA1D0(GlobalContext* globalCtx, u8 arg1, u8 arg2, u8 arg3, u8 arg4) { + MREG(64) = 1; + MREG(65) = arg1; + MREG(66) = arg2; + MREG(67) = arg3; + MREG(68) = arg4; +} + +void func_809DA22C(GlobalContext* globalCtx, u8 arg1) { + MREG(68) = arg1; +} + +void func_809DA24C(GlobalContext* globalCtx) { + MREG(64) = 0; +} + +void func_809DA264(Boss02Effects* effects, Vec3f* vec, f32 arg2) { + s16 i; + + for (i = 0; i < ARRAY_COUNT(D_809E0438); i++, effects++) { + if (effects->unk_24 == 0) { + effects->unk_24 = 1; + effects->unk_00 = *vec; + effects->unk_0C.x = randPlusMinusPoint5Scaled(30.0f); + effects->unk_0C.y = Rand_ZeroFloat(7.0f) + 7.0f; + effects->unk_0C.z = randPlusMinusPoint5Scaled(30.0f); + effects->unk_18.y = -0.3f; + effects->unk_34 = arg2; + effects->unk_2C = 255; + effects->unk_26 = 0; + effects->unk_38 = 2.0f * arg2; + effects->unk_18.x = effects->unk_18.z = 0.0f; + break; + } + } +} + +void func_809DA344(Boss02Effects* effects, Vec3f* vec) { + s16 i; + + for (i = 0; i < ARRAY_COUNT(D_809E0438); i++, effects++) { + if (effects->unk_24 == 0) { + effects->unk_24 = 3; + effects->unk_00 = *vec; + effects->unk_26 = Rand_ZeroFloat(20.0f); + effects->unk_0C.x = randPlusMinusPoint5Scaled(50.0f); + effects->unk_0C.y = randPlusMinusPoint5Scaled(50.0f); + effects->unk_0C.z = randPlusMinusPoint5Scaled(50.0f); + effects->unk_18.z = 0.0f; + effects->unk_18.x = 0.0f; + effects->unk_18.y = -1.5f; + effects->unk_34 = Rand_ZeroFloat(0.04f) + 0.02f; + effects->unk_30 = Rand_ZeroFloat(32767.0f); + effects->unk_2E = Rand_ZeroFloat(32767.0f); + break; + } + } +} + +void func_809DA460(Boss02Effects* effects, Vec3f* vec) { + s16 i; + + for (i = 0; i < ARRAY_COUNT(D_809E0438); i++, effects++) { + if ((effects->unk_24 == 0) || (effects->unk_24 == 3)) { + effects->unk_24 = 4; + effects->unk_00 = *vec; + Math_Vec3f_Copy(&effects->unk_0C, &D_801D15B0); + Math_Vec3f_Copy(&effects->unk_18, &D_801D15B0); + effects->unk_2C = 0xFF; + effects->unk_34 = 0.0f; + break; + } + } +} + +void func_809DA50C(s32 arg0, ColliderJntSph* collider, Vec3f* arg2) { + collider->elements[arg0].dim.worldSphere.center.x = arg2->x; + collider->elements[arg0].dim.worldSphere.center.y = arg2->y; + collider->elements[arg0].dim.worldSphere.center.z = arg2->z; + collider->elements[arg0].dim.worldSphere.radius = + collider->elements[arg0].dim.modelSphere.radius * collider->elements[arg0].dim.scale * D_809DF5B0; +} + +void Boss02_Init(Actor* thisx, GlobalContext* globalCtx) { + Boss02* this = THIS; + s32 i; + s32 pad[2]; + + if ((gSaveContext.weekEventReg[52] & 0x20) && (this->actor.params == 0)) { + D_809E0434 = (DoorWarp1*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, + 0.0f, 60.0f, 0.0f, 0, 0, 0, 1); + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, 0.0f, 30.0f, -150.0f, 0, 1, 0, 0); + } + + this->actor.targetMode = 10; + this->unk_1D3C.z = this->unk_1D3C.x = 0.0f; + this->unk_1D3C.y = 1.0f; + if (this->actor.params == 200) { + D_809E042C = this; + globalCtx->specialEffects = (void*)D_809E0438; + this->actor.update = func_809DC78C; + this->actor.draw = func_809DD0A8; + this->actor.flags &= ~1; + this->unk_1D70 = 0.00999999977648f; + if ((KREG(64) != 0) || (gSaveContext.eventInf[5] & 0x20) || (D_809E0434 != NULL)) { + this->unk_1D20 = 0; + D_809E0430 = KREG(15) + 20; + } else { + this->unk_1D20 = 1; + } + XREG(41) = KREG(14) + 20; + this->unk_01AC = 1.0f; + Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_TANRON5, 0.0f, 1000.0f, 0.0f, 0, 0, + 0, 0); + } else if (this->actor.params == 100) { + this->actor.update = func_809DC218; + this->actor.draw = NULL; + this->actor.hintId = 0x2E; + } else { + if (this->actor.params != 35) { + this->actor.params = 0; + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BOSS_02, 0.0f, 0.0f, 0.0f, 0, 0, 0, 200); + D_809E0424 = this; + D_809E0428 = (Boss02*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BOSS_02, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, + this->actor.world.rot.y, this->actor.world.rot.z, 35); + D_809E0424->actor.colChkInfo.damageTable = &sDamageTable2; + D_809E0428->actor.colChkInfo.damageTable = &sDamageTable1; + D_809E0424->unk_1674 = D_809E0428; + D_809E0428->unk_1674 = D_809E0424; + } + + this->actor.colChkInfo.mass = MASS_HEAVY; + this->actor.colChkInfo.health = 20; + Actor_SetScale(&this->actor, 0.01f); + SkelAnime_Init(globalCtx, &this->skelAnime, &D_06009B10, &D_06009C78, this->jointTable, this->morphTable, 13); + Collider_InitAndSetJntSph(globalCtx, &this->colliderSphere1, &this->actor, &sJntSphInit1, + this->colliderSphere1Elements); + Collider_InitAndSetJntSph(globalCtx, &this->colliderSphere2, &this->actor, &sJntSphInit2, + this->colliderSphere2Elements); + Collider_InitAndSetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit); + + if (D_809E0434 != NULL) { + func_809DAA74(this, globalCtx); + } else { + func_809DAAA8(this, globalCtx); + } + + for (i = 0; i < ARRAY_COUNT(this->unk_01BC); i++) { + this->unk_01BC[i].x = this->actor.world.pos.x; + this->unk_01BC[i].y = this->actor.world.pos.y; + this->unk_01BC[i].z = this->actor.world.pos.z; + } + + this->unk_014C = Rand_ZeroFloat(1000.0f); + this->unk_1678 = 22; + Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_02, 0.0f, 0.0f, 0.0f, 0, 0, 0, + 100); + } +} + +void Boss02_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} + +void func_809DAA74(Boss02* this, GlobalContext* globalCtx) { + this->actionFunc = func_809DAA98; + this->actor.world.pos.y = -3000.0f; +} + +void func_809DAA98(Boss02* this, GlobalContext* globalCtx) { +} + +void func_809DAAA8(Boss02* this, GlobalContext* globalCtx) { + this->actionFunc = func_809DAB78; + Animation_MorphToLoop(&this->skelAnime, &D_06009C78, 0.0f); + if (D_809E042C->unk_1D20 != 0) { + this->unk_0144 = 10; + } else { + this->unk_0144 = 100; + this->unk_01A8 = 25.0f; + D_809E042C->unk_1D7E = 100; + this->actor.world.pos.x = 0.0f; + if (D_809E0424 == this) { + this->actor.world.pos.z = -1000.0f; + } else { + this->actor.world.pos.z = 1400.0f; + } + } + this->actor.world.pos.y = -500.0f; +} + +#ifdef NON_MATCHING +// Saving to spC8 rather than spC4 at line 18dc +void func_809DAB78(Boss02* this, GlobalContext* globalCtx) { + static Color_RGBA8 D_809DFA98 = { 185, 140, 70, 255 }; + s32 pad; + Player* player = GET_PLAYER(globalCtx); + CollisionPoly* spDC; + Vec3f spD0; + f32 spCC; + f32 spC8; + f32 spC4; + s32 i; + f32 temp_f0; + f32 phi_f2; + s16 temp_s0; + s16 temp_s2; + Boss02* spB0 = this->unk_1674; + Vec3f spA4; + f32 spA0; + f32 sp9C; + Vec3f sp90; + CollisionPoly* sp8C; + s32 sp88; + Vec3f sp7C; + Vec3f sp70; + Vec3f sp64; + + spCC = this->unk_01B0.x - this->actor.world.pos.x; + spC8 = this->unk_01B0.y - this->actor.world.pos.y; + spC4 = this->unk_01B0.z - this->actor.world.pos.z; + + if ((this->unk_0144 != 10) && (this->unk_0144 <= 20)) { + SkelAnime_Update(&this->skelAnime); + temp_s0 = Math_Atan2S(spCC, spC4); + temp_s2 = Math_Atan2S(spC8, sqrtf(SQ(spCC) + SQ(spC4))); + Math_ApproachS(&this->actor.world.rot.y, temp_s0, 0x14, this->unk_0164); + Math_ApproachS(&this->actor.shape.rot.x, temp_s2, 0x14, this->unk_0164); + Math_ApproachS(&this->unk_0198, this->unk_019A, 1, 0x20); + this->unk_0196 += this->unk_0198; + Math_ApproachF(&this->unk_019C, this->unk_01A0, 0.1f, 100.0f); + this->unk_01A4 = Math_SinS(this->unk_0196) * this->unk_019C; + this->actor.world.rot.x = this->actor.shape.rot.x + this->unk_01A4; + + if (!(this->unk_014C & 0x1F) && (D_809E042C->unk_1D20 == 0)) { + this->unk_01A0 = Rand_ZeroFloat(0x1000) + 0x800; + this->unk_019A = Rand_ZeroFloat(0x400) + 0x200; + } + + if (this->unk_0195 != 0) { + Math_ApproachF(&this->unk_0164, this->unk_0168 * 1.25f, 1.0f, 62.5f); + } else { + Math_ApproachF(&this->unk_0164, this->unk_0168, 1.0f, 50.0f); + } + + this->unk_0168 = 2000.0f; + if (this->unk_0195 != 0) { + this->actor.speedXZ = this->unk_01A8 * D_809DF5B0 * 1.25f; + this->skelAnime.playSpeed = 2.0f; + } else { + this->actor.speedXZ = this->unk_01A8 * D_809DF5B0; + } + + Actor_SetVelocityXYRotation(&this->actor); + Actor_ApplyMovement(&this->actor); + + spD0 = this->actor.world.pos; + if (D_809E0422 != 0) { + spD0.y = 5000.0f; + } else { + spD0.y = 2000.0f; + } + + temp_f0 = func_800C3FA0(&globalCtx->colCtx, &spDC, &spD0); + if (((this->unk_017C.y < temp_f0) && (temp_f0 <= this->unk_0188.y)) || + ((temp_f0 < this->unk_017C.y) && (this->unk_0188.y <= temp_f0))) { + this->unk_0170 = this->unk_017C; + this->unk_0170.y = temp_f0; + this->unk_016C = 120; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_INBOSS_ROAR_OLD); + } + + this->actor.flags &= ~1; + if (this->unk_0195 != 0) { + this->actor.world.rot.z = Math_SinS(this->unk_014C * 0x1200) * 0xE00; + } else { + this->actor.world.rot.z = Math_SinS(this->unk_014C * 0xC00) * 0xE00; + } + + this->unk_014E++; + if (this->unk_014E >= ARRAY_COUNT(this->unk_01BC)) { + this->unk_014E = 0; + } + + this->unk_01BC[this->unk_014E].x = this->actor.world.pos.x; + this->unk_01BC[this->unk_014E].y = this->actor.world.pos.y; + this->unk_01BC[this->unk_014E].z = this->actor.world.pos.z; + + this->unk_0B1C[this->unk_014E].x = BINANG_TO_RAD(this->actor.world.rot.x); + this->unk_0B1C[this->unk_014E].y = BINANG_TO_RAD(this->actor.world.rot.y); + this->unk_0B1C[this->unk_014E].z = BINANG_TO_RAD(this->actor.world.rot.z); + } + + if ((this->unk_0144 < 10) && (spB0->unk_0144 >= 20)) { + this->unk_01B0.y = -1000.0f * D_809DF5B0; + if (D_809E0422 != 0) { + this->unk_01B0.y += 3150.0f; + } + this->unk_0144 = 3; + this->unk_0146[0] = 50; + } + + switch (this->unk_0144) { + default: + return; + + case 0: + if ((this->actor.params == 0) && (Rand_ZeroOne() < 0.75f)) { + this->actor.world.pos.x = player->actor.world.pos.x; + this->actor.world.pos.z = player->actor.world.pos.z; + this->actor.world.pos.y = player->actor.world.pos.y - (600.0f * D_809DF5B0); + } else { + this->actor.world.pos.x = randPlusMinusPoint5Scaled(5000.0f * D_809DF5B0); + this->actor.world.pos.z = randPlusMinusPoint5Scaled(5000.0f * D_809DF5B0); + this->actor.world.pos.y = -500.0f * D_809DF5B0; + if (D_809E0422 != 0) { + this->actor.world.pos.y += 3150.0f; + } + } + + if ((fabsf(this->actor.world.pos.x) < (500.0f * D_809DF5B0)) && + (fabsf(this->actor.world.pos.z) < (500.0f * D_809DF5B0))) { + return; + } + + case 100: + this->actor.shape.rot.x = 0x4000; + this->unk_01B0.x = this->actor.world.pos.x; + this->unk_01B0.y = this->actor.world.pos.y + (1000.0f * D_809DF5B0); + this->unk_01B0.z = this->actor.world.pos.z; + this->unk_0146[0] = 100; + this->unk_0144 = 1; + + case 1: + if (this->unk_0146[0] == 0) { + if (Rand_ZeroOne() < 0.3f) { + this->unk_0144 = 5; + this->unk_0146[0] = 150; + } else { + this->unk_0144 = 2; + this->unk_01B0.x = randPlusMinusPoint5Scaled(3000.0f * D_809DF5B0); + this->unk_01B0.z = randPlusMinusPoint5Scaled(3000.0f * D_809DF5B0); + if ((fabsf(this->unk_01B0.x) < (500.0f * D_809DF5B0)) && + (fabsf(this->unk_01B0.z) < (500.0f * D_809DF5B0))) { + this->unk_01B0.x = 500.0f; + this->unk_01B0.z = 500.0f; + } + this->unk_01B0.y = Rand_ZeroFloat(800.0f * D_809DF5B0) + (200.0f * D_809DF5B0); + if (D_809E0422 != 0) { + this->unk_01B0.y += 3150.0f; + } + } + this->unk_0164 = 0.0f; + } + return; + + case 2: + if (this->unk_0195 != 0) { + phi_f2 = 700.0f; + } else { + phi_f2 = 500.0f; + } + if (sqrtf(SQ(spCC) + SQ(spC8) + SQ(spC4)) < (phi_f2 * D_809DF5B0)) { + this->unk_0144 = 3; + this->unk_01B0.y = -3000.0f * D_809DF5B0; + if (D_809E0422 != 0) { + this->unk_01B0.y += 3150.0f; + } + this->unk_0146[0] = 150; + this->unk_0164 = 0.0f; + } + return; + + case 3: + if (this->unk_0146[0] == 0) { + this->unk_0144 = 0; + } + return; + + case 5: + this->unk_01B0.x = player->actor.world.pos.x; + this->unk_01B0.y = player->actor.world.pos.y + (100.0f * D_809DF5B0); + this->unk_01B0.z = player->actor.world.pos.z; + if (this->unk_0146[0] == 0) { + this->unk_0144 = 3; + this->unk_01B0.x = randPlusMinusPoint5Scaled(500.0f * D_809DF5B0) + this->actor.world.pos.x; + this->unk_01B0.y = -3000.0f * D_809DF5B0; + if (D_809E0422 != 0) { + this->unk_01B0.y += 3150.0f; + } + this->unk_01B0.z = randPlusMinusPoint5Scaled(500.0f * D_809DF5B0) + this->actor.world.pos.z; + this->unk_0146[0] = 150; + this->unk_0164 = 0.0f; + } + return; + + case 10: + if (this->unk_1678 != 0) { + this->unk_019A = 0x500; + this->unk_01A0 = 0x1200; + } else { + this->colliderCylinder.dim.radius = 150.0f * D_809DF5B0; + this->colliderCylinder.dim.height = 200.0f * D_809DF5B0; + this->colliderCylinder.dim.yShift = 0; + Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + } + return; + + case 11: + if (this == D_809E0424) { + this->unk_01B0.x = D_809DF9C0[this->unk_1D1A].x; + this->unk_01B0.y = D_809DF9C0[this->unk_1D1A].y; + this->unk_01B0.z = D_809DF9C0[this->unk_1D1A].z; + } else { + this->unk_01B0.x = D_809DFA2C[this->unk_1D1A].x; + this->unk_01B0.y = D_809DFA2C[this->unk_1D1A].y; + this->unk_01B0.z = D_809DFA2C[this->unk_1D1A].z; + } + this->actor.shape.rot.x = 0x4000; + this->unk_0144 = 12; + this->actor.world.pos.x = this->unk_01B0.x; + this->actor.world.pos.y = -200.0f; + this->actor.world.pos.z = this->unk_01B0.z; + this->unk_01A8 = 25.0f; + return; + + case 12: + if (sqrtf(SQ(spCC) + SQ(spC8) + SQ(spC4)) < 500.0f) { + this->unk_1D1A++; + this->unk_0164 = 0.0f; + if (this->unk_1D1A > 8) { + this->unk_1D1A = 8; + } + if (this == D_809E0424) { + this->unk_01B0.x = D_809DF9C0[this->unk_1D1A].x; + this->unk_01B0.y = D_809DF9C0[this->unk_1D1A].y; + this->unk_01B0.z = D_809DF9C0[this->unk_1D1A].z; + } else { + this->unk_01B0.x = D_809DFA2C[this->unk_1D1A].x; + this->unk_01B0.y = D_809DFA2C[this->unk_1D1A].y; + this->unk_01B0.z = D_809DFA2C[this->unk_1D1A].z; + } + } + return; + + case 20: + this->unk_0152 = 15; + if ((s16)(BREG(71) + 140) < this->unk_0146[1]) { + if (this->unk_0146[0] == 0) { + Matrix_RotateY(Math_Atan2S(-player->actor.world.pos.x, -player->actor.world.pos.z), MTXMODE_NEW); + Matrix_GetStateTranslationAndScaledZ(1500.0f * D_809DF5B0, &spA4); + this->unk_0146[0] = 50; + this->unk_01B0.x = player->actor.world.pos.x + spA4.x; + this->unk_01B0.y = randPlusMinusPoint5Scaled(500.0f * D_809DF5B0) + (600.0f * D_809DF5B0); + if (D_809E0422 != 0) { + this->unk_01B0.y += 3150.0f; + } + this->unk_01B0.z = player->actor.world.pos.z + spA4.z; + } + this->unk_0168 = 3000.0f; + } else { + this->unk_01B0.y += 10.0f * D_809DF5B0; + this->unk_0168 = 5000.0f; + } + this->unk_019A = 0x1000; + this->unk_01A8 = 25.0f; + this->unk_01A0 = 0x1800; + if (this->unk_0146[1] == 0) { + this->unk_015C = 1; + this->unk_0144 = 21; + this->unk_0146[0] = 20; + this->unk_0152 = 0; + D_809E042C->unk_1D20 = 102; + D_809E042C->unk_1D5C = 0.0f; + play_sound(NA_SE_EN_INBOSS_DEAD_PRE2_OLD); + } else if (!(this->unk_0146[1] & 0xF) && (Rand_ZeroOne() < 0.5f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_INBOSS_DAMAGE_OLD); + } + return; + + case 21: + this->unk_01A8 = 0.0f; + this->actor.speedXZ = 0.0f; + if (this->unk_0146[0] == 0) { + this->unk_0146[0] = 3; + + for (i = 0; i < 35; i++) { + func_809DA344(globalCtx->specialEffects, &this->unk_147C[this->unk_1678]); + } + + func_809DA460(globalCtx->specialEffects, &this->unk_147C[this->unk_1678]); + play_sound(NA_SE_EV_EXPLOSION); + + this->unk_1678--; + if (this->unk_1678 <= 0) { + this->unk_0144 = 22; + this->actor.gravity = -1.0f * D_809DF5B0; + this->actor.velocity.y = 0.0f; + this->actor.minVelocityY = -1000.0f * D_809DF5B0; + this->unk_0164 = randPlusMinusPoint5Scaled(0.05f); + + spC4 = player->actor.world.pos.x - this->actor.world.pos.x; + spC8 = player->actor.world.pos.z - this->actor.world.pos.z; + if (sqrtf(SQ(spC4) + SQ(spC8)) < (400.0f * D_809DF5B0)) { + this->actor.speedXZ = 15.0f * D_809DF5B0; + } + + spC4 = this->actor.world.pos.x; + spC8 = this->actor.world.pos.z; + if (sqrtf(SQ(spC4) + SQ(spC8)) < (400.0f * D_809DF5B0)) { + this->actor.speedXZ = 15.0f * D_809DF5B0; + } + + if (spB0->unk_0144 >= 10) { + Audio_QueueSeqCmd(0x8021); + } + + Audio_PlayActorSound2(&this->actor, NA_SE_EN_INBOSS_DEAD_OLD); + } + } + return; + + case 22: + i = (this->unk_014E + 196) % ARRAY_COUNT(this->unk_01BC); + + Math_Vec3f_Copy(&this->unk_01BC[i], &this->actor.world.pos); + this->unk_0B1C[i].y += this->unk_0164; + Math_ApproachF(&this->unk_0B1C[i].x, -(M_PI / 2), 0.1f, 0.07f); + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 150.0f, 100.0f, 4); + + if (this->actor.bgCheckFlags & 1) { + this->unk_0144 = 23; + this->actor.speedXZ = 0.0f; + this->unk_0170 = this->unk_017C; + this->unk_016C = 30; + this->unk_0170.y = this->actor.floorHeight; + D_809E042C->unk_1D20 = 103; + D_809E042C->unk_1D1C = 0; + D_809E042C->unk_0146[0] = 15; + D_809E042C->unk_0150 = 0; + play_sound(NA_SE_EV_LIGHTNING); + + for (i = 0; i < 30; i++) { + func_809DA344(globalCtx->specialEffects, &this->unk_0170); + } + + this->unk_0146[0] = 10; + } + break; + + case 23: + i = (this->unk_014E + 196) % ARRAY_COUNT(this->unk_01BC); + Math_Vec3f_Copy(&this->unk_01BC[i], &this->actor.world.pos); + Math_ApproachF(&this->unk_0B1C[i].x, -(M_PI / 2), 0.05f, 0.07f); + + if (this->unk_0146[0] & 1) { + sp9C = Rand_ZeroFloat(M_PI); + + for (i = 0; i < 15; i++) { + Matrix_InsertYRotation_f(((2.0f * (i * M_PI)) / 15.0f) + sp9C, 0); + Matrix_GetStateTranslationAndScaledZ((10 - this->unk_0146[0]) * (D_809DF5B0 * 300.0f) * 0.1f, + &sp90); + spD0.x = this->unk_0170.x + sp90.x; + spD0.y = this->unk_0170.y + (1000.0f * D_809DF5B0); + spD0.z = this->unk_0170.z + sp90.z; + if (func_800C40B4(&globalCtx->colCtx, &sp8C, &sp88, &spD0) != BGCHECK_Y_MIN) { + spA0 = func_800C3FA0(&globalCtx->colCtx, &sp8C, &spD0); + Matrix_GetStateTranslationAndScaledZ(5.0f * D_809DF5B0, &sp70); + sp70.y = 2.0f * D_809DF5B0; + sp64.y = 0.3f * D_809DF5B0; + sp64.z = 0.0f; + sp64.x = 0.0f; + sp7C.x = spD0.x; + sp7C.y = spA0; + sp7C.z = spD0.z; + func_800B0F18(globalCtx, &sp7C, &sp70, &sp64, &D_809DFA98, &D_809DFA98, + (Rand_ZeroFloat(500.0f) + 1200.0f) * D_809DF5B0, 20.0f * D_809DF5B0, + Rand_ZeroFloat(5.0f) + 14.0f); + } + } + } + } + + this->colliderCylinder.dim.radius = 150.0f * D_809DF5B0; + this->colliderCylinder.dim.height = 200.0f * D_809DF5B0; + this->colliderCylinder.dim.yShift = 0; + Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); +} +#else +static Color_RGBA8 D_809DFA98 = { 185, 140, 70, 255 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DAB78.s") #endif -extern DamageTable D_809DF550; -extern DamageTable D_809DF570; -extern ColliderJntSphElementInit D_809DF614[22]; -extern ColliderJntSphInit D_809DF92C; -extern ColliderJntSphElementInit D_809DF93C[2]; -extern ColliderJntSphInit D_809DF984; -extern ColliderCylinderInit D_809DF994; +void func_809DBFB4(Boss02* this, GlobalContext* globalCtx) { + Boss02* temp_s6 = this->unk_1674; + s32 temp; + s32 i; + u8 damage; -extern UNK_TYPE D_060002E0; -extern UNK_TYPE D_060003A0; -extern UNK_TYPE D_06008650; -extern UNK_TYPE D_06009C78; + if (this->unk_0154 == 0) { + if (D_809E0422 != 0) { + temp = 0; + } else { + temp = 1; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DA1D0.s") + for (i = temp; i < ARRAY_COUNT(this->colliderSphere2Elements); i++) { + if (this->colliderSphere2.elements[i].info.bumperFlags & BUMP_HIT) { + this->colliderSphere2.elements[i].info.bumperFlags &= ~BUMP_HIT; + this->unk_0154 = 15; + this->unk_0156 = 15; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DA22C.s") + if (i == 0) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_INBOSS_DAMAGE_OLD); + this->unk_015C = 1; + } else { + func_8019F1C0(&this->unk_167C, NA_SE_EN_INBOSS_DAMAGE_OLD); + this->unk_015C = 10; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DA24C.s") + if (D_809E0422 != 0) { + this->unk_0152 = 15; + } else { + this->unk_0152 = 12; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DA264.s") + damage = this->actor.colChkInfo.damage; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DA344.s") + if (temp_s6->unk_0144 < 20) { + do { + do { + this->actor.colChkInfo.health -= damage; + } while (0); + } while (0); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DA460.s") + if ((s8)this->actor.colChkInfo.health <= 0) { + Actor_MarkForDeath(this->actor.child); + this->actor.child = NULL; + Enemy_StartFinishingBlow(globalCtx, &this->actor); + this->skelAnime.playSpeed = 2.0f; + this->unk_0144 = 20; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DA50C.s") + if (temp_s6->unk_0144 >= 10) { + Audio_QueueSeqCmd(0x100100FF); + } else { + temp_s6->unk_0195 = 1; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/Boss02_Init.s") + this->unk_0146[1] = BREG(70) + 170; + this->unk_0146[0] = 0; + this->actor.shape.rot.x = 0x4000; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/Boss02_Destroy.s") + if (D_809E0422 == 0) { + if (this->actor.world.pos.y < -200.0f) { + this->actor.world.pos.y = -200.0f; + } + } else if (this->actor.world.pos.y < 3130.0f) { + this->actor.world.pos.y = 3130.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DAA74.s") + D_809E042C->unk_1D20 = 100; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DAA98.s") + if (this == D_809E0424) { + D_809E042C->unk_0194 = 0; + } else { + D_809E042C->unk_0194 = 1; + } + } + } + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DAAA8.s") +void func_809DC218(Actor* thisx, GlobalContext* globalCtx) { + Boss02* this = THIS; + s32 pad; + Vec3f sp24; + CollisionPoly* sp20; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DAB78.s") + this->unk_014C++; + if ((this->unk_014C + this->actor.params) & 1) { + sp24 = this->actor.world.pos; + this->actor.focus.pos = this->actor.world.pos; + if (D_809E0422 != 0) { + sp24.y = 5000.0f; + } else { + sp24.y = 2000.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DBFB4.s") + if ((this->actor.focus.pos.y < func_800C3FA0(&globalCtx->colCtx, &sp20, &sp24)) || (D_809E0422 != 0)) { + this->actor.flags &= ~1; + } else { + this->actor.flags |= 1; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DC218.s") +void Boss02_Update(Actor* thisx, GlobalContext* globalCtx) { + Vec3f sp3C; + Boss02* this = THIS; + s32 pad; + s16 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/Boss02_Update.s") + if (D_809E0422 == 0) { + Actor_SetScale(&this->actor, 0.6f); + } else { + Actor_SetScale(&this->actor, 0.060000001f); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DC78C.s") + if (D_809E042C->unk_1D18 == 0) { + for (i = 0; i < ARRAY_COUNT(this->unk_0146); i++) { + if (this->unk_0146[i] != 0) { + this->unk_0146[i]--; + } + } + if (this->unk_016C != 0) { + this->unk_016C--; + } + + if (this->unk_0154 != 0) { + this->unk_0154--; + } + + if (this->unk_0156 != 0) { + this->unk_0156--; + } + + if (this->unk_0152 != 0) { + this->unk_0152--; + } + + this->unk_014C++; + + this->actionFunc(this, globalCtx); + + if (this->unk_016C != 0) { + if ((this->unk_016C == 60) && (this->unk_0144 < 20)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_INBOSS_ROAR_OLD); + } + Audio_PlayActorSound2(&this->actor, NA_SE_EN_INBOSS_SAND_OLD - SFX_FLAG); + + if (this->unk_0144 > 20) { + sp3C.x = randPlusMinusPoint5Scaled(100.0f * D_809DF5B0) + this->unk_0170.x; + sp3C.y = randPlusMinusPoint5Scaled(50.0f * D_809DF5B0) + this->unk_0170.y; + sp3C.z = randPlusMinusPoint5Scaled(100.0f * D_809DF5B0) + this->unk_0170.z; + func_809DA264(globalCtx->specialEffects, &sp3C, Rand_ZeroFloat(3.0f) + 6.0f); + } + + if ((this->unk_014C % 2) == 0) { + sp3C.x = randPlusMinusPoint5Scaled(100.0f * D_809DF5B0) + this->unk_0170.x; + sp3C.y = randPlusMinusPoint5Scaled(50.0f * D_809DF5B0) + this->unk_0170.y; + sp3C.z = randPlusMinusPoint5Scaled(100.0f * D_809DF5B0) + this->unk_0170.z; + func_809DA264(globalCtx->specialEffects, &sp3C, Rand_ZeroFloat(3.0f) + 6.0f); + } + } + + if ((this->unk_0144 < 20) && (this->unk_0144 != 10)) { + func_809DBFB4(this, globalCtx); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere1.base); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere1.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere1.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere2.base); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere2.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere2.base); + } + + switch (this->unk_015C) { + case 1: + this->unk_015A = 0; + this->unk_0158 = this->unk_015A; + this->unk_015C++; + + case 2: + this->unk_015A += 2; + if (this->unk_015A > 20) { + this->unk_015C++; + } + this->unk_0156 |= 4; + break; + + case 3: + this->unk_0158 += 2; + if (this->unk_0158 > 20) { + this->unk_015C = 0; + } + this->unk_0156 |= 4; + break; + + case 10: + this->unk_015A = 21; + this->unk_0158 = this->unk_015A; + this->unk_015C++; + + case 11: + this->unk_0158 -= 2; + if (this->unk_0158 <= 0) { + this->unk_0158 = 0; + this->unk_015C++; + } + this->unk_0156 |= 4; + break; + + case 12: + this->unk_015A -= 2; + if (this->unk_015A <= 0) { + this->unk_015A = 0; + this->unk_015C = 0; + } + this->unk_0156 |= 4; + break; + } + } +} + +void func_809DC78C(Actor* thisx, GlobalContext* globalCtx) { + Boss02* this = THIS; + + this->unk_01AC = D_809DF5B0; + globalCtx->envCtx.unk_EA = 0xD; + + if (D_809E0434 != NULL) { + this->unk_1D74 = KREG(23) + -15.0f; + D_801F4E30 = 0; + globalCtx->envCtx.unk_C3 = 1; + globalCtx->skyboxId = 1; + } else if (D_809E0422 == 0) { + this->unk_1D74 = 0.0f; + D_801F4E30 = this->unk_1D7C; + globalCtx->envCtx.unk_C3 = 0; + globalCtx->skyboxId = 2; + } else { + this->unk_1D74 = KREG(23) + -15.0f; + D_801F4E30 = ((KREG(24) * 0.1f) + 1.0f) * this->unk_1D7C; + globalCtx->envCtx.unk_C3 = 1; + globalCtx->skyboxId = 1; + } + + Math_ApproachS(&this->unk_1D7C, this->unk_1D7E, 1, 3); + + if (this->unk_0146[0] != 0) { + this->unk_0146[0]--; + } + + if (D_809E0434 == NULL) { + if (D_809E0430 != 0) { + D_809E0430--; + if (D_809E0430 == 0) { + Audio_QueueSeqCmd(0x801B); + } + } + } + + func_809DD0CC(globalCtx); + func_809DEAC4(this, globalCtx); + func_809DD934(this, globalCtx); +} + +#ifdef NON_MATCHING +// matrix stuff at the start? +void Boss02_Draw(Actor* thisx, GlobalContext* globalCtx2) { + static Gfx* D_809DFA9C[] = { + D_0600ECF0, D_0600EF90, D_0600F310, D_0600F690, D_0600FA10, D_0600FD90, D_06010110, D_06010490, + D_06010810, D_06010B90, D_06010F10, D_06011290, D_06011610, D_06011990, D_06011D10, D_06012090, + D_06012410, D_06012790, D_06012B10, D_06012E90, D_06013210, D_06013590, + }; + static Vec3f D_809DFAF4 = { -10000.0f, -100000.0f, -100000.0f }; + Boss02* this = THIS; + GlobalContext* globalCtx = globalCtx2; + s32 i; + s32 idx; + RSPMatrix* matrix; + s32 pad; + s32 phi_v0; + f32 phi_f12; + f32 spAC; + f32 spA8; + f32 spA4; + f32 spA0; + f32 sp9C; + f32 sp98; + + matrix = (RSPMatrix*)GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(RSPMatrix) * 23); + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + + if (this->actor.params == 0) { + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(&D_060003A0)); + } else { + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(&D_060041A0)); + } + + gSPSegment(POLY_OPA_DISP++, 0x0D, matrix); + + if (D_809E0422 == 0) { + sp98 = -500.0f; + } else { + sp98 = 3100.0f; + } + + sp9C = this->unk_0152 * (M_PI / 4) * (1.0f / 15); + if (this->unk_0144 < 20) { + spAC = Math_SinS(this->unk_014C * 0x2200) * sp9C * 0.5f; + spA8 = Math_CosS(this->unk_014C * 0x3200) * sp9C; + } else { + spAC = Math_SinS(this->unk_014C * 0x1000) * sp9C * 0.5f; + spA8 = Math_CosS(this->unk_014C * 0x1500) * sp9C; + } + + idx = (this->unk_014E + 196) % ARRAY_COUNT(this->unk_01BC); + Matrix_InsertTranslation(this->unk_01BC[idx].x, this->unk_01BC[idx].y, this->unk_01BC[idx].z, MTXMODE_NEW); + Matrix_InsertYRotation_f(this->unk_0B1C[idx].y + spA8, MTXMODE_APPLY); + Matrix_RotateStateAroundXAxis(spAC - this->unk_0B1C[idx].x); + Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); + Matrix_InsertTranslation(0.0f, 0.0f, 250.0f, MTXMODE_APPLY); + Matrix_GetStateTranslationAndScaledZ(150.0f, &this->unk_147C[0]); + this->unk_0188 = this->unk_017C; + Matrix_GetStateTranslationAndScaledZ(300.0f, &this->unk_017C); + Math_Vec3f_Copy(&this->actor.focus.pos, &this->unk_017C); + + if ((this->unk_0156 & 1) && (this->unk_0158 == 0)) { + POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 0, 0, 255, 0x384, 0x44B); + } + + SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->actor); + POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + + spA4 = 0.0f; + spA0 = 0.0f; + for (i = 0; i < ARRAY_COUNT(D_809DFA9C); i++) { + if (this->unk_0195 != 0) { + phi_v0 = (D_809DF5E4[i] + this->unk_014E) % ARRAY_COUNT(this->unk_01BC); + } else { + phi_v0 = (D_809DF5B4[i] + this->unk_014E) % ARRAY_COUNT(this->unk_01BC); + } + + if ((i == 21) && (this->unk_0144 < 20)) { + spA4 = spAC; + spA0 = spA8; + } + + Matrix_InsertTranslation(this->unk_01BC[phi_v0].x, this->unk_01BC[phi_v0].y, this->unk_01BC[phi_v0].z, + MTXMODE_NEW); + Matrix_InsertYRotation_f(this->unk_0B1C[phi_v0].y + spA0, MTXMODE_APPLY); + Matrix_RotateStateAroundXAxis(spA4 - this->unk_0B1C[phi_v0].x); + Matrix_InsertZRotation_f(this->unk_0B1C[phi_v0].z, MTXMODE_APPLY); + Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); + Matrix_InsertYRotation_f(M_PI / 2, MTXMODE_APPLY); + Matrix_RotateStateAroundXAxis(-(M_PI / 2)); + Matrix_GetStateAsRSPMatrix(&matrix[i]); + + gSPMatrix(POLY_OPA_DISP++, &matrix[i], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + if ((this->unk_0156 & 1) && (i >= this->unk_0158) && (this->unk_015A >= i)) { + POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 0, 0, 255, 0x384, 0x44B); + } + + if (i < this->unk_1678) { + if (sp98 < this->unk_01BC[phi_v0].y) { + gSPDisplayList(POLY_OPA_DISP++, D_809DFA9C[i]); + } + POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + } + + if (i == 21) { + phi_f12 = 600.0f; + } else { + phi_f12 = 200.0f; + } + + Matrix_GetStateTranslationAndScaledX(phi_f12, &this->unk_147C[i + 1]); + + if (i == 21) { + Actor* child = this->actor.child; + + if (child != NULL) { + Matrix_GetStateTranslationAndScaledX(500.0f, &child->world.pos); + } + + func_809DA50C(1, &this->colliderSphere2, &this->unk_147C[i + 1]); + SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->projectionMatrix, &this->unk_147C[i + 1], &this->unk_167C, + &this->actor.projectedW); + } else { + func_809DA50C(i, &this->colliderSphere1, &this->unk_147C[i + 1]); + } + } + + CLOSE_DISPS(globalCtx->state.gfxCtx); + + if (D_809E0422 == 0) { + func_809DA50C(0, &this->colliderSphere2, &D_809DFAF4); + func_809DA50C(21, &this->colliderSphere1, &this->unk_147C[0]); + } else { + func_809DA50C(0, &this->colliderSphere2, &this->unk_147C[0]); + func_809DA50C(21, &this->colliderSphere1, &D_809DFAF4); + } +} +#else +static Gfx* D_809DFA9C[] = { + D_0600ECF0, D_0600EF90, D_0600F310, D_0600F690, D_0600FA10, D_0600FD90, D_06010110, D_06010490, + D_06010810, D_06010B90, D_06010F10, D_06011290, D_06011610, D_06011990, D_06011D10, D_06012090, + D_06012410, D_06012790, D_06012B10, D_06012E90, D_06013210, D_06013590, +}; +static Vec3f D_809DFAF4 = { -10000.0f, -100000.0f, -100000.0f }; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/Boss02_Draw.s") +#endif -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DD0A8.s") +void func_809DD0A8(Actor* thisx, GlobalContext* globalCtx) { + func_809DD2F8(globalCtx); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DD0CC.s") +void func_809DD0CC(GlobalContext* globalCtx) { + Boss02Effects* effect = (Boss02Effects*)globalCtx->specialEffects; + f32 phi_f22; + s16 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DD2F8.s") + if (D_809E0422 == 0) { + phi_f22 = 0.0f; + } else { + phi_f22 = 3150.0f; + } + for (i = 0; i < ARRAY_COUNT(D_809E0438); i++, effect++) { + if (effect->unk_24) { + effect->unk_26++; + effect->unk_00.x += effect->unk_0C.x * D_809DF5B0; + effect->unk_00.y += effect->unk_0C.y * D_809DF5B0; + effect->unk_00.z += effect->unk_0C.z * D_809DF5B0; + effect->unk_0C.y += effect->unk_18.y; + + if (effect->unk_24 < 3) { + Math_ApproachF(&effect->unk_34, effect->unk_38, 0.1f, 0.1f); + if (effect->unk_24 == 2) { + effect->unk_2C -= 18; + } else { + effect->unk_2C -= 15; + } + if (effect->unk_2C <= 0) { + effect->unk_24 = 0; + } + } else if (effect->unk_24 == 3) { + effect->unk_2E += 0x1000; + effect->unk_30 += 0x1500; + if ((effect->unk_00.y < phi_f22) || (effect->unk_26 > 50)) { + effect->unk_24 = 0; + } + } else if (effect->unk_24 == 4) { + Math_ApproachF(&effect->unk_34, 80.0f, 0.2f, 20.0f); + effect->unk_2C -= 15; + if (effect->unk_2C <= 0) { + effect->unk_24 = 0; + } + } + } + } +} + +void func_809DD2F8(GlobalContext* globalCtx) { + u8 flag = false; + Boss02Effects* effect = (Boss02Effects*)globalCtx->specialEffects; + s16 i; + u8 phi_a0; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + func_8012C2DC(globalCtx->state.gfxCtx); + + for (i = 0; i < ARRAY_COUNT(D_809E0438); i++, effect++) { + if (effect->unk_24 == 1) { + if (!flag) { + gSPDisplayList(POLY_XLU_DISP++, D_06000230); + gDPSetEnvColor(POLY_XLU_DISP++, 185, 140, 70, 128); + flag++; + } + + phi_a0 = effect->unk_2C; + if (effect->unk_2C > 255) { + phi_a0 = 255; + } + + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 185, 140, 70, phi_a0); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, effect->unk_26 + (i * 3), + (effect->unk_26 + (i * 3)) * 5, 32, 64, 1, 0, 0, 32, 32)); + + Matrix_InsertTranslation(effect->unk_00.x, effect->unk_00.y, effect->unk_00.z, MTXMODE_NEW); + Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_Scale(effect->unk_34 * D_809DF5B0, effect->unk_34 * D_809DF5B0, 1.0f, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, D_060002E0); + } + } + + effect = (Boss02Effects*)globalCtx->specialEffects; + for (i = 0, flag = false; i < ARRAY_COUNT(D_809E0438); i++, effect++) { + if (effect->unk_24 == 3) { + if (!flag) { + gDPSetCombineLERP(POLY_OPA_DISP++, SHADE, 0, PRIMITIVE, 0, SHADE, 0, PRIMITIVE, 0, SHADE, 0, PRIMITIVE, + 0, SHADE, 0, PRIMITIVE, 0); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x01, 100, 100, 120, 255); + flag++; + } + Matrix_InsertTranslation(effect->unk_00.x, effect->unk_00.y, effect->unk_00.z, MTXMODE_NEW); + Matrix_RotateY(effect->unk_30, MTXMODE_APPLY); + Matrix_InsertXRotation_s(effect->unk_2E, MTXMODE_APPLY); + Matrix_Scale(effect->unk_34 * D_809DF5B0, effect->unk_34 * D_809DF5B0, effect->unk_34 * D_809DF5B0, + MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, D_0401A620); + } + } + + effect = (Boss02Effects*)globalCtx->specialEffects; + for (i = 0, flag = false; i < ARRAY_COUNT(D_809E0438); i++, effect++) { + if (effect->unk_24 == 4) { + if (!flag) { //! @bug - dev forgot to set flag to 1, should only apply to first entry? + gSPDisplayList(POLY_XLU_DISP++, D_04023348); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 128); + } + + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, (u8)effect->unk_2C); + + Matrix_InsertTranslation(effect->unk_00.x, effect->unk_00.y, effect->unk_00.z, MTXMODE_NEW); + Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_Scale(effect->unk_34 * D_809DF5B0, effect->unk_34 * D_809DF5B0, 1.0f, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, D_04023428); + } + } + + effect = (Boss02Effects*)globalCtx->specialEffects; + for (i = 0, flag = false; i < ARRAY_COUNT(D_809E0438); i++, effect++) { + if (effect->unk_24 == 2) { + if (!flag) { + gSPDisplayList(POLY_XLU_DISP++, D_06000230); + gDPSetEnvColor(POLY_XLU_DISP++, 30, 30, 30, 128); + flag++; + } + + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 30, 30, 30, (u8)effect->unk_2C); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, effect->unk_26 + (i * 3), + (effect->unk_26 + (i * 3)) * 5, 32, 64, 1, 0, 0, 32, 32)); + + Matrix_InsertTranslation(effect->unk_00.x, effect->unk_00.y, effect->unk_00.z, 0); + Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_Scale(effect->unk_34 * D_809DF5B0, effect->unk_34 * D_809DF5B0, 1.0f, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, D_060002E0); + } + } + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} + +#ifdef NON_MATCHING +// Small ordering in the last loop +void func_809DD934(Boss02* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + s16 i; + Actor* temp_a0_5; + Vec3f sp58; + u8 sp57 = 0; + f32 phi_f0_2; + s16 phi_v1; + + this->unk_1D14++; + + switch (this->unk_1D18) { + case 0: + if (player->stateFlags1 & 0x100) { + func_800EA0D4(globalCtx, &globalCtx->csCtx); + this->unk_1D22 = func_801694DC(globalCtx); + func_80169590(globalCtx, 0, 1); + func_80169590(globalCtx, this->unk_1D22, 7); + func_8016566C(150); + this->unk_1D14 = 0; + this->unk_1D5C = 0.0f; + this->unk_1D58 = 0.0f; + if (D_809E0422 == 0) { + this->unk_1D18 = 1; + this->unk_1D68 = 10.0f; + this->unk_1D64 = 60.0f; + this->unk_1D6C = 23.0f; + this->unk_1D70 = 0.01f; + this->unk_1D74 = 0.0f; + goto label1; + } else { + this->unk_1D18 = 10; + this->unk_1D68 = 10.0f; + this->unk_1D64 = 200.0f; + this->unk_1D6C = 273.0f; + this->unk_1D70 = 0.1f; + this->unk_1D74 = -100.0f; + sp57 = 1; + goto label2; + } + } + break; + + case 1: + if ((this->unk_1D14 < 80U) && (D_809E0420 != 0) && + CHECK_BTN_ANY(CONTROLLER1(globalCtx)->press.button, + BTN_A | BTN_B | BTN_CUP | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT)) { + this->unk_1D18++; + this->unk_1D78 = 1; + this->unk_1D14 = 0; + } else { + label1: + if (this->unk_1D14 >= 50U) { + if (this->unk_1D14 == (u32)(BREG(43) + 60)) { + play_sound(NA_SE_PL_TRANSFORM_GIANT); + } + Math_ApproachF(&this->unk_1D64, 200.0f, 0.1f, this->unk_1D5C * 640.0f); + Math_ApproachF(&this->unk_1D6C, 273.0f, 0.1f, this->unk_1D5C * 150.0f); + Math_ApproachF(&this->unk_1D70, 0.1f, 0.2f, this->unk_1D5C * 0.1f); + Math_ApproachF(&this->unk_1D74, -100.0f, 1.0f, this->unk_1D5C * 100.0f); + Math_ApproachF(&this->unk_1D5C, 1.0f, 1.0f, 0.001f); + } else { + Math_ApproachF(&this->unk_1D64, 30.0f, 0.1f, 1.0f); + } + + if (this->unk_1D14 > 50U) { + Math_ApproachZeroF(&this->unk_1D58, 1.0f, 0.06f); + } else { + Math_ApproachF(&this->unk_1D58, 0.4f, 1.0f, 0.02f); + } + + if (this->unk_1D14 == 107U) { + this->unk_1D78 = 1; + } + + if (this->unk_1D14 < 121U) { + break; + } + + sp57 = 1; + D_809E0420 = 1; + goto block_38; + } + break; + + case 2: + if (this->unk_1D14 < 8U) { + break; + } + sp57 = 1; + goto block_38; + + case 10: + if ((this->unk_1D14 < 30U) && (D_809E0421 != 0) && + CHECK_BTN_ANY(CONTROLLER1(globalCtx)->press.button, + BTN_A | BTN_B | BTN_CUP | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT)) { + this->unk_1D18++; + this->unk_1D78 = 1; + this->unk_1D14 = 0; + break; + } + + label2: + if (this->unk_1D14 != 0U) { + if (this->unk_1D14 == (u32)(BREG(44) + 10)) { + play_sound(NA_SE_PL_TRANSFORM_NORAML); + } + Math_ApproachF(&this->unk_1D64, 60.0f, 0.1f, this->unk_1D5C * 640.0f); + Math_ApproachF(&this->unk_1D6C, 23.0f, 0.1f, this->unk_1D5C * 150.0f); + Math_ApproachF(&this->unk_1D70, 0.01f, 0.1f, 0.003f); + Math_ApproachF(&this->unk_1D74, 0.0f, 1.0f, this->unk_1D5C * 100.0f); + Math_ApproachF(&this->unk_1D5C, 2.0f, 1.0f, 0.01f); + } + + if (this->unk_1D14 == 42U) { + this->unk_1D78 = 1; + } + + if (this->unk_1D14 > 50U) { + D_809E0421 = 1; + goto block_38; + } + break; + + case 11: + if (this->unk_1D14 < 8U) { + break; + } + + block_38: + case 20: + this->unk_1D18 = 0; + func_80169AFC(globalCtx, this->unk_1D22, 0); + this->unk_1D22 = 0; + func_800EA0EC(globalCtx, &globalCtx->csCtx); + this->actor.flags |= 1; + player->stateFlags1 &= ~0x100; + this->unk_1D70 = 0.01f; + func_80165690(); + break; + } + + if (player->transformation == PLAYER_FORM_FIERCE_DEITY) { + Actor_SetScale(&player->actor, this->unk_1D70 * 1.5f); + } else { + Actor_SetScale(&player->actor, this->unk_1D70); + } + + globalCtx->envCtx.unk_8C.fogNear = this->unk_1D74; + + if (sp57) { + D_809E0422 = 1 - D_809E0422; + if (D_809E0422 == 0) { + D_809DF5B0 = 1.0f; + } else { + D_809DF5B0 = 0.1f; + } + + this->unk_01AC = D_809DF5B0; + if (D_809E0422 == 0) { + if (D_809E0434 != NULL) { + D_809E0434->unk_203 = 0; + D_809E0434->unk_204 = 1.0f; + D_809E0434->actor.world.pos.y = 60.0f; + } + + player->actor.world.pos.x *= 10.0f; + player->actor.world.pos.y -= 3150.0f; + player->actor.world.pos.y *= 10.0f; + player->unk_B68 = player->actor.world.pos.y; + player->actor.world.pos.z *= 10.0f; + + if ((D_809E0434 != NULL) && ((SQ(player->actor.world.pos.z) + SQ(player->actor.world.pos.x)) < SQ(60.0f))) { + player->actor.world.pos.z = 60.0f; + player->actor.world.pos.x = 60.0f; + } + + D_809E0424->actor.world.pos.x *= 10.0f; + D_809E0424->actor.world.pos.y -= 3150.0f; + D_809E0424->actor.world.pos.y *= 10.0f; + D_809E0424->actor.world.pos.z *= 10.0f; + + D_809E0424->unk_0170.x *= 10.0f; + D_809E0424->unk_0170.y -= 3150.0f; + D_809E0424->unk_0170.y *= 10.0f; + D_809E0424->unk_0170.z *= 10.0f; + + for (i = 0; i < ARRAY_COUNT(this->unk_01BC); i++) { + D_809E0424->unk_01BC[i].x *= 10.0f; + D_809E0424->unk_01BC[i].y -= 3150.0f; + D_809E0424->unk_01BC[i].y *= 10.0f; + D_809E0424->unk_01BC[i].z *= 10.0f; + } + + D_809E0424->unk_01B0.x *= 10.0f; + D_809E0424->unk_01B0.y -= 3150.0f; + D_809E0424->unk_01B0.y *= 10.0f; + D_809E0424->unk_01B0.z *= 10.0f; + + D_809E0424->unk_017C.y -= 3150.0f; + D_809E0424->unk_017C.y *= 10.0f; + D_809E0424->unk_0188.y -= 3150.0f; + D_809E0424->unk_0188.y *= 10.0f; + + D_809E0428->actor.world.pos.x *= 10.0f; + D_809E0428->actor.world.pos.y -= 3150.0f; + D_809E0428->actor.world.pos.y *= 10.0f; + D_809E0428->actor.world.pos.z *= 10.0f; + + D_809E0428->unk_0170.x *= 10.0f; + D_809E0428->unk_0170.y -= 3150.0f; + D_809E0428->unk_0170.y *= 10.0f; + D_809E0428->unk_0170.z *= 10.0f; + + for (i = 0; i < ARRAY_COUNT(this->unk_01BC); i++) { + D_809E0428->unk_01BC[i].x *= 10.0f; + D_809E0428->unk_01BC[i].y -= 3150.0f; + D_809E0428->unk_01BC[i].y *= 10.0f; + D_809E0428->unk_01BC[i].z *= 10.0f; + } + + D_809E0428->unk_01B0.x *= 10.0f; + D_809E0428->unk_01B0.y -= 3150.0f; + D_809E0428->unk_01B0.y *= 10.0f; + D_809E0428->unk_01B0.z *= 10.0f; + + D_809E0428->unk_017C.y -= 3150.0f; + D_809E0428->unk_017C.y *= 10.0f; + D_809E0428->unk_0188.y -= 3150.0f; + D_809E0428->unk_0188.y *= 10.0f; + + } else { + if (D_809E0434 != 0) { + D_809E0434->unk_203 = 1; + D_809E0434->unk_204 = 0.1f; + D_809E0434->actor.world.pos.y = 3155.0f; + } + + player->actor.world.pos.x *= 0.1f; + player->actor.world.pos.y *= 0.1f; + player->actor.world.pos.y += 3150.0f; + player->unk_B68 = player->actor.world.pos.y; + player->actor.world.pos.z *= 0.1f; + + D_809E0424->actor.world.pos.x *= 0.1f; + D_809E0424->actor.world.pos.y *= 0.1f; + D_809E0424->actor.world.pos.y += 3150.0f; + D_809E0424->actor.world.pos.z *= 0.1f; + + D_809E0424->unk_0170.x *= 0.1f; + D_809E0424->unk_0170.y *= 0.1f; + D_809E0424->unk_0170.y += 3150.0f; + D_809E0424->unk_0170.z *= 0.1f; + + for (i = 0; i < ARRAY_COUNT(this->unk_01BC); i++) { + D_809E0424->unk_01BC[i].x *= 0.1f; + D_809E0424->unk_01BC[i].y *= 0.1f; + D_809E0424->unk_01BC[i].y += 3150.0f; + D_809E0424->unk_01BC[i].z *= 0.1f; + } + + D_809E0424->unk_01B0.x *= 0.1f; + D_809E0424->unk_01B0.y *= 0.1f; + D_809E0424->unk_01B0.y += 3150.0f; + D_809E0424->unk_01B0.z *= 0.1f; + + D_809E0424->unk_017C.y *= 0.1f; + D_809E0424->unk_017C.y += 3150.0f; + D_809E0424->unk_0188.y *= 0.1f; + D_809E0424->unk_0188.y += 3150.0f; + + D_809E0428->actor.world.pos.x *= 0.1f; + D_809E0428->actor.world.pos.y *= 0.1f; + D_809E0428->actor.world.pos.y += 3150.0f; + D_809E0428->actor.world.pos.z *= 0.1f; + + D_809E0428->unk_0170.x *= 0.1f; + D_809E0428->unk_0170.y *= 0.1f; + D_809E0428->unk_0170.y += 3150.0f; + D_809E0428->unk_0170.z *= 0.1f; + + for (i = 0; i < ARRAY_COUNT(this->unk_01BC); i++) { + D_809E0428->unk_01BC[i].x *= 0.1f; + D_809E0428->unk_01BC[i].y *= 0.1f; + D_809E0428->unk_01BC[i].y += 3150.0f; + D_809E0428->unk_01BC[i].z *= 0.1f; + } + + D_809E0428->unk_01B0.x *= 0.1f; + D_809E0428->unk_01B0.y *= 0.1f; + D_809E0428->unk_01B0.y += 3150.0f; + D_809E0428->unk_01B0.z *= 0.1f; + + D_809E0428->unk_017C.y *= 0.1f; + D_809E0428->unk_017C.y += 3150.0f; + D_809E0428->unk_0188.y *= 0.1f; + D_809E0428->unk_0188.y += 3150.0f; + } + + player->actor.home.pos = player->actor.world.pos; + player->actor.prevPos = player->actor.world.pos; + + temp_a0_5 = globalCtx->actorCtx.actorList[ACTORCAT_BG].first; + while (temp_a0_5 != NULL) { + if (temp_a0_5->id == ACTOR_BG_INIBS_MOVEBG) { + Actor_MarkForDeath(temp_a0_5); + break; + } + temp_a0_5 = temp_a0_5->next; + } + + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_INIBS_MOVEBG, 0, D_809E0422 ? 3150.0f : 0.0f, 0, 0, 0, 0, + D_809E0422); + + temp_a0_5 = globalCtx->actorCtx.actorList[ACTORCAT_BOSS].first; + while (temp_a0_5 != NULL) { + if ((temp_a0_5->id == ACTOR_EN_TANRON5) || (temp_a0_5->id == ACTOR_ITEM_B_HEART)) { + if (D_809E0422 == 0) { + temp_a0_5->world.pos.y -= 3150.0f; + temp_a0_5->world.pos.y *= 10.0f; + + temp_a0_5->floorHeight -= 3150.0f; + temp_a0_5->floorHeight *= 10.0f; + + phi_f0_2 = 10.0f; + } else { + temp_a0_5->world.pos.y *= 0.1f; + temp_a0_5->world.pos.y += 3150.0f; + + temp_a0_5->floorHeight *= 0.1f; + temp_a0_5->floorHeight += 3150.0f; + + phi_f0_2 = 0.1f; + } + + temp_a0_5->world.pos.x *= phi_f0_2; + temp_a0_5->world.pos.z *= phi_f0_2; + + temp_a0_5->speedXZ *= phi_f0_2; + + temp_a0_5->velocity.x *= phi_f0_2; + temp_a0_5->velocity.y *= phi_f0_2; + temp_a0_5->velocity.z *= phi_f0_2; + + temp_a0_5->gravity *= phi_f0_2; + temp_a0_5->minVelocityY *= phi_f0_2; + + temp_a0_5->scale.x *= phi_f0_2; + temp_a0_5->scale.y *= phi_f0_2; + temp_a0_5->scale.z *= phi_f0_2; + + if (temp_a0_5->id == ACTOR_ITEM_B_HEART) { + ((ItemBHeart*)temp_a0_5)->unk_168 *= phi_f0_2; + } + } + temp_a0_5 = temp_a0_5->next; + } + } + + switch (this->unk_1D78) { + case 0: + break; + + case 1: + this->unk_1D7A = 0; + func_809DA1D0(globalCtx, 255, 255, 255, 0); + this->unk_1D78 = 2; + play_sound(NA_SE_SY_TRANSFORM_MASK_FLASH); + + case 2: + this->unk_1D7A += 40; + if (this->unk_1D7A >= 400) { + this->unk_1D78 = 3; + } + phi_v1 = this->unk_1D7A; + if (phi_v1 > 255) { + phi_v1 = 255; + } + func_809DA22C(globalCtx, phi_v1); + break; + + case 3: + this->unk_1D7A -= 40; + if (this->unk_1D7A <= 0) { + this->unk_1D7A = 0; + this->unk_1D78 = 0; + func_809DA24C(globalCtx); + } else { + phi_v1 = this->unk_1D7A; + if (phi_v1 > 255) { + phi_v1 = 255; + } + func_809DA22C(globalCtx, phi_v1); + } + break; + } + + if ((this->unk_1D18 != 0) && (this->unk_1D22 != 0)) { + Matrix_RotateY(player->actor.shape.rot.y, MTXMODE_NEW); + Matrix_GetStateTranslationAndScaledZ(this->unk_1D64, &sp58); + + this->unk_1D24.x = player->actor.world.pos.x + sp58.x; + this->unk_1D24.y = player->actor.world.pos.y + sp58.y + this->unk_1D68; + this->unk_1D24.z = player->actor.world.pos.z + sp58.z; + + this->unk_1D30.x = player->actor.world.pos.x; + this->unk_1D30.y = player->actor.world.pos.y + this->unk_1D6C; + this->unk_1D30.z = player->actor.world.pos.z; + + this->unk_1D54 = Math_SinS(this->unk_1D14 * 1512) * this->unk_1D58; + Matrix_InsertZRotation_f(this->unk_1D54, MTXMODE_APPLY); + Matrix_GetStateTranslationAndScaledY(1.0f, &this->unk_1D3C); + func_8016981C(globalCtx, this->unk_1D22, &this->unk_1D30, &this->unk_1D24, &this->unk_1D3C); + ShrinkWindow_SetLetterboxTarget(0x1B); + } +} +#else #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DD934.s") +#endif -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DEAC4.s") +void func_809DEAC4(Boss02* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + Boss02* sp68; + Vec3f sp5C; + f32 sp58 = 0.0f; + + this->unk_1D1C++; + if (this->unk_0194 == 0) { + sp68 = D_809E0424; + } else { + sp68 = D_809E0428; + } + + switch (this->unk_1D20) { + case 0: + break; + + case 1: + if ((gSaveContext.weekEventReg[52] & 0x20) || ((u32)(KREG(13) + 15) >= this->unk_1D1C)) { + break; + } + func_800EA0D4(globalCtx, &globalCtx->csCtx); + this->unk_1D22 = func_801694DC(globalCtx); + func_80169590(globalCtx, 0, 1); + func_80169590(globalCtx, this->unk_1D22, 7); + this->unk_1D20 = 2; + this->unk_1D1C = 0; + + case 2: + player->actor.shape.rot.y = -0x8000; + player->actor.world.rot.y = player->actor.shape.rot.y; + this->unk_1D24.x = player->actor.world.pos.x - 20.0f; + this->unk_1D24.y = (func_800B6FC8(player) + player->actor.world.pos.y) - 29.0f; + this->unk_1D24.z = player->actor.world.pos.z - 50; + + this->unk_1D30.x = player->actor.world.pos.x; + this->unk_1D30.y = (func_800B6FC8(player) + player->actor.world.pos.y) - 17.0f; + this->unk_1D30.z = player->actor.world.pos.z; + if (this->unk_1D1C >= 30) { + if (this->unk_1D1C == 30) { + func_8013EC44(0.0f, 50, 200, 1); + } + this->unk_0150 += 0x4000; + sp58 = (Math_SinS(this->unk_0150) * (BREG(19) + 5)) * 0.1f; + Matrix_InsertZRotation_f(Math_SinS(this->unk_1D1C * 0x3000) * ((KREG(28) * 0.001f) + 0.017f), + MTXMODE_NEW); + Matrix_GetStateTranslationAndScaledY(1.0f, &this->unk_1D3C); + func_8019F128(NA_SE_EV_EARTHQUAKE_LAST - SFX_FLAG); + } + + if (this->unk_1D1C == 20) { + this->unk_1D7E = 100; + } + + if (this->unk_1D1C == 45) { + func_800B7298(globalCtx, &this->actor, 21); + D_809E0430 = KREG(91) + 43; + } + + if (this->unk_1D1C == 85) { + D_809E0424->unk_0144 = 11; + D_809E0424->unk_014C = 0; + } + + if (this->unk_1D1C == 92) { + func_8013EC44(0.0f, 255, 30, 100); + } + + if (this->unk_1D1C == 100) { + func_800B7298(globalCtx, &this->actor, 0x73); + } + + if (this->unk_1D1C == 112) { + this->unk_1D20 = 10; + this->unk_1D1C = 0; + } + break; + + case 10: + if (this->unk_1D1C < 310) { + this->unk_1D48 = sp68->actor.world.pos; + this->unk_1D24.x = (sp68->actor.world.pos.x * 50.0f) * 0.001f; + this->unk_1D24.y = (sp68->actor.world.pos.y * 50.0f) * 0.001f; + if (this->unk_1D24.y < 100.0f) { + this->unk_1D24.y = 100.0f; + } + this->unk_1D24.z = (sp68->actor.world.pos.z * 100) * 0.001f; + } + + Math_ApproachF(&this->unk_1D30.x, this->unk_1D48.x, 0.1f, 3000.0f); + Math_ApproachF(&this->unk_1D30.y, this->unk_1D48.y, 0.1f, 3000.0f); + Math_ApproachF(&this->unk_1D30.z, this->unk_1D48.z, 0.1f, 3000.0f); + + if (this->unk_1D1C == 100) { + D_809E0428->unk_0144 = 11; + D_809E0428->unk_014C = 0; + this->unk_0194 = 1; + } + + if (this->unk_1D1C == (u32)(KREG(92) + 125)) { + Actor_TitleCardCreate(globalCtx, &globalCtx->actorCtx.titleCtxt, Lib_SegmentedToVirtual(&D_06008650), + 160, 180, 128, 40); + } + + if (this->unk_1D1C == (u32)(BREG(27) + 335)) { + func_80169AFC(globalCtx, this->unk_1D22, 0); + this->unk_1D22 = 0; + func_800EA0EC(globalCtx, &globalCtx->csCtx); + func_800B7298(globalCtx, &this->actor, 6); + this->actor.flags |= 1; + this->unk_1D20 = 0; + D_809E0424->unk_0144 = D_809E0428->unk_0144 = 3; + D_809E0424->unk_0146[0] = D_809E0428->unk_0146[0] = 60; + gSaveContext.eventInf[5] |= 0x20; + } + break; + + case 100: + if (ActorCutscene_GetCurrentIndex() == -1) { + func_800EA0D4(globalCtx, &globalCtx->csCtx); + this->unk_1D22 = func_801694DC(globalCtx); + func_80169590(globalCtx, 0, 1); + func_80169590(globalCtx, this->unk_1D22, 7); + this->unk_1D20 = 101; + this->unk_1D1C = 0; + this->unk_1D5C = 1.0f; + this->unk_1D30 = sp68->actor.world.pos; + } else { + break; + } + + case 101: + case 102: + case_10x: + if ((this->unk_1D20 == 101) || (this->unk_1D20 == 103)) { + this->unk_1D48 = sp68->actor.world.pos; + } else { + this->unk_1D48 = sp68->unk_147C[sp68->unk_1678]; + } + + this->unk_1D24.x = player->actor.world.pos.x; + this->unk_1D24.y = player->actor.world.pos.y + 100.0f; + if (D_809E0422 == 0) { + if (this->unk_1D24.y < 100.0f) { + this->unk_1D24.y = 100.0f; + } + } else if (this->unk_1D24.y < 3160.0f) { + this->unk_1D24.y = 3160.0f; + } + + if (this->unk_1D48.y < (100.0f * D_809DF5B0)) { + this->unk_1D48.y = (100.0f * D_809DF5B0); + } + + this->unk_1D24.z = player->actor.world.pos.z; + Math_ApproachF(&this->unk_1D30.x, this->unk_1D48.x, 0.3f, this->unk_1D5C * 500.0f); + Math_ApproachF(&this->unk_1D30.y, this->unk_1D48.y, 0.3f, this->unk_1D5C * 500.0f); + Math_ApproachF(&this->unk_1D30.z, this->unk_1D48.z, 0.3f, this->unk_1D5C * 500.0f); + Math_ApproachF(&this->unk_1D5C, 1.0f, 1.0f, 0.02f); + break; + + case 103: + this->unk_0150 += 0x4000; + sp58 = Math_SinS(this->unk_0150); + sp58 = (sp58 * this->unk_0146[0]) * 1.5f; + if (this->unk_1D1C == 30) { + func_80169AFC(globalCtx, this->unk_1D22, 0); + this->unk_1D22 = 0; + func_800EA0EC(globalCtx, &globalCtx->csCtx); + func_800B7298(globalCtx, &this->actor, 6); + this->unk_1D20 = 0; + this->actor.flags |= 1; + sp68->unk_0144 = 10; + if ((D_809E0424->unk_0144 >= 10) && (D_809E0428->unk_0144 >= 10)) { + f32 phi_f0; + + this->unk_1D7E = 0; + if (D_809E0422 == 0) { + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, 0.0f, 30.0f, -150.0f, 0, 1, 0, + 0); + phi_f0 = 60.0f; + } else { + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, 0.0f, 3153.0f, -15.0f, 0, 1, 0, + 35); + phi_f0 = 3155.0f; + } + D_809E0434 = (DoorWarp1*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, + ACTOR_DOOR_WARP1, 0.0f, phi_f0, 0.0f, 0, 0, 0, 1); + + if (D_809E0422 == 0) { + D_809E0434->unk_203 = 0; + D_809E0434->unk_204 = 1.0f; + } else { + D_809E0434->unk_203 = 1; + D_809E0434->unk_204 = 0.1f; + } + } + } + goto case_10x; + } + + if ((this->unk_1D20 != 0) && (this->unk_1D22 != 0)) { + sp5C = this->unk_1D24; + sp5C.y += sp58 * D_809DF5B0; + func_8016981C(globalCtx, this->unk_1D22, &this->unk_1D30, &sp5C, &this->unk_1D3C); + this->unk_1D3C.z = this->unk_1D3C.x = 0.0f; + this->unk_1D3C.y = 1.0f; + ShrinkWindow_SetLetterboxTarget(0x1B); + } +} diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.h b/src/overlays/actors/ovl_Boss_02/z_boss_02.h index 4e000b3ee2..d630acb8f5 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.h +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.h @@ -7,11 +7,89 @@ struct Boss02; typedef void (*Boss02ActionFunc)(struct Boss02*, GlobalContext*); +typedef struct { + /* 0x00 */ Vec3f unk_00; + /* 0x0C */ Vec3f unk_0C; + /* 0x18 */ Vec3f unk_18; + /* 0x24 */ u8 unk_24; + /* 0x26 */ s16 unk_26; + /* 0x28 */ UNK_TYPE1 unk_28[0x4]; + /* 0x2C */ s16 unk_2C; + /* 0x2E */ s16 unk_2E; + /* 0x30 */ s16 unk_30; + /* 0x34 */ f32 unk_34; + /* 0x38 */ f32 unk_38; +} Boss02Effects; // size = 0x3C + typedef struct Boss02 { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x152C]; + /* 0x0144 */ u8 unk_0144; + /* 0x0146 */ s16 unk_0146[3]; + /* 0x014C */ s16 unk_014C; + /* 0x014E */ s16 unk_014E; + /* 0x0150 */ s16 unk_0150; + /* 0x0152 */ s16 unk_0152; + /* 0x0154 */ s16 unk_0154; + /* 0x0156 */ s16 unk_0156; + /* 0x0158 */ s16 unk_0158; + /* 0x015A */ s16 unk_015A; + /* 0x015C */ u8 unk_015C; + /* 0x015D */ UNK_TYPE1 unk015D[0x7]; + /* 0x0164 */ f32 unk_0164; + /* 0x0168 */ f32 unk_0168; + /* 0x016C */ s16 unk_016C; + /* 0x0170 */ Vec3f unk_0170; + /* 0x017C */ Vec3f unk_017C; + /* 0x018C */ Vec3f unk_0188; + /* 0x0194 */ u8 unk_0194; + /* 0x0195 */ u8 unk_0195; + /* 0x0196 */ s16 unk_0196; + /* 0x0198 */ s16 unk_0198; + /* 0x019A */ s16 unk_019A; + /* 0x019C */ f32 unk_019C; + /* 0x01A0 */ f32 unk_01A0; + /* 0x01A4 */ s16 unk_01A4; + /* 0x01A8 */ f32 unk_01A8; + /* 0x01AC */ f32 unk_01AC; + /* 0x01B0 */ Vec3f unk_01B0; + /* 0x01BC */ Vec3f unk_01BC[200]; + /* 0x0B1c */ Vec3f unk_0B1C[200]; + /* 0x147C */ Vec3f unk_147C[23]; + /* 0x1590 */ SkelAnime skelAnime; + /* 0x15D4 */ Vec3s jointTable[13]; + /* 0x1622 */ Vec3s morphTable[13]; /* 0x1670 */ Boss02ActionFunc actionFunc; - /* 0x1674 */ char unk_1674[0x70C]; + /* 0x1674 */ struct Boss02* unk_1674; // points to the other's instance + /* 0x1678 */ s32 unk_1678; + /* 0x167C */ Vec3f unk_167C; + /* 0x1688 */ ColliderJntSph colliderSphere1; + /* 0x16A8 */ ColliderJntSphElement colliderSphere1Elements[22]; + /* 0x1C28 */ ColliderJntSph colliderSphere2; + /* 0x1C48 */ ColliderJntSphElement colliderSphere2Elements[2]; + /* 0x1CC8 */ ColliderCylinder colliderCylinder; + /* 0x1D14 */ u32 unk_1D14; + /* 0x1D18 */ s16 unk_1D18; + /* 0x1D1A */ s16 unk_1D1A; + /* 0x1D1C */ u32 unk_1D1C; + /* 0x1D20 */ s16 unk_1D20; + /* 0x1D22 */ s16 unk_1D22; + /* 0x1D24 */ Vec3f unk_1D24; + /* 0x1D30 */ Vec3f unk_1D30; + /* 0x1D3C */ Vec3f unk_1D3C; + /* 0x1D48 */ Vec3f unk_1D48; + /* 0x1D54 */ f32 unk_1D54; + /* 0x1D58 */ f32 unk_1D58; + /* 0x1D5C */ f32 unk_1D5C; + /* 0x1D60 */ UNK_TYPE1 unk1D60[0x4]; + /* 0x1D64 */ f32 unk_1D64; + /* 0x1D68 */ f32 unk_1D68; + /* 0x1D6C */ f32 unk_1D6C; + /* 0x1D70 */ f32 unk_1D70; + /* 0x1D74 */ f32 unk_1D74; + /* 0x1D78 */ u8 unk_1D78; + /* 0x1D7A */ s16 unk_1D7A; + /* 0x1D7C */ s16 unk_1D7C; + /* 0x1D7E */ s16 unk_1D7E; } Boss02; // size = 0x1D80 extern const ActorInit Boss_02_InitVars; diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h index 8085af4457..e7b67312e9 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h @@ -11,7 +11,10 @@ typedef struct DoorWarp1 { /* 0x0000 */ Actor actor; /* 0x0144 */ char unk_144[0x94]; /* 0x01D8 */ DoorWarp1ActionFunc actionFunc; - /* 0x01DC */ char unk_1DC[0x30]; + /* 0x01DC */ char unk_1DC[0x27]; + /* 0x0203 */ u8 unk_203; + /* 0x0204 */ f32 unk_204; + /* 0x0208 */ char unk_208[0x4]; } DoorWarp1; // size = 0x20C extern const ActorInit Door_Warp1_InitVars; diff --git a/tools/actorfixer.py b/tools/actorfixer.py index e1815e2241..e89303ba56 100755 --- a/tools/actorfixer.py +++ b/tools/actorfixer.py @@ -45,6 +45,7 @@ animdict = { "SysMatrix_NormalizeXYZ": "Matrix_NormalizeXYZ", "SysMatrix_InsertRotationAroundUnitVector_f": "Matrix_InsertRotationAroundUnitVector_f", "SysMatrix_InsertRotationAroundUnitVector_s": "Matrix_InsertRotationAroundUnitVector_s", + "SysMatrix_GetStateAsRSPMatrix": "Matrix_GetStateAsRSPMatrix", "func_800B78B8": "Actor_UpdateBgCheckInfo", "func_8012403C": "Player_GetMask", "func_8012404c": "Player_RemoveMask", diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index b4fa7869b6..8f63c1c891 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -10420,8 +10420,8 @@ 0x809DF570:("D_809DF570","UNK_TYPE1","",0x1), 0x809DF590:("Boss_02_InitVars","UNK_TYPE1","",0x1), 0x809DF5B0:("D_809DF5B0","f32","",0x4), - 0x809DF5B6:("D_809DF5B6","UNK_TYPE2","",0x2), - 0x809DF5E6:("D_809DF5E6","UNK_TYPE2","",0x2), + 0x809DF5B4:("D_809DF5B4","UNK_TYPE2","[24]",0x30), + 0x809DF5E4:("D_809DF5E4","UNK_TYPE2","[24]",0x30), 0x809DF614:("D_809DF614","UNK_TYPE1","",0x1), 0x809DF92C:("D_809DF92C","UNK_TYPE1","",0x1), 0x809DF93C:("D_809DF93C","UNK_TYPE1","",0x1), diff --git a/undefined_syms.txt b/undefined_syms.txt index 75a9b5cdc7..6c17154b82 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -1017,6 +1017,28 @@ D_060041A0 = 0x060041A0; D_06008650 = 0x06008650; D_06009B10 = 0x06009B10; D_06009C78 = 0x06009C78; +D_0600ECF0 = 0x0600ECF0; +D_0600EF90 = 0x0600EF90; +D_0600F310 = 0x0600F310; +D_0600F690 = 0x0600F690; +D_0600FA10 = 0x0600FA10; +D_0600FD90 = 0x0600FD90; +D_06010110 = 0x06010110; +D_06010490 = 0x06010490; +D_06010810 = 0x06010810; +D_06010B90 = 0x06010B90; +D_06010F10 = 0x06010F10; +D_06011290 = 0x06011290; +D_06011610 = 0x06011610; +D_06011990 = 0x06011990; +D_06011D10 = 0x06011D10; +D_06012090 = 0x06012090; +D_06012410 = 0x06012410; +D_06012790 = 0x06012790; +D_06012B10 = 0x06012B10; +D_06012E90 = 0x06012E90; +D_06013210 = 0x06013210; +D_06013590 = 0x06013590; // ovl_Boss_03