diff options
214 files changed, 4870 insertions, 4704 deletions
@@ -4,9 +4,12 @@ ## Questions - [What is pokecrystal11.gbc?](#what-is-pokecrystal11gbc) -- [Can't build ROM; "ERROR: `UNION` already defined"](#cant-build-rom-error-union-already-defined) -- [Can't build ROM; "Segmentation fault" from `rgbgfx`](#cant-build-rom-segmentation-fault-from-rgbgfx) -- [Can't build ROM; "Section is too big" or "Unable to place section in bank"](#cant-build-rom-section-is-too-big-or-unable-to-place-section-in-bank) +- [I can't build the ROM, `make` just prints an error!](#i-cant-build-the-rom-make-just-prints-an-error) + - [`gcc`: command not found](#gcc-command-not-found) + - ["ERROR: `UNION` already defined"](#error-union-already-defined) + - ["Segmentation fault" from `rgbgfx`](#segmentation-fault-from-rgbgfx) + - ["Section is too big" or "Unable to place section in bank"](#section-is-too-big-or-unable-to-place-section-in-bank) + - ["Invalid file or object file version"](#invalid-file-or-object-file-version) - [How do I edit maps?](#how-do-i-edit-maps) - [How do I write new features?](#how-do-i-write-new-features) - [I need more help!](#i-need-more-help) @@ -17,31 +20,41 @@ Version 1.1 of Pokémon Crystal, which fixed some issues with the initial international release. `make crystal11` defines `_CRYSTAL11` so the assembly builds the changed version. -## Can't build ROM; "ERROR: `UNION` already defined" +## I can't build the ROM, `make` just prints an error! -Download [**rgbds 0.3.3**][rgbds]. Earlier versions will not work. +Reread [INSTALL.md](INSTALL.md) carefully, and make sure you're following all its steps. +### `gcc`: command not found -## Can't build ROM; "Segmentation fault" from `rgbgfx` +You need to install `gcc`. If you're using Cygwin, re-run its setup, and at "Select Packages", choose to install `gcc-core`. -If you are using 64-bit Windows, download [**64-bit Cygwin**][cygwin] and [**64-bit rgbds**][rgbds]. +### "ERROR: `UNION` already defined" + +Download [the latest **rgbds** release][rgbds]. Versions earlier than 0.3.3 will not work. +### "Segmentation fault" from `rgbgfx` + +If you are using 64-bit Windows, download [**64-bit Cygwin**][cygwin] and [**64-bit rgbds**][rgbds]. -## Can't build ROM; "Section is too big" or "Unable to place section in bank" +### "Section is too big" or "Unable to place section in bank" If you have not changed any of the asm, make sure you have the latest version of pokecrystal and the correct version of rgbds (see [INSTALL.md](INSTALL.md)). If you added or changed any code, it has to fit in the **memory banks**. The 2MB ROM is divided into 128 banks of 4KB each, numbered $00 to $7F. The linkerscript **pokecrystal.link** lists which `SECTION`s go in which banks. Try moving some code into a new section. +### "Invalid file or object file version" + +Run `make clean` to remove all the old `o` files, then re-run `make`. + ## How do I edit maps? -For `asm` scripts, read [docs/map_event_scripts.md](docs/map_event_scripts.md). For `blk` layouts, try [crowdmap][crowdmap] or [Polished Map][polished-map]. +For `asm` scripts, read [docs/map_event_scripts.md](docs/map_event_scripts.md). For `blk` layouts, try [Polished Map][polished-map] or [crowdmap][crowdmap]. ## How do I write new features? -There are a number of special-purpose scripting languages, as described in [docs](docs/). For more general features, you'll need to code directly in assembly language. See [docs/assembly_programming.md](docs/assembly_programming.md). +There are a number of special-purpose scripting languages, as described in [docs](docs/). For more general features, you'll need to code directly in assembly language. See [docs/assembly_programming.md](docs/assembly_programming.md). Some of the [tutorials][tutorials] may also be helpful. ## I need more help! @@ -50,5 +63,6 @@ Try asking on IRC or Discord (see [README.md](README.md)). [cygwin]: https://cygwin.com/install.html [rgbds]: https://github.com/rednex/rgbds/releases -[crowdmap]: https://github.com/yenatch/crowdmap/ [polished-map]: https://github.com/Rangi42/polished-map +[crowdmap]: https://github.com/yenatch/crowdmap/ +[tutorials]: https://github.com/pret/pokecrystal/wiki/Tutorials diff --git a/INSTALL.md b/INSTALL.md index 2bfc34085..19ac7d07b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -60,7 +60,7 @@ Run setup and leave the default settings. At "Select Packages", choose to instal - `git` - `gcc-core` -Then download [**rgbds**](https://github.com/rednex/rgbds/releases/): the latest **win64.tar.gz** or **win32.tar.gz** release. Extract it and put all the `exe` and `dll` files individually in **C:\Cygwin64\usr\local\bin**. +Then download [**rgbds**](https://github.com/rednex/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**. **Note: If you have an older rgbds, you will need to update to 0.3.3 or newer.** Ignore this if you have never installed rgbds before. @@ -96,7 +96,7 @@ pokecrystal11.gbc: $(crystal11_obj) pokecrystal.link $(eval filename := $@.$(hash)) $(if $(wildcard $(filename)),\ cp $(filename) $@,\ - tools/lzcomp $< $@) + tools/lzcomp -- $< $@) ### Terrible hacks to match animations. Delete these rules if you don't care about matching. diff --git a/audio/engine.asm b/audio/engine.asm index 482b1d1db..0b6d14fa4 100644 --- a/audio/engine.asm +++ b/audio/engine.asm @@ -2422,7 +2422,7 @@ _PlayCry:: add hl, bc ld a, [wCryLength] ld [hli], a - ld a, [wCryLength+1] + ld a, [wCryLength + 1] ld [hl], a .start call StartChannel diff --git a/audio/sfx.asm b/audio/sfx.asm index dbc10ddbb..9da38234f 100644 --- a/audio/sfx.asm +++ b/audio/sfx.asm @@ -364,6 +364,7 @@ Sfx_Shine: Sfx_Unknown5F: musicheader 3, 5, Sfx_Unknown5F_Ch5 musicheader 1, 6, Sfx_Unknown5F_Ch6 + Sfx_Sandstorm: musicheader 1, 8, Sfx_Sandstorm_Ch8 @@ -3650,8 +3651,8 @@ Sfx_2Boops_Ch5: soundinput $8 endchannel -Sfx_UnknownCB: - musicheader 1, 8, Sfx_UnknownCB_Ch8 +Sfx_IntroWhoosh: + musicheader 1, 8, Sfx_IntroWhoosh_Ch8 Sfx_Menu_Ch8: noise __, 2, $e2, $33 @@ -4703,7 +4704,7 @@ Sfx_Unknown60_Ch8: noise __, 16, $f2, $43 endchannel -Sfx_UnknownCB_Ch8: +Sfx_IntroWhoosh_Ch8: noise __, 2, $10, $10 noise __, 3, $20, $10 noise __, 3, $30, $20 diff --git a/audio/sfx_pointers.asm b/audio/sfx_pointers.asm index 7ab55649b..0e066c60a 100644 --- a/audio/sfx_pointers.asm +++ b/audio/sfx_pointers.asm @@ -204,7 +204,7 @@ SFX: dba Sfx_IntroSuicune4 dba Sfx_GameFreakPresents dba Sfx_Tingle - dba Sfx_UnknownCB + dba Sfx_IntroWhoosh dba Sfx_TwoPcBeeps dba Sfx_4NoteDitty dba Sfx_Twinkle diff --git a/charmap.asm b/charmap.asm index e04091a88..d5bd2bcf1 100644 --- a/charmap.asm +++ b/charmap.asm @@ -2,9 +2,12 @@ ; Control characters (see home/text.asm) + charmap "<NULL>", $00 charmap "<PLAY_G>", $14 ; "<PLAYER>くん" or "<PLAYER>ちゃん"; same as "<PLAYER>" in English + charmap "<MOBILE>", $15 + charmap "<CR>", $16 charmap "¯", $1f ; soft linebreak - charmap "<LNBRK>", $22 + charmap "<LF>", $22 charmap "<POKE>", $24 ; "<PO><KE>" charmap "%", $25 ; soft linebreak in landmark names charmap "<RED>", $38 ; wRedsName diff --git a/constants/battle_constants.asm b/constants/battle_constants.asm index 64e99d1d7..e426b615e 100644 --- a/constants/battle_constants.asm +++ b/constants/battle_constants.asm @@ -61,9 +61,10 @@ MOVE_LENGTH EQU const_value const STAT_DEF const STAT_SPD const STAT_SATK +NUM_EXP_STATS EQU const_value + -1 const STAT_SDEF -NUM_STATS EQU const_value -STAT_SPC EQU STAT_SATK +NUM_STATS EQU const_value + -1 +NUM_BATTLE_STATS EQU NUM_STATS + -1 ; don't count HP ; stat formula constants STAT_MIN_NORMAL EQU 5 @@ -243,6 +244,12 @@ SUBSTATUS_CURLED EQU 0 const BATTLEACTION_E const BATTLEACTION_FORFEIT +; wBattlePlayerAction + const_def + const BATTLEPLAYERACTION_USEMOVE + const BATTLEPLAYERACTION_USEITEM + const BATTLEPLAYERACTION_SWITCH + ; wBattleResult const_def const WIN diff --git a/constants/engine_flags.asm b/constants/engine_flags.asm index 518edf806..d6ef40b55 100644 --- a/constants/engine_flags.asm +++ b/constants/engine_flags.asm @@ -94,7 +94,7 @@ const ENGINE_LUCKY_NUMBER_SHOW ; wStatusFlags2 const ENGINE_4F -; wDailyFlags +; wDailyFlags1 const ENGINE_KURT_MAKING_BALLS ; 50 const ENGINE_DAILY_BUG_CONTEST const ENGINE_FISH_SWARM @@ -103,7 +103,7 @@ const ENGINE_GOT_SHUCKIE_TODAY const ENGINE_GOLDENROD_UNDERGROUND_MERCHANT_CLOSED const ENGINE_FOUGHT_IN_TRAINER_HALL_TODAY -; wWeeklyFlags +; wDailyFlags2 const ENGINE_MT_MOON_SQUARE_CLEFAIRY const ENGINE_UNION_CAVE_LAPRAS const ENGINE_GOLDENROD_UNDERGROUND_GOT_HAIRCUT diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm index 41a67a648..70b243447 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -49,6 +49,6 @@ NUM_SPRITE_OAM_STRUCTS EQU 40 ; see wVirtualOAM const ANIM_MON_TRADE const ANIM_MON_EVOLVE const ANIM_MON_HATCH - const ANIM_MON_UNUSED + const ANIM_MON_HOF const ANIM_MON_EGG1 const ANIM_MON_EGG2 diff --git a/constants/hardware_constants.asm b/constants/hardware_constants.asm index d96672c3a..34c7d6813 100644 --- a/constants/hardware_constants.asm +++ b/constants/hardware_constants.asm @@ -58,10 +58,6 @@ X_FLIP EQU 1 << OAM_X_FLIP ; $20 Y_FLIP EQU 1 << OAM_Y_FLIP ; $40 PRIORITY EQU 1 << OAM_PRIORITY ; $80 -; Other useful constants -LCDC_DEFAULT EQU %11100011 -LY_VBLANK EQU 144 - ; Hardware registers rJOYP EQU $ff00 ; Joypad (R/W) rSB EQU $ff01 ; Serial transfer data (R/W) @@ -119,14 +115,20 @@ rWave_d EQU $ff3d rWave_e EQU $ff3e rWave_f EQU $ff3f rLCDC EQU $ff40 ; LCD Control (R/W) +rLCDC_BG_PRIORITY EQU 0 ; 0=Off, 1=On rLCDC_SPRITES_ENABLE EQU 1 ; 0=Off, 1=On rLCDC_SPRITE_SIZE EQU 2 ; 0=8x8, 1=8x16 +rLCDC_BG_TILEMAP EQU 3 ; 0=9800-9BFF, 1=9C00-9FFF +rLCDC_TILE_DATA EQU 4 ; 0=8800-97FF, 1=8000-8FFF +rLCDC_WINDOW_ENABLE EQU 5 ; 0=Off, 1=On rLCDC_WINDOW_TILEMAP EQU 6 ; 0=9800-9BFF, 1=9C00-9FFF rLCDC_ENABLE EQU 7 ; 0=Off, 1=On +LCDC_DEFAULT EQU (1 << rLCDC_ENABLE) | (1 << rLCDC_WINDOW_TILEMAP) | (1 << rLCDC_WINDOW_ENABLE) | (1 << rLCDC_SPRITES_ENABLE) | (1 << rLCDC_BG_PRIORITY) rSTAT EQU $ff41 ; LCDC Status (R/W) rSCY EQU $ff42 ; Scroll Y (R/W) rSCX EQU $ff43 ; Scroll X (R/W) rLY EQU $ff44 ; LCDC Y-Coordinate (R) +LY_VBLANK EQU 144 rLYC EQU $ff45 ; LY Compare (R/W) rDMA EQU $ff46 ; DMA Transfer and Start Address (W) rBGP EQU $ff47 ; BG Palette Data (R/W) - Non CGB Mode Only diff --git a/constants/icon_constants.asm b/constants/icon_constants.asm index 2b0456c1d..870175f45 100644 --- a/constants/icon_constants.asm +++ b/constants/icon_constants.asm @@ -39,3 +39,13 @@ const ICON_SLOWPOKE const ICON_SUDOWOODO const ICON_BIGMON + +; LoadMenuMonIcon.Jumptable indexes (see engine/gfx/mon_icons.asm) + const_def + const MONICON_PARTYMENU + const MONICON_NAMINGSCREEN + const MONICON_MOVES + const MONICON_TRADE + const MONICON_MOBILE1 + const MONICON_MOBILE2 + const MONICON_UNUSED diff --git a/constants/menu_constants.asm b/constants/menu_constants.asm index 7c5f23377..bf6945bf4 100644 --- a/constants/menu_constants.asm +++ b/constants/menu_constants.asm @@ -33,7 +33,7 @@ shift_const SCROLLINGMENU_ENABLE_SELECT ; MonMenuOptions indexes (see data/mon_menu.asm) -; used by PokemonActionSubmenu (see engine/menus/start_menu.asm) +; used by PokemonActionSubmenu (see engine/pokemon/mon_menu.asm) const_def 1 ; moves const MONMENUITEM_CUT ; 1 diff --git a/constants/npc_trade_constants.asm b/constants/npc_trade_constants.asm index 653ce3555..f84db5df4 100644 --- a/constants/npc_trade_constants.asm +++ b/constants/npc_trade_constants.asm @@ -19,6 +19,7 @@ NPCTRADE_PADDING EQU 31 ; db const NPC_TRADE_CHRIS ; 4 const NPC_TRADE_KIM ; 5 const NPC_TRADE_FOREST ; 6 +NUM_NPC_TRADES EQU const_value ; trade gender limits const_def diff --git a/constants/script_constants.asm b/constants/script_constants.asm index 35f988c4e..a31394a36 100644 --- a/constants/script_constants.asm +++ b/constants/script_constants.asm @@ -119,8 +119,14 @@ CMDQUEUE_05 EQU 5 CMDQUEUE_ENTRY_SIZE EQU 6 CMDQUEUE_CAPACITY EQU 4 -; command queue types -CMDQUEUE_STONETABLE EQU 2 +; HandleQueuedCommand.Jumptable indexes (see engine/overworld/events.asm) + const_def + const CMDQUEUE_NULL + const CMDQUEUE_NULL2 + const CMDQUEUE_STONETABLE + const CMDQUEUE_TYPE3 + const CMDQUEUE_TYPE4 +NUM_CMDQUEUE_TYPES EQU const_value ; elevfloor macro values ; ElevatorFloorNames indexes (see data/events/elevator_floors.asm) diff --git a/constants/sfx_constants.asm b/constants/sfx_constants.asm index 9d98e147d..37fd908db 100644 --- a/constants/sfx_constants.asm +++ b/constants/sfx_constants.asm @@ -128,7 +128,7 @@ const SFX_SWEET_KISS ; 7c const SFX_SWEET_KISS_2 ; 7d const SFX_BELLY_DRUM ; 7e - const SFX_UNKNOWN_7F ; 7f + const SFX_TOXIC ; 7f const SFX_SLUDGE_BOMB ; 80 const SFX_FORESIGHT ; 81 const SFX_SPITE ; 82 @@ -206,7 +206,7 @@ const SFX_INTRO_SUICUNE_4 ; c8 const SFX_GAME_FREAK_PRESENTS ; c9 const SFX_TINGLE ; ca - const SFX_UNKNOWN_CB ; cb + const SFX_INTRO_WHOOSH ; cb const SFX_TWO_PC_BEEPS ; cc const SFX_4_NOTE_DITTY ; cd const SFX_TWINKLE ; ce diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm index 9f9132a66..c5bc47650 100644 --- a/constants/wram_constants.asm +++ b/constants/wram_constants.asm @@ -20,17 +20,17 @@ AUTO_INPUT EQU $ff GAMETIMERPAUSE_TIMER_PAUSED_F EQU 0 GAMETIMERPAUSE_MOBILE_7_F EQU 7 -; wOptions:: (bits 4-7) ; cfcc +; wOptions:: ; cfcc +TEXT_DELAY_MASK EQU %111 const_def 4 const NO_TEXT_SCROLL ; 4 const STEREO ; 5 const BATTLE_SHIFT ; 6 const BATTLE_SCENE ; 7 -; wOptions:: (bits 0-2) ; cfcc -TEXT_DELAY_FAST EQU 1 -TEXT_DELAY_MED EQU 3 -TEXT_DELAY_SLOW EQU 5 +TEXT_DELAY_FAST EQU %001 ; 1 +TEXT_DELAY_MED EQU %011 ; 3 +TEXT_DELAY_SLOW EQU %101 ; 5 ; wTextBoxFrame:: ; cfce const_def @@ -232,27 +232,27 @@ CELEBIEVENT_FOREST_IS_RESTLESS_F EQU 2 const BIKEFLAGS_ALWAYS_ON_BIKE_F ; 1 const BIKEFLAGS_DOWNHILL_F ; 2 -; wDailyFlags:: ; dc1e +; wDailyFlags1:: ; dc1e const_def - const DAILYFLAGS_KURT_MAKING_BALLS_F ; 0 - const DAILYFLAGS_BUG_CONTEST_F ; 1 - const DAILYFLAGS_FISH_SWARM_F ; 2 - const DAILYFLAGS_TIME_CAPSULE_F ; 3 - const DAILYFLAGS_ALL_FRUIT_TREES_F ; 4 - const DAILYFLAGS_GOT_SHUCKIE_TODAY_F ; 5 - const DAILYFLAGS_GOLDENROD_UNDERGROUND_BARGAIN_F ; 6 - const DAILYFLAGS_TRAINER_HOUSE_F ; 7 - -; wWeeklyFlags:: ; dc1f + const DAILYFLAGS1_KURT_MAKING_BALLS_F ; 0 + const DAILYFLAGS1_BUG_CONTEST_F ; 1 + const DAILYFLAGS1_FISH_SWARM_F ; 2 + const DAILYFLAGS1_TIME_CAPSULE_F ; 3 + const DAILYFLAGS1_ALL_FRUIT_TREES_F ; 4 + const DAILYFLAGS1_GOT_SHUCKIE_TODAY_F ; 5 + const DAILYFLAGS1_GOLDENROD_UNDERGROUND_BARGAIN_F ; 6 + const DAILYFLAGS1_TRAINER_HOUSE_F ; 7 + +; wDailyFlags2:: ; dc1f const_def - const WEEKLYFLAGS_MT_MOON_SQUARE_CLEFAIRY_F ; 0 - const WEEKLYFLAGS_UNION_CAVE_LAPRAS_F ; 1 - const WEEKLYFLAGS_GOLDENROD_UNDERGROUND_GOT_HAIRCUT_F ; 2 - const WEEKLYFLAGS_GOLDENROD_DEPT_STORE_TM27_RETURN_F ; 3 - const WEEKLYFLAGS_DAISYS_GROOMING_F ; 4 - const WEEKLYFLAGS_INDIGO_PLATEAU_RIVAL_FIGHT_F ; 5 - const WEEKLYFLAGS_DAILY_MOVE_TUTOR_F ; 6 - const WEEKLYFLAGS_BUENAS_PASSWORD_F ; 7 + const DAILYFLAGS2_MT_MOON_SQUARE_CLEFAIRY_F ; 0 + const DAILYFLAGS2_UNION_CAVE_LAPRAS_F ; 1 + const DAILYFLAGS2_GOLDENROD_UNDERGROUND_GOT_HAIRCUT_F ; 2 + const DAILYFLAGS2_GOLDENROD_DEPT_STORE_TM27_RETURN_F ; 3 + const DAILYFLAGS2_DAISYS_GROOMING_F ; 4 + const DAILYFLAGS2_INDIGO_PLATEAU_RIVAL_FIGHT_F ; 5 + const DAILYFLAGS2_MOVE_TUTOR_F ; 6 + const DAILYFLAGS2_BUENAS_PASSWORD_F ; 7 ; wSwarmFlags:: ; dc20 const_def diff --git a/data/battle/critical_hits.asm b/data/battle/critical_hit_chances.asm index 5800d57f4..0128f1a1e 100644 --- a/data/battle/critical_hits.asm +++ b/data/battle/critical_hit_chances.asm @@ -1,13 +1,3 @@ -CriticalHitMoves: - db KARATE_CHOP - db RAZOR_WIND - db RAZOR_LEAF - db CRABHAMMER - db SLASH - db AEROBLAST - db CROSS_CHOP - db -1 - CriticalHitChances: db 7 percent ; 0 db 12 percent + 2 ; +1 diff --git a/data/battle/effect_command_pointers.asm b/data/battle/effect_command_pointers.asm index 1b06eefe7..d5c044d78 100644 --- a/data/battle/effect_command_pointers.asm +++ b/data/battle/effect_command_pointers.asm @@ -20,7 +20,7 @@ BattleCommandPointers: dw BattleCommand_ApplyDamage dw BattleCommand_CriticalText dw BattleCommand_SuperEffectiveText - dw BattleCommand_CheckDestinyBond + dw BattleCommand_CheckFaint dw BattleCommand_BuildOpponentRage dw BattleCommand_PoisonTarget dw BattleCommand_SleepTarget diff --git a/data/battle_tower/parties.asm b/data/battle_tower/parties.asm index 15b7cdc4e..e0d2b4dec 100644 --- a/data/battle_tower/parties.asm +++ b/data/battle_tower/parties.asm @@ -14,7 +14,7 @@ BattleTowerMons1: bigdw 40000 bigdw 35000 bigdw 40000 - db $dd, $bd ; DVs + dn 13, 13, 11, 13 ; DVs db 15, 5, 15, 20 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -40,7 +40,7 @@ BattleTowerMons1: bigdw 35000 bigdw 40000 bigdw 40000 - db $ed, $fb ; DVs + dn 14, 13, 15, 11 ; DVs db 10, 10, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -66,7 +66,7 @@ BattleTowerMons1: bigdw 45000 bigdw 50000 bigdw 40000 - db $db, $ef ; DVs + dn 13, 11, 14, 15 ; DVs db 15, 15, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -92,7 +92,7 @@ BattleTowerMons1: bigdw 50000 bigdw 50000 bigdw 50000 - db $7f, $d7 ; DVs + dn 7, 15, 13, 7 ; DVs db 20, 20, 25, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -118,7 +118,7 @@ BattleTowerMons1: bigdw 40000 bigdw 30000 bigdw 30000 - db $ef, $cf ; DVs + dn 14, 15, 12, 15 ; DVs db 15, 5, 10, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -144,7 +144,7 @@ BattleTowerMons1: bigdw 33300 bigdw 30000 bigdw 30000 - db $fe, $fd ; DVs + dn 15, 14, 15, 13 ; DVs db 15, 10, 20, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -170,7 +170,7 @@ BattleTowerMons1: bigdw 30000 bigdw 30000 bigdw 35000 - db $bb, $df ; DVs + dn 11, 11, 13, 15 ; DVs db 5, 10, 5, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -196,7 +196,7 @@ BattleTowerMons1: bigdw 30000 bigdw 30000 bigdw 30000 - db $db, $fb ; DVs + dn 13, 11, 15, 11 ; DVs db 5, 20, 10, 25 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -222,7 +222,7 @@ BattleTowerMons1: bigdw 30000 bigdw 30000 bigdw 30000 - db $fd, $eb ; DVs + dn 15, 13, 14, 11 ; DVs db 5, 15, 15, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -248,7 +248,7 @@ BattleTowerMons1: bigdw 30000 bigdw 30000 bigdw 30000 - db $fb, $bf ; DVs + dn 15, 11, 11, 15 ; DVs db 20, 20, 15, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -274,7 +274,7 @@ BattleTowerMons1: bigdw 40000 bigdw 30000 bigdw 30000 - db $fb, $de ; DVs + dn 15, 11, 13, 14 ; DVs db 10, 5, 5, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -300,7 +300,7 @@ BattleTowerMons1: bigdw 30000 bigdw 30000 bigdw 30000 - db $ef, $df ; DVs + dn 14, 15, 13, 15 ; DVs db 5, 5, 20, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -326,7 +326,7 @@ BattleTowerMons1: bigdw 30000 bigdw 33000 bigdw 30000 - db $fd, $fe ; DVs + dn 15, 13, 15, 14 ; DVs db 20, 10, 20, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -352,7 +352,7 @@ BattleTowerMons1: bigdw 30000 bigdw 30000 bigdw 30000 - db $ed, $fd ; DVs + dn 14, 13, 15, 13 ; DVs db 20, 10, 15, 30 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -378,7 +378,7 @@ BattleTowerMons1: bigdw 30000 bigdw 30000 bigdw 30000 - db $df, $ce ; DVs + dn 13, 15, 12, 14 ; DVs db 15, 10, 20, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -404,7 +404,7 @@ BattleTowerMons1: bigdw 30000 bigdw 30000 bigdw 30000 - db $ef, $f7 ; DVs + dn 14, 15, 15, 7 ; DVs db 15, 10, 15, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -430,7 +430,7 @@ BattleTowerMons1: bigdw 30000 bigdw 30000 bigdw 30000 - db $fe, $fe ; DVs + dn 15, 14, 15, 14 ; DVs db 10, 5, 10, 25 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -456,7 +456,7 @@ BattleTowerMons1: bigdw 30000 bigdw 30000 bigdw 30000 - db $f7, $f7 ; DVs + dn 15, 7, 15, 7 ; DVs db 15, 10, 20, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -482,7 +482,7 @@ BattleTowerMons1: bigdw 30000 bigdw 30000 bigdw 30000 - db $ff, $ff ; DVs + dn 15, 15, 15, 15 ; DVs db 15, 0, 0, 0 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -508,7 +508,7 @@ BattleTowerMons1: bigdw 30000 bigdw 30000 bigdw 30000 - db $65, $57 ; DVs + dn 6, 5, 5, 7 ; DVs db 15, 15, 30, 15 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -534,7 +534,7 @@ BattleTowerMons1: bigdw 30000 bigdw 30000 bigdw 30000 - db $73, $67 ; DVs + dn 7, 3, 6, 7 ; DVs db 10, 10, 15, 15 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -563,7 +563,7 @@ BattleTowerMons2: bigdw 50000 bigdw 50000 bigdw 50000 - db $cf, $bc ; DVs + dn 12, 15, 11, 12 ; DVs db 10, 10, 10, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -589,7 +589,7 @@ BattleTowerMons2: bigdw 50000 bigdw 50000 bigdw 50000 - db $db, $db ; DVs + dn 13, 11, 13, 11 ; DVs db 20, 10, 15, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -615,7 +615,7 @@ BattleTowerMons2: bigdw 50000 bigdw 50000 bigdw 50000 - db $fa, $fd ; DVs + dn 15, 10, 15, 13 ; DVs db 5, 10, 15, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -641,7 +641,7 @@ BattleTowerMons2: bigdw 50000 bigdw 30000 bigdw 50000 - db $ff, $ff ; DVs + dn 15, 15, 15, 15 ; DVs db 20, 15, 15, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -667,7 +667,7 @@ BattleTowerMons2: bigdw 30000 bigdw 50000 bigdw 40000 - db $fd, $ef ; DVs + dn 15, 13, 14, 15 ; DVs db 10, 10, 10, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -693,7 +693,7 @@ BattleTowerMons2: bigdw 50000 bigdw 55000 bigdw 50000 - db $db, $fb ; DVs + dn 13, 11, 15, 11 ; DVs db 15, 20, 5, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -719,7 +719,7 @@ BattleTowerMons2: bigdw 45000 bigdw 30000 bigdw 45000 - db $df, $de ; DVs + dn 13, 15, 13, 14 ; DVs db 10, 15, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -745,7 +745,7 @@ BattleTowerMons2: bigdw 50000 bigdw 45000 bigdw 45000 - db $fd, $eb ; DVs + dn 15, 13, 14, 11 ; DVs db 5, 10, 10, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -771,7 +771,7 @@ BattleTowerMons2: bigdw 40000 bigdw 50000 bigdw 45000 - db $fb, $bb ; DVs + dn 15, 11, 11, 11 ; DVs db 10, 5, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -797,7 +797,7 @@ BattleTowerMons2: bigdw 30000 bigdw 30000 bigdw 50000 - db $bd, $fe ; DVs + dn 11, 13, 15, 14 ; DVs db 10, 25, 10, 20 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -823,7 +823,7 @@ BattleTowerMons2: bigdw 40000 bigdw 55000 bigdw 30000 - db $fe, $d7 ; DVs + dn 15, 14, 13, 7 ; DVs db 10, 15, 5, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -849,7 +849,7 @@ BattleTowerMons2: bigdw 45000 bigdw 50000 bigdw 50000 - db $fc, $fe ; DVs + dn 15, 12, 15, 14 ; DVs db 15, 20, 15, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -875,7 +875,7 @@ BattleTowerMons2: bigdw 40000 bigdw 45000 bigdw 50000 - db $fd, $fe ; DVs + dn 15, 13, 15, 14 ; DVs db 25, 20, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -901,7 +901,7 @@ BattleTowerMons2: bigdw 35000 bigdw 50000 bigdw 30000 - db $fb, $fd ; DVs + dn 15, 11, 15, 13 ; DVs db 15, 15, 15, 20 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -927,7 +927,7 @@ BattleTowerMons2: bigdw 50000 bigdw 30000 bigdw 30000 - db $fb, $ef ; DVs + dn 15, 11, 14, 15 ; DVs db 15, 10, 5, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -953,7 +953,7 @@ BattleTowerMons2: bigdw 40000 bigdw 40000 bigdw 40000 - db $ed, $f7 ; DVs + dn 14, 13, 15, 7 ; DVs db 15, 5, 15, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -979,7 +979,7 @@ BattleTowerMons2: bigdw 40000 bigdw 40000 bigdw 40000 - db $df, $fe ; DVs + dn 13, 15, 15, 14 ; DVs db 10, 10, 15, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1005,7 +1005,7 @@ BattleTowerMons2: bigdw 40000 bigdw 40000 bigdw 40000 - db $c7, $fe ; DVs + dn 12, 7, 15, 14 ; DVs db 5, 5, 5, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1031,7 +1031,7 @@ BattleTowerMons2: bigdw 30000 bigdw 30000 bigdw 30000 - db $c7, $77 ; DVs + dn 12, 7, 7, 7 ; DVs db 10, 15, 10, 15 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1057,7 +1057,7 @@ BattleTowerMons2: bigdw 30000 bigdw 30000 bigdw 30000 - db $56, $46 ; DVs + dn 5, 6, 4, 6 ; DVs db 5, 10, 15, 15 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1083,7 +1083,7 @@ BattleTowerMons2: bigdw 30000 bigdw 30000 bigdw 30000 - db $55, $47 ; DVs + dn 5, 5, 4, 7 ; DVs db 20, 10, 15, 5 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1112,7 +1112,7 @@ BattleTowerMons3: bigdw 50000 bigdw 50000 bigdw 55000 - db $db, $ed ; DVs + dn 13, 11, 14, 13 ; DVs db 15, 20, 20, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1138,7 +1138,7 @@ BattleTowerMons3: bigdw 55000 bigdw 55000 bigdw 50000 - db $dd, $fb ; DVs + dn 13, 13, 15, 11 ; DVs db 15, 15, 5, 25 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1164,7 +1164,7 @@ BattleTowerMons3: bigdw 50000 bigdw 50000 bigdw 50000 - db $ff, $ff ; DVs + dn 15, 15, 15, 15 ; DVs db 20, 10, 20, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1190,7 +1190,7 @@ BattleTowerMons3: bigdw 50000 bigdw 30000 bigdw 50000 - db $fb, $ee ; DVs + dn 15, 11, 14, 14 ; DVs db 5, 10, 15, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1216,7 +1216,7 @@ BattleTowerMons3: bigdw 30000 bigdw 50000 bigdw 50000 - db $ef, $ff ; DVs + dn 14, 15, 15, 15 ; DVs db 10, 10, 20, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1242,7 +1242,7 @@ BattleTowerMons3: bigdw 50000 bigdw 55000 bigdw 50000 - db $df, $db ; DVs + dn 13, 15, 13, 11 ; DVs db 5, 5, 10, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1268,7 +1268,7 @@ BattleTowerMons3: bigdw 45000 bigdw 30000 bigdw 45000 - db $fb, $ed ; DVs + dn 15, 11, 14, 13 ; DVs db 10, 20, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1294,7 +1294,7 @@ BattleTowerMons3: bigdw 50000 bigdw 45000 bigdw 45000 - db $fd, $ed ; DVs + dn 15, 13, 14, 13 ; DVs db 15, 15, 15, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1320,7 +1320,7 @@ BattleTowerMons3: bigdw 40000 bigdw 50000 bigdw 45000 - db $fd, $be ; DVs + dn 15, 13, 11, 14 ; DVs db 5, 15, 10, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1346,7 +1346,7 @@ BattleTowerMons3: bigdw 30000 bigdw 30000 bigdw 50000 - db $ef, $dc ; DVs + dn 14, 15, 13, 12 ; DVs db 15, 10, 10, 35 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1372,7 +1372,7 @@ BattleTowerMons3: bigdw 40000 bigdw 55000 bigdw 30000 - db $df, $db ; DVs + dn 13, 15, 13, 11 ; DVs db 10, 20, 5, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1398,7 +1398,7 @@ BattleTowerMons3: bigdw 45000 bigdw 50000 bigdw 30000 - db $dd, $eb ; DVs + dn 13, 13, 14, 11 ; DVs db 10, 20, 5, 10 ; PP db 255 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1424,7 +1424,7 @@ BattleTowerMons3: bigdw 40000 bigdw 45000 bigdw 50000 - db $bd, $ef ; DVs + dn 11, 13, 14, 15 ; DVs db 30, 15, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1450,7 +1450,7 @@ BattleTowerMons3: bigdw 35000 bigdw 50000 bigdw 30000 - db $fd, $eb ; DVs + dn 15, 13, 14, 11 ; DVs db 5, 25, 15, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1476,7 +1476,7 @@ BattleTowerMons3: bigdw 50000 bigdw 30000 bigdw 30000 - db $dd, $eb ; DVs + dn 13, 13, 14, 11 ; DVs db 5, 10, 15, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1502,7 +1502,7 @@ BattleTowerMons3: bigdw 50000 bigdw 50000 bigdw 50000 - db $ef, $f7 ; DVs + dn 14, 15, 15, 7 ; DVs db 25, 20, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1528,7 +1528,7 @@ BattleTowerMons3: bigdw 50000 bigdw 47000 bigdw 45000 - db $fe, $fe ; DVs + dn 15, 14, 15, 14 ; DVs db 20, 10, 10, 20 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1554,7 +1554,7 @@ BattleTowerMons3: bigdw 50000 bigdw 50000 bigdw 50000 - db $f7, $f7 ; DVs + dn 15, 7, 15, 7 ; DVs db 10, 30, 15, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1580,7 +1580,7 @@ BattleTowerMons3: bigdw 30000 bigdw 30000 bigdw 30000 - db $77, $45 ; DVs + dn 7, 7, 4, 5 ; DVs db 15, 10, 20, 30 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1606,7 +1606,7 @@ BattleTowerMons3: bigdw 30000 bigdw 30000 bigdw 30000 - db $67, $77 ; DVs + dn 6, 7, 7, 7 ; DVs db 20, 20, 35, 20 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1632,7 +1632,7 @@ BattleTowerMons3: bigdw 30000 bigdw 30000 bigdw 30000 - db $77, $67 ; DVs + dn 7, 7, 6, 7 ; DVs db 20, 25, 15, 30 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1661,7 +1661,7 @@ BattleTowerMons4: bigdw 50000 bigdw 50000 bigdw 50000 - db $fd, $fe ; DVs + dn 15, 13, 15, 14 ; DVs db 20, 5, 10, 15 ; PP db 255 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1687,7 +1687,7 @@ BattleTowerMons4: bigdw 50000 bigdw 50000 bigdw 50000 - db $fd, $ef ; DVs + dn 15, 13, 14, 15 ; DVs db 15, 20, 5, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1713,7 +1713,7 @@ BattleTowerMons4: bigdw 50000 bigdw 50000 bigdw 50000 - db $ed, $dd ; DVs + dn 14, 13, 13, 13 ; DVs db 15, 15, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1739,7 +1739,7 @@ BattleTowerMons4: bigdw 50000 bigdw 50000 bigdw 50000 - db $fd, $eb ; DVs + dn 15, 13, 14, 11 ; DVs db 15, 10, 10, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1765,7 +1765,7 @@ BattleTowerMons4: bigdw 50000 bigdw 50000 bigdw 50000 - db $ef, $db ; DVs + dn 14, 15, 13, 11 ; DVs db 10, 15, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1791,7 +1791,7 @@ BattleTowerMons4: bigdw 50000 bigdw 55000 bigdw 50000 - db $dd, $ef ; DVs + dn 13, 13, 14, 15 ; DVs db 10, 15, 20, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1817,7 +1817,7 @@ BattleTowerMons4: bigdw 45000 bigdw 50000 bigdw 45000 - db $fd, $be ; DVs + dn 15, 13, 11, 14 ; DVs db 5, 15, 15, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1843,7 +1843,7 @@ BattleTowerMons4: bigdw 50000 bigdw 50000 bigdw 50000 - db $bf, $e7 ; DVs + dn 11, 15, 14, 7 ; DVs db 20, 20, 25, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1869,7 +1869,7 @@ BattleTowerMons4: bigdw 40000 bigdw 50000 bigdw 45000 - db $dd, $ed ; DVs + dn 13, 13, 14, 13 ; DVs db 5, 10, 20, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1895,7 +1895,7 @@ BattleTowerMons4: bigdw 50000 bigdw 40000 bigdw 50000 - db $bd, $fe ; DVs + dn 11, 13, 15, 14 ; DVs db 20, 25, 20, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1921,7 +1921,7 @@ BattleTowerMons4: bigdw 50000 bigdw 50000 bigdw 50000 - db $fe, $bb ; DVs + dn 15, 14, 11, 11 ; DVs db 10, 5, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1947,7 +1947,7 @@ BattleTowerMons4: bigdw 45000 bigdw 50000 bigdw 50000 - db $bf, $cf ; DVs + dn 11, 15, 12, 15 ; DVs db 15, 10, 10, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1973,7 +1973,7 @@ BattleTowerMons4: bigdw 50000 bigdw 50000 bigdw 50000 - db $bc, $ef ; DVs + dn 11, 12, 14, 15 ; DVs db 30, 30, 20, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -1999,7 +1999,7 @@ BattleTowerMons4: bigdw 50000 bigdw 50000 bigdw 50000 - db $fe, $bb ; DVs + dn 15, 14, 11, 11 ; DVs db 25, 30, 15, 20 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2025,7 +2025,7 @@ BattleTowerMons4: bigdw 50000 bigdw 50000 bigdw 50000 - db $fa, $7f ; DVs + dn 15, 10, 7, 15 ; DVs db 40, 10, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2051,7 +2051,7 @@ BattleTowerMons4: bigdw 50000 bigdw 50000 bigdw 50000 - db $ef, $f7 ; DVs + dn 14, 15, 15, 7 ; DVs db 10, 25, 5, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2077,7 +2077,7 @@ BattleTowerMons4: bigdw 50000 bigdw 50000 bigdw 50000 - db $fe, $fe ; DVs + dn 15, 14, 15, 14 ; DVs db 15, 10, 15, 20 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2103,7 +2103,7 @@ BattleTowerMons4: bigdw 50000 bigdw 50000 bigdw 50000 - db $f7, $e7 ; DVs + dn 15, 7, 14, 7 ; DVs db 10, 20, 10, 25 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2129,7 +2129,7 @@ BattleTowerMons4: bigdw 30000 bigdw 30000 bigdw 30000 - db $77, $7a ; DVs + dn 7, 7, 7, 10 ; DVs db 25, 15, 15, 20 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2155,7 +2155,7 @@ BattleTowerMons4: bigdw 30000 bigdw 30000 bigdw 30000 - db $75, $6b ; DVs + dn 7, 5, 6, 11 ; DVs db 40, 10, 20, 30 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2181,7 +2181,7 @@ BattleTowerMons4: bigdw 30000 bigdw 30000 bigdw 30000 - db $65, $77 ; DVs + dn 6, 5, 7, 7 ; DVs db 30, 15, 20, 15 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2210,7 +2210,7 @@ BattleTowerMons5: bigdw 60000 bigdw 50000 bigdw 55000 - db $dd, $ff ; DVs + dn 13, 13, 15, 15 ; DVs db 15, 5, 5, 20 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2236,7 +2236,7 @@ BattleTowerMons5: bigdw 60000 bigdw 60000 bigdw 60000 - db $dd, $fc ; DVs + dn 13, 13, 15, 12 ; DVs db 10, 15, 15, 15 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2262,7 +2262,7 @@ BattleTowerMons5: bigdw 60000 bigdw 60000 bigdw 55000 - db $fd, $cf ; DVs + dn 15, 13, 12, 15 ; DVs db 10, 10, 10, 20 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2288,7 +2288,7 @@ BattleTowerMons5: bigdw 55000 bigdw 60000 bigdw 55000 - db $fd, $ef ; DVs + dn 15, 13, 14, 15 ; DVs db 5, 10, 15, 10 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2314,7 +2314,7 @@ BattleTowerMons5: bigdw 60000 bigdw 55000 bigdw 60000 - db $dd, $dd ; DVs + dn 13, 13, 13, 13 ; DVs db 15, 15, 10, 5 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2340,7 +2340,7 @@ BattleTowerMons5: bigdw 57000 bigdw 55000 bigdw 55000 - db $ed, $ff ; DVs + dn 14, 13, 15, 15 ; DVs db 15, 20, 15, 15 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2366,7 +2366,7 @@ BattleTowerMons5: bigdw 40000 bigdw 50000 bigdw 45000 - db $df, $ed ; DVs + dn 13, 15, 14, 13 ; DVs db 5, 20, 30, 35 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2392,7 +2392,7 @@ BattleTowerMons5: bigdw 45000 bigdw 50000 bigdw 50000 - db $df, $de ; DVs + dn 13, 15, 13, 14 ; DVs db 10, 15, 10, 20 ; PP db 15 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2418,7 +2418,7 @@ BattleTowerMons5: bigdw 50000 bigdw 40000 bigdw 44000 - db $ff, $ec ; DVs + dn 15, 15, 14, 12 ; DVs db 5, 10, 5, 15 ; PP db 13 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2444,7 +2444,7 @@ BattleTowerMons5: bigdw 40000 bigdw 45000 bigdw 40000 - db $ff, $ff ; DVs + dn 15, 15, 15, 15 ; DVs db 20, 20, 15, 15 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2470,7 +2470,7 @@ BattleTowerMons5: bigdw 50000 bigdw 45000 bigdw 50000 - db $f7, $fe ; DVs + dn 15, 7, 15, 14 ; DVs db 10, 20, 5, 10 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2496,7 +2496,7 @@ BattleTowerMons5: bigdw 54000 bigdw 40000 bigdw 50000 - db $7d, $fe ; DVs + dn 7, 13, 15, 14 ; DVs db 15, 5, 20, 10 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2522,7 +2522,7 @@ BattleTowerMons5: bigdw 50000 bigdw 45000 bigdw 45000 - db $fd, $dd ; DVs + dn 15, 13, 13, 13 ; DVs db 5, 10, 5, 15 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2548,7 +2548,7 @@ BattleTowerMons5: bigdw 50000 bigdw 40000 bigdw 50000 - db $ef, $ff ; DVs + dn 14, 15, 15, 15 ; DVs db 10, 15, 5, 10 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2574,7 +2574,7 @@ BattleTowerMons5: bigdw 45000 bigdw 40000 bigdw 50000 - db $fd, $de ; DVs + dn 15, 13, 13, 14 ; DVs db 20, 15, 20, 5 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2600,7 +2600,7 @@ BattleTowerMons5: bigdw 50000 bigdw 50000 bigdw 40000 - db $d7, $ed ; DVs + dn 13, 7, 14, 13 ; DVs db 10, 15, 25, 10 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2626,7 +2626,7 @@ BattleTowerMons5: bigdw 55000 bigdw 45000 bigdw 40000 - db $cf, $dd ; DVs + dn 12, 15, 13, 13 ; DVs db 10, 10, 5, 15 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2652,7 +2652,7 @@ BattleTowerMons5: bigdw 50000 bigdw 40000 bigdw 45000 - db $dd, $dd ; DVs + dn 13, 13, 13, 13 ; DVs db 10, 15, 10, 10 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2678,7 +2678,7 @@ BattleTowerMons5: bigdw 40000 bigdw 40000 bigdw 40000 - db $45, $56 ; DVs + dn 4, 5, 5, 6 ; DVs db 15, 15, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2704,7 +2704,7 @@ BattleTowerMons5: bigdw 40000 bigdw 40000 bigdw 40000 - db $75, $65 ; DVs + dn 7, 5, 6, 5 ; DVs db 5, 15, 5, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2730,7 +2730,7 @@ BattleTowerMons5: bigdw 40000 bigdw 40000 bigdw 40000 - db $45, $56 ; DVs + dn 4, 5, 5, 6 ; DVs db 5, 5, 20, 15 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2759,7 +2759,7 @@ BattleTowerMons6: bigdw 50000 bigdw 60000 bigdw 60000 - db $dd, $fe ; DVs + dn 13, 13, 15, 14 ; DVs db 20, 15, 5, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2785,7 +2785,7 @@ BattleTowerMons6: bigdw 55000 bigdw 60000 bigdw 55000 - db $fd, $ed ; DVs + dn 15, 13, 14, 13 ; DVs db 15, 10, 10, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2811,7 +2811,7 @@ BattleTowerMons6: bigdw 55000 bigdw 60000 bigdw 55000 - db $fb, $ef ; DVs + dn 15, 11, 14, 15 ; DVs db 15, 15, 15, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2837,7 +2837,7 @@ BattleTowerMons6: bigdw 50000 bigdw 50000 bigdw 55000 - db $dd, $de ; DVs + dn 13, 13, 13, 14 ; DVs db 5, 20, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2863,7 +2863,7 @@ BattleTowerMons6: bigdw 45000 bigdw 50000 bigdw 50000 - db $fd, $ef ; DVs + dn 15, 13, 14, 15 ; DVs db 15, 5, 15, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2889,7 +2889,7 @@ BattleTowerMons6: bigdw 50000 bigdw 55000 bigdw 50000 - db $dd, $fd ; DVs + dn 13, 13, 15, 13 ; DVs db 10, 20, 15, 20 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2915,7 +2915,7 @@ BattleTowerMons6: bigdw 45000 bigdw 50000 bigdw 45000 - db $fd, $ed ; DVs + dn 15, 13, 14, 13 ; DVs db 20, 20, 5, 25 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2941,7 +2941,7 @@ BattleTowerMons6: bigdw 50000 bigdw 45000 bigdw 45000 - db $fd, $dd ; DVs + dn 15, 13, 13, 13 ; DVs db 5, 20, 10, 25 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2967,7 +2967,7 @@ BattleTowerMons6: bigdw 40000 bigdw 50000 bigdw 45000 - db $dd, $fd ; DVs + dn 13, 13, 15, 13 ; DVs db 5, 15, 15, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -2993,7 +2993,7 @@ BattleTowerMons6: bigdw 50000 bigdw 50000 bigdw 50000 - db $fd, $ef ; DVs + dn 15, 13, 14, 15 ; DVs db 10, 5, 10, 20 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3019,7 +3019,7 @@ BattleTowerMons6: bigdw 40000 bigdw 55000 bigdw 50000 - db $fd, $ed ; DVs + dn 15, 13, 14, 13 ; DVs db 15, 15, 5, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3045,7 +3045,7 @@ BattleTowerMons6: bigdw 45000 bigdw 50000 bigdw 50000 - db $fb, $eb ; DVs + dn 15, 11, 14, 11 ; DVs db 25, 15, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3071,7 +3071,7 @@ BattleTowerMons6: bigdw 50000 bigdw 45000 bigdw 50000 - db $fb, $cd ; DVs + dn 15, 11, 12, 13 ; DVs db 10, 10, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3097,7 +3097,7 @@ BattleTowerMons6: bigdw 50000 bigdw 50000 bigdw 50000 - db $fa, $fc ; DVs + dn 15, 10, 15, 12 ; DVs db 10, 15, 15, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3123,7 +3123,7 @@ BattleTowerMons6: bigdw 50000 bigdw 50000 bigdw 50000 - db $df, $ed ; DVs + dn 13, 15, 14, 13 ; DVs db 15, 10, 10, 20 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3149,7 +3149,7 @@ BattleTowerMons6: bigdw 50000 bigdw 50000 bigdw 50000 - db $ff, $eb ; DVs + dn 15, 15, 14, 11 ; DVs db 5, 10, 15, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3175,7 +3175,7 @@ BattleTowerMons6: bigdw 50000 bigdw 50000 bigdw 50000 - db $fe, $fe ; DVs + dn 15, 14, 15, 14 ; DVs db 15, 10, 40, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3201,7 +3201,7 @@ BattleTowerMons6: bigdw 50000 bigdw 50000 bigdw 50000 - db $fb, $fa ; DVs + dn 15, 11, 15, 10 ; DVs db 10, 15, 15, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3227,7 +3227,7 @@ BattleTowerMons6: bigdw 30000 bigdw 30000 bigdw 30000 - db $b7, $67 ; DVs + dn 11, 7, 6, 7 ; DVs db 10, 20, 5, 15 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3253,7 +3253,7 @@ BattleTowerMons6: bigdw 30000 bigdw 30000 bigdw 30000 - db $66, $5f ; DVs + dn 6, 6, 5, 15 ; DVs db 15, 5, 5, 10 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3279,7 +3279,7 @@ BattleTowerMons6: bigdw 30000 bigdw 30000 bigdw 30000 - db $76, $57 ; DVs + dn 7, 6, 5, 7 ; DVs db 5, 10, 15, 20 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3308,7 +3308,7 @@ BattleTowerMons7: bigdw 55000 bigdw 50000 bigdw 60000 - db $fb, $ef ; DVs + dn 15, 11, 14, 15 ; DVs db 15, 5, 15, 20 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3334,7 +3334,7 @@ BattleTowerMons7: bigdw 60000 bigdw 60000 bigdw 50000 - db $bf, $ef ; DVs + dn 11, 15, 14, 15 ; DVs db 5, 15, 15, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3360,7 +3360,7 @@ BattleTowerMons7: bigdw 55000 bigdw 50000 bigdw 58000 - db $dd, $dd ; DVs + dn 13, 13, 13, 13 ; DVs db 20, 5, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3386,7 +3386,7 @@ BattleTowerMons7: bigdw 55000 bigdw 58000 bigdw 50000 - db $df, $ed ; DVs + dn 13, 15, 14, 13 ; DVs db 20, 10, 15, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3412,7 +3412,7 @@ BattleTowerMons7: bigdw 60000 bigdw 55000 bigdw 50000 - db $dd, $dd ; DVs + dn 13, 13, 13, 13 ; DVs db 10, 10, 5, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3438,7 +3438,7 @@ BattleTowerMons7: bigdw 55000 bigdw 60000 bigdw 55000 - db $dd, $cd ; DVs + dn 13, 13, 12, 13 ; DVs db 15, 15, 20, 20 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3464,7 +3464,7 @@ BattleTowerMons7: bigdw 45000 bigdw 50000 bigdw 45000 - db $db, $df ; DVs + dn 13, 11, 13, 15 ; DVs db 10, 15, 10, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3490,7 +3490,7 @@ BattleTowerMons7: bigdw 50000 bigdw 45000 bigdw 45000 - db $db, $df ; DVs + dn 13, 11, 13, 15 ; DVs db 15, 20, 20, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3516,7 +3516,7 @@ BattleTowerMons7: bigdw 40000 bigdw 50000 bigdw 45000 - db $dd, $ed ; DVs + dn 13, 13, 14, 13 ; DVs db 10, 5, 10, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3542,7 +3542,7 @@ BattleTowerMons7: bigdw 45000 bigdw 45000 bigdw 50000 - db $fd, $eb ; DVs + dn 15, 13, 14, 11 ; DVs db 5, 20, 10, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3568,7 +3568,7 @@ BattleTowerMons7: bigdw 50000 bigdw 55000 bigdw 50000 - db $db, $ef ; DVs + dn 13, 11, 14, 15 ; DVs db 15, 15, 5, 20 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3594,7 +3594,7 @@ BattleTowerMons7: bigdw 45000 bigdw 50000 bigdw 50000 - db $de, $dd ; DVs + dn 13, 14, 13, 13 ; DVs db 10, 15, 10, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3620,7 +3620,7 @@ BattleTowerMons7: bigdw 50000 bigdw 45000 bigdw 50000 - db $fd, $ed ; DVs + dn 15, 13, 14, 13 ; DVs db 20, 10, 5, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3646,7 +3646,7 @@ BattleTowerMons7: bigdw 45000 bigdw 50000 bigdw 50000 - db $bd, $fb ; DVs + dn 11, 13, 15, 11 ; DVs db 20, 15, 10, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3672,7 +3672,7 @@ BattleTowerMons7: bigdw 50000 bigdw 50000 bigdw 50000 - db $bd, $ef ; DVs + dn 11, 13, 14, 15 ; DVs db 5, 15, 15, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3698,7 +3698,7 @@ BattleTowerMons7: bigdw 50000 bigdw 50000 bigdw 50000 - db $fe, $fd ; DVs + dn 15, 14, 15, 13 ; DVs db 30, 40, 15, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3724,7 +3724,7 @@ BattleTowerMons7: bigdw 50000 bigdw 50000 bigdw 50000 - db $fe, $fe ; DVs + dn 15, 14, 15, 14 ; DVs db 15, 10, 15, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3750,7 +3750,7 @@ BattleTowerMons7: bigdw 50000 bigdw 50000 bigdw 50000 - db $f7, $f7 ; DVs + dn 15, 7, 15, 7 ; DVs db 15, 10, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3776,7 +3776,7 @@ BattleTowerMons7: bigdw 30000 bigdw 30000 bigdw 30000 - db $76, $44 ; DVs + dn 7, 6, 4, 4 ; DVs db 5, 10, 5, 5 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3802,7 +3802,7 @@ BattleTowerMons7: bigdw 30000 bigdw 30000 bigdw 30000 - db $56, $44 ; DVs + dn 5, 6, 4, 4 ; DVs db 20, 10, 5, 15 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3828,7 +3828,7 @@ BattleTowerMons7: bigdw 30000 bigdw 30000 bigdw 30000 - db $76, $64 ; DVs + dn 7, 6, 6, 4 ; DVs db 5, 15, 5, 15 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3857,7 +3857,7 @@ BattleTowerMons8: bigdw 60000 bigdw 55000 bigdw 55000 - db $fd, $eb ; DVs + dn 15, 13, 14, 11 ; DVs db 20, 15, 15, 20 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3883,7 +3883,7 @@ BattleTowerMons8: bigdw 50000 bigdw 55500 bigdw 60000 - db $db, $ed ; DVs + dn 13, 11, 14, 13 ; DVs db 10, 10, 15, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3909,7 +3909,7 @@ BattleTowerMons8: bigdw 55000 bigdw 55000 bigdw 55000 - db $fd, $db ; DVs + dn 15, 13, 13, 11 ; DVs db 10, 15, 15, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3935,7 +3935,7 @@ BattleTowerMons8: bigdw 50000 bigdw 30000 bigdw 50000 - db $fd, $de ; DVs + dn 15, 13, 13, 14 ; DVs db 10, 15, 15, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3961,7 +3961,7 @@ BattleTowerMons8: bigdw 50000 bigdw 55000 bigdw 50000 - db $df, $db ; DVs + dn 13, 15, 13, 11 ; DVs db 10, 15, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -3987,7 +3987,7 @@ BattleTowerMons8: bigdw 50000 bigdw 55000 bigdw 50000 - db $df, $db ; DVs + dn 13, 15, 13, 11 ; DVs db 10, 15, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4013,7 +4013,7 @@ BattleTowerMons8: bigdw 45000 bigdw 55000 bigdw 50000 - db $de, $dd ; DVs + dn 13, 14, 13, 13 ; DVs db 15, 15, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4039,7 +4039,7 @@ BattleTowerMons8: bigdw 50000 bigdw 45000 bigdw 50000 - db $fd, $ed ; DVs + dn 15, 13, 14, 13 ; DVs db 5, 10, 10, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4065,7 +4065,7 @@ BattleTowerMons8: bigdw 40000 bigdw 55000 bigdw 50000 - db $fb, $ed ; DVs + dn 15, 11, 14, 13 ; DVs db 10, 15, 5, 20 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4091,7 +4091,7 @@ BattleTowerMons8: bigdw 50000 bigdw 50000 bigdw 45000 - db $dd, $dd ; DVs + dn 13, 13, 13, 13 ; DVs db 20, 15, 15, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4117,7 +4117,7 @@ BattleTowerMons8: bigdw 40000 bigdw 55000 bigdw 50000 - db $df, $ed ; DVs + dn 13, 15, 14, 13 ; DVs db 10, 20, 5, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4143,7 +4143,7 @@ BattleTowerMons8: bigdw 45000 bigdw 50000 bigdw 50000 - db $df, $df ; DVs + dn 13, 15, 13, 15 ; DVs db 10, 5, 15, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4169,7 +4169,7 @@ BattleTowerMons8: bigdw 40000 bigdw 45000 bigdw 50000 - db $df, $dc ; DVs + dn 13, 15, 13, 12 ; DVs db 15, 10, 5, 35 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4195,7 +4195,7 @@ BattleTowerMons8: bigdw 35000 bigdw 50000 bigdw 50000 - db $dd, $ef ; DVs + dn 13, 13, 14, 15 ; DVs db 25, 15, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4221,7 +4221,7 @@ BattleTowerMons8: bigdw 50000 bigdw 40000 bigdw 50000 - db $dd, $fe ; DVs + dn 13, 13, 15, 14 ; DVs db 15, 5, 25, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4247,7 +4247,7 @@ BattleTowerMons8: bigdw 50000 bigdw 40000 bigdw 50000 - db $ff, $ed ; DVs + dn 15, 15, 14, 13 ; DVs db 5, 10, 10, 20 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4273,7 +4273,7 @@ BattleTowerMons8: bigdw 40000 bigdw 40000 bigdw 50000 - db $ff, $ef ; DVs + dn 15, 15, 14, 15 ; DVs db 15, 5, 20, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4299,7 +4299,7 @@ BattleTowerMons8: bigdw 40000 bigdw 50000 bigdw 40000 - db $fd, $dd ; DVs + dn 15, 13, 13, 13 ; DVs db 20, 10, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4325,7 +4325,7 @@ BattleTowerMons8: bigdw 30000 bigdw 30000 bigdw 30000 - db $65, $65 ; DVs + dn 6, 5, 6, 5 ; DVs db 5, 10, 5, 10 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4351,7 +4351,7 @@ BattleTowerMons8: bigdw 30000 bigdw 30000 bigdw 30000 - db $74, $64 ; DVs + dn 7, 4, 6, 4 ; DVs db 5, 25, 15, 10 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4377,7 +4377,7 @@ BattleTowerMons8: bigdw 30000 bigdw 30000 bigdw 30000 - db $76, $57 ; DVs + dn 7, 6, 5, 7 ; DVs db 20, 15, 5, 15 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4406,7 +4406,7 @@ BattleTowerMons9: bigdw 55000 bigdw 60000 bigdw 55000 - db $fd, $ed ; DVs + dn 15, 13, 14, 13 ; DVs db 20, 10, 5, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4432,7 +4432,7 @@ BattleTowerMons9: bigdw 56000 bigdw 60000 bigdw 60000 - db $fd, $ed ; DVs + dn 15, 13, 14, 13 ; DVs db 5, 5, 15, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4458,7 +4458,7 @@ BattleTowerMons9: bigdw 60000 bigdw 55000 bigdw 60000 - db $df, $dd ; DVs + dn 13, 15, 13, 13 ; DVs db 20, 15, 15, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4484,7 +4484,7 @@ BattleTowerMons9: bigdw 50000 bigdw 50000 bigdw 50000 - db $db, $df ; DVs + dn 13, 11, 13, 15 ; DVs db 5, 5, 15, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4510,7 +4510,7 @@ BattleTowerMons9: bigdw 50000 bigdw 50000 bigdw 50000 - db $fd, $cf ; DVs + dn 15, 13, 12, 15 ; DVs db 35, 30, 5, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4536,7 +4536,7 @@ BattleTowerMons9: bigdw 50000 bigdw 55000 bigdw 50000 - db $fd, $ed ; DVs + dn 15, 13, 14, 13 ; DVs db 10, 10, 20, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4562,7 +4562,7 @@ BattleTowerMons9: bigdw 55000 bigdw 50000 bigdw 45000 - db $df, $de ; DVs + dn 13, 15, 13, 14 ; DVs db 20, 15, 5, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4588,7 +4588,7 @@ BattleTowerMons9: bigdw 50000 bigdw 45000 bigdw 50000 - db $df, $de ; DVs + dn 13, 15, 13, 14 ; DVs db 5, 15, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4614,7 +4614,7 @@ BattleTowerMons9: bigdw 50000 bigdw 50000 bigdw 55000 - db $bd, $ef ; DVs + dn 11, 13, 14, 15 ; DVs db 10, 15, 15, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4640,7 +4640,7 @@ BattleTowerMons9: bigdw 50000 bigdw 55000 bigdw 50000 - db $dd, $fe ; DVs + dn 13, 13, 15, 14 ; DVs db 10, 15, 5, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4666,7 +4666,7 @@ BattleTowerMons9: bigdw 50000 bigdw 55000 bigdw 50000 - db $dd, $ed ; DVs + dn 13, 13, 14, 13 ; DVs db 5, 10, 5, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4692,7 +4692,7 @@ BattleTowerMons9: bigdw 55000 bigdw 50000 bigdw 50000 - db $fe, $fd ; DVs + dn 15, 14, 15, 13 ; DVs db 5, 15, 10, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4718,7 +4718,7 @@ BattleTowerMons9: bigdw 50000 bigdw 45000 bigdw 55000 - db $df, $de ; DVs + dn 13, 15, 13, 14 ; DVs db 5, 15, 5, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4744,7 +4744,7 @@ BattleTowerMons9: bigdw 50000 bigdw 50000 bigdw 50000 - db $bd, $fe ; DVs + dn 11, 13, 15, 14 ; DVs db 10, 5, 10, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4770,7 +4770,7 @@ BattleTowerMons9: bigdw 50000 bigdw 50000 bigdw 50000 - db $db, $fe ; DVs + dn 13, 11, 15, 14 ; DVs db 15, 15, 5, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4796,7 +4796,7 @@ BattleTowerMons9: bigdw 50000 bigdw 50000 bigdw 50000 - db $ef, $f7 ; DVs + dn 14, 15, 15, 7 ; DVs db 10, 25, 10, 20 ; PP db 255 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4822,7 +4822,7 @@ BattleTowerMons9: bigdw 50000 bigdw 50000 bigdw 50000 - db $fe, $fe ; DVs + dn 15, 14, 15, 14 ; DVs db 10, 20, 10, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4848,7 +4848,7 @@ BattleTowerMons9: bigdw 50000 bigdw 50000 bigdw 50000 - db $f7, $f7 ; DVs + dn 15, 7, 15, 7 ; DVs db 5, 15, 15, 20 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4874,7 +4874,7 @@ BattleTowerMons9: bigdw 30000 bigdw 30000 bigdw 30000 - db $47, $57 ; DVs + dn 4, 7, 5, 7 ; DVs db 10, 10, 15, 15 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4900,7 +4900,7 @@ BattleTowerMons9: bigdw 30000 bigdw 30000 bigdw 30000 - db $65, $76 ; DVs + dn 6, 5, 7, 6 ; DVs db 15, 5, 15, 10 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4926,7 +4926,7 @@ BattleTowerMons9: bigdw 30000 bigdw 30000 bigdw 30000 - db $54, $44 ; DVs + dn 5, 4, 4, 4 ; DVs db 10, 10, 15, 5 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4955,7 +4955,7 @@ BattleTowerMons10: bigdw 60000 bigdw 60000 bigdw 60000 - db $fd, $ed ; DVs + dn 15, 13, 14, 13 ; DVs db 15, 15, 20, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -4981,7 +4981,7 @@ BattleTowerMons10: bigdw 60000 bigdw 60000 bigdw 60000 - db $fd, $ef ; DVs + dn 15, 13, 14, 15 ; DVs db 5, 10, 5, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5007,7 +5007,7 @@ BattleTowerMons10: bigdw 60000 bigdw 60000 bigdw 60000 - db $df, $fe ; DVs + dn 13, 15, 15, 14 ; DVs db 15, 20, 10, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5033,7 +5033,7 @@ BattleTowerMons10: bigdw 50000 bigdw 30000 bigdw 50000 - db $fd, $fe ; DVs + dn 15, 13, 15, 14 ; DVs db 15, 20, 20, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5059,7 +5059,7 @@ BattleTowerMons10: bigdw 50000 bigdw 50000 bigdw 50000 - db $fd, $ef ; DVs + dn 15, 13, 14, 15 ; DVs db 5, 10, 15, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5085,7 +5085,7 @@ BattleTowerMons10: bigdw 50000 bigdw 55000 bigdw 50000 - db $dd, $ef ; DVs + dn 13, 13, 14, 15 ; DVs db 15, 5, 15, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5111,7 +5111,7 @@ BattleTowerMons10: bigdw 55000 bigdw 55000 bigdw 55000 - db $fe, $df ; DVs + dn 15, 14, 13, 15 ; DVs db 15, 10, 20, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5137,7 +5137,7 @@ BattleTowerMons10: bigdw 50000 bigdw 45000 bigdw 45000 - db $fb, $ef ; DVs + dn 15, 11, 14, 15 ; DVs db 20, 15, 5, 20 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5163,7 +5163,7 @@ BattleTowerMons10: bigdw 55000 bigdw 50000 bigdw 45000 - db $fd, $ef ; DVs + dn 15, 13, 14, 15 ; DVs db 15, 10, 5, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5189,7 +5189,7 @@ BattleTowerMons10: bigdw 55000 bigdw 60000 bigdw 50000 - db $fd, $de ; DVs + dn 15, 13, 13, 14 ; DVs db 10, 5, 15, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5215,7 +5215,7 @@ BattleTowerMons10: bigdw 50000 bigdw 55000 bigdw 50000 - db $fd, $cf ; DVs + dn 15, 13, 12, 15 ; DVs db 20, 25, 5, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5241,7 +5241,7 @@ BattleTowerMons10: bigdw 55000 bigdw 50000 bigdw 55000 - db $bd, $ef ; DVs + dn 11, 13, 14, 15 ; DVs db 5, 5, 20, 15 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5267,7 +5267,7 @@ BattleTowerMons10: bigdw 48000 bigdw 45000 bigdw 50000 - db $fd, $ef ; DVs + dn 15, 13, 14, 15 ; DVs db 20, 5, 15, 20 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5293,7 +5293,7 @@ BattleTowerMons10: bigdw 50000 bigdw 50000 bigdw 45000 - db $fb, $fe ; DVs + dn 15, 11, 15, 14 ; DVs db 25, 5, 20, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5319,7 +5319,7 @@ BattleTowerMons10: bigdw 50000 bigdw 30000 bigdw 30000 - db $dd, $fe ; DVs + dn 13, 13, 15, 14 ; DVs db 15, 5, 5, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5345,7 +5345,7 @@ BattleTowerMons10: bigdw 50000 bigdw 50000 bigdw 50000 - db $fe, $f7 ; DVs + dn 15, 14, 15, 7 ; DVs db 10, 5, 5, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5371,7 +5371,7 @@ BattleTowerMons10: bigdw 50000 bigdw 50000 bigdw 50000 - db $fe, $fe ; DVs + dn 15, 14, 15, 14 ; DVs db 10, 10, 5, 5 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5397,7 +5397,7 @@ BattleTowerMons10: bigdw 50000 bigdw 50000 bigdw 50000 - db $fb, $e7 ; DVs + dn 15, 11, 14, 7 ; DVs db 15, 5, 5, 10 ; PP db 100 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5423,7 +5423,7 @@ BattleTowerMons10: bigdw 30000 bigdw 30000 bigdw 30000 - db $74, $46 ; DVs + dn 7, 4, 4, 6 ; DVs db 5, 10, 10, 5 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5449,7 +5449,7 @@ BattleTowerMons10: bigdw 30000 bigdw 30000 bigdw 30000 - db $67, $76 ; DVs + dn 6, 7, 7, 6 ; DVs db 20, 15, 15, 15 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -5475,7 +5475,7 @@ BattleTowerMons10: bigdw 30000 bigdw 30000 bigdw 30000 - db $76, $57 ; DVs + dn 7, 6, 5, 7 ; DVs db 15, 5, 5, 10 ; PP db 0 ; Happiness db 0, 0, 0 ; Pokerus, Caught data diff --git a/data/default_options.asm b/data/default_options.asm index 991827316..333f7ef02 100644 --- a/data/default_options.asm +++ b/data/default_options.asm @@ -2,7 +2,7 @@ DefaultOptions: ; wOptions: med text speed db TEXT_DELAY_MED ; wSaveFileExists: no - db $00 + db FALSE ; wTextBoxFrame: frame 1 db FRAME_1 ; wTextBoxFlags: use text speed diff --git a/data/engine_flags.asm b/data/engine_flags.asm index 21f8ca0fe..ab669acfc 100644 --- a/data/engine_flags.asm +++ b/data/engine_flags.asm @@ -104,23 +104,23 @@ EngineFlags: engine_flag wStatusFlags2, STATUSFLAGS2_UNUSED_3_F - engine_flag wDailyFlags, DAILYFLAGS_KURT_MAKING_BALLS_F ; $50 - engine_flag wDailyFlags, DAILYFLAGS_BUG_CONTEST_F - engine_flag wDailyFlags, DAILYFLAGS_FISH_SWARM_F - engine_flag wDailyFlags, DAILYFLAGS_TIME_CAPSULE_F - engine_flag wDailyFlags, DAILYFLAGS_ALL_FRUIT_TREES_F - engine_flag wDailyFlags, DAILYFLAGS_GOT_SHUCKIE_TODAY_F - engine_flag wDailyFlags, DAILYFLAGS_GOLDENROD_UNDERGROUND_BARGAIN_F - engine_flag wDailyFlags, DAILYFLAGS_TRAINER_HOUSE_F - - engine_flag wWeeklyFlags, WEEKLYFLAGS_MT_MOON_SQUARE_CLEFAIRY_F ; $58 - engine_flag wWeeklyFlags, WEEKLYFLAGS_UNION_CAVE_LAPRAS_F - engine_flag wWeeklyFlags, WEEKLYFLAGS_GOLDENROD_UNDERGROUND_GOT_HAIRCUT_F - engine_flag wWeeklyFlags, WEEKLYFLAGS_GOLDENROD_DEPT_STORE_TM27_RETURN_F - engine_flag wWeeklyFlags, WEEKLYFLAGS_DAISYS_GROOMING_F - engine_flag wWeeklyFlags, WEEKLYFLAGS_INDIGO_PLATEAU_RIVAL_FIGHT_F - engine_flag wWeeklyFlags, WEEKLYFLAGS_DAILY_MOVE_TUTOR_F - engine_flag wWeeklyFlags, WEEKLYFLAGS_BUENAS_PASSWORD_F + engine_flag wDailyFlags1, DAILYFLAGS1_KURT_MAKING_BALLS_F ; $50 + engine_flag wDailyFlags1, DAILYFLAGS1_BUG_CONTEST_F + engine_flag wDailyFlags1, DAILYFLAGS1_FISH_SWARM_F + engine_flag wDailyFlags1, DAILYFLAGS1_TIME_CAPSULE_F + engine_flag wDailyFlags1, DAILYFLAGS1_ALL_FRUIT_TREES_F + engine_flag wDailyFlags1, DAILYFLAGS1_GOT_SHUCKIE_TODAY_F + engine_flag wDailyFlags1, DAILYFLAGS1_GOLDENROD_UNDERGROUND_BARGAIN_F + engine_flag wDailyFlags1, DAILYFLAGS1_TRAINER_HOUSE_F + + engine_flag wDailyFlags2, DAILYFLAGS2_MT_MOON_SQUARE_CLEFAIRY_F ; $58 + engine_flag wDailyFlags2, DAILYFLAGS2_UNION_CAVE_LAPRAS_F + engine_flag wDailyFlags2, DAILYFLAGS2_GOLDENROD_UNDERGROUND_GOT_HAIRCUT_F + engine_flag wDailyFlags2, DAILYFLAGS2_GOLDENROD_DEPT_STORE_TM27_RETURN_F + engine_flag wDailyFlags2, DAILYFLAGS2_DAISYS_GROOMING_F + engine_flag wDailyFlags2, DAILYFLAGS2_INDIGO_PLATEAU_RIVAL_FIGHT_F + engine_flag wDailyFlags2, DAILYFLAGS2_MOVE_TUTOR_F + engine_flag wDailyFlags2, DAILYFLAGS2_BUENAS_PASSWORD_F engine_flag wSwarmFlags, SWARMFLAGS_BUENAS_PASSWORD_F ; $60 engine_flag wSwarmFlags, SWARMFLAGS_GOLDENROD_DEPT_STORE_SALE_F diff --git a/data/events/odd_eggs.asm b/data/events/odd_eggs.asm index d8a289872..a3c942ff7 100644 --- a/data/events/odd_eggs.asm +++ b/data/events/odd_eggs.asm @@ -41,7 +41,7 @@ OddEgg1: bigdw 0 bigdw 0 bigdw 0 - db $0, $0 ; DVs + dn 0, 0, 0, 0 ; DVs db 30, 20, 10, 0 ; PP db 20 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -55,8 +55,8 @@ OddEgg1: bigdw 8 ; SAtk bigdw 8 ; SDef db "EGG@@@@@@@@" +OddEgg1End: -OddEgg2: db PICHU db NO_ITEM db THUNDERSHOCK, CHARM, DIZZY_PUNCH, 0 @@ -68,7 +68,7 @@ OddEgg2: bigdw 0 bigdw 0 bigdw 0 - db $2a, $aa ; DVs + dn 2, 10, 10, 10 ; DVs db 30, 20, 10, 0 ; PP db 20 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -94,7 +94,7 @@ OddEgg2: bigdw 0 bigdw 0 bigdw 0 - db $0, $0 ; DVs + dn 0, 0, 0, 0 ; DVs db 35, 20, 10, 0 ; PP db 20 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -120,7 +120,7 @@ OddEgg2: bigdw 0 bigdw 0 bigdw 0 - db $2a, $aa ; DVs + dn 2, 10, 10, 10 ; DVs db 35, 20, 10, 0 ; PP db 20 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -146,7 +146,7 @@ OddEgg2: bigdw 0 bigdw 0 bigdw 0 - db $0, $0 ; DVs + dn 0, 0, 0, 0 ; DVs db 15, 20, 10, 0 ; PP db 20 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -172,7 +172,7 @@ OddEgg2: bigdw 0 bigdw 0 bigdw 0 - db $2a, $aa ; DVs + dn 2, 10, 10, 10 ; DVs db 15, 20, 10, 0 ; PP db 20 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -198,7 +198,7 @@ OddEgg2: bigdw 0 bigdw 0 bigdw 0 - db $0, $0 ; DVs + dn 0, 0, 0, 0 ; DVs db 35, 30, 10, 0 ; PP db 20 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -224,7 +224,7 @@ OddEgg2: bigdw 0 bigdw 0 bigdw 0 - db $2a, $aa ; DVs + dn 2, 10, 10, 10 ; DVs db 35, 30, 10, 0 ; PP db 20 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -250,7 +250,7 @@ OddEgg2: bigdw 0 bigdw 0 bigdw 0 - db $0, $0 ; DVs + dn 0, 0, 0, 0 ; DVs db 25, 10, 0, 0 ; PP db 20 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -276,7 +276,7 @@ OddEgg2: bigdw 0 bigdw 0 bigdw 0 - db $2a, $aa ; DVs + dn 2, 10, 10, 10 ; DVs db 25, 10, 0, 0 ; PP db 20 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -302,7 +302,7 @@ OddEgg2: bigdw 0 bigdw 0 bigdw 0 - db $0, $0 ; DVs + dn 0, 0, 0, 0 ; DVs db 30, 30, 10, 0 ; PP db 20 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -328,7 +328,7 @@ OddEgg2: bigdw 0 bigdw 0 bigdw 0 - db $2a, $aa ; DVs + dn 2, 10, 10, 10 ; DVs db 30, 30, 10, 0 ; PP db 20 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -354,7 +354,7 @@ OddEgg2: bigdw 0 bigdw 0 bigdw 0 - db $0, $0 ; DVs + dn 0, 0, 0, 0 ; DVs db 35, 10, 0, 0 ; PP db 20 ; Happiness db 0, 0, 0 ; Pokerus, Caught data @@ -380,7 +380,7 @@ OddEgg2: bigdw 0 bigdw 0 bigdw 0 - db $2a, $aa ; DVs + dn 2, 10, 10, 10 ; DVs db 35, 10, 0, 0 ; PP db 20 ; Happiness db 0, 0, 0 ; Pokerus, Caught data diff --git a/data/maps/landmarks.asm b/data/maps/landmarks.asm index d15e27ca6..d34b85987 100644 --- a/data/maps/landmarks.asm +++ b/data/maps/landmarks.asm @@ -1,107 +1,107 @@ landmark: MACRO ; x, y, name - db \1, \2 + db \1 + 8, \2 + 16 dw \3 ENDM Landmarks: ; entries correspond to constants/landmark_constants.asm - landmark 0, 0, SpecialMapName - landmark 148, 116, NewBarkTownName - landmark 136, 116, Route29Name - landmark 108, 116, CherrygroveCityName - landmark 108, 96, Route30Name - landmark 104, 76, Route31Name - landmark 92, 76, VioletCityName - landmark 93, 74, SproutTowerName - landmark 92, 108, Route32Name - landmark 84, 92, RuinsOfAlphName - landmark 92, 140, UnionCaveName - landmark 90, 140, Route33Name - landmark 76, 140, AzaleaTownName - landmark 78, 138, SlowpokeWellName - landmark 60, 136, IlexForestName - landmark 60, 128, Route34Name - landmark 60, 108, GoldenrodCityName - landmark 58, 108, RadioTowerName - landmark 60, 92, Route35Name - landmark 60, 76, NationalParkName - landmark 72, 76, Route36Name - landmark 76, 68, Route37Name - landmark 76, 60, EcruteakCityName - landmark 78, 58, TinTowerName - landmark 74, 58, BurnedTowerName - landmark 60, 60, Route38Name - landmark 44, 64, Route39Name - landmark 44, 76, OlivineCityName - landmark 46, 78, LighthouseName - landmark 36, 72, BattleTowerName - landmark 36, 80, Route40Name - landmark 36, 108, WhirlIslandsName - landmark 36, 116, Route41Name - landmark 28, 116, CianwoodCityName - landmark 100, 60, Route42Name - landmark 92, 60, MtMortarName - landmark 116, 60, MahoganyTownName - landmark 116, 52, Route43Name - landmark 116, 44, LakeOfRageName - landmark 128, 60, Route44Name - landmark 138, 54, IcePathName - landmark 140, 60, BlackthornCityName - landmark 140, 52, DragonsDenName - landmark 140, 80, Route45Name - landmark 120, 88, DarkCaveName - landmark 132, 104, Route46Name - landmark 156, 84, SilverCaveName - landmark 60, 124, PalletTownName - landmark 60, 108, Route1Name - landmark 60, 92, ViridianCityName - landmark 60, 80, Route2Name - landmark 60, 68, PewterCityName - landmark 72, 68, Route3Name - landmark 84, 68, MtMoonName - landmark 96, 68, Route4Name - landmark 108, 68, CeruleanCityName - landmark 108, 60, Route24Name - landmark 116, 52, Route25Name - landmark 108, 76, Route5Name - landmark 116, 92, UndergroundName - landmark 108, 92, Route6Name - landmark 108, 100, VermilionCityName - landmark 96, 76, DiglettsCaveName - landmark 96, 84, Route7Name - landmark 124, 84, Route8Name - landmark 124, 68, Route9Name - landmark 140, 68, RockTunnelName - landmark 140, 72, Route10Name - landmark 140, 76, PowerPlantName - landmark 140, 84, LavenderTownName - landmark 148, 84, LavRadioTowerName - landmark 84, 84, CeladonCityName - landmark 108, 84, SaffronCityName - landmark 124, 100, Route11Name - landmark 140, 96, Route12Name - landmark 132, 116, Route13Name - landmark 124, 128, Route14Name - landmark 112, 132, Route15Name - landmark 76, 84, Route16Name - landmark 76, 108, Route17Name - landmark 88, 132, Route18Name - landmark 100, 132, FuchsiaCityName - landmark 100, 144, Route19Name - landmark 84, 148, Route20Name - landmark 76, 148, SeafoamIslandsName - landmark 60, 148, CinnabarIslandName - landmark 60, 136, Route21Name - landmark 44, 84, Route22Name - landmark 36, 68, VictoryRoadName - landmark 36, 60, Route23Name - landmark 36, 52, IndigoPlateauName - landmark 36, 108, Route26Name - landmark 28, 116, Route27Name - landmark 20, 116, TohjoFallsName - landmark 28, 84, Route28Name - landmark 148, 132, FastShipName + dbbw 0, 0, SpecialMapName + landmark 140, 100, NewBarkTownName + landmark 128, 100, Route29Name + landmark 100, 100, CherrygroveCityName + landmark 100, 80, Route30Name + landmark 96, 60, Route31Name + landmark 84, 60, VioletCityName + landmark 85, 58, SproutTowerName + landmark 84, 92, Route32Name + landmark 76, 76, RuinsOfAlphName + landmark 84, 124, UnionCaveName + landmark 82, 124, Route33Name + landmark 68, 124, AzaleaTownName + landmark 70, 122, SlowpokeWellName + landmark 52, 120, IlexForestName + landmark 52, 112, Route34Name + landmark 52, 92, GoldenrodCityName + landmark 50, 92, RadioTowerName + landmark 52, 76, Route35Name + landmark 52, 60, NationalParkName + landmark 64, 60, Route36Name + landmark 68, 52, Route37Name + landmark 68, 44, EcruteakCityName + landmark 70, 42, TinTowerName + landmark 66, 42, BurnedTowerName + landmark 52, 44, Route38Name + landmark 36, 48, Route39Name + landmark 36, 60, OlivineCityName + landmark 38, 62, LighthouseName + landmark 28, 56, BattleTowerName + landmark 28, 64, Route40Name + landmark 28, 92, WhirlIslandsName + landmark 28, 100, Route41Name + landmark 20, 100, CianwoodCityName + landmark 92, 44, Route42Name + landmark 84, 44, MtMortarName + landmark 108, 44, MahoganyTownName + landmark 108, 36, Route43Name + landmark 108, 28, LakeOfRageName + landmark 120, 44, Route44Name + landmark 130, 38, IcePathName + landmark 132, 44, BlackthornCityName + landmark 132, 36, DragonsDenName + landmark 132, 64, Route45Name + landmark 112, 72, DarkCaveName + landmark 124, 88, Route46Name + landmark 148, 68, SilverCaveName + landmark 52, 108, PalletTownName + landmark 52, 92, Route1Name + landmark 52, 76, ViridianCityName + landmark 52, 64, Route2Name + landmark 52, 52, PewterCityName + landmark 64, 52, Route3Name + landmark 76, 52, MtMoonName + landmark 88, 52, Route4Name + landmark 100, 52, CeruleanCityName + landmark 100, 44, Route24Name + landmark 108, 36, Route25Name + landmark 100, 60, Route5Name + landmark 108, 76, UndergroundName + landmark 100, 76, Route6Name + landmark 100, 84, VermilionCityName + landmark 88, 60, DiglettsCaveName + landmark 88, 68, Route7Name + landmark 116, 68, Route8Name + landmark 116, 52, Route9Name + landmark 132, 52, RockTunnelName + landmark 132, 56, Route10Name + landmark 132, 60, PowerPlantName + landmark 132, 68, LavenderTownName + landmark 140, 68, LavRadioTowerName + landmark 76, 68, CeladonCityName + landmark 100, 68, SaffronCityName + landmark 116, 84, Route11Name + landmark 132, 80, Route12Name + landmark 124, 100, Route13Name + landmark 116, 112, Route14Name + landmark 104, 116, Route15Name + landmark 68, 68, Route16Name + landmark 68, 92, Route17Name + landmark 80, 116, Route18Name + landmark 92, 116, FuchsiaCityName + landmark 92, 128, Route19Name + landmark 76, 132, Route20Name + landmark 68, 132, SeafoamIslandsName + landmark 52, 132, CinnabarIslandName + landmark 52, 120, Route21Name + landmark 36, 68, Route22Name + landmark 28, 52, VictoryRoadName + landmark 28, 44, Route23Name + landmark 28, 36, IndigoPlateauName + landmark 28, 92, Route26Name + landmark 20, 100, Route27Name + landmark 12, 100, TohjoFallsName + landmark 20, 68, Route28Name + landmark 140, 116, FastShipName NewBarkTownName: db "NEW BARK¯TOWN@" CherrygroveCityName: db "CHERRYGROVE¯CITY@" diff --git a/data/mon_menu.asm b/data/mon_menu.asm index b6130a199..f2b9f3ac0 100644 --- a/data/mon_menu.asm +++ b/data/mon_menu.asm @@ -19,7 +19,7 @@ MonMenuOptionStrings: db "ERROR!@" MonMenuOptions: -; category, item, value; actions are in PokemonActionSubmenu (see engine/start_menu.asm) +; category, item, value; actions are in PokemonActionSubmenu (see engine/pokemon/mon_menu.asm) ; moves db MONMENU_FIELD_MOVE, MONMENUITEM_CUT, CUT db MONMENU_FIELD_MOVE, MONMENUITEM_FLY, FLY diff --git a/data/moves/animations.asm b/data/moves/animations.asm index cef14f5ab..95518af3d 100644 --- a/data/moves/animations.asm +++ b/data/moves/animations.asm @@ -4738,13 +4738,13 @@ BattleAnim_SludgeBomb_branch_cbc15: BattleAnim_Sludge_branch_cbc15: BattleAnim_Toxic_branch_cbc15: .loop - anim_sound 0, 1, SFX_UNKNOWN_7F + anim_sound 0, 1, SFX_TOXIC anim_obj ANIM_OBJ_1A, 132, 72, $0 anim_wait 8 - anim_sound 0, 1, SFX_UNKNOWN_7F + anim_sound 0, 1, SFX_TOXIC anim_obj ANIM_OBJ_1A, 116, 72, $0 anim_wait 8 - anim_sound 0, 1, SFX_UNKNOWN_7F + anim_sound 0, 1, SFX_TOXIC anim_obj ANIM_OBJ_1A, 148, 72, $0 anim_wait 8 anim_loop 5, .loop diff --git a/data/moves/critical_hit_moves.asm b/data/moves/critical_hit_moves.asm new file mode 100644 index 000000000..4a4730574 --- /dev/null +++ b/data/moves/critical_hit_moves.asm @@ -0,0 +1,9 @@ +CriticalHitMoves: + db KARATE_CHOP + db RAZOR_WIND + db RAZOR_LEAF + db CRABHAMMER + db SLASH + db AEROBLAST + db CROSS_CHOP + db -1 diff --git a/data/moves/effects.asm b/data/moves/effects.asm index 81bd89f5f..8e5b5c173 100644 --- a/data/moves/effects.asm +++ b/data/moves/effects.asm @@ -17,7 +17,7 @@ NormalHit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -47,7 +47,7 @@ PoisonHit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage poisontarget endmove @@ -68,7 +68,7 @@ LeechHit: criticaltext supereffectivetext draintarget - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -89,7 +89,7 @@ BurnHit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage burntarget endmove @@ -110,7 +110,7 @@ FreezeHit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage freezetarget endmove @@ -131,7 +131,7 @@ ParalyzeHit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage paralyzetarget endmove @@ -152,7 +152,7 @@ Selfdestruct: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -173,7 +173,7 @@ DreamEater: criticaltext supereffectivetext eatdream - checkdestinybond + checkfaint buildopponentrage endmove @@ -551,7 +551,7 @@ AttackDownHit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage attackdown statdownmessage @@ -573,7 +573,7 @@ DefenseDownHit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage effectchance ; bug: duplicate effectchance shouldn't be here defensedown @@ -596,7 +596,7 @@ SpeedDownHit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage speeddown statdownmessage @@ -618,7 +618,7 @@ SpecialAttackDownHit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage specialattackdown statdownmessage @@ -640,7 +640,7 @@ SpecialDefenseDownHit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage specialdefensedown statdownmessage @@ -662,7 +662,7 @@ AccuracyDownHit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage accuracydown statdownmessage @@ -684,7 +684,7 @@ EvasionDownHit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage evasiondown statdownmessage @@ -706,7 +706,7 @@ DefenseUpHit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage defenseup statupmessage @@ -728,7 +728,7 @@ AttackUpHit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage attackup statupmessage @@ -750,7 +750,7 @@ AllUpHit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage allstatsup endmove @@ -771,7 +771,7 @@ PayDay: criticaltext supereffectivetext payday - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -801,7 +801,7 @@ Bide: moveanim bidefailtext applydamage - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -824,7 +824,7 @@ Rampage: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -856,7 +856,7 @@ MultiHit: criticaltext cleartext supereffectivelooptext - checkdestinybond + checkfaint buildopponentrage endloop raisesub @@ -883,7 +883,7 @@ PoisonMultiHit: criticaltext cleartext supereffectivelooptext - checkdestinybond + checkfaint buildopponentrage endloop raisesub @@ -907,7 +907,7 @@ FlinchHit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage flinchtarget endmove @@ -923,7 +923,7 @@ OHKOHit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage endmove @@ -943,7 +943,7 @@ RecoilHit: criticaltext supereffectivetext recoil - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -987,7 +987,7 @@ ConfuseHit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage confusetarget endmove @@ -1029,7 +1029,7 @@ TriAttack: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage tristatuschance endmove @@ -1073,7 +1073,7 @@ SkyAttack: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage flinchtarget kingsrock @@ -1102,7 +1102,7 @@ HyperBeam: criticaltext supereffectivetext rechargenextturn - checkdestinybond + checkfaint buildopponentrage endmove @@ -1123,7 +1123,7 @@ Rage: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -1183,7 +1183,7 @@ RazorWind: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -1206,7 +1206,7 @@ Fly: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -1227,7 +1227,7 @@ TrapTarget: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage traptarget endmove @@ -1244,7 +1244,7 @@ StaticDamage: moveanim failuretext applydamage - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -1260,7 +1260,7 @@ Reversal: failuretext applydamage supereffectivetext - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -1273,7 +1273,7 @@ Counter: moveanim failuretext applydamage - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -1311,7 +1311,7 @@ Snore: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage flinchtarget kingsrock @@ -1385,7 +1385,7 @@ FalseSwipe: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -1417,7 +1417,7 @@ TripleKick: criticaltext cleartext supereffectivelooptext - checkdestinybond + checkfaint buildopponentrage kickcounter endloop @@ -1442,7 +1442,7 @@ Thief: criticaltext supereffectivetext thief - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -1478,7 +1478,7 @@ FlameWheel: criticaltext supereffectivetext defrost - checkdestinybond + checkfaint buildopponentrage burntarget endmove @@ -1550,7 +1550,7 @@ Rollout: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -1589,7 +1589,7 @@ FuryCutter: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -1618,7 +1618,7 @@ Return: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -1639,7 +1639,7 @@ Present: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -1660,7 +1660,7 @@ Frustration: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -1689,7 +1689,7 @@ SacredFire: criticaltext supereffectivetext defrost - checkdestinybond + checkfaint buildopponentrage burntarget endmove @@ -1711,7 +1711,7 @@ Magnitude: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -1739,7 +1739,7 @@ Pursuit: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -1760,7 +1760,7 @@ RapidSpin: criticaltext supereffectivetext clearhazards - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -1801,7 +1801,7 @@ HiddenPower: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -1852,7 +1852,7 @@ MirrorCoat: moveanim failuretext applydamage - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -1874,7 +1874,7 @@ SkullBash: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage kingsrock endturn @@ -1899,7 +1899,7 @@ Twister: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage flinchtarget endmove @@ -1921,7 +1921,7 @@ Earthquake: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage endmove @@ -1938,7 +1938,7 @@ FutureSight: moveanimnosub failuretext applydamage - checkdestinybond + checkfaint buildopponentrage endmove @@ -1958,7 +1958,7 @@ Gust: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage endmove @@ -1979,7 +1979,7 @@ Stomp: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage flinchtarget endmove @@ -2002,7 +2002,7 @@ Solarbeam: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage kingsrock endmove @@ -2024,7 +2024,7 @@ Thunder: applydamage criticaltext supereffectivetext - checkdestinybond + checkfaint buildopponentrage paralyzetarget endmove @@ -2055,7 +2055,7 @@ BeatUp: criticaltext cleartext supereffectivetext - checkdestinybond + checkfaint buildopponentrage endloop beatupfailtext diff --git a/data/battle/metronome_exception_moves.asm b/data/moves/metronome_exception_moves.asm index a5aa44132..a5aa44132 100644 --- a/data/battle/metronome_exception_moves.asm +++ b/data/moves/metronome_exception_moves.asm diff --git a/data/phone/non_trainer_names.asm b/data/phone/non_trainer_names.asm index d7648fa7f..1792c506a 100644 --- a/data/phone/non_trainer_names.asm +++ b/data/phone/non_trainer_names.asm @@ -12,4 +12,4 @@ NonTrainerCallerNames: .bill: db "BILL:@" .elm: db "PROF.ELM:@" .bikeshop: db "BIKE SHOP:@" -.buena: db "BUENA:<LNBRK> DISC JOCKEY@" +.buena: db "BUENA:<LF> DISC JOCKEY@" diff --git a/data/sprites/emotes.asm b/data/sprites/emotes.asm index 76ca2f0b9..2371c4624 100644 --- a/data/sprites/emotes.asm +++ b/data/sprites/emotes.asm @@ -2,20 +2,20 @@ emote: MACRO ; graphics pointer, length, starting tile dw \1 db \2 tiles, BANK(\1) - dw vTiles1 tile \3 + dw vTiles0 tile \3 ENDM Emotes: ; entries correspond to EMOTE_* constants - emote ShockEmote, 4, $78 - emote QuestionEmote, 4, $78 - emote HappyEmote, 4, $78 - emote SadEmote, 4, $78 - emote HeartEmote, 4, $78 - emote BoltEmote, 4, $78 - emote SleepEmote, 4, $78 - emote FishEmote, 4, $78 - emote JumpShadowGFX, 1, $7c - emote FishingRodGFX, 2, $7c - emote BoulderDustGFX, 2, $7e - emote GrassRustleGFX, 1, $7e + emote ShockEmote, 4, $f8 + emote QuestionEmote, 4, $f8 + emote HappyEmote, 4, $f8 + emote SadEmote, 4, $f8 + emote HeartEmote, 4, $f8 + emote BoltEmote, 4, $f8 + emote SleepEmote, 4, $f8 + emote FishEmote, 4, $f8 + emote JumpShadowGFX, 1, $fc + emote FishingRodGFX, 2, $fc + emote BoulderDustGFX, 2, $fe + emote GrassRustleGFX, 1, $fe diff --git a/data/text/battle.asm b/data/text/battle.asm index 97152ebbb..9ac62c122 100644 --- a/data/text/battle.asm +++ b/data/text/battle.asm @@ -87,7 +87,7 @@ SandstormHitsText: PerishCountText: text "<USER>'s" line "PERISH count is @" - deciram wd265, 1, 1 + deciram wDeciramBuffer, 1, 1 text "!" prompt @@ -669,7 +669,7 @@ SpiteEffectText: text_from_ram wStringBuffer1 text " was" cont "reduced by @" - deciram wd265, 1, 1 + deciram wDeciramBuffer, 1, 1 text "!" prompt @@ -1029,7 +1029,7 @@ SafeguardProtectText: MagnitudeText: text "Magnitude @" - deciram wd265, 1, 1 + deciram wDeciramBuffer, 1, 1 text "!" prompt diff --git a/data/text/common_1.asm b/data/text/common_1.asm index a6e867498..cf6e3ce8c 100644 --- a/data/text/common_1.asm +++ b/data/text/common_1.asm @@ -41,7 +41,7 @@ UnknownText_0x1bc0a2:: text_from_ram wStringBuffer1 text_start line "recovered @" - deciram wd1f3, 2, 3 + deciram wCurHPAnimDeltaHP, 2, 3 text "HP!" done @@ -93,7 +93,7 @@ UnknownText_0x1bc14f:: line "level @" deciram wCurPartyLevel, 1, 3 text "!@" - sound_dex_fanfare_50_79 + sound_dex_fanfare_50_79 ; plays SFX_DEX_FANFARE_50_79, identical to SFX_LEVEL_UP text_waitbutton db "@@" @@ -1155,7 +1155,7 @@ Text_BreedingIsNotPossible:: UnknownText_0x1bd0d8:: text "The compatibility" line "is @" - deciram wd265, 1, 3 + deciram wBreedingCompatibility, 1, 3 text "." cont "Should they breed?" done diff --git a/data/text/common_2.asm b/data/text/common_2.asm index 582d3b16f..679c207d8 100644 --- a/data/text/common_2.asm +++ b/data/text/common_2.asm @@ -262,7 +262,7 @@ UnknownText_0x1c0531:: text_from_ram wc850 text "'s CARD was" line "listed as no.@" - deciram wd265, 1, 2 + deciram wDeciramBuffer, 1, 2 text "." prompt diff --git a/data/tilesets.asm b/data/tilesets.asm index b652a01ad..b95c20f40 100644 --- a/data/tilesets.asm +++ b/data/tilesets.asm @@ -8,7 +8,7 @@ ENDM ; Associated data: ; - The *GFX, *Meta, and *Coll are defined in gfx/tilesets.asm ; - The *PalMap are defined in gfx/tileset_palette_maps.asm -; - The *Anim are defined in engine/tileset_anims.asm +; - The *Anim are defined in engine/tilesets/tileset_anims.asm Tilesets:: ; entries correspond to TILESET_* constants diff --git a/data/trainers/parties.asm b/data/trainers/parties.asm index 35de91e85..ad796da02 100644 --- a/data/trainers/parties.asm +++ b/data/trainers/parties.asm @@ -5,8 +5,8 @@ Trainers: ; - db "NAME@", TRAINERTYPE_* constant ; - 1 to 6 Pokémon: ; * for TRAINERTYPE_NORMAL: db level, species -; * for TRAINERTYPE_ITEM: db level, species, item ; * for TRAINERTYPE_MOVES: db level, species, 4 moves +; * for TRAINERTYPE_ITEM: db level, species, item ; * for TRAINERTYPE_ITEM_MOVES: db level, species, item, 4 moves ; - db -1 ; end diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md index 786c51ab3..33df631b2 100644 --- a/docs/bugs_and_glitches.md +++ b/docs/bugs_and_glitches.md @@ -2,11 +2,19 @@ These are known bugs and glitches in the original Pokémon Crystal game: code that clearly does not work as intended, or that only works in limited circumstances but has the possibility to fail or crash. +Fixes are written in the `diff` format. If you're familiar with git, this should look farmiliar: +```diff + this is some code +-delete red - lines ++add green + lines +``` + ## Contents -- [Thick Club and Light Ball can decrease damage done with boosted (Special) Attack](#thick-club-and-light-ball-can-decrease-damage-done-with-boosted-special-attack) +- [Thick Club and Light Ball can make (Special) Attack wrap around above 1024](#thick-club-and-light-ball-can-make-special-attack-wrap-around-above-1024) - [Metal Powder can increase damage taken with boosted (Special) Defense](#metal-powder-can-increase-damage-taken-with-boosted-special-defense) +- [Reflect and Light Screen can make (Special) Defense wrap around above 1024](#reflect-and-light-screen-can-make-special-defense-wrap-around-above-1024) - [Belly Drum sharply boosts Attack even with under 50% HP](#belly-drum-sharply-boosts-attack-even-with-under-50-hp) - [Confusion damage is affected by type-boosting items and Explosion/Self-Destruct doubling](#confusion-damage-is-affected-by-type-boosting-items-and-explosionself-destruct-doubling) - [Moves that lower Defense can do so after breaking a Substitute](#moves-that-lower-defense-can-do-so-after-breaking-a-substitute) @@ -15,7 +23,8 @@ These are known bugs and glitches in the original Pokémon Crystal game: code th - [A Pokémon that fainted from Pursuit will have its old status condition when revived](#a-pokémon-that-fainted-from-pursuit-will-have-its-old-status-condition-when-revived) - [Lock-On and Mind Reader don't always bypass Fly and Dig](#lock-on-and-mind-reader-dont-always-bypass-fly-and-dig) - [Beat Up can desynchronize link battles](#beat-up-can-desynchronize-link-battles) -- [Beat Up may fail to raise substitute](#beat-up-may-fail-to-raise-substitute) +- [Beat Up works incorrectly with only one Pokémon in the party](#beat-up-works-incorrectly-with-only-one-pokémon-in-the-party) +- [Beat Up may fail to raise Substitute](#beat-up-may-fail-to-raise-substitute) - [Beat Up may trigger King's Rock even if it failed](#beat-up-may-trigger-kings-rock-even-if-it-failed) - [Present damage is incorrect in link battles](#present-damage-is-incorrect-in-link-battles) - ["Smart" AI encourages Mean Look if its own Pokémon is badly poisoned](#smart-ai-encourages-mean-look-if-its-own-pokémon-is-badly-poisoned) @@ -55,43 +64,33 @@ These are known bugs and glitches in the original Pokémon Crystal game: code th - [`LoadSpriteGFX` does not limit the capacity of `UsedSprites`](#loadspritegfx-does-not-limit-the-capacity-of-usedsprites) - [`ChooseWildEncounter` doesn't really validate the wild Pokémon species](#choosewildencounter-doesnt-really-validate-the-wild-pokémon-species) - [`TryObjectEvent` arbitrary code execution](#tryobjectevent-arbitrary-code-execution) -- [`CheckBugContestContestantFlag` can read beyond its data table](#checkbugcontestcontestantflag-can-read-beyond-its-data-table) - [`ClearWRAM` only clears WRAM bank 1](#clearwram-only-clears-wram-bank-1) -## Thick Club and Light Ball can decrease damage done with boosted (Special) Attack +## Thick Club and Light Ball can make (Special) Attack wrap around above 1024 *Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.* ([Video](https://www.youtube.com/watch?v=rGqu3d3pdok&t=450)) -This is a bug with `SpeciesItemBoost` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm): - -```asm -; Double the stat - sla l - rl h - ret -``` - -**Fix:** - -```asm -; Double the stat - sla l - rl h - - ld a, HIGH(MAX_STAT_VALUE) - cp h - jr c, .cap - ld a, LOW(MAX_STAT_VALUE) - cp l - ret nc - -.cap - ld h, HIGH(MAX_STAT_VALUE) - ld l, LOW(MAX_STAT_VALUE) - ret +**Fix:** Edit `SpeciesItemBoost` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm) + +```diff + ; Double the stat + sla l + rl h ++ ++ ld a, HIGH(MAX_STAT_VALUE) ++ cp h ++ jr c, .cap ++ ld a, LOW(MAX_STAT_VALUE) ++ cp l ++ ret nc ++ ++.cap ++ ld h, HIGH(MAX_STAT_VALUE) ++ ld l, LOW(MAX_STAT_VALUE) + ret ``` @@ -101,57 +100,65 @@ This is a bug with `SpeciesItemBoost` in [engine/battle/effect_commands.asm](/en ([Video](https://www.youtube.com/watch?v=rGqu3d3pdok&t=450)) -This is a bug with `DittoMetalPowder` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm): +**Fix:** Edit `DittoMetalPowder` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm): + +```diff + ld a, c + srl a + add c + ld c, a + ret nc + + srl b + ld a, b + and a + jr nz, .done + inc b + .done + scf + rr c ++ ++ ld a, HIGH(MAX_STAT_VALUE) ++ cp b ++ jr c, .cap ++ ld a, LOW(MAX_STAT_VALUE) ++ cp c ++ ret nc ++ ++.cap ++ ld b, HIGH(MAX_STAT_VALUE) ++ ld c, LOW(MAX_STAT_VALUE) + ret +``` -```asm - ld a, c - srl a - add c - ld c, a - ret nc - srl b - ld a, b - and a - jr nz, .done - inc b -.done - scf - rr c - ret -``` +## Reflect and Light Screen can make (Special) Defense wrap around above 1024 -**Fix:** +*Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.* -```asm - ld a, c - srl a - add c - ld c, a - ret nc +This bug existed for all battles in Gold and Silver, and was only fixed for single-player battles in Crystal to preserve link compatibility. - srl b - ld a, b - and a - jr nz, .done - inc b -.done - scf - rr c - - ld a, HIGH(MAX_STAT_VALUE) - cp b - jr c, .cap - ld a, LOW(MAX_STAT_VALUE) - cp c - ret nc - -.cap - ld b, HIGH(MAX_STAT_VALUE) - ld c, LOW(MAX_STAT_VALUE) - ret +**Fix:** Edit `TruncateHL_BC` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm) + +```diff + .finish +- ld a, [wLinkMode] +- cp LINK_COLOSSEUM +- jr z, .done + ; If we go back to the loop point, + ; it's the same as doing this exact + ; same check twice. + ld a, h + or b + jr nz, .loop + +-.done + ld b, l + ret ``` +(This fix also affects Thick Club, Light Ball, and Metal Powder, as described above, but their specific fixes in the above bugs allow more accurate damage calculations.) + ## Belly Drum sharply boosts Attack even with under 50% HP @@ -159,37 +166,27 @@ This is a bug with `DittoMetalPowder` in [engine/battle/effect_commands.asm](/en ([Video](https://www.youtube.com/watch?v=zuCLMikWo4Y)) -This is a bug with `BattleCommand_BellyDrum` in [engine/battle/move_effects/belly_drum.asm](/engine/battle/move_effects/belly_drum.asm): - -```asm -BattleCommand_BellyDrum: -; bellydrum -; This command is buggy because it raises the user's attack -; before checking that it has enough HP to use the move. -; Swap the order of these two blocks to fix. - call BattleCommand_AttackUp2 - ld a, [wAttackMissed] - and a - jr nz, .failed - - callfar GetHalfMaxHP - callfar CheckUserHasEnoughHP - jr nc, .failed -``` - -**Fix:** - -```asm -BattleCommand_BellyDrum: -; bellydrum - callfar GetHalfMaxHP - callfar CheckUserHasEnoughHP - jr nc, .failed - - call BattleCommand_AttackUp2 - ld a, [wAttackMissed] - and a - jr nz, .failed +**Fix:** Edit `BattleCommand_BellyDrum` in [engine/battle/move_effects/belly_drum.asm](/engine/battle/move_effects/belly_drum.asm): + +```diff + BattleCommand_BellyDrum: + ; bellydrum +-; This command is buggy because it raises the user's attack +-; before checking that it has enough HP to use the move. +-; Swap the order of these two blocks to fix. +- call BattleCommand_AttackUp2 +- ld a, [wAttackMissed] +- and a +- jr nz, .failed +- + callfar GetHalfMaxHP + callfar CheckUserHasEnoughHP + jr nc, .failed ++ ++ call BattleCommand_AttackUp2 ++ ld a, [wAttackMissed] ++ and a ++ jr nz, .failed ``` @@ -210,35 +207,33 @@ BattleCommand_BellyDrum: This bug affects Acid, Iron Tail, and Rock Smash. -This is a bug with `DefenseDownHit` in [data/moves/effects.asm](/data/moves/effects.asm): - -```asm -DefenseDownHit: - checkobedience - usedmovetext - doturn - critical - damagestats - damagecalc - stab - damagevariation - checkhit - effectchance - hittarget - failuretext - checkfaint - criticaltext - supereffectivetext - checkdestinybond - buildopponentrage - effectchance ; bug: duplicate effectchance shouldn't be here - defensedown - statdownmessage - endmove +**Fix:** Edit `DefenseDownHit` in [data/moves/effects.asm](/data/moves/effects.asm): + +```diff + DefenseDownHit: + checkobedience + usedmovetext + doturn + critical + damagestats + damagecalc + stab + damagevariation + checkhit + effectchance + hittarget + failuretext + checkfaint + criticaltext + supereffectivetext + checkfaint + buildopponentrage +- effectchance ; bug: duplicate effectchance shouldn't be here + defensedown + statdownmessage + endmove ``` -**Fix:** Delete the second `effectchance`. - ## Counter and Mirror Coat still work if the opponent uses an item @@ -246,7 +241,26 @@ DefenseDownHit: ([Video](https://www.youtube.com/watch?v=uRYyzKRatFk)) -*To do:* Identify specific code causing this bug and fix it. +**Fix:** Edit `BattleCommand_Counter` in [engine/battle/move_effects/counter.asm](/engine/battle/move_effects/counter.asm) and `BattleCommand_MirrorCoat` in [engine/battle/move_effects/mirror_coat.asm](/engine/battle/move_effects/mirror_coat.asm): + +```diff +- ; BUG: Move should fail with all non-damaging battle actions + ld hl, wCurDamage + ld a, [hli] + or [hl] +- ret z ++ jp z, .failed +``` + +Add this to the end of each file: + +```diff ++.failed ++ ld a, 1 ++ ld [wEffectFailed], a ++ and a ++ ret +``` ## A Disabled but PP Up–enhanced move may not trigger Struggle @@ -255,25 +269,24 @@ DefenseDownHit: ([Video](https://www.youtube.com/watch?v=1v9x4SgMggs)) -This is a bug with `CheckPlayerHasUsableMoves` in [engine/battle/core.asm](/engine/battle/core.asm): - -```asm -.done - ; Bug: this will result in a move with PP Up confusing the game. - and a ; should be "and PP_MASK" - ret nz - -.force_struggle - ld hl, BattleText_MonHasNoMovesLeft - call StdBattleTextBox - ld c, 60 - call DelayFrames - xor a - ret +**Fix:** Edit `CheckPlayerHasUsableMoves` in [engine/battle/core.asm](/engine/battle/core.asm): + +```diff + .done +- ; Bug: this will result in a move with PP Up confusing the game. +- and a ; should be "and PP_MASK" ++ and PP_MASK + ret nz + + .force_struggle + ld hl, BattleText_MonHasNoMovesLeft + call StdBattleTextBox + ld c, 60 + call DelayFrames + xor a + ret ``` -**Fix:** Change `and a` to `and PP_MASK`. - ## A Pokémon that fainted from Pursuit will have its old status condition when revived @@ -290,19 +303,18 @@ This is a bug with `CheckPlayerHasUsableMoves` in [engine/battle/core.asm](/engi This bug affects Attract, Curse, Foresight, Mean Look, Mimic, Nightmare, Spider Web, Transform, and stat-lowering effects of moves like String Shot or Bubble during the semi-invulnerable turn of Fly or Dig. -This is a bug with `CheckHiddenOpponent` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm): +**Fix:** Edit `CheckHiddenOpponent` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm): -```asm -CheckHiddenOpponent: -; BUG: This routine should account for Lock-On and Mind Reader. - ld a, BATTLE_VARS_SUBSTATUS3_OPP - call GetBattleVar - and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND - ret +```diff + CheckHiddenOpponent: +-; BUG: This routine is completely redundant and introduces a bug, since BattleCommand_CheckHit does these checks properly. +- ld a, BATTLE_VARS_SUBSTATUS3_OPP +- call GetBattleVar +- and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND ++ xor a + ret ``` -*To do:* Fix this bug. - ## Beat Up can desynchronize link battles @@ -310,110 +322,110 @@ CheckHiddenOpponent: ([Video](https://www.youtube.com/watch?v=202-iAsrIa8)) -This is a bug with `BattleCommand_BeatUp` in [engine/battle/move_effects/beat_up.asm](/engine/battle/move_effects/beat_up.asm): - -```asm -.got_mon - ld a, [wd002] - ld hl, wPartyMonNicknames - call GetNick - ld a, MON_HP - call GetBeatupMonLocation - ld a, [hli] - or [hl] - jp z, .beatup_fail ; fainted - ld a, [wd002] - ld c, a - ld a, [wCurBattleMon] - ; BUG: this can desynchronize link battles - ; Change "cp [hl]" to "cp c" to fix - cp [hl] - ld hl, wBattleMonStatus - jr z, .active_mon - ld a, MON_STATUS - call GetBeatupMonLocation -.active_mon - ld a, [hl] - and a - jp nz, .beatup_fail +**Fix:** Edit `BattleCommand_BeatUp` in [engine/battle/move_effects/beat_up.asm](/engine/battle/move_effects/beat_up.asm): + +```diff + .got_mon + ld a, [wd002] + ld hl, wPartyMonNicknames + call GetNick + ld a, MON_HP + call GetBeatupMonLocation + ld a, [hli] + or [hl] + jp z, .beatup_fail ; fainted + ld a, [wd002] + ld c, a + ld a, [wCurBattleMon] +- ; BUG: this can desynchronize link battles +- ; Change "cp [hl]" to "cp c" to fix +- cp [hl] ++ cp c + ld hl, wBattleMonStatus + jr z, .active_mon + ld a, MON_STATUS + call GetBeatupMonLocation + .active_mon + ld a, [hl] + and a + jp nz, .beatup_fail ``` -**Fix:** Change `cp [hl]` to `cp c`. +## Beat Up works incorrectly with only one Pokémon in the party -## Beat Up may fail to raise substitute +*Fixing this bug may break compatibility with standard Pokémon Crystal for link battles.* -*Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.* -(Only the fixes denoted with "breaking" will actually break compatibility, the others just affect what's shown on the screen with the patched game) +This bug prevents the rest of Beat Up's effect from being executed if the player or enemy only has one Pokémon in their party while using it. It prevents Substitute from being raised and King's Rock from working. -This is a bug in `BattleCommand_EndLoop` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm) that prevents the rest of the move's effect from being executed if the player or enemy only has one mon in their party while using Beat Up. +**Fix:** Edit `BattleCommand_EndLoop` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm): -It prevents the substitute from being raised and the King's Rock from working. - -```asm -.only_one_beatup - ld a, BATTLE_VARS_SUBSTATUS3 - call GetBattleVarAddr - res SUBSTATUS_IN_LOOP, [hl] - call BattleCommand_BeatUpFailText - jp EndMoveEffect +```diff + .only_one_beatup + ld a, BATTLE_VARS_SUBSTATUS3 + call GetBattleVarAddr + res SUBSTATUS_IN_LOOP, [hl] +- call BattleCommand_BeatUpFailText +- jp EndMoveEffect ++ ret ``` -**Fix (breaking):** Replace the last two lines with `ret`. -**Fix (cosmetics):** Call `BattleCommand_RaiseSub` before the `jp`. - -There's a similar oversight in `BattleCommand_FailureText` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm) that will prevent the substitute from being raised if Beat Up is protected against. +**Cosmetic fix:** This fix does not break compatibility, but it only affects what's shown on the screen for the patched game. -```asm - cp EFFECT_MULTI_HIT - jr z, .multihit - cp EFFECT_DOUBLE_HIT - jr z, .multihit - cp EFFECT_POISON_MULTI_HIT - jr z, .multihit - jp EndMoveEffect - -.multihit - call BattleCommand_RaiseSub - jp EndMoveEffect +```diff + .only_one_beatup + ld a, BATTLE_VARS_SUBSTATUS3 + call GetBattleVarAddr + res SUBSTATUS_IN_LOOP, [hl] + call BattleCommand_BeatUpFailText ++ call BattleCommand_RaiseSub + jp EndMoveEffect ``` -**Fix:** Check for `EFFECT_BEAT_UP` as well. +## Beat Up may fail to raise Substitute -## Beat Up may trigger King's Rock even if it failed +This bug prevents Substitute from being raised if Beat Up was blocked by Protect or Detect. -*Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.* +**Fix:** Edit `BattleCommand_FailureText` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm). -This is a bug in how `wAttackMissed` is never set by BeatUp, even when none of the 'mon have been able to attack (due to being fainted or having a status effect), the King's Rock may activate. +```diff + cp EFFECT_MULTI_HIT + jr z, .multihit + cp EFFECT_DOUBLE_HIT + jr z, .multihit + cp EFFECT_POISON_MULTI_HIT + jr z, .multihit ++ cp EFFECT_BEAT_UP ++ jr z, .multihit + jp EndMoveEffect -This bug can be fixed in a plethora of ways, but the most straight-forward would be in `BattleCommand_BeatUpFailText` in [engine/battle/move_effects/beat_up.asm](/engine/battle/move_effects/beat_up.asm), as that's always ran before the king's rock effect. + .multihit + call BattleCommand_RaiseSub + jp EndMoveEffect +``` -```asm -BattleCommand_BeatUpFailText: -; beatupfailtext - ld a, [wBeatUpHitAtLeastOnce] - and a - ret nz +## Beat Up may trigger King's Rock even if it failed - jp PrintButItFailed -``` +*Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.* -**Fix:** +This bug is caused because Beat Up never sets `wAttackMissed`, even when no Pokémon was able to attack (due to being fainted or having a status condition). -```asm -BattleCommand_BeatUpFailText: -; beatupfailtext +**Fix:** Edit `BattleCommand_BeatUpFailText` in [engine/battle/move_effects/beat_up.asm](/engine/battle/move_effects/beat_up.asm): - ld a, [wBeatUpHitAtLeastOnce] - and a - ret nz +```diff + BattleCommand_BeatUpFailText: + ; beatupfailtext - inc a - ld [wAttackMissed], a + ld a, [wBeatUpHitAtLeastOnce] + and a + ret nz ++ ++ inc a ++ ld [wAttackMissed], a - jp PrintButItFailed + jp PrintButItFailed ``` @@ -425,40 +437,27 @@ BattleCommand_BeatUpFailText: This bug existed for all battles in Gold and Silver, and was only fixed for single-player battles in Crystal to preserve link compatibility. -This is a bug with `BattleCommand_Present` in [engine/battle/move_effects/present.asm](/engine/battle/move_effects/present.asm): - -```asm -BattleCommand_Present: -; present - - ld a, [wLinkMode] - cp LINK_COLOSSEUM - jr z, .colosseum_skippush - push bc - push de -.colosseum_skippush - - call BattleCommand_Stab - - ld a, [wLinkMode] - cp LINK_COLOSSEUM - jr z, .colosseum_skippop - pop de - pop bc -.colosseum_skippop -``` - -**Fix:** +**Fix:** Edit `BattleCommand_Present` in [engine/battle/move_effects/present.asm](/engine/battle/move_effects/present.asm): -```asm -BattleCommand_Present: -; present +```diff + BattleCommand_Present: + ; present - push bc - push de +- ld a, [wLinkMode] +- cp LINK_COLOSSEUM +- jr z, .colosseum_skippush + push bc + push de +-.colosseum_skippush +- call BattleCommand_Stab - pop de - pop bc +- +- ld a, [wLinkMode] +- cp LINK_COLOSSEUM +- jr z, .colosseum_skippop + pop de + pop bc +-.colosseum_skippop ``` @@ -466,22 +465,22 @@ BattleCommand_Present: ([Video](https://www.youtube.com/watch?v=cygMO-zHTls)) -This is a bug with `AI_Smart_MeanLook` in [engine/battle/ai/scoring.asm](/engine/battle/ai/scoring.asm): +**Fix:** Edit `AI_Smart_MeanLook` in [engine/battle/ai/scoring.asm](/engine/battle/ai/scoring.asm): -```asm -; 80% chance to greatly encourage this move if the enemy is badly poisoned (buggy). -; Should check wPlayerSubStatus5 instead. - ld a, [wEnemySubStatus5] - bit SUBSTATUS_TOXIC, a - jr nz, .asm_38e26 +```diff +-; 80% chance to greatly encourage this move if the enemy is badly poisoned (buggy). +-; Should check wPlayerSubStatus5 instead. +- ld a, [wEnemySubStatus5] ++; 80% chance to greatly encourage this move if the player is badly poisoned ++ ld a, [wPlayerSubStatus5] + bit SUBSTATUS_TOXIC, a + jr nz, .asm_38e26 ``` -**Fix:** Change `wEnemySubStatus5` to `wPlayerSubStatus5`. - ## AI makes a false assumption about `CheckTypeMatchup` -In [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm): +In [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm). ```asm BattleCheckTypeMatchup: @@ -512,83 +511,81 @@ CheckTypeMatchup: ([Video](https://www.youtube.com/watch?v=rGqu3d3pdok&t=322)) -This is a bug with `AI_HealStatus` in [engine/battle/ai/items.asm](/engine/battle/ai/items.asm): - -```asm -AI_HealStatus: - ld a, [wCurOTMon] - ld hl, wOTPartyMon1Status - ld bc, PARTYMON_STRUCT_LENGTH - call AddNTimes - xor a - ld [hl], a - ld [wEnemyMonStatus], a - ; Bug: this should reset SUBSTATUS_NIGHTMARE too - ; Uncomment the lines below to fix - ; ld hl, wEnemySubStatus1 - ; res SUBSTATUS_NIGHTMARE, [hl] - ld hl, wEnemySubStatus5 - res SUBSTATUS_TOXIC, [hl] - ret +**Fix:** Edit `AI_HealStatus` in [engine/battle/ai/items.asm](/engine/battle/ai/items.asm): + +```diff + AI_HealStatus: + ld a, [wCurOTMon] + ld hl, wOTPartyMon1Status + ld bc, PARTYMON_STRUCT_LENGTH + call AddNTimes + xor a + ld [hl], a + ld [wEnemyMonStatus], a +- ; Bug: this should reset SUBSTATUS_NIGHTMARE too +- ; Uncomment the lines below to fix +- ; ld hl, wEnemySubStatus1 +- ; res SUBSTATUS_NIGHTMARE, [hl] ++ ld hl, wEnemySubStatus1 ++ res SUBSTATUS_NIGHTMARE, [hl] + ld hl, wEnemySubStatus5 + res SUBSTATUS_TOXIC, [hl] + ret ``` -**Fix:** Uncomment `ld hl, wEnemySubStatus1` and `res SUBSTATUS_NIGHTMARE, [hl]`. - ## HP bar animation is slow for high HP ([Video](https://www.youtube.com/watch?v=SE-BfsFgZVM)) -This is a bug with `LongAnim_UpdateVariables` in [engine/battle/anim_hp_bar.asm](/engine/battle/anim_hp_bar.asm): - -```asm - ; This routine is buggy. The result from ComputeHPBarPixels is stored - ; in e. However, the pop de opcode deletes this result before it is even - ; used. The game then proceeds as though it never deleted that output. - ; To fix, uncomment the line below. - call ComputeHPBarPixels - ; ld a, e - pop bc - pop de - pop hl - ld a, e ; Comment or delete this line to fix the above bug. - ld hl, wCurHPBarPixels - cp [hl] - jr z, .loop - ld [hl], a - and a - ret +**Fix:** Edit `LongAnim_UpdateVariables` in [engine/battle/anim_hp_bar.asm](/engine/battle/anim_hp_bar.asm): + +```diff +- ; This routine is buggy. The result from ComputeHPBarPixels is stored +- ; in e. However, the pop de opcode deletes this result before it is even +- ; used. The game then proceeds as though it never deleted that output. +- ; To fix, uncomment the line below. + call ComputeHPBarPixels +- ; ld a, e ++ ld a, e + pop bc + pop de + pop hl +- ld a, e ; Comment or delete this line to fix the above bug. + ld hl, wCurHPBarPixels + cp [hl] + jr z, .loop + ld [hl], a + and a + ret ``` -**Fix:** Move `ld a, e` to right after `call ComputeHPBarPixels`. - ## HP bar animation off-by-one error for low HP ([Video](https://www.youtube.com/watch?v=9KyNVIZxJvI)) -This is a bug with `ShortHPBar_CalcPixelFrame` in [engine/battle/anim_hp_bar.asm](/engine/battle/anim_hp_bar.asm): - -```asm - ld b, 0 -; This routine is buggy. If [wCurHPAnimMaxHP] * [wCurHPBarPixels] is -; divisible by HP_BAR_LENGTH_PX, the loop runs one extra time. -; To fix, uncomment the line below. -.loop - ld a, l - sub HP_BAR_LENGTH_PX - ld l, a - ld a, h - sbc $0 - ld h, a - ; jr z, .done - jr c, .done - inc b - jr .loop +**Fix:** Edit `ShortHPBar_CalcPixelFrame` in [engine/battle/anim_hp_bar.asm](/engine/battle/anim_hp_bar.asm): + +```diff + ld b, 0 +-; This routine is buggy. If [wCurHPAnimMaxHP] * [wCurHPBarPixels] is +-; divisible by HP_BAR_LENGTH_PX, the loop runs one extra time. +-; To fix, uncomment the line below. + .loop + ld a, l + sub HP_BAR_LENGTH_PX + ld l, a + ld a, h + sbc $0 + ld h, a +- ; jr z, .done ++ jr z, .done + jr c, .done + inc b + jr .loop ``` -**Fix:** Uncomment `jr z, .done`. - ## Experience underflow for level 1 Pokémon with Medium-Slow growth rate @@ -596,45 +593,31 @@ This is a bug with `ShortHPBar_CalcPixelFrame` in [engine/battle/anim_hp_bar.asm This can bring Pokémon straight from level 1 to 100 by gaining just a few experience points. -This is a bug with `CalcExpAtLevel` in [engine/pokemon/experience.asm](/engine/pokemon/experience.asm): - -```asm -CalcExpAtLevel: -; (a/b)*n**3 + c*n**2 + d*n - e - ld a, [wBaseGrowthRate] - add a - add a - ld c, a - ld b, 0 - ld hl, GrowthRates - add hl, bc -``` - -**Fix:** - -```asm -CalcExpAtLevel: -; (a/b)*n**3 + c*n**2 + d*n - e - ld a, d - cp 1 - jr nz, .UseExpFormula -; Pokémon have 0 experience at level 1 - xor a - ld hl, hProduct - ld [hli], a - ld [hli], a - ld [hli], a - ld [hl], a - ret - -.UseExpFormula - ld a, [wBaseGrowthRate] - add a - add a - ld c, a - ld b, 0 - ld hl, GrowthRates - add hl, bc +**Fix:** Edit `CalcExpAtLevel` in [engine/pokemon/experience.asm](/engine/pokemon/experience.asm): + +```diff + CalcExpAtLevel: + ; (a/b)*n**3 + c*n**2 + d*n - e ++ ld a, d ++ cp 1 ++ jr nz, .UseExpFormula ++; Pokémon have 0 experience at level 1 ++ xor a ++ ld hl, hProduct ++ ld [hli], a ++ ld [hli], a ++ ld [hli], a ++ ld [hl], a ++ ret ++ + +.UseExpFormula + ld a, [wBaseGrowthRate] + add a + add a + ld c, a + ld b, 0 + ld hl, GrowthRates + add hl, bc ``` @@ -642,151 +625,128 @@ CalcExpAtLevel: ([Video](https://www.youtube.com/watch?v=o54VjpAEoO8)) -This is a bug with `Text_ABoostedStringBuffer2ExpPoints` and `Text_StringBuffer2ExpPoints` in [data/text/common_2.asm](/data/text/common_2.asm): - -```asm -Text_ABoostedStringBuffer2ExpPoints:: - text_start - line "a boosted" - cont "@" - deciram wStringBuffer2, 2, 4 - text " EXP. Points!" - prompt - -Text_StringBuffer2ExpPoints:: - text_start - line "@" - deciram wStringBuffer2, 2, 4 - text " EXP. Points!" - prompt +**Fix:** Edit `Text_ABoostedStringBuffer2ExpPoints` and `Text_StringBuffer2ExpPoints` in [data/text/common_2.asm](/data/text/common_2.asm): + +```diff + Text_ABoostedStringBuffer2ExpPoints:: + text_start + line "a boosted" + cont "@" +- deciram wStringBuffer2, 2, 4 ++ deciram wStringBuffer2, 2, 5 + text " EXP. Points!" + prompt + + Text_StringBuffer2ExpPoints:: + text_start + line "@" +- deciram wStringBuffer2, 2, 4 ++ deciram wStringBuffer2, 2, 5 + text " EXP. Points!" + prompt ``` -**Fix:** Change both `deciram wStringBuffer2, 2, 4` to `deciram wStringBuffer2, 2, 5`. - ## BRN/PSN/PAR do not affect catch rate -This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm): - -```asm -; This routine is buggy. It was intended that SLP and FRZ provide a higher -; catch rate than BRN/PSN/PAR, which in turn provide a higher catch rate than -; no status effect at all. But instead, it makes BRN/PSN/PAR provide no -; benefit. -; Uncomment the line below to fix this. - ld b, a - ld a, [wEnemyMonStatus] - and 1 << FRZ | SLP - ld c, 10 - jr nz, .addstatus - ; ld a, [wEnemyMonStatus] - and a - ld c, 5 - jr nz, .addstatus - ld c, 0 -.addstatus - ld a, b - add c - jr nc, .max_1 - ld a, $ff -.max_1 +**Fix:** Edit `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm): + +```diff +-; This routine is buggy. It was intended that SLP and FRZ provide a higher +-; catch rate than BRN/PSN/PAR, which in turn provide a higher catch rate than +-; no status effect at all. But instead, it makes BRN/PSN/PAR provide no +-; benefit. +-; Uncomment the line below to fix this. + ld b, a + ld a, [wEnemyMonStatus] + and 1 << FRZ | SLP + ld c, 10 + jr nz, .addstatus +- ; ld a, [wEnemyMonStatus] ++ ld a, [wEnemyMonStatus] + and a + ld c, 5 + jr nz, .addstatus + ld c, 0 + .addstatus + ld a, b + add c + jr nc, .max_1 + ld a, $ff + .max_1 ``` -**Fix:** Uncomment `ld a, [wEnemyMonStatus]`. - ## Moon Ball does not boost catch rate -This is a bug with `MoonBallMultiplier` in [items/item_effects.asm](/items/item_effects.asm): - -```asm -MoonBallMultiplier: -; This function is buggy. -; Intent: multiply catch rate by 4 if mon evolves with moon stone -; Reality: no boost - -... - -; Moon Stone's constant from Pokémon Red is used. -; No Pokémon evolve with Burn Heal, -; so Moon Balls always have a catch rate of 1×. - push bc - ld a, BANK("Evolutions and Attacks") - call GetFarByte - cp MOON_STONE_RED ; BURN_HEAL - pop bc - ret nz +**Fix:** Edit `MoonBallMultiplier` in [items/item_effects.asm](/items/item_effects.asm): + +```diff +-; Moon Stone's constant from Pokémon Red is used. +-; No Pokémon evolve with Burn Heal, +-; so Moon Balls always have a catch rate of 1×. + push bc + ld a, BANK("Evolutions and Attacks") + call GetFarByte +- cp MOON_STONE_RED ; BURN_HEAL ++ cp MOON_STONE + pop bc + ret nz ``` -**Fix:** Change `MOON_STONE_RED` to `MOON_STONE`. - ## Love Ball boosts catch rate for the wrong gender -This is a bug with `LoveBallMultiplier` in [items/item_effects.asm](/items/item_effects.asm): +**Fix:** Edit `LoveBallMultiplier` in [items/item_effects.asm](/items/item_effects.asm): -```asm -LoveBallMultiplier: -; This function is buggy. -; Intent: multiply catch rate by 8 if mons are of same species, different sex -; Reality: multiply catch rate by 8 if mons are of same species, same sex - -... +```diff + .wildmale - ld a, d - pop de - cp d - pop bc - ret nz ; for the intended effect, this should be "ret z" + ld a, d + pop de + cp d + pop bc +- ret nz ; for the intended effect, this should be "ret z" ++ ret z ``` -**Fix:** Change `ret nz` to `ret z`. - ## Fast Ball only boosts catch rate for three Pokémon -This is a bug with `FastBallMultiplier` in [items/item_effects.asm](/items/item_effects.asm): - -```asm -FastBallMultiplier: -; This function is buggy. -; Intent: multiply catch rate by 4 if enemy mon is in one of the three -; FleeMons tables. -; Reality: multiply catch rate by 4 if enemy mon is one of the first three in -; the first FleeMons table. - -... - - inc hl - cp -1 - jr z, .next - cp c - jr nz, .next ; for the intended effect, this should be "jr nz, .loop" - sla b - jr c, .max +**Fix:** Edit `FastBallMultiplier` in [items/item_effects.asm](/items/item_effects.asm): + +```diff + .loop + ld a, BANK(FleeMons) + call GetFarByte + + inc hl + cp -1 + jr z, .next + cp c +- jr nz, .next ; for the intended effect, this should be "jr nz, .loop" ++ jr nz, .loop + sla b + jr c, .max ``` -**Fix:** Change `jr nz, .next` to `jr nz, .loop`. - ## Dragon Scale, not Dragon Fang, boosts Dragon-type moves *Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.* -This is a bug with `ItemAttributes` in [data/items/attributes.asm](/data/items/attributes.asm): +**Fix:** Edit `ItemAttributes` in [data/items/attributes.asm](/data/items/attributes.asm): -```asm -; DRAGON_FANG - item_attribute 100, 0, 0, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE - -... - -; DRAGON_SCALE - item_attribute 2100, HELD_DRAGON_BOOST, 10, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE +```diff + ; DRAGON_FANG +- item_attribute 100, HELD_NONE, 0, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE ++ item_attribute 100, HELD_DRAGON_BOOST, 0, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE + ... + ; DRAGON_SCALE +- item_attribute 2100, HELD_DRAGON_BOOST, 10, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE ++ item_attribute 2100, HELD_NONE, 10, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE ``` -**Fix:** Move `HELD_DRAGON_BOOST` to the `DRAGON_FANG` attributes and `0` to `DRAGON_SCALE`. - ## Daisy's grooming doesn't always increase happiness @@ -827,273 +787,344 @@ CopyPokemonName_Buffer1_Buffer3: jp CopyBytes ``` -In [data/events/happiness_probabilities.asm](/data/events/happiness_probabilities.asm): +**Fix:** Edit [data/events/happiness_probabilities.asm](/data/events/happiness_probabilities.asm): -```asm -HappinessData_DaisysGrooming: - db $ff, 2, HAPPINESS_GROOMING ; 99.6% chance -``` - -**Fix:** - -```asm -HappinessData_DaisysGrooming: - db $80, 2, HAPPINESS_GROOMING ; 50% chance - db $ff, 2, HAPPINESS_GROOMING ; 50% chance +```diff + HappinessData_DaisysGrooming: +- db $ff, 2, HAPPINESS_GROOMING ; 99.6% chance ++ db $80, 2, HAPPINESS_GROOMING ; 50% chance ++ db $ff, 2, HAPPINESS_GROOMING ; 50% chance ``` ## Magikarp in Lake of Rage are shorter, not longer -This is a bug with `LoadEnemyMon.CheckMagikarpArea` in [engine/battle/core.asm](/engine/battle/core.asm): - -```asm -.CheckMagikarpArea: -; The "jr z" checks are supposed to be "jr nz". - -; Instead, all maps in GROUP_LAKE_OF_RAGE (Mahogany area) -; and Routes 20 and 44 are treated as Lake of Rage. - -; This also means Lake of Rage Magikarp can be smaller than ones -; caught elsewhere rather than the other way around. - -; Intended behavior enforces a minimum size at Lake of Rage. -; The real behavior prevents a minimum size in the Lake of Rage area. - -; Moreover, due to the check not being translated to feet+inches, all Magikarp -; smaller than 4'0" may be caught by the filter, a lot more than intended. - ld a, [wMapGroup] - cp GROUP_LAKE_OF_RAGE - jr z, .Happiness - ld a, [wMapNumber] - cp MAP_LAKE_OF_RAGE - jr z, .Happiness +**Fix:** Edit `LoadEnemyMon.CheckMagikarpArea` in [engine/battle/core.asm](/engine/battle/core.asm): + +```diff + .CheckMagikarpArea: +-; The "jr z" checks are supposed to be "jr nz". +- +-; Instead, all maps in GROUP_LAKE_OF_RAGE (Mahogany area) +-; and Routes 20 and 44 are treated as Lake of Rage. +- +-; This also means Lake of Rage Magikarp can be smaller than ones +-; caught elsewhere rather than the other way around. +- +-; Intended behavior enforces a minimum size at Lake of Rage. +-; The real behavior prevents a minimum size in the Lake of Rage area. +- +-; Moreover, due to the check not being translated to feet+inches, all Magikarp +-; smaller than 4'0" may be caught by the filter, a lot more than intended. + ld a, [wMapGroup] + cp GROUP_LAKE_OF_RAGE +- jr z, .Happiness ++ jr nz, .Happiness + ld a, [wMapNumber] + cp MAP_LAKE_OF_RAGE +- jr z, .Happiness ++ jr nz, .Happiness ``` -**Fix:** Change both `jr z, .Happiness` to `jr nz, .Happiness`. - ## Magikarp length limits have a unit conversion error -This is a bug with `LoadEnemyMon.CheckMagikarpArea` in [engine/battle/core.asm](/engine/battle/core.asm): - -```asm -; Get Magikarp's length - ld de, wEnemyMonDVs - ld bc, wPlayerID - callfar CalcMagikarpLength - -; No reason to keep going if length > 1536 mm (i.e. if HIGH(length) > 6 feet) - ld a, [wMagikarpLength] - cp HIGH(1536) ; should be "cp 5", since 1536 mm = 5'0", but HIGH(1536) = 6 - jr nz, .CheckMagikarpArea - -; 5% chance of skipping both size checks - call Random - cp 5 percent - jr c, .CheckMagikarpArea -; Try again if length >= 1616 mm (i.e. if LOW(length) >= 3 inches) - ld a, [wMagikarpLength + 1] - cp LOW(1616) ; should be "cp 3", since 1616 mm = 5'3", but LOW(1616) = 80 - jr nc, .GenerateDVs - -; 20% chance of skipping this check - call Random - cp 20 percent - 1 - jr c, .CheckMagikarpArea -; Try again if length >= 1600 mm (i.e. if LOW(length) >= 2 inches) - ld a, [wMagikarpLength + 1] - cp LOW(1600) ; should be "cp 2", since 1600 mm = 5'2", but LOW(1600) = 64 - jr nc, .GenerateDVs +**Fix:** Edit `LoadEnemyMon.CheckMagikarpArea` in [engine/battle/core.asm](/engine/battle/core.asm): + +```diff + ; Get Magikarp's length + ld de, wEnemyMonDVs + ld bc, wPlayerID + callfar CalcMagikarpLength + + ; No reason to keep going if length > 1536 mm (i.e. if HIGH(length) > 6 feet) + ld a, [wMagikarpLength] +- cp HIGH(1536) ; should be "cp 5", since 1536 mm = 5'0", but HIGH(1536) = 6 ++ cp 5 + jr nz, .CheckMagikarpArea + + ; 5% chance of skipping both size checks + call Random + cp 5 percent + jr c, .CheckMagikarpArea + ; Try again if length >= 1616 mm (i.e. if LOW(length) >= 3 inches) + ld a, [wMagikarpLength + 1] +- cp LOW(1616) ; should be "cp 3", since 1616 mm = 5'3", but LOW(1616) = 80 ++ cp 3 + jr nc, .GenerateDVs + + ; 20% chance of skipping this check + call Random + cp 20 percent - 1 + jr c, .CheckMagikarpArea + ; Try again if length >= 1600 mm (i.e. if LOW(length) >= 2 inches) + ld a, [wMagikarpLength + 1] +- cp LOW(1600) ; should be "cp 2", since 1600 mm = 5'2", but LOW(1600) = 64 ++ cp 2 + jr nc, .GenerateDVs ``` -**Fix:** Change the three `cp` instructions to use their commented values. - ## Magikarp lengths can be miscalculated -This is a bug with `CalcMagikarpLength.BCLessThanDE` in [engine/events/magikarp.asm](/engine/events/magikarp.asm): - -```asm -.BCLessThanDE: -; Intention: Return bc < de. -; Reality: Return b < d. - ld a, b - cp d - ret c - ret nc ; whoops - ld a, c - cp e - ret +**Fix:** Edit `CalcMagikarpLength.BCLessThanDE` in [engine/events/magikarp.asm](/engine/events/magikarp.asm): + +```diff + .BCLessThanDE: +-; Intention: Return bc < de. +-; Reality: Return b < d. + ld a, b + cp d + ret c +- ret nc ; whoops + ld a, c + cp e + ret ``` -**Fix:** Delete `ret nc`. - ## Battle transitions fail to account for the enemy's level ([Video](https://www.youtube.com/watch?v=eij_1060SMc)) -This is a bug with `StartTrainerBattle_DetermineWhichAnimation` in [engine/battle/battle_transition.asm](/engine/battle/battle_transition.asm): +There are three things wrong here: -```asm -StartTrainerBattle_DetermineWhichAnimation: -; The screen flashes a different number of times depending on the level of -; your lead Pokemon relative to the opponent's. -; BUG: wBattleMonLevel and wEnemyMonLevel are not set at this point, so whatever -; values happen to be there will determine the animation. +- `wEnemyMonLevel` isn't initialized yet +- `wBattleMonLevel` gets overwritten after it's initialized by `FindFirstAliveMonAndStartBattle` +- `wBattleMonLevel` isn't initialized until much later when the battle is with a trainer + +**Fix:** + +First, edit [engine/battle/battle_transition.asm](/engine/battle/battle_transition.asm): + +```diff + StartTrainerBattle_DetermineWhichAnimation: + ; The screen flashes a different number of times depending on the level of + ; your lead Pokemon relative to the opponent's. +-; BUG: wBattleMonLevel and wEnemyMonLevel are not set at this point, so whatever +-; values happen to be there will determine the animation. ++ ld a, [wOtherTrainerClass] ++ and a ++ jr z, .wild ++ farcall SetTrainerBattleLevel ++ ++.wild ++ ld b, PARTY_LENGTH ++ ld hl, wPartyMon1HP ++ ld de, PARTYMON_STRUCT_LENGTH - 1 ++ ++.loop ++ ld a, [hli] ++ or [hl] ++ jr nz, .okay ++ add hl, de ++ dec b ++ jr nz, .loop ++ ++.okay ++ ld de, MON_LEVEL - MON_HP ++ add hl, de ld de, 0 - ld a, [wBattleMonLevel] - add 3 - ld hl, wEnemyMonLevel - cp [hl] - jr nc, .not_stronger - set TRANS_STRONGER_F, e -.not_stronger - ld a, [wEnvironment] - cp CAVE - jr z, .cave - cp ENVIRONMENT_5 - jr z, .cave - cp DUNGEON - jr z, .cave - set TRANS_NO_CAVE_F, e -.cave - ld hl, .StartingPoints - add hl, de - ld a, [hl] - ld [wJumptableIndex], a - ret +- ld a, [wBattleMonLevel] ++ ld a, [hl] + add 3 +- ld hl, wEnemyMonLevel ++ ld hl, wCurPartyLevel + cp [hl] + jr nc, .not_stronger + set TRANS_STRONGER_F, e + .not_stronger + ld a, [wEnvironment] + cp CAVE + jr z, .cave + cp ENVIRONMENT_5 + jr z, .cave + cp DUNGEON + jr z, .cave + set TRANS_NO_CAVE_F, e + .cave + ld hl, .StartingPoints + add hl, de + ld a, [hl] + ld [wJumptableIndex], a + ret + + .StartingPoints: + ; entries correspond to TRANS_* constants + db BATTLETRANSITION_CAVE + db BATTLETRANSITION_CAVE_STRONGER + db BATTLETRANSITION_NO_CAVE + db BATTLETRANSITION_NO_CAVE_STRONGER +``` -.StartingPoints: -; entries correspond to TRANS_* constants - db BATTLETRANSITION_CAVE - db BATTLETRANSITION_CAVE_STRONGER - db BATTLETRANSITION_NO_CAVE - db BATTLETRANSITION_NO_CAVE_STRONGER +Then edit [engine/battle/start_battle.asm](/engine/battle/start_battle.asm): + +```diff + FindFirstAliveMonAndStartBattle: + xor a + ld [hMapAnims], a + call DelayFrame +- ld b, 6 +- ld hl, wPartyMon1HP +- ld de, PARTYMON_STRUCT_LENGTH - 1 +- +-.loop +- ld a, [hli] +- or [hl] +- jr nz, .okay +- add hl, de +- dec b +- jr nz, .loop +- +-.okay +- ld de, MON_LEVEL - MON_HP +- add hl, de +- ld a, [hl] +- ld [wBattleMonLevel], a + predef DoBattleTransition ``` -*To do:* Fix this bug. +Finally, edit [engine/battle/read_trainer_party.asm](/engine/battle/read_trainer_party.asm): + +```diff + INCLUDE "data/trainers/parties.asm" ++ ++SetTrainerBattleLevel: ++ ld a, 255 ++ ld [wCurPartyLevel], a ++ ++ ld a, [wInBattleTowerBattle] ++ bit 0, a ++ ret nz ++ ++ ld a, [wLinkMode] ++ and a ++ ret nz ++ ++ ld a, [wOtherTrainerClass] ++ dec a ++ ld c, a ++ ld b, 0 ++ ld hl, TrainerGroups ++ add hl, bc ++ add hl, bc ++ ld a, [hli] ++ ld h, [hl] ++ ld l, a ++ ++ ld a, [wOtherTrainerID] ++ ld b, a ++.skip_trainer ++ dec b ++ jr z, .got_trainer ++.loop1 ++ ld a, [hli] ++ cp $ff ++ jr nz, .loop1 ++ jr .skip_trainer ++.got_trainer ++ ++.skip_name ++ ld a, [hli] ++ cp "@" ++ jr nz, .skip_name ++ ++ inc hl ++ ld a, [hl] ++ ld [wCurPartyLevel], a ++ ret +``` ## A "HOF Master!" title for 200-Time Famers is defined but inaccessible ([Video](https://www.youtube.com/watch?v=iHkWubvxmSg)) -This is a bug with `_HallOfFamePC.DisplayMonAndStrings` in [engine/events/halloffame.asm](/engine/events/halloffame.asm): - -```asm - ld a, [wHallOfFameTempWinCount] - cp HOF_MASTER_COUNT + 1 ; should be HOF_MASTER_COUNT - jr c, .print_num_hof - ld de, .HOFMaster - hlcoord 1, 2 - call PlaceString - hlcoord 13, 2 - jr .finish +**Fix:** Edit `_HallOfFamePC.DisplayMonAndStrings` in [engine/events/halloffame.asm](/engine/events/halloffame.asm): + +```diff + ld a, [wHallOfFameTempWinCount] +- cp HOF_MASTER_COUNT + 1 ; should be HOF_MASTER_COUNT ++ cp HOF_MASTER_COUNT + jr c, .print_num_hof + ld de, .HOFMaster + hlcoord 1, 2 + call PlaceString + hlcoord 13, 2 + jr .finish ``` -**Fix:** Change `HOF_MASTER_COUNT + 1` to `HOF_MASTER_COUNT`. - ## Slot machine payout sound effects cut each other off ([Video](https://www.youtube.com/watch?v=ojq3xqfRF6I)) -This is a bug with `Slots_PayoutAnim` in [engine/games/slot_machine.asm](/engine/games/slot_machine.asm): - -```asm -.okay - ld [hl], e - dec hl - ld [hl], d - ld a, [wSlotsDelay] - and $7 - ret z ; ret nz would be more appropriate - ld de, SFX_GET_COIN_FROM_SLOTS - call PlaySFX - ret +**Fix:** Edit `Slots_PayoutAnim` in [engine/games/slot_machine.asm](/engine/games/slot_machine.asm): + +```diff + .okay + ld [hl], e + dec hl + ld [hl], d + ld a, [wSlotsDelay] + and $7 +- ret z ; ret nz would be more appropriate ++ ret nz + ld de, SFX_GET_COIN_FROM_SLOTS + call PlaySFX + ret ``` -**Fix:** Change `ret z` to `ret nz`. - ## Team Rocket battle music is not used for Executives or Scientists -This is a bug with `PlayBattleMusic` in [engine/battle/start_battle.asm](/engine/battle/start_battle.asm): - -```asm - ; They should have included EXECUTIVEM, EXECUTIVEF, and SCIENTIST too... - ld de, MUSIC_ROCKET_BATTLE - cp GRUNTM - jr z, .done - cp GRUNTF - jr z, .done -``` - -**Fix:** - -```asm - ld de, MUSIC_ROCKET_BATTLE - cp GRUNTM - jr z, .done - cp GRUNTF - jr z, .done - cp EXECUTIVEM - jr z, .done - cp EXECUTIVEF - jr z, .done - cp SCIENTIST - jr z, .done +**Fix:** Edit `PlayBattleMusic` in [engine/battle/start_battle.asm](/engine/battle/start_battle.asm): + +```diff + ld de, MUSIC_ROCKET_BATTLE + cp GRUNTM + jr z, .done + cp GRUNTF + jr z, .done ++ cp EXECUTIVEM ++ jr z, .done ++ cp EXECUTIVEF ++ jr z, .done ++ cp SCIENTIST ++ jr z, .done ``` ## No bump noise if standing on tile `$3E` -This is a bug with `DoPlayerMovement.CheckWarp` in [engine/overworld/player_movement.asm](/engine/overworld/player_movement.asm): - -```asm -; Bug: Since no case is made for STANDING here, it will check -; [.edgewarps + $ff]. This resolves to $3e at $8035a. -; This causes wd041 to be nonzero when standing on tile $3e, -; making bumps silent. - - ld a, [wWalkingDirection] - ; cp STANDING - ; jr z, .not_warp - ld e, a - ld d, 0 - ld hl, .EdgeWarps - add hl, de - ld a, [wPlayerStandingTile] - cp [hl] - jr nz, .not_warp - - ld a, 1 - ld [wd041], a - ld a, [wWalkingDirection] - ; This is in the wrong place. - cp STANDING - jr z, .not_warp -``` - -**Fix:** - -```asm - ld a, [wWalkingDirection] - cp STANDING - jr z, .not_warp - ld e, a - ld d, 0 - ld hl, .EdgeWarps - add hl, de - ld a, [wPlayerStandingTile] - cp [hl] - jr nz, .not_warp - - ld a, 1 - ld [wd041], a - ld a, [wWalkingDirection] +**Fix:** Edit `DoPlayerMovement.CheckWarp` in [engine/overworld/player_movement.asm](/engine/overworld/player_movement.asm): + +```diff + .CheckWarp: +-; Bug: Since no case is made for STANDING here, it will check +-; [.edgewarps + $ff]. This resolves to $3e at $8035a. +-; This causes wd041 to be nonzero when standing on tile $3e, +-; making bumps silent. +- + ld a, [wWalkingDirection] +- ; cp STANDING +- ; jr z, .not_warp ++ cp STANDING ++ jr z, .not_warp + ld e, a + ld d, 0 + ld hl, .EdgeWarps + add hl, de + ld a, [wPlayerStandingTile] + cp [hl] + jr nz, .not_warp + + ld a, 1 + ld [wd041], a + ld a, [wWalkingDirection] +- ; This is in the wrong place. +- cp STANDING +- jr z, .not_warp ``` @@ -1101,26 +1132,21 @@ This is a bug with `DoPlayerMovement.CheckWarp` in [engine/overworld/player_move ([Video](https://www.youtube.com/watch?v=z305e4sIO24)) -The exact cause is unknown, but a workaround exists for `DexEntryScreen_MenuActionJumptable.Cry` in [engine/pokedex/pokedex.asm](/engine/pokedex/pokedex.asm): - -```asm -.Cry: - call Pokedex_GetSelectedMon - ld a, [wd265] - call GetCryIndex - ld e, c - ld d, b - call PlayCry - ret -``` - -**Workaround:** - -```asm -.Cry: - ld a, [wCurPartySpecies] - call PlayMonCry - ret +The exact cause of this bug is unknown. + +**Workaround:** Edit `DexEntryScreen_MenuActionJumptable.Cry` in [engine/pokedex/pokedex.asm](/engine/pokedex/pokedex.asm): + +```diff + .Cry: +- call Pokedex_GetSelectedMon +- ld a, [wTempSpecies] +- call GetCryIndex +- ld e, c +- ld d, b +- call PlayCry ++ ld a, [wCurPartySpecies] ++ call PlayMonCry + ret ``` @@ -1150,29 +1176,28 @@ This is a mistake with the left-hand warp carpet corner tiles in [gfx/tilesets/p This bug prevents you from using blocksets with more than 128 blocks. -In [home/map.asm](/home/map.asm): - -```asm - ; Set hl to the address of the current metatile data ([wTilesetBlocksAddress] + (a) tiles). - ; This is buggy; it wraps around past 128 blocks. - ; To fix, uncomment the line below. - add a ; Comment or delete this line to fix the above bug. - ld l, a - ld h, 0 - ; add hl, hl - add hl, hl - add hl, hl - add hl, hl - ld a, [wTilesetBlocksAddress] - add l - ld l, a - ld a, [wTilesetBlocksAddress + 1] - adc h - ld h, a +**Fix:** Edit `LoadMetatiles` in [home/map.asm](/home/map.asm): + +```diff + ; Set hl to the address of the current metatile data ([wTilesetBlocksAddress] + (a) tiles). +- ; This is buggy; it wraps around past 128 blocks. +- ; To fix, uncomment the line below. +- add a ; Comment or delete this line to fix the above bug. + ld l, a + ld h, 0 +- ; add hl, hl ++ add hl, hl + add hl, hl + add hl, hl + add hl, hl + ld a, [wTilesetBlocksAddress] + add l + ld l, a + ld a, [wTilesetBlocksAddress + 1] + adc h + ld h, a ``` -**Fix:** Delete `add a` and uncomment `add hl, hl`. - ## Surfing directly across a map connection does not load the new map @@ -1185,17 +1210,16 @@ In [home/map.asm](/home/map.asm): This bug is why the Lapras in [maps/UnionCaveB2F.asm](/maps/UnionCaveB2F.asm), which uses `SPRITEMOVEDATA_SWIM_WANDER`, is not restricted by its `1, 1` movement radius. -This is a bug with `CanObjectMoveInDirection` in [engine/overworld/npc_movement.asm](/engine/overworld/npc_movement.asm): +**Fix:** Edit `CanObjectMoveInDirection` in [engine/overworld/npc_movement.asm](/engine/overworld/npc_movement.asm): -```asm - ld hl, OBJECT_FLAGS1 - add hl, bc - bit NOCLIP_TILES_F, [hl] ; lost, uncomment next line to fix - ; jr nz, .noclip_tiles +```diff + ld hl, OBJECT_FLAGS1 + add hl, bc + bit NOCLIP_TILES_F, [hl] ; lost, uncomment next line to fix +- ; jr nz, .noclip_tiles ++ jr nz, .noclip_tiles ``` -**Fix:** Uncomment `jr nz, .noclip_tiles`. - ## `CheckOwnMon` only checks the first five letters of OT names @@ -1203,102 +1227,74 @@ This is a bug with `CanObjectMoveInDirection` in [engine/overworld/npc_movement. This bug can allow you to talk to Eusine in Celadon City and encounter Ho-Oh with only traded legendary beasts. -In [engine/pokemon/search.asm](/engine/pokemon/search.asm): - -```asm -; check OT -; This only checks five characters, which is fine for the Japanese version, -; but in the English version the player name is 7 characters, so this is wrong. - - ld hl, wPlayerName - -rept NAME_LENGTH_JAPANESE + -2 ; should be PLAYER_NAME_LENGTH + -2 - ld a, [de] - cp [hl] - jr nz, .notfound - cp "@" - jr z, .found ; reached end of string - inc hl - inc de -endr - - ld a, [de] - cp [hl] - jr z, .found +**Fix:** Edit `CheckOwnMon` in [engine/pokemon/search.asm](/engine/pokemon/search.asm): + +```diff + ; check OT +-; This only checks five characters, which is fine for the Japanese version, +-; but in the English version the player name is 7 characters, so this is wrong. + + ld hl, wPlayerName + +-rept NAME_LENGTH_JAPANESE + -2 ; should be PLAYER_NAME_LENGTH + -2 ++rept PLAYER_NAME_LENGTH + -2 + ld a, [de] + cp [hl] + jr nz, .notfound + cp "@" + jr z, .found ; reached end of string + inc hl + inc de + endr + + ld a, [de] + cp [hl] + jr z, .found ``` -**Fix:** Change `rept NAME_LENGTH_JAPANESE + -2` to `rept PLAYER_NAME_LENGTH + -2`. - ## Catching a Transformed Pokémon always catches a Ditto This bug can affect Mew or Pokémon other than Ditto that used Transform via Mirror Move or Sketch. -This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm): - -```asm - ld hl, wEnemySubStatus5 - ld a, [hl] - push af - set SUBSTATUS_TRANSFORMED, [hl] - -; This code is buggy. Any wild Pokémon that has Transformed will be -; caught as a Ditto, even if it was something else like Mew. -; To fix, do not set [wTempEnemyMonSpecies] to DITTO. - bit SUBSTATUS_TRANSFORMED, a - jr nz, .ditto - jr .not_ditto - -.ditto - ld a, DITTO - ld [wTempEnemyMonSpecies], a - jr .load_data - -.not_ditto - set SUBSTATUS_TRANSFORMED, [hl] - ld hl, wEnemyBackupDVs - ld a, [wEnemyMonDVs] - ld [hli], a - ld a, [wEnemyMonDVs + 1] - ld [hl], a - -.load_data - ld a, [wTempEnemyMonSpecies] - ld [wCurPartySpecies], a - ld a, [wEnemyMonLevel] - ld [wCurPartyLevel], a - farcall LoadEnemyMon - - pop af - ld [wEnemySubStatus5], a -``` - -**Fix:** - -```asm - ld hl, wEnemySubStatus5 - ld a, [hl] - push af - set SUBSTATUS_TRANSFORMED, [hl] - - bit SUBSTATUS_TRANSFORMED, a - jr nz, .load_data - - ld hl, wEnemyBackupDVs - ld a, [wEnemyMonDVs] - ld [hli], a - ld a, [wEnemyMonDVs + 1] - ld [hl], a - -.load_data - ld a, [wTempEnemyMonSpecies] - ld [wCurPartySpecies], a - ld a, [wEnemyMonLevel] - ld [wCurPartyLevel], a - farcall LoadEnemyMon - - pop af - ld [wEnemySubStatus5], a +**Fix:** Edit `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm): + +```diff + ld hl, wEnemySubStatus5 + ld a, [hl] + push af + set SUBSTATUS_TRANSFORMED, [hl] + +-; This code is buggy. Any wild Pokémon that has Transformed will be +-; caught as a Ditto, even if it was something else like Mew. +-; To fix, do not set [wTempEnemyMonSpecies] to DITTO. + bit SUBSTATUS_TRANSFORMED, a +- jr nz, .ditto +- jr .not_ditto ++ jr nz, .load_data + +-.ditto +- ld a, DITTO +- ld [wTempEnemyMonSpecies], a +- jr .load_data +- +-.not_ditto +- set SUBSTATUS_TRANSFORMED, [hl] + ld hl, wEnemyBackupDVs + ld a, [wEnemyMonDVs] + ld [hli], a + ld a, [wEnemyMonDVs + 1] + ld [hl], a + + .load_data + ld a, [wTempEnemyMonSpecies] + ld [wCurPartySpecies], a + ld a, [wEnemyMonLevel] + ld [wCurPartyLevel], a + farcall LoadEnemyMon + + pop af + ld [wEnemySubStatus5], a ``` @@ -1306,109 +1302,87 @@ This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/i ([Video](https://www.youtube.com/watch?v=v1ErZdLCIyU)) -This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm): - -```asm -.room_in_party - xor a - ld [wWildMon], a - ld a, [wCurItem] - cp PARK_BALL - call nz, ReturnToBattle_UseBall -``` - -**Fix:** - -```asm -.room_in_party - xor a - ld [wWildMon], a - ld a, [wBattleType] - cp BATTLETYPE_CONTEST - call nz, ReturnToBattle_UseBall +**Fix:** Edit `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm): + +```diff + .room_in_party + xor a + ld [wWildMon], a +- ld a, [wCurItem] +- cp PARK_BALL ++ ld a, [wBattleType] ++ cp BATTLETYPE_CONTEST + call nz, ReturnToBattle_UseBall ``` ## `HELD_CATCH_CHANCE` has no effect -This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm): - -```asm - ; BUG: farcall overwrites a, and GetItemHeldEffect takes b anyway. - ; This is probably the reason the HELD_CATCH_CHANCE effect is never used. - ; Uncomment the line below to fix. - ld d, a - push de - ld a, [wBattleMonItem] - ; ld b, a - farcall GetItemHeldEffect - ld a, b - cp HELD_CATCH_CHANCE - pop de - ld a, d - jr nz, .max_2 - add c - jr nc, .max_2 - ld a, $ff -.max_2 +**Fix:** Edit `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm): + +```diff +- ; BUG: farcall overwrites a, and GetItemHeldEffect takes b anyway. +- ; This is probably the reason the HELD_CATCH_CHANCE effect is never used. +- ; Uncomment the line below to fix. + ld d, a + push de + ld a, [wBattleMonItem] +- ; ld b, a ++ ld b, a + farcall GetItemHeldEffect + ld a, b + cp HELD_CATCH_CHANCE + pop de + ld a, d + jr nz, .max_2 + add c + jr nc, .max_2 + ld a, $ff + .max_2 ``` -**Fix:** Uncomment `ld b, a`. - ## Only the first three evolution entries can have Stone compatibility reported correctly -This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/pokemon/party_menu.asm](/engine/pokemon/party_menu.asm): - -```asm -.DetermineCompatibility: - ld de, wStringBuffer1 - ld a, BANK(EvosAttacksPointers) - ld bc, 2 - call FarCopyBytes - ld hl, wStringBuffer1 - ld a, [hli] - ld h, [hl] - ld l, a - ld de, wStringBuffer1 - ld a, BANK("Evolutions and Attacks") - ld bc, 10 - call FarCopyBytes +**Workaround:** Edit `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/pokemon/party_menu.asm](/engine/pokemon/party_menu.asm): + +```diff + .DetermineCompatibility: + ld de, wStringBuffer1 + ld a, BANK(EvosAttacksPointers) + ld bc, 2 + call FarCopyBytes + ld hl, wStringBuffer1 + ld a, [hli] + ld h, [hl] + ld l, a + ld de, wStringBuffer1 + ld a, BANK("Evolutions and Attacks") +- ld bc, 10 ++ ld bc, wStringBuffer2 - wStringBuffer1 + call FarCopyBytes ``` -**Fix:** Change `ld bc, 10` to `ld bc, wStringBuffer2 - wStringBuffer1` to support up to six Stone entries. +This supports up to six entries. ## `EVOLVE_STAT` can break Stone compatibility reporting -This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/pokemon/party_menu.asm](/engine/pokemon/party_menu.asm): - -```asm -.loop2 - ld a, [hli] - and a - jr z, .nope - inc hl - inc hl - cp EVOLVE_ITEM - jr nz, .loop2 -``` - -**Fix:** - -```asm -.loop2 - ld a, [hli] - and a - jr z, .nope - cp EVOLVE_STAT - jr nz, .not_four_bytes - inc hl -.not_four_bytes - inc hl - inc hl - cp EVOLVE_ITEM - jr nz, .loop2 +**Fix:** Edit `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/pokemon/party_menu.asm](/engine/pokemon/party_menu.asm): + +```diff + .loop2 + ld a, [hli] + and a + jr z, .nope ++ cp EVOLVE_STAT ++ jr nz, .not_four_bytes ++ inc hl ++.not_four_bytes + inc hl + inc hl + cp EVOLVE_ITEM + jr nz, .loop2 ``` @@ -1454,157 +1428,107 @@ ScriptCall: ## `LoadSpriteGFX` does not limit the capacity of `UsedSprites` -In [engine/overworld/overworld.asm](/engine/overworld/overworld.asm): - -```asm -LoadSpriteGFX: -; Bug: b is not preserved, so it's useless as a next count. -; Uncomment the lines below to fix. - - ld hl, wUsedSprites - ld b, SPRITE_GFX_LIST_CAPACITY -.loop - ld a, [hli] - and a - jr z, .done - push hl - call .LoadSprite - pop hl - ld [hli], a - dec b - jr nz, .loop - -.done - ret - -.LoadSprite: - ; push bc - call GetSprite - ; pop bc - ld a, l - ret +**Fix:** Edit `LoadSpriteGFX` in [engine/overworld/overworld.asm](/engine/overworld/overworld.asm): + +```diff + LoadSpriteGFX: +-; Bug: b is not preserved, so it's useless as a next count. +-; Uncomment the lines below to fix. +- + ld hl, wUsedSprites + ld b, SPRITE_GFX_LIST_CAPACITY + .loop + ld a, [hli] + and a + jr z, .done + push hl + call .LoadSprite + pop hl + ld [hli], a + dec b + jr nz, .loop + + .done + ret + + .LoadSprite: +- ; push bc ++ push bc + call GetSprite +- ; pop bc ++ pop bc + ld a, l + ret ``` -**Fix:** Uncomment `push bc` and `pop bc`. - ## `ChooseWildEncounter` doesn't really validate the wild Pokémon species -In [engine/overworld/wildmons.asm](/engine/overworld/wildmons.asm): +**Fix:** Edit `ChooseWildEncounter` in [engine/overworld/wildmons.asm](/engine/overworld/wildmons.asm): -```asm -ChooseWildEncounter: -... - ld a, b - ld [wCurPartyLevel], a - ld b, [hl] - ; ld a, b - call ValidateTempWildMonSpecies - jr c, .nowildbattle - - ld a, b ; This is in the wrong place. - cp UNOWN - jr nz, .done - -... +```diff + .ok + ld a, b + ld [wCurPartyLevel], a + ld b, [hl] +- ; ld a, b ++ ld a, b + call ValidateTempWildMonSpecies + jr c, .nowildbattle -ValidateTempWildMonSpecies: -; Due to a development oversight, this function is called with the wild Pokemon's level, not its species, in a. + cp UNOWN + jr nz, .done ``` -**Fix:** - -```asm - ld a, b - ld [wCurPartyLevel], a - ld b, [hl] - ld a, b - call ValidateTempWildMonSpecies - jr c, .nowildbattle - - cp UNOWN - jr nz, .done -``` ## `TryObjectEvent` arbitrary code execution -In [engine/overworld/events.asm](/engine/overworld/events.asm): - -```asm -; Bug: If IsInArray returns nc, data at bc will be executed as code. - push bc - ld de, 3 - ld hl, .pointers - call IsInArray - jr nc, .nope_bugged - pop bc - - inc hl - ld a, [hli] - ld h, [hl] - ld l, a - jp hl - -.nope_bugged - ; pop bc - xor a - ret -``` - -**Fix:** Uncomment `pop bc`. - - -## `CheckBugContestContestantFlag` can read beyond its data table - -In [engine/events/bug_contest/contest_2.asm](/engine/events/bug_contest/contest_2.asm): - -```asm -CheckBugContestContestantFlag: -; Checks the flag of the Bug Catching Contestant whose index is loaded in a. - -; Bug: If a >= NUM_BUG_CONTESTANTS when this is called, -; it will read beyond the table. - - ld hl, BugCatchingContestantEventFlagTable - ld e, a - ld d, 0 - add hl, de - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - ld b, CHECK_FLAG - call EventFlagAction - ret - -INCLUDE "data/events/bug_contest_flags.asm" +**Fix:** Edit `TryObjectEvent` in [engine/overworld/events.asm](/engine/overworld/events.asm): + +```diff +-; Bug: If IsInArray returns nc, data at bc will be executed as code. + push bc + ld de, 3 + ld hl, .pointers + call IsInArray + jr nc, .nope_bugged + pop bc + + inc hl + ld a, [hli] + ld h, [hl] + ld l, a + jp hl + + .nope_bugged +- ; pop bc ++ pop bc + xor a + ret ``` -However, `a < NUM_BUG_CONTESTANTS` should always be true, so in practice this is not a problem. - ## `ClearWRAM` only clears WRAM bank 1 -In [home/init.asm](/home/init.asm): - -```asm -ClearWRAM:: -; Wipe swappable WRAM banks (1-7) -; Assumes CGB or AGB - - ld a, 1 -.bank_loop - push af - ld [rSVBK], a - xor a - ld hl, WRAM1_Begin - ld bc, WRAM1_End - WRAM1_Begin - call ByteFill - pop af - inc a - cp 8 - jr nc, .bank_loop ; Should be jr c - ret +**Fix:** Edit `ClearWRAM` in [home/init.asm](/home/init.asm): + +```diff + ClearWRAM:: + ; Wipe swappable WRAM banks (1-7) + ; Assumes CGB or AGB + + ld a, 1 + .bank_loop + push af + ld [rSVBK], a + xor a + ld hl, WRAM1_Begin + ld bc, WRAM1_End - WRAM1_Begin + call ByteFill + pop af + inc a + cp 8 +- jr nc, .bank_loop ; Should be jr c ++ jr c, .bank_loop + ret ``` - -**Fix:** Change `jr nc, .bank_loop` to `jr c, .bank_loop`. diff --git a/docs/design_flaws.md b/docs/design_flaws.md index 4b24a0cc3..80c34dfdb 100644 --- a/docs/design_flaws.md +++ b/docs/design_flaws.md @@ -152,41 +152,44 @@ Don't enforce `org $4000` in pokecrystal.link. Modify `GetFrontpicPointer`: -```asm - ld a, [wCurPartySpecies] - cp UNOWN - jr z, .unown - ld a, [wCurPartySpecies] - ld hl, PokemonPicPointers - ld d, BANK(PokemonPicPointers) - jr .ok - -.unown - ld a, [wUnownLetter] - ld hl, UnownPicPointers - ld d, BANK(UnownPicPointers) - -.ok - dec a - ld bc, 6 - call AddNTimes +```diff + ld a, [wCurPartySpecies] + cp UNOWN + jr z, .unown + ld a, [wCurPartySpecies] ++ ld hl, PokemonPicPointers + ld d, BANK(PokemonPicPointers) + jr .ok + + .unown + ld a, [wUnownLetter] ++ ld hl, UnownPicPointers + ld d, BANK(UnownPicPointers) + + .ok +- ld hl, PokemonPicPointers ; UnownPicPointers + dec a + ld bc, 6 + call AddNTimes ``` And `GetMonBackpic`: -```asm - ld a, b - ld hl, PokemonPicPointers - ld d, BANK(PokemonPicPointers) - cp UNOWN - jr nz, .ok - ld a, c - ld hl, UnownPicPointers - ld d, BANK(UnownPicPointers) -.ok - dec a - ld bc, 6 - call AddNTimes +```diff +- ; These are assumed to be at the same address in their respective banks. +- ld hl, PokemonPicPointers ; UnownPicPointers + ld a, b ++ ld hl, PokemonPicPointers + ld d, BANK(PokemonPicPointers) + cp UNOWN + jr nz, .ok + ld a, c ++ ld hl, UnownPicPointers + ld d, BANK(UnownPicPointers) + .ok + dec a + ld bc, 6 + call AddNTimes ``` @@ -268,12 +271,26 @@ INCBIN "gfx/footprints/wartortle.1bpp" Modify `Pokedex_LoadAnyFootprint`: -```asm - ld e, l - ld d, h - ld hl, vTiles2 tile $62 - lb bc, BANK(Footprints), 4 - call Request1bpp +```diff +- push hl + ld e, l + ld d, h + ld hl, vTiles2 tile $62 +- lb bc, BANK(Footprints), 2 ++ lb bc, BANK(Footprints), 4 + call Request1bpp +- pop hl +- +- ; Whoever was editing footprints forgot to fix their +- ; tile editor. Now each bottom half is 8 tiles off. +- ld de, 8 tiles +- add hl, de +- +- ld e, l +- ld d, h +- ld hl, vTiles2 tile $64 +- lb bc, BANK(Footprints), 2 +- call Request1bpp ``` @@ -341,22 +358,41 @@ Move `ITEM_C3` and `ITEM_DC` above all the TMs in every table of item data. Modify engine/items/items.asm: -```asm -GetTMHMNumber:: -; Return the number of a TM/HM by item id c. - ld a, c - sub TM01 - inc a - ld c, a - ret - -GetNumberedTMHM: -; Return the item id of a TM/HM by number c. - ld a, c - add TM01 - dec a - ld c, a - ret +```diff + GetTMHMNumber:: + ; Return the number of a TM/HM by item id c. + ld a, c +-; Skip any dummy items. +- cp ITEM_C3 ; TM04-05 +- jr c, .done +- cp ITEM_DC ; TM28-29 +- jr c, .skip +- dec a +-.skip +- dec a +-.done + sub TM01 + inc a + ld c, a + ret + + GetNumberedTMHM: + ; Return the item id of a TM/HM by number c. + ld a, c +-; Skip any gaps. +- cp ITEM_C3 - (TM01 - 1) +- jr c, .done +- cp ITEM_DC - (TM01 - 1) - 1 +- jr c, .skip_one +-.skip_two +- inc a +-.skip_one +- inc a +-.done + add TM01 + dec a + ld c, a + ret ``` diff --git a/docs/move_effect_commands.md b/docs/move_effect_commands.md index a7a779123..acb9eca8e 100644 --- a/docs/move_effect_commands.md +++ b/docs/move_effect_commands.md @@ -29,13 +29,13 @@ Defined in [macros/scripts/battle_commands.asm](/macros/scripts/battle_commands. ## `$0D`: `failuretext` -## `$0E`: `checkfaint` +## `$0E`: `applydamage` ## `$0F`: `criticaltext` ## `$10`: `supereffectivetext` -## `$11`: `checkdestinybond` +## `$11`: `checkfaint` ## `$12`: `buildopponentrage` @@ -331,13 +331,13 @@ Defined in [macros/scripts/battle_commands.asm](/macros/scripts/battle_commands. ## `$A4`: `allstatsup` -## `$A5`: `effect0xa5` +## `$A5`: `bidefailtext` ## `$A6`: `raisesubnoanim` ## `$A7`: `lowersubnoanim` -## `$A8`: `effect0xa8` +## `$A8`: `beatupfailtext` ## `$A9`: `clearmissdamage` diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm index 29bc23b20..28dfb1010 100644 --- a/engine/battle/ai/items.asm +++ b/engine/battle/ai/items.asm @@ -806,7 +806,7 @@ EnemyUsedXItem: push bc call PrintText_UsedItemOn pop bc - farcall CheckIfStatCanBeRaised + farcall RaiseStat jp AIUpdateHUD ; Parameter @@ -818,7 +818,7 @@ PrintText_UsedItemOn_AND_AIUpdateHUD: PrintText_UsedItemOn: ld a, [wCurEnemyItem] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetItemName ld hl, wStringBuffer1 ld de, wMonOrItemNameBuffer diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm index 6928a3a83..752796892 100644 --- a/engine/battle/ai/scoring.asm +++ b/engine/battle/ai/scoring.asm @@ -171,10 +171,10 @@ AI_Types: pop bc pop hl - ld a, [wd265] + ld a, [wTypeMatchup] and a jr z, .immune - cp 10 ; 1.0 + cp EFFECTIVE jr z, .checkmove jr c, .noteffective @@ -415,8 +415,8 @@ AI_Smart_LeechHit: pop hl ; 60% chance to discourage this move if not very effective. - ld a, [wd265] - cp 10 ; 1.0 + ld a, [wTypeMatchup] + cp EFFECTIVE jr c, .asm_38815 ; Do nothing if effectiveness is neutral. @@ -491,8 +491,8 @@ AI_Smart_LockOn: push hl push bc farcall BattleCheckTypeMatchup - ld a, [wd265] - cp $a + ld a, [wTypeMatchup] + cp EFFECTIVE pop bc pop hl jr c, .asm_3884f @@ -1292,8 +1292,8 @@ AI_Smart_Mimic: ld [hBattleTurn], a callfar BattleCheckTypeMatchup - ld a, [wd265] - cp $a + ld a, [wTypeMatchup] + cp EFFECTIVE pop hl jr c, .asm_38bef jr z, .asm_38bd4 @@ -1408,8 +1408,8 @@ AI_Smart_Encore: predef CheckTypeMatchup pop hl - ld a, [wd265] - cp $a + ld a, [wTypeMatchup] + cp EFFECTIVE jr nc, .asm_38c68 and a @@ -1550,7 +1550,7 @@ AI_Smart_Spite: dec [hl] ret -Function_0x38d16 +Function_0x38d16: jp AIDiscourageMove AI_Smart_DestinyBond: @@ -1679,8 +1679,8 @@ AI_Smart_Conversion2: callfar BattleCheckTypeMatchup - ld a, [wd265] - cp $a + ld a, [wTypeMatchup] + cp EFFECTIVE pop hl jr c, .asm_38dc9 ret z @@ -2293,8 +2293,8 @@ AI_Smart_HiddenPower: pop hl ; Discourage Hidden Power if not very effective. - ld a, [wd265] - cp 10 + ld a, [wTypeMatchup] + cp EFFECTIVE jr c, .bad ; Discourage Hidden Power if its base power is lower than 50. @@ -2303,8 +2303,8 @@ AI_Smart_HiddenPower: jr c, .bad ; Encourage Hidden Power if super-effective. - ld a, [wd265] - cp 11 + ld a, [wTypeMatchup] + cp EFFECTIVE + 1 jr nc, .good ; Encourage Hidden Power if its base power is 70. @@ -3125,7 +3125,7 @@ AI_Status: pop bc pop hl - ld a, [wd265] + ld a, [wTypeMatchup] and a jr nz, .checkmove diff --git a/engine/battle/ai/switch.asm b/engine/battle/ai/switch.asm index b9bd2ea60..b12087e23 100644 --- a/engine/battle/ai/switch.asm +++ b/engine/battle/ai/switch.asm @@ -30,11 +30,11 @@ CheckPlayerMoveTypeMatchups: ld hl, wEnemyMonType call CheckTypeMatchup ld a, [wTypeMatchup] - cp 10 + 1 ; 1.0 + 0.1 + cp EFFECTIVE + 1 ; 1.0 + 0.1 jr nc, .super_effective and a jr z, .next - cp 10 ; 1.0 + cp EFFECTIVE ; 1.0 jr nc, .neutral .not_very_effective @@ -75,7 +75,7 @@ CheckPlayerMoveTypeMatchups: ld hl, wEnemyMonType1 call CheckTypeMatchup ld a, [wTypeMatchup] - cp 10 + 1 ; 1.0 + 0.1 + cp EFFECTIVE + 1 ; 1.0 + 0.1 jr c, .ok call .DecreaseScore .ok @@ -84,7 +84,7 @@ CheckPlayerMoveTypeMatchups: jr z, .ok2 call CheckTypeMatchup ld a, [wTypeMatchup] - cp 10 + 1 ; 1.0 + 0.1 + cp EFFECTIVE + 1 ; 1.0 + 0.1 jr c, .ok2 call .DecreaseScore .ok2 @@ -130,7 +130,7 @@ CheckPlayerMoveTypeMatchups: ; not very effective inc c - cp 10 + cp EFFECTIVE jr c, .loop2 ; neutral @@ -139,7 +139,7 @@ CheckPlayerMoveTypeMatchups: inc c inc c inc c - cp 10 + cp EFFECTIVE jr z, .loop2 ; super effective @@ -481,7 +481,7 @@ FindEnemyMonsWithASuperEffectiveMove: ; if neutral: load 1 and continue ld e, 1 - cp 10 + 1 + cp EFFECTIVE + 1 jr c, .nope ; if super-effective: load 2 and break @@ -584,7 +584,7 @@ FindEnemyMonsThatResistPlayer: ld hl, wBaseType call CheckTypeMatchup ld a, [wTypeMatchup] - cp 10 + 1 + cp EFFECTIVE + 1 jr nc, .dont_choose_mon ld a, b diff --git a/engine/battle/core.asm b/engine/battle/core.asm index c3c7e9867..2d5e85cef 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -373,7 +373,7 @@ HandleBerserkGene: push bc callfar GetUserItem ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a sub BERSERK_GENE pop bc pop de @@ -447,7 +447,7 @@ DetermineMoveOrder: sub BATTLEACTION_SWITCH1 jr c, .use_move ld a, [wBattlePlayerAction] - cp $2 + cp BATTLEPLAYERACTION_SWITCH jr nz, .switch ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK @@ -472,7 +472,7 @@ DetermineMoveOrder: .use_move ld a, [wBattlePlayerAction] - and a + and a ; BATTLEPLAYERACTION_USEMOVE? jp nz, .player_first call CompareMovePriority jr z, .equal_priority @@ -530,7 +530,7 @@ DetermineMoveOrder: ld de, wBattleMonSpeed ld hl, wEnemyMonSpeed ld c, 2 - call StringCmp + call CompareBytes jr z, .speed_tie jp nc, .player_first jp .enemy_first @@ -611,7 +611,7 @@ ParsePlayerAction: .not_encored ld a, [wBattlePlayerAction] - cp $2 + cp BATTLEPLAYERACTION_SWITCH jr z, .reset_rage and a jr nz, .reset_bide @@ -900,7 +900,7 @@ Battle_EnemyFirst: call ResidualDamage jp z, HandlePlayerMonFaint call RefreshBattleHuds - xor a + xor a ; BATTLEPLAYERACTION_USEMOVE ld [wBattlePlayerAction], a ret @@ -949,7 +949,7 @@ Battle_PlayerFirst: call ResidualDamage jp z, HandleEnemyMonFaint call RefreshBattleHuds - xor a + xor a ; BATTLEPLAYERACTION_USEMOVE ld [wBattlePlayerAction], a ret @@ -1161,7 +1161,7 @@ HandlePerishSong: ret z dec [hl] ld a, [hl] - ld [wd265], a + ld [wDeciramBuffer], a push af ld hl, PerishCountText call StdBattleTextBox @@ -1235,7 +1235,7 @@ HandleWrap: ret nz ld a, [de] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a ld [wFXAnimID], a call GetMoveName dec [hl] @@ -1288,7 +1288,7 @@ HandleLeftovers: callfar GetUserItem ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetItemName ld a, b cp HELD_LEFTOVERS @@ -1397,7 +1397,7 @@ HandleMysteryberry: push bc push bc ld a, [hl] - ld [wd265], a + ld [wTempByteValue], a ld de, wBattleMonMoves - 1 ld hl, wBattleMonPP ld a, [hBattleTurn] @@ -1417,7 +1417,7 @@ HandleMysteryberry: pop de pop bc - ld a, [wd265] + ld a, [wTempByteValue] cp [hl] jr nz, .skip_checks ld a, [hBattleTurn] @@ -1434,7 +1434,7 @@ HandleMysteryberry: .skip_checks callfar GetUserItem ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a xor a ld [hl], a call GetPartymonItem @@ -2048,18 +2048,18 @@ HandleEnemyMonFaint: call CheckMobileBattleError jp c, WildFled_EnemyFled_LinkBattleCanceled - ld a, $1 + ld a, BATTLEPLAYERACTION_USEITEM ld [wBattlePlayerAction], a call HandleEnemySwitch jp z, WildFled_EnemyFled_LinkBattleCanceled jr DoubleSwitch .player_mon_not_fainted - ld a, $1 + ld a, BATTLEPLAYERACTION_USEITEM ld [wBattlePlayerAction], a call HandleEnemySwitch jp z, WildFled_EnemyFled_LinkBattleCanceled - xor a + xor a ; BATTLEPLAYERACTION_USEMOVE ld [wBattlePlayerAction], a ret @@ -2088,7 +2088,7 @@ DoubleSwitch: call PlayerPartyMonEntrance .done - xor a + xor a ; BATTLEPLAYERACTION_USEMOVE ld [wBattlePlayerAction], a ret @@ -2636,7 +2636,7 @@ HandlePlayerMonFaint: ld a, c and a ret nz - ld a, $1 + ld a, BATTLEPLAYERACTION_USEITEM ld [wBattlePlayerAction], a call HandleEnemySwitch jp z, WildFled_EnemyFled_LinkBattleCanceled @@ -2716,12 +2716,12 @@ ForcePlayerMonChoice: ld a, [wLinkMode] and a jr z, .skip_link - ld a, $1 + ld a, BATTLEPLAYERACTION_USEITEM ld [wBattlePlayerAction], a call LinkBattleSendReceiveAction .skip_link - xor a + xor a ; BATTLEPLAYERACTION_USEMOVE ld [wBattlePlayerAction], a call CheckMobileBattleError jr c, .enemy_fainted_mobile_error @@ -3287,8 +3287,8 @@ LookUpTheEffectivenessOfEveryMove: pop bc pop de pop hl - ld a, [wd265] ; Get The Effectiveness Modifier - cp 10 + 1 ; 1.0 + 0.1 + ld a, [wTypeMatchup] + cp EFFECTIVE + 1 jr c, .loop ld hl, wBuffer1 set 0, [hl] @@ -3319,14 +3319,14 @@ IsThePlayerMonTypesEffectiveAgainstOTMon: ld [wPlayerMoveStruct + MOVE_TYPE], a call SetPlayerTurn callfar BattleCheckTypeMatchup - ld a, [wd265] - cp 10 + 1 ; 1.0 + 0.1 + ld a, [wTypeMatchup] + cp EFFECTIVE + 1 jr nc, .super_effective ld a, [wBattleMonType2] ld [wPlayerMoveStruct + MOVE_TYPE], a callfar BattleCheckTypeMatchup - ld a, [wd265] - cp 10 + 1 ; 1.0 + 0.1 + ld a, [wTypeMatchup] + cp EFFECTIVE + 1 jr nc, .super_effective pop bc ret @@ -3619,10 +3619,10 @@ CheckPlayerPartyForFitMon: ld e, a xor a ld hl, wPartyMon1HP - ld bc, wPartyMon2 - (wPartyMon1 + 1) + ld bc, PARTYMON_STRUCT_LENGTH - 1 .loop or [hl] - inc hl + inc hl ; + 1 or [hl] add hl, bc dec e @@ -3695,7 +3695,7 @@ TryToRunAwayFromBattle: push hl push de ld a, [wBattleMonItem] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a ld b, a callfar GetItemHeldEffect ld a, b @@ -3715,33 +3715,33 @@ TryToRunAwayFromBattle: inc a ld [wNumFleeAttempts], a ld a, [hli] - ld [hStringCmpString2 + 0], a + ld [hPartyMon1Speed + 0], a ld a, [hl] - ld [hStringCmpString2 + 1], a + ld [hPartyMon1Speed + 1], a ld a, [de] inc de - ld [hStringCmpString1 + 0], a + ld [hEnemyMonSpeed + 0], a ld a, [de] - ld [hStringCmpString1 + 1], a + ld [hEnemyMonSpeed + 1], a call Call_LoadTempTileMapToTileMap - ld de, hStringCmpString2 - ld hl, hStringCmpString1 - ld c, $2 - call StringCmp + ld de, hPartyMon1Speed + ld hl, hEnemyMonSpeed + ld c, 2 + call CompareBytes jr nc, .can_escape xor a ld [hMultiplicand], a - ld a, $20 + ld a, 32 ld [hMultiplier], a call Multiply ld a, [hProduct + 2] ld [hDividend + 0], a ld a, [hProduct + 3] ld [hDividend + 1], a - ld a, [hStringCmpString1 + 0] + ld a, [hEnemyMonSpeed + 0] ld b, a - ld a, [hStringCmpString1 + 1] + ld a, [hEnemyMonSpeed + 1] srl b rr a srl b @@ -3772,7 +3772,7 @@ TryToRunAwayFromBattle: ld a, [hQuotient + 2] cp b jr nc, .can_escape - ld a, $1 + ld a, BATTLEPLAYERACTION_USEITEM ld [wBattlePlayerAction], a ld hl, BattleText_CantEscape2 jr .print_inescapable_text @@ -3786,7 +3786,7 @@ TryToRunAwayFromBattle: .print_inescapable_text call StdBattleTextBox - ld a, $1 + ld a, TRUE ld [wFailedToFlee], a call LoadTileMapToTempTileMap and a @@ -3798,7 +3798,7 @@ TryToRunAwayFromBattle: ld a, DRAW jr z, .fled call LoadTileMapToTempTileMap - xor a + xor a ; BATTLEPLAYERACTION_USEMOVE ld [wBattlePlayerAction], a ld a, $f ld [wCurMoveNum], a @@ -4429,7 +4429,7 @@ UseConfusionHealingItem: .heal_status ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVarAddr res SUBSTATUS_CONFUSED, [hl] @@ -4496,7 +4496,7 @@ HandleStatBoostingHeldItems: jr nz, .loop pop bc ld a, [bc] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a push bc dec hl dec hl @@ -4952,7 +4952,7 @@ BattleMenu_Pack: farcall BattlePack ld a, [wBattlePlayerAction] - and a + and a ; BATTLEPLAYERACTION_USEMOVE? jr z, .didnt_use_item jr .got_item @@ -5157,7 +5157,7 @@ TryPlayerSwitch: jp z, BattleMenuPKMN_Loop ld a, [wCurBattleMon] ld [wLastPlayerMon], a - ld a, $2 + ld a, BATTLEPLAYERACTION_SWITCH ld [wBattlePlayerAction], a call ClearPalettes call DelayFrame @@ -5270,8 +5270,8 @@ PassedBattleMonEntrance: ld [wCurBattleMon], a call AddBattleParticipant call InitBattleMon - xor a - ld [wd265], a + xor a ; FALSE + ld [wApplyStatLevelMultipliersToEnemy], a call ApplyStatLevelMultiplierOnAllStats call SendOutPlayerMon call EmptyBattleTextBox @@ -5286,11 +5286,11 @@ BattleMenu_Run: ld hl, wBattleMonSpeed ld de, wEnemyMonSpeed call TryToRunAwayFromBattle - ld a, $0 + ld a, FALSE ld [wFailedToFlee], a ret c ld a, [wBattlePlayerAction] - and a + and a ; BATTLEPLAYERACTION_USEMOVE? ret nz jp BattleMenu @@ -5770,7 +5770,7 @@ ParseEnemyAction: call EmptyBattleTextBox call LoadTileMapToTempTileMap ld a, [wBattlePlayerAction] - and a + and a ; BATTLEPLAYERACTION_USEMOVE? call z, LinkBattleSendReceiveAction call Call_LoadTempTileMapToTileMap ld a, [wBattleAction] @@ -5989,7 +5989,7 @@ LoadEnemyMon: ; Used for Ho-Oh, Lugia and Snorlax encounters ld a, [wBattleType] cp BATTLETYPE_FORCEITEM - ld a, [wBaseItems] + ld a, [wBaseItem1] jr z, .UpdateItem ; Failing that, it's all up to chance @@ -6007,9 +6007,9 @@ LoadEnemyMon: ; From there, an 8% chance for Item2 call BattleRandom cp 8 percent ; 8% of 25% = 2% Item2 - ld a, [wBaseItems] + ld a, [wBaseItem1] jr nc, .UpdateItem - ld a, [wBaseItems+1] + ld a, [wBaseItem2] .UpdateItem: ld [wEnemyMonItem], a @@ -6375,7 +6375,7 @@ LoadEnemyMon: ld [de], a ld a, [wTempEnemyMonSpecies] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName @@ -6661,14 +6661,14 @@ ApplyStatLevelMultiplierOnAllStats: call ApplyStatLevelMultiplier inc c ld a, c - cp 5 + cp NUM_BATTLE_STATS jr nz, .stat_loop ret ApplyStatLevelMultiplier: push bc push bc - ld a, [wd265] + ld a, [wApplyStatLevelMultipliersToEnemy] and a ld a, c ld hl, wBattleMonAttack @@ -6718,7 +6718,7 @@ ApplyStatLevelMultiplier: call Multiply ld a, [hl] ld [hDivisor], a - ld b, $4 + ld b, 4 call Divide pop hl @@ -6992,7 +6992,7 @@ GiveExperiencePoints: ld a, [wCurPartyMon] ld c, a ld b, CHECK_FLAG - ld d, $0 + ld d, FALSE predef SmallFarFlagAction ld a, c and a @@ -7006,7 +7006,7 @@ GiveExperiencePoints: ld e, l ld hl, wEnemyMonBaseStats - 1 push bc - ld c, $5 + ld c, NUM_EXP_STATS .loop1 inc hl ld a, [de] @@ -7113,7 +7113,7 @@ GiveExperiencePoints: push bc call LoadTileMapToTempTileMap pop bc - ld hl, MON_STAT_EXP - 1 + ld hl, MON_EXP + 2 add hl, bc ld d, [hl] ld a, [hQuotient + 2] @@ -7145,7 +7145,7 @@ GiveExperiencePoints: ld d, MAX_LEVEL callfar CalcExpAtLevel pop bc - ld hl, MON_STAT_EXP - 1 + ld hl, MON_EXP + 2 add hl, bc push bc ld a, [hQuotient] @@ -7192,7 +7192,7 @@ GiveExperiencePoints: add hl, bc ld a, [hl] ld [wCurSpecies], a - ld [wd265], a + ld [wTempSpecies], a ; unused? call GetBaseData ld hl, MON_MAXHP + 1 add hl, bc @@ -7256,8 +7256,8 @@ GiveExperiencePoints: call CopyBytes .transformed - xor a - ld [wd265], a + xor a ; FALSE + ld [wApplyStatLevelMultipliersToEnemy], a call ApplyStatLevelMultiplierOnAllStats callfar ApplyStatusEffectOnPlayerStats callfar BadgeStatBoosts @@ -7286,20 +7286,20 @@ GiveExperiencePoints: ld [wMonType], a predef CopyMonToTempMon hlcoord 9, 0 - ld b, $a - ld c, $9 + ld b, 10 + ld c, 9 call TextBox hlcoord 11, 1 ld bc, 4 predef PrintTempMonStats - ld c, $1e + ld c, 30 call DelayFrames call WaitPressAorB_BlinkCursor call Call_LoadTempTileMapToTileMap xor a ; PARTYMON ld [wMonType], a ld a, [wCurSpecies] - ld [wd265], a + ld [wTempSpecies], a ; unused? ld a, [wCurPartyLevel] push af ld c, a @@ -7359,7 +7359,7 @@ GiveExperiencePoints: cp 2 ret c - ld [wd265], a + ld [wTempByteValue], a ld hl, wEnemyMonBaseStats ld c, wEnemyMonEnd - wEnemyMonBaseStats .count_loop2 @@ -7367,7 +7367,7 @@ GiveExperiencePoints: ld [hDividend + 0], a ld a, [hl] ld [hDividend + 1], a - ld a, [wd265] + ld a, [wTempByteValue] ld [hDivisor], a ld b, 2 call Divide @@ -8578,7 +8578,7 @@ ReadAndPrintLinkBattleRecord: db " 0 0 0@" .Format: - db " --- <LNBRK>" + db " --- <LF>" db " - - -@" .Record: db "<PLAYER>'s RECORD@" @@ -8712,7 +8712,7 @@ AddLastMobileBattleToLinkRecord: push de ld bc, 12 ld de, wStringBuffer1 - call CompareLong + call CompareBytesLong pop de pop hl jr c, .done @@ -8821,7 +8821,7 @@ AddLastMobileBattleToLinkRecord: pop hl push bc ld c, 3 - call StringCmp + call CompareBytes pop bc jr z, .equal jr nc, .done2 @@ -9094,7 +9094,7 @@ BattleStartMessage: jr .skip_cry ; cry is played during the animation .cry_no_anim - ld a, $0f + ld a, $f ld [wCryTracks], a ld a, [wTempEnemyMonSpecies] call PlayStereoCry diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index 3e6d928d2..91c021a72 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -2,7 +2,7 @@ DoPlayerTurn: call SetPlayerTurn ld a, [wBattlePlayerAction] - and a + and a ; BATTLEPLAYERACTION_USEMOVE? ret nz jr DoTurn @@ -1210,7 +1210,9 @@ BattleCommand_Critical: ld [wCriticalHit], a ret -INCLUDE "data/battle/critical_hits.asm" +INCLUDE "data/moves/critical_hit_moves.asm" + +INCLUDE "data/battle/critical_hit_chances.asm" INCLUDE "engine/battle/move_effects/triple_kick.asm" @@ -1246,7 +1248,7 @@ BattleCommand_Stab: .go ld a, BATTLE_VARS_MOVE_TYPE call GetBattleVarAddr - ld [wTypeMatchup], a + ld [wCurType], a push hl push de @@ -1262,7 +1264,7 @@ BattleCommand_Stab: pop bc pop de - ld a, [wTypeMatchup] + ld a, [wCurType] cp b jr z, .stab cp c @@ -2361,10 +2363,12 @@ BattleCommand_SuperEffectiveText: .print jp StdBattleTextBox -BattleCommand_CheckDestinyBond: -; checkdestinybond +BattleCommand_CheckFaint: +; checkfaint -; Faint the user if it fainted an opponent using Destiny Bond. +; Faint the opponent if its HP reached zero +; and faint the user along with it if it used Destiny Bond. +; Ends the move effect if the opponent faints. ld hl, wEnemyMonHP ld a, [hBattleTurn] @@ -2592,7 +2596,7 @@ PlayerAttackDamage: .physicalcrit ld hl, wBattleMonAttack - call GetDamageStatsCritical + call CheckDamageStatsCritical jr c, .thickclub ld hl, wEnemyDefense @@ -2616,7 +2620,7 @@ PlayerAttackDamage: .specialcrit ld hl, wBattleMonSpclAtk - call GetDamageStatsCritical + call CheckDamageStatsCritical jr c, .lightball ld hl, wEnemySpDef @@ -2677,7 +2681,7 @@ TruncateHL_BC: .finish ld a, [wLinkMode] - cp 3 + cp LINK_COLOSSEUM jr z, .done ; If we go back to the loop point, ; it's the same as doing this exact @@ -2690,20 +2694,16 @@ TruncateHL_BC: ld b, l ret -GetDamageStatsCritical: -; Return carry if non-critical. +CheckDamageStatsCritical: +; Return carry if boosted stats should be used in damage calculations. +; Unboosted stats should be used if the attack is a critical hit, +; and the stage of the opponent's defense is higher than the user's attack. ld a, [wCriticalHit] and a scf ret z - ; fallthrough - -GetDamageStats: -; Return the attacker's offensive stat and the defender's defensive -; stat based on whether the attacking type is physical or special. - push hl push bc ld a, [hBattleTurn] @@ -2838,7 +2838,7 @@ EnemyAttackDamage: .physicalcrit ld hl, wEnemyMonAttack - call GetDamageStatsCritical + call CheckDamageStatsCritical jr c, .thickclub ld hl, wPlayerDefense @@ -2862,7 +2862,7 @@ EnemyAttackDamage: .specialcrit ld hl, wEnemyMonSpclAtk - call GetDamageStatsCritical + call CheckDamageStatsCritical jr c, .lightball ld hl, wPlayerSpDef ld a, [hli] @@ -3581,7 +3581,7 @@ UpdateMoveData: ld a, BATTLE_VARS_MOVE call GetBattleVar - ld [wCurMove], a + ld [wCurSpecies], a ld [wNamedObjectIndexBuffer], a dec a @@ -4183,13 +4183,13 @@ BattleCommand_EvasionUp2: BattleCommand_StatUp: ; statup - call CheckIfStatCanBeRaised + call RaiseStat ld a, [wFailedMessage] and a ret nz - jp StatUpAnimation + jp MinimizeDropSub -CheckIfStatCanBeRaised: +RaiseStat: ld a, b ld [wLoweredStat], a ld hl, wPlayerStatLevels @@ -4285,7 +4285,9 @@ CheckIfStatCanBeRaised: ld [wFailedMessage], a ret -StatUpAnimation: +MinimizeDropSub: +; Lower the substitute if we're minimizing + ld bc, wPlayerMinimized ld hl, DropPlayerSub ld a, [hBattleTurn] @@ -6152,7 +6154,7 @@ BattleCommand_Heal: push de push bc ld c, 2 - call StringCmp + call CompareBytes pop bc pop de pop hl @@ -6571,7 +6573,7 @@ BattleCommand_TimeBasedHealContinue: ; Don't bother healing if HP is already full. push bc - call StringCmp + call CompareBytes pop bc jr z, .Full @@ -6682,7 +6684,7 @@ INCLUDE "engine/battle/move_effects/future_sight.asm" INCLUDE "engine/battle/move_effects/thunder.asm" CheckHiddenOpponent: -; BUG: This routine should account for Lock-On and Mind Reader. +; BUG: This routine is completely redundant and introduces a bug, since BattleCommand_CheckHit does these checks properly. ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVar and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm index 48062f643..8985385a0 100644 --- a/engine/battle/misc.asm +++ b/engine/battle/misc.asm @@ -53,13 +53,13 @@ DoWeatherModifiers: ld de, WeatherTypeModifiers ld a, [wBattleWeather] ld b, a - ld a, [wd265] ; move type + ld a, [wCurType] ld c, a .CheckWeatherType: ld a, [de] inc de - cp $ff + cp -1 jr z, .done_weather_types cp b @@ -84,7 +84,7 @@ DoWeatherModifiers: .CheckWeatherMove: ld a, [de] inc de - cp $ff + cp -1 jr z, .done cp b @@ -116,7 +116,7 @@ DoWeatherModifiers: ld a, 10 ld [hDivisor], a - ld b, $4 + ld b, 4 call Divide ld a, [hQuotient + 0] @@ -176,7 +176,7 @@ DoBadgeTypeBoosts: rr c jr nc, .NextBadge - ld a, [wd265] ; move type + ld a, [wCurType] cp [hl] jr z, .ApplyBoost diff --git a/engine/battle/move_effects/baton_pass.asm b/engine/battle/move_effects/baton_pass.asm index 5d9f19838..7f922b214 100644 --- a/engine/battle/move_effects/baton_pass.asm +++ b/engine/battle/move_effects/baton_pass.asm @@ -68,8 +68,8 @@ BattleCommand_BatonPass: call CallBattleCore ld hl, ResetBattleParticipants call CallBattleCore - ld a, 1 - ld [wTypeMatchup], a + ld a, TRUE + ld [wApplyStatLevelMultipliersToEnemy], a ld hl, ApplyStatLevelMultiplierOnAllStats call CallBattleCore @@ -83,7 +83,7 @@ BatonPass_LinkPlayerSwitch: and a ret z - ld a, 1 + ld a, BATTLEPLAYERACTION_USEITEM ld [wBattlePlayerAction], a call LoadStandardMenuHeader @@ -91,7 +91,7 @@ BatonPass_LinkPlayerSwitch: call CallBattleCore call CloseWindow - xor a + xor a ; BATTLEPLAYERACTION_USEMOVE ld [wBattlePlayerAction], a ret diff --git a/engine/battle/move_effects/counter.asm b/engine/battle/move_effects/counter.asm index f92e1b3ac..031c399a6 100644 --- a/engine/battle/move_effects/counter.asm +++ b/engine/battle/move_effects/counter.asm @@ -36,6 +36,7 @@ BattleCommand_Counter: cp SPECIAL ret nc + ; BUG: Move should fail with all non-damaging battle actions ld hl, wCurDamage ld a, [hli] or [hl] diff --git a/engine/battle/move_effects/false_swipe.asm b/engine/battle/move_effects/false_swipe.asm index 4f4eb329c..0d3f7d47c 100644 --- a/engine/battle/move_effects/false_swipe.asm +++ b/engine/battle/move_effects/false_swipe.asm @@ -13,7 +13,7 @@ BattleCommand_FalseSwipe: ld c, 2 push hl push de - call StringCmp + call CompareBytes pop de pop hl jr c, .done diff --git a/engine/battle/move_effects/magnitude.asm b/engine/battle/move_effects/magnitude.asm index 4dcf919d7..eaa0c2a3a 100644 --- a/engine/battle/move_effects/magnitude.asm +++ b/engine/battle/move_effects/magnitude.asm @@ -18,7 +18,7 @@ BattleCommand_GetMagnitude: push de inc hl ld a, [hl] - ld [wTypeMatchup], a + ld [wDeciramBuffer], a call BattleCommand_MoveDelay ld hl, MagnitudeText call StdBattleTextBox diff --git a/engine/battle/move_effects/metronome.asm b/engine/battle/move_effects/metronome.asm index b8a6b586f..25197d7cd 100644 --- a/engine/battle/move_effects/metronome.asm +++ b/engine/battle/move_effects/metronome.asm @@ -40,4 +40,4 @@ BattleCommand_Metronome: call UpdateMoveData jp ResetTurn -INCLUDE "data/battle/metronome_exception_moves.asm" +INCLUDE "data/moves/metronome_exception_moves.asm" diff --git a/engine/battle/move_effects/mirror_coat.asm b/engine/battle/move_effects/mirror_coat.asm index 8743c389d..96afa3175 100644 --- a/engine/battle/move_effects/mirror_coat.asm +++ b/engine/battle/move_effects/mirror_coat.asm @@ -29,14 +29,15 @@ BattleCommand_MirrorCoat: ld de, wStringBuffer1 call GetMoveData - ld a, [wStringBuffer1 + 2] + ld a, [wStringBuffer1 + MOVE_POWER] and a ret z - ld a, [wStringBuffer1 + 3] + ld a, [wStringBuffer1 + MOVE_TYPE] cp SPECIAL ret c + ; BUG: Move should fail with all non-damaging battle actions ld hl, wCurDamage ld a, [hli] or [hl] diff --git a/engine/battle/move_effects/mirror_move.asm b/engine/battle/move_effects/mirror_move.asm index 089403839..89879c825 100644 --- a/engine/battle/move_effects/mirror_move.asm +++ b/engine/battle/move_effects/mirror_move.asm @@ -24,7 +24,7 @@ BattleCommand_MirrorMove: .use ld a, b ld [hl], a - ld [wd265], a + ld [wNamedObjectIndexBuffer], a push af ld a, BATTLE_VARS_MOVE_ANIM diff --git a/engine/battle/move_effects/sketch.asm b/engine/battle/move_effects/sketch.asm index 4c15dbe02..a5b0d1c03 100644 --- a/engine/battle/move_effects/sketch.asm +++ b/engine/battle/move_effects/sketch.asm @@ -34,7 +34,7 @@ BattleCommand_Sketch: .get_last_move ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar - ld [wTypeMatchup], a + ld [wNamedObjectIndexBuffer], a ld b, a ; Fail if move is invalid or is Struggle. and a diff --git a/engine/battle/move_effects/spite.asm b/engine/battle/move_effects/spite.asm index 8aba187a4..71252fe22 100644 --- a/engine/battle/move_effects/spite.asm +++ b/engine/battle/move_effects/spite.asm @@ -24,7 +24,7 @@ BattleCommand_Spite: ld a, [hli] cp b jr nz, .loop - ld [wTypeMatchup], a + ld [wNamedObjectIndexBuffer], a dec hl ld b, 0 push bc @@ -78,7 +78,7 @@ BattleCommand_Spite: call AnimateCurrentMove pop de ld a, d - ld [wTypeMatchup], a + ld [wDeciramBuffer], a ld hl, SpiteEffectText jp StdBattleTextBox diff --git a/engine/battle/move_effects/thief.asm b/engine/battle/move_effects/thief.asm index 64de1a4fe..34a9699fc 100644 --- a/engine/battle/move_effects/thief.asm +++ b/engine/battle/move_effects/thief.asm @@ -21,7 +21,7 @@ BattleCommand_Thief: ; Can't steal mail. - ld [wd265], a + ld [wNamedObjectIndexBuffer], a ld d, a farcall ItemIsMail ret c @@ -45,7 +45,7 @@ BattleCommand_Thief: ld [de], a call .playeritem - ld a, [wd265] + ld a, [wNamedObjectIndexBuffer] ld [hl], a ld [de], a jr .stole @@ -68,7 +68,7 @@ BattleCommand_Thief: ; Can't steal mail! - ld [wd265], a + ld [wNamedObjectIndexBuffer], a ld d, a farcall ItemIsMail ret c @@ -86,7 +86,7 @@ BattleCommand_Thief: ld [de], a call .enemyitem - ld a, [wd265] + ld a, [wNamedObjectIndexBuffer] ld [hl], a ld [de], a diff --git a/engine/battle/start_battle.asm b/engine/battle/start_battle.asm index 5c2a633a8..f5fc4a6b0 100644 --- a/engine/battle/start_battle.asm +++ b/engine/battle/start_battle.asm @@ -16,7 +16,7 @@ FindFirstAliveMonAndStartBattle: xor a ld [hMapAnims], a call DelayFrame - ld b, 6 + ld b, PARTY_LENGTH ld hl, wPartyMon1HP ld de, PARTYMON_STRUCT_LENGTH - 1 diff --git a/engine/battle/trainer_huds.asm b/engine/battle/trainer_huds.asm index 3930549b2..7a971e21f 100644 --- a/engine/battle/trainer_huds.asm +++ b/engine/battle/trainer_huds.asm @@ -101,7 +101,7 @@ StageBallTilesData: DrawPlayerHUDBorder: ld hl, .tiles ld de, wTrainerHUDTiles - ld bc, 4 + ld bc, .tiles_end - .tiles call CopyBytes hlcoord 18, 10 ld de, -1 ; start on right @@ -112,11 +112,12 @@ DrawPlayerHUDBorder: db $77 ; bottom right db $6f ; bottom left db $76 ; bottom side +.tiles_end DrawPlayerPartyIconHUDBorder: ld hl, .tiles ld de, wTrainerHUDTiles - ld bc, 4 + ld bc, .tiles_end - .tiles call CopyBytes hlcoord 18, 10 ld de, -1 ; start on right @@ -127,11 +128,12 @@ DrawPlayerPartyIconHUDBorder: db $5c ; bottom right db $6f ; bottom left db $76 ; bottom side +.tiles_end DrawEnemyHUDBorder: ld hl, .tiles ld de, wTrainerHUDTiles - ld bc, 4 + ld bc, .tiles_end - .tiles call CopyBytes hlcoord 1, 2 ld de, 1 ; start on left @@ -152,23 +154,24 @@ DrawEnemyHUDBorder: db $74 ; bottom left db $78 ; bottom right db $76 ; bottom side +.tiles_end PlaceHUDBorderTiles: - ld a, [wTrainerHUDTiles] + ld a, [wTrainerHUDTiles + 0] ld [hl], a ld bc, SCREEN_WIDTH add hl, bc - ld a, [wStartFlypoint] + ld a, [wTrainerHUDTiles + 1] ld [hl], a - ld b, $8 + ld b, 8 .loop add hl, de - ld a, [wMovementBuffer] + ld a, [wTrainerHUDTiles + 3] ld [hl], a dec b jr nz, .loop add hl, de - ld a, [wEndFlypoint] + ld a, [wTrainerHUDTiles + 2] ld [hl], a ret @@ -181,7 +184,7 @@ LinkBattle_TrainerHuds: ld a, 10 * 8 ld [hli], a ld [hl], 8 * 8 - ld a, $8 + ld a, 8 ld [wPlaceBallsDirection], a ld hl, wVirtualOAMSprite00 call LoadTrainerHudOAM diff --git a/engine/battle/used_move_text.asm b/engine/battle/used_move_text.asm index 9307a1a1e..8166094f2 100644 --- a/engine/battle/used_move_text.asm +++ b/engine/battle/used_move_text.asm @@ -26,7 +26,7 @@ UsedMoveText: ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar - ld [wd265], a + ld [wMoveGrammar], a push hl farcall CheckUserIsCharging @@ -34,13 +34,12 @@ UsedMoveText: jr nz, .grammar ; update last move - ld a, [wd265] + ld a, [wMoveGrammar] ld [hl], a ld [de], a .grammar - call GetMoveGrammar -; wd265 now contains MoveGrammar + call GetMoveGrammar ; convert move id to grammar index ; everything except 'instead' made redundant in localization @@ -51,7 +50,7 @@ UsedMoveText: ret nz ; check move grammar - ld a, [wd265] + ld a, [wMoveGrammar] cp $3 ld hl, UsedMove2Text ret c @@ -89,14 +88,14 @@ MoveNameText: ld hl, .endusedmovetexts ; get move id - ld a, [wd265] + ld a, [wMoveGrammar] ; 2-byte pointer add a ; seek push bc - ld b, $0 + ld b, 0 ld c, a add hl, bc pop bc @@ -132,13 +131,13 @@ EndUsedMove5Text: db "@" GetMoveGrammar: -; store move grammar type in wd265 +; store move grammar type in wMoveGrammar push bc -; c = move id - ld a, [wd265] - ld c, a - ld b, $0 +; wMoveGrammar contains move id + ld a, [wMoveGrammar] + ld c, a ; move id + ld b, 0 ; grammar index ; read grammar table ld hl, MoveGrammar @@ -158,9 +157,9 @@ GetMoveGrammar: jr .loop .end -; wd265 now contains move grammar +; wMoveGrammar now contains move grammar ld a, b - ld [wd265], a + ld [wMoveGrammar], a ; we're done pop bc diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index e68b7d774..600168a9a 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -284,7 +284,7 @@ RunBattleAnimCommand: .loop call GetBattleAnimByte - cp $ff + cp anim_ret_command jr nz, .not_done_with_anim ; Return from a subroutine. diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm index e51080ae0..534e2c331 100644 --- a/engine/events/battle_tower/battle_tower.asm +++ b/engine/events/battle_tower/battle_tower.asm @@ -270,7 +270,7 @@ ReadBTTrainerParty: ; Check the nicknames for illegal characters, and replace bad nicknames ; with their species names. - ld de, wBT_OTTempMon1Name ; $c643 + ld de, wBT_OTTempMon1Name ld c, MON_NAME_LENGTH farcall CheckStringForErrors jr nc, .skip_mon_1 @@ -280,44 +280,44 @@ ReadBTTrainerParty: call GetPokemonName ld l, e ld h, d - ld de, wBT_OTTempMon1Name ; $c643 + ld de, wBT_OTTempMon1Name ld bc, MON_NAME_LENGTH call CopyBytes .skip_mon_1 - ld de, wBT_OTTempMon2Name ; $c67e + ld de, wBT_OTTempMon2Name ld c, MON_NAME_LENGTH farcall CheckStringForErrors jr nc, .skip_mon_2 - ld a, [wBT_OTTempMon2] ; [$c64e] + ld a, [wBT_OTTempMon2] ld [wNamedObjectIndexBuffer], a call GetPokemonName ld l, e ld h, d - ld de, wBT_OTTempMon2Name ; $c67e + ld de, wBT_OTTempMon2Name ld bc, MON_NAME_LENGTH call CopyBytes .skip_mon_2 - ld de, wBT_OTTempMon3Name ; $c686 + 51 = $c6b9 + ld de, wBT_OTTempMon3Name ld c, MON_NAME_LENGTH farcall CheckStringForErrors jr nc, .skip_mon_3 - ld a, [wBT_OTTempMon3] ; [$c689] + ld a, [wBT_OTTempMon3] ld [wNamedObjectIndexBuffer], a call GetPokemonName ld l, e ld h, d - ld de, wBT_OTTempMon3Name ; $c686 + 51 = $c6b9 + ld de, wBT_OTTempMon3Name ld bc, MON_NAME_LENGTH call CopyBytes .skip_mon_3 ; Add the terminator character to each of these names ld a, "@" - ld [wBT_OTTempMon1NameEnd - 1], a ; $c64d - ld [wBT_OTTempMon2NameEnd - 1], a ; $c688 - ld [wBT_OTTempMon3NameEnd - 1], a ; $c68a + 57 = $c6c3 + ld [wBT_OTTempMon1NameEnd - 1], a + ld [wBT_OTTempMon2NameEnd - 1], a + ld [wBT_OTTempMon3NameEnd - 1], a ; Fix errors in the movesets call CheckBTMonMovesForErrors ; Repair the trainer name if needed, then copy it to wOTPlayerName diff --git a/engine/events/battle_tower/load_trainer.asm b/engine/events/battle_tower/load_trainer.asm index 2f34950b6..f9be02b28 100644 --- a/engine/events/battle_tower/load_trainer.asm +++ b/engine/events/battle_tower/load_trainer.asm @@ -104,7 +104,7 @@ Function_LoadRandomBattleTowerMon: ld a, [wBTChoiceOfLvlGroup] dec a ld hl, BattleTowerMons - ld bc, BattleTowerMons2 - BattleTowerMons1 + ld bc, BattleTowerMons2 - BattleTowerMons1 ; size of one level group call AddNTimes ld a, [hRandomAdd] diff --git a/engine/events/bug_contest/caught_mon.asm b/engine/events/bug_contest/caught_mon.asm index 45212ae3e..fc170cf28 100644 --- a/engine/events/bug_contest/caught_mon.asm +++ b/engine/events/bug_contest/caught_mon.asm @@ -2,7 +2,7 @@ BugContest_SetCaughtContestMon: ld a, [wContestMon] and a jr z, .firstcatch - ld [wd265], a + ld [wNamedObjectIndexBuffer], a farcall DisplayAlreadyCaughtText farcall DisplayCaughtContestMonStats lb bc, 14, 7 @@ -12,7 +12,7 @@ BugContest_SetCaughtContestMon: .firstcatch call .generatestats ld a, [wTempEnemyMonSpecies] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, .caughttext call PrintText diff --git a/engine/events/bug_contest/contest_2.asm b/engine/events/bug_contest/contest_2.asm index 9cf70a03e..ddfad8644 100644 --- a/engine/events/bug_contest/contest_2.asm +++ b/engine/events/bug_contest/contest_2.asm @@ -58,9 +58,6 @@ SelectRandomBugContestContestants: CheckBugContestContestantFlag: ; Checks the flag of the Bug Catching Contestant whose index is loaded in a. -; Bug: If a >= NUM_BUG_CONTESTANTS when this is called, -; it will read beyond the table. - ld hl, BugCatchingContestantEventFlagTable ld e, a ld d, 0 diff --git a/engine/events/bug_contest/display_stats.asm b/engine/events/bug_contest/display_stats.asm index 94a5e9511..9d92f8fe3 100644 --- a/engine/events/bug_contest/display_stats.asm +++ b/engine/events/bug_contest/display_stats.asm @@ -36,7 +36,7 @@ DisplayCaughtContestMonStats: call PlaceString ld a, [wContestMon] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld de, wStringBuffer1 hlcoord 1, 2 diff --git a/engine/events/bug_contest/judging.asm b/engine/events/bug_contest/judging.asm index d8f9d7657..a6ec3baf6 100644 --- a/engine/events/bug_contest/judging.asm +++ b/engine/events/bug_contest/judging.asm @@ -171,7 +171,7 @@ DetermineContestWinners: ld de, wBugContestTempScore ld hl, wBugContestFirstPlaceScore ld c, 2 - call StringCmp + call CompareBytes jr c, .not_first_place ld hl, wBugContestSecondPlaceWinnerID ld de, wBugContestThirdPlaceWinnerID @@ -189,7 +189,7 @@ DetermineContestWinners: ld de, wBugContestTempScore ld hl, wBugContestSecondPlaceScore ld c, 2 - call StringCmp + call CompareBytes jr c, .not_second_place ld hl, wBugContestSecondPlaceWinnerID ld de, wBugContestThirdPlaceWinnerID @@ -203,7 +203,7 @@ DetermineContestWinners: ld de, wBugContestTempScore ld hl, wBugContestThirdPlaceScore ld c, 2 - call StringCmp + call CompareBytes jr c, .done ld hl, wBugContestThirdPlaceWinnerID call CopyTempContestant diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm index 76bdbaa76..a34f3935a 100644 --- a/engine/events/celebi.asm +++ b/engine/events/celebi.asm @@ -31,7 +31,7 @@ CelebiShrineEvent: call GetCelebiSpriteTile inc d push de - ld a, $90 + ld a, 36 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a farcall DoNextFrameForAllSprites call CelebiEvent_CountDown diff --git a/engine/events/daycare.asm b/engine/events/daycare.asm index 5904a476d..4e98c5382 100644 --- a/engine/events/daycare.asm +++ b/engine/events/daycare.asm @@ -558,7 +558,7 @@ DayCare_InitBreeding: bit DAYCAREMAN_HAS_MON_F, a ret z callfar CheckBreedmonCompatibility - ld a, [wd265] + ld a, [wBreedingCompatibility] and a ret z inc a diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm index f5ad049f2..a6edbc08c 100644 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -1,3 +1,7 @@ +FIELDMOVE_GRASS EQU $80 +FIELDMOVE_TREE EQU $84 +FIELDMOVE_FLY EQU $84 + PlayWhirlpoolSound: call WaitSFX ld de, SFX_SURF @@ -20,11 +24,11 @@ BlindingFlash: ShakeHeadbuttTree: farcall ClearSpriteAnims ld de, CutGrassGFX - ld hl, vTiles1 tile $00 + ld hl, vTiles0 tile FIELDMOVE_GRASS lb bc, BANK(CutGrassGFX), 4 call Request2bpp ld de, HeadbuttTreeGFX - ld hl, vTiles1 tile $04 + ld hl, vTiles0 tile FIELDMOVE_TREE lb bc, BANK(HeadbuttTreeGFX), 8 call Request2bpp call Cut_Headbutt_GetPixelFacing @@ -32,8 +36,8 @@ ShakeHeadbuttTree: call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $84 - ld a, 36 * 4 + ld [hl], FIELDMOVE_TREE + ld a, 36 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a farcall DoNextFrameForAllSprites call HideHeadbuttTree @@ -48,7 +52,7 @@ ShakeHeadbuttTree: and a jr z, .done dec [hl] - ld a, 36 * 4 + ld a, 36 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a farcall DoNextFrameForAllSprites call DelayFrame @@ -111,7 +115,7 @@ OWCutAnimation: ; 0: Split tree in half ; 1: Mow the lawn ld a, e - and $1 + and 1 ld [wJumptableIndex], a call .LoadCutGFX call WaitSFX @@ -121,7 +125,7 @@ OWCutAnimation: ld a, [wJumptableIndex] bit 7, a jr nz, .finish - ld a, 36 * 4 + ld a, 36 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a callfar DoNextFrameForAllSprites call OWCutJumptable @@ -134,11 +138,11 @@ OWCutAnimation: .LoadCutGFX: callfar ClearSpriteAnims ; pointless to farcall ld de, CutGrassGFX - ld hl, vTiles1 tile $00 + ld hl, vTiles0 tile FIELDMOVE_GRASS lb bc, BANK(CutGrassGFX), 4 call Request2bpp ld de, CutTreeGFX - ld hl, vTiles1 tile $04 + ld hl, vTiles0 tile FIELDMOVE_TREE lb bc, BANK(CutTreeGFX), 4 call Request2bpp ret @@ -173,7 +177,7 @@ Cut_SpawnAnimateTree: call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $84 + ld [hl], FIELDMOVE_TREE ld a, 32 ld [wFrameCounter], a ; Cut_StartWaiting @@ -226,7 +230,7 @@ Cut_SpawnLeaf: call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $80 + ld [hl], FIELDMOVE_GRASS ld hl, SPRITEANIMSTRUCT_0E add hl, bc ld [hl], $4 @@ -313,7 +317,7 @@ FlyFromAnim: call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $84 + ld [hl], FIELDMOVE_FLY ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID add hl, bc ld [hl], SPRITE_ANIM_SEQ_FLY_FROM @@ -323,7 +327,7 @@ FlyFromAnim: ld a, [wJumptableIndex] bit 7, a jr nz, .exit - ld a, 0 * 4 + ld a, 0 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a callfar DoNextFrameForAllSprites call FlyFunction_FrameTimer @@ -347,7 +351,7 @@ FlyToAnim: call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $84 + ld [hl], FIELDMOVE_FLY ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID add hl, bc ld [hl], SPRITE_ANIM_SEQ_FLY_TO @@ -360,7 +364,7 @@ FlyToAnim: ld a, [wJumptableIndex] bit 7, a jr nz, .exit - ld a, 0 * 4 + ld a, 0 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a callfar DoNextFrameForAllSprites call FlyFunction_FrameTimer @@ -394,7 +398,7 @@ endr FlyFunction_InitGFX: callfar ClearSpriteAnims ld de, CutGrassGFX - ld hl, vTiles1 tile $00 + ld hl, vTiles0 tile FIELDMOVE_GRASS lb bc, BANK(CutGrassGFX), 4 call Request2bpp ld a, [wCurPartyMon] @@ -403,8 +407,8 @@ FlyFunction_InitGFX: ld d, 0 add hl, de ld a, [hl] - ld [wd265], a - ld e, $84 + ld [wTempIconSpecies], a + ld e, FIELDMOVE_FLY farcall FlyFunction_GetMonIcon xor a ld [wJumptableIndex], a @@ -446,5 +450,5 @@ FlyFunction_FrameTimer: call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $80 + ld [hl], FIELDMOVE_GRASS ret diff --git a/engine/events/fish.asm b/engine/events/fish.asm index a1df536bb..c1dde87d8 100644 --- a/engine/events/fish.asm +++ b/engine/events/fish.asm @@ -93,8 +93,8 @@ GetFishGroupIndex: ; Return the index of fishgroup d in de. push hl - ld hl, wDailyFlags - bit DAILYFLAGS_FISH_SWARM_F, [hl] + ld hl, wDailyFlags1 + bit DAILYFLAGS1_FISH_SWARM_F, [hl] pop hl jr z, .done diff --git a/engine/events/fishing_gfx.asm b/engine/events/fishing_gfx.asm index 25d1ee77a..159f0022d 100644 --- a/engine/events/fishing_gfx.asm +++ b/engine/events/fishing_gfx.asm @@ -17,7 +17,7 @@ LoadFishingGFX: call .LoadGFX ld hl, vTiles0 tile $0a call .LoadGFX - ld hl, vTiles1 tile $7c + ld hl, vTiles0 tile $fc call .LoadGFX pop af diff --git a/engine/events/fruit_trees.asm b/engine/events/fruit_trees.asm index 6d5ca6a1d..15fa4f80f 100644 --- a/engine/events/fruit_trees.asm +++ b/engine/events/fruit_trees.asm @@ -41,8 +41,8 @@ GetCurTreeFruit: ret TryResetFruitTrees: - ld hl, wDailyFlags - bit DAILYFLAGS_ALL_FRUIT_TREES_F, [hl] + ld hl, wDailyFlags1 + bit DAILYFLAGS1_ALL_FRUIT_TREES_F, [hl] ret nz jp ResetFruitTrees @@ -65,8 +65,8 @@ ResetFruitTrees: ld [hli], a ld [hli], a ld [hl], a - ld hl, wDailyFlags - set DAILYFLAGS_ALL_FRUIT_TREES_F, [hl] + ld hl, wDailyFlags1 + set DAILYFLAGS1_ALL_FRUIT_TREES_F, [hl] ret GetFruitTreeFlag: diff --git a/engine/events/halloffame.asm b/engine/events/halloffame.asm index 6cbc749d5..752ec965b 100644 --- a/engine/events/halloffame.asm +++ b/engine/events/halloffame.asm @@ -124,7 +124,7 @@ AnimateHallOfFame: call PlaceString call WaitBGMap decoord 6, 5 - ld c, $6 + ld c, ANIM_MON_HOF predef HOF_AnimateFrontpic ld c, 60 call DelayFrames @@ -390,7 +390,7 @@ _HallOfFamePC: call GetSGBLayout call SetPalettes decoord 6, 5 - ld c, $6 + ld c, ANIM_MON_HOF predef HOF_AnimateFrontpic and a ret @@ -462,7 +462,7 @@ DisplayHOFMon: call TextBox ld a, [wTempMonSpecies] ld [wCurPartySpecies], a - ld [wd265], a + ld [wDeciramBuffer], a ld hl, wTempMonDVs predef GetUnownLetter xor a @@ -477,7 +477,7 @@ DisplayHOFMon: ld [hli], a ld [hl], "<DOT>" hlcoord 3, 13 - ld de, wd265 + ld de, wDeciramBuffer lb bc, PRINTNUM_LEADINGZEROS | 1, 3 call PrintNum call GetBasePokemonName diff --git a/engine/events/happiness_egg.asm b/engine/events/happiness_egg.asm index 41f9a4411..1d33edb74 100644 --- a/engine/events/happiness_egg.asm +++ b/engine/events/happiness_egg.asm @@ -11,7 +11,7 @@ GetFirstPokemonHappiness: jr .loop .done - ld [wd265], a + ld [wNamedObjectIndexBuffer], a ld a, [hl] ld [wScriptVar], a call GetPokemonName @@ -19,9 +19,9 @@ GetFirstPokemonHappiness: CheckFirstMonIsEgg: ld a, [wPartySpecies] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a cp EGG - ld a, 1 + ld a, TRUE jr z, .egg xor a @@ -196,15 +196,15 @@ DayCareStep:: call Random ld [hl], a callfar CheckBreedmonCompatibility - ld a, [wd265] + ld a, [wBreedingCompatibility] cp 230 ld b, 32 percent - 1 jr nc, .okay - ld a, [wd265] + ld a, [wBreedingCompatibility] cp 170 ld b, 16 percent jr nc, .okay - ld a, [wd265] + ld a, [wBreedingCompatibility] cp 110 ld b, 12 percent jr nc, .okay diff --git a/engine/events/lucky_number.asm b/engine/events/lucky_number.asm index c5d6d18e0..1c3a8dc02 100644 --- a/engine/events/lucky_number.asm +++ b/engine/events/lucky_number.asm @@ -1,7 +1,7 @@ CheckForLuckyNumberWinners: xor a ld [wScriptVar], a - ld [wFoundMatchingIDInParty], a + ld [wTempByteValue], a ld a, [wPartyCount] and a ret z @@ -34,8 +34,8 @@ CheckForLuckyNumberWinners: jr z, .SkipOpenBoxMon call .CompareLuckyNumberToMonID jr nc, .SkipOpenBoxMon - ld a, 1 - ld [wFoundMatchingIDInParty], a + ld a, TRUE + ld [wTempByteValue], a .SkipOpenBoxMon: push bc @@ -81,8 +81,8 @@ CheckForLuckyNumberWinners: call .CompareLuckyNumberToMonID ; sets wScriptVar and wCurPartySpecies appropriately jr nc, .SkipBoxMon - ld a, 1 - ld [wFoundMatchingIDInParty], a + ld a, TRUE + ld [wTempByteValue], a .SkipBoxMon: push bc @@ -104,7 +104,7 @@ CheckForLuckyNumberWinners: and a ret z ; found nothing farcall StubbedTrainerRankings_LuckyNumberShow - ld a, [wFoundMatchingIDInParty] + ld a, [wTempByteValue] and a push af ld a, [wCurPartySpecies] @@ -127,14 +127,14 @@ CheckForLuckyNumberWinners: ld hl, wBuffer1 lb bc, PRINTNUM_LEADINGZEROS | 2, 5 call PrintNum - ld hl, wLuckyNumberDigit1Buffer + ld hl, wLuckyNumberDigitsBuffer ld de, wLuckyIDNumber lb bc, PRINTNUM_LEADINGZEROS | 2, 5 call PrintNum ld b, 5 ld c, 0 - ld hl, wLuckyNumberDigit5Buffer - ld de, wBuffer5 + ld hl, wLuckyNumberDigitsBuffer + 4 + ld de, wBuffer1 + 4 .loop ld a, [de] cp [hl] diff --git a/engine/events/magikarp.asm b/engine/events/magikarp.asm index 7fe8adba7..db415c65e 100644 --- a/engine/events/magikarp.asm +++ b/engine/events/magikarp.asm @@ -36,7 +36,7 @@ CheckMagikarpLength: ld hl, wMagikarpLength ld de, wBestMagikarpLengthFeet ld c, 2 - call StringCmp + call CompareBytes jr nc, .not_long_enough ; NEW RECORD!!! Let's save that. @@ -185,7 +185,7 @@ CalcMagikarpLength: ld hl, MagikarpLengths ld a, 2 - ld [wd265], a + ld [wTempByteValue], a .read ld a, [hli] @@ -214,7 +214,7 @@ CalcMagikarpLength: ld [hMultiplicand + 1], a ld a, 100 ld [hMultiplicand + 2], a - ld a, [wd265] + ld a, [wTempByteValue] ld [hMultiplier], a call Multiply ld b, 0 @@ -228,9 +228,9 @@ CalcMagikarpLength: .next inc hl ; align to next triplet - ld a, [wd265] + ld a, [wTempByteValue] inc a - ld [wd265], a + ld [wTempByteValue], a cp 16 jr c, .read diff --git a/engine/events/move_deleter.asm b/engine/events/move_deleter.asm index f2b827227..2f0df5162 100644 --- a/engine/events/move_deleter.asm +++ b/engine/events/move_deleter.asm @@ -28,7 +28,7 @@ MoveDeletion: ld a, [wMenuCursorY] push af ld a, [wCurSpecies] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetMoveName ld hl, .ConfirmDeleteText call PrintText diff --git a/engine/events/move_tutor.asm b/engine/events/move_tutor.asm index 67d0ca528..681dc6adc 100644 --- a/engine/events/move_tutor.asm +++ b/engine/events/move_tutor.asm @@ -8,7 +8,7 @@ MoveTutor: xor a ld [wItemAttributeParamBuffer], a call .GetMoveTutorMove - ld [wd265], a + ld [wNamedObjectIndexBuffer], a ld [wPutativeTMHMMove], a call GetMoveName call CopyName1 diff --git a/engine/events/name_rater.asm b/engine/events/name_rater.asm index 593d51c69..2cdff4bdd 100644 --- a/engine/events/name_rater.asm +++ b/engine/events/name_rater.asm @@ -29,7 +29,7 @@ _NameRater: xor a ; PARTYMON ld [wMonType], a ld a, [wCurPartySpecies] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a ld [wCurSpecies], a call GetBaseData ld b, 0 diff --git a/engine/events/npc_trade.asm b/engine/events/npc_trade.asm index 9cff40a2b..bb71941ed 100644 --- a/engine/events/npc_trade.asm +++ b/engine/events/npc_trade.asm @@ -301,7 +301,7 @@ Trade_GetAttributeOfLastPartymon: GetTradeMonName: push de - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetBasePokemonName ld hl, wStringBuffer1 pop de diff --git a/engine/events/odd_egg.asm b/engine/events/odd_egg.asm index 10d7cf9aa..a6b244b1d 100644 --- a/engine/events/odd_egg.asm +++ b/engine/events/odd_egg.asm @@ -39,7 +39,7 @@ _GiveOddEgg: .done ld hl, OddEggs - ld a, OddEgg2 - OddEgg1 + ld a, OddEgg1End - OddEgg1 call AddNTimes ld de, wOddEggSpecies diff --git a/engine/events/pokecenter_pc.asm b/engine/events/pokecenter_pc.asm index f1a593b5a..8f73fc41e 100644 --- a/engine/events/pokecenter_pc.asm +++ b/engine/events/pokecenter_pc.asm @@ -478,21 +478,21 @@ PlayerDepositItemMenu: push af ld a, [wBuffer2] push af - call .DepositItem_ + call .DepositItem pop af ld [wBuffer2], a pop af ld [wBuffer1], a ret -.DepositItem_: +.DepositItem: farcall _CheckTossableItem ld a, [wItemAttributeParamBuffer] and a jr z, .AskQuantity ld a, $1 ld [wItemQuantityChangeBuffer], a - jr .DepositItem + jr .ContinueDeposit .AskQuantity: ld hl, .HowManyText @@ -504,7 +504,7 @@ PlayerDepositItemMenu: pop af jr c, .DeclinedToDeposit -.DepositItem: +.ContinueDeposit: ld a, [wItemQuantityChangeBuffer] ld [wBuffer1], a ld a, [wCurItemQuantity] diff --git a/engine/events/shuckle.asm b/engine/events/shuckle.asm index c6d909afe..b1c87f53a 100644 --- a/engine/events/shuckle.asm +++ b/engine/events/shuckle.asm @@ -54,8 +54,8 @@ GiveShuckle: call CopyName2 ; Engine flag for this event. - ld hl, wDailyFlags - set DAILYFLAGS_GOT_SHUCKIE_TODAY_F, [hl] + ld hl, wDailyFlags1 + set DAILYFLAGS1_GOT_SHUCKIE_TODAY_F, [hl] ld a, 1 ld [wScriptVar], a ret diff --git a/engine/events/specials.asm b/engine/events/specials.asm index 35d32dde6..be554f1bc 100644 --- a/engine/events/specials.asm +++ b/engine/events/specials.asm @@ -34,7 +34,7 @@ GameCornerPrizeMonCheckDex: call SetSeenAndCaughtMon call FadeToMenu ld a, [wScriptVar] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a farcall NewPokedexEntry call ExitAllMenus ret @@ -153,7 +153,7 @@ GetMysteryGiftItem: ld [sMysteryGiftItem], a call CloseSRAM ld a, [wCurItem] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetItemName ld hl, .ReceiveItemText call PrintText diff --git a/engine/games/unown_puzzle.asm b/engine/games/unown_puzzle.asm index fb88d93b6..40c6527d9 100644 --- a/engine/games/unown_puzzle.asm +++ b/engine/games/unown_puzzle.asm @@ -19,11 +19,11 @@ _UnownPuzzle: xor a call ByteFill ld hl, UnownPuzzleCursorGFX - ld de, vTiles1 tile $60 + ld de, vTiles0 tile $e0 ld bc, 4 tiles call CopyBytes ld hl, UnownPuzzleStartCancelLZ - ld de, vTiles1 tile $6d + ld de, vTiles0 tile $ed call Decompress call LoadUnownPuzzlePiecesGFX hlcoord 0, 0 diff --git a/engine/gfx/cgb_layouts.asm b/engine/gfx/cgb_layouts.asm index d8f53d7fc..ffd4d4c48 100644 --- a/engine/gfx/cgb_layouts.asm +++ b/engine/gfx/cgb_layouts.asm @@ -266,7 +266,7 @@ _CGB_Pokedex: jr .got_palette .is_pokemon - call GetMonPalettePointer_ + call GetMonPalettePointer call LoadPalette_White_Col1_Col2_Black ; mon palette .got_palette call WipeAttrMap @@ -352,7 +352,7 @@ _CGB_PokedexUnownMode: call GetPredefPal call LoadHLPaletteIntoDE ld a, [wCurPartySpecies] - call GetMonPalettePointer_ + call GetMonPalettePointer call LoadPalette_White_Col1_Col2_Black call WipeAttrMap hlcoord 7, 5, wAttrMap @@ -914,7 +914,7 @@ _CGB_PlayerOrMonFrontpicPals: _CGB1e: ld de, wBGPals1 ld a, [wCurPartySpecies] - call GetMonPalettePointer_ + call GetMonPalettePointer call LoadPalette_White_Col1_Col2_Black call WipeAttrMap call ApplyAttrMap diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm index 9a3b4f8ef..397db9751 100644 --- a/engine/gfx/color.asm +++ b/engine/gfx/color.asm @@ -94,9 +94,9 @@ Unreferenced_Function8aa4: ld a, d ld [wSGBPals + 6], a ld hl, wSGBPals - call PushSGBPals_ + call PushSGBPals ld hl, BlkPacket_9a86 - call PushSGBPals_ + call PushSGBPals ret InitPartyMenuPalettes: @@ -173,7 +173,7 @@ Unreferenced_Function8b3f: and a ret z ld hl, BlkPacket_9a86 - jp PushSGBPals_ + jp PushSGBPals Unreferenced_Function8b4d: call CheckCGB @@ -182,7 +182,7 @@ Unreferenced_Function8b4d: and a ret z ld hl, PalPacket_BetaIntroVenusaur - jp PushSGBPals_ + jp PushSGBPals .cgb ld de, wOBPals1 @@ -197,7 +197,7 @@ Unreferenced_Function8b67: and a ret z ld hl, PalPacket_Pack - jp PushSGBPals_ + jp PushSGBPals .cgb ld de, wOBPals1 @@ -218,7 +218,7 @@ Unreferenced_Function8b81: ld bc, PALPACKET_LENGTH call CopyBytes pop af - call GetMonPalettePointer_ + call GetMonPalettePointer ld a, [hli] ld [wSGBPals + 3], a ld a, [hli] @@ -228,12 +228,12 @@ Unreferenced_Function8b81: ld a, [hl] ld [wSGBPals + 6], a ld hl, wSGBPals - jp PushSGBPals_ + jp PushSGBPals .cgb ld de, wOBPals1 ld a, c - call GetMonPalettePointer_ + call GetMonPalettePointer call LoadPalette_White_Col1_Col2_Black ret @@ -245,7 +245,7 @@ LoadTrainerClassPaletteAsNthBGPal: LoadMonPaletteAsNthBGPal: ld a, [wCurPartySpecies] - call GetMonPalettePointer + call _GetMonPalettePointer ld a, e bit 7, a jr z, got_palette_pointer_8bd7 @@ -278,7 +278,7 @@ Unreferenced_Function8bec: and a jr nz, .cgb ld hl, wPlayerLightScreenCount - jp PushSGBPals_ + jp PushSGBPals .cgb ld a, [wEnemyLightScreenCount] ; col @@ -310,7 +310,7 @@ ApplyMonOrTrainerPals: and a jr z, .get_trainer ld a, [wCurPartySpecies] - call GetMonPalettePointer_ + call GetMonPalettePointer jr .load_palettes .get_trainer @@ -426,9 +426,9 @@ LoadMailPalettes: ld a, [hli] ld [wSGBPals + 6], a ld hl, wSGBPals - call PushSGBPals_ + call PushSGBPals ld hl, BlkPacket_9a86 - call PushSGBPals_ + call PushSGBPals ret .cgb @@ -732,8 +732,8 @@ GetTrainerPalettePointer: add hl, bc ret -GetMonPalettePointer_: - call GetMonPalettePointer +GetMonPalettePointer: + call _GetMonPalettePointer ret Unreferenced_Function9779: @@ -781,7 +781,7 @@ Unreferenced_Function97cc: jr nz, .loop ret -GetMonPalettePointer: +_GetMonPalettePointer: ld l, a ld h, $0 add hl, hl @@ -793,7 +793,7 @@ GetMonPalettePointer: GetMonNormalOrShinyPalettePointer: push bc - call GetMonPalettePointer + call _GetMonPalettePointer pop bc push hl call CheckShininess @@ -804,17 +804,17 @@ rept 4 endr ret -PushSGBPals_: +PushSGBPals: ld a, [wcfbe] push af set 7, a ld [wcfbe], a - call PushSGBPals + call _PushSGBPals pop af ld [wcfbe], a ret -PushSGBPals: +_PushSGBPals: ld a, [hl] and $7 ret z @@ -878,7 +878,7 @@ InitSGBBorder: call SGBDelayCycles call SGB_ClearVRAM ld hl, MaskEnCancelPacket - call PushSGBPals + call _PushSGBPals .skip pop af @@ -950,7 +950,7 @@ _InitSGBBorderPals: push hl ld h, [hl] ld l, a - call PushSGBPals + call _PushSGBPals pop hl inc hl pop bc @@ -974,12 +974,12 @@ Unreferenced_Function9911: xor a ld [rJOYP], a ld hl, MaskEnFreezePacket - call PushSGBPals + call _PushSGBPals call PushSGBBorder call SGBDelayCycles call SGB_ClearVRAM ld hl, MaskEnCancelPacket - call PushSGBPals + call _PushSGBPals ei ret @@ -1005,7 +1005,7 @@ SGB_ClearVRAM: PushSGBBorderPalsAndWait: ld hl, MltReq2Packet - call PushSGBPals + call _PushSGBPals call SGBDelayCycles ld a, [rJOYP] and $3 @@ -1050,7 +1050,7 @@ endr .FinalPush: ld hl, MltReq1Packet - call PushSGBPals + call _PushSGBPals jp SGBDelayCycles SGBBorder_PushBGPals: @@ -1065,7 +1065,7 @@ SGBBorder_PushBGPals: ld a, LCDC_DEFAULT ld [rLCDC], a ld hl, PalTrnPacket - call PushSGBPals + call _PushSGBPals xor a ld [rBGP], a ret @@ -1099,7 +1099,7 @@ SGBBorder_MorePalPushing: ld a, LCDC_DEFAULT ld [rLCDC], a ld hl, PctTrnPacket - call PushSGBPals + call _PushSGBPals xor a ld [rBGP], a ret @@ -1123,7 +1123,7 @@ SGBBorder_YetMorePalPushing: ld a, LCDC_DEFAULT ld [rLCDC], a ld hl, ChrTrnPacket - call PushSGBPals + call _PushSGBPals xor a ld [rBGP], a ret diff --git a/engine/gfx/crystal_layouts.asm b/engine/gfx/crystal_layouts.asm index b9686701c..bdbf91118 100644 --- a/engine/gfx/crystal_layouts.asm +++ b/engine/gfx/crystal_layouts.asm @@ -284,7 +284,7 @@ _InitMG_Mobile_LinkTradePalMap: call ByteFill ret -LoadTradeRoomBGPals: +_LoadTradeRoomBGPals: ld hl, TradeRoomPalette ld de, wBGPals1 palette PAL_BG_GREEN ld bc, 6 palettes diff --git a/engine/gfx/mon_icons.asm b/engine/gfx/mon_icons.asm index 5ae2fbf8b..c4bb7294c 100644 --- a/engine/gfx/mon_icons.asm +++ b/engine/gfx/mon_icons.asm @@ -34,13 +34,14 @@ LoadMenuMonIcon: jp hl .Jumptable: - dw PartyMenu_InitAnimatedMonIcon ; party menu - dw NamingScreen_InitAnimatedMonIcon ; naming screen - dw MoveList_InitAnimatedMonIcon ; moves (?) - dw Trade_LoadMonIconGFX ; trade - dw Mobile_InitAnimatedMonIcon ; mobile - dw Mobile_InitPartyMenuBGPal71 ; mobile - dw .GetPartyMenuMonIcon ; unused +; entries correspond to MONICON_* constants + dw PartyMenu_InitAnimatedMonIcon ; MONICON_PARTYMENU + dw NamingScreen_InitAnimatedMonIcon ; MONICON_NAMINGSCREEN + dw MoveList_InitAnimatedMonIcon ; MONICON_MOVES + dw Trade_LoadMonIconGFX ; MONICON_TRADE + dw Mobile_InitAnimatedMonIcon ; MONICON_MOBILE1 + dw Mobile_InitPartyMenuBGPal71 ; MONICON_MOBILE2 + dw .GetPartyMenuMonIcon ; MONICON_UNUSED .GetPartyMenuMonIcon: call InitPartyMenuIcon @@ -65,14 +66,14 @@ LoadMenuMonIcon: pop bc pop hl jr c, .not_mail - ld a, $6 + ld a, $06 jr .got_tile .not_mail - ld a, $5 - ; jr .got_tile + ld a, $05 + ; fallthrough .no_item - ld a, $4 + ld a, $04 .got_tile ld hl, SPRITEANIMSTRUCT_FRAMESET_ID add hl, bc @@ -156,7 +157,7 @@ InitPartyMenuIcon: ld a, [hObjectStructIndexBuffer] ld hl, wPartySpecies ld e, a - ld d, $0 + ld d, 0 add hl, de ld a, [hl] call ReadMonMenuIcon @@ -214,7 +215,7 @@ SetPartyMonIconAnimSpeed: db $80 ; HP_RED NamingScreen_InitAnimatedMonIcon: - ld a, [wd265] + ld a, [wTempIconSpecies] call ReadMonMenuIcon ld [wCurIcon], a xor a @@ -228,7 +229,7 @@ NamingScreen_InitAnimatedMonIcon: ret MoveList_InitAnimatedMonIcon: - ld a, [wd265] + ld a, [wTempIconSpecies] call ReadMonMenuIcon ld [wCurIcon], a xor a @@ -243,7 +244,7 @@ MoveList_InitAnimatedMonIcon: ret Trade_LoadMonIconGFX: - ld a, [wd265] + ld a, [wTempIconSpecies] call ReadMonMenuIcon ld [wCurIcon], a ld a, $62 @@ -254,7 +255,7 @@ Trade_LoadMonIconGFX: GetSpeciesIcon: ; Load species icon into VRAM at tile a push de - ld a, [wd265] + ld a, [wTempIconSpecies] call ReadMonMenuIcon ld [wCurIcon], a pop de @@ -264,7 +265,7 @@ GetSpeciesIcon: FlyFunction_GetMonIcon: push de - ld a, [wd265] + ld a, [wTempIconSpecies] call ReadMonMenuIcon ld [wCurIcon], a pop de @@ -274,7 +275,7 @@ FlyFunction_GetMonIcon: Unreferenced_GetMonIcon2: push de - ld a, [wd265] + ld a, [wTempIconSpecies] call ReadMonMenuIcon ld [wCurIcon], a pop de diff --git a/engine/gfx/pic_animation.asm b/engine/gfx/pic_animation.asm index 843e5cba4..af0227a2a 100644 --- a/engine/gfx/pic_animation.asm +++ b/engine/gfx/pic_animation.asm @@ -40,8 +40,8 @@ AnimateMon_Hatch: call AnimateFrontpic ret -AnimateMon_Unused: - ld e, ANIM_MON_UNUSED +AnimateMon_HOF: + ld e, ANIM_MON_HOF ld d, $0 call AnimateFrontpic ret @@ -59,13 +59,14 @@ endr ENDM PokeAnims: +; entries correspond to ANIM_MON_* constants dw .Slow dw .Normal dw .Menu dw .Trade dw .Evolve dw .Hatch - dw .Unused ; same as .Menu + dw .HOF dw .Egg1 dw .Egg2 @@ -75,7 +76,7 @@ PokeAnims: .Trade: pokeanim Idle, Play2, Idle, Play, SetWait, Wait, Cry, Setup, Play .Evolve: pokeanim Idle, Play, SetWait, Wait, CryNoWait, Setup, Play .Hatch: pokeanim Idle, Play, CryNoWait, Setup, Play, SetWait, Wait, Idle, Play -.Unused: pokeanim CryNoWait, Setup, Play, SetWait, Wait, Idle, Play +.HOF: pokeanim CryNoWait, Setup, Play, SetWait, Wait, Idle, Play .Egg1: pokeanim Setup, Play .Egg2: pokeanim Idle, Play @@ -108,7 +109,7 @@ LoadMonAnimation: SetUpPokeAnim: ld a, [rSVBK] push af - ld a, BANK(wPokeAnimSceneIndex) + ld a, BANK(wPokeAnimStruct) ld [rSVBK], a ld a, [wPokeAnimSceneIndex] ld c, a @@ -283,14 +284,14 @@ AnimateMon_CheckIfPokemon: PokeAnim_InitPicAttributes: ld a, [rSVBK] push af - ld a, BANK(wPokeAnimSceneIndex) + ld a, BANK(wPokeAnimStruct) ld [rSVBK], a push bc push de push hl - ld hl, wPokeAnimSceneIndex - ld bc, wPokeAnimStructEnd - wPokeAnimSceneIndex + ld hl, wPokeAnimStruct + ld bc, wPokeAnimStructEnd - wPokeAnimStruct xor a call ByteFill pop hl diff --git a/engine/gfx/sgb_layouts.asm b/engine/gfx/sgb_layouts.asm index 538132ce2..7279f9a32 100644 --- a/engine/gfx/sgb_layouts.asm +++ b/engine/gfx/sgb_layouts.asm @@ -61,7 +61,7 @@ LoadSGBLayout: .SGB_BattleColors: ld hl, BlkPacket_Battle - call PushSGBPals_ + call PushSGBPals ld hl, PalPacket_9ce6 ld de, wSGBPals @@ -210,7 +210,7 @@ LoadSGBLayout: inc hl ld [hl], HIGH(palred 26 + palgreen 10 + palblue 6) ld a, [wCurPartySpecies] - call GetMonPalettePointer_ + call GetMonPalettePointer ld a, [hli] ld [wSGBPals + 9], a ld a, [hli] @@ -566,6 +566,6 @@ INCLUDE "data/maps/sgb_roof_pal_inds.asm" _LoadSGBLayout_ReturnFromJumpTable: push de - call PushSGBPals_ + call PushSGBPals pop hl - jp PushSGBPals_ + jp PushSGBPals diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 1439b2c6d..e751b42e6 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1,6 +1,6 @@ _DoItemEffect:: ld a, [wCurItem] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetItemName call CopyName1 ld a, 1 @@ -489,7 +489,7 @@ PokeBallEffect: ld a, [wEnemyMonSpecies] ld [wWildMon], a ld [wCurPartySpecies], a - ld [wd265], a + ld [wTempSpecies], a ld a, [wBattleType] cp BATTLETYPE_TUTORIAL jp z, .FinishTutorial @@ -501,13 +501,13 @@ PokeBallEffect: call ClearSprites - ld a, [wd265] + ld a, [wTempSpecies] dec a call CheckCaughtMon ld a, c push af - ld a, [wd265] + ld a, [wTempSpecies] dec a call SetSeenAndCaughtMon pop af @@ -523,7 +523,7 @@ PokeBallEffect: call ClearSprites ld a, [wEnemyMonSpecies] - ld [wd265], a + ld [wTempSpecies], a predef NewPokedexEntry .skip_pokedex @@ -566,7 +566,7 @@ PokeBallEffect: call PrintText ld a, [wCurPartySpecies] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName call YesNoBox @@ -626,7 +626,7 @@ PokeBallEffect: call PrintText ld a, [wCurPartySpecies] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName call YesNoBox @@ -1276,7 +1276,7 @@ Table_eeeb: RareCandy_StatBooster_GetParameters: ld a, [wCurPartySpecies] ld [wCurSpecies], a - ld [wd265], a + ld [wTempSpecies], a ld a, MON_LEVEL call GetPartyParamLocation ld a, [hl] @@ -1368,7 +1368,7 @@ RareCandyEffect: xor a ; PARTYMON ld [wMonType], a ld a, [wCurPartySpecies] - ld [wd265], a + ld [wTempSpecies], a predef LearnLevelMoves xor a @@ -2159,7 +2159,7 @@ XItemEffect: ld [hBattleTurn], a ld [wAttackMissed], a ld [wEffectFailed], a - farcall CheckIfStatCanBeRaised + farcall RaiseStat call WaitSFX farcall BattleCommand_StatUpMessage @@ -2344,7 +2344,7 @@ RestorePPEffect: push hl ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetMoveName call CopyName1 pop hl @@ -2373,8 +2373,8 @@ RestorePPEffect: ld a, [hl] add PP_UP_ONE ld [hl], a - ld a, $1 - ld [wd265], a + ld a, TRUE + ld [wUsePPUp], a call ApplyPPUp call Play_SFX_FULL_HEAL @@ -2492,7 +2492,7 @@ RestorePP: ld hl, wPartyMon1PP ld bc, PARTYMON_STRUCT_LENGTH call GetMthMoveOfNthPartymon - ld a, [wd265] + ld a, [wTempPP] ld b, a ld a, [hl] and PP_MASK @@ -2765,8 +2765,8 @@ ApplyPPUp: ld a, b cp NUM_MOVES + 1 ret z - ld a, [wd265] - dec a + ld a, [wUsePPUp] + dec a ; FALSE? jr nz, .use ld a, [wMenuCursorY] inc a @@ -2822,7 +2822,7 @@ ComputeMaxPP: .okay add b ld b, a - ld a, [wd265] + ld a, [wTempPP] dec a jr z, .NoPPUp dec c @@ -2857,7 +2857,7 @@ RestoreAllPP: ld a, [de] and PP_UP_MASK ld b, a - ld a, [wd265] + ld a, [wTempPP] add b ld [de], a inc de @@ -2933,12 +2933,12 @@ GetMaxPPOfMove: ld hl, wStringBuffer1 + 1 ld [hl], a xor a - ld [wd265], a + ld [wTempPP], a ld a, b ; this gets lost anyway call ComputeMaxPP ld a, [hl] and PP_MASK - ld [wd265], a + ld [wTempPP], a pop af ld [wStringBuffer1 + 1], a diff --git a/engine/items/mart.asm b/engine/items/mart.asm index 7e185662b..8afae541a 100644 --- a/engine/items/mart.asm +++ b/engine/items/mart.asm @@ -54,8 +54,8 @@ BargainShop: ld a, [hli] or [hl] jr z, .skip_set - ld hl, wDailyFlags - set DAILYFLAGS_GOLDENROD_UNDERGROUND_BARGAIN_F, [hl] + ld hl, wDailyFlags1 + set DAILYFLAGS1_GOLDENROD_UNDERGROUND_BARGAIN_F, [hl] .skip_set ld hl, Text_BargainShop_ComeAgain diff --git a/engine/items/print_item_description.asm b/engine/items/print_item_description.asm index b0a3a0b33..5d944e206 100644 --- a/engine/items/print_item_description.asm +++ b/engine/items/print_item_description.asm @@ -9,7 +9,7 @@ PrintItemDescription: push de farcall GetTMHMItemMove pop hl - ld a, [wd265] + ld a, [wTempTMHM] ld [wCurSpecies], a predef PrintMoveDesc ret diff --git a/engine/items/tmhm.asm b/engine/items/tmhm.asm index 4958d2afc..14e481248 100644 --- a/engine/items/tmhm.asm +++ b/engine/items/tmhm.asm @@ -33,7 +33,7 @@ ConvertCurItemIntoCurTMHM: ld c, a callfar GetTMHMNumber ld a, c - ld [wCurTMHM], a + ld [wTempTMHM], a ret GetTMHMItemMove: @@ -50,7 +50,7 @@ AskTeachTMHM: cp TM01 jr c, .NotTMHM call GetTMHMItemMove - ld a, [wCurTMHM] + ld a, [wTempTMHM] ld [wPutativeTMHMMove], a call GetMoveName call CopyName1 @@ -251,9 +251,9 @@ TMHM_ShowTMMoveDescription: ld a, [wCurItem] cp NUM_TMS + NUM_HMS + 1 jr nc, TMHM_JoypadLoop - ld [wd265], a + ld [wTempTMHM], a predef GetTMHMMove - ld a, [wd265] + ld a, [wTempTMHM] ld [wCurSpecies], a hlcoord 1, 14 call PrintMoveDesc @@ -261,14 +261,14 @@ TMHM_ShowTMMoveDescription: TMHM_ChooseTMorHM: call TMHM_PlaySFX_ReadText2 - call CountTMsHMs ; This stores the count to wd265. + call CountTMsHMs ; This stores the count to wTempTMHM. ld a, [wMenuCursorY] dec a ld b, a ld a, [wTMHMPocketScrollPosition] add b ld b, a - ld a, [wd265] + ld a, [wTempTMHM] cp b jr z, _TMHM_ExitPack ; our cursor was hovering over CANCEL TMHM_CheckHoveringOverCancel: @@ -354,16 +354,16 @@ TMHM_DisplayPocketItems: jr z, .loop2 ld b, a ld a, c - ld [wd265], a + ld [wTempTMHM], a push hl push de push bc call TMHMPocket_GetCurrentLineCoord push hl - ld a, [wd265] + ld a, [wTempTMHM] cp NUM_TMS + 1 jr nc, .HM - ld de, wd265 + ld de, wTempTMHM lb bc, PRINTNUM_LEADINGZEROS | 1, 2 call PrintNum jr .okay @@ -371,17 +371,17 @@ TMHM_DisplayPocketItems: .HM: push af sub NUM_TMS - ld [wd265], a + ld [wTempTMHM], a ld [hl], "H" inc hl - ld de, wd265 + ld de, wTempTMHM lb bc, PRINTNUM_RIGHTALIGN | 1, 2 call PrintNum pop af - ld [wd265], a + ld [wTempTMHM], a .okay predef GetTMHMMove - ld a, [wd265] + ld a, [wNamedObjectIndexBuffer] ld [wPutativeTMHMMove], a call GetMoveName pop hl @@ -403,8 +403,8 @@ TMHM_DisplayPocketItems: pop bc push bc ld a, b - ld [wd265], a - ld de, wd265 + ld [wTempTMHM], a + ld de, wTempTMHM lb bc, 1, 2 call PrintNum .hm2 @@ -445,7 +445,7 @@ Unreferenced_Function2ca95: ld bc, 3 add hl, bc predef GetTMHMMove - ld a, [wd265] + ld a, [wTempTMHM] ld [wPutativeTMHMMove], a call GetMoveName push hl @@ -508,7 +508,7 @@ Unreferenced_Function2cadf: db "@" .CheckHaveRoomForTMHM: - ld a, [wd265] + ld a, [wTempTMHM] dec a ld hl, wTMsHMs ld b, 0 @@ -523,7 +523,7 @@ Unreferenced_Function2cadf: ConsumeTM: call ConvertCurItemIntoCurTMHM - ld a, [wd265] + ld a, [wTempTMHM] dec a ld hl, wTMsHMs ld b, 0 @@ -555,20 +555,5 @@ CountTMsHMs: dec c jr nz, .loop ld a, b - ld [wd265], a + ld [wTempTMHM], a ret - -PrintMoveDesc: - push hl - ld hl, MoveDescriptions - ld a, [wCurSpecies] - dec a - ld c, a - ld b, 0 - add hl, bc - add hl, bc - ld a, [hli] - ld e, a - ld d, [hl] - pop hl - jp PlaceString diff --git a/engine/items/tmhm2.asm b/engine/items/tmhm2.asm index 10206d36b..057d0b346 100644 --- a/engine/items/tmhm2.asm +++ b/engine/items/tmhm2.asm @@ -33,14 +33,14 @@ CanLearnTMHMMove: ret GetTMHMMove: - ld a, [wd265] + ld a, [wTempTMHM] dec a ld hl, TMHMMoves ld b, 0 ld c, a add hl, bc ld a, [hl] - ld [wd265], a + ld [wTempTMHM], a ret INCLUDE "data/moves/tmhm_moves.asm" diff --git a/engine/link/link.asm b/engine/link/link.asm index d72abb0a5..5363a3047 100644 --- a/engine/link/link.asm +++ b/engine/link/link.asm @@ -149,13 +149,13 @@ Gen2ToGen1LinkComms: ld a, [hli] cp -1 jr z, .done_party - ld [wd265], a + ld [wTempSpecies], a push hl push de callfar ConvertMon_1to2 pop de pop hl - ld a, [wd265] + ld a, [wTempSpecies] ld [de], a inc de jr .party_loop @@ -651,13 +651,13 @@ Link_PrepPartyData_Gen1: ld a, [hli] cp -1 jr z, .done_party - ld [wd265], a + ld [wTempSpecies], a push hl push de callfar ConvertMon_2to1 pop de pop hl - ld a, [wd265] + ld a, [wTempSpecies] ld [de], a inc de jr .loop2 @@ -692,11 +692,11 @@ Link_PrepPartyData_Gen1: push de push bc ld a, [hl] - ld [wd265], a + ld [wTempSpecies], a callfar ConvertMon_2to1 pop bc pop de - ld a, [wd265] + ld a, [wTempSpecies] ld [de], a inc de ld hl, MON_HP @@ -976,11 +976,11 @@ Function2868a: inc de push bc push de - ld [wd265], a + ld [wTempSpecies], a callfar ConvertMon_1to2 pop de pop bc - ld a, [wd265] + ld a, [wTempSpecies] ld [bc], a ld [wCurSpecies], a ld hl, MON_HP @@ -1461,7 +1461,7 @@ Function28926: ld b, 0 add hl, bc ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName hlcoord 0, 12 ld b, 4 @@ -1619,7 +1619,7 @@ LinkTrade: ld b, 0 add hl, bc ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, wStringBuffer1 ld de, wd004 @@ -1631,7 +1631,7 @@ LinkTrade: ld b, 0 add hl, bc ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, UnknownText_0x28eb8 bccoord 1, 14 @@ -1971,7 +1971,7 @@ LoadTradeScreenBorder: ret SetTradeRoomBGPals: - farcall LoadTradeRoomBGPals_ ; just a nested farcall; so wasteful + farcall LoadTradeRoomBGPals ; just a nested farcall; so wasteful call SetPalettes ret @@ -2039,7 +2039,7 @@ CheckTimeCapsuleCompatibility: jr nc, .move_too_new dec c jr nz, .move_next - ld de, wPartyMon2 - (wPartyMon1 + NUM_MOVES) + ld de, PARTYMON_STRUCT_LENGTH - NUM_MOVES add hl, de dec b jr nz, .move_loop @@ -2047,14 +2047,14 @@ CheckTimeCapsuleCompatibility: jr .done .mon_too_new - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld a, $1 jr .done .move_too_new push bc - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetMoveName call CopyName1 pop bc @@ -2079,7 +2079,7 @@ Function29c67: ld hl, wPartyCount add hl, bc ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ret @@ -2146,13 +2146,13 @@ WaitForOtherPlayerToExit: SetBitsForLinkTradeRequest: ld a, LINK_TRADECENTER - 1 ld [wPlayerLinkAction], a - ld [wd265], a + ld [wChosenCableClubRoom], a ret SetBitsForBattleRequest: ld a, LINK_COLOSSEUM - 1 ld [wPlayerLinkAction], a - ld [wd265], a + ld [wChosenCableClubRoom], a ret SetBitsForTimeCapsuleRequest: @@ -2166,7 +2166,7 @@ SetBitsForTimeCapsuleRequest: ld [rSC], a xor a ; LINK_TIMECAPSULE - 1 ld [wPlayerLinkAction], a - ld [wd265], a + ld [wChosenCableClubRoom], a ret WaitForLinkedFriend: @@ -2373,7 +2373,7 @@ Link_CheckCommunicationError: ret TryQuickSave: - ld a, [wd265] + ld a, [wChosenCableClubRoom] push af farcall Link_SaveGame ld a, TRUE @@ -2384,11 +2384,11 @@ TryQuickSave: ld c, 30 call DelayFrames pop af - ld [wd265], a + ld [wChosenCableClubRoom], a ret CheckBothSelectedSameRoom: - ld a, [wd265] + ld a, [wChosenCableClubRoom] call Link_EnsureSync push af call LinkDataReceived @@ -2396,10 +2396,10 @@ CheckBothSelectedSameRoom: call LinkDataReceived pop af ld b, a - ld a, [wd265] + ld a, [wChosenCableClubRoom] cp b jr nz, .fail - ld a, [wd265] + ld a, [wChosenCableClubRoom] inc a ld [wLinkMode], a xor a diff --git a/engine/link/link_trade.asm b/engine/link/link_trade.asm index a3c596bfe..a250e84fa 100644 --- a/engine/link/link_trade.asm +++ b/engine/link/link_trade.asm @@ -133,8 +133,8 @@ LinkComms_LoadPleaseWaitTextboxBorderGFX: call Get2bpp ret -LoadTradeRoomBGPals_: - farcall LoadTradeRoomBGPals +LoadTradeRoomBGPals: + farcall _LoadTradeRoomBGPals ret Function16d6ae: diff --git a/engine/link/mystery_gift.asm b/engine/link/mystery_gift.asm index 0a5dfcec3..6fba91619 100644 --- a/engine/link/mystery_gift.asm +++ b/engine/link/mystery_gift.asm @@ -1430,7 +1430,7 @@ Function105688: ld de, wMysteryGiftTrainerData farcall Function8ac70 ld a, c - ld [wd265], a + ld [wDeciramBuffer], a ld hl, Text_CardNotRegistered jr c, PrintTextAndExit_JP ld hl, Text_ListedCardAsNumber diff --git a/engine/link/mystery_gift_2.asm b/engine/link/mystery_gift_2.asm index c1b258724..b9c7eccb4 100644 --- a/engine/link/mystery_gift_2.asm +++ b/engine/link/mystery_gift_2.asm @@ -24,7 +24,7 @@ PrepMysteryGiftDataToSend: call CountSetBits pop de pop bc - ld a, [wd265] + ld a, [wNumSetBits] ld [de], a inc de ; wc80f call CloseSRAM diff --git a/engine/link/time_capsule.asm b/engine/link/time_capsule.asm index 195062c1e..499e9fc34 100644 --- a/engine/link/time_capsule.asm +++ b/engine/link/time_capsule.asm @@ -122,7 +122,7 @@ PlaceTradePartnerNamesAndParty: ld a, [de] cp -1 ret z - ld [wd265], a + ld [wNamedObjectIndexBuffer], a push bc push hl push de diff --git a/engine/link/time_capsule_2.asm b/engine/link/time_capsule_2.asm index be7027f34..6640f6b03 100644 --- a/engine/link/time_capsule_2.asm +++ b/engine/link/time_capsule_2.asm @@ -1,8 +1,10 @@ ConvertMon_2to1: -; Takes the Gen-2 Pokemon number stored in wd265, finds it in the Pokered_MonIndices table, and returns its index in wd265. +; Takes the Gen 2 Pokemon number stored in wTempSpecies, +; finds it in the Pokered_MonIndices table, +; and returns its index in wTempSpecies. push bc push hl - ld a, [wd265] + ld a, [wTempSpecies] ld b, a ld c, 0 ld hl, Pokered_MonIndices @@ -12,23 +14,24 @@ ConvertMon_2to1: cp b jr nz, .loop ld a, c - ld [wd265], a + ld [wTempSpecies], a pop hl pop bc ret ConvertMon_1to2: -; Takes the Gen-1 Pokemon number stored in wd265 and returns the corresponding value from Pokered_MonIndices in wd265. +; Takes the Gen 1 Pokemon number stored in wTempSpecies +; and returns the corresponding value from Pokered_MonIndices in wTempSpecies. push bc push hl - ld a, [wd265] + ld a, [wTempSpecies] dec a ld hl, Pokered_MonIndices ld b, 0 ld c, a add hl, bc ld a, [hl] - ld [wd265], a + ld [wTempSpecies], a pop hl pop bc ret diff --git a/engine/menus/debug.asm b/engine/menus/debug.asm index a48322488..efee45e59 100644 --- a/engine/menus/debug.asm +++ b/engine/menus/debug.asm @@ -311,9 +311,9 @@ Function81adb: ld a, [wcf66] inc a ld [wCurPartySpecies], a - ld [wd265], a + ld [wDeciramBuffer], a hlcoord 0, 1 - ld de, wd265 + ld de, wDeciramBuffer lb bc, PRINTNUM_LEADINGZEROS | 1, 3 call PrintNum ld a, [wd002] @@ -353,7 +353,7 @@ Function81adb: jr .asm_81ba9 .asm_81b7a - ld a, [wd265] + ld a, [wDeciramBuffer] ld [wTrainerClass], a callfar GetTrainerAttributes ld de, wStringBuffer1 @@ -738,9 +738,9 @@ Function81df4: call Function81e5e ld a, [wd004] inc a - ld [wd265], a + ld [wTempTMHM], a predef GetTMHMMove - ld a, [wd265] + ld a, [wTempTMHM] ld [wPutativeTMHMMove], a call GetMoveName hlcoord 10, 12 diff --git a/engine/menus/intro_menu.asm b/engine/menus/intro_menu.asm index 9652dd73e..4e145664a 100644 --- a/engine/menus/intro_menu.asm +++ b/engine/menus/intro_menu.asm @@ -593,7 +593,7 @@ Continue_DisplayBadgeCount: ld b, 2 call CountSetBits pop hl - ld de, wd265 + ld de, wNumSetBits lb bc, 1, 2 jp PrintNum @@ -610,7 +610,7 @@ else endc call CountSetBits pop hl - ld de, wd265 + ld de, wNumSetBits lb bc, 1, 3 jp PrintNum diff --git a/engine/menus/menu_2.asm b/engine/menus/menu_2.asm index b039b590f..94732d60b 100644 --- a/engine/menus/menu_2.asm +++ b/engine/menus/menu_2.asm @@ -170,7 +170,7 @@ StartMenu_PrintBugContestStatus: and a ld de, .None jr z, .no_contest_mon - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName .no_contest_mon diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm index 8a8303067..aa8ccddf8 100644 --- a/engine/menus/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -84,13 +84,13 @@ NamingScreen: .Pokemon: ld a, [wCurPartySpecies] - ld [wd265], a + ld [wTempIconSpecies], a ld hl, LoadMenuMonIcon ld a, BANK(LoadMenuMonIcon) - ld e, $1 - rst FarCall ; ; indirect jump to LoadMenuMonIcon (8e83f (23:683f)) + ld e, MONICON_NAMINGSCREEN + rst FarCall ld a, [wCurPartySpecies] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName hlcoord 5, 2 call PlaceString diff --git a/engine/menus/options_menu.asm b/engine/menus/options_menu.asm index 46fa33621..4dc6c0fe1 100644 --- a/engine/menus/options_menu.asm +++ b/engine/menus/options_menu.asm @@ -61,20 +61,20 @@ _OptionsMenu: ret StringOptions: - db "TEXT SPEED<LNBRK>" - db " :<LNBRK>" - db "BATTLE SCENE<LNBRK>" - db " :<LNBRK>" - db "BATTLE STYLE<LNBRK>" - db " :<LNBRK>" - db "SOUND<LNBRK>" - db " :<LNBRK>" - db "PRINT<LNBRK>" - db " :<LNBRK>" - db "MENU ACCOUNT<LNBRK>" - db " :<LNBRK>" - db "FRAME<LNBRK>" - db " :TYPE<LNBRK>" + db "TEXT SPEED<LF>" + db " :<LF>" + db "BATTLE SCENE<LF>" + db " :<LF>" + db "BATTLE STYLE<LF>" + db " :<LF>" + db "SOUND<LF>" + db " :<LF>" + db "PRINT<LF>" + db " :<LF>" + db "MENU ACCOUNT<LF>" + db " :<LF>" + db "FRAME<LF>" + db " :TYPE<LF>" db "CANCEL@" GetOptionPointer: @@ -165,7 +165,7 @@ GetTextSpeed: ; converts TEXT_DELAY_* value in a to OPT_TEXT_SPEED_* value in c, ; with previous/next TEXT_DELAY_* values in d/e ld a, [wOptions] - and $7 + and TEXT_DELAY_MASK cp TEXT_DELAY_SLOW jr z, .slow cp TEXT_DELAY_FAST @@ -467,7 +467,7 @@ Options_Frame: dec a .Save: - and $7 + maskbits NUM_FRAMES ld [hl], a UpdateFrame: ld a, [wTextBoxFrame] diff --git a/engine/menus/save.asm b/engine/menus/save.asm index 469c55abd..ad9f0b5b2 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -89,7 +89,7 @@ MoveMonWOMail_InsertMon_SaveGame: pop de ld a, e ld [wCurBox], a - ld a, $1 + ld a, TRUE ld [wSaveFileExists], a farcall StageRTCTimeForSave farcall BackupMysteryGift @@ -133,12 +133,12 @@ StartMoveMonWOMail_SaveGame: ret PauseGameLogic: - ld a, $1 + ld a, TRUE ld [wGameLogicPaused], a ret ResumeGameLogic: - xor a + xor a ; FALSE ld [wGameLogicPaused], a ret @@ -164,7 +164,7 @@ AddHallOfFameEntry: ret SaveGameData: - call SaveGameData_ + call _SaveGameData ret AskOverwriteSaveFile: @@ -228,15 +228,15 @@ CompareLoadedAndSavedPlayerID: _SavingDontTurnOffThePower: call SavingDontTurnOffThePower SavedTheGame: - call SaveGameData_ + call _SaveGameData ; wait 32 frames - ld c, $20 + ld c, 32 call DelayFrames ; copy the original text speed setting to the stack ld a, [wOptions] push af - ; set text speed super slow - ld a, 3 + ; set text speed to medium + ld a, TEXT_DELAY_MED ld [wOptions], a ; <PLAYER> saved the game! ld hl, Text_PlayerSavedTheGame @@ -248,12 +248,12 @@ SavedTheGame: call WaitPlaySFX call WaitSFX ; wait 30 frames - ld c, $1e + ld c, 30 call DelayFrames ret -SaveGameData_: - ld a, 1 +_SaveGameData: + ld a, TRUE ld [wSaveFileExists], a farcall StageRTCTimeForSave farcall BackupMysteryGift @@ -332,8 +332,8 @@ SavingDontTurnOffThePower: ; Save the text speed setting to the stack ld a, [wOptions] push af - ; Set the text speed to super slow - ld a, $3 + ; Set the text speed to medium + ld a, TEXT_DELAY_MED ld [wOptions], a ; SAVING... DON'T TURN OFF THE POWER. ld hl, Text_SavingDontTurnOffThePower @@ -342,7 +342,7 @@ SavingDontTurnOffThePower: pop af ld [wOptions], a ; Wait for 16 frames - ld c, $10 + ld c, 16 call DelayFrames ret @@ -627,7 +627,7 @@ TryLoadSaveFile: ret TryLoadSaveData: - xor a + xor a ; FALSE ld [wSaveFileExists], a call CheckPrimarySaveFile ld a, [wSaveFileExists] @@ -690,7 +690,7 @@ CheckPrimarySaveFile: ld bc, wOptionsEnd - wOptions call CopyBytes call CloseSRAM - ld a, $1 + ld a, TRUE ld [wSaveFileExists], a .nope diff --git a/engine/menus/start_menu.asm b/engine/menus/start_menu.asm index 108a4edf6..d8596840f 100644 --- a/engine/menus/start_menu.asm +++ b/engine/menus/start_menu.asm @@ -29,7 +29,7 @@ StartMenu:: call .SetUpMenuItems ld a, [wBattleMenuCursorBuffer] ld [wMenuCursorBuffer], a - call .DrawMenuAccount_ + call .DrawMenuAccount call DrawVariableLengthMenuBox call .DrawBugContestStatusBox call SafeUpdateSprites @@ -49,7 +49,7 @@ StartMenu:: .Select: call .GetInput jr c, .Exit - call .DrawMenuAccount + call ._DrawMenuAccount ld a, [wMenuCursorBuffer] ld [wBattleMenuCursorBuffer], a call PlayClickSFX @@ -96,7 +96,7 @@ StartMenu:: ; Return carry on exit, and no-carry on selection. xor a ld [hBGMapMode], a - call .DrawMenuAccount + call ._DrawMenuAccount call SetUpMenu ld a, $ff ld [wMenuSelection], a @@ -147,7 +147,7 @@ StartMenu:: call ClearBGPalettes call Call_ExitMenu call ReloadTilesetAndPalettes - call .DrawMenuAccount_ + call .DrawMenuAccount call DrawVariableLengthMenuBox call .DrawBugContestStatus call UpdateSprites @@ -360,17 +360,17 @@ endr inc c ret -.DrawMenuAccount_: - jp .DrawMenuAccount +.DrawMenuAccount: + jp ._DrawMenuAccount .PrintMenuAccount: call .IsMenuAccountOn ret z - call .DrawMenuAccount + call ._DrawMenuAccount decoord 0, 14 jp .MenuDesc -.DrawMenuAccount: +._DrawMenuAccount: call .IsMenuAccountOn ret z hlcoord 0, 13 @@ -539,1309 +539,3 @@ StartMenu_Pokemon: call ExitAllMenus pop af ret - -HasNoItems: - ld a, [wNumItems] - and a - ret nz - ld a, [wNumKeyItems] - and a - ret nz - ld a, [wNumBalls] - and a - ret nz - ld hl, wTMsHMs - ld b, NUM_TMS + NUM_HMS -.loop - ld a, [hli] - and a - jr nz, .done - dec b - jr nz, .loop - scf - ret -.done - and a - ret - -TossItemFromPC: - push de - call PartyMonItemName - farcall _CheckTossableItem - ld a, [wItemAttributeParamBuffer] - and a - jr nz, .key_item - ld hl, .TossHowMany - call MenuTextBox - farcall SelectQuantityToToss - push af - call CloseWindow - call ExitMenu - pop af - jr c, .quit - ld hl, .ConfirmToss - call MenuTextBox - call YesNoBox - push af - call ExitMenu - pop af - jr c, .quit - pop hl - ld a, [wCurItemQuantity] - call TossItem - call PartyMonItemName - ld hl, .TossedThisMany - call MenuTextBox - call ExitMenu - and a - ret - -.key_item - call .CantToss -.quit - pop hl - scf - ret - -.TossHowMany: - ; Toss out how many @ (S)? - text_jump UnknownText_0x1c1a90 - db "@" - -.ConfirmToss: - ; Throw away @ @ (S)? - text_jump UnknownText_0x1c1aad - db "@" - -.TossedThisMany: - ; Discarded @ (S). - text_jump UnknownText_0x1c1aca - db "@" - -.CantToss: - ld hl, .TooImportantToToss - call MenuTextBoxBackup - ret - -.TooImportantToToss: - ; That's too impor- tant to toss out! - text_jump UnknownText_0x1c1adf - db "@" - -CantUseItem: - ld hl, CantUseItemText - call MenuTextBoxWaitButton - ret - -CantUseItemText: - text_jump UnknownText_0x1c1b03 - db "@" - -PartyMonItemName: - ld a, [wCurItem] - ld [wd265], a - call GetItemName - call CopyName1 - ret - -CancelPokemonAction: - farcall InitPartyMenuWithCancel - farcall UnfreezeMonIcons - ld a, 1 - ret - -PokemonActionSubmenu: - hlcoord 1, 15 - lb bc, 2, 18 - call ClearBox - farcall MonSubmenu - call GetCurNick - ld a, [wMenuSelection] - ld hl, .Actions - ld de, 3 - call IsInArray - jr nc, .nothing - - inc hl - ld a, [hli] - ld h, [hl] - ld l, a - jp hl - -.nothing - ld a, 0 - ret - -.Actions: - dbw MONMENUITEM_CUT, MonMenu_Cut - dbw MONMENUITEM_FLY, MonMenu_Fly - dbw MONMENUITEM_SURF, MonMenu_Surf - dbw MONMENUITEM_STRENGTH, MonMenu_Strength - dbw MONMENUITEM_FLASH, MonMenu_Flash - dbw MONMENUITEM_WHIRLPOOL, MonMenu_Whirlpool - dbw MONMENUITEM_DIG, MonMenu_Dig - dbw MONMENUITEM_TELEPORT, MonMenu_Teleport - dbw MONMENUITEM_SOFTBOILED, MonMenu_Softboiled_MilkDrink - dbw MONMENUITEM_MILKDRINK, MonMenu_Softboiled_MilkDrink - dbw MONMENUITEM_HEADBUTT, MonMenu_Headbutt - dbw MONMENUITEM_WATERFALL, MonMenu_Waterfall - dbw MONMENUITEM_ROCKSMASH, MonMenu_RockSmash - dbw MONMENUITEM_SWEETSCENT, MonMenu_SweetScent - dbw MONMENUITEM_STATS, OpenPartyStats - dbw MONMENUITEM_SWITCH, SwitchPartyMons - dbw MONMENUITEM_ITEM, GiveTakePartyMonItem - dbw MONMENUITEM_CANCEL, CancelPokemonAction - dbw MONMENUITEM_MOVE, ManagePokemonMoves - dbw MONMENUITEM_MAIL, MonMailAction - -SwitchPartyMons: -; Don't try if there's nothing to switch! - ld a, [wPartyCount] - cp 2 - jr c, .DontSwitch - - ld a, [wCurPartyMon] - inc a - ld [wSwitchMon], a - - farcall HoldSwitchmonIcon - farcall InitPartyMenuNoCancel - - ld a, PARTYMENUACTION_MOVE - ld [wPartyMenuActionText], a - farcall WritePartyMenuTilemap - farcall PrintPartyMenuText - - hlcoord 0, 1 - ld bc, SCREEN_WIDTH * 2 - ld a, [wSwitchMon] - dec a - call AddNTimes - ld [hl], "▷" - call WaitBGMap - call SetPalettes - call DelayFrame - - farcall PartyMenuSelect - bit 1, b - jr c, .DontSwitch - - farcall _SwitchPartyMons - - xor a - ld [wPartyMenuActionText], a - - farcall LoadPartyMenuGFX - farcall InitPartyMenuWithCancel - farcall InitPartyMenuGFX - - ld a, 1 - ret - -.DontSwitch: - xor a - ld [wPartyMenuActionText], a - call CancelPokemonAction - ret - -GiveTakePartyMonItem: -; Eggs can't hold items! - ld a, [wCurPartySpecies] - cp EGG - jr z, .cancel - - ld hl, GiveTakeItemMenuData - call LoadMenuHeader - call VerticalMenu - call ExitMenu - jr c, .cancel - - call GetCurNick - ld hl, wStringBuffer1 - ld de, wMonOrItemNameBuffer - ld bc, MON_NAME_LENGTH - call CopyBytes - ld a, [wMenuCursorY] - cp 1 - jr nz, .take - - call LoadStandardMenuHeader - call ClearPalettes - call .GiveItem - call ClearPalettes - call LoadFontsBattleExtra - call ExitMenu - ld a, 0 - ret - -.take - call TakePartyItem - ld a, 3 - ret - -.cancel - ld a, 3 - ret - -.GiveItem: - farcall DepositSellInitPackBuffers - -.loop - farcall DepositSellPack - - ld a, [wcf66] - and a - jr z, .quit - - ld a, [wcf65] - cp 2 - jr z, .next - - call CheckTossableItem - ld a, [wItemAttributeParamBuffer] - and a - jr nz, .next - - call TryGiveItemToPartymon - jr .quit - -.next - ld hl, CantBeHeldText - call MenuTextBoxBackup - jr .loop - -.quit - ret - -TryGiveItemToPartymon: - call SpeechTextBox - call PartyMonItemName - call GetPartyItemLocation - ld a, [hl] - and a - jr z, .give_item_to_mon - - push hl - ld d, a - farcall ItemIsMail - pop hl - jr c, .please_remove_mail - ld a, [hl] - jr .already_holding_item - -.give_item_to_mon - call GiveItemToPokemon - ld hl, MadeHoldText - call MenuTextBoxBackup - call GivePartyItem - ret - -.please_remove_mail - ld hl, PleaseRemoveMailText - call MenuTextBoxBackup - ret - -.already_holding_item - ld [wd265], a - call GetItemName - ld hl, SwitchAlreadyHoldingText - call StartMenuYesNo - jr c, .abort - - call GiveItemToPokemon - ld a, [wd265] - push af - ld a, [wCurItem] - ld [wd265], a - pop af - ld [wCurItem], a - call ReceiveItemFromPokemon - jr nc, .bag_full - - ld hl, TookAndMadeHoldText - call MenuTextBoxBackup - ld a, [wd265] - ld [wCurItem], a - call GivePartyItem - ret - -.bag_full - ld a, [wd265] - ld [wCurItem], a - call ReceiveItemFromPokemon - ld hl, ItemStorageIsFullText - call MenuTextBoxBackup - -.abort - ret - -GivePartyItem: - call GetPartyItemLocation - ld a, [wCurItem] - ld [hl], a - ld d, a - farcall ItemIsMail - jr nc, .done - call ComposeMailMessage - -.done - ret - -TakePartyItem: - call SpeechTextBox - call GetPartyItemLocation - ld a, [hl] - and a - jr z, .asm_12c8c - - ld [wCurItem], a - call ReceiveItemFromPokemon - jr nc, .asm_12c94 - - farcall ItemIsMail - call GetPartyItemLocation - ld a, [hl] - ld [wd265], a - ld [hl], NO_ITEM - call GetItemName - ld hl, TookFromText - call MenuTextBoxBackup - jr .asm_12c9a - -.asm_12c8c - ld hl, IsntHoldingAnythingText - call MenuTextBoxBackup - jr .asm_12c9a - -.asm_12c94 - ld hl, ItemStorageIsFullText - call MenuTextBoxBackup - -.asm_12c9a - ret - -GiveTakeItemMenuData: - db MENU_SPRITE_ANIMS | MENU_BACKUP_TILES ; flags - menu_coords 12, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 - dw .Items - db 1 ; default option - -.Items: - db STATICMENU_CURSOR ; flags - db 2 ; # items - db "GIVE@" - db "TAKE@" - -TookAndMadeHoldText: - text_jump UnknownText_0x1c1b2c - db "@" - -MadeHoldText: - text_jump UnknownText_0x1c1b57 - db "@" - -PleaseRemoveMailText: - text_jump UnknownText_0x1c1b6f - db "@" - -IsntHoldingAnythingText: - text_jump UnknownText_0x1c1b8e - db "@" - -ItemStorageIsFullText: - text_jump UnknownText_0x1c1baa - db "@" - -TookFromText: - text_jump UnknownText_0x1c1bc4 - db "@" - -SwitchAlreadyHoldingText: - text_jump UnknownText_0x1c1bdc - db "@" - -CantBeHeldText: - text_jump UnknownText_0x1c1c09 - db "@" - -GetPartyItemLocation: - push af - ld a, MON_ITEM - call GetPartyParamLocation - pop af - ret - -ReceiveItemFromPokemon: - ld a, 1 - ld [wItemQuantityChangeBuffer], a - ld hl, wNumItems - jp ReceiveItem - -GiveItemToPokemon: - ld a, 1 - ld [wItemQuantityChangeBuffer], a - ld hl, wNumItems - jp TossItem - -StartMenuYesNo: - call MenuTextBox - call YesNoBox - jp ExitMenu - -ComposeMailMessage: - ld de, wTempMailMessage - farcall _ComposeMailMessage - ld hl, wPlayerName - ld de, wTempMailAuthor - ld bc, NAME_LENGTH - 1 - call CopyBytes - ld hl, wPlayerID - ld bc, 2 - call CopyBytes - ld a, [wCurPartySpecies] - ld [de], a - inc de - ld a, [wCurItem] - ld [de], a - ld a, [wCurPartyMon] - ld hl, sPartyMail - ld bc, MAIL_STRUCT_LENGTH - call AddNTimes - ld d, h - ld e, l - ld hl, wTempMail - ld bc, MAIL_STRUCT_LENGTH - ld a, BANK(sPartyMail) - call GetSRAMBank - call CopyBytes - call CloseSRAM - ret - -MonMailAction: -; If in the time capsule or trade center, -; selecting the mail only allows you to -; read the mail. - ld a, [wLinkMode] - cp LINK_TIMECAPSULE - jr z, .read - cp LINK_TRADECENTER - jr z, .read - -; Show the READ/TAKE/QUIT menu. - ld hl, .MenuHeader - call LoadMenuHeader - call VerticalMenu - call ExitMenu - -; Interpret the menu. - jp c, .done - ld a, [wMenuCursorY] - cp $1 - jr z, .read - cp $2 - jr z, .take - jp .done - -.read - farcall ReadPartyMonMail - ld a, $0 - ret - -.take - ld hl, .sendmailtopctext - call StartMenuYesNo - jr c, .RemoveMailToBag - ld a, [wCurPartyMon] - ld b, a - farcall SendMailToPC - jr c, .MailboxFull - ld hl, .sentmailtopctext - call MenuTextBoxBackup - jr .done - -.MailboxFull: - ld hl, .mailboxfulltext - call MenuTextBoxBackup - jr .done - -.RemoveMailToBag: - ld hl, .mailwilllosemessagetext - call StartMenuYesNo - jr c, .done - call GetPartyItemLocation - ld a, [hl] - ld [wCurItem], a - call ReceiveItemFromPokemon - jr nc, .BagIsFull - call GetPartyItemLocation - ld [hl], $0 - call GetCurNick - ld hl, .tookmailfrommontext - call MenuTextBoxBackup - jr .done - -.BagIsFull: - ld hl, .bagfulltext - call MenuTextBoxBackup - jr .done - -.done - ld a, $3 - ret - -.MenuHeader: - db MENU_BACKUP_TILES ; flags - menu_coords 12, 10, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 - dw .MenuData - db 1 ; default option - -.MenuData: - db STATICMENU_CURSOR ; flags - db 3 ; items - db "READ@" - db "TAKE@" - db "QUIT@" - -.mailwilllosemessagetext -; The MAIL will lose its message. OK? - text_jump UnknownText_0x1c1c22 - db "@" - -.tookmailfrommontext -; MAIL detached from <POKEMON>. - text_jump UnknownText_0x1c1c47 - db "@" - -.bagfulltext -; There's no space for removing MAIL. - text_jump UnknownText_0x1c1c62 - db "@" - -.sendmailtopctext -; Send the removed MAIL to your PC? - text_jump UnknownText_0x1c1c86 - db "@" - -.mailboxfulltext -; Your PC's MAILBOX is full. - text_jump UnknownText_0x1c1ca9 - db "@" - -.sentmailtopctext -; The MAIL was sent to your PC. - text_jump UnknownText_0x1c1cc4 - db "@" - -OpenPartyStats: - call LoadStandardMenuHeader - call ClearSprites -; PartyMon - xor a - ld [wMonType], a - call LowVolume - predef StatsScreenInit - call MaxVolume - call Call_ExitMenu - ld a, 0 - ret - -MonMenu_Cut: - farcall CutFunction - ld a, [wFieldMoveSucceeded] - cp $1 - jr nz, .Fail - ld b, $4 - ld a, $2 - ret - -.Fail: - ld a, $3 - ret - -MonMenu_Fly: - farcall FlyFunction - ld a, [wFieldMoveSucceeded] - cp $2 - jr z, .Fail - cp $0 - jr z, .Error - farcall StubbedTrainerRankings_Fly - ld b, $4 - ld a, $2 - ret - -.Fail: - ld a, $3 - ret - -.Error: - ld a, $0 - ret - -.Unreferenced: - ld a, $1 - ret - -MonMenu_Flash: - farcall OWFlash - ld a, [wFieldMoveSucceeded] - cp $1 - jr nz, .Fail - ld b, $4 - ld a, $2 - ret - -.Fail: - ld a, $3 - ret - -MonMenu_Strength: - farcall StrengthFunction - ld a, [wFieldMoveSucceeded] - cp $1 - jr nz, .Fail - ld b, $4 - ld a, $2 - ret - -.Fail: - ld a, $3 - ret - -MonMenu_Whirlpool: - farcall WhirlpoolFunction - ld a, [wFieldMoveSucceeded] - cp $1 - jr nz, .Fail - ld b, $4 - ld a, $2 - ret - -.Fail: - ld a, $3 - ret - -MonMenu_Waterfall: - farcall WaterfallFunction - ld a, [wFieldMoveSucceeded] - cp $1 - jr nz, .Fail - ld b, $4 - ld a, $2 - ret - -.Fail: - ld a, $3 - ret - -MonMenu_Teleport: - farcall TeleportFunction - ld a, [wFieldMoveSucceeded] - and a - jr z, .Fail - ld b, $4 - ld a, $2 - ret - -.Fail: - ld a, $3 - ret - -MonMenu_Surf: - farcall SurfFunction - ld a, [wFieldMoveSucceeded] - and a - jr z, .Fail - ld b, $4 - ld a, $2 - ret - -.Fail: - ld a, $3 - ret - -MonMenu_Dig: - farcall DigFunction - ld a, [wFieldMoveSucceeded] - cp $1 - jr nz, .Fail - ld b, $4 - ld a, $2 - ret - -.Fail: - ld a, $3 - ret - -MonMenu_Softboiled_MilkDrink: - call .CheckMonHasEnoughHP - jr nc, .NotEnoughHP - farcall Softboiled_MilkDrinkFunction - jr .finish - -.NotEnoughHP: - ld hl, .Text_NotEnoughHP - call PrintText - -.finish - xor a - ld [wPartyMenuActionText], a - ld a, $3 - ret - -.Text_NotEnoughHP: - ; Not enough HP! - text_jump UnknownText_0x1c1ce3 - db "@" - -.CheckMonHasEnoughHP: -; Need to have at least (MaxHP / 5) HP left. - ld a, MON_MAXHP - call GetPartyParamLocation - ld a, [hli] - ld [hDividend + 0], a - ld a, [hl] - ld [hDividend + 1], a - ld a, 5 - ld [hDivisor], a - ld b, 2 - call Divide - ld a, MON_HP + 1 - call GetPartyParamLocation - ld a, [hQuotient + 2] - sub [hl] - dec hl - ld a, [hQuotient + 1] - sbc [hl] - ret - -MonMenu_Headbutt: - farcall HeadbuttFunction - ld a, [wFieldMoveSucceeded] - cp $1 - jr nz, .Fail - ld b, $4 - ld a, $2 - ret - -.Fail: - ld a, $3 - ret - -MonMenu_RockSmash: - farcall RockSmashFunction - ld a, [wFieldMoveSucceeded] - cp $1 - jr nz, .Fail - ld b, $4 - ld a, $2 - ret - -.Fail: - ld a, $3 - ret - -MonMenu_SweetScent: - farcall SweetScentFromMenu - ld b, $4 - ld a, $2 - ret - -ChooseMoveToDelete: - ld hl, wOptions - ld a, [hl] - push af - set NO_TEXT_SCROLL, [hl] - call LoadFontsBattleExtra - call .ChooseMoveToDelete - pop bc - ld a, b - ld [wOptions], a - push af - call ClearBGPalettes - pop af - ret - -.ChooseMoveToDelete - call SetUpMoveScreenBG - ld de, DeleteMoveScreenAttrs - call SetMenuAttributes - call SetUpMoveList - ld hl, w2DMenuFlags1 - set 6, [hl] - jr .enter_loop - -.loop - call ScrollingMenuJoypad - bit B_BUTTON_F, a - jp nz, .b_button - bit A_BUTTON_F, a - jp nz, .a_button - -.enter_loop - call PrepareToPlaceMoveData - call PlaceMoveData - jp .loop - -.a_button - and a - jr .finish - -.b_button - scf - -.finish - push af - xor a - ld [wSwitchMon], a - ld hl, w2DMenuFlags1 - res 6, [hl] - call ClearSprites - call ClearTileMap - pop af - ret - -DeleteMoveScreenAttrs: - db 3, 1 - db 3, 1 - db $40, $00 - dn 2, 0 - db D_UP | D_DOWN | A_BUTTON | B_BUTTON - -ManagePokemonMoves: - ld a, [wCurPartySpecies] - cp EGG - jr z, .egg - ld hl, wOptions - ld a, [hl] - push af - set NO_TEXT_SCROLL, [hl] - call MoveScreenLoop - pop af - ld [wOptions], a - call ClearBGPalettes - -.egg - ld a, $0 - ret - -MoveScreenLoop: - ld a, [wCurPartyMon] - inc a - ld [wPartyMenuCursor], a - call SetUpMoveScreenBG - call Function132d3 - ld de, MoveScreenAttributes - call SetMenuAttributes -.loop - call SetUpMoveList - ld hl, w2DMenuFlags1 - set 6, [hl] - jr .skip_joy - -.joy_loop - call ScrollingMenuJoypad - bit 1, a - jp nz, .b_button - bit 0, a - jp nz, .a_button - bit 4, a - jp nz, .d_right - bit 5, a - jp nz, .d_left - -.skip_joy - call PrepareToPlaceMoveData - ld a, [wMoveSwapBuffer] - and a - jr nz, .moving_move - call PlaceMoveData - jp .joy_loop - -.moving_move - ld a, " " - hlcoord 1, 11 - ld bc, 5 - call ByteFill - hlcoord 1, 12 - lb bc, 5, SCREEN_WIDTH - 2 - call ClearBox - hlcoord 1, 12 - ld de, String_MoveWhere - call PlaceString - jp .joy_loop -.b_button - call PlayClickSFX - call WaitSFX - ld a, [wMoveSwapBuffer] - and a - jp z, .exit - - ld a, [wMoveSwapBuffer] - ld [wMenuCursorY], a - xor a - ld [wMoveSwapBuffer], a - hlcoord 1, 2 - lb bc, 8, SCREEN_WIDTH - 2 - call ClearBox - jp .loop - -.d_right - ld a, [wMoveSwapBuffer] - and a - jp nz, .joy_loop - - ld a, [wCurPartyMon] - ld b, a - push bc - call .cycle_right - pop bc - ld a, [wCurPartyMon] - cp b - jp z, .joy_loop - jp MoveScreenLoop - -.d_left - ld a, [wMoveSwapBuffer] - and a - jp nz, .joy_loop - ld a, [wCurPartyMon] - ld b, a - push bc - call .cycle_left - pop bc - ld a, [wCurPartyMon] - cp b - jp z, .joy_loop - jp MoveScreenLoop - -.cycle_right - ld a, [wCurPartyMon] - inc a - ld [wCurPartyMon], a - ld c, a - ld b, 0 - ld hl, wPartySpecies - add hl, bc - ld a, [hl] - cp -1 - jr z, .cycle_left - cp EGG - ret nz - jr .cycle_right - -.cycle_left - ld a, [wCurPartyMon] - and a - ret z -.cycle_left_loop - ld a, [wCurPartyMon] - dec a - ld [wCurPartyMon], a - ld c, a - ld b, 0 - ld hl, wPartySpecies - add hl, bc - ld a, [hl] - cp EGG - ret nz - ld a, [wCurPartyMon] - and a - jr z, .cycle_right - jr .cycle_left_loop - -.a_button - call PlayClickSFX - call WaitSFX - ld a, [wMoveSwapBuffer] - and a - jr nz, .place_move - ld a, [wMenuCursorY] - ld [wMoveSwapBuffer], a - call PlaceHollowCursor - jp .moving_move - -.place_move - ld hl, wPartyMon1Moves - ld bc, PARTYMON_STRUCT_LENGTH - ld a, [wCurPartyMon] - call AddNTimes - push hl - call .copy_move - pop hl - ld bc, $15 - add hl, bc - call .copy_move - ld a, [wBattleMode] - jr z, .swap_moves - ld hl, wBattleMonMoves - ld bc, $20 - ld a, [wCurPartyMon] - call AddNTimes - push hl - call .copy_move - pop hl - ld bc, 6 - add hl, bc - call .copy_move - -.swap_moves - ld de, SFX_SWITCH_POKEMON - call PlaySFX - call WaitSFX - ld de, SFX_SWITCH_POKEMON - call PlaySFX - call WaitSFX - hlcoord 1, 2 - lb bc, 8, 18 - call ClearBox - hlcoord 10, 10 - lb bc, 1, 9 - call ClearBox - jp .loop - -.copy_move - push hl - ld a, [wMenuCursorY] - dec a - ld c, a - ld b, $0 - add hl, bc - ld d, h - ld e, l - pop hl - ld a, [wMoveSwapBuffer] - dec a - ld c, a - ld b, $0 - add hl, bc - ld a, [de] - ld b, [hl] - ld [hl], a - ld a, b - ld [de], a - ret - -.exit - xor a - ld [wMoveSwapBuffer], a - ld hl, w2DMenuFlags1 - res 6, [hl] - call ClearSprites - jp ClearTileMap - -MoveScreenAttributes: - db 3, 1 - db 3, 1 - db $40, $00 - dn 2, 0 - db D_UP | D_DOWN | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON - -String_MoveWhere: - db "Where?@" - -SetUpMoveScreenBG: - call ClearBGPalettes - call ClearTileMap - call ClearSprites - xor a - ld [hBGMapMode], a - farcall LoadStatsScreenPageTilesGFX - farcall ClearSpriteAnims2 - ld a, [wCurPartyMon] - ld e, a - ld d, $0 - ld hl, wPartySpecies - add hl, de - ld a, [hl] - ld [wd265], a - ld e, $2 - farcall LoadMenuMonIcon - hlcoord 0, 1 - ld b, 9 - ld c, 18 - call TextBox - hlcoord 0, 11 - ld b, 5 - ld c, 18 - call TextBox - hlcoord 2, 0 - lb bc, 2, 3 - call ClearBox - xor a - ld [wMonType], a - ld hl, wPartyMonNicknames - ld a, [wCurPartyMon] - call GetNick - hlcoord 5, 1 - call PlaceString - push bc - farcall CopyMonToTempMon - pop hl - call PrintLevel - ld hl, wPlayerHPPal - call SetHPPal - ld b, SCGB_MOVE_LIST - call GetSGBLayout - hlcoord 16, 0 - lb bc, 1, 3 - jp ClearBox - -SetUpMoveList: - xor a - ld [hBGMapMode], a - ld [wMoveSwapBuffer], a - ld [wMonType], a - predef CopyMonToTempMon - ld hl, wTempMonMoves - ld de, wListMoves_MoveIndicesBuffer - ld bc, NUM_MOVES - call CopyBytes - ld a, SCREEN_WIDTH * 2 - ld [wBuffer1], a - hlcoord 2, 3 - predef ListMoves - hlcoord 10, 4 - predef ListMovePP - call WaitBGMap - call SetPalettes - ld a, [wNumMoves] - inc a - ld [w2DMenuNumRows], a - hlcoord 0, 11 - ld b, 5 - ld c, 18 - jp TextBox - -PrepareToPlaceMoveData: - ld hl, wPartyMon1Moves - ld bc, PARTYMON_STRUCT_LENGTH - ld a, [wCurPartyMon] - call AddNTimes - ld a, [wMenuCursorY] - dec a - ld c, a - ld b, $0 - add hl, bc - ld a, [hl] - ld [wCurMove], a - hlcoord 1, 12 - lb bc, 5, 18 - jp ClearBox - -PlaceMoveData: - xor a - ld [hBGMapMode], a - hlcoord 0, 10 - ld de, String_MoveType_Top - call PlaceString - hlcoord 0, 11 - ld de, String_MoveType_Bottom - call PlaceString - hlcoord 12, 12 - ld de, String_MoveAtk - call PlaceString - ld a, [wCurMove] - ld b, a - hlcoord 2, 12 - predef PrintMoveType - ld a, [wCurMove] - dec a - ld hl, Moves + MOVE_POWER - ld bc, MOVE_LENGTH - call AddNTimes - ld a, BANK(Moves) - call GetFarByte - hlcoord 16, 12 - cp 2 - jr c, .no_power - ld [wd265], a - ld de, wd265 - lb bc, 1, 3 - call PrintNum - jr .description - -.no_power - ld de, String_MoveNoPower - call PlaceString - -.description - hlcoord 1, 14 - predef PrintMoveDesc - ld a, $1 - ld [hBGMapMode], a - ret - -String_MoveType_Top: - db "┌─────┐@" -String_MoveType_Bottom: - db "│TYPE/└@" -String_MoveAtk: - db "ATK/@" -String_MoveNoPower: - db "---@" - -Function132d3: - call Function132da - call Function132fe - ret - -Function132da: - ld a, [wCurPartyMon] - and a - ret z - ld c, a - ld e, a - ld d, 0 - ld hl, wPartyCount - add hl, de -.loop - ld a, [hl] - and a - jr z, .prev - cp EGG - jr z, .prev - cp NUM_POKEMON + 1 - jr c, .legal - -.prev - dec hl - dec c - jr nz, .loop - ret - -.legal - hlcoord 16, 0 - ld [hl], "◀" - ret - -Function132fe: - ld a, [wCurPartyMon] - inc a - ld c, a - ld a, [wPartyCount] - cp c - ret z - ld e, c - ld d, 0 - ld hl, wPartySpecies - add hl, de -.loop - ld a, [hl] - cp -1 - ret z - and a - jr z, .next - cp EGG - jr z, .next - cp NUM_POKEMON + 1 - jr c, .legal - -.next - inc hl - jr .loop - -.legal - hlcoord 18, 0 - ld [hl], "▶" - ret diff --git a/engine/menus/trainer_card.asm b/engine/menus/trainer_card.asm index f48636f67..a1b7fcd64 100644 --- a/engine/menus/trainer_card.asm +++ b/engine/menus/trainer_card.asm @@ -276,7 +276,7 @@ TrainerCard_Page1_PrintDexCaught_GameTime: ld hl, wPokedexCaught ld b, wEndPokedexCaught - wPokedexCaught call CountSetBits - ld de, wd265 + ld de, wNumSetBits hlcoord 15, 10 lb bc, 1, 3 call PrintNum diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index 97828ab58..76154a1aa 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -377,7 +377,7 @@ ParseCredits: push de ld a, [wCreditsPos] ld e, a - ld a, [wCreditsPos+1] + ld a, [wCreditsPos + 1] ld d, a ld hl, CreditsScript add hl, de @@ -386,7 +386,7 @@ ParseCredits: ld a, e ld [wCreditsPos], a ld a, d - ld [wCreditsPos+1], a + ld [wCreditsPos + 1], a ld a, [hl] pop de pop hl diff --git a/engine/movie/crystal_intro.asm b/engine/movie/crystal_intro.asm index 26fb31bb8..467c1671a 100644 --- a/engine/movie/crystal_intro.asm +++ b/engine/movie/crystal_intro.asm @@ -1481,7 +1481,7 @@ IntroScene28: cp $8 ret nz - ld de, SFX_UNKNOWN_CB + ld de, SFX_INTRO_WHOOSH call PlaySFX ret diff --git a/engine/movie/title.asm b/engine/movie/title.asm index 3717b4e73..eb639489f 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -246,8 +246,8 @@ SuicuneFrameIterator: ret .Frames: - db $80 ; vTiles4 tile $00 - db $88 ; vTiles4 tile $08 + db $80 ; vTiles3 tile $80 + db $88 ; vTiles3 tile $88 db $00 ; vTiles5 tile $00 db $08 ; vTiles5 tile $08 diff --git a/engine/movie/trade_animation.asm b/engine/movie/trade_animation.asm index e60344430..a225e9721 100644 --- a/engine/movie/trade_animation.asm +++ b/engine/movie/trade_animation.asm @@ -317,7 +317,7 @@ TradeAnim_TubeToOT1: ld a, TRADEANIM_RIGHT_ARROW call TradeAnim_PlaceTrademonStatsOnTubeAnim ld a, [wLinkTradeSendmonSpecies] - ld [wd265], a + ld [wTempIconSpecies], a xor a depixel 5, 11, 4, 0 ld b, $0 @@ -327,7 +327,7 @@ TradeAnim_TubeToPlayer1: ld a, TRADEANIM_LEFT_ARROW call TradeAnim_PlaceTrademonStatsOnTubeAnim ld a, [wLinkTradeGetmonSpecies] - ld [wd265], a + ld [wTempIconSpecies], a ld a, TRADEANIMSTATE_2 depixel 9, 18, 4, 4 ld b, $4 @@ -820,7 +820,7 @@ TradeAnim_GetFrontpic: TradeAnim_GetNickname: push de - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, wStringBuffer1 pop de @@ -1373,7 +1373,7 @@ LoadTradeBallAndCableGFX: LoadTradeBubbleGFX: call DelayFrame - ld e, $3 + ld e, MONICON_TRADE callfar LoadMenuMonIcon ld de, TradeBubbleGFX ld hl, vTiles0 tile $72 diff --git a/engine/overworld/decorations.asm b/engine/overworld/decorations.asm index 7ba177420..673d7f272 100644 --- a/engine/overworld/decorations.asm +++ b/engine/overworld/decorations.asm @@ -559,7 +559,7 @@ GetDecoName: .getpokename push bc - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName pop bc jr .copy @@ -1085,17 +1085,18 @@ DecorationDesc_GiantOrnament: db "@" ToggleMaptileDecorations: - lb de, 0, 4 + ; tile coordinates work the same way as for changeblock + lb de, 0, 4 ; bed coordinates ld a, [wDecoBed] call SetDecorationTile - lb de, 7, 4 + lb de, 7, 4 ; plant coordinates ld a, [wDecoPlant] call SetDecorationTile - lb de, 6, 0 + lb de, 6, 0 ; poster coordinates ld a, [wDecoPoster] call SetDecorationTile call SetPosterVisibility - lb de, 0, 0 + lb de, 0, 0 ; carpet top-left coordinates call PadCoords_de ld a, [wDecoCarpet] and a @@ -1103,15 +1104,15 @@ ToggleMaptileDecorations: call _GetDecorationSprite ld [hl], a push af - lb de, 0, 2 + lb de, 0, 2 ; carpet bottom-left coordinates call PadCoords_de pop af inc a - ld [hli], a + ld [hli], a ; carpet bottom-left block inc a - ld [hli], a + ld [hli], a ; carpet bottom-middle block dec a - ld [hl], a + ld [hl], a ; carpet bottom-right block ret SetPosterVisibility: @@ -1177,6 +1178,7 @@ _GetDecorationSprite: ret PadCoords_de: +; adjusts coordinates, the same way as Script_changeblock ld a, d add 4 ld d, a diff --git a/engine/overworld/events.asm b/engine/overworld/events.asm index 707d31e66..063265e4d 100644 --- a/engine/overworld/events.asm +++ b/engine/overworld/events.asm @@ -972,17 +972,18 @@ DoPlayerEvent: ret PlayerEventScriptPointers: - dba Invalid_0x96c2d ; 0 - dba SeenByTrainerScript ; 1 - dba TalkToTrainerScript ; 2 - dba FindItemInBallScript ; 3 - dba EdgeWarpScript ; 4 - dba WarpToNewMapScript ; 5 - dba FallIntoMapScript ; 6 - dba Script_OverworldWhiteout ; 7 - dba HatchEggScript ; 8 - dba ChangeDirectionScript ; 9 - dba Invalid_0x96c2d ; 10 +; entries correspond to PLAYEREVENT_* constants + dba Invalid_0x96c2d ; PLAYEREVENT_NONE + dba SeenByTrainerScript ; PLAYEREVENT_SEENBYTRAINER + dba TalkToTrainerScript ; PLAYEREVENT_TALKTOTRAINER + dba FindItemInBallScript ; PLAYEREVENT_ITEMBALL + dba EdgeWarpScript ; PLAYEREVENT_CONNECTION + dba WarpToNewMapScript ; PLAYEREVENT_WARP + dba FallIntoMapScript ; PLAYEREVENT_FALL + dba Script_OverworldWhiteout ; PLAYEREVENT_WHITEOUT + dba HatchEggScript ; PLAYEREVENT_HATCH + dba ChangeDirectionScript ; PLAYEREVENT_JOYCHANGEFACING + dba Invalid_0x96c2d ; (NUM_PLAYER_EVENTS) Invalid_0x96c2d: end @@ -1336,8 +1337,8 @@ DoBikeStep:: ClearCmdQueue:: ld hl, wCmdQueue - ld de, 6 - ld c, 4 + ld de, CMDQUEUE_ENTRY_SIZE + ld c, CMDQUEUE_CAPACITY xor a .loop ld [hl], a @@ -1443,7 +1444,7 @@ HandleQueuedCommand: ld hl, CMDQUEUE_TYPE add hl, bc ld a, [hl] - cp 5 + cp NUM_CMDQUEUE_TYPES jr c, .okay xor a diff --git a/engine/overworld/player_movement.asm b/engine/overworld/player_movement.asm index c70357f13..a4926e7e5 100644 --- a/engine/overworld/player_movement.asm +++ b/engine/overworld/player_movement.asm @@ -562,8 +562,8 @@ DoPlayerMovement:: .GetAction: ; Poll player input and update movement info. - ld hl, .table - ld de, .table2 - .table1 + ld hl, .action_table + ld de, .action_table_1_end - .action_table_1 ld a, [wCurInput] bit D_DOWN_F, a jr nz, .d_down @@ -597,25 +597,20 @@ DoPlayerMovement:: ld [wWalkingTile], a ret -.table -; struct: -; walk direction -; facing -; x movement -; y movement -; tile collision pointer -.table1 - db STANDING, FACE_CURRENT, 0, 0 - dw wPlayerStandingTile -.table2 - db RIGHT, FACE_RIGHT, 1, 0 - dw wTileRight - db LEFT, FACE_LEFT, -1, 0 - dw wTileLeft - db UP, FACE_UP, 0, -1 - dw wTileUp - db DOWN, FACE_DOWN, 0, 1 - dw wTileDown +player_action: MACRO +; walk direction, facing, x movement, y movement, tile collision pointer + db \1, \2, \3, \4 + dw \5 +ENDM + +.action_table: +.action_table_1 + player_action STANDING, FACE_CURRENT, 0, 0, wPlayerStandingTile +.action_table_1_end + player_action RIGHT, FACE_RIGHT, 1, 0, wTileRight + player_action LEFT, FACE_LEFT, -1, 0, wTileLeft + player_action UP, FACE_UP, 0, -1, wTileUp + player_action DOWN, FACE_DOWN, 0, 1, wTileDown .CheckNPC: ; Returns 0 if there is an NPC in front that you can't move diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm index f8e702eb9..248ff9978 100644 --- a/engine/overworld/scripting.asm +++ b/engine/overworld/scripting.asm @@ -623,7 +623,7 @@ INCLUDE "data/items/pocket_names.asm" CurItemName: ld a, [wCurItem] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetItemName ret @@ -1863,7 +1863,7 @@ Script_pokenamemem: jr nz, .gotit ld a, [wScriptVar] .gotit - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld de, wStringBuffer1 @@ -1890,7 +1890,7 @@ Script_itemtotext: jr nz, .ok ld a, [wScriptVar] .ok - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetItemName ld de, wStringBuffer1 jr ConvertMemToText diff --git a/engine/overworld/time.asm b/engine/overworld/time.asm index abb12d87d..74bd1b6d9 100644 --- a/engine/overworld/time.asm +++ b/engine/overworld/time.asm @@ -91,9 +91,9 @@ CheckDailyResetTimer:: call CheckDayDependentEventHL ret nc xor a - ld hl, wDailyFlags - ld [hli], a ; wDailyFlags - ld [hli], a ; wWeeklyFlags + ld hl, wDailyFlags1 + ld [hli], a ; wDailyFlags1 + ld [hli], a ; wDailyFlags2 ld [hli], a ; wSwarmFlags ld [hl], a ; wSwarmFlags + 1 ld hl, wDailyRematchFlags @@ -207,14 +207,14 @@ CheckUnusedTwoDayTimer: ret ; unused - ld hl, wDailyFlags - set DAILYFLAGS_FISH_SWARM_F, [hl] + ld hl, wDailyFlags1 + set DAILYFLAGS1_FISH_SWARM_F, [hl] ret ; unused and a - ld hl, wDailyFlags - bit DAILYFLAGS_FISH_SWARM_F, [hl] + ld hl, wDailyFlags1 + bit DAILYFLAGS1_FISH_SWARM_F, [hl] ret nz scf ret diff --git a/engine/overworld/variables.asm b/engine/overworld/variables.asm index 9b5e3846c..da4b18812 100644 --- a/engine/overworld/variables.asm +++ b/engine/overworld/variables.asm @@ -72,7 +72,7 @@ _GetVarAction:: ld hl, wPokedexCaught ld b, wEndPokedexCaught - wPokedexCaught call CountSetBits - ld a, [wd265] + ld a, [wNumSetBits] jp .loadstringbuffer2 .CountSeenMons: @@ -80,7 +80,7 @@ _GetVarAction:: ld hl, wPokedexSeen ld b, wEndPokedexSeen - wPokedexSeen call CountSetBits - ld a, [wd265] + ld a, [wNumSetBits] jp .loadstringbuffer2 .CountBadges: @@ -88,7 +88,7 @@ _GetVarAction:: ld hl, wBadges ld b, 2 call CountSetBits - ld a, [wd265] + ld a, [wNumSetBits] jp .loadstringbuffer2 .PlayerFacing: diff --git a/engine/pokedex/pokedex.asm b/engine/pokedex/pokedex.asm index 5682dac35..188462bb5 100644 --- a/engine/pokedex/pokedex.asm +++ b/engine/pokedex/pokedex.asm @@ -465,7 +465,7 @@ DexEntryScreen_MenuActionJumptable: .Cry: call Pokedex_GetSelectedMon - ld a, [wd265] + ld a, [wTempSpecies] call GetCryIndex ld e, c ld d, b @@ -1088,7 +1088,7 @@ Pokedex_DrawMainScreenBG: ld hl, wPokedexSeen ld b, wEndPokedexSeen - wPokedexSeen call CountSetBits - ld de, wd265 + ld de, wNumSetBits hlcoord 5, 12 lb bc, 1, 3 call PrintNum @@ -1098,7 +1098,7 @@ Pokedex_DrawMainScreenBG: ld hl, wPokedexCaught ld b, wEndPokedexCaught - wPokedexCaught call CountSetBits - ld de, wd265 + ld de, wNumSetBits hlcoord 5, 15 lb bc, 1, 3 call PrintNum @@ -1317,7 +1317,7 @@ Pokedex_DrawUnownModeBG: call Pokedex_PlaceFrontpicAtHL ld de, 0 ld b, 0 - ld c, 26 + ld c, NUM_UNOWN .loop ld hl, wUnownDex add hl, de @@ -1492,7 +1492,7 @@ Pokedex_PrintListing: .loop push af ld a, [de] - ld [wd265], a + ld [wTempSpecies], a ; also sets wNamedObjectIndexBuffer push de push hl call .PrintEntry @@ -1531,7 +1531,7 @@ Pokedex_PrintNumberIfOldMode: push hl ld de, -SCREEN_WIDTH add hl, de - ld de, wd265 + ld de, wTempSpecies lb bc, PRINTNUM_LEADINGZEROS | 1, 3 call PrintNum pop hl @@ -1585,13 +1585,13 @@ Pokedex_GetSelectedMon: ld hl, wPokedexOrder add hl, de ld a, [hl] - ld [wd265], a + ld [wTempSpecies], a ret Pokedex_CheckCaught: push de push hl - ld a, [wd265] + ld a, [wTempSpecies] dec a call CheckCaughtMon pop hl @@ -1601,7 +1601,7 @@ Pokedex_CheckCaught: Pokedex_CheckSeen: push de push hl - ld a, [wd265] + ld a, [wTempSpecies] dec a call CheckSeenMon pop hl @@ -1654,7 +1654,7 @@ Pokedex_OrderMonsByMode: ld e, d .loopfindend ld a, [hld] - ld [wd265], a + ld [wTempSpecies], a call Pokedex_CheckSeen jr nz, .foundend dec d @@ -1674,10 +1674,10 @@ Pokedex_ABCMode: .loop1abc push bc ld a, [de] - ld [wd265], a + ld [wTempSpecies], a call Pokedex_CheckSeen jr z, .skipabc - ld a, [wd265] + ld a, [wTempSpecies] ld [hli], a ld a, [wDexListingEnd] inc a @@ -1898,7 +1898,7 @@ Pokedex_SearchForMons: ld a, [hl] and a jr z, .next_mon - ld [wd265], a + ld [wTempSpecies], a ld [wCurSpecies], a call Pokedex_CheckCaught jr z, .next_mon @@ -1917,7 +1917,7 @@ Pokedex_SearchForMons: jr nz, .next_mon .match_found - ld a, [wd265] + ld a, [wTempSpecies] ld [de], a inc de ld a, [wDexSearchResultCount] @@ -2138,40 +2138,40 @@ Pokedex_PutScrollbarOAM: ld hl, wDexListingScrollOffset add [hl] cp e - jr z, .asm_4133f - ld hl, $0 - ld bc, $79 + jr z, .max + ld hl, 0 + ld bc, 121 ; max y - min y call AddNTimes ld e, l ld d, h - ld b, $0 + ld b, 0 ld a, d or e - jr z, .asm_41341 + jr z, .done ld a, [wDexListingEnd] ld c, a -.asm_41333 +.loop ld a, e sub c ld e, a ld a, d - sbc $0 + sbc 0 ld d, a - jr c, .asm_41341 + jr c, .done inc b - jr .asm_41333 -.asm_4133f - ld b, $79 -.asm_41341 - ld a, $14 + jr .loop +.max + ld b, 121 ; max y - min y +.done + ld a, 20 ; min y add b pop hl ld [hli], a - ld a, $a1 + ld a, 161 ; x ld [hli], a - ld a, $f + ld a, $0f ; tile id ld [hli], a - ld [hl], $0 + ld [hl], 0 ; attributes ret Pokedex_InitArrowCursor: @@ -2354,7 +2354,7 @@ Pokedex_LoadSelectedMonTiles: jr z, .QuestionMark ld a, [wFirstUnownSeen] ld [wUnownLetter], a - ld a, [wd265] + ld a, [wTempSpecies] ld [wCurPartySpecies], a call GetBaseData ld de, vTiles2 @@ -2378,7 +2378,7 @@ Pokedex_LoadCurrentFootprint: call Pokedex_GetSelectedMon Pokedex_LoadAnyFootprint: - ld a, [wd265] + ld a, [wTempSpecies] dec a and %11111000 srl a @@ -2386,7 +2386,7 @@ Pokedex_LoadAnyFootprint: srl a ld e, 0 ld d, a - ld a, [wd265] + ld a, [wTempSpecies] dec a and %111 swap a ; * $10 @@ -2486,11 +2486,11 @@ Pokedex_LoadUnownFont: ld a, BANK(UnownFont) call FarCopyBytes ld hl, sScratch + $188 - ld bc, 27 tiles + ld bc, (NUM_UNOWN + 1) tiles call Pokedex_InvertTiles ld de, sScratch + $188 ld hl, vTiles2 tile $40 - lb bc, BANK(Pokedex_LoadUnownFont), 27 + lb bc, BANK(Pokedex_LoadUnownFont), NUM_UNOWN + 1 call Request2bpp call CloseSRAM ret @@ -2524,7 +2524,7 @@ _NewPokedexEntry: call LoadFontsExtra call Pokedex_LoadGFX call Pokedex_LoadAnyFootprint - ld a, [wd265] + ld a, [wTempSpecies] ld [wCurPartySpecies], a call Pokedex_DrawDexEntryScreenBG call Pokedex_DrawFootprint diff --git a/engine/pokedex/pokedex_2.asm b/engine/pokedex/pokedex_2.asm index 8105a080a..62e7e853b 100644 --- a/engine/pokedex/pokedex_2.asm +++ b/engine/pokedex/pokedex_2.asm @@ -80,7 +80,7 @@ DisplayDexEntry: call GetPokemonName hlcoord 9, 3 call PlaceString ; mon species - ld a, [wd265] + ld a, [wTempSpecies] ld b, a call GetDexEntryPointer ld a, b @@ -96,11 +96,11 @@ DisplayDexEntry: ld [hli], a ld a, $5d ; . ld [hli], a - ld de, wd265 + ld de, wTempSpecies lb bc, PRINTNUM_LEADINGZEROS | 1, 3 call PrintNum ; Check to see if we caught it. Get out of here if we haven't. - ld a, [wd265] + ld a, [wTempSpecies] dec a call CheckCaughtMon pop hl diff --git a/engine/pokegear/pokegear.asm b/engine/pokegear/pokegear.asm index 8fc5ffa3d..8dda3a237 100644 --- a/engine/pokegear/pokegear.asm +++ b/engine/pokegear/pokegear.asm @@ -1287,12 +1287,12 @@ PokegearPhoneContactSubmenu: cp 12 jr c, .am sub 12 - ld [wd265], a + ld [wTempByteValue], a scf ret .am - ld [wd265], a + ld [wTempByteValue], a and a ret @@ -2741,7 +2741,7 @@ TownMapMon: ld d, $0 add hl, de ld a, [hl] - ld [wd265], a + ld [wTempIconSpecies], a ; Get FlyMon icon ld e, $08 ; starting tile in VRAM farcall GetSpeciesIcon diff --git a/engine/pokegear/radio.asm b/engine/pokegear/radio.asm index b76cad13e..390fef28e 100644 --- a/engine/pokegear/radio.asm +++ b/engine/pokegear/radio.asm @@ -1558,8 +1558,8 @@ BuenasPassword4: jp c, BuenasPassword8 ld a, [wBuenasPassword] ; If we already generated the password today, we don't need to generate a new one. - ld hl, wWeeklyFlags - bit WEEKLYFLAGS_BUENAS_PASSWORD_F, [hl] + ld hl, wDailyFlags2 + bit DAILYFLAGS2_BUENAS_PASSWORD_F, [hl] jr nz, .AlreadyGotIt ; There are only 11 groups to choose from. .greater_than_11 @@ -1580,8 +1580,8 @@ BuenasPassword4: add e ld [wBuenasPassword], a ; Set the flag so that we don't generate a new password this week. - ld hl, wWeeklyFlags - set WEEKLYFLAGS_BUENAS_PASSWORD_F, [hl] + ld hl, wDailyFlags2 + set DAILYFLAGS2_BUENAS_PASSWORD_F, [hl] .AlreadyGotIt: ld c, a call GetBuenasPassword @@ -1701,15 +1701,15 @@ BuenasPassword7: BuenasPasswordAfterMidnight: push hl - ld hl, wWeeklyFlags - res WEEKLYFLAGS_BUENAS_PASSWORD_F, [hl] + ld hl, wDailyFlags2 + res DAILYFLAGS2_BUENAS_PASSWORD_F, [hl] pop hl ld a, BUENAS_PASSWORD_8 jp NextRadioLine BuenasPassword8: - ld hl, wWeeklyFlags - res WEEKLYFLAGS_BUENAS_PASSWORD_F, [hl] + ld hl, wDailyFlags2 + res DAILYFLAGS2_BUENAS_PASSWORD_F, [hl] ld hl, BuenaRadioMidnightText10 ld a, BUENAS_PASSWORD_9 jp NextRadioLine @@ -1776,8 +1776,8 @@ BuenasPassword20: farcall NoRadioName pop af ld [hBGMapMode], a - ld hl, wWeeklyFlags - res WEEKLYFLAGS_BUENAS_PASSWORD_F, [hl] + ld hl, wDailyFlags2 + res DAILYFLAGS2_BUENAS_PASSWORD_F, [hl] ld a, BUENAS_PASSWORD ld [wCurrentRadioLine], a xor a diff --git a/engine/pokegear/townmap_convertlinebreakcharacters.asm b/engine/pokegear/townmap_convertlinebreakcharacters.asm index e0ed55131..a881b9260 100644 --- a/engine/pokegear/townmap_convertlinebreakcharacters.asm +++ b/engine/pokegear/townmap_convertlinebreakcharacters.asm @@ -5,14 +5,14 @@ TownMap_ConvertLineBreakCharacters: cp "@" jr z, .end cp "%" - jr z, .line_break + jr z, .line_feed cp "¯" - jr z, .line_break + jr z, .line_feed inc hl jr .loop -.line_break - ld [hl], "<LNBRK>" +.line_feed + ld [hl], "<LF>" .end ld de, wStringBuffer1 diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index 65621192d..f0ddc0ba8 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -1035,7 +1035,7 @@ PCMonInfo: cp -1 ret z - ld [wd265], a + ld [wTempSpecies], a hlcoord 1, 4 xor a ld b, 7 @@ -1057,7 +1057,7 @@ PCMonInfo: jr nz, .row call BillsPC_LoadMonStats - ld a, [wd265] + ld a, [wTempSpecies] ld [wCurPartySpecies], a ld [wCurSpecies], a ld hl, wTempMonDVs @@ -1068,7 +1068,7 @@ PCMonInfo: xor a ld [wBillsPC_MonHasMail], a ld a, [wCurPartySpecies] - ld [wd265], a + ld [wTempSpecies], a cp EGG ret z @@ -1676,9 +1676,9 @@ StatsScreenDPad: and a jr z, .did_nothing call BillsPC_GetSelectedPokemonSpecies - ld [wd265], a + ld [wTempSpecies], a call BillsPC_LoadMonStats - ld a, [wd265] + ld a, [wTempSpecies] ld [wCurPartySpecies], a ld [wCurSpecies], a ld hl, wTempMonDVs @@ -1893,7 +1893,7 @@ ReleasePKMN_ByePKMN: .skip_cry ld a, [wCurPartySpecies] - ld [wd265], a + ld [wTempSpecies], a call GetPokemonName hlcoord 1, 16 ld de, PCString_ReleasedPKMN @@ -2314,9 +2314,9 @@ BillsPC_PrintBoxCountAndCapacity: ld de, .Pokemon call PlaceString call GetBoxCount - ld [wd265], a + ld [wDeciramBuffer], a hlcoord 13, 11 - ld de, wd265 + ld de, wDeciramBuffer lb bc, 1, 2 call PrintNum ld de, .out_of_20 diff --git a/engine/pokemon/breeding.asm b/engine/pokemon/breeding.asm index 7e7f0e097..dfebcd9f9 100644 --- a/engine/pokemon/breeding.asm +++ b/engine/pokemon/breeding.asm @@ -81,7 +81,7 @@ CheckBreedmonCompatibility: .done ld a, c - ld [wd265], a + ld [wBreedingCompatibility], a ret .CheckDVs: @@ -250,7 +250,7 @@ HatchEggs: ld a, [wCurPartySpecies] dec de ld [de], a - ld [wd265], a + ld [wNamedObjectIndexBuffer], a ld [wCurSpecies], a call GetPokemonName xor a @@ -676,7 +676,7 @@ EggHatch_DoAnimFrame: ret EggHatch_AnimationSequence: - ld a, [wd265] + ld a, [wNamedObjectIndexBuffer] ld [wJumptableIndex], a ld a, [wCurSpecies] push af @@ -910,7 +910,7 @@ DayCareMonCompatibilityText: call CopyBytes call CheckBreedmonCompatibility pop bc - ld a, [wd265] + ld a, [wBreedingCompatibility] ld hl, .AllAlone cp -1 jr z, .done diff --git a/engine/pokemon/caught_data.asm b/engine/pokemon/caught_data.asm index 89d22fdf6..31cfe7e75 100644 --- a/engine/pokemon/caught_data.asm +++ b/engine/pokemon/caught_data.asm @@ -38,7 +38,7 @@ CheckPartyFullAfterContest: ld hl, wPlayerName call CopyBytes ld a, [wCurPartySpecies] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, wStringBuffer1 ld de, wMonOrItemNameBuffer @@ -105,7 +105,7 @@ CheckPartyFullAfterContest: call CopyBytes callfar InsertPokemonIntoBox ld a, [wCurPartySpecies] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName call GiveANickname_YesNo ld hl, wStringBuffer1 diff --git a/engine/pokemon/correct_party_errors.asm b/engine/pokemon/correct_party_errors.asm index 50a9f3562..717893b36 100644 --- a/engine/pokemon/correct_party_errors.asm +++ b/engine/pokemon/correct_party_errors.asm @@ -123,7 +123,7 @@ Unreferenced_CorrectPartyErrors: cp EGG ld hl, .TAMAGO jr z, .got_nickname - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, wStringBuffer1 .got_nickname diff --git a/engine/pokemon/evolve.asm b/engine/pokemon/evolve.asm index 571cff0b8..eb2645e00 100644 --- a/engine/pokemon/evolve.asm +++ b/engine/pokemon/evolve.asm @@ -99,7 +99,7 @@ EvolveAfterBattle_MasterLoop: ld de, wTempMonAttack ld hl, wTempMonDefense ld c, 2 - call StringCmp + call CompareBytes ld a, ATK_EQ_DEF jr z, .got_tyrogue_evo ld a, ATK_LT_DEF @@ -236,7 +236,7 @@ EvolveAfterBattle_MasterLoop: ld [wCurSpecies], a ld [wTempMonSpecies], a ld [wEvolutionNewSpecies], a - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName push hl @@ -293,15 +293,15 @@ EvolveAfterBattle_MasterLoop: call CopyBytes ld a, [wCurSpecies] - ld [wd265], a + ld [wTempSpecies], a xor a ld [wMonType], a call LearnLevelMoves - ld a, [wd265] + ld a, [wTempSpecies] dec a call SetSeenAndCaughtMon - ld a, [wd265] + ld a, [wTempSpecies] cp UNOWN jr nz, .skip_unown @@ -348,7 +348,7 @@ UpdateSpeciesNameIfNotNicknamed: ld a, [wCurSpecies] push af ld a, [wBaseDexNo] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName pop af ld [wCurSpecies], a @@ -369,7 +369,7 @@ UpdateSpeciesNameIfNotNicknamed: call AddNTimes push hl ld a, [wCurSpecies] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, wStringBuffer1 pop de @@ -415,7 +415,7 @@ Text_WhatEvolving: db "@" LearnLevelMoves: - ld a, [wd265] + ld a, [wTempSpecies] ld [wCurPartySpecies], a dec a ld b, 0 @@ -466,7 +466,7 @@ LearnLevelMoves: .learn ld a, d ld [wPutativeTMHMMove], a - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetMoveName call CopyName1 predef LearnMove @@ -475,7 +475,7 @@ LearnLevelMoves: .done ld a, [wCurPartySpecies] - ld [wd265], a + ld [wTempSpecies], a ret FillMoves: diff --git a/engine/pokemon/learn.asm b/engine/pokemon/learn.asm index 20294c878..9031c6857 100644 --- a/engine/pokemon/learn.asm +++ b/engine/pokemon/learn.asm @@ -36,7 +36,7 @@ LearnMove: push hl push de - ld [wd265], a + ld [wNamedObjectIndexBuffer], a ld b, a ld a, [wBattleMode] diff --git a/engine/pokemon/mail.asm b/engine/pokemon/mail.asm index 359d2ac8e..2c66ab72a 100644 --- a/engine/pokemon/mail.asm +++ b/engine/pokemon/mail.asm @@ -149,7 +149,7 @@ CheckPokeMail:: ; Compare the mail message, byte for byte, with the expected message. ld a, MAIL_MSG_LENGTH - ld [wd265], a + ld [wTempByteValue], a .loop ld a, [de] ld c, a @@ -162,9 +162,9 @@ CheckPokeMail:: jr nz, .close_sram_return inc hl inc de - ld a, [wd265] + ld a, [wTempByteValue] dec a - ld [wd265], a + ld [wTempByteValue], a jr nz, .loop .done diff --git a/engine/pokemon/mail_2.asm b/engine/pokemon/mail_2.asm index 1cc776706..b5154187a 100644 --- a/engine/pokemon/mail_2.asm +++ b/engine/pokemon/mail_2.asm @@ -59,7 +59,7 @@ ReadAnyMail: .pressed_start ld a, [wJumptableIndex] push af - callfar PrintMail ; printer + callfar PrintMailAndExit ; printer pop af ld [wJumptableIndex], a jr .loop diff --git a/engine/pokemon/mon_menu.asm b/engine/pokemon/mon_menu.asm index 2d14bd603..985546845 100644 --- a/engine/pokemon/mon_menu.asm +++ b/engine/pokemon/mon_menu.asm @@ -1,290 +1,1305 @@ -INCLUDE "data/mon_menu.asm" - -MonSubmenu: - xor a - ld [hBGMapMode], a - call GetMonSubmenuItems - farcall FreezeMonIcons - ld hl, .MenuHeader - call LoadMenuHeader - call .GetTopCoord - call PopulateMonMenu - - ld a, 1 - ld [hBGMapMode], a - call MonMenuLoop - ld [wMenuSelection], a +HasNoItems: + ld a, [wNumItems] + and a + ret nz + ld a, [wNumKeyItems] + and a + ret nz + ld a, [wNumBalls] + and a + ret nz + ld hl, wTMsHMs + ld b, NUM_TMS + NUM_HMS +.loop + ld a, [hli] + and a + jr nz, .done + dec b + jr nz, .loop + scf + ret +.done + and a + ret +TossItemFromPC: + push de + call PartyMonItemName + farcall _CheckTossableItem + ld a, [wItemAttributeParamBuffer] + and a + jr nz, .key_item + ld hl, .TossHowMany + call MenuTextBox + farcall SelectQuantityToToss + push af + call CloseWindow call ExitMenu + pop af + jr c, .quit + ld hl, .ConfirmToss + call MenuTextBox + call YesNoBox + push af + call ExitMenu + pop af + jr c, .quit + pop hl + ld a, [wCurItemQuantity] + call TossItem + call PartyMonItemName + ld hl, .TossedThisMany + call MenuTextBox + call ExitMenu + and a ret -.MenuHeader: - db MENU_BACKUP_TILES ; flags - menu_coords 6, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 - dw 0 - db 1 ; default option +.key_item + call .CantToss +.quit + pop hl + scf + ret -.GetTopCoord: -; TopCoord = 1 + BottomCoord - 2 * (NumSubmenuItems + 1) - ld a, [wBuffer1] - inc a - add a - ld b, a - ld a, [wMenuBorderBottomCoord] - sub b - inc a - ld [wMenuBorderTopCoord], a - call MenuBox +.TossHowMany: + ; Toss out how many @ (S)? + text_jump UnknownText_0x1c1a90 + db "@" + +.ConfirmToss: + ; Throw away @ @ (S)? + text_jump UnknownText_0x1c1aad + db "@" + +.TossedThisMany: + ; Discarded @ (S). + text_jump UnknownText_0x1c1aca + db "@" + +.CantToss: + ld hl, .TooImportantToToss + call MenuTextBoxBackup ret -MonMenuLoop: -.loop - ld a, MENU_UNUSED_3 | MENU_BACKUP_TILES_2 ; flags - ld [wMenuDataFlags], a - ld a, [wBuffer1] ; items - ld [wMenuDataItems], a - call InitVerticalMenuCursor - ld hl, w2DMenuFlags1 - set 6, [hl] - call StaticMenuJoypad - ld de, SFX_READ_TEXT_2 - call PlaySFX - ld a, [hJoyPressed] - bit A_BUTTON_F, a - jr nz, .select - bit B_BUTTON_F, a - jr nz, .cancel - jr .loop +.TooImportantToToss: + ; That's too impor- tant to toss out! + text_jump UnknownText_0x1c1adf + db "@" -.cancel - ld a, MONMENUITEM_CANCEL +CantUseItem: + ld hl, CantUseItemText + call MenuTextBoxWaitButton ret -.select - ld a, [wMenuCursorY] - dec a - ld c, a - ld b, 0 - ld hl, wBuffer2 - add hl, bc - ld a, [hl] +CantUseItemText: + text_jump UnknownText_0x1c1b03 + db "@" + +PartyMonItemName: + ld a, [wCurItem] + ld [wNamedObjectIndexBuffer], a + call GetItemName + call CopyName1 ret -PopulateMonMenu: - call MenuBoxCoord2Tile - ld bc, 2 * SCREEN_WIDTH + 2 - add hl, bc - ld de, wBuffer2 -.loop - ld a, [de] - inc de - cp -1 - ret z - push de - push hl - call GetMonMenuString - pop hl - call PlaceString - ld bc, 2 * SCREEN_WIDTH - add hl, bc - pop de - jr .loop +CancelPokemonAction: + farcall InitPartyMenuWithCancel + farcall UnfreezeMonIcons + ld a, 1 + ret -GetMonMenuString: - ld hl, MonMenuOptions + 1 +PokemonActionSubmenu: + hlcoord 1, 15 + lb bc, 2, 18 + call ClearBox + farcall MonSubmenu + call GetCurNick + ld a, [wMenuSelection] + ld hl, .Actions ld de, 3 call IsInArray - dec hl - ld a, [hli] - cp MONMENU_MENUOPTION - jr z, .NotMove + jr nc, .nothing + inc hl - ld a, [hl] - ld [wd265], a - call GetMoveName + ld a, [hli] + ld h, [hl] + ld l, a + jp hl + +.nothing + ld a, 0 ret -.NotMove: - inc hl - ld a, [hl] +.Actions: + dbw MONMENUITEM_CUT, MonMenu_Cut + dbw MONMENUITEM_FLY, MonMenu_Fly + dbw MONMENUITEM_SURF, MonMenu_Surf + dbw MONMENUITEM_STRENGTH, MonMenu_Strength + dbw MONMENUITEM_FLASH, MonMenu_Flash + dbw MONMENUITEM_WHIRLPOOL, MonMenu_Whirlpool + dbw MONMENUITEM_DIG, MonMenu_Dig + dbw MONMENUITEM_TELEPORT, MonMenu_Teleport + dbw MONMENUITEM_SOFTBOILED, MonMenu_Softboiled_MilkDrink + dbw MONMENUITEM_MILKDRINK, MonMenu_Softboiled_MilkDrink + dbw MONMENUITEM_HEADBUTT, MonMenu_Headbutt + dbw MONMENUITEM_WATERFALL, MonMenu_Waterfall + dbw MONMENUITEM_ROCKSMASH, MonMenu_RockSmash + dbw MONMENUITEM_SWEETSCENT, MonMenu_SweetScent + dbw MONMENUITEM_STATS, OpenPartyStats + dbw MONMENUITEM_SWITCH, SwitchPartyMons + dbw MONMENUITEM_ITEM, GiveTakePartyMonItem + dbw MONMENUITEM_CANCEL, CancelPokemonAction + dbw MONMENUITEM_MOVE, ManagePokemonMoves + dbw MONMENUITEM_MAIL, MonMailAction + +SwitchPartyMons: +; Don't try if there's nothing to switch! + ld a, [wPartyCount] + cp 2 + jr c, .DontSwitch + + ld a, [wCurPartyMon] + inc a + ld [wSwitchMon], a + + farcall HoldSwitchmonIcon + farcall InitPartyMenuNoCancel + + ld a, PARTYMENUACTION_MOVE + ld [wPartyMenuActionText], a + farcall WritePartyMenuTilemap + farcall PrintPartyMenuText + + hlcoord 0, 1 + ld bc, SCREEN_WIDTH * 2 + ld a, [wSwitchMon] dec a - ld hl, MonMenuOptionStrings - call GetNthString - ld d, h - ld e, l + call AddNTimes + ld [hl], "▷" + call WaitBGMap + call SetPalettes + call DelayFrame + + farcall PartyMenuSelect + bit 1, b + jr c, .DontSwitch + + farcall _SwitchPartyMons + + xor a + ld [wPartyMenuActionText], a + + farcall LoadPartyMenuGFX + farcall InitPartyMenuWithCancel + farcall InitPartyMenuGFX + + ld a, 1 + ret + +.DontSwitch: + xor a + ld [wPartyMenuActionText], a + call CancelPokemonAction ret -GetMonSubmenuItems: - call ResetMonSubmenu +GiveTakePartyMonItem: +; Eggs can't hold items! ld a, [wCurPartySpecies] cp EGG - jr z, .egg - ld a, [wLinkMode] - and a - jr nz, .skip_moves - ld a, MON_MOVES - call GetPartyParamLocation - ld d, h - ld e, l - ld c, NUM_MOVES + jr z, .cancel + + ld hl, GiveTakeItemMenuData + call LoadMenuHeader + call VerticalMenu + call ExitMenu + jr c, .cancel + + call GetCurNick + ld hl, wStringBuffer1 + ld de, wMonOrItemNameBuffer + ld bc, MON_NAME_LENGTH + call CopyBytes + ld a, [wMenuCursorY] + cp 1 + jr nz, .take + + call LoadStandardMenuHeader + call ClearPalettes + call .GiveItem + call ClearPalettes + call LoadFontsBattleExtra + call ExitMenu + ld a, 0 + ret + +.take + call TakePartyItem + ld a, 3 + ret + +.cancel + ld a, 3 + ret + +.GiveItem: + farcall DepositSellInitPackBuffers + .loop - push bc - push de - ld a, [de] + farcall DepositSellPack + + ld a, [wcf66] and a + jr z, .quit + + ld a, [wcf65] + cp 2 jr z, .next - push hl - call IsFieldMove - pop hl - jr nc, .next - call AddMonMenuItem + + call CheckTossableItem + ld a, [wItemAttributeParamBuffer] + and a + jr nz, .next + + call TryGiveItemToPartymon + jr .quit .next - pop de - inc de - pop bc - dec c - jr nz, .loop + ld hl, CantBeHeldText + call MenuTextBoxBackup + jr .loop -.skip_moves - ld a, MONMENUITEM_STATS - call AddMonMenuItem - ld a, MONMENUITEM_SWITCH - call AddMonMenuItem - ld a, MONMENUITEM_MOVE - call AddMonMenuItem - ld a, [wLinkMode] +.quit + ret + +TryGiveItemToPartymon: + call SpeechTextBox + call PartyMonItemName + call GetPartyItemLocation + ld a, [hl] and a - jr nz, .skip2 + jr z, .give_item_to_mon + push hl - ld a, MON_ITEM - call GetPartyParamLocation - ld d, [hl] + ld d, a farcall ItemIsMail pop hl - ld a, MONMENUITEM_MAIL - jr c, .ok - ld a, MONMENUITEM_ITEM + jr c, .please_remove_mail + ld a, [hl] + jr .already_holding_item + +.give_item_to_mon + call GiveItemToPokemon + ld hl, MadeHoldText + call MenuTextBoxBackup + call GivePartyItem + ret -.ok - call AddMonMenuItem +.please_remove_mail + ld hl, PleaseRemoveMailText + call MenuTextBoxBackup + ret -.skip2 - ld a, [wBuffer1] - cp NUM_MONMENU_ITEMS - jr z, .ok2 - ld a, MONMENUITEM_CANCEL - call AddMonMenuItem +.already_holding_item + ld [wNamedObjectIndexBuffer], a + call GetItemName + ld hl, SwitchAlreadyHoldingText + call StartMenuYesNo + jr c, .abort -.ok2 - call TerminateMonSubmenu + call GiveItemToPokemon + ld a, [wNamedObjectIndexBuffer] + push af + ld a, [wCurItem] + ld [wNamedObjectIndexBuffer], a + pop af + ld [wCurItem], a + call ReceiveItemFromPokemon + jr nc, .bag_full + + ld hl, TookAndMadeHoldText + call MenuTextBoxBackup + ld a, [wNamedObjectIndexBuffer] + ld [wCurItem], a + call GivePartyItem ret -.egg - ld a, MONMENUITEM_STATS - call AddMonMenuItem - ld a, MONMENUITEM_SWITCH - call AddMonMenuItem - ld a, MONMENUITEM_CANCEL - call AddMonMenuItem - call TerminateMonSubmenu +.bag_full + ld a, [wNamedObjectIndexBuffer] + ld [wCurItem], a + call ReceiveItemFromPokemon + ld hl, ItemStorageIsFullText + call MenuTextBoxBackup + +.abort ret -IsFieldMove: +GivePartyItem: + call GetPartyItemLocation + ld a, [wCurItem] + ld [hl], a + ld d, a + farcall ItemIsMail + jr nc, .done + call ComposeMailMessage + +.done + ret + +TakePartyItem: + call SpeechTextBox + call GetPartyItemLocation + ld a, [hl] + and a + jr z, .asm_12c8c + + ld [wCurItem], a + call ReceiveItemFromPokemon + jr nc, .asm_12c94 + + farcall ItemIsMail + call GetPartyItemLocation + ld a, [hl] + ld [wNamedObjectIndexBuffer], a + ld [hl], NO_ITEM + call GetItemName + ld hl, TookFromText + call MenuTextBoxBackup + jr .asm_12c9a + +.asm_12c8c + ld hl, IsntHoldingAnythingText + call MenuTextBoxBackup + jr .asm_12c9a + +.asm_12c94 + ld hl, ItemStorageIsFullText + call MenuTextBoxBackup + +.asm_12c9a + ret + +GiveTakeItemMenuData: + db MENU_SPRITE_ANIMS | MENU_BACKUP_TILES ; flags + menu_coords 12, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 + dw .Items + db 1 ; default option + +.Items: + db STATICMENU_CURSOR ; flags + db 2 ; # items + db "GIVE@" + db "TAKE@" + +TookAndMadeHoldText: + text_jump UnknownText_0x1c1b2c + db "@" + +MadeHoldText: + text_jump UnknownText_0x1c1b57 + db "@" + +PleaseRemoveMailText: + text_jump UnknownText_0x1c1b6f + db "@" + +IsntHoldingAnythingText: + text_jump UnknownText_0x1c1b8e + db "@" + +ItemStorageIsFullText: + text_jump UnknownText_0x1c1baa + db "@" + +TookFromText: + text_jump UnknownText_0x1c1bc4 + db "@" + +SwitchAlreadyHoldingText: + text_jump UnknownText_0x1c1bdc + db "@" + +CantBeHeldText: + text_jump UnknownText_0x1c1c09 + db "@" + +GetPartyItemLocation: + push af + ld a, MON_ITEM + call GetPartyParamLocation + pop af + ret + +ReceiveItemFromPokemon: + ld a, 1 + ld [wItemQuantityChangeBuffer], a + ld hl, wNumItems + jp ReceiveItem + +GiveItemToPokemon: + ld a, 1 + ld [wItemQuantityChangeBuffer], a + ld hl, wNumItems + jp TossItem + +StartMenuYesNo: + call MenuTextBox + call YesNoBox + jp ExitMenu + +ComposeMailMessage: + ld de, wTempMailMessage + farcall _ComposeMailMessage + ld hl, wPlayerName + ld de, wTempMailAuthor + ld bc, NAME_LENGTH - 1 + call CopyBytes + ld hl, wPlayerID + ld bc, 2 + call CopyBytes + ld a, [wCurPartySpecies] + ld [de], a + inc de + ld a, [wCurItem] + ld [de], a + ld a, [wCurPartyMon] + ld hl, sPartyMail + ld bc, MAIL_STRUCT_LENGTH + call AddNTimes + ld d, h + ld e, l + ld hl, wTempMail + ld bc, MAIL_STRUCT_LENGTH + ld a, BANK(sPartyMail) + call GetSRAMBank + call CopyBytes + call CloseSRAM + ret + +MonMailAction: +; If in the time capsule or trade center, +; selecting the mail only allows you to +; read the mail. + ld a, [wLinkMode] + cp LINK_TIMECAPSULE + jr z, .read + cp LINK_TRADECENTER + jr z, .read + +; Show the READ/TAKE/QUIT menu. + ld hl, .MenuHeader + call LoadMenuHeader + call VerticalMenu + call ExitMenu + +; Interpret the menu. + jp c, .done + ld a, [wMenuCursorY] + cp $1 + jr z, .read + cp $2 + jr z, .take + jp .done + +.read + farcall ReadPartyMonMail + ld a, $0 + ret + +.take + ld hl, .sendmailtopctext + call StartMenuYesNo + jr c, .RemoveMailToBag + ld a, [wCurPartyMon] ld b, a - ld hl, MonMenuOptions -.next - ld a, [hli] - cp -1 - jr z, .nope - cp MONMENU_MENUOPTION - jr z, .nope - ld d, [hl] - inc hl + farcall SendMailToPC + jr c, .MailboxFull + ld hl, .sentmailtopctext + call MenuTextBoxBackup + jr .done + +.MailboxFull: + ld hl, .mailboxfulltext + call MenuTextBoxBackup + jr .done + +.RemoveMailToBag: + ld hl, .mailwilllosemessagetext + call StartMenuYesNo + jr c, .done + call GetPartyItemLocation + ld a, [hl] + ld [wCurItem], a + call ReceiveItemFromPokemon + jr nc, .BagIsFull + call GetPartyItemLocation + ld [hl], $0 + call GetCurNick + ld hl, .tookmailfrommontext + call MenuTextBoxBackup + jr .done + +.BagIsFull: + ld hl, .bagfulltext + call MenuTextBoxBackup + jr .done + +.done + ld a, $3 + ret + +.MenuHeader: + db MENU_BACKUP_TILES ; flags + menu_coords 12, 10, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 + dw .MenuData + db 1 ; default option + +.MenuData: + db STATICMENU_CURSOR ; flags + db 3 ; items + db "READ@" + db "TAKE@" + db "QUIT@" + +.mailwilllosemessagetext +; The MAIL will lose its message. OK? + text_jump UnknownText_0x1c1c22 + db "@" + +.tookmailfrommontext +; MAIL detached from <POKEMON>. + text_jump UnknownText_0x1c1c47 + db "@" + +.bagfulltext +; There's no space for removing MAIL. + text_jump UnknownText_0x1c1c62 + db "@" + +.sendmailtopctext +; Send the removed MAIL to your PC? + text_jump UnknownText_0x1c1c86 + db "@" + +.mailboxfulltext +; Your PC's MAILBOX is full. + text_jump UnknownText_0x1c1ca9 + db "@" + +.sentmailtopctext +; The MAIL was sent to your PC. + text_jump UnknownText_0x1c1cc4 + db "@" + +OpenPartyStats: + call LoadStandardMenuHeader + call ClearSprites +; PartyMon + xor a + ld [wMonType], a + call LowVolume + predef StatsScreenInit + call MaxVolume + call Call_ExitMenu + ld a, 0 + ret + +MonMenu_Cut: + farcall CutFunction + ld a, [wFieldMoveSucceeded] + cp $1 + jr nz, .Fail + ld b, $4 + ld a, $2 + ret + +.Fail: + ld a, $3 + ret + +MonMenu_Fly: + farcall FlyFunction + ld a, [wFieldMoveSucceeded] + cp $2 + jr z, .Fail + cp $0 + jr z, .Error + farcall StubbedTrainerRankings_Fly + ld b, $4 + ld a, $2 + ret + +.Fail: + ld a, $3 + ret + +.Error: + ld a, $0 + ret + +.Unreferenced: + ld a, $1 + ret + +MonMenu_Flash: + farcall OWFlash + ld a, [wFieldMoveSucceeded] + cp $1 + jr nz, .Fail + ld b, $4 + ld a, $2 + ret + +.Fail: + ld a, $3 + ret + +MonMenu_Strength: + farcall StrengthFunction + ld a, [wFieldMoveSucceeded] + cp $1 + jr nz, .Fail + ld b, $4 + ld a, $2 + ret + +.Fail: + ld a, $3 + ret + +MonMenu_Whirlpool: + farcall WhirlpoolFunction + ld a, [wFieldMoveSucceeded] + cp $1 + jr nz, .Fail + ld b, $4 + ld a, $2 + ret + +.Fail: + ld a, $3 + ret + +MonMenu_Waterfall: + farcall WaterfallFunction + ld a, [wFieldMoveSucceeded] + cp $1 + jr nz, .Fail + ld b, $4 + ld a, $2 + ret + +.Fail: + ld a, $3 + ret + +MonMenu_Teleport: + farcall TeleportFunction + ld a, [wFieldMoveSucceeded] + and a + jr z, .Fail + ld b, $4 + ld a, $2 + ret + +.Fail: + ld a, $3 + ret + +MonMenu_Surf: + farcall SurfFunction + ld a, [wFieldMoveSucceeded] + and a + jr z, .Fail + ld b, $4 + ld a, $2 + ret + +.Fail: + ld a, $3 + ret + +MonMenu_Dig: + farcall DigFunction + ld a, [wFieldMoveSucceeded] + cp $1 + jr nz, .Fail + ld b, $4 + ld a, $2 + ret + +.Fail: + ld a, $3 + ret + +MonMenu_Softboiled_MilkDrink: + call .CheckMonHasEnoughHP + jr nc, .NotEnoughHP + farcall Softboiled_MilkDrinkFunction + jr .finish + +.NotEnoughHP: + ld hl, .Text_NotEnoughHP + call PrintText + +.finish + xor a + ld [wPartyMenuActionText], a + ld a, $3 + ret + +.Text_NotEnoughHP: + ; Not enough HP! + text_jump UnknownText_0x1c1ce3 + db "@" + +.CheckMonHasEnoughHP: +; Need to have at least (MaxHP / 5) HP left. + ld a, MON_MAXHP + call GetPartyParamLocation ld a, [hli] - cp b - jr nz, .next - ld a, d - scf + ld [hDividend + 0], a + ld a, [hl] + ld [hDividend + 1], a + ld a, 5 + ld [hDivisor], a + ld b, 2 + call Divide + ld a, MON_HP + 1 + call GetPartyParamLocation + ld a, [hQuotient + 2] + sub [hl] + dec hl + ld a, [hQuotient + 1] + sbc [hl] + ret + +MonMenu_Headbutt: + farcall HeadbuttFunction + ld a, [wFieldMoveSucceeded] + cp $1 + jr nz, .Fail + ld b, $4 + ld a, $2 + ret -.nope +.Fail: + ld a, $3 ret -ResetMonSubmenu: +MonMenu_RockSmash: + farcall RockSmashFunction + ld a, [wFieldMoveSucceeded] + cp $1 + jr nz, .Fail + ld b, $4 + ld a, $2 + ret + +.Fail: + ld a, $3 + ret + +MonMenu_SweetScent: + farcall SweetScentFromMenu + ld b, $4 + ld a, $2 + ret + +ChooseMoveToDelete: + ld hl, wOptions + ld a, [hl] + push af + set NO_TEXT_SCROLL, [hl] + call LoadFontsBattleExtra + call .ChooseMoveToDelete + pop bc + ld a, b + ld [wOptions], a + push af + call ClearBGPalettes + pop af + ret + +.ChooseMoveToDelete + call SetUpMoveScreenBG + ld de, DeleteMoveScreenAttrs + call SetMenuAttributes + call SetUpMoveList + ld hl, w2DMenuFlags1 + set 6, [hl] + jr .enter_loop + +.loop + call ScrollingMenuJoypad + bit B_BUTTON_F, a + jp nz, .b_button + bit A_BUTTON_F, a + jp nz, .a_button + +.enter_loop + call PrepareToPlaceMoveData + call PlaceMoveData + jp .loop + +.a_button + and a + jr .finish + +.b_button + scf + +.finish + push af xor a - ld [wBuffer1], a - ld hl, wBuffer2 - ld bc, NUM_MONMENU_ITEMS + 1 - call ByteFill + ld [wSwitchMon], a + ld hl, w2DMenuFlags1 + res 6, [hl] + call ClearSprites + call ClearTileMap + pop af ret -TerminateMonSubmenu: - ld a, [wBuffer1] - ld e, a - ld d, 0 - ld hl, wBuffer2 - add hl, de - ld [hl], -1 +DeleteMoveScreenAttrs: + db 3, 1 + db 3, 1 + db $40, $00 + dn 2, 0 + db D_UP | D_DOWN | A_BUTTON | B_BUTTON + +ManagePokemonMoves: + ld a, [wCurPartySpecies] + cp EGG + jr z, .egg + ld hl, wOptions + ld a, [hl] + push af + set NO_TEXT_SCROLL, [hl] + call MoveScreenLoop + pop af + ld [wOptions], a + call ClearBGPalettes + +.egg + ld a, $0 ret -AddMonMenuItem: +MoveScreenLoop: + ld a, [wCurPartyMon] + inc a + ld [wPartyMenuCursor], a + call SetUpMoveScreenBG + call Function132d3 + ld de, MoveScreenAttributes + call SetMenuAttributes +.loop + call SetUpMoveList + ld hl, w2DMenuFlags1 + set 6, [hl] + jr .skip_joy + +.joy_loop + call ScrollingMenuJoypad + bit 1, a + jp nz, .b_button + bit 0, a + jp nz, .a_button + bit 4, a + jp nz, .d_right + bit 5, a + jp nz, .d_left + +.skip_joy + call PrepareToPlaceMoveData + ld a, [wMoveSwapBuffer] + and a + jr nz, .moving_move + call PlaceMoveData + jp .joy_loop + +.moving_move + ld a, " " + hlcoord 1, 11 + ld bc, 5 + call ByteFill + hlcoord 1, 12 + lb bc, 5, SCREEN_WIDTH - 2 + call ClearBox + hlcoord 1, 12 + ld de, String_MoveWhere + call PlaceString + jp .joy_loop +.b_button + call PlayClickSFX + call WaitSFX + ld a, [wMoveSwapBuffer] + and a + jp z, .exit + + ld a, [wMoveSwapBuffer] + ld [wMenuCursorY], a + xor a + ld [wMoveSwapBuffer], a + hlcoord 1, 2 + lb bc, 8, SCREEN_WIDTH - 2 + call ClearBox + jp .loop + +.d_right + ld a, [wMoveSwapBuffer] + and a + jp nz, .joy_loop + + ld a, [wCurPartyMon] + ld b, a + push bc + call .cycle_right + pop bc + ld a, [wCurPartyMon] + cp b + jp z, .joy_loop + jp MoveScreenLoop + +.d_left + ld a, [wMoveSwapBuffer] + and a + jp nz, .joy_loop + ld a, [wCurPartyMon] + ld b, a + push bc + call .cycle_left + pop bc + ld a, [wCurPartyMon] + cp b + jp z, .joy_loop + jp MoveScreenLoop + +.cycle_right + ld a, [wCurPartyMon] + inc a + ld [wCurPartyMon], a + ld c, a + ld b, 0 + ld hl, wPartySpecies + add hl, bc + ld a, [hl] + cp -1 + jr z, .cycle_left + cp EGG + ret nz + jr .cycle_right + +.cycle_left + ld a, [wCurPartyMon] + and a + ret z +.cycle_left_loop + ld a, [wCurPartyMon] + dec a + ld [wCurPartyMon], a + ld c, a + ld b, 0 + ld hl, wPartySpecies + add hl, bc + ld a, [hl] + cp EGG + ret nz + ld a, [wCurPartyMon] + and a + jr z, .cycle_right + jr .cycle_left_loop + +.a_button + call PlayClickSFX + call WaitSFX + ld a, [wMoveSwapBuffer] + and a + jr nz, .place_move + ld a, [wMenuCursorY] + ld [wMoveSwapBuffer], a + call PlaceHollowCursor + jp .moving_move + +.place_move + ld hl, wPartyMon1Moves + ld bc, PARTYMON_STRUCT_LENGTH + ld a, [wCurPartyMon] + call AddNTimes push hl - push de - push af - ld a, [wBuffer1] + call .copy_move + pop hl + ld bc, $15 + add hl, bc + call .copy_move + ld a, [wBattleMode] + jr z, .swap_moves + ld hl, wBattleMonMoves + ld bc, $20 + ld a, [wCurPartyMon] + call AddNTimes + push hl + call .copy_move + pop hl + ld bc, 6 + add hl, bc + call .copy_move + +.swap_moves + ld de, SFX_SWITCH_POKEMON + call PlaySFX + call WaitSFX + ld de, SFX_SWITCH_POKEMON + call PlaySFX + call WaitSFX + hlcoord 1, 2 + lb bc, 8, 18 + call ClearBox + hlcoord 10, 10 + lb bc, 1, 9 + call ClearBox + jp .loop + +.copy_move + push hl + ld a, [wMenuCursorY] + dec a + ld c, a + ld b, $0 + add hl, bc + ld d, h + ld e, l + pop hl + ld a, [wMoveSwapBuffer] + dec a + ld c, a + ld b, $0 + add hl, bc + ld a, [de] + ld b, [hl] + ld [hl], a + ld a, b + ld [de], a + ret + +.exit + xor a + ld [wMoveSwapBuffer], a + ld hl, w2DMenuFlags1 + res 6, [hl] + call ClearSprites + jp ClearTileMap + +MoveScreenAttributes: + db 3, 1 + db 3, 1 + db $40, $00 + dn 2, 0 + db D_UP | D_DOWN | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON + +String_MoveWhere: + db "Where?@" + +SetUpMoveScreenBG: + call ClearBGPalettes + call ClearTileMap + call ClearSprites + xor a + ld [hBGMapMode], a + farcall LoadStatsScreenPageTilesGFX + farcall ClearSpriteAnims2 + ld a, [wCurPartyMon] ld e, a - inc a - ld [wBuffer1], a - ld d, 0 - ld hl, wBuffer2 + ld d, $0 + ld hl, wPartySpecies add hl, de - pop af - ld [hl], a - pop de + ld a, [hl] + ld [wTempIconSpecies], a + ld e, MONICON_MOVES + farcall LoadMenuMonIcon + hlcoord 0, 1 + ld b, 9 + ld c, 18 + call TextBox + hlcoord 0, 11 + ld b, 5 + ld c, 18 + call TextBox + hlcoord 2, 0 + lb bc, 2, 3 + call ClearBox + xor a + ld [wMonType], a + ld hl, wPartyMonNicknames + ld a, [wCurPartyMon] + call GetNick + hlcoord 5, 1 + call PlaceString + push bc + farcall CopyMonToTempMon pop hl - ret + call PrintLevel + ld hl, wPlayerHPPal + call SetHPPal + ld b, SCGB_MOVE_LIST + call GetSGBLayout + hlcoord 16, 0 + lb bc, 1, 3 + jp ClearBox -BattleMonMenu: - ld hl, MenuHeader_0x24ed4 - call CopyMenuHeader +SetUpMoveList: xor a ld [hBGMapMode], a - call MenuBox - call UpdateSprites - call PlaceVerticalMenuItems + ld [wMoveSwapBuffer], a + ld [wMonType], a + predef CopyMonToTempMon + ld hl, wTempMonMoves + ld de, wListMoves_MoveIndicesBuffer + ld bc, NUM_MOVES + call CopyBytes + ld a, SCREEN_WIDTH * 2 + ld [wBuffer1], a + hlcoord 2, 3 + predef ListMoves + hlcoord 10, 4 + predef ListMovePP call WaitBGMap - call CopyMenuData - ld a, [wMenuDataFlags] - bit 7, a - jr z, .set_carry - call InitVerticalMenuCursor - ld hl, w2DMenuFlags1 - set 6, [hl] - call StaticMenuJoypad - ld de, SFX_READ_TEXT_2 - call PlaySFX - ld a, [hJoyPressed] - bit B_BUTTON_F, a - jr z, .clear_carry - ret z + call SetPalettes + ld a, [wNumMoves] + inc a + ld [w2DMenuNumRows], a + hlcoord 0, 11 + ld b, 5 + ld c, 18 + jp TextBox -.set_carry - scf +PrepareToPlaceMoveData: + ld hl, wPartyMon1Moves + ld bc, PARTYMON_STRUCT_LENGTH + ld a, [wCurPartyMon] + call AddNTimes + ld a, [wMenuCursorY] + dec a + ld c, a + ld b, $0 + add hl, bc + ld a, [hl] + ld [wCurSpecies], a + hlcoord 1, 12 + lb bc, 5, 18 + jp ClearBox + +PlaceMoveData: + xor a + ld [hBGMapMode], a + hlcoord 0, 10 + ld de, String_MoveType_Top + call PlaceString + hlcoord 0, 11 + ld de, String_MoveType_Bottom + call PlaceString + hlcoord 12, 12 + ld de, String_MoveAtk + call PlaceString + ld a, [wCurSpecies] + ld b, a + hlcoord 2, 12 + predef PrintMoveType + ld a, [wCurSpecies] + dec a + ld hl, Moves + MOVE_POWER + ld bc, MOVE_LENGTH + call AddNTimes + ld a, BANK(Moves) + call GetFarByte + hlcoord 16, 12 + cp 2 + jr c, .no_power + ld [wDeciramBuffer], a + ld de, wDeciramBuffer + lb bc, 1, 3 + call PrintNum + jr .description + +.no_power + ld de, String_MoveNoPower + call PlaceString + +.description + hlcoord 1, 14 + predef PrintMoveDesc + ld a, $1 + ld [hBGMapMode], a ret -.clear_carry +String_MoveType_Top: + db "┌─────┐@" +String_MoveType_Bottom: + db "│TYPE/└@" +String_MoveAtk: + db "ATK/@" +String_MoveNoPower: + db "---@" + +Function132d3: + call Function132da + call Function132fe + ret + +Function132da: + ld a, [wCurPartyMon] + and a + ret z + ld c, a + ld e, a + ld d, 0 + ld hl, wPartyCount + add hl, de +.loop + ld a, [hl] and a + jr z, .prev + cp EGG + jr z, .prev + cp NUM_POKEMON + 1 + jr c, .legal + +.prev + dec hl + dec c + jr nz, .loop ret -MenuHeader_0x24ed4: - db 0 ; flags - menu_coords 11, 11, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 - dw MenuData_0x24edc - db 1 ; default option +.legal + hlcoord 16, 0 + ld [hl], "◀" + ret -MenuData_0x24edc: - db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags - db 3 ; items - db "SWITCH@" - db "STATS@" - db "CANCEL@" +Function132fe: + ld a, [wCurPartyMon] + inc a + ld c, a + ld a, [wPartyCount] + cp c + ret z + ld e, c + ld d, 0 + ld hl, wPartySpecies + add hl, de +.loop + ld a, [hl] + cp -1 + ret z + and a + jr z, .next + cp EGG + jr z, .next + cp NUM_POKEMON + 1 + jr c, .legal + +.next + inc hl + jr .loop + +.legal + hlcoord 18, 0 + ld [hl], "▶" + ret diff --git a/engine/pokemon/mon_stats.asm b/engine/pokemon/mon_stats.asm index 76f09b461..74e3d2a95 100644 --- a/engine/pokemon/mon_stats.asm +++ b/engine/pokemon/mon_stats.asm @@ -295,7 +295,7 @@ ListMovePP: call PrintNum ld a, "/" ld [hli], a - ld de, wd265 + ld de, wTempPP lb bc, 1, 2 call PrintNum pop hl diff --git a/engine/pokemon/mon_submenu.asm b/engine/pokemon/mon_submenu.asm new file mode 100644 index 000000000..926c35f5d --- /dev/null +++ b/engine/pokemon/mon_submenu.asm @@ -0,0 +1,290 @@ +INCLUDE "data/mon_menu.asm" + +MonSubmenu: + xor a + ld [hBGMapMode], a + call GetMonSubmenuItems + farcall FreezeMonIcons + ld hl, .MenuHeader + call LoadMenuHeader + call .GetTopCoord + call PopulateMonMenu + + ld a, 1 + ld [hBGMapMode], a + call MonMenuLoop + ld [wMenuSelection], a + + call ExitMenu + ret + +.MenuHeader: + db MENU_BACKUP_TILES ; flags + menu_coords 6, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 + dw 0 + db 1 ; default option + +.GetTopCoord: +; TopCoord = 1 + BottomCoord - 2 * (NumSubmenuItems + 1) + ld a, [wBuffer1] + inc a + add a + ld b, a + ld a, [wMenuBorderBottomCoord] + sub b + inc a + ld [wMenuBorderTopCoord], a + call MenuBox + ret + +MonMenuLoop: +.loop + ld a, MENU_UNUSED_3 | MENU_BACKUP_TILES_2 ; flags + ld [wMenuDataFlags], a + ld a, [wBuffer1] ; items + ld [wMenuDataItems], a + call InitVerticalMenuCursor + ld hl, w2DMenuFlags1 + set 6, [hl] + call StaticMenuJoypad + ld de, SFX_READ_TEXT_2 + call PlaySFX + ld a, [hJoyPressed] + bit A_BUTTON_F, a + jr nz, .select + bit B_BUTTON_F, a + jr nz, .cancel + jr .loop + +.cancel + ld a, MONMENUITEM_CANCEL + ret + +.select + ld a, [wMenuCursorY] + dec a + ld c, a + ld b, 0 + ld hl, wBuffer2 + add hl, bc + ld a, [hl] + ret + +PopulateMonMenu: + call MenuBoxCoord2Tile + ld bc, 2 * SCREEN_WIDTH + 2 + add hl, bc + ld de, wBuffer2 +.loop + ld a, [de] + inc de + cp -1 + ret z + push de + push hl + call GetMonMenuString + pop hl + call PlaceString + ld bc, 2 * SCREEN_WIDTH + add hl, bc + pop de + jr .loop + +GetMonMenuString: + ld hl, MonMenuOptions + 1 + ld de, 3 + call IsInArray + dec hl + ld a, [hli] + cp MONMENU_MENUOPTION + jr z, .NotMove + inc hl + ld a, [hl] + ld [wNamedObjectIndexBuffer], a + call GetMoveName + ret + +.NotMove: + inc hl + ld a, [hl] + dec a + ld hl, MonMenuOptionStrings + call GetNthString + ld d, h + ld e, l + ret + +GetMonSubmenuItems: + call ResetMonSubmenu + ld a, [wCurPartySpecies] + cp EGG + jr z, .egg + ld a, [wLinkMode] + and a + jr nz, .skip_moves + ld a, MON_MOVES + call GetPartyParamLocation + ld d, h + ld e, l + ld c, NUM_MOVES +.loop + push bc + push de + ld a, [de] + and a + jr z, .next + push hl + call IsFieldMove + pop hl + jr nc, .next + call AddMonMenuItem + +.next + pop de + inc de + pop bc + dec c + jr nz, .loop + +.skip_moves + ld a, MONMENUITEM_STATS + call AddMonMenuItem + ld a, MONMENUITEM_SWITCH + call AddMonMenuItem + ld a, MONMENUITEM_MOVE + call AddMonMenuItem + ld a, [wLinkMode] + and a + jr nz, .skip2 + push hl + ld a, MON_ITEM + call GetPartyParamLocation + ld d, [hl] + farcall ItemIsMail + pop hl + ld a, MONMENUITEM_MAIL + jr c, .ok + ld a, MONMENUITEM_ITEM + +.ok + call AddMonMenuItem + +.skip2 + ld a, [wBuffer1] + cp NUM_MONMENU_ITEMS + jr z, .ok2 + ld a, MONMENUITEM_CANCEL + call AddMonMenuItem + +.ok2 + call TerminateMonSubmenu + ret + +.egg + ld a, MONMENUITEM_STATS + call AddMonMenuItem + ld a, MONMENUITEM_SWITCH + call AddMonMenuItem + ld a, MONMENUITEM_CANCEL + call AddMonMenuItem + call TerminateMonSubmenu + ret + +IsFieldMove: + ld b, a + ld hl, MonMenuOptions +.next + ld a, [hli] + cp -1 + jr z, .nope + cp MONMENU_MENUOPTION + jr z, .nope + ld d, [hl] + inc hl + ld a, [hli] + cp b + jr nz, .next + ld a, d + scf + +.nope + ret + +ResetMonSubmenu: + xor a + ld [wBuffer1], a + ld hl, wBuffer2 + ld bc, NUM_MONMENU_ITEMS + 1 + call ByteFill + ret + +TerminateMonSubmenu: + ld a, [wBuffer1] + ld e, a + ld d, 0 + ld hl, wBuffer2 + add hl, de + ld [hl], -1 + ret + +AddMonMenuItem: + push hl + push de + push af + ld a, [wBuffer1] + ld e, a + inc a + ld [wBuffer1], a + ld d, 0 + ld hl, wBuffer2 + add hl, de + pop af + ld [hl], a + pop de + pop hl + ret + +BattleMonMenu: + ld hl, MenuHeader_0x24ed4 + call CopyMenuHeader + xor a + ld [hBGMapMode], a + call MenuBox + call UpdateSprites + call PlaceVerticalMenuItems + call WaitBGMap + call CopyMenuData + ld a, [wMenuDataFlags] + bit 7, a + jr z, .set_carry + call InitVerticalMenuCursor + ld hl, w2DMenuFlags1 + set 6, [hl] + call StaticMenuJoypad + ld de, SFX_READ_TEXT_2 + call PlaySFX + ld a, [hJoyPressed] + bit B_BUTTON_F, a + jr z, .clear_carry + ret z + +.set_carry + scf + ret + +.clear_carry + and a + ret + +MenuHeader_0x24ed4: + db 0 ; flags + menu_coords 11, 11, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 + dw MenuData_0x24edc + db 1 ; default option + +MenuData_0x24edc: + db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags + db 3 ; items + db "SWITCH@" + db "STATS@" + db "CANCEL@" diff --git a/engine/pokemon/move_mon.asm b/engine/pokemon/move_mon.asm index 7074dafd8..e14a1a03a 100644 --- a/engine/pokemon/move_mon.asm +++ b/engine/pokemon/move_mon.asm @@ -52,7 +52,7 @@ TryAddMonToParty: and a jr nz, .skipnickname ld a, [wCurPartySpecies] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, wPartyMonNicknames ld a, [hMoveMon] @@ -185,11 +185,11 @@ endr .registerpokedex ld a, [wCurPartySpecies] - ld [wd265], a + ld [wTempSpecies], a dec a push de call CheckCaughtMon - ld a, [wd265] + ld a, [wTempSpecies] dec a call SetSeenAndCaughtMon pop de @@ -695,7 +695,7 @@ SendGetMonIntoFromBox: ld a, [sBoxCount] dec a ld b, a - call RestorePPofDepositedPokemon + call RestorePPOfDepositedPokemon .CloseSRAM_And_ClearCarryFlag: call CloseSRAM and a @@ -706,7 +706,7 @@ CloseSRAM_And_SetCarryFlag: scf ret -RestorePPofDepositedPokemon: +RestorePPOfDepositedPokemon: ld a, b ld hl, sBoxMons ld bc, BOXMON_STRUCT_LENGTH @@ -750,7 +750,7 @@ RestorePPofDepositedPokemon: farcall GetMaxPPOfMove pop de pop hl - ld a, [wd265] + ld a, [wTempPP] ld b, a ld a, [de] and %11000000 @@ -970,7 +970,7 @@ SendMonIntoBox: call CopyBytes ld a, [wCurPartySpecies] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld de, sBoxMonNicknames @@ -1057,7 +1057,7 @@ SendMonIntoBox: call CopyBytes ld b, 0 - call RestorePPofDepositedPokemon + call RestorePPOfDepositedPokemon call CloseSRAM scf @@ -1403,7 +1403,7 @@ CalcMonStats: ; hl is the path to the Stat EXP ; de points to where the final stats will be saved - ld c, $0 + ld c, STAT_HP - 1 ; first stat .loop inc c call CalcMonStatC @@ -1414,7 +1414,7 @@ CalcMonStats: ld [de], a inc de ld a, c - cp STAT_SDEF + cp STAT_SDEF ; last stat jr nz, .loop ret @@ -1434,14 +1434,14 @@ CalcMonStatC: push hl ld hl, wBaseStats dec hl ; has to be decreased, because 'c' begins with 1 - ld b, $0 + ld b, 0 add hl, bc ld a, [hl] ld e, a pop hl push hl ld a, c - cp STAT_SDEF + cp STAT_SDEF ; last stat jr nz, .not_spdef dec hl dec hl @@ -1669,7 +1669,7 @@ GivePoke:: .done ld a, [wCurPartySpecies] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a ld [wTempEnemyMonSpecies], a call GetPokemonName ld hl, wStringBuffer1 diff --git a/engine/pokemon/move_mon_wo_mail.asm b/engine/pokemon/move_mon_wo_mail.asm index 1dab879c7..8166d348c 100644 --- a/engine/pokemon/move_mon_wo_mail.asm +++ b/engine/pokemon/move_mon_wo_mail.asm @@ -5,21 +5,21 @@ InsertPokemonIntoBox: call InsertSpeciesIntoBoxOrParty ld a, [sBoxCount] dec a - ld [wd265], a + ld [wNextBoxOrPartyIndex], a ld hl, sBoxMonNicknames ld bc, MON_NAME_LENGTH ld de, wBufferMonNick call InsertDataIntoBoxOrParty ld a, [sBoxCount] dec a - ld [wd265], a + ld [wNextBoxOrPartyIndex], a ld hl, sBoxMonOT ld bc, NAME_LENGTH ld de, wBufferMonOT call InsertDataIntoBoxOrParty ld a, [sBoxCount] dec a - ld [wd265], a + ld [wNextBoxOrPartyIndex], a ld hl, sBoxMons ld bc, BOXMON_STRUCT_LENGTH ld de, wBufferMon @@ -34,7 +34,7 @@ InsertPokemonIntoBox: call CopyBytes ld a, [wCurPartyMon] ld b, a - farcall RestorePPofDepositedPokemon + farcall RestorePPOfDepositedPokemon jp CloseSRAM InsertPokemonIntoParty: @@ -42,21 +42,21 @@ InsertPokemonIntoParty: call InsertSpeciesIntoBoxOrParty ld a, [wPartyCount] dec a - ld [wd265], a + ld [wNextBoxOrPartyIndex], a ld hl, wPartyMonNicknames ld bc, MON_NAME_LENGTH ld de, wBufferMonNick call InsertDataIntoBoxOrParty ld a, [wPartyCount] dec a - ld [wd265], a + ld [wNextBoxOrPartyIndex], a ld hl, wPartyMonOT ld bc, NAME_LENGTH ld de, wBufferMonOT call InsertDataIntoBoxOrParty ld a, [wPartyCount] dec a - ld [wd265], a + ld [wNextBoxOrPartyIndex], a ld hl, wPartyMons ld bc, PARTYMON_STRUCT_LENGTH ld de, wBufferMon @@ -85,7 +85,7 @@ InsertDataIntoBoxOrParty: push de push hl push bc - ld a, [wd265] + ld a, [wNextBoxOrPartyIndex] dec a call AddNTimes push hl @@ -95,7 +95,7 @@ InsertDataIntoBoxOrParty: pop hl .loop push bc - ld a, [wd265] + ld a, [wNextBoxOrPartyIndex] ld b, a ld a, [wCurPartyMon] cp b @@ -116,9 +116,9 @@ InsertDataIntoBoxOrParty: sbc b ld h, a pop de - ld a, [wd265] + ld a, [wNextBoxOrPartyIndex] dec a - ld [wd265], a + ld [wNextBoxOrPartyIndex], a jr .loop .insert diff --git a/engine/pokemon/party_menu.asm b/engine/pokemon/party_menu.asm index c3a70dbdc..814e6be55 100644 --- a/engine/pokemon/party_menu.asm +++ b/engine/pokemon/party_menu.asm @@ -596,7 +596,7 @@ InitPartyMenuGFX: push hl ld hl, LoadMenuMonIcon ld a, BANK(LoadMenuMonIcon) - ld e, $0 + ld e, MONICON_PARTYMENU rst FarCall ld a, [hObjectStructIndexBuffer] inc a diff --git a/engine/pokemon/print_move_description.asm b/engine/pokemon/print_move_description.asm new file mode 100644 index 000000000..c461f2f3d --- /dev/null +++ b/engine/pokemon/print_move_description.asm @@ -0,0 +1,14 @@ +PrintMoveDesc: + push hl + ld hl, MoveDescriptions + ld a, [wCurSpecies] + dec a + ld c, a + ld b, 0 + add hl, bc + add hl, bc + ld a, [hli] + ld e, a + ld d, [hl] + pop hl + jp PlaceString diff --git a/engine/pokemon/stats_screen.asm b/engine/pokemon/stats_screen.asm index dfc704f1a..72f895269 100644 --- a/engine/pokemon/stats_screen.asm +++ b/engine/pokemon/stats_screen.asm @@ -377,7 +377,7 @@ StatsScreen_InitUpperHalf: xor a ld [hBGMapMode], a ld a, [wBaseDexNo] - ld [wd265], a + ld [wDeciramBuffer], a ld [wCurSpecies], a hlcoord 8, 0 ld [hl], "№" @@ -386,7 +386,7 @@ StatsScreen_InitUpperHalf: inc hl hlcoord 10, 0 lb bc, PRINTNUM_LEADINGZEROS | 1, 3 - ld de, wd265 + ld de, wDeciramBuffer call PrintNum hlcoord 14, 0 call PrintLevel @@ -401,7 +401,7 @@ StatsScreen_InitUpperHalf: ld a, "/" ld [hli], a ld a, [wBaseDexNo] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName call PlaceString call StatsScreen_PlaceHorizontalDivider @@ -483,7 +483,7 @@ StatsScreen_PlaceShinyIcon: StatsScreen_LoadGFX: ld a, [wBaseDexNo] - ld [wd265], a + ld [wTempSpecies], a ld [wCurSpecies], a xor a ld [hBGMapMode], a @@ -708,7 +708,7 @@ StatsScreen_LoadGFX: ld b, a farcall TimeCapsule_ReplaceTeruSama ld a, b - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetItemName ret diff --git a/engine/pokemon/switchpartymons.asm b/engine/pokemon/switchpartymons.asm index d612a3472..6d68ec88d 100644 --- a/engine/pokemon/switchpartymons.asm +++ b/engine/pokemon/switchpartymons.asm @@ -1,5 +1,5 @@ _SwitchPartyMons: - ld a, [wd0e3] + ld a, [wSwitchMon] dec a ld [wBuffer3], a ld b, a diff --git a/engine/pokemon/types.asm b/engine/pokemon/types.asm index 4e2ca3e45..abeeda840 100644 --- a/engine/pokemon/types.asm +++ b/engine/pokemon/types.asm @@ -74,9 +74,9 @@ PrintType: jp PlaceString GetTypeName: -; Copy the name of type [wd265] to wStringBuffer1. +; Copy the name of type [wNamedObjectIndexBuffer] to wStringBuffer1. - ld a, [wd265] + ld a, [wNamedObjectIndexBuffer] ld hl, TypeNames ld e, a ld d, 0 diff --git a/engine/printer/print_party.asm b/engine/printer/print_party.asm index eeb694d62..9aca79378 100644 --- a/engine/printer/print_party.asm +++ b/engine/printer/print_party.asm @@ -26,11 +26,11 @@ PrintPage1: hlcoord 2, 11, wPrinterTileMapBuffer lb bc, 5, 18 call ClearBox - ld a, [wd265] + ld a, [wTempSpecies] dec a call CheckCaughtMon push af - ld a, [wd265] + ld a, [wTempSpecies] ld b, a ld c, 1 ; get page 1 farcall GetDexEntryPagePointer @@ -75,11 +75,11 @@ PrintPage2: ld bc, SCREEN_WIDTH ld a, $32 call ByteFill - ld a, [wd265] + ld a, [wTempSpecies] dec a call CheckCaughtMon push af - ld a, [wd265] + ld a, [wTempSpecies] ld b, a ld c, 2 ; get page 2 farcall GetDexEntryPagePointer @@ -170,7 +170,7 @@ PrintPartyMonPage1: lb bc, 2, 3 call PrintNum ld a, [wCurPartySpecies] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a ld [wCurSpecies], a ld hl, wPartyMonNicknames call Function1dc50e @@ -186,7 +186,7 @@ PrintPartyMonPage1: inc hl ld [hl], "." inc hl - ld de, wd265 + ld de, wNamedObjectIndexBuffer lb bc, PRINTNUM_LEADINGZEROS | 1, 3 call PrintNum hlcoord 1, 9 @@ -297,7 +297,7 @@ Function1dc51a: and a jr z, .no_move - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetMoveName jr .got_string diff --git a/engine/printer/printer.asm b/engine/printer/printer.asm index 4dc74c6d2..8477ce88a 100644 --- a/engine/printer/printer.asm +++ b/engine/printer/printer.asm @@ -268,12 +268,12 @@ PrintUnownStamp: ld [wPrinterQueueLength], a ret -PrintMail: - call PrintMail_ +PrintMailAndExit: + call PrintMail call Printer_ExitPrinter ret -PrintMail_: +PrintMail: ld a, [wPrinterQueueLength] push af xor a @@ -725,7 +725,7 @@ Printer_PrintBoxListSegment: ld a, [de] cp $ff jp z, .finish - ld [wd265], a + ld [wNamedObjectIndexBuffer], a ld [wCurPartySpecies], a push bc diff --git a/engine/printer/printer_serial.asm b/engine/printer/printer_serial.asm index e8f106ac4..e8d056bf9 100644 --- a/engine/printer/printer_serial.asm +++ b/engine/printer/printer_serial.asm @@ -44,14 +44,14 @@ PrinterJumptableIteration: dw Printer_WaitUntilFinished ; 0c dw Printer_Quit ; 0d - dw Printer_NextSection_ ; 0e + dw Printer_NextSection ; 0e dw Printer_WaitSerial ; 0f dw Printer_SignalLoopBack ; 10 dw Printer_SectionOne ; 11 - dw Printer_WaitLoopBack ; 12 - dw Printer_WaitLoopBack_ ; 13 + dw Printer_NextSectionWaitLoopBack ; 12 + dw Printer_WaitLoopBack ; 13 -Printer_NextSection: +_Printer_NextSection: ld hl, wJumptableIndex inc [hl] ret @@ -68,8 +68,8 @@ Printer_Quit: set 7, [hl] ret -Printer_NextSection_: - call Printer_NextSection +Printer_NextSection: + call _Printer_NextSection ret Printer_SectionOne: @@ -86,7 +86,7 @@ Print_InitPrinterHandshake: ld [wPrinterSendByteCounter + 1], a ld a, [wPrinterQueueLength] ld [wPrinterRowIndex], a - call Printer_NextSection + call _Printer_NextSection call Printer_WaitHandshake ld a, PRINTER_STATUS_CHECKING ld [wPrinterStatus], a @@ -110,7 +110,7 @@ Printer_StartTransmittingTilemap: ld [wPrinterSendByteCounter + 1], a ; compute the checksum call Printer_ComputeChecksum - call Printer_NextSection + call _Printer_NextSection call Printer_WaitHandshake ld a, PRINTER_STATUS_TRANSMITTING ld [wPrinterStatus], a @@ -127,7 +127,7 @@ Printer_EndTilemapTransmission: xor a ld [wPrinterSendByteCounter], a ld [wPrinterSendByteCounter + 1], a - call Printer_NextSection + call _Printer_NextSection call Printer_WaitHandshake ret @@ -143,7 +143,7 @@ Printer_SignalSendHeader: ld [wPrinterSendByteCounter + 1], a ; compute the checksum call Printer_ComputeChecksum - call Printer_NextSection + call _Printer_NextSection call Printer_WaitHandshake ld a, PRINTER_STATUS_PRINTING ld [wPrinterStatus], a @@ -160,7 +160,7 @@ Printer_SignalLoopBack: ld [wPrinterSendByteCounter + 1], a ld a, [wPrinterQueueLength] ld [wPrinterRowIndex], a - call Printer_NextSection + call _Printer_NextSection call Printer_WaitHandshake ret @@ -172,7 +172,7 @@ Printer_WaitSerial: ret c xor a ld [hl], a - call Printer_NextSection + call _Printer_NextSection ret Printer_WaitSerialAndLoopBack2: @@ -211,7 +211,7 @@ Printer_CheckConnectionStatus: set 1, [hl] ld a, $5 ld [wHandshakeFrameDelay], a - call Printer_NextSection + call _Printer_NextSection ret .printer_error @@ -232,7 +232,7 @@ Printer_TransmissionLoop: ld a, [wPrinterStatusFlags] and $1 jr nz, .cycle_back - call Printer_NextSection + call _Printer_NextSection ret .cycle_back @@ -240,7 +240,7 @@ Printer_TransmissionLoop: ret .enter_wait_loop - ld a, $12 ; Printer_WaitLoopBack + ld a, $12 ; Printer_NextSectionWaitLoopBack ld [wJumptableIndex], a ret @@ -251,12 +251,12 @@ Printer_WaitUntilFinished: ld a, [wPrinterStatusFlags] and $f3 ret nz - call Printer_NextSection + call _Printer_NextSection ret +Printer_NextSectionWaitLoopBack: + call _Printer_NextSection Printer_WaitLoopBack: - call Printer_NextSection -Printer_WaitLoopBack_: ld a, [wPrinterOpcode] and a ret nz @@ -474,31 +474,31 @@ _PrinterReceive:: dw Printer_SendNextByte ; 06 dw Printer_SendwPrinterChecksumLo ; 07 dw Printer_SendwPrinterChecksumHi ; 08 - dw Printer_Send0x00 ; 09 - dw Printer_ReceiveTowPrinterHandshakeAndSend0x00 ; 0a - dw Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop ; 0b + dw Printer_Send0x00_2 ; 09 + dw Printer_ReceiveTwoPrinterHandshakeAndSend0x00 ; 0a + dw Printer_ReceiveTwoPrinterStatusFlagsAndExitSendLoop ; 0b dw Printer_Send0x33 ; 0c triggered by AskSerial dw Printer_Send0x0f ; 0d - dw Printer_Send0x00_ ; 0e - dw Printer_Send0x00_ ; 0f - dw Printer_Send0x00_ ; 10 + dw Printer_Send0x00 ; 0e + dw Printer_Send0x00 ; 0f + dw Printer_Send0x00 ; 10 dw Printer_Send0x0f ; 11 - dw Printer_Send0x00_ ; 12 - dw Printer_Send0x00 ; 13 - dw Printer_ReceiveTowPrinterHandshakeAndSend0x00 ; 14 - dw Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop_ ; 15 + dw Printer_Send0x00 ; 12 + dw Printer_Send0x00_2 ; 13 + dw Printer_ReceiveTwoPrinterHandshakeAndSend0x00 ; 14 + dw Printer_ReceiveTwoPrinterStatusFlagsAndExitSendLoop_2 ; 15 dw Printer_Send0x33 ; 16 triggered by pressing B dw Printer_Send0x08 ; 17 - dw Printer_Send0x00_ ; 18 - dw Printer_Send0x00_ ; 19 - dw Printer_Send0x00_ ; 1a + dw Printer_Send0x00 ; 18 + dw Printer_Send0x00 ; 19 + dw Printer_Send0x00 ; 1a dw Printer_Send0x08 ; 1b - dw Printer_Send0x00_ ; 1c - dw Printer_Send0x00 ; 1d - dw Printer_ReceiveTowPrinterHandshakeAndSend0x00 ; 1e - dw Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop ; 1f + dw Printer_Send0x00 ; 1c + dw Printer_Send0x00_2 ; 1d + dw Printer_ReceiveTwoPrinterHandshakeAndSend0x00 ; 1e + dw Printer_ReceiveTwoPrinterStatusFlagsAndExitSendLoop ; 1f Printer_NextInstruction: ld hl, wPrinterOpcode @@ -580,13 +580,14 @@ Printer_SendwPrinterChecksumHi: call Printer_NextInstruction ret -Printer_Send0x00: +Printer_Send0x00_2: +; identical to Printer_Send0x00, but referenced less ld a, $0 call Printer_SerialSend call Printer_NextInstruction ret -Printer_ReceiveTowPrinterHandshakeAndSend0x00: +Printer_ReceiveTwoPrinterHandshakeAndSend0x00: ld a, [rSB] ld [wPrinterHandshake], a ld a, $0 @@ -594,7 +595,7 @@ Printer_ReceiveTowPrinterHandshakeAndSend0x00: call Printer_NextInstruction ret -Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop: +Printer_ReceiveTwoPrinterStatusFlagsAndExitSendLoop: ld a, [rSB] ld [wPrinterStatusFlags], a xor a @@ -607,7 +608,7 @@ Printer_Send0x0f: call Printer_NextInstruction ret -Printer_Send0x00_: +Printer_Send0x00: ld a, $0 call Printer_SerialSend call Printer_NextInstruction @@ -627,7 +628,8 @@ Printer_SerialSend: ld [rSC], a ret -Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop_: +Printer_ReceiveTwoPrinterStatusFlagsAndExitSendLoop_2: +; identical to Printer_ReceiveTwoPrinterStatusFlagsAndExitSendLoop, but referenced less ld a, [rSB] ld [wPrinterStatusFlags], a xor a diff --git a/engine/rtc/timeset.asm b/engine/rtc/timeset.asm index 06f800c45..0b05f9c03 100644 --- a/engine/rtc/timeset.asm +++ b/engine/rtc/timeset.asm @@ -694,8 +694,8 @@ PrintHour: inc hl pop bc call AdjustHourForAMorPM - ld [wd265], a - ld de, wd265 + ld [wDeciramBuffer], a + ld de, wDeciramBuffer call PrintTwoDigitNumberRightAlign ret diff --git a/engine/tilesets/tileset_anims.asm b/engine/tilesets/tileset_anims.asm index 1e6abb968..2827b3a92 100644 --- a/engine/tilesets/tileset_anims.asm +++ b/engine/tilesets/tileset_anims.asm @@ -40,7 +40,7 @@ TilesetKantoAnim: dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, WaitTileAnimation dw NULL, AnimateFlowerTile dw NULL, WaitTileAnimation @@ -53,7 +53,7 @@ TilesetParkAnim: dw NULL, WaitTileAnimation dw vTiles2 tile $5f, AnimateFountain dw NULL, WaitTileAnimation - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, WaitTileAnimation dw NULL, AnimateFlowerTile dw NULL, WaitTileAnimation @@ -71,7 +71,7 @@ TilesetForestAnim: dw NULL, ForestTreeRightAnimation2 dw NULL, AnimateFlowerTile dw vTiles2 tile $14, AnimateWaterTile - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, StandingTileFrame8 dw NULL, DoneTileAnimation @@ -79,7 +79,7 @@ TilesetJohtoAnim: dw vTiles2 tile $14, AnimateWaterTile dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, WaitTileAnimation dw NULL, AnimateFlowerTile dw WhirlpoolFrames1, AnimateWhirlpoolTile @@ -122,7 +122,7 @@ TilesetPortAnim: dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation @@ -178,7 +178,7 @@ TilesetDarkCaveAnim: dw NULL, FlickeringCaveEntrancePalette dw vTiles2 tile $14, WriteTileFromBuffer dw NULL, FlickeringCaveEntrancePalette - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, FlickeringCaveEntrancePalette dw vTiles2 tile $40, WriteTileToBuffer dw NULL, FlickeringCaveEntrancePalette @@ -199,7 +199,7 @@ TilesetIcePathAnim: dw NULL, FlickeringCaveEntrancePalette dw vTiles2 tile $35, WriteTileFromBuffer dw NULL, FlickeringCaveEntrancePalette - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, FlickeringCaveEntrancePalette dw vTiles2 tile $31, WriteTileToBuffer dw NULL, FlickeringCaveEntrancePalette @@ -852,7 +852,7 @@ endr ld sp, hl ret -TileAnimationPalette: +AnimateWaterPalette: ; Transition between color values 0-2 for color 0 in palette 3. ; No palette changes on DMG. @@ -162,61 +162,14 @@ CallPointerAt:: rst Bankswitch ret -QueueScript:: -; Push pointer hl in the current bank to wQueuedScriptBank. - ld a, [hROMBank] - -FarQueueScript:: -; Push pointer a:hl to wQueuedScriptBank. - ld [wQueuedScriptBank], a - ld a, l - ld [wQueuedScriptAddr], a - ld a, h - ld [wQueuedScriptAddr + 1], a - ret - -StringCmp:: -; Compare c bytes at de and hl. -; Return z if they all match. -.loop - ld a, [de] - cp [hl] - ret nz - inc de - inc hl - dec c - jr nz, .loop - ret - -CompareLong:: -; Compare bc bytes at de and hl. -; Return carry if they all match. - - ld a, [de] - cp [hl] - jr nz, .Diff - - inc de - inc hl - dec bc - - ld a, b - or c - jr nz, CompareLong - - scf - ret - -.Diff: - and a - ret - +INCLUDE "home/queue_script.asm" +INCLUDE "home/compare.asm" INCLUDE "home/tilemap.asm" INCLUDE "home/hp_pals.asm" CountSetBits:: ; Count the number of set bits in b bytes starting from hl. -; Return in a, c and [wd265]. +; Return in a, c and [wNumSetBits]. ld c, 0 .next ld a, [hli] @@ -235,7 +188,7 @@ CountSetBits:: jr nz, .next ld a, c - ld [wd265], a + ld [wNumSetBits], a ret GetWeekday:: diff --git a/home/compare.asm b/home/compare.asm new file mode 100644 index 000000000..26b7567fd --- /dev/null +++ b/home/compare.asm @@ -0,0 +1,35 @@ +CompareBytes:: +; Compare c bytes at de and hl. +; Return z if they all match. +.loop + ld a, [de] + cp [hl] + ret nz + inc de + inc hl + dec c + jr nz, .loop + ret + +CompareBytesLong:: +; Compare bc bytes at de and hl. +; Return carry if they all match. +.loop + ld a, [de] + cp [hl] + jr nz, .diff + + inc de + inc hl + dec bc + + ld a, b + or c + jr nz, .loop + + scf + ret + +.diff: + and a + ret diff --git a/home/joypad.asm b/home/joypad.asm index 87fc60d7e..392be760b 100644 --- a/home/joypad.asm +++ b/home/joypad.asm @@ -213,7 +213,7 @@ GetJoypad:: ld a, l ld [wAutoInputAddress], a ld a, h - ld [wAutoInputAddress+1], a + ld [wAutoInputAddress + 1], a jr .finishauto .stopauto @@ -235,7 +235,7 @@ StartAutoInput:: ld a, l ld [wAutoInputAddress], a ld a, h - ld [wAutoInputAddress+1], a + ld [wAutoInputAddress + 1], a ; Start reading the stream immediately. xor a ld [wAutoInputLength], a @@ -254,7 +254,7 @@ StopAutoInput:: xor a ld [wAutoInputBank], a ld [wAutoInputAddress], a - ld [wAutoInputAddress+1], a + ld [wAutoInputAddress + 1], a ld [wAutoInputLength], a ; Back to normal input. ld [wInputType], a diff --git a/home/map.asm b/home/map.asm index 550486081..a38b791fb 100644 --- a/home/map.asm +++ b/home/map.asm @@ -1176,7 +1176,7 @@ ScrollMapUp:: ld l, a ld a, [wBGMapAnchor + 1] ld h, a - ld bc, $0200 + ld bc, BG_MAP_WIDTH tiles add hl, bc ; cap d at HIGH(vBGMap0) ld a, h diff --git a/home/names.asm b/home/names.asm index e9c36fc1d..63043863d 100644 --- a/home/names.asm +++ b/home/names.asm @@ -2,10 +2,10 @@ NamesPointers:: ; entries correspond to GetName constants (see constants/text_constants.asm) dba PokemonNames ; MON_NAME (not used; jumps to GetPokemonName) dba MoveNames ; MOVE_NAME - dbw 0, NULL ; DUMMY_NAME + dba NULL ; DUMMY_NAME dba ItemNames ; ITEM_NAME - dbw 0, wPartyMonOT ; PARTY_OT_NAME - dbw 0, wOTPartyMonOT ; ENEMY_OT_NAME + dbw 0, wPartyMonOT ; PARTY_OT_NAME + dbw 0, wOTPartyMonOT ; ENEMY_OT_NAME dba TrainerClassNames ; TRAINER_NAME dbw 4, MoveDescriptions ; MOVE_DESC_NAME_BROKEN (wrong bank) @@ -23,7 +23,7 @@ GetName:: jr nz, .NotPokeName ld a, [wCurSpecies] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, MON_NAME_LENGTH add hl, de @@ -110,7 +110,7 @@ GetBasePokemonName:: ret GetPokemonName:: -; Get Pokemon name wd265. +; Get Pokemon name for wNamedObjectIndexBuffer. ld a, [hROMBank] push af @@ -119,7 +119,7 @@ GetPokemonName:: rst Bankswitch ; Each name is ten characters - ld a, [wd265] + ld a, [wNamedObjectIndexBuffer] dec a ld d, 0 ld e, a @@ -147,11 +147,11 @@ GetPokemonName:: ret GetItemName:: -; Get item name wd265. +; Get item name for wNamedObjectIndexBuffer. push hl push bc - ld a, [wd265] + ld a, [wNamedObjectIndexBuffer] cp TM01 jr nc, .TM @@ -170,12 +170,12 @@ GetItemName:: ret GetTMHMName:: -; Get TM/HM name by item id wd265. +; Get TM/HM name for item wNamedObjectIndexBuffer. push hl push de push bc - ld a, [wd265] + ld a, [wNamedObjectIndexBuffer] push af ; TM/HM prefix @@ -197,7 +197,7 @@ GetTMHMName:: ; TM/HM number push de - ld a, [wd265] + ld a, [wNamedObjectIndexBuffer] ld c, a callfar GetTMHMNumber pop de @@ -235,7 +235,7 @@ GetTMHMName:: ld [de], a pop af - ld [wd265], a + ld [wNamedObjectIndexBuffer], a pop bc pop de pop hl diff --git a/home/predef.asm b/home/predef.asm index e829bdc00..bfb5e4690 100644 --- a/home/predef.asm +++ b/home/predef.asm @@ -39,7 +39,7 @@ Predef:: ld a, h ld [wPredefTemp], a ld a, l - ld [wPredefTemp+1], a + ld [wPredefTemp + 1], a pop hl ld a, h diff --git a/home/print_level.asm b/home/print_level.asm index 2ebbbf980..d10b8f8a1 100644 --- a/home/print_level.asm +++ b/home/print_level.asm @@ -22,7 +22,7 @@ PrintLevel_Force3Digits:: ld c, 3 Print8BitNumRightAlign:: - ld [wd265], a - ld de, wd265 + ld [wDeciramBuffer], a + ld de, wDeciramBuffer ld b, PRINTNUM_RIGHTALIGN | 1 jp PrintNum diff --git a/home/queue_script.asm b/home/queue_script.asm new file mode 100644 index 000000000..40a971dc9 --- /dev/null +++ b/home/queue_script.asm @@ -0,0 +1,12 @@ +QueueScript:: +; Push pointer hl in the current bank to wQueuedScriptBank. + ld a, [hROMBank] + +FarQueueScript:: +; Push pointer a:hl to wQueuedScriptBank. + ld [wQueuedScriptBank], a + ld a, l + ld [wQueuedScriptAddr], a + ld a, h + ld [wQueuedScriptAddr + 1], a + ret diff --git a/home/text.asm b/home/text.asm index d74af02af..ef952942d 100644 --- a/home/text.asm +++ b/home/text.asm @@ -178,26 +178,30 @@ NextChar:: CheckDict:: dict: MACRO -if \1 == 0 +if \1 == "<NULL>" and a else cp \1 endc - jp z, \2 -ENDM -dict2: MACRO - cp \1 +if STRSUB("\2", 1, 1) == "\"" +; Replace a character with another one jr nz, ._\@ ld a, \2 ._\@: +elif STRSUB("\2", 1, 1) == "." +; Locals can use a short jump + jr z, \2 +else + jp z, \2 +endc ENDM - dict TX_DAY, DayOfWeekChar + dict "<MOBILE>", MobileScriptChar dict "<LINE>", LineChar dict "<NEXT>", NextLineChar - dict TX_FAR, TextFar - dict TX_START, NullChar + dict "<CR>", CarriageReturnChar + dict "<NULL>", NullChar dict "<SCROLL>", _ContTextNoPause dict "<_CONT>", _ContText dict "<PARA>", Paragraph @@ -215,7 +219,7 @@ ENDM dict "<TM>", TMChar dict "<TRAINER>", TrainerChar dict "<KOUGEKI>", PlaceKougeki - dict "<LNBRK>", LineBreakChar + dict "<LF>", LineFeedChar dict "<CONT>", ContText dict "<……>", SixDotsChar dict "<DONE>", DoneText @@ -223,17 +227,14 @@ ENDM dict "<PKMN>", PlacePKMN dict "<POKE>", PlacePOKE dict "%", NextChar - dict2 "¯", " " + dict "¯", " " dict "<DEXEND>", PlaceDexEnd dict "<TARGET>", PlaceMoveTargetsName dict "<USER>", PlaceMoveUsersName dict "<ENEMY>", PlaceEnemysName dict "<PLAY_G>", PlaceGenderedPlayerName - - cp "゚" - jr z, .place ; should be .diacritic - cp "゙" - jr z, .place ; should be .diacritic + dict "゚", .place ; should be .diacritic + dict "゙", .place ; should be .diacritic jr .not_diacritic .diacritic @@ -276,10 +277,10 @@ ENDM call PrintLetterDelay jp NextChar -DayOfWeekChar:: +MobileScriptChar:: ld c, l ld b, h - farcall Function17f036 + farcall RunMobileScript jp PlaceNextChar print_name: MACRO @@ -409,14 +410,14 @@ NextLineChar:: push hl jp NextChar -LineBreakChar:: +LineFeedChar:: pop hl ld bc, SCREEN_WIDTH add hl, bc push hl jp NextChar -TextFar:: +CarriageReturnChar:: pop hl push de ld bc, -wTileMap + $10000 @@ -681,32 +682,32 @@ DoTextUntilTerminator:: TextCommands:: ; entries correspond to TX_* constants (see macros/scripts/text.asm) - dw Text_TX ; TX_START - dw Text_TX_RAM ; TX_RAM - dw Text_TX_BCD ; TX_BCD - dw Text_TX_MOVE ; TX_MOVE - dw Text_TX_BOX ; TX_BOX - dw Text_TX_LOW ; TX_LOW - dw Text_WAIT_BUTTON ; WAIT_BUTTON - dw Text_TX_SCROLL ; TX_SCROLL - dw Text_START_ASM ; START_ASM - dw Text_TX_NUM ; TX_NUM - dw Text_TX_EXIT ; TX_EXIT - dw Text_PlaySound ; TX_SOUND_DEX_FANFARE_50_79 - dw Text_TX_DOTS ; TX_DOTS - dw Text_LINK_WAIT_BUTTON ; TX_LINK_WAIT_BUTTON - dw Text_PlaySound ; TX_SOUND_DEX_FANFARE_20_49 - dw Text_PlaySound ; TX_SOUND_ITEM - dw Text_PlaySound ; TX_SOUND_CAUGHT_MON - dw Text_PlaySound ; TX_SOUND_DEX_FANFARE_80_109 - dw Text_PlaySound ; TX_SOUND_FANFARE - dw Text_PlaySound ; TX_SOUND_SLOT_MACHINE_START - dw Text_TX_STRINGBUFFER ; TX_STRINGBUFFER - dw Text_TX_DAY ; TX_DAY - dw Text_TX_FAR ; TX_FAR - -Text_TX:: -; TX + dw TextCommand_START ; TX_START + dw TextCommand_RAM ; TX_RAM + dw TextCommand_BCD ; TX_BCD + dw TextCommand_MOVE ; TX_MOVE + dw TextCommand_BOX ; TX_BOX + dw TextCommand_LOW ; TX_LOW + dw TextCommand_WAIT_BUTTON ; TX_WAIT_BUTTON + dw TextCommand_SCROLL ; TX_SCROLL + dw TextCommand_START_ASM ; TX_START_ASM + dw TextCommand_NUM ; TX_NUM + dw TextCommand_EXIT ; TX_EXIT + dw TextCommand_SOUND ; TX_SOUND_DEX_FANFARE_50_79 + dw TextCommand_DOTS ; TX_DOTS + dw TextCommand_LINK_WAIT_BUTTON ; TX_LINK_WAIT_BUTTON + dw TextCommand_SOUND ; TX_SOUND_DEX_FANFARE_20_49 + dw TextCommand_SOUND ; TX_SOUND_ITEM + dw TextCommand_SOUND ; TX_SOUND_CAUGHT_MON + dw TextCommand_SOUND ; TX_SOUND_DEX_FANFARE_80_109 + dw TextCommand_SOUND ; TX_SOUND_FANFARE + dw TextCommand_SOUND ; TX_SOUND_SLOT_MACHINE_START + dw TextCommand_STRINGBUFFER ; TX_STRINGBUFFER + dw TextCommand_DAY ; TX_DAY + dw TextCommand_FAR ; TX_FAR + +TextCommand_START:: +; text_start ; write text until "@" ; [$00]["...@"] @@ -720,7 +721,7 @@ Text_TX:: inc hl ret -Text_TX_RAM:: +TextCommand_RAM:: ; text_from_ram ; write text from a ram address ; little endian @@ -737,7 +738,7 @@ Text_TX_RAM:: pop hl ret -Text_TX_FAR:: +TextCommand_FAR:: ; text_jump ; write text from a different bank ; little endian @@ -766,8 +767,8 @@ Text_TX_FAR:: ld [MBC3RomBank], a ret -Text_TX_BCD:: -; TX_BCD +TextCommand_BCD:: +; text_bcd ; write bcd from address, typically ram ; [$02][addr][flags] ; flags: see PrintBCDNumber @@ -787,8 +788,8 @@ Text_TX_BCD:: pop hl ret -Text_TX_MOVE:: -; TX_MOVE +TextCommand_MOVE:: +; text_move ; move to a new tile ; [$03][addr] @@ -800,8 +801,8 @@ Text_TX_MOVE:: ld b, a ret -Text_TX_BOX:: -; TX_BOX +TextCommand_BOX:: +; text_box ; draw a box ; little endian ; [$04][addr][height][width] @@ -821,25 +822,25 @@ Text_TX_BOX:: pop hl ret -Text_TX_LOW:: -; TX_LOW +TextCommand_LOW:: +; text_low ; write text at (1,16) ; [$05] bccoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2 ret -Text_WAIT_BUTTON:: -; TX_WAITBUTTON +TextCommand_WAIT_BUTTON:: +; text_waitbutton ; wait for button press ; show arrow ; [06] ld a, [wLinkMode] cp LINK_COLOSSEUM - jp z, Text_LINK_WAIT_BUTTON + jp z, TextCommand_LINK_WAIT_BUTTON cp LINK_MOBILE - jp z, Text_LINK_WAIT_BUTTON + jp z, TextCommand_LINK_WAIT_BUTTON push hl call LoadBlinkingCursor @@ -850,7 +851,8 @@ Text_WAIT_BUTTON:: pop hl ret -Text_TX_SCROLL:: +TextCommand_SCROLL:: +; text_scroll ; pushes text up two lines and sets the BC cursor to the border tile ; below the first character column of the text box. push hl @@ -861,8 +863,8 @@ Text_TX_SCROLL:: bccoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2 ret -Text_START_ASM:: -; TX_ASM +TextCommand_START_ASM:: +; start_asm bit 7, h jr nz, .not_rom @@ -873,8 +875,8 @@ Text_START_ASM:: ld [hl], a ret -Text_TX_NUM:: -; TX_NUM +TextCommand_NUM:: +; deciram ; [$09][addr][hi:bytes lo:digits] ld a, [hli] ld e, a @@ -898,7 +900,8 @@ Text_TX_NUM:: pop hl ret -Text_TX_EXIT:: +TextCommand_EXIT:: +; interpret_data push hl push bc call GetJoypad @@ -912,7 +915,7 @@ Text_TX_EXIT:: pop hl ret -Text_PlaySound:: +TextCommand_SOUND:: ; chars: ; $0b, $0e, $0f, $10, $11, $12, $13 ; see TextSFX @@ -948,7 +951,7 @@ Text_PlaySound:: ret Unreferenced_Function1522:: -; TX_CRY +; play_cry push de ld e, [hl] inc hl @@ -969,7 +972,8 @@ TextSFX:: dbw TX_SOUND_SLOT_MACHINE_START, SFX_SLOT_MACHINE_START db -1 -Text_TX_DOTS:: +TextCommand_DOTS:: +; limited_interpret_data ; [$0C][num] ld a, [hli] ld d, a @@ -997,7 +1001,8 @@ Text_TX_DOTS:: pop hl ret -Text_LINK_WAIT_BUTTON:: +TextCommand_LINK_WAIT_BUTTON:: +; link_wait_button ; wait for key down ; display arrow push hl @@ -1007,7 +1012,8 @@ Text_LINK_WAIT_BUTTON:: pop hl ret -Text_TX_STRINGBUFFER:: +TextCommand_STRINGBUFFER:: +; text_buffer ; Print a string from one of the following: ; 0: wStringBuffer3 ; 1: wStringBuffer4 @@ -1035,8 +1041,8 @@ Text_TX_STRINGBUFFER:: pop hl ret -Text_TX_DAY:: -; TX_DAY +TextCommand_DAY:: +; current_day call GetWeekday push hl @@ -48,8 +48,8 @@ hConnectedMapWidth EQU $ffb0 hPastLeadingZeroes EQU $ffb3 -hStringCmpString1 EQU $ffb1 -hStringCmpString2 EQU $ffb5 +hEnemyMonSpeed EQU $ffb1 +hPartyMon1Speed EQU $ffb5 hDividend EQU $ffb3 ; length in b register, before 'call Divide' (max 4 bytes) hDivisor EQU $ffb7 ; 1 byte long @@ -129,3 +129,4 @@ hDMATransfer EQU $ffe8 hMobile EQU $ffe9 hSystemBooted EQU $ffea hClockResetTrigger EQU $ffeb +hFFEC EQU $ffec diff --git a/macros/code.asm b/macros/code.asm index 72fd4b0d2..9429884ca 100644 --- a/macros/code.asm +++ b/macros/code.asm @@ -1,11 +1,11 @@ ; Syntactic sugar macros lb: MACRO ; r, hi, lo - ld \1, (((\2) & $ff) << 8) | (((\3) & $ff)) + ld \1, ((\2) & $ff) << 8 | ((\3) & $ff) ENDM ln: MACRO ; r, hi, lo - ld \1, (((\2) & $f) << 4) | (((\3) & $f)) + ld \1, ((\2) & $f) << 4 | ((\3) & $f) ENDM ldpixel: MACRO diff --git a/macros/scripts/battle_commands.asm b/macros/scripts/battle_commands.asm index 48e034bdf..919d6e00f 100644 --- a/macros/scripts/battle_commands.asm +++ b/macros/scripts/battle_commands.asm @@ -21,7 +21,7 @@ ENDM command applydamage ; 0e command criticaltext ; 0f command supereffectivetext ; 10 - command checkdestinybond ; 11 + command checkfaint ; 11 command buildopponentrage ; 12 command poisontarget ; 13 command sleeptarget ; 14 diff --git a/macros/scripts/text.asm b/macros/scripts/text.asm index bff18c7ea..d1fec35db 100644 --- a/macros/scripts/text.asm +++ b/macros/scripts/text.asm @@ -46,9 +46,9 @@ text_low: MACRO db TX_LOW ENDM - enum WAIT_BUTTON ; $06 + enum TX_WAIT_BUTTON ; $06 text_waitbutton: MACRO - db WAIT_BUTTON + db TX_WAIT_BUTTON ENDM enum TX_SCROLL ; $07 @@ -56,9 +56,9 @@ text_scroll: MACRO db TX_SCROLL ENDM - enum START_ASM ; $08 + enum TX_START_ASM ; $08 start_asm: MACRO - db START_ASM + db TX_START_ASM ENDM enum TX_NUM ; $09 @@ -57,6 +57,7 @@ INCLUDE "engine/events/whiteout.asm" INCLUDE "engine/events/forced_movement.asm" INCLUDE "engine/events/itemfinder.asm" INCLUDE "engine/menus/start_menu.asm" +INCLUDE "engine/pokemon/mon_menu.asm" INCLUDE "engine/overworld/select_menu.asm" INCLUDE "engine/events/elevator.asm" INCLUDE "engine/events/bug_contest/contest.asm" @@ -109,7 +110,7 @@ INCLUDE "engine/overworld/map_objects_2.asm" INCLUDE "engine/menus/scrolling_menu.asm" INCLUDE "engine/items/switch_items.asm" INCLUDE "engine/menus/menu_2.asm" -INCLUDE "engine/pokemon/mon_menu.asm" +INCLUDE "engine/pokemon/mon_submenu.asm" INCLUDE "engine/battle/menu.asm" INCLUDE "engine/items/buy_sell_toss.asm" INCLUDE "engine/menus/trainer_card.asm" @@ -144,6 +145,7 @@ INCLUDE "engine/battle/ai/redundant.asm" INCLUDE "engine/events/move_deleter.asm" INCLUDE "engine/link/mystery_gift_2.asm" INCLUDE "engine/items/tmhm.asm" +INCLUDE "engine/pokemon/print_move_description.asm" INCLUDE "data/moves/descriptions.asm" INCLUDE "engine/events/pokerus/pokerus.asm" INCLUDE "engine/battle/start_battle.asm" diff --git a/maps/BattleTowerBattleRoom.asm b/maps/BattleTowerBattleRoom.asm index 0491c2845..43c43415f 100644 --- a/maps/BattleTowerBattleRoom.asm +++ b/maps/BattleTowerBattleRoom.asm @@ -34,7 +34,7 @@ Script_BattleRoomLoop: special FadeOutPalettes reloadmap ifnotequal $0, Script_FailedBattleTowerChallenge - copybytetovar wNrOfBeatenBattleTowerTrainers ; wcf64 + copybytetovar wNrOfBeatenBattleTowerTrainers ifequal BATTLETOWER_STREAK_LENGTH, Script_BeatenAllTrainers applymovement BATTLETOWERBATTLEROOM_YOUNGSTER, MovementData_BattleTowerBattleRoomOpponentWalksOut warpsound diff --git a/maps/BillsFamilysHouse.asm b/maps/BillsFamilysHouse.asm index 1c95dc68d..b100f1e61 100644 --- a/maps/BillsFamilysHouse.asm +++ b/maps/BillsFamilysHouse.asm @@ -13,38 +13,38 @@ BillScript: opentext checkevent EVENT_GOT_EEVEE iftrue .GotEevee - writetext UnknownText_0x54c74 + writetext BillTakeThisEeveeText yesorno iffalse .Refused - writetext UnknownText_0x54d3f + writetext BillImCountingOnYouText buttonsound waitsfx checkcode VAR_PARTYCOUNT ifequal PARTY_LENGTH, .NoRoom - writetext UnknownText_0x54dae + writetext ReceivedEeveeText playsound SFX_CAUGHT_MON waitsfx givepoke EEVEE, 20 setevent EVENT_GOT_EEVEE - writetext UnknownText_0x54dc1 + writetext BillEeveeMayEvolveText waitbutton closetext end .NoRoom: - writetext UnknownText_0x54e02 + writetext BillPartyFullText waitbutton closetext end .Refused: - writetext UnknownText_0x54e2d + writetext BillNoEeveeText waitbutton closetext end .GotEevee: - writetext UnknownText_0x54e42 + writetext BillPopWontWorkText waitbutton closetext end @@ -54,13 +54,13 @@ BillsMomScript: opentext checkevent EVENT_MET_BILL iffalse .HaventMetBill - writetext UnknownText_0x54ea8 + writetext BillsPopText waitbutton closetext end .HaventMetBill: - writetext UnknownText_0x54f4e + writetext BillsMomText waitbutton closetext end @@ -70,30 +70,30 @@ BillsSisterScript: opentext checkcellnum PHONE_BILL iftrue .GotBillsNumber - writetext UnknownText_0x54f9e + writetext BillsSisterUsefulNumberText askforphonenumber PHONE_BILL ifequal PHONE_CONTACTS_FULL, .NoRoom ifequal PHONE_CONTACT_REFUSED, .Refused waitsfx addcellnum PHONE_BILL - writetext UnknownText_0x54fd9 + writetext RecordedBillsNumberText playsound SFX_REGISTER_PHONE_NUMBER waitsfx buttonsound .GotBillsNumber: - writetext UnknownText_0x55069 + writetext BillsSisterStorageSystemText waitbutton closetext end .Refused: - writetext UnknownText_0x54ff3 + writetext BillsSisterRefusedNumberText waitbutton closetext end .NoRoom: - writetext UnknownText_0x55046 + writetext BillsSisterPhoneFullText buttonsound jump .Refused @@ -106,7 +106,7 @@ BillsHouseBookshelf2: BillsHouseRadio: jumpstd radio2 -UnknownText_0x54c74: +BillTakeThisEeveeText: text "BILL: Hi, <PLAYER>!" line "Do us a favor and" cont "take this EEVEE." @@ -126,7 +126,7 @@ UnknownText_0x54c74: cont "<PLAYER>?" done -UnknownText_0x54d3f: +BillImCountingOnYouText: text "BILL: I knew you'd" line "come through!" @@ -140,12 +140,12 @@ UnknownText_0x54d3f: line "it!" done -UnknownText_0x54dae: +ReceivedEeveeText: text "<PLAYER> received" line "EEVEE!" done -UnknownText_0x54dc1: +BillEeveeMayEvolveText: text "BILL: PROF.ELM" line "claims EEVEE may" @@ -153,18 +153,18 @@ UnknownText_0x54dc1: line "unknown ways." done -UnknownText_0x54e02: +BillPartyFullText: text "Whoa, wait. You" line "can't carry any" cont "more #MON." done -UnknownText_0x54e2d: +BillNoEeveeText: text "Oh… Now what to" line "do?" done -UnknownText_0x54e42: +BillPopWontWorkText: text "BILL: My pop, he" line "won't work. All he" @@ -175,7 +175,7 @@ UnknownText_0x54e42: line "a real headache…" done -UnknownText_0x54ea8: +BillsPopText: text "Oh, you collect" line "#MON? My son" cont "BILL is an expert." @@ -193,7 +193,7 @@ UnknownText_0x54ea8: line "being called…" done -UnknownText_0x54f4e: +BillsMomText: text "My husband was" line "once known as a" @@ -204,7 +204,7 @@ UnknownText_0x54f4e: line "father." done -UnknownText_0x54f9e: +BillsSisterUsefulNumberText: text "Are you a trainer?" para "I've got a useful" @@ -212,12 +212,12 @@ UnknownText_0x54f9e: cont "you." done -UnknownText_0x54fd9: +RecordedBillsNumberText: text "<PLAYER> recorded" line "BILL's number." done -UnknownText_0x54ff3: +BillsSisterRefusedNumberText: text "My brother made" line "the PC #MON" cont "storage system." @@ -227,12 +227,12 @@ UnknownText_0x54ff3: cont "number…" done -UnknownText_0x55046: +BillsSisterPhoneFullText: text "You can't record" line "any more numbers." done -UnknownText_0x55069: +BillsSisterStorageSystemText: text "My big brother" line "BILL made the PC" diff --git a/maps/CeladonMansion3F.asm b/maps/CeladonMansion3F.asm index 2bb4cf186..29f043092 100644 --- a/maps/CeladonMansion3F.asm +++ b/maps/CeladonMansion3F.asm @@ -9,10 +9,10 @@ CeladonMansion3F_MapScripts: db 0 ; callbacks -CeladonMansion3FCooltrainerMScript: +GameFreakGameDesignerScript: faceplayer opentext - writetext UnknownText_0x716ce + writetext GameFreakGameDesignerText checkcode VAR_DEXCAUGHT ifgreater NUM_POKEMON - 2 - 1, .CompletedPokedex ; ignore Mew and Celebi waitbutton @@ -21,30 +21,30 @@ CeladonMansion3FCooltrainerMScript: .CompletedPokedex: buttonsound - writetext UnknownText_0x71725 + writetext GameFreakGameDesignerCompletedPokedexText playsound SFX_DEX_FANFARE_230_PLUS waitsfx - writetext UnknownText_0x71760 + writetext GameFreakGameDesignerPauseForDiplomaText buttonsound special Diploma - writetext UnknownText_0x71763 + writetext GameFreakGameDesignerAfterDiplomaText waitbutton closetext setevent EVENT_ENABLE_DIPLOMA_PRINTING end -CeladonMansion3FGymGuyScript: +GameFreakGraphicArtistScript: faceplayer opentext checkevent EVENT_ENABLE_DIPLOMA_PRINTING iftrue .CanPrintDiploma - writetext UnknownText_0x717b4 + writetext GameFreakGraphicArtistText waitbutton closetext end .CanPrintDiploma: - writetext UnknownText_0x717d8 + writetext GameFreakGraphicArtistPrintDiplomaText yesorno iffalse .Refused special PrintDiploma @@ -52,23 +52,23 @@ CeladonMansion3FGymGuyScript: end .Refused: - writetext UnknownText_0x71830 + writetext GameFreakGraphicArtistRefusedText waitbutton closetext end .CancelPrinting: ; unused - writetext UnknownText_0x71863 + writetext GameFreakGraphicArtistErrorText waitbutton closetext end -CeladonMansion3FSuperNerdScript: - jumptextfaceplayer CeladonMansion3FSuperNerdText +GameFreakProgrammerScript: + jumptextfaceplayer GameFreakProgrammerText -CeladonMansion3FFisherScript: - jumptextfaceplayer CeladonMansion3FFisherText +GameFreakCharacterDesignerScript: + jumptextfaceplayer GameFreakCharacterDesignerText CeladonMansion3FDevRoomSign: jumptext CeladonMansion3FDevRoomSignText @@ -82,7 +82,7 @@ CeladonMansion3FGameProgram: CeladonMansion3FReferenceMaterial: jumptext CeladonMansion3FReferenceMaterialText -UnknownText_0x716ce: +GameFreakGameDesignerText: text "Is that right?" para "I'm the GAME" @@ -93,7 +93,7 @@ UnknownText_0x716ce: cont "but don't give up!" done -UnknownText_0x71725: +GameFreakGameDesignerCompletedPokedexText: text "Wow! Excellent!" line "You completed your" cont "#DEX!" @@ -101,11 +101,11 @@ UnknownText_0x71725: para "Congratulations!" done -UnknownText_0x71760: +GameFreakGameDesignerPauseForDiplomaText: text "…" done -UnknownText_0x71763: +GameFreakGameDesignerAfterDiplomaText: text "The GRAPHIC ARTIST" line "will print out a" cont "DIPLOMA for you." @@ -114,14 +114,14 @@ UnknownText_0x71763: line "it off." done -UnknownText_0x717b4: +GameFreakGraphicArtistText: text "I'm the GRAPHIC" line "ARTIST." para "I drew you!" done -UnknownText_0x717d8: +GameFreakGraphicArtistPrintDiplomaText: text "I'm the GRAPHIC" line "ARTIST." @@ -132,19 +132,19 @@ UnknownText_0x717d8: line "out your DIPLOMA?" done -UnknownText_0x71830: +GameFreakGraphicArtistRefusedText: text "Give me a shout if" line "you want your" cont "DIPLOMA printed." done -UnknownText_0x71863: +GameFreakGraphicArtistErrorText: text "Something's wrong." line "I'll have to can-" cont "cel printing." done -CeladonMansion3FSuperNerdText: +GameFreakProgrammerText: text "Who, me? I'm the" line "PROGRAMMER." @@ -152,7 +152,7 @@ CeladonMansion3FSuperNerdText: line "machines!" done -CeladonMansion3FFisherText: +GameFreakCharacterDesignerText: text "Aren't the TWINS" line "adorable?" @@ -206,7 +206,7 @@ CeladonMansion3F_MapEvents: bg_event 1, 3, BGEVENT_UP, CeladonMansion3FReferenceMaterial db 4 ; object events - object_event 3, 6, SPRITE_COOLTRAINER_M, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, CeladonMansion3FCooltrainerMScript, -1 - object_event 3, 4, SPRITE_GYM_GUY, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, CeladonMansion3FGymGuyScript, -1 - object_event 0, 7, SPRITE_SUPER_NERD, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, CeladonMansion3FSuperNerdScript, -1 - object_event 0, 4, SPRITE_FISHER, SPRITEMOVEDATA_STANDING_UP, 2, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, CeladonMansion3FFisherScript, -1 + object_event 3, 6, SPRITE_COOLTRAINER_M, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, GameFreakGameDesignerScript, -1 + object_event 3, 4, SPRITE_GYM_GUY, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, GameFreakGraphicArtistScript, -1 + object_event 0, 7, SPRITE_SUPER_NERD, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, GameFreakProgrammerScript, -1 + object_event 0, 4, SPRITE_FISHER, SPRITEMOVEDATA_STANDING_UP, 2, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, GameFreakCharacterDesignerScript, -1 diff --git a/maps/CeladonMansionRoofHouse.asm b/maps/CeladonMansionRoofHouse.asm index 9ffceb59c..31bda62b8 100644 --- a/maps/CeladonMansionRoofHouse.asm +++ b/maps/CeladonMansionRoofHouse.asm @@ -11,34 +11,34 @@ CeladonMansionRoofHousePharmacistScript: opentext checkevent EVENT_GOT_TM03_CURSE iftrue .GotCurse - writetext UnknownText_0x71b27 + writetext CeladonMansionRoofHousePharmacistIntroText buttonsound checktime NITE iftrue .Night - writetext UnknownText_0x71b4a + writetext CeladonMansionRoofHousePharmacistNotNightText waitbutton closetext end .Night: - writetext UnknownText_0x71ba3 + writetext CeladonMansionRoofHousePharmacistStoryText buttonsound verbosegiveitem TM_CURSE iffalse .NoRoom setevent EVENT_GOT_TM03_CURSE .GotCurse: - writetext UnknownText_0x71db3 + writetext CeladonMansionRoofHousePharmacistCurseText waitbutton .NoRoom: closetext end -UnknownText_0x71b27: +CeladonMansionRoofHousePharmacistIntroText: text "Let me recount a" line "terrifying tale…" done -UnknownText_0x71b4a: +CeladonMansionRoofHousePharmacistNotNightText: text "Then again, it's" line "not as scary while" @@ -49,7 +49,7 @@ UnknownText_0x71b4a: line "sunset, OK?" done -UnknownText_0x71ba3: +CeladonMansionRoofHousePharmacistStoryText: text "Once upon a time," line "there was a little" @@ -104,7 +104,7 @@ UnknownText_0x71ba3: cont "take this--TM03!" done -UnknownText_0x71db3: +CeladonMansionRoofHousePharmacistCurseText: text "TM03 is CURSE." para "It's a terrifying" diff --git a/maps/CeruleanGym.asm b/maps/CeruleanGym.asm index 4fff92cdf..9c75c5661 100644 --- a/maps/CeruleanGym.asm +++ b/maps/CeruleanGym.asm @@ -26,18 +26,18 @@ CeruleanGym_MapScripts: applymovement CERULEANGYM_ROCKET, CeruleanGymGruntRunsIntoYouMovement playmusic MUSIC_ROCKET_ENCOUNTER opentext - writetext UnknownText_0x1884fb + writetext CeruleanGymGruntIntroText waitbutton closetext showemote EMOTE_SHOCK, CERULEANGYM_ROCKET, 15 applymovement CERULEANGYM_ROCKET, CeruleanGymGruntBacksAwayMovement opentext - writetext UnknownText_0x188574 + writetext CeruleanGymGruntBigMistakeText waitbutton closetext applymovement CERULEANGYM_ROCKET, CeruleanGymGruntMovesCloseMovement opentext - writetext UnknownText_0x1885a5 + writetext CeruleanGymGruntByeText waitbutton closetext applymovement CERULEANGYM_ROCKET, CeruleanGymGruntRunsOutMovement @@ -61,10 +61,10 @@ CeruleanGymMistyScript: opentext checkflag ENGINE_CASCADEBADGE iftrue .FightDone - writetext UnknownText_0x188674 + writetext MistyIntroText waitbutton closetext - winlosstext UnknownText_0x18870c, 0 + winlosstext MistyWinLossText, 0 loadtrainer MISTY, MISTY1 startbattle reloadmapafterbattle @@ -73,12 +73,12 @@ CeruleanGymMistyScript: setevent EVENT_BEAT_SWIMMERF_BRIANA setevent EVENT_BEAT_SWIMMERM_PARKER opentext - writetext UnknownText_0x188768 + writetext ReceivedCascadeBadgeText playsound SFX_GET_BADGE waitsfx setflag ENGINE_CASCADEBADGE .FightDone: - writetext UnknownText_0x188782 + writetext MistyFightDoneText waitbutton closetext end @@ -139,7 +139,7 @@ CeruleanGymStatue1: checkevent EVENT_TRAINERS_IN_CERULEAN_GYM iffalse CeruleanGymStatue opentext - writetext CeruleanGymNote1 + writetext CeruleanGymNote1Text waitbutton closetext end @@ -148,7 +148,7 @@ CeruleanGymStatue2: checkevent EVENT_TRAINERS_IN_CERULEAN_GYM iffalse CeruleanGymStatue opentext - writetext CeruleanGymNote2 + writetext CeruleanGymNote2Text waitbutton closetext end @@ -195,7 +195,7 @@ CeruleanGymGruntBacksAwayMovement: remove_fixed_facing step_end -UnknownText_0x1884fb: +CeruleanGymGruntIntroText: text "Oops! I so sorry!" line "You not hurt," cont "okay?" @@ -207,13 +207,13 @@ UnknownText_0x1884fb: cont "seen by somebody." done -UnknownText_0x188574: +CeruleanGymGruntBigMistakeText: text "Oh no! You seen" line "me already! I make" cont "big mistake!" done -UnknownText_0x1885a5: +CeruleanGymGruntByeText: text "Hey, you! Forget" line "you see me, okay?" @@ -226,19 +226,19 @@ UnknownText_0x1885a5: para "Bye-bye a go-go!" done -CeruleanGymNote1: +CeruleanGymNote1Text: text "Sorry, I'll be out" line "for a while." cont "MISTY, GYM LEADER" done -CeruleanGymNote2: +CeruleanGymNote2Text: text "Since MISTY's out," line "we'll be away too." cont "GYM TRAINERS" done -UnknownText_0x188674: +MistyIntroText: text "MISTY: I was ex-" line "pecting you, you" cont "pest!" @@ -254,7 +254,7 @@ UnknownText_0x188674: line "#MON are tough!" done -UnknownText_0x18870c: +MistyWinLossText: text "MISTY: You really" line "are good…" @@ -265,12 +265,12 @@ UnknownText_0x18870c: line "CASCADEBADGE." done -UnknownText_0x188768: +ReceivedCascadeBadgeText: text "<PLAYER> received" line "CASCADEBADGE." done -UnknownText_0x188782: +MistyFightDoneText: text "MISTY: Are there" line "many strong train-" cont "ers in JOHTO? Like" diff --git a/maps/EarlsPokemonAcademy.asm b/maps/EarlsPokemonAcademy.asm index 982369994..4fbbb6d89 100644 --- a/maps/EarlsPokemonAcademy.asm +++ b/maps/EarlsPokemonAcademy.asm @@ -15,23 +15,23 @@ AcademyEarl: applymovement EARLSPOKEMONACADEMY_EARL, AcademyEarlSpinMovement faceplayer opentext - writetext UnknownText_0x68b3b + writetext AcademyEarlIntroText yesorno iffalse .Part1 - writetext UnknownText_0x68bbd + writetext AcademyEarlTeachHowToWinText yesorno iffalse .Done .Part1: - writetext UnknownText_0x68c51 + writetext AcademyEarlTeachMoreText yesorno iffalse .Done - writetext UnknownText_0x68c7b + writetext AcademyEarlTeachHowToRaiseWellText waitbutton closetext end .Done: - writetext UnknownText_0x68d31 + writetext AcademyEarlNoMoreToTeachText waitbutton closetext end @@ -161,7 +161,7 @@ AcademyEarlSpinMovement: turn_head DOWN step_end -UnknownText_0x68b3b: +AcademyEarlIntroText: text "EARL, I am!" para "Wonderful are" @@ -176,7 +176,7 @@ UnknownText_0x68b3b: cont "a winner is you?" done -UnknownText_0x68bbd: +AcademyEarlTeachHowToWinText: text "Good! Teach you," line "I will!" @@ -192,13 +192,13 @@ UnknownText_0x68bbd: line "want to hear?" done -UnknownText_0x68c51: +AcademyEarlTeachMoreText: text "So, want to know" line "how to raise" cont "#MON well?" done -UnknownText_0x68c7b: +AcademyEarlTeachHowToRaiseWellText: text "Fine! Teach you," line "I will!" @@ -219,7 +219,7 @@ UnknownText_0x68c7b: cont "become!" done -UnknownText_0x68d31: +AcademyEarlNoMoreToTeachText: text "Oh! Smart student" line "you are! Nothing" cont "more do I teach!" diff --git a/maps/EcruteakGym.asm b/maps/EcruteakGym.asm index 4dd709ec5..8d86f5771 100644 --- a/maps/EcruteakGym.asm +++ b/maps/EcruteakGym.asm @@ -26,10 +26,10 @@ EcruteakGymMortyScript: opentext checkevent EVENT_BEAT_MORTY iftrue .FightDone - writetext UnknownText_0x99e65 + writetext MortyIntroText waitbutton closetext - winlosstext UnknownText_0x9a00a, 0 + winlosstext MortyWinLossText, 0 loadtrainer MORTY, MORTY1 startbattle reloadmapafterbattle @@ -62,7 +62,7 @@ EcruteakGymMortyScript: end .GotShadowBall: - writetext UnknownText_0x9a145 + writetext MortyFightDoneText waitbutton .NoRoomForShadowBall: closetext @@ -83,7 +83,7 @@ EcruteakGymClosed: applymovement PLAYER, EcruteakGymPlayerStepUpMovement applymovement ECRUTEAKGYM_GRAMPS, EcruteakGymGrampsSlowStepDownMovement opentext - writetext UnknownText_0x9a49c + writetext EcruteakGymClosedText waitbutton closetext follow PLAYER, ECRUTEAKGYM_GRAMPS @@ -177,7 +177,7 @@ EcruteakGymGrampsSlowStepDownMovement: slow_step DOWN step_end -UnknownText_0x99e65: +MortyIntroText: text "Good of you to" line "have come." @@ -218,7 +218,7 @@ UnknownText_0x99e65: cont "level!" done -UnknownText_0x9a00a: +MortyWinLossText: text "I'm not good" line "enough yet…" @@ -259,7 +259,7 @@ MortyText_ShadowBallSpeech: line "appeals to you." done -UnknownText_0x9a145: +MortyFightDoneText: text "I see…" para "Your journey has" @@ -374,7 +374,7 @@ EcruteakGymGuyWinText: cont "pure terror!" done -UnknownText_0x9a49c: +EcruteakGymClosedText: text "MORTY, the GYM" line "LEADER, is absent." diff --git a/maps/ElmsLab.asm b/maps/ElmsLab.asm index 2deaf2016..d2cf87d2f 100644 --- a/maps/ElmsLab.asm +++ b/maps/ElmsLab.asm @@ -111,7 +111,7 @@ ElmCheckEverstone: writebyte TOGETIC special FindPartyMonThatSpeciesYourTrainerID iftrue ShowElmTogepiScript - writetext UnknownText_0x79a40 + writetext ElmThoughtEggHatchedText waitbutton closetext end @@ -1064,7 +1064,7 @@ ElmWaitingEggHatchText: line "EGG changed any?" done -UnknownText_0x79a40: +ElmThoughtEggHatchedText: text "<PLAY_G>? I thought" line "the EGG hatched." diff --git a/maps/FastShip1F.asm b/maps/FastShip1F.asm index 8b6b50419..0d3b3fc62 100644 --- a/maps/FastShip1F.asm +++ b/maps/FastShip1F.asm @@ -127,7 +127,7 @@ WorriedGrandpaSceneLeft: applymovement PLAYER, MovementData_0x7522e applymovement FASTSHIP1F_GENTLEMAN, MovementData_0x75220 opentext - writetext UnknownText_0x75412 + writetext FastShip1FGrandpaText waitbutton closetext turnobject PLAYER, RIGHT @@ -257,7 +257,7 @@ FastShip1FSailor3Text: cont "their cabins." done -UnknownText_0x75412: +FastShip1FGrandpaText: text "Whoa! Excuse me." line "I was in a hurry!" diff --git a/maps/FastShipB1F.asm b/maps/FastShipB1F.asm index 7eb6813c7..a8c1cafdd 100644 --- a/maps/FastShipB1F.asm +++ b/maps/FastShipB1F.asm @@ -57,7 +57,7 @@ FastShipB1FSailorScript: iftrue .LazySailor checkevent EVENT_FAST_SHIP_INFORMED_ABOUT_LAZY_SAILOR iftrue .AlreadyInformed - writetext UnknownText_0x7687b + writetext FastShipB1FOnDutySailorText waitbutton closetext setevent EVENT_FAST_SHIP_INFORMED_ABOUT_LAZY_SAILOR @@ -65,13 +65,13 @@ FastShipB1FSailorScript: end .AlreadyInformed: - writetext UnknownText_0x76907 + writetext FastShipB1FOnDutySailorRefusedText waitbutton closetext end .LazySailor: - writetext UnknownText_0x7692e + writetext FastShipB1FOnDutySailorThanksText checkevent EVENT_FAST_SHIP_FOUND_GIRL iffalse .NotFoundGirl waitbutton @@ -80,13 +80,13 @@ FastShipB1FSailorScript: .NotFoundGirl: buttonsound - writetext UnknownText_0x7696d + writetext FastShipB1FOnDutySailorSawLittleGirlText waitbutton closetext end .FirstTime: - writetext UnknownText_0x7699d + writetext FastShipB1FOnDutySailorDirectionsText waitbutton closetext end @@ -218,7 +218,7 @@ FashShipB1FSailorBlocksLeftMovement: turn_head DOWN step_end -UnknownText_0x7687b: +FastShipB1FOnDutySailorText: text "Hey, kid. Could I" line "get you to look" cont "for my buddy?" @@ -232,14 +232,14 @@ UnknownText_0x7687b: cont "duty right now." done -UnknownText_0x76907: +FastShipB1FOnDutySailorRefusedText: text "Oh, gee…" para "The CAPTAIN will" line "be furious…" done -UnknownText_0x7692e: +FastShipB1FOnDutySailorThanksText: text "Thanks, kid!" line "I chewed him out" @@ -247,14 +247,14 @@ UnknownText_0x7692e: line "slacking off!" done -UnknownText_0x7696d: +FastShipB1FOnDutySailorSawLittleGirlText: text "A little girl?" para "I may have seen" line "her go by here." done -UnknownText_0x7699d: +FastShipB1FOnDutySailorDirectionsText: text "The dining room is" line "up ahead." diff --git a/maps/FastShipCabins_NNW_NNE_NE.asm b/maps/FastShipCabins_NNW_NNE_NE.asm index c2af9728b..2f52b0c14 100644 --- a/maps/FastShipCabins_NNW_NNE_NE.asm +++ b/maps/FastShipCabins_NNW_NNE_NE.asm @@ -82,17 +82,17 @@ FastShipLazySailorScript: playmusic MUSIC_HIKER_ENCOUNTER faceplayer opentext - writetext UnknownText_0x75812 + writetext SailorStanlySeenText waitbutton closetext - winlosstext UnknownText_0x75897, 0 + winlosstext SailorStanlyBeatenText, 0 loadtrainer SAILOR, STANLY startbattle reloadmap special HealParty setevent EVENT_BEAT_SAILOR_STANLY opentext - writetext UnknownText_0x758b1 + writetext SailorStanlyAfterBattleText waitbutton closetext setevent EVENT_FAST_SHIP_LAZY_SAILOR @@ -200,7 +200,7 @@ HikerNolandAfterBattleText: line "KANTO?" done -UnknownText_0x75812: +SailorStanlySeenText: text "Yeah, I'm a sail-" line "or, all right." @@ -215,12 +215,12 @@ UnknownText_0x75812: line "Let's battle!" done -UnknownText_0x75897: +SailorStanlyBeatenText: text "Sorry! It's all my" line "fault!" done -UnknownText_0x758b1: +SailorStanlyAfterBattleText: text "Being a sailor, I" line "have to do phys-" cont "ical labor. It's" diff --git a/maps/FastShipCabins_SW_SSW_NW.asm b/maps/FastShipCabins_SW_SSW_NW.asm index ab1a27b13..2d38d5439 100644 --- a/maps/FastShipCabins_SW_SSW_NW.asm +++ b/maps/FastShipCabins_SW_SSW_NW.asm @@ -50,14 +50,14 @@ TrainerGuitaristClyde: special Mobile_DummyReturnFalse iftrue .mobile opentext - writetext UnknownText_0x75d65 + writetext GuitaristClydeAfterBattleText waitbutton closetext end .mobile opentext - writetext UnknownText_0x75cfe + writetext GuitaristClydeAfterBattleMobileText waitbutton closetext end @@ -180,7 +180,7 @@ GuitaristClydeBeatenText: line "Total distortion!" done -UnknownText_0x75cfe: +GuitaristClydeAfterBattleMobileText: text "I was going to" line "make my debut at" cont "the BATTLE TOWER…" @@ -190,7 +190,7 @@ UnknownText_0x75cfe: cont "redo my training…" done -UnknownText_0x75d65: +GuitaristClydeAfterBattleText: text "Speaking of the" line "RADIO STATION," diff --git a/maps/GoldenrodBikeShop.asm b/maps/GoldenrodBikeShop.asm index 62a1902e9..caf328d14 100644 --- a/maps/GoldenrodBikeShop.asm +++ b/maps/GoldenrodBikeShop.asm @@ -14,27 +14,27 @@ GoldenrodBikeShopClerkScript: opentext checkevent EVENT_GOT_BICYCLE iftrue .GotBicycle - writetext UnknownText_0x54787 + writetext GoldenrodBikeShopClerkIntroText yesorno iffalse .Refused - writetext UnknownText_0x547f8 + writetext GoldenrodBikeShopClerkAgreedText buttonsound waitsfx giveitem BICYCLE - writetext UnknownText_0x54848 + writetext BorrowedABicycleText playsound SFX_KEY_ITEM waitsfx itemnotify setflag ENGINE_BIKE_SHOP_CALL_ENABLED setevent EVENT_GOT_BICYCLE .GotBicycle: - writetext UnknownText_0x5485f + writetext GoldenrodBikeShopClerkFirstRateBikesText waitbutton closetext end .Refused: - writetext UnknownText_0x54898 + writetext GoldenrodBikeShopClerkRefusedText waitbutton closetext end @@ -46,7 +46,7 @@ GoldenrodBikeShopJustReleasedCompactBike: GoldenrodBikeShopBicycle: jumptext GoldenrodBikeShopBicycleText -UnknownText_0x54787: +GoldenrodBikeShopClerkIntroText: text "…sigh… I moved" line "here, but I can't" @@ -58,7 +58,7 @@ UnknownText_0x54787: cont "tise for me?" done -UnknownText_0x547f8: +GoldenrodBikeShopClerkAgreedText: text "Really? Great!" para "Give me your name" @@ -68,12 +68,12 @@ UnknownText_0x547f8: line "a BICYCLE." done -UnknownText_0x54848: +BorrowedABicycleText: text "<PLAYER> borrowed a" line "BICYCLE." done -UnknownText_0x5485f: +GoldenrodBikeShopClerkFirstRateBikesText: text "My BICYCLES are" line "first-rate! You" @@ -81,13 +81,12 @@ UnknownText_0x5485f: line "anywhere." done -UnknownText_0x54898: +GoldenrodBikeShopClerkRefusedText: text "…sigh… Oh, for" line "the kindness of" cont "people…" done -; possibly unused GoldenrodBikeShopJustReleasedCompactBikeText: text "Just released!" diff --git a/maps/GoldenrodCity.asm b/maps/GoldenrodCity.asm index 51041345f..6afe0df5c 100644 --- a/maps/GoldenrodCity.asm +++ b/maps/GoldenrodCity.asm @@ -13,7 +13,7 @@ const GOLDENRODCITY_ROCKET4 const GOLDENRODCITY_ROCKET5 const GOLDENRODCITY_ROCKET6 - const GOLDENRODCITY_POKEFAN_M2 + const GOLDENRODCITY_MOVETUTOR GoldenrodCity_MapScripts: db 0 ; scene scripts @@ -40,13 +40,13 @@ GoldenrodCity_MapScripts: ifequal WEDNESDAY, .MoveTutorAppear ifequal SATURDAY, .MoveTutorAppear .MoveTutorDisappear: - disappear GOLDENRODCITY_POKEFAN_M2 + disappear GOLDENRODCITY_MOVETUTOR return .MoveTutorAppear: checkflag ENGINE_DAILY_MOVE_TUTOR iftrue .MoveTutorDone - appear GOLDENRODCITY_POKEFAN_M2 + appear GOLDENRODCITY_MOVETUTOR .MoveTutorDone: return @@ -130,14 +130,14 @@ MoveTutorScript: closetext checkcode VAR_FACING ifequal LEFT, .WalkAroundPlayer - applymovement GOLDENRODCITY_POKEFAN_M2, MovementData_0x198a5f + applymovement GOLDENRODCITY_MOVETUTOR, MovementData_0x198a5f jump .GoInside .WalkAroundPlayer: - applymovement GOLDENRODCITY_POKEFAN_M2, MovementData_0x198a63 + applymovement GOLDENRODCITY_MOVETUTOR, MovementData_0x198a63 .GoInside: playsound SFX_ENTER_DOOR - disappear GOLDENRODCITY_POKEFAN_M2 + disappear GOLDENRODCITY_MOVETUTOR clearevent EVENT_GOLDENROD_GAME_CORNER_MOVE_TUTOR setflag ENGINE_DAILY_MOVE_TUTOR waitsfx diff --git a/maps/GoldenrodDeptStoreB1F.asm b/maps/GoldenrodDeptStoreB1F.asm index 9c08c4198..d34dcfbe3 100644 --- a/maps/GoldenrodDeptStoreB1F.asm +++ b/maps/GoldenrodDeptStoreB1F.asm @@ -55,7 +55,7 @@ GoldenrodDeptStoreB1FBlackBelt3Script: GoldenrodDeptStoreB1FMachopScript: opentext - writetext UnknownText_0x7d8bb + writetext GoldenrodDeptStoreB1FMachokeText cry MACHOKE waitbutton closetext @@ -103,7 +103,7 @@ GoldenrodDeptStoreB1FBlackBelt3Text: line "want it!" done -UnknownText_0x7d8bb: +GoldenrodDeptStoreB1FMachokeText: text "MACHOKE: Maaacho!" done diff --git a/maps/GoldenrodDeptStoreRoof.asm b/maps/GoldenrodDeptStoreRoof.asm index f385a3e8a..187d7b69b 100644 --- a/maps/GoldenrodDeptStoreRoof.asm +++ b/maps/GoldenrodDeptStoreRoof.asm @@ -49,7 +49,7 @@ GoldenrodDeptStoreRoofPokefanFScript: GoldenrodDeptStoreRoofFisherScript: faceplayer opentext - writetext UnknownText_0x567d2 + writetext GoldenrodDeptStoreRoofFisherText waitbutton closetext turnobject GOLDENRODDEPTSTOREROOF_FISHER, UP @@ -60,12 +60,12 @@ GoldenrodDeptStoreRoofTwinScript: GoldenrodDeptStoreRoofSuperNerdScript: opentext - writetext UnknownText_0x56867 + writetext GoldenrodDeptStoreRoofSuperNerdOhWowText waitbutton closetext turnobject GOLDENRODDEPTSTOREROOF_SUPER_NERD, UP opentext - writetext UnknownText_0x56871 + writetext GoldenrodDeptStoreRoofSuperNerdQuitBotheringMeText waitbutton closetext turnobject GOLDENRODDEPTSTOREROOF_SUPER_NERD, RIGHT @@ -102,7 +102,7 @@ GoldenrodDeptStoreRoofPokefanFText: line "from shopping." done -UnknownText_0x567d2: +GoldenrodDeptStoreRoofFisherText: text "Pardon? Who says" line "an adult can't get" cont "into this?" @@ -120,11 +120,11 @@ GoldenrodDeptStoreRoofTwinText: cont "so often." done -UnknownText_0x56867: +GoldenrodDeptStoreRoofSuperNerdOhWowText: text "Oh, wow!" done -UnknownText_0x56871: +GoldenrodDeptStoreRoofSuperNerdQuitBotheringMeText: text "Will you quit" line "bothering me?" done diff --git a/maps/GoldenrodGameCorner.asm b/maps/GoldenrodGameCorner.asm index 288ec01d3..fbffa8229 100644 --- a/maps/GoldenrodGameCorner.asm +++ b/maps/GoldenrodGameCorner.asm @@ -10,15 +10,15 @@ const GOLDENRODGAMECORNER_COOLTRAINER_F const GOLDENRODGAMECORNER_GENTLEMAN const GOLDENRODGAMECORNER_POKEFAN_M2 - const GOLDENRODGAMECORNER_POKEFAN_M3 + const GOLDENRODGAMECORNER_MOVETUTOR GoldenrodGameCorner_MapScripts: db 0 ; scene scripts db 1 ; callbacks - callback MAPCALLBACK_OBJECTS, .Callback + callback MAPCALLBACK_OBJECTS, .MoveTutor -.Callback: +.MoveTutor: checkevent EVENT_BEAT_ELITE_FOUR iffalse .finish checkitem COIN_CASE @@ -27,23 +27,23 @@ GoldenrodGameCorner_MapScripts: ifequal WEDNESDAY, .move_tutor_outside ifequal SATURDAY, .move_tutor_outside .move_tutor_inside - appear GOLDENRODGAMECORNER_POKEFAN_M3 + appear GOLDENRODGAMECORNER_MOVETUTOR return .move_tutor_outside checkflag ENGINE_DAILY_MOVE_TUTOR iftrue .finish - disappear GOLDENRODGAMECORNER_POKEFAN_M3 + disappear GOLDENRODGAMECORNER_MOVETUTOR .finish return -GoldenrodGameCornerPokefanM3Script: +MoveTutorInsideScript: faceplayer opentext - writetext GoldenrodGameCornerPokefanM3Text + writetext MoveTutorInsideText waitbutton closetext - turnobject GOLDENRODGAMECORNER_POKEFAN_M3, RIGHT + turnobject GOLDENRODGAMECORNER_MOVETUTOR, RIGHT end GoldenrodGameCornerCoinVendorScript: @@ -422,7 +422,7 @@ GoldenrodGameCornerPokefanM2Text: line "UNDERGROUND." done -GoldenrodGameCornerPokefanM3Text: +MoveTutorInsideText: text "Wahahah! The coins" line "keep rolling in!" done @@ -488,4 +488,4 @@ GoldenrodGameCorner_MapEvents: object_event 10, 3, SPRITE_COOLTRAINER_F, SPRITEMOVEDATA_WANDER, 2, 1, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 0, GoldenrodGameCornerCooltrainerFScript, -1 object_event 5, 10, SPRITE_GENTLEMAN, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, GoldenrodGameCornerGentlemanScript, -1 object_event 2, 9, SPRITE_POKEFAN_M, SPRITEMOVEDATA_WANDER, 1, 1, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_SCRIPT, 0, GoldenrodGameCornerPokefanM2Script, -1 - object_event 17, 10, SPRITE_POKEFAN_M, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, GoldenrodGameCornerPokefanM3Script, EVENT_GOLDENROD_GAME_CORNER_MOVE_TUTOR + object_event 17, 10, SPRITE_POKEFAN_M, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, MoveTutorInsideScript, EVENT_GOLDENROD_GAME_CORNER_MOVE_TUTOR diff --git a/maps/GoldenrodUndergroundWarehouse.asm b/maps/GoldenrodUndergroundWarehouse.asm index b650ac975..49c4582d8 100644 --- a/maps/GoldenrodUndergroundWarehouse.asm +++ b/maps/GoldenrodUndergroundWarehouse.asm @@ -71,17 +71,17 @@ GoldenrodUndergroundWarehouseDirectorScript: opentext checkevent EVENT_RECEIVED_CARD_KEY iftrue .GotCardKey - writetext UnknownText_0x7dbc6 + writetext DirectorIntroText buttonsound verbosegiveitem CARD_KEY setevent EVENT_RECEIVED_CARD_KEY setevent EVENT_GOLDENROD_DEPT_STORE_B1F_LAYOUT_1 clearevent EVENT_GOLDENROD_DEPT_STORE_B1F_LAYOUT_2 clearevent EVENT_GOLDENROD_DEPT_STORE_B1F_LAYOUT_3 - writetext UnknownText_0x7dc5b + writetext DirectorCardKeyText buttonsound .GotCardKey: - writetext UnknownText_0x7dc8d + writetext DirectorAfterText waitbutton closetext end @@ -157,7 +157,7 @@ GruntM15AfterBattleText: cont "I'll remember you!" done -UnknownText_0x7dbc6: +DirectorIntroText: text "DIRECTOR: Who?" line "What? You came to" cont "rescue me?" @@ -176,13 +176,13 @@ UnknownText_0x7dbc6: line "CARD KEY." done -UnknownText_0x7dc5b: +DirectorCardKeyText: text "DIRECTOR: Use that" line "to open the shut-" cont "ters on 3F." done -UnknownText_0x7dc8d: +DirectorAfterText: text "I'm begging you to" line "help." diff --git a/maps/IlexForest.asm b/maps/IlexForest.asm index 806ce41d3..91f6ad6d2 100644 --- a/maps/IlexForest.asm +++ b/maps/IlexForest.asm @@ -89,13 +89,13 @@ IlexForestCharcoalApprenticeScript: opentext checkevent EVENT_HERDED_FARFETCHD iftrue .DoneFarfetchd - writetext UnknownText_0x6ef5c + writetext IlexForestApprenticeIntroText waitbutton closetext end .DoneFarfetchd: - writetext UnknownText_0x6f019 + writetext IlexForestApprenticeAfterText waitbutton closetext end @@ -736,7 +736,7 @@ MovementData_0x6ef58: remove_fixed_facing step_end -UnknownText_0x6ef5c: +IlexForestApprenticeIntroText: text "Oh, man… My boss" line "is going to be" cont "steaming…" @@ -755,7 +755,7 @@ UnknownText_0x6ef5c: line "and scary for me…" done -UnknownText_0x6f019: +IlexForestApprenticeAfterText: text "Wow! Thanks a" line "whole bunch!" diff --git a/maps/MahoganyTown.asm b/maps/MahoganyTown.asm index 0f7f702f1..872303b06 100644 --- a/maps/MahoganyTown.asm +++ b/maps/MahoganyTown.asm @@ -43,14 +43,14 @@ RageCandyBarMerchantScript: .ClearedRocketHideout: opentext - writetext RageCandyBarMerchantText_SoldOut + writetext RageCandyBarMerchantSoldOutText waitbutton closetext end .SellRageCandyBars: opentext - writetext RageCandyBarMerchantText_TryOne + writetext RageCandyBarMerchantTryOneText special PlaceMoneyTopRight yesorno iffalse .Refused @@ -62,25 +62,25 @@ RageCandyBarMerchantScript: playsound SFX_TRANSACTION takemoney YOUR_MONEY, 300 special PlaceMoneyTopRight - writetext RageCandyBarMerchantText_SavorIt + writetext RageCandyBarMerchantSavorItText waitbutton closetext end .NotEnoughMoney: - writetext RageCandyBarMerchantText_NotEnoughMoney + writetext RageCandyBarMerchantNotEnoughMoneyText waitbutton closetext end .Refused: - writetext RageCandyBarMerchantText_Refused + writetext RageCandyBarMerchantRefusedText waitbutton closetext end .NoRoom: - writetext UnknownText_0x190188 + writetext RageCandyBarMerchantNoRoomText waitbutton closetext end @@ -138,7 +138,7 @@ MovementData_0x1900ad: turn_head DOWN step_end -RageCandyBarMerchantText_TryOne: +RageCandyBarMerchantTryOneText: text "Hiya, kid!" para "I see you're new" @@ -155,25 +155,25 @@ RageCandyBarMerchantText_TryOne: cont "¥300! Want one?" done -RageCandyBarMerchantText_SavorIt: +RageCandyBarMerchantSavorItText: text "Good! Savor it!" done -RageCandyBarMerchantText_NotEnoughMoney: +RageCandyBarMerchantNotEnoughMoneyText: text "You don't have" line "enough money." done -RageCandyBarMerchantText_Refused: +RageCandyBarMerchantRefusedText: text "Oh, fine then…" done -UnknownText_0x190188: +RageCandyBarMerchantNoRoomText: text "You don't have" line "room for this." done -RageCandyBarMerchantText_SoldOut: +RageCandyBarMerchantSoldOutText: text "RAGECANDYBAR's" line "sold out." diff --git a/maps/NationalParkBugContest.asm b/maps/NationalParkBugContest.asm index bf2911e3a..75623e360 100644 --- a/maps/NationalParkBugContest.asm +++ b/maps/NationalParkBugContest.asm @@ -20,7 +20,7 @@ NationalParkBugContest_MapScripts: BugCatchingContestant1AScript: faceplayer opentext - writetext UnknownText_0x5c94c + writetext BugCatchingContestant1AText waitbutton closetext end @@ -28,7 +28,7 @@ BugCatchingContestant1AScript: BugCatchingContestant2AScript: faceplayer opentext - writetext UnknownText_0x5c973 + writetext BugCatchingContestant2AText waitbutton closetext end @@ -36,7 +36,7 @@ BugCatchingContestant2AScript: BugCatchingContestant3AScript: faceplayer opentext - writetext UnknownText_0x5c9a3 + writetext BugCatchingContestant3AText waitbutton closetext end @@ -44,7 +44,7 @@ BugCatchingContestant3AScript: BugCatchingContestant4AScript: faceplayer opentext - writetext UnknownText_0x5c9cc + writetext BugCatchingContestant4AText waitbutton closetext end @@ -52,7 +52,7 @@ BugCatchingContestant4AScript: BugCatchingContestant5AScript: faceplayer opentext - writetext UnknownText_0x5ca15 + writetext BugCatchingContestant5AText waitbutton closetext end @@ -60,7 +60,7 @@ BugCatchingContestant5AScript: BugCatchingContestant6AScript: faceplayer opentext - writetext UnknownText_0x5ca52 + writetext BugCatchingContestant6AText waitbutton closetext end @@ -68,7 +68,7 @@ BugCatchingContestant6AScript: BugCatchingContestant7AScript: faceplayer opentext - writetext UnknownText_0x5ca8f + writetext BugCatchingContestant7AText waitbutton closetext end @@ -76,7 +76,7 @@ BugCatchingContestant7AScript: BugCatchingContestant8AScript: faceplayer opentext - writetext UnknownText_0x5cac8 + writetext BugCatchingContestant8AText waitbutton closetext end @@ -84,7 +84,7 @@ BugCatchingContestant8AScript: BugCatchingContestant9AScript: faceplayer opentext - writetext UnknownText_0x5cb25 + writetext BugCatchingContestant9AText waitbutton closetext end @@ -92,7 +92,7 @@ BugCatchingContestant9AScript: BugCatchingContestant10AScript: faceplayer opentext - writetext UnknownText_0x5cb64 + writetext BugCatchingContestant10AText waitbutton closetext end @@ -115,25 +115,25 @@ NationalParkBugContestTMDig: NationalParkBugContestHiddenFullHeal: hiddenitem FULL_HEAL, EVENT_NATIONAL_PARK_HIDDEN_FULL_HEAL -UnknownText_0x5c94c: +BugCatchingContestant1AText: text "DON: I'm going to" line "win! Don't bother" cont "me." done -UnknownText_0x5c973: +BugCatchingContestant2AText: text "ED: My PARASECT" line "puts #MON to" cont "sleep with SPORE." done -UnknownText_0x5c9a3: +BugCatchingContestant3AText: text "NICK: I'm raising" line "fast #MON for" cont "battles." done -UnknownText_0x5c9cc: +BugCatchingContestant4AText: text "WILLIAM: I'm not" line "concerned about" cont "winning." @@ -142,7 +142,7 @@ UnknownText_0x5c9cc: line "for rare #MON." done -UnknownText_0x5ca15: +BugCatchingContestant5AText: text "BENNY: Ssh! You'll" line "scare off SCYTHER." @@ -150,7 +150,7 @@ UnknownText_0x5ca15: line "later." done -UnknownText_0x5ca52: +BugCatchingContestant6AText: text "BARRY: You should" line "weaken bug #MON" @@ -158,7 +158,7 @@ UnknownText_0x5ca52: line "a BALL." done -UnknownText_0x5ca8f: +BugCatchingContestant7AText: text "CINDY: I love bug" line "#MON." @@ -166,7 +166,7 @@ UnknownText_0x5ca8f: line "like them too." done -UnknownText_0x5cac8: +BugCatchingContestant8AText: text "JOSH: I've been" line "collecting bug" @@ -177,7 +177,7 @@ UnknownText_0x5cac8: line "going to lose!" done -UnknownText_0x5cb25: +BugCatchingContestant9AText: text "SAMUEL: If you've" line "got the time to" @@ -185,7 +185,7 @@ UnknownText_0x5cb25: line "bug #MON." done -UnknownText_0x5cb64: +BugCatchingContestant10AText: text "KIPP: I've studied" line "about bug #MON" cont "a lot." diff --git a/maps/OlivineCity.asm b/maps/OlivineCity.asm index f93c584dc..03d0cf7c2 100644 --- a/maps/OlivineCity.asm +++ b/maps/OlivineCity.asm @@ -33,7 +33,7 @@ OlivineCityRivalSceneTop: applymovement OLIVINECITY_OLIVINE_RIVAL, MovementData_0x1a88d2 playmusic MUSIC_RIVAL_ENCOUNTER opentext - writetext UnknownText_0x1a88fa + writetext OlivineCityRivalText waitbutton closetext applymovement PLAYER, MovementData_0x1a88f4 @@ -57,7 +57,7 @@ OlivineCityRivalSceneBottom: applymovement OLIVINECITY_OLIVINE_RIVAL, MovementData_0x1a88d6 playmusic MUSIC_RIVAL_ENCOUNTER opentext - writetext UnknownText_0x1a88fa + writetext OlivineCityRivalText waitbutton closetext applymovement PLAYER, MovementData_0x1a88f7 @@ -165,7 +165,7 @@ MovementData_0x1a88f7: turn_head DOWN step_end -UnknownText_0x1a88fa: +OlivineCityRivalText: text "…" para "You again?" diff --git a/maps/PewterGym.asm b/maps/PewterGym.asm index e01352895..c5e39a1c2 100644 --- a/maps/PewterGym.asm +++ b/maps/PewterGym.asm @@ -13,27 +13,27 @@ PewterGymBrockScript: opentext checkflag ENGINE_BOULDERBADGE iftrue .FightDone - writetext UnknownText_0x1a28d0 + writetext BrockIntroText waitbutton closetext - winlosstext UnknownText_0x1a29bb, 0 + winlosstext BrockWinLossText, 0 loadtrainer BROCK, BROCK1 startbattle reloadmapafterbattle setevent EVENT_BEAT_BROCK setevent EVENT_BEAT_CAMPER_JERRY opentext - writetext UnknownText_0x1a2a3d + writetext ReceivedBoulderBadgeText playsound SFX_GET_BADGE waitsfx setflag ENGINE_BOULDERBADGE - writetext UnknownText_0x1a2a57 + writetext BrockBoulderBadgeText waitbutton closetext end .FightDone: - writetext UnknownText_0x1a2ada + writetext BrockFightDoneText waitbutton closetext end @@ -73,7 +73,7 @@ PewterGymStatue: trainertotext BROCK, BROCK1, MEM_BUFFER_1 jumpstd gymstatue2 -UnknownText_0x1a28d0: +BrockIntroText: text "BROCK: Wow, it's" line "not often that we" @@ -98,7 +98,7 @@ UnknownText_0x1a28d0: para "Come on!" done -UnknownText_0x1a29bb: +BrockWinLossText: text "BROCK: Your #-" line "MON's powerful at-" cont "tacks overcame my" @@ -111,12 +111,12 @@ UnknownText_0x1a29bb: line "this BADGE." done -UnknownText_0x1a2a3d: +ReceivedBoulderBadgeText: text "<PLAYER> received" line "BOULDERBADGE." done -UnknownText_0x1a2a57: +BrockBoulderBadgeText: text "BROCK: <PLAY_G>," line "thanks. I enjoyed" @@ -131,7 +131,7 @@ UnknownText_0x1a2a57: line "powerful." done -UnknownText_0x1a2ada: +BrockFightDoneText: text "BROCK: The world" line "is huge. There are" diff --git a/maps/Route12SuperRodHouse.asm b/maps/Route12SuperRodHouse.asm index cd2ebd6cb..f91e78026 100644 --- a/maps/Route12SuperRodHouse.asm +++ b/maps/Route12SuperRodHouse.asm @@ -11,22 +11,22 @@ Route12SuperRodHouseFishingGuruScript: opentext checkevent EVENT_GOT_SUPER_ROD iftrue .GotSuperRod - writetext UnknownText_0x7f4af + writetext OfferSuperRodText yesorno iffalse .Refused - writetext UnknownText_0x7f52f + writetext GiveSuperRodText buttonsound verbosegiveitem SUPER_ROD iffalse .NoRoom setevent EVENT_GOT_SUPER_ROD .GotSuperRod: - writetext UnknownText_0x7f57c + writetext GaveSuperRodText waitbutton closetext end .Refused: - writetext UnknownText_0x7f5ec + writetext DontWantSuperRodText waitbutton .NoRoom: closetext @@ -36,7 +36,7 @@ SuperRodHouseBookshelf: ; unused jumpstd picturebookshelf -UnknownText_0x7f4af: +OfferSuperRodText: text "I'm the FISHING" line "GURU's younger" cont "brother." @@ -51,7 +51,7 @@ UnknownText_0x7f4af: line "right." done -UnknownText_0x7f52f: +GiveSuperRodText: text "Yes, yes. Just as" line "I thought!" @@ -60,7 +60,7 @@ UnknownText_0x7f52f: cont "SUPER ROD." done -UnknownText_0x7f57c: +GaveSuperRodText: text "Try your hand at" line "fishing wherever" cont "there is water." @@ -72,7 +72,7 @@ UnknownText_0x7f57c: line "different RODS." done -UnknownText_0x7f5ec: +DontWantSuperRodText: text "Huh? My own eyes" line "deceived me?" done diff --git a/maps/Route24.asm b/maps/Route24.asm index 227503e73..903ff57d0 100644 --- a/maps/Route24.asm +++ b/maps/Route24.asm @@ -10,20 +10,20 @@ Route24RocketScript: faceplayer playmusic MUSIC_ROCKET_ENCOUNTER opentext - writetext UnknownText_0x1adc2e + writetext Route24RocketSeenText waitbutton closetext - winlosstext UnknownText_0x1add67, -1 + winlosstext Route24RocketBeatenText, -1 loadtrainer GRUNTM, GRUNTM_31 startbattle dontrestartmapmusic reloadmapafterbattle playmusic MUSIC_ROCKET_ENCOUNTER opentext - writetext UnknownText_0x1addc0 + writetext Route24RocketAfterBattleText buttonsound special FadeOutMusic - writetext UnknownText_0x1adee1 + writetext Route24RocketDisappearsText waitbutton closetext special FadeBlackQuickly @@ -34,7 +34,7 @@ Route24RocketScript: playmapmusic end -UnknownText_0x1adc2e: +Route24RocketSeenText: text "Hey, kid! Me am a" line "TEAM ROCKET member" cont "kind of guy!" @@ -63,7 +63,7 @@ UnknownText_0x1adc2e: line "begin we do!" done -UnknownText_0x1add67: +Route24RocketBeatenText: text "Ayieeeh! No, no," line "no, believe it I" cont "can't!" @@ -73,7 +73,7 @@ UnknownText_0x1add67: cont "not to you!" done -UnknownText_0x1addc0: +Route24RocketAfterBattleText: text "OK. Tell you mine" line "secret will I." @@ -102,7 +102,7 @@ UnknownText_0x1addc0: line "revenge they are." done -UnknownText_0x1adee1: +Route24RocketDisappearsText: text "…" para "You say what? TEAM" diff --git a/maps/Route26HealHouse.asm b/maps/Route26HealHouse.asm index c90025032..3820defce 100644 --- a/maps/Route26HealHouse.asm +++ b/maps/Route26HealHouse.asm @@ -9,7 +9,7 @@ Route26HealHouse_MapScripts: Route26HealHouseTeacherScript: faceplayer opentext - writetext UnknownText_0x7b14d + writetext Route26HealHouseRestAWhileText waitbutton closetext special FadeBlackQuickly @@ -21,7 +21,7 @@ Route26HealHouseTeacherScript: special FadeInQuickly special RestartMapMusic opentext - writetext UnknownText_0x7b18b + writetext Route26HealHouseKeepAtItText waitbutton closetext end @@ -29,7 +29,7 @@ Route26HealHouseTeacherScript: Route26HealHouseBookshelf: jumpstd picturebookshelf -UnknownText_0x7b14d: +Route26HealHouseRestAWhileText: text "Your #MON look" line "a little tired." @@ -37,7 +37,7 @@ UnknownText_0x7b14d: line "them a while." done -UnknownText_0x7b18b: +Route26HealHouseKeepAtItText: text "There!" para "Your #MON are" diff --git a/maps/Route29.asm b/maps/Route29.asm index 1a1f83e94..3b3322f13 100644 --- a/maps/Route29.asm +++ b/maps/Route29.asm @@ -125,7 +125,7 @@ CatchingTutorialDudeScript: end .BoxFull: - writetext UnknownText_0x1a10a7 + writetext CatchingTutorialBoxFullText waitbutton closetext end @@ -246,7 +246,7 @@ DudeMovementData2b: step DOWN step_end -UnknownText_0x1a10a7: +CatchingTutorialBoxFullText: text "#MON hide in" line "the grass. Who" diff --git a/maps/Route36NationalParkGate.asm b/maps/Route36NationalParkGate.asm index 7faddf989..417dd346a 100644 --- a/maps/Route36NationalParkGate.asm +++ b/maps/Route36NationalParkGate.asm @@ -308,13 +308,13 @@ BugCatchingContestant1BScript: opentext checkevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1 iffalse .StillCompeting - writetext UnknownText_0x6b399 + writetext BugCatchingContestant1BText waitbutton closetext end .StillCompeting: - writetext UnknownText_0x6b3c4 + writetext BugCatchingContestant1BStillCompetingText waitbutton closetext end @@ -324,13 +324,13 @@ BugCatchingContestant2BScript: opentext checkevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1 iffalse .StillCompeting - writetext UnknownText_0x6b40f + writetext BugCatchingContestant2BText waitbutton closetext end .StillCompeting: - writetext UnknownText_0x6b440 + writetext BugCatchingContestant2BStillCompetingText waitbutton closetext end @@ -340,13 +340,13 @@ BugCatchingContestant3BScript: opentext checkevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1 iffalse .StillCompeting - writetext UnknownText_0x6b462 + writetext BugCatchingContestant3BText waitbutton closetext end .StillCompeting: - writetext UnknownText_0x6b496 + writetext BugCatchingContestant3BStillCompetingText waitbutton closetext end @@ -356,13 +356,13 @@ BugCatchingContestant4BScript: opentext checkevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1 iffalse .StillCompeting - writetext UnknownText_0x6b4da + writetext BugCatchingContestant4BText waitbutton closetext end .StillCompeting: - writetext UnknownText_0x6b50a + writetext BugCatchingContestant4BStillCompetingText waitbutton closetext end @@ -372,13 +372,13 @@ BugCatchingContestant5BScript: opentext checkevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1 iffalse .StillCompeting - writetext UnknownText_0x6b54e + writetext BugCatchingContestant5BText waitbutton closetext end .StillCompeting: - writetext UnknownText_0x6b57c + writetext BugCatchingContestant5BStillCompetingText waitbutton closetext end @@ -388,13 +388,13 @@ BugCatchingContestant6BScript: opentext checkevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1 iffalse .StillCompeting - writetext UnknownText_0x6b5b0 + writetext BugCatchingContestant6BText waitbutton closetext end .StillCompeting: - writetext UnknownText_0x6b5dd + writetext BugCatchingContestant6BStillCompetingText waitbutton closetext end @@ -404,13 +404,13 @@ BugCatchingContestant7BScript: opentext checkevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1 iffalse .StillCompeting - writetext UnknownText_0x6b64b + writetext BugCatchingContestant7BText waitbutton closetext end .StillCompeting: - writetext UnknownText_0x6b698 + writetext BugCatchingContestant7BStillCompetingText waitbutton closetext end @@ -420,13 +420,13 @@ BugCatchingContestant8BScript: opentext checkevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1 iffalse .StillCompeting - writetext UnknownText_0x6b6b8 + writetext BugCatchingContestant8BText waitbutton closetext end .StillCompeting: - writetext UnknownText_0x6b6e9 + writetext BugCatchingContestant8BStillCompetingText waitbutton closetext end @@ -436,13 +436,13 @@ BugCatchingContestant9BScript: opentext checkevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1 iffalse .StillCompeting - writetext UnknownText_0x6b71b + writetext BugCatchingContestant9BText waitbutton closetext end .StillCompeting: - writetext UnknownText_0x6b740 + writetext BugCatchingContestant9BStillCompetingText waitbutton closetext end @@ -452,13 +452,13 @@ BugCatchingContestant10BScript: opentext checkevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1 iffalse .StillCompeting - writetext UnknownText_0x6b76f + writetext BugCatchingContestant10BText waitbutton closetext end .StillCompeting: - writetext UnknownText_0x6b7af + writetext BugCatchingContestant10BStillCompetingText waitbutton closetext end @@ -658,13 +658,13 @@ UnknownText_0x6b370: cont "the PARK." done -UnknownText_0x6b399: +BugCatchingContestant1BText: text "DON: Wow, you beat" line "me. You're pretty" cont "good." done -UnknownText_0x6b3c4: +BugCatchingContestant1BStillCompetingText: text "DON: Luck plays a" line "big part in this." @@ -673,24 +673,24 @@ UnknownText_0x6b3c4: cont "appear." done -UnknownText_0x6b40f: +BugCatchingContestant2BText: text "ED: I envy you." line "I just couldn't" cont "do it this time." done -UnknownText_0x6b440: +BugCatchingContestant2BStillCompetingText: text "ED: Maybe you win" line "with big #MON?" done -UnknownText_0x6b462: +BugCatchingContestant3BText: text "NICK: Well done!" line "I'm going to raise" cont "my #MON better." done -UnknownText_0x6b496: +BugCatchingContestant3BStillCompetingText: text "NICK: Maybe you" line "get a higher score" @@ -698,13 +698,13 @@ UnknownText_0x6b496: line "an unusual color." done -UnknownText_0x6b4da: +BugCatchingContestant4BText: text "WILLIAM: You're" line "the winner? What" cont "did you catch?" done -UnknownText_0x6b50a: +BugCatchingContestant4BStillCompetingText: text "WILLIAM: Well, I'm" line "satisfied because" @@ -712,25 +712,25 @@ UnknownText_0x6b50a: line "that I wanted." done -UnknownText_0x6b54e: +BugCatchingContestant5BText: text "BENNY: Congrats!" line "You have earned my" cont "respect!" done -UnknownText_0x6b57c: +BugCatchingContestant5BStillCompetingText: text "BENNY: I caught a" line "SCYTHER before," cont "but I didn't win." done -UnknownText_0x6b5b0: +BugCatchingContestant6BText: text "BARRY: That #-" line "MON you caught…" cont "it's awesome!" done -UnknownText_0x6b5dd: +BugCatchingContestant6BStillCompetingText: text "BARRY: It's easier" line "to win if you get" @@ -742,7 +742,7 @@ UnknownText_0x6b5dd: cont "other points." done -UnknownText_0x6b64b: +BugCatchingContestant7BText: text "CINDY: You won?" line "That's great!" @@ -751,35 +751,35 @@ UnknownText_0x6b64b: cont "#MON with me?" done -UnknownText_0x6b698: +BugCatchingContestant7BStillCompetingText: text "CINDY: I really" line "love bug #MON!" done -UnknownText_0x6b6b8: +BugCatchingContestant8BText: text "JOSH: I… I can't" line "believe I lost at" cont "bug-catching…" done -UnknownText_0x6b6e9: +BugCatchingContestant8BStillCompetingText: text "JOSH: I heard that" line "somebody won with" cont "a CATERPIE!" done -UnknownText_0x6b71b: +BugCatchingContestant9BText: text "SAMUEL: Next time," line "I'm going to win." done -UnknownText_0x6b740: +BugCatchingContestant9BStillCompetingText: text "SAMUEL: Darn." line "I thought I would" cont "score higher…" done -UnknownText_0x6b76f: +BugCatchingContestant10BText: text "KIPP: Could you" line "give me some tips?" @@ -787,7 +787,7 @@ UnknownText_0x6b76f: line "your style." done -UnknownText_0x6b7af: +BugCatchingContestant10BStillCompetingText: text "KIPP: I study a" line "lot, but that's" diff --git a/maps/Route39Barn.asm b/maps/Route39Barn.asm index 15f69e310..ce3522d9a 100644 --- a/maps/Route39Barn.asm +++ b/maps/Route39Barn.asm @@ -13,14 +13,14 @@ Route39BarnTwin1Script: opentext checkevent EVENT_HEALED_MOOMOO iftrue .FeedingMooMoo - writetext Text_MoomooIsSick + writetext Route39BarnTwinMoomooIsSickText waitbutton closetext turnobject ROUTE39BARN_TWIN1, RIGHT end .FeedingMooMoo: - writetext Text_WereFeedingMoomoo + writetext Route39BarnTwinWereFeedingMoomooText waitbutton closetext turnobject ROUTE39BARN_TWIN1, RIGHT @@ -31,28 +31,28 @@ Route39BarnTwin2Script: opentext checkevent EVENT_HEALED_MOOMOO iftrue .FeedingMooMoo - writetext Text_MoomooIsSick + writetext Route39BarnTwinMoomooIsSickText waitbutton closetext turnobject ROUTE39BARN_TWIN2, LEFT end .FeedingMooMoo: - writetext Text_WereFeedingMoomoo + writetext Route39BarnTwinWereFeedingMoomooText waitbutton closetext turnobject ROUTE39BARN_TWIN2, LEFT end -MooMoo: +MoomooScript: opentext checkevent EVENT_HEALED_MOOMOO iftrue .HappyCow - writetext Text_WeakMoo + writetext MoomooWeakMooText writebyte MILTANK special PlaySlowCry buttonsound - writetext Text_ItsCryIsWeak + writetext Route39BarnItsCryIsWeakText checkevent EVENT_TALKED_TO_FARMER_ABOUT_MOOMOO iftrue .GiveBerry waitbutton @@ -61,7 +61,7 @@ MooMoo: .GiveBerry: buttonsound - writetext Text_AskGiveBerry + writetext Route39BarnAskGiveBerryText yesorno iffalse .Refused checkitem BERRY @@ -73,113 +73,113 @@ MooMoo: ifequal 3, .ThreeBerries ifequal 5, .FiveBerries ifequal 7, .SevenBerries - writetext Text_GaveBerry + writetext Route39BarnGaveBerryText waitbutton closetext end .ThreeBerries: - writetext Text_GaveBerry + writetext Route39BarnGaveBerryText buttonsound - writetext Text_LittleHealthier + writetext Route39BarnLittleHealthierText waitbutton closetext end .FiveBerries: - writetext Text_GaveBerry + writetext Route39BarnGaveBerryText buttonsound - writetext Text_QuiteHealthy + writetext Route39BarnQuiteHealthyText waitbutton closetext end .SevenBerries: playmusic MUSIC_HEAL - writetext Text_GaveBerry + writetext Route39BarnGaveBerryText pause 60 buttonsound special RestartMapMusic - writetext Text_TotallyHealthy + writetext Route39BarnTotallyHealthyText waitbutton closetext setevent EVENT_HEALED_MOOMOO end .NoBerriesInBag: - writetext Text_NoBerries + writetext Route39BarnNoBerriesText waitbutton closetext end .Refused: - writetext Text_RefusedToGiveBerry + writetext Route39BarnRefusedBerryText waitbutton closetext end .HappyCow: - writetext UnknownText_0x9cd92 + writetext MoomooHappyMooText cry MILTANK waitbutton closetext end -Text_MoomooIsSick: +Route39BarnTwinMoomooIsSickText: text "MOOMOO is sick…" para "She needs lots of" line "BERRIES." done -Text_WereFeedingMoomoo: +Route39BarnTwinWereFeedingMoomooText: text "We're feeding" line "MOOMOO!" done -Text_WeakMoo: +MoomooWeakMooText: text "MILTANK: …Moo…" done -Text_ItsCryIsWeak: +Route39BarnItsCryIsWeakText: text "Its cry is weak…" done -UnknownText_0x9cd92: +MoomooHappyMooText: text "MILTANK: Mooo!" done -Text_AskGiveBerry: +Route39BarnAskGiveBerryText: text "Give a BERRY to" line "MILTANK?" done -Text_GaveBerry: +Route39BarnGaveBerryText: text "<PLAYER> gave a" line "BERRY to MILTANK." done -Text_LittleHealthier: +Route39BarnLittleHealthierText: text "MILTANK became a" line "little healthier!" done -Text_QuiteHealthy: +Route39BarnQuiteHealthyText: text "MILTANK became" line "quite healthy!" done -Text_TotallyHealthy: +Route39BarnTotallyHealthyText: text "MILTANK became" line "totally healthy!" done -Text_NoBerries: +Route39BarnNoBerriesText: text "<PLAYER> has no" line "BERRIES…" done -Text_RefusedToGiveBerry: +Route39BarnRefusedBerryText: text "<PLAYER> wouldn't" line "give a BERRY." @@ -200,4 +200,4 @@ Route39Barn_MapEvents: db 3 ; object events object_event 2, 3, SPRITE_TWIN, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, Route39BarnTwin1Script, -1 object_event 4, 3, SPRITE_TWIN, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 0, Route39BarnTwin2Script, -1 - object_event 3, 3, SPRITE_TAUROS, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, MooMoo, -1 + object_event 3, 3, SPRITE_TAUROS, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, MoomooScript, -1 diff --git a/maps/Route43MahoganyGate.asm b/maps/Route43MahoganyGate.asm index 6af688f1a..671b64aed 100644 --- a/maps/Route43MahoganyGate.asm +++ b/maps/Route43MahoganyGate.asm @@ -11,18 +11,18 @@ Route43MahoganyGateOfficer: opentext checkevent EVENT_CLEARED_ROCKET_HIDEOUT iftrue .RocketsCleared - writetext UnknownText_0x19ab1f + writetext Route43MahoganyGateOfficerText waitbutton closetext end .RocketsCleared: - writetext UnknownText_0x19ab65 + writetext Route43MahoganyGateOfficerRocketsClearedText waitbutton closetext end -UnknownText_0x19ab1f: +Route43MahoganyGateOfficerText: text "Only people headed" line "up to LAKE OF RAGE" @@ -30,7 +30,7 @@ UnknownText_0x19ab1f: line "here lately." done -UnknownText_0x19ab65: +Route43MahoganyGateOfficerRocketsClearedText: text "Nobody goes up to" line "LAKE OF RAGE these" cont "days." diff --git a/maps/SaffronGym.asm b/maps/SaffronGym.asm index c495d1104..e9376a6e9 100644 --- a/maps/SaffronGym.asm +++ b/maps/SaffronGym.asm @@ -16,10 +16,10 @@ SaffronGymSabrinaScript: opentext checkflag ENGINE_MARSHBADGE iftrue .FightDone - writetext UnknownText_0x189cdf + writetext SabrinaIntroText waitbutton closetext - winlosstext UnknownText_0x189df4, 0 + winlosstext SabrinaWinLossText, 0 loadtrainer SABRINA, SABRINA1 startbattle reloadmapafterbattle @@ -29,17 +29,17 @@ SaffronGymSabrinaScript: setevent EVENT_BEAT_PSYCHIC_FRANKLIN setevent EVENT_BEAT_PSYCHIC_JARED opentext - writetext UnknownText_0x189e95 + writetext ReceivedMarshBadgeText playsound SFX_GET_BADGE waitsfx setflag ENGINE_MARSHBADGE - writetext UnknownText_0x189ead + writetext SabrinaMarshBadgeText waitbutton closetext end .FightDone: - writetext UnknownText_0x189f6c + writetext SabrinaFightDoneText waitbutton closetext end @@ -112,7 +112,7 @@ SaffronGymStatue: trainertotext SABRINA, SABRINA1, MEM_BUFFER_1 jumpstd gymstatue2 -UnknownText_0x189cdf: +SabrinaIntroText: text "SABRINA: I knew" line "you were coming…" @@ -138,7 +138,7 @@ UnknownText_0x189cdf: cont "psychic powers!" done -UnknownText_0x189df4: +SabrinaWinLossText: text "SABRINA: Your" line "power…" @@ -156,12 +156,12 @@ UnknownText_0x189df4: cont "MARSHBADGE." done -UnknownText_0x189e95: +ReceivedMarshBadgeText: text "<PLAYER> received" line "MARSHBADGE." done -UnknownText_0x189ead: +SabrinaMarshBadgeText: text "SABRINA: MARSH-" line "BADGE draws out" @@ -179,7 +179,7 @@ UnknownText_0x189ead: cont "beloved CHAMPION!" done -UnknownText_0x189f6c: +SabrinaFightDoneText: text "SABRINA: Your love" line "for your #MON" diff --git a/maps/SaffronPokecenter1F.asm b/maps/SaffronPokecenter1F.asm index 960f9f9be..161c4c169 100644 --- a/maps/SaffronPokecenter1F.asm +++ b/maps/SaffronPokecenter1F.asm @@ -15,23 +15,23 @@ SaffronPokecenter1FNurseScript: SaffronPokecenter1FTeacherScript: special Mobile_DummyReturnFalse iftrue .mobile - jumptextfaceplayer UnknownText_0x18a4a3 + jumptextfaceplayer SaffronPokecenter1FTeacherText .mobile - jumptextfaceplayer UnknownText_0x18a532 + jumptextfaceplayer SaffronPokecenter1FTeacherMobileText SaffronPokecenter1FFisherScript: faceplayer opentext checkevent EVENT_RETURNED_MACHINE_PART iftrue .SolvedKantoPowerCrisis - writetext UnknownText_0x18a5d3 + writetext SaffronPokecenter1FFisherText waitbutton closetext end .SolvedKantoPowerCrisis: - writetext UnknownText_0x18a62e + writetext SaffronPokecenter1FFisherReturnedMachinePartText waitbutton closetext end @@ -39,7 +39,7 @@ SaffronPokecenter1FFisherScript: SaffronPokecenter1FYoungsterScript: jumptextfaceplayer SaffronPokecenter1FYoungsterText -UnknownText_0x18a4a3: +SaffronPokecenter1FTeacherText: text "What are JOHTO's" line "#MON CENTERS" cont "like?" @@ -55,7 +55,7 @@ UnknownText_0x18a4a3: cont "then!" done -UnknownText_0x18a532: +SaffronPokecenter1FTeacherMobileText: text "What are JOHTO's" line "#MON CENTERS" cont "like?" @@ -73,7 +73,7 @@ UnknownText_0x18a532: line "trade it to me!" done -UnknownText_0x18a5d3: +SaffronPokecenter1FFisherText: text "I just happened to" line "come through ROCK" @@ -82,7 +82,7 @@ UnknownText_0x18a5d3: cont "the POWER PLANT." done -UnknownText_0x18a62e: +SaffronPokecenter1FFisherReturnedMachinePartText: text "Caves collapse" line "easily." diff --git a/maps/SeafoamGym.asm b/maps/SeafoamGym.asm index fece1933d..0a4ed0595 100644 --- a/maps/SeafoamGym.asm +++ b/maps/SeafoamGym.asm @@ -16,10 +16,10 @@ SeafoamGymBlaineScript: opentext checkflag ENGINE_VOLCANOBADGE iftrue .FightDone - writetext UnknownText_0x1ab548 + writetext BlaineIntroText waitbutton closetext - winlosstext UnknownText_0x1ab646, 0 + winlosstext BlaineWinLossText, 0 loadtrainer BLAINE, BLAINE1 startbattle iftrue .ReturnAfterBattle @@ -28,17 +28,17 @@ SeafoamGymBlaineScript: reloadmapafterbattle setevent EVENT_BEAT_BLAINE opentext - writetext UnknownText_0x1ab683 + writetext ReceivedVolcanoBadgeText playsound SFX_GET_BADGE waitsfx setflag ENGINE_VOLCANOBADGE - writetext UnknownText_0x1ab69d + writetext BlaineAfterBattleText waitbutton closetext end .FightDone: - writetext UnknownText_0x1ab71c + writetext BlaineFightDoneText waitbutton closetext end @@ -60,7 +60,7 @@ SeafoamGymGuyScript: closetext end -UnknownText_0x1ab548: +BlaineIntroText: text "BLAINE: Waaah!" para "My GYM in CINNABAR" @@ -88,7 +88,7 @@ UnknownText_0x1ab548: line "have BURN HEAL!" done -UnknownText_0x1ab646: +BlaineWinLossText: text "BLAINE: Awesome." line "I've burned out…" @@ -96,12 +96,12 @@ UnknownText_0x1ab646: line "VOLCANOBADGE!" done -UnknownText_0x1ab683: +ReceivedVolcanoBadgeText: text "<PLAYER> received" line "VOLCANOBADGE." done -UnknownText_0x1ab69d: +BlaineAfterBattleText: text "BLAINE: I did lose" line "this time, but I'm" @@ -115,7 +115,7 @@ UnknownText_0x1ab69d: line "a rematch." done -UnknownText_0x1ab71c: +BlaineFightDoneText: text "BLAINE: My fire" line "#MON will be" diff --git a/maps/SproutTower3F.asm b/maps/SproutTower3F.asm index 0462f279a..a33bc0e58 100644 --- a/maps/SproutTower3F.asm +++ b/maps/SproutTower3F.asm @@ -34,7 +34,7 @@ SproutTower3FRivalScene: applymovement PLAYER, MovementData_0x184a1d applymovement SPROUTTOWER3F_SILVER, MovementData_0x184a22 opentext - writetext UnknownText_0x184a27 + writetext SproutTowerElderLecturesRivalText waitbutton closetext showemote EMOTE_SHOCK, SPROUTTOWER3F_SILVER, 15 @@ -151,7 +151,7 @@ MovementData_0x184a24: step DOWN step_end -UnknownText_0x184a27: +SproutTowerElderLecturesRivalText: text "ELDER: You are in-" line "deed skilled as a" cont "trainer." diff --git a/maps/TeamRocketBaseB3F.asm b/maps/TeamRocketBaseB3F.asm index f1092aca7..9396a882a 100644 --- a/maps/TeamRocketBaseB3F.asm +++ b/maps/TeamRocketBaseB3F.asm @@ -183,13 +183,13 @@ TeamRocketBaseB3FLockedDoor: jump .OpenSesame .NeedsPassword: - writetext UnknownText_0x6e970 + writetext TeamRocketBaseB3FLockedDoorNeedsPasswordText waitbutton closetext end .OpenSesame: - writetext UnknownText_0x6e9a3 + writetext TeamRocketBaseB3FLockedDoorOpenSesameText waitbutton playsound SFX_ENTER_DOOR changeblock 10, 8, $07 ; floor @@ -547,14 +547,14 @@ ScientistMitchAfterBattleText: line "excites me!" done -UnknownText_0x6e970: +TeamRocketBaseB3FLockedDoorNeedsPasswordText: text "The door's closed…" para "It needs two" line "passwords to open." done -UnknownText_0x6e9a3: +TeamRocketBaseB3FLockedDoorOpenSesameText: text "The door's closed…" para "<PLAYER> entered" diff --git a/maps/VermilionGym.asm b/maps/VermilionGym.asm index aa81430a9..d6cdcd30d 100644 --- a/maps/VermilionGym.asm +++ b/maps/VermilionGym.asm @@ -15,10 +15,10 @@ VermilionGymSurgeScript: opentext checkflag ENGINE_THUNDERBADGE iftrue .FightDone - writetext UnknownText_0x192142 + writetext LtSurgeIntroText waitbutton closetext - winlosstext UnknownText_0x192238, 0 + winlosstext LtSurgeWinLossText, 0 loadtrainer LT_SURGE, LT_SURGE1 startbattle reloadmapafterbattle @@ -27,17 +27,17 @@ VermilionGymSurgeScript: setevent EVENT_BEAT_GUITARIST_VINCENT setevent EVENT_BEAT_JUGGLER_HORTON opentext - writetext UnknownText_0x192277 + writetext ReceivedThunderBadgeText playsound SFX_GET_BADGE waitsfx setflag ENGINE_THUNDERBADGE - writetext UnknownText_0x192291 + writetext LtSurgeThunderBadgeText waitbutton closetext end .FightDone: - writetext UnknownText_0x192303 + writetext LtSurgeFightDoneText waitbutton closetext end @@ -102,7 +102,7 @@ VermilionGymStatue: trainertotext LT_SURGE, LT_SURGE1, MEM_BUFFER_1 jumpstd gymstatue2 -UnknownText_0x192142: +LtSurgeIntroText: text "SURGE: Hey, you" line "little tyke!" @@ -125,7 +125,7 @@ UnknownText_0x192142: cont "enemies in war!" done -UnknownText_0x192238: +LtSurgeWinLossText: text "SURGE: Arrrgh!" line "You are strong!" @@ -133,12 +133,12 @@ UnknownText_0x192238: line "THUNDERBADGE!" done -UnknownText_0x192277: +ReceivedThunderBadgeText: text "<PLAYER> received" line "THUNDERBADGE." done -UnknownText_0x192291: +LtSurgeThunderBadgeText: text "SURGE: THUNDER-" line "BADGE increases" cont "#MON's speed. " @@ -150,7 +150,7 @@ UnknownText_0x192291: line "proudly, hear?" done -UnknownText_0x192303: +LtSurgeFightDoneText: text "SURGE: Hey, kid!" line "Still slugging and" cont "chugging away?" diff --git a/maps/VioletGym.asm b/maps/VioletGym.asm index 21e588b1d..36561ce12 100644 --- a/maps/VioletGym.asm +++ b/maps/VioletGym.asm @@ -14,16 +14,16 @@ VioletGymFalknerScript: opentext checkevent EVENT_BEAT_FALKNER iftrue .FightDone - writetext UnknownText_0x68473 + writetext FalknerIntroText waitbutton closetext - winlosstext UnknownText_0x6854a, 0 + winlosstext FalknerWinLossText, 0 loadtrainer FALKNER, FALKNER1 startbattle reloadmapafterbattle setevent EVENT_BEAT_FALKNER opentext - writetext UnknownText_0x685af + writetext ReceivedZephyrBadgeText playsound SFX_GET_BADGE waitsfx setflag ENGINE_ZEPHYRBADGE @@ -36,18 +36,18 @@ VioletGymFalknerScript: setevent EVENT_BEAT_BIRD_KEEPER_ABE setmapscene ELMS_LAB, SCENE_ELMSLAB_NOTHING specialphonecall SPECIALCALL_ASSISTANT - writetext UnknownText_0x685c8 + writetext FalknerZephyrBadgeText buttonsound verbosegiveitem TM_MUD_SLAP iffalse .NoRoomForMudSlap setevent EVENT_GOT_TM31_MUD_SLAP - writetext UnknownText_0x68648 + writetext FalknerTMMudSlapText waitbutton closetext end .SpeechAfterTM: - writetext UnknownText_0x68735 + writetext FalknerFightDoneText waitbutton .NoRoomForMudSlap: closetext @@ -110,7 +110,7 @@ VioletGymStatue: trainertotext FALKNER, FALKNER1, MEM_BUFFER_1 jumpstd gymstatue2 -UnknownText_0x68473: +FalknerIntroText: text "I'm FALKNER, the" line "VIOLET #MON GYM" cont "leader!" @@ -133,7 +133,7 @@ UnknownText_0x68473: line "#MON!" done -UnknownText_0x6854a: +FalknerWinLossText: text "…Darn! My dad's" line "cherished bird" cont "#MON…" @@ -146,12 +146,12 @@ UnknownText_0x6854a: cont "ZEPHYRBADGE." done -UnknownText_0x685af: +ReceivedZephyrBadgeText: text "<PLAYER> received" line "ZEPHYRBADGE." done -UnknownText_0x685c8: +FalknerZephyrBadgeText: text "ZEPHYRBADGE" line "raises the attack" cont "power of #MON." @@ -166,7 +166,7 @@ UnknownText_0x685c8: line "too." done -UnknownText_0x68648: +FalknerTMMudSlapText: text "By using a TM, a" line "#MON will" @@ -191,7 +191,7 @@ UnknownText_0x68648: cont "and offensive." done -UnknownText_0x68735: +FalknerFightDoneText: text "There are #MON" line "GYMS in cities and" cont "towns ahead." diff --git a/maps/ViridianCity.asm b/maps/ViridianCity.asm index 70c0b8ced..2ed7d7441 100644 --- a/maps/ViridianCity.asm +++ b/maps/ViridianCity.asm @@ -17,16 +17,16 @@ ViridianCity_MapScripts: ViridianCityCoffeeGramps: faceplayer opentext - writetext UnknownText_0x1a9aa5 + writetext ViridianCityCoffeeGrampsQuestionText yesorno iffalse .no - writetext UnknownText_0x1a9b6f + writetext ViridianCityCoffeeGrampsBelievedText waitbutton closetext end .no: - writetext UnknownText_0x1a9bb7 + writetext ViridianCityCoffeeGrampsDoubtedText waitbutton closetext end @@ -36,13 +36,13 @@ ViridianCityGrampsNearGym: opentext checkevent EVENT_BLUE_IN_CINNABAR iftrue .BlueReturned - writetext UnknownText_0x1a9c11 + writetext ViridianCityGrampsNearGymText waitbutton closetext end .BlueReturned: - writetext UnknownText_0x1a9c7e + writetext ViridianCityGrampsNearGymBlueReturnedText waitbutton closetext end @@ -52,13 +52,13 @@ ViridianCityDreamEaterFisher: opentext checkevent EVENT_GOT_TM42_DREAM_EATER iftrue .GotDreamEater - writetext UnknownText_0x1a9cc4 + writetext ViridianCityDreamEaterFisherText buttonsound verbosegiveitem TM_DREAM_EATER iffalse .NoRoomForDreamEater setevent EVENT_GOT_TM42_DREAM_EATER .GotDreamEater: - writetext UnknownText_0x1a9d86 + writetext ViridianCityDreamEaterFisherGotDreamEaterText waitbutton .NoRoomForDreamEater: closetext @@ -85,7 +85,7 @@ ViridianCityPokecenterSign: ViridianCityMartSign: jumpstd martsign -UnknownText_0x1a9aa5: +ViridianCityCoffeeGrampsQuestionText: text "Hey, kid! I just" line "had a double shot" @@ -105,7 +105,7 @@ UnknownText_0x1a9aa5: para "Do you believe me?" done -UnknownText_0x1a9b6f: +ViridianCityCoffeeGrampsBelievedText: text "Good, good. Yes, I" line "was something out" @@ -113,7 +113,7 @@ UnknownText_0x1a9b6f: line "let me tell you!" done -UnknownText_0x1a9bb7: +ViridianCityCoffeeGrampsDoubtedText: text "What? You little" line "whelp!" @@ -124,7 +124,7 @@ UnknownText_0x1a9bb7: line "or two. Humph!" done -UnknownText_0x1a9c11: +ViridianCityGrampsNearGymText: text "This GYM didn't" line "have a LEADER" cont "until recently." @@ -136,7 +136,7 @@ UnknownText_0x1a9c11: line "often away." done -UnknownText_0x1a9c7e: +ViridianCityGrampsNearGymBlueReturnedText: text "Are you going to" line "battle the LEADER?" @@ -144,7 +144,7 @@ UnknownText_0x1a9c7e: line "You'll need it." done -UnknownText_0x1a9cc4: +ViridianCityDreamEaterFisherText: text "Yawn!" para "I must have dozed" @@ -167,7 +167,7 @@ UnknownText_0x1a9cc4: cont "this TM." done -UnknownText_0x1a9d86: +ViridianCityDreamEaterFisherGotDreamEaterText: text "TM42 contains" line "DREAM EATER…" diff --git a/maps/WiseTriosRoom.asm b/maps/WiseTriosRoom.asm index e1136222a..ada1a726b 100644 --- a/maps/WiseTriosRoom.asm +++ b/maps/WiseTriosRoom.asm @@ -59,7 +59,7 @@ WiseTriosRoom_CannotEnterTinTowerScript: stopfollow turnobject PLAYER, RIGHT opentext - writetext UnknownText_0x98712 + writetext WiseTriosRoomSage3BlocksExitText waitbutton closetext applymovement WISETRIOSROOM_SAGE3, MovementData_0x98625 @@ -71,7 +71,7 @@ TrainerSageGaku: .Script: opentext - writetext UnknownText_0x98938 + writetext SageGakuAfterBattleText waitbutton closetext end @@ -81,7 +81,7 @@ TrainerSageMasa: .Script: opentext - writetext UnknownText_0x98a35 + writetext SageMasaAfterBattleText waitbutton closetext end @@ -95,9 +95,9 @@ TrainerSageKoji: pause 10 showemote EMOTE_SHOCK, WISETRIOSROOM_SAGE6, 20 opentext - writetext UnknownText_0x98c6c + writetext SageKojiAfterBattleQuestionText buttonsound - writetext UnknownText_0x98cac + writetext SageKojiAfterBattleSpeechText waitbutton closetext applymovement WISETRIOSROOM_SAGE6, MovementData_0x98628 @@ -108,7 +108,7 @@ TrainerSageKoji: .KojiAllowsPassage: opentext - writetext UnknownText_0x98db5 + writetext SageKojiAfterBattleFinalText waitbutton closetext end @@ -153,7 +153,7 @@ WiseTriosRoomSage2Text: line "by someone." done -UnknownText_0x98712: +WiseTriosRoomSage3BlocksExitText: text "TIN TOWER may be" line "entered by those" @@ -213,7 +213,7 @@ SageGakuBeatenText: line "thought? Perhaps…" done -UnknownText_0x98938: +SageGakuAfterBattleText: text "Ah, so it is you" line "who claim to have" @@ -241,7 +241,7 @@ SageMasaBeatenText: line "the truth…" done -UnknownText_0x98a35: +SageMasaAfterBattleText: text "In the past, there" line "were two nine-tier" cont "towers here." @@ -301,7 +301,7 @@ SageKojiBeatenText: line "Why?" done -UnknownText_0x98c6c: +SageKojiAfterBattleQuestionText: text "You… Are you the" line "trainer who is" @@ -309,7 +309,7 @@ UnknownText_0x98c6c: line "legendary #MON?" done -UnknownText_0x98cac: +SageKojiAfterBattleSpeechText: text "I see…" para "We, the WISE TRIO," @@ -335,7 +335,7 @@ UnknownText_0x98cac: line "you to the test." done -UnknownText_0x98db5: +SageKojiAfterBattleFinalText: text "Please, do go on." para "SUICUNE will put" diff --git a/mobile/fixed_words.asm b/mobile/fixed_words.asm index 839529faf..00bf03b4e 100644 --- a/mobile/fixed_words.asm +++ b/mobile/fixed_words.asm @@ -261,7 +261,7 @@ CopyMobileEZChatToC608: .get_name ld a, e - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, wStringBuffer1 ld bc, MON_NAME_LENGTH - 1 diff --git a/mobile/mobile_12_2.asm b/mobile/mobile_12_2.asm index c89cffb14..d85b0eba7 100644 --- a/mobile/mobile_12_2.asm +++ b/mobile/mobile_12_2.asm @@ -268,7 +268,7 @@ Function4a9d7: call GetNick ld h, d ld l, e - ld de, wEndFlypoint + ld de, wd006 ld bc, 6 call CopyBytes ld a, [wd003] @@ -428,7 +428,7 @@ Function4aad3: .loop push bc push hl - ld e, 0 + ld e, MONICON_PARTYMENU farcall LoadMenuMonIcon ld a, [hObjectStructIndexBuffer] inc a diff --git a/mobile/mobile_22.asm b/mobile/mobile_22.asm index da8fee07c..d9aa43687 100644 --- a/mobile/mobile_22.asm +++ b/mobile/mobile_22.asm @@ -2063,7 +2063,7 @@ Function89d0d: ld [rSVBK], a call SetPalettes - farcall PrintMail_ + farcall PrintMail call Mobile22_SetBGMapMode1 ld c, 24 call DelayFrames @@ -3894,7 +3894,7 @@ Function8aab6: ret String_8aaf0: - db "あたらしい めいし<PKMN>できまし<LNBRK>@" + db "あたらしい めいし<PKMN>できまし<LF>@" Function8ab00: ld de, String_8911c diff --git a/mobile/mobile_22_2.asm b/mobile/mobile_22_2.asm index 260e62073..be1c897d8 100644 --- a/mobile/mobile_22_2.asm +++ b/mobile/mobile_22_2.asm @@ -586,7 +586,7 @@ Function8b690: ld a, BANK(GFX_17afa5) call FarCopyBytes ld hl, GFX_17afa5 + $514 + $160 - ld de, vTiles1 tile $6e + ld de, vTiles0 tile $ee ld bc, $10 ld a, BANK(GFX_17afa5) call FarCopyBytes diff --git a/mobile/mobile_40.asm b/mobile/mobile_40.asm index dc3767bf4..72703bbb9 100644 --- a/mobile/mobile_40.asm +++ b/mobile/mobile_40.asm @@ -1549,7 +1549,7 @@ _LinkBattleSendReceiveAction: .StageForSend: ld a, [wBattlePlayerAction] - and a + and a ; BATTLEPLAYERACTION_USEMOVE? jr nz, .switch ld a, [wCurPlayerMove] ld b, BATTLEACTION_E @@ -6383,7 +6383,7 @@ Function102d48: ld hl, wPartyCount add hl, de ld a, [hl] - ld [wd265], a + ld [wTempSpecies], a cp EGG jr z, .asm_102d6d dec a @@ -6396,7 +6396,7 @@ Function102d48: ld [hl], BASE_HAPPINESS .asm_102d6d - ld a, [wd265] + ld a, [wTempSpecies] cp UNOWN jr nz, .asm_102d98 ld a, [wcd4c] @@ -6529,7 +6529,7 @@ Function102e4f: ld a, [de] cp $ff ret z - ld [wd265], a + ld [wNamedObjectIndexBuffer], a push bc push hl push de @@ -6557,7 +6557,7 @@ Function102ea8: ld hl, wPartySpecies add hl, bc ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, wStringBuffer1 ld de, wStringBuffer2 @@ -6570,7 +6570,7 @@ Function102ea8: ld hl, wOTPartySpecies add hl, bc ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, UnknownText_0x102ee2 call PrintTextBoxText @@ -6639,7 +6639,7 @@ Function102f85: ld hl, wOTPartySpecies add hl, bc ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName call Function102dc3 ld de, String_102fb2 @@ -7518,11 +7518,11 @@ UnknownText_0x10377b: db "@" Function103780: - ld a, [wd265] + ld a, [wChosenCableClubRoom] push af call Function10378c pop af - ld [wd265], a + ld [wChosenCableClubRoom], a ret Function10378c: diff --git a/mobile/mobile_42.asm b/mobile/mobile_42.asm index 3f53146bb..6bd8a3c4c 100644 --- a/mobile/mobile_42.asm +++ b/mobile/mobile_42.asm @@ -318,7 +318,7 @@ Function108229: MobileTradeAnim_InitSpeciesName: push de - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, wStringBuffer1 pop de diff --git a/mobile/mobile_45.asm b/mobile/mobile_45.asm index e2168a737..64ddaff6b 100644 --- a/mobile/mobile_45.asm +++ b/mobile/mobile_45.asm @@ -4265,7 +4265,7 @@ Function1158c2: ld l, c ld h, b xor a - ld [wWeeklyFlags], a + ld [wDailyFlags2], a .asm_1158e5 ld b, $3 @@ -4290,7 +4290,7 @@ Function1158c2: push hl dec hl ld a, c - ld [wWeeklyFlags], a + ld [wDailyFlags2], a .asm_115908 xor a ld [hld], a @@ -4430,7 +4430,7 @@ endr jp nz, .asm_1158e5 .asm_1159c4 - ld a, [wWeeklyFlags] + ld a, [wDailyFlags2] cp $0 jr z, .asm_1159d8 push hl @@ -4890,7 +4890,7 @@ Function115bc8: Function115c49: ld a, e - ld [wWeeklyFlags], a + ld [wDailyFlags2], a ld a, d ld [wSwarmFlags], a xor a @@ -4960,7 +4960,7 @@ endr ld [$dc1a], a push de push hl - ld hl, wWeeklyFlags + ld hl, wDailyFlags2 ld a, [hli] ld h, [hl] ld l, a @@ -5070,7 +5070,7 @@ Function115cfd: .asm_115d38 push de push hl - ld a, [wWeeklyFlags] + ld a, [wDailyFlags2] ld l, a ld a, [wSwarmFlags] ld h, a diff --git a/mobile/mobile_46.asm b/mobile/mobile_46.asm index 43ddf5201..d9b9d7af7 100644 --- a/mobile/mobile_46.asm +++ b/mobile/mobile_46.asm @@ -3367,7 +3367,7 @@ Function119987: ret Function1199b4: - ld a, [w3_d081+1] + ld a, [w3_d081 + 1] and a jr nz, .asm_1199c7 ld a, [w3_d081] @@ -3967,7 +3967,7 @@ BattleTower_UbersCheck: .uber_under_70 pop af ld a, [de] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, wStringBuffer1 ld de, wcd49 @@ -5543,7 +5543,7 @@ Function11ac51: call Function11b314 call Function11acb7 call Function11ad6e - ld a, 30 * 4 + ld a, 30 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a farcall DoNextFrameForAllSprites farcall ReloadMapPart @@ -5624,11 +5624,11 @@ Function11ad1b: ld [wCurIconTile], a ld hl, LoadMenuMonIcon ld a, BANK(LoadMenuMonIcon) - ld e, $4 + ld e, MONICON_MOBILE1 rst FarCall ld hl, LoadMenuMonIcon ld a, BANK(LoadMenuMonIcon) - ld e, $5 + ld e, MONICON_MOBILE2 rst FarCall ld hl, $c6d0 ld bc, $0115 @@ -6127,7 +6127,7 @@ Function11b099: .loop push af ld a, [de] - ld [wd265], a + ld [wTempSpecies], a push de push hl call .PlaceMonNameOrPlaceholderString @@ -6387,13 +6387,13 @@ Function11b20b: ld hl, $c6d0 add hl, de ld a, [hl] - ld [wd265], a + ld [wTempSpecies], a ret CheckCaughtMemMon: push de push hl - ld a, [wd265] + ld a, [wTempSpecies] dec a call CheckCaughtMon pop hl @@ -6403,7 +6403,7 @@ CheckCaughtMemMon: CheckSeenMemMon: push de push hl - ld a, [wd265] + ld a, [wTempSpecies] dec a call CheckSeenMon pop hl @@ -6463,7 +6463,7 @@ Function11b275: ret Function11b279: - ld a, [wd265] + ld a, [wTempSpecies] ld [wCurSpecies], a call CheckSeenMemMon jr z, .asm_11b28f diff --git a/mobile/mobile_5c.asm b/mobile/mobile_5c.asm index 2874ce65a..355678096 100644 --- a/mobile/mobile_5c.asm +++ b/mobile/mobile_5c.asm @@ -121,10 +121,10 @@ Function170c06: push hl ld de, 0 xor a - ld [wd265], a + ld [wTempByteValue], a .asm_170c30 ld hl, wPartyMon1HP - ld a, [wd265] + ld a, [wTempByteValue] call GetPartyLocation ld a, [hli] ld b, a @@ -143,9 +143,9 @@ Function170c06: push hl pop de jr c, .asm_170c58 - ld a, [wd265] + ld a, [wTempByteValue] inc a - ld [wd265], a + ld [wTempByteValue], a cp $3 jr c, .asm_170c30 jr .asm_170c5b @@ -279,7 +279,7 @@ Function170d02: ld a, $1 ld [rVBK], a ld de, GFX_171848 - ld hl, vTiles1 tile $41 + ld hl, vTiles0 tile $c1 lb bc, BANK(GFX_171848), 24 call Get2bpp xor a diff --git a/mobile/mobile_5f.asm b/mobile/mobile_5f.asm index ed2b5188c..4b2c330c0 100644 --- a/mobile/mobile_5f.asm +++ b/mobile/mobile_5f.asm @@ -265,27 +265,27 @@ CheckStringForErrors_IgnoreTerminator: ret Function17d0f3: - ld a, [$c608 + 5] + ld a, [wc608 + 5] ld [wOTTrademonSpecies], a ld [wCurPartySpecies], a ld a, [wcd81] - ld [$c74e], a - ld hl, $c63d + ld [wc74e], a + ld hl, wc608 + 53 ld de, wOTTrademonOTName ld bc, 5 call CopyBytes ld a, "@" ld [de], a - ld a, [$c608 + 11] + ld a, [wc608 + 11] ld [wOTTrademonID], a - ld a, [$c608 + 12] + ld a, [wc608 + 12] ld [wOTTrademonID + 1], a - ld hl, $c608 + 26 + ld hl, wc608 + 26 ld a, [hli] ld [wOTTrademonDVs], a ld a, [hl] ld [wOTTrademonDVs + 1], a - ld bc, $c608 + 5 + ld bc, wc608 + 5 farcall GetCaughtGender ld a, c ld [wOTTrademonCaughtData], a @@ -324,7 +324,7 @@ Function17d0f3: Mobile_CopyDefaultOTName: ld hl, Mobile5F_PlayersName - ld de, $c63d + ld de, wc63d ld bc, 5 call CopyBytes ret @@ -334,7 +334,7 @@ Mobile5F_PlayersName: Mobile_CopyDefaultNickname: ld hl, .DefaultNickname - ld de, $c642 + ld de, wc642 ld bc, 5 call CopyBytes ret @@ -344,11 +344,11 @@ Mobile_CopyDefaultNickname: Mobile_CopyDefaultMail: ld a, "@" - ld hl, $c647 + ld hl, wc647 ld bc, MAIL_MSG_LENGTH + 1 call ByteFill ld hl, .DefaultMessage - ld de, $c647 + ld de, wc647 ld bc, 6 call CopyBytes ret @@ -358,11 +358,11 @@ Mobile_CopyDefaultMail: Mobile_CopyDefaultMailAuthor: ld a, "@" - ld de, $c668 + ld de, wc668 ld bc, 5 call ByteFill ld hl, Mobile5F_PlayersName - ld de, $c668 + ld de, wc668 ld bc, 5 call CopyBytes ret @@ -605,8 +605,8 @@ Function17d370: call ClearScreen farcall ReloadMapPart call DisableLCD - ld hl, vTiles1 tile $6e - ld de, $c608 + ld hl, vTiles0 tile $ee + ld de, wc608 ld bc, 1 tiles call CopyBytes ld a, $1 @@ -619,8 +619,8 @@ Function17d370: ld hl, vTiles2 tile $7f ld bc, 1 tiles call ByteFill - ld hl, $c608 - ld de, vTiles1 tile $6e + ld hl, wc608 + ld de, vTiles0 tile $ee ld bc, 1 tiles call CopyBytes xor a @@ -652,8 +652,8 @@ Function17d3f6: Function17d405: call DisableLCD - ld hl, vTiles1 tile $6e - ld de, $c608 + ld hl, vTiles0 tile $ee + ld de, wc608 ld bc, 1 tiles call CopyBytes ld a, $1 @@ -666,8 +666,8 @@ Function17d405: ld hl, vTiles2 tile $7f ld bc, 1 tiles call ByteFill - ld hl, $c608 - ld de, vTiles1 tile $6e + ld hl, wc608 + ld de, vTiles0 tile $ee ld bc, 1 tiles call CopyBytes xor a @@ -713,7 +713,7 @@ Jumptable_17d483: Function17d48d: ld hl, Palette_17eff6 - ld de, $c608 + ld de, wc608 ld bc, $40 call CopyBytes ld hl, TileAttrmap_17eb8e @@ -765,7 +765,7 @@ Function17d48d: .asm_17d4e0 ld a, [hli] - ld de, $c608 + ld de, wc608 ld c, $8 .asm_17d4e6 srl a @@ -938,7 +938,7 @@ Function17d5c4: Function17d5f6: ld a, $5 ld [rSVBK], a - ld hl, $c608 + ld hl, wc608 ld de, wBGPals1 ld bc, 8 palettes call CopyBytes @@ -950,7 +950,7 @@ Function17d60b: ld a, $5 call GetSRAMBank ld hl, $b1d3 - ld de, $c608 + ld de, wc608 ld bc, $20 call CopyBytes ld a, [$b1b1] @@ -964,7 +964,7 @@ Function17d60b: call CloseSRAM ld a, $6 call GetSRAMBank - ld de, $c708 + ld de, wc708 ld a, c and a jr z, .asm_17d684 @@ -985,7 +985,7 @@ Function17d60b: ld [wcd49], a push hl push de - ld hl, $c608 + ld hl, wc608 ld e, b ld d, $0 add hl, de @@ -1024,7 +1024,7 @@ Function17d60b: call CloseSRAM ld a, $5 call GetSRAMBank - ld hl, $c708 + ld hl, wc708 ld de, $b1b3 ld a, [$b1b1] ld c, a @@ -1307,7 +1307,7 @@ Function17d85d: and a jr nz, .asm_17d86c pop hl - ld de, $c608 + ld de, wc608 ld c, $0 .asm_17d878 ld a, [hli] @@ -1365,7 +1365,7 @@ Function17d85d: push bc ld a, $3 ld [rSVBK], a - ld hl, $c608 + ld hl, wc608 ld de, wBGPals1 ld b, $0 call CopyBytes @@ -1426,7 +1426,7 @@ Function17d902: Function17d93a: call IncCrashCheckPointer - ld de, $c708 + ld de, wc708 ld bc, $5 call CopyBytes call HlToCrashCheckPointer @@ -1435,19 +1435,19 @@ Function17d93a: push af ld a, $1 ld [rSVBK], a - ld a, [$c70c] + ld a, [wc70c] call Function17e6de - ld a, [$c70a] + ld a, [wc70a] ld [wCurPartySpecies], a - ld a, [$c70c] + ld a, [wc70c] ld e, a farcall LoadMonPaletteAsNthBGPal call SetPalettes - ld a, [$c708] + ld a, [wc708] ld l, a - ld a, [$c709] + ld a, [wc709] ld h, a - ld a, [$c70b] + ld a, [wc70b] ld c, a decoord 0, 0 add hl, de @@ -1461,7 +1461,7 @@ Function17d93a: Function17d98b: call IncCrashCheckPointer - ld de, $c708 + ld de, wc708 ld bc, $4 call CopyBytes call HlToCrashCheckPointer @@ -1470,17 +1470,17 @@ Function17d98b: push af ld a, $1 ld [rSVBK], a - ld a, [$c70b] + ld a, [wc70b] call Function17e6de - ld a, [$c70a] + ld a, [wc70a] ld [wTrainerClass], a - ld a, [$c70b] + ld a, [wc70b] ld e, a farcall LoadTrainerClassPaletteAsNthBGPal call SetPalettes - ld a, [$c708] + ld a, [wc708] ld e, a - ld a, [$c709] + ld a, [wc709] ld d, a push de ld de, vTiles2 @@ -1497,34 +1497,34 @@ Function17d98b: Function17d9e3: call IncCrashCheckPointer - ld de, $c708 + ld de, wc708 ld bc, $7 call CopyBytes call HlToCrashCheckPointer - ld a, [$c70b] + ld a, [wc70b] push af cp $c0 jr c, .asm_17da01 - ld a, [$c70c] + ld a, [wc70c] ld [rSVBK], a jr .asm_17da07 .asm_17da01 - ld a, [$c70c] + ld a, [wc70c] call GetSRAMBank .asm_17da07 - ld a, [$c708] + ld a, [wc708] ld l, a - ld a, [$c709] + ld a, [wc709] ld h, a - ld a, [$c70a] + ld a, [wc70a] ld e, a - ld a, [$c70b] + ld a, [wc70b] ld d, a - ld a, [$c70d] + ld a, [wc70d] ld c, a - ld a, [$c70e] + ld a, [wc70e] ld b, a call CopyBytes pop af @@ -1542,28 +1542,28 @@ Function17d9e3: Function17da31: call IncCrashCheckPointer - ld de, $c708 + ld de, wc708 ld bc, $4 call CopyBytes call HlToCrashCheckPointer - ld a, [$c709] + ld a, [wc709] push af cp $c0 jr c, .asm_17da4f - ld a, [$c70a] + ld a, [wc70a] ld [rSVBK], a jr .asm_17da55 .asm_17da4f - ld a, [$c70a] + ld a, [wc70a] call GetSRAMBank .asm_17da55 - ld a, [$c708] + ld a, [wc708] ld e, a - ld a, [$c709] + ld a, [wc709] ld d, a - ld a, [$c70b] + ld a, [wc70b] ld c, a bit 7, c jr nz, .asm_17da70 @@ -1824,7 +1824,7 @@ Function17dbe9: Function17dc1f: call IncCrashCheckPointer - ld de, $c688 + ld de, wc688 ld bc, $6 call CopyBytes call Function17e32b @@ -1832,24 +1832,24 @@ Function17dc1f: push af ld a, $1 ld [rSVBK], a - ld hl, $c688 + ld hl, wc688 ld a, $40 - ld [$c708], a + ld [wc708], a ld a, [hli] - ld [$c70a], a + ld [wc70a], a add $5 - ld [$c70c], a + ld [wc70c], a ld a, [hli] - ld [$c709], a + ld [wc709], a add $4 - ld [$c70b], a + ld [wc70b], a ld a, $96 - ld [$c70d], a + ld [wc70d], a ld a, $5c - ld [$c70e], a + ld [wc70e], a ld a, $1 - ld [$c70f], a - ld hl, $c708 + ld [wc70f], a + ld hl, wc708 call LoadMenuHeader call VerticalMenu jr nc, .asm_17dc6e @@ -1863,16 +1863,16 @@ Function17dc1f: ld a, [wMenuCursorY] cp $1 jr nz, .asm_17dc85 - ld a, [$c68a] + ld a, [wc68a] ld l, a - ld a, [$c68a + 1] + ld a, [wc68a + 1] ld h, a jr .asm_17dc8d .asm_17dc85 - ld a, [$c68a + 2] + ld a, [wc68a + 2] ld l, a - ld a, [$c68a + 3] + ld a, [wc68a + 3] ld h, a .asm_17dc8d @@ -2005,35 +2005,35 @@ Function17dd30: Function17dd49: call IncCrashCheckPointer - ld de, $c708 + ld de, wc708 ld bc, $a call CopyBytes - ld a, [$c711] + ld a, [wc711] ld c, a ld b, $0 call CopyBytes - ld a, [$c70a] + ld a, [wc70a] cp $c0 jr c, .sram - ld a, [$c708] + ld a, [wc708] ld [rSVBK], a jr .got_bank .sram - ld a, [$c708] + ld a, [wc708] call GetSRAMBank .got_bank - ld a, [$c709] + ld a, [wc709] ld l, a - ld a, [$c70a] + ld a, [wc70a] ld h, a - ld de, $c688 - ld a, [$c711] + ld de, wc688 + ld a, [wc711] ld c, a ld b, $0 call CopyBytes - ld a, [$c70a] + ld a, [wc70a] cp $c0 jr c, .close_sram ld a, $4 @@ -2044,10 +2044,10 @@ Function17dd49: call CloseSRAM .exited_bank - ld a, [$c711] + ld a, [wc711] ld c, a - ld hl, $c712 - ld de, $c688 + ld hl, wc712 + ld de, wc688 .loop ld a, [de] inc de @@ -2060,23 +2060,23 @@ Function17dd49: .next dec c jr nz, .loop - ld a, [$c70d] + ld a, [wc70d] ld l, a - ld a, [$c70e] + ld a, [wc70e] ld h, a jr .done .load2 - ld a, [$c70f] + ld a, [wc70f] ld l, a - ld a, [$c710] + ld a, [wc710] ld h, a jr .done .load - ld a, [$c70b] + ld a, [wc70b] ld l, a - ld a, [$c70c] + ld a, [wc70c] ld h, a .done @@ -2085,31 +2085,31 @@ Function17dd49: Function17ddcd: call IncCrashCheckPointer - ld de, $c708 + ld de, wc708 ld bc, $8 call CopyBytes - ld a, [$c70a] + ld a, [wc70a] cp $c0 jr c, .asm_17dde7 - ld a, [$c708] + ld a, [wc708] ld [rSVBK], a jr .asm_17dded .asm_17dde7 - ld a, [$c708] + ld a, [wc708] call GetSRAMBank .asm_17dded - ld a, [$c709] + ld a, [wc709] ld e, a - ld a, [$c70a] + ld a, [wc70a] ld d, a ld a, [de] - ld [$c710], a - ld a, [$c70b] + ld [wc710], a + ld a, [wc70b] ld c, a ld b, $0 - ld a, [$c70a] + ld a, [wc70a] cp $c0 jr c, .asm_17de0c ld a, $4 @@ -2124,20 +2124,20 @@ Function17ddcd: ld hl, Unknown_17da8c add hl, bc ld a, [hl] - ld hl, $c710 + ld hl, wc710 and [hl] pop hl jr nz, .asm_17de26 - ld a, [$c70e] + ld a, [wc70e] ld l, a - ld a, [$c70f] + ld a, [wc70f] ld h, a jr .asm_17de2e .asm_17de26 - ld a, [$c70c] + ld a, [wc70c] ld l, a - ld a, [$c70d] + ld a, [wc70d] ld h, a .asm_17de2e @@ -2146,26 +2146,26 @@ Function17ddcd: Function17de32: call IncCrashCheckPointer - ld de, $c708 + ld de, wc708 ld bc, $9 call CopyBytes - ld a, [$c710] + ld a, [wc710] ld c, a ld b, $0 call CopyBytes ld a, $6 call GetSRAMBank call Function17f4f6 - ld a, [$c708] + ld a, [wc708] ld e, a - ld a, [$c709] + ld a, [wc709] ld d, a add hl, de ld e, l ld d, h - ld a, [$c710] + ld a, [wc710] ld c, a - ld hl, $c711 + ld hl, wc711 .asm_17de61 ld a, [de] inc de @@ -2178,23 +2178,23 @@ Function17de32: .asm_17de6b dec c jr nz, .asm_17de61 - ld a, [$c70c] + ld a, [wc70c] ld l, a - ld a, [$c70d] + ld a, [wc70d] ld h, a jr .asm_17de8a .asm_17de78 - ld a, [$c70e] + ld a, [wc70e] ld l, a - ld a, [$c70f] + ld a, [wc70f] ld h, a jr .asm_17de8a .asm_17de82 - ld a, [$c70a] + ld a, [wc70a] ld l, a - ld a, [$c70b] + ld a, [wc70b] ld h, a .asm_17de8a @@ -2204,20 +2204,20 @@ Function17de32: Function17de91: call IncCrashCheckPointer - ld de, $c708 + ld de, wc708 ld bc, $7 call CopyBytes ld a, $6 call GetSRAMBank call Function17f4f6 - ld a, [$c708] + ld a, [wc708] ld e, a - ld a, [$c709] + ld a, [wc709] ld d, a add hl, de ld e, l ld d, h - ld a, [$c70a] + ld a, [wc70a] ld c, a ld b, $0 ld hl, Unknown_17da8c @@ -2227,16 +2227,16 @@ Function17de91: ld h, d and [hl] jr nz, .asm_17deca - ld a, [$c70d] + ld a, [wc70d] ld l, a - ld a, [$c70e] + ld a, [wc70e] ld h, a jr .asm_17ded2 .asm_17deca - ld a, [$c70b] + ld a, [wc70b] ld l, a - ld a, [$c70c] + ld a, [wc70c] ld h, a .asm_17ded2 @@ -2246,7 +2246,7 @@ Function17de91: Function17ded9: call IncCrashCheckPointer - ld de, $c708 + ld de, wc708 ld bc, $1f call CopyBytes call Function17e32b @@ -2254,7 +2254,7 @@ Function17ded9: push af ld a, $1 ld [rSVBK], a - ld hl, $c708 + ld hl, wc708 ld a, [hli] ld [wCurPartySpecies], a ld [wTempEnemyMonSpecies], a @@ -2585,14 +2585,14 @@ asm_17e0ee Function17e0fd: call IncCrashCheckPointer - ld de, $c708 + ld de, wc708 ld bc, $6 call CopyBytes ld a, [rSVBK] push af ld a, $1 ld [rSVBK], a - ld hl, $c708 + ld hl, wc708 ld a, [hli] ld [wCurItem], a ld a, [hli] @@ -2618,14 +2618,14 @@ Function17e0fd: Function17e133: call IncCrashCheckPointer - ld de, $c708 + ld de, wc708 ld bc, $5 call CopyBytes ld a, [rSVBK] push af ld a, $1 ld [rSVBK], a - ld hl, $c708 + ld hl, wc708 ld a, [hli] ld [wScriptVar], a push hl @@ -2648,14 +2648,14 @@ Function17e133: Function17e165: call IncCrashCheckPointer - ld de, $c708 + ld de, wc708 ld bc, $5 call CopyBytes ld a, [rSVBK] push af ld a, $1 ld [rSVBK], a - ld hl, $c708 + ld hl, wc708 ld a, [hli] ld [wCurItem], a push hl @@ -2684,31 +2684,31 @@ Function17e165: Function17e1a1: call IncCrashCheckPointer - ld de, $c708 + ld de, wc708 ld bc, $d call CopyBytes - ld a, [$c70a] + ld a, [wc70a] cp $c0 jr c, .asm_17e1bb - ld a, [$c708] + ld a, [wc708] ld [rSVBK], a jr .asm_17e1c1 .asm_17e1bb - ld a, [$c708] + ld a, [wc708] call GetSRAMBank .asm_17e1c1 - ld a, [$c709] + ld a, [wc709] ld l, a - ld a, [$c70a] + ld a, [wc70a] ld h, a - ld de, $c608 - ld a, [$c70b] + ld de, wc608 + ld a, [wc70b] ld c, a ld b, $0 call CopyBytes - ld a, [$c70a] + ld a, [wc70a] cp $c0 jr c, .asm_17e1e2 ld a, $4 @@ -2719,28 +2719,28 @@ Function17e1a1: call CloseSRAM .asm_17e1e5 - ld a, [$c70e] + ld a, [wc70e] cp $c0 jr c, .asm_17e1f3 - ld a, [$c70c] + ld a, [wc70c] ld [rSVBK], a jr .asm_17e1f9 .asm_17e1f3 - ld a, [$c70c] + ld a, [wc70c] call GetSRAMBank .asm_17e1f9 - ld a, [$c70d] + ld a, [wc70d] ld l, a - ld a, [$c70e] + ld a, [wc70e] ld h, a - ld de, $c688 - ld a, [$c70b] + ld de, wc688 + ld a, [wc70b] ld c, a ld b, $0 call CopyBytes - ld a, [$c70e] + ld a, [wc70e] cp $c0 jr c, .asm_17e21a ld a, $4 @@ -2751,10 +2751,10 @@ Function17e1a1: call CloseSRAM .asm_17e21d - ld a, [$c70b] + ld a, [wc70b] ld c, a - ld hl, $c688 - ld de, $c608 + ld hl, wc688 + ld de, wc608 .asm_17e227 ld a, [de] inc de @@ -2767,23 +2767,23 @@ Function17e1a1: .asm_17e231 dec c jr nz, .asm_17e227 - ld a, [$c711] + ld a, [wc711] ld l, a - ld a, [$c712] + ld a, [wc712] ld h, a jr .asm_17e250 .asm_17e23e - ld a, [$c70f] + ld a, [wc70f] ld l, a - ld a, [$c710] + ld a, [wc710] ld h, a jr .asm_17e250 .asm_17e248 - ld a, [$c712 + 1] + ld a, [wc712 + 1] ld l, a - ld a, [$c712 + 2] + ld a, [wc712 + 2] ld h, a .asm_17e250 @@ -2927,7 +2927,7 @@ Function17e309: Function17e32b: ld a, $5 call GetSRAMBank - ld hl, $c608 + ld hl, wc608 ld de, $b0b1 ld bc, $40 call CopyBytes @@ -2941,7 +2941,7 @@ Function17e349: ld a, $5 call GetSRAMBank ld hl, $b0b1 - ld de, $c608 + ld de, wc608 ld bc, $40 call CopyBytes ld de, wBGMapBuffer @@ -2967,7 +2967,7 @@ endr ENDM IncCrashCheckPointer_SaveGameData: - inc_crash_check_pointer_farcall SaveGameData_ + inc_crash_check_pointer_farcall _SaveGameData IncCrashCheckPointer_SaveAfterLinkTrade: inc_crash_check_pointer_farcall SaveAfterLinkTrade @@ -3286,7 +3286,7 @@ Function17e5af: ld h, a bccoord 0, 0 add hl, bc - ld bc, $ffec + ld bc, hFFEC add hl, bc ld a, [wMobileInactivityTimerSeconds] ld c, a @@ -3505,9 +3505,9 @@ Function17e691: Function17e6de: push af - ld a, [$c708] + ld a, [wc708] ld l, a - ld a, [$c709] + ld a, [wc709] ld h, a decoord 0, 0, wAttrMap add hl, de @@ -3570,25 +3570,25 @@ Palette_17eff6: RGB 24, 16, 3 RGB 0, 0, 0 -Function17f036:: +RunMobileScript:: ld a, $6 call GetSRAMBank inc de -.asm_17f03c - call Function17f047 - jr c, .asm_17f043 - jr .asm_17f03c +.loop + call _RunMobileScript + jr c, .finished + jr .loop -.asm_17f043 +.finished call CloseSRAM ret -Function17f047: +_RunMobileScript: ld a, [de] inc de - cp $50 + cp "@" jr z, .finished - cp $10 + cp $10 ; jumptable size jr nc, .finished dec a push de @@ -3641,7 +3641,7 @@ Function17f081: ld b, $0 add hl, bc ld a, [de] - cp $50 + cp "@" jr z, .asm_17f09d and a ret @@ -3726,7 +3726,7 @@ Function17f0f8: ld b, $0 add hl, bc ld a, [de] - cp $50 + cp "@" jr z, .asm_17f112 and a ret @@ -3749,15 +3749,15 @@ Function17f0f8: ld a, [wcd55] ld d, a add hl, de - ld de, $c608 + ld de, wc608 ld a, [wcd56] ld c, a ld b, $0 call CopyBytes - ld a, $50 + ld a, "@" ld [de], a pop hl - ld de, $c608 + ld de, wc608 call PlaceString ld a, c ld [wcd52], a @@ -3778,7 +3778,7 @@ Function17f154: ld e, l ld d, h ld a, [de] - cp $50 + cp "@" jr z, .asm_17f165 and a ret @@ -3823,7 +3823,7 @@ Function17f181: ld b, $0 add hl, bc ld a, [de] - cp $50 + cp "@" jr z, .asm_17f19b and a ret @@ -3847,10 +3847,10 @@ Function17f181: add hl, de ld a, [hl] ld c, a - ld de, $c608 + ld de, wc608 farcall Function48c63 pop hl - ld de, $c608 + ld de, wc608 call PlaceString ld a, c ld [wcd52], a @@ -3877,7 +3877,7 @@ Function17f1d0: ld b, $0 add hl, bc ld a, [de] - cp $50 + cp "@" jr z, .asm_17f1ea and a ret @@ -3902,7 +3902,7 @@ Function17f1d0: ld a, [hl] ld a, $1 ld [rSVBK], a - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName pop hl call PlaceString @@ -3933,7 +3933,7 @@ Function17f220: ld b, $0 add hl, bc ld a, [de] - cp $50 + cp "@" jr z, .asm_17f23a and a ret @@ -3996,7 +3996,7 @@ Function17f27b: ld b, $0 add hl, bc ld a, [de] - cp $50 + cp "@" jr z, .asm_17f295 and a ret @@ -4021,7 +4021,7 @@ Function17f27b: ld a, [hl] ld a, $1 ld [rSVBK], a - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetItemName pop hl call PlaceString @@ -4079,13 +4079,13 @@ Function17f2ff: ld a, $1 ld [rSVBK], a ld hl, wPlayerName - ld de, $c608 + ld de, wc608 ld bc, $6 call CopyBytes ld a, $4 ld [rSVBK], a pop hl - ld de, $c608 + ld de, wc608 call PlaceString ld a, c ld [wcd52], a @@ -4125,10 +4125,10 @@ Function17f334: .asm_17f35d ld c, a call CloseSRAM - ld de, $c608 + ld de, wc608 farcall Function48c63 pop hl - ld de, $c608 + ld de, wc608 call PlaceString ld a, c ld [wcd52], a @@ -4186,14 +4186,14 @@ Function17f382: Function17f3c9: push bc ld hl, wcd36 - ld de, $c708 + ld de, wc708 ld bc, 12 call CopyBytes pop de ld c, $0 farcall Function11c075 push hl - ld hl, $c708 + ld hl, wc708 ld de, wcd36 ld bc, $c call CopyBytes @@ -4304,7 +4304,7 @@ Function17f44f: ld b, 0 add hl, bc ld a, [de] - cp $50 + cp "@" jr z, .asm_17f46b and a ret @@ -4337,7 +4337,7 @@ Function17f44f: ld l, a ld a, [wcd56] ld h, a - ld de, $c608 + ld de, wc608 ld a, [wcd57] ld c, a ld b, $0 @@ -4355,7 +4355,7 @@ Function17f44f: call GetSRAMBank .asm_17f4b7 - ld de, $c608 + ld de, wc608 pop hl push hl ld a, [wcd57] diff --git a/tools/Makefile b/tools/Makefile index 4a5d51507..d29d5d748 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -19,5 +19,6 @@ clean: rm -f $(tools) gfx md5: common.h + %: %.c $(CC) $(CFLAGS) -o $@ $< diff --git a/tools/free_space.awk b/tools/free_space.awk new file mode 100644 index 000000000..1f2b04415 --- /dev/null +++ b/tools/free_space.awk @@ -0,0 +1,13 @@ +#!/usr/bin/awk -f + +# Usage: tools/free_space.awk pokecrystal.map + +BEGIN { + total = free = 16384 * 128 +} +/^ SECTION: \$[0-7]/ { + free -= strtonum("0x" substr($3, 3)) +} +END { + printf "Free space: %d/%d (%.2f%%)\n", free, total, free * 100 / total +} diff --git a/tools/lzcomp.c b/tools/lzcomp.c index 7d3e0b8fc..f2669aef8 100644 --- a/tools/lzcomp.c +++ b/tools/lzcomp.c @@ -11,13 +11,24 @@ struct command { signed value: 17; }; +struct options { + const char * input; + const char * output; + unsigned char mode; +}; + int main(int, char **); +struct options get_options(char **); +void usage(const char *); void error_exit(int, const char *, ...); void bit_flip(const unsigned char *, unsigned short, unsigned char *); unsigned char * read_file_into_buffer(const char *, unsigned short *); +void write_commands_to_textfile(const char *, const struct command *, unsigned, const unsigned char *); +void write_command_to_textfile(FILE *, struct command, const unsigned char *); void write_commands_to_file(const char *, const struct command *, unsigned, const unsigned char *); void write_command_to_file(FILE *, struct command, const unsigned char *); struct command * compress(const unsigned char *, unsigned short *); +struct command * store_uncompressed(unsigned short *); struct command * try_compress(const unsigned char *, const unsigned char *, unsigned short *, unsigned); struct command find_best_copy(const unsigned char *, unsigned short, unsigned short, const unsigned char *, unsigned); unsigned short scan_forwards(const unsigned char *, unsigned short, const unsigned char *, unsigned short, short *); @@ -32,20 +43,50 @@ struct command * select_command_sequence(struct command **, const unsigned short struct command * merge_command_sequences(const struct command *, unsigned short, const struct command *, unsigned short, unsigned short *); unsigned short compressed_length(const struct command *, unsigned short); -int main (int argc, char ** argv) { - if (argc < 3) { - fprintf(stderr, "usage: %s <source file> <compressed output>\n", *argv); - return 3; - } +int main (int argc __attribute__((unused)), char ** argv) { + struct options options = get_options(argv); unsigned short size; - unsigned char * file_buffer = read_file_into_buffer(argv[1], &size); + unsigned char * file_buffer = read_file_into_buffer(options.input, &size); struct command * compressed = compress(file_buffer, &size); - write_commands_to_file(argv[2], compressed, size, file_buffer); + if (options.mode) + write_commands_to_textfile(options.output, compressed, size, file_buffer); + else + write_commands_to_file(options.output, compressed, size, file_buffer); free(file_buffer); free(compressed); return 0; } +struct options get_options (char ** argv) { + struct options result = {.input = NULL, .output = NULL, .mode = 0}; + const char * program_name = *argv; + for (argv ++; *argv; argv ++) { + if (strncmp(*argv, "--", 2)) break; + if (!strcmp(*argv, "--")) { + argv ++; + break; + } else if (!strcmp(*argv, "--text")) + result.mode = 1; + else if (!strcmp(*argv, "--binary")) + result.mode = 0; + else + error_exit(3, "unknown option: %s", *argv); + } + if (!*argv) usage(program_name); + result.input = *argv; + result.output = argv[1]; + return result; +} + +void usage (const char * program_name) { + fprintf(stderr, "Usage: %s [<options>] <source file> [<compressed output>]\n\n", program_name); + fputs("Options:\n", stderr); + fputs(" --text Output the command stream as text.\n", stderr); + fputs(" --binary Output the command stream as binary data (default).\n", stderr); + fputs(" -- End of option list.\n", stderr); + exit(3); +} + void error_exit (int error_code, const char * error, ...) { va_list ap; va_start(ap, error); @@ -77,13 +118,63 @@ unsigned char * read_file_into_buffer (const char * file, unsigned short * size) return buf; } +void write_commands_to_textfile (const char * file, const struct command * commands, unsigned count, const unsigned char * input_stream) { + FILE * fp = file ? fopen(file, "w") : stdout; + if (!fp) error_exit(1, "could not open file %s for writing", file); + while (count --) write_command_to_textfile(fp, *(commands ++), input_stream); + if (fputs("\tlzend\n", fp) < 0) error_exit(1, "could not write terminator to compressed output"); + if (file) fclose(fp); +} + +void write_command_to_textfile (FILE * fp, struct command command, const unsigned char * input_stream) { + if ((!command.count) || (command.count > 1024)) error_exit(2, "invalid command in output stream"); + int rv, pos; + const char * kind; + switch (command.command) { + case 0: + if ((rv = fprintf(fp, "\tlzdata")) < 0) break; + for (pos = 0; pos < command.count; pos ++) if ((rv = fprintf(fp, "%s$%02hhx", pos ? ", " : " ", input_stream[command.value + pos])) < 0) break; + rv = putc('\n', fp); + break; + case 1: + if ((command.value < 0) || (command.value > 255)) error_exit(2, "invalid command in output stream"); + rv = fprintf(fp, "\tlzrepeat %u, $%02hhx\n", command.count, (unsigned char) command.value); + break; + case 2: + if (command.value < 0) error_exit(2, "invalid command in output stream"); + rv = fprintf(fp, "\tlzrepeat %u, $%02hhx, $%02hhx\n", command.count, (unsigned char) command.value, (unsigned char) (command.value >> 8)); + break; + case 3: + rv = fprintf(fp, "\tlzzero %u\n", command.count); + break; + case 4: + kind = "normal"; + goto copy; + case 5: + kind = "flipped"; + goto copy; + case 6: + kind = "reversed"; + copy: + if ((command.value < -128) || (command.value > 32767)) error_exit(2, "invalid command in output stream"); + if (command.value < 0) + rv = fprintf(fp, "\tlzcopy %s, %u, %d\n", kind, command.count, command.value); + else + rv = fprintf(fp, "\tlzcopy %s, %u, $%04hx\n", kind, command.count, (unsigned short) command.value); + break; + default: + error_exit(2, "invalid command in output stream"); + } + if (rv < 0) error_exit(1, "could not write command to compressed output"); +} + void write_commands_to_file (const char * file, const struct command * commands, unsigned count, const unsigned char * input_stream) { - FILE * fp = fopen(file, "wb"); + FILE * fp = file ? fopen(file, "wb") : stdout; if (!fp) error_exit(1, "could not open file %s for writing", file); while (count --) write_command_to_file(fp, *(commands ++), input_stream); unsigned char terminator = -1; if (fwrite(&terminator, 1, 1, fp) != 1) error_exit(1, "could not write terminator to compressed output"); - fclose(fp); + if (file) fclose(fp); } void write_command_to_file (FILE * fp, struct command command, const unsigned char * input_stream) { @@ -113,7 +204,7 @@ void write_command_to_file (FILE * fp, struct command command, const unsigned ch *(pos ++) = command.value; } } - if ((int)fwrite(buf, 1, pos - buf, fp) != (pos - buf)) error_exit(1, "could not write command to compressed output"); + if (fwrite(buf, 1, pos - buf, fp) != (size_t)(pos - buf)) error_exit(1, "could not write command to compressed output"); if (command.command) return; command.count ++; if (fwrite(input_stream + command.value, 1, command.count, fp) != command.count) error_exit(1, "could not write data to compressed output"); @@ -122,16 +213,31 @@ void write_command_to_file (FILE * fp, struct command command, const unsigned ch struct command * compress (const unsigned char * data, unsigned short * size) { unsigned char * bitflipped = malloc(*size); bit_flip(data, *size, bitflipped); - struct command * compressed_sequences[COMPRESSION_METHODS]; - unsigned short lengths[COMPRESSION_METHODS]; + struct command * compressed_sequences[COMPRESSION_METHODS + 1]; + unsigned short lengths[COMPRESSION_METHODS + 1]; unsigned current; for (current = 0; current < COMPRESSION_METHODS; current ++) { lengths[current] = *size; compressed_sequences[current] = try_compress(data, bitflipped, lengths + current, current); } free(bitflipped); - struct command * result = select_command_sequence(compressed_sequences, lengths, COMPRESSION_METHODS, size); - for (current = 0; current < COMPRESSION_METHODS; current ++) free(compressed_sequences[current]); + lengths[COMPRESSION_METHODS] = *size; + compressed_sequences[COMPRESSION_METHODS] = store_uncompressed(lengths + COMPRESSION_METHODS); + struct command * result = select_command_sequence(compressed_sequences, lengths, COMPRESSION_METHODS + 1, size); + for (current = 0; current <= COMPRESSION_METHODS; current ++) free(compressed_sequences[current]); + return result; +} + +struct command * store_uncompressed (unsigned short * size) { + unsigned short position, block, remainder = *size; + struct command * result = NULL; + *size = 0; + for (position = 0; remainder; position += block, remainder -= block) { + block = (remainder > 1024) ? 1024 : remainder; + if ((block <= 64) && (block > 32)) block = 32; + result = realloc(result, sizeof(struct command) * (1 + *size)); + result[(*size) ++] = (struct command) {.command = 0, .count = block, .value = position}; + } return result; } @@ -220,7 +326,8 @@ unsigned short scan_backwards (const unsigned char * data, unsigned short limit, unsigned short position; for (position = 0; position < real_position; position ++) { if (data[position] != data[real_position]) continue; - for (current_length = 0; (current_length < limit) && (data[position - current_length] == data[real_position + current_length]); current_length ++); + for (current_length = 0; (current_length <= position) && (current_length < limit) && + (data[position - current_length] == data[real_position + current_length]); current_length ++); if (current_length > 1024) current_length = 1024; if (current_length < best_length) continue; best_match = position; @@ -310,7 +417,7 @@ void optimize (struct command * commands, unsigned short count) { break; case 1: if (commands -> value != next -> value) break; - // falls through + // fall through case 3: if ((commands -> count + next -> count) <= 1024) { commands -> count += next -> count; @@ -158,11 +158,10 @@ wDisableTextAcceleration:: db wPreviousLandmark:: db wCurrentLandmark:: db wLandmarkSignTimer:: dw -wLinkMode:: ; c2dc -; 0 not in link battle -; 1 link battle -; 4 mobile battle - db + +wLinkMode:: +; a LINK_* value for the link type + db ; c2dc wScriptVar:: db ; c2dd @@ -359,7 +358,13 @@ SECTION "Battle", WRAM0 UNION ; c608 ; unidentified uses -wc608:: ds 480 +wc608:: ds 53 +wc63d:: ds 5 +wc642:: ds 5 +wc647:: ds 33 +wc668:: ds 32 +wc688:: ds 2 +wc68a:: ds 350 NEXTU ; c608 ; surrounding tiles @@ -868,7 +873,18 @@ endc NEXTU ; c6d0 ; mobile data -wc6d0:: ds 126 +wc6d0:: ds 56 +wc708:: db +wc709:: db +wc70a:: db +wc70b:: db +wc70c:: db +wc70d:: db +wc70e:: db +wc70f:: db +wc710:: db +wc711:: db +wc712:: ds 60 wc74e:: ds 107 wc7b9:: ds 1 wc7ba:: ds 1 @@ -1304,9 +1320,7 @@ wcf5d:: dw wMonType:: db ; cf5f -wCurSpecies:: -wCurMove:: - db ; cf60 +wCurSpecies:: db ; cf60 wNamedObjectTypeBuffer:: db @@ -1659,11 +1673,7 @@ wRadioTextEnd:: NEXTU ; d002 ; lucky number show -wLuckyNumberDigit1Buffer:: db -wLuckyNumberDigit2Buffer:: db -wLuckyNumberDigit3Buffer:: db -wLuckyNumberDigit4Buffer:: db -wLuckyNumberDigit5Buffer:: db +wLuckyNumberDigitsBuffer:: ds 5 NEXTU ; d002 ; movement buffer data @@ -1685,7 +1695,7 @@ NEXTU ; d002 ; trainer HUD data ds 1 wPlaceBallsDirection:: db -wTrainerHUDTiles:: db +wTrainerHUDTiles:: ds 4 NEXTU ; d002 ; mobile participant nicknames @@ -1715,7 +1725,8 @@ wd003:: db wd004:: db ; mobile? - ds 3 + ds 1 +wd006:: ds 2 wd008:: ds 2 ds 2 wd00c:: ds 1 @@ -1870,7 +1881,7 @@ wTMHMPocketScrollPosition:: db wSwitchMon:: wSwitchItem:: wMoveSwapBuffer:: -wd0e3:: +wd0e3:: ; mobile db wMenuScrollPosition:: ds 4 @@ -2183,11 +2194,24 @@ wPutativeTMHMMove:: db wInitListType:: db wBattleHasJustStarted:: db +; d265 has many different short-term uses wNamedObjectIndexBuffer:: -wCurTMHM:: +wDeciramBuffer:: +wTempByteValue:: +wNumSetBits:: wTypeMatchup:: -wFoundMatchingIDInParty:: -wd265:: +wCurType:: +wTempSpecies:: +wTempIconSpecies:: +wTempTMHM:: +wTempPP:: +wNextBoxOrPartyIndex:: +wChosenCableClubRoom:: +wBreedingCompatibility:: +wMoveGrammar:: +wApplyStatLevelMultipliersToEnemy:: +wUsePPUp:: +wd265:: ; mobile db wFailedToFlee:: db @@ -2507,7 +2531,7 @@ wRegisteredItem:: db ; d95c wPlayerState:: db ; d95d wHallOfFameCount:: dw -wTradeFlags:: flag_array PARTY_LENGTH ; d960 +wTradeFlags:: flag_array NUM_NPC_TRADES ; d960 ds 1 wMooMooBerries:: db ; d962 wUndergroundSwitchPositions:: db ; d963 @@ -2690,8 +2714,8 @@ wWhichMomItemSet:: db ; dc18 wMomItemTriggerBalance:: ds 3 ; dc19 wDailyResetTimer:: dw ; dc1c -wDailyFlags:: db -wWeeklyFlags:: db +wDailyFlags1:: db +wDailyFlags2:: db wSwarmFlags:: db ds 2 wTimerEventStartDay:: db @@ -2876,6 +2900,7 @@ wTempTileMap:: ds SCREEN_WIDTH * SCREEN_HEIGHT ; $168 = 360 ; PokeAnim data +wPokeAnimStruct:: wPokeAnimSceneIndex:: db wPokeAnimPointer:: dw wPokeAnimSpecies:: db @@ -2884,7 +2909,6 @@ wPokeAnimSpeciesOrUnown:: db wPokeAnimGraphicStartTile:: db wPokeAnimCoord:: dw wPokeAnimFrontpicHeight:: db -; PokeAnim Data wPokeAnimIdleFlag:: db wPokeAnimSpeed:: db wPokeAnimPointerBank:: db |