diff --git a/asm/pokenav.s b/asm/pokenav.s index 77e826bde5..474efe935e 100644 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -5,69 +5,7 @@ .text - thumb_func_start sub_81C7388 -sub_81C7388: @ 81C7388 - push {r4-r6,lr} - movs r5, 0 -_081C738C: - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x5 - bl GetMonData - cmp r0, 0 - beq _081C73BA - adds r0, r4, 0 - movs r1, 0x6 - bl GetMonData - cmp r0, 0 - bne _081C73BA - adds r0, r4, 0 - movs r1, 0x52 - bl GetMonData - cmp r0, 0 - bne _081C73E2 -_081C73BA: - adds r5, 0x1 - cmp r5, 0x5 - ble _081C738C - movs r4, 0 -_081C73C2: - movs r5, 0 - lsls r6, r4, 24 -_081C73C6: - adds r0, r4, 0 - adds r1, r5, 0 - bl CheckBoxMonSanityAt - cmp r0, 0 - beq _081C73EC - lsls r1, r5, 24 - lsrs r1, 24 - lsrs r0, r6, 24 - movs r2, 0x52 - bl GetBoxMonDataAt - cmp r0, 0 - beq _081C73EC -_081C73E2: - movs r0, 0x1 - b _081C73FA - .pool -_081C73EC: - adds r5, 0x1 - cmp r5, 0x1D - ble _081C73C6 - adds r4, 0x1 - cmp r4, 0xD - ble _081C73C2 - movs r0, 0 -_081C73FA: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81C7388 + thumb_func_start sub_81C7400 sub_81C7400: @ 81C7400 diff --git a/src/pokenav_main.c b/src/pokenav_main.c index 3f6f8eb5cf..125ced646f 100644 --- a/src/pokenav_main.c +++ b/src/pokenav_main.c @@ -5,6 +5,7 @@ #include "overworld.h" #include "field_weather.h" #include "palette.h" +#include "pokemon_storage_system.h" struct UnknownStruct_0203CF40 { u32 field_0; @@ -24,7 +25,7 @@ extern void sub_81C7418(void); extern void sub_81C7170(u8 a0); extern void sub_81C71E4(u8 a0); extern void sub_81C7650(s32 a0); -extern u32 sub_81C7388(void); +extern u32 AnyMonHasRibbon(void); void sub_81C72BC(void); void sub_81C7360(struct UnknownStruct_0203CF40 *a0); @@ -202,6 +203,32 @@ void sub_81C7360(struct UnknownStruct_0203CF40 *a0) { } a0->field_2 = 0; a0->field_1 = 0; - a0->field_3 = sub_81C7388(); + a0->field_3 = AnyMonHasRibbon(); a0->field_0 = 0; +} + +bool32 AnyMonHasRibbon() { + s32 i; + s32 j; + + for (i = 0; i < 6; i++) { + if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_HAS_SPECIES) + && !GetMonData(&gPlayerParty[i], MON_DATA_SANITY_IS_EGG) + && GetMonData(&gPlayerParty[i], MON_DATA_RIBBON_COUNT) != 0) + { + return TRUE; + } + } + + for (j = 0; j < 14; j++) { + for (i = 0; i < 30; i++) { + if (CheckBoxMonSanityAt(j, i) + && GetBoxMonDataAt(j, i, MON_DATA_RIBBON_COUNT) != 0) + { + return TRUE; + } + } + } + + return FALSE; } \ No newline at end of file