diff --git a/include/enums.h b/include/enums.h index 7c1df326..4b51e6c8 100644 --- a/include/enums.h +++ b/include/enums.h @@ -164,9 +164,8 @@ enum bkprog_e{ // {index=0x99, type="Prog", level=6, name="1st Time Past 50 ND Text"}, // {index=0x9B, type="Prog", level=6, name="CC WS Eyes Active"}, - // {index=0x9C, type="Prog", level=6, name="CC WS Left Eye Pressed"}, - // {index=0x9D, type="Prog", level=6, name="CC WS Right Eye Pressed"}, - // {index=0x9E, type="Prog", level=6, name="Crypt Coffin Lid Open"}, + BKPROG_9C_LAIR_CC_WITCH_SWITCH_LEFT_EYE_PRESSED = 0x9C, + BKPROG_9D_LAIR_CC_WITCH_SWITCH_RIGHT_EYE_PRESSED = 0x9D, BKPROG_9E_CRYPT_COFFIN_LID_OPEN = 0x9E, BKPROG_A1_STATUE_HAT_OPEN = 0xA1, diff --git a/include/functions.h b/include/functions.h index 694dfda1..457f911b 100644 --- a/include/functions.h +++ b/include/functions.h @@ -166,7 +166,7 @@ Actor *func_802C8C04(s32 position[3], s32 yaw, ActorInfo* actorInfo, u32 flags); Actor *marker_getActor(ActorMarker *); f32 time_getDelta(void); -void jiggySpawn(u32 indx, f32 pos[3]); +void jiggySpawn(enum jiggy_e jiggy_id, f32 pos[3]); struct3s *func_802F8264(s32 arg0); struct6s *func_802F8BE0(s32 arg0); diff --git a/include/structs.h b/include/structs.h index 4b1b1d54..aa100af5 100644 --- a/include/structs.h +++ b/include/structs.h @@ -857,4 +857,13 @@ typedef struct { // u8 pad31[3]; }Struct80s; + +typedef struct { + u8 pad0[4]; + struct actor_marker_s *marker; + f32 position[3]; + void (*unk14)(struct actor_s *, struct actor_marker_s *); + struct actor_marker_s *unk18; +}Struct81s; + #endif diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 40d7f44e..aefdcc8c 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core2 - 75.2473% - 75.2473% + 75.5318% + 75.5318% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 09d1c91e..680502b8 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 80.5899% - 80.5899% + 80.7531% + 80.7531% \ No newline at end of file diff --git a/src/core2/code_9C170.c b/src/core2/code_9C170.c index 176b98d8..34534680 100644 --- a/src/core2/code_9C170.c +++ b/src/core2/code_9C170.c @@ -42,7 +42,7 @@ void func_80323230(void){} void func_80323238(void){} -// BREAK ??? +// =============================================BREAK ??? extern f32 func_80258708(f32 [3], f32[3]); extern f32 ml_vec3f_distance_squared(f32 [3], f32 [3]); @@ -79,7 +79,6 @@ f32 func_803232AC(f32 *arg0, f32 arg1, f32 arg2, s32 arg3, f32 arg4) { func_80341180(arg2, arg3, 3, arg0, sp60); var_f22 += func_80258708(sp6C, sp60); return var_f22; - } f32 func_803233F8(struct56s *arg0) { diff --git a/src/core2/code_ABC00.c b/src/core2/code_ABC00.c index 0c5a232e..a47fee47 100644 --- a/src/core2/code_ABC00.c +++ b/src/core2/code_ABC00.c @@ -2,33 +2,207 @@ #include "functions.h" #include "variables.h" +extern void func_80347B54(Struct81s *); +extern void func_80347B80(Struct81s *); +extern void func_80347C5C(Struct81s *, Gfx **, Mtx **, Vtx **); +extern void func_80347C70(Struct81s *); -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_ABC00/func_80332B90.s") +extern void func_80347CC8(Struct81s *); +extern void func_80347CF4(Struct81s *); +extern void func_80347DD0(Struct81s *, Gfx **, Mtx **, Vtx **); +extern void func_80347DE4(Struct81s *); -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_ABC00/func_80332BB0.s") -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_ABC00/func_80332BEC.s") +typedef struct { + void (*unk0)(void **); + void (*unk4)(void **); + void (*unk8)(void **, Gfx**, Mtx **, Vtx **); + void (*unkC)(void **); + Struct81s unk10; +}Struct_core2_ABC00_0; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_ABC00/func_80332CCC.s") +void func_803331D8(enum jiggy_e, f32[3]); +void func_803332D0(Actor *); -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_ABC00/func_80332D98.s") +/* .data */ +extern u8 D_8036E830; +extern Struct_core2_ABC00_0 D_8036E834[]; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_ABC00/func_80332E08.s") +/* .bss */ +extern s32 D_80383560; +extern s32 D_80383564; +extern s32 D_80383568; +extern s32 D_8038356C; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_ABC00/func_80332F4C.s") +/* .code */ +void func_80332B90(void){ + func_8024BD08(1); +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_ABC00/func_8033301C.s") +void func_80332BB0(void) { + timedFunc_set_0(1.0f, func_80332B90); + func_8025A55C(-1, 4000, 5); +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_ABC00/jiggySpawn.s") +void func_80332BEC(enum map_e map_id) { + s32 temp_a2; + s32 temp_at; + s32 temp_hi; + s32 temp_lo; + s32 temp_t4; + s32 var_a1; + s32 var_v1; + s32 var_v0; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_ABC00/func_803331D8.s") + var_v1 = (map_getLevel(map_id) - 1) % (D_80383568 = 0xA); + var_a1 = MAX(0, var_v1); + D_80383560 = var_a1 * 0xA; + D_80383564 = (var_a1 + 1) * 0xA; + for(D_8038356C = D_80383560; D_8038356C < D_80383564; D_8038356C++){ + D_8036E834[D_8038356C].unk10.marker = NULL; + } + D_8036E830 = 0; +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_ABC00/func_80333270.s") +void func_80332CCC(void) { + Actor **temp_v0; + s32 i; + temp_v0 = func_80326FC0(); + for(D_8038356C = 0; temp_v0[D_8038356C] != NULL; D_8038356C++){ + if(!temp_v0[D_8038356C]->unk44_2){ + D_8036E834[func_802C8088(temp_v0[D_8038356C]) - 1].unk10.marker = temp_v0[D_8038356C]->marker; + } + } +} + + +void func_80332D98(enum map_e map_id, enum jiggy_e jiggy_id, enum bkprog_e flag_id, s32 arg3) { + f32 sp1C[3]; + + if ((map_get() == map_id) + && func_8031FF1C(flag_id) + && !jiggyscore_isSpawned(jiggy_id) + && func_80304E24(arg3, sp1C) + ) { + func_803331D8(jiggy_id, sp1C); + } +} + +void func_80332E08(void) { + s32 temp_t0; + s32 var_v0; + void *temp_v1; + + for(D_8038356C = D_80383560; D_8038356C < D_80383564; D_8038356C++) { + if (D_8036E834[D_8038356C].unk10.marker != NULL) { + D_8036E834[D_8038356C].unk4(&D_8036E834[D_8038356C].unk10); + var_v0 = D_8038356C; + } + } + func_80332D98(MAP_69_GL_MM_LOBBY, JIGGY_34_LAIR_MM_WITCH_SWITCH, BKPROG_18_MM_WITCH_SWITCH_JIGGY_SPAWNED, 0x205); + func_80332D98(MAP_6F_GL_FP_LOBBY, JIGGY_39_LAIR_MMM_WITCH_SWITCH, BKPROG_19_MMM_WITCH_SWITCH_JIGGY_SPAWNED, 0x207); + func_80332D98(MAP_6D_GL_TTC_LOBBY, JIGGY_36_LAIR_TTC_WITCH_SWITCH, BKPROG_1A_TTC_WITCH_SWITCH_JIGGY_SPAWNED, 0x209); + func_80332D98(MAP_76_GL_640_NOTE_DOOR, JIGGY_3B_LAIR_RBB_WITCH_SWITCH, BKPROG_1C_RBB_WITCH_SWITCH_JIGGY_SPAWNED, 0x20C); + func_80332D98(MAP_79_GL_CCW_LOBBY, JIGGY_3C_LAIR_CCW_WITCH_SWITCH, BKPROG_46_CCW_WITCH_SWITCH_JIGGY_SPAWNED, 0x238); + if ((D_8036E830 == 0) && func_8031FF1C(BKPROG_9C_LAIR_CC_WITCH_SWITCH_LEFT_EYE_PRESSED)) { + func_80332D98(MAP_6A_GL_TTC_AND_CC_PUZZLE, JIGGY_35_LAIR_CC_WITCH_SWITCH, BKPROG_9D_LAIR_CC_WITCH_SWITCH_RIGHT_EYE_PRESSED, 0x190); + } + D_8036E830 = 1; +} + +void func_80332F4C(Gfx **gfx, Mtx **mtx, Vtx **vtx) { + for(D_8038356C = D_80383560; D_8038356C < D_80383564; D_8038356C++) { + if (D_8036E834[D_8038356C].unk10.marker != NULL) { + D_8036E834[D_8038356C].unk8(&D_8036E834[D_8038356C].unk10, gfx, mtx, vtx); + } + } +} + +void func_8033301C(void) { + for(D_8038356C = D_80383560; D_8038356C < D_80383564; D_8038356C++) { + if (D_8036E834[D_8038356C].unk10.marker != NULL) { + func_803332D0(marker_getActor(D_8036E834[D_8038356C].unk10.marker)); + } + } +} + +void jiggySpawn(enum jiggy_e jiggy_id, f32 pos[3]) { + Struct_core2_ABC00_0 *temp_v0; + + jiggy_id = ((jiggy_id <= 0) || (jiggy_id >= (D_80383568 * 10))) ? 10 : jiggy_id; + temp_v0 = &D_8036E834[jiggy_id - 1]; + if (D_8036E834[jiggy_id - 1].unk10.marker == NULL) { + temp_v0->unk10.position[0] = pos[0]; + temp_v0->unk10.position[1] = pos[1]; + temp_v0->unk10.position[2] = pos[2]; + temp_v0->unk0(&temp_v0->unk10); + jiggyscore_setSpawned(jiggy_id, TRUE); + if (!jiggyscore_isCollected(jiggy_id) && (jiggy_id != 0x3E) && (jiggy_id != 0xB)) { + func_8024BD08(0); + func_8025A55C(0, 4000, 5); + func_8025A6EC(COMUSIC_3D_JIGGY_SPAWN, 0x7FFF); + timedFunc_set_0(3.5f, func_80332BB0); + } + } +} + +void func_803331D8(enum jiggy_e jiggy_id, f32 arg1[3]) { + jiggy_id = ((jiggy_id <= 0) || (jiggy_id >= (D_80383568 * 10))) ? JIGGY_A_MM_CONGA : jiggy_id; + + D_8036E834[jiggy_id - 1].unk10.position[0] = arg1[0]; + D_8036E834[jiggy_id - 1].unk10.position[1] = arg1[1]; + D_8036E834[jiggy_id - 1].unk10.position[2] = arg1[2]; + D_8036E834[jiggy_id - 1].unk0(&D_8036E834[jiggy_id - 1].unk10); + jiggyscore_setSpawned(jiggy_id, TRUE); +} + +void func_80333270(enum jiggy_e jiggy_id, f32 position[3], void (*method)(Actor *, ActorMarker *), ActorMarker *other_marker) { + Struct_core2_ABC00_0 *ptr; + + ptr = &D_8036E834[jiggy_id - 1]; + jiggySpawn(jiggy_id, position); + ptr->unk10.unk14 = method; + ptr->unk10.unk18 = other_marker; +} + +void func_803332D0(Actor *); #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_ABC00/func_803332D0.s") -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_ABC00/func_80333334.s") -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_ABC00/func_80333388.s") +void func_80333334(enum jiggy_e jiggy_id) { + Struct_core2_ABC00_0 *temp_v0; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_ABC00/func_803333DC.s") + temp_v0 = &D_8036E834[jiggy_id - 1]; + temp_v0->unk0 = func_80347B54; + temp_v0->unk4 = func_80347B80; + temp_v0->unk8 = func_80347C5C; + temp_v0->unkC = func_80347C70; +} + +void func_80333388(enum jiggy_e jiggy_id) { + Struct_core2_ABC00_0 *temp_v0; + + temp_v0 = &D_8036E834[jiggy_id - 1]; + temp_v0->unk0 = func_80347CC8; + temp_v0->unk4 = func_80347CF4; + temp_v0->unk8 = func_80347DD0; + temp_v0->unkC = func_80347DE4; + +} + +void func_803333DC(Struct81s *arg0, Actor *arg1) { + s32 sp20; + + arg0->marker = arg1->marker; + if (arg0->unk14 != NULL) { + arg0->unk14(arg1, arg0->unk18); + } + func_803300D8(arg1->marker, func_803332D0); + sp20 = ((s32) ((s32)arg0 - (s32)&D_8036E834) / 0x2C) + 1; + func_802C80B4(arg1, sp20); + if ((sp20 == JIGGY_49_CCW_EYRIE) || (sp20 == JIGGY_39_LAIR_MMM_WITCH_SWITCH) || (sp20 == JIGGY_3C_LAIR_CCW_WITCH_SWITCH)) { + arg1->marker->unk40_21 = TRUE; + arg1->marker->unk40_20 = TRUE; + } +} diff --git a/src/core2/code_BEF20.c b/src/core2/code_BEF20.c index f4894b67..df84d79b 100644 --- a/src/core2/code_BEF20.c +++ b/src/core2/code_BEF20.c @@ -426,12 +426,35 @@ void func_8034798C(void){ #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_80347AA8.s") -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_80347B10.s") +/// =============== BREAK????? +extern void func_80329904(ActorMarker *, s32, f32 *); -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_80347B54.s") +void func_80347B10(Struct81s *arg0){ + Actor *actor; + actor = func_802C937C(0x10, arg0->position); + actor->unk54 = 3.0f; + func_803333DC(arg0, actor); +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_80347B80.s") +void func_80347B54(Struct81s *arg0){ + func_802C3C88((GenMethod_1)func_80347B10, reinterpret_cast(s32, arg0)); +} -void func_80347C5C(s32 arg0, s32 arg1, s32 arg2, s32 arg3){} +void func_80347B80(Struct81s *arg0) { + Actor *sp1C; + Actor *temp_v0; -void func_80347C70(s32 arg0){} \ No newline at end of file + sp1C = marker_getActor(arg0->marker); + if (sp1C->unk54 > 0.0) { + if (randf() < ((sp1C->unk54 / 3.0) * 2)) { + func_8033E73C(arg0->marker, 5, func_80329904); + func_8033E3F0(0xF, ((ActorMarker *)arg0->marker)->unk14_21); + // func_8033E3F0(0xF, arg0->marker->unk14_21); + } + sp1C->unk54 -= time_getDelta(); + } +} + +void func_80347C5C(Struct81s *arg0, Gfx **arg1, Mtx **arg2, Vtx **arg3){} + +void func_80347C70(Struct81s *arg0){} \ No newline at end of file