From 58d08bff4386815b83c9260bd831719507acfcec Mon Sep 17 00:00:00 2001 From: Rangi Date: Tue, 2 Nov 2021 19:57:08 -0400 Subject: Identify some percentage constant values --- engine/battle/animations.asm | 4 ++-- engine/battle/core.asm | 26 +++++++++++++------------- engine/battle/effects.asm | 14 +++++++------- 3 files changed, 22 insertions(+), 22 deletions(-) (limited to 'engine') diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 75713592..a93af9e9 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -653,7 +653,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] @@ -668,7 +668,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 d24a43d0..57303776 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -402,12 +402,12 @@ MainInBattleLoop: cp USING_INTERNAL_CLOCK jr z, .invertOutcome call BattleRandom - cp $80 + cp 50 percent + 1 jr c, .playerMovesFirst jr .enemyMovesFirst .invertOutcome call BattleRandom - cp $80 + cp 50 percent + 1 jr c, .enemyMovesFirst jr .playerMovesFirst .enemyMovesFirst @@ -1319,7 +1319,7 @@ EnemySendOutFirstMon: ld [wWhichPokemon], a jr .next3 .next - ld b, $FF + ld b, $ff .next2 inc b ld a, [wEnemyMonPartyPos] @@ -2962,19 +2962,19 @@ SelectEnemyMove: .chooseRandomMove push hl call BattleRandom - ld b, $1 - cp $3f ; select move 1, [0,3e] (63/256 chance) + ld b, 1 ; 25% chance to select move 1 + cp 25 percent jr c, .moveChosen inc hl - inc b - cp $7f ; select move 2, [3f,7e] (64/256 chance) + inc b ; 25% chance to select move 2 + cp 50 percent jr c, .moveChosen inc hl - inc b - cp $be ; select move 3, [7f,bd] (63/256 chance) + inc b ; 25% chance to select move 3 + cp 75 percent - 1 jr c, .moveChosen inc hl - inc b ; select move 4, [be,ff] (66/256 chance) + inc b ; 25% chance to select move 4 .moveChosen ld a, b dec a @@ -3398,7 +3398,7 @@ CheckPlayerStatusConditions: ld a, CONF_ANIM - 1 call PlayMoveAnimation call BattleRandom - cp $80 ; 50% chance to hurt itself + cp 50 percent + 1 ; chance to hurt itself jr c, .TriedToUseDisabledMoveCheck ld hl, wPlayerBattleStatus1 ld a, [hl] @@ -4607,7 +4607,7 @@ CriticalHitTest: dec hl ld c, [hl] ; read move id ld a, [de] - bit GETTING_PUMPED, a ; test for focus energy + bit GETTING_PUMPED, a ; test for focus energy jr nz, .focusEnergyUsed ; bug: using focus energy causes a shift to the right instead of left, ; resulting in 1/4 the usual crit chance sla b ; (effective (base speed/2)*2) @@ -5932,7 +5932,7 @@ CheckEnemyStatusConditions: bit PAR, [hl] jr z, .checkIfUsingBide call BattleRandom - cp $3f ; 25% to be fully paralysed + cp 25 percent ; chance to be fully paralysed jr nc, .checkIfUsingBide ld hl, FullyParalyzedText call PrintText diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index 91bb9ee0..c68d6731 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -98,10 +98,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 @@ -548,7 +548,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 @@ -557,7 +557,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 @@ -979,9 +979,9 @@ FlinchSideEffect: .flinchSideEffect 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 @@ -1111,7 +1111,7 @@ RecoilEffect: ConfusionSideEffect: call BattleRandom - cp $19 ; ~10% chance + cp 10 percent ; chance of confusion ret nc jr ConfusionSideEffectSuccess -- cgit v1.2.3 From 2ee8ce26da2d8195be9440335323d7ad9f9a168d Mon Sep 17 00:00:00 2001 From: Rangi Date: Wed, 3 Nov 2021 17:07:08 -0400 Subject: Comment on the CooltrainerFAI bug Fixes #308 --- engine/battle/trainer_ai.asm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engine') diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index 0117a057..2ef60f5b 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -342,7 +342,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 -- cgit v1.2.3 From 8349bfd8e646002105dfd6a7f997c26cf0e0624b Mon Sep 17 00:00:00 2001 From: Yoann Fievez Date: Fri, 5 Nov 2021 20:40:15 +0100 Subject: Refactorize check button pressed (#340) --- engine/battle/core.asm | 6 +++--- engine/events/cinnabar_lab.asm | 2 +- engine/events/hidden_objects/bills_house_pc.asm | 2 +- engine/events/hidden_objects/school_blackboard.asm | 8 ++++---- engine/events/prize_menu.asm | 2 +- engine/events/vending_machine.asm | 2 +- engine/link/cable_club.asm | 22 +++++++++++----------- engine/menus/main_menu.asm | 14 +++++++------- engine/menus/pc.asm | 2 +- engine/menus/pokedex.asm | 12 ++++++------ engine/menus/save.asm | 2 +- engine/menus/start_sub_menus.asm | 4 ++-- engine/menus/text_box.asm | 10 +++++----- engine/pokemon/bills_pc.asm | 6 +++--- engine/pokemon/learn_move.asm | 2 +- 15 files changed, 48 insertions(+), 48 deletions(-) (limited to 'engine') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 57303776..6c0585b6 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -2087,7 +2087,7 @@ DisplayBattleMenu:: ld [hli], a ; wMaxMenuItem ld [hl], D_RIGHT | A_BUTTON ; wMenuWatchedKeys call HandleMenuInput - bit 4, a ; check if right was pressed + bit BIT_D_RIGHT, a jr nz, .rightColumn jr .AButtonPressed ; the A button was pressed .rightColumn ; put cursor in right column of menu @@ -2350,7 +2350,7 @@ PartyMenuOrRockOrRun: xor a ld [hl], a ; wLastMenuItem call HandleMenuInput - bit 1, a ; was A pressed? + bit BIT_B_BUTTON, a jr nz, .partyMonDeselected ; if B was pressed, jump ; A was pressed call PlaceUnfilledArrowMenuCursor @@ -6745,7 +6745,7 @@ DetermineWildOpponent: bit 1, a jr z, .asm_3ef2f ldh a, [hJoyHeld] - bit 1, a ; B button pressed? + bit BIT_B_BUTTON, a ret nz .asm_3ef2f ld a, [wNumberOfNoRandomBattleStepsLeft] 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 a73596b4..6147387a 100644 --- a/engine/events/hidden_objects/bills_house_pc.asm +++ b/engine/events/hidden_objects/bills_house_pc.asm @@ -95,7 +95,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 de4700d4..fd3c0b8f 100644 --- a/engine/events/hidden_objects/school_blackboard.asm +++ b/engine/events/hidden_objects/school_blackboard.asm @@ -36,7 +36,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" @@ -122,9 +122,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 @@ -137,7 +137,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 d9320fe7..bc3aab9a 100644 --- a/engine/events/prize_menu.asm +++ b/engine/events/prize_menu.asm @@ -31,7 +31,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 a67f1c07..980a45c5 100644 --- a/engine/events/vending_machine.asm +++ b/engine/events/vending_machine.asm @@ -31,7 +31,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/link/cable_club.asm b/engine/link/cable_club.asm index f3bf3b5d..cabc19ab 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -345,7 +345,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] @@ -364,7 +364,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 @@ -384,7 +384,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 @@ -412,7 +412,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 @@ -422,7 +422,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 @@ -444,7 +444,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 @@ -488,7 +488,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 @@ -503,9 +503,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 @@ -554,9 +554,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 95404cce..c3366b8e 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -66,7 +66,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 @@ -477,11 +477,11 @@ DisplayOptionMenu: ld b, a and A_BUTTON | B_BUTTON | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ; any key besides select pressed? jr z, .getJoypadStateLoop - bit 1, b ; B button pressed? + bit BIT_B_BUTTON, b jr nz, .exitMenu - bit 3, b ; Start button pressed? + bit BIT_START, b jr nz, .exitMenu - bit 0, b ; A button pressed? + bit BIT_A_BUTTON, b jr z, .checkDirectionKeys ld a, [wTopMenuItemY] cp 16 ; is the cursor on Cancel? @@ -496,9 +496,9 @@ DisplayOptionMenu: jp .loop .checkDirectionKeys ld a, [wTopMenuItemY] - bit 7, b ; Down pressed? + bit BIT_D_DOWN, b jr nz, .downPressed - bit 6, b ; Up pressed? + bit BIT_D_UP, b jr nz, .upPressed cp 8 ; cursor in Battle Animation section? jr z, .cursorInBattleAnimation @@ -507,7 +507,7 @@ DisplayOptionMenu: cp 16 ; cursor on Cancel? jr z, .loop .cursorInTextSpeed - bit 5, b ; Left pressed? + bit BIT_D_LEFT, b jp nz, .pressedLeftInTextSpeed jp .pressedRightInTextSpeed .downPressed 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/pokedex.asm b/engine/menus/pokedex.asm index 2af8d714..3411f729 100644 --- a/engine/menus/pokedex.asm +++ b/engine/menus/pokedex.asm @@ -95,7 +95,7 @@ HandlePokedexSideMenu: ld [wMenuWatchMovingOutOfBounds], a .handleMenuInput call HandleMenuInput - bit 1, a ; was the B button pressed? + bit BIT_B_BUTTON, a ld b, 2 jr nz, .buttonBPressed ld a, [wCurrentMenuItem] @@ -284,10 +284,10 @@ HandlePokedexListMenu: call Delay3 call GBPalNormal call HandleMenuInput - bit 1, a ; was the B button pressed? + bit BIT_B_BUTTON, a jp nz, .buttonBPressed .checkIfUpPressed - bit 6, a ; was Up pressed? + bit BIT_D_UP, a jr z, .checkIfDownPressed .upPressed ; scroll up one row ld a, [wListScrollOffset] @@ -297,7 +297,7 @@ HandlePokedexListMenu: ld [wListScrollOffset], a jp .loop .checkIfDownPressed - bit 7, a ; was Down pressed? + bit BIT_D_DOWN, a jr z, .checkIfRightPressed .downPressed ; scroll down one row ld a, [wDexMaxSeenMon] @@ -312,7 +312,7 @@ HandlePokedexListMenu: ld [wListScrollOffset], a jp .loop .checkIfRightPressed - bit 4, a ; was Right pressed? + bit BIT_D_RIGHT, a jr z, .checkIfLeftPressed .rightPressed ; scroll down 7 rows ld a, [wDexMaxSeenMon] @@ -330,7 +330,7 @@ HandlePokedexListMenu: ld [wListScrollOffset], a jp .loop .checkIfLeftPressed ; scroll up 7 rows - bit 5, a ; was Left pressed? + bit BIT_D_LEFT, a jr z, .buttonAPressed .leftPressed ld a, [wListScrollOffset] diff --git a/engine/menus/save.asm b/engine/menus/save.asm index 07eb5acb..83a5ca9b 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -356,7 +356,7 @@ ChangeBox:: call HandleMenuInput ld hl, hUILayoutFlags res 1, [hl] - bit 1, a ; pressed b + bit BIT_B_BUTTON, a ret nz call GetBoxSRAMLocation ld e, l diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm index cd1e6da6..dbc6ab89 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] @@ -360,7 +360,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/text_box.asm b/engine/menus/text_box.asm index 5253ec48..cdb8841d 100644 --- a/engine/menus/text_box.asm +++ b/engine/menus/text_box.asm @@ -174,9 +174,9 @@ DoBuySellQuitMenu: ld [wd730], a call HandleMenuInput call PlaceUnfilledArrowMenuCursor - bit 0, a ; was A pressed? + bit BIT_A_BUTTON, a jr nz, .pressedA - bit 1, a ; was B pressed? (always true since only A/B are watched) + bit BIT_B_BUTTON, a ; always true since only A/B are watched jr z, .pressedA ld a, CANCELLED_MENU ld [wMenuExitMethod], a @@ -296,8 +296,8 @@ DisplayTwoOptionMenu: pop hl .noYesMenuInputLoop call HandleMenuInput - bit 1, a ; A button pressed? - jr nz, .noYesMenuInputLoop ; try again if A was not pressed + bit BIT_B_BUTTON, a + jr nz, .noYesMenuInputLoop ; try again if B was not pressed pop af pop hl ld [wFlags_0xcd60], a @@ -309,7 +309,7 @@ DisplayTwoOptionMenu: ld [wTwoOptionMenuID], a call HandleMenuInput pop hl - bit 1, a ; A button pressed? + bit BIT_B_BUTTON, a jr nz, .choseSecondMenuItem ; automatically choose the second option if B is pressed .pressedAButton ld a, [wCurrentMenuItem] diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index 7aba8001..8684b761 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -171,8 +171,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 @@ -416,7 +416,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 fd92ec57..0377caa4 100644 --- a/engine/pokemon/learn_move.asm +++ b/engine/pokemon/learn_move.asm @@ -155,7 +155,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] -- cgit v1.2.3 From f68af5c6e95a11daa3bc8daaf28c4e9a779615b9 Mon Sep 17 00:00:00 2001 From: Yoann Fievez Date: Sat, 6 Nov 2021 00:45:09 +0100 Subject: Add some constants for options (#344) Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com> --- engine/battle/animations.asm | 2 +- engine/battle/core.asm | 2 +- engine/battle/move_effects/substitute.asm | 2 +- engine/debug/debug_menu.asm | 2 +- engine/menus/main_menu.asm | 13 ++++++------- 5 files changed, 10 insertions(+), 11 deletions(-) (limited to 'engine') diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index a93af9e9..476e937f 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -395,7 +395,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 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 6c0585b6..efcba34b 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1372,7 +1372,7 @@ EnemySendOutFirstMon: cp LINK_STATE_BATTLING jr z, .next4 ld a, [wOptions] - bit 6, a + bit BIT_BATTLE_SHIFT, a jr nz, .next4 ld hl, TrainerAboutToUseText call PrintText 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/debug/debug_menu.asm b/engine/debug/debug_menu.asm index 02280db0..f2297129 100644 --- a/engine/debug/debug_menu.asm +++ b/engine/debug/debug_menu.asm @@ -26,7 +26,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/menus/main_menu.asm b/engine/menus/main_menu.asm index c3366b8e..7e4cc9be 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -125,9 +125,9 @@ MainMenu: jp SpecialEnterMap InitOptions: - ld a, 1 ; no delay + ld a, TEXT_DELAY_FAST ld [wLetterPrintingDelayFlags], a - ld a, 3 ; medium speed + ld a, TEXT_DELAY_MEDIUM ld [wOptions], a ret @@ -678,11 +678,10 @@ SetCursorPositionsFromOptions: ; 00: X coordinate of menu cursor ; 01: delay after printing a letter (in frames) TextSpeedOptionData: - db 14, 5 ; Slow - db 7, 3 ; Medium - db 1, 1 ; Fast - db 7 ; default X coordinate (Medium) - db -1 ; end + db 14, TEXT_DELAY_SLOW + db 7, TEXT_DELAY_MEDIUM + db 1, TEXT_DELAY_FAST + db 7, -1 ; end (default X coordinate) CheckForPlayerNameInSRAM: ; Check if the player name data in SRAM has a string terminator character -- cgit v1.2.3 From 09e92c554c7563b52a9484b26d96d903c7635b0d Mon Sep 17 00:00:00 2001 From: Rangi Date: Tue, 23 Nov 2021 21:00:07 -0500 Subject: Use ~X instead of $ff ^ X --- engine/battle/core.asm | 4 ++-- engine/battle/move_effects/haze.asm | 2 +- engine/debug/debug_party.asm | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'engine') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index efcba34b..4a166f7e 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -3433,7 +3433,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 @@ -5940,7 +5940,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/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/debug/debug_party.asm b/engine/debug/debug_party.asm index 17baa7ef..36eb8e6f 100644 --- a/engine/debug/debug_party.asm +++ b/engine/debug/debug_party.asm @@ -46,7 +46,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 SetIshiharaTeam -- cgit v1.2.3