From d0c49e387f4fd16dc0910370733bfd707ed2beeb Mon Sep 17 00:00:00 2001 From: Donkey Kong Date: Sat, 11 Mar 2023 01:47:25 +1030 Subject: [PATCH] 16.5787% --- include/functions.h | 4 + include/structs.h | 17 +-- include/variables.h | 4 +- progress/progress.global_asm.csv | 2 +- progress/progress.menu.csv | 2 +- progress/progress.total.csv | 4 +- progress/progress_global_asm.svg | 4 +- progress/progress_menu.svg | 6 +- progress/progress_total.svg | 4 +- src/bonus/code_12A0.c | 22 ++- src/bonus/code_9010.c | 49 +++++++ src/boss/code_9C60.c | 4 + src/boss/code_C920.c | 1 - src/global_asm/code_0.c | 1 + src/global_asm/code_114270.c | 1 + src/global_asm/code_1295B0.c | 4 +- src/global_asm/code_12E800.c | 233 ++++++++++++++++++++++++++++++- src/global_asm/code_699B0.c | 6 +- src/global_asm/code_7AF60.c | 6 +- src/global_asm/code_7CA80.c | 106 +++++++++++++- src/global_asm/code_936B0.c | 1 - src/global_asm/code_B1F60.c | 1 - src/global_asm/code_B7490.c | 130 ++++++++++++++++- src/global_asm/code_BDEE0.c | 1 - src/global_asm/code_CEAE0.c | 4 +- src/global_asm/code_EFDC0.c | 2 - src/global_asm/code_F56F0.c | 104 ++++++++++++-- src/menu/code_1AF0.c | 225 ++++++++++++++++++++++++++++- src/menu/code_3E10.c | 13 +- src/menu/code_E550.c | 1 - src/water/code_0.c | 4 +- symbol_addrs.global_asm.us.txt | 6 + symbol_addrs.menu.us.txt | 1 + 33 files changed, 906 insertions(+), 67 deletions(-) diff --git a/include/functions.h b/include/functions.h index de568d9..319556d 100644 --- a/include/functions.h +++ b/include/functions.h @@ -29,6 +29,10 @@ f32 func_80612794(s16); void func_80614E78(Actor*, s32); void func_80629174(void); +void func_80729B00(void); + +s16 func_80665DE0(f32, f32, f32, f32); + // Heap stuff??? void func_8061130C(void *); diff --git a/include/structs.h b/include/structs.h index 443155c..834cc07 100644 --- a/include/structs.h +++ b/include/structs.h @@ -57,7 +57,7 @@ typedef struct enemy_info { s16 unk2A; // Used u32 unk2C; u32 unk30; - u32 unk34; + f32 unk34; // Used f32 unk38; // Used f32 unk3C; // at 0x3C s16 unk40; // Used @@ -1361,15 +1361,16 @@ struct Struct807FDC90 { Struct807FDC90 *unk0; // TODO: This type may not be correct Actor *unk4; s16 unk8; - s16 unkA; + s16 unkA; // Used: X Position s16 unkC; // Used - s16 unkE; - s32 unk10; - s32 unk14; + s16 unkE; // Used: Z Position + s16 unk10; // Used + s16 unk12; + s16 unk14; // Used + s16 unk16; u16 unk18; - u16 unk1A; - u8 unk1C; - u8 unk1D; + u16 unk1A; // Used + u16 unk1C; // Used u8 unk1E; u8 unk1F; u8 unk20; diff --git a/include/variables.h b/include/variables.h index 7dfc17f..435b2fb 100644 --- a/include/variables.h +++ b/include/variables.h @@ -102,7 +102,9 @@ typedef struct Struct807FDCA0 { s32 unkC; s32 unk10; s32 unk14; // TODO: Pointer to an array of structs 0xA big? See boss func_8003392C - s32 unk18; + s8 unk18; + s8 unk19; // Used + s16 unk1A; s32 unk1C; s8 unk20; } Struct807FDCA0; diff --git a/progress/progress.global_asm.csv b/progress/progress.global_asm.csv index 4358106..7c16e6d 100644 --- a/progress/progress.global_asm.csv +++ b/progress/progress.global_asm.csv @@ -1289,7 +1289,7 @@ us,.code,func_80735864,244,no us,.code,func_806C3F10,1176,no us,.code,func_806BE09C,1496,no us,.code,func_806E0D40,620,no -us,.code,func_806F46B0,160,no +us,.code,func_806F46B0,148,yes us,.code,func_806574B8,80,no us,.code,func_80660830,204,no us,.code,func_8073E63C,256,no diff --git a/progress/progress.menu.csv b/progress/progress.menu.csv index 459fe27..242983d 100644 --- a/progress/progress.menu.csv +++ b/progress/progress.menu.csv @@ -86,7 +86,7 @@ us,.code,func_80032304,456,no us,.code,func_80029D30,456,no us,.code,func_80027DEC,32,yes us,.code,func_8002E8B8,1072,no -us,.code,func_800324CC,132,no +us,.code,func_800324CC,124,yes us,.code,func_80032024,684,no us,.code,func_80029BB4,380,no us,.code,func_8002ACD4,124,no diff --git a/progress/progress.total.csv b/progress/progress.total.csv index 2ebe365..2427012 100644 --- a/progress/progress.total.csv +++ b/progress/progress.total.csv @@ -1289,7 +1289,7 @@ us,.code,func_80735864,244,no us,.code,func_806C3F10,1176,no us,.code,func_806BE09C,1496,no us,.code,func_806E0D40,620,no -us,.code,func_806F46B0,160,no +us,.code,func_806F46B0,148,yes us,.code,func_806574B8,80,no us,.code,func_80660830,204,no us,.code,func_8073E63C,256,no @@ -3389,7 +3389,7 @@ us,.code,func_80032304,456,no us,.code,func_80029D30,456,no us,.code,func_80027DEC,32,yes us,.code,func_8002E8B8,1072,no -us,.code,func_800324CC,132,no +us,.code,func_800324CC,124,yes us,.code,func_80032024,684,no us,.code,func_80029BB4,380,no us,.code,func_8002ACD4,124,no diff --git a/progress/progress_global_asm.svg b/progress/progress_global_asm.svg index 905d977..410470e 100644 --- a/progress/progress_global_asm.svg +++ b/progress/progress_global_asm.svg @@ -17,7 +17,7 @@ global_asm - 16.0543% - 16.0543% + 16.0673% + 16.0673% \ No newline at end of file diff --git a/progress/progress_menu.svg b/progress/progress_menu.svg index 55e2b8c..1d01990 100644 --- a/progress/progress_menu.svg +++ b/progress/progress_menu.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ menu - 11.9679% - 11.9679% + 12.1833% + 12.1833% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 8e496e0..11bfb28 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Donkey Kong 64 (US) - 16.5610% - 16.5610% + 16.5787% + 16.5787% \ No newline at end of file diff --git a/src/bonus/code_12A0.c b/src/bonus/code_12A0.c index 786e316..e91a412 100644 --- a/src/bonus/code_12A0.c +++ b/src/bonus/code_12A0.c @@ -3,8 +3,6 @@ #include "variables.h" -#pragma GLOBAL_ASM("asm/nonmatchings/bonus/code_12A0/func_800252A0.s") - s32 func_80677FA8(s32, s32); // spawnActorWrapper() void func_80627948(Actor*, s32, s32, s32); void func_8069D2AC(s32,s32,u8, s32, s32, s32, s32, s32); @@ -13,6 +11,9 @@ void func_8061C464(s32, Actor*, s32, s32, s32, s32, s32, s32, s32, s32, f32); extern f32 D_8002DCB8; +// Displaylist stuff +#pragma GLOBAL_ASM("asm/nonmatchings/bonus/code_12A0/func_800252A0.s") + Actor* func_800253E4(s32 arg0, s16 arg1, s16 arg2, s16 arg3) { BaaD2 *tmp; if (func_80677FA8(0xDB, arg0)) { // Spawn actor 219 (slot, BBB I guess?) @@ -29,6 +30,23 @@ Actor* func_800253E4(s32 arg0, s16 arg1, s16 arg2, s16 arg3) { #pragma GLOBAL_ASM("asm/nonmatchings/bonus/code_12A0/func_800254B0.s") +extern f32 D_8002DCB4; +extern void *D_80717404; +extern s32 D_8074E880[]; + +/* +void func_800254B0(s16 arg0, s16 arg1, s16 arg2, s16 arg3) { + s16 i; + + for (i = 0; i < arg3; i++) { + func_807149B8(1); + func_8071498C(&D_80717404); + func_80714950(1); + func_80714CC0(D_8074E880[((rand() >> 0xF) % 1000) % 3], D_8002DCB4, arg0, arg1, arg2); + } +} +*/ + void func_8002563C(s32 arg0) { PlayerAdditionalActorData *PaaD = player_pointer->PaaD; func_8061C464(PaaD->unk104, player_pointer, 4, 0, 0xAA, 0, 0, 0, 0, 0, D_8002DCB8); diff --git a/src/bonus/code_9010.c b/src/bonus/code_9010.c index ab696e0..de5113c 100644 --- a/src/bonus/code_9010.c +++ b/src/bonus/code_9010.c @@ -12,6 +12,55 @@ extern s8 D_8002DEF0[]; #pragma GLOBAL_ASM("asm/nonmatchings/bonus/code_9010/func_8002D6F8.s") +/* +extern s8 D_8002D910[]; +extern s8 D_8002D91C[]; +extern s8 D_8002D920; +extern s8 D_8002D924; +extern s8 D_8002D928; + +void func_8002D6F8(s16 arg0) { + s32 var_v1_2; + s8 *var_v1; + s8 temp_t9; + s32 i; + + D_8002D928 = 5; + var_v1 = &D_8002D91C; + do { + temp_t9 = *var_v1; + var_v1++; + if (arg0 == temp_t9) { + D_8002D928 += 0xF; + } + } while (var_v1 < &D_8002D920); + i = 0; + if (arg0 != D_8002D910[0]) { +loop_5: + i++; + if (i < 0xA) { + if (arg0 != D_8002D910[i]) { + goto loop_5; + } + } + } + var_v1_2 = i - 1; + if (var_v1_2 < 0) { + var_v1_2 = 0xA; + } + if (var_v1_2 == D_8002D920) { + D_8002D924++; + if (D_8002D924 >= 0xA) { + D_8002D924 = 0; + D_8002D928 += 0x32; + } + } else { + D_8002D924 = 0; + } + D_8002D920 = i; +} +*/ + void func_8002D7E8(s16 arg0) { s8 phi_v0 = arg0 == 0xD4 ? 0xA : 2; diff --git a/src/boss/code_9C60.c b/src/boss/code_9C60.c index a2a4556..7facd69 100644 --- a/src/boss/code_9C60.c +++ b/src/boss/code_9C60.c @@ -41,6 +41,7 @@ void func_8002DD7C(void) { } } +// Jumptable #pragma GLOBAL_ASM("asm/nonmatchings/boss/code_9C60/func_8002DE04.s") void func_8002E7A0(Actor *arg0) { @@ -112,8 +113,10 @@ void func_8002EA14() { func_8072B324(current_actor_pointer, D_807FDC9C[0].unkC + (sp1C->unk14 * 0xA) + 0xF); } +// Jumptable #pragma GLOBAL_ASM("asm/nonmatchings/boss/code_9C60/func_8002EA7C.s") +// Jumptable #pragma GLOBAL_ASM("asm/nonmatchings/boss/code_9C60/func_8002F100.s") void func_8002FB7C(u8 arg0) { @@ -172,6 +175,7 @@ void func_8002FEC0(Actor* arg0[], u8 arg1, s32 arg2) { arg0[arg1] = D_807FBB44; } +// Jumptable #pragma GLOBAL_ASM("asm/nonmatchings/boss/code_9C60/func_8002FF74.s") #pragma GLOBAL_ASM("asm/nonmatchings/boss/code_9C60/func_80030888.s") diff --git a/src/boss/code_C920.c b/src/boss/code_C920.c index 8ad264e..f00fda0 100644 --- a/src/boss/code_C920.c +++ b/src/boss/code_C920.c @@ -2,7 +2,6 @@ #include "functions.h" #include "variables.h" -s16 func_80665DE0(f32, f32, f32, f32); void func_8061C464(s32, Actor*, s32, s32, s32, s32, s32, s32, s32, s32, f32); void func_806086CC(f32, f32, f32, s32, s32, s32, s32, s32, f32, s32); void func_8063DA40(s32, s16); diff --git a/src/global_asm/code_0.c b/src/global_asm/code_0.c index f0d938f..20e73cf 100644 --- a/src/global_asm/code_0.c +++ b/src/global_asm/code_0.c @@ -408,6 +408,7 @@ void *func_805FD030(Gfx *arg0) { // display list something? #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_0/func_805FE398.s") +// display list arg0 #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_0/func_805FE4D4.s") extern s32 D_8076A058; diff --git a/src/global_asm/code_114270.c b/src/global_asm/code_114270.c index 63d4bce..e54cfcc 100644 --- a/src/global_asm/code_114270.c +++ b/src/global_asm/code_114270.c @@ -373,6 +373,7 @@ s32 *func_805FD030(s32 *arg0); s32 *func_807132DC(s32 *arg0); // get displaylist? /* +// TODO: DL macros s32 *func_807132DC(s32 *arg0) { s32 *temp_v0; diff --git a/src/global_asm/code_1295B0.c b/src/global_asm/code_1295B0.c index e3a0866..4e29a70 100644 --- a/src/global_asm/code_1295B0.c +++ b/src/global_asm/code_1295B0.c @@ -137,16 +137,14 @@ Actor *func_807270C0(s16 spawn_trigger, u16 arg1) { #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_1295B0/func_8072752C.s") -/* -s16 func_80665DE0(f32, f32, f32, f32); s32 func_807271F4(s16, s16, s16, s16, s32, s32, s32); +/* // TODO: Everything matches apart from stack offset void func_8072752C(s16 arg0, s16 x1, s16 y1, s16 z1, s16 x2, s16 y2, s16 z2, s16 arg7, s16 arg8) { s16 sp46; f32 sp40; s32 dx, dy, dz; - // s32 temp; dx = (x2 - x1) * (x2 - x1); dy = (y2 - y1) * (y2 - y1); diff --git a/src/global_asm/code_12E800.c b/src/global_asm/code_12E800.c index afc80ae..90c6c4f 100644 --- a/src/global_asm/code_12E800.c +++ b/src/global_asm/code_12E800.c @@ -11,7 +11,6 @@ void func_806A5DF0(s32, f32, f32, f32, s32, s32, s32, s32); void func_806F8BC4(s32, s32, s32); void func_806F91B4(u8, u8, s16); s16 func_806CC190(s16, s16, f32); -s32 func_80665DE0(f32, f32, f32, f32); s16 func_806CC190(s16, s16, f32); extern f64 D_8075FF38; @@ -19,6 +18,94 @@ extern f64 D_8075FF38; // Doable #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_12E800/func_80729B00.s") +extern s8 D_807FBB85; + +/* +void func_80729B00(void) { + Actor *temp_a2; + EnemyInfo *temp_t9; + GlobalASMStruct35 *var_t2; + f32 var_f10; + u16 var_v0; + u32 temp_a0; + u8 temp_t3; + u8 temp_v0; + u8 temp_v0_2; + void *temp_t7; + void *temp_v1; + + temp_t7 = current_actor_pointer->additional_actor_data; + D_807FDC90 = temp_t7; + D_807FDC94 = temp_t7->unk4; + temp_t9 = temp_t7->unk0; + D_807FDC98 = temp_t9; + D_807FDC9C = temp_t9; + D_807FDCA0 = temp_t9->unk1C; + var_t2 = D_807FBB70; + temp_t7->unk18++; + temp_a2 = current_actor_pointer; + temp_a0 = temp_a2->object_properties_bitfield; + if (temp_a0 & 0x20000000) { + temp_v0 = temp_a2->control_state; + if ((temp_v0 != 0x37) && (temp_v0 != 0x36) && (D_807FDC90->unk16 != D_807FDC94->animation_state->unk0->unk10)) { + temp_a2->object_properties_bitfield = temp_a0 & 0xDFFFFFFF; + } + } + if (temp_a2->interactable & 2) { + if (((is_cutscene_active == 1) && (D_807FDC98->unk46 & 8)) || ((D_807FDC94 != NULL) && (D_807FDC94->control_state == 0x42))) { + temp_v0_2 = temp_a2->control_state; + if ((temp_v0_2 >= 0x23) && (temp_v0_2 < 0x36)) { + temp_a2->noclip_byte = 1; + current_actor_pointer->control_state = 0x3A; + current_actor_pointer->control_state_progress = 0; + } + } + var_v0 = D_807FDC98->unk46; + if ((D_807FBB70->unk1B != 0) && (temp_a2->control_state != 0x39)) { + if (var_v0 & 0x800) { + D_807FBB70->unk15 = 1; + var_v0 = D_807FDC98->unk46; + } else { + func_8067AC38(temp_a0, &D_807FDC90, temp_a2, &D_807FDC98); + current_actor_pointer->unk138 = 0; + current_actor_pointer->object_properties_bitfield &= 0xFFFD7FFF; + current_actor_pointer->noclip_byte = 1; + current_actor_pointer->control_state = 0x39; + current_actor_pointer->control_state_progress = 0; + func_80614EBC(current_actor_pointer, D_807FDC98->unk2A); + func_80608528(current_actor_pointer, 0x16, 0xFF, 0x7F, 0x14); + current_actor_pointer->y_velocity = -220.0f; + var_t2 = 0x807FBB70; + var_v0 = D_807FDC98->unk46; + } + } + if ((var_v0 & 0x4000) && (temp_a2->unk6A & 4)) { + temp_t3 = temp_a2->unk15E; + var_f10 = temp_t3; + if (temp_t3 < 0) { + var_f10 += 4294967296.0f; + } + if ((temp_a2->y_position + var_f10) < temp_a2->unkAC) { + var_t2->unk15 = 1; + } + } + if ((current_map == 0x30) && (D_807FDC94->interactable & 1)) { + temp_v1 = D_807FDC94->additional_actor_data; + if ((temp_v1->unk1F0 ^ temp_v1->unk1F8) & 0x100000) { + func_80605314(temp_a2, 0, temp_a2); + current_actor_pointer->control_state = 0; + current_actor_pointer->control_state_progress = 0; + D_807FBB85 = 1; + } + } + } + if ((temp_a2->unk58 != 0xAF) && (temp_a2->control_state == 0x37) && (temp_a2->unk138 != 0)) { + temp_a2->unk138 = 0; + } + func_806663F8(); +} +*/ + void func_80729E6C(void) { current_actor_pointer->y_velocity += current_actor_pointer->y_acceleration; if (current_actor_pointer->y_velocity < current_actor_pointer->terminal_velocity) { @@ -65,7 +152,7 @@ void func_8072A7DC(void) { #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_12E800/func_8072A86C.s") -void func_8072AB74(u8, f32, f32, u16, f32); +u8 func_8072AB74(u8 arg0, f32 arg1, f32 arg2, u16 arg3, f32 arg4); /* // TODO: t8 a3 regalloc? Odd one @@ -95,9 +182,149 @@ void func_8072AA80(void) { } */ -// TODO: Huge, and actually seems super doable #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_12E800/func_8072AB74.s") +extern f64 D_8075FD40; + +s16 func_806CC14C(s16, s16); +void func_80729EB0(s32, f32, f32, u16); +void func_806653C0(Actor*, f32, f32); +void func_8066635C(Actor*, f32, f32, f32, f32*); +s32 func_80725BA4(f32, f32, Struct807FDCA0*); + +/* +// TODO: Seems doable, progress made... +u8 func_8072AB74(u8 arg0, f32 x, f32 z, u16 arg3, f32 arg4) { + s16 sp52; + s16 *sp4C; + u8 sp43; + f32 sp34; + f32 dx; + f32 temp_f12; + f32 dz; + s32 var_v1_2; + + sp43 = 0; + sp4C = &D_807FDC90->unk8; + D_807FDC90->unk1C = D_807FDC90->unk1A; + D_807FDC90->unk1A &= 0xBD7F; + dx = current_actor_pointer->x_position - x; + dz = current_actor_pointer->z_position - z; + temp_f12 = current_actor_pointer->animation_state->scale_y / D_8075FD40; + if (((dx * dx) + (dz * dz)) < (1600.0f * temp_f12)) { + D_807FDC90->unk1A |= 0x80; + if (func_806CC14C(*sp4C, current_actor_pointer->y_rotation) >= 0x191) { + current_actor_pointer->unkB8 *= D_807FDC98->unk34; + } + } + func_8067ACB4(current_actor_pointer); + if ((current_actor_pointer->unkB8 != 0.0f) || (arg3 & 4)) { + func_80729EB0(arg0, x, z, arg3); + } + if (!(arg3 & 0x1001)) { + func_80729E6C(); + } + if (!(D_807FDC98->unk46 & 0x200)) { + func_80666280(2); + } + if ((D_807FDCA0->unk19 == 1) && ((arg0 != 0x37) || !(D_807FDC98->unk46 & 0x10))) { + func_80666280(1); + } + if (arg3 & 0x4000) { + current_actor_pointer->unkFC = 0; + } + if ((arg0 != 0x37) && !(D_807FDC90->unk1A & 2)) { + func_80665160(current_actor_pointer, current_actor_pointer->unkEE, current_actor_pointer->y_rotation); + } + if (arg3 & 2) { + if (!(arg3 & 1)) { + func_806653C0(current_actor_pointer, 0.0f, current_actor_pointer->y_velocity); + } + func_80665564(current_actor_pointer, arg4); + if (!(arg3 & 0x2000)) { + func_8072A714(); + } + if (!(arg3 & 0x10)) { + func_8072A450(); + } + return 0; + } + if (!(arg3 & 0x20)) { + func_8072B438(arg3); + } + if (arg3 & 0x800) { + func_806653C0(current_actor_pointer, 0.0f, current_actor_pointer->y_velocity); + } else if (arg3 & 1) { + func_806653C0(current_actor_pointer, current_actor_pointer->unkB8, 0.0f); + } else { + func_806651FC(current_actor_pointer); + } + if (!(arg3 & 8)) { + func_80665564(current_actor_pointer, arg4); + } else if ((D_807FDCA0->unk19 != 1) && (arg3 & 0x10)) { + func_8066635C(current_actor_pointer, current_actor_pointer->x_position, current_actor_pointer->unk8C, current_actor_pointer->z_position, ¤t_actor_pointer->floor); + } + if (!(arg3 & 0x2000)) { + func_8072A714(); + } + if (!(arg3 & 0x10)) { + func_8072A450(); + } + current_actor_pointer->unkFC = 0; + current_actor_pointer->unkFD = 0; + if ((D_807FDC98->unk46 & 0x20) || (current_actor_pointer->interactable & 0x40)) { + return 0; + } + if ((arg0 == 0x37) && (D_807FDC98->unk46 & 0x10)) { + if (func_80725BA4(current_actor_pointer->x_position, current_actor_pointer->z_position, D_807FDCA0) == 0) { + var_v1_2 = -1; + if (current_actor_pointer->unkB8 >= 0.0f) { + var_v1_2 = 1; + } + current_actor_pointer->unkB8 = var_v1_2 * 0x1E; + return 0; + } + D_807FDC90->unk1A |= 0x4000; + return 0; + } + if (func_80725BA4(current_actor_pointer->x_position, current_actor_pointer->z_position, D_807FDCA0) != 0) { + D_807FDC90->unk1A |= 0x4000; + if (func_807264B0(current_actor_pointer, current_actor_pointer->unk88, current_actor_pointer->unk90, D_807FDCA0, &sp52) == 0) { + sp34 = func_80612794(current_actor_pointer->unkEE); + if (func_80725BA4((sp34 * current_actor_pointer->unkB8) + current_actor_pointer->x_position, (func_80612790(current_actor_pointer->unkEE) * current_actor_pointer->unkB8) + current_actor_pointer->z_position, D_807FDCA0) == 0) { + if (D_807FDC90->unk22-- == 0) { + *sp4C += 0x800; + *sp4C &= 0xFFF; + D_807FDC90->unk22 = D_807FDC90->unk23 * 4; + } + } + goto block_63; + } + if ((arg0 == 0x37) || (arg0 == 0)) { + current_actor_pointer->unkB8 = 0.0f; + current_actor_pointer->x_position = D_807FDC90->unk10; + current_actor_pointer->z_position = D_807FDC90->unk14; + return 0; + } +block_63: + D_807FDC90->unk10 = current_actor_pointer->x_position; + D_807FDC90->unk14 = current_actor_pointer->z_position; + goto block_66; + } + sp43 = 1; + D_807FDC90->unk1A |= 0x200; + current_actor_pointer->x_position = D_807FDC90->unk10; + current_actor_pointer->z_position = D_807FDC90->unk14; + if (D_807FDC90->unk22-- == 0) { + *sp4C += 0x800; + *sp4C &= 0xFFF; + D_807FDC90->unk22 = D_807FDC90->unk23 * 6; + } +block_66: + return sp43; +} +*/ + void func_8072B324(Actor *arg0, s32 arg1) { PlayerAdditionalActorData *PaaD = arg0->PaaD; PaaD->unk26 = arg1; diff --git a/src/global_asm/code_699B0.c b/src/global_asm/code_699B0.c index f9e9e90..0136ac8 100644 --- a/src/global_asm/code_699B0.c +++ b/src/global_asm/code_699B0.c @@ -120,14 +120,14 @@ void func_80665ACC(Actor *arg0) { //forward decl necessary //looks like its taking the linear distance between 2 points (2D) -void func_80665C18(f32,f32,f32,f32,f32); -void func_80665DE0(f32 arg0, f32 arg1, f32 arg2, f32 arg3) { +s16 func_80665C18(f32,f32,f32,f32,f32); +s16 func_80665DE0(f32 arg0, f32 arg1, f32 arg2, f32 arg3) { f32 temp_f0; f32 temp_f2; temp_f0 = arg0 - arg2; temp_f2 = arg1 - arg3; - func_80665C18(arg0, arg1, arg2, arg3, + return func_80665C18(arg0, arg1, arg2, arg3, sqrtf((temp_f0 * temp_f0) + (temp_f2 * temp_f2))); } diff --git a/src/global_asm/code_7AF60.c b/src/global_asm/code_7AF60.c index b6e078c..11eb117 100644 --- a/src/global_asm/code_7AF60.c +++ b/src/global_asm/code_7AF60.c @@ -35,12 +35,12 @@ u8 func_80676308(Actor *arg0, Actor *arg1, s32 arg2) { // TODO: Not exactly sure what's wrong here // Tricky floating point typecasty stuff I suspect -/* -s32 func_80665DE0(s32, s32, s32, s32); + s32 func_806CC14C(s16, s16); -s32 func_8067641C(s32, s32, s32); +s32 func_8067641C(Actor*, Actor*, s32); +/* s32 func_80676338(Actor *arg0, Actor *arg1, s32 arg2) { u8 temp = func_806CC14C(func_80665DE0(arg0->x_position, arg0->z_position, arg1->x_position, arg1->z_position), arg0->y_rotation) < 0x200; return temp diff --git a/src/global_asm/code_7CA80.c b/src/global_asm/code_7CA80.c index 8305877..b7d73ce 100644 --- a/src/global_asm/code_7CA80.c +++ b/src/global_asm/code_7CA80.c @@ -99,9 +99,113 @@ s32 func_80678014(s32 arg0) { return FALSE; } -// Doable, initializeActor(behaviour) + #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_7CA80/func_80678050.s") +extern u16 D_807FBB34; +extern u32 D_807FBB38; +extern u16 D_807FBB3E; +extern u16 *D_8074E218[]; +extern u16 D_8074DA58[]; + +void func_8067AE90(Actor *arg0); +void func_80611690(void*); +void func_806761D0(Actor *arg0); + +/* +// Doable, initializeActor(behaviour) +s32 func_80678050(u16 arg0) { + Actor *newActor; + u16 var_a1; + u16 var_a2; + u16 *var_v0; + u16 *var_v0_2; + u16 temp_t4; + u16 var_v1; + void **var_v1_2; + s32 *var_a0; + + var_v0 = D_8074E218[arg0]; + var_v1 = *var_v0; + var_a1 = 0x174; + var_a2 = 0; + while (var_v1 != 0) { + var_a2 += D_8074DA58[var_v1]; + var_v1 = var_v0[1]; + var_a1 += 4; + var_v0++; + } + // Align to next 8 byte boundary + var_a1 = (var_a1 + 7) & 0xFFF8; + newActor = malloc((var_a2 + var_a1) & 0xFFFF); + if (newActor != NULL) { + func_80611690(newActor); // Something with the heap + var_v0_2 = D_8074E218[arg0]; + var_v1_2 = &newActor->additional_actor_data; + var_a0 = &newActor + var_a1; + while (var_v0_2[0] != 0) { + *var_v1_2 = var_a0; + var_v1_2++; + temp_t4 = D_8074DA58[var_v0_2[0]]; + var_v0_2++; + var_a0 += temp_t4; + } + newActor->collision_queue_pointer = NULL; + newActor->unk138 = -1; + newActor->noclip_byte = 2; + newActor->locked_to_pad = 0; + newActor->unkF8 = 0x50; + newActor->object_properties_bitfield = 0x58144; + newActor->unk64 = 0; + newActor->shadow_opacity = 0xFF; + newActor->unk58 = arg0; + if (D_807FBB64 & 0x100) { + newActor->draw_distance = 2000; + } else { + newActor->draw_distance = 500; + } + newActor->unk68 = 0; + newActor->unk156 = 0; + newActor->unk78 = 0; + newActor->unk6C = 1; + newActor->unk6A = 1; + newActor->unk132 = 1; + newActor->unk114 = 0; + newActor->unk118 = 0; + newActor->unk11C = NULL; + newActor->unk6E = -1; + newActor->unk70 = -1; + newActor->unk150 = NULL; + newActor->unk12C = -1; + newActor->unk124 = 0; + newActor->unk148 = 0; + newActor->unk14C = 0; + newActor->unkD4 = 0x80748D4A; + newActor->unk146 = -1; + newActor->unkDA = 0x400; + newActor->unkCC = 0; + newActor->unkCD = 0; + newActor->unk130 = 0; + newActor->unk131 = 0; + newActor->unk16D = 0xF; + newActor->unkCE = 0; + newActor->unkB0 = -1; + newActor->interactable = D_8074D624[arg0]; + newActor->unk54 = D_807FBB38; + D_807FBB38++; + func_8067AE90(newActor); // Add to actor list + func_806761D0(newActor); // Set initial health + D_807FB930[D_807FBB34].unk0 = newActor; + D_807FB930[D_807FBB34].unk4 = 0; + D_807FBB3E = D_807FBB34; + D_807FBB34++; + D_807FBB44 = newActor; + return TRUE; + } + return FALSE; +} +*/ + void func_806782C0(Actor *arg0) { func_806897F0(); func_806782E8(arg0); diff --git a/src/global_asm/code_936B0.c b/src/global_asm/code_936B0.c index dc5fe1b..a34cafa 100644 --- a/src/global_asm/code_936B0.c +++ b/src/global_asm/code_936B0.c @@ -162,7 +162,6 @@ void func_80690814(s32 arg0, s32 arg1) { extern f32 D_807FC7B0; extern f32 D_807FC7B8; -f32 func_80665DE0(f32, f32, f32, f32); void func_80690930(s32, s16, s16, s32, f32, f32, f32, f32, f32); void func_80690A28(s16 arg0, s16 arg1, s32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, s32 arg7) { diff --git a/src/global_asm/code_B1F60.c b/src/global_asm/code_B1F60.c index 0b6eb61..9c7f50d 100644 --- a/src/global_asm/code_B1F60.c +++ b/src/global_asm/code_B1F60.c @@ -4,7 +4,6 @@ void func_80724E48(u8); void func_806319C4(Actor *, s32); -void func_80729B00(void); void func_8072B79C(s32, s32, s32); void func_806782C0(Actor *); s32 func_8072881C(s32, s32); diff --git a/src/global_asm/code_B7490.c b/src/global_asm/code_B7490.c index e37061d..361ddfb 100644 --- a/src/global_asm/code_B7490.c +++ b/src/global_asm/code_B7490.c @@ -25,16 +25,16 @@ void func_80665564(Actor*, f32); void func_806086CC(f32, f32, f32, s32, s32, s32, s32, s32, f32, s32); void func_807248B0(Actor*, f32); +// Jumptable #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_B7490/func_806B2790.s") void func_806B2D5C(void) { } +// Jumptable #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_B7490/func_806B2D64.s") -void func_80729B00(void); // TODO: Move to functions.h - void func_806B3420(void) { f32 dx, dy, dz; s32 temp; @@ -101,6 +101,130 @@ void func_806B3420(void) { #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_B7490/func_806B3680.s") +s32 func_8072AB74(u8, f32, f32, s32, f32); + +extern f32 D_8075B5C4; +extern f32 D_8075B5C8; +extern f32 D_8075B5CC; +extern f32 D_8075B5D0; +extern f32 D_8075B5D8; +extern s32 D_8072073C; +extern s32 D_8071ABDC; + +extern s32 D_8075B5DC; + +void func_8066E9EC(Actor*, s32, f32); +void func_8066EB40(Actor*, f32); +void func_8072A920(f32, u8, s32, f32, f32, f32, s32, s32, f32, s32); +// void func_8072A920(s32, s16, f32, f32, f32, s32, f32, f32, u16, s32); + +/* +void func_806B3680(void) { + f32 var_f14; + f32 var_f12; + f32 sp54; + f32 dx; + f32 dz; + f32 dy; + s32 *sp44; + s16 i; + + var_f14 = current_actor_pointer->animation_state->scale_y * 800.0f; + sp54 = D_8075B5C4; + if (current_map == MAP_CASTLE_KING_KUT_OUT) { + if (!(player_pointer->unk6A & 4)) { + var_f14 = 0.0f; + sp54 = D_8075B5C8; + } else { + var_f14 = var_f14 * 0.75; + sp54 = D_8075B5CC; + } + } + var_f14 = var_f14 * var_f14; + func_80729B00(); + if (!(current_actor_pointer->object_properties_bitfield & 0x10)) { + current_actor_pointer->unk64 |= 4; + func_8067ACB4(current_actor_pointer); + } + if (((D_807FBB70->unk200 == 9) || (D_807FBB70->unk15 != 0)) && (current_actor_pointer->control_state != 0x27)) { + current_actor_pointer->control_state = 0x27; + current_actor_pointer->control_state_progress = 0; + } else if (current_actor_pointer->control_state != 0x27) { + dx = D_807FDC94->x_position - current_actor_pointer->x_position; + dy = D_807FDC94->y_position - current_actor_pointer->y_position; + dz = D_807FDC94->z_position - current_actor_pointer->z_position; + if (((dx * dx) + (dy * dy) + (dz * dz)) < var_f14) { + current_actor_pointer->control_state = 0x27; + current_actor_pointer->control_state_progress = 0; + } + } + func_80685020(0x1F, 0); + switch (current_actor_pointer->control_state) { + case 4: + func_8072AB74(0, 0.0f, 0.0f, 2, 0.0f); + if (current_actor_pointer->y_position < current_actor_pointer->unkAC) { + current_actor_pointer->y_position = current_actor_pointer->unkAC; + current_actor_pointer->y_velocity = current_actor_pointer->y_acceleration; + } + // fallthrough + case 0: + func_8072E1A4(0xA, D_807FDC94); + break; + default: + if (current_actor_pointer->control_state != 0x27) { + func_8072B7CC(0x32E); + } else { + switch (current_actor_pointer->control_state) { + case 0: + func_80608528(current_actor_pointer, 0x1C2, 0xFF, 0x7F, 0); + D_807FDC90->unk30 = 2.0 * current_actor_pointer->animation_state->scale_y; + current_actor_pointer->control_state_progress += 1; + // fallthrough + case 1: + // i = 0; + if (current_actor_pointer->animation_state->scale_y < D_807FDC90->unk30) { + func_807248B0(current_actor_pointer, current_actor_pointer->animation_state->scale_y * D_8075B5D0); + } else { + sp44 = &D_8071ABDC; + for (i = 0; i < 0xC; i++) { + func_807149B8(1); + func_807149FC(2); + func_80714950(i + 0x0B020000); + func_8071498C(sp44); + func_80714998(1); + func_80714CC0(&D_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); + } + func_80608528(current_actor_pointer, 0x3D, 0xFF, 0x7F, 0); + func_806086CC(current_actor_pointer->x_position, current_actor_pointer->y_position, current_actor_pointer->z_position, 0x35C, 0xFF, 0x7F, 0, 0x32, D_8075B5D8, 0); + func_8067E278(0, 1); + func_8066E9EC(current_actor_pointer, 1, current_actor_pointer->ledge_info_pointer->unkC * sp54); + func_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 += 1; + } + break; + case 5: + current_actor_pointer->control_state = 0x40; + break; + default: + current_actor_pointer->control_state_progress++; + break; + } + } + break; + case 2: + case 3: + var_f12 = MIN(D_807FDC90->unkC, current_actor_pointer->unkAC - current_actor_pointer->unk15E); + func_8072A920(var_f12, current_actor_pointer->control_state, 0, D_807FDC90->unkA, var_f12, D_807FDC90->unkE, 0x1E, D_8075B5DC, 100.0f, 0x2040); + break; + } + if ((current_actor_pointer->control_state == 2) || (current_actor_pointer->control_state == 3)) { + func_8072D13C(current_actor_pointer->control_state, 1); + } + func_806319C4(current_actor_pointer, 0); +} +*/ + void func_806B3C30(u8 arg0) { func_80690814(current_actor_pointer, arg0); func_8069084C(0x32, 1, 0.3f, current_actor_pointer->unkEE, 80.0f, 0.0f, current_actor_pointer); @@ -170,7 +294,6 @@ void func_806B3F3C(void) { f32 func_80665E94(f32, f32, f32, f32, f32, f32, s32); s16 func_806CC190(s16, s16, f32); -s32 func_8072AB74(u8, f32, f32, s32, f32); extern f64 D_8075B5E0; extern f64 D_8075B5E8; @@ -418,7 +541,6 @@ void func_806B52DC(void) { extern f64 D_8075B718; -s16 func_80665DE0(f32, f32, f32, f32); void func_80604CBC(Actor*, s32, s32, s32, s32, s32, f32, s32); s32 func_806CC10C(s16, s16); s16 func_806119A0(void); diff --git a/src/global_asm/code_BDEE0.c b/src/global_asm/code_BDEE0.c index f8faa5c..3a06589 100644 --- a/src/global_asm/code_BDEE0.c +++ b/src/global_asm/code_BDEE0.c @@ -137,7 +137,6 @@ void func_806BB32C(void) { extern f32 D_8075BAEC; extern f32 D_8075BAF0; void func_807248B0(Actor*, f32); -s16 func_80665DE0(f32, f32, f32, f32); void func_8072AB74(s32, f32, f32, s32, f32); void func_806D0430(f32); diff --git a/src/global_asm/code_CEAE0.c b/src/global_asm/code_CEAE0.c index 62c8196..795b1f0 100644 --- a/src/global_asm/code_CEAE0.c +++ b/src/global_asm/code_CEAE0.c @@ -2276,7 +2276,7 @@ void func_806D2DC4(void) { current_actor_pointer->control_state_progress--; phi_a1 = 0x14; } - if (object_timer > 1 && !func_806DF6D4(phi_a1)) { + if ((u32)object_timer > 1 && !func_806DF6D4(phi_a1)) { newControlState = func_806CDD24(current_actor_pointer, current_actor_pointer->unkB8, extra_player_info_pointer->unk4, 1); if (newControlState != 0xC) { // TODO: Non matching here @@ -4205,8 +4205,6 @@ void func_806DA320(void) { extern f64 D_8075CEB8; -s16 func_80665DE0(f32, f32, f32, f32); - /* // TODO: Float regalloc void func_806DA3E4(void) { diff --git a/src/global_asm/code_EFDC0.c b/src/global_asm/code_EFDC0.c index 1d2e1b5..9b9f558 100644 --- a/src/global_asm/code_EFDC0.c +++ b/src/global_asm/code_EFDC0.c @@ -1069,8 +1069,6 @@ void func_806EFA1C(void) { current_actor_pointer->control_state_progress = 0; } -s16 func_80665DE0(f32, f32, f32, f32); - #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_EFDC0/func_806EFA3C.s") extern s32 D_8075D380[3]; diff --git a/src/global_asm/code_F56F0.c b/src/global_asm/code_F56F0.c index 891347f..ad3129c 100644 --- a/src/global_asm/code_F56F0.c +++ b/src/global_asm/code_F56F0.c @@ -274,40 +274,49 @@ void func_806F3760(s16 map) { #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_F56F0/func_806F37BC.s") -void func_806F386C(u8, Actor*, Actor*, s16, s32); +void func_806F386C(u8, Actor*, Actor*, s16, u8); #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_F56F0/func_806F386C.s") -/* -extern void *D_80753E90; +typedef struct { + s16 unk0; + s32 unk4; +} Struct80753E90_2; + +// TODO: Same as GlobalASMStruct75? +typedef struct { + s16 unk0; + s16 unk2; + Struct80753E90_2 *unk4; +} Struct80753E90; + +extern Struct80753E90 *D_80753E90; extern u8 D_8076A0B1; extern s32 D_807FD70C; -extern s32 D_807FD708; +extern Struct80753E90_2 *D_807FD708; extern Actor *D_807FD710; extern s16 D_807FD714; extern s16 D_807FD718; extern Actor *D_807FD71C; -// TODO: Very doable, just gotta figure out some structs +/* +// TODO: Close void func_806F386C(u8 arg0, Actor *arg1, Actor *arg2, s16 arg3, u8 arg4) { - s32 temp_t6; - void *temp_t5; PlayerAdditionalActorData *temp_v0; temp_v0 = arg1->PaaD; - if (D_80753E90->unk0 >= arg0) { + if (D_80753E90[0].unk0 >= arg0) { is_autowalking = 3; D_8076A0B1 |= 0x10; D_807FD710 = arg1; temp_v0->unk1F0 &= ~1; D_807FD714 = 0; - temp_t5 = D_80753E90->unk4 + (arg0 * 8); - D_807FD708 = temp_t5; - D_807FD70C = temp_t5->unk4; + D_807FD708 = D_80753E90[arg0].unk4; + D_807FD70C = D_807FD708->unk4; D_807FD718 = arg3; D_807FD71C = arg2; if (arg4 == 0) { - func_806F37BC(arg1, D_807FD70C, arg3); + func_806F37BC(arg1, D_807FD70C); } } } @@ -343,6 +352,54 @@ void func_806F397C(Actor *arg0, Actor *arg1, s16 arg2, s16 arg3) { #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_F56F0/func_806F3BEC.s") +f32 func_80612794(s16); + +typedef struct { + s16 unk0; // X Position + s16 unk2; // Y Position + s16 unk4; // Z Position + s16 unk6; + u8 unk8; + u8 unk9; // Used +} Struct806F3BEC; + +/* +void func_806F3BEC(Actor *arg0, s16 arg1, s16 arg2, u8 arg3) { + s16 sp3A; + f32 temp_f0; + f32 temp_f16; + Struct80753E90_2 *temp_a1; + Struct806F3BEC *temp_t0; + void *temp_v0; + Struct806F3BEC *temp_v0_2; + + sp3A = func_80665DE0(arg1, arg2, arg0->x_position, arg0->z_position); + temp_a1 = &D_80753E90[0].unk4[D_80753E90[0].unk0]; + if (arg0->control_state != 0x44) { + temp_a1->unk0 = 2; + temp_v0 = malloc(0x24); + temp_a1->unk4 = temp_v0; + func_80611690(temp_v0); + temp_v0_2 = temp_a1->unk4; + temp_t0 = temp_v0_2 + 0x12; + temp_v0_2->unk0 = arg0->x_position; + temp_v0_2->unk2 = arg0->y_position; + temp_v0_2->unk4 = arg0->z_position; + temp_v0_2->unk9 = 0x28; + temp_f0 = func_80612794(sp3A); + + temp_t0->unk0 = (temp_f0 * arg3) + arg0->x_position; + temp_t0->unk2 = arg0->y_position; + temp_f16 = func_80612790(sp3A) * arg3; + temp_t0->unk4 = temp_f16 + arg0->z_position; + temp_t0->unk9 = 0x28; + func_806F386C(D_80753E90[0].unk0, arg0, 0, 0, 0); + D_807FD716 = 0; + global_properties_bitfield |= 0x400; + } +} +*/ + void func_806F3DB0(void) { D_807FD716 |= 2; } @@ -364,4 +421,25 @@ void func_806F3DC8(u16 *arg0, s16 *arg1, u8 *arg2, u16 arg3) { // Autowalk file arg0 #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_F56F0/func_806F4528.s") -#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_F56F0/func_806F46B0.s") +typedef struct { + s16 unk0; + s8 unk2; + s8 unk3; + s16 unk4; +} Struct80753EA0; + +extern Struct80753EA0 D_80753EA0[]; +extern f32 D_8075D850; +extern s32 D_8076A0A8; + +f32 func_806F46B0(s16 arg0) { + s16 i; + s32 max = 0xD; // TODO: Why does this need to be a temp variable? + + for (i = 0; i < max; i++) { + if ((D_8076A0A8 == D_80753EA0[i].unk0) && (((arg0 == D_80753EA0[i].unk2)) || (D_80753EA0[i].unk2 == -1))) { + return D_80753EA0[i].unk4; + } + } + return D_8075D850; +} diff --git a/src/menu/code_1AF0.c b/src/menu/code_1AF0.c index 9e9e947..90f682b 100644 --- a/src/menu/code_1AF0.c +++ b/src/menu/code_1AF0.c @@ -16,6 +16,7 @@ typedef struct menu_struct_1 { u8 unkF; u8 unk10; u8 unk11; + u8 unk12; } MenuStruct1; extern u8 D_800334DC[]; @@ -126,6 +127,88 @@ void func_80025E04(MenuStruct1 *arg0, s32 arg1) { // It checks whether levels have been entered and does stuff with actor behaviour index #pragma GLOBAL_ASM("asm/nonmatchings/menu/code_1AF0/func_80025FB4.s") +extern u8 D_807FCC4C; + +/* +void func_80025FB4(MenuStruct1 *arg0, s32 arg1, ? arg2) { + ? *var_v1; + s16 temp_a0; + s16 temp_v0; + s32 temp_s0; + s32 var_a2; + s32 var_s0; + s32 var_s1; + u32 temp_v1; + void *var_a1; + + var_s1 = 0; + var_s0 = 6; + if (isFlagSet(0x1CB, 0) == 0) { +loop_1: + var_s0 -= 1; + if (var_s0 >= 0) { + if (isFlagSet(var_s0 + 0x1C5, 0) == 0) { + goto loop_1; + } + } + } + temp_s0 = var_s0 + 1; + arg0->unkC = getLevelIndex(D_8076A0AB, 0); + temp_v1 = current_actor_pointer->unk58; + var_a2 = 0 * 6; + switch (temp_v1) { + default: + var_v1 = sp2C; + break; + case 0xBD: // Cranky + var_v1 = &D_80033260; + break; + case 0xBF: // Candy + var_v1 = &D_80033334; + break; + case 0xBE: // Funky + var_v1 = &D_80033408; + break; + } + if (temp_s0 > 0) { + var_a1 = var_v1 + (D_8074E77C * 0x2A) + var_a2; +loop_12: + temp_a0 = var_a1->unk0; + var_a2 += 6; + if (temp_a0 >= 0) { + if ((temp_a0 == 2) || (temp_a0 == 4)) { + if (!((1 << (var_a1->unk2 + 0x1F)) & *(arg1 + temp_a0))) { + goto block_18; + } + } else if (*(arg1 + temp_a0) < var_a1->unk2) { +block_18: + var_s1 = 1; + } + if (var_s1 != 0) { + arg0->unkB = temp_a0; + temp_v0 = var_a1->unk4; + arg0->unk4 = temp_v0; + D_80750AC8 = temp_v0; + arg0->unk11 = var_a1->unk2; + } + } + var_a1 += 6; + if ((var_a2 < (temp_s0 * 6)) && (var_s1 == 0)) { + goto loop_12; + } + } + if (var_s1 == 0) { + arg0->unk4 = 0; + arg0->unkB = -1; + D_80750AC8 = arg0->unk4; + if (temp_s0 >= 7) { + arg0->unkB = -2; + } + } + arg0->unk10 = D_807FCC4C; +} +*/ + s32 func_800261C0(MenuStruct1 *arg0, s32 arg1) { s32 ret = 0; arg0->unkF = 3; @@ -158,9 +241,149 @@ void func_80026290(MenuStruct1 *arg0, u32 *arg1) { arg0->unkB = -1; } -// Doable, big though #pragma GLOBAL_ASM("asm/nonmatchings/menu/code_1AF0/func_800262A8.s") +extern MenuStruct1 D_800334EC; +extern MenuStruct1 D_80033500; +extern MenuStruct1 D_80033514; +extern u16 D_80033528; +extern u16 D_80750AC8; + +extern u8 D_807FCC4C; +extern u8 D_800334DD[]; + +/* +// TODO: Doable, good progress made +void func_800262A8(MenuStruct1 *arg0, u8 *arg1, s32 arg2) { + MenuStruct1 *sp44; + u16 sp42; + s32 sp3C; + u16 sp3A; + u16 sp38; + u16 sp36; + u16 sp34; + u16 sp2C; + s32 sp28; + s16 var_a0; + s32 temp_v0_2; + u16 var_a2; + u16 var_t0; + u16 var_t1; + u16 var_v1; + + if (func_80629148() != 0) { + sp44 = NULL; + sp3C = func_800261C0(arg0, arg2); + func_80629174(); + arg0->unk12 = 0; + arg0->unkE++; + switch (current_actor_pointer->unk58) { + case 0xBF: // Candy + var_v1 = 3; + var_a2 = 7; + var_t0 = 0xC; + var_t1 = 0xE; + if (arg0->unkB >= 0) { + sp3A = 3; + sp38 = 7; + sp36 = 0xC; + sp34 = 0xE; + var_v1 = 3; + var_a2 = 7; + var_t0 = 0xC; + var_t1 = 0xE; + temp_v0_2 = func_80025AF0(arg0, 1, 7, arg0); + if (arg1[arg0->unkB] & 1) { + var_a2 = 9; + var_v1 = 5; + if (D_807FCC4C < D_800334DD[arg1[arg0->unkB]]) { + var_v1 = 6; + var_t0 = 0xD; + var_t1 = 0xF; + arg0->unk12 = 1; + } else { + var_a2 = 8; + } + } else if (temp_v0_2 == 0) { + var_v1 = 4; + } + } + D_80033500.unk4 = var_v1; + D_80033500.unk6 = var_a2; + D_80033500.unkC = var_t0; + D_80033500.unkE = var_t1; + sp44 = &D_80033500; + sp42 = 9; + break; + case 0xBD: // Cranky + arg2 = 0; + sp2C = D_80750AC8; + var_v1 = 0; + sp3C = func_800261C0(arg0, 0); + if ((sp3C == 0) || (sp3C == 1)) { + sp3C = 0; + sp2C = 0xF; + } + sp42 = 8; + sp44 = &D_800334EC; + if (arg0->unkA == 0) { + if (isFlagSet(0x61, 2) != 0) { + setFlag(0x61, 0, 2); + func_80026290(arg0, &sp3C); + if (isFlagSet(0x17B, 0) != 0) { + var_v1 = 0x20; + } else if (isFlagSet(0x62, 2) != 0) { + setFlag(0x62, 0, 2); + var_v1 = 0x22; + } else { + var_v1 = 0x21; + } + } else { + sp28 = func_80731AA8(0x225, 0x28, 0); + if (sp28 >= 0xF) { + func_80026290(arg0, &sp3C); + if (isFlagSet(0x17B, 0) != 0) { + var_v1 = 0x20; + } else { + var_v1 = 2; + sp2C = sp28; + } + } + } + } + D_80750AC8 = sp2C; + D_800334EC.unk0 = var_v1; + break; + case 0xBE: // Funky + sp44 = &D_80033514; + var_v1 = 3; + if (arg0->unkB == 3) { + sp44 = &D_80033528; + } else { + var_a0 = 4; + if ((arg0->unkB >= 0) && (arg1[arg0->unkB] & 1)) { + var_v1 = 5; + var_a0 = 6; + } + D_80033514.unk4 = var_v1; + D_80033514.unk6 = var_a0; + } + sp42 = 7; + break; + } + if (arg2 != 0) { + func_8070D8C0(current_actor_pointer, sp42, sp44[0].unk11); + } + func_8070D8C0(current_actor_pointer, sp42, sp44[sp3C].unk11); + if ((sp3C == 2) || (sp3C == 3) || (sp3C == 6) || (sp3C == 7)) { + func_806F833C(0); + func_806F8BC4(1, 1, 0); + func_806F8BC4(0xE, 1, 0); + } + } +} +*/ + void func_80026684(MenuStruct1 *arg0, s32 arg1, s32 arg2) { switch (arg0->unkE) { case 0: diff --git a/src/menu/code_3E10.c b/src/menu/code_3E10.c index 317e811..d4d4703 100644 --- a/src/menu/code_3E10.c +++ b/src/menu/code_3E10.c @@ -903,4 +903,15 @@ s32 func_800322D0(s8 arg0) { #pragma GLOBAL_ASM("asm/nonmatchings/menu/code_3E10/func_80032304.s") -#pragma GLOBAL_ASM("asm/nonmatchings/menu/code_3E10/func_800324CC.s") +s32 *label_string_pointer_array; + +void func_800324CC(void) { + s32 temp_v0; + s32 i; + + label_string_pointer_array = malloc(101 * sizeof(s32)); + i = 0; + while (i != 101) { + label_string_pointer_array[i++] = func_8070E750(0x25, i, 0); + } +} diff --git a/src/menu/code_E550.c b/src/menu/code_E550.c index 58ff9c7..da9a630 100644 --- a/src/menu/code_E550.c +++ b/src/menu/code_E550.c @@ -5,7 +5,6 @@ s32 func_80629148(void); void func_806319C4(Actor*, s32); void func_8068A858(s32 *, s32 *, s32 *); -void func_80729B00(); extern s32 D_80033FB0; extern s32 D_80033FB1; extern s32 D_80033FB2; diff --git a/src/water/code_0.c b/src/water/code_0.c index ee4096f..413f73e 100644 --- a/src/water/code_0.c +++ b/src/water/code_0.c @@ -312,8 +312,6 @@ extern f64 D_8002A078; #pragma GLOBAL_ASM("asm/nonmatchings/water/code_0/func_80026904.s") -s16 func_80665DE0(f32, f32, WaterStruct4*, f32, f32); - // Doable, pretty close /* void func_80026904(WaterStruct4 *arg0, WaterStruct2 *arg1) { @@ -329,7 +327,7 @@ void func_80026904(WaterStruct4 *arg0, WaterStruct2 *arg1) { return; } if ((arg0->unk1E0 == 2) && (arg0->unk3C < D_80029BA4->unkA)) { - func_80025DB8(arg0->unk54, arg0, 0, ((func_80665DE0(arg0->unk8, arg0->unk10, arg0, D_807FBB48->x_position, D_807FBB48->z_position) + (func_806119A0() & 0x7FF)) - 0x400), 1); + func_80025DB8(arg0->unk54, arg0, 0, ((func_80665DE0(arg0->unk8, arg0->unk10, D_807FBB48->x_position, D_807FBB48->z_position) + (func_806119A0() & 0x7FF)) - 0x400), 1); arg0->unk1E0 = 1; } } else if (D_80029BA4 == arg0->unk54) { diff --git a/symbol_addrs.global_asm.us.txt b/symbol_addrs.global_asm.us.txt index f06d6f4..0f1750e 100644 --- a/symbol_addrs.global_asm.us.txt +++ b/symbol_addrs.global_asm.us.txt @@ -191,3 +191,9 @@ D_80758918 = 0x80758918; D_80748BA0 = 0x80748BA0; D_8075BAEC = 0x8075BAEC; D_8075BAF0 = 0x8075BAF0; + +D_8075B5D0 = 0x8075B5D0; +D_8075B5DC = 0x8075B5DC; + +D_807FD708 = 0x807FD708; +D_8076A0A8 = 0x8076A0A8; diff --git a/symbol_addrs.menu.us.txt b/symbol_addrs.menu.us.txt index 094f53f..6f4ca1e 100644 --- a/symbol_addrs.menu.us.txt +++ b/symbol_addrs.menu.us.txt @@ -58,3 +58,4 @@ newly_pressed_input_copy = 0x807ECD66; D_80033D54 = 0x80033D54; D_1000118 = 0x1000118; D_20000C0 = 0x20000C0; +D_80033514 = 0x80033514;