diff --git a/include/i5.h b/include/i5.h index f74b71bc..b491d294 100644 --- a/include/i5.h +++ b/include/i5.h @@ -52,7 +52,7 @@ void func_i5_801B58AC(Gfx **, f32); bool func_i5_801B6AEC(f32, f32, f32); s32 func_i5_801B6E20(f32, f32, f32 *, f32 *, f32 *); void func_i5_801AD144(PlayerShot*); -void func_i5_80189120(f32 x, f32 y, f32 z, f32, f32); +void func_i5_80189120(f32, f32, f32, f32, f32); bool func_i5_801A3C20(f32); s32 func_i5_801A3300(Player*, f32, f32); s32 func_i5_801A3790(Player*, f32, f32); @@ -128,4 +128,25 @@ void func_i5_801AEC04(Actor*); void func_i5_801AEEFC(Actor*); s32 func_i5_801A55D4(s32 , Vec3f* , Vec3f* , s32 ); +typedef struct { + /* 0x00 */ PosRot unk_00; + /* 0x18 */ u16 unk_18; +} UnkStruct_i5_801BD738; // size = 0x1C + +typedef struct { + /* 0x00 */ PosRot unk_00; + /* 0x18 */ f32 unk_18; + /* 0x1C */ f32 unk_1C; + /* 0x20 */ f32 unk_20; + /* 0x24 */ s16 unk_24; + /* 0x26 */ u16 unk_26; +} UnkStruct_i5_801BBF00; // size = 0x28 + +typedef struct { + s32 unk_00; + s32 unk_04; + Actor* actor; + s32 unk_0C; +} UnkStruct_i5_801B8198; // size = 0x10 + #endif diff --git a/linker_scripts/us/symbol_addrs_overlays.txt b/linker_scripts/us/symbol_addrs_overlays.txt index 07666fe7..11d82e6d 100644 --- a/linker_scripts/us/symbol_addrs_overlays.txt +++ b/linker_scripts/us/symbol_addrs_overlays.txt @@ -145,9 +145,13 @@ func_i5_801B6E20 = 0x801B6E20; D_i5_801B7584 = 0x801B7584; D_i5_801B7608 = 0x801B7608; D_i5_801B769C = 0x801B769C; +D_i5_801B8198 = 0x801B8198;//size:0x210 segment:ovl_i5 +D_i5_801B83A8 = 0x801B83A8;//size:0x814 type:f32 segment:ovl_i5 D_i5_801BA1E8 = 0x801BA1E8; D_i5_801BA708 = 0x801BA708;//size:0xC type:Vec3f segment:ovl_i5 +D_i5_801BAA50 = 0x801BAA50;//size:0x26 type:s16 segment:ovl_i5 D_i5_801BBEE0 = 0x801BBEE0; +D_i5_801BBF00 = 0x801BBF00;//size:0xA78 segment:ovl_i5 D_i5_801BE250 = 0x801BE250; D_i5_801BE258 = 0x801BE258; D_i5_801BE25C = 0x801BE25C; diff --git a/linker_scripts/us/undefined_syms.ld b/linker_scripts/us/undefined_syms.ld index bc27274c..99f66316 100644 --- a/linker_scripts/us/undefined_syms.ld +++ b/linker_scripts/us/undefined_syms.ld @@ -1216,4 +1216,62 @@ D_70024D0 = 0x070024D0; D_7002730 = 0x07002730; D_7002990 = 0x07002990; D_7002BF0 = 0x07002BF0; -D_7002E50 = 0x07002E50; \ No newline at end of file +D_7002E50 = 0x07002E50; + +// fox_ti +D_700DDF0 = 0x0700DDF0; +D_700D9B0 = 0x0700D9B0; +D_700DF70 = 0x0700DF70; +D_700DC50 = 0x0700DC50; +D_700DED0 = 0x0700DED0; +D_700DAD0 = 0x0700DAD0; +D_700DBB0 = 0x0700DBB0; +D_700E030 = 0x0700E030; +D_700D880 = 0x0700D880; +D_700D740 = 0x0700D740; +D_7005280 = 0x07005280; +D_7003C50 = 0x07003C50; +D_7003E30 = 0x07003E30; +D_7004370 = 0x07004370; +D_7004560 = 0x07004560; +D_7003A90 = 0x07003A90; +D_7005420 = 0x07005420; +D_7003FC0 = 0x07003FC0; +D_7002930 = 0x07002930; +D_7009700 = 0x07009700; +D_7004E80 = 0x07004E80; +D_70049C0 = 0x070049C0; +D_70045D0 = 0x070045D0; +D_A001FA0 = 0x0A001FA0; +D_900FE80 = 0x0900FE80; +D_80018D0 = 0x080018D0; +D_9005450 = 0x09005450; +D_8009000 = 0x08009000; +D_A002170 = 0x0A002170; +D_8001FB0 = 0x08001FB0; +D_90058A0 = 0x090058A0; +D_90042A0 = 0x090042A0; +D_90043D0 = 0x090043D0; +D_90044E0 = 0x090044E0; +D_90045F0 = 0x090045F0; +D_80020D0 = 0x080020D0; +D_7003F00 = 0x07003F00; +D_8001D20 = 0x08001D20; +D_8001E20 = 0x08001E20; +D_80011C0 = 0x080011C0; +D_8002360 = 0x08002360; +D_90051C0 = 0x090051C0; +D_8003640 = 0x08003640; +D_900FC60 = 0x0900FC60; +D_900FD70 = 0x0900FD70; +D_9005600 = 0x09005600; +D_8001630 = 0x08001630; +D_80014A0 = 0x080014A0; +D_9005040 = 0x09005040; +D_7004400 = 0x07004400; +D_7009890 = 0x07009890; +D_8001A80 = 0x08001A80; +D_A001DB0 = 0x0A001DB0; +D_A001EC0 = 0x0A001EC0; +D_A001BE0 = 0x0A001BE0; +D_7004270 = 0x07004270; \ No newline at end of file diff --git a/src/overlays/ovl_i5/fox_ti.c b/src/overlays/ovl_i5/fox_ti.c index c98c5b47..4e6cbdeb 100644 --- a/src/overlays/ovl_i5/fox_ti.c +++ b/src/overlays/ovl_i5/fox_ti.c @@ -1,141 +1,5320 @@ -#include "common.h" +#include "global.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_80188F30.s") +extern f32 D_6006924[]; +extern Gfx D_3007E70[]; +extern Animation D_700C8D8; +extern Limb* D_700C964[]; +extern Gfx D_700B9C0[]; +extern Gfx D_700C4B0[]; +extern Gfx D_700C980[]; +extern Gfx D_700E3F0[]; +extern Animation D_700D534; +extern Limb* D_700D700[]; +extern Gfx D_7009D60[]; +extern Gfx D_700A990[]; +extern Gfx D_7002490[]; +extern Limb* D_7006990[]; +extern Animation D_70067C4; +extern Animation D_7006F74; +extern Animation D_7007130; +extern Animation D_7007234; +extern Animation D_700733C; +extern Gfx D_70098E0[]; +extern Gfx D_7008930[]; +extern Gfx D_7009510[]; +extern f32 D_6006C0C[]; +extern f32 D_6006C28[]; +extern Gfx D_7000A80[]; +extern Gfx D_7002270[]; +extern s32 D_8000FC0[]; +extern Animation D_8000708; +extern Animation D_8000D80; +extern Animation D_A0002BC; +extern Animation D_A00047C; +extern Animation D_A000858; +extern Animation D_A000934; +extern Animation D_A000D50; +extern Animation D_7003EE8; +extern Animation D_70084CC; +extern Animation D_70096EC; +extern Gfx D_7009A80[]; +extern Animation D_700E244; +extern Animation D_8008FE8; +extern Animation D_9004288; +extern Animation D_900FC4C; +extern Animation D_A009990; +extern Gfx D_7005300[]; +extern Gfx D_8000D90[]; +extern Limb* D_A000568[]; +extern Limb* D_A000EDC[]; +extern Limb* D_A001A70[]; +extern Gfx D_Gfx_800D94D0[]; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_80188F60.s") +s32* D_i5_801BBEF0; +f32* D_i5_801BBEF4; +s32* D_i5_801BBEF8; +UnkStruct_i5_801BBF00 D_i5_801BBF00[67]; +Vec3f D_i5_801BC978[8]; +Vec3f D_i5_801BC9D8[8]; +Vec3f D_i5_801BCA38[76]; +Vec3f D_i5_801BCDC8[8]; +Vec3f D_i5_801BCE28[8]; +Vec3f D_i5_801BCE88[76]; +Vec3f D_i5_801BD218[92]; +s16 D_i5_801BD668[34]; +f32 D_i5_801BD6B0[34]; +UnkStruct_i5_801BD738 D_i5_801BD738[3][9]; +PosRot D_i5_801BDA30[10]; +f32 D_i5_801BDB20[3][151]; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_80188FA8.s") +static f32 D_i5_801B7360[25][4] = { + { 165.0f, 120.0f, 0.0f, 90.0f }, { 127.5f, 7.5f, 0.0f, 90.0f }, { 7.5f, -112.5f, 0.0f, 90.0f }, + { 255.0f, 285.0f, -60.0f, 60.0f }, { 255.0f, 285.0f, 60.0f, 60.0f }, { 247.5f, 120.0f, -90.0f, 75.0f }, + { 247.5f, 120.0f, 90.0f, 75.0f }, { 217.5f, -75.0f, -135.0f, 90.0f }, { 217.5f, -75.0f, 135.0f, 90.0f }, + { 90.0f, -172.5f, -157.5f, 60.0f }, { 90.0f, -172.5f, 157.5f, 60.0f }, { 72.0f, 12.0f, -3.0f, 30.0f }, + { 124.5f, 12.0f, -3.0f, 22.5f }, { 84.0f, 19.5f, -3.0f, 45.0f }, { 72.0f, 12.0f, 3.0f, 37.5f }, + { 124.5f, 12.0f, 3.0f, 22.5f }, { 84.0f, 19.5f, 3.0f, 45.0f }, { 277.5f, -55.5f, -31.5f, 30.0f }, + { 187.5f, -63.0f, -33.0f, 45.0f }, { 60.0f, -25.5f, -33.0f, 67.5f }, { 117.0f, -3.0f, -18.0f, 45.0f }, + { 277.5f, -55.5f, 31.5f, 30.0f }, { 187.5f, -63.0f, 33.0f, 45.0f }, { 60.0f, -25.5f, 33.0f, 67.5f }, + { 117.0f, -3.0f, 18.0f, 45.0f } +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_80189090.s") +static u8 D_i5_801B74F0[9][3] = { + { 13, 0, 11 }, { 1, 11, 2 }, { 2, 13, 1 }, { 3, 14, 2 }, { 4, 16, 1 }, + { 5, 17, 3 }, { 6, 20, 1 }, { 7, 21, 3 }, { 8, 24, 1 }, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_80189120.s") +static bool D_i5_801B750C[3] = { false, false, false }; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_80189194.s") +static f32 D_i5_801B7518[2] = { 20.0f, 60.0f }; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_801891B4.s") +void func_i5_80188F30(void) { + s32 i; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_801891F4.s") + for (i = 0; i < 3; i++) { + D_i5_801B750C[i] = false; + } + D_i5_801BA1E8 = 99; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_80189380.s") +void func_i5_80188F60(Effect* effect) { + if (effect->timer_50 == 0) { + effect->unk_44 -= 16; + if (effect->unk_44 < 17) { + Object_Kill(&effect->obj, effect->sfxPos); + } + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_801895B8.s") +void func_i5_80188FA8(Effect* effect) { -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_80189AFC.s") + Matrix_Scale(gGfxMatrix, effect->scale2 * 0.5f, effect->scale2, effect->scale2, 1); + Matrix_RotateX(gGfxMatrix, -(M_DTOR * 90), 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, effect->unk_44); + gSPDisplayList(gMasterDisp++, D_3007E70); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_80189B80.s") +void func_i5_80189090(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 yRot, f32 scale2) { + Effect_Initialize(effect); + effect->obj.status = OBJ_INIT; + effect->obj.id = OBJ_EFFECT_368; + effect->obj.pos.x = xPos; + effect->obj.pos.y = yPos; + effect->obj.pos.z = zPos; + effect->obj.rot.y = yRot; + effect->scale2 = scale2; + effect->timer_50 = 25; + effect->unk_44 = 255; + Object_SetInfo(&effect->info, effect->obj.id); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_80189CC8.s") +void func_i5_80189120(f32 xPos, f32 yPos, f32 zPos, f32 yRot, f32 scale2) { + s32 i; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018A1C0.s") + for (i = 50; i >= 0; i--) { + if (gEffects[i].obj.status == OBJ_FREE) { + func_i5_80189090(&gEffects[i], xPos, yPos, zPos, yRot, scale2); + break; + } + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018A2E8.s") +void func_i5_80189194(Actor* actor) { + func_i5_801B49D0(actor); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018A3F4.s") +static Vec3f D_i5_801B7520 = { -150.0f, 0.0f, 0.0f }; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018A474.s") +void func_i5_801891B4(s32 limbIndex, Vec3f* rot, void* data) { + Actor* actor = (Actor*) data; + if (limbIndex == 2) { + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B7520, (Vec3f*) &actor->fwork[0]); + } +} + +void func_i5_801891F4(Actor* actor) { + f32 temp_fs0; + f32 temp_fs1; + f32 var_fv1; + f32 temp; + f32 temp2; + + temp_fs0 = gPlayer[0].pos.x - actor->obj.pos.x; + temp_fs1 = (gPlayer[0].unk_138 + gPlayer[0].unk_08C) - actor->obj.pos.z; + + var_fv1 = Math_RadToDeg(Math_Atan2F(temp_fs0, temp_fs1)); + + if ((var_fv1 > 45.0f) && (var_fv1 < 180.0f)) { + var_fv1 = 45.0f; + } + if ((var_fv1 < 315.0f) && (var_fv1 > 180.0f)) { + var_fv1 = 315.0f; + } + Math_SmoothStepToAngle(&actor->obj.rot.y, var_fv1, 0.2f, 6.0f, 0.01f); + temp_fs0 = (actor->obj.pos.x + actor->fwork[0]) - gPlayer[0].pos.x; + temp2 = (actor->obj.pos.y + actor->fwork[1]) - (gPlayer[0].pos.y + 30.0f); + temp_fs1 = ((actor->obj.pos.z + actor->fwork[2]) - gPlayer[0].unk_138) + gPlayer[0].unk_08C; + temp = sqrtf(SQ(temp_fs0) + SQ(temp_fs1)); + Math_SmoothStepToAngle(&actor->fwork[5], Math_RadToDeg(Math_Atan2F(temp2, temp)), 0.2f, 5.0f, 0.01f); +} + +void func_i5_80189380(Actor* actor) { + Vec3f sp8C; + Vec3f sp80; + Vec3f sp74; + Vec3f sp68; + Vec3f sp5C; + Vec3f sp50; + Vec3f sp44; + Vec3f pad; + + sp50.x = actor->fwork[0]; + sp50.y = actor->fwork[1]; + sp50.z = actor->fwork[2]; + sp44.x = gPlayer[0].pos.x - actor->obj.pos.x; + sp44.y = gPlayer[0].pos.y - actor->obj.pos.y; + sp44.z = gPlayer[0].pos.z - actor->obj.pos.z; + Matrix_RotateZ(gCalcMatrix, -actor->obj.rot.z * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, -actor->obj.rot.x * M_DTOR, 1); + Matrix_RotateY(gCalcMatrix, -actor->obj.rot.y * M_DTOR, 1); + Matrix_MultVec3f(gCalcMatrix, &sp44, &sp8C); + Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, actor->obj.rot.x * M_DTOR, 1); + Matrix_RotateZ(gCalcMatrix, actor->obj.rot.z * M_DTOR, 1); + Matrix_MultVec3f(gCalcMatrix, &sp50, &sp8C); + sp80.x = actor->obj.pos.x + sp8C.x; + sp80.y = actor->obj.pos.y + sp8C.y; + sp80.z = actor->obj.pos.z + sp8C.z; + sp74.x = actor->fwork[5]; + sp74.y = actor->obj.rot.y; + sp74.z = 0.0f; + sp68.x = actor->obj.rot.x; + sp68.y = actor->obj.rot.y; + sp68.z = actor->obj.rot.z; + sp5C.x = 0.0f; + sp5C.y = 0.0f; + sp5C.z = 70.0f; + func_8007EE68(0x161, &sp80, &sp74, &sp68, &sp5C, 1.0f); + sp80.y += 20.0f; + func_8007EE68(0x161, &sp80, &sp74, &sp68, &sp5C, 1.0f); +} + +static Vec3f D_i5_801B752C = { -50.0f, 0.0f, -20.0f }; +static Vec3f D_i5_801B7538 = { 50.0f, 0.0f, -20.0f }; + +void func_i5_801895B8(Actor* actor) { + Vec3f sp54; + Vec3f sp48; + f32 sp44; + f32 sp40; + f32 sp3C; + + actor->iwork[2]++; + switch (actor->state) { + case 0: + Audio_PlaySfx(0x31000017, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + if (actor->obj.rot.z > 1.0f) { + actor->iwork[0] = 1; + } + actor->state = 1; + /* fallthrough */ + case 1: + actor->fwork[7] = 20.0f; + if (fabsf(actor->obj.pos.z - gPlayer[0].unk_138) < 3000.0f) { + actor->state = 2; + actor->timer_0BC = 30; + } + break; + case 2: + if (actor->iwork[0] == 1) { + actor->fwork[7] = 5.0f; + if (fabsf(actor->obj.pos.z - gPlayer[0].unk_138) < 200.0f) { + actor->fwork[7] = 0.0f; + } + func_i5_801891F4(actor); + } + if (actor->timer_0BC == 0) { + actor->timer_0BC = 40; + func_i5_80189380(actor); + if ((fabsf(actor->obj.pos.z - gPlayer[0].unk_138) > 200.0f) && (actor->iwork[0] == 1)) { + actor->fwork[6] = -10.0f; + } + } + break; + } + func_i5_801B6E20(actor->obj.pos.x, actor->obj.pos.z + D_80177D20, &sp44, &sp3C, &sp40); + actor->obj.pos.y = sp3C; + + if (actor->obj.rot.x < sp44 * M_RTOD) { + actor->obj.rot.x += 2.0f; + } + if (sp44 * M_RTOD < actor->obj.rot.x) { + actor->obj.rot.x -= 2.0f; + } + + if (actor->obj.rot.z < sp40 * M_RTOD) { + actor->obj.rot.z += 2.0f; + } + if (sp40 * M_RTOD < actor->obj.rot.z) { + actor->obj.rot.z -= 2.0f; + } + Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, 0); + Matrix_Push(&gCalcMatrix); + if (!(actor->iwork[2] & 1) && ((actor->obj.pos.z + D_80177D20) > -3800.0f)) { + Matrix_RotateX(gCalcMatrix, actor->obj.rot.x * M_DTOR, 1); + Matrix_RotateZ(gCalcMatrix, actor->obj.rot.z * M_DTOR, 1); + Matrix_MultVec3fNoTranslate(gCalcMatrix, &D_i5_801B752C, &sp48); + func_i5_80189120(actor->obj.pos.x + sp48.x, actor->obj.pos.y + sp48.y, actor->obj.pos.z + sp48.z, + actor->obj.pos.y, 1.3f); + Matrix_MultVec3fNoTranslate(gCalcMatrix, &D_i5_801B7538, &sp48); + func_i5_80189120(actor->obj.pos.x + sp48.x, actor->obj.pos.y + sp48.y, actor->obj.pos.z + sp48.z, + actor->obj.pos.y, 1.3f); + } + Math_SmoothStepToF(&actor->fwork[6], actor->fwork[7], 0.1f, 2.0f, 0.00001f); + Matrix_Pop(&gCalcMatrix); + sp54.x = 0.0f; + sp54.y = 0.0f; + sp54.z = actor->fwork[6]; + Matrix_MultVec3f(gCalcMatrix, &sp54, &sp48); + actor->vel.x = sp48.x; + actor->vel.y = sp48.y; + actor->vel.z = sp48.z; + if (actor->unk_0D0 > 0) { + if (Rand_ZeroOne() <= 0.25f) { + actor->unk_044 = 2; + } else { + actor->unk_044 = 0; + } + func_80066254(actor); + actor->info.bonus = 0; + func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y + 30.0f, actor->obj.pos.z, 8.0f); + func_8007C120(actor->obj.pos.x, actor->obj.pos.y + 30.0f, actor->obj.pos.z, actor->vel.x, actor->vel.y, + actor->vel.z, 0.1f, 30); + func_8007A6F0(&actor->obj.pos, 0x2903A008); + Object_Kill(&actor->obj, actor->sfxPos); + } +} + +void func_i5_80189AFC(Actor* actor) { + + Animation_GetFrameData(&D_700C8D8, 0, actor->vwork); + actor->vwork[3].z = actor->fwork[5] + 270.0f; + Animation_DrawSkeleton(1, D_700C964, actor->vwork, NULL, func_i5_801891B4, actor, &gIdentityMatrix); +} + +static Vec3f D_i5_801B7544 = { 0.0f, -50.0f, 178.0f }; + +void func_i5_80189B80(Actor* actor) { + f32 sp2C; + + func_i5_801B6E20(actor->obj.pos.x, actor->obj.pos.z + D_80177D20, &sp2C, &actor->obj.pos.y, &sp2C); + actor->health = 10; + actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_60068F0); + Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, actor->obj.rot.x * M_DTOR, 1); + Matrix_RotateZ(gCalcMatrix, actor->obj.rot.z * M_DTOR, 1); + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B7544, (Vec3f*) &actor->fwork[0]); + actor->fwork[0] += actor->obj.pos.x; + actor->fwork[1] += actor->obj.pos.y; + actor->fwork[2] += actor->obj.pos.z; +} + +void func_i5_80189CC8(Actor* actor) { + static Vec3f D_i5_801B7550 = { 0.0f, -50.0f, 178.0f }; + static Vec3f D_i5_801B755C = { 0.0f, 0.0f, 90.0f }; + Vec3f sp64; + Vec3f sp58; + Vec3f sp4C; + Vec3f sp40; + f32 temp; + + if (actor->health > 0) { + if (actor->unk_0D0 != 0) { + actor->unk_0D0 = 0; + actor->timer_0C6 = 15; + actor->health -= actor->damage; + if (actor->health <= 0) { + actor->health = 0; + Audio_PlaySfx(0x2903A008, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + actor->timer_0CA[0] = actor->unk_044 = 0; + actor->info.unk_1C = 0.0f; + func_80066254(actor); + actor->info.bonus = 0; + actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_6006924); + func_8007D0E0(actor->fwork[0], actor->fwork[1], actor->fwork[2], 2.0f); + } + } + if (actor->timer_0BC >= 15) { + sp4C.x = gPlayer[0].pos.x - actor->obj.pos.x; + sp4C.y = (gPlayer[0].pos.y + 30.0f) - actor->obj.pos.y; + sp4C.z = gPlayer[0].pos.z - actor->obj.pos.z; + Matrix_RotateZ(gCalcMatrix, -actor->obj.rot.z * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, -actor->obj.rot.x * M_DTOR, 1); + Matrix_RotateY(gCalcMatrix, -actor->obj.rot.y * M_DTOR, 1); + Matrix_MultVec3f(gCalcMatrix, &sp4C, &sp64); + sp58.x = sp64.x - D_i5_801B7550.x; + sp58.y = sp64.y - D_i5_801B7550.y; + sp58.z = sp64.z - D_i5_801B7550.z; + temp = sqrtf(SQ(sp58.x) + SQ(sp58.z)); + actor->fwork[5] = Math_RadToDeg(-Math_Atan2F(sp58.y, temp)); + actor->fwork[6] = Math_RadToDeg(Math_Atan2F(sp58.x, sp58.z)); + Math_SmoothStepToAngle(&actor->fwork[3], actor->fwork[5], 0.2f, 5.0f, 0.01f); + Math_SmoothStepToAngle(&actor->fwork[4], actor->fwork[6], 0.2f, 5.0f, 0.01f); + + if ((actor->fwork[4] > 45.0f) && (actor->fwork[4] < 180.0f)) { + actor->fwork[4] = 45.0f; + } + if ((actor->fwork[4] < 315.0f) && (actor->fwork[4] > 180.0f)) { + actor->fwork[4] = 315.0f; + } + + if ((actor->fwork[3] > 45.0f) && (actor->fwork[3] < 180.0f)) { + actor->fwork[3] = 45.0f; + } + if ((actor->fwork[3] < 315.0f) && (actor->fwork[3] > 180.0f)) { + actor->fwork[3] = 315.0f; + } + } + Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, actor->obj.rot.x * M_DTOR, 1); + Matrix_RotateZ(gCalcMatrix, actor->obj.rot.z * M_DTOR, 1); + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B7550, &sp64); + sp40.x = actor->fwork[3]; + sp40.y = actor->fwork[4]; + sp40.z = 0.0f; + + if ((actor->timer_0BC < 15) && ((actor->timer_0BC % 7) == 0)) { + func_8007EE68(0x161, (Vec3f*) &actor->fwork[0], &sp40, &actor->obj.rot, &D_i5_801B755C, 1.0f); + if (actor->timer_0BC == 0) { + actor->timer_0BC = 90; + } + } + } else if (!(gGameFrameCount & 7) && (Rand_ZeroOne() < 0.5f)) { + Audio_PlaySfx(0x11000027, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + func_8007C120(actor->fwork[0], actor->fwork[1], actor->fwork[2], 0.0f, 0.0f, 0.0f, 0.1f, 7); + actor->timer_0C6 = 4; + } +} + +void func_i5_8018A1C0(Actor* actor) { + gSPDisplayList(gMasterDisp++, D_700C4B0); + Matrix_Translate(gGfxMatrix, 0.0f, -50.0f, 178.0f, 1); + Matrix_RotateY(gGfxMatrix, actor->fwork[4] * M_DTOR, 1); + Matrix_RotateX(gGfxMatrix, actor->fwork[3] * M_DTOR, 1); + Matrix_SetGfxMtx(&gMasterDisp); + if (actor->health != 0) { + gSPDisplayList(gMasterDisp++, D_700B9C0); + RCP_SetupDL(&gMasterDisp, 0x21); + gSPDisplayList(gMasterDisp++, D_700C980); + } +} + +static f32 D_i5_801B7568[7] = { 1.0f, 0.0f, 25.0f, 0.0f, 12.0f, 0.0f, 12.0f }; +extern Gfx D_700DDF0[]; +extern Gfx D_700D9B0[]; +extern Gfx D_700DF70[]; +extern Gfx D_700DC50[]; +extern Gfx D_700DED0[]; +extern Gfx D_700DAD0[]; +extern Gfx D_700DBB0[]; +extern Gfx D_700E030[]; +extern Gfx D_700D880[]; +extern Gfx D_700D740[]; +Gfx* D_i5_801B7584[10] = { + D_700DDF0, D_700D9B0, D_700DF70, D_700DC50, D_700DED0, D_700DAD0, D_700DBB0, D_700E030, D_700D880, D_700D740, +}; + +void func_i5_8018A2E8(Actor* actor, f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32 yVel, f32 zVel) { + + Actor_Initialize(actor); + actor->obj.status = OBJ_ACTIVE; + actor->obj.id = OBJ_ACTOR_230; + actor->timer_0BC = RAND_INT(20.0f) + 20; + actor->timer_0C2 = 8; + actor->vel.x = xVel; + actor->vel.y = yVel; + actor->vel.z = zVel; + actor->obj.pos.x = xPos; + actor->obj.pos.y = yPos; + actor->obj.pos.z = zPos; + actor->scale = RAND_FLOAT(0.2f) + 0.3f; + Object_SetInfo(&actor->info, actor->obj.id); + actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_i5_801B7568); +} + +void func_i5_8018A3F4(f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32 yVel, f32 zVel) { + s32 i; + + for (i = 0; i < ARRAY_COUNT(gActors); i++) { + if (gActors[i].obj.status == OBJ_FREE) { + func_i5_8018A2E8(&gActors[i], xPos, yPos, zPos, xVel, yVel, zVel); + gActors[i].info.damage = 0; + break; + } + } +} + +void func_i5_8018A474(Actor* actor) { + s32 i; + + for (i = 0; i < 4; i++) { + func_i5_8018A3F4(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, RAND_FLOAT_CENTERED(40.0f), + RAND_FLOAT_CENTERED(40.0f), RAND_FLOAT(-20.0f)); + } +} + +#ifdef NON_MATCHING +// Regalloc +// https://decomp.me/scratch/0X1gk +void func_i5_8018A544(Actor* actor) { + f32 temp_fv0; + f32 temp_fv1; + f32 sp4C; + f32 sp48; + f32 sp44; + s32 var_v0; + + actor->unk_0C9 = 1; + if ((actor->scale != 1.0f) && (actor->unk_0D0 == 3)) { + Object_Kill(&actor->obj, actor->sfxPos); + } + if (actor->unk_0D0 != 0) { + actor->unk_0D0 = 0; + actor->timer_0C6 = 15; + actor->health += actor->damage; + if (actor->scale == 1.0f) { + if (actor->health >= 10) { + func_8007A6F0(&actor->obj.pos, 0x1903400F); + var_v0 = actor->iwork[0]; + if (var_v0) { + actor->iwork[actor->iwork[1]] = 0; + } + func_8007A900(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 8.0f, 0xFF, 8, 1); + if (Rand_ZeroOne() < 0.3f) { + actor->unk_044 = 1; + } else { + func_i5_8018A474(actor); + actor->unk_044 = 0; + } + func_80066254(actor); + actor->info.bonus = 0; + } + Object_Kill(&actor->obj, actor->sfxPos); + } else { + func_8007A900(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 8.0f, 0xFF, 8, 1); + Object_Kill(&actor->obj, actor->sfxPos); + + var_v0 = actor->iwork[0]; + if (var_v0) { + actor->iwork[actor->iwork[1]] = 0; + } + } + } + if (actor->unk_046 == 2) { + actor->gravity = 0.0f; + func_i5_801B6E20(actor->obj.pos.x, actor->obj.pos.z + D_80177D20, &sp4C, &sp44, &sp48); + actor->fwork[0] = sp4C; + actor->fwork[1] = sp44; + actor->fwork[2] = sp48; + return; + } + actor->gravity = 3.0f; + func_i5_801B6E20(actor->obj.pos.x, actor->obj.pos.z + D_80177D20, &sp4C, &sp44, &sp48); + actor->fwork[0] = sp4C; + actor->fwork[1] = sp44; + actor->fwork[2] = sp48; + temp_fv1 = (actor->scale * 50.0f); + if (actor->obj.pos.y > sp44 + temp_fv1) { + actor->unk_046 = 0; + } else { + actor->obj.pos.y = sp44 + temp_fv1; + if (actor->unk_046 == 0) { + if (actor->vel.y < -6.0f) { + Audio_PlaySfx(0x19020006, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + if (actor->vel.y < 0.0f) { + actor->vel.y = -actor->vel.y * 0.2f; + } + actor->vel.x -= (10.0f * sp48) / (M_DTOR * 90); + actor->vel.z += (10.0f * sp4C) / (M_DTOR * 90); + if (actor->vel.y < 10.0f) { + actor->vel.y = 0.0f; + } + actor->unk_046 = 1; + } else { + if ((s32) sp48 == 0) { + actor->vel.x *= 0.9; + } + if ((s32) sp4C == 0) { + actor->vel.z *= 0.9; + } + actor->vel.y = 0.0f; + } + actor->vel.x -= (3.0f * sp48) / (M_DTOR * 90); + actor->vel.z += (3.0f * sp4C) / (M_DTOR * 90); + } + + temp_fv1 = actor->scale * 314.0f; + if (actor->vel.x != 0.0f) { + var_v0 = (actor->vel.x > 0) ? 1 : (actor->vel.x == 0.0f) ? 0 : -1; + + actor->obj.rot.x += ((sqrtf(SQ(actor->vel.x) + SQ(actor->vel.z)) * 360.0f) / temp_fv1) * (f32) var_v0; + } else { + var_v0 = (actor->vel.z > 0) ? 1 : (actor->vel.z == 0.0f) ? 0 : -1; + + actor->obj.rot.x += ((sqrtf(SQ(actor->vel.x) + SQ(actor->vel.z)) * 360.0f) / temp_fv1) * (f32) var_v0; + } + actor->obj.rot.y = Math_RadToDeg(Math_Atan2F(actor->vel.x, actor->vel.z)); + if (actor->obj.rot.y >= 180.0f) { + actor->obj.rot.y -= 180.0f; + } + if (actor->obj.rot.y < 0.0f) { + actor->obj.rot.y += 180.0f; + } +} +#else #pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018A544.s") +#endif -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018AABC.s") +void func_i5_8018AABC(Actor* actor) { + if (actor->scale != 1.0f) { + Matrix_Scale(gGfxMatrix, actor->scale, actor->scale, actor->scale, 1); + Matrix_SetGfxMtx(&gMasterDisp); + } + gSPDisplayList(gMasterDisp++, D_700E3F0); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018AB44.s") +void func_i5_8018AB44(Actor* actor) { + f32 sp3C; + f32 sp38; + f32 sp34; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018ADC4.s") + switch (actor->state) { + case 0: + actor->gravity = 1.0f; + func_i5_801B6E20(actor->obj.pos.x, actor->obj.pos.z + D_80177D20, &sp3C, &sp34, &sp38); + if (actor->obj.pos.y <= (sp34 + 3.0f)) { + Audio_PlaySfx(0x19000024, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + actor->obj.pos.y = sp34 + 3.0f; + actor->obj.rot.x = sp3C * (M_RTOD); + actor->obj.rot.z = sp38 * (M_RTOD); + actor->vel.y = 0.0f; + actor->gravity = 0.0f; + actor->state++; + } + break; + case 1: + break; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018AFD4.s") + switch (actor->unk_0D0) { + case 1: + Audio_PlaySfx(0x29022086, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + break; + case 2: + actor->unk_044 = 0; + func_80066254(actor); + actor->info.bonus = 0; + func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y + 10.0f, actor->obj.pos.z, 6.0f); + func_8007A6F0(&actor->obj.pos, 0x2903B009); + Object_Kill(&actor->obj, actor->sfxPos); + break; + case 3: + func_8007A6F0(&actor->obj.pos, 0x2903B009); + func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y + 50.0f, actor->obj.pos.z, (10.0f / 3.0f)); + gPlayer[0].vel.y = 20.0f; + gPlayer[0].pos.y += 15.0f; + gPlayer[0].unk_1DC = 1; + gPlayer[0].timer_1E8 = 15; + gPlayer[0].unk_1EC = 20; + if (actor->obj.pos.x < gPlayer[0].pos.x) { + gPlayer[0].unk_1EC = -20; + } + Object_Kill(&actor->obj, actor->sfxPos); + break; + } + actor->unk_0D0 = 0; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018AFF0.s") +static Vec3f D_i5_801B75AC = { -70.0f, 50.0f, 212.0f }; +static Vec3f D_i5_801B75B8 = { 70.0f, 50.0f, 212.0f }; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018B144.s") +void func_i5_8018ADC4(Actor* actor) { + Vec3f sp68[2]; + s32 i; + s32 k; + Actor* actorPtr; + f32 sp58; + f32 sp54; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018B1B4.s") + actor->fwork[0] = actor->obj.rot.z; + actor->fwork[1] = actor->obj.rot.x; + actor->obj.rot.z = 0.0f; + actor->obj.rot.x = 0.0f; + func_i5_801B6E20(actor->obj.pos.x, actor->obj.pos.z + D_80177D20, &sp54, &sp58, &sp54); + actor->obj.pos.y = sp58; + Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, 0); + Matrix_MultVec3fNoTranslate(gCalcMatrix, &D_i5_801B75AC, &sp68[0]); + Matrix_MultVec3fNoTranslate(gCalcMatrix, &D_i5_801B75B8, &sp68[1]); + k = 0; + actorPtr = gActors; + for (i = 0; i < 60; i++, actorPtr++) { + if (actorPtr->obj.status == OBJ_FREE) { + Actor_Initialize(actorPtr); + actorPtr->obj.status = OBJ_INIT; + actorPtr->obj.id = OBJ_ACTOR_230; + actorPtr->obj.pos.x = actor->obj.pos.x + sp68[k].x; + actorPtr->obj.pos.y = actor->obj.pos.y + sp68[k].y; + actorPtr->obj.pos.z = actor->obj.pos.z + sp68[k].z; + actorPtr->unk_046 = 2; + actorPtr->iwork[0] = (uintptr_t) actor; + actorPtr->iwork[1] = k; + Object_SetInfo(&actorPtr->info, actorPtr->obj.id); + actor->iwork[k] = (uintptr_t) actorPtr; + k++; + if ((k >= 2)) { + break; + } + } + } + actor->health = 40; + if (k < 2) { + for (i = 0; i < k; i++) { + Object_Kill(&gActors[actor->iwork[k]].obj, gActors[actor->iwork[k]].sfxPos); + } + Object_Kill(&actor->obj, actor->sfxPos); + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018B268.s") +bool func_i5_8018AFD4(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* data) { + *dList = NULL; + return false; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018B6AC.s") +bool func_i5_8018AFF0(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* data) { + if ((limbIndex == 2) || (limbIndex == 3) || (limbIndex == 4)) { + Matrix_Translate(gCalcMatrix, pos->x, pos->y, pos->z, 1); + Matrix_RotateZ(gCalcMatrix, rot->z * M_DTOR, 1); + Matrix_RotateY(gCalcMatrix, rot->y * M_DTOR, 1); + Matrix_RotateX(gCalcMatrix, rot->x * M_DTOR, 1); + Matrix_Mult(gGfxMatrix, gCalcMatrix, 1); + Matrix_SetGfxMtx(&gMasterDisp); + RCP_SetupDL(&gMasterDisp, 0x21); + gSPDisplayList(gMasterDisp++, *dList); + RCP_SetupDL(&gMasterDisp, 0x1D); + return true; + } + return false; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018B720.s") +static Vec3f D_i5_801B75C4 = { 110.0f, 0.0f, 0.0f }; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018B96C.s") +void func_i5_8018B144(s32 limbIndex, Vec3f* rot, void* data) { + Actor* actor = (Actor*) data; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018B9D0.s") + switch (limbIndex) { + case 2: + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B75C4, (Vec3f*) &actor->fwork[3]); + break; + case 4: + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B75C4, (Vec3f*) &actor->fwork[6]); + break; + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018BE84.s") +static s16 D_i5_801B75D0[] = { + 1, 2, 3, 4, 5, 6, 7, 10, 12, 13, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018BFB0.s") +void func_i5_8018B1B4(s32 limbIndex, Vec3f* rot, void* data) { + s32 i; + PosRot* var_a2; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018C118.s") + var_a2 = SEGMENTED_TO_VIRTUAL(D_i5_801BDA30); -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018C134.s") + for (i = 0; i < 10; i++, var_a2++) { + if (limbIndex == D_i5_801B75D0[i]) { + Matrix_MultVec3f(gCalcMatrix, &D_800C9F2C, &var_a2->pos); + Matrix_GetYRPAngles(gCalcMatrix, &var_a2->rot); + break; + } + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018C370.s") +void func_i5_8018B268(Actor* actor) { + Vec3f sp4C; + Vec3f sp40; + Actor* sp3C; + Actor* sp38; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018C3D8.s") + sp3C = actor->iwork[0]; + sp38 = actor->iwork[1]; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018C72C.s") + if (actor->unk_0D0 > 0) { + actor->unk_0D0 = 0; + if (actor->health > 0) { + actor->health -= actor->damage; + if (actor->health <= 0) { + actor->health = actor->unk_044 = 0; + func_80066254(actor); + actor->info.bonus = 0; + } + } + actor->timer_0C6 = 10; + } + switch (actor->state) { + case 0: + if ((gPlayer[0].pos.z - actor->obj.pos.z) < actor->fwork[0]) { + actor->state++; + } + break; + case 1: + Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, 0); + if ((actor->unk_0B6 >= 26) && (actor->unk_0B6 <= 53) && (sp3C != NULL)) { + if (actor->unk_0B6 == 26) { + sp3C->unk_046 = 2; + sp3C->vel.x = 0.0f; + sp3C->vel.y = 0.0f; + sp3C->vel.z = 0.0f; + } else if (actor->unk_0B6 == 53) { + sp4C.x = 0.0f; + sp4C.y = actor->fwork[1]; + sp4C.z = 20.0f; + Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp4C, &sp40); + sp3C->vel.x = sp40.x; + sp3C->vel.y = sp40.y; + sp3C->vel.z = sp40.z; + sp3C->unk_046 = 0; + sp3C->iwork[0] = (uintptr_t) NULL; + actor->iwork[0] = (uintptr_t) NULL; + } + sp4C.x = actor->fwork[3]; + sp4C.y = actor->fwork[4] + 50.0f; + sp4C.z = actor->fwork[5]; + Matrix_MultVec3f(gCalcMatrix, &sp4C, &sp40); + sp3C->obj.pos.x = actor->obj.pos.x + sp40.x; + sp3C->obj.pos.y = actor->obj.pos.y + sp40.y; + sp3C->obj.pos.z = actor->obj.pos.z + sp40.z; + } + if ((actor->unk_0B6 >= 26) && (actor->unk_0B6 <= 57) && (sp38 != NULL)) { + if (actor->unk_0B6 == 26) { + sp38->unk_046 = 2; + sp38->vel.x = 0.0f; + sp38->vel.y = 0.0f; + sp38->vel.z = 0.0f; + } else if (actor->unk_0B6 == 57) { + Audio_PlaySfx(0x29000028, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + sp4C.x = 0.0f; + sp4C.y = actor->fwork[1]; + sp4C.z = 20.0f; + Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp4C, &sp40); + sp38->vel.x = sp40.x; + sp38->vel.y = sp40.y; + sp38->vel.z = sp40.z; + sp38->unk_046 = 0; + sp38->iwork[0] = (uintptr_t) NULL; + actor->iwork[1] = (uintptr_t) NULL; + } + sp4C.x = actor->fwork[6]; + sp4C.y = actor->fwork[7] + 50.0f; + sp4C.z = actor->fwork[8]; + Matrix_MultVec3f(gCalcMatrix, &sp4C, &sp40); + sp38->obj.pos.x = actor->obj.pos.x + sp40.x; + sp38->obj.pos.y = actor->obj.pos.y + sp40.y; + sp38->obj.pos.z = actor->obj.pos.z + sp40.z; + } + + if (++actor->unk_0B6 >= Animation_GetFrameCount(&D_700D534)) { + actor->state++; + } + break; + case 2: + break; + } + if (actor->health == 0) { + actor->obj.status = OBJ_DYING; + Animation_GetFrameData(&D_700D534, actor->unk_0B6, actor->vwork); + Animation_DrawSkeleton(0, D_700D700, actor->vwork, func_i5_8018AFD4, func_i5_8018B1B4, actor, &gIdentityMatrix); + func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 10.0f); + actor->timer_0CA[0] = 0; + actor->info.unk_1C = 0.0f; + } +} + +void func_i5_8018B6AC(Actor* actor) { + Animation_GetFrameData(&D_700D534, actor->unk_0B6, actor->vwork); + Animation_DrawSkeleton(0, D_700D700, actor->vwork, func_i5_8018AFF0, func_i5_8018B144, actor, &gIdentityMatrix); +} + +void func_i5_8018B720(Actor* actor) { + PosRot* var_s1; + Actor* actorPtr; + s32 i; + Vec3f sp70; + + Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, 0); + var_s1 = SEGMENTED_TO_VIRTUAL(D_i5_801BDA30); + for (i = 0; i < 10; i++, var_s1++) { + actorPtr = func_800A3608(OBJ_ACTOR_189); + if (actorPtr != NULL) { + actorPtr->obj.status = OBJ_ACTIVE; + actorPtr->state = 46; + actorPtr->unk_048 = i; + Matrix_MultVec3f(gCalcMatrix, &var_s1->pos, &sp70); + actorPtr->obj.pos.x = actor->obj.pos.x + sp70.x; + actorPtr->obj.pos.y = actor->obj.pos.y + sp70.y; + actorPtr->obj.pos.z = actor->obj.pos.z + sp70.z; + actorPtr->obj.rot.x = actor->obj.rot.x + var_s1->rot.x; + actorPtr->obj.rot.y = actor->obj.rot.y + var_s1->rot.y; + actorPtr->obj.rot.z = actor->obj.rot.z + var_s1->rot.z; + actorPtr->gravity = 1.0f; + actorPtr->vel.x = sp70.x * 0.05f; + actorPtr->vel.y = 20.0f; + actorPtr->vel.z = sp70.z * 0.05f; + actorPtr->fwork[0] = RAND_FLOAT(4.0f) - 6.0f; + actorPtr->fwork[1] = RAND_FLOAT(4.0f) - 6.0f; + actorPtr->fwork[2] = RAND_FLOAT(4.0f) - 6.0f; + } + } + actorPtr = actor->iwork[0]; + if (actorPtr != NULL) { + actorPtr->iwork[0] = (uintptr_t) NULL; + actor->iwork[0] = (uintptr_t) NULL; + actorPtr->unk_046 = 0; + } + actorPtr = actor->iwork[1]; + if (actorPtr != NULL) { + actorPtr->unk_046 = 0; + actorPtr->iwork[0] = (uintptr_t) NULL; + actor->iwork[1] = (uintptr_t) NULL; + } + Object_Kill(&actor->obj, actor->sfxPos); +} + +void func_i5_8018B96C(Actor* actor) { + f32 sp24; + + func_i5_801B6E20(actor->obj.pos.x, actor->obj.pos.z + D_80177D20, &sp24, &actor->obj.pos.y, &sp24); + actor->obj.rot.x = actor->obj.rot.y = actor->obj.rot.z = 0.0f; + actor->obj.pos.y -= 20.0f; +} + +void func_i5_8018B9D0(Actor* actor) { + s32 var_v1; + f32 sp50; + f32 sp4C; + f32 sp48; + f32 sp44; + f32 sp40; + f32 sp3C; + f32 temp_fa1; + f32 var_fa0; + + // FAKE + var_v1 = actor->state; + actor->unk_0C9 = 1; + switch (var_v1) { + case 0: + sp44 = gPlayer[0].pos.x - actor->obj.pos.x; + sp40 = gPlayer[0].pos.y - actor->obj.pos.y; + sp3C = gPlayer[0].pos.z - actor->obj.pos.z; + if (actor->timer_0BE == 7) { + actor->iwork[0] = 2; + Audio_PlaySfx(0x19000032, actor->sfxPos, 0, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + if (actor->timer_0BE == 0) { + temp_fa1 = SQ(sp44) + SQ(sp40) + SQ(sp3C); + if (temp_fa1 < 27639.062f) { + actor->timer_0BE = 8; + } else { + if (temp_fa1 < 360000.0f) { + actor->timer_0BE = 0; + if (actor->timer_0BC == 0) { + Audio_PlaySfx(0x19000029, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + actor->iwork[0] = 1 - actor->iwork[0]; + actor->timer_0BC = 5; + } + } else { + actor->iwork[0] = 0; + } + } + } + if (actor->timer_0BE == 1) { + func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 10.0f); + Object_Kill(&actor->obj, actor->sfxPos); + Player_ApplyDamage(gPlayer, 0, 60); + gPlayer[0].vel.y = 20.0f; + gPlayer[0].pos.y += 15.0f; + gPlayer[0].unk_1DC = 1; + gPlayer[0].timer_1E8 = 15; + gPlayer[0].unk_1EC = 20; + if (actor->obj.pos.x < gPlayer[0].pos.x) { + gPlayer[0].unk_1EC = -20; + } + } + break; + case 1: + func_i5_801B6E20(actor->obj.pos.x, actor->obj.pos.z + D_80177D20, &sp4C, &sp50, &sp48); + actor->fwork[0] = sp50; + actor->fwork[1] = sp4C; + actor->fwork[2] = sp48; + if (actor->vel.y <= 0.0f) { + actor->unk_044 = 0; + func_80066254(actor); + func_8007A6F0(&actor->obj.pos, 0x2903B009); + func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 10.0f); + Object_Kill(&actor->obj, actor->sfxPos); + } + break; + } + + if (fabsf(actor->vel.x) > 130.0f) { + var_v1 = (actor->vel.x > 0.0f) ? 1 : (actor->vel.x == 0.0f) ? 0 : -1; + var_fa0 = var_v1 * 130.0f; + } else { + var_fa0 = actor->vel.x; + } + + actor->obj.rot.z = (-var_fa0 / 130.0f) * 90.0f; + if (fabsf(actor->vel.z) > 130.0f) { + var_v1 = (actor->vel.z > 0.0f) ? 1 : (actor->vel.z == 0.0f) ? 0 : -1; + var_fa0 = var_v1 * 130.0f; + } else { + var_fa0 = actor->vel.z; + } + actor->obj.rot.x = (var_fa0 / 130.0f) * 90.0f; + if (actor->unk_0D0 == 1) { + Audio_PlaySfx(0x19020008, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + sp44 = actor->obj.pos.x - actor->unk_0D8.x; + sp40 = fabsf(sp44); + actor->unk_0D0 = 0; + actor->state = 1; + actor->timer_0BC = 0; + actor->timer_0BE = 0; + actor->iwork[0] = 0; + actor->vel.x += sp44 * 0.5f * 0.8f; + actor->vel.z -= (80.0f - sp40) * 0.8f; + actor->vel.y += 34.0f; + actor->gravity = 2.0f; + } +} + +static s32 D_i5_801B75E4[3][3] = { + { 15, 255, 255 }, + { 0, 255, 0 }, + { 0, 0, 0 }, +}; + +extern Gfx D_7005280[]; +extern Gfx D_7003C50[]; +extern Gfx D_7003E30[]; +extern Gfx D_7004370[]; +extern Gfx D_7004560[]; +extern Gfx D_7003A90[]; +extern Gfx D_7005420[]; +extern Gfx D_7003FC0[]; +extern Gfx D_7002930[]; + +Gfx* D_i5_801B7608[10] = { + D_7005280, D_7003C50, D_7003E30, D_7004370, D_7004560, D_7003A90, D_7005420, D_7003FC0, D_7002930, D_7002490, +}; + +void func_i5_8018BE84(Actor* actor) { + s32 index; + + RCP_SetupDL(&gMasterDisp, 0x1E); + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255); + Matrix_Scale(gGfxMatrix, 1.5f, 1.5f, 1.5f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_7009D60); + RCP_SetupDL(&gMasterDisp, 0x22); + index = actor->iwork[0]; + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, D_i5_801B75E4[0][index], D_i5_801B75E4[1][index], + D_i5_801B75E4[2][index], 255); + gSPDisplayList(gMasterDisp++, D_700A990); +} + +void func_i5_8018BFB0(Actor* actor) { + UnkStruct_i5_801BD738* temp_a1; + s32 temp_a2; + s32 i; + + for (i = 0; i < 3; i++) { + if (!D_i5_801B750C[i]) { + D_i5_801B750C[i] = true; + actor->iwork[0] = i; + break; + } + } + if (i == 3) { + Object_Kill(&actor->obj, actor->sfxPos); + return; + } + + temp_a2 = actor->iwork[0]; + actor->info.hitbox = D_i5_801BDB20[temp_a2]; + actor->health = 80; + actor->iwork[8] = 1; + temp_a1 = D_i5_801BD738[temp_a2]; + + for (i = 0; i < 9; i++) { + temp_a1[i].unk_00.pos.x = temp_a1[i].unk_00.pos.y = temp_a1[i].unk_00.pos.z = temp_a1[i].unk_00.rot.x = + temp_a1[i].unk_00.rot.y = temp_a1[i].unk_00.rot.z = 0.0f; + temp_a1[i].unk_18 = 0; + } +} + +bool func_i5_8018C118(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* data) { + *dList = NULL; + return false; +} + +static s16 D_i5_801B7630[18] = { + 1, 0, 2, 1, 3, 0, 4, 1, 5, 1, 6, 0, 7, 1, 8, 0, 13, 1, +}; + +bool func_i5_8018C134(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* data) { + Actor* actor = (Actor*) data; + s32 sp58; + s32 i; + s32 sp50; + + sp50 = actor->iwork[0]; + sp58 = false; + for (i = 0; i < 9; i++) { + if (limbIndex == D_i5_801B7630[i * 2]) { + if (!(D_i5_801BD738[sp50][i].unk_18 & 1)) { + Matrix_Translate(gCalcMatrix, pos->x, pos->y, pos->z, 1); + sp58 = true; + Matrix_RotateZ(gCalcMatrix, rot->z * M_DTOR, 1); + Matrix_RotateY(gCalcMatrix, rot->y * M_DTOR, 1); + Matrix_RotateX(gCalcMatrix, rot->x * M_DTOR, 1); + Matrix_Mult(gGfxMatrix, gCalcMatrix, 1); + Matrix_SetGfxMtx(&gMasterDisp); + if ((limbIndex == 13) && (actor->iwork[5] & 2) && (actor->iwork[6] == 0)) { + RCP_SetupDL(&gMasterDisp, 0x1E); + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 0, 0, 255); + gSPDisplayList(gMasterDisp++, *dList); + RCP_SetupDL(&gMasterDisp, 0x1D); + } else { + gSPDisplayList(gMasterDisp++, *dList); + } + } else { + *dList = NULL; + } + } + } + + return sp58; +} + +void func_i5_8018C370(s32 limbIndex, Vec3f* rot, void* data) { + Actor* actor = (Actor*) data; + + if ((limbIndex == 13) && !(D_i5_801BD738[actor->iwork[0]][8].unk_18 & 1)) { + gSPDisplayList(gMasterDisp++, D_7002490); + } +} + +static Vec3f D_i5_801B7654 = { 387.0f, 0.0f, 0.0f }; +static Vec3f D_i5_801B7660 = { 199.5f, 0.0f, 0.0f }; + +void func_i5_8018C3D8(s32 limbIndex, Vec3f* rot, void* data) { + s32 i; + s32 j; + Vec3f sp54; + Vec3f sp48; + UnkStruct_i5_801BD738* var_s0; + s32 var_t0; + f32* var_v0_2; + f32* var_s0_2; + s32 temp; + Actor* actor = (Actor*) data; + + var_s0 = D_i5_801BD738[actor->iwork[0]]; + var_s0[8].unk_18 |= 2; + + for (i = 0; i < 9U; i++, var_s0++) { + if ((limbIndex == D_i5_801B7630[i * 2]) && (var_s0->unk_18 & 2)) { + Matrix_MultVec3f(gCalcMatrix, &D_800C9F2C, &var_s0->unk_00.pos); + Matrix_GetYRPAngles(gCalcMatrix, &var_s0->unk_00.rot); + var_s0->unk_18 &= ~2; + break; + } + } + + actor->fwork[27] = D_i5_801BD738[actor->iwork[0]][8].unk_00.pos.y; + switch (actor->iwork[2]) { + case 0: + switch (limbIndex) { + case 1: + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B7660, (Vec3f*) &actor->fwork[12]); + break; + case 3: + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B7660, (Vec3f*) &actor->fwork[9]); + break; + case 5: + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B7654, (Vec3f*) &actor->fwork[3]); + break; + case 7: + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B7654, (Vec3f*) &actor->fwork[6]); + break; + } + break; + case 1: + switch (limbIndex) { + case 1: + Matrix_MultVec3f(gCalcMatrix, &D_800C9F2C, (Vec3f*) &actor->fwork[12]); + break; + case 3: + Matrix_MultVec3f(gCalcMatrix, &D_800C9F2C, (Vec3f*) &actor->fwork[9]); + break; + case 5: + Matrix_MultVec3f(gCalcMatrix, &D_800C9F2C, (Vec3f*) &actor->fwork[3]); + break; + case 7: + Matrix_MultVec3f(gCalcMatrix, &D_800C9F2C, (Vec3f*) &actor->fwork[6]); + break; + } + break; + } + var_v0_2 = actor->info.hitbox; + if (actor->iwork[8] != 0) { + var_v0_2[0] = 25.0f; + var_v0_2++; + + for (i = 0; i < 9U; i++) { + var_t0 = D_i5_801B74F0[i][2]; + if (limbIndex == D_i5_801B74F0[i][0]) { + temp = D_i5_801B74F0[i][1]; + for (j = 0; j < var_t0; j++) { + var_s0_2 = D_i5_801B7360[temp + j]; + sp54.x = var_s0_2[0]; + sp54.y = var_s0_2[1]; + sp54.z = var_s0_2[2]; + Matrix_MultVec3f(gCalcMatrix, &sp54, &sp48); + var_v0_2[0] = sp48.z; + var_v0_2[1] = var_s0_2[3]; + var_v0_2[2] = sp48.y; + var_v0_2[3] = var_s0_2[3]; + var_v0_2[4] = sp48.x; + var_v0_2[5] = var_s0_2[3]; + var_v0_2 += 6; + } + break; + } + var_v0_2 += var_t0 * 6; + } + } else { + var_v0_2[0] = 0.0f; + } +} + +void func_i5_8018C72C(Actor* actor) { + s32 i; + f32 sp30; + + actor->state = 8; + Audio_PlaySfx(0x29030098, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + + for (i = 0; i < 9; i++) { + D_i5_801BD738[actor->iwork[0]][i].unk_18 |= 2; + } + + sp30 = actor->vwork[0].y; + actor->vwork[0].y += actor->fwork[26]; + Animation_DrawSkeleton(0, D_7006990, actor->vwork, func_i5_8018C118, func_i5_8018C3D8, actor, &gIdentityMatrix); + actor->vwork[0].y = sp30; + actor->iwork[7] = 0; + actor->iwork[8] = 0; +} + +static Vec3f D_i5_801B766C = { 0.0f, 0.0f, 15.0f }; + +#ifdef NON_EQUIVALENT +// strange section on lines 113-118 in scratch +// https://decomp.me/scratch/EoG59 + +void func_i5_8018C8A8(Actor* actor) { + u32 i; + f32 sp170; + s32 pad; + Actor* actorPtr; + UnkStruct_i5_801BD738* var_s1; + Vec3f sp158; + Vec3f spA4[15]; + f32 spA0; + f32 sp9C; + f32 sp98; + Vec3f sp8C; + f32 sp88; + f32 temp_fs0; + f32 temp_fv0; + + actor->iwork[7]++; + sp88 = gPlayer[0].unk_138 - actor->obj.pos.z; + // fake label to temp align things + // label: + if (actor->iwork[4] > 0) { + actor->iwork[4]--; + } else if ((gPlayer[0].unk_1D4 != 0) && (actor->iwork[3] > 0)) { + D_80137E84[0] = 1; + actor->iwork[3]--; + } + + if (actor->iwork[5] > 0) { + actor->iwork[5]--; + } + + if (actor->iwork[6] > 0) { + actor->iwork[6]--; + } + + if (actor->health > 0) { + if ((actor->unk_0D0 > 0) && (actor->unk_0D0 != 3)) { + if (actor->state >= 3) { + if ((actor->health > 0) && (actor->unk_0D2 >= 0) && (actor->unk_0D2 < 3)) { + actor->iwork[5] = 10; + if (actor->state == 4) { + func_8001A55C(actor->sfxPos, 0x31030043); + actor->timer_0BC = 20; + actor->fwork[24] = 1.0f; + actor->fwork[23] = actor->unk_0B6; + } + actor->health -= actor->damage; + if (actor->health <= 0) { + BonusText_Display(actor->obj.pos.x, actor->obj.pos.y, actor->fwork[27] + actor->obj.pos.z, 3); + gHitCount += 3; + actor->health = actor->unk_044 = 0; + func_80066254(actor); + actor->info.bonus = 0; + actor->timer_0BC = 20; + actor->unk_0B6 = 0; + actor->fwork[15] = 0.0f; + } else { + Audio_PlaySfx(0x29034041, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + } else if (actor->unk_0D0 == 1) { + func_8007A6F0(&actor->obj.pos, 0x29121007); + } + actor->unk_0D0 = 0; + } + } + } + + switch (actor->state) { + case 0: + Audio_PlaySfx(0x29023020, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + actor->unk_0F4.y = actor->obj.rot.y; + actor->obj.rot.y = 180.0f; + actor->obj.pos.y += 125.0f; + actor->gravity = 1.0f; + actor->unk_0C9 = 1; + actor->vel.y = 20.0f; + actor->vel.z = -70.0f; + Animation_GetFrameData(&D_700733C, 0, actor->vwork); + Animation_DrawSkeleton(1, D_7006990, actor->vwork, func_i5_8018C118, func_i5_8018C3D8, actor, + &gIdentityMatrix); + actor->state = 1; + break; + case 1: + func_i5_801B6E20(actor->obj.pos.x, actor->obj.pos.z + gPlayer[0].unk_144, &spA0, &sp9C, &sp98); + actor->fwork[0] = sp9C; + actor->fwork[1] = spA0; + actor->fwork[2] = sp98; + Animation_GetFrameData(&D_700733C, 0, spA4); + Math_SmoothStepToVec3fArray(spA4, actor->vwork, 1, 15, 0.2f, 10.0f, 0.01f); + Animation_DrawSkeleton(1, D_7006990, actor->vwork, func_i5_8018C118, func_i5_8018C3D8, actor, + &gIdentityMatrix); + if (actor->obj.pos.z <= gPlayer[0].pos.z) { + Math_SmoothStepToAngle(&actor->obj.rot.y, actor->unk_0F4.y, 0.2f, 10.0f, 0.01f); + } + if ((actor->obj.pos.y + actor->fwork[7] + actor->fwork[26]) <= sp9C) { + Audio_PlaySfx(0x29034021, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + actor->fwork[16] = actor->obj.pos.y = sp9C; + actor->unk_0F4.x = spA0 * M_RTOD; + actor->unk_0F4.z = sp98 * M_RTOD; + actor->gravity = 0.0f; + actor->vel.x = actor->vel.y = actor->vel.z = 0.0f; + actor->timer_0BC = 10; + func_8007A900(actor->obj.pos.x + actor->fwork[6], actor->obj.pos.y + actor->fwork[7] + actor->fwork[26], + actor->obj.pos.z + actor->fwork[8], 20.0f, 0xFF, 8, 0); + func_8007A900(actor->obj.pos.x + actor->fwork[3], actor->obj.pos.y + actor->fwork[4] + actor->fwork[26], + actor->obj.pos.z + actor->fwork[5], 20.0f, 0xFF, 8, 0); + temp_fv0 = fabsf(sp88); + if (temp_fv0 < 5000.0f) { + actor->iwork[4] = (s32) (temp_fv0 / 200.0f); + actor->iwork[3] = (s32) ((5000.0f - temp_fv0) / 714.0f); + } + actor->state = 2; + } + actor->fwork[15] = 0.0f; + Matrix_RotateX(gCalcMatrix, actor->obj.rot.x * M_DTOR, 0); + Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, 1); + Matrix_RotateZ(gCalcMatrix, actor->obj.rot.z * M_DTOR, 1); + Matrix_MultVec3f(gCalcMatrix, (Vec3f*) &actor->fwork[12], &sp8C); + actor->fwork[12] = sp8C.x; + actor->fwork[13] = sp8C.y; + actor->fwork[14] = sp8C.z; + Matrix_MultVec3f(gCalcMatrix, (Vec3f*) &actor->fwork[9], &sp8C); + actor->fwork[9] = sp8C.x; + actor->fwork[10] = sp8C.y; + actor->fwork[11] = sp8C.z; + Matrix_MultVec3f(gCalcMatrix, (Vec3f*) &actor->fwork[3], &sp8C); + actor->fwork[3] = sp8C.x; + actor->fwork[4] = sp8C.y; + actor->fwork[5] = sp8C.z; + Matrix_MultVec3f(gCalcMatrix, (Vec3f*) &actor->fwork[6], &sp8C); + actor->fwork[6] = sp8C.x; + actor->fwork[7] = sp8C.y; + actor->fwork[8] = sp8C.z; + break; + case 2: + Math_SmoothStepToAngle(&actor->obj.rot.x, actor->unk_0F4.x, 0.5f, 5.0f, 0.01f); + Math_SmoothStepToAngle(&actor->obj.rot.z, actor->unk_0F4.z, 0.5f, 5.0f, 0.01f); + actor->obj.pos.y = actor->fwork[0] = actor->fwork[16]; + actor->fwork[1] = actor->unk_0F4.x; + actor->fwork[2] = actor->unk_0F4.z; + Animation_GetFrameData(&D_7007234, 0, spA4); + Math_SmoothStepToVec3fArray(spA4, actor->vwork, 1, 15, 0.5f, 7.0, 0.1f); + temp_fs0 = actor->vwork[0].y; + actor->vwork[0].y += actor->fwork[26]; + Animation_DrawSkeleton(0, D_7006990, actor->vwork, func_i5_8018C118, func_i5_8018C3D8, actor, + &gIdentityMatrix); + actor->vwork[0].y = temp_fs0; + actor->fwork[15] = 0.0f; + if (actor->timer_0BC == 0) { + actor->timer_0BC = 15; + actor->state++; + Audio_PlaySfx(0x31030043, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + Math_SmoothStepToF(&actor->fwork[26], -60.0f, actor->fwork[15], 500.0f, 0.01f); + break; + case 3: + if (actor->timer_0BC == 0) { + actor->state = 4; + } + Animation_GetFrameData(&D_70067C4, actor->unk_0B6, spA4); + Math_SmoothStepToVec3fArray(spA4, actor->vwork, 1, 0xF, 0.1f, 3.0f, 0.01f); + temp_fs0 = actor->vwork[0].y; + actor->vwork[0].y += actor->fwork[26]; + Animation_DrawSkeleton(0, D_7006990, actor->vwork, func_i5_8018C118, func_i5_8018C3D8, actor, + &gIdentityMatrix); + actor->vwork[0].y = temp_fs0; + actor->fwork[15] = 0.0f; + Math_SmoothStepToF(&actor->fwork[26], -60.0f, 0.0f, 500.0f, 0.01f); + if (actor->health <= 0) { + actor->state = 5; + actor->unk_0B6 = 0; + actor->timer_0BC = 30; + actor->iwork[6] = 30; + actor->fwork[15] = 0.0f; + } + break; + case 4: + func_i5_801B6E20(actor->obj.pos.x, actor->obj.pos.z + D_80177D20, &spA0, &sp9C, &sp98); + actor->fwork[0] = sp9C; + actor->fwork[1] = spA0; + actor->fwork[2] = sp98; + actor->obj.pos.y = sp9C; + Math_SmoothStepToAngle(&actor->obj.rot.x, spA0 * M_RTOD, 0.1f, 1.0f, 0.01f); + Math_SmoothStepToAngle(&actor->obj.rot.z, sp98 * M_RTOD, 0.1f, 1.0f, 0.01f); + + if (actor->timer_0BC == 0) { + if (((actor->unk_0B6 == 0x28) || (actor->unk_0B6 == 0x50)) && (actor->timer_0BC == 0)) { + Audio_PlaySfx(0x2902201F, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + Math_SmoothStepToF(&actor->fwork[0xF], 1.0f, 0.7f, 0.1f, 0.01f); + actor->unk_0B6++; + if (actor->unk_0B6 >= Animation_GetFrameCount(&D_70067C4)) { + actor->unk_0B6 = 0; + } + if ((actor->fwork[4] > 0.0f) || (actor->fwork[7] > 0.0f)) { + Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, 0); + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B766C, &sp158); + actor->obj.pos.x += sp158.x; + actor->obj.pos.z += sp158.z; + } + } else { + Math_SmoothStepToF(&actor->fwork[15], 0.0f, 1.0f, 0.2f, 0.01f); + Math_SmoothStepToF(&actor->fwork[24], 0.0f, 1.0f, 0.1f, 0.01f); + actor->fwork[23] += actor->fwork[24]; + if ((f32) Animation_GetFrameCount(&D_70067C4) <= actor->fwork[23]) { + actor->fwork[23] = 0.0f; + } + actor->unk_0B6 = actor->fwork[23]; + if (actor->timer_0BC == 1) { + Audio_PlaySfx(0x31030043, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + } + Animation_GetFrameData(&D_70067C4, actor->unk_0B6, spA4); + Math_SmoothStepToVec3fArray(spA4, actor->vwork, 1, 15, actor->fwork[15], 360.0f, 0.01f); + temp_fs0 = actor->vwork[0].y; + actor->vwork[0].y += actor->fwork[26]; + Animation_DrawSkeleton(0, D_7006990, actor->vwork, func_i5_8018C118, func_i5_8018C3D8, actor, + &gIdentityMatrix); + actor->vwork[0].y = temp_fs0; + Math_SmoothStepToF(&actor->fwork[26], -60.0f, actor->fwork[15], 500.0f, 0.01f); + if (actor->health <= 0) { + actor->iwork[6] = 300; + actor->state = 5; + actor->unk_0B6 = 0; + actor->timer_0BC = 30; + actor->fwork[15] = 0.0f; + Audio_PlaySfx(0x29030098, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + break; + case 5: + Math_SmoothStepToF(&actor->fwork[15], 1.0f, 1.0f, 0.015f, 0.01f); + Animation_GetFrameData(&D_7007130, actor->unk_0B6, spA4); + Math_SmoothStepToVec3fArray(spA4, actor->vwork, 1, 15, actor->fwork[15], 360.0f, 0.01f); + Math_SmoothStepToF(&actor->fwork[26], -40.0f, actor->fwork[15], 500.0f, 0.01f); + temp_fs0 = actor->vwork[0].y; + actor->vwork[0].y += actor->fwork[26]; + Animation_DrawSkeleton(0, D_7006990, actor->vwork, func_i5_8018C118, func_i5_8018C3D8, actor, + &gIdentityMatrix); + actor->vwork[0].y = temp_fs0; + actor->unk_0B6++; + if (actor->unk_0B6 >= Animation_GetFrameCount(&D_7007130)) { + actor->unk_0B6 = 0; + } + if (actor->timer_0BC == 0) { + actor->state = 6; + actor->unk_0B6 = 0; + actor->fwork[15] = 0.0f; + } + break; + case 6: + if (actor->unk_0B6 == 18) { + actor->iwork[8] = 0; + } + actor->iwork[2] = 1; + Math_SmoothStepToF(&actor->fwork[15], 1.0f, 1.0f, 0.005f, 0.01f); + Animation_GetFrameData(&D_7006F74, actor->unk_0B6, spA4); + Math_SmoothStepToVec3fArray(spA4, actor->vwork, 1, 15, actor->fwork[15], 360.0f, 0.01f); + temp_fs0 = actor->vwork[0].y; + actor->vwork[0].y += actor->fwork[26]; + Animation_DrawSkeleton(0, D_7006990, actor->vwork, func_i5_8018C118, func_i5_8018C3D8, actor, + &gIdentityMatrix); + actor->vwork[0].y = temp_fs0; + if (actor->unk_0B6 == 0x15) { + Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, actor->obj.rot.x * M_DTOR, 1); + Matrix_RotateZ(gCalcMatrix, actor->obj.rot.z * M_DTOR, 1); + Matrix_MultVec3f(gCalcMatrix, (Vec3f*) &actor->fwork[12], &sp158); + func_8007A900(actor->obj.pos.x + sp158.x, actor->obj.pos.y + sp158.y, actor->obj.pos.z + sp158.z, 20.0f, + 0xFF, 8, 0); + Matrix_MultVec3f(gCalcMatrix, (Vec3f*) &actor->fwork[9], &sp158); + func_8007A900(actor->obj.pos.x + sp158.x, actor->obj.pos.y + sp158.y, actor->obj.pos.z + sp158.z, 20.0f, + 0xFF, 8, 0); + Matrix_MultVec3f(gCalcMatrix, (Vec3f*) &actor->fwork[3], &sp158); + func_8007A900(actor->obj.pos.x + sp158.x, actor->obj.pos.y + sp158.y, actor->obj.pos.z + sp158.z, 20.0f, + 0xFF, 8, 0); + Matrix_MultVec3f(gCalcMatrix, (Vec3f*) &actor->fwork[6], &sp158); + func_8007A900(actor->obj.pos.x + sp158.x, actor->obj.pos.y + sp158.y, actor->obj.pos.z + sp158.z, 20.0f, + 0xFF, 8, 0); + Audio_PlaySfx(0x19030003, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + if (!(actor->timer_0BC & 7)) { + Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, actor->obj.rot.x * M_DTOR, 1); + Matrix_RotateZ(gCalcMatrix, actor->obj.rot.z * M_DTOR, 1); + Matrix_MultVec3f(gCalcMatrix, (Vec3f*) &actor->fwork[0xC], &sp158); + func_8007D2C8(actor->obj.pos.x + sp158.x, actor->obj.pos.y + sp158.y, actor->obj.pos.z + sp158.z, 1.5f); + Matrix_MultVec3f(gCalcMatrix, (Vec3f*) &actor->fwork[9], &sp158); + func_8007D2C8(actor->obj.pos.x + sp158.x, actor->obj.pos.y + sp158.y, actor->obj.pos.z + sp158.z, 1.5f); + Matrix_MultVec3f(gCalcMatrix, (Vec3f*) &actor->fwork[3], &sp158); + func_8007D2C8(actor->obj.pos.x + sp158.x, actor->obj.pos.y + sp158.y, actor->obj.pos.z + sp158.z, 1.5f); + Matrix_MultVec3f(gCalcMatrix, (Vec3f*) &actor->fwork[6], &sp158); + func_8007D2C8(actor->obj.pos.x + sp158.x, actor->obj.pos.y + sp158.y, actor->obj.pos.z + sp158.z, 1.5f); + } + + if (actor->unk_0B6 < (Animation_GetFrameCount(&D_7006F74) - 1)) { + actor->unk_0B6++; + } else { + func_i5_8018C72C(actor); + } + break; + case 7: + Animation_GetFrameData(&D_7006F74, actor->unk_0B6, spA4); + Math_SmoothStepToVec3fArray(spA4, actor->vwork, 1, 15, actor->fwork[15], 360.0f, 0.01f); + break; + case 8: + switch (actor->iwork[7]) { + case 1: + for (i = 0; i < 9; i++) { + D_i5_801BD738[actor->iwork[0]][i].unk_18 |= 1; + } + Audio_PlaySfx(0x2940C00A, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + D_80178480 = 20; + D_Timer_80177BD0[0] = 16; + Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, actor->obj.rot.x * M_DTOR, 1); + Matrix_RotateZ(gCalcMatrix, actor->obj.rot.z * M_DTOR, 1); + func_8007D2C8(actor->obj.pos.x, actor->fwork[0x1B] + actor->obj.pos.y, actor->obj.pos.z, 15.0f); + var_s1 = D_i5_801BD738[actor->iwork[0]]; + for (i = 0; i < 9; i++, var_s1++) { + actorPtr = func_800A3608(0xBD); + if ((actorPtr != NULL) && D_i5_801B7630[2 * i + 1] == 1) { + actorPtr->state = 0x2F; + actorPtr->unk_048 = i; + Matrix_MultVec3f(gCalcMatrix, &var_s1->unk_00.pos, &sp158); + actorPtr->obj.pos.x = actor->obj.pos.x + sp158.x; + actorPtr->obj.pos.y = actor->obj.pos.y + sp158.y; + actorPtr->obj.pos.z = actor->obj.pos.z + sp158.z; + actorPtr->obj.rot.x = var_s1->unk_00.rot.x + actor->obj.rot.x; + actorPtr->obj.rot.y = var_s1->unk_00.rot.y + actor->obj.rot.y; + actorPtr->obj.rot.z = var_s1->unk_00.rot.z + actor->obj.rot.z; + sp170 = Math_Atan2F(var_s1->unk_00.pos.z, var_s1->unk_00.pos.x); + actorPtr->vel.x = __sinf(sp170) * ((Rand_ZeroOne() * 5.0f) + 7.0f); + actorPtr->vel.z = __cosf(sp170) * ((Rand_ZeroOne() * 5.0f) + 7.0f); + actorPtr->vel.y = (Rand_ZeroOne() * 10.0f) + 7.0f; + actorPtr->iwork[0] = 1; + actorPtr->iwork[1] = 1; + if (i != 8) { + actorPtr->fwork[0] = + ((Rand_ZeroOne() < 0.5f) ? -1.0f : 1.0f) * ((Rand_ZeroOne() * 3.0f) + 4.0f); + actorPtr->fwork[1] = + ((Rand_ZeroOne() < 0.5f) ? -1.0f : 1.0f) * ((Rand_ZeroOne() * 3.0f) + 4.0f); + actorPtr->fwork[2] = + ((Rand_ZeroOne() < 0.5f) ? -1.0f : 1.0f) * ((Rand_ZeroOne() * 3.0f) + 4.0f); + } else { + actorPtr->fwork[0] = ((Rand_ZeroOne() < 0.5f) ? -1.0f : 1.0f) * (Rand_ZeroOne() + 0.5f); + actorPtr->fwork[1] = ((Rand_ZeroOne() < 0.5f) ? -1.0f : 1.0f) * (Rand_ZeroOne() + 0.5f); + actorPtr->fwork[2] = ((Rand_ZeroOne() < 0.5f) ? -1.0f : 1.0f) * (Rand_ZeroOne() + 0.5f); + } + actorPtr->gravity = 0.8f; + } + if (i == 8) { + actorPtr = func_800A3608(0xBD); + if (actorPtr != NULL) { + actorPtr->state = 0x2F; + actorPtr->unk_048 = 9; + Matrix_MultVec3f(gCalcMatrix, &var_s1->unk_00.pos, &sp158); + actorPtr->obj.pos.x = actor->obj.pos.x + sp158.x; + actorPtr->obj.pos.y = actor->obj.pos.y + sp158.y; + actorPtr->obj.pos.z = actor->obj.pos.z + sp158.z; + actorPtr->obj.rot.x = var_s1->unk_00.rot.x + actor->obj.rot.x; + actorPtr->obj.rot.y = var_s1->unk_00.rot.y + actor->obj.rot.y; + actorPtr->obj.rot.z = var_s1->unk_00.rot.z + actor->obj.rot.z; + sp170 = Math_Atan2F(var_s1->unk_00.pos.z, var_s1->unk_00.pos.x); + actorPtr->vel.x = __sinf(sp170) * ((Rand_ZeroOne() * 5.0f) + 7.0f); + actorPtr->vel.z = __cosf(sp170) * ((Rand_ZeroOne() * 5.0f) + 7.0f); + actorPtr->vel.y = (Rand_ZeroOne() * 10.0f) + 7.0f; + actorPtr->iwork[0] = 1; + actorPtr->iwork[1] = 1; + actorPtr->fwork[0] = ((Rand_ZeroOne() < 0.5f) ? -1.0f : 1.0f) * (Rand_ZeroOne() * 0.7f); + actorPtr->fwork[1] = ((Rand_ZeroOne() < 0.5f) ? -1.0f : 1.0f) * (Rand_ZeroOne() * 0.7f); + actorPtr->fwork[2] = ((Rand_ZeroOne() < 0.5f) ? -1.0f : 1.0f) * (Rand_ZeroOne() * 0.7f); + actorPtr->gravity = 0.8f; + } + } + } + break; + case 4: + D_80178348 = D_80178350 = D_80178354 = D_80178340 = 255; + D_80178358 = 0; + D_8017835C = 0x40; + break; + case 5: + D_i5_801B750C[actor->iwork[0]] = false; + Object_Kill(&actor->obj, actor->sfxPos); + break; + } + break; + } + + if (actor->health > 0) { + actor->info.unk_1C = actor->fwork[27]; + } else { + actor->timer_0CA[0] = 0; + actor->info.unk_1C = 0.0f; + } + actor->unk_0D0 = 0; +} +#else #pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018C8A8.s") +#endif -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018E2D8.s") +void func_i5_8018E2D8(Actor* actor) { + f32 sp34; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018E3B0.s") + if (actor->iwork[6] & 1) { + RCP_SetupDL(&gMasterDisp, 0x1F); + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 127, 0, 0, 255); + gDPSetEnvColor(gMasterDisp++, 255, 255, 255, 255); + } + sp34 = actor->vwork[0].y; + actor->vwork[0].y += actor->fwork[26]; + Animation_DrawSkeleton(0, D_7006990, actor->vwork, func_i5_8018C134, func_i5_8018C370, actor, &gIdentityMatrix); + actor->vwork[0].y = sp34; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018E3CC.s") +void func_i5_8018E3B0(Actor* actor) { + D_i5_801B750C[actor->iwork[0]] = false; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018E54C.s") +static Vec3f D_i5_801B7678 = { 0.0f, 388.0f, 103.0f }; +static Vec3f D_i5_801B7684 = { 0.0f, 0.0f, 0.0f }; // unused -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018E5B4.s") +void func_i5_8018E3CC(Actor* actor) { + Actor* actorPtr; + f32 sp40; + Vec3f sp34; + s32 i; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018E5E8.s") + func_i5_801B6E20(actor->obj.pos.x, actor->obj.pos.z + D_80177D20, &sp40, &actor->obj.pos.y, &sp40); + actor->obj.pos.y -= 20.0f; + actorPtr = gActors; + for (i = 0; i < 60; i++, actorPtr++) { + if (actorPtr->obj.status == OBJ_FREE) { + Actor_Initialize(actorPtr); + actorPtr->obj.status = OBJ_INIT; + actorPtr->obj.id = OBJ_ACTOR_228; + Object_SetInfo(&actorPtr->info, actorPtr->obj.id); + actorPtr->iwork[4] = (uintptr_t) actor; + actor->iwork[0] = (uintptr_t) actorPtr; + actorPtr->fwork[6] = D_i5_801B7518[0]; + actorPtr->obj.rot.x = (D_i5_801B7518[0] + D_i5_801B7518[1]) * 0.5f; + Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, 0); + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B7678, &sp34); + actorPtr->obj.pos.x = actor->fwork[0] = actor->obj.pos.x + sp34.x; + actorPtr->obj.pos.y = actor->fwork[1] = actor->obj.pos.y + sp34.y; + actorPtr->obj.pos.z = actor->fwork[2] = actor->obj.pos.z + sp34.z; + actorPtr->obj.rot.y = actor->obj.rot.y; + break; + } + } + if (i == 60) { + Object_Kill(&actor->obj, actor->sfxPos); + } +} +void func_i5_8018E54C(Actor* actor) { + + actor->iwork[1]++; + if ((actor->iwork[0] == (uintptr_t) NULL) && !(actor->iwork[1] & 3)) { + func_8007C120(actor->fwork[0], actor->fwork[1], actor->fwork[2], 0.0f, 0.0f, 0.0f, 0.0625f, 10); + } +} + +void func_i5_8018E5B4(Actor* actor) { + gSPDisplayList(gMasterDisp++, D_70098E0); +} + +void func_i5_8018E5E8(Actor* actor) { + actor->health = 100; +} + +#ifdef NON_MATCHING +// a/v regalloc +// https://decomp.me/scratch/sZkSb + +void func_i5_8018E5F8(Actor* actor) { + f32 spA4; + f32 spA0; + f32 sp9C; + Vec3f sp90; + Vec3f sp84; + f32 sp80; + f32 sp7C; + Effect* temp_v0_3; + f32 sp74; + f32 sp70; + f32 sp6C; + f32 sp68; + f32 sp64; + f32 sp60; + f32 sp5C; + Effect* temp_v0_4; + f32 sp54; + s32 i; + UnkEntity30* temp_v0_2; + f32 sp48; + f32 sp44; + f32 sp40; + s32 index; + + sp9C = gPlayer[0].pos.x - actor->obj.pos.x; + spA0 = (gPlayer[0].pos.y - actor->obj.pos.y) - 30.0f; + spA4 = gPlayer[0].unk_138 - actor->obj.pos.z; + + switch (actor->state) { + case 0: + if (Math_SmoothStepToAngle(&actor->obj.rot.x, actor->fwork[6], 0.2f, 1.0f, 0.01f) == 0.0f) { + actor->iwork[1] = 1 - actor->iwork[1]; + actor->fwork[6] = D_i5_801B7518[actor->iwork[1]]; + } + if (spA4 <= 2500.0f) { + actor->state++; + } + break; + case 1: + actor->fwork[7] = Math_Atan2F(sp9C, spA4) * M_RTOD; + actor->fwork[6] = -Math_Atan2F(spA0, sqrtf(SQ(sp9C) + SQ(spA4))) * M_RTOD; + Math_SmoothStepToAngle(&actor->obj.rot.y, actor->fwork[7], 0.1f, 1.3333334f, 0.01f); + Math_SmoothStepToAngle(&actor->obj.rot.x, actor->fwork[6], 0.1f, 1.3333334f, 0.01f); + break; + case 2: + if (actor->obj.rot.y < 0.0f) { + actor->obj.rot.y += 360.0f; + } else if (actor->obj.rot.y >= 360.0f) { + actor->obj.rot.y -= 360.0f; + } + if (actor->obj.rot.y > 180.0f) { + actor->fwork[8] = 90.0f; + } else { + actor->fwork[8] = 270.0f; + } + actor->fwork[9] = 0.0f; + actor->timer_0BC = 10; + func_8007D0E0(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 10.0f); + actor->iwork[2] = 1; + if (actor->iwork[3] > 0) { + gUnkEntities30[actor->iwork[3] - 1].mode = 0; + } + actor->state++; + break; + case 3: + Math_SmoothStepToF(&actor->fwork[9], 5.0f, 0.05f, 0.5f, 0.01f); + Math_SmoothStepToAngle(&actor->obj.rot.z, actor->fwork[8], 1.0f, actor->fwork[9], 0.01f); + if (actor->timer_0BC == 0) { + actor->gravity = 0.5f; + } + if (actor->timer_0BE == 0) { + func_8007D0E0(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 10.0f); + actor->timer_0BE = 0xA; + } + func_i5_801B6E20(actor->obj.pos.x, actor->obj.pos.z + D_80177D20, &sp80, &sp7C, &sp80); + if (actor->obj.pos.y < (94.0f + sp7C)) { + spA4 = fabsf(spA4); + if (fabsf(spA4) < 5000.0f) { + actor->iwork[7] = (s32) (spA4 / 200.0f); + actor->iwork[8] = (s32) ((5000.0f - spA4) / 714.0f); + } + Audio_PlaySfx(0x19130003, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + actor->vel.y = 0.0f; + actor->gravity = 0.0f; + actor->obj.pos.y = 94.0f + sp7C; + actor->state++; + } + break; + case 4: + if (actor->iwork[7] > 0) { + actor->iwork[7]--; + } else if ((gPlayer[0].unk_1D4 != 0) && (actor->iwork[8] > 0)) { + D_80137E84[0] = 1; + actor->iwork[8]--; + } + break; + } + if ((actor->state == 0) || (actor->state == 1)) { + Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, actor->obj.rot.x * M_DTOR, 1); + sp90.x = 0.0f; + sp90.y = 39.0f; + sp90.z = 115.0f; + Matrix_MultVec3f(gCalcMatrix, &sp90, &sp84); + actor->fwork[0] = sp84.x; + actor->fwork[1] = sp84.y; + actor->fwork[2] = sp84.z; + sp90.x = 0.0f; + sp90.y = 39.0f; + sp90.z = 3115.0f; + Matrix_MultVec3f(gCalcMatrix, &sp90, &sp84); + actor->fwork[3] = sp84.x; + actor->fwork[4] = sp84.y; + actor->fwork[5] = sp84.z; + if (actor->unk_0D0 > 0) { + actor->unk_0D0 = 0; + actor->timer_0C6 = 0xA; + if (actor->health > 0) { + actor->health -= actor->damage; + if (actor->health <= 0) { + BonusText_Display(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z + actor->fwork[27], 2); + gHitCount += 2; + actor->timer_0CA[0] = actor->health = actor->unk_044 = 0; + actor->info.unk_1C = 0.0f; + func_80066254(actor); + actor->info.bonus = 0; + ((Actor*) actor->iwork[4])->iwork[0] = 0; + actor->iwork[5] = 0; + actor->state = 2; + } + } + } + } + + if (actor->iwork[3] == 0) { + for (i = 0; i < 100; i++) { + if (gUnkEntities30[i].mode == 0) { + actor->iwork[3] = i + 1; + break; + } + } + } + + sp68 = (actor->fwork[3] - actor->fwork[0]) / 3000.0f; + sp64 = (actor->fwork[4] - actor->fwork[1]) / 3000.0f; + sp60 = (actor->fwork[5] - actor->fwork[2]) / 3000.0f; + sp40 = actor->obj.pos.x + actor->fwork[0]; + sp44 = actor->obj.pos.y + actor->fwork[1]; + sp48 = actor->obj.pos.z + actor->fwork[2]; + + for (i = 0; i <= 3000; i += 50) { + sp5C = (sp68 * i) + sp40; + sp54 = (sp60 * i) + sp48; + func_i5_801B6E20(sp5C, sp54 + D_80177D20, &sp74, &sp70, &sp6C); + if ((sp64 * i) + sp44 < sp70) { + break; + } + } + + if (actor->iwork[2] == 0) { + index = actor->iwork[3] - 1; + gUnkEntities30[index].mode = 0x65; + gUnkEntities30[index].unk_04.x = actor->obj.pos.x + actor->fwork[0]; + gUnkEntities30[index].unk_04.y = actor->obj.pos.y + actor->fwork[1]; + gUnkEntities30[index].unk_04.z = actor->obj.pos.z + actor->fwork[2]; + gUnkEntities30[index].unk_2C = 0xFF; + gUnkEntities30[index].unk_2D = 0xFF; + gUnkEntities30[index].unk_2E = 0; + gUnkEntities30[index].unk_2F = 0xFF; + gUnkEntities30[index].unk_10.x = sp5C; + gUnkEntities30[index].unk_10.y = sp70; + gUnkEntities30[index].unk_10.z = sp54; + gUnkEntities30[index].unk_28 = 3.0f; + if (actor->timer_0C0 == 0) { + gUnkEntities30[index].unk_2C = 0xFF; + gUnkEntities30[index].unk_2D = 0xFF; + gUnkEntities30[index].unk_2E = 0x40; + } else { + gUnkEntities30[index].unk_2C = 0xFF; + gUnkEntities30[index].unk_2D = 0x64; + gUnkEntities30[index].unk_2E = 0; + } + if (i < 0xBB9) { + if (actor->timer_0C0 == 0) { + func_8007D1E0(sp5C, sp70 + 5.0f, sp54, 2.0f); + } + temp_v0_3 = actor->iwork[5]; + if (temp_v0_3 == NULL) { + temp_v0_4 = func_8007783C(OBJ_EFFECT_373); + if (temp_v0_4 != NULL) { + temp_v0_4->obj.status = OBJ_ACTIVE; + temp_v0_4->obj.pos.x = sp5C; + temp_v0_4->obj.pos.y = sp70 + 5.0f; + temp_v0_4->obj.pos.z = sp54; + temp_v0_4->timer_50 = 2; + actor->iwork[5] = (uintptr_t) temp_v0_4; + Audio_PlaySfx(0x3100001E, temp_v0_4->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + } else { + temp_v0_3->obj.pos.x = sp5C; + temp_v0_3->obj.pos.y = (f32) (sp70 + 5.0f); + temp_v0_3->obj.pos.z = sp54; + temp_v0_3->timer_50 = 2; + } + } else { + actor->iwork[5] = 0; + } + if (actor->timer_0C0 == 0) { + actor->timer_0C0 = 3; + } + } +} +#else #pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018E5F8.s") +#endif -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018EF14.s") +void func_i5_8018EF14(Actor* actor) { -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018EFF0.s") + gSPDisplayList(gMasterDisp++, D_7008930); + if (!(actor->timer_0C6 & 1)) { + RCP_SetupDL(&gMasterDisp, 0x22); + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 220, 220, 220, 255); + } else { + RCP_SetupDL(&gMasterDisp, 0x16); + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 0, 0, 0, 255); + } + gSPDisplayList(gMasterDisp++, D_7009510); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018F038.s") +void func_i5_8018EFF0(Object_4C* obj4C) { + f32 sp24; + f32 sp20; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018F0D8.s") + func_i5_801B6E20(obj4C->obj.pos.x, obj4C->obj.pos.z + D_80177D20, &sp20, &sp24, &sp20); + obj4C->obj.pos.y = sp24; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018F134.s") +void func_i5_8018F038(Object_4C* obj4C) { + obj4C->obj.rot.y = + Math_Atan2F(gPlayer[0].camEye.x - obj4C->obj.pos.x, gPlayer[0].camEye.z - (obj4C->obj.pos.z + D_80177D20)) * + M_RTOD; + if (obj4C->unk_46 != 0) { + func_8007D074(obj4C->obj.pos.x, obj4C->obj.pos.y + 96.0f, obj4C->obj.pos.z, 4.0f); + obj4C->obj.status = OBJ_FREE; + func_8007A6F0(&obj4C->obj.pos, 0x1903400F); + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018F4D8.s") +void func_i5_8018F0D8(Object_80* obj80) { -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018F8B8.s") + if (obj80->obj.rot.x != 0.0f) { + if (obj80->obj.rot.x >= 10000.0f) { + obj80->unk_44 = 1; + obj80->obj.rot.x -= 10000.0f; + } + obj80->vel.y = obj80->obj.rot.x; + obj80->obj.rot.x = 0.0f; + } + obj80->vel.z = obj80->obj.pos.x; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018FA48.s") +static Vec3f D_i5_801B7690 = { 0.0f, 460.0f, 0.0f }; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8018FC70.s") +extern Gfx D_7009700[]; +extern Gfx D_7004E80[]; +extern Gfx D_70049C0[]; +extern Gfx D_70045D0[]; +extern Gfx D_A001FA0[]; +extern Gfx D_900FE80[]; +extern Gfx D_80018D0[]; +extern Gfx D_9005450[]; +extern Gfx D_8009000[]; +extern Gfx D_A002170[]; +extern Gfx D_8001FB0[]; +extern Gfx D_90058A0[]; +extern Gfx D_90042A0[]; +extern Gfx D_90043D0[]; +extern Gfx D_90044E0[]; +extern Gfx D_90045F0[]; +extern Gfx D_80020D0[]; +extern Gfx D_7003F00[]; +extern Gfx D_8001D20[]; +extern Gfx D_8001E20[]; +extern Gfx D_80011C0[]; +extern Gfx D_8002360[]; +extern Gfx D_90051C0[]; +extern Gfx D_8003640[]; +extern Gfx D_900FC60[]; +extern Gfx D_900FD70[]; +extern Gfx D_9005600[]; +extern Gfx D_8001630[]; +extern Gfx D_80014A0[]; +extern Gfx D_9005040[]; +extern Gfx D_7004400[]; +extern Gfx D_7009890[]; +extern Gfx D_8001A80[]; +extern Gfx D_A001DB0[]; +extern Gfx D_A001EC0[]; +extern Gfx D_A001BE0[]; +extern Gfx D_7004270[]; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8019002C.s") +Gfx* D_i5_801B769C[39] = { + D_7009700, D_7004E80, D_70049C0, D_70045D0, D_A001FA0, D_900FE80, D_80018D0, D_9005450, NULL, D_8009000, + D_A002170, D_8001FB0, D_90058A0, D_90042A0, D_90043D0, D_90044E0, D_90045F0, D_80020D0, D_7003F00, D_8001D20, + D_8001E20, NULL, D_80011C0, D_8002360, D_90051C0, D_8003640, D_900FC60, D_900FD70, D_9005600, D_8001630, + D_80014A0, D_9005040, D_7004400, D_7009890, D_8001A80, D_A001DB0, D_A001EC0, D_A001BE0, D_7004270, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_801903A0.s") +void func_i5_8018F134(Object_80* obj80) { + Vec3f sp7C; + Vec3f sp70; + f32 i; + f32* j = &D_i5_801B7690.x; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_8019081C.s") + switch (obj80->unk_44) { + case 0: + Matrix_RotateY(gCalcMatrix, obj80->obj.rot.y * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, obj80->obj.rot.x * M_DTOR, 1); + if ((obj80->obj.rot.y <= 30.0f) || (obj80->obj.rot.y >= 330.0f)) { + for (*j = -80.0f; *j <= 80.0f; *j += 40.0f) { + Matrix_MultVec3fNoTranslate(gCalcMatrix, &D_i5_801B7690, &sp70); + func_8007A900(obj80->obj.pos.x + sp70.x, obj80->obj.pos.y + sp70.y, obj80->obj.pos.z + sp70.z, + 10.0f, 0xFF, 15, 0); + } + } else { + sp7C.z = 0.0f; + sp7C.x = -80.0f; + if (obj80->obj.rot.y > 90.0f) { + sp7C.x = 80.0f; + } + for (i = 0.0f; i <= 450.0f; i += 50.0f) { + Matrix_RotateY(gCalcMatrix, obj80->obj.rot.y * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, obj80->obj.rot.x * M_DTOR, 1); + sp7C.y = i; + Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp7C, &sp70); + func_8007A900(obj80->obj.pos.x + sp70.x, obj80->obj.pos.y + sp70.y, obj80->obj.pos.z + sp70.z, + 10.0f, 0xFF, 15, 0); + } + } + break; + case 1: + Matrix_RotateZ(gCalcMatrix, obj80->obj.rot.z * M_DTOR, 0); + sp7C.z = 0.0f; + sp7C.x = 0.0f; + for (i = 0.0f; i <= 450.0f; i += 50.0f) { + sp7C.y = i; + Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp7C, &sp70); + func_8007A900(obj80->obj.pos.x + sp70.x, obj80->obj.pos.y + sp70.y, obj80->obj.pos.z + sp70.z, 10.0f, + 0xFF, 15, 0); + } + break; + } +} + +void func_i5_8018F4D8(Object_80* obj80) { + f32 temp; + + switch (obj80->state) { + case 0: + temp = gPlayer[0].pos.z - obj80->obj.pos.z; + if ((obj80->vel.y != 0.0f) && (temp < obj80->vel.y)) { + if ((obj80->unk_44 == 1) && (obj80->obj.pos.x < gPlayer[0].pos.x)) { + obj80->unk_44 = 2; + } + obj80->state++; + } + break; + case 1: + obj80->state++; + /* fallthrough */ + case 2: + obj80->vel.x += 0.05f; + switch (obj80->unk_44) { + case 0: + obj80->obj.rot.x += obj80->vel.x; + if (obj80->obj.rot.x >= 90.0f) { + obj80->obj.rot.x = 90.0f; + obj80->state++; + D_Timer_80177BD0[0] = 7; + D_80178480 = 12; + func_i5_8018F134(obj80); + Audio_PlaySfx(0x19130003, obj80->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + break; + case 1: + obj80->obj.rot.z += obj80->vel.x; + if (obj80->obj.rot.z >= 90.0f) { + obj80->obj.rot.z = 90.0f; + D_Timer_80177BD0[0] = 7; + D_80178480 = 12; + func_i5_8018F134(obj80); + Audio_PlaySfx(0x19130003, obj80->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + obj80->state++; + } + break; + case 2: + obj80->obj.rot.z -= obj80->vel.x; + if (obj80->obj.rot.z <= -90.0f) { + obj80->obj.rot.z = -90.0f; + D_Timer_80177BD0[0] = 7; + D_80178480 = 12; + func_i5_8018F134(obj80); + Audio_PlaySfx(0x19130003, obj80->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + obj80->state++; + } + break; + } + break; + case 3: + break; + } + if (obj80->unk_44 != 0) { + if (obj80->obj.rot.z == 0.0f) { + obj80->obj.pos.x = obj80->vel.z; + obj80->info.hitbox = SEGMENTED_TO_VIRTUAL(D_6006BF0); + } else if (obj80->obj.rot.z > 0.0f) { + obj80->obj.pos.x = obj80->vel.z - 75.0f; + obj80->info.hitbox = SEGMENTED_TO_VIRTUAL(D_6006C28); + } else { + obj80->obj.pos.x = obj80->vel.z + 75.0f; + obj80->info.hitbox = SEGMENTED_TO_VIRTUAL(D_6006C0C); + } + } +} + +void func_i5_8018F8B8(Object_80* obj80) { + + switch (obj80->unk_44) { + case 0: + if (obj80->unk_44 == 0) { + gSPDisplayList(gMasterDisp++, D_7002270); + } else { + gSPDisplayList(gMasterDisp++, D_7000A80); + } + break; + case 1: + case 2: + if (obj80->obj.rot.z != 0.0f) { + if (obj80->obj.rot.z > 0.0f) { + Matrix_Translate(gGfxMatrix, 75.0f, 0.0f, 0.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + } else { + Matrix_Translate(gGfxMatrix, -75.0f, 0.0f, 0.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + } + } + if (obj80->unk_44 == 0) { + gSPDisplayList(gMasterDisp++, D_7002270); + } else { + gSPDisplayList(gMasterDisp++, D_7000A80); + } + break; + } +} + +void func_i5_8018FA48(Boss* boss) { + s32 pad[2]; + f32* sp1C; + s32 i; + s32* var_a1_2; + UnkStruct_i5_801BBF00* var_v1; + + if (boss->swork[0] < 4) { + boss->swork[0]++; + gOverlayStage = boss->swork[0]; + boss->timer_050 = 1; + } + + if (boss->timer_050 != 0) { + boss->obj.status = OBJ_INIT; + return; + } + + gBossActive = 1; + boss->fwork[2] = 1.0f; + boss->fwork[4] = 730.0f; + for (i = 0; i < ARRAY_COUNT(D_i5_801BD668); i++) { + D_i5_801BD668[i] = 0; + D_i5_801BD6B0[i] = 0.0f; + } + boss->fwork[49] = boss->obj.rot.y; + boss->obj.rot.y = 0.0f; + var_v1 = D_i5_801BBF00; + for (i = 0; i < ARRAY_COUNTU(D_i5_801BBF00); i++, var_v1++) { + var_v1->unk_26 = 0; + var_v1->unk_00.pos.x = var_v1->unk_00.pos.y = var_v1->unk_00.pos.z = var_v1->unk_00.rot.x = + var_v1->unk_00.rot.y = var_v1->unk_00.rot.z = var_v1->unk_18 = var_v1->unk_1C = var_v1->unk_20 = 0.0f; + } + + for (i = 0; i < ARRAY_COUNT(D_i5_801BD218); i++) { + D_i5_801BD218[i].x = D_i5_801BD218[i].y = D_i5_801BD218[i].z = 0.0f; + D_i5_801BCDC8[i].x = D_i5_801BCDC8[i].y = D_i5_801BCDC8[i].z = 0.0f; + D_i5_801BC978[i].x = D_i5_801BC978[i].y = D_i5_801BC978[i].z = 0.0f; + } + boss->swork[9] = 50; + boss->swork[10] = 50; + boss->swork[11] = 50; + boss->swork[12] = 50; + boss->swork[21] = 100; + sp1C = D_i5_801BBEF4 = Memory_Allocate(76 * sizeof(f32)); + var_a1_2 = D_i5_801BBEF0 = Memory_Allocate(50 * sizeof(s32)); + for (i = 0; i < 50; i++, var_a1_2++) { + *var_a1_2 = 0; + } + + for (i = 0; i < 76; i++, sp1C++) { + *sp1C = 0.0f; + } + + D_i5_801BBEF8 = SEGMENTED_TO_VIRTUAL(D_8000FC0); +} + +bool func_i5_8018FC70(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* data) { + f32 sp24; + + if (D_i5_801BBEF0[30] != 0) { + sp24 = (D_i5_801BBEF0[30] / 15.0f) * D_i5_801BBEF0[32]; + rot->z += SIN_DEG((D_i5_801BBEF0[30] / (f32) D_i5_801BBEF0[31]) * 360.0f) * sp24; + } + switch (limbIndex) { + case 0: + Matrix_Translate(gCalcMatrix, D_i5_801BBEF4[36], D_i5_801BBEF4[37], D_i5_801BBEF4[38], 1); + Matrix_RotateY(gCalcMatrix, D_i5_801BBEF4[64] * M_DTOR, 1); + break; + case 1: + case 2: + case 3: + rot->z += D_i5_801BBEF4[66]; + break; + } + Matrix_Translate(gCalcMatrix, pos->x, pos->y, pos->z, 1); + Matrix_RotateZ(gCalcMatrix, rot->z * M_DTOR, 1); + Matrix_RotateY(gCalcMatrix, rot->y * M_DTOR, 1); + Matrix_RotateX(gCalcMatrix, rot->x * M_DTOR, 1); + Matrix_Mult(gGfxMatrix, gCalcMatrix, 1); + Matrix_SetGfxMtx(&gMasterDisp); + switch (limbIndex) { + case 1: + case 2: + case 3: + case 7: + RCP_SetupDL(&gMasterDisp, 0x1E); + if (D_i5_801BBEF0[30] & 1) { + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 0, 0, 255); + } else { + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255); + } + if (*dList != NULL) { + gSPDisplayList(gMasterDisp++, *dList); + } + break; + case 8: + case 9: + case 10: + case 11: + RCP_SetupDL(&gMasterDisp, 0x3D); + if (D_i5_801BBEF0[30] & 1) { + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 0, 0, 255); + } else { + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255); + } + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + if (*dList != NULL) { + gSPDisplayList(gMasterDisp++, *dList); + } + RCP_SetupDL(&gMasterDisp, 0x1D); + break; + } + return true; +} + +static f32 D_i5_801B7738[14] = { -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, + 871.0f, 580.0f, 637.0f, 637.0f, 1000.0f, 380.0f, 1400.0f }; + +static u8 D_i5_801B7770[][6] = { + { 1, 0, 0, 0, 0, 4 }, { 2, 0, 0, 0, 0, 5 }, { 3, 0, 0, 0, 0, 3 }, { 4, 0, 0, 0, 0, 6 }, + { 5, 0, 0, 0, 0, 7 }, { 7, 0, 2, 0, 2, 10 }, { 8, 0, 2, 0, 2, 10 }, { 9, 0, 2, 0, 2, 10 }, + { 10, 0, 3, 0, 3, 9 }, { 11, 0, 3, 17, 3, 37 }, { 12, 1, 3, 27, 3, 2 }, { 13, 1, 3, 27, 3, 2 }, + { 14, 1, 3, 27, 3, 2 }, { 15, 1, 3, 27, 3, 2 }, { 16, 0, 4, 0, 4, 9 }, { 17, 0, 4, 18, 4, 37 }, + { 18, 1, 4, 28, 4, 2 }, { 19, 1, 4, 28, 4, 2 }, { 20, 1, 4, 28, 4, 2 }, { 21, 1, 4, 28, 4, 2 }, + { 22, 0, 1, 0, 1, 10 }, { 23, 0, 1, 0, 1, 10 }, { 24, 0, 1, 0, 1, 10 }, { 25, 2, 0, 0, 0, 11 }, + { 26, 2, 0, 0, 0, 12 }, { 27, 0, 0, 0, 0, 0 }, { 28, 0, 0, 0, 0, 13 }, { 29, 0, 0, 0, 0, 14 }, + { 30, 0, 0, 0, 0, 14 }, { 31, 0, 0, 0, 0, 15 }, { 32, 0, 0, 1, 0, 16 }, { 33, 0, 0, 5, 0, 17 }, + { 34, 0, 0, 2, 0, 18 }, { 35, 1, 0, 0, 0, 19 }, { 36, 0, 0, 6, 0, 20 }, { 37, 0, 0, 3, 0, 18 }, + { 38, 1, 0, 0, 0, 19 }, { 39, 0, 0, 4, 0, 20 }, { 51, 2, 0, 0, 0, 22 }, { 55, 0, 2, 8, 2, 1 }, + { 56, 1, 2, 26, 2, 2 }, { 57, 1, 2, 26, 2, 2 }, { 58, 1, 2, 26, 2, 2 }, { 59, 1, 2, 26, 2, 2 }, + { 61, 0, 1, 9, 1, 1 }, { 62, 1, 1, 25, 1, 2 }, { 63, 1, 1, 25, 1, 2 }, { 64, 1, 1, 25, 1, 2 }, + { 65, 1, 1, 25, 1, 2 }, { 66, 3, 0, 0, 0, 23 }, { 70, 0, 0, 12, 0, 24 }, { 71, 0, 0, 7, 0, 25 }, + { 72, 0, 0, 0, 0, 26 }, { 73, 0, 0, 0, 0, 26 }, { 74, 0, 0, 0, 0, 26 }, { 75, 0, 0, 0, 0, 26 }, + { 76, 0, 0, 0, 0, 27 }, { 78, 0, 0, 15, 0, 28 }, { 80, 0, 0, 13, 0, 29 }, { 81, 0, 0, 11, 0, 30 }, + { 84, 0, 0, 10, 0, 31 }, { 85, 0, 0, 0, 0, 32 }, { 86, 1, 0, 0, 0, 33 }, { 87, 0, 0, 16, 0, 34 }, + { 88, 0, 0, 19, 0, 35 }, { 89, 0, 0, 20, 0, 36 }, { 90, 0, 0, 5, 0, 38 }, +}; + +static u8 D_i5_801B7904[92] = { + 29, 30, 31, 32, 33, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, + 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 28, 8, 8, 8, 8, 8, 9, 9, + 9, 10, 10, 10, 11, 11, 12, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, + 18, 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 22, 22, 23, 24, 25, 26, 27, +}; + +static s16 D_i5_801B7960[][4] = { + { 3, 7, 12, 90 }, { 1, 9, 12, 90 }, { 1, 9, 12, 90 }, { 1, 7, 12, 90 }, { 1, 7, 12, 90 }, { 1, 7, 12, 90 }, + { 2, 14, 30, 90 }, { 2, 14, 12, 90 }, { 2, 14, 12, 90 }, { 2, 7, 6, 90 }, { 2, 7, 6, 90 }, { 1, 7, 6, 90 }, + { 1, 7, 6, 90 }, { 0, 7, 6, 90 }, { 1, 7, 6, 90 }, { 1, 7, 6, 90 }, { 2, 14, 12, 90 }, { 2, 14, 12, 90 }, + { 1, 7, 6, 90 }, { 1, 7, 6, 90 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, + { 2, 1, 2, 67 }, { 2, 1, 2, 67 }, { 2, 1, 2, 67 }, { 2, 1, 2, 67 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, +}; + +static f32 D_i5_801B7A70[86][4] = { + { 99.0f, 9.0f, 0.0f, 0.0f }, { 99.0f, 9.0f, 0.0f, 0.0f }, { 45.0f, 26.0f, 0.0f, 0.0f }, + { 45.0f, 26.0f, 0.0f, 0.0f }, { 21.0f, 42.0f, 0.0f, 0.0f }, { 50.0f, -3.0f, 0.0f, 24.0f }, + { 103.0f, 2.0f, 0.0f, 24.0f }, { 143.0f, -1.0f, 0.0f, 12.0f }, { 173.0f, 0.0f, 0.0f, 15.0f }, + { 68.0f, -8.0f, 0.0f, 29.0f }, { 69.0f, -7.0f, 0.0f, 29.0f }, { 28.0f, -7.0f, 0.0f, 29.0f }, + { 55.0f, -1.0f, 0.0f, 34.0f }, { 27.0f, 126.0f, 0.0f, 40.0f }, { 35.0f, 56.0f, -2.0f, 30.0f }, + { 28.0f, -3.0f, -2.0f, 29.0f }, { 28.0f, -3.0f, 2.0f, 29.0f }, { 35.0f, 56.0f, 2.0f, 30.0f }, + { 27.0f, 126.0f, 0.0f, 40.0f }, { 106.0f, 22.0f, 0.0f, 35.0f }, { 41.0f, 4.0f, 2.0f, 35.0f }, + { 9.0f, -27.0f, 0.0f, 30.0f }, { 17.0f, 32.0f, 0.0f, 40.0f }, { 106.0f, 22.0f, 0.0f, 35.0f }, + { 41.0f, 4.0f, -2.0f, 35.0f }, { 29.0f, -8.0f, 0.0f, 15.0f }, { 26.0f, 11.0f, 0.0f, 25.0f }, + { 36.0f, 10.0f, 6.0f, 18.0f }, { 36.0f, 10.0f, -6.0f, 18.0f }, { 29.0f, 12.0f, -49.0f, 25.0f }, + { 29.0f, 12.0f, 49.0f, 25.0f }, { 25.0f, 1.0f, 0.0f, 40.0f }, { 85.0f, -10.0f, 0.0f, 25.0f }, + { 36.0f, -40.0f, 0.0f, 20.0f }, { 36.0f, -40.0f, 0.0f, 20.0f }, { 36.0f, -40.0f, 0.0f, 20.0f }, + { 99.0f, 9.0f, 0.0f, 35.0f }, { 23.0f, 6.0f, 0.0f, 30.0f }, { 180.0f, 28.0f, -11.0f, 32.0f }, + { 36.0f, -40.0f, 0.0f, 20.0f }, { 36.0f, -40.0f, 0.0f, 20.0f }, { 36.0f, -40.0f, 0.0f, 20.0f }, + { 99.0f, 9.0f, 0.0f, 35.0f }, { 23.0f, 6.0f, 0.0f, 30.0f }, { 123.0f, -98.0f, -179.0f, 25.0f }, + { 102.0f, -75.0f, -128.0f, 30.0f }, { 89.0f, -42.0f, -84.0f, 40.0f }, { 123.0f, -98.0f, 179.0f, 25.0f }, + { 102.0f, -75.0f, 128.0f, 30.0f }, { 89.0f, -42.0f, 58.0f, 40.0f }, { -2.0f, 20.0f, -47.0f, 34.0f }, + { 13.0f, 52.0f, -54.0f, 35.0f }, { -2.0f, 20.0f, 47.0f, 34.0f }, { 13.0f, 52.0f, 54.0f, 35.0f }, + { 26.0f, 68.0f, 0.0f, 35.0f }, { 75.0f, 39.0f, -60.0f, 40.0f }, { 75.0f, 39.0f, 60.0f, 40.0f }, + { 120.0f, 16.0f, 0.0f, 25.0f }, { 85.0f, 26.0f, 0.0f, 30.0f }, { 45.0f, 26.0f, 0.0f, 35.0f }, + { -25.0f, 11.0f, 0.0f, 35.0f }, { 94.0f, 0.0f, 0.0f, 30.0f }, { 34.0f, 1.0f, 0.0f, 35.0f }, + { 120.0f, 16.0f, 0.0f, 25.0f }, { 85.0f, 26.0f, 0.0f, 30.0f }, { 45.0f, 26.0f, 0.0f, 35.0f }, + { -25.0f, 11.0f, 0.0f, 35.0f }, { 94.0f, 0.0f, 0.0f, 30.0f }, { 34.0f, 1.0f, 0.0f, 35.0f }, + { 6.0f, 4.0f, 0.0f, 25.0f }, { 30.0f, 12.0f, 0.0f, 25.0f }, { 50.0f, -32.0f, 47.0f, 20.0f }, + { 52.0f, -22.0f, 11.0f, 20.0f }, { 53.0f, -19.0f, -23.0f, 20.0f }, { 12.0f, 7.0f, -18.0f, 20.0f }, + { 12.0f, 0.0f, 17.0f, 20.0f }, { 11.0f, -3.0f, 49.0f, 20.0f }, { 50.0f, -32.0f, -47.0f, 20.0f }, + { 52.0f, -22.0f, -11.0f, 20.0f }, { 53.0f, -19.0f, 23.0f, 20.0f }, { 12.0f, 7.0f, 18.0f, 20.0f }, + { 12.0f, 0.0f, -17.0f, 20.0f }, { 11.0f, -3.0f, -49.0f, 20.0f }, { 98.0f, 40.0f, 25.0f, 0.0f }, + { 78.0f, 40.0f, -25.0f, 0.0f }, { 21.0f, 42.0f, 0.0f, 40.0f }, +}; + +static s16 D_i5_801B7FD0[45][4] = { + { 61, 1, 1, 44 }, { 55, 2, 1, 39 }, { 10, 3, 1, 8 }, { 16, 4, 1, 14 }, { 51, 0, 1, 38 }, { 28, 5, 4, 26 }, + { 29, 9, 1, 27 }, { 30, 10, 1, 28 }, { 31, 11, 1, 29 }, { 32, 12, 1, 30 }, { 34, 13, 3, 32 }, { 37, 16, 3, 35 }, + { 39, 19, 2, 37 }, { 90, 21, 2, 66 }, { 36, 23, 2, 34 }, { 1, 25, 1, 0 }, { 2, 26, 1, 1 }, { 4, 27, 1, 3 }, + { 5, 28, 1, 4 }, { 71, 29, 4, 51 }, { 7, 33, 1, 5 }, { 8, 34, 1, 6 }, { 9, 35, 1, 7 }, { 55, 36, 3, 39 }, + { 24, 39, 1, 22 }, { 23, 40, 1, 21 }, { 23, 41, 1, 20 }, { 61, 42, 2, 44 }, { 85, 44, 3, 60 }, { 81, 47, 3, 59 }, + { 70, 50, 2, 50 }, { 80, 52, 2, 58 }, { 85, 54, 1, 61 }, { 78, 55, 1, 57 }, { 87, 56, 1, 63 }, { 10, 57, 4, 8 }, + { 11, 61, 2, 9 }, { 16, 63, 4, 14 }, { 17, 67, 2, 15 }, { 88, 69, 1, 64 }, { 89, 70, 1, 65 }, { 25, 71, 6, 23 }, + { 26, 77, 6, 24 }, { 86, 83, 2, 62 }, { 51, 85, 1, 38 }, +}; + +static s16 D_i5_801B8138[9] = { 12, 15, 18, 45, 48, 51, 78, 84, 102 }; + +static s16 D_i5_801B814C[9] = { 21, 24, 27, 54, 57, 60, 81, 87, 105 }; + +static s32 D_i5_801B8160[14] = { + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 89, 90, +}; + +static UnkStruct_i5_801B8198 D_i5_801B8198[33] = { + { 61, 0, NULL, 0 }, { 22, 30, NULL, 0 }, { 21, 30, NULL, 0 }, { 20, 30, NULL, 0 }, { 44, 25, NULL, 0 }, + { 45, 20, NULL, 0 }, { 46, 15, NULL, 0 }, { 47, 10, NULL, 0 }, { 48, 5, NULL, 0 }, { 57, 0, NULL, 0 }, + { 5, 30, NULL, 0 }, { 6, 30, NULL, 0 }, { 7, 30, NULL, 0 }, { 39, 25, NULL, 0 }, { 40, 20, NULL, 0 }, + { 41, 15, NULL, 0 }, { 42, 10, NULL, 0 }, { 43, 5, NULL, 0 }, { 63, 0, NULL, 0 }, { 8, 30, NULL, 0 }, + { 9, 30, NULL, 0 }, { 10, 25, NULL, 0 }, { 11, 20, NULL, 0 }, { 12, 15, NULL, 0 }, { 13, 10, NULL, 0 }, + { 50, 5, NULL, 0 }, { 14, 30, NULL, 0 }, { 15, 30, NULL, 0 }, { 16, 25, NULL, 0 }, { 17, 20, NULL, 0 }, + { 18, 15, NULL, 0 }, { 19, 10, NULL, 0 }, { 58, 5, NULL, 0 }, +}; + +f32 D_i5_801B83A8[517] = { + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f +}; + +static f32 D_i5_801B8BBC[5][4] = { { 36.0f, -40.0f, 0.0f, 20.0f }, + { 99.0f, 9.0f, 0.0f, 0.0f }, + { 99.0f, 9.0f, 0.0f, 35.0f }, + { 23.0f, 6.0f, 0.0f, 30.0f }, + { 180.0f, 28.0f, -11.0f, 32.0f } }; + +static u8 D_i5_801B8C0C[21] = { + 0, 0, 0, 0, 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, +}; + +static s32 D_i5_801B8C24[4][4] = { + { 1, 0, 1, 0 }, + { 2, 0, 1, 1 }, + { 3, 0, 1, 2 }, + { 7, 1, 4, 3 }, +}; + +static f32 D_i5_801B8C64[7][4] = { + { 45.0f, 26.0f, 0.0f, 0.0f }, { 120.0f, 16.0f, 0.0f, 25.0f }, { 85.0f, 26.0f, 0.0f, 30.0f }, + { 45.0f, 26.0f, 0.0f, 35.0f }, { -25.0f, 11.0f, 0.0f, 35.0f }, { 94.0f, 0.0f, 0.0f, 30.0f }, + { 34.0f, 1.0f, 0.0f, 35.0f }, +}; + +static s32 D_i5_801B8CD4[2][4] = { + { 1, 0, 5, 0 }, + { 2, 4, 2, 5 }, +}; + +static s32 D_i5_801B8CF4[3] = { 0, 7, 14 }; + +static Vec3f D_i5_801B8D00 = { 104.0f, 23.0f, 0.0f }; +static Vec3f D_i5_801B8D0C = { 5.0f, 0.0f, 0.0f }; +static Vec3f D_i5_801B8D18 = { 0.0f, 0.0f, 30.0f }; +static Vec3f D_i5_801B8D24 = { 54.0f, 0.0f, 0.0f }; +static Vec3f D_i5_801B8D30 = { 47.0f, 0.0f, 0.0f }; +static Vec3f D_i5_801B8D3C = { 158.0f, 4.0f, 0.0f }; +static Vec3f D_i5_801B8D48 = { 0.0f, 0.0f, 60.0f }; + +void func_i5_8019002C(s32 limbIndex, Vec3f* rot, void* data) { + Boss* boss = (Boss*) data; + s32 i; + s32 j; + s32* var_s6; + f32* var_s0; + Vec3f sp80; + Vec3f sp74; + s32 temp_s3; + Vec3f sp64; + s32 temp; + + for (i = 0; i < 4; i++) { + var_s6 = D_i5_801B8C24[i]; + temp_s3 = var_s6[2]; + if (limbIndex == var_s6[0]) { + var_s0 = &D_i5_801B83A8[D_i5_801B8CF4[D_i5_801BBEF0[25]] * 6 + var_s6[3] * 6 + 1]; + temp = var_s6[1]; + + for (j = 0; j < temp_s3; j++) { + sp80.x = D_i5_801B8BBC[temp + j][0]; + sp80.y = D_i5_801B8BBC[temp + j][1]; + sp80.z = D_i5_801B8BBC[temp + j][2]; + Matrix_MultVec3f(gCalcMatrix, &sp80, &sp74); + var_s0[0] = sp74.z; + var_s0[1] = D_i5_801B8BBC[temp + j][3]; + var_s0[2] = sp74.y; + var_s0[3] = D_i5_801B8BBC[temp + j][3]; + var_s0[4] = sp74.x; + var_s0[5] = D_i5_801B8BBC[temp + j][3]; + var_s0 += 6; + } + } + } + if (limbIndex == 7) { + Matrix_Push(&gGfxMatrix); + Matrix_Translate(gGfxMatrix, 180.0f, 36.0f, 0.0f, 1); + Matrix_RotateX(gGfxMatrix, -(M_DTOR * 90.0f), 1); + Matrix_RotateZ(gGfxMatrix, -(M_DTOR * 90.0f), 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_40018A0); + Matrix_Translate(gGfxMatrix, 0.0f, 0.0f, -47.0f, 1); + Matrix_GetYRPAngles(gGfxMatrix, &sp64); + Matrix_RotateZ(gGfxMatrix, -sp64.z * M_DTOR, 1); + Matrix_RotateX(gGfxMatrix, -sp64.x * M_DTOR, 1); + Matrix_RotateY(gGfxMatrix, -sp64.y * M_DTOR, 1); + Matrix_Scale(gGfxMatrix, D_i5_801BBEF4[74], D_i5_801BBEF4[74], 1.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + RCP_SetupDL(&gMasterDisp, 0x48); + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255); + gDPSetEnvColor(gMasterDisp++, 255, 0, 0, 255); + gSPDisplayList(gMasterDisp++, D_1024AC0); + RCP_SetupDL(&gMasterDisp, 0x1E); + Matrix_Pop(&gGfxMatrix); + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B8D3C, (Vec3f*) &boss->fwork[29]); + } +} + +bool func_i5_801903A0(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* data) { + f32 sp24; + s32 sp20; + + if (limbIndex == 0) { + if (D_i5_801BBEF0[25] == 1) { + Matrix_Translate(gCalcMatrix, D_i5_801BBEF4[39], D_i5_801BBEF4[40], D_i5_801BBEF4[41], 1); + Matrix_RotateY(gCalcMatrix, D_i5_801BBEF4[54] * M_DTOR, 1); + } else { + Matrix_Translate(gCalcMatrix, D_i5_801BBEF4[42], D_i5_801BBEF4[43], D_i5_801BBEF4[44], 1); + Matrix_RotateY(gCalcMatrix, D_i5_801BBEF4[56] * M_DTOR, 1); + } + } + if (D_i5_801BBEF0[25] == 1) { + sp20 = D_i5_801BBEF0[33] & 1; + if (D_i5_801BBEF0[33] != 0) { + sp24 = (D_i5_801BBEF0[33] / 15.0f) * D_i5_801BBEF0[37]; + rot->z += SIN_DEG((D_i5_801BBEF0[33] / (f32) D_i5_801BBEF0[35]) * 360.0f) * sp24; + } + } else { + sp20 = D_i5_801BBEF0[34] & 1; + if (D_i5_801BBEF0[34] != 0) { + sp24 = (D_i5_801BBEF0[34] / 15.0f) * D_i5_801BBEF0[38]; + rot->z += SIN_DEG((D_i5_801BBEF0[34] / (f32) D_i5_801BBEF0[36]) * 360.0f) * sp24; + } + } + Matrix_Translate(gCalcMatrix, pos->x, pos->y, pos->z, 1); + Matrix_RotateZ(gCalcMatrix, rot->z * M_DTOR, 1); + Matrix_RotateY(gCalcMatrix, rot->y * M_DTOR, 1); + Matrix_RotateX(gCalcMatrix, rot->x * M_DTOR, 1); + Matrix_Mult(gGfxMatrix, gCalcMatrix, 1); + Matrix_SetGfxMtx(&gMasterDisp); + switch (limbIndex) { + case 1: + case 2: + RCP_SetupDL(&gMasterDisp, 0x1E); + if (sp20 & 1) { + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 0, 0, 255); + } else { + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255); + } + if (*dList != NULL) { + gSPDisplayList(gMasterDisp++, *dList); + } + break; + case 3: + case 4: + case 5: + case 6: + RCP_SetupDL(&gMasterDisp, 0x3D); + if (sp20 & 1) { + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 0, 0, 255); + } else { + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255); + } + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + if (*dList != NULL) { + gSPDisplayList(gMasterDisp++, *dList); + } + RCP_SetupDL(&gMasterDisp, 0x1D); + break; + } + return true; +} + +void func_i5_8019081C(s32 limbIndex, Vec3f* rot, void* data) { + s32 i; + s32 j; + f32* var_s0; + s32 temp_s3; + Vec3f sp5C; + Vec3f sp50; + s32 temp; + + for (i = 0; i < 2; i++) { + temp_s3 = D_i5_801B8CD4[i][2]; + if (limbIndex == D_i5_801B8CD4[i][0]) { + var_s0 = &D_i5_801B83A8[D_i5_801B8CF4[D_i5_801BBEF0[25]] * 6 + D_i5_801B8CD4[i][3] * 6 + 1]; + temp = D_i5_801B8CD4[i][1]; + for (j = 0; j < temp_s3; j++) { + sp5C.x = D_i5_801B8C64[temp + j][0]; + sp5C.y = D_i5_801B8C64[temp + j][1]; + sp5C.z = D_i5_801B8C64[temp + j][2]; + Matrix_MultVec3f(gCalcMatrix, &sp5C, &sp50); + var_s0[0] = sp50.z; + var_s0[1] = D_i5_801B8C64[temp + j][3]; + var_s0[2] = sp50.y; + var_s0[3] = D_i5_801B8C64[temp + j][3]; + var_s0[4] = sp50.x; + var_s0[5] = D_i5_801B8C64[temp + j][3]; + var_s0 += 6; + } + } + } + if (limbIndex == 1) { + // FAKE + if (1) {} + switch ((s32) D_i5_801BBEF0[25]) { + case 0: + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B8D00, (Vec3f*) &D_i5_801BBEF4[68]); + return; + case 1: + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B8D00, (Vec3f*) &D_i5_801BBEF4[71]); + break; + } + } +} + +#ifdef NON_MATCHING +// regalloc +// https://decomp.me/scratch/cEhIC + +bool func_i5_80190A08(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* data) { + Vec3f spCC; + f32 spC8; + f32 spC4; + f32 spC0; + f32 spBC; + s32 i; + s32 temp_v1; + s32 padAC[1]; + f32 temp; + u32 spA8; + Boss* boss = (Boss*) data; + s32 spA0; + f32 sp9C; + s32 ret; + Vec3f sp8C; + s32 sp88; + Vec3f sp7C; + f32 sp78; + f32 sp74; + f32 sp70; + s32 sp6C; + f32 sp68; + s32 pad64; + f32 sp60; + f32 sp5C; + s32 sp58; + + ret = false; + if (limbIndex == 0) { + rot->y += boss->fwork[0x31]; + } + + for (i = 0; i < 0x43; i++) { + if (limbIndex == D_i5_801B7770[i][0]) { + if (D_i5_801BBF00[i].unk_26 & 4) { + *dList = NULL; + } else { + switch (limbIndex) { + case 0x7: + case 0x8: + case 0x9: + rot->z += D_i5_801BBEF4[8]; + break; + case 0x16: + case 0x17: + case 0x18: + rot->z += D_i5_801BBEF4[6]; + break; + case 0x19: + case 0x1A: + if (D_i5_801BBEF4[2] != 0.0f) { + rot->z += D_i5_801BBEF4[2]; + if (D_i5_801BBEF4[3] != 0.0f) { + rot->z += (__sinf((D_i5_801BBEF4[3] / D_i5_801BBEF4[5]) * 360.0f * M_DTOR) * + D_i5_801BBEF4[3]) / + 6.0f; + } + } + break; + case 0x59: + rot->x += D_i5_801BBEF4[13]; + break; + } + sp88 = 0; + switch (limbIndex) { + case 0x37: + if (boss->fwork[0x28] != 0.0f) { + sp88 = 1; + } + break; + case 0x3D: + if (boss->fwork[39] != 0.0f) { + sp88 = 2; + } + break; + case 0x47: + if (boss->fwork[38] != 0.0f) { + sp88 = 3; + } + break; + } + if (sp88 != 0) { + Matrix_GetYRPAngles(gCalcMatrix, &spCC); + } + sp9C = 0.0f; + temp_v1 = D_i5_801B7770[i][3] - 1; + spA0 = (temp_v1 != -1) && (D_i5_801BD668[temp_v1] != 0); + + if (spA0 != 0) { + spA8 = (u32) D_i5_801B7960[temp_v1][0]; + sp9C = ((__sinf(D_i5_801BD6B0[temp_v1] * M_DTOR) * (f32) D_i5_801BD668[temp_v1]) / + (f32) D_i5_801B7960[temp_v1][1]) * + D_i5_801B7960[temp_v1][2]; + switch (spA8) { + case 0: + break; + case 1: + spC0 = 0.0f; + spC8 = spC4 = sp9C; + break; + case 2: + if (sp88 == 0) { + Matrix_RotateZ(gCalcMatrix, sp9C * M_DTOR, 1); + Matrix_RotateY(gCalcMatrix, sp9C * M_DTOR, 1); + } + break; + case 3: + rot->y += sp9C; + break; + case 4: + spBC = sp9C; + break; + } + } + Matrix_Translate(gCalcMatrix, pos->x, pos->y, pos->z, 1); + if (sp88 != 0) { + Matrix_RotateZ(gCalcMatrix, D_i5_801BBF00[i].unk_20 * M_DTOR, 1); + Matrix_RotateY(gCalcMatrix, D_i5_801BBF00[i].unk_1C * M_DTOR, 1); + Matrix_RotateX(gCalcMatrix, D_i5_801BBF00[i].unk_18 * M_DTOR, 1); + } else { + rot->z += D_i5_801BBF00[i].unk_20; + rot->y += D_i5_801BBF00[i].unk_1C; + rot->x += D_i5_801BBF00[i].unk_18; + } + if (sp88 != 0) { + Matrix_Push(&gCalcMatrix); + Matrix_RotateZ(gCalcMatrix, rot->z * M_DTOR, 1); + Matrix_RotateY(gCalcMatrix, rot->y * M_DTOR, 1); + Matrix_RotateX(gCalcMatrix, rot->x * M_DTOR, 1); + Matrix_GetYRPAngles(gCalcMatrix, &sp8C); + Matrix_MultVec3f(gCalcMatrix, &D_800C9F2C, &sp7C); + if ((limbIndex == 0x47) && (boss->fwork[0x2E] != 0.0f)) { + sp70 = (gPlayer[0].pos.x - (boss->obj.pos.x + sp7C.x)) * boss->fwork[0x2E]; + sp74 = (gPlayer[0].pos.y + 50.0f) - (boss->obj.pos.y + sp7C.y); + sp78 = (gPlayer[0].unk_138 - (boss->obj.pos.z + sp7C.z)) * boss->fwork[0x2E]; + sp60 = Math_Atan2F(sp70, sp78) * M_RTOD; + sp5C = -Math_Atan2F(sp74, sqrtf(SQ(sp70) + SQ(sp78))) * M_RTOD; + } else { + sp70 = gPlayer[0].pos.x - (boss->obj.pos.x + sp7C.x); + sp74 = (gPlayer[0].pos.y + 30.0f) - (boss->obj.pos.y + sp7C.y); + sp78 = gPlayer[0].unk_138 - (boss->obj.pos.z + sp7C.z); + sp60 = Math_Atan2F(sp70, sp78) * M_RTOD; + sp5C = -Math_Atan2F(sp74, sqrtf(SQ(sp70) + SQ(sp78))) * M_RTOD; + } + Matrix_Pop(&gCalcMatrix); + Matrix_RotateZ(gCalcMatrix, -(spCC.z * M_DTOR), 1); + Matrix_RotateX(gCalcMatrix, -(spCC.x * M_DTOR), 1); + Matrix_RotateY(gCalcMatrix, -(spCC.y * M_DTOR), 1); + switch (limbIndex) { + case 0x37: + if (D_i5_801BBEF0[15] == 1) { + D_i5_801BBEF4[20] = 0.0f; + D_i5_801BBEF4[21] = sp60 - 90.0f; + D_i5_801BBEF4[22] = -sp5C; + D_i5_801BBEF0[15] = 0; + } + D_i5_801BBEF4[29] = 0.0f; + D_i5_801BBEF4[30] = sp60 - 90.0f; + D_i5_801BBEF4[31] = -sp5C; + sp8C.x = 0.0f; + Math_SmoothStepToAngle(&sp8C.y, D_i5_801BBEF4[21], boss->fwork[0x28], 360.0f, 0.01f); + Math_SmoothStepToAngle(&sp8C.z, D_i5_801BBEF4[22], boss->fwork[0x28], 360.0f, 0.01f); + break; + case 0x3D: + if (D_i5_801BBEF0[14] == 1) { + D_i5_801BBEF4[17] = 0.0f; + D_i5_801BBEF4[18] = sp60 - 90.0f; + D_i5_801BBEF4[19] = -sp5C; + D_i5_801BBEF0[14] = 0; + } + D_i5_801BBEF4[26] = 0.0f; + D_i5_801BBEF4[27] = sp60 - 90.0f; + D_i5_801BBEF4[28] = -sp5C; + sp8C.x = 0.0f; + Math_SmoothStepToAngle(&sp8C.y, D_i5_801BBEF4[18], boss->fwork[39], 360.0f, 0.01f); + Math_SmoothStepToAngle(&sp8C.z, D_i5_801BBEF4[19], boss->fwork[39], 360.0f, 0.01f); + break; + case 0x47: + if (D_i5_801BBEF0[13] == 1) { + D_i5_801BBEF4[14] = 0.0f; + D_i5_801BBEF4[15] = sp60 + 90.0f; + D_i5_801BBEF4[16] = sp5C + 180.0f; + D_i5_801BBEF0[13] = 0; + } + D_i5_801BBEF4[24] = sp60 + 90.0f; + D_i5_801BBEF4[25] = sp5C + 180.0f; + while (D_i5_801BBEF4[24] >= 270.0f) { + D_i5_801BBEF4[24] -= 360.0f; + } + + while (D_i5_801BBEF4[24] < -90.0f) { + D_i5_801BBEF4[24] += 360.0f; + } + + if (D_i5_801BBEF4[24] < -45.0f) { + D_i5_801BBEF4[24] = -45.0f; + } + if (D_i5_801BBEF4[24] > 225.0f) { + D_i5_801BBEF4[24] = 225.0f; + } + sp8C.x = 0.0f; + Math_SmoothStepToAngle(&sp8C.y, D_i5_801BBEF4[15], boss->fwork[38], 360.0f, 0.01f); + Math_SmoothStepToAngle(&sp8C.z, D_i5_801BBEF4[16], boss->fwork[38], 360.0f, 0.01f); + break; + } + Matrix_RotateY(gCalcMatrix, (sp8C.y + sp9C) * M_DTOR, 1); + Matrix_RotateZ(gCalcMatrix, (sp8C.z + sp9C) * M_DTOR, 1); + Matrix_RotateX(gCalcMatrix, sp8C.x * M_DTOR, 1); + } else { + Matrix_RotateZ(gCalcMatrix, rot->z * M_DTOR, 1); + Matrix_RotateY(gCalcMatrix, rot->y * M_DTOR, 1); + Matrix_RotateX(gCalcMatrix, rot->x * M_DTOR, 1); + } + sp6C = 0; + if ((limbIndex == 0x33) || (limbIndex == 0x42)) { + if (D_i5_801BBEF0[1] != 0) { + sp68 = 1.1f - (fabsf(__sinf(((f32) D_i5_801BBEF0[0] / D_i5_801BBEF0[1]) * 360.0f * M_DTOR))) * + D_i5_801BBEF4[0]; + Matrix_Push(&gCalcMatrix); + Matrix_Scale(gCalcMatrix, sp68, sp68, sp68, 1); + sp6C = 1; + } + } + if (spA0 != 0) { + switch (spA8) { + case 1: + Matrix_Push(&gCalcMatrix); + Matrix_Translate(gCalcMatrix, spC0, spC4, spC8, 1); + break; + case 4: + Matrix_Push(&gCalcMatrix); + Matrix_Translate(gCalcMatrix, 40.0f, 0.0f, 0.0f, 1); + Matrix_RotateZ(gCalcMatrix, spBC * M_DTOR, 1); + Matrix_Translate(gCalcMatrix, -40.0f, 0.0f, 0.0f, 1); + break; + } + } + Matrix_Mult(gGfxMatrix, gCalcMatrix, 1); + Matrix_SetGfxMtx(&gMasterDisp); + sp58 = 0; + switch (D_i5_801B7770[i][1]) { + case 0: + break; + case 1: + RCP_SetupDL(&gMasterDisp, 0x3D); + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + break; + case 2: + RCP_SetupDL(&gMasterDisp, 0x3A); + gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); + break; + case 3: + RCP_SetupDL(&gMasterDisp, 0x22); + break; + } + if ((boss->swork[22] & 1) || + ((D_i5_801B7770[i][2] != 0) && (boss->swork[D_i5_801B7770[i][2] + 4] & 1))) { + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 0, 0, 255); + sp58 = 1; + } + if (*dList != NULL) { + gSPDisplayList(gMasterDisp++, *dList); + } + if (D_i5_801B7770[i][1] > 0) { + RCP_SetupDL(&gMasterDisp, 0x1E); + } else { + gDPPipeSync(gMasterDisp++); + } + if (sp58 == 1) { + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255); + } + if (sp6C != 0) { + Matrix_Pop(&gCalcMatrix); + } + if ((spA0 != 0) && ((spA8 == 1) || (spA8 == 4))) { + Matrix_Pop(&gCalcMatrix); + } + Matrix_SetGfxMtx(&gMasterDisp); + ret = true; + } + break; + } + } + + return ret; +} +#else #pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_80190A08.s") +bool func_i5_80190A08(s32, Gfx**, Vec3f*, Vec3f*, void*); +#endif +#ifdef NON_MATCHING +// s0/s1 regalloc +// https://decomp.me/scratch/M2RNR + +void func_i5_80191AE8(s32 limbIndex, Vec3f* rot, void* data) { + Boss* boss = (Boss*) data; + f32* var_s0_2; + Vec3f spB4; + Vec3f spA8; + s32 pad[2]; + f32* var_s1; + UnkStruct_i5_801BBF00* var_s0; + s32 temp_s4; + s16 temp_s6; + s32 i; + s32 j; + s32 cond; + Vec3f sp78; + + var_s0 = D_i5_801BBF00; + for (i = 0; i < (u32) 0x43; i++, var_s0++) { + if ((var_s0->unk_26 & 1) && (limbIndex == D_i5_801B7770[i][0])) { + Matrix_MultVec3f(gCalcMatrix, &D_800C9F2C, &var_s0->unk_00.pos); + Matrix_GetYRPAngles(gCalcMatrix, &var_s0->unk_00.rot); + var_s0->unk_26 &= ~1; + break; + } + } + + var_s0_2 = D_i5_801B83A8; + var_s0_2[0] = 86.0f; + var_s0_2++; + for (i = 0; i < (u32) 0x2D; i++) { + temp_s4 = D_i5_801B7FD0[i][2]; + if (limbIndex == D_i5_801B7FD0[i][0]) { + + temp_s6 = D_i5_801B7FD0[i][1]; + cond = (D_i5_801BBF00[D_i5_801B7FD0[i][3]].unk_26 & 0xC); + cond = !(cond || (i >= 20 && i < 23 && boss->state == 10)); + + for (j = 0; j < temp_s4; j++) { + if (cond && (D_i5_801BBEF0[8] == 0 || i != 0x17 || j != 2)) { + var_s1 = D_i5_801B7A70[temp_s6 + j]; + spB4.x = var_s1[0]; + spB4.y = var_s1[1]; + spB4.z = var_s1[2]; + Matrix_MultVec3f(gCalcMatrix, &spB4, &spA8); + var_s0_2[0] = spA8.z; + var_s0_2[1] = var_s1[3]; + var_s0_2[2] = spA8.y; + var_s0_2[3] = var_s1[3]; + var_s0_2[4] = spA8.x; + var_s0_2[5] = var_s1[3]; + var_s0_2 += 6; + } else { + var_s0_2[0] = 10000.0f; + var_s0_2[1] = 0.0f; + var_s0_2[2] = 10000.0f; + var_s0_2[3] = 0.0f; + var_s0_2[4] = 0.0f; + var_s0_2[5] = 0.0f; + var_s0_2 += 6; + } + } + + if (i < 5) { + continue; + } + break; + } + var_s0_2 += temp_s4 * 6; + } + switch (limbIndex) { + case 0x3: + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B8D30, (Vec3f*) &boss->fwork[17]); + break; + case 0xA: + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B8D00, (Vec3f*) &D_i5_801BBEF4[68]); + break; + case 0x10: + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B8D00, (Vec3f*) &D_i5_801BBEF4[71]); + break; + case 0x47: + Matrix_GetYRPAngles(gCalcMatrix, (Vec3f*) &boss->fwork[20]); + break; + case 0x3D: + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B8D3C, (Vec3f*) &boss->fwork[0x17]); + Matrix_GetYRPAngles(gCalcMatrix, (Vec3f*) &boss->fwork[0x1A]); + break; + case 0x37: + if (D_i5_801BBEF0[8] == 0) { + Matrix_Push(&gGfxMatrix); + Matrix_Translate(gGfxMatrix, 180.0f, 36.0f, 0.0f, 1); + Matrix_RotateX(gGfxMatrix, -(M_DTOR * 90.0f), 1); + Matrix_RotateZ(gGfxMatrix, -(M_DTOR * 90.0f), 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_40018A0); + Matrix_Translate(gGfxMatrix, 0.0f, 0.0f, -47.0f, 1); + Matrix_GetYRPAngles(gGfxMatrix, &sp78); + Matrix_RotateZ(gGfxMatrix, -sp78.z * M_DTOR, 1); + Matrix_RotateX(gGfxMatrix, -sp78.x * M_DTOR, 1); + Matrix_RotateY(gGfxMatrix, -sp78.y * M_DTOR, 1); + Matrix_Scale(gGfxMatrix, D_i5_801BBEF4[74], D_i5_801BBEF4[74], 1.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + RCP_SetupDL(&gMasterDisp, 0x48); + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255); + gDPSetEnvColor(gMasterDisp++, 255, 0, 0, 255); + gSPDisplayList(gMasterDisp++, D_1024AC0); + RCP_SetupDL(&gMasterDisp, 0x1E); + Matrix_Pop(&gGfxMatrix); + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B8D3C, (Vec3f*) &boss->fwork[29]); + break; + } + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B8D3C, (Vec3f*) &boss->fwork[29]); + Matrix_GetYRPAngles(gCalcMatrix, (Vec3f*) &boss->fwork[32]); + break; + case 0x22: + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B8D24, (Vec3f*) &boss->fwork[5]); + break; + case 0x25: + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B8D24, (Vec3f*) &boss->fwork[8]); + break; + default: + break; + } +} +#else #pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_80191AE8.s") +void func_i5_80191AE8(s32, Vec3f*, void*); +#endif -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_80192118.s") +void func_i5_80192118(Boss* boss) { + Vec3f sp54; + Effect* effect; + f32 temp_ft2; + f32 temp_ft4; + f32 temp_fa1; + f32 temp_fv1; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_80193B30.s") + if (D_i5_801BBEF0[30] > 0) { + D_i5_801BBEF0[30]--; + } + if (D_i5_801BBEF0[33] > 0) { + D_i5_801BBEF0[33]--; + } + + if (D_i5_801BBEF0[34] > 0) { + D_i5_801BBEF0[34]--; + } + + if (D_i5_801BBEF0[29] > 0) { + D_i5_801BBEF0[29]--; + } + + if ((boss->state == 3) || (boss->state == 4)) { + Math_SmoothStepToF(&D_i5_801BBEF4[36], D_i5_801BBEF4[51], 0.5f, 10.0f, 0.01f); + Math_SmoothStepToF(&D_i5_801BBEF4[37], D_i5_801BBEF4[52], 0.5f, 10.0f, 0.01f); + Math_SmoothStepToF(&D_i5_801BBEF4[38], D_i5_801BBEF4[53], 0.5f, 10.0f, 0.01f); + Math_SmoothStepToF(&D_i5_801BBEF4[39], D_i5_801BBEF4[45], 0.5f, 10.0f, 0.01f); + Math_SmoothStepToF(&D_i5_801BBEF4[40], D_i5_801BBEF4[46], 0.5f, 10.0f, 0.01f); + Math_SmoothStepToF(&D_i5_801BBEF4[41], D_i5_801BBEF4[47], 0.5f, 10.0f, 0.01f); + Math_SmoothStepToF(&D_i5_801BBEF4[42], D_i5_801BBEF4[48], 0.5f, 10.0f, 0.01f); + Math_SmoothStepToF(&D_i5_801BBEF4[43], D_i5_801BBEF4[49], 0.5f, 10.0f, 0.01f); + Math_SmoothStepToF(&D_i5_801BBEF4[44], D_i5_801BBEF4[50], 0.5f, 10.0f, 0.01f); + Math_SmoothStepToAngle(&D_i5_801BBEF4[64], D_i5_801BBEF4[65], 0.5f, 3.0f, 0.01f); + Math_SmoothStepToAngle(&D_i5_801BBEF4[54], D_i5_801BBEF4[55], 0.5f, 3.0f, 0.01f); + Math_SmoothStepToAngle(&D_i5_801BBEF4[56], D_i5_801BBEF4[63], 0.5f, 3.0f, 0.01f); + } + switch (boss->state) { + case 0: + D_i5_801BBEF4[36] = D_i5_801BBEF4[51] = 120.0f; + D_i5_801BBEF4[37] = D_i5_801BBEF4[52] = -250.0f; + D_i5_801BBEF4[38] = D_i5_801BBEF4[53] = -300.0f; + D_i5_801BBEF4[39] = D_i5_801BBEF4[45] = -200.0f; + D_i5_801BBEF4[40] = D_i5_801BBEF4[46] = -290.0f; + D_i5_801BBEF4[41] = D_i5_801BBEF4[47] = 0.0f; + D_i5_801BBEF4[42] = D_i5_801BBEF4[48] = -40.0f; + D_i5_801BBEF4[43] = D_i5_801BBEF4[49] = -80.0f; + D_i5_801BBEF4[44] = D_i5_801BBEF4[50] = -40.0f; + D_i5_801BBEF4[57] = D_i5_801BBEF4[36] + boss->obj.pos.x; + D_i5_801BBEF4[58] = D_i5_801BBEF4[38] + boss->obj.pos.z; + D_i5_801BBEF4[59] = D_i5_801BBEF4[39] + boss->obj.pos.x; + D_i5_801BBEF4[60] = D_i5_801BBEF4[41] + boss->obj.pos.z; + D_i5_801BBEF4[61] = D_i5_801BBEF4[42] + boss->obj.pos.x; + D_i5_801BBEF4[62] = D_i5_801BBEF4[44] + boss->obj.pos.z; + D_i5_801BBEF4[54] = D_i5_801BBEF4[55] = 70.0f; + D_i5_801BBEF4[56] = D_i5_801BBEF4[63] = -80.0f; + D_i5_801BBEF4[64] = D_i5_801BBEF4[65] = 0.0f; + D_i5_801BBEF4[66] = 48.0f; + D_i5_801BBEF4[67] = 48.0f; + D_i5_801BBEF0[22] = 0; + D_i5_801BBEF0[23] = 0; + D_i5_801BBEF0[24] = 0; + boss->swork[1] = 1; + break; + case 1: + Animation_GetFrameData(&D_A0002BC, 0, D_i5_801BC978); + Animation_GetFrameData(&D_A0002BC, 0, D_i5_801BCDC8); + Animation_GetFrameData(&D_A0002BC, 0, D_i5_801BC9D8); + Animation_GetFrameData(&D_A0002BC, 0, D_i5_801BCE28); + Animation_GetFrameData(&D_A000934, 0, D_i5_801BCA38); + Animation_GetFrameData(&D_A000934, 0, D_i5_801BCE88); + if ((gPlayer[0].unk_138 - boss->obj.pos.z) <= 450.0f) { + gPlayer[0].unk_19C = -1; + gPlayer[0].unk_000 = 0.0f; + boss->swork[1] = 2; + boss->swork[31] = 0; + boss->swork[30]++; + } + break; + case 2: + + if (boss->dmgType == DMG_BEAM) { + switch (D_i5_801B8C0C[boss->dmgPart]) { + case 0: + D_i5_801BBEF0[30] = 15; + Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + break; + case 1: + D_i5_801BBEF0[33] = 15; + Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + break; + case 2: + D_i5_801BBEF0[34] = 15; + Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + break; + } + } + if (boss->dmgType == DMG_BOMB) { + + if ((boss->dmgPart == 5) || (boss->dmgPart == 7) || (boss->dmgPart == 14)) { + switch (D_i5_801B8C0C[boss->dmgPart]) { + case 0: + D_i5_801BBEF0[30] = 15; + break; + case 1: + D_i5_801BBEF0[33] = 15; + break; + case 2: + D_i5_801BBEF0[34] = 15; + break; + } + } + } + if (boss->dmgType != 0) { + D_i5_801BBEF0[48]++; + } + if ((D_i5_801BBEF0[48] >= 3) || (boss->swork[31] >= 90)) { + D_i5_801BBEF4[45] = -240.0f; + D_i5_801BBEF4[46] = -40.0f; + D_i5_801BBEF4[47] = -200.0f; + D_i5_801BBEF4[48] = 240.0f; + D_i5_801BBEF4[49] = -40.0f; + D_i5_801BBEF4[50] = -200.0f; + D_i5_801BBEF4[51] = 0.0f; + D_i5_801BBEF4[52] = -200.0f; + D_i5_801BBEF4[53] = -450.0f; + D_i5_801BBEF4[55] = 0.0f; + D_i5_801BBEF4[63] = 0.0f; + boss->vel.z = gPlayer[0].vel.z; + D_i5_801BBEF0[27] = 100; + D_i5_801BBEF0[29] = 30; + D_i5_801BBEF0[31] = 5; + D_i5_801BBEF0[32] = 2; + D_i5_801BBEF0[35] = 5; + D_i5_801BBEF0[37] = 2; + D_i5_801BBEF0[36] = 5; + D_i5_801BBEF0[38] = 2; + gPlayer[0].unk_19C = 0; + boss->swork[1] = 3; + func_8001D444(0, 0x8014, 0, 0xFF); + } + break; + case 3: + + if (D_i5_801BBEF0[22] == 37) { + sp54.x = (boss->obj.pos.x + D_i5_801BBEF4[39]) + D_i5_801BBEF4[68]; + sp54.y = 0.0f; + sp54.z = (boss->obj.pos.z + D_i5_801BBEF4[41]) + D_i5_801BBEF4[70]; + func_8007A6F0(&sp54, 0x29403031); + boss->swork[39] = 5; + D_80178480 = 5; + } + if (D_i5_801BBEF0[23] == 37) { + sp54.x = (boss->obj.pos.x + D_i5_801BBEF4[42]) + D_i5_801BBEF4[71]; + sp54.y = 0.0f; + sp54.z = (boss->obj.pos.z + D_i5_801BBEF4[44]) + D_i5_801BBEF4[73]; + func_8007A6F0(&sp54, 0x29403031); + boss->swork[39] = 5; + D_80178480 = 5; + } + if (boss->dmgType == DMG_BEAM) { + switch (D_i5_801B8C0C[boss->dmgPart]) { + case 0: + D_i5_801BBEF0[30] = 15; + + D_i5_801BBEF0[27] -= boss->damage; + Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + break; + case 1: + D_i5_801BBEF0[33] = 15; + + D_i5_801BBEF0[27] -= boss->damage; + Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + break; + case 2: + D_i5_801BBEF0[34] = 15; + + D_i5_801BBEF0[27] -= boss->damage; + Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + break; + } + boss->dmgType = DMG_NONE; + } + if ((boss->dmgType == DMG_BOMB) && + ((boss->dmgPart == 5) || (boss->dmgPart == 7) || (boss->dmgPart == 14))) { + boss->dmgType = DMG_NONE; + switch (D_i5_801B8C0C[boss->dmgPart]) { + case 0: + D_i5_801BBEF0[30] = 15; + + D_i5_801BBEF0[27] -= boss->damage; + break; + case 1: + D_i5_801BBEF0[33] = 15; + + D_i5_801BBEF0[27] -= boss->damage; + break; + case 2: + D_i5_801BBEF0[34] = 15; + + D_i5_801BBEF0[27] -= boss->damage; + break; + } + } + Math_SmoothStepToF(&boss->vel.z, gPlayer[0].vel.z, 0.7f, 1.0f, 0.01f); + Math_SmoothStepToF(&boss->obj.pos.x, gPlayer[0].pos.x, 0.1f, 6.0f, 0.01f); + Math_SmoothStepToF(&boss->obj.pos.z, gPlayer[0].unk_138 - 450.0f, 0.1f, 1.0f, 0.01f); + Animation_GetFrameData(&D_A000D50, D_i5_801BBEF0[24] >> 1, D_i5_801BCA38); + + switch (D_i5_801BBEF0[39]) { + case 0: + Animation_GetFrameData(&D_A000858, D_i5_801BBEF0[22] >> 1, D_i5_801BC978); + break; + case 1: + Animation_GetFrameData(&D_A00047C, D_i5_801BBEF0[22] >> 1, D_i5_801BC978); + break; + } + + switch (D_i5_801BBEF0[40]) { + case 0: + Animation_GetFrameData(&D_A000858, D_i5_801BBEF0[23] >> 1, D_i5_801BC9D8); + break; + case 1: + Animation_GetFrameData(&D_A00047C, D_i5_801BBEF0[23] >> 1, D_i5_801BC9D8); + break; + } + Math_SmoothStepToVec3fArray(D_i5_801BC978, D_i5_801BCDC8, 1, 8, 0.5f, 360.0f, 0.01f); + Math_SmoothStepToVec3fArray(D_i5_801BC9D8, D_i5_801BCE28, 1, 8, 0.5f, 360.0f, 0.01f); + Math_SmoothStepToVec3fArray(D_i5_801BCA38, D_i5_801BCE88, 1, 13, 0.5f, 5.0f, 0.01f); + D_i5_801BBEF0[24]++; + D_i5_801BBEF0[22]++; + D_i5_801BBEF0[23]++; + + if (D_i5_801BBEF0[24] >= (Animation_GetFrameCount(&D_A000D50) * 2)) { + D_i5_801BBEF0[24] = 0; + } + + switch (D_i5_801BBEF0[39]) { + case 0: + + if (D_i5_801BBEF0[22] >= (Animation_GetFrameCount(&D_A000858) * 2)) { + D_i5_801BBEF0[22] = 0; + } + break; + case 1: + + if (D_i5_801BBEF0[22] >= (Animation_GetFrameCount(&D_A00047C) * 2)) { + D_i5_801BBEF0[22] = 0; + } + break; + } + + switch (D_i5_801BBEF0[40]) { + case 0: + if (D_i5_801BBEF0[23] >= (Animation_GetFrameCount(&D_A000858) * 2)) { + D_i5_801BBEF0[23] = 0; + } + break; + case 1: + if (D_i5_801BBEF0[23] >= (Animation_GetFrameCount(&D_A00047C) * 2)) { + D_i5_801BBEF0[23] = 0; + } + break; + } + D_i5_801BBEF4[51] = (f32) (SIN_DEG((((f32) (boss->swork[38] & 0x7F) * 360.0f) / 128)) * 40.0f); + + switch (D_i5_801BBEF0[28]) { + case 0: + if (D_i5_801BBEF0[29] == 0) { + D_i5_801BBEF0[28] = 1; + } + break; + case 1: + if (D_i5_801BBEF0[22] == 0) { + D_i5_801BBEF0[39] = 1; + D_i5_801BBEF4[45] = 0.0f; + D_i5_801BBEF4[47] = 0.0f; + D_i5_801BBEF4[55] = RAND_FLOAT(2.0f) - 1.0f; + D_i5_801BBEF0[28] = 2; + } + break; + case 2: + if (D_i5_801BBEF0[22] == 0) { + D_i5_801BBEF0[39] = 0; + D_i5_801BBEF4[45] = -240.0f + RAND_FLOAT(30.0f) - 15.0f; + D_i5_801BBEF4[47] = -200.0f + RAND_FLOAT(20.0f); + D_i5_801BBEF4[55] = RAND_FLOAT(20.0f); + D_i5_801BBEF0[28] = 3; + } + break; + case 3: + if (D_i5_801BBEF0[23] == 0) { + D_i5_801BBEF0[40] = 1; + D_i5_801BBEF4[48] = 0.0f; + D_i5_801BBEF4[50] = 0.0f; + D_i5_801BBEF4[63] = RAND_FLOAT(2.0f) - 1.0f; + D_i5_801BBEF0[28] = 4; + } + break; + case 4: + if (D_i5_801BBEF0[23] == 0) { + D_i5_801BBEF0[40] = 0; + D_i5_801BBEF4[48] = 240.0f + RAND_FLOAT(30.0f) - 15.0f; + D_i5_801BBEF4[50] = -200.0f + RAND_FLOAT(20.0f); + D_i5_801BBEF4[63] = -Rand_ZeroOne() * 20.0f; + D_i5_801BBEF0[28] = 1; + } + break; + default: + break; + } + if (D_i5_801BBEF0[27] <= 0) { + D_i5_801BBEF4[45] = -90.0f; + D_i5_801BBEF4[46] = -70.0f; + D_i5_801BBEF4[47] = -250.0f; + D_i5_801BBEF4[48] = 90.0f; + D_i5_801BBEF4[49] = -70.0f; + D_i5_801BBEF4[50] = -250.0f; + D_i5_801BBEF4[51] = 0.0f; + D_i5_801BBEF4[52] = -100.0f; + D_i5_801BBEF4[53] = -350.0f; + D_i5_801BBEF4[63] = 0.0f; + D_i5_801BBEF4[55] = D_i5_801BBEF4[63]; + Audio_PlaySfx(0x2900502A, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + Audio_PlaySfx(0x2940802C, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + boss->swork[1] = 4; + boss->timer_050 = 120; + D_i5_801BBEF0[22] = 0; + D_i5_801BBEF0[23] = 0; + D_i5_801BBEF0[24] = 0; + boss->swork[31] = 0; + boss->fwork[0] = 0.0f; + boss->swork[30]++; + } + break; + case 4: + boss->vel.z = gPlayer[0].vel.z; + Animation_GetFrameData(&D_8000D80, D_i5_801BBEF0[22] >> 1, D_i5_801BC978); + Animation_GetFrameData(&D_8000D80, D_i5_801BBEF0[23] >> 1, D_i5_801BC9D8); + Animation_GetFrameData(&D_8000708, D_i5_801BBEF0[24] >> 1, D_i5_801BCA38); + Math_SmoothStepToF(boss->fwork, 0.5f, 0.05f, 0.05f, 0.01f); + Math_SmoothStepToVec3fArray(D_i5_801BC978, D_i5_801BCDC8, 1, 8, boss->fwork[0], 360.0f, 0.01f); + Math_SmoothStepToVec3fArray(D_i5_801BC9D8, D_i5_801BCE28, 1, 8, boss->fwork[0], 360.0f, 0.01f); + Math_SmoothStepToVec3fArray(D_i5_801BCA38, D_i5_801BCE88, 1, 13, boss->fwork[0], 360.0f, 0.01f); + if (boss->timer_050 <= 120) { + if (D_i5_801BBEF0[22] < ((Animation_GetFrameCount(&D_8000D80) * 2) - 1)) { + D_i5_801BBEF0[22]++; + } + } + if (boss->timer_050 < 108) { + if (D_i5_801BBEF0[23] < ((Animation_GetFrameCount(&D_8000D80) * 2) - 1)) { + D_i5_801BBEF0[23]++; + } + } + if (boss->timer_050 <= 120) { + if (D_i5_801BBEF0[24] < ((Animation_GetFrameCount(&D_8000708) * 2) - 1)) { + D_i5_801BBEF0[24]++; + } + } + if (boss->timer_050 == 0) { + boss->swork[1] = 5; + boss->timer_050 = 90; + } + break; + } + if ((boss->state >= 3) && (boss->state < 5)) { + if ((boss->state != 4) || (boss->swork[31] < 100)) { + temp_ft2 = boss->obj.pos.x + D_i5_801BBEF4[36]; + temp_ft4 = boss->obj.pos.z + D_i5_801BBEF4[38]; + + temp_fa1 = D_i5_801BBEF4[57] - temp_ft2; + temp_fv1 = D_i5_801BBEF4[58] - temp_ft4; + + if ((s32) sqrtf(SQ(temp_fa1) + SQ(temp_fv1)) > 50.0f) { + + effect = func_8007783C(OBJ_EFFECT_394); + if (effect != NULL) { + effect->obj.status = OBJ_ACTIVE; + effect->unk_7A = 10; + effect->unk_78 = effect->unk_7A; + effect->obj.pos.x = temp_ft2; + effect->obj.pos.y = boss->obj.pos.y; + effect->obj.pos.z = temp_ft4; + + effect->obj.rot.y = (Math_Atan2F(-temp_fv1, temp_fa1) * M_RTOD) - 90.0f; + effect->info.unk_14 = -1; + effect->unk_46 = 70; + effect->scale2 = sqrtf(SQ(temp_fa1) + SQ(temp_fv1)) / 26.0f; + } + D_i5_801BBEF4[57] = temp_ft2; + D_i5_801BBEF4[58] = temp_ft4; + } + if (!(boss->swork[38] & 3)) { + func_8007A900(temp_ft2, boss->obj.pos.y, temp_ft4, 10.0f, 0xC0, 0x10, 0); + } + } + if ((boss->state != 4) || (boss->swork[31] < 90)) { + temp_ft2 = boss->obj.pos.x + D_i5_801BBEF4[39]; + temp_ft4 = boss->obj.pos.z + D_i5_801BBEF4[41]; + + temp_fa1 = D_i5_801BBEF4[59] - temp_ft2; + temp_fv1 = D_i5_801BBEF4[60] - temp_ft4; + + if ((s32) sqrtf(SQ(temp_fa1) + SQ(temp_fv1)) > 50.0f) { + + effect = func_8007783C(OBJ_EFFECT_394); + + if (effect != NULL) { + effect->obj.status = OBJ_ACTIVE; + effect->unk_7A = 10; + effect->unk_78 = effect->unk_7A; + effect->obj.pos.x = temp_ft2; + effect->obj.pos.y = boss->obj.pos.y; + effect->obj.pos.z = temp_ft4; + + effect->obj.rot.y = (Math_Atan2F(-temp_fv1, temp_fa1) * M_RTOD) - 90.0f; + effect->info.unk_14 = -1; + effect->unk_46 = 50; + effect->scale2 = sqrtf(SQ(temp_fa1) + SQ(temp_fv1)) / 26.0f; + } + D_i5_801BBEF4[59] = temp_ft2; + D_i5_801BBEF4[60] = temp_ft4; + } + if (!(boss->swork[38] & 3)) { + func_8007A900(temp_ft2, boss->obj.pos.y, temp_ft4, 10.0f, 0xC0, 0x10, 0); + } + } + if ((boss->state != 4) || (boss->swork[31] < 102)) { + temp_ft2 = boss->obj.pos.x + D_i5_801BBEF4[42]; + temp_ft4 = boss->obj.pos.z + D_i5_801BBEF4[44]; + + temp_fa1 = D_i5_801BBEF4[61] - temp_ft2; + temp_fv1 = D_i5_801BBEF4[62] - temp_ft4; + + if ((s32) sqrtf(SQ(temp_fa1) + SQ(temp_fv1)) > 50.0f) { + + effect = func_8007783C(OBJ_EFFECT_394); + + if (effect != NULL) { + effect->state = 10; + effect->unk_7A = 10; + effect->unk_78 = effect->unk_7A; + effect->obj.pos.x = temp_ft2; + effect->obj.pos.y = boss->obj.pos.y; + effect->obj.pos.z = temp_ft4; + + effect->obj.rot.y = (Math_Atan2F(-temp_fv1, temp_fa1) * M_RTOD) - 90.0f; + effect->info.unk_14 = -1; + effect->unk_46 = 50; + effect->scale2 = sqrtf(SQ(temp_fa1) + SQ(temp_fv1)) / 26.0f; + } + D_i5_801BBEF4[61] = temp_ft2; + D_i5_801BBEF4[62] = temp_ft4; + } + if (!(boss->swork[38] & 3)) { + func_8007A900(temp_ft2, boss->obj.pos.y, temp_ft4, 10.0f, 0xC0, 0x10, 0); + } + } + } + boss->dmgType = DMG_NONE; +} + +void func_i5_80193B30(Boss* boss) { + + if (boss->state == boss->swork[1]) { + if (boss->swork[1] != 11) { + boss->swork[1] = 11; + } else { + boss->swork[1] = 9; + } + } + switch (boss->swork[1]) { + case 8: + if ((boss->swork[11] <= 0) && (boss->swork[12] <= 0)) { + if (boss->swork[35] == 0) { + boss->swork[1] = 12; + } else { + boss->swork[1] = 11; + } + } + break; + case 10: + if (D_i5_801BBEF0[8] != 0) { + boss->swork[1] = 12; + } + break; + case 11: + if (boss->swork[35] == 0) { + boss->swork[1] = 8; + } + break; + } + if (boss->swork[1] != 7) { + boss->swork[36]++; + } else { + boss->swork[36] = 0; + } + if (boss->swork[36] >= 2) { + boss->swork[1] = 7; + boss->swork[36] = 0; + } + if (boss->swork[1] == 8) { + boss->swork[3] = 2; + } else { + boss->swork[3] = 1; + } + D_i5_801BBEF4[11] = D_i5_801B7738[boss->swork[1]]; + + switch (boss->swork[1]) { + case 7: + case 8: + case 9: + case 10: + if (boss->fwork[35] != 1.0f) { + D_i5_801BBEF0[13] = 1; + boss->fwork[35] = 1.0f; + D_i5_801BBEF4[32] = 10.0f; + D_i5_801BBEF4[33] = 10.0f; + } + break; + case 11: + boss->fwork[35] = 0.0f; + break; + case 12: + boss->fwork[35] = 0.0f; + break; + } + switch (boss->swork[1]) { + case 7: + if (boss->swork[9] > 0) { + boss->fwork[36] = 1.0f; + D_i5_801BBEF0[14] = 1; + D_i5_801BBEF4[34] = 1.0f; + } + if ((boss->swork[10] > 0) && (D_i5_801BBEF0[8] != 0)) { + boss->fwork[37] = 1.0f; + D_i5_801BBEF0[15] = 1; + D_i5_801BBEF4[35] = 1.0f; + } + boss->swork[34] = 1; + break; + case 8: + boss->swork[34] = 1; + break; + case 9: + boss->swork[34] = 1; + break; + case 10: + boss->swork[34] = 1; + break; + case 11: + boss->swork[34] = 1; + boss->swork[24] = 1; + boss->fwork[45] = 230.0f; + break; + case 12: + boss->swork[34] = 2; + boss->fwork[48] = 0.0f; + break; + default: + break; + } +} + +const s16 D_i5_801BAA50[19] = { + 0, 1, 91, 34, 90, 68, 33, 32, 31, 30, 29, 53, 37, 36, 35, 47, 40, 39, 38, +}; + +const s16 D_i5_801BAA78[34] = { + 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +const s16 D_i5_801BAABC[4][10] = { + { 22, 21, 20, 44, 45, 46, 47, 48, 57, -1 }, + { 5, 6, 7, 39, 40, 41, 42, 43, 63, -1 }, + { 8, 9, 10, 11, 12, 13, 50, -1, 0, 0 }, + { 14, 15, 16, 17, 18, 19, 58, -1, 0, 0 }, +}; + +const s16 D_i5_801BAB0C[4][10] = { + { 0, 0, 0, 5, 5, 5, 5, 5, 5, -1 }, + { 0, 0, 0, 5, 5, 5, 5, 5, 5, -1 }, + { 0, 5, 5, 5, 5, 5, 5, -1, 0, 0 }, + { 0, 5, 5, 5, 5, 5, 5, -1, 0, 0 }, +}; + +const s16 D_i5_801BAB5C[8] = { + 0x456E, 0x6D2D, 0x3E63, 0x6870, 0x743D, 0x3C25, 0x643E, 0x0A00, +}; + +#ifdef NON_EQUIVALENT +// lui/addiu issues, with problem loops +// https://decomp.me/scratch/UBc0r + +void func_i5_80193DF0(Boss* boss) { + Vec3f spD4; + Vec3f spC8; + s32 i; + s32 j; + s32 var_v1; + s32 spB8; + f32 temp_f; + Effect* effect; + s32 pad2; + Actor* actor; + s32 spA4; + s32 pad; + f32 sp9C; + Vec3f sp90; + Vec3f sp84; + f32 temp; + + Matrix_RotateY(gCalcMatrix, boss->obj.rot.y * M_DTOR, 0); + + for (i = 0; i < ARRAY_COUNTU(D_i5_801BBF00); i++) { + if (D_i5_801BBF00[i].unk_26 & 0x10) { + if ((i == 0x27) && (D_i5_801BBEF0[8] == 0)) { + boss->swork[37] |= 0x18; + D_i5_801BBEF0[44] = 0; + D_i5_801BBEF0[8] = -1; + D_i5_801BBEF0[41] = 1; + actor = func_800A3608(0xC6); + if (actor != NULL) { + Matrix_MultVec3f(gCalcMatrix, &D_i5_801BBF00[i].unk_00.pos, &spC8); + actor->obj.pos.x = boss->obj.pos.x + spC8.x; + actor->obj.pos.y = boss->obj.pos.y + spC8.y; + actor->obj.pos.z = boss->obj.pos.z + spC8.z; + actor->obj.rot.x = D_i5_801BBF00[i].unk_00.rot.x + boss->obj.rot.x; + actor->obj.rot.y = D_i5_801BBF00[i].unk_00.rot.y + boss->obj.rot.y; + actor->obj.rot.z = D_i5_801BBF00[i].unk_00.rot.z + boss->obj.rot.z; + } + } + D_i5_801BBF00[i].unk_26 &= ~0x10; + } + if (D_i5_801BBF00[i].unk_26 & 2) { + actor = func_800A3608(0xBD); + if (actor != NULL) { + actor->state = 40; + actor->unk_046 = D_i5_801B7770[i][5]; + actor->unk_048 = D_i5_801B7770[i][1]; + if (D_i5_801B7770[i][0] == 0x55) { + actor->fwork[0] = 5.0f; + actor->fwork[1] = 5.0f; + actor->obj.pos.x = D_i5_801BBF00[i].unk_00.pos.x + boss->obj.pos.x; + actor->obj.pos.y = D_i5_801BBF00[i].unk_00.pos.y + boss->obj.pos.y; + actor->obj.pos.z = D_i5_801BBF00[i].unk_00.pos.z + boss->obj.pos.z; + actor->obj.rot.x = D_i5_801BBF00[i].unk_00.rot.x + boss->obj.rot.x; + actor->obj.rot.y = D_i5_801BBF00[i].unk_00.rot.y + boss->obj.rot.y; + actor->obj.rot.z = D_i5_801BBF00[i].unk_00.rot.z + boss->obj.rot.z; + Matrix_Push(&gCalcMatrix); + Matrix_RotateY(gCalcMatrix, 0.0f, 0); + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B8D18, &spC8); + Matrix_Pop(&gCalcMatrix); + actor->vel.x = spC8.x; + actor->vel.y = 5.0f; + actor->vel.z = spC8.z; + actor->gravity = 0.8f; + } else { + actor->fwork[0] = (Rand_ZeroOne() * 10.0f) + 10.0f; + actor->fwork[1] = (Rand_ZeroOne() * 10.0f) + 10.0f; + actor->obj.pos.x = D_i5_801BBF00[i].unk_00.pos.x + boss->obj.pos.x; + actor->obj.pos.y = D_i5_801BBF00[i].unk_00.pos.y + boss->obj.pos.y; + actor->obj.pos.z = D_i5_801BBF00[i].unk_00.pos.z + boss->obj.pos.z; + actor->obj.rot.x = D_i5_801BBF00[i].unk_00.rot.x + boss->obj.rot.x; + actor->obj.rot.y = D_i5_801BBF00[i].unk_00.rot.y + boss->obj.rot.y; + actor->obj.rot.z = D_i5_801BBF00[i].unk_00.rot.z + boss->obj.rot.z; + Matrix_Push(&gCalcMatrix); + Matrix_RotateY(gCalcMatrix, Rand_ZeroOne() * 360.0f * M_DTOR, 0); + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B8D0C, &spC8); + Matrix_Pop(&gCalcMatrix); + actor->vel.x = spC8.x; + actor->vel.y = (f32) ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * ((Rand_ZeroOne() * 2.0f) + 15.0f); + actor->vel.z = spC8.z; + actor->gravity = 2.5f; + } + } + D_i5_801BBF00[i].unk_26 = 4; + Audio_PlaySfx(0x2903B009, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + } + if (boss->fwork[38] != 0.0f) { + Math_SmoothStepToF(&D_i5_801BBEF4[15], D_i5_801BBEF4[24], 1.0f, D_i5_801BBEF4[32], 0.01f); + Math_SmoothStepToAngle(&D_i5_801BBEF4[16], D_i5_801BBEF4[25], 1.0f, D_i5_801BBEF4[33], 0.01f); + } + if (boss->fwork[39] != 0.0f) { + Math_SmoothStepToAngle(&D_i5_801BBEF4[18], D_i5_801BBEF4[27], 1.0f, D_i5_801BBEF4[34], 0.01f); + Math_SmoothStepToAngle(&D_i5_801BBEF4[19], D_i5_801BBEF4[28], 1.0f, D_i5_801BBEF4[34], 0.01f); + } + if (boss->fwork[0x28] != 0.0f) { + Math_SmoothStepToAngle(&D_i5_801BBEF4[21], D_i5_801BBEF4[30], 1.0f, D_i5_801BBEF4[35], 0.01f); + Math_SmoothStepToAngle(&D_i5_801BBEF4[22], D_i5_801BBEF4[31], 1.0f, D_i5_801BBEF4[35], 0.01f); + } + Math_SmoothStepToF(&boss->fwork[38], boss->fwork[35], 1.0f, 0.3f, 0.01f); + Math_SmoothStepToF(&boss->fwork[39], boss->fwork[0x24], 0.2f, 0.5f, 0.01f); + Math_SmoothStepToF(&boss->fwork[0x28], boss->fwork[37], 0.2f, 0.5f, 0.01f); + if (D_i5_801BBEF0[6] > 0) { + D_i5_801BBEF0[6]--; + if (D_i5_801BBEF0[6] == 0) { + for (i = 0; i < ARRAY_COUNTU(D_i5_801BBF00); i++) { + D_i5_801BBF00[i].unk_18 = D_i5_801BBF00[i].unk_1C = D_i5_801BBF00[i].unk_20 = 0.0f; + } + } + } + + for (i = 0; i < 4; i++) { + if (boss->swork[i + 5] > 0) { + boss->swork[i + 5]--; + } + } + + for (i = 0; i < 0x22; i++) { + if (D_i5_801BD668[i] > 0) { + D_i5_801BD6B0[i] += D_i5_801B7960[i][3]; + D_i5_801BD668[i]--; + } + } + + if (boss->swork[22] > 0) { + boss->swork[22]--; + } + if (boss->swork[28] != 0) { + if (boss->swork[0x1B] > 0) { + boss->swork[0x1B]--; + } + } + + if (D_i5_801BBEF0[2] > 0) { + D_i5_801BBEF0[2]--; + } + + if (D_i5_801BBEF0[4] > 0) { + D_i5_801BBEF0[4]--; + } + + if ((D_i5_801BBEF0[3] != 0) && + (Math_SmoothStepToAngle(&D_i5_801BBEF4[6], D_i5_801BBEF4[7], 1.0f, 8.0f, 0.01f) == 0.0f)) { + if (D_i5_801BBEF4[7] == 48.0f) { + D_i5_801BBEF4[7] = 0.0f; + } else { + D_i5_801BBEF4[7] = 48.0f; + D_i5_801BBEF0[3]--; + } + } + if ((D_i5_801BBEF0[5] != 0) && + (Math_SmoothStepToAngle(&D_i5_801BBEF4[8], D_i5_801BBEF4[9], 1.0f, 8.0f, 0.01f) == 0.0f)) { + if (D_i5_801BBEF4[9] == 48.0f) { + D_i5_801BBEF4[9] = 0.0f; + } else { + D_i5_801BBEF4[9] = 48.0f; + D_i5_801BBEF0[5]--; + } + } + if (D_i5_801BBEF0[6] != 0) { + for (i = 0; i < ARRAY_COUNTU(D_i5_801BBF00); i++) { + for (j = 0; j < 14; j++) { + if (D_i5_801B7770[i][0] == D_i5_801B8160[j]) { + break; + } + } + if (j == 14) { + D_i5_801BBF00[i].unk_20 = (Rand_ZeroOne() * 5.0f) - 2.5f; + } + } + } + + for (i = 0; i < 4; i++) { + if ((boss->swork[i + 9] > 0) && (boss->swork[i + 9] < 0xB)) { + D_i5_801BD668[i + 24] = 1; + } + } + + if ((boss->state >= 7) && (boss->state < 0xE) && (boss->dmgType == DMG_BEAM) && + (D_i5_801BAA78[D_i5_801B7904[boss->dmgPart]] == 2) && (D_i5_801BBEF0[8] == 0)) { + Audio_PlaySfx(0x29121007, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + boss->dmgType = DMG_NONE; + } + if ((boss->state >= 7) && (boss->state < 0xE)) { + if (boss->dmgType == DMG_BEAM) { + boss->dmgType = DMG_NONE; + D_i5_801BD668[D_i5_801B7904[boss->dmgPart]] = D_i5_801B7960[D_i5_801B7904[boss->dmgPart]][1]; + D_i5_801BD6B0[D_i5_801B7904[boss->dmgPart]] = 0; + + if ((D_i5_801B7904[boss->dmgPart] == 6) && (boss->state == 0xB)) { + D_i5_801BD668[D_i5_801B7904[boss->dmgPart]] = 0; + } + + if (D_i5_801BAA78[D_i5_801B7904[boss->dmgPart]] != 0) { + Audio_PlaySfx(0x2940802C, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + boss->swork[D_i5_801BAA78[D_i5_801B7904[boss->dmgPart]] + 4] = 0x14; + if (boss->swork[D_i5_801BAA78[D_i5_801B7904[boss->dmgPart]] + 8] > 0) { + boss->swork[D_i5_801BAA78[D_i5_801B7904[boss->dmgPart]] + 8] -= boss->damage; + if (boss->swork[D_i5_801BAA78[D_i5_801B7904[boss->dmgPart]] + 8] <= 0) { + boss->swork[D_i5_801BAA78[D_i5_801B7904[boss->dmgPart]] + 8] = 0; + D_i5_801BBEF0[6] = 0x28; + D_i5_801BBEF4[10] = 2.0f; + } + } + var_v1 = 0; + for (i = 0; i < 4; i++) { + if (boss->swork[i + 9] <= 0) { + var_v1++; + } + } + if ((var_v1 == 3) && (D_i5_801BBEF0[8] == 0)) { + D_i5_801BBF00[39].unk_26 |= 0x11; + } + if (var_v1 == 4) { + D_i5_801BBEF0[41] = 0; + boss->swork[28] = 1; + boss->swork[0x1B] = 0x50; + boss->swork[35]++; + } + } else if ((gBossHealthBar > 0) && (D_i5_801B7904[boss->dmgPart] == 0x17) && (boss->swork[29] != 0) && + (boss->swork[21] > 0)) { + boss->swork[21] -= boss->damage; + if (boss->swork[21] <= 0) { + D_8017796C = -1; + boss->swork[21] = 0; + D_Timer_80161A60 = 8; + Audio_PlaySfx(0x2940D09A, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } else { + Audio_PlaySfx(0x2940802C, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + + if (boss->swork[21] < 0xB) { + D_i5_801BBEF0[1] = 15; + } else if (boss->swork[21] < 0x15) { + D_i5_801BBEF0[1] = 20; + } + } + gBossHealthBar = (s32) (((f32) boss->swork[21] * 255.0f) / 100.0f); + boss->swork[22] = 0x14; + D_i5_801BBEF0[6] = 0x14; + D_i5_801BBEF4[10] = 4.0f; + } else if (D_i5_801B7904[boss->dmgPart] == 0x1C) { + boss->swork[37] |= 4; + D_i5_801BBEF0[43] = 0; + } else { + Audio_PlaySfx(0x29121007, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + } + if ((boss->dmgType == DMG_BOMB) && (boss->dmgPart == 1) && (D_i5_801BBEF0[8] == 0)) { + boss->dmgType = DMG_NONE; + } + if (boss->dmgType == DMG_BOMB) { + boss->dmgType = DMG_NONE; + switch (boss->dmgPart) { + case 0: + case 1: + case 2: + case 3: + Audio_PlaySfx(0x2940802C, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + boss->swork[boss->dmgPart + 5] = 0x14; + if (boss->swork[boss->dmgPart + 9] <= 0) { + break; + } + boss->swork[boss->dmgPart + 9] -= boss->damage; + if (boss->swork[boss->dmgPart + 9] <= 0) { + boss->swork[boss->dmgPart + 9] = 0; + D_i5_801BBEF0[6] = 0x28; + D_i5_801BBEF4[10] = 2.0f; + var_v1 = 0; + for (i = 0; i < 4; i++) { + if (boss->swork[i + 9] <= 0) { + var_v1++; + } + } + + if ((var_v1 == 3) && (D_i5_801BBEF0[8] == 0)) { + D_i5_801BBF00[39].unk_26 |= 0x11; + } + if (var_v1 == 4) { + D_i5_801BBEF0[41] = 0; + boss->swork[28] = 1; + boss->swork[0x1B] = 0x50; + boss->swork[35]++; + } + } + break; + case 4: + if ((gBossHealthBar > 0) && (boss->swork[29] != 0) && (boss->swork[21] > 0)) { + Audio_PlaySfx(0x2940802C, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + boss->swork[21] -= boss->damage; + if (boss->swork[21] <= 0) { + boss->swork[21] = 0; + D_Timer_80161A60 = 8; + D_8017796C = -1; + Audio_PlaySfx(0x2940D09A, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } else { + Audio_PlaySfx(0x2940802C, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + + if (boss->swork[21] < 0xB) { + D_i5_801BBEF0[1] = 0xF; + } else if (boss->swork[21] < 0x15) { + D_i5_801BBEF0[1] = 0x14; + } + } + gBossHealthBar = (s32) (((f32) boss->swork[21] * 255.0f) / 100.0f); + boss->swork[22] = 0x14; + D_i5_801BBEF0[6] = 0x14; + D_i5_801BBEF4[10] = 4.0f; + } + break; + } + } + } + + if ((boss->state >= 6) && (boss->state < 0xE) && (D_i5_801BBEF0[1] != 0)) { + D_i5_801BBEF0[0]++; + if (D_i5_801BBEF0[0] >= D_i5_801BBEF0[1]) { + D_i5_801BBEF0[0] -= D_i5_801BBEF0[1]; + } + } + + switch (boss->swork[28]) { + + case 1: + if (boss->swork[0x1B] == 0) { + boss->swork[28]++; + } + break; + case 2: + D_i5_801BBF00[61].unk_26 = 3; + D_i5_801BBEF4[2] = 0.0f; + D_i5_801BBEF4[1] = 20.0f; + boss->swork[28]++; + Audio_PlaySfx(0x2900803F, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + Audio_PlaySfx(0x11003023, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + break; + case 3: + D_i5_801BBEF4[2] += D_i5_801BBEF4[1]; + D_i5_801BBEF4[1] += 4.0; + if (D_i5_801BBEF4[2] >= 116.0f) { + boss->swork[28]++; + D_i5_801BBEF4[3] = 40.0f; + D_i5_801BBEF4[5] = 5.0f; + D_i5_801BBEF4[4] = 20.0f; + boss->swork[29] = 1; + boss->swork[37] |= 1; + Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + break; + case 4: + D_i5_801BBEF4[3]--; + if (D_i5_801BBEF4[3] == 0) { + boss->swork[0x1B] = 0x12C; + boss->swork[28]++; + } + break; + case 5: + if (boss->swork[0x1B] == 0) { + D_i5_801BBEF4[3] = 40.0f; + D_i5_801BBEF4[5] = 5.0f; + D_i5_801BBEF4[4] = 20.0f; + boss->swork[28]++; + } + break; + case 6: + D_i5_801BBEF4[3] -= 1; + if (D_i5_801BBEF4[3] == 0) { + D_i5_801BBEF4[1] = -40.0f; + D_i5_801BBEF4[4] = 0.0f; + boss->swork[28]++; + } + break; + case 7: + D_i5_801BBEF4[2] += D_i5_801BBEF4[1]; + D_i5_801BBEF4[1] -= 3.0; + if (D_i5_801BBEF4[2] <= 0.0f) { + func_8001A55C(boss->sfxPos, 0x11003023); + boss->swork[29] = 0; + D_i5_801BBEF4[2] = 0.0f; + boss->swork[28]++; + } + break; + case 8: + Audio_PlaySfx(0x11033022, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + + for (i = 0; i < 0x21; i++) { + actor = func_800A3608(0xBD); + if (actor != NULL) { + actor->state = 40; + actor->obj.pos.x = 0.0f; + actor->obj.pos.y = 0.0f; + actor->obj.pos.z = boss->obj.pos.z + 2000.0f; + actor->info.unk_10 = 5000.0f; + actor->unk_046 = D_i5_801B7770[D_i5_801B8198[i].unk_00][5]; + actor->unk_048 = D_i5_801B7770[D_i5_801B8198[i].unk_00][1]; + D_i5_801B8198[i].unk_0C = D_i5_801B8198[i].unk_04; + actor->vel.z = boss->vel.z; + D_i5_801BBF00[D_i5_801B8198[i].unk_00].unk_26 |= 1; + } + D_i5_801B8198[i].actor = actor; + } + boss->swork[28]++; + break; + case 9: + for (i = 0; i < 0x21; i++) { + actor = D_i5_801B8198[i].actor; + if (actor != NULL) { + j = D_i5_801B8198[i].unk_00; + actor->obj.pos.x = (D_i5_801BBF00[j].unk_00.pos.x * 2.0f) + boss->obj.pos.x; + actor->obj.pos.y = D_i5_801BBF00[j].unk_00.pos.y + boss->obj.pos.y; + } + } + boss->swork[28]++; + break; + case 10: + Matrix_RotateY(gCalcMatrix, boss->obj.rot.y * M_DTOR, 0); + spA4 = 0; + for (i = 0; i < 0x21; i++) { + actor = D_i5_801B8198[i].actor; + if (actor != NULL) { + if (D_i5_801B8198[i].unk_0C == 0) { + j = D_i5_801B8198[i].unk_00; + Matrix_MultVec3f(gCalcMatrix, &D_i5_801BBF00[j].unk_00.pos, &spC8); + sp9C = + fabsf(Math_SmoothStepToF(&actor->obj.pos.x, boss->obj.pos.x + spC8.x, 1.0f, 40.0f, 0.01f)); + sp9C += + fabsf(Math_SmoothStepToF(&actor->obj.pos.y, boss->obj.pos.y + spC8.y, 1.0f, 40.0f, 0.01f)); + sp9C += + fabsf(Math_SmoothStepToF(&actor->obj.pos.z, boss->obj.pos.z + spC8.z, 1.0f, 90.0f, 0.01f)); + actor->obj.rot.x += 20.0f; + actor->obj.rot.y += 20.0f; + actor->obj.rot.z += 20.0f; + if (sp9C <= 25.0f) { + D_i5_801BBF00[D_i5_801B8198[i].unk_00].unk_26 = 8; + Object_Kill(&actor->obj, actor->sfxPos); + D_i5_801B8198[i].actor = NULL; + } + } else if (D_i5_801B8198[i].unk_0C > 0) { + D_i5_801B8198[i].unk_0C--; + } + } else { + spA4++; + } + } + + if (spA4 == 0x21) { + boss->swork[28]++; + } + break; + case 11: + for (i = 0; i < 0x21U; i++) { + D_i5_801BBF00[D_i5_801B8198[i].unk_00].unk_26 = 0; + } + + for (i = 0; i < 4; i++) { + boss->swork[i + 9] = 0x1E; + boss->swork[i + 13] = 0; + boss->swork[i + 17] = 0; + } + + boss->swork[28] = 0; + boss->swork[37] |= 2; + break; + case 0: + break; + } + Math_SmoothStepToAngle(&D_i5_801BBEF4[13], D_i5_801BBEF4[12], 0.5f, 1.5f, 0.01f); + spB8 = 0; + + switch (boss->state) { + case 7: + Animation_GetFrameData(&D_70084CC, boss->unk_04C >> 1, D_i5_801BC978); + break; + case 8: + Animation_GetFrameData(&D_7003EE8, boss->unk_04C >> 1, D_i5_801BC978); + break; + case 9: + Animation_GetFrameData(&D_8008FE8, boss->unk_04C >> 1, D_i5_801BC978); + break; + case 10: + Animation_GetFrameData(&D_700E244, boss->unk_04C >> 1, D_i5_801BC978); + break; + case 11: + case 13: + Animation_GetFrameData(&D_9004288, boss->unk_04C >> 1, D_i5_801BC978); + break; + case 12: + Animation_GetFrameData(&D_A009990, boss->unk_04C >> 1, D_i5_801BC978); + break; + } + + switch (boss->swork[34]) { + case 0: + break; + case 1: + Animation_GetFrameData(&D_70096EC, (s32) boss->fwork[48] >> 1, D_i5_801BD218); + // might need to copy individual values + for (i = 0; i < 0x13; i++) { + D_i5_801BC978[D_i5_801BAA50[i]] = D_i5_801BD218[D_i5_801BAA50[i]]; + } + + break; + case 2: + Animation_GetFrameData(&D_A009990, (s32) boss->fwork[48] >> 1, D_i5_801BD218); + for (i = 0; i < 0x13; i++) { + D_i5_801BC978[D_i5_801BAA50[i]] = D_i5_801BD218[D_i5_801BAA50[i]]; + } + break; + } + if ((boss->state >= 7) && (boss->state < 0xD) && ((boss->fwork[9] > 0.0f) || (boss->fwork[6] > 0.0f))) { + if (boss->state == 0xC) { + if ((boss->fwork[9] > 0.0f) && (boss->fwork[6] > 0.0f)) { + Math_SmoothStepToF(&boss->obj.pos.x, gPlayer[0].pos.x, 0.1f, 10.0f, 0.01f); + } else { + Math_SmoothStepToF(&boss->obj.pos.x, gPlayer[0].pos.x, 0.1f, 4.0f, 0.01f); + } + } else { + Math_SmoothStepToF(&boss->obj.pos.x, gPlayer[0].pos.x, 0.1f, 3.0f, 0.01f); + } + } + switch (boss->state) { + case 5: + if (boss->timer_050 == 0) { + D_i5_801BBEF0[0] = 0; + D_i5_801BBEF0[1] = 0x19; + D_i5_801BBEF4[0] = 0.25f; + boss->obj.pos.x = gPlayer[0].pos.x; + boss->obj.pos.z = gPlayer[0].unk_138 - 1070.0f; + boss->vel.z = 0.0f; + Animation_GetFrameData(&D_900FC4C, 0, D_i5_801BCDC8); + D_i5_801BBEF4[8] = 48.0f; + D_i5_801BBEF4[9] = 48.0f; + boss->fwork[35] = 1.0f; + D_i5_801BBEF0[13] = 1; + D_i5_801BBEF4[32] = 10.0f; + D_i5_801BBEF4[33] = 10.0f; + boss->swork[1] = 6; + D_i5_801BBEF4[11] = D_i5_801B7738[boss->swork[1]]; + boss->swork[31] = 0; + boss->swork[30]++; + for (i = 0; i < ARRAY_COUNTU(D_i5_801BBF00); i++) { + D_i5_801BBF00[i].unk_26 = 1; + D_i5_801BBF00[i].unk_24 = -1; + } + } + break; + case 6: + boss->fwork[47] = (f32) boss->unk_04C / (f32) (Animation_GetFrameCount(&D_900FC4C) * 2); + if ((boss->unk_04C == 0) || (boss->unk_04C == 0x44) || (boss->unk_04C == 0x60) || (boss->unk_04C == 0x95)) { + Audio_PlaySfx(0x2900502A, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + temp_f = gPlayer[0].unk_138 - boss->obj.pos.z - 530.0f; + if (temp_f < 0.0f) { + boss->obj.pos.z += temp_f; + } + if (boss->unk_04C == 0x1A) { + gPlayer[0].unk_19C = -1; + gPlayer[0].unk_000 = 0.0f; + } + + for (i = 0; i < ARRAY_COUNTU(D_i5_801BBF00); i++) { + if ((D_i5_801BBF00[i].unk_24 < 0) && ((D_i5_801BBF00[i].unk_00.pos.y + boss->obj.pos.y) > 0.0f)) { + D_i5_801BBF00[i].unk_24 = 30; + } + if (D_i5_801BBF00[i].unk_24 > 0) { + D_i5_801BBF00[i].unk_24--; + if (!(D_i5_801BBF00[i].unk_24 & 1)) { + func_8007A900(D_i5_801BBF00[i].unk_00.pos.x + boss->obj.pos.x, + D_i5_801BBF00[i].unk_00.pos.y + boss->obj.pos.y, + D_i5_801BBF00[i].unk_00.pos.z + boss->obj.pos.z, 7.0f, 160, 16, 0); + } + } + if (D_i5_801BBF00[i].unk_24 != 0) { + D_i5_801BBF00[i].unk_26 = 1; + } + } + Animation_GetFrameData(&D_900FC4C, boss->unk_04C >> 1, D_i5_801BC978); + Math_SmoothStepToF(boss->fwork, 0.5f, 1.0f, 0.02f, 0.0f); + Math_SmoothStepToVec3fArray(D_i5_801BC978, D_i5_801BCDC8, 1, 0x5C, boss->fwork[0], 360.0f, 0.01f); + boss->unk_04C++; + if (boss->unk_04C >= (Animation_GetFrameCount(&D_900FC4C) * 2)) { + Audio_PlaySfx(0x2940702B, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + gPlayer[0].unk_19C = 0; + boss->unk_04C = 0; + boss->fwork[48] = 0; + Animation_GetFrameData(&D_70084CC, 0, D_i5_801BC978); + boss->swork[31] = 0; + boss->swork[30]++; + boss->vel.z = -15.0f; + spB8 = 1; + } + break; + case 7: + if (boss->swork[9] > 0) { + + for (i = 0; i < 9; i++) { + if (boss->unk_04C == D_i5_801B8138[i]) { + sp90.x = boss->obj.pos.x + boss->fwork[0x17]; + sp90.y = boss->obj.pos.y + boss->fwork[24]; + sp90.z = boss->obj.pos.z + boss->fwork[25]; + sp84.x = -boss->fwork[28]; + sp84.y = boss->fwork[0x1B] + 90.0f; + sp84.z = 0.0f; + func_8007EE68(0x161, &sp90, &sp84, &D_800C9F2C, &D_i5_801B8D48, 1.0f); + } + } + } + if ((boss->swork[10] > 0) && ((D_i5_801BBEF0[41] == 2) || (D_i5_801BBEF0[8] != 0))) { + + for (i = 0; i < 9; i++) { + if (boss->unk_04C == D_i5_801B814C[i]) { + sp90.x = boss->obj.pos.x + boss->fwork[29]; + sp90.y = boss->obj.pos.y + boss->fwork[30]; + sp90.z = boss->obj.pos.z + boss->fwork[31]; + sp84.x = -boss->fwork[34]; + sp84.y = boss->fwork[0x21] + 90.0f; + sp84.z = 0.0f; + func_8007EE68(0x161, &sp90, &sp84, &D_800C9F2C, &D_i5_801B8D48, 1.0f); + } + } + } + if (D_i5_801BBEF0[41] == 1) { + D_i5_801BBEF0[41] = 2; + } + if (D_i5_801BBEF0[2] == 0) { + D_i5_801BBEF4[7] = 48; + D_i5_801BBEF0[2] = 0x5A; + D_i5_801BBEF0[3] = 2; + } + if (D_i5_801BBEF0[8] != 0) { + if (D_i5_801BBEF0[4] == 0) { + D_i5_801BBEF4[9] = 48; + D_i5_801BBEF0[4] = 0x5A; + D_i5_801BBEF0[5] = 2; + } + } else { + D_i5_801BBEF4[8] = 48; + D_i5_801BBEF4[9] = 48; + } + Math_SmoothStepToF(boss->fwork, 0.5f, 1.0f, 0.02f, 0.0f); + Math_SmoothStepToVec3fArray(D_i5_801BC978, D_i5_801BCDC8, 1, 0x5C, boss->fwork[0], 360.0f, 0.01f); + boss->unk_04C++; + if (boss->unk_04C >= (Animation_GetFrameCount(&D_70084CC) * 2)) { + boss->fwork[0x24] = 0.0f; + boss->fwork[37] = 0.0f; + spB8 = 1; + } + break; + case 8: + if ((boss->unk_04C == 0) && (boss->swork[0xB] <= 0)) { + boss->unk_04C = 0x3E; + } + if ((boss->unk_04C == 0x3E) && (boss->swork[0xC] <= 0)) { + boss->unk_04C = (Animation_GetFrameCount(&D_7003EE8) * 2) - 1; + D_i5_801BBEF4[12] = 0.0f; + } + if (boss->unk_04C == 0x62) { + D_i5_801BBEF4[12] = 0.0f; + } + if ((boss->unk_04C == 0x16) || (boss->unk_04C == 0x50)) { + Audio_PlaySfx(0x2940702B, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + if (((boss->unk_04C >= 0) && (boss->unk_04C < 0x12)) || + ((boss->unk_04C >= 0x3E) && (boss->unk_04C < 0x50))) { + D_i5_801BBEF4[12] = + Math_Atan2F(gPlayer[0].pos.x - boss->obj.pos.x, gPlayer[0].pos.z - boss->obj.pos.z) * M_RTOD; + D_i5_801BBEF4[11] = __cosf(D_i5_801BBEF4[12] * M_DTOR) * 580.0f; + } + if ((boss->unk_04C >= 0x25) && (boss->unk_04C < 0x29) && (boss->swork[0xB] > 0)) { + spD4.x = boss->obj.pos.x + D_i5_801BBEF4[68]; + spD4.y = 0.0f; + spD4.z = boss->obj.pos.z + D_i5_801BBEF4[70]; + if (boss->unk_04C & 1) { + func_8007A900(spD4.x, 0.0f, spD4.z, 10.0f, 0xFF, 8, 0); + } + if (boss->unk_04C == 0x26) { + func_8007A6F0(&spD4, 0x29403031); + boss->swork[39] = 5; + D_80178480 = 0x14; + } + } + if ((boss->unk_04C >= 0x61) && (boss->unk_04C < 0x65) && (boss->swork[0xC] > 0)) { + spD4.x = boss->obj.pos.x + D_i5_801BBEF4[71]; + spD4.y = 0.0f; + spD4.z = boss->obj.pos.z + D_i5_801BBEF4[73]; + if (boss->unk_04C & 1) { + func_8007A900(spD4.x, 0.0f, spD4.z, 10.0f, 0xFF, 8, 0); + } + if (boss->unk_04C == 0x62) { + func_8007A6F0(&spD4, 0x29403031); + boss->swork[39] = 5; + D_80178480 = 0x14; + } + } + Math_SmoothStepToF(boss->fwork, 0.5f, 1.0f, 0.02f, 0.0f); + Math_SmoothStepToVec3fArray(D_i5_801BC978, D_i5_801BCDC8, 1, 0x5C, boss->fwork[0], 360.0f, 0.01f); + boss->unk_04C++; + if (boss->unk_04C >= (Animation_GetFrameCount(&D_7003EE8) * 2)) { + spB8 = 1; + } + break; + case 9: + Math_SmoothStepToF(boss->fwork, 0.5f, 1.0f, 0.02f, 0.0f); + Math_SmoothStepToVec3fArray(D_i5_801BC978, D_i5_801BCDC8, 1, 0x5C, boss->fwork[0], 360.0f, 0.01f); + boss->unk_04C++; + if (boss->unk_04C >= (Animation_GetFrameCount(&D_8008FE8) * 2)) { + spB8 = 1; + } + break; + case 10: + Math_SmoothStepToF(boss->fwork, 0.5f, 1.0f, 0.02f, 0.0f); + Math_SmoothStepToVec3fArray(D_i5_801BC978, D_i5_801BCDC8, 1, 0x5C, boss->fwork[0], 360.0f, 0.01f); + boss->unk_04C++; + if (boss->unk_04C >= (Animation_GetFrameCount(&D_700E244) * 2)) { + spB8 = 1; + } + break; + case 11: + if (D_i5_801BBEF0[26] > 0) { + D_i5_801BBEF0[26]--; + } + + if (D_i5_801BBEF0[16] > 0) { + D_i5_801BBEF0[16]--; + } + + if (D_i5_801BBEF0[17] > 0) { + D_i5_801BBEF0[17]--; + } + if (boss->unk_04C == 0) { + Audio_PlaySfx(0x39435830, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + if (boss->unk_04C == 0xF) { + D_i5_801BBEF0[16] = 0x19; + } + if ((boss->unk_04C >= 0x2C) && (boss->unk_04C < 0x33)) { + D_i5_801BBEF0[7]++; + } + if (boss->unk_04C == 0x2B) { + D_i5_801BBEF0[7] = 0; + D_i5_801BBEF4[11] = 1300.0f; + } + if (boss->unk_04C == 0x33) { + D_i5_801BBEF0[7] = 0; + } + if (boss->unk_04C == 0x2D) { + Audio_PlaySfx(0x3143102F, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + boss->swork[32] = 0; + boss->fwork[42] = 0.0f; + boss->fwork[41] = 40.0f; + D_i5_801BBEF0[26] = 3; + boss->swork[25] = 1; + D_i5_801BBEF0[17] = 3; + D_i5_801BBEF0[13] = 1; + D_i5_801BBEF4[32] = 1.0f; + D_i5_801BBEF4[33] = 1.0f; + for (i = 0; i < 4; i++) { + if (D_i5_801BBEF0[i + 9] == 0) { + for (j = 0; j < 100; j++) { + if (gUnkEntities30[j].mode == 0) { + gUnkEntities30[j].mode = 1; + D_i5_801BBEF0[i + 9] = j + 1; + break; + } + } + } + } + } + if (boss->unk_04C == 0x82) { + for (i = 0; i < 4; i++) { + // stores in v instead of t + j = D_i5_801BBEF0[i + 9]; + gUnkEntities30[j - 1].mode = 0; + } + + boss->swork[32] = 0; + func_8001A55C(boss->sfxPos, 0x3143102F); + boss->swork[25] = 0; + boss->fwork[41] = 0.0f; + boss->fwork[42] = 0.0f; + } + if (boss->unk_04C == 0x35) { + boss->swork[32] = 1; + } + if (boss->unk_04C == 0x78) { + boss->swork[32] = 0; + } + if (D_i5_801BBEF0[26] != 0) { + D_80178348 = 0xFF; + D_80178350 = 0xFF; + D_80178354 = 0xFF; + D_80178340 = (s32) (((f32) D_i5_801BBEF0[26] * 255.0f) / 3.0f); + } + + if ((boss->unk_04C >= 0x36) && (boss->unk_04C < 0x78)) { + boss->fwork[0x2E] += 0.04f; + if (boss->fwork[0x2E] > 1.0f) { + boss->fwork[0x2E] = 1.0f; + } + } + if (boss->unk_04C == 0x33) { + D_i5_801BBEF4[32] = 360.0f; + D_i5_801BBEF4[33] = 10.0f; + boss->fwork[0x2E] = 0.3f; + } + if (boss->fwork[0x2E] == 1.0f) { + D_i5_801BBEF4[33] = 0.01f; + D_i5_801BBEF4[32] = 0.5f; + } + if (boss->unk_04C == 0x34) { + D_i5_801BBEF4[32] = 0.0f; + } + if (boss->unk_04C == 0x78) { + boss->fwork[0x2E] = 0.0f; + } + if ((boss->unk_04C >= 0x33) && (boss->unk_04C < 0x78)) { + boss->fwork[35] = 1.0f; + } else { + boss->fwork[35] = 0.0f; + } + + if ((boss->unk_04C >= 0x2D) && (boss->unk_04C < 0x2F)) { + boss->fwork[41] += 20.0f; + boss->fwork[42] += 1050.0f; + } + if (boss->unk_04C >= 0x2F) { + if (boss->fwork[41] > 40.0f) { + boss->fwork[41] -= 20.0f; + } + } + if ((boss->unk_04C >= 0x7E) && (boss->unk_04C < 0x81)) { + boss->fwork[41] *= 0.5f; + } + if (boss->unk_04C >= 0x80) { + boss->fwork[42] *= 0.3f; + } + if (boss->unk_04C >= 0x81) { + boss->fwork[42] *= 0.5f; + boss->fwork[41] *= 0.5f; + } + if (boss->swork[24] != 0) { + Math_SmoothStepToF(&boss->fwork[45], 0.0f, 0.8f, 2.5f, 0.01f); + if (boss->fwork[43] == 0.0f) { + boss->fwork[43] = 1.0f; + } + Math_SmoothStepToF(&boss->fwork[43], 0.0f, 1.0f, 0.1f, 0.001f); + if (boss->unk_04C == 0x1E) { + boss->fwork[41] = 0.0f; + boss->fwork[42] = 0.0f; + boss->swork[24] = 0; + func_8001A55C(boss->sfxPos, 0x39435830); + } + } + Math_SmoothStepToF(boss->fwork, 0.5f, 1.0f, 0.02f, 0.0f); + Math_SmoothStepToVec3fArray(D_i5_801BC978, D_i5_801BCDC8, 1, 0x5C, boss->fwork[0], 360.0f, 0.01f); + boss->unk_04C++; + if (boss->unk_04C >= (Animation_GetFrameCount(&D_9004288) * 2)) { + boss->swork[24] = 0; + boss->fwork[43] = 0.0f; + boss->swork[25] = 0; + spB8 = 1; + } + break; + case 12: + boss->swork[0x21] = 1; + if ((boss->unk_04C >= 0x26) && (boss->unk_04C < 0x8D)) { + boss->fwork[1] = ((f32) (boss->unk_04C - 0x26) * 360.0f) / 102.0f; + } + Math_SmoothStepToAngle(&boss->fwork[0x31], boss->fwork[1], 0.5f, 180.0f, 0.0f); + Math_SmoothStepToF(boss->fwork, 0.5f, 1.0f, 0.02f, 0.0f); + Math_SmoothStepToVec3fArray(D_i5_801BC978, D_i5_801BCDC8, 1, 0x5C, boss->fwork[0], 360.0f, 0.01f); + boss->unk_04C++; + if (boss->unk_04C >= (Animation_GetFrameCount(&D_A009990) * 2)) { + boss->swork[0x21] = 0; + boss->fwork[48] = 0; + spB8 = 1; + } + break; + case 13: + if (boss->swork[34] == 2) { + if ((boss->fwork[48] >= 38.0f) && (boss->fwork[48] <= 140.0f)) { + boss->fwork[1] = ((boss->fwork[48] - 38.0f) * 360.0f) / 102.0f; + } + Math_SmoothStepToAngle(&boss->fwork[0x31], boss->fwork[1], 0.5f, 180.0f, 0.0f); + } + Math_SmoothStepToF(boss->fwork, 0.5f, 1.0f, 0.02f, 0.01f); + Math_SmoothStepToVec3fArray(D_i5_801BC978, D_i5_801BCDC8, 1, 0x5C, boss->fwork[0], 360.0f, 0.01f); + if (boss->swork[38] & 1) { + boss->unk_04C++; + } + D_i5_801BBEF0[6] = 2; + if (boss->unk_04C == 0x1E) { + func_8001A55C(boss->sfxPos, 0x11003023); + D_i5_801BBEF0[7] = 0; + boss->obj.status = OBJ_DYING; + D_i5_801BBEF4[12] = 0.0f; + boss->fwork[35] = 0.0f; + boss->unk_044 = 0; + boss->timer_050 = 0x118; + D_i5_801BBEF0[16] = 0; + D_i5_801BBEF0[17] = 0; + boss->swork[0x17] = 0; + D_i5_801BBEF0[6] = 0x50; + D_i5_801BBEF0[7] = 0; + for (i = 0; i < ARRAY_COUNTU(D_i5_801BBF00); i++) { + if (!(D_i5_801BBF00[i].unk_26 & 4)) { + D_i5_801BBF00[i].unk_26 = 3; + } + } + } + break; + } + + switch (boss->swork[34]) { + case 0: + break; + case 1: + boss->fwork[48] += boss->fwork[2]; + if (Animation_GetFrameCount(&D_70096EC) * 2 <= boss->fwork[48]) { + boss->fwork[48] -= Animation_GetFrameCount(&D_70096EC) * 2; + } else if (boss->fwork[48] < 0.0f) { + boss->fwork[48] += Animation_GetFrameCount(&D_70096EC) * 2 - 1.0f; + } + break; + case 2: + boss->fwork[48] += 1.0f; + if (Animation_GetFrameCount(&D_A009990) * 2 <= boss->fwork[48]) { + if (boss->state == 0xD) { + boss->fwork[0] = 0.0f; + boss->swork[34] = 1; + boss->fwork[48] = 0; + } else { + boss->fwork[48] = 0; + } + } + break; + } + if (spB8 == 1) { + boss->unk_04C = 0; + boss->fwork[0] = 0.0f; + boss->swork[3]--; + if (boss->swork[3] <= 0) { + boss->swork[1] = (s32) (Rand_ZeroOne() * 6.0f) + 7; + func_i5_80193B30(boss); + } + boss->swork[4]++; + if (boss->swork[37] & 0x18) { + D_i5_801BBEF0[44]++; + } + D_i5_801BBEF0[42] = 0; + + switch (boss->swork[1]) { + case 7: + if (boss->swork[37] & 2) { + // not necessarily j + j = 0; + for (i = 0; i < 4; i++) { + if (boss->swork[i + 9] <= 0) { + j++; + } + } + + if ((j != 4) && gTeamShields[3] > 0) { + Radio_PlayMessage(gMsg_ID_4095, RCID_PEPPY); + } + boss->swork[37] &= ~2; + } + break; + case 9: + if (boss->swork[37] & 1) { + if ((boss->swork[29] != 0) && gTeamShields[1] > 0) { + Radio_PlayMessage(gMsg_ID_4099, RCID_FALCO); + } + boss->swork[37] &= ~1; + } + break; + } + } + + while (boss->fwork[0x31] >= 360.0f) { + boss->fwork[0x31] -= 360.0f; + } + + while (boss->fwork[0x31] < 0.0f) { + boss->fwork[0x31] += 360.0f; + } + + for (i = 0; i < 4; i++) { + if (boss->swork[i + 9] == 0) { + j = boss->swork[i + 0x11]; + if (boss->swork[i + 0xD] == D_i5_801BAB0C[i][j]) { + do { + D_i5_801BBF00[D_i5_801BAABC[i][j]].unk_26 = 3; + boss->swork[i + 0x11]++; + j++; + } while (D_i5_801BAB0C[i][j] == 0); + if (D_i5_801BAB0C[i][j] == -1) { + boss->swork[i + 9] = -1; + } else { + boss->swork[i + 0xD] = 0; + } + } else { + boss->swork[i + 0xD]++; + } + } + } + if ((boss->state != 0xD) && (boss->swork[21] <= 0)) { + boss->swork[1] = 0xD; + boss->unk_04C = 0; + if (boss->swork[25] != 0) { + func_8001A55C(boss->sfxPos, 0x3143102F); + boss->swork[25] = 0; + } + if (boss->swork[24] != 0) { + func_8001A55C(boss->sfxPos, 0x39435830); + boss->swork[24] = 0; + } + } + if (boss->state >= 7) { + if ((boss->fwork[0xF] <= 0.0f) && (boss->fwork[9] > 0.0f)) { + effect = func_8007783C(OBJ_EFFECT_394); + if (effect != NULL) { + Matrix_RotateY(gCalcMatrix, boss->obj.rot.y * M_DTOR, 0); + Matrix_MultVec3f(gCalcMatrix, (Vec3f*) &boss->fwork[8], &spC8); + effect->obj.status = OBJ_ACTIVE; + effect->unk_78 = effect->unk_7A = 0; + effect->obj.pos.x = boss->obj.pos.x + spC8.x; + effect->obj.pos.y = boss->obj.pos.y + 3.0f; + effect->obj.pos.z = boss->obj.pos.z + spC8.z; + effect->obj.rot.y = boss->fwork[0x31] + -44.0f; + effect->unk_44 = 0x35; + effect->info.unk_10 = 400.0f; + effect->info.unk_14 = -1; + effect->unk_74 = D_7009A80; + } + } + if ((boss->fwork[0xC] <= 0.0f) && (boss->fwork[6] > 0.0f)) { + effect = func_8007783C(OBJ_EFFECT_394); + if (effect != NULL) { + Matrix_RotateY(gCalcMatrix, boss->obj.rot.y * M_DTOR, 0); + Matrix_MultVec3f(gCalcMatrix, (Vec3f*) &boss->fwork[5], &spC8); + effect->obj.status = OBJ_ACTIVE; + effect->unk_78 = effect->unk_7A = 0; + effect->obj.pos.x = boss->obj.pos.x + spC8.x; + effect->obj.pos.y = boss->obj.pos.y + 3.0f; + effect->obj.pos.z = boss->obj.pos.z + spC8.z; + effect->obj.rot.y = boss->fwork[0x31] + 44.0f; + effect->unk_44 = 0x35; + effect->info.unk_10 = 400.0f; + effect->info.unk_14 = -1; + effect->unk_74 = D_7009A80; + } + } + } + if ((boss->state == 6) && ((boss->unk_04C == 0x86) || (boss->unk_04C == 0xBC))) { + Audio_PlaySfx(0x29406029, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + boss->swork[39] = 4; + D_80178480 = 7; + } + if (boss->state >= 7) { + if (((boss->fwork[0xF] > 0.0f) && (boss->fwork[9] <= 0.0f)) || + ((boss->fwork[0xC] > 0.0f) && (boss->fwork[6] <= 0.0f))) { + Audio_PlaySfx(0x29406029, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + if (boss->state == 0xC) { + boss->swork[39] = 4; + D_80178480 = 0x14; + } else { + boss->swork[39] = 2; + D_80178480 = 5; + } + } + boss->fwork[0xC] = boss->fwork[6]; + boss->fwork[0xF] = boss->fwork[9]; + } + if ((boss->state >= 7) && (D_i5_801B7738[boss->state] > 0.0f)) { + // Can use temp here + temp = Math_SmoothStepToF(&boss->obj.pos.z, gPlayer[0].pos.z - D_i5_801BBEF4[11], 0.1f, 14.0f, 0.001f); + boss->fwork[2] = (((-temp / 14.0f) * 1.2f) + 1.0f) * 2.0f; + boss->vel.z = -12.0f; + } + boss->dmgType = DMG_NONE; +} +#else #pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_80193DF0.s") +void func_i5_80193DF0(Boss*); +#endif -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_80197A94.s") +static s16 D_i5_801B8D54[4] = { 30, 35, 60, 70 }; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_801982A8.s") +void func_i5_80197A94(Boss* boss) { + Vec3f sp3C; -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/func_i5_801990DC.s") + boss->swork[38]++; + if ((boss->dmgType != 0) && + (((boss->state >= 0) && (boss->state <= 1)) || ((boss->state >= 4) && (boss->state <= 6)))) { + Audio_PlaySfx(0x29121007, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + boss->dmgType = DMG_NONE; + } + if ((gPlayer->unk_1D4 != 0) && (boss->swork[39] > 0)) { + D_80137E84[0] = 1; + boss->swork[39]--; + } + if (boss->swork[28] == 2) { + if (gTeamShields[3] > 0) { + Radio_PlayMessage(gMsg_ID_4091, RCID_PEPPY); + } + D_i5_801BBEF0[42] = 1; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/D_i5_801BAA50.s") + if (D_i5_801BBEF0[45] >= 2) { + D_i5_801BBEF0[45]--; + } + if (boss->swork[30] == 4) { + if ((boss->swork[37] & 8) && (D_i5_801BBEF0[44] == 0)) { + Radio_PlayMessage(gMsg_ID_4110, RCID_SLIPPY); + boss->swork[37] &= ~8; + } + if ((boss->swork[37] & 0x10) && (D_i5_801BBEF0[44] >= 2) && (gRadioState == 0)) { + Radio_PlayMessage(gMsg_ID_4092, RCID_SLIPPY); + boss->swork[37] &= ~0x10; + D_i5_801BBEF0[45] = 101; + } + if (D_i5_801BBEF0[45] == 1) { + gBossHealthBar = ((boss->swork[21] * 255.0f) / 100.0f); + gShowBossHealth = 1; + D_i5_801BBEF0[45] = 0; + } + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/D_i5_801BAA54.s") + if ((boss->state >= 3) && (boss->state <= 13)) { + gBossFrameCount++; + } + switch (boss->state) { + case 0: + case 1: + case 2: + case 3: + case 4: + func_i5_80192118(boss); + break; + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + func_i5_80193DF0(boss); + break; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/D_i5_801BAA78.s") + switch (boss->swork[30]) { + case 0: + switch (boss->swork[31]) { + case 1: + Radio_PlayMessage(gMsg_ID_20266, RCID_FOX); + break; + case 80: + gTeamShields[2] = 1; + Radio_PlayMessage(gMsg_ID_4112, RCID_SLIPPY); + gTeamShields[2] = -2; + break; + case 240: + gTeamShields[2] = 1; + Radio_PlayMessage(gMsg_ID_4093, RCID_SLIPPY); + gTeamShields[2] = -2; + break; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/D_i5_801BAABC.s") + break; + case 1: + if (boss->swork[31] == 1) { + func_800182F4(0x105A00FF); + func_800182F4(0x115A00FF); + } + break; + case 2: + if (boss->swork[31] == 11) { + gTeamShields[2] = 1; + Radio_PlayMessage(gMsg_ID_4111, RCID_SLIPPY); + gTeamShields[2] = -2; + } + break; + case 3: + switch (boss->swork[31]) { + case 1: + break; + case 50: + if (gTeamShields[1] > 0) { + Radio_PlayMessage(gMsg_ID_4094, RCID_FALCO); + } + default: + break; + } + break; + case 4: + if (boss->swork[35] == 0) { + if (D_i5_801BBEF0[42] == 0) { + switch (boss->swork[4]) { + case 1: + if (gTeamShields[3] > 0) { + Radio_PlayMessage(gMsg_ID_4095, RCID_PEPPY); + } + D_i5_801BBEF0[42] = 1; + break; + case 3: + if ((D_i5_801BBEF0[8] == 0) && (gTeamShields[1] > 0)) { + Radio_PlayMessage(gMsg_ID_4097, RCID_FALCO); + } + D_i5_801BBEF0[42] = 1; + break; + default: + break; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i5/fox_ti/D_i5_801BAB0C.s") + if (boss->swork[4] >= 4 && !(D_i5_801BBEF0[46] & 1)) { + if ((gTeamShields[1] > 0) && (D_i5_801BBEF0[8] == 0) && (gRadioState == 0) && + (boss->swork[10] >= 2)) { + gTeamShields[2] = 1; + Radio_PlayMessage(gMsg_ID_4098, RCID_SLIPPY); + gTeamShields[2] = -2; + D_i5_801BBEF0[46] = (s32) (D_i5_801BBEF0[46] | 1); + } + D_i5_801BBEF0[42] = 1; + } + } + } + if (boss->swork[37] & 4) { + D_i5_801BBEF0[43]++; + switch (D_i5_801BBEF0[43]) { + case 1: + gTeamShields[2] = 1; + Radio_PlayMessage(gMsg_ID_20190, RCID_SLIPPY); + gTeamShields[2] = -2; + break; + case 80: + if (gTeamShields[1] > 0) { + Radio_PlayMessage(gMsg_ID_4096, RCID_FALCO); + } + boss->swork[37] &= ~4; + break; + default: + break; + } + } + break; + } + + if ((boss->state != 5) && ((boss->state != 4) || (boss->swork[31] <= 100)) && (D_i5_801BBEF0[8] == 0)) { + Math_SmoothStepToF(&D_i5_801BBEF4[74], D_i5_801BBEF4[75], 0.5f, 0.04f, 0.01f); + if (D_i5_801BBEF4[74] == D_i5_801BBEF4[74]) { + if (boss->swork[38] & 1) { + D_i5_801BBEF4[75] = 0.7f; + D_i5_801BBEF4[74] = D_i5_801BBEF4[75]; + } else { + D_i5_801BBEF4[75] = 0.6f; + D_i5_801BBEF4[74] = D_i5_801BBEF4[75]; + } + } + + if ((D_i5_801BBEF0[49] >= 25) && !((D_i5_801BBEF0[49] - 25) & 1)) { + D_i5_801BBEF4[74] = RAND_FLOAT(0.4f) + 0.9f; + D_i5_801BBEF4[75] = 0.6f; + } + if (D_i5_801BBEF0[49] == 0) { + sp3C.x = boss->fwork[29] + boss->obj.pos.x; + sp3C.y = boss->fwork[30] + boss->obj.pos.y; + sp3C.z = boss->fwork[31] + boss->obj.pos.z; + func_8007A6F0(&sp3C, 0x09004002); + D_i5_801BBEF0[49] = D_i5_801B8D54[RAND_INT(4.0f)]; + D_i5_801BBEF4[74] = RAND_FLOAT(0.4f) + 0.9f; + D_i5_801BBEF4[75] = 0.6f; + } + if (D_i5_801BBEF0[49] > 0) { + D_i5_801BBEF0[49]--; + } + } + boss->swork[31]++; +} + +static f32 D_i5_801B8D5C[50] = { + 0.0f, 0.03f, 0.06f, 0.12f, 0.18f, 0.25f, 0.425f, 0.6f, 0.775f, 0.95f, 1.125f, 1.3f, 1.475f, + 1.65f, 1.825f, 2.0f, 1.8f, 1.6f, 1.4f, 1.2f, 1.0f, 0.8f, 0.6f, 0.4f, 0.2f, 0.0f, + 0.8f, 1.6f, 2.4f, 3.2f, 4.0f, 3.4f, 3.2f, 3.0f, 2.8f, 2.4f, 2.2f, 2.0f, 1.8f, + 1.6f, 1.4f, 1.2f, 1.0f, 0.8f, 0.6f, 0.4f, 0.2f, 0.0f, 0.0f, 0.0f, +}; + +static f32 D_i5_801B8E24[4][2] = { + { -1.0f, 1.0f }, + { 1.0f, 1.0f }, + { -1.0f, -1.0f }, + { 1.0f, -1.0f }, +}; + +void func_i5_801982A8(Boss* boss) { + UnkEntity30* temp_v0_6; + f32 sp120; + f32 temp_fs0; + f32 temp_fs1; + f32 temp_fs2; + f32 temp_fv0; + s32 pad; + f32 stack; + s32 i; + s32 j; + Vec3f spF4; + Vec3f spE8; + s32 temp_v1_28; + f32 half = 0.5f; + s32 temp; + + Matrix_Push(&gGfxMatrix); + RCP_SetupDL(&gMasterDisp, 0x1E); + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255); + + switch (boss->state) { + case 1: + case 2: + case 3: + case 4: + Matrix_Push(&gGfxMatrix); + D_i5_801BBEF0[25] = 0; + Animation_DrawSkeleton(0, D_A000EDC, D_i5_801BCE88, func_i5_8018FC70, func_i5_8019002C, boss, + &gIdentityMatrix); + Matrix_Pop(&gGfxMatrix); + D_i5_801B83A8[0] = 22.0f; + Matrix_Push(&gGfxMatrix); + D_i5_801BBEF0[25] = 1; + Animation_DrawSkeleton(0, D_A000568, D_i5_801BCDC8, func_i5_801903A0, func_i5_8019081C, boss, + &gIdentityMatrix); + Matrix_Pop(&gGfxMatrix); + Matrix_Push(&gGfxMatrix); + D_i5_801BBEF0[25] = 2; + Animation_DrawSkeleton(0, D_A000568, D_i5_801BCE28, func_i5_801903A0, func_i5_8019081C, boss, + &gIdentityMatrix); + Matrix_Pop(&gGfxMatrix); + break; + case 6: + Animation_DrawSkeleton(0, D_A001A70, D_i5_801BCDC8, func_i5_80190A08, func_i5_80191AE8, boss, + &gIdentityMatrix); + break; + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + Animation_DrawSkeleton(0, D_A001A70, D_i5_801BCDC8, func_i5_80190A08, func_i5_80191AE8, boss, + &gIdentityMatrix); + break; + case 0: + break; + } + Matrix_Pop(&gGfxMatrix); + if (boss->obj.status != OBJ_DYING) { + switch (boss->state) { + case 6: + Matrix_Push(&gGfxMatrix); + RCP_SetupDL(&gMasterDisp, 0x45); + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 0, 0, 0, 255); + gDPSetEnvColor(gMasterDisp++, 0, 0, 0, 0); + Matrix_RotateX(gGfxMatrix, -1.5707964f, 1); + Matrix_Scale(gGfxMatrix, boss->fwork[47] * 10.0f, boss->fwork[47] * 10.0f, 1.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_1024AC0); + Matrix_Pop(&gGfxMatrix); + break; + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + Matrix_Push(&gGfxMatrix); + RCP_SetupDL(&gMasterDisp, 0x45); + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 0, 0, 0, 255); + gDPSetEnvColor(gMasterDisp++, 0, 0, 0, 0); + Matrix_RotateX(gGfxMatrix, -1.5707964f, 1); + Matrix_Scale(gGfxMatrix, 10.0f, 10.0f, 1.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_1024AC0); + Matrix_Pop(&gGfxMatrix); + break; + } + if (boss->state == 11) { + if (boss->swork[24] != 0) { + Matrix_Push(&gGfxMatrix); + Matrix_Translate(gGfxMatrix, boss->fwork[17], boss->fwork[18], boss->fwork[19] + 50.0f, 1); + RCP_SetupDL_14(); + for (i = 0; i < 3; i++) { + sp120 = (boss->fwork[43] + (f32) i) / 3.0f; + temp_fs2 = boss->fwork[45] * sp120; + temp_fv0 = 1.0f - sp120; + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, (s32) (temp_fv0 * 255.0f), + (s32) ((temp_fv0 * 128.0f) + 127.0f), (s32) ((temp_fv0 * 60.0f) + 195.0f), + (s32) ((temp_fv0 * 155.0f) + 100.0f)); + for (j = 0; j < 0x168; j += 0x2D) { + Matrix_Push(&gGfxMatrix); + Matrix_RotateZ(gGfxMatrix, (j + boss->fwork[43] * 360.0f) * M_DTOR, 1); + Matrix_Translate(gGfxMatrix, temp_fs2, 0.0f, 0.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, D_Gfx_800D94D0); + Matrix_Pop(&gGfxMatrix); + } + } + Matrix_Pop(&gGfxMatrix); + } + Matrix_Translate(gGfxMatrix, boss->fwork[17], boss->fwork[18], boss->fwork[19], 1); + + if (D_i5_801BBEF0[7] != 0) { + Matrix_Push(&gGfxMatrix); + sp120 = (f32) D_i5_801BBEF0[7] * 16.0f; + RCP_SetupDL(&gMasterDisp, 0x40); + Matrix_RotateX(gGfxMatrix, 1.5707964f, 1); + Matrix_Push(&gGfxMatrix); + Matrix_Scale(gGfxMatrix, sp120, 1.0f, sp120, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 120, 255, 220, D_i5_801BBEF0[7] * 50); + gSPDisplayList(gMasterDisp++, D_20112C0); + Matrix_Pop(&gGfxMatrix); + if (D_i5_801BBEF0[7] > 0) { + sp120 = (f32) (D_i5_801BBEF0[7] - 1) * 24.0f; + Matrix_Scale(gGfxMatrix, sp120, 1.0f, sp120, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 120, 255, 220, D_i5_801BBEF0[7] * 50); + gSPDisplayList(gMasterDisp++, D_20112C0); + } + Matrix_Pop(&gGfxMatrix); + } + + if (D_i5_801BBEF0[16] > 0) { + temp = D_i5_801BBEF0[16] - 1; + Matrix_Push(&gGfxMatrix); + Matrix_RotateY(gGfxMatrix, (boss->fwork[21] - 90.0f) * M_DTOR, 1); + Matrix_RotateX(gGfxMatrix, (boss->fwork[22] - 180.0f) * M_DTOR, 1); + Matrix_RotateZ(gGfxMatrix, (boss->fwork[20] + ((boss->unk_04C - 15) * 15.6f)) * M_DTOR, 1); + Matrix_Scale(gGfxMatrix, D_i5_801B8D5C[temp], D_i5_801B8D5C[temp], D_i5_801B8D5C[temp + 25], 1); + Matrix_SetGfxMtx(&gMasterDisp); + RCP_SetupDL(&gMasterDisp, 0x31); + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 178); + gDPSetEnvColor(gMasterDisp++, 0, 128, 60, 0); + gSPDisplayList(gMasterDisp++, D_7005300); + Matrix_Pop(&gGfxMatrix); + } + if (D_i5_801BBEF0[17] > 0) { + Matrix_Push(&gGfxMatrix); + Matrix_RotateY(gGfxMatrix, (boss->fwork[21] - 90.0f) * M_DTOR, 1); + Matrix_RotateX(gGfxMatrix, (boss->fwork[22] - 180.0f) * M_DTOR, 1); + Matrix_RotateZ(gGfxMatrix, (boss->fwork[20] + ((boss->unk_04C - 15) * 15.6f)) * M_DTOR * 3.0f, 1); + Matrix_Scale(gGfxMatrix, 4.0f, 4.0f, 4.0f, 1); + Matrix_SetGfxMtx(&gMasterDisp); + RCP_SetupDL(&gMasterDisp, 0x31); + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, + (s32) ((f32) (D_i5_801BBEF0[17] * 89.0f) / 3.0f)); + gDPSetEnvColor(gMasterDisp++, 0, 128, 60, 0); + gSPDisplayList(gMasterDisp++, D_7005300); + Matrix_Pop(&gGfxMatrix); + } + + if (boss->swork[25] != 0) { + sp120 = boss->fwork[41] / 40.0f; + temp_fs2 = boss->fwork[42] / 700.0f; + Matrix_RotateY(gGfxMatrix, (boss->fwork[21] - 90.0f) * M_DTOR, 1); + Matrix_RotateX(gGfxMatrix, (boss->fwork[22] - 180.0f) * M_DTOR, 1); + Matrix_RotateZ(gGfxMatrix, (boss->fwork[20] - ((boss->swork[38] & 7) * 43.0f)) * M_DTOR, 1); + Matrix_Push(&gGfxMatrix); + Matrix_Scale(gGfxMatrix, half * sp120, half * sp120, temp_fs2, 1); + Matrix_SetGfxMtx(&gMasterDisp); + RCP_SetupDL(&gMasterDisp, 0x48); + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 178); + gDPSetEnvColor(gMasterDisp++, 0, 128, 60, 0); + gSPDisplayList(gMasterDisp++, D_8000D90); + Matrix_Pop(&gGfxMatrix); + Matrix_Scale(gGfxMatrix, sp120, sp120, temp_fs2, 1); + Matrix_SetGfxMtx(&gMasterDisp); + gDPPipeSync(gMasterDisp++); + gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 64); + gDPSetEnvColor(gMasterDisp++, 0, 128, 110, 0); + gSPDisplayList(gMasterDisp++, D_8000D90); + Matrix_RotateY(gCalcMatrix, (boss->fwork[21] - 90.0f) * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, (boss->fwork[22] - 180.0f) * M_DTOR, 1); + Matrix_RotateZ(gCalcMatrix, (boss->fwork[20] + boss->fwork[42]) * M_DTOR, 1); + temp_fs0 = boss->obj.pos.x + boss->fwork[17]; + temp_fs1 = boss->obj.pos.y + boss->fwork[18]; + temp_fs2 = boss->obj.pos.z + boss->fwork[19]; + for (i = 0; i < 4; i++) { + if (D_i5_801BBEF0[i + 9] != 0) { + temp_v1_28 = D_i5_801BBEF0[i + 9] - 1; + spF4.x = D_i5_801B8E24[i][0] * boss->fwork[41]; + spF4.y = D_i5_801B8E24[i][1] * boss->fwork[41]; + spF4.z = boss->fwork[42]; + Matrix_MultVec3f(gCalcMatrix, &spF4, &spE8); + gUnkEntities30[temp_v1_28].unk_04.x = temp_fs0; + gUnkEntities30[temp_v1_28].unk_04.y = temp_fs1; + gUnkEntities30[temp_v1_28].unk_04.z = temp_fs2; + gUnkEntities30[temp_v1_28].unk_10.x = temp_fs0 + spE8.x; + gUnkEntities30[temp_v1_28].unk_10.y = temp_fs1 + spE8.y; + gUnkEntities30[temp_v1_28].unk_10.z = temp_fs2 + spE8.z; + if (boss->swork[32] == 0) { + gUnkEntities30[temp_v1_28].mode = 0; + } else { + gUnkEntities30[temp_v1_28].mode = 1; + } + gUnkEntities30[temp_v1_28].unk_2C = 0; + gUnkEntities30[temp_v1_28].unk_2E = 0; + gUnkEntities30[temp_v1_28].unk_2D = 0; + gUnkEntities30[temp_v1_28].unk_2F = 0; + gUnkEntities30[temp_v1_28].unk_28 = 1; + } + } + } + } + boss->state = boss->swork[1]; + } +} + +static Vec3f D_i5_801B8E44 = { 3.0f, 0.0f, 0.0f }; + +void func_i5_801990DC(Boss* boss) { + s32 i; + Vec3f sp60; + Actor* actor; + + if (boss->unk_044 == 0) { + Audio_PlaySfx(0x2940902D, boss->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + func_800182F4(0x103200FF); + func_800182F4(0x113200FF); + func_8007A568(boss->obj.pos.x, boss->obj.pos.y + 250.0f, boss->obj.pos.z, 40.0f); + func_80042EC0(boss); + gShowBossHealth = 0; + actor = gActors; + for (i = 0; i < ARRAY_COUNT(gActors); i++, actor++) { + if ((actor->obj.status == OBJ_ACTIVE) && (actor->obj.id == OBJ_ACTOR_189) && (actor->state == 40)) { + actor->gravity = 0.2f; + } + } + + for (i = 0; i < ARRAY_COUNTU(D_i5_801BBF00); i++) { + if (!(D_i5_801BBF00[i].unk_26 & 4)) { + actor = func_800A3608(OBJ_ACTOR_189); + if (actor != NULL) { + actor->state = 40; + actor->unk_046 = D_i5_801B7770[i][5]; + actor->unk_048 = D_i5_801B7770[i][1]; + Matrix_RotateY(gCalcMatrix, boss->obj.rot.y * M_DTOR, 0); + Matrix_MultVec3f(gCalcMatrix, &D_i5_801BBF00[i].unk_00.pos, &sp60); + actor->obj.pos.x = boss->obj.pos.x + sp60.x; + actor->obj.pos.y = boss->obj.pos.y + sp60.y; + actor->obj.pos.z = boss->obj.pos.z + sp60.z; + actor->obj.rot.x = D_i5_801BBF00[i].unk_00.rot.x + boss->obj.rot.x; + actor->obj.rot.y = D_i5_801BBF00[i].unk_00.rot.y + boss->obj.rot.y; + actor->obj.rot.z = D_i5_801BBF00[i].unk_00.rot.z + boss->obj.rot.z; + if (i == 51) { + actor->vel.x = RAND_FLOAT(10.0f) - 5.0f; + actor->vel.y = 30.0f; + actor->vel.z = -30.0f; + actor->gravity = 0.1f; + } else { + actor->fwork[0] = (f32) ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(5.0f) + 5.0f); + actor->fwork[1] = (f32) ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(5.0f) + 5.0f); + Matrix_Push(&gCalcMatrix); + Matrix_RotateY(gCalcMatrix, RAND_FLOAT(360.0f) * M_DTOR, 0); + Matrix_MultVec3f(gCalcMatrix, &D_i5_801B8E44, &sp60); + Matrix_Pop(&gCalcMatrix); + actor->vel.x = sp60.x; + actor->vel.y = ((f32) ((D_i5_801BBF00[i].unk_00.pos.y > 250.0f) ? 1 + : (D_i5_801BBF00[i].unk_00.pos.y == 250.0f) ? 0 + : -1) - + RAND_FLOAT(0.5f)) + + 0.5f; + actor->vel.z = (boss->vel.z * 0.5f) + sp60.z; + actor->gravity = 0.1f; + } + } + D_i5_801BBF00[i].unk_26 = 4; + } + } + boss->unk_044 = 1; + } else { + boss->obj.pos.z = gPlayer[0].pos.z; + } + + switch (boss->timer_050) { + case 100: + actor = func_800A3608(OBJ_ACTOR_189); + if (actor != NULL) { + actor->fwork[0] = (f32) ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (Rand_ZeroOne() + 1.0f); + actor->fwork[1] = (f32) ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (Rand_ZeroOne() + 1.0f); + actor->state = 40; + actor->unk_046 = 25; + actor->unk_048 = 0; + actor->unk_04A = 6; + actor->fwork[3] = 0.0f; + actor->fwork[4] = -200.0f; + actor->obj.pos.x = gPlayer[0].pos.x; + actor->obj.pos.y = 500.0f; + actor->obj.pos.z = gPlayer[0].unk_138 + actor->fwork[4]; + actor->obj.rot.y = (RAND_FLOAT(5.0f) + 90.0f) - 2.5f; + actor->obj.rot.z = (RAND_FLOAT(5.0f) + 180.0f) - 2.5f; + actor->vel.y = -10.0f; + actor->gravity = 0.8f; + } + break; + case 120: + actor = func_800A3608(OBJ_ACTOR_189); + if (actor != NULL) { + actor->fwork[0] = (f32) ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(5.0f) + 5.0f); + actor->fwork[1] = (f32) ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(5.0f) + 5.0f); + actor->state = 40; + actor->unk_046 = 2; + actor->unk_048 = 1; + actor->unk_04A = 6; + actor->iwork[1] = (s32) 1; + actor->fwork[3] = -150.0f; + actor->fwork[4] = -200.0f; + actor->fwork[5] = 200.0f; + actor->obj.pos.x = gPlayer[0].pos.x + actor->fwork[3]; + actor->obj.pos.y = 500.0f; + actor->obj.pos.z = gPlayer[0].unk_138 + actor->fwork[4]; + actor->obj.rot.z = 90.0f; + actor->vel.y = -10.0f; + actor->gravity = 0.8f; + } + break; + case 140: + actor = func_800A3608(OBJ_ACTOR_189); + if (actor != NULL) { + actor->fwork[0] = (f32) ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (Rand_ZeroOne() + 1.0f); + actor->fwork[1] = (f32) ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (Rand_ZeroOne() + 1.0f); + actor->state = 40; + actor->unk_046 = 2; + actor->unk_048 = 1; + actor->unk_04A = 6; + actor->iwork[1] = 2; + actor->fwork[3] = 100.0f; + actor->fwork[4] = -100.0f; + actor->fwork[5] = 200.0f; + actor->obj.pos.x = gPlayer[0].pos.x + actor->fwork[3]; + actor->obj.pos.y = 500.0f; + actor->obj.pos.z = gPlayer[0].unk_138 + actor->fwork[4]; + actor->obj.rot.z = 90.0f; + actor->vel.y = -10.0f; + actor->gravity = 0.8f; + } + break; + } + if ((boss->timer_050 == 0) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_3)) { + Object_Kill(&boss->obj, boss->sfxPos); + gPlayer[0].state_1C8 = PLAYERSTATE_1C8_7; + gPlayer[0].unk_1D0 = 0; + } +} diff --git a/yamls/us/overlays.yaml b/yamls/us/overlays.yaml index 27958b76..a24ddf17 100644 --- a/yamls/us/overlays.yaml +++ b/yamls/us/overlays.yaml @@ -118,7 +118,7 @@ - [0xE97CC0, c, fox_ground] - [0xE9A580, .data, fox_i5] - [0xE9A590, .data, fox_ti_cs] - - [0xE9A650, data, fox_ti] + - [0xE9A650, .data, fox_ti] - [0xE9C140, .data, fox_ma] - [0xE9DC00, .data, fox_ground] - [0xE9DCD0, .rodata, fox_i5] @@ -127,7 +127,7 @@ - [0xE9E5A0, .rodata, fox_ma] - [0xE9F0E0, .rodata, fox_ground] - { start: 0xE9F1D0, type: .bss, vram: 0x801BBEE0, name: fox_i5 } - - { type: bss, vram: 0x801BBEF0, name: fox_ti } + - { type: .bss, vram: 0x801BBEF0, name: fox_ti } - { type: .bss, vram: 0x801BE240, name: fox_ma } - { type: .bss, vram: 0x801BE740, name: fox_ground }