From 1ad7eac318e57ed1ed713adf758ea031c08706b5 Mon Sep 17 00:00:00 2001 From: Donkey Kong Date: Sat, 1 Jun 2024 18:32:08 +0930 Subject: [PATCH] Attempt func_bonus_80024158 --- decompressed.us.yaml | 4 +- include/functions.h | 3 + src/bonus/code_0.c | 347 ++++++++++++++++++++++++- src/boss/code_3840.c | 1 - src/global_asm/code_12E800.c | 1 - src/global_asm/code_3C10.c | 2 - src/global_asm/code_478F0.c | 2 - src/global_asm/code_A2F10.c | 1 - src/global_asm/code_A8400.c | 1 - src/global_asm/code_C2A90.c | 1 - src/global_asm/code_F9450.c | 1 - src/global_asm/done/code_A6280.c | 1 - src/global_asm/{ => done}/code_AAAF0.c | 6 +- src/global_asm/heap.c | 2 +- src/jetpac/code_3480.c | 2 +- src/minecart/code_0.c | 112 +++++++- src/multiplayer/code_0.c | 1 - 17 files changed, 463 insertions(+), 25 deletions(-) rename src/global_asm/{ => done}/code_AAAF0.c (98%) diff --git a/decompressed.us.yaml b/decompressed.us.yaml index 2ea699c..d3a8aac 100644 --- a/decompressed.us.yaml +++ b/decompressed.us.yaml @@ -267,7 +267,7 @@ segments: - [0x20A6280, c, done/code_A6280] - [0x20A7710, c, code_A7710] - [0x20A8400, c, code_A8400] - - [0x20AAAF0, c, code_AAAF0] + - [0x20AAAF0, c, done/code_AAAF0] - [0x20ACDC0, c, code_ACDC0] - [0x20B1F60, c, code_B1F60] - [0x20B2CE0, c, code_B2CE0] @@ -398,7 +398,7 @@ segments: - [0x215F250, .rodata, done/code_A6280] - [0x215F2B0, .rodata, code_A7710] - [0x215F440, .rodata, code_A8400] - - [0x215F6A0, .rodata, code_AAAF0] + - [0x215F6A0, .rodata, done/code_AAAF0] - [0x215F780, rodata] # code_ACDC0, TODO: Double 255.0 in a row, weird - [0x215FA20, .rodata, code_B1F60] - [0x215FB20, .rodata, code_B2CE0] diff --git a/include/functions.h b/include/functions.h index 66d837b..88589e8 100644 --- a/include/functions.h +++ b/include/functions.h @@ -37,6 +37,9 @@ void func_global_asm_8060BF84(s32, u8, u16 *, u8*); void func_global_asm_8060BEA8(s32, u8, u16 *, u8*); void func_global_asm_8060BCA0(s32 arg0, u8 arg1, u8 arg2, u16 *arg3, u8 *arg4); +void func_global_asm_806A5DF0(s16 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, u8 arg5, s16 arg6, s32 arg7); +void func_global_asm_806A6DB4(u8 arg0); + u8 func_global_asm_8072AB74(u8 arg0, f32 x, f32 z, u16 arg3, f32 arg4); void func_global_asm_806A1AC4(void); diff --git a/src/bonus/code_0.c b/src/bonus/code_0.c index a4121d5..fd87842 100644 --- a/src/bonus/code_0.c +++ b/src/bonus/code_0.c @@ -29,7 +29,6 @@ typedef struct { Gfx *func_global_asm_8068DC54(Gfx*, s32, s32, void *, s32, void *); void func_global_asm_806A2A10(s32, s32, s32); -void func_global_asm_806A5DF0(s32, f32, f32, f32, s32, s32, s32, s32); void func_global_asm_80737638(void * arg0, enum sfx_e arg1, u32 arg2 , u32 arg3, f32 arg4, u32 arg5, u32 arg6); Gfx *func_bonus_80024000(Gfx *dl, Actor *arg1) { @@ -54,13 +53,353 @@ void func_bonus_800240F0() { func_global_asm_8072707C(5, 0x40, 0); } -// Jumptable +// Jumptable, doable, close +// https://decomp.me/scratch/4iOmJ #pragma GLOBAL_ASM("asm/nonmatchings/bonus/code_0/func_bonus_80024158.s") +/* +void func_global_asm_806C8E58(s16 arg0); +u8 func_global_asm_806FDB8C(s32, s8 *, s32, s32, f32, f32); // extern +extern s32 D_bonus_8002D863[4]; +extern s16 D_global_asm_80750AC4; +extern s16 D_global_asm_8076AEF2; +extern u8 D_global_asm_807FBDC4; + +typedef struct { + u16 unk0; + s16 unk2; + s16 unk4; + u8 unk6[0x9 - 0x6]; + u8 unk9; +} A178_80024158; + +void func_bonus_80024158(void) { + s16 i; + u8 sp6F; + u8 sp6E; + char *aString; + u8 boolVal2; + u8 boolVal1; + s16 temp_v0_2; + char *bString; + char *cString; + s32 song; + s32 var_v1; + u8 temp_v1_2; + A178_80024158 *a178; + + a178 = current_actor_pointer->unk178; + initializeCharacterSpawnerActor(); + sp6F = D_global_asm_807FDC9C[1].pad0; + sp6E = D_global_asm_807FDC9C->unkA_u8[0]; + addActorRecolor( + player_pointer, + player_pointer->x_position, + player_pointer->y_position + 30.0f, + player_pointer->z_position, + 0xFF, 0xFF, 0xFF, 0xFF, + 0 + ); + if (!(current_actor_pointer->object_properties_bitfield & 0x10)) { + boolVal2 = FALSE; + func_global_asm_80629174(); + D_global_asm_807FDC98->unk46 |= 0x80; + func_global_asm_806FB370(2, 0, 1); + func_global_asm_806FB370(5, 0, 1); + func_global_asm_806FB370(4, 0, 2); + current_actor_pointer->control_state = 0; + func_global_asm_806A2A10(0xDC, 0x2A, D_global_asm_807FDC9C->unkA_u8[1]); + switch (sp6F) { // switch 1 + case 14: // switch 1 + func_global_asm_8063DA78(((rand() >> 0xF) % 32767) % 4, 1, 1); + // fallthrough + case 0: // switch 1 + case 4: // switch 1 + case 13: // switch 1 +block_4: + aString = getTextString(0x1A, 2, 1); + boolVal2 = TRUE; + break; + case 15: // switch 1 + func_global_asm_806C8E58(8); + current_player->control_state = 0xC; + current_player->control_state_progress = 0; + playAnimation(current_player, 9); + current_player->unkB8 = 0.0f; + func_global_asm_806D03BC(); + goto block_4; + case 1: // switch 1 + case 10: // switch 1 + case 12: // switch 1 + case 16: // switch 1 + a178->unk2 = 0; + break; + case 3: // switch 1 + func_bonus_800240F0(); + break; + case 5: // switch 1 + func_bonus_800240F0(); + // fallthrough + case 2: // switch 1 + case 6: // switch 1 + case 7: // switch 1 + case 8: // switch 1 + case 11: // switch 1 + D_global_asm_80750AC4 = 0; + aString = getTextString(0x1A, 3, 1); + boolVal2 = TRUE; + break; + case 9: // switch 1 + getSpawnerTiedActor((((rand() >> 0xF) % 32767) % 8) + 0x11, 0)->unk15F = 1; + break; + } + if (boolVal2) { + a178->unk9 = func_global_asm_806FDB8C(1, aString, 8, 0, 0.0f, 0.0f); + func_global_asm_806FDAB8(a178->unk9, 0.0f); + a178->unk4 = sp6E; + a178->unk2 = sp6E; + } + } + if (current_actor_pointer->control_state == 0) { + for (i = 0; i < D_global_asm_807FBDC4; i++) { + if (D_global_asm_807FBB70.unk258[i] == 3) { + boolVal1 = TRUE; + temp_v1_2 = D_global_asm_807FBB70.unk278[i]->unk2; + switch (sp6F) { // switch 2 + case 0: // switch 2 + temp_v0_2 = a178->unk4; + if (temp_v0_2 != 0) { + if (temp_v0_2 >= 2) { + aString = getTextString(0x1A, 0xF, 1); + bString = malloc(strlen(aString) + 5); + func_global_asm_8061134C(bString); + sprintf(bString, "%d %s", a178->unk4, aString); + } else { + bString = getTextString(0x1A, 0x10, 1); + } + func_global_asm_8069D2AC(0, 0, 0x8C, bString, 0, 0x28, 8, 8); + boolVal1 = FALSE; + } + break; + case 16: // switch 2 + if ((a178->unk2 == 0) && (temp_v1_2 != 0x28)) { + func_global_asm_8069D2AC(0, 0, 0x8C, getTextString(0x1A, 0x17, 1), 0, 0x28, 8, 8); + boolVal1 = FALSE; + } + if (temp_v1_2 == 0x28) { + boolVal1 = FALSE; + } + break; + case 2: // switch 2 + boolVal1 = TRUE; + if (func_global_asm_806F8AD4(0xB, 0) < sp6E) { + if (a178->unk4 >= 2) { + aString = getTextString(0x1A, 0x11, 1); + cString = malloc(strlen(aString) + 5); + sprintf(cString, "%d %s", sp6E - func_global_asm_806F8AD4(0xB, 0), aString); + } else { + cString = getTextString(0x1A, 0x12, 1); + } + func_global_asm_8069D2AC(0, 0, 0x8C, cString, 0, 0x28, 8, 8); + boolVal1 = FALSE; + } + break; + case 7: // switch 2 + case 8: // switch 2 + case 9: // switch 2 + case 11: // switch 2 + case 15: // switch 2 + boolVal1 = FALSE; + break; + case 12: // switch 2 + case 13: // switch 2 + boolVal1 = FALSE; + if (temp_v1_2 != 0x12) { + if (temp_v1_2 == 0x27) { + current_actor_pointer->unk15F++; + if (current_actor_pointer->unk15F >= 3) { + boolVal1 = FALSE; + func_global_asm_8063DA40(2, 0xA); + } + } else { + boolVal1 = FALSE; + func_bonus_800265C0(1, 1); + } + } + break; + } + if (boolVal1) { + func_bonus_800264E0(1, 0xE); + func_global_asm_80726EE0(0); + } + } + } + } + if (current_actor_pointer->control_state == 0) { + switch (sp6F) { // switch 3 + case 15: // switch 3 + func_global_asm_80724A20(); + // fallthrough + case 4: // switch 3 + case 11: // switch 3 + case 13: // switch 3 + case 14: // switch 3 + if (a178->unk4 == 0) { + func_bonus_800264E0(1, 0xE); + } + // fallthrough + case 0: // switch 3 + var_v1 = sp6E - enemies_killed; + if (var_v1 < 0) { + var_v1 = 0; + } + if (var_v1 != a178->unk4) { + func_global_asm_806FDAB8(a178->unk9, 3.1415927f); + a178->unk4 = MAX(0, sp6E - enemies_killed); + } +block_71: + if (a178->unk0 >= 2) { + addActorToTextOverlayRenderArray(&func_bonus_80024000, current_actor_pointer, 3); + } + break; + case 7: // switch 3 + case 8: // switch 3 + func_global_asm_80724A20(); + goto block_71; + case 5: // switch 3 + if ((current_map == MAP_SPLISH_SPLASH_SALVAGE_EASY) && (a178->unk4 == 1)) { + if (current_actor_pointer->control_state_progress == 0) { + current_actor_pointer->control_state_progress++; + func_global_asm_80641874(0, 0); + func_global_asm_80641874(1, 0); + func_global_asm_80641874(2, 0); + } + } + // fallthrough + case 6: // switch 3 + if (a178->unk4 == 0) { + func_bonus_800264E0(1, 0xE); + } + // fallthrough + case 2: // switch 3 + var_v1 = MAX(0, sp6E - func_global_asm_806F8AD4(0xB, 0)); + if (var_v1 != a178->unk4) { + func_global_asm_806FDAB8(a178->unk9, 3.1415927f); + a178->unk4 = MAX(0, func_global_asm_806F8AD4(0xB, 0)); + } + goto block_71; + case 9: // switch 3 + case 10: // switch 3 + case 12: // switch 3 + case 16: // switch 3 + func_global_asm_80724A20(); + break; + } + } + switch (a178->unk0) { // switch 6; irregular + case 0: // switch 6 + if (func_global_asm_80629148() != 0) { + func_global_asm_80629174(); + if (D_global_asm_8076AEF2 == 0x11) { + func_global_asm_8070E8DC(2); + } + loadText(current_actor_pointer, 0, D_bonus_8002D863[sp6F]); + a178->unk0++; + } + break; + case 1: // switch 6 + if (!(current_actor_pointer->object_properties_bitfield & 0x02000000)) { + func_global_asm_8061CB08(current_actor_pointer); + func_global_asm_806A2B08(current_actor_pointer->unk11C); + switch (current_map) { // switch 7; irregular + case MAP_KROOL_BARREL_TINY_MUSHROOM_GAME: + case MAP_KROOL_BARREL_DK_TARGET_GAME: + case MAP_KROOL_BARREL_LANKY_MAZE: + case MAP_KROOL_BARREL_DIDDY_KREMLING_GAME: // switch 7 + case MAP_KROOL_BARREL_DIDDY_ROCKETBARREL_GAME: // switch 7 + case MAP_KROOL_BARREL_LANKY_SHOOTING_GAME: // switch 7 + case MAP_KROOL_BARREL_CHUNKY_HIDDEN_KREMLING_GAME: // switch 7 + case MAP_KROOL_BARREL_TINY_PONY_TAIL_TWIRL_GAME: // switch 7 + case MAP_KROOL_BARREL_CHUNKY_SHOOTING_GAME: // switch 7 + case MAP_KROOL_BARREL_DK_RAMBI_GAME: // switch 7 + song = 0x75; + break; + case MAP_KROOL_FIGHT_DK_PHASE: // switch 7 + case MAP_KROOL_FIGHT_DIDDY_PHASE: // switch 7 + case MAP_KROOL_FIGHT_LANKY_PHASE: // switch 7 + case MAP_KROOL_FIGHT_TINY_PHASE: // switch 7 + case MAP_KROOL_FIGHT_CHUNKY_PHASE: // switch 7 + case MAP_BLOOPERS_ENDING: // switch 7 + song = 0x52; + if (sp6F != 0) { + if (sp6F != 1) { + song = 8; + } else { + song = 0x59; + } + } + } + playSong(song, 1.0f); + a178->unk0++; + } + break; + } + switch (current_actor_pointer->control_state) { // switch 5 + case 0x0: // switch 5 + if (((sp6F == 1) || (sp6F == 0) || (sp6F == 2) || (sp6F == 0x10)) && (player_pointer->y_position < 0.0f)) { + func_bonus_800265C0(1, 1); + } else if ((sp6F == 4) && (player_pointer->y_position < -20.0f)) { + playSoundAtActorPosition(current_actor_pointer, 0x362, 0xFF, 0x7F, 0); + func_bonus_800265C0(0, 1); + playCutscene(current_actor_pointer, 1, 1); + } else if (player_pointer->control_state == 0x73) { + if (sp6F == 1) { + func_bonus_800265C0(1, 0x13); + } else { + func_bonus_800265C0(1, 1); + } + } else if ((sp6F == 3) && (player_pointer->control_state == 0x31)) { + func_bonus_800265C0(1, 0x14); + } else if (current_actor_pointer->unk11C->control_state == 5) { + if (sp6F == 3) { + func_bonus_800264E0(1, 0x15); + } else { + func_bonus_800265C0(1, 0x16); + } + } + break; + default: // switch 5 + break; + case 0x1: // switch 5 + current_actor_pointer->unk11C->control_state = 0; + current_actor_pointer->control_state++; + break; + case 0x27: // switch 5 + func_global_asm_806FDAB8(a178->unk9, 3.1415927f); + a178->unk4--; + if (a178->unk4 == 0) { + func_bonus_800264E0(1, 0xE); + } else { + current_actor_pointer->control_state = 0; + } + break; + case 0x28: // switch 5 + a178->unk2 = 1; + current_actor_pointer->control_state = 0; + break; + case 0x37: // switch 5 + func_bonus_800265C0(1, 1); + break; + case 0x12: // switch 5 + func_bonus_800264E0(1, 0xE); + break; + } +} +*/ + Gfx *func_bonus_80024D3C(Gfx *dl, s32 arg1) { gSPDisplayList(dl++, &D_1000118); - // TODO: Get rid of magic constants - gDPSetCombine(dl++, 0x119623, 0xFF2FFFFF); + gDPSetCombineMode(dl++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetPrimColor(dl++, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF); return dl; } diff --git a/src/boss/code_3840.c b/src/boss/code_3840.c index d14726e..4266194 100644 --- a/src/boss/code_3840.c +++ b/src/boss/code_3840.c @@ -43,7 +43,6 @@ typedef struct { s16 unk10; } A17C_80028878; -void func_global_asm_806A5DF0(s32, f32, f32, f32, s32, s32, s16, s32); extern void func_global_asm_8071CDE0(void* arg0, s32 arg1); void func_global_asm_80737638(void * arg0, enum sfx_e arg1, u32 arg2 , u32 arg3, f32 arg4, u32 arg5, u32 arg6); diff --git a/src/global_asm/code_12E800.c b/src/global_asm/code_12E800.c index 122909f..efdf5cc 100644 --- a/src/global_asm/code_12E800.c +++ b/src/global_asm/code_12E800.c @@ -4,7 +4,6 @@ extern s32 D_global_asm_8071FB34; extern s32 D_global_asm_8071FF18; extern f64 D_global_asm_8075FF20; -void func_global_asm_806A5DF0(s32, f32, f32, f32, s32, s32, s32, s32); extern f64 D_global_asm_8075FF38; diff --git a/src/global_asm/code_3C10.c b/src/global_asm/code_3C10.c index 53d9b5b..5d55bba 100644 --- a/src/global_asm/code_3C10.c +++ b/src/global_asm/code_3C10.c @@ -464,8 +464,6 @@ void func_global_asm_805FF660(u8 arg0) { D_global_asm_80744820 = arg0; } -void func_global_asm_806A5DF0(s32, f32, f32, f32, u16, s32, s32, s32); - void func_global_asm_805FF670(void) { f32 temp_f20; s16 spawn_x; diff --git a/src/global_asm/code_478F0.c b/src/global_asm/code_478F0.c index 1479e1f..e30fbb3 100644 --- a/src/global_asm/code_478F0.c +++ b/src/global_asm/code_478F0.c @@ -1915,8 +1915,6 @@ void func_global_asm_8064C134(Struct8064BFD0 *arg0, s32 arg1, s16 arg2, s32 arg3 } } -void func_global_asm_806A5DF0(s32, f32, f32, f32, s32, s32, s32, s32); - void func_global_asm_8064C250(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { func_global_asm_806A5DF0(0x2F, D_global_asm_807F621C, D_global_asm_807F6220 + 15.0f, D_global_asm_807F6224, 0, 1, -1, 0); func_global_asm_806A5DF0(0x2F, D_global_asm_807F621C, D_global_asm_807F6220 + 15.0f, D_global_asm_807F6224, 0x400, 1, -1, 0); diff --git a/src/global_asm/code_A2F10.c b/src/global_asm/code_A2F10.c index f402fc0..c893814 100644 --- a/src/global_asm/code_A2F10.c +++ b/src/global_asm/code_A2F10.c @@ -52,7 +52,6 @@ extern u8 D_global_asm_807FBD70; GlobalASMStruct60 *func_global_asm_80688584(Actor*, s32); Gfx *func_global_asm_8069FA40(Gfx *arg0, Actor *arg1); extern char *D_global_asm_80750338[]; -void func_global_asm_806A5DF0(s16 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, s16 arg5, s16 arg6, Actor *arg7); // Jumptable, close, doable // https://decomp.me/scratch/yqWRH diff --git a/src/global_asm/code_A8400.c b/src/global_asm/code_A8400.c index d85bb1e..4aef1fe 100644 --- a/src/global_asm/code_A8400.c +++ b/src/global_asm/code_A8400.c @@ -19,7 +19,6 @@ extern Struct80750400 D_global_asm_80750400[]; int func_global_asm_806A4284(); void func_global_asm_806A4DDC(Actor *arg0); void func_global_asm_806A5174(Actor*, void*, f32); -void func_global_asm_806A5DF0(s16 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, u8 arg5, s16 arg6, s32 arg7); void func_global_asm_8070DA74(Actor*); void func_global_asm_8070E808(Actor *arg0, Actor *arg1); diff --git a/src/global_asm/code_C2A90.c b/src/global_asm/code_C2A90.c index e295e96..b6ec6a0 100644 --- a/src/global_asm/code_C2A90.c +++ b/src/global_asm/code_C2A90.c @@ -30,7 +30,6 @@ void func_global_asm_8061CAD8(void); void func_global_asm_8061CB08(void); void func_global_asm_8061F510(s32, s32); void func_global_asm_8062217C(Actor *, s32); -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); diff --git a/src/global_asm/code_F9450.c b/src/global_asm/code_F9450.c index a0eba65..d448286 100644 --- a/src/global_asm/code_F9450.c +++ b/src/global_asm/code_F9450.c @@ -20,7 +20,6 @@ extern s32 D_global_asm_807FD780[]; void func_global_asm_806F5270(void); void func_global_asm_806F54E0(u8, s32, u8); -void func_global_asm_806A5DF0(s16, f32, f32, f32, s32, s32, s32, s32); void func_global_asm_806F4750(void) { func_global_asm_806F5270(); diff --git a/src/global_asm/done/code_A6280.c b/src/global_asm/done/code_A6280.c index ea4a629..e62fe74 100644 --- a/src/global_asm/done/code_A6280.c +++ b/src/global_asm/done/code_A6280.c @@ -23,7 +23,6 @@ typedef struct { s16 unk8; } AAD_806A2328; -void func_global_asm_806A5DF0(s16 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, s16 arg5, s16 arg6, Actor *arg7); void func_global_asm_806A1580(void) { s16 sp36; diff --git a/src/global_asm/code_AAAF0.c b/src/global_asm/done/code_AAAF0.c similarity index 98% rename from src/global_asm/code_AAAF0.c rename to src/global_asm/done/code_AAAF0.c index a861665..f00b159 100644 --- a/src/global_asm/code_AAAF0.c +++ b/src/global_asm/done/code_AAAF0.c @@ -72,14 +72,12 @@ typedef struct { void func_global_asm_80686CF8(Actor *actor); -void func_global_asm_806A5DF0(s16 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, u8 arg5, s16 arg6, s32 arg7); void func_global_asm_806A664C(f32 arg0); -void func_global_asm_806A6DB4(u8 arg0); s32 func_global_asm_80723020(Actor *arg0, s32 arg1, s32 arg2, f32 arg3, f32 arg4, f32 arg5, u8 arg6); void func_global_asm_80723484(s32, Actor*); -void func_global_asm_806A5DF0(s16 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, u8 arg5, s16 arg6, s32 arg7) { +void func_global_asm_806A5DF0(s16 arg0, f32 x, f32 y, f32 z, s16 arg4, u8 arg5, s16 arg6, s32 arg7) { f32 var_f0; f32 sp2C[8]; @@ -90,7 +88,7 @@ void func_global_asm_806A5DF0(s16 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, sp2C[0] = arg5; sp2C[1] = arg4; sp2C[2] = arg6; - func_global_asm_806891D8(arg0, arg1, arg2, arg3, 0, var_f0, arg7, &sp2C); + func_global_asm_806891D8(arg0, x, y, z, 0, var_f0, arg7, &sp2C); } void func_global_asm_806A5EAC(AAD_global_asm_806A5EAC *arg0, void *sprite, f32 scale) { diff --git a/src/global_asm/heap.c b/src/global_asm/heap.c index 0b71a81..c45a31e 100644 --- a/src/global_asm/heap.c +++ b/src/global_asm/heap.c @@ -86,6 +86,7 @@ s32 func_global_asm_806111BC(s32 arg0, s32 arg1) { return 0; } +// close #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/heap/func_global_asm_806111F8.s") typedef struct Struct807F0988_unk8 Struct807F0988_unk8; @@ -108,7 +109,6 @@ typedef struct { extern Struct807F0988 D_global_asm_807F0988[]; /* -// TODO: Close void *func_global_asm_806111F8(s32 arg0, u32 arg1) { u32 temp_a0; u32 var_v0; diff --git a/src/jetpac/code_3480.c b/src/jetpac/code_3480.c index d665f3d..f43bb4d 100644 --- a/src/jetpac/code_3480.c +++ b/src/jetpac/code_3480.c @@ -520,8 +520,8 @@ typedef struct { extern Struct8002DC38 D_jetpac_8002DC38[2]; extern s32 D_jetpac_8002DD88; + /* -close void func_jetpac_800289EC(void) { s32 pad[6]; s32* sp44; diff --git a/src/minecart/code_0.c b/src/minecart/code_0.c index b909160..44d1c22 100644 --- a/src/minecart/code_0.c +++ b/src/minecart/code_0.c @@ -332,9 +332,119 @@ void func_minecart_80024914(void) { } // long, structs -// https://decomp.me/scratch/2LtnJ +// https://decomp.me/scratch/3Hkbw #pragma GLOBAL_ASM("asm/nonmatchings/minecart/code_0/func_minecart_80024B00.s") +/* +extern s32 D_global_asm_807F5FD0; +extern s32 D_minecart_80028C48; +extern u8 D_minecart_80028C50; + +typedef struct Vec3f { + f32 x; + f32 y; + f32 z; +} Vec3f; + +typedef struct { + s16 unk0; + s16 unk2; + Actor *unk4; + s32 unk8; + s32 unkC; + s16 unk10; + s16 unk12; + u8 unk14[0x24 - 0x14]; + f32 unk24; + f32 unk28; + s32 unk34; +} AAD_minecart_80024B00; + +void func_minecart_80024B00(void) { + s16 sp4E; + Vec3f sp3C; + Struct807F5FD4_unk0* temp_t7_2; + Vec3f* temp_t8; + Struct807F5FD4_unk0* temp_t8_2; + Struct807F5FD4_unk0* temp_t9; + Struct807F5FD4_unk0* temp_v0; + Struct807F5FD4_unk0* temp_a2; + Struct807F5FD4_unk0** temp_a2_2; + f32 temp_f0; + s16 j; + s16 i; + s32 temp_lo; + s32 temp_t4; + s32 temp_t7; + Actor *temp_v0_2; + u8 var_v0; + AAD_minecart_80024B00* aaD; + + aaD = current_actor_pointer->additional_actor_data; + temp_f0 = current_actor_pointer->animation_state->scale[1] * 0.16666666675; + sp4E = aaD->unk0; + if (!(current_actor_pointer->object_properties_bitfield & 0x10)) { + func_global_asm_807248B0(player_pointer, 0.12f); + current_actor_pointer->y_acceleration = D_global_asm_807502F8; + current_actor_pointer->terminal_velocity = D_global_asm_807502D0; + aaD->unk24 = 0.1f; + aaD->unk28 = 5.0f; + } + aaD->unk0 += (current_actor_pointer->y_velocity * temp_f0); + func_global_asm_80729E6C(); + if (aaD->unk0 < 0) { + aaD->unk0 = 0; + if (sp4E != 0) { + playSoundAtActorPosition(current_actor_pointer, 0x8B, 0xFFU, 0x7F, 0x1EU); + } + } + if (player_pointer->unk6A & 0x100) { + player_pointer->unk6A &= 0xFEFF; + current_actor_pointer->unk168 = 2; + } + func_minecart_8002430C(1U, &D_minecart_80028C48, 0x7FFF, 0x23U); + func_minecart_80024768(); + if ((aaD->unk34 >= 7) && (func_global_asm_8061CB50()) && (current_actor_pointer->control_state != 5)) { + current_actor_pointer->unkB8 = 300.0f; + } + if (current_actor_pointer->control_state == 4) { + for (i = 0; i < D_global_asm_807F5FD0; i++) { + temp_a2 = &D_global_asm_807F5FD4->unk0[i]; + j = 0; + temp_lo = (s32) (temp_a2->unk4 - temp_a2->unk0) / 12; + temp_t4 = (s16) temp_lo / 2; + while (j < temp_t4) { + temp_a2_2 = &D_global_asm_807F5FD4->unk0[i]; + temp_t8 = &D_global_asm_807F5FD4->unk0[i][j]; + temp_t7 = (s16) temp_lo - j; + sp3C.x = temp_t8->x; + sp3C.y = temp_t8->y; + sp3C.z = temp_t8->z; + temp_v0 = *temp_a2_2; + temp_t8_2 = &temp_v0[temp_t7]; + temp_t9 = &temp_v0[j]; + // temp_t9->unk0 = temp_t8_2->unk-C; + // temp_t9->unk4 = temp_t8_2->unk-8; + // temp_t9->unk8 = temp_t8_2->unk-4; + temp_t7_2 = &D_global_asm_807F5FD4->unk0[i][temp_t7]; + // temp_t7_2->unk-C = (f32) sp3C.unk0; + j += 1; + // temp_t7_2->unk-8 = (f32) sp3C.unk4; + // temp_t7_2->unk-4 = (f32) sp3C.unk8; + } + } + aaD->unk34 = &D_minecart_80028C50; + aaD->unk10 = 2; + current_actor_pointer->control_state = 5; + aaD->unkC = 0; + } + if (current_actor_pointer->control_state != 0) { + temp_v0_2 = aaD->unk4; + getBonePosition(current_actor_pointer, 9, &temp_v0_2->x_position, &temp_v0_2->y_position, &temp_v0_2->z_position); + } +} +*/ + void func_minecart_80024E78(AAD_minecart_80027DA0* arg0, s32* arg1[], u8 arg2, u8 arg3) { s32 var_s3; u8 temp_s5; diff --git a/src/multiplayer/code_0.c b/src/multiplayer/code_0.c index 476ba68..ecccccd 100644 --- a/src/multiplayer/code_0.c +++ b/src/multiplayer/code_0.c @@ -52,7 +52,6 @@ s32 func_multiplayer_80025608(s32 objectType); void func_multiplayer_80025F84(); s32 func_multiplayer_80026BD8(s32); -void func_global_asm_806A5DF0(u16, f32, f32, f32, s32, s32, s32, s32); void func_global_asm_806F54E0(u8, s32, s32); extern int func_global_asm_8071F3C0(); // TODO: Signature