Match CanUnnerveContestant()

This commit is contained in:
Marcus Huderle
2018-04-05 20:18:42 -07:00
parent 989a6449a3
commit bdc22ceb2c
+5 -59
View File
@@ -1073,81 +1073,27 @@ static void JamByMoveCategory(u8 category)
SetContestantEffectStringID2(shared192D0.contestant, CONTEST_STRING_MESSED_UP2);
}
#ifdef NONMATCHING
static bool8 CanUnnerveContestant(u8 i)
{
// For whatever reason, i is copied to r4. I cannot optimize this out.
shared192D0.unnervedPokes[i] = 1;
if (sContestantStatus[i].immune)
{
SetContestantEffectStringID(i, CONTEST_STRING_AVOID_SEEING);
return FALSE;
}
else if (sContestantStatus[i].jamSafetyCount != 0)
{
sContestantStatus[i].jamSafetyCount--;
SetContestantEffectStringID(i, CONTEST_STRING_AVERT_GAZE);
return FALSE;
}
else if (!sContestantStatus[i].noMoreTurns && sContestantStatus[i].numTurnsSkipped == 0)
{
return TRUE;
}
return FALSE;
}
#else
static __attribute__((naked)) bool8 CanUnnerveContestant(u8 i)
{
asm_unified("\tpush {lr}\n"
"\tlsls r0, 24\n"
"\tlsrs r3, r0, 24\n"
"\tldr r2, _080B90EC @ =gSharedMem + 0x192D0\n"
"\tadds r0, r2, 0\n"
"\tadds r0, 0xD\n"
"\tadds r0, r3, r0\n"
"\tmovs r1, 0x1\n"
"\tstrb r1, [r0]\n"
"\tlsls r0, r3, 3\n"
"\tsubs r0, r3\n"
"\tlsls r0, 2\n"
"\tsubs r2, 0x70\n"
"\tadds r2, r0, r2\n"
"\tldrb r1, [r2, 0x10]\n"
"\tmovs r0, 0x2\n"
"\tands r0, r1\n"
"\tcmp r0, 0\n"
"\tbeq _080B90F0\n"
"\tadds r0, r3, 0\n"
"\tmovs r1, 0x2D\n"
"\tb _080B9116\n"
"\t.align 2, 0\n"
"_080B90EC: .4byte gSharedMem + 0x192D0\n"
"_080B90F0:\n"
"\tldrb r0, [r2, 0x12]\n"
"\tcmp r0, 0\n"
"\tbne _080B910E\n"
"\tldrb r1, [r2, 0xB]\n"
"\tmovs r0, 0x80\n"
"\tands r0, r1\n"
"\tcmp r0, 0\n"
"\tbne _080B911A\n"
"\tldrb r1, [r2, 0xC]\n"
"\tmovs r0, 0x6\n"
"\tands r0, r1\n"
"\tcmp r0, 0\n"
"\tbne _080B911A\n"
"\tmovs r0, 0x1\n"
"\tb _080B911C\n"
"_080B910E:\n"
"\tsubs r0, 0x1\n"
"\tstrb r0, [r2, 0x12]\n"
"\tadds r0, r3, 0\n"
"\tmovs r1, 0x2C\n"
"_080B9116:\n"
"\tbl SetContestantEffectStringID\n"
"_080B911A:\n"
"\tmovs r0, 0\n"
"_080B911C:\n"
"\tpop {r1}\n"
"\tbx r1");
}
#endif
static bool8 WasAtLeastOneOpponentJammed(void)
{