From 234b36ebb51004d23d7b13699873b3e2e876530b Mon Sep 17 00:00:00 2001 From: petrie911 <69443847+petrie911@users.noreply.github.com> Date: Wed, 14 Feb 2024 17:22:37 -0600 Subject: [PATCH] match fox_sy (#128) * match * pointer cleanup * more cleanup * more cleanup --- include/functions.h | 2 + src/overlays/ovl_i1/fox_tr.c | 6 +- src/overlays/ovl_i1/fox_tr360.c | 2 +- src/overlays/ovl_i2/fox_me.c | 40 ++-- src/overlays/ovl_i2/fox_sx.c | 63 ++--- src/overlays/ovl_i3/fox_aq.c | 12 +- src/overlays/ovl_i4/fox_bo.c | 36 +-- src/overlays/ovl_i4/fox_fo.c | 8 +- src/overlays/ovl_i4/fox_ka.c | 24 +- src/overlays/ovl_i5/fox_ma.c | 42 ++-- src/overlays/ovl_i5/fox_ti_cs.c | 8 +- src/overlays/ovl_i6/fox_andross.c | 6 +- src/overlays/ovl_i6/fox_sy.c | 377 +++++++++++++++++++++++++++++- 13 files changed, 486 insertions(+), 140 deletions(-) diff --git a/include/functions.h b/include/functions.h index c66f4cdf..4321c631 100644 --- a/include/functions.h +++ b/include/functions.h @@ -498,6 +498,7 @@ void func_8008EA14(f32, f32); void func_8008FA84(void); void func_8008FE78(Boss*); void func_8008FFF0(Boss*, s32); +s32 func_80090200(Boss* boss); bool func_8009092C(Actor*); void func_800907C4(Boss*); s32 func_800915FC(Actor*); @@ -548,6 +549,7 @@ void func_800AC290(Player* player, PlayerShot* shot, f32 arg2, f32 arg3, PlayerS void func_800A5844(void); void func_800A594C(void); void func_800A5D6C(void); +void func_800A5EBC(void); void func_800A5FA0(f32* , u32 , s32 ); void func_800A6070(f32* , u32 ); void func_800A6148(void); diff --git a/src/overlays/ovl_i1/fox_tr.c b/src/overlays/ovl_i1/fox_tr.c index f4922c2b..9aab0931 100644 --- a/src/overlays/ovl_i1/fox_tr.c +++ b/src/overlays/ovl_i1/fox_tr.c @@ -15,13 +15,13 @@ void func_i1_80198968(Item* item) { case 0: item->obj.rot.z += 1.0f; Math_SmoothStepToF(&item->scale, 1.0f, 1.0f, 0.05f, 0.0f); - if ((item->unk_44 == 0) && (gPlayer->unk_4DC == 0)) { + if ((item->unk_44 == 0) && (gPlayer[0].unk_4DC == 0)) { if (item->obj.rot.y == 0.0f) { var_fv0 = 550.0f; } else { var_fv0 = 1000.0f; } - if (item->obj.pos.z > (gPlayer->unk_138 + var_fv0)) { + if (item->obj.pos.z > (gPlayer[0].unk_138 + var_fv0)) { item->unk_44 = 1; PRINTF("♪:リング未通過音\n"); // Ring not passed sound Audio_PlaySfx(0x4900402F, D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); @@ -43,7 +43,7 @@ void func_i1_80198968(Item* item) { case 1: item->obj.pos.x += ((gPlayer[item->playerNum].pos.x - item->obj.pos.x) * 0.05f); item->obj.pos.y += ((gPlayer[item->playerNum].pos.y - item->obj.pos.y) * 0.05f); - if (gPlayer->unk_238 != 0) { + if (gPlayer[0].unk_238 != 0) { item->obj.pos.z += ((gPlayer[item->playerNum].unk_138 - 300.0f) - item->obj.pos.z) * 0.05f; } else { item->obj.pos.z += ((gPlayer[item->playerNum].unk_138 - item->obj.pos.z) * 0.05f); diff --git a/src/overlays/ovl_i1/fox_tr360.c b/src/overlays/ovl_i1/fox_tr360.c index 7faf4ff0..92240511 100644 --- a/src/overlays/ovl_i1/fox_tr360.c +++ b/src/overlays/ovl_i1/fox_tr360.c @@ -180,7 +180,7 @@ void func_i1_8019949C(void) { } if (!(gGameFrameCount & 3)) { - if (gPlayer->state_1C8 == PLAYERSTATE_1C8_3) { + if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_3) { sp44.x = 0.0f; sp44.y = 0.0f; sp44.z = -15000.0f; diff --git a/src/overlays/ovl_i2/fox_me.c b/src/overlays/ovl_i2/fox_me.c index 24faf3fb..30bfb3db 100644 --- a/src/overlays/ovl_i2/fox_me.c +++ b/src/overlays/ovl_i2/fox_me.c @@ -146,7 +146,7 @@ void func_i2_801877C4(Actor* actor) { if (actor->timer_0BC == 0) { actor->timer_0BC = 40; - if (actor->obj.pos.z < (gPlayer->unk_138 - 1000.0f)) { + if (actor->obj.pos.z < (gPlayer[0].unk_138 - 1000.0f)) { func_8007F11C(0x161, actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 120.0f); } } @@ -680,7 +680,7 @@ void func_i2_80188FAC(Effect* effect) { } void func_i2_80189114(Effect* effect) { - if (gPlayer->state_1C8 == PLAYERSTATE_1C8_7) { + if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7) { Object_Kill(&effect->obj, effect->sfxPos); } @@ -690,28 +690,28 @@ void func_i2_80189114(Effect* effect) { } effect->obj.rot.z += 35.0f; - if (effect->obj.pos.x < gPlayer->pos.x) { + if (effect->obj.pos.x < gPlayer[0].pos.x) { effect->obj.pos.x += 1.5f; if (effect->vel.x < 40.0f) { effect->vel.x += 2.0f; } } - if (gPlayer->pos.x < effect->obj.pos.x) { + if (gPlayer[0].pos.x < effect->obj.pos.x) { effect->obj.pos.x -= 1.5f; if (effect->vel.x > -40.0f) { effect->vel.x -= 2.0f; } } - if (effect->obj.pos.y < gPlayer->pos.y) { + if (effect->obj.pos.y < gPlayer[0].pos.y) { effect->obj.pos.y += 1.5f; if (effect->vel.y < 40.0f) { effect->vel.y += 2.0f; } } - if (gPlayer->pos.y < effect->obj.pos.y) { + if (gPlayer[0].pos.y < effect->obj.pos.y) { effect->obj.pos.y -= 1.5f; if (effect->vel.y > -40.0f) { effect->vel.y -= 2.0f; @@ -1261,7 +1261,7 @@ void func_i2_8018978C(Boss* boss) { boss->obj.rot.z = boss->obj.rot.z + ((0.0f - boss->obj.rot.z) * 0.02f); Math_SmoothStepToF(&boss->fwork[0x15], 4.0f, 1.0f, 0.1f, 0.0f); - if (gPlayer->state_1C8 != PLAYERSTATE_1C8_6) { + if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_6) { D_80178348 = D_80178340 = D_80178350 = D_80178354 = 0; if ((boss->timer_050 == 10) || (boss->timer_050 == 30) || (boss->timer_050 == 50) || @@ -2049,7 +2049,7 @@ void func_i2_8018CD8C(Player* player) { gActors[player->unk_1D8].obj.pos.z, 10.0f); gActors[player->unk_1D8].obj.status = OBJ_FREE; func_i2_8018CCF8(&gActors[player->unk_1D8]); - Object_Kill(&gPlayerShots->obj, gPlayerShots->sfxPos); + Object_Kill(&gPlayerShots[0].obj, gPlayerShots[0].sfxPos); } } break; @@ -2243,20 +2243,20 @@ void func_i2_8018E084(Player* player) { Matrix_MultVec3f(gCalcMatrix, &src, &dest); - D_80177978 = gBosses->obj.pos.x + dest.x; - D_80177980 = gBosses->obj.pos.y + dest.y; + D_80177978 = gBosses[0].obj.pos.x + dest.x; + D_80177980 = gBosses[0].obj.pos.y + dest.y; - D_80177988 = gBosses->obj.pos.z + D_80177D20 + dest.z; - D_801779A0 = gBosses->obj.pos.x; - D_801779B8 = gBosses->obj.pos.y; + D_80177988 = gBosses[0].obj.pos.z + D_80177D20 + dest.z; + D_801779A0 = gBosses[0].obj.pos.x; + D_801779B8 = gBosses[0].obj.pos.y; - D_801779C0 = gBosses->obj.pos.z + D_80177D20; + D_801779C0 = gBosses[0].obj.pos.z + D_80177D20; Math_SmoothStepToF(&D_80177A48[1], 180.0f, 0.05f, 1.0f, 0.0f); Math_SmoothStepToF(&D_80177A48[2], 1500.0f, 0.1f, 10.0f, 0.0f); Math_SmoothStepToF(&D_80177A48[0], 0.1f, 0.1f, 0.001f, 0.0f); Math_SmoothStepToF(&player->unk_0D0, 0.0f, 1.0f, 0.5f, 0.0f); - Math_SmoothStepToF(&gBosses->vel.z, 0.0f, 1.0f, 0.5f, 0.0f); + Math_SmoothStepToF(&gBosses[0].vel.z, 0.0f, 1.0f, 0.5f, 0.0f); Math_SmoothStepToF(&player->unk_0E4, 0.0f, 0.1f, 3.0f, 0.0f); if (gCsFrameCount == 320) { @@ -2344,12 +2344,12 @@ void func_i2_8018E084(Player* player) { switch (gCsFrameCount) { case 350: - Object_Kill(&gActors->obj, gActors->sfxPos); + Object_Kill(&gActors[0].obj, gActors[0].sfxPos); Object_Kill(&gActors[1].obj, gActors[1].sfxPos); Object_Kill(&gActors[2].obj, gActors[2].sfxPos); if (gTeamShields[1] > 0) { - func_i2_8018DF08(gActors, 0); + func_i2_8018DF08(&gActors[0], 0); } if (gTeamShields[2] > 0) { func_i2_8018DF08(&gActors[1], 1); @@ -2482,9 +2482,9 @@ void func_i2_8018ED9C(Actor* actor) { switch (actor->state) { case 0: - actor->vwork[0].x = D_i2_80195610[actor->index].x + gPlayer->pos.x; - actor->vwork[0].y = D_i2_80195610[actor->index].y + gPlayer->pos.y; - actor->vwork[0].z = D_i2_80195610[actor->index].z + gPlayer->pos.z; + actor->vwork[0].x = gPlayer[0].pos.x + D_i2_80195610[actor->index].x; + actor->vwork[0].y = gPlayer[0].pos.y + D_i2_80195610[actor->index].y; + actor->vwork[0].z = gPlayer[0].pos.z + D_i2_80195610[actor->index].z; Math_SmoothStepToF(&actor->obj.pos.x, actor->vwork[0].x, 0.02f, 50.0f, 0.0001f); Math_SmoothStepToF(&actor->obj.pos.y, actor->vwork[0].y, 0.02f, 50.0f, 0.0001f); diff --git a/src/overlays/ovl_i2/fox_sx.c b/src/overlays/ovl_i2/fox_sx.c index ebf76b62..7d77ce0d 100644 --- a/src/overlays/ovl_i2/fox_sx.c +++ b/src/overlays/ovl_i2/fox_sx.c @@ -47,9 +47,9 @@ void func_i2_8018F030(void) { actor->obj.id = OBJ_ACTOR_203; actor->unk_0B6 = 1; actor->obj.rot.y = 180.0f; - actor->obj.pos.x = gPlayer->camEye.x - 300.0f; - actor->obj.pos.y = gPlayer->camEye.y + 200.0f; - actor->obj.pos.z = gPlayer->camEye.z - D_80177D20 + 300.0f; + actor->obj.pos.x = gPlayer[0].camEye.x - 300.0f; + actor->obj.pos.y = gPlayer[0].camEye.y + 200.0f; + actor->obj.pos.z = gPlayer[0].camEye.z - D_80177D20 + 300.0f; actor->iwork[11] = 1; actor->unk_0E4 = 2; Object_SetInfo(&actor->info, actor->obj.id); @@ -66,9 +66,9 @@ void func_i2_8018F124(void) { actor->obj.status = OBJ_INIT; actor->obj.id = OBJ_ACTOR_203; actor->unk_0B6 = -1; - actor->obj.pos.x = gPlayer->camEye.x + 3000.0f; - actor->obj.pos.y = gPlayer->camEye.y - 3000.0f; - actor->obj.pos.z = gPlayer->pos.z + 30000.0f; + actor->obj.pos.x = gPlayer[0].camEye.x + 3000.0f; + actor->obj.pos.y = gPlayer[0].camEye.y - 3000.0f; + actor->obj.pos.z = gPlayer[0].pos.z + 30000.0f; Object_SetInfo(&actor->info, actor->obj.id); actor->info.unk_10 = 100000.0f; } @@ -123,7 +123,7 @@ void func_i2_8018F330(Actor* actor) { func_8007A6F0(&actor->obj.pos, 0x2903A008); gBosses[0].swork[6] = 0; gTeamShields[2] = -2; - gPlayer->state_1C8 = PLAYERSTATE_1C8_0; + gPlayer[0].state_1C8 = PLAYERSTATE_1C8_0; actor->timer_0BC = 200; actor->iwork[14] = 3; actor->fwork[0] = 0.0f; @@ -147,14 +147,14 @@ void func_i2_8018F330(Actor* actor) { Math_SmoothStepToF(&actor->fwork[0], 0.5f, 1.0f, 0.01f, 0); Math_SmoothStepToF(&actor->fwork[1], 0.1f, 1.0f, 0.01f, 0); - Math_SmoothStepToF(&gPlayer->camAt.x, actor->obj.pos.x, actor->fwork[0], 100.0f, 0.0f); - Math_SmoothStepToF(&gPlayer->camAt.y, actor->obj.pos.y, actor->fwork[0], 100.0f, 0.0f); - Math_SmoothStepToF(&gPlayer->camAt.z, actor->obj.pos.z + D_80177D20, actor->fwork[0], 100.0f, 0.0f); - Math_SmoothStepToF(&gPlayer->camEye.x, actor->obj.pos.x - 30.0f, actor->fwork[1], 20.0f, 0.0f); - Math_SmoothStepToF(&gPlayer->camEye.y, actor->obj.pos.y, actor->fwork[1], 20.0f, 0.0f); + Math_SmoothStepToF(&gPlayer[0].camAt.x, actor->obj.pos.x, actor->fwork[0], 100.0f, 0.0f); + Math_SmoothStepToF(&gPlayer[0].camAt.y, actor->obj.pos.y, actor->fwork[0], 100.0f, 0.0f); + Math_SmoothStepToF(&gPlayer[0].camAt.z, actor->obj.pos.z + D_80177D20, actor->fwork[0], 100.0f, 0.0f); + Math_SmoothStepToF(&gPlayer[0].camEye.x, actor->obj.pos.x - 30.0f, actor->fwork[1], 20.0f, 0.0f); + Math_SmoothStepToF(&gPlayer[0].camEye.y, actor->obj.pos.y, actor->fwork[1], 20.0f, 0.0f); if (actor->timer_0BC == 0) { - gPlayer->state_1C8 = PLAYERSTATE_1C8_3; - if (gPlayer->unk_238 != 0) { + gPlayer[0].state_1C8 = PLAYERSTATE_1C8_3; + if (gPlayer[0].unk_238 != 0) { func_800B5D30(gPlayer, 1); } D_80161A44 = 12800.0f; @@ -201,9 +201,9 @@ void func_i2_8018F884(Actor* actor) { void func_i2_8018FA04(f32 x, f32 y, f32 z) { s32 i; Actor* actor; - f32 yPos; - f32 xPos; - s32 pad; + f32 yRot; + f32 xRot; + f32 pad; Vec3f src; Vec3f dest; @@ -218,10 +218,11 @@ void func_i2_8018FA04(f32 x, f32 y, f32 z) { actor->obj.pos.z = z; Object_SetInfo(&actor->info, actor->obj.id); actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_60328CC); - xPos = Math_Atan2F(gPlayer->pos.x - x, gPlayer->unk_138 - z); - yPos = -Math_Atan2F(gPlayer->pos.y - y, sqrtf(SQ(gPlayer->unk_138 - z) + SQ(gPlayer->pos.x - x))); - Matrix_RotateY(gCalcMatrix, xPos, 0); - Matrix_RotateX(gCalcMatrix, yPos, 1); + xRot = Math_Atan2F(gPlayer[0].pos.x - x, gPlayer[0].unk_138 - z); + pad = sqrtf(SQ(gPlayer[0].pos.x - x) + SQ(gPlayer[0].unk_138 - z)); + yRot = -Math_Atan2F(gPlayer[0].pos.y - y, pad); + Matrix_RotateY(gCalcMatrix, xRot, 0); + Matrix_RotateX(gCalcMatrix, yRot, 1); src.x = 0.0f; src.y = 0.0f; src.z = 60.0f; @@ -237,8 +238,8 @@ void func_i2_8018FA04(f32 x, f32 y, f32 z) { void func_i2_8018FBBC(Vec3f* pos) { s32 i; Actor* actor; - f32 xPos; - f32 yPos; + f32 xRot; + f32 yRot; Vec3f src; Vec3f dest; @@ -251,11 +252,11 @@ void func_i2_8018FBBC(Vec3f* pos) { actor->vwork[29].z + actor->unk_0F4.z)) { func_800A6028(actor->sfxPos, 0x09000004); actor->state = 1000; - xPos = Math_Atan2F(actor->obj.pos.x - pos->x, actor->obj.pos.z - pos->z); - yPos = -Math_Atan2F(actor->obj.pos.y - pos->y, + xRot = Math_Atan2F(actor->obj.pos.x - pos->x, actor->obj.pos.z - pos->z); + yRot = -Math_Atan2F(actor->obj.pos.y - pos->y, sqrtf(SQ(actor->obj.pos.x - pos->x) + SQ(actor->obj.pos.z - pos->z))); - Matrix_RotateY(gCalcMatrix, xPos, 0); - Matrix_RotateX(gCalcMatrix, yPos, 1); + Matrix_RotateY(gCalcMatrix, xRot, 0); + Matrix_RotateX(gCalcMatrix, yRot, 1); src.x = 0.0f; src.y = 0.0f; src.z = 20.0f; @@ -1449,9 +1450,9 @@ void func_i2_801938D8(Actor* actor, s32 arg1) { Actor_Initialize(actor); actor->obj.status = OBJ_ACTIVE; actor->obj.id = OBJ_ACTOR_195; - actor->obj.pos.x = D_i2_801956EC[arg1].x + gPlayer->camEye.x; - actor->obj.pos.y = D_i2_801956EC[arg1].y + gPlayer->camEye.y; - actor->obj.pos.z = D_i2_801956EC[arg1].z + gPlayer->camEye.z; + actor->obj.pos.x = gPlayer[0].camEye.x + D_i2_801956EC[arg1].x; + actor->obj.pos.y = gPlayer[0].camEye.y + D_i2_801956EC[arg1].y; + actor->obj.pos.z = gPlayer[0].camEye.z + D_i2_801956EC[arg1].z; actor->state = 1; actor->iwork[11] = 1; actor->vel.z = -30.0f; @@ -1516,7 +1517,7 @@ void func_i2_80193A30(Player* player) { xyzDeg, xzDeg, 0.0f); } if (gCsFrameCount == 143) { - Object_Kill(&gPlayerShots->obj, gPlayerShots->sfxPos); + Object_Kill(&gPlayerShots[0].obj, gPlayerShots[0].sfxPos); func_8007BFFC(gActors[5].obj.pos.x, gActors[5].obj.pos.y, gActors[5].obj.pos.z, 0.0f, 0.0f, 0.0f, 3.0f, 40); func_8007D2C8(gActors[5].obj.pos.x, gActors[5].obj.pos.y, gActors[5].obj.pos.z, 6.0f); diff --git a/src/overlays/ovl_i3/fox_aq.c b/src/overlays/ovl_i3/fox_aq.c index daea510b..53097af5 100644 --- a/src/overlays/ovl_i3/fox_aq.c +++ b/src/overlays/ovl_i3/fox_aq.c @@ -6021,7 +6021,7 @@ void func_i3_801BE034(Actor* actor) { if (actor->iwork[0] >= Animation_GetFrameCount(&D_60135E0)) { actor->iwork[0] = 0; } - if (gPlayer->unk_1D0 >= 5) { + if (gPlayer[0].unk_1D0 >= 5) { Object_Kill(&actor->obj, actor->sfxPos); } } @@ -6082,7 +6082,7 @@ void func_i3_801BE3F8(Actor* actor) { actor->state++; break; case 1: - if (fabsf(gPlayer->pos.z - actor->obj.pos.z) <= 3000.0f) { + if (fabsf(gPlayer[0].pos.z - actor->obj.pos.z) <= 3000.0f) { actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_60314E4); actor->info.damage = 0; actor->info.bonus = 1; @@ -6101,11 +6101,11 @@ void func_i3_801BE3F8(Actor* actor) { } if ((actor->unk_0B6 == 18) && (actor->health != 0)) { actor->unk_0B6 = 17; - if ((fabsf(actor->obj.pos.z - gPlayer->unk_138) > 1000.0f) && (actor->timer_0BC < 20) && + if ((fabsf(actor->obj.pos.z - gPlayer[0].unk_138) > 1000.0f) && (actor->timer_0BC < 20) && !(actor->timer_0BC & 3)) { - sp68 = gPlayer->pos.x + RAND_FLOAT_CENTERED(200.0f) - actor->obj.pos.x; - sp64 = gPlayer->pos.y + RAND_FLOAT_CENTERED(200.0f) - actor->obj.pos.y; - sp60 = gPlayer->unk_138 - actor->obj.pos.z; + sp68 = gPlayer[0].pos.x + RAND_FLOAT_CENTERED(200.0f) - actor->obj.pos.x; + sp64 = gPlayer[0].pos.y + RAND_FLOAT_CENTERED(200.0f) - actor->obj.pos.y; + sp60 = gPlayer[0].unk_138 - actor->obj.pos.z; sp58 = Math_RadToDeg(Math_Atan2F(sp68, sp60)); sp5C = Math_RadToDeg(-Math_Atan2F(sp64, sqrtf(SQ(sp68) + SQ(sp60)))); func_i3_801BE274(actor, sp58, sp5C); diff --git a/src/overlays/ovl_i4/fox_bo.c b/src/overlays/ovl_i4/fox_bo.c index 5c88880d..2c5edd47 100644 --- a/src/overlays/ovl_i4/fox_bo.c +++ b/src/overlays/ovl_i4/fox_bo.c @@ -813,31 +813,31 @@ s32 func_i4_8018E05C(Boss* boss, s32 index) { Matrix_RotateY(gCalcMatrix, (-var_fs0) * M_DTOR, 1); - src.x = gPlayer->pos.x - (boss->obj.pos.x + temp_fs2); - src.y = gPlayer->pos.y - (boss->obj.pos.y + 580.0f); - src.z = gPlayer->unk_138 - (boss->obj.pos.z + temp_fs3); + src.x = gPlayer[0].pos.x - (boss->obj.pos.x + temp_fs2); + src.y = gPlayer[0].pos.y - (boss->obj.pos.y + 580.0f); + src.z = gPlayer[0].unk_138 - (boss->obj.pos.z + temp_fs3); Matrix_MultVec3fNoTranslate(gCalcMatrix, &src, &dest); if ((fabsf(dest.x) < 100.0f) && (fabsf(dest.y) < 200.0f)) { - if ((dest.z >= 0.0f) && (dest.z < temp_fs4) && (gPlayer->unk_1F4 == 0)) { + if ((dest.z >= 0.0f) && (dest.z < temp_fs4) && (gPlayer[0].unk_1F4 == 0)) { Player_ApplyDamage(gPlayer, 0, 40); if (dest.y > 0.0f) { - gPlayer->unk_0D8.y = 20.0f; + gPlayer[0].unk_0D8.y = 20.0f; } else { - gPlayer->unk_0D8.y = -20.0f; + gPlayer[0].unk_0D8.y = -20.0f; } for (i = 0; i < 5; i++) { - func_8007C484(RAND_FLOAT_CENTERED(30.0f) + gPlayer->pos.x, RAND_FLOAT(10.0f) + gPlayer->pos.y, - RAND_FLOAT_CENTERED(30.0f) + gPlayer->unk_138, gPlayer->vel.x, - gPlayer->unk_0D8.y + gPlayer->vel.y, gPlayer->vel.z, RAND_FLOAT(0.1f) + 0.1f, - gPlayer->num + 11); + func_8007C484(gPlayer[0].pos.x + RAND_FLOAT_CENTERED(30.0f), gPlayer[0].pos.y + RAND_FLOAT(10.0f), + gPlayer[0].unk_138 + RAND_FLOAT_CENTERED(30.0f), gPlayer[0].vel.x, + gPlayer[0].vel.y + gPlayer[0].unk_0D8.y, gPlayer[0].vel.z, RAND_FLOAT(0.1f) + 0.1f, + gPlayer[0].num + 11); } - func_8007BFFC(RAND_FLOAT_CENTERED(10.0f) + gPlayer->pos.x, RAND_FLOAT(10.0f) + gPlayer->pos.y, - RAND_FLOAT_CENTERED(10.0f) + gPlayer->unk_138, 0.0f, 15.0f, 0.0f, 2.0f, 5); + func_8007BFFC(gPlayer[0].pos.x + RAND_FLOAT_CENTERED(10.0f), gPlayer[0].pos.y + RAND_FLOAT(10.0f), + gPlayer[0].unk_138 + RAND_FLOAT_CENTERED(10.0f), 0.0f, 15.0f, 0.0f, 2.0f, 5); } ret = true; } @@ -942,7 +942,7 @@ void func_i4_8018E710(Boss* boss) { } boss->fwork[0] += 2.0f; - Matrix_RotateY(&D_i4_8019EE80, gBosses->obj.rot.y * M_DTOR, 0); + Matrix_RotateY(&D_i4_8019EE80, gBosses[0].obj.rot.y * M_DTOR, 0); } void func_i4_8018E870(Boss* boss) { @@ -1463,7 +1463,7 @@ void func_i4_8018F94C(Player* player) { case 95: Audio_KillSfx(actor50->sfxPos); - Audio_PlaySfx(0x2902F026U, gActors->sfxPos, 0U, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + Audio_PlaySfx(0x2902F026U, gActors[0].sfxPos, 0U, &D_800C5D34, &D_800C5D34, &D_800C5D3C); for (i = 0; i < ARRAY_COUNT(gEffects); i++) { Object_Kill(&gEffects[i].obj, gEffects[i].sfxPos); @@ -1834,7 +1834,7 @@ void func_i4_801912FC(Boss* boss) { break; case 1: - if (((gHitCount - gActors->iwork[1]) >= 5) || (D_i4_801A0530 > 8000)) { + if (((gHitCount - gActors[0].iwork[1]) >= 5) || (D_i4_801A0530 > 8000)) { boss->state = 2; Radio_PlayMessage(gMsg_ID_11150, RCID_PEPPY); boss->timer_050 = 1000; @@ -1884,7 +1884,7 @@ void func_i4_801912FC(Boss* boss) { boss->swork[36]--; if (boss->swork[36] <= 0) { boss->state = 10; - gBosses->state = 1; + gBosses[0].state = 1; } boss->obj.pos.y += 300.0f; func_80042EC0(boss); @@ -2023,7 +2023,7 @@ void func_i4_80191BAC(Boss* boss) { break; case 1: - Math_SmoothStepToF(&gBosses->fwork[1], 0.0f, 1.0f, 0.01f, 0.001f); + Math_SmoothStepToF(&gBosses[0].fwork[1], 0.0f, 1.0f, 0.01f, 0.001f); if (boss->timer_052 == 0) { boss->state = 2; Audio_PlaySfx(0x19401048U, boss->sfxPos, 0U, &D_800C5D34, &D_800C5D34, &D_800C5D3C); @@ -2160,7 +2160,7 @@ void func_i4_80192264(void) { Matrix_Push(&gGfxMatrix); Rand_SetSeed(1, 29100, 9786); Matrix_Translate(gGfxMatrix, 0.0f, D_8017847C, 0.0f, 1); - Matrix_RotateY(gGfxMatrix, gBosses->obj.rot.y * M_DTOR, 1); + Matrix_RotateY(gGfxMatrix, gBosses[0].obj.rot.y * M_DTOR, 1); Matrix_Scale(gGfxMatrix, 5.0f, 1.0f, 5.0f, 1); for (z = -3200.0f; z <= 3200.0f; z += 800.0f) { diff --git a/src/overlays/ovl_i4/fox_fo.c b/src/overlays/ovl_i4/fox_fo.c index 67692299..785073fd 100644 --- a/src/overlays/ovl_i4/fox_fo.c +++ b/src/overlays/ovl_i4/fox_fo.c @@ -4,12 +4,6 @@ extern Animation D_6007854; extern Limb* D_6007980[]; extern u8 D_600FF64[]; -s32 func_80090200(Boss* boss); -void func_800A5EBC(void); - -void func_i4_801875F0(Actor* actor); -void func_i4_80187960(Actor* actor); - void func_i4_801875F0(Actor* actor) { s32 i; s32 counter; @@ -774,7 +768,7 @@ void func_i4_8018927C(Player* player) { gBosses[0].swork[0] = 1; - if ((func_80090200(gBosses) == 2) || (D_80177930 != 0)) { + if ((func_80090200(&gBosses[0]) == 2) || (D_80177930 != 0)) { func_800A6148(); if (D_80177930 == 0) { player->unk_1D0 = 10; diff --git a/src/overlays/ovl_i4/fox_ka.c b/src/overlays/ovl_i4/fox_ka.c index 86d003d0..dfb4fbb3 100644 --- a/src/overlays/ovl_i4/fox_ka.c +++ b/src/overlays/ovl_i4/fox_ka.c @@ -440,26 +440,20 @@ void func_i4_80193CA4(Boss* boss) { void func_i4_80193CE4(Boss* boss, s32 idx) { s32 i; Vec3f pos; - f32 randX; - f32 randY; - f32 randZ; - func_8007D2C8((boss->vwork[idx + 1].x * 1.3f) + boss->obj.pos.x, (boss->vwork[idx + 1].y * 1.3f) + boss->obj.pos.y, - (boss->vwork[idx + 1].z * 1.3f) + boss->obj.pos.z, 15.0f); + func_8007D2C8(boss->obj.pos.x + (boss->vwork[idx + 1].x * 1.3f), boss->obj.pos.y + (boss->vwork[idx + 1].y * 1.3f), + boss->obj.pos.z + (boss->vwork[idx + 1].z * 1.3f), 15.0f); boss->swork[idx + 5] = 60; for (i = 0; i < 20; i++) { - randX = Rand_ZeroOne(); - randY = Rand_ZeroOne(); - randZ = Rand_ZeroOne(); - func_800794CC((boss->vwork[idx + 1].x * 1.3f) + (boss->obj.pos.x + ((randX - 0.5f) * 300.0f)), - (boss->vwork[idx + 1].y * 1.3f) + (boss->obj.pos.y + ((randY - 0.5f) * 300.0f)), - (boss->vwork[idx + 1].z * 1.3f) + (boss->obj.pos.z + ((randZ - 0.5f) * 300.0f)), 1.55f); + func_800794CC(boss->obj.pos.x + RAND_FLOAT_CENTERED(300.0f) + (boss->vwork[idx + 1].x * 1.3f), + boss->obj.pos.y + RAND_FLOAT_CENTERED(300.0f) + (boss->vwork[idx + 1].y * 1.3f), + boss->obj.pos.z + RAND_FLOAT_CENTERED(300.0f) + (boss->vwork[idx + 1].z * 1.3f), 1.55f); } - pos.x = (boss->vwork[idx + 1].x * 1.3f) + boss->obj.pos.x; - pos.y = (boss->vwork[idx + 1].y * 1.3f) + boss->obj.pos.y; - pos.z = (boss->vwork[idx + 1].z * 1.3f) + boss->obj.pos.z; + pos.x = boss->obj.pos.x + (boss->vwork[idx + 1].x * 1.3f); + pos.y = boss->obj.pos.y + (boss->vwork[idx + 1].y * 1.3f); + pos.z = boss->obj.pos.z + (boss->vwork[idx + 1].z * 1.3f); func_8007A6F0(&pos, 0x2903B009); boss->swork[15] += 1; BonusText_Display(pos.x, pos.y - 300.0f, pos.z, 5); @@ -2002,7 +1996,7 @@ void func_i4_80198AA0(Actor* actor) { actor->iwork[5] = 1; if (!((actor->index + gGameFrameCount) & 11) && (Rand_ZeroOne() < 0.1f) && - (func_80031900(actor) != 0) && (gActors->state == 2)) { + (func_80031900(actor) != 0) && (gActors[0].state == 2)) { actor->iwork[0] = 1; } } else { diff --git a/src/overlays/ovl_i5/fox_ma.c b/src/overlays/ovl_i5/fox_ma.c index 99b5e8a1..68662833 100644 --- a/src/overlays/ovl_i5/fox_ma.c +++ b/src/overlays/ovl_i5/fox_ma.c @@ -2973,7 +2973,7 @@ void func_i5_801A46A0(Actor* actor) { actor->vel.y = -actor->vel.y * (actor->unk_046 * 0.07f); } - actor->fwork[0] /= 1.2f + Rand_ZeroOne() / 2; + actor->fwork[0] /= 1.2f + RAND_FLOAT(1.0f) / 2; actor->unk_046--; actor->vel.z /= 1.5f; if (actor->unk_046 == 0) { @@ -3579,14 +3579,14 @@ void func_i5_801A6C78(Actor* actor) { func_i5_801A0308(actor, actor->obj.pos.z, actor->obj.rot.y, 0); switch (D_i5_801BE320[0]) { case 0: - Math_SmoothStepToF(&D_i5_801BE368[0], 30.0f, 0.1f, Rand_ZeroOne() + 1.0f, 0.01f); + Math_SmoothStepToF(&D_i5_801BE368[0], 30.0f, 0.1f, RAND_FLOAT(1.0f) + 1.0f, 0.01f); D_i5_801BE368[1] += D_i5_801BE368[0]; if (D_i5_801BE368[1] > 200.0f) { D_i5_801BE320[0] = 1; } break; case 1: - Math_SmoothStepToF(&D_i5_801BE368[0], -30.0f, 0.1f, Rand_ZeroOne() + 1.0f, 0.01f); + Math_SmoothStepToF(&D_i5_801BE368[0], -30.0f, 0.1f, RAND_FLOAT(1.0f) + 1.0f, 0.01f); D_i5_801BE368[1] += D_i5_801BE368[0]; if (D_i5_801BE368[1] < -200.0f) { D_i5_801BE320[0] = 0; @@ -3629,14 +3629,14 @@ void func_i5_801A6FB4(Actor* actor) { func_i5_801A0308(actor, actor->obj.pos.z, actor->obj.rot.y, 0); switch (D_i5_801BE320[0]) { case 0: - Math_SmoothStepToF(&D_i5_801BE368[0], 20.0f, 0.1f, Rand_ZeroOne() + 1.0f, 0.01f); + Math_SmoothStepToF(&D_i5_801BE368[0], 20.0f, 0.1f, RAND_FLOAT(1.0f) + 1.0f, 0.01f); D_i5_801BE368[1] += D_i5_801BE368[0]; if (D_i5_801BE368[1] > 200.0f) { D_i5_801BE320[0] = 1; } break; case 1: - Math_SmoothStepToF(&D_i5_801BE368[0], -20.0f, 0.1f, Rand_ZeroOne() + 1.0f, 0.01f); + Math_SmoothStepToF(&D_i5_801BE368[0], -20.0f, 0.1f, RAND_FLOAT(1.0f) + 1.0f, 0.01f); D_i5_801BE368[1] += D_i5_801BE368[0]; if (D_i5_801BE368[1] < -200.0f) { D_i5_801BE320[0] = 0; @@ -3673,14 +3673,14 @@ void func_i5_801A72DC(Actor* actor) { func_i5_801A0308(actor, actor->obj.pos.z, actor->obj.rot.y, 0); switch (D_i5_801BE320[0]) { case 0: - Math_SmoothStepToF(&D_i5_801BE368[0], 5.0f, 0.1f, Rand_ZeroOne() + 0.3f, 0.01f); + Math_SmoothStepToF(&D_i5_801BE368[0], 5.0f, 0.1f, RAND_FLOAT(1.0f) + 0.3f, 0.01f); D_i5_801BE368[1] += D_i5_801BE368[0]; if (D_i5_801BE368[1] > 100.0f) { D_i5_801BE320[0] = 1; } break; case 1: - Math_SmoothStepToF(&D_i5_801BE368[0], -5.0f, 0.1f, Rand_ZeroOne() + 0.3f, 0.01f); + Math_SmoothStepToF(&D_i5_801BE368[0], -5.0f, 0.1f, RAND_FLOAT(1.0f) + 0.3f, 0.01f); D_i5_801BE368[1] += D_i5_801BE368[0]; if (D_i5_801BE368[1] < -100.0f) { D_i5_801BE320[0] = 0; @@ -3696,14 +3696,14 @@ void func_i5_801A74C4(Actor* actor) { func_i5_801A0308(actor, actor->obj.pos.z, actor->obj.rot.y, 0); switch (D_i5_801BE320[0]) { case 0: - Math_SmoothStepToF(&D_i5_801BE368[0], 22.0f, 0.1f, Rand_ZeroOne() + 1.0f, 0.01f); + Math_SmoothStepToF(&D_i5_801BE368[0], 22.0f, 0.1f, RAND_FLOAT(1.0f) + 1.0f, 0.01f); D_i5_801BE368[1] += D_i5_801BE368[0]; if (D_i5_801BE368[1] > 200.0f) { D_i5_801BE320[0] = 1; } break; case 1: - Math_SmoothStepToF(&D_i5_801BE368[0], -22.0f, 0.1f, Rand_ZeroOne() + 1.0f, 0.01f); + Math_SmoothStepToF(&D_i5_801BE368[0], -22.0f, 0.1f, RAND_FLOAT(1.0f) + 1.0f, 0.01f); D_i5_801BE368[1] += D_i5_801BE368[0]; if (D_i5_801BE368[1] < -200.0f) { D_i5_801BE320[0] = 0; @@ -3756,14 +3756,14 @@ void func_i5_801A78B0(Actor* actor) { func_i5_801A0308(actor, actor->obj.pos.z, actor->obj.rot.y, 0); switch (D_i5_801BE320[0]) { case 0: - Math_SmoothStepToF(&D_i5_801BE368[0], 10.0f, 0.1f, Rand_ZeroOne() + 1.0f, 0.01f); + Math_SmoothStepToF(&D_i5_801BE368[0], 10.0f, 0.1f, RAND_FLOAT(1.0f) + 1.0f, 0.01f); D_i5_801BE368[1] += D_i5_801BE368[0]; if (D_i5_801BE368[1] > 200.0f) { D_i5_801BE320[0] = 1; } break; case 1: - Math_SmoothStepToF(&D_i5_801BE368[0], -10.0f, 0.1f, Rand_ZeroOne() + 1.0f, 0.01f); + Math_SmoothStepToF(&D_i5_801BE368[0], -10.0f, 0.1f, RAND_FLOAT(1.0f) + 1.0f, 0.01f); D_i5_801BE368[1] += D_i5_801BE368[0]; if (D_i5_801BE368[1] < -200.0f) { D_i5_801BE320[0] = 0; @@ -3778,14 +3778,14 @@ void func_i5_801A7A30(Actor* actor) { func_i5_801A0308(actor, actor->obj.pos.z, actor->obj.rot.y, 0); switch (D_i5_801BE320[0]) { case 0: - Math_SmoothStepToF(&D_i5_801BE368[0], 30.0f, 0.1f, Rand_ZeroOne() + 1.0f, 0.01f); + Math_SmoothStepToF(&D_i5_801BE368[0], 30.0f, 0.1f, RAND_FLOAT(1.0f) + 1.0f, 0.01f); D_i5_801BE368[1] += D_i5_801BE368[0]; if (D_i5_801BE368[1] > 10.0f) { D_i5_801BE320[0] = 1; } break; case 1: - Math_SmoothStepToF(&D_i5_801BE368[0], -30.0f, 0.1f, Rand_ZeroOne() + 1.0f, 0.01f); + Math_SmoothStepToF(&D_i5_801BE368[0], -30.0f, 0.1f, RAND_FLOAT(1.0f) + 1.0f, 0.01f); D_i5_801BE368[1] += D_i5_801BE368[0]; if (D_i5_801BE368[1] < -10.0f) { D_i5_801BE320[0] = 0; @@ -4364,7 +4364,7 @@ void func_i5_801A7E7C(Actor* actor) { actor->vwork[0].z, RAND_FLOAT_CENTERED(10.0f), RAND_FLOAT(5.0f), actor->vel.z + 2.0f, RAND_FLOAT(360.0f), RAND_FLOAT(360.0f), RAND_FLOAT(360.0f), RAND_FLOAT_CENTERED(30.0f), RAND_FLOAT_CENTERED(30.0f), RAND_FLOAT_CENTERED(30.0f), - (s32) (RAND_FLOAT(25.0f) + 30.f), 10, Rand_ZeroOne()); + (s32) (RAND_FLOAT(25.0f) + 30.f), 10, RAND_FLOAT(1.0f)); } actor->timer_0BC = 80; actor->state = 14; @@ -4616,7 +4616,7 @@ void func_i5_801A7E7C(Actor* actor) { RAND_FLOAT_CENTERED(10.0f), RAND_FLOAT(5.0f), RAND_FLOAT_CENTERED(3.0f), RAND_FLOAT(360.0f), RAND_FLOAT(360.0f), RAND_FLOAT(360.0f), RAND_FLOAT_CENTERED(30.0f), RAND_FLOAT_CENTERED(30.0f), RAND_FLOAT_CENTERED(30.0f), (s32) (RAND_FLOAT(50.0f) + 70.0f), - 3, Rand_ZeroOne()); + 3, RAND_FLOAT(1.0f)); if (D_i5_801BE320[9] <= 0) { Audio_PlaySfx(0x2903B009, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y + 80.0f, actor->obj.pos.z + 50.0f, 5.0f); @@ -4625,7 +4625,7 @@ void func_i5_801A7E7C(Actor* actor) { RAND_FLOAT_CENTERED(10.0f), RAND_FLOAT(5.0f), RAND_FLOAT_CENTERED(3.0f), RAND_FLOAT(360.0f), RAND_FLOAT(360.0f), RAND_FLOAT(360.0f), RAND_FLOAT_CENTERED(30.0f), RAND_FLOAT_CENTERED(30.0f), RAND_FLOAT_CENTERED(30.f), - (s32) (RAND_FLOAT(50.0f) + 70.0f), 3, Rand_ZeroOne()); + (s32) (RAND_FLOAT(50.0f) + 70.0f), 3, RAND_FLOAT(1.0f)); } func_i5_801AD624(actor->obj.pos.x, actor->obj.pos.y + 80.0f, actor->obj.pos.z + 50.0f, RAND_FLOAT_CENTERED(3.0f), RAND_FLOAT(15.0f), -2.0f, RAND_FLOAT(360.0f), @@ -4641,7 +4641,7 @@ void func_i5_801A7E7C(Actor* actor) { func_i5_801AD624(actor->obj.pos.x, actor->obj.pos.y - 30.0f, actor->obj.pos.z, RAND_FLOAT_CENTERED(10.0f), RAND_FLOAT(7.0f) + 7.0f, RAND_FLOAT_CENTERED(3.0f), RAND_FLOAT(360.0f), RAND_FLOAT(360.0f), RAND_FLOAT(360.0f), RAND_FLOAT_CENTERED(30.0f), RAND_FLOAT_CENTERED(30.0f), - RAND_FLOAT_CENTERED(30.0f), (s32) (RAND_FLOAT(50.0f) + 70.0f), 3, Rand_ZeroOne()); + RAND_FLOAT_CENTERED(30.0f), (s32) (RAND_FLOAT(50.0f) + 70.0f), 3, RAND_FLOAT(1.0f)); if (D_i5_801BE320[10] <= 0) { Audio_PlaySfx(0x2903B009, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y - 30.0f, actor->obj.pos.z, 6.0f); @@ -4651,7 +4651,7 @@ void func_i5_801A7E7C(Actor* actor) { RAND_FLOAT_CENTERED(10.0f), RAND_FLOAT(7.0f) + 7.0f, RAND_FLOAT_CENTERED(3.0f), RAND_FLOAT(360.0f), RAND_FLOAT(360.0f), RAND_FLOAT(360.0f), RAND_FLOAT_CENTERED(30.0f), RAND_FLOAT_CENTERED(30.0f), RAND_FLOAT_CENTERED(30.0f), - (s32) (RAND_FLOAT(50.0f) + 70.0f), 3, Rand_ZeroOne()); + (s32) (RAND_FLOAT(50.0f) + 70.0f), 3, RAND_FLOAT(1.0f)); } func_i5_801AD624(actor->obj.pos.x, actor->obj.pos.y - 30.0f, actor->obj.pos.z + 50.0f, RAND_FLOAT_CENTERED(3.0f), RAND_FLOAT(15.0f), -2.0f, RAND_FLOAT(360.0f), @@ -4710,8 +4710,8 @@ void func_i5_801A7E7C(Actor* actor) { D_i5_801BE368[28] = actor->vwork[4].y; D_i5_801BE368[29] = actor->vwork[4].z; D_i5_801BE368[19] = actor->vel.z; - D_i5_801BE368[30] = Rand_ZeroOne(); - D_i5_801BE368[31] = Rand_ZeroOne(); + D_i5_801BE368[30] = RAND_FLOAT(1.0f); + D_i5_801BE368[31] = RAND_FLOAT(1.0f); if (D_i5_801BE368[30] < 0.5f) { D_i5_801BE368[30] = 0.6f; } @@ -6971,7 +6971,7 @@ void func_i5_801B3D04(Player* player) { break; case 230: if (gTeamShields[2] > 0.0f) { - func_i5_801B3554(gActors, 0); + func_i5_801B3554(&gActors[0], 0); } break; case 260: diff --git a/src/overlays/ovl_i5/fox_ti_cs.c b/src/overlays/ovl_i5/fox_ti_cs.c index ac8bab4f..20ccf930 100644 --- a/src/overlays/ovl_i5/fox_ti_cs.c +++ b/src/overlays/ovl_i5/fox_ti_cs.c @@ -77,7 +77,7 @@ void func_i5_8018769C(Player* player) { player->unk_240 = 1; player->unk_1D0 = 1; gFogFar = 1006; - gPlayer->unk_19C = 0; + gPlayer[0].unk_19C = 0; gBgColor = 0x78C1; case 1: @@ -145,7 +145,7 @@ void func_i5_8018769C(Player* player) { player->camAt.y = D_801779B8 = player->pos.y; player->camAt.z = D_801779C0 = player->pos.z; - gPlayer->unk_19C = 1; + gPlayer[0].unk_19C = 1; gBgColor = 0x2089; @@ -304,7 +304,7 @@ void func_i5_801882CC(Player* player) { player->unk_0D4 = 3.0f; - func_i5_80188108(gActors, 0); + func_i5_80188108(&gActors[0], 0); if (gTeamShields[1] > 0) { func_i5_80188108(&gActors[1], 1); @@ -475,7 +475,7 @@ void func_i5_801882CC(Player* player) { break; case 1200: - gActors->state++; + gActors[0].state++; break; case 1220: diff --git a/src/overlays/ovl_i6/fox_andross.c b/src/overlays/ovl_i6/fox_andross.c index e66e4019..9a9d02f3 100644 --- a/src/overlays/ovl_i6/fox_andross.c +++ b/src/overlays/ovl_i6/fox_andross.c @@ -1325,9 +1325,9 @@ void func_i6_8018C390(Player* player) { case 3: break; case 0: - Math_SmoothStepToF(&player->pos.x, gBosses->obj.pos.x, 0.5f, 30.0f, 0); - Math_SmoothStepToF(&player->pos.y, gBosses->obj.pos.y - 150.0f, 0.5f, 30.0f, 0); - Math_SmoothStepToF(&player->pos.z, gBosses->obj.pos.z - 100.0f, 0.5f, 60.0f, 0); + Math_SmoothStepToF(&player->pos.x, gBosses[0].obj.pos.x, 0.5f, 30.0f, 0); + Math_SmoothStepToF(&player->pos.y, gBosses[0].obj.pos.y - 150.0f, 0.5f, 30.0f, 0); + Math_SmoothStepToF(&player->pos.z, gBosses[0].obj.pos.z - 100.0f, 0.5f, 60.0f, 0); D_80177D20 = player->unk_144 = -player->pos.z; Math_SmoothStepToF(&player->camEye.z, 2000.0f, 0.05f, 20.0f, 0); Math_SmoothStepToF(&player->camEye.x, 0.0f, 0.05f, 10.0f, 0); diff --git a/src/overlays/ovl_i6/fox_sy.c b/src/overlays/ovl_i6/fox_sy.c index b0991aa5..d689c4ce 100644 --- a/src/overlays/ovl_i6/fox_sy.c +++ b/src/overlays/ovl_i6/fox_sy.c @@ -1139,8 +1139,75 @@ void func_i6_8019BBBC(Boss* boss) { boss->fwork[26] = gPlayer[0].vel.z; } -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i6/fox_sy/func_i6_8019BC14.s") -// https://decomp.me/scratch/xg9Tv +void func_i6_8019BC14(Boss* boss) { + f32 sp4C; + f32 sp48; + f32 sp44; + f32 sp40; + f32 sp3C; + f32 sp38; + f32 var_fa0; + + if ((ABS(boss->obj.pos.x) >= 11000.0f) || (ABS(boss->obj.pos.z) >= 11000.0f)) { + boss->timer_052 = 2; + return; + } + if ((boss->swork[0x16] == 1) && (D_801615D0.z > 0.0f)) { + boss->timer_052 = 2; + return; + } + if (boss->swork[0x16] != 1) { + var_fa0 = ((ABS(boss->fwork[0x12] - boss->fwork[1]) + ABS(boss->fwork[0x14] - boss->fwork[3]) + + ABS(boss->fwork[0x13] - boss->fwork[2])) / + 140.0f) - + 2.0f; + boss->fwork[0x12] = boss->fwork[0x12] + boss->fwork[0x18] * var_fa0; + boss->fwork[0x13] = boss->fwork[0x13] + boss->fwork[0x19] * var_fa0; + boss->fwork[0x14] = boss->fwork[0x14] + boss->fwork[0x1A] * var_fa0; + } + if ((fabsf(boss->fwork[3] - boss->fwork[0x14]) > 300.0f) || (fabsf(boss->fwork[1] - boss->fwork[0x12]) > 300.0f)) { + sp3C = Math_RadToDeg( + Math_Atan2F(boss->fwork[0x12] - boss->fwork[1] - boss->unk_078.x, boss->fwork[0x14] - boss->fwork[3])); + sp40 = ABS(boss->fwork[0x12] - boss->fwork[1]) + ABS(boss->fwork[0x14] - boss->fwork[3]); + sp40 = Math_RadToDeg(-Math_Atan2F(boss->fwork[0x13] - boss->fwork[2], sp40)); + sp38 = Math_RadToDeg(Math_Atan2F(boss->fwork[1] - boss->fwork[0x15], boss->fwork[3] - boss->fwork[0x17])); + var_fa0 = ABS(boss->fwork[1] - boss->fwork[0x15]) + ABS(boss->fwork[3] - boss->fwork[0x17]); + var_fa0 = Math_RadToDeg(-Math_Atan2F(boss->fwork[2] - boss->fwork[0x16], var_fa0)); + sp38 = sp3C - sp38; + var_fa0 = sp40 - var_fa0; + + if (sp38 < 0.0f) { + sp38 += 360.0f; + } + if (var_fa0 < 0.0f) { + var_fa0 += 360.0f; + } + if (((sp38 < 41.0f) || (sp38 > 319.0f)) && ((var_fa0 < 41.0f) || (var_fa0 > 319.0f))) { + boss->timer_054 = 4; + boss->fwork[4] = 30.0f; + sp4C = gPlayer[0].pos.x; + sp48 = gPlayer[0].pos.y; + sp44 = gPlayer[0].pos.z; + gPlayer[0].pos.x = boss->fwork[0x12]; + gPlayer[0].pos.y = boss->fwork[0x13]; + gPlayer[0].unk_138 = gPlayer[0].pos.z = boss->fwork[0x14]; + func_8007F11C(OBJ_EFFECT_354, boss->fwork[1], boss->fwork[2], boss->fwork[3], 100.0f); + gPlayer[0].pos.x = sp4C; + gPlayer[0].pos.y = sp48; + gPlayer[0].unk_138 = gPlayer[0].pos.z = sp44; + if (boss->index == 0) { + Audio_PlaySfx(0x2901306EU, boss->sfxPos, 4U, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } else { + Audio_PlaySfx(0x2900306BU, boss->sfxPos, 4U, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + } + } + if (boss->index == 0) { + boss->timer_052 = RAND_INT(20.0f) + 15; + } else { + boss->timer_052 = RAND_INT(20.0f) + 25; + } +} void func_i6_8019C194(Boss* boss, f32 zSpeed, f32 xSpeed) { f32 sp2C; @@ -1736,9 +1803,9 @@ void func_i6_8019E2C4(Boss* boss) { Matrix_Scale(gGfxMatrix, boss->fwork[34], boss->fwork[34], boss->fwork[34], 1); Matrix_RotateX(gGfxMatrix, -boss->obj.rot.x * M_DTOR, 1); Matrix_RotateZ(gGfxMatrix, -boss->obj.rot.z * M_DTOR, 1); - sp98 = gPlayer->camEye.x - boss->obj.pos.x; - sp94 = gPlayer->camEye.y - boss->obj.pos.y; - sp90 = gPlayer->camEye.z - (boss->obj.pos.z + D_80177D20); + sp98 = gPlayer[0].camEye.x - boss->obj.pos.x; + sp94 = gPlayer[0].camEye.y - boss->obj.pos.y; + sp90 = gPlayer[0].camEye.z - (boss->obj.pos.z + D_80177D20); sp8C = -Math_Atan2F(sp98, sp90); sp9C = sqrtf(SQ(sp90) + SQ(sp98)); sp88 = Math_Atan2F(sp94, sp9C); @@ -2884,15 +2951,15 @@ void func_i6_801A0AC0(Player* player) { Math_SmoothStepToAngle(&gActors[5].obj.rot.y, 30.0f, 1.0f, 0.75f, 0.0f); } if ((gCsFrameCount > 440) && (player->unk_0E8 != 0.0f)) { - Math_SmoothStepToF(&gPlayer->pos.y, 0.0f, 0.1f, 5.0f, 0.0f); + Math_SmoothStepToF(&gPlayer[0].pos.y, 0.0f, 0.1f, 5.0f, 0.0f); Math_SmoothStepToAngle(&player->unk_0EC, Math_SmoothStepToAngle(&player->unk_0E8, 0.0f, 1.0f, 0.7f, 0.0f) * 30.0f, 0.1f, 5.0f, 0); - Math_SmoothStepToF(&gPlayer->pos.x, 0.0f, 1.0f, 13.0f, 0.0f); + Math_SmoothStepToF(&gPlayer[0].pos.x, 0.0f, 1.0f, 13.0f, 0.0f); } if (player->unk_0E8 == 0.0f) { Math_SmoothStepToAngle(&player->unk_0EC, 0.0f, 1.0f, 0.5f, 0); - Math_SmoothStepToF(&gPlayer->pos.x, 0.0f, 1.0f, 2.0f, 0.0f); + Math_SmoothStepToF(&gPlayer[0].pos.x, 0.0f, 1.0f, 2.0f, 0.0f); } if (gCsFrameCount >= 445) { Math_SmoothStepToF(&gActors[7].vel.z, -40.0f, 1.0f, 1.0f, 1.0f); @@ -3026,7 +3093,7 @@ void func_i6_801A0AC0(Player* player) { break; case 4: Math_SmoothStepToAngle(&player->unk_0EC, 0.0f, 1.0f, 0.5f, 0); - Math_SmoothStepToF(&gPlayer->pos.x, 0.0f, 1.0f, 1.0f, 0.0f); + Math_SmoothStepToF(&gPlayer[0].pos.x, 0.0f, 1.0f, 1.0f, 0.0f); Math_SmoothStepToF(D_80177A48, 1.0f, 0.1f, 0.05f, 0.0f); if (gCsFrameCount < 595) { Math_SmoothStepToF(&gActors[5].obj.pos.z, -12000.0f, 1.0f, 100.0f, 1.0f); @@ -3161,8 +3228,296 @@ void func_i6_801A3B50(f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32 yVel, f32 zVel } } -#pragma GLOBAL_ASM("asm/us/nonmatchings/overlays/ovl_i6/fox_sy/func_i6_801A3BD4.s") -// https://decomp.me/scratch/lEVcO +void func_i6_801A3BD4(Actor* actor) { + f32 sp1E4; + f32 sp1E0; + s32 i; + f32 sp1D8; + f32 sp1D4; + f32 sp1D0; + Vec3f sp68[30]; + Vec3f sp5C; + Vec3f sp50; + s32 sp4C; + s32 pad; + + sp4C = 30; + actor->iwork[14] = actor->unk_0B4 - 48; + actor->info.drawType = 2; + if (actor->iwork[18] != 0) { + actor->iwork[18]--; + } + + if ((actor->unk_048 != 0) && (actor->unk_046 != 3)) { + switch (actor->unk_048) { + case 1: + actor->unk_046 = 1; + actor->timer_0BE = 50; + actor->iwork[19] = 0; + break; + case 2: + actor->unk_046 = 1; + actor->timer_0BE = 20; + actor->iwork[19] = 0; + break; + case 3: + actor->unk_046 = 2; + actor->unk_0B6 = 0; + break; + case 4: + actor->unk_046 = 0; + actor->unk_0B6 = 0; + break; + case 8: + actor->unk_046 = 1; + actor->timer_0BE = 50; + actor->iwork[19] = 1; + break; + case 9: + actor->unk_046 = 1; + actor->timer_0BE = 20; + actor->iwork[19] = 1; + break; + case 10: + actor->unk_046 = 1; + actor->timer_0BE = 50; + actor->iwork[19] = -1; + break; + case 11: + actor->unk_046 = 1; + actor->timer_0BE = 20; + actor->iwork[19] = -1; + break; + case 6: + actor->unk_046 = 4; + actor->unk_0B6 = 0; + break; + case 5: + actor->unk_046 = 5; + actor->unk_0B6 = Animation_GetFrameCount(&D_602B778) - 1; + break; + case 7: + actor->unk_046 = 6; + actor->unk_0B6 = Animation_GetFrameCount(&D_602B778) - 1; + break; + } + actor->unk_048 = 0; + actor->fwork[15] = 0.0f; + } + + switch (actor->unk_046) { + case 0: + i = actor->iwork[17]; + if (i != 0) { + if (i == 1) { + actor->unk_0B6 = Animation_GetFrameCount(&D_60265B4) - 1; + sp4C = Animation_GetFrameData(&D_60265B4, actor->unk_0B6, sp68); + } else if (i == 2) { + actor->unk_0B6 = Animation_GetFrameCount(&D_602B8DC) - 1; + sp4C = Animation_GetFrameData(&D_602B8DC, actor->unk_0B6, sp68); + } + } else { + actor->unk_0B6 = Animation_GetFrameCount(&D_602CEB4); + sp4C = Animation_GetFrameData(&D_602CEB4, actor->unk_0B6, sp68); + } + break; + case 1: + i = actor->iwork[17]; + if (i != 0) { + if (i == 1) { + actor->unk_0B6 = Animation_GetFrameCount(&D_60265B4) - 1; + sp4C = Animation_GetFrameData(&D_60265B4, actor->unk_0B6, sp68); + } else if (i == 2) { + actor->unk_0B6 = Animation_GetFrameCount(&D_602B8DC) - 1; + sp4C = Animation_GetFrameData(&D_602B8DC, actor->unk_0B6, sp68); + } + } else { + actor->unk_0B6 = Animation_GetFrameCount(&D_602A2CC) - 1; + sp4C = Animation_GetFrameData(&D_602A2CC, actor->unk_0B6, sp68); + } + if (actor->timer_0BE == 15) { + actor->timer_0C4 = 4; + actor->fwork[19] = 30.0f; + if (actor->iwork[19] < 0) { + func_8006F254(actor); + } else { + sp1E4 = gPlayer[0].pos.x; + sp1E0 = gPlayer[0].pos.y; + if (actor->iwork[19] != 0) { + gPlayer[0].pos.x += RAND_FLOAT_CENTERED(300.0f); + gPlayer[0].pos.y += RAND_FLOAT_CENTERED(300.0f); + } + func_8007F11C(0x162, actor->fwork[16], actor->fwork[17], actor->fwork[18], 100.0f); + gPlayer[0].pos.x = sp1E4; + gPlayer[0].pos.y = sp1E0; + Audio_PlaySfx(0x2900306B, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + actor->unk_048 = 0; + } + if (actor->timer_0BE == 0) { + actor->unk_0B6 = 0; + actor->unk_046 = 0; + actor->fwork[15] = 0.0f; + } + break; + case 2: + if (actor->unk_0B6 < (Animation_GetFrameCount(&D_6029B48) - 1)) { + actor->unk_0B6++; + } + sp4C = Animation_GetFrameData(&D_6029B48, actor->unk_0B6, sp68); + break; + case 4: + actor->unk_0B6++; + if (actor->unk_0B6 >= (Animation_GetFrameCount(&D_602B778) - 1)) { + actor->unk_046 = 0; + actor->iwork[17] = 0; + actor->fwork[15] = 0.0f; + } + sp4C = Animation_GetFrameData(&D_602B778, actor->unk_0B6, sp68); + break; + case 5: + case 6: + actor->unk_0B6 -= 1; + if (actor->unk_0B6 < 8) { + actor->fwork[15] = 0.1f; + if (actor->unk_046 == 5) { + actor->iwork[17] = 1; + } else { + actor->iwork[17] = 2; + } + actor->unk_046 = 0; + } + sp4C = Animation_GetFrameData(&D_602B778, actor->unk_0B6, sp68); + break; + case 3: + actor->unk_0B6++; + if (actor->unk_0B6 >= Animation_GetFrameCount(&D_6003348)) { + actor->unk_0B6 = Animation_GetFrameCount(&D_6003348) - 1; + } + sp4C = Animation_GetFrameData(&D_6003348, actor->unk_0B6, sp68); + if ((actor->timer_0BE % 4U) == 0) { + func_8007D2C8(RAND_FLOAT_CENTERED(150.0f) + actor->obj.pos.x, + RAND_FLOAT_CENTERED(150.0f) + actor->obj.pos.y, actor->obj.pos.z + 30.0f, 4.0f); + } + if (actor->timer_0BE == 5U) { + func_8007BFFC(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, actor->vel.x, actor->vel.y, + actor->vel.z, 8.0f, 0xA); + func_8007B344(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 8.0f, 5); + Audio_PlaySfx(0x2903A060, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + } + if (actor->timer_0BE == 0) { + Object_Kill(&actor->obj, actor->sfxPos); + func_80066254(actor); + for (i = 10; i < 24; i++) { + func_i6_801A3B50(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, RAND_FLOAT_CENTERED(50.0f), + RAND_FLOAT_CENTERED(50.0f), actor->vel.z + RAND_FLOAT_CENTERED(50.0f), i); + } + } + break; + } + if ((actor->unk_046 == 1) || (actor->unk_046 == 2)) { + Matrix_RotateZ(gCalcMatrix, -actor->vwork[29].z * M_DTOR, 0); + Matrix_RotateX(gCalcMatrix, -actor->vwork[29].x * M_DTOR, 1); + Matrix_RotateY(gCalcMatrix, -actor->vwork[29].y * M_DTOR, 1); + Matrix_RotateZ(gCalcMatrix, -actor->obj.rot.z * M_DTOR, 1); + Matrix_RotateX(gCalcMatrix, -actor->obj.rot.x * M_DTOR, 1); + if (actor->iwork[17] == 0) { + Matrix_RotateY(gCalcMatrix, -actor->obj.rot.y * M_DTOR, 1); + } + sp5C.x = gPlayer[0].pos.x - actor->obj.pos.x; + sp5C.y = gPlayer[0].pos.y - actor->obj.pos.y; + sp5C.z = gPlayer[0].pos.z - actor->obj.pos.z; + Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp5C, &sp50); + sp1D4 = Math_RadToDeg(Math_Atan2F(sp50.x, sp50.z)); + sp1D8 = Math_RadToDeg(-Math_Atan2F(sp50.y, sqrtf((sp50.x * sp50.x) + (sp50.z * sp50.z)))); + if ((sp1D8 > 90.0f) && (sp1D8 < 180.0f)) { + sp1D8 = 90.0f; + } + if ((sp1D8 < 270.0f) && (sp1D8 > 180.0f)) { + sp1D8 = 270.0f; + } + if (actor->iwork[17] != 0) { + Math_SmoothStepToAngle(&actor->obj.rot.y, sp1D4, 0.1f, 2.0f, 0.0f); + sp1D0 = sp1D4 - actor->obj.rot.y; + sp1D4 = 0.0f; + } else { + if ((sp1D4 > 90.0f) && (sp1D4 < 180.0f)) { + sp1D4 = 90.0f; + } + if ((sp1D4 < 270.0f) && (sp1D4 > 180.0f)) { + sp1D4 = 270.0f; + } + sp1D0 = sp1D4 - actor->fwork[0x15]; + } + } else { + sp1D0 = sp1D8 = sp1D4 = 0.0f; + } + Math_SmoothStepToAngle(&actor->fwork[0x15], sp1D4, 0.1f, 2.0f, 0.0f); + Math_SmoothStepToAngle(&actor->fwork[20], sp1D8, 0.1f, 2.0f, 0.0f); + + if (sp1D0 < 0.0f) { + sp1D0 += 360.0f; + } + + Math_SmoothStepToAngle(&actor->fwork[28], sp1D0, 0.2f, 5.0f, 0.0f); + Math_SmoothStepToAngle(&actor->fwork[29], sp1D8, 0.2f, 5.0f, 0.0f); + Math_SmoothStepToVec3fArray(sp68, actor->vwork, 1, sp4C, actor->fwork[15], 100.0f, 0.0f); + + if ((actor->unk_046 == 6) || (actor->unk_046 == 5)) { + Math_SmoothStepToF(&actor->fwork[15], 0.3f, 1.0f, 0.05f, 0.0f); + } else { + Math_SmoothStepToF(&actor->fwork[15], 0.2f, 1.0f, 0.015f, 0.0f); + } + Math_SmoothStepToF(&actor->fwork[19], 0.0f, 0.2f, 10.0f, 0.0f); + + if (actor->iwork[17] != 0) { + Math_SmoothStepToF(&actor->fwork[27], 1.5f, 1.0f, 0.2f, 0.0f); + } else { + Math_SmoothStepToF(&actor->fwork[27], 0.0f, 1.0f, 0.05f, 0.0f); + } + actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_603405C); + if (actor->unk_046 == 1) { + actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_603421C); + } + i = actor->iwork[17]; + if (i != 0) { + if (i == 1) { + actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_6034124); + } else if (i == 2) { + actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_60341A8); + } + } + if (actor->unk_046 == 2) { + actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_60340C0); + } + + if ((actor->unk_0D0 != 0) && (actor->unk_046 != 3)) { + + if (actor->unk_0D0 == 2) { + actor->unk_0D2 = 1; + } + actor->unk_0D0 = 0; + if (actor->unk_0D2 == 0) { + actor->iwork[18] = 15; + Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + + } else { + Audio_PlaySfx(0x2903300E, actor->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); + actor->timer_0C6 = 15; + func_8007C120(actor->unk_0D8.x, actor->unk_0D8.y, actor->unk_0D8.z, actor->vel.x, actor->vel.y, + actor->vel.z, 0.1f, 10); + actor->health -= actor->damage; + + if (actor->health <= 0) { + actor->unk_046 = 3; + actor->unk_048 = 0; + actor->unk_0B6 = 0; + actor->timer_0BE = 50; + actor->fwork[15] = 0.0f; + } + } + } +} static s32 D_i6_801A6B28[3] = { 255, 150, 150 }; static s32 D_i6_801A6B34[3] = { 150, 255, 150 };