diff --git a/src/link_rfu_3.c b/src/link_rfu_3.c index db1ba8b43..c4c000a6e 100644 --- a/src/link_rfu_3.c +++ b/src/link_rfu_3.c @@ -623,105 +623,39 @@ static void ASCIIToPkmnStr(u8 *pkmnStr, const u8 *asciiStr) pkmnStr[i] = EOS; } -#ifdef NONMATCHING static u8 GetConnectedChildStrength(u8 maxFlags) { u8 flagCount = 0; - u32 flags = gRfuLinkStatus->connSlotFlag; + u8 flags = gRfuLinkStatus->connSlotFlag; u8 i; if (gRfuLinkStatus->parentChild == MODE_PARENT) { - for (i = 0; i < 4; flags >>= 1, i++) + for (i = 0; i < 4; i++) { if (flags & 1) { if (maxFlags == flagCount + 1) + { return gRfuLinkStatus->strength[i]; + break; // This break is needed to match + } flagCount++; } + flags >>= 1; } } else { - for (i = 0; i < 4; flags >>= 1, i++) + for (i = 0; i < 4; i++) { if (flags & 1) return gRfuLinkStatus->strength[i]; + flags >>= 1; } } return 0; } -#else -NAKED -static u8 GetConnectedChildStrength(u8 maxFlags) -{ - asm_unified("\tpush {r4-r7,lr}\n" - "\tlsls r0, 24\n" - "\tlsrs r5, r0, 24\n" - "\tmovs r6, 0\n" - "\tldr r0, =gRfuLinkStatus\n" - "\tldr r4, [r0]\n" - "\tldrb r2, [r4, 0x2]\n" - "\tldrb r1, [r4]\n" - "\tadds r7, r0, 0\n" - "\tcmp r1, 0x1\n" - "\tbne _0800DD72\n" - "\tmovs r3, 0\n" - "\tands r1, r2\n" - "\tcmp r1, 0\n" - "\tbeq _0800DD4E\n" - "\tcmp r5, 0x1\n" - "\tbne _0800DD48\n" - "\tldrb r0, [r4, 0xA]\n" - "\tb _0800DD8C\n" - "\t.pool\n" - "_0800DD48:\n" - "\tadds r0, r6, 0x1\n" - "\tlsls r0, 24\n" - "\tlsrs r6, r0, 24\n" - "_0800DD4E:\n" - "\tlsrs r2, 1\n" - "\tadds r0, r3, 0x1\n" - "\tlsls r0, 24\n" - "\tlsrs r3, r0, 24\n" - "\tcmp r3, 0x3\n" - "\tbhi _0800DD8A\n" - "\tmovs r0, 0x1\n" - "\tands r0, r2\n" - "\tcmp r0, 0\n" - "\tbeq _0800DD4E\n" - "\tadds r0, r6, 0x1\n" - "\tcmp r5, r0\n" - "\tbne _0800DD48\n" - "_0800DD68:\n" - "\tldr r0, [r7]\n" - "\tadds r0, 0xA\n" - "\tadds r0, r3\n" - "\tldrb r0, [r0]\n" - "\tb _0800DD8C\n" - "_0800DD72:\n" - "\tmovs r3, 0\n" - "\tmovs r1, 0x1\n" - "_0800DD76:\n" - "\tadds r0, r2, 0\n" - "\tands r0, r1\n" - "\tcmp r0, 0\n" - "\tbne _0800DD68\n" - "\tlsrs r2, 1\n" - "\tadds r0, r3, 0x1\n" - "\tlsls r0, 24\n" - "\tlsrs r3, r0, 24\n" - "\tcmp r3, 0x3\n" - "\tbls _0800DD76\n" - "_0800DD8A:\n" - "\tmovs r0, 0\n" - "_0800DD8C:\n" - "\tpop {r4-r7}\n" - "\tpop {r1}\n" - "\tbx r1"); -} -#endif void InitHostRFUtgtGname(struct GFtgtGname *data, u8 activity, bool32 started, s32 child_sprite_genders) {