diff --git a/INSTALL.md b/INSTALL.md index 684ab8e9a..18334ba00 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -9,6 +9,12 @@ If you run into trouble, ask for help on IRC or Discord (see [README.md](README. Download and install [**Windows Subsystem for Linux**](https://docs.microsoft.com/en-us/windows/wsl/install-win10). Then open the **WSL terminal**. +Update WSL's software before continuing. If you chose Debian, Ubuntu, or another distribution that uses `apt-get`, then enter this command: + +```bash +apt-get update && apt-get upgrade +``` + WSL has its own file system that's not accessible from Windows, but Windows files *are* accessible from WSL. So you're going to want to install pokecrystal within Windows. You'll have to change the **current working directory** every time you open WSL. For example, if you want to store pokecrystal in **C:\Users\\*\*\Desktop**, enter this command: @@ -19,9 +25,9 @@ cd /mnt/c/Users//Desktop (The Windows `C:\` drive is called `/mnt/c/` in WSL. Replace *\* in the example path with your username.) -Then follow [the instructions for **Linux**](#linux). +If this works, then follow [the instructions for **Linux**](#linux) below for whatever distribution you installed for WSL. -If this doesn't work, try following [the regular Windows instructions](#windows) below. +Otherwise, continue reading below for [the older Windows instructions](#windows). ## Windows @@ -36,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 download [**rgbds**](https://github.com/gbdev/rgbds/releases/): the latest **win64.zip** or **win32.zip** release. Extract it and put all the `exe` and `dll` files individually in **C:\cygwin64\usr\local\bin**. +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/windows) for Windows with Cygwin to install **rgbds 0.4.1**. -**Note: If you already have an older rgbds, you will need to update to 0.4.1.** Ignore this if you have never installed rgbds before. If a version newer than 0.4.1 does not work, try downloading 0.4.1. +**Note:** If you already have an older rgbds, you will need to update to 0.4.1. Ignore this if you have never installed rgbds before. If a version newer than 0.4.1 does not work, try downloading 0.4.1. Now open the **Cygwin terminal** and enter the following commands. @@ -55,17 +61,13 @@ cd /cygdrive/c/Users//Desktop Now you're ready to [build **pokecrystal**](#build-pokecrystal). -## Mac OS X +## macOS Install [**Homebrew**](https://brew.sh/). Follow the official instructions. -Open **Terminal** and enter the following commands. +Open **Terminal** and prepare to enter commands. -To install **rgbds**: - -```bash -brew install rgbds -``` +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/macos) for macOS to install **rgbds 0.4.1**. Now you're ready to [build **pokecrystal**](#build-pokecrystal). @@ -82,13 +84,7 @@ To install the software required for **pokecrystal**: sudo apt-get install make gcc git ``` -To install **rgbds**: - -```bash -sudo apt-get install pkg-config flex bison libpng-dev -git clone -b v0.4.1 --depth=1 https://github.com/gbdev/rgbds -sudo make -C rgbds install -``` +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.4.1** from source. ### OpenSUSE @@ -98,13 +94,7 @@ To install the software required for **pokecrystal**: sudo zypper install make gcc git ``` -To install **rgbds**: - -```bash -sudo zypper install pkg-config flex bison libpng16-devel -git clone -b v0.4.1 --depth=1 https://github.com/gbdev/rgbds -sudo make -C rgbds install -``` +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.4.1** from source. ### Arch Linux @@ -114,13 +104,9 @@ To install the software required for **pokecrystal**: sudo pacman -S make gcc git rgbds ``` -If you want to compile and install **rgbds** manually instead of using the Arch package: +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/arch) for Arch Linux to install **rgbds 0.4.1**. -```bash -sudo pacman -S pkg-config flex bison libpng -git clone -b v0.4.1 --depth=1 https://github.com/gbdev/rgbds -sudo make -C rgbds install -``` +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.4.1** from source. ### Termux @@ -136,6 +122,8 @@ 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.4.1** from source. + ### Other distros If your distro is not listed here, try to find the required software in its repositories: @@ -145,19 +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 also need these: - -- `pkg-config` -- `flex` -- `bison` -- `libpng` (and the development headers) - -To install **rgbds**: - -```bash -git clone -b v0.4.1 --depth=1 https://github.com/gbdev/rgbds -sudo make -C rgbds install -``` +If `rgbds` is not available, you'll need to follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.4.1** from source. Now you're ready to [build **pokecrystal**](#build-pokecrystal). diff --git a/STYLE.md b/STYLE.md index a80315120..becfc5044 100644 --- a/STYLE.md +++ b/STYLE.md @@ -69,6 +69,7 @@ PascalCase: ; label PascalCase:: ; global label .snake_case ; local jump .PascalCase: ; an atomic chunk of code or data that's local +; don't define unused labels when a comment would do ; Labels are prefixed with lower case letters depending on location wPascalCase: ; wram @@ -151,9 +152,7 @@ endr ; do db \1, \2, \3, \4, \5 -rept 5 - shift -endr + shift 5 db \1, \2, \3, \4, \5 ENDM @@ -161,7 +160,7 @@ ENDM UPPER_CASE_IS_OK_SOMETIMES: MACRO -; but i can't think of any examples +; but I can't think of any examples besides ACRONYMS ENDM diff --git a/audio/cries.asm b/audio/cries.asm index 352ce3218..cf2ead186 100644 --- a/audio/cries.asm +++ b/audio/cries.asm @@ -464,7 +464,7 @@ Cry_Sentret_Ch6: square_note 8, 15, 1, 1824 sound_ret -Cry_Sentret_Ch8: +Cry_Sentret_Ch8: ; unreferenced noise_note 8, 3, -3, 0 noise_note 8, 9, 2, 0 sound_ret @@ -1082,7 +1082,7 @@ Cry_Weepinbell: channel 6, Cry_Weepinbell_Ch6 channel 8, Cry_Weepinbell_Ch8 -Cry_Unused_Ch5: +Cry_Unused_Ch5: ; unreferenced duty_cycle_pattern 3, 3, 0, 0 square_note 15, 14, 0, 1920 square_note 15, 15, 0, 1924 @@ -1092,7 +1092,7 @@ Cry_Unused_Ch5: square_note 8, 7, 1, 1924 sound_ret -Cry_Unused_Ch6: +Cry_Unused_Ch6: ; unreferenced duty_cycle_pattern 0, 0, 1, 1 square_note 15, 10, 0, 1857 square_note 15, 11, 0, 1859 @@ -1102,7 +1102,7 @@ Cry_Unused_Ch6: square_note 8, 3, 1, 1862 sound_ret -Cry_Unused_Ch8: +Cry_Unused_Ch8: ; unreferenced noise_note 2, 15, 2, 76 noise_note 6, 14, 0, 58 noise_note 15, 13, 0, 58 diff --git a/audio/engine.asm b/audio/engine.asm index ea3e467ec..d394067c3 100644 --- a/audio/engine.asm +++ b/audio/engine.asm @@ -38,15 +38,16 @@ _InitSound:: dec e jr nz, .clearsound - ld hl, wChannels ; start of channel data - ld de, wChannelsEnd - wChannels ; length of area to clear (entire sound wram area) -.clearchannels + ld hl, wAudio + ld de, wAudioEnd - wAudio +.clearaudio xor a ld [hli], a dec de ld a, e or d - jr nz, .clearchannels + jr nz, .clearaudio + ld a, MAX_VOLUME ld [wVolume], a call MusicOn @@ -1614,9 +1615,9 @@ Music_JumpIf: ret MusicEE: +; unused ; conditional jump ; checks a byte in ram corresponding to the current channel -; doesn't seem to be set by any commands ; params: 2 ; ll hh ; pointer @@ -1666,15 +1667,15 @@ MusicEE: ret MusicF9: +; unused ; sets some flag -; seems to be unused ; params: 0 ld a, TRUE ld [wUnusedMusicF9Flag], a ret MusicE2: -; seems to have been dummied out +; unused ; params: 1 call GetMusicByte ld hl, CHANNEL_FIELD2C diff --git a/audio/music/magnettrain.asm b/audio/music/magnettrain.asm index f0c49d597..428acc4be 100644 --- a/audio/music/magnettrain.asm +++ b/audio/music/magnettrain.asm @@ -246,7 +246,7 @@ Music_MagnetTrain_Ch4: drum_note 12, 16 sound_ret -.sub1: ; unused +.sub1: ; unreferenced drum_note 9, 1 drum_note 8, 1 drum_note 8, 1 diff --git a/audio/sfx.asm b/audio/sfx.asm index b84238921..83dd5f6d6 100644 --- a/audio/sfx.asm +++ b/audio/sfx.asm @@ -21,7 +21,8 @@ Sfx_Menu: Sfx_ReadText: Sfx_ReadText2: channel_count 1 - channel 5, Sfx_ReadText2_Ch5 + channel 5, Sfx_ReadText_Ch5 + assert Sfx_ReadText_Ch5 == Sfx_ReadText2_Ch5 Sfx_Poison: channel_count 1 @@ -467,6 +468,7 @@ Sfx_Unknown5F: channel 6, Sfx_Unknown5F_Ch6 Sfx_Sandstorm: channel 8, Sfx_Sandstorm_Ch8 + assert Sfx_Sandstorm_Ch8 == Sfx_Unknown5F_Ch8 Sfx_HangUp: channel_count 1 @@ -490,6 +492,10 @@ Sfx_DexFanfare5079: channel 6, Sfx_LevelUp_Ch6 channel 7, Sfx_LevelUp_Ch7 channel 8, Sfx_LevelUp_Ch8 + assert Sfx_LevelUp_Ch5 == Sfx_DexFanfare5079_Ch5 + assert Sfx_LevelUp_Ch6 == Sfx_DexFanfare5079_Ch6 + assert Sfx_LevelUp_Ch7 == Sfx_DexFanfare5079_Ch7 + assert Sfx_LevelUp_Ch8 == Sfx_DexFanfare5079_Ch8 Sfx_LevelUp_Ch5: Sfx_DexFanfare5079_Ch5: @@ -942,7 +948,7 @@ Sfx_Fanfare2: channel 6, Sfx_Fanfare2_Ch6 channel 8, Sfx_Fanfare2_Ch8 -Sfx_Unused: +Sfx_Unused: ; unreferenced channel_count 4 channel 5, Sfx_Unused_Ch5 channel 6, Sfx_Unused_Ch6 diff --git a/audio/sfx_crystal.asm b/audio/sfx_crystal.asm index f2deb8fcc..1a5d1e2d8 100644 --- a/audio/sfx_crystal.asm +++ b/audio/sfx_crystal.asm @@ -184,7 +184,7 @@ Sfx_Tingle_Ch5: duty_cycle 1 transpose 0, 11 note_type 1, 11, 1 -Sfx_Tingle_branch_17996c: +.loop1: octave 5 note C_, 3 octave 6 @@ -192,7 +192,7 @@ Sfx_Tingle_branch_17996c: octave 5 note C_, 3 rest 2 - sound_loop 2, Sfx_Tingle_branch_17996c + sound_loop 2, .loop1 note C_, 2 volume_envelope 10, 1 note G_, 13 diff --git a/constants/collision_constants.asm b/constants/collision_constants.asm index 5626cb094..226f1a1fa 100644 --- a/constants/collision_constants.asm +++ b/constants/collision_constants.asm @@ -1,11 +1,11 @@ -; collision permissions (see data/collision_permissions.asm) +; collision permissions (see data/collision/collision_permissions.asm) LAND_TILE EQU $00 WATER_TILE EQU $01 WALL_TILE EQU $0f TALK EQU $10 ; collision data types (see data/tilesets/*_collision.asm) -; TileCollisionTable indexes (see data/collision_permissions.asm) +; TileCollisionTable indexes (see data/collision/collision_permissions.asm) COLL_FLOOR EQU $00 COLL_01 EQU $01 ; garbage COLL_03 EQU $03 ; garbage diff --git a/constants/engine_flags.asm b/constants/engine_flags.asm index 800e7651b..5b45c4b22 100644 --- a/constants/engine_flags.asm +++ b/constants/engine_flags.asm @@ -15,7 +15,7 @@ const ENGINE_MOM_SAVING_MONEY const ENGINE_MOM_ACTIVE ; wUnusedTwoDayTimerOn - const ENGINE_0A + const ENGINE_UNUSED_TWO_DAY_TIMER_ON ; wStatusFlags const ENGINE_POKEDEX const ENGINE_UNOWN_DEX @@ -115,7 +115,7 @@ ; wSwarmFlags const ENGINE_BUENAS_PASSWORD_2 const ENGINE_GOLDENROD_DEPT_STORE_SALE_IS_ON -; wGameTimerPause +; wGameTimerPaused const ENGINE_62 ; wPlayerGender const ENGINE_PLAYER_IS_FEMALE diff --git a/constants/event_flags.asm b/constants/event_flags.asm index 850b33e85..f4541e46f 100644 --- a/constants/event_flags.asm +++ b/constants/event_flags.asm @@ -136,9 +136,9 @@ const EVENT_TIN_TOWER_5F_HIDDEN_FULL_RESTORE const EVENT_TIN_TOWER_5F_HIDDEN_CARBOS const EVENT_BURNED_TOWER_1F_HIDDEN_ETHER - const_skip ; unused - const_skip ; unused - const_skip ; unused + const_skip ; unused in Crystal + const_skip ; unused in Crystal + const_skip ; unused in Crystal const EVENT_NATIONAL_PARK_HIDDEN_FULL_HEAL const EVENT_OLIVINE_LIGHTHOUSE_5F_HIDDEN_HYPER_POTION const EVENT_TEAM_ROCKET_BASE_B1F_HIDDEN_REVIVE @@ -281,11 +281,11 @@ const EVENT_GAVE_KURT_PNK_APRICORN ; Phone events const EVENT_JACK_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_BEVERLY_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_HUEY_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_GOT_PROTEIN_FROM_HUEY const EVENT_GOT_HP_UP_FROM_JOEY const EVENT_GOT_CARBOS_FROM_VANCE @@ -293,55 +293,55 @@ const EVENT_GOT_CALCIUM_FROM_ERIN const EVENT_KENJI_ON_BREAK const EVENT_GAVEN_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_BETH_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_JOSE_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_REENA_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_JOEY_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_WADE_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_RALPH_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_LIZ_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_ANTHONY_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_TODD_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_GINA_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_IRWIN_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_ARNIE_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_ALAN_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const_skip ; unused const_skip ; unused const EVENT_DANA_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_CHAD_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_DEREK_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_TULLY_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_BRENT_ASKED_FOR_PHONE_NUMBER const_skip ; unused const EVENT_TIFFANY_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_VANCE_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_WILTON_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_KENJI_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_PARRY_ASKED_FOR_PHONE_NUMBER - const_skip ; unused + const_skip ; unused in Crystal const EVENT_ERIN_ASKED_FOR_PHONE_NUMBER const EVENT_BUENA_OFFERED_HER_PHONE_NUMBER_NO_BLUE_CARD const_skip ; unused @@ -1229,7 +1229,7 @@ const EVENT_COPYCAT_2 const EVENT_GOLDENROD_SALE_OFF const EVENT_GOLDENROD_SALE_ON - const_skip ; unused + const_skip ; unused in Crystal const EVENT_ILEX_FOREST_APPRENTICE const EVENT_ILEX_FOREST_CHARCOAL_MASTER const EVENT_CHARCOAL_KILN_FARFETCH_D diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm index f1d53085b..5e7391458 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -21,6 +21,7 @@ SCREEN_META_WIDTH EQU 6 ; metatiles SCREEN_META_HEIGHT EQU 5 ; metatiles SURROUNDING_WIDTH EQU SCREEN_META_WIDTH * METATILE_WIDTH ; tiles SURROUNDING_HEIGHT EQU SCREEN_META_HEIGHT * METATILE_WIDTH ; tiles +MAP_CONNECTION_PADDING_WIDTH EQU 3 ; metatiles HP_BAR_LENGTH EQU 6 ; tiles EXP_BAR_LENGTH EQU 8 ; tiles diff --git a/constants/hardware_constants.asm b/constants/hardware_constants.asm index ed5447e28..490da9c19 100644 --- a/constants/hardware_constants.asm +++ b/constants/hardware_constants.asm @@ -71,10 +71,10 @@ rTIMA EQU $ff05 ; Timer counter (R/W) rTMA EQU $ff06 ; Timer Modulo (R/W) rTAC EQU $ff07 ; Timer Control (R/W) rTAC_ON EQU 2 -rTAC_4096_HZ EQU 0 -rTAC_262144_HZ EQU 1 -rTAC_65536_HZ EQU 2 -rTAC_16384_HZ EQU 3 +rTAC_4096_HZ EQU %00 +rTAC_262144_HZ EQU %01 +rTAC_65536_HZ EQU %10 +rTAC_16384_HZ EQU %11 rIF EQU $ff0f ; Interrupt Flag (R/W) rNR10 EQU $ff10 ; Channel 1 Sweep register (R/W) rNR11 EQU $ff11 ; Channel 1 Sound length/Wave pattern duty (R/W) @@ -147,6 +147,9 @@ rHDMA3 EQU $ff53 ; CGB Mode Only - New DMA Destination, High rHDMA4 EQU $ff54 ; CGB Mode Only - New DMA Destination, Low rHDMA5 EQU $ff55 ; CGB Mode Only - New DMA Length/Mode/Start rRP EQU $ff56 ; CGB Mode Only - Infrared Communications Port +rRP_LED_ON EQU 0 +rRP_RECEIVING EQU 1 +rRP_ENABLE_READ_MASK EQU %11000000 rBGPI EQU $ff68 ; CGB Mode Only - Background Palette Index rBGPI_AUTO_INCREMENT EQU 7 ; increment rBGPI after write to rBGPD rBGPD EQU $ff69 ; CGB Mode Only - Background Palette Data diff --git a/constants/landmark_constants.asm b/constants/landmark_constants.asm index ccdc0f849..9b562288c 100644 --- a/constants/landmark_constants.asm +++ b/constants/landmark_constants.asm @@ -102,8 +102,9 @@ KANTO_LANDMARK EQU const_value const LANDMARK_FAST_SHIP ; 5f ; used in CaughtData -LANDMARK_GIFT EQU $7e -LANDMARK_EVENT EQU $7f + const_def $7f, -1 + const LANDMARK_EVENT ; $7f + const LANDMARK_GIFT ; $7e ; Regions const_def diff --git a/constants/map_constants.asm b/constants/map_constants.asm index e946a2856..233c19935 100644 --- a/constants/map_constants.asm +++ b/constants/map_constants.asm @@ -1,5 +1,5 @@ newgroup: MACRO -const_value = const_value + 1 + const_skip __map_value__ = 1 ENDM diff --git a/constants/map_data_constants.asm b/constants/map_data_constants.asm index d288e07d5..533157101 100644 --- a/constants/map_data_constants.asm +++ b/constants/map_data_constants.asm @@ -66,7 +66,7 @@ NUM_MAP_PALETTES EQU const_value shift_const NORTH ; SpawnPoints indexes (see data/maps/spawn_points.asm) -const_value = -1 + const_def -1 const SPAWN_N_A const SPAWN_HOME const SPAWN_DEBUG diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index a3c31141c..92e66f06b 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -14,6 +14,8 @@ FEMALE EQU 1 ; G/S version ID: 0 = Gold, 1 = Silver (used by checkver) GS_VERSION EQU 0 +; Pokémon Pikachu 2, a step counter / virtual pet device (used by Mystery Gift) +POKEMON_PIKACHU_2_VERSION EQU 3 ; save file corruption check values SAVE_CHECK_VALUE_1 EQU 99 diff --git a/constants/pokemon_constants.asm b/constants/pokemon_constants.asm index edb9fc2e0..6f38f20c7 100644 --- a/constants/pokemon_constants.asm +++ b/constants/pokemon_constants.asm @@ -10,14 +10,14 @@ ; - PokemonPalettes (see data/pokemon/palettes.asm) ; - PokedexDataPointerTable (see data/pokemon/dex_entry_pointers.asm) ; - AlphabeticalPokedexOrder (see data/pokemon/dex_order_alpha.asm) -; - EZChat_SortedPokemon (see data/pokemon/ezchat_order.asm) ; - NewPokedexOrder (see data/pokemon/dex_order_new.asm) ; - Pokered_MonIndices (see data/pokemon/gen1_order.asm) +; - Footprints (see gfx/footprints.asm) ; - AnimationPointers (see gfx/pokemon/anim_pointers.asm) ; - AnimationIdlePointers (see gfx/pokemon/idle_pointers.asm) ; - BitmasksPointers (see gfx/pokemon/bitmask_pointers.asm) ; - FramesPointers (see gfx/pokemon/frame_pointers.asm) -; - Footprints (see gfx/footprints.asm) +; - EZChat_SortedPokemon (see data/pokemon/ezchat_order.asm) const_def 1 const BULBASAUR ; 01 const IVYSAUR ; 02 diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm index 61e28f6f2..328a6a6fa 100644 --- a/constants/pokemon_data_constants.asm +++ b/constants/pokemon_data_constants.asm @@ -179,7 +179,7 @@ NUM_TREEMON_SETS EQU const_value const TREEMON_SCORE_RARE ; 2 ; ChangeHappiness arguments (see data/happiness_changes.asm) -const_value = 1 + const_def 1 const HAPPINESS_GAINLEVEL ; 01 const HAPPINESS_USEDITEM ; 02 const HAPPINESS_USEDXITEM ; 03 diff --git a/constants/scgb_constants.asm b/constants/scgb_constants.asm index 785bf3933..eac530a44 100644 --- a/constants/scgb_constants.asm +++ b/constants/scgb_constants.asm @@ -35,6 +35,12 @@ SCGB_PARTY_MENU_HP_BARS EQU $fc SCGB_DEFAULT EQU $ff +; GetCrystalCGBLayout arguments (see engine/gfx/crystal_layouts.asm) + const_def + const CRYSTAL_CGB_MOBILE_0 + const CRYSTAL_CGB_MOBILE_1 + const CRYSTAL_CGB_NAME_CARD + ; PredefPals indexes (see gfx/sgb/predef.pal) ; GetPredefPal arguments (see engine/gfx/color.asm) const_def diff --git a/constants/serial_constants.asm b/constants/serial_constants.asm index 0b711e877..715534372 100644 --- a/constants/serial_constants.asm +++ b/constants/serial_constants.asm @@ -30,3 +30,8 @@ SERIAL_NO_DATA_BYTE EQU $fe SERIAL_PATCH_LIST_PART_TERMINATOR EQU $ff SERIAL_PREAMBLE_LENGTH EQU 6 + +; timeout duration after exchanging a byte +SERIAL_LINK_BYTE_TIMEOUT EQU $5000 + +MAX_MYSTERY_GIFT_PARTNERS EQU 5 diff --git a/constants/trainer_constants.asm b/constants/trainer_constants.asm index cbc28e87e..4d45b7a11 100644 --- a/constants/trainer_constants.asm +++ b/constants/trainer_constants.asm @@ -3,7 +3,7 @@ __trainer_class__ = 0 trainerclass: MACRO \1 EQU __trainer_class__ __trainer_class__ = __trainer_class__ + 1 -const_value = 1 + const_def 1 ENDM ; trainer class ids diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm index c571faf8b..2b3d61e36 100644 --- a/constants/wram_constants.asm +++ b/constants/wram_constants.asm @@ -21,9 +21,13 @@ AUTO_INPUT EQU $ff const TEMPMON ; 3 const WILDMON ; 4 -; wGameTimerPause:: -GAMETIMERPAUSE_TIMER_PAUSED_F EQU 0 -GAMETIMERPAUSE_MOBILE_7_F EQU 7 +; wGameTimerPaused:: +GAME_TIMER_PAUSED_F EQU 0 +GAME_TIMER_MOBILE_F EQU 7 + +; wJoypadDisable:: +JOYPAD_DISABLE_MON_FAINT_F EQU 6 +JOYPAD_DISABLE_SGB_TRANSFER_F EQU 7 ; wOptions:: TEXT_DELAY_MASK EQU %111 @@ -80,11 +84,12 @@ LEFT_MASK EQU 1 << LEFT RIGHT_MASK EQU 1 << RIGHT ; wFacingDirection:: + const_def NUM_DIRECTIONS - 1, -1 + shift_const FACE_DOWN ; 8 + shift_const FACE_UP ; 4 + shift_const FACE_LEFT ; 2 + shift_const FACE_RIGHT ; 1 FACE_CURRENT EQU 0 -FACE_DOWN EQU 8 -FACE_UP EQU 4 -FACE_LEFT EQU 2 -FACE_RIGHT EQU 1 ; wPokemonWithdrawDepositParameter:: PC_WITHDRAW EQU 0 diff --git a/data/battle/effect_command_pointers.asm b/data/battle/effect_command_pointers.asm index d5c044d78..d1f747a1f 100644 --- a/data/battle/effect_command_pointers.asm +++ b/data/battle/effect_command_pointers.asm @@ -63,7 +63,7 @@ BattleCommandPointers: dw BattleCommand_Charge dw BattleCommand_CheckCharge dw BattleCommand_TrapTarget - dw BattleCommand3c + dw BattleCommand_Unused3C dw BattleCommand_Rampage dw BattleCommand_CheckRampage dw BattleCommand_ConstantDamage @@ -96,7 +96,7 @@ BattleCommandPointers: dw BattleCommand_Endure dw BattleCommand_CheckCurl dw BattleCommand_RolloutPower - dw BattleCommand5d + dw BattleCommand_Unused5D dw BattleCommand_FuryCutter dw BattleCommand_Attract dw BattleCommand_HappinessPower diff --git a/data/battle_tower/parties.asm b/data/battle_tower/parties.asm index e0d2b4dec..9c67c2f72 100644 --- a/data/battle_tower/parties.asm +++ b/data/battle_tower/parties.asm @@ -1,7 +1,7 @@ BattleTowerMons: -; 10 groups of 21 mons. +; 10 groups (one per floor level) of 21 mons (BATTLETOWER_NUM_UNIQUE_MON). -BattleTowerMons1: +; BattleTowerMons group 1 db JOLTEON db MIRACLEBERRY @@ -550,7 +550,7 @@ BattleTowerMons1: db "BARIYA-DO@@" -BattleTowerMons2: +; BattleTowerMons group 2 db UMBREON db LEFTOVERS @@ -1099,7 +1099,7 @@ BattleTowerMons2: db "NUO-@@@@@@@" -BattleTowerMons3: +; BattleTowerMons group 3 db JOLTEON db MIRACLEBERRY @@ -1648,7 +1648,7 @@ BattleTowerMons3: db "OKORIZARU@@" -BattleTowerMons4: +; BattleTowerMons group 4 db TAUROS db GOLD_BERRY @@ -2197,7 +2197,7 @@ BattleTowerMons4: db "EREBU-@@@@@" -BattleTowerMons5: +; BattleTowerMons group 5 db KINGDRA db GOLD_BERRY @@ -2746,7 +2746,7 @@ BattleTowerMons5: db "HURI-ZA-@@@" -BattleTowerMons6: +; BattleTowerMons group 6 db KINGDRA db LEFTOVERS @@ -3295,7 +3295,7 @@ BattleTowerMons6: db "GORO-NIya@@" -BattleTowerMons7: +; BattleTowerMons group 7 db JOLTEON db MIRACLEBERRY @@ -3844,7 +3844,7 @@ BattleTowerMons7: db "KAMEtuKUSU@" -BattleTowerMons8: +; BattleTowerMons group 8 db JOLTEON db MIRACLEBERRY @@ -4393,7 +4393,7 @@ BattleTowerMons8: db "GURANBURU@@" -BattleTowerMons9: +; BattleTowerMons group 9 db UMBREON db KINGS_ROCK @@ -4942,7 +4942,7 @@ BattleTowerMons9: db "BETOBETON@@" -BattleTowerMons10: +; BattleTowerMons group 10 db HOUNDOOM db MINT_BERRY diff --git a/data/battle_tower/unknown.asm b/data/battle_tower/unknown.asm index 81c9515fb..3437c444b 100644 --- a/data/battle_tower/unknown.asm +++ b/data/battle_tower/unknown.asm @@ -1,8 +1,8 @@ -BattleTowerTrainerData:: ; What exactly it is, I don't know -; Size is 70 (Nr of Trainers in BattleTower) * 0x24 (Nr of Bytes that are copied) +BattleTowerTrainerData:: ; ??? +; 70 tables (BATTLETOWER_NUM_UNIQUE_TRAINERS) of 18 two-argument entries (total size BATTLETOWER_TRAINERDATALENGTH). ; Second argument points to an entry in Unknown_170470, to which the first argument is compared. -BattleTowerTrainer1DataTable: +; BattleTowerTrainerData table 1: db $37, 3 db $0e, 9 db $25, 11 @@ -22,7 +22,7 @@ BattleTowerTrainer1DataTable: db $34, 3 db $06, 5 -BattleTowerTrainer2DataTable: +; BattleTowerTrainerData table 2: db $36, 3 db $ca, 0 db $22, 8 @@ -42,7 +42,7 @@ BattleTowerTrainer2DataTable: db $28, 11 db $0c, 13 -BattleTowerTrainer3DataTable: +; BattleTowerTrainerData table 3: db $32, 6 db $31, 4 db $02, 2 @@ -62,7 +62,7 @@ BattleTowerTrainer3DataTable: db $22, 2 db $13, 13 -BattleTowerTrainer4DataTable: +; BattleTowerTrainerData table 4: db $22, 12 db $22, 12 db $0a, 9 @@ -82,7 +82,7 @@ BattleTowerTrainer4DataTable: db $1c, 11 db $41, 11 -BattleTowerTrainer5DataTable: +; BattleTowerTrainerData table 5: db $a3, 0 db $41, 3 db $1f, 4 @@ -102,7 +102,7 @@ BattleTowerTrainer5DataTable: db $d1, 0 db $0a, 6 -BattleTowerTrainer6DataTable: +; BattleTowerTrainerData table 6: db $13, 2 db $31, 6 db $04, 2 @@ -122,7 +122,7 @@ BattleTowerTrainer6DataTable: db $08, 5 db $1a, 13 -BattleTowerTrainer7DataTable: +; BattleTowerTrainerData table 7: db $0d, 2 db $07, 2 db $00, 5 @@ -142,7 +142,7 @@ BattleTowerTrainer7DataTable: db $20, 4 db $23, 13 -BattleTowerTrainer8DataTable: +; BattleTowerTrainerData table 8: db $1e, 2 db $22, 2 db $00, 5 @@ -162,7 +162,7 @@ BattleTowerTrainer8DataTable: db $14, 8 db $00, 5 -BattleTowerTrainer9DataTable: +; BattleTowerTrainerData table 9: db $06, 12 db $09, 6 db $00, 0 @@ -182,7 +182,7 @@ BattleTowerTrainer9DataTable: db $31, 13 db $01, 5 -BattleTowerTrainer10DataTable: +; BattleTowerTrainerData table 10: db $22, 12 db $30, 4 db $01, 5 @@ -202,7 +202,7 @@ BattleTowerTrainer10DataTable: db $30, 13 db $06, 5 -BattleTowerTrainer11DataTable: +; BattleTowerTrainerData table 11: db $0e, 6 db $04, 5 db $2c, 4 @@ -222,7 +222,7 @@ BattleTowerTrainer11DataTable: db $26, 13 db $04, 5 -BattleTowerTrainer12DataTable: +; BattleTowerTrainerData table 12: db $18, 2 db $33, 3 db $28, 4 @@ -242,7 +242,7 @@ BattleTowerTrainer12DataTable: db $0f, 2 db $00, 5 -BattleTowerTrainer13DataTable: +; BattleTowerTrainerData table 13: db $3a, 11 db $3a, 11 db $00, 5 @@ -262,7 +262,7 @@ BattleTowerTrainer13DataTable: db $3a, 8 db $2a, 13 -BattleTowerTrainer14DataTable: +; BattleTowerTrainerData table 14: db $31, 5 db $11, 14 db $30, 4 @@ -282,7 +282,7 @@ BattleTowerTrainer14DataTable: db $3b, 7 db $0e, 13 -BattleTowerTrainer15DataTable: +; BattleTowerTrainerData table 15: db $1b, 2 db $2c, 4 db $0d, 13 @@ -302,7 +302,7 @@ BattleTowerTrainer15DataTable: db $06, 5 db $00, 0 -BattleTowerTrainer16DataTable: +; BattleTowerTrainerData table 16: db $42, 3 db $30, 4 db $1f, 11 @@ -322,7 +322,7 @@ BattleTowerTrainer16DataTable: db $36, 8 db $41, 13 -BattleTowerTrainer17DataTable: +; BattleTowerTrainerData table 17: db $18, 3 db $42, 3 db $43, 4 @@ -342,7 +342,7 @@ BattleTowerTrainer17DataTable: db $3f, 4 db $20, 14 -BattleTowerTrainer18DataTable: +; BattleTowerTrainerData table 18: db $0c, 5 db $36, 7 db $30, 4 @@ -362,7 +362,7 @@ BattleTowerTrainer18DataTable: db $30, 7 db $06, 5 -BattleTowerTrainer19DataTable: +; BattleTowerTrainerData table 19: db $36, 3 db $06, 6 db $44, 4 @@ -382,7 +382,7 @@ BattleTowerTrainer19DataTable: db $05, 13 db $00, 0 -BattleTowerTrainer20DataTable: +; BattleTowerTrainerData table 20: db $3f, 6 db $2c, 4 db $34, 13 @@ -402,7 +402,7 @@ BattleTowerTrainer20DataTable: db $34, 7 db $04, 13 -BattleTowerTrainer21DataTable: +; BattleTowerTrainerData table 21: db $12, 3 db $02, 4 db $07, 7 @@ -422,7 +422,7 @@ BattleTowerTrainer21DataTable: db $28, 11 db $02, 5 -BattleTowerTrainer22DataTable: +; BattleTowerTrainerData table 22: db $41, 4 db $3c, 11 db $34, 13 @@ -442,7 +442,7 @@ BattleTowerTrainer22DataTable: db $0c, 4 db $3b, 13 -BattleTowerTrainer23DataTable: +; BattleTowerTrainerData table 23: db $03, 10 db $3a, 13 db $2c, 4 @@ -462,7 +462,7 @@ BattleTowerTrainer23DataTable: db $13, 4 db $04, 5 -BattleTowerTrainer24DataTable: +; BattleTowerTrainerData table 24: db $06, 5 db $06, 5 db $06, 5 @@ -482,7 +482,7 @@ BattleTowerTrainer24DataTable: db $33, 4 db $03, 5 -BattleTowerTrainer25DataTable: +; BattleTowerTrainerData table 25: db $27, 5 db $01, 5 db $00, 0 @@ -502,7 +502,7 @@ BattleTowerTrainer25DataTable: db $0c, 4 db $19, 13 -BattleTowerTrainer26DataTable: +; BattleTowerTrainerData table 26: db $03, 2 db $43, 3 db $27, 4 @@ -522,7 +522,7 @@ BattleTowerTrainer26DataTable: db $20, 4 db $41, 13 -BattleTowerTrainer27DataTable: +; BattleTowerTrainerData table 27: db $34, 3 db $00, 3 db $11, 13 @@ -542,7 +542,7 @@ BattleTowerTrainer27DataTable: db $0d, 6 db $20, 6 -BattleTowerTrainer28DataTable: +; BattleTowerTrainerData table 28: db $19, 3 db $17, 11 db $20, 6 @@ -562,7 +562,7 @@ BattleTowerTrainer28DataTable: db $06, 12 db $1a, 11 -BattleTowerTrainer29DataTable: +; BattleTowerTrainerData table 29: db $0a, 3 db $0c, 12 db $25, 10 @@ -582,7 +582,7 @@ BattleTowerTrainer29DataTable: db $0a, 9 db $2f, 13 -BattleTowerTrainer30DataTable: +; BattleTowerTrainerData table 30: db $15, 2 db $2c, 4 db $03, 2 @@ -602,7 +602,7 @@ BattleTowerTrainer30DataTable: db $0c, 4 db $3b, 13 -BattleTowerTrainer31DataTable: +; BattleTowerTrainerData table 31: db $10, 11 db $04, 4 db $00, 5 @@ -622,7 +622,7 @@ BattleTowerTrainer31DataTable: db $13, 7 db $16, 13 -BattleTowerTrainer32DataTable: +; BattleTowerTrainerData table 32: db $0f, 14 db $19, 13 db $00, 5 @@ -642,7 +642,7 @@ BattleTowerTrainer32DataTable: db $19, 13 db $01, 5 -BattleTowerTrainer33DataTable: +; BattleTowerTrainerData table 33: db $35, 3 db $06, 4 db $0d, 6 @@ -662,7 +662,7 @@ BattleTowerTrainer33DataTable: db $29, 8 db $03, 5 -BattleTowerTrainer34DataTable: +; BattleTowerTrainerData table 34: db $18, 4 db $03, 5 db $0b, 13 @@ -682,7 +682,7 @@ BattleTowerTrainer34DataTable: db $0c, 6 db $1a, 13 -BattleTowerTrainer35DataTable: +; BattleTowerTrainerData table 35: db $0c, 12 db $37, 3 db $1a, 3 @@ -702,7 +702,7 @@ BattleTowerTrainer35DataTable: db $3b, 8 db $1b, 7 -BattleTowerTrainer36DataTable: +; BattleTowerTrainerData table 36: db $18, 3 db $1b, 8 db $29, 11 @@ -722,7 +722,7 @@ BattleTowerTrainer36DataTable: db $2f, 8 db $27, 6 -BattleTowerTrainer37DataTable: +; BattleTowerTrainerData table 37: db $1c, 3 db $02, 14 db $31, 3 @@ -742,7 +742,7 @@ BattleTowerTrainer37DataTable: db $27, 4 db $34, 13 -BattleTowerTrainer38DataTable: +; BattleTowerTrainerData table 38: db $33, 3 db $30, 4 db $2c, 4 @@ -762,7 +762,7 @@ BattleTowerTrainer38DataTable: db $40, 6 db $22, 7 -BattleTowerTrainer39DataTable: +; BattleTowerTrainerData table 39: db $22, 12 db $22, 12 db $16, 10 @@ -782,7 +782,7 @@ BattleTowerTrainer39DataTable: db $2c, 4 db $26, 7 -BattleTowerTrainer40DataTable: +; BattleTowerTrainerData table 40: db $0e, 6 db $05, 8 db $04, 13 @@ -802,7 +802,7 @@ BattleTowerTrainer40DataTable: db $00, 0 db $00, 0 -BattleTowerTrainer41DataTable: +; BattleTowerTrainerData table 41: db $18, 3 db $27, 3 db $03, 5 @@ -822,7 +822,7 @@ BattleTowerTrainer41DataTable: db $2f, 8 db $06, 5 -BattleTowerTrainer42DataTable: +; BattleTowerTrainerData table 42: db $36, 3 db $30, 4 db $17, 4 @@ -842,7 +842,7 @@ BattleTowerTrainer42DataTable: db $07, 13 db $3b, 13 -BattleTowerTrainer43DataTable: +; BattleTowerTrainerData table 43: db $0b, 5 db $14, 6 db $24, 4 @@ -862,7 +862,7 @@ BattleTowerTrainer43DataTable: db $00, 2 db $07, 5 -BattleTowerTrainer44DataTable: +; BattleTowerTrainerData table 44: db $0a, 3 db $32, 7 db $0b, 14 @@ -882,7 +882,7 @@ BattleTowerTrainer44DataTable: db $1e, 6 db $14, 7 -BattleTowerTrainer45DataTable: +; BattleTowerTrainerData table 45: db $0e, 6 db $2c, 4 db $00, 13 @@ -902,7 +902,7 @@ BattleTowerTrainer45DataTable: db $31, 4 db $21, 13 -BattleTowerTrainer46DataTable: +; BattleTowerTrainerData table 46: db $22, 5 db $07, 14 db $30, 4 @@ -922,7 +922,7 @@ BattleTowerTrainer46DataTable: db $3f, 4 db $06, 5 -BattleTowerTrainer47DataTable: +; BattleTowerTrainerData table 47: db $3a, 7 db $3b, 7 db $36, 3 @@ -942,7 +942,7 @@ BattleTowerTrainer47DataTable: db $3f, 4 db $0c, 13 -BattleTowerTrainer48DataTable: +; BattleTowerTrainerData table 48: db $43, 3 db $20, 4 db $41, 13 @@ -962,7 +962,7 @@ BattleTowerTrainer48DataTable: db $39, 4 db $41, 13 -BattleTowerTrainer49DataTable: +; BattleTowerTrainerData table 49: db $36, 3 db $16, 4 db $08, 6 @@ -982,7 +982,7 @@ BattleTowerTrainer49DataTable: db $2c, 13 db $00, 5 -BattleTowerTrainer50DataTable: +; BattleTowerTrainerData table 50: db $11, 5 db $25, 3 db $33, 4 @@ -1002,7 +1002,7 @@ BattleTowerTrainer50DataTable: db $19, 13 db $06, 5 -BattleTowerTrainer51DataTable: +; BattleTowerTrainerData table 51: db $2c, 4 db $0a, 13 db $04, 5 @@ -1022,7 +1022,7 @@ BattleTowerTrainer51DataTable: db $29, 8 db $05, 13 -BattleTowerTrainer52DataTable: +; BattleTowerTrainerData table 52: db $05, 3 db $1b, 4 db $41, 3 @@ -1042,7 +1042,7 @@ BattleTowerTrainer52DataTable: db $1d, 11 db $03, 5 -BattleTowerTrainer53DataTable: +; BattleTowerTrainerData table 53: db $1c, 12 db $20, 6 db $05, 8 @@ -1062,7 +1062,7 @@ BattleTowerTrainer53DataTable: db $06, 5 db $1f, 8 -BattleTowerTrainer54DataTable: +; BattleTowerTrainerData table 54: db $37, 3 db $0e, 1 db $08, 1 @@ -1082,7 +1082,7 @@ BattleTowerTrainer54DataTable: db $41, 8 db $3b, 13 -BattleTowerTrainer55DataTable: +; BattleTowerTrainerData table 55: db $06, 2 db $00, 5 db $34, 3 @@ -1102,7 +1102,7 @@ BattleTowerTrainer55DataTable: db $1b, 4 db $0c, 13 -BattleTowerTrainer56DataTable: +; BattleTowerTrainerData table 56: db $2c, 4 db $13, 9 db $20, 6 @@ -1122,7 +1122,7 @@ BattleTowerTrainer56DataTable: db $06, 13 db $3b, 13 -BattleTowerTrainer57DataTable: +; BattleTowerTrainerData table 57: db $06, 3 db $20, 4 db $24, 13 @@ -1142,7 +1142,7 @@ BattleTowerTrainer57DataTable: db $09, 6 db $06, 5 -BattleTowerTrainer58DataTable: +; BattleTowerTrainerData table 58: db $44, 7 db $23, 11 db $33, 13 @@ -1162,7 +1162,7 @@ BattleTowerTrainer58DataTable: db $11, 8 db $41, 13 -BattleTowerTrainer59DataTable: +; BattleTowerTrainerData table 59: db $36, 3 db $06, 6 db $30, 4 @@ -1182,7 +1182,7 @@ BattleTowerTrainer59DataTable: db $0b, 6 db $27, 6 -BattleTowerTrainer60DataTable: +; BattleTowerTrainerData table 60: db $14, 5 db $04, 2 db $09, 14 @@ -1202,7 +1202,7 @@ BattleTowerTrainer60DataTable: db $39, 4 db $00, 5 -BattleTowerTrainer61DataTable: +; BattleTowerTrainerData table 61: db $34, 3 db $00, 3 db $11, 13 @@ -1222,7 +1222,7 @@ BattleTowerTrainer61DataTable: db $1e, 6 db $14, 13 -BattleTowerTrainer62DataTable: +; BattleTowerTrainerData table 62: db $37, 5 db $37, 5 db $00, 5 @@ -1242,7 +1242,7 @@ BattleTowerTrainer62DataTable: db $16, 5 db $01, 5 -BattleTowerTrainer63DataTable: +; BattleTowerTrainerData table 63: db $1f, 14 db $36, 4 db $40, 13 @@ -1262,7 +1262,7 @@ BattleTowerTrainer63DataTable: db $27, 13 db $00, 0 -BattleTowerTrainer64DataTable: +; BattleTowerTrainerData table 64: db $41, 8 db $0b, 6 db $37, 3 @@ -1282,7 +1282,7 @@ BattleTowerTrainer64DataTable: db $28, 6 db $06, 5 -BattleTowerTrainer65DataTable: +; BattleTowerTrainerData table 65: db $0c, 8 db $2c, 4 db $1c, 11 @@ -1302,7 +1302,7 @@ BattleTowerTrainer65DataTable: db $20, 6 db $22, 7 -BattleTowerTrainer66DataTable: +; BattleTowerTrainerData table 66: db $22, 12 db $22, 12 db $0a, 9 @@ -1322,7 +1322,7 @@ BattleTowerTrainer66DataTable: db $02, 7 db $04, 5 -BattleTowerTrainer67DataTable: +; BattleTowerTrainerData table 67: db $2d, 11 db $02, 8 db $37, 13 @@ -1342,7 +1342,7 @@ BattleTowerTrainer67DataTable: db $10, 5 db $04, 5 -BattleTowerTrainer68DataTable: +; BattleTowerTrainerData table 68: db $3f, 3 db $16, 14 db $3f, 8 @@ -1362,7 +1362,7 @@ BattleTowerTrainer68DataTable: db $26, 7 db $03, 5 -BattleTowerTrainer69DataTable: +; BattleTowerTrainerData table 69: db $3a, 6 db $2c, 3 db $12, 3 @@ -1382,7 +1382,7 @@ BattleTowerTrainer69DataTable: db $1b, 7 db $00, 5 -BattleTowerTrainer70DataTable: +; BattleTowerTrainerData table 70: db $1b, 2 db $00, 5 db $0c, 8 @@ -1401,4 +1401,3 @@ BattleTowerTrainer70DataTable: db $22, 7 db $d1, 0 db $32, 13 -BattleTowerTrainerDataEnd: diff --git a/data/collision_permissions.asm b/data/collision/collision_permissions.asm similarity index 100% rename from data/collision_permissions.asm rename to data/collision/collision_permissions.asm diff --git a/data/events/collision_stdscripts.asm b/data/collision/collision_stdscripts.asm similarity index 100% rename from data/events/collision_stdscripts.asm rename to data/collision/collision_stdscripts.asm diff --git a/data/events/field_move_blocks.asm b/data/collision/field_move_blocks.asm similarity index 90% rename from data/events/field_move_blocks.asm rename to data/collision/field_move_blocks.asm index fea80f537..444be14bb 100644 --- a/data/events/field_move_blocks.asm +++ b/data/collision/field_move_blocks.asm @@ -1,3 +1,4 @@ +; these blocks all use COLL_CUT_TREE in one quadrant CutTreeBlockPointers: ; tileset, block list pointer dbw TILESET_JOHTO, .johto @@ -42,6 +43,8 @@ CutTreeBlockPointers: db $0f, $17, 0 db -1 ; end + +; these blocks all use COLL_WHIRLPOOL in one quadrant WhirlpoolBlockPointers: dbw TILESET_JOHTO, .johto db -1 ; end diff --git a/data/decorations/decorations.asm b/data/decorations/decorations.asm index 947bca1b9..e3ec28f1c 100644 --- a/data/decorations/decorations.asm +++ b/data/decorations/decorations.asm @@ -48,7 +48,8 @@ DecorationIDs: db DECO_BIG_SNORLAX_DOLL ; 1a db DECO_BIG_ONIX_DOLL ; 1b db DECO_BIG_LAPRAS_DOLL ; 1c -TrophyIDs: + db DECO_GOLD_TROPHY_DOLL ; 33 db DECO_SILVER_TROPHY_DOLL ; 34 - db -1 + + db -1 ; end diff --git a/data/events/engine_flags.asm b/data/events/engine_flags.asm index f43e64aea..526413651 100644 --- a/data/events/engine_flags.asm +++ b/data/events/engine_flags.asm @@ -125,7 +125,7 @@ EngineFlags: engine_flag wSwarmFlags, SWARMFLAGS_BUENAS_PASSWORD_F engine_flag wSwarmFlags, SWARMFLAGS_GOLDENROD_DEPT_STORE_SALE_F - engine_flag wGameTimerPause, GAMETIMERPAUSE_MOBILE_7_F + engine_flag wGameTimerPaused, GAME_TIMER_MOBILE_F engine_flag wPlayerGender, PLAYERGENDER_FEMALE_F diff --git a/data/events/special_pointers.asm b/data/events/special_pointers.asm index e1702991c..e2814b879 100644 --- a/data/events/special_pointers.asm +++ b/data/events/special_pointers.asm @@ -55,8 +55,8 @@ SpecialsPointers:: add_special UnownPuzzle add_special SlotMachine add_special CardFlip - add_special DummyNonfunctionalGameCornerGame - add_special ClearBGPalettesBufferScreen + add_special UnusedDummyGame ; unused + add_special ClearBGPalettesBufferScreen ; unused add_special FadeOutPalettes add_special BattleTowerFade add_special FadeBlackQuickly @@ -65,21 +65,21 @@ SpecialsPointers:: add_special ReloadSpritesNoPalettes ; bank 0 add_special ClearBGPalettes ; bank 0 add_special UpdateTimePals ; bank 0 - add_special ClearTilemap ; bank 0 + add_special ClearTilemap ; bank 0; unused as special add_special UpdateSprites ; bank 0 add_special UpdatePlayerSprite ; bank 0 add_special GameCornerPrizeMonCheckDex - add_special UnusedSetSeenMon + add_special UnusedSetSeenMon ; unused add_special WaitSFX ; bank 0 add_special PlayMapMusic ; bank 0 add_special RestartMapMusic ; bank 0 add_special HealMachineAnim add_special SurfStartStep - add_special FindPartyMonAboveLevel - add_special FindPartyMonAtLeastThatHappy + add_special FindPartyMonAboveLevel ; unused + add_special FindPartyMonAtLeastThatHappy ; unused add_special FindPartyMonThatSpecies add_special FindPartyMonThatSpeciesYourTrainerID - add_special UnusedCheckUnusedTwoDayTimer + add_special UnusedCheckUnusedTwoDayTimer ; unused add_special DayCareMon1 add_special DayCareMon2 add_special SelectRandomBugContestContestants @@ -134,7 +134,7 @@ SpecialsPointers:: add_special Function170114 add_special BattleTowerBattle add_special Function1704e1 - add_special DummySpecial_17021d + add_special UnusedBattleTowerDummySpecial1 add_special LoadOpponentTrainerAndPokemonWithOTSprite add_special Function11ba38 add_special CheckForBattleTowerRules @@ -166,7 +166,7 @@ SpecialsPointers:: add_special BeastsCheck add_special MonCheck add_special SetPlayerPalette - add_special DummySpecial_170bd2 + add_special UnusedBattleTowerDummySpecial2 add_special Mobile_SelectThreeMons add_special Function1037eb add_special Function10383c @@ -179,6 +179,7 @@ SpecialsPointers:: add_special AskRememberPassword add_special LoadMapPalettes add_special UnusedFindItemInPCOrBag + add_special InitialSetDSTFlag add_special InitialClearDSTFlag - add_special DummySpecial_c224 + add_special UnusedDummySpecial ; unused diff --git a/data/maps/blocks.asm b/data/maps/blocks.asm index 747bfefe4..0c59e4fc1 100644 --- a/data/maps/blocks.asm +++ b/data/maps/blocks.asm @@ -15,7 +15,7 @@ Route44_Blocks: Route28_Blocks: INCBIN "maps/Route28.blk" -BetaPlayersHouse2F_Blocks: +BetaPlayersHouse2F_Blocks: ; unreferenced INCBIN "maps/unused/BetaPlayersHouse2F.blk" CeladonCity_Blocks: @@ -30,25 +30,25 @@ Route2_Blocks: ElmsHouse_Blocks: INCBIN "maps/ElmsHouse.blk" -BetaSproutTower1_Blocks: +BetaSproutTower1_Blocks: ; unreferenced INCBIN "maps/unused/BetaSproutTower1.blk" Route11_Blocks: INCBIN "maps/Route11.blk" -BetaSproutTower5_Blocks: +BetaSproutTower5_Blocks: ; unreferenced INCBIN "maps/unused/BetaSproutTower5.blk" Route15_Blocks: INCBIN "maps/Route15.blk" -BetaSproutTower9_Blocks: +BetaSproutTower9_Blocks: ; unreferenced INCBIN "maps/unused/BetaSproutTower9.blk" Route19_Blocks: INCBIN "maps/Route19.blk" -BetaBlackthornCity_Blocks: +BetaBlackthornCity_Blocks: ; unreferenced INCBIN "maps/unused/BetaBlackthornCity.blk" Route10South_Blocks: @@ -94,7 +94,7 @@ Route25_Blocks: Route24_Blocks: INCBIN "maps/Route24.blk" -BetaVioletCity_Blocks: +BetaVioletCity_Blocks: ; unreferenced INCBIN "maps/unused/BetaVioletCity.blk" Route3_Blocks: @@ -103,25 +103,25 @@ Route3_Blocks: PewterCity_Blocks: INCBIN "maps/PewterCity.blk" -BetaSilverCaveOutside_Blocks: +BetaSilverCaveOutside_Blocks: ; unreferenced INCBIN "maps/unused/BetaSilverCaveOutside.blk" -BetaSproutTower2_Blocks: +BetaSproutTower2_Blocks: ; unreferenced INCBIN "maps/unused/BetaSproutTower2.blk" Route12_Blocks: INCBIN "maps/Route12.blk" -BetaGoldenrodCity_Blocks: +BetaGoldenrodCity_Blocks: ; unreferenced INCBIN "maps/unused/BetaGoldenrodCity.blk" Route20_Blocks: INCBIN "maps/Route20.blk" -BetaSproutTower6_Blocks: +BetaSproutTower6_Blocks: ; unreferenced INCBIN "maps/unused/BetaSproutTower6.blk" -BetaPokecenter_Blocks: +BetaPokecenter_Blocks: ; unreferenced INCBIN "maps/unused/BetaPokecenter.blk" Route30_Blocks: @@ -145,7 +145,7 @@ FuchsiaCity_Blocks: Route38_Blocks: INCBIN "maps/Route38.blk" -BetaCianwoodCity_Blocks: +BetaCianwoodCity_Blocks: ; unreferenced INCBIN "maps/unused/BetaCianwoodCity.blk" OlivineTimsHouse_Blocks: @@ -214,10 +214,10 @@ Route29Route46Gate_Blocks: Route5SaffronGate_Blocks: INCBIN "maps/NorthSouthGate.blk" -BetaEcruteakCity_Blocks: +BetaEcruteakCity_Blocks: ; unreferenced INCBIN "maps/unused/BetaEcruteakCity.blk" -BetaCherrygroveCity_Blocks: +BetaCherrygroveCity_Blocks: ; unreferenced INCBIN "maps/unused/BetaCherrygroveCity.blk" CinnabarIsland_Blocks: @@ -229,7 +229,7 @@ Route4_Blocks: Route8_Blocks: INCBIN "maps/Route8.blk" -BetaSproutTower3_Blocks: +BetaSproutTower3_Blocks: ; unreferenced INCBIN "maps/unused/BetaSproutTower3.blk" ViridianCity_Blocks: @@ -241,13 +241,13 @@ Route13_Blocks: Route21_Blocks: INCBIN "maps/Route21.blk" -BetaSproutTower7_Blocks: +BetaSproutTower7_Blocks: ; unreferenced INCBIN "maps/unused/BetaSproutTower7.blk" Route17_Blocks: INCBIN "maps/Route17.blk" -BetaMahoganyTown_Blocks: +BetaMahoganyTown_Blocks: ; unreferenced INCBIN "maps/unused/BetaMahoganyTown.blk" Route31_Blocks: @@ -280,16 +280,16 @@ Route17Route18Gate_Blocks: Route31VioletGate_Blocks: INCBIN "maps/EastWestGate.blk" -BetaAzaleaTown_Blocks: +BetaAzaleaTown_Blocks: ; unreferenced INCBIN "maps/unused/BetaAzaleaTown.blk" VermilionCity_Blocks: INCBIN "maps/VermilionCity.blk" -BetaOlivineCity_Blocks: +BetaOlivineCity_Blocks: ; unreferenced INCBIN "maps/unused/BetaOlivineCity.blk" -BetaNewBarkTown_Blocks: +BetaNewBarkTown_Blocks: ; unreferenced INCBIN "maps/unused/BetaNewBarkTown.blk" ElmsLab_Blocks: @@ -316,7 +316,7 @@ SECTION "Map Blocks 2", ROMX Route14_Blocks: INCBIN "maps/Route14.blk" -BetaSproutTower8_Blocks: +BetaSproutTower8_Blocks: ; unreferenced INCBIN "maps/unused/BetaSproutTower8.blk" OlivineMart_Blocks: @@ -337,7 +337,7 @@ CherrygroveMart_Blocks: Route10North_Blocks: INCBIN "maps/Route10North.blk" -BetaLakeOfRage_Blocks: +BetaLakeOfRage_Blocks: ; unreferenced INCBIN "maps/unused/BetaLakeOfRage.blk" OlivinePokecenter1F_Blocks: @@ -363,25 +363,25 @@ SaffronPokecenter1F_Blocks: CherrygrovePokecenter1F_Blocks: INCBIN "maps/Pokecenter1F.blk" -BetaPewterMuseumOfScience1F_Blocks: +BetaPewterMuseumOfScience1F_Blocks: ; unreferenced INCBIN "maps/unused/BetaPewterMuseumOfScience1F.blk" -BetaPewterMuseumOfScience2F_Blocks: +BetaPewterMuseumOfScience2F_Blocks: ; unreferenced INCBIN "maps/unused/BetaPewterMuseumOfScience2F.blk" EarlsPokemonAcademy_Blocks: INCBIN "maps/EarlsPokemonAcademy.blk" -BetaCinnabarPokemonLabHallway_Blocks: +BetaCinnabarPokemonLabHallway_Blocks: ; unreferenced INCBIN "maps/unused/BetaCinnabarPokemonLabHallway.blk" -BetaCinnabarPokemonLabRoom1_Blocks: +BetaCinnabarPokemonLabRoom1_Blocks: ; unreferenced INCBIN "maps/unused/BetaCinnabarPokemonLabRoom1.blk" -BetaCinnabarPokemonLabRoom2_Blocks: +BetaCinnabarPokemonLabRoom2_Blocks: ; unreferenced INCBIN "maps/unused/BetaCinnabarPokemonLabRoom2.blk" -BetaCinnabarPokemonLabRoom3_Blocks: +BetaCinnabarPokemonLabRoom3_Blocks: ; unreferenced INCBIN "maps/unused/BetaCinnabarPokemonLabRoom3.blk" GoldenrodDeptStore1F_Blocks: @@ -424,7 +424,7 @@ CeladonMansion3F_Blocks: CeladonMansionRoof_Blocks: INCBIN "maps/CeladonMansionRoof.blk" -BetaHouse_Blocks: +BetaHouse_Blocks: ; unreferenced INCBIN "maps/unused/BetaHouse.blk" CeladonGameCorner_Blocks: @@ -446,7 +446,7 @@ VioletNicknameSpeechHouse_Blocks: VioletKylesHouse_Blocks: INCBIN "maps/House2.blk" -BetaUnionCave_Blocks: +BetaUnionCave_Blocks: ; unreferenced INCBIN "maps/unused/BetaUnionCave.blk" UnionCaveB1F_Blocks: @@ -466,7 +466,7 @@ Route5UndergroundPathEntrance_Blocks: Route6UndergroundPathEntrance_Blocks: INCBIN "maps/UndergroundPathEntrance.blk" -BetaCapsuleHouse_Blocks: +BetaCapsuleHouse_Blocks: ; unreferenced INCBIN "maps/unused/BetaCapsuleHouse.blk" KurtsHouse_Blocks: @@ -478,7 +478,7 @@ GoldenrodMagnetTrainStation_Blocks: RuinsOfAlphOutside_Blocks: INCBIN "maps/RuinsOfAlphOutside.blk" -BetaRuinsOfAlphUnsolvedPuzzleRoom_Blocks: +BetaRuinsOfAlphUnsolvedPuzzleRoom_Blocks: ; unreferenced INCBIN "maps/unused/BetaRuinsOfAlphUnsolvedPuzzleRoom.blk" RuinsOfAlphInnerChamber_Blocks: @@ -493,19 +493,19 @@ RuinsOfAlphAerodactylChamber_Blocks: SproutTower1F_Blocks: INCBIN "maps/SproutTower1F.blk" -BetaSproutTowerCutOut1_Blocks: +BetaSproutTowerCutOut1_Blocks: ; unreferenced INCBIN "maps/unused/BetaSproutTowerCutOut1.blk" SproutTower2F_Blocks: INCBIN "maps/SproutTower2F.blk" -BetaSproutTowerCutOut2_Blocks: +BetaSproutTowerCutOut2_Blocks: ; unreferenced INCBIN "maps/unused/BetaSproutTowerCutOut2.blk" SproutTower3F_Blocks: INCBIN "maps/SproutTower3F.blk" -BetaSproutTowerCutOut3_Blocks: +BetaSproutTowerCutOut3_Blocks: ; unreferenced INCBIN "maps/unused/BetaSproutTowerCutOut3.blk" RadioTower1F_Blocks: @@ -583,7 +583,7 @@ GoldenrodDeptStoreB1F_Blocks: GoldenrodUndergroundWarehouse_Blocks: INCBIN "maps/GoldenrodUndergroundWarehouse.blk" -BetaElevator_Blocks: +BetaElevator_Blocks: ; unreferenced INCBIN "maps/unused/BetaElevator.blk" TinTower1F_Blocks: @@ -622,7 +622,7 @@ BurnedTower1F_Blocks: BurnedTowerB1F_Blocks: INCBIN "maps/BurnedTowerB1F.blk" -BetaCaveTestMap_Blocks: +BetaCaveTestMap_Blocks: ; unreferenced INCBIN "maps/unused/BetaCaveTestMap.blk" MountMortar1FOutside_Blocks: @@ -685,16 +685,16 @@ SilverCaveRoom2_Blocks: SilverCaveRoom3_Blocks: INCBIN "maps/SilverCaveRoom3.blk" -BetaRocketHideoutB2F_Blocks: +BetaRocketHideoutB2F_Blocks: ; unreferenced INCBIN "maps/unused/BetaRocketHideoutB2F.blk" -BetaRocketHideoutB1F_Blocks: +BetaRocketHideoutB1F_Blocks: ; unreferenced INCBIN "maps/unused/BetaRocketHideoutB1F.blk" -BetaRocketHideout1F_Blocks: +BetaRocketHideout1F_Blocks: ; unreferenced INCBIN "maps/unused/BetaRocketHideout1F.blk" -BetaRocketHideoutB3F_Blocks: +BetaRocketHideoutB3F_Blocks: ; unreferenced INCBIN "maps/unused/BetaRocketHideoutB3F.blk" MahoganyMart1F_Blocks: @@ -710,7 +710,7 @@ TeamRocketBaseB2F_Blocks: TeamRocketBaseB3F_Blocks: INCBIN "maps/TeamRocketBaseB3F.blk" -BetaRoute23_Blocks: +BetaRoute23_Blocks: ; unreferenced INCBIN "maps/unused/BetaRoute23.blk" IndigoPlateauPokecenter1F_Blocks: @@ -746,7 +746,7 @@ MahoganyGym_Blocks: OlivineGym_Blocks: INCBIN "maps/OlivineGym.blk" -BetaUnknownGym_Blocks: +BetaUnknownGym_Blocks: ; unreferenced INCBIN "maps/unused/BetaUnknownGym.blk" CianwoodGym_Blocks: @@ -779,7 +779,7 @@ OlivineLighthouse6F_Blocks: SECTION "Map Blocks 3", ROMX -BetaSlowpokeWell1F_Blocks: +BetaSlowpokeWell1F_Blocks: ; unreferenced INCBIN "maps/unused/BetaSlowpokeWell1F.blk" SlowpokeWellB1F_Blocks: @@ -824,7 +824,7 @@ FastShip1F_Blocks: FastShipB1F_Blocks: INCBIN "maps/FastShipB1F.blk" -BetaFastShipInsideCutOut_Blocks: +BetaFastShipInsideCutOut_Blocks: ; unreferenced INCBIN "maps/unused/BetaFastShipInsideCutOut.blk" FastShipCabins_NNW_NNE_NE_Blocks: @@ -913,13 +913,13 @@ PewterGym_Blocks: CeladonGym_Blocks: INCBIN "maps/CeladonGym.blk" -BetaCeladonMansion1F_Blocks: +BetaCeladonMansion1F_Blocks: ; unreferenced INCBIN "maps/unused/BetaCeladonMansion1F.blk" CeladonCafe_Blocks: INCBIN "maps/CeladonCafe.blk" -BetaCeladonMansion2F_Blocks: +BetaCeladonMansion2F_Blocks: ; unreferenced INCBIN "maps/unused/BetaCeladonMansion2F.blk" RockTunnel1F_Blocks: @@ -1040,7 +1040,7 @@ BattleTowerElevator_Blocks: BattleTowerOutside_Blocks: INCBIN "maps/BattleTowerOutside.blk" -BetaBlank_Blocks: +BetaBlank_Blocks: ; unreferenced INCBIN "maps/unused/BetaBlank.blk" GoldenrodDeptStoreRoof_Blocks: diff --git a/data/maps/landmarks.asm b/data/maps/landmarks.asm index d34b85987..9a28ee52e 100644 --- a/data/maps/landmarks.asm +++ b/data/maps/landmarks.asm @@ -128,7 +128,7 @@ WhirlIslandsName: db "WHIRL¯ISLANDS@" MtMortarName: db "MT.MORTAR@" DragonsDenName: db "DRAGON'S¯DEN@" IcePathName: db "ICE PATH@" -NotApplicableName: db "N/A@" ; "オバケやしき" ("HAUNTED HOUSE") in Japanese +NotApplicableName: db "N/A@" ; unreferenced ; "オバケやしき" ("HAUNTED HOUSE") in Japanese PalletTownName: db "PALLET TOWN@" ViridianCityName: db "VIRIDIAN¯CITY@" PewterCityName: db "PEWTER CITY@" @@ -144,11 +144,11 @@ VictoryRoadName: db "VICTORY¯ROAD@" MtMoonName: db "MT.MOON@" RockTunnelName: db "ROCK TUNNEL@" LavRadioTowerName: db "LAV¯RADIO TOWER@" -SilphCoName: db "SILPH CO.@" -SafariZoneName: db "SAFARI ZONE@" +SilphCoName: db "SILPH CO.@" ; unreferenced +SafariZoneName: db "SAFARI ZONE@" ; unreferenced SeafoamIslandsName: db "SEAFOAM¯ISLANDS@" -PokemonMansionName: db "#MON¯MANSION@" -CeruleanCaveName: db "CERULEAN¯CAVE@" +PokemonMansionName: db "#MON¯MANSION@" ; unreferenced +CeruleanCaveName: db "CERULEAN¯CAVE@" ; unreferenced Route1Name: db "ROUTE 1@" Route2Name: db "ROUTE 2@" Route3Name: db "ROUTE 3@" @@ -199,7 +199,7 @@ DarkCaveName: db "DARK CAVE@" IlexForestName: db "ILEX¯FOREST@" BurnedTowerName: db "BURNED¯TOWER@" FastShipName: db "FAST SHIP@" -ViridianForestName: db "VIRIDIAN¯FOREST@" +ViridianForestName: db "VIRIDIAN¯FOREST@" ; unreferenced DiglettsCaveName: db "DIGLETT'S¯CAVE@" TohjoFallsName: db "TOHJO FALLS@" UndergroundName: db "UNDERGROUND@" diff --git a/data/moves/animations.asm b/data/moves/animations.asm index e022ed98f..bba0d186f 100644 --- a/data/moves/animations.asm +++ b/data/moves/animations.asm @@ -481,7 +481,7 @@ BattleAnim_SendOutMon: BattleAnim_ReturnMon: anim_sound 0, 0, SFX_BALL_POOF -.anim: +BattleAnimSub_Return: anim_bgeffect ANIM_BG_RETURN_MON, $0, BG_EFFECT_USER, $0 anim_wait 32 anim_ret @@ -1314,7 +1314,7 @@ BattleAnim_RazorWind: anim_wait 24 anim_ret -BattleAnim_Sonicboom_JP: +BattleAnim_Sonicboom_JP: ; unreferenced anim_2gfx ANIM_GFX_WHIP, ANIM_GFX_HIT .loop anim_sound 3, 0, SFX_RAZOR_WIND @@ -4106,7 +4106,7 @@ BattleAnim_BatonPass: anim_1gfx ANIM_GFX_MISC anim_obj ANIM_OBJ_BATON_PASS, 44, 104, $20 anim_sound 0, 0, SFX_BATON_PASS - anim_call BattleAnim_ReturnMon.anim + anim_call BattleAnimSub_Return anim_wait 64 anim_ret diff --git a/data/phone/text/elm.asm b/data/phone/text/elm.asm index 8685367f0..611f41e24 100644 --- a/data/phone/text/elm.asm +++ b/data/phone/text/elm.asm @@ -197,7 +197,6 @@ ElmPhoneGiftText: para "See you later!" done -; unused ElmPhoneGotAholdOfSomethingNeatText: text "Hello, ?" line "How's it going?" diff --git a/data/phone/text/todd_overworld.asm b/data/phone/text/todd_overworld.asm index 6b4e9dd4c..11e34e9a8 100644 --- a/data/phone/text/todd_overworld.asm +++ b/data/phone/text/todd_overworld.asm @@ -57,9 +57,8 @@ ToddRematchText: line "my #MON better!" done -UnusedText_0xa43ca: -; This is unused; Todd says this during the department store sale, -; but this is a duplicate of the actual string in the Route 34 scripts. +ToddSaleText: ; unreferenced +; This is a duplicate of CamperToddSaleText in maps/Route34.asm. text "Shopping under the" line "sky!" diff --git a/data/player_names.asm b/data/player_names.asm index 6263cb828..d537af5dc 100644 --- a/data/player_names.asm +++ b/data/player_names.asm @@ -2,8 +2,8 @@ ChrisNameMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, 10, TEXTBOX_Y - 1 dw .MaleNames - db 1 ; ???? - db 0 ; default option + db 1 ; default option + db 0 ; ???? .MaleNames: db STATICMENU_CURSOR | STATICMENU_PLACE_TITLE | STATICMENU_DISABLE_B ; flags @@ -21,8 +21,8 @@ KrisNameMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, 10, TEXTBOX_Y - 1 dw .FemaleNames - db 1 ; ???? - db 0 ; default option + db 1 ; default option + db 0 ; ???? .FemaleNames: db STATICMENU_CURSOR | STATICMENU_PLACE_TITLE | STATICMENU_DISABLE_B ; flags diff --git a/data/sprite_anims/framesets.asm b/data/sprite_anims/framesets.asm index 1052f6aad..5a154acd8 100644 --- a/data/sprite_anims/framesets.asm +++ b/data/sprite_anims/framesets.asm @@ -245,45 +245,45 @@ SpriteAnimFrameData: frame SPRITE_ANIM_OAMSET_MAGNET_TRAIN_RED_2, 8, OAM_X_FLIP dorestart -; unused +.Frameset_Unknown1: ; unreferenced frame SPRITE_ANIM_OAMSET_UNUSED_43, 8 frame SPRITE_ANIM_OAMSET_UNUSED_44, 8 dorestart -; unused +.Frameset_Unknown2: ; unreferenced frame SPRITE_ANIM_OAMSET_UNUSED_45, 8 frame SPRITE_ANIM_OAMSET_UNUSED_46, 8 dorestart -; unused +.Frameset_Unknown3: ; unreferenced frame SPRITE_ANIM_OAMSET_UNUSED_47, 8 frame SPRITE_ANIM_OAMSET_UNUSED_48, 8 dorestart -; unused +.Frameset_Unknown4: ; unreferenced frame SPRITE_ANIM_OAMSET_UNUSED_49, 1 frame SPRITE_ANIM_OAMSET_UNUSED_49, 1, OAM_X_FLIP frame SPRITE_ANIM_OAMSET_UNUSED_49, 1, OAM_X_FLIP, OAM_Y_FLIP frame SPRITE_ANIM_OAMSET_UNUSED_49, 1, OAM_Y_FLIP dorestart -; unused +.Frameset_Unknown5: ; unreferenced frame SPRITE_ANIM_OAMSET_UNUSED_4A, 32 endanim -; unused +.Frameset_Unknown6: ; unreferenced frame SPRITE_ANIM_OAMSET_UNUSED_4B, 32 endanim -; unused +.Frameset_Unknown7: ; unreferenced frame SPRITE_ANIM_OAMSET_UNUSED_4C, 32 endanim -; unused +.Frameset_Unknown8: ; unreferenced frame SPRITE_ANIM_OAMSET_UNUSED_4D, 32 endanim -; unused +.Frameset_Unknown9: ; unreferenced frame SPRITE_ANIM_OAMSET_UNUSED_4E, 3 dowait 3 dorestart diff --git a/data/sprite_anims/oam.asm b/data/sprite_anims/oam.asm index 84fb1fdcd..10e6ed1d9 100644 --- a/data/sprite_anims/oam.asm +++ b/data/sprite_anims/oam.asm @@ -181,7 +181,7 @@ SpriteAnimOAMData: dbsprite -1, 0, 0, 0, $00, 7 | Y_FLIP dbsprite 0, 0, 0, 0, $00, 7 | X_FLIP | Y_FLIP -; unused +.OAMData_Unknown1: ; unreferenced db 4 dbsprite -1, -1, 0, 0, $00, 0 | PRIORITY dbsprite 0, -1, 0, 0, $00, 0 | X_FLIP | PRIORITY @@ -305,7 +305,7 @@ SpriteAnimOAMData: dbsprite 1, 0, 4, 4, $17, 0 dbsprite 1, 1, 4, 4, $18, 0 -; unused +.OAMData_Unknown2: ; unreferenced db 36 dbsprite -3, -3, 0, 0, $00, 0 dbsprite -2, -3, 0, 0, $01, 0 diff --git a/data/text/battle.asm b/data/text/battle.asm index 48d0ff483..fc2e3a1cf 100644 --- a/data/text/battle.asm +++ b/data/text/battle.asm @@ -349,7 +349,7 @@ BattleText_StringBuffer1GrewToLevel: sound_dex_fanfare_50_79 text_end - text_end ; unused + text_end ; unreferenced BattleText_WildMonIsEating: text "Wild @" @@ -1085,7 +1085,7 @@ BeatUpAttackText: line "attack!" done -RefusedGiftText: +PresentFailedText: text "" line "refused the gift!" prompt @@ -1102,7 +1102,7 @@ BattleText_LinkErrorBattleCanceled: line "been canceled…" prompt -BattleText_0x8188e: +BattleText_NoTimeLeftToday: ; unreferenced text "There is no time" line "left today!" done diff --git a/data/text/common_1.asm b/data/text/common_1.asm index e585a6320..46cf48b40 100644 --- a/data/text/common_1.asm +++ b/data/text/common_1.asm @@ -463,7 +463,6 @@ _MobileForPartnersMonText:: text "." done -; unreferenced _MobilePlayersMonTradeText:: text_ram wPlayerTrademonSenderName text "'s" @@ -1665,7 +1664,7 @@ _DayCareManIntroText:: cont "raise a #MON?" done -_DayCareManOddEggText:: +_DayCareManIntroEggText:: text "I'm the DAY-CARE" line "MAN. Do you know" cont "about EGGS?" @@ -1692,7 +1691,7 @@ _DayCareLadyIntroText:: line "#MON for you?" done -_DayCareLadyOddEggText:: +_DayCareLadyIntroEggText:: text "I'm the DAY-CARE" line "LADY. Do you know" cont "about EGGS?" diff --git a/data/text/common_2.asm b/data/text/common_2.asm index 4b01a5294..09cd24e4d 100644 --- a/data/text/common_2.asm +++ b/data/text/common_2.asm @@ -260,32 +260,32 @@ _MysteryGiftSentHomeText:: text "'s home." prompt -_MysteryGiftReceivedCardText:: +_NameCardReceivedCardText:: text "Received" line "@" - text_ram wc850 + text_ram wMysteryGiftCardHolderName text "'s CARD." prompt -_MysteryGiftListedCardText:: - text_ram wc850 +_NameCardListedCardText:: + text_ram wMysteryGiftCardHolderName text "'s CARD was" line "listed as no.@" text_decimal wDeciramBuffer, 1, 2 text "." prompt -_MysteryGiftNotRegisteredCardText:: +_NameCardNotRegisteredCardText:: text "The CARD was not" line "registered." prompt -_MysteryGiftLinkCancelledText:: +_NameCardLinkCancelledText:: text "The link has been" line "cancelled." prompt -_MysteryGiftLinkCommErrorText:: +_NameCardLinkCommErrorText:: text "Communication" line "error." prompt @@ -487,7 +487,6 @@ _RodNothingText:: text "Not even a nibble!" prompt -; unreferenced _UnusedNothingHereText:: text "Looks like there's" line "nothing here." diff --git a/data/text/common_3.asm b/data/text/common_3.asm index 95342d174..e081f0d32 100644 --- a/data/text/common_3.asm +++ b/data/text/common_3.asm @@ -72,7 +72,7 @@ _LinkAbnormalMonText:: _LinkAskTradeForText:: text "Trade @" - text_ram wd004 + text_ram wBufferTrademonNick text_start line "for @" text_ram wStringBuffer1 @@ -620,7 +620,6 @@ _PharmacyComeAgainText:: line "See you around." done -; unreferenced _NothingToSellText:: text "You don't have" line "anything to sell." @@ -744,25 +743,21 @@ _MainMenuTimeUnknownText:: text "Clock time unknown" done -; unreferenced mobile _DeleteSavedLoginPasswordText:: text "Delete the saved" line "LOG-IN PASSWORD?" done -; unreferenced mobile _DeletedTheLoginPasswordText:: text "Deleted the LOG-IN" line "PASSWORD." done -; unreferenced mobile _MobilePickThreeMonForBattle:: text "Pick three #MON" line "for battle." prompt -; unreferenced mobile _MobileUseTheseThreeMonText:: text_ram wMobileParticipant1Nickname text "," @@ -776,13 +771,11 @@ _MobileUseTheseThreeMonText:: para "Use these three?" done -; unreferenced mobile _MobileOnlyThreeMonMayEnterText:: text "Only three #MON" line "may enter." prompt -; unreferenced mobile _MobileCardFolderIntro1Text:: text "The CARD FOLDER" line "stores your and" @@ -800,7 +793,6 @@ _MobileCardFolderIntro1Text:: para "" done -; unreferenced mobile _MobileCardFolderIntro2Text:: text "This is your CARD." @@ -814,7 +806,6 @@ _MobileCardFolderIntro2Text:: para "" done -; unreferenced mobile _MobileCardFolderIntro3Text:: text "If you have your" line "friend's CARD, you" @@ -829,7 +820,6 @@ _MobileCardFolderIntro3Text:: para "" done -; unreferenced mobile _MobileCardFolderIntro4Text:: text "To safely store" line "your collection of" @@ -841,7 +831,6 @@ _MobileCardFolderIntro4Text:: para "" done -; unreferenced mobile _MobileCardFolderAskDeleteText:: text "If the CARD FOLDER" line "is deleted, all" @@ -858,13 +847,11 @@ _MobileCardFolderAskDeleteText:: line "your CARD FOLDER?" done -; unreferenced mobile _MobileCardFolderDeleteAreYouSureText:: text "Are you sure you" line "want to delete it?" done -; unreferenced mobile _MobileCardFolderDeletedText:: text "The CARD FOLDER" line "has been deleted." @@ -872,7 +859,6 @@ _MobileCardFolderDeletedText:: para "" done -; unreferenced mobile _MobileCardFolderAskOpenOldText:: text "There is an older" line "CARD FOLDER from a" @@ -882,13 +868,11 @@ _MobileCardFolderAskOpenOldText:: line "open it?" done -; unreferenced mobile _MobileCardFolderAskDeleteOldText:: text "Delete the old" line "CARD FOLDER?" done -; unreferenced mobile _MobileCardFolderFinishRegisteringCardsText:: text "Finish registering" line "CARDS?" diff --git a/data/text/unused_sweet_honey.asm b/data/text/unused_sweet_honey.asm index 04ceae2e6..d4970118a 100644 --- a/data/text/unused_sweet_honey.asm +++ b/data/text/unused_sweet_honey.asm @@ -8,7 +8,7 @@ ; Most of these texts seem to be associated with a single NPC. ; The last text is associated with a second NPC, probably a Butterfree. -UnusedSweetHoneyText: +UnusedSweetHoneyText: ; unreferenced text "My #MON is an" line "expert at collect-" cont "ing SWEET HONEY." @@ -17,7 +17,7 @@ UnusedSweetHoneyText: line "with you." done -UnusedSweetHoneyBagFullText: +UnusedSweetHoneyBagFullText: ; unreferenced text "I want to give you" line "some SWEET HONEY," @@ -25,17 +25,17 @@ UnusedSweetHoneyBagFullText: line "room for it." done -UnusedSweetHoneyGiveText: +UnusedSweetHoneyGiveText: ; unreferenced text "Here you go! Have" line "some SWEET HONEY!" done -UnusedGotSweetHoneyText: +UnusedGotSweetHoneyText: ; unreferenced text " received" line "SWEET HONEY." done -UnusedSweetHoneyAfterText1: +UnusedSweetHoneyAfterText1: ; unreferenced text "My little brother" line "takes SWEET HONEY" @@ -46,7 +46,7 @@ UnusedSweetHoneyAfterText1: line "up to?" done -UnusedSweetHoneyAfterText2: +UnusedSweetHoneyAfterText2: ; unreferenced text "Did you put SWEET" line "HONEY on a tree?" @@ -54,7 +54,7 @@ UnusedSweetHoneyAfterText2: line "it?" done -UnusedSweetHoneyAfterText3: +UnusedSweetHoneyAfterText3: ; unreferenced text "Did you put SWEET" line "HONEY on a tree?" @@ -63,6 +63,6 @@ UnusedSweetHoneyAfterText3: cont "be drawn to it." done -UnusedSweetHoneyButterfreeText: +UnusedSweetHoneyButterfreeText: ; unreferenced text "BUTTERFREE: Freeh!" done diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md index bda8bccad..4d7abd7a2 100644 --- a/docs/bugs_and_glitches.md +++ b/docs/bugs_and_glitches.md @@ -560,7 +560,7 @@ This bug affects Attract, Curse, Foresight, Mean Look, Mimic, Nightmare, Spider ```diff .got_mon - ld a, [wd002] + ld a, [wCurBeatUpPartyMon] ld hl, wPartyMonNicknames call GetNick ld a, MON_HP @@ -568,7 +568,7 @@ This bug affects Attract, Curse, Foresight, Mean Look, Mimic, Nightmare, Spider ld a, [hli] or [hl] jp z, .beatup_fail ; fainted - ld a, [wd002] + ld a, [wCurBeatUpPartyMon] ld c, a ld a, [wCurBattleMon] - ; BUG: this can desynchronize link battles diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm index 4de82d153..62adaca77 100644 --- a/engine/battle/ai/items.asm +++ b/engine/battle/ai/items.asm @@ -20,8 +20,9 @@ AI_SwitchOrTryItem: and a jr nz, DontSwitch + ; always load the first trainer class in wTrainerClass for Battle Tower trainers ld hl, TrainerClassAttributes + TRNATTR_AI_ITEM_SWITCH - ld a, [wInBattleTowerBattle] ; always load the first trainer class in wTrainerClass for BattleTower-Trainers + ld a, [wInBattleTowerBattle] and a jr nz, .ok @@ -29,6 +30,7 @@ AI_SwitchOrTryItem: dec a ld bc, NUM_TRAINER_ATTRIBUTES call AddNTimes + .ok bit SWITCH_OFTEN_F, [hl] jp nz, SwitchOften @@ -145,13 +147,13 @@ SwitchSometimes: ld [wEnemySwitchMonIndex], a jp AI_TrySwitch -CheckSubstatusCantRun: +CheckSubstatusCantRun: ; unreferenced ld a, [wEnemySubStatus5] bit SUBSTATUS_CANT_RUN, a ret AI_TryItem: - ; items are not allowed in the BattleTower + ; items are not allowed in the Battle Tower ld a, [wInBattleTowerBattle] and a ret nz @@ -213,7 +215,7 @@ AI_TryItem: inc hl jr c, .loop -.used_item +; used item xor a ld [de], a inc a @@ -259,7 +261,7 @@ AI_TryItem: cp e jr nc, .yes -.no +.no ; unreferenced and a ret diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index a1cdd239d..12932ede5 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -258,7 +258,7 @@ StartTrainerBattle_NextScene: StartTrainerBattle_SetUpBGMap: call StartTrainerBattle_NextScene xor a - ld [wcf64], a + ld [wBattleTransitionCounter], a ldh [hBGMapMode], a ret @@ -272,7 +272,7 @@ StartTrainerBattle_Flash: ld a, [wTimeOfDayPalset] cp DARKNESS_PALSET jr z, .done - ld hl, wcf64 + ld hl, wBattleTransitionCounter ld a, [hl] inc [hl] srl a @@ -290,7 +290,7 @@ StartTrainerBattle_Flash: .done xor a - ld [wcf64], a + ld [wBattleTransitionCounter], a scf ret @@ -322,12 +322,12 @@ StartTrainerBattle_SetUpForWavyOutro: ld a, $90 ldh [hLYOverrideEnd], a xor a - ld [wcf64], a - ld [wcf65], a + ld [wBattleTransitionCounter], a + ld [wBattleTransitionSineWaveOffset], a ret StartTrainerBattle_SineWave: - ld a, [wcf64] + ld a, [wBattleTransitionCounter] cp $60 jr nc, .end call .DoSineWave @@ -339,10 +339,10 @@ StartTrainerBattle_SineWave: ret .DoSineWave: - ld hl, wcf65 + ld hl, wBattleTransitionSineWaveOffset ld a, [hl] inc [hl] - ld hl, wcf64 + ld hl, wBattleTransitionCounter ld d, [hl] add [hl] ld [hl], a @@ -372,13 +372,13 @@ StartTrainerBattle_SetUpForSpinOutro: ldh [rSVBK], a call StartTrainerBattle_NextScene xor a - ld [wcf64], a + ld [wBattleTransitionCounter], a ret StartTrainerBattle_SpinToBlack: xor a ldh [hBGMapMode], a - ld a, [wcf64] + ld a, [wBattleTransitionCounter] ld e, a ld d, 0 ld hl, .spin_quadrants @@ -388,13 +388,13 @@ endr ld a, [hli] cp -1 jr z, .end - ld [wcf65], a + ld [wBattleTransitionSineWaveOffset], a call .load ld a, 1 ldh [hBGMapMode], a call DelayFrame call DelayFrame - ld hl, wcf64 + ld hl, wBattleTransitionCounter inc [hl] ret @@ -449,7 +449,7 @@ ENDM spin_quadrant LOWER_LEFT, .wedge1, 1, 11 db -1 -.load +.load: ld a, [hli] ld e, a ld a, [hli] @@ -464,7 +464,7 @@ ENDM inc de .loop1 ld [hl], BATTLETRANSITION_BLACK - ld a, [wcf65] + ld a, [wBattleTransitionSineWaveOffset] bit RIGHT_QUADRANT_F, a jr z, .leftside inc hl @@ -475,7 +475,7 @@ ENDM dec c jr nz, .loop1 pop hl - ld a, [wcf65] + ld a, [wBattleTransitionSineWaveOffset] bit LOWER_QUADRANT_F, a ld bc, SCREEN_WIDTH jr z, .upper @@ -490,7 +490,7 @@ ENDM jr z, .loop ld c, a .loop2 - ld a, [wcf65] + ld a, [wBattleTransitionSineWaveOffset] bit RIGHT_QUADRANT_F, a jr z, .leftside2 dec hl @@ -514,13 +514,13 @@ StartTrainerBattle_SetUpForRandomScatterOutro: ldh [rSVBK], a call StartTrainerBattle_NextScene ld a, $10 - ld [wcf64], a + ld [wBattleTransitionCounter], a ld a, 1 ldh [hBGMapMode], a ret StartTrainerBattle_SpeckleToBlack: - ld hl, wcf64 + ld hl, wBattleTransitionCounter ld a, [hl] and a jr z, .done diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 85cba5f85..f84864a95 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1697,7 +1697,7 @@ HandleWeather: cp USING_EXTERNAL_CLOCK jr z, .enemy_first -.player_first +; player first call SetPlayerTurn call .SandstormDamage call SetEnemyTurn @@ -2711,7 +2711,7 @@ AskUseNextPokemon: ForcePlayerMonChoice: call EmptyBattleTextbox call LoadStandardMenuHeader - call SetUpBattlePartyMenu_NoLoop + call SetUpBattlePartyMenu call ForcePickPartyMonInBattle ld a, [wLinkMode] and a @@ -2810,9 +2810,9 @@ IsMobileBattle: cp LINK_MOBILE ret -SetUpBattlePartyMenu_NoLoop: +SetUpBattlePartyMenu: call ClearBGPalettes -SetUpBattlePartyMenu: ; switch to fullscreen menu? +SetUpBattlePartyMenu_Loop: ; switch to fullscreen menu? farcall LoadPartyMenuGFX farcall InitPartyMenuWithCancel farcall InitPartyMenuBGPal7 @@ -3006,10 +3006,11 @@ PlayerMonFaintedAnimation: jp MonFaintedAnimation MonFaintedAnimation: - ld a, [wcfbe] + ld a, [wJoypadDisable] push af - set 6, a - ld [wcfbe], a + set JOYPAD_DISABLE_MON_FAINT_F, a + ld [wJoypadDisable], a + ld b, 7 .OuterLoop: @@ -3052,7 +3053,7 @@ MonFaintedAnimation: jr nz, .OuterLoop pop af - ld [wcfbe], a + ld [wJoypadDisable], a ret .Spaces: @@ -3486,7 +3487,7 @@ OfferSwitch: ld a, [wMenuCursorY] dec a jr nz, .said_no - call SetUpBattlePartyMenu_NoLoop + call SetUpBattlePartyMenu call PickSwitchMonInBattle jr c, .canceled_switch ld a, [wCurBattleMon] @@ -4639,7 +4640,7 @@ CheckDanger: PrintPlayerHUD: ld de, wBattleMonNick hlcoord 10, 7 - call ret_3e138 + call Battle_DummyFunction call PlaceString push bc @@ -4725,7 +4726,7 @@ DrawEnemyHUD: call GetBaseData ld de, wEnemyMonNick hlcoord 1, 0 - call ret_3e138 + call Battle_DummyFunction call PlaceString ld h, b ld l, c @@ -4854,7 +4855,8 @@ UpdateHPPal: ret z jp FinishBattleAnim -ret_3e138: +Battle_DummyFunction: +; called before placing either battler's nickname in the HUD ret BattleMenu: @@ -5043,7 +5045,7 @@ BattleMenuPKMN_ReturnFromStats: call LoadStandardMenuHeader call ClearBGPalettes BattleMenuPKMN_Loop: - call SetUpBattlePartyMenu + call SetUpBattlePartyMenu_Loop xor a ld [wPartyMenuActionText], a call JumpToPartyMenuAndPrintText @@ -7436,13 +7438,13 @@ AnimateExpBar: jp nc, .finish ldh a, [hProduct + 3] - ld [wd004], a + ld [wExperienceGained + 2], a push af ldh a, [hProduct + 2] - ld [wd003], a + ld [wExperienceGained + 1], a push af xor a - ld [wd002], a + ld [wExperienceGained], a xor a ; PARTYMON ld [wMonType], a predef CopyMonToTempMon @@ -7454,10 +7456,10 @@ AnimateExpBar: call CalcExpBar push bc ld hl, wTempMonExp + 2 - ld a, [wd004] + ld a, [wExperienceGained + 2] add [hl] ld [hld], a - ld a, [wd003] + ld a, [wExperienceGained + 1] adc [hl] ld [hld], a jr nc, .NoOverflow @@ -7781,7 +7783,8 @@ HandleSafariAngerEatingStatus: ; unreferenced jr .finish .angry - dec hl ; wSafariMonAngerCount + dec hl + assert wSafariMonEating - 1 == wSafariMonAngerCount ld a, [hl] and a ret z @@ -8785,7 +8788,7 @@ AddLastLinkBattleToLinkRecord: .FindOpponentAndAppendRecord: ld b, NUM_LINK_BATTLE_RECORDS ld hl, sLinkBattleRecord1End - 1 - ld de, wd002 + ld de, wLinkBattleRecordBuffer .loop3 push bc push de @@ -8814,16 +8817,16 @@ AddLastLinkBattleToLinkRecord: add b add b ld e, a - ld d, $0 - ld hl, wd002 + ld d, 0 + ld hl, wLinkBattleRecordBuffer add hl, de push hl ld a, c add c add c ld e, a - ld d, $0 - ld hl, wd002 + ld d, 0 + ld hl, wLinkBattleRecordBuffer add hl, de ld d, h ld e, l @@ -8855,7 +8858,7 @@ AddLastLinkBattleToLinkRecord: ld hl, sLinkBattleRecord call AddNTimes push hl - ld de, wd002 + ld de, wLinkBattleRecordBuffer ld bc, LINK_BATTLE_RECORD_LENGTH call CopyBytes pop hl @@ -8869,7 +8872,7 @@ AddLastLinkBattleToLinkRecord: push hl ld bc, LINK_BATTLE_RECORD_LENGTH call CopyBytes - ld hl, wd002 + ld hl, wLinkBattleRecordBuffer ld bc, LINK_BATTLE_RECORD_LENGTH pop de call CopyBytes @@ -8952,13 +8955,13 @@ InitBattleDisplay: ldh [rSVBK], a ld hl, wDecompressScratch - ld bc, wScratchAttrmap - wDecompressScratch + ld bc, BG_MAP_WIDTH * BG_MAP_HEIGHT ld a, " " call ByteFill ld de, wDecompressScratch hlbgcoord 0, 0 - lb bc, BANK(.BlankBGMap), $40 + lb bc, BANK(@), (BG_MAP_WIDTH * BG_MAP_HEIGHT) / LEN_2BPP_TILE call Request2bpp pop af diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index 4d670b4b1..14f1afd82 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -134,7 +134,7 @@ BattleCommand_CheckTurn: and a jp nz, CheckEnemyTurn -CheckPlayerTurn: +; check player turn ld hl, wPlayerSubStatus4 bit SUBSTATUS_RECHARGE, [hl] jr z, .no_recharge @@ -2586,7 +2586,7 @@ PlayerAttackDamage: cp SPECIAL jr nc, .special -.physical +; physical ld hl, wEnemyMonDefense ld a, [hli] ld b, a @@ -2826,9 +2826,9 @@ EnemyAttackDamage: ld a, [hl] cp SPECIAL - jr nc, .Special + jr nc, .special -.physical +; physical ld hl, wBattleMonDefense ld a, [hli] ld b, a @@ -2852,7 +2852,7 @@ EnemyAttackDamage: ld hl, wEnemyAttack jr .thickclub -.Special: +.special ld hl, wBattleMonSpclDef ld a, [hli] ld b, a @@ -5714,8 +5714,7 @@ BattleCommand_Charge: text_far _BattleDugText text_end -BattleCommand3c: -; unused +BattleCommand_Unused3C: ; unreferenced ret BattleCommand_TrapTarget: @@ -6124,7 +6123,7 @@ INCLUDE "engine/battle/move_effects/conversion.asm" BattleCommand_ResetStats: ; resetstats - ld a, 7 ; neutral + ld a, BASE_STAT_LEVEL ld hl, wPlayerStatLevels call .Fill ld hl, wEnemyStatLevels @@ -6147,7 +6146,7 @@ BattleCommand_ResetStats: jp StdBattleTextbox .Fill: - ld b, wPlayerStatLevelsEnd - wPlayerStatLevels + ld b, NUM_LEVEL_STATS .next ld [hli], a dec b @@ -6489,8 +6488,7 @@ INCLUDE "engine/battle/move_effects/sandstorm.asm" INCLUDE "engine/battle/move_effects/rollout.asm" -BattleCommand5d: -; unused +BattleCommand_Unused5D: ; unreferenced ret INCLUDE "engine/battle/move_effects/fury_cutter.asm" diff --git a/engine/battle/menu.asm b/engine/battle/menu.asm index a4955ec6a..e29bff48b 100644 --- a/engine/battle/menu.asm +++ b/engine/battle/menu.asm @@ -9,8 +9,7 @@ LoadBattleMenu: call ExitMenu ret -SafariBattleMenu: -; untranslated +SafariBattleMenu: ; unreferenced ld hl, SafariBattleMenuHeader call LoadMenuHeader jr CommonBattleMenu @@ -18,7 +17,8 @@ SafariBattleMenu: ContestBattleMenu: ld hl, ContestBattleMenuHeader call LoadMenuHeader -; fallthrough + ; fallthrough + CommonBattleMenu: ld a, [wBattleMenuCursorBuffer] ld [wMenuCursorBuffer], a diff --git a/engine/battle/move_effects/baton_pass.asm b/engine/battle/move_effects/baton_pass.asm index 46baeb75f..bafe33866 100644 --- a/engine/battle/move_effects/baton_pass.asm +++ b/engine/battle/move_effects/baton_pass.asm @@ -17,7 +17,7 @@ BattleCommand_BatonPass: ; Transition into switchmon menu call LoadStandardMenuHeader - farcall SetUpBattlePartyMenu_NoLoop + farcall SetUpBattlePartyMenu farcall ForcePickSwitchMonInBattle diff --git a/engine/battle/move_effects/beat_up.asm b/engine/battle/move_effects/beat_up.asm index 73bbb2e42..f1cc7a5c2 100644 --- a/engine/battle/move_effects/beat_up.asm +++ b/engine/battle/move_effects/beat_up.asm @@ -14,7 +14,7 @@ BattleCommand_BeatUp: call DelayFrames xor a ld [wPlayerRolloutCount], a - ld [wd002], a + ld [wCurBeatUpPartyMon], a ld [wBeatUpHitAtLeastOnce], a jr .got_mon @@ -23,10 +23,10 @@ BattleCommand_BeatUp: ld b, a ld a, [wPartyCount] sub b - ld [wd002], a + ld [wCurBeatUpPartyMon], a .got_mon - ld a, [wd002] + ld a, [wCurBeatUpPartyMon] ld hl, wPartyMonNicknames call GetNick ld a, MON_HP @@ -34,7 +34,7 @@ BattleCommand_BeatUp: ld a, [hli] or [hl] jp z, .beatup_fail ; fainted - ld a, [wd002] + ld a, [wCurBeatUpPartyMon] ld c, a ld a, [wCurBattleMon] ; BUG: this can desynchronize link battles @@ -88,7 +88,7 @@ BattleCommand_BeatUp: xor a ld [wEnemyRolloutCount], a - ld [wd002], a + ld [wCurBeatUpPartyMon], a ld [wBeatUpHitAtLeastOnce], a jr .enemy_got_mon @@ -97,7 +97,7 @@ BattleCommand_BeatUp: ld b, a ld a, [wOTPartyCount] sub b - ld [wd002], a + ld [wCurBeatUpPartyMon], a .enemy_got_mon ld a, [wBattleMode] @@ -112,7 +112,7 @@ BattleCommand_BeatUp: and a jr nz, .link_or_tower - ld a, [wd002] + ld a, [wCurBeatUpPartyMon] ld c, a ld b, 0 ld hl, wOTPartySpecies @@ -123,7 +123,7 @@ BattleCommand_BeatUp: jr .got_enemy_nick .link_or_tower - ld a, [wd002] + ld a, [wCurBeatUpPartyMon] ld hl, wOTPartyMonNicknames ld bc, NAME_LENGTH call AddNTimes @@ -137,7 +137,7 @@ BattleCommand_BeatUp: or [hl] jp z, .beatup_fail - ld a, [wd002] + ld a, [wCurBeatUpPartyMon] ld b, a ld a, [wCurOTMon] cp b @@ -217,7 +217,7 @@ GetBeatupMonLocation: ld hl, wOTPartyMon1Species .got_species - ld a, [wd002] + ld a, [wCurBeatUpPartyMon] add hl, bc call GetPartyLocation pop bc diff --git a/engine/battle/move_effects/present.asm b/engine/battle/move_effects/present.asm index 8d7461fa1..6aa35acbf 100644 --- a/engine/battle/move_effects/present.asm +++ b/engine/battle/move_effects/present.asm @@ -80,7 +80,7 @@ BattleCommand_Present: call _CheckBattleScene jr nc, .do_animation call AnimateFailedMove - ld hl, RefusedGiftText + ld hl, PresentFailedText call StdBattleTextbox .do_animation jp EndMoveEffect diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index fd2457bb3..34ef87f61 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -245,7 +245,8 @@ BattleAnim_ClearOAM: ld c, NUM_SPRITE_OAM_STRUCTS .loop ld a, [hl] - and $ff ^ (PALETTE_MASK | VRAM_BANK_1) ; PAL_BATTLE_OB_ENEMY (0) + and $ff ^ (PALETTE_MASK | VRAM_BANK_1) ; zeros out the palette bits + assert PAL_BATTLE_OB_ENEMY == 0 ld [hli], a rept SPRITEOAMSTRUCT_LENGTH - 1 inc hl @@ -1050,7 +1051,7 @@ GetMinimizePic: and a jr z, .player - ld de, sScratch + $1a tiles + ld de, sScratch + (3 * 7 + 5) tiles call CopyMinimizePic ld hl, vTiles2 tile $00 ld de, sScratch @@ -1058,7 +1059,7 @@ GetMinimizePic: ret .player - ld de, sScratch + $160 + ld de, sScratch + (3 * 6 + 4) tiles call CopyMinimizePic ld hl, vTiles2 tile $31 ld de, sScratch diff --git a/engine/battle_anims/core.asm b/engine/battle_anims/core.asm index adba64e0d..d756a447a 100644 --- a/engine/battle_anims/core.asm +++ b/engine/battle_anims/core.asm @@ -263,14 +263,12 @@ InitBattleAnimBuffer: jr nz, .no_sub ld a, [wFXAnimID] cp KINESIS - jr z, .kinesis + jr z, .do_sub cp SOFTBOILED - jr z, .softboiled + jr z, .do_sub cp MILK_DRINK jr nz, .no_sub -.kinesis -.softboiled -.milk_drink +.do_sub pop af sub 1 * 8 jr .done diff --git a/engine/battle_anims/functions.asm b/engine/battle_anims/functions.asm index 271c39252..5a04a5b65 100644 --- a/engine/battle_anims/functions.asm +++ b/engine/battle_anims/functions.asm @@ -4299,14 +4299,14 @@ BattleAnim_Cosine_e: ld e, a ret -BattleAnim_AbsSinePrecise: +BattleAnim_AbsSinePrecise: ; unreferenced ld a, e call BattleAnim_Sine ld e, l ld d, h ret -BattleAnim_AbsCosinePrecise: +BattleAnim_AbsCosinePrecise: ; unreferenced ld a, e call BattleAnim_Cosine ld e, l diff --git a/engine/debug/color_picker.asm b/engine/debug/color_picker.asm index ee9a9f6a6..40261a391 100644 --- a/engine/debug/color_picker.asm +++ b/engine/debug/color_picker.asm @@ -32,7 +32,7 @@ const DEBUGCOLORMAIN_INITTMHM ; 4 const DEBUGCOLORMAIN_TMHMJOYPAD ; 5 -DebugColorPicker: +DebugColorPicker: ; unreferenced ; A debug menu to test monster and trainer palettes at runtime. ldh a, [hCGB] and a @@ -929,13 +929,13 @@ DebugColor_FillBoxWithByte: ret DebugColor_PushSGBPals: - ld a, [wcfbe] + ld a, [wJoypadDisable] push af - set 7, a - ld [wcfbe], a + set JOYPAD_DISABLE_SGB_TRANSFER_F, a + ld [wJoypadDisable], a call _DebugColor_PushSGBPals pop af - ld [wcfbe], a + ld [wJoypadDisable], a ret _DebugColor_PushSGBPals: @@ -1069,7 +1069,7 @@ INCBIN "gfx/debug/up_arrow.2bpp" DebugColor_GFX: INCBIN "gfx/debug/color_test.2bpp" -TilesetColorPicker: +TilesetColorPicker: ; unreferenced ; A debug menu to test tileset palettes at runtime. ; dummied out ret @@ -1437,8 +1437,8 @@ DebugTileset_CalculatePalette: ld [hl], d ret -; unused +.dummy1: ; unreferenced ret -; unused +.dummy2: ; unreferenced ret diff --git a/engine/debug/debug_room.asm b/engine/debug/debug_room.asm index 95692c8d3..895de62d5 100644 --- a/engine/debug/debug_room.asm +++ b/engine/debug/debug_room.asm @@ -1328,9 +1328,9 @@ DebugRoom_BoxStructStrings: .Move4: db "MOVE 4@" .ID0: db "ID[0]@" .ID1: db "ID[1]@" -.BaseExp0: db "BASE EXP[0]@" -.BaseExp1: db "BASE EXP[1]@" -.BaseExp2: db "BASE EXP[2]@" +.BaseExp0: db "BASE EXP[0]@" ; unreferenced +.BaseExp1: db "BASE EXP[1]@" ; unreferenced +.BaseExp2: db "BASE EXP[2]@" ; unreferenced .HPExp0: db "HP EXP[0]@" .HPExp1: db "HP EXP[1]@" .AttkExp0: db "ATTK EXP[0]@" diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm index f335a83c9..0164ede48 100644 --- a/engine/events/battle_tower/battle_tower.asm +++ b/engine/events/battle_tower/battle_tower.asm @@ -67,7 +67,7 @@ Function170114: call Function170c8b ret -Function170139: +Function170139: ; unreferenced ; Convert the 4-digit decimal number at s5_aa41 into binary ld a, BANK(s5_aa41) call OpenSRAM @@ -183,7 +183,7 @@ BattleTowerBattle: call _BattleTowerBattle ret -DummySpecial_17021d: +UnusedBattleTowerDummySpecial1: ret InitBattleTowerChallengeRAM: @@ -374,7 +374,7 @@ ReadBTTrainerParty: ld [bc], a ret -ValidateBTParty: +ValidateBTParty: ; unreferenced ; Check for and fix errors in party data ld hl, wBT_OTTempMon1Species ld d, BATTLETOWER_PARTY_LENGTH @@ -386,7 +386,7 @@ ValidateBTParty: ld a, [hl] and a x = $ff -rept ($ff - NUM_POKEMON) +rept $ff - NUM_POKEMON jr z, .invalid cp x x = x - 1 @@ -1008,11 +1008,11 @@ BattleTowerAction_SetExplanationRead: BattleTowerAction_SetByteToQuickSaveChallenge: ld c, BATTLETOWER_SAVED_AND_LEFT - jr asm_17079f + jr SetBattleTowerChallengeState BattleTowerAction_SetByteToCancelChallenge: ld c, BATTLETOWER_NO_CHALLENGE -asm_17079f: +SetBattleTowerChallengeState: ld a, BANK(sBattleTowerChallengeState) call OpenSRAM ld a, c @@ -1447,11 +1447,11 @@ Function1709bb: ; BattleTowerAction $10 Function170a9c: ld c, FALSE - jr asm_170aa2 + jr Set_s5_aa8d Function170aa0: ld c, TRUE -asm_170aa2: +Set_s5_aa8d: ld a, BANK(s5_aa8d) call OpenSRAM ld a, c @@ -1576,7 +1576,7 @@ LoadOpponentTrainerAndPokemonWithOTSprite: INCLUDE "data/trainers/sprites.asm" -DummySpecial_170bd2: +UnusedBattleTowerDummySpecial2: ret CheckForBattleTowerRules: diff --git a/engine/events/battle_tower/load_trainer.asm b/engine/events/battle_tower/load_trainer.asm index 8ed401afe..165efb8dd 100644 --- a/engine/events/battle_tower/load_trainer.asm +++ b/engine/events/battle_tower/load_trainer.asm @@ -95,7 +95,7 @@ Function_LoadRandomBattleTowerMon: ld c, BATTLETOWER_PARTY_LENGTH .loop push bc - ld a, BANK(sBTMonPrevTrainer1) + ld a, BANK(sBTMonOfTrainers) call OpenSRAM .FindARandomBattleTowerMon: diff --git a/engine/events/buena.asm b/engine/events/buena.asm index 452f5d62a..dca125ece 100644 --- a/engine/events/buena.asm +++ b/engine/events/buena.asm @@ -85,7 +85,7 @@ BuenaPrize: call Buena_PrizeMenu jr z, .done ld [wMenuSelectionQuantity], a - call Buena_getprize + call Buena_GetPrize ld a, [hl] ld [wNamedObjectIndexBuffer], a call GetItemName @@ -95,7 +95,7 @@ BuenaPrize: jr c, .loop ld a, [wMenuSelectionQuantity] - call Buena_getprize + call Buena_GetPrize inc hl ld a, [hld] ld c, a @@ -258,11 +258,11 @@ Buena_PrizeMenu: db SCROLLINGMENU_DISPLAY_ARROWS ; flags db 4, 13 ; rows, columns db SCROLLINGMENU_ITEMS_NORMAL ; item format - dba .indices - dba .prizeitem - dba .prizepoints + dba .Prizes + dba .PrintPrizeItem + dba .PrintPrizePoints -.indices: +.Prizes: db NUM_BUENA_PRIZES x = 1 rept NUM_BUENA_PRIZES @@ -271,9 +271,9 @@ x = x + 1 endr db -1 -.prizeitem: +.PrintPrizeItem: ld a, [wMenuSelection] - call Buena_getprize + call Buena_GetPrize ld a, [hl] push de ld [wNamedObjectIndexBuffer], a @@ -282,9 +282,9 @@ endr call PlaceString ret -.prizepoints: +.PrintPrizePoints: ld a, [wMenuSelection] - call Buena_getprize + call Buena_GetPrize inc hl ld a, [hl] ld c, "0" @@ -292,7 +292,7 @@ endr ld [de], a ret -Buena_getprize: +Buena_GetPrize: dec a ld hl, BuenaPrizeItems ld b, 0 diff --git a/engine/events/bug_contest/judging.asm b/engine/events/bug_contest/judging.asm index 361aef81a..abb9d60da 100644 --- a/engine/events/bug_contest/judging.asm +++ b/engine/events/bug_contest/judging.asm @@ -68,7 +68,8 @@ ContestJudging_ThirdPlaceScoreText: LoadContestantName: ; If a = 1, get your name. - dec a ; BUG_CONTEST_PLAYER + assert BUG_CONTEST_PLAYER == 1 + dec a jr z, .player ; Find the pointer for the trainer class of the Bug Catching Contestant whose ID is in a. ld c, a diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm index 028f2e350..6a2d16dfc 100644 --- a/engine/events/celebi.asm +++ b/engine/events/celebi.asm @@ -1,6 +1,6 @@ SPECIALCELEBIEVENT_CELEBI EQU $84 -UnusedForestTreeFrames: +UnusedForestTreeFrames: ; unreferenced INCBIN "gfx/tilesets/forest-tree/1.2bpp" INCBIN "gfx/tilesets/forest-tree/2.2bpp" INCBIN "gfx/tilesets/forest-tree/3.2bpp" @@ -99,9 +99,8 @@ CelebiEvent_CountDown: set 7, [hl] ret -CelebiEvent_SpawnLeaf: -; unused - ld hl, wcf65 +CelebiEvent_SpawnLeaf: ; unreferenced + ld hl, wFrameCounter2 ld a, [hl] inc [hl] and $7 diff --git a/engine/events/daycare.asm b/engine/events/daycare.asm index 1c08ca1b8..9393ebc93 100644 --- a/engine/events/daycare.asm +++ b/engine/events/daycare.asm @@ -1,9 +1,9 @@ ; PrintDayCareText.TextTable indexes const_def const DAYCARETEXT_MAN_INTRO - const DAYCARETEXT_MAN_ODD_EGG + const DAYCARETEXT_MAN_INTRO_EGG const DAYCARETEXT_LADY_INTRO - const DAYCARETEXT_LADY_ODD_EGG + const DAYCARETEXT_LADY_INTRO_EGG const DAYCARETEXT_WHICH_ONE const DAYCARETEXT_DEPOSIT const DAYCARETEXT_CANT_BREED_EGG @@ -166,7 +166,7 @@ DayCareAskDepositPokemon: scf ret -.DaycareDummyText: +.DaycareDummyText: ; unreferenced text_far _DaycareDummyText text_end @@ -274,9 +274,9 @@ PrintDayCareText: .TextTable: ; entries correspond to DAYCARETEXT_* constants dw .DayCareManIntroText ; 00 - dw .DayCareManOddEggText ; 01 + dw .DayCareManIntroEggText ; 01 dw .DayCareLadyIntroText ; 02 - dw .DayCareLadyOddEggText ; 03 + dw .DayCareLadyIntroEggText ; 03 dw .WhatShouldIRaiseText ; 04 dw .IllRaiseYourMonText ; 05 dw .CantAcceptEggText ; 06 @@ -298,16 +298,16 @@ PrintDayCareText: text_far _DayCareManIntroText text_end -.DayCareManOddEggText: - text_far _DayCareManOddEggText +.DayCareManIntroEggText: + text_far _DayCareManIntroEggText text_end .DayCareLadyIntroText: text_far _DayCareLadyIntroText text_end -.DayCareLadyOddEggText: - text_far _DayCareLadyOddEggText +.DayCareLadyIntroEggText: + text_far _DayCareLadyIntroEggText text_end .WhatShouldIRaiseText: diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm index f0008b7fd..814c9644c 100644 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -87,4 +87,5 @@ INCBIN "gfx/diploma/page1.tilemap" DiplomaPage2Tilemap: INCBIN "gfx/diploma/page2.tilemap" - ret ; unused +Diploma_DummyFunction: ; unreferenced + ret diff --git a/engine/events/engine_flags.asm b/engine/events/engine_flags.asm index aebbacdc1..13f9a9a81 100644 --- a/engine/events/engine_flags.asm +++ b/engine/events/engine_flags.asm @@ -57,7 +57,7 @@ EngineFlagAction:: jr z, .set ; b = 1 ; Return the given flag in c. -.check +; check ld a, [de] and c ld c, a diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm index 6bbb7cbec..130ec411d 100644 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -426,7 +426,7 @@ FlyFunction_FrameTimer: ret .SpawnLeaf: - ld hl, wcf65 + ld hl, wFrameCounter2 ld a, [hl] inc [hl] and $7 diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm index 38ccbf12c..166b42b67 100644 --- a/engine/events/heal_machine_anim.asm +++ b/engine/events/heal_machine_anim.asm @@ -56,7 +56,7 @@ HealMachineAnim: .Pointers: ; entries correspond to HEALMACHINE_* constants dw .Pokecenter - dw .ElmLab + dw .ElmsLab dw .HallOfFame healmachineanimseq: MACRO @@ -68,7 +68,7 @@ ENDM .Pokecenter: healmachineanimseq LOADGFX, PCLOADBALLS, PLAYMUSIC, FINISH -.ElmLab: +.ElmsLab: healmachineanimseq LOADGFX, PCLOADBALLS, PLAYMUSIC, FINISH .HallOfFame: healmachineanimseq LOADGFX, HOFLOADBALLS, HOFPLAYSFX, FINISH diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm index 14ccb02ba..43b1d716d 100644 --- a/engine/events/magnet_train.asm +++ b/engine/events/magnet_train.asm @@ -69,7 +69,7 @@ MagnetTrain: ld [wRequested2bppSource + 1], a ld [wRequested2bppDest], a ld [wRequested2bppDest + 1], a - ld [wRequested2bpp], a + ld [wRequested2bppSize], a call ClearTilemap pop af diff --git a/engine/events/mom_phone.asm b/engine/events/mom_phone.asm index f18685df8..3ff5f2b3e 100644 --- a/engine/events/mom_phone.asm +++ b/engine/events/mom_phone.asm @@ -228,9 +228,12 @@ MomItsInYourRoomText: text_far _MomItsInYourRoomText text_end - db 0 ; unused + +DummyPredef3A_DummyData: ; unreferenced + db 0 DummyPredef3A: ret - ret ; unused +DummyPredef3A_DummyFunction: ; unreferenced + ret diff --git a/engine/events/npc_trade.asm b/engine/events/npc_trade.asm index 94aaace72..6b32aff56 100644 --- a/engine/events/npc_trade.asm +++ b/engine/events/npc_trade.asm @@ -56,11 +56,12 @@ NPCTrade:: call DisableSpriteUpdates ld a, [wJumptableIndex] push af - ld a, [wcf64] + ; wTradeDialog aliases wFrameCounter, which TradeAnimation uses + ld a, [wTradeDialog] push af predef TradeAnimation pop af - ld [wcf64], a + ld [wTradeDialog], a pop af ld [wJumptableIndex], a call ReturnToMapWithSpeechTextbox @@ -107,7 +108,7 @@ Trade_GetDialog: ld e, NPCTRADE_DIALOG call GetTradeAttribute ld a, [hl] - ld [wcf64], a + ld [wTradeDialog], a ret DoNPCTrade: @@ -392,7 +393,7 @@ PrintTradeText: ld bc, 2 * 4 ld hl, TradeTexts call AddNTimes - ld a, [wcf64] + ld a, [wTradeDialog] ld c, a add hl, bc add hl, bc diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm index 9c956e83b..0ca448930 100644 --- a/engine/events/overworld.asm +++ b/engine/events/overworld.asm @@ -271,7 +271,7 @@ CheckOverworldTileArrays: xor a ret -INCLUDE "data/events/field_move_blocks.asm" +INCLUDE "data/collision/field_move_blocks.asm" FlashFunction: call .CheckUseFlash @@ -1414,7 +1414,7 @@ HasRockSmash: ld d, ROCK_SMASH call CheckPartyMove jr nc, .yes -.no +; no ld a, 1 jr .done .yes @@ -1616,7 +1616,7 @@ RodNothingText: text_far _RodNothingText text_end -UnusedNothingHereText: ; unused +UnusedNothingHereText: ; unreferenced text_far _UnusedNothingHereText text_end @@ -1722,7 +1722,7 @@ Script_GetOnBike_Register: special UpdatePlayerSprite end -; unused +Overworld_DummyFunction: ; unreferenced nop ret diff --git a/engine/events/poisonstep.asm b/engine/events/poisonstep.asm index e6de6f19f..827f69411 100644 --- a/engine/events/poisonstep.asm +++ b/engine/events/poisonstep.asm @@ -149,6 +149,6 @@ DoPoisonStep:: text_far _PoisonFaintText text_end -.PoisonWhiteoutText: +.PoisonWhiteoutText: ; unreferenced text_far _PoisonWhiteoutText text_end diff --git a/engine/events/print_unown_2.asm b/engine/events/print_unown_2.asm index 0badae200..4926bf532 100644 --- a/engine/events/print_unown_2.asm +++ b/engine/events/print_unown_2.asm @@ -9,7 +9,7 @@ RotateUnownFrontpic: push bc push hl push bc - ld de, wd002 + ld de, wPrintedUnownTileSource call .Copy call .Rotate ld hl, UnownPrinter_GBPrinterRectangle @@ -19,10 +19,10 @@ RotateUnownFrontpic: ld a, [hli] ld e, a ld d, [hl] - ld hl, wd012 + ld hl, wPrintedUnownTileDest call .Copy pop hl - ld bc, $10 + ld bc, LEN_2BPP_TILE add hl, bc pop bc inc c @@ -30,7 +30,7 @@ RotateUnownFrontpic: cp 7 * 7 jr c, .loop - ld hl, wGameboyPrinterRAM + ld hl, wGameboyPrinter2bppSource ld de, sScratch ld bc, 7 * 7 tiles call CopyBytes @@ -44,7 +44,7 @@ RotateUnownFrontpic: ret .Copy: - ld c, $10 + ld c, LEN_2BPP_TILE .loop_copy ld a, [hli] ld [de], a @@ -54,18 +54,18 @@ RotateUnownFrontpic: ret .Rotate: - ld hl, wd012 + ld hl, wPrintedUnownTileDest ld e, %10000000 ld d, 8 .loop_decompress push hl - ld hl, wd002 + ld hl, wPrintedUnownTileSource call .CountSetBit pop hl ld a, b ld [hli], a push hl - ld hl, wd003 + ld hl, wPrintedUnownTileSource + 1 call .CountSetBit pop hl ld a, b @@ -100,7 +100,7 @@ y = 0 rept \1 x = \1 * (\2 - 1) + y rept \2 - dw wGameboyPrinterRAM tile x + dw wGameboyPrinter2bppSource tile x x = x - \2 endr y = y + 1 diff --git a/engine/events/prof_oaks_pc.asm b/engine/events/prof_oaks_pc.asm index 1be775a4c..b272e3fb5 100644 --- a/engine/events/prof_oaks_pc.asm +++ b/engine/events/prof_oaks_pc.asm @@ -36,18 +36,18 @@ Rate: ld hl, wPokedexSeen ld b, wEndPokedexSeen - wPokedexSeen call CountSetBits - ld [wd002], a + ld [wTempPokedexSeenCount], a ld hl, wPokedexCaught ld b, wEndPokedexCaught - wPokedexCaught call CountSetBits - ld [wd003], a + ld [wTempPokedexCaughtCount], a ; print appropriate rating call .UpdateRatingBuffers ld hl, OakPCText3 call PrintText call JoyWaitAorB - ld a, [wd003] + ld a, [wTempPokedexCaughtCount] ld hl, OakRatings call FindOakRating push de @@ -57,10 +57,10 @@ Rate: .UpdateRatingBuffers: ld hl, wStringBuffer3 - ld de, wd002 + ld de, wTempPokedexSeenCount call .UpdateRatingBuffer ld hl, wStringBuffer4 - ld de, wd003 + ld de, wTempPokedexCaughtCount call .UpdateRatingBuffer ret diff --git a/engine/events/specials.asm b/engine/events/specials.asm index 28cf2dd13..1333f27ce 100644 --- a/engine/events/specials.asm +++ b/engine/events/specials.asm @@ -15,7 +15,7 @@ Special:: INCLUDE "data/events/special_pointers.asm" -DummySpecial_c224: +UnusedDummySpecial: ret SetPlayerPalette: @@ -207,7 +207,7 @@ CardFlip: call StartGameCornerGame ret -DummyNonfunctionalGameCornerGame: +UnusedDummyGame: call CheckCoinsAndCoinCase ret c ld a, BANK(_DummyGame) @@ -380,17 +380,17 @@ GameboyCheck: ldh a, [hCGB] and a jr nz, .cgb - ldh a, [hSGB] and a jr nz, .sgb - -.gb +; gb xor a ; GBCHECK_GB jr .done + .sgb ld a, GBCHECK_SGB jr .done + .cgb ld a, GBCHECK_CGB .done diff --git a/engine/events/std_collision.asm b/engine/events/std_collision.asm index 8c54c0414..5ab112680 100644 --- a/engine/events/std_collision.asm +++ b/engine/events/std_collision.asm @@ -23,7 +23,7 @@ CheckFacingTileForStdScript:: xor a ret -INCLUDE "data/events/collision_stdscripts.asm" +INCLUDE "data/collision/collision_stdscripts.asm" Script_JumpStdFromRAM: sjump wJumpStdScriptBuffer diff --git a/engine/events/treemons.asm b/engine/events/treemons.asm index 680a9d7f5..9adcdbdc2 100644 --- a/engine/events/treemons.asm +++ b/engine/events/treemons.asm @@ -210,7 +210,7 @@ GetTreeScore: cp 5 jr c, .good -.bad +; bad xor a ; TREEMON_SCORE_BAD ret diff --git a/engine/games/card_flip.asm b/engine/games/card_flip.asm index 1244ca081..bee7aee11 100644 --- a/engine/games/card_flip.asm +++ b/engine/games/card_flip.asm @@ -1,7 +1,8 @@ CARDFLIP_LIGHT_OFF EQU "♂" ; $ef CARDFLIP_LIGHT_ON EQU "♀" ; $f5 -CARDFLIP_DECK_SIZE EQU 4 * 6 +CARDFLIP_DECK_SIZE EQUS "(wDeckEnd - wDeck)" + assert wDiscardPileEnd - wDiscardPile == wDeckEnd - wDeck DummyGameGFX: ; Graphics for an unused Game Corner diff --git a/engine/games/dummy_game.asm b/engine/games/dummy_game.asm index e4bb2d060..648346fc3 100644 --- a/engine/games/dummy_game.asm +++ b/engine/games/dummy_game.asm @@ -20,7 +20,7 @@ _DummyGame: ld a, BANK(DummyGameGFX) call FarCopyBytes ld a, $8 - ld hl, wc300 + ld hl, wSpriteAnimDict ld [hli], a ld [hl], $0 hlcoord 0, 0 @@ -133,11 +133,11 @@ endr .next_try dec [hl] xor a - ld [wcf64], a + ld [wDummyGameCardChoice], a ld hl, wJumptableIndex inc [hl] .PickCard1: - ld a, [wcf64] + ld a, [wDummyGameCardChoice] and a ret z dec a @@ -155,13 +155,13 @@ endr call DummyGame_Card2Coord call DummyGame_PlaceCard xor a - ld [wcf64], a + ld [wDummyGameCardChoice], a ld hl, wJumptableIndex inc [hl] ret .PickCard2: - ld a, [wcf64] + ld a, [wDummyGameCardChoice] and a ret z dec a @@ -527,7 +527,7 @@ DummyGame_InterpretJoypad_AnimateCursor: add hl, bc ld a, [hl] inc a - ld [wcf64], a + ld [wDummyGameCardChoice], a ret .pressed_left diff --git a/engine/games/slot_machine.asm b/engine/games/slot_machine.asm index 84f50e69d..0b2a08fac 100644 --- a/engine/games/slot_machine.asm +++ b/engine/games/slot_machine.asm @@ -249,7 +249,7 @@ DebugPrintSlotBias: ; unreferenced AnimateSlotReelIcons: ; unreferenced ; This animation was present in pokegold-spaceworld. - ld hl, wcf66 + ld hl, wUnusedSlotReelIconDelay ld a, [hl] inc [hl] and $7 diff --git a/engine/games/unown_puzzle.asm b/engine/games/unown_puzzle.asm index 871cb4541..48e36b899 100644 --- a/engine/games/unown_puzzle.asm +++ b/engine/games/unown_puzzle.asm @@ -504,13 +504,13 @@ CheckSolvedUnownPuzzle: RedrawUnownPuzzlePieces: call GetCurrentPuzzlePieceVTileCorner - ld [wd002], a + ld [wUnownPuzzleCornerTile], a xor a call GetUnownPuzzleCoordData ; get pixel positions ld a, [hli] ld b, [hl] ld c, a - ld a, [wd002] + ld a, [wUnownPuzzleCornerTile] cp $e0 jr z, .NoPiece ld hl, .OAM_HoldingPiece @@ -532,7 +532,7 @@ RedrawUnownPuzzlePieces: add c ld [de], a ; x inc de - ld a, [wd002] + ld a, [wUnownPuzzleCornerTile] add [hl] ld [de], a ; tile id inc hl diff --git a/engine/gfx/cgb_layouts.asm b/engine/gfx/cgb_layouts.asm index cd6f16cdb..66aeca079 100644 --- a/engine/gfx/cgb_layouts.asm +++ b/engine/gfx/cgb_layouts.asm @@ -17,19 +17,18 @@ LoadSGBLayoutCGB: ld l, a ld h, 0 add hl, hl - ld de, .dw + ld de, .Jumptable add hl, de ld a, [hli] ld h, [hl] ld l, a - ld de, .ReturnFromJumpTable + ld de, .done push de jp hl - -.ReturnFromJumpTable: +.done: ret -.dw +.Jumptable: dw _CGB_BattleGrayscale dw _CGB_BattleColors dw _CGB_PokegearPals @@ -43,7 +42,7 @@ LoadSGBLayoutCGB: dw _CGB_PartyMenu dw _CGB_Evolution dw _CGB_GSTitleScreen - dw _CGB0d + dw _CGB_Unused0D dw _CGB_MoveList dw _CGB_BetaPikachuMinigame dw _CGB_PokedexSearchOption @@ -60,7 +59,7 @@ LoadSGBLayoutCGB: dw _CGB_TradeTube dw _CGB_TrainerOrMonFrontpicPals dw _CGB_MysteryGift - dw _CGB1e + dw _CGB_Unused1E _CGB_BattleGrayscale: ld hl, PalPacket_BattleGrayscale + 1 @@ -321,12 +320,12 @@ _CGB_BillsPC: ldh [hCGBPalUpdate], a ret -Function9009: ; unreferenced +_CGB_Unknown: ; unreferenced ld hl, BillsPCOrangePalette call LoadHLPaletteIntoDE jr .GotPalette -.GetMonPalette: +.GetMonPalette: ; unreferenced ld bc, wTempMonDVs call GetPlayerOrMonPalettePointer call LoadPalette_White_Col1_Col2_Black @@ -595,7 +594,7 @@ _CGB_GSTitleScreen: ldh [hCGBPalUpdate], a ret -_CGB0d: +_CGB_Unused0D: ld hl, PalPacket_Diploma + 1 call CopyFourPalettes call WipeAttrmap @@ -911,7 +910,7 @@ _CGB_PlayerOrMonFrontpicPals: call ApplyPals ret -_CGB1e: +_CGB_Unused1E: ld de, wBGPals1 ld a, [wCurPartySpecies] call GetMonPalettePointer diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm index 76c2dc504..9f42d24f6 100644 --- a/engine/gfx/color.asm +++ b/engine/gfx/color.asm @@ -15,31 +15,31 @@ CheckShininess: ; Attack ld a, [hl] and 1 << SHINY_ATK_BIT - jr z, .NotShiny + jr z, .not_shiny ; Defense ld a, [hli] and $f cp SHINY_DEF_VAL - jr nz, .NotShiny + jr nz, .not_shiny ; Speed ld a, [hl] and $f0 cp SHINY_SPD_VAL << 4 - jr nz, .NotShiny + jr nz, .not_shiny ; Special ld a, [hl] and $f cp SHINY_SPC_VAL - jr nz, .NotShiny + jr nz, .not_shiny -.Shiny: +; shiny scf ret -.NotShiny: +.not_shiny and a ret @@ -49,30 +49,30 @@ Unused_CheckShininess: ; Attack ld a, [hl] cp 10 << 4 - jr c, .NotShiny + jr c, .not_shiny ; Defense ld a, [hli] and $f cp 10 - jr c, .NotShiny + jr c, .not_shiny ; Speed ld a, [hl] cp 10 << 4 - jr c, .NotShiny + jr c, .not_shiny ; Special ld a, [hl] and $f cp 10 - jr c, .NotShiny + jr c, .not_shiny -.Shiny: +; shiny scf ret -.NotShiny: +.not_shiny and a ret @@ -136,6 +136,7 @@ SGB_ApplyPartyMenuHPPals: Intro_LoadMagikarpPalettes: ; unreferenced call CheckCGB ret z + ; CGB only ld hl, .BGPal ld de, wBGPals1 @@ -789,13 +790,13 @@ endr ret PushSGBPals: - ld a, [wcfbe] + ld a, [wJoypadDisable] push af - set 7, a - ld [wcfbe], a + set JOYPAD_DISABLE_SGB_TRANSFER_F, a + ld [wJoypadDisable], a call _PushSGBPals pop af - ld [wcfbe], a + ld [wJoypadDisable], a ret _PushSGBPals: @@ -841,12 +842,14 @@ _PushSGBPals: InitSGBBorder: call CheckCGB ret nz + ; SGB/DMG only di - ld a, [wcfbe] + ld a, [wJoypadDisable] push af - set 7, a - ld [wcfbe], a + set JOYPAD_DISABLE_SGB_TRANSFER_F, a + ld [wJoypadDisable], a + xor a ldh [rJOYP], a ldh [hSGB], a @@ -866,13 +869,14 @@ InitSGBBorder: .skip pop af - ld [wcfbe], a + ld [wJoypadDisable], a ei ret InitCGBPals:: call CheckCGB ret z + ; CGB only ld a, BANK(vTiles3) ldh [rVBK], a @@ -977,7 +981,7 @@ PushSGBBorder: .LoadSGBBorderPointers: ld hl, SGBBorderGFX - ld de, SGBBorderMap + ld de, SGBBorderMapAndPalettes ret SGB_ClearVRAM: @@ -1174,12 +1178,10 @@ INCLUDE "data/sgb_ctrl_packets.asm" PredefPals: INCLUDE "gfx/sgb/predef.pal" -SGBBorderMap: +SGBBorderMapAndPalettes: ; interleaved tile ids and palette ids, without the center 20x18 screen area INCBIN "gfx/sgb/sgb_border.sgb.tilemap" - -SGBBorderPalettes: -; assumed to come after SGBBorderMap +; four SGB palettes of 16 colors each; only the first 4 colors are used INCLUDE "gfx/sgb/sgb_border.pal" SGBBorderGFX: @@ -1317,7 +1319,7 @@ INCLUDE "gfx/diploma/diploma.pal" PartyMenuOBPals: INCLUDE "gfx/stats/party_menu_ob.pal" -UnusedBattleObjectPals: +UnusedBattleObjectPals: ; unreferenced INCLUDE "gfx/battle_anims/unused_battle_anims.pal" UnusedGSTitleBGPals: diff --git a/engine/gfx/crystal_layouts.asm b/engine/gfx/crystal_layouts.asm index 9c47797d1..1d3cca3ed 100644 --- a/engine/gfx/crystal_layouts.asm +++ b/engine/gfx/crystal_layouts.asm @@ -1,16 +1,16 @@ -GetMysteryGift_MobileAdapterLayout: +GetCrystalCGBLayout: ld a, b cp SCGB_DEFAULT - jr nz, .not_ram + jr nz, .not_default ld a, [wDefaultSGBLayout] -.not_ram +.not_default push af farcall ResetBGPals pop af ld l, a ld h, 0 add hl, hl - ld de, .dw + ld de, .Jumptable add hl, de ld a, [hli] ld h, [hl] @@ -18,15 +18,16 @@ GetMysteryGift_MobileAdapterLayout: ld de, .done push de jp hl -.done +.done: ret -.dw - dw MG_Mobile_Layout00 - dw MG_Mobile_Layout01 - dw MG_Mobile_Layout02 +.Jumptable: + dw _CrystalCGB_MobileLayout0 + dw _CrystalCGB_MobileLayout1 + dw _CrystalCGB_NameCard -MG_Mobile_Layout_FillBox: +Crystal_FillBoxCGB: +; This is a copy of FillBoxCGB. .row push bc push hl @@ -42,7 +43,8 @@ MG_Mobile_Layout_FillBox: jr nz, .row ret -MG_Mobile_Layout_WipeAttrmap: +Crystal_WipeAttrmap: +; This is a copy of WipeAttrmap. hlcoord 0, 0, wAttrmap ld bc, SCREEN_HEIGHT * SCREEN_WIDTH xor a @@ -62,9 +64,9 @@ MG_Mobile_Layout_LoadPals: call FarCopyWRAM ret -MG_Mobile_Layout00: +_CrystalCGB_MobileLayout0: call MG_Mobile_Layout_LoadPals - call MG_Mobile_Layout_WipeAttrmap + call Crystal_WipeAttrmap call MG_Mobile_Layout_CreatePalBoxes farcall ApplyAttrmap farcall ApplyPals @@ -74,33 +76,33 @@ MG_Mobile_Layout_CreatePalBoxes: hlcoord 0, 0, wAttrmap lb bc, 4, 1 ld a, $1 - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB lb bc, 2, 1 ld a, $2 - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB lb bc, 6, 1 ld a, $3 - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB hlcoord 1, 0, wAttrmap ld a, $1 lb bc, 3, 18 - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB lb bc, 2, 18 ld a, $2 - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB lb bc, 12, 18 ld a, $3 - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB hlcoord 19, 0, wAttrmap lb bc, 4, 1 ld a, $1 - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB lb bc, 2, 1 ld a, $2 - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB lb bc, 6, 1 ld a, $3 - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB hlcoord 0, 12, wAttrmap ld bc, 6 * SCREEN_WIDTH ld a, $7 @@ -129,14 +131,14 @@ Function49420:: call FarCopyWRAM ret -MG_Mobile_Layout01: +_CrystalCGB_MobileLayout1: call MG_Mobile_Layout_LoadPals ld de, wBGPals1 palette PAL_BG_TEXT - ld hl, .Palette_49478 + ld hl, .TextPalette ld bc, 1 palettes ld a, BANK(wBGPals1) call FarCopyWRAM - call MG_Mobile_Layout_WipeAttrmap + call Crystal_WipeAttrmap hlcoord 0, 0, wAttrmap ld bc, SCREEN_WIDTH * SCREEN_HEIGHT xor a @@ -149,19 +151,18 @@ MG_Mobile_Layout01: bit 6, a jr z, .asm_49464 call Function49480 - jr .asm_49467 + jr .done .asm_49464 call Function49496 - -.asm_49467 +.done farcall ApplyAttrmap farcall ApplyPals ld a, TRUE ldh [hCGBPalUpdate], a ret -.Palette_49478: +.TextPalette: RGB 31, 31, 31 RGB 26, 31, 00 RGB 20, 16, 03 @@ -171,7 +172,7 @@ Function49480: hlcoord 0, 0, wAttrmap lb bc, 4, SCREEN_WIDTH ld a, $7 - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB hlcoord 0, 2, wAttrmap ld a, $4 ld [hl], a @@ -183,7 +184,7 @@ Function49496: hlcoord 0, 0, wAttrmap lb bc, 2, SCREEN_WIDTH ld a, $7 - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB hlcoord 0, 1, wAttrmap ld a, $4 ld [hl], a @@ -193,29 +194,29 @@ Function49496: INCLUDE "engine/tilesets/tileset_palettes.asm" -MG_Mobile_Layout02: - ld hl, .Palette_49732 +_CrystalCGB_NameCard: + ld hl, .BGPalette ld de, wBGPals1 ld bc, 1 palettes ld a, BANK(wBGPals1) call FarCopyWRAM farcall ApplyPals - call MG_Mobile_Layout_WipeAttrmap + call Crystal_WipeAttrmap farcall ApplyAttrmap - ld hl, .Palette_4973a + ld hl, .OBPalette ld de, wOBPals1 ld bc, 1 palettes ld a, BANK(wOBPals1) call FarCopyWRAM ret -.Palette_49732: +.BGPalette: RGB 31, 31, 31 RGB 23, 16, 07 RGB 23, 07, 07 RGB 03, 07, 20 -.Palette_4973a: +.OBPalette: RGB 00, 00, 00 RGB 07, 05, 31 RGB 14, 18, 31 @@ -237,38 +238,38 @@ _InitMG_Mobile_LinkTradePalMap: hlcoord 0, 0, wAttrmap lb bc, 16, 2 ld a, $4 - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB ld a, $3 ldcoord_a 0, 1, wAttrmap ldcoord_a 0, 14, wAttrmap hlcoord 2, 0, wAttrmap lb bc, 8, 18 ld a, $5 - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB hlcoord 2, 8, wAttrmap lb bc, 8, 18 ld a, $6 - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB hlcoord 0, 16, wAttrmap lb bc, 2, SCREEN_WIDTH ld a, $4 - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB ld a, $3 lb bc, 6, 1 hlcoord 6, 1, wAttrmap - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB ld a, $3 lb bc, 6, 1 hlcoord 17, 1, wAttrmap - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB ld a, $3 lb bc, 6, 1 hlcoord 6, 9, wAttrmap - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB ld a, $3 lb bc, 6, 1 hlcoord 17, 9, wAttrmap - call MG_Mobile_Layout_FillBox + call Crystal_FillBoxCGB ld a, $2 hlcoord 2, 16, wAttrmap ld [hli], a diff --git a/engine/gfx/load_pics.asm b/engine/gfx/load_pics.asm index a8dc82892..98dbdc17b 100644 --- a/engine/gfx/load_pics.asm +++ b/engine/gfx/load_pics.asm @@ -208,7 +208,8 @@ GetMonBackpic: push de ; These are assumed to be at the same address in their respective banks. - ld hl, PokemonPicPointers ; UnownPicPointers + assert PokemonPicPointers == UnownPicPointers + ld hl, PokemonPicPointers ld a, b ld d, BANK(PokemonPicPointers) cp UNOWN diff --git a/engine/gfx/pic_animation.asm b/engine/gfx/pic_animation.asm index f2a59b75a..90bb06620 100644 --- a/engine/gfx/pic_animation.asm +++ b/engine/gfx/pic_animation.asm @@ -648,7 +648,7 @@ PokeAnim_ConvertAndApplyBitmask: .skip2 ret -; unused +.UnusedSizeData: ; unreferenced db 6, 5, 4 .GetTilemap: diff --git a/engine/gfx/player_gfx.asm b/engine/gfx/player_gfx.asm index 9a395e048..149c0ef4a 100644 --- a/engine/gfx/player_gfx.asm +++ b/engine/gfx/player_gfx.asm @@ -113,10 +113,10 @@ GetCardPic: ld bc, $23 tiles ld a, BANK(ChrisCardPic) ; aka BANK(KrisCardPic) call FarCopyBytes - ld hl, CardGFX + ld hl, TrainerCardGFX ld de, vTiles2 tile $23 ld bc, 6 tiles - ld a, BANK(CardGFX) + ld a, BANK(TrainerCardGFX) call FarCopyBytes ret @@ -126,7 +126,7 @@ INCBIN "gfx/trainer_card/chris_card.2bpp" KrisCardPic: INCBIN "gfx/trainer_card/kris_card.2bpp" -CardGFX: +TrainerCardGFX: INCBIN "gfx/trainer_card/trainer_card.2bpp" GetPlayerBackpic: diff --git a/engine/gfx/sgb_layouts.asm b/engine/gfx/sgb_layouts.asm index bfdaeb098..1e5055f26 100644 --- a/engine/gfx/sgb_layouts.asm +++ b/engine/gfx/sgb_layouts.asm @@ -35,7 +35,7 @@ LoadSGBLayout: dw .SGB_PartyMenu dw .SGB_Evolution dw .SGB_GSTitleScreen - dw .SGB0d + dw .SGB_Unused0D dw .SGB_MoveList dw .SGB_BetaPikachuMinigame dw .SGB_PokedexSearchOption @@ -52,7 +52,7 @@ LoadSGBLayout: dw .SGB_TradeTube dw .SGB_TrainerOrMonFrontpicPals dw .SGB_MysteryGift - dw .SGB1e + dw .SGB_Unused1E .SGB_BattleGrayscale: ld hl, PalPacket_BattleGrayscale @@ -397,7 +397,7 @@ endr ld de, BlkPacket_AllPal0 ret -.SGB0d: +.SGB_Unused0D: .SGB_TrainerCard: ld hl, PalPacket_Diploma ld de, BlkPacket_AllPal0 @@ -437,7 +437,7 @@ endr ld de, wSGBPals + PALPACKET_LENGTH ret -.SGB1e: +.SGB_Unused1E: ld hl, PalPacket_Pal01 ld de, wSGBPals ld bc, PALPACKET_LENGTH @@ -450,7 +450,7 @@ endr add hl, hl ld de, PokemonPalettes add hl, de - ld a, [wcf65] + ld a, [wUnusedSGB1eColorOffset] and 3 sla a sla a diff --git a/engine/gfx/sprite_anims.asm b/engine/gfx/sprite_anims.asm index 53fe6b882..0c2c42bcb 100644 --- a/engine/gfx/sprite_anims.asm +++ b/engine/gfx/sprite_anims.asm @@ -357,7 +357,7 @@ AnimSeq_SlotsGolem: AnimSeq_SlotsChansey: callfar Slots_AnimateChansey - ld hl, wcf64 + ld hl, wSlotsDelay ld a, [hl] cp $2 ret nz @@ -382,7 +382,7 @@ AnimSeq_SlotsChanseyEgg: jr c, .move_right call DeinitializeSprite ld a, $4 - ld [wcf64], a + ld [wSlotsDelay], a ld de, SFX_PLACE_PUZZLE_PIECE_DOWN call PlaySFX ret @@ -819,7 +819,7 @@ AnimSeq_IntroUnown: ret AnimSeq_IntroUnownF: - ld a, [wcf64] + ld a, [wSlotsDelay] cp $40 ret nz ld a, SPRITE_ANIM_FRAMESET_INTRO_UNOWN_F_2 diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index bc185500e..f91332761 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1062,14 +1062,13 @@ LevelBallMultiplier: ld b, $ff ret -; These two texts were carried over from gen 1. -; They are not used in gen 2, and are dummied out. +; BallDodgedText and BallMissedText were used in Gen 1. -BallDodgedText: +BallDodgedText: ; unreferenced text_far _BallDodgedText text_end -BallMissedText: +BallMissedText: ; unreferenced text_far _BallMissedText text_end @@ -1896,14 +1895,14 @@ LoadCurHPIntoBuffer5: ld [wBuffer5], a ret -LoadHPIntoBuffer5: +LoadHPIntoBuffer5: ; unreferenced ld a, d ld [wBuffer6], a ld a, e ld [wBuffer5], a ret -LoadHPFromBuffer5: +LoadHPFromBuffer5: ; unreferenced ld a, [wBuffer6] ld d, a ld a, [wBuffer5] @@ -2167,11 +2166,12 @@ INCLUDE "data/items/x_stats.asm" PokeFluteEffect: ld a, [wBattleMode] and a - jr nz, .dummy -.dummy + jr nz, .in_battle + ; overworld flute code was dummied out here +.in_battle xor a - ld [wd002], a + ld [wPokeFluteCuredSleep], a ld b, $ff ^ SLP @@ -2194,7 +2194,7 @@ PokeFluteEffect: and b ld [hl], a - ld a, [wd002] + ld a, [wPokeFluteCuredSleep] and a ld hl, .PlayedFluteText jp z, PrintText @@ -2203,22 +2203,22 @@ PokeFluteEffect: ld a, [wLowHealthAlarm] and 1 << DANGER_ON_F - jr nz, .dummy2 -.dummy2 + jr nz, .dummy + ; more code was dummied out here +.dummy ld hl, .FluteWakeUpText jp PrintText .CureSleep: ld de, PARTYMON_STRUCT_LENGTH ld c, PARTY_LENGTH - .loop ld a, [hl] push af and SLP jr z, .not_asleep - ld a, 1 - ld [wd002], a + ld a, TRUE + ld [wPokeFluteCuredSleep], a .not_asleep pop af and b @@ -2291,7 +2291,7 @@ ItemfinderEffect: RestorePPEffect: ld a, [wCurItem] - ld [wd002], a + ld [wTempRestorePPItem], a .loop ; Party Screen opens to choose on which mon to use the Item @@ -2300,14 +2300,14 @@ RestorePPEffect: jp c, PPRestoreItem_Cancel .loop2 - ld a, [wd002] + ld a, [wTempRestorePPItem] cp MAX_ELIXER jp z, Elixer_RestorePPofAllMoves cp ELIXER jp z, Elixer_RestorePPofAllMoves ld hl, RaiseThePPOfWhichMoveText - ld a, [wd002] + ld a, [wTempRestorePPItem] cp PP_UP jr z, .ppup ld hl, RestoreThePPOfWhichMoveText @@ -2338,7 +2338,7 @@ RestorePPEffect: call CopyName1 pop hl - ld a, [wd002] + ld a, [wTempRestorePPItem] cp PP_UP jp nz, Not_PP_Up @@ -2353,7 +2353,6 @@ RestorePPEffect: jr c, .do_ppup .CantUsePPUpOnSketch: -.pp_is_maxed_out ld hl, PPIsMaxedOutText call PrintText jr .loop2 @@ -2488,7 +2487,7 @@ RestorePP: cp b jr nc, .dont_restore - ld a, [wd002] + ld a, [wTempRestorePPItem] cp MAX_ELIXER jr z, .restore_all cp MAX_ETHER @@ -2650,16 +2649,17 @@ WontHaveAnyEffectMessage: ld hl, ItemWontHaveEffectText jr CantUseItemMessage -BelongsToSomeoneElseMessage: +BelongsToSomeoneElseMessage: ; unreferenced ld hl, ItemBelongsToSomeoneElseText jr CantUseItemMessage -CyclingIsntAllowedMessage: +CyclingIsntAllowedMessage: ; unreferenced ld hl, NoCyclingText jr CantUseItemMessage -CantGetOnYourBikeMessage: +CantGetOnYourBikeMessage: ; unreferenced ld hl, ItemCantGetOnText + ; fallthrough CantUseItemMessage: ; Item couldn't be used. @@ -2711,11 +2711,11 @@ ItemUsedText: text_far _ItemUsedText text_end -ItemGotOnText: +ItemGotOnText: ; unreferenced text_far _ItemGotOnText text_end -ItemGotOffText: +ItemGotOffText: ; unreferenced text_far _ItemGotOffText text_end diff --git a/engine/items/items.asm b/engine/items/items.asm index 78b0e2cd9..42381b411 100644 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -481,7 +481,7 @@ GetNumberedTMHM: jr c, .done cp ITEM_DC - (TM01 - 1) - 1 jr c, .skip_one -.skip_two +; skip two inc a .skip_one inc a diff --git a/engine/items/pack.asm b/engine/items/pack.asm index 4f8e7617f..17662cf60 100644 --- a/engine/items/pack.asm +++ b/engine/items/pack.asm @@ -1531,7 +1531,7 @@ PC_Mart_BallsPocketMenuHeader: dba PlaceMenuItemQuantity dba UpdateItemDescription -PackNoItemText: +PackNoItemText: ; unreferenced text_far _PackNoItemText text_end @@ -1571,7 +1571,7 @@ PackEmptyText: text_far _PackEmptyText text_end -YouCantUseItInABattleText: +YouCantUseItInABattleText: ; unreferenced text_far _YouCantUseItInABattleText text_end diff --git a/engine/items/tmhm.asm b/engine/items/tmhm.asm index fd8293603..ea990d849 100644 --- a/engine/items/tmhm.asm +++ b/engine/items/tmhm.asm @@ -159,7 +159,7 @@ TeachTMHM: and a ret -.unused +.didnt_use ; unreferenced ld a, 2 ld [wItemEffectSucceeded], a .learned_move diff --git a/engine/link/init_list.asm b/engine/link/init_list.asm index 470280c4b..3e16d3494 100644 --- a/engine/link/init_list.asm +++ b/engine/link/init_list.asm @@ -44,9 +44,9 @@ InitList: ld a, h ld [wListPointer + 1], a ld a, e - ld [wUnusedD102], a + ld [wUnusedNamesPointer], a ld a, d - ld [wUnusedD102 + 1], a + ld [wUnusedNamesPointer + 1], a ld bc, ItemAttributes ld a, c ld [wItemAttributesPtr], a diff --git a/engine/link/link.asm b/engine/link/link.asm index 3d6d5cf24..3fa34df03 100644 --- a/engine/link/link.asm +++ b/engine/link/link.asm @@ -27,10 +27,11 @@ LinkCommunications: call PlaceString call SetTradeRoomBGPals call WaitBGMap2 - ld hl, wcf5d - xor a ; LOW($5000) + ld hl, wLinkByteTimeout + assert LOW(SERIAL_LINK_BYTE_TIMEOUT) == 0 + xor a ; LOW(SERIAL_LINK_BYTE_TIMEOUT) ld [hli], a - ld [hl], HIGH($5000) + ld [hl], HIGH(SERIAL_LINK_BYTE_TIMEOUT) ld a, [wLinkMode] cp LINK_TIMECAPSULE jp nz, Gen2ToGen2LinkComms @@ -101,14 +102,14 @@ Gen2ToGen1LinkComms: ld a, [hl] pop hl and a - jp z, Function28b22 + jp z, ExitLinkCommunications cp $7 - jp nc, Function28b22 + jp nc, ExitLinkCommunications ld de, wLinkData ld bc, $1a2 call Link_CopyOTData - ld de, wPlayerTrademonSpecies - ld hl, wTimeCapsulePartyMon1Species + ld de, wPlayerTrademon + ld hl, wTimeCapsulePlayerData ld c, 2 .loop ld a, [de] @@ -162,12 +163,12 @@ Gen2ToGen1LinkComms: .done_party ld [de], a - ld hl, wTimeCapsulePartyMon1Species - call Function2868a + ld hl, wTimeCapsulePlayerData + call Link_ConvertPartyStruct1to2 ld a, LOW(wOTPartyMonOT) - ld [wUnusedD102], a + ld [wUnusedNamesPointer], a ld a, HIGH(wOTPartyMonOT) - ld [wUnusedD102 + 1], a + ld [wUnusedNamesPointer + 1], a ld de, MUSIC_NONE call PlayMusic ldh a, [hSerialConnectionStatus] @@ -253,8 +254,8 @@ Gen2ToGen2LinkComms: ld de, wLinkData ld bc, $1b9 call Link_CopyOTData - ld de, wPlayerTrademonSpecies - ld hl, wLinkPlayerPartyMon1Species + ld de, wPlayerTrademon + ld hl, wLinkPlayerData ld c, 2 .loop1 ld a, [de] @@ -407,9 +408,9 @@ Gen2ToGen2LinkComms: ld bc, wOTPartyDataEnd - wOTPartyMons call CopyBytes ld a, LOW(wOTPartyMonOT) - ld [wUnusedD102], a + ld [wUnusedNamesPointer], a ld a, HIGH(wOTPartyMonOT) - ld [wUnusedD102 + 1], a + ld [wUnusedNamesPointer + 1], a ld de, MUSIC_NONE call PlayMusic ldh a, [hSerialConnectionStatus] @@ -467,7 +468,7 @@ Gen2ToGen2LinkComms: pop af ld [wOptions], a farcall LoadPokemonData - jp Function28b22 + jp ExitLinkCommunications .ready_to_trade ld de, MUSIC_ROUTE_30 @@ -510,6 +511,8 @@ LinkTimeout: text_end ExchangeBytes: +; This is similar to Serial_ExchangeBytes, +; but without a SERIAL_PREAMBLE_BYTE check. ld a, TRUE ldh [hSerialIgnoringInitialData], a .loop @@ -520,9 +523,9 @@ ExchangeBytes: ld b, a inc hl ld a, 48 -.delay_cycles +.wait dec a - jr nz, .delay_cycles + jr nz, .wait ldh a, [hSerialIgnoringInitialData] and a ld a, b @@ -584,7 +587,7 @@ FixDataForLinkTransfer: ld [hli], a dec b jr nz, .loop3 - ld hl, wTimeCapsulePartyMon1 - 1 + PARTY_LENGTH + ld hl, wTimeCapsulePlayerData - 1 + PARTY_LENGTH ld de, wc612 lb bc, 0, 0 .loop4 @@ -831,7 +834,7 @@ Link_PrepPartyData_Gen2: ; Fill 5 bytes at wc9f4 with $20 ld de, wc9f4 ld a, $20 - call Function28682 + call Link_CopyMailPreamble ; Copy all the mail messages to wc9f9 ld a, BANK(sPartyMail) @@ -932,7 +935,8 @@ Link_PrepPartyData_Gen2: ld [de], a ret -Function28682: +Link_CopyMailPreamble: +; fill 5 bytes with the value of a, starting at de ld c, 5 .loop ld [de], a @@ -941,7 +945,7 @@ Function28682: jr nz, .loop ret -Function2868a: +Link_ConvertPartyStruct1to2: push hl ld d, h ld e, l @@ -1245,7 +1249,7 @@ LinkTradeOTPartymonMenuLoop: .not_d_up bit D_DOWN_F, a jp z, LinkTradePartiesMenuMasterLoop - jp Function28ac9 + jp LinkTradeCheckCancel LinkTrade_PlayerPartyMenu: farcall InitMG_Mobile_LinkTradePalMap @@ -1281,7 +1285,7 @@ LinkTradePartymonMenuLoop: .check_joypad bit A_BUTTON_F, a jr z, .not_a_button - jp Function28926 + jp LinkTrade_TradeStatsMenu .not_a_button bit D_DOWN_F, a @@ -1327,7 +1331,7 @@ LinkTradePartiesMenuMasterLoop: jp z, LinkTradePartymonMenuLoop ; PARTYMON jp LinkTradeOTPartymonMenuLoop ; OTPARTYMON -Function28926: +LinkTrade_TradeStatsMenu: call LoadTilemapToTempTilemap ld a, [wMenuCursorY] push af @@ -1423,14 +1427,14 @@ Function28926: pop af ld [wMenuCursorY], a dec a - ld [wd002], a + ld [wCurTradePartyMon], a ld [wPlayerLinkAction], a - farcall Function16d6ce + farcall PrintWaitingTextAndSyncAndExchangeNybble ld a, [wOtherPlayerLinkMode] cp $f jp z, InitTradeMenuDisplay - ld [wd003], a - call Function28b68 + ld [wCurOTTradePartyMon], a + call LinkTradePlaceArrow ld c, 100 call DelayFrames farcall ValidateOTTrademon @@ -1454,7 +1458,7 @@ Function28926: xor a ld [wcf57], a ld [wOtherPlayerLinkAction], a - ld a, [wd003] + ld a, [wCurOTTradePartyMon] ld hl, wOTPartySpecies ld c, a ld b, 0 @@ -1481,7 +1485,7 @@ Function28926: call PlaceString ld a, $1 ld [wPlayerLinkAction], a - farcall Function16d6ce + farcall PrintWaitingTextAndSyncAndExchangeNybble ld c, 100 call DelayFrames jp InitTradeMenuDisplay @@ -1497,7 +1501,7 @@ Function28926: text_far _LinkAbnormalMonText text_end -Function28ac9: +LinkTradeCheckCancel: ld a, [wMenuCursorY] cp 1 jp nz, LinkTradePartiesMenuMasterLoop @@ -1540,18 +1544,18 @@ Function28ade: ldcoord_a 9, 17 ld a, $f ld [wPlayerLinkAction], a - farcall Function16d6ce + farcall PrintWaitingTextAndSyncAndExchangeNybble ld a, [wOtherPlayerLinkMode] cp $f jr nz, .loop1 -Function28b22: +ExitLinkCommunications: call RotateThreePalettesRight call ClearScreen ld b, SCGB_DIPLOMA call GetSGBLayout call WaitBGMap2 xor a - ld [wcfbb], a + ld [wUnusedLinkCommunicationByte], a xor a ldh [rSB], a ldh [hSerialSend], a @@ -1561,15 +1565,18 @@ Function28b22: ldh [rSC], a ret -Function28b42: ; unreferenced +GSPlaceTradeScreenFooter: ; unreferenced +; Fill the screen footer with pattern tile hlcoord 0, 16 - ld a, "┘" + ld a, $7e ld bc, 2 * SCREEN_WIDTH call ByteFill +; Clear out area for cancel string hlcoord 1, 16 ld a, " " ld bc, SCREEN_WIDTH - 2 call ByteFill +; Place the string hlcoord 2, 16 ld de, .CancelString jp PlaceString @@ -1577,7 +1584,8 @@ Function28b42: ; unreferenced .CancelString: db "CANCEL@" -Function28b68: +LinkTradePlaceArrow: +; Indicates which pokemon the other player has selected to trade ld a, [wOtherPlayerLinkMode] hlcoord 6, 9 ld bc, SCREEN_WIDTH @@ -1610,7 +1618,7 @@ LinkTrade: ld c, 18 call LinkTextboxAtHL farcall Link_WaitBGMap - ld a, [wd002] + ld a, [wCurTradePartyMon] ld hl, wPartySpecies ld c, a ld b, 0 @@ -1619,10 +1627,10 @@ LinkTrade: ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, wStringBuffer1 - ld de, wd004 + ld de, wBufferTrademonNick ld bc, MON_NAME_LENGTH call CopyBytes - ld a, [wd003] + ld a, [wCurOTTradePartyMon] ld hl, wOTPartySpecies ld c, a ld b, 0 @@ -1638,7 +1646,7 @@ LinkTrade: ld b, 3 ld c, 7 call LinkTextboxAtHL - ld de, String28eab + ld de, String_TradeCancel hlcoord 12, 8 call PlaceString ld a, 8 @@ -1666,12 +1674,12 @@ LinkTrade: call WaitBGMap2 pop af bit 1, a - jr nz, .asm_28c33 + jr nz, .canceled ld a, [wMenuCursorY] dec a - jr z, .asm_28c54 + jr z, .try_trade -.asm_28c33 +.canceled ld a, $1 ld [wPlayerLinkAction], a hlcoord 0, 12 @@ -1681,16 +1689,17 @@ LinkTrade: hlcoord 1, 14 ld de, String_TooBadTheTradeWasCanceled call PlaceString - farcall Function16d6ce - jp Function28ea3 + farcall PrintWaitingTextAndSyncAndExchangeNybble + jp InitTradeMenuDisplay_Delay -.asm_28c54 +.try_trade ld a, $2 ld [wPlayerLinkAction], a - farcall Function16d6ce + farcall PrintWaitingTextAndSyncAndExchangeNybble ld a, [wOtherPlayerLinkMode] dec a - jr nz, .asm_28c7b + jr nz, .do_trade +; If we're here, the other player canceled the trade hlcoord 0, 12 ld b, 4 ld c, 18 @@ -1698,11 +1707,11 @@ LinkTrade: hlcoord 1, 14 ld de, String_TooBadTheTradeWasCanceled call PlaceString - jp Function28ea3 + jp InitTradeMenuDisplay_Delay -.asm_28c7b +.do_trade ld hl, sPartyMail - ld a, [wd002] + ld a, [wCurTradePartyMon] ld bc, MAIL_STRUCT_LENGTH call AddNTimes ld a, BANK(sPartyMail) @@ -1711,20 +1720,20 @@ LinkTrade: ld e, l ld bc, MAIL_STRUCT_LENGTH add hl, bc - ld a, [wd002] + ld a, [wCurTradePartyMon] ld c, a -.asm_28c96 +.copy_mail inc c ld a, c cp PARTY_LENGTH - jr z, .asm_28ca6 + jr z, .copy_player_data push bc ld bc, MAIL_STRUCT_LENGTH call CopyBytes pop bc - jr .asm_28c96 + jr .copy_mail -.asm_28ca6 +.copy_player_data ld hl, sPartyMail ld a, [wPartyCount] dec a @@ -1732,18 +1741,22 @@ LinkTrade: call AddNTimes push hl ld hl, wc9f4 - ld a, [wd003] + ld a, [wCurOTTradePartyMon] ld bc, MAIL_STRUCT_LENGTH call AddNTimes pop de ld bc, MAIL_STRUCT_LENGTH call CopyBytes call CloseSRAM + +; Buffer player data +; nickname ld hl, wPlayerName ld de, wPlayerTrademonSenderName ld bc, NAME_LENGTH call CopyBytes - ld a, [wd002] +; species + ld a, [wCurTradePartyMon] ld hl, wPartySpecies ld b, 0 ld c, a @@ -1751,27 +1764,31 @@ LinkTrade: ld a, [hl] ld [wPlayerTrademonSpecies], a push af - ld a, [wd002] +; OT name + ld a, [wCurTradePartyMon] ld hl, wPartyMonOT call SkipNames ld de, wPlayerTrademonOTName ld bc, NAME_LENGTH call CopyBytes +; ID ld hl, wPartyMon1ID - ld a, [wd002] + ld a, [wCurTradePartyMon] call GetPartyLocation ld a, [hli] ld [wPlayerTrademonID], a ld a, [hl] ld [wPlayerTrademonID + 1], a +; DVs ld hl, wPartyMon1DVs - ld a, [wd002] + ld a, [wCurTradePartyMon] call GetPartyLocation ld a, [hli] ld [wPlayerTrademonDVs], a ld a, [hl] ld [wPlayerTrademonDVs + 1], a - ld a, [wd002] +; caught data + ld a, [wCurTradePartyMon] ld hl, wPartyMon1Species call GetPartyLocation ld b, h @@ -1779,38 +1796,46 @@ LinkTrade: farcall GetCaughtGender ld a, c ld [wPlayerTrademonCaughtData], a + +; Buffer other player data +; nickname ld hl, wOTPlayerName ld de, wOTTrademonSenderName ld bc, NAME_LENGTH call CopyBytes - ld a, [wd003] +; species + ld a, [wCurOTTradePartyMon] ld hl, wOTPartySpecies ld b, 0 ld c, a add hl, bc ld a, [hl] ld [wOTTrademonSpecies], a - ld a, [wd003] +; OT name + ld a, [wCurOTTradePartyMon] ld hl, wOTPartyMonOT call SkipNames ld de, wOTTrademonOTName ld bc, NAME_LENGTH call CopyBytes +; ID ld hl, wOTPartyMon1ID - ld a, [wd003] + ld a, [wCurOTTradePartyMon] call GetPartyLocation ld a, [hli] ld [wOTTrademonID], a ld a, [hl] ld [wOTTrademonID + 1], a +; DVs ld hl, wOTPartyMon1DVs - ld a, [wd003] + ld a, [wCurOTTradePartyMon] call GetPartyLocation ld a, [hli] ld [wOTTrademonDVs], a ld a, [hl] ld [wOTTrademonDVs + 1], a - ld a, [wd003] +; caught data + ld a, [wCurOTTradePartyMon] ld hl, wOTPartyMon1Species call GetPartyLocation ld b, h @@ -1818,14 +1843,16 @@ LinkTrade: farcall GetCaughtGender ld a, c ld [wOTTrademonCaughtData], a - ld a, [wd002] + + ld a, [wCurTradePartyMon] ld [wCurPartyMon], a ld hl, wPartySpecies ld b, 0 ld c, a add hl, bc ld a, [hl] - ld [wd002], a + ld [wCurTradePartyMon], a + xor a ; REMOVE_PARTY ld [wPokemonWithdrawDepositParameter], a callfar RemoveMonFromPartyOrBox @@ -1834,14 +1861,15 @@ LinkTrade: ld [wCurPartyMon], a ld a, TRUE ld [wForceEvolution], a - ld a, [wd003] + ld a, [wCurOTTradePartyMon] push af ld hl, wOTPartySpecies ld b, 0 ld c, a add hl, bc ld a, [hl] - ld [wd003], a + ld [wCurOTTradePartyMon], a + ld c, 100 call DelayFrames call ClearTilemap @@ -1933,7 +1961,7 @@ LinkTrade: ld c, 18 call LinkTextboxAtHL hlcoord 1, 14 - ld de, String28ebd + ld de, String_TradeCompleted call PlaceString farcall Link_WaitBGMap ld c, 50 @@ -1943,12 +1971,12 @@ LinkTrade: jp z, Gen2ToGen1LinkComms jp Gen2ToGen2LinkComms -Function28ea3: +InitTradeMenuDisplay_Delay: ld c, 100 call DelayFrames jp InitTradeMenuDisplay -String28eab: +String_TradeCancel: db "TRADE" next "CANCEL@" @@ -1956,7 +1984,7 @@ LinkAskTradeForText: text_far _LinkAskTradeForText text_end -String28ebd: +String_TradeCompleted: db "Trade completed!@" String_TooBadTheTradeWasCanceled: @@ -2248,7 +2276,7 @@ CheckLinkTimeout_Receptionist: ld a, $1 ld [wPlayerLinkAction], a ld hl, wLinkTimeoutFrames - ld a, $3 + ld a, 3 ld [hli], a xor a ld [hl], a diff --git a/engine/link/link_trade.asm b/engine/link/link_trade.asm index 3bec9c27c..4f4d3c5ce 100644 --- a/engine/link/link_trade.asm +++ b/engine/link/link_trade.asm @@ -15,7 +15,7 @@ Function16d42e: call CopyBytes ret -Function16d43b: +Function16d43b: ; unreferenced call LoadStandardMenuHeader call ClearBGPalettes call ClearTilemap @@ -153,15 +153,15 @@ LinkTextbox: call _LinkTextbox ret -Function16d6ce: +PrintWaitingTextAndSyncAndExchangeNybble: call LoadStandardMenuHeader - call Function16d6e1 + call .PrintWaitingText farcall WaitLinkTransfer call Call_ExitMenu call WaitBGMap2 ret -Function16d6e1: +.PrintWaitingText: hlcoord 4, 10 ld b, 1 ld c, 10 diff --git a/engine/link/mystery_gift.asm b/engine/link/mystery_gift.asm index e28167f14..8b4240c0c 100644 --- a/engine/link/mystery_gift.asm +++ b/engine/link/mystery_gift.asm @@ -1,3 +1,29 @@ +; hMGRole values +IR_RECEIVER EQU 1 +IR_SENDER EQU 2 + +; hMGStatusFlags error bits +MG_WRONG_CHECKSUM_F EQU 0 +MG_TIMED_OUT_F EQU 1 +MG_CANCELED_F EQU 4 +MG_WRONG_PREFIX_F EQU 7 + +; hMGStatusFlags values +MG_WRONG_CHECKSUM EQU 1 << MG_WRONG_CHECKSUM_F +MG_TIMED_OUT EQU 1 << MG_TIMED_OUT_F +MG_CANCELED EQU 1 << MG_CANCELED_F +MG_WRONG_PREFIX EQU 1 << MG_WRONG_PREFIX_F +MG_NOT_OKAY EQU MG_WRONG_CHECKSUM | MG_TIMED_OUT | MG_CANCELED | MG_WRONG_PREFIX +MG_OKAY EQU $ff ^ MG_NOT_OKAY +MG_START_END EQU %11111111 + +REGION_PREFIX EQU $96 +REGION_CODE EQU $90 ; USA + +MESSAGE_PREFIX EQU $5a + +NAME_CARD_PREFIX EQU $3c + DoMysteryGift: call ClearTilemap call ClearSprites @@ -7,22 +33,24 @@ DoMysteryGift: ld de, .String_PressAToLink_BToCancel call PlaceString call WaitBGMap - farcall PrepMysteryGiftDataToSend - call MysteryGift_ClearTrainerData - ld a, $2 - ld [wca01], a - ld a, $14 - ld [wca02], a + + ; Prepare the first of two messages for wMysteryGiftPartnerData + farcall StageDataForMysteryGift + call ClearMysteryGiftTrainer + ld a, 2 + ld [wMysteryGiftMessageCount], a + ld a, wMysteryGiftPartnerDataEnd - wMysteryGiftPartnerData + ld [wMysteryGiftStagedDataLength], a + ldh a, [rIE] push af - - call Function104a95 - + call ExchangeMysteryGiftData ld d, a xor a ldh [rIF], a pop af ldh [rIE], a + push de call ClearTilemap call EnableLCD @@ -31,15 +59,16 @@ DoMysteryGift: call GetSGBLayout call SetPalettes pop de + hlcoord 2, 8 ld a, d ld de, .MysteryGiftCanceledText ; Link has been canceled - cp $10 + cp MG_CANCELED jp z, .LinkCanceled - cp $6c + cp MG_OKAY jp nz, .CommunicationError - ld a, [wc900] - cp 3 + ld a, [wMysteryGiftGameVersion] + cp POKEMON_PIKACHU_2_VERSION jr z, .skip_checks call .CheckAlreadyGotFiveGiftsToday ld hl, .MysteryGiftFiveADayText ; Only 5 gifts a day @@ -54,12 +83,12 @@ DoMysteryGift: ld a, [wMysteryGiftPartnerBackupItem] and a jp nz, .FriendNotReady - ld a, [wc900] - cp 3 + ld a, [wMysteryGiftGameVersion] + cp POKEMON_PIKACHU_2_VERSION jr z, .skip_append_save call .AddMysteryGiftPartnerID - ld a, [wc900] - cp 4 + ld a, [wMysteryGiftGameVersion] + cp 4 ; ??? jr z, .skip_append_save call .SaveMysteryGiftTrainerName farcall RestoreMobileEventIndex @@ -68,14 +97,16 @@ DoMysteryGift: .skip_append_save ld a, [wMysteryGiftPartnerSentDeco] and a - jr z, .item + jr z, .SentItem +; sent decoration ld a, [wMysteryGiftPartnerWhichDeco] ld c, a farcall MysteryGiftGetDecoration push bc - call MysteryGift_CheckAndSetDecorationAlreadyReceived + call CheckAndSetMysteryGiftDecorationAlreadyReceived pop bc - jr nz, .item + jr nz, .SentItem +; keep the decoration if it wasn't already received callfar GetDecorationName_c ld h, d ld l, e @@ -85,17 +116,17 @@ DoMysteryGift: ld hl, .MysteryGiftSentHomeText ; sent decoration to home jr .PrintTextAndExit -.item +.SentItem: call GetMysteryGiftBank ld a, [wMysteryGiftPartnerWhichItem] ld c, a - farcall MysteryGiftGetItemHeldEffect + farcall MysteryGiftGetItem ld a, c ld [sBackupMysteryGiftItem], a ld [wNamedObjectIndexBuffer], a call CloseSRAM call GetItemName - ld hl, .MysteryGiftSentText ; sent item + ld hl, .MysteryGiftSentText ; sent item/decoration jr .PrintTextAndExit .LinkCanceled: @@ -113,6 +144,7 @@ DoMysteryGift: .FriendNotReady: ld hl, .YourFriendIsNotReadyText ; friend not ready + ; fallthrough .PrintTextAndExit: call PrintText @@ -162,7 +194,7 @@ DoMysteryGift: .CheckAlreadyGotFiveGiftsToday: call GetMysteryGiftBank ld a, [sNumDailyMysteryGiftPartnerIDs] - cp $5 + cp MAX_MYSTERY_GIFT_PARTNERS jp CloseSRAM .CheckAlreadyGotAGiftFromThatPerson: @@ -198,9 +230,9 @@ DoMysteryGift: ld hl, sNumDailyMysteryGiftPartnerIDs ld a, [hl] inc [hl] - ld hl, sDailyMysteryGiftPartnerIDs ; inc hl + ld hl, sDailyMysteryGiftPartnerIDs ; could have done "inc hl" instead ld e, a - ld d, $0 + ld d, 0 add hl, de add hl, de ld a, [wMysteryGiftPartnerID] @@ -211,226 +243,268 @@ DoMysteryGift: .SaveMysteryGiftTrainerName: call GetMysteryGiftBank - ld a, $1 + ld a, TRUE ld [sMysteryGiftTrainerHouseFlag], a ld hl, wMysteryGiftPartnerName ld de, sMysteryGiftPartnerName ld bc, NAME_LENGTH call CopyBytes - ld a, $1 + assert sMysteryGiftPartnerName + NAME_LENGTH == sMysteryGiftUnusedFlag + ld a, TRUE ld [de], a inc de - ld hl, wMysteryGiftTrainerData - ld bc, (1 + 1 + NUM_MOVES) * PARTY_LENGTH + 2 + assert sMysteryGiftUnusedFlag + 1 == sMysteryGiftTrainer + ld hl, wMysteryGiftTrainer + ld bc, wMysteryGiftTrainerEnd - wMysteryGiftTrainer call CopyBytes jp CloseSRAM -Function104a95: +ExchangeMysteryGiftData: di farcall ClearChannels - call Function104d5e + call InitializeIRCommunicationInterrupts -.loop2 - call Function104d96 - call Function104ddd +.restart + call BeginIRCommunication + call InitializeIRCommunicationRoles ldh a, [hMGStatusFlags] - cp $10 - jp z, Function104bd0 - cp $6c - jr nz, .loop2 + cp MG_CANCELED + jp z, EndOrContinueMysteryGiftIRCommunication + cp MG_OKAY + jr nz, .restart - ldh a, [hPrintNumBuffer + 8] - cp $2 - jr z, Function104b22 - ld hl, hPrintNumBuffer - ld b, $1 - call Function104d56 - jr nz, .ly_loop - call Function104b49 - jp nz, Function104bd0 - jr Function104b0a + ldh a, [hMGRole] + cp IR_SENDER + jr z, SenderExchangeMysteryGiftDataPayloads +; receiver + ld hl, hMGExchangedByte + ld b, 1 + call TryReceivingIRDataBlock + jr nz, .failed + call ReceiveMysteryGiftDataPayload_GotRegionPrefix + jp nz, EndOrContinueMysteryGiftIRCommunication + jr ReceiverExchangeMysteryGiftDataPayloads_GotPayload + +.failed ; Delay frame -.ly_loop +.wait_frame ldh a, [rLY] cp LY_VBLANK - jr c, .ly_loop + jr c, .wait_frame + ld c, LOW(rRP) - ld a, $c0 + ld a, rRP_ENABLE_READ_MASK ldh [c], a - ld b, 240 ; This might have been intended as a 4-second timeout buffer. - ; However, it is reset with each frame. -.loop3 + + ld b, 60 * 4 ; 4 seconds +.continue push bc - call MysteryGift_ReadJoypad - - ld b, $2 + call MysteryGift_UpdateJoypad + ld b, 1 << rRP_RECEIVING ld c, LOW(rRP) - ; Delay frame -.ly_loop2 +.in_vblank ldh a, [c] and b ld b, a ldh a, [rLY] cp LY_VBLANK - jr nc, .ly_loop2 -.ly_loop3 + jr nc, .in_vblank +.wait_vblank ldh a, [c] and b ld b, a ldh a, [rLY] cp LY_VBLANK - jr c, .ly_loop3 - + jr c, .wait_vblank ld a, b pop bc + ; Restart if the 4-second timeout has elapsed dec b - jr z, .loop2 ; we never jump here + jr z, .restart + ; Restart if rRP is not receiving data or a - jr nz, .loop2 - ; Check if we've pressed the B button + jr nz, .restart + ; Check if we've pressed the B button to cancel ldh a, [hMGJoypadReleased] bit B_BUTTON_F, a - jr z, .loop3 - ld a, $10 + jr z, .continue + ld a, MG_CANCELED ldh [hMGStatusFlags], a - jp Function104bd0 + jp EndOrContinueMysteryGiftIRCommunication -Function104b04: - call Function104b40 - jp nz, Function104bd0 -Function104b0a: - call Function104d38 - jp nz, Function104bd0 - call Function104b88 - jp nz, Function104bd0 - call Function104d43 - jp nz, Function104bd0 - call Function105033 - jp Function104bd0 +ReceiverExchangeMysteryGiftDataPayloads: + ; Receive the data payload + call ReceiveMysteryGiftDataPayload + jp nz, EndOrContinueMysteryGiftIRCommunication + ; fallthrough +ReceiverExchangeMysteryGiftDataPayloads_GotPayload: + ; Switch roles + call BeginSendingIRCommunication + jp nz, EndOrContinueMysteryGiftIRCommunication + ; Send the data payload + call SendMysteryGiftDataPayload + jp nz, EndOrContinueMysteryGiftIRCommunication + ; Switch roles + call BeginReceivingIRCommunication + jp nz, EndOrContinueMysteryGiftIRCommunication + ; Receive an empty block + call ReceiveEmptyIRDataBlock + jp EndOrContinueMysteryGiftIRCommunication -Function104b22: - call Function104b88 - jp nz, Function104bd0 - call Function104d43 - jp nz, Function104bd0 - call Function104b40 - jp nz, Function104bd0 - call Function104d38 - jp nz, Function104bd0 - call Function10502e - jp Function104bd0 +SenderExchangeMysteryGiftDataPayloads: + ; Send the data payload + call SendMysteryGiftDataPayload + jp nz, EndOrContinueMysteryGiftIRCommunication + ; Switch roles + call BeginReceivingIRCommunication + jp nz, EndOrContinueMysteryGiftIRCommunication + ; Receive the data payload + call ReceiveMysteryGiftDataPayload + jp nz, EndOrContinueMysteryGiftIRCommunication + ; Switch roles + call BeginSendingIRCommunication + jp nz, EndOrContinueMysteryGiftIRCommunication + ; Send an empty block + call SendEmptyIRDataBlock + jp EndOrContinueMysteryGiftIRCommunication -Function104b40: - ld hl, hPrintNumBuffer - ld b, $1 - call Function104d56 +ReceiveMysteryGiftDataPayload: + ; Receive the region prefix + ld hl, hMGExchangedByte + ld b, 1 + call TryReceivingIRDataBlock ret nz - -Function104b49: - call Function105033 + ; fallthrough +ReceiveMysteryGiftDataPayload_GotRegionPrefix: + ; Receive an empty block + call ReceiveEmptyIRDataBlock ldh a, [hMGStatusFlags] - cp $6c + cp MG_OKAY ret nz - ldh a, [hPrintNumBuffer] - cp $96 - jp nz, Function104d32 - ld a, $90 - ldh [hPrintNumBuffer], a - call Function104d38 + ; Verify the received region prefix + ldh a, [hMGExchangedByte] + cp REGION_PREFIX + jp nz, WrongMysteryGiftRegion + ld a, REGION_CODE + ldh [hMGExchangedByte], a + ; Switch roles + call BeginSendingIRCommunication ret nz - ld hl, hPrintNumBuffer - ld b, $1 - call Function104d4e + ; Send the region code + ld hl, hMGExchangedByte + ld b, 1 + call TrySendingIRDataBlock ret nz - call Function10502e + ; Send an empty block + call SendEmptyIRDataBlock ldh a, [hMGStatusFlags] - cp $6c + cp MG_OKAY ret nz - call Function104d43 + ; Switch roles + call BeginReceivingIRCommunication ret nz - ld hl, wMysteryGiftTrainerData - ld a, [wca02] + ; Receive the staged data + ld hl, wMysteryGiftTrainer + ld a, [wMysteryGiftStagedDataLength] ld b, a - call Function104d56 + call TryReceivingIRDataBlock ret nz - call Function105033 + ; Receive an empty block + call ReceiveEmptyIRDataBlock ldh a, [hMGStatusFlags] - cp $6c + cp MG_OKAY ret -Function104b88: - ld a, $96 - ldh [hPrintNumBuffer], a - ld hl, hPrintNumBuffer - ld b, $1 - call Function104d4e +SendMysteryGiftDataPayload: + ; Send the region prefix + ld a, REGION_PREFIX + ldh [hMGExchangedByte], a + ld hl, hMGExchangedByte + ld b, 1 + call TrySendingIRDataBlock ret nz - call Function10502e + ; Send an empty block + call SendEmptyIRDataBlock ldh a, [hMGStatusFlags] - cp $6c + cp MG_OKAY ret nz - call Function104d43 + ; Switch roles + call BeginReceivingIRCommunication ret nz - ld hl, hPrintNumBuffer - ld b, $1 - call Function104d56 + ; Receive the region code + ld hl, hMGExchangedByte + ld b, 1 + call TryReceivingIRDataBlock ret nz - call Function105033 + ; Receive an empty block + call ReceiveEmptyIRDataBlock ldh a, [hMGStatusFlags] - cp $6c + cp MG_OKAY ret nz - ldh a, [hPrintNumBuffer] - cp $90 - jp nz, Function104d32 - call Function104d38 + ; Verify the received region code + ldh a, [hMGExchangedByte] + cp REGION_CODE + jp nz, WrongMysteryGiftRegion + ; Switch roles + call BeginSendingIRCommunication ret nz - ld hl, wLinkData - ld a, [wca02] + ; Send the staged data + ld hl, wMysteryGiftStaging + ld a, [wMysteryGiftStagedDataLength] ld b, a - call Function104d4e + call TrySendingIRDataBlock ret nz - call Function10502e + ; Send an empty block + call SendEmptyIRDataBlock ldh a, [hMGStatusFlags] - cp $6c + cp MG_OKAY ret -Function104bd0: +EndOrContinueMysteryGiftIRCommunication: nop ldh a, [hMGStatusFlags] - cp $10 + ; Quit if player canceled + cp MG_CANCELED jr z, .quit - cp $6c + ; Quit if there was a communication error + cp MG_OKAY jr nz, .quit - ld hl, wca01 + ; Quit if all messages are sent/received + ld hl, wMysteryGiftMessageCount dec [hl] jr z, .quit - ld hl, wMysteryGiftTrainerData + ; Quit if communicating with Pokémon Pikachu 2 device + ld hl, wMysteryGiftTrainer ld de, wMysteryGiftPartnerData ld bc, wMysteryGiftPartnerDataEnd - wMysteryGiftPartnerData call CopyBytes - ld a, [wMysteryGiftTrainerData] - cp $3 + ld a, [wMysteryGiftTrainer] ; first byte is the version + cp POKEMON_PIKACHU_2_VERSION jr nc, .quit - farcall StagePartyDataForMysteryGift - call MysteryGift_ClearTrainerData - ld a, $26 - ld [wca02], a - ldh a, [hPrintNumBuffer + 8] - cp $2 - jr z, .asm_104c10 - call Function104d43 - jr nz, Function104bd0 - jp Function104b04 -.asm_104c10 - call Function104d38 - jr nz, Function104bd0 - jp Function104b22 + ; Prepare the second message for wMysteryGiftTrainer + farcall StagePartyDataForMysteryGift + call ClearMysteryGiftTrainer + ld a, wMysteryGiftTrainerEnd - wMysteryGiftTrainer + ld [wMysteryGiftStagedDataLength], a + + ldh a, [hMGRole] + cp IR_SENDER + jr z, .sender +; receiver + call BeginReceivingIRCommunication + jr nz, EndOrContinueMysteryGiftIRCommunication + jp ReceiverExchangeMysteryGiftDataPayloads + +.sender + call BeginSendingIRCommunication + jr nz, EndOrContinueMysteryGiftIRCommunication + jp SenderExchangeMysteryGiftDataPayloads .quit ldh a, [hMGStatusFlags] push af - call Function104da0 + call EndIRCommunication xor a ldh [rIF], a ldh a, [rIE] @@ -441,121 +515,153 @@ Function104bd0: pop af ret -Function104c2d: +ExchangeNameCardData: di farcall ClearChannels - call Function104d5e -.asm_104c37 - call Function104d96 - call Function104ddd - ldh a, [hMGStatusFlags] - cp $10 - jp z, Function104d1c - cp $6c - jr nz, .asm_104c37 - ldh a, [hPrintNumBuffer + 8] - cp $2 - jr z, .asm_104c6c - call Function104c8a - jp nz, Function104d1c - call Function104d38 - jp nz, Function104d1c - call Function104cd2 - jp nz, Function104d1c - call Function104d43 - jp nz, Function104d1c - call Function105033 - jp Function104d1c -.asm_104c6c - call Function104cd2 - jp nz, Function104d1c - call Function104d43 - jp nz, Function104d1c - call Function104c8a - jp nz, Function104d1c - call Function104d38 - jp nz, Function104d1c - call Function10502e - jp Function104d1c + call InitializeIRCommunicationInterrupts -Function104c8a: - ld hl, hPrintNumBuffer - ld b, $1 - call Function104d56 - ret nz - call Function105033 +.restart + call BeginIRCommunication + call InitializeIRCommunicationRoles ldh a, [hMGStatusFlags] - cp $6c + cp MG_CANCELED + jp z, EndNameCardIRCommunication + cp MG_OKAY + jr nz, .restart + + ldh a, [hMGRole] + cp IR_SENDER + jr z, .sender +; receiver + ; Receive the data payload + call ReceiveNameCardDataPayload + jp nz, EndNameCardIRCommunication + ; Switch roles + call BeginSendingIRCommunication + jp nz, EndNameCardIRCommunication + ; Send the data payload + call SendNameCardDataPayload + jp nz, EndNameCardIRCommunication + ; Switch roles + call BeginReceivingIRCommunication + jp nz, EndNameCardIRCommunication + ; Receive an empty block + call ReceiveEmptyIRDataBlock + jp EndNameCardIRCommunication + +.sender + ; Send the data payload + call SendNameCardDataPayload + jp nz, EndNameCardIRCommunication + ; Switch roles + call BeginReceivingIRCommunication + jp nz, EndNameCardIRCommunication + ; Receive the data payload + call ReceiveNameCardDataPayload + jp nz, EndNameCardIRCommunication + ; Switch roles + call BeginSendingIRCommunication + jp nz, EndNameCardIRCommunication + ; Send an empty block + call SendEmptyIRDataBlock + jp EndNameCardIRCommunication + +ReceiveNameCardDataPayload: + ; Receive the Name Card prefix + ld hl, hMGExchangedByte + ld b, 1 + call TryReceivingIRDataBlock ret nz - ldh a, [hPrintNumBuffer] - cp $3c - jp nz, Function104d32 + ; Receive an empty block + call ReceiveEmptyIRDataBlock + ldh a, [hMGStatusFlags] + cp MG_OKAY + ret nz + ; Verify the received Name Card prefix + ldh a, [hMGExchangedByte] + cp NAME_CARD_PREFIX + jp nz, WrongMysteryGiftRegion swap a - ldh [hPrintNumBuffer], a - call Function104d38 + ldh [hMGExchangedByte], a + ; Switch roles + call BeginSendingIRCommunication ret nz - ld hl, hPrintNumBuffer - ld b, $1 - call Function104d4e + ; Send the swapped Name Card prefix + ld hl, hMGExchangedByte + ld b, 1 + call TrySendingIRDataBlock ret nz - call Function10502e + ; Send an empty block + call SendEmptyIRDataBlock ldh a, [hMGStatusFlags] - cp $6c + cp MG_OKAY ret nz - call Function104d43 + ; Switch roles + call BeginReceivingIRCommunication ret nz - ld hl, wMysteryGiftTrainerData - ld a, [wca02] + ; Receive the staged data + ld hl, wNameCardData + ld a, [wMysteryGiftStagedDataLength] ld b, a - call Function104d56 + call TryReceivingIRDataBlock ret nz - call Function105033 + ; Receive an empty block + call ReceiveEmptyIRDataBlock ldh a, [hMGStatusFlags] - cp $6c + cp MG_OKAY ret -Function104cd2: - ld a, $3c - ldh [hPrintNumBuffer], a - ld hl, hPrintNumBuffer - ld b, $1 - call Function104d4e +SendNameCardDataPayload: + ; Send the Name Card prefix + ld a, NAME_CARD_PREFIX + ldh [hMGExchangedByte], a + ld hl, hMGExchangedByte + ld b, 1 + call TrySendingIRDataBlock ret nz - call Function10502e + ; Send an empty block + call SendEmptyIRDataBlock ldh a, [hMGStatusFlags] - cp $6c + cp MG_OKAY ret nz - call Function104d43 + ; Switch roles + call BeginReceivingIRCommunication ret nz - ld hl, hPrintNumBuffer - ld b, $1 - call Function104d56 + ; Receive the swapped Name Card prefix + ld hl, hMGExchangedByte + ld b, 1 + call TryReceivingIRDataBlock ret nz - call Function105033 + ; Receive an empty block + call ReceiveEmptyIRDataBlock ldh a, [hMGStatusFlags] - cp $6c + cp MG_OKAY ret nz - ldh a, [hPrintNumBuffer] + ; Verify the received swapped Name Card prefix + ldh a, [hMGExchangedByte] swap a - cp $3c - jp nz, Function104d32 - call Function104d38 + cp NAME_CARD_PREFIX + jp nz, WrongMysteryGiftRegion + ; Switch roles + call BeginSendingIRCommunication ret nz - ld hl, wLinkData - ld a, [wca02] + ; Send the staged data + ld hl, wMysteryGiftStaging + ld a, [wMysteryGiftStagedDataLength] ld b, a - call Function104d4e + call TrySendingIRDataBlock ret nz - call Function10502e + ; Send an empty block + call SendEmptyIRDataBlock ldh a, [hMGStatusFlags] - cp $6c + cp MG_OKAY ret -Function104d1c: +EndNameCardIRCommunication: nop ldh a, [hMGStatusFlags] push af - call Function104da0 + call EndIRCommunication xor a ldh [rIF], a ldh a, [rIE] @@ -566,46 +672,46 @@ Function104d1c: pop af ret -Function104d32: - ld a, $80 +WrongMysteryGiftRegion: + ld a, MG_WRONG_PREFIX ldh [hMGStatusFlags], a and a ret -Function104d38: - call Function104d96 - call Function104e46 +BeginSendingIRCommunication: + call BeginIRCommunication + call SendIRHelloMessage ldh a, [hMGStatusFlags] - cp $6c + cp MG_OKAY ret -Function104d43: - call Function104d96 - call Function104dfe +BeginReceivingIRCommunication: + call BeginIRCommunication + call ReceiveIRHelloMessage ldh a, [hMGStatusFlags] - cp $6c + cp MG_OKAY ret -Function104d4e: - call Function104e93 +TrySendingIRDataBlock: + call SendIRDataBlock ldh a, [hMGStatusFlags] - cp $6c + cp MG_OKAY ret -Function104d56: - call Function104f57 +TryReceivingIRDataBlock: + call ReceiveIRDataBlock ldh a, [hMGStatusFlags] - cp $6c + cp MG_OKAY ret -Function104d5e: - call Function104d74 +InitializeIRCommunicationInterrupts: + call StartFastIRTimer ld a, 1 << TIMER ldh [rIE], a xor a ldh [rIF], a - call Function104d96 -; runs for ~$40400 cycles + call BeginIRCommunication +; waits for ~$40400 cycles = ~0.25 seconds xor a ld b, a .busy_wait @@ -615,69 +721,76 @@ Function104d5e: jr nz, .busy_wait ret -Function104d74: +StartFastIRTimer: +; Starts a 65,536 Hz timer that interrupts every 3 increments (21,845 Hz). xor a ldh [rTAC], a - ld a, $fe + ld a, -2 ldh [rTMA], a ldh [rTIMA], a - ld a, $2 + ld a, rTAC_65536_HZ ldh [rTAC], a - or $4 + or 1 << rTAC_ON ldh [rTAC], a ret -Function104d86: +StartSlowIRTimer: +; Starts a 65,536 Hz timer that interrupts every 256 increments (256 Hz). xor a ldh [rTAC], a ldh [rTMA], a ldh [rTIMA], a - ld a, $2 + ld a, rTAC_65536_HZ ldh [rTAC], a - or $4 + or 1 << rTAC_ON ldh [rTAC], a ret -Function104d96: - ld a, $c0 - call Function104e8c - ld a, $1 - ldh [hPrintNumBuffer + 8], a +BeginIRCommunication: + ld a, rRP_ENABLE_READ_MASK + call ToggleIRCommunication + ld a, IR_RECEIVER + ldh [hMGRole], a ret -Function104da0: +EndIRCommunication: xor a - call Function104e8c - ld a, $2 + call ToggleIRCommunication + ld a, rTAC_65536_HZ ldh [rTAC], a ret -Function104da9: +ReceiveInfraredLEDOn: +; Count interrupts of the partner's IR LED on; quit after 256-d interrupts. +.recv_loop inc d ret z xor a ldh [rIF], a halt ldh a, [c] - bit 1, a - jr z, Function104da9 + bit rRP_RECEIVING, a + jr z, .recv_loop or a ret -Function104db7: +ReceiveInfraredLEDOff: +; Count interrupts of the partner's IR LED off; quit after 256-d interrupts. +.no_recv_loop inc d ret z xor a ldh [rIF], a halt ldh a, [c] - bit 1, a - jr nz, Function104db7 + bit rRP_RECEIVING, a + jr nz, .no_recv_loop or a ret -Function104dc5: - ld a, $c1 +SendInfraredLEDOn: +; Holds the IR LED on for d-1 interrupts. + ld a, rRP_ENABLE_READ_MASK | (1 << rRP_LED_ON) ldh [c], a .wait dec d @@ -687,8 +800,9 @@ Function104dc5: halt jr .wait -Function104dd1: - ld a, $c0 +SendInfraredLEDOff: +; Holds the IR LED off for d-1 interrupts. + ld a, rRP_ENABLE_READ_MASK ldh [c], a .wait dec d @@ -698,175 +812,204 @@ Function104dd1: halt jr .wait -Function104ddd: - ld d, $0 +InitializeIRCommunicationRoles: + ld d, 0 ld e, d - ld a, $1 - ldh [hPrintNumBuffer + 8], a + + ld a, IR_RECEIVER + ldh [hMGRole], a .loop - call MysteryGift_ReadJoypad - ld b, $2 + call MysteryGift_UpdateJoypad + ld b, 1 << rRP_RECEIVING ld c, LOW(rRP) + ; Check if we've pressed the B button to cancel ldh a, [hMGJoypadReleased] bit B_BUTTON_F, a - jr z, .next - ld a, $10 + jr z, .not_canceled + ld a, MG_CANCELED ldh [hMGStatusFlags], a ret -.next - bit 0, a - jr nz, Function104e3a +.not_canceled + ; Check if we've pressed the A button to start sending + bit A_BUTTON_F, a + jr nz, SendIRHelloMessageAfterDelay + ; If rRP is not receiving data, keep checking for input ldh a, [c] and b jr nz, .loop + ; fallthrough -Function104dfe: +ReceiveIRHelloMessage: ld c, LOW(rRP) - ld d, $0 + ld d, 0 ld e, d - call Function104db7 - jp z, Function104f42 + + call ReceiveInfraredLEDOff + jp z, InfraredLEDReceiveTimedOut ld d, e - call Function104da9 - jp z, Function104f42 - call Function104db7 - jp z, Function104f42 - call Function104da9 - jp z, Function104f42 - ld a, $6c + call ReceiveInfraredLEDOn + jp z, InfraredLEDReceiveTimedOut + call ReceiveInfraredLEDOff + jp z, InfraredLEDReceiveTimedOut + call ReceiveInfraredLEDOn + jp z, InfraredLEDReceiveTimedOut + + ld a, MG_OKAY ldh [hMGStatusFlags], a - ld d, $3d - call Function104dd1 - ld d, $5 - call Function104dc5 - ld d, $15 - call Function104dd1 - ld d, $5 - call Function104dc5 - ld d, $5 - call Function104dd1 + + ld d, 61 + call SendInfraredLEDOff + ld d, 5 + call SendInfraredLEDOn + ld d, 21 + call SendInfraredLEDOff + ld d, 5 + call SendInfraredLEDOn + ld d, 5 + call SendInfraredLEDOff ret -Function104e3a: +SendIRHelloMessageAfterDelay: ; Wait a random amount of time call Random ld e, a and $f ld d, a -.loop +.wait_loop dec de ld a, d or e - jr nz, .loop -Function104e46: - ld a, $2 - ldh [hPrintNumBuffer + 8], a + jr nz, .wait_loop + ; fallthrough + +SendIRHelloMessage: + ld a, IR_SENDER + ldh [hMGRole], a + ld c, LOW(rRP) - ld d, $0 + ld d, 0 ld e, d - ld d, $3d - call Function104dd1 - ld d, $5 - call Function104dc5 - ld d, $15 - call Function104dd1 - ld d, $5 - call Function104dc5 - ld d, $5 - call Function104dd1 + + ld d, 61 + call SendInfraredLEDOff + ld d, 5 + call SendInfraredLEDOn + ld d, 21 + call SendInfraredLEDOff + ld d, 5 + call SendInfraredLEDOn + ld d, 5 + call SendInfraredLEDOff + ld d, e - call Function104db7 - jp z, Function104f42 + call ReceiveInfraredLEDOff + jp z, InfraredLEDReceiveTimedOut ld d, e - call Function104da9 - jp z, Function104f42 - call Function104db7 - jp z, Function104f42 - call Function104da9 - jp z, Function104f42 - ld d, $3d - call Function104dd1 - ld a, $6c + call ReceiveInfraredLEDOn + jp z, InfraredLEDReceiveTimedOut + call ReceiveInfraredLEDOff + jp z, InfraredLEDReceiveTimedOut + call ReceiveInfraredLEDOn + jp z, InfraredLEDReceiveTimedOut + + ld d, 61 + call SendInfraredLEDOff + + ld a, MG_OKAY ldh [hMGStatusFlags], a ret -Function104e8c: +ToggleIRCommunication: ldh [rRP], a - ld a, $ff + ld a, MG_START_END ldh [hMGStatusFlags], a ret -Function104e93: +SendIRDataBlock: +; Send b bytes of data in three messages: +; 1. two bytes: MESSAGE_PREFIX and the length b +; 2. b bytes: the actual data +; 3. two bytes: a little-endian checksum +; Then receive a one-byte acknowledgement message: the status. xor a - ldh [hPrintNumBuffer + 4], a - ldh [hPrintNumBuffer + 5], a + ldh [hMGChecksum + 0], a + ldh [hMGChecksum + 1], a push hl push bc ld c, LOW(rRP) - ld d, $3d - call Function104dd1 - ld hl, hPrintNumBuffer + 1 - ld a, $5a + ld d, 61 + call SendInfraredLEDOff + ld hl, hMGExchangedWord + ld a, MESSAGE_PREFIX ld [hli], a ld [hl], b dec hl - ld b, $2 - call Function104ed6 + ld b, 2 + call SendIRDataMessage pop bc pop hl - call Function104ed6 - ldh a, [hPrintNumBuffer + 4] - ldh [hPrintNumBuffer + 1], a - ldh a, [hPrintNumBuffer + 5] - ldh [hPrintNumBuffer + 2], a + call SendIRDataMessage + ldh a, [hMGChecksum + 0] + ldh [hMGExchangedWord + 0], a + ldh a, [hMGChecksum + 1] + ldh [hMGExchangedWord + 1], a push hl - ld hl, hPrintNumBuffer + 1 - ld b, $2 - call Function104ed6 + ld hl, hMGExchangedWord + ld b, 2 + call SendIRDataMessage ld hl, hMGStatusFlags - ld b, $1 - call Function104faf - ldh a, [hPrintNumBuffer + 1] - ldh [hPrintNumBuffer + 4], a - ldh a, [hPrintNumBuffer + 2] - ldh [hPrintNumBuffer + 5], a + ld b, 1 + call ReceiveIRDataMessage + ldh a, [hMGExchangedWord + 0] + ldh [hMGChecksum + 0], a + ldh a, [hMGExchangedWord + 1] + ldh [hMGChecksum + 1], a pop hl ret -Function104ed6: +SendIRDataMessage: +; Send b bytes of data one bit at a time, and update the checksum. ld c, LOW(rRP) - ld d, $5 - call Function104dd1 - ld d, $5 - call Function104dc5 - ld d, $15 - call Function104dd1 + + ld d, 5 + call SendInfraredLEDOff + ld d, 5 + call SendInfraredLEDOn + ld d, 21 + call SendInfraredLEDOff + + ; b = -b - 1; then count up to 0 ld a, b cpl ld b, a - ld a, $f4 + + ld a, -12 ldh [rTMA], a -.main_loop +.byte_loop inc b jr z, .done - ld a, $8 - ldh [hPrintNumBuffer + 3], a + ld a, 8 + ldh [hMGNumBits], a + ; Get the next data byte ld a, [hli] ld e, a - ldh a, [hPrintNumBuffer + 4] + ; Add the next data byte to the checksum + ldh a, [hMGChecksum + 0] add e - ldh [hPrintNumBuffer + 4], a - ldh a, [hPrintNumBuffer + 5] + ldh [hMGChecksum + 0], a + ldh a, [hMGChecksum + 1] adc 0 - ldh [hPrintNumBuffer + 5], a -.inner_loop + ldh [hMGChecksum + 1], a + ; Send each bit of the byte +.bit_loop xor a ldh [rIF], a halt - ld a, $c1 + ld a, rRP_ENABLE_READ_MASK | (1 << rRP_LED_ON) ldh [rRP], a - ld d, $1 + ; Turn the LED off for longer if the bit is 1 + ld d, 1 ld a, e rlca ld e, a @@ -874,9 +1017,9 @@ Function104ed6: inc d .wait ldh a, [rTIMA] - cp $f8 + cp -8 jr c, .wait - ld a, $c0 + ld a, rRP_ENABLE_READ_MASK ldh [rRP], a dec d jr z, .no_halt @@ -884,133 +1027,145 @@ Function104ed6: ldh [rIF], a halt .no_halt - ldh a, [hPrintNumBuffer + 3] + ldh a, [hMGNumBits] dec a - jr z, .main_loop - ldh [hPrintNumBuffer + 3], a - jr .inner_loop + jr z, .byte_loop + ldh [hMGNumBits], a + jr .bit_loop .done - ld a, $fe + ld a, -2 ldh [rTMA], a xor a ldh [rIF], a halt - ld d, $5 - call Function104dc5 - ld d, $11 - call Function104dd1 + + ld d, 5 + call SendInfraredLEDOn + ld d, 17 + call SendInfraredLEDOff ret -Function104f42: +InfraredLEDReceiveTimedOut: ldh a, [hMGStatusFlags] - or $2 + or MG_TIMED_OUT ldh [hMGStatusFlags], a ret -Function104f49: +ReceivedWrongIRChecksum: ldh a, [hMGStatusFlags] - or $1 + or MG_WRONG_CHECKSUM ldh [hMGStatusFlags], a ret -Function104f50: +ReceivedWrongIRMessagePrefix: ldh a, [hMGStatusFlags] - or $80 + or MG_WRONG_PREFIX ldh [hMGStatusFlags], a ret -Function104f57: +ReceiveIRDataBlock: +; Receive b bytes of data in three messages: +; 1. two bytes: MESSAGE_PREFIX and the length b +; 2. b bytes: the actual data +; 3. two bytes: a little-endian checksum +; Then send a one-byte acknowledgement message: the status. xor a - ldh [hPrintNumBuffer + 4], a - ldh [hPrintNumBuffer + 5], a + ldh [hMGChecksum + 0], a + ldh [hMGChecksum + 1], a push bc push hl - ld hl, hPrintNumBuffer + 1 - ld b, $2 - call Function104faf - ldh a, [hPrintNumBuffer + 2] - ldh [hPrintNumBuffer + 7], a + ld hl, hMGExchangedWord + ld b, 2 + call ReceiveIRDataMessage + ldh a, [hMGExchangedWord + 1] + ldh [hMGUnusedMsgLength], a ld b, a pop hl pop af cp b - jp c, Function104f50 - ldh a, [hPrintNumBuffer + 1] - cp $5a - jp nz, Function104f50 - call Function104faf - ldh a, [hPrintNumBuffer + 4] + jp c, ReceivedWrongIRMessagePrefix + ldh a, [hMGExchangedWord + 0] + cp MESSAGE_PREFIX + jp nz, ReceivedWrongIRMessagePrefix + call ReceiveIRDataMessage + ldh a, [hMGChecksum + 0] ld d, a - ldh a, [hPrintNumBuffer + 5] + ldh a, [hMGChecksum + 1] ld e, a push hl push de - ld hl, hPrintNumBuffer + 1 - ld b, $2 - call Function104faf + ld hl, hMGExchangedWord + ld b, 2 + call ReceiveIRDataMessage pop de - ld hl, hPrintNumBuffer + 1 + ld hl, hMGExchangedWord ld a, [hli] xor d ld b, a ld a, [hl] xor e or b - call nz, Function104f49 + call nz, ReceivedWrongIRChecksum push de - ld d, $3d - call Function104dd1 + + ld d, 61 + call SendInfraredLEDOff + ld hl, hMGStatusFlags - ld b, $1 - call Function104ed6 + ld b, 1 + call SendIRDataMessage + pop de pop hl ld a, d - ldh [hPrintNumBuffer + 4], a + ldh [hMGChecksum + 0], a ld a, e - ldh [hPrintNumBuffer + 5], a + ldh [hMGChecksum + 1], a ret -Function104faf: +ReceiveIRDataMessage: ld c, LOW(rRP) - ld d, $0 - call Function104db7 - jp z, Function104f42 - ld d, $0 - call Function104da9 - jp z, Function104f42 - ld d, $0 - call Function104db7 - jp z, Function104f42 + + ld d, 0 + call ReceiveInfraredLEDOff + jp z, InfraredLEDReceiveTimedOut + ld d, 0 + call ReceiveInfraredLEDOn + jp z, InfraredLEDReceiveTimedOut + ld d, 0 + call ReceiveInfraredLEDOff + jp z, InfraredLEDReceiveTimedOut + ld a, b cpl ld b, a xor a ldh [hMGPrevTIMA], a - call Function104d86 + + call StartSlowIRTimer .main_loop inc b jr z, .done - ld a, $8 - ldh [hPrintNumBuffer + 3], a + ld a, 8 + ldh [hMGNumBits], a .inner_loop - ld d, $0 -.wait_one + ld d, 0 +.recv_loop inc d - jr z, .got_one + jr z, .recv_done ldh a, [c] - bit 1, a - jr z, .wait_one - ld d, $0 -.got_one -.wait_zero + bit rRP_RECEIVING, a + jr z, .recv_loop + ld d, 0 +.recv_done +.send_loop inc d - jr z, .got_zero + jr z, .send_done ldh a, [c] - bit 1, a - jr nz, .wait_zero -.got_zero + bit rRP_RECEIVING, a + jr nz, .send_loop +.send_done ldh a, [hMGPrevTIMA] ld d, a ldh a, [rTIMA] @@ -1023,9 +1178,9 @@ Function104faf: .zero res 0, e .ok - ldh a, [hPrintNumBuffer + 3] + ldh a, [hMGNumBits] dec a - ldh [hPrintNumBuffer + 3], a + ldh [hMGNumBits], a jr z, .continue ld a, e rlca @@ -1035,34 +1190,35 @@ Function104faf: .continue ld a, e ld [hli], a - ldh a, [hPrintNumBuffer + 4] + ldh a, [hMGChecksum + 0] add e - ldh [hPrintNumBuffer + 4], a - ldh a, [hPrintNumBuffer + 5] + ldh [hMGChecksum + 0], a + ldh a, [hMGChecksum + 1] adc 0 - ldh [hPrintNumBuffer + 5], a + ldh [hMGChecksum + 1], a jr .main_loop .done - call Function104d74 + call StartFastIRTimer xor a ldh [rIF], a - ld d, $0 - call Function104da9 - jp z, Function104f42 - ld d, $10 - call Function104dd1 + ld d, 0 + call ReceiveInfraredLEDOn + jp z, InfraredLEDReceiveTimedOut + + ld d, 16 + call SendInfraredLEDOff ret -Function10502e: - ld b, $0 - jp Function104e93 +SendEmptyIRDataBlock: + ld b, 0 + jp SendIRDataBlock -Function105033: - ld b, $0 - jp Function104f57 +ReceiveEmptyIRDataBlock: + ld b, 0 + jp ReceiveIRDataBlock -MysteryGift_ReadJoypad: +MysteryGift_UpdateJoypad: ; We can only get four inputs at a time. ; We take d-pad first for no particular reason. ld a, R_DPAD @@ -1107,9 +1263,10 @@ endr ldh [rJOYP], a ret -MysteryGift_CheckAndSetDecorationAlreadyReceived: +CheckAndSetMysteryGiftDecorationAlreadyReceived: +; Return nz if decoration c was already received; otherwise receive it. call GetMysteryGiftBank - ld d, $0 + ld d, 0 ld b, CHECK_FLAG ld hl, sMysteryGiftDecorationsReceived lda_predef SmallFarFlagAction @@ -1129,12 +1286,12 @@ MysteryGift_CheckAndSetDecorationAlreadyReceived: xor a ret -MysteryGift_CopyReceivedDecosToPC: +CopyMysteryGiftReceivedDecorationsToPC: call GetMysteryGiftBank - ld c, $0 + ld c, 0 .loop push bc - ld d, $0 + ld d, 0 ld b, CHECK_FLAG ld hl, sMysteryGiftDecorationsReceived predef SmallFarFlagAction @@ -1148,57 +1305,68 @@ MysteryGift_CopyReceivedDecosToPC: .skip inc c ld a, c - cp TrophyIDs - DecorationIDs + cp NUM_NON_TROPHY_DECOS jr c, .loop jp CloseSRAM UnlockMysteryGift: +; If [sMysteryGiftUnlocked] was -1, this sets both +; [sMysteryGiftUnlocked] and [sMysteryGiftItem] to 0. call GetMysteryGiftBank ld hl, sMysteryGiftUnlocked ld a, [hl] inc a jr nz, .ok ld [hld], a + assert sMysteryGiftUnlocked - 1 == sMysteryGiftItem ld [hl], a .ok jp CloseSRAM -Function1050c8: +ResetDailyMysteryGiftLimitIfUnlocked: call GetMysteryGiftBank ld a, [sNumDailyMysteryGiftPartnerIDs] - cp $ff - jr z, .okay + cp -1 ; locked? + jr z, .dont_clear xor a ld [sNumDailyMysteryGiftPartnerIDs], a -.okay +.dont_clear jp CloseSRAM BackupMysteryGift: +; Copies [sMysteryGiftItem] to [sBackupMysteryGiftItem], +; and [sMysteryGiftUnlocked] to [sNumDailyMysteryGiftPartnerIDs]. call GetMysteryGiftBank ld hl, sMysteryGiftItem ld de, sBackupMysteryGiftItem ld a, [hli] ld [de], a inc de + assert sMysteryGiftItem + 1 == sMysteryGiftUnlocked + assert sBackupMysteryGiftItem + 1 == sNumDailyMysteryGiftPartnerIDs ld a, [hl] ld [de], a jp CloseSRAM RestoreMysteryGift: +; Copies [sBackupMysteryGiftItem] to [sMysteryGiftItem], +; and [sNumDailyMysteryGiftPartnerIDs] to [sMysteryGiftUnlocked]. call GetMysteryGiftBank ld hl, sBackupMysteryGiftItem ld de, sMysteryGiftItem ld a, [hli] ld [de], a inc de + assert sBackupMysteryGiftItem + 1 == sNumDailyMysteryGiftPartnerIDs + assert sMysteryGiftItem + 1 == sMysteryGiftUnlocked ld a, [hl] ld [de], a jp CloseSRAM -MysteryGift_ClearTrainerData: - ld hl, wMysteryGiftTrainerData +ClearMysteryGiftTrainer: + ld hl, wMysteryGiftTrainer xor a - ld b, wMysteryGiftTrainerDataEnd - wMysteryGiftTrainerData + ld b, wMysteryGiftTrainerEnd - wMysteryGiftTrainer .loop ld [hli], a dec b @@ -1206,7 +1374,7 @@ MysteryGift_ClearTrainerData: ret GetMysteryGiftBank: - ld a, BANK(sBackupMysteryGiftItem) + ld a, BANK(sMysteryGiftData) jp OpenSRAM StagePartyDataForMysteryGift: @@ -1256,8 +1424,8 @@ StagePartyDataForMysteryGift: .party_end ld a, -1 ld [de], a - ld a, $26 - ld [wca00], a + ld a, wMysteryGiftTrainerEnd - wMysteryGiftTrainer + ld [wUnusedMysteryGiftStagedDataLength], a jp CloseSRAM InitMysteryGiftLayout: @@ -1399,22 +1567,22 @@ InitMysteryGiftLayout: MysteryGiftGFX: INCBIN "gfx/mystery_gift/mystery_gift.2bpp" -Function105688: +DoNameCardSwap: call ClearTilemap call ClearSprites call WaitBGMap - call Function1057d7 + call InitNameCardLayout hlcoord 3, 8 - ld de, String_PressAToLink_BToCancel_JP + ld de, .String_PressAToLink_BToCancel_JP call PlaceString call WaitBGMap - call Function10578c - call MysteryGift_ClearTrainerData - ld a, $24 - ld [wca02], a + call StageDataForNameCard + call ClearMysteryGiftTrainer + ld a, wNameCardDataEnd - wNameCardData + ld [wMysteryGiftStagedDataLength], a ldh a, [rIE] push af - call Function104c2d + call ExchangeNameCardData ld d, a xor a ldh [rIF], a @@ -1422,25 +1590,25 @@ Function105688: ldh [rIE], a ld a, d cp $10 - jp z, Function105712 - cp $6c - jp nz, Function10571a - call Function1056eb + jp z, .LinkCanceled + cp MG_OKAY + jp nz, .CommunicationError + call .SlideNameCardUpOffScreen ld c, 60 call DelayFrames - call Function105777 - ld hl, MysteryGiftReceivedCardText + call .ClearScreen + ld hl, .NameCardReceivedCardText call PrintText - ld de, wMysteryGiftTrainerData + ld de, wNameCardData farcall Function8ac70 ld a, c ld [wDeciramBuffer], a - ld hl, MysteryGiftNotRegisteredCardText - jr c, PrintTextAndExit_JP - ld hl, MysteryGiftListedCardText - jr PrintTextAndExit_JP + ld hl, .NameCardNotRegisteredCardText + jr c, .PrintTextAndExit + ld hl, .NameCardListedCardText + jr .PrintTextAndExit -Function1056eb: +.SlideNameCardUpOffScreen: ld c, 16 .loop ld hl, wVirtualOAMSprite00YCoord @@ -1469,51 +1637,51 @@ endr pop bc jr .loop -Function105712: - call Function105777 - ld hl, MysteryGiftLinkCancelledText - jr PrintTextAndExit_JP +.LinkCanceled: + call .ClearScreen + ld hl, .NameCardLinkCancelledText + jr .PrintTextAndExit -Function10571a: - call Function105777 - ld hl, MysteryGiftLinkCommErrorText +.CommunicationError: + call .ClearScreen + ld hl, .NameCardCommErrorText call PrintText - jp Function105688 + jp DoNameCardSwap -PrintTextAndExit_JP: +.PrintTextAndExit: call PrintText ld a, LCDC_DEFAULT ldh [rLCDC], a ret -String_PressAToLink_BToCancel_JP: +.String_PressAToLink_BToCancel_JP: db "エーボタンおすと" next "つうしんおこなわれるよ!" next "ビーボタンおすと" next "つうしんちゅうし します" db "@" -MysteryGiftReceivedCardText: - text_far _MysteryGiftReceivedCardText +.NameCardReceivedCardText: + text_far _NameCardReceivedCardText text_end -MysteryGiftListedCardText: - text_far _MysteryGiftListedCardText +.NameCardListedCardText: + text_far _NameCardListedCardText text_end -MysteryGiftNotRegisteredCardText: - text_far _MysteryGiftNotRegisteredCardText +.NameCardNotRegisteredCardText: + text_far _NameCardNotRegisteredCardText text_end -MysteryGiftLinkCancelledText: - text_far _MysteryGiftLinkCancelledText +.NameCardLinkCancelledText: + text_far _NameCardLinkCancelledText text_end -MysteryGiftLinkCommErrorText: - text_far _MysteryGiftLinkCommErrorText +.NameCardCommErrorText: + text_far _NameCardLinkCommErrorText text_end -Function105777: +.ClearScreen: call ClearSprites call ClearTilemap call EnableLCD @@ -1523,8 +1691,8 @@ Function105777: call SetPalettes ret -Function10578c: - ld de, wLinkData +StageDataForNameCard: + ld de, wMysteryGiftStaging ld a, BANK(sPlayerData) call OpenSRAM ld hl, sPlayerData + wPlayerName - wPlayerData @@ -1545,15 +1713,15 @@ Function10578c: ld a, BANK(s4_a603) ; aka BANK(s4_a007) ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call OpenSRAM ld hl, s4_a603 ; address of MBC30 bank - ld bc, $8 + ld bc, 8 call CopyBytes ld hl, s4_a007 ; address of MBC30 bank - ld bc, $c + ld bc, 12 call CopyBytes call CloseSRAM ret -Function1057d7: +InitNameCardLayout: call ClearBGPalettes call DisableLCD ld hl, CardTradeGFX @@ -1638,13 +1806,13 @@ Function1057d7: hlcoord 17, 15 ld [hl], $3e ld de, wVirtualOAMSprite00 - ld hl, .OAM_data + ld hl, .NameCardOAMData ld bc, 16 * SPRITEOAMSTRUCT_LENGTH call CopyBytes call EnableLCD call WaitBGMap - ld b, $2 - farcall GetMysteryGift_MobileAdapterLayout + ld b, CRYSTAL_CGB_NAME_CARD + farcall GetCrystalCGBLayout jp SetPalettes .Load6Row: @@ -1692,7 +1860,7 @@ Function1057d7: jr nz, .row_loop_no_inc ret -.OAM_data: +.NameCardOAMData: dbsprite 6, 2, 4, 1, $00, 0 dbsprite 7, 2, 4, 1, $01, 0 dbsprite 8, 2, 4, 1, $02, 0 diff --git a/engine/link/mystery_gift_2.asm b/engine/link/mystery_gift_2.asm index f6e9fa320..af3715e09 100644 --- a/engine/link/mystery_gift_2.asm +++ b/engine/link/mystery_gift_2.asm @@ -1,24 +1,24 @@ -PrepMysteryGiftDataToSend: +StageDataForMysteryGift: ld de, wMysteryGiftStaging - ld a, $1 + GS_VERSION + ld a, GS_VERSION + 1 ld [de], a - inc de ; wc801 + inc de ; wMysteryGiftStaging+1 ld a, BANK(sGameData) call OpenSRAM ld hl, sPlayerData + wPlayerID - wPlayerData ld a, [hli] ld [de], a ld b, a - inc de ; wc802 + inc de ; wMysteryGiftStaging+2 ld a, [hl] ld [de], a ld c, a - inc de ; wc803 + inc de ; wMysteryGiftStaging+3 push bc ld hl, sPlayerData + wPlayerName - wPlayerData ld bc, NAME_LENGTH call CopyBytes - push de ; wc80e + push de ; wMysteryGiftStaging+14 ld hl, sPokemonData + wPokedexCaught - wPokemonData ld b, wEndPokedexCaught - wPokedexCaught call CountSetBits @@ -26,30 +26,30 @@ PrepMysteryGiftDataToSend: pop bc ld a, [wNumSetBits] ld [de], a - inc de ; wc80f + inc de ; wMysteryGiftStaging+15 call CloseSRAM call Random and 1 ld [de], a - inc de ; wc810 + inc de ; wMysteryGiftStaging+16 call .RandomSample ld [de], a - inc de ; wc811 + inc de ; wMysteryGiftStaging+17 ld a, c ld c, b ld b, a call .RandomSample ld [de], a - inc de ; wc812 + inc de ; wMysteryGiftStaging+18 ld a, BANK(sBackupMysteryGiftItem) call OpenSRAM ld a, [sBackupMysteryGiftItem] ld [de], a inc de - ld a, [sBackupMysteryGiftItem + 1] + ld a, [sNumDailyMysteryGiftPartnerIDs] ld [de], a - ld a, $14 - ld [wca00], a + ld a, wMysteryGiftPlayerDataEnd - wMysteryGiftPlayerData + ld [wUnusedMysteryGiftStagedDataLength], a call CloseSRAM ld hl, wMysteryGiftStaging ld de, wMysteryGiftPlayerData @@ -121,7 +121,7 @@ PrepMysteryGiftDataToSend: pop de ret -MysteryGiftGetItemHeldEffect: +MysteryGiftGetItem: ld a, c cp MysteryGiftItems.End - MysteryGiftItems jr nc, MysteryGiftFallbackItem diff --git a/engine/link/time_capsule.asm b/engine/link/time_capsule.asm index bacda9c4b..b8c68a32b 100644 --- a/engine/link/time_capsule.asm +++ b/engine/link/time_capsule.asm @@ -1,11 +1,11 @@ ; These functions seem to be related to backwards compatibility ValidateOTTrademon: - ld a, [wd003] + ld a, [wCurOTTradePartyMon] ld hl, wOTPartyMon1Species call GetPartyLocation push hl - ld a, [wd003] + ld a, [wCurOTTradePartyMon] inc a ld c, a ld b, 0 @@ -30,7 +30,7 @@ ValidateOTTrademon: cp LINK_TIMECAPSULE jr nz, .normal ld hl, wOTPartySpecies - ld a, [wd003] + ld a, [wCurOTTradePartyMon] ld c, a ld b, 0 add hl, bc @@ -65,11 +65,11 @@ ValidateOTTrademon: ret CheckAnyOtherAliveMonsForTrade: - ld a, [wd002] + ld a, [wCurTradePartyMon] ld d, a ld a, [wPartyCount] ld b, a - ld c, $0 + ld c, 0 .loop ld a, c cp d @@ -87,7 +87,7 @@ CheckAnyOtherAliveMonsForTrade: inc c dec b jr nz, .loop - ld a, [wd003] + ld a, [wCurOTTradePartyMon] ld hl, wOTPartyMon1HP call GetPartyLocation ld a, [hli] diff --git a/engine/math/print_num.asm b/engine/math/print_num.asm index 409379257..09a10128b 100644 --- a/engine/math/print_num.asm +++ b/engine/math/print_num.asm @@ -35,7 +35,6 @@ _PrintNum:: cp 2 jr z, .word ; maximum 3 bytes -.long ld a, [de] ldh [hPrintNumBuffer + 1], a inc de @@ -81,7 +80,7 @@ _PrintNum:: cp 6 jr z, .six -.seven +; seven ld a, HIGH(1000000 >> 8) ldh [hPrintNumBuffer + 4], a ld a, HIGH(1000000) ; mid diff --git a/engine/menus/intro_menu.asm b/engine/menus/intro_menu.asm index cf1bef554..5849fa0f9 100644 --- a/engine/menus/intro_menu.asm +++ b/engine/menus/intro_menu.asm @@ -9,7 +9,7 @@ Intro_MainMenu: farcall MainMenu jp StartTitleScreen -; unused +IntroMenu_DummyFunction: ; unreferenced ret PrintDayOfWeek: @@ -173,12 +173,13 @@ _ResetWRAM: ld [wRoamMon2MapNumber], a ld [wRoamMon3MapNumber], a - ld a, BANK(sMysteryGiftItem) + ld a, BANK(sMysteryGiftItem) ; aka BANK(sMysteryGiftUnlocked) call OpenSRAM ld hl, sMysteryGiftItem xor a ld [hli], a - dec a + assert sMysteryGiftItem + 1 == sMysteryGiftUnlocked + dec a ; -1 ld [hl], a call CloseSRAM @@ -370,7 +371,7 @@ Continue: ld c, 20 call DelayFrames farcall JumpRoamMons - farcall MysteryGift_CopyReceivedDecosToPC + farcall CopyMysteryGiftReceivedDecorationsToPC farcall ClockContinue ld a, [wSpawnAfterChampion] cp SPAWN_LANCE @@ -464,9 +465,9 @@ FinishContinueFunction: xor a ld [wDontPlayMapMusicOnReload], a ld [wLinkMode], a - ld hl, wGameTimerPause - set GAMETIMERPAUSE_TIMER_PAUSED_F, [hl] - res GAMETIMERPAUSE_MOBILE_7_F, [hl] + ld hl, wGameTimerPaused + set GAME_TIMER_PAUSED_F, [hl] + res GAME_TIMER_MOBILE_F, [hl] ld hl, wEnteredMapFromContinue set 1, [hl] farcall OverworldLoop diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index fcbd7d430..63173ec0c 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -31,8 +31,8 @@ MainMenu: ld b, SCGB_DIPLOMA call GetSGBLayout call SetPalettes - ld hl, wGameTimerPause - res GAMETIMERPAUSE_TIMER_PAUSED_F, [hl] + ld hl, wGameTimerPaused + res GAME_TIMER_PAUSED_F, [hl] call MainMenu_GetWhichMenu ld [wWhichIndexSet], a call MainMenu_PrintCurrentTimeAndDay @@ -206,7 +206,7 @@ MainMenu_GetWhichMenu: ld a, BANK(sNumDailyMysteryGiftPartnerIDs) call OpenSRAM ld a, [sNumDailyMysteryGiftPartnerIDs] - cp -1 + cp -1 ; locked? call CloseSRAM jr nz, .mystery_gift ; This check makes no difference. @@ -316,20 +316,19 @@ MainMenu_PrintCurrentTimeAndDay: call PrintNum ret -.min -; unused +.minString: ; unreferenced db "min.@" .PrintTimeNotSet: hlcoord 1, 14 - ld de, .TimeNotSet + ld de, .TimeNotSetString call PlaceString ret -.TimeNotSet: +.TimeNotSetString: db "TIME NOT SET@" -.MainMenuTimeUnknownText: +.MainMenuTimeUnknownText: ; unreferenced text_far _MainMenuTimeUnknownText text_end diff --git a/engine/menus/menu_2.asm b/engine/menus/menu_2.asm index 64a58a18d..08666bfab 100644 --- a/engine/menus/menu_2.asm +++ b/engine/menus/menu_2.asm @@ -156,18 +156,18 @@ StartMenu_PrintBugContestStatus: set NO_TEXT_SCROLL, [hl] call StartMenu_DrawBugContestStatusBox hlcoord 1, 5 - ld de, .Balls_EN + ld de, .BallsString call PlaceString hlcoord 8, 5 ld de, wParkBallsRemaining lb bc, PRINTNUM_LEFTALIGN | 1, 2 call PrintNum hlcoord 1, 1 - ld de, .CAUGHT + ld de, .CaughtString call PlaceString ld a, [wContestMon] and a - ld de, .None + ld de, .NoneString jr z, .no_contest_mon ld [wNamedObjectIndexBuffer], a call GetPokemonName @@ -179,7 +179,7 @@ StartMenu_PrintBugContestStatus: and a jr z, .skip_level hlcoord 1, 3 - ld de, .LEVEL + ld de, .LevelString call PlaceString ld a, [wContestMonLevel] ld h, b @@ -193,15 +193,15 @@ StartMenu_PrintBugContestStatus: ld [wOptions], a ret -.Balls_JP: +.BallsJPString: ; unreferenced db "ボール   こ@" -.CAUGHT: +.CaughtString: db "CAUGHT@" -.Balls_EN: +.BallsString: db "BALLS:@" -.None: +.NoneString: db "None@" -.LEVEL: +.LevelString: db "LEVEL@" FindApricornsInBag: diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm index f95845b51..0a436b273 100644 --- a/engine/menus/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -275,6 +275,7 @@ NamingScreen_InitText: NamingScreen_ApplyTextInputMode: call NamingScreen_IsTargetBox jr nz, .not_box + assert BoxNameInputLower - NameInputLower == BoxNameInputUpper - NameInputUpper ld hl, BoxNameInputLower - NameInputLower add hl, de ld d, h @@ -880,7 +881,7 @@ INCBIN "gfx/naming_screen/cursor.2bpp" INCLUDE "data/text/name_input_chars.asm" -NamingScreenGFX_End: ; unused +NamingScreenGFX_End: ; unreferenced INCBIN "gfx/naming_screen/end.1bpp" NamingScreenGFX_MiddleLine: @@ -1333,7 +1334,7 @@ MailComposition_TryAddLastCharacter: ld a, [wNamingScreenLastCharacter] jp MailComposition_TryAddCharacter -; unused +.add_dakuten ; unreferenced ld a, [wNamingScreenCurNameLength] and a ret z diff --git a/engine/menus/trainer_card.asm b/engine/menus/trainer_card.asm index 6a7477e14..8dead3429 100644 --- a/engine/menus/trainer_card.asm +++ b/engine/menus/trainer_card.asm @@ -296,7 +296,8 @@ TrainerCard_Page1_PrintDexCaught_GameTime: db "#DEX" next "PLAY TIME@" - db "@" ; unused +.Unused: ; unreferenced + db "@" .Badges: db " BADGES▶@" diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index 701b8c57d..6cdbef709 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -199,7 +199,7 @@ Credits_RequestGFX: xor a ldh [hBGMapMode], a ld a, 8 - ld [wRequested2bpp], a + ld [wRequested2bppSize], a jp Credits_Next Credits_LYOverride: diff --git a/engine/movie/intro.asm b/engine/movie/intro.asm index 1da3576e3..623b92ed4 100644 --- a/engine/movie/intro.asm +++ b/engine/movie/intro.asm @@ -21,7 +21,7 @@ CrystalIntro: call DelayFrame jp .loop -.ShutOffMusic: +.ShutOffMusic ld de, MUSIC_NONE call PlayMusic @@ -152,14 +152,14 @@ IntroScene2: cp $80 jr nc, .endscene cp $60 - jr nz, .DontPlaySound + jr nz, .nosound push af depixel 11, 11 call CrystalIntro_InitUnownAnim ld de, SFX_INTRO_UNOWN_1 call PlaySFX pop af -.DontPlaySound: +.nosound ld [wIntroSceneTimer], a xor a call CrystalIntro_UnownFade @@ -971,7 +971,8 @@ IntroScene20: xor a call Intro_Scene20_AppearUnown ret -; unused + +.AppearUnownPal2: ; unreferenced ld a, c and $1c srl a @@ -981,7 +982,7 @@ IntroScene20: call Intro_Scene20_AppearUnown ret -.finished +.finished: call NextIntroScene ret diff --git a/engine/movie/trade_animation.asm b/engine/movie/trade_animation.asm index 71e438767..0b65ccfc9 100644 --- a/engine/movie/trade_animation.asm +++ b/engine/movie/trade_animation.asm @@ -20,7 +20,7 @@ ENDM TradeAnimation: xor a - ld [wcf66], a + ld [wUnusedTradeAnimPlayEvolutionMusic], a ld hl, wPlayerTrademonSenderName ld de, wOTTrademonSenderName call LinkTradeAnim_LoadTradePlayerNames @@ -71,7 +71,7 @@ TradeAnimation: TradeAnimationPlayer2: xor a - ld [wcf66], a + ld [wUnusedTradeAnimPlayEvolutionMusic], a ld hl, wOTTrademonSenderName ld de, wPlayerTrademonSenderName call LinkTradeAnim_LoadTradePlayerNames @@ -137,7 +137,7 @@ RunTradeAnimScript: push af set NO_TEXT_SCROLL, [hl] call .TradeAnimLayout - ld a, [wcf66] + ld a, [wUnusedTradeAnimPlayEvolutionMusic] and a jr nz, .anim_loop ld de, MUSIC_EVOLUTION @@ -225,7 +225,7 @@ DoTradeAnimation: jr nz, .finished call .DoTradeAnimCommand callfar PlaySpriteAnimations - ld hl, wcf65 + ld hl, wFrameCounter2 inc [hl] call DelayFrame and a @@ -273,8 +273,8 @@ DoTradeAnimation: add_tradeanim TradeAnim_TextboxScrollStart ; 1e add_tradeanim TradeAnim_ScrollOutRight ; 1f add_tradeanim TradeAnim_ScrollOutRight2 ; 20 - add_tradeanim TradeAnim_Wait80 ; 21 - add_tradeanim TradeAnim_Wait40 ; 22 + add_tradeanim TradeAnim_Wait80 ; 21 + add_tradeanim TradeAnim_Wait40 ; 22 add_tradeanim TradeAnim_RockingBall ; 23 add_tradeanim TradeAnim_DropBall ; 24 add_tradeanim TradeAnim_WaitAnim ; 25 @@ -285,9 +285,9 @@ DoTradeAnimation: add_tradeanim TradeAnim_GetTrademonSFX ; 2a add_tradeanim TradeAnim_End ; 2b add_tradeanim TradeAnim_AnimateFrontpic ; 2c - add_tradeanim TradeAnim_Wait96 ; 2d - add_tradeanim TradeAnim_Wait80IfOTEgg ; 2e - add_tradeanim TradeAnim_Wait180IfOTEgg ; 2f + add_tradeanim TradeAnim_Wait96 ; 2d + add_tradeanim TradeAnim_Wait80IfOTEgg ; 2e + add_tradeanim TradeAnim_Wait180IfOTEgg ; 2f TradeAnim_IncrementJumptableIndex: ld hl, wJumptableIndex @@ -1333,7 +1333,7 @@ LinkTradeAnim_LoadTradeMonSpecies: ret TradeAnim_FlashBGPals: - ld a, [wcf65] + ld a, [wFrameCounter2] and $7 ret nz ldh a, [rBGP] diff --git a/engine/movie/unused_title.asm b/engine/movie/unused_title.asm index 615d92d36..4b8845f6f 100644 --- a/engine/movie/unused_title.asm +++ b/engine/movie/unused_title.asm @@ -1,4 +1,4 @@ -UnusedTitleScreen: +UnusedTitleScreen: ; unreferenced call ClearBGPalettes call ClearTilemap call DisableLCD @@ -154,7 +154,7 @@ UnusedTitleFG_OAM: dbsprite 13, 11, 0, 0, $4c, 1 dbsprite 14, 11, 0, 0, $4e, 1 -Function10ed51: +Function10ed51: ; unreferenced call _TitleScreen .loop call JoyTextDelay diff --git a/engine/overworld/decorations.asm b/engine/overworld/decorations.asm index 6c56330ed..6cc86181a 100644 --- a/engine/overworld/decorations.asm +++ b/engine/overworld/decorations.asm @@ -44,7 +44,7 @@ _PlayerDecorationMenu: .MenuData: db STATICMENU_CURSOR | STATICMENU_WRAP ; flags db 0 ; items - dw wd002 + dw wNumOwnedDecoCategories dw PlaceNthMenuStrings dw .pointers @@ -75,7 +75,7 @@ _PlayerDecorationMenu: ld a, 7 call .AppendToStringBuffer2 ld hl, wStringBuffer2 - ld de, wd002 + ld de, wDecoNameBuffer ld bc, ITEM_NAME_LENGTH call CopyBytes ret @@ -133,10 +133,11 @@ _PlayerDecorationMenu: Deco_FillTempWithMinusOne: xor a - ld hl, wd002 + ld hl, wNumOwnedDecoCategories ld [hli], a + assert wNumOwnedDecoCategories + 1 == wOwnedDecoCategories ld a, -1 - ld bc, $10 + ld bc, 16 call ByteFill ret @@ -161,10 +162,11 @@ CheckAllDecorationFlags: ret AppendDecoIndex: - ld hl, wd002 + ld hl, wNumOwnedDecoCategories inc [hl] + assert wNumOwnedDecoCategories + 1 == wOwnedDecoCategories ld e, [hl] - ld d, $0 + ld d, 0 add hl, de ld [hl], a ret @@ -176,7 +178,7 @@ FindOwnedDecosInCategory: pop hl call CheckAllDecorationFlags pop bc - ld a, [wd002] + ld a, [wNumOwnedDecoCategories] and a ret z @@ -335,7 +337,7 @@ DecoExitMenu: ret PopulateDecoCategoryMenu: - ld a, [wd002] + ld a, [wNumOwnedDecoCategories] and a jr z, .empty cp 8 @@ -353,9 +355,10 @@ PopulateDecoCategoryMenu: ret .beyond_eight - ld hl, wd002 + ld hl, wNumOwnedDecoCategories ld e, [hl] dec [hl] + assert wNumOwnedDecoCategories + 1 == wOwnedDecoCategories ld d, 0 add hl, de ld [hl], -1 @@ -395,7 +398,7 @@ PopulateDecoCategoryMenu: .NonscrollingMenuData: db STATICMENU_CURSOR | STATICMENU_WRAP ; flags db 0 ; items - dw wd002 + dw wDecoNameBuffer dw DecorationMenuFunction dw DecorationAttributes @@ -409,10 +412,10 @@ PopulateDecoCategoryMenu: db SCROLLINGMENU_DISPLAY_ARROWS ; flags db 8, 0 ; rows, columns db SCROLLINGMENU_ITEMS_NORMAL ; item format - dbw 0, wd002 ; text pointer + dbw 0, wDecoNameBuffer ; text pointer dba DecorationMenuFunction - dbw 0, 0 - dbw 0, 0 + dbw 0, NULL + dbw 0, NULL GetDecorationData: ld hl, DecorationAttributes @@ -549,7 +552,7 @@ GetDecoName: ld a, e jr .getpokename -.unused +.unused ; unreferenced push de call .getdeconame pop de @@ -939,7 +942,7 @@ GetDecorationID: pop hl ret -SetAllDecorationFlags: +SetAllDecorationFlags: ; unreferenced ld hl, DecorationIDs .loop ld a, [hli] diff --git a/engine/overworld/events.asm b/engine/overworld/events.asm index 218b7efc0..822b9ebf9 100644 --- a/engine/overworld/events.asm +++ b/engine/overworld/events.asm @@ -25,76 +25,76 @@ OverworldLoop:: DisableEvents: xor a - ld [wScriptFlags3], a + ld [wScriptFlags2], a ret EnableEvents:: ld a, $ff - ld [wScriptFlags3], a + ld [wScriptFlags2], a ret -CheckBit5_ScriptFlags3: - ld hl, wScriptFlags3 +CheckBit5_ScriptFlags2: + ld hl, wScriptFlags2 bit 5, [hl] ret -DisableWarpsConnxns: - ld hl, wScriptFlags3 +DisableWarpsConnxns: ; unreferenced + ld hl, wScriptFlags2 res 2, [hl] ret -DisableCoordEvents: - ld hl, wScriptFlags3 +DisableCoordEvents: ; unreferenced + ld hl, wScriptFlags2 res 1, [hl] ret -DisableStepCount: - ld hl, wScriptFlags3 +DisableStepCount: ; unreferenced + ld hl, wScriptFlags2 res 0, [hl] ret -DisableWildEncounters: - ld hl, wScriptFlags3 +DisableWildEncounters: ; unreferenced + ld hl, wScriptFlags2 res 4, [hl] ret -EnableWarpsConnxns: - ld hl, wScriptFlags3 +EnableWarpsConnxns: ; unreferenced + ld hl, wScriptFlags2 set 2, [hl] ret -EnableCoordEvents: - ld hl, wScriptFlags3 +EnableCoordEvents: ; unreferenced + ld hl, wScriptFlags2 set 1, [hl] ret -EnableStepCount: - ld hl, wScriptFlags3 +EnableStepCount: ; unreferenced + ld hl, wScriptFlags2 set 0, [hl] ret EnableWildEncounters: - ld hl, wScriptFlags3 + ld hl, wScriptFlags2 set 4, [hl] ret CheckWarpConnxnScriptFlag: - ld hl, wScriptFlags3 + ld hl, wScriptFlags2 bit 2, [hl] ret CheckCoordEventScriptFlag: - ld hl, wScriptFlags3 + ld hl, wScriptFlags2 bit 1, [hl] ret CheckStepCountScriptFlag: - ld hl, wScriptFlags3 + ld hl, wScriptFlags2 bit 0, [hl] ret CheckWildEncountersScriptFlag: - ld hl, wScriptFlags3 + ld hl, wScriptFlags2 bit 4, [hl] ret @@ -135,7 +135,7 @@ EnterMap: ld [wMapStatus], a ret -UnusedWait30Frames: +UnusedWait30Frames: ; unreferenced ld c, 30 call DelayFrames ret @@ -248,7 +248,7 @@ PlayerEvents: and a ret nz - call Dummy_CheckScriptFlags3Bit5 ; This is a waste of time + call Dummy_CheckScriptFlags2Bit5 ; This is a waste of time call CheckTrainerBattle_GetPlayerEvent jr c, .ok @@ -395,8 +395,8 @@ SetMinTwoStepWildEncounterCooldown: ld [wWildEncounterCooldown], a ret -Dummy_CheckScriptFlags3Bit5: - call CheckBit5_ScriptFlags3 +Dummy_CheckScriptFlags2Bit5: + call CheckBit5_ScriptFlags2 ret z call SetXYCompareFlags ret @@ -480,8 +480,8 @@ CheckTimeEvents: scf ret -.unused - ld a, 8 +.unused ; unreferenced + ld a, $8 ; ??? scf ret @@ -812,7 +812,7 @@ PlayerMovement: CheckMenuOW: xor a ldh [hMenuReturn], a - ldh [hUnusedFFA1], a + ldh [hUnusedByte], a ldh a, [hJoyPressed] bit SELECT_F, a diff --git a/engine/overworld/map_object_action.asm b/engine/overworld/map_object_action.asm index 35de22030..5c68f6b0f 100644 --- a/engine/overworld/map_object_action.asm +++ b/engine/overworld/map_object_action.asm @@ -273,7 +273,8 @@ SetFacingBoulderDust: and 2 ld a, FACING_BOULDER_DUST_1 jr z, .ok - inc a ; FACING_BOULDER_DUST_2 + inc a + assert FACING_BOULDER_DUST_1 + 1 == FACING_BOULDER_DUST_2 .ok ld [hl], a ret diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm index 59b8abf84..f6157ce83 100644 --- a/engine/overworld/map_objects.asm +++ b/engine/overworld/map_objects.asm @@ -2894,20 +2894,20 @@ InitSprites: ldh [hCurSpriteTile], a xor a bit 7, [hl] - jr nz, .skip1 + jr nz, .not_vram1 or VRAM_BANK_1 -.skip1 +.not_vram1 ld hl, OBJECT_FLAGS2 add hl, bc ld e, [hl] bit OBJ_FLAGS2_7, e - jr z, .skip2 + jr z, .not_priority or PRIORITY -.skip2 +.not_priority bit USE_OBP1_F, e - jr z, .skip3 + jr z, .not_obp_num or OBP_NUM -.skip3 +.not_obp_num ld hl, OBJECT_PALETTE add hl, bc ld d, a @@ -2917,9 +2917,9 @@ InitSprites: ld d, a xor a bit OVERHEAD_F, e - jr z, .skip4 + jr z, .not_overhead or PRIORITY -.skip4 +.not_overhead ldh [hCurSpriteOAMFlags], a ld hl, OBJECT_SPRITE_X add hl, bc diff --git a/engine/overworld/map_setup.asm b/engine/overworld/map_setup.asm index 9a96d6700..e70f9ab7b 100644 --- a/engine/overworld/map_setup.asm +++ b/engine/overworld/map_setup.asm @@ -82,7 +82,7 @@ LoadMapObjects: farcall InitializeVisibleSprites ret -; unused +MapSetup_DummyFunction: ; unreferenced ret ResetPlayerObjectAction: diff --git a/engine/overworld/player_movement.asm b/engine/overworld/player_movement.asm index fcf147dd0..4ef04d79b 100644 --- a/engine/overworld/player_movement.asm +++ b/engine/overworld/player_movement.asm @@ -311,7 +311,7 @@ DoPlayerMovement:: scf ret -; unused +.unused ; unreferenced xor a ret diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm index 7e86795fc..d9878269b 100644 --- a/engine/overworld/scripting.asm +++ b/engine/overworld/scripting.asm @@ -458,11 +458,11 @@ Script_verbosegiveitem: ld de, GiveItemScript jp ScriptCall -ret_96f76: +GiveItemScript_DummyFunction: ret GiveItemScript: - callasm ret_96f76 + callasm GiveItemScript_DummyFunction writetext .ReceivedItemText iffalse .Full waitsfx @@ -1703,7 +1703,7 @@ Script_givepokemail: push bc inc hl ld bc, MAIL_MSG_LENGTH - ld de, wd002 + ld de, wMonMailMessageBuffer ld a, [wScriptBank] call FarCopyBytes pop bc @@ -2173,8 +2173,7 @@ Script_warpcheck: farcall EnableEvents ret -Script_enableevents: -; unused +Script_enableevents: ; unreferenced farcall EnableEvents ret @@ -2204,7 +2203,8 @@ Script_writeunusedbytebuffer: ld [wUnusedScriptByteBuffer], a ret - db closetext_command ; unused +UnusedClosetextScript: ; unreferenced + closetext Script_closetext: call _OpenAndCloseMenu_HDMATransferTilemapAndAttrmap @@ -2316,13 +2316,13 @@ Script_endall: ret Script_halloffame: - ld hl, wGameTimerPause - res GAMETIMERPAUSE_TIMER_PAUSED_F, [hl] + ld hl, wGameTimerPaused + res GAME_TIMER_PAUSED_F, [hl] farcall StubbedTrainerRankings_HallOfFame farcall StubbedTrainerRankings_HallOfFame2 farcall HallOfFame - ld hl, wGameTimerPause - set GAMETIMERPAUSE_TIMER_PAUSED_F, [hl] + ld hl, wGameTimerPaused + set GAME_TIMER_PAUSED_F, [hl] jr ReturnFromCredits Script_credits: @@ -2353,7 +2353,7 @@ Script_checksave: ld [wScriptVar], a ret -; unused +Script_checkver_duplicate: ; unreferenced ld a, [.gs_version] ld [wScriptVar], a ret diff --git a/engine/overworld/time.asm b/engine/overworld/time.asm index 86807119d..4299a69ab 100644 --- a/engine/overworld/time.asm +++ b/engine/overworld/time.asm @@ -203,7 +203,7 @@ CheckPokerusTick:: xor a ret -SetUnusedTwoDayTimer: +SetUnusedTwoDayTimer: ; unreferenced ld a, 2 ld hl, wUnusedTwoDayTimer ld [hl], a @@ -220,12 +220,12 @@ CheckUnusedTwoDayTimer: call UpdateTimeRemaining ret -; unused +UnusedSetSwarmFlag: ; unreferenced ld hl, wDailyFlags1 set DAILYFLAGS1_FISH_SWARM_F, [hl] ret -; unused +UnusedCheckSwarmFlag: ; unreferenced and a ld hl, wDailyFlags1 bit DAILYFLAGS1_FISH_SWARM_F, [hl] @@ -272,7 +272,7 @@ DoMysteryGiftIfDayHasPassed: ld hl, wBuffer1 call InitOneDayCountdown call CloseSRAM - farcall Function1050c8 + farcall ResetDailyMysteryGiftLimitIfUnlocked .not_timed_out ld a, BANK(sMysteryGiftTimer) @@ -308,7 +308,7 @@ UpdateTimeRemaining: scf ret -GetSecondsSinceIfLessThan60: +GetSecondsSinceIfLessThan60: ; unreferenced ld a, [wDaysSince] and a jr nz, GetTimeElapsed_ExceedsUnitLimit @@ -330,7 +330,7 @@ GetMinutesSinceIfLessThan60: ld a, [wMinutesSince] ret -GetHoursSinceIfLessThan24: +GetHoursSinceIfLessThan24: ; unreferenced ld a, [wDaysSince] and a jr nz, GetTimeElapsed_ExceedsUnitLimit @@ -349,7 +349,7 @@ CalcDaysSince: xor a jr _CalcDaysSince -CalcHoursDaysSince: +CalcHoursDaysSince: ; unreferenced inc hl xor a jr _CalcHoursDaysSince @@ -423,7 +423,7 @@ CopyDayToHL: ld [hl], a ret -CopyDayHourToHL: +CopyDayHourToHL: ; unreferenced ld a, [wCurDay] ld [hli], a ldh a, [hHours] diff --git a/engine/overworld/warp_connection.asm b/engine/overworld/warp_connection.asm index 866480d5c..0b87de722 100644 --- a/engine/overworld/warp_connection.asm +++ b/engine/overworld/warp_connection.asm @@ -175,7 +175,8 @@ EnterMapWarp: ; MOUNT_MOON_SQUARE and TIN_TOWER_ROOF are outdoor maps within indoor maps. ; Dig and Escape Rope should not take you to them. ld a, [wPrevMapGroup] - cp GROUP_MOUNT_MOON_SQUARE ; aka GROUP_TIN_TOWER_ROOF + cp GROUP_MOUNT_MOON_SQUARE + assert GROUP_MOUNT_MOON_SQUARE == GROUP_TIN_TOWER_ROOF jr nz, .not_mt_moon_or_tin_tower ld a, [wPrevMapNumber] cp MAP_MOUNT_MOON_SQUARE @@ -390,44 +391,42 @@ GetMapScreenCoords:: ld hl, wOverworldMapBlocks ld a, [wXCoord] bit 0, a - jr nz, .increment_then_halve1 + jr nz, .odd_x +; even x srl a - add $1 - jr .resume - -.increment_then_halve1 - add $1 + add 1 + jr .got_block_x +.odd_x + add 1 srl a - -.resume +.got_block_x ld c, a - ld b, $0 + ld b, 0 add hl, bc ld a, [wMapWidth] - add $6 + add MAP_CONNECTION_PADDING_WIDTH * 2 ld c, a - ld b, $0 + ld b, 0 ld a, [wYCoord] bit 0, a - jr nz, .increment_then_halve2 + jr nz, .odd_y +; even y srl a - add $1 - jr .resume2 - -.increment_then_halve2 - add $1 + add 1 + jr .got_block_y +.odd_y + add 1 srl a - -.resume2 +.got_block_y call AddNTimes ld a, l ld [wOverworldMapAnchor], a ld a, h ld [wOverworldMapAnchor + 1], a ld a, [wYCoord] - and $1 + and 1 ld [wMetatileStandingY], a ld a, [wXCoord] - and $1 + and 1 ld [wMetatileStandingX], a ret diff --git a/engine/phone/phone.asm b/engine/phone/phone.asm index 18533678c..5b808cf67 100644 --- a/engine/phone/phone.asm +++ b/engine/phone/phone.asm @@ -437,7 +437,7 @@ Script_SpecialBillCall:: ld e, PHONE_BILL jp LoadCallerScript -LoadElmCallScript: +Script_SpecialElmCall: ; unreferenced callasm .LoadElmScript pause 30 sjump Script_ReceivePhoneCall @@ -720,7 +720,7 @@ PhoneJustTalkToThemText: text_far _PhoneJustTalkToThemText text_end -PhoneThankYouTextScript: +PhoneThankYouTextScript: ; unreferenced writetext PhoneThankYouText end diff --git a/engine/phone/scripts/elm.asm b/engine/phone/scripts/elm.asm index 4760d8505..b8341541d 100644 --- a/engine/phone/scripts/elm.asm +++ b/engine/phone/scripts/elm.asm @@ -95,7 +95,7 @@ ElmPhoneCallerScript: specialphonecall SPECIALCALL_NONE end -.unused +.neat ; unreferenced farwritetext ElmPhoneGotAholdOfSomethingNeatText specialphonecall SPECIALCALL_NONE end diff --git a/engine/phone/scripts/generic_callee.asm b/engine/phone/scripts/generic_callee.asm index f8a5f7394..51bcd4947 100644 --- a/engine/phone/scripts/generic_callee.asm +++ b/engine/phone/scripts/generic_callee.asm @@ -1103,7 +1103,7 @@ PhoneScript_Generic_Male: promptbutton end -.Unknown: +.Unknown: ; unreferenced farwritetext UnknownGenericText promptbutton end diff --git a/engine/phone/scripts/hangups_2.asm b/engine/phone/scripts/hangups_2.asm index aad10df21..197845fa8 100644 --- a/engine/phone/scripts/hangups_2.asm +++ b/engine/phone/scripts/hangups_2.asm @@ -3,7 +3,7 @@ BeverlyComePickUpScript: promptbutton sjump PhoneScript_HangUpText_Female -JoseComePickUpScript: +JoseComePickUpScript: ; unreferenced farwritetext JoseComePickUpText promptbutton sjump PhoneScript_HangUpText_Male diff --git a/engine/pokedex/pokedex.asm b/engine/pokedex/pokedex.asm index 245cbf11f..10cd6ef8d 100644 --- a/engine/pokedex/pokedex.asm +++ b/engine/pokedex/pokedex.asm @@ -91,7 +91,7 @@ InitPokedex: ld [wJumptableIndex], a ld [wPrevDexEntryJumptableIndex], a ld [wPrevDexEntryBackup], a - ld [wcf66], a + ld [wUnusedPokedexByte], a call Pokedex_CheckUnlockedUnownMode @@ -1166,7 +1166,7 @@ Pokedex_DrawDexEntryScreenBG: call Pokedex_PlaceFrontpicTopLeftCorner ret -.Unused: +.Number: ; unreferenced db $5c, $5d, -1 ; No. .Height: db "HT ?", $5e, "??", $5f, -1 ; HT ?'??" @@ -2480,6 +2480,7 @@ Pokedex_LoadUnownFont: ld a, BANK(sScratch) call OpenSRAM ld hl, UnownFont + ; sScratch + $188 was the address of sDecompressBuffer in pokegold ld de, sScratch + $188 ld bc, 39 tiles ld a, BANK(UnownFont) diff --git a/engine/pokegear/pokegear.asm b/engine/pokegear/pokegear.asm index 02fb65fea..ad06ad059 100644 --- a/engine/pokegear/pokegear.asm +++ b/engine/pokegear/pokegear.asm @@ -92,7 +92,7 @@ PokeGear: ld [wJumptableIndex], a ; POKEGEARSTATE_CLOCKINIT ld [wPokegearCard], a ; POKEGEARCARD_CLOCK ld [wPokegearMapRegion], a ; JOHTO_REGION - ld [wcf66], a + ld [wUnusedPokegearByte], a ld [wPokegearPhoneScrollPosition], a ld [wPokegearPhoneCursorPosition], a ld [wPokegearPhoneSelectedPerson], a @@ -1271,7 +1271,7 @@ PokegearPhoneContactSubmenu: dw .Call dw .Cancel -; unused +GetAMPMHours: ; unreferenced ldh a, [hHours] cp 12 jr c, .am @@ -1442,7 +1442,7 @@ UpdateRadioStation: ldh [hBGMapMode], a ret -; unused +LoadPokegearRadioChannelPointer: ; unreferenced ld [wPokegearRadioChannelBank], a ld a, [hli] ld [wPokegearRadioChannelAddr], a @@ -1546,7 +1546,7 @@ RadioChannels: jr z, .johto cp KANTO_LANDMARK jr c, .johto -.kanto +; kanto and a ret @@ -2038,7 +2038,7 @@ _FlyMap: lb bc, BANK(FlyMapLabelBorderGFX), 6 call Request1bpp call FlyMap - call ret_91c8f + call Pokegear_DummyFunction ld b, SCGB_POKEGEAR_PALS call GetSGBLayout call SetPalettes @@ -2243,7 +2243,7 @@ HasVisitedSpawn: INCLUDE "data/maps/flypoints.asm" -ret_91c8f: +Pokegear_DummyFunction: ret FlyMap: @@ -2265,7 +2265,7 @@ FlyMap: ; The first 46 locations are part of Johto. The rest are in Kanto. cp KANTO_LANDMARK jr nc, .KantoFlyMap -.JohtoFlyMap: +; Johto fly map ; Note that .NoKanto should be modified in tandem with this branch push af ld a, JOHTO_FLYPOINT ; first Johto flypoint @@ -2569,7 +2569,7 @@ Pokedex_GetArea: jr z, .johto cp KANTO_LANDMARK jr c, .johto -.kanto +; kanto ld a, [wTownMapCursorLandmark] and a jr z, .clear diff --git a/engine/pokegear/radio.asm b/engine/pokegear/radio.asm index 803a7b036..bc7c3195d 100644 --- a/engine/pokegear/radio.asm +++ b/engine/pokegear/radio.asm @@ -141,7 +141,7 @@ PrintRadioLine: ld [wRadioTextDelay], a ret -ReplacePeriodsWithSpaces: +ReplacePeriodsWithSpaces: ; unreferenced push hl ld b, SCREEN_WIDTH * 2 .loop @@ -149,7 +149,6 @@ ReplacePeriodsWithSpaces: cp "." jr nz, .next ld [hl], " " - .next inc hl dec b @@ -335,6 +334,7 @@ OaksPKMNTalk8: ; so no need for a retry loop call Random maskbits NUM_OAKS_POKEMON_TALK_ADVERBS + assert_power_of_2 NUM_OAKS_POKEMON_TALK_ADVERBS ld e, a ld d, 0 ld hl, .Adverbs @@ -434,6 +434,7 @@ OaksPKMNTalk9: ; so no need for a retry loop call Random maskbits NUM_OAKS_POKEMON_TALK_ADJECTIVES + assert_power_of_2 NUM_OAKS_POKEMON_TALK_ADJECTIVES ld e, a ld d, 0 ld hl, .Adjectives @@ -1131,6 +1132,7 @@ PeoplePlaces5: ; so no need for a retry loop call Random maskbits NUM_PNP_PEOPLE_ADJECTIVES + assert_power_of_2 NUM_PNP_PEOPLE_ADJECTIVES ld e, a ld d, 0 ld hl, .Adjectives @@ -1264,6 +1266,7 @@ PeoplePlaces7: ; so no need for a retry loop call Random maskbits NUM_PNP_PLACES_ADJECTIVES + assert_power_of_2 NUM_PNP_PLACES_ADJECTIVES ld e, a ld d, 0 ld hl, .Adjectives @@ -1779,7 +1782,7 @@ CopyRadioTextToRAM: cp TX_FAR jp z, FarCopyRadioText ld de, wRadioText - ld bc, SCREEN_WIDTH * 2 + ld bc, 2 * SCREEN_WIDTH jp CopyBytes StartRadioStation: diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index ed7856957..2c5145b9f 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -101,7 +101,7 @@ _DepositPKMN: ld [wJumptableIndex], a ret -.go_back +.go_back ; unreferenced ld hl, wJumptableIndex dec [hl] ret @@ -358,7 +358,7 @@ _WithdrawPKMN: ld [wJumptableIndex], a ret -.unused +.go_back ; unreferenced ld hl, wJumptableIndex dec [hl] ret @@ -609,7 +609,7 @@ _MovePKMNWithoutMail: ld [wJumptableIndex], a ret -.unused +.go_back ; unreferenced ld hl, wJumptableIndex dec [hl] ret @@ -782,9 +782,9 @@ BillsPC_InitRAM: call ByteFill xor a ld [wJumptableIndex], a - ld [wcf64], a - ld [wcf65], a - ld [wcf66], a + ld [wUnusedBillsPCData], a + ld [wUnusedBillsPCData+1], a + ld [wUnusedBillsPCData+2], a ld [wBillsPC_CursorPosition], a ld [wBillsPC_ScrollPosition], a ret @@ -1377,20 +1377,20 @@ copy_box_data: MACRO jr z, .done\@ and a jr z, .done\@ - ld [de], a + ld [de], a ; species inc de ld a, [wBillsPC_LoadedBox] - ld [de], a + ld [de], a ; box number inc de - ld a, [wd003] - ld [de], a + ld a, [wBillsPCTempListIndex] + ld [de], a ; list index inc a - ld [wd003], a + ld [wBillsPCTempListIndex], a inc de inc hl - ld a, [wd004] + ld a, [wBillsPCTempBoxCount] inc a - ld [wd004], a + ld [wBillsPCTempBoxCount], a jr .loop\@ .done\@ @@ -1399,7 +1399,7 @@ if \1 endc ld a, -1 ld [de], a - ld a, [wd004] + ld a, [wBillsPCTempBoxCount] inc a ld [wBillsPC_NumMonsInBox], a ENDM @@ -1411,8 +1411,8 @@ CopyBoxmonSpecies: call ByteFill ld de, wBillsPCPokemonList xor a - ld [wd003], a - ld [wd004], a + ld [wBillsPCTempListIndex], a + ld [wBillsPCTempBoxCount], a ld a, [wBillsPC_LoadedBox] and a jr z, .party @@ -2222,7 +2222,7 @@ PCString_ReleasedPKMN: db "Released .@" PCString_Bye: db "Bye,@" PCString_Stored: db "Stored @" PCString_Got: db "Got @" -PCString_Non: db "Non.@" +PCString_Non: db "Non.@" ; unreferenced PCString_BoxFull: db "The BOX is full.@" PCString_PartyFull: db "The party's full!@" PCString_NoReleasingEGGS: db "No releasing EGGS!@" @@ -2268,16 +2268,16 @@ _ChangeBox_MenuHeader: dw .MenuData db 1 ; default option -.MenuData +.MenuData: db SCROLLINGMENU_CALL_FUNCTION3_NO_SWITCH | SCROLLINGMENU_ENABLE_FUNCTION3 ; flags db 4, 0 ; rows, columns db SCROLLINGMENU_ITEMS_NORMAL ; item format - dba .boxes - dba .boxnames + dba .Boxes + dba .PrintBoxNames dba NULL dba BillsPC_PrintBoxCountAndCapacity -.boxes +.Boxes: db NUM_BOXES x = 1 rept NUM_BOXES @@ -2286,7 +2286,7 @@ x = x + 1 endr db -1 -.boxnames +.PrintBoxNames: push de ld a, [wMenuSelection] dec a @@ -2455,7 +2455,7 @@ BillsPC_ChangeBoxSubmenu: .Name: ld b, NAME_BOX - ld de, wd002 + ld de, wBoxNameBuffer farcall NamingScreen call ClearTilemap call LoadStandardFont @@ -2465,17 +2465,17 @@ BillsPC_ChangeBoxSubmenu: call GetBoxName ld e, l ld d, h - ld hl, wd002 + ld hl, wBoxNameBuffer ld c, BOX_NAME_LENGTH - 1 call InitString ld a, [wMenuSelection] dec a call GetBoxName - ld de, wd002 + ld de, wBoxNameBuffer call CopyName2 ret - hlcoord 11, 7 ; unused + hlcoord 11, 7 ; unreferenced .MenuHeader: db MENU_BACKUP_TILES ; flags diff --git a/engine/pokemon/breedmon_level_growth.asm b/engine/pokemon/breedmon_level_growth.asm index c6356dd6e..f64bd6ca0 100644 --- a/engine/pokemon/breedmon_level_growth.asm +++ b/engine/pokemon/breedmon_level_growth.asm @@ -1,5 +1,5 @@ GetBreedMon1LevelGrowth: - ld hl, wBreedMon1Stats + ld hl, wBreedMon1 ld de, wTempMon ld bc, BOXMON_STRUCT_LENGTH call CopyBytes @@ -13,7 +13,7 @@ GetBreedMon1LevelGrowth: ret GetBreedMon2LevelGrowth: - ld hl, wBreedMon2Stats + ld hl, wBreedMon2 ld de, wTempMon ld bc, BOXMON_STRUCT_LENGTH call CopyBytes diff --git a/engine/pokemon/evolve.asm b/engine/pokemon/evolve.asm index 1fbca90d5..3e6c4f969 100644 --- a/engine/pokemon/evolve.asm +++ b/engine/pokemon/evolve.asm @@ -327,7 +327,7 @@ EvolveAfterBattle_MasterLoop: inc hl jp .loop -; unused +.UnusedReturnToMap: ; unreferenced pop hl .ReturnToMap: pop de @@ -512,7 +512,7 @@ FillMoves: ld a, [wEvolutionOldSpecies] and a jr z, .CheckMove - ld a, [wd002] + ld a, [wPrevPartyLevel] cp b jr nc, .GetMove diff --git a/engine/pokemon/mail.asm b/engine/pokemon/mail.asm index acf6626b1..940061461 100644 --- a/engine/pokemon/mail.asm +++ b/engine/pokemon/mail.asm @@ -8,7 +8,7 @@ SendMailToPC: cp MAILBOX_CAPACITY jr nc, .full ld bc, MAIL_STRUCT_LENGTH - ld hl, sMailbox + ld hl, sMailboxes call AddNTimes ld d, h ld e, l @@ -44,7 +44,7 @@ DeleteMailFromPC: call OpenSRAM ld a, b push bc - ld hl, sMailbox + ld hl, sMailboxes ld bc, MAIL_STRUCT_LENGTH call AddNTimes push hl @@ -73,7 +73,7 @@ DeleteMailFromPC: ReadMailMessage: ld a, b - ld hl, sMailbox + ld hl, sMailboxes ld bc, MAIL_STRUCT_LENGTH call AddNTimes ld d, h @@ -87,7 +87,7 @@ MoveMailFromPCToParty: push bc ld a, b ld bc, MAIL_STRUCT_LENGTH - ld hl, sMailbox + ld hl, sMailboxes call AddNTimes push hl ld a, [wCurPartyMon] @@ -206,7 +206,7 @@ GivePokeMail:: call AddNTimes ld d, h ld e, l - ld hl, wd002 + ld hl, wMonMailMessageBuffer ld bc, MAIL_MSG_LENGTH + 1 ld a, BANK(sPartyMail) call OpenSRAM @@ -314,19 +314,19 @@ _PlayerMailBoxMenu: text_end InitMail: -; initialize wMailboxCount and beyond with incrementing values, one per mail -; set z if no mail +; return z if no mail ld a, BANK(sMailboxCount) call OpenSRAM ld a, [sMailboxCount] call CloseSRAM - ld hl, wMailboxCount - ld [hli], a - and a +; initialize wMailboxCount from sMailboxCount + ld hl, wMailboxCount + ld [hli], a ; now hl = wMailboxItems + and a jr z, .done ; if no mail, we're done - ; load values in memory with incrementing values starting at wMailboxCount +; initialize wMailboxItems with incrementing values starting at 1 ld b, a ld a, 1 .loop @@ -334,6 +334,7 @@ InitMail: inc a dec b jr nz, .loop + .done ld [hl], -1 ; terminate diff --git a/engine/pokemon/mail_2.asm b/engine/pokemon/mail_2.asm index b7fc57e8e..934a6bece 100644 --- a/engine/pokemon/mail_2.asm +++ b/engine/pokemon/mail_2.asm @@ -404,7 +404,7 @@ LoadBlueSkyMailGFX: ld de, BlueSkyMailGrassGFX ld c, 1 * LEN_1BPP_TILE call LoadMailGFX_Color3 - ld de, MailDragoniteGFX + ld de, MailDragoniteAndSentretGFX ld c, 23 * LEN_1BPP_TILE call LoadMailGFX_Color3 ld de, MailCloudGFX @@ -767,7 +767,7 @@ Mail_Place14TileAlternatingRow: ld b, 14 / 2 jr Mail_PlaceAlternatingRow -Mail_Place16TileAlternatingRow: +Mail_Place16TileAlternatingRow: ; unreferenced push af ld b, 16 / 2 jr Mail_PlaceAlternatingRow @@ -775,6 +775,7 @@ Mail_Place16TileAlternatingRow: Mail_Place18TileAlternatingRow: push af ld b, 18 / 2 + ; fallthrough Mail_PlaceAlternatingRow: .loop @@ -812,16 +813,16 @@ Mail_PlaceAlternatingColumn: pop af ret -Mail_Draw7TileRow: - ld b, $7 +Mail_Draw7TileRow: ; unreferenced + ld b, 7 jr Mail_DrawRowLoop Mail_Draw13TileRow: - ld b, $d + ld b, 13 jr Mail_DrawRowLoop Mail_Draw16TileRow: - ld b, $10 + ld b, 16 jr Mail_DrawRowLoop Mail_DrawTopBottomBorder: @@ -830,6 +831,7 @@ Mail_DrawTopBottomBorder: Mail_DrawFullWidthBorder: ld b, SCREEN_WIDTH + ; fallthrough Mail_DrawRowLoop: .loop diff --git a/engine/pokemon/move_mon.asm b/engine/pokemon/move_mon.asm index 36d8c4fd3..3fc4dbc73 100644 --- a/engine/pokemon/move_mon.asm +++ b/engine/pokemon/move_mon.asm @@ -780,7 +780,7 @@ RetrieveMonFromDayCareMan: call WaitSFX call GetBreedMon1LevelGrowth ld a, b - ld [wd002], a + ld [wPrevPartyLevel], a ld a, e ld [wCurPartyLevel], a xor a @@ -795,12 +795,12 @@ RetrieveMonFromDayCareLady: call WaitSFX call GetBreedMon2LevelGrowth ld a, b - ld [wd002], a + ld [wPrevPartyLevel], a ld a, e ld [wCurPartyLevel], a ld a, PC_DEPOSIT ld [wPokemonWithdrawDepositParameter], a - jp RetrieveBreedmon + jp RetrieveBreedmon ; pointless RetrieveBreedmon: ld hl, wPartyCount diff --git a/engine/pokemon/party_menu.asm b/engine/pokemon/party_menu.asm index fe470ed96..e318a0430 100644 --- a/engine/pokemon/party_menu.asm +++ b/engine/pokemon/party_menu.asm @@ -758,12 +758,10 @@ TeachWhichPKMNString: MoveToWhereString: db "Move to where?@" -ChooseAFemalePKMNString: -; unused +ChooseAFemalePKMNString: ; unreferenced db "Choose a ♀.@" -ChooseAMalePKMNString: -; unused +ChooseAMalePKMNString: ; unreferenced db "Choose a ♂.@" ToWhichPKMNString: diff --git a/engine/pokemon/stats_screen.asm b/engine/pokemon/stats_screen.asm index a6ad0818e..c9a5fbbe3 100644 --- a/engine/pokemon/stats_screen.asm +++ b/engine/pokemon/stats_screen.asm @@ -33,7 +33,7 @@ StatsScreenInit_gotaddress: push af ld a, [wJumptableIndex] ld b, a - ld a, [wcf64] + ld a, [wStatsScreenFlags] ld c, a push bc @@ -52,7 +52,7 @@ StatsScreenInit_gotaddress: ld a, b ld [wJumptableIndex], a ld a, c - ld [wcf64], a + ld [wStatsScreenFlags], a pop af ld [wBoxAlignment], a pop af @@ -63,11 +63,11 @@ StatsScreenMain: xor a ld [wJumptableIndex], a ; ??? - ld [wcf64], a - ld a, [wcf64] + ld [wStatsScreenFlags], a + ld a, [wStatsScreenFlags] and $ff ^ STAT_PAGE_MASK or PINK_PAGE ; first_page - ld [wcf64], a + ld [wStatsScreenFlags], a .loop ld a, [wJumptableIndex] and $ff ^ (1 << 7) @@ -83,11 +83,11 @@ StatsScreenMobile: xor a ld [wJumptableIndex], a ; ??? - ld [wcf64], a - ld a, [wcf64] + ld [wStatsScreenFlags], a + ld a, [wStatsScreenFlags] and $ff ^ STAT_PAGE_MASK or PINK_PAGE ; first_page - ld [wcf64], a + ld [wStatsScreenFlags], a .loop farcall Mobile_SetOverworldDelay ld a, [wJumptableIndex] @@ -115,7 +115,7 @@ StatsScreenPointerTable: dw StatsScreen_Exit StatsScreen_WaitAnim: - ld hl, wcf64 + ld hl, wStatsScreenFlags bit 6, [hl] jr nz, .try_anim bit 5, [hl] @@ -126,10 +126,10 @@ StatsScreen_WaitAnim: .try_anim farcall SetUpPokeAnim jr nc, .finish - ld hl, wcf64 + ld hl, wStatsScreenFlags res 6, [hl] .finish - ld hl, wcf64 + ld hl, wStatsScreenFlags res 5, [hl] farcall HDMATransferTilemapToWRAMBank3 ret @@ -147,7 +147,7 @@ StatsScreen_Exit: ret MonStatsInit: - ld hl, wcf64 + ld hl, wStatsScreenFlags res 6, [hl] call ClearBGPalettes call ClearTilemap @@ -157,7 +157,7 @@ MonStatsInit: cp EGG jr z, .egg call StatsScreen_InitUpperHalf - ld hl, wcf64 + ld hl, wStatsScreenFlags set 4, [hl] ld h, 4 call StatsScreen_SetJumptableIndex @@ -217,7 +217,7 @@ if DEF(_DEBUG) ld de, .HatchSoonString hlcoord 8, 17 call PlaceString - ld hl, wcf64 + ld hl, wStatsScreenFlags set 5, [hl] pop hl pop de @@ -232,7 +232,7 @@ endc StatsScreen_LoadPage: call StatsScreen_LoadGFX - ld hl, wcf64 + ld hl, wStatsScreenFlags res 4, [hl] ld a, [wJumptableIndex] inc a @@ -314,7 +314,7 @@ StatsScreen_GetJoypad: StatsScreen_JoypadAction: push af - ld a, [wcf64] + ld a, [wStatsScreenFlags] maskbits NUM_STAT_PAGES ld c, a pop af @@ -393,10 +393,10 @@ StatsScreen_JoypadAction: ret .set_page - ld a, [wcf64] + ld a, [wStatsScreenFlags] and $ff ^ STAT_PAGE_MASK or c - ld [wcf64], a + ld [wStatsScreenFlags], a ld h, 4 call StatsScreen_SetJumptableIndex ret @@ -530,7 +530,7 @@ StatsScreen_LoadGFX: call .ClearBox call .PageTilemap call .LoadPals - ld hl, wcf64 + ld hl, wStatsScreenFlags bit 4, [hl] jr nz, .place_frontpic call SetPalettes @@ -541,7 +541,7 @@ StatsScreen_LoadGFX: ret .ClearBox: - ld a, [wcf64] + ld a, [wStatsScreenFlags] maskbits NUM_STAT_PAGES ld c, a call StatsScreen_LoadPageIndicators @@ -551,17 +551,17 @@ StatsScreen_LoadGFX: ret .LoadPals: - ld a, [wcf64] + ld a, [wStatsScreenFlags] maskbits NUM_STAT_PAGES ld c, a farcall LoadStatsScreenPals call DelayFrame - ld hl, wcf64 + ld hl, wStatsScreenFlags set 5, [hl] ret .PageTilemap: - ld a, [wcf64] + ld a, [wStatsScreenFlags] maskbits NUM_STAT_PAGES dec a ld hl, .Jumptable @@ -848,7 +848,7 @@ StatsScreen_PlaceFrontpic: ret .AnimateMon: - ld hl, wcf64 + ld hl, wStatsScreenFlags set 5, [hl] ld a, [wCurPartySpecies] cp UNOWN @@ -890,7 +890,7 @@ StatsScreen_PlaceFrontpic: ld d, $0 ld e, ANIM_MON_MENU predef LoadMonAnimation - ld hl, wcf64 + ld hl, wStatsScreenFlags set 6, [hl] ret @@ -1033,7 +1033,7 @@ endc .picked hlcoord 1, 9 call PlaceString - ld hl, wcf64 + ld hl, wStatsScreenFlags set 5, [hl] call SetPalettes ; pals call DelayFrame @@ -1099,7 +1099,7 @@ StatsScreen_AnimateEgg: hlcoord 0, 0 ld d, $0 predef LoadMonAnimation - ld hl, wcf64 + ld hl, wStatsScreenFlags set 6, [hl] ret diff --git a/engine/pokemon/switchpartymons.asm b/engine/pokemon/switchpartymons.asm index 26aa6e5fa..2c00b34b4 100644 --- a/engine/pokemon/switchpartymons.asm +++ b/engine/pokemon/switchpartymons.asm @@ -65,7 +65,7 @@ _SwitchPartyMons: ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes push hl - ld de, wd002 + ld de, wSwitchMonBuffer ld bc, PARTYMON_STRUCT_LENGTH call CopyBytes ld a, [wBuffer3] @@ -77,14 +77,14 @@ _SwitchPartyMons: ld bc, PARTYMON_STRUCT_LENGTH call CopyBytes pop de - ld hl, wd002 + ld hl, wSwitchMonBuffer ld bc, PARTYMON_STRUCT_LENGTH call CopyBytes ld a, [wBuffer2] ld hl, wPartyMonOT call SkipNames push hl - call .CopyNameTowd002 + call .CopyNameToSwitchMonBuffer ld a, [wBuffer3] ld hl, wPartyMonOT call SkipNames @@ -92,13 +92,13 @@ _SwitchPartyMons: push hl call .CopyName pop de - ld hl, wd002 + ld hl, wSwitchMonBuffer call .CopyName ld hl, wPartyMonNicknames ld a, [wBuffer2] call SkipNames push hl - call .CopyNameTowd002 + call .CopyNameToSwitchMonBuffer ld hl, wPartyMonNicknames ld a, [wBuffer3] call SkipNames @@ -106,14 +106,14 @@ _SwitchPartyMons: push hl call .CopyName pop de - ld hl, wd002 + ld hl, wSwitchMonBuffer call .CopyName ld hl, sPartyMail ld a, [wBuffer2] ld bc, MAIL_STRUCT_LENGTH call AddNTimes push hl - ld de, wd002 + ld de, wSwitchMonBuffer ld bc, MAIL_STRUCT_LENGTH ld a, BANK(sPartyMail) call OpenSRAM @@ -127,7 +127,7 @@ _SwitchPartyMons: ld bc, MAIL_STRUCT_LENGTH call CopyBytes pop de - ld hl, wd002 + ld hl, wSwitchMonBuffer ld bc, MAIL_STRUCT_LENGTH call CopyBytes call CloseSRAM @@ -136,8 +136,8 @@ _SwitchPartyMons: pop hl ret -.CopyNameTowd002: - ld de, wd002 +.CopyNameToSwitchMonBuffer: + ld de, wSwitchMonBuffer .CopyName: ld bc, NAME_LENGTH diff --git a/engine/printer/printer.asm b/engine/printer/printer.asm index fcfd4be39..e8e93bf2d 100644 --- a/engine/printer/printer.asm +++ b/engine/printer/printer.asm @@ -447,9 +447,11 @@ CheckCancelPrint: ret .pressed_b - ld a, [wca80] + ld a, [wUnusedGameboyPrinterSafeCancelFlag] cp $0c jr nz, .cancel + +; wait for printer activity to finish before canceling? .loop ld a, [wPrinterOpcode] and a diff --git a/engine/printer/printer_serial.asm b/engine/printer/printer_serial.asm index 9d0bd907d..f717ad381 100644 --- a/engine/printer/printer_serial.asm +++ b/engine/printer/printer_serial.asm @@ -304,7 +304,7 @@ Printer_ResetData: xor a ld [wPrinterSendByteCounter], a ld [wPrinterSendByteCounter + 1], a - ld hl, wGameboyPrinterRAM + ld hl, wGameboyPrinter2bppSource ld bc, wGameboyPrinter2bppSourceEnd - wGameboyPrinter2bppSource call Printer_ByteFill ret @@ -435,10 +435,10 @@ PrinterDataPacket3: PrinterDataPacket4: db 4, 0, $00, 0 dw 4 -PrinterDataPacket5: ; unused +PrinterDataPacket5: ; unreferenced db 8, 0, $00, 0 dw 8 -PrinterDataPacket6: ; unused +PrinterDataPacket6: ; unreferenced db 15, 0, $00, 0 dw 15 diff --git a/engine/smallflag.asm b/engine/smallflag.asm index 04cbfcc23..316ae6aa6 100644 --- a/engine/smallflag.asm +++ b/engine/smallflag.asm @@ -36,9 +36,9 @@ SmallFarFlagAction: jr z, .set ; 1 = SET_FLAG dec b jr z, .check ; 2 = CHECK_FLAG -; 0 = RESET_FLAG + ; 0 = RESET_FLAG -.reset +; reset ld a, c cpl and [hl] diff --git a/engine/tilesets/tileset_anims.asm b/engine/tilesets/tileset_anims.asm index d59c750a8..8ed05c625 100644 --- a/engine/tilesets/tileset_anims.asm +++ b/engine/tilesets/tileset_anims.asm @@ -305,7 +305,7 @@ ScrollTileRightLeft: jr nz, ScrollTileLeft jr ScrollTileRight -ScrollTileUpDown: +ScrollTileUpDown: ; unreferenced ; Scroll up for 4 ticks, then down for 4 ticks. ld a, [wTileAnimationTimer] inc a @@ -891,7 +891,7 @@ AnimateWaterPalette: cp %100 ; frame 4 jr z, .color2 -.color1 +; color1 ld hl, wBGPals1 palette PAL_BG_WATER color 1 ld a, [hli] ldh [rBGPD], a diff --git a/gfx/font.asm b/gfx/font.asm index e32060db7..51d1ccb2d 100644 --- a/gfx/font.asm +++ b/gfx/font.asm @@ -33,13 +33,13 @@ INCBIN "gfx/battle/expbar.2bpp" TownMapGFX: INCBIN "gfx/pokegear/town_map.2bpp.lz" -UnusedWeekdayKanjiGFX: +UnusedWeekdayKanjiGFX: ; unreferenced INCBIN "gfx/font/unused_weekday_kanji.2bpp" PokegearPhoneIconGFX: INCBIN "gfx/font/phone_icon.2bpp" -UnusedBoldFontGFX: +UnusedBoldFontGFX: ; unreferenced INCBIN "gfx/font/unused_bold_font.1bpp" TextboxSpaceGFX: @@ -49,7 +49,7 @@ INCBIN "gfx/font/space.2bpp" FontsExtra_SolidBlackGFX: INCBIN "gfx/font/black.1bpp" -UnusedUpArrowGFX: +UnusedUpArrowGFX: ; unreferenced INCBIN "gfx/font/unused_up_arrow.1bpp" MobilePhoneTilesGFX: diff --git a/gfx/mail.asm b/gfx/mail.asm index f8b3f2891..fe42eb88c 100644 --- a/gfx/mail.asm +++ b/gfx/mail.asm @@ -55,15 +55,10 @@ INCBIN "gfx/mail/ditto.1bpp" MailMewGFX: INCBIN "gfx/mail/mew.1bpp" -MailDragoniteGFX: +MailDragoniteAndSentretGFX: INCBIN "gfx/mail/dragonite.1bpp" - -MailSentretGFX: INCBIN "gfx/mail/sentret.1bpp" -MailUnusedGrassGFX: -INCBIN "gfx/mail/unused_grass.1bpp" - PortraitMailLargePokeballGFX: INCBIN "gfx/mail/large_pokeball.1bpp" diff --git a/gfx/mail/sentret.png b/gfx/mail/sentret.png index b277a2c9c..0bfff0d61 100644 Binary files a/gfx/mail/sentret.png and b/gfx/mail/sentret.png differ diff --git a/gfx/tileset_palette_maps.asm b/gfx/tileset_palette_maps.asm index bbe1ccad4..b75e27124 100644 --- a/gfx/tileset_palette_maps.asm +++ b/gfx/tileset_palette_maps.asm @@ -90,7 +90,7 @@ INCLUDE "gfx/tilesets/lighthouse_palette_map.asm" TilesetPlayersRoomPalMap: INCLUDE "gfx/tilesets/players_room_palette_map.asm" -UnusedMuseumPalMap: +UnusedMuseumPalMap: ; unreferenced INCLUDE "gfx/tilesets/unused_museum_palette_map.asm" TilesetIcePathPalMap: diff --git a/gfx/trade/mobile_border.pal b/gfx/trade/mobile_border.pal index 93e884046..95a727db3 100644 --- a/gfx/trade/mobile_border.pal +++ b/gfx/trade/mobile_border.pal @@ -1,9 +1,9 @@ - RGB 31, 31, 63 + dw $ffff ; RGB 31, 31, 63 RGB 00, 00, 00 RGB 00, 00, 00 RGB 00, 00, 00 - RGB 31, 31, 63 + dw $ffff ; RGB 31, 31, 63 RGB 00, 00, 00 RGB 00, 00, 00 RGB 00, 00, 00 diff --git a/home/audio.asm b/home/audio.asm index c2d60adb0..7c7b84371 100644 --- a/home/audio.asm +++ b/home/audio.asm @@ -436,7 +436,7 @@ SpecialMapMusic:: and a ret -.bike +.bike ; unreferenced ld de, MUSIC_BICYCLE scf ret diff --git a/home/battle.asm b/home/battle.asm index da9c081a2..0fb077c90 100644 --- a/home/battle.asm +++ b/home/battle.asm @@ -275,6 +275,6 @@ PushLYOverrides:: ld a, HIGH(wLYOverrides) ld [wRequested2bppDest + 1], a - ld a, (wLYOverridesEnd - wLYOverrides) / 16 - ld [wRequested2bpp], a + ld a, (wLYOverridesEnd - wLYOverrides) / LEN_2BPP_TILE + ld [wRequested2bppSize], a ret diff --git a/home/decompress.asm b/home/decompress.asm index 0ac2c0b6b..a072b1e74 100644 --- a/home/decompress.asm +++ b/home/decompress.asm @@ -80,7 +80,6 @@ LZ_LONG_HI EQU %00000011 cp LZ_LONG jr nz, .short -.long ; The count is now 10 bits. ; Read the next 3 bits. @@ -133,7 +132,7 @@ LZ_LONG_HI EQU %00000011 cp LZ_ZERO jr z, .Zero -.Literal: +; Literal ; Read literal data for bc bytes. .lloop dec c @@ -215,10 +214,8 @@ LZ_LONG_HI EQU %00000011 bit 7, a ; sign jr z, .positive -.negative -; hl = de - a - ; Since we can't subtract a from de, - ; Make it negative and add de. +; negative + ; hl = de + -a and %01111111 cpl add e diff --git a/home/game_time.asm b/home/game_time.asm index 7b958c897..5a6732414 100644 --- a/home/game_time.asm +++ b/home/game_time.asm @@ -22,7 +22,7 @@ GameTimer:: ldh [rSVBK], a ret -.Function +.Function: ; Increment the game timer by one frame. ; The game timer is capped at 999:59:59.00. @@ -32,8 +32,8 @@ GameTimer:: ret nz ; Is the timer paused? - ld hl, wGameTimerPause - bit GAMETIMERPAUSE_TIMER_PAUSED_F, [hl] + ld hl, wGameTimerPaused + bit GAME_TIMER_PAUSED_F, [hl] ret z ; Is the timer already capped? diff --git a/home/gfx.asm b/home/gfx.asm index fa5cdd7be..50c2e98b7 100644 --- a/home/gfx.asm +++ b/home/gfx.asm @@ -111,7 +111,7 @@ LoadFontsExtra:: farcall _LoadFontsExtra2 ret -LoadFontsExtra2: +LoadFontsExtra2: ; unreferenced farcall _LoadFontsExtra2 ret @@ -226,10 +226,10 @@ Request2bpp:: cp [hl] jr nc, .cycle - ld [wRequested2bpp], a + ld [wRequested2bppSize], a .wait call DelayFrame - ld a, [wRequested2bpp] + ld a, [wRequested2bppSize] and a jr nz, .wait @@ -245,11 +245,11 @@ Request2bpp:: .cycle ldh a, [hTilesPerCycle] - ld [wRequested2bpp], a + ld [wRequested2bppSize], a .wait2 call DelayFrame - ld a, [wRequested2bpp] + ld a, [wRequested2bppSize] and a jr nz, .wait2 @@ -300,10 +300,10 @@ Request1bpp:: cp [hl] jr nc, .cycle - ld [wRequested1bpp], a + ld [wRequested1bppSize], a .wait call DelayFrame - ld a, [wRequested1bpp] + ld a, [wRequested1bppSize] and a jr nz, .wait @@ -319,11 +319,11 @@ Request1bpp:: .cycle ldh a, [hTilesPerCycle] - ld [wRequested1bpp], a + ld [wRequested1bppSize], a .wait2 call DelayFrame - ld a, [wRequested1bpp] + ld a, [wRequested1bppSize] and a jr nz, .wait2 diff --git a/home/init.asm b/home/init.asm index 76dc28422..683f7f10e 100644 --- a/home/init.asm +++ b/home/init.asm @@ -10,8 +10,8 @@ Reset:: ldh [rIE], a ei - ld hl, wcfbe - set 7, [hl] + ld hl, wJoypadDisable + set JOYPAD_DISABLE_SGB_TRANSFER_F, [hl] ld c, 32 call DelayFrames @@ -50,7 +50,7 @@ Init:: ldh [rOBP1], a ldh [rTMA], a ldh [rTAC], a - ld [wd000], a + ld [wBetaTitleSequenceOpeningType], a ld a, %100 ; Start timer at 4096Hz ldh [rTAC], a diff --git a/home/joypad.asm b/home/joypad.asm index 05868d8b3..8dbe2cc5c 100644 --- a/home/joypad.asm +++ b/home/joypad.asm @@ -27,8 +27,8 @@ UpdateJoypad:: ; hJoypadSum: pressed so far ; Any of these three bits can be used to disable input. - ld a, [wcfbe] - and %11010000 + ld a, [wJoypadDisable] + and (1 << JOYPAD_DISABLE_MON_FAINT_F) | (1 << JOYPAD_DISABLE_SGB_TRANSFER_F) | (1 << 4) ret nz ; If we're saving, input is disabled. diff --git a/home/map.asm b/home/map.asm index 261e044d6..e329f6b6e 100644 --- a/home/map.asm +++ b/home/map.asm @@ -124,12 +124,12 @@ LoadMetatiles:: ld a, [wOverworldMapAnchor + 1] ld d, a ld hl, wSurroundingTiles - ld b, SURROUNDING_HEIGHT / METATILE_WIDTH ; 5 + ld b, SCREEN_META_HEIGHT .row push de push hl - ld c, SURROUNDING_WIDTH / METATILE_WIDTH ; 6 + ld c, SCREEN_META_WIDTH .col push de @@ -195,7 +195,7 @@ endr add hl, de pop de ld a, [wMapWidth] - add 6 + add MAP_CONNECTION_PADDING_WIDTH * 2 add e ld e, a jr nc, .ok2 @@ -2163,7 +2163,8 @@ GetMapEnvironment:: pop hl ret - ret ; unused +Map_DummyFunction:: ; unreferenced + ret GetAnyMapEnvironment:: push hl diff --git a/home/menu.asm b/home/menu.asm index cfa1cd444..abbe45d7a 100644 --- a/home/menu.asm +++ b/home/menu.asm @@ -257,6 +257,7 @@ MenuBoxCoord2Tile:: ld c, a ld a, [wMenuBorderTopCoord] ld b, a + ; fallthrough Coord2Tile:: ; Return the address of wTilemap(c, b) in hl. @@ -330,7 +331,7 @@ MenuTextbox:: pop hl jp PrintText -; unused +Menu_DummyFunction:: ; unreferenced ret LoadMenuTextbox:: @@ -430,12 +431,12 @@ _YesNoBox:: ld hl, YesNoMenuHeader call CopyMenuHeader pop bc -; This seems to be an overflow prevention, but -; it was coded wrong. +; This seems to be an overflow prevention, +; but it was coded wrong. ld a, b - cp SCREEN_WIDTH - 6 + cp SCREEN_WIDTH - 1 - 5 jr nz, .okay ; should this be "jr nc"? - ld a, SCREEN_WIDTH - 6 + ld a, SCREEN_WIDTH - 1 - 5 ld b, a .okay diff --git a/home/movement.asm b/home/movement.asm index f329a3c3e..80d7ed5bf 100644 --- a/home/movement.asm +++ b/home/movement.asm @@ -2,7 +2,7 @@ InitMovementBuffer:: ld [wMovementBufferObject], a xor a ld [wMovementBufferCount], a - ld a, $0 ; useless + ld a, $0 ; was BANK(wMovementBuffer) in G/S ld [wUnusedMovementBufferBank], a ld a, LOW(wMovementBuffer) ld [wUnusedMovementBufferPointer], a diff --git a/home/names.asm b/home/names.asm index e2ce8175c..1add8a888 100644 --- a/home/names.asm +++ b/home/names.asm @@ -56,9 +56,9 @@ GetName:: .done ld a, e - ld [wUnusedD102], a + ld [wUnusedNamesPointer], a ld a, d - ld [wUnusedD102 + 1], a + ld [wUnusedNamesPointer + 1], a pop de pop bc diff --git a/home/print_bcd.asm b/home/print_bcd.asm index 74e2d1619..4182eadfc 100644 --- a/home/print_bcd.asm +++ b/home/print_bcd.asm @@ -33,10 +33,11 @@ PrintBCDNumber:: jr nz, .loop bit PRINTNUM_LEADINGZEROS_F, b jr z, .done ; if so, we are done -.numberEqualsZero ; if every digit of the BCD number is zero +; every digit of the BCD number is zero bit PRINTNUM_LEFTALIGN_F, b jr nz, .skipLeftAlignmentAdjustment - dec hl ; if the string is left-aligned, it needs to be moved back one space +; the string is left-aligned; it needs to be moved back one space + dec hl .skipLeftAlignmentAdjustment bit PRINTNUM_MONEY_F, b jr z, .skipCurrencySymbol @@ -53,7 +54,7 @@ PrintBCDDigit:: and %00001111 and a jr z, .zeroDigit -.nonzeroDigit +; nonzero digit bit PRINTNUM_LEADINGZEROS_F, b ; have any non-space characters been printed? jr z, .outputDigit ; if bit 7 is set, then no numbers have been printed yet diff --git a/home/serial.asm b/home/serial.asm index 6b03649a2..f6e9e7db7 100644 --- a/home/serial.asm +++ b/home/serial.asm @@ -57,13 +57,13 @@ Serial:: xor a ldh [rSB], a + ld a, 3 ldh [rDIV], a - -.wait_bit_7 +.delay_loop ldh a, [rDIV] bit 7, a - jr nz, .wait_bit_7 + jr nz, .delay_loop ld a, (0 << rSC_ON) | (0 << rSC_CLOCK) ldh [rSC], a @@ -89,8 +89,9 @@ Serial:: reti Serial_ExchangeBytes:: - ld a, $1 + ld a, TRUE ldh [hSerialIgnoringInitialData], a + .loop ld a, [hl] ldh [hSerialSend], a @@ -98,10 +99,12 @@ Serial_ExchangeBytes:: push bc ld b, a inc hl - ld a, $30 + + ld a, 48 .wait dec a jr nz, .wait + ldh a, [hSerialIgnoringInitialData] and a ld a, b @@ -124,7 +127,7 @@ Serial_ExchangeBytes:: ret Serial_ExchangeByte:: -.loop +.timeout_loop xor a ldh [hSerialReceivedNewData], a ldh a, [hSerialConnectionStatus] @@ -135,16 +138,16 @@ Serial_ExchangeByte:: ld a, (1 << rSC_ON) | (1 << rSC_CLOCK) ldh [rSC], a .not_player_2 -.loop2 +.loop ldh a, [hSerialReceivedNewData] and a - jr nz, .reset_ffca + jr nz, .await_new_data ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK - jr nz, .not_player_1_or_wLinkTimeoutFrames_zero - call CheckwLinkTimeoutFramesNonzero - jr z, .not_player_1_or_wLinkTimeoutFrames_zero - call .delay_15_cycles + jr nz, .not_player_1_or_timed_out + call CheckLinkTimeoutFramesNonzero + jr z, .not_player_1_or_timed_out + call .ShortDelay push hl ld hl, wLinkTimeoutFrames + 1 inc [hl] @@ -154,51 +157,52 @@ Serial_ExchangeByte:: .no_rollover_up pop hl - call CheckwLinkTimeoutFramesNonzero - jr nz, .loop2 + call CheckLinkTimeoutFramesNonzero + jr nz, .loop jp SerialDisconnected -.not_player_1_or_wLinkTimeoutFrames_zero +.not_player_1_or_timed_out ldh a, [rIE] and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK) cp 1 << SERIAL - jr nz, .loop2 - ld a, [wcf5d] + jr nz, .loop + ld a, [wLinkByteTimeout] dec a - ld [wcf5d], a - jr nz, .loop2 - ld a, [wcf5d + 1] + ld [wLinkByteTimeout], a + jr nz, .loop + ld a, [wLinkByteTimeout + 1] dec a - ld [wcf5d + 1], a - jr nz, .loop2 + ld [wLinkByteTimeout + 1], a + jr nz, .loop ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK - jr z, .reset_ffca + jr z, .await_new_data ld a, 255 -.delay_255_cycles +.long_delay_loop dec a - jr nz, .delay_255_cycles + jr nz, .long_delay_loop -.reset_ffca +.await_new_data xor a ldh [hSerialReceivedNewData], a ldh a, [rIE] and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK) sub 1 << SERIAL - jr nz, .rIE_not_equal_8 + jr nz, .non_serial_interrupts_enabled - ; LOW($5000) - ld [wcf5d], a - ld a, HIGH($5000) - ld [wcf5d + 1], a + ; a == 0 + assert LOW(SERIAL_LINK_BYTE_TIMEOUT) == 0 + ld [wLinkByteTimeout], a + ld a, HIGH(SERIAL_LINK_BYTE_TIMEOUT) + ld [wLinkByteTimeout + 1], a -.rIE_not_equal_8 +.non_serial_interrupts_enabled ldh a, [hSerialReceive] cp SERIAL_NO_DATA_BYTE ret nz - call CheckwLinkTimeoutFramesNonzero - jr z, .linkTimeoutFrames_zero + call CheckLinkTimeoutFramesNonzero + jr z, .timed_out push hl ld hl, wLinkTimeoutFrames + 1 ld a, [hl] @@ -210,10 +214,10 @@ Serial_ExchangeByte:: .no_rollover pop hl - call CheckwLinkTimeoutFramesNonzero + call CheckLinkTimeoutFramesNonzero jr z, SerialDisconnected -.linkTimeoutFrames_zero +.timed_out ldh a, [rIE] and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK) cp 1 << SERIAL @@ -222,16 +226,16 @@ Serial_ExchangeByte:: ld a, [hl] ldh [hSerialSend], a call DelayFrame - jp .loop + jp .timeout_loop -.delay_15_cycles +.ShortDelay: ld a, 15 -.delay_cycles +.short_delay_loop dec a - jr nz, .delay_cycles + jr nz, .short_delay_loop ret -CheckwLinkTimeoutFramesNonzero:: +CheckLinkTimeoutFramesNonzero:: push hl ld hl, wLinkTimeoutFrames ld a, [hli] @@ -239,8 +243,10 @@ CheckwLinkTimeoutFramesNonzero:: pop hl ret +; This sets wLinkTimeoutFrames to $ffff, since +; a is always 0 when it is called. SerialDisconnected:: - dec a ; a is always 0 when this is called + dec a ld [wLinkTimeoutFrames], a ld [wLinkTimeoutFrames + 1], a ret @@ -278,12 +284,10 @@ Serial_PrintWaitingTextAndSyncAndExchangeNybble:: call WaitLinkTransfer jp SafeLoadTempTilemapToTilemap -Serial_SyncAndExchangeNybble:: +Serial_SyncAndExchangeNybble:: ; unreferenced call LoadTilemapToTempTilemap callfar PlaceWaitingText - jp WaitLinkTransfer - -; One "giant" leap for machinekind + jp WaitLinkTransfer ; pointless WaitLinkTransfer:: ld a, $ff @@ -291,7 +295,7 @@ WaitLinkTransfer:: .loop call LinkTransfer call DelayFrame - call CheckwLinkTimeoutFramesNonzero + call CheckLinkTimeoutFramesNonzero jr z, .check push hl ld hl, wLinkTimeoutFrames + 1 diff --git a/home/text.asm b/home/text.asm index d9236a7a7..eb3a58099 100644 --- a/home/text.asm +++ b/home/text.asm @@ -141,12 +141,15 @@ RadioTerminator:: PrintText:: call SetUpTextbox + ; fallthrough + BuenaPrintText:: push hl hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW call ClearBox pop hl + ; fallthrough PrintTextboxText:: bccoord TEXTBOX_INNERX, TEXTBOX_INNERY @@ -163,6 +166,7 @@ SetUpTextbox:: PlaceString:: push hl + ; fallthrough PlaceNextChar:: ld a, [de] @@ -173,7 +177,9 @@ PlaceNextChar:: pop hl ret - pop de ; unused +DummyChar:: ; unreferenced + pop de + ; fallthrough NextChar:: inc de @@ -242,7 +248,7 @@ ENDM dict "゙", .place ; should be .diacritic jr .not_diacritic -.diacritic +.diacritic ; unreferenced ld b, a call Diacritic jp NextChar @@ -250,18 +256,19 @@ ENDM .not_diacritic cp FIRST_REGULAR_TEXT_CHAR jr nc, .place - +; dakuten or handakuten cp "パ" jr nc, .handakuten - -.dakuten +; dakuten cp FIRST_HIRAGANA_DAKUTEN_CHAR jr nc, .hiragana_dakuten +; katakana dakuten add "カ" - "ガ" - jr .katakana_dakuten + jr .place_dakuten + .hiragana_dakuten add "か" - "が" -.katakana_dakuten +.place_dakuten ld b, "゙" ; dakuten call Diacritic jr .place @@ -269,11 +276,13 @@ ENDM .handakuten cp "ぱ" jr nc, .hiragana_handakuten +; katakana handakuten add "ハ" - "パ" - jr .katakana_handakuten + jr .place_handakuten + .hiragana_handakuten add "は" - "ぱ" -.katakana_handakuten +.place_handakuten ld b, "゚" ; handakuten call Diacritic @@ -316,12 +325,13 @@ PlaceKokoWa: print_name PlaceKokoWaText PlaceMoveTargetsName:: ldh a, [hBattleTurn] xor 1 - jr PlaceMoveUsersName.place + jr PlaceBattlersName PlaceMoveUsersName:: ldh a, [hBattleTurn] + ; fallthrough -.place: +PlaceBattlersName: push de and a jr nz, .enemy diff --git a/home/tilemap.asm b/home/tilemap.asm index 6338cd892..8f8d339df 100644 --- a/home/tilemap.asm +++ b/home/tilemap.asm @@ -60,7 +60,7 @@ CGBOnly_CopyTilemapAtOnce:: CopyTilemapAtOnce:: jr _CopyTilemapAtOnce -; unused +CopyAttrmapAndTilemapToWRAMBank3: ; unreferenced farcall HDMATransferAttrmapAndTilemapToWRAMBank3 ret diff --git a/home/video.asm b/home/video.asm index 2e577da7f..96490c3c5 100644 --- a/home/video.asm +++ b/home/video.asm @@ -184,7 +184,7 @@ UpdateBGMap:: THIRD_HEIGHT EQU SCREEN_HEIGHT / 3 -.bottom +; bottom ld de, 2 * THIRD_HEIGHT * SCREEN_WIDTH add hl, de ld sp, hl @@ -267,7 +267,7 @@ endr Serve1bppRequest:: ; Only call during the first fifth of VBlank - ld a, [wRequested1bpp] + ld a, [wRequested1bppSize] and a ret z @@ -278,7 +278,7 @@ Serve1bppRequest:: cp LY_VBLANK + 2 ret nc -; Copy [wRequested1bpp] 1bpp tiles from [wRequested1bppSource] to [wRequested1bppDest] +; Copy [wRequested1bppSize] 1bpp tiles from [wRequested1bppSource] to [wRequested1bppDest] ld [hSPBuffer], sp @@ -296,11 +296,11 @@ Serve1bppRequest:: ld l, a ; # tiles to copy - ld a, [wRequested1bpp] + ld a, [wRequested1bppSize] ld b, a xor a - ld [wRequested1bpp], a + ld [wRequested1bppSize], a .next @@ -345,7 +345,7 @@ endr Serve2bppRequest:: ; Only call during the first fifth of VBlank - ld a, [wRequested2bpp] + ld a, [wRequested2bppSize] and a ret z @@ -358,12 +358,12 @@ Serve2bppRequest:: jr _Serve2bppRequest Serve2bppRequest_VBlank:: - ld a, [wRequested2bpp] + ld a, [wRequested2bppSize] and a ret z _Serve2bppRequest:: -; Copy [wRequested2bpp] 2bpp tiles from [wRequested2bppSource] to [wRequested2bppDest] +; Copy [wRequested2bppSize] 2bpp tiles from [wRequested2bppSource] to [wRequested2bppDest] ld [hSPBuffer], sp @@ -381,11 +381,11 @@ _Serve2bppRequest:: ld l, a ; # tiles to copy - ld a, [wRequested2bpp] + ld a, [wRequested2bppSize] ld b, a xor a - ld [wRequested2bpp], a + ld [wRequested2bppSize], a .next diff --git a/home/window.asm b/home/window.asm index 082ec40fc..fa53b068e 100644 --- a/home/window.asm +++ b/home/window.asm @@ -92,6 +92,6 @@ SafeUpdateSprites:: ldh [hOAMUpdate], a ret -; unused +SetCarryFlag:: ; unreferenced scf ret diff --git a/hram.asm b/hram.asm index c5dd27195..aca62d831 100644 --- a/hram.asm +++ b/hram.asm @@ -31,7 +31,7 @@ hVBlank:: db hMapEntryMethod:: db hMenuReturn:: db -hUnusedFFA1:: db +hUnusedByte:: db hJoypadReleased:: db hJoypadPressed:: db @@ -88,8 +88,14 @@ NEXTU hPrintNumBuffer:: ds 10 NEXTU -; miscellaneous - ds 9 +; Mystery Gift +hMGExchangedByte:: db +hMGExchangedWord:: dw +hMGNumBits:: db +hMGChecksum:: dw + ds 1 +hMGUnusedMsgLength:: db +hMGRole:: db hMGStatusFlags:: db ENDU diff --git a/lib/mobile/main.asm b/lib/mobile/main.asm index ae170d4d1..770cc1c3e 100644 --- a/lib/mobile/main.asm +++ b/lib/mobile/main.asm @@ -6858,7 +6858,7 @@ Function112d33: dec a jp .asm_112e46 -; unused +.asm_112d4c ; unreferenced ret .asm_112d4d diff --git a/macros/code.asm b/macros/code.asm index e393d4951..a5d8c7560 100644 --- a/macros/code.asm +++ b/macros/code.asm @@ -38,6 +38,7 @@ maskbits: MACRO ; maskbits 26 ; cp 26 ; jr nc, .loop + assert 0 < (\1) && (\1) <= $100, "bitmask must be 8-bit" x = 1 rept 8 if x + 1 < (\1) diff --git a/macros/data.asm b/macros/data.asm index a6656af32..3e1177f78 100644 --- a/macros/data.asm +++ b/macros/data.asm @@ -25,6 +25,10 @@ percent EQUS "* $ff / 100" ; e.g. 1 out_of 2 == 50 percent + 1 == $80 out_of EQUS "* $100 /" +assert_power_of_2: MACRO + assert (\1) & ((\1) - 1) == 0, "\1 must be a power of 2" +ENDM + ; Constant data (db, dw, dl) macros dwb: MACRO diff --git a/macros/gfx.asm b/macros/gfx.asm index 2c67cfc8a..b42b1440b 100644 --- a/macros/gfx.asm +++ b/macros/gfx.asm @@ -1,5 +1,13 @@ +assert_valid_rgb: MACRO +rept _NARG + assert 0 <= (\1) && (\1) <= 31, "RGB channel must be 0-31" + shift +endr +ENDM + RGB: MACRO rept _NARG / 3 + assert_valid_rgb \1, \2, \3 dw palred (\1) + palgreen (\2) + palblue (\3) shift 3 endr diff --git a/macros/scripts/audio.asm b/macros/scripts/audio.asm index 2776c293f..127f2d1e3 100644 --- a/macros/scripts/audio.asm +++ b/macros/scripts/audio.asm @@ -1,8 +1,12 @@ channel_count: MACRO + assert 0 < (\1) && (\1) <= NUM_MUSIC_CHANS, \ + "channel_count must be 1-{d:NUM_MUSIC_CHANS}" _num_channels = \1 - 1 ENDM channel: MACRO + assert 0 < (\1) && (\1) <= NUM_CHANNELS, \ + "channel id must be 1-{d:NUM_CHANNELS}" dn (_num_channels << 2), \1 - 1 ; channel id dw \2 ; address _num_channels = 0 @@ -46,6 +50,7 @@ FIRST_MUSIC_CMD EQU const_value const octave_cmd ; $d0 octave: MACRO + assert 0 < (\1) && (\1) < 8, "octave must be 1-8" db octave_cmd | 8 - (\1) ; octave ENDM diff --git a/macros/scripts/battle_anims.asm b/macros/scripts/battle_anims.asm index 123a262ab..a6ebe4310 100644 --- a/macros/scripts/battle_anims.asm +++ b/macros/scripts/battle_anims.asm @@ -1,7 +1,5 @@ anim_wait: MACRO -if \1 >= $d0 - fail "anim_wait argument must be less than $d0." -endc + assert (\1) < $d0, "anim_wait argument must be less than $d0" db \1 ENDM diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm index d9ffd83e1..a30e0c06a 100644 --- a/macros/scripts/maps.asm +++ b/macros/scripts/maps.asm @@ -1,5 +1,7 @@ map_id: MACRO ;\1: map id + assert DEF(GROUP_\1) && DEF(MAP_\1), \ + "Missing 'map_const \1' in constants/map_constants.asm" db GROUP_\1, MAP_\1 ENDM diff --git a/macros/wram.asm b/macros/wram.asm index b7da3df19..1fd5e572f 100644 --- a/macros/wram.asm +++ b/macros/wram.asm @@ -108,7 +108,8 @@ box: MACRO \1MonOT:: ds NAME_LENGTH * MONS_PER_BOX \1MonNicknames:: ds MON_NAME_LENGTH * MONS_PER_BOX \1MonNicknamesEnd:: -\1End:: ds 2 ; padding +\1End:: + ds 2 ; padding ENDM map_connection_struct: MACRO diff --git a/main.asm b/main.asm index e86cdee39..67523b44e 100644 --- a/main.asm +++ b/main.asm @@ -203,7 +203,7 @@ SECTION "bank13", ROMX INCLUDE "engine/tilesets/map_palettes.asm" INCLUDE "gfx/tileset_palette_maps.asm" -INCLUDE "data/collision_permissions.asm" +INCLUDE "data/collision/collision_permissions.asm" INCLUDE "engine/menus/empty_sram.asm" INCLUDE "engine/menus/savemenu_copytilemapatonce.asm" INCLUDE "engine/events/checksave.asm" @@ -262,7 +262,7 @@ INCLUDE "data/pokemon/names.asm" INCLUDE "data/pokemon/unused_pic_banks.asm" UnusedEggPic:: -; Another egg pic. This is shifted up a few pixels. +; The G/S Egg pic. This is shifted up a few pixels. INCBIN "gfx/pokemon/egg/unused_front.2bpp.lz" diff --git a/maps/AzaleaPokecenter1F.asm b/maps/AzaleaPokecenter1F.asm index bdd5e1281..26d6f0a4c 100644 --- a/maps/AzaleaPokecenter1F.asm +++ b/maps/AzaleaPokecenter1F.asm @@ -36,8 +36,7 @@ AzaleaPokecenter1FGentlemanText: line "fainted." done -AzaleaPokecenter1FUnusedText: -; unreferenced +AzaleaPokecenter1FUnusedText: ; unreferenced text "This BILL guy" line "created the system" diff --git a/maps/AzaleaTown.asm b/maps/AzaleaTown.asm index 7e771e86a..85a42b83d 100644 --- a/maps/AzaleaTown.asm +++ b/maps/AzaleaTown.asm @@ -143,8 +143,7 @@ AzaleaTownSlowpokeScript: closetext end -UnusedWoosterScript: -; unused +UnusedWoosterScript: ; unreferenced faceplayer opentext writetext WoosterText diff --git a/maps/BattleTower1F.asm b/maps/BattleTower1F.asm index 014c51cc1..c0396a481 100644 --- a/maps/BattleTower1F.asm +++ b/maps/BattleTower1F.asm @@ -364,7 +364,7 @@ Text_RightThisWayToYourBattleRoom: line "your BATTLE ROOM." done -Text_BattleTowerIntroduction_1: +Text_BattleTowerIntroduction_1: ; unreferenced text "BATTLE TOWER is a" line "facility made for" cont "#MON battles." @@ -473,7 +473,7 @@ Text_PleaseConfirmOnThisMonitor: line "this monitor." done -Text_ThankYou: +Text_ThankYou: ; unreferenced text "Thank you!" para "" @@ -484,7 +484,7 @@ Text_ThanksForVisiting: line "visiting!" done -Text_BeatenAllTheTrainers_Mobile: +Text_BeatenAllTheTrainers_Mobile: ; unreferenced text "Congratulations!" para "You've beaten all" @@ -514,7 +514,7 @@ Text_CongratulationsYouveBeatenAllTheTrainers: para "" done -Text_AskRegisterRecord_Mobile: +Text_AskRegisterRecord_Mobile: ; unreferenced text "Would you like to" line "register your" @@ -539,7 +539,7 @@ Text_YourPackIsStuffedFull: line "and come back." done -Text_YourRegistrationIsComplete: +Text_YourRegistrationIsComplete: ; unreferenced text "Your registration" line "is complete." @@ -582,7 +582,7 @@ Text_CantBeRegistered_PreviousRecordDeleted: cont "deleted. OK?" done -Text_CheckTheLeaderHonorRoll: +Text_CheckTheLeaderHonorRoll: ; unreferenced text "Check the LEADER" line "HONOR ROLL?" done @@ -639,7 +639,7 @@ Text_NextUpOpponentNo: text ". Ready?" done -Text_SaveBeforeConnecting_Mobile: +Text_SaveBeforeConnecting_Mobile: ; unreferenced text "Your session will" line "be SAVED before" @@ -673,7 +673,7 @@ Text_CancelYourBattleRoomChallenge: line "ROOM challenge?" done -Text_RegisterRecordOnFile_Mobile: +Text_RegisterRecordOnFile_Mobile: ; unreferenced text "We have your" line "previous record on" @@ -714,8 +714,8 @@ Text_TooMuchTimeElapsedNoRegister: cont "challenge." done -; a dupe? -Text_RegisterRecordTimedOut_Mobile: +Text_RegisterRecordTimedOut_Mobile: ; unreferenced +; duplicate of Text_TooMuchTimeElapsedNoRegister text "Sorry, but it's" line "not possible to" diff --git a/maps/BattleTowerBattleRoom.asm b/maps/BattleTowerBattleRoom.asm index a62182716..63816a724 100644 --- a/maps/BattleTowerBattleRoom.asm +++ b/maps/BattleTowerBattleRoom.asm @@ -131,7 +131,7 @@ Script_ChallengeCanceled: ; unreferenced closetext end -Text_ReturnedAfterSave_Mobile: +Text_ReturnedAfterSave_Mobile: ; unreferenced text "You'll be returned" line "after you SAVE." done diff --git a/maps/BattleTowerOutside.asm b/maps/BattleTowerOutside.asm index e38ab7c61..b7d70cd5f 100644 --- a/maps/BattleTowerOutside.asm +++ b/maps/BattleTowerOutside.asm @@ -30,8 +30,7 @@ BattleTowerOutsideSailorScript: BattleTowerOutsideSign: jumptext BattleTowerOutsideSignText -BattleTowerOutsideYoungsterText_NotYetOpen: -; unreferenced +BattleTowerOutsideYoungsterText_NotYetOpen: ; unreferenced text "Wow, the BATTLE" line "TOWER is huge! My" @@ -39,8 +38,7 @@ BattleTowerOutsideYoungsterText_NotYetOpen: line "looking up at it." done -BattleTowerOutsideYoungsterText_Mobile: -; unreferenced +BattleTowerOutsideYoungsterText_Mobile: ; unreferenced text "Wow, the BATTLE" line "TOWER is huge!" @@ -63,8 +61,7 @@ BattleTowerOutsideYoungsterText: cont "in there!" done -BattleTowerOutsideBeautyText_NotYetOpen: -; unreferenced +BattleTowerOutsideBeautyText_NotYetOpen: ; unreferenced text "What on earth do" line "they do here?" @@ -86,8 +83,7 @@ BattleTowerOutsideBeautyText: line "battle…" done -BattleTowerOutsideSailorText_Mobile: -; unreferenced +BattleTowerOutsideSailorText_Mobile: ; unreferenced text "Ehehehe…" line "I sneaked out of" cont "work to come here." @@ -108,8 +104,8 @@ BattleTowerOutsideSailorText: line "all. That I must!" done -BattleTowerOutsideSignText_NotYetOpen: -; unused; originally shown when the Battle Tower was closed +BattleTowerOutsideSignText_NotYetOpen: ; unreferenced +; originally shown when the Battle Tower was closed text "BATTLE TOWER" done @@ -120,14 +116,14 @@ BattleTowerOutsideSignText: line "Trainer Challenge!" done -BattleTowerOutsideText_DoorsClosed: -; unused; originally shown when the Battle Tower was closed +BattleTowerOutsideText_DoorsClosed: ; unreferenced +; originally shown when the Battle Tower was closed text "The BATTLE TOWER's" line "doors are closed…" done -BattleTowerOutsideText_DoorsOpen: -; unused; originally shown after the Battle Tower opened +BattleTowerOutsideText_DoorsOpen: ; unreferenced +; originally shown after the Battle Tower opened text "It's open!" done diff --git a/maps/BlackthornDragonSpeechHouse.asm b/maps/BlackthornDragonSpeechHouse.asm index 9c1ed0e0a..8d33c0e51 100644 --- a/maps/BlackthornDragonSpeechHouse.asm +++ b/maps/BlackthornDragonSpeechHouse.asm @@ -18,12 +18,10 @@ BlackthornDragonSpeechHouseDratiniScript: closetext end -; unused -BlackthornDragonSpeechHousePictureBookshelf: +BlackthornDragonSpeechHousePictureBookshelf: ; unreferenced jumpstd PictureBookshelfScript -; unused -BlackthornDragonSpeechHouseMagazineBookshelf: +BlackthornDragonSpeechHouseMagazineBookshelf: ; unreferenced jumpstd MagazineBookshelfScript BlackthornDragonSpeechHouseGrannyText: diff --git a/maps/BurnedTowerB1F.asm b/maps/BurnedTowerB1F.asm index 6f5535bba..c4b14df2c 100644 --- a/maps/BurnedTowerB1F.asm +++ b/maps/BurnedTowerB1F.asm @@ -155,8 +155,7 @@ BurnedTowerSuicuneMovement2: remove_sliding step_end -BurnedTowerUnusedMovement: -; unreferenced +BurnedTowerUnusedMovement: ; unreferenced set_sliding big_step DOWN remove_sliding diff --git a/maps/CeladonCity.asm b/maps/CeladonCity.asm index d2c34878e..9c5a83f31 100644 --- a/maps/CeladonCity.asm +++ b/maps/CeladonCity.asm @@ -164,8 +164,7 @@ CeladonCityTeacher2Text: line "a sales clerk." done -CeladonCityLassText_Mobile: -; unused +CeladonCityLassText_Mobile: ; unreferenced text "I love being" line "surrounded by tall" cont "buildings!" diff --git a/maps/CeladonDeptStore6F.asm b/maps/CeladonDeptStore6F.asm index 27948375b..c37c4e6c8 100644 --- a/maps/CeladonDeptStore6F.asm +++ b/maps/CeladonDeptStore6F.asm @@ -98,8 +98,7 @@ CeladonDeptStore6FVendingMachine: CeladonDeptStore6FDirectory: jumptext CeladonDeptStore6FDirectoryText -; unused -CeladonDeptStore6FElevatorButton: +CeladonDeptStore6FElevatorButton: ; unreferenced jumpstd ElevatorButtonScript CeladonVendingText: diff --git a/maps/CeladonGameCorner.asm b/maps/CeladonGameCorner.asm index e006506bd..37686168c 100644 --- a/maps/CeladonGameCorner.asm +++ b/maps/CeladonGameCorner.asm @@ -141,8 +141,7 @@ CeladonGameCornerSodaCanScript: closetext end -CeladonGameCornerUnusedMovementData: -; unreferenced +CeladonGameCornerUnusedMovementData: ; unreferenced step RIGHT turn_head LEFT step_end diff --git a/maps/CeladonMansion3F.asm b/maps/CeladonMansion3F.asm index 6012e1a75..8c818267e 100644 --- a/maps/CeladonMansion3F.asm +++ b/maps/CeladonMansion3F.asm @@ -57,8 +57,7 @@ GameFreakGraphicArtistScript: closetext end -.CancelPrinting: -; unused +.CancelPrinting: ; unreferenced writetext GameFreakGraphicArtistErrorText waitbutton closetext diff --git a/maps/CherrygroveCity.asm b/maps/CherrygroveCity.asm index bbdb46452..e9c40e77b 100644 --- a/maps/CherrygroveCity.asm +++ b/maps/CherrygroveCity.asm @@ -317,7 +317,7 @@ CherrygroveCity_RivalPushesYouOutOfTheWay: turn_head UP step_end -CherrygroveCity_UnusedMovementData: +CherrygroveCity_UnusedMovementData: ; unreferenced step LEFT turn_head DOWN step_end diff --git a/maps/CianwoodCity.asm b/maps/CianwoodCity.asm index d6d909af6..30c1d3939 100644 --- a/maps/CianwoodCity.asm +++ b/maps/CianwoodCity.asm @@ -118,8 +118,7 @@ CianwoodCityPokefanM: CianwoodCityLass: jumptextfaceplayer CianwoodCityLassText -CianwoodCityUnusedScript: -; unreferenced +CianwoodCityUnusedScript: ; unreferenced jumptextfaceplayer CianwoodCityUnusedText CianwoodCitySign: @@ -266,7 +265,6 @@ CianwoodCityLassText: done CianwoodCityUnusedText: -; unused text "There are several" line "islands between" cont "here and OLIVINE." diff --git a/maps/CianwoodPokecenter1F.asm b/maps/CianwoodPokecenter1F.asm index afe5c6c69..3559c2051 100644 --- a/maps/CianwoodPokecenter1F.asm +++ b/maps/CianwoodPokecenter1F.asm @@ -89,8 +89,7 @@ CianwoodGymGuideWinText: cont "looking at you!" done -CianwoodPokecenter1FUnusedText1: -; unreferenced +CianwoodPokecenter1FUnusedText1: ; unreferenced text "Don't you get the" line "urge to show off" @@ -104,8 +103,7 @@ CianwoodPokecenter1FUnusedText1: line "in VIOLET." done -CianwoodPokecenter1FUnusedText2: -; unreferenced +CianwoodPokecenter1FUnusedText2: ; unreferenced text "I've been battling" line "my pal in VIOLET" diff --git a/maps/DayCare.asm b/maps/DayCare.asm index 45c2e37e8..ca7685046 100644 --- a/maps/DayCare.asm +++ b/maps/DayCare.asm @@ -78,7 +78,7 @@ Text_GrampsLookingForYou: line "for you." done -Text_DayCareManTalksAboutEggTicket: +Text_DayCareManTalksAboutEggTicket: ; unreferenced text "I'm the DAY-CARE" line "MAN." @@ -125,7 +125,7 @@ DayCareManText_GiveOddEgg: line "yours to keep!" done -DayCareText_ComeAgain: +DayCareText_ComeAgain: ; unreferenced text "Come again." done diff --git a/maps/DragonsDenB1F.asm b/maps/DragonsDenB1F.asm index 5daa2bc13..1a228a988 100644 --- a/maps/DragonsDenB1F.asm +++ b/maps/DragonsDenB1F.asm @@ -56,7 +56,7 @@ DragonsDenB1F_ClairScene: giveitem TM_DRAGONBREATH iffalse .BagFull getitemname STRING_BUFFER_3, TM_DRAGONBREATH - writetext NotifyReceiveDragonbreath + writetext Text_ReceivedTM24 playsound SFX_ITEM waitsfx itemnotify @@ -214,7 +214,7 @@ ClairText_GiveDragonbreathDragonDen: line "my apology." done -NotifyReceiveDragonbreath: +Text_ReceivedTM24: text " received" line "TM24." done diff --git a/maps/EarlsPokemonAcademy.asm b/maps/EarlsPokemonAcademy.asm index ab5da0057..07decf533 100644 --- a/maps/EarlsPokemonAcademy.asm +++ b/maps/EarlsPokemonAcademy.asm @@ -138,8 +138,7 @@ AcademyNotebook: closetext end -AcademyStickerMachine: -; unused +AcademyStickerMachine: ; unreferenced jumptext AcademyStickerMachineText AcademyBookshelf: @@ -271,8 +270,7 @@ AcademyBlackboardText: line "battle." done -AcademyBlackboardText2: -; unused +AcademyBlackboardText2: ; unreferenced text "Read which topic?" done diff --git a/maps/EcruteakCity.asm b/maps/EcruteakCity.asm index fec6d0bc3..6964768b6 100644 --- a/maps/EcruteakCity.asm +++ b/maps/EcruteakCity.asm @@ -88,8 +88,7 @@ EcruteakCityMartSign: EcruteakCityHiddenHyperPotion: hiddenitem HYPER_POTION, EVENT_ECRUTEAK_CITY_HIDDEN_HYPER_POTION -UnusedMissingDaughterText: -; unused +UnusedMissingDaughterText: ; unreferenced text "Oh, no. Oh, no…" para "My daughter is" diff --git a/maps/ElmsHouse.asm b/maps/ElmsHouse.asm index 1b2502435..f68c5935a 100644 --- a/maps/ElmsHouse.asm +++ b/maps/ElmsHouse.asm @@ -43,15 +43,13 @@ ElmsSonText: cont "professor!" done -ElmsHouseLabFoodText: -; unused +ElmsHouseLabFoodText: ; unreferenced text "There's some food" line "here. It must be" cont "for the LAB." done -ElmsHousePokemonFoodText: -; unused +ElmsHousePokemonFoodText: ; unreferenced text "There's some food" line "here. This must be" cont "for #MON." diff --git a/maps/ElmsLab.asm b/maps/ElmsLab.asm index 48dfb226c..72978277f 100644 --- a/maps/ElmsLab.asm +++ b/maps/ElmsLab.asm @@ -601,8 +601,7 @@ ElmsLabTrashcan: ElmsLabPC: jumptext ElmsLabPCText -ElmsLabTrashcan2: -; unused +ElmsLabTrashcan2: ; unreferenced jumpstd TrashCanScript ElmsLabBookshelf: @@ -1209,7 +1208,7 @@ ElmGiveTicketText2: line "PROF.OAK in KANTO!" done -ElmsLabSignpostText_Egg: +ElmsLabMonEggText: ; unreferenced text "It's the #MON" line "EGG being studied" cont "by PROF.ELM." diff --git a/maps/GoldenrodBikeShop.asm b/maps/GoldenrodBikeShop.asm index 14121e027..d788589d2 100644 --- a/maps/GoldenrodBikeShop.asm +++ b/maps/GoldenrodBikeShop.asm @@ -39,8 +39,7 @@ GoldenrodBikeShopClerkScript: closetext end -GoldenrodBikeShopJustReleasedCompactBike: -; unused +GoldenrodBikeShopJustReleasedCompactBike: ; unreferenced jumptext GoldenrodBikeShopJustReleasedCompactBikeText GoldenrodBikeShopBicycle: diff --git a/maps/GoldenrodCity.asm b/maps/GoldenrodCity.asm index 70f2d9ecc..42487b29c 100644 --- a/maps/GoldenrodCity.asm +++ b/maps/GoldenrodCity.asm @@ -476,8 +476,7 @@ GoldenrodCityUndergroundSignSouthText: line "ENTRANCE" done -GoldenrodCityPokeComCenterSignText: -; unused +GoldenrodCityPokeComCenterSignText: ; unreferenced text "For Mobile Tips!" line "#COM CENTER" done diff --git a/maps/GoldenrodDeptStore2F.asm b/maps/GoldenrodDeptStore2F.asm index facb495b1..7761ec961 100644 --- a/maps/GoldenrodDeptStore2F.asm +++ b/maps/GoldenrodDeptStore2F.asm @@ -39,8 +39,7 @@ GoldenrodDeptStore2FDirectory: GoldenrodDeptStore2FElevatorButton: jumpstd ElevatorButtonScript -GoldenrodDeptStore2FUnusedText1: -; unused +GoldenrodDeptStore2FUnusedText1: ; unreferenced text "We intend to sell" line "items for #MON" cont "to hold." @@ -50,8 +49,7 @@ GoldenrodDeptStore2FUnusedText1: cont "MON hold it." done -GoldenrodDeptStore2FUnusedText2: -; unused +GoldenrodDeptStore2FUnusedText2: ; unreferenced text "By giving #MON" line "items to hold, I" diff --git a/maps/GoldenrodFlowerShop.asm b/maps/GoldenrodFlowerShop.asm index 0c915e52f..5195107f5 100644 --- a/maps/GoldenrodFlowerShop.asm +++ b/maps/GoldenrodFlowerShop.asm @@ -73,16 +73,13 @@ FlowerShopFloriaScript: closetext end -FlowerShopShelf1: -; unused +FlowerShopShelf1: ; unreferenced jumpstd PictureBookshelfScript -FlowerShopShelf2: -; unused +FlowerShopShelf2: ; unreferenced jumpstd MagazineBookshelfScript -FlowerShopRadio: -; unused +FlowerShopRadio: ; unreferenced jumpstd Radio2Script GoldenrodFlowerShopTeacherMySisterWentToSeeWigglyTreeRoute36Text: diff --git a/maps/GoldenrodPokecenter1F.asm b/maps/GoldenrodPokecenter1F.asm index 8547606b4..0acaa7959 100644 --- a/maps/GoldenrodPokecenter1F.asm +++ b/maps/GoldenrodPokecenter1F.asm @@ -149,8 +149,7 @@ GoldenrodPokeCenter1FLinkReceptionistWalkToStairsFromRightDoorwayTileMovement: step DOWN step_end -; unused -UnknownText_0x61072: +UnknownText_0x61072: ; unreferenced text "Hello! Welcome to" line "#COM CENTER" cont "TRADE CORNER." @@ -160,7 +159,7 @@ UnknownText_0x61072: cont "people far away." done -UnknownText_0x610ce: +UnknownText_0x610ce: ; unreferenced text "To make a trade," line "we must hold your" cont "#MON." @@ -169,13 +168,13 @@ UnknownText_0x610ce: line "trade?" done -UnknownText_0x61111: +UnknownText_0x61111: ; unreferenced text "What kind of" line "#MON do you" cont "want in return?" done -UnknownText_0x6113b: +UnknownText_0x6113b: ; unreferenced text "Fine. We will try" line "to trade your" @@ -195,7 +194,7 @@ UnknownText_0x6113b: cont "room for it." done -UnknownText_0x611c9: +UnknownText_0x611c9: ; unreferenced text "Fine. We will try" line "to trade your" @@ -214,7 +213,7 @@ UnknownText_0x611c9: cont "room for it." done -UnknownText_0x61271: +UnknownText_0x61271: ; unreferenced text "Your trade #MON" line "has been received." @@ -225,7 +224,7 @@ UnknownText_0x61271: line "come back later." done -UnknownText_0x612d8: +UnknownText_0x612d8: ; unreferenced text "Oh? You have only" line "one #MON in" cont "your party. " @@ -236,28 +235,28 @@ UnknownText_0x612d8: cont "of your party." done -UnknownText_0x61344: +UnknownText_0x61344: ; unreferenced text "We hope to see you" line "again." done -UnknownText_0x6135f: +UnknownText_0x6135f: ; unreferenced text "Communication" line "error…" done -UnknownText_0x61375: +UnknownText_0x61375: ; unreferenced text "If we accept that" line "#MON, what will" cont "you battle with?" done -UnknownText_0x613a9: +UnknownText_0x613a9: ; unreferenced text "Sorry. We can't" line "accept an EGG." done -UnknownText_0x613c8: +UnknownText_0x613c8: ; unreferenced text "Sorry, but your" line "#MON appears to" @@ -265,20 +264,20 @@ UnknownText_0x613c8: line "can't accept it." done -UnknownText_0x61409: +UnknownText_0x61409: ; unreferenced text "Oh? Aren't we" line "already holding a" cont "#MON of yours?" done -UnknownText_0x61438: +UnknownText_0x61438: ; unreferenced text "We'll check the" line "rooms." para "Please wait." done -UnknownText_0x6145c: +UnknownText_0x6145c: ; unreferenced text "Thank you for your" line "patience." @@ -286,7 +285,7 @@ UnknownText_0x6145c: line "has been found." done -UnknownText_0x6149a: +UnknownText_0x6149a: ; unreferenced text "It's your new" line "partner." @@ -297,7 +296,7 @@ UnknownText_0x6149a: line "again." done -UnknownText_0x614ed: +UnknownText_0x614ed: ; unreferenced text "Uh-oh. Your party" line "is already full." @@ -306,7 +305,7 @@ UnknownText_0x614ed: cont "in your party." done -UnknownText_0x61544: +UnknownText_0x61544: ; unreferenced text "It's unfortunate," line "but no one has" @@ -317,12 +316,12 @@ UnknownText_0x61544: line "your #MON back?" done -UnknownText_0x615a5: +UnknownText_0x615a5: ; unreferenced text "We have returned" line "your #MON." done -UnknownText_0x615c2: +UnknownText_0x615c2: ; unreferenced text "It's unfortunate," line "but no one has" @@ -339,18 +338,18 @@ UnknownText_0x615c2: line "return it to you." done -UnknownText_0x6166e: +UnknownText_0x6166e: ; unreferenced text "We hope to see you" line "again." done -UnknownText_0x61689: +UnknownText_0x61689: ; unreferenced text "Fine. We will" line "continue to hold" cont "your #MON." done -UnknownText_0x616b4: +UnknownText_0x616b4: ; unreferenced text "Oh? You left your" line "#MON with us" cont "only recently." @@ -359,23 +358,23 @@ UnknownText_0x616b4: line "later." done -UnknownText_0x616fb: +UnknownText_0x616fb: ; unreferenced text "We'll SAVE before" line "connecting to the" cont "CENTER." done -UnknownText_0x61727: +UnknownText_0x61727: ; unreferenced text "Which #MON do" line "you want to trade?" done -UnknownText_0x61749: +UnknownText_0x61749: ; unreferenced text "Sorry, but we must" line "cancel the trade." done -UnknownText_0x6176f: +UnknownText_0x6176f: ; unreferenced text "Oh!" para "I see you have an" @@ -388,7 +387,7 @@ UnknownText_0x6176f: line "special #MON!" done -UnknownText_0x617d2: +UnknownText_0x617d2: ; unreferenced text "Let me give you a" line "quick briefing." @@ -421,12 +420,12 @@ UnknownText_0x617d2: line "chosen room." done -UnknownText_0x6191f: +UnknownText_0x6191f: ; unreferenced text "Please wait a" line "moment." done -UnknownText_0x61936: +UnknownText_0x61936: ; unreferenced text "Thank you for" line "waiting." @@ -439,7 +438,7 @@ UnknownText_0x61936: line "with loving care." done -UnknownText_0x61996: +UnknownText_0x61996: ; unreferenced text "I'm awfully sorry." para "The EGG TICKET" @@ -447,17 +446,17 @@ UnknownText_0x61996: cont "isn't running now." done -UnknownText_0x619db: +UnknownText_0x619db: ; unreferenced text "It's a #MON" line "NEWS MACHINE." done -UnknownText_0x619f5: +UnknownText_0x619f5: ; unreferenced text "What would you" line "like to do?" done -UnknownText_0x61a11: +UnknownText_0x61a11: ; unreferenced text "#MON NEWS is" line "news compiled from" @@ -492,22 +491,22 @@ UnknownText_0x61a11: line "in the NEWS!" done -UnknownText_0x61b7c: +UnknownText_0x61b7c: ; unreferenced text "Would you like to" line "get the NEWS?" done -UnknownText_0x61b9d: +UnknownText_0x61b9d: ; unreferenced text "Reading the latest" line "NEWS… Please wait." done -UnknownText_0x61bc4: +UnknownText_0x61bc4: ; unreferenced text "There is no old" line "NEWS…" done -UnknownText_0x61bdb: +UnknownText_0x61bdb: ; unreferenced text "The NEWS data is" line "corrupted." @@ -515,7 +514,7 @@ UnknownText_0x61bdb: line "the NEWS again." done -UnknownText_0x61c18: +UnknownText_0x61c18: ; unreferenced text "We're making" line "preparations." @@ -523,7 +522,7 @@ UnknownText_0x61c18: line "later." done -UnknownText_0x61c4b: +UnknownText_0x61c4b: ; unreferenced text "We will SAVE your" line "progress before" @@ -531,7 +530,7 @@ UnknownText_0x61c4b: line "MACHINE." done -UnknownText_0x61c89: +UnknownText_0x61c89: ; unreferenced text "Whoa, this #MON" line "CENTER is huge." @@ -542,7 +541,7 @@ UnknownText_0x61c89: line "new machines too." done -UnknownText_0x61cef: +UnknownText_0x61cef: ; unreferenced text "I thought up a fun" line "new thing for the" cont "TRADE CORNER!" @@ -570,7 +569,7 @@ UnknownText_0x61cef: line "friends!" done -UnknownText_0x61dfd: +UnknownText_0x61dfd: ; unreferenced text "They said you can" line "trade #MON with" @@ -581,7 +580,7 @@ UnknownText_0x61dfd: line "adjusting things." done -UnknownText_0x61e5c: +UnknownText_0x61e5c: ; unreferenced text "Some girl I don't" line "know sent me her" @@ -592,7 +591,7 @@ UnknownText_0x61e5c: line "you want." done -UnknownText_0x61eb2: +UnknownText_0x61eb2: ; unreferenced text "I received a" line "female HOPPIP, but" cont "its named STANLEY!" @@ -601,7 +600,7 @@ UnknownText_0x61eb2: line "name!" done -UnknownText_0x61efa: +UnknownText_0x61efa: ; unreferenced text "What is the NEWS" line "MACHINE?" @@ -610,7 +609,7 @@ UnknownText_0x61efa: cont "than the radio?" done -UnknownText_0x61f48: +UnknownText_0x61f48: ; unreferenced text "The #COM CENTER" line "will link with all" @@ -624,7 +623,7 @@ UnknownText_0x61f48: line "sorts of people." done -UnknownText_0x61fc9: +UnknownText_0x61fc9: ; unreferenced text "The machines here" line "can't be used yet." @@ -635,7 +634,7 @@ UnknownText_0x61fc9: line "people." done -UnknownText_0x6202c: +UnknownText_0x6202c: ; unreferenced text "My friend was in" line "the NEWS a while" @@ -643,13 +642,13 @@ UnknownText_0x6202c: line "surprised!" done -UnknownText_0x6206d: +UnknownText_0x6206d: ; unreferenced text "I get anxious if I" line "don't check out" cont "the latest NEWS!" done -UnknownText_0x620a1: +UnknownText_0x620a1: ; unreferenced text "If I get in the" line "NEWS and become" @@ -673,7 +672,7 @@ GoldenrodPokecenter1FGameboyKidText: line "afford to lose." done -UnknownText_0x62173: +UnknownText_0x62173: ; unreferenced text "I came over here" line "when I got word" @@ -691,7 +690,7 @@ UnknownText_0x62173: line "preparations…" done -UnknownText_0x62222: +UnknownText_0x62222: ; unreferenced text "Just seeing all" line "these new things" @@ -732,7 +731,7 @@ GoldenrodPokeCenter1FLinkReceptionistPleaseDoComeAgainText: line "again!" done -UnknownText_0x62370: +UnknownText_0x62370: ; unreferenced text "#COM CENTER" line "1F INFORMATION" @@ -746,7 +745,7 @@ UnknownText_0x62370: line "#MON NEWS" done -UnknownText_0x623c7: +UnknownText_0x623c7: ; unreferenced text "It's a #MON" line "NEWS MACHINE!" diff --git a/maps/GoldenrodUnderground.asm b/maps/GoldenrodUnderground.asm index 9a457e068..d15b52390 100644 --- a/maps/GoldenrodUnderground.asm +++ b/maps/GoldenrodUnderground.asm @@ -58,7 +58,7 @@ GoldenrodUnderground_MapScripts: ifequal FRIDAY, .Friday ifequal SATURDAY, .Saturday -.Sunday: +; Sunday disappear GOLDENRODUNDERGROUND_GRAMPS disappear GOLDENRODUNDERGROUND_OLDER_HAIRCUT_BROTHER appear GOLDENRODUNDERGROUND_YOUNGER_HAIRCUT_BROTHER diff --git a/maps/IlexForest.asm b/maps/IlexForest.asm index d26d18e8a..03a721af3 100644 --- a/maps/IlexForest.asm +++ b/maps/IlexForest.asm @@ -420,8 +420,7 @@ IlexForestHiddenSuperPotion: IlexForestHiddenFullHeal: hiddenitem FULL_HEAL, EVENT_ILEX_FOREST_HIDDEN_FULL_HEAL -IlexForestBoulder: -; unused +IlexForestBoulder: ; unreferenced jumpstd StrengthBoulderScript IlexForestSignpost: diff --git a/maps/LakeOfRageMagikarpHouse.asm b/maps/LakeOfRageMagikarpHouse.asm index efcb8699c..c4d314e1f 100644 --- a/maps/LakeOfRageMagikarpHouse.asm +++ b/maps/LakeOfRageMagikarpHouse.asm @@ -83,8 +83,7 @@ MagikarpLengthRaterScript: closetext end -LakeOfRageMagikarpHouseUnusedRecordSign: -; unused +LakeOfRageMagikarpHouseUnusedRecordSign: ; unreferenced jumptext LakeOfRageMagikarpHouseUnusedRecordText MagikarpHouseBookshelf: @@ -205,7 +204,8 @@ LakeOfRageMagikarpHouseUnusedRecordText: text_ram wStringBuffer4 text_end - text_end ; unused +LakeOfRageMagikarpHouseUnusedDummyText: ; unreferenced + text_end LakeOfRageMagikarpHouse_MapEvents: db 0, 0 ; filler diff --git a/maps/LavRadioTower1F.asm b/maps/LavRadioTower1F.asm index 346ef5768..0ec5efcf9 100644 --- a/maps/LavRadioTower1F.asm +++ b/maps/LavRadioTower1F.asm @@ -72,8 +72,7 @@ LavRadioTower1FDirectory: LavRadioTower1FPokeFluteSign: jumptext LavRadioTower1FPokeFluteSignText -LavRadioTower1FReferenceLibrary: -; unreferenced +LavRadioTower1FReferenceLibrary: ; unreferenced jumptext LavRadioTower1FReferenceLibraryText LavRadioTower1FReceptionistText: diff --git a/maps/LavenderNameRater.asm b/maps/LavenderNameRater.asm index 2809d3152..02bb67ee0 100644 --- a/maps/LavenderNameRater.asm +++ b/maps/LavenderNameRater.asm @@ -18,8 +18,7 @@ LavenderNameRater: closetext end -LavenderNameRaterUnusedBookshelf: -; unused +LavenderNameRaterUnusedBookshelf: ; unreferenced jumpstd DifficultBookshelfScript LavenderNameRater_MapEvents: diff --git a/maps/MahoganyRedGyaradosSpeechHouse.asm b/maps/MahoganyRedGyaradosSpeechHouse.asm index 78ddf6ced..0fdce56c6 100644 --- a/maps/MahoganyRedGyaradosSpeechHouse.asm +++ b/maps/MahoganyRedGyaradosSpeechHouse.asm @@ -26,12 +26,10 @@ MahoganyRedGyaradosSpeechHouseTeacherScript: closetext end -MahoganyRedGyaradosSpeechHouseUnusedBookshelf1: -; unused +MahoganyRedGyaradosSpeechHouseUnusedBookshelf1: ; unreferenced jumpstd PictureBookshelfScript -MahoganyRedGyaradosSpeechHouseUnusedBookshelf2: -; unused +MahoganyRedGyaradosSpeechHouseUnusedBookshelf2: ; unreferenced jumpstd MagazineBookshelfScript MahoganyRedGyaradosSpeechHouseBlackBeltText: diff --git a/maps/ManiasHouse.asm b/maps/ManiasHouse.asm index 7d8cfee43..bb6b97c94 100644 --- a/maps/ManiasHouse.asm +++ b/maps/ManiasHouse.asm @@ -83,7 +83,7 @@ ManiaScript: closetext end -.nothingleft +.nothingleft ; unreferenced writetext ManiaText_ShuckleIsYourLastMon waitbutton closetext @@ -95,8 +95,7 @@ ManiaScript: closetext end -ManiasHouseUnusedBookshelf: -; unused +ManiasHouseUnusedBookshelf: ; unreferenced jumpstd PictureBookshelfScript ManiaText_AskLookAfterShuckle: diff --git a/maps/OaksLab.asm b/maps/OaksLab.asm index 06d2345f5..f6484d868 100644 --- a/maps/OaksLab.asm +++ b/maps/OaksLab.asm @@ -9,7 +9,7 @@ OaksLab_MapScripts: def_callbacks -.DummyScene: +.DummyScene: ; unreferenced end Oak: diff --git a/maps/OlivineCity.asm b/maps/OlivineCity.asm index ad20726f2..ea83e0280 100644 --- a/maps/OlivineCity.asm +++ b/maps/OlivineCity.asm @@ -281,8 +281,8 @@ OlivineCityBattleTowerSignText: line "Opening Now!" done -OlivineCityBattleTowerSignText_NotYetOpen: -; unused; originally shown when the Battle Tower was closed +OlivineCityBattleTowerSignText_NotYetOpen: ; unreferenced +; originally shown when the Battle Tower was closed text "BATTLE TOWER AHEAD" done diff --git a/maps/OlivineGoodRodHouse.asm b/maps/OlivineGoodRodHouse.asm index 8c1289921..fde165b42 100644 --- a/maps/OlivineGoodRodHouse.asm +++ b/maps/OlivineGoodRodHouse.asm @@ -35,8 +35,7 @@ GoodRodGuru: closetext end -GoodRodHouseBookshelf: -; unused +GoodRodHouseBookshelf: ; unreferenced jumpstd PictureBookshelfScript OfferGoodRodText: diff --git a/maps/OlivineGym.asm b/maps/OlivineGym.asm index 27bb61006..2b59ca1c5 100644 --- a/maps/OlivineGym.asm +++ b/maps/OlivineGym.asm @@ -145,7 +145,7 @@ Jasmine_BadgeSpeech: line "this too…" done -Text_ReceivedTM09: +Text_ReceivedTM09: ; unreferenced text " received" line "TM09." done diff --git a/maps/OlivineLighthouse2F.asm b/maps/OlivineLighthouse2F.asm index 0529cb493..6159de99f 100644 --- a/maps/OlivineLighthouse2F.asm +++ b/maps/OlivineLighthouse2F.asm @@ -162,8 +162,7 @@ SailorHueyBeatenText: line "I lose!" done -SailorHueyUnusedText: -; unused +SailorHueyUnusedText: ; unreferenced text "What power!" line "How would you like" diff --git a/maps/OlivineLighthouse6F.asm b/maps/OlivineLighthouse6F.asm index ad99fb999..6f9e43dd3 100644 --- a/maps/OlivineLighthouse6F.asm +++ b/maps/OlivineLighthouse6F.asm @@ -27,7 +27,7 @@ OlivineLighthouseJasmine: .BroughtSecretpotion: writetext JasmineCureAmphyText yesorno - iffalse .no + iffalse .Refused writetext PlayerHandedSecretpotionText promptbutton takeitem SECRETPOTION @@ -84,7 +84,7 @@ OlivineLighthouseJasmine: disappear OLIVINELIGHTHOUSE6F_JASMINE end -.no: +.Refused: writetext JasmineISeeText waitbutton closetext @@ -97,8 +97,7 @@ OlivineLighthouseJasmine: closetext end -OlivineLighthouseUnusedDummyScript: -; unused +.Unused: ; unreferenced end OlivineLighthouseAmphy: diff --git a/maps/PlayersHouse2F.asm b/maps/PlayersHouse2F.asm index 6d87dcdd0..73a9fdc58 100644 --- a/maps/PlayersHouse2F.asm +++ b/maps/PlayersHouse2F.asm @@ -11,8 +11,7 @@ PlayersHouse2F_MapScripts: callback MAPCALLBACK_NEWMAP, .InitializeRoom callback MAPCALLBACK_TILES, .SetUpTileDecorations -; unused -.Null: +.DummyScene: ; unreferenced end .InitializeRoom: diff --git a/maps/Pokecenter2F.asm b/maps/Pokecenter2F.asm index 744691971..97a396a3e 100644 --- a/maps/Pokecenter2F.asm +++ b/maps/Pokecenter2F.asm @@ -97,7 +97,7 @@ LinkReceptionistScript_Trade: iffalse .LinkedToFirstGen special CheckBothSelectedSameRoom iffalse .IncompatibleRooms - writetext Text_PleaseComeIn2 + writetext Text_PleaseComeIn waitbutton closetext scall Pokecenter2F_CheckGender @@ -152,7 +152,7 @@ LinkReceptionistScript_Trade: special TryQuickSave iffalse .Mobile_DidNotSave special Function1011f1 - writetext Text_PleaseComeIn2 + writetext Text_PleaseComeIn waitbutton closetext setval FALSE @@ -199,7 +199,7 @@ LinkReceptionistScript_Battle: iffalse .LinkedToFirstGen special CheckBothSelectedSameRoom iffalse .IncompatibleRooms - writetext Text_PleaseComeIn2 + writetext Text_PleaseComeIn waitbutton closetext scall Pokecenter2F_CheckGender @@ -256,7 +256,7 @@ LinkReceptionistScript_Battle: special Function103780 iffalse .Mobile_DidNotSave special Function1011f1 - writetext Text_PleaseComeIn2 + writetext Text_PleaseComeIn waitbutton closetext setval FALSE @@ -332,7 +332,7 @@ LinkReceptionistScript_TimeCapsule: .OK: special EnterTimeCapsule - writetext Text_PleaseComeIn2 + writetext Text_PleaseComeIn waitbutton closetext scall TimeCapsuleScript_CheckPlayerGender @@ -813,7 +813,7 @@ Text_TradeReceptionistMobile: line "mobile phone?" done -Text_ThisWayToMobileRoom: +Text_ThisWayToMobileRoom: ; unreferenced text "This way to the" line "MOBILE ROOM." done @@ -882,11 +882,11 @@ Text_PleaseComeAgain: text "Please come again." prompt -Text_PleaseComeIn: +Text_PleaseComeInDuplicate: ; unreferenced text "Please come in." prompt -Text_TemporaryStagingInLinkRoom: +Text_TemporaryStagingInLinkRoom: ; unreferenced text "We'll put you in" line "the link room for" cont "the time being." @@ -902,11 +902,11 @@ Text_IncompatibleRooms: line "were chosen." prompt -Text_PleaseComeIn2: +Text_PleaseComeIn: text "Please come in." done -Text_PleaseEnter: +Text_PleaseEnter: ; unreferenced text "Please enter." prompt diff --git a/maps/RadioTower2F.asm b/maps/RadioTower2F.asm index bf963d13b..1268f5451 100644 --- a/maps/RadioTower2F.asm +++ b/maps/RadioTower2F.asm @@ -16,8 +16,7 @@ RadioTower2F_MapScripts: def_callbacks -RadioTower2FUnusedDummyScene: -; unused +RadioTower2FUnusedDummyScene: ; unreferenced end RadioTower2FSuperNerdScript: diff --git a/maps/Route12SuperRodHouse.asm b/maps/Route12SuperRodHouse.asm index cef05c182..10cb41cef 100644 --- a/maps/Route12SuperRodHouse.asm +++ b/maps/Route12SuperRodHouse.asm @@ -32,8 +32,7 @@ Route12SuperRodHouseFishingGuruScript: closetext end -SuperRodHouseBookshelf: -; unused +SuperRodHouseBookshelf: ; unreferenced jumpstd PictureBookshelfScript OfferSuperRodText: diff --git a/maps/Route25.asm b/maps/Route25.asm index a20cb3f21..4ddb215f1 100644 --- a/maps/Route25.asm +++ b/maps/Route25.asm @@ -423,7 +423,7 @@ BillsHouseSignText: line "BILL'S HOUSE" done -; unused +UnusedBillsHouseSignText: ; unreferenced text "BILL'S HOUSE" done diff --git a/maps/Route29.asm b/maps/Route29.asm index 4b8d6bb1c..fa8e3ff15 100644 --- a/maps/Route29.asm +++ b/maps/Route29.asm @@ -322,8 +322,7 @@ Route29FisherText: line "progress." done -; unused -Text_WaitingForDay: +Text_WaitingForDay: ; unreferenced text "I'm waiting for" line "#MON that" diff --git a/maps/Route2NuggetHouse.asm b/maps/Route2NuggetHouse.asm index 147d72d69..93e8fbeb0 100644 --- a/maps/Route2NuggetHouse.asm +++ b/maps/Route2NuggetHouse.asm @@ -23,8 +23,7 @@ Route2NuggetHouseFisherScript: closetext end -Route2NuggetHouseBookshelf: -; unused +Route2NuggetHouseBookshelf: ; unreferenced jumpstd DifficultBookshelfScript Route2NuggetHouseFisherText: diff --git a/maps/Route32.asm b/maps/Route32.asm index 2caaf96d5..6e90ff1c3 100644 --- a/maps/Route32.asm +++ b/maps/Route32.asm @@ -542,7 +542,6 @@ Route32CooltrainerMText_AideIsWaiting: done Route32CooltrainerMText_UnusedSproutTower: -; unused text "Have you gone to" line "SPROUT TOWER?" @@ -679,9 +678,7 @@ FisherRalphSwarmText: line "as you can, kid!" done -; --- start a segment of unused text - -Route32UnusedFisher1SeenText: +Route32UnusedFisher1SeenText: ; unreferenced text "I keep catching" line "the same #MON…" @@ -690,29 +687,29 @@ Route32UnusedFisher1SeenText: cont "around for me." done -Route32UnusedFisher1BeatenText: +Route32UnusedFisher1BeatenText: ; unreferenced text "Nothing ever goes" line "right for me now…" done -Route32UnusedFisher1AfterText: +Route32UnusedFisher1AfterText: ; unreferenced text "How come the guy" line "next to me catches" cont "good #MON?" done -Route32UnusedFisher2SeenText: +Route32UnusedFisher2SeenText: ; unreferenced text "Heh, I'm on a roll" line "today. How about a" cont "battle, kid?" done -Route32UnusedFisher2BeatenText: +Route32UnusedFisher2BeatenText: ; unreferenced text "Oof. I wasn't" line "lucky that time." done -Route32UnusedFisher2AfterText: +Route32UnusedFisher2AfterText: ; unreferenced text "You have to have a" line "good ROD if you" @@ -720,8 +717,6 @@ Route32UnusedFisher2AfterText: line "#MON." done -; --- end a segment of unused texts - FisherHenrySeenText: text "My #MON?" line "Freshly caught!" @@ -835,8 +830,7 @@ BirdKeeperPeterAfterText: cont "in VIOLET CITY." done -Route32UnusedText: -; unused +Route32UnusedText: ; unreferenced text "The fishermen" line "yelled at me for" cont "bugging them…" diff --git a/maps/Route34.asm b/maps/Route34.asm index a688bbb49..a4f1155fd 100644 --- a/maps/Route34.asm +++ b/maps/Route34.asm @@ -470,8 +470,7 @@ TrainerCooltrainerfKate: closetext end -Route34IlexForestSign: -; unused +Route34IlexForestSign: ; unreferenced jumptext Route34IlexForestSignText Route34Sign: @@ -516,7 +515,7 @@ YoungsterSamuelBeatenText: line "passing stranger!" done -YoungsterSamuelMobileText: +YoungsterSamuelMobileText: ; unreferenced text "Have you been to" line "GOLDENROD CITY?" @@ -726,7 +725,6 @@ CooltrainerfKateAfterText: done Route34IlexForestSignText: -; unused text "ILEX FOREST" line "THROUGH THE GATE" done diff --git a/maps/Route36.asm b/maps/Route36.asm index 9ad2c83f4..f7842c58e 100644 --- a/maps/Route36.asm +++ b/maps/Route36.asm @@ -489,7 +489,7 @@ RockSmashGuyText2: cont "have this." done -UnusedReceivedTM08Text: +Text_ReceivedTM08: ; unreferenced text " received" line "TM08." done @@ -509,7 +509,7 @@ RockSmashGuyText3: cont "smash 'em up!" done -UnusedOddTreeText: +UnusedOddTreeText: ; unreferenced text "An odd tree is" line "blocking the way" cont "to GOLDENROD CITY." diff --git a/maps/Route36NationalParkGate.asm b/maps/Route36NationalParkGate.asm index c0fd51773..1a2664e13 100644 --- a/maps/Route36NationalParkGate.asm +++ b/maps/Route36NationalParkGate.asm @@ -463,7 +463,7 @@ BugCatchingContestant10BScript: closetext end -UnusedBugCatchingContestExplanationSign: +UnusedBugCatchingContestExplanationSign: ; unreferenced ; duplicate of BugCatchingContestExplanationSign in Route35NationalParkGate.asm jumptext UnusedBugCatchingContestExplanationText @@ -795,10 +795,9 @@ BugCatchingContestant10BStillCompetingText: line "win." done -UnusedSudowoodoText: -; This text is unused and unreferenced in the final game. -; The tree Pokémon is Sudowoodo. -; The Silph Scope 2 was later reworked into the Squirtbottle. +UnusedSilphScope2Text: ; unreferenced +; This text is referring to Sudowoodo. +; The SILPHSCOPE2 was later reworked into the SQUIRTBOTTLE. text "I hear there's a" line "#MON that looks" cont "just like a tree." diff --git a/maps/Route39Farmhouse.asm b/maps/Route39Farmhouse.asm index 29f08d911..8ea55dbf4 100644 --- a/maps/Route39Farmhouse.asm +++ b/maps/Route39Farmhouse.asm @@ -172,7 +172,7 @@ FarmerFText_HealedMiltank: line "fer your trouble." done -Text_ReceivedTM13: +Text_ReceivedTM13: ; unreferenced text " received" line "TM13." done diff --git a/maps/Route40BattleTowerGate.asm b/maps/Route40BattleTowerGate.asm index b2da1a5eb..71d3d393f 100644 --- a/maps/Route40BattleTowerGate.asm +++ b/maps/Route40BattleTowerGate.asm @@ -18,7 +18,7 @@ Route40BattleTowerGateRockerScript: Route40BattleTowerGateTwinScript: jumptextfaceplayer Route40BattleTowerGateTwinText -UnknownText_0x9f66f: +Route40BattleTowerGateUnusedText1: ; unreferenced text "Did you come to" line "see the BATTLE" cont "TOWER too?" @@ -27,7 +27,7 @@ UnknownText_0x9f66f: line "can't go in yet." done -UnknownText_0x9f6ba: +Route40BattleTowerGateUnusedText2: ; unreferenced text "BATTLE TOWER has" line "opened." @@ -49,7 +49,7 @@ Route40BattleTowerGateRockerText: line "win special gifts." done -UnknownText_0x9f783: +Route40BattleTowerGateUnusedText3: ; unreferenced text "I'm going to train" line "my #MON so I'll" diff --git a/maps/Route41.asm b/maps/Route41.asm index 8272b93a6..1c446ad16 100644 --- a/maps/Route41.asm +++ b/maps/Route41.asm @@ -125,8 +125,7 @@ TrainerSwimmermMathew: closetext end -Route41Rock: -; unused +Route41Rock: ; unreferenced jumpstd SmashRockScript Route41HiddenMaxEther: diff --git a/maps/Route43Gate.asm b/maps/Route43Gate.asm index 7645fdcc4..5301d952e 100644 --- a/maps/Route43Gate.asm +++ b/maps/Route43Gate.asm @@ -234,7 +234,7 @@ OfficerText_FoundTM: cont "you take it away?" done -Text_ReceivedTM30: +Text_ReceivedTM30: ; unreferenced text " received" line "TM30." done diff --git a/maps/Route45.asm b/maps/Route45.asm index 827758ede..cf24706ac 100644 --- a/maps/Route45.asm +++ b/maps/Route45.asm @@ -285,7 +285,7 @@ TrainerCamperQuentin: closetext end -Route45DummyScript: +Route45DummyScript: ; unreferenced writetext Route45DummyText waitbutton closetext diff --git a/maps/RuinsOfAlphAerodactylChamber.asm b/maps/RuinsOfAlphAerodactylChamber.asm index ae75c199f..3012ae023 100644 --- a/maps/RuinsOfAlphAerodactylChamber.asm +++ b/maps/RuinsOfAlphAerodactylChamber.asm @@ -112,8 +112,7 @@ RuinsOfAlphAerodactylChamberWallPatternLeftText: line "on the walls…" done -RuinsOfAlphAerodactylChamberUnownText: -; unused +RuinsOfAlphAerodactylChamberUnownText: ; unreferenced text "It's UNOWN text!" done diff --git a/maps/RuinsOfAlphHoOhChamber.asm b/maps/RuinsOfAlphHoOhChamber.asm index 78ae152cf..e106f0b4d 100644 --- a/maps/RuinsOfAlphHoOhChamber.asm +++ b/maps/RuinsOfAlphHoOhChamber.asm @@ -113,8 +113,7 @@ RuinsOfAlphHoOhChamberWallPatternLeftText: line "on the walls…" done -RuinsOfAlphHoOhChamberUnownText: -; unused +RuinsOfAlphHoOhChamberUnownText: ; unreferenced text "It's UNOWN text!" done diff --git a/maps/RuinsOfAlphKabutoChamber.asm b/maps/RuinsOfAlphKabutoChamber.asm index 8e29a90ae..607b8ed45 100644 --- a/maps/RuinsOfAlphKabutoChamber.asm +++ b/maps/RuinsOfAlphKabutoChamber.asm @@ -200,8 +200,7 @@ RuinsOfAlphKabutoChamberScientistTremorText: cont "this wall here…" done -RuinsOfAlphKabutoChamberUnusedText: -; unused +RuinsOfAlphKabutoChamberUnusedText: ; unreferenced text "The patterns on" line "the wall appear to" cont "be words!" @@ -224,8 +223,7 @@ RuinsOfAlphKabutoChamberWallPatternLeftText: line "on the walls…" done -RuinsOfAlphKabutoChamberUnownText: -; unused +RuinsOfAlphKabutoChamberUnownText: ; unreferenced text "It's UNOWN text!" done diff --git a/maps/RuinsOfAlphOmanyteChamber.asm b/maps/RuinsOfAlphOmanyteChamber.asm index 4b7872912..3f80c72b2 100644 --- a/maps/RuinsOfAlphOmanyteChamber.asm +++ b/maps/RuinsOfAlphOmanyteChamber.asm @@ -113,8 +113,7 @@ RuinsOfAlphOmanyteChamberWallPatternLeftText: line "on the walls…" done -RuinsOfAlphOmanyteChamberUnownText: -; unused +RuinsOfAlphOmanyteChamberUnownText: ; unreferenced text "It's UNOWN text!" done diff --git a/maps/RuinsOfAlphOutside.asm b/maps/RuinsOfAlphOutside.asm index 02c75fe4b..c229b6d92 100644 --- a/maps/RuinsOfAlphOutside.asm +++ b/maps/RuinsOfAlphOutside.asm @@ -110,7 +110,7 @@ TrainerPsychicNathan: closetext end -TrainerSuperNerdStan: +TrainerSuperNerdStan: ; unreferenced trainer SUPER_NERD, STAN, EVENT_BEAT_SUPER_NERD_STAN, SuperNerdStanSeenText, SuperNerdStanBeatenText, 0, .Script .Script: diff --git a/maps/RuinsOfAlphResearchCenter.asm b/maps/RuinsOfAlphResearchCenter.asm index f7506822d..7fc33ab52 100644 --- a/maps/RuinsOfAlphResearchCenter.asm +++ b/maps/RuinsOfAlphResearchCenter.asm @@ -167,8 +167,7 @@ RuinsOfAlphResearchCenterPrinter: closetext end -RuinsOfAlphResearchCenterPhoto: -; unreferenced +RuinsOfAlphResearchCenterPhoto: ; unreferenced jumptext RuinsOfAlphResearchCenterProfSilktreePhotoText RuinsOfAlphResearchCenterBookshelf: @@ -307,8 +306,7 @@ RuinsOfAlphResearchCenterScientist2Text_UnownAppeared: cont "kinds of them…" done -RuinsOfAlphResearchCenterUnusedText1: -; unused +RuinsOfAlphResearchCenterUnusedText1: ; unreferenced text "We think something" line "caused the cryptic" @@ -319,8 +317,7 @@ RuinsOfAlphResearchCenterUnusedText1: line "studies on that." done -RuinsOfAlphResearchCenterUnusedText2: -; unused +RuinsOfAlphResearchCenterUnusedText2: ; unreferenced text "According to my" line "research…" @@ -374,7 +371,6 @@ RuinsOfAlphResearchCenterUnownPrinterText: done RuinsOfAlphResearchCenterProfSilktreePhotoText: -; unused text "It's a photo of" line "the RESEARCH" diff --git a/maps/TeamRocketBaseB2F.asm b/maps/TeamRocketBaseB2F.asm index 7c4dc38d0..cd299e748 100644 --- a/maps/TeamRocketBaseB2F.asm +++ b/maps/TeamRocketBaseB2F.asm @@ -731,7 +731,7 @@ RocketBaseLanceElectrodeDoneText: cont "any need for it." done -RocketBaseReceivedHM06Text: ; unused +RocketBaseReceivedHM06Text: ; unreferenced text " received" line "HM06." done diff --git a/maps/TinTower9F.asm b/maps/TinTower9F.asm index 908f1a6dd..694fd892b 100644 --- a/maps/TinTower9F.asm +++ b/maps/TinTower9F.asm @@ -9,13 +9,11 @@ TinTower9F_MapScripts: TinTower9FHPUp: itemball HP_UP -TinTower9FUnusedHoOhText: -; unused +TinTower9FUnusedHoOhText: ; unreferenced text "HO-OH: Shaoooh!" done -TinTower9FUnusedLugiaText: -; unused +TinTower9FUnusedLugiaText: ; unreferenced text "LUGIA: Gyaaan!" done diff --git a/maps/TradeCenter.asm b/maps/TradeCenter.asm index 2282d9d5c..40405518b 100644 --- a/maps/TradeCenter.asm +++ b/maps/TradeCenter.asm @@ -39,15 +39,14 @@ TradeCenterConsoleScript: newloadmap MAPSETUP_LINKRETURN end -TradeCenterFriendScript: -; unreferenced +TradeCenterFriendScript: ; unreferenced opentext - writetext .FriendReadyText + writetext TradeCenterFriendReadyText waitbutton closetext end -.FriendReadyText: +TradeCenterFriendReadyText: text "Your friend is" line "ready." done diff --git a/maps/UnionCave1F.asm b/maps/UnionCave1F.asm index 862afd58a..7721ed1a3 100644 --- a/maps/UnionCave1F.asm +++ b/maps/UnionCave1F.asm @@ -81,8 +81,7 @@ UnionCave1FPotion: UnionCave1FAwakening: itemball AWAKENING -UnionCave1FUnusedSign: -; unused +UnionCave1FUnusedSign: ; unreferenced jumptext UnionCave1FUnusedSignText HikerRussellSeenText: diff --git a/maps/VermilionFishingSpeechHouse.asm b/maps/VermilionFishingSpeechHouse.asm index 14715e116..1f0046b64 100644 --- a/maps/VermilionFishingSpeechHouse.asm +++ b/maps/VermilionFishingSpeechHouse.asm @@ -12,8 +12,7 @@ FishingDude: FishingDudesHousePhoto: jumptext FishingDudesHousePhotoText -FishingDudesHouseBookshelf: -; unused +FishingDudesHouseBookshelf: ; unreferenced jumpstd PictureBookshelfScript FishingDudeText: diff --git a/maps/VioletPokecenter1F.asm b/maps/VioletPokecenter1F.asm index a249f4a70..679b645c6 100644 --- a/maps/VioletPokecenter1F.asm +++ b/maps/VioletPokecenter1F.asm @@ -157,8 +157,7 @@ VioletPokecenterElmsAideAskEggText: line "take the EGG?" done -; unused -VioletPokecenterFarawayLinkText: +VioletPokecenterFarawayLinkText: ; unreferenced text "I've been thinking" line "it'd be great to" @@ -169,8 +168,7 @@ VioletPokecenterFarawayLinkText: line "far away." done -; unused -VioletPokecenterMobileAdapterText: +VioletPokecenterMobileAdapterText: ; unreferenced text "I just battled a" line "friend in CIANWOOD" cont "over a link." diff --git a/mobile/fixed_words.asm b/mobile/fixed_words.asm index b599d8d43..dc60aafe7 100644 --- a/mobile/fixed_words.asm +++ b/mobile/fixed_words.asm @@ -1334,7 +1334,7 @@ Function11c86e: jr nz, .asm_11c8c2 ret -BCD2String: +BCD2String: ; unreferenced inc a push af and $f @@ -1356,7 +1356,7 @@ BCD2String: ld [hli], a ret -MobileString_Page: +MobileString_Page: ; unreferenced db "ぺージ@" MobileString_Prev: diff --git a/mobile/mobile_12.asm b/mobile/mobile_12.asm index 0bf26b8ee..aca9eed2e 100644 --- a/mobile/mobile_12.asm +++ b/mobile/mobile_12.asm @@ -45,8 +45,8 @@ InitMobileProfile: ld [wMusicFadeID + 1], a ld c, 20 call DelayFrames - ld b, $1 - call GetMysteryGift_MobileAdapterLayout + ld b, CRYSTAL_CGB_MOBILE_1 + call GetCrystalCGBLayout call ClearBGPalettes hlcoord 0, 0 ld b, 2 @@ -652,8 +652,8 @@ Wakayama: db "わかやまけん@" ; Wakayama Function48689: ld c, 7 call DelayFrames - ld b, $1 - call GetMysteryGift_MobileAdapterLayout + ld b, CRYSTAL_CGB_MOBILE_1 + call GetCrystalCGBLayout call ClearBGPalettes hlcoord 0, 0 ld b, 4 @@ -1080,7 +1080,7 @@ asm_48922: call DelayFrames jr asm_48972 -Function4895a: +Function4895a: ; unreferenced ldh a, [hJoyPressed] and a jr z, .asm_48965 @@ -1608,7 +1608,7 @@ Function48c8e: ; unreferenced call WaitBGMap ret -Function48ca3: +Function48ca3: ; unreferenced push af push bc push de diff --git a/mobile/mobile_12_2.asm b/mobile/mobile_12_2.asm index b2b3c84c6..88b7d0d72 100644 --- a/mobile/mobile_12_2.asm +++ b/mobile/mobile_12_2.asm @@ -332,7 +332,7 @@ Function4aa34: pop af ret -Function4aa6e: +Function4aa6e: ; unreferenced pop af ld de, SFX_WRONG call PlaySFX @@ -803,7 +803,7 @@ Function4ad60: farcall ManagePokemonMoves ret -Function4ad67: +Function4ad67: ; unreferenced ret Function4ad68: diff --git a/mobile/mobile_22.asm b/mobile/mobile_22.asm index d73977854..e4cde1665 100644 --- a/mobile/mobile_22.asm +++ b/mobile/mobile_22.asm @@ -20,18 +20,18 @@ OpenSRAMBank4: ret Function89168: - ld hl, wGameTimerPause - set GAMETIMERPAUSE_MOBILE_7_F, [hl] + ld hl, wGameTimerPaused + set GAME_TIMER_MOBILE_F, [hl] ret Function8916e: - ld hl, wGameTimerPause - res GAMETIMERPAUSE_MOBILE_7_F, [hl] + ld hl, wGameTimerPaused + res GAME_TIMER_MOBILE_F, [hl] ret Function89174: - ld hl, wGameTimerPause - bit GAMETIMERPAUSE_MOBILE_7_F, [hl] + ld hl, wGameTimerPaused + bit GAME_TIMER_MOBILE_F, [hl] ret Function8917a: @@ -507,7 +507,7 @@ Function893ef: call FarCopyBytes ret -Function893fe: +Function893fe: ; unreferenced call DisableLCD call Function893ef call EnableLCD @@ -792,7 +792,7 @@ Palette_895de: RGB 07, 07, 06 RGB 00, 00, 00 -Function895e6: +Function895e6: ; unreferenced ld a, 7 hlcoord 0, 0, wAttrmap ld bc, SCREEN_WIDTH * SCREEN_HEIGHT @@ -989,32 +989,33 @@ Function896f5: inc hl ld b, 2 -ClearScreenArea: -; clears an area of the screen +Function896ff: ; unreferenced ; INPUT: ; hl = address of upper left corner of the area ; b = height ; c = width - ld a, " " ; blank tile - ld de, 20 ; screen width -.loop +; clears an area of the screen + ld a, " " + ld de, SCREEN_WIDTH +.row_loop push bc push hl -.innerLoop +.col_loop ld [hli], a dec c - jr nz, .innerLoop + jr nz, .col_loop pop hl pop bc add hl, de dec b - jr nz, .loop + jr nz, .row_loop +; alternates tiles $36 and $18 at the bottom of the area dec hl inc c inc c -.asm_89713 +.bottom_loop ld a, $36 ld [hli], a dec c @@ -1022,7 +1023,7 @@ ClearScreenArea: ld a, $18 ld [hli], a dec c - jr nz, .asm_89713 + jr nz, .bottom_loop ret Function8971f: @@ -1695,7 +1696,7 @@ Function89b07: farcall Function4a3a7 ret -Function89b14: +Function89b14: ; unreferenced call ClearBGPalettes call Function89b07 call Function89b00 @@ -3963,7 +3964,7 @@ Function8ab3b: Function8ab93: call ClearBGPalettes call LoadStandardMenuHeader - farcall Function105688 + farcall DoNameCardSwap call ClearSprites call Function891fe call Function89b28 @@ -4225,7 +4226,7 @@ Function8adb3: pop af ret -Function8adbf: +Function8adbf: ; unreferenced call OpenSRAMBank4 ld hl, $a603 call Function89b45 diff --git a/mobile/mobile_22_2.asm b/mobile/mobile_22_2.asm index c3c1e7f1f..247d582ad 100644 --- a/mobile/mobile_22_2.asm +++ b/mobile/mobile_22_2.asm @@ -32,7 +32,7 @@ Function8b342:: .two ret -Function8b35d: +Function8b35d: ; unreferenced ld a, h cp d ret nz @@ -40,7 +40,7 @@ Function8b35d: cp e ret -Function8b363: +Function8b363: ; unreferenced push bc farcall Mobile_AlwaysReturnNotCarry pop bc @@ -719,7 +719,7 @@ Function8b75d: jr nz, .asm_8b780 jr Function8b79e -Function8b787: +Function8b787: ; unreferenced ret Function8b788: diff --git a/mobile/mobile_40.asm b/mobile/mobile_40.asm index ef3fc1560..677216bc6 100644 --- a/mobile/mobile_40.asm +++ b/mobile/mobile_40.asm @@ -429,7 +429,7 @@ Function100320: farcall Mobile_ReloadMapPart ret -Function100327: +Function100327: ; unreferenced farcall HDMATransferTilemapToWRAMBank3 ret @@ -523,7 +523,7 @@ Function10039c: call FarCopyWRAM ret -Function1003ab: +Function1003ab: ; unreferenced ld hl, w3_d000 ld de, wcc60 ld bc, $54 @@ -2217,29 +2217,29 @@ Function100ed4: Function100edf: ld hl, Unknown_100fc0 ld c, 1 - jr asm_100f02 + jr Function100f02 Function100ee6: ld hl, Unknown_100fc0 ld c, 2 - jr asm_100f02 + jr Function100f02 Function100eed: ld hl, Unknown_100feb ld c, 1 - jr asm_100f02 + jr Function100f02 Function100ef4: ld hl, Unknown_100ff3 ld c, 1 - jr asm_100f02 + jr Function100f02 -Function100efb: +Function100efb: ; unreferenced ld hl, Unknown_10102c ld c, 1 - jr asm_100f02 + jr Function100f02 -asm_100f02: +Function100f02: ld a, c ld [wStringBuffer2], a ; someting that was previously stored in de gets backed up to here @@ -2660,8 +2660,8 @@ Function1011f1: call CloseSRAM ld hl, wdc41 res 4, [hl] - ld hl, wGameTimerPause - bit GAMETIMERPAUSE_MOBILE_7_F, [hl] + ld hl, wGameTimerPaused + bit GAME_TIMER_MOBILE_F, [hl] jr z, .skip ld hl, wdc41 set 4, [hl] @@ -4425,15 +4425,15 @@ Function101e98: call ClearSprites farcall Function8adb3 ret c - ld hl, wGameTimerPause - set GAMETIMERPAUSE_MOBILE_7_F, [hl] + ld hl, wGameTimerPaused + set GAME_TIMER_MOBILE_F, [hl] ld hl, wdc41 set 4, [hl] ret Function101ead: - ld hl, wGameTimerPause - bit GAMETIMERPAUSE_MOBILE_7_F, [hl] + ld hl, wGameTimerPaused + bit GAME_TIMER_MOBILE_F, [hl] jr nz, .asm_101ec8 ld hl, wdc41 bit 2, [hl] @@ -4812,7 +4812,7 @@ Function1021e0: call ExitMenu ret -UnknownText_0x1021ea: +UnknownText_0x1021ea: ; unreferenced text_far UnknownText_0x1bd201 text_end @@ -5169,7 +5169,7 @@ Function10246a: ld [wcd49], a ret -Function102480: +Function102480: ; unreferenced ld c, $32 call DelayFrames ld a, [wcd49] @@ -5183,7 +5183,7 @@ Function10248d: ld [wcd49], a ret -Function102496: +Function102496: ; unreferenced ld hl, wcd4e dec [hl] ret nz diff --git a/mobile/mobile_41.asm b/mobile/mobile_41.asm index 8dc755368..c782087cf 100644 --- a/mobile/mobile_41.asm +++ b/mobile/mobile_41.asm @@ -282,7 +282,7 @@ StubbedTrainerRankings_TrainerBattles: ld hl, sTrainerRankingTrainerBattles jp StubbedTrainerRankings_Increment3Byte -StubbedTrainerRankings_Unused1: +StubbedTrainerRankings_Unused1: ; unreferenced ret ld hl, sTrainerRankingUnused1 jp StubbedTrainerRankings_Increment3Byte @@ -362,7 +362,7 @@ StubbedTrainerRankings_PhoneCalls: ld hl, sTrainerRankingPhoneCalls jr StubbedTrainerRankings_Increment3Byte -StubbedTrainerRankings_Unused2: +StubbedTrainerRankings_Unused2: ; unreferenced ret ld hl, sTrainerRankingUnused2 jr StubbedTrainerRankings_Increment3Byte @@ -386,7 +386,7 @@ StubbedTrainerRankings_TreeEncounters: ld hl, sTrainerRankingTreeEncounters jr StubbedTrainerRankings_Increment3Byte -StubbedTrainerRankings_Unused3: +StubbedTrainerRankings_Unused3: ; unreferenced ret ld hl, sTrainerRankingUnused3 jr StubbedTrainerRankings_Increment3Byte @@ -431,8 +431,7 @@ StubbedTrainerRankings_Increment2Byte: ld bc, 1 jr StubbedTrainerRankings_Increment -; unused -StubbedTrainerRankings_Increment1Byte: +StubbedTrainerRankings_Increment1Byte: ; unreferenced push bc ld bc, 0 @@ -556,9 +555,8 @@ DeleteMobileEventIndex: call CloseSRAM ret -; Used in the Japanese version to initialize Trainer Rankings data -; for a new save file. Unreferenced in the English version. -InitializeTrainerRankings: +InitializeTrainerRankings: ; unreferenced +; Initializes Trainer Rankings data for a new save file in JP Crystal. ld hl, sTrainerRankings ld bc, sTrainerRankingsEnd - sTrainerRankings xor a @@ -807,8 +805,8 @@ Mobile_AlwaysReturnNotCarry: or a ret -Function106331: -; called by Mobile_DummyReturnFalse in Crystal-J +Function106331: ; unreferenced +; called by Mobile_DummyReturnFalse in JP Crystal ; check ~[s4_b000] == [s7_a800] ld a, BANK(s4_b000) call OpenSRAM @@ -1028,7 +1026,7 @@ Function106464:: farcall LoadFrame ret -Function10649b: +Function10649b: ; unreferenced ld a, [wTextboxFrame] maskbits NUM_FRAMES ld bc, 6 * LEN_1BPP_TILE @@ -1063,7 +1061,7 @@ Function1064c3: ldh [rSVBK], a jr asm_1064ed -Function1064d8: +Function1064d8: ; unreferenced ldh a, [rSVBK] push af ld a, $6 @@ -1097,7 +1095,7 @@ asm_1064ed: ldh [rSVBK], a ret -Function10650a: +Function10650a: ; unreferenced ld de, MobilePhoneTilesGFX lb bc, BANK(MobilePhoneTilesGFX), 17 call Get2bpp diff --git a/mobile/mobile_42.asm b/mobile/mobile_42.asm index f609cb74d..358cf2a5a 100644 --- a/mobile/mobile_42.asm +++ b/mobile/mobile_42.asm @@ -309,7 +309,7 @@ Function108201: predef GetAnimatedFrontpic ret -Function108219: +Function108219: ; unreferenced ld [wCurPartySpecies], a hlcoord 7, 2 ld d, $0 @@ -1557,7 +1557,7 @@ Function108bec: text_far _MobileForPartnersMonText text_end -.MobilePlayersMonTradeText: +.MobilePlayersMonTradeText: ; unreferenced text_far _MobilePlayersMonTradeText text_end @@ -1636,7 +1636,7 @@ Function108c80: ldh [rVBK], a ret -DebugMobileTrade: +DebugMobileTrade: ; unreferenced ; localization error: NAME_LENGTH (11) should be NAME_LENGTH_JAPANESE (6) here ld hl, .DebugTradeData @@ -1741,7 +1741,7 @@ INCBIN "gfx/mobile/mobile_trade.tilemap.lz" MobileTradeAttrmapLZ: INCBIN "gfx/mobile/mobile_trade.attrmap.lz" -UnusedMobilePulsePalettes: +UnusedMobilePulsePalettes: ; unreferenced INCLUDE "gfx/mobile/unused_mobile_pulses.pal" MobileTradeBGPalettes: diff --git a/mobile/mobile_45.asm b/mobile/mobile_45.asm index 15dbeddca..9bfd2cf7b 100644 --- a/mobile/mobile_45.asm +++ b/mobile/mobile_45.asm @@ -1959,7 +1959,7 @@ Function114c0b: jr z, .asm_114c24 jr .asm_114c18 -Function114c55: +Function114c55: ; unreferenced push bc ld bc, $dc00 call Function115d80 diff --git a/mobile/mobile_45_sprite_engine.asm b/mobile/mobile_45_sprite_engine.asm index 54ecede02..fce800e59 100644 --- a/mobile/mobile_45_sprite_engine.asm +++ b/mobile/mobile_45_sprite_engine.asm @@ -475,7 +475,7 @@ Function1161d5: ld [wc319], a ret -MenuHeader_11628c: +MenuHeader_11628c: ; unreferenced db MENU_BACKUP_TILES ; flags menu_coords 0, 6, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw NULL diff --git a/mobile/mobile_46.asm b/mobile/mobile_46.asm index d5c331cb9..01dde10ee 100644 --- a/mobile/mobile_46.asm +++ b/mobile/mobile_46.asm @@ -331,7 +331,7 @@ Function118284: call BattleTowerRoomMenu_Cleanup ret -Function1182d5: +Function1182d5: ; unreferenced call BattleTowerRoomMenu_InitRAM ld a, $18 ld [wcd33], a @@ -1039,7 +1039,7 @@ Function118880: ld a, $2 jp Function119e2b -Function118896: +Function118896: ; unreferenced ld a, [wc821] bit 1, a jr nz, .asm_1188a5 @@ -1302,7 +1302,7 @@ BattleTowerRoomMenu_UpdatePickLevelMenu: ld [wMobileInactivityTimerFrames], a ret -Function118a54: +Function118a54: ; unreferenced ld a, [wcd55] ld l, a ld a, [wcd56] @@ -1311,7 +1311,7 @@ Function118a54: ld bc, $0004 jp Function118ae4 -Function118a65: +Function118a65: ; unreferenced ld hl, BattleDownloadURL ld de, wcc60 ld bc, $80 @@ -3530,7 +3530,7 @@ setcharmap ascii XGameCode: db "CGB-BXTJ-00", $0 -XGameResult: +XGameResult: ; unreferenced db "pokemon_crystal", $0 popc @@ -3861,7 +3861,7 @@ MenuHeader_119cf7: dw NULL db 0 ; default option -MenuData_119cff: +MenuData_119cff: ; unreferenced db MENU_BACKUP_TILES ; flags menu_coords 15, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw NULL @@ -4627,7 +4627,7 @@ String_11a2cf: String_11a2d3: db "NO@" -MenuHeader_11a2d6: +MenuHeader_11a2d6: ; unreferenced db MENU_BACKUP_TILES ; flags menu_coords 14, 6, SCREEN_WIDTH - 1, 10 dw NULL @@ -5151,7 +5151,7 @@ String_11a7d7: String_11a7f4: db "               @" -MenuHeader_11a804: +MenuHeader_11a804: ; unreferenced db MENU_BACKUP_TILES ; flags menu_coords 0, 0, SCREEN_WIDTH - 1, 5 dw NULL @@ -5402,7 +5402,7 @@ Function11a9f0: and a ret -Function11a9f4: +Function11a9f4: ; unreferenced ld a, [wcd8a] ld l, a ld a, [wcd8b] @@ -5443,12 +5443,12 @@ Text_QuitReadingNews: text "Quit reading NEWS?" done -Text_CanceledSendingSaveFile: +Text_CanceledSendingSaveFile: ; unreferenced text "Canceled sending" line "SAVE FILE." done -Text_ReceivedOddEgg: +Text_ReceivedOddEgg: ; unreferenced text "ODD EGG" line "was received!" done @@ -5458,7 +5458,7 @@ Text_RegisteringRecord: line "record…" done -Text_BattleRoomVisitLimit: +Text_BattleRoomVisitLimit: ; unreferenced text "One visit per day" line "per BATTLE ROOM!" done @@ -5487,7 +5487,7 @@ Text_ExitGymLeaderHonorRoll: line "HONOR ROLL?" done -Text_LinkingWithCenter: +Text_LinkingWithCenter: ; unreferenced text "Linking with the" line "CENTER…" done @@ -5502,16 +5502,16 @@ Text_CheckBattleRoomListByMaxLevel: line "list by max level?" done -Text_EnterWhichBattleRoom: +Text_EnterWhichBattleRoom: ; unreferenced text "Enter which" line "BATTLE ROOM?" done -Text_WhichBattleRoom: +Text_WhichBattleRoom: ; unreferenced text "Which BATTLE ROOM?" done -Text_ThisBattleRoomPleaseWait: +Text_ThisBattleRoomPleaseWait: ; unreferenced text_ram wStringBuffer3 text "'s ROOM" line "@" @@ -6379,21 +6379,21 @@ Function11b175: scf ret -Function11b1f7: +FillScreenWithTile32: ; unreferenced hlcoord 0, 0 ld a, $32 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call ByteFill ret -Function11b203: -.asm_11b203 +CopyDataUntilFF: ; unreferenced +.loop ld a, [de] cp $ff ret z inc de ld [hli], a - jr .asm_11b203 + jr .loop Function11b20b: ld a, [wc7d1] @@ -6554,10 +6554,10 @@ Function11b295: call PlaceString ret -String_11b2fe: +String_11b2fe: ; unreferenced db "あげる#@" -String_11b303: +String_11b303: ; unreferenced db "ほしい#@" String_11b308: diff --git a/mobile/mobile_5b.asm b/mobile/mobile_5b.asm index 2002facb5..297891e4f 100644 --- a/mobile/mobile_5b.asm +++ b/mobile/mobile_5b.asm @@ -7,11 +7,11 @@ Function16c000: ; unreferenced ldh a, [hSystemBooted] and a ret z - ; Set some flag, preserving the old state - ld a, [wcfbe] + ; Disable the joypad during mobile setup + ld a, [wJoypadDisable] push af - set 7, a - ld [wcfbe], a + set JOYPAD_DISABLE_SGB_TRANSFER_F, a + ld [wJoypadDisable], a ; Do stuff call MobileSystemSplashScreen_InitGFX ; Load GFX farcall SetRAMStateForMobile @@ -24,7 +24,7 @@ Function16c000: ; unreferenced ldh [hSystemBooted], a ; Restore the flag state pop af - ld [wcfbe], a + ld [wJoypadDisable], a ret .RunJumptable: diff --git a/mobile/mobile_5c.asm b/mobile/mobile_5c.asm index a8d47d913..f9a8b8621 100644 --- a/mobile/mobile_5c.asm +++ b/mobile/mobile_5c.asm @@ -93,7 +93,7 @@ Clears5_a89a: call CloseSRAM ret -Function170c06: +Function170c06: ; unreferenced ld a, $5 call OpenSRAM ld hl, $a894 diff --git a/mobile/mobile_5e.asm b/mobile/mobile_5e.asm index a30ed4983..023ac6178 100644 --- a/mobile/mobile_5e.asm +++ b/mobile/mobile_5e.asm @@ -186,7 +186,7 @@ Function17a78f: farcall ReloadMapPart ret -Function17a7a6: +Function17a7a6: ; unreferenced ld a, [$d087] inc a ld [$d087], a diff --git a/mobile/mobile_5f.asm b/mobile/mobile_5f.asm index ed4df965e..c32b4255b 100644 --- a/mobile/mobile_5f.asm +++ b/mobile/mobile_5f.asm @@ -1882,7 +1882,7 @@ Function17dc1f: call Function17e40f ret -MenuData_17dc96: +MenuData_17dc96: ; unreferenced db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING | STATICMENU_WRAP ; flags db 2 db "はい@" @@ -4645,7 +4645,7 @@ Table_17f699: dw MobileErrorCode_101_009_Text dw MobileErrorCode_101_009_Text -Palette_17f6af: +Palette_17f6af: ; unreferenced RGB 5, 5, 16 RGB 8, 19, 28 RGB 0, 0, 0 @@ -4678,7 +4678,7 @@ Function17f6b7: MobileCommunicationErrorText: db "つうしんエラー   ー@" -String_17f6e8: +String_17f6e8: ; unreferenced db "みていぎエラーです" next "プログラム" next "かくにん してください" @@ -5115,7 +5115,7 @@ MobileErrorCode_101_005_Text: next "せつめいしょを ごらんください" db "@" -String_17fe9a: ; unused +String_17fe9a: ; unreferenced ; Cannot send your save data because Pokémon News is being updated. ; Please send your save data after loading new Pokémon News. db "ポケモンニュースが" diff --git a/mobile/mobile_menu.asm b/mobile/mobile_menu.asm index f1d84f519..834690d5a 100644 --- a/mobile/mobile_menu.asm +++ b/mobile/mobile_menu.asm @@ -108,24 +108,20 @@ MobileString1: db "@" MobileStrings2: - +; string 0 String_0x49fe9: db "めいし¯つくったり" next "ほぞんしておける フォルダーです@" - -String_0x4a004: +; string 1 db "モバイルたいせんや じぶんのめいしで" next "つかう あいさつ¯つくります@" - -String_0x4a026: +; string 2 db "あなたじゅうしょや ねんれいの" next "せい¯かえられます@" - -String_0x4a042: +; string 3 db "モバイルセンターせつぞくするとき" next "ひつような こと¯きめます@" - -String_0x4a062: +; string 4 db "まえがめん もどります" next "@" @@ -446,7 +442,7 @@ Function4a28a: xor a ret -MenuHeader_0x4a346: +MenuHeader_0x4a346: ; unreferenced db MENU_BACKUP_TILES ; flags menu_coords 12, 0, SCREEN_WIDTH - 1, 6 @@ -502,7 +498,7 @@ Function4a373: ld [hli], a ret -Function4a39a: +Function4a39a: ; unreferenced call Function4a485 call Function4a492 call Function4a3aa @@ -574,7 +570,7 @@ Function4a3aa: call Function4a6d8 ret -Function4a449: +Function4a449: ; unreferenced ld bc, 3 * SCREEN_WIDTH ld a, $0 hlcoord 0, 0 @@ -607,7 +603,7 @@ Function4a485: ret Function4a492: - call MG_Mobile_Layout00 + call _CrystalCGB_MobileLayout0 ret MainMenu_MobileStudium: diff --git a/mobile/news/news.asm b/mobile/news/news.asm index 8f31e5755..f8343f676 100644 --- a/mobile/news/news.asm +++ b/mobile/news/news.asm @@ -28,7 +28,7 @@ Function1f4dbe: ; unreferenced .news_data INCBIN "mobile/news/news_2.bin" -Function1f5d9f: +Function1f5d9f: ; unreferenced ld a, BANK(s6_a000) call OpenSRAM ld hl, .news_data diff --git a/sram.asm b/sram.asm index 36b0a61e8..d20429736 100644 --- a/sram.asm +++ b/sram.asm @@ -1,6 +1,6 @@ SECTION "Scratch", SRAM -sScratch:: ds $600 +sScratch:: ds $60 tiles SECTION "SRAM Bank 0", SRAM @@ -22,7 +22,7 @@ sPartyMon5MailBackup:: mailmsg sPartyMon5MailBackup sPartyMon6MailBackup:: mailmsg sPartyMon6MailBackup sMailboxCount:: db -sMailbox:: +sMailboxes:: sMailbox1:: mailmsg sMailbox1 sMailbox2:: mailmsg sMailbox2 sMailbox3:: mailmsg sMailbox3 @@ -35,7 +35,7 @@ sMailbox9:: mailmsg sMailbox9 sMailbox10:: mailmsg sMailbox10 sMailboxCountBackup:: db -sMailboxBackup:: +sMailboxesBackup:: sMailbox1Backup:: mailmsg sMailbox1Backup sMailbox2Backup:: mailmsg sMailbox2Backup sMailbox3Backup:: mailmsg sMailbox3Backup @@ -47,20 +47,20 @@ sMailbox8Backup:: mailmsg sMailbox8Backup sMailbox9Backup:: mailmsg sMailbox9Backup sMailbox10Backup:: mailmsg sMailbox10Backup +sMysteryGiftData:: sMysteryGiftItem:: db sMysteryGiftUnlocked:: db sBackupMysteryGiftItem:: db sNumDailyMysteryGiftPartnerIDs:: db -sDailyMysteryGiftPartnerIDs:: ds 5 * 2 ; maximum 5 per day, 2 bytes per ID +sDailyMysteryGiftPartnerIDs:: ds MAX_MYSTERY_GIFT_PARTNERS * 2 sMysteryGiftDecorationsReceived:: flag_array NUM_NON_TROPHY_DECOS ds 4 -sMysteryGiftTimer:: db -sMysteryGiftTimerStartDay:: db +sMysteryGiftTimer:: dw ds 1 sMysteryGiftTrainerHouseFlag:: db sMysteryGiftPartnerName:: ds NAME_LENGTH - ds 1 -sMysteryGiftTrainer:: ds (1 + 1 + NUM_MOVES) * PARTY_LENGTH + 2 +sMysteryGiftUnusedFlag:: db +sMysteryGiftTrainer:: ds wMysteryGiftTrainerEnd - wMysteryGiftTrainer sBackupMysteryGiftItemEnd:: ds $30 @@ -194,7 +194,6 @@ sBattleTowerChallengeState:: ; 2: battle tower db -sBattleTower:: sNrOfBeatenBattleTowerTrainers:: db sBTChoiceOfLevelGroup:: db ; Battle Tower trainers are saved here, so nobody appears more than once diff --git a/wram.asm b/wram.asm index f835b6361..ab6ac382f 100644 --- a/wram.asm +++ b/wram.asm @@ -10,25 +10,22 @@ SECTION "Stack", WRAM0 wStackBottom:: ds $100 - 1 -wStack:: wStackTop:: ds 1 SECTION "Audio RAM", WRAM0 -wMusic:: - ; nonzero if playing wMusicPlaying:: db -wChannels:: +wAudio:: + wChannel1:: channel_struct wChannel1 wChannel2:: channel_struct wChannel2 wChannel3:: channel_struct wChannel3 wChannel4:: channel_struct wChannel4 -wSFXChannels:: wChannel5:: channel_struct wChannel5 wChannel6:: channel_struct wChannel6 wChannel7:: channel_struct wChannel7 @@ -118,12 +115,12 @@ wSFXDuration:: db wCurSFX:: ; id of sfx currently playing db -wChannelsEnd:: + +wAudioEnd:: wMapMusic:: db wDontPlayMapMusicOnReload:: db -wMusicEnd:: SECTION "WRAM", WRAM0 @@ -169,7 +166,6 @@ wPlayerMovement:: db ds 2 -wc2e2:: wMovementObject:: db wMovementDataBank:: db @@ -239,10 +235,6 @@ wSpriteAnim9:: sprite_anim_struct wSpriteAnim9 wSpriteAnim10:: sprite_anim_struct wSpriteAnim10 wSpriteAnimationStructsEnd:: -NEXTU -; dummy game -wc300:: - NEXTU ; mobile data wMobileWRAM:: @@ -410,6 +402,7 @@ wBattleMon:: battle_struct wBattleMon wWildMon:: db ds 1 + wEnemyTrainerItem1:: db wEnemyTrainerItem2:: db wEnemyTrainerBaseReward:: db @@ -443,71 +436,17 @@ wAttackMissed:: ; nonzero for a miss db -wPlayerSubStatus1:: -; bit -; 0 nightmare -; 1 curse -; 2 protect -; 3 identified -; 4 perish song -; 5 endure -; 6 rollout -; 7 in love - db -wPlayerSubStatus2:: -; bit -; 0 curled -; 1-7 unused - db -wPlayerSubStatus3:: -; bit -; 0 bide -; 1 rampage -; 2 in loop -; 3 flinched -; 4 charged -; 5 underground -; 6 flying -; 7 confused - db -wPlayerSubStatus4:: -; bit -; 0 x accuracy -; 1 mist -; 2 focus energy -; 3 -; 4 substitute -; 5 recharge -; 6 rage -; 7 leech seed - db -wPlayerSubStatus5:: -; bit -; 0 toxic -; 1 -; 2 -; 3 transformed -; 4 encored -; 5 lock-on -; 6 destiny bond -; 7 can't run - db +wPlayerSubStatus1:: db +wPlayerSubStatus2:: db +wPlayerSubStatus3:: db +wPlayerSubStatus4:: db +wPlayerSubStatus5:: db -wEnemySubStatus1:: -; see wPlayerSubStatus1 - db -wEnemySubStatus2:: -; see wPlayerSubStatus2 - db -wEnemySubStatus3:: -; see wPlayerSubStatus3 - db -wEnemySubStatus4:: -; see wPlayerSubStatus4 - db -wEnemySubStatus5:: -; see wPlayerSubStatus5 - db +wEnemySubStatus1:: db +wEnemySubStatus2:: db +wEnemySubStatus3:: db +wEnemySubStatus4:: db +wEnemySubStatus5:: db wPlayerRolloutCount:: db wPlayerConfuseCount:: db @@ -528,7 +467,7 @@ wEnemyFuryCutterCount:: db wEnemyProtectCount:: db wPlayerDamageTaken:: dw -wEnemyDamageTaken:: dw +wEnemyDamageTaken:: dw wBattleReward:: ds 3 @@ -543,56 +482,53 @@ wTurnEnded:: db ds 1 wPlayerStats:: -wPlayerAttack:: dw +wPlayerAttack:: dw wPlayerDefense:: dw -wPlayerSpeed:: dw -wPlayerSpAtk:: dw -wPlayerSpDef:: dw +wPlayerSpeed:: dw +wPlayerSpAtk:: dw +wPlayerSpDef:: dw ds 1 wEnemyStats:: -wEnemyAttack:: dw +wEnemyAttack:: dw wEnemyDefense:: dw -wEnemySpeed:: dw -wEnemySpAtk:: dw -wEnemySpDef:: dw +wEnemySpeed:: dw +wEnemySpAtk:: dw +wEnemySpDef:: dw ds 1 wPlayerStatLevels:: -; 07 neutral -wPlayerAtkLevel:: db -wPlayerDefLevel:: db -wPlayerSpdLevel:: db +wPlayerAtkLevel:: db +wPlayerDefLevel:: db +wPlayerSpdLevel:: db wPlayerSAtkLevel:: db wPlayerSDefLevel:: db -wPlayerAccLevel:: db -wPlayerEvaLevel:: db +wPlayerAccLevel:: db +wPlayerEvaLevel:: db ds 1 -wPlayerStatLevelsEnd:: wEnemyStatLevels:: -; 07 neutral -wEnemyAtkLevel:: db -wEnemyDefLevel:: db -wEnemySpdLevel:: db +wEnemyAtkLevel:: db +wEnemyDefLevel:: db +wEnemySpdLevel:: db wEnemySAtkLevel:: db wEnemySDefLevel:: db -wEnemyAccLevel:: db -wEnemyEvaLevel:: db +wEnemyAccLevel:: db +wEnemyEvaLevel:: db ds 1 -wEnemyTurnsTaken:: db +wEnemyTurnsTaken:: db wPlayerTurnsTaken:: db ds 1 wPlayerSubstituteHP:: db -wEnemySubstituteHP:: db +wEnemySubstituteHP:: db wUnusedPlayerLockedMove:: db ds 1 wCurPlayerMove:: db -wCurEnemyMove:: db +wCurEnemyMove:: db wLinkBattleRNCount:: ; how far through the prng stream @@ -605,7 +541,7 @@ wCurEnemyMoveNum:: db wEnemyHPAtTimeOfPlayerSwitch:: dw wPayDayMoney:: ds 3 -wSafariMonAngerCount:: db +wSafariMonAngerCount:: db ; unreferenced wSafariMonEating:: db ds 1 wEnemyBackupDVs:: dw ; used when enemy is transformed @@ -703,7 +639,7 @@ wEnemyFutureSightCount:: db wGivingExperienceToExpShareHolders:: db -wBackupEnemyMonBaseStats:: ds 5 +wBackupEnemyMonBaseStats:: ds NUM_EXP_STATS wBackupEnemyMonCatchRate:: db wBackupEnemyMonBaseExp:: db @@ -859,7 +795,6 @@ NEXTU wTrademons:: wPlayerTrademon:: trademon wPlayerTrademon wOTTrademon:: trademon wOTTrademon -wTrademonsEnd:: wTradeAnimAddress:: dw wLinkPlayer1Name:: ds NAME_LENGTH wLinkPlayer2Name:: ds NAME_LENGTH @@ -902,18 +837,15 @@ wSlotsEnd:: NEXTU ; card flip -wCardFlip:: -wDeck:: ds 24 +wDeck:: ds 4 * 6 wDeckEnd:: wCardFlipNumCardsPlayed:: db wCardFlipFaceUpCard:: db -wDiscardPile:: ds 24 +wDiscardPile:: ds 4 * 6 wDiscardPileEnd:: -wCardFlipEnd:: NEXTU ; dummy game -wDummyGame:: wDummyGameCards:: ds 9 * 5 wDummyGameCardsEnd:: wDummyGameLastCardPicked:: db @@ -925,7 +857,6 @@ wDummyGameNumberTriesRemaining:: db wDummyGameLastMatches:: ds 5 wDummyGameCounter:: db wDummyGameNumCardsMatched:: db -wDummyGameEnd:: NEXTU ; mobile data @@ -950,8 +881,7 @@ wc7bd:: ds 19 wc7d0:: ds 1 wc7d1:: ds 1 wc7d2:: ds 1 -wc7d3:: ds 1 -wc7d4:: ds 1 +wc7d3:: ds 2 ENDU ENDU @@ -969,17 +899,12 @@ UNION wOverworldMapBlocks:: ds 1300 wOverworldMapBlocksEnd:: -NEXTU -; GB Printer screen RAM -wGameboyPrinterRAM:: -wGameboyPrinterScreen:: ds SCREEN_HEIGHT * SCREEN_WIDTH -wGameboyPrinterScreenEnd:: - NEXTU ; GB Printer data +wGameboyPrinterRAM:: wGameboyPrinter2bppSource:: ds 40 tiles wGameboyPrinter2bppSourceEnd:: -wca80:: db +wUnusedGameboyPrinterSafeCancelFlag:: db wPrinterRowIndex:: db ; Printer data @@ -1000,7 +925,6 @@ wPrinterSendByteCounter:: dw ; tilemap backup? wPrinterTilemapBuffer:: ds SCREEN_HEIGHT * SCREEN_WIDTH -wPrinterTilemapBufferEnd:: wPrinterStatus:: db ds 1 ; High nibble is for margin before the image, low nibble is for after. @@ -1060,7 +984,6 @@ wTimeCapsulePartyMon5:: red_party_struct wTimeCapsulePartyMon5 wTimeCapsulePartyMon6:: red_party_struct wTimeCapsulePartyMon6 wTimeCapsulePartyMonOTNames:: ds PARTY_LENGTH * NAME_LENGTH wTimeCapsulePartyMonNicks:: ds PARTY_LENGTH * MON_NAME_LENGTH -wTimeCapsulePlayerDataEnd:: NEXTU ; link player data @@ -1073,58 +996,28 @@ wLinkPlayerPartyMon5:: party_struct wLinkPlayerPartyMon5 wLinkPlayerPartyMon6:: party_struct wLinkPlayerPartyMon6 wLinkPlayerPartyMonOTNames:: ds PARTY_LENGTH * NAME_LENGTH wLinkPlayerPartyMonNicks:: ds PARTY_LENGTH * MON_NAME_LENGTH -wLinkPlayerDataEnd:: ENDU NEXTU ; mystery gift data -UNION -wMysteryGiftPartyTemp:: ds (1 + 1 + NUM_MOVES) * PARTY_LENGTH - -NEXTU wMysteryGiftStaging:: ds 80 -NEXTU -wc800:: ds 1 -wc801:: ds 1 -wc802:: ds 1 -wc803:: ds 4 -wc807:: ds 7 -wc80e:: ds 1 -wc80f:: ds 1 -wc810:: ds 1 -wc811:: ds 1 -wMobileSDK_PacketChecksum:: dw -wc814:: ds 4 -wMobileSDK_AdapterType:: db - ds 5 -wMobileSDK_SendCommandID:: db - ds 1 -wc820:: ds 1 -wc821:: ds 1 -wc822:: ds 46 -ENDU - UNION -wMysteryGiftTrainerData:: ds (1 + 1 + NUM_MOVES) * PARTY_LENGTH + 2 -wMysteryGiftTrainerDataEnd:: +wMysteryGiftTrainer:: ds 1 + (1 + 1 + NUM_MOVES) * PARTY_LENGTH + 1 +wMysteryGiftTrainerEnd:: NEXTU -wc850:: ds 16 -wc860:: ds 16 -wc870:: ds 16 -wc880:: ds 16 -wc890:: ds 16 -wc8a0:: ds 16 -wc8b0:: ds 16 -wc8c0:: ds 16 -wc8d0:: ds 16 -wc8e0:: ds 16 -wc8f0:: ds 16 +wNameCardData:: ds NAME_LENGTH + 2 + 2 + 1 + 8 + 12 +wNameCardDataEnd:: + +NEXTU +wMysteryGiftCardHolderName:: ds PLAYER_NAME_LENGTH ENDU + ds 138 + wMysteryGiftPartnerData:: -wc900:: db +wMysteryGiftGameVersion:: db wMysteryGiftPartnerID:: dw wMysteryGiftPartnerName:: ds NAME_LENGTH wMysteryGiftPartnerDexCaught:: db @@ -1162,9 +1055,9 @@ wCreditsBlankFrame2bppEnd:: NEXTU ; mystery gift data -wca00:: db -wca01:: db -wca02:: db +wUnusedMysteryGiftStagedDataLength:: db +wMysteryGiftMessageCount:: db +wMysteryGiftStagedDataLength:: db NEXTU ; link data @@ -1181,12 +1074,8 @@ ENDU ds 14 wcb0e:: ds 5 -wcb13:: ds 50 -wcb45:: ds 2 -wMobileSDK_PacketBuffer:: ds 18 -wcb59:: ds 20 -wcb6d:: ds 1 -wcb6e:: ds 22 +wcb13:: ds 52 +wMobileSDK_PacketBuffer:: ds 61 wcb84:: ds 100 wcbe8:: dw wLinkOTPartyMonTypes:: ds 2 * PARTY_LENGTH @@ -1205,6 +1094,20 @@ wccb8:: ds 1 wccb9:: ds 1 wccba:: ds 102 +NEXTU +; mobile + ds 7 +wc807:: ds 1 + ds 10 +wMobileSDK_PacketChecksum:: dw + ds 4 +wMobileSDK_AdapterType:: db + ds 5 +wMobileSDK_SendCommandID:: db + ds 2 +wc821:: ds 1 +wc822:: ds 46 + if DEF(_DEBUG) NEXTU ; debug room @@ -1442,7 +1345,7 @@ wPlayerLinkAction:: db wcf57:: db ds 3 wLinkTimeoutFrames:: dw -wcf5d:: dw +wLinkByteTimeout:: dw wMonType:: db @@ -1457,12 +1360,6 @@ wBattleTowerBattleEnded:: db UNION -; unidentified -wcf64:: db -wcf65:: db -wcf66:: db - -NEXTU ; intro data wIntroSceneFrameCounter:: db wIntroSceneTimer:: db @@ -1487,11 +1384,13 @@ else wPrevDexEntryBackup:: wPokedexStatus:: db endc +wUnusedPokedexByte:: db NEXTU ; pokegear wPokegearCard:: db wPokegearMapRegion:: db +wUnusedPokegearByte:: db NEXTU ; pack @@ -1506,11 +1405,21 @@ wTrainerCardBadgeTileID:: db wTrainerCardBadgeAttributes:: db NEXTU -; card flip data +; slot machine +wSlotsDelay:: db + ds 1 +wUnusedSlotReelIconDelay:: db + +NEXTU +; card flip wCardFlipCursorY:: db wCardFlipCursorX:: db wCardFlipWhichCard:: db +NEXTU +; dummy game +wDummyGameCardChoice:: db + NEXTU ; magnet train wMagnetTrainOffset:: db @@ -1523,6 +1432,16 @@ wHoldingUnownPuzzlePiece:: db wUnownPuzzleCursorPosition:: db wUnownPuzzleHeldPiece:: db +NEXTU +; battle transitions +wBattleTransitionCounter:: db +wBattleTransitionSineWaveOffset:: +wBattleTransitionSpinQuadrant:: db + +NEXTU +; bill's pc +wUnusedBillsPCData:: ds 3 + NEXTU ; debug mon color picker wDebugColorRGBJumptableIndex:: db @@ -1535,30 +1454,41 @@ wDebugTilesetCurPalette:: db wDebugTilesetRGBJumptableIndex:: db wDebugTilesetCurColor:: db +NEXTU +; stats screen +wStatsScreenFlags:: db + NEXTU ; battle tower - ds $2 +wNrOfBeatenBattleTowerTrainers:: db + ds 1 wBattleTowerRoomMenuJumptableIndex:: db NEXTU ; miscellaneous wFrameCounter:: -wNrOfBeatenBattleTowerTrainers:: wMomBankDigitCursorPosition:: wNamingScreenLetterCase:: wHallOfFameMonCounter:: -wSlotsDelay:: +wTradeDialog:: db +wFrameCounter2:: wPrinterQueueLength:: +wUnusedSGB1eColorOffset:: db +wUnusedTradeAnimPlayEvolutionMusic:: db + +NEXTU +; mobile +wcf64:: db +wcf65:: db +wcf66:: db ENDU -wRequested2bpp:: wRequested2bppSize:: db wRequested2bppSource:: dw wRequested2bppDest:: dw -wRequested1bpp:: wRequested1bppSize:: db wRequested1bppSource:: dw wRequested1bppDest:: dw @@ -1654,20 +1584,20 @@ wPredefTemp:: dw wPredefAddress:: dw wFarCallBCBuffer:: dw -wcfbb:: db +wUnusedLinkCommunicationByte:: db -wGameTimerPause:: +wGameTimerPaused:: ; bit 0: game timer paused ; bit 7: something mobile db ds 1 -wcfbe:: +wJoypadDisable:: ; bits 4, 6, or 7 can be used to disable joypad input ; bit 4 -; bit 6: mon fainted? -; bit 7: SGB flag? +; bit 6: ongoing mon faint animation +; bit 7: ongoing sgb data transfer db ds 1 @@ -1738,13 +1668,19 @@ SECTION "WRAM 1", WRAMX wGBCOnlyDecompressBuffer:: ; a $540-byte buffer that continues past this SECTION -wd000:: db +wBetaTitleSequenceOpeningType:: +; This selected the title screen animation (fire/notes) in pokegold-spaceworld. + db wDefaultSpawnpoint:: db UNION -; mail temp storage -wTempMail:: mailmsg wTempMail +; mon buffer +wBufferMonNick:: ds MON_NAME_LENGTH +wBufferMonOT:: ds NAME_LENGTH +wBufferMon:: party_struct wBufferMon + ds 8 +wMonOrItemNameBuffer:: ds 22 NEXTU ; poke seer @@ -1760,12 +1696,8 @@ wSeerCaughtData:: db wSeerCaughtGender:: db NEXTU -; mon buffer -wBufferMonNick:: ds MON_NAME_LENGTH -wBufferMonOT:: ds NAME_LENGTH -wBufferMon:: party_struct wBufferMon - ds 8 -wMonOrItemNameBuffer:: +; mail temp storage +wTempMail:: mailmsg wTempMail NEXTU ; bug-catching contest @@ -1799,6 +1731,8 @@ wTownMapCursorLandmark:: db wTownMapCursorObjectPointer:: dw NEXTU wTownMapCursorCoordinates:: dw +wStartFlypoint:: db +wEndFlypoint:: db ENDU NEXTU @@ -1815,7 +1749,6 @@ wNumRadioLinesPrinted:: db wOaksPKMNTalkSegmentCounter:: db ds 5 wRadioText:: ds 2 * SCREEN_WIDTH -wRadioTextEnd:: NEXTU ; lucky number show @@ -1837,6 +1770,11 @@ wAddrOfBoxToPrint:: dw wBankOfBoxToPrint:: db wWhichBoxToPrint:: db +NEXTU +; Unown printing +wPrintedUnownTileSource:: ds 1 tiles +wPrintedUnownTileDest:: ds 1 tiles + NEXTU ; trainer HUD data ds 1 @@ -1850,6 +1788,10 @@ wMobileParticipant1Nickname:: ds NAME_LENGTH_JAPANESE wMobileParticipant2Nickname:: ds NAME_LENGTH_JAPANESE wMobileParticipant3Nickname:: ds NAME_LENGTH_JAPANESE +NEXTU +; battle exp gain +wExperienceGained:: ds 3 + NEXTU ; earthquake data buffer wEarthquakeMovementDataBuffer:: ds 5 @@ -1858,16 +1800,65 @@ NEXTU ; switching items in pack wSwitchItemBuffer:: ds 2 ; may store 1 or 2 bytes +NEXTU +; switching pokemon in party +; may store NAME_LENGTH, PARTYMON_STRUCT_LENGTH, or MAIL_STRUCT_LENGTH bytes +wSwitchMonBuffer:: ds 48 + +NEXTU +; giving pokemon mail +wMonMailMessageBuffer:: ds MAIL_MSG_LENGTH + 1 + +NEXTU +; bill's pc +UNION +wBoxNameBuffer:: ds BOX_NAME_LENGTH +NEXTU + ds 1 +wBillsPCTempListIndex:: db +wBillsPCTempBoxCount:: db +ENDU + +NEXTU +; prof. oak's pc +wTempPokedexSeenCount:: db +wTempPokedexCaughtCount:: db + +NEXTU +; player's room pc +UNION +wDecoNameBuffer:: ds ITEM_NAME_LENGTH +NEXTU +wNumOwnedDecoCategories:: db +wOwnedDecoCategories:: ds 16 +ENDU + +NEXTU +; trade +wCurTradePartyMon:: db +wCurOTTradePartyMon:: db +wBufferTrademonNick:: ds MON_NAME_LENGTH + +NEXTU +; link battle record data +wLinkBattleRecordBuffer:: +wLinkBattleRecordName:: ds NAME_LENGTH +wLinkBattleRecordWins:: dw +wLinkBattleRecordLosses:: dw +wLinkBattleRecordDraws:: dw + NEXTU ; miscellaneous wTempDayOfWeek:: +wPrevPartyLevel:: +wCurBeatUpPartyMon:: +wUnownPuzzleCornerTile:: +wKeepSevenBiasChance:: +wPokeFluteCuredSleep:: +wTempRestorePPItem:: wApricorns:: -wKeepSevenBiasChance:: ; used in the slots to handle the favoring of 7 symbol streaks wSuicuneFrame:: db - ds 2 -wStartFlypoint:: db -wEndFlypoint:: db NEXTU ; debug color picker @@ -1876,21 +1867,11 @@ wDebugColorIsShiny:: db wDebugColorCurTMHM:: db NEXTU -; link battle record data -wLinkBattleRecordName:: ds NAME_LENGTH -wLinkBattleRecordWins:: dw -wLinkBattleRecordLosses:: dw -wLinkBattleRecordDraws:: dw - -NEXTU -; unidentified -wd002:: db -wd003:: db -wd004:: db - ; mobile? - ds 1 - ds 2 +wd002:: ds 1 +wd003:: ds 1 +wd004:: ds 1 + ds 3 wd008:: ds 2 ds 6 wd010:: ds 1 @@ -1912,7 +1893,11 @@ wd032:: ds 1 wd033:: ds 1 wd034:: ds 2 wd036:: ds 2 - ds 6 + +NEXTU +; Every previous NEXTU takes up 60 or fewer bytes, +; except the initial "mon buffer" UNION. + ds 60 UNION ; trainer data @@ -2060,7 +2045,7 @@ wBallsPocketCursor:: db wTMHMPocketCursor:: db wPCItemsScrollPosition:: db -wPartyMenuScrollPosition:: db ; unused + ds 1 wItemsPocketScrollPosition:: db wKeyItemsPocketScrollPosition:: db wBallsPocketScrollPosition:: db @@ -2118,11 +2103,11 @@ wCurMessageScrollPosition:: db wCurMessageIndex:: db wMailboxCount:: db wMailboxItems:: ds MAILBOX_CAPACITY -wMailboxEnd:: ENDU wListPointer:: dw -wUnusedD102:: dw +wUnusedNamesPointer:: dw + wItemAttributesPtr:: dw wCurItem:: db @@ -2303,7 +2288,7 @@ wTempEnemyMonSpecies:: db wTempBattleMonSpecies:: db wEnemyMon:: battle_struct wEnemyMon -wEnemyMonBaseStats:: ds 5 +wEnemyMonBaseStats:: ds NUM_EXP_STATS wEnemyMonCatchRate:: db wEnemyMonBaseExp:: db wEnemyMonEnd:: @@ -2443,25 +2428,21 @@ wOTPartyMonsEnd:: wOTPartyMonOT:: ds NAME_LENGTH * PARTY_LENGTH wOTPartyMonNicknames:: ds MON_NAME_LENGTH * PARTY_LENGTH wOTPartyDataEnd:: - ds 4 NEXTU ; catch tutorial dude pack -wDudeBag:: wDudeNumItems:: db -wDudeItems:: ds 2 * 4 -wDudeItemsEnd:: db +wDudeItems:: ds 2 * 4 + 1 wDudeNumKeyItems:: db -wDudeKeyItems:: ds 18 -wDudeKeyItemsEnd:: db +wDudeKeyItems:: ds 18 + 1 wDudeNumBalls:: db -wDudeBalls:: ds 2 * 4 -wDudeBallsEnd:: db -wDudeBagEnd:: +wDudeBalls:: ds 2 * 4 + 1 ENDU + ds 4 + wd430:: ; mobile wBattleAction:: db @@ -2472,9 +2453,8 @@ wMapEventStatus:: db wScriptFlags:: ; bit 3: priority jump db + ds 1 wScriptFlags2:: - db -wScriptFlags3:: ; bit 0: count steps ; bit 1: coord events ; bit 2: warps and connections @@ -2565,8 +2545,8 @@ wSavedAtLeastOnce:: db wSpawnAfterChampion:: db ; init time set at newgame -wStartDay:: db -wStartHour:: db +wStartDay:: db +wStartHour:: db wStartMinute:: db wStartSecond:: db @@ -2611,7 +2591,6 @@ wObject9Struct:: object_struct wObject9 wObject10Struct:: object_struct wObject10 wObject11Struct:: object_struct wObject11 wObject12Struct:: object_struct wObject12 -wObjectStructsEnd:: wCmdQueue:: ds CMDQUEUE_CAPACITY * CMDQUEUE_ENTRY_SIZE @@ -2634,7 +2613,6 @@ wMap12Object:: map_object wMap12 wMap13Object:: map_object wMap13 wMap14Object:: map_object wMap14 wMap15Object:: map_object wMap15 -wMapObjectsEnd:: wObjectMasks:: ds NUM_OBJECTS @@ -2690,23 +2668,18 @@ wJohtoBadges:: flag_array NUM_JOHTO_BADGES wKantoBadges:: flag_array NUM_KANTO_BADGES wTMsHMs:: ds NUM_TMS + NUM_HMS -wTMsHMsEnd:: wNumItems:: db wItems:: ds MAX_ITEMS * 2 + 1 -wItemsEnd:: wNumKeyItems:: db wKeyItems:: ds MAX_KEY_ITEMS + 1 -wKeyItemsEnd:: wNumBalls:: db wBalls:: ds MAX_BALLS * 2 + 1 -wBallsEnd:: wNumPCItems:: db wPCItems:: ds MAX_PC_ITEMS * 2 + 1 -wPCItemsEnd:: wPokegearFlags:: ; bit 0: map @@ -2818,7 +2791,7 @@ wMobileBattleRoomSceneID:: db ; fight counts wJackFightCount:: db -wBeverlyFightCount:: db ; unused +wBeverlyFightCount:: db ; unreferenced wHueyFightCount:: db wGavenFightCount:: db wBethFightCount:: db @@ -2831,18 +2804,18 @@ wLizFightCount:: db wAnthonyFightCount:: db wToddFightCount:: db wGinaFightCount:: db -wIrwinFightCount:: db ; unused +wIrwinFightCount:: db ; unreferenced wArnieFightCount:: db wAlanFightCount:: db wDanaFightCount:: db wChadFightCount:: db -wDerekFightCount:: db ; unused +wDerekFightCount:: db ; unreferenced wTullyFightCount:: db wBrentFightCount:: db wTiffanyFightCount:: db wVanceFightCount:: db wWiltonFightCount:: db -wKenjiFightCount:: db ; unused +wKenjiFightCount:: db ; unreferenced wParryFightCount:: db wErinFightCount:: db @@ -3034,10 +3007,9 @@ wDayCareMan:: ; bit 0: monster 1 in day-care db -wBreedMon1:: -wBreedMon1Nick:: ds MON_NAME_LENGTH -wBreedMon1OT:: ds NAME_LENGTH -wBreedMon1Stats:: box_struct wBreedMon1 +wBreedMon1Nick:: ds MON_NAME_LENGTH +wBreedMon1OT:: ds NAME_LENGTH +wBreedMon1:: box_struct wBreedMon1 wDayCareLady:: ; bit 7: active @@ -3051,10 +3023,9 @@ wBreedMotherOrNonDitto:: ; nz: no db -wBreedMon2:: -wBreedMon2Nick:: ds MON_NAME_LENGTH -wBreedMon2OT:: ds NAME_LENGTH -wBreedMon2Stats:: box_struct wBreedMon2 +wBreedMon2Nick:: ds MON_NAME_LENGTH +wBreedMon2OT:: ds NAME_LENGTH +wBreedMon2:: box_struct wBreedMon2 wEggNick:: ds MON_NAME_LENGTH wEggOT:: ds NAME_LENGTH @@ -3237,7 +3208,6 @@ wAnimObject07:: battle_anim_struct wAnimObject07 wAnimObject08:: battle_anim_struct wAnimObject08 wAnimObject09:: battle_anim_struct wAnimObject09 wAnimObject10:: battle_anim_struct wAnimObject10 -wActiveAnimObjectsEnd:: wActiveBGEffects:: wBGEffect1:: battle_bg_effect wBGEffect1 @@ -3245,7 +3215,6 @@ wBGEffect2:: battle_bg_effect wBGEffect2 wBGEffect3:: battle_bg_effect wBGEffect3 wBGEffect4:: battle_bg_effect wBGEffect4 wBGEffect5:: battle_bg_effect wBGEffect5 -wActiveBGEffectsEnd:: wLastAnimObjectIndex:: db