From a3d8b2fa362fdf16b35edf66d04b97d7bf2bb3bf Mon Sep 17 00:00:00 2001 From: Donkey Kong Date: Mon, 6 May 2024 12:25:59 +0930 Subject: [PATCH] 40.2341% --- progress/progress.bonus.csv | 2 +- progress/progress.total.csv | 2 +- progress/progress_bonus.svg | 6 ++-- progress/progress_total.svg | 4 +-- src/bonus/code_2690.c | 11 +++---- src/global_asm/code_C2A90.c | 49 +++++++++++++++++++------------- src/global_asm/code_CEAE0.c | 48 +++++++++++++++---------------- src/global_asm/done/code_B6C50.c | 6 ++-- 8 files changed, 67 insertions(+), 61 deletions(-) diff --git a/progress/progress.bonus.csv b/progress/progress.bonus.csv index 5a5feb0..ad806a0 100644 --- a/progress/progress.bonus.csv +++ b/progress/progress.bonus.csv @@ -42,7 +42,7 @@ us,.bonus,func_bonus_8002733C,356,yes us,.bonus,func_bonus_80024158,3044,no us,.bonus,func_bonus_80024D8C,172,yes us,.bonus,func_bonus_800277F8,1820,no -us,.bonus,func_bonus_80028648,468,no +us,.bonus,func_bonus_80028648,468,yes us,.bonus,func_bonus_80027548,688,yes us,.bonus,func_bonus_80024D3C,80,yes us,.bonus,func_bonus_800271B4,340,yes diff --git a/progress/progress.total.csv b/progress/progress.total.csv index 81d636a..80dc646 100644 --- a/progress/progress.total.csv +++ b/progress/progress.total.csv @@ -3612,7 +3612,7 @@ us,.bonus,func_bonus_8002733C,356,yes us,.bonus,func_bonus_80024158,3044,no us,.bonus,func_bonus_80024D8C,172,yes us,.bonus,func_bonus_800277F8,1820,no -us,.bonus,func_bonus_80028648,468,no +us,.bonus,func_bonus_80028648,468,yes us,.bonus,func_bonus_80027548,688,yes us,.bonus,func_bonus_80024D3C,80,yes us,.bonus,func_bonus_800271B4,340,yes diff --git a/progress/progress_bonus.svg b/progress/progress_bonus.svg index c8266aa..139c81c 100644 --- a/progress/progress_bonus.svg +++ b/progress/progress_bonus.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ bonus - 27.6354% - 27.6354% + 28.8351% + 28.8351% diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 31246e0..744c13f 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Donkey Kong 64 (US) - 40.2057% - 40.2057% + 40.2341% + 40.2341% diff --git a/src/bonus/code_2690.c b/src/bonus/code_2690.c index ab480b9..a15e76b 100644 --- a/src/bonus/code_2690.c +++ b/src/bonus/code_2690.c @@ -438,11 +438,8 @@ void func_bonus_800284C0(void) { renderActor(current_actor_pointer, 0); } -// doable close regalloc -#pragma GLOBAL_ASM("asm/nonmatchings/bonus/code_2690/func_bonus_80028648.s") - typedef struct { - s32 unk0[6]; // Used + Actor *unk0[6]; // Used s16 unk18; u8 unk1A; u8 unk1B; // Used @@ -466,12 +463,12 @@ typedef struct { s16 unk8; // Used } AAD_bonus_80028648_2; -/* void func_bonus_80028648(ARG0_80028648 *arg0) { s32 i; AAD_bonus_80028648 *snakeAAD; AAD_bonus_80028648_2 *turtleAAD; Struct807F5FD4_unk0 *temp; + Actor *temp2; for (i = 1; i < 7; i++) { if (spawnActor(ACTOR_SNAKE, 0x15)) { @@ -486,9 +483,10 @@ void func_bonus_80028648(ARG0_80028648 *arg0) { last_spawned_actor->object_properties_bitfield |= 0x1000; last_spawned_actor->y_rotation = 0x800; arg0->unk0[i - 1] = last_spawned_actor; + temp2 = last_spawned_actor; if (spawnActor(ACTOR_TURTLE, 0x16)) { turtleAAD = last_spawned_actor->additional_actor_data; - turtleAAD->unk0 = last_spawned_actor; + turtleAAD->unk0 = temp2; turtleAAD->unk6 = i - 1; snakeAAD->unk4 = last_spawned_actor; turtleAAD->unk8 = -1; @@ -496,7 +494,6 @@ void func_bonus_80028648(ARG0_80028648 *arg0) { } } } -*/ #pragma GLOBAL_ASM("asm/nonmatchings/bonus/code_2690/func_bonus_8002881C.s") diff --git a/src/global_asm/code_C2A90.c b/src/global_asm/code_C2A90.c index 77e01c5..2e0d427 100644 --- a/src/global_asm/code_C2A90.c +++ b/src/global_asm/code_C2A90.c @@ -1127,44 +1127,55 @@ void func_global_asm_806C28B8(void) { } } -void func_global_asm_806C2A64(u8 arg0, u8 arg1, u8 arg2, f32 x, f32 y, f32 z, void *sprite, f32 scale) { +void func_global_asm_806C2A64(u8 red, u8 green, u8 blue, f32 x, f32 y, f32 z, void *sprite, f32 scale) { func_global_asm_807149A8(1000); func_global_asm_80714998(0xFF); func_global_asm_80714944(((rand() >> 0xF) % 32767) % 11); - changeActorColor(arg0, arg1, arg2, 0xFF); + changeActorColor(red, green, blue, 0xFF); func_global_asm_8071498C(&func_global_asm_80717D84); func_global_asm_80714950(2); drawSpriteAtPosition(sprite, scale * 0.2, x, y, z); } +// close, stack, float, rodata #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_C2A90/func_global_asm_806C2B2C.s") +void func_global_asm_806C2B2C(u8 boneIndex, u8 arg1, u8 colorIndex, void *sprite); + /* -void func_global_asm_806C2B2C(s32 arg0, s32 arg1, u8 arg2, s32 arg3) { - f32 spA8; - f32 spA4; - f32 spA0; - f32 sp9C; - f32 sp98; - f32 sp94; +void func_global_asm_806C2B2C(u8 boneIndex, u8 arg1, u8 colorIndex, void *sprite) { f32 temp_f20; f32 temp_f24; s16 i; - Struct80747B00 *temp_s0; + f32 x1; + f32 y1; + f32 z1; + f32 x2; + f32 y2; + f32 z2; - temp_f24 = (current_actor_pointer->animation_state->scale_y / 0.3f) / 1.5; - while (arg1 >= arg0) { + temp_f24 = (current_actor_pointer->animation_state->scale_y / 0.3) / 1.5; + while (arg1 >= boneIndex) { for (i = 0; i < 3.0; i++) { - temp_s0 = &D_global_asm_80747B00[arg2]; - temp_f20 = i / 3.0; - getBonePosition(current_actor_pointer, arg0, &spA8, &spA4, &spA0); - if (arg0 < arg1) { - getBonePosition(current_actor_pointer, arg0 + 1, &sp9C, &sp98, &sp94); + temp_f20 = (i / 3.0); + getBonePosition(current_actor_pointer, boneIndex, &x1, &y1, &z1); + if (boneIndex < arg1) { + getBonePosition(current_actor_pointer, boneIndex + 1, &x2, &y2, &z2); } else { - getBonePosition(current_actor_pointer, arg0, &sp9C, &sp98, &sp94); + getBonePosition(current_actor_pointer, boneIndex, &x2, &y2, &z2); } - func_global_asm_806C2A64(spA0, temp_s0->unk0, temp_s0->unk1, temp_s0->unk2, ((sp9C - spA8) * temp_f20) + spA8, ((sp98 - spA4) * temp_f20) + spA4, ((sp94 - spA0) * temp_f20) + spA0, arg3); + func_global_asm_806C2A64( + D_global_asm_80747B00[colorIndex].unk0, + D_global_asm_80747B00[colorIndex].unk1, + D_global_asm_80747B00[colorIndex].unk2, + ((x2 - x1) * temp_f20) + x1, + ((y2 - y1) * temp_f20) + y1, + ((z2 - z1) * temp_f20) + z1, + sprite, + temp_f24 + ); } + boneIndex++; } } */ diff --git a/src/global_asm/code_CEAE0.c b/src/global_asm/code_CEAE0.c index ea5437c..f1502ae 100644 --- a/src/global_asm/code_CEAE0.c +++ b/src/global_asm/code_CEAE0.c @@ -1420,44 +1420,42 @@ void func_global_asm_806CF0D0(void) { } } -// progress made, doable +// progress made, doable, float #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_CEAE0/func_global_asm_806CF138.s") /* void func_global_asm_806CF138(Struct806CF138 *arg0) { - // TODO: This could be a matrix - f32 sp74; - f32 sp70; - f32 sp6C; - f32 sp68; - f32 sp64; - f32 sp60; - f32 sp5C; - s32 pad2; + f32 x2; + f32 x1; + f32 y2; + f32 y1; + f32 z2; + f32 z1; + f32 dy; + f32 dx; f32 sp54; + f32 pad; f32 sp4C; f32 sp48; - f32 sp44; - f32 sp40; + f32 dz; f32 sp3C; f32 sp38; - f32 temp_f14; - s32 sp30; - s32 sp2C; + s32 boneIndex1; + s32 boneIndex2; - func_global_asm_806CF2EC(&sp30, &sp2C); - getBonePosition(arg0->unk0, sp30, &sp70, &sp68, &sp60); - getBonePosition(arg0->unk0, sp2C, &sp74, &sp6C, &sp64); - sp5C = (sp6C - sp68); - temp_f14 = (sp74 - sp70); - sp54 = func_global_asm_806118FC(sp5C / sqrtf(((sp64 - sp60) * (sp64 - sp60)) + ((temp_f14 * temp_f14) + (sp5C * sp5C)))) * 57.29577637f; + func_global_asm_806CF2EC(&boneIndex1, &boneIndex2); + getBonePosition(arg0->unk0, boneIndex1, &x1, &y1, &z1); + getBonePosition(arg0->unk0, boneIndex2, &x2, &y2, &z2); + dx = (x2 - x1); + dy = (y2 - y1); + dz = (z2 - z1); + sp54 = func_global_asm_806118FC(dy / sqrtf((dx * dx) + (dy * dy) + (dz * dz))) * 57.29577637f; sp48 = func_global_asm_80612794(arg0->unk0->y_rotation) * 50.0f; sp4C = func_global_asm_80612790(arg0->unk0->y_rotation) * 50.0f; - sp40 = (sp74 - sp70); - sp44 = (sp64 - sp60); - sp3C = (sp44 * sp4C) + (sp48 * sp40); + dx = (x2 - x1); + sp3C = (dz * sp4C) + (sp48 * dx); sp38 = sqrtf((sp4C * sp4C) + (sp48 * sp48)); - func_global_asm_8067AA58(arg0->unk0, arg0->unk4, sp54, 90.0 - (func_global_asm_80611850(sp3C / (sp38 * sqrtf((sp44 * sp44) + (sp40 * sp40)))) * 57.29577637f)); + func_global_asm_8067AA58(arg0->unk0, arg0->unk4, sp54, 90.0 - (func_global_asm_80611850(sp3C / (sp38 * sqrtf((dz * dz) + (dx * dx)))) * 57.29577637f)); } */ diff --git a/src/global_asm/done/code_B6C50.c b/src/global_asm/done/code_B6C50.c index 997e6e8..b5a28e6 100644 --- a/src/global_asm/done/code_B6C50.c +++ b/src/global_asm/done/code_B6C50.c @@ -8,7 +8,7 @@ void func_global_asm_8072AB74(s32, f32, f32, s32, f32); void func_global_asm_806A2A10(s16 arg0, s16 arg1, u8 arg2); void func_global_asm_806B1F50(void) { - u8 sp37; + u8 brightness; initializeCharacterSpawnerActor(); if (!(current_actor_pointer->object_properties_bitfield & 0x10)) { @@ -90,9 +90,9 @@ void func_global_asm_806B1F50(void) { } } if ((current_actor_pointer->control_state_progress != 0) && (func_global_asm_8067AF44(D_global_asm_807FDC94) != 0) && ((object_timer % 7U) == 0)) { - sp37 = 180 + (30 * -current_actor_pointer->control_state_progress); + brightness = 180 + (30 * -current_actor_pointer->control_state_progress); func_global_asm_80714998(3); - changeActorColor(sp37, sp37, sp37, current_actor_pointer->shadow_opacity); + changeActorColor(brightness, brightness, brightness, current_actor_pointer->shadow_opacity); func_global_asm_8068588C(D_global_asm_807FDC94, 1, 1.0f, 0.0f, 0.0f, 0.0f, -0x96); } }