Merge remote-tracking branch 'remotes/pokered/master'

This commit is contained in:
Rangi 2021-11-23 21:19:29 -05:00
commit 7574e186e7
53 changed files with 179 additions and 162 deletions

View File

@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@master
with:
path: rgbds
ref: v0.5.1
ref: v0.5.2
repository: gbdev/rgbds
- name: Install rgbds
@ -29,6 +29,7 @@ jobs:
rm -rf rgbds
- name: Compare
if: ${{ github.repository_owner == 'pret' }}
run: |
make DEBUG=1 -j$(nproc) compare
if ! git diff-index --quiet HEAD --; then
@ -37,6 +38,16 @@ jobs:
return 1
fi
- name: Make
if: ${{ github.repository_owner != 'pret' }}
run: |
make -j$(nproc)
if ! git diff-index --quiet HEAD --; then
echo 'Uncommitted changes detected:'
git diff-index HEAD --
return 1
fi
- name: Discord webhook
if: ${{ github.event_name == 'push' && github.repository_owner == 'pret' }}
env:

View File

@ -42,9 +42,9 @@ Run setup and leave the default settings. At the "**Select Packages**" step, cho
Double click on the text that says "**Skip**" next to each package to select the most recent version to install.
Then follow the [**rgbds** install instructions](https://rgbds.gbdev.io/install/windows) for Windows with Cygwin to install **rgbds 0.5.1**.
Then follow the [**rgbds** install instructions](https://rgbds.gbdev.io/install/windows) for Windows with Cygwin to install **rgbds 0.5.2**.
**Note:** If you already have an older rgbds, you will need to update to 0.5.1. Ignore this if you have never installed rgbds before. If a version newer than 0.5.1 does not work, try downloading 0.5.1.
**Note:** If you already have an older rgbds, you will need to update to 0.5.2. Ignore this if you have never installed rgbds before. If a version newer than 0.5.2 does not work, try downloading 0.5.2.
Now open the **Cygwin terminal** and enter the following commands.
@ -67,7 +67,7 @@ Install [**Homebrew**](https://brew.sh/). Follow the official instructions.
Open **Terminal** and prepare to enter commands.
Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/macos) for macOS to install **rgbds 0.5.1**.
Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/macos) for macOS to install **rgbds 0.5.2**.
Now you're ready to [build **pokeyellow**](#build-pokeyellow).
@ -84,7 +84,7 @@ To install the software required for **pokeyellow**:
sudo apt-get install make gcc git
```
Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.5.1** from source.
Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.5.2** from source.
### OpenSUSE
@ -94,7 +94,7 @@ To install the software required for **pokeyellow**:
sudo zypper install make gcc git
```
Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.5.1** from source.
Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.5.2** from source.
### Arch Linux
@ -104,9 +104,9 @@ To install the software required for **pokeyellow**:
sudo pacman -S make gcc git
```
Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/arch) for Arch Linux to install **rgbds 0.5.1**.
Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/arch) for Arch Linux to install **rgbds 0.5.2**.
If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.5.1** from source.
If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.5.2** from source.
### Termux
@ -122,7 +122,7 @@ To install **rgbds**:
sudo apt install rgbds
```
If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.5.1** from source.
If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.5.2** from source.
### Other distros
@ -133,7 +133,7 @@ If your distro is not listed here, try to find the required software in its repo
- `git`
- `rgbds`
If `rgbds` is not available, you'll need to follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.5.1** from source.
If `rgbds` is not available, you'll need to follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.5.2** from source.
Now you're ready to [build **pokeyellow**](#build-pokeyellow).
@ -155,8 +155,8 @@ make
### Build with a local rgbds version
If you have different projects that require different versions of `rgbds`, it might not be convenient to install rgbds 0.5.1 globally. Instead, you can put its files in a directory within pokeyellow, such as `pokeyellow/rgbds-0.5.1/`. Then specify it when you run `make`:
If you have different projects that require different versions of `rgbds`, it might not be convenient to install rgbds 0.5.2 globally. Instead, you can put its files in a directory within pokeyellow, such as `pokeyellow/rgbds-0.5.2/`. Then specify it when you run `make`:
```bash
make RGBDS=rgbds-0.5.1/
make RGBDS=rgbds-0.5.2/
```

View File

@ -58,7 +58,7 @@ tools:
$(MAKE) -C tools/
RGBASMFLAGS = -h -L -Weverything
RGBASMFLAGS = -h -L -Weverything -Wnumeric-string=2 -Wtruncation=1
# Create a sym/map for debug purposes if `make` run with `DEBUG=1`
ifeq ($(DEBUG),1)
RGBASMFLAGS += -E

View File

@ -14,19 +14,19 @@
; the graph of the wave
; the current instrument is copied to rWave_0--rWave_f
.wave0
db $02,$46,$8A,$CE,$FF,$FE,$ED,$DC,$CB,$A9,$87,$65,$44,$33,$22,$11
dn 0, 2, 4, 6, 8, 10, 12, 14, 15, 15, 15, 14, 14, 13, 13, 12, 12, 11, 10, 9, 8, 7, 6, 5, 4, 4, 3, 3, 2, 2, 1, 1
.wave1
db $02,$46,$8A,$CE,$EF,$FF,$FE,$EE,$DD,$CB,$A9,$87,$65,$43,$22,$11
dn 0, 2, 4, 6, 8, 10, 12, 14, 14, 15, 15, 15, 15, 14, 14, 14, 13, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 2, 1, 1
.wave2
db $13,$69,$BD,$EE,$EE,$FF,$FF,$ED,$DE,$FF,$FF,$EE,$EE,$DB,$96,$31
dn 1, 3, 6, 9, 11, 13, 14, 14, 14, 14, 15, 15, 15, 15, 14, 13, 13, 14, 15, 15, 15, 15, 14, 14, 14, 14, 13, 11, 9, 6, 3, 1
.wave3
db $02,$46,$8A,$CD,$EF,$FE,$DE,$FF,$EE,$DC,$BA,$98,$76,$54,$32,$10
dn 0, 2, 4, 6, 8, 10, 12, 13, 14, 15, 15, 14, 13, 14, 15, 15, 14, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
.wave4
db $01,$23,$45,$67,$8A,$CD,$EE,$F7,$7F,$EE,$DC,$A8,$76,$54,$32,$10
dn 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 13, 14, 14, 15, 7, 7, 15, 14, 14, 13, 12, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0
; duty 5 reads from sfx data
.wave5

View File

@ -122,7 +122,7 @@ __tmhm_value__ = NUM_TMS + 1
add_tmnum: MACRO
\1_TMNUM EQU __tmhm_value__
__tmhm_value__ = __tmhm_value__ + 1
__tmhm_value__ += 1
ENDM
add_hm: MACRO

View File

@ -7,3 +7,12 @@ TRUE EQU 1
const FLAG_RESET ; 0
const FLAG_SET ; 1
const FLAG_TEST ; 2
; wOptions
TEXT_DELAY_FAST EQU %001 ; 1
TEXT_DELAY_MEDIUM EQU %011 ; 3
TEXT_DELAY_SLOW EQU %101 ; 5
const_def 6
const BIT_BATTLE_SHIFT ; 6
const BIT_BATTLE_ANIMATION ; 7

View File

@ -3,7 +3,7 @@ move_choices: MACRO
db \# ; all args
ENDC
db 0 ; end
list_index = list_index + 1
list_index += 1
ENDM
; move choice modification methods that are applied for each trainer class

View File

@ -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?

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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]

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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?

