diff --git a/src/boss/mar/AFC4.c b/src/boss/mar/AFC4.c index e7ea9c34d4..df51836e07 100644 --- a/src/boss/mar/AFC4.c +++ b/src/boss/mar/AFC4.c @@ -1,6 +1,8 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include +#include "mar.h" + extern Dialogue g_Dialogue; #include "../../st/cutscene_unk1.h" @@ -21,4 +23,49 @@ INCLUDE_ASM("boss/mar/nonmatchings/AFC4", func_us_8018B74C); INCLUDE_ASM("boss/mar/nonmatchings/AFC4", EntityMariaCutscene); -INCLUDE_ASM("boss/mar/nonmatchings/AFC4", func_us_8018C90C); +// func_psp_092467F8 +void func_us_8018C90C(Entity* self) { + Entity* player; + Tilemap* tilemap; // unused but shows up in the psp code. + + tilemap = &g_Tilemap; + player = &PLAYER; + + switch (self->step) { + case 0: + InitializeEntity(D_80180A60); + D_8003C8B8 = 0; + g_unkGraphicsStruct.unk0 = 1; + g_Player.padSim = PAD_RIGHT; + g_Player.D_80072EFC = 1; + break; + case 1: + if ((player->posX.i.hi >= 0x21) && !(g_CutsceneFlags & 1)) { + g_CutsceneFlags |= 1; + } + if (player->posX.i.hi >= 0xB1) { + g_Player.padSim = PAD_LEFT; + self->step++; + } else { + g_Player.padSim = PAD_RIGHT; + } + g_Player.D_80072EFC = 1; + break; + case 2: + if (g_CutsceneFlags & 2) { + D_8003C8B8 = 1; + + if (g_unkGraphicsStruct.unk0) { + g_unkGraphicsStruct.unk0 = 0; + } + + DestroyEntity(self); + g_Statues[LEFT_STATUE] ^= 1; // suspicious, everywhere else we're + // treating this like a boolean. + } + + g_Player.padSim = 0; + g_Player.D_80072EFC = 1; + break; + } +} diff --git a/src/boss/mar/mar.h b/src/boss/mar/mar.h index b571338bba..50f2993d3d 100644 --- a/src/boss/mar/mar.h +++ b/src/boss/mar/mar.h @@ -45,5 +45,6 @@ typedef enum Statues { extern u16 g_eInitGeneric2[]; extern s32 D_800973FC; extern u16 g_Statues[]; +extern u16 D_80180A60[]; #endif