diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2f26a4d35..03d5dc0de 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.6.1 + ref: v0.7.0 repository: gbdev/rgbds - name: Install rgbds diff --git a/INSTALL.md b/INSTALL.md index a5c7efb5a..101ea8e2c 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#pre-built) for Windows with Cygwin to install **rgbds 0.6.1**. +Then follow the [**rgbds** install instructions](https://rgbds.gbdev.io/install#pre-built) for Windows with Cygwin to install **rgbds 0.7.0**. -**Note:** If you already have an installed rgbds older than 0.6.0, you will need to update to 0.6.0 or 0.6.1. Ignore this if you have never installed rgbds before. If a version newer than 0.6.1 does not work, try downloading 0.6.1. +**Note:** If you already have an installed rgbds older than 0.7.0, you will need to update to 0.7.0. Ignore this if you have never installed rgbds before. If a version newer than 0.7.0 does not work, try downloading 0.7.0. 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#pre-built) for macOS to install **rgbds 0.6.1**. +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#pre-built) for macOS to install **rgbds 0.7.0**. Now you're ready to [build **pokered**](#build-pokered). @@ -84,7 +84,7 @@ To install the software required for **pokered**: sudo apt-get install make gcc git ``` -Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.6.1** from source. +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.7.0** from source. ### OpenSUSE @@ -94,7 +94,7 @@ To install the software required for **pokered**: sudo zypper install make gcc git ``` -Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.6.1** from source. +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.7.0** from source. ### Arch Linux @@ -104,7 +104,7 @@ To install the software required for **pokered**: sudo pacman -S make gcc git rgbds ``` -If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.6.1** from source. +If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.7.0** from source. ### Termux @@ -120,7 +120,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#building-from-source) to build **rgbds 0.6.1** from source. +If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.7.0** from source. ### Other distros @@ -131,7 +131,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#building-from-source) to build **rgbds 0.6.1** from source. +If `rgbds` is not available, you'll need to follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.7.0** from source. Now you're ready to [build **pokered**](#build-pokered). @@ -153,8 +153,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.6.1 globally. Instead, you can put its files in a directory within pokered, such as `pokered/rgbds-0.6.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.7.0 globally. Instead, you can put its files in a directory within pokered, such as `pokered/rgbds-0.7.0/`. Then specify it when you run `make`: ```bash -make RGBDS=rgbds-0.6.1/ +make RGBDS=rgbds-0.7.0/ ``` diff --git a/Makefile b/Makefile index 215aa7687..4f6f4d34b 100644 --- a/Makefile +++ b/Makefile @@ -85,7 +85,7 @@ tools: $(MAKE) -C tools/ -RGBASMFLAGS = -hL -Q8 -P includes.asm -Weverything -Wnumeric-string=2 -Wtruncation=1 +RGBASMFLAGS = -Q8 -P includes.asm -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/constants/hardware_constants.asm b/constants/hardware_constants.asm index 3cca47ae5..f6443fc0f 100644 --- a/constants/hardware_constants.asm +++ b/constants/hardware_constants.asm @@ -2,19 +2,6 @@ DEF GBC EQU $11 -; memory map -DEF VRAM_Begin EQU $8000 -DEF VRAM_End EQU $a000 -DEF SRAM_Begin EQU $a000 -DEF SRAM_End EQU $c000 -DEF WRAM0_Begin EQU $c000 -DEF WRAM0_End EQU $d000 -DEF WRAM1_Begin EQU $d000 -DEF WRAM1_End EQU $e000 -; hardware registers $ff00-$ff80 (see below) -DEF HRAM_Begin EQU $ff80 -DEF HRAM_End EQU $ffff - ; MBC1 DEF MBC1SRamEnable EQU $0000 DEF MBC1RomBank EQU $2000 diff --git a/constants/item_constants.asm b/constants/item_constants.asm index a7132670c..4e09da0c7 100644 --- a/constants/item_constants.asm +++ b/constants/item_constants.asm @@ -52,13 +52,13 @@ DEF SAFARI_ROCK EQU CASCADEBADGE ; overload const DOME_FOSSIL ; $29 const HELIX_FOSSIL ; $2A const SECRET_KEY ; $2B - const ITEM_2C ; $2C + const ITEM_2C ; $2C ; unused const BIKE_VOUCHER ; $2D const X_ACCURACY ; $2E const LEAF_STONE ; $2F const CARD_KEY ; $30 const NUGGET ; $31 - const ITEM_32 ; $32 + const ITEM_32 ; $32 ; unused const POKE_DOLL ; $33 const FULL_HEAL ; $34 const REVIVE ; $35 @@ -215,3 +215,6 @@ DEF NUM_TM_HM EQU NUM_TMS + NUM_HMS ; These fit in 7 bytes, with one unused bit left over. DEF __tmhm_value__ = NUM_TM_HM + 1 DEF UNUSED_TMNUM EQU __tmhm_value__ + +DEF MAX_HIDDEN_ITEMS EQU 112 +DEF MAX_HIDDEN_COINS EQU 16 diff --git a/crysaudio/audio_constants.asm b/crysaudio/audio_constants.asm index 0d854ae5f..acc46c179 100644 --- a/crysaudio/audio_constants.asm +++ b/crysaudio/audio_constants.asm @@ -21,64 +21,64 @@ const CHAN2 ; 1 const CHAN3 ; 2 const CHAN4 ; 3 -NUM_MUSIC_CHANS EQU const_value +DEF NUM_MUSIC_CHANS EQU const_value const CHAN5 ; 4 const CHAN6 ; 5 const CHAN7 ; 6 const CHAN8 ; 7 -NUM_NOISE_CHANS EQU const_value - NUM_MUSIC_CHANS -NUM_CHANNELS EQU const_value +DEF NUM_NOISE_CHANS EQU const_value - NUM_MUSIC_CHANS +DEF NUM_CHANNELS EQU const_value -Ch1 EQU CHAN1 -Ch2 EQU CHAN2 -Ch3 EQU CHAN3 -Ch4 EQU CHAN4 -Ch5 EQU CHAN5 -Ch6 EQU CHAN6 -Ch7 EQU CHAN7 -Ch8 EQU CHAN8 +DEF Ch1 EQU CHAN1 +DEF Ch2 EQU CHAN2 +DEF Ch3 EQU CHAN3 +DEF Ch4 EQU CHAN4 +DEF Ch5 EQU CHAN5 +DEF Ch6 EQU CHAN6 +DEF Ch7 EQU CHAN7 +DEF Ch8 EQU CHAN8 ; channel_struct members (see macros/wram.asm) -CHANNEL_MUSIC_ID EQUS "(wChannel1MusicID - wChannel1)" -CHANNEL_MUSIC_BANK EQUS "(wChannel1MusicBank - wChannel1)" -CHANNEL_FLAGS1 EQUS "(wChannel1Flags1 - wChannel1)" -CHANNEL_FLAGS2 EQUS "(wChannel1Flags2 - wChannel1)" -CHANNEL_FLAGS3 EQUS "(wChannel1Flags3 - wChannel1)" -CHANNEL_MUSIC_ADDRESS EQUS "(wChannel1MusicAddress - wChannel1)" -CHANNEL_LAST_MUSIC_ADDRESS EQUS "(wChannel1LastMusicAddress - wChannel1)" -CHANNEL_NOTE_FLAGS EQUS "(wChannel1NoteFlags - wChannel1)" -CHANNEL_CONDITION EQUS "(wChannel1Condition - wChannel1)" -CHANNEL_DUTY_CYCLE EQUS "(wChannel1DutyCycle - wChannel1)" -CHANNEL_VOLUME_ENVELOPE EQUS "(wChannel1VolumeEnvelope - wChannel1)" -CHANNEL_FREQUENCY EQUS "(wChannel1Frequency - wChannel1)" -CHANNEL_PITCH EQUS "(wChannel1Pitch - wChannel1)" -CHANNEL_OCTAVE EQUS "(wChannel1Octave - wChannel1)" -CHANNEL_TRANSPOSITION EQUS "(wChannel1Transposition - wChannel1)" -CHANNEL_NOTE_DURATION EQUS "(wChannel1NoteDuration - wChannel1)" -CHANNEL_FIELD16 EQUS "(wChannel1Field16 - wChannel1)" -CHANNEL_LOOP_COUNT EQUS "(wChannel1LoopCount - wChannel1)" -CHANNEL_TEMPO EQUS "(wChannel1Tempo - wChannel1)" -CHANNEL_TRACKS EQUS "(wChannel1Tracks - wChannel1)" -CHANNEL_DUTY_CYCLE_PATTERN EQUS "(wChannel1DutyCyclePattern - wChannel1)" -CHANNEL_VIBRATO_DELAY_COUNT EQUS "(wChannel1VibratoDelayCount - wChannel1)" -CHANNEL_VIBRATO_DELAY EQUS "(wChannel1VibratoDelay - wChannel1)" -CHANNEL_VIBRATO_EXTENT EQUS "(wChannel1VibratoExtent - wChannel1)" -CHANNEL_VIBRATO_RATE EQUS "(wChannel1VibratoRate - wChannel1)" -CHANNEL_PITCH_SLIDE_TARGET EQUS "(wChannel1PitchSlideTarget - wChannel1)" -CHANNEL_PITCH_SLIDE_AMOUNT EQUS "(wChannel1PitchSlideAmount - wChannel1)" -CHANNEL_PITCH_SLIDE_AMOUNT_FRACTION EQUS "(wChannel1PitchSlideAmountFraction - wChannel1)" -CHANNEL_FIELD25 EQUS "(wChannel1Field25 - wChannel1)" -CHANNEL_PITCH_OFFSET EQUS "(wChannel1PitchOffset - wChannel1)" -CHANNEL_FIELD29 EQUS "(wChannel1Field29 - wChannel1)" -CHANNEL_FIELD2A EQUS "(wChannel1Field2a - wChannel1)" -CHANNEL_FIELD2C EQUS "(wChannel1Field2c - wChannel1)" -CHANNEL_NOTE_LENGTH EQUS "(wChannel1NoteLength - wChannel1)" -CHANNEL_FIELD2E EQUS "(wChannel1Field2e - wChannel1)" -CHANNEL_FIELD2F EQUS "(wChannel1Field2f - wChannel1)" -CHANNEL_FIELD30 EQUS "(wChannel1Field30 - wChannel1)" -CHANNEL_STRUCT_LENGTH EQUS "(wChannel2 - wChannel1)" +DEF CHANNEL_MUSIC_ID EQUS "(wChannel1MusicID - wChannel1)" +DEF CHANNEL_MUSIC_BANK EQUS "(wChannel1MusicBank - wChannel1)" +DEF CHANNEL_FLAGS1 EQUS "(wChannel1Flags1 - wChannel1)" +DEF CHANNEL_FLAGS2 EQUS "(wChannel1Flags2 - wChannel1)" +DEF CHANNEL_FLAGS3 EQUS "(wChannel1Flags3 - wChannel1)" +DEF CHANNEL_MUSIC_ADDRESS EQUS "(wChannel1MusicAddress - wChannel1)" +DEF CHANNEL_LAST_MUSIC_ADDRESS EQUS "(wChannel1LastMusicAddress - wChannel1)" +DEF CHANNEL_NOTE_FLAGS EQUS "(wChannel1NoteFlags - wChannel1)" +DEF CHANNEL_CONDITION EQUS "(wChannel1Condition - wChannel1)" +DEF CHANNEL_DUTY_CYCLE EQUS "(wChannel1DutyCycle - wChannel1)" +DEF CHANNEL_VOLUME_ENVELOPE EQUS "(wChannel1VolumeEnvelope - wChannel1)" +DEF CHANNEL_FREQUENCY EQUS "(wChannel1Frequency - wChannel1)" +DEF CHANNEL_PITCH EQUS "(wChannel1Pitch - wChannel1)" +DEF CHANNEL_OCTAVE EQUS "(wChannel1Octave - wChannel1)" +DEF CHANNEL_TRANSPOSITION EQUS "(wChannel1Transposition - wChannel1)" +DEF CHANNEL_NOTE_DURATION EQUS "(wChannel1NoteDuration - wChannel1)" +DEF CHANNEL_FIELD16 EQUS "(wChannel1Field16 - wChannel1)" +DEF CHANNEL_LOOP_COUNT EQUS "(wChannel1LoopCount - wChannel1)" +DEF CHANNEL_TEMPO EQUS "(wChannel1Tempo - wChannel1)" +DEF CHANNEL_TRACKS EQUS "(wChannel1Tracks - wChannel1)" +DEF CHANNEL_DUTY_CYCLE_PATTERN EQUS "(wChannel1DutyCyclePattern - wChannel1)" +DEF CHANNEL_VIBRATO_DELAY_COUNT EQUS "(wChannel1VibratoDelayCount - wChannel1)" +DEF CHANNEL_VIBRATO_DELAY EQUS "(wChannel1VibratoDelay - wChannel1)" +DEF CHANNEL_VIBRATO_EXTENT EQUS "(wChannel1VibratoExtent - wChannel1)" +DEF CHANNEL_VIBRATO_RATE EQUS "(wChannel1VibratoRate - wChannel1)" +DEF CHANNEL_PITCH_SLIDE_TARGET EQUS "(wChannel1PitchSlideTarget - wChannel1)" +DEF CHANNEL_PITCH_SLIDE_AMOUNT EQUS "(wChannel1PitchSlideAmount - wChannel1)" +DEF CHANNEL_PITCH_SLIDE_AMOUNT_FRACTION EQUS "(wChannel1PitchSlideAmountFraction - wChannel1)" +DEF CHANNEL_FIELD25 EQUS "(wChannel1Field25 - wChannel1)" +DEF CHANNEL_PITCH_OFFSET EQUS "(wChannel1PitchOffset - wChannel1)" +DEF CHANNEL_FIELD29 EQUS "(wChannel1Field29 - wChannel1)" +DEF CHANNEL_FIELD2A EQUS "(wChannel1Field2a - wChannel1)" +DEF CHANNEL_FIELD2C EQUS "(wChannel1Field2c - wChannel1)" +DEF CHANNEL_NOTE_LENGTH EQUS "(wChannel1NoteLength - wChannel1)" +DEF CHANNEL_FIELD2E EQUS "(wChannel1Field2e - wChannel1)" +DEF CHANNEL_FIELD2F EQUS "(wChannel1Field2f - wChannel1)" +DEF CHANNEL_FIELD30 EQUS "(wChannel1Field30 - wChannel1)" +DEF CHANNEL_STRUCT_LENGTH EQUS "(wChannel2 - wChannel1)" -NOISE_CHAN_F EQU 2 ; bit set in CHAN5-CHAN7 +DEF NOISE_CHAN_F EQU 2 ; bit set in CHAN5-CHAN7 ; Flags1 const_def @@ -116,22 +116,22 @@ NOISE_CHAN_F EQU 2 ; bit set in CHAN5-CHAN7 const NOTE_VIBRATO_OVERRIDE ; 6 ; wVolume -VOLUME_SO1_F EQU 3 -VOLUME_SO2_F EQU 7 -VOLUME_SO1_LEVEL EQU %00000111 -VOLUME_SO2_LEVEL EQU %01110000 -MAX_VOLUME EQU $77 +DEF VOLUME_SO1_F EQU 3 +DEF VOLUME_SO2_F EQU 7 +DEF VOLUME_SO1_LEVEL EQU %00000111 +DEF VOLUME_SO2_LEVEL EQU %01110000 +DEF MAX_VOLUME EQU $77 ; wSoundInput -SOUND_INPUT_CH1_F EQU 0 -SOUND_INPUT_CH2_F EQU 1 -SOUND_INPUT_CH3_F EQU 2 -SOUND_INPUT_CH4_F EQU 3 -SOUND_INPUT_GLOBAL_F EQU 7 +DEF SOUND_INPUT_CH1_F EQU 0 +DEF SOUND_INPUT_CH2_F EQU 1 +DEF SOUND_INPUT_CH3_F EQU 2 +DEF SOUND_INPUT_CH4_F EQU 3 +DEF SOUND_INPUT_GLOBAL_F EQU 7 ; wLowHealthAlarm -DANGER_PITCH_F EQU 4 -DANGER_ON_F EQU 7 +DEF DANGER_PITCH_F EQU 4 +DEF DANGER_ON_F EQU 7 ; wMusicFade -MUSIC_FADE_IN_F EQU 7 +DEF MUSIC_FADE_IN_F EQU 7 diff --git a/crysaudio/macros.asm b/crysaudio/macros.asm index 96fa5831c..039031703 100644 --- a/crysaudio/macros.asm +++ b/crysaudio/macros.asm @@ -147,7 +147,7 @@ ENDM MACRO toggle_sfx db toggle_sfx_cmd ENDM -execute_music EQUS "toggle_sfx" +DEF execute_music EQUS "toggle_sfx" const pitch_slide_cmd ; $e0 MACRO pitch_slide @@ -202,7 +202,7 @@ MACRO pitch_offset db pitch_offset_cmd bigdw \1 ; pitch offset ENDM -toggle_perfect_pitch EQUS "pitch_offset 1" +DEF toggle_perfect_pitch EQUS "pitch_offset 1" const unknownmusic0xe7_cmd ; $e7 MACRO unknownmusic0xe7 diff --git a/data/events/hidden_coins.asm b/data/events/hidden_coins.asm index f2485f505..1fa5af23e 100644 --- a/data/events/hidden_coins.asm +++ b/data/events/hidden_coins.asm @@ -3,6 +3,7 @@ MACRO hidden_coin ENDM HiddenCoinCoords: + table_width 3, HiddenCoinCoords ; map id, x, y hidden_coin GAME_CORNER, 0, 8 hidden_coin GAME_CORNER, 1, 16 @@ -16,4 +17,5 @@ HiddenCoinCoords: hidden_coin GAME_CORNER, 11, 7 hidden_coin GAME_CORNER, 15, 8 hidden_coin GAME_CORNER, 12, 15 + assert_max_table_length MAX_HIDDEN_COINS db -1 ; end diff --git a/data/events/hidden_item_coords.asm b/data/events/hidden_item_coords.asm index 30619d6be..04f0c2f46 100644 --- a/data/events/hidden_item_coords.asm +++ b/data/events/hidden_item_coords.asm @@ -3,6 +3,7 @@ MACRO hidden_item ENDM HiddenItemCoords: + table_width 3, HiddenItemCoords ; map id, x, y hidden_item VIRIDIAN_FOREST, 1, 18 hidden_item VIRIDIAN_FOREST, 16, 42 @@ -58,4 +59,5 @@ HiddenItemCoords: hidden_item VERMILION_CITY, 14, 11 hidden_item CERULEAN_CITY, 15, 8 hidden_item ROUTE_4, 40, 3 + assert_max_table_length MAX_HIDDEN_ITEMS db -1 ; end diff --git a/data/moves/animations.asm b/data/moves/animations.asm index 29a784776..e9fdc34ce 100644 --- a/data/moves/animations.asm +++ b/data/moves/animations.asm @@ -28,7 +28,7 @@ AttackAnimationPointers: dw JumpKickAnim dw RollingKickAnim dw SandAttackAnim - dw HeadButtAnim + dw HeadbuttAnim dw HornAttackAnim dw FuryAttackAnim dw HornDrillAnim @@ -363,7 +363,7 @@ SandAttackAnim: battle_anim SAND_ATTACK, SUBANIM_1_SAND, 1, 6 db -1 ; end -HeadButtAnim: +HeadbuttAnim: battle_anim HEADBUTT, SUBANIM_1_STAR_BIG, 1, 6 db -1 ; end diff --git a/engine/events/starter_dex.asm b/engine/events/starter_dex.asm index 7cfe9af26..9640a40e9 100644 --- a/engine/events/starter_dex.asm +++ b/engine/events/starter_dex.asm @@ -1,4 +1,4 @@ -; this function temporarily makes the starters (and Ivysaur) seen +; this function temporarily makes the starters (and Ivysaur) owned ; so that the full Pokedex information gets displayed in Oak's lab StarterDex: ld a, 1 << (DEX_BULBASAUR - 1) | 1 << (DEX_IVYSAUR - 1) | 1 << (DEX_CHARMANDER - 1) | 1 << (DEX_SQUIRTLE - 1) diff --git a/engine/gfx/oam_dma.asm b/engine/gfx/oam_dma.asm index 11e52694a..725c3dca1 100644 --- a/engine/gfx/oam_dma.asm +++ b/engine/gfx/oam_dma.asm @@ -2,7 +2,7 @@ WriteDMACodeToHRAM:: ; Since no other memory is available during OAM DMA, ; DMARoutine is copied to HRAM and executed there. ld c, LOW(hDMARoutine) - ld b, DMARoutineEnd - DMARoutine + ld b, DMARoutine.End - DMARoutine ld hl, DMARoutine .copy ld a, [hli] @@ -25,4 +25,4 @@ hDMARoutine:: jr nz, .wait ret ENDL -DMARoutineEnd: +.End: diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 8423e240b..16f458db9 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -23,7 +23,7 @@ ItemUsePtrTable: dw ItemUseBall ; POKE_BALL dw ItemUseTownMap ; TOWN_MAP dw ItemUseBicycle ; BICYCLE - dw ItemUseSurfboard ; out-of-battle Surf effect + dw ItemUseSurfboard ; SURFBOARD dw ItemUseBall ; SAFARI_BALL dw ItemUsePokedex ; POKEDEX dw ItemUseEvoStone ; MOON_STONE @@ -60,19 +60,19 @@ ItemUsePtrTable: dw UnusableItem ; DOME_FOSSIL dw UnusableItem ; HELIX_FOSSIL dw UnusableItem ; SECRET_KEY - dw UnusableItem + dw UnusableItem ; ITEM_2C dw UnusableItem ; BIKE_VOUCHER dw ItemUseXAccuracy ; X_ACCURACY dw ItemUseEvoStone ; LEAF_STONE dw ItemUseCardKey ; CARD_KEY dw UnusableItem ; NUGGET - dw UnusableItem ; ??? PP_UP - dw ItemUsePokedoll ; POKE_DOLL + dw UnusableItem ; ITEM_32 + dw ItemUsePokeDoll ; POKE_DOLL dw ItemUseMedicine ; FULL_HEAL dw ItemUseMedicine ; REVIVE dw ItemUseMedicine ; MAX_REVIVE dw ItemUseGuardSpec ; GUARD_SPEC - dw ItemUseSuperRepel ; SUPER_REPL + dw ItemUseSuperRepel ; SUPER_REPEL dw ItemUseMaxRepel ; MAX_REPEL dw ItemUseDireHit ; DIRE_HIT dw UnusableItem ; COIN @@ -89,13 +89,13 @@ ItemUsePtrTable: dw ItemUseOaksParcel ; OAKS_PARCEL dw ItemUseItemfinder ; ITEMFINDER dw UnusableItem ; SILPH_SCOPE - dw ItemUsePokeflute ; POKE_FLUTE + dw ItemUsePokeFlute ; POKE_FLUTE dw UnusableItem ; LIFT_KEY dw UnusableItem ; EXP_ALL dw ItemUseOldRod ; OLD_ROD dw ItemUseGoodRod ; GOOD_ROD dw ItemUseSuperRod ; SUPER_ROD - dw ItemUsePPUp ; PP_UP (real one) + dw ItemUsePPUp ; PP_UP dw ItemUsePPRestore ; ETHER dw ItemUsePPRestore ; MAX_ETHER dw ItemUsePPRestore ; ELIXER @@ -665,7 +665,7 @@ ItemUseBicycle: .printText jp PrintText -; used for Surf out-of-battle effect +; indirectly used by SURF in StartMenu_Pokemon.surf ItemUseSurfboard: ld a, [wWalkBikeSurfState] ld [wWalkBikeSurfStateCopy], a @@ -1427,6 +1427,9 @@ VitaminNoEffectText: INCLUDE "data/battle/stat_names.asm" +; for BOULDERBADGE when used from the +; ITEM window, which corresponds to +; SAFARI_BAIT during Safari Game encounters ItemUseBait: ld hl, ThrewBaitText call PrintText @@ -1437,6 +1440,9 @@ ItemUseBait: ld de, wSafariEscapeFactor ; escape factor jr BaitRockCommon +; for CASCADEBADGE when used from the +; ITEM window, which corresponds to +; SAFARI_ROCK during Safari Game encounters ItemUseRock: ld hl, ThrewRockText call PrintText @@ -1482,7 +1488,7 @@ ThrewRockText: text_far _ThrewRockText text_end -; also used for Dig out-of-battle effect +; indirectly used by DIG in StartMenu_Pokemon.dig ItemUseEscapeRope: ld a, [wIsInBattle] and a @@ -1597,7 +1603,7 @@ ItemUseCardKey: INCLUDE "data/events/card_key_coords.asm" -ItemUsePokedoll: +ItemUsePokeDoll: ld a, [wIsInBattle] dec a jp nz, ItemUseNotTime @@ -1662,7 +1668,7 @@ ItemUseXStat: ld [hl], a ; restore [wPlayerMoveNum] ret -ItemUsePokeflute: +ItemUsePokeFlute: ld a, [wIsInBattle] and a jr nz, .inBattle diff --git a/engine/menus/save.asm b/engine/menus/save.asm index 1857d6f50..3269e7f2c 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -705,7 +705,7 @@ ClearSAV: PadSRAM_FF: ld [MBC1SRamBank], a - ld hl, SRAM_Begin - ld bc, SRAM_End - SRAM_Begin + ld hl, STARTOF(SRAM) + ld bc, SIZEOF(SRAM) ld a, $ff jp FillMemory diff --git a/engine/movie/oak_speech/oak_speech2.asm b/engine/movie/oak_speech/oak_speech2.asm index 7288207b7..95ebcabe5 100644 --- a/engine/movie/oak_speech/oak_speech2.asm +++ b/engine/movie/oak_speech/oak_speech2.asm @@ -54,7 +54,7 @@ ChooseRivalName: call ClearScreen call Delay3 ld de, Rival1Pic - ld b, $13 + ld b, BANK(Rival1Pic) call IntroDisplayPicCenteredOrUpperRight .done ld hl, HisNameIsText diff --git a/home/header.asm b/home/header.asm index c12a05659..5b8de8381 100644 --- a/home/header.asm +++ b/home/header.asm @@ -79,3 +79,5 @@ Start:: ; This makes sure it doesn't get used for anything else. ds $0150 - @ + +ENDSECTION diff --git a/home/init.asm b/home/init.asm index 2570374b5..bc9879f67 100644 --- a/home/init.asm +++ b/home/init.asm @@ -41,8 +41,8 @@ DEF rLCDC_DEFAULT EQU %11100011 ld sp, wStack - ld hl, WRAM0_Begin - ld bc, WRAM1_End - WRAM0_Begin + ld hl, STARTOF(WRAM0) + ld bc, SIZEOF(WRAM0) .loop ld [hl], 0 inc hl @@ -53,8 +53,8 @@ DEF rLCDC_DEFAULT EQU %11100011 call ClearVram - ld hl, HRAM_Begin - ld bc, HRAM_End - HRAM_Begin + ld hl, STARTOF(HRAM) + ld bc, SIZEOF(HRAM) call FillMemory call ClearSprites @@ -119,8 +119,8 @@ DEF rLCDC_DEFAULT EQU %11100011 jp PrepareTitleScreen ClearVram:: - ld hl, VRAM_Begin - ld bc, VRAM_End - VRAM_Begin + ld hl, STARTOF(VRAM) + ld bc, SIZEOF(VRAM) xor a jp FillMemory diff --git a/home/trainers.asm b/home/trainers.asm index e41c8c84a..5475c2044 100644 --- a/home/trainers.asm +++ b/home/trainers.asm @@ -258,7 +258,7 @@ SetSpritePosition1:: SetSpritePosition2:: ld hl, _SetSpritePosition2 SpritePositionBankswitch:: - ld b, BANK(_GetSpritePosition1) ; BANK(_GetSpritePosition2), BANK(_SetSpritePosition1), BANK(_SetSpritePosition2) + ld b, BANK("Trainer Sight") jp Bankswitch ; indirect jump to one of the four functions CheckForEngagingTrainers:: diff --git a/macros/asserts.asm b/macros/asserts.asm index 64e6bc7bf..bc5b25820 100644 --- a/macros/asserts.asm +++ b/macros/asserts.asm @@ -16,6 +16,12 @@ MACRO assert_table_length "{CURRENT_TABLE_START}: expected {d:x} entries, each {d:CURRENT_TABLE_WIDTH} bytes" ENDM +MACRO assert_max_table_length + DEF x = \1 + ASSERT x * CURRENT_TABLE_WIDTH >= @ - {CURRENT_TABLE_START}, \ + "{CURRENT_TABLE_START}: expected a maximum of {d:x} entries, each {d:CURRENT_TABLE_WIDTH} bytes" +ENDM + MACRO list_start DEF list_index = 0 IF _NARG == 1 diff --git a/ram/hram.asm b/ram/hram.asm index fc2f45bc3..1a781da4b 100644 --- a/ram/hram.asm +++ b/ram/hram.asm @@ -397,3 +397,5 @@ hJoyInput:: db hDisableJoypadPolling:: db ds 5 + +ENDSECTION diff --git a/ram/sram.asm b/ram/sram.asm index 6cb453711..c3435b808 100644 --- a/ram/sram.asm +++ b/ram/sram.asm @@ -51,3 +51,5 @@ sBank3IndividualBoxChecksums:: ds 6 ; All 12 boxes fit within 2 SRAM banks ASSERT box_n == NUM_BOXES, \ "boxes: Expected {d:NUM_BOXES} total boxes, got {d:box_n}" + +ENDSECTION diff --git a/ram/vram.asm b/ram/vram.asm index 21230ac07..04556410c 100644 --- a/ram/vram.asm +++ b/ram/vram.asm @@ -29,3 +29,5 @@ vTitleLogo:: ds $80 tiles vTitleLogo2:: ds 30 tiles ENDU + +ENDSECTION diff --git a/ram/wram.asm b/ram/wram.asm index 7f16c395e..d6003262c 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -2079,9 +2079,9 @@ wChannel7:: channel_struct wChannel7 wChannel8:: channel_struct wChannel8 ENDU -wObtainedHiddenItemsFlags:: flag_array 112 +wObtainedHiddenItemsFlags:: flag_array MAX_HIDDEN_ITEMS -wObtainedHiddenCoinsFlags:: flag_array 16 +wObtainedHiddenCoinsFlags:: flag_array MAX_HIDDEN_COINS ; $00 = walking ; $01 = biking @@ -2357,3 +2357,5 @@ SECTION "Stack", WRAM0 ; the stack grows downward ds $100 - 1 wStack:: db + +ENDSECTION diff --git a/rgbdscheck.asm b/rgbdscheck.asm index e06e1707a..55fea288c 100644 --- a/rgbdscheck.asm +++ b/rgbdscheck.asm @@ -1,16 +1,6 @@ -MAJOR EQU 0 -MINOR EQU 6 -PATCH EQU 0 - -WRONG_RGBDS EQUS "fail \"pokered requires rgbds v0.6.0 or newer.\"" - IF !DEF(__RGBDS_MAJOR__) || !DEF(__RGBDS_MINOR__) || !DEF(__RGBDS_PATCH__) - WRONG_RGBDS -ELSE -IF (__RGBDS_MAJOR__ < MAJOR) || \ - (__RGBDS_MAJOR__ == MAJOR && __RGBDS_MINOR__ < MINOR) || \ - (__RGBDS_MAJOR__ == MAJOR && __RGBDS_MINOR__ == MINOR && __RGBDS_PATCH__ < PATCH) || \ - (__RGBDS_MAJOR__ == MAJOR && __RGBDS_MINOR__ == MINOR && __RGBDS_PATCH__ == PATCH && DEF(__RGBDS_RC__)) - WRONG_RGBDS + fail "pokered requires rgbds v0.7.0 or newer." ENDC +IF __RGBDS_MAJOR__ == 0 && __RGBDS_MINOR__ < 7 + fail "pokered requires rgbds v0.7.0 or newer." ENDC