diff --git a/asm/code_809747C.s b/asm/code_809747C.s index 05ec4f8d..08f7d44e 100644 --- a/asm/code_809747C.s +++ b/asm/code_809747C.s @@ -5,103 +5,5 @@ .text - - thumb_func_start sub_8097504 -sub_8097504: - push {lr} - lsls r0, 16 - asrs r0, 16 - adds r1, r0, 0 - cmp r0, 0x10 - bgt _08097568 - cmp r0, 0xE - bhi _08097580 - lsls r0, 2 - ldr r1, _08097520 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08097520: .4byte _08097524 - .align 2, 0 -_08097524: - .4byte _08097564 - .4byte _08097564 - .4byte _08097560 - .4byte _08097580 - .4byte _08097580 - .4byte _08097564 - .4byte _08097580 - .4byte _08097564 - .4byte _08097580 - .4byte _08097564 - .4byte _08097560 - .4byte _08097560 - .4byte _08097560 - .4byte _08097574 - .4byte _08097564 -_08097560: - movs r0, 0xE - b _08097576 -_08097564: - movs r0, 0xF - b _08097576 -_08097568: - cmp r1, 0x16 - bgt _08097584 - cmp r1, 0x16 - beq _08097584 - cmp r1, 0x15 - beq _08097584 -_08097574: - movs r0, 0x6 -_08097576: - bl sub_80023E4 - lsls r0, 24 - cmp r0, 0 - beq _08097584 -_08097580: - movs r0, 0x1 - b _08097586 -_08097584: - movs r0, 0 -_08097586: - pop {r1} - bx r1 - thumb_func_end sub_8097504 - - thumb_func_start sub_809758C -sub_809758C: - push {lr} - adds r2, r0, 0 - lsls r2, 16 - lsrs r2, 16 - movs r0, 0 - movs r1, 0x2E - bl sub_8001784 - cmp r0, 0 - beq _080975A2 - movs r0, 0x1 -_080975A2: - pop {r1} - bx r1 - thumb_func_end sub_809758C - - thumb_func_start sub_80975A8 -sub_80975A8: - push {lr} - adds r2, r0, 0 - adds r3, r1, 0 - lsls r3, 24 - lsrs r3, 24 - lsls r2, 16 - lsrs r2, 16 - movs r0, 0 - movs r1, 0x2E - bl sub_800199C - pop {r0} - bx r0 - thumb_func_end sub_80975A8 - .align 2,0 diff --git a/asm/code_80A26CC.s b/asm/code_80A26CC.s deleted file mode 100644 index 25bbb299..00000000 --- a/asm/code_80A26CC.s +++ /dev/null @@ -1,277 +0,0 @@ - #include "asm/constants/gba_constants.inc" - #include "asm/macros.inc" - - .syntax unified - - .text - - thumb_func_start sub_80A293C -sub_80A293C: - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x40 - mov r8, r0 - movs r7, 0 - movs r1, 0 - mov r0, sp - adds r0, 0x3E -_080A294E: - strb r1, [r0] - subs r0, 0x1 - cmp r0, sp - bge _080A294E - movs r5, 0 -_080A2958: - lsls r0, r5, 16 - asrs r4, r0, 16 - adds r0, r4, 0 - bl sub_80A2620 - adds r6, r0, 0 - ldrb r0, [r6, 0x11] - cmp r0, 0 - beq _080A2980 - adds r0, r4, 0 - bl sub_8097384 - lsls r0, 24 - cmp r0, 0 - beq _080A2980 - ldrb r0, [r6, 0xC] - mov r2, sp - adds r1, r2, r0 - movs r0, 0x1 - strb r0, [r1] -_080A2980: - adds r5, 0x1 - cmp r5, 0x2D - ble _080A2958 - movs r5, 0 -_080A2988: - mov r1, sp - adds r0, r1, r5 - ldrb r0, [r0] - cmp r0, 0 - beq _080A299A - mov r2, r8 - adds r0, r2, r7 - strb r5, [r0] - adds r7, 0x1 -_080A299A: - adds r5, 0x1 - cmp r5, 0x3E - ble _080A2988 - adds r0, r7, 0 - add sp, 0x40 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80A293C - - thumb_func_start sub_80A29B0 -sub_80A29B0: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x48 - mov r8, r0 - movs r7, 0 - movs r0, 0x2B - add r0, sp - mov r9, r0 - add r1, sp, 0x2C - mov r10, r1 - mov r2, sp - adds r2, 0x2D - str r2, [sp, 0x40] - mov r0, sp - adds r0, 0x2E - str r0, [sp, 0x44] - movs r1, 0 - adds r0, 0x10 -_080A29DA: - strb r1, [r0] - subs r0, 0x1 - cmp r0, sp - bge _080A29DA - movs r0, 0x1 - bl sub_80023E4 - lsls r0, 24 - cmp r0, 0 - beq _080A2A1E - movs r5, 0 -_080A29F0: - lsls r0, r5, 16 - asrs r4, r0, 16 - adds r0, r4, 0 - bl sub_80A2620 - adds r6, r0, 0 - ldrb r0, [r6, 0x11] - cmp r0, 0 - beq _080A2A18 - adds r0, r4, 0 - bl sub_80973F4 - lsls r0, 24 - cmp r0, 0 - beq _080A2A18 - ldrb r0, [r6, 0xC] - mov r2, sp - adds r1, r2, r0 - movs r0, 0x1 - strb r0, [r1] -_080A2A18: - adds r5, 0x1 - cmp r5, 0x2D - ble _080A29F0 -_080A2A1E: - movs r0, 0 - mov r1, r9 - strb r0, [r1] - mov r2, r10 - strb r0, [r2] - ldr r1, [sp, 0x40] - strb r0, [r1] - ldr r2, [sp, 0x44] - strb r0, [r2] - movs r5, 0 -_080A2A32: - mov r1, sp - adds r0, r1, r5 - ldrb r0, [r0] - cmp r0, 0 - beq _080A2A44 - mov r2, r8 - adds r0, r2, r7 - strb r5, [r0] - adds r7, 0x1 -_080A2A44: - adds r5, 0x1 - cmp r5, 0x3E - ble _080A2A32 - adds r0, r7, 0 - add sp, 0x48 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80A29B0 - - thumb_func_start sub_80A2A5C -sub_80A2A5C: - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x40 - mov r8, r0 - movs r7, 0 - movs r1, 0 - mov r0, sp - adds r0, 0x3E -_080A2A6E: - strb r1, [r0] - subs r0, 0x1 - cmp r0, sp - bge _080A2A6E - movs r0, 0x1 - bl sub_80023E4 - lsls r0, 24 - cmp r0, 0 - beq _080A2AC0 - movs r6, 0 -_080A2A84: - lsls r0, r6, 16 - asrs r4, r0, 16 - adds r0, r4, 0 - bl sub_80A2620 - adds r5, r0, 0 - ldrb r0, [r5, 0x11] - cmp r0, 0 - beq _080A2AB8 - adds r0, r4, 0 - bl sub_8097384 - lsls r0, 24 - cmp r0, 0 - bne _080A2AAE - adds r0, r4, 0 - bl sub_80973F4 - lsls r0, 24 - cmp r0, 0 - beq _080A2AB8 -_080A2AAE: - ldrb r0, [r5, 0xC] - mov r2, sp - adds r1, r2, r0 - movs r0, 0x1 - strb r0, [r1] -_080A2AB8: - adds r6, 0x1 - cmp r6, 0x2D - ble _080A2A84 - b _080A2AF0 -_080A2AC0: - movs r6, 0 -_080A2AC2: - lsls r0, r6, 16 - asrs r4, r0, 16 - adds r0, r4, 0 - bl sub_80A2620 - adds r5, r0, 0 - ldrb r0, [r5, 0x11] - cmp r0, 0 - beq _080A2AEA - adds r0, r4, 0 - bl sub_8097384 - lsls r0, 24 - cmp r0, 0 - beq _080A2AEA - ldrb r0, [r5, 0xC] - mov r2, sp - adds r1, r2, r0 - movs r0, 0x1 - strb r0, [r1] -_080A2AEA: - adds r6, 0x1 - cmp r6, 0x2D - ble _080A2AC2 -_080A2AF0: - movs r6, 0 -_080A2AF2: - mov r1, sp - adds r0, r1, r6 - ldrb r0, [r0] - cmp r0, 0 - beq _080A2B04 - mov r2, r8 - adds r0, r2, r7 - strb r6, [r0] - adds r7, 0x1 -_080A2B04: - adds r6, 0x1 - cmp r6, 0x3E - ble _080A2AF2 - adds r0, r7, 0 - add sp, 0x40 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80A2A5C - - thumb_func_start sub_80A2B18 -sub_80A2B18: - lsls r0, 16 - ldr r1, _080A2B24 - asrs r0, 14 - adds r0, r1 - ldr r0, [r0] - bx lr - .align 2, 0 -_080A2B24: .4byte gUnknown_8117000 - thumb_func_end sub_80A2B18 diff --git a/asm/ground_script.s b/asm/ground_script.s index 9d98617b..3f880be4 100644 --- a/asm/ground_script.s +++ b/asm/ground_script.s @@ -7214,7 +7214,7 @@ _080A1792: _080A1794: lsls r4, r5, 16 asrs r0, r4, 16 - bl sub_809758C + bl IsMazeCompleted lsls r0, 24 cmp r0, 0 beq _080A17B6 diff --git a/asm/makuhita_dojo.s b/asm/makuhita_dojo.s index 3e167174..5a707780 100644 --- a/asm/makuhita_dojo.s +++ b/asm/makuhita_dojo.s @@ -508,7 +508,7 @@ _08030362: adds r3, r5, 0 bl sub_8013818 bl sub_80304C8 - bl sub_803053C + bl DrawDojoCourseList movs r0, 0x1 _0803039A: pop {r3} @@ -567,7 +567,7 @@ _080303F2: b _08030410 _08030406: bl sub_80304C8 - bl sub_803053C + bl DrawDojoCourseList movs r0, 0x1 _08030410: pop {r4} @@ -617,7 +617,7 @@ sub_8030444: adds r0, 0x30 bl sub_8013984 bl sub_80304C8 - bl sub_803053C + bl DrawDojoCourseList cmp r4, 0 beq _08030476 ldr r0, [r5] @@ -726,144 +726,4 @@ sub_80304C8: _08030538: .4byte gUnknown_203B31C thumb_func_end sub_80304C8 - thumb_func_start sub_803053C -sub_803053C: - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x108 - ldr r4, _08030658 - ldr r0, [r4] - ldr r0, [r0, 0x64] - bl sub_8008C54 - ldr r0, [r4] - ldr r0, [r0, 0x64] - bl sub_80073B8 - ldr r2, _0803065C - ldr r0, [r4] - ldr r3, [r0, 0x64] - movs r0, 0 - str r0, [sp] - movs r0, 0xA - movs r1, 0 - bl xxx_call_draw_string - ldr r3, [r4] - adds r0, r3, 0 - adds r0, 0xCE - ldrb r0, [r0] - lsls r0, 3 - adds r0, 0x4 - adds r1, r3, 0 - adds r1, 0x4E - movs r5, 0 - ldrsh r2, [r1, r5] - adds r2, 0x1 - movs r1, 0x7 - str r1, [sp] - ldr r1, [r3, 0x64] - str r1, [sp, 0x4] - movs r1, 0 - movs r3, 0x2 - bl sub_8012BC4 - movs r0, 0 - mov r9, r0 - ldr r0, [r4] - adds r0, 0x4A - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r9, r0 - bge _0803063E - mov r8, r4 -_080305A2: - mov r3, r8 - ldr r1, [r3] - adds r0, r1, 0 - adds r0, 0x4E - movs r5, 0 - ldrsh r2, [r0, r5] - subs r0, 0x2 - movs r3, 0 - ldrsh r0, [r0, r3] - muls r0, r2 - add r0, r9 - lsls r0, 1 - adds r1, r0 - movs r5, 0 - ldrsh r4, [r1, r5] - adds r0, r4, 0 - bl sub_80A2740 - lsls r0, 24 - lsrs r7, r0, 24 - adds r0, r4, 0 - bl sub_80A2668 - adds r4, r0, 0 - lsls r4, 16 - asrs r4, 16 - mov r1, r8 - ldr r0, [r1] - adds r0, 0x30 - mov r1, r9 - bl sub_8013800 - adds r6, r0, 0 - movs r5, 0x7 - adds r0, r4, 0 - bl sub_809758C - lsls r0, 24 - cmp r0, 0 - beq _08030608 - mov r3, r8 - ldr r0, [r3] - ldr r3, [r0, 0x64] - movs r0, 0 - str r0, [sp] - movs r0, 0x8 - adds r1, r6, 0 - ldr r2, _08030660 - bl xxx_call_draw_string - movs r5, 0x4 -_08030608: - adds r0, r7, 0 - bl GetDungeonName1 - adds r3, r0, 0 - add r0, sp, 0x8 - ldr r1, _08030664 - adds r2, r5, 0 - bl sprintf_2 - mov r5, r8 - ldr r0, [r5] - ldr r3, [r0, 0x64] - movs r0, 0 - str r0, [sp] - movs r0, 0x10 - adds r1, r6, 0 - add r2, sp, 0x8 - bl xxx_call_draw_string - movs r0, 0x1 - add r9, r0 - ldr r0, [r5] - adds r0, 0x4A - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r9, r0 - blt _080305A2 -_0803063E: - ldr r0, _08030658 - ldr r0, [r0] - ldr r0, [r0, 0x64] - bl sub_80073E0 - add sp, 0x108 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08030658: .4byte gUnknown_203B31C -_0803065C: .4byte gUnknown_80E081C -_08030660: .4byte gUnknown_80E0824 -_08030664: .4byte gUnknown_80E0828 - thumb_func_end sub_803053C - .align 2,0 diff --git a/ld_script.txt b/ld_script.txt index cec10feb..0f039b58 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -311,8 +311,6 @@ SECTIONS { src/code_80972F4.o(.text); asm/code_8097318.o(.text); src/code_809747C.o(.text); - asm/code_809747C.o(.text); - src/code_809747C_1.o(.text); src/code_8097670.o(.text); asm/code_8097670.o(.text); src/code_8097DD0.o(.text); @@ -330,8 +328,6 @@ SECTIONS { src/ground_script.o(.text); asm/ground_script.o(.text); src/code_80A26CC.o(.text); - asm/code_80A26CC.o(.text); - src/code_80A26CC_1.o(.text); asm/code_80A26CC_1.o(.text); src/ground_map.o(.text); asm/ground_map.o(.text); diff --git a/src/code_809747C.c b/src/code_809747C.c index 258b14bf..d0334909 100644 --- a/src/code_809747C.c +++ b/src/code_809747C.c @@ -14,8 +14,17 @@ struct MissionText extern struct MissionText gStoryMissionText[]; extern const u8 gUnknown_8109CC0[]; extern const u8 gDummyScenarioText[]; +extern const char gFinalScenarioText[]; +extern const char gMeetNinetalesText[]; +extern const char gAvoidCaptureText[]; + extern u8 sub_80A270C(); extern void sub_80015C0(u8, u8); +extern u8 sub_80A2728(s16); +extern u8 sub_8001D08(u32, u32 ,s32); +extern u32 sub_8001784(u32, u32, u16); +extern void sub_800199C(u32, u32, u32, u32); +extern u8 sub_80023E4(u32); const u8 *sub_809747C(s16 r0) { @@ -63,3 +72,117 @@ void sub_80974E8(void) void nullsub_208(void) { } + +bool8 sub_8097504(s16 mazeIndex) +{ + s32 mazeIndex_s32; + register s32 mazeIndex_s32_1 asm("r1"); + s32 uVar3; + + mazeIndex_s32 = mazeIndex; + mazeIndex_s32_1 = mazeIndex_s32; + + if(mazeIndex_s32 < 17) + { + switch(mazeIndex_s32) { + case 2: + case 10: + case 11: + case 12: + uVar3 = 14; + break; + case 0: + case 1: + case 5: + case 7: + case 9: + case 14: + uVar3 = 15; + break; + case 3: + case 4: + case 6: + case 8: + return TRUE; + case 13: + uVar3 = 6; + break; + default: + return TRUE; + } + } + else + { + if (mazeIndex_s32_1 > 22) return FALSE; + if (mazeIndex_s32_1 == 22) return FALSE; + if (mazeIndex_s32_1 == 21) return FALSE; + uVar3 = 6; + } + + if (sub_80023E4(uVar3) == 0) { + return FALSE; + } + else { + return TRUE; + } +} + +// TODO: this should probably be bool8 but can't get a match just yet +bool32 IsMazeCompleted(s16 mazeIndex) +{ + bool32 mazeCompletion; + + mazeCompletion = sub_8001784(0, 0x2e, mazeIndex); + if (mazeCompletion) { + mazeCompletion = TRUE; + } + return mazeCompletion; +} + +void sub_80975A8(s16 param_1,u8 param_2) +{ + u16 param_1_u16 = param_1; + sub_800199C(0,0x2e,param_1_u16,param_2); +} + +const u8 *sub_80975C4(s16 r0) +{ + return GetDungeonName1(sub_80A2728(r0)); +} + +const char *sub_80975DC(u32 r0) +{ + // TODO: slight hack but matches + r0 <<= 16; + if((0xffe90000 + r0) >> 16 < 2) + if(sub_8001D08(0x3, 0xE, -1) != 0) + return gMeetNinetalesText; + else + return gAvoidCaptureText; + else + return gFinalScenarioText; +} + +bool8 HasCompletedAllMazes(void) +{ + s32 iVar2; + for(iVar2 = 0; iVar2 < 17; iVar2++) + { + if(!(bool8)IsMazeCompleted(iVar2)) + return FALSE; + } + return TRUE; +} + +u32 sub_8097640(void) +{ + if(sub_8001784(0, 0x2E, 0x1F) == 0 && HasCompletedAllMazes()) + { + sub_800199C(0, 0x2E, 0x1F, 1); + return 1; + } + else + { + return 0; + } +} diff --git a/src/code_809747C_1.c b/src/code_809747C_1.c deleted file mode 100644 index 127ebf8f..00000000 --- a/src/code_809747C_1.c +++ /dev/null @@ -1,54 +0,0 @@ -#include "global.h" -#include "dungeon.h" - -extern u8 sub_80A2728(s16); -extern const char gFinalScenarioText[]; -extern const char gMeetNinetalesText[]; -extern const char gAvoidCaptureText[]; -extern u8 sub_8001D08(u32, u32 ,s32); -extern bool8 sub_809761C(void); -extern u32 sub_8001784(u32, u32, u16); -extern void sub_800199C(u32, u32, u32, u32); -extern bool8 sub_809758C(s16); - -const u8 *sub_80975C4(s16 r0) -{ - return GetDungeonName1(sub_80A2728(r0)); -} - -const char *sub_80975DC(u32 r0) -{ - // TODO: slight hack but matches - r0 <<= 16; - if((0xffe90000 + r0) >> 16 < 2) - if(sub_8001D08(0x3, 0xE, -1) != 0) - return gMeetNinetalesText; - else - return gAvoidCaptureText; - else - return gFinalScenarioText; -} - -bool8 sub_809761C(void) -{ - s32 iVar2; - for(iVar2 = 0; iVar2 < 17; iVar2++) - { - if(!sub_809758C(iVar2)) - return FALSE; - } - return TRUE; -} - -u32 sub_8097640(void) -{ - if(sub_8001784(0, 0x2E, 0x1F) == 0 && sub_809761C()) - { - sub_800199C(0, 0x2E, 0x1F, 1); - return 1; - } - else - { - return 0; - } -} diff --git a/src/code_80A26CC.c b/src/code_80A26CC.c index 7b91ce4a..a15ddcfe 100644 --- a/src/code_80A26CC.c +++ b/src/code_80A26CC.c @@ -5,11 +5,13 @@ extern u8 sub_80023E4(u32); extern u8 sub_80973F4(s16); extern u8 sub_8097384(s16); s16 sub_80A26B8(s16); -extern s16 gUnknown_8116F9A[]; -extern s16 gUnknown_8116F24[]; extern struct unkStruct_80A2608 gUnknown_81168A8[]; extern u8 sub_8098F88(void); -extern void sub_8001658(u32, u32); +extern u32 sub_8001658(u32, u32); + +extern s16 gUnknown_8116F9A[]; +extern s16 gUnknown_8116F24[]; +extern const u8 *gUnknown_8117000[]; u32 sub_80A25AC(u16 param_1) { @@ -288,3 +290,155 @@ u32 sub_80A28F0(u8 r0) } return 0; } + +s32 sub_80A293C(u8 *param_1) +{ + u8 *pcVar2; + struct unkStruct_80A2608 * iVar3; + s32 index; + s32 counter; + u8 local_68 [0x40]; + u8 zero; + + counter = 0; + zero = 0; + + pcVar2 = &local_68[0x3e]; + do { + *pcVar2 = zero; + pcVar2--; + } while ((int)pcVar2 >= (int)local_68); + + + for(index = 0; index < 0x2E; index++) + { + iVar3 = sub_80A2620(index); + if ((iVar3->unk11 != 0) && + (sub_8097384(index) != 0)) { + local_68[iVar3->unkC] = 1; + } + } + + for(index = 0; index < 0x3F; index++) + { + if (local_68[index] != 0) { + param_1[counter] = index; + counter++; + } + } + return counter; +} + +s32 sub_80A29B0(u8 *param_1) +{ + u8 *pcVar2; + struct unkStruct_80A2608 * iVar3; + s32 index; + s32 counter; + u8 *local1; + u8 *local2; + u8 *local3; + u8 *local4; + u8 local_68 [0x40]; + u8 zero; + + counter = 0; + local1 = &local_68[0x2B]; + local2 = &local_68[0x2C]; + local3 = &local_68[0x2D]; + local4 = &local_68[0x2E]; + zero = 0; + + pcVar2 = &local_68[0x3e]; + do { + *pcVar2 = zero; + pcVar2 = pcVar2 + -1; + } while ((int)pcVar2 >= (int)local_68); + + + if (sub_80023E4(1) != 0) { + for(index = 0; index < 0x2E; index++) + { + iVar3 = sub_80A2620(index); + if ((iVar3->unk11 != 0) && + (sub_80973F4(index) != 0)) { + local_68[iVar3->unkC] = 1; + } + } + } + *local1 = 0; + *local2 = 0; + *local3 = 0; + *local4 = 0; + + for(index = 0; index < 0x3F; index++) + { + if (local_68[index] != 0) { + param_1[counter] = index; + counter++; + } + } + return counter; +} + +s32 sub_80A2A5C(u8 *param_1) +{ + u8 *pcVar2; + struct unkStruct_80A2608 *iVar3; + s32 index; + s32 counter; + u8 local_58 [0x40]; + u8 zero; + + counter = 0; + zero = 0; + + pcVar2 = &local_58[0x3E]; + do { + *pcVar2 = zero; + pcVar2--; + } while ((s32)pcVar2 >= (s32)local_58); + + if (sub_80023E4(1) != 0) { + for(index = 0; index < 0x2E; index++) + { + iVar3 = sub_80A2620(index); + if ((iVar3->unk11 != 0) && ((sub_8097384(index) != 0) || (sub_80973F4(index) != 0))) + { + local_58[iVar3->unkC] = 1; + } + } + } + else { + for(index = 0; index < 0x2E; index++) + { + iVar3 = sub_80A2620(index); + if ((iVar3->unk11 != 0) && (sub_8097384(index) != 0)) + { + local_58[iVar3->unkC] = 1; + } + } + } + for(index = 0; index < 0x3F; index++) + { + if (local_58[index] != 0) { + param_1[counter] = index; + counter++; + } + } + return counter; +} + +// Returns Location string for the pause menu +const u8 *sub_80A2B18(s16 param_1) +{ + s32 param_1_s32 = param_1; + const u8 **preload = gUnknown_8117000; + return preload[param_1_s32]; +} + +const u8 *sub_80A2B28(u16 r0) +{ + return sub_80A2B18(sub_8001658(0, 17)); +} + diff --git a/src/code_80A26CC_1.c b/src/code_80A26CC_1.c deleted file mode 100644 index 5693ecdf..00000000 --- a/src/code_80A26CC_1.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "global.h" - -extern u32 sub_8001658(u32, u32); -extern const char *sub_80A2B18(s16); - -const char *sub_80A2B28(u16 r0) -{ - return sub_80A2B18(sub_8001658(0, 17)); -} diff --git a/src/event_flag_1.c b/src/event_flag_1.c index c6d8093d..25d4b35b 100644 --- a/src/event_flag_1.c +++ b/src/event_flag_1.c @@ -7,7 +7,7 @@ #include "rescue_team_info.h" #include "team_inventory.h" -extern u8 sub_809761C(void); +extern bool8 HasCompletedAllMazes(void); extern u8 sub_80973F4(u32); extern u8 _FlagJudge(u32, u32, u32); extern u32 sub_8001658(u32, s32); @@ -562,7 +562,7 @@ u8 sub_80023E4(u32 param_1) case 0x1c: return GetRescueTeamRank() == LUCARIO_RANK; case 0x1d: - return sub_809761C(); + return HasCompletedAllMazes(); default: return 0; } diff --git a/src/makuhita_dojo_1.c b/src/makuhita_dojo_1.c index a76dafe6..822b25a3 100644 --- a/src/makuhita_dojo_1.c +++ b/src/makuhita_dojo_1.c @@ -1,11 +1,13 @@ #include "global.h" +#include "constants/colors.h" +#include "code_800D090.h" +#include "dungeon.h" #include "text.h" struct unkStruct_203B31C { // Size: 0xD0 - u16 unk0[2]; - u8 fill4[0x30 - 0x4]; + s16 unk0[0x17]; u32 unk30; u8 fill34[0x48 - 0x34]; s16 unk48; @@ -26,7 +28,55 @@ extern struct unkStruct_203B31C *gUnknown_203B31C; extern bool8 sub_8097504(s16); extern s16 sub_80A26CC(s16 r0); +extern u8 gUnknown_80E081C[]; +extern u8 gUnknown_80E0824[]; +extern u8 gUnknown_80E0828[]; +extern void sub_8008C54(u32); +extern void sub_80073B8(u32); +extern void sub_80073E0(u32); +extern void xxx_call_draw_string(s32 x, u32 y, u8 *, u32 , u32); +extern void sub_8012BC4(u32 x, u32 y, u32, u32, u32, u32); +extern u8 sub_80A2740(s32 r0); +extern s16 sub_80A2668(u32 r0); +extern s32 sub_8013800(void *, u32); +extern bool8 IsMazeCompleted(s32); +void DrawDojoCourseList(void) +{ + u8 dungeonIndex; + s32 sVar3; + s32 y; + s32 iVar6; + u32 color; + s32 index; + u8 buffer [256]; + + sub_8008C54(gUnknown_203B31C->unk64); + sub_80073B8(gUnknown_203B31C->unk64); + xxx_call_draw_string(10,0,gUnknown_80E081C,gUnknown_203B31C->unk64,0); // Courses + sub_8012BC4(gUnknown_203B31C->unkCC[2] * 8 + 4,0, + gUnknown_203B31C->unk4E + 1,2,7,gUnknown_203B31C->unk64); + index = 0; + if (index < gUnknown_203B31C->unk4A) { + do { + iVar6 = gUnknown_203B31C->unk0[gUnknown_203B31C->unk4E * gUnknown_203B31C->unk4C + index]; + dungeonIndex = sub_80A2740(iVar6); + + sVar3 = sub_80A2668(iVar6); + + y = sub_8013800(&gUnknown_203B31C->unk30, index); + color = 7; // COLOR_WHITE again? + if (IsMazeCompleted(sVar3)) { + xxx_call_draw_string(8,y,gUnknown_80E0824,gUnknown_203B31C->unk64,0); // Draw Star symbol + color = COLOR_GREEN; + } + sprintf_2(buffer,gUnknown_80E0828,color,GetDungeonName1(dungeonIndex)); // "#c%c%s#r" + xxx_call_draw_string(0x10,y,buffer,gUnknown_203B31C->unk64,0); + index++; + } while (index < gUnknown_203B31C->unk4A); + } + sub_80073E0(gUnknown_203B31C->unk64); +} s32 sub_8030668(void) {