View File

@ -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

View File

@ -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, " "

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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]

View File

@ -6,7 +6,7 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor::
ldh a, [hLoadedROMBank]
push af
ldh a, [hJoyHeld]
bit 0, a ; A button
bit BIT_A_BUTTON, a
jr z, .nothingFound
; A button is pressed
ld a, BANK(CheckForHiddenObject)

View File

@ -12,7 +12,7 @@ DisableLCD::
jr nz, .wait
ldh a, [rLCDC]
and $ff ^ rLCDC_ENABLE_MASK
and ~rLCDC_ENABLE_MASK
ldh [rLCDC], a
ld a, b
ldh [rIE], a

View File

@ -84,7 +84,7 @@ DisplayListMenuIDLoop::
push af
call PlaceMenuCursor
pop af
bit 0, a ; was the A button pressed?
bit BIT_A_BUTTON, a
jp z, .checkOtherKeys
.buttonAPressed
ld a, [wCurrentMenuItem]
@ -168,12 +168,12 @@ DisplayListMenuIDLoop::
res 6, [hl] ; turn on letter printing delay
jp BankswitchBack
.checkOtherKeys ; check B, SELECT, Up, and Down keys
bit 1, a ; was the B button pressed?
bit BIT_B_BUTTON, a
jp nz, ExitListMenu ; if so, exit the menu
bit 2, a ; was the select button pressed?
bit BIT_SELECT, a
jp nz, HandleItemListSwapping ; if so, allow the player to swap menu entries
ld b, a
bit 7, b ; was Down pressed?
bit BIT_D_DOWN, b
ld hl, wListScrollOffset
jr z, .upPressed
.downPressed
@ -218,13 +218,13 @@ DisplayChooseQuantityMenu::
.waitForKeyPressLoop
call JoypadLowSensitivity
ldh a, [hJoyPressed] ; newly pressed buttons
bit 0, a ; was the A button pressed?
bit BIT_A_BUTTON, a
jp nz, .buttonAPressed
bit 1, a ; was the B button pressed?
bit BIT_B_BUTTON, a
jp nz, .buttonBPressed
bit 6, a ; was Up pressed?
bit BIT_D_UP, a
jr nz, .incrementQuantity
bit 7, a ; was Down pressed?
bit BIT_D_DOWN, a
jr nz, .decrementQuantity
jr .waitForKeyPressLoop
.incrementQuantity

