From 9da16399089a23acee5544f6302b945d1f619096 Mon Sep 17 00:00:00 2001 From: Alejandro Javier Asenjo Nitti Date: Thu, 16 May 2024 11:05:21 -0300 Subject: [PATCH] fox_co spacing and generic vars --- src/overlays/ovl_i1/fox_co.c | 579 ++++++++++++++++++++++++++++++----- 1 file changed, 497 insertions(+), 82 deletions(-) diff --git a/src/overlays/ovl_i1/fox_co.c b/src/overlays/ovl_i1/fox_co.c index c3f5493e..cd7b7fa4 100644 --- a/src/overlays/ovl_i1/fox_co.c +++ b/src/overlays/ovl_i1/fox_co.c @@ -8,7 +8,6 @@ #include "assets/ast_arwing.h" #include "assets/ast_corneria.h" -// bss u8 D_i1_8019B6D0; f32 D_i1_8019B6D8[68]; @@ -16,7 +15,6 @@ void Corneria_80187530(Scenery* scenery) { } void Corneria_8018753C(Scenery* scenery) { - gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); gSPDisplayList(gMasterDisp++, D_CO_60199D0); gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); @@ -37,7 +35,6 @@ void Corneria_801875A4(Sprite* sprite) { void Corneria_80187670(Actor* actor, f32 xPos, f32 yPos, f32 zPos, f32 arg4, f32 xRot, f32 yRot, s32 arg7, s32 arg8, ObjectId objId) { - Actor_Initialize(actor); actor->obj.status = OBJ_INIT; actor->obj.id = objId; @@ -58,37 +55,40 @@ void Corneria_80187710(f32 xPos, f32 yPos, f32 zPos, f32 arg3, f32 xRot, f32 yRo for (i = 0; i < ARRAY_COUNT(gActors); i++) { if (gActors[i].obj.status == OBJ_FREE) { - (void) "Enms[1].obj.mode %d\n"; + PRINTF("Enms[1].obj.mode %d\n"); Corneria_80187670(&gActors[i], xPos, yPos, zPos, arg3, xRot, yRot, arg6, arg7, objId); return; } } } -void Corneria_801877A0(Boss* boss, f32 arg1, f32 arg2, f32 arg3) { - Vec3f sp2C; - Vec3f sp20; +void Corneria_801877A0(Boss* boss, f32 x, f32 y, f32 z) { + Vec3f src; + Vec3f dest; - sp2C.x = arg1; - sp2C.y = arg2; - sp2C.z = arg3; - Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp2C, &sp20); - func_effect_8007F11C(OBJ_EFFECT_353, boss->obj.pos.x + sp20.x, boss->obj.pos.y + sp20.y, boss->obj.pos.z + sp20.z, + src.x = x; + src.y = y; + src.z = z; + + Matrix_MultVec3fNoTranslate(gCalcMatrix, &src, &dest); + + func_effect_8007F11C(OBJ_EFFECT_353, boss->obj.pos.x + dest.x, boss->obj.pos.y + dest.y, boss->obj.pos.z + dest.z, 100.0f); } -void Corneria_80187838(s32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg4) { +// Maybe Corneria_SpawnItem +void Corneria_80187838(s32 arg0, f32 x, f32 y, f32 z, ObjectId item) { s32 i; for (i = 0; i < ARRAY_COUNT(gItems); i++) { if (gItems[i].obj.status == OBJ_FREE) { Item_Initialize(&gItems[i]); gItems[i].obj.status = OBJ_INIT; - gItems[i].obj.id = arg4; + gItems[i].obj.id = item; gItems[i].timer_4A = 8; - gItems[i].obj.pos.x = arg1; - gItems[i].obj.pos.y = arg2; - gItems[i].obj.pos.z = arg3; + gItems[i].obj.pos.x = x; + gItems[i].obj.pos.y = y; + gItems[i].obj.pos.z = z; Object_SetInfo(&gItems[i].info, gItems[i].obj.id); return; } @@ -99,6 +99,7 @@ void Corneria_Boss292_Init(Boss292* this) { s32 i; gBossFrameCount = 0; + if (gLevelMode == LEVELMODE_ON_RAILS) { if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) { gPlayer[0].state_1C8 = PLAYERSTATE_1C8_START_360; @@ -140,35 +141,47 @@ f32 Corneria_80187A88(s32 arg0) { void Corneria_80187AC8(Boss* boss) { Sprite* sprite; - s32 var_v0; + s32 item; s32 var_s1; s32 var_s1_2; if (boss->dmgType != DMG_NONE) { boss->dmgType = DMG_NONE; + if (boss->dmgPart == 0) { boss->swork[10] = 15; boss->swork[29] -= boss->damage; + Corneria_80187A38(boss, D_i1_8019B6D8[62], D_i1_8019B6D8[63], D_i1_8019B6D8[64], 0.2f, 20); + if (boss->swork[29] < 30) { func_effect_8007A6F0(&boss->obj.pos, NA_SE_EN_KNOCK_DOWN); } else { func_effect_8007A6F0(&boss->obj.pos, NA_SE_OB_DAMAGE_M); } + Radio_PlayMessage(gMsg_ID_2270, RCID_BOSS_CORNERIA); + if (boss->swork[29] <= 0) { boss->swork[10] = 1000; boss->info.hitbox[1 + 0] = 100000.0f; + Corneria_8018798C(boss, D_i1_8019B6D8[62], D_i1_8019B6D8[63], D_i1_8019B6D8[64], 10.0f); + AUDIO_PLAY_SFX(NA_SE_EN_DOWN_IMPACT, boss->sfxSource, 4); + gScreenFlashTimer = 8; + if (fabsf(boss->obj.rot.x) < 20.0f) { boss->swork[32] = 1; } + boss->state = 7; boss->timer_050 = 100; + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 80); SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 80); + gCsFrameCount = 0; if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || @@ -176,6 +189,7 @@ void Corneria_80187AC8(Boss* boss) { gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; gPlayer[0].csState = gPlayer[0].csTimer = 0; gPlayer[0].rot.y += gPlayer[0].yRot_114; + if (gPlayer[0].rot.y > 360.0f) { gPlayer[0].rot.y -= 360.0f; } @@ -184,8 +198,11 @@ void Corneria_80187AC8(Boss* boss) { } gPlayer[0].yRot_114 = 0.0f; } + Radio_PlayMessage(gMsg_ID_2280, RCID_BOSS_CORNERIA); + Boss_AwardBonus(boss); + gBossFrameCount = 100000; return; } @@ -193,9 +210,11 @@ void Corneria_80187AC8(Boss* boss) { boss->swork[3] = 15; boss->swork[20] = 30; boss->swork[28] -= boss->damage; + Corneria_801879F0(boss, D_i1_8019B6D8[12] + RAND_FLOAT_CENTERED(60.0f), D_i1_8019B6D8[13], D_i1_8019B6D8[14] + RAND_FLOAT_CENTERED(60.0f), 2.0f); Corneria_80187A38(boss, D_i1_8019B6D8[12], D_i1_8019B6D8[13], D_i1_8019B6D8[14], 0.1f, 20); + if (boss->swork[28] <= 0) { boss->swork[3] = 1000; boss->info.hitbox[1 + 18] = 100000.0f; @@ -211,6 +230,7 @@ void Corneria_80187AC8(Boss* boss) { Corneria_801879F0(boss, D_i1_8019B6D8[6] + RAND_FLOAT_CENTERED(60.0f), D_i1_8019B6D8[7], D_i1_8019B6D8[8] + RAND_FLOAT_CENTERED(60.0f), 2.0f); Corneria_80187A38(boss, D_i1_8019B6D8[6], D_i1_8019B6D8[7], D_i1_8019B6D8[8], 0.1f, 20); + if (boss->swork[26] <= 0) { boss->swork[2] = 1000; boss->info.hitbox[1 + 6] = 100000.0f; @@ -220,9 +240,11 @@ void Corneria_80187AC8(Boss* boss) { boss->swork[1] = 15; boss->swork[22] = 30; boss->swork[27] -= boss->damage; + Corneria_801879F0(boss, D_i1_8019B6D8[0] + RAND_FLOAT_CENTERED(60.0f), D_i1_8019B6D8[1], D_i1_8019B6D8[2] + RAND_FLOAT_CENTERED(60.0f), 2.0f); Corneria_80187A38(boss, D_i1_8019B6D8[0], D_i1_8019B6D8[1], D_i1_8019B6D8[2], 0.1f, 20); + if (boss->swork[27] <= 0) { boss->swork[1] = 1000; boss->info.hitbox[1 + 12] = 100000.0f; @@ -231,19 +253,23 @@ void Corneria_80187AC8(Boss* boss) { } else if ((boss->dmgPart == 4) || (boss->dmgPart == 5)) { AUDIO_PLAY_SFX(NA_SE_EN_DAMAGE_S, boss->sfxSource, 4); boss->swork[23] = 200; + if (boss->dmgPart == 4) { boss->swork[24] -= boss->damage; boss->swork[7] = boss->swork[8] = boss->swork[9] = 5; boss->swork[18] = 30; + if (boss->swork[24] <= 0) { boss->swork[7] = boss->swork[8] = boss->swork[9] = 1000; boss->info.hitbox[1 + 24] = 100000.0f; + for (var_s1 = 3; var_s1 < 6; var_s1++) { Boss_SpawnDebris(D_i1_8019B6D8[18 + var_s1 + 2], D_i1_8019B6D8[24 + var_s1 + 2], D_i1_8019B6D8[30 + var_s1 + 2], D_i1_8019B6D8[36 + var_s1 + 2], D_i1_8019B6D8[42 + var_s1 + 2], D_i1_8019B6D8[48 + var_s1 + 2], 0.0f, RAND_FLOAT(20.0f), 0.0f, 5.5f, var_s1 + 28, RAND_INT(30.0f) + 60.0f); } + if (boss->state < 5) { boss->state = 5; boss->timer_050 = 60; @@ -253,6 +279,7 @@ void Corneria_80187AC8(Boss* boss) { boss->swork[25] -= boss->damage; boss->swork[4] = boss->swork[5] = boss->swork[6] = 5; boss->swork[19] = 30; + if (boss->swork[25] <= 0) { boss->swork[4] = boss->swork[5] = boss->swork[6] = 1000; boss->info.hitbox[1 + 30] = 100000.0f; @@ -263,6 +290,7 @@ void Corneria_80187AC8(Boss* boss) { D_i1_8019B6D8[42 + var_s1 + 2], D_i1_8019B6D8[48 + var_s1 + 2], 0.0f, RAND_FLOAT(20.0f), 0.0f, 5.5f, var_s1 + 28, RAND_INT(30.0f) + 60.0f); } + if (boss->state < 5) { boss->state = 6; boss->timer_050 = 60; @@ -276,15 +304,18 @@ void Corneria_80187AC8(Boss* boss) { if ((boss->state != 0) && (boss->state < 5)) { boss->fwork[14] = 0.0f; + if (Rand_ZeroOne() < 0.5f) { - var_v0 = OBJ_ITEM_SILVER_RING; + item = OBJ_ITEM_SILVER_RING; } else { - var_v0 = OBJ_ITEM_BOMB; + item = OBJ_ITEM_BOMB; } - Corneria_80187838(boss, boss->obj.pos.x, boss->obj.pos.y + 100.0f, boss->obj.pos.z, var_v0); + Corneria_80187838(boss, boss->obj.pos.x, boss->obj.pos.y + 100.0f, boss->obj.pos.z, item); } + if (boss->state < 5) { boss->state = 0; + switch (RAND_INT(5.0f)) { case 0: boss->swork[31] = 2; @@ -305,9 +336,7 @@ void Corneria_80187AC8(Boss* boss) { } if (!(D_edisplay_801615D0.y < 0.0f)) { - - sprite = gSprites; - for (var_s1 = 0; var_s1 < ARRAY_COUNT(gSprites); var_s1++, sprite++) { + for (sprite = gSprites, var_s1 = 0; var_s1 < ARRAY_COUNT(gSprites); var_s1++, sprite++) { if ((sprite->obj.status == OBJ_ACTIVE) && (sprite->obj.id == OBJ_SPRITE_CO_TREE)) { if ((fabsf(sprite->obj.pos.x - D_i1_8019B6D8[20]) < 90.0f) && (fabsf(sprite->obj.pos.z - D_i1_8019B6D8[32]) < 90.0f)) { @@ -320,6 +349,7 @@ void Corneria_80187AC8(Boss* boss) { } } } + if ((boss->swork[1] == 1000) && ((gGameFrameCount % 4) == 0)) { func_effect_8007BFFC(D_i1_8019B6D8[3], D_i1_8019B6D8[4], D_i1_8019B6D8[5], (D_i1_8019B6D8[3] - boss->obj.pos.x) * 0.1f, 0.0f, @@ -344,6 +374,7 @@ void Corneria_80187AC8(Boss* boss) { ObjectId Corneria_80188750(Boss* boss) { boss->swork[35]++; + if (boss->swork[35] >= 5) { boss->swork[35] = 0; return OBJ_ACTOR_191; @@ -356,42 +387,49 @@ ObjectId Corneria_80188750(Boss* boss) { void Corneria_801887AC(Boss* boss) { Vec3f sp3C; - ObjectId sp38; + ObjectId objId; if ((gBossFrameCount < 500)) { return; } + switch (boss->swork[30]) { case 0: break; + case 1: - sp38 = Corneria_80188750(boss); - if (sp38 != 0) { + objId = Corneria_80188750(boss); + if (objId != 0) { if (boss->swork[1] != 1000) { Corneria_80187710(D_i1_8019B6D8[0], D_i1_8019B6D8[1], D_i1_8019B6D8[2], 65.0f, 0.0f, - D_i1_8019B6D8[16] + boss->obj.rot.y, 0, 0, sp38); + D_i1_8019B6D8[16] + boss->obj.rot.y, 0, 0, objId); } if (boss->swork[2] != 1000) { Corneria_80187710(D_i1_8019B6D8[6], D_i1_8019B6D8[7], D_i1_8019B6D8[8], 65.0f, 0.0f, - D_i1_8019B6D8[16] + boss->obj.rot.y, 0, 0, sp38); + D_i1_8019B6D8[16] + boss->obj.rot.y, 0, 0, objId); } } boss->swork[30] = 0; break; + case 2: Corneria_801877A0(boss, 40.0f, 228.0f, 212.0f); Corneria_801877A0(boss, -40.0f, 228.0f, 212.0f); boss->swork[30] = 0; break; + case 3: if (boss->swork[3] != 1000) { sp3C.x = gPlayer[0].pos.x; sp3C.y = gPlayer[0].pos.y; sp3C.z = gPlayer[0].trueZpos; + gPlayer[0].pos.x += RAND_FLOAT_CENTERED(300.0f); gPlayer[0].pos.y += RAND_FLOAT_CENTERED(300.0f); gPlayer[0].trueZpos += RAND_FLOAT_CENTERED(300.0f); + func_effect_8007F11C(OBJ_EFFECT_376, D_i1_8019B6D8[12], D_i1_8019B6D8[13], D_i1_8019B6D8[14], 60.0f); + gPlayer[0].pos.x = sp3C.x; gPlayer[0].pos.y = sp3C.y; gPlayer[0].trueZpos = sp3C.z; @@ -412,10 +450,12 @@ void Corneria_80188A18(Boss* boss) { case 1: boss->swork[31] = 1; break; + case 2: case 3: boss->swork[31] = 2; break; + case 4: if (D_edisplay_801615D0.y < 0.0f) { boss->swork[31] = 4; @@ -423,6 +463,7 @@ void Corneria_80188A18(Boss* boss) { boss->swork[31] = 3; } break; + case 5: case 6: case 7: @@ -438,6 +479,7 @@ void Corneria_80188A18(Boss* boss) { } } } + if ((gBossFrameCount > 800) && ((gBossFrameCount % 512) == 0)) { if (gCoUturnCount < 2) { Radio_PlayMessage(gMsg_ID_20237, RCID_PEPPY); @@ -469,9 +511,9 @@ void Corneria_80188C7C(Boss* boss) { void Corneria_80188D50(Boss* boss) { static s32 D_i1_801997E0 = 0; s32 i; - Vec3f sp48; - Vec3f sp3C; - s32 temp_ft3; + Vec3f src; + Vec3f dest; + s32 rnd; if (boss->swork[36] == 0) { if (gPlayer[0].hitTimer != 0) { @@ -485,16 +527,18 @@ void Corneria_80188D50(Boss* boss) { (fabsf(boss->obj.pos.z - gPlayer[0].trueZpos) < 200.0f) && (gPlayer[0].aerobaticPitch > 180.0f)) { boss->swork[36]++; D_i1_801997E0 = 20; + AUDIO_PLAY_SFX(NA_SE_RING_PASS, gDefaultSfxSource, 4); + if ((gTeamShields[TEAM_ID_FALCO] > 0) || (gTeamShields[TEAM_ID_SLIPPY] > 0) || (gTeamShields[TEAM_ID_PEPPY] > 0)) { - do { - do { - temp_ft3 = RAND_INT(2.9f) + 1; - } while (gTeamShields[temp_ft3] <= 0); - } while (0); + if (0) {}; - switch (temp_ft3) { + do { + rnd = RAND_INT(2.9f) + 1; + } while (gTeamShields[rnd] <= 0); + + switch (rnd) { case 1: Radio_PlayMessage(gMsg_ID_7100, RCID_FALCO); break; @@ -506,20 +550,26 @@ void Corneria_80188D50(Boss* boss) { break; } } + Matrix_RotateY(gCalcMatrix, (gPlayer[0].yRot_114 + gPlayer[0].rot.y) * M_DTOR, MTXF_NEW); - sp48.x = 0.0f; - sp48.y = 0.0f; - sp48.z = -2500.0f; - Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp48, &sp3C); + + src.x = 0.0f; + src.y = 0.0f; + src.z = -2500.0f; + + Matrix_MultVec3fNoTranslate(gCalcMatrix, &src, &dest); + for (i = 0; i < ARRAY_COUNT(gItems); i++) { if (gItems[i].obj.status == OBJ_FREE) { Item_Initialize(&gItems[i]); + gItems[i].obj.status = OBJ_INIT; gItems[i].obj.id = OBJ_ITEM_1UP; - gItems[i].obj.pos.x = gPlayer[0].pos.x + sp3C.x; + gItems[i].obj.pos.x = gPlayer[0].pos.x + dest.x; gItems[i].obj.pos.y = gPlayer[0].pos.y + 100.0f; - gItems[i].obj.pos.z = gPlayer[0].trueZpos + sp3C.z; + gItems[i].obj.pos.z = gPlayer[0].trueZpos + dest.z; gItems[i].timer_4A = 8; + Object_SetInfo(&gItems[i].info, gItems[i].obj.id); func_effect_8007B344(gItems[i].obj.pos.x, gItems[i].obj.pos.y, gItems[i].obj.pos.z, 5.0f, 0); break; @@ -552,25 +602,32 @@ void Corneria_80189058(Boss* boss) { gBossActive = 2; boss->drawShadow = true; + boss->swork[24] = 150; boss->swork[25] = 150; boss->swork[26] = 40; boss->swork[27] = 40; boss->swork[28] = 40; boss->swork[29] = 130; + boss->info.hitbox[1 + 0] = -241.0f; boss->info.hitbox[1 + 6] = 0.0f; boss->info.hitbox[1 + 12] = 0.0f; boss->info.hitbox[1 + 18] = 0.0f; boss->info.hitbox[1 + 24] = 0.0f; boss->info.hitbox[1 + 30] = 0.0f; + boss->timer_052 = 100; boss->state = 0; boss->swork[31] = 1; + D_i1_8019B6D8[66] = 0.0f; D_i1_8019B6D8[67] = 10000.0f; + boss->timer_050 = 30; + Animation_GetFrameData(&D_CO_602C0D0, 0, boss->vwork); + gBossFrameCount = 0; } gBossFrameCount++; @@ -581,7 +638,9 @@ void Corneria_80189058(Boss* boss) { gRadarMarks[59].pos.z = boss->obj.pos.z; gRadarMarks[59].yRot = boss->obj.rot.y + 180.0f; + Corneria_80188D50(boss); + if (D_edisplay_801615D0.z > 0.0f) { if (D_edisplay_801615D0.x > 0.0f) { gPlayer[0].flags_228 = PFLAG_228_4; @@ -621,13 +680,13 @@ void Corneria_80189058(Boss* boss) { } for (sp218 = 0; sp218 < 24; sp218++) { - if ((boss->swork[sp218] != 0) && (boss->swork[sp218] < 1000)) { boss->swork[sp218]--; } } Corneria_80187AC8(boss); + boss->fwork[0] = SIN_DEG(boss->swork[18] * 50.0f) * Corneria_80187A88(boss->swork[18]); boss->fwork[1] = SIN_DEG(boss->swork[19] * 50.0f) * Corneria_80187A88(boss->swork[19]); boss->fwork[2] = SIN_DEG(boss->swork[20] * 50.0f) * Corneria_80187A88(boss->swork[20]); @@ -638,12 +697,15 @@ void Corneria_80189058(Boss* boss) { sp5C = SIN_DEG(boss->swork[23] * 12.0f) * Corneria_80187A88(boss->swork[23]) * 0.3f; Math_SmoothStepToF(&boss->obj.rot.z, sp5C, 0.2f, 100.0f, 0.001f); } + if (boss->obj.pos.y <= 10.0f) { boss->obj.pos.y = 10.0f; } + sp214 = D_i1_8019B6D8[17] - boss->obj.pos.x; sp210 = D_i1_8019B6D8[18] - (boss->obj.pos.y + 300.0f); sp20C = D_i1_8019B6D8[19] - boss->obj.pos.z; + sp1FC = Math_RadToDeg(Math_Atan2F(sp214, sp20C)); sp204 = sqrtf((sp214 * sp214) + (sp20C * sp20C)); sp200 = Math_RadToDeg(-Math_Atan2F(sp210, sp204)); @@ -654,6 +716,7 @@ void Corneria_80189058(Boss* boss) { if ((sp200 < 310.0f) && (sp200 > 180.0f)) { sp200 = 310.0f; } + sp1FC -= boss->obj.rot.y; if (sp1FC > 360.0f) { sp1FC -= 360.0f; @@ -670,11 +733,13 @@ void Corneria_80189058(Boss* boss) { Math_SmoothStepToAngle(&D_i1_8019B6D8[16], sp1FC, 0.1f, 3.0f, 0.0f); Math_SmoothStepToAngle(&D_i1_8019B6D8[15], sp200, 0.1f, 3.0f, 0.0f); + if (boss->state != 0) { sp1F8 = Math_RadToDeg(Math_Atan2F(D_i1_8019B6D8[66] - boss->obj.pos.x, D_i1_8019B6D8[67] - boss->obj.pos.z)); Math_SmoothStepToAngle(&boss->obj.rot.y, sp1F8, 0.1f, 3.0f, 0.0f); } + Matrix_RotateY(gCalcMatrix, boss->obj.rot.y * M_DTOR, 0U); switch (boss->state) { @@ -683,6 +748,7 @@ void Corneria_80189058(Boss* boss) { D_i1_8019B6D8[17] = gPlayer[0].pos.x; D_i1_8019B6D8[18] = gPlayer[0].pos.y; D_i1_8019B6D8[19] = gPlayer[0].trueZpos; + if (boss->timer_050 == 0) { switch (boss->swork[31]) { case 1: @@ -690,6 +756,7 @@ void Corneria_80189058(Boss* boss) { boss->timer_050 = RAND_INT(50.0f) + 50; boss->fwork[14] = 0.0f; break; + case 2: boss->state = 2; boss->timer_050 = RAND_INT(100.0f) + 150; @@ -697,6 +764,7 @@ void Corneria_80189058(Boss* boss) { boss->timer_054 = 40; boss->fwork[14] = 0.07f; break; + case 4: boss->state = 4; boss->timer_050 = RAND_INT(70.0f) + 100; @@ -705,6 +773,7 @@ void Corneria_80189058(Boss* boss) { D_i1_8019B6D8[67] = RAND_FLOAT_CENTERED(6000.0f); boss->fwork[14] = 0.07f; break; + case 3: boss->state = 3; boss->timer_050 = RAND_INT(100.0f) + 150; @@ -712,12 +781,15 @@ void Corneria_80189058(Boss* boss) { break; } } + Animation_GetFrameData(&D_CO_602C0D0, boss->unk_04C, sp84); + if (boss->timer_052 == 0) { boss->timer_052 = 150; boss->swork[30] = 1; } break; + case 1: D_i1_8019B6D8[17] = D_i1_8019B6D8[66] = gPlayer[0].pos.x; D_i1_8019B6D8[18] = gPlayer[0].pos.y; @@ -727,14 +799,18 @@ void Corneria_80189058(Boss* boss) { if (boss->unk_04C >= Animation_GetFrameCount(&D_CO_602BC18)) { boss->unk_04C = 0; } + Animation_GetFrameData(&D_CO_602BC18, boss->unk_04C, sp84); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp1EC, &sp21C); + if (boss->timer_052 == 0) { boss->timer_052 = 150; boss->swork[30] = 1; } + Corneria_80188A18(boss); break; + case 2: D_i1_8019B6D8[17] = D_i1_8019B6D8[66] = gPlayer[0].pos.x; D_i1_8019B6D8[18] = gPlayer[0].pos.y; @@ -744,8 +820,10 @@ void Corneria_80189058(Boss* boss) { if (boss->unk_04C < 0) { boss->unk_04C = 100; } + Animation_GetFrameData(&D_CO_602BC18, boss->unk_04C, sp84); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp6C, &sp21C); + if (boss->timer_052 == 0) { boss->timer_052 = 30; boss->swork[30] = 2; @@ -754,8 +832,10 @@ void Corneria_80189058(Boss* boss) { boss->timer_054 = 9; boss->swork[30] = 3; } + Corneria_80188A18(boss); break; + case 3: D_i1_8019B6D8[17] = D_i1_8019B6D8[66] = gPlayer[0].pos.x; D_i1_8019B6D8[18] = gPlayer[0].pos.y; @@ -765,8 +845,10 @@ void Corneria_80189058(Boss* boss) { if (boss->unk_04C > 100) { boss->unk_04C = 0; } + Animation_GetFrameData(&D_CO_602BC18, boss->unk_04C, sp84); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp78, &sp21C); + if (boss->timer_052 == 0) { boss->timer_052 = 30; boss->swork[30] = 2; @@ -775,8 +857,10 @@ void Corneria_80189058(Boss* boss) { boss->timer_054 = 9; boss->swork[30] = 3; } + Corneria_80188A18(boss); break; + case 4: D_i1_8019B6D8[17] = gPlayer[0].pos.x; D_i1_8019B6D8[18] = gPlayer[0].pos.y; @@ -786,20 +870,26 @@ void Corneria_80189058(Boss* boss) { if (boss->unk_04C > 100) { boss->unk_04C = 0; } + Animation_GetFrameData(&D_CO_602BC18, boss->unk_04C, sp84); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp78, &sp21C); + Corneria_80188A18(boss); break; + case 5: case 6: boss->drawShadow = false; gGroundClipMode = 1; + if (((gGameFrameCount % 8) == 0)) { D_i1_8019B6D8[17] = gPlayer[0].pos.x + RAND_FLOAT_CENTERED(2000.0f); D_i1_8019B6D8[18] = gPlayer[0].pos.y; D_i1_8019B6D8[19] = gPlayer[0].trueZpos + RAND_FLOAT_CENTERED(2000.0f); } + boss->fwork[12] += 0.05f; + if (boss->state == 6) { boss->obj.rot.z += boss->fwork[12]; if (boss->obj.rot.z > 60.0f) { @@ -830,6 +920,7 @@ void Corneria_80189058(Boss* boss) { } boss->obj.rot.x = -boss->obj.rot.z; } + if (boss->timer_050 == 0) { ObjectId objId; @@ -843,12 +934,15 @@ void Corneria_80189058(Boss* boss) { } boss->yOffset = SIN_DEG(boss->obj.rot.z) * 30.0f; + if (((gGameFrameCount % 16) == 0)) { boss->unk_04C = RAND_INT(100.0f); } + Animation_GetFrameData(&D_CO_602BC18, boss->unk_04C, sp84); boss->fwork[14] = 0.03f; break; + case 7: if (boss->swork[32] != 0) { boss->fwork[12] += 0.05f; @@ -871,9 +965,11 @@ void Corneria_80189058(Boss* boss) { Object_Kill(&gEffects[sp218].obj, gEffects[sp218].sfxSource); } } + func_effect_8007A568(D_i1_8019B6D8[62], D_i1_8019B6D8[63] - 100.0f, D_i1_8019B6D8[64], 40.0f); func_effect_8007D0E0(D_i1_8019B6D8[62], D_i1_8019B6D8[63] - 100.0f, D_i1_8019B6D8[64], 30.0f); func_enmy_80062B60(D_i1_8019B6D8[62], D_i1_8019B6D8[64], 0, 120.0f); + gCameraShake = 25; gShowBossHealth = 0; @@ -883,6 +979,7 @@ void Corneria_80189058(Boss* boss) { D_i1_8019B6D8[64] + RAND_FLOAT_CENTERED(600.0f), 2.0f); } } + if (boss->timer_050 < 50) { boss->dmgPart = boss->timer_050 % 8U; @@ -892,6 +989,7 @@ void Corneria_80189058(Boss* boss) { boss->dmgType = DMG_BEAM; } break; + case 2: if (boss->swork[1] != 1000) { boss->dmgType = DMG_BEAM; @@ -901,6 +999,7 @@ void Corneria_80189058(Boss* boss) { boss->dmgType = DMG_BEAM; } break; + case 4: if (boss->swork[7] != 1000) { boss->dmgType = DMG_BEAM; @@ -912,18 +1011,23 @@ void Corneria_80189058(Boss* boss) { break; } } + if (boss->timer_050 == 0) { Object_Kill(&boss->obj, boss->sfxSource); } Animation_GetFrameData(&D_CO_602BC18, 0, sp84); break; + default: Animation_GetFrameData(&D_CO_602C0D0, boss->unk_04C, sp84); break; } + Math_SmoothStepToF(&boss->vel.x, sp21C.x, 0.3f, 5.0f, 0.0f); Math_SmoothStepToF(&boss->vel.z, sp21C.z, 0.3f, 5.0f, 0.0f); + Corneria_801887AC(boss); + Math_SmoothStepToVec3fArray(sp84, boss->vwork, 1, 19, boss->fwork[14], 100.0f, 0.0f); Math_SmoothStepToF(&boss->fwork[14], 1.0f, 1.0f, 0.01f, 0.0f); @@ -935,9 +1039,11 @@ void Corneria_80189058(Boss* boss) { D_i1_8019B6D8[67] = 0.0f; boss->swork[31] = 0; } + if ((boss->state != 0) && ((boss->unk_04C == 0) || (boss->unk_04C == 52))) { AUDIO_PLAY_SFX(NA_SE_EN_HEAVY_WALK, boss->sfxSource, 4); } + if (gPlayer[0].somersault && (boss->state != 0)) { boss->state = 0; boss->swork[31] = 1; @@ -956,54 +1062,65 @@ bool Corneria_8018A434(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* } RCP_SetupDL_29(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, 1001); + switch (limbIndex) { case 6: rot->x += boss->fwork[1]; rot->y += boss->fwork[1]; rot->y -= boss->fwork[13] * 0.6f; break; + case 5: rot->x -= boss->fwork[1]; rot->y -= boss->fwork[1]; rot->z += boss->fwork[1]; break; + case 4: rot->x += boss->fwork[1]; rot->y += boss->fwork[1]; rot->z -= boss->fwork[1]; break; + case 9: rot->x -= boss->fwork[0]; rot->y -= boss->fwork[0]; rot->y += boss->fwork[13]; break; + case 8: rot->x += boss->fwork[0]; rot->y += boss->fwork[0]; rot->z -= boss->fwork[0]; break; + case 7: rot->x -= boss->fwork[0]; rot->y -= boss->fwork[0]; rot->z += boss->fwork[0]; break; + case 3: rot->x += boss->fwork[2]; rot->y += boss->fwork[2]; rot->z += D_i1_8019B6D8[15]; break; + case 1: rot->x += boss->fwork[4] - D_i1_8019B6D8[15]; rot->y += boss->fwork[4]; break; + case 2: rot->x += boss->fwork[3] + D_i1_8019B6D8[15]; rot->y += boss->fwork[3]; break; + case 16: rot->x += D_i1_8019B6D8[16]; break; } + if (((boss->swork[limbIndex] % 2) != 0) || ((boss->timer_05C % 2) != 0)) { RCP_SetupDL_64(); gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 64, 64, 255, 255); @@ -1028,11 +1145,14 @@ void Corneria_8018A730(s32 limbIndex, Vec3f* rot, void* data) { D_i1_8019B6D8[limbIndex + 16] = sp74.x; D_i1_8019B6D8[limbIndex + 22] = sp74.y; D_i1_8019B6D8[limbIndex + 28] = sp74.z; + Matrix_GetYRPAngles(gCalcMatrix, &sp74); + D_i1_8019B6D8[limbIndex + 34] = sp74.x; D_i1_8019B6D8[limbIndex + 40] = sp74.y; D_i1_8019B6D8[limbIndex + 46] = sp74.z; } + switch (limbIndex) { case 1: Matrix_MultVec3f(gCalcMatrix, &sp68, &sp74); @@ -1044,6 +1164,7 @@ void Corneria_8018A730(s32 limbIndex, Vec3f* rot, void* data) { D_i1_8019B6D8[1] = sp74.y; D_i1_8019B6D8[2] = sp74.z; break; + case 2: Matrix_MultVec3f(gCalcMatrix, &sp68, &sp74); D_i1_8019B6D8[9] = sp74.x; @@ -1054,12 +1175,14 @@ void Corneria_8018A730(s32 limbIndex, Vec3f* rot, void* data) { D_i1_8019B6D8[7] = sp74.y; D_i1_8019B6D8[8] = sp74.z; break; + case 3: Matrix_MultVec3f(gCalcMatrix, &sp50, &sp74); D_i1_8019B6D8[12] = sp74.x; D_i1_8019B6D8[13] = sp74.y; D_i1_8019B6D8[14] = sp74.z; break; + case 17: Matrix_MultVec3f(gCalcMatrix, &sp44, &sp74); D_i1_8019B6D8[56] = sp74.x; @@ -1070,12 +1193,14 @@ void Corneria_8018A730(s32 limbIndex, Vec3f* rot, void* data) { D_i1_8019B6D8[60] = sp74.y; D_i1_8019B6D8[61] = sp74.z; break; + case 10: Matrix_MultVec3f(gCalcMatrix, &sp2C, &sp74); D_i1_8019B6D8[62] = sp74.x; D_i1_8019B6D8[63] = sp74.y; D_i1_8019B6D8[64] = sp74.z; break; + default: break; } @@ -1113,6 +1238,7 @@ s32 Corneria_8018AB64(Actor* actor) { sp7C.x = sp60[i] + actor->obj.pos.x; sp7C.y = actor->obj.pos.y; sp7C.z = sp50[i] + actor->obj.pos.z; + temp_v0 = Object_CheckCollision(actor->index, &sp7C, &sp70, 1); if ((temp_v0 != 0) && (temp_v0 >= 10)) { if ((gScenery[temp_v0 - 10].obj.status == OBJ_ACTIVE) && @@ -1125,15 +1251,16 @@ s32 Corneria_8018AB64(Actor* actor) { } void Corneria_8018ACE0(Actor* actor) { - if (actor->dmgType != DMG_NONE) { actor->dmgType = DMG_NONE; + if (actor->dmgPart == 0) { AUDIO_PLAY_SFX(NA_SE_OB_DAMAGE_M, actor->sfxSource, 4); func_effect_8007C120(actor->obj.pos.x, actor->obj.pos.y + 200.0f, actor->obj.pos.z, actor->vel.x, actor->vel.y, actor->vel.z, 0.1f, 20); actor->timer_0C6 = 15; actor->health -= actor->damage; + if (actor->health <= 0) { actor->obj.id = OBJ_ACTOR_179; Object_SetInfo(&actor->info, actor->obj.id); @@ -1144,6 +1271,7 @@ void Corneria_8018ACE0(Actor* actor) { } } } + if ((actor->health < 11) && ((gGameFrameCount % 4) == 0)) { func_effect_8007D2C8(actor->obj.pos.x + RAND_FLOAT_CENTERED(100.0f), actor->obj.pos.y + 200.0f + RAND_FLOAT_CENTERED(100.0f), @@ -1159,17 +1287,21 @@ void Corneria_8018AED0(Actor* actor) { f32 temp_cos; Corneria_8018ACE0(actor); + Math_SmoothStepToVec3fArray(sp40, actor->vwork, 0, Animation_GetFrameData(&D_CO_602991C, actor->animFrame, sp40), 1.0f, 1.0f, 1.0f); + temp_sin = SIN_DEG(actor->obj.rot.y); actor->vel.x = actor->fwork[0] * temp_sin; temp_cos = COS_DEG(actor->obj.rot.y); actor->vel.z = actor->fwork[0] * temp_cos; + switch (actor->state) { case 0: actor->fwork[1] += 20.0f; Texture_Scroll(D_CO_60329C0, 16, 16, 1); actor->animFrame = 0; + actor->fwork[0] += 1.0f; if (actor->fwork[0] > 10.0f) { actor->fwork[0] = 10.0f; @@ -1178,13 +1310,14 @@ void Corneria_8018AED0(Actor* actor) { actor->iwork[0] = Corneria_8018AB64(actor); if (actor->iwork[0] != 0) { actor->state++; - return; } - return; + break; + case 1: actor->animFrame++; actor->fwork[1] += 20.0f; actor->fwork[0] = 0.0f; + if (actor->animFrame == 50) { gScenery[actor->iwork[0] - 1].state = 1; } @@ -1192,6 +1325,7 @@ void Corneria_8018AED0(Actor* actor) { actor->state++; } break; + case 2: actor->animFrame = 0; actor->fwork[1] += 20.0f; @@ -1229,6 +1363,7 @@ void Corneria_8018B15C(Actor* actor) { Corneria_8018ACE0(actor); scenery = &gScenery[actor->iwork[0]]; + temp_sin = SIN_DEG(actor->obj.rot.y); actor->vel.x = actor->fwork[0] * temp_sin; temp_cos = COS_DEG(actor->obj.rot.y); @@ -1356,7 +1491,6 @@ void Corneria_8018B58C(Actor* actor) { } if (actor->timer_0BC == 0) { - for (i = 0; i < 4; i++) { Boss_SpawnDebris(actor->fwork[2 + i], actor->fwork[6 + i], actor->fwork[10 + i], 0.0f, 0.0f, 0.0f, @@ -1375,12 +1509,14 @@ void Corneria_8018B58C(Actor* actor) { actor->state = 101; actor->timer_0BE = 50; } + if (actor->timer_0BC == 8) { func_effect_8007BFFC(actor->obj.pos.x, actor->obj.pos.y + 200.0f, actor->obj.pos.z + 50.0f, 0.0f, 0.0f, 0.0f, 5.0f, 30); AUDIO_PLAY_SFX(NA_SE_EN_EXPLOSION_M, actor->sfxSource, 4); } break; + case 101: if ((actor->timer_0BE != 0) && ((gGameFrameCount % 2) == 0)) { func_effect_8007797C(actor->obj.pos.x, actor->obj.pos.y + 150.0f, actor->obj.pos.z, 0.0f, 10.0f, 0.0f, @@ -1429,31 +1565,35 @@ bool Corneria_8018BC50(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* void Corneria_8018BC84(s32 limbIndex, Vec3f* rot, void* data) { Actor* actor = (Actor*) data; - Vec3f sp28 = { 0.0f, 0.0f, 0.0f }; - Vec3f sp1C; + Vec3f src = { 0.0f, 0.0f, 0.0f }; + Vec3f dest; + + Matrix_MultVec3f(gCalcMatrix, &src, &dest); - Matrix_MultVec3f(gCalcMatrix, &sp28, &sp1C); switch (limbIndex) { case 1: - actor->fwork[2] = sp1C.x; - actor->fwork[6] = sp1C.y; - actor->fwork[10] = sp1C.z; - return; + actor->fwork[2] = dest.x; + actor->fwork[6] = dest.y; + actor->fwork[10] = dest.z; + break; + case 2: - actor->fwork[3] = sp1C.x; - actor->fwork[7] = sp1C.y; - actor->fwork[11] = sp1C.z; - return; + actor->fwork[3] = dest.x; + actor->fwork[7] = dest.y; + actor->fwork[11] = dest.z; + break; + case 3: - actor->fwork[4] = sp1C.x; - actor->fwork[8] = sp1C.y; - actor->fwork[12] = sp1C.z; - return; + actor->fwork[4] = dest.x; + actor->fwork[8] = dest.y; + actor->fwork[12] = dest.z; + break; + case 4: - actor->fwork[5] = sp1C.x; - actor->fwork[9] = sp1C.y; - actor->fwork[13] = sp1C.z; - return; + actor->fwork[5] = dest.x; + actor->fwork[9] = dest.y; + actor->fwork[13] = dest.z; + break; } } @@ -1461,14 +1601,14 @@ void Corneria_8018BD7C(Actor* actor) { Animation_DrawSkeleton(3, D_CO_6029A48, actor->vwork, Corneria_8018BC50, Corneria_8018BC84, actor, gCalcMatrix); } -void Corneria_8018BDD4(Boss* boss, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5, s32 arg6) { +void Corneria_8018BDD4(Boss* boss, f32 xPos, f32 yPos, f32 zPos, f32 arg4, s32 arg5, s32 arg6) { ObjectId objId = OBJ_ACTOR_191; if (func_hud_8008AC54(0) < 4) { objId = OBJ_ACTOR_190; } - Corneria_80187710(boss->obj.pos.x + arg1, boss->obj.pos.y + arg2, boss->obj.pos.z + arg3, arg4, boss->obj.rot.x, + Corneria_80187710(boss->obj.pos.x + xPos, boss->obj.pos.y + yPos, boss->obj.pos.z + zPos, arg4, boss->obj.rot.x, boss->obj.rot.y, arg5, arg6, objId); } @@ -1478,10 +1618,12 @@ void Corneria_Boss293_Init(Boss293* this) { gBossActive = 1; gBossFrameCount = 0; + this->drawShadow = true; this->timer_050 = 354; this->health = 601; this->fwork[18] = -gArwingSpeed - 10.0f; + if (fabsf(gPlayer[0].xPath) < 1.0f) { this->timer_05A = 30000; this->obj.pos.z = (gPlayer[0].cam.eye.z - gPathProgress) - 2000.0f; @@ -1569,9 +1711,11 @@ void Corneria_8018C19C(Boss* boss) { f32* temp_a1; gBossFrameCount++; + Matrix_RotateY(gCalcMatrix, boss->obj.rot.y * M_DTOR, MTXF_NEW); Matrix_RotateX(gCalcMatrix, boss->obj.rot.x * M_DTOR, MTXF_APPLY); Matrix_RotateZ(gCalcMatrix, boss->obj.rot.z * M_DTOR, MTXF_APPLY); + if (D_i1_8019B6D0 == 0) { if (boss->obj.pos.x > 6000.0f) { Object_Kill(&boss->obj, boss->sfxSource); @@ -1580,14 +1724,19 @@ void Corneria_8018C19C(Boss* boss) { } return; } + sp78.x = 0.0f; sp78.y = 0.0f; sp78.z = 60.0f; + Matrix_MultVec3f(gCalcMatrix, &sp78, &sp6C); + boss->vel.x = sp6C.x; boss->vel.y = sp6C.y; boss->vel.z = sp6C.z - gPathVelZ; + boss->fwork[16] = 4.0f; + if (((gGameFrameCount % 2) == 0)) { Matrix_MultVec3f(gCalcMatrix, &D_i1_80199914[0], &sp84[6]); Matrix_MultVec3f(gCalcMatrix, &D_i1_80199914[1], &sp84[7]); @@ -1631,6 +1780,7 @@ void Corneria_8018C19C(Boss* boss) { } } } + if (boss->dmgType != DMG_NONE) { boss->dmgType = DMG_NONE; if ((gBosses[1].state != 0) && (gBosses[2].state != 0) && (gBosses[3].state != 0)) { @@ -1648,32 +1798,40 @@ void Corneria_8018C19C(Boss* boss) { AUDIO_PLAY_SFX(NA_SE_EN_REFLECT, boss->sfxSource, 4); } } + boss->vel.z = boss->fwork[18]; + if (boss->state > 0) { boss->fwork[3] = (gPlayer[0].cam.eye.z - gPathProgress) - 2500.0f; } + if (boss->state != 7) { Math_SmoothStepToF(&boss->fwork[4], boss->fwork[5], 0.1f, 2.0f, 0.00001f); Math_SmoothStepToF(&boss->obj.pos.z, boss->fwork[3], 0.1f, boss->fwork[4], 0.00001f); } + Math_SmoothStepToF(&boss->obj.pos.y, boss->fwork[6], 0.02f, 2.0f, 0.00001f); Math_SmoothStepToAngle(&boss->fwork[0], boss->fwork[9], 0.2f, 5.0f, 0.00001f); Math_SmoothStepToAngle(&boss->fwork[1], boss->fwork[10], 0.2f, 5.0f, 0.00001f); Math_SmoothStepToAngle(&boss->fwork[2], boss->fwork[11], 0.2f, 5.0f, 0.00001f); + if (boss->state < 6) { Math_SmoothStepToAngle(&boss->obj.rot.y, boss->fwork[13], 0.03f, boss->fwork[8], 0.00001f); Math_SmoothStepToF(&boss->fwork[8], boss->fwork[12], 0.1f, 0.02f, 0.001f); Math_SmoothStepToAngle(&boss->obj.rot.z, boss->fwork[14], 0.03f, boss->fwork[15], 0.00001f); + if (boss->timer_056 == 1) { boss->fwork[14] = 0.0f; boss->fwork[15] = 0.5f; } } + if ((gBosses[1].state != 0) && ((gGameFrameCount % 16) == 0)) { Matrix_MultVec3f(gCalcMatrix, &D_i1_80199908, &sp84[5]); func_effect_8007D0E0(gBosses[0].obj.pos.x + sp84[5].x, gBosses[0].obj.pos.y + sp84[5].y, gBosses[0].obj.pos.z + sp84[5].z, 5.0f); } + if (gBosses[2].state != 0) { gBosses[3].drawShadow = true; if (gBosses[3].state != 0) { @@ -1688,6 +1846,7 @@ void Corneria_8018C19C(Boss* boss) { gBosses[0].obj.pos.z + sp84[9].z, 5.0f); } } + if ((gBosses[3].state != 0) && (gBosses[2].state == 0) && ((gGameFrameCount % 16) == 0)) { Matrix_MultVec3f(gCalcMatrix, &D_i1_80199944, &sp84[10]); func_effect_8007D0E0(gBosses[0].obj.pos.x + sp84[10].x, gBosses[0].obj.pos.y + sp84[10].y, @@ -1698,6 +1857,7 @@ void Corneria_8018C19C(Boss* boss) { Matrix_MultVec3f(gCalcMatrix, &D_i1_80199914[0], &sp84[6]); Matrix_MultVec3f(gCalcMatrix, &D_i1_80199914[1], &sp84[7]); Matrix_MultVec3f(gCalcMatrix, &D_i1_8019992C, &sp84[8]); + func_effect_8007BC7C(sp84[6].x + boss->obj.pos.x, sp84[6].y + boss->obj.pos.y, sp84[6].z + boss->obj.pos.z, 20.0f); func_effect_8007BC7C(sp84[7].x + boss->obj.pos.x, sp84[7].y + boss->obj.pos.y, sp84[7].z + boss->obj.pos.z, @@ -1705,6 +1865,7 @@ void Corneria_8018C19C(Boss* boss) { func_effect_8007BC7C(sp84[8].x + boss->obj.pos.x, sp84[8].y + boss->obj.pos.y, sp84[8].z + boss->obj.pos.z, 10.0f); } + if (boss->timer_052 != 0) { Math_SmoothStepToF(&D_ctx_801779A8[0], 50.0f, 1.0f, 1.6f, 0.0001f); } @@ -1712,15 +1873,18 @@ void Corneria_8018C19C(Boss* boss) { switch (boss->state) { case 0: boss->fwork[3] = gPlayer[0].trueZpos + 1500.0f; + if (boss->timer_050 == 350) { SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 40); SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 40); Radio_PlayMessage(gMsg_ID_2290, RCID_BOSS_CORNERIA2); } + if (boss->timer_050 == 180) { Radio_PlayMessage(gMsg_ID_2298, RCID_PEPPY); boss->timer_052 = 350; } + if (boss->timer_050 == 0) { boss->obj.pos.y = 900.0f; boss->state = 1; @@ -1733,6 +1897,7 @@ void Corneria_8018C19C(Boss* boss) { boss->timer_050 = 40; } break; + case 1: if (boss->timer_050 == 0) { boss->state = 2; @@ -1741,6 +1906,7 @@ void Corneria_8018C19C(Boss* boss) { boss->timer_050 = 250; } break; + case 2: if (boss->timer_050 == 0) { boss->state = 3; @@ -1752,12 +1918,14 @@ void Corneria_8018C19C(Boss* boss) { boss->swork[4]++; } break; + case 3: boss->fwork[12] = 1.5f; boss->fwork[11] = 0.0f; boss->fwork[9] = 0.0f; boss->fwork[10] = 0.0f; boss->fwork[13] = 0.0f; + if (boss->timer_050 == 0) { boss->state = boss->swork[0]; boss->timer_050 = 60; @@ -1765,43 +1933,53 @@ void Corneria_8018C19C(Boss* boss) { AUDIO_PLAY_SFX(NA_SE_EN_HATCH, boss->sfxSource, 4); } break; + case 4: boss->fwork[11] = 120.0f; boss->fwork[13] = 340.0f; + if ((boss->timer_050 == 0) || (gBosses[1].state != 0)) { boss->state = 3; boss->swork[0] = 5; boss->timer_050 = 20; boss->fwork[8] = 0.0f; + if (gBosses[1].state == 0) { AUDIO_PLAY_SFX(NA_SE_EN_HATCH, boss->sfxSource, 4); } + if ((boss->swork[5] == 0) && ((gBosses[2].state == 0) || (gBosses[3].state == 0))) { Radio_PlayMessage(gMsg_ID_2292, RCID_BOSS_CORNERIA2); } + boss->swork[5]++; boss->swork[5] &= 3; + } else if ((boss->fwork[2] > 60.0f) && (boss->timer_054 == 0)) { boss->timer_054 = 20; Corneria_8018BDD4(boss, sp84[0].x, sp84[0].y, sp84[0].z, 30.0f, 0, 1); } break; + case 5: boss->fwork[9] = 120.0f; boss->fwork[10] = 120.0f; boss->fwork[13] = 20.0f; + if ((boss->fwork[0] > 60.0f) && (gBosses[2].state == 0) && (boss->swork[1] == 0)) { Corneria_8018BDD4(boss, sp84[1].x, sp84[1].y + 50.0f, sp84[1].z, 45.0f, 0, 0); AUDIO_PLAY_SFX(NA_SE_EN_BARREL_SHOT, boss->sfxSource, 4); Corneria_8018BDD4(boss, sp84[1].x, sp84[1].y - 50.0f, sp84[1].z, 40.0f, 0, 0); boss->swork[1] = 1; } + if ((boss->fwork[1] > 60.0f) && (gBosses[3].state == 0) && (boss->swork[2] == 0)) { Corneria_8018BDD4(boss, sp84[2].x, sp84[2].y + 50.0f, sp84[2].z, 35.0f, 0, 0); AUDIO_PLAY_SFX(NA_SE_EN_BARREL_SHOT, boss->sfxSource, 4); Corneria_8018BDD4(boss, sp84[2].x, sp84[2].y - 50.0f, sp84[2].z, 30.0f, 0, 0); boss->swork[2] = 1; } + if ((boss->timer_050 == 0) || ((gBosses[3].state != 0) && (gBosses[2].state != 0))) { boss->state = 3; boss->swork[0] = 4; @@ -1809,24 +1987,30 @@ void Corneria_8018C19C(Boss* boss) { boss->swork[1] = 0; boss->swork[2] = 0; boss->fwork[8] = 0.0f; + if ((boss->swork[4] == 0) && (gBosses[1].state == 0)) { Radio_PlayMessage(gMsg_ID_2291, RCID_BOSS_CORNERIA2); } + if ((boss->swork[4] == 2) && (boss->swork[7] == 0) && ((gBosses[3].state == 0) || (gBosses[2].state == 0) || (gBosses[1].state == 0))) { Radio_PlayMessage(gMsg_ID_2299, RCID_PEPPY); boss->swork[7]++; } + boss->swork[4]++; boss->swork[4] &= 3; + if ((gBosses[3].state == 0) && (gBosses[2].state == 0)) { AUDIO_PLAY_SFX(NA_SE_EN_HATCH, boss->sfxSource, 4); } } break; + case 6: Math_SmoothStepToAngle(&boss->obj.rot.y, boss->fwork[13], 0.1f, 5.0f, 0.01f); Math_SmoothStepToAngle(&boss->obj.rot.z, boss->fwork[14], 0.1f, 5.0f, 0.01f); + if ((boss->obj.rot.y == 0.0f) || (boss->timer_058 == 0)) { boss->timer_058 = 0; boss->state = 7; @@ -1834,11 +2018,12 @@ void Corneria_8018C19C(Boss* boss) { boss->obj.rot.y = 0.0f; } break; + case 7: boss->fwork[3] = (gPlayer[0].cam.eye.z - gPathProgress) - 4000.0f; Math_SmoothStepToF(&boss->obj.pos.z, boss->fwork[3], 0.1f, 15.0f, 0.00001f); - if (boss->timer_058 == 0) { + if (boss->timer_058 == 0) { boss->timer_058 = D_i1_80199A4C[boss->swork[3]]; boss->fwork[20] = D_i1_80199A5C[boss->swork[3]]; boss->swork[3]++; @@ -1852,7 +2037,6 @@ void Corneria_8018C19C(Boss* boss) { } if ((boss->swork[3] == 0) || (boss->swork[3] == 2)) { - if ((boss->obj.rot.y < 20.0f) && (boss->obj.rot.y > -20.0f)) { if (boss->swork[9] == 0) { boss->swork[9]++; @@ -1863,12 +2047,13 @@ void Corneria_8018C19C(Boss* boss) { boss->swork[6]++; boss->swork[6] &= 1; } + if (((gGameFrameCount % 8) == 0)) { if (fabsf(boss->obj.pos.z - gPlayer[0].trueZpos) > 700.0f) { Matrix_MultVec3f(gCalcMatrix, &D_i1_801998F0[0], &sp84[3]); - effect = gEffects; - for (i = 0; i < ARRAY_COUNT(gEffects); i++, effect++) { + + for (effect = gEffects, i = 0; i < ARRAY_COUNT(gEffects); i++, effect++) { if (effect->obj.status == OBJ_FREE) { Effect_Initialize(effect); effect->obj.status = OBJ_INIT; @@ -1892,14 +2077,20 @@ void Corneria_8018C19C(Boss* boss) { } } } + if (boss->health < 2) { gTeamLowHealthMsgTimer = -1; + Audio_KillSfxBySourceAndId(boss->sfxSource, NA_SE_EN_ZOBOSS_BEAM); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 40); SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 40); + AUDIO_PLAY_SFX(NA_SE_EN_DOWN_IMPACT, boss->sfxSource, 4); + gScreenFlashTimer = 8; gShowBossHealth = false; + Radio_PlayMessage(gMsg_ID_2294, RCID_BOSS_CORNERIA2); boss->health = 1; boss->timer_056 = 150; @@ -1908,6 +2099,7 @@ void Corneria_8018C19C(Boss* boss) { } else { Math_SmoothStepToF(&boss->fwork[8], 3.0f, 0.1f, 0.5f, 0.001f); Math_SmoothStepToAngle(&boss->obj.rot.z, boss->fwork[14], 0.1f, 3.0f, 0.00001f); + temp_fv0_2 = Math_SmoothStepToF(&boss->obj.rot.y, boss->fwork[20], 0.1f, boss->fwork[8], 0.00001f); boss->fwork[14] = 0.0f; if (temp_fv0_2 < -1.0f) { @@ -1916,27 +2108,34 @@ void Corneria_8018C19C(Boss* boss) { if (temp_fv0_2 > 1.0f) { boss->fwork[14] = 335.0f; } + sp78.x = 0.0f; sp78.y = 0.0f; sp78.z = 40.0f; + Matrix_MultVec3f(gCalcMatrix, &sp78, &sp6C); + boss->vel.x = sp6C.x; boss->vel.y = sp6C.y; boss->vel.z = sp6C.z - gPathVelZ; } break; + case 8: D_ctx_801779A8[0] = 20.0f; + if (((gGameFrameCount % 32) == 0)) { for (i = 0; i < 10; i++) { func_effect_80079618(RAND_FLOAT_CENTERED(300.0f) + boss->obj.pos.x, boss->obj.pos.y, boss->obj.pos.z, 1.0f); } } + Math_SmoothStepToF(&boss->obj.pos.x, boss->fwork[7], 1.0f, 10.0f, 0.00001f); Math_SmoothStepToF(&boss->vel.x, 0.0f, 0.1f, 2.0f, 0.00001f); Math_SmoothStepToF(&boss->vel.y, 0.0f, 0.1f, 2.0f, 0.00001f); Math_SmoothStepToF(&boss->vel.z, 0.0f, 0.1f, 2.0f, 0.00001f); + if (boss->obj.rot.z == boss->fwork[14]) { if (boss->fwork[14] == boss->fwork[19]) { boss->fwork[14] = 360.0f - boss->fwork[19]; @@ -1944,17 +2143,21 @@ void Corneria_8018C19C(Boss* boss) { boss->fwork[14] = boss->fwork[19]; } } + Math_SmoothStepToAngle(&boss->obj.rot.z, boss->fwork[14], 1.0f, 1.0f, 0.001f); + if (boss->health != 0) { if (boss->timer_056 == 0) { Boss_AwardBonus(boss); boss->fwork[17] = 10.0f; boss->vel.y *= 1.5f; gMissionStatus = MISSION_ACCOMPLISHED; + if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN)) { Boss_CompleteLevel(gPlayer, boss->obj.pos.x, boss->obj.pos.y, boss->obj.pos.z); } + boss->health--; boss->fwork[8] = 0.0f; Radio_PlayMessage(gMsg_ID_2296, RCID_BOSS_CORNERIA2); @@ -1975,6 +2178,7 @@ void Corneria_8018C19C(Boss* boss) { boss->state = 9; } break; + case 9: if (((gGameFrameCount % 16) == 0)) { for (i = 0; i < 10; i++) { @@ -1985,8 +2189,10 @@ void Corneria_8018C19C(Boss* boss) { Math_SmoothStepToF(&boss->vel.x, 0.0f, 0.1f, 2.0f, 0.00001f); Math_SmoothStepToF(&boss->vel.y, 0.0f, 0.1f, 2.0f, 0.00001f); Math_SmoothStepToF(&boss->vel.z, 0.0f, 0.1f, 2.0f, 0.00001f); + boss->obj.rot.z -= 2.0f; boss->gravity = 1.0f; + if (boss->obj.pos.y < (gGroundHeight + 150.0f)) { gCameraShake = 100; func_effect_80081A8C(boss->obj.pos.x, boss->obj.pos.y, boss->obj.pos.z, 40.0f, 12); @@ -1998,6 +2204,7 @@ void Corneria_8018C19C(Boss* boss) { boss->state = 10; } break; + case 10: if (((gGameFrameCount % 8) == 0)) { for (i = 0; i < 10; i++) { @@ -2005,27 +2212,33 @@ void Corneria_8018C19C(Boss* boss) { boss->obj.pos.z, 1.0f); } } + if (boss->timer_050 == 0) { func_effect_8007A568(boss->obj.pos.x, boss->obj.pos.y + 500.0f, boss->obj.pos.z, 120.0f); Object_Kill(&boss->obj, boss->sfxSource); } break; } + temp_a0 = SEGMENTED_TO_VIRTUAL(D_CO_603E748); temp_a1 = SEGMENTED_TO_VIRTUAL(D_CO_603E7C4); temp_a0[9] = -100000.0f; temp_a0[3] = 172.0f; temp_a1[9] = -100000.0f; temp_a1[3] = -150.0f; + if (boss->fwork[0] > 60.0f) { temp_a0[3] = -100000.0f; temp_a0[9] = 543.0f; } + if (boss->fwork[1] > 60.0f) { temp_a1[3] = -100000.0f; temp_a1[9] = -557.0f; } + boss->fwork[16] = 4.0f; + if ((boss->swork[10] == 0) && (boss->state < 6)) { boss->fwork[17] = 1.8f; AUDIO_PLAY_SFX(NA_SE_EXPLOSION_DEMO6, boss->sfxSource, 4); @@ -2074,10 +2287,14 @@ void Corneria_8018DDAC(Boss* boss) { } else { Radio_PlayMessage(gMsg_ID_7085, RCID_FALCO); } + boss->info.cullDistance = 300.0f; + gBosses[0].fwork[14] = 25.0f; gBosses[0].fwork[15] = 0.0f; + AUDIO_PLAY_SFX(NA_SE_EN_PARTS_BROKEN, boss->sfxSource, 4); + if (gBosses[0].swork[10] != 0) { gBosses[0].swork[10]--; } @@ -2103,15 +2320,20 @@ void Corneria_8018DDAC(Boss* boss) { boss->obj.rot.x = gBosses[0].obj.rot.x; boss->obj.rot.y = gBosses[0].obj.rot.y; boss->obj.rot.z = gBosses[0].obj.rot.z; + Matrix_RotateY(gCalcMatrix, boss->obj.rot.y * M_DTOR, MTXF_NEW); Matrix_RotateX(gCalcMatrix, boss->obj.rot.x * M_DTOR, MTXF_APPLY); Matrix_RotateZ(gCalcMatrix, boss->obj.rot.z * M_DTOR, MTXF_APPLY); + Matrix_MultVec3f(gCalcMatrix, &D_i1_80199A78, &sp40); + boss->obj.pos.x = gBosses[0].obj.pos.x + sp40.x; boss->obj.pos.y = gBosses[0].obj.pos.y + sp40.y; boss->obj.pos.z = gBosses[0].obj.pos.z + sp40.z; + boss->fwork[2] = gBosses[0].fwork[2]; break; + case 1: Matrix_RotateZ(gCalcMatrix, boss->obj.rot.z * M_DTOR, MTXF_NEW); gBosses[0].fwork[15] += 0.5f; @@ -2159,29 +2381,40 @@ void Corneria_8018E290(Boss* boss) { if (boss->health != 0) { boss->timer_05C = 15; boss->health -= boss->damage; + AUDIO_PLAY_SFX(NA_SE_OB_DAMAGE_M, boss->sfxSource, 4); + if (boss->health <= 0) { gBosses[0].swork[8]--; + if (gBosses[0].swork[8] != 0) { Radio_PlayMessage(gMsg_ID_15130, RCID_FALCO); } else { Radio_PlayMessage(gMsg_ID_7085, RCID_FALCO); } + boss->info.cullDistance = 300.0f; + gBosses[0].fwork[15] = 0.0f; gBosses[0].fwork[14] = 335.0f; boss->health = 0; + AUDIO_PLAY_SFX(NA_SE_EN_PARTS_BROKEN, boss->sfxSource, 4); + if (gBosses[0].swork[10] != 0) { gBosses[0].swork[10]--; } + gBosses[0].timer_056 = 30; boss->state = 1; + Matrix_MultVec3f(gCalcMatrix, &D_i1_80199A84, &sp4C); + for (i = 0; i < 10; i++) { func_effect_80079618(boss->obj.pos.x + sp4C.x, boss->obj.pos.y + sp4C.y, boss->obj.pos.z + sp4C.z, 1.0f); } + if (gBosses[1].state == 1) { gBosses[0].fwork[14] = 25.0f; } @@ -2195,15 +2428,20 @@ void Corneria_8018E290(Boss* boss) { boss->obj.rot.x = gBosses[0].obj.rot.x; boss->obj.rot.y = gBosses[0].obj.rot.y; boss->obj.rot.z = gBosses[0].obj.rot.z; + Matrix_RotateY(gCalcMatrix, boss->obj.rot.y * M_DTOR, MTXF_NEW); Matrix_RotateX(gCalcMatrix, boss->obj.rot.x * M_DTOR, MTXF_APPLY); Matrix_RotateZ(gCalcMatrix, boss->obj.rot.z * M_DTOR, MTXF_APPLY); + Matrix_MultVec3f(gCalcMatrix, &D_i1_80199A90, &sp40); + boss->obj.pos.x = gBosses[0].obj.pos.x + sp40.x; boss->obj.pos.y = gBosses[0].obj.pos.y + sp40.y; boss->obj.pos.z = gBosses[0].obj.pos.z + sp40.z; + boss->fwork[0] = gBosses[0].fwork[0]; break; + case 1: Matrix_RotateZ(gCalcMatrix, boss->obj.rot.z * M_DTOR, MTXF_NEW); gBosses[0].fwork[15] += 0.5f; @@ -2251,7 +2489,9 @@ void Corneria_8018E76C(Boss* boss) { if (boss->health != 0) { boss->timer_05C = 15; boss->health -= boss->damage; + AUDIO_PLAY_SFX(NA_SE_OB_DAMAGE_M, boss->sfxSource, 4); + if (boss->health <= 0) { gBosses[0].swork[8]--; if (gBosses[0].swork[8] != 0) { @@ -2259,17 +2499,24 @@ void Corneria_8018E76C(Boss* boss) { } else { Radio_PlayMessage(gMsg_ID_7085, RCID_FALCO); } + boss->info.cullDistance = 300.0f; + gBosses[0].fwork[15] = 0.0f; gBosses[0].fwork[14] = 335.0f; + boss->health = 0; + AUDIO_PLAY_SFX(NA_SE_EN_PARTS_BROKEN, boss->sfxSource, 4); + if (gBosses[0].swork[10] != 0) { gBosses[0].swork[10]--; } + gBosses[0].timer_056 = 30; boss->state = 1; gBosses[0].fwork[6] = 500.0f; + Matrix_MultVec3f(gCalcMatrix, &D_i1_80199A9C, &sp4C); for (i = 0; i < 10; i++) { @@ -2290,26 +2537,35 @@ void Corneria_8018E76C(Boss* boss) { boss->obj.rot.x = gBosses[0].obj.rot.x; boss->obj.rot.y = gBosses[0].obj.rot.y; boss->obj.rot.z = gBosses[0].obj.rot.z; + Matrix_RotateY(gCalcMatrix, boss->obj.rot.y * M_DTOR, MTXF_NEW); Matrix_RotateX(gCalcMatrix, boss->obj.rot.x * M_DTOR, MTXF_APPLY); Matrix_RotateZ(gCalcMatrix, boss->obj.rot.z * M_DTOR, MTXF_APPLY); + Matrix_MultVec3f(gCalcMatrix, &D_i1_80199AA8, &sp40); + boss->obj.pos.x = gBosses[0].obj.pos.x + sp40.x; boss->obj.pos.y = gBosses[0].obj.pos.y + sp40.y; boss->obj.pos.z = gBosses[0].obj.pos.z + sp40.z; + boss->fwork[1] = gBosses[0].fwork[1]; break; + case 1: Matrix_RotateZ(gCalcMatrix, boss->obj.rot.z * M_DTOR, MTXF_NEW); + gBosses[0].fwork[15] += 0.5f; + if (((gGameFrameCount % 8) == 0) && (Rand_ZeroOne() < 0.5f)) { boss->timer_05C = 4; } + if (((gGameFrameCount % 2) == 0)) { Matrix_MultVec3f(gCalcMatrix, &D_i1_80199A9C, &sp4C); func_effect_8007C120(boss->obj.pos.x + sp4C.x, boss->obj.pos.y + sp4C.y, boss->obj.pos.z + sp4C.z, boss->vel.x, boss->vel.y, boss->vel.z, 0.2f, 10); } + if (boss->obj.pos.y < (gGroundHeight + 150.0f)) { if (boss->swork[0] == 0) { boss->vel.y = -5.0f; @@ -2337,7 +2593,6 @@ bool Corneria_8018EC54(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* } void Corneria_8018ECAC(Boss* boss) { - Animation_GetFrameData(&D_CO_602D400, 0, boss->vwork); Animation_DrawSkeleton(1, D_CO_602D5AC, boss->vwork, Corneria_8018EC54, NULL, &boss->index, &gIdentityMatrix); } @@ -2353,7 +2608,6 @@ bool Corneria_8018ED1C(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* } void Corneria_8018ED78(Boss* boss) { - Matrix_Translate(gGfxMatrix, -D_i1_80199A78.x, -D_i1_80199A78.y, 0.0f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); Animation_GetFrameData(&D_CO_602D400, 0, boss->vwork); @@ -2371,7 +2625,6 @@ bool Corneria_8018EE2C(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* } void Corneria_8018EE84(Boss* boss) { - Matrix_Translate(gGfxMatrix, -D_i1_80199A90.x, -D_i1_80199A90.y, 0.0f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); Animation_GetFrameData(&D_CO_602D400, 0, boss->vwork); @@ -2389,7 +2642,6 @@ bool Corneria_8018EF38(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* } void Corneria_8018EF90(Boss* boss) { - Matrix_Translate(gGfxMatrix, -D_i1_80199AA8.x, -D_i1_80199AA8.y, 0.0f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); Animation_GetFrameData(&D_CO_602D400, 0, boss->vwork); @@ -2397,7 +2649,6 @@ void Corneria_8018EF90(Boss* boss) { } void Corneria_8018F044(Scenery* scenery) { - switch (scenery->state) { case 0: if (scenery->dmgType != DMG_NONE) { @@ -2417,6 +2668,7 @@ void Corneria_8018F044(Scenery* scenery) { } } break; + case 1: Math_SmoothStepToF(&scenery->vel.x, 80.0f, 0.2f, 10.0f, 0.0f); Math_SmoothStepToF(&scenery->vel.y, 80.0f, 0.2f, 10.0f, 0.0f); @@ -2428,6 +2680,7 @@ bool Corneria_8018F1C8(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* Scenery* scenery = (Scenery*) data; RCP_SetupDL_29(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); + switch (limbIndex) { case 1: rot->y -= scenery->vel.x; @@ -2435,6 +2688,7 @@ bool Corneria_8018F1C8(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* RCP_SetupDL_60(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); } break; + case 2: rot->y += scenery->vel.y; if ((scenery->timer_4C % 2) != 0) { @@ -2455,12 +2709,15 @@ void Corneria_8018F31C(Scenery* scenery) { void Corneria_8018F3BC(Scenery* scenery, f32 arg1) { Scenery_Initialize(scenery); + scenery->obj.status = OBJ_INIT; scenery->obj.pos.x = RAND_FLOAT_CENTERED(1000.0f) + arg1; scenery->obj.rot.y = RAND_FLOAT(90.0f) + 45.0f; + if (arg1 > 0.0f) { scenery->obj.rot.y *= -1.0f; } + scenery->obj.pos.y = 0.0f; scenery->obj.id = OBJ_SCENERY_1; scenery->effectVel.z = 60.0f; @@ -2501,9 +2758,11 @@ void Corneria_8018F55C(Effect* effect) { effect->obj.pos.z = -4000.0f; effect->vel.z = 60.0f; effect->scale2 = 10.0f + RAND_FLOAT(15.0f); + if (Rand_ZeroOne() < 0.5f) { effect->obj.rot.z = 180.0f; } + Object_SetInfo(&effect->info, effect->obj.id); } @@ -2511,7 +2770,6 @@ void Corneria_8018F678(void) { s32 i; if (((gGameFrameCount % 32) == 0) && gPlayer[0].pos.x == 0.0f) { - for (i = 0; i < ARRAY_COUNT(gEffects); i++) { if (gEffects[i].obj.status == OBJ_FREE) { Corneria_8018F55C(&gEffects[i]); @@ -2533,17 +2791,23 @@ void Corneria_8018F6F8(Actor* actor, s32 arg1) { Actor_Initialize(actor); actor->obj.status = OBJ_INIT; actor->obj.id = OBJ_ACTOR_CUTSCENE; + actor->obj.pos.x = (D_i1_80199AB4[arg1] * 4.0f) + gPlayer[0].pos.x; actor->obj.pos.y = (D_i1_80199AC0[arg1] * 2.0f) + gPlayer[0].pos.y; actor->obj.pos.z = (D_i1_80199ACC[arg1] * 3.0f) + gPlayer[0].trueZpos; + actor->vwork[20].x = D_i1_80199AB4[arg1] + gPlayer[0].pos.x; actor->vwork[20].y = gPlayer[0].pos.y; actor->vwork[20].z = D_i1_80199ACC[arg1] + gPlayer[0].trueZpos; + actor->obj.rot.z = D_i1_80199AD8[arg1]; - actor->state = 100; actor->obj.rot.y = 180.0f; + + actor->state = 100; actor->fwork[0] = RAND_FLOAT(360.0f); + Object_SetInfo(&actor->info, actor->obj.id); + actor->drawShadow = true; actor->iwork[11] = 1; actor->info.cullDistance = 200.0f; @@ -2587,6 +2851,7 @@ void Corneria_LevelStart(Player* player) { sp30 = -Math_Atan2F(player->cam.eye.y - sp38, sqrtf(SQ(player->cam.eye.z - sp34) + SQ(player->cam.eye.x - sp3C))); sp44 = Math_RadToDeg(sp2C) - D_ctx_80177A48[4]; sp40 = Math_RadToDeg(sp30) - D_ctx_80177A48[5]; + if (sp44 > 180.0f) { sp44 -= 360.0f; } @@ -2629,11 +2894,14 @@ void Corneria_LevelStart(Player* player) { D_ctx_80177A48[4] = Math_RadToDeg(sp2C); D_ctx_80177A48[5] = Math_RadToDeg(sp30); + player->flags_228 = 0; + D_ctx_80177950 = -1.0f; if ((Math_RadToDeg(gPlayer[0].camYaw) < 90.0f) || (Math_RadToDeg(gPlayer[0].camYaw) > 270.0f)) { D_ctx_80177950 = 1.0f; } + player->vel.z = 0.0f; player->pos.z = player->pos.z; player->trueZpos = player->pos.z + player->camDist; @@ -2641,7 +2909,9 @@ void Corneria_LevelStart(Player* player) { player->yBob = -SIN_DEG(player->bobPhase) * 0.5f; player->rockPhase += 3.0f; player->rockAngle = SIN_DEG(player->rockPhase) * 1.5f; + Corneria_8018F678(); + player->wings.unk_30 = 0; switch (player->csState) { @@ -2651,80 +2921,103 @@ void Corneria_LevelStart(Player* player) { player->csTimer = 600; player->pos.y = 6000.0f; player->pos.x = 0.1f; + Corneria_8018F6F8(&gActors[0], 0); Corneria_8018F6F8(&gActors[1], 1); Corneria_8018F6F8(&gActors[2], 2); + actor0->iwork[14] = 2; actor1->iwork[14] = 3; actor2->iwork[14] = 4; + player->cam.eye.x = gCsCamEyeX = player->pos.x - 400.0f; gPlayer[0].cam.eye.y = gCsCamEyeY = player->pos.y + 600.0f; player->cam.eye.z = gCsCamEyeZ = player->trueZpos + 2000.0f; + player->cam.at.x = gCsCamAtX = player->pos.x; player->cam.at.y = gCsCamAtY = player->pos.y; player->cam.at.z = gCsCamAtZ = player->trueZpos + 300.0f; + D_ctx_80177A48[0] = 0; D_ctx_80177A48[1] = D_ctx_80177A48[2] = 0; + gFillScreenAlphaTarget = 255; gFillScreenAlpha = 255; gFillScreenRed = gFillScreenGreen = gFillScreenBlue = 255; break; + case 1: if (player->csTimer < 550) { gFillScreenAlphaTarget = 0; gFillScreenAlphaStep = 3; Math_SmoothStepToF(&D_ctx_80177A48[0], 0.01f, 1.0f, 0.0005f, 0.0f); } + gCsCamEyeX = player->pos.x - 150.0f; gCsCamEyeY = player->pos.y - 70.0f; gCsCamEyeZ = player->trueZpos + 150.0f; + gCsCamAtX = player->pos.x; gCsCamAtY = player->pos.y; gCsCamAtZ = player->trueZpos; + if (player->csTimer == 0) { player->csState = 2; player->csTimer = 130; D_ctx_80177A48[0] = 0.0f; } + if (player->csTimer == 315) { player->pos.x = 0.0f; } + if (player->csTimer == 270) { gHideRadio = false; Radio_PlayMessage(gMsg_ID_2005, RCID_FOX); } + if (player->csTimer == 180) { AUDIO_PLAY_SFX(NA_SE_WING_OPEN, player->sfxSource, 0); } + if (player->csTimer == 120) { AUDIO_PLAY_SFX(NA_SE_WING_OPEN_END, player->sfxSource, 0); } + if ((player->csTimer < 190) && (player->csTimer > 150)) { Math_SmoothStepToF(&player->wings.unk_24, 2.0f, 0.2f, 0.5f, 0.0f); } + if (player->csTimer < 150) { player->unk_204 = 0; } + if ((player->csTimer < 120) && ((player->csTimer % 16) == 0)) { D_ctx_80177A48[1] = RAND_FLOAT_CENTERED(60.0f); D_ctx_80177A48[2] = RAND_FLOAT_CENTERED(60.0f); } + if (player->csTimer == 0) { D_ctx_80177A48[1] = 0.0f; D_ctx_80177A48[2] = D_ctx_80177A48[1]; } break; + case 2: Math_SmoothStepToF(&D_ctx_80177A48[0], 0.1f, 1.0f, 0.001f, 0.0f); + gCsCamEyeX = player->pos.x - 50.0f; gCsCamEyeY = player->pos.y + 10.0f; gCsCamEyeZ = player->trueZpos - 10.0f; + gCsCamAtX = player->pos.x; gCsCamAtY = player->pos.y + 10.0f; gCsCamAtZ = player->trueZpos + 10.0f; + if (player->csTimer == 20) { Radio_PlayMessage(gMsg_ID_2010, RCID_FOX); } + if (player->csTimer == 0) { player->csState = 3; player->csTimer = 180; @@ -2735,50 +3028,65 @@ void Corneria_LevelStart(Player* player) { actor0->obj.pos.y = player->pos.y + 80.0f; actor0->obj.pos.z += 100.0f; } - if (gMsgCharIsPrinting && ((gGameFrameCount & 2) != 0)) { + + if (gMsgCharIsPrinting && (gGameFrameCount & 2)) { player->wings.unk_30 = 5.0f; } break; + case 3: if (fabsf(Math_SmoothStepToF(&actor0->obj.pos.z, player->pos.z + 100.0f, 0.05f, 5.0f, 0.0f)) < 1.0f) { player->csState = 4; D_ctx_80177A48[0] = 0.0f; player->csTimer = 190; } + if (gMsgCharIsPrinting && ((gGameFrameCount & 2) != 0)) { player->wings.unk_30 = 5.0f; } + gCsCamEyeY = player->pos.y + 10.0f; gCsCamAtY = player->pos.y + 10.0f; break; + case 4: if (gMsgCharIsPrinting && ((gGameFrameCount & 2) != 0)) { player->wings.unk_30 = 5.0f; } + Math_SmoothStepToF(&D_ctx_80177A48[0], 0.1f, 1.0f, 0.001f, 0.0f); + gCsCamEyeX = actor0->obj.pos.x - 50.0f; gCsCamEyeY = actor0->obj.pos.y + 10.0f; gCsCamEyeZ = actor0->obj.pos.z - 10.0f; + gCsCamAtX = actor0->obj.pos.x; gCsCamAtY = actor0->obj.pos.y + 10.0f; gCsCamAtZ = actor0->obj.pos.z + 10.0f; + if (player->csTimer == 0) { player->csState = 5; player->csTimer = 5; } + if (player->csTimer == 80) { Radio_PlayMessage(gMsg_ID_2020, RCID_FALCO); } + if (player->csTimer < 100) { Math_SmoothStepToF(&actor0->fwork[19], 50.0f, 0.1f, 3.0f, 0.01f); } + actor0->fwork[20] = 0.0f; + if (gMsgCharIsPrinting && ((gGameFrameCount & 2) != 0)) { actor0->fwork[20] = 5.0f; } break; + case 5: Math_SmoothStepToF(&actor0->fwork[19], 0, 0.1f, 3.0f, 0.01f); + if (player->csTimer == 0) { player->csState = 6; D_ctx_80177A48[0] = 0.0f; @@ -2788,6 +3096,7 @@ void Corneria_LevelStart(Player* player) { gCsCamEyeY = actor0->obj.pos.y + 10.0f; gCsCamAtY = actor0->obj.pos.y + 10.0f; break; + case 6: Math_SmoothStepToF(&actor0->fwork[19], 0.0f, 0.1f, 3.0f, 0.01f); Math_SmoothStepToF(&D_ctx_80177A48[0], 0.1f, 1.0f, 0.001f, 0.0f); @@ -2809,22 +3118,29 @@ void Corneria_LevelStart(Player* player) { actor0->obj.pos.y = player->pos.y; actor0->obj.pos.z = player->trueZpos + 240.0f; } + if (player->csTimer == 80) { Radio_PlayMessage(gMsg_ID_2030, RCID_PEPPY); } + actor2->fwork[20] = 0.0f; + if (gMsgCharIsPrinting && ((gGameFrameCount & 2) != 0)) { actor2->fwork[20] = 5.0f; } break; + case 7: Math_SmoothStepToF(&D_ctx_80177A48[0], 0.1f, 1.0f, 0.001f, 0.0f); + gCsCamEyeX = actor1->obj.pos.x + 20.0f; gCsCamEyeY = actor1->obj.pos.y + 10.0f; gCsCamEyeZ = actor1->obj.pos.z - 50.0f; + gCsCamAtX = actor1->obj.pos.x + 10.0f; gCsCamAtY = actor1->obj.pos.y + 10.0f; gCsCamAtZ = actor1->obj.pos.z + 10.0f; + if (player->csTimer == 0) { player->csState = 8; D_ctx_80177A48[0] = 0.0f; @@ -2832,20 +3148,26 @@ void Corneria_LevelStart(Player* player) { D_ctx_80177A48[8] = 50.0f; D_ctx_80177A48[3] = 0.0f; } + if (player->csTimer == 80) { Radio_PlayMessage(gMsg_ID_2040, RCID_SLIPPY); player->pos.x = 0.1f; } + if (player->csTimer < 100) { Math_SmoothStepToF(&actor1->fwork[19], -20.0f, 0.1f, 3.0f, 0.01f); } + actor1->fwork[20] = 0.0f; + if (gMsgCharIsPrinting && ((gGameFrameCount & 2) != 0)) { actor1->fwork[20] = 5.0f; } break; + case 8: Math_SmoothStepToF(&D_ctx_80177A48[0], 0.1f, 1.0f, 0.001f, 0.0f); + if (player->csTimer < 150) { D_ctx_80177A48[3] += player->unk_004; Math_SmoothStepToF(&player->unk_004, 2.0f, 1.0f, 0.2f, 0.0f); @@ -2853,49 +3175,64 @@ void Corneria_LevelStart(Player* player) { gCsCamEyeX = player->pos.x; gCsCamEyeZ = (player->trueZpos - 600.0f) + D_ctx_80177A48[3]; gCsCamEyeY = player->pos.y + D_ctx_80177A48[8]; + gCsCamAtX = player->pos.x; gCsCamAtY = player->pos.y + 20.0f; gCsCamAtZ = player->trueZpos + 100.0f; + if (player->csTimer < 100) { Math_SmoothStepToF(&D_ctx_80177A48[8], 10.0f, 0.1f, 0.7f, 0.0f); } + if (player->csTimer == 200) { Radio_PlayMessage(gMsg_ID_2050, RCID_FOX); } + player->wings.unk_30 = 0.0f; + if (gMsgCharIsPrinting && ((gGameFrameCount & 2) != 0)) { player->wings.unk_30 = 5.0f; } + if (player->csTimer == 80) { actor0->fwork[29] = 5.0f; } + if (player->csTimer == 60) { actor1->fwork[29] = 5.0f; } + if (player->csTimer == 40) { actor2->fwork[29] = 5.0f; } + if ((player->csTimer > 70) && (player->csTimer < 80)) { actor0->iwork[11] = 2; } + if ((player->csTimer > 50) && (player->csTimer < 60)) { actor1->iwork[11] = 2; } + if ((player->csTimer > 30) && (player->csTimer < 40)) { actor2->iwork[11] = 2; } + if (player->csTimer == 70) { actor0->state = 1; Play_PlaySfxFirstPlayer(player->sfxSource, NA_SE_ARWING_BOOST); } + if (player->csTimer == 50) { actor1->state = 2; Play_PlaySfxFirstPlayer(player->sfxSource, NA_SE_ARWING_BOOST); } + if (player->csTimer == 30) { actor2->state = 3; Play_PlaySfxFirstPlayer(player->sfxSource, NA_SE_ARWING_BOOST); } + if (player->csTimer == 0) { player->csState = 9; Play_PlaySfxFirstPlayer(player->sfxSource, NA_SE_ARWING_BOOST); @@ -2904,27 +3241,35 @@ void Corneria_LevelStart(Player* player) { player->unk_190 = 5.0f; } break; + case 9: gCsCamEyeX = player->pos.x; gCsCamEyeY = player->pos.y; gCsCamEyeZ = player->trueZpos + 1000.0f; + gCsCamAtX = player->pos.x; gCsCamAtY = player->pos.y; gCsCamAtZ = player->trueZpos + 1100.0f; + D_ctx_80177A48[0] = 0.03f; + player->unk_190 = 2.0f; + if (player->csTimer == 0) { gFillScreenAlphaTarget = 255; gFillScreenAlphaStep = 48; gFillScreenRed = gFillScreenGreen = gFillScreenBlue = 255; } + if (gFillScreenAlpha == 255) { AUDIO_PLAY_BGM(gBgmSeqId); + Object_Kill(&actor0->obj, actor0->sfxSource); Object_Kill(&actor1->obj, actor1->sfxSource); Object_Kill(&actor2->obj, actor2->sfxSource); gLevelStartStatusScreenTimer = 80; + player->pos.y = 350.0f; player->cam.eye.x = player->pos.x; player->cam.eye.y = (player->pos.y * player->unk_148) + 50.0f; @@ -2934,29 +3279,38 @@ void Corneria_LevelStart(Player* player) { player->cam.at.x = player->pos.x; player->cam.at.y = (player->pos.y * player->unk_148) + 20.0f; player->cam.at.z = player->trueZpos; + D_ctx_80177950 = 1.0f; + gPlayerGlareAlphas[0] = gPlayerGlareAlphas[1] = gPlayerGlareAlphas[2] = gPlayerGlareAlphas[3] = 0; gLoadLevelObjects = 1; gFillScreenAlphaTarget = 0; player->csTimer = 15; } break; + case 10: break; } + Math_SmoothStepToF(&player->cam.eye.x, gCsCamEyeX, D_ctx_80177A48[0], 20000.0f, 0.0f); Math_SmoothStepToF(&player->cam.eye.y, player->yBob + gCsCamEyeY, D_ctx_80177A48[0], 20000.0f, 0.0f); Math_SmoothStepToF(&player->cam.eye.z, gCsCamEyeZ, D_ctx_80177A48[0], 20000.0f, 0.0f); + Math_SmoothStepToF(&player->cam.at.x, gCsCamAtX, D_ctx_80177A48[0], 20000.0f, 0.0f); Math_SmoothStepToF(&player->cam.at.y, gCsCamAtY - player->yBob, D_ctx_80177A48[0], 20000.0f, 0.0f); Math_SmoothStepToF(&player->cam.at.z, gCsCamAtZ, D_ctx_80177A48[0], 20000.0f, 0.0f); + Math_SmoothStepToF(&player->wings.unk_04, D_ctx_80177A48[1], 0.2f, 1.0f, 0.0f); Math_SmoothStepToF(&player->wings.unk_0C, D_ctx_80177A48[2], 0.2f, 1.0f, 0.0f); + player->wings.unk_08 = player->wings.unk_04; player->wings.unk_10 = player->wings.unk_0C; + player->cam.eye.y -= 3.0f; player->cam.at.y -= 3.0f; player->pos.y -= 3.0f; + actor0->vwork[20].y -= 3.0f; actor0->obj.pos.y -= 3.0f; actor2->vwork[20].y -= 3.0f; @@ -2990,27 +3344,37 @@ void Corneria_80190F74(Actor* actor, s32 arg1) { sp5C.x = D_i1_80199AE4[arg1]; sp5C.y = D_i1_80199AF0[arg1]; sp5C.z = D_i1_80199AFC[arg1]; + sp44.x = D_i1_80199B08[arg1]; sp44.y = D_i1_80199B14[arg1]; sp44.z = D_i1_80199B20[arg1]; + Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp5C, &sp50); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp44, &sp38); + Actor_Initialize(actor); + actor->obj.pos.x = player->pos.x + sp50.x; actor->obj.pos.y = player->pos.y + sp50.y; actor->obj.pos.z = player->pos.z + sp50.z; + actor->fwork[0] = sp38.x; actor->fwork[1] = sp38.y; actor->fwork[2] = sp38.z; + actor->fwork[7] = RAND_FLOAT(360.0f); actor->fwork[8] = RAND_FLOAT(360.0f); + actor->vel.x = player->vel.x; actor->vel.y = player->vel.y; actor->vel.z = player->vel.z; + actor->obj.status = OBJ_INIT; actor->obj.id = OBJ_ACTOR_CUTSCENE; actor->obj.rot.z = D_i1_80199B2C[arg1]; + Object_SetInfo(&actor->info, actor->obj.id); + actor->iwork[11] = 1; AUDIO_PLAY_SFX(NA_SE_ARWING_ENGINE_FG, actor->sfxSource, 4); } @@ -3026,11 +3390,13 @@ void Corneria_LevelComplete1(Player* player) { f32 temp_deg; player->wings.unk_04 = player->wings.unk_0C = player->wings.unk_08 = player->wings.unk_10 = 0.0f; + Math_SmoothStepToF(&player->zRotBarrelRoll, 0.0f, 0.1f, 15.0f, 0.0f); Math_SmoothStepToF(&player->zRotBank, 0.0f, 0.1f, 15.0f, 0.0f); Math_SmoothStepToF(&player->camRoll, 0.0f, 0.1f, 3.0f, 0.0f); Math_SmoothStepToAngle(&player->aerobaticPitch, 0.0f, 0.1f, 20.0f, 0.0f); Math_SmoothStepToF(&player->boostSpeed, 0.0f, 0.1f, 3.0f, 0.0f); + if (player->csState >= 3) { player->cam.eye.y += 3.0f; player->cam.at.y += 3.0f; @@ -3045,12 +3411,15 @@ void Corneria_LevelComplete1(Player* player) { switch (player->csState) { case 0: Audio_StopSfxByBankAndSource(1, player->sfxSource); + sp54 = player->cam.eye.x - D_i1_8019B6D8[62]; sp4C = player->cam.eye.z - D_i1_8019B6D8[64]; D_ctx_80177A48[0] = Math_RadToDeg(Math_Atan2F(sp54, sp4C)); D_ctx_80177A48[1] = sqrtf(SQ(sp54) + SQ(sp4C)); + player->csState++; + D_ctx_80177A48[5] = 0.0f; D_ctx_80177A48[4] = D_ctx_80177A48[5]; D_ctx_80177A48[2] = D_ctx_80177A48[5]; @@ -3059,24 +3428,31 @@ void Corneria_LevelComplete1(Player* player) { Math_SmoothStepToF(&player->rot.x, 0.0f, 0.1f, 5.0f, 0.0f); Math_SmoothStepToF(&player->pos.y, 400.0f, 0.05f, 3.0f, 0.0f); Math_SmoothStepToF(&D_ctx_80177A48[1], 1300.0f, 0.05f, 1000.0f, 0.0f); + if (player->rot.y > 180.0f) { D_ctx_80177A48[0] += 0.5f; } else { D_ctx_80177A48[0] -= 0.5f; } + Matrix_RotateY(gCalcMatrix, D_ctx_80177A48[0] * M_DTOR, MTXF_NEW); + sp64.x = 0.0f; sp64.y = 0.0f; sp64.z = D_ctx_80177A48[1]; + Matrix_MultVec3f(gCalcMatrix, &sp64, &sp58); + Math_SmoothStepToF(&player->cam.eye.x, D_i1_8019B6D8[62] + sp58.x, 0.05f, 500.0f, 0.0f); Math_SmoothStepToF(&player->cam.eye.y, D_i1_8019B6D8[63] + 100.0f, 0.05f, 500.0f, 0.0f); Math_SmoothStepToF(&player->cam.eye.z, D_i1_8019B6D8[64] + sp58.z, 0.05f, 500.0f, 0.0f); Math_SmoothStepToF(&player->cam.at.x, D_i1_8019B6D8[62], 0.05f, 500.0f, 0.0f); Math_SmoothStepToF(&player->cam.at.y, D_i1_8019B6D8[63], 0.05f, 500.0f, 0.0f); Math_SmoothStepToF(&player->cam.at.z, D_i1_8019B6D8[64], 0.05f, 500.0f, 0.0f); + temp_fa0 = player->pos.x - D_i1_8019B6D8[62]; temp_fa1 = player->pos.z - D_i1_8019B6D8[64]; + if (gCsFrameCount < 30) { temp_deg = Math_RadToDeg(-Math_Atan2F(temp_fa0, temp_fa1)); var_fv1 = Math_SmoothStepToAngle(&player->rot.y, temp_deg, 0.5f, 4.0f, 0.0001f) * 20.0f; @@ -3084,51 +3460,69 @@ void Corneria_LevelComplete1(Player* player) { temp_deg = Math_RadToDeg(Math_Atan2F(temp_fa0, temp_fa1)); var_fv1 = Math_SmoothStepToAngle(&player->rot.y, temp_deg, 0.5f, 2.0f, 0.0001f) * 30.0f; } + Math_SmoothStepToAngle(&player->rot.z, var_fv1, 0.1f, 5.0f, 0.0001f); + if (gCsFrameCount == 220) { player->csState++; } break; + case 2: Math_SmoothStepToAngle(&player->rot.x, 20.0f, 0.1f, 0.5f, 0.0001f); Math_SmoothStepToAngle(&player->rot.z, 0.0f, 0.1f, 1.0f, 0.0001f); + Math_SmoothStepToF(&D_ctx_80177A48[2], 0.05f, 1.0f, 0.005f, 0.0001f); + Math_SmoothStepToF(&player->cam.at.x, player->pos.x, D_ctx_80177A48[2], 500.0f, 0.0f); Math_SmoothStepToF(&player->cam.at.y, player->pos.y, D_ctx_80177A48[2], 500.0f, 0.0f); Math_SmoothStepToF(&player->cam.at.z, player->pos.z, D_ctx_80177A48[2], 500.0f, 0.0f); + if (gCsFrameCount == 350) { player->csState++; D_ctx_80177A48[2] = 0.0f; D_ctx_80177A48[3] = 0.05f; } break; + case 3: if ((gCsFrameCount > 700) && (gCsFrameCount < 1000)) { func_demo_8004AA84(); } Math_SmoothStepToAngle(&player->rot.x, 20.0f, 0.1f, 0.5f, 0); Math_SmoothStepToAngle(&player->rot.z, 0.0f, 0.1f, 1.0f, 0); + Math_SmoothStepToF(&player->baseSpeed, 0.0f, 0.1f, 2.0f, 0.0f); + Math_SmoothStepToF(&D_ctx_80177A48[2], 0.1f, 1.0f, 0.002f, 0); Math_SmoothStepToF(&D_ctx_80177A48[3], 0.1f, 1.0f, 0.002f, 0); + Matrix_RotateY(gCalcMatrix, player->rot.y * M_DTOR, MTXF_NEW); Matrix_Push(&gCalcMatrix); Matrix_RotateY(gCalcMatrix, D_ctx_80177A48[5] * M_DTOR, MTXF_APPLY); + sp64.x = 0.0f; sp64.y = -200.0f; sp64.z = 800.0f; + Matrix_MultVec3f(gCalcMatrix, &sp64, &sp58); + Math_SmoothStepToF(&player->cam.eye.x, player->pos.x + sp58.x, D_ctx_80177A48[2], 500.0f, 0.0f); Math_SmoothStepToF(&player->cam.eye.y, player->pos.y + sp58.y, D_ctx_80177A48[2], 500.0f, 0.0f); Math_SmoothStepToF(&player->cam.eye.z, player->pos.z + sp58.z, D_ctx_80177A48[2], 500.0f, 0.0f); + Matrix_Pop(&gCalcMatrix); + sp64.x = 0.0f; sp64.y = 0; sp64.z = 150.0f; + Matrix_MultVec3f(gCalcMatrix, &sp64, &sp58); + Math_SmoothStepToF(&player->cam.at.x, player->pos.x + sp58.x, D_ctx_80177A48[3], 500.0f, 0.0f); Math_SmoothStepToF(&player->cam.at.y, player->pos.y + sp58.y, D_ctx_80177A48[3], 500.0f, 0.0f); Math_SmoothStepToF(&player->cam.at.z, player->pos.z + sp58.z, D_ctx_80177A48[3], 500.0f, 0.0f); + D_ctx_80177A48[5] += D_ctx_80177A48[4]; if ((gCsFrameCount > 400) && (gCsFrameCount < 1000)) { @@ -3147,6 +3541,7 @@ void Corneria_LevelComplete1(Player* player) { player->unk_190 = 5.0f; } break; + case 4: if (gCsFrameCount >= 1270) { player->baseSpeed *= 1.2f; @@ -3156,13 +3551,16 @@ void Corneria_LevelComplete1(Player* player) { } player->unk_190 = 2.0f; } + if (gCsFrameCount == 1290) { Audio_FadeOutAll(50); } + if (gCsFrameCount > 1300) { gFillScreenAlphaTarget = 255; gFillScreenRed = gFillScreenGreen = gFillScreenBlue = 0; gFillScreenAlphaStep = 8; + if (gFillScreenAlpha == 255) { player->state_1C8 = PLAYERSTATE_1C8_NEXT; player->csTimer = 0; @@ -3177,15 +3575,19 @@ void Corneria_LevelComplete1(Player* player) { case 981: gShowLevelClearStatusScreen = 1; break; + case 1181: gShowLevelClearStatusScreen = 0; break; + case 240: AUDIO_PLAY_BGM(NA_BGM_COURSE_CLEAR); break; + case 330: gLevelClearScreenTimer = 100; break; + case 470: Play_ClearObjectData(); if (gTeamShields[TEAM_ID_FALCO] > 0) { @@ -3198,9 +3600,11 @@ void Corneria_LevelComplete1(Player* player) { Corneria_80190F74(&gActors[2], 2); } break; + case 410: Radio_PlayMessage(gMsg_ID_2335, RCID_FOX); break; + case 550: if ((gTeamShields[TEAM_ID_SLIPPY] == -1) || (gTeamShields[TEAM_ID_SLIPPY] == 0)) { Radio_PlayMessage(gMsg_ID_20333, RCID_ROB64); @@ -3208,6 +3612,7 @@ void Corneria_LevelComplete1(Player* player) { Radio_PlayMessage(gMsg_ID_2300, RCID_SLIPPY); } break; + case 682: if ((gTeamShields[TEAM_ID_PEPPY] == -1) || (gTeamShields[TEAM_ID_PEPPY] == 0)) { Radio_PlayMessage(gMsg_ID_20332, RCID_ROB64); @@ -3215,6 +3620,7 @@ void Corneria_LevelComplete1(Player* player) { Radio_PlayMessage(gMsg_ID_2310, RCID_PEPPY); } break; + case 816: if ((gTeamShields[TEAM_ID_FALCO] == -1) || (gTeamShields[TEAM_ID_FALCO] == 0)) { Radio_PlayMessage(gMsg_ID_20331, RCID_ROB64); @@ -3222,6 +3628,7 @@ void Corneria_LevelComplete1(Player* player) { Radio_PlayMessage(gMsg_ID_2320, RCID_FALCO); } break; + case 1150: if (gTeamShields[TEAM_ID_FALCO] > 0) { gActors[0].state = 1; @@ -3231,6 +3638,7 @@ void Corneria_LevelComplete1(Player* player) { gActors[0].fwork[29] = 5.0f; } break; + case 1190: if (gTeamShields[TEAM_ID_SLIPPY] > 0) { gActors[1].state = 1; @@ -3240,6 +3648,7 @@ void Corneria_LevelComplete1(Player* player) { gActors[1].fwork[29] = 5.0f; } break; + case 1230: if (gTeamShields[TEAM_ID_PEPPY] > 0) { gActors[2].state = 1; @@ -3250,18 +3659,24 @@ void Corneria_LevelComplete1(Player* player) { } break; } + Matrix_RotateY(gCalcMatrix, (player->rot.y + 180.0f) * M_DTOR, MTXF_NEW); Matrix_RotateX(gCalcMatrix, -((player->rot.x + player->aerobaticPitch) * M_DTOR), MTXF_APPLY); + sp64.x = 0.0f; sp64.y = 0.0f; sp64.z = player->baseSpeed + player->boostSpeed; + Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp64, &sp58); + player->vel.x = sp58.x; player->vel.z = sp58.z; player->vel.y = sp58.y; + player->pos.x += player->vel.x; player->pos.y += player->vel.y; player->pos.z += player->vel.z; + player->trueZpos = player->pos.z; player->bankAngle = player->rot.z + player->zRotBank + player->zRotBarrelRoll; player->bobPhase += 10.0f;