summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/main.yml13
-rw-r--r--INSTALL.md22
-rw-r--r--Makefile2
-rw-r--r--audio/wave_instruments.asm10
-rw-r--r--constants/item_constants.asm2
-rw-r--r--constants/misc_constants.asm9
-rw-r--r--data/trainers/move_choices.asm2
-rw-r--r--engine/battle/animations.asm6
-rw-r--r--engine/battle/core.asm4
-rw-r--r--engine/battle/effects.asm14
-rw-r--r--engine/battle/move_effects/haze.asm2
-rw-r--r--engine/battle/move_effects/substitute.asm2
-rw-r--r--engine/battle/trainer_ai.asm3
-rw-r--r--engine/debug/debug_menu.asm2
-rw-r--r--engine/debug/debug_party.asm2
-rw-r--r--engine/events/cinnabar_lab.asm2
-rw-r--r--engine/events/hidden_objects/bills_house_pc.asm2
-rw-r--r--engine/events/hidden_objects/school_blackboard.asm8
-rw-r--r--engine/events/prize_menu.asm2
-rw-r--r--engine/events/vending_machine.asm2
-rw-r--r--engine/gfx/palettes.asm23
-rw-r--r--engine/link/cable_club.asm22
-rw-r--r--engine/menus/main_menu.asm6
-rw-r--r--engine/menus/pc.asm2
-rw-r--r--engine/menus/save.asm2
-rw-r--r--engine/menus/start_sub_menus.asm4
-rw-r--r--engine/menus/unused_input.asm2
-rw-r--r--engine/pokemon/bills_pc.asm6
-rw-r--r--engine/pokemon/learn_move.asm2
-rw-r--r--home/hidden_objects.asm2
-rw-r--r--home/lcd.asm2
-rw-r--r--home/list_menu.asm16
-rw-r--r--home/overworld.asm12
-rw-r--r--home/pokemon.asm2
-rw-r--r--home/print_text.asm4
-rw-r--r--home/start_menu.asm8
-rw-r--r--home/text_script.asm2
-rw-r--r--home/window.asm4
-rw-r--r--macros/asserts.asm8
-rw-r--r--macros/const.asm10
-rw-r--r--macros/data.asm31
-rw-r--r--macros/scripts/events.asm12
-rw-r--r--macros/scripts/gfx_anims.asm2
-rw-r--r--macros/scripts/maps.asm8
-rw-r--r--rgbdscheck.asm4
-rw-r--r--scripts/BillsHouse.asm2
-rw-r--r--scripts/MtMoonB2F.asm6
-rw-r--r--scripts/OaksLab.asm8
-rw-r--r--scripts/PalletTown.asm6
-rw-r--r--scripts/PokemonTower7F.asm6
-rw-r--r--scripts/ViridianCity.asm2
-rw-r--r--scripts/ViridianCity2.asm2
-rw-r--r--sram.asm2
53 files changed, 179 insertions, 162 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index a3fd4456..c1052183 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -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:
diff --git a/INSTALL.md b/INSTALL.md
index b156c156..0719c0d4 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -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/
```
diff --git a/Makefile b/Makefile
index a5a6af77..675a75e7 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/audio/wave_instruments.asm b/audio/wave_instruments.asm
index 89536a35..842fafd9 100644
--- a/audio/wave_instruments.asm
+++ b/audio/wave_instruments.asm
@@ -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
diff --git a/constants/item_constants.asm b/constants/item_constants.asm
index 36ce7f7b..0d462f2e 100644
--- a/constants/item_constants.asm
+++ b/constants/item_constants.asm
@@ -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
diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm
index 1bb32f8e..4aff58da 100644
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -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
diff --git a/data/trainers/move_choices.asm b/data/trainers/move_choices.asm
index d80722b1..4f694cce 100644
--- a/data/trainers/move_choices.asm
+++ b/data/trainers/move_choices.asm
@@ -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
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]
diff --git a/home/hidden_objects.asm b/home/hidden_objects.asm
index 0003022b..d22bd3d8 100644
--- a/home/hidden_objects.asm
+++ b/home/hidden_objects.asm
@@ -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)
diff --git a/home/lcd.asm b/home/lcd.asm
index 72fc70ed..5c496824 100644
--- a/home/lcd.asm
+++ b/home/lcd.asm
@@ -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
diff --git a/home/list_menu.asm b/home/list_menu.asm
index a7398135..13bcec59 100644
--- a/home/list_menu.asm
+++ b/home/list_menu.asm
@@ -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
diff --git a/home/overworld.asm b/home/overworld.asm
index 50edcf74..e9ef2fc0 100644
--- a/home/overworld.asm
+++ b/home/overworld.asm
@@ -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
diff --git a/home/pokemon.asm b/home/pokemon.asm
index 93b536ff..0e28df50 100644
--- a/home/pokemon.asm
+++ b/home/pokemon.asm
@@ -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
diff --git a/home/print_text.asm b/home/print_text.asm
index 049ddfb4..962ae519 100644
--- a/home/print_text.asm
+++ b/home/print_text.asm
@@ -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
diff --git a/home/start_menu.asm b/home/start_menu.asm
index 8edccfe2..12c9685c 100644
--- a/home/start_menu.asm
+++ b/home/start_menu.asm
@@ -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
diff --git a/home/text_script.asm b/home/text_script.asm
index 5ef9f9fa..7ebbcbed 100644
--- a/home/text_script.asm
+++ b/home/text_script.asm
@@ -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::
diff --git a/home/window.asm b/home/window.asm
index 1be272f9..a3c313c0 100644
--- a/home/window.asm
+++ b/home/window.asm
@@ -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
diff --git a/macros/asserts.asm b/macros/asserts.asm
index 946add28..df2cdcd4 100644
--- a/macros/asserts.asm
+++ b/macros/asserts.asm
@@ -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
diff --git a/macros/const.asm b/macros/const.asm
index 3df9ecd8..afbde7bc 100644
--- a/macros/const.asm
+++ b/macros/const.asm
@@ -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
diff --git a/macros/data.asm b/macros/data.asm
index 9d8a4406..58e8f740 100644
--- a/macros/data.asm
+++ b/macros/data.asm
@@ -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
diff --git a/macros/scripts/events.asm b/macros/scripts/events.asm
index a5f7113d..81404ade 100644
--- a/macros/scripts/events.asm
+++ b/macros/scripts/events.asm
@@ -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
diff --git a/macros/scripts/gfx_anims.asm b/macros/scripts/gfx_anims.asm
index f475ad8d..9ba1e61c 100644
--- a/macros/scripts/gfx_anims.asm
+++ b/macros/scripts/gfx_anims.asm
@@ -5,7 +5,7 @@ frame: MACRO
x = \2
IF _NARG > 2
REPT _NARG - 2
-x = x | (\3 << 1)
+x |= \3 << 1
shift
ENDR
ENDC
diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm
index 12bc3c77..bae8fd07 100644
--- a/macros/scripts/maps.asm
+++ b/macros/scripts/maps.asm
@@ -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
diff --git a/rgbdscheck.asm b/rgbdscheck.asm
index 4514bd69..ae3423b3 100644
--- a/rgbdscheck.asm
+++ b/rgbdscheck.asm
@@ -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__)
diff --git a/scripts/BillsHouse.asm b/scripts/BillsHouse.asm
index 8559c0b1..a19317d5 100644
--- a/scripts/BillsHouse.asm
+++ b/scripts/BillsHouse.asm
@@ -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
diff --git a/scripts/MtMoonB2F.asm b/scripts/MtMoonB2F.asm
index 83601218..491ecae3 100644
--- a/scripts/MtMoonB2F.asm
+++ b/scripts/MtMoonB2F.asm
@@ -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
diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm
index 70f00d94..84faa0cd 100644
--- a/scripts/OaksLab.asm
+++ b/scripts/OaksLab.asm
@@ -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
diff --git a/scripts/PalletTown.asm b/scripts/PalletTown.asm
index e7cc1f7a..3a80739e 100644
--- a/scripts/PalletTown.asm
+++ b/scripts/PalletTown.asm
@@ -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
diff --git a/scripts/PokemonTower7F.asm b/scripts/PokemonTower7F.asm
index 984322b6..c9da74f7 100644
--- a/scripts/PokemonTower7F.asm
+++ b/scripts/PokemonTower7F.asm
@@ -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
diff --git a/scripts/ViridianCity.asm b/scripts/ViridianCity.asm
index d960b9cb..44d7b780 100644
--- a/scripts/ViridianCity.asm
+++ b/scripts/ViridianCity.asm
@@ -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
diff --git a/scripts/ViridianCity2.asm b/scripts/ViridianCity2.asm
index c2e8254e..55f1a79d 100644
--- a/scripts/ViridianCity2.asm
+++ b/scripts/ViridianCity2.asm
@@ -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
diff --git a/sram.asm b/sram.asm
index a4c9a38c..776610c5 100644
--- a/sram.asm
+++ b/sram.asm
@@ -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