Fix style, sync moved functions properly

This commit is contained in:
ExpoSeed 2020-10-13 09:40:01 -05:00
parent bcfa79f4fb
commit d4e58d9746
3 changed files with 13 additions and 9 deletions

View File

@ -4931,6 +4931,7 @@ void RunBattleScriptCommands(void)
if (gBattleControllerExecFlags == 0) if (gBattleControllerExecFlags == 0)
gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]](); gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]]();
} }
void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk) void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk)
{ {
u32 moveType, ateType, attackerAbility; u32 moveType, ateType, attackerAbility;

View File

@ -5019,8 +5019,7 @@ bool32 CanBattlerSwitch(u32 battlerId)
ret = (i != PARTY_SIZE); ret = (i != PARTY_SIZE);
} }
else if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
{ {
if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT) if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT)
party = gEnemyParty; party = gEnemyParty;

View File

@ -334,7 +334,9 @@ void HandleAction_UseItem(void)
gBattlerAttacker = gBattlerTarget = gBattlerByTurnOrder[gCurrentTurnActionNumber]; gBattlerAttacker = gBattlerTarget = gBattlerByTurnOrder[gCurrentTurnActionNumber];
gBattle_BG0_X = 0; gBattle_BG0_X = 0;
gBattle_BG0_Y = 0; gBattle_BG0_Y = 0;
ClearFuryCutterDestinyBondGrudge(gBattlerAttacker); ClearFuryCutterDestinyBondGrudge(gBattlerAttacker);
gLastUsedItem = gBattleResources->bufferB[gBattlerAttacker][1] | (gBattleResources->bufferB[gBattlerAttacker][2] << 8); gLastUsedItem = gBattleResources->bufferB[gBattlerAttacker][1] | (gBattleResources->bufferB[gBattlerAttacker][2] << 8);
if (gLastUsedItem <= LAST_BALL) // is ball if (gLastUsedItem <= LAST_BALL) // is ball
@ -360,18 +362,18 @@ void HandleAction_UseItem(void)
break; break;
case AI_ITEM_CURE_CONDITION: case AI_ITEM_CURE_CONDITION:
gBattleCommunication[MULTISTRING_CHOOSER] = 0; gBattleCommunication[MULTISTRING_CHOOSER] = 0;
if (*(gBattleStruct->AI_itemFlags + gBattlerAttacker / 2) & 1) if (*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) & 1)
{ {
if (*(gBattleStruct->AI_itemFlags + gBattlerAttacker / 2) & 0x3E) if (*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) & 0x3E)
gBattleCommunication[MULTISTRING_CHOOSER] = 5; gBattleCommunication[MULTISTRING_CHOOSER] = 5;
} }
else else
{ {
while (!(*(gBattleStruct->AI_itemFlags + gBattlerAttacker / 2) & 1)) do
{ {
*(gBattleStruct->AI_itemFlags + gBattlerAttacker / 2) >>= 1; *(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) >>= 1;
gBattleCommunication[MULTISTRING_CHOOSER]++; gBattleCommunication[MULTISTRING_CHOOSER]++;
} } while (!(*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) & 1));
} }
break; break;
case AI_ITEM_X_STAT: case AI_ITEM_X_STAT:
@ -387,7 +389,7 @@ void HandleAction_UseItem(void)
while (!((*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1))) & 1)) while (!((*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1))) & 1))
{ {
*(gBattleStruct->AI_itemFlags + gBattlerAttacker / 2) >>= 1; *(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) >>= 1;
gBattleTextBuff1[2]++; gBattleTextBuff1[2]++;
} }
@ -403,7 +405,7 @@ void HandleAction_UseItem(void)
break; break;
} }
gBattlescriptCurrInstr = gBattlescriptsForUsingItem[*(gBattleStruct->AI_itemType + gBattlerAttacker / 2)]; gBattlescriptCurrInstr = gBattlescriptsForUsingItem[*(gBattleStruct->AI_itemType + (gBattlerAttacker >> 1))];
} }
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT; gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
} }
@ -577,6 +579,8 @@ void HandleAction_ThrowPokeblock(void)
gBattleStruct->safariPkblThrowCounter++; gBattleStruct->safariPkblThrowCounter++;
if (gBattleStruct->safariEscapeFactor > 1) if (gBattleStruct->safariEscapeFactor > 1)
{ {
// BUG: The safariEscapeFactor is unintetionally able to become 0 (but it can not become negative!). This causes the pokeblock throw glitch.
// To fix that change the < in the if statement below to <=.
if (gBattleStruct->safariEscapeFactor < sPkblToEscapeFactor[gBattleStruct->safariPkblThrowCounter][gBattleCommunication[MULTISTRING_CHOOSER]]) if (gBattleStruct->safariEscapeFactor < sPkblToEscapeFactor[gBattleStruct->safariPkblThrowCounter][gBattleCommunication[MULTISTRING_CHOOSER]])
gBattleStruct->safariEscapeFactor = 1; gBattleStruct->safariEscapeFactor = 1;
else else