View File

@ -73,14 +73,14 @@ OverworldLoopLessDelay::
.notSimulating
ldh a, [hJoyPressed]
.checkIfStartIsPressed
bit 3, a ; start button
bit BIT_START, a
jr z, .startButtonNotPressed
; if START is pressed
xor a ; TEXT_START_MENU
ldh [hSpriteIndexOrTextID], a
jp .displayDialogue
.startButtonNotPressed
bit 0, a ; A button
bit BIT_A_BUTTON, a
jp z, .checkIfDownButtonIsPressed
; if A is pressed
ld a, [wd730]
@ -142,7 +142,7 @@ OverworldLoopLessDelay::
.checkIfDownButtonIsPressed
ldh a, [hJoyHeld] ; current joypad state
bit 7, a ; down button
bit BIT_D_DOWN, a
jr z, .checkIfUpButtonIsPressed
ld a, 1
ld [wSpritePlayerStateData1YStepVector], a
@ -150,7 +150,7 @@ OverworldLoopLessDelay::
jr .handleDirectionButtonPress
.checkIfUpButtonIsPressed
bit 6, a ; up button
bit BIT_D_UP, a
jr z, .checkIfLeftButtonIsPressed
ld a, -1
ld [wSpritePlayerStateData1YStepVector], a
@ -158,7 +158,7 @@ OverworldLoopLessDelay::
jr .handleDirectionButtonPress
.checkIfLeftButtonIsPressed
bit 5, a ; left button
bit BIT_D_LEFT, a
jr z, .checkIfRightButtonIsPressed
ld a, -1
ld [wSpritePlayerStateData1XStepVector], a
@ -166,7 +166,7 @@ OverworldLoopLessDelay::
jr .handleDirectionButtonPress
.checkIfRightButtonIsPressed
bit 4, a ; right button
bit BIT_D_RIGHT, a
jr z, .noDirectionButtonsPressed
ld a, 1
ld [wSpritePlayerStateData1XStepVector], a

View File

@ -299,7 +299,7 @@ HandlePartyMenuInput::
scf
ret
.swappingPokemon
bit 1, b ; was the B button pressed?
bit BIT_B_BUTTON, b
jr z, .handleSwap ; if not, handle swapping the pokemon
.cancelSwap ; if the B button was pressed
farcall ErasePartyMenuCursors

View File

