From bb5da949f22f0825fa2e75f63dc45a13572686ef Mon Sep 17 00:00:00 2001 From: PokeCodec <67983839+PokeCodec@users.noreply.github.com> Date: Tue, 8 Sep 2020 19:44:33 -0400 Subject: [PATCH] Fix build --- berry_fix/payload/Makefile | 2 +- berry_fix/payload/src/flash.c | 2 +- src/battle_main.c | 21 ++++++--------------- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/berry_fix/payload/Makefile b/berry_fix/payload/Makefile index ca8b952dd7..e7315242fd 100644 --- a/berry_fix/payload/Makefile +++ b/berry_fix/payload/Makefile @@ -38,7 +38,7 @@ CPPFLAGS := -I ../../tools/agbcc/include -I ../../tools/agbcc -iquote include -n ROM := payload.gba OBJ_DIR := build CC1 := ../../tools/agbcc/bin/agbcc$(EXE) -override CC1FLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm -nostdlib +override CC1FLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm ELF = $(ROM:.gba=.elf) diff --git a/berry_fix/payload/src/flash.c b/berry_fix/payload/src/flash.c index 1f09d0b8f7..499a1f9710 100644 --- a/berry_fix/payload/src/flash.c +++ b/berry_fix/payload/src/flash.c @@ -296,7 +296,7 @@ u8 HandleWriteSectorNBytes(u8 sectorNum, u8 *data, u16 size) u8 TryWriteSector(u8 sectorNum, u8 *data) { - if (ProgramFlashSectorAndVerify(sectorNum, data) != 0) // is damaged? + if (ProgramFlashSectorAndVerify(sectorNum, data)) // is damaged? { SetSectorDamagedStatus(SECTOR_DAMAGED, sectorNum); // set damaged sector bits. return SAVE_STATUS_ERROR; diff --git a/src/battle_main.c b/src/battle_main.c index 66af8d07f1..bf0fdc1aad 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -2686,8 +2686,7 @@ static void sub_80398BC(struct Sprite *sprite) // unused? static void sub_80398D0(struct Sprite *sprite) { - sprite->data[4]--; - if (sprite->data[4] == 0) + if (--sprite->data[4] == 0) { sprite->data[4] = 8; sprite->invisible ^= 1; @@ -3418,17 +3417,13 @@ static void BattleIntroDrawTrainersOrMonsSprites(void) } } - if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + if ((gBattleTypeFlags & BATTLE_TYPE_MULTI) && (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT || GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT)) { - if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT - || GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT) - { - BtlController_EmitDrawTrainerPic(0); - MarkBattlerForControllerExec(gActiveBattler); - } + BtlController_EmitDrawTrainerPic(0); + MarkBattlerForControllerExec(gActiveBattler); } - if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS && GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT) + if ((gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) && (GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT)) { BtlController_EmitDrawTrainerPic(0); MarkBattlerForControllerExec(gActiveBattler); @@ -3961,11 +3956,7 @@ u8 IsRunningFromBattleImpossible(void) gPotentialItemEffectBattler = gActiveBattler; - if (holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN) - return 0; - if (gBattleTypeFlags & BATTLE_TYPE_LINK) - return 0; - if (gBattleMons[gActiveBattler].ability == ABILITY_RUN_AWAY) + if ((holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN) || (gBattleTypeFlags & BATTLE_TYPE_LINK) || (gBattleMons[gActiveBattler].ability == ABILITY_RUN_AWAY)) return 0; side = GetBattlerSide(gActiveBattler);