diff --git a/src/battle/battle.c b/src/battle/battle.c index 7c471a7..da17ffa 100644 --- a/src/battle/battle.c +++ b/src/battle/battle.c @@ -32,6 +32,9 @@ const s32 D_800A0108 = 21; const s32 D_800A010C[] = {2, 22, 3, 23, 4}; // entrypoint + +s32 func_800AD8DC(s32); // extern + INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A1158); INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A1798); @@ -357,6 +360,9 @@ INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A5250); INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A555C); +extern s32 D_800F3A40; +extern s32 D_800F3A42; + INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A55BC); INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A55F4); @@ -444,9 +450,22 @@ INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A68FC); void func_800A6A3C(s32 arg0, s32 arg1) { D_800F5BB8[arg0].unkE |= arg1; } -INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A6A70); +void func_800A555C(); // extern + +void func_800A6A70(s32 arg0) { + s32 temp_v1; + + func_800A555C(); + temp_v1 = arg0 * 0x44; + *(&D_800F5BB8->unkE + temp_v1) = *(&D_800F5BB8->unkE + temp_v1) | 9; +} -INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A6AC4); +void func_800A6AC4(void) { + D_800F5F44.D_800F7DC4 &= 0xFC0F; + D_800F5F44.D_800F7DCA = D_800F5F44.D_800F7DCA & 0xFC0F; + D_800F5F44.D_800F7DAC = D_800F5F44.D_800F7DAC & 0xFC0F; + D_800F5F44.D_800F7DC2 = D_800F5F44.D_800F7DC2 & 0xFC0F; +} INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A6B1C); @@ -454,7 +473,13 @@ INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A6B88); void func_800A6BFC(void) {} -INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A6C04); +void func_800A6C04(s32 arg0) { + s16 sp10; + + sp10 = (s16)D_801636B8[arg0].D_801636B8; + D_800F5F44.D_800F7DBE = func_800A5EB0(func_800151F4(0x26), &sp10) + 0x100; + D_800F5F44.D_800F7DC0 = 0xF; +} INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A6C5C); @@ -462,7 +487,14 @@ INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A6CC0); void func_800A6D10(s32 arg0) { func_800A3E98(arg0, 3, 2, 54, 0); } -INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A6D3C); +void func_800A6D3C(s32 arg0) { + s32 temp_v1; + + temp_v1 = D_800F83E0[arg0].unk0; + if (temp_v1 & 0x2000) { + D_800F83E0[arg0].unk0 = (temp_v1 & ~0x2000) | 0x4000; + } +} INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A6D88); @@ -485,7 +517,12 @@ void func_800A7034(s32 arg0, s16 arg1) { void func_800A7060(s32 arg0, s32 arg1) { func_800A7254(0, arg0, 12, arg1); } -INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A7090); +void func_800A7090(s32 arg0) { + s32 temp_v1; + + temp_v1 = arg0 * 0x44; + *(&D_800F5BB8->unk29 + temp_v1) = *(&D_800F5BB8->unk29 + temp_v1) | 0x40; +} INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A70C4); @@ -571,9 +608,17 @@ INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A866C); INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A8A6C); -INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A8C94); +void func_800A8C94(void) { + D_80063014->unk8C = 0xFF; + D_80063014->unk40 = 0xB0; + D_80063014->unk80 |= 1; + D_80063014->unk3C = (s32)D_80063014->unk3C >> 1; +} -INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800A8CC8); +void func_800A8CC8(void) { + D_80063014->unk6C &= ~0x2000; + D_80063014->unk3C /= 3; +} void func_800A8D04(void) { D_80063014->unk48 = 2; } @@ -804,7 +849,15 @@ INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800AD73C); INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800AD804); -INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800AD890); +s32 func_800AD890(s32 arg0) { + s32 var_a0; + + var_a0 = arg0; + if (D_80063014->unk228 & 0x10) { + var_a0 -= (var_a0 * 3) / 10; + } + return var_a0; +} INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800AD8DC); @@ -823,7 +876,15 @@ INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800ADDE8); void func_800ADE5C(void) { D_80063014->unk214 = D_80063014->unk48 * 20; } -INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800ADE84); +void func_800ADE84(void) { + s32 var_v1; + + var_v1 = D_80063014->unk48 * (0x200 - D_80063014->unk210); + if (var_v1 < 0) { + var_v1 += 0x1F; + } + D_80063014->unk214 = func_800AD8DC(var_v1 >> 5); +} void func_800ADED8(void) { if (D_80063014->unk230 & 0x40) { @@ -977,9 +1038,30 @@ void func_800B0DF8(void) { } } -INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800B0E5C); +s32 func_800B0E5C(s32 arg0) { + s32 var_a0; + + var_a0 = arg0; + if ((var_a0 < 0xFF) && (D_80063014->unkC8 & 0x20)) { + var_a0 -= (var_a0 * 3) / 10; + } + return var_a0; +} + +s32 func_800B0EB4(s32 arg0) { + s32 temp_v1; + s32 var_a0; -INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800B0EB4); + temp_v1 = D_800F83E0[arg0].unk0; + var_a0 = arg0 < 4; + if (temp_v1 & 0x40) { + var_a0 += 1; + } + if (temp_v1 & 0x400000) { + var_a0 += 1; + } + return var_a0 & 1; +} INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800B0F04); @@ -1074,7 +1156,9 @@ u8 func_800B2F30(void) { return func_80014B70(); } u16 func_800B2F50(void) { return func_80014BE4(); } -INCLUDE_ASM("asm/us/battle/nonmatchings/battle", func_800B2F70); +s32 func_800B2F70(void) { + return (((func_800B2F50() & 0xFFFF) * 0x63) / 65535) + 1; +} static s32 func_800B2FC4(s32 arg0) { return (arg0 * (func_800B2F30() + 0xF01)) >> 12; diff --git a/src/battle/battle1.c b/src/battle/battle1.c index efcdc54..127cd91 100644 --- a/src/battle/battle1.c +++ b/src/battle/battle1.c @@ -18,6 +18,19 @@ static void func_800BB864(void); static void func_800C4D10(void); DR_MODE* func_800C4DC8(s16 x, s16 y, s16 w, s16 h, s32*); +extern s8 D_800F8374; +extern s8 D_800F837C; +extern s8 D_800F8380; +extern s32 D_800F9F30; +extern s8 D_801031E0; +extern s8 D_801517C4; +extern s8 D_801620A0; +extern s8 D_801620A4; +extern s8 D_80162974; +extern s8 D_80163B38; + +s16 SquareRoot0(s32, s16); // extern + void func_800B30E4(void) { s32 i; @@ -162,6 +175,9 @@ static void func_800B3DBC(void) { } } +void func_800BC1E0(u8); // extern +void func_800C5BEC(); // extern + INCLUDE_ASM("asm/us/battle/nonmatchings/battle1", func_800B3E2C); INCLUDE_ASM("asm/us/battle/nonmatchings/battle1", func_800B3FAC); @@ -590,13 +606,34 @@ static void func_800BB944(void) { func_8002DA7C(); } -INCLUDE_ASM("asm/us/battle/nonmatchings/battle1", func_800BB978); +void func_800BB978(void) { + *D_8009A000 = 0xC1; + *D_8009A004 = 0x12C; + *D_8009A008 = 0; + func_8002DA7C(); +} INCLUDE_ASM("asm/us/battle/nonmatchings/battle1", func_800BB9B8); -INCLUDE_ASM("asm/us/battle/nonmatchings/battle1", func_800BB9FC); +void func_800BB9FC(s32 arg0) { + s32 temp_a0; + + *D_8009A000 = 0x2B; + temp_a0 = arg0 & 0xFFFF; + *D_8009A004 = 0x40; + *D_8009A008 = temp_a0; + func_8002DA7C(temp_a0); +} -INCLUDE_ASM("asm/us/battle/nonmatchings/battle1", func_800BBA40); +void func_800BBA40(s32 arg0) { + s32 temp_a0; + + *D_8009A000 = 0x20; + temp_a0 = arg0 & 0xFFFF; + *D_8009A004 = 0x40; + *D_8009A008 = temp_a0; + func_8002DA7C(temp_a0); +} INCLUDE_ASM("asm/us/battle/nonmatchings/battle1", func_800BBA84); @@ -686,7 +723,12 @@ INCLUDE_ASM("asm/us/battle/nonmatchings/battle1", func_800C0254); INCLUDE_ASM("asm/us/battle/nonmatchings/battle1", func_800C0314); -INCLUDE_ASM("asm/us/battle/nonmatchings/battle1", func_800C03B8); +s16 func_800C03B8(s16 arg0, s16 arg1) { + s32 temp_a0; + + temp_a0 = arg0 - arg1; + return SquareRoot0(temp_a0 * temp_a0, arg1); +} s32 func_800C03FC(s32 arg0, s32 arg1) { return arg0 < 0 ? -arg1 : arg1; } @@ -998,6 +1040,8 @@ INCLUDE_ASM("asm/us/battle/nonmatchings/battle1", func_800C59B8); INCLUDE_ASM("asm/us/battle/nonmatchings/battle1", func_800C5ADC); +extern s32 D_800F9DA8; + INCLUDE_ASM("asm/us/battle/nonmatchings/battle1", func_800C5BEC); INCLUDE_ASM("asm/us/battle/nonmatchings/battle1", func_800C5C18); diff --git a/src/battle/battle2.c b/src/battle/battle2.c index 3576e70..53b3f8d 100644 --- a/src/battle/battle2.c +++ b/src/battle/battle2.c @@ -39,6 +39,16 @@ void func_801B0040(s16, u8); void func_801B0054(s16, u8); void func_801B0084(s16, u8); +extern u8 D_800F10EC[]; +extern u8 D_800F11E8[]; +extern u8 D_800F1304[]; +extern s32 D_800F14D4; + +void func_800D6F78(); // extern +void func_800D70C0(); // extern + +void func_800D57C0(); // extern + static s32 func_800C7B60(s16 arg0, s16 nItems, u8* arg2) { BattleModelSub* var_a0; s32 var_a1; @@ -1127,7 +1137,15 @@ INCLUDE_ASM("asm/us/battle/nonmatchings/battle2", func_800D5774); INCLUDE_ASM("asm/us/battle/nonmatchings/battle2", func_800D57C0); -INCLUDE_ASM("asm/us/battle/nonmatchings/battle2", func_800D58D0); +void func_800D58D0(s16 arg0, s16 arg1, s16 arg2) { + Unk80162978* temp_v0; + + temp_v0 = &D_80162978[func_800BBEAC(func_800D57C0)]; + temp_v0->D_80162978 = 0; + temp_v0->D_80162980 = arg0; + temp_v0->D_8016297E = arg2; + temp_v0->D_8016297C = arg1; +} void func_800D5938(); INCLUDE_ASM("asm/us/battle/nonmatchings/battle2", func_800D5938); @@ -1141,7 +1159,11 @@ static void func_800D5A68(s16 arg0, s16 arg1) { temp_v0->D_8016297C = arg0; } -INCLUDE_ASM("asm/us/battle/nonmatchings/battle2", func_800D5AC0); +s32 func_800D5AC0(s32 arg0, s32 arg1) { + return (((s32)(arg0 & 0xFF0000) / arg1) & 0xFF0000) | + (((s32)(arg0 & 0xFF00) / arg1) & 0xFF00) | + (((s32)(arg0 & 0xFF) / arg1) & 0xFF); +} INCLUDE_ASM("asm/us/battle/nonmatchings/battle2", func_800D5B6C); @@ -1155,14 +1177,10 @@ INCLUDE_ASM("asm/us/battle/nonmatchings/battle2", func_800D6394); INCLUDE_ASM("asm/us/battle/nonmatchings/battle2", func_800D650C); -extern u8 D_800F10EC[]; -extern u8 D_800F11E8[]; -extern u8 D_800F1304[]; u8* const D_800A0DC8[] = {D_800F10EC, D_800F11E8, D_800F1304}; INCLUDE_ASM("asm/us/battle/nonmatchings/battle2", func_800D6734); void func_800D6734(s32, s32); -extern s32 D_800F14D4; static void func_800D67BC(s32 arg0) { D_800F14D4 = 0x88; @@ -1196,7 +1214,22 @@ INCLUDE_ASM("asm/us/battle/nonmatchings/battle2", func_800D70C0); INCLUDE_ASM("asm/us/battle/nonmatchings/battle2", func_800D7178); void func_800D72B4(); -INCLUDE_ASM("asm/us/battle/nonmatchings/battle2", func_800D72B4); + +void func_800D72B4(void) { + Unk801621F0* temp_s0; + + temp_s0 = &D_801621F0[D_801590D4]; + if (D_80062D98 == 0) { + if (temp_s0->D_801621F2 == 0) { + func_800D5138(1); + } + if (temp_s0->D_801621F2 == 2) { + func_800D51D4(1); + temp_s0->D_801621F0 = -1; + } + temp_s0->D_801621F2 = (u16)temp_s0->D_801621F2 + 1; + } +} static void func_800D7340(void) { func_800BBEAC(func_800D72B4); } diff --git a/src/battle/battle3.c b/src/battle/battle3.c index 05ea587..7991b22 100644 --- a/src/battle/battle3.c +++ b/src/battle/battle3.c @@ -5,6 +5,26 @@ static void func_800E5358(void); static void func_800E4B88(void); static s32 func_800E4BCC(void); +extern s8 D_800F389D; +extern s8 D_800F38A4; +extern s8 D_800F38A5; +extern s16 D_800F92E2; +extern s16 D_800F92E4; +extern s16 D_800F92E6; +extern s16 D_800F92E8; +extern s16 D_800F92EA; +extern s8 D_800F92EC; +extern s8 D_800F92ED; +extern s8 D_800F92EE; +extern s8 D_800F92EF; +extern s8 D_800F92F0; +extern s8 D_800F92F1; +extern s8 D_800F92F2; +extern s8 D_800F92F3; +extern s8 D_800F977C; + +extern u16 D_800F3124; + void func_800D8A04(void) {} s32 func_800D8A0C(s32 arg0) { return arg0 < 0 ? -arg0 : arg0; } @@ -77,6 +97,9 @@ static void func_800DBF54(void) { func_800269C0(D_80077F64); } static void func_800DBF7C(void) { D_800F3122 = 0; } +extern s32 D_800492FC; +extern s32 D_800F55D8; + INCLUDE_ASM("asm/us/battle/nonmatchings/battle3", func_800DBF8C); INCLUDE_ASM("asm/us/battle/nonmatchings/battle3", func_800DC0CC); @@ -366,6 +389,13 @@ void func_800E084C(void) { INCLUDE_ASM("asm/us/battle/nonmatchings/battle3", func_800E08C4); +extern s32 D_800F1E58; +extern s32 D_800F1E5A; +extern s32 D_800F1E5C; +extern s32 D_800F1E5E; +extern s32 D_800F1E60; +extern s32 D_800F1E62; + INCLUDE_ASM("asm/us/battle/nonmatchings/battle3", func_800E0BE0); static void func_800E0DF4(void) { @@ -502,6 +532,10 @@ s32 func_800E54EC(void) { INCLUDE_ASM("asm/us/battle/nonmatchings/battle3", func_800E5530); +extern s32 D_800F33B0; +extern s32 D_80163778; +extern s32 D_80163B70; + INCLUDE_ASM("asm/us/battle/nonmatchings/battle3", func_800E5814); void func_800E58B0(void) { diff --git a/src/ending/ending.c b/src/ending/ending.c index 003733a..e806cc7 100644 --- a/src/ending/ending.c +++ b/src/ending/ending.c @@ -1,5 +1,11 @@ #include "common.h" +s32 func_80034410(); // extern + +extern s32 D_800A6528; + +extern s32 D_800AF410; + INCLUDE_ASM("asm/us/ending/nonmatchings/ending", func_800A0030); INCLUDE_ASM("asm/us/ending/nonmatchings/ending", func_800A04C4); @@ -32,9 +38,9 @@ INCLUDE_ASM("asm/us/ending/nonmatchings/ending", func_800A19A4); INCLUDE_ASM("asm/us/ending/nonmatchings/ending", func_800A1E20); -INCLUDE_ASM("asm/us/ending/nonmatchings/ending", func_800A1ED4); +void func_800A1ED4(s32 arg0) { D_800A6528 = arg0; } -INCLUDE_ASM("asm/us/ending/nonmatchings/ending", func_800A1EE4); +s32 func_800A1EE4(void) { return 0; } INCLUDE_ASM("asm/us/ending/nonmatchings/ending", func_800A1EEC); @@ -62,7 +68,10 @@ INCLUDE_ASM("asm/us/ending/nonmatchings/ending", func_800A2274); INCLUDE_ASM("asm/us/ending/nonmatchings/ending", func_800A22A4); -INCLUDE_ASM("asm/us/ending/nonmatchings/ending", func_800A22D4); +s32 func_800A22D4(void) { + D_800AF410 = 0; + return 1; +} INCLUDE_ASM("asm/us/ending/nonmatchings/ending", func_800A22E4); diff --git a/src/field/field.c b/src/field/field.c index 0280dd6..f433bf6 100644 --- a/src/field/field.c +++ b/src/field/field.c @@ -41,6 +41,11 @@ static void func_800DA424(s32 val, char* msg_out); static void func_800DA444(s32 val, char* msg_out); static void func_800DA480(s32 val, char* msg_out); +extern MATRIX* D_80083270; +extern MATRIX** D_80083578; +extern u8 D_8009AC2D; +extern u16 D_80114488; + INCLUDE_ASM("asm/us/field/nonmatchings/field", func_800A1368); void func_800A1498(void) { @@ -168,7 +173,16 @@ INCLUDE_ASM("asm/us/field/nonmatchings/field", func_800AAB24); void func_800AB2AC(void) {} -INCLUDE_ASM("asm/us/field/nonmatchings/field", func_800AB2B4); +void func_800AB2B4(void) { + MATRIX* var_v0; + + if ((D_80114488 == 0) || (D_8009AC2D == 1)) { + var_v0 = *D_80083578; + } else { + var_v0 = D_80083270; + } + D_80071E40 = var_v0; +} INCLUDE_ASM("asm/us/field/nonmatchings/field", func_800AB310); @@ -468,7 +482,13 @@ s32 func_800C0B54(void) { return 1; } -INCLUDE_ASM("asm/us/field/nonmatchings/field", func_800C0BE8); +s32 func_800C0BE8(void) { + u16* temp_v0; + + temp_v0 = &D_800831FC[D_800722C4]; + *temp_v0 += 1; + return 1; +} INCLUDE_ASM("asm/us/field/nonmatchings/field", func_800C0C18); diff --git a/src/main/18B8.c b/src/main/18B8.c index 631cf50..974b356 100644 --- a/src/main/18B8.c +++ b/src/main/18B8.c @@ -169,6 +169,14 @@ void func_8001B834(s32); void func_8001BD50(u8, u8, u8); u8 func_8001F6B4(); +extern s32 D_80048D24; // field.X sector +extern u32 D_80048D28; // field.X size + +extern s8 D_8007EAC2; +extern s8 D_8007EAC4; +extern s8 D_8007EB1E; +extern s8 D_8007EB20; + void __main(void) {} INCLUDE_ASM("asm/us/main/nonmatchings/18B8", __SN_ENTRY_POINT); @@ -226,12 +234,21 @@ void func_8001171C(void) { InitGeom(); } -INCLUDE_ASM("asm/us/main/nonmatchings/18B8", func_80011784); +void func_80011784(void) { + SetDefDispEnv(D_8007EB68, 0, 0xE8, 0x140, 0xF0); + SetDefDispEnv(&D_8007EB68[1], 0, 0, 0x140, 0xF0); + SetDefDrawEnv(D_8007EAAC, 0, 8, 0x140, 0xE0); + SetDefDrawEnv(&D_8007EAAC[1], 0, 0xF0, 0x140, 0xE0); + D_8007EAC2 = 1; + D_8007EB1E = 1; + D_8007EAC4 = 0; + D_8007EB20 = 0; + PutDispEnv(D_8007EB68); + PutDrawEnv(D_8007EAAC); +} -void func_800A16CC(); // field loop -void func_800CF60C(); // field load -extern s32 D_80048D24; // field.X sector -extern u32 D_80048D28; // field.X size +void func_800A16CC(); // field loop +void func_800CF60C(); // field load void func_80011860(void) { if (D_800965EC != 5 && D_800965EC != 13) { @@ -482,7 +499,17 @@ void func_80014C70() { D_80062E20 = 0; } -INCLUDE_ASM("asm/us/main/nonmatchings/18B8", func_80014C80); +u8* func_80014C80(s32 arg0) { + s32 temp_v0; + s32 temp_v1; + + temp_v0 = D_80062E1C; + D_80062E1C = temp_v0 + 1; + temp_v1 = D_80062E20; + D_80069490[temp_v0] = (u16)temp_v1; + D_80062E20 = temp_v1 + arg0; + return &D_80063690[temp_v1]; +} s32 func_80014CBC(s32 arg0, s32 arg1) { s32 var_a2; @@ -562,7 +589,7 @@ INCLUDE_ASM("asm/us/main/nonmatchings/18B8", func_800159B0); INCLUDE_ASM("asm/us/main/nonmatchings/18B8", func_80015AFC); -INCLUDE_ASM("asm/us/main/nonmatchings/18B8", func_80015B44); +void func_80015B44(s32 arg0) { D_80062E30 = arg0; } INCLUDE_ASM("asm/us/main/nonmatchings/18B8", func_80015B50); @@ -931,7 +958,10 @@ void SetupGamepad(void) { D_80062FA0 = 0; } -INCLUDE_ASM("asm/us/main/nonmatchings/18B8", func_8001C484); +void func_8001C484(s32 arg0) { + D_80062E9C = arg0; + D_80062E94 = 0x14; +} INCLUDE_ASM("asm/us/main/nonmatchings/18B8", func_8001C498); @@ -1217,11 +1247,35 @@ void func_8001F6E4(s16 arg0, s16 arg1, s16 arg2) { INCLUDE_ASM("asm/us/main/nonmatchings/18B8", func_8001F710); -INCLUDE_ASM("asm/us/main/nonmatchings/18B8", func_8001FA28); +void func_8001FA28(s32 arg0) { + s32 temp_a0; -INCLUDE_ASM("asm/us/main/nonmatchings/18B8", func_8001FA68); + temp_a0 = arg0 & 0xFFFF; + *D_8009A000 = 0x30; + *D_8009A004 = temp_a0; + *D_8009A008 = temp_a0; + func_8002DA7C(temp_a0); +} -INCLUDE_ASM("asm/us/main/nonmatchings/18B8", func_8001FAAC); +void func_8001FA68(s32 arg0) { + s32 temp_a0; + + *D_8009A000 = 0x28; + temp_a0 = arg0 & 0xFFFF; + *D_8009A004 = 0x40; + *D_8009A008 = temp_a0; + func_8002DA7C(temp_a0); +} + +void func_8001FAAC(s32 arg0) { + s32 temp_a0; + + *D_8009A000 = 0x29; + temp_a0 = arg0 & 0xFFFF; + *D_8009A004 = 0x40; + *D_8009A008 = temp_a0; + func_8002DA7C(temp_a0); +} void func_8001FAF0(void) {} @@ -1278,11 +1332,23 @@ void func_80021044(DRAWENV* draw_env, DISPENV* disp_env) { SetDispMask(1); } -INCLUDE_ASM("asm/us/main/nonmatchings/18B8", func_800211B8); +void func_800211B8(s32 arg0) { D_80062DEC = arg0; } INCLUDE_ASM("asm/us/main/nonmatchings/18B8", func_800211C4); -INCLUDE_ASM("asm/us/main/nonmatchings/18B8", func_8002120C); +void func_800211C4(); // extern + +void func_8002120C(s32 arg0) { + s32 temp_v0; + + temp_v0 = D_80062DD4; + D_80062DD4 = arg0; + D_80062DD0 = temp_v0; + if ((arg0 != 0) && + (((u32)(temp_v0 - 3) >= 2U) || ((u32)(arg0 - 3) >= 2U))) { + func_800211C4(); + } +} void func_80021258(s32 arg0) { func_80015248(13, arg0, 8); } diff --git a/src/main/akao.c b/src/main/akao.c index e2d2122..84fe789 100644 --- a/src/main/akao.c +++ b/src/main/akao.c @@ -137,6 +137,8 @@ void func_8002BA08(Unk8002B7E0* arg0); void func_8002B8B4(Unk8002B7E0* arg0); void func_8002B668(Unk8002B7E0* arg0); +extern u16 D_80062FC8; + INCLUDE_ASM("asm/us/main/nonmatchings/akao", func_800293D0); INCLUDE_ASM("asm/us/main/nonmatchings/akao", func_800293F4); @@ -247,8 +249,6 @@ void func_8002B2F8(Unk8002B7E0* arg0) { INCLUDE_ASM("asm/us/main/nonmatchings/akao", func_8002B3B4); -extern u16 D_80062FC8; - void func_8002B5A8(Unk8002B7E0* arg0) { if (D_8009A14E) { D_80062FC8 = arg0->unk10 ? arg0->unk10 : 0x10; diff --git a/src/menu/bginmenu.c b/src/menu/bginmenu.c index 5c6d513..dc61d38 100644 --- a/src/menu/bginmenu.c +++ b/src/menu/bginmenu.c @@ -20,6 +20,9 @@ extern u8 D_801D085C[2]; extern Unk80026448 D_801D0860[]; extern s8 D_801D086B; +extern u8 D_8009C778[]; // Savemap.party +extern u8 D_8009C798[]; // Savemap.party + void func_801D0000(void) { volatile s32 padding; func_80026448(&D_801D0860[0], 0, 0, 1, 3, 0, 0, 1, 3, 0, 0, 0, 1, 0); @@ -52,8 +55,6 @@ static void func_801D01BC(void) {} INCLUDE_ASM("asm/us/menu/nonmatchings/bginmenu", func_801D01C4); #else // -O1 -extern u8 D_8009C778[]; // Savemap.party -extern u8 D_8009C798[]; // Savemap.party s32 func_801D01C4(s32 arg0) { s32 var_a1; s32 var_a2; diff --git a/src/world/world.c b/src/world/world.c index dff8f3b..3469770 100644 --- a/src/world/world.c +++ b/src/world/world.c @@ -163,6 +163,68 @@ static const char D_800A0010[] = "JUMP "; static const char D_800A0018[] = "FROM "; static const char D_800A0020[] = "SCR-H"; +extern s16 D_8010AD44; +extern s16 D_8010AD48; +extern s16 D_8010AD4C; + +extern s32 D_800E5604; +extern s32 D_800E564C; +extern s32 D_800E5650; + +extern s32 D_80109D64; +extern s32 D_80109D68; + +extern s32 D_8010CACC; +extern s32 D_8010CAD0; +extern s32 D_8010CAD4; + +extern s32 D_80116274; + +extern s32 D_8010CA8C; + +extern s16 D_8010CB00; +extern s16 D_8010CB04; +extern s16 D_8010CB08; +extern s16 D_8010CB0C; +extern s16 D_8010CB10; + +extern s32 D_801163D8; +extern s32 D_801163DC; + +extern s16 D_800C68EE; +extern s16 D_800C6902; +extern s16 D_800C6916; +extern s32 D_8010CB14; + +extern s32 D_8010CB18; +extern s32 D_8010CB1C; + +extern s32 D_8010CAF4; + +extern s32 D_800BD144; +extern s32 D_8010CA1C; +extern s32 D_8010CA20; +extern s32 D_8010CA74; +extern s32 D_8010CA78; +extern s32 D_8010CAC0; +extern s32 D_8010CAC4; +extern s32 D_8010CAC8; + +extern s32 D_80109D5C; +extern s32 D_80109D60; + +extern s32 D_8010CB20; + +extern s32 D_80115A58; + +extern s32 D_8010C804; + +extern Unk8010AD3C D_80109D74; +extern Unk8010AD3C* D_8010AD38; +extern Unk8010AD3C* D_8010ADE4; + +s32 func_800AA580(Unk8010AD3C*); // extern + static void func_800A0B40(void) {} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A0B48); @@ -197,7 +259,13 @@ s32 func_800A1D14(void) { return D_800E560C & 0xFFF; } static void func_800A1D24(s32 arg0) { D_800E5608 = arg0 & 0xFFF; } -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A1D38); +void func_800A1D38(s32 arg0) { + s32 temp_a0; + + temp_a0 = arg0 & 0xFFF; + D_800E5608 = temp_a0; + D_800E560C = temp_a0; +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A1D54); @@ -220,7 +288,23 @@ void func_800A2040(void) { static s16 func_800A2078(void) { return D_800E56D8; } -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A2088); +void func_800A2088(s32 arg0) { + s32 temp_v0; + s32 var_v1; + + temp_v0 = D_800E5648; + D_800E5648 = arg0; + D_800E5650 = temp_v0; + if (((u32)arg0 < 2U) && (D_800E5634 != 3)) { + D_800E5608 = 0; + } + var_v1 = 0xA0; + if (D_800E5648 == 0) { + var_v1 = 0x78; + } + D_800E564C = var_v1; + D_800E5604 = -(D_800E5648 != 3) & 0x78; +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A2108); @@ -298,7 +382,9 @@ INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A3F4C); INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A4008); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A4080); +s32 func_800A4080(void) { + return (D_800E5648 & 3) | ((func_800BCA38() * 4) & 0xC); +} void func_800A40B8(s32 arg0) { func_800A2088(arg0 & 3); @@ -424,7 +510,23 @@ static void func_800A7E8C(s32 arg0) { D_80109D6C = arg0; } static void func_800A7E9C(void) {} -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A7EA4); +void func_800A4DDC(); // extern +void func_800A59A0(); // extern +void func_800A60D8(); // extern + +void func_800A7EA4(void) { + func_800A4DDC(); + func_800A59A0(); + func_800A60D8(); + D_80109D54 = 0; + D_80109D58 = 0; + D_80109D5C = 0; + D_80109D60 = 0; + D_800E5828 = 1; + D_80109D64 = 0; + D_80109D68 = 0; + D_80109D6C = 0; +} void func_800A7F18(void) { func_800A7F38(); } @@ -446,7 +548,10 @@ INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A835C); INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A86C4); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A886C); +void func_800A886C(s32 arg0) { + D_80109D64 = 2; + D_80109D68 = arg0; +} void func_800A8888(s32 arg0) { D_800E5824 = arg0; } @@ -464,11 +569,30 @@ INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A8AF4); INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A8B30); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A8C70); +void func_800A8C70(Unk8010AD3C* arg0) { + Unk8010AD3C* temp_v0; + + if ((arg0 != NULL) && (arg0->unk0 == 0)) { + temp_v0 = D_8010AD38; + D_8010AD38 = arg0; + arg0->unk0 = (s32)temp_v0; + } +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A8CA4); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A8CE4); +void func_800A8B30(Unk8010AD40*); // extern + +void func_800A8CE4(void) { + Unk8010AD40* temp_s0; + + temp_s0 = D_8010AD40; + if ((temp_s0 != NULL) && (D_8010AD3C != NULL) && (D_8010AD3C->unk8 == 0)) { + func_800A8B30(temp_s0); + D_8010AD3C->unk8 = (s32)temp_s0; + D_8010AD40 = (Unk8010AD40*)D_8010AD3C; + } +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A8D58); @@ -488,27 +612,93 @@ void func_800A8FA0(void) { } } -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A8FCC); +void func_800A8AF4(s32); // extern + +void func_800A8FCC(void) { + s32 temp_a0; + + if (D_8010AD40 != NULL) { + temp_a0 = D_8010AD40->unk8; + if (temp_a0 != 0) { + func_800A8AF4(temp_a0); + D_8010AD40->unk8 = 0; + } + } +} + +void func_800A9018(void) { + s32 temp_a0; -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A9018); + if (D_8010AD3C != NULL) { + temp_a0 = D_8010AD3C->unk8; + if (temp_a0 != 0) { + func_800A8AF4(temp_a0); + D_8010AD3C->unk8 = 0; + } + } +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A9064); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A90EC); +void func_800A90EC(void) { + if (D_8010AD40 != NULL) { + D_8010AD3C = (Unk8010AD3C*)D_8010AD40; + } +} -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A9110); +void func_800A9110(void) { + if (D_8010AD3C != NULL) { + D_8010AD40 = (Unk8010AD40*)D_8010AD3C; + } +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A9134); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A9154); +s32 func_800A9154(void) { + u8 var_v0; -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A9174); + var_v0 = 0; + if (D_8010AD3C != NULL) { + var_v0 = D_8010AD3C->unk50; + } + return (s32)var_v0; +} + +s32 func_800A9174(void) { + u8 var_v0; + + var_v0 = 0; + if (D_8010AD40 != NULL) { + var_v0 = (u8)D_8010AD40->unk50; + } + return (s32)var_v0; +} Unk8010AD3C* func_800A9194(void) { return D_8010AD3C; } -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A91A4); +s32 func_800A91A4(s32 arg0) { + u8 temp_v1; -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A91E0); + if (D_8010AD40 != NULL) { + temp_v1 = (u8)D_8010AD40->unk50; + if (temp_v1 < 0x20U) { + return (arg0 >> temp_v1) & 1; + } + } + return 0; +} + +s32 func_800A91E0(s32 arg0) { + u8 temp_v1; + + if (D_8010AD3C != NULL) { + temp_v1 = D_8010AD3C->unk50; + if (temp_v1 < 0x20U) { + return (arg0 >> temp_v1) & 1; + } + } + return 0; +} s32 func_800A921C(s32 arg0, u8 arg1) { if (arg1 >= 0x20) { @@ -517,11 +707,37 @@ s32 func_800A921C(s32 arg0, u8 arg1) { return (arg0 >> arg1) & 1; } -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A9240); +s32 func_800A9240(void) { + s32 var_a1; + u8 temp_a0; + + if (D_8010AD40 != NULL) { + temp_a0 = (u8)D_8010AD40->unk50; + var_a1 = 0; + if ((temp_a0 == 4) || (temp_a0 == 0x13) || + ((u32)((u8)D_8010AD40->unk50 - 0x29) < 2U)) { + var_a1 = 1; + } + } else { + var_a1 = 0; + } + return var_a1; +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A929C); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A92F8); +s32 func_800A92F8(s32 arg0) { + s32 temp_v1; + s32 var_a1; + + temp_v1 = arg0 & 0xFF; + var_a1 = 0; + if ((temp_v1 == 4) || (temp_v1 == 0x13) || + ((u32)((arg0 - 0x29) & 0xFF) < 2U)) { + var_a1 = 1; + } + return var_a1; +} static const s32 D_800A01D8[] = {0, 0xF000}; static const s32 D_800A01E0[] = {0, 0}; @@ -549,7 +765,11 @@ INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A97A8); INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A97E4); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A9820); +void func_800A9820(s32 arg0) { + if (D_8010AD3C != NULL) { + D_8010AD3C->unk10 += arg0; + } +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A984C); @@ -563,7 +783,16 @@ INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A9910); INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A993C); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A9988); +void func_800A9988(void) { + s32 temp_v0; + + if (D_8010AD40 != NULL) { + temp_v0 = D_8010AD40->unk4; + if (temp_v0 != 0) { + D_8010AD3C = (Unk8010AD3C*)temp_v0; + } + } +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A99BC); @@ -595,7 +824,17 @@ void func_800A9D5C(s32 arg0) { func_800A9C64(D_8010AD3C, arg0); } void func_800A9D88(s32 arg0) { func_800A9C64(D_8010AD40, arg0); } -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A9DB4); +void func_800A9C64(Unk8010AD40*, s32); // extern + +void func_800A9DB4(s32 arg0) { + func_800A9C64(D_8010AD40, arg0); + if (D_8010AD40 != NULL) { + D_8010AD40->unk1C = D_8010AD40->unkC; + D_8010AD40->unk20 = D_8010AD40->unk10; + D_8010AD40->unk24 = D_8010AD40->unk14; + D_8010AD40->unk28 = D_8010AD40->unk18; + } +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800A9E14); @@ -637,9 +876,27 @@ INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AA304); INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AA580); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AA640); +void func_800AA1B8(); // extern + +s32 func_800AA640(void) { + s32 temp_v0; -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AA684); + temp_v0 = func_800AA580(D_8010AD3C); + if (temp_v0 != 0) { + func_800AA1B8(); + } + return temp_v0; +} + +s32 func_800AA684(void) { + s32 var_v0; + + var_v0 = 0; + if (D_8010AD3C != NULL) { + var_v0 = D_8010AD3C->unk4; + } + return var_v0; +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AA6A4); @@ -647,7 +904,11 @@ INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AA6D0); INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AA7DC); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AA8D8); +void func_800AA8D8(s16 arg0, s16 arg1, s16 arg2) { + D_8010AD44 = arg0; + D_8010AD48 = arg1; + D_8010AD4C = arg2; +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AA8F8); @@ -663,7 +924,28 @@ INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AB48C); INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AB4F4); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AB570); +void func_800AAB18(Unk8010AD3C*); // extern +void func_800AB398(Unk8010AD3C*); // extern + +void func_800AB570(void) { + Unk8010AD3C* var_s0; + Unk8010AD3C* var_s0_2; + + var_s0 = D_8010AD38; + if (var_s0 != NULL) { + do { + func_800AAB18(var_s0); + var_s0 = (Unk8010AD3C*)var_s0->unk0; + } while (var_s0 != NULL); + } + var_s0_2 = D_8010AD38; + if (var_s0_2 != NULL) { + do { + func_800AB398(var_s0_2); + var_s0_2 = (Unk8010AD3C*)var_s0_2->unk0; + } while (var_s0_2 != NULL); + } +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AB5E4); @@ -695,7 +977,24 @@ INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AC700); INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AD63C); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AD788); +void func_800AD63C(Unk8010AD3C*); // extern + +void func_800AD788(void) { + Unk8010AD3C* var_s0; + + D_8010ADE4 = &D_80109D74; + D_8010AD3C = &D_80109D74; + func_800AD63C(&D_80109D74); + var_s0 = D_8010AD38; + if (var_s0 != NULL) { + do { + D_8010AD3C = var_s0; + D_8010ADE4 = var_s0; + func_800AD63C(var_s0); + var_s0 = (Unk8010AD3C*)var_s0->unk0; + } while (var_s0 != NULL); + } +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AD804); @@ -753,9 +1052,23 @@ INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AF110); INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AF1A8); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AF1E8); +void func_800AF1E8(u32 arg0, u32 arg1) { + if ((D_8010B3B8 != NULL) && (arg0 < 0x24U) && (arg1 < 0x1CU)) { + D_8010B3B8->unk0 &= 0x1FFF; + D_8010B3B8->unk8 &= 0x1FFF; + D_8010B3B8->unk0 |= arg0 << 0xD; + D_8010B3B8->unk8 |= arg1 << 0xD; + } +} -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AF24C); +void func_800AF24C(s32 arg0, s32 arg1) { + if (D_8010B3B8 != NULL) { + D_8010B3B8->unk0 &= ~0x1FFF; + D_8010B3B8->unk8 &= ~0x1FFF; + D_8010B3B8->unk0 |= arg0 & 0x1FFF; + D_8010B3B8->unk8 |= arg1 & 0x1FFF; + } +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800AF2A4); @@ -810,7 +1123,14 @@ INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B04AC); INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B0670); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B075C); +void func_800B0670(); // extern + +void func_800B075C(void) { + if (D_8010C804 == 0) { + func_800B0670(); + D_8010C804 = 1; + } +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B0794); @@ -824,7 +1144,19 @@ INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B0D98); INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B0E84); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B104C); +void func_800B104C(void) { + D_8010CA20 = 0; + D_8010CA1C = 0; + D_8010CA78 = 0; + D_8010CA74 = 0; + D_800BD144 = 0; + D_8010CAF0 = 0; + D_8010CA8C = 0; + D_8010CAC8 = 0; + D_8010CAC4 = 0; + D_8010CAC0 = 0; + D_8010CAF4 = 0; +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B10AC); @@ -890,27 +1222,69 @@ INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B2E90); static void func_800B2F94(s32 arg0) { D_8010CAF0 = arg0; } -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B2FA4); +s32 func_800B2FA4(void) { + if (D_8010CA8C != 2) { + return -(D_8010CA8C == 3); + } + return 1; +} -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B2FD0); +s32 func_800B2FD0(void) { + s32 var_v1; -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B3018); + var_v1 = 0; + if ((D_8010CACC != 0) || (D_8010CAD0 != 0) || (D_8010CAD4 != 0)) { + var_v1 = 1; + } + return var_v1; +} -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B3044); +void func_800B3018(void) { + D_8010CAF4 = 1; + if (D_8010CA8C != 1) { + D_8010CA8C = 0; + } +} + +void func_800B3044(s16 arg0) { + D_8010CAFC = arg0; + D_8010CB10 = 0; + D_8010CB0C = 0; + D_8010CB08 = 0; + D_8010CB04 = 0; + D_8010CB00 = 0; +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B307C); static s16 func_800B32F0(void) { return D_8010CAFC; } -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B3300); +void func_800B3300(u32 arg0) { + D_800C68EE = arg0 & 0xFF; + D_800C6902 = (arg0 >> 8) & 0xFF; + D_800C6916 = (arg0 >> 0x10) & 0xFF; + D_8010CB14 = (s32)(arg0 >> 0x18); + D_8010CB1C = 0; + D_8010CB18 = 0; +} -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B3350); +s32 func_800B3350(void) { + return D_800C68EE | (D_800C6902 << 8) | (D_800C6916 << 0x10) | + (D_8010CB14 << 0x18); +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B338C); INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B3418); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B37E0); +void func_800B37E0(s32* arg0, s32* arg1) { + if (arg0 != NULL) { + *arg0 += D_8010CB18; + } + if (arg1 != NULL) { + *arg1 += D_8010CB1C; + } +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B3828); @@ -960,15 +1334,45 @@ void func_800B64A0(void) { func_800B63F0(D_801159E0); } static s32 func_800B64C8(void) { return D_801159E0; } -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B64D8); +void func_800B64D8(s32 arg0) { + *D_8009A000 = 0x30; + *D_8009A004 = arg0; + func_8002DA7C(); +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B650C); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B6570); +void func_800B6570(s32 arg0) { + *D_8009A000 = 0xC0; + *D_8009A004 = arg0; + func_8002DA7C(); +} -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B65A4); +void func_800B65A4(s32 arg0, s32 arg1) { + *D_8009A000 = 0xBD; + *D_8009A004 = arg0; + *D_8009A008 = arg1; + func_8002DA7C(); +} -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B65E0); +void func_800B65E0(s32 arg0) { + if (D_8010CB20 < arg0) { + *D_8009A000 = 0x20; + D_8010CB20 = arg0; + *D_8009A004 = 0x40; + *D_8009A008 = arg0; + goto block_4; + } + if (arg0 == -D_8010CB20) { + D_8010CB20 = 0; + *D_8009A000 = 0xF1; + func_8002DA7C(); + *D_8009A000 = 0xBC; + *D_8009A004 = 0; + block_4: + func_8002DA7C(); + } +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B667C); @@ -1006,7 +1410,12 @@ INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B6E78); INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B6EFC); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B7104); +void func_800B6B28(s16); // extern + +void func_800B7104(s16 arg0) { + D_80115A58 = (s32)arg0; + func_800B6B28(arg0); +} void func_800B7134(void) { func_8003408C(); @@ -1061,7 +1470,11 @@ void func_800B7820(void) { D_8009D2E7 = 0; } -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B7838); +void func_800B7838(void) { + D_8011626C = 2; + D_80116270 = 0; + D_80116274 = 0; +} s32 func_800B785C(void) { return D_8011626C; } @@ -1083,7 +1496,15 @@ u16 func_800B7B3C(void) { return (D_800707BE >> 3) & 1; } INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B7B54); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B7B78); +s32 func_800B7B78(void) { + s32 var_v1; + + var_v1 = D_80062F1B & 0x7F; + if (var_v1 >= 0x11) { + var_v1 *= 2; + } + return var_v1; +} u8 func_800B7BA0(void) { return D_80062F1B >> 7; } @@ -1159,7 +1580,12 @@ INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B8D4C); INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B90C0); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800B95E8); +void func_800B95E8(void) { + *D_8009A000 = 0x30; + *D_8009A004 = 1; + *D_8009A008 = 0x40; + func_8002DA7C(); +} static const char D_800A09AC[] = "No mes data!"; static const char D_800A09BC[] = "mes busy="; @@ -1190,11 +1616,25 @@ INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800BB650); INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800BB7DC); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800BB8B0); +void func_800BB8B0(void) { + D_801163D4 = 0; + D_801163D8 = 0; + D_801163E8 = &D_801163E0; + D_801163EC = 0; + D_801163DC = 0; +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800BB8E8); -INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800BB9A0); +void func_800BB9A0(u8 arg0) { + s8* temp_v1; + + temp_v1 = D_801163E8; + if ((u32)temp_v1 < (u32)&D_801163E8) { + D_801163E8 = temp_v1 + 1; + *temp_v1 = (s8)arg0; + } +} INCLUDE_ASM("asm/us/world/nonmatchings/world", func_800BB9D0);