@ -25,11 +25,11 @@ PrintLetterDelay::
call Joypad
ldh a, [hJoyHeld]
.checkAButton
bit 0, a ; is the A button pressed?
bit BIT_A_BUTTON, a
jr z, .checkBButton
jr .endWait
.checkBButton
bit 1, a ; is the B button pressed?
bit BIT_B_BUTTON, a
jr z, .buttonsNotPressed
.endWait
call DelayFrame

View File

@ -15,7 +15,7 @@ RedisplayStartMenu_DoNotDrawStartMenu::
call HandleMenuInput
ld b, a
.checkIfUpPressed
bit 6, a ; was Up pressed?
bit BIT_D_UP, a
jr z, .checkIfDownPressed
ld a, [wCurrentMenuItem] ; menu selection
and a
@ -33,7 +33,7 @@ RedisplayStartMenu_DoNotDrawStartMenu::
call EraseMenuCursor
jr .loop
.checkIfDownPressed
bit 7, a
bit BIT_D_DOWN, a
jr z, .buttonPressed
; if the player pressed tried to go past the bottom item, wrap around to the top
CheckEvent EVENT_GOT_POKEDEX
@ -54,7 +54,7 @@ RedisplayStartMenu_DoNotDrawStartMenu::
ld a, [wCurrentMenuItem]
ld [wBattleAndStartSavedMenuItem], a ; save current menu selection
ld a, b
and %00001010 ; was the Start button or B button pressed?
and B_BUTTON | START ; was the Start button or B button pressed?
jp nz, CloseStartMenu
call SaveScreenTilesToBuffer2 ; copy background from wTileMap to wTileMapBackup2
CheckEvent EVENT_GOT_POKEDEX
@ -79,7 +79,7 @@ RedisplayStartMenu_DoNotDrawStartMenu::
CloseStartMenu::
call Joypad
ldh a, [hJoyPressed]
bit 0, a ; was A button newly pressed?
bit BIT_A_BUTTON, a
jr nz, CloseStartMenu
call LoadTextBoxTilePatterns
jp CloseTextDisplay

View File

@ -97,7 +97,7 @@ AfterDisplayingTextID::
HoldTextDisplayOpen::
call Joypad
ldh a, [hJoyHeld]
bit 0, a ; is the A button being pressed?
bit BIT_A_BUTTON, a
jr nz, HoldTextDisplayOpen
CloseTextDisplay::

View File

@ -50,9 +50,9 @@ HandleMenuInput_::
ld [wCheckFor180DegreeTurn], a
ldh a, [hJoy5]
ld b, a
bit 0, a ; pressed A key?
bit BIT_A_BUTTON, a
jr nz, .checkOtherKeys
bit 6, a ; pressed Up key?
bit BIT_D_UP, a
jr z, .checkIfDownPressed
.upPressed
ld a, [wCurrentMenuItem] ; selected menu item

View File

@ -29,7 +29,7 @@ ENDM
li: MACRO
ASSERT !STRIN(\1, "@"), STRCAT("String terminator \"@\" in list entry: ", \1)
db \1, "@"
list_index = list_index + 1
list_index += 1
ENDM
assert_list_length: MACRO
@ -52,7 +52,7 @@ ENDM
nybble: MACRO
ASSERT 0 <= (\1) && (\1) < $10, "nybbles must be 0-15"
CURRENT_NYBBLE_ARRAY_VALUE = (\1) | (CURRENT_NYBBLE_ARRAY_VALUE << 4)
CURRENT_NYBBLE_ARRAY_LENGTH = CURRENT_NYBBLE_ARRAY_LENGTH + 1
CURRENT_NYBBLE_ARRAY_LENGTH += 1
IF CURRENT_NYBBLE_ARRAY_LENGTH % 2 == 0
db CURRENT_NYBBLE_ARRAY_VALUE
CURRENT_NYBBLE_ARRAY_VALUE = 0
@ -86,8 +86,8 @@ ENDM
dbit: MACRO
ASSERT (\1) == 0 || (\1) == 1, "bits must be 0 or 1"
CURRENT_BIT_ARRAY_VALUE = CURRENT_BIT_ARRAY_VALUE | ((\1) << (CURRENT_BIT_ARRAY_LENGTH % 8))
CURRENT_BIT_ARRAY_LENGTH = CURRENT_BIT_ARRAY_LENGTH + 1
CURRENT_BIT_ARRAY_VALUE |= (\1) << (CURRENT_BIT_ARRAY_LENGTH % 8)
CURRENT_BIT_ARRAY_LENGTH += 1
IF CURRENT_BIT_ARRAY_LENGTH % 8 == 0
db CURRENT_BIT_ARRAY_VALUE
CURRENT_BIT_ARRAY_VALUE = 0

