diff --git a/include/functions.h b/include/functions.h index e705cf2..0768745 100644 --- a/include/functions.h +++ b/include/functions.h @@ -35,6 +35,8 @@ 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); +u8 func_global_asm_8072AB74(u8 arg0, f32 x, f32 z, u16 arg3, f32 arg4); + void func_global_asm_806A1AC4(void); void func_global_asm_8068696C(Actor *arg0); void func_global_asm_8067B100(Actor *player); @@ -1764,7 +1766,7 @@ void func_global_asm_8070E808(Actor *arg0, Actor *arg1); void func_global_asm_8070DA28(AAD_global_asm_806A4DDC *arg0); void func_global_asm_806891D8(s16 arg0, f32 x, f32 y, f32 z, s16 arg4, f32 arg5, Actor *arg6, Struct807500B4 *arg7); void func_global_asm_806A7600(void *arg0); -void func_global_asm_8072EE7C(s32 arg0, u8 arg1, u8 arg2, u8 arg3, u8 arg4, f32 arg5, f32 arg6, f32 arg7, f32 arg8, f32 arg9, f32 argA, u8 argB, f32 argC, f32 argD, u8 argE); +void func_global_asm_8072EE7C(Actor *arg0, u8 arg1, u8 arg2, u8 arg3, u8 arg4, f32 arg5, f32 arg6, f32 arg7, f32 arg8, f32 arg9, f32 argA, u8 argB, f32 argC, f32 argD, u8 argE); void func_global_asm_8072EF7C(Actor *arg0, u8 arg1, u8 arg2, u8 arg3, u8 arg4, f32 arg5, f32 arg6, f32 arg7, u8 arg8, s16 arg9, s16 argA, s16 argB, s16 argC); f32 func_global_asm_80611850(f32 arg0); void func_global_asm_80675D70(Actor *arg0); @@ -2409,7 +2411,7 @@ s32 func_global_asm_806CE7A0(Actor*, f32, f32, s16, s16); s32 func_global_asm_806CCC10(void); void func_global_asm_806CF2EC(s32*, s32*); void func_global_asm_806CF918(void); -void func_global_asm_806AD260(s16 arg0, u8 arg1, u16 arg2); +void func_global_asm_806AD260(s16 arg0, u8 arg1, s32 arg2); void func_global_asm_806F10E8(Actor *arg0); void func_global_asm_806F14BC(Actor *arg0); s16 func_global_asm_80665C18(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4); diff --git a/src/boss/code_0.c b/src/boss/code_0.c index 48e1eac..263e792 100644 --- a/src/boss/code_0.c +++ b/src/boss/code_0.c @@ -89,7 +89,6 @@ typedef struct { u8 unk6[1]; // TODO: How many elements? } Struct8002450C; -void func_global_asm_8072AB74(s32, f32, f32, s32, f32); s32 func_boss_80024568(Struct8002450C*, u8, f32, f32, f32); // TODO: Close, just gotta figure out sp48 and D_boss_8003598C @@ -278,7 +277,7 @@ void func_boss_80024EAC(void) { sp2A = current_actor_pointer->animation_state->unk64; func_global_asm_806CC10C(D_global_asm_807FDC90->unk8, current_actor_pointer->y_rotation); - func_global_asm_8072AB74(0x45, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0x16, 0.0f); + func_global_asm_8072AB74(0x45, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0x16, 0); temp_v0 = func_global_asm_806CC10C(D_global_asm_807FDC90->unk8, current_actor_pointer->y_rotation); if (temp_v0 > 0) { if (sp2A != 0x260) { diff --git a/src/boss/code_8520.c b/src/boss/code_8520.c index dbaad04..11b6519 100644 --- a/src/boss/code_8520.c +++ b/src/boss/code_8520.c @@ -81,8 +81,6 @@ typedef struct { s16 unk4; } A178_8002C964; -void func_global_asm_8072AB74(s32, f32, f32, s32, f32); - void func_boss_8002C964(void) { A178_8002C964 *a178; f64 yScale; @@ -229,7 +227,7 @@ void func_boss_8002C964(void) { } break; case 0x23: - func_global_asm_8072AB74(0x23, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0, 0.0f); + func_global_asm_8072AB74(0x23, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0, 0); break; case 0x37: func_global_asm_806AD260(0x2F7, 1, 0); diff --git a/src/global_asm/code_12E800.c b/src/global_asm/code_12E800.c index cbf8023..af9749f 100644 --- a/src/global_asm/code_12E800.c +++ b/src/global_asm/code_12E800.c @@ -157,8 +157,6 @@ void func_global_asm_8072A7DC(void) { // regalloc #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_12E800/func_global_asm_8072A86C.s") -u8 func_global_asm_8072AB74(u8 arg0, f32 arg1, f32 arg2, u16 arg3, f32 arg4); - /* void func_global_asm_8072A86C(s16 arg0, f32 arg1, f32 arg2, f32 arg3, u16 arg4) { current_actor_pointer->y_velocity = func_global_asm_80612794(current_actor_pointer->unkF0) * -arg3; @@ -670,7 +668,7 @@ void func_global_asm_8072DB68(s32 arg0) { } void func_global_asm_8072DC7C(u8 arg0) { - func_global_asm_8072AB74(0x37, 0.0f, 0.0f, 0x32, 0.0f); + func_global_asm_8072AB74(0x37, 0, 0, 0x32, 0); current_actor_pointer->shadow_opacity -= arg0; if (current_actor_pointer->shadow_opacity < 0) { current_actor_pointer->control_state_progress++; diff --git a/src/global_asm/code_133A90.c b/src/global_asm/code_133A90.c index fc99342..15b546f 100644 --- a/src/global_asm/code_133A90.c +++ b/src/global_asm/code_133A90.c @@ -96,7 +96,7 @@ void func_global_asm_8072EE0C(Actor *arg0, u8 arg1, u8 arg2) { } } -void func_global_asm_8072EE7C(s32 arg0, u8 arg1, u8 arg2, u8 arg3, u8 arg4, f32 arg5, f32 arg6, f32 arg7, f32 arg8, f32 arg9, f32 argA, u8 argB, f32 argC, f32 argD, u8 argE) { +void func_global_asm_8072EE7C(Actor *arg0, u8 arg1, u8 arg2, u8 arg3, u8 arg4, f32 arg5, f32 arg6, f32 arg7, f32 arg8, f32 arg9, f32 argA, u8 argB, f32 argC, f32 argD, u8 argE) { GlobalASMStruct82 **var_t0; GlobalASMStruct82 *current; GlobalASMStruct82 *sp18; diff --git a/src/global_asm/code_5E020.c b/src/global_asm/code_5E020.c index aaa11ba..9093dc5 100644 --- a/src/global_asm/code_5E020.c +++ b/src/global_asm/code_5E020.c @@ -1,7 +1,6 @@ #include #include "functions.h" - typedef struct global_asm_struct_78 { s32 unk0; s32 unk4; // Index into object model 2 array? diff --git a/src/global_asm/code_9CE20.c b/src/global_asm/code_9CE20.c index e24de87..70b75d5 100644 --- a/src/global_asm/code_9CE20.c +++ b/src/global_asm/code_9CE20.c @@ -1,6 +1,7 @@ #include #include "functions.h" +// doable #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_9CE20/func_global_asm_80698120.s") void func_global_asm_8072EF7C(Actor *arg0, u8 arg1, u8 arg2, u8 arg3, u8 arg4, f32 arg5, f32 arg6, f32 arg7, u8 arg8, s16 arg9, s16 argA, s16 argB, s16 argC); @@ -27,7 +28,6 @@ typedef struct { } AAD_global_asm_80698120; /* -// TODO: Doable, good progress made void func_global_asm_80698120(u8 arg0) { PlayerAdditionalActorData *PaaD; u8 sp63; @@ -55,7 +55,23 @@ void func_global_asm_80698120(u8 arg0) { aaD->unk24 = ((rand() >> 0xF) % 100) / 1000.0 + 0.1; aaD->unk18 = 0.0f; current_actor_pointer->animation_state->unk1C = malloc(0x80); - func_global_asm_8072EE7C(current_actor_pointer, 0, 0, 0, arg0 * 0.33333299999999999, 0.15f, 100.0f, 20.0f, 8.0f, 0, 0.0f, 0.0f, 0); + func_global_asm_8072EE7C( + current_actor_pointer, + 0, + 0, + 0, + 0, + arg0 * 0.33333299999999999, + 0.15f, + 100.0f, + 20.0f, + 8.0f, + 0.0f, + 0, + 0.0f, + 0.0f, + 0 + ); for (var_v1 = 1; var_v1 < arg0; var_v1++) { func_global_asm_8072EF7C(current_actor_pointer, 0, var_v1 + 1, var_v1 - 1, var_v1, 0.3333329856f, 0.0f, 0.0f, 0, 0, 0, 0, 0); } @@ -63,9 +79,9 @@ void func_global_asm_80698120(u8 arg0) { current_actor_pointer->unk131 = 0xC8; var_t1_2->unk14 = 0; var_t1_2->unk15 = 0; - aaD->unk28 = isFlagSet(0x183, FLAG_TYPE_PERMANENT) != FALSE - || (D_global_asm_807FBB64 & 0x10000000) != 0 - || gameIsInDKTVMode() != FALSE; + aaD->unk28 = isFlagSet(0x183, FLAG_TYPE_PERMANENT) + || (D_global_asm_807FBB64 & 0x10000000) + || gameIsInDKTVMode(); } if ((player_pointer->control_state == 0x63) || (aaD->unk28 == 0) || ((current_actor_pointer->unk124->unk0 == 1) && !(PaaD->unk1F0 & 0x40))) { current_actor_pointer->object_properties_bitfield &= 0xFBFFFFFB; diff --git a/src/global_asm/code_B1F60.c b/src/global_asm/code_B1F60.c index f5fa4be..76970d2 100644 --- a/src/global_asm/code_B1F60.c +++ b/src/global_asm/code_B1F60.c @@ -2,14 +2,13 @@ #include "functions.h" s32 func_global_asm_8072881C(s32, s32); -s32 func_global_asm_8072AB74(u8, f32, f32, u16, f32); void func_global_asm_806A5C60(Actor *arg0); // Not 100% on these signatures void func_global_asm_8072C918(s16, s16, s16); u8 func_global_asm_8072D13C(u8 arg0, s32 arg1); -void func_global_asm_806AD260(s16 arg0, u8 arg1, u16 arg2) { +void func_global_asm_806AD260(s16 arg0, u8 arg1, s32 arg2) { if (arg0 != 0) { if (D_global_asm_807FBB70.unk200 == 9 || D_global_asm_807FBB70.unk15 != 0) { if (current_actor_pointer->control_state != 0x37) { @@ -23,7 +22,7 @@ void func_global_asm_806AD260(s16 arg0, u8 arg1, u16 arg2) { case 0x10: case 0x15: case 0x23: - func_global_asm_8072AB74(current_actor_pointer->control_state, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, (current_actor_pointer->unk6A & 1) ? arg2 : arg2 | 2, 0); + func_global_asm_8072AB74(current_actor_pointer->control_state, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, (current_actor_pointer->unk6A & 1) ? (u16)arg2 : (u16)arg2 | 2, 0); break; case 0x2: case 0x3: @@ -35,7 +34,7 @@ void func_global_asm_806AD260(s16 arg0, u8 arg1, u16 arg2) { // TODO: Is there a better way to express case 2 in this switch? switch (current_actor_pointer->control_state_progress) { case 0: - func_global_asm_8072AB74(0x37, 0, 0, (arg2 | 0x4200), 0); + func_global_asm_8072AB74(0x37, 0, 0, ((u16)arg2 | 0x4200), 0); break; case 1: func_global_asm_806A5C60(current_actor_pointer); @@ -46,7 +45,7 @@ void func_global_asm_806AD260(s16 arg0, u8 arg1, u16 arg2) { current_actor_pointer->y_velocity = 100.0f; current_actor_pointer->control_state_progress++; case 2: - func_global_asm_8072AB74(0x37, 0, 0, (arg2 | 0x4200), 0); + func_global_asm_8072AB74(0x37, 0, 0, ((u16)arg2 | 0x4200), 0); } break; case 3: diff --git a/src/global_asm/code_B2CE0.c b/src/global_asm/code_B2CE0.c index 71926d5..882538c 100644 --- a/src/global_asm/code_B2CE0.c +++ b/src/global_asm/code_B2CE0.c @@ -6,8 +6,6 @@ extern s32 D_global_asm_8072073C; // TODO: Proper datatype extern f32 D_global_asm_8075B1A8; -void func_global_asm_8072AB74(s32, f32, f32, s32, f32); - void func_global_asm_80612BC0(f32*, f32); void func_global_asm_8070033C(f32, f32, f32, f32, f32, f32, f32, s32, s32, s32); @@ -288,8 +286,6 @@ void func_global_asm_806AEE08(void) { #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_B2CE0/func_global_asm_806AEE84.s") void func_global_asm_806AF688(void) { - s32 var_v0; - initializeCharacterSpawnerActor(); if (!(current_actor_pointer->object_properties_bitfield & 0x10)) { func_global_asm_8072B79C(0x2C0, 0x2C1, 0x2C1); @@ -330,24 +326,14 @@ void func_global_asm_806AF688(void) { current_actor_pointer->control_state = 0x11; current_actor_pointer->control_state_progress = 0; } - if (current_actor_pointer->control_state == 1) { - var_v0 = 2; - } else { - var_v0 = 0; - } - func_global_asm_80724E48(var_v0); + func_global_asm_80724E48(current_actor_pointer->control_state == 1 ? 2 : 0); func_global_asm_8072AB74(current_actor_pointer->control_state, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0, 0.0f); break; case 0x2: case 0x3: case 0x7: case 0x35: - if (current_actor_pointer->control_state == 0x35) { - var_v0 = 2; - } else { - var_v0 = 3; - } - func_global_asm_80724E48(var_v0); + func_global_asm_80724E48(current_actor_pointer->control_state == 0x35 ? 2 : 3); func_global_asm_8072AB74(current_actor_pointer->control_state, D_global_asm_807FDC90->unkA, D_global_asm_807FDC90->unkE, 0, 0.0f); break; case 0x37: diff --git a/src/global_asm/code_B5EC0.c b/src/global_asm/code_B5EC0.c index a6a63f6..d261efc 100644 --- a/src/global_asm/code_B5EC0.c +++ b/src/global_asm/code_B5EC0.c @@ -35,30 +35,14 @@ void func_global_asm_806B1348(void) { } } -// Huge, jumptable, it compiles... doable +// Jumptable, close, doable #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_B5EC0/func_global_asm_806B13B4.s") -// ? func_global_asm_806A5C60(Actor *, Actor **); -// ? func_global_asm_8072A450(Actor *); -// ? func_global_asm_8072AB74(u8, f32, f32, ?, f32); -// void func_global_asm_8072C918(s16, s16, s16); -// ? func_global_asm_8072D13C(u8, ?); -// ? func_global_asm_8072D714(Actor *, ?); +void func_global_asm_8072C918(s16, s16, s16); +u8 func_global_asm_8072D13C(u8, s32); // extern /* void func_global_asm_806B13B4(u8 arg0) { - s32 var_v1; - s32 var_v1_2; - u16 temp_v1_4; - u16 temp_v1_5; - u8 temp_t8; - u8 temp_v1; - u8 temp_v1_2; - u8 temp_v1_3; - u8 var_a0; - u8 var_a0_2; - u8 var_a1; - initializeCharacterSpawnerActor(); if (!(current_actor_pointer->object_properties_bitfield & 0x10)) { if (current_map == MAP_STASH_SNATCH_NORMAL) { @@ -68,142 +52,95 @@ void func_global_asm_806B13B4(u8 arg0) { func_global_asm_8072B79C(0x205, 0x203, 0x204); func_global_asm_80724CA4(2, 1); } - var_a0 = current_actor_pointer->control_state; - var_a1 = var_a0; - if (var_a0 == 0x27) { + if (current_actor_pointer->control_state == 0x27) { current_actor_pointer->unk132 = 2; - var_a0 = current_actor_pointer->control_state; - goto block_8; - } - if (var_a1 != 0x32) { + } else if (current_actor_pointer->control_state != 0x32) { current_actor_pointer->unk132 = 1; - var_a0 = current_actor_pointer->control_state; -block_8: - var_a1 = var_a0; } - if (var_a1 == 0x32) { - if (D_global_asm_807FBB70.unk15 != 0) { - goto block_11; - } - } else { -block_11: - if (D_global_asm_807FBB70.unk200 != 9) { - if (D_global_asm_807FBB70.unk15 != 0) { - goto block_13; + if (current_actor_pointer->control_state != 0x32 || D_global_asm_807FBB70.unk15 != 0) { + if (D_global_asm_807FBB70.unk200 == 9 || D_global_asm_807FBB70.unk15 != 0) { + if (current_actor_pointer->control_state != 0x37) { + if (current_actor_pointer->health < -1) { + func_global_asm_8072D714(D_global_asm_807FBB70.unk1FC, 0x20C); + current_actor_pointer->y_velocity = 250.0f; + } else { + func_global_asm_8072D714(D_global_asm_807FBB70.unk1FC, 0x20B); + current_actor_pointer->y_velocity = 200.0f; + } + D_global_asm_807FDC90->unk35 = 2; + current_actor_pointer->unk138 &= 0xFFFF7FFF; } - goto block_18; - } -block_13: - if (var_a1 != 0x37) { - if (current_actor_pointer->health < -1) { - func_global_asm_8072D714(D_global_asm_807FBB70.unk1FC, 0x20C); - current_actor_pointer->y_velocity = 250.0f; - } else { - func_global_asm_8072D714(D_global_asm_807FBB70.unk1FC, 0x20B); - current_actor_pointer->y_velocity = 200.0f; - } - D_global_asm_807FDC90->unk35 = 2; - current_actor_pointer->unk138 &= 0xFFFF7FFF; - var_a0 = current_actor_pointer->control_state; - goto block_22; - } -block_18: - if (D_global_asm_807FBB70.unk200 == 4) { + } else if (D_global_asm_807FBB70.unk200 == 4) { func_global_asm_8072DEA8(0x209, 0x31, D_global_asm_807FBB70.unk1FC); - var_a0 = current_actor_pointer->control_state; - goto block_22; - } - if (D_global_asm_807FBB70.unk200 == 5) { + } else if (D_global_asm_807FBB70.unk200 == 5) { func_global_asm_8072DEA8(0x20A, 0x32, D_global_asm_807FBB70.unk1FC); current_actor_pointer->y_velocity = 220.0f; current_actor_pointer->unk132 = 8; - var_a0 = current_actor_pointer->control_state; -block_22: - var_a1 = var_a0; } } - switch (var_a1) { // switch 1 - case 0x31: // switch 1 - if (current_actor_pointer->control_state_progress == 0) { - if (current_actor_pointer->animation_state->unk0->unk24 == 0.0f) { - goto block_27; - } - } else { -block_27: + switch (current_actor_pointer->control_state) { + case 0x31: + if (current_actor_pointer->control_state_progress != 0 || current_actor_pointer->animation_state->unk0->unk24 == 0.0f) { func_global_asm_8072DE44(0x203); } func_global_asm_8072AB74(0, 0.0f, 0.0f, 0x4300, 0.0f); - var_a0 = current_actor_pointer->control_state; -block_100: - var_a1 = var_a0; break; - case 0x32: // switch 1 + case 0x32: current_actor_pointer->y_rotation = func_global_asm_806CC190(current_actor_pointer->y_rotation, current_actor_pointer->unkEE, 7.0f); - temp_v1 = current_actor_pointer->control_state_progress; - switch (temp_v1) { // switch 3; irregular - case 0: // switch 3 + switch (current_actor_pointer->control_state_progress) { + case 0: func_global_asm_8072AB74(0, 0.0f, 0.0f, 0x4300, 0.0f); -block_34: break; - case 1: // switch 3 + case 1: current_actor_pointer->unk132 = 1; func_global_asm_8072DE44(0x203); - goto block_34; + break; } - var_a0 = current_actor_pointer->control_state; - goto block_100; - case 0x28: // switch 1 - temp_v1_2 = current_actor_pointer->control_state_progress; - switch (temp_v1_2) { // switch 4; irregular - case 0: // switch 4 + break; + case 0x28: + switch (current_actor_pointer->control_state_progress) { + case 0: playActorAnimation(current_actor_pointer, 0x20D); current_actor_pointer->control_state_progress = 1; - var_a0 = current_actor_pointer->control_state; - goto block_100; - case 2: // switch 4 + break; + case 2: func_global_asm_806B11C0(1); func_global_asm_806B11C0(2); playSoundAtActorPosition(current_actor_pointer, 0x1D5, 0xFF, 0x7F, 1); playSoundAtActorPosition(current_actor_pointer, 0x25A, 0xFF, 0x7F, 1); current_actor_pointer->control_state_progress = 3; - var_a0 = current_actor_pointer->control_state; - goto block_100; - case 4: // switch 4 + break; + case 4: func_global_asm_8072DE44(0x203); - var_a0 = current_actor_pointer->control_state; - goto block_100; + break; } break; - case 0x11: // switch 1 - func_global_asm_80724E48(5, var_a1); - temp_v1_3 = current_actor_pointer->control_state_progress; - switch (temp_v1_3) { // switch 5; irregular - case 0: // switch 5 + case 0x11: + func_global_asm_80724E48(5); + switch (current_actor_pointer->control_state_progress) { + case 0: func_global_asm_8072B324(current_actor_pointer, 0); playActorAnimation(current_actor_pointer, 0x205); - current_actor_pointer->control_state_progress += 1; + current_actor_pointer->control_state_progress++; // fallthrough - case 1: // switch 5 + case 1: func_global_asm_8072AB74(current_actor_pointer->control_state, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0x200, 0.0f); if (current_actor_pointer->unkB8 < 1.0f) { - current_actor_pointer->control_state_progress += 1; -block_53: - current_actor_pointer = current_actor_pointer; + current_actor_pointer->control_state_progress++; } break; - case 2: // switch 5 - func_global_asm_8072A450(current_actor_pointer); + case 2: + func_global_asm_8072A450(); if (((rand() >> 0xF) % 1000) >= 0x3E4) { func_global_asm_8072DE44(0x203); } - goto block_53; + break; } - var_a0 = current_actor_pointer->control_state; - goto block_100; - case 0x27: // switch 1 - func_global_asm_8072AB74(var_a0, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0x200, 0.0f); - switch (current_actor_pointer->control_state_progress) { // switch 2 - case 0: // switch 2 + break; + case 0x27: + func_global_asm_8072AB74(current_actor_pointer->control_state, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0x200, 0.0f); + switch (current_actor_pointer->control_state_progress) { + case 0: func_global_asm_8072B324(current_actor_pointer, 0); if (((rand() >> 0xF) % 1000) >= 0x259) { playActorAnimation(current_actor_pointer, 0x208); @@ -212,120 +149,95 @@ block_53: playActorAnimation(current_actor_pointer, 0x206); current_actor_pointer->control_state_progress = 1; } -block_73: - current_actor_pointer = current_actor_pointer; - default: // switch 2 -block_74: - var_a0 = current_actor_pointer->control_state; + default: break; - case 1: // switch 2 - if (!(D_global_asm_807FDC90->unk1A & 0x100)) { - var_a0 = current_actor_pointer->unk0; - } else { + case 1: + if (D_global_asm_807FDC90->unk1A & 0x100) { func_global_asm_8066EA90(current_actor_pointer, 2); func_global_asm_8066EA90(current_actor_pointer, 3); - goto block_73; } break; - case 2: // switch 2 - temp_v1_4 = D_global_asm_807FDC90->unk1A; - if (temp_v1_4 & 0x100) { - D_global_asm_807FDC90->unk1A = temp_v1_4 & 0xFEFF; + case 2: + if (D_global_asm_807FDC90->unk1A & 0x100) { + D_global_asm_807FDC90->unk1A &= 0xFEFF; playActorAnimation(current_actor_pointer, 0x207); current_actor_pointer->control_state_progress = 3; } else { func_global_asm_8072DE44(0x203); } - goto block_73; - case 3: // switch 2 - temp_v1_5 = D_global_asm_807FDC90->unk1A; - if (temp_v1_5 & 0x100) { - D_global_asm_807FDC90->unk1A = temp_v1_5 & 0xFEFF; + break; + case 3: + if (D_global_asm_807FDC90->unk1A & 0x100) { + D_global_asm_807FDC90->unk1A &= 0xFEFF; playActorAnimation(current_actor_pointer, 0x208); current_actor_pointer->control_state_progress = 5; - goto block_73; } - goto block_74; - case 4: // switch 2 + break; + case 4: func_global_asm_8072DE44(0x203); - goto block_73; - case 5: // switch 2 - current_actor_pointer->unk0 = 4; - goto block_73; + break; + case 5: + current_actor_pointer->unk132 = 4; + break; } - goto block_100; - case 0x1: // switch 1 - if (func_global_asm_8072E54C() != 0) { + break; + case 0x1: + if (func_global_asm_8072E54C()) { current_actor_pointer->control_state = 0x11; current_actor_pointer->control_state_progress = 0; } // fallthrough - case 0x10: // switch 1 - case 0x23: // switch 1 + case 0x10: + case 0x23: if (func_global_asm_8061CB50() == 0) { func_global_asm_806B1290(); func_global_asm_806B1348(); } - var_v1 = 0; - if (current_actor_pointer->control_state == 1) { - var_v1 = 2; - } - func_global_asm_80724E48(var_v1); + func_global_asm_80724E48(current_actor_pointer->control_state == 1 ? 2 : 0); func_global_asm_8072AB74(current_actor_pointer->control_state, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0, 0.0f); - var_a0 = current_actor_pointer->control_state; - goto block_100; - case 0x2: // switch 1 - case 0x3: // switch 1 - case 0x7: // switch 1 - case 0x35: // switch 1 - var_v1_2 = 3; - if (var_a1 == 0x35) { - var_v1_2 = 2; - } - func_global_asm_80724E48(var_v1_2); + break; + case 0x2: + case 0x3: + case 0x7: + case 0x35: + func_global_asm_80724E48(current_actor_pointer->control_state == 0x35 ? 2 : 3); func_global_asm_8072AB74(current_actor_pointer->control_state, D_global_asm_807FDC90->unkA, D_global_asm_807FDC90->unkE, 0, 0.0f); - var_a0 = current_actor_pointer->control_state; - goto block_100; - case 0x37: // switch 1 + break; + case 0x37: current_actor_pointer->y_rotation = func_global_asm_806CC190(current_actor_pointer->y_rotation, current_actor_pointer->unkEE, 7.0f); - var_a0_2 = current_actor_pointer->control_state_progress; - switch (var_a0_2) { // switch 6; irregular - case 0: // switch 6 + switch (current_actor_pointer->control_state_progress) { + case 0: func_global_asm_8072AB74(0x37, 0.0f, 0.0f, 0x200, 0.0f); -block_97: break; - case 1: // switch 6 + case 1: if (arg0 != 0) { - func_global_asm_806A5C60(current_actor_pointer, ¤t_actor_pointer); - var_a0_2 = current_actor_pointer->control_state_progress; + func_global_asm_806A5C60(current_actor_pointer); } - current_actor_pointer->control_state_progress = var_a0_2 + 1; + current_actor_pointer->control_state_progress++; // fallthrough - case 2: // switch 6 + case 2: func_global_asm_8072AB74(0x37, 0.0f, 0.0f, 0x200, 0.0f); func_global_asm_8072DC7C(8); - goto block_97; - case 3: // switch 6 + break; + case 3: current_actor_pointer->control_state = 0x40; - goto block_97; + break; } - var_a0 = current_actor_pointer->control_state; - goto block_100; - default: // switch 1 - func_global_asm_8072B7CC(0x203); - var_a0 = current_actor_pointer->control_state; - goto block_100; - } - switch (var_a1) { // switch 7; irregular - case 0x31: // switch 7 - case 0x37: // switch 7 - case 0x40: // switch 7 break; - case 0x2: // switch 7 - case 0x3: // switch 7 - func_global_asm_8072D13C(var_a0, 1); + default: + func_global_asm_8072B7CC(0x203); + break; + } + switch (current_actor_pointer->control_state) { + case 0x31: + case 0x37: + case 0x40: + break; + case 0x2: + case 0x3: + func_global_asm_8072D13C(current_actor_pointer->control_state, 1); // fallthrough - default: // switch 7 + default: func_global_asm_8072C918(0x6400, 0x203, 0x204); break; } diff --git a/src/global_asm/code_B7490.c b/src/global_asm/code_B7490.c index 6cd5c7e..8609fcd 100644 --- a/src/global_asm/code_B7490.c +++ b/src/global_asm/code_B7490.c @@ -292,8 +292,6 @@ void func_global_asm_806B3420(void) { // close, switch case woes #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_B7490/func_global_asm_806B3680.s") -s32 func_global_asm_8072AB74(u8, f32, f32, s32, f32); - extern s32 D_global_asm_8072073C; extern s32 D_global_asm_8071ABDC; @@ -603,7 +601,7 @@ void func_global_asm_806B49B0(u8 arg0, s16 arg1, s16 arg2) { playActorAnimation(current_actor_pointer, arg1); current_actor_pointer->control_state_progress++; } - func_global_asm_8072AB74(arg0, D_global_asm_807FDC90->unkA, D_global_asm_807FDC90->unkE, 0xE1, 0.0f); + func_global_asm_8072AB74(arg0, D_global_asm_807FDC90->unkA, D_global_asm_807FDC90->unkE, 0xE1, 0); if (current_actor_pointer->y_position < sp32) { if (current_actor_pointer->control_state_progress == 2) { current_actor_pointer->y_position += ((f32)D_global_asm_807FDC9C[0].unkA_u8[1] * 0.03125); @@ -627,7 +625,7 @@ void func_global_asm_806B49B0(u8 arg0, s16 arg1, s16 arg2) { } break; case 0x37: - func_global_asm_8072AB74(0x37, 0.0f, 0.0f, 0x22, 0.0f); + func_global_asm_8072AB74(0x37, 0, 0, 0x22, 0); if (current_actor_pointer->unk6A & 1) { current_actor_pointer->control_state = 0x40; } diff --git a/src/global_asm/code_BB300.c b/src/global_asm/code_BB300.c index df35bf7..0310c59 100644 --- a/src/global_asm/code_BB300.c +++ b/src/global_asm/code_BB300.c @@ -6,8 +6,6 @@ extern s16 D_global_asm_807502E0; extern u8 D_global_asm_807FBD70; -void func_global_asm_8072AB74(s32, f32, f32, s32, f32); - // rodata, close, doable #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_BB300/func_global_asm_806B6600.s") @@ -94,7 +92,7 @@ void func_global_asm_806B6958(void) { deleteActor(current_actor_pointer); } if (current_actor_pointer->control_state == 0x23) { - func_global_asm_8072AB74(0x23, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0x200, 0.0f); + func_global_asm_8072AB74(0x23, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0x200, 0); } else { func_global_asm_8072B7CC(0x237); } diff --git a/src/global_asm/code_BDEE0.c b/src/global_asm/code_BDEE0.c index 8959f62..65df5f5 100644 --- a/src/global_asm/code_BDEE0.c +++ b/src/global_asm/code_BDEE0.c @@ -10,7 +10,6 @@ extern u8 D_global_asm_80750628[]; void func_global_asm_80612BC0(Mtx*, f32); void func_global_asm_80612C30(Mtx*, f32); void func_global_asm_80611A70(f32, f32, f32*, f32*); -s32 func_global_asm_8072AB74(s32, f32, f32, s32, f32); // Jumptable #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_BDEE0/func_global_asm_806B91E0.s") @@ -209,7 +208,7 @@ void func_global_asm_806BA76C(f32 arg0) { case 0x3: case 0x7: case 0x35: - if (!(func_global_asm_8072AB74(current_actor_pointer->control_state, var_f0, var_f2, (current_actor_pointer->unkFC ? 0x10 : 0x810) & 0xFFFF, 0.0f) & 1) && (current_actor_pointer->unkFC == 0)) { + if (!(func_global_asm_8072AB74(current_actor_pointer->control_state, var_f0, var_f2, (current_actor_pointer->unkFC ? 0x10 : 0x810), 0) & 1) && (current_actor_pointer->unkFC == 0)) { a178->unk0 += arg0; } break; @@ -224,7 +223,7 @@ void func_global_asm_806BA76C(f32 arg0) { } break; case 0x4: - func_global_asm_8072AB74(0x37, 0.0f, 0.0f, 0x12, 0.0f); + func_global_asm_8072AB74(0x37, 0, 0, 0x12, 0); break; default: func_global_asm_8072B7CC(0); diff --git a/src/global_asm/code_C2A90.c b/src/global_asm/code_C2A90.c index 0b51f4a..992909f 100644 --- a/src/global_asm/code_C2A90.c +++ b/src/global_asm/code_C2A90.c @@ -44,7 +44,6 @@ int func_global_asm_807035C4(); // TODO: Signature void func_global_asm_80718BF4(void); int func_global_asm_807197B4(); // TODO: Signature int func_global_asm_8071C818(); // TODO: Signature -void func_global_asm_8072AB74(s32, f32, f32, s32, f32); u8 func_global_asm_806BDD90(void) { s16 i; @@ -449,7 +448,7 @@ void func_global_asm_806BE8BC(void) { } } func_global_asm_8072881C(0, &D_global_asm_807FDC90->unk28); - func_global_asm_8072AB74(current_actor_pointer->control_state, D_global_asm_807FDC90->unkA, D_global_asm_807FDC90->unkE, 0x10, 0.0f); + func_global_asm_8072AB74(current_actor_pointer->control_state, D_global_asm_807FDC90->unkA, D_global_asm_807FDC90->unkE, 0x10, 0); func_global_asm_8072D13C(current_actor_pointer->control_state, 0); break; } diff --git a/src/global_asm/code_C8C10.c b/src/global_asm/code_C8C10.c index 4ac2be7..bfe1b29 100644 --- a/src/global_asm/code_C8C10.c +++ b/src/global_asm/code_C8C10.c @@ -139,7 +139,6 @@ void func_global_asm_806C49D0(void) { renderActor(current_actor_pointer, 0); } -void func_global_asm_8072AB74(s32, f32, f32, s32, f32); extern int func_global_asm_8068E474(); // TODO: Signature typedef struct { @@ -419,7 +418,7 @@ void func_global_asm_806C5C20(void) { current_actor_pointer->unkB8 = D_global_asm_807FDC9C->unkC * 4; } func_global_asm_80724E48(6); - func_global_asm_8072AB74(1, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0x2C9, 0.0f); + func_global_asm_8072AB74(1, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0x2C9, 0); if (!(object_timer & 3)) { func_global_asm_807149B8(1); func_global_asm_8071498C(&func_global_asm_8071C818); diff --git a/src/global_asm/code_FE40.c b/src/global_asm/code_FE40.c index 72e2908..bd7fc2a 100644 --- a/src/global_asm/code_FE40.c +++ b/src/global_asm/code_FE40.c @@ -1,32 +1,31 @@ #include #include "functions.h" - -// Doable, datatype and stack issues +// Doable, close #pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_FE40/func_global_asm_8060B140.s") extern s8 D_global_asm_80746834; extern OSMesgQueue D_global_asm_807655F0; extern OSIoMesg D_global_asm_807ECE00; -extern void *D_global_asm_807ECE18; +extern void *D_807ECE18; /* void func_global_asm_8060B140(u32 arg0, u8 *arg1, s32 *arg2, u8 arg3, u8 arg4, u8 arg5, u8 *arg6) { + u8 i; + u32 var_a0; u8 *sp5C; u8 *sp58; + u32 var_v1; u8 *sp50; - s32 var_v1; - u32 var_a0; - u32 var_s0; u8 *var_s1; sp58 = arg1; - if ((arg3 != 0) || (arg4 != 0)) { + if ((arg3) || (arg4)) { if (arg3 & 0x80) { sp5C = arg6; arg6 += 0x3800; } else if (arg6 != NULL) { - sp5C = 0x80024000; + sp5C = (void*)0x80024000; } else { sp50 = malloc(*arg2); sp5C = sp50; @@ -35,22 +34,22 @@ void func_global_asm_8060B140(u32 arg0, u8 *arg1, s32 *arg2, u8 arg3, u8 arg4, u sp5C = arg1; } osInvalDCache(sp5C, *arg2); + i = 0; var_v1 = *arg2; - var_s0 = 0; - var_s1 = sp5C; var_a0 = var_v1 >> 0xE; + var_s1 = sp5C; if (var_a0 != 0) { do { osPiStartDma(&D_global_asm_807ECE00, 0, 0, arg0, var_s1, 0x4000, &D_global_asm_807655F0); D_global_asm_80746834 = 4; osRecvMesg(&D_global_asm_807655F0, NULL, 1); D_global_asm_80746834 = 0; - var_s0 += 1; + i += 1; var_v1 = *arg2; arg0 += 0x4000; var_s1 += 0x4000; var_a0 = var_v1 >> 0xE; - } while (var_s0 < var_a0); + } while (i < var_a0); } if (var_v1 - (var_a0 << 0xE) != 0) { osPiStartDma(&D_global_asm_807ECE00, 0, 0, arg0, var_s1, var_v1 - (var_a0 << 0xE), &D_global_asm_807655F0); @@ -58,32 +57,32 @@ void func_global_asm_8060B140(u32 arg0, u8 *arg1, s32 *arg2, u8 arg3, u8 arg4, u osRecvMesg(&D_global_asm_807655F0, NULL, 1); D_global_asm_80746834 = 0; } - D_global_asm_807ECE18 = arg6; + D_807ECE18 = arg6; if ((arg6 == NULL) && ((arg5 == 1) || (arg5 == 2))) { - D_global_asm_807ECE18 = malloc(0x4000); + D_807ECE18 = malloc(0x4000); } switch (arg5) { case 1: - if (arg3 != 0) { - func_dk64_boot_800024E0(&sp5C, &arg1, D_global_asm_807ECE18); + if (arg3) { + func_dk64_boot_800024E0(&sp5C, &arg1, D_807ECE18); } - if (arg4 != 0) { - func_dk64_boot_800024E0(&sp5C, &arg1, D_global_asm_807ECE18); + if (arg4) { + func_dk64_boot_800024E0(&sp5C, &arg1, D_807ECE18); } break; case 2: - if (arg3 != 0) { - func_dk64_boot_80002790(&sp5C, &arg1, D_global_asm_807ECE18, arg3); + if (arg3) { + func_dk64_boot_80002790(&sp5C, &arg1, D_807ECE18, arg3); } - if (arg4 != 0) { - func_dk64_boot_80002790(&sp5C, &arg1, D_global_asm_807ECE18, arg4); + if (arg4) { + func_dk64_boot_80002790(&sp5C, &arg1, D_807ECE18, arg4); } break; } if ((arg6 == NULL) && ((arg5 == 1) || (arg5 == 2))) { - free(D_global_asm_807ECE18); + free(D_807ECE18); } - if ((arg3 != 0) || (arg4 != 0)) { + if ((arg3) || (arg4)) { *arg2 = arg1 - sp58; if (arg6 == NULL) { free(sp50); diff --git a/src/global_asm/done/code_B6C50.c b/src/global_asm/done/code_B6C50.c index b5a28e6..2c7ea19 100644 --- a/src/global_asm/done/code_B6C50.c +++ b/src/global_asm/done/code_B6C50.c @@ -4,7 +4,6 @@ extern s32 D_global_asm_8072030C; extern s32 D_global_asm_80720340; // Sprite -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) { @@ -138,7 +137,7 @@ void func_global_asm_806B24B8(void) { current_actor_pointer->unkF0 = 1; } } - func_global_asm_8072AB74(0x23, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0, 0.0f); + func_global_asm_8072AB74(0x23, D_global_asm_807FDC94->x_position, D_global_asm_807FDC94->z_position, 0, 0); } else { func_global_asm_8072B7CC(0x1F8); }