diff options
Diffstat (limited to 'engine')
-rw-r--r-- | engine/battle/animations.asm | 6 | ||||
-rw-r--r-- | engine/battle/core.asm | 4 | ||||
-rw-r--r-- | engine/battle/effects.asm | 14 | ||||
-rw-r--r-- | engine/battle/move_effects/haze.asm | 2 | ||||
-rw-r--r-- | engine/battle/move_effects/substitute.asm | 2 | ||||
-rw-r--r-- | engine/battle/trainer_ai.asm | 3 | ||||
-rw-r--r-- | engine/debug/debug_menu.asm | 2 | ||||
-rw-r--r-- | engine/debug/debug_party.asm | 2 | ||||
-rw-r--r-- | engine/events/cinnabar_lab.asm | 2 | ||||
-rw-r--r-- | engine/events/hidden_objects/bills_house_pc.asm | 2 | ||||
-rw-r--r-- | engine/events/hidden_objects/school_blackboard.asm | 8 | ||||
-rw-r--r-- | engine/events/prize_menu.asm | 2 | ||||
-rw-r--r-- | engine/events/vending_machine.asm | 2 | ||||
-rw-r--r-- | engine/gfx/palettes.asm | 23 | ||||
-rw-r--r-- | engine/link/cable_club.asm | 22 | ||||
-rw-r--r-- | engine/menus/main_menu.asm | 6 | ||||
-rw-r--r-- | engine/menus/pc.asm | 2 | ||||
-rw-r--r-- | engine/menus/save.asm | 2 | ||||
-rw-r--r-- | engine/menus/start_sub_menus.asm | 4 | ||||
-rw-r--r-- | engine/menus/unused_input.asm | 2 | ||||
-rw-r--r-- | engine/pokemon/bills_pc.asm | 6 | ||||
-rw-r--r-- | engine/pokemon/learn_move.asm | 2 |
22 files changed, 54 insertions, 66 deletions
diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 56db1979..81468a39 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -419,7 +419,7 @@ MoveAnimation: .moveAnimation ; check if battle animations are disabled in the options ld a, [wOptions] - bit 7, a + bit BIT_BATTLE_ANIMATION, a jr nz, .animationsDisabled call ShareMoveAnimations call PlayAnimation @@ -701,7 +701,7 @@ INCLUDE "data/battle_anims/special_effects.asm" DoBallTossSpecialEffects: ld a, [wcf91] - cp 3 ; is it a Master Ball or Ultra Ball? + cp ULTRA_BALL + 1 ; is it a Master Ball or Ultra Ball? jr nc, .skipFlashingEffect .flashingEffect ; do a flashing effect if it's Master Ball or Ultra Ball ldh a, [rOBP0] @@ -717,7 +717,7 @@ DoBallTossSpecialEffects: call PlaySound .skipPlayingSound ld a, [wIsInBattle] - cp 02 ; is it a trainer battle? + cp 2 ; is it a trainer battle? jr z, .isTrainerBattle ld a, [wd11e] cp $10 ; is the enemy pokemon the Ghost Marowak? diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 882f3f8e..fa1a8d56 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -3602,7 +3602,7 @@ CheckPlayerStatusConditions: ld hl, wPlayerBattleStatus1 ld a, [hl] ; clear bide, thrashing, charging up, and trapping moves such as warp (already cleared for confusion damage) - and $ff ^ ((1 << STORING_ENERGY) | (1 << THRASHING_ABOUT) | (1 << CHARGING_UP) | (1 << USING_TRAPPING_MOVE)) + and ~((1 << STORING_ENERGY) | (1 << THRASHING_ABOUT) | (1 << CHARGING_UP) | (1 << USING_TRAPPING_MOVE)) ld [hl], a ld a, [wPlayerMoveEffect] cp FLY_EFFECT @@ -6120,7 +6120,7 @@ CheckEnemyStatusConditions: ld hl, wEnemyBattleStatus1 ld a, [hl] ; clear bide, thrashing about, charging up, and multi-turn moves such as warp - and $ff ^ ((1 << STORING_ENERGY) | (1 << THRASHING_ABOUT) | (1 << CHARGING_UP) | (1 << USING_TRAPPING_MOVE)) + and ~((1 << STORING_ENERGY) | (1 << THRASHING_ABOUT) | (1 << CHARGING_UP) | (1 << USING_TRAPPING_MOVE)) ld [hl], a ld a, [wEnemyMoveEffect] cp FLY_EFFECT diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index 959f7eaf..f2e2590c 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -108,10 +108,10 @@ PoisonEffect: jr z, .noEffect ld a, [de] cp POISON_SIDE_EFFECT1 - ld b, $34 ; ~20% chance of poisoning + ld b, 20 percent + 1 ; chance of poisoning jr z, .sideEffectTest cp POISON_SIDE_EFFECT2 - ld b, $67 ; ~40% chance of poisoning + ld b, 40 percent + 1 ; chance of poisoning jr z, .sideEffectTest push hl push de @@ -584,7 +584,7 @@ StatModifierDownEffect: cp LINK_STATE_BATTLING jr z, .statModifierDownEffect call BattleRandom - cp $40 ; 1/4 chance to miss by in regular battle + cp 25 percent + 1 ; chance to miss by in regular battle jp c, MoveMissed .statModifierDownEffect call CheckTargetSubstitute ; can't hit through substitute @@ -593,7 +593,7 @@ StatModifierDownEffect: cp ATTACK_DOWN_SIDE_EFFECT jr c, .nonSideEffect call BattleRandom - cp $55 ; 85/256 chance for side effects + cp 33 percent + 1 ; chance for side effects jp nc, CantLowerAnymore ld a, [de] sub ATTACK_DOWN_SIDE_EFFECT ; map each stat to 0-3 @@ -1018,9 +1018,9 @@ FlinchSideEffect: call z, ClearHyperBeam ld a, [de] cp FLINCH_SIDE_EFFECT1 - ld b, $1a ; ~10% chance of flinch + ld b, 10 percent + 1 ; chance of flinch (FLINCH_SIDE_EFFECT1) jr z, .gotEffectChance - ld b, $4d ; ~30% chance of flinch + ld b, 30 percent + 1 ; chance of flinch otherwise .gotEffectChance call BattleRandom cp b @@ -1167,7 +1167,7 @@ RecoilEffect: ConfusionSideEffect: call BattleRandom - cp $19 ; ~10% chance + cp 10 percent ; chance of confusion ret nc jr ConfusionSideEffectSuccess diff --git a/engine/battle/move_effects/haze.asm b/engine/battle/move_effects/haze.asm index 915eeed8..c15c848b 100644 --- a/engine/battle/move_effects/haze.asm +++ b/engine/battle/move_effects/haze.asm @@ -51,7 +51,7 @@ CureVolatileStatuses: inc hl ; BATTSTATUS2 ld a, [hl] ; clear USING_X_ACCURACY, PROTECTED_BY_MIST, GETTING_PUMPED, and SEEDED statuses - and $ff ^((1 << USING_X_ACCURACY) | (1 << PROTECTED_BY_MIST) | (1 << GETTING_PUMPED) | (1 << SEEDED)) + and ~((1 << USING_X_ACCURACY) | (1 << PROTECTED_BY_MIST) | (1 << GETTING_PUMPED) | (1 << SEEDED)) ld [hli], a ; BATTSTATUS3 ld a, [hl] and %11110000 | (1 << TRANSFORMED) ; clear Bad Poison, Reflect and Light Screen statuses diff --git a/engine/battle/move_effects/substitute.asm b/engine/battle/move_effects/substitute.asm index 860b76b6..b1fd8ac2 100644 --- a/engine/battle/move_effects/substitute.asm +++ b/engine/battle/move_effects/substitute.asm @@ -45,7 +45,7 @@ SubstituteEffect_: ld l, c set HAS_SUBSTITUTE_UP, [hl] ld a, [wOptions] - bit 7, a ; battle animation is enabled? + bit BIT_BATTLE_ANIMATION, a ld hl, PlayCurrentMoveAnimation ld b, BANK(PlayCurrentMoveAnimation) jr z, .animationEnabled diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index 3efbeeda..4048e808 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -351,7 +351,10 @@ CooltrainerMAI: jp AIUseXAttack CooltrainerFAI: + ; The intended 25% chance to consider switching will not apply. + ; Uncomment the line below to fix this. cp 25 percent + 1 + ; ret nc ld a, 10 call AICheckIfHPBelowFraction jp c, AIUseHyperPotion diff --git a/engine/debug/debug_menu.asm b/engine/debug/debug_menu.asm index 4d31265b..83917823 100644 --- a/engine/debug/debug_menu.asm +++ b/engine/debug/debug_menu.asm @@ -25,7 +25,7 @@ IF DEF(_DEBUG) ld de, DebugMenuOptions call PlaceString - ld a, 3 ; medium speed + ld a, TEXT_DELAY_MEDIUM ld [wOptions], a ld a, A_BUTTON | B_BUTTON | START diff --git a/engine/debug/debug_party.asm b/engine/debug/debug_party.asm index 67a27710..1945950f 100644 --- a/engine/debug/debug_party.asm +++ b/engine/debug/debug_party.asm @@ -31,7 +31,7 @@ IF DEF(_DEBUG) ld [wTownVisitedFlag + 1], a ; Get all badges except Earth Badge. - ld a, $ff ^ (1 << BIT_EARTHBADGE) + ld a, ~(1 << BIT_EARTHBADGE) ld [wObtainedBadges], a call SetDebugTeam diff --git a/engine/events/cinnabar_lab.asm b/engine/events/cinnabar_lab.asm index 7cbb2cd5..547f782e 100644 --- a/engine/events/cinnabar_lab.asm +++ b/engine/events/cinnabar_lab.asm @@ -27,7 +27,7 @@ GiveFossilToCinnabarLab:: ld hl, wd730 res 6, [hl] call HandleMenuInput - bit 1, a ; pressed B? + bit BIT_B_BUTTON, a jr nz, .cancelledGivingFossil ld hl, wFilteredBagItems ld a, [wCurrentMenuItem] diff --git a/engine/events/hidden_objects/bills_house_pc.asm b/engine/events/hidden_objects/bills_house_pc.asm index bdbaff7e..1299ac23 100644 --- a/engine/events/hidden_objects/bills_house_pc.asm +++ b/engine/events/hidden_objects/bills_house_pc.asm @@ -92,7 +92,7 @@ BillsHousePokemonList:: call PrintText call SaveScreenTilesToBuffer2 call HandleMenuInput - bit 1, a ; pressed b + bit BIT_B_BUTTON, a jr nz, .cancel ld a, [wCurrentMenuItem] add EEVEE diff --git a/engine/events/hidden_objects/school_blackboard.asm b/engine/events/hidden_objects/school_blackboard.asm index eb927292..e1cf1312 100644 --- a/engine/events/hidden_objects/school_blackboard.asm +++ b/engine/events/hidden_objects/school_blackboard.asm @@ -35,7 +35,7 @@ LinkCableHelp:: ld hl, LinkCableHelpText2 call PrintText call HandleMenuInput - bit 1, a ; pressed b + bit BIT_B_BUTTON, a jr nz, .exit ld a, [wCurrentMenuItem] cp 3 ; pressed a on "STOP READING" @@ -121,9 +121,9 @@ ViridianSchoolBlackboard:: ld hl, ViridianSchoolBlackboardText2 call PrintText call HandleMenuInput ; pressing up and down is handled in here - bit 1, a ; pressed b + bit BIT_B_BUTTON, a ; pressed b jr nz, .exitBlackboard - bit 4, a ; pressed right + bit BIT_D_RIGHT, a jr z, .didNotPressRight ; move cursor to right column ld a, 2 @@ -136,7 +136,7 @@ ViridianSchoolBlackboard:: ld [wMenuItemOffset], a jr .blackboardLoop .didNotPressRight - bit 5, a ; pressed left + bit BIT_D_LEFT, a jr z, .didNotPressLeftOrRight ; move cursor to left column ld a, 2 diff --git a/engine/events/prize_menu.asm b/engine/events/prize_menu.asm index 87244119..47bb1062 100644 --- a/engine/events/prize_menu.asm +++ b/engine/events/prize_menu.asm @@ -30,7 +30,7 @@ CeladonPrizeMenu:: ld hl, WhichPrizeTextPtr call PrintText call HandleMenuInput ; menu choice handler - bit 1, a ; keypress = B (Cancel) + bit BIT_B_BUTTON, a jr nz, .noChoice ld a, [wCurrentMenuItem] cp 3 ; "NO,THANKS" choice diff --git a/engine/events/vending_machine.asm b/engine/events/vending_machine.asm index 6ff6a5e4..68dfadfb 100644 --- a/engine/events/vending_machine.asm +++ b/engine/events/vending_machine.asm @@ -30,7 +30,7 @@ VendingMachineMenu:: ld hl, wd730 res 6, [hl] call HandleMenuInput - bit 1, a ; pressed B? + bit BIT_B_BUTTON, a jr nz, .notThirsty ld a, [wCurrentMenuItem] cp 3 ; chose Cancel? diff --git a/engine/gfx/palettes.asm b/engine/gfx/palettes.asm index b480c6d0..fa7bb7c5 100644 --- a/engine/gfx/palettes.asm +++ b/engine/gfx/palettes.asm @@ -740,9 +740,7 @@ InitGBCPalettes: inc hl -index = 0 - - REPT NUM_ACTIVE_PALS + FOR index, NUM_ACTIVE_PALS IF index > 0 pop hl ENDC @@ -774,8 +772,6 @@ index = 0 call DMGPalToGBCPal ld a, index + 4 call TransferCurOBPData - -index = index + 1 ENDR ret @@ -820,8 +816,7 @@ DMGPalToGBCPal:: ldh a, [rOBP1] ld [wLastOBP1], a .convert -color_index = 0 - REPT NUM_PAL_COLORS + FOR color_index, NUM_PAL_COLORS ld b, a and %11 call .GetColorAddress @@ -835,8 +830,6 @@ color_index = 0 rrca rrca ENDC - -color_index = color_index + 1 ENDR ret @@ -980,9 +973,7 @@ _UpdateGBCPal_BGP_CheckDMG:: ; fall through _UpdateGBCPal_BGP:: -index = 0 - - REPT NUM_ACTIVE_PALS + FOR index, NUM_ACTIVE_PALS ld a, [wGBCBasePalPointers + index * 2] ld e, a ld a, [wGBCBasePalPointers + index * 2 + 1] @@ -991,17 +982,13 @@ index = 0 call DMGPalToGBCPal ld a, index call BufferBGPPal - -index = index + 1 ENDR call TransferBGPPals ret _UpdateGBCPal_OBP:: -index = 0 - - REPT NUM_ACTIVE_PALS + FOR index, NUM_ACTIVE_PALS ld a, [wGBCBasePalPointers + index * 2] ld e, a ld a, [wGBCBasePalPointers + index * 2 + 1] @@ -1022,8 +1009,6 @@ index = 0 ENDC call TransferCurOBPData - -index = index + 1 ENDR ret diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index f9728f47..0c653cc8 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -353,7 +353,7 @@ TradeCenter_SelectMon: res 1, [hl] and a jp z, .getNewInput - bit 0, a ; A button pressed? + bit BIT_A_BUTTON, a jr z, .enemyMonMenu_ANotPressed ; if A button pressed ld a, [wMaxMenuItem] @@ -372,7 +372,7 @@ TradeCenter_SelectMon: call TradeCenter_DisplayStats jp .getNewInput .enemyMonMenu_ANotPressed - bit 5, a ; Left pressed? + bit BIT_D_LEFT, a jr z, .enemyMonMenu_LeftNotPressed ; if Left pressed, switch back to the player mon menu xor a ; player mon menu @@ -392,7 +392,7 @@ TradeCenter_SelectMon: ld [wCurrentMenuItem], a jr .playerMonMenu .enemyMonMenu_LeftNotPressed - bit 7, a ; Down pressed? + bit BIT_D_DOWN, a jp z, .getNewInput jp .selectedCancelMenuItem ; jump if Down pressed .playerMonMenu @@ -420,7 +420,7 @@ TradeCenter_SelectMon: jr nz, .playerMonMenu_SomethingPressed jp .getNewInput .playerMonMenu_SomethingPressed - bit 0, a ; A button pressed? + bit BIT_A_BUTTON, a jr z, .playerMonMenu_ANotPressed jp .chosePlayerMon ; jump if A button pressed ; unreachable code @@ -430,7 +430,7 @@ TradeCenter_SelectMon: call TradeCenter_DisplayStats jp .getNewInput .playerMonMenu_ANotPressed - bit 4, a ; Right pressed? + bit BIT_D_RIGHT, a jr z, .playerMonMenu_RightNotPressed ; if Right pressed, switch to the enemy mon menu ld a, $1 ; enemy mon menu @@ -452,7 +452,7 @@ TradeCenter_SelectMon: .notPastLastEnemyMon jp .enemyMonMenu .playerMonMenu_RightNotPressed - bit 7, a ; Down pressed? + bit BIT_D_DOWN, a jr z, .getNewInput jp .selectedCancelMenuItem ; jump if Down pressed .getNewInput @@ -495,7 +495,7 @@ TradeCenter_SelectMon: call HandleMenuInput bit 4, a ; Right pressed? jr nz, .selectTradeMenuItem - bit 1, a ; B button pressed? + bit BIT_B_BUTTON, a jr z, .displayPlayerMonStats .cancelPlayerMonChoice pop af @@ -510,9 +510,9 @@ TradeCenter_SelectMon: ld a, 11 ld [wTopMenuItemX], a call HandleMenuInput - bit 5, a ; Left pressed? + bit BIT_D_LEFT, a jr nz, .selectStatsMenuItem - bit 1, a ; B button pressed? + bit BIT_B_BUTTON, a jr nz, .cancelPlayerMonChoice jr .choseTrade .displayPlayerMonStats @@ -561,9 +561,9 @@ TradeCenter_SelectMon: ldh a, [hJoy5] and a ; pressed anything? jr z, .cancelMenuItem_JoypadLoop - bit 0, a ; A button pressed? + bit BIT_A_BUTTON, a jr nz, .cancelMenuItem_APressed - bit 6, a ; Up pressed? + bit BIT_D_UP, a jr z, .cancelMenuItem_JoypadLoop ; if Up pressed ld a, " " diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index 7d81d2f6..6ccbb597 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -64,7 +64,7 @@ MainMenu: ld a, [wSaveFileStatus] ld [wMaxMenuItem], a call HandleMenuInput - bit 1, a ; pressed B? + bit BIT_B_BUTTON, a jp nz, DisplayTitleScreen ; if so, go back to the title screen ld c, 20 call DelayFrames @@ -97,9 +97,9 @@ MainMenu: ldh [hJoyHeld], a call Joypad ldh a, [hJoyHeld] - bit 0, a + bit BIT_A_BUTTON, a jr nz, .pressedA - bit 1, a + bit BIT_B_BUTTON, a jp nz, .mainMenuLoop ; pressed B jr .inputLoop .pressedA diff --git a/engine/menus/pc.asm b/engine/menus/pc.asm index 4c340e7b..6a15eaa5 100644 --- a/engine/menus/pc.asm +++ b/engine/menus/pc.asm @@ -14,7 +14,7 @@ PCMainMenu: ld hl, wFlags_0xcd60 set 5, [hl] call HandleMenuInput - bit 1, a ;if player pressed B + bit BIT_B_BUTTON, a jp nz, LogOff ld a, [wMaxMenuItem] cp 2 diff --git a/engine/menus/save.asm b/engine/menus/save.asm index aab29b20..55ae9e47 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -347,7 +347,7 @@ ChangeBox:: call HandleMenuInput ld hl, hUILayoutFlags res 1, [hl] - bit 1, a ; pressed b + bit BIT_B_BUTTON, a ret nz ld a, $b6 call PlaySoundWaitForCurrent diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm index 6055db5c..8a0b7b82 100644 --- a/engine/menus/start_sub_menus.asm +++ b/engine/menus/start_sub_menus.asm @@ -65,7 +65,7 @@ StartMenu_Pokemon:: push af call LoadScreenTilesFromBuffer1 ; restore saved screen pop af - bit 1, a ; was the B button pressed? + bit BIT_B_BUTTON, a jp nz, .loop ; if the B button wasn't pressed ld a, [wMaxMenuItem] @@ -377,7 +377,7 @@ StartMenu_Item:: ld [hl], a ; old menu item id call HandleMenuInput call PlaceUnfilledArrowMenuCursor - bit 1, a ; was the B button pressed? + bit BIT_B_BUTTON, a jr z, .useOrTossItem jp ItemMenuLoop .useOrTossItem ; if the player made the choice to use or toss the item diff --git a/engine/menus/unused_input.asm b/engine/menus/unused_input.asm index ad5c36df..6fe44b0b 100644 --- a/engine/menus/unused_input.asm +++ b/engine/menus/unused_input.asm @@ -31,7 +31,7 @@ HandleMenuInputPokemonSelectionDuplicate: ; unreferenced ld [wCheckFor180DegreeTurn], a ldh a, [hJoy5] ld b, a - bit 6, a ; pressed Up key? + bit BIT_D_UP, a jr z, .checkIfDownPressed .upPressed ld a, [wCurrentMenuItem] ; selected menu item diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index 13ad1b20..6901ef46 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -168,8 +168,8 @@ BillsPCMenu: ldh [hAutoBGTransferEnabled], a call Delay3 call HandleMenuInput - bit 1, a - jp nz, ExitBillsPC ; b button + bit BIT_B_BUTTON, a + jp nz, ExitBillsPC call PlaceUnfilledArrowMenuCursor ld a, [wCurrentMenuItem] ld [wParentMenuItem], a @@ -456,7 +456,7 @@ DisplayDepositWithdrawMenu: ld [wPartyAndBillsPCSavedMenuItem], a .loop call HandleMenuInput - bit 1, a ; pressed B? + bit BIT_B_BUTTON, a jr nz, .exit ld a, [wCurrentMenuItem] and a diff --git a/engine/pokemon/learn_move.asm b/engine/pokemon/learn_move.asm index 9f4ac2d2..03f17bcc 100644 --- a/engine/pokemon/learn_move.asm +++ b/engine/pokemon/learn_move.asm @@ -154,7 +154,7 @@ TryingToLearn: call LoadScreenTilesFromBuffer1 pop af pop hl - bit 1, a ; pressed b + bit BIT_B_BUTTON, a jr nz, .cancel push hl ld a, [wCurrentMenuItem] |