View File

@ -15,19 +15,19 @@ ENDM
const: MACRO
\1 EQU const_value
const_value = const_value + const_inc
const_value += const_inc
ENDM
shift_const: MACRO
\1 EQU (1 << const_value)
const_value = const_value + const_inc
\1 EQU 1 << const_value
const_value += const_inc
ENDM
const_skip: MACRO
if _NARG >= 1
const_value = const_value + const_inc * (\1)
const_value += const_inc * (\1)
else
const_value = const_value + const_inc
const_value += const_inc
endc
ENDM

View File

@ -24,7 +24,7 @@ REPT _NARG
IF DEF(\1_TMNUM)
n = (\1_TMNUM - 1) / 8
i = (\1_TMNUM - 1) % 8
_tm{d:n} = _tm{d:n} | (1 << i)
_tm{d:n} |= 1 << i
ELSE
FAIL "\1 is not a TM or HM move"
ENDC
@ -39,26 +39,35 @@ ENDM
; Constant data (db, dw, dl) macros
dn: MACRO ; nybbles
db (\1 << 4 | \2)
ENDM
dbw: MACRO
db \1
dw \2
ENDM
dba: MACRO
dbw BANK(\1), \1
ENDM
dwb: MACRO
dw \1
db \2
ENDM
dab: MACRO
dn: MACRO ; nybbles
REPT _NARG / 2
db ((\1) << 4) | (\2)
SHIFT 2
ENDR
ENDM
dba: MACRO ; dbw bank, address
REPT _NARG
dbw BANK(\1), \1
SHIFT
ENDR
ENDM
dab: MACRO ; dwb address, bank
REPT _NARG
dwb \1, BANK(\1)
SHIFT
ENDR
ENDM
sine_table: MACRO
@ -66,6 +75,6 @@ sine_table: MACRO
x = 0
REPT \1
dw (sin(x) + (sin(x) & $ff)) >> 8 ; round up
x = x + DIV(32768, \1) ; a circle has 65536 "degrees"
x += DIV(32768, \1) ; a circle has 65536 "degrees"
ENDR
ENDM

View File

@ -292,8 +292,8 @@ event_fill_start = event_start_byte + 1
event_fill_count = event_end_byte - event_start_byte - 1
IF ((\1) % 8) == 0
event_fill_start = event_fill_start - 1
event_fill_count = event_fill_count + 1
event_fill_start -= 1
event_fill_count += 1
ELSE
ld a, [wEventFlags + event_start_byte]
or $ff - ((1 << ((\1) % 8)) - 1)
@ -301,7 +301,7 @@ event_fill_count = event_fill_count + 1
ENDC
IF ((\2) % 8) == 7
event_fill_count = event_fill_count + 1
event_fill_count += 1
ENDC
IF event_fill_count == 1
@ -354,8 +354,8 @@ event_fill_start = event_start_byte + 1
event_fill_count = event_end_byte - event_start_byte - 1
IF ((\1) % 8) == 0
event_fill_start = event_fill_start - 1
event_fill_count = event_fill_count + 1
event_fill_start -= 1
event_fill_count += 1
ELSE
ld a, [wEventFlags + event_start_byte]
and ~($ff - ((1 << ((\1) % 8)) - 1)) & $ff
@ -363,7 +363,7 @@ event_fill_count = event_fill_count + 1
ENDC
IF ((\2) % 8) == 7
event_fill_count = event_fill_count + 1
event_fill_count += 1
ENDC
IF event_fill_count == 1

View File

@ -5,7 +5,7 @@ frame: MACRO
x = \2
IF _NARG > 2
REPT _NARG - 2
x = x | (\3 << 1)
x |= \3 << 1
shift
ENDR
ENDC

View File

