diff --git a/include/functions.h b/include/functions.h
index e99d613..efe5557 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -112,7 +112,6 @@ int gameIsInMainMenuMode(void);
int gameIsInAdventureMode(void);
int gameIsInDKTheatreMode(void);
int gameIsInQuitGameMode(void);
-void *func_80714CC0(void*, f32, f32, f32, f32);
// countSetFlags(startIndex, length, flagType);
s32 func_80731AA8(s32 startIndex, s32 length, u8 flagType);
@@ -335,8 +334,11 @@ void func_80714A28(u16 arg0);
void func_80714A38(u8 arg0);
void func_80714A58(u16 arg0);
void func_80714A68(s16 arg0, s16 arg1, s16 arg2, s16 arg3);
-void *func_80714B84(void *arg0, f32 arg1, s32 arg2, s32 arg3, u8 arg4);
-void *func_80714C08(void *arg0, f32 arg1, Actor *arg2, s32 arg3, u8 arg4);
+
+Struct80717D84 *func_80714B84(void *arg0, f32 arg1, s32 arg2, s32 arg3, u8 arg4);
+Struct80717D84 *func_80714C08(void *arg0, f32 arg1, Actor *arg2, s32 arg3, u8 arg4);
+Struct80717D84 *func_80714CC0(void* arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4);
+
void func_80715E38(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5);
void func_807180F4(s32 arg0, s32 arg1);
void func_80718124(f32 arg0, f32 arg1, f32 arg2, f32 arg3);
@@ -2056,6 +2058,6 @@ void alEvtqFlushType(ALEventQueue *evtq, s16 type);
void alSeqpStop(ALSeqPlayer *seqp);
// 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(d) (((d) > 0) ? (d) : -(d))
#endif
diff --git a/include/structs.h b/include/structs.h
index e574c25..27a1005 100644
--- a/include/structs.h
+++ b/include/structs.h
@@ -2354,16 +2354,31 @@ typedef struct {
s16 unk16;
} Struct80717D84_unk330;
+typedef struct Struct80717D84 Struct80717D84;
+
typedef struct {
- u8 unk0[0x128 - 0x0];
+ void *unk0;
+ void *unk4;
+} Struct80717D84_unk0;
+
+struct Struct80717D84 {
+ Struct80717D84_unk0 unk0[4]; // TODO: How many?
+ u8 unk20;
+ u8 unk21[0x128 - 0x21];
float unk128[2][4][4]; // TODO: How many?
- u8 unk1A8[0x32C - 0x1A8];
+ u8 unk1A8[0x328 - 0x1A8];
+ void *unk328;
u8 unk32C;
u8 unk32D[0x330 - 0x32D];
Struct80717D84_unk330 *unk330;
- s32 unk334;
+ s8 unk334;
+ s8 unk335;
+ s8 unk336;
+ s8 unk337;
Actor *unk338;
- s32 unk33C;
+ s16 unk33C;
+ s8 unk33E;
+ s8 unk33F;
f32 unk340; // X
f32 unk344; // Y
f32 unk348; // Z
@@ -2382,9 +2397,15 @@ typedef struct {
};
f32 unk360; // X
f32 unk364; // Y
- u8 unk368[0x36D - 0x368];
+ s16 unk368;
+ u8 unk36A;
+ u8 unk36B;
+ u8 unk36C;
u8 unk36D;
- u8 unk36E[0x384 - 0x36E];
+ u8 unk36E;
+ u8 unk36F;
+ u8 unk370[0x380 - 0x370];
+ s32 unk380;
union {
Struct80717D84_unk384 *unk384;
Struct80717D84_unk384_f32 *unk384_f32;
@@ -2392,16 +2413,36 @@ typedef struct {
Struct80717D84_unk384_80717100 *unk384_80717100;
Struct80717D84_unk384_80717814 *unk384_80717814;
};
- s32 unk388;
+ s16 unk388;
+ s8 unk38A;
+ s8 unk38B;
u16 unk38C;
-} Struct80717D84;
+ u16 unk38E;
+ u16 unk390;
+ u16 unk392;
+ u16 unk394;
+ Struct80717D84 *unk398; // Prev?
+ Struct80717D84 *unk39C; // Next?
+};
-typedef struct Struct807FDB00 Struct807FDB00;
+typedef struct Struct807FDB00 Struct807FDB00;
struct Struct807FDB00 {
- s32 unk0;
+ void *unk0;
s32 unk4;
- u8 unk8[0x24 - 0x8];
+ u8 unk8;
+ u8 unk9;
+ u8 unkA;
+ u8 unkB;
+ u8 unkC;
+ u8 unkD;
+ u8 unkE;
+ u8 unkF;
+ u8 unk10;
+ u8 unk11;
+ u8 unk12;
+ u8 unk13;
+ u8 unk14[0x24 - 0x14];
Struct807FDB00 *next;
};
diff --git a/progress/progress.global_asm.csv b/progress/progress.global_asm.csv
index 4d1de78..18944c6 100644
--- a/progress/progress.global_asm.csv
+++ b/progress/progress.global_asm.csv
@@ -1259,7 +1259,7 @@ us,.code,func_8070E34C,508,no
us,.code,func_806E3E40,884,no
us,.code,func_8064BE80,216,no
us,.code,func_8062DAF4,124,yes
-us,.code,func_80714D08,916,no
+us,.code,func_80714D08,916,yes
us,.code,func_8073BA60,176,no
us,.code,func_8062B478,440,yes
us,.code,func_80652E58,100,yes
diff --git a/progress/progress.menu.csv b/progress/progress.menu.csv
index 57f1794..f45adf3 100644
--- a/progress/progress.menu.csv
+++ b/progress/progress.menu.csv
@@ -90,7 +90,7 @@ us,.code,func_800324CC,124,yes
us,.code,func_80032024,684,no
us,.code,func_80029BB4,380,no
us,.code,func_8002ACD4,124,no
-us,.code,func_8002C0C8,1212,no
+us,.code,func_8002C0C8,1212,yes
us,.code,func_80027808,384,no
us,.code,func_8002D7EC,192,yes
us,.code,func_80024788,1140,no
diff --git a/progress/progress.total.csv b/progress/progress.total.csv
index 7809be0..5402a94 100644
--- a/progress/progress.total.csv
+++ b/progress/progress.total.csv
@@ -1259,7 +1259,7 @@ us,.code,func_8070E34C,508,no
us,.code,func_806E3E40,884,no
us,.code,func_8064BE80,216,no
us,.code,func_8062DAF4,124,yes
-us,.code,func_80714D08,916,no
+us,.code,func_80714D08,916,yes
us,.code,func_8073BA60,176,no
us,.code,func_8062B478,440,yes
us,.code,func_80652E58,100,yes
@@ -3376,7 +3376,7 @@ us,.code,func_800324CC,124,yes
us,.code,func_80032024,684,no
us,.code,func_80029BB4,380,no
us,.code,func_8002ACD4,124,no
-us,.code,func_8002C0C8,1212,no
+us,.code,func_8002C0C8,1212,yes
us,.code,func_80027808,384,no
us,.code,func_8002D7EC,192,yes
us,.code,func_80024788,1140,no
diff --git a/progress/progress_global_asm.svg b/progress/progress_global_asm.svg
index a411aac..cbac783 100644
--- a/progress/progress_global_asm.svg
+++ b/progress/progress_global_asm.svg
@@ -17,7 +17,7 @@
global_asm
- 29.6999%
- 29.6999%
+ 29.7743%
+ 29.7743%
diff --git a/progress/progress_menu.svg b/progress/progress_menu.svg
index b8ba0df..d3ca567 100644
--- a/progress/progress_menu.svg
+++ b/progress/progress_menu.svg
@@ -9,7 +9,7 @@
-
+
@@ -17,7 +17,7 @@
menu
- 17.1455%
- 17.1455%
+ 19.1238%
+ 19.1238%
diff --git a/progress/progress_total.svg b/progress/progress_total.svg
index cbba122..d44a589 100644
--- a/progress/progress_total.svg
+++ b/progress/progress_total.svg
@@ -9,7 +9,7 @@
-
+
@@ -17,7 +17,7 @@
Donkey Kong 64 (US)
- 29.5108%
- 29.5108%
+ 29.6399%
+ 29.6399%
diff --git a/src/boss/code_C920.c b/src/boss/code_C920.c
index 7a3840e..6d8cda1 100644
--- a/src/boss/code_C920.c
+++ b/src/boss/code_C920.c
@@ -88,5 +88,138 @@ void func_80030E58() {
// Jumptable, 4200 bytes of code
#pragma GLOBAL_ASM("asm/nonmatchings/boss/code_C920/func_80031AA0.s")
-// Quite an interesting Actor + float function, quite big but doable, but might need some struct and array definitions
+// rodata, close, doable, stack
#pragma GLOBAL_ASM("asm/nonmatchings/boss/code_C920/func_80032B08.s")
+
+s32 func_80614644(Actor *, AnimationStateUnk0 *, f32); // extern
+extern s8 D_80035B28;
+extern s16 D_80035B2C;
+extern f32 D_80035B3C;
+extern s16 D_80035B74;
+extern f32 D_80036DC4;
+
+extern s16 D_80035B00[];
+extern s16 D_80035B08[];
+extern s16 D_80035B10[];
+extern s16 D_80035B18[];
+extern s16 D_80035B20[];
+
+typedef struct {
+ Actor *unk0;
+ s8 unk4;
+ s8 unk5;
+} AAD_80032B08;
+
+typedef struct {
+ f32 unk0;
+ f32 unk4;
+ s8 unk8[0x12 - 0x8];
+ s8 unk12;
+ s8 unk13; // Unused
+ s8 unk14;
+ s8 unk15; // Unused
+ s8 unk16; // Unused
+ s8 unk17;
+} AAD_80032B08_2;
+
+/*
+void func_80032B08(void) {
+ AnimationStateUnk0 *temp_s0;
+ s32 var_v0;
+ AAD_80032B08 *aaD;
+ AAD_80032B08_2 *aaD2; // sp30
+
+ aaD = current_actor_pointer->additional_actor_data;
+ aaD2 = aaD->unk0->additional_data_pointer;
+ temp_s0 = current_actor_pointer->animation_state->unk0;
+ if (aaD->unk5 == 0) {
+ D_80036DC4 = ((player_pointer->x_position - current_actor_pointer->x_position) * (player_pointer->x_position - current_actor_pointer->x_position)) + ((player_pointer->z_position - current_actor_pointer->z_position) * (player_pointer->z_position - current_actor_pointer->z_position));
+ }
+ if (!(current_actor_pointer->object_properties_bitfield & 0x10)) {
+ func_80613C48(current_actor_pointer, aaD->unk4 + 0x668, 0.0f, 0.0f);
+ current_actor_pointer->draw_distance = 0xFA0;
+ }
+ if (D_80035B28 & (1 << aaD->unk4)) {
+ current_actor_pointer->z_rotation = (s32)(aaD2->unk4 * 1024.0) - 0x400;
+ current_actor_pointer->x_rotation = D_80035B2C;
+ if (temp_s0 != NULL) {
+ if (D_80035B3C != temp_s0->unk4) {
+ func_80614644(current_actor_pointer, temp_s0, D_80035B3C);
+ }
+ }
+ } else {
+ current_actor_pointer->z_rotation = 0;
+ if (temp_s0 != NULL) {
+ if (temp_s0->unk10 != aaD->unk4 + 0x66B) {
+ func_80613C48(current_actor_pointer, aaD->unk4 + 0x66B, 0.0f, 0.0f);
+ playSound(0x38D, 0x7D00, 63.0f, 1.0f, 0, 0);
+ } else {
+ func_80614644(current_actor_pointer, temp_s0, temp_s0->unk4 + 0.75f);
+ }
+ if (aaD->unk4 == 1) {
+ if (temp_s0->unk4 > 24.0f) {
+ temp_s0->unk4 = 24.0f;
+ }
+ if (temp_s0->unk4 > 15.0f) {
+ current_actor_pointer->y_position -= 10.0f;
+ }
+ } else {
+ if (temp_s0->unk4 > 37.0f) {
+ temp_s0->unk4 = 37.0f;
+ }
+ if (temp_s0->unk4 > 26.0f) {
+ current_actor_pointer->y_position -= 10.0f;
+ }
+ }
+ if (current_actor_pointer->y_position < 0.0) {
+ playSound(0x384, 0x7D00, 63.0f, 1.0f, 0, 0);
+ func_806782C0(current_actor_pointer);
+ }
+ }
+ }
+ if (aaD->unk5 == 0) {
+ current_actor_pointer->noclip_byte = 0xC;
+ if (aaD->unk4 == 0) {
+ if (aaD2->unk17 == 1) {
+ if (aaD->unk0->control_state == 0) {
+ D_80035B74 = 0x28;
+ }
+ D_80035B74--;
+ if (D_80035B74 < 0) {
+ D_80035B74 = 0xA;
+ func_806907F0(
+ current_actor_pointer->x_position + D_80035B18[aaD2->unk14],
+ current_actor_pointer->y_position + 270.0f,
+ current_actor_pointer->z_position + D_80035B20[aaD2->unk14]
+ );
+ func_80690A28(0x2C, 1, 0.25f, player_pointer->x_position, player_pointer->y_position, player_pointer->z_position, 2400.0f, current_actor_pointer);
+ }
+ } else {
+ D_80035B74 = 0;
+ }
+ }
+ current_actor_pointer->x_position = D_80035B00[aaD2->unk14] + aaD->unk0->x_position;
+ current_actor_pointer->z_position = D_80035B08[aaD2->unk14] + aaD->unk0->z_position;
+ current_actor_pointer->y_rotation = D_80035B10[aaD2->unk14];
+ } else {
+ current_actor_pointer->noclip_byte = 1;
+ var_v0 = aaD2->unk14 + 2;
+ if (var_v0 >= 4) {
+ var_v0 -= 4;
+ }
+ current_actor_pointer->x_position = D_80035B00[var_v0] + aaD->unk0->x_position;
+ current_actor_pointer->z_position = D_80035B08[var_v0] + aaD->unk0->z_position;
+ current_actor_pointer->y_rotation = D_80035B10[var_v0];
+ current_actor_pointer->object_properties_bitfield |= 0x800000;
+ current_actor_pointer->unk16A = 0x23;
+ current_actor_pointer->unk16B = 0x23;
+ current_actor_pointer->unk16C = 0x46;
+ if (aaD2->unk12 != 1) {
+ current_actor_pointer->object_properties_bitfield &= ~4;
+ } else {
+ current_actor_pointer->object_properties_bitfield |= 4;
+ }
+ }
+ func_806319C4(current_actor_pointer, 0);
+}
+*/
diff --git a/src/global_asm/code_119370.c b/src/global_asm/code_119370.c
index e5b23b1..9323d2e 100644
--- a/src/global_asm/code_119370.c
+++ b/src/global_asm/code_119370.c
@@ -79,7 +79,7 @@ extern f32 D_8075EA50;
extern Struct807FDB00 *D_807FDB00;
extern Struct807FDB04 *D_807FDB04;
-extern s32 D_807FDB08;
+extern Struct80717D84 *D_807FDB08;
extern u8 D_807FDB0C;
extern u8 D_807FDB0D;
extern u8 D_807FDB0E;
@@ -87,7 +87,7 @@ extern u8 D_807FDB0F;
extern s32 D_807FDB10;
extern void *D_807FDB14; // TODO: Function pointer
extern u8 D_807FDB18;
-extern u16 D_807FDB1A;
+extern s16 D_807FDB1A;
extern u8 D_807FDB1C;
extern u8 D_807FDB1D;
extern f32 D_807FDB20;
@@ -98,14 +98,14 @@ extern s32 D_807FDB30;
extern u16 D_807FDB34;
extern u16 D_807FDB36;
extern s16 D_807FDB38;
-extern u16 D_807FDB3A;
+extern s16 D_807FDB3A;
extern s16 D_807FDB3C;
extern s16 D_807FDB3E;
extern s16 D_807FDB40;
extern s16 D_807FDB42;
u32 func_806119A0();
-void *func_80714D08(void*, f32, f32, f32, f32, s32, s32, s32, s32);
+Struct80717D84 *func_80714D08(void*, f32, f32, f32, f32, s32, s32, s32, u8);
void func_80714A9C(void);
void func_80718380(Struct80717D84 *arg0, s8 *arg1);
int func_80717404(); // TODO: Signature
@@ -251,7 +251,7 @@ void func_80714A9C(void) {
D_807FDB3A = 0x258;
}
-void *func_80714B84(void *arg0, f32 arg1, s32 arg2, s32 arg3, u8 arg4) {
+Struct80717D84 *func_80714B84(void *arg0, f32 arg1, s32 arg2, s32 arg3, u8 arg4) {
f32 sp3C;
f32 sp38;
f32 sp34;
@@ -260,7 +260,7 @@ void *func_80714B84(void *arg0, f32 arg1, s32 arg2, s32 arg3, u8 arg4) {
return func_80714D08(arg0, arg1, sp3C, sp38, sp34, 0, arg2, arg3, arg4);
}
-void *func_80714C08(void *arg0, f32 arg1, Actor *arg2, s32 arg3, u8 arg4) {
+Struct80717D84 *func_80714C08(void *arg0, f32 arg1, Actor *arg2, s32 arg3, u8 arg4) {
f32 sp3C;
f32 sp38;
f32 sp34;
@@ -272,12 +272,124 @@ void *func_80714C08(void *arg0, f32 arg1, Actor *arg2, s32 arg3, u8 arg4) {
return func_80714D08(arg0, arg1, sp3C, sp38, sp34, arg2, 0, arg3, arg4);
}
-void *func_80714CC0(void* arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
+Struct80717D84 *func_80714CC0(void* arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
return func_80714D08(arg0, arg1, arg2, arg3, arg4, 0, 0, 0, 0);
}
-// Doable, init for the 0x374 struct thing
-#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_119370/func_80714D08.s")
+extern u8 D_80750AB4;
+extern Struct807FDB00 *D_807FDB00;
+extern u8 D_807FDB0C;
+extern u8 D_807FDB0D;
+extern u8 D_807FDB0E;
+extern u8 D_807FDB0F;
+extern u8 D_807FDB18;
+extern u8 D_807FDB1D;
+extern f32 D_807FDB20;
+extern f32 D_807FDB24;
+extern u8 D_807FDB28;
+extern u16 D_807FDB36;
+extern s16 D_807FDB3C;
+
+void func_80714778(f32);
+
+Struct80717D84 *func_80714D08(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5, s32 arg6, s32 arg7, u8 arg8) {
+ Struct80717D84 *sp2C;
+ s32 i;
+ s32 var_v0;
+ Struct807FDB00 *var_s0;
+ Struct80717D84 *var_s0_2;
+
+ func_80714778(arg1);
+ var_s0 = D_807FDB00;
+ var_v0 = 0;
+ while (!var_v0 && var_s0 != NULL) {
+ if (arg0 == var_s0->unk0) {
+ var_v0 = 1;
+ } else {
+ var_s0 = var_s0->next;
+ }
+ }
+ if (var_v0 == 0) {
+ func_80714A9C();
+ return NULL;
+ }
+ sp2C = malloc(sizeof(Struct80717D84));
+ if (D_807FDB04 != NULL) {
+ D_807FDB08->unk39C = sp2C;
+ sp2C->unk398 = D_807FDB08;
+ } else {
+ D_807FDB04 = sp2C;
+ sp2C->unk398 = NULL;
+ }
+ D_807FDB08 = sp2C;
+ if (D_807FDB1D != 0) {
+ arg2 *= 4.0f;
+ arg3 *= 4.0f;
+ arg4 *= 4.0f;
+ arg1 *= 4.0f;
+ D_807FDB20 *= 4.0f;
+ D_807FDB24 *= 4.0f;
+ }
+ sp2C->unk340 = arg2;
+ sp2C->unk344 = arg3;
+ sp2C->unk348 = arg4;
+ if (D_807FDB28 != 0) {
+ sp2C->unk360 = D_807FDB20;
+ sp2C->unk364 = D_807FDB24;
+ } else {
+ sp2C->unk360 = arg1;
+ sp2C->unk364 = arg1;
+ }
+ if (D_807FDB0F != 0) {
+ sp2C->unk36A = D_807FDB0C;
+ sp2C->unk36B = D_807FDB0D;
+ sp2C->unk36C = D_807FDB0E;
+ sp2C->unk36D = D_807FDB0F;
+ } else {
+ sp2C->unk36A = var_s0->unk10;
+ sp2C->unk36B = var_s0->unk11;
+ sp2C->unk36C = var_s0->unk12;
+ sp2C->unk36D = var_s0->unk13;
+ }
+ sp2C->unk36E = D_807FDB18;
+ sp2C->unk36F = D_807FDB1D;
+ sp2C->unk368 = D_807FDB1A;
+ sp2C->unk380 = var_s0->unk8 * var_s0->unk9;
+ sp2C->unk334 = arg8;
+ sp2C->unk338 = arg5;
+ sp2C->unk33C = arg6;
+ sp2C->unk33E = arg7;
+ sp2C->unk34E = D_807FDB30;
+ sp2C->unk350 = D_807FDB1C;
+ sp2C->unk351 = 0;
+ sp2C->unk354 = D_807FDB10;
+ sp2C->unk358 = 0;
+ sp2C->unk35C = D_807FDB2C;
+ if (D_807FBB64 & 0x100) {
+ sp2C->unk34C = 0x7D0;
+ } else {
+ sp2C->unk34C = D_807FDB3A;
+ }
+ sp2C->unk330 = var_s0;
+ sp2C->unk39C = 0;
+ sp2C->unk328 = D_807FDB14;
+ sp2C->unk384 = 0;
+ sp2C->unk388 = D_807FDB38;
+ sp2C->unk38A = -1;
+ sp2C->unk38C = D_807FDB36;
+ sp2C->unk38E = D_807FDB3C;
+ sp2C->unk390 = D_807FDB3E;
+ sp2C->unk392 = D_807FDB40;
+ sp2C->unk394 = D_807FDB42;
+ for (i = 0; i < D_80750AB4; i++) {
+ sp2C->unk0[i].unk0 = malloc(0x200);
+ sp2C->unk0[i].unk4 = malloc(0x200);
+ }
+ sp2C->unk20 = D_80750AB4;
+ func_8071509C(sp2C);
+ func_80714A9C();
+ return sp2C;
+}
// Doable, needs a struct array size 0x10 at Struct807FDB04->unk28
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_119370/func_8071509C.s")
diff --git a/src/global_asm/code_89250.c b/src/global_asm/code_89250.c
index ea4fb23..c44330d 100644
--- a/src/global_asm/code_89250.c
+++ b/src/global_asm/code_89250.c
@@ -401,11 +401,6 @@ void func_8068588C(Actor *arg0, s16 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5
func_806858E8(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
}
-typedef struct {
- u8 unk0[0x338 - 0x0];
- Actor *unk338;
-} Struct806858E8;
-
void func_806858E8(Actor *arg0, s16 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, s32 arg6) {
if (arg0 != NULL) {
if (arg1 != 0) {
@@ -414,7 +409,7 @@ void func_806858E8(Actor *arg0, s16 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5
}
func_8071498C(&func_80718080);
func_80714950(arg6);
- ((Struct806858E8*)func_80714CC0(&D_8071FFA0, arg2, arg3, arg4 + 5.0f, arg5))->unk338 = arg0;
+ func_80714CC0(&D_8071FFA0, arg2, arg3, arg4 + 5.0f, arg5)->unk338 = arg0;
}
extern s32 D_8071FFA0; // TODO: Datatype
@@ -468,9 +463,36 @@ void func_80685D84(Actor *arg0) {
}
}
-// Returns struct from function call in a weird way... Doable once we figure out which struct is returned.
+// rodata
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_89250/func_80685E78.s")
+extern s32 D_8071FED0; // TODO: Datatype
+extern f64 D_80759B08;
+extern f64 D_80759B10;
+
+void func_807184F4(Struct80717D84 *arg0, s32 arg1);
+
+/*
+void func_80685E78(Actor *arg0) {
+ f32 sp28;
+ ActorAnimationState *temp_v0;
+
+ temp_v0 = arg0->animation_state;
+ if (temp_v0 != NULL) {
+ sp28 = temp_v0->scale_y / D_80759B08;
+ } else {
+ sp28 = 1.0;
+ }
+ func_80714998(3);
+ func_807149B8(1);
+ func_807149FC(1);
+ func_8071498C(&func_807184F4);
+ func_80714A28(4);
+ func_807149C8(0xC8, 0xFF, 0xFF, 0xC8);
+ func_80714CC0(&D_8071FED0, sp28 * D_80759B10, arg0->x_position, arg0->unkAC, arg0->z_position)->unk338 = arg0;
+}
+*/
+
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_89250/func_80685F60.s")
extern s16 D_80753A08[];
diff --git a/src/global_asm/code_CEAE0.c b/src/global_asm/code_CEAE0.c
index cc33f1d..64efaf8 100644
--- a/src/global_asm/code_CEAE0.c
+++ b/src/global_asm/code_CEAE0.c
@@ -5404,10 +5404,195 @@ void func_806DF670(s16 *arg0, s16 arg1, s16 arg2) {
}
}
-// Surprisingly doable, quite large though
-// controlStateControl()
+// doable, stack regalloc
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_CEAE0/func_806DF6D4.s")
+/*
+u16 func_806DFF34(u16, s32 *);
+extern s32 D_80750FF0;
+extern f64 D_8075D0E0;
+extern f32 D_8075D0E8;
+
+typedef struct {
+ u16 unk0;
+ s8 unk2;
+ s8 unk3; // Used
+} Struct807ECDEC;
+
+extern Struct807ECDEC *D_807ECDEC;
+
+typedef struct {
+ void (*unk0)(void); // Start Button Pressed Handler
+ void (*unk4)(void); // Always Called (before input handlers)
+ void (*unk8)(void); // A Button Pressed Handler
+ void (*unkC)(void); // B Button Pressed Handler
+ void (*unk10)(void); // Z Button Pressed Handler
+ void (*unk14)(void); // A Button Released Handler
+ void (*unk18)(void); // B Button Released Handler
+ void (*unk1C)(void); // Z Button Released Handler
+ void (*unk20)(void); // L Button Pressed Handler
+ void (*unk24)(void); // R Button Pressed Handler
+ void (*unk28)(void);
+ void (*unk2C)(void); // R Button Released Handler
+ void (*unk30)(void); // C-Up Pressed Handler
+ void (*unk34)(void); // C-Left Pressed Handler
+ void (*unk38)(void); // C-Right Pressed Handler
+ void (*unk3C)(void); // C-Down Pressed Handler
+ void (*unk40)(void); // Always Called (after input handlers)
+} ControlStateInputHandler;
+extern ControlStateInputHandler D_80751004[]; // TODO: rodata?
+
+extern u16 D_807ECDF0;
+
+s32 func_806DF6D4(s32 controlState) {
+ ControlStateInputHandler *inputHandler;
+ f32 temp_f18;
+ f32 var_f14; // sp44
+ f32 var_f2; // sp40
+ f32 temp_f8;
+ f32 var_f16; // sp38
+ s16 var_t0;
+ s32 var_a0;
+ s32 oldControlState; // sp2C
+ f32 temp_f12;
+
+ oldControlState = D_807FBB48->control_state;
+
+ // Read button inputs
+ D_807FD610[cc_player_index].unk2A = func_806DFF34(D_807ECDEC->unk0, &D_80750FF0);
+ D_807FD610[cc_player_index].unk2C = func_806DFF34(D_807ECDF0, &D_80750FF0);
+
+ // Buttons disabled?
+ if (extra_player_info_pointer->unk1F4 & 0x20) {
+ D_807FD610[cc_player_index].unk2A = 0;
+ D_807FD610[cc_player_index].unk2C = 0;
+ }
+
+ // Read joystick inputs and clamp between -80 and 80
+ D_807ECDEC->unk2 = MIN(MAX(D_807ECDEC->unk2, -80), 80);
+ D_807ECDEC->unk3 = MIN(MAX(D_807ECDEC->unk3, -80), 80);
+ D_807FD610[cc_player_index].unk2E = D_807ECDEC->unk2;
+ D_807FD610[cc_player_index].unk2F = D_807ECDEC->unk3;
+
+ // Joystick disabled?
+ if (extra_player_info_pointer->unk1F4 & 0x20) {
+ D_807FD610[cc_player_index].unk2E = 0;
+ D_807FD610[cc_player_index].unk2F = 0;
+ }
+ // Joystick movement halved?
+ if (extra_player_info_pointer->unk1F0 & 0x100) {
+ D_807FD610[cc_player_index].unk2E *= 0.5;
+ D_807FD610[cc_player_index].unk2F *= 0.5;
+ }
+ // Joystick inverted?
+ if (extra_player_info_pointer->unk1F0 & 0x80) {
+ D_807FD610[cc_player_index].unk2E = -D_807FD610[cc_player_index].unk2E;
+ D_807FD610[cc_player_index].unk2F = -D_807FD610[cc_player_index].unk2F;
+ }
+
+ // Compute absolute joystick magnitude
+ D_807FD610[cc_player_index].unk30 = ABS(D_807FD610[cc_player_index].unk2E);
+ D_807FD610[cc_player_index].unk31 = ABS(D_807FD610[cc_player_index].unk2F);
+
+ // Joystick deadzone
+ if (D_807FD610[cc_player_index].unk30 < 5 && D_807FD610[cc_player_index].unk31 < 5) {
+ D_807FD610[cc_player_index].unk2E = 0;
+ D_807FD610[cc_player_index].unk30 = 0;
+ D_807FD610[cc_player_index].unk2F = 0;
+ D_807FD610[cc_player_index].unk31 = 0;
+ }
+ if (D_807FD610[cc_player_index].unk30 < 2) {
+ D_807FD610[cc_player_index].unk2E = 0;
+ D_807FD610[cc_player_index].unk30 = 0;
+ }
+ if (D_807FD610[cc_player_index].unk31 < 2) {
+ D_807FD610[cc_player_index].unk2F = 0;
+ D_807FD610[cc_player_index].unk31 = 0;
+ }
+ var_f14 = D_807FD610[cc_player_index].unk30 * D_807FD610[cc_player_index].unk30;
+ var_f2 = D_807FD610[cc_player_index].unk31 * D_807FD610[cc_player_index].unk31;
+ var_f16 = sqrtf(var_f14 + var_f2);
+ if (var_f2 < var_f14) {
+ temp_f12 = var_f14;
+ var_f14 = var_f2;
+ var_f2 = temp_f12;
+ }
+ if (var_f2 != 0.0f) {
+ var_f16 *= (f32)(1.0 - ((var_f14 / var_f2) * D_8075D0E0));
+ }
+ if (var_f16 > 70.0f) {
+ var_f16 = 70.0f;
+ }
+ temp_f8 = D_807FD610[cc_player_index].unk4;
+ D_807FD610[cc_player_index].unk4 = var_f16;
+ D_807FD610[cc_player_index].unkC = var_f16 - temp_f8;
+ if (var_f16 != 0.0f) {
+ D_807FD610[cc_player_index].unk0 = 0;
+ D_807FD610[cc_player_index].unk8 = (var_f16 - 5.0f) / 65.0f;
+ } else {
+ D_807FD610[cc_player_index].unk0++;
+ D_807FD610[cc_player_index].unk8 = 0.0f;
+ }
+ if (var_f16 != 0.0f) {
+ var_t0 = (func_80611BB4(D_807FD610[cc_player_index].unk2E, -D_807FD610[cc_player_index].unk2F) * 4096.0f) / D_8075D0E8;
+ D_807FD610[cc_player_index].unk28 = (character_change_array[cc_player_index].unk2C8 + var_t0);
+ D_807FD610[cc_player_index].unk28 &= 0xFFF;
+ } else {
+ var_t0 = D_807FD610[cc_player_index].unk20[0];
+ }
+ for (var_a0 = 3; var_a0 != 0; var_a0--) {
+ D_807FD610[cc_player_index].unk20[var_a0] = D_807FD610[cc_player_index].unk20[var_a0 - 1];
+ D_807FD610[cc_player_index].unk10[var_a0] = D_807FD610[cc_player_index].unk10[var_a0 - 1];
+ }
+ D_807FD610[cc_player_index].unk20[var_a0] = var_t0;
+ D_807FD610[cc_player_index].unk10[var_a0] = var_f16;
+
+ // Handle inputs for this control state
+ inputHandler = &D_80751004[controlState];
+ inputHandler->unk4();
+ if (D_807FD610[cc_player_index].unk2A & START_BUTTON) {
+ inputHandler->unk0();
+ }
+ if (D_807FD610[cc_player_index].unk2A & A_BUTTON) {
+ inputHandler->unk8();
+ } else {
+ inputHandler->unk14();
+ }
+ if (D_807FD610[cc_player_index].unk2A & B_BUTTON) {
+ inputHandler->unkC();
+ } else {
+ inputHandler->unk18();
+ }
+ if (D_807FD610[cc_player_index].unk2A & Z_TRIG) {
+ inputHandler->unk10();
+ } else {
+ inputHandler->unk1C();
+ }
+ if (D_807FD610[cc_player_index].unk2A & R_TRIG) {
+ inputHandler->unk24();
+ } else {
+ inputHandler->unk2C();
+ }
+ if (D_807FD610[cc_player_index].unk2A & L_TRIG) {
+ inputHandler->unk20();
+ }
+ if (D_807FD610[cc_player_index].unk2A & U_CBUTTONS) {
+ inputHandler->unk30();
+ }
+ if (D_807FD610[cc_player_index].unk2A & D_CBUTTONS) {
+ inputHandler->unk3C();
+ }
+ if (D_807FD610[cc_player_index].unk2A & L_CBUTTONS) {
+ inputHandler->unk34();
+ }
+ if (D_807FD610[cc_player_index].unk2A & R_CBUTTONS) {
+ inputHandler->unk38();
+ }
+ inputHandler->unk40();
+ return D_807FBB48->control_state - oldControlState;
+}
+*/
+
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_CEAE0/func_806DFF34.s")
/*
diff --git a/src/menu/code_3E10.c b/src/menu/code_3E10.c
index 70b3343..2b3c519 100644
--- a/src/menu/code_3E10.c
+++ b/src/menu/code_3E10.c
@@ -52,7 +52,7 @@ extern s8 menu_selection_available;
extern f32 menu_icon_transition_scale;
extern f32 DK_barrel_scale;
-void func_80030894(MenuAdditionalActorData*,s32,u16,u8,f32,u8,u8); // Param 1 is ActorAdditionalData
+void func_80030894(MenuAdditionalActorData*,s32,u16,u16,f32,u8,u8); // Param 1 is ActorAdditionalData
void func_80027E10(void) {
s32 phi_a0 = 1;
@@ -575,11 +575,89 @@ s32 func_8002AD50(s32 arg0) {
// Displaylist stuff
#pragma GLOBAL_ASM("asm/nonmatchings/menu/code_3E10/func_8002B708.s")
-// Huge, fiddly struct negative offset stuff
-// Reasonably doable though
-#pragma GLOBAL_ASM("asm/nonmatchings/menu/code_3E10/func_8002C0C8.s")
+extern s16 D_8003386C[];
+extern f32 D_80033CDC;
+extern f32 D_80033CE0;
+extern f32 D_80033CE4;
+extern s8 D_80033FAD;
+extern s8 D_80033FAE;
+extern s8 D_80033FAF;
+extern s32 D_80720D5C;
+extern s32 D_80720D80;
+extern s32 D_807211AC;
+extern s8 D_8074451C;
+extern s16 D_80744544;
+
+typedef struct {
+ u8 unk0[0x17 - 0x0];
+ u8 unk17;
+} AAD_8002C0C8;
+
+typedef struct {
+ Actor *unk0;
+ s32 unk4;
+ s8 unk8;
+} AAD_MultiplayerMenuKong;
void func_8002F8EC();
+
+void func_8002C0C8(Actor *arg0, s32 arg1) {
+ s32 var_s1;
+ s32 i;
+ AAD_8002C0C8 *temp_s6;
+ AAD_MultiplayerMenuKong *temp_v1;
+
+ temp_s6 = arg0->additional_actor_data;
+ func_8002F8EC();
+ D_80033FAF = 1;
+ var_s1 = 0x1D;
+ for (i = 1; i < 5; i++) {
+ if (isFlagSet(var_s1, 1) != 0) {
+ D_80033FAF |= 1 << i;
+ }
+ var_s1 += 1;
+ }
+ if (D_80744544 & 1) {
+ D_80033FAF |= 0x20;
+ }
+ D_80033FAE = 0;
+ D_80033FAD = 0;
+ if (D_8076A104 != 0) {
+ if (D_8074451C >= 5) {
+ D_8074451C = 0;
+ }
+ }
+ temp_s6->unk17 = D_8074451C;
+ for (i = 0; i < 4; i++) {
+ Actor17C *temp;
+ func_80677FA8(ACTOR_MAIN_MENU_MULTIPLAYER_KONG, D_8003386C[D_8076A0E4[i] & 0x7F]);
+ temp = D_807FBB44->unk17C;
+ temp->unk0_s16[0] = D_8003386C[D_8076A0E4[i] & 0x7F];
+ D_807FBB44->control_state = i;
+ D_807FBB44->control_state_progress = D_8076A0E4[i] & 0x7F;
+ temp_v1 = D_807FBB44->additional_actor_data;
+ temp_v1->unk0 = arg0;
+ temp_v1->unk8 = 0;
+ }
+ func_80030894(temp_s6, &D_80720CF0, 0x122, 0xD2, 0.75f, 2, 0);
+ func_80030894(temp_s6, &D_80720D14, 0x23, 0xD2, 0.75f, 2, 0);
+ func_80030894(temp_s6, &D_80720C34, 0xA0, 0x7D, 0.75f, 2, 4);
+ func_80030894(temp_s6, &D_80720D80, 0xA0, 0x10, 0.5f, 2, 0);
+ func_80030894(temp_s6, &D_807211AC, 0xA0, 0xDC, 0.75f, 2, 0);
+ func_80030894(temp_s6, &D_807211D0, 1, 1, D_80033CDC, 2, 0xF);
+ func_80030894(temp_s6, &D_807211D0, 2, 2, D_80033CE0, 2, 0xF);
+ func_80030894(temp_s6, &D_807211D0, 3, 3, D_80033CE4, 2, 0xF);
+ func_80030894(temp_s6, &D_80720CF0, 0x122, 0xD2, 0.75f, 2, 0xB);
+ func_80030894(temp_s6, &D_80720D14, 0x23, 0xD2, 0.75f, 2, 0xB);
+ func_80030894(temp_s6, &D_80720C34, 0xA0, 0x16D, 0.75f, 2, 4);
+ func_80030894(temp_s6, &D_80720D5C, 0xA0, 0xDC, 0.5f, 2, 0xB);
+ func_80030894(temp_s6, &D_80720D80, 0xA0, 0x10, 0.5f, 2, 0x13);
+ func_80030894(temp_s6, &D_80720CF0, 0x122, 0xD2, 0.75f, 2, 0xD);
+ func_80030894(temp_s6, &D_80720D14, 0x23, 0xD2, 0.75f, 2, 0xD);
+ func_80030894(temp_s6, &D_80720C34, 0xA0, 0x23F, 0.75f, 2, 4);
+ func_80030894(temp_s6, &D_80720D5C, 0xA0, 0xDC, 0.5f, 2, 0xD);
+}
+
void func_8002FC1C(Actor*, MenuAdditionalActorData*, s32);
void func_8002C584(Actor *arg0, s32 arg1) {
diff --git a/symbol_addrs.boss.us.txt b/symbol_addrs.boss.us.txt
index 0575715..46dbf74 100644
--- a/symbol_addrs.boss.us.txt
+++ b/symbol_addrs.boss.us.txt
@@ -29,3 +29,5 @@ D_80036A20 = 0x80036A20;
func_8071720C = 0x8071720C;
func_8071AF30 = 0x8071AF30;
+
+D_80035B10 = 0x80035B10;