From 35ff7f1d7e6055f68957ea46967e23ae309ac60d Mon Sep 17 00:00:00 2001 From: Donkey Kong Date: Sat, 4 May 2024 10:07:29 +0930 Subject: [PATCH] 39.9866% --- include/functions.h | 5 +- progress/progress.global_asm.csv | 2 +- progress/progress.total.csv | 2 +- progress/progress_global_asm.svg | 4 +- progress/progress_total.svg | 6 +- src/bonus/code_2690.c | 1 + src/global_asm/code_936B0.c | 4 +- src/global_asm/code_B2CE0.c | 174 ++++++++++++++++++++++-- src/global_asm/code_B7490.c | 73 +++++------ src/global_asm/code_BA790.c | 2 +- src/global_asm/code_C2A90.c | 219 ++++++++++++++++++++++++++++++- src/global_asm/code_CEAE0.c | 2 +- src/global_asm/code_D78D0.c | 196 +++++++++++++++++++++------ src/menu/code_1AF0.c | 2 +- 14 files changed, 586 insertions(+), 106 deletions(-) diff --git a/include/functions.h b/include/functions.h index 5537858..2f24033 100644 --- a/include/functions.h +++ b/include/functions.h @@ -899,7 +899,7 @@ s32 func_global_asm_806D0964(s32 arg0, u8 playerIndex); void func_global_asm_806D09E8(Actor *arg0); void func_global_asm_806D0A54(Actor *arg0, s32 arg1, s32 arg2); void func_global_asm_806D0A84(void); -void func_global_asm_806D0EBC(s32 arg0); +void func_global_asm_806D0EBC(Actor *arg0); s16 func_global_asm_806D1080(f32 arg0, f32 arg1); s32 func_global_asm_806D10D0(Actor *arg0); void func_global_asm_806D1110(void); @@ -2349,7 +2349,7 @@ s32 func_global_asm_80631EB8(u16); Gfx *func_global_asm_8070068C(Gfx *); void func_bonus_800264E0(u8 arg0, u8 arg1); void func_bonus_800265C0(u8 arg0, u8 arg1); -s32 func_global_asm_8072D714(Actor*, s32); +void func_global_asm_8072D714(Actor*, s32); void func_global_asm_8072B7CC(s32); Gfx *func_race_8002CAC8(Gfx *dl, Actor *arg1, RaceAdditionalActorData *arg2); void func_global_asm_806BFBF4(void); @@ -2444,6 +2444,7 @@ void func_global_asm_8066466C(void); // TODO: Where is the best place to put this so it's available everywhere and doesn't conflict with internal libultra/gu stuff? #define ABS(d) (((d) > 0) ? (d) : -(d)) +#define ABS_DIFF(a, b) (((b) < (a)) ? ((a) - (b)) : (-((a) - (b)))) #define TWO_PI 6.28318548202514648 #endif diff --git a/progress/progress.global_asm.csv b/progress/progress.global_asm.csv index bb274c3..0483f19 100644 --- a/progress/progress.global_asm.csv +++ b/progress/progress.global_asm.csv @@ -2133,7 +2133,7 @@ us,asm,func_global_asm_8060042C,40,yes us,asm,func_global_asm_806E8BA4,88,yes us,asm,func_global_asm_8071F660,248,no us,asm,func_global_asm_806DC410,1644,yes -us,asm,func_global_asm_806BE8BC,2396,no +us,asm,func_global_asm_806BE8BC,2396,yes us,asm,func_global_asm_8064D1E8,560,no us,asm,func_global_asm_8069DA54,444,yes us,asm,func_global_asm_80676D00,460,yes diff --git a/progress/progress.total.csv b/progress/progress.total.csv index da8c723..c650621 100644 --- a/progress/progress.total.csv +++ b/progress/progress.total.csv @@ -2133,7 +2133,7 @@ us,asm,func_global_asm_8060042C,40,yes us,asm,func_global_asm_806E8BA4,88,yes us,asm,func_global_asm_8071F660,248,no us,asm,func_global_asm_806DC410,1644,yes -us,asm,func_global_asm_806BE8BC,2396,no +us,asm,func_global_asm_806BE8BC,2396,yes us,asm,func_global_asm_8064D1E8,560,no us,asm,func_global_asm_8069DA54,444,yes us,asm,func_global_asm_80676D00,460,yes diff --git a/progress/progress_global_asm.svg b/progress/progress_global_asm.svg index e9a4dbd..b854f37 100644 --- a/progress/progress_global_asm.svg +++ b/progress/progress_global_asm.svg @@ -17,7 +17,7 @@ global_asm - 39.2006% - 39.2006% + 39.3952% + 39.3952% diff --git a/progress/progress_total.svg b/progress/progress_total.svg index cf088b6..2c595f4 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ Donkey Kong 64 (US) - 39.8412% - 39.8412% + 39.9866% + 39.9866% diff --git a/src/bonus/code_2690.c b/src/bonus/code_2690.c index b02c29f..ab480b9 100644 --- a/src/bonus/code_2690.c +++ b/src/bonus/code_2690.c @@ -674,6 +674,7 @@ void func_bonus_80029E54(Actor *arg0) { // rodata, doable #pragma GLOBAL_ASM("asm/nonmatchings/bonus/code_2690/func_bonus_8002A010.s") +// rodata, doable #pragma GLOBAL_ASM("asm/nonmatchings/bonus/code_2690/func_bonus_8002A398.s") extern s16 D_bonus_8002D900; diff --git a/src/global_asm/code_936B0.c b/src/global_asm/code_936B0.c index 0e77a67..0dd0f0b 100644 --- a/src/global_asm/code_936B0.c +++ b/src/global_asm/code_936B0.c @@ -151,7 +151,7 @@ void func_global_asm_8068ECF4(s32 arg0, u8 arg1) { } } -// Jumptable +// Jumptable, matrix #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_936B0/func_global_asm_8068EF54.s") #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_936B0/func_global_asm_8068F72C.s") @@ -1121,7 +1121,7 @@ s32 func_global_asm_806951B0(Actor *arg0) { return FALSE; } -// doable +// doable, matrix #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_936B0/func_global_asm_806951E8.s") void func_global_asm_80695724(f32, u8); diff --git a/src/global_asm/code_B2CE0.c b/src/global_asm/code_B2CE0.c index 204129c..4d35067 100644 --- a/src/global_asm/code_B2CE0.c +++ b/src/global_asm/code_B2CE0.c @@ -107,9 +107,10 @@ void func_global_asm_8072C918(s16, s16, s16); void func_global_asm_8072A450(void); // extern u8 func_global_asm_8072D13C(u8, s32); // extern +void func_global_asm_806A5C60(Actor *); // extern + /* void func_global_asm_806AE588(void) { - s32 temp; initializeCharacterSpawnerActor(); if (!(current_actor_pointer->object_properties_bitfield & 0x10)) { func_global_asm_8072B79C(0x1FD, 0x1FB, 0x1FC); @@ -225,24 +226,14 @@ void func_global_asm_806AE588(void) { } // fallthrough case 0x10: - if (current_actor_pointer->control_state == 1) { - temp = 2; - } else { - temp = 0; - } - func_global_asm_80724E48(temp); + func_global_asm_80724E48(current_actor_pointer->control_state == 1 ? 2 : 0); func_global_asm_8072AB74(current_actor_pointer->control_state, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0, 0.0f); break; case 0x2: case 0x3: case 0x7: case 0x35: - if (current_actor_pointer->control_state == 0x35) { - temp = 2; - } else { - temp = 3; - } - func_global_asm_80724E48(temp); + func_global_asm_80724E48(current_actor_pointer->control_state == 0x35 ? 2 : 3); func_global_asm_8072AB74(current_actor_pointer->control_state, D_global_asm_807FDC90->unkA, D_global_asm_807FDC90->unkE, 0, 0.0f); break; case 0x37: @@ -403,9 +394,164 @@ void func_global_asm_806AFA60(u8 arg0) { } } -// Jumptable +// Jumptable, close, regalloc #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_B2CE0/func_global_asm_806AFB58.s") +/* +void func_global_asm_806AFB58(void) { + s32 cs; + + initializeCharacterSpawnerActor(); + if (!(current_actor_pointer->object_properties_bitfield & 0x10)) { + current_actor_pointer->unk146_s16 = -1; + func_global_asm_8072B79C(0x2D9, 0x2D7, 0x2D8); + func_global_asm_80724CA4(2, 1); + current_actor_pointer->unkEC = 0x1770; + } + if (((D_global_asm_807FBB70.unk200 == 9) || (D_global_asm_807FBB70.unk15 != 0)) && (current_actor_pointer->control_state != 0x37)) { + func_global_asm_8072D714(D_global_asm_807FBB70.unk1FC, 0x2DD); + D_global_asm_807FDC90->unk35 = 2; + current_actor_pointer->unk138 &= ~0x8000; + } else if ((D_global_asm_807FBB70.unk200 == 4) || (D_global_asm_807FBB70.unk200 == 5)) { + if (current_actor_pointer->unk146_s16 & 1) { + D_global_asm_807FDC90->unk1E = 0xF; + D_global_asm_807FDC90->unk1F = 0xF; + current_actor_pointer->unkEC = -1; + func_global_asm_806AE2B0(0xC2, 0x800, 1, 0x190); + last_spawned_actor->unk15F = 1; + func_global_asm_806AFA60(1); + } else if (current_actor_pointer->unk146_s16 & 2) { + func_global_asm_806AFA60(2); + } + current_actor_pointer->unk146_s16 *= 2; + func_global_asm_8072DEA8(0x2DC, 0x31, D_global_asm_807FBB70.unk1FC); + D_global_asm_807FDC90->unk26 = 0; + current_actor_pointer->unkB8 = 0.0f; + } + switch (current_actor_pointer->control_state) { + case 0x31: + if ((current_actor_pointer->control_state_progress != 0) || (current_actor_pointer->animation_state->unk0->unk24 == 0.0f)) { + func_global_asm_8072DE44(0x2D7); + } + func_global_asm_8072AB74(0, 0.0f, 0.0f, 0x4200, 0.0f); + cs = current_actor_pointer->control_state; + break; + case 0x11: + func_global_asm_80724E48(5); + switch (current_actor_pointer->control_state_progress) { + case 0: + func_global_asm_8072B324(current_actor_pointer, 0); + playActorAnimation(current_actor_pointer, 0x2D9); + current_actor_pointer->control_state_progress++; + // fallthrough + case 1: + func_global_asm_8072AB74(current_actor_pointer->control_state, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0x200, 0.0f); + if (current_actor_pointer->unkB8 < 1.0f) { + current_actor_pointer->control_state_progress++; + } + break; + case 2: + func_global_asm_8072A450(); + if (((rand() >> 0xF) % 1000) >= 0x3E4) { + func_global_asm_8072DE44(0x2D7); + } + break; + } + cs = current_actor_pointer->control_state; + break; + case 0x27: + if (current_actor_pointer->unkEC < 0xFFFF) { + func_global_asm_8072E1A4(0xA, D_global_asm_807FDC94); + } + func_global_asm_8072AB74(current_actor_pointer->control_state, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0x200, 0.0f); + switch (current_actor_pointer->control_state_progress) { + case 0: + func_global_asm_8072B324(current_actor_pointer, 0); + if ((current_actor_pointer->animation_state->scale[1] > 0.18) && (((rand() >> 0xF) % 1000) >= 0x1F5)) { + playActorAnimation(current_actor_pointer, 0x2DB); + } else { + playActorAnimation(current_actor_pointer, 0x2DA); + } + current_actor_pointer->control_state_progress = 1; + break; + case 2: + current_actor_pointer->unk132 = 2; + break; + case 3: + current_actor_pointer->unk132 = 1; + break; + case 4: + func_global_asm_8072DE44(0x2D7); + break; + } + cs = current_actor_pointer->control_state; + break; + case 0x1: + if (func_global_asm_8072E54C() != 0) { + current_actor_pointer->control_state = 0x11; + current_actor_pointer->control_state_progress = 0; + } + // fallthrough + case 0x23: + if ((D_global_asm_807FBB70.unk200 == 2) && (func_global_asm_8072DE10(current_actor_pointer->unkEC) != 0)) { + current_actor_pointer->control_state = 0x27; + current_actor_pointer->control_state_progress = 0; + } + // fallthrough + case 0x10: + func_global_asm_80724E48(current_actor_pointer->control_state == 1 ? 2 : 0); + func_global_asm_8072AB74(current_actor_pointer->control_state, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0, 0.0f); + cs = current_actor_pointer->control_state; + break; + case 0x2: + case 0x3: + case 0x7: + case 0x35: + func_global_asm_80724E48(current_actor_pointer->control_state == 0x35 ? 2 : 3); + func_global_asm_8072AB74(current_actor_pointer->control_state, D_global_asm_807FDC90->unkA, D_global_asm_807FDC90->unkE, 0, 0.0f); + cs = current_actor_pointer->control_state; + break; + case 0x37: + current_actor_pointer->y_rotation = func_global_asm_806CC190(current_actor_pointer->y_rotation, current_actor_pointer->unkEE, 7.0f); + switch (current_actor_pointer->control_state_progress) { + case 0: + func_global_asm_8072AB74(0x37, 0.0f, 0.0f, 0x202, 0.0f); + break; + case 1: + func_global_asm_806A5C60(current_actor_pointer); + current_actor_pointer->control_state_progress++; + // fallthrough + case 2: + func_global_asm_8072DC7C(8); + break; + case 3: + current_actor_pointer->control_state = 0x40; + break; + } + cs = current_actor_pointer->control_state; + break; + default: + func_global_asm_8072B7CC(0x2D7); + cs = current_actor_pointer->control_state; + break; + } + switch (current_actor_pointer->control_state) { + case 0x31: + case 0x37: + case 0x40: + break; + case 0x2: + case 0x3: + func_global_asm_8072D13C(1, cs); + // fallthrough + default: + func_global_asm_8072C918(0x6400, 0x2D7, 0x2D8); + break; + } + renderActor(current_actor_pointer, 0); +} +*/ + void func_global_asm_806B02EC(void) { initializeCharacterSpawnerActor(); if (!(current_actor_pointer->object_properties_bitfield & 0x10)) { diff --git a/src/global_asm/code_B7490.c b/src/global_asm/code_B7490.c index d890018..641de98 100644 --- a/src/global_asm/code_B7490.c +++ b/src/global_asm/code_B7490.c @@ -80,7 +80,7 @@ void func_global_asm_806B3420(void) { renderActor(current_actor_pointer, 0); } -// close +// close, switch case woes #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_B7490/func_global_asm_806B3680.s") s32 func_global_asm_8072AB74(u8, f32, f32, s32, f32); @@ -91,9 +91,9 @@ extern s32 D_global_asm_8071ABDC; extern f32 D_global_asm_8075B5C4; extern f32 D_global_asm_8075B5C8; extern f32 D_global_asm_8075B5CC; -extern f32 D_global_asm_8075B5D0; +extern f64 D_global_asm_8075B5D0; extern f32 D_global_asm_8075B5D8; -extern s32 D_global_asm_8075B5DC; +extern f32 D_global_asm_8075B5DC; void func_global_asm_8066E9EC(Actor*, s32, f32); u8 func_global_asm_8072D13C(u8 arg0, s32 arg1); @@ -151,43 +151,37 @@ void func_global_asm_806B3680(void) { func_global_asm_8072E1A4(0xA, D_global_asm_807FDC94); break; default: - if (current_actor_pointer->control_state != 0x27) { - func_global_asm_8072B7CC(0x32E); - } else { - switch (current_actor_pointer->control_state) { - case 0: - playSoundAtActorPosition(current_actor_pointer, 0x1C2, 0xFF, 0x7F, 0); - D_global_asm_807FDC90->unk30 = 2.0 * current_actor_pointer->animation_state->scale_y; - current_actor_pointer->control_state_progress++; - // fallthrough - case 1: - // i = 0; - if (current_actor_pointer->animation_state->scale_y < D_global_asm_807FDC90->unk30) { - func_global_asm_807248B0(current_actor_pointer, current_actor_pointer->animation_state->scale_y * D_global_asm_8075B5D0); - } else { - for (i = 0; i != 0xC; i++) { - func_global_asm_807149B8(1); - func_global_asm_807149FC(2); - func_global_asm_80714950(i + 0x0B020000); - func_global_asm_8071498C(func_global_asm_8071ABDC); - func_global_asm_80714998(1); - drawSpriteAtPosition(&D_global_asm_8072073C, 2.0 * current_actor_pointer->animation_state->scale_y, current_actor_pointer->x_position, current_actor_pointer->y_position, current_actor_pointer->z_position); - } - playSoundAtActorPosition(current_actor_pointer, 0x3D, 0xFF, 0x7F, 0); - playSoundAtPosition(current_actor_pointer->x_position, current_actor_pointer->y_position, current_actor_pointer->z_position, 0x35C, 0xFF, 0x7F, 0, 0x32, D_global_asm_8075B5D8, 0); - func_global_asm_8067E278(0, 1); - func_global_asm_8066E9EC(current_actor_pointer, 1, current_actor_pointer->ledge_info_pointer->unkC * sp54); - func_global_asm_8066EB40(current_actor_pointer, current_actor_pointer->ledge_info_pointer->unkC * sp54); - current_actor_pointer->object_properties_bitfield &= ~4; - current_actor_pointer->control_state_progress++; + switch (current_actor_pointer->control_state) { + case 0: + playSoundAtActorPosition(current_actor_pointer, 0x1C2, 0xFF, 0x7F, 0); + D_global_asm_807FDC90->unk30 = 2.0 * current_actor_pointer->animation_state->scale_y; + default: + current_actor_pointer->control_state_progress++; + break; + case 1: + if (current_actor_pointer->animation_state->scale_y < D_global_asm_807FDC90->unk30) { + func_global_asm_807248B0(current_actor_pointer, current_actor_pointer->animation_state->scale_y * D_global_asm_8075B5D0); + } else { + for (i = 0; i < 0xC; i++) { + func_global_asm_807149B8(1); + func_global_asm_807149FC(2); + func_global_asm_80714950(i + 0x0B020000); + func_global_asm_8071498C(func_global_asm_8071ABDC); + func_global_asm_80714998(1); + drawSpriteAtPosition(&D_global_asm_8072073C, 2.0 * current_actor_pointer->animation_state->scale_y, current_actor_pointer->x_position, current_actor_pointer->y_position, current_actor_pointer->z_position); } - break; - case 5: - current_actor_pointer->control_state = 0x40; - break; - default: + playSoundAtActorPosition(current_actor_pointer, 0x3D, 0xFF, 0x7F, 0); + playSoundAtPosition(current_actor_pointer->x_position, current_actor_pointer->y_position, current_actor_pointer->z_position, 0x35C, 0xFF, 0x7F, 0, 0x32, D_global_asm_8075B5D8, 0); + func_global_asm_8067E278(0, 1); + func_global_asm_8066E9EC(current_actor_pointer, 1, current_actor_pointer->ledge_info_pointer->unkC * sp54); + func_global_asm_8066EB40(current_actor_pointer, current_actor_pointer->ledge_info_pointer->unkC * sp54); + current_actor_pointer->object_properties_bitfield &= ~4; current_actor_pointer->control_state_progress++; - } + } + break; + case 5: + current_actor_pointer->control_state = 0x40; + break; } break; case 2: @@ -195,6 +189,9 @@ void func_global_asm_806B3680(void) { var_f12 = MIN(D_global_asm_807FDC90->unkC, current_actor_pointer->unkAC - current_actor_pointer->unk15E); func_global_asm_8072A920(current_actor_pointer->control_state, 0, D_global_asm_807FDC90->unkA, var_f12, D_global_asm_807FDC90->unkE, 0x1E, D_global_asm_8075B5DC, 100.0f, 0x2040); break; + case 0x27: + func_global_asm_8072B7CC(0x32E); + break; } switch (current_actor_pointer->control_state) { case 2: diff --git a/src/global_asm/code_BA790.c b/src/global_asm/code_BA790.c index 6937c19..40eeed0 100644 --- a/src/global_asm/code_BA790.c +++ b/src/global_asm/code_BA790.c @@ -2,7 +2,7 @@ #include "functions.h" -// Jumptable +// Jumptable, doable, switch case is not detected by mips2c #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_BA790/func_global_asm_806B5A90.s") void func_global_asm_806B63E0(void) { diff --git a/src/global_asm/code_C2A90.c b/src/global_asm/code_C2A90.c index 61a0bc9..30ab397 100644 --- a/src/global_asm/code_C2A90.c +++ b/src/global_asm/code_C2A90.c @@ -26,6 +26,17 @@ extern u8 D_global_asm_807FBDC4; extern s32 D_global_asm_807FBDC8[]; extern u16 D_global_asm_807FC930[]; +void func_global_asm_8061CAD8(void); // extern +void func_global_asm_8061CB08(void); +void func_global_asm_8061F510(s32, s32); // extern +void func_global_asm_8062217C(Actor *, s32); // extern +void func_global_asm_806A5DF0(s16 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, u8 arg5, s16 arg6, s32 arg7); +u8 func_global_asm_8072881C(u8 arg0, u32 *arg1); +void func_global_asm_8072A450(void); +u8 func_global_asm_8072D13C(u8 arg0, s32 arg1); +extern int func_global_asm_8068E474(); // TODO: Signature +extern int func_global_asm_806BE6F0(); // TODO: Signature + void func_global_asm_8061C518(Actor*, Actor*, s32, s32, s32, s32, s32, s32, s32, s32, f32); void func_global_asm_8061C600(Actor*, Actor*, s32, s32, s32, s32, s32, s32, s32, s32, f32); void func_global_asm_806BF920(void); @@ -247,8 +258,212 @@ Gfx *func_global_asm_806BE6F0(Gfx *dl, Actor *arg1) { } */ -// Jumptable -#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_C2A90/func_global_asm_806BE8BC.s") +void func_global_asm_806BE8BC(void) { + u8 sp37; + s16 j; + s16 i; + s16 var_v0; + + sp37 = isFlagSet(0xF8, FLAG_TYPE_PERMANENT); + initializeCharacterSpawnerActor(); + if (extra_player_info_pointer->unk1F0 & 0x100000) { + current_actor_pointer->control_state = 0x40; + return; + } + if (!(current_actor_pointer->object_properties_bitfield & 0x10)) { + func_global_asm_80724CA4(2, 1); + D_global_asm_807FDC98->unk46 |= 0x20; + playActorAnimation(current_actor_pointer, 0x306); + func_global_asm_80728950(0); + current_actor_pointer->control_state = 0x1E; + current_actor_pointer->control_state_progress = 0; + current_actor_pointer->unk15F = 0; + } + switch (current_actor_pointer->control_state) { + case 0x26: + playActorAnimation(current_actor_pointer, 0x307); + current_actor_pointer->control_state = 0x27; + current_actor_pointer->control_state_progress = 0; + break; + case 0x1E: + func_global_asm_80684850(1); + if (current_actor_pointer->shadow_opacity < 0xFF) { + current_actor_pointer->shadow_opacity += 5; + } + if (func_global_asm_80629148()) { + func_global_asm_8063DA40(0x1F, 3); + func_global_asm_80672C30(player_pointer); + func_global_asm_80726EE0(1); + D_global_asm_807FDC98->unk46 |= 4; + func_global_asm_806BE674(1); + func_global_asm_807289B0(0, 0); + if (sp37) { + func_global_asm_80641874(0x17, 0x14); + loadText(current_actor_pointer, 0x14, 1); + } else { + loadText(current_actor_pointer, 0x14, 0); + } + playActorAnimation(current_actor_pointer, 0x309); + current_actor_pointer->control_state = 0x1F; + current_actor_pointer->control_state_progress = 0; + } + break; + case 0x1F: + switch (current_actor_pointer->control_state_progress) { + case 0: + if (func_global_asm_80629148()) { + func_global_asm_8061CAD8(); + func_global_asm_8061CAD8(); + current_actor_pointer->control_state_progress++; + current_actor_pointer->unk168 = 0x78; + } + break; + case 1: + addActorToTextOverlayRenderArray(&func_global_asm_806BE6F0, current_actor_pointer, 3); + break; + case 2: + playSong(0xA9, 1.0f); + D_global_asm_807FBB64 |= 4; + func_global_asm_8061CB08(); + func_global_asm_8062217C(D_global_asm_807F5D10, 3); + playActorAnimation(current_actor_pointer, 0x302); + func_global_asm_8072B324(current_actor_pointer, (sp37 ? 1.5 : 1.0) * D_global_asm_807FDC9C->unkD); + current_actor_pointer->control_state = 2; + current_actor_pointer->control_state_progress = 0; + func_global_asm_8061F510(1, 0xA); + extra_player_info_pointer->unk1F4 |= 0x40; + break; + } + break; + case 0x27: + if (current_actor_pointer->control_state_progress == 0) { + func_global_asm_80602B60(0xA9, 0); + current_actor_pointer->object_properties_bitfield &= ~0x8000; + current_actor_pointer->shadow_opacity = 0xFF; + func_global_asm_806BE674(0); + playCutscene(current_actor_pointer, 0xF, 5); + current_actor_pointer->y_rotation = func_global_asm_80665DE0(player_pointer->x_position, player_pointer->z_position, current_actor_pointer->x_position, current_actor_pointer->z_position); + loadText(current_actor_pointer, 0x14, 4); + current_actor_pointer->control_state = 0x37; + current_actor_pointer->control_state_progress = 0; + current_actor_pointer->y_position = current_actor_pointer->floor; + } + break; + case 0x28: + switch (current_actor_pointer->control_state_progress) { + case 0: + func_global_asm_80602B60(0xA9, 0); + current_actor_pointer->object_properties_bitfield &= ~0x8000; + current_actor_pointer->shadow_opacity = 0xFF; + func_global_asm_806BE674(0); + playCutscene(current_actor_pointer, 0x1F, 1); + current_actor_pointer->y_rotation = func_global_asm_80665DE0(player_pointer->x_position, player_pointer->z_position, current_actor_pointer->x_position, current_actor_pointer->z_position); + playActorAnimation(current_actor_pointer, 0x308); + func_global_asm_8070E8DC(1); + if (sp37) { + loadText(current_actor_pointer, 0x14, 3); + } else { + loadText(current_actor_pointer, 0x14, 2); + } + current_actor_pointer->control_state_progress = 1; + current_actor_pointer->y_position = current_actor_pointer->floor; + break; + case 1: + if (func_global_asm_80629148()) { + if (sp37) { + func_global_asm_8063DA40(0x57, 0xA); + D_global_asm_807FDC90->unk1A |= 0x8000; + } else { + // Problem here + var_v0 = current_actor_pointer->y_rotation - 0x12C; + playSong(0x2F, 1.0f); + for (i = 0; i < 3; i++, var_v0 += 0x12C) { + func_global_asm_806A5DF0( + 0x35, + current_actor_pointer->x_position, + current_actor_pointer->y_position, + current_actor_pointer->z_position, + var_v0, + 0x63, + -1, + 0 + ); + } + } + setFlag(0xF8, TRUE, FLAG_TYPE_PERMANENT); + current_actor_pointer->control_state = 0x37; + current_actor_pointer->control_state_progress = 0; + current_actor_pointer->y_position = current_actor_pointer->floor; + } + break; + } + break; + case 0x37: + if (!(current_actor_pointer->object_properties_bitfield & 0x02000000)) { + func_global_asm_8072DC7C(2); + if (current_actor_pointer->control_state_progress != 0) { + D_global_asm_807FBB64 &= ~4; + extra_player_info_pointer->unk23F = 2; + func_global_asm_8061F510(1, 0); + extra_player_info_pointer->unk1F4 &= ~0x40; + func_global_asm_8072EC94(0x16, 0); + func_global_asm_80726EE0(2); + if (D_global_asm_807FDC90->unk1A & 0x8000) { + current_actor_pointer->control_state = 0x40; + } else { + if (current_actor_pointer->animation_state->unk64 != 0x308) { + func_global_asm_806ACC00(2); + } + func_global_asm_8063DA40(0x1F, 1); + current_actor_pointer->control_state = 0x3C; + } + } + } + break; + case 0x13: + playActorAnimation(current_actor_pointer, 0x305); + current_actor_pointer->y_velocity = 200.0f; + current_actor_pointer->control_state = 2; + current_actor_pointer->control_state_progress = 0; + // fallthrough + default: + if (current_actor_pointer->unk15F < 0x10U) { + addActorToTextOverlayRenderArray(&func_global_asm_8068E474, current_actor_pointer, 3); + } + if ((((rand() >> 0xF) % 1000) >= 0x3DF) && (current_actor_pointer->animation_state->unk64 == 0x302)) { + playActorAnimation(current_actor_pointer, (object_timer & 1) ? 0x303 : 0x304); + } + if (D_global_asm_807FBB70.unk0 != 0) { + if ((D_global_asm_807FBB70.unk1 >= D_global_asm_807506C0[current_actor_pointer->unk15F]) && (current_actor_pointer->unk15F < 0x10U)) { + if (D_global_asm_807FBB70.unk1 != D_global_asm_807506C0[current_actor_pointer->unk15F]) { + playActorAnimation(current_actor_pointer, 0x301); + current_actor_pointer->control_state = 0x27; + current_actor_pointer->control_state_progress = 0; + } else { + current_actor_pointer->unk15F++; + if (current_actor_pointer->unk15F >= 0x10U) { + func_global_asm_8072EC94(0x16, 1); + } + } + } + } + for (j = 0; j < D_global_asm_807FBB70.unk254; j++) { + if (D_global_asm_807FBB70.unk258[j] == 3) { + current_actor_pointer->control_state = 0x28; + current_actor_pointer->control_state_progress = 0; + } + } + func_global_asm_8072881C(0, &D_global_asm_807FDC90->unk28); + func_global_asm_8072AB74(current_actor_pointer->control_state, D_global_asm_807FDC90->unkA, D_global_asm_807FDC90->unkE, 0x10, 0.0f); + func_global_asm_8072D13C(current_actor_pointer->control_state, 0); + break; + } + if ((current_actor_pointer->animation_state->unk64 == 0x301) || (current_actor_pointer->animation_state->unk64 == 0x302)) { + func_global_asm_80724E48(0); + } + func_global_asm_8072A450(); + renderActor(current_actor_pointer, 0); +} // Jumptable #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_C2A90/func_global_asm_806BF218.s") diff --git a/src/global_asm/code_CEAE0.c b/src/global_asm/code_CEAE0.c index 4412e99..ea5437c 100644 --- a/src/global_asm/code_CEAE0.c +++ b/src/global_asm/code_CEAE0.c @@ -2099,7 +2099,7 @@ u8 func_global_asm_806D0DE4(Actor *arg0, Actor *arg1) { return var_v0 < var_v1 && var_a2; } -void func_global_asm_806D0EBC(s32 arg0) { +void func_global_asm_806D0EBC(Actor *arg0) { f32 phi_f12; f32 phi_f0; diff --git a/src/global_asm/code_D78D0.c b/src/global_asm/code_D78D0.c index 2e18f28..28ade59 100644 --- a/src/global_asm/code_D78D0.c +++ b/src/global_asm/code_D78D0.c @@ -2053,11 +2053,10 @@ extern f32 D_global_asm_80753AE0[]; /* void func_global_asm_806D8B08(void) { - f32 temp_f0; f32 temp_f14; - f32 temp_f2; + f32 temp_f0; - extra_player_info_pointer->unk24 += 1; + extra_player_info_pointer->unk24++; extra_player_info_pointer->unk2C = D_global_asm_80753AFC[D_global_asm_807FD584]; switch (current_actor_pointer->control_state_progress) { case 0: @@ -2065,7 +2064,7 @@ void func_global_asm_806D8B08(void) { temp_f14 = D_global_asm_80753A5C[D_global_asm_807FD584]; current_actor_pointer->y_velocity = func_global_asm_806CD898(current_actor_pointer->y_velocity, temp_f14, extra_player_info_pointer->unk1C); if (temp_f14 <= current_actor_pointer->y_velocity) { - if ((current_actor_pointer->unkB8 != 0.0f) || (extra_player_info_pointer->unk10 != 0)) { + if ((current_actor_pointer->unkB8 != 0) || (extra_player_info_pointer->unk10 != 0)) { current_actor_pointer->control_state_progress = 3; } else { current_actor_pointer->control_state_progress = 2; @@ -2077,27 +2076,25 @@ void func_global_asm_806D8B08(void) { break; case 1: handleInputsForControlState(0x4F); - func_global_asm_806CC638(0.0f); + func_global_asm_806CC638(0); if (extra_player_info_pointer->unk10 == 0) { current_actor_pointer->control_state_progress = 3; } - temp_f14 = (extra_player_info_pointer->unk10 / 7.5) + 1.0; + temp_f14 = (extra_player_info_pointer->unk10 / 7.5) + 1; if (current_actor_pointer->animation_state->unk48 < temp_f14) { - func_global_asm_80614D00(current_actor_pointer, temp_f14, 0.0f); + func_global_asm_80614D00(current_actor_pointer, temp_f14, 0); } else { func_global_asm_80614D00(current_actor_pointer, temp_f14, 15.0f); } func_global_asm_80684D98(2); - temp_f0 = current_actor_pointer->unkAC; - temp_f2 = D_global_asm_807538C8[D_global_asm_807FD584]; - if (temp_f0 < (temp_f2 + current_actor_pointer->y_position)) { - current_actor_pointer->y_position = temp_f0 - temp_f2; + if (current_actor_pointer->unkAC < (D_global_asm_807538C8[D_global_asm_807FD584] + current_actor_pointer->y_position)) { + current_actor_pointer->y_position = current_actor_pointer->unkAC - D_global_asm_807538C8[D_global_asm_807FD584]; } break; default: handleInputsForControlState(0x54); func_global_asm_806CC638(D_global_asm_80753A5C[D_global_asm_807FD584]); - if (current_actor_pointer->unkB8 != 0.0f) { + if (current_actor_pointer->unkB8 != 0) { extra_player_info_pointer->unk18 = 0; current_actor_pointer->control_state_progress = 3; } else { @@ -2112,7 +2109,7 @@ void func_global_asm_806D8B08(void) { break; case 3: handleInputsForControlState(0x50); - func_global_asm_806CC638(0.0f); + func_global_asm_806CC638(0); break; case 4: handleInputsForControlState(0x51); @@ -2120,27 +2117,27 @@ void func_global_asm_806D8B08(void) { extra_player_info_pointer->unk14 = current_actor_pointer->y_rotation; extra_player_info_pointer->unk38 = D_global_asm_80753AE0[D_global_asm_807FD584]; extra_player_info_pointer->unk10 = D_global_asm_80753A88[D_global_asm_807FD584]; - func_global_asm_806CC638(0.0f); - current_actor_pointer->control_state_progress += 1; + func_global_asm_806CC638(0); + current_actor_pointer->control_state_progress++; break; case 5: handleInputsForControlState(0x51); - func_global_asm_806CC638(0.0f); + func_global_asm_806CC638(0); break; case 6: handleInputsForControlState(0x52); - func_global_asm_806CC638(0.0f); + func_global_asm_806CC638(0); break; case 7: handleInputsForControlState(0x51); - func_global_asm_806CC638(0.0f); + func_global_asm_806CC638(0); break; case 8: handleInputsForControlState(0x53); - func_global_asm_806CC638(0.0f); + func_global_asm_806CC638(0); break; } - if ((current_actor_pointer->unkB8 == 0.0f) || (extra_player_info_pointer->unk18 != 0)) { + if ((current_actor_pointer->unkB8 == 0) || (extra_player_info_pointer->unk18 != 0)) { extra_player_info_pointer->unk50 = D_global_asm_80753A78[D_global_asm_807FD584]; func_global_asm_80614D00(current_actor_pointer, 0.5f, extra_player_info_pointer->unk50); current_actor_pointer->control_state_progress = 2; @@ -3325,23 +3322,23 @@ void func_global_asm_806DC410(void) { func_global_asm_806CC970(); } +// doable, switch case woes, float #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_D78D0/func_global_asm_806DCA7C.s") /* -// TODO: Doable, made good progress, not sure what's going on with case 1 void func_global_asm_806DCA7C(Actor **arg0, s32 arg1) { - f32 sp50; - f32 sp4C; - f32 sp44; - f32 sp40; - f32 sp3C; + f32 d; + f32 dy; + f32 x; + f32 y; + f32 z; f32 dx; f32 dz; s32 var_v0; s32 var_v1; - current_actor_pointer->object_properties_bitfield &= 0xFFBFFFFF; - current_actor_pointer->unk6A &= 0xFFBF; + current_actor_pointer->object_properties_bitfield &= ~0x400000; + current_actor_pointer->unk6A &= ~0x40; current_actor_pointer->z_rotation += (-current_actor_pointer->z_rotation * 0.1); switch (current_actor_pointer->control_state_progress) { case 0: @@ -3367,7 +3364,7 @@ void func_global_asm_806DCA7C(Actor **arg0, s32 arg1) { } func_global_asm_806DF5A0(¤t_actor_pointer->y_rotation, current_actor_pointer->unkEE, 0x78, 0x600); current_actor_pointer->y_velocity = extra_player_info_pointer->unk150; - current_actor_pointer->control_state_progress += 1; + current_actor_pointer->control_state_progress++; handleInputsForControlState(0x27); extra_player_info_pointer->unk30 /= 2; func_global_asm_806CC948(); @@ -3391,17 +3388,17 @@ void func_global_asm_806DCA7C(Actor **arg0, s32 arg1) { extra_player_info_pointer->unk4 = 150.0f; extra_player_info_pointer->unk38 = 150.0f; if (extra_player_info_pointer->unk158 != 0) { - getBonePosition(extra_player_info_pointer->unk158, 1, &sp44, &sp40, &sp3C); - dx = sp44 - current_player->x_position; - dz = sp3C - current_player->z_position; - sp4C = (sp40 - current_player->y_position) / (current_player->animation_state->scale_y * 0.166666666749999998); - sp50 = ((sqrtf((dx * dx) + (dz * dz)) / (current_player->animation_state->scale_y * 0.166666666749999998)) / current_player->unkB8) - 1.0f; - if (sp50 < 1.0f) { - sp50 = 1.0f; + getBonePosition(extra_player_info_pointer->unk158, 1, &x, &y, &z); + dx = x - current_player->x_position; + dz = z - current_player->z_position; + dy = (y - current_player->y_position) / (current_player->animation_state->scale_y * 0.166666666749999998); + d = ((sqrtf((dx * dx) + (dz * dz)) / (current_player->animation_state->scale_y * 0.166666666749999998)) / current_player->unkB8) - 1.0f; + if (d < 1.0f) { + d = 1.0f; } } - if ((extra_player_info_pointer->unk158 != 0) && (sp50 < 30.0f)) { - current_player->y_velocity = (((0.0 - (D_global_asm_80753CD0[D_global_asm_807FD584]) * 0.5 * (sp50 * sp50)) - sp4C)) / sp50; + if ((extra_player_info_pointer->unk158 != 0) && (d < 30.0f)) { + current_player->y_velocity = (((0.0 - (D_global_asm_80753CD0[D_global_asm_807FD584]) * 0.5 * (d * d)) - dy)) / d; current_player->y_acceleration = -0.001f; } else { extra_player_info_pointer->unk158 = 0; @@ -3795,6 +3792,129 @@ void func_global_asm_806DDAB0(void) { // Jumptable #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_D78D0/func_global_asm_806DE264.s") +/* +void func_global_asm_80614A64(Actor *); // extern + +void func_global_asm_806DE264(void) { + f32 z; + f32 y; + f32 x; + f32 var_f2; + f32 sp3C; + + current_actor_pointer->y_velocity = 0.0f; + current_actor_pointer->unkB8 = 0.0f; + handleInputsForControlState(1); + if (func_global_asm_806CFC90(current_actor_pointer, &sp3C, 1, 15.0f)) { + extra_player_info_pointer->unkF0_f32 = sp3C; + } + if (ABS_DIFF(extra_player_info_pointer->unkF4_f32, extra_player_info_pointer->unkF0_f32) > 20.0) { + func_global_asm_806CFF1C(current_actor_pointer); + renderActor(current_actor_pointer, 0); + return; + } + extra_player_info_pointer->unkF4_f32 = extra_player_info_pointer->unkF0_f32; + current_actor_pointer->object_properties_bitfield |= 0x08000000; + renderActor(current_actor_pointer, 0); + func_global_asm_80678DD8(current_actor_pointer); + switch (current_actor_pointer->control_state_progress) { + case 0: + switch (current_actor_pointer->unk58) { + case ACTOR_LANKY: + if (current_actor_pointer->animation_state->unk0->unk4 < 25.0f) { + getBonePosition(current_actor_pointer, 7, &x, &y, &z); + current_actor_pointer->y_position = extra_player_info_pointer->unkF0_f32 - (y - current_actor_pointer->y_position); + } + if (current_actor_pointer->animation_state->unk0->unk4 < 25.0f) { + current_actor_pointer->x_position = extra_player_info_pointer->unkE0; + current_actor_pointer->z_position = extra_player_info_pointer->unkE4; + } else if (current_actor_pointer->animation_state->unk0->unk4 < 31.0f) { + current_actor_pointer->unkEE = current_actor_pointer->y_rotation; + current_actor_pointer->unkB8 = 70.0f; + current_actor_pointer->y_position = extra_player_info_pointer->unkF0_f32; + } else { + current_actor_pointer->y_position = extra_player_info_pointer->unkF0_f32; + } + break; + case ACTOR_TINY: + if (current_actor_pointer->animation_state->unk0->unk4 < 17.0f) { + getBonePosition(current_actor_pointer, 7, &x, &y, &z); + current_actor_pointer->y_position = extra_player_info_pointer->unkF0_f32 - (y - current_actor_pointer->y_position); + } + if (current_actor_pointer->animation_state->unk0->unk4 < 19.0f) { + current_actor_pointer->x_position = extra_player_info_pointer->unkE0; + current_actor_pointer->z_position = extra_player_info_pointer->unkE4; + } else if (current_actor_pointer->animation_state->unk0->unk4 < 29.0f) { + current_actor_pointer->unkEE = current_actor_pointer->y_rotation; + current_actor_pointer->unkB8 = 40.0f; + current_actor_pointer->y_position = extra_player_info_pointer->unkF0_f32; + } else { + current_actor_pointer->y_position = extra_player_info_pointer->unkF0_f32; + } + break; + case ACTOR_DK: + getBonePosition(current_actor_pointer, 7, &x, &y, &z); + current_actor_pointer->y_position = extra_player_info_pointer->unkF0_f32 - (y - current_actor_pointer->y_position); + if (current_actor_pointer->animation_state->unk0->unk4 > 16.0f) { + current_actor_pointer->unkEE = current_actor_pointer->y_rotation; + current_actor_pointer->y_position = extra_player_info_pointer->unkF0_f32; + current_actor_pointer->unkB8 = 30.0f; + } else { + current_actor_pointer->x_position = extra_player_info_pointer->unkE0; + current_actor_pointer->z_position = extra_player_info_pointer->unkE4; + } + break; + case ACTOR_CHUNKY: + case ACTOR_KRUSHA: + if (current_actor_pointer->animation_state->unk0->unk4 < 18.0f) { + getBonePosition(current_actor_pointer, 7, &x, &y, &z); + current_actor_pointer->y_position = extra_player_info_pointer->unkF0_f32 - (y - current_actor_pointer->y_position); + current_actor_pointer->x_position = extra_player_info_pointer->unkE0; + current_actor_pointer->z_position = extra_player_info_pointer->unkE4; + } else if (current_actor_pointer->animation_state->unk0->unk4 < 26.0f) { + current_actor_pointer->unkEE = current_actor_pointer->y_rotation; + current_actor_pointer->unkB8 = 50.0f; + current_actor_pointer->y_position = extra_player_info_pointer->unkF0_f32; + } else { + if (ABS_DIFF(current_actor_pointer->floor, extra_player_info_pointer->unkF0_f32) >= 20.0) { + func_global_asm_806CFF1C(current_actor_pointer); + } else { + current_actor_pointer->y_position = current_actor_pointer->floor; + } + } + break; + default: + getBonePosition(current_actor_pointer, 7, &x, &y, &z); + current_actor_pointer->y_position = extra_player_info_pointer->unkF0_f32 - (y - current_actor_pointer->y_position); + if (current_actor_pointer->animation_state->unk0->unk4 > 14.0f) { + current_actor_pointer->unkEE = current_actor_pointer->y_rotation; + current_actor_pointer->unkB8 = 10.0f; + current_actor_pointer->y_position = extra_player_info_pointer->unkF0_f32; + } else { + current_actor_pointer->x_position = extra_player_info_pointer->unkE0; + current_actor_pointer->z_position = extra_player_info_pointer->unkE4; + } + break; + } + func_global_asm_806CC970(); + break; + case 1: // switch 1 + func_global_asm_806CC970(); + if (ABS_DIFF(current_actor_pointer->floor, extra_player_info_pointer->unkF0_f32) < 20.0) { + current_actor_pointer->y_position = current_actor_pointer->floor; + current_actor_pointer->unk6A |= 1; + current_actor_pointer->y_velocity = -50.0f; + func_global_asm_806CFF9C(current_actor_pointer); + } else { + func_global_asm_806CFF1C(current_actor_pointer); + } + break; + } + renderActor(current_actor_pointer, 0); + func_global_asm_80614A64(current_actor_pointer); +} +*/ + void func_global_asm_806DE930(void) { extra_player_info_pointer->unk4 = 0.0f; if (!handleInputsForControlState(1)) { diff --git a/src/menu/code_1AF0.c b/src/menu/code_1AF0.c index e74a997..62beab0 100644 --- a/src/menu/code_1AF0.c +++ b/src/menu/code_1AF0.c @@ -788,7 +788,7 @@ void func_menu_800270E0(void) { break; case 5: if (!(current_actor_pointer->object_properties_bitfield & 0x02000000)) { - func_global_asm_8061CB08(current_actor_pointer); + func_global_asm_8061CB08(); current_actor_pointer->control_state = 6; } break;