@ -29,7 +29,7 @@ object_event: MACRO
ELSE
db \6
ENDC
{_NUM_OBJECT_EVENTS} = {_NUM_OBJECT_EVENTS} + 1
{_NUM_OBJECT_EVENTS} += 1
ENDM
def_warp_events: MACRO
@ -46,7 +46,7 @@ warp_event: MACRO
db \2, \1, \4 - 1, \3
_WARP_{d:{_NUM_WARP_EVENTS}}_X = \1
_WARP_{d:{_NUM_WARP_EVENTS}}_Y = \2
{_NUM_WARP_EVENTS} = {_NUM_WARP_EVENTS} + 1
{_NUM_WARP_EVENTS} += 1
ENDM
def_bg_events: MACRO
@ -60,7 +60,7 @@ ENDM
;\3 sign id
bg_event: MACRO
db \2, \1, \3
{_NUM_BG_EVENTS} = {_NUM_BG_EVENTS} + 1
{_NUM_BG_EVENTS} += 1
ENDM
;\1 source map
@ -101,7 +101,7 @@ _cur_bit = CURRENT_TRAINER_BIT % 8
db \2 << 4
dw wEventFlags + (\1 - CURRENT_TRAINER_BIT) / 8
dw \3, \5, \4, \4
CURRENT_TRAINER_BIT = CURRENT_TRAINER_BIT + 1
CURRENT_TRAINER_BIT += 1
ENDM
;\1 x position

View File

@ -1,9 +1,9 @@
MAJOR EQU 0
MINOR EQU 5
PATCH EQU 1
PATCH EQU 2
wrong_rgbds: MACRO
fail "pokeyellow requires rgbds v0.5.1 or newer."
fail "pokeyellow requires rgbds v0.5.2 or newer."
ENDM
IF !DEF(__RGBDS_MAJOR__) || !DEF(__RGBDS_MINOR__) || !DEF(__RGBDS_PATCH__)

View File

@ -212,7 +212,7 @@ BillsHouseScript7:
ld [wPlayerMovingDirection], a
ld a, SPRITE_FACING_UP
ld [wSpritePlayerStateData1FacingDirection], a
ld a, $FF ^ (A_BUTTON | B_BUTTON)
ld a, ~(A_BUTTON | B_BUTTON)
ld [wJoyIgnore], a
ld de, RLE_1e219
ld hl, wSimulatedJoypadStatesEnd

View File

@ -234,7 +234,7 @@ MtMoon3Script_49e15:
call PlayMusic
xor a
ldh [hJoyHeld], a
ld a, $FF ^ (A_BUTTON | B_BUTTON)
ld a, ~(A_BUTTON | B_BUTTON)
ld [wJoyIgnore], a
ld a, HS_MT_MOON_B2F_JESSIE
call MtMoon3Script_49f84
@ -319,7 +319,7 @@ MtMoon3Script11:
ld a, SPRITE_FACING_LEFT
ld [wSprite06StateData1FacingDirection], a
call Delay3
ld a, $FF ^ (A_BUTTON | B_BUTTON)
ld a, ~(A_BUTTON | B_BUTTON)
ld [wJoyIgnore], a
ld a, $d
ldh [hSpriteIndexOrTextID], a
@ -355,7 +355,7 @@ MtMoon3Script13:
xor a
ld [wSprite02StateData1FacingDirection], a
ld [wSprite06StateData1FacingDirection], a
ld a, $FF ^ (A_BUTTON | B_BUTTON)
ld a, ~(A_BUTTON | B_BUTTON)
ld [wJoyIgnore], a
ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a

View File

