diff --git a/include/functions.h b/include/functions.h index 8f4e778..58e604a 100644 --- a/include/functions.h +++ b/include/functions.h @@ -33,7 +33,7 @@ Actor *func_global_asm_807271F4(s16 arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4 Gfx *func_global_asm_8068C5A8(Gfx *, u16, s32, s32, s32, s32, s32, s32, f32, f32, s32, f32); // TODO: What do the params mean? -void playCutscene(Actor*, s16, s32); +s32 playCutscene(Actor*, s16, s32); void playSong(s32, f32); void playSound(s16, s16, f32, f32, s32, s32); diff --git a/progress/progress.critter.csv b/progress/progress.critter.csv index 9730758..bfcc2d1 100644 --- a/progress/progress.critter.csv +++ b/progress/progress.critter.csv @@ -6,7 +6,7 @@ us,.critter,func_critter_800255C4,528,no us,.critter,func_critter_80028120,1824,no us,.critter,func_critter_80026FD0,100,yes us,.critter,func_critter_80026C9C,368,no -us,.critter,func_critter_80024154,296,no +us,.critter,func_critter_80024154,296,yes us,.critter,func_critter_80024B78,272,yes us,.critter,func_critter_800288A8,500,no us,.critter,func_critter_80026B78,292,yes @@ -42,7 +42,7 @@ us,.critter,func_critter_8002516C,916,no us,.critter,func_critter_80025D1C,156,yes us,.critter,func_critter_800257D4,220,yes us,.critter,func_critter_80028A9C,844,no -us,.critter,func_critter_8002427C,528,no +us,.critter,func_critter_8002427C,528,yes us,.critter,func_critter_80025500,196,yes us,.critter,func_critter_800262C0,120,yes us,.critter,func_critter_8002904C,196,no diff --git a/progress/progress.total.csv b/progress/progress.total.csv index 08e296f..2a80e81 100644 --- a/progress/progress.total.csv +++ b/progress/progress.total.csv @@ -3623,7 +3623,7 @@ us,.critter,func_critter_800255C4,528,no us,.critter,func_critter_80028120,1824,no us,.critter,func_critter_80026FD0,100,yes us,.critter,func_critter_80026C9C,368,no -us,.critter,func_critter_80024154,296,no +us,.critter,func_critter_80024154,296,yes us,.critter,func_critter_80024B78,272,yes us,.critter,func_critter_800288A8,500,no us,.critter,func_critter_80026B78,292,yes @@ -3659,7 +3659,7 @@ us,.critter,func_critter_8002516C,916,no us,.critter,func_critter_80025D1C,156,yes us,.critter,func_critter_800257D4,220,yes us,.critter,func_critter_80028A9C,844,no -us,.critter,func_critter_8002427C,528,no +us,.critter,func_critter_8002427C,528,yes us,.critter,func_critter_80025500,196,yes us,.critter,func_critter_800262C0,120,yes us,.critter,func_critter_8002904C,196,no diff --git a/progress/progress_critter.svg b/progress/progress_critter.svg index 0398d00..abaea5d 100644 --- a/progress/progress_critter.svg +++ b/progress/progress_critter.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ critter - 35.1279% - 35.1279% + 38.7882% + 38.7882% diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 9f474e0..0d83b1b 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Donkey Kong 64 (US) - 34.6205% - 34.6205% + 34.6705% + 34.6705% diff --git a/src/bonus/code_0.c b/src/bonus/code_0.c index 1e48edd..ff0fa96 100644 --- a/src/bonus/code_0.c +++ b/src/bonus/code_0.c @@ -76,5 +76,106 @@ s32 func_bonus_80024D8C(void) { } } -// Jumptable +// Jumptable, close, doable #pragma GLOBAL_ASM("asm/nonmatchings/bonus/code_0/func_bonus_80024E38.s") + +extern void *D_global_asm_8076D1F8; + +typedef struct { + u16 unk0; + s16 unk2; + s32 unk4; + s16 unk8; + s16 unkA; + s32 unkC; + s32 unk10; + s32 unk14; + u16 unk18; +} A178_80024E38; + +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); + +void func_global_asm_806A2A10(s32, s32, s32); + +/* +void func_bonus_80024E38(void) { + A178_80024E38 *a178; + s32 temp_v0_5; + + a178 = current_actor_pointer->unk178; + func_global_asm_80729B00(); + if (!(current_actor_pointer->object_properties_bitfield & 0x10)) { + a178->unk0 = 0x12C; + a178->unkA = 0; + a178->unk8 = 0; + func_global_asm_80737638(D_global_asm_8076D1F8, 0x1E6, 0, 0x40, 1.0f, 0x80, &a178->unk4); + func_global_asm_806A2A10(0xDC, 0x2A, D_global_asm_807FDC9C->unkA_u8[1]); + func_global_asm_8072707C(1, 0x40, 0x10); + func_global_asm_8072707C(2, 0x40, 0x10); + func_global_asm_8072707C(3, 0x40, 0x10); + func_global_asm_8072707C(4, 0x40, 0x10); + current_actor_pointer->control_state = 0; + current_actor_pointer->control_state_progress = 0; + func_global_asm_8061CC30(); + a178->unk18 = playCutscene(NULL, 0, 1); + } + switch (current_actor_pointer->control_state) { + case 0: + if (a178->unk18 != 0) { + a178->unk18--; + } else { + func_global_asm_806A2B08(current_actor_pointer->unk11C); + current_actor_pointer->control_state = 1; + } + break; + case 1: + if (current_actor_pointer->unk11C->control_state == 5) { + func_global_asm_8069D2AC(0x81, 0, 0x78, func_global_asm_8070E750(0x1A, 0x15, 1), 0, 0x28, 8, 8); + func_global_asm_80726EE0(0); + playSong(0x28, 1.0f); + func_global_asm_806A5DF0(0x56, 588.0f, 240.0f, 582.0f, 0, 0, func_bonus_80024D8C(), 0); + current_actor_pointer->control_state = 2; + } + if (player_pointer->control_state == 0x39) { + func_global_asm_805FF898(); + func_global_asm_806C9974(0, 0x40); + current_actor_pointer->control_state = 2; + } + break; + } + a178->unk0--; + a178->unk8 = MAX(8000, a178->unk8 - 150); + a178->unkA = MIN(a178->unk8, a178->unkA + 1000); + func_global_asm_80737AC4(a178->unk4, 8, a178->unkA); + if (extra_player_info_pointer->unk1F0 & 0xC0000) { + if (a178->unk0 < 0x129) { + a178->unk0 = 0x12C; + if (extra_player_info_pointer->unk1F0 & 0x40000) { + if (((rand() >> 0xF) % 1000) & 1) { + playSound(0x1E7, 0x7FFF, 64.0f, 1.0f, 0x14, 0x80); + } else { + playSound(0x1EA, 0x7FFF, 64.0f, 1.0f, 0x14, 0x80); + } + } else { + playSound(0x1E8, 0x7FFF, 64.0f, 1.0f, 0x14, 0x80); + } + } + a178->unk8 = MIN(0x7FFF, a178->unk8 + 18000); + extra_player_info_pointer->unk1F0 &= 0xFFF3FFFF; + } + switch (a178->unk0) { + case 0x0: + case 0x14: + case 0x28: + case 0x3C: + case 0x50: + temp_v0_5 = 0x7FFF - (a178->unk0 * 150); + playSound(0x1E9, temp_v0_5, 64.0f, 1.0f, 0xA, 0x80); + if (a178->unk0 == 0) { + a178->unk0 = 0xC8; + } + break; + } +} +*/ diff --git a/src/critter/code_0.c b/src/critter/code_0.c index 2b91277..b0653bd 100644 --- a/src/critter/code_0.c +++ b/src/critter/code_0.c @@ -61,7 +61,7 @@ typedef struct Critter { typedef struct CritterController { u8 critter_count; u8 unk1; - u8 unk2; + u8 unk2; // Also a count? u8 unk3; s32 unk4; Critter *critter; @@ -197,40 +197,63 @@ void func_critter_800240EC(CritterController *arg0) { } } -// Odd stack struct -#pragma GLOBAL_ASM("asm/nonmatchings/critter/code_0/func_critter_80024154.s") +typedef struct { + s16 temp[3]; +} D_80029F6C; -// rodata -#pragma GLOBAL_ASM("asm/nonmatchings/critter/code_0/func_critter_8002427C.s") +extern D_80029F6C D_critter_80029F6C; -extern s32 *D_critter_80029F74; - -/* -void func_critter_8002427C(CritterController *arg0) { - s16 sp68[2]; - Critter *var_s0; +void func_critter_80024154(CritterController *arg0) { s32 i; + s32 pad; // TODO: what? + u8 var_v1; + D_80029F6C sp10; + Critter *critter; + + critter = arg0->critter; + sp10 = D_critter_80029F6C; + var_v1 = 0; + for (i = 0; i < arg0->unk2; i++) { + if ((var_v1 == 0 && ((arg0->unk2 * 0.4) < i)) + || (var_v1 == 1 && (arg0->unk2 * 0.7) < i)) { + var_v1++; + } + critter->unk24 = 10.0f; + critter->unk1E4[0] = sp10.temp[var_v1]; + critter->unk1E8[0] = 0; + critter++; + } +} + +typedef struct { + s16 temp[4]; +} D_80029F74; + +extern D_80029F74 D_critter_80029F74; + +void func_critter_8002427C(CritterController *arg0) { + Critter *critter; + s32 i; + D_80029F74 sp68; u8 var_s2; - var_s0 = arg0->critter; + critter = arg0->critter; + sp68 = D_critter_80029F74; var_s2 = 0; - sp68[0] = D_critter_80029F74[0]; - sp68[1] = D_critter_80029F74[1]; for (i = 0; i < arg0->unk2; i++) { if ((var_s2 == 0 && ((arg0->unk2 * 0.3) < i)) ||(var_s2 == 1 && ((arg0->unk2 * 0.5) < i)) ||(var_s2 == 2 && ((arg0->unk2 * 0.7) < i))) { var_s2++; } - var_s0->unk24 = 20.0f; - var_s0->unk1E4[0] = sp68[var_s2]; - var_s0->unk1E8[0] = 0; - var_s0->unk1E1 |= 4; - func_critter_80024000(var_s0, arg0, var_s0->unk38 * 0.5); - var_s0++; + critter->unk24 = 20.0f; + critter->unk1E4[0] = sp68.temp[var_s2]; + critter->unk1E8[0] = 0; + critter->unk1E1 |= 4; + func_critter_80024000(critter, arg0, critter->unk38 * 0.5); + critter++; } } -*/ void func_critter_8002448C(Critter *arg0) { s32 i; @@ -804,6 +827,8 @@ void func_critter_80026C9C(CritterController *arg0) { } */ +void func_critter_80027118(CritterController *arg0); + void func_critter_80026E0C(s32 arg0) { s32 j; unkStruct_critter_80029BA0 *var_s2; @@ -885,3 +910,63 @@ void func_critter_8002708C(CritterController *arg0) { // Jumptable #pragma GLOBAL_ASM("asm/nonmatchings/critter/code_0/func_critter_80027118.s") + +/* +void func_critter_80027118(CritterController *arg0) { + s32 pad[3]; + void (*sp50)(CritterController *); + u32 temp_hi; + s32 i; + s32 var_s3; + u8 arraySize; + Critter *critter; + + arraySize = arg0->unk2; + if (arraySize == 0) { + arg0->critter = NULL; + return; + } + switch (arg0->critter_count) { + case 0: + case 1: + sp50 = func_critter_800240EC; + break; + case 3: + sp50 = func_critter_80024154; + break; + case 4: + sp50 = func_critter_8002409C; + break; + case 2: + sp50 = func_critter_8002427C; + break; + } + arg0->critter = malloc(arraySize * sizeof(Critter)); + func_global_asm_80611690(arg0->critter); + critter = arg0->critter; + if (arg0->unk1 == 1) { + var_s3 = 0; + } else { + var_s3 = 1; + } + for (i = 0; i < arg0->unk2; i++) { + func_critter_80025F8C(arg0->unk4, critter, 1); + if (!gameIsInDKTVMode()) { + func_critter_80025F3C(arg0->unk4, critter, 1, 1); + } + temp_hi = arg0->unk4; + critter->unk58 = temp_hi; + critter->unk1E2 = var_s3; + critter->unk54 = temp_hi; + critter->unk40 = 0xFF; + critter->unk0 = func_global_asm_806119A0() & 0xFFF; + critter->unk42 = func_global_asm_806119A0() & 0xFFF; + critter->unk38 = 2 * (1.0f - ((func_global_asm_806119A0() % 1000U) / 4000.0f)); + critter++; + if (var_s3 == 1) { + var_s3 = 2; + } + } + sp50(arg0); +} +*/ diff --git a/src/menu/code_1AF0.c b/src/menu/code_1AF0.c index acc0bea..8aafd1d 100644 --- a/src/menu/code_1AF0.c +++ b/src/menu/code_1AF0.c @@ -17,31 +17,32 @@ typedef struct menu_struct_1 { u8 unk12; } MenuStruct1; +// TODO: Array of structs? const u16 D_menu_80033A50[] = { - 0x0000, + 0x0000, // Donkey 0x000B, 0x000F, 0x0014, - 0x0000, + 0x0000, // Diddy 0x000C, 0x0010, 0x0015, - 0x0000, + 0x0000, // Lanky 0x000E, 0x0013, 0x0016, - 0x0000, + 0x0000, // Tiny 0x000D, 0x0011, 0x0017, - 0x0000, + 0x0000, // Chunky 0x000D, 0x0012, 0x0018, }; const u16 D_menu_80033A78[] = { - 0x0000, + 0x0000, // Krusha? 0x0019, 0x001A, 0x001B,