diff --git a/assets/xml/objects/object_knight.xml b/assets/xml/objects/object_knight.xml index bbd2d7b939..67d87a0ffd 100644 --- a/assets/xml/objects/object_knight.xml +++ b/assets/xml/objects/object_knight.xml @@ -98,6 +98,9 @@ + + + diff --git a/include/variables.h b/include/variables.h index ed77d97861..98ff888dc8 100644 --- a/include/variables.h +++ b/include/variables.h @@ -3215,20 +3215,16 @@ extern u8 actorCutsceneNextCutscenes[16]; // extern UNK_TYPE1 D_801F4E20; extern u8 D_801F4E30; // extern UNK_TYPE1 D_801F4E31; -// extern UNK_TYPE1 D_801F4E32; -// extern UNK_TYPE1 D_801F4E38; -// extern UNK_TYPE1 D_801F4E3C; -// extern UNK_TYPE1 D_801F4E40; -// extern UNK_TYPE1 D_801F4E44; -// extern UNK_TYPE1 D_801F4E48; -// extern UNK_TYPE1 D_801F4E4C; -// extern UNK_TYPE1 D_801F4E4E; -// extern UNK_TYPE1 D_801F4E50; -// extern UNK_TYPE1 D_801F4E54; -// extern UNK_TYPE1 D_801F4E58; -// extern UNK_TYPE1 D_801F4E5C; -// extern UNK_TYPE1 D_801F4E60; -// extern UNK_TYPE1 D_801F4E64; +extern s8 D_801F4E32; +extern Vec3f D_801F4E38; +extern f32 D_801F4E44; +extern f32 D_801F4E48; +extern s16 D_801F4E4C; +extern s8 D_801F4E4E; +extern Vec3f D_801F4E50; +extern f32 D_801F4E5C; +extern f32 D_801F4E60; +extern s16 D_801F4E64; // extern UNK_TYPE1 D_801F4E68; extern f32 D_801F4E70; // extern UNK_TYPE1 D_801F4E74; diff --git a/spec b/spec index 6533538d2a..f288eee045 100644 --- a/spec +++ b/spec @@ -2562,9 +2562,11 @@ beginseg name "ovl_Boss_06" compress include "build/src/overlays/actors/ovl_Boss_06/z_boss_06.o" - include "build/data/ovl_Boss_06/ovl_Boss_06.data.o" - include "build/data/ovl_Boss_06/ovl_Boss_06.bss.o" +#ifdef NON_MATCHING + include "build/src/overlays/actors/ovl_Boss_06/ovl_Boss_06_reloc.o" +#else include "build/data/ovl_Boss_06/ovl_Boss_06.reloc.o" +#endif endseg beginseg diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.c b/src/overlays/actors/ovl_Boss_06/z_boss_06.c index 9e38aaccb5..9461dbeb0c 100644 --- a/src/overlays/actors/ovl_Boss_06/z_boss_06.c +++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.c @@ -5,8 +5,11 @@ */ #include "z_boss_06.h" +#include "overlays/actors/ovl_En_Knight/z_en_knight.h" +#include "objects/gameplay_keep/gameplay_keep.h" +#include "objects/object_knight/object_knight.h" -#define FLAGS 0x00000035 +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((Boss06*)thisx) @@ -15,15 +18,22 @@ void Boss06_Destroy(Actor* thisx, GlobalContext* globalCtx); void Boss06_Update(Actor* thisx, GlobalContext* globalCtx); void Boss06_Draw(Actor* thisx, GlobalContext* globalCtx); +void func_809F24A8(Boss06* this); void func_809F24C8(Boss06* this, GlobalContext* globalCtx); void func_809F2B64(Boss06* this, GlobalContext* globalCtx); void func_809F2C44(Boss06* this, GlobalContext* globalCtx); +void func_809F2E14(Boss06* this, GlobalContext* globalCtx); void func_809F2E34(Boss06* this, GlobalContext* globalCtx); +void func_809F2ED0(Boss06* this, GlobalContext* globalCtx); void func_809F2EE8(Boss06* this, GlobalContext* globalCtx); -#if 0 -// static DamageTable sDamageTable = { -static DamageTable D_809F4080 = { +static Vec3f D_809F4370[128]; +static EnKnight* D_809F4970; +static s32 D_809F4974; +static s32 D_809F4978; +static s32 D_809F497C; + +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(0, 0xF), /* Deku Stick */ DMG_ENTRY(0, 0xF), /* Horse trample */ DMG_ENTRY(0, 0x0), @@ -70,47 +80,581 @@ const ActorInit Boss_06_InitVars = { (ActorFunc)Boss06_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_809F40C0 = { - { COLTYPE_HIT3, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7FFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_HIT3, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x00, 0x04 }, + { 0xF7FFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 90, 140, 10, { 0, 0, 0 } }, }; +static Vec3f D_809F40EC[] = { + { 1081.0f, 235.0f, 3224.0f }, + { 676.0f, 235.0f, 3224.0f }, +}; + +void func_809F2120(s32 arg0, s32 arg1, s32 arg2) { + D_809F4974 = arg0; + D_809F4978 = arg1; + D_809F497C = arg2; +} + +f32 func_809F2140(void) { + f32 temp_f2; + + D_809F4974 = (D_809F4974 * 171) % 30269; + D_809F4978 = (D_809F4978 * 172) % 30307; + D_809F497C = (D_809F497C * 170) % 30323; + temp_f2 = (D_809F4974 / 30269.0f) + (D_809F4978 / 30307.0f) + (D_809F497C / 30323.0f); + + while (temp_f2 >= 1.0f) { + temp_f2 -= 1.0f; + } + + return fabsf(temp_f2); +} + +void Boss06_Init(Actor* thisx, GlobalContext* globalCtx) { + Boss06* this = THIS; + u8* temp_v0; + s32 i; + + D_809F4970 = (EnKnight*)this->actor.parent; + this->actor.colChkInfo.damageTable = &sDamageTable; + + if ((KREG(64) != 0) || (gSaveContext.eventInf[5] & 0x80)) { + this->actionFunc = func_809F2E14; + } else { + this->actionFunc = func_809F2B64; + } + + Actor_SetScale(&this->actor, 0.1f); + Math_Vec3f_Copy(&this->actor.world.pos, &D_809F40EC[ENBOSS06_GET_PARAMS(&this->actor)]); + this->actor.shape.rot.y = -0x8000; + Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + + temp_v0 = SEGMENTED_TO_VIRTUAL(&object_knight_Tex_019490); + for (i = 0; i < ARRAY_COUNT(this->unk_200); i++) { + this->unk_200[i] = temp_v0[i]; + } + + this->actor.flags &= ~ACTOR_FLAG_1; +} + +void Boss06_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} + +void func_809F23CC(Boss06* this) { + if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; + if ((this->unk_1C9 == 0) && (D_809F4970->unk_68A == 0)) { + if (this->actor.colChkInfo.damageEffect == 2) { + func_809F24A8(this); + play_sound(NA_SE_SY_TRE_BOX_APPEAR); + + this->unk_1B0 = -(this->actor.world.pos.x - this->collider.info.bumper.hitPos.x); + this->unk_1BC = this->unk_1B0 * 0.35f; + + this->unk_1B4 = -((this->actor.world.pos.y + 80.0f) - this->collider.info.bumper.hitPos.y); + this->unk_1C0 = this->unk_1B4 * -0.35f; + } + } + } +} + +void func_809F24A8(Boss06* this) { + this->actionFunc = func_809F24C8; + this->unk_A28 = 0.0f; + this->unk_1AC = 0.0f; +} + +#ifdef NON_MATCHING +// Weird loading of 1 +void func_809F24C8(Boss06* this, GlobalContext* globalCtx) { + s16 sp4E = 0; + Player* player = GET_PLAYER(globalCtx); + Actor* temp_s0; + Actor* temp_v0_2; + Actor* child; + + this->unk_1CA++; + + switch (this->unk_1C9) { + case 0: + if (ActorCutscene_GetCurrentIndex() != -1) { + break; + } + + func_800EA0D4(globalCtx, &globalCtx->csCtx); + func_800B7298(globalCtx, &this->actor, 7); + this->unk_A00 = func_801694DC(globalCtx); + func_80169590(globalCtx, 0, 1); + func_80169590(globalCtx, this->unk_A00, 7); + D_809F4970->unk_151 = 1; + this->unk_1C9 = 1; + this->unk_1C8 = 1; + this->unk_1E0 = 255.0f; + this->unk_1DC = 0.0f; + + temp_s0 = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; + while (temp_s0 != NULL) { + if (temp_s0->id == ACTOR_EN_ARROW) { + Actor_MarkForDeath(temp_s0); + } + temp_s0 = temp_s0->next; + } + + case 1: + if (this->unk_1CA >= 10) { + Math_ApproachF(&this->unk_1E4, 30.0f, 0.2f, 1.0f); + globalCtx->envCtx.unk_E5 = 1; + globalCtx->envCtx.unk_E6[2] = 0; + globalCtx->envCtx.unk_E6[1] = 0; + globalCtx->envCtx.unk_E6[0] = 0; + globalCtx->envCtx.unk_E6[3] = this->unk_A2C; + Math_ApproachF(&this->unk_A2C, 75.0f, 1.0f, 3.0f); + } + + if (this->unk_1CA >= 30) { + play_sound(NA_SE_EV_S_STONE_FLASH); + } + + if (this->unk_1CA >= 60) { + globalCtx->envCtx.unk_E5 = 0; + this->unk_1C8 = 0; + this->unk_1DC = 0.0f; + this->unk_1D8 = 0.0f; + if (this->unk_1CA == 60) { + D_809F4970->unk_154++; + func_800B7298(globalCtx, &this->actor, 0x84); + player->actor.shape.rot.y = 0; + player->actor.world.rot.y = player->actor.shape.rot.y; + } + + this->unk_A04.x = player->actor.world.pos.x + 20.0f; + this->unk_A04.y = player->actor.world.pos.y + 20.0f; + this->unk_A04.z = player->actor.world.pos.z + 30.0f; + + this->unk_A10.x = player->actor.world.pos.x; + this->unk_A10.y = player->actor.world.pos.y + 26.0f; + this->unk_A10.z = player->actor.world.pos.z; + + if (this->unk_1CA >= 75) { + temp_v0_2 = globalCtx->actorCtx.actorLists[ACTORCAT_BOSS].first; + while (temp_v0_2 != NULL) { + if ((temp_v0_2->id == ACTOR_EN_KNIGHT) && (&D_809F4970->actor == temp_v0_2) && + (D_809F4970->unk_680 != 0)) { + this->unk_A04.x = 1307.0f; + this->unk_A04.y = 142.0f; + this->unk_A04.z = 2897.0f; + + this->unk_A10.x = 1376.0f; + this->unk_A10.y = 132.0f; + this->unk_A10.z = 2860.0f; + + if (this->unk_1CA == 75) { + D_809F4970->unk_148 = 1; + } + sp4E = 17; + break; + } + temp_v0_2 = temp_v0_2->next; + } + } + + if ((s16)(sp4E + 80) < this->unk_1CA) { + this->unk_1C9 = 2; + this->unk_1CA = 0; + this->unk_1B4 = 0.0f; + this->unk_1B0 = 0.0f; + this->unk_144 = 2; + this->unk_1A4 = 0.0f; + this->unk_1A0 = 0.0f; + this->unk_1DC = 18.0f; + this->unk_1E0 = 255.0f; + this->unk_19C = 1.0f; + + Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_MIR_RAY2, + this->actor.world.pos.x, this->actor.world.pos.y - 200.0f, + this->actor.world.pos.z - 170.0f, 15, 0, 0, 1); + + if (ENBOSS06_GET_PARAMS(&this->actor) == 0) { + this->unk_A04.x = this->actor.world.pos.x - 200.0f; + } else { + this->unk_A04.x = this->actor.world.pos.x + 200.0f; + } + this->unk_A04.y = (this->actor.world.pos.y - 200.0f) + 100.0f; + this->unk_A04.z = this->actor.world.pos.z - 200.0f; + + this->unk_A10.x = this->actor.world.pos.x; + this->unk_A10.y = this->actor.world.pos.y + 80.0f; + this->unk_A10.z = this->actor.world.pos.z; + } + } else { + this->unk_A10.z = this->actor.world.pos.z; + this->unk_A04.y = this->actor.world.pos.y + 60.0f; + this->unk_A04.x = this->actor.world.pos.x; + + this->unk_A04.z = this->actor.world.pos.z - 210.0f; + this->unk_A10.y = this->actor.world.pos.y + 80.0f; + this->unk_A10.x = this->actor.world.pos.x; + } + break; + + case 2: + child = this->actor.child; + + if (this->unk_1CA == 1) { + this->unk_A1C.x = fabsf(this->unk_A10.x - child->world.pos.x); + this->unk_A1C.y = fabsf(this->unk_A10.y - child->world.pos.y); + this->unk_A1C.z = fabsf(this->unk_A10.z - child->world.pos.z); + } + + Math_ApproachF(&this->unk_A10.x, child->world.pos.x, 0.15f, this->unk_A1C.x * this->unk_A28); + Math_ApproachF(&this->unk_A10.y, child->world.pos.y, 0.15f, this->unk_A1C.y * this->unk_A28); + Math_ApproachF(&this->unk_A10.z, child->world.pos.z, 0.15f, this->unk_A1C.z * this->unk_A28); + Math_ApproachF(&this->unk_A28, 1.0f, 1.0f, 0.001f); + + if (this->unk_1CA > 80) { + func_809F2ED0(this, globalCtx); + func_80169AFC(globalCtx, this->unk_A00, 0); + this->unk_A00 = 0; + func_800EA0EC(globalCtx, &globalCtx->csCtx); + func_800B7298(globalCtx, &this->actor, 6); + D_809F4970->unk_151 = 0; + } + break; + } + + if (this->unk_A00 != 0) { + ShrinkWindow_SetLetterboxTarget(0x1B); + Play_CameraSetAtEye(globalCtx, this->unk_A00, &this->unk_A10, &this->unk_A04); + } +} +#else +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_06/func_809F24C8.s") #endif -extern DamageTable D_809F4080; -extern ColliderCylinderInit D_809F40C0; +void func_809F2B64(Boss06* this, GlobalContext* globalCtx) { + this->actionFunc = func_809F2C44; + this->unk_144 = 3; + this->unk_1A8 = 110.0f; + this->unk_1E0 = 200; + this->unk_1DC = 15.0f; + this->unk_1E4 = 30.0f; + this->unk_1AC = 0.0f; + this->unk_19C = 1.0f; + Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_MIR_RAY2, this->actor.world.pos.x, + this->actor.world.pos.y - 200.0f, this->actor.world.pos.z - 170.0f, 15, 0, 0, 1); + D_809F4970->unk_154++; +} -extern UNK_TYPE D_06018BD0; -extern UNK_TYPE D_06019490; +void func_809F2C44(Boss06* this, GlobalContext* globalCtx) { + if (D_809F4970->unk_153 != 0) { + this->unk_A28 = 0.008f; + Math_ApproachF(&this->unk_1E4, 0.0f, 0.2f, this->unk_A28 * 30.0f); + Math_ApproachF(&this->unk_1AC, -70.0f, 0.2f, this->unk_A28 * 70.0f); + Math_ApproachF(&this->unk_1A8, 0.0f, 0.2f, this->unk_A28 * 110.0f); + Math_ApproachF(&this->unk_1A0, -900.0f, 0.2f, this->unk_A28 * 900.0f); + Math_ApproachF(&this->unk_1A4, 1350.0f, 0.2f, this->unk_A28 * 1350.0f); + Math_ApproachF(&this->unk_1E0, 100.0f, 0.2f, this->unk_A28 * 100.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_06/func_809F2120.s") + if (this->unk_1E4 < 5.0f) { + Math_ApproachF(&this->unk_19C, 0.0f, 1.0f, 0.03f); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_06/func_809F2140.s") + if ((this->unk_1E4 > 0.1f) && ENBOSS06_GET_PARAMS(&this->actor) == 0) { + play_sound(NA_SE_EV_CURTAIN_DOWN - SFX_FLAG); + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_06/Boss06_Init.s") + if (D_809F4970->unk_153 == 2) { + Actor_MarkForDeath(this->actor.child); + this->actor.child = NULL; + func_809F2E14(this, globalCtx); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_06/Boss06_Destroy.s") +void func_809F2E14(Boss06* this, GlobalContext* globalCtx) { + this->actionFunc = func_809F2E34; + this->unk_144 = 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_06/func_809F23CC.s") +void func_809F2E34(Boss06* this, GlobalContext* globalCtx) { + this->unk_1E0 = 200.0f; + this->unk_1DC = 15.0f; + func_809F23CC(this); + Collider_UpdateCylinder(&this->actor, &this->collider); + this->collider.dim.pos.z = (this->actor.world.pos.z - 50.0f) + 100.0f; + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_06/func_809F24A8.s") +void func_809F2ED0(Boss06* this, GlobalContext* globalCtx) { + this->actionFunc = func_809F2EE8; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_06/func_809F24C8.s") +void func_809F2EE8(Boss06* this, GlobalContext* globalCtx) { + this->unk_1E0 = 100.0f; + this->unk_1DC = 13.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_06/func_809F2B64.s") +void Boss06_Update(Actor* thisx, GlobalContext* globalCtx) { + Boss06* this = THIS; + s32 i; + Vec3f sp7C; + f32 temp_f22; + f32 phi_f26; + f32 phi_f24; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_06/func_809F2C44.s") + this->actionFunc(this, globalCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_06/func_809F2E14.s") + if (this->unk_146 != 0) { + this->unk_146--; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_06/func_809F2E34.s") + if (this->unk_148 != 0) { + this->unk_148--; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_06/func_809F2ED0.s") + if (this->unk_1E4 > 0.0f) { + if (ENBOSS06_GET_PARAMS(&this->actor) == 0) { + D_801F4E32 = 1; + D_801F4E38.x = this->actor.world.pos.x + this->unk_1B0; + D_801F4E38.y = this->actor.world.pos.y + 80.0f + this->unk_1B4 + this->unk_1AC; + D_801F4E38.z = this->actor.world.pos.z; + D_801F4E44 = this->unk_1E4; + D_801F4E48 = 10.0f; + D_801F4E4C = 0; + } else { + D_801F4E4E = 1; + D_801F4E50.x = this->actor.world.pos.x + this->unk_1B0; + D_801F4E50.y = this->actor.world.pos.y + 80.0f + this->unk_1B4 + this->unk_1AC; + D_801F4E50.z = this->actor.world.pos.z; + D_801F4E5C = this->unk_1E4; + D_801F4E60 = 10.0f; + D_801F4E64 = 0; + } + } else if (ENBOSS06_GET_PARAMS(&this->actor) == 0) { + D_801F4E32 = 0; + } else { + D_801F4E4E = 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_06/func_809F2EE8.s") + if ((this->unk_1C8 != 0) && (this->unk_1C8 != 0)) { + play_sound(NA_SE_EV_FIRE_PLATE - SFX_FLAG); + this->unk_1CC += 0.6f; + this->unk_1D0 += 0.1f; + this->unk_1D4 += 0.0200000014156f; + this->unk_1D8 += 0.00016f; + this->unk_1DC += 0.4f; + Math_ApproachZeroF(&this->unk_1B0, 1.0f, 0.7f); + Math_ApproachZeroF(&this->unk_1B4, 1.0f, 0.7f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_06/Boss06_Update.s") + phi_f26 = 0.0f; + phi_f24 = 0.0f; + for (i = 0; i < 1024; i++) { + temp_f22 = + (((__sinf(phi_f24) * this->unk_1D4) + 1.0f) * ((__sinf(phi_f26) * this->unk_1D0) + this->unk_1D0)) + + this->unk_1CC; + + phi_f26 += (M_PI / 64); + phi_f24 += 0.030679617f; + + Matrix_InsertZRotation_f(i * (M_PI / 512), MTXMODE_NEW); + Matrix_GetStateTranslationAndScaledY(temp_f22, &sp7C); + + sp7C.x += 32.0f + this->unk_1BC; + sp7C.y += 32.0f + this->unk_1C0; + + if ((i % 8) == 0) { + Math_Vec3f_Copy(&D_809F4370[i / 8], &sp7C); + } + + if ((sp7C.x >= 0.0f) && (sp7C.y >= 0.0f) && (sp7C.x < 64.0f) && (sp7C.y < 64.0f)) { + s32 x = sp7C.x; + s32 idx = ((s32)sp7C.y << 5); + + idx += (x / 2); + + if ((x % 2) != 0) { + this->unk_200[idx] &= 0xF0; + } else { + this->unk_200[idx] &= 0xF; + } + } + } + } +} + +#ifdef NON_MATCHING +// v/a flips +void Boss06_Draw(Actor* thisx, GlobalContext* globalCtx2) { + GlobalContext* globalCtx = globalCtx2; + Boss06* this = THIS; + s32 i; + f32 spE0 = 0.0f; + s16 temp_s0; + s16 temp_f10; + Vtx* temp_v0_2; + u32 temp_v0; + u8 spD3; + u8 spD2; + s32 pad; + f32 sp68; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(globalCtx->state.gfxCtx); + + temp_v0 = gSaveContext.time; + if (gSaveContext.time > 0x8000) { + temp_v0 = (0xFFFF - gSaveContext.time) & 0xFFFF; + } + sp68 = (f32)temp_v0 / 0x8000; + spD3 = ((10.0f * sp68) + 105.0f) * this->unk_19C; + spD2 = ((40.0f * sp68) + 55.0f) * this->unk_19C; + + if (this->unk_144 & 2) { + temp_s0 = Math_SinS(D_809F4970->unk_144) * 1000.0f; + temp_f10 = (Math_CosS(D_809F4970->unk_144) * -2000.0f) - 2000.0f; + temp_v0_2 = SEGMENTED_TO_VIRTUAL(&object_knight_Vtx_018BD0); + + temp_v0_2[0].v.ob[1] = (s16)this->unk_1A0 + 0xE92; + temp_v0_2[3].v.ob[1] = (s16)this->unk_1A0 + 0xE92; + temp_v0_2[4].v.ob[1] = (s16)this->unk_1A0 + 0xE92; + temp_v0_2[7].v.ob[1] = (s16)this->unk_1A0 + 0xE92; + + temp_v0_2[5].v.ob[0] = temp_s0 + 0x2A3; + temp_v0_2[5].v.ob[2] = (temp_f10 + (s16)this->unk_1A4) - 0x708; + + temp_v0_2[6].v.ob[0] = temp_s0 - 0x2A3; + temp_v0_2[6].v.ob[2] = (temp_f10 + (s16)this->unk_1A4) - 0x708; + + temp_v0_2[9].v.ob[0] = temp_s0 + 0x2A3; + temp_v0_2[9].v.ob[2] = temp_f10 - 0x1C2; + + temp_v0_2[11].v.ob[0] = temp_s0 - 0x2A3; + temp_v0_2[11].v.ob[2] = temp_f10 - 0x1C2; + + temp_v0_2[12].v.ob[0] = temp_s0 + 0x2A3; + temp_v0_2[12].v.ob[2] = temp_f10 - 0x1C2; + + temp_v0_2[14].v.ob[0] = temp_s0 - 0x339; + temp_v0_2[14].v.ob[2] = temp_f10 - 0x79E; + + temp_v0_2[15].v.ob[0] = temp_s0 - 0x339; + temp_v0_2[15].v.ob[2] = temp_f10; + + temp_v0_2[16].v.ob[0] = temp_s0 + 0x339; + temp_v0_2[16].v.ob[2] = temp_f10; + + temp_v0_2[17].v.ob[0] = temp_s0 + 0x339; + temp_v0_2[17].v.ob[2] = temp_f10 - 0x79E; + + if (this->actor.child != NULL) { + Actor* child = this->actor.child; + + child->world.pos.x = this->actor.world.pos.x + (temp_s0 * 0.1f); + child->world.pos.z = (this->actor.world.pos.z - 170.0f) + (temp_f10 * 0.1f); + } + + AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&object_knight_Matanimheader_019360)); + Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y - 234.0f, + this->actor.world.pos.z + 30.0f, 0); + Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); + Matrix_InsertTranslation(0.0f, 0.0f, -1112.0f, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x9B, 255, 255, (u8)((140.0f * sp68) + 115.0f), spD3); + gSPDisplayList(POLY_XLU_DISP++, object_knight_DL_018CF0); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0xFF, 255, 255, (u8)((100.0f * sp68) + 65.0f), spD2); + gSPDisplayList(POLY_XLU_DISP++, object_knight_DL_018DE0); + } + + if (this->unk_144 & 1) { + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(&this->unk_200)); + + Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y + this->unk_1A8, + this->actor.world.pos.z, MTXMODE_NEW); + Matrix_Scale(this->actor.scale.x, this->actor.scale.y, 0.0f, MTXMODE_APPLY); + Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, object_knight_DL_0193B0); + + if (this->unk_1D8 > 0.0f) { + Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y + 84.0f, + this->actor.world.pos.z - 2.0f, MTXMODE_NEW); + Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_APPLY); + func_809F2120(1, 0x71A5, 0x263A); + + gDPSetEnvColor(POLY_XLU_DISP++, 255, 10, 0, 0); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 230); + + for (i = 0; i < ARRAY_COUNT(D_809F4370); i++) { + if ((fabsf(D_809F4370[i].x - 32.0f) < 30.0f) && (fabsf(D_809F4370[i].y - 32.0f) < 30.0f)) { + Matrix_StatePush(); + + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, + ((globalCtx->gameplayFrames + (i * 10)) * -20) % 512, 0x20, 0x80)); + + Matrix_InsertTranslation((D_809F4370[i].x - 32.0f) * -2.4f, (D_809F4370[i].y - 32.0f) * -2.4f, 0.0f, + MTXMODE_APPLY); + Matrix_InsertZRotation_f(i * (M_PI / 64), MTXMODE_APPLY); + + if (func_809F2140() < 0.5f) { + Matrix_InsertYRotation_f(M_PI, MTXMODE_APPLY); + } + + Matrix_Scale(-0.002f, -this->unk_1D8, 1.0f, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + + Matrix_StatePop(); + } + } + } else { + spE0 = 7.0f; + } + } + + if (this->unk_1DC > 0.0f) { + u8 temp_s2 = (this->unk_1E0 - 50.0f) + (50.0f * sp68); + + Matrix_InsertTranslation(this->actor.world.pos.x + this->unk_1B0, + this->actor.world.pos.y + 84.0f + this->unk_1B4, + (this->actor.world.pos.z - 2.0f) + spE0, MTXMODE_NEW); + + gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_023348); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, (u8)((140.0f * sp68) + 115.0f), temp_s2); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 205, (u8)((100.0f * sp68) + 65.0f), 128); + + Matrix_Scale(this->unk_1DC, this->unk_1DC, 1.0f, MTXMODE_APPLY); + Matrix_InsertZRotation_s(globalCtx->gameplayFrames * 64, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_023428); + } + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} +#else #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_06/Boss06_Draw.s") +#endif diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.h b/src/overlays/actors/ovl_Boss_06/z_boss_06.h index b793b284b2..d7e6875a20 100644 --- a/src/overlays/actors/ovl_Boss_06/z_boss_06.h +++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.h @@ -7,11 +7,47 @@ struct Boss06; typedef void (*Boss06ActionFunc)(struct Boss06*, GlobalContext*); +#define ENBOSS06_GET_PARAMS(thisx) ((thisx)->params) + typedef struct Boss06 { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x54]; + /* 0x0144 */ u8 unk_144; + /* 0x0146 */ s16 unk_146; + /* 0x0148 */ s16 unk_148; + /* 0x014C */ ColliderCylinder collider; /* 0x0198 */ Boss06ActionFunc actionFunc; - /* 0x019C */ char unk_19C[0x894]; + /* 0x019C */ f32 unk_19C; + /* 0x01A0 */ f32 unk_1A0; + /* 0x01A4 */ f32 unk_1A4; + /* 0x01A8 */ f32 unk_1A8; + /* 0x01AC */ f32 unk_1AC; + /* 0x01B0 */ f32 unk_1B0; + /* 0x01B4 */ f32 unk_1B4; + /* 0x01B8 */ UNK_TYPE1 unk1B8[4]; + /* 0x01BC */ f32 unk_1BC; + /* 0x01C0 */ f32 unk_1C0; + /* 0x01C4 */ UNK_TYPE1 unk1C4[4]; + /* 0x01C8 */ u8 unk_1C8; + /* 0x01C9 */ u8 unk_1C9; + /* 0x01CA */ s16 unk_1CA; + /* 0x01CC */ f32 unk_1CC; + /* 0x01D0 */ f32 unk_1D0; + /* 0x01D4 */ f32 unk_1D4; + /* 0x01D8 */ f32 unk_1D8; + /* 0x01DC */ f32 unk_1DC; + /* 0x01E0 */ f32 unk_1E0; + /* 0x01E4 */ f32 unk_1E4; + /* 0x01E8 */ UNK_TYPE1 unk1E8[0x15]; + /* 0x01FD */ u8 unk_1FD; + /* 0x01FE */ u8 unk_1FE; + /* 0x01FF */ u8 unk_1FF; + /* 0x0200 */ u8 unk_200[0x800]; + /* 0x0A00 */ s16 unk_A00; + /* 0x0A04 */ Vec3f unk_A04; + /* 0x0A10 */ Vec3f unk_A10; + /* 0x0A1C */ Vec3f unk_A1C; + /* 0x0A28 */ f32 unk_A28; + /* 0x0A2C */ f32 unk_A2C; } Boss06; // size = 0xA30 extern const ActorInit Boss_06_InitVars; diff --git a/src/overlays/actors/ovl_En_Knight/z_en_knight.h b/src/overlays/actors/ovl_En_Knight/z_en_knight.h index 00c48db914..8191b13a20 100644 --- a/src/overlays/actors/ovl_En_Knight/z_en_knight.h +++ b/src/overlays/actors/ovl_En_Knight/z_en_knight.h @@ -9,9 +9,21 @@ typedef void (*EnKnightActionFunc)(struct EnKnight*, GlobalContext*); typedef struct EnKnight { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x2DC]; + /* 0x0144 */ s16 unk_144; + /* 0x0146 */ char unk_146[0x2]; + /* 0x0148 */ s8 unk_148; + /* 0x0149 */ char pad149[8]; + /* 0x0151 */ s8 unk_151; + /* 0x0152 */ char pad152[1]; + /* 0x0153 */ u8 unk_153; + /* 0x0154 */ u8 unk_154; + /* 0x0155 */ char pad155[0x2CB]; /* 0x0420 */ EnKnightActionFunc actionFunc; - /* 0x0424 */ char unk_424[0x2B0]; + /* 0x0424 */ char unk_424[0x25C]; + /* 0x0680 */ u8 unk_680; + /* 0x0681 */ char pad681[9]; + /* 0x068A */ s16 unk_68A; + /* 0x068C */ char pad68C[0x48]; } EnKnight; // size = 0x6D4 extern const ActorInit En_Knight_InitVars; diff --git a/undefined_syms.txt b/undefined_syms.txt index 0f9790c65e..8e0d134b06 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -880,7 +880,6 @@ D_06018CF0 = 0x06018CF0; D_06018DE0 = 0x06018DE0; D_06019360 = 0x06019360; D_060193B0 = 0x060193B0; -D_06019490 = 0x06019490; // ovl_Boss_07