@ -231,7 +231,7 @@ OaksLabScript9:
ld a, EEVEE
ld [wd11e], a
call GetMonName
ld a, $FF ^ (A_BUTTON | B_BUTTON)
ld a, ~(A_BUTTON | B_BUTTON)
ld [wJoyIgnore], a
ld a, $11
ldh [hSpriteIndexOrTextID], a
@ -378,7 +378,7 @@ OaksLabScript14:
ld a, b
ld [wRivalStarter], a
ld a, $ff ^ (A_BUTTON | B_BUTTON)
ld a, ~(A_BUTTON | B_BUTTON)
ld [wJoyIgnore], a
ld a, PLAYER_DIR_UP
ld [wPlayerMovingDirection], a
@ -435,7 +435,7 @@ OaksLabScript16:
ld a, [wd730]
bit 0, a
jr nz, .checkRivalPosition
ld a, $ff ^ (A_BUTTON | B_BUTTON)
ld a, ~(A_BUTTON | B_BUTTON)
ld [wJoyIgnore], a
ld a, HS_OAKS_LAB_RIVAL
ld [wMissableObjectIndex], a
@ -539,7 +539,7 @@ OaksLabScript20:
ret nz
call EnableAutoTextBoxDrawing
call PlayDefaultMusic
ld a, $ff ^ (A_BUTTON | B_BUTTON)
ld a, ~(A_BUTTON | B_BUTTON)
ld [wJoyIgnore], a
call OaksLabScript_1c78e
ld a, $14

View File

@ -51,7 +51,7 @@ PalletTownScript0:
ret
PalletTownScript1:
ld a, $FF ^ (A_BUTTON | B_BUTTON)
ld a, ~(A_BUTTON | B_BUTTON)
ld [wJoyIgnore], a
xor a
ld [wcf0d], a
@ -105,7 +105,7 @@ PalletTownScript3:
ld a, [wd730]
bit 0, a
ret nz
ld a, $FF ^ (A_BUTTON | B_BUTTON)
ld a, ~(A_BUTTON | B_BUTTON)
ld [wJoyIgnore], a
ld a, 1
ld [wcf0d], a
@ -135,7 +135,7 @@ PalletTownScript3:
PalletTownScript4:
; start the pikachu battle
ld a, $FF ^ (A_BUTTON | B_BUTTON)
ld a, ~(A_BUTTON | B_BUTTON)
ld [wJoyIgnore], a
xor a
ld [wListScrollOffset], a

View File

@ -54,7 +54,7 @@ PokemonTower7Script_60d2a:
call PlayMusic
xor a
ldh [hJoyHeld], a
ld a, $FF ^ (A_BUTTON | B_BUTTON)
ld a, ~(A_BUTTON | B_BUTTON)
ld [wJoyIgnore], a
ld a, HS_POKEMON_TOWER_7F_JESSIE
call PokemonTower7Script_60eaf
@ -141,7 +141,7 @@ PokemonTower7Script6:
ld [wSprite02StateData1FacingDirection], a
.asm_60dff
call Delay3
ld a, $FF ^ (A_BUTTON | B_BUTTON)
ld a, ~(A_BUTTON | B_BUTTON)
ld [wJoyIgnore], a
ld a, $5
ldh [hSpriteIndexOrTextID], a
@ -176,7 +176,7 @@ PokemonTower7Script8:
xor a
ld [wSprite01StateData1FacingDirection], a
ld [wSprite02StateData1FacingDirection], a
ld a, $FF ^ (A_BUTTON | B_BUTTON)
ld a, ~(A_BUTTON | B_BUTTON)
ld [wJoyIgnore], a
ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a

View File

@ -33,7 +33,7 @@ ViridianCityScript_1905b:
CheckEvent EVENT_VIRIDIAN_GYM_OPEN
ret nz
ld a, [wObtainedBadges]
cp $ff ^ (1 << BIT_EARTHBADGE)
cp ~(1 << BIT_EARTHBADGE)
jr nz, .gym_closed
SetEvent EVENT_VIRIDIAN_GYM_OPEN
ret

View File

@ -10,7 +10,7 @@ ViridianCityText_f18c2:
Func_f18c7::
ld hl, ViridianCityText_19127
ld a, [wObtainedBadges]
cp $ff ^ (1 << BIT_EARTHBADGE)
cp ~(1 << BIT_EARTHBADGE)
jr z, .done
CheckEvent EVENT_BEAT_VIRIDIAN_GYM_GIOVANNI
jr nz, .done

View File

@ -27,7 +27,7 @@ sMainDataCheckSum:: db
box_n = 0
boxes: MACRO
REPT \1
box_n = box_n + 1
box_n += 1
sBox{d:box_n}:: ds wBoxDataEnd - wBoxDataStart
ENDR
ENDM