port fakematch fixes from #1155

This commit is contained in:
Kurausukun 2020-10-22 05:45:53 -04:00
parent 9c4dddf870
commit 64ba8c8061
2 changed files with 7 additions and 11 deletions

View file

@ -4962,11 +4962,7 @@ static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void)
TryClearRageStatuses(); TryClearRageStatuses();
gCurrentTurnActionNumber = 0; gCurrentTurnActionNumber = 0;
{ gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber];
// something stupid needed to match
u8 zero;
gCurrentActionFuncId = gActionsByTurnOrder[(zero = 0)];
}
gDynamicBasePower = 0; gDynamicBasePower = 0;
gBattleStruct->dynamicMoveType = 0; gBattleStruct->dynamicMoveType = 0;
gBattleMainFunc = RunTurnActionsFunctions; gBattleMainFunc = RunTurnActionsFunctions;

View file

@ -923,7 +923,7 @@ static bool32 RfuProcessEnqueuedRecvBlock(void)
static void HandleSendFailure(u8 unused, u32 flags) static void HandleSendFailure(u8 unused, u32 flags)
{ {
s32 i, j; s32 i, j, temp;
const u8 *r10 = Rfu.sendBlock.payload; const u8 *r10 = Rfu.sendBlock.payload;
for (i = 0; i < Rfu.sendBlock.count; i++) for (i = 0; i < Rfu.sendBlock.count; i++)
@ -933,14 +933,14 @@ static void HandleSendFailure(u8 unused, u32 flags)
sResendBlock16[0] = RFUCMD_0x8900 | i; sResendBlock16[0] = RFUCMD_0x8900 | i;
for (j = 0; j < 7; j++) for (j = 0; j < 7; j++)
{ {
sResendBlock16[j + 1] = (r10[12 * i + (j << 1) + 1] << 8) | r10[12 * i + (j << 1) + 0]; temp = j << 1;
sResendBlock16[j + 1] = (r10[12 * i + temp + 1] << 8) | r10[12 * i + temp + 0];
} }
for (j = 0; j < 7; j++) for (j = 0; j < 7; j++)
{ {
sResendBlock8[2 * j + 1] = sResendBlock16[j] >> 8; temp = j << 1;
sResendBlock8[2 * j + 0] = sResendBlock16[j]; sResendBlock8[temp + 1] = sResendBlock16[j] >> 8;
sResendBlock8[temp + 0] = sResendBlock16[j];
j++;j--; // Needed to match;
} }
RfuSendQueue_Enqueue(&Rfu.sendQueue, sResendBlock8); RfuSendQueue_Enqueue(&Rfu.sendQueue, sResendBlock8);
Rfu.sendBlock.failedFlags |= (1 << i); Rfu.sendBlock.failedFlags |= (1 << i);