From 53724e2b43aa10ae45d995c6ebb3ca890ee954f6 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sun, 1 Mar 2020 00:35:42 -0500 Subject: [PATCH 1/6] Delete asm siirtc data --- data/librtc_rodata.s | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 data/librtc_rodata.s diff --git a/data/librtc_rodata.s b/data/librtc_rodata.s deleted file mode 100644 index 0ed8b9ade..000000000 --- a/data/librtc_rodata.s +++ /dev/null @@ -1,16 +0,0 @@ - .section .rodata - - .asciz "SIIRTC_V001" - - .align 2 - .4byte 0x3001A7E - .4byte 0x3001A7E - .4byte 0x3001A7E - .4byte 0x3001A7E - .4byte 0x3001A7E - .4byte 0x3001A7E - .4byte 0x3001A7E - .4byte 0x3001A7E - .4byte 0x3001A7E - .4byte 0x3001A7E - .4byte GPIOPortDirection From 46370853904b9218422033e83afa5f1b4ab028c6 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 3 Mar 2020 01:36:20 -0500 Subject: [PATCH 2/6] Clarify event ticket flag names --- data/maps/LilycoveCity_Harbor/scripts.inc | 18 +++++++++--------- data/maps/SouthernIsland_Interior/scripts.inc | 2 +- data/scripts/cable_club.inc | 4 ++-- include/constants/flags.h | 11 +++++------ src/record_mixing.c | 2 +- src/script_menu.c | 18 +++++++++--------- 6 files changed, 27 insertions(+), 28 deletions(-) diff --git a/data/maps/LilycoveCity_Harbor/scripts.inc b/data/maps/LilycoveCity_Harbor/scripts.inc index 28e68da9d..023f530fb 100644 --- a/data/maps/LilycoveCity_Harbor/scripts.inc +++ b/data/maps/LilycoveCity_Harbor/scripts.inc @@ -108,12 +108,12 @@ LilycoveCity_Harbor_EventScript_GoToBattleFrontier:: @ 821E171 LilycoveCity_Harbor_EventScript_GetEonTicketState:: @ 821E194 setvar VAR_TEMP_E, 0 - goto_if_unset FLAG_SYS_HAS_EON_TICKET, Common_EventScript_NopReturn + goto_if_unset FLAG_ENABLE_SHIP_SOUTHERN_ISLAND, Common_EventScript_NopReturn checkitem ITEM_EON_TICKET, 1 compare VAR_RESULT, 0 goto_if_eq Common_EventScript_NopReturn setvar VAR_TEMP_E, 1 - goto_if_set FLAG_HAS_EON_TICKET, Common_EventScript_NopReturn + goto_if_set FLAG_SHOWN_EON_TICKET, Common_EventScript_NopReturn setvar VAR_TEMP_E, 2 return @@ -124,7 +124,7 @@ LilycoveCity_Harbor_EventScript_GetAuroraTicketState:: @ 821E1C6 compare VAR_RESULT, 0 goto_if_eq Common_EventScript_NopReturn setvar VAR_TEMP_D, 1 - goto_if_set FLAG_HAS_AURORA_TICKET, Common_EventScript_NopReturn + goto_if_set FLAG_SHOWN_AURORA_TICKET, Common_EventScript_NopReturn setvar VAR_TEMP_D, 2 return @@ -135,7 +135,7 @@ LilycoveCity_Harbor_EventScript_GetOldSeaMapState:: @ 821E1F8 compare VAR_RESULT, 0 goto_if_eq Common_EventScript_NopReturn setvar VAR_TEMP_C, 1 - goto_if_set FLAG_HAS_OLD_SEA_MAP, Common_EventScript_NopReturn + goto_if_set FLAG_SHOWN_OLD_SEA_MAP, Common_EventScript_NopReturn setvar VAR_TEMP_C, 2 return @@ -146,7 +146,7 @@ LilycoveCity_Harbor_EventScript_GetMysticTicketState:: @ 821E22A compare VAR_RESULT, 0 goto_if_eq Common_EventScript_NopReturn setvar VAR_TEMP_9, 1 - goto_if_set FLAG_HAS_MYSTIC_TICKET, Common_EventScript_NopReturn + goto_if_set FLAG_SHOWN_MYSTIC_TICKET, Common_EventScript_NopReturn setvar VAR_TEMP_9, 2 return @@ -207,7 +207,7 @@ LilycoveCity_Harbor_EventScript_SetHasMysticTicket:: @ 821E2EA return LilycoveCity_Harbor_EventScript_EonTicketFirstTime:: @ 821E2F0 - setflag FLAG_HAS_EON_TICKET + setflag FLAG_SHOWN_EON_TICKET msgbox EventTicket_Text_ThatPass, MSGBOX_DEFAULT closemessage call LilycoveCity_Harbor_EventScript_GetEventTicketSailor @@ -224,7 +224,7 @@ LilycoveCity_Harbor_EventScript_GoToSouthernIslandFirstTime:: @ 821E30F end LilycoveCity_Harbor_EventScript_AuroraTicketFirstTime:: @ 821E320 - setflag FLAG_HAS_AURORA_TICKET + setflag FLAG_SHOWN_AURORA_TICKET msgbox EventTicket_Text_ThatPass, MSGBOX_DEFAULT closemessage call LilycoveCity_Harbor_EventScript_GetEventTicketSailor @@ -241,7 +241,7 @@ LilycoveCity_Harbor_EventScript_GoToBirthIslandFirstTime:: @ 821E33F end LilycoveCity_Harbor_EventScript_OldSeaMapFirstTime:: @ 821E350 - setflag FLAG_HAS_OLD_SEA_MAP + setflag FLAG_SHOWN_OLD_SEA_MAP msgbox EventTicket_Text_ShowOldSeaMap, MSGBOX_DEFAULT closemessage call LilycoveCity_Harbor_EventScript_GetEventTicketSailor @@ -290,7 +290,7 @@ LilycoveCity_Harbor_EventScript_GoToFarawayIslandFirstTime:: @ 821E40C end LilycoveCity_Harbor_EventScript_MysticTicketFirstTime:: @ 821E41D - setflag FLAG_HAS_MYSTIC_TICKET + setflag FLAG_SHOWN_MYSTIC_TICKET msgbox EventTicket_Text_ThatPass, MSGBOX_DEFAULT closemessage call LilycoveCity_Harbor_EventScript_GetEventTicketSailor diff --git a/data/maps/SouthernIsland_Interior/scripts.inc b/data/maps/SouthernIsland_Interior/scripts.inc index 78f468dbe..486f00029 100644 --- a/data/maps/SouthernIsland_Interior/scripts.inc +++ b/data/maps/SouthernIsland_Interior/scripts.inc @@ -58,7 +58,7 @@ SouthernIsland_Interior_EventScript_Lati:: @ 8242AD0 goto_if_set FLAG_TEMP_2, SouthernIsland_Interior_EventScript_Sign goto_if_set FLAG_DEFEATED_LATIAS_OR_LATIOS, SouthernIsland_Interior_EventScript_Sign goto_if_set FLAG_CAUGHT_LATIAS_OR_LATIOS, SouthernIsland_Interior_EventScript_Sign - goto_if_unset FLAG_SYS_HAS_EON_TICKET, SouthernIsland_Interior_EventScript_Sign + goto_if_unset FLAG_ENABLE_SHIP_SOUTHERN_ISLAND, SouthernIsland_Interior_EventScript_Sign setflag FLAG_ENCOUNTERED_LATIAS_OR_LATIOS setflag FLAG_TEMP_2 special SpawnCameraObject diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc index d671dc95b..6d5702f74 100644 --- a/data/scripts/cable_club.inc +++ b/data/scripts/cable_club.inc @@ -39,10 +39,10 @@ CableClub_EventScript_DistributeEonTicket:: @ 8276B23 checkitem ITEM_EON_TICKET, 1 compare VAR_RESULT, TRUE goto_if_eq CableClub_EventScript_AlreadyGotEonTicket - goto_if_set FLAG_SYS_HAS_EON_TICKET, CableClub_EventScript_AlreadyGotEonTicket + goto_if_set FLAG_ENABLE_SHIP_SOUTHERN_ISLAND, CableClub_EventScript_AlreadyGotEonTicket msgbox Mevent_Text_TheresATicketForYou, MSGBOX_DEFAULT giveitem ITEM_EON_TICKET - setflag FLAG_SYS_HAS_EON_TICKET + setflag FLAG_ENABLE_SHIP_SOUTHERN_ISLAND setvar VAR_DISTRIBUTE_EON_TICKET, 0 msgbox Mevent_Text_TryUsingItAtLilycovePort, MSGBOX_DEFAULT release diff --git a/include/constants/flags.h b/include/constants/flags.h index e0b383d7b..4dd18880f 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -459,9 +459,9 @@ #define FLAG_DEFEATED_DEOXYS 0x1AC #define FLAG_BATTLED_DEOXYS 0x1AD -#define FLAG_HAS_EON_TICKET 0x1AE -#define FLAG_HAS_AURORA_TICKET 0x1AF -#define FLAG_HAS_OLD_SEA_MAP 0x1B0 +#define FLAG_SHOWN_EON_TICKET 0x1AE +#define FLAG_SHOWN_AURORA_TICKET 0x1AF +#define FLAG_SHOWN_OLD_SEA_MAP 0x1B0 #define FLAG_MOVE_TUTOR_TAUGHT_SWAGGER 0x1B1 #define FLAG_MOVE_TUTOR_TAUGHT_ROLLOUT 0x1B2 #define FLAG_MOVE_TUTOR_TAUGHT_FURY_CUTTER 0x1B3 @@ -506,7 +506,7 @@ #define FLAG_UNUSED_0x1DA 0x1DA // Unused Flag -#define FLAG_HAS_MYSTIC_TICKET 0x1DB +#define FLAG_SHOWN_MYSTIC_TICKET 0x1DB #define FLAG_DEFEATED_HO_OH 0x1DC #define FLAG_DEFEATED_LUGIA 0x1DD @@ -1448,10 +1448,9 @@ #define FLAG_SYS_REGIROCK_PUZZLE_COMPLETED (SYSTEM_FLAGS + 0x50) #define FLAG_SYS_BRAILLE_REGICE_COMPLETED (SYSTEM_FLAGS + 0x51) #define FLAG_SYS_REGISTEEL_PUZZLE_COMPLETED (SYSTEM_FLAGS + 0x52) -#define FLAG_SYS_HAS_EON_TICKET (SYSTEM_FLAGS + 0x53) +#define FLAG_ENABLE_SHIP_SOUTHERN_ISLAND (SYSTEM_FLAGS + 0x53) #define FLAG_LANDMARK_POKEMON_LEAGUE (SYSTEM_FLAGS + 0x54) - #define FLAG_LANDMARK_ISLAND_CAVE (SYSTEM_FLAGS + 0x55) #define FLAG_LANDMARK_DESERT_RUINS (SYSTEM_FLAGS + 0x56) #define FLAG_LANDMARK_FOSSIL_MANIACS_HOUSE (SYSTEM_FLAGS + 0x57) diff --git a/src/record_mixing.c b/src/record_mixing.c index f290c8554..3a93d72f8 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -932,7 +932,7 @@ static void ReceiveGiftItem(u16 *item, u8 which) VarSet(VAR_TEMP_1, *item); StringCopy(gStringVar1, gLinkPlayers[0].name); if (*item == ITEM_EON_TICKET) - FlagSet(FLAG_SYS_HAS_EON_TICKET); + FlagSet(FLAG_ENABLE_SHIP_SOUTHERN_ISLAND); } else { diff --git a/src/script_menu.c b/src/script_menu.c index 7afe30080..9ff63e357 100644 --- a/src/script_menu.c +++ b/src/script_menu.c @@ -428,7 +428,7 @@ static void CreateLilycoveSSTidalMultichoice(void) } } - if (CheckBagHasItem(ITEM_EON_TICKET, 1) == TRUE && FlagGet(FLAG_SYS_HAS_EON_TICKET) == TRUE) + if (CheckBagHasItem(ITEM_EON_TICKET, 1) == TRUE && FlagGet(FLAG_ENABLE_SHIP_SOUTHERN_ISLAND) == TRUE) { if (gSpecialVar_0x8004 == 0) { @@ -436,11 +436,11 @@ static void CreateLilycoveSSTidalMultichoice(void) selectionCount++; } - if (gSpecialVar_0x8004 == 1 && FlagGet(FLAG_HAS_EON_TICKET) == FALSE) + if (gSpecialVar_0x8004 == 1 && FlagGet(FLAG_SHOWN_EON_TICKET) == FALSE) { sLilycoveSSTidalSelections[selectionCount] = SSTIDAL_SELECTION_SOUTHERN_ISLAND; selectionCount++; - FlagSet(FLAG_HAS_EON_TICKET); + FlagSet(FLAG_SHOWN_EON_TICKET); } } @@ -452,11 +452,11 @@ static void CreateLilycoveSSTidalMultichoice(void) selectionCount++; } - if (gSpecialVar_0x8004 == 1 && FlagGet(FLAG_HAS_MYSTIC_TICKET) == FALSE) + if (gSpecialVar_0x8004 == 1 && FlagGet(FLAG_SHOWN_MYSTIC_TICKET) == FALSE) { sLilycoveSSTidalSelections[selectionCount] = SSTIDAL_SELECTION_NAVEL_ROCK; selectionCount++; - FlagSet(FLAG_HAS_MYSTIC_TICKET); + FlagSet(FLAG_SHOWN_MYSTIC_TICKET); } } @@ -468,11 +468,11 @@ static void CreateLilycoveSSTidalMultichoice(void) selectionCount++; } - if (gSpecialVar_0x8004 == 1 && FlagGet(FLAG_HAS_AURORA_TICKET) == FALSE) + if (gSpecialVar_0x8004 == 1 && FlagGet(FLAG_SHOWN_AURORA_TICKET) == FALSE) { sLilycoveSSTidalSelections[selectionCount] = SSTIDAL_SELECTION_BIRTH_ISLAND; selectionCount++; - FlagSet(FLAG_HAS_AURORA_TICKET); + FlagSet(FLAG_SHOWN_AURORA_TICKET); } } @@ -484,11 +484,11 @@ static void CreateLilycoveSSTidalMultichoice(void) selectionCount++; } - if (gSpecialVar_0x8004 == 1 && FlagGet(FLAG_HAS_OLD_SEA_MAP) == FALSE) + if (gSpecialVar_0x8004 == 1 && FlagGet(FLAG_SHOWN_OLD_SEA_MAP) == FALSE) { sLilycoveSSTidalSelections[selectionCount] = SSTIDAL_SELECTION_FARAWAY_ISLAND; selectionCount++; - FlagSet(FLAG_HAS_OLD_SEA_MAP); + FlagSet(FLAG_SHOWN_OLD_SEA_MAP); } } From b6c9ad505ddac0936aa3365dfdd2f834b7aeda51 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 3 Mar 2020 14:47:14 -0500 Subject: [PATCH 3/6] Minor fixes in trainer_battle.inc --- data/scripts/trainer_battle.inc | 9 ++++----- include/event_scripts.h | 2 +- src/battle_setup.c | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/data/scripts/trainer_battle.inc b/data/scripts/trainer_battle.inc index d609fcc93..aa96e7b35 100644 --- a/data/scripts/trainer_battle.inc +++ b/data/scripts/trainer_battle.inc @@ -44,7 +44,7 @@ EventScript_NotEnoughMonsForDoubleBattle:: @ 82713BA EventScript_NoDoubleTrainerBattle:: @ 82713C1 gotopostbattlescript -EventScript_DoTainerBattle:: @ 82713C2 +EventScript_DoNoIntroTrainerBattle:: @ 82713C2 applymovement VAR_LAST_TALKED, Movement_RevealTrainer waitmovement 0 special SetUpTrainerEncounterMusic @@ -54,7 +54,7 @@ EventScript_DoTainerBattle:: @ 82713C2 EventScript_TryDoRematchBattle:: @ 82713D1 call EventScript_RevealTrainer specialvar VAR_RESULT, IsTrainerReadyForRematch - compare VAR_RESULT, 0 + compare VAR_RESULT, FALSE goto_if_eq EventScript_NoRematchTrainerBattle special SetUpTrainerEncounterMusic special SetUpTrainerMovement @@ -70,7 +70,7 @@ EventScript_NoRematchTrainerBattle:: @ 82713F7 EventScript_TryDoDoubleRematchBattle:: @ 82713F8 specialvar VAR_RESULT, IsTrainerReadyForRematch - compare VAR_RESULT, 0 + compare VAR_RESULT, FALSE goto_if_eq EventScript_NoDoubleRematchTrainerBattle special HasEnoughMonsForDoubleBattle compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS @@ -113,7 +113,7 @@ EventScript_ShowTrainerIntroMsg:: @ 827143C EventScript_DoTrainerBattle:: @ 8271454 trainerbattlebegin - @ Pointless check, possibly used for debugging? + @ Below battle mode check only needed in FRLG specialvar VAR_RESULT, GetTrainerBattleMode compare VAR_RESULT, TRAINER_BATTLE_SINGLE goto_if_eq EventScript_EndTrainerBattle @@ -125,7 +125,6 @@ EventScript_DoTrainerBattle:: @ 8271454 goto_if_eq EventScript_EndTrainerBattle compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC goto_if_eq EventScript_EndTrainerBattle - EventScript_EndTrainerBattle:: @ 8271491 gotobeatenscript releaseall diff --git a/include/event_scripts.h b/include/event_scripts.h index a56ab89e0..d147dd4f1 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -4,7 +4,7 @@ extern const u8 EventScript_TestSignpostMsg[]; extern const u8 EventScript_TryGetTrainerScript[]; extern const u8 EventScript_271354[]; -extern const u8 EventScript_DoTainerBattle[]; +extern const u8 EventScript_DoNoIntroTrainerBattle[]; extern const u8 EventScript_TryDoDoubleTrainerBattle[]; extern const u8 EventScript_TryDoNormalTrainerBattle[]; extern const u8 EventScript_TryDoDoubleRematchBattle[]; diff --git a/src/battle_setup.c b/src/battle_setup.c index eff57eae3..b44c7b9ec 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -1087,7 +1087,7 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data) { case TRAINER_BATTLE_SINGLE_NO_INTRO_TEXT: TrainerBattleLoadArgs(sOrdinaryNoIntroBattleParams, data); - return EventScript_DoTainerBattle; + return EventScript_DoNoIntroTrainerBattle; case TRAINER_BATTLE_DOUBLE: TrainerBattleLoadArgs(sDoubleBattleParams, data); SetMapVarsToTrainer(); From 32520c80e90b77981da0c921fd81a1937ca010d4 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 3 Mar 2020 16:29:57 -0500 Subject: [PATCH 4/6] Celebratory change to calcrom.pl --- .travis/calcrom/calcrom.pl | 43 +++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/.travis/calcrom/calcrom.pl b/.travis/calcrom/calcrom.pl index 1bc8bc74b..4858babb9 100755 --- a/.travis/calcrom/calcrom.pl +++ b/.travis/calcrom/calcrom.pl @@ -125,19 +125,42 @@ my $docPct = sprintf("%.4f", 100 * $documented / $total_syms); my $partialPct = sprintf("%.4f", 100 * $partial_documented / $total_syms); my $undocPct = sprintf("%.4f", 100 * $undocumented / $total_syms); -print "$total total bytes of code\n"; -print "$src bytes of code in src ($srcPct%)\n"; -print "$asm bytes of code in asm ($asmPct%)\n"; +if ($asm == 0) +{ + print "Code decompilation is 100% complete\n" +} +else +{ + print "$total total bytes of code\n"; + print "$src bytes of code in src ($srcPct%)\n"; + print "$asm bytes of code in asm ($asmPct%)\n"; +} print "\n"; -print "$total_syms total symbols\n"; -print "$documented symbols documented ($docPct%)\n"; -print "$partial_documented symbols partially documented ($partialPct%)\n"; -print "$undocumented symbols undocumented ($undocPct%)\n"; + +if ($partial_documented == 0 && $undocumented == 0) +{ + print "Documentation is 100% complete\n" +} +else +{ + print "$total_syms total symbols\n"; + print "$documented symbols documented ($docPct%)\n"; + print "$partial_documented symbols partially documented ($partialPct%)\n"; + print "$undocumented symbols undocumented ($undocPct%)\n"; +} print "\n"; my $dataTotal = $srcdata + $data; my $srcDataPct = sprintf("%.4f", 100 * $srcdata / $dataTotal); my $dataPct = sprintf("%.4f", 100 * $data / $dataTotal); -print "$dataTotal total bytes of data\n"; -print "$srcdata bytes of data in src ($srcDataPct%)\n"; -print "$data bytes of data in data ($dataPct%)\n"; + +if ($data == 0) +{ + print "Data porting to C is 100% complete\n" +} +else +{ + print "$dataTotal total bytes of data\n"; + print "$srcdata bytes of data in src ($srcDataPct%)\n"; + print "$data bytes of data in data ($dataPct%)\n"; +} From 69aff34afd58d5770c070d14b016fb30f304b59c Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Fri, 6 Mar 2020 05:25:31 +0800 Subject: [PATCH 5/6] sub_8027E30 --- src/dodrio_berry_picking.c | 449 ++----------------------------------- 1 file changed, 16 insertions(+), 433 deletions(-) diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index 958922067..40074e0af 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -2770,22 +2770,22 @@ struct UnkPacket2 u8 id; u8 unk1_0:4; u8 unk1_1:4; - u8 unk2_0:4; - u8 unk2_1:4; - u8 unk3_0:4; - u8 unk3_1:4; - u8 unk4_0:4; - u8 unk4_1:4; - u8 unk5_0:4; - u8 unk5_1:4; - u8 unk6_0:2; - u8 unk6_1:2; - u8 unk6_2:2; - u8 unk6_3:2; - u8 unk7_0:2; - u8 unk7_1:2; - u8 unk7_2:2; - u8 unk7_3:2; + u16 unk2_0:4; + u16 unk2_1:4; + u16 unk3_0:4; + u16 unk3_1:4; + u16 unk4_0:4; + u16 unk4_1:4; + u16 unk5_0:4; + u16 unk5_1:4; + u16 unk6_0:2; + u16 unk6_1:2; + u16 unk6_2:2; + u16 unk6_3:2; + u16 unk7_0:2; + u16 unk7_1:2; + u16 unk7_2:2; + u16 unk7_3:2; u8 unk8_0:2; u8 unk8_1:2; u8 unk8_2:2; @@ -2808,7 +2808,6 @@ struct UnkPacket2 u8 unkB_6:1; }; -#ifdef NONMATCHING static void sub_8027E30(struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 arg6, u32 arg7, u32 arg8) { struct UnkPacket2 packet; @@ -2860,422 +2859,6 @@ static void sub_8027E30(struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruc packet.unkB_0 = arg8; sub_800FE50(&packet); } -#else -NAKED -static void sub_8027E30(struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 arg6, u32 arg7, u32 arg8) -{ - asm_unified(" push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, 0x20\n\ - ldr r4, [sp, 0x48]\n\ - lsls r4, 24\n\ - str r4, [sp, 0x1C]\n\ - movs r4, 0x14\n\ - adds r4, r0\n\ - mov r9, r4\n\ - mov r5, sp\n\ - movs r4, 0x2\n\ - strb r4, [r5]\n\ - mov r10, sp\n\ - mov r5, r9\n\ - ldrb r4, [r5, 0xB]\n\ - movs r7, 0xF\n\ - adds r5, r7, 0\n\ - ands r5, r4\n\ - mov r6, r10\n\ - ldrb r6, [r6, 0x1]\n\ - mov r8, r6\n\ - movs r4, 0x10\n\ - negs r4, r4\n\ - mov r6, r8\n\ - ands r4, r6\n\ - orrs r4, r5\n\ - mov r5, r10\n\ - strb r4, [r5, 0x1]\n\ - mov r8, sp\n\ - mov r6, r9\n\ - ldrb r5, [r6, 0xC]\n\ - lsls r5, 4\n\ - ands r4, r7\n\ - orrs r4, r5\n\ - mov r5, r8\n\ - strb r4, [r5, 0x1]\n\ - ldrb r5, [r6, 0xD]\n\ - movs r6, 0xF\n\ - ands r5, r6\n\ - mov r4, r10\n\ - ldrb r4, [r4, 0x2]\n\ - mov r8, r4\n\ - movs r4, 0x10\n\ - negs r4, r4\n\ - mov r6, r8\n\ - ands r4, r6\n\ - orrs r4, r5\n\ - mov r5, r10\n\ - strb r4, [r5, 0x2]\n\ - mov r8, sp\n\ - mov r6, r9\n\ - ldrb r5, [r6, 0xE]\n\ - lsls r5, 4\n\ - ands r4, r7\n\ - orrs r4, r5\n\ - mov r5, r8\n\ - strb r4, [r5, 0x2]\n\ - ldrb r5, [r6, 0xF]\n\ - movs r6, 0xF\n\ - ands r5, r6\n\ - mov r4, r10\n\ - ldrb r4, [r4, 0x3]\n\ - mov r8, r4\n\ - movs r4, 0x10\n\ - negs r4, r4\n\ - mov r6, r8\n\ - ands r4, r6\n\ - orrs r4, r5\n\ - mov r5, r10\n\ - strb r4, [r5, 0x3]\n\ - mov r8, sp\n\ - mov r6, r9\n\ - ldrb r5, [r6, 0x10]\n\ - lsls r5, 4\n\ - ands r4, r7\n\ - orrs r4, r5\n\ - mov r5, r8\n\ - strb r4, [r5, 0x3]\n\ - ldrb r5, [r6, 0x11]\n\ - movs r6, 0xF\n\ - ands r5, r6\n\ - mov r4, r10\n\ - ldrb r4, [r4, 0x4]\n\ - mov r8, r4\n\ - movs r4, 0x10\n\ - negs r4, r4\n\ - mov r6, r8\n\ - ands r4, r6\n\ - orrs r4, r5\n\ - mov r5, r10\n\ - strb r4, [r5, 0x4]\n\ - mov r8, sp\n\ - mov r6, r9\n\ - ldrb r5, [r6, 0x12]\n\ - lsls r5, 4\n\ - ands r4, r7\n\ - orrs r4, r5\n\ - mov r5, r8\n\ - strb r4, [r5, 0x4]\n\ - ldrb r4, [r6, 0x13]\n\ - movs r6, 0xF\n\ - ands r4, r6\n\ - mov r6, r8\n\ - ldrb r5, [r6, 0x5]\n\ - movs r6, 0x10\n\ - negs r6, r6\n\ - ands r6, r5\n\ - orrs r6, r4\n\ - str r6, [sp, 0xC]\n\ - mov r4, r8\n\ - strb r6, [r4, 0x5]\n\ - mov r5, sp\n\ - mov r6, r9\n\ - ldrb r4, [r6, 0x14]\n\ - lsls r4, 4\n\ - ldr r6, [sp, 0xC]\n\ - ands r6, r7\n\ - orrs r6, r4\n\ - strb r6, [r5, 0x5]\n\ - mov r7, sp\n\ - movs r4, 0x3\n\ - mov r8, r4\n\ - ldrb r0, [r0, 0x14]\n\ - mov r5, r8\n\ - ands r0, r5\n\ - ldrb r5, [r7, 0x6]\n\ - movs r6, 0x4\n\ - negs r6, r6\n\ - mov r10, r6\n\ - mov r4, r10\n\ - ands r4, r5\n\ - orrs r4, r0\n\ - strb r4, [r7, 0x6]\n\ - mov r5, r9\n\ - ldrb r0, [r5, 0x1]\n\ - mov r6, r8\n\ - ands r0, r6\n\ - lsls r0, 2\n\ - movs r5, 0xD\n\ - negs r5, r5\n\ - ands r5, r4\n\ - orrs r5, r0\n\ - strb r5, [r7, 0x6]\n\ - mov r0, r9\n\ - ldrb r4, [r0, 0x2]\n\ - ands r4, r6\n\ - lsls r4, 4\n\ - movs r0, 0x31\n\ - negs r0, r0\n\ - ands r0, r5\n\ - orrs r0, r4\n\ - strb r0, [r7, 0x6]\n\ - mov r5, sp\n\ - mov r6, r9\n\ - ldrb r4, [r6, 0x3]\n\ - lsls r4, 6\n\ - movs r6, 0x3F\n\ - ands r0, r6\n\ - orrs r0, r4\n\ - strb r0, [r5, 0x6]\n\ - mov r4, r9\n\ - ldrb r0, [r4, 0x4]\n\ - mov r5, r8\n\ - ands r0, r5\n\ - ldrb r5, [r7, 0x7]\n\ - mov r4, r10\n\ - ands r4, r5\n\ - orrs r4, r0\n\ - strb r4, [r7, 0x7]\n\ - mov r6, r9\n\ - ldrb r0, [r6, 0x5]\n\ - mov r5, r8\n\ - ands r0, r5\n\ - lsls r0, 2\n\ - movs r5, 0xD\n\ - negs r5, r5\n\ - ands r5, r4\n\ - orrs r5, r0\n\ - strb r5, [r7, 0x7]\n\ - ldrb r4, [r6, 0x6]\n\ - mov r6, r8\n\ - ands r4, r6\n\ - lsls r4, 4\n\ - movs r0, 0x31\n\ - negs r0, r0\n\ - ands r0, r5\n\ - orrs r0, r4\n\ - strb r0, [r7, 0x7]\n\ - mov r5, sp\n\ - mov r6, r9\n\ - ldrb r4, [r6, 0x7]\n\ - lsls r4, 6\n\ - movs r6, 0x3F\n\ - ands r0, r6\n\ - orrs r0, r4\n\ - strb r0, [r5, 0x7]\n\ - mov r8, sp\n\ - mov r0, r9\n\ - ldrb r4, [r0, 0x8]\n\ - movs r7, 0x3\n\ - adds r0, r7, 0\n\ - ands r0, r4\n\ - mov r4, r8\n\ - ldrb r5, [r4, 0x8]\n\ - mov r4, r10\n\ - ands r4, r5\n\ - orrs r4, r0\n\ - mov r5, r8\n\ - strb r4, [r5, 0x8]\n\ - mov r6, r9\n\ - ldrb r5, [r6, 0x9]\n\ - adds r0, r7, 0\n\ - ands r0, r5\n\ - lsls r0, 2\n\ - movs r5, 0xD\n\ - negs r5, r5\n\ - ands r5, r4\n\ - orrs r5, r0\n\ - mov r0, r8\n\ - strb r5, [r0, 0x8]\n\ - ldrb r0, [r1]\n\ - adds r4, r7, 0\n\ - ands r4, r0\n\ - lsls r4, 4\n\ - movs r0, 0x31\n\ - negs r0, r0\n\ - ands r0, r5\n\ - orrs r0, r4\n\ - mov r4, r8\n\ - strb r0, [r4, 0x8]\n\ - mov r5, sp\n\ - ldrb r4, [r2]\n\ - lsls r4, 6\n\ - movs r6, 0x3F\n\ - ands r0, r6\n\ - orrs r0, r4\n\ - strb r0, [r5, 0x8]\n\ - ldrb r4, [r3]\n\ - adds r0, r7, 0\n\ - ands r0, r4\n\ - ldrb r4, [r5, 0x9]\n\ - mov r6, r10\n\ - ands r6, r4\n\ - orrs r6, r0\n\ - mov r10, r6\n\ - strb r6, [r5, 0x9]\n\ - ldr r0, [sp, 0x40]\n\ - ldrb r4, [r0]\n\ - adds r0, r7, 0\n\ - ands r0, r4\n\ - lsls r0, 2\n\ - movs r4, 0xD\n\ - negs r4, r4\n\ - ands r6, r4\n\ - orrs r6, r0\n\ - str r6, [sp, 0x10]\n\ - strb r6, [r5, 0x9]\n\ - mov r4, sp\n\ - ldr r5, [sp, 0x44]\n\ - ldrb r0, [r5]\n\ - adds r6, r7, 0\n\ - ands r6, r0\n\ - lsls r0, r6, 4\n\ - subs r7, 0x34\n\ - ldr r5, [sp, 0x10]\n\ - ands r7, r5\n\ - orrs r7, r0\n\ - strb r7, [r4, 0x9]\n\ - mov r5, sp\n\ - ldrb r0, [r1, 0x4]\n\ - movs r6, 0x1\n\ - mov r12, r6\n\ - mov r4, r12\n\ - ands r4, r0\n\ - lsls r4, 6\n\ - movs r0, 0x41\n\ - negs r0, r0\n\ - mov r10, r0\n\ - ands r0, r7\n\ - orrs r0, r4\n\ - strb r0, [r5, 0x9]\n\ - ldrb r4, [r2, 0x4]\n\ - lsls r4, 7\n\ - movs r5, 0x7F\n\ - ands r0, r5\n\ - orrs r0, r4\n\ - mov r4, r8\n\ - strb r0, [r4, 0x9]\n\ - ldrb r4, [r3, 0x4]\n\ - mov r0, r12\n\ - ands r0, r4\n\ - mov r5, r8\n\ - ldrb r4, [r5, 0xA]\n\ - movs r7, 0x2\n\ - negs r7, r7\n\ - adds r5, r7, 0\n\ - ands r5, r4\n\ - orrs r5, r0\n\ - mov r6, r8\n\ - strb r5, [r6, 0xA]\n\ - mov r9, sp\n\ - ldr r4, [sp, 0x40]\n\ - ldrb r0, [r4, 0x4]\n\ - mov r4, r12\n\ - ands r4, r0\n\ - lsls r4, 1\n\ - movs r6, 0x3\n\ - negs r6, r6\n\ - mov r8, r6\n\ - mov r0, r8\n\ - ands r0, r5\n\ - orrs r0, r4\n\ - mov r4, r9\n\ - strb r0, [r4, 0xA]\n\ - ldr r6, [sp, 0x44]\n\ - ldrb r5, [r6, 0x4]\n\ - mov r4, r12\n\ - ands r4, r5\n\ - lsls r4, 2\n\ - movs r5, 0x5\n\ - negs r5, r5\n\ - ands r0, r5\n\ - orrs r0, r4\n\ - mov r4, r9\n\ - strb r0, [r4, 0xA]\n\ - mov r4, sp\n\ - ldrb r1, [r1, 0x8]\n\ - mov r0, r12\n\ - ands r0, r1\n\ - lsls r0, 2\n\ - ldrb r1, [r4, 0xB]\n\ - ands r5, r1\n\ - orrs r5, r0\n\ - strb r5, [r4, 0xB]\n\ - ldrb r1, [r2, 0x8]\n\ - mov r0, r12\n\ - ands r0, r1\n\ - lsls r0, 3\n\ - movs r1, 0x9\n\ - negs r1, r1\n\ - ands r1, r5\n\ - orrs r1, r0\n\ - strb r1, [r4, 0xB]\n\ - ldrb r2, [r3, 0x8]\n\ - mov r0, r12\n\ - ands r0, r2\n\ - lsls r0, 4\n\ - movs r2, 0x11\n\ - negs r2, r2\n\ - ands r2, r1\n\ - orrs r2, r0\n\ - strb r2, [r4, 0xB]\n\ - mov r3, sp\n\ - ldr r5, [sp, 0x40]\n\ - ldrb r0, [r5, 0x8]\n\ - mov r1, r12\n\ - ands r1, r0\n\ - lsls r1, 5\n\ - movs r0, 0x21\n\ - negs r0, r0\n\ - ands r0, r2\n\ - orrs r0, r1\n\ - strb r0, [r3, 0xB]\n\ - mov r2, sp\n\ - ldrb r1, [r6, 0x8]\n\ - mov r6, r12\n\ - ands r6, r1\n\ - lsls r1, r6, 6\n\ - mov r3, r10\n\ - ands r0, r3\n\ - orrs r0, r1\n\ - strb r0, [r2, 0xB]\n\ - ldr r4, [sp, 0x1C]\n\ - lsrs r3, r4, 21\n\ - ldrb r1, [r2, 0xA]\n\ - movs r0, 0x7\n\ - ands r0, r1\n\ - orrs r0, r3\n\ - strb r0, [r2, 0xA]\n\ - mov r1, sp\n\ - ldr r5, [sp, 0x4C]\n\ - movs r6, 0x1\n\ - ands r5, r6\n\ - lsls r2, r5, 1\n\ - ldrb r0, [r1, 0xB]\n\ - mov r3, r8\n\ - ands r3, r0\n\ - orrs r3, r2\n\ - mov r8, r3\n\ - strb r3, [r1, 0xB]\n\ - mov r0, sp\n\ - ldr r4, [sp, 0x50]\n\ - ands r4, r6\n\ - mov r5, r8\n\ - ands r5, r7\n\ - orrs r5, r4\n\ - strb r5, [r0, 0xB]\n\ - bl sub_800FE50\n\ - add sp, 0x20\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ -"); -} -#endif static u32 sub_8028164(u32 unused, struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 *arg6, u32 *arg7, u32 *arg8) { From 93f0bff49cab5fd2f77459bd9b746470d0b37d2c Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Fri, 6 Mar 2020 06:59:32 +0800 Subject: [PATCH 6/6] sub_8021A28 --- src/berry_crush.c | 502 ++++------------------------------------------ 1 file changed, 41 insertions(+), 461 deletions(-) diff --git a/src/berry_crush.c b/src/berry_crush.c index 49810f3b4..542888631 100755 --- a/src/berry_crush.c +++ b/src/berry_crush.c @@ -1400,495 +1400,75 @@ void sub_80219C8(u8 windowId, u8 left, u8 colorId, const u8 *string) AddTextPrinterParameterized3(windowId, 2, left, 0, sBerryCrushTextColorTable[colorId], 0, string); } -#ifdef NONMATCHING -void sub_8021A28(struct BerryCrushGame *sp0C, u8 sp10, u8 sp14, u8 r3) +void sub_8021A28(struct BerryCrushGame * sp0C, u8 sp10, u8 sp14, u8 sp18) { - s32 r6; - u8 i, j; - u8 sp18 = 0; + u8 r8; u8 sp1C = 0; - union BerryCrushGame_68 *sp20 = &sp0C->unk68; + u8 sp20 = 0; + u8 r2; + s32 r3; + u8 r7; + union BerryCrushGame_68 * sp24 = &sp0C->unk68; u32 xOffset; - u32 r8, r9, r4, r7, r3_; - u8 r10, r2; + s32 r6; - r3 -= 16; + sp18 -= 16; if (sp10 == 2) - r3 -= 42; - r6 = r3 - 14 * sp0C->unk9; + sp18 -= 42; + r6 = sp18 - 14 * sp0C->unk9; if (r6 > 0) r6 = r6 / 2 + 16; else r6 = 16; - i = 0; - while (i < sp0C->unk9) + + for (r8 = 0; r8 < sp0C->unk9; r6 += 14, ++r8) { DynamicPlaceholderTextUtil_Reset(); switch (sp10) { - default: // how can you write this twice?????? - r4 = sp14 - 4; - r10 = r6; - r9 = sp1C + 0xA2; - r8 = sp18; - r6 += 14; - ++i; - break; case 0: - sp18 = sp20->as_five_players.unk1C[0].unk4.as_2d_bytes[0][i]; - if (i != 0 && sp20->as_four_players.unk00.unk0C[0][i] != sp20->as_four_players.unk00.unk0C[0][i - 1]) - sp1C = i; - ConvertIntToDecimalStringN( - gStringVar4, - sp20->as_four_players.unk00.unk0C[sp10][i], - STR_CONV_MODE_RIGHT_ALIGN, - 4 - ); + sp1C = sp24->as_five_players.unk1C[0].unk4.as_2d_bytes[sp10][r8]; + if (r8 != 0 && sp24->as_four_players.unk00.unk0C[sp10][r8] != sp24->as_four_players.unk00.unk0C[sp10][r8 - 1]) + sp20 = r8; + ConvertIntToDecimalStringN(gStringVar4, sp24->as_four_players.unk00.unk0C[sp10][r8], STR_CONV_MODE_RIGHT_ALIGN, 4); StringAppend(gStringVar4, gUnknown_082F43B4[sp10]); - r4 = sp14 - 4; - r10 = r6; - r9 = sp1C + 0xA2; - r8 = sp18; - r6 += 14; - ++i; break; case 1: - sp18 = sp20->as_five_players.unk1C[0].unk4.as_2d_bytes[1][i]; - if (i != 0 && sp20->as_four_players.unk00.unk0C[1][i] != sp20->as_four_players.unk00.unk0C[1][i - 1]) - sp1C = i; - ConvertIntToDecimalStringN( - gStringVar1, - sp20->as_four_players.unk00.unk0C[sp10][i] >> 4, - STR_CONV_MODE_RIGHT_ALIGN, - 3 - ); - j = 0; - r3_ = 15 & (u8)sp20->as_four_players.unk00.unk0C[sp10][i]; - r4 = sp14 - 4; - r10 = r6; - r9 = sp1C + 0xA2; - r8 = sp18; - r6 += 14; - ++i; - for (; j < 4; ++j) - if (((r3_ >> (3 - j)) & 1) != 0) // why does it load constant 1 into r10? - r7 += gUnknown_082F334C[j]; - ConvertIntToDecimalStringN( - gStringVar2, - (u8)(r7 / 1000000), - STR_CONV_MODE_LEADING_ZEROS, - 2 - ); - StringExpandPlaceholders(gStringVar4, gText_XDotY); + sp1C = sp24->as_five_players.unk1C[0].unk4.as_2d_bytes[sp10][r8]; + if (r8 != 0 && sp24->as_four_players.unk00.unk0C[sp10][r8] != sp24->as_four_players.unk00.unk0C[sp10][r8 - 1]) + sp20 = r8; + ConvertIntToDecimalStringN(gStringVar1, sp24->as_four_players.unk00.unk0C[sp10][r8] >> 4, STR_CONV_MODE_RIGHT_ALIGN, 3); + r3 = 0; + r7 = sp24->as_four_players.unk00.unk0C[sp10][r8] & 15; + for (r2 = 0; r2 < 4; ++r2) + if ((r7 >> (3 - r2)) & 1) + r3 += gUnknown_082F334C[r2]; + r7 = r3 / 1000000u; + ConvertIntToDecimalStringN(gStringVar2, r7, STR_CONV_MODE_LEADING_ZEROS, 2); + StringExpandPlaceholders(gStringVar4, gUnknown_082F43B4[sp10]); break; case 2: - sp18 = i; - sp1C = i; - r2 = sp0C->unk68.as_four_players.others[i].unk0; - if (r2 > 43) + sp1C = r8; + sp20 = r8; + r2 = sp0C->unk68.as_five_players.unk1C[r8].unk14[12]; + if (r2 >= LAST_BERRY_INDEX - FIRST_BERRY_INDEX + 2) r2 = 0; - StringCopy(gStringVar1,gBerries[r2].name); - StringExpandPlaceholders(gStringVar4, gText_Var1Berry); - r4 = sp14 - 4; - r10 = r6; - r9 = sp1C + 0xA2; - r8 = i; - r6 += 14; - ++i; + StringCopy(gStringVar1, gBerries[r2].name); + StringExpandPlaceholders(gStringVar4, gUnknown_082F43B4[2]); break; } - xOffset = GetStringRightAlignXOffset(2, gStringVar4, r4); - AddTextPrinterParameterized3( - sp0C->unk138.unk82, - 2, - xOffset, - r10, - sBerryCrushTextColorTable[0], - 0, - gStringVar4 - ); - if (sp18 == sp0C->unk8) + xOffset = GetStringRightAlignXOffset(2, gStringVar4, sp14 - 4); + AddTextPrinterParameterized3(sp0C->unk138.unk82, 2, xOffset, r6, sBerryCrushTextColorTable[0], 0, gStringVar4); + if (sp1C == sp0C->unk8) StringCopy(gStringVar3, gText_1DotBlueF700); else StringCopy(gStringVar3, gText_1DotF700); - gStringVar3[0] = r9; - DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, PLAYER_UNK14(sp0C, r8)); + gStringVar3[0] = sp20 + CHAR_1; + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, PLAYER_UNK14(sp0C, sp1C)); DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gStringVar3); - AddTextPrinterParameterized3( - sp0C->unk138.unk82, - 2, - 4, - r10, - sBerryCrushTextColorTable[0], - 0, - gStringVar4 - ); + AddTextPrinterParameterized3(sp0C->unk138.unk82, 2, 4, r6, sBerryCrushTextColorTable[0], 0, gStringVar4); } } -#else -NAKED -void sub_8021A28(struct BerryCrushGame *sp0C, u8 sp10, u8 sp14, u8 r3) -{ - asm_unified("\n\ - push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, 0x2C\n\ - str r0, [sp, 0xC]\n\ - lsls r1, 24\n\ - lsrs r1, 24\n\ - str r1, [sp, 0x10]\n\ - lsls r2, 24\n\ - lsrs r2, 24\n\ - str r2, [sp, 0x14]\n\ - lsls r3, 24\n\ - movs r0, 0\n\ - str r0, [sp, 0x18]\n\ - movs r1, 0\n\ - str r1, [sp, 0x1C]\n\ - ldr r2, [sp, 0xC]\n\ - adds r2, 0x68\n\ - str r2, [sp, 0x20]\n\ - movs r4, 0xF0\n\ - lsls r4, 24\n\ - adds r3, r4\n\ - lsrs r3, 24\n\ - ldr r0, [sp, 0x10]\n\ - cmp r0, 0x2\n\ - bne _08021A68\n\ - adds r0, r3, 0\n\ - subs r0, 0x2A\n\ - lsls r0, 24\n\ - lsrs r3, r0, 24\n\ - _08021A68:\n\ - ldr r2, [sp, 0xC]\n\ - ldrb r1, [r2, 0x9]\n\ - lsls r0, r1, 3\n\ - subs r0, r1\n\ - lsls r0, 1\n\ - subs r6, r3, r0\n\ - cmp r6, 0\n\ - ble _08021A84\n\ - lsrs r0, r6, 31\n\ - adds r0, r6, r0\n\ - asrs r0, 1\n\ - adds r6, r0, 0\n\ - adds r6, 0x10\n\ - b _08021A86\n\ - _08021A84:\n\ - movs r6, 0x10\n\ - _08021A86:\n\ - movs r5, 0\n\ - ldr r3, [sp, 0xC]\n\ - ldrb r3, [r3, 0x9]\n\ - cmp r5, r3\n\ - bcc _08021A92\n\ - b _08021D14\n\ - _08021A92:\n\ - ldr r4, [sp, 0x10]\n\ - lsls r4, 2\n\ - str r4, [sp, 0x24]\n\ - _08021A98:\n\ - bl DynamicPlaceholderTextUtil_Reset\n\ - ldr r0, [sp, 0x10]\n\ - cmp r0, 0x1\n\ - beq _08021B48\n\ - cmp r0, 0x1\n\ - bgt _08021AC0\n\ - cmp r0, 0\n\ - beq _08021ADE\n\ - ldr r4, [sp, 0x14]\n\ - subs r4, 0x4\n\ - lsls r1, r6, 24\n\ - mov r10, r1\n\ - ldr r2, [sp, 0x1C]\n\ - adds r2, 0xA2\n\ - mov r9, r2\n\ - ldr r3, [sp, 0x18]\n\ - lsls r3, 5\n\ - mov r8, r3\n\ - b _08021C5A\n\ - _08021AC0:\n\ - ldr r4, [sp, 0x10]\n\ - cmp r4, 0x2\n\ - bne _08021AC8\n\ - b _08021C1C\n\ - _08021AC8:\n\ - ldr r4, [sp, 0x14]\n\ - subs r4, 0x4\n\ - lsls r0, r6, 24\n\ - mov r10, r0\n\ - ldr r1, [sp, 0x1C]\n\ - adds r1, 0xA2\n\ - mov r9, r1\n\ - ldr r2, [sp, 0x18]\n\ - lsls r2, 5\n\ - mov r8, r2\n\ - b _08021C5A\n\ - _08021ADE:\n\ - ldr r0, [sp, 0x20]\n\ - adds r0, 0x20\n\ - adds r0, r5\n\ - ldrb r0, [r0]\n\ - str r0, [sp, 0x18]\n\ - lsls r3, r5, 1\n\ - ldr r2, [sp, 0x20]\n\ - adds r2, 0xC\n\ - cmp r5, 0\n\ - beq _08021B04\n\ - adds r0, r2, r3\n\ - subs r1, r5, 0x1\n\ - lsls r1, 1\n\ - adds r1, r2, r1\n\ - ldrh r0, [r0]\n\ - ldrh r1, [r1]\n\ - cmp r0, r1\n\ - beq _08021B04\n\ - str r5, [sp, 0x1C]\n\ - _08021B04:\n\ - ldr r4, [sp, 0x24]\n\ - ldr r1, [sp, 0x10]\n\ - adds r0, r4, r1\n\ - lsls r0, 1\n\ - adds r0, r3, r0\n\ - adds r0, r2, r0\n\ - ldrh r1, [r0]\n\ - ldr r0, =gStringVar4\n\ - movs r2, 0x1\n\ - movs r3, 0x4\n\ - bl ConvertIntToDecimalStringN\n\ - ldr r0, =gUnknown_082F43B4\n\ - adds r0, r4, r0\n\ - ldr r1, [r0]\n\ - ldr r0, =gStringVar4\n\ - bl StringAppend\n\ - ldr r4, [sp, 0x14]\n\ - subs r4, 0x4\n\ - lsls r2, r6, 24\n\ - mov r10, r2\n\ - ldr r3, [sp, 0x1C]\n\ - adds r3, 0xA2\n\ - mov r9, r3\n\ - ldr r0, [sp, 0x18]\n\ - lsls r0, 5\n\ - mov r8, r0\n\ - b _08021C5A\n\ - .pool\n\ - _08021B48:\n\ - ldr r1, [sp, 0x20]\n\ - adds r0, r1, r5\n\ - adds r0, 0x28\n\ - ldrb r0, [r0]\n\ - str r0, [sp, 0x18]\n\ - lsls r3, r5, 1\n\ - adds r2, r1, 0\n\ - adds r2, 0xC\n\ - cmp r5, 0\n\ - beq _08021B72\n\ - adds r0, r3, 0\n\ - adds r0, 0xA\n\ - adds r0, r2, r0\n\ - adds r1, r3, 0\n\ - adds r1, 0x8\n\ - adds r1, r2, r1\n\ - ldrh r0, [r0]\n\ - ldrh r1, [r1]\n\ - cmp r0, r1\n\ - beq _08021B72\n\ - str r5, [sp, 0x1C]\n\ - _08021B72:\n\ - ldr r0, [sp, 0x24]\n\ - ldr r1, [sp, 0x10]\n\ - adds r4, r0, r1\n\ - lsls r4, 1\n\ - adds r4, r3, r4\n\ - adds r4, r2, r4\n\ - ldrh r1, [r4]\n\ - lsrs r1, 4\n\ - ldr r0, =gStringVar1\n\ - movs r2, 0x1\n\ - movs r3, 0x3\n\ - bl ConvertIntToDecimalStringN\n\ - movs r7, 0\n\ - ldrb r0, [r4]\n\ - movs r3, 0xF\n\ - ands r3, r0\n\ - movs r2, 0\n\ - ldr r4, [sp, 0x10]\n\ - lsls r4, 2\n\ - str r4, [sp, 0x28]\n\ - ldr r4, [sp, 0x14]\n\ - subs r4, 0x4\n\ - lsls r0, r6, 24\n\ - mov r10, r0\n\ - ldr r1, [sp, 0x1C]\n\ - adds r1, 0xA2\n\ - mov r9, r1\n\ - ldr r0, [sp, 0x18]\n\ - lsls r0, 5\n\ - mov r8, r0\n\ - adds r6, 0xE\n\ - adds r5, 0x1\n\ - ldr r1, =gUnknown_082F334C\n\ - mov r12, r1\n\ - _08021BB8:\n\ - movs r0, 0x3\n\ - subs r1, r0, r2\n\ - adds r0, r3, 0\n\ - asrs r0, r1\n\ - movs r1, 0x1\n\ - ands r0, r1\n\ - cmp r0, 0\n\ - beq _08021BD0\n\ - lsls r0, r2, 2\n\ - add r0, r12\n\ - ldr r0, [r0]\n\ - adds r7, r0\n\ - _08021BD0:\n\ - adds r0, r2, 0x1\n\ - lsls r0, 24\n\ - lsrs r2, r0, 24\n\ - cmp r2, 0x3\n\ - bls _08021BB8\n\ - adds r0, r7, 0\n\ - ldr r1, =0x000f4240\n\ - bl __udivsi3\n\ - lsls r0, 24\n\ - lsrs r3, r0, 24\n\ - ldr r0, =gStringVar2\n\ - adds r1, r3, 0\n\ - movs r2, 0x2\n\ - movs r3, 0x2\n\ - bl ConvertIntToDecimalStringN\n\ - ldr r0, =gUnknown_082F43B4\n\ - ldr r2, [sp, 0x28]\n\ - adds r0, r2, r0\n\ - ldr r1, [r0]\n\ - ldr r0, =gStringVar4\n\ - bl StringExpandPlaceholders\n\ - b _08021C5E\n\ - .pool\n\ - _08021C1C:\n\ - str r5, [sp, 0x18]\n\ - str r5, [sp, 0x1C]\n\ - lsls r7, r5, 5\n\ - ldr r3, [sp, 0xC]\n\ - adds r0, r3, r7\n\ - adds r0, 0xA4\n\ - ldrb r2, [r0]\n\ - cmp r2, 0x2B\n\ - bls _08021C30\n\ - movs r2, 0\n\ - _08021C30:\n\ - lsls r1, r2, 3\n\ - subs r1, r2\n\ - lsls r1, 2\n\ - ldr r0, =gBerries\n\ - adds r1, r0\n\ - ldr r0, =gStringVar1\n\ - bl StringCopy\n\ - ldr r0, =gUnknown_082F43B4\n\ - ldr r1, [r0, 0x8]\n\ - ldr r0, =gStringVar4\n\ - bl StringExpandPlaceholders\n\ - ldr r4, [sp, 0x14]\n\ - subs r4, 0x4\n\ - lsls r0, r6, 24\n\ - mov r10, r0\n\ - movs r1, 0xA2\n\ - adds r1, r5\n\ - mov r9, r1\n\ - mov r8, r7\n\ - _08021C5A:\n\ - adds r6, 0xE\n\ - adds r5, 0x1\n\ - _08021C5E:\n\ - movs r0, 0x2\n\ - ldr r1, =gStringVar4\n\ - adds r2, r4, 0\n\ - bl GetStringRightAlignXOffset\n\ - adds r2, r0, 0\n\ - ldr r3, [sp, 0xC]\n\ - movs r4, 0xDD\n\ - lsls r4, 1\n\ - adds r0, r3, r4\n\ - ldrb r0, [r0]\n\ - lsls r2, 24\n\ - lsrs r2, 24\n\ - mov r1, r10\n\ - lsrs r3, r1, 24\n\ - ldr r1, =sBerryCrushTextColorTable\n\ - str r1, [sp]\n\ - movs r4, 0\n\ - str r4, [sp, 0x4]\n\ - ldr r1, =gStringVar4\n\ - str r1, [sp, 0x8]\n\ - movs r1, 0x2\n\ - bl AddTextPrinterParameterized3\n\ - ldr r3, [sp, 0x18]\n\ - ldr r2, [sp, 0xC]\n\ - ldrb r2, [r2, 0x8]\n\ - cmp r3, r2\n\ - bne _08021CC0\n\ - ldr r0, =gStringVar3\n\ - ldr r1, =gText_1DotBlueF700\n\ - bl StringCopy\n\ - b _08021CC8\n\ - .pool\n\ - _08021CC0:\n\ - ldr r0, =gStringVar3\n\ - ldr r1, =gText_1DotF700\n\ - bl StringCopy\n\ - _08021CC8:\n\ - ldr r4, =gStringVar3\n\ - mov r3, r9\n\ - strb r3, [r4]\n\ - mov r1, r8\n\ - adds r1, 0x98\n\ - ldr r0, [sp, 0xC]\n\ - adds r1, r0, r1\n\ - movs r0, 0\n\ - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr\n\ - ldr r0, =gStringVar4\n\ - adds r1, r4, 0\n\ - bl DynamicPlaceholderTextUtil_ExpandPlaceholders\n\ - ldr r1, [sp, 0xC]\n\ - movs r2, 0xDD\n\ - lsls r2, 1\n\ - adds r0, r1, r2\n\ - ldrb r0, [r0]\n\ - mov r4, r10\n\ - lsrs r3, r4, 24\n\ - ldr r1, =sBerryCrushTextColorTable\n\ - str r1, [sp]\n\ - movs r1, 0\n\ - str r1, [sp, 0x4]\n\ - ldr r2, =gStringVar4\n\ - str r2, [sp, 0x8]\n\ - movs r1, 0x2\n\ - movs r2, 0x4\n\ - bl AddTextPrinterParameterized3\n\ - lsls r0, r5, 24\n\ - lsrs r5, r0, 24\n\ - ldr r3, [sp, 0xC]\n\ - ldrb r3, [r3, 0x9]\n\ - cmp r5, r3\n\ - bcs _08021D14\n\ - b _08021A98\n\ - _08021D14:\n\ - add sp, 0x2C\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool"); -} -#endif void sub_8021D34(struct BerryCrushGame *r8) {