diff options
1214 files changed, 53521 insertions, 30185 deletions
diff --git a/.gitattributes b/.gitattributes index bc973be0..3b289089 100644 --- a/.gitattributes +++ b/.gitattributes @@ -15,4 +15,4 @@ *.map binary *.wav binary *.blk binary -*.pic binary +*.pic binary
\ No newline at end of file @@ -19,6 +19,9 @@ *.1bpp *.pic +# converted audio data +*.pcm + # swap files for vim .*.swp @@ -30,6 +33,27 @@ *.sav *.sys +# lol bgb +*.sn1 +*.sn2 +*.sn3 +*.sn4 +*.sn5 +*.sn6 +*.sn7 +*.sn8 +*.sn9 +*.sn0 + +# replace.sh +replace.sh + +# leftover txt files from diff +*.txt + # for vim configuration # url: http://www.vim.org/scripts/script.php?script_id=441 .lvimrc + +# extras is a submodule, don't include +extras/ diff --git a/.gitmodules b/.gitmodules index 1f76b537..5ea53c08 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "extras"] path = extras - url = git://github.com/kanzure/pokemon-reverse-engineering-tools.git + url = git://github.com/pret/pokemon-reverse-engineering-tools.git + ignore = dirty @@ -1,38 +1,38 @@ # Linux - sudo apt-get install make gcc bison git python + sudo apt-get install make gcc bison git python python-pip + sudo pip install pypng git clone https://github.com/bentley/rgbds cd rgbds sudo make install cd .. - git clone --recursive https://github.com/pret/pokered - cd pokered - -To build **pokered.gbc** and **pokeblue.gbc**: + git clone --recursive https://github.com/pret/pokeyellow + cd pokeyellow +To build **pokeyellow.gbc**: make -To build them individually: - - make red - make blue - # Mac In **Terminal**, run: xcode-select --install + sudo easy_install pypng git clone https://github.com/bentley/rgbds cd rgbds sudo make install cd .. - git clone --recursive https://github.com/pret/pokered - cd pokered + git clone --recursive https://github.com/pret/pokeyellow + cd pokeyellow + +Copy the ROM "Pokemon Yellow (U) [C][!].gbc" to the same directory as the disassembly under the name "baserom.gbc". + +Then run (in the shell): make @@ -46,9 +46,17 @@ In the installer, select the following packages: `make` `git` `python` `gettext` Then get the most recent version of [**rgbds**](https://github.com/bentley/rgbds/releases/). Extract the archive and put `rgbasm.exe`, `rgblink.exe` and `rgbfix.exe` in `C:\cygwin\usr\local\bin`. + In the **Cygwin terminal**: - git clone --recursive https://github.com/pret/pokered - cd pokered + lynx -source bootstrap.pypa.io/get-pip.py | python + pip install pypng + + git clone --recursive https://github.com/pret/pokeyellow + cd pokeyellow + +Copy the ROM "Pokemon Yellow (U) [C][!].gbc" to the same directory as the disassembly under the name "baserom.gbc". + +Then run (in the Cygwin terminal): make @@ -1,61 +1,56 @@ PYTHON := python MD5 := md5sum -c --quiet -2bpp := $(PYTHON) extras/pokemontools/gfx.py 2bpp -1bpp := $(PYTHON) extras/pokemontools/gfx.py 1bpp +2bpp := $(PYTHON) gfx.py 2bpp +1bpp := $(PYTHON) gfx.py 1bpp +pcm := $(PYTHON) extras/pokemontools/pcm.py pcm pic := $(PYTHON) extras/pokemontools/pic.py compress includes := $(PYTHON) extras/pokemontools/scan_includes.py -base_obj := \ +objs := \ audio.o \ main.o \ text.o \ wram.o -red_obj := $(base_obj:.o=_red.o) -blue_obj := $(base_obj:.o=_blue.o) -all_obj := $(red_obj) $(blue_obj) - -$(foreach obj, $(base_obj:.o=), \ +$(foreach obj, $(objs:.o=), \ $(eval $(obj)_dep := $(shell $(includes) $(obj).asm)) \ ) .SUFFIXES: -.SUFFIXES: .asm .o .gbc .png .2bpp .1bpp .pic +.SUFFIXES: .asm .o .gbc .png .2bpp .1bpp .pic .wav .pcm .SECONDEXPANSION: # Suppress annoying intermediate file deletion messages. .PRECIOUS: %.2bpp -.PHONY: all clean red blue compare +.PHONY: all clean yellow compare -roms := pokered.gbc pokeblue.gbc +rom := pokeyellow.gbc -all: $(roms) -red: pokered.gbc -blue: pokeblue.gbc +all: $(rom) +yellow: $(rom) # For contributors to make sure a change didn't affect the contents of the rom. -compare: red blue +compare: yellow @$(MD5) roms.md5 clean: - rm -f $(roms) $(all_obj) $(roms:.gbc=.sym) - find . \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pic' \) -exec rm {} + + rm -f $(rom) $(objs) $(rom:.gbc=.sym) + find . \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pic' -o -iname '*.pcm' \) -exec rm {} + %.asm: ; -$(red_obj): %_red.o: %.asm $$(%_dep) - rgbasm -D "_RED" -h -o $@ $*.asm -$(blue_obj): %_blue.o: %.asm $$(%_dep) - rgbasm -D "_BLUE" -h -o $@ $*.asm +$(objs): %.o: %.asm $$(%_dep) + rgbasm -h -o $@ $*.asm -dmg_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -red_opt = $(dmg_opt) -t "POKEMON RED" -blue_opt = $(dmg_opt) -t "POKEMON BLUE" +opts = -cjsv -k 01 -l 0x33 -m 0x1b -p 0 -r 03 -t "POKEMON YELLOW" -poke%.gbc: $$(%_obj) - rgblink -n poke$*.sym -o $@ $^ - rgbfix $($*_opt) $@ +$(rom): $(objs) + rgblink -n $*.sym -o $@ $^ + rgbfix $(opts) $@ %.png: ; %.2bpp: %.png ; @$(2bpp) $< %.1bpp: %.png ; @$(1bpp) $< %.pic: %.2bpp ; @$(pic) $< + +%.wav: ; +%.pcm: %.wav ; @$(pcm) $< @@ -1,19 +1,20 @@ -# Pokémon Red and Blue +# Pokémon Yellow -This is a disassembly of Pokémon Red and Blue. +This is a disassembly of Pokémon Yellow. -It builds the following roms: +It builds the following rom: -* Pokemon Red (UE) [S][!].gb `md5: 3d45c1ee9abd5738df46d2bdda8b57dc` -* Pokemon Blue (UE) [S][!].gb `md5: 50927e843568814f7ed45ec4f944bd8b` +* Pokemon Yellow (UE) [C][!].gbc `md5: d9290db87b1f0a23b89f99ee4469e34b` To set up the repository, see [**INSTALL.md**](INSTALL.md). ## See also +* Disassembly of [**Pokémon Red/Blue**][pokered] * Disassembly of [**Pokémon Crystal**][pokecrystal] * irc: **irc.freenode.net** [**#pret**][irc] +[pokered]: https://github.com/iimarckus/pokered [pokecrystal]: https://github.com/kanzure/pokecrystal [irc]: https://kiwiirc.com/client/irc.freenode.net/?#pret @@ -1,7 +1,29 @@ +INCLUDE "charmap.asm" AUDIO_1 EQU $2 AUDIO_2 EQU $8 AUDIO_3 EQU $1f +AUDIO_4 EQU $20 + +PCM_1 EQU $21 +PCM_2 EQU $22 +PCM_3 EQU $23 +PCM_4 EQU $24 +PCM_5 EQU $25 +PCM_6 EQU $31 +PCM_7 EQU $32 +PCM_8 EQU $33 +PCM_9 EQU $34 +PCM_10 EQU $35 +PCM_11 EQU $36 +PCM_12 EQU $37 +PCM_13 EQU $38 +GLOBAL AUDIO_1, AUDIO_2, AUDIO_3, AUDIO_4 +GLOBAL PCM_1, PCM_2, PCM_3, PCM_4, PCM_5, PCM_6, PCM_7 +GLOBAL PCM_8, PCM_9, PCM_10, PCM_11, PCM_12, PCM_13 + + + INCLUDE "constants.asm" @@ -15,7 +37,8 @@ INCLUDE "audio/headers/sfxheaders2.asm" SECTION "Sound Effect Headers 3", ROMX, BANK[AUDIO_3] INCLUDE "audio/headers/sfxheaders3.asm" - +SECTION "Sound Effect Headers 4", ROMX, BANK[AUDIO_4] +INCLUDE "audio/headers/sfxheaders4.asm" SECTION "Music Headers 1", ROMX, BANK[AUDIO_1] INCLUDE "audio/headers/musicheaders1.asm" @@ -26,7 +49,8 @@ INCLUDE "audio/headers/musicheaders2.asm" SECTION "Music Headers 3", ROMX, BANK[AUDIO_3] INCLUDE "audio/headers/musicheaders3.asm" - +SECTION "Music Headers 4", ROMX, BANK[AUDIO_4] +INCLUDE "audio/headers/musicheaders4.asm" SECTION "Sound Effects 1", ROMX, BANK[AUDIO_1] @@ -49,9 +73,7 @@ INCLUDE "audio/sfx/triangle3_1.asm" INCLUDE "audio/sfx/muted_snare2_1.asm" INCLUDE "audio/sfx/muted_snare3_1.asm" INCLUDE "audio/sfx/muted_snare4_1.asm" - -Audio1_WavePointers: INCLUDE "audio/wave_instruments.asm" - +; Audio1_WavePointers: INCLUDE "audio/wave_instruments.asm" INCLUDE "audio/sfx/start_menu_1.asm" INCLUDE "audio/sfx/pokeflute.asm" INCLUDE "audio/sfx/cut_1.asm" @@ -126,7 +148,6 @@ INCLUDE "audio/sfx/cry20_1.asm" INCLUDE "audio/sfx/cry21_1.asm" INCLUDE "audio/sfx/cry22_1.asm" - SECTION "Sound Effects 2", ROMX, BANK[AUDIO_2] INCLUDE "audio/sfx/snare1_2.asm" @@ -148,9 +169,7 @@ INCLUDE "audio/sfx/triangle3_2.asm" INCLUDE "audio/sfx/muted_snare2_2.asm" INCLUDE "audio/sfx/muted_snare3_2.asm" INCLUDE "audio/sfx/muted_snare4_2.asm" - -Audio2_WavePointers: INCLUDE "audio/wave_instruments.asm" - +;Audio2_WavePointers: INCLUDE "audio/wave_instruments.asm" INCLUDE "audio/sfx/press_ab_2.asm" INCLUDE "audio/sfx/start_menu_2.asm" INCLUDE "audio/sfx/tink_2.asm" @@ -162,6 +181,7 @@ INCLUDE "audio/sfx/ball_poof.asm" INCLUDE "audio/sfx/faint_thud.asm" INCLUDE "audio/sfx/run.asm" INCLUDE "audio/sfx/dex_page_added.asm" +INCLUDE "audio/sfx/swap_2.asm" ; added in yellow INCLUDE "audio/sfx/pokeflute_ch3.asm" INCLUDE "audio/sfx/peck.asm" INCLUDE "audio/sfx/faint_fall.asm" @@ -250,7 +270,7 @@ INCLUDE "audio/sfx/cry1f_2.asm" INCLUDE "audio/sfx/cry20_2.asm" INCLUDE "audio/sfx/cry21_2.asm" INCLUDE "audio/sfx/cry22_2.asm" - +;Audio2_WavePointers: INCLUDE "audio/wave_instruments.asm" SECTION "Sound Effects 3", ROMX, BANK[AUDIO_3] @@ -273,9 +293,7 @@ INCLUDE "audio/sfx/triangle3_3.asm" INCLUDE "audio/sfx/muted_snare2_3.asm" INCLUDE "audio/sfx/muted_snare3_3.asm" INCLUDE "audio/sfx/muted_snare4_3.asm" - -Audio3_WavePointers: INCLUDE "audio/wave_instruments.asm" - +;Audio3_WavePointers: INCLUDE "audio/wave_instruments.asm" INCLUDE "audio/sfx/start_menu_3.asm" INCLUDE "audio/sfx/cut_3.asm" INCLUDE "audio/sfx/go_inside_3.asm" @@ -358,7 +376,79 @@ INCLUDE "audio/sfx/cry20_3.asm" INCLUDE "audio/sfx/cry21_3.asm" INCLUDE "audio/sfx/cry22_3.asm" - +SECTION "Sound Effects 4", ROMX, BANK[AUDIO_4] +INCLUDE "audio/sfx/snare1_4.asm" +INCLUDE "audio/sfx/snare2_4.asm" +INCLUDE "audio/sfx/snare3_4.asm" +INCLUDE "audio/sfx/snare4_4.asm" +INCLUDE "audio/sfx/snare5_4.asm" +INCLUDE "audio/sfx/triangle1_4.asm" +INCLUDE "audio/sfx/triangle2_4.asm" +INCLUDE "audio/sfx/snare6_4.asm" +INCLUDE "audio/sfx/snare7_4.asm" +INCLUDE "audio/sfx/snare8_4.asm" +INCLUDE "audio/sfx/snare9_4.asm" +INCLUDE "audio/sfx/cymbal1_4.asm" +INCLUDE "audio/sfx/cymbal2_4.asm" +INCLUDE "audio/sfx/cymbal3_4.asm" +INCLUDE "audio/sfx/muted_snare1_4.asm" +INCLUDE "audio/sfx/triangle3_4.asm" +INCLUDE "audio/sfx/muted_snare2_4.asm" +INCLUDE "audio/sfx/muted_snare3_4.asm" +INCLUDE "audio/sfx/muted_snare4_4.asm" +INCLUDE "audio/sfx/unknown_80250.asm" +INCLUDE "audio/sfx/unknown_80263.asm" +INCLUDE "audio/sfx/unknown_8026a.asm" +INCLUDE "audio/sfx/heal_ailment_4.asm" +INCLUDE "audio/sfx/tink_4.asm" +INCLUDE "audio/sfx/unknown_8029f.asm" +INCLUDE "audio/sfx/unknown_802b5.asm" +INCLUDE "audio/sfx/unknown_802cc.asm" +INCLUDE "audio/sfx/unknown_802d7.asm" +INCLUDE "audio/sfx/unknown_802e1.asm" +INCLUDE "audio/sfx/get_item2_4_2.asm" +INCLUDE "audio/sfx/unknown_80337.asm" +INCLUDE "audio/sfx/unknown_803da.asm" +INCLUDE "audio/sfx/unknown_80411.asm" +INCLUDE "audio/sfx/unknown_80467.asm" +INCLUDE "audio/sfx/unknown_804bf.asm" +INCLUDE "audio/sfx/unknown_804fa.asm" +INCLUDE "audio/sfx/unknown_80545.asm" +INCLUDE "audio/sfx/unknown_8058b.asm" +INCLUDE "audio/sfx/unknown_805db.asm" +INCLUDE "audio/sfx/unknown_80603.asm" +INCLUDE "audio/sfx/unknown_80633.asm" +INCLUDE "audio/sfx/unknown_80661.asm" +INCLUDE "audio/sfx/unknown_80689.asm" +INCLUDE "audio/sfx/unknown_806af.asm" +INCLUDE "audio/sfx/unknown_80712.asm" +INCLUDE "audio/sfx/unknown_80760.asm" +INCLUDE "audio/sfx/unknown_8077e.asm" +INCLUDE "audio/sfx/unknown_807eb.asm" +INCLUDE "audio/sfx/unknown_8081e.asm" +INCLUDE "audio/sfx/unknown_80879.asm" +INCLUDE "audio/sfx/unknown_808a9.asm" +INCLUDE "audio/sfx/unknown_808fa.asm" +INCLUDE "audio/sfx/unknown_8091c.asm" +INCLUDE "audio/sfx/unknown_80944.asm" +INCLUDE "audio/sfx/unknown_8097f.asm" +INCLUDE "audio/sfx/unknown_809b2.asm" +INCLUDE "audio/sfx/unknown_809fb.asm" +INCLUDE "audio/sfx/unknown_80a23.asm" +INCLUDE "audio/sfx/unknown_80a89.asm" +INCLUDE "audio/sfx/unknown_80ad2.asm" +INCLUDE "audio/sfx/unknown_80b05.asm" +INCLUDE "audio/sfx/unknown_80b53.asm" +INCLUDE "audio/sfx/unknown_80b9c.asm" +INCLUDE "audio/sfx/unknown_80be2.asm" +INCLUDE "audio/sfx/unknown_80c3b.asm" +INCLUDE "audio/sfx/unknown_80c6e.asm" +INCLUDE "audio/sfx/unknown_80ca1.asm" +INCLUDE "audio/sfx/unknown_80ce7.asm" +INCLUDE "audio/music/printer.asm" +INCLUDE "audio/sfx/unknown_80e5a.asm" +INCLUDE "audio/sfx/unknown_80e91.asm" +INCLUDE "audio/sfx/get_item2_4.asm" SECTION "Audio Engine 1", ROMX, BANK[AUDIO_1] @@ -366,15 +456,13 @@ PlayBattleMusic:: xor a ld [wAudioFadeOutControl], a ld [wLowHealthAlarm], a - dec a - ld [wNewSoundID], a - call PlaySound ; stop music + call StopAllMusic call DelayFrame - ld c, BANK(Music_GymLeaderBattle) + ld c, $8 ; BANK(Music_GymLeaderBattle) ld a, [wGymLeaderNo] and a jr z, .notGymLeaderBattle - ld a, MUSIC_GYM_LEADER_BATTLE + ld a, $ea ; MUSIC_GYM_LEADER_BATTLE jr .playSong .notGymLeaderBattle ld a, [wCurOpponent] @@ -384,16 +472,16 @@ PlayBattleMusic:: jr z, .finalBattle cp OPP_LANCE jr nz, .normalTrainerBattle - ld a, MUSIC_GYM_LEADER_BATTLE ; lance also plays gym leader theme + ld a, $ea ; MUSIC_GYM_LEADER_BATTLE ; lance also plays gym leader theme jr .playSong .normalTrainerBattle - ld a, MUSIC_TRAINER_BATTLE + ld a, $ed ; MUSIC_TRAINER_BATTLE jr .playSong .finalBattle - ld a, MUSIC_FINAL_BATTLE + ld a, $f3 ; MUSIC_FINAL_BATTLE jr .playSong .wildBattle - ld a, MUSIC_WILD_BATTLE + ld a, $f0 ; MUSIC_WILD_BATTLE .playSong jp PlayMusic @@ -425,17 +513,20 @@ Music_RivalAlternateTempo:: ld c, BANK(Music_MeetRival) ld a, MUSIC_MEET_RIVAL call PlayMusic - ld hl, wChannelCommandPointers ld de, Music_MeetRival_branch_b119 - jp Audio1_OverwriteChannelPointer + jr asm_99ed ; applies both the alternate start and alternate tempo Music_RivalAlternateStartAndTempo:: call Music_RivalAlternateStart - ld hl, wChannelCommandPointers ld de, Music_MeetRival_branch_b19b +asm_99ed: + ld hl, wChannelCommandPointers jp Audio1_OverwriteChannelPointer +; XXX + ret + ; an alternate tempo for Cities1 which is used for the Hall of Fame room Music_Cities1AlternateTempo:: ld a, 10 @@ -446,13 +537,12 @@ Music_Cities1AlternateTempo:: ld c, 100 call DelayFrames ; wait for the fade-out to finish ld c, BANK(Music_Cities1) - ld a, MUSIC_CITIES1 + ld a, $c3 ; MUSIC_CITIES1 call PlayMusic ld hl, wChannelCommandPointers ld de, Music_Cities1_branch_aa6f jp Audio1_OverwriteChannelPointer - SECTION "Audio Engine 2", ROMX, BANK[AUDIO_2] Music_DoLowHealthAlarm:: @@ -531,32 +621,10 @@ Music_DoLowHealthAlarm:: .toneDataSilence db $00,$00,$00,$80 - INCLUDE "engine/menu/bills_pc.asm" INCLUDE "audio/engine_2.asm" - -Music_PokeFluteInBattle:: - ; begin playing the "caught mon" sound effect - ld a, SFX_CAUGHT_MON - call PlaySoundWaitForCurrent - ; then immediately overwrtie the channel pointers - ld hl, wChannelCommandPointers + CH4 * 2 - ld de, SFX_08_PokeFlute_Ch1 - call Audio2_OverwriteChannelPointer - ld de, SFX_08_PokeFlute_Ch2 - call Audio2_OverwriteChannelPointer - ld de, SFX_08_PokeFlute_Ch3 - -Audio2_OverwriteChannelPointer: - ld a, e - ld [hli], a - ld a, d - ld [hli], a - ret - - SECTION "Audio Engine 3", ROMX, BANK[AUDIO_3] PlayPokedexRatingSfx:: @@ -571,9 +639,7 @@ PlayPokedexRatingSfx:: jr .getSfxPointer .gotSfxPointer push bc - ld a, $ff - ld [wNewSoundID], a - call PlaySoundWaitForCurrent + call StopAllMusic pop bc ld b, $0 ld hl, PokedexRatingSfxPointers @@ -599,10 +665,18 @@ OwnedMonValues: INCLUDE "audio/engine_3.asm" +SECTION "Audio Engine 4", ROMX, BANK[AUDIO_4] + +SurfingPikachu1Graphics1:: INCBIN "gfx/surfing_pikachu_1a.2bpp" +SurfingPikachu1Graphics2:: INCBIN "gfx/surfing_pikachu_1b.2bpp" +SurfingPikachu1Graphics3:: INCBIN "gfx/surfing_pikachu_1c.t5.2bpp" +INCLUDE "audio/engine_4.asm" SECTION "Music 1", ROMX, BANK[AUDIO_1] +Audio1_WavePointers: INCLUDE "audio/wave_instruments.asm" + INCLUDE "audio/music/pkmnhealed.asm" INCLUDE "audio/music/routes1.asm" INCLUDE "audio/music/routes2.asm" @@ -632,7 +706,6 @@ INCLUDE "audio/music/pokecenter.asm" SECTION "Music 2", ROMX, BANK[AUDIO_2] -INCLUDE "audio/sfx/pokeflute_ch1_ch2.asm" INCLUDE "audio/sfx/unused2_2.asm" INCLUDE "audio/music/gymleaderbattle.asm" INCLUDE "audio/music/trainerbattle.asm" @@ -670,4 +743,325 @@ INCLUDE "audio/music/surfing.asm" INCLUDE "audio/music/jigglypuffsong.asm" INCLUDE "audio/music/halloffame.asm" INCLUDE "audio/music/credits.asm" +INCLUDE "audio/music/yellowintro.asm" + +SECTION "Music 4", ROMX, BANK[AUDIO_4] +INCLUDE "audio/music/surfingpikachu.asm" +INCLUDE "audio/music/yellowunusedsong.asm" +INCLUDE "audio/music/meetjessiejames.asm" + +INCBIN "audio/unknown_832b9.bin" + +SECTION "Pikachu Cries 1",ROMX,BANK[PCM_1] +PikachuCry1:: + dw (PikachuCry1_End - PikachuCry1) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_1.pcm" +PikachuCry1_End: + + db $77 ; unused + ; Game Freak might have made a slight error, because all of + ; the pcm data has one trailing byte that is never processed. + +PikachuCry2:: + dw (PikachuCry2_End - PikachuCry2) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_2.pcm" +PikachuCry2_End: + + db $77 ; unused + +PikachuCry3:: + dw (PikachuCry3_End - PikachuCry3) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_3.pcm" +PikachuCry3_End: + + db $03 ; unused + +PikachuCry4:: + dw (PikachuCry4_End - PikachuCry4) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_4.pcm" +PikachuCry4_End: + + db $e0 ; unused + + +SECTION "Pikachu Cries 2",ROMX,BANK[PCM_2] +PikachuCry5:: + dw (PikachuCry5_End - PikachuCry5) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_5.pcm" +PikachuCry5_End: + + db $77 ; unused + +PikachuCry6:: + dw (PikachuCry6_End - PikachuCry6) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_6.pcm" +PikachuCry6_End: + + db $77 ; unused + +PikachuCry7:: + dw (PikachuCry7_End - PikachuCry7) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_7.pcm" +PikachuCry7_End: + + db $ff ; unused + + +SECTION "Pikachu Cries 3",ROMX,BANK[PCM_3] +PikachuCry8:: + dw (PikachuCry8_End - PikachuCry8) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_8.pcm" +PikachuCry8_End: + + db $f7 ; unused + +PikachuCry9:: + dw (PikachuCry9_End - PikachuCry9) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_9.pcm" +PikachuCry9_End: + + db $f3 ; unused + +PikachuCry10:: + dw (PikachuCry10_End - PikachuCry10) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_10.pcm" +PikachuCry10_End: + + db $ff ; unused + + +SECTION "Pikachu Cries 4",ROMX,BANK[PCM_4] +PikachuCry11:: + dw (PikachuCry11_End - PikachuCry11) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_11.pcm" +PikachuCry11_End: + + db $77 ; unused + +PikachuCry12:: + dw (PikachuCry12_End - PikachuCry12) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_12.pcm" +PikachuCry12_End: + + db $ff ; unused + +PikachuCry13:: + dw (PikachuCry13_End - PikachuCry13) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_13.pcm" +PikachuCry13_End: + + db $f0 ; unused + + +SECTION "Pikachu Cries 5",ROMX,BANK[PCM_5] +PikachuCry14:: + dw (PikachuCry14_End - PikachuCry14) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_14.pcm" +PikachuCry14_End: + + db $fc ; unused + +PikachuCry15:: + dw (PikachuCry15_End - PikachuCry15) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_15.pcm" +PikachuCry15_End: + + db $77 ; unused + +SECTION "Pikachu Cries 6",ROMX,BANK[PCM_6] +PikachuCry16:: + dw (PikachuCry16_End - PikachuCry16) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_16.pcm" +PikachuCry16_End: + + db $e7 ; unused + +PikachuCry18:: + dw (PikachuCry18_End - PikachuCry18) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_18.pcm" +PikachuCry18_End: + + db $00 ; unused + +PikachuCry22:: + dw (PikachuCry22_End - PikachuCry22) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_22.pcm" +PikachuCry22_End: + + db $7e ; unused + + +SECTION "Pikachu Cries 7",ROMX,BANK[PCM_7] +PikachuCry20:: + dw (PikachuCry20_End - PikachuCry20) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_20.pcm" +PikachuCry20_End: + + db $07 ; unused + +PikachuCry21:: + dw (PikachuCry21_End - PikachuCry21) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_21.pcm" +PikachuCry21_End: + + db $ff ; unused + + +SECTION "Pikachu Cries 8",ROMX,BANK[PCM_8] +PikachuCry19:: + dw (PikachuCry19_End - PikachuCry19) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_19.pcm" +PikachuCry19_End: + + db $06 ; unused + +PikachuCry24:: + dw (PikachuCry24_End - PikachuCry24) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_24.pcm" +PikachuCry24_End: + + db $e0 ; unused + +PikachuCry26:: + dw (PikachuCry26_End - PikachuCry26) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_26.pcm" +PikachuCry26_End: + + +SECTION "Pikachu Cries 9",ROMX,BANK[PCM_9] +PikachuCry17:: + dw (PikachuCry17_End - PikachuCry17) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_17.pcm" +PikachuCry17_End: + + db $00 ; unused + +PikachuCry23:: + dw (PikachuCry23_End - PikachuCry23) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_23.pcm" +PikachuCry23_End: + + db $00 ; unused + +PikachuCry25:: + dw (PikachuCry25_End - PikachuCry25) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_25.pcm" +PikachuCry25_End: + + db $03 ; unused + + +SECTION "Pikachu Cries 10",ROMX,BANK[PCM_10] +PikachuCry27:: + dw (PikachuCry27_End - PikachuCry27) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_27.pcm" +PikachuCry27_End: + + db $ff ; unused + +PikachuCry28:: + dw (PikachuCry28_End - PikachuCry28) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_28.pcm" +PikachuCry28_End: + + db $1b ; unused + +PikachuCry29:: + dw (PikachuCry29_End - PikachuCry29) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_29.pcm" +PikachuCry29_End: + + db $87 ; unused + +PikachuCry30:: + dw (PikachuCry30_End - PikachuCry30) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_30.pcm" +PikachuCry30_End: + + db $00 ; unused + +PikachuCry31:: + dw (PikachuCry31_End - PikachuCry31) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_31.pcm" +PikachuCry31_End: + + +SECTION "Pikachu Cries 11",ROMX,BANK[PCM_11] +PikachuCry32:: + dw (PikachuCry32_End - PikachuCry32) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_32.pcm" +PikachuCry32_End: + + db $ff ; unused + +PikachuCry33:: + dw (PikachuCry33_End - PikachuCry33) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_33.pcm" +PikachuCry33_End: + + db $1f ; unused + +PikachuCry34:: + dw (PikachuCry34_End - PikachuCry34) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_34.pcm" +PikachuCry34_End: + + db $01 ; unused + +PikachuCry41:: + dw (PikachuCry41_End - PikachuCry41) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_41.pcm" +PikachuCry41_End: + + db $9b ; unused + + +SECTION "Pikachu Cries 12",ROMX,BANK[PCM_12] +PikachuCry35:: + dw (PikachuCry35_End - PikachuCry35) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_35.pcm" +PikachuCry35_End: + + db $00 ; unused + +PikachuCry36:: + dw (PikachuCry36_End - PikachuCry36) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_36.pcm" +PikachuCry36_End: + + db $01 ; unused + +PikachuCry39:: + dw (PikachuCry39_End - PikachuCry39) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_39.pcm" +PikachuCry39_End: + + db $0f ; unused + + +SECTION "Pikachu Cries 13",ROMX,BANK[PCM_13] +PikachuCry37:: + dw (PikachuCry37_End - PikachuCry37) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_37.pcm" +PikachuCry37_End: + + db $3f ; unused + +PikachuCry38:: + dw (PikachuCry38_End - PikachuCry38) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_38.pcm" +PikachuCry38_End: + + db $ff ; unused + +PikachuCry40:: + dw (PikachuCry40_End - PikachuCry40) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_40.pcm" +PikachuCry40_End: + + db $ff ; unused +PikachuCry42:: + dw (PikachuCry42_End - PikachuCry42) - 2 ; length of pcm data + INCBIN "audio/pikachu_cries/pikachu_cry_42.pcm" +PikachuCry42_End: diff --git a/audio/engine_1.asm b/audio/engine_1.asm index 36f5db5a..4faf06cf 100644 --- a/audio/engine_1.asm +++ b/audio/engine_1.asm @@ -157,6 +157,15 @@ Audio1_PlayNextNote: add hl, bc res BIT_PITCH_BEND_ON, [hl] res BIT_PITCH_BEND_DECREASING, [hl] + ld a, c + cp $4 + jr nz, .asm_918c + ld a, [wLowHealthAlarm] + bit 7, a + jr z, .asm_918c + call Audio1_EnableChannelOutput + ret +.asm_918c call Audio1_endchannel ret @@ -515,7 +524,8 @@ Audio1_unknownmusic0xef: jr nz, Audio1_dutycycle ; no call Audio1_GetNextMusicByte push bc - call Audio1_PlaySound + ld b, a + call DetermineAudioFunction pop bc ld a, [wDisableChannelOutputWhenSfxEnds] and a @@ -670,8 +680,8 @@ asm_94fd ld a, [wDisableChannelOutputWhenSfxEnds] and a jr nz, .asm_9508 - ld a, d - call Audio1_PlaySound + ld b, d + call DetermineAudioFunction .asm_9508 pop bc pop de @@ -831,7 +841,7 @@ Audio1_notepitch: Audio1_EnableChannelOutput: ld b, 0 - ld hl, Audio1_HWChannelEnableMasks + call Audio1_9972 add hl, bc ld a, [rNR51] or [hl] ; set this channel's bits @@ -851,7 +861,7 @@ Audio1_EnableChannelOutput: ; If this is the SFX noise channel or a music channel whose corresponding ; SFX channel is off, apply stereo panning. ld a, [wStereoPanning] - ld hl, Audio1_HWChannelEnableMasks + call Audio1_9972 add hl, bc and [hl] ld d, a @@ -939,12 +949,31 @@ Audio1_ApplyWavePatternAndFrequency: ld [hl], e ; store frequency low byte inc hl ld [hl], d ; store frequency high byte + ld a, c + cp $4 + jr c, .asm_9642 call Audio1_ApplyFrequencyModifier +.asm_9642 + ret +.asm_9643 + ld a, c + cp $4 + ret nz + ld a, [wLowHealthAlarm] + bit 7, a + ret z + xor a + ld [wFrequencyModifier], a + ld a, $80 + ld [wTempoModifier], a ret Audio1_SetSfxTempo: call Audio1_IsCry + jr c, .isCry + call Audio1_96c3 jr nc, .notCry +.isCry ld d, 0 ld a, [wTempoModifier] add $80 @@ -954,18 +983,20 @@ Audio1_SetSfxTempo: ld [wSfxTempo + 1], a ld a, d ld [wSfxTempo], a - jr .done + ret .notCry xor a ld [wSfxTempo + 1], a - ld a, $1 + inc a ld [wSfxTempo], a -.done ret Audio1_ApplyFrequencyModifier: call Audio1_IsCry - jr nc, .done + jr c, .isCry + call Audio1_96c3 + ret nc +.isCry ; if playing a cry, add the cry's frequency modifier ld a, [wFrequencyModifier] add e @@ -999,8 +1030,7 @@ Audio1_GoBackOneCommandIfCry: scf ret .done - scf - ccf + and a ret Audio1_IsCry: @@ -1021,6 +1051,26 @@ Audio1_IsCry: scf ret +Audio1_96c3: + ld a, [wAudioROMBank] + cp AUDIO_2 + jr nz, .asm_96dc + ld a, [wChannelSoundIDs + CH7] + ld b, a + ld a, [wChannelSoundIDs + CH4] + or b + cp $9d + jr c, .asm_96dc + cp $ea + jr z, .asm_96de + jr c, .asm_96de +.asm_96dc + and a + ret +.asm_96de + scf + ret + Audio1_ApplyPitchBend: ld hl, wChannelFlags1 add hl, bc @@ -1243,21 +1293,7 @@ Audio1_ApplyDutyCycle: ret Audio1_GetNextMusicByte: - ld d, 0 - ld a, c - add a - ld e, a - ld hl, wChannelCommandPointers - add hl, de - ld a, [hli] - ld e, a - ld a, [hld] - ld d, a - ld a, [de] ; get next music command - inc de - ld [hl], e ; store address of next command - inc hl - ld [hl], d + call GetNextMusicByte ret Audio1_GetRegisterPointer: @@ -1319,6 +1355,7 @@ Audio1_CalculateFrequency: Audio1_PlaySound:: ld [wSoundID], a + ld a, [wSoundID] cp $ff jp z, .stopAllAudio cp MAX_SFX_ID @@ -1329,76 +1366,7 @@ Audio1_PlaySound:: jp nc, .playSfx .playMusic - xor a - ld [wUnusedC000], a - ld [wDisableChannelOutputWhenSfxEnds], a - ld [wMusicTempo + 1], a - ld [wMusicWaveInstrument], a - ld [wSfxWaveInstrument], a - ld d, $8 - ld hl, wChannelReturnAddresses - call .FillMem - ld hl, wChannelCommandPointers - call .FillMem - ld d, $4 - ld hl, wChannelSoundIDs - call .FillMem - ld hl, wChannelFlags1 - call .FillMem - ld hl, wChannelDuties - call .FillMem - ld hl, wChannelDutyCycles - call .FillMem - ld hl, wChannelVibratoDelayCounters - call .FillMem - ld hl, wChannelVibratoExtents - call .FillMem - ld hl, wChannelVibratoRates - call .FillMem - ld hl, wChannelFrequencyLowBytes - call .FillMem - ld hl, wChannelVibratoDelayCounterReloadValues - call .FillMem - ld hl, wChannelFlags2 - call .FillMem - ld hl, wChannelPitchBendLengthModifiers - call .FillMem - ld hl, wChannelPitchBendFrequencySteps - call .FillMem - ld hl, wChannelPitchBendFrequencyStepsFractionalPart - call .FillMem - ld hl, wChannelPitchBendCurrentFrequencyFractionalPart - call .FillMem - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - call .FillMem - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - call .FillMem - ld hl, wChannelPitchBendTargetFrequencyHighBytes - call .FillMem - ld hl, wChannelPitchBendTargetFrequencyLowBytes - call .FillMem - ld a, $1 - ld hl, wChannelLoopCounters - call .FillMem - ld hl, wChannelNoteDelayCounters - call .FillMem - ld hl, wChannelNoteSpeeds - call .FillMem - ld [wMusicTempo], a - ld a, $ff - ld [wStereoPanning], a - xor a - ld [rNR50], a - ld a, $8 - ld [rNR10], a - ld a, 0 - ld [rNR51], a - xor a - ld [rNR30], a - ld a, $80 - ld [rNR30], a - ld a, $77 - ld [rNR50], a + call InitMusicVariables jp .playSoundCommon .playSfx @@ -1460,91 +1428,7 @@ Audio1_PlaySound:: jr c, .asm_99a3 ret .asm_99a3 - xor a - push de - ld h, d - ld l, e - add hl, hl - ld d, h - ld e, l - ld hl, wChannelReturnAddresses - add hl, de - ld [hli], a - ld [hl], a - ld hl, wChannelCommandPointers - add hl, de - ld [hli], a - ld [hl], a - pop de - ld hl, wChannelSoundIDs - add hl, de - ld [hl], a - ld hl, wChannelFlags1 - add hl, de - ld [hl], a - ld hl, wChannelDuties - add hl, de - ld [hl], a - ld hl, wChannelDutyCycles - add hl, de - ld [hl], a - ld hl, wChannelVibratoDelayCounters - add hl, de - ld [hl], a - ld hl, wChannelVibratoExtents - add hl, de - ld [hl], a - ld hl, wChannelVibratoRates - add hl, de - ld [hl], a - ld hl, wChannelFrequencyLowBytes - add hl, de - ld [hl], a - ld hl, wChannelVibratoDelayCounterReloadValues - add hl, de - ld [hl], a - ld hl, wChannelPitchBendLengthModifiers - add hl, de - ld [hl], a - ld hl, wChannelPitchBendFrequencySteps - add hl, de - ld [hl], a - ld hl, wChannelPitchBendFrequencyStepsFractionalPart - add hl, de - ld [hl], a - ld hl, wChannelPitchBendCurrentFrequencyFractionalPart - add hl, de - ld [hl], a - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - add hl, de - ld [hl], a - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - add hl, de - ld [hl], a - ld hl, wChannelPitchBendTargetFrequencyHighBytes - add hl, de - ld [hl], a - ld hl, wChannelPitchBendTargetFrequencyLowBytes - add hl, de - ld [hl], a - ld hl, wChannelFlags2 - add hl, de - ld [hl], a - ld a, $1 - ld hl, wChannelLoopCounters - add hl, de - ld [hl], a - ld hl, wChannelNoteDelayCounters - add hl, de - ld [hl], a - ld hl, wChannelNoteSpeeds - add hl, de - ld [hl], a - ld a, e - cp CH4 - jr nz, .asm_9a2b - ld a, $8 - ld [rNR10], a ; sweep off + call InitSFXVariables .asm_9a2b ld a, c and a @@ -1553,51 +1437,7 @@ Audio1_PlaySound:: jp .sfxChannelLoop .stopAllAudio - ld a, $80 - ld [rNR52], a ; sound hardware on - ld [rNR30], a ; wave playback on - xor a - ld [rNR51], a ; no sound output - ld [rNR32], a ; mute channel 3 (wave channel) - ld a, $8 - ld [rNR10], a ; sweep off - ld [rNR12], a ; mute channel 1 (pulse channel 1) - ld [rNR22], a ; mute channel 2 (pulse channel 2) - ld [rNR42], a ; mute channel 4 (noise channel) - ld a, $40 - ld [rNR14], a ; counter mode - ld [rNR24], a - ld [rNR44], a - ld a, $77 - ld [rNR50], a ; full volume - xor a - ld [wUnusedC000], a - ld [wDisableChannelOutputWhenSfxEnds], a - ld [wMuteAudioAndPauseMusic], a - ld [wMusicTempo + 1], a - ld [wSfxTempo + 1], a - ld [wMusicWaveInstrument], a - ld [wSfxWaveInstrument], a - ld d, $a0 - ld hl, wChannelCommandPointers - call .FillMem - ld a, $1 - ld d, $18 - ld hl, wChannelNoteDelayCounters - call .FillMem - ld [wMusicTempo], a - ld [wSfxTempo], a - ld a, $ff - ld [wStereoPanning], a - ret - -; fills d bytes at hl with a -.FillMem - ld b, d -.loop - ld [hli], a - dec b - jr nz, .loop + call StopAllAudio ret .playSoundCommon @@ -1633,16 +1473,11 @@ Audio1_PlaySound:: inc hl jr .commandPointerLoop .next + push af push hl push bc - push af ld b, 0 ld c, a - ld hl, wChannelSoundIDs - add hl, bc - ld a, [wSoundID] - ld [hl], a - pop af cp CH3 jr c, .skipSettingFlag ld hl, wChannelFlags1 @@ -1657,6 +1492,17 @@ Audio1_PlaySound:: ld a, [de] ld [hli], a inc de + pop af + push hl + push bc + ld b, 0 + ld c, a + ld hl, wChannelSoundIDs + add hl, bc + ld a, [wSoundID] + ld [hl], a + pop bc + pop hl inc c dec b ld a, b @@ -1707,9 +1553,29 @@ Audio1_HWChannelDisableMasks: db HW_CH1_DISABLE_MASK, HW_CH2_DISABLE_MASK, HW_CH3_DISABLE_MASK, HW_CH4_DISABLE_MASK ; channels 0-3 db HW_CH1_DISABLE_MASK, HW_CH2_DISABLE_MASK, HW_CH3_DISABLE_MASK, HW_CH4_DISABLE_MASK ; channels 4-7 +Audio1_9972: + push af + push bc + ld a, [wOptions] + and %110000 ; channel options + srl a + ld c, a + ld b, 0 + ld hl, Audio1_HWChannelEnableMasks + add hl, bc + pop bc + pop af + ret + Audio1_HWChannelEnableMasks: db HW_CH1_ENABLE_MASK, HW_CH2_ENABLE_MASK, HW_CH3_ENABLE_MASK, HW_CH4_ENABLE_MASK ; channels 0-3 db HW_CH1_ENABLE_MASK, HW_CH2_ENABLE_MASK, HW_CH3_ENABLE_MASK, HW_CH4_ENABLE_MASK ; channels 4-7 + db $01,$20,$44,$88 + db $11,$22,$44,$88 + db $01,$20,$04,$80 + db $01,$20,$04,$80 + db $01,$02,$40,$80 + db $01,$02,$40,$80 Audio1_Pitches: dw $F82C ; C_ diff --git a/audio/engine_2.asm b/audio/engine_2.asm index 3928d092..d1b07df9 100644 --- a/audio/engine_2.asm +++ b/audio/engine_2.asm @@ -1,1341 +1,214 @@ -; The second of three duplicated sound engines. - -Audio2_UpdateMusic:: - ld c, CH0 -.loop - ld b, $0 - ld hl, wChannelSoundIDs - add hl, bc - ld a, [hl] - and a - jr z, .nextChannel - ld a, c - cp CH4 - jr nc, .applyAffects ; if sfx channel - ld a, [wMuteAudioAndPauseMusic] - and a - jr z, .applyAffects - bit 7, a - jr nz, .nextChannel - set 7, a - ld [wMuteAudioAndPauseMusic], a - xor a - ld [rNR51], a - ld [rNR30], a - ld a, $80 - ld [rNR30], a - jr .nextChannel -.applyAffects - call Audio2_ApplyMusicAffects -.nextChannel - ld a, c - inc c - cp CH7 - jr nz, .loop - ret +Audio2_PlaySound:: + ld [wSoundID], a + ld a, [wSoundID] + cp $ff + jp z, Audio2_2193c + cp $e9 + jp z, Audio2_218db + jp c, Audio2_218db + cp $fe + jr z, .asm_218d5 + jp nc, Audio2_218db +.asm_218d5 + call InitMusicVariables + jp Audio2_21940 -; this routine checks flags for music effects currently applied -; to the channel and calls certain functions based on flags. -; known flags for wChannelFlags1: -; 0: toggleperfectpitch has been used -; 1: call has been used -; 3: a toggle used only by this routine for vibrato -; 4: pitchbend flag -; 6: dutycycle flag -Audio2_ApplyMusicAffects: - ld b, $0 - ld hl, wChannelNoteDelayCounters ; delay until next note - add hl, bc +Audio2_218db: + ld l, a + ld e, a + ld h, $0 + ld d, h + add hl, hl + add hl, de + ld de, SFX_Headers_2 + add hl, de + ld a, h + ld [wSfxHeaderPointer], a + ld a, l + ld [wSfxHeaderPointer + 1], a ld a, [hl] - cp $1 ; if the delay is 1, play next note - jp z, Audio2_PlayNextNote - dec a ; otherwise, decrease the delay timer - ld [hl], a + and $c0 + rlca + rlca + ld c, a +.asm_218f4 + ld d, c ld a, c - cp CH4 - jr nc, .startChecks ; if a sfx channel - ld hl, wChannelSoundIDs + CH4 - add hl, bc - ld a, [hl] - and a - jr z, .startChecks - ret -.startChecks - ld hl, wChannelFlags1 - add hl, bc - bit 6, [hl] ; dutycycle - jr z, .checkForExecuteMusic - call Audio2_ApplyDutyCycle -.checkForExecuteMusic + add a + add c + ld c, a ld b, $0 - ld hl, wChannelFlags2 - add hl, bc - bit 0, [hl] - jr nz, .checkForPitchBend - ld hl, wChannelFlags1 - add hl, bc - bit 2, [hl] - jr nz, .disablePitchBendVibrato -.checkForPitchBend - ld hl, wChannelFlags1 - add hl, bc - bit 4, [hl] ; pitchbend - jr z, .checkVibratoDelay - jp Audio2_ApplyPitchBend -.checkVibratoDelay - ld hl, wChannelVibratoDelayCounters ; vibrato delay - add hl, bc - ld a, [hl] - and a ; check if delay is over - jr z, .checkForVibrato - dec [hl] ; otherwise, dec delay -.disablePitchBendVibrato - ret -.checkForVibrato - ld hl, wChannelVibratoExtents ; vibrato rate - add hl, bc - ld a, [hl] - and a - jr nz, .vibrato - ret ; no vibrato -.vibrato - ld d, a - ld hl, wChannelVibratoRates + ld a, [wSfxHeaderPointer] + ld h, a + ld a, [wSfxHeaderPointer + 1] + ld l, a add hl, bc + ld c, d ld a, [hl] and $f - and a - jr z, .vibratoAlreadyDone - dec [hl] ; apply vibrato pitch change - ret -.vibratoAlreadyDone + ld e, a + ld d, $0 + ld hl, wChannelSoundIDs + add hl, de ld a, [hl] - swap [hl] - or [hl] - ld [hl], a ; reset the vibrato value and start again - ld hl, wChannelFrequencyLowBytes - add hl, bc - ld e, [hl] ; get note pitch - ld hl, wChannelFlags1 - add hl, bc - bit 3, [hl] ; this is the only code that sets/resets bit three so - jr z, .unset ; it continuously alternates which path it takes - res 3, [hl] - ld a, d - and $f - ld d, a + and a + jr z, .asm_21930 ld a, e - sub d - jr nc, .noCarry - ld a, $0 -.noCarry - jr .done -.unset - set 3, [hl] - ld a, d - and $f0 - swap a - add e - jr nc, .done - ld a, $ff -.done - ld d, a - ld b, $3 - call Audio2_21ff7 - ld [hl], d + cp $7 + jr nz, .asm_21927 + ld a, [wSoundID] + cp $14 + jr nc, .asm_21920 ret - -; this routine executes all music commands that take up no time, -; like tempo changes, duty changes etc. and doesn't return -; until the first note is reached -Audio2_PlayNextNote: - ld hl, wChannelVibratoDelayCounterReloadValues - add hl, bc +.asm_21920 ld a, [hl] - ld hl, wChannelVibratoDelayCounters - add hl, bc - ld [hl], a - ld hl, wChannelFlags1 - add hl, bc - res 4, [hl] - res 5, [hl] - ld a, c - cp CH4 - jr nz, .beginChecks - ld a, [wLowHealthAlarm] ;low health alarm enabled? - bit 7, a - ret nz -.beginChecks - call Audio2_endchannel + cp $14 + jr z, .asm_21930 + jr c, .asm_21930 +.asm_21927 + ld a, [wSoundID] + cp [hl] + jr z, .asm_21930 + jr c, .asm_21930 ret - -Audio2_endchannel: - call Audio2_GetNextMusicByte - ld d, a - cp $ff ; is this command an endchannel? - jp nz, Audio2_callchannel ; no - ld b, $0 ; yes - ld hl, wChannelFlags1 - add hl, bc - bit 1, [hl] - jr nz, .returnFromCall +.asm_21930 + call InitSFXVariables ld a, c - cp CH3 - jr nc, .noiseOrSfxChannel - jr .asm_219c0 -.noiseOrSfxChannel - res 2, [hl] - ld hl, wChannelFlags2 - add hl, bc - res 0, [hl] - cp CH6 - jr nz, .notSfxChannel3 - ld a, $0 - ld [rNR30], a - ld a, $80 - ld [rNR30], a -.notSfxChannel3 - jr nz, .asm_219a3 - ld a, [wDisableChannelOutputWhenSfxEnds] and a - jr z, .asm_219a3 - xor a - ld [wDisableChannelOutputWhenSfxEnds], a - jr .asm_219c0 -.asm_219a3 - jr .asm_219c9 -.returnFromCall - res 1, [hl] - ld d, $0 - ld a, c - add a - ld e, a - ld hl, wChannelCommandPointers - add hl, de - push hl ; store current channel address - ld hl, wChannelReturnAddresses - add hl, de - ld e, l - ld d, h - pop hl - ld a, [de] - ld [hli], a - inc de - ld a, [de] - ld [hl], a ; loads channel address to return to - jp Audio2_endchannel -.asm_219c0 - ld hl, Unknown_222de - add hl, bc - ld a, [rNR51] - and [hl] - ld [rNR51], a -.asm_219c9 - ld a, [wChannelSoundIDs + CH4] - cp $14 - jr nc, .asm_219d2 - jr .asm_219ef -.asm_219d2 - ld a, [wChannelSoundIDs + CH4] - cp $86 - jr z, .asm_219ef - jr c, .asm_219dd - jr .asm_219ef -.asm_219dd - ld a, c - cp CH4 - jr z, .asm_219e6 - call Audio2_21e6d - ret c -.asm_219e6 - ld a, [wSavedVolume] - ld [rNR50], a - xor a - ld [wSavedVolume], a -.asm_219ef - ld hl, wChannelSoundIDs - add hl, bc - ld [hl], b + jp z, Audio2_21940 + dec c + jp .asm_218f4 + +Audio2_2193c: + call StopAllAudio ret -Audio2_callchannel: - cp $fd ; is this command a callchannel? - jp nz, Audio2_loopchannel ; no - call Audio2_GetNextMusicByte ; yes - push af - call Audio2_GetNextMusicByte - ld d, a - pop af - ld e, a - push de ; store pointer - ld d, $0 - ld a, c - add a +Audio2_21940: + ld a, [wSoundID] + ld l, a ld e, a - ld hl, wChannelCommandPointers + ld h, $0 + ld d, h + add hl, hl add hl, de - push hl - ld hl, wChannelReturnAddresses + ld de, SFX_Headers_2 add hl, de ld e, l ld d, h - pop hl - ld a, [hli] - ld [de], a - inc de - ld a, [hld] - ld [de], a ; copy current channel address - pop de - ld [hl], e - inc hl - ld [hl], d ; overwrite current address with pointer - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - set 1, [hl] ; set the call flag - jp Audio2_endchannel - -Audio2_loopchannel: - cp $fe ; is this command a loopchannel? - jp nz, Audio2_notetype ; no - call Audio2_GetNextMusicByte ; yes - ld e, a - and a - jr z, .infiniteLoop - ld b, $0 - ld hl, wChannelLoopCounters - add hl, bc - ld a, [hl] - cp e - jr nz, .loopAgain - ld a, $1 ; if no more loops to make, - ld [hl], a - call Audio2_GetNextMusicByte ; skip pointer - call Audio2_GetNextMusicByte - jp Audio2_endchannel -.loopAgain ; inc loop count - inc a - ld [hl], a - ; fall through -.infiniteLoop ; overwrite current address with pointer - call Audio2_GetNextMusicByte - push af - call Audio2_GetNextMusicByte - ld b, a - ld d, $0 - ld a, c - add a - ld e, a ld hl, wChannelCommandPointers - add hl, de - pop af - ld [hli], a - ld [hl], b - jp Audio2_endchannel - -Audio2_notetype: - and $f0 - cp $d0 ; is this command a notetype? - jp nz, Audio2_toggleperfectpitch ; no - ld a, d ; yes - and $f - ld b, $0 - ld hl, wChannelNoteSpeeds - add hl, bc - ld [hl], a ; store low nibble as speed - ld a, c - cp CH3 - jr z, .noiseChannel ; noise channel has 0 params - call Audio2_GetNextMusicByte - ld d, a - ld a, c - cp CH2 - jr z, .musicChannel3 - cp CH6 - jr nz, .notChannel3 - ld hl, wSfxWaveInstrument - jr .sfxChannel3 -.musicChannel3 - ld hl, wMusicWaveInstrument -.sfxChannel3 - ld a, d - and $f - ld [hl], a ; store low nibble of param as duty - ld a, d - and $30 - sla a - ld d, a - ; fall through - - ; if channel 3, store high nibble as volume - ; else, store volume (high nibble) and fade (low nibble) -.notChannel3 - ld b, $0 - ld hl, wChannelVolumes - add hl, bc - ld [hl], d -.noiseChannel - jp Audio2_endchannel - -Audio2_toggleperfectpitch: - ld a, d - cp $e8 ; is this command a toggleperfectpitch? - jr nz, Audio2_vibrato ; no - ld b, $0 ; yes - ld hl, wChannelFlags1 - add hl, bc - ld a, [hl] - xor $1 - ld [hl], a ; flip bit 0 of wChannelFlags1 - jp Audio2_endchannel - -Audio2_vibrato: - cp $ea ; is this command a vibrato? - jr nz, Audio2_pitchbend ; no - call Audio2_GetNextMusicByte ; yes - ld b, $0 - ld hl, wChannelVibratoDelayCounters - add hl, bc - ld [hl], a ; store delay - ld hl, wChannelVibratoDelayCounterReloadValues - add hl, bc - ld [hl], a ; store delay - call Audio2_GetNextMusicByte - ld d, a - and $f0 - swap a - ld b, $0 - ld hl, wChannelVibratoExtents - add hl, bc - srl a - ld e, a - adc b - swap a - or e - ld [hl], a ; store rate as both high and low nibbles - ld a, d - and $f - ld d, a - ld hl, wChannelVibratoRates - add hl, bc - swap a - or d - ld [hl], a ; store depth as both high and low nibbles - jp Audio2_endchannel - -Audio2_pitchbend: - cp $eb ; is this command a pitchbend? - jr nz, Audio2_duty ; no - call Audio2_GetNextMusicByte ; yes - ld b, $0 - ld hl, wChannelPitchBendLengthModifiers - add hl, bc - ld [hl], a ; store first param - call Audio2_GetNextMusicByte - ld d, a - and $f0 - swap a - ld b, a - ld a, d - and $f - call Audio2_22017 - ld b, $0 - ld hl, wChannelPitchBendTargetFrequencyHighBytes - add hl, bc - ld [hl], d ; store unknown part of second param - ld hl, wChannelPitchBendTargetFrequencyLowBytes - add hl, bc - ld [hl], e ; store unknown part of second param - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - set 4, [hl] ; set pitchbend flag - call Audio2_GetNextMusicByte - ld d, a - jp Audio2_notelength - -Audio2_duty: - cp $ec ; is this command a duty? - jr nz, Audio2_tempo ; no - call Audio2_GetNextMusicByte ; yes - rrca - rrca - and $c0 - ld b, $0 - ld hl, wChannelDuties - add hl, bc - ld [hl], a ; store duty - jp Audio2_endchannel - -Audio2_tempo: - cp $ed ; is this command a tempo? - jr nz, Audio2_stereopanning ; no - ld a, c ; yes - cp CH4 - jr nc, .sfxChannel - call Audio2_GetNextMusicByte - ld [wMusicTempo], a ; store first param - call Audio2_GetNextMusicByte - ld [wMusicTempo + 1], a ; store second param - xor a - ld [wChannelNoteDelayCountersFractionalPart], a ; clear RAM - ld [wChannelNoteDelayCountersFractionalPart + 1], a - ld [wChannelNoteDelayCountersFractionalPart + 2], a - ld [wChannelNoteDelayCountersFractionalPart + 3], a - jr .musicChannelDone -.sfxChannel - call Audio2_GetNextMusicByte - ld [wSfxTempo], a ; store first param - call Audio2_GetNextMusicByte - ld [wSfxTempo + 1], a ; store second param - xor a - ld [wChannelNoteDelayCountersFractionalPart + 4], a ; clear RAM - ld [wChannelNoteDelayCountersFractionalPart + 5], a - ld [wChannelNoteDelayCountersFractionalPart + 6], a - ld [wChannelNoteDelayCountersFractionalPart + 7], a -.musicChannelDone - jp Audio2_endchannel - -Audio2_stereopanning: - cp $ee ; is this command a stereopanning? - jr nz, Audio2_unknownmusic0xef ; no - call Audio2_GetNextMusicByte ; yes - ld [wStereoPanning], a ; store panning - jp Audio2_endchannel - -; this appears to never be used -Audio2_unknownmusic0xef: - cp $ef ; is this command an unknownmusic0xef? - jr nz, Audio2_dutycycle ; no - call Audio2_GetNextMusicByte ; yes - push bc - call Audio2_PlaySound - pop bc - ld a, [wDisableChannelOutputWhenSfxEnds] - and a - jr nz, .skip - ld a, [wChannelSoundIDs + CH7] - ld [wDisableChannelOutputWhenSfxEnds], a - xor a - ld [wChannelSoundIDs + CH7], a -.skip - jp Audio2_endchannel - -Audio2_dutycycle: - cp $fc ; is this command a dutycycle? - jr nz, Audio2_volume ; no - call Audio2_GetNextMusicByte ; yes - ld b, $0 - ld hl, wChannelDutyCycles - add hl, bc - ld [hl], a ; store full cycle - and $c0 - ld hl, wChannelDuties - add hl, bc - ld [hl], a ; store first duty - ld hl, wChannelFlags1 - add hl, bc - set 6, [hl] ; set dutycycle flag - jp Audio2_endchannel - -Audio2_volume: - cp $f0 ; is this command a volume? - jr nz, Audio2_executemusic ; no - call Audio2_GetNextMusicByte ; yes - ld [rNR50], a ; store volume - jp Audio2_endchannel - -Audio2_executemusic: - cp $f8 ; is this command an executemusic? - jr nz, Audio2_octave ; no - ld b, $0 ; yes - ld hl, wChannelFlags2 - add hl, bc - set 0, [hl] - jp Audio2_endchannel - -Audio2_octave: - and $f0 - cp $e0 ; is this command an octave? - jr nz, Audio2_unknownsfx0x20 ; no - ld hl, wChannelOctaves ; yes - ld b, $0 - add hl, bc - ld a, d - and $f - ld [hl], a ; store low nibble as octave - jp Audio2_endchannel - -Audio2_unknownsfx0x20: - cp $20 ; is this command an unknownsfx0x20? - jr nz, Audio2_unknownsfx0x10 ; no - ld a, c - cp CH3 ; is this a noise or sfx channel? - jr c, Audio2_unknownsfx0x10 ; no - ld b, $0 - ld hl, wChannelFlags2 - add hl, bc - bit 0, [hl] - jr nz, Audio2_unknownsfx0x10 ; no - call Audio2_notelength - ld d, a - ld b, $0 - ld hl, wChannelDuties - add hl, bc - ld a, [hl] - or d - ld d, a - ld b, $1 - call Audio2_21ff7 - ld [hl], d - call Audio2_GetNextMusicByte - ld d, a - ld b, $2 - call Audio2_21ff7 - ld [hl], d - call Audio2_GetNextMusicByte - ld e, a - ld a, c - cp CH7 - ld a, $0 - jr z, .sfxNoiseChannel ; only two params for noise channel - push de - call Audio2_GetNextMusicByte - pop de -.sfxNoiseChannel - ld d, a - push de - call Audio2_21daa - call Audio2_21d79 - pop de - call Audio2_21dcc - ret - -Audio2_unknownsfx0x10: - ld a, c - cp CH4 - jr c, Audio2_note ; if not a sfx - ld a, d - cp $10 ; is this command a unknownsfx0x10? - jr nz, Audio2_note ; no - ld b, $0 - ld hl, wChannelFlags2 - add hl, bc - bit 0, [hl] - jr nz, Audio2_note ; no - call Audio2_GetNextMusicByte ; yes - ld [rNR10], a - jp Audio2_endchannel - -Audio2_note: - ld a, c - cp CH3 - jr nz, Audio2_notelength ; if not noise channel - ld a, d - and $f0 - cp $b0 ; is this command a dnote? - jr z, Audio2_dnote ; yes - jr nc, Audio2_notelength ; no - swap a + ld a, [de] ; get channel number ld b, a - ld a, d - and $f - ld d, a + rlca + rlca + and $3 + ld c, a ld a, b - push de - push bc - jr asm_21c7e - -Audio2_dnote: - ld a, d and $f + ld b, c + inc b + inc de + ld c, $0 +.asm_21962 + cp c + jr z, .asm_2196a + inc c + inc hl + inc hl + jr .asm_21962 +.asm_2196a push af + push hl push bc - call Audio2_GetNextMusicByte ; get dnote instrument -asm_21c7e - ld d, a - ld a, [wDisableChannelOutputWhenSfxEnds] - and a - jr nz, .asm_21c89 - ld a, d - call Audio2_PlaySound -.asm_21c89 - pop bc - pop de - -Audio2_notelength: - ld a, d - push af - and $f - inc a ld b, $0 - ld e, a ; store note length (in 16ths) - ld d, b - ld hl, wChannelNoteSpeeds - add hl, bc - ld a, [hl] - ld l, b - call Audio2_22006 - ld a, c - cp CH4 - jr nc, .sfxChannel - ld a, [wMusicTempo] - ld d, a - ld a, [wMusicTempo + 1] - ld e, a - jr .skip -.sfxChannel - ld d, $1 - ld e, $0 - cp CH7 - jr z, .skip ; if noise channel - call Audio2_21e2f - ld a, [wSfxTempo] - ld d, a - ld a, [wSfxTempo + 1] - ld e, a -.skip - ld a, l - ld b, $0 - ld hl, wChannelNoteDelayCountersFractionalPart - add hl, bc - ld l, [hl] - call Audio2_22006 - ld e, l - ld d, h - ld hl, wChannelNoteDelayCountersFractionalPart - add hl, bc - ld [hl], e - ld a, d - ld hl, wChannelNoteDelayCounters - add hl, bc - ld [hl], a - ld hl, wChannelFlags2 - add hl, bc - bit 0, [hl] - jr nz, Audio2_notepitch + ld c, a + cp $3 + jr c, .asm_2197a ld hl, wChannelFlags1 add hl, bc - bit 2, [hl] - jr z, Audio2_notepitch + set 2, [hl] +.asm_2197a + pop bc pop hl - ret - -Audio2_notepitch: + ld a, [de] ; get channel pointer + ld [hli], a + inc de + ld a, [de] + ld [hli], a + inc de pop af - and $f0 - cp $c0 ; compare to rest - jr nz, .notRest - ld a, c - cp CH4 - jr nc, .sfxChannel - ld hl, wChannelSoundIDs + CH4 - add hl, bc - ld a, [hl] - and a - jr nz, .done - ; fall through -.sfxChannel - ld a, c - cp CH2 - jr z, .musicChannel3 - cp CH6 - jr nz, .notSfxChannel3 -.musicChannel3 + push hl + push bc ld b, $0 - ld hl, Unknown_222de + ld c, a + ld hl, wChannelSoundIDs add hl, bc - ld a, [rNR51] - and [hl] - ld [rNR51], a - jr .done -.notSfxChannel3 - ld b, $2 - call Audio2_21ff7 - ld a, $8 - ld [hli], a - inc hl - ld a, $80 + ld a, [wSoundID] ld [hl], a -.done - ret -.notRest - swap a - ld b, $0 - ld hl, wChannelOctaves - add hl, bc - ld b, [hl] - call Audio2_22017 - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - bit 4, [hl] - jr z, .asm_21d39 - call Audio2_21f4e -.asm_21d39 - push de - ld a, c - cp CH4 - jr nc, .skip ; if sfx channel - ld hl, wChannelSoundIDs + CH4 - ld d, $0 - ld e, a - add hl, de - ld a, [hl] - and a - jr nz, .asm_21d4c - jr .skip -.asm_21d4c - pop de - ret -.skip - ld b, $0 - ld hl, wChannelVolumes - add hl, bc - ld d, [hl] - ld b, $2 - call Audio2_21ff7 - ld [hl], d - call Audio2_21daa - call Audio2_21d79 - pop de - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - bit 0, [hl] ; has toggleperfectpitch been used? - jr z, .skip2 - inc e ; if yes, increment the pitch by 1 - jr nc, .skip2 - inc d -.skip2 - ld hl, wChannelFrequencyLowBytes - add hl, bc - ld [hl], e - call Audio2_21dcc - ret - -Audio2_21d79: - ld b, $0 - ld hl, Unknown_222e6 - add hl, bc - ld a, [rNR51] - or [hl] - ld d, a - ld a, c - cp CH7 - jr z, .sfxNoiseChannel - cp CH4 - jr nc, .skip ; if sfx channel - ld hl, wChannelSoundIDs + CH4 - add hl, bc - ld a, [hl] + pop bc + pop hl + inc c + dec b + ld a, b and a - jr nz, .skip -.sfxNoiseChannel - ld a, [wStereoPanning] - ld hl, Unknown_222e6 - add hl, bc - and [hl] - ld d, a - ld a, [rNR51] - ld hl, Unknown_222de - add hl, bc - and [hl] - or d - ld d, a -.skip - ld a, d - ld [rNR51], a - ret - -Audio2_21daa: - ld b, $0 - ld hl, wChannelNoteDelayCounters - add hl, bc - ld d, [hl] - ld a, c - cp CH2 - jr z, .channel3 ; if music channel 3 - cp CH6 - jr z, .channel3 ; if sfx channel 3 - ld a, d - and $3f - ld d, a - ld hl, wChannelDuties - add hl, bc - ld a, [hl] - or d - ld d, a -.channel3 - ld b, $1 - call Audio2_21ff7 - ld [hl], d - ret - -Audio2_21dcc: - ld a, c - cp CH2 - jr z, .channel3 - cp CH6 - jr nz, .notSfxChannel3 - ; fall through -.channel3 - push de - ld de, wMusicWaveInstrument - cp CH2 - jr z, .musicChannel3 - ld de, wSfxWaveInstrument -.musicChannel3 - ld a, [de] - add a - ld d, $0 - ld e, a - ld hl, Audio2_WavePointers - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - ld hl, $ff30 - ld b, $f - ld a, $0 - ld [rNR30], a -.loop ld a, [de] inc de + jr nz, .asm_21962 + ld a, [wSoundID] + cp $14 + jr nc, .asm_219a3 + jr .asm_219cd +.asm_219a3 + ld a, [wSoundID] + cp $86 + jr z, .asm_219cd + jr c, .asm_219ae + jr .asm_219cd +.asm_219ae + ld hl, wChannelSoundIDs + CH4 + ld [hli], a + ld [hli], a ld [hli], a - ld a, b - dec b - and a - jr nz, .loop - ld a, $80 - ld [rNR30], a - pop de -.notSfxChannel3 - ld a, d - or $80 - and $c7 - ld d, a - ld b, $3 - call Audio2_21ff7 - ld [hl], e - inc hl - ld [hl], d - ld a, c - cp CH4 - jr c, .musicChannel - call Audio2_21e56 -.musicChannel - ret - -Audio2_21e19: - ld a, c - cp CH4 - jr nz, .asm_21e2e - ld a, [wLowHealthAlarm] - bit 7, a - jr z, .asm_21e2e - xor a - ld [wFrequencyModifier], a - ld a, $80 - ld [wTempoModifier], a -.asm_21e2e - ret - -Audio2_21e2f: - call Audio2_21e8b - jr c, .asm_21e39 - call Audio2_21e9f - jr nc, .asm_21e4c -.asm_21e39 - ld d, $0 - ld a, [wTempoModifier] - add $80 - jr nc, .asm_21e43 - inc d -.asm_21e43 - ld [wSfxTempo + 1], a - ld a, d - ld [wSfxTempo], a - jr .asm_21e55 -.asm_21e4c - xor a - ld [wSfxTempo + 1], a - ld a, $1 - ld [wSfxTempo], a -.asm_21e55 - ret - -Audio2_21e56: - call Audio2_21e8b - jr c, .asm_21e60 - call Audio2_21e9f - jr nc, .asm_21e6c -.asm_21e60 - ld a, [wFrequencyModifier] - add e - jr nc, .asm_21e67 - inc d -.asm_21e67 - dec hl - ld e, a - ld [hl], e - inc hl - ld [hl], d -.asm_21e6c - ret - -Audio2_21e6d: - call Audio2_21e8b - jr nc, .asm_21e88 - ld hl, wChannelCommandPointers - ld e, c - ld d, $0 - sla e - rl d - add hl, de - ld a, [hl] - sub $1 ld [hl], a + ld hl, wChannelCommandPointers + CH6 * 2 ; sfx noise channel pointer + ld de, Noise2_endchannel + ld [hl], e inc hl - ld a, [hl] - sbc $0 - ld [hl], a - scf - ret -.asm_21e88 - scf - ccf - ret - -Audio2_21e8b: - ld a, [wChannelSoundIDs + CH4] - cp $14 - jr nc, .asm_21e94 - jr .asm_21e9a -.asm_21e94 - cp $86 - jr z, .asm_21e9a - jr c, .asm_21e9d -.asm_21e9a - scf - ccf - ret -.asm_21e9d - scf + ld [hl], d ; overwrite pointer to point to endchannel + ld a, [wSavedVolume] + and a + jr nz, .asm_219cd + ld a, [rNR50] + ld [wSavedVolume], a + ld a, $77 + ld [rNR50], a +.asm_219cd ret -Audio2_21e9f: - ld a, [wChannelSoundIDs + CH7] - ld b, a - ld a, [wChannelSoundIDs + CH4] - or b - cp $9d - jr nc, .asm_21ead - jr .asm_21eb3 -.asm_21ead - cp $ea - jr z, .asm_21eb3 - jr c, .asm_21eb6 -.asm_21eb3 - scf - ccf - ret -.asm_21eb6 - scf - ret +Noise2_endchannel: + endchannel -Audio2_ApplyPitchBend: - ld hl, wChannelFlags1 - add hl, bc - bit 5, [hl] - jp nz, .asm_21eff - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - add hl, bc - ld e, [hl] - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - add hl, bc - ld d, [hl] - ld hl, wChannelPitchBendFrequencySteps - add hl, bc - ld l, [hl] - ld h, b - add hl, de - ld d, h - ld e, l - ld hl, wChannelPitchBendCurrentFrequencyFractionalPart - add hl, bc - push hl - ld hl, wChannelPitchBendFrequencyStepsFractionalPart - add hl, bc - ld a, [hl] - pop hl - add [hl] - ld [hl], a - ld a, $0 - adc e - ld e, a - ld a, $0 - adc d - ld d, a - ld hl, wChannelPitchBendTargetFrequencyHighBytes - add hl, bc - ld a, [hl] - cp d - jp c, .asm_21f45 - jr nz, .asm_21f32 - ld hl, wChannelPitchBendTargetFrequencyLowBytes - add hl, bc - ld a, [hl] - cp e - jp c, .asm_21f45 - jr .asm_21f32 -.asm_21eff - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - add hl, bc - ld a, [hl] - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - add hl, bc - ld d, [hl] - ld hl, wChannelPitchBendFrequencySteps - add hl, bc - ld e, [hl] - sub e - ld e, a - ld a, d - sbc b - ld d, a - ld hl, wChannelPitchBendFrequencyStepsFractionalPart - add hl, bc - ld a, [hl] - add a - ld [hl], a - ld a, e - sbc b - ld e, a - ld a, d - sbc b - ld d, a - ld hl, wChannelPitchBendTargetFrequencyHighBytes - add hl, bc - ld a, d - cp [hl] - jr c, .asm_21f45 - jr nz, .asm_21f32 - ld hl, wChannelPitchBendTargetFrequencyLowBytes - add hl, bc - ld a, e - cp [hl] - jr c, .asm_21f45 -.asm_21f32 - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - add hl, bc - ld [hl], e - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - add hl, bc - ld [hl], d - ld b, $3 - call Audio2_21ff7 +Music_PokeFluteInBattle:: + ; begin playing the "caught mon" sound effect + ld a, SFX_CAUGHT_MON + call PlaySoundWaitForCurrent + ; then immediately overwrtie the channel pointers + ld hl, wChannelCommandPointers + CH4 * 2 + ld de, SFX_08_PokeFlute_Ch1 + call Audio2_OverwriteChannelPointer + ld de, SFX_08_PokeFlute_Ch2 + call Audio2_OverwriteChannelPointer + ld de, SFX_08_PokeFlute_Ch3 + +Audio2_OverwriteChannelPointer: ld a, e ld [hli], a - ld [hl], d - ret -.asm_21f45 - ld hl, wChannelFlags1 - add hl, bc - res 4, [hl] - res 5, [hl] - ret - -Audio2_21f4e: - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - add hl, bc - ld [hl], d - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - add hl, bc - ld [hl], e - ld hl, wChannelNoteDelayCounters - add hl, bc - ld a, [hl] - ld hl, wChannelPitchBendLengthModifiers - add hl, bc - sub [hl] - jr nc, .asm_21f66 - ld a, $1 -.asm_21f66 - ld [hl], a - ld hl, wChannelPitchBendTargetFrequencyLowBytes - add hl, bc - ld a, e - sub [hl] - ld e, a - ld a, d - sbc b - ld hl, wChannelPitchBendTargetFrequencyHighBytes - add hl, bc - sub [hl] - jr c, .asm_21f82 - ld d, a - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - set 5, [hl] - jr .asm_21fa5 -.asm_21f82 - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - add hl, bc - ld d, [hl] - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - add hl, bc - ld e, [hl] - ld hl, wChannelPitchBendTargetFrequencyLowBytes - add hl, bc - ld a, [hl] - sub e - ld e, a ld a, d - sbc b - ld d, a - ld hl, wChannelPitchBendTargetFrequencyHighBytes - add hl, bc - ld a, [hl] - sub d - ld d, a - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - res 5, [hl] -.asm_21fa5 - ld hl, wChannelPitchBendLengthModifiers - add hl, bc -.asm_21fa9 - inc b - ld a, e - sub [hl] - ld e, a - jr nc, .asm_21fa9 - ld a, d - and a - jr z, .asm_21fb7 - dec a - ld d, a - jr .asm_21fa9 -.asm_21fb7 - ld a, e - add [hl] - ld d, b - ld b, $0 - ld hl, wChannelPitchBendFrequencySteps - add hl, bc - ld [hl], d - ld hl, wChannelPitchBendFrequencyStepsFractionalPart - add hl, bc - ld [hl], a - ld hl, wChannelPitchBendCurrentFrequencyFractionalPart - add hl, bc - ld [hl], a - ret - -Audio2_ApplyDutyCycle: - ld b, $0 - ld hl, wChannelDutyCycles - add hl, bc - ld a, [hl] - rlca - rlca - ld [hl], a - and $c0 - ld d, a - ld b, $1 - call Audio2_21ff7 - ld a, [hl] - and $3f - or d - ld [hl], a - ret - -Audio2_GetNextMusicByte: - ld d, $0 - ld a, c - add a - ld e, a - ld hl, wChannelCommandPointers - add hl, de - ld a, [hli] - ld e, a - ld a, [hld] - ld d, a - ld a, [de] ; get next music command - inc de - ld [hl], e ; store address of next command - inc hl - ld [hl], d - ret - -Audio2_21ff7: - ld a, c - ld hl, Unknown_222d6 - add l - jr nc, .noCarry - inc h -.noCarry - ld l, a - ld a, [hl] - add b - ld l, a - ld h, $ff + ld [hli], a ret -Audio2_22006: - ld h, $0 -.loop - srl a - jr nc, .noCarry - add hl, de -.noCarry - sla e - rl d - and a - jr z, .done - jr .loop -.done - ret +INCLUDE "audio/sfx/pokeflute_ch1_ch2.asm" -Audio2_22017: - ld h, $0 - ld l, a - add hl, hl - ld d, h - ld e, l - ld hl, Audio2_Pitches - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - ld a, b -.loop - cp CH7 - jr z, .done - sra d - rr e - inc a - jr .loop -.done - ld a, $8 - add d - ld d, a - ret - -Audio2_PlaySound:: - ld [wSoundID], a - cp $ff - jp z, Audio2_221f3 - cp $e9 - jp z, Audio2_2210d - jp c, Audio2_2210d - cp $fe - jr z, .asm_2204c - jp nc, Audio2_2210d -.asm_2204c +Audio2_InitMusicVariables:: xor a ld [wUnusedC000], a ld [wDisableChannelOutputWhenSfxEnds], a @@ -1406,67 +279,9 @@ Audio2_PlaySound:: ld [rNR30], a ld a, $77 ld [rNR50], a - jp Audio2_2224e - -Audio2_2210d: - ld l, a - ld e, a - ld h, $0 - ld d, h - add hl, hl - add hl, de - ld de, SFX_Headers_2 - add hl, de - ld a, h - ld [wSfxHeaderPointer], a - ld a, l - ld [wSfxHeaderPointer + 1], a - ld a, [hl] - and $c0 - rlca - rlca - ld c, a -.asm_22126 - ld d, c - ld a, c - add a - add c - ld c, a - ld b, $0 - ld a, [wSfxHeaderPointer] - ld h, a - ld a, [wSfxHeaderPointer + 1] - ld l, a - add hl, bc - ld c, d - ld a, [hl] - and $f - ld e, a - ld d, $0 - ld hl, wChannelSoundIDs - add hl, de - ld a, [hl] - and a - jr z, .asm_22162 - ld a, e - cp $7 - jr nz, .asm_22159 - ld a, [wSoundID] - cp $14 - jr nc, .asm_22152 ret -.asm_22152 - ld a, [hl] - cp $14 - jr z, .asm_22162 - jr c, .asm_22162 -.asm_22159 - ld a, [wSoundID] - cp [hl] - jr z, .asm_22162 - jr c, .asm_22162 - ret -.asm_22162 + +Audio2_InitSFXVariables:: xor a push de ld h, d @@ -1549,17 +364,12 @@ Audio2_2210d: ld [hl], a ld a, e cp $4 - jr nz, .asm_221ea + ret nz ld a, $8 ld [rNR10], a -.asm_221ea - ld a, c - and a - jp z, Audio2_2224e - dec c - jp .asm_22126 + ret -Audio2_221f3: +Audio2_StopAllAudio:: ld a, $80 ld [rNR52], a ld [rNR30], a @@ -1585,7 +395,7 @@ Audio2_221f3: ld [wSfxTempo + 1], a ld [wMusicWaveInstrument], a ld [wSfxWaveInstrument], a - ld d, $a0 + ld d, $b0 ld hl, wChannelCommandPointers call FillAudioRAM2 ld a, $1 @@ -1598,7 +408,6 @@ Audio2_221f3: ld [wStereoPanning], a ret -; fills d bytes at hl with a FillAudioRAM2: ld b, d .loop @@ -1606,129 +415,3 @@ FillAudioRAM2: dec b jr nz, .loop ret - -Audio2_2224e: - ld a, [wSoundID] - ld l, a - ld e, a - ld h, $0 - ld d, h - add hl, hl - add hl, de - ld de, SFX_Headers_2 - add hl, de - ld e, l - ld d, h - ld hl, wChannelCommandPointers - ld a, [de] ; get channel number - ld b, a - rlca - rlca - and $3 - ld c, a - ld a, b - and $f - ld b, c - inc b - inc de - ld c, $0 -.asm_22270 - cp c - jr z, .asm_22278 - inc c - inc hl - inc hl - jr .asm_22270 -.asm_22278 - push hl - push bc - push af - ld b, $0 - ld c, a - ld hl, wChannelSoundIDs - add hl, bc - ld a, [wSoundID] - ld [hl], a - pop af - cp $3 - jr c, .asm_22291 - ld hl, wChannelFlags1 - add hl, bc - set 2, [hl] -.asm_22291 - pop bc - pop hl - ld a, [de] ; get channel pointer - ld [hli], a - inc de - ld a, [de] - ld [hli], a - inc de - inc c - dec b - ld a, b - and a - ld a, [de] - inc de - jr nz, .asm_22270 - ld a, [wSoundID] - cp $14 - jr nc, .asm_222aa - jr .asm_222d4 -.asm_222aa - ld a, [wSoundID] - cp $86 - jr z, .asm_222d4 - jr c, .asm_222b5 - jr .asm_222d4 -.asm_222b5 - ld hl, wChannelSoundIDs + CH4 - ld [hli], a - ld [hli], a - ld [hli], a - ld [hl], a - ld hl, wChannelCommandPointers + CH6 * 2 ; sfx noise channel pointer - ld de, Noise2_endchannel - ld [hl], e - inc hl - ld [hl], d ; overwrite pointer to point to endchannel - ld a, [wSavedVolume] - and a - jr nz, .asm_222d4 - ld a, [rNR50] - ld [wSavedVolume], a - ld a, $77 - ld [rNR50], a -.asm_222d4 - ret - -Noise2_endchannel: - endchannel - -Unknown_222d6: - db $10, $15, $1A, $1F ; channels 0-3 - db $10, $15, $1A, $1F ; channels 4-7 - -Unknown_222de: - db $EE, $DD, $BB, $77 ; channels 0-3 - db $EE, $DD, $BB, $77 ; channels 4-7 - -Unknown_222e6: - db $11, $22, $44, $88 ; channels 0-3 - db $11, $22, $44, $88 ; channels 4-7 - -Audio2_Pitches: - dw $F82C ; C_ - dw $F89D ; C# - dw $F907 ; D_ - dw $F96B ; D# - dw $F9CA ; E_ - dw $FA23 ; F_ - dw $FA77 ; F# - dw $FAC7 ; G_ - dw $FB12 ; G# - dw $FB58 ; A_ - dw $FB9B ; A# - dw $FBDA ; B_ - - diff --git a/audio/engine_3.asm b/audio/engine_3.asm index 33baa5c6..418ee10b 100644 --- a/audio/engine_3.asm +++ b/audio/engine_3.asm @@ -1,1363 +1,21 @@ ; The third of three duplicated sound engines. -Audio3_UpdateMusic:: - ld c, CH0 -.loop - ld b, $0 - ld hl, wChannelSoundIDs - add hl, bc - ld a, [hl] - and a - jr z, .nextChannel - ld a, c - cp CH4 - jr nc, .applyAffects ; if sfx channel - ld a, [wMuteAudioAndPauseMusic] - and a - jr z, .applyAffects - bit 7, a - jr nz, .nextChannel - set 7, a - ld [wMuteAudioAndPauseMusic], a - xor a - ld [rNR51], a - ld [rNR30], a - ld a, $80 - ld [rNR30], a - jr .nextChannel -.applyAffects - call Audio3_ApplyMusicAffects -.nextChannel - ld a, c - inc c ; inc channel number - cp CH7 - jr nz, .loop - ret - -; this routine checks flags for music effects currently applied -; to the channel and calls certain functions based on flags. -; known flags for wChannelFlags1: -; 0: toggleperfectpitch has been used -; 1: call has been used -; 3: a toggle used only by this routine for vibrato -; 4: pitchbend flag -; 6: dutycycle flag -Audio3_ApplyMusicAffects: - ld b, $0 - ld hl, wChannelNoteDelayCounters ; delay until next note - add hl, bc - ld a, [hl] - cp $1 ; if delay is 1, play next note - jp z, Audio3_PlayNextNote - dec a ; otherwise, decrease the delay timer - ld [hl], a - ld a, c - cp CH4 - jr nc, .startChecks ; if a sfx channel - ld hl, wChannelSoundIDs + CH4 - add hl, bc - ld a, [hl] - and a - jr z, .startChecks - ret -.startChecks - ld hl, wChannelFlags1 - add hl, bc - bit 6, [hl] ; dutycycle - jr z, .checkForExecuteMusic - call Audio3_ApplyDutyCycle -.checkForExecuteMusic - ld b, $0 - ld hl, wChannelFlags2 - add hl, bc - bit 0, [hl] - jr nz, .checkForPitchBend - ld hl, wChannelFlags1 - add hl, bc - bit 2, [hl] - jr nz, .disablePitchBendVibrato -.checkForPitchBend - ld hl, wChannelFlags1 - add hl, bc - bit 4, [hl] ; pitchbend - jr z, .checkVibratoDelay - jp Audio3_ApplyPitchBend -.checkVibratoDelay - ld hl, wChannelVibratoDelayCounters ; vibrato delay - add hl, bc - ld a, [hl] - and a ; check if delay is over - jr z, .checkForVibrato - dec [hl] ; otherwise, dec delay -.disablePitchBendVibrato - ret -.checkForVibrato - ld hl, wChannelVibratoExtents ; vibrato rate - add hl, bc - ld a, [hl] - and a - jr nz, .vibrato - ret ; no vibrato -.vibrato - ld d, a - ld hl, wChannelVibratoRates - add hl, bc - ld a, [hl] - and $f - and a - jr z, .vibratoAlreadyDone - dec [hl] ; apply vibrato pitch change - ret -.vibratoAlreadyDone - ld a, [hl] - swap [hl] - or [hl] - ld [hl], a ; reset the vibrato value and start again - ld hl, wChannelFrequencyLowBytes - add hl, bc - ld e, [hl] ; get note pitch - ld hl, wChannelFlags1 - add hl, bc - bit 3, [hl] ; this is the only code that sets/resets bit three so - jr z, .unset ; it continuously alternates which path it takes - res 3, [hl] - ld a, d - and $f - ld d, a - ld a, e - sub d - jr nc, .noCarry - ld a, $0 -.noCarry - jr .done -.unset - set 3, [hl] - ld a, d - and $f0 - swap a - add e - jr nc, .done - ld a, $ff -.done - ld d, a - ld b, $3 - call Audio3_7d8ac - ld [hl], d - ret - -; this routine executes all music commands that take up no time, -; like tempo changes, duty changes etc. and doesn't return -; until the first note is reached -Audio3_PlayNextNote: - ld hl, wChannelVibratoDelayCounterReloadValues - add hl, bc - ld a, [hl] - ld hl, wChannelVibratoDelayCounters - add hl, bc - ld [hl], a - ld hl, wChannelFlags1 - add hl, bc - res 4, [hl] - res 5, [hl] - call Audio3_endchannel - ret - -Audio3_endchannel: - call Audio3_GetNextMusicByte - ld d, a - cp $ff ; is this command an endchannel? - jp nz, Audio3_callchannel ; no - ld b, $0 ; yes - ld hl, wChannelFlags1 - add hl, bc - bit 1, [hl] - jr nz, .returnFromCall - ld a, c - cp CH3 - jr nc, .noiseOrSfxChannel - jr .asm_7d2b3 -.noiseOrSfxChannel - res 2, [hl] - ld hl, wChannelFlags2 - add hl, bc - res 0, [hl] - cp CH6 - jr nz, .notSfxChannel3 - ld a, $0 - ld [rNR30], a - ld a, $80 - ld [rNR30], a -.notSfxChannel3 - jr nz, .asm_7d296 - ld a, [wDisableChannelOutputWhenSfxEnds] - and a - jr z, .asm_7d296 - xor a - ld [wDisableChannelOutputWhenSfxEnds], a - jr .asm_7d2b3 -.asm_7d296 - jr .asm_7d2bc -.returnFromCall - res 1, [hl] - ld d, $0 - ld a, c - add a - ld e, a - ld hl, wChannelCommandPointers - add hl, de - push hl ; store current channel address - ld hl, wChannelReturnAddresses - add hl, de - ld e, l - ld d, h - pop hl - ld a, [de] - ld [hli], a - inc de - ld a, [de] - ld [hl], a ; loads channel address to return to - jp Audio3_endchannel -.asm_7d2b3 - ld hl, Unknown_7db93 - add hl, bc - ld a, [rNR51] - and [hl] - ld [rNR51], a -.asm_7d2bc - ld a, [wChannelSoundIDs + CH4] - cp $14 - jr nc, .asm_7d2c5 - jr .asm_7d2e2 -.asm_7d2c5 - ld a, [wChannelSoundIDs + CH4] - cp $86 - jr z, .asm_7d2e2 - jr c, .asm_7d2d0 - jr .asm_7d2e2 -.asm_7d2d0 - ld a, c - cp CH4 - jr z, .asm_7d2d9 - call Audio3_7d73b - ret c -.asm_7d2d9 - ld a, [wSavedVolume] - ld [rNR50], a - xor a - ld [wSavedVolume], a -.asm_7d2e2 - ld hl, wChannelSoundIDs - add hl, bc - ld [hl], b - ret - -Audio3_callchannel: - cp $fd ; is this command a callchannel? - jp nz, Audio3_loopchannel ; no - call Audio3_GetNextMusicByte ; yes - push af - call Audio3_GetNextMusicByte - ld d, a - pop af - ld e, a - push de ; store pointer - ld d, $0 - ld a, c - add a - ld e, a - ld hl, wChannelCommandPointers - add hl, de - push hl - ld hl, wChannelReturnAddresses - add hl, de - ld e, l - ld d, h - pop hl - ld a, [hli] - ld [de], a - inc de - ld a, [hld] - ld [de], a ; copy current channel address - pop de - ld [hl], e - inc hl - ld [hl], d ; overwrite current address with pointer - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - set 1, [hl] ; set the call flag - jp Audio3_endchannel - -Audio3_loopchannel: - cp $fe ; is this command a loopchannel? - jp nz, Audio3_notetype ; no - call Audio3_GetNextMusicByte ; yes - ld e, a - and a - jr z, .infiniteLoop - ld b, $0 - ld hl, wChannelLoopCounters - add hl, bc - ld a, [hl] - cp e - jr nz, .loopAgain - ld a, $1 ; if no more loops to make - ld [hl], a - call Audio3_GetNextMusicByte ; skip pointer - call Audio3_GetNextMusicByte - jp Audio3_endchannel -.loopAgain ; inc loop count - inc a - ld [hl], a - ; fall through -.infiniteLoop ; overwrite current address with pointer - call Audio3_GetNextMusicByte - push af - call Audio3_GetNextMusicByte - ld b, a - ld d, $0 - ld a, c - add a - ld e, a - ld hl, wChannelCommandPointers - add hl, de - pop af - ld [hli], a - ld [hl], b - jp Audio3_endchannel - -Audio3_notetype: - and $f0 - cp $d0 ; is this command a notetype? - jp nz, Audio3_toggleperfectpitch ; no - ld a, d ; yes - and $f - ld b, $0 - ld hl, wChannelNoteSpeeds - add hl, bc - ld [hl], a ; store low nibble as speed - ld a, c - cp CH3 - jr z, .noiseChannel ; noise channel has 0 params - call Audio3_GetNextMusicByte - ld d, a - ld a, c - cp CH2 - jr z, .musicChannel3 - cp CH6 - jr nz, .notChannel3 - ld hl, wSfxWaveInstrument - jr .sfxChannel3 -.musicChannel3 - ld hl, wMusicWaveInstrument -.sfxChannel3 - ld a, d - and $f - ld [hl], a ; store low nibble of param as duty - ld a, d - and $30 - sla a - ld d, a - ; fall through - - ; if channel 3, store high nibble as volume - ; else, store volume (high nibble) and fade (low nibble) -.notChannel3 - ld b, $0 - ld hl, wChannelVolumes - add hl, bc - ld [hl], d -.noiseChannel - jp Audio3_endchannel - -Audio3_toggleperfectpitch: - ld a, d - cp $e8 ; is this command a toggleperfectpitch? - jr nz, Audio3_vibrato ; no - ld b, $0 ; yes - ld hl, wChannelFlags1 - add hl, bc - ld a, [hl] - xor $1 - ld [hl], a ; flip bit 0 of wChannelFlags1 - jp Audio3_endchannel - -Audio3_vibrato: - cp $ea ; is this command a vibrato? - jr nz, Audio3_pitchbend ; no - call Audio3_GetNextMusicByte ; yes - ld b, $0 - ld hl, wChannelVibratoDelayCounters - add hl, bc - ld [hl], a ; store delay - ld hl, wChannelVibratoDelayCounterReloadValues - add hl, bc - ld [hl], a ; store delay - call Audio3_GetNextMusicByte - ld d, a - and $f0 - swap a - ld b, $0 - ld hl, wChannelVibratoExtents - add hl, bc - srl a - ld e, a - adc b - swap a - or e - ld [hl], a ; store rate as both high and low nibbles - ld a, d - and $f - ld d, a - ld hl, wChannelVibratoRates - add hl, bc - swap a - or d - ld [hl], a ; store depth as both high and low nibbles - jp Audio3_endchannel - -Audio3_pitchbend: - cp $eb ; is this command a pitchbend? - jr nz, Audio3_duty ; no - call Audio3_GetNextMusicByte ; yes - ld b, $0 - ld hl, wChannelPitchBendLengthModifiers - add hl, bc - ld [hl], a ; store first param - call Audio3_GetNextMusicByte - ld d, a - and $f0 - swap a - ld b, a - ld a, d - and $f - call Audio3_7d8cc - ld b, $0 - ld hl, wChannelPitchBendTargetFrequencyHighBytes - add hl, bc - ld [hl], d ; store unknown part of second param - ld hl, wChannelPitchBendTargetFrequencyLowBytes - add hl, bc - ld [hl], e ; store unknown part of second param - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - set 4, [hl] ; set pitchbend flag - call Audio3_GetNextMusicByte - ld d, a - jp Audio3_notelength - -Audio3_duty: - cp $ec ; is this command a duty? - jr nz, Audio3_tempo ; no - call Audio3_GetNextMusicByte ; yes - rrca - rrca - and $c0 - ld b, $0 - ld hl, wChannelDuties - add hl, bc - ld [hl], a ; store duty - jp Audio3_endchannel - -Audio3_tempo: - cp $ed ; is this command a tempo? - jr nz, Audio3_stereopanning ; no - ld a, c ; yes - cp CH4 - jr nc, .sfxChannel - call Audio3_GetNextMusicByte - ld [wMusicTempo], a ; store first param - call Audio3_GetNextMusicByte - ld [wMusicTempo + 1], a ; store second param - xor a - ld [wChannelNoteDelayCountersFractionalPart], a ; clear RAM - ld [wChannelNoteDelayCountersFractionalPart + 1], a - ld [wChannelNoteDelayCountersFractionalPart + 2], a - ld [wChannelNoteDelayCountersFractionalPart + 3], a - jr .musicChannelDone -.sfxChannel - call Audio3_GetNextMusicByte - ld [wSfxTempo], a ; store first param - call Audio3_GetNextMusicByte - ld [wSfxTempo + 1], a ; store second param - xor a - ld [wChannelNoteDelayCountersFractionalPart + 4], a ; clear RAM - ld [wChannelNoteDelayCountersFractionalPart + 5], a - ld [wChannelNoteDelayCountersFractionalPart + 6], a - ld [wChannelNoteDelayCountersFractionalPart + 7], a -.musicChannelDone - jp Audio3_endchannel - -Audio3_stereopanning: - cp $ee ; is this command a stereopanning? - jr nz, Audio3_unknownmusic0xef ; no - call Audio3_GetNextMusicByte ; yes - ld [wStereoPanning], a ; store panning - jp Audio3_endchannel - -; this appears to never be used -Audio3_unknownmusic0xef: - cp $ef ; is this command an unknownmusic0xef? - jr nz, Audio3_dutycycle ; no - call Audio3_GetNextMusicByte ; yes - push bc - call Audio3_PlaySound - pop bc - ld a, [wDisableChannelOutputWhenSfxEnds] - and a - jr nz, .skip - ld a, [wChannelSoundIDs + CH7] - ld [wDisableChannelOutputWhenSfxEnds], a - xor a - ld [wChannelSoundIDs + CH7], a -.skip - jp Audio3_endchannel - -Audio3_dutycycle: - cp $fc ; is this command a dutycycle? - jr nz, Audio3_volume ; no - call Audio3_GetNextMusicByte ; yes - ld b, $0 - ld hl, wChannelDutyCycles - add hl, bc - ld [hl], a ; store full cycle - and $c0 - ld hl, wChannelDuties - add hl, bc - ld [hl], a ; store first duty - ld hl, wChannelFlags1 - add hl, bc - set 6, [hl] ; set duty flag - jp Audio3_endchannel - -Audio3_volume: - cp $f0 ; is this command a volume? - jr nz, Audio3_executemusic ; no - call Audio3_GetNextMusicByte ; yes - ld [rNR50], a ; store volume - jp Audio3_endchannel - -Audio3_executemusic: - cp $f8 ; is this command an executemusic? - jr nz, Audio3_octave ; no - ld b, $0 ; yes - ld hl, wChannelFlags2 - add hl, bc - set 0, [hl] - jp Audio3_endchannel - -Audio3_octave: - and $f0 - cp $e0 ; is this command an octave? - jr nz, Audio3_unknownsfx0x20 ; no - ld hl, wChannelOctaves ; yes - ld b, $0 - add hl, bc - ld a, d - and $f - ld [hl], a ; store low nibble as octave - jp Audio3_endchannel - -Audio3_unknownsfx0x20: - cp $20 ; is this command an unknownsfx0x20? - jr nz, Audio3_unknownsfx0x10 ; no - ld a, c - cp CH3 ; is this a noise or sfx channel? - jr c, Audio3_unknownsfx0x10 ; no - ld b, $0 - ld hl, wChannelFlags2 - add hl, bc - bit 0, [hl] - jr nz, Audio3_unknownsfx0x10 ; no - call Audio3_notelength ; yes - ld d, a - ld b, $0 - ld hl, wChannelDuties - add hl, bc - ld a, [hl] - or d - ld d, a - ld b, $1 - call Audio3_7d8ac - ld [hl], d - call Audio3_GetNextMusicByte - ld d, a - ld b, $2 - call Audio3_7d8ac - ld [hl], d - call Audio3_GetNextMusicByte - ld e, a - ld a, c - cp CH7 - ld a, $0 - jr z, .sfxNoiseChannel ; only two params for noise channel - push de - call Audio3_GetNextMusicByte - pop de -.sfxNoiseChannel - ld d, a - push de - call Audio3_7d69d - call Audio3_7d66c - pop de - call Audio3_7d6bf - ret - -Audio3_unknownsfx0x10: - ld a, c - cp CH4 - jr c, Audio3_note ; if not a sfx - ld a, d - cp $10 ; is this command an unknownsfx0x10? - jr nz, Audio3_note ; no - ld b, $0 - ld hl, wChannelFlags2 - add hl, bc - bit 0, [hl] - jr nz, Audio3_note ; no - call Audio3_GetNextMusicByte ; yes - ld [rNR10], a - jp Audio3_endchannel - -Audio3_note: - ld a, c - cp CH3 - jr nz, Audio3_notelength ; if not noise channel - ld a, d - and $f0 - cp $b0 ; is this command a dnote? - jr z, Audio3_dnote ; yes - jr nc, Audio3_notelength ; no - swap a - ld b, a - ld a, d - and $f - ld d, a - ld a, b - push de - push bc - jr asm_7d571 - -Audio3_dnote: - ld a, d - and $f - push af - push bc - call Audio3_GetNextMusicByte ; get dnote instrument -asm_7d571 - ld d, a - ld a, [wDisableChannelOutputWhenSfxEnds] - and a - jr nz, .asm_7d57c - ld a, d - call Audio3_PlaySound -.asm_7d57c - pop bc - pop de - -Audio3_notelength: - ld a, d - push af - and $f - inc a - ld b, $0 - ld e, a ; store note length (in 16ths) - ld d, b - ld hl, wChannelNoteSpeeds - add hl, bc - ld a, [hl] - ld l, b - call Audio3_7d8bb - ld a, c - cp CH4 - jr nc, .sfxChannel - ld a, [wMusicTempo] - ld d, a - ld a, [wMusicTempo + 1] - ld e, a - jr .skip -.sfxChannel - ld d, $1 - ld e, $0 - cp CH7 - jr z, .skip ; if noise channel - call Audio3_7d707 - ld a, [wSfxTempo] - ld d, a - ld a, [wSfxTempo + 1] - ld e, a -.skip - ld a, l - ld b, $0 - ld hl, wChannelNoteDelayCountersFractionalPart - add hl, bc - ld l, [hl] - call Audio3_7d8bb - ld e, l - ld d, h - ld hl, wChannelNoteDelayCountersFractionalPart - add hl, bc - ld [hl], e - ld a, d - ld hl, wChannelNoteDelayCounters - add hl, bc - ld [hl], a - ld hl, wChannelFlags2 - add hl, bc - bit 0, [hl] - jr nz, Audio3_notepitch - ld hl, wChannelFlags1 - add hl, bc - bit 2, [hl] - jr z, Audio3_notepitch - pop hl - ret - -Audio3_notepitch: - pop af - and $f0 - cp $c0 ; compare to rest - jr nz, .notRest - ld a, c - cp CH4 - jr nc, .sfxChannel - ld hl, wChannelSoundIDs + CH4 - add hl, bc - ld a, [hl] - and a - jr nz, .quit - ; fall through -.sfxChannel - ld a, c - cp CH2 - jr z, .musicChannel3 - cp CH6 - jr nz, .notSfxChannel3 -.musicChannel3 - ld b, $0 - ld hl, Unknown_7db93 - add hl, bc - ld a, [rNR51] - and [hl] - ld [rNR51], a - jr .quit -.notSfxChannel3 - ld b, $2 - call Audio3_7d8ac - ld a, $8 - ld [hli], a - inc hl - ld a, $80 - ld [hl], a -.quit - ret -.notRest - swap a - ld b, $0 - ld hl, wChannelOctaves - add hl, bc - ld b, [hl] - call Audio3_7d8cc - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - bit 4, [hl] - jr z, .asm_7d62c - call Audio3_7d803 -.asm_7d62c - push de - ld a, c - cp CH4 - jr nc, .skip ; if sfx Channel - ld hl, wChannelSoundIDs + CH4 - ld d, $0 - ld e, a - add hl, de - ld a, [hl] - and a - jr nz, .done - jr .skip -.done - pop de - ret -.skip - ld b, $0 - ld hl, wChannelVolumes - add hl, bc - ld d, [hl] - ld b, $2 - call Audio3_7d8ac - ld [hl], d - call Audio3_7d69d - call Audio3_7d66c - pop de - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - bit 0, [hl] ; has toggleperfectpitch been used? - jr z, .skip2 - inc e ; if yes, increment the pitch by 1 - jr nc, .skip2 - inc d -.skip2 - ld hl, wChannelFrequencyLowBytes - add hl, bc - ld [hl], e - call Audio3_7d6bf - ret - -Audio3_7d66c: - ld b, $0 - ld hl, Unknown_7db9b - add hl, bc - ld a, [rNR51] - or [hl] - ld d, a - ld a, c - cp CH7 - jr z, .sfxNoiseChannel - cp CH4 - jr nc, .skip ; if sfx channel - ld hl, wChannelSoundIDs + CH4 - add hl, bc - ld a, [hl] - and a - jr nz, .skip -.sfxNoiseChannel - ld a, [wStereoPanning] - ld hl, Unknown_7db9b - add hl, bc - and [hl] - ld d, a - ld a, [rNR51] - ld hl, Unknown_7db93 - add hl, bc - and [hl] - or d - ld d, a -.skip - ld a, d - ld [rNR51], a - ret - -Audio3_7d69d: - ld b, $0 - ld hl, wChannelNoteDelayCounters - add hl, bc - ld d, [hl] - ld a, c - cp CH2 - jr z, .channel3 ; if music channel 3 - cp CH6 - jr z, .channel3 ; if sfx channel 3 - ld a, d - and $3f - ld d, a - ld hl, wChannelDuties - add hl, bc - ld a, [hl] - or d - ld d, a -.channel3 - ld b, $1 - call Audio3_7d8ac - ld [hl], d - ret - -Audio3_7d6bf: - ld a, c - cp CH2 - jr z, .channel3 - cp CH6 - jr nz, .notSfxChannel3 - ; fall through -.channel3 - push de - ld de, wMusicWaveInstrument - cp CH2 - jr z, .musicChannel3 - ld de, wSfxWaveInstrument -.musicChannel3 - ld a, [de] - add a - ld d, $0 - ld e, a - ld hl, Audio3_WavePointers - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - ld hl, $ff30 - ld b, $f - ld a, $0 - ld [rNR30], a -.loop - ld a, [de] - inc de - ld [hli], a - ld a, b - dec b - and a - jr nz, .loop - ld a, $80 - ld [rNR30], a - pop de -.notSfxChannel3 - ld a, d - or $80 - and $c7 - ld d, a - ld b, $3 - call Audio3_7d8ac - ld [hl], e - inc hl - ld [hl], d - call Audio3_7d729 - ret - -Audio3_7d707: - call Audio3_7d759 - jr nc, .asm_7d71f - ld d, $0 - ld a, [wTempoModifier] - add $80 - jr nc, .asm_7d716 - inc d -.asm_7d716 - ld [wSfxTempo + 1], a - ld a, d - ld [wSfxTempo], a - jr .asm_7d728 -.asm_7d71f - xor a - ld [wSfxTempo + 1], a - ld a, $1 - ld [wSfxTempo], a -.asm_7d728 - ret - -Audio3_7d729: - call Audio3_7d759 - jr nc, .asm_7d73a - ld a, [wFrequencyModifier] - add e - jr nc, .asm_7d735 - inc d -.asm_7d735 - dec hl - ld e, a - ld [hl], e - inc hl - ld [hl], d -.asm_7d73a - ret - -Audio3_7d73b: - call Audio3_7d759 - jr nc, .asm_7d756 - ld hl, wChannelCommandPointers - ld e, c - ld d, $0 - sla e - rl d - add hl, de - ld a, [hl] - sub $1 - ld [hl], a - inc hl - ld a, [hl] - sbc $0 - ld [hl], a - scf - ret -.asm_7d756 - scf - ccf - ret - -Audio3_7d759: - ld a, [wChannelSoundIDs + CH4] - cp $14 - jr nc, .asm_7d762 - jr .asm_7d768 -.asm_7d762 - cp $86 - jr z, .asm_7d768 - jr c, .asm_7d76b -.asm_7d768 - scf - ccf - ret -.asm_7d76b - scf - ret - -Audio3_ApplyPitchBend: - ld hl, wChannelFlags1 - add hl, bc - bit 5, [hl] - jp nz, .asm_7d7b4 - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - add hl, bc - ld e, [hl] - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - add hl, bc - ld d, [hl] - ld hl, wChannelPitchBendFrequencySteps - add hl, bc - ld l, [hl] - ld h, b - add hl, de - ld d, h - ld e, l - ld hl, wChannelPitchBendCurrentFrequencyFractionalPart - add hl, bc - push hl - ld hl, wChannelPitchBendFrequencyStepsFractionalPart - add hl, bc - ld a, [hl] - pop hl - add [hl] - ld [hl], a - ld a, $0 - adc e - ld e, a - ld a, $0 - adc d - ld d, a - ld hl, wChannelPitchBendTargetFrequencyHighBytes - add hl, bc - ld a, [hl] - cp d - jp c, .asm_7d7fa - jr nz, .asm_7d7e7 - ld hl, wChannelPitchBendTargetFrequencyLowBytes - add hl, bc - ld a, [hl] - cp e - jp c, .asm_7d7fa - jr .asm_7d7e7 -.asm_7d7b4 - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - add hl, bc - ld a, [hl] - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - add hl, bc - ld d, [hl] - ld hl, wChannelPitchBendFrequencySteps - add hl, bc - ld e, [hl] - sub e - ld e, a - ld a, d - sbc b - ld d, a - ld hl, wChannelPitchBendFrequencyStepsFractionalPart - add hl, bc - ld a, [hl] - add a - ld [hl], a - ld a, e - sbc b - ld e, a - ld a, d - sbc b - ld d, a - ld hl, wChannelPitchBendTargetFrequencyHighBytes - add hl, bc - ld a, d - cp [hl] - jr c, .asm_7d7fa - jr nz, .asm_7d7e7 - ld hl, wChannelPitchBendTargetFrequencyLowBytes - add hl, bc - ld a, e - cp [hl] - jr c, .asm_7d7fa -.asm_7d7e7 - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - add hl, bc - ld [hl], e - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - add hl, bc - ld [hl], d - ld b, $3 - call Audio3_7d8ac - ld a, e - ld [hli], a - ld [hl], d - ret -.asm_7d7fa - ld hl, wChannelFlags1 - add hl, bc - res 4, [hl] - res 5, [hl] - ret - -Audio3_7d803: - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - add hl, bc - ld [hl], d - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - add hl, bc - ld [hl], e - ld hl, wChannelNoteDelayCounters - add hl, bc - ld a, [hl] - ld hl, wChannelPitchBendLengthModifiers - add hl, bc - sub [hl] - jr nc, .asm_7d81b - ld a, $1 -.asm_7d81b - ld [hl], a - ld hl, wChannelPitchBendTargetFrequencyLowBytes - add hl, bc - ld a, e - sub [hl] - ld e, a - ld a, d - sbc b - ld hl, wChannelPitchBendTargetFrequencyHighBytes - add hl, bc - sub [hl] - jr c, .asm_7d837 - ld d, a - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - set 5, [hl] - jr .asm_7d85a -.asm_7d837 - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - add hl, bc - ld d, [hl] - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - add hl, bc - ld e, [hl] - ld hl, wChannelPitchBendTargetFrequencyLowBytes - add hl, bc - ld a, [hl] - sub e - ld e, a - ld a, d - sbc b - ld d, a - ld hl, wChannelPitchBendTargetFrequencyHighBytes - add hl, bc - ld a, [hl] - sub d - ld d, a - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - res 5, [hl] -.asm_7d85a - ld hl, wChannelPitchBendLengthModifiers - add hl, bc -.asm_7d85e - inc b - ld a, e - sub [hl] - ld e, a - jr nc, .asm_7d85e - ld a, d - and a - jr z, .asm_7d86c - dec a - ld d, a - jr .asm_7d85e -.asm_7d86c - ld a, e - add [hl] - ld d, b - ld b, $0 - ld hl, wChannelPitchBendFrequencySteps - add hl, bc - ld [hl], d - ld hl, wChannelPitchBendFrequencyStepsFractionalPart - add hl, bc - ld [hl], a - ld hl, wChannelPitchBendCurrentFrequencyFractionalPart - add hl, bc - ld [hl], a - ret - -Audio3_ApplyDutyCycle: - ld b, $0 - ld hl, wChannelDutyCycles - add hl, bc - ld a, [hl] - rlca - rlca - ld [hl], a - and $c0 - ld d, a - ld b, $1 - call Audio3_7d8ac - ld a, [hl] - and $3f - or d - ld [hl], a - ret - -Audio3_GetNextMusicByte: - ld d, $0 - ld a, c - add a - ld e, a - ld hl, wChannelCommandPointers - add hl, de - ld a, [hli] - ld e, a - ld a, [hld] - ld d, a - ld a, [de] ; get next music command - inc de - ld [hl], e ; store address of next command - inc hl - ld [hl], d - ret - -Audio3_7d8ac: - ld a, c - ld hl, Unknown_7db8b - add l - jr nc, .noCarry - inc h -.noCarry - ld l, a - ld a, [hl] - add b - ld l, a - ld h, $ff - ret - -Audio3_7d8bb: - ld h, $0 -.loop - srl a - jr nc, .noCarry - add hl, de -.noCarry - sla e - rl d - and a - jr z, .done - jr .loop -.done - ret - -Audio3_7d8cc: - ld h, $0 - ld l, a - add hl, hl - ld d, h - ld e, l - ld hl, Audio3_Pitches - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - ld a, b -.loop - cp $7 - jr z, .done - sra d - rr e - inc a - jr .loop -.done - ld a, $8 - add d - ld d, a - ret - Audio3_PlaySound:: ld [wSoundID], a + ld a, [wSoundID] cp $ff - jp z, Audio3_7daa8 + jp z, Audio3_7d18e cp $c2 - jp z, Audio3_7d9c2 - jp c, Audio3_7d9c2 - cp $fe - jr z, .asm_7d901 - jp nc, Audio3_7d9c2 -.asm_7d901 - xor a - ld [wUnusedC000], a - ld [wDisableChannelOutputWhenSfxEnds], a - ld [wMusicTempo + 1], a - ld [wMusicWaveInstrument], a - ld [wSfxWaveInstrument], a - ld d, $8 - ld hl, wChannelReturnAddresses - call FillAudioRAM3 - ld hl, wChannelCommandPointers - call FillAudioRAM3 - ld d, $4 - ld hl, wChannelSoundIDs - call FillAudioRAM3 - ld hl, wChannelFlags1 - call FillAudioRAM3 - ld hl, wChannelDuties - call FillAudioRAM3 - ld hl, wChannelDutyCycles - call FillAudioRAM3 - ld hl, wChannelVibratoDelayCounters - call FillAudioRAM3 - ld hl, wChannelVibratoExtents - call FillAudioRAM3 - ld hl, wChannelVibratoRates - call FillAudioRAM3 - ld hl, wChannelFrequencyLowBytes - call FillAudioRAM3 - ld hl, wChannelVibratoDelayCounterReloadValues - call FillAudioRAM3 - ld hl, wChannelFlags2 - call FillAudioRAM3 - ld hl, wChannelPitchBendLengthModifiers - call FillAudioRAM3 - ld hl, wChannelPitchBendFrequencySteps - call FillAudioRAM3 - ld hl, wChannelPitchBendFrequencyStepsFractionalPart - call FillAudioRAM3 - ld hl, wChannelPitchBendCurrentFrequencyFractionalPart - call FillAudioRAM3 - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - call FillAudioRAM3 - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - call FillAudioRAM3 - ld hl, wChannelPitchBendTargetFrequencyHighBytes - call FillAudioRAM3 - ld hl, wChannelPitchBendTargetFrequencyLowBytes - call FillAudioRAM3 - ld a, $1 - ld hl, wChannelLoopCounters - call FillAudioRAM3 - ld hl, wChannelNoteDelayCounters - call FillAudioRAM3 - ld hl, wChannelNoteSpeeds - call FillAudioRAM3 - ld [wMusicTempo], a - ld a, $ff - ld [wStereoPanning], a - xor a - ld [rNR50], a - ld a, $8 - ld [rNR10], a - ld a, $0 - ld [rNR51], a - xor a - ld [rNR30], a - ld a, $80 - ld [rNR30], a - ld a, $77 - ld [rNR50], a - jp Audio3_7db03 - -Audio3_7d9c2: + jp z, Audio3_7d12d + jp c, Audio3_7d12d + cp $fd + jr z, .asm_7d127 + jp nc, Audio3_7d12d +.asm_7d127 + call InitMusicVariables + jp Audio3_7d192 + +Audio3_7d12d: ld l, a ld e, a ld h, $0 @@ -1375,7 +33,7 @@ Audio3_7d9c2: rlca rlca ld c, a -.asm_7d9db +.asm_7d146 ld d, c ld a, c add a @@ -1396,167 +54,38 @@ Audio3_7d9c2: add hl, de ld a, [hl] and a - jr z, .asm_7da17 + jr z, .asm_7d182 ld a, e cp $7 - jr nz, .asm_7da0e + jr nz, .asm_7d179 ld a, [wSoundID] cp $14 - jr nc, .asm_7da07 + jr nc, .asm_7d172 ret -.asm_7da07 +.asm_7d172 ld a, [hl] cp $14 - jr z, .asm_7da17 - jr c, .asm_7da17 -.asm_7da0e + jr z, .asm_7d182 + jr c, .asm_7d182 +.asm_7d179 ld a, [wSoundID] cp [hl] - jr z, .asm_7da17 - jr c, .asm_7da17 + jr z, .asm_7d182 + jr c, .asm_7d182 ret -.asm_7da17 - xor a - push de - ld h, d - ld l, e - add hl, hl - ld d, h - ld e, l - ld hl, wChannelReturnAddresses - add hl, de - ld [hli], a - ld [hl], a - ld hl, wChannelCommandPointers - add hl, de - ld [hli], a - ld [hl], a - pop de - ld hl, wChannelSoundIDs - add hl, de - ld [hl], a - ld hl, wChannelFlags1 - add hl, de - ld [hl], a - ld hl, wChannelDuties - add hl, de - ld [hl], a - ld hl, wChannelDutyCycles - add hl, de - ld [hl], a - ld hl, wChannelVibratoDelayCounters - add hl, de - ld [hl], a - ld hl, wChannelVibratoExtents - add hl, de - ld [hl], a - ld hl, wChannelVibratoRates - add hl, de - ld [hl], a - ld hl, wChannelFrequencyLowBytes - add hl, de - ld [hl], a - ld hl, wChannelVibratoDelayCounterReloadValues - add hl, de - ld [hl], a - ld hl, wChannelPitchBendLengthModifiers - add hl, de - ld [hl], a - ld hl, wChannelPitchBendFrequencySteps - add hl, de - ld [hl], a - ld hl, wChannelPitchBendFrequencyStepsFractionalPart - add hl, de - ld [hl], a - ld hl, wChannelPitchBendCurrentFrequencyFractionalPart - add hl, de - ld [hl], a - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - add hl, de - ld [hl], a - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - add hl, de - ld [hl], a - ld hl, wChannelPitchBendTargetFrequencyHighBytes - add hl, de - ld [hl], a - ld hl, wChannelPitchBendTargetFrequencyLowBytes - add hl, de - ld [hl], a - ld hl, wChannelFlags2 - add hl, de - ld [hl], a - ld a, $1 - ld hl, wChannelLoopCounters - add hl, de - ld [hl], a - ld hl, wChannelNoteDelayCounters - add hl, de - ld [hl], a - ld hl, wChannelNoteSpeeds - add hl, de - ld [hl], a - ld a, e - cp $4 - jr nz, .asm_7da9f - ld a, $8 - ld [rNR10], a -.asm_7da9f +.asm_7d182 + call InitSFXVariables ld a, c and a - jp z, Audio3_7db03 + jp z, Audio3_7d192 dec c - jp .asm_7d9db + jp .asm_7d146 -Audio3_7daa8: - ld a, $80 - ld [rNR52], a - ld [rNR30], a - xor a - ld [rNR51], a - ld [rNR32], a - ld a, $8 - ld [rNR10], a - ld [rNR12], a - ld [rNR22], a - ld [rNR42], a - ld a, $40 - ld [rNR14], a - ld [rNR24], a - ld [rNR44], a - ld a, $77 - ld [rNR50], a - xor a - ld [wUnusedC000], a - ld [wDisableChannelOutputWhenSfxEnds], a - ld [wMuteAudioAndPauseMusic], a - ld [wMusicTempo + 1], a - ld [wSfxTempo + 1], a - ld [wMusicWaveInstrument], a - ld [wSfxWaveInstrument], a - ld d, $a0 - ld hl, wChannelCommandPointers - call FillAudioRAM3 - ld a, $1 - ld d, $18 - ld hl, wChannelNoteDelayCounters - call FillAudioRAM3 - ld [wMusicTempo], a - ld [wSfxTempo], a - ld a, $ff - ld [wStereoPanning], a +Audio3_7d18e: + call StopAllAudio ret -; fills d bytes at hl with a -FillAudioRAM3: - ld b, d -.loop - ld [hli], a - dec b - jr nz, .loop - ret - -Audio3_7db03: +Audio3_7d192: ld a, [wSoundID] ld l, a ld e, a @@ -1581,30 +110,25 @@ Audio3_7db03: inc b inc de ld c, $0 -.asm_7db25 +.asm_7d1b4 cp c - jr z, .asm_7db2d + jr z, .asm_7d1bc inc c inc hl inc hl - jr .asm_7db25 -.asm_7db2d + jr .asm_7d1b4 +.asm_7d1bc + push af push hl push bc - push af ld b, $0 ld c, a - ld hl, wChannelSoundIDs - add hl, bc - ld a, [wSoundID] - ld [hl], a - pop af cp $3 - jr c, .asm_7db46 + jr c, .asm_7d1cc ld hl, wChannelFlags1 add hl, bc set 2, [hl] -.asm_7db46 +.asm_7d1cc pop bc pop hl ld a, [de] ; get channel pointer @@ -1613,24 +137,35 @@ Audio3_7db03: ld a, [de] ld [hli], a inc de + pop af + push hl + push bc + ld b, $0 + ld c, a + ld hl, wChannelSoundIDs + add hl, bc + ld a, [wSoundID] + ld [hl], a + pop bc + pop hl inc c dec b ld a, b and a ld a, [de] inc de - jr nz, .asm_7db25 + jr nz, .asm_7d1b4 ld a, [wSoundID] cp $14 - jr nc, .asm_7db5f - jr .asm_7db89 -.asm_7db5f + jr nc, .asm_7d1f5 + jr .asm_7d21f +.asm_7d1f5 ld a, [wSoundID] cp $86 - jr z, .asm_7db89 - jr c, .asm_7db6a - jr .asm_7db89 -.asm_7db6a + jr z, .asm_7d21f + jr c, .asm_7d200 + jr .asm_7d21f +.asm_7d200 ld hl, wChannelSoundIDs + CH4 ld [hli], a ld [hli], a @@ -1643,41 +178,13 @@ Audio3_7db03: ld [hl], d ; overwrite pointer to point to endchannel ld a, [wSavedVolume] and a - jr nz, .asm_7db89 + jr nz, .asm_7d21f ld a, [rNR50] ld [wSavedVolume], a ld a, $77 ld [rNR50], a -.asm_7db89 +.asm_7d21f ret Noise3_endchannel: endchannel - -Unknown_7db8b: - db $10, $15, $1A, $1F ; channels 0-3 - db $10, $15, $1A, $1F ; channels 4-7 - -Unknown_7db93: - db $EE, $DD, $BB, $77 ; channels 0-3 - db $EE, $DD, $BB, $77 ; channels 4-7 - -Unknown_7db9b: - db $11, $22, $44, $88 ; channels 0-3 - db $11, $22, $44, $88 ; channels 4-7 - -Audio3_Pitches: - dw $F82C ; C_ - dw $F89D ; C# - dw $F907 ; D_ - dw $F96B ; D# - dw $F9CA ; E_ - dw $FA23 ; F_ - dw $FA77 ; F# - dw $FAC7 ; G_ - dw $FB12 ; G# - dw $FB58 ; A_ - dw $FB9B ; A# - dw $FBDA ; B_ - - diff --git a/audio/engine_4.asm b/audio/engine_4.asm new file mode 100644 index 00000000..f152ff80 --- /dev/null +++ b/audio/engine_4.asm @@ -0,0 +1,193 @@ +Audio4_PlaySound:: +; Duplicate of Audio3_PlaySound + ld [wSoundID], a + ld a, [wSoundID] + cp $ff + jp z, Audio4_7d18e + cp $98 + jp z, Audio4_7d12d + jp c, Audio4_7d12d + cp $a3 + jr z, .asm_7d127 + jp nc, Audio4_7d12d + +.asm_7d127 + call InitMusicVariables + jp Audio4_7d192 + +Audio4_7d12d: + ld l, a + ld e, a + ld h, $0 + ld d, h + add hl, hl + add hl, de + ld de, SFX_Headers_4 + add hl, de + ld a, h + ld [wSfxHeaderPointer], a + ld a, l + ld [wSfxHeaderPointer + 1], a + ld a, [hl] + and $c0 + rlca + rlca + ld c, a +.asm_7d146 + ld d, c + ld a, c + add a + add c + ld c, a + ld b, $0 + ld a, [wSfxHeaderPointer] + ld h, a + ld a, [wSfxHeaderPointer + 1] + ld l, a + add hl, bc + ld c, d + ld a, [hl] + and $f + ld e, a + ld d, $0 + ld hl, wChannelSoundIDs + add hl, de + ld a, [hl] + and a + jr z, .asm_7d182 + ld a, e + cp $7 + jr nz, .asm_7d179 + ld a, [wSoundID] + cp $14 + jr nc, .asm_7d172 + ret + +.asm_7d172 + ld a, [hl] + cp $14 + jr z, .asm_7d182 + jr c, .asm_7d182 +.asm_7d179 + ld a, [wSoundID] + cp [hl] + jr z, .asm_7d182 + jr c, .asm_7d182 + ret + +.asm_7d182 + call InitSFXVariables + ld a, c + and a + jp z, Audio4_7d192 + dec c + jp .asm_7d146 + +Audio4_7d18e: + call StopAllAudio + ret + +Audio4_7d192: + ld a, [wSoundID] + ld l, a + ld e, a + ld h, $0 + ld d, h + add hl, hl + add hl, de + ld de, SFX_Headers_4 + add hl, de + ld e, l + ld d, h + ld hl, wChannelCommandPointers + ld a, [de] ; get channel number + ld b, a + rlca + rlca + and $3 + ld c, a + ld a, b + and $f + ld b, c + inc b + inc de + ld c, $0 +.asm_7d1b4 + cp c + jr z, .asm_7d1bc + inc c + inc hl + inc hl + jr .asm_7d1b4 +.asm_7d1bc + push af + push hl + push bc + ld b, $0 + ld c, a + cp $3 + jr c, .asm_7d1cc + ld hl, wChannelFlags1 + add hl, bc + set 2, [hl] +.asm_7d1cc + pop bc + pop hl + ld a, [de] ; get channel pointer + ld [hli], a + inc de + ld a, [de] + ld [hli], a + inc de + pop af + push hl + push bc + ld b, $0 + ld c, a + ld hl, wChannelSoundIDs + add hl, bc + ld a, [wSoundID] + ld [hl], a + pop bc + pop hl + inc c + dec b + ld a, b + and a + ld a, [de] + inc de + jr nz, .asm_7d1b4 + ld a, [wSoundID] + cp $14 + jr nc, .asm_7d1f5 + jr .asm_7d21f + +.asm_7d1f5 + ld a, [wSoundID] + cp $86 + jr z, .asm_7d21f + jr c, .asm_7d200 + jr .asm_7d21f +.asm_7d200 + ld hl, wChannelSoundIDs + CH4 + ld [hli], a + ld [hli], a + ld [hli], a + ld [hl], a + ld hl, wChannelCommandPointers + CH6 * 2 ; sfx noise channel pointer + ld de, Noise4_endchannel + ld [hl], e + inc hl + ld [hl], d ; overwrite pointer to point to endchannel + ld a, [wSavedVolume] + and a + jr nz, .asm_7d21f + ld a, [rNR50] + ld [wSavedVolume], a + ld a, $77 + ld [rNR50], a +.asm_7d21f + ret + +Noise4_endchannel: + endchannel diff --git a/audio/headers/musicheaders1.asm b/audio/headers/musicheaders1.asm index 5a762b30..665efceb 100755..100644 --- a/audio/headers/musicheaders1.asm +++ b/audio/headers/musicheaders1.asm @@ -1,184 +1,115 @@ Music_PalletTown:: - db ( $80 | CH0 ) - dw Music_PalletTown_Ch1 - db CH1 - dw Music_PalletTown_Ch2 - db CH2 - dw Music_PalletTown_Ch3 + dbw ( $80 | CH0 ), Music_PalletTown_Ch1 + dbw CH1, Music_PalletTown_Ch2 + dbw CH2, Music_PalletTown_Ch3 Music_Pokecenter:: - db ( $80 | CH0 ) - dw Music_Pokecenter_Ch1 - db CH1 - dw Music_Pokecenter_Ch2 - db CH2 - dw Music_Pokecenter_Ch3 + dbw ( $80 | CH0 ), Music_Pokecenter_Ch1 + dbw CH1, Music_Pokecenter_Ch2 + dbw CH2, Music_Pokecenter_Ch3 Music_Gym:: - db ( $80 | CH0 ) - dw Music_Gym_Ch1 - db CH1 - dw Music_Gym_Ch2 - db CH2 - dw Music_Gym_Ch3 + dbw ( $80 | CH0 ), Music_Gym_Ch1 + dbw CH1, Music_Gym_Ch2 + dbw CH2, Music_Gym_Ch3 ; Viridian City, Pewter City, Saffron City Music_Cities1:: - db ( $C0 | CH0 ) - dw Music_Cities1_Ch1 - db CH1 - dw Music_Cities1_Ch2 - db CH2 - dw Music_Cities1_Ch3 - db CH3 - dw Music_Cities1_Ch4 + dbw ( $C0 | CH0 ), Music_Cities1_Ch1 + dbw CH1, Music_Cities1_Ch2 + dbw CH2, Music_Cities1_Ch3 + dbw CH3, Music_Cities1_Ch4 ; Cerulean City, Fuchsia City Music_Cities2:: - db ( $80 | CH0 ) - dw Music_Cities2_Ch1 - db CH1 - dw Music_Cities2_Ch2 - db CH2 - dw Music_Cities2_Ch3 + dbw ( $80 | CH0 ), Music_Cities2_Ch1 + dbw CH1, Music_Cities2_Ch2 + dbw CH2, Music_Cities2_Ch3 Music_Celadon:: - db ( $80 | CH0 ) - dw Music_Celadon_Ch1 - db CH1 - dw Music_Celadon_Ch2 - db CH2 - dw Music_Celadon_Ch3 + dbw ( $80 | CH0 ), Music_Celadon_Ch1 + dbw CH1, Music_Celadon_Ch2 + dbw CH2, Music_Celadon_Ch3 Music_Cinnabar:: - db ( $80 | CH0 ) - dw Music_Cinnabar_Ch1 - db CH1 - dw Music_Cinnabar_Ch2 - db CH2 - dw Music_Cinnabar_Ch3 + dbw ( $80 | CH0 ), Music_Cinnabar_Ch1 + dbw CH1, Music_Cinnabar_Ch2 + dbw CH2, Music_Cinnabar_Ch3 Music_Vermilion:: - db ( $C0 | CH0 ) - dw Music_Vermilion_Ch1 - db CH1 - dw Music_Vermilion_Ch2 - db CH2 - dw Music_Vermilion_Ch3 - db CH3 - dw Music_Vermilion_Ch4 + dbw ( $C0 | CH0 ), Music_Vermilion_Ch1 + dbw CH1, Music_Vermilion_Ch2 + dbw CH2, Music_Vermilion_Ch3 + dbw CH3, Music_Vermilion_Ch4 Music_Lavender:: - db ( $C0 | CH0 ) - dw Music_Lavender_Ch1 - db CH1 - dw Music_Lavender_Ch2 - db CH2 - dw Music_Lavender_Ch3 - db CH3 - dw Music_Lavender_Ch4 + dbw ( $C0 | CH0 ), Music_Lavender_Ch1 + dbw CH1, Music_Lavender_Ch2 + dbw CH2, Music_Lavender_Ch3 + dbw CH3, Music_Lavender_Ch4 Music_SSAnne:: - db ( $80 | CH0 ) - dw Music_SSAnne_Ch1 - db CH1 - dw Music_SSAnne_Ch2 - db CH2 - dw Music_SSAnne_Ch3 + dbw ( $80 | CH0 ), Music_SSAnne_Ch1 + dbw CH1, Music_SSAnne_Ch2 + dbw CH2, Music_SSAnne_Ch3 Music_MeetProfOak:: - db ( $80 | CH0 ) - dw Music_MeetProfOak_Ch1 - db CH1 - dw Music_MeetProfOak_Ch2 - db CH2 - dw Music_MeetProfOak_Ch3 + dbw ( $80 | CH0 ), Music_MeetProfOak_Ch1 + dbw CH1, Music_MeetProfOak_Ch2 + dbw CH2, Music_MeetProfOak_Ch3 Music_MeetRival:: - db ( $80 | CH0 ) - dw Music_MeetRival_Ch1 - db CH1 - dw Music_MeetRival_Ch2 - db CH2 - dw Music_MeetRival_Ch3 + dbw ( $80 | CH0 ), Music_MeetRival_Ch1 + dbw CH1, Music_MeetRival_Ch2 + dbw CH2, Music_MeetRival_Ch3 Music_MuseumGuy:: - db ( $C0 | CH0 ) - dw Music_MuseumGuy_Ch1 - db CH1 - dw Music_MuseumGuy_Ch2 - db CH2 - dw Music_MuseumGuy_Ch3 - db CH3 - dw Music_MuseumGuy_Ch4 + dbw ( $C0 | CH0 ), Music_MuseumGuy_Ch1 + dbw CH1, Music_MuseumGuy_Ch2 + dbw CH2, Music_MuseumGuy_Ch3 + dbw CH3, Music_MuseumGuy_Ch4 Music_SafariZone:: - db ( $80 | CH0 ) - dw Music_SafariZone_Ch1 - db CH1 - dw Music_SafariZone_Ch2 - db CH2 - dw Music_SafariZone_Ch3 + dbw ( $80 | CH0 ), Music_SafariZone_Ch1 + dbw CH1, Music_SafariZone_Ch2 + dbw CH2, Music_SafariZone_Ch3 Music_PkmnHealed:: - db ( $80 | CH0 ) - dw Music_PkmnHealed_Ch1 - db CH1 - dw Music_PkmnHealed_Ch2 - db CH2 - dw Music_PkmnHealed_Ch3 + dbw ( $80 | CH0 ), Music_PkmnHealed_Ch1 + dbw CH1, Music_PkmnHealed_Ch2 + dbw CH2, Music_PkmnHealed_Ch3 ; Routes 1 and 2 Music_Routes1:: - db ( $C0 | CH0 ) - dw Music_Routes1_Ch1 - db CH1 - dw Music_Routes1_Ch2 - db CH2 - dw Music_Routes1_Ch3 - db CH3 - dw Music_Routes1_Ch4 + dbw ( $C0 | CH0 ), Music_Routes1_Ch1 + dbw CH1, Music_Routes1_Ch2 + dbw CH2, Music_Routes1_Ch3 + dbw CH3, Music_Routes1_Ch4 ; Routes 24 and 25 Music_Routes2:: - db ( $C0 | CH0 ) - dw Music_Routes2_Ch1 - db CH1 - dw Music_Routes2_Ch2 - db CH2 - dw Music_Routes2_Ch3 - db CH3 - dw Music_Routes2_Ch4 + dbw ( $C0 | CH0 ), Music_Routes2_Ch1 + dbw CH1, Music_Routes2_Ch2 + dbw CH2, Music_Routes2_Ch3 + dbw CH3, Music_Routes2_Ch4 ; Routes 3, 4, 5, 6, 7, 8, 9, 10, 16, 17, 18, 19, 20, 21, 22 Music_Routes3:: - db ( $C0 | CH0 ) - dw Music_Routes3_Ch1 - db CH1 - dw Music_Routes3_Ch2 - db CH2 - dw Music_Routes3_Ch3 - db CH3 - dw Music_Routes3_Ch4 + dbw ( $C0 | CH0 ), Music_Routes3_Ch1 + dbw CH1, Music_Routes3_Ch2 + dbw CH2, Music_Routes3_Ch3 + dbw CH3, Music_Routes3_Ch4 ; Routes 11, 12, 13, 14, 15 Music_Routes4:: - db ( $C0 | CH0 ) - dw Music_Routes4_Ch1 - db CH1 - dw Music_Routes4_Ch2 - db CH2 - dw Music_Routes4_Ch3 - db CH3 - dw Music_Routes4_Ch4 + dbw ( $C0 | CH0 ), Music_Routes4_Ch1 + dbw CH1, Music_Routes4_Ch2 + dbw CH2, Music_Routes4_Ch3 + dbw CH3, Music_Routes4_Ch4 ; Route 23, Indigo Plateau Music_IndigoPlateau:: - db ( $C0 | CH0 ) - dw Music_IndigoPlateau_Ch1 - db CH1 - dw Music_IndigoPlateau_Ch2 - db CH2 - dw Music_IndigoPlateau_Ch3 - db CH3 - dw Music_IndigoPlateau_Ch4 + dbw ( $C0 | CH0 ), Music_IndigoPlateau_Ch1 + dbw CH1, Music_IndigoPlateau_Ch2 + dbw CH2, Music_IndigoPlateau_Ch3 + dbw CH3, Music_IndigoPlateau_Ch4 diff --git a/audio/headers/musicheaders2.asm b/audio/headers/musicheaders2.asm index 8adc039a..7df3f8bf 100755..100644 --- a/audio/headers/musicheaders2.asm +++ b/audio/headers/musicheaders2.asm @@ -1,55 +1,34 @@ Music_GymLeaderBattle:: - db ( $80 | CH0 ) - dw Music_GymLeaderBattle_Ch1 - db CH1 - dw Music_GymLeaderBattle_Ch2 - db CH2 - dw Music_GymLeaderBattle_Ch3 + dbw ( $80 | CH0 ), Music_GymLeaderBattle_Ch1 + dbw CH1, Music_GymLeaderBattle_Ch2 + dbw CH2, Music_GymLeaderBattle_Ch3 Music_TrainerBattle:: - db ( $80 | CH0 ) - dw Music_TrainerBattle_Ch1 - db CH1 - dw Music_TrainerBattle_Ch2 - db CH2 - dw Music_TrainerBattle_Ch3 + dbw ( $80 | CH0 ), Music_TrainerBattle_Ch1 + dbw CH1, Music_TrainerBattle_Ch2 + dbw CH2, Music_TrainerBattle_Ch3 Music_WildBattle:: - db ( $80 | CH0 ) - dw Music_WildBattle_Ch1 - db CH1 - dw Music_WildBattle_Ch2 - db CH2 - dw Music_WildBattle_Ch3 + dbw ( $80 | CH0 ), Music_WildBattle_Ch1 + dbw CH1, Music_WildBattle_Ch2 + dbw CH2, Music_WildBattle_Ch3 Music_FinalBattle:: - db ( $80 | CH0 ) - dw Music_FinalBattle_Ch1 - db CH1 - dw Music_FinalBattle_Ch2 - db CH2 - dw Music_FinalBattle_Ch3 + dbw ( $80 | CH0 ), Music_FinalBattle_Ch1 + dbw CH1, Music_FinalBattle_Ch2 + dbw CH2, Music_FinalBattle_Ch3 Music_DefeatedTrainer:: - db ( $80 | CH0 ) - dw Music_DefeatedTrainer_Ch1 - db CH1 - dw Music_DefeatedTrainer_Ch2 - db CH2 - dw Music_DefeatedTrainer_Ch3 + dbw ( $80 | CH0 ), Music_DefeatedTrainer_Ch1 + dbw CH1, Music_DefeatedTrainer_Ch2 + dbw CH2, Music_DefeatedTrainer_Ch3 Music_DefeatedWildMon:: - db ( $80 | CH0 ) - dw Music_DefeatedWildMon_Ch1 - db CH1 - dw Music_DefeatedWildMon_Ch2 - db CH2 - dw Music_DefeatedWildMon_Ch3 + dbw ( $80 | CH0 ), Music_DefeatedWildMon_Ch1 + dbw CH1, Music_DefeatedWildMon_Ch2 + dbw CH2, Music_DefeatedWildMon_Ch3 Music_DefeatedGymLeader:: - db ( $80 | CH0 ) - dw Music_DefeatedGymLeader_Ch1 - db CH1 - dw Music_DefeatedGymLeader_Ch2 - db CH2 - dw Music_DefeatedGymLeader_Ch3 + dbw ( $80 | CH0 ), Music_DefeatedGymLeader_Ch1 + dbw CH1, Music_DefeatedGymLeader_Ch2 + dbw CH2, Music_DefeatedGymLeader_Ch3 diff --git a/audio/headers/musicheaders3.asm b/audio/headers/musicheaders3.asm index 1c54b266..c694be9b 100755..100644 --- a/audio/headers/musicheaders3.asm +++ b/audio/headers/musicheaders3.asm @@ -1,158 +1,97 @@ Music_TitleScreen:: - db ( $C0 | CH0 ) - dw Music_TitleScreen_Ch1 - db CH1 - dw Music_TitleScreen_Ch2 - db CH2 - dw Music_TitleScreen_Ch3 - db CH3 - dw Music_TitleScreen_Ch4 + dbw ( $C0 | CH0 ), Music_TitleScreen_Ch1 + dbw CH1, Music_TitleScreen_Ch2 + dbw CH2, Music_TitleScreen_Ch3 + dbw CH3, Music_TitleScreen_Ch4 Music_Credits:: - db ( $80 | CH0 ) - dw Music_Credits_Ch1 - db CH1 - dw Music_Credits_Ch2 - db CH2 - dw Music_Credits_Ch3 + dbw ( $80 | CH0 ), Music_Credits_Ch1 + dbw CH1, Music_Credits_Ch2 + dbw CH2, Music_Credits_Ch3 Music_HallOfFame:: - db ( $80 | CH0 ) - dw Music_HallOfFame_Ch1 - db CH1 - dw Music_HallOfFame_Ch2 - db CH2 - dw Music_HallOfFame_Ch3 + dbw ( $80 | CH0 ), Music_HallOfFame_Ch1 + dbw CH1, Music_HallOfFame_Ch2 + dbw CH2, Music_HallOfFame_Ch3 Music_OaksLab:: - db ( $80 | CH0 ) - dw Music_OaksLab_Ch1 - db CH1 - dw Music_OaksLab_Ch2 - db CH2 - dw Music_OaksLab_Ch3 + dbw ( $80 | CH0 ), Music_OaksLab_Ch1 + dbw CH1, Music_OaksLab_Ch2 + dbw CH2, Music_OaksLab_Ch3 Music_JigglypuffSong:: - db $40 - dw Music_JigglypuffSong_Ch1 - db CH1 - dw Music_JigglypuffSong_Ch2 + dbw $40, Music_JigglypuffSong_Ch1 + dbw CH1, Music_JigglypuffSong_Ch2 Music_BikeRiding:: - db ( $C0 | CH0 ) - dw Music_BikeRiding_Ch1 - db CH1 - dw Music_BikeRiding_Ch2 - db CH2 - dw Music_BikeRiding_Ch3 - db CH3 - dw Music_BikeRiding_Ch4 + dbw ( $C0 | CH0 ), Music_BikeRiding_Ch1 + dbw CH1, Music_BikeRiding_Ch2 + dbw CH2, Music_BikeRiding_Ch3 + dbw CH3, Music_BikeRiding_Ch4 Music_Surfing:: - db ( $80 | CH0 ) - dw Music_Surfing_Ch1 - db CH1 - dw Music_Surfing_Ch2 - db CH2 - dw Music_Surfing_Ch3 + dbw ( $80 | CH0 ), Music_Surfing_Ch1 + dbw CH1, Music_Surfing_Ch2 + dbw CH2, Music_Surfing_Ch3 Music_GameCorner:: - db ( $80 | CH0 ) - dw Music_GameCorner_Ch1 - db CH1 - dw Music_GameCorner_Ch2 - db CH2 - dw Music_GameCorner_Ch3 + dbw ( $80 | CH0 ), Music_GameCorner_Ch1 + dbw CH1, Music_GameCorner_Ch2 + dbw CH2, Music_GameCorner_Ch3 Music_IntroBattle:: - db ( $C0 | CH0 ) - dw Music_IntroBattle_Ch1 - db CH1 - dw Music_IntroBattle_Ch2 - db CH2 - dw Music_IntroBattle_Ch3 - db CH3 - dw Music_IntroBattle_Ch4 + dbw ( $80 | CH0 ), Music_YellowIntro_Ch1 + dbw CH1, Music_YellowIntro_Ch2 + dbw CH2, Music_YellowIntro_Ch3 ; Power Plant, Unknown Dungeon, Rocket HQ Music_Dungeon1:: - db ( $C0 | CH0 ) - dw Music_Dungeon1_Ch1 - db CH1 - dw Music_Dungeon1_Ch2 - db CH2 - dw Music_Dungeon1_Ch3 - db CH3 - dw Music_Dungeon1_Ch4 + dbw ( $C0 | CH0 ), Music_Dungeon1_Ch1 + dbw CH1, Music_Dungeon1_Ch2 + dbw CH2, Music_Dungeon1_Ch3 + dbw CH3, Music_Dungeon1_Ch4 ; Viridian Forest, Seafoam Islands Music_Dungeon2:: - db ( $C0 | CH0 ) - dw Music_Dungeon2_Ch1 - db CH1 - dw Music_Dungeon2_Ch2 - db CH2 - dw Music_Dungeon2_Ch3 - db CH3 - dw Music_Dungeon2_Ch4 + dbw ( $C0 | CH0 ), Music_Dungeon2_Ch1 + dbw CH1, Music_Dungeon2_Ch2 + dbw CH2, Music_Dungeon2_Ch3 + dbw CH3, Music_Dungeon2_Ch4 ; Mt. Moon, Rock Tunnel, Victory Road Music_Dungeon3:: - db ( $C0 | CH0 ) - dw Music_Dungeon3_Ch1 - db CH1 - dw Music_Dungeon3_Ch2 - db CH2 - dw Music_Dungeon3_Ch3 - db CH3 - dw Music_Dungeon3_Ch4 + dbw ( $C0 | CH0 ), Music_Dungeon3_Ch1 + dbw CH1, Music_Dungeon3_Ch2 + dbw CH2, Music_Dungeon3_Ch3 + dbw CH3, Music_Dungeon3_Ch4 Music_CinnabarMansion:: - db ( $C0 | CH0 ) - dw Music_CinnabarMansion_Ch1 - db CH1 - dw Music_CinnabarMansion_Ch2 - db CH2 - dw Music_CinnabarMansion_Ch3 - db CH3 - dw Music_CinnabarMansion_Ch4 + dbw ( $C0 | CH0 ), Music_CinnabarMansion_Ch1 + dbw CH1, Music_CinnabarMansion_Ch2 + dbw CH2, Music_CinnabarMansion_Ch3 + dbw CH3, Music_CinnabarMansion_Ch4 Music_PokemonTower:: - db ( $80 | CH0 ) - dw Music_PokemonTower_Ch1 - db CH1 - dw Music_PokemonTower_Ch2 - db CH2 - dw Music_PokemonTower_Ch3 + dbw ( $80 | CH0 ), Music_PokemonTower_Ch1 + dbw CH1, Music_PokemonTower_Ch2 + dbw CH2, Music_PokemonTower_Ch3 Music_SilphCo:: - db ( $80 | CH0 ) - dw Music_SilphCo_Ch1 - db CH1 - dw Music_SilphCo_Ch2 - db CH2 - dw Music_SilphCo_Ch3 + dbw ( $80 | CH0 ), Music_SilphCo_Ch1 + dbw CH1, Music_SilphCo_Ch2 + dbw CH2, Music_SilphCo_Ch3 Music_MeetEvilTrainer:: - db ( $80 | CH0 ) - dw Music_MeetEvilTrainer_Ch1 - db CH1 - dw Music_MeetEvilTrainer_Ch2 - db CH2 - dw Music_MeetEvilTrainer_Ch3 + dbw ( $80 | CH0 ), Music_MeetEvilTrainer_Ch1 + dbw CH1, Music_MeetEvilTrainer_Ch2 + dbw CH2, Music_MeetEvilTrainer_Ch3 Music_MeetFemaleTrainer:: - db ( $80 | CH0 ) - dw Music_MeetFemaleTrainer_Ch1 - db CH1 - dw Music_MeetFemaleTrainer_Ch2 - db CH2 - dw Music_MeetFemaleTrainer_Ch3 + dbw ( $80 | CH0 ), Music_MeetFemaleTrainer_Ch1 + dbw CH1, Music_MeetFemaleTrainer_Ch2 + dbw CH2, Music_MeetFemaleTrainer_Ch3 Music_MeetMaleTrainer:: - db ( $80 | CH0 ) - dw Music_MeetMaleTrainer_Ch1 - db CH1 - dw Music_MeetMaleTrainer_Ch2 - db CH2 - dw Music_MeetMaleTrainer_Ch3 + dbw ( $80 | CH0 ), Music_MeetMaleTrainer_Ch1 + dbw CH1, Music_MeetMaleTrainer_Ch2 + dbw CH2, Music_MeetMaleTrainer_Ch3 diff --git a/audio/headers/musicheaders4.asm b/audio/headers/musicheaders4.asm new file mode 100644 index 00000000..be5d822a --- /dev/null +++ b/audio/headers/musicheaders4.asm @@ -0,0 +1,18 @@ +Music_SurfingPikachu:: + dbw ((3 - 1) << 6) | CH0, Music_SurfingPikachu_Ch1 + dbw CH1, Music_SurfingPikachu_Ch2 + dbw CH2, Music_SurfingPikachu_Ch3 + +Music_MeetJessieJames:: + dbw ((3 - 1) << 6) | CH0, Music_MeetJessieJames_Ch1 + dbw CH1, Music_MeetJessieJames_Ch2 + dbw CH2, Music_MeetJessieJames_Ch3 + +Music_YellowUnusedSong:: + dbw ((4 - 1) << 6) | CH0, Music_YellowUnusedSong_Ch1 + dbw CH1, Music_YellowUnusedSong_Ch2 + dbw CH2, Music_YellowUnusedSong_Ch3 + dbw CH3, Music_YellowUnusedSong_Ch4 + +Music_GBPrinter:: + dbw ((1 - 1) << 6) | CH2, Music_GBPrinter_Ch3 diff --git a/audio/headers/sfxheaders1.asm b/audio/headers/sfxheaders1.asm index 57c62e1c..fdbcb5f3 100644 --- a/audio/headers/sfxheaders1.asm +++ b/audio/headers/sfxheaders1.asm @@ -1,562 +1,377 @@ SFX_Headers_1:: - db $ff, $ff, $ff ; padding + dbw -1, -1 ; padding SFX_Snare1_1:: - db CH7 - dw SFX_Snare1_1_Ch1 + dbw CH7, SFX_Snare1_1_Ch1 SFX_Snare2_1:: - db CH7 - dw SFX_Snare2_1_Ch1 + dbw CH7, SFX_Snare2_1_Ch1 SFX_Snare3_1:: - db CH7 - dw SFX_Snare3_1_Ch1 + dbw CH7, SFX_Snare3_1_Ch1 SFX_Snare4_1:: - db CH7 - dw SFX_Snare4_1_Ch1 + dbw CH7, SFX_Snare4_1_Ch1 SFX_Snare5_1:: - db CH7 - dw SFX_Snare5_1_Ch1 + dbw CH7, SFX_Snare5_1_Ch1 SFX_Triangle1_1:: - db CH7 - dw SFX_Triangle1_1_Ch1 + dbw CH7, SFX_Triangle1_1_Ch1 SFX_Triangle2_1:: - db CH7 - dw SFX_Triangle2_1_Ch1 + dbw CH7, SFX_Triangle2_1_Ch1 SFX_Snare6_1:: - db CH7 - dw SFX_Snare6_1_Ch1 + dbw CH7, SFX_Snare6_1_Ch1 SFX_Snare7_1:: - db CH7 - dw SFX_Snare7_1_Ch1 + dbw CH7, SFX_Snare7_1_Ch1 SFX_Snare8_1:: - db CH7 - dw SFX_Snare8_1_Ch1 + dbw CH7, SFX_Snare8_1_Ch1 SFX_Snare9_1:: - db CH7 - dw SFX_Snare9_1_Ch1 + dbw CH7, SFX_Snare9_1_Ch1 SFX_Cymbal1_1:: - db CH7 - dw SFX_Cymbal1_1_Ch1 + dbw CH7, SFX_Cymbal1_1_Ch1 SFX_Cymbal2_1:: - db CH7 - dw SFX_Cymbal2_1_Ch1 + dbw CH7, SFX_Cymbal2_1_Ch1 SFX_Cymbal3_1:: - db CH7 - dw SFX_Cymbal3_1_Ch1 + dbw CH7, SFX_Cymbal3_1_Ch1 SFX_Muted_Snare1_1:: - db CH7 - dw SFX_Muted_Snare1_1_Ch1 + dbw CH7, SFX_Muted_Snare1_1_Ch1 SFX_Triangle3_1:: - db CH7 - dw SFX_Triangle3_1_Ch1 + dbw CH7, SFX_Triangle3_1_Ch1 SFX_Muted_Snare2_1:: - db CH7 - dw SFX_Muted_Snare2_1_Ch1 + dbw CH7, SFX_Muted_Snare2_1_Ch1 SFX_Muted_Snare3_1:: - db CH7 - dw SFX_Muted_Snare3_1_Ch1 + dbw CH7, SFX_Muted_Snare3_1_Ch1 SFX_Muted_Snare4_1:: - db CH7 - dw SFX_Muted_Snare4_1_Ch1 + dbw CH7, SFX_Muted_Snare4_1_Ch1 SFX_Cry00_1:: - db ( $80 | CH4 ) - dw SFX_Cry00_1_Ch1 - db CH5 - dw SFX_Cry00_1_Ch2 - db CH7 - dw SFX_Cry00_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry00_1_Ch1 + dbw CH5, SFX_Cry00_1_Ch2 + dbw CH7, SFX_Cry00_1_Ch3 SFX_Cry01_1:: - db ( $80 | CH4 ) - dw SFX_Cry01_1_Ch1 - db CH5 - dw SFX_Cry01_1_Ch2 - db CH7 - dw SFX_Cry01_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry01_1_Ch1 + dbw CH5, SFX_Cry01_1_Ch2 + dbw CH7, SFX_Cry01_1_Ch3 SFX_Cry02_1:: - db ( $80 | CH4 ) - dw SFX_Cry02_1_Ch1 - db CH5 - dw SFX_Cry02_1_Ch2 - db CH7 - dw SFX_Cry02_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry02_1_Ch1 + dbw CH5, SFX_Cry02_1_Ch2 + dbw CH7, SFX_Cry02_1_Ch3 SFX_Cry03_1:: - db ( $80 | CH4 ) - dw SFX_Cry03_1_Ch1 - db CH5 - dw SFX_Cry03_1_Ch2 - db CH7 - dw SFX_Cry03_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry03_1_Ch1 + dbw CH5, SFX_Cry03_1_Ch2 + dbw CH7, SFX_Cry03_1_Ch3 SFX_Cry04_1:: - db ( $80 | CH4 ) - dw SFX_Cry04_1_Ch1 - db CH5 - dw SFX_Cry04_1_Ch2 - db CH7 - dw SFX_Cry04_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry04_1_Ch1 + dbw CH5, SFX_Cry04_1_Ch2 + dbw CH7, SFX_Cry04_1_Ch3 SFX_Cry05_1:: - db ( $80 | CH4 ) - dw SFX_Cry05_1_Ch1 - db CH5 - dw SFX_Cry05_1_Ch2 - db CH7 - dw SFX_Cry05_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry05_1_Ch1 + dbw CH5, SFX_Cry05_1_Ch2 + dbw CH7, SFX_Cry05_1_Ch3 SFX_Cry06_1:: - db ( $80 | CH4 ) - dw SFX_Cry06_1_Ch1 - db CH5 - dw SFX_Cry06_1_Ch2 - db CH7 - dw SFX_Cry06_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry06_1_Ch1 + dbw CH5, SFX_Cry06_1_Ch2 + dbw CH7, SFX_Cry06_1_Ch3 SFX_Cry07_1:: - db ( $80 | CH4 ) - dw SFX_Cry07_1_Ch1 - db CH5 - dw SFX_Cry07_1_Ch2 - db CH7 - dw SFX_Cry07_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry07_1_Ch1 + dbw CH5, SFX_Cry07_1_Ch2 + dbw CH7, SFX_Cry07_1_Ch3 SFX_Cry08_1:: - db ( $80 | CH4 ) - dw SFX_Cry08_1_Ch1 - db CH5 - dw SFX_Cry08_1_Ch2 - db CH7 - dw SFX_Cry08_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry08_1_Ch1 + dbw CH5, SFX_Cry08_1_Ch2 + dbw CH7, SFX_Cry08_1_Ch3 SFX_Cry09_1:: - db ( $80 | CH4 ) - dw SFX_Cry09_1_Ch1 - db CH5 - dw SFX_Cry09_1_Ch2 - db CH7 - dw SFX_Cry09_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry09_1_Ch1 + dbw CH5, SFX_Cry09_1_Ch2 + dbw CH7, SFX_Cry09_1_Ch3 SFX_Cry0A_1:: - db ( $80 | CH4 ) - dw SFX_Cry0A_1_Ch1 - db CH5 - dw SFX_Cry0A_1_Ch2 - db CH7 - dw SFX_Cry0A_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry0A_1_Ch1 + dbw CH5, SFX_Cry0A_1_Ch2 + dbw CH7, SFX_Cry0A_1_Ch3 SFX_Cry0B_1:: - db ( $80 | CH4 ) - dw SFX_Cry0B_1_Ch1 - db CH5 - dw SFX_Cry0B_1_Ch2 - db CH7 - dw SFX_Cry0B_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry0B_1_Ch1 + dbw CH5, SFX_Cry0B_1_Ch2 + dbw CH7, SFX_Cry0B_1_Ch3 SFX_Cry0C_1:: - db ( $80 | CH4 ) - dw SFX_Cry0C_1_Ch1 - db CH5 - dw SFX_Cry0C_1_Ch2 - db CH7 - dw SFX_Cry0C_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry0C_1_Ch1 + dbw CH5, SFX_Cry0C_1_Ch2 + dbw CH7, SFX_Cry0C_1_Ch3 SFX_Cry0D_1:: - db ( $80 | CH4 ) - dw SFX_Cry0D_1_Ch1 - db CH5 - dw SFX_Cry0D_1_Ch2 - db CH7 - dw SFX_Cry0D_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry0D_1_Ch1 + dbw CH5, SFX_Cry0D_1_Ch2 + dbw CH7, SFX_Cry0D_1_Ch3 SFX_Cry0E_1:: - db ( $80 | CH4 ) - dw SFX_Cry0E_1_Ch1 - db CH5 - dw SFX_Cry0E_1_Ch2 - db CH7 - dw SFX_Cry0E_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry0E_1_Ch1 + dbw CH5, SFX_Cry0E_1_Ch2 + dbw CH7, SFX_Cry0E_1_Ch3 SFX_Cry0F_1:: - db ( $80 | CH4 ) - dw SFX_Cry0F_1_Ch1 - db CH5 - dw SFX_Cry0F_1_Ch2 - db CH7 - dw SFX_Cry0F_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry0F_1_Ch1 + dbw CH5, SFX_Cry0F_1_Ch2 + dbw CH7, SFX_Cry0F_1_Ch3 SFX_Cry10_1:: - db ( $80 | CH4 ) - dw SFX_Cry10_1_Ch1 - db CH5 - dw SFX_Cry10_1_Ch2 - db CH7 - dw SFX_Cry10_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry10_1_Ch1 + dbw CH5, SFX_Cry10_1_Ch2 + dbw CH7, SFX_Cry10_1_Ch3 SFX_Cry11_1:: - db ( $80 | CH4 ) - dw SFX_Cry11_1_Ch1 - db CH5 - dw SFX_Cry11_1_Ch2 - db CH7 - dw SFX_Cry11_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry11_1_Ch1 + dbw CH5, SFX_Cry11_1_Ch2 + dbw CH7, SFX_Cry11_1_Ch3 SFX_Cry12_1:: - db ( $80 | CH4 ) - dw SFX_Cry12_1_Ch1 - db CH5 - dw SFX_Cry12_1_Ch2 - db CH7 - dw SFX_Cry12_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry12_1_Ch1 + dbw CH5, SFX_Cry12_1_Ch2 + dbw CH7, SFX_Cry12_1_Ch3 SFX_Cry13_1:: - db ( $80 | CH4 ) - dw SFX_Cry13_1_Ch1 - db CH5 - dw SFX_Cry13_1_Ch2 - db CH7 - dw SFX_Cry13_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry13_1_Ch1 + dbw CH5, SFX_Cry13_1_Ch2 + dbw CH7, SFX_Cry13_1_Ch3 SFX_Cry14_1:: - db ( $80 | CH4 ) - dw SFX_Cry14_1_Ch1 - db CH5 - dw SFX_Cry14_1_Ch2 - db CH7 - dw SFX_Cry14_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry14_1_Ch1 + dbw CH5, SFX_Cry14_1_Ch2 + dbw CH7, SFX_Cry14_1_Ch3 SFX_Cry15_1:: - db ( $80 | CH4 ) - dw SFX_Cry15_1_Ch1 - db CH5 - dw SFX_Cry15_1_Ch2 - db CH7 - dw SFX_Cry15_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry15_1_Ch1 + dbw CH5, SFX_Cry15_1_Ch2 + dbw CH7, SFX_Cry15_1_Ch3 SFX_Cry16_1:: - db ( $80 | CH4 ) - dw SFX_Cry16_1_Ch1 - db CH5 - dw SFX_Cry16_1_Ch2 - db CH7 - dw SFX_Cry16_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry16_1_Ch1 + dbw CH5, SFX_Cry16_1_Ch2 + dbw CH7, SFX_Cry16_1_Ch3 SFX_Cry17_1:: - db ( $80 | CH4 ) - dw SFX_Cry17_1_Ch1 - db CH5 - dw SFX_Cry17_1_Ch2 - db CH7 - dw SFX_Cry17_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry17_1_Ch1 + dbw CH5, SFX_Cry17_1_Ch2 + dbw CH7, SFX_Cry17_1_Ch3 SFX_Cry18_1:: - db ( $80 | CH4 ) - dw SFX_Cry18_1_Ch1 - db CH5 - dw SFX_Cry18_1_Ch2 - db CH7 - dw SFX_Cry18_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry18_1_Ch1 + dbw CH5, SFX_Cry18_1_Ch2 + dbw CH7, SFX_Cry18_1_Ch3 SFX_Cry19_1:: - db ( $80 | CH4 ) - dw SFX_Cry19_1_Ch1 - db CH5 - dw SFX_Cry19_1_Ch2 - db CH7 - dw SFX_Cry19_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry19_1_Ch1 + dbw CH5, SFX_Cry19_1_Ch2 + dbw CH7, SFX_Cry19_1_Ch3 SFX_Cry1A_1:: - db ( $80 | CH4 ) - dw SFX_Cry1A_1_Ch1 - db CH5 - dw SFX_Cry1A_1_Ch2 - db CH7 - dw SFX_Cry1A_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry1A_1_Ch1 + dbw CH5, SFX_Cry1A_1_Ch2 + dbw CH7, SFX_Cry1A_1_Ch3 SFX_Cry1B_1:: - db ( $80 | CH4 ) - dw SFX_Cry1B_1_Ch1 - db CH5 - dw SFX_Cry1B_1_Ch2 - db CH7 - dw SFX_Cry1B_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry1B_1_Ch1 + dbw CH5, SFX_Cry1B_1_Ch2 + dbw CH7, SFX_Cry1B_1_Ch3 SFX_Cry1C_1:: - db ( $80 | CH4 ) - dw SFX_Cry1C_1_Ch1 - db CH5 - dw SFX_Cry1C_1_Ch2 - db CH7 - dw SFX_Cry1C_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry1C_1_Ch1 + dbw CH5, SFX_Cry1C_1_Ch2 + dbw CH7, SFX_Cry1C_1_Ch3 SFX_Cry1D_1:: - db ( $80 | CH4 ) - dw SFX_Cry1D_1_Ch1 - db CH5 - dw SFX_Cry1D_1_Ch2 - db CH7 - dw SFX_Cry1D_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry1D_1_Ch1 + dbw CH5, SFX_Cry1D_1_Ch2 + dbw CH7, SFX_Cry1D_1_Ch3 SFX_Cry1E_1:: - db ( $80 | CH4 ) - dw SFX_Cry1E_1_Ch1 - db CH5 - dw SFX_Cry1E_1_Ch2 - db CH7 - dw SFX_Cry1E_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry1E_1_Ch1 + dbw CH5, SFX_Cry1E_1_Ch2 + dbw CH7, SFX_Cry1E_1_Ch3 SFX_Cry1F_1:: - db ( $80 | CH4 ) - dw SFX_Cry1F_1_Ch1 - db CH5 - dw SFX_Cry1F_1_Ch2 - db CH7 - dw SFX_Cry1F_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry1F_1_Ch1 + dbw CH5, SFX_Cry1F_1_Ch2 + dbw CH7, SFX_Cry1F_1_Ch3 SFX_Cry20_1:: - db ( $80 | CH4 ) - dw SFX_Cry20_1_Ch1 - db CH5 - dw SFX_Cry20_1_Ch2 - db CH7 - dw SFX_Cry20_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry20_1_Ch1 + dbw CH5, SFX_Cry20_1_Ch2 + dbw CH7, SFX_Cry20_1_Ch3 SFX_Cry21_1:: - db ( $80 | CH4 ) - dw SFX_Cry21_1_Ch1 - db CH5 - dw SFX_Cry21_1_Ch2 - db CH7 - dw SFX_Cry21_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry21_1_Ch1 + dbw CH5, SFX_Cry21_1_Ch2 + dbw CH7, SFX_Cry21_1_Ch3 SFX_Cry22_1:: - db ( $80 | CH4 ) - dw SFX_Cry22_1_Ch1 - db CH5 - dw SFX_Cry22_1_Ch2 - db CH7 - dw SFX_Cry22_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry22_1_Ch1 + dbw CH5, SFX_Cry22_1_Ch2 + dbw CH7, SFX_Cry22_1_Ch3 SFX_Cry23_1:: - db ( $80 | CH4 ) - dw SFX_Cry23_1_Ch1 - db CH5 - dw SFX_Cry23_1_Ch2 - db CH7 - dw SFX_Cry23_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry23_1_Ch1 + dbw CH5, SFX_Cry23_1_Ch2 + dbw CH7, SFX_Cry23_1_Ch3 SFX_Cry24_1:: - db ( $80 | CH4 ) - dw SFX_Cry24_1_Ch1 - db CH5 - dw SFX_Cry24_1_Ch2 - db CH7 - dw SFX_Cry24_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry24_1_Ch1 + dbw CH5, SFX_Cry24_1_Ch2 + dbw CH7, SFX_Cry24_1_Ch3 SFX_Cry25_1:: - db ( $80 | CH4 ) - dw SFX_Cry25_1_Ch1 - db CH5 - dw SFX_Cry25_1_Ch2 - db CH7 - dw SFX_Cry25_1_Ch3 + dbw ( $80 | CH4 ), SFX_Cry25_1_Ch1 + dbw CH5, SFX_Cry25_1_Ch2 + dbw CH7, SFX_Cry25_1_Ch3 SFX_Get_Item1_1:: - db ( $80 | CH4 ) - dw SFX_Get_Item1_1_Ch1 - db CH5 - dw SFX_Get_Item1_1_Ch2 - db CH6 - dw SFX_Get_Item1_1_Ch3 + dbw ( $80 | CH4 ), SFX_Get_Item1_1_Ch1 + dbw CH5, SFX_Get_Item1_1_Ch2 + dbw CH6, SFX_Get_Item1_1_Ch3 SFX_Get_Item2_1:: - db ( $80 | CH4 ) - dw SFX_Get_Item2_1_Ch1 - db CH5 - dw SFX_Get_Item2_1_Ch2 - db CH6 - dw SFX_Get_Item2_1_Ch3 + dbw ( $80 | CH4 ), SFX_Get_Item2_1_Ch1 + dbw CH5, SFX_Get_Item2_1_Ch2 + dbw CH6, SFX_Get_Item2_1_Ch3 SFX_Tink_1:: - db CH4 - dw SFX_Tink_1_Ch1 + dbw CH4, SFX_Tink_1_Ch1 SFX_Heal_HP_1:: - db CH4 - dw SFX_Heal_HP_1_Ch1 + dbw CH4, SFX_Heal_HP_1_Ch1 SFX_Heal_Ailment_1:: - db CH4 - dw SFX_Heal_Ailment_1_Ch1 + dbw CH4, SFX_Heal_Ailment_1_Ch1 SFX_Start_Menu_1:: - db CH7 - dw SFX_Start_Menu_1_Ch1 + dbw CH7, SFX_Start_Menu_1_Ch1 SFX_Press_AB_1:: - db CH4 - dw SFX_Press_AB_1_Ch1 + dbw CH4, SFX_Press_AB_1_Ch1 SFX_Pokedex_Rating_1:: - db ( $80 | CH4 ) - dw SFX_Pokedex_Rating_1_Ch1 - db CH5 - dw SFX_Pokedex_Rating_1_Ch2 - db CH6 - dw SFX_Pokedex_Rating_1_Ch3 + dbw ( $80 | CH4 ), SFX_Pokedex_Rating_1_Ch1 + dbw CH5, SFX_Pokedex_Rating_1_Ch2 + dbw CH6, SFX_Pokedex_Rating_1_Ch3 SFX_Get_Key_Item_1:: - db ( $80 | CH4 ) - dw SFX_Get_Key_Item_1_Ch1 - db CH5 - dw SFX_Get_Key_Item_1_Ch2 - db CH6 - dw SFX_Get_Key_Item_1_Ch3 + dbw ( $80 | CH4 ), SFX_Get_Key_Item_1_Ch1 + dbw CH5, SFX_Get_Key_Item_1_Ch2 + dbw CH6, SFX_Get_Key_Item_1_Ch3 SFX_Poisoned_1:: - db CH4 - dw SFX_Poisoned_1_Ch1 + dbw CH4, SFX_Poisoned_1_Ch1 SFX_Trade_Machine_1:: - db CH4 - dw SFX_Trade_Machine_1_Ch1 + dbw CH4, SFX_Trade_Machine_1_Ch1 SFX_Turn_On_PC_1:: - db CH4 - dw SFX_Turn_On_PC_1_Ch1 + dbw CH4, SFX_Turn_On_PC_1_Ch1 SFX_Turn_Off_PC_1:: - db CH4 - dw SFX_Turn_Off_PC_1_Ch1 + dbw CH4, SFX_Turn_Off_PC_1_Ch1 SFX_Enter_PC_1:: - db CH4 - dw SFX_Enter_PC_1_Ch1 + dbw CH4, SFX_Enter_PC_1_Ch1 SFX_Shrink_1:: - db CH4 - dw SFX_Shrink_1_Ch1 + dbw CH4, SFX_Shrink_1_Ch1 SFX_Switch_1:: - db CH4 - dw SFX_Switch_1_Ch1 + dbw CH4, SFX_Switch_1_Ch1 SFX_Healing_Machine_1:: - db CH4 - dw SFX_Healing_Machine_1_Ch1 + dbw CH4, SFX_Healing_Machine_1_Ch1 SFX_Teleport_Exit1_1:: - db CH4 - dw SFX_Teleport_Exit1_1_Ch1 + dbw CH4, SFX_Teleport_Exit1_1_Ch1 SFX_Teleport_Enter1_1:: - db CH4 - dw SFX_Teleport_Enter1_1_Ch1 + dbw CH4, SFX_Teleport_Enter1_1_Ch1 SFX_Teleport_Exit2_1:: - db CH4 - dw SFX_Teleport_Exit2_1_Ch1 + dbw CH4, SFX_Teleport_Exit2_1_Ch1 SFX_Ledge_1:: - db CH4 - dw SFX_Ledge_1_Ch1 + dbw CH4, SFX_Ledge_1_Ch1 SFX_Teleport_Enter2_1:: - db CH7 - dw SFX_Teleport_Enter2_1_Ch1 + dbw CH7, SFX_Teleport_Enter2_1_Ch1 SFX_Fly_1:: - db CH7 - dw SFX_Fly_1_Ch1 + dbw CH7, SFX_Fly_1_Ch1 SFX_Denied_1:: - db ( $40 | CH4 ) - dw SFX_Denied_1_Ch1 - db CH5 - dw SFX_Denied_1_Ch2 + dbw ( $40 | CH4 ), SFX_Denied_1_Ch1 + dbw CH5, SFX_Denied_1_Ch2 SFX_Arrow_Tiles_1:: - db CH4 - dw SFX_Arrow_Tiles_1_Ch1 + dbw CH4, SFX_Arrow_Tiles_1_Ch1 SFX_Push_Boulder_1:: - db CH7 - dw SFX_Push_Boulder_1_Ch1 + dbw CH7, SFX_Push_Boulder_1_Ch1 SFX_SS_Anne_Horn_1:: - db ( $40 | CH4 ) - dw SFX_SS_Anne_Horn_1_Ch1 - db CH5 - dw SFX_SS_Anne_Horn_1_Ch2 + dbw ( $40 | CH4 ), SFX_SS_Anne_Horn_1_Ch1 + dbw CH5, SFX_SS_Anne_Horn_1_Ch2 SFX_Withdraw_Deposit_1:: - db CH4 - dw SFX_Withdraw_Deposit_1_Ch1 + dbw CH4, SFX_Withdraw_Deposit_1_Ch1 SFX_Cut_1:: - db CH7 - dw SFX_Cut_1_Ch1 + dbw CH7, SFX_Cut_1_Ch1 SFX_Go_Inside_1:: - db CH7 - dw SFX_Go_Inside_1_Ch1 + dbw CH7, SFX_Go_Inside_1_Ch1 SFX_Swap_1:: - db ( $40 | CH4 ) - dw SFX_Swap_1_Ch1 - db CH5 - dw SFX_Swap_1_Ch2 + dbw ( $40 | CH4 ), SFX_Swap_1_Ch1 + dbw CH5, SFX_Swap_1_Ch2 SFX_59_1:: - db ( $40 | CH4 ) - dw SFX_59_1_Ch1 - db CH5 - dw SFX_59_1_Ch2 + dbw ( $40 | CH4 ), SFX_59_1_Ch1 + dbw CH5, SFX_59_1_Ch2 SFX_Purchase_1:: - db ( $40 | CH4 ) - dw SFX_Purchase_1_Ch1 - db CH5 - dw SFX_Purchase_1_Ch2 + dbw ( $40 | CH4 ), SFX_Purchase_1_Ch1 + dbw CH5, SFX_Purchase_1_Ch2 SFX_Collision_1:: - db CH4 - dw SFX_Collision_1_Ch1 + dbw CH4, SFX_Collision_1_Ch1 SFX_Go_Outside_1:: - db CH7 - dw SFX_Go_Outside_1_Ch1 + dbw CH7, SFX_Go_Outside_1_Ch1 SFX_Save_1:: - db ( $40 | CH4 ) - dw SFX_Save_1_Ch1 - db CH5 - dw SFX_Save_1_Ch2 + dbw ( $40 | CH4 ), SFX_Save_1_Ch1 + dbw CH5, SFX_Save_1_Ch2 SFX_Pokeflute:: - db CH2 - dw SFX_Pokeflute_Ch1 + dbw CH2, SFX_Pokeflute_Ch1 SFX_Safari_Zone_PA:: - db CH4 - dw SFX_Safari_Zone_PA_Ch1 + dbw CH4, SFX_Safari_Zone_PA_Ch1 diff --git a/audio/headers/sfxheaders2.asm b/audio/headers/sfxheaders2.asm index 1b6f8a5c..2f517d10 100644 --- a/audio/headers/sfxheaders2.asm +++ b/audio/headers/sfxheaders2.asm @@ -1,706 +1,473 @@ SFX_Headers_2:: - db $ff, $ff, $ff ; padding + dbw -1, -1 ; padding SFX_Snare1_2:: - db CH7 - dw SFX_Snare1_2_Ch1 + dbw CH7, SFX_Snare1_2_Ch1 SFX_Snare2_2:: - db CH7 - dw SFX_Snare2_2_Ch1 + dbw CH7, SFX_Snare2_2_Ch1 SFX_Snare3_2:: - db CH7 - dw SFX_Snare3_2_Ch1 + dbw CH7, SFX_Snare3_2_Ch1 SFX_Snare4_2:: - db CH7 - dw SFX_Snare4_2_Ch1 + dbw CH7, SFX_Snare4_2_Ch1 SFX_Snare5_2:: - db CH7 - dw SFX_Snare5_2_Ch1 + dbw CH7, SFX_Snare5_2_Ch1 SFX_Triangle1_2:: - db CH7 - dw SFX_Triangle1_2_Ch1 + dbw CH7, SFX_Triangle1_2_Ch1 SFX_Triangle2_2:: - db CH7 - dw SFX_Triangle2_2_Ch1 + dbw CH7, SFX_Triangle2_2_Ch1 SFX_Snare6_2:: - db CH7 - dw SFX_Snare6_2_Ch1 + dbw CH7, SFX_Snare6_2_Ch1 SFX_Snare7_2:: - db CH7 - dw SFX_Snare7_2_Ch1 + dbw CH7, SFX_Snare7_2_Ch1 SFX_Snare8_2:: - db CH7 - dw SFX_Snare8_2_Ch1 + dbw CH7, SFX_Snare8_2_Ch1 SFX_Snare9_2:: - db CH7 - dw SFX_Snare9_2_Ch1 + dbw CH7, SFX_Snare9_2_Ch1 SFX_Cymbal1_2:: - db CH7 - dw SFX_Cymbal1_2_Ch1 + dbw CH7, SFX_Cymbal1_2_Ch1 SFX_Cymbal2_2:: - db CH7 - dw SFX_Cymbal2_2_Ch1 + dbw CH7, SFX_Cymbal2_2_Ch1 SFX_Cymbal3_2:: - db CH7 - dw SFX_Cymbal3_2_Ch1 + dbw CH7, SFX_Cymbal3_2_Ch1 SFX_Muted_Snare1_2:: - db CH7 - dw SFX_Muted_Snare1_2_Ch1 + dbw CH7, SFX_Muted_Snare1_2_Ch1 SFX_Triangle3_2:: - db CH7 - dw SFX_Triangle3_2_Ch1 + dbw CH7, SFX_Triangle3_2_Ch1 SFX_Muted_Snare2_2:: - db CH7 - dw SFX_Muted_Snare2_2_Ch1 + dbw CH7, SFX_Muted_Snare2_2_Ch1 SFX_Muted_Snare3_2:: - db CH7 - dw SFX_Muted_Snare3_2_Ch1 + dbw CH7, SFX_Muted_Snare3_2_Ch1 SFX_Muted_Snare4_2:: - db CH7 - dw SFX_Muted_Snare4_2_Ch1 + dbw CH7, SFX_Muted_Snare4_2_Ch1 SFX_Cry00_2:: - db ( $80 | CH4 ) - dw SFX_Cry00_2_Ch1 - db CH5 - dw SFX_Cry00_2_Ch2 - db CH7 - dw SFX_Cry00_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry00_2_Ch1 + dbw CH5, SFX_Cry00_2_Ch2 + dbw CH7, SFX_Cry00_2_Ch3 SFX_Cry01_2:: - db ( $80 | CH4 ) - dw SFX_Cry01_2_Ch1 - db CH5 - dw SFX_Cry01_2_Ch2 - db CH7 - dw SFX_Cry01_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry01_2_Ch1 + dbw CH5, SFX_Cry01_2_Ch2 + dbw CH7, SFX_Cry01_2_Ch3 SFX_Cry02_2:: - db ( $80 | CH4 ) - dw SFX_Cry02_2_Ch1 - db CH5 - dw SFX_Cry02_2_Ch2 - db CH7 - dw SFX_Cry02_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry02_2_Ch1 + dbw CH5, SFX_Cry02_2_Ch2 + dbw CH7, SFX_Cry02_2_Ch3 SFX_Cry03_2:: - db ( $80 | CH4 ) - dw SFX_Cry03_2_Ch1 - db CH5 - dw SFX_Cry03_2_Ch2 - db CH7 - dw SFX_Cry03_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry03_2_Ch1 + dbw CH5, SFX_Cry03_2_Ch2 + dbw CH7, SFX_Cry03_2_Ch3 SFX_Cry04_2:: - db ( $80 | CH4 ) - dw SFX_Cry04_2_Ch1 - db CH5 - dw SFX_Cry04_2_Ch2 - db CH7 - dw SFX_Cry04_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry04_2_Ch1 + dbw CH5, SFX_Cry04_2_Ch2 + dbw CH7, SFX_Cry04_2_Ch3 SFX_Cry05_2:: - db ( $80 | CH4 ) - dw SFX_Cry05_2_Ch1 - db CH5 - dw SFX_Cry05_2_Ch2 - db CH7 - dw SFX_Cry05_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry05_2_Ch1 + dbw CH5, SFX_Cry05_2_Ch2 + dbw CH7, SFX_Cry05_2_Ch3 SFX_Cry06_2:: - db ( $80 | CH4 ) - dw SFX_Cry06_2_Ch1 - db CH5 - dw SFX_Cry06_2_Ch2 - db CH7 - dw SFX_Cry06_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry06_2_Ch1 + dbw CH5, SFX_Cry06_2_Ch2 + dbw CH7, SFX_Cry06_2_Ch3 SFX_Cry07_2:: - db ( $80 | CH4 ) - dw SFX_Cry07_2_Ch1 - db CH5 - dw SFX_Cry07_2_Ch2 - db CH7 - dw SFX_Cry07_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry07_2_Ch1 + dbw CH5, SFX_Cry07_2_Ch2 + dbw CH7, SFX_Cry07_2_Ch3 SFX_Cry08_2:: - db ( $80 | CH4 ) - dw SFX_Cry08_2_Ch1 - db CH5 - dw SFX_Cry08_2_Ch2 - db CH7 - dw SFX_Cry08_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry08_2_Ch1 + dbw CH5, SFX_Cry08_2_Ch2 + dbw CH7, SFX_Cry08_2_Ch3 SFX_Cry09_2:: - db ( $80 | CH4 ) - dw SFX_Cry09_2_Ch1 - db CH5 - dw SFX_Cry09_2_Ch2 - db CH7 - dw SFX_Cry09_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry09_2_Ch1 + dbw CH5, SFX_Cry09_2_Ch2 + dbw CH7, SFX_Cry09_2_Ch3 SFX_Cry0A_2:: - db ( $80 | CH4 ) - dw SFX_Cry0A_2_Ch1 - db CH5 - dw SFX_Cry0A_2_Ch2 - db CH7 - dw SFX_Cry0A_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry0A_2_Ch1 + dbw CH5, SFX_Cry0A_2_Ch2 + dbw CH7, SFX_Cry0A_2_Ch3 SFX_Cry0B_2:: - db ( $80 | CH4 ) - dw SFX_Cry0B_2_Ch1 - db CH5 - dw SFX_Cry0B_2_Ch2 - db CH7 - dw SFX_Cry0B_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry0B_2_Ch1 + dbw CH5, SFX_Cry0B_2_Ch2 + dbw CH7, SFX_Cry0B_2_Ch3 SFX_Cry0C_2:: - db ( $80 | CH4 ) - dw SFX_Cry0C_2_Ch1 - db CH5 - dw SFX_Cry0C_2_Ch2 - db CH7 - dw SFX_Cry0C_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry0C_2_Ch1 + dbw CH5, SFX_Cry0C_2_Ch2 + dbw CH7, SFX_Cry0C_2_Ch3 SFX_Cry0D_2:: - db ( $80 | CH4 ) - dw SFX_Cry0D_2_Ch1 - db CH5 - dw SFX_Cry0D_2_Ch2 - db CH7 - dw SFX_Cry0D_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry0D_2_Ch1 + dbw CH5, SFX_Cry0D_2_Ch2 + dbw CH7, SFX_Cry0D_2_Ch3 SFX_Cry0E_2:: - db ( $80 | CH4 ) - dw SFX_Cry0E_2_Ch1 - db CH5 - dw SFX_Cry0E_2_Ch2 - db CH7 - dw SFX_Cry0E_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry0E_2_Ch1 + dbw CH5, SFX_Cry0E_2_Ch2 + dbw CH7, SFX_Cry0E_2_Ch3 SFX_Cry0F_2:: - db ( $80 | CH4 ) - dw SFX_Cry0F_2_Ch1 - db CH5 - dw SFX_Cry0F_2_Ch2 - db CH7 - dw SFX_Cry0F_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry0F_2_Ch1 + dbw CH5, SFX_Cry0F_2_Ch2 + dbw CH7, SFX_Cry0F_2_Ch3 SFX_Cry10_2:: - db ( $80 | CH4 ) - dw SFX_Cry10_2_Ch1 - db CH5 - dw SFX_Cry10_2_Ch2 - db CH7 - dw SFX_Cry10_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry10_2_Ch1 + dbw CH5, SFX_Cry10_2_Ch2 + dbw CH7, SFX_Cry10_2_Ch3 SFX_Cry11_2:: - db ( $80 | CH4 ) - dw SFX_Cry11_2_Ch1 - db CH5 - dw SFX_Cry11_2_Ch2 - db CH7 - dw SFX_Cry11_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry11_2_Ch1 + dbw CH5, SFX_Cry11_2_Ch2 + dbw CH7, SFX_Cry11_2_Ch3 SFX_Cry12_2:: - db ( $80 | CH4 ) - dw SFX_Cry12_2_Ch1 - db CH5 - dw SFX_Cry12_2_Ch2 - db CH7 - dw SFX_Cry12_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry12_2_Ch1 + dbw CH5, SFX_Cry12_2_Ch2 + dbw CH7, SFX_Cry12_2_Ch3 SFX_Cry13_2:: - db ( $80 | CH4 ) - dw SFX_Cry13_2_Ch1 - db CH5 - dw SFX_Cry13_2_Ch2 - db CH7 - dw SFX_Cry13_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry13_2_Ch1 + dbw CH5, SFX_Cry13_2_Ch2 + dbw CH7, SFX_Cry13_2_Ch3 SFX_Cry14_2:: - db ( $80 | CH4 ) - dw SFX_Cry14_2_Ch1 - db CH5 - dw SFX_Cry14_2_Ch2 - db CH7 - dw SFX_Cry14_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry14_2_Ch1 + dbw CH5, SFX_Cry14_2_Ch2 + dbw CH7, SFX_Cry14_2_Ch3 SFX_Cry15_2:: - db ( $80 | CH4 ) - dw SFX_Cry15_2_Ch1 - db CH5 - dw SFX_Cry15_2_Ch2 - db CH7 - dw SFX_Cry15_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry15_2_Ch1 + dbw CH5, SFX_Cry15_2_Ch2 + dbw CH7, SFX_Cry15_2_Ch3 SFX_Cry16_2:: - db ( $80 | CH4 ) - dw SFX_Cry16_2_Ch1 - db CH5 - dw SFX_Cry16_2_Ch2 - db CH7 - dw SFX_Cry16_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry16_2_Ch1 + dbw CH5, SFX_Cry16_2_Ch2 + dbw CH7, SFX_Cry16_2_Ch3 SFX_Cry17_2:: - db ( $80 | CH4 ) - dw SFX_Cry17_2_Ch1 - db CH5 - dw SFX_Cry17_2_Ch2 - db CH7 - dw SFX_Cry17_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry17_2_Ch1 + dbw CH5, SFX_Cry17_2_Ch2 + dbw CH7, SFX_Cry17_2_Ch3 SFX_Cry18_2:: - db ( $80 | CH4 ) - dw SFX_Cry18_2_Ch1 - db CH5 - dw SFX_Cry18_2_Ch2 - db CH7 - dw SFX_Cry18_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry18_2_Ch1 + dbw CH5, SFX_Cry18_2_Ch2 + dbw CH7, SFX_Cry18_2_Ch3 SFX_Cry19_2:: - db ( $80 | CH4 ) - dw SFX_Cry19_2_Ch1 - db CH5 - dw SFX_Cry19_2_Ch2 - db CH7 - dw SFX_Cry19_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry19_2_Ch1 + dbw CH5, SFX_Cry19_2_Ch2 + dbw CH7, SFX_Cry19_2_Ch3 SFX_Cry1A_2:: - db ( $80 | CH4 ) - dw SFX_Cry1A_2_Ch1 - db CH5 - dw SFX_Cry1A_2_Ch2 - db CH7 - dw SFX_Cry1A_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry1A_2_Ch1 + dbw CH5, SFX_Cry1A_2_Ch2 + dbw CH7, SFX_Cry1A_2_Ch3 SFX_Cry1B_2:: - db ( $80 | CH4 ) - dw SFX_Cry1B_2_Ch1 - db CH5 - dw SFX_Cry1B_2_Ch2 - db CH7 - dw SFX_Cry1B_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry1B_2_Ch1 + dbw CH5, SFX_Cry1B_2_Ch2 + dbw CH7, SFX_Cry1B_2_Ch3 SFX_Cry1C_2:: - db ( $80 | CH4 ) - dw SFX_Cry1C_2_Ch1 - db CH5 - dw SFX_Cry1C_2_Ch2 - db CH7 - dw SFX_Cry1C_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry1C_2_Ch1 + dbw CH5, SFX_Cry1C_2_Ch2 + dbw CH7, SFX_Cry1C_2_Ch3 SFX_Cry1D_2:: - db ( $80 | CH4 ) - dw SFX_Cry1D_2_Ch1 - db CH5 - dw SFX_Cry1D_2_Ch2 - db CH7 - dw SFX_Cry1D_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry1D_2_Ch1 + dbw CH5, SFX_Cry1D_2_Ch2 + dbw CH7, SFX_Cry1D_2_Ch3 SFX_Cry1E_2:: - db ( $80 | CH4 ) - dw SFX_Cry1E_2_Ch1 - db CH5 - dw SFX_Cry1E_2_Ch2 - db CH7 - dw SFX_Cry1E_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry1E_2_Ch1 + dbw CH5, SFX_Cry1E_2_Ch2 + dbw CH7, SFX_Cry1E_2_Ch3 SFX_Cry1F_2:: - db ( $80 | CH4 ) - dw SFX_Cry1F_2_Ch1 - db CH5 - dw SFX_Cry1F_2_Ch2 - db CH7 - dw SFX_Cry1F_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry1F_2_Ch1 + dbw CH5, SFX_Cry1F_2_Ch2 + dbw CH7, SFX_Cry1F_2_Ch3 SFX_Cry20_2:: - db ( $80 | CH4 ) - dw SFX_Cry20_2_Ch1 - db CH5 - dw SFX_Cry20_2_Ch2 - db CH7 - dw SFX_Cry20_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry20_2_Ch1 + dbw CH5, SFX_Cry20_2_Ch2 + dbw CH7, SFX_Cry20_2_Ch3 SFX_Cry21_2:: - db ( $80 | CH4 ) - dw SFX_Cry21_2_Ch1 - db CH5 - dw SFX_Cry21_2_Ch2 - db CH7 - dw SFX_Cry21_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry21_2_Ch1 + dbw CH5, SFX_Cry21_2_Ch2 + dbw CH7, SFX_Cry21_2_Ch3 SFX_Cry22_2:: - db ( $80 | CH4 ) - dw SFX_Cry22_2_Ch1 - db CH5 - dw SFX_Cry22_2_Ch2 - db CH7 - dw SFX_Cry22_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry22_2_Ch1 + dbw CH5, SFX_Cry22_2_Ch2 + dbw CH7, SFX_Cry22_2_Ch3 SFX_Cry23_2:: - db ( $80 | CH4 ) - dw SFX_Cry23_2_Ch1 - db CH5 - dw SFX_Cry23_2_Ch2 - db CH7 - dw SFX_Cry23_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry23_2_Ch1 + dbw CH5, SFX_Cry23_2_Ch2 + dbw CH7, SFX_Cry23_2_Ch3 SFX_Cry24_2:: - db ( $80 | CH4 ) - dw SFX_Cry24_2_Ch1 - db CH5 - dw SFX_Cry24_2_Ch2 - db CH7 - dw SFX_Cry24_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry24_2_Ch1 + dbw CH5, SFX_Cry24_2_Ch2 + dbw CH7, SFX_Cry24_2_Ch3 SFX_Cry25_2:: - db ( $80 | CH4 ) - dw SFX_Cry25_2_Ch1 - db CH5 - dw SFX_Cry25_2_Ch2 - db CH7 - dw SFX_Cry25_2_Ch3 + dbw ( $80 | CH4 ), SFX_Cry25_2_Ch1 + dbw CH5, SFX_Cry25_2_Ch2 + dbw CH7, SFX_Cry25_2_Ch3 SFX_Level_Up:: - db ( $80 | CH4 ) - dw SFX_Level_Up_Ch1 - db CH5 - dw SFX_Level_Up_Ch2 - db CH6 - dw SFX_Level_Up_Ch3 + dbw ( $80 | CH4 ), SFX_Level_Up_Ch1 + dbw CH5, SFX_Level_Up_Ch2 + dbw CH6, SFX_Level_Up_Ch3 SFX_Get_Item2_2:: - db ( $80 | CH4 ) - dw SFX_Get_Item2_2_Ch1 - db CH5 - dw SFX_Get_Item2_2_Ch2 - db CH6 - dw SFX_Get_Item2_2_Ch3 + dbw ( $80 | CH4 ), SFX_Get_Item2_2_Ch1 + dbw CH5, SFX_Get_Item2_2_Ch2 + dbw CH6, SFX_Get_Item2_2_Ch3 SFX_Tink_2:: - db CH4 - dw SFX_Tink_2_Ch1 + dbw CH4, SFX_Tink_2_Ch1 SFX_Heal_HP_2:: - db CH4 - dw SFX_Heal_HP_2_Ch1 + dbw CH4, SFX_Heal_HP_2_Ch1 SFX_Heal_Ailment_2:: - db CH4 - dw SFX_Heal_Ailment_2_Ch1 + dbw CH4, SFX_Heal_Ailment_2_Ch1 SFX_Start_Menu_2:: - db CH7 - dw SFX_Start_Menu_2_Ch1 + dbw CH7, SFX_Start_Menu_2_Ch1 SFX_Press_AB_2:: - db CH4 - dw SFX_Press_AB_2_Ch1 + dbw CH4, SFX_Press_AB_2_Ch1 SFX_Ball_Toss:: - db ( $40 | CH4 ) - dw SFX_Ball_Toss_Ch1 - db CH5 - dw SFX_Ball_Toss_Ch2 + dbw ( $40 | CH4 ), SFX_Ball_Toss_Ch1 + dbw CH5, SFX_Ball_Toss_Ch2 SFX_Ball_Poof:: - db ( $40 | CH4 ) - dw SFX_Ball_Poof_Ch1 - db CH7 - dw SFX_Ball_Poof_Ch2 + dbw ( $40 | CH4 ), SFX_Ball_Poof_Ch1 + dbw CH7, SFX_Ball_Poof_Ch2 SFX_Faint_Thud:: - db ( $40 | CH4 ) - dw SFX_Faint_Thud_Ch1 - db CH7 - dw SFX_Faint_Thud_Ch2 + dbw ( $40 | CH4 ), SFX_Faint_Thud_Ch1 + dbw CH7, SFX_Faint_Thud_Ch2 SFX_Run:: - db CH7 - dw SFX_Run_Ch1 + dbw CH7, SFX_Run_Ch1 SFX_Dex_Page_Added:: - db ( $40 | CH4 ) - dw SFX_Dex_Page_Added_Ch1 - db CH5 - dw SFX_Dex_Page_Added_Ch2 + dbw ( $40 | CH4 ), SFX_Dex_Page_Added_Ch1 + dbw CH5, SFX_Dex_Page_Added_Ch2 SFX_Caught_Mon:: - db ( $80 | CH4 ) - dw SFX_Caught_Mon_Ch1 - db CH5 - dw SFX_Caught_Mon_Ch2 - db CH6 - dw SFX_Caught_Mon_Ch3 + dbw ( $80 | CH4 ), SFX_Caught_Mon_Ch1 + dbw CH5, SFX_Caught_Mon_Ch2 + dbw CH6, SFX_Caught_Mon_Ch3 SFX_Peck:: - db CH7 - dw SFX_Peck_Ch1 + dbw CH7, SFX_Peck_Ch1 SFX_Faint_Fall:: - db CH4 - dw SFX_Faint_Fall_Ch1 + dbw CH4, SFX_Faint_Fall_Ch1 SFX_Battle_09:: - db CH4 - dw SFX_Battle_09_Ch1 + dbw CH4, SFX_Battle_09_Ch1 SFX_Pound:: - db CH7 - dw SFX_Pound_Ch1 + dbw CH7, SFX_Pound_Ch1 SFX_Battle_0B:: - db CH7 - dw SFX_Battle_0B_Ch1 + dbw CH7, SFX_Battle_0B_Ch1 SFX_Battle_0C:: - db CH7 - dw SFX_Battle_0C_Ch1 + dbw CH7, SFX_Battle_0C_Ch1 SFX_Battle_0D:: - db CH7 - dw SFX_Battle_0D_Ch1 + dbw CH7, SFX_Battle_0D_Ch1 SFX_Battle_0E:: - db CH7 - dw SFX_Battle_0E_Ch1 + dbw CH7, SFX_Battle_0E_Ch1 SFX_Battle_0F:: - db CH7 - dw SFX_Battle_0F_Ch1 + dbw CH7, SFX_Battle_0F_Ch1 SFX_Damage:: - db CH7 - dw SFX_Damage_Ch1 + dbw CH7, SFX_Damage_Ch1 SFX_Not_Very_Effective:: - db CH7 - dw SFX_Not_Very_Effective_Ch1 + dbw CH7, SFX_Not_Very_Effective_Ch1 SFX_Battle_12:: - db CH7 - dw SFX_Battle_12_Ch1 + dbw CH7, SFX_Battle_12_Ch1 SFX_Battle_13:: - db CH7 - dw SFX_Battle_13_Ch1 + dbw CH7, SFX_Battle_13_Ch1 SFX_Battle_14:: - db CH7 - dw SFX_Battle_14_Ch1 + dbw CH7, SFX_Battle_14_Ch1 SFX_Vine_Whip:: - db CH7 - dw SFX_Vine_Whip_Ch1 + dbw CH7, SFX_Vine_Whip_Ch1 SFX_Battle_16:: - db CH7 - dw SFX_Battle_16_Ch1 + dbw CH7, SFX_Battle_16_Ch1 SFX_Battle_17:: - db CH7 - dw SFX_Battle_17_Ch1 + dbw CH7, SFX_Battle_17_Ch1 SFX_Battle_18:: - db CH7 - dw SFX_Battle_18_Ch1 + dbw CH7, SFX_Battle_18_Ch1 SFX_Battle_19:: - db CH7 - dw SFX_Battle_19_Ch1 + dbw CH7, SFX_Battle_19_Ch1 SFX_Super_Effective:: - db CH7 - dw SFX_Super_Effective_Ch1 + dbw CH7, SFX_Super_Effective_Ch1 SFX_Battle_1B:: - db CH7 - dw SFX_Battle_1B_Ch1 + dbw CH7, SFX_Battle_1B_Ch1 SFX_Battle_1C:: - db CH7 - dw SFX_Battle_1C_Ch1 + dbw CH7, SFX_Battle_1C_Ch1 SFX_Doubleslap:: - db CH7 - dw SFX_Doubleslap_Ch1 + dbw CH7, SFX_Doubleslap_Ch1 SFX_Battle_1E:: - db ( $40 | CH4 ) - dw SFX_Battle_1E_Ch1 - db CH7 - dw SFX_Battle_1E_Ch2 + dbw ( $40 | CH4 ), SFX_Battle_1E_Ch1 + dbw CH7, SFX_Battle_1E_Ch2 SFX_Horn_Drill:: - db CH7 - dw SFX_Horn_Drill_Ch1 + dbw CH7, SFX_Horn_Drill_Ch1 SFX_Battle_20:: - db CH7 - dw SFX_Battle_20_Ch1 + dbw CH7, SFX_Battle_20_Ch1 SFX_Battle_21:: - db CH7 - dw SFX_Battle_21_Ch1 + dbw CH7, SFX_Battle_21_Ch1 SFX_Battle_22:: - db CH7 - dw SFX_Battle_22_Ch1 + dbw CH7, SFX_Battle_22_Ch1 SFX_Battle_23:: - db CH7 - dw SFX_Battle_23_Ch1 + dbw CH7, SFX_Battle_23_Ch1 SFX_Battle_24:: - db ( $40 | CH4 ) - dw SFX_Battle_24_Ch1 - db CH7 - dw SFX_Battle_24_Ch2 + dbw ( $40 | CH4 ), SFX_Battle_24_Ch1 + dbw CH7, SFX_Battle_24_Ch2 SFX_Battle_25:: - db CH7 - dw SFX_Battle_25_Ch1 + dbw CH7, SFX_Battle_25_Ch1 SFX_Battle_26:: - db CH7 - dw SFX_Battle_26_Ch1 + dbw CH7, SFX_Battle_26_Ch1 SFX_Battle_27:: - db ( $80 | CH4 ) - dw SFX_Battle_27_Ch1 - db CH5 - dw SFX_Battle_27_Ch2 - db CH7 - dw SFX_Battle_27_Ch3 + dbw ( $80 | CH4 ), SFX_Battle_27_Ch1 + dbw CH5, SFX_Battle_27_Ch2 + dbw CH7, SFX_Battle_27_Ch3 SFX_Battle_28:: - db ( $80 | CH4 ) - dw SFX_Battle_28_Ch1 - db CH5 - dw SFX_Battle_28_Ch2 - db CH7 - dw SFX_Battle_28_Ch3 - -SFX_Battle_29:: - db ( $40 | CH4 ) - dw SFX_Battle_29_Ch1 - db CH7 - dw SFX_Battle_29_Ch2 + dbw ( $80 | CH4 ), SFX_Battle_28_Ch1 + dbw CH5, SFX_Battle_28_Ch2 + dbw CH7, SFX_Battle_28_Ch3 + +SFX_Earthquake:: + dbw ( $40 | CH4 ), SFX_Earthquake_Ch1 + dbw CH7, SFX_Earthquake_Ch2 SFX_Battle_2A:: - db ( $80 | CH4 ) - dw SFX_Battle_2A_Ch1 - db CH5 - dw SFX_Battle_2A_Ch2 - db CH7 - dw SFX_Battle_2A_Ch3 + dbw ( $80 | CH4 ), SFX_Battle_2A_Ch1 + dbw CH5, SFX_Battle_2A_Ch2 + dbw CH7, SFX_Battle_2A_Ch3 SFX_Battle_2B:: - db ( $40 | CH4 ) - dw SFX_Battle_2B_Ch1 - db CH7 - dw SFX_Battle_2B_Ch2 + dbw ( $40 | CH4 ), SFX_Battle_2B_Ch1 + dbw CH7, SFX_Battle_2B_Ch2 SFX_Battle_2C:: - db ( $80 | CH4 ) - dw SFX_Battle_2C_Ch1 - db CH5 - dw SFX_Battle_2C_Ch2 - db CH7 - dw SFX_Battle_2C_Ch3 + dbw ( $80 | CH4 ), SFX_Battle_2C_Ch1 + dbw CH5, SFX_Battle_2C_Ch2 + dbw CH7, SFX_Battle_2C_Ch3 SFX_Psybeam:: - db ( $80 | CH4 ) - dw SFX_Psybeam_Ch1 - db CH5 - dw SFX_Psybeam_Ch2 - db CH7 - dw SFX_Psybeam_Ch3 + dbw ( $80 | CH4 ), SFX_Psybeam_Ch1 + dbw CH5, SFX_Psybeam_Ch2 + dbw CH7, SFX_Psybeam_Ch3 SFX_Battle_2E:: - db ( $80 | CH4 ) - dw SFX_Battle_2E_Ch1 - db CH5 - dw SFX_Battle_2E_Ch2 - db CH7 - dw SFX_Battle_2E_Ch3 - -SFX_Battle_2F:: - db ( $80 | CH4 ) - dw SFX_Battle_2F_Ch1 - db CH5 - dw SFX_Battle_2F_Ch2 - db CH7 - dw SFX_Battle_2F_Ch3 + dbw ( $80 | CH4 ), SFX_Battle_2E_Ch1 + dbw CH5, SFX_Battle_2E_Ch2 + dbw CH7, SFX_Battle_2E_Ch3 + +SFX_Thunderbolt:: + dbw ( $80 | CH4 ), SFX_Thunderbolt_Ch1 + dbw CH5, SFX_Thunderbolt_Ch2 + dbw CH7, SFX_Thunderbolt_Ch3 SFX_Psychic_M:: - db ( $80 | CH4 ) - dw SFX_Psychic_M_Ch1 - db CH5 - dw SFX_Psychic_M_Ch2 - db CH7 - dw SFX_Psychic_M_Ch3 + dbw ( $80 | CH4 ), SFX_Psychic_M_Ch1 + dbw CH5, SFX_Psychic_M_Ch2 + dbw CH7, SFX_Psychic_M_Ch3 SFX_Battle_31:: - db ( $40 | CH4 ) - dw SFX_Battle_31_Ch1 - db CH5 - dw SFX_Battle_31_Ch2 + dbw ( $40 | CH4 ), SFX_Battle_31_Ch1 + dbw CH5, SFX_Battle_31_Ch2 SFX_Battle_32:: - db ( $40 | CH4 ) - dw SFX_Battle_32_Ch1 - db CH5 - dw SFX_Battle_32_Ch2 + dbw ( $40 | CH4 ), SFX_Battle_32_Ch1 + dbw CH5, SFX_Battle_32_Ch2 SFX_Battle_33:: - db ( $40 | CH4 ) - dw SFX_Battle_33_Ch1 - db CH5 - dw SFX_Battle_33_Ch2 + dbw ( $40 | CH4 ), SFX_Battle_33_Ch1 + dbw CH5, SFX_Battle_33_Ch2 SFX_Battle_34:: - db ( $80 | CH4 ) - dw SFX_Battle_34_Ch1 - db CH5 - dw SFX_Battle_34_Ch2 - db CH7 - dw SFX_Battle_34_Ch3 + dbw ( $80 | CH4 ), SFX_Battle_34_Ch1 + dbw CH5, SFX_Battle_34_Ch2 + dbw CH7, SFX_Battle_34_Ch3 SFX_Battle_35:: - db ( $40 | CH4 ) - dw SFX_Battle_35_Ch1 - db CH5 - dw SFX_Battle_35_Ch2 + dbw ( $40 | CH4 ), SFX_Battle_35_Ch1 + dbw CH5, SFX_Battle_35_Ch2 SFX_Battle_36:: - db ( $80 | CH4 ) - dw SFX_Battle_36_Ch1 - db CH5 - dw SFX_Battle_36_Ch2 - db CH7 - dw SFX_Battle_36_Ch3 + dbw ( $80 | CH4 ), SFX_Battle_36_Ch1 + dbw CH5, SFX_Battle_36_Ch2 + dbw CH7, SFX_Battle_36_Ch3 SFX_Silph_Scope:: - db CH4 - dw SFX_Silph_Scope_Ch1 + dbw CH4, SFX_Silph_Scope_Ch1 diff --git a/audio/headers/sfxheaders3.asm b/audio/headers/sfxheaders3.asm index 0472afa6..cd940357 100644 --- a/audio/headers/sfxheaders3.asm +++ b/audio/headers/sfxheaders3.asm @@ -1,596 +1,402 @@ SFX_Headers_3:: - db $ff, $ff, $ff ; padding + dbw -1, -1 ; padding SFX_Snare1_3:: - db CH7 - dw SFX_Snare1_3_Ch1 + dbw CH7, SFX_Snare1_3_Ch1 SFX_Snare2_3:: - db CH7 - dw SFX_Snare2_3_Ch1 + dbw CH7, SFX_Snare2_3_Ch1 SFX_Snare3_3:: - db CH7 - dw SFX_Snare3_3_Ch1 + dbw CH7, SFX_Snare3_3_Ch1 SFX_Snare4_3:: - db CH7 - dw SFX_Snare4_3_Ch1 + dbw CH7, SFX_Snare4_3_Ch1 SFX_Snare5_3:: - db CH7 - dw SFX_Snare5_3_Ch1 + dbw CH7, SFX_Snare5_3_Ch1 SFX_Triangle1_3:: - db CH7 - dw SFX_Triangle1_3_Ch1 + dbw CH7, SFX_Triangle1_3_Ch1 SFX_Triangle2_3:: - db CH7 - dw SFX_Triangle2_3_Ch1 + dbw CH7, SFX_Triangle2_3_Ch1 SFX_Snare6_3:: - db CH7 - dw SFX_Snare6_3_Ch1 + dbw CH7, SFX_Snare6_3_Ch1 SFX_Snare7_3:: - db CH7 - dw SFX_Snare7_3_Ch1 + dbw CH7, SFX_Snare7_3_Ch1 SFX_Snare8_3:: - db CH7 - dw SFX_Snare8_3_Ch1 + dbw CH7, SFX_Snare8_3_Ch1 SFX_Snare9_3:: - db CH7 - dw SFX_Snare9_3_Ch1 + dbw CH7, SFX_Snare9_3_Ch1 SFX_Cymbal1_3:: - db CH7 - dw SFX_Cymbal1_3_Ch1 + dbw CH7, SFX_Cymbal1_3_Ch1 SFX_Cymbal2_3:: - db CH7 - dw SFX_Cymbal2_3_Ch1 + dbw CH7, SFX_Cymbal2_3_Ch1 SFX_Cymbal3_3:: - db CH7 - dw SFX_Cymbal3_3_Ch1 + dbw CH7, SFX_Cymbal3_3_Ch1 SFX_Muted_Snare1_3:: - db CH7 - dw SFX_Muted_Snare1_3_Ch1 + dbw CH7, SFX_Muted_Snare1_3_Ch1 SFX_Triangle3_3:: - db CH7 - dw SFX_Triangle3_3_Ch1 + dbw CH7, SFX_Triangle3_3_Ch1 SFX_Muted_Snare2_3:: - db CH7 - dw SFX_Muted_Snare2_3_Ch1 + dbw CH7, SFX_Muted_Snare2_3_Ch1 SFX_Muted_Snare3_3:: - db CH7 - dw SFX_Muted_Snare3_3_Ch1 + dbw CH7, SFX_Muted_Snare3_3_Ch1 SFX_Muted_Snare4_3:: - db CH7 - dw SFX_Muted_Snare4_3_Ch1 + dbw CH7, SFX_Muted_Snare4_3_Ch1 SFX_Cry00_3:: - db ( $80 | CH4 ) - dw SFX_Cry00_3_Ch1 - db CH5 - dw SFX_Cry00_3_Ch2 - db CH7 - dw SFX_Cry00_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry00_3_Ch1 + dbw CH5, SFX_Cry00_3_Ch2 + dbw CH7, SFX_Cry00_3_Ch3 SFX_Cry01_3:: - db ( $80 | CH4 ) - dw SFX_Cry01_3_Ch1 - db CH5 - dw SFX_Cry01_3_Ch2 - db CH7 - dw SFX_Cry01_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry01_3_Ch1 + dbw CH5, SFX_Cry01_3_Ch2 + dbw CH7, SFX_Cry01_3_Ch3 SFX_Cry02_3:: - db ( $80 | CH4 ) - dw SFX_Cry02_3_Ch1 - db CH5 - dw SFX_Cry02_3_Ch2 - db CH7 - dw SFX_Cry02_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry02_3_Ch1 + dbw CH5, SFX_Cry02_3_Ch2 + dbw CH7, SFX_Cry02_3_Ch3 SFX_Cry03_3:: - db ( $80 | CH4 ) - dw SFX_Cry03_3_Ch1 - db CH5 - dw SFX_Cry03_3_Ch2 - db CH7 - dw SFX_Cry03_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry03_3_Ch1 + dbw CH5, SFX_Cry03_3_Ch2 + dbw CH7, SFX_Cry03_3_Ch3 SFX_Cry04_3:: - db ( $80 | CH4 ) - dw SFX_Cry04_3_Ch1 - db CH5 - dw SFX_Cry04_3_Ch2 - db CH7 - dw SFX_Cry04_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry04_3_Ch1 + dbw CH5, SFX_Cry04_3_Ch2 + dbw CH7, SFX_Cry04_3_Ch3 SFX_Cry05_3:: - db ( $80 | CH4 ) - dw SFX_Cry05_3_Ch1 - db CH5 - dw SFX_Cry05_3_Ch2 - db CH7 - dw SFX_Cry05_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry05_3_Ch1 + dbw CH5, SFX_Cry05_3_Ch2 + dbw CH7, SFX_Cry05_3_Ch3 SFX_Cry06_3:: - db ( $80 | CH4 ) - dw SFX_Cry06_3_Ch1 - db CH5 - dw SFX_Cry06_3_Ch2 - db CH7 - dw SFX_Cry06_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry06_3_Ch1 + dbw CH5, SFX_Cry06_3_Ch2 + dbw CH7, SFX_Cry06_3_Ch3 SFX_Cry07_3:: - db ( $80 | CH4 ) - dw SFX_Cry07_3_Ch1 - db CH5 - dw SFX_Cry07_3_Ch2 - db CH7 - dw SFX_Cry07_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry07_3_Ch1 + dbw CH5, SFX_Cry07_3_Ch2 + dbw CH7, SFX_Cry07_3_Ch3 SFX_Cry08_3:: - db ( $80 | CH4 ) - dw SFX_Cry08_3_Ch1 - db CH5 - dw SFX_Cry08_3_Ch2 - db CH7 - dw SFX_Cry08_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry08_3_Ch1 + dbw CH5, SFX_Cry08_3_Ch2 + dbw CH7, SFX_Cry08_3_Ch3 SFX_Cry09_3:: - db ( $80 | CH4 ) - dw SFX_Cry09_3_Ch1 - db CH5 - dw SFX_Cry09_3_Ch2 - db CH7 - dw SFX_Cry09_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry09_3_Ch1 + dbw CH5, SFX_Cry09_3_Ch2 + dbw CH7, SFX_Cry09_3_Ch3 SFX_Cry0A_3:: - db ( $80 | CH4 ) - dw SFX_Cry0A_3_Ch1 - db CH5 - dw SFX_Cry0A_3_Ch2 - db CH7 - dw SFX_Cry0A_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry0A_3_Ch1 + dbw CH5, SFX_Cry0A_3_Ch2 + dbw CH7, SFX_Cry0A_3_Ch3 SFX_Cry0B_3:: - db ( $80 | CH4 ) - dw SFX_Cry0B_3_Ch1 - db CH5 - dw SFX_Cry0B_3_Ch2 - db CH7 - dw SFX_Cry0B_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry0B_3_Ch1 + dbw CH5, SFX_Cry0B_3_Ch2 + dbw CH7, SFX_Cry0B_3_Ch3 SFX_Cry0C_3:: - db ( $80 | CH4 ) - dw SFX_Cry0C_3_Ch1 - db CH5 - dw SFX_Cry0C_3_Ch2 - db CH7 - dw SFX_Cry0C_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry0C_3_Ch1 + dbw CH5, SFX_Cry0C_3_Ch2 + dbw CH7, SFX_Cry0C_3_Ch3 SFX_Cry0D_3:: - db ( $80 | CH4 ) - dw SFX_Cry0D_3_Ch1 - db CH5 - dw SFX_Cry0D_3_Ch2 - db CH7 - dw SFX_Cry0D_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry0D_3_Ch1 + dbw CH5, SFX_Cry0D_3_Ch2 + dbw CH7, SFX_Cry0D_3_Ch3 SFX_Cry0E_3:: - db ( $80 | CH4 ) - dw SFX_Cry0E_3_Ch1 - db CH5 - dw SFX_Cry0E_3_Ch2 - db CH7 - dw SFX_Cry0E_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry0E_3_Ch1 + dbw CH5, SFX_Cry0E_3_Ch2 + dbw CH7, SFX_Cry0E_3_Ch3 SFX_Cry0F_3:: - db ( $80 | CH4 ) - dw SFX_Cry0F_3_Ch1 - db CH5 - dw SFX_Cry0F_3_Ch2 - db CH7 - dw SFX_Cry0F_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry0F_3_Ch1 + dbw CH5, SFX_Cry0F_3_Ch2 + dbw CH7, SFX_Cry0F_3_Ch3 SFX_Cry10_3:: - db ( $80 | CH4 ) - dw SFX_Cry10_3_Ch1 - db CH5 - dw SFX_Cry10_3_Ch2 - db CH7 - dw SFX_Cry10_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry10_3_Ch1 + dbw CH5, SFX_Cry10_3_Ch2 + dbw CH7, SFX_Cry10_3_Ch3 SFX_Cry11_3:: - db ( $80 | CH4 ) - dw SFX_Cry11_3_Ch1 - db CH5 - dw SFX_Cry11_3_Ch2 - db CH7 - dw SFX_Cry11_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry11_3_Ch1 + dbw CH5, SFX_Cry11_3_Ch2 + dbw CH7, SFX_Cry11_3_Ch3 SFX_Cry12_3:: - db ( $80 | CH4 ) - dw SFX_Cry12_3_Ch1 - db CH5 - dw SFX_Cry12_3_Ch2 - db CH7 - dw SFX_Cry12_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry12_3_Ch1 + dbw CH5, SFX_Cry12_3_Ch2 + dbw CH7, SFX_Cry12_3_Ch3 SFX_Cry13_3:: - db ( $80 | CH4 ) - dw SFX_Cry13_3_Ch1 - db CH5 - dw SFX_Cry13_3_Ch2 - db CH7 - dw SFX_Cry13_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry13_3_Ch1 + dbw CH5, SFX_Cry13_3_Ch2 + dbw CH7, SFX_Cry13_3_Ch3 SFX_Cry14_3:: - db ( $80 | CH4 ) - dw SFX_Cry14_3_Ch1 - db CH5 - dw SFX_Cry14_3_Ch2 - db CH7 - dw SFX_Cry14_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry14_3_Ch1 + dbw CH5, SFX_Cry14_3_Ch2 + dbw CH7, SFX_Cry14_3_Ch3 SFX_Cry15_3:: - db ( $80 | CH4 ) - dw SFX_Cry15_3_Ch1 - db CH5 - dw SFX_Cry15_3_Ch2 - db CH7 - dw SFX_Cry15_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry15_3_Ch1 + dbw CH5, SFX_Cry15_3_Ch2 + dbw CH7, SFX_Cry15_3_Ch3 SFX_Cry16_3:: - db ( $80 | CH4 ) - dw SFX_Cry16_3_Ch1 - db CH5 - dw SFX_Cry16_3_Ch2 - db CH7 - dw SFX_Cry16_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry16_3_Ch1 + dbw CH5, SFX_Cry16_3_Ch2 + dbw CH7, SFX_Cry16_3_Ch3 SFX_Cry17_3:: - db ( $80 | CH4 ) - dw SFX_Cry17_3_Ch1 - db CH5 - dw SFX_Cry17_3_Ch2 - db CH7 - dw SFX_Cry17_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry17_3_Ch1 + dbw CH5, SFX_Cry17_3_Ch2 + dbw CH7, SFX_Cry17_3_Ch3 SFX_Cry18_3:: - db ( $80 | CH4 ) - dw SFX_Cry18_3_Ch1 - db CH5 - dw SFX_Cry18_3_Ch2 - db CH7 - dw SFX_Cry18_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry18_3_Ch1 + dbw CH5, SFX_Cry18_3_Ch2 + dbw CH7, SFX_Cry18_3_Ch3 SFX_Cry19_3:: - db ( $80 | CH4 ) - dw SFX_Cry19_3_Ch1 - db CH5 - dw SFX_Cry19_3_Ch2 - db CH7 - dw SFX_Cry19_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry19_3_Ch1 + dbw CH5, SFX_Cry19_3_Ch2 + dbw CH7, SFX_Cry19_3_Ch3 SFX_Cry1A_3:: - db ( $80 | CH4 ) - dw SFX_Cry1A_3_Ch1 - db CH5 - dw SFX_Cry1A_3_Ch2 - db CH7 - dw SFX_Cry1A_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry1A_3_Ch1 + dbw CH5, SFX_Cry1A_3_Ch2 + dbw CH7, SFX_Cry1A_3_Ch3 SFX_Cry1B_3:: - db ( $80 | CH4 ) - dw SFX_Cry1B_3_Ch1 - db CH5 - dw SFX_Cry1B_3_Ch2 - db CH7 - dw SFX_Cry1B_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry1B_3_Ch1 + dbw CH5, SFX_Cry1B_3_Ch2 + dbw CH7, SFX_Cry1B_3_Ch3 SFX_Cry1C_3:: - db ( $80 | CH4 ) - dw SFX_Cry1C_3_Ch1 - db CH5 - dw SFX_Cry1C_3_Ch2 - db CH7 - dw SFX_Cry1C_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry1C_3_Ch1 + dbw CH5, SFX_Cry1C_3_Ch2 + dbw CH7, SFX_Cry1C_3_Ch3 SFX_Cry1D_3:: - db ( $80 | CH4 ) - dw SFX_Cry1D_3_Ch1 - db CH5 - dw SFX_Cry1D_3_Ch2 - db CH7 - dw SFX_Cry1D_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry1D_3_Ch1 + dbw CH5, SFX_Cry1D_3_Ch2 + dbw CH7, SFX_Cry1D_3_Ch3 SFX_Cry1E_3:: - db ( $80 | CH4 ) - dw SFX_Cry1E_3_Ch1 - db CH5 - dw SFX_Cry1E_3_Ch2 - db CH7 - dw SFX_Cry1E_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry1E_3_Ch1 + dbw CH5, SFX_Cry1E_3_Ch2 + dbw CH7, SFX_Cry1E_3_Ch3 SFX_Cry1F_3:: - db ( $80 | CH4 ) - dw SFX_Cry1F_3_Ch1 - db CH5 - dw SFX_Cry1F_3_Ch2 - db CH7 - dw SFX_Cry1F_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry1F_3_Ch1 + dbw CH5, SFX_Cry1F_3_Ch2 + dbw CH7, SFX_Cry1F_3_Ch3 SFX_Cry20_3:: - db ( $80 | CH4 ) - dw SFX_Cry20_3_Ch1 - db CH5 - dw SFX_Cry20_3_Ch2 - db CH7 - dw SFX_Cry20_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry20_3_Ch1 + dbw CH5, SFX_Cry20_3_Ch2 + dbw CH7, SFX_Cry20_3_Ch3 SFX_Cry21_3:: - db ( $80 | CH4 ) - dw SFX_Cry21_3_Ch1 - db CH5 - dw SFX_Cry21_3_Ch2 - db CH7 - dw SFX_Cry21_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry21_3_Ch1 + dbw CH5, SFX_Cry21_3_Ch2 + dbw CH7, SFX_Cry21_3_Ch3 SFX_Cry22_3:: - db ( $80 | CH4 ) - dw SFX_Cry22_3_Ch1 - db CH5 - dw SFX_Cry22_3_Ch2 - db CH7 - dw SFX_Cry22_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry22_3_Ch1 + dbw CH5, SFX_Cry22_3_Ch2 + dbw CH7, SFX_Cry22_3_Ch3 SFX_Cry23_3:: - db ( $80 | CH4 ) - dw SFX_Cry23_3_Ch1 - db CH5 - dw SFX_Cry23_3_Ch2 - db CH7 - dw SFX_Cry23_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry23_3_Ch1 + dbw CH5, SFX_Cry23_3_Ch2 + dbw CH7, SFX_Cry23_3_Ch3 SFX_Cry24_3:: - db ( $80 | CH4 ) - dw SFX_Cry24_3_Ch1 - db CH5 - dw SFX_Cry24_3_Ch2 - db CH7 - dw SFX_Cry24_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry24_3_Ch1 + dbw CH5, SFX_Cry24_3_Ch2 + dbw CH7, SFX_Cry24_3_Ch3 SFX_Cry25_3:: - db ( $80 | CH4 ) - dw SFX_Cry25_3_Ch1 - db CH5 - dw SFX_Cry25_3_Ch2 - db CH7 - dw SFX_Cry25_3_Ch3 + dbw ( $80 | CH4 ), SFX_Cry25_3_Ch1 + dbw CH5, SFX_Cry25_3_Ch2 + dbw CH7, SFX_Cry25_3_Ch3 SFX_Get_Item1_3:: - db ( $80 | CH4 ) - dw SFX_Get_Item1_3_Ch1 - db CH5 - dw SFX_Get_Item1_3_Ch2 - db CH6 - dw SFX_Get_Item1_3_Ch3 + dbw ( $80 | CH4 ), SFX_Get_Item1_3_Ch1 + dbw CH5, SFX_Get_Item1_3_Ch2 + dbw CH6, SFX_Get_Item1_3_Ch3 SFX_Get_Item2_3:: - db ( $80 | CH4 ) - dw SFX_Get_Item2_3_Ch1 - db CH5 - dw SFX_Get_Item2_3_Ch2 - db CH6 - dw SFX_Get_Item2_3_Ch3 + dbw ( $80 | CH4 ), SFX_Get_Item2_3_Ch1 + dbw CH5, SFX_Get_Item2_3_Ch2 + dbw CH6, SFX_Get_Item2_3_Ch3 SFX_Tink_3:: - db CH4 - dw SFX_Tink_3_Ch1 + dbw CH4, SFX_Tink_3_Ch1 SFX_Heal_HP_3:: - db CH4 - dw SFX_Heal_HP_3_Ch1 + dbw CH4, SFX_Heal_HP_3_Ch1 SFX_Heal_Ailment_3:: - db CH4 - dw SFX_Heal_Ailment_3_Ch1 + dbw CH4, SFX_Heal_Ailment_3_Ch1 SFX_Start_Menu_3:: - db CH7 - dw SFX_Start_Menu_3_Ch1 + dbw CH7, SFX_Start_Menu_3_Ch1 SFX_Press_AB_3:: - db CH4 - dw SFX_Press_AB_3_Ch1 + dbw CH4, SFX_Press_AB_3_Ch1 SFX_Pokedex_Rating_3:: - db ( $80 | CH4 ) - dw SFX_Pokedex_Rating_3_Ch1 - db CH5 - dw SFX_Pokedex_Rating_3_Ch2 - db CH6 - dw SFX_Pokedex_Rating_3_Ch3 + dbw ( $80 | CH4 ), SFX_Pokedex_Rating_3_Ch1 + dbw CH5, SFX_Pokedex_Rating_3_Ch2 + dbw CH6, SFX_Pokedex_Rating_3_Ch3 SFX_Get_Key_Item_3:: - db ( $80 | CH4 ) - dw SFX_Get_Key_Item_3_Ch1 - db CH5 - dw SFX_Get_Key_Item_3_Ch2 - db CH6 - dw SFX_Get_Key_Item_3_Ch3 + dbw ( $80 | CH4 ), SFX_Get_Key_Item_3_Ch1 + dbw CH5, SFX_Get_Key_Item_3_Ch2 + dbw CH6, SFX_Get_Key_Item_3_Ch3 SFX_Poisoned_3:: - db CH4 - dw SFX_Poisoned_3_Ch1 + dbw CH4, SFX_Poisoned_3_Ch1 SFX_Trade_Machine_3:: - db CH4 - dw SFX_Trade_Machine_3_Ch1 + dbw CH4, SFX_Trade_Machine_3_Ch1 SFX_Turn_On_PC_3:: - db CH4 - dw SFX_Turn_On_PC_3_Ch1 + dbw CH4, SFX_Turn_On_PC_3_Ch1 SFX_Turn_Off_PC_3:: - db CH4 - dw SFX_Turn_Off_PC_3_Ch1 + dbw CH4, SFX_Turn_Off_PC_3_Ch1 SFX_Enter_PC_3:: - db CH4 - dw SFX_Enter_PC_3_Ch1 + dbw CH4, SFX_Enter_PC_3_Ch1 SFX_Shrink_3:: - db CH4 - dw SFX_Shrink_3_Ch1 + dbw CH4, SFX_Shrink_3_Ch1 SFX_Switch_3:: - db CH4 - dw SFX_Switch_3_Ch1 + dbw CH4, SFX_Switch_3_Ch1 SFX_Healing_Machine_3:: - db CH4 - dw SFX_Healing_Machine_3_Ch1 + dbw CH4, SFX_Healing_Machine_3_Ch1 SFX_Teleport_Exit1_3:: - db CH4 - dw SFX_Teleport_Exit1_3_Ch1 + dbw CH4, SFX_Teleport_Exit1_3_Ch1 SFX_Teleport_Enter1_3:: - db CH4 - dw SFX_Teleport_Enter1_3_Ch1 + dbw CH4, SFX_Teleport_Enter1_3_Ch1 SFX_Teleport_Exit2_3:: - db CH4 - dw SFX_Teleport_Exit2_3_Ch1 + dbw CH4, SFX_Teleport_Exit2_3_Ch1 SFX_Ledge_3:: - db CH4 - dw SFX_Ledge_3_Ch1 + dbw CH4, SFX_Ledge_3_Ch1 SFX_Teleport_Enter2_3:: - db CH7 - dw SFX_Teleport_Enter2_3_Ch1 + dbw CH7, SFX_Teleport_Enter2_3_Ch1 SFX_Fly_3:: - db CH7 - dw SFX_Fly_3_Ch1 + dbw CH7, SFX_Fly_3_Ch1 SFX_Denied_3:: - db ( $40 | CH4 ) - dw SFX_Denied_3_Ch1 - db CH5 - dw SFX_Denied_3_Ch2 + dbw ( $40 | CH4 ), SFX_Denied_3_Ch1 + dbw CH5, SFX_Denied_3_Ch2 SFX_Arrow_Tiles_3:: - db CH4 - dw SFX_Arrow_Tiles_3_Ch1 + dbw CH4, SFX_Arrow_Tiles_3_Ch1 SFX_Push_Boulder_3:: - db CH7 - dw SFX_Push_Boulder_3_Ch1 + dbw CH7, SFX_Push_Boulder_3_Ch1 SFX_SS_Anne_Horn_3:: - db ( $40 | CH4 ) - dw SFX_SS_Anne_Horn_3_Ch1 - db CH5 - dw SFX_SS_Anne_Horn_3_Ch2 + dbw ( $40 | CH4 ), SFX_SS_Anne_Horn_3_Ch1 + dbw CH5, SFX_SS_Anne_Horn_3_Ch2 SFX_Withdraw_Deposit_3:: - db CH4 - dw SFX_Withdraw_Deposit_3_Ch1 + dbw CH4, SFX_Withdraw_Deposit_3_Ch1 SFX_Cut_3:: - db CH7 - dw SFX_Cut_3_Ch1 + dbw CH7, SFX_Cut_3_Ch1 SFX_Go_Inside_3:: - db CH7 - dw SFX_Go_Inside_3_Ch1 + dbw CH7, SFX_Go_Inside_3_Ch1 SFX_Swap_3:: - db ( $40 | CH4 ) - dw SFX_Swap_3_Ch1 - db CH5 - dw SFX_Swap_3_Ch2 + dbw ( $40 | CH4 ), SFX_Swap_3_Ch1 + dbw CH5, SFX_Swap_3_Ch2 SFX_59_3:: - db ( $40 | CH4 ) - dw SFX_59_3_Ch1 - db CH5 - dw SFX_59_3_Ch2 + dbw ( $40 | CH4 ), SFX_59_3_Ch1 + dbw CH5, SFX_59_3_Ch2 SFX_Purchase_3:: - db ( $40 | CH4 ) - dw SFX_Purchase_3_Ch1 - db CH5 - dw SFX_Purchase_3_Ch2 + dbw ( $40 | CH4 ), SFX_Purchase_3_Ch1 + dbw CH5, SFX_Purchase_3_Ch2 SFX_Collision_3:: - db CH4 - dw SFX_Collision_3_Ch1 + dbw CH4, SFX_Collision_3_Ch1 SFX_Go_Outside_3:: - db CH7 - dw SFX_Go_Outside_3_Ch1 + dbw CH7, SFX_Go_Outside_3_Ch1 SFX_Save_3:: - db ( $40 | CH4 ) - dw SFX_Save_3_Ch1 - db CH5 - dw SFX_Save_3_Ch2 + dbw ( $40 | CH4 ), SFX_Save_3_Ch1 + dbw CH5, SFX_Save_3_Ch2 SFX_Intro_Lunge:: - db CH7 - dw SFX_Intro_Lunge_Ch1 + dbw CH7, SFX_Intro_Lunge_Ch1 SFX_Intro_Hip:: - db CH4 - dw SFX_Intro_Hip_Ch1 + dbw CH4, SFX_Intro_Hip_Ch1 SFX_Intro_Hop:: - db CH4 - dw SFX_Intro_Hop_Ch1 + dbw CH4, SFX_Intro_Hop_Ch1 SFX_Intro_Raise:: - db CH7 - dw SFX_Intro_Raise_Ch1 + dbw CH7, SFX_Intro_Raise_Ch1 SFX_Intro_Crash:: - db CH7 - dw SFX_Intro_Crash_Ch1 + dbw CH7, SFX_Intro_Crash_Ch1 SFX_Intro_Whoosh:: - db CH7 - dw SFX_Intro_Whoosh_Ch1 + dbw CH7, SFX_Intro_Whoosh_Ch1 SFX_Slots_Stop_Wheel:: - db CH4 - dw SFX_Slots_Stop_Wheel_Ch1 + dbw CH4, SFX_Slots_Stop_Wheel_Ch1 SFX_Slots_Reward:: - db CH4 - dw SFX_Slots_Reward_Ch1 + dbw CH4, SFX_Slots_Reward_Ch1 SFX_Slots_New_Spin:: - db ( $40 | CH4 ) - dw SFX_Slots_New_Spin_Ch1 - db CH5 - dw SFX_Slots_New_Spin_Ch2 + dbw ( $40 | CH4 ), SFX_Slots_New_Spin_Ch1 + dbw CH5, SFX_Slots_New_Spin_Ch2 SFX_Shooting_Star:: - db CH4 - dw SFX_Shooting_Star_Ch1 + dbw CH4, SFX_Shooting_Star_Ch1 diff --git a/audio/headers/sfxheaders4.asm b/audio/headers/sfxheaders4.asm new file mode 100644 index 00000000..16e69e1f --- /dev/null +++ b/audio/headers/sfxheaders4.asm @@ -0,0 +1,294 @@ +SFX_Headers_4:: + dbw -1, -1 ; padding + +SFX_Snare1_4:: + dbw CH7, SFX_Snare1_4_Ch7 + +SFX_Snare2_4:: + dbw CH7, SFX_Snare2_4_Ch7 + +SFX_Snare3_4:: + dbw CH7, SFX_Snare3_4_Ch7 + +SFX_Snare4_4:: + dbw CH7, SFX_Snare4_4_Ch7 + +SFX_Snare5_4:: + dbw CH7, SFX_Snare5_4_Ch7 + +SFX_Triangle1_4:: + dbw CH7, SFX_Triangle1_4_Ch7 + +SFX_Triangle2_4:: + dbw CH7, SFX_Triangle2_4_Ch7 + +SFX_Snare6_4:: + dbw CH7, SFX_Snare6_4_Ch7 + +SFX_Snare7_4:: + dbw CH7, SFX_Snare7_4_Ch7 + +SFX_Snare8_4:: + dbw CH7, SFX_Snare8_4_Ch7 + +SFX_Snare9_4:: + dbw CH7, SFX_Snare9_4_Ch7 + +SFX_Cymbal1_4:: + dbw CH7, SFX_Cymbal1_4_Ch7 + +SFX_Cymbal2_4:: + dbw CH7, SFX_Cymbal2_4_Ch7 + +SFX_Cymbal3_4:: + dbw CH7, SFX_Cymbal3_4_Ch7 + +SFX_Muted_Snare1_4:: + dbw CH7, SFX_Muted_Snare1_4_Ch7 + +SFX_Triangle3_4:: + dbw CH7, SFX_Triangle3_4_Ch7 + +SFX_Muted_Snare2_4:: + dbw CH7, SFX_Muted_Snare2_4_Ch7 + +SFX_Muted_Snare3_4:: + dbw CH7, SFX_Muted_Snare3_4_Ch7 + +SFX_Muted_Snare4_4:: + dbw CH7, SFX_Muted_Snare4_4_Ch7 + +SFX_8003c_4:: + dbw ( $80 | CH4 ), SFX_805db_4_Ch4 + dbw CH5, SFX_805ea_4_Ch5 + dbw CH7, SFX_805f9_4_Ch7 + +SFX_80045_4:: + dbw ( $80 | CH4 ), SFX_807eb_4_Ch4 + dbw CH5, SFX_807fe_4_Ch5 + dbw CH7, SFX_80811_4_Ch7 + +SFX_8004e_4:: + dbw ( $80 | CH4 ), SFX_80760_4_Ch4 + dbw CH5, SFX_8076f_4_Ch5 + dbw CH7, SFX_8077d_4_Ch7 + +SFX_80057_4:: + dbw ( $80 | CH4 ), SFX_804fa_4_Ch4 + dbw CH5, SFX_80519_4_Ch5 + dbw CH7, SFX_80538_4_Ch7 + +SFX_80060_4:: + dbw ( $80 | CH4 ), SFX_808a9_4_Ch4 + dbw CH5, SFX_808c8_4_Ch5 + dbw CH7, SFX_808e7_4_Ch7 + +SFX_80069_4:: + dbw ( $80 | CH4 ), SFX_80689_4_Ch4 + dbw CH5, SFX_8069c_4_Ch5 + dbw CH7, SFX_806ae_4_Ch7 + +SFX_80072_4:: + dbw ( $80 | CH4 ), SFX_80633_4_Ch4 + dbw CH5, SFX_8064d_4_Ch5 + dbw CH7, SFX_8064e_4_Ch7 + +SFX_8007b_4:: + dbw ( $80 | CH4 ), SFX_80661_4_Ch4 + dbw CH5, SFX_80670_4_Ch5 + dbw CH7, SFX_8067f_4_Ch7 + +SFX_80084_4:: + dbw ( $80 | CH4 ), SFX_80879_4_Ch4 + dbw CH5, SFX_8088c_4_Ch5 + dbw CH7, SFX_8089f_4_Ch7 + +SFX_8008d_4:: + dbw ( $80 | CH4 ), SFX_80383_4_Ch4 + dbw CH5, SFX_803a0_4_Ch5 + dbw CH7, SFX_803c1_4_Ch7 + +SFX_80096_4:: + dbw ( $80 | CH4 ), SFX_8081e_4_Ch4 + dbw CH5, SFX_8083d_4_Ch5 + dbw CH7, SFX_80860_4_Ch7 + +SFX_8009f_4:: + dbw ( $80 | CH4 ), SFX_806af_4_Ch4 + dbw CH5, SFX_806da_4_Ch5 + dbw CH7, SFX_806f9_4_Ch7 + +SFX_800a8_4:: + dbw ( $80 | CH4 ), SFX_80712_4_Ch4 + dbw CH5, SFX_80739_4_Ch5 + dbw CH7, SFX_8075f_4_Ch7 + +SFX_800b1_4:: + dbw ( $80 | CH4 ), SFX_8077e_4_Ch4 + dbw CH5, SFX_8079d_4_Ch5 + dbw CH7, SFX_807cc_4_Ch7 + +SFX_800ba_4:: + dbw ( $80 | CH4 ), SFX_80603_4_Ch4 + dbw CH5, SFX_80616_4_Ch5 + dbw CH7, SFX_80629_4_Ch7 + +SFX_800c3_4:: + dbw ( $80 | CH4 ), SFX_80545_4_Ch4 + dbw CH5, SFX_80560_4_Ch5 + dbw CH7, SFX_8057b_4_Ch7 + +SFX_800cc_4:: + dbw ( $80 | CH4 ), SFX_8058b_4_Ch4 + dbw CH5, SFX_805ae_4_Ch5 + dbw CH7, SFX_805d1_4_Ch7 + +SFX_800d5_4:: + dbw ( $80 | CH4 ), SFX_80467_4_Ch4 + dbw CH5, SFX_80486_4_Ch5 + dbw CH7, SFX_804a9_4_Ch7 + +SFX_800de_4:: + dbw ( $80 | CH4 ), SFX_8097f_4_Ch4 + dbw CH5, SFX_80992_4_Ch5 + dbw CH7, SFX_809a5_4_Ch7 + +SFX_800e7_4:: + dbw ( $80 | CH4 ), SFX_809b2_4_Ch4 + dbw CH5, SFX_809cd_4_Ch5 + dbw CH7, SFX_809e8_4_Ch7 + +SFX_800f0_4:: + dbw ( $80 | CH4 ), SFX_809fb_4_Ch4 + dbw CH5, SFX_80a0a_4_Ch5 + dbw CH7, SFX_80a19_4_Ch7 + +SFX_800f9_4:: + dbw ( $80 | CH4 ), SFX_80a89_4_Ch4 + dbw CH5, SFX_80aa4_4_Ch5 + dbw CH7, SFX_80abf_4_Ch7 + +SFX_80102_4:: + dbw ( $80 | CH4 ), SFX_8091c_4_Ch4 + dbw CH5, SFX_8092b_4_Ch5 + dbw CH7, SFX_8093a_4_Ch7 + +SFX_8010b_4:: + dbw ( $80 | CH4 ), SFX_80ad2_4_Ch4 + dbw CH5, SFX_80ae5_4_Ch5 + dbw CH7, SFX_80af8_4_Ch7 + +SFX_80114_4:: + dbw ( $80 | CH4 ), SFX_80be2_4_Ch4 + dbw CH5, SFX_80c05_4_Ch5 + dbw CH7, SFX_80c28_4_Ch7 + +SFX_8011d_4:: + dbw ( $80 | CH4 ), SFX_808fa_4_Ch4 + dbw CH5, SFX_80909_4_Ch5 + dbw CH7, SFX_8091b_4_Ch7 + +SFX_80126_4:: + dbw ( $80 | CH4 ), SFX_80b53_4_Ch4 + dbw CH5, SFX_80b6e_4_Ch5 + dbw CH7, SFX_80b89_4_Ch7 + +SFX_8012f_4:: + dbw ( $80 | CH4 ), SFX_80944_4_Ch4 + dbw CH5, SFX_8095b_4_Ch5 + dbw CH7, SFX_80972_4_Ch7 + +SFX_80138_4:: + dbw ( $80 | CH4 ), SFX_80b05_4_Ch4 + dbw CH5, SFX_80b28_4_Ch5 + dbw CH7, SFX_80b43_4_Ch7 + +SFX_80141_4:: + dbw ( $80 | CH4 ), SFX_80b9c_4_Ch4 + dbw CH5, SFX_80bb7_4_Ch5 + dbw CH7, SFX_80bd2_4_Ch7 + +SFX_8014a_4:: + dbw ( $80 | CH4 ), SFX_80a23_4_Ch4 + dbw CH5, SFX_80a46_4_Ch5 + dbw CH7, SFX_80a6d_4_Ch7 + +SFX_80153_4:: + dbw ( $80 | CH4 ), SFX_80c3b_4_Ch4 + dbw CH5, SFX_80c4e_4_Ch5 + dbw CH7, SFX_80c61_4_Ch7 + +SFX_8015c_4:: + dbw ( $80 | CH4 ), SFX_80c6e_4_Ch4 + dbw CH5, SFX_80c81_4_Ch5 + dbw CH7, SFX_80c94_4_Ch7 + +SFX_80165_4:: + dbw ( $80 | CH4 ), SFX_80ca1_4_Ch4 + dbw CH5, SFX_80cc4_4_Ch5 + dbw CH7, SFX_80ce6_4_Ch7 + +SFX_8016e_4:: + dbw ( $80 | CH4 ), SFX_80ce7_4_Ch4 + dbw CH5, SFX_80cfa_4_Ch5 + dbw CH7, SFX_80d0d_4_Ch7 + +SFX_80177_4:: + dbw ( $80 | CH4 ), SFX_803da_4_Ch4 + dbw CH5, SFX_803f1_4_Ch5 + dbw CH7, SFX_80404_4_Ch7 + +SFX_80180_4:: + dbw ( $80 | CH4 ), SFX_80411_4_Ch4 + dbw CH5, SFX_80434_4_Ch5 + dbw CH7, SFX_80457_4_Ch7 + +SFX_80189_4:: + dbw ( $80 | CH4 ), SFX_804bf_4_Ch4 + dbw CH5, SFX_804d6_4_Ch5 + dbw CH7, SFX_804ed_4_Ch7 + +SFX_Get_Item1_4:: + dbw ( $80 | CH4 ), SFX_80e5a_4_Ch4 + dbw CH5, SFX_80e71_4_Ch5 + dbw CH6, SFX_80e81_4_Ch6 + +SFX_Get_Item2_4:: + dbw ( $80 | CH4 ), SFX_80ec8_4_Ch4 + dbw CH5, SFX_80ee7_4_Ch5 + dbw CH6, SFX_80eff_4_Ch6 + +SFX_Tink_4:: + dbw CH4, SFX_8028e_4_Ch4 + +SFX_Heal_Ailment_4:: + dbw CH4, SFX_8027f_4_Ch4 + +SFX_Start_Menu_4:: + dbw CH4, SFX_8026a_4_Ch4 + +SFX_PressAB_4:: + dbw CH7, SFX_80263_4_Ch7 + +SFX_801b0_4:: + dbw CH4, SFX_80250_4_Ch4 + +SFX_801b3_4:: + dbw CH7, SFX_8029f_4_Ch7 + +SFX_801b6_4:: + dbw CH4, SFX_802b5_4_Ch4 + +SFX_801b9_4:: + dbw CH7, SFX_802e1_4_Ch7 + +SFX_801bc_4:: + dbw CH4, SFX_802cc_4_Ch4 + +SFX_801bf_4:: + dbw CH7, SFX_802d7_4_Ch7 + +SFX_Get_Item2_4_2:: + dbw ( $80 | CH4 ), SFX_Get_Item2_4_2_Ch1 + dbw CH5, SFX_Get_Item2_4_2_Ch2 + dbw CH6, SFX_Get_Item2_4_2_Ch3 diff --git a/audio/music/dungeon1.asm b/audio/music/dungeon1.asm index c84fc694..825207b8 100644 --- a/audio/music/dungeon1.asm +++ b/audio/music/dungeon1.asm @@ -6,10 +6,8 @@ Music_Dungeon1_Ch1:: vibrato 10, 1, 4 notetype 12, 4, 13 rest 8 - stereopanning 237 octave 4 F# 8 - stereopanning 255 Music_Dungeon1_branch_7dee5:: notetype 12, 11, 2 diff --git a/audio/music/yellow/meetjessiejames.asm b/audio/music/meetjessiejames.asm index 086fef53..086fef53 100644 --- a/audio/music/yellow/meetjessiejames.asm +++ b/audio/music/meetjessiejames.asm diff --git a/audio/music/printer.asm b/audio/music/printer.asm new file mode 100755 index 00000000..853aa290 --- /dev/null +++ b/audio/music/printer.asm @@ -0,0 +1,316 @@ +Music_GBPrinter_Ch3: + tempo 256 + notetype 12, 1, 0 + octave 4 + B_ 6 + octave 5 + C# 1 + rest 1 + octave 4 + B_ 6 + octave 5 + C# 1 + rest 1 + octave 4 + B_ 1 + rest 1 + octave 5 + E_ 1 + rest 1 + D# 1 + rest 1 + C# 1 + rest 1 + octave 4 + B_ 1 + rest 1 + A_ 1 + rest 1 + G# 1 + rest 1 + F# 1 + rest 1 +.loop: + E_ 1 + rest 1 + B_ 1 + rest 1 + E_ 1 + rest 1 + B_ 1 + rest 1 + E_ 1 + rest 1 + B_ 1 + rest 1 + E_ 1 + rest 1 + B_ 1 + rest 1 + E_ 1 + rest 1 + B_ 1 + rest 1 + E_ 1 + rest 1 + B_ 1 + rest 1 + E_ 1 + rest 1 + B_ 1 + rest 1 + E_ 1 + rest 1 + B_ 1 + rest 1 + F# 1 + rest 1 + A_ 1 + rest 1 + F# 1 + rest 1 + A_ 1 + rest 1 + F# 1 + rest 1 + octave 5 + C# 1 + C_ 1 + C# 1 + rest 1 + octave 4 + F# 1 + rest 1 + E_ 1 + rest 1 + G# 1 + rest 1 + E_ 1 + rest 1 + G# 1 + rest 1 + E_ 1 + rest 1 + octave 5 + E_ 1 + D# 1 + E_ 1 + rest 1 + octave 4 + D# 1 + rest 1 + E_ 1 + rest 1 + B_ 1 + rest 1 + E_ 1 + rest 1 + B_ 1 + rest 1 + E_ 1 + rest 1 + B_ 1 + rest 1 + E_ 1 + rest 1 + B_ 1 + rest 1 + E_ 1 + rest 1 + B_ 1 + rest 1 + E_ 1 + rest 1 + B_ 1 + rest 1 + E_ 1 + rest 1 + B_ 1 + rest 1 + E_ 1 + rest 1 + B_ 1 + rest 1 + F# 1 + rest 1 + A_ 1 + rest 1 + F# 1 + rest 1 + A_ 1 + rest 1 + B_ 1 + rest 1 + A_ 1 + rest 1 + G# 1 + rest 1 + F# 1 + rest 1 + E_ 1 + rest 1 + B_ 1 + rest 1 + E_ 1 + rest 1 + B_ 1 + rest 1 + E_ 1 + rest 1 + octave 3 + B_ 1 + rest 1 + octave 4 + C# 1 + rest 1 + D_ 1 + rest 1 + D# 1 + rest 1 + F# 1 + rest 1 + octave 3 + B_ 1 + rest 1 + octave 4 + F# 1 + rest 1 + D# 1 + rest 1 + F# 1 + rest 1 + octave 3 + B_ 1 + rest 1 + octave 4 + F# 1 + rest 1 + E_ 1 + rest 1 + G# 1 + rest 1 + octave 3 + B_ 1 + rest 1 + octave 4 + G# 1 + rest 1 + E_ 1 + rest 1 + G# 1 + rest 1 + octave 3 + B_ 1 + rest 1 + octave 4 + G# 1 + rest 1 + F# 1 + rest 1 + A_ 1 + rest 1 + C# 1 + rest 1 + A_ 1 + rest 1 + F# 1 + rest 1 + A_ 1 + rest 1 + C# 1 + rest 1 + A_ 1 + rest 1 + B_ 1 + A# 1 + B_ 1 + rest 1 + E_ 1 + rest 1 + F# 1 + rest 1 + G# 1 + rest 1 + octave 3 + B_ 1 + rest 1 + octave 4 + C# 1 + rest 1 + D_ 1 + rest 1 + D# 1 + rest 1 + F# 1 + rest 1 + octave 3 + B_ 1 + rest 1 + octave 4 + F# 1 + rest 1 + D# 1 + rest 1 + F# 1 + rest 1 + octave 3 + B_ 1 + rest 1 + octave 4 + F# 1 + rest 1 + E_ 1 + rest 1 + G# 1 + rest 1 + octave 3 + B_ 1 + rest 1 + octave 4 + G# 1 + rest 1 + E_ 1 + rest 1 + G# 1 + rest 1 + octave 3 + B_ 1 + rest 1 + octave 4 + G# 1 + rest 1 + F# 1 + rest 1 + A_ 1 + rest 1 + C# 1 + rest 1 + A_ 1 + rest 1 + F# 1 + rest 1 + A_ 1 + rest 1 + F# 1 + rest 1 + D# 1 + rest 1 + B_ 1 + rest 1 + B_ 1 + rest 1 + A_ 1 + rest 1 + A_ 1 + rest 1 + G# 1 + rest 1 + octave 3 + B_ 1 + rest 1 + octave 4 + C# 1 + rest 1 + D# 1 + rest 1 + loopchannel 0, .loop diff --git a/audio/music/yellow/surfingpikachu.asm b/audio/music/surfingpikachu.asm index 1ee3f760..1ee3f760 100644 --- a/audio/music/yellow/surfingpikachu.asm +++ b/audio/music/surfingpikachu.asm diff --git a/audio/music/yellow/yellowintro.asm b/audio/music/yellowintro.asm index c809d10f..c809d10f 100644 --- a/audio/music/yellow/yellowintro.asm +++ b/audio/music/yellowintro.asm diff --git a/audio/music/yellow/yellowunusedsong.asm b/audio/music/yellowunusedsong.asm index f65ca164..f65ca164 100644 --- a/audio/music/yellow/yellowunusedsong.asm +++ b/audio/music/yellowunusedsong.asm diff --git a/audio/pikachu_cries/pikachu_cry_1.wav b/audio/pikachu_cries/pikachu_cry_1.wav Binary files differnew file mode 100644 index 00000000..98714511 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_1.wav diff --git a/audio/pikachu_cries/pikachu_cry_10.wav b/audio/pikachu_cries/pikachu_cry_10.wav Binary files differnew file mode 100644 index 00000000..e51a2979 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_10.wav diff --git a/audio/pikachu_cries/pikachu_cry_11.wav b/audio/pikachu_cries/pikachu_cry_11.wav Binary files differnew file mode 100644 index 00000000..44eece5a --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_11.wav diff --git a/audio/pikachu_cries/pikachu_cry_12.wav b/audio/pikachu_cries/pikachu_cry_12.wav Binary files differnew file mode 100644 index 00000000..cad90cfe --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_12.wav diff --git a/audio/pikachu_cries/pikachu_cry_13.wav b/audio/pikachu_cries/pikachu_cry_13.wav Binary files differnew file mode 100644 index 00000000..981768b5 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_13.wav diff --git a/audio/pikachu_cries/pikachu_cry_14.wav b/audio/pikachu_cries/pikachu_cry_14.wav Binary files differnew file mode 100644 index 00000000..3da9a543 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_14.wav diff --git a/audio/pikachu_cries/pikachu_cry_15.wav b/audio/pikachu_cries/pikachu_cry_15.wav Binary files differnew file mode 100644 index 00000000..4ef874c3 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_15.wav diff --git a/audio/pikachu_cries/pikachu_cry_16.wav b/audio/pikachu_cries/pikachu_cry_16.wav Binary files differnew file mode 100644 index 00000000..baddf17c --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_16.wav diff --git a/audio/pikachu_cries/pikachu_cry_17.wav b/audio/pikachu_cries/pikachu_cry_17.wav Binary files differnew file mode 100644 index 00000000..f8bd9c73 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_17.wav diff --git a/audio/pikachu_cries/pikachu_cry_18.wav b/audio/pikachu_cries/pikachu_cry_18.wav Binary files differnew file mode 100644 index 00000000..69b2d3b8 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_18.wav diff --git a/audio/pikachu_cries/pikachu_cry_19.wav b/audio/pikachu_cries/pikachu_cry_19.wav Binary files differnew file mode 100644 index 00000000..a9429132 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_19.wav diff --git a/audio/pikachu_cries/pikachu_cry_2.wav b/audio/pikachu_cries/pikachu_cry_2.wav Binary files differnew file mode 100644 index 00000000..d95343de --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_2.wav diff --git a/audio/pikachu_cries/pikachu_cry_20.wav b/audio/pikachu_cries/pikachu_cry_20.wav Binary files differnew file mode 100644 index 00000000..1c1842e4 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_20.wav diff --git a/audio/pikachu_cries/pikachu_cry_21.wav b/audio/pikachu_cries/pikachu_cry_21.wav Binary files differnew file mode 100644 index 00000000..d74ebc12 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_21.wav diff --git a/audio/pikachu_cries/pikachu_cry_22.wav b/audio/pikachu_cries/pikachu_cry_22.wav Binary files differnew file mode 100644 index 00000000..89fa5c77 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_22.wav diff --git a/audio/pikachu_cries/pikachu_cry_23.wav b/audio/pikachu_cries/pikachu_cry_23.wav Binary files differnew file mode 100644 index 00000000..ea092080 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_23.wav diff --git a/audio/pikachu_cries/pikachu_cry_24.wav b/audio/pikachu_cries/pikachu_cry_24.wav Binary files differnew file mode 100644 index 00000000..ec51d8cb --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_24.wav diff --git a/audio/pikachu_cries/pikachu_cry_25.wav b/audio/pikachu_cries/pikachu_cry_25.wav Binary files differnew file mode 100644 index 00000000..77dac608 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_25.wav diff --git a/audio/pikachu_cries/pikachu_cry_26.wav b/audio/pikachu_cries/pikachu_cry_26.wav Binary files differnew file mode 100644 index 00000000..9a9a0776 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_26.wav diff --git a/audio/pikachu_cries/pikachu_cry_27.wav b/audio/pikachu_cries/pikachu_cry_27.wav Binary files differnew file mode 100644 index 00000000..44a79ee0 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_27.wav diff --git a/audio/pikachu_cries/pikachu_cry_28.wav b/audio/pikachu_cries/pikachu_cry_28.wav Binary files differnew file mode 100644 index 00000000..ccf8bde2 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_28.wav diff --git a/audio/pikachu_cries/pikachu_cry_29.wav b/audio/pikachu_cries/pikachu_cry_29.wav Binary files differnew file mode 100644 index 00000000..fb3375b3 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_29.wav diff --git a/audio/pikachu_cries/pikachu_cry_3.wav b/audio/pikachu_cries/pikachu_cry_3.wav Binary files differnew file mode 100644 index 00000000..d3423966 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_3.wav diff --git a/audio/pikachu_cries/pikachu_cry_30.wav b/audio/pikachu_cries/pikachu_cry_30.wav Binary files differnew file mode 100644 index 00000000..9bdafdc2 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_30.wav diff --git a/audio/pikachu_cries/pikachu_cry_31.wav b/audio/pikachu_cries/pikachu_cry_31.wav Binary files differnew file mode 100644 index 00000000..2853bc0b --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_31.wav diff --git a/audio/pikachu_cries/pikachu_cry_32.wav b/audio/pikachu_cries/pikachu_cry_32.wav Binary files differnew file mode 100644 index 00000000..8ded504e --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_32.wav diff --git a/audio/pikachu_cries/pikachu_cry_33.wav b/audio/pikachu_cries/pikachu_cry_33.wav Binary files differnew file mode 100644 index 00000000..9be38b10 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_33.wav diff --git a/audio/pikachu_cries/pikachu_cry_34.wav b/audio/pikachu_cries/pikachu_cry_34.wav Binary files differnew file mode 100644 index 00000000..45986668 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_34.wav diff --git a/audio/pikachu_cries/pikachu_cry_35.wav b/audio/pikachu_cries/pikachu_cry_35.wav Binary files differnew file mode 100644 index 00000000..91b4d35b --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_35.wav diff --git a/audio/pikachu_cries/pikachu_cry_36.wav b/audio/pikachu_cries/pikachu_cry_36.wav Binary files differnew file mode 100644 index 00000000..789f9ca6 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_36.wav diff --git a/audio/pikachu_cries/pikachu_cry_37.wav b/audio/pikachu_cries/pikachu_cry_37.wav Binary files differnew file mode 100644 index 00000000..bc004c25 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_37.wav diff --git a/audio/pikachu_cries/pikachu_cry_38.wav b/audio/pikachu_cries/pikachu_cry_38.wav Binary files differnew file mode 100644 index 00000000..b7d23e25 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_38.wav diff --git a/audio/pikachu_cries/pikachu_cry_39.wav b/audio/pikachu_cries/pikachu_cry_39.wav Binary files differnew file mode 100644 index 00000000..da02dee2 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_39.wav diff --git a/audio/pikachu_cries/pikachu_cry_4.wav b/audio/pikachu_cries/pikachu_cry_4.wav Binary files differnew file mode 100644 index 00000000..8cfc1041 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_4.wav diff --git a/audio/pikachu_cries/pikachu_cry_40.wav b/audio/pikachu_cries/pikachu_cry_40.wav Binary files differnew file mode 100644 index 00000000..a048a408 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_40.wav diff --git a/audio/pikachu_cries/pikachu_cry_41.wav b/audio/pikachu_cries/pikachu_cry_41.wav Binary files differnew file mode 100644 index 00000000..bbf5eabd --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_41.wav diff --git a/audio/pikachu_cries/pikachu_cry_42.wav b/audio/pikachu_cries/pikachu_cry_42.wav Binary files differnew file mode 100644 index 00000000..cd18baa0 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_42.wav diff --git a/audio/pikachu_cries/pikachu_cry_5.wav b/audio/pikachu_cries/pikachu_cry_5.wav Binary files differnew file mode 100644 index 00000000..a2293acd --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_5.wav diff --git a/audio/pikachu_cries/pikachu_cry_6.wav b/audio/pikachu_cries/pikachu_cry_6.wav Binary files differnew file mode 100644 index 00000000..814d7139 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_6.wav diff --git a/audio/pikachu_cries/pikachu_cry_7.wav b/audio/pikachu_cries/pikachu_cry_7.wav Binary files differnew file mode 100644 index 00000000..6ffa781f --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_7.wav diff --git a/audio/pikachu_cries/pikachu_cry_8.wav b/audio/pikachu_cries/pikachu_cry_8.wav Binary files differnew file mode 100644 index 00000000..04218660 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_8.wav diff --git a/audio/pikachu_cries/pikachu_cry_9.wav b/audio/pikachu_cries/pikachu_cry_9.wav Binary files differnew file mode 100644 index 00000000..484c92bc --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_9.wav diff --git a/audio/sfx/battle_29.asm b/audio/sfx/battle_29.asm index d0abb3cb..0db98b36 100644 --- a/audio/sfx/battle_29.asm +++ b/audio/sfx/battle_29.asm @@ -1,17 +1,17 @@ -SFX_Battle_29_Ch1: +SFX_Earthquake_Ch1: dutycycle 201 unknownsfx0x20 11, 243, 32, 1 unknownsfx0x20 9, 211, 80, 1 - loopchannel 5, SFX_Battle_29_Ch1 + loopchannel 5, SFX_Earthquake_Ch1 unknownsfx0x20 8, 227, 48, 1 unknownsfx0x20 15, 194, 16, 1 endchannel -SFX_Battle_29_Ch2: +SFX_Earthquake_Ch2: unknownnoise0x20 10, 243, 53 unknownnoise0x20 14, 246, 69 - loopchannel 4, SFX_Battle_29_Ch2 + loopchannel 4, SFX_Earthquake_Ch2 unknownnoise0x20 12, 244, 188 unknownnoise0x20 12, 245, 156 unknownnoise0x20 15, 244, 172 diff --git a/audio/sfx/battle_2f.asm b/audio/sfx/battle_2f.asm index ad607993..f511c832 100644 --- a/audio/sfx/battle_2f.asm +++ b/audio/sfx/battle_2f.asm @@ -1,21 +1,21 @@ -SFX_Battle_2F_Ch1: +SFX_Thunderbolt_Ch1: dutycycle 43 unknownsfx0x20 3, 241, 240, 7 unknownsfx0x20 4, 242, 0, 2 - loopchannel 8, SFX_Battle_2F_Ch1 + loopchannel 8, SFX_Thunderbolt_Ch1 endchannel -SFX_Battle_2F_Ch2: +SFX_Thunderbolt_Ch2: dutycycle 179 unknownsfx0x20 4, 226, 2, 2 unknownsfx0x20 4, 225, 226, 7 - loopchannel 9, SFX_Battle_2F_Ch2 + loopchannel 9, SFX_Thunderbolt_Ch2 endchannel -SFX_Battle_2F_Ch3: +SFX_Thunderbolt_Ch3: unknownnoise0x20 4, 255, 67 unknownnoise0x20 4, 242, 68 - loopchannel 9, SFX_Battle_2F_Ch3 + loopchannel 9, SFX_Thunderbolt_Ch3 endchannel diff --git a/audio/sfx/cymbal1_4.asm b/audio/sfx/cymbal1_4.asm new file mode 100644 index 00000000..bd941ef5 --- /dev/null +++ b/audio/sfx/cymbal1_4.asm @@ -0,0 +1,4 @@ +SFX_Cymbal1_4_Ch7: + unknownnoise0x20 0, 161, 16 + endchannel + diff --git a/audio/sfx/cymbal2_4.asm b/audio/sfx/cymbal2_4.asm new file mode 100644 index 00000000..b33e10fc --- /dev/null +++ b/audio/sfx/cymbal2_4.asm @@ -0,0 +1,4 @@ +SFX_Cymbal2_4_Ch7: + unknownnoise0x20 0, 162, 17 + endchannel + diff --git a/audio/sfx/cymbal3_4.asm b/audio/sfx/cymbal3_4.asm new file mode 100644 index 00000000..b5e99c56 --- /dev/null +++ b/audio/sfx/cymbal3_4.asm @@ -0,0 +1,4 @@ +SFX_Cymbal3_4_Ch7: + unknownnoise0x20 0, 162, 80 + endchannel + diff --git a/audio/sfx/get_item2_4.asm b/audio/sfx/get_item2_4.asm new file mode 100644 index 00000000..b2909739 --- /dev/null +++ b/audio/sfx/get_item2_4.asm @@ -0,0 +1,67 @@ +SFX_80ec8_4_Ch4: + executemusic + tempo 256 + volume 7, 7 + duty 2 + toggleperfectpitch + notetype 5, 11, 4 + octave 4 + D_ 4 + C_ 4 + octave 3 + A_ 8 + notetype 5, 11, 2 + octave 4 + D# 2 + D# 2 + D_ 2 + C_ 2 + C_ 2 + octave 3 + A# 2 + notetype 5, 11, 4 + octave 4 + C_ 8 + endchannel + +SFX_80ee7_4_Ch5: + executemusic + vibrato 8, 2, 7 + duty 2 + notetype 5, 12, 5 + octave 4 + A_ 4 + F_ 4 + C_ 8 + notetype 5, 12, 2 + A# 2 + A# 2 + A# 2 + G_ 2 + G_ 2 + A# 2 + notetype 5, 12, 4 + A_ 8 + endchannel + +SFX_80eff_4_Ch6: + executemusic + notetype 5, 1, 0 + octave 5 + F_ 4 + D# 4 + C_ 8 + D# 1 + rest 1 + D# 1 + rest 1 + E_ 1 + rest 1 + F_ 1 + rest 1 + F_ 1 + rest 1 + G_ 1 + rest 1 + A_ 8 + endchannel diff --git a/audio/sfx/get_item2_4_2.asm b/audio/sfx/get_item2_4_2.asm new file mode 100644 index 00000000..4f7e38eb --- /dev/null +++ b/audio/sfx/get_item2_4_2.asm @@ -0,0 +1,69 @@ +SFX_Get_Item2_4_2_Ch1: + executemusic + tempo 256 + volume 7, 7 + duty 2 + toggleperfectpitch + notetype 5, 11, 4 + octave 4 + D_ 4 + C_ 4 + octave 3 + A_ 8 + notetype 5, 11, 2 + octave 4 + D# 2 + D# 2 + D_ 2 + C_ 2 + C_ 2 + octave 3 + A# 2 + notetype 5, 11, 4 + octave 4 + C_ 8 + endchannel + + +SFX_Get_Item2_4_2_Ch2: + executemusic + vibrato 8, 2, 7 + duty 2 + notetype 5, 12, 5 + octave 4 + A_ 4 + F_ 4 + C_ 8 + notetype 5, 12, 2 + A# 2 + A# 2 + A# 2 + G_ 2 + G_ 2 + A# 2 + notetype 5, 12, 4 + A_ 8 + endchannel + + +SFX_Get_Item2_4_2_Ch3: + executemusic + notetype 5, 1, 0 + octave 5 + F_ 4 + D# 4 + C_ 8 + D# 1 + rest 1 + D# 1 + rest 1 + E_ 1 + rest 1 + F_ 1 + rest 1 + F_ 1 + rest 1 + G_ 1 + rest 1 + A_ 8 + endchannel diff --git a/audio/sfx/heal_ailment_4.asm b/audio/sfx/heal_ailment_4.asm new file mode 100755 index 00000000..fd80517d --- /dev/null +++ b/audio/sfx/heal_ailment_4.asm @@ -0,0 +1,7 @@ +SFX_8027f_4_Ch4: + duty 2 + unknownsfx0x10 23 + unknownsfx0x20 15, 240, 240, 4 + unknownsfx0x20 15, 242, 80, 6 + unknownsfx0x10 8 + endchannel diff --git a/audio/sfx/muted_snare1_4.asm b/audio/sfx/muted_snare1_4.asm new file mode 100644 index 00000000..bcf8c54b --- /dev/null +++ b/audio/sfx/muted_snare1_4.asm @@ -0,0 +1,5 @@ +SFX_Muted_Snare1_4_Ch7: + unknownnoise0x20 0, 161, 24 + unknownnoise0x20 0, 49, 51 + endchannel + diff --git a/audio/sfx/muted_snare2_4.asm b/audio/sfx/muted_snare2_4.asm new file mode 100644 index 00000000..8934afe2 --- /dev/null +++ b/audio/sfx/muted_snare2_4.asm @@ -0,0 +1,4 @@ +SFX_Muted_Snare2_4_Ch7: + unknownnoise0x20 0, 145, 34 + endchannel + diff --git a/audio/sfx/muted_snare3_4.asm b/audio/sfx/muted_snare3_4.asm new file mode 100644 index 00000000..beeec087 --- /dev/null +++ b/audio/sfx/muted_snare3_4.asm @@ -0,0 +1,4 @@ +SFX_Muted_Snare3_4_Ch7: + unknownnoise0x20 0, 113, 34 + endchannel + diff --git a/audio/sfx/muted_snare4_4.asm b/audio/sfx/muted_snare4_4.asm new file mode 100644 index 00000000..7fc65086 --- /dev/null +++ b/audio/sfx/muted_snare4_4.asm @@ -0,0 +1,4 @@ +SFX_Muted_Snare4_4_Ch7: + unknownnoise0x20 0, 97, 34 + endchannel + diff --git a/audio/sfx/pokeflute_ch1_ch2.asm b/audio/sfx/pokeflute_ch1_ch2.asm index 84631bca..84631bca 100755..100644 --- a/audio/sfx/pokeflute_ch1_ch2.asm +++ b/audio/sfx/pokeflute_ch1_ch2.asm diff --git a/audio/sfx/pokeflute_ch3.asm b/audio/sfx/pokeflute_ch3.asm index 3c883462..3c883462 100755..100644 --- a/audio/sfx/pokeflute_ch3.asm +++ b/audio/sfx/pokeflute_ch3.asm diff --git a/audio/sfx/save_3.asm b/audio/sfx/save_3.asm index ad049ec6..7f0df72c 100644 --- a/audio/sfx/save_3.asm +++ b/audio/sfx/save_3.asm @@ -1,36 +1,18 @@ SFX_Save_3_Ch1: duty 2 -IF DEF(_RED) - unknownsfx0x20 4, 244, 0, 7 - unknownsfx0x20 3, 228, 128, 6 - unknownsfx0x20 3, 228, 192, 6 - unknownsfx0x20 3, 228, 0, 7 - unknownsfx0x20 2, 228, 160, 7 -ELSE unknownsfx0x20 3, 228, 0, 6 unknownsfx0x20 3, 228, 128, 6 unknownsfx0x20 3, 228, 192, 6 unknownsfx0x20 3, 228, 0, 7 unknownsfx0x20 15, 242, 224, 7 -ENDC endchannel - SFX_Save_3_Ch2: duty 2 -IF DEF(_RED) - unknownsfx0x20 4, 8, 0, 0 - unknownsfx0x20 3, 212, 1, 7 - unknownsfx0x20 3, 196, 129, 6 - unknownsfx0x20 3, 196, 193, 6 - unknownsfx0x20 3, 196, 1, 7 - unknownsfx0x20 2, 196, 161, 7 -ELSE unknownsfx0x20 3, 8, 0, 0 unknownsfx0x20 3, 196, 1, 6 unknownsfx0x20 3, 196, 129, 6 unknownsfx0x20 3, 196, 193, 6 unknownsfx0x20 3, 196, 1, 7 unknownsfx0x20 15, 210, 225, 7 -ENDC endchannel diff --git a/audio/sfx/shooting_star.asm b/audio/sfx/shooting_star.asm index f8b8e285..282f83b5 100644 --- a/audio/sfx/shooting_star.asm +++ b/audio/sfx/shooting_star.asm @@ -1,5 +1,5 @@ SFX_Shooting_Star_Ch1: - dutycycle 228 + dutycycle 136 unknownsfx0x10 47 unknownsfx0x20 4, 64, 224, 7 unknownsfx0x20 4, 96, 224, 7 diff --git a/audio/sfx/snare1_4.asm b/audio/sfx/snare1_4.asm new file mode 100755 index 00000000..4ba3b8c5 --- /dev/null +++ b/audio/sfx/snare1_4.asm @@ -0,0 +1,4 @@ +SFX_Snare1_4_Ch7: ; 841ec + unknownnoise0x20 0, 193, 51 + endchannel + diff --git a/audio/sfx/snare2_4.asm b/audio/sfx/snare2_4.asm new file mode 100755 index 00000000..dc1a26a9 --- /dev/null +++ b/audio/sfx/snare2_4.asm @@ -0,0 +1,4 @@ +SFX_Snare2_4_Ch7: ; 841f0 + unknownnoise0x20 0, 177, 51 + endchannel + diff --git a/audio/sfx/snare3_4.asm b/audio/sfx/snare3_4.asm new file mode 100755 index 00000000..a0fcb0d7 --- /dev/null +++ b/audio/sfx/snare3_4.asm @@ -0,0 +1,4 @@ +SFX_Snare3_4_Ch7: + unknownnoise0x20 0, 161, 51 + endchannel + diff --git a/audio/sfx/snare4_4.asm b/audio/sfx/snare4_4.asm new file mode 100644 index 00000000..c1d5cc21 --- /dev/null +++ b/audio/sfx/snare4_4.asm @@ -0,0 +1,4 @@ +SFX_Snare4_4_Ch7: + unknownnoise0x20 0, 129, 51 + endchannel + diff --git a/audio/sfx/snare5_4.asm b/audio/sfx/snare5_4.asm new file mode 100644 index 00000000..37fe8b27 --- /dev/null +++ b/audio/sfx/snare5_4.asm @@ -0,0 +1,9 @@ +SFX_Snare5_4_Ch7: + unknownnoise0x20 7, 132, 55 + unknownnoise0x20 6, 132, 54 + unknownnoise0x20 5, 131, 53 + unknownnoise0x20 4, 131, 52 + unknownnoise0x20 3, 130, 51 + unknownnoise0x20 2, 129, 50 + endchannel + diff --git a/audio/sfx/snare6_4.asm b/audio/sfx/snare6_4.asm new file mode 100644 index 00000000..1b835f00 --- /dev/null +++ b/audio/sfx/snare6_4.asm @@ -0,0 +1,4 @@ +SFX_Snare6_4_Ch7: + unknownnoise0x20 0, 129, 16 + endchannel + diff --git a/audio/sfx/snare7_4.asm b/audio/sfx/snare7_4.asm new file mode 100644 index 00000000..ed03d368 --- /dev/null +++ b/audio/sfx/snare7_4.asm @@ -0,0 +1,4 @@ +SFX_Snare7_4_Ch7: + unknownnoise0x20 0, 130, 35 + endchannel + diff --git a/audio/sfx/snare8_4.asm b/audio/sfx/snare8_4.asm new file mode 100644 index 00000000..ec0e6665 --- /dev/null +++ b/audio/sfx/snare8_4.asm @@ -0,0 +1,4 @@ +SFX_Snare8_4_Ch7: + unknownnoise0x20 0, 130, 37 + endchannel + diff --git a/audio/sfx/snare9_4.asm b/audio/sfx/snare9_4.asm new file mode 100644 index 00000000..254e9ce6 --- /dev/null +++ b/audio/sfx/snare9_4.asm @@ -0,0 +1,4 @@ +SFX_Snare9_4_Ch7: + unknownnoise0x20 0, 130, 38 + endchannel + diff --git a/audio/sfx/swap_2.asm b/audio/sfx/swap_2.asm new file mode 100644 index 00000000..270cf15b --- /dev/null +++ b/audio/sfx/swap_2.asm @@ -0,0 +1,11 @@ +SFX_Swap_2_Ch1: + duty 2 + unknownsfx0x20 8, 225, 64, 7 + endchannel + + +SFX_Swap_2_Ch2: + duty 2 + unknownsfx0x20 2, 8, 0, 0 + unknownsfx0x20 8, 177, 65, 7 + endchannel diff --git a/audio/sfx/tink_4.asm b/audio/sfx/tink_4.asm new file mode 100755 index 00000000..4efa3209 --- /dev/null +++ b/audio/sfx/tink_4.asm @@ -0,0 +1,8 @@ +SFX_8028e_4_Ch4: + duty 2 + unknownsfx0x10 58 + unknownsfx0x20 4, 242, 0, 2 + unknownsfx0x10 34 + unknownsfx0x20 8, 226, 0, 2 + unknownsfx0x10 8 + endchannel diff --git a/audio/sfx/triangle1_4.asm b/audio/sfx/triangle1_4.asm new file mode 100644 index 00000000..a90e4c48 --- /dev/null +++ b/audio/sfx/triangle1_4.asm @@ -0,0 +1,4 @@ +SFX_Triangle1_4_Ch7: + unknownnoise0x20 0, 81, 42 + endchannel + diff --git a/audio/sfx/triangle2_4.asm b/audio/sfx/triangle2_4.asm new file mode 100644 index 00000000..58b6d511 --- /dev/null +++ b/audio/sfx/triangle2_4.asm @@ -0,0 +1,5 @@ +SFX_Triangle2_4_Ch7: + unknownnoise0x20 1, 65, 43 + unknownnoise0x20 0, 97, 42 + endchannel + diff --git a/audio/sfx/triangle3_4.asm b/audio/sfx/triangle3_4.asm new file mode 100644 index 00000000..a2fab704 --- /dev/null +++ b/audio/sfx/triangle3_4.asm @@ -0,0 +1,5 @@ +SFX_Triangle3_4_Ch7: + unknownnoise0x20 2, 145, 40 + unknownnoise0x20 0, 113, 24 + endchannel + diff --git a/audio/sfx/unknown_80250.asm b/audio/sfx/unknown_80250.asm new file mode 100644 index 00000000..4f65a6a0 --- /dev/null +++ b/audio/sfx/unknown_80250.asm @@ -0,0 +1,7 @@ +SFX_80250_4_Ch4: + duty 2 + unknownsfx0x20 0, 145, 192, 7 + unknownsfx0x20 0, 129, 208, 7 + unknownsfx0x20 0, 145, 192, 7 + unknownsfx0x20 12, 161, 208, 7 + endchannel diff --git a/audio/sfx/unknown_80263.asm b/audio/sfx/unknown_80263.asm new file mode 100755 index 00000000..884c1352 --- /dev/null +++ b/audio/sfx/unknown_80263.asm @@ -0,0 +1,4 @@ +SFX_80263_4_Ch7: + unknownnoise0x20 1, 226, 51 + unknownnoise0x20 8, 225, 34 + endchannel diff --git a/audio/sfx/unknown_8026a.asm b/audio/sfx/unknown_8026a.asm new file mode 100644 index 00000000..9dd6a02b --- /dev/null +++ b/audio/sfx/unknown_8026a.asm @@ -0,0 +1,10 @@ +SFX_8026a_4_Ch4: + duty 2 + unknownsfx0x10 20 + unknownsfx0x20 4, 242, 0, 6 + unknownsfx0x20 4, 242, 0, 6 + unknownsfx0x10 23 + unknownsfx0x20 15, 242, 0, 6 + unknownsfx0x10 8 + endchannel + diff --git a/audio/sfx/unknown_8029f.asm b/audio/sfx/unknown_8029f.asm new file mode 100755 index 00000000..475c2813 --- /dev/null +++ b/audio/sfx/unknown_8029f.asm @@ -0,0 +1,10 @@ +SFX_8029f_4_Ch7: + unknownnoise0x20 6, 241, 17 + unknownnoise0x20 7, 242, 34 + unknownnoise0x20 8, 243, 51 + unknownnoise0x20 9, 244, 66 + unknownnoise0x20 10, 245, 51 + unknownnoise0x20 11, 246, 34 + unknownnoise0x20 12, 247, 17 + endchannel + diff --git a/audio/sfx/unknown_802b5.asm b/audio/sfx/unknown_802b5.asm new file mode 100644 index 00000000..364443cf --- /dev/null +++ b/audio/sfx/unknown_802b5.asm @@ -0,0 +1,8 @@ +SFX_802b5_4_Ch4: + duty 2 + unknownsfx0x20 3, 196, 96, 7 + unknownsfx0x20 0, 164, 64, 7 + unknownsfx0x20 2, 196, 64, 7 + unknownsfx0x20 0, 164, 96, 7 + unknownsfx0x20 15, 193, 96, 7 + endchannel diff --git a/audio/sfx/unknown_802cc.asm b/audio/sfx/unknown_802cc.asm new file mode 100755 index 00000000..9e209638 --- /dev/null +++ b/audio/sfx/unknown_802cc.asm @@ -0,0 +1,5 @@ +SFX_802cc_4_Ch4: + duty 2 + unknownsfx0x20 3, 180, 192, 7 + unknownsfx0x20 0, 161, 128, 7 + endchannel diff --git a/audio/sfx/unknown_802d7.asm b/audio/sfx/unknown_802d7.asm new file mode 100755 index 00000000..4a1f1ab4 --- /dev/null +++ b/audio/sfx/unknown_802d7.asm @@ -0,0 +1,6 @@ +SFX_802d7_4_Ch7: + unknownnoise0x20 2, 241, 50 + unknownnoise0x20 2, 0, 0 + unknownnoise0x20 4, 230, 33 + endchannel + diff --git a/audio/sfx/unknown_802e1.asm b/audio/sfx/unknown_802e1.asm new file mode 100644 index 00000000..e1963b23 --- /dev/null +++ b/audio/sfx/unknown_802e1.asm @@ -0,0 +1,6 @@ +SFX_802e1_4_Ch7: + unknownnoise0x20 3, 243, 102 + unknownnoise0x20 3, 51, 83 + unknownnoise0x20 7, 245, 81 + endchannel + diff --git a/audio/sfx/unknown_80337.asm b/audio/sfx/unknown_80337.asm new file mode 100644 index 00000000..c21f8794 --- /dev/null +++ b/audio/sfx/unknown_80337.asm @@ -0,0 +1,64 @@ +SFX_80337_4_Branch: + dutycycle 240 + unknownsfx0x20 15, 224, 128, 7 + unknownsfx0x20 15, 240, 132, 7 + unknownsfx0x20 15, 195, 224, 5 + unknownsfx0x20 15, 196, 0, 6 + unknownsfx0x20 10, 108, 128, 7 + unknownsfx0x20 8, 113, 132, 7 + endchannel + +SFX_80352_4_Branch: + dutycycle 5 + unknownsfx0x20 15, 160, 65, 7 + unknownsfx0x20 15, 176, 67, 7 + unknownsfx0x20 15, 147, 177, 5 + unknownsfx0x20 15, 148, 193, 5 + unknownsfx0x20 10, 76, 65, 7 + unknownsfx0x20 8, 49, 70, 7 + endchannel + +SFX_8036c_4_Branch: + unknownnoise0x20 2, 242, 76 + unknownnoise0x20 6, 224, 58 + unknownnoise0x20 15, 208, 58 + unknownnoise0x20 8, 208, 44 + unknownnoise0x20 6, 230, 76 + unknownnoise0x20 12, 125, 76 + unknownnoise0x20 15, 211, 76 + endchannel + +SFX_80383_4_Ch4: + dutycycle 240 + unknownsfx0x20 15, 247, 160, 7 + unknownsfx0x20 6, 230, 163, 7 + unknownsfx0x20 10, 244, 160, 7 + dutycycle 165 + unknownsfx0x20 10, 246, 216, 7 + unknownsfx0x20 4, 227, 215, 7 + unknownsfx0x20 15, 242, 216, 7 + endchannel + +SFX_803a0_4_Ch5: + dutycycle 5 + unknownsfx0x20 2, 8, 0, 0 + unknownsfx0x20 15, 167, 161, 6 + unknownsfx0x20 6, 134, 162, 6 + unknownsfx0x20 10, 116, 161, 6 + dutycycle 95 + unknownsfx0x20 10, 118, 214, 6 + unknownsfx0x20 4, 131, 217, 6 + unknownsfx0x20 15, 162, 215, 6 + endchannel + +SFX_803c1_4_Ch7: + unknownnoise0x20 2, 242, 60 + unknownnoise0x20 8, 228, 62 + unknownnoise0x20 15, 215, 60 + unknownnoise0x20 6, 197, 59 + unknownnoise0x20 6, 228, 61 + unknownnoise0x20 8, 182, 60 + unknownnoise0x20 6, 212, 61 + unknownnoise0x20 8, 193, 59 + endchannel + diff --git a/audio/sfx/unknown_803da.asm b/audio/sfx/unknown_803da.asm new file mode 100644 index 00000000..442bd112 --- /dev/null +++ b/audio/sfx/unknown_803da.asm @@ -0,0 +1,24 @@ +SFX_803da_4_Ch4: + dutycycle 240 + unknownsfx0x20 15, 247, 192, 7 + unknownsfx0x20 6, 228, 193, 7 + unknownsfx0x20 10, 246, 192, 7 + unknownsfx0x20 4, 211, 194, 7 + unknownsfx0x20 8, 193, 192, 7 + endchannel + +SFX_803f1_4_Ch5: + dutycycle 95 + unknownsfx0x20 15, 151, 129, 7 + unknownsfx0x20 6, 132, 128, 7 + unknownsfx0x20 10, 150, 129, 7 + unknownsfx0x20 15, 131, 129, 7 + endchannel + +SFX_80404_4_Ch7: + unknownnoise0x20 3, 242, 60 + unknownnoise0x20 13, 230, 44 + unknownnoise0x20 15, 215, 60 + unknownnoise0x20 8, 193, 44 + endchannel + diff --git a/audio/sfx/unknown_80411.asm b/audio/sfx/unknown_80411.asm new file mode 100644 index 00000000..4ef49cdf --- /dev/null +++ b/audio/sfx/unknown_80411.asm @@ -0,0 +1,32 @@ +SFX_80411_4_Ch4: + dutycycle 240 + unknownsfx0x20 15, 247, 128, 6 + unknownsfx0x20 10, 230, 132, 6 + unknownsfx0x20 15, 215, 144, 6 + unknownsfx0x20 8, 213, 144, 6 + unknownsfx0x20 6, 196, 136, 6 + unknownsfx0x20 5, 211, 112, 6 + unknownsfx0x20 4, 211, 96, 6 + unknownsfx0x20 8, 193, 64, 6 + endchannel + +SFX_80434_4_Ch5: + dutycycle 5 + unknownsfx0x20 15, 183, 65, 6 + unknownsfx0x20 10, 150, 66, 6 + unknownsfx0x20 15, 167, 81, 6 + unknownsfx0x20 8, 165, 81, 6 + unknownsfx0x20 6, 148, 71, 6 + unknownsfx0x20 5, 163, 49, 6 + unknownsfx0x20 4, 147, 34, 6 + unknownsfx0x20 8, 113, 1, 6 + endchannel + +SFX_80457_4_Ch7: + unknownnoise0x20 15, 228, 60 + unknownnoise0x20 10, 199, 76 + unknownnoise0x20 10, 199, 60 + unknownnoise0x20 12, 183, 76 + unknownnoise0x20 15, 162, 92 + endchannel + diff --git a/audio/sfx/unknown_80467.asm b/audio/sfx/unknown_80467.asm new file mode 100644 index 00000000..7e5335ff --- /dev/null +++ b/audio/sfx/unknown_80467.asm @@ -0,0 +1,33 @@ +SFX_80467_4_Ch4: + dutycycle 240 + unknownsfx0x20 6, 247, 160, 7 + unknownsfx0x20 8, 230, 164, 7 + unknownsfx0x20 4, 214, 160, 7 + unknownsfx0x20 15, 211, 32, 7 + unknownsfx0x20 8, 195, 35, 7 + unknownsfx0x20 2, 194, 40, 7 + unknownsfx0x20 8, 177, 48, 7 + endchannel + +SFX_80486_4_Ch5: + dutycycle 10 + unknownsfx0x20 4, 8, 0, 0 + unknownsfx0x20 6, 167, 65, 7 + unknownsfx0x20 8, 134, 67, 7 + unknownsfx0x20 4, 118, 65, 7 + unknownsfx0x20 13, 131, 194, 6 + unknownsfx0x20 7, 115, 193, 6 + unknownsfx0x20 3, 130, 204, 6 + unknownsfx0x20 8, 113, 216, 6 + endchannel + +SFX_804a9_4_Ch7: + unknownnoise0x20 2, 242, 76 + unknownnoise0x20 6, 230, 58 + unknownnoise0x20 4, 215, 58 + unknownnoise0x20 6, 214, 44 + unknownnoise0x20 8, 229, 60 + unknownnoise0x20 12, 210, 61 + unknownnoise0x20 8, 209, 44 + endchannel + diff --git a/audio/sfx/unknown_804bf.asm b/audio/sfx/unknown_804bf.asm new file mode 100644 index 00000000..6776692c --- /dev/null +++ b/audio/sfx/unknown_804bf.asm @@ -0,0 +1,25 @@ +SFX_804bf_4_Ch4: + dutycycle 165 + unknownsfx0x20 6, 244, 64, 7 + unknownsfx0x20 15, 227, 48, 7 + unknownsfx0x20 4, 244, 64, 7 + unknownsfx0x20 5, 179, 72, 7 + unknownsfx0x20 8, 209, 80, 7 + endchannel + +SFX_804d6_4_Ch5: + dutycycle 119 + unknownsfx0x20 6, 195, 18, 7 + unknownsfx0x20 15, 179, 4, 7 + unknownsfx0x20 3, 195, 18, 7 + unknownsfx0x20 4, 195, 33, 7 + unknownsfx0x20 8, 177, 50, 7 + endchannel + +SFX_804ed_4_Ch7: + unknownnoise0x20 8, 214, 44 + unknownnoise0x20 12, 198, 60 + unknownnoise0x20 10, 182, 44 + unknownnoise0x20 8, 145, 28 + endchannel + diff --git a/audio/sfx/unknown_804fa.asm b/audio/sfx/unknown_804fa.asm new file mode 100644 index 00000000..74b7e681 --- /dev/null +++ b/audio/sfx/unknown_804fa.asm @@ -0,0 +1,29 @@ +SFX_804fa_4_Ch4: + dutycycle 240 + unknownsfx0x20 4, 247, 8, 6 + unknownsfx0x20 6, 230, 0, 6 + unknownsfx0x20 6, 215, 240, 5 + unknownsfx0x20 6, 196, 224, 5 + unknownsfx0x20 5, 211, 192, 5 + unknownsfx0x20 4, 211, 160, 5 + unknownsfx0x20 8, 225, 128, 5 + endchannel + +SFX_80519_4_Ch5: + dutycycle 10 + unknownsfx0x20 4, 199, 4, 5 + unknownsfx0x20 6, 166, 2, 5 + unknownsfx0x20 6, 151, 241, 4 + unknownsfx0x20 4, 180, 225, 4 + unknownsfx0x20 5, 163, 194, 4 + unknownsfx0x20 4, 179, 163, 4 + unknownsfx0x20 8, 193, 130, 4 + endchannel + +SFX_80538_4_Ch7: + unknownnoise0x20 12, 228, 76 + unknownnoise0x20 10, 199, 92 + unknownnoise0x20 12, 182, 76 + unknownnoise0x20 15, 162, 92 + endchannel + diff --git a/audio/sfx/unknown_80545.asm b/audio/sfx/unknown_80545.asm new file mode 100644 index 00000000..9ba19478 --- /dev/null +++ b/audio/sfx/unknown_80545.asm @@ -0,0 +1,28 @@ +SFX_80545_4_Ch4: + dutycycle 241 + unknownsfx0x20 4, 247, 192, 7 + unknownsfx0x20 12, 230, 194, 7 + unknownsfx0x20 6, 181, 128, 6 + unknownsfx0x20 4, 196, 112, 6 + unknownsfx0x20 4, 181, 96, 6 + unknownsfx0x20 8, 193, 64, 6 + endchannel + +SFX_80560_4_Ch5: + dutycycle 204 + unknownsfx0x20 3, 199, 129, 7 + unknownsfx0x20 12, 182, 128, 7 + unknownsfx0x20 6, 165, 65, 6 + unknownsfx0x20 4, 196, 50, 6 + unknownsfx0x20 6, 181, 33, 6 + unknownsfx0x20 8, 161, 2, 6 + endchannel + +SFX_8057b_4_Ch7: + unknownnoise0x20 3, 228, 60 + unknownnoise0x20 12, 214, 44 + unknownnoise0x20 4, 228, 60 + unknownnoise0x20 8, 183, 92 + unknownnoise0x20 15, 194, 93 + endchannel + diff --git a/audio/sfx/unknown_8058b.asm b/audio/sfx/unknown_8058b.asm new file mode 100644 index 00000000..9e424200 --- /dev/null +++ b/audio/sfx/unknown_8058b.asm @@ -0,0 +1,30 @@ +SFX_8058b_4_Ch4: + dutycycle 201 + unknownsfx0x20 8, 247, 128, 6 + unknownsfx0x20 2, 247, 96, 6 + unknownsfx0x20 1, 231, 64, 6 + unknownsfx0x20 1, 231, 32, 6 + unknownsfx0x20 15, 209, 0, 6 + unknownsfx0x20 4, 199, 64, 7 + unknownsfx0x20 4, 167, 48, 7 + unknownsfx0x20 15, 145, 32, 7 + endchannel + +SFX_805ae_4_Ch5: + dutycycle 121 + unknownsfx0x20 10, 231, 130, 6 + unknownsfx0x20 2, 231, 98, 6 + unknownsfx0x20 1, 215, 66, 6 + unknownsfx0x20 1, 215, 34, 6 + unknownsfx0x20 15, 193, 2, 6 + unknownsfx0x20 4, 183, 66, 7 + unknownsfx0x20 2, 151, 50, 7 + unknownsfx0x20 15, 129, 34, 7 + endchannel + +SFX_805d1_4_Ch7: + unknownnoise0x20 4, 116, 33 + unknownnoise0x20 4, 116, 16 + unknownnoise0x20 4, 113, 32 + endchannel + diff --git a/audio/sfx/unknown_805db.asm b/audio/sfx/unknown_805db.asm new file mode 100644 index 00000000..5e978a1e --- /dev/null +++ b/audio/sfx/unknown_805db.asm @@ -0,0 +1,20 @@ +SFX_805db_4_Ch4: + dutycycle 245 + unknownsfx0x20 4, 243, 24, 7 + unknownsfx0x20 15, 229, 152, 7 + unknownsfx0x20 8, 145, 88, 7 + endchannel + +SFX_805ea_4_Ch5: + dutycycle 160 + unknownsfx0x20 5, 179, 8, 7 + unknownsfx0x20 15, 197, 136, 7 + unknownsfx0x20 8, 113, 72, 7 + endchannel + +SFX_805f9_4_Ch7: + unknownnoise0x20 3, 161, 28 + unknownnoise0x20 14, 148, 44 + unknownnoise0x20 8, 129, 28 + endchannel + diff --git a/audio/sfx/unknown_80603.asm b/audio/sfx/unknown_80603.asm new file mode 100644 index 00000000..3cbc9ca2 --- /dev/null +++ b/audio/sfx/unknown_80603.asm @@ -0,0 +1,22 @@ +SFX_80603_4_Ch4: + dutycycle 165 + unknownsfx0x20 4, 225, 0, 7 + unknownsfx0x20 4, 242, 128, 7 + unknownsfx0x20 2, 146, 64, 7 + unknownsfx0x20 8, 225, 0, 6 + endchannel + +SFX_80616_4_Ch5: + dutycycle 10 + unknownsfx0x20 4, 177, 225, 6 + unknownsfx0x20 3, 194, 225, 6 + unknownsfx0x20 3, 98, 129, 6 + unknownsfx0x20 8, 177, 225, 5 + endchannel + +SFX_80629_4_Ch7: + unknownnoise0x20 2, 97, 50 + unknownnoise0x20 2, 97, 33 + unknownnoise0x20 8, 97, 17 + endchannel + diff --git a/audio/sfx/unknown_80633.asm b/audio/sfx/unknown_80633.asm new file mode 100644 index 00000000..9be59347 --- /dev/null +++ b/audio/sfx/unknown_80633.asm @@ -0,0 +1,20 @@ +SFX_80633_4_Ch4: + dutycycle 250 + unknownsfx0x20 6, 131, 71, 2 + unknownsfx0x20 15, 98, 38, 2 + unknownsfx0x20 4, 82, 69, 2 + unknownsfx0x20 9, 99, 6, 2 + unknownsfx0x20 15, 130, 37, 2 + unknownsfx0x20 15, 66, 7, 2 +SFX_8064d_4_Ch5: + endchannel + +SFX_8064e_4_Ch7: + unknownnoise0x20 8, 212, 140 + unknownnoise0x20 4, 226, 156 + unknownnoise0x20 15, 198, 140 + unknownnoise0x20 8, 228, 172 + unknownnoise0x20 15, 215, 156 + unknownnoise0x20 15, 242, 172 + endchannel + diff --git a/audio/sfx/unknown_80661.asm b/audio/sfx/unknown_80661.asm new file mode 100644 index 00000000..f6848664 --- /dev/null +++ b/audio/sfx/unknown_80661.asm @@ -0,0 +1,20 @@ +SFX_80661_4_Ch4: + dutycycle 240 + unknownsfx0x20 4, 243, 224, 6 + unknownsfx0x20 15, 228, 64, 6 + unknownsfx0x20 8, 193, 32, 6 + endchannel + +SFX_80670_4_Ch5: + dutycycle 10 + unknownsfx0x20 3, 195, 131, 6 + unknownsfx0x20 14, 180, 2, 6 + unknownsfx0x20 8, 161, 1, 6 + endchannel + +SFX_8067f_4_Ch7: + unknownnoise0x20 4, 211, 92 + unknownnoise0x20 15, 230, 76 + unknownnoise0x20 8, 177, 92 + endchannel + diff --git a/audio/sfx/unknown_80689.asm b/audio/sfx/unknown_80689.asm new file mode 100644 index 00000000..0e2c573a --- /dev/null +++ b/audio/sfx/unknown_80689.asm @@ -0,0 +1,17 @@ +SFX_80689_4_Ch4: + dutycycle 10 + unknownsfx0x20 6, 226, 0, 5 + unknownsfx0x20 6, 227, 128, 5 + unknownsfx0x20 6, 211, 112, 5 + unknownsfx0x20 8, 161, 96, 5 + endchannel + +SFX_8069c_4_Ch5: + dutycycle 245 + unknownsfx0x20 6, 226, 130, 4 + unknownsfx0x20 6, 211, 1, 5 + unknownsfx0x20 6, 178, 226, 4 + unknownsfx0x20 8, 129, 193, 4 +SFX_806ae_4_Ch7: + endchannel + diff --git a/audio/sfx/unknown_806af.asm b/audio/sfx/unknown_806af.asm new file mode 100644 index 00000000..3cb97c62 --- /dev/null +++ b/audio/sfx/unknown_806af.asm @@ -0,0 +1,36 @@ +SFX_806af_4_Ch4: + dutycycle 204 + unknownsfx0x20 4, 241, 0, 7 + unknownsfx0x20 4, 225, 128, 7 + unknownsfx0x20 4, 209, 64, 7 + unknownsfx0x20 4, 225, 64, 7 + unknownsfx0x20 4, 241, 128, 7 + unknownsfx0x20 4, 209, 0, 7 + unknownsfx0x20 4, 241, 1, 7 + unknownsfx0x20 4, 209, 130, 7 + unknownsfx0x20 4, 193, 66, 7 + unknownsfx0x20 8, 177, 65, 7 + endchannel + +SFX_806da_4_Ch5: + dutycycle 68 + unknownsfx0x20 12, 8, 0, 0 + unknownsfx0x20 4, 241, 1, 7 + unknownsfx0x20 4, 225, 130, 7 + unknownsfx0x20 4, 209, 65, 7 + unknownsfx0x20 4, 225, 65, 7 + unknownsfx0x20 4, 241, 130, 7 + unknownsfx0x20 8, 209, 1, 7 + endchannel + +SFX_806f9_4_Ch7: + unknownnoise0x20 15, 8, 0 + unknownnoise0x20 4, 8, 0 + unknownnoise0x20 4, 209, 76 + unknownnoise0x20 4, 177, 44 + unknownnoise0x20 4, 209, 60 + unknownnoise0x20 4, 177, 60 + unknownnoise0x20 4, 193, 44 + unknownnoise0x20 8, 161, 76 + endchannel + diff --git a/audio/sfx/unknown_80712.asm b/audio/sfx/unknown_80712.asm new file mode 100644 index 00000000..689f12ad --- /dev/null +++ b/audio/sfx/unknown_80712.asm @@ -0,0 +1,27 @@ +SFX_80712_4_Ch4: + dutycycle 204 + unknownsfx0x20 8, 245, 0, 6 + unknownsfx0x20 2, 210, 56, 6 + unknownsfx0x20 2, 194, 48, 6 + unknownsfx0x20 2, 194, 40, 6 + unknownsfx0x20 2, 178, 32, 6 + unknownsfx0x20 2, 178, 16, 6 + unknownsfx0x20 2, 162, 24, 6 + unknownsfx0x20 2, 178, 16, 6 + unknownsfx0x20 8, 193, 32, 6 + endchannel + +SFX_80739_4_Ch5: + dutycycle 68 + unknownsfx0x20 12, 195, 192, 5 + unknownsfx0x20 3, 177, 249, 5 + unknownsfx0x20 2, 161, 241, 5 + unknownsfx0x20 2, 161, 233, 5 + unknownsfx0x20 2, 145, 225, 5 + unknownsfx0x20 2, 145, 217, 5 + unknownsfx0x20 2, 129, 209, 5 + unknownsfx0x20 2, 145, 217, 5 + unknownsfx0x20 8, 145, 225, 5 +SFX_8075f_4_Ch7: + endchannel + diff --git a/audio/sfx/unknown_80760.asm b/audio/sfx/unknown_80760.asm new file mode 100644 index 00000000..47d28da0 --- /dev/null +++ b/audio/sfx/unknown_80760.asm @@ -0,0 +1,15 @@ +SFX_80760_4_Ch4: + duty 0 + unknownsfx0x20 8, 245, 128, 4 + unknownsfx0x20 2, 225, 224, 5 + unknownsfx0x20 8, 209, 220, 5 + endchannel + +SFX_8076f_4_Ch5: + dutycycle 165 + unknownsfx0x20 7, 149, 65, 4 + unknownsfx0x20 2, 129, 33, 5 + unknownsfx0x20 8, 97, 26, 5 +SFX_8077d_4_Ch7: + endchannel + diff --git a/audio/sfx/unknown_8077e.asm b/audio/sfx/unknown_8077e.asm new file mode 100644 index 00000000..2047af78 --- /dev/null +++ b/audio/sfx/unknown_8077e.asm @@ -0,0 +1,39 @@ +SFX_8077e_4_Ch4: + dutycycle 136 + unknownsfx0x20 5, 242, 80, 6 + unknownsfx0x20 9, 209, 96, 6 + unknownsfx0x20 5, 226, 18, 6 + unknownsfx0x20 9, 193, 34, 6 + unknownsfx0x20 5, 242, 16, 6 + unknownsfx0x20 6, 209, 32, 6 + loopchannel 2, SFX_8077e_4_Ch4 + endchannel + +SFX_8079d_4_Ch5: + dutycycle 64 + unknownsfx0x20 4, 8, 0, 0 + unknownsfx0x20 5, 242, 81, 6 + unknownsfx0x20 9, 209, 97, 6 + unknownsfx0x20 5, 226, 20, 6 + unknownsfx0x20 8, 193, 36, 6 + unknownsfx0x20 5, 242, 17, 6 + unknownsfx0x20 12, 209, 33, 6 + unknownsfx0x20 5, 226, 20, 6 + unknownsfx0x20 8, 193, 36, 6 + unknownsfx0x20 5, 242, 17, 6 + unknownsfx0x20 4, 209, 33, 6 + endchannel + +SFX_807cc_4_Ch7: + unknownnoise0x20 6, 210, 28 + unknownnoise0x20 9, 177, 44 + unknownnoise0x20 8, 194, 44 + unknownnoise0x20 9, 177, 60 + unknownnoise0x20 6, 194, 44 + unknownnoise0x20 9, 162, 60 + unknownnoise0x20 7, 194, 44 + unknownnoise0x20 5, 161, 60 + unknownnoise0x20 9, 194, 44 + unknownnoise0x20 4, 161, 60 + endchannel + diff --git a/audio/sfx/unknown_807eb.asm b/audio/sfx/unknown_807eb.asm new file mode 100644 index 00000000..8554695e --- /dev/null +++ b/audio/sfx/unknown_807eb.asm @@ -0,0 +1,23 @@ +SFX_807eb_4_Ch4: + dutycycle 160 + unknownsfx0x20 4, 243, 0, 6 + unknownsfx0x20 8, 213, 96, 7 + unknownsfx0x20 3, 226, 32, 7 + unknownsfx0x20 8, 209, 16, 7 + endchannel + +SFX_807fe_4_Ch5: + dutycycle 90 + unknownsfx0x20 5, 179, 241, 6 + unknownsfx0x20 7, 197, 82, 7 + unknownsfx0x20 3, 162, 17, 7 + unknownsfx0x20 8, 177, 1, 6 + endchannel + +SFX_80811_4_Ch7: + unknownnoise0x20 3, 162, 60 + unknownnoise0x20 12, 148, 44 + unknownnoise0x20 3, 130, 28 + unknownnoise0x20 8, 113, 44 + endchannel + diff --git a/audio/sfx/unknown_8081e.asm b/audio/sfx/unknown_8081e.asm new file mode 100644 index 00000000..1581d121 --- /dev/null +++ b/audio/sfx/unknown_8081e.asm @@ -0,0 +1,34 @@ +SFX_8081e_4_Ch4: + dutycycle 240 + unknownsfx0x20 8, 247, 224, 6 + unknownsfx0x20 6, 230, 229, 6 + unknownsfx0x20 3, 244, 224, 6 + unknownsfx0x20 3, 246, 208, 6 + unknownsfx0x20 3, 227, 192, 6 + unknownsfx0x20 4, 242, 176, 6 + unknownsfx0x20 15, 162, 200, 6 + endchannel + +SFX_8083d_4_Ch5: + dutycycle 5 + unknownsfx0x20 3, 8, 0, 0 + unknownsfx0x20 8, 167, 161, 6 + unknownsfx0x20 6, 134, 163, 6 + unknownsfx0x20 3, 116, 161, 6 + unknownsfx0x20 3, 118, 145, 6 + unknownsfx0x20 3, 131, 130, 6 + unknownsfx0x20 4, 162, 113, 6 + unknownsfx0x20 15, 114, 137, 6 + endchannel + +SFX_80860_4_Ch7: + unknownnoise0x20 2, 242, 60 + unknownnoise0x20 8, 228, 62 + unknownnoise0x20 8, 215, 60 + unknownnoise0x20 5, 197, 59 + unknownnoise0x20 3, 212, 44 + unknownnoise0x20 2, 182, 60 + unknownnoise0x20 3, 164, 44 + unknownnoise0x20 8, 145, 60 + endchannel + diff --git a/audio/sfx/unknown_80879.asm b/audio/sfx/unknown_80879.asm new file mode 100644 index 00000000..23839d60 --- /dev/null +++ b/audio/sfx/unknown_80879.asm @@ -0,0 +1,22 @@ +SFX_80879_4_Ch4: + dutycycle 240 + unknownsfx0x20 15, 246, 101, 5 + unknownsfx0x20 10, 228, 124, 5 + unknownsfx0x20 3, 194, 92, 5 + unknownsfx0x20 15, 178, 60, 5 + endchannel + +SFX_8088c_4_Ch5: + dutycycle 90 + unknownsfx0x20 14, 214, 3, 5 + unknownsfx0x20 9, 180, 27, 5 + unknownsfx0x20 4, 146, 250, 4 + unknownsfx0x20 15, 162, 219, 4 + endchannel + +SFX_8089f_4_Ch7: + unknownnoise0x20 12, 230, 76 + unknownnoise0x20 11, 215, 92 + unknownnoise0x20 15, 194, 76 + endchannel + diff --git a/audio/sfx/unknown_808a9.asm b/audio/sfx/unknown_808a9.asm new file mode 100644 index 00000000..efa4a0d6 --- /dev/null +++ b/audio/sfx/unknown_808a9.asm @@ -0,0 +1,31 @@ +SFX_808a9_4_Ch4: + dutycycle 240 + unknownsfx0x20 4, 247, 160, 6 + unknownsfx0x20 8, 230, 164, 6 + unknownsfx0x20 4, 214, 160, 6 + unknownsfx0x20 12, 211, 32, 6 + unknownsfx0x20 8, 195, 36, 6 + unknownsfx0x20 4, 194, 32, 6 + unknownsfx0x20 8, 177, 16, 6 + endchannel + +SFX_808c8_4_Ch5: + dutycycle 90 + unknownsfx0x20 4, 231, 1, 6 + unknownsfx0x20 8, 214, 3, 6 + unknownsfx0x20 4, 198, 1, 6 + unknownsfx0x20 12, 195, 129, 5 + unknownsfx0x20 8, 179, 131, 5 + unknownsfx0x20 4, 178, 130, 5 + unknownsfx0x20 8, 161, 113, 5 + endchannel + +SFX_808e7_4_Ch7: + unknownnoise0x20 7, 214, 92 + unknownnoise0x20 8, 230, 76 + unknownnoise0x20 4, 212, 92 + unknownnoise0x20 4, 212, 76 + unknownnoise0x20 7, 195, 76 + unknownnoise0x20 8, 161, 92 + endchannel + diff --git a/audio/sfx/unknown_808fa.asm b/audio/sfx/unknown_808fa.asm new file mode 100644 index 00000000..4bd5839f --- /dev/null +++ b/audio/sfx/unknown_808fa.asm @@ -0,0 +1,16 @@ +SFX_808fa_4_Ch4: + dutycycle 27 + unknownsfx0x20 7, 210, 64, 7 + unknownsfx0x20 15, 229, 96, 7 + unknownsfx0x20 15, 193, 48, 7 + endchannel + +SFX_80909_4_Ch5: + dutycycle 129 + unknownsfx0x20 2, 194, 1, 7 + unknownsfx0x20 4, 194, 8, 7 + unknownsfx0x20 15, 215, 65, 7 + unknownsfx0x20 15, 162, 1, 7 +SFX_8091b_4_Ch7: + endchannel + diff --git a/audio/sfx/unknown_8091c.asm b/audio/sfx/unknown_8091c.asm new file mode 100644 index 00000000..c4fa4c20 --- /dev/null +++ b/audio/sfx/unknown_8091c.asm @@ -0,0 +1,20 @@ +SFX_8091c_4_Ch4: + dutycycle 240 + unknownsfx0x20 15, 215, 128, 7 + unknownsfx0x20 4, 230, 160, 7 + unknownsfx0x20 15, 210, 64, 7 + endchannel + +SFX_8092b_4_Ch5: + dutycycle 90 + unknownsfx0x20 15, 199, 83, 7 + unknownsfx0x20 5, 182, 114, 7 + unknownsfx0x20 15, 194, 17, 7 + endchannel + +SFX_8093a_4_Ch7: + unknownnoise0x20 13, 246, 76 + unknownnoise0x20 4, 230, 60 + unknownnoise0x20 15, 242, 76 + endchannel + diff --git a/audio/sfx/unknown_80944.asm b/audio/sfx/unknown_80944.asm new file mode 100644 index 00000000..e16cec26 --- /dev/null +++ b/audio/sfx/unknown_80944.asm @@ -0,0 +1,25 @@ +SFX_80944_4_Ch4: + dutycycle 240 + unknownsfx0x20 6, 247, 192, 6 + unknownsfx0x20 15, 231, 0, 7 + unknownsfx0x20 4, 244, 240, 6 + unknownsfx0x20 4, 228, 224, 6 + unknownsfx0x20 8, 209, 208, 6 + endchannel + +SFX_8095b_4_Ch5: + dutycycle 10 + unknownsfx0x20 7, 230, 129, 6 + unknownsfx0x20 14, 213, 193, 6 + unknownsfx0x20 4, 196, 177, 6 + unknownsfx0x20 4, 212, 161, 6 + unknownsfx0x20 8, 193, 145, 6 + endchannel + +SFX_80972_4_Ch7: + unknownnoise0x20 10, 166, 60 + unknownnoise0x20 14, 148, 44 + unknownnoise0x20 5, 163, 60 + unknownnoise0x20 8, 145, 44 + endchannel + diff --git a/audio/sfx/unknown_8097f.asm b/audio/sfx/unknown_8097f.asm new file mode 100644 index 00000000..b178821c --- /dev/null +++ b/audio/sfx/unknown_8097f.asm @@ -0,0 +1,23 @@ +SFX_8097f_4_Ch4: + dutycycle 165 + unknownsfx0x20 12, 242, 64, 4 + unknownsfx0x20 15, 227, 160, 4 + unknownsfx0x20 4, 210, 144, 4 + unknownsfx0x20 8, 209, 128, 4 + endchannel + +SFX_80992_4_Ch5: + dutycycle 238 + unknownsfx0x20 11, 210, 56, 4 + unknownsfx0x20 14, 198, 152, 4 + unknownsfx0x20 3, 178, 136, 4 + unknownsfx0x20 8, 177, 120, 4 + endchannel + +SFX_809a5_4_Ch7: + unknownnoise0x20 10, 230, 108 + unknownnoise0x20 15, 210, 92 + unknownnoise0x20 3, 194, 108 + unknownnoise0x20 8, 209, 92 + endchannel + diff --git a/audio/sfx/unknown_809b2.asm b/audio/sfx/unknown_809b2.asm new file mode 100644 index 00000000..095f7134 --- /dev/null +++ b/audio/sfx/unknown_809b2.asm @@ -0,0 +1,29 @@ +SFX_809b2_4_Ch4: + dutycycle 51 + unknownsfx0x20 15, 246, 192, 5 + unknownsfx0x20 8, 227, 188, 5 + unknownsfx0x20 6, 210, 208, 5 + unknownsfx0x20 6, 178, 224, 5 + unknownsfx0x20 6, 194, 240, 5 + unknownsfx0x20 8, 177, 0, 6 + endchannel + +SFX_809cd_4_Ch5: + dutycycle 153 + unknownsfx0x20 14, 198, 177, 4 + unknownsfx0x20 7, 195, 173, 4 + unknownsfx0x20 5, 178, 193, 4 + unknownsfx0x20 8, 146, 209, 4 + unknownsfx0x20 6, 162, 225, 4 + unknownsfx0x20 8, 145, 241, 4 + endchannel + +SFX_809e8_4_Ch7: + unknownnoise0x20 10, 230, 92 + unknownnoise0x20 10, 214, 108 + unknownnoise0x20 4, 194, 76 + unknownnoise0x20 6, 211, 92 + unknownnoise0x20 8, 179, 76 + unknownnoise0x20 8, 161, 92 + endchannel + diff --git a/audio/sfx/unknown_809fb.asm b/audio/sfx/unknown_809fb.asm new file mode 100644 index 00000000..7424d61b --- /dev/null +++ b/audio/sfx/unknown_809fb.asm @@ -0,0 +1,20 @@ +SFX_809fb_4_Ch4: + dutycycle 240 + unknownsfx0x20 8, 228, 144, 7 + unknownsfx0x20 15, 245, 192, 7 + unknownsfx0x20 8, 209, 216, 7 + endchannel + +SFX_80a0a_4_Ch5: + dutycycle 165 + unknownsfx0x20 10, 196, 113, 7 + unknownsfx0x20 15, 182, 162, 7 + unknownsfx0x20 8, 161, 183, 7 + endchannel + +SFX_80a19_4_Ch7: + unknownnoise0x20 8, 228, 76 + unknownnoise0x20 14, 196, 60 + unknownnoise0x20 8, 209, 44 + endchannel + diff --git a/audio/sfx/unknown_80a23.asm b/audio/sfx/unknown_80a23.asm new file mode 100644 index 00000000..c20a37d4 --- /dev/null +++ b/audio/sfx/unknown_80a23.asm @@ -0,0 +1,37 @@ +SFX_80a23_4_Ch4: + dutycycle 240 + unknownsfx0x20 6, 242, 0, 6 + unknownsfx0x20 6, 226, 64, 6 + unknownsfx0x20 6, 210, 128, 6 + unknownsfx0x20 6, 226, 192, 6 + unknownsfx0x20 6, 210, 0, 7 + unknownsfx0x20 6, 194, 64, 7 + unknownsfx0x20 6, 178, 128, 7 + unknownsfx0x20 8, 161, 192, 7 + endchannel + +SFX_80a46_4_Ch5: + dutycycle 17 + unknownsfx0x20 3, 8, 1, 0 + unknownsfx0x20 6, 194, 193, 5 + unknownsfx0x20 6, 178, 2, 6 + unknownsfx0x20 6, 162, 65, 6 + unknownsfx0x20 6, 178, 130, 6 + unknownsfx0x20 6, 162, 194, 6 + unknownsfx0x20 6, 146, 1, 7 + unknownsfx0x20 6, 162, 66, 7 + unknownsfx0x20 8, 129, 129, 7 + endchannel + +SFX_80a6d_4_Ch7: + unknownnoise0x20 6, 8, 1 + unknownnoise0x20 5, 226, 92 + unknownnoise0x20 5, 194, 76 + unknownnoise0x20 5, 210, 60 + unknownnoise0x20 5, 178, 44 + unknownnoise0x20 5, 194, 28 + unknownnoise0x20 5, 162, 27 + unknownnoise0x20 5, 146, 26 + unknownnoise0x20 8, 129, 24 + endchannel + diff --git a/audio/sfx/unknown_80a89.asm b/audio/sfx/unknown_80a89.asm new file mode 100644 index 00000000..b79cf7c3 --- /dev/null +++ b/audio/sfx/unknown_80a89.asm @@ -0,0 +1,29 @@ +SFX_80a89_4_Ch4: + dutycycle 240 + unknownsfx0x20 4, 243, 128, 7 + unknownsfx0x20 15, 231, 0, 7 + unknownsfx0x20 8, 211, 16, 7 + unknownsfx0x20 4, 194, 0, 7 + unknownsfx0x20 4, 210, 240, 6 + unknownsfx0x20 8, 193, 224, 6 + endchannel + +SFX_80aa4_4_Ch5: + dutycycle 90 + unknownsfx0x20 6, 195, 1, 7 + unknownsfx0x20 14, 183, 129, 6 + unknownsfx0x20 7, 179, 146, 6 + unknownsfx0x20 3, 162, 129, 6 + unknownsfx0x20 4, 178, 114, 6 + unknownsfx0x20 8, 161, 97, 6 + endchannel + +SFX_80abf_4_Ch7: + unknownnoise0x20 6, 227, 92 + unknownnoise0x20 14, 214, 76 + unknownnoise0x20 6, 198, 60 + unknownnoise0x20 3, 179, 76 + unknownnoise0x20 3, 162, 92 + unknownnoise0x20 8, 177, 108 + endchannel + diff --git a/audio/sfx/unknown_80ad2.asm b/audio/sfx/unknown_80ad2.asm new file mode 100644 index 00000000..db7b45b2 --- /dev/null +++ b/audio/sfx/unknown_80ad2.asm @@ -0,0 +1,23 @@ +SFX_80ad2_4_Ch4: + dutycycle 15 + unknownsfx0x20 15, 247, 0, 5 + unknownsfx0x20 15, 231, 8, 5 + unknownsfx0x20 8, 180, 128, 4 + unknownsfx0x20 15, 162, 96, 4 + endchannel + +SFX_80ae5_4_Ch5: + dutycycle 68 + unknownsfx0x20 14, 215, 129, 4 + unknownsfx0x20 14, 199, 137, 4 + unknownsfx0x20 10, 180, 1, 4 + unknownsfx0x20 15, 194, 225, 3 + endchannel + +SFX_80af8_4_Ch7: + unknownnoise0x20 14, 247, 124 + unknownnoise0x20 12, 246, 108 + unknownnoise0x20 9, 228, 124 + unknownnoise0x20 15, 226, 108 + endchannel + diff --git a/audio/sfx/unknown_80b05.asm b/audio/sfx/unknown_80b05.asm new file mode 100644 index 00000000..68ca90f5 --- /dev/null +++ b/audio/sfx/unknown_80b05.asm @@ -0,0 +1,30 @@ +SFX_80b05_4_Ch4: + dutycycle 245 + unknownsfx0x20 7, 214, 225, 7 + unknownsfx0x20 6, 198, 226, 7 + unknownsfx0x20 9, 214, 225, 7 + unknownsfx0x20 7, 198, 224, 7 + unknownsfx0x20 5, 182, 226, 7 + unknownsfx0x20 7, 198, 225, 7 + unknownsfx0x20 6, 182, 224, 7 + unknownsfx0x20 8, 161, 223, 7 + endchannel + +SFX_80b28_4_Ch5: + dutycycle 68 + unknownsfx0x20 6, 195, 201, 7 + unknownsfx0x20 6, 179, 199, 7 + unknownsfx0x20 10, 196, 195, 7 + unknownsfx0x20 8, 180, 199, 7 + unknownsfx0x20 6, 195, 201, 7 + unknownsfx0x20 15, 162, 197, 7 + endchannel + +SFX_80b43_4_Ch7: + unknownnoise0x20 13, 25, 124 + unknownnoise0x20 13, 247, 140 + unknownnoise0x20 12, 214, 124 + unknownnoise0x20 8, 196, 108 + unknownnoise0x20 15, 179, 92 + endchannel + diff --git a/audio/sfx/unknown_80b53.asm b/audio/sfx/unknown_80b53.asm new file mode 100644 index 00000000..3033d299 --- /dev/null +++ b/audio/sfx/unknown_80b53.asm @@ -0,0 +1,29 @@ +SFX_80b53_4_Ch4: + dutycycle 240 + unknownsfx0x20 6, 247, 64, 7 + unknownsfx0x20 12, 230, 68, 7 + unknownsfx0x20 6, 213, 80, 7 + unknownsfx0x20 4, 195, 96, 7 + unknownsfx0x20 3, 195, 128, 7 + unknownsfx0x20 8, 209, 160, 7 + endchannel + +SFX_80b6e_4_Ch5: + dutycycle 10 + unknownsfx0x20 6, 199, 1, 7 + unknownsfx0x20 11, 182, 2, 7 + unknownsfx0x20 6, 165, 17, 7 + unknownsfx0x20 4, 147, 33, 7 + unknownsfx0x20 3, 163, 65, 7 + unknownsfx0x20 8, 145, 98, 7 + endchannel + +SFX_80b89_4_Ch7: + unknownnoise0x20 3, 226, 60 + unknownnoise0x20 8, 214, 76 + unknownnoise0x20 5, 212, 60 + unknownnoise0x20 12, 199, 76 + unknownnoise0x20 2, 226, 60 + unknownnoise0x20 8, 209, 44 + endchannel + diff --git a/audio/sfx/unknown_80b9c.asm b/audio/sfx/unknown_80b9c.asm new file mode 100644 index 00000000..5e54107e --- /dev/null +++ b/audio/sfx/unknown_80b9c.asm @@ -0,0 +1,28 @@ +SFX_80b9c_4_Ch4: + dutycycle 244 + unknownsfx0x20 15, 240, 5, 7 + unknownsfx0x20 10, 224, 0, 7 + unknownsfx0x20 6, 180, 16, 7 + unknownsfx0x20 4, 211, 0, 7 + unknownsfx0x20 6, 178, 32, 6 + unknownsfx0x20 8, 161, 36, 6 + endchannel + +SFX_80bb7_4_Ch5: + dutycycle 34 + unknownsfx0x20 15, 176, 195, 6 + unknownsfx0x20 10, 160, 193, 6 + unknownsfx0x20 6, 132, 210, 6 + unknownsfx0x20 4, 147, 193, 6 + unknownsfx0x20 6, 130, 225, 5 + unknownsfx0x20 8, 97, 232, 5 + endchannel + +SFX_80bd2_4_Ch7: + unknownnoise0x20 6, 230, 76 + unknownnoise0x20 15, 214, 60 + unknownnoise0x20 10, 197, 74 + unknownnoise0x20 1, 178, 91 + unknownnoise0x20 15, 194, 76 + endchannel + diff --git a/audio/sfx/unknown_80be2.asm b/audio/sfx/unknown_80be2.asm new file mode 100644 index 00000000..4660d8f2 --- /dev/null +++ b/audio/sfx/unknown_80be2.asm @@ -0,0 +1,33 @@ +SFX_80be2_4_Ch4: + dutycycle 80 + unknownsfx0x20 10, 245, 128, 6 + unknownsfx0x20 3, 226, 160, 6 + unknownsfx0x20 3, 242, 192, 6 + unknownsfx0x20 3, 226, 224, 6 + unknownsfx0x20 3, 210, 0, 7 + unknownsfx0x20 3, 194, 224, 6 + unknownsfx0x20 3, 210, 192, 6 + unknownsfx0x20 8, 193, 160, 6 + endchannel + +SFX_80c05_4_Ch5: + dutycycle 15 + unknownsfx0x20 9, 213, 49, 6 + unknownsfx0x20 3, 210, 82, 6 + unknownsfx0x20 3, 226, 113, 6 + unknownsfx0x20 3, 178, 145, 6 + unknownsfx0x20 3, 194, 178, 6 + unknownsfx0x20 3, 178, 145, 6 + unknownsfx0x20 3, 194, 113, 6 + unknownsfx0x20 8, 177, 81, 6 + endchannel + +SFX_80c28_4_Ch7: + unknownnoise0x20 6, 227, 76 + unknownnoise0x20 4, 195, 60 + unknownnoise0x20 5, 212, 60 + unknownnoise0x20 4, 196, 44 + unknownnoise0x20 6, 180, 60 + unknownnoise0x20 8, 193, 44 + endchannel + diff --git a/audio/sfx/unknown_80c3b.asm b/audio/sfx/unknown_80c3b.asm new file mode 100644 index 00000000..f6106ebf --- /dev/null +++ b/audio/sfx/unknown_80c3b.asm @@ -0,0 +1,23 @@ +SFX_80c3b_4_Ch4: + dutycycle 165 + unknownsfx0x20 3, 244, 65, 6 + unknownsfx0x20 13, 214, 33, 7 + unknownsfx0x20 8, 244, 25, 7 + unknownsfx0x20 8, 193, 26, 7 + endchannel + +SFX_80c4e_4_Ch5: + dutycycle 204 + unknownsfx0x20 4, 244, 128, 5 + unknownsfx0x20 14, 230, 224, 6 + unknownsfx0x20 8, 213, 216, 6 + unknownsfx0x20 8, 209, 220, 6 + endchannel + +SFX_80c61_4_Ch7: + unknownnoise0x20 5, 196, 70 + unknownnoise0x20 13, 165, 68 + unknownnoise0x20 8, 196, 69 + unknownnoise0x20 8, 177, 68 + endchannel + diff --git a/audio/sfx/unknown_80c6e.asm b/audio/sfx/unknown_80c6e.asm new file mode 100644 index 00000000..54c4b3f9 --- /dev/null +++ b/audio/sfx/unknown_80c6e.asm @@ -0,0 +1,23 @@ +SFX_80c6e_4_Ch4: + dutycycle 240 + unknownsfx0x20 13, 241, 17, 5 + unknownsfx0x20 13, 225, 21, 5 + unknownsfx0x20 13, 225, 17, 5 + unknownsfx0x20 8, 209, 17, 5 + endchannel + +SFX_80c81_4_Ch5: + dutycycle 21 + unknownsfx0x20 12, 225, 12, 5 + unknownsfx0x20 12, 209, 16, 5 + unknownsfx0x20 14, 193, 12, 5 + unknownsfx0x20 8, 193, 10, 5 + endchannel + +SFX_80c94_4_Ch7: + unknownnoise0x20 14, 242, 101 + unknownnoise0x20 13, 226, 85 + unknownnoise0x20 14, 210, 86 + unknownnoise0x20 8, 209, 102 + endchannel + diff --git a/audio/sfx/unknown_80ca1.asm b/audio/sfx/unknown_80ca1.asm new file mode 100644 index 00000000..df3b29be --- /dev/null +++ b/audio/sfx/unknown_80ca1.asm @@ -0,0 +1,25 @@ +SFX_80ca1_4_Ch4: + dutycycle 27 + unknownsfx0x20 3, 243, 100, 5 + unknownsfx0x20 2, 226, 68, 5 + unknownsfx0x20 5, 209, 34, 5 + unknownsfx0x20 2, 178, 132, 4 + unknownsfx0x20 8, 209, 162, 4 + unknownsfx0x20 3, 243, 36, 5 + unknownsfx0x20 4, 228, 228, 4 + unknownsfx0x20 8, 209, 2, 5 + endchannel + +SFX_80cc4_4_Ch5: + dutycycle 204 + unknownsfx0x20 3, 211, 96, 5 + unknownsfx0x20 2, 194, 64, 5 + unknownsfx0x20 5, 193, 32, 5 + unknownsfx0x20 2, 146, 128, 4 + unknownsfx0x20 8, 193, 160, 4 + unknownsfx0x20 3, 211, 32, 5 + unknownsfx0x20 3, 196, 224, 4 + unknownsfx0x20 8, 193, 0, 5 +SFX_80ce6_4_Ch7: + endchannel + diff --git a/audio/sfx/unknown_80ce7.asm b/audio/sfx/unknown_80ce7.asm new file mode 100644 index 00000000..6b5a2163 --- /dev/null +++ b/audio/sfx/unknown_80ce7.asm @@ -0,0 +1,24 @@ +SFX_80ce7_4_Ch4: + dutycycle 17 + unknownsfx0x20 2, 61, 129, 3 + unknownsfx0x20 7, 245, 1, 6 + unknownsfx0x20 1, 194, 129, 4 + unknownsfx0x20 8, 145, 129, 3 + endchannel + +SFX_80cfa_4_Ch5: + dutycycle 238 + unknownsfx0x20 2, 62, 176, 5 + unknownsfx0x20 7, 213, 93, 7 + unknownsfx0x20 1, 178, 176, 6 + unknownsfx0x20 8, 97, 176, 5 + endchannel + +SFX_80d0d_4_Ch7: + unknownnoise0x20 2, 146, 73 + unknownnoise0x20 7, 181, 41 + unknownnoise0x20 1, 162, 57 + unknownnoise0x20 8, 145, 73 + endchannel + + diff --git a/audio/sfx/unknown_80e5a.asm b/audio/sfx/unknown_80e5a.asm new file mode 100644 index 00000000..76cf48d4 --- /dev/null +++ b/audio/sfx/unknown_80e5a.asm @@ -0,0 +1,46 @@ +SFX_80e5a_4_Ch4: + executemusic + tempo 256 + volume 7, 7 + vibrato 6, 2, 6 + duty 2 + toggleperfectpitch + notetype 4, 11, 1 + octave 3 + G# 2 + G# 2 + G# 2 + notetype 12, 11, 3 + octave 4 + E_ 4 + endchannel + +SFX_80e71_4_Ch5: + executemusic + vibrato 8, 2, 7 + duty 2 + notetype 4, 12, 1 + octave 4 + E_ 2 + E_ 2 + E_ 2 + notetype 12, 12, 3 + B_ 4 + endchannel + +SFX_80e81_4_Ch6: + executemusic + notetype 4, 1, 0 + octave 4 + B_ 1 + rest 1 + B_ 1 + rest 1 + B_ 1 + rest 1 + notetype 12, 1, 0 + octave 4 + B_ 2 + rest 2 + endchannel + diff --git a/audio/sfx/unknown_80e91.asm b/audio/sfx/unknown_80e91.asm new file mode 100644 index 00000000..2b180d9d --- /dev/null +++ b/audio/sfx/unknown_80e91.asm @@ -0,0 +1,46 @@ +SFX_80e91_4_Ch4: + executemusic + tempo 256 + volume 7, 7 + vibrato 6, 2, 6 + duty 2 + toggleperfectpitch + notetype 4, 11, 1 + octave 3 + G# 2 + G# 2 + G# 2 + notetype 12, 11, 3 + octave 4 + E_ 4 + endchannel + +SFX_80ea8_4_Ch5: + executemusic + vibrato 8, 2, 7 + duty 2 + notetype 4, 12, 1 + octave 4 + E_ 2 + E_ 2 + E_ 2 + notetype 12, 12, 3 + B_ 4 + endchannel + +SFX_80eb8_4_Ch6: + executemusic + notetype 4, 1, 0 + octave 4 + B_ 1 + rest 1 + B_ 1 + rest 1 + B_ 1 + rest 1 + notetype 12, 1, 0 + octave 4 + B_ 2 + rest 2 + endchannel + diff --git a/audio/sfx/unused2_2.asm b/audio/sfx/unused2_2.asm index 7e0350d4..7e0350d4 100755..100644 --- a/audio/sfx/unused2_2.asm +++ b/audio/sfx/unused2_2.asm diff --git a/audio/sfx/unused_1.asm b/audio/sfx/unused_1.asm index d0bbfd59..d0bbfd59 100755..100644 --- a/audio/sfx/unused_1.asm +++ b/audio/sfx/unused_1.asm diff --git a/audio/sfx/unused_2.asm b/audio/sfx/unused_2.asm index fd491b71..fd491b71 100755..100644 --- a/audio/sfx/unused_2.asm +++ b/audio/sfx/unused_2.asm diff --git a/audio/sfx/unused_3.asm b/audio/sfx/unused_3.asm index b00e55f5..b00e55f5 100755..100644 --- a/audio/sfx/unused_3.asm +++ b/audio/sfx/unused_3.asm diff --git a/audio/unknown_832b9.bin b/audio/unknown_832b9.bin Binary files differnew file mode 100755 index 00000000..1c14816a --- /dev/null +++ b/audio/unknown_832b9.bin diff --git a/audio/wave_instruments.asm b/audio/wave_instruments.asm index fede06af..9f34d3ac 100644 --- a/audio/wave_instruments.asm +++ b/audio/wave_instruments.asm @@ -6,7 +6,7 @@ dw .wave5 ; used in the Lavender Town and Pokemon Tower themes dw .wave5 ; unused dw .wave5 ; unused - dw .wave5 ; unused +; dw .wave5 ; unused ; these are the definitions for the channel 3 instruments ; each instrument definition is made up of 32 points (nibbles) that form diff --git a/charmap.asm b/charmap.asm index 980c79a3..8f57a130 100644 --- a/charmap.asm +++ b/charmap.asm @@ -147,9 +147,16 @@ charmap "ゅ", $E1 charmap "ょ", $E2 charmap "ー", $E3 +charmap "<pkmn>", $4A ; PkMn charmap "@", $50 +charmap "<PLAYER>", $52 +charmap "<RIVAL>", $53 charmap "#", $54 ;charmap "POKé", $54 +charmap "<TARGET>", $59 +charmap "<USER>", $5A +charmap "′", $71 +charmap "″", $73 charmap "…", $75 charmap "┌", $79 @@ -233,6 +240,7 @@ charmap "'m", $E5 charmap "?", $E6 charmap "!", $E7 charmap ".", $E8 +charmap "▷", $EC charmap "▶", $ED charmap "♂", $EF charmap "¥", $F0 diff --git a/constants.asm b/constants.asm index 8bca86eb..554f89ca 100644 --- a/constants.asm +++ b/constants.asm @@ -1,5 +1,4 @@ INCLUDE "macros.asm" -INCLUDE "charmap.asm" INCLUDE "hram.asm" INCLUDE "vram.asm" @@ -30,3 +29,5 @@ INCLUDE "constants/tilesets.asm" INCLUDE "constants/starter_mons.asm" INCLUDE "constants/event_constants.asm" INCLUDE "constants/event_macros.asm" +INCLUDE "constants/pikachu_emotion_constants.asm" +INCLUDE "constants/text_constants.asm" diff --git a/constants/credits_constants.asm b/constants/credits_constants.asm index f5715072..013ceceb 100644 --- a/constants/credits_constants.asm +++ b/constants/credits_constants.asm @@ -1,67 +1,95 @@ -const_value = 0 - - const CRED_VERSION ; $00 - const CRED_TAJIRI ; $01 - const CRED_TA_OOTA ; $02 - const CRED_MORIMOTO ; $03 - const CRED_WATANABE ; $04 - const CRED_MASUDE ; $05 - const CRED_NISINO ; $06 - const CRED_SUGIMORI ; $07 - const CRED_NISHIDA ; $08 - const CRED_MIYAMOTO ; $09 - const CRED_KAWAGUCHI ; $0A - const CRED_ISHIHARA ; $0B - const CRED_YAMAUCHI ; $0C - const CRED_ZINNAI ; $0D - const CRED_HISHIDA ; $0E - const CRED_SAKAI ; $0F - const CRED_YAMAGUCHI ; $10 - const CRED_YAMAMOTO ; $11 - const CRED_TANIGUCHI ; $12 - const CRED_NONOMURA ; $13 - const CRED_FUZIWARA ; $14 - const CRED_MATSUSIMA ; $15 - const CRED_TOMISAWA ; $16 - const CRED_KAWAMOTO ; $17 - const CRED_KAKEI ; $18 - const CRED_TSUCHIYA ; $19 - const CRED_TA_NAKAMURA ; $1A - const CRED_YUDA ; $1B - const CRED_MON ; $1C - const CRED_DIRECTOR ; $1D - const CRED_PROGRAMMERS ; $1E - const CRED_CHAR_DESIGN ; $1F - const CRED_MUSIC ; $20 - const CRED_SOUND_EFFECTS ; $21 - const CRED_GAME_DESIGN ; $22 - const CRED_MONSTER_DESIGN ; $23 - const CRED_GAME_SCENE ; $24 - const CRED_PARAM ; $25 - const CRED_MAP ; $26 - const CRED_TEST ; $27 - const CRED_SPECIAL ; $28 - const CRED_PRODUCERS ; $29 - const CRED_PRODUCER ; $2A - const CRED_EXECUTIVE ; $2B - const CRED_TAMADA ; $2C - const CRED_SA_OOTA ; $2D - const CRED_YOSHIKAWA ; $2E - const CRED_TO_OOTA ; $2F - const CRED_US_STAFF ; $30 - const CRED_US_COORD ; $31 - const CRED_TILDEN ; $32 - const CRED_KAWAKAMI ; $33 - const CRED_HI_NAKAMURA ; $34 - const CRED_GIESE ; $35 - const CRED_OSBORNE ; $36 - const CRED_TRANS ; $37 - const CRED_OGASAWARA ; $38 - const CRED_IWATA ; $39 - const CRED_IZUSHI ; $3A - const CRED_HARADA ; $3B - const CRED_MURAKAWA ; $3C - const CRED_FUKUI ; $3D - const CRED_CLUB ; $3E - const CRED_PAAD ; $3F + const_def + const CRED_VERSION ; 00 + const CRED_TAJIRI ; 01 + const CRED_OOTA ; 02 + const CRED_MORIMOTO ; 03 + const CRED_WATANABE ; 04 + const CRED_MASUDA ; 05 + const CRED_NISHINO ; 06 + const CRED_SUGIMORI ; 07 + const CRED_NISHIDA ; 08 + const CRED_MIYAMOTO ; 09 + const CRED_KAWAGUCHI ; 0a + const CRED_ISHIHARA ; 0b + const CRED_YAMAUCHI ; 0c + const CRED_ZINNAI ; 0d + const CRED_HISHIDA ; 0e + const CRED_SAKAI ; 0f + const CRED_YAMAGUCHI ; 10 + const CRED_YAMAMOTO ; 11 + const CRED_TANIGUCHI ; 12 + const CRED_NONOMURA ; 13 + const CRED_FUZIWARA ; 14 + const CRED_MATSUSIMA ; 15 + const CRED_TOMISAWA ; 16 + const CRED_KAWAMOTO ; 17 + const CRED_KAKEI ; 18 + const CRED_TSUCHIYA ; 19 + const CRED_NAKAMURA ; 1a + const CRED_YUDA ; 1b + const CRED_POKEMON ; 1c + const CRED_DIRECTOR ; 1d + const CRED_PROGRAMMERS ; 1e + const CRED_CHARACTER_DESIGN ; 1f + const CRED_MUSIC ; 20 + const CRED_SOUND_EFFECTS ; 21 + const CRED_GAME_DESIGN ; 22 + const CRED_MONSTER_DESIGN ; 23 + const CRED_GAME_SCENARIO ; 24 + const CRED_PARAMETRIC_DESIGN ; 25 + const CRED_MAP_DESIGN ; 26 + const CRED_TESTING ; 27 + const CRED_SPECIAL_THANKS ; 28 + const CRED_PRODUCER ; 29 + const CRED_EXECUTIVE_PRODUCER ; 2a + const CRED_TAMADA ; 2b + const CRED_OOTA2 ; 2c + const CRED_YOSHIKAWA ; 2d + const CRED_OOTA23 ; 2e + const CRED_YOSHIDA ; 2f + const CRED_MATSUMITA ; 30 + const CRED_SEYA ; 31 + const CRED_SEKINE ; 32 + const CRED_SHIMAMURA ; 33 + const CRED_SHIMOYAMADA ; 34 + const CRED_SUPER_MARIO_CLUB ; 35 + const CRED_IZUSHI ; 36 + const CRED_NOMURA ; 37 + const CRED_HARADA ; 38 + const CRED_YAMAGAMI ; 39 + const CRED_NISHIMURA ; 3a + const CRED_SAEKI ; 3b + const CRED_FUZII ; 3c + const CRED_SHOGAKUKAN ; 3d + const CRED_OOTANI ; 3e + const CRED_PIKACHU_VOICE ; 3f + const CRED_U_S_STAFF ; 40 + const CRED_U_S_COORD ; 41 + const CRED_TILDEN ; 42 + const CRED_KAWAKAMI ; 43 + const CRED_NAKAMURA2 ; 44 + const CRED_SHOEMAKE ; 45 + const CRED_OSBORNE ; 46 + const CRED_TRANSLATION ; 47 + const CRED_OGASAWARA ; 48 + const CRED_IWATA ; 49 + const CRED_IZUSHI2 ; 4a + const CRED_HARADA2 ; 4b + const CRED_MURAKAWA ; 4c + const CRED_FUKUI ; 4d + const CRED_SUPER_MARIO_CLUB2 ; 4e + const CRED_PAAD ; 4f + const CRED_PRODUCERS ; 50 + const CRED_HOSOKAWA ; 51 + const CRED_OKUBO ; 52 + const CRED_NAKAMICHI ; 53 + const CRED_YOSHIMURA ; 54 + const CRED_YAMAZAKI ; 55 +const_value SET $fa + const CRED_THE_END + const CRED_COPYRIGHT + const CRED_TEXT + const CRED_TEXT_FADE + const CRED_TEXT_MON + const CRED_TEXT_FADE_MON diff --git a/constants/event_constants.asm b/constants/event_constants.asm index 47448d09..d2bf1123 100755..100644 --- a/constants/event_constants.asm +++ b/constants/event_constants.asm @@ -5,7 +5,7 @@ const_value = 0 const EVENT_002 ; 002, (D747, bit 2) const EVENT_HALL_OF_FAME_DEX_RATING ; 003, (D747, bit 3) const EVENT_004 ; 004, (D747, bit 4) - const EVENT_005 ; 005, (D747, bit 5) + const EVENT_PLAYER_AT_RIGHT_EXIT_TO_PALLET_TOWN ; 005, (D747, bit 5) const EVENT_PALLET_AFTER_GETTING_POKEBALLS ; 006, (D747, bit 6) const EVENT_007 ; 007, (D747, bit 7) const EVENT_008 ; 008, (D748, bit 0) @@ -168,7 +168,7 @@ const_value = 0 const EVENT_0A5 ; 0A5, (D75B, bit 5) const EVENT_0A6 ; 0A6, (D75B, bit 6) const EVENT_BEAT_CERULEAN_ROCKET_THIEF ; 0A7, (D75B, bit 7) - const EVENT_0A8 ; 0A8, (D75C, bit 0) + const EVENT_GOT_BULBASAUR_IN_CERULEAN ; 0A8, (D75C, bit 0) const EVENT_0A9 ; 0A9, (D75C, bit 1) const EVENT_0AA ; 0AA, (D75C, bit 2) const EVENT_0AB ; 0AB, (D75C, bit 3) @@ -327,7 +327,7 @@ const_value = 0 const EVENT_144 ; 144, (D76F, bit 4) const EVENT_145 ; 145, (D76F, bit 5) const EVENT_146 ; 146, (D76F, bit 6) - const EVENT_147 ; 147, (D76F, bit 7) + const EVENT_GOT_SQUIRTLE_FROM_OFFICER_JENNY ; 147, (D76F, bit 7) const EVENT_148 ; 148, (D770, bit 0) const EVENT_149 ; 149, (D770, bit 1) const EVENT_14A ; 14A, (D770, bit 2) @@ -1381,8 +1381,8 @@ const_value = 0 const EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_0 ; 562, (D7F3, bit 2) const EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_1 ; 563, (D7F3, bit 3) const EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_2 ; 564, (D7F3, bit 4) - const EVENT_565 ; 565, (D7F3, bit 5) - const EVENT_566 ; 566, (D7F3, bit 6) + const EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_3 ; 565, (D7F3, bit 5) + const EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_4 ; 566, (D7F3, bit 6) const EVENT_567 ; 567, (D7F3, bit 7) const EVENT_568 ; 568, (D7F4, bit 0) const EVENT_569 ; 569, (D7F4, bit 1) @@ -1400,13 +1400,13 @@ const_value = 0 const EVENT_BEAT_MT_MOON_1_TRAINER_5 ; 575, (D7F5, bit 5) const EVENT_BEAT_MT_MOON_1_TRAINER_6 ; 576, (D7F5, bit 6) const EVENT_BEAT_MT_MOON_1_TRAINER_7 ; 577, (D7F5, bit 7) - const EVENT_578 ; 578, (D7F6, bit 0) + const EVENT_GOT_DOME_FOSSIL ; 578, (D7F6, bit 0) const EVENT_BEAT_MT_MOON_EXIT_SUPER_NERD ; 579, (D7F6, bit 1) const EVENT_BEAT_MT_MOON_3_TRAINER_0 ; 57A, (D7F6, bit 2) const EVENT_BEAT_MT_MOON_3_TRAINER_2 ; 57B, (D7F6, bit 3) const EVENT_BEAT_MT_MOON_3_TRAINER_3 ; 57C, (D7F6, bit 4) const EVENT_BEAT_MT_MOON_3_TRAINER_4 ; 57D, (D7F6, bit 5) - const EVENT_GOT_DOME_FOSSIL ; 57E, (D7F6, bit 6) + const EVENT_57E ; 57E, (D7F6, bit 6) const EVENT_GOT_HELIX_FOSSIL ; 57F, (D7F6, bit 7) const EVENT_580 ; 580, (D7F7, bit 0) const EVENT_581 ; 581, (D7F7, bit 1) @@ -2560,3 +2560,5 @@ const_value = 0 const EVENT_9FD ; 9FD, (D886, bit 5) const EVENT_9FE ; 9FE, (D886, bit 6) const EVENT_9FF ; 9FF, (D886, bit 7) + +NUM_EVENT_FLAGS EQU const_value diff --git a/constants/event_macros.asm b/constants/event_macros.asm index 20027209..a3ce9746 100755..100644 --- a/constants/event_macros.asm +++ b/constants/event_macros.asm @@ -57,6 +57,16 @@ event_byte = ((\2) / 8) ld \1, wEventFlags + event_byte ENDM +EventFlagAddressa: MACRO +event_byte = ((\1) / 8) + ld [wEventFlags + event_byte], a + ENDM + +aEventFlagAddress: MACRO +event_byte = ((\1) / 8) + ld a, [wEventFlags + event_byte] + ENDM + ;\1 = event index CheckEventHL: MACRO event_byte = ((\1) / 8) @@ -125,6 +135,27 @@ CheckAndResetEventA: MACRO ld [wEventFlags + ((\1) / 8)], a ENDM +CheckAndSetEventReuseHL: MACRO + IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + ENDC + + bit (\1) % 8, [hl] + set (\1) % 8, [hl] + ENDM + +CheckAndResetEventReuseHL: MACRO + IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + ENDC + + bit (\1) % 8, [hl] + res (\1) % 8, [hl] + ENDM + + ;\1 = event index SetEvent: MACRO event_byte = ((\1) / 8) @@ -431,6 +462,36 @@ CheckEitherEventSet: MACRO ENDC ENDM +CheckEitherEventSetReuseA: MACRO + IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld a, [wEventFlags + event_byte] + ENDC + IF ((\1) / 8) == ((\2) / 8) + ld a, [wEventFlags + ((\1) / 8)] + and (1 << ((\1) % 8)) | (1 << ((\2) % 8)) + ELSE + ; This case doesn't happen in the original ROM. + IF ((\1) % 8) == ((\2) % 8) + push hl + ld a, [wEventFlags + ((\1) / 8)] + ld hl, wEventFlags + ((\2) / 8) + or [hl] + bit ((\1) % 8), a + pop hl + ELSE + push bc + ld a, [wEventFlags + ((\1) / 8)] + and (1 << ((\1) % 8)) + ld b, a + ld a, [wEventFlags + ((\2) / 8)] + and (1 << ((\2) % 8)) + or b + pop bc + ENDC + ENDC + ENDM + ; for handling fixed event bits when events are inserted/removed ;\1 = event index ;\2 = fixed flag bit diff --git a/constants/hide_show_constants.asm b/constants/hide_show_constants.asm index 1a44b1e7..fb4116d7 100755 --- a/constants/hide_show_constants.asm +++ b/constants/hide_show_constants.asm @@ -1,236 +1,245 @@ ; this is a list of the sprites that can be enabled/disabled during the game -; sprites marked with an X are constants that are never used -; because those sprites are not (de)activated in a map's script -; (they are either items or sprites that deactivate after battle -; and are detected in wMissableObjectList) +; there may be unused sprites, but these will remain unmarked until +; the disassembly is complete -const_value = 0 + const_def const HS_PALLET_TOWN_OAK ; 00 const HS_LYING_OLD_MAN ; 01 - const HS_OLD_MAN ; 02 - const HS_MUSEUM_GUY ; 03 - const HS_GYM_GUY ; 04 - const HS_CERULEAN_RIVAL ; 05 - const HS_CERULEAN_ROCKET ; 06 - const HS_CERULEAN_GUARD_1 ; 07 - const HS_UNKNOWN_DUNGEON_GUY ; 08 - const HS_CERULEAN_GUARD_2 ; 09 - const HS_SAFFRON_CITY_1 ; 0A - const HS_SAFFRON_CITY_2 ; 0B - const HS_SAFFRON_CITY_3 ; 0C - const HS_SAFFRON_CITY_4 ; 0D - const HS_SAFFRON_CITY_5 ; 0E - const HS_SAFFRON_CITY_6 ; 0F - const HS_SAFFRON_CITY_7 ; 10 - const HS_SAFFRON_CITY_8 ; 11 - const HS_SAFFRON_CITY_9 ; 12 - const HS_SAFFRON_CITY_A ; 13 - const HS_SAFFRON_CITY_B ; 14 - const HS_SAFFRON_CITY_C ; 15 - const HS_SAFFRON_CITY_D ; 16 - const HS_SAFFRON_CITY_E ; 17 - const HS_SAFFRON_CITY_F ; 18 - const HS_ROUTE_2_ITEM_1 ; 19 X - const HS_ROUTE_2_ITEM_2 ; 1A X - const HS_ROUTE_4_ITEM ; 1B X - const HS_ROUTE_9_ITEM ; 1C X - const HS_ROUTE_12_SNORLAX ; 1D - const HS_ROUTE_12_ITEM_1 ; 1E X - const HS_ROUTE_12_ITEM_2 ; 1F X - const HS_ROUTE_15_ITEM ; 20 X - const HS_ROUTE_16_SNORLAX ; 21 - const HS_ROUTE_22_RIVAL_1 ; 22 - const HS_ROUTE_22_RIVAL_2 ; 23 - const HS_NUGGET_BRIDGE_GUY ; 24 - const HS_ROUTE_24_ITEM ; 25 X - const HS_ROUTE_25_ITEM ; 26 X - const HS_DAISY_SITTING ; 27 - const HS_DAISY_WALKING ; 28 - const HS_TOWN_MAP ; 29 - const HS_OAKS_LAB_RIVAL ; 2A - const HS_STARTER_BALL_1 ; 2B - const HS_STARTER_BALL_2 ; 2C - const HS_STARTER_BALL_3 ; 2D - const HS_OAKS_LAB_OAK_1 ; 2E - const HS_POKEDEX_1 ; 2F - const HS_POKEDEX_2 ; 30 - const HS_OAKS_LAB_OAK_2 ; 31 - const HS_VIRIDIAN_GYM_GIOVANNI ; 32 - const HS_VIRIDIAN_GYM_ITEM ; 33 X - const HS_OLD_AMBER ; 34 - const HS_UNKNOWN_DUNGEON_1_ITEM_1 ; 35 X - const HS_UNKNOWN_DUNGEON_1_ITEM_2 ; 36 X - const HS_UNKNOWN_DUNGEON_1_ITEM_3 ; 37 X - const HS_POKEMONTOWER_2_RIVAL ; 38 - const HS_POKEMONTOWER_3_ITEM ; 39 X - const HS_POKEMONTOWER_4_ITEM_1 ; 3A X - const HS_POKEMONTOWER_4_ITEM_2 ; 3B X - const HS_POKEMONTOWER_4_ITEM_3 ; 3C X - const HS_POKEMONTOWER_5_ITEM ; 3D X - const HS_POKEMONTOWER_6_ITEM_1 ; 3E X - const HS_POKEMONTOWER_6_ITEM_2 ; 3F X - const HS_POKEMONTOWER_7_ROCKET_1 ; 40 X - const HS_POKEMONTOWER_7_ROCKET_2 ; 41 X - const HS_POKEMONTOWER_7_ROCKET_3 ; 42 X + const HS_OLD_MAN_1 ; 02 + const HS_OLD_MAN ; 03 + const HS_MUSEUM_GUY ; 04 + const HS_GYM_GUY ; 05 + const HS_CERULEAN_RIVAL ; 06 + const HS_CERULEAN_ROCKET ; 07 + const HS_CERULEAN_GUARD_1 ; 08 + const HS_UNKNOWN_DUNGEON_GUY ; 09 + const HS_CERULEAN_GUARD_2 ; 0A + const HS_SAFFRON_CITY_1 ; 0B + const HS_SAFFRON_CITY_2 ; 0C + const HS_SAFFRON_CITY_3 ; 0D + const HS_SAFFRON_CITY_4 ; 0E + const HS_SAFFRON_CITY_5 ; 0F + const HS_SAFFRON_CITY_6 ; 10 + const HS_SAFFRON_CITY_7 ; 11 + const HS_SAFFRON_CITY_8 ; 12 + const HS_SAFFRON_CITY_9 ; 13 + const HS_SAFFRON_CITY_A ; 14 + const HS_SAFFRON_CITY_B ; 15 + const HS_SAFFRON_CITY_C ; 16 + const HS_SAFFRON_CITY_D ; 17 + const HS_SAFFRON_CITY_E ; 18 + const HS_SAFFRON_CITY_F ; 19 + const HS_ROUTE_2_ITEM_1 ; 1A + const HS_ROUTE_2_ITEM_2 ; 1B + const HS_ROUTE_4_ITEM ; 1C + const HS_ROUTE_9_ITEM ; 1D + const HS_ROUTE_12_SNORLAX ; 1E + const HS_ROUTE_12_ITEM_1 ; 1F + const HS_ROUTE_12_ITEM_2 ; 20 + const HS_ROUTE_15_ITEM ; 21 + const HS_ROUTE_16_SNORLAX ; 22 + const HS_ROUTE_22_RIVAL_1 ; 23 + const HS_ROUTE_22_RIVAL_2 ; 24 + const HS_NUGGET_BRIDGE_GUY ; 25 + const HS_ROUTE_24_ITEM ; 26 + const HS_ROUTE_25_ITEM ; 27 + const HS_DAISY_SITTING ; 28 + const HS_DAISY_WALKING ; 29 + const HS_TOWN_MAP ; 2A + const HS_OAKS_LAB_RIVAL ; 2B + const HS_STARTER_BALL_1 ; 2C + const HS_OAKS_LAB_OAK_1 ; 2D + const HS_POKEDEX_1 ; 2E + const HS_POKEDEX_2 ; 2F + const HS_OAKS_LAB_OAK_2 ; 30 + const HS_VIRIDIAN_GYM_GIOVANNI ; 31 + const HS_VIRIDIAN_GYM_ITEM ; 32 + const HS_OLD_AMBER ; 33 + const HS_CERULEAN_BULBASAUR ; 34 + const HS_UNKNOWN_DUNGEON_1_ITEM_1 ; 35 + const HS_UNKNOWN_DUNGEON_1_ITEM_2 ; 36 + const HS_UNKNOWN_DUNGEON_1_ITEM_3 ; 37 + const HS_UNKNOWN_DUNGEON_1_ITEM_4 ; 38 + const HS_POKEMONTOWER_2_RIVAL ; 39 + const HS_POKEMONTOWER_3_ITEM ; 3A + const HS_POKEMONTOWER_4_ITEM_1 ; 3B + const HS_POKEMONTOWER_4_ITEM_2 ; 3C + const HS_POKEMONTOWER_4_ITEM_3 ; 3D + const HS_POKEMONTOWER_5_ITEM ; 3E + const HS_POKEMONTOWER_6_ITEM_1 ; 3F + const HS_POKEMONTOWER_6_ITEM_2 ; 40 + const HS_POKEMONTOWER_7_JESSIE ; 41 + const HS_POKEMONTOWER_7_JAMES ; 42 const HS_POKEMONTOWER_7_MR_FUJI ; 43 const HS_LAVENDER_HOUSE_1_MR_FUJI ; 44 const HS_CELADON_MANSION_5_GIFT ; 45 const HS_GAME_CORNER_ROCKET ; 46 - const HS_FUCHSIA_HOUSE_2_ITEM ; 47 X - const HS_MANSION_1_ITEM_1 ; 48 X - const HS_MANSION_1_ITEM_2 ; 49 X + const HS_FUCHSIA_HOUSE_2_ITEM ; 47 + const HS_MANSION_1_ITEM_1 ; 48 + const HS_MANSION_1_ITEM_2 ; 49 const HS_FIGHTING_DOJO_GIFT_1 ; 4A const HS_FIGHTING_DOJO_GIFT_2 ; 4B const HS_SILPH_CO_1F_RECEPTIONIST ; 4C - const HS_VOLTORB_1 ; 4D X - const HS_VOLTORB_2 ; 4E X - const HS_VOLTORB_3 ; 4F X - const HS_ELECTRODE_1 ; 50 X - const HS_VOLTORB_4 ; 51 X - const HS_VOLTORB_5 ; 52 X - const HS_ELECTRODE_2 ; 53 X - const HS_VOLTORB_6 ; 54 X - const HS_ZAPDOS ; 55 X - const HS_POWER_PLANT_ITEM_1 ; 56 X - const HS_POWER_PLANT_ITEM_2 ; 57 X - const HS_POWER_PLANT_ITEM_3 ; 58 X - const HS_POWER_PLANT_ITEM_4 ; 59 X - const HS_POWER_PLANT_ITEM_5 ; 5A X - const HS_MOLTRES ; 5B X - const HS_VICTORY_ROAD_2_ITEM_1 ; 5C X - const HS_VICTORY_ROAD_2_ITEM_2 ; 5D X - const HS_VICTORY_ROAD_2_ITEM_3 ; 5E X - const HS_VICTORY_ROAD_2_ITEM_4 ; 5F X + const HS_VOLTORB_1 ; 4D + const HS_VOLTORB_2 ; 4E + const HS_VOLTORB_3 ; 4F + const HS_ELECTRODE_1 ; 50 + const HS_VOLTORB_4 ; 51 + const HS_VOLTORB_5 ; 52 + const HS_ELECTRODE_2 ; 53 + const HS_VOLTORB_6 ; 54 + const HS_ZAPDOS ; 55 + const HS_POWER_PLANT_ITEM_1 ; 56 + const HS_POWER_PLANT_ITEM_2 ; 57 + const HS_POWER_PLANT_ITEM_3 ; 58 + const HS_POWER_PLANT_ITEM_4 ; 59 + const HS_POWER_PLANT_ITEM_5 ; 5A + const HS_MOLTRES ; 5B + const HS_VICTORY_ROAD_2_ITEM_1 ; 5C + const HS_VICTORY_ROAD_2_ITEM_2 ; 5D + const HS_VICTORY_ROAD_2_ITEM_3 ; 5E + const HS_VICTORY_ROAD_2_ITEM_4 ; 5F const HS_VICTORY_ROAD_2_BOULDER ; 60 const HS_BILL_POKEMON ; 61 const HS_BILL_1 ; 62 const HS_BILL_2 ; 63 - const HS_VIRIDIAN_FOREST_ITEM_1 ; 64 X - const HS_VIRIDIAN_FOREST_ITEM_2 ; 65 X - const HS_VIRIDIAN_FOREST_ITEM_3 ; 66 X - const HS_MT_MOON_1_ITEM_1 ; 67 X - const HS_MT_MOON_1_ITEM_2 ; 68 X - const HS_MT_MOON_1_ITEM_3 ; 69 X - const HS_MT_MOON_1_ITEM_4 ; 6A X - const HS_MT_MOON_1_ITEM_5 ; 6B X - const HS_MT_MOON_1_ITEM_6 ; 6C X - const HS_MT_MOON_3_FOSSIL_1 ; 6D - const HS_MT_MOON_3_FOSSIL_2 ; 6E - const HS_MT_MOON_3_ITEM_1 ; 6F X - const HS_MT_MOON_3_ITEM_2 ; 70 X - const HS_SS_ANNE_2_RIVAL ; 71 - const HS_SS_ANNE_8_ITEM ; 72 X - const HS_SS_ANNE_9_ITEM_1 ; 73 X - const HS_SS_ANNE_9_ITEM_2 ; 74 X - const HS_SS_ANNE_10_ITEM_1 ; 75 X - const HS_SS_ANNE_10_ITEM_2 ; 76 X - const HS_SS_ANNE_10_ITEM_3 ; 77 X - const HS_VICTORY_ROAD_3_ITEM_1 ; 78 X - const HS_VICTORY_ROAD_3_ITEM_2 ; 79 X - const HS_VICTORY_ROAD_3_BOULDER ; 7A - const HS_ROCKET_HIDEOUT_1_ITEM_1 ; 7B X - const HS_ROCKET_HIDEOUT_1_ITEM_2 ; 7C X - const HS_ROCKET_HIDEOUT_2_ITEM_1 ; 7D X - const HS_ROCKET_HIDEOUT_2_ITEM_2 ; 7E X - const HS_ROCKET_HIDEOUT_2_ITEM_3 ; 7F X - const HS_ROCKET_HIDEOUT_2_ITEM_4 ; 80 X - const HS_ROCKET_HIDEOUT_3_ITEM_1 ; 81 X - const HS_ROCKET_HIDEOUT_3_ITEM_2 ; 82 X - const HS_ROCKET_HIDEOUT_4_GIOVANNI ; 83 - const HS_ROCKET_HIDEOUT_4_ITEM_1 ; 84 X - const HS_ROCKET_HIDEOUT_4_ITEM_2 ; 85 X - const HS_ROCKET_HIDEOUT_4_ITEM_3 ; 86 X - const HS_ROCKET_HIDEOUT_4_ITEM_4 ; 87 - const HS_ROCKET_HIDEOUT_4_ITEM_5 ; 88 - const HS_SILPH_CO_2F_1 ; 89 XXX never (de)activated? - const HS_SILPH_CO_2F_2 ; 8A - const HS_SILPH_CO_2F_3 ; 8B - const HS_SILPH_CO_2F_4 ; 8C - const HS_SILPH_CO_2F_5 ; 8D - const HS_SILPH_CO_3F_1 ; 8E - const HS_SILPH_CO_3F_2 ; 8F - const HS_SILPH_CO_3F_ITEM ; 90 X - const HS_SILPH_CO_4F_1 ; 91 - const HS_SILPH_CO_4F_2 ; 92 - const HS_SILPH_CO_4F_3 ; 93 - const HS_SILPH_CO_4F_ITEM_1 ; 94 X - const HS_SILPH_CO_4F_ITEM_2 ; 95 X - const HS_SILPH_CO_4F_ITEM_3 ; 96 X - const HS_SILPH_CO_5F_1 ; 97 - const HS_SILPH_CO_5F_2 ; 98 - const HS_SILPH_CO_5F_3 ; 99 - const HS_SILPH_CO_5F_4 ; 9A - const HS_SILPH_CO_5F_ITEM_1 ; 9B X - const HS_SILPH_CO_5F_ITEM_2 ; 9C X - const HS_SILPH_CO_5F_ITEM_3 ; 9D X - const HS_SILPH_CO_6F_1 ; 9E - const HS_SILPH_CO_6F_2 ; 9F - const HS_SILPH_CO_6F_3 ; A0 - const HS_SILPH_CO_6F_ITEM_1 ; A1 X - const HS_SILPH_CO_6F_ITEM_2 ; A2 X - const HS_SILPH_CO_7F_1 ; A3 - const HS_SILPH_CO_7F_2 ; A4 - const HS_SILPH_CO_7F_3 ; A5 - const HS_SILPH_CO_7F_4 ; A6 - const HS_SILPH_CO_7F_RIVAL ; A7 - const HS_SILPH_CO_7F_ITEM_1 ; A8 X - const HS_SILPH_CO_7F_ITEM_2 ; A9 X - const HS_SILPH_CO_7F_8 ; AA XXX sprite doesn't exist - const HS_SILPH_CO_8F_1 ; AB - const HS_SILPH_CO_8F_2 ; AC - const HS_SILPH_CO_8F_3 ; AD - const HS_SILPH_CO_9F_1 ; AE - const HS_SILPH_CO_9F_2 ; AF - const HS_SILPH_CO_9F_3 ; B0 - const HS_SILPH_CO_10F_1 ; B1 - const HS_SILPH_CO_10F_2 ; B2 - const HS_SILPH_CO_10F_3 ; B3 XXX never (de)activated? - const HS_SILPH_CO_10F_ITEM_1 ; B4 X - const HS_SILPH_CO_10F_ITEM_2 ; B5 X - const HS_SILPH_CO_10F_ITEM_3 ; B6 X - const HS_SILPH_CO_11F_1 ; B7 - const HS_SILPH_CO_11F_2 ; B8 - const HS_SILPH_CO_11F_3 ; B9 - const HS_MAP_F4_1 ; BA XXX sprite doesn't exist - const HS_MANSION_2_ITEM ; BB X - const HS_MANSION_3_ITEM_1 ; BC X - const HS_MANSION_3_ITEM_2 ; BD X - const HS_MANSION_4_ITEM_1 ; BE X - const HS_MANSION_4_ITEM_2 ; BF X - const HS_MANSION_4_ITEM_3 ; C0 X - const HS_MANSION_4_ITEM_4 ; C1 X - const HS_MANSION_4_ITEM_5 ; C2 X - const HS_SAFARI_ZONE_EAST_ITEM_1 ; C3 X - const HS_SAFARI_ZONE_EAST_ITEM_2 ; C4 X - const HS_SAFARI_ZONE_EAST_ITEM_3 ; C5 X - const HS_SAFARI_ZONE_EAST_ITEM_4 ; C6 X - const HS_SAFARI_ZONE_NORTH_ITEM_1 ; C7 X - const HS_SAFARI_ZONE_NORTH_ITEM_2 ; C8 X - const HS_SAFARI_ZONE_WEST_ITEM_1 ; C9 X - const HS_SAFARI_ZONE_WEST_ITEM_2 ; CA X - const HS_SAFARI_ZONE_WEST_ITEM_3 ; CB X - const HS_SAFARI_ZONE_WEST_ITEM_4 ; CC X - const HS_SAFARI_ZONE_CENTER_ITEM ; CD X - const HS_UNKNOWN_DUNGEON_2_ITEM_1 ; CE X - const HS_UNKNOWN_DUNGEON_2_ITEM_2 ; CF X - const HS_UNKNOWN_DUNGEON_2_ITEM_3 ; D0 X - const HS_MEWTWO ; D1 X - const HS_UNKNOWN_DUNGEON_3_ITEM_1 ; D2 X - const HS_UNKNOWN_DUNGEON_3_ITEM_2 ; D3 X - const HS_VICTORY_ROAD_1_ITEM_1 ; D4 X - const HS_VICTORY_ROAD_1_ITEM_2 ; D5 X - const HS_CHAMPIONS_ROOM_OAK ; D6 - const HS_SEAFOAM_ISLANDS_1_BOULDER_1 ; D7 - const HS_SEAFOAM_ISLANDS_1_BOULDER_2 ; D8 - const HS_SEAFOAM_ISLANDS_2_BOULDER_1 ; D9 - const HS_SEAFOAM_ISLANDS_2_BOULDER_2 ; DA - const HS_SEAFOAM_ISLANDS_3_BOULDER_1 ; DB - const HS_SEAFOAM_ISLANDS_3_BOULDER_2 ; DC - const HS_SEAFOAM_ISLANDS_4_BOULDER_1 ; DD - const HS_SEAFOAM_ISLANDS_4_BOULDER_2 ; DE - const HS_SEAFOAM_ISLANDS_4_BOULDER_3 ; DF - const HS_SEAFOAM_ISLANDS_4_BOULDER_4 ; E0 - const HS_SEAFOAM_ISLANDS_5_BOULDER_1 ; E1 - const HS_SEAFOAM_ISLANDS_5_BOULDER_2 ; E2 - const HS_ARTICUNO ; E3 X + const HS_VIRIDIAN_FOREST_ITEM_1 ; 64 + const HS_VIRIDIAN_FOREST_ITEM_2 ; 65 + const HS_VIRIDIAN_FOREST_ITEM_3 ; 66 + const HS_MT_MOON_1_ITEM_1 ; 67 + const HS_MT_MOON_1_ITEM_2 ; 68 + const HS_MT_MOON_1_ITEM_3 ; 69 + const HS_MT_MOON_1_ITEM_4 ; 6A + const HS_MT_MOON_1_ITEM_5 ; 6B + const HS_MT_MOON_1_ITEM_6 ; 6C + const HS_MT_MOON_JESSIE ; 6D + const HS_MT_MOON_JAMES ; 6E + const HS_MT_MOON_3_FOSSIL_1 ; 6F + const HS_MT_MOON_3_FOSSIL_2 ; 70 + const HS_MT_MOON_3_ITEM_1 ; 71 + const HS_MT_MOON_3_ITEM_2 ; 72 + const HS_SS_ANNE_2_RIVAL ; 73 + const HS_SS_ANNE_8_ITEM ; 74 + const HS_SS_ANNE_9_ITEM_1 ; 75 + const HS_SS_ANNE_9_ITEM_2 ; 76 + const HS_SS_ANNE_10_ITEM_1 ; 77 + const HS_SS_ANNE_10_ITEM_2 ; 78 + const HS_SS_ANNE_10_ITEM_3 ; 79 + const HS_VICTORY_ROAD_3_ITEM_1 ; 7A + const HS_VICTORY_ROAD_3_ITEM_2 ; 7B + const HS_VICTORY_ROAD_3_BOULDER ; 7C + const HS_ROCKET_HIDEOUT_1_ITEM_1 ; 7D + const HS_ROCKET_HIDEOUT_1_ITEM_2 ; 7E + const HS_ROCKET_HIDEOUT_2_ITEM_1 ; 7F + const HS_ROCKET_HIDEOUT_2_ITEM_2 ; 80 + const HS_ROCKET_HIDEOUT_2_ITEM_3 ; 81 + const HS_ROCKET_HIDEOUT_2_ITEM_4 ; 82 + const HS_ROCKET_HIDEOUT_3_ITEM_1 ; 83 + const HS_ROCKET_HIDEOUT_3_ITEM_2 ; 84 + const HS_ROCKET_HIDEOUT_4_GIOVANNI ; 85 + const HS_ROCKET_HIDEOUT_4_JAMES ; 86 + const HS_ROCKET_HIDEOUT_4_JESSIE ; 87 + const HS_ROCKET_HIDEOUT_4_ITEM_1 ; 88 + const HS_ROCKET_HIDEOUT_4_ITEM_2 ; 89 + const HS_ROCKET_HIDEOUT_4_ITEM_3 ; 8A + const HS_ROCKET_HIDEOUT_4_ITEM_4 ; 8B + const HS_ROCKET_HIDEOUT_4_ITEM_5 ; 8C + const HS_SILPH_CO_2F_1 ; 8D + const HS_SILPH_CO_2F_2 ; 8E + const HS_SILPH_CO_2F_3 ; 8F + const HS_SILPH_CO_2F_4 ; 90 + const HS_SILPH_CO_2F_5 ; 91 + const HS_SILPH_CO_3F_1 ; 92 + const HS_SILPH_CO_3F_2 ; 93 + const HS_SILPH_CO_3F_ITEM ; 94 + const HS_SILPH_CO_4F_1 ; 95 + const HS_SILPH_CO_4F_2 ; 96 + const HS_SILPH_CO_4F_3 ; 97 + const HS_SILPH_CO_4F_ITEM_1 ; 98 + const HS_SILPH_CO_4F_ITEM_2 ; 99 + const HS_SILPH_CO_4F_ITEM_3 ; 9A + const HS_SILPH_CO_5F_1 ; 9B + const HS_SILPH_CO_5F_2 ; 9C + const HS_SILPH_CO_5F_3 ; 9D + const HS_SILPH_CO_5F_4 ; 9E + const HS_SILPH_CO_5F_ITEM_1 ; 9F + const HS_SILPH_CO_5F_ITEM_2 ; A0 + const HS_SILPH_CO_5F_ITEM_3 ; A1 + const HS_SILPH_CO_6F_1 ; A2 + const HS_SILPH_CO_6F_2 ; A3 + const HS_SILPH_CO_6F_3 ; A4 + const HS_SILPH_CO_6F_ITEM_1 ; A5 + const HS_SILPH_CO_6F_ITEM_2 ; A6 + const HS_SILPH_CO_7F_1 ; A7 + const HS_SILPH_CO_7F_2 ; A8 + const HS_SILPH_CO_7F_3 ; A9 + const HS_SILPH_CO_7F_4 ; AA + const HS_SILPH_CO_7F_RIVAL ; AB + const HS_SILPH_CO_7F_ITEM_1 ; AC + const HS_SILPH_CO_7F_ITEM_2 ; AD + const HS_SILPH_CO_7F_8 ; AE + const HS_SILPH_CO_8F_1 ; AF + const HS_SILPH_CO_8F_2 ; B0 + const HS_SILPH_CO_8F_3 ; B1 + const HS_SILPH_CO_9F_1 ; B2 + const HS_SILPH_CO_9F_2 ; B3 + const HS_SILPH_CO_9F_3 ; B4 + const HS_SILPH_CO_10F_1 ; B5 + const HS_SILPH_CO_10F_2 ; B6 + const HS_SILPH_CO_10F_3 ; B7 + const HS_SILPH_CO_10F_ITEM_1 ; B8 + const HS_SILPH_CO_10F_ITEM_2 ; B9 + const HS_SILPH_CO_10F_ITEM_3 ; BA + const HS_SILPH_CO_11F_1 ; BB + const HS_SILPH_CO_11F_JAMES ; BC + const HS_SILPH_CO_11F_2 ; BD + const HS_SILPH_CO_11F_JESSIE ; BE + const HS_MAP_F4_1 ; BF + const HS_MANSION_2_ITEM ; C0 + const HS_MANSION_3_ITEM_1 ; C1 + const HS_MANSION_3_ITEM_2 ; C2 + const HS_MANSION_4_ITEM_1 ; C3 + const HS_MANSION_4_ITEM_2 ; C4 + const HS_MANSION_4_ITEM_3 ; C5 + const HS_MANSION_4_ITEM_4 ; C6 + const HS_MANSION_4_ITEM_5 ; C7 + const HS_SAFARI_ZONE_EAST_ITEM_1 ; C8 + const HS_SAFARI_ZONE_EAST_ITEM_2 ; C9 + const HS_SAFARI_ZONE_EAST_ITEM_3 ; CA + const HS_SAFARI_ZONE_EAST_ITEM_4 ; CB + const HS_SAFARI_ZONE_NORTH_ITEM_1 ; CC + const HS_SAFARI_ZONE_NORTH_ITEM_2 ; CD + const HS_SAFARI_ZONE_WEST_ITEM_1 ; CE + const HS_SAFARI_ZONE_WEST_ITEM_2 ; CF + const HS_SAFARI_ZONE_WEST_ITEM_3 ; D0 + const HS_SAFARI_ZONE_WEST_ITEM_4 ; D1 + const HS_SAFARI_ZONE_CENTER_ITEM ; D2 + const HS_UNKNOWN_DUNGEON_2_ITEM_1 ; D3 + const HS_UNKNOWN_DUNGEON_2_ITEM_2 ; D4 + const HS_UNKNOWN_DUNGEON_2_ITEM_3 ; D5 + const HS_UNKNOWN_DUNGEON_2_ITEM_4 ; D6 + const HS_MEWTWO ; D7 + const HS_UNKNOWN_DUNGEON_3_ITEM_1 ; D8 + const HS_UNKNOWN_DUNGEON_3_ITEM_2 ; D9 + const HS_UNKNOWN_DUNGEON_3_ITEM_3 ; DA + const HS_UNKNOWN_DUNGEON_3_ITEM_4 ; DB + const HS_VICTORY_ROAD_1_ITEM_1 ; DC + const HS_VICTORY_ROAD_1_ITEM_2 ; DD + const HS_CHAMPIONS_ROOM_OAK ; DE + const HS_SEAFOAM_ISLANDS_1_BOULDER_1 ; DF + const HS_SEAFOAM_ISLANDS_1_BOULDER_2 ; E0 + const HS_SEAFOAM_ISLANDS_2_BOULDER_1 ; E1 + const HS_SEAFOAM_ISLANDS_2_BOULDER_2 ; E2 + const HS_SEAFOAM_ISLANDS_3_BOULDER_1 ; E3 + const HS_SEAFOAM_ISLANDS_3_BOULDER_2 ; E4 + const HS_SEAFOAM_ISLANDS_4_BOULDER_1 ; E5 + const HS_SEAFOAM_ISLANDS_4_BOULDER_2 ; E6 + const HS_SEAFOAM_ISLANDS_4_BOULDER_3 ; E7 + const HS_SEAFOAM_ISLANDS_4_BOULDER_4 ; E8 + const HS_SEAFOAM_ISLANDS_5_BOULDER_1 ; E9 + const HS_SEAFOAM_ISLANDS_5_BOULDER_2 ; EA + const HS_ARTICUNO ; EB + const HS_DAISY_SITTING_COPY ; EC + const HS_DAISY_WALKING_COPY ; ED + const HS_TOWN_MAP_COPY ; EE diff --git a/constants/map_constants.asm b/constants/map_constants.asm index cbedef3f..c2068dd9 100644 --- a/constants/map_constants.asm +++ b/constants/map_constants.asm @@ -253,3 +253,4 @@ ENDM mapconst LORELEIS_ROOM, 6, 5 ; $F5 mapconst BRUNOS_ROOM, 6, 5 ; $F6 mapconst AGATHAS_ROOM, 6, 5 ; $F7 + mapconst BEACH_HOUSE, 4, 7 ; $F8 diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index de777c5d..8e5b9866 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -29,6 +29,16 @@ D_LEFT EQU %00100000 D_UP EQU %01000000 D_DOWN EQU %10000000 +const_value set 0 + const BIT_A_BUTTON + const BIT_B_BUTTON + const BIT_SELECT + const BIT_START + const BIT_D_RIGHT + const BIT_D_LEFT + const BIT_D_UP + const BIT_D_DOWN + SCREEN_WIDTH EQU 20 SCREEN_HEIGHT EQU 18 @@ -93,6 +103,11 @@ PARTY_TO_DAYCARE EQU 3 EXCLAMATION_BUBBLE EQU 0 QUESTION_BUBBLE EQU 1 SMILE_BUBBLE EQU 2 +SKULL_BUBBLE EQU 3 +HEART_BUBBLE EQU 4 +BOLT_BUBBLE EQU 5 +ZZZ_BUBBLE EQU 6 +FISH_BUBBLE EQU 7 ; slot symbols SLOTS7 EQU $0200 @@ -152,20 +167,6 @@ FLAG_RESET EQU 0 FLAG_SET EQU 1 FLAG_TEST EQU 2 -; special text IDs -TEXT_MON_FAINTED EQU $d0 -TEXT_BLACKED_OUT EQU $d1 -TEXT_REPEL_WORE_OFF EQU $d2 -TEXT_SAFARI_GAME_OVER EQU $d3 - -; PrintNumber - -BIT_LEFT_ALIGN EQU 6 -BIT_LEADING_ZEROES EQU 7 - -LEFT_ALIGN EQU (1 << BIT_LEFT_ALIGN) -LEADING_ZEROES EQU (1 << BIT_LEADING_ZEROES) - ; HP bar HP_BAR_GREEN EQU 0 HP_BAR_YELLOW EQU 1 @@ -178,6 +179,8 @@ BIT_TEST_BATTLE EQU 0 BATTLE_TYPE_NORMAL EQU 0 BATTLE_TYPE_OLD_MAN EQU 1 BATTLE_TYPE_SAFARI EQU 2 +BATTLE_TYPE_RUN EQU 3 +BATTLE_TYPE_PIKACHU EQU 4 ; serial @@ -204,3 +207,26 @@ LINK_STATE_START_BATTLE EQU $03 ; pre-battle initialisation LINK_STATE_BATTLING EQU $04 ; in a link battle LINK_STATE_RESET EQU $05 ; reset game (unused) LINK_STATE_TRADING EQU $32 ; in a link trade + +; pikachu happiness modifiers +const_value set 1 + const PIKAHAPPY_LEVELUP + const PIKAHAPPY_USEDITEM + const PIKAHAPPY_USEDXITEM + const PIKAHAPPY_GYMLEADER + const PIKAHAPPY_USEDTMHM + const PIKAHAPPY_WALKING + const PIKAHAPPY_DEPOSITED + const PIKAHAPPY_FAINTED + const PIKAHAPPY_PSNFNT + const PIKAHAPPY_CARELESSTRAINER + const PIKAHAPPY_TRADE + +; DMGPalToGBCPal +CONVERT_BGP EQU 0 +CONVERT_OBP0 EQU 1 +CONVERT_OBP1 EQU 2 + +NUM_COLORS EQU 4 +PAL_SIZE EQU NUM_COLORS * 2 +NUM_ACTIVE_PALS EQU 4 diff --git a/constants/music_constants.asm b/constants/music_constants.asm index 57ad230d..955a3899 100644 --- a/constants/music_constants.asm +++ b/constants/music_constants.asm @@ -94,7 +94,13 @@ ENDM music_const MUSIC_MEET_FEMALE_TRAINER, Music_MeetFemaleTrainer music_const MUSIC_MEET_MALE_TRAINER, Music_MeetMaleTrainer - ; AUDIO_1 AUDIO_2 AUDIO_3 + ; AUDIO_4 + music_const MUSIC_SURFING_PIKACHU, Music_SurfingPikachu + music_const MUSIC_MEET_JESSIE_JAMES, Music_MeetJessieJames + music_const MUSIC_YELLOW_UNUSED_SONG, Music_YellowUnusedSong + music_const MUSIC_GB_PRINTER, Music_GBPrinter + + ; AUDIO_1 AUDIO_2 AUDIO_3 AUDIO_4 music_const SFX_SNARE_1, SFX_Snare1_1 music_const SFX_SNARE_2, SFX_Snare2_1 music_const SFX_SNARE_3, SFX_Snare3_1 @@ -152,8 +158,9 @@ ENDM music_const SFX_CRY_23, SFX_Cry23_1 music_const SFX_CRY_24, SFX_Cry24_1 music_const SFX_CRY_25, SFX_Cry25_1 - music_const SFX_GET_ITEM_2, SFX_Get_Item2_1 + + ; AUDIO_1 AUDIO_2 AUDIO_3 music_const SFX_TINK, SFX_Tink_1 music_const SFX_HEAL_HP, SFX_Heal_HP_1 music_const SFX_HEAL_AILMENT, SFX_Heal_Ailment_1 @@ -194,7 +201,7 @@ ENDM music_const SFX_SAVE, SFX_Save_1 ; AUDIO_1 - music_const SFX_POKEFLUE, SFX_Pokeflute + music_const SFX_POKEFLUTE, SFX_Pokeflute music_const SFX_SAFARI_ZONE_PA, SFX_Safari_Zone_PA ; AUDIO_2 @@ -240,13 +247,13 @@ ENDM music_const SFX_BATTLE_26, SFX_Battle_26 music_const SFX_BATTLE_27, SFX_Battle_27 music_const SFX_BATTLE_28, SFX_Battle_28 - music_const SFX_BATTLE_29, SFX_Battle_29 + music_const SFX_EARTHQUAKE, SFX_Earthquake music_const SFX_BATTLE_2A, SFX_Battle_2A music_const SFX_BATTLE_2B, SFX_Battle_2B music_const SFX_BATTLE_2C, SFX_Battle_2C music_const SFX_PSYBEAM, SFX_Psybeam music_const SFX_BATTLE_2E, SFX_Battle_2E - music_const SFX_BATTLE_2F, SFX_Battle_2F + music_const SFX_THUNDERBOLT, SFX_Thunderbolt music_const SFX_PSYCHIC_M, SFX_Psychic_M music_const SFX_BATTLE_31, SFX_Battle_31 music_const SFX_BATTLE_32, SFX_Battle_32 @@ -267,3 +274,12 @@ ENDM music_const SFX_SLOTS_REWARD, SFX_Slots_Reward music_const SFX_SLOTS_NEW_SPIN, SFX_Slots_New_Spin music_const SFX_SHOOTING_STAR, SFX_Shooting_Star + + ; AUDIO_4 + music_const SFX_UNKNOWN_801B0_4, SFX_801b0_4 + music_const SFX_UNKNOWN_801B3_4, SFX_801b3_4 + music_const SFX_UNKNOWN_801B6_4, SFX_801b6_4 + music_const SFX_UNKNOWN_801B9_4, SFX_801b9_4 + music_const SFX_UNKNOWN_801BC_4, SFX_801bc_4 + music_const SFX_UNKNOWN_801BF_4, SFX_801bf_4 + music_const SFX_GET_ITEM2_4_2, SFX_Get_Item2_4_2 diff --git a/constants/oam_constants.asm b/constants/oam_constants.asm index ddf95648..8e855fc9 100755 --- a/constants/oam_constants.asm +++ b/constants/oam_constants.asm @@ -7,3 +7,18 @@ OAMFLAG_VFLIPPED EQU %00100000 ; OAM flag flips the sprite vertically. ; OAM attribute flags OAM_HFLIP EQU %00100000 ; horizontal flip OAM_VFLIP EQU %01000000 ; vertical flip + +frame: MACRO + db \1 +x = \2 +REPT _NARG +- 2 +x = x | (\3 << 1) + shift +endr + db x + endm + +delanim EQUS "db $fc" +dorepeat EQUS "db $fd," +dorestart EQUS "db $fe" +endanim EQUS "db $ff" diff --git a/constants/pikachu_emotion_constants.asm b/constants/pikachu_emotion_constants.asm new file mode 100644 index 00000000..25d9a7aa --- /dev/null +++ b/constants/pikachu_emotion_constants.asm @@ -0,0 +1,224 @@ +dpikapic: macro + db (\1_id - PikaPicAnimPointers) / 2 + endm + +ldpikapic: macro + ld \1, (\2_id - PikaPicAnimPointers) / 2 + endm + +dpikaemotion: macro + db (\1_id - PikachuEmotionTable) / 2 + endm + +ldpikaemotion: macro + ld \1, (\2_id - PikachuEmotionTable) / 2 + endm + +dpikaanim: macro + db (\1_id - PikaPicAnimBGFramesPointers) / 2 + endm + +pikaframeend EQUS "db $e0" +pikaframe: macro + db (\1_id - PikaPicTilemapPointers) / 2, \2 + endm + +pikaframedelay EQUS "db 0," + +; Starter Pikachu emotion commands constants + + const_def + const PIKAEMOTION_DUMMY1 + const PIKAEMOTION_PRINTTEXT + const PIKAEMOTION_PLAYPCMSOUNDCLIP + const PIKAEMOTION_DOEMOTIONBUBBLE + const PIKAEMOTION_4 + const PIKAEMOTION_5 + const PIKAEMOTION_SUBCMD + const PIKAEMOTION_DELAYFRAMES + const PIKAEMOTION_DUMMY2 + const PIKAEMOTION_9 + const PIKAEMOTION_DUMMY3 + + const_def + const PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + const PIKAEMOTION_SUBCMD_LOADFONT + const PIKAEMOTION_SUBCMD_SHOWMAPVIEW + const PIKAEMOTION_SUBCMD_WAITBUTTONPRESS + const PIKAEMOTION_SUBCMD_CHECKPEWTERCENTER + const PIKAEMOTION_SUBCMD_CHECKLAVENDERTOWER + const PIKAEMOTION_SUBCMD_CHECKBILLSHOUSE + + const_def + const PIKASTEPDIR_DOWN + const PIKASTEPDIR_UP + const PIKASTEPDIR_LEFT + const PIKASTEPDIR_RIGHT + const PIKASTEPDIR_DOWN_LEFT + const PIKASTEPDIR_DOWN_RIGHT + const PIKASTEPDIR_UP_LEFT + const PIKASTEPDIR_UP_RIGHT + + +; Macros for commands +pikaemotion_dummy1: MACRO + db PIKAEMOTION_DUMMY1 +ENDM + +pikaemotion_printtext: MACRO + db PIKAEMOTION_PRINTTEXT + dw \1 +ENDM + +pikaemotion_pcm: MACRO + db PIKAEMOTION_PLAYPCMSOUNDCLIP +IF _NARG > 0 + dpikacry \1 +ELSE + db $ff +ENDC +ENDM + +pikaemotion_emotebubble: MACRO + db PIKAEMOTION_DOEMOTIONBUBBLE + db \1 +ENDM + +pikaemotion_movement: MACRO + db PIKAEMOTION_4 + dw \1 +ENDM + +pikaemotion_pikapic: MACRO + db PIKAEMOTION_5 + dpikapic \1 +ENDM + +pikaemotion_subcmd: MACRO + db PIKAEMOTION_SUBCMD + db \1 +ENDM + +pikaemotion_delay: MACRO + db PIKAEMOTION_DELAYFRAMES + db \1 +ENDM + +pikaemotion_dummy2: MACRO + db PIKAEMOTION_DUMMY2 +ENDM + +pikaemotion_9: MACRO + db PIKAEMOTION_9 +ENDM + +pikaemotion_dummy3: MACRO + db PIKAEMOTION_DUMMY3 +ENDM + +pikacry_def: MACRO +\1_id:: dba \1 +endm + +dpikacry: MACRO + db (\1_id - PikachuCriesPointerTable) / 3 + endm + +ldpikacry: MACRO + ld \1, (\2_id - PikachuCriesPointerTable) / 3 + ENDM + +pikacry: MACRO + ldpikacry a, \1 + endm + + + enum_start + enum pikapic_nop_command +pikapic_nop: macro + db pikapic_nop_command + endm + + enum pikapic_writebyte_command +pikapic_writebyte: macro + db pikapic_writebyte_command, \1 + endm + + enum pikapic_loadgfx_command +pikapic_loadgfx: macro + db pikapic_loadgfx_command, (\1_id - PikaPicAnimGFXHeaders) / 4 + endm + + enum pikapic_animation_command +pikapic_animation: macro + ; frameset pointer, starting vtile, y offset, x offset + db pikapic_animation_command + dpikaanim \1 + db 0, \2, \3, \4 + endm + + enum pikapic_nop4_command +pikapic_nop4: macro + db pikapic_nop4_command + endm + + enum pikapic_nop5_command +pikapic_nop5: macro + db pikapic_nop5_command + endm + + enum pikapic_waitbgmapeleteobject_command +pikapic_waitbgmapeleteobject: macro + db pikapic_waitbgmapeleteobject_command, \1 + endm + + enum pikapic_nop7_command +pikapic_nop7: macro + db pikapic_nop7_command + endm + + enum pikapic_nop8_command +pikapic_nop8: macro + db pikapic_nop8_command + endm + + enum pikapic_jump_command +pikapic_jump: macro ; 9 + dbw pikapic_jump_command, \1 + endm + + enum pikapic_setduration_command +pikapic_setduration: macro ; a + dbw pikapic_setduration_command, \1 + endm + + enum pikapic_cry_command +pikapic_cry: macro ; b + db pikapic_cry_command +IF _NARG == 0 + db $ff +else + dpikacry \1 + endc + endm + + enum pikapic_thunderbolt_command +pikapic_thunderbolt: macro ; c + db pikapic_thunderbolt_command + endm + + enum pikapic_waitbgmap_command +pikapic_waitbgmap: macro ; d + db pikapic_waitbgmap_command + endm + + enum pikapic_ret_command +pikapic_ret: macro ; e + db pikapic_ret_command + endm + +pikapic_looptofinish: macro +.loop\@ + pikapic_waitbgmap + pikapic_jump .loop\@ + endm diff --git a/constants/sprite_constants.asm b/constants/sprite_constants.asm index 11973648..3349e374 100755 --- a/constants/sprite_constants.asm +++ b/constants/sprite_constants.asm @@ -1,17 +1,17 @@ ; pokemon's overworld sprites const_value = 0 - const SPRITE_MON ; $0 - const SPRITE_BALL_M ; $1 - const SPRITE_HELIX ; $2 - const SPRITE_FAIRY ; $3 - const SPRITE_BIRD_M ; $4 - const SPRITE_WATER ; $5 - const SPRITE_BUG ; $6 - const SPRITE_GRASS ; $7 - const SPRITE_SNAKE ; $8 - const SPRITE_QUADRUPED ; $9 - + const SPRITE_MON ; $0 + const SPRITE_BALL_M ; $1 + const SPRITE_HELIX ; $2 + const SPRITE_FAIRY ; $3 + const SPRITE_BIRD_M ; $4 + const SPRITE_WATER ; $5 + const SPRITE_BUG ; $6 + const SPRITE_GRASS ; $7 + const SPRITE_SNAKE ; $8 + const SPRITE_QUADRUPED ; $9 + const SPRITE_PIKACHU_FAMILY ; $A ; overworld sprites const_value = 1 @@ -45,7 +45,7 @@ const_value = 1 const SPRITE_MOM_GEISHA ; $1c const SPRITE_BRUNETTE_GIRL ; $1d const SPRITE_LANCE ; $1e - const SPRITE_OAK_SCIENTIST_AIDE ; $1f + const SPRITE_UNUSED_1 ; $1f const SPRITE_OAK_AIDE ; $20 const SPRITE_ROCKER ; $21 const SPRITE_SWIMMER ; $22 @@ -64,29 +64,41 @@ const_value = 1 const SPRITE_FISHER2 ; $2f const SPRITE_BLACKBELT ; $30 const SPRITE_GUARD ; $31 - const SPRITE_COP_GUARD ; $32 + const SPRITE_UNUSED_2 ; $32 const SPRITE_MOM ; $33 const SPRITE_BALDING_GUY ; $34 const SPRITE_YOUNG_BOY ; $35 - const SPRITE_GAMEBOY_KID ; $36 - const SPRITE_GAMEBOY_KID_COPY ; $37 + const SPRITE_UNUSED_3 ; $36 + const SPRITE_GAMEBOY_KID ; $37 const SPRITE_CLEFAIRY ; $38 const SPRITE_AGATHA ; $39 const SPRITE_BRUNO ; $3a const SPRITE_LORELEI ; $3b const SPRITE_SEEL ; $3c - const SPRITE_BALL ; $3d - const SPRITE_OMANYTE ; $3e - const SPRITE_BOULDER ; $3f - const SPRITE_PAPER_SHEET ; $40 - const SPRITE_BOOK_MAP_DEX ; $41 - const SPRITE_CLIPBOARD ; $42 - const SPRITE_SNORLAX ; $43 - const SPRITE_OLD_AMBER_COPY ; $44 - const SPRITE_OLD_AMBER ; $45 - const SPRITE_LYING_OLD_MAN_UNUSED_1 ; $46 - const SPRITE_LYING_OLD_MAN_UNUSED_2 ; $47 - const SPRITE_LYING_OLD_MAN ; $48 + const SPRITE_PIKACHU ; $3d + const SPRITE_OFFICER_JENNY ; $3e + const SPRITE_SANDSHREW ; $3f + const SPRITE_ODDISH ; $40 + const SPRITE_BULBASAUR ; $41 + const SPRITE_JIGGLYPUFF ; $42 + const SPRITE_CLEFAIRY_2 ; $43 + const SPRITE_CHANSEY ; $44 + const SPRITE_JESSIE ; $45 + const SPRITE_JAMES ; $46 + + ; 4-tile sprites + const SPRITE_BALL ; $47 + const SPRITE_OMANYTE ; $48 + const SPRITE_BOULDER ; $49 + const SPRITE_PAPER_SHEET ; $4a + const SPRITE_BOOK_MAP_DEX ; $4b + const SPRITE_CLIPBOARD ; $4c + const SPRITE_SNORLAX ; $4d + const SPRITE_OLD_AMBER_COPY ; $4e + const SPRITE_OLD_AMBER ; $4f + const SPRITE_LYING_OLD_MAN_UNUSED_1 ; $50 + const SPRITE_LYING_OLD_MAN_UNUSED_2 ; $51 + const SPRITE_LYING_OLD_MAN ; $52 ; different kinds of people events ITEM EQU $80 diff --git a/constants/text_constants.asm b/constants/text_constants.asm new file mode 100755 index 00000000..4479e90e --- /dev/null +++ b/constants/text_constants.asm @@ -0,0 +1,15 @@ +; special text IDs +TEXT_MON_FAINTED EQU $d0 +TEXT_BLACKED_OUT EQU $d1 +TEXT_REPEL_WORE_OFF EQU $d2 +TEXT_SAFARI_GAME_OVER EQU $d3 +TEXT_PIKACHU_ANIM EQU $d4 + +; PrintNumber +BIT_MONEY_SIGN EQU 5 +BIT_LEFT_ALIGN EQU 6 +BIT_LEADING_ZEROES EQU 7 + +MONEY_SIGN EQU (1 << BIT_MONEY_SIGN) +LEFT_ALIGN EQU (1 << BIT_LEFT_ALIGN) +LEADING_ZEROES EQU (1 << BIT_LEADING_ZEROES) diff --git a/constants/tilesets.asm b/constants/tilesets.asm index f10e4d92..aa81f774 100644 --- a/constants/tilesets.asm +++ b/constants/tilesets.asm @@ -24,3 +24,4 @@ const_value = 0 const CLUB ; 21 const FACILITY ; 22 const PLATEAU ; 23 + const BEACH_HOUSE_TILESET ; 24 diff --git a/constants/trainer_constants.asm b/constants/trainer_constants.asm index ee890282..e11cc4aa 100755 --- a/constants/trainer_constants.asm +++ b/constants/trainer_constants.asm @@ -6,50 +6,50 @@ ENDM const_value = 1 - trainer_const YOUNGSTER ; $01 - trainer_const BUG_CATCHER ; $02 - trainer_const LASS ; $03 - trainer_const SAILOR ; $04 - trainer_const JR_TRAINER_M ; $05 - trainer_const JR_TRAINER_F ; $06 - trainer_const POKEMANIAC ; $07 - trainer_const SUPER_NERD ; $08 - trainer_const HIKER ; $09 - trainer_const BIKER ; $0A - trainer_const BURGLAR ; $0B - trainer_const ENGINEER ; $0C - trainer_const JUGGLER_X ; $0D - trainer_const FISHER ; $0E - trainer_const SWIMMER ; $0F - trainer_const CUE_BALL ; $10 - trainer_const GAMBLER ; $11 - trainer_const BEAUTY ; $12 - trainer_const PSYCHIC_TR ; $13 - trainer_const ROCKER ; $14 - trainer_const JUGGLER ; $15 - trainer_const TAMER ; $16 - trainer_const BIRD_KEEPER ; $17 - trainer_const BLACKBELT ; $18 - trainer_const SONY1 ; $19 - trainer_const PROF_OAK ; $1A - trainer_const CHIEF ; $1B - trainer_const SCIENTIST ; $1C - trainer_const GIOVANNI ; $1D - trainer_const ROCKET ; $1E - trainer_const COOLTRAINER_M ; $1F - trainer_const COOLTRAINER_F ; $20 - trainer_const BRUNO ; $21 - trainer_const BROCK ; $22 - trainer_const MISTY ; $23 - trainer_const LT_SURGE ; $24 - trainer_const ERIKA ; $25 - trainer_const KOGA ; $26 - trainer_const BLAINE ; $27 - trainer_const SABRINA ; $28 - trainer_const GENTLEMAN ; $29 - trainer_const SONY2 ; $2A - trainer_const SONY3 ; $2B - trainer_const LORELEI ; $2C - trainer_const CHANNELER ; $2D - trainer_const AGATHA ; $2E - trainer_const LANCE ; $2F + trainer_const YOUNGSTER ; $01 | OPP = $C9 + trainer_const BUG_CATCHER ; $02 | OPP = $CA + trainer_const LASS ; $03 | OPP = $CB + trainer_const SAILOR ; $04 | OPP = $CC + trainer_const JR_TRAINER_M ; $05 | OPP = $CD + trainer_const JR_TRAINER_F ; $06 | OPP = $CE + trainer_const POKEMANIAC ; $07 | OPP = $CF + trainer_const SUPER_NERD ; $08 | OPP = $D0 + trainer_const HIKER ; $09 | OPP = $D1 + trainer_const BIKER ; $0A | OPP = $D2 + trainer_const BURGLAR ; $0B | OPP = $D3 + trainer_const ENGINEER ; $0C | OPP = $D4 + trainer_const JUGGLER_X ; $0D | OPP = $D5 + trainer_const FISHER ; $0E | OPP = $D6 + trainer_const SWIMMER ; $0F | OPP = $D7 + trainer_const CUE_BALL ; $10 | OPP = $D8 + trainer_const GAMBLER ; $11 | OPP = $D9 + trainer_const BEAUTY ; $12 | OPP = $DA + trainer_const PSYCHIC_TR ; $13 | OPP = $DB + trainer_const ROCKER ; $14 | OPP = $DC + trainer_const JUGGLER ; $15 | OPP = $DD + trainer_const TAMER ; $16 | OPP = $DE + trainer_const BIRD_KEEPER ; $17 | OPP = $DF + trainer_const BLACKBELT ; $18 | OPP = $E0 + trainer_const SONY1 ; $19 | OPP = $E1 + trainer_const PROF_OAK ; $1A | OPP = $E2 + trainer_const CHIEF ; $1B | OPP = $E3 + trainer_const SCIENTIST ; $1C | OPP = $E4 + trainer_const GIOVANNI ; $1D | OPP = $E5 + trainer_const ROCKET ; $1E | OPP = $E6 + trainer_const COOLTRAINER_M ; $1F | OPP = $E7 + trainer_const COOLTRAINER_F ; $20 | OPP = $E8 + trainer_const BRUNO ; $21 | OPP = $E9 + trainer_const BROCK ; $22 | OPP = $EA + trainer_const MISTY ; $23 | OPP = $EB + trainer_const LT_SURGE ; $24 | OPP = $EC + trainer_const ERIKA ; $25 | OPP = $ED + trainer_const KOGA ; $26 | OPP = $EE + trainer_const BLAINE ; $27 | OPP = $EF + trainer_const SABRINA ; $28 | OPP = $F0 + trainer_const GENTLEMAN ; $29 | OPP = $F1 + trainer_const SONY2 ; $2A | OPP = $F2 + trainer_const SONY3 ; $2B | OPP = $F3 + trainer_const LORELEI ; $2C | OPP = $F4 + trainer_const CHANNELER ; $2D | OPP = $F5 + trainer_const AGATHA ; $2E | OPP = $F6 + trainer_const LANCE ; $2F | OPP = $F7 diff --git a/data/animated_objects_3e_1.asm b/data/animated_objects_3e_1.asm new file mode 100755 index 00000000..07b17ce5 --- /dev/null +++ b/data/animated_objects_3e_1.asm @@ -0,0 +1,383 @@ +SurfingPikachuFrames: + dw Unkn_f943d ; 00 + dw Unkn_f9440 ; 01 + dw Unkn_f9445 ; 02 + dw Unkn_f944a ; 03 + dw Unkn_f944f ; 04 + dw Unkn_f9454 ; 05 + dw Unkn_f9459 ; 06 + dw Unkn_f945e ; 07 + dw Unkn_f9463 ; 08 + dw Unkn_f9468 ; 09 + dw Unkn_f946d ; 0a + dw Unkn_f9472 ; 0b + dw Unkn_f9477 ; 0c + dw Unkn_f947c ; 0d + dw Unkn_f9481 ; 0e + dw Unkn_f9486 ; 0f + dw Unkn_f948b ; 10 + dw Unkn_f9494 ; 11 + dw Unkn_f9499 ; 12 + dw Unkn_f949e ; 13 + dw Unkn_f94fb ; 14 + dw Unkn_f94a1 ; 15 + dw Unkn_f94b0 ; 16 + dw Unkn_f94bf ; 17 + dw Unkn_f94ce ; 18 + dw Unkn_f94dd ; 19 + dw Unkn_f94ec ; 1a + dw Unkn_f94fe ; 1b + +Unkn_f943d: + frame $00, 32 + endanim + +Unkn_f9440: + frame $01, 8 + frame $02, 8 + dorestart + +Unkn_f9445: + frame $03, 8 + frame $04, 8 + dorestart + +Unkn_f944a: + frame $05, 8 + frame $06, 8 + dorestart + +Unkn_f944f: + frame $07, 8 + frame $08, 8 + dorestart + +Unkn_f9454: + frame $09, 8 + frame $0a, 8 + dorestart + +Unkn_f9459: + frame $0b, 8 + frame $0c, 8 + dorestart + +Unkn_f945e: + frame $0d, 8 + frame $0e, 8 + dorestart + +Unkn_f9463: + frame $01, 8, OAM_HFLIP, OAM_VFLIP + frame $02, 8, OAM_HFLIP, OAM_VFLIP + dorestart + +Unkn_f9468: + frame $03, 8, OAM_HFLIP, OAM_VFLIP + frame $04, 8, OAM_HFLIP, OAM_VFLIP + dorestart + +Unkn_f946d: + frame $05, 8, OAM_HFLIP, OAM_VFLIP + frame $06, 8, OAM_HFLIP, OAM_VFLIP + dorestart + +Unkn_f9472: + frame $07, 8, OAM_HFLIP, OAM_VFLIP + frame $08, 8, OAM_HFLIP, OAM_VFLIP + dorestart + +Unkn_f9477: + frame $09, 8, OAM_HFLIP, OAM_VFLIP + frame $0a, 8, OAM_HFLIP, OAM_VFLIP + dorestart + +Unkn_f947c: + frame $0b, 8, OAM_HFLIP, OAM_VFLIP + frame $0c, 8, OAM_HFLIP, OAM_VFLIP + dorestart + +Unkn_f9481: + frame $0d, 8, OAM_HFLIP, OAM_VFLIP + frame $0e, 8, OAM_HFLIP, OAM_VFLIP + dorestart + +Unkn_f9486: + frame $11, 7 + frame $12, 7 + dorestart + +Unkn_f948b: + frame $13, 2 + frame $14, 2 + dorepeat 8 + frame $15, 2 + endanim + +Unkn_f9494: + frame $16, 32 + frame $16, 32 + delanim + +Unkn_f9499: + frame $17, 32 + frame $17, 32 + delanim + +Unkn_f949e: + frame $18, 32 + endanim + +Unkn_f94a1: + frame $1a, 4 + dorepeat 1 + frame $1a, 3 + dorepeat 1 + frame $1a, 2 + dorepeat 1 + frame $1a, 1 + delanim + +Unkn_f94b0: + frame $1b, 4 + dorepeat 1 + frame $1b, 3 + dorepeat 1 + frame $1b, 2 + dorepeat 1 + frame $1b, 1 + delanim + +Unkn_f94bf: + frame $1c, 4 + dorepeat 1 + frame $1c, 3 + dorepeat 1 + frame $1c, 2 + dorepeat 1 + frame $1c, 1 + delanim + +Unkn_f94ce: + frame $1d, 4 + dorepeat 1 + frame $1d, 3 + dorepeat 1 + frame $1d, 2 + dorepeat 1 + frame $1d, 1 + delanim + +Unkn_f94dd: + frame $1e, 4 + dorepeat 1 + frame $1e, 3 + dorepeat 1 + frame $1e, 2 + dorepeat 1 + frame $1e, 1 + delanim + +Unkn_f94ec: + frame $1f, 4 + dorepeat 1 + frame $1f, 3 + dorepeat 1 + frame $1f, 2 + dorepeat 1 + frame $1f, 1 + delanim + +Unkn_f94fb: + frame $19, 1 + delanim + +Unkn_f94fe: + frame $20, 7 + frame $21, 7 + frame $22, 7 + frame $23, 7 + dorestart + +SurfingPikachuOAMData: + dbw $00, .Frame0 + dbw $00, .Frame1 + dbw $36, .Frame2 + dbw $03, .Frame3 + dbw $39, .Frame4 + dbw $06, .Frame5 + dbw $3c, .Frame6 + dbw $09, .Frame7 + dbw $60, .Frame8 + dbw $0c, .Frame9 + dbw $63, .Frame10 + dbw $30, .Frame11 + dbw $66, .Frame12 + dbw $33, .Frame13 + dbw $69, .Frame14 + dbw $6c, .Frame15 + dbw $9c, .Frame16 + dbw $a0, .Frame17 + dbw $a3, .Frame18 + dbw $a7, .Frame19 + dbw $a8, .Frame20 + dbw $98, .Frame21 + dbw $e0, .Frame22 + dbw $e6, .Frame23 + dbw $ca, .Frame24 + dbw $a7, .Frame25 + dbw $00, .Frame26 + dbw $00, .Frame27 + dbw $00, .Frame28 + dbw $00, .Frame29 + dbw $00, .Frame30 + dbw $00, .Frame31 + dbw $80, .Frame32 + dbw $84, .Frame33 + dbw $88, .Frame34 + dbw $8c, .Frame35 + +.Frame0: + db 1 + db $fc, $fc, $00, $00 + +.Frame1: +.Frame2: +.Frame3: +.Frame4: +.Frame5: +.Frame6: +.Frame7: +.Frame8: +.Frame9: +.Frame10: +.Frame11: +.Frame12: +.Frame13: +.Frame14: +.Frame15: +.Frame16: +.Frame17: +.Frame18: + db 9 + db $f4, $f4, $00, $00 + db $f4, $fc, $01, $00 + db $f4, $04, $02, $00 + db $fc, $f4, $10, $00 + db $fc, $fc, $11, $00 + db $fc, $04, $12, $00 + db $04, $f4, $20, $00 + db $04, $fc, $21, $00 + db $04, $04, $22, $00 + +.Frame22: +.Frame23: +.Frame24: + db 12 + db $f8, $e8, $00, $00 + db $f8, $f0, $01, $00 + db $f8, $f8, $02, $00 + db $f8, $00, $03, $00 + db $f8, $08, $04, $00 + db $f8, $10, $05, $00 + db $00, $e8, $10, $00 + db $00, $f0, $11, $00 + db $00, $f8, $12, $00 + db $00, $00, $13, $00 + db $00, $08, $14, $00 + db $00, $10, $15, $00 + +.Frame25: + db 3 + db $fc, $0b, $00, $10 + db $04, $03, $0f, $10 + db $04, $0b, $10, $10 + +.Frame19: + db 6 + db $fc, $f0, $00, $30 + db $fc, $08, $00, $10 + db $04, $f0, $10, $30 + db $04, $f8, $0f, $30 + db $04, $00, $0f, $10 + db $04, $08, $10, $10 + +.Frame20: + db 12 + db $f4, $f0, $00, $10 + db $f4, $f8, $01, $10 + db $f4, $00, $01, $30 + db $f4, $08, $00, $30 + db $fc, $f0, $10, $10 + db $fc, $f8, $11, $10 + db $fc, $00, $11, $30 + db $fc, $08, $10, $30 + db $04, $f0, $20, $10 + db $04, $f8, $21, $10 + db $04, $00, $21, $30 + db $04, $08, $20, $30 + +.Frame21: + db 3 + db $04, $f4, $00, $00 + db $04, $fc, $01, $00 + db $04, $04, $02, $00 + +.Frame26: + db 3 + db $fc, $f4, $bf, $00 + db $fc, $fc, $d5, $00 + db $fc, $04, $d0, $00 + +.Frame27: + db 4 + db $fc, $f0, $bf, $00 + db $fc, $f8, $d1, $00 + db $fc, $00, $d5, $00 + db $fc, $08, $d0, $00 + +.Frame28: + db 4 + db $fc, $f0, $bf, $00 + db $fc, $f8, $d3, $00 + db $fc, $00, $d5, $00 + db $fc, $08, $d0, $00 + +.Frame29: + db 4 + db $fc, $f0, $bf, $00 + db $fc, $f8, $d7, $00 + db $fc, $00, $d5, $00 + db $fc, $08, $d0, $00 + +.Frame30: + db 4 + db $fc, $f0, $bf, $00 + db $fc, $f8, $d1, $00 + db $fc, $00, $d8, $00 + db $fc, $08, $d0, $00 + +.Frame31: + db 4 + db $fc, $f0, $bf, $00 + db $fc, $f8, $d5, $00 + db $fc, $00, $d0, $00 + db $fc, $08, $d0, $00 + +.Frame32: +.Frame33: +.Frame34: +.Frame35: + db 12 + db $f4, $f0, $03, $20 + db $f4, $f8, $02, $20 + db $f4, $00, $01, $20 + db $f4, $08, $00, $20 + db $fc, $f0, $13, $20 + db $fc, $f8, $12, $20 + db $fc, $00, $11, $20 + db $fc, $08, $10, $20 + db $04, $f0, $23, $20 + db $04, $f8, $22, $20 + db $04, $00, $21, $20 + db $04, $08, $20, $20 diff --git a/data/animated_objects_3e_2.asm b/data/animated_objects_3e_2.asm new file mode 100755 index 00000000..4e9f5b3c --- /dev/null +++ b/data/animated_objects_3e_2.asm @@ -0,0 +1,236 @@ +YellowIntro_AnimatedObjectFramesData: + dw Unkn_fa100 + dw Unkn_fa103 + dw Unkn_fa10a + dw Unkn_fa111 + dw Unkn_fa118 + dw Unkn_fa11b + dw Unkn_fa11e + dw Unkn_fa121 + dw Unkn_fa124 + dw Unkn_fa127 + dw Unkn_fa138 + +Unkn_fa100: + frame $00, 32 + endanim + +Unkn_fa103: + frame $01, 4 + frame $02, 4 + frame $03, 4 + dorestart + +Unkn_fa10a: + frame $04, 4 + frame $05, 4 + frame $06, 4 + dorestart + +Unkn_fa111: + frame $07, 4 + frame $08, 4 + frame $09, 4 + dorestart + +Unkn_fa118: + frame $0a, 32 + endanim + +Unkn_fa11b: + frame $0b, 32 + endanim + +Unkn_fa11e: + frame $0c, 32 + endanim + +Unkn_fa121: + frame $0d, 32 + endanim + +Unkn_fa124: + frame $0e, 32 + endanim + +Unkn_fa127: + frame $0f, 31 + frame $11, 2 + frame $0f, 2 + frame $11, 2 + frame $0f, 31 + frame $11, 2 + frame $0f, 23 + frame $10, 32 + endanim + +Unkn_fa138: + frame $12, 4 + frame $13, 4 + dorestart + +YellowIntro_AnimatedObjectOAMData: + dbw $00, Unkn_fa179 + dbw $96, Unkn_fa17e + dbw $98, Unkn_fa17e + dbw $9a, Unkn_fa17e + dbw $0c, Unkn_fa18f + dbw $0e, Unkn_fa18f + dbw $3c, Unkn_fa18f + dbw $60, Unkn_fa1b0 + dbw $70, Unkn_fa1b0 + dbw $80, Unkn_fa1b0 + dbw $90, Unkn_fa201 + dbw $00, Unkn_fa201 + dbw $06, Unkn_fa201 + dbw $c6, Unkn_fa292 + dbw $6d, Unkn_fa2f7 + dbw $f0, Unkn_fa308 + dbw $f4, Unkn_fa308 + dbw $f8, Unkn_fa308 + dbw $9c, Unkn_fa329 + dbw $ec, Unkn_fa329 + +Unkn_fa179: + db 1 + db $fc, $fc, $00, $00 +Unkn_fa17e: + db 4 + db $f8, $f8, $00, $00 + db $f8, $00, $01, $00 + db $00, $f8, $10, $00 + db $00, $00, $11, $00 + +Unkn_fa18f: + db 8 + db $f0, $f8, $00, $00 + db $f0, $00, $01, $00 + db $f8, $f8, $10, $00 + db $f8, $00, $11, $00 + db $00, $f8, $20, $00 + db $00, $00, $20, $20 + db $08, $f8, $21, $00 + db $08, $00, $21, $20 + +Unkn_fa1b0: + db 20 + db $e8, $f8, $00, $00 + db $e8, $00, $01, $00 + db $f0, $f8, $02, $00 + db $f0, $00, $03, $00 + db $f8, $f0, $04, $00 + db $f8, $f8, $05, $00 + db $f8, $00, $06, $00 + db $f8, $08, $04, $20 + db $00, $f0, $07, $00 + db $00, $f8, $08, $00 + db $00, $00, $08, $20 + db $00, $08, $07, $20 + db $08, $f0, $09, $00 + db $08, $f8, $0a, $00 + db $08, $00, $0a, $20 + db $08, $08, $09, $20 + db $10, $f0, $0b, $00 + db $10, $f8, $0c, $00 + db $10, $00, $0c, $20 + db $10, $08, $0b, $20 + +Unkn_fa201: + db 36 + db $e8, $e8, $00, $00 + db $e8, $f0, $01, $00 + db $e8, $f8, $02, $00 + db $e8, $00, $03, $00 + db $e8, $08, $04, $00 + db $e8, $10, $05, $00 + db $f0, $e8, $10, $00 + db $f0, $f0, $11, $00 + db $f0, $f8, $12, $00 + db $f0, $00, $13, $00 + db $f0, $08, $14, $00 + db $f0, $10, $15, $00 + db $f8, $e8, $20, $00 + db $f8, $f0, $21, $00 + db $f8, $f8, $22, $00 + db $f8, $00, $23, $00 + db $f8, $08, $24, $00 + db $f8, $10, $25, $00 + db $00, $e8, $30, $00 + db $00, $f0, $31, $00 + db $00, $f8, $32, $00 + db $00, $00, $33, $00 + db $00, $08, $34, $00 + db $00, $10, $35, $00 + db $08, $e8, $40, $00 + db $08, $f0, $41, $00 + db $08, $f8, $42, $00 + db $08, $00, $43, $00 + db $08, $08, $44, $00 + db $08, $10, $45, $00 + db $10, $e8, $50, $00 + db $10, $f0, $51, $00 + db $10, $f8, $52, $00 + db $10, $00, $53, $00 + db $10, $08, $54, $00 + db $10, $10, $55, $00 + +Unkn_fa292: + db 25 + db $ec, $f0, $00, $00 + db $ec, $f8, $01, $00 + db $ec, $00, $02, $00 + db $ec, $08, $03, $00 + db $ec, $10, $04, $00 + db $f4, $f0, $05, $00 + db $f4, $f8, $06, $00 + db $f4, $00, $07, $00 + db $f4, $08, $08, $00 + db $f4, $10, $09, $00 + db $fc, $f0, $10, $00 + db $fc, $f8, $11, $00 + db $fc, $00, $12, $00 + db $fc, $08, $13, $00 + db $fc, $10, $14, $00 + db $04, $f0, $15, $00 + db $04, $f8, $16, $00 + db $04, $00, $17, $00 + db $04, $08, $18, $00 + db $04, $10, $19, $00 + db $0c, $f0, $20, $00 + db $0c, $f8, $21, $00 + db $0c, $00, $22, $00 + db $0c, $08, $23, $00 + db $0c, $10, $24, $00 + +Unkn_fa2f7: + db 4 + db $fc, $f0, $00, $00 + db $fc, $f8, $01, $00 + db $fc, $00, $01, $20 + db $fc, $08, $00, $20 + +Unkn_fa308: + db 8 + db $f8, $e8, $00, $10 + db $f8, $f0, $01, $10 + db $00, $e8, $02, $10 + db $00, $f0, $03, $10 + db $f8, $08, $01, $30 + db $f8, $10, $00, $30 + db $00, $08, $03, $30 + db $00, $10, $02, $30 + +Unkn_fa329: + db 12 + db $f8, $d8, $00, $10 + db $f8, $e0, $01, $10 + db $f8, $e8, $02, $10 + db $00, $d8, $10, $10 + db $00, $e0, $11, $10 + db $00, $e8, $12, $10 + db $f8, $10, $02, $30 + db $f8, $18, $01, $30 + db $f8, $20, $00, $30 + db $00, $10, $12, $30 + db $00, $18, $11, $30 + db $00, $20, $10, $30 diff --git a/data/animations.asm b/data/animations.asm index 8c388afd..de2487d7 100755 --- a/data/animations.asm +++ b/data/animations.asm @@ -201,7 +201,6 @@ AttackAnimationPointers: dw HidePicAnim dw ThrowRockAnim dw ThrowBaitAnim - dw ZigZagScreenAnim ; each animation is a list of subanimations and special effects ; if first byte < $56 @@ -209,10 +208,6 @@ AttackAnimationPointers: ; if first byte >= $D8 ; db special_effect_id, sound_id ; $FF terminated -ZigZagScreenAnim: - db SE_WAVY_SCREEN, $FF - db $FF - PoundAnim: StruggleAnim: db $08,$00,$01 diff --git a/data/baseStats/abra.asm b/data/baseStats/abra.asm index 1a41bb5c..c8e240f2 100644 --- a/data/baseStats/abra.asm +++ b/data/baseStats/abra.asm @@ -8,7 +8,7 @@ db PSYCHIC ; species type 1 db PSYCHIC ; species type 2 db 200 ; catch rate db 73 ; base exp yield -INCBIN "pic/bmon/abra.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/abra.pic",0,1 ; 55, sprite dimensions dw AbraPicFront dw AbraPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/aerodactyl.asm b/data/baseStats/aerodactyl.asm index 874dd57d..7c9158f8 100644 --- a/data/baseStats/aerodactyl.asm +++ b/data/baseStats/aerodactyl.asm @@ -8,7 +8,7 @@ db ROCK ; species type 1 db FLYING ; species type 2 db 45 ; catch rate db 202 ; base exp yield -INCBIN "pic/bmon/aerodactyl.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/aerodactyl.pic",0,1 ; 77, sprite dimensions dw AerodactylPicFront dw AerodactylPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/alakazam.asm b/data/baseStats/alakazam.asm index c20b6c41..5a9bf426 100644 --- a/data/baseStats/alakazam.asm +++ b/data/baseStats/alakazam.asm @@ -8,13 +8,13 @@ db PSYCHIC ; species type 1 db PSYCHIC ; species type 2 db 50 ; catch rate db 186 ; base exp yield -INCBIN "pic/bmon/alakazam.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/alakazam.pic",0,1 ; 77, sprite dimensions dw AlakazamPicFront dw AlakazamPicBack ; attacks known at lvl 0 db TELEPORT -db CONFUSION -db DISABLE +db KINESIS +db 0 db 0 db 3 ; growth rate ; learnset diff --git a/data/baseStats/arbok.asm b/data/baseStats/arbok.asm index 6beee569..1959af0c 100644 --- a/data/baseStats/arbok.asm +++ b/data/baseStats/arbok.asm @@ -8,7 +8,7 @@ db POISON ; species type 1 db POISON ; species type 2 db 90 ; catch rate db 147 ; base exp yield -INCBIN "pic/bmon/arbok.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/arbok.pic",0,1 ; 77, sprite dimensions dw ArbokPicFront dw ArbokPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/arcanine.asm b/data/baseStats/arcanine.asm index 2a2dda3b..68e111a1 100644 --- a/data/baseStats/arcanine.asm +++ b/data/baseStats/arcanine.asm @@ -8,7 +8,7 @@ db FIRE ; species type 1 db FIRE ; species type 2 db 75 ; catch rate db 213 ; base exp yield -INCBIN "pic/bmon/arcanine.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/arcanine.pic",0,1 ; 77, sprite dimensions dw ArcaninePicFront dw ArcaninePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/articuno.asm b/data/baseStats/articuno.asm index ef791055..6171d40c 100644 --- a/data/baseStats/articuno.asm +++ b/data/baseStats/articuno.asm @@ -8,7 +8,7 @@ db ICE ; species type 1 db FLYING ; species type 2 db 3 ; catch rate db 215 ; base exp yield -INCBIN "pic/bmon/articuno.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/articuno.pic",0,1 ; 77, sprite dimensions dw ArticunoPicFront dw ArticunoPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/beedrill.asm b/data/baseStats/beedrill.asm index 6bf091b8..859d4835 100644 --- a/data/baseStats/beedrill.asm +++ b/data/baseStats/beedrill.asm @@ -8,7 +8,7 @@ db BUG ; species type 1 db POISON ; species type 2 db 45 ; catch rate db 159 ; base exp yield -INCBIN "pic/bmon/beedrill.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/beedrill.pic",0,1 ; 77, sprite dimensions dw BeedrillPicFront dw BeedrillPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/bellsprout.asm b/data/baseStats/bellsprout.asm index 1c908bbb..2126a422 100644 --- a/data/baseStats/bellsprout.asm +++ b/data/baseStats/bellsprout.asm @@ -8,7 +8,7 @@ db GRASS ; species type 1 db POISON ; species type 2 db 255 ; catch rate db 84 ; base exp yield -INCBIN "pic/bmon/bellsprout.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/bellsprout.pic",0,1 ; 55, sprite dimensions dw BellsproutPicFront dw BellsproutPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/blastoise.asm b/data/baseStats/blastoise.asm index eaf18b41..c6fad5f0 100644 --- a/data/baseStats/blastoise.asm +++ b/data/baseStats/blastoise.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db WATER ; species type 2 db 45 ; catch rate db 210 ; base exp yield -INCBIN "pic/bmon/blastoise.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/blastoise.pic",0,1 ; 77, sprite dimensions dw BlastoisePicFront dw BlastoisePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/bulbasaur.asm b/data/baseStats/bulbasaur.asm index 7b3567b5..225e8bec 100644 --- a/data/baseStats/bulbasaur.asm +++ b/data/baseStats/bulbasaur.asm @@ -9,7 +9,7 @@ db GRASS ; species type 1 db POISON ; species type 2 db 45 ; catch rate db 64 ; base exp yield -INCBIN "pic/bmon/bulbasaur.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/bulbasaur.pic",0,1 ; 55, sprite dimensions dw BulbasaurPicFront dw BulbasaurPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/butterfree.asm b/data/baseStats/butterfree.asm index c0fb5f6c..4b161422 100644 --- a/data/baseStats/butterfree.asm +++ b/data/baseStats/butterfree.asm @@ -8,7 +8,7 @@ db BUG ; species type 1 db FLYING ; species type 2 db 45 ; catch rate db 160 ; base exp yield -INCBIN "pic/bmon/butterfree.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/butterfree.pic",0,1 ; 77, sprite dimensions dw ButterfreePicFront dw ButterfreePicBack ; attacks known at lvl 0 @@ -24,5 +24,5 @@ db 0 ; growth rate tmlearn 29,30,31,32 tmlearn 33,34,39 tmlearn 44,46 - tmlearn 50 + tmlearn 50,55 db 0 ; padding diff --git a/data/baseStats/caterpie.asm b/data/baseStats/caterpie.asm index d26bc5d9..10615994 100644 --- a/data/baseStats/caterpie.asm +++ b/data/baseStats/caterpie.asm @@ -8,7 +8,7 @@ db BUG ; species type 1 db BUG ; species type 2 db 255 ; catch rate db 53 ; base exp yield -INCBIN "pic/bmon/caterpie.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/caterpie.pic",0,1 ; 55, sprite dimensions dw CaterpiePicFront dw CaterpiePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/chansey.asm b/data/baseStats/chansey.asm index 434b1c26..2097ef8c 100644 --- a/data/baseStats/chansey.asm +++ b/data/baseStats/chansey.asm @@ -8,12 +8,12 @@ db NORMAL ; species type 1 db NORMAL ; species type 2 db 30 ; catch rate db 255 ; base exp yield -INCBIN "pic/bmon/chansey.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/chansey.pic",0,1 ; 66, sprite dimensions dw ChanseyPicFront dw ChanseyPicBack ; attacks known at lvl 0 db POUND -db DOUBLESLAP +db TAIL_WHIP db 0 db 0 db 4 ; growth rate diff --git a/data/baseStats/charizard.asm b/data/baseStats/charizard.asm index 2479a60c..c123bd18 100644 --- a/data/baseStats/charizard.asm +++ b/data/baseStats/charizard.asm @@ -8,7 +8,7 @@ db FIRE ; species type 1 db FLYING ; species type 2 db 45 ; catch rate db 209 ; base exp yield -INCBIN "pic/bmon/charizard.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/charizard.pic",0,1 ; 77, sprite dimensions dw CharizardPicFront dw CharizardPicBack ; attacks known at lvl 0 @@ -24,5 +24,5 @@ db 3 ; growth rate tmlearn 26,27,28,31,32 tmlearn 33,34,38,39,40 tmlearn 44 - tmlearn 50,51,54 + tmlearn 50,51,52,54 db 0 ; padding diff --git a/data/baseStats/charmander.asm b/data/baseStats/charmander.asm index ccd53458..2e0189f2 100644 --- a/data/baseStats/charmander.asm +++ b/data/baseStats/charmander.asm @@ -8,7 +8,7 @@ db FIRE ; species type 1 db FIRE ; species type 2 db 45 ; catch rate db 65 ; base exp yield -INCBIN "pic/bmon/charmander.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/charmander.pic",0,1 ; 55, sprite dimensions dw CharmanderPicFront dw CharmanderPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/charmeleon.asm b/data/baseStats/charmeleon.asm index 80aa2bca..419fc4b8 100644 --- a/data/baseStats/charmeleon.asm +++ b/data/baseStats/charmeleon.asm @@ -8,7 +8,7 @@ db FIRE ; species type 1 db FIRE ; species type 2 db 45 ; catch rate db 142 ; base exp yield -INCBIN "pic/bmon/charmeleon.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/charmeleon.pic",0,1 ; 66, sprite dimensions dw CharmeleonPicFront dw CharmeleonPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/clefable.asm b/data/baseStats/clefable.asm index 17837da4..473564b3 100644 --- a/data/baseStats/clefable.asm +++ b/data/baseStats/clefable.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db NORMAL ; species type 2 db 25 ; catch rate db 129 ; base exp yield -INCBIN "pic/bmon/clefable.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/clefable.pic",0,1 ; 66, sprite dimensions dw ClefablePicFront dw ClefablePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/clefairy.asm b/data/baseStats/clefairy.asm index 952391c7..c24f0c73 100644 --- a/data/baseStats/clefairy.asm +++ b/data/baseStats/clefairy.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db NORMAL ; species type 2 db 150 ; catch rate db 68 ; base exp yield -INCBIN "pic/bmon/clefairy.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/clefairy.pic",0,1 ; 55, sprite dimensions dw ClefairyPicFront dw ClefairyPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/cloyster.asm b/data/baseStats/cloyster.asm index 10f38bdb..4b174241 100644 --- a/data/baseStats/cloyster.asm +++ b/data/baseStats/cloyster.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db ICE ; species type 2 db 60 ; catch rate db 203 ; base exp yield -INCBIN "pic/bmon/cloyster.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/cloyster.pic",0,1 ; 77, sprite dimensions dw CloysterPicFront dw CloysterPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/cubone.asm b/data/baseStats/cubone.asm index b1222d98..598531d5 100644 --- a/data/baseStats/cubone.asm +++ b/data/baseStats/cubone.asm @@ -8,14 +8,14 @@ db GROUND ; species type 1 db GROUND ; species type 2 db 190 ; catch rate db 87 ; base exp yield -INCBIN "pic/bmon/cubone.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/cubone.pic",0,1 ; 55, sprite dimensions dw CubonePicFront dw CubonePicBack ; attacks known at lvl 0 -db BONE_CLUB db GROWL db 0 db 0 +db 0 db 0 ; growth rate ; learnset tmlearn 1,5,6,8 diff --git a/data/baseStats/dewgong.asm b/data/baseStats/dewgong.asm index fb0cf2c2..cdeb45a7 100644 --- a/data/baseStats/dewgong.asm +++ b/data/baseStats/dewgong.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db ICE ; species type 2 db 75 ; catch rate db 176 ; base exp yield -INCBIN "pic/bmon/dewgong.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/dewgong.pic",0,1 ; 66, sprite dimensions dw DewgongPicFront dw DewgongPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/diglett.asm b/data/baseStats/diglett.asm index 8ef6e381..91fdc415 100644 --- a/data/baseStats/diglett.asm +++ b/data/baseStats/diglett.asm @@ -8,7 +8,7 @@ db GROUND ; species type 1 db GROUND ; species type 2 db 255 ; catch rate db 81 ; base exp yield -INCBIN "pic/bmon/diglett.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/diglett.pic",0,1 ; 55, sprite dimensions dw DiglettPicFront dw DiglettPicBack ; attacks known at lvl 0 @@ -24,5 +24,5 @@ db 0 ; growth rate tmlearn 26,27,28,31,32 tmlearn 34 tmlearn 44,48 - tmlearn 50 + tmlearn 50,51 db 0 ; padding diff --git a/data/baseStats/ditto.asm b/data/baseStats/ditto.asm index 90ea4c5e..456639c7 100644 --- a/data/baseStats/ditto.asm +++ b/data/baseStats/ditto.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db NORMAL ; species type 2 db 35 ; catch rate db 61 ; base exp yield -INCBIN "pic/bmon/ditto.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/ditto.pic",0,1 ; 55, sprite dimensions dw DittoPicFront dw DittoPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/dodrio.asm b/data/baseStats/dodrio.asm index 99608f48..dfae1713 100644 --- a/data/baseStats/dodrio.asm +++ b/data/baseStats/dodrio.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db FLYING ; species type 2 db 45 ; catch rate db 158 ; base exp yield -INCBIN "pic/bmon/dodrio.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/dodrio.pic",0,1 ; 77, sprite dimensions dw DodrioPicFront dw DodrioPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/doduo.asm b/data/baseStats/doduo.asm index 760c258b..5571d09e 100644 --- a/data/baseStats/doduo.asm +++ b/data/baseStats/doduo.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db FLYING ; species type 2 db 190 ; catch rate db 96 ; base exp yield -INCBIN "pic/bmon/doduo.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/doduo.pic",0,1 ; 55, sprite dimensions dw DoduoPicFront dw DoduoPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/dragonair.asm b/data/baseStats/dragonair.asm index 041300e0..6ec0031b 100644 --- a/data/baseStats/dragonair.asm +++ b/data/baseStats/dragonair.asm @@ -6,9 +6,9 @@ db 70 ; base speed db 70 ; base special db DRAGON ; species type 1 db DRAGON ; species type 2 -db 45 ; catch rate +db 27 ; catch rate db 144 ; base exp yield -INCBIN "pic/bmon/dragonair.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/dragonair.pic",0,1 ; 66, sprite dimensions dw DragonairPicFront dw DragonairPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/dragonite.asm b/data/baseStats/dragonite.asm index 442275b2..02ac0c9b 100644 --- a/data/baseStats/dragonite.asm +++ b/data/baseStats/dragonite.asm @@ -6,9 +6,9 @@ db 80 ; base speed db 100 ; base special db DRAGON ; species type 1 db FLYING ; species type 2 -db 45 ; catch rate +db 9 ; catch rate db 218 ; base exp yield -INCBIN "pic/bmon/dragonite.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/dragonite.pic",0,1 ; 77, sprite dimensions dw DragonitePicFront dw DragonitePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/dratini.asm b/data/baseStats/dratini.asm index 5fb5c75d..c3c659a4 100644 --- a/data/baseStats/dratini.asm +++ b/data/baseStats/dratini.asm @@ -8,7 +8,7 @@ db DRAGON ; species type 1 db DRAGON ; species type 2 db 45 ; catch rate db 67 ; base exp yield -INCBIN "pic/bmon/dratini.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/dratini.pic",0,1 ; 55, sprite dimensions dw DratiniPicFront dw DratiniPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/drowzee.asm b/data/baseStats/drowzee.asm index 452db1bc..132c1b5c 100644 --- a/data/baseStats/drowzee.asm +++ b/data/baseStats/drowzee.asm @@ -8,7 +8,7 @@ db PSYCHIC ; species type 1 db PSYCHIC ; species type 2 db 190 ; catch rate db 102 ; base exp yield -INCBIN "pic/bmon/drowzee.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/drowzee.pic",0,1 ; 66, sprite dimensions dw DrowzeePicFront dw DrowzeePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/dugtrio.asm b/data/baseStats/dugtrio.asm index c763680f..07f551a5 100644 --- a/data/baseStats/dugtrio.asm +++ b/data/baseStats/dugtrio.asm @@ -8,7 +8,7 @@ db GROUND ; species type 1 db GROUND ; species type 2 db 50 ; catch rate db 153 ; base exp yield -INCBIN "pic/bmon/dugtrio.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/dugtrio.pic",0,1 ; 66, sprite dimensions dw DugtrioPicFront dw DugtrioPicBack ; attacks known at lvl 0 @@ -24,5 +24,5 @@ db 0 ; growth rate tmlearn 26,27,28,31,32 tmlearn 34 tmlearn 44,48 - tmlearn 50 + tmlearn 50,51 db 0 ; padding diff --git a/data/baseStats/eevee.asm b/data/baseStats/eevee.asm index 51e36621..7e64bfd8 100644 --- a/data/baseStats/eevee.asm +++ b/data/baseStats/eevee.asm @@ -8,12 +8,12 @@ db NORMAL ; species type 1 db NORMAL ; species type 2 db 45 ; catch rate db 92 ; base exp yield -INCBIN "pic/bmon/eevee.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/eevee.pic",0,1 ; 55, sprite dimensions dw EeveePicFront dw EeveePicBack ; attacks known at lvl 0 db TACKLE -db SAND_ATTACK +db TAIL_WHIP db 0 db 0 db 0 ; growth rate diff --git a/data/baseStats/ekans.asm b/data/baseStats/ekans.asm index b029a67c..a4385e9c 100644 --- a/data/baseStats/ekans.asm +++ b/data/baseStats/ekans.asm @@ -8,7 +8,7 @@ db POISON ; species type 1 db POISON ; species type 2 db 255 ; catch rate db 62 ; base exp yield -INCBIN "pic/bmon/ekans.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/ekans.pic",0,1 ; 55, sprite dimensions dw EkansPicFront dw EkansPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/electabuzz.asm b/data/baseStats/electabuzz.asm index 4b44604e..8b85f12a 100644 --- a/data/baseStats/electabuzz.asm +++ b/data/baseStats/electabuzz.asm @@ -8,7 +8,7 @@ db ELECTRIC ; species type 1 db ELECTRIC ; species type 2 db 45 ; catch rate db 156 ; base exp yield -INCBIN "pic/bmon/electabuzz.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/electabuzz.pic",0,1 ; 66, sprite dimensions dw ElectabuzzPicFront dw ElectabuzzPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/electrode.asm b/data/baseStats/electrode.asm index 1b292f2f..d6842241 100644 --- a/data/baseStats/electrode.asm +++ b/data/baseStats/electrode.asm @@ -8,7 +8,7 @@ db ELECTRIC ; species type 1 db ELECTRIC ; species type 2 db 60 ; catch rate db 150 ; base exp yield -INCBIN "pic/bmon/electrode.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/electrode.pic",0,1 ; 55, sprite dimensions dw ElectrodePicFront dw ElectrodePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/exeggcute.asm b/data/baseStats/exeggcute.asm index 8503889b..db0860fa 100644 --- a/data/baseStats/exeggcute.asm +++ b/data/baseStats/exeggcute.asm @@ -8,7 +8,7 @@ db GRASS ; species type 1 db PSYCHIC ; species type 2 db 90 ; catch rate db 98 ; base exp yield -INCBIN "pic/bmon/exeggcute.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/exeggcute.pic",0,1 ; 77, sprite dimensions dw ExeggcutePicFront dw ExeggcutePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/exeggutor.asm b/data/baseStats/exeggutor.asm index 4d739430..1349e7d7 100644 --- a/data/baseStats/exeggutor.asm +++ b/data/baseStats/exeggutor.asm @@ -8,7 +8,7 @@ db GRASS ; species type 1 db PSYCHIC ; species type 2 db 45 ; catch rate db 212 ; base exp yield -INCBIN "pic/bmon/exeggutor.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/exeggutor.pic",0,1 ; 77, sprite dimensions dw ExeggutorPicFront dw ExeggutorPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/farfetchd.asm b/data/baseStats/farfetchd.asm index 2aa7eca0..801b672c 100644 --- a/data/baseStats/farfetchd.asm +++ b/data/baseStats/farfetchd.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db FLYING ; species type 2 db 45 ; catch rate db 94 ; base exp yield -INCBIN "pic/bmon/farfetchd.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/farfetchd.pic",0,1 ; 66, sprite dimensions dw FarfetchdPicFront dw FarfetchdPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/fearow.asm b/data/baseStats/fearow.asm index 4ad88723..2da5d712 100644 --- a/data/baseStats/fearow.asm +++ b/data/baseStats/fearow.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db FLYING ; species type 2 db 90 ; catch rate db 162 ; base exp yield -INCBIN "pic/bmon/fearow.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/fearow.pic",0,1 ; 77, sprite dimensions dw FearowPicFront dw FearowPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/flareon.asm b/data/baseStats/flareon.asm index 70621a6a..82add9d7 100644 --- a/data/baseStats/flareon.asm +++ b/data/baseStats/flareon.asm @@ -8,12 +8,12 @@ db FIRE ; species type 1 db FIRE ; species type 2 db 45 ; catch rate db 198 ; base exp yield -INCBIN "pic/bmon/flareon.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/flareon.pic",0,1 ; 66, sprite dimensions dw FlareonPicFront dw FlareonPicBack ; attacks known at lvl 0 db TACKLE -db SAND_ATTACK +db TAIL_WHIP db QUICK_ATTACK db EMBER db 0 ; growth rate diff --git a/data/baseStats/gastly.asm b/data/baseStats/gastly.asm index fdcaaa71..10f5eebd 100644 --- a/data/baseStats/gastly.asm +++ b/data/baseStats/gastly.asm @@ -8,7 +8,7 @@ db GHOST ; species type 1 db POISON ; species type 2 db 190 ; catch rate db 95 ; base exp yield -INCBIN "pic/bmon/gastly.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/gastly.pic",0,1 ; 77, sprite dimensions dw GastlyPicFront dw GastlyPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/gengar.asm b/data/baseStats/gengar.asm index 0e3e877c..927e0d9b 100644 --- a/data/baseStats/gengar.asm +++ b/data/baseStats/gengar.asm @@ -8,7 +8,7 @@ db GHOST ; species type 1 db POISON ; species type 2 db 45 ; catch rate db 190 ; base exp yield -INCBIN "pic/bmon/gengar.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/gengar.pic",0,1 ; 66, sprite dimensions dw GengarPicFront dw GengarPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/geodude.asm b/data/baseStats/geodude.asm index a47a993a..fb981766 100644 --- a/data/baseStats/geodude.asm +++ b/data/baseStats/geodude.asm @@ -8,7 +8,7 @@ db ROCK ; species type 1 db GROUND ; species type 2 db 255 ; catch rate db 86 ; base exp yield -INCBIN "pic/bmon/geodude.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/geodude.pic",0,1 ; 55, sprite dimensions dw GeodudePicFront dw GeodudePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/gloom.asm b/data/baseStats/gloom.asm index f2153e5c..35bfbba6 100644 --- a/data/baseStats/gloom.asm +++ b/data/baseStats/gloom.asm @@ -8,7 +8,7 @@ db GRASS ; species type 1 db POISON ; species type 2 db 120 ; catch rate db 132 ; base exp yield -INCBIN "pic/bmon/gloom.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/gloom.pic",0,1 ; 66, sprite dimensions dw GloomPicFront dw GloomPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/golbat.asm b/data/baseStats/golbat.asm index 845adf4b..123ccad6 100644 --- a/data/baseStats/golbat.asm +++ b/data/baseStats/golbat.asm @@ -8,7 +8,7 @@ db POISON ; species type 1 db FLYING ; species type 2 db 90 ; catch rate db 171 ; base exp yield -INCBIN "pic/bmon/golbat.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/golbat.pic",0,1 ; 77, sprite dimensions dw GolbatPicFront dw GolbatPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/goldeen.asm b/data/baseStats/goldeen.asm index ed3a4fdb..7952ec18 100644 --- a/data/baseStats/goldeen.asm +++ b/data/baseStats/goldeen.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db WATER ; species type 2 db 225 ; catch rate db 111 ; base exp yield -INCBIN "pic/bmon/goldeen.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/goldeen.pic",0,1 ; 66, sprite dimensions dw GoldeenPicFront dw GoldeenPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/golduck.asm b/data/baseStats/golduck.asm index cce89da7..6ac14021 100644 --- a/data/baseStats/golduck.asm +++ b/data/baseStats/golduck.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db WATER ; species type 2 db 75 ; catch rate db 174 ; base exp yield -INCBIN "pic/bmon/golduck.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/golduck.pic",0,1 ; 77, sprite dimensions dw GolduckPicFront dw GolduckPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/golem.asm b/data/baseStats/golem.asm index 28f2a326..5047de54 100644 --- a/data/baseStats/golem.asm +++ b/data/baseStats/golem.asm @@ -8,7 +8,7 @@ db ROCK ; species type 1 db GROUND ; species type 2 db 45 ; catch rate db 177 ; base exp yield -INCBIN "pic/bmon/golem.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/golem.pic",0,1 ; 66, sprite dimensions dw GolemPicFront dw GolemPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/graveler.asm b/data/baseStats/graveler.asm index 08776ab1..898673b8 100644 --- a/data/baseStats/graveler.asm +++ b/data/baseStats/graveler.asm @@ -8,7 +8,7 @@ db ROCK ; species type 1 db GROUND ; species type 2 db 120 ; catch rate db 134 ; base exp yield -INCBIN "pic/bmon/graveler.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/graveler.pic",0,1 ; 66, sprite dimensions dw GravelerPicFront dw GravelerPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/grimer.asm b/data/baseStats/grimer.asm index 5f7a64a7..0effddf4 100644 --- a/data/baseStats/grimer.asm +++ b/data/baseStats/grimer.asm @@ -8,7 +8,7 @@ db POISON ; species type 1 db POISON ; species type 2 db 190 ; catch rate db 90 ; base exp yield -INCBIN "pic/bmon/grimer.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/grimer.pic",0,1 ; 55, sprite dimensions dw GrimerPicFront dw GrimerPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/growlithe.asm b/data/baseStats/growlithe.asm index df305636..39804054 100644 --- a/data/baseStats/growlithe.asm +++ b/data/baseStats/growlithe.asm @@ -8,7 +8,7 @@ db FIRE ; species type 1 db FIRE ; species type 2 db 190 ; catch rate db 91 ; base exp yield -INCBIN "pic/bmon/growlithe.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/growlithe.pic",0,1 ; 55, sprite dimensions dw GrowlithePicFront dw GrowlithePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/gyarados.asm b/data/baseStats/gyarados.asm index 6bfc34a0..742da527 100644 --- a/data/baseStats/gyarados.asm +++ b/data/baseStats/gyarados.asm @@ -8,14 +8,14 @@ db WATER ; species type 1 db FLYING ; species type 2 db 45 ; catch rate db 214 ; base exp yield -INCBIN "pic/bmon/gyarados.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/gyarados.pic",0,1 ; 77, sprite dimensions dw GyaradosPicFront dw GyaradosPicBack ; attacks known at lvl 0 -db BITE -db DRAGON_RAGE -db LEER -db HYDRO_PUMP +db TACKLE +db 0 +db 0 +db 0 db 5 ; growth rate ; learnset tmlearn 6,8 diff --git a/data/baseStats/haunter.asm b/data/baseStats/haunter.asm index bd39eaf4..8614c373 100644 --- a/data/baseStats/haunter.asm +++ b/data/baseStats/haunter.asm @@ -8,7 +8,7 @@ db GHOST ; species type 1 db POISON ; species type 2 db 90 ; catch rate db 126 ; base exp yield -INCBIN "pic/bmon/haunter.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/haunter.pic",0,1 ; 66, sprite dimensions dw HaunterPicFront dw HaunterPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/hitmonchan.asm b/data/baseStats/hitmonchan.asm index 37021f65..4a565d21 100644 --- a/data/baseStats/hitmonchan.asm +++ b/data/baseStats/hitmonchan.asm @@ -8,7 +8,7 @@ db FIGHTING ; species type 1 db FIGHTING ; species type 2 db 45 ; catch rate db 140 ; base exp yield -INCBIN "pic/bmon/hitmonchan.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/hitmonchan.pic",0,1 ; 66, sprite dimensions dw HitmonchanPicFront dw HitmonchanPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/hitmonlee.asm b/data/baseStats/hitmonlee.asm index d16db130..b08cd76c 100644 --- a/data/baseStats/hitmonlee.asm +++ b/data/baseStats/hitmonlee.asm @@ -8,7 +8,7 @@ db FIGHTING ; species type 1 db FIGHTING ; species type 2 db 45 ; catch rate db 139 ; base exp yield -INCBIN "pic/bmon/hitmonlee.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/hitmonlee.pic",0,1 ; 77, sprite dimensions dw HitmonleePicFront dw HitmonleePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/horsea.asm b/data/baseStats/horsea.asm index 01de3ff6..86222be3 100644 --- a/data/baseStats/horsea.asm +++ b/data/baseStats/horsea.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db WATER ; species type 2 db 225 ; catch rate db 83 ; base exp yield -INCBIN "pic/bmon/horsea.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/horsea.pic",0,1 ; 55, sprite dimensions dw HorseaPicFront dw HorseaPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/hypno.asm b/data/baseStats/hypno.asm index 4e4959b4..3d9cb355 100644 --- a/data/baseStats/hypno.asm +++ b/data/baseStats/hypno.asm @@ -8,7 +8,7 @@ db PSYCHIC ; species type 1 db PSYCHIC ; species type 2 db 75 ; catch rate db 165 ; base exp yield -INCBIN "pic/bmon/hypno.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/hypno.pic",0,1 ; 77, sprite dimensions dw HypnoPicFront dw HypnoPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/ivysaur.asm b/data/baseStats/ivysaur.asm index 3e19f2a1..38d5ce6a 100644 --- a/data/baseStats/ivysaur.asm +++ b/data/baseStats/ivysaur.asm @@ -8,7 +8,7 @@ db GRASS ; species type 1 db POISON ; species type 2 db 45 ; catch rate db 141 ; base exp yield -INCBIN "pic/bmon/ivysaur.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/ivysaur.pic",0,1 ; 66, sprite dimensions dw IvysaurPicFront dw IvysaurPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/jigglypuff.asm b/data/baseStats/jigglypuff.asm index fac03fc9..bb8a1626 100644 --- a/data/baseStats/jigglypuff.asm +++ b/data/baseStats/jigglypuff.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db NORMAL ; species type 2 db 170 ; catch rate db 76 ; base exp yield -INCBIN "pic/bmon/jigglypuff.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/jigglypuff.pic",0,1 ; 55, sprite dimensions dw JigglypuffPicFront dw JigglypuffPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/jolteon.asm b/data/baseStats/jolteon.asm index b33d6327..dd1e3c5a 100644 --- a/data/baseStats/jolteon.asm +++ b/data/baseStats/jolteon.asm @@ -8,12 +8,12 @@ db ELECTRIC ; species type 1 db ELECTRIC ; species type 2 db 45 ; catch rate db 197 ; base exp yield -INCBIN "pic/bmon/jolteon.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/jolteon.pic",0,1 ; 66, sprite dimensions dw JolteonPicFront dw JolteonPicBack ; attacks known at lvl 0 db TACKLE -db SAND_ATTACK +db TAIL_WHIP db QUICK_ATTACK db THUNDERSHOCK db 0 ; growth rate diff --git a/data/baseStats/jynx.asm b/data/baseStats/jynx.asm index e69b87b9..72d28179 100644 --- a/data/baseStats/jynx.asm +++ b/data/baseStats/jynx.asm @@ -8,7 +8,7 @@ db ICE ; species type 1 db PSYCHIC ; species type 2 db 45 ; catch rate db 137 ; base exp yield -INCBIN "pic/bmon/jynx.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/jynx.pic",0,1 ; 66, sprite dimensions dw JynxPicFront dw JynxPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/kabuto.asm b/data/baseStats/kabuto.asm index 60f3e959..dce77f2b 100644 --- a/data/baseStats/kabuto.asm +++ b/data/baseStats/kabuto.asm @@ -8,7 +8,7 @@ db ROCK ; species type 1 db WATER ; species type 2 db 45 ; catch rate db 119 ; base exp yield -INCBIN "pic/bmon/kabuto.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/kabuto.pic",0,1 ; 55, sprite dimensions dw KabutoPicFront dw KabutoPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/kabutops.asm b/data/baseStats/kabutops.asm index dbddab2e..ef165079 100644 --- a/data/baseStats/kabutops.asm +++ b/data/baseStats/kabutops.asm @@ -8,7 +8,7 @@ db ROCK ; species type 1 db WATER ; species type 2 db 45 ; catch rate db 201 ; base exp yield -INCBIN "pic/bmon/kabutops.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/kabutops.pic",0,1 ; 66, sprite dimensions dw KabutopsPicFront dw KabutopsPicBack ; attacks known at lvl 0 @@ -24,5 +24,5 @@ db 0 ; growth rate tmlearn 31,32 tmlearn 33,34,40 tmlearn 44 - tmlearn 50,53 + tmlearn 50,51,53 db 0 ; padding diff --git a/data/baseStats/kadabra.asm b/data/baseStats/kadabra.asm index 472cc4c5..37f9ded4 100644 --- a/data/baseStats/kadabra.asm +++ b/data/baseStats/kadabra.asm @@ -8,13 +8,13 @@ db PSYCHIC ; species type 1 db PSYCHIC ; species type 2 db 100 ; catch rate db 145 ; base exp yield -INCBIN "pic/bmon/kadabra.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/kadabra.pic",0,1 ; 66, sprite dimensions dw KadabraPicFront dw KadabraPicBack ; attacks known at lvl 0 db TELEPORT -db CONFUSION -db DISABLE +db KINESIS +db 0 db 0 db 3 ; growth rate ; learnset diff --git a/data/baseStats/kakuna.asm b/data/baseStats/kakuna.asm index ec593f91..ea59d67d 100644 --- a/data/baseStats/kakuna.asm +++ b/data/baseStats/kakuna.asm @@ -8,7 +8,7 @@ db BUG ; species type 1 db POISON ; species type 2 db 120 ; catch rate db 71 ; base exp yield -INCBIN "pic/bmon/kakuna.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/kakuna.pic",0,1 ; 55, sprite dimensions dw KakunaPicFront dw KakunaPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/kangaskhan.asm b/data/baseStats/kangaskhan.asm index 6dcd1e3c..bca753e2 100644 --- a/data/baseStats/kangaskhan.asm +++ b/data/baseStats/kangaskhan.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db NORMAL ; species type 2 db 45 ; catch rate db 175 ; base exp yield -INCBIN "pic/bmon/kangaskhan.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/kangaskhan.pic",0,1 ; 77, sprite dimensions dw KangaskhanPicFront dw KangaskhanPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/kingler.asm b/data/baseStats/kingler.asm index 8708d5cf..d4030bb8 100644 --- a/data/baseStats/kingler.asm +++ b/data/baseStats/kingler.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db WATER ; species type 2 db 60 ; catch rate db 206 ; base exp yield -INCBIN "pic/bmon/kingler.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/kingler.pic",0,1 ; 77, sprite dimensions dw KinglerPicFront dw KinglerPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/koffing.asm b/data/baseStats/koffing.asm index fced6246..a6034ea6 100644 --- a/data/baseStats/koffing.asm +++ b/data/baseStats/koffing.asm @@ -8,7 +8,7 @@ db POISON ; species type 1 db POISON ; species type 2 db 190 ; catch rate db 114 ; base exp yield -INCBIN "pic/bmon/koffing.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/koffing.pic",0,1 ; 66, sprite dimensions dw KoffingPicFront dw KoffingPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/krabby.asm b/data/baseStats/krabby.asm index 88d690b6..b0b6ce66 100644 --- a/data/baseStats/krabby.asm +++ b/data/baseStats/krabby.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db WATER ; species type 2 db 225 ; catch rate db 115 ; base exp yield -INCBIN "pic/bmon/krabby.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/krabby.pic",0,1 ; 55, sprite dimensions dw KrabbyPicFront dw KrabbyPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/lapras.asm b/data/baseStats/lapras.asm index 3a897525..83df6278 100644 --- a/data/baseStats/lapras.asm +++ b/data/baseStats/lapras.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db ICE ; species type 2 db 45 ; catch rate db 219 ; base exp yield -INCBIN "pic/bmon/lapras.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/lapras.pic",0,1 ; 77, sprite dimensions dw LaprasPicFront dw LaprasPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/lickitung.asm b/data/baseStats/lickitung.asm index 05020627..5db3fa6e 100644 --- a/data/baseStats/lickitung.asm +++ b/data/baseStats/lickitung.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db NORMAL ; species type 2 db 45 ; catch rate db 127 ; base exp yield -INCBIN "pic/bmon/lickitung.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/lickitung.pic",0,1 ; 77, sprite dimensions dw LickitungPicFront dw LickitungPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/machamp.asm b/data/baseStats/machamp.asm index b461d45a..dec82c74 100644 --- a/data/baseStats/machamp.asm +++ b/data/baseStats/machamp.asm @@ -8,7 +8,7 @@ db FIGHTING ; species type 1 db FIGHTING ; species type 2 db 45 ; catch rate db 193 ; base exp yield -INCBIN "pic/bmon/machamp.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/machamp.pic",0,1 ; 77, sprite dimensions dw MachampPicFront dw MachampPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/machoke.asm b/data/baseStats/machoke.asm index b8a41efd..eee41d0c 100644 --- a/data/baseStats/machoke.asm +++ b/data/baseStats/machoke.asm @@ -8,7 +8,7 @@ db FIGHTING ; species type 1 db FIGHTING ; species type 2 db 90 ; catch rate db 146 ; base exp yield -INCBIN "pic/bmon/machoke.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/machoke.pic",0,1 ; 77, sprite dimensions dw MachokePicFront dw MachokePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/machop.asm b/data/baseStats/machop.asm index 9ed22dc2..91250bfb 100644 --- a/data/baseStats/machop.asm +++ b/data/baseStats/machop.asm @@ -8,7 +8,7 @@ db FIGHTING ; species type 1 db FIGHTING ; species type 2 db 180 ; catch rate db 88 ; base exp yield -INCBIN "pic/bmon/machop.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/machop.pic",0,1 ; 55, sprite dimensions dw MachopPicFront dw MachopPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/magikarp.asm b/data/baseStats/magikarp.asm index 50cc651c..941f8cd9 100644 --- a/data/baseStats/magikarp.asm +++ b/data/baseStats/magikarp.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db WATER ; species type 2 db 255 ; catch rate db 20 ; base exp yield -INCBIN "pic/bmon/magikarp.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/magikarp.pic",0,1 ; 66, sprite dimensions dw MagikarpPicFront dw MagikarpPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/magmar.asm b/data/baseStats/magmar.asm index 379e91df..6d503611 100644 --- a/data/baseStats/magmar.asm +++ b/data/baseStats/magmar.asm @@ -8,7 +8,7 @@ db FIRE ; species type 1 db FIRE ; species type 2 db 45 ; catch rate db 167 ; base exp yield -INCBIN "pic/bmon/magmar.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/magmar.pic",0,1 ; 66, sprite dimensions dw MagmarPicFront dw MagmarPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/magnemite.asm b/data/baseStats/magnemite.asm index ce042457..a328f2ef 100644 --- a/data/baseStats/magnemite.asm +++ b/data/baseStats/magnemite.asm @@ -8,7 +8,7 @@ db ELECTRIC ; species type 1 db ELECTRIC ; species type 2 db 190 ; catch rate db 89 ; base exp yield -INCBIN "pic/bmon/magnemite.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/magnemite.pic",0,1 ; 55, sprite dimensions dw MagnemitePicFront dw MagnemitePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/magneton.asm b/data/baseStats/magneton.asm index a2890bbd..9cc52ec3 100644 --- a/data/baseStats/magneton.asm +++ b/data/baseStats/magneton.asm @@ -8,7 +8,7 @@ db ELECTRIC ; species type 1 db ELECTRIC ; species type 2 db 60 ; catch rate db 161 ; base exp yield -INCBIN "pic/bmon/magneton.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/magneton.pic",0,1 ; 66, sprite dimensions dw MagnetonPicFront dw MagnetonPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/mankey.asm b/data/baseStats/mankey.asm index 406a1364..b05fd16d 100644 --- a/data/baseStats/mankey.asm +++ b/data/baseStats/mankey.asm @@ -8,7 +8,7 @@ db FIGHTING ; species type 1 db FIGHTING ; species type 2 db 190 ; catch rate db 74 ; base exp yield -INCBIN "pic/bmon/mankey.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/mankey.pic",0,1 ; 55, sprite dimensions dw MankeyPicFront dw MankeyPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/marowak.asm b/data/baseStats/marowak.asm index 3b90dbb1..bc767faf 100644 --- a/data/baseStats/marowak.asm +++ b/data/baseStats/marowak.asm @@ -8,14 +8,14 @@ db GROUND ; species type 1 db GROUND ; species type 2 db 75 ; catch rate db 124 ; base exp yield -INCBIN "pic/bmon/marowak.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/marowak.pic",0,1 ; 66, sprite dimensions dw MarowakPicFront dw MarowakPicBack ; attacks known at lvl 0 db BONE_CLUB -db GROWL -db LEER -db FOCUS_ENERGY +db TAIL_WHIP +db 0 +db 0 db 0 ; growth rate ; learnset tmlearn 1,5,6,8 diff --git a/data/baseStats/meowth.asm b/data/baseStats/meowth.asm index dc146cf3..ce211d22 100644 --- a/data/baseStats/meowth.asm +++ b/data/baseStats/meowth.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db NORMAL ; species type 2 db 255 ; catch rate db 69 ; base exp yield -INCBIN "pic/bmon/meowth.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/meowth.pic",0,1 ; 55, sprite dimensions dw MeowthPicFront dw MeowthPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/metapod.asm b/data/baseStats/metapod.asm index 9da351ad..b29a323d 100644 --- a/data/baseStats/metapod.asm +++ b/data/baseStats/metapod.asm @@ -8,7 +8,7 @@ db BUG ; species type 1 db BUG ; species type 2 db 120 ; catch rate db 72 ; base exp yield -INCBIN "pic/bmon/metapod.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/metapod.pic",0,1 ; 55, sprite dimensions dw MetapodPicFront dw MetapodPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/mew.asm b/data/baseStats/mew.asm index 6919fd0e..7381bf6f 100644 --- a/data/baseStats/mew.asm +++ b/data/baseStats/mew.asm @@ -1,4 +1,3 @@ -MewBaseStats: db DEX_MEW ; pokedex id db 100 ; base hp db 100 ; base attack @@ -9,7 +8,7 @@ db PSYCHIC ; species type 1 db PSYCHIC ; species type 2 db 45 ; catch rate db 64 ; base exp yield -INCBIN "pic/bmon/mew.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/mew.pic",0,1 ; 55, sprite dimensions dw MewPicFront dw MewPicBack ; attacks known at lvl 0 @@ -25,5 +24,5 @@ db 3 ; growth rate tmlearn 25,26,27,28,29,30,31,32 tmlearn 33,34,35,36,37,38,39,40 tmlearn 41,42,43,44,45,46,47,48 - tmlearn 49,50,51,52,53,54,55,56 -db %11111111 ; usually spacing + tmlearn 49,50,51,52,53,54,55 +db 0 ; usually spacing diff --git a/data/baseStats/mewtwo.asm b/data/baseStats/mewtwo.asm index dc597345..d6239384 100644 --- a/data/baseStats/mewtwo.asm +++ b/data/baseStats/mewtwo.asm @@ -8,7 +8,7 @@ db PSYCHIC ; species type 1 db PSYCHIC ; species type 2 db 3 ; catch rate db 220 ; base exp yield -INCBIN "pic/bmon/mewtwo.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/mewtwo.pic",0,1 ; 77, sprite dimensions dw MewtwoPicFront dw MewtwoPicBack ; attacks known at lvl 0 @@ -19,7 +19,7 @@ db PSYCHIC_M db 5 ; growth rate ; learnset tmlearn 1,5,6,8 - tmlearn 9,10,11,12,13,14,15,16 + tmlearn 9,10,11,12,13,14,15 tmlearn 17,18,19,20,22,24 tmlearn 25,29,30,31,32 tmlearn 33,34,35,36,38,40 diff --git a/data/baseStats/moltres.asm b/data/baseStats/moltres.asm index e9437405..5588e0df 100644 --- a/data/baseStats/moltres.asm +++ b/data/baseStats/moltres.asm @@ -8,7 +8,7 @@ db FIRE ; species type 1 db FLYING ; species type 2 db 3 ; catch rate db 217 ; base exp yield -INCBIN "pic/bmon/moltres.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/moltres.pic",0,1 ; 77, sprite dimensions dw MoltresPicFront dw MoltresPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/mrmime.asm b/data/baseStats/mrmime.asm index 8640e340..87b110b7 100644 --- a/data/baseStats/mrmime.asm +++ b/data/baseStats/mrmime.asm @@ -8,7 +8,7 @@ db PSYCHIC ; species type 1 db PSYCHIC ; species type 2 db 45 ; catch rate db 136 ; base exp yield -INCBIN "pic/bmon/mr.mime.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/mr.mime.pic",0,1 ; 66, sprite dimensions dw MrMimePicFront dw MrMimePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/muk.asm b/data/baseStats/muk.asm index cb15563e..4e67df43 100644 --- a/data/baseStats/muk.asm +++ b/data/baseStats/muk.asm @@ -8,7 +8,7 @@ db POISON ; species type 1 db POISON ; species type 2 db 75 ; catch rate db 157 ; base exp yield -INCBIN "pic/bmon/muk.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/muk.pic",0,1 ; 77, sprite dimensions dw MukPicFront dw MukPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/nidoking.asm b/data/baseStats/nidoking.asm index ebef0965..c9efa629 100644 --- a/data/baseStats/nidoking.asm +++ b/data/baseStats/nidoking.asm @@ -8,7 +8,7 @@ db POISON ; species type 1 db GROUND ; species type 2 db 45 ; catch rate db 195 ; base exp yield -INCBIN "pic/bmon/nidoking.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/nidoking.pic",0,1 ; 77, sprite dimensions dw NidokingPicFront dw NidokingPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/nidoqueen.asm b/data/baseStats/nidoqueen.asm index 9ea29a31..f37cc0af 100644 --- a/data/baseStats/nidoqueen.asm +++ b/data/baseStats/nidoqueen.asm @@ -8,7 +8,7 @@ db POISON ; species type 1 db GROUND ; species type 2 db 45 ; catch rate db 194 ; base exp yield -INCBIN "pic/bmon/nidoqueen.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/nidoqueen.pic",0,1 ; 77, sprite dimensions dw NidoqueenPicFront dw NidoqueenPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/nidoranf.asm b/data/baseStats/nidoranf.asm index 67832f18..9694a027 100644 --- a/data/baseStats/nidoranf.asm +++ b/data/baseStats/nidoranf.asm @@ -8,7 +8,7 @@ db POISON ; species type 1 db POISON ; species type 2 db 235 ; catch rate db 59 ; base exp yield -INCBIN "pic/bmon/nidoranf.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/nidoranf.pic",0,1 ; 55, sprite dimensions dw NidoranFPicFront dw NidoranFPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/nidoranm.asm b/data/baseStats/nidoranm.asm index a7882766..0d04948e 100644 --- a/data/baseStats/nidoranm.asm +++ b/data/baseStats/nidoranm.asm @@ -8,7 +8,7 @@ db POISON ; species type 1 db POISON ; species type 2 db 235 ; catch rate db 60 ; base exp yield -INCBIN "pic/bmon/nidoranm.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/nidoranm.pic",0,1 ; 55, sprite dimensions dw NidoranMPicFront dw NidoranMPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/nidorina.asm b/data/baseStats/nidorina.asm index 0ddecf70..e8375d97 100644 --- a/data/baseStats/nidorina.asm +++ b/data/baseStats/nidorina.asm @@ -8,7 +8,7 @@ db POISON ; species type 1 db POISON ; species type 2 db 120 ; catch rate db 117 ; base exp yield -INCBIN "pic/bmon/nidorina.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/nidorina.pic",0,1 ; 66, sprite dimensions dw NidorinaPicFront dw NidorinaPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/nidorino.asm b/data/baseStats/nidorino.asm index fc435fc4..ca28b121 100644 --- a/data/baseStats/nidorino.asm +++ b/data/baseStats/nidorino.asm @@ -8,7 +8,7 @@ db POISON ; species type 1 db POISON ; species type 2 db 120 ; catch rate db 118 ; base exp yield -INCBIN "pic/bmon/nidorino.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/nidorino.pic",0,1 ; 66, sprite dimensions dw NidorinoPicFront dw NidorinoPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/ninetales.asm b/data/baseStats/ninetales.asm index e98028dc..212f6322 100644 --- a/data/baseStats/ninetales.asm +++ b/data/baseStats/ninetales.asm @@ -8,7 +8,7 @@ db FIRE ; species type 1 db FIRE ; species type 2 db 75 ; catch rate db 178 ; base exp yield -INCBIN "pic/bmon/ninetales.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/ninetales.pic",0,1 ; 77, sprite dimensions dw NinetalesPicFront dw NinetalesPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/oddish.asm b/data/baseStats/oddish.asm index c91c5138..aabc873b 100644 --- a/data/baseStats/oddish.asm +++ b/data/baseStats/oddish.asm @@ -8,7 +8,7 @@ db GRASS ; species type 1 db POISON ; species type 2 db 255 ; catch rate db 78 ; base exp yield -INCBIN "pic/bmon/oddish.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/oddish.pic",0,1 ; 55, sprite dimensions dw OddishPicFront dw OddishPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/omanyte.asm b/data/baseStats/omanyte.asm index 3c461876..89a6b824 100644 --- a/data/baseStats/omanyte.asm +++ b/data/baseStats/omanyte.asm @@ -8,7 +8,7 @@ db ROCK ; species type 1 db WATER ; species type 2 db 45 ; catch rate db 120 ; base exp yield -INCBIN "pic/bmon/omanyte.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/omanyte.pic",0,1 ; 55, sprite dimensions dw OmanytePicFront dw OmanytePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/omastar.asm b/data/baseStats/omastar.asm index 09a2ae77..2066c8c2 100644 --- a/data/baseStats/omastar.asm +++ b/data/baseStats/omastar.asm @@ -8,7 +8,7 @@ db ROCK ; species type 1 db WATER ; species type 2 db 45 ; catch rate db 199 ; base exp yield -INCBIN "pic/bmon/omastar.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/omastar.pic",0,1 ; 66, sprite dimensions dw OmastarPicFront dw OmastarPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/onix.asm b/data/baseStats/onix.asm index 6f3be4df..1e2f6ed5 100644 --- a/data/baseStats/onix.asm +++ b/data/baseStats/onix.asm @@ -8,7 +8,7 @@ db ROCK ; species type 1 db GROUND ; species type 2 db 45 ; catch rate db 108 ; base exp yield -INCBIN "pic/bmon/onix.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/onix.pic",0,1 ; 77, sprite dimensions dw OnixPicFront dw OnixPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/paras.asm b/data/baseStats/paras.asm index 2c918e68..273ec7a3 100644 --- a/data/baseStats/paras.asm +++ b/data/baseStats/paras.asm @@ -8,7 +8,7 @@ db BUG ; species type 1 db GRASS ; species type 2 db 190 ; catch rate db 70 ; base exp yield -INCBIN "pic/bmon/paras.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/paras.pic",0,1 ; 55, sprite dimensions dw ParasPicFront dw ParasPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/parasect.asm b/data/baseStats/parasect.asm index dfa0c73e..ed5c7015 100644 --- a/data/baseStats/parasect.asm +++ b/data/baseStats/parasect.asm @@ -8,7 +8,7 @@ db BUG ; species type 1 db GRASS ; species type 2 db 75 ; catch rate db 128 ; base exp yield -INCBIN "pic/bmon/parasect.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/parasect.pic",0,1 ; 77, sprite dimensions dw ParasectPicFront dw ParasectPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/persian.asm b/data/baseStats/persian.asm index 2f5ef125..5ace4f35 100644 --- a/data/baseStats/persian.asm +++ b/data/baseStats/persian.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db NORMAL ; species type 2 db 90 ; catch rate db 148 ; base exp yield -INCBIN "pic/bmon/persian.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/persian.pic",0,1 ; 77, sprite dimensions dw PersianPicFront dw PersianPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/pidgeot.asm b/data/baseStats/pidgeot.asm index 05350d07..e0240fb1 100644 --- a/data/baseStats/pidgeot.asm +++ b/data/baseStats/pidgeot.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db FLYING ; species type 2 db 45 ; catch rate db 172 ; base exp yield -INCBIN "pic/bmon/pidgeot.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/pidgeot.pic",0,1 ; 77, sprite dimensions dw PidgeotPicFront dw PidgeotPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/pidgeotto.asm b/data/baseStats/pidgeotto.asm index 74440fcc..2930b5ae 100644 --- a/data/baseStats/pidgeotto.asm +++ b/data/baseStats/pidgeotto.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db FLYING ; species type 2 db 120 ; catch rate db 113 ; base exp yield -INCBIN "pic/bmon/pidgeotto.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/pidgeotto.pic",0,1 ; 66, sprite dimensions dw PidgeottoPicFront dw PidgeottoPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/pidgey.asm b/data/baseStats/pidgey.asm index ec032d6b..c110a32e 100644 --- a/data/baseStats/pidgey.asm +++ b/data/baseStats/pidgey.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db FLYING ; species type 2 db 255 ; catch rate db 55 ; base exp yield -INCBIN "pic/bmon/pidgey.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/pidgey.pic",0,1 ; 55, sprite dimensions dw PidgeyPicFront dw PidgeyPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/pikachu.asm b/data/baseStats/pikachu.asm index 09971b79..5e81a85f 100644 --- a/data/baseStats/pikachu.asm +++ b/data/baseStats/pikachu.asm @@ -8,7 +8,7 @@ db ELECTRIC ; species type 1 db ELECTRIC ; species type 2 db 190 ; catch rate db 82 ; base exp yield -INCBIN "pic/bmon/pikachu.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/pikachu.pic",0,1 ; 55, sprite dimensions dw PikachuPicFront dw PikachuPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/pinsir.asm b/data/baseStats/pinsir.asm index 08c0e95a..b79f01a3 100644 --- a/data/baseStats/pinsir.asm +++ b/data/baseStats/pinsir.asm @@ -8,7 +8,7 @@ db BUG ; species type 1 db BUG ; species type 2 db 45 ; catch rate db 200 ; base exp yield -INCBIN "pic/bmon/pinsir.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/pinsir.pic",0,1 ; 77, sprite dimensions dw PinsirPicFront dw PinsirPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/poliwag.asm b/data/baseStats/poliwag.asm index 8014811e..9c89fc49 100644 --- a/data/baseStats/poliwag.asm +++ b/data/baseStats/poliwag.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db WATER ; species type 2 db 255 ; catch rate db 77 ; base exp yield -INCBIN "pic/bmon/poliwag.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/poliwag.pic",0,1 ; 55, sprite dimensions dw PoliwagPicFront dw PoliwagPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/poliwhirl.asm b/data/baseStats/poliwhirl.asm index 6209da68..c836e194 100644 --- a/data/baseStats/poliwhirl.asm +++ b/data/baseStats/poliwhirl.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db WATER ; species type 2 db 120 ; catch rate db 131 ; base exp yield -INCBIN "pic/bmon/poliwhirl.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/poliwhirl.pic",0,1 ; 66, sprite dimensions dw PoliwhirlPicFront dw PoliwhirlPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/poliwrath.asm b/data/baseStats/poliwrath.asm index 9489a6a3..5a1acd9f 100644 --- a/data/baseStats/poliwrath.asm +++ b/data/baseStats/poliwrath.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db FIGHTING ; species type 2 db 45 ; catch rate db 185 ; base exp yield -INCBIN "pic/bmon/poliwrath.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/poliwrath.pic",0,1 ; 77, sprite dimensions dw PoliwrathPicFront dw PoliwrathPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/ponyta.asm b/data/baseStats/ponyta.asm index a6ff9e4b..3c779075 100644 --- a/data/baseStats/ponyta.asm +++ b/data/baseStats/ponyta.asm @@ -8,7 +8,7 @@ db FIRE ; species type 1 db FIRE ; species type 2 db 190 ; catch rate db 152 ; base exp yield -INCBIN "pic/bmon/ponyta.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/ponyta.pic",0,1 ; 66, sprite dimensions dw PonytaPicFront dw PonytaPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/porygon.asm b/data/baseStats/porygon.asm index a049fa7f..502bbc4f 100644 --- a/data/baseStats/porygon.asm +++ b/data/baseStats/porygon.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db NORMAL ; species type 2 db 45 ; catch rate db 130 ; base exp yield -INCBIN "pic/bmon/porygon.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/porygon.pic",0,1 ; 66, sprite dimensions dw PorygonPicFront dw PorygonPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/primeape.asm b/data/baseStats/primeape.asm index 659edefd..3eeac4f3 100644 --- a/data/baseStats/primeape.asm +++ b/data/baseStats/primeape.asm @@ -8,14 +8,14 @@ db FIGHTING ; species type 1 db FIGHTING ; species type 2 db 75 ; catch rate db 149 ; base exp yield -INCBIN "pic/bmon/primeape.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/primeape.pic",0,1 ; 77, sprite dimensions dw PrimeapePicFront dw PrimeapePicBack ; attacks known at lvl 0 db SCRATCH db LEER +db LOW_KICK db KARATE_CHOP -db FURY_SWIPES db 0 ; growth rate ; learnset tmlearn 1,5,6,8 diff --git a/data/baseStats/psyduck.asm b/data/baseStats/psyduck.asm index db3ac79f..e3ab72bb 100644 --- a/data/baseStats/psyduck.asm +++ b/data/baseStats/psyduck.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db WATER ; species type 2 db 190 ; catch rate db 80 ; base exp yield -INCBIN "pic/bmon/psyduck.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/psyduck.pic",0,1 ; 55, sprite dimensions dw PsyduckPicFront dw PsyduckPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/raichu.asm b/data/baseStats/raichu.asm index c830483c..c63231b3 100644 --- a/data/baseStats/raichu.asm +++ b/data/baseStats/raichu.asm @@ -8,7 +8,7 @@ db ELECTRIC ; species type 1 db ELECTRIC ; species type 2 db 75 ; catch rate db 122 ; base exp yield -INCBIN "pic/bmon/raichu.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/raichu.pic",0,1 ; 77, sprite dimensions dw RaichuPicFront dw RaichuPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/rapidash.asm b/data/baseStats/rapidash.asm index c452159e..18781739 100644 --- a/data/baseStats/rapidash.asm +++ b/data/baseStats/rapidash.asm @@ -8,7 +8,7 @@ db FIRE ; species type 1 db FIRE ; species type 2 db 60 ; catch rate db 192 ; base exp yield -INCBIN "pic/bmon/rapidash.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/rapidash.pic",0,1 ; 77, sprite dimensions dw RapidashPicFront dw RapidashPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/raticate.asm b/data/baseStats/raticate.asm index ff8373d5..85aa044b 100644 --- a/data/baseStats/raticate.asm +++ b/data/baseStats/raticate.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db NORMAL ; species type 2 db 90 ; catch rate db 116 ; base exp yield -INCBIN "pic/bmon/raticate.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/raticate.pic",0,1 ; 66, sprite dimensions dw RaticatePicFront dw RaticatePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/rattata.asm b/data/baseStats/rattata.asm index 7edfb626..165dce14 100644 --- a/data/baseStats/rattata.asm +++ b/data/baseStats/rattata.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db NORMAL ; species type 2 db 255 ; catch rate db 57 ; base exp yield -INCBIN "pic/bmon/rattata.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/rattata.pic",0,1 ; 55, sprite dimensions dw RattataPicFront dw RattataPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/rhydon.asm b/data/baseStats/rhydon.asm index d7066906..b183c282 100644 --- a/data/baseStats/rhydon.asm +++ b/data/baseStats/rhydon.asm @@ -8,7 +8,7 @@ db GROUND ; species type 1 db ROCK ; species type 2 db 60 ; catch rate db 204 ; base exp yield -INCBIN "pic/bmon/rhydon.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/rhydon.pic",0,1 ; 77, sprite dimensions dw RhydonPicFront dw RhydonPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/rhyhorn.asm b/data/baseStats/rhyhorn.asm index a6491bd5..41a1e360 100644 --- a/data/baseStats/rhyhorn.asm +++ b/data/baseStats/rhyhorn.asm @@ -8,7 +8,7 @@ db GROUND ; species type 1 db ROCK ; species type 2 db 120 ; catch rate db 135 ; base exp yield -INCBIN "pic/bmon/rhyhorn.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/rhyhorn.pic",0,1 ; 77, sprite dimensions dw RhyhornPicFront dw RhyhornPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/sandshrew.asm b/data/baseStats/sandshrew.asm index a9875a8e..b4c6abb8 100644 --- a/data/baseStats/sandshrew.asm +++ b/data/baseStats/sandshrew.asm @@ -8,7 +8,7 @@ db GROUND ; species type 1 db GROUND ; species type 2 db 255 ; catch rate db 93 ; base exp yield -INCBIN "pic/bmon/sandshrew.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/sandshrew.pic",0,1 ; 55, sprite dimensions dw SandshrewPicFront dw SandshrewPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/sandslash.asm b/data/baseStats/sandslash.asm index 30477eb4..e47467ef 100644 --- a/data/baseStats/sandslash.asm +++ b/data/baseStats/sandslash.asm @@ -8,7 +8,7 @@ db GROUND ; species type 1 db GROUND ; species type 2 db 90 ; catch rate db 163 ; base exp yield -INCBIN "pic/bmon/sandslash.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/sandslash.pic",0,1 ; 66, sprite dimensions dw SandslashPicFront dw SandslashPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/scyther.asm b/data/baseStats/scyther.asm index 13de0d2b..ea3f3cba 100644 --- a/data/baseStats/scyther.asm +++ b/data/baseStats/scyther.asm @@ -8,7 +8,7 @@ db BUG ; species type 1 db FLYING ; species type 2 db 45 ; catch rate db 187 ; base exp yield -INCBIN "pic/bmon/scyther.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/scyther.pic",0,1 ; 77, sprite dimensions dw ScytherPicFront dw ScytherPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/seadra.asm b/data/baseStats/seadra.asm index 9f28001b..4f5614af 100644 --- a/data/baseStats/seadra.asm +++ b/data/baseStats/seadra.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db WATER ; species type 2 db 75 ; catch rate db 155 ; base exp yield -INCBIN "pic/bmon/seadra.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/seadra.pic",0,1 ; 66, sprite dimensions dw SeadraPicFront dw SeadraPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/seaking.asm b/data/baseStats/seaking.asm index d4fbe8ea..de983475 100644 --- a/data/baseStats/seaking.asm +++ b/data/baseStats/seaking.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db WATER ; species type 2 db 60 ; catch rate db 170 ; base exp yield -INCBIN "pic/bmon/seaking.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/seaking.pic",0,1 ; 77, sprite dimensions dw SeakingPicFront dw SeakingPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/seel.asm b/data/baseStats/seel.asm index ef9c2898..4a82ad72 100644 --- a/data/baseStats/seel.asm +++ b/data/baseStats/seel.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db WATER ; species type 2 db 190 ; catch rate db 100 ; base exp yield -INCBIN "pic/bmon/seel.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/seel.pic",0,1 ; 66, sprite dimensions dw SeelPicFront dw SeelPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/shellder.asm b/data/baseStats/shellder.asm index 7c2cdf9d..1a4644cb 100644 --- a/data/baseStats/shellder.asm +++ b/data/baseStats/shellder.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db WATER ; species type 2 db 190 ; catch rate db 97 ; base exp yield -INCBIN "pic/bmon/shellder.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/shellder.pic",0,1 ; 55, sprite dimensions dw ShellderPicFront dw ShellderPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/slowbro.asm b/data/baseStats/slowbro.asm index ffeda79e..f471a646 100644 --- a/data/baseStats/slowbro.asm +++ b/data/baseStats/slowbro.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db PSYCHIC ; species type 2 db 75 ; catch rate db 164 ; base exp yield -INCBIN "pic/bmon/slowbro.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/slowbro.pic",0,1 ; 77, sprite dimensions dw SlowbroPicFront dw SlowbroPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/slowpoke.asm b/data/baseStats/slowpoke.asm index ea238a6e..f7a1a510 100644 --- a/data/baseStats/slowpoke.asm +++ b/data/baseStats/slowpoke.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db PSYCHIC ; species type 2 db 190 ; catch rate db 99 ; base exp yield -INCBIN "pic/bmon/slowpoke.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/slowpoke.pic",0,1 ; 55, sprite dimensions dw SlowpokePicFront dw SlowpokePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/snorlax.asm b/data/baseStats/snorlax.asm index 2d1fd6e3..62144d31 100644 --- a/data/baseStats/snorlax.asm +++ b/data/baseStats/snorlax.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db NORMAL ; species type 2 db 25 ; catch rate db 154 ; base exp yield -INCBIN "pic/bmon/snorlax.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/snorlax.pic",0,1 ; 77, sprite dimensions dw SnorlaxPicFront dw SnorlaxPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/spearow.asm b/data/baseStats/spearow.asm index eb8ab1ec..b7d35b3a 100644 --- a/data/baseStats/spearow.asm +++ b/data/baseStats/spearow.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db FLYING ; species type 2 db 255 ; catch rate db 58 ; base exp yield -INCBIN "pic/bmon/spearow.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/spearow.pic",0,1 ; 55, sprite dimensions dw SpearowPicFront dw SpearowPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/squirtle.asm b/data/baseStats/squirtle.asm index f8dcd0a1..1d302a00 100644 --- a/data/baseStats/squirtle.asm +++ b/data/baseStats/squirtle.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db WATER ; species type 2 db 45 ; catch rate db 66 ; base exp yield -INCBIN "pic/bmon/squirtle.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/squirtle.pic",0,1 ; 55, sprite dimensions dw SquirtlePicFront dw SquirtlePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/starmie.asm b/data/baseStats/starmie.asm index 686dfa57..8ef77af8 100644 --- a/data/baseStats/starmie.asm +++ b/data/baseStats/starmie.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db PSYCHIC ; species type 2 db 60 ; catch rate db 207 ; base exp yield -INCBIN "pic/bmon/starmie.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/starmie.pic",0,1 ; 66, sprite dimensions dw StarmiePicFront dw StarmiePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/staryu.asm b/data/baseStats/staryu.asm index 35f51a6a..bc774f42 100644 --- a/data/baseStats/staryu.asm +++ b/data/baseStats/staryu.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db WATER ; species type 2 db 225 ; catch rate db 106 ; base exp yield -INCBIN "pic/bmon/staryu.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/staryu.pic",0,1 ; 66, sprite dimensions dw StaryuPicFront dw StaryuPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/tangela.asm b/data/baseStats/tangela.asm index b50a57bc..8b76bde5 100644 --- a/data/baseStats/tangela.asm +++ b/data/baseStats/tangela.asm @@ -8,12 +8,12 @@ db GRASS ; species type 1 db GRASS ; species type 2 db 45 ; catch rate db 166 ; base exp yield -INCBIN "pic/bmon/tangela.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/tangela.pic",0,1 ; 66, sprite dimensions dw TangelaPicFront dw TangelaPicBack ; attacks known at lvl 0 db CONSTRICT -db BIND +db 0 db 0 db 0 db 0 ; growth rate diff --git a/data/baseStats/tauros.asm b/data/baseStats/tauros.asm index 87f28ec6..ac55ed65 100644 --- a/data/baseStats/tauros.asm +++ b/data/baseStats/tauros.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db NORMAL ; species type 2 db 45 ; catch rate db 211 ; base exp yield -INCBIN "pic/bmon/tauros.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/tauros.pic",0,1 ; 77, sprite dimensions dw TaurosPicFront dw TaurosPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/tentacool.asm b/data/baseStats/tentacool.asm index 7237f083..123d904c 100644 --- a/data/baseStats/tentacool.asm +++ b/data/baseStats/tentacool.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db POISON ; species type 2 db 190 ; catch rate db 105 ; base exp yield -INCBIN "pic/bmon/tentacool.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/tentacool.pic",0,1 ; 55, sprite dimensions dw TentacoolPicFront dw TentacoolPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/tentacruel.asm b/data/baseStats/tentacruel.asm index d3d93919..9c65fe15 100644 --- a/data/baseStats/tentacruel.asm +++ b/data/baseStats/tentacruel.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db POISON ; species type 2 db 60 ; catch rate db 205 ; base exp yield -INCBIN "pic/bmon/tentacruel.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/tentacruel.pic",0,1 ; 66, sprite dimensions dw TentacruelPicFront dw TentacruelPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/vaporeon.asm b/data/baseStats/vaporeon.asm index e22b3185..3d5024b5 100644 --- a/data/baseStats/vaporeon.asm +++ b/data/baseStats/vaporeon.asm @@ -8,12 +8,12 @@ db WATER ; species type 1 db WATER ; species type 2 db 45 ; catch rate db 196 ; base exp yield -INCBIN "pic/bmon/vaporeon.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/vaporeon.pic",0,1 ; 66, sprite dimensions dw VaporeonPicFront dw VaporeonPicBack ; attacks known at lvl 0 db TACKLE -db SAND_ATTACK +db TAIL_WHIP db QUICK_ATTACK db WATER_GUN db 0 ; growth rate diff --git a/data/baseStats/venomoth.asm b/data/baseStats/venomoth.asm index 7a5bd981..6709e42a 100644 --- a/data/baseStats/venomoth.asm +++ b/data/baseStats/venomoth.asm @@ -8,14 +8,14 @@ db BUG ; species type 1 db POISON ; species type 2 db 75 ; catch rate db 138 ; base exp yield -INCBIN "pic/bmon/venomoth.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/venomoth.pic",0,1 ; 77, sprite dimensions dw VenomothPicFront dw VenomothPicBack ; attacks known at lvl 0 db TACKLE db DISABLE -db POISONPOWDER -db LEECH_LIFE +db SUPERSONIC +db CONFUSION db 0 ; growth rate ; learnset tmlearn 2,4,6 @@ -24,5 +24,5 @@ db 0 ; growth rate tmlearn 29,30,31,32 tmlearn 33,34,39 tmlearn 44,46 - tmlearn 50 + tmlearn 50,55 db 0 ; padding diff --git a/data/baseStats/venonat.asm b/data/baseStats/venonat.asm index aeadc6cd..ef3db9a1 100644 --- a/data/baseStats/venonat.asm +++ b/data/baseStats/venonat.asm @@ -8,7 +8,7 @@ db BUG ; species type 1 db POISON ; species type 2 db 190 ; catch rate db 75 ; base exp yield -INCBIN "pic/bmon/venonat.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/venonat.pic",0,1 ; 55, sprite dimensions dw VenonatPicFront dw VenonatPicBack ; attacks known at lvl 0 @@ -24,5 +24,5 @@ db 0 ; growth rate tmlearn 29,31,32 tmlearn 33,34 tmlearn 44,46 - tmlearn 50 + tmlearn 50,55 db 0 ; padding diff --git a/data/baseStats/venusaur.asm b/data/baseStats/venusaur.asm index 0a457321..d3725735 100644 --- a/data/baseStats/venusaur.asm +++ b/data/baseStats/venusaur.asm @@ -8,7 +8,7 @@ db GRASS ; species type 1 db POISON ; species type 2 db 45 ; catch rate db 208 ; base exp yield -INCBIN "pic/bmon/venusaur.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/venusaur.pic",0,1 ; 77, sprite dimensions dw VenusaurPicFront dw VenusaurPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/victreebel.asm b/data/baseStats/victreebel.asm index a56958ef..685ece60 100644 --- a/data/baseStats/victreebel.asm +++ b/data/baseStats/victreebel.asm @@ -8,7 +8,7 @@ db GRASS ; species type 1 db POISON ; species type 2 db 45 ; catch rate db 191 ; base exp yield -INCBIN "pic/bmon/victreebel.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/victreebel.pic",0,1 ; 77, sprite dimensions dw VictreebelPicFront dw VictreebelPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/vileplume.asm b/data/baseStats/vileplume.asm index 17bb9739..ed463650 100644 --- a/data/baseStats/vileplume.asm +++ b/data/baseStats/vileplume.asm @@ -8,7 +8,7 @@ db GRASS ; species type 1 db POISON ; species type 2 db 45 ; catch rate db 184 ; base exp yield -INCBIN "pic/bmon/vileplume.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/vileplume.pic",0,1 ; 77, sprite dimensions dw VileplumePicFront dw VileplumePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/voltorb.asm b/data/baseStats/voltorb.asm index 92d2ccb3..ffd12992 100644 --- a/data/baseStats/voltorb.asm +++ b/data/baseStats/voltorb.asm @@ -8,7 +8,7 @@ db ELECTRIC ; species type 1 db ELECTRIC ; species type 2 db 190 ; catch rate db 103 ; base exp yield -INCBIN "pic/bmon/voltorb.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/voltorb.pic",0,1 ; 55, sprite dimensions dw VoltorbPicFront dw VoltorbPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/vulpix.asm b/data/baseStats/vulpix.asm index 9577ae30..b67b9bbd 100644 --- a/data/baseStats/vulpix.asm +++ b/data/baseStats/vulpix.asm @@ -8,7 +8,7 @@ db FIRE ; species type 1 db FIRE ; species type 2 db 190 ; catch rate db 63 ; base exp yield -INCBIN "pic/bmon/vulpix.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/vulpix.pic",0,1 ; 66, sprite dimensions dw VulpixPicFront dw VulpixPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/wartortle.asm b/data/baseStats/wartortle.asm index bc86bd6f..daf85dc6 100644 --- a/data/baseStats/wartortle.asm +++ b/data/baseStats/wartortle.asm @@ -8,7 +8,7 @@ db WATER ; species type 1 db WATER ; species type 2 db 45 ; catch rate db 143 ; base exp yield -INCBIN "pic/bmon/wartortle.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/wartortle.pic",0,1 ; 66, sprite dimensions dw WartortlePicFront dw WartortlePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/weedle.asm b/data/baseStats/weedle.asm index 8370dc41..44ca5c2c 100644 --- a/data/baseStats/weedle.asm +++ b/data/baseStats/weedle.asm @@ -8,7 +8,7 @@ db BUG ; species type 1 db POISON ; species type 2 db 255 ; catch rate db 52 ; base exp yield -INCBIN "pic/bmon/weedle.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/weedle.pic",0,1 ; 55, sprite dimensions dw WeedlePicFront dw WeedlePicBack ; attacks known at lvl 0 diff --git a/data/baseStats/weepinbell.asm b/data/baseStats/weepinbell.asm index 735a453f..0ac287f8 100644 --- a/data/baseStats/weepinbell.asm +++ b/data/baseStats/weepinbell.asm @@ -8,7 +8,7 @@ db GRASS ; species type 1 db POISON ; species type 2 db 120 ; catch rate db 151 ; base exp yield -INCBIN "pic/bmon/weepinbell.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/weepinbell.pic",0,1 ; 66, sprite dimensions dw WeepinbellPicFront dw WeepinbellPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/weezing.asm b/data/baseStats/weezing.asm index 0dd09dfe..089ef495 100644 --- a/data/baseStats/weezing.asm +++ b/data/baseStats/weezing.asm @@ -8,7 +8,7 @@ db POISON ; species type 1 db POISON ; species type 2 db 60 ; catch rate db 173 ; base exp yield -INCBIN "pic/bmon/weezing.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/weezing.pic",0,1 ; 77, sprite dimensions dw WeezingPicFront dw WeezingPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/wigglytuff.asm b/data/baseStats/wigglytuff.asm index d5fd08e2..815b1244 100644 --- a/data/baseStats/wigglytuff.asm +++ b/data/baseStats/wigglytuff.asm @@ -8,7 +8,7 @@ db NORMAL ; species type 1 db NORMAL ; species type 2 db 50 ; catch rate db 109 ; base exp yield -INCBIN "pic/bmon/wigglytuff.pic",0,1 ; 66, sprite dimensions +INCBIN "pic/ymon/wigglytuff.pic",0,1 ; 66, sprite dimensions dw WigglytuffPicFront dw WigglytuffPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/zapdos.asm b/data/baseStats/zapdos.asm index 487052ba..b7befb99 100644 --- a/data/baseStats/zapdos.asm +++ b/data/baseStats/zapdos.asm @@ -8,7 +8,7 @@ db ELECTRIC ; species type 1 db FLYING ; species type 2 db 3 ; catch rate db 216 ; base exp yield -INCBIN "pic/bmon/zapdos.pic",0,1 ; 77, sprite dimensions +INCBIN "pic/ymon/zapdos.pic",0,1 ; 77, sprite dimensions dw ZapdosPicFront dw ZapdosPicBack ; attacks known at lvl 0 diff --git a/data/baseStats/zubat.asm b/data/baseStats/zubat.asm index 1caa4259..7ddad05c 100644 --- a/data/baseStats/zubat.asm +++ b/data/baseStats/zubat.asm @@ -8,7 +8,7 @@ db POISON ; species type 1 db FLYING ; species type 2 db 255 ; catch rate db 54 ; base exp yield -INCBIN "pic/bmon/zubat.pic",0,1 ; 55, sprite dimensions +INCBIN "pic/ymon/zubat.pic",0,1 ; 55, sprite dimensions dw ZubatPicFront dw ZubatPicBack ; attacks known at lvl 0 diff --git a/data/base_stats.asm b/data/base_stats.asm index a84693a4..23e85e0f 100755 --- a/data/base_stats.asm +++ b/data/base_stats.asm @@ -148,3 +148,4 @@ INCLUDE "data/baseStats/dratini.asm" INCLUDE "data/baseStats/dragonair.asm" INCLUDE "data/baseStats/dragonite.asm" INCLUDE "data/baseStats/mewtwo.asm" +INCLUDE "data/baseStats/mew.asm" diff --git a/data/bg_map_attributes.asm b/data/bg_map_attributes.asm new file mode 100644 index 00000000..81535e72 --- /dev/null +++ b/data/bg_map_attributes.asm @@ -0,0 +1,506 @@ +BGMapAttributes_Unknown1: + db $23 + dw $000d + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00,$00,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + +BGMapAttributes_Unknown2: + db $23 + dw $000d + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + +BGMapAttributes_GameFreakIntro: + db $23 + dw $000d + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$01,$01,$01,$02,$02,$00,$00,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$01,$01,$01,$02,$02,$00,$00,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$01,$01,$01,$02,$02,$00,$00,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + +BGMapAttributes_TrainerCard: + db $23 + dw $000d + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$01,$01,$00,$00,$03,$03,$00,$00,$00,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$01,$01,$00,$00,$03,$03,$00,$01,$01,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$02,$02,$00,$00,$03,$03,$00,$00,$02,$02,$00,$00,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$02,$02,$00,$00,$03,$03,$00,$00,$02,$02,$00,$00,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + +BGMapAttributes_PartyMenu: + db $23 + dw $000d + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $01,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$00,$00,$01,$01,$00,$00,$00,$00,$00,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$00,$00,$01,$01,$00,$00,$00,$00,$00,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$00,$00,$01,$01,$00,$00,$00,$00,$00,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$00,$00,$01,$01,$00,$00,$00,$00,$00,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$00,$00,$01,$01,$00,$00,$00,$00,$00,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$00,$00,$01,$01,$00,$00,$00,$00,$00,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + +BGMapAttributes_NidorinoIntro: + db $23 + dw $000d + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + +BGMapAttributes_TitleScreen: + db $23 + dw $024d + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 +; vBGMap1 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + +BGMapAttributes_Slots: + db $23 + dw $000d + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $03,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$03,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $03,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$03,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + +BGMapAttributes_Pokedex: + db $23 + dw $000d + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + +BGMapAttributes_StatusScreen: + db $23 + dw $000d + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + +BGMapAttributes_Battle: + db $23 + dw $000d + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$03,$03,$03,$03,$03,$03,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$03,$03,$03,$03,$03,$03,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$03,$03,$03,$03,$03,$03,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$03,$03,$03,$03,$03,$03,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$03,$03,$03,$03,$03,$03,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$03,$03,$03,$03,$03,$03,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$03,$03,$03,$03,$03,$03,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + +BGMapAttributes_WholeScreen: + db $3f + dw $000d + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + +BGMapAttributes_Unknown13: + db $23 + dw $024d + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00 + db $00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$03,$03,$03,$03,$03,$03,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$03,$03,$03,$03,$03,$03,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$03,$03,$03,$03,$03,$03,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$03,$03,$03,$03,$03,$03,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$03,$03,$03,$03,$03,$03,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$03,$03,$03,$03,$03,$03,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$03,$03,$03,$03,$03,$03,$03,$03,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 +; vBGMap1 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 diff --git a/data/collision.asm b/data/collision.asm index 78579242..8d35793d 100644 --- a/data/collision.asm +++ b/data/collision.asm @@ -22,3 +22,4 @@ Lab_Coll:: INCBIN "gfx/tilesets/lab.tilecoll" Club_Coll:: INCBIN "gfx/tilesets/club.tilecoll" Facility_Coll:: INCBIN "gfx/tilesets/facility.tilecoll" Plateau_Coll:: INCBIN "gfx/tilesets/plateau.tilecoll" +BeachHouse_Coll:: INCBIN "gfx/tilesets/beachhouse.tilecoll" diff --git a/data/credit_mons.asm b/data/credit_mons.asm index 23142f9f..15212048 100755 --- a/data/credit_mons.asm +++ b/data/credit_mons.asm @@ -14,3 +14,7 @@ CreditsMons: db VILEPLUME db NIDOKING db PARASECT + +rept 9 + db GENGAR +endr diff --git a/data/credits_order.asm b/data/credits_order.asm index 20b9137f..c818ac07 100755 --- a/data/credits_order.asm +++ b/data/credits_order.asm @@ -2,38 +2,37 @@ CreditsOrder: ; subsequent credits elements will be displayed on separate lines. ; $FF, $FE, $FD, $FC, $FB, and $FA are commands that are used ; to go to the next set of credits texts. - db CRED_MON, CRED_VERSION, $FF - db CRED_DIRECTOR, CRED_TAJIRI, $FF - db CRED_PROGRAMMERS, CRED_TA_OOTA, CRED_MORIMOTO, $FD - db CRED_PROGRAMMERS, CRED_WATANABE, CRED_MASUDE, CRED_TAMADA, $FE - db CRED_CHAR_DESIGN, CRED_SUGIMORI, CRED_NISHIDA, $FF - db CRED_MUSIC, CRED_MASUDE, $FD - db CRED_SOUND_EFFECTS, CRED_MASUDE, $FE - db CRED_GAME_DESIGN, CRED_TAJIRI, $FF - db CRED_MONSTER_DESIGN, CRED_SUGIMORI, CRED_NISHIDA, CRED_FUZIWARA, $FD - db CRED_MONSTER_DESIGN, CRED_MORIMOTO, CRED_SA_OOTA, CRED_YOSHIKAWA, $FE - db CRED_GAME_SCENE, CRED_TAJIRI, $FD - db CRED_GAME_SCENE, CRED_TANIGUCHI, CRED_NONOMURA, CRED_ZINNAI, $FE - db CRED_PARAM, CRED_NISINO, CRED_TA_NAKAMURA, $FF - db CRED_MAP, CRED_TAJIRI, CRED_NISINO, $FD - db CRED_MAP, CRED_MATSUSIMA, CRED_NONOMURA, CRED_TANIGUCHI, $FE - db CRED_TEST, CRED_KAKEI, CRED_TSUCHIYA, $FD - db CRED_TEST, CRED_TA_NAKAMURA, CRED_YUDA, $FE - db CRED_SPECIAL, CRED_HISHIDA, CRED_SAKAI, $FD - db CRED_SPECIAL, CRED_YAMAGUCHI, CRED_YAMAMOTO, $FC - db CRED_SPECIAL, CRED_TOMISAWA, CRED_KAWAMOTO, CRED_TO_OOTA, $FE - db CRED_PRODUCERS, CRED_MIYAMOTO, $FD - db CRED_PRODUCERS, CRED_KAWAGUCHI, $FC - db CRED_PRODUCERS, CRED_ISHIHARA, $FE - db CRED_US_STAFF, $FD - db CRED_US_COORD, CRED_TILDEN, $FD - db CRED_US_COORD, CRED_KAWAKAMI, CRED_HI_NAKAMURA, $FC - db CRED_US_COORD, CRED_GIESE, CRED_OSBORNE, $FC - db CRED_TRANS, CRED_OGASAWARA, $FD - db CRED_PROGRAMMERS, CRED_MURAKAWA, CRED_FUKUI, $FD - db CRED_SPECIAL, CRED_IWATA, $FD - db CRED_SPECIAL, CRED_HARADA, $FC - db CRED_TEST, CRED_PAAD, CRED_CLUB, $FD - db CRED_PRODUCER, CRED_IZUSHI, $FD - db CRED_EXECUTIVE, CRED_YAMAUCHI, $FF - db $FB, $FF, $FA + db CRED_POKEMON, CRED_VERSION, CRED_TEXT_FADE_MON + db CRED_DIRECTOR, CRED_TAJIRI, CRED_TEXT_FADE_MON + db CRED_PROGRAMMERS, CRED_OOTA, CRED_MORIMOTO, CRED_WATANABE, CRED_TEXT_FADE + db CRED_PROGRAMMERS, CRED_MASUDA, CRED_TAMADA, CRED_TEXT_MON + db CRED_CHARACTER_DESIGN, CRED_SUGIMORI, CRED_NISHIDA, CRED_TEXT_FADE_MON + db CRED_MUSIC, CRED_MASUDA, CRED_TEXT_FADE + db CRED_SOUND_EFFECTS, CRED_MASUDA, CRED_WATANABE, CRED_TEXT_MON + db CRED_GAME_DESIGN, CRED_TAJIRI, CRED_NISHINO, CRED_TEXT_FADE_MON + db CRED_MONSTER_DESIGN, CRED_SUGIMORI, CRED_NISHIDA, CRED_YOSHIDA, CRED_TEXT_FADE_MON + db CRED_GAME_SCENARIO, CRED_TAJIRI, CRED_TEXT_FADE + db CRED_GAME_SCENARIO, CRED_MATSUMITA, CRED_TEXT_MON + db CRED_PARAMETRIC_DESIGN, CRED_NISHINO, CRED_TEXT_FADE_MON + db CRED_MAP_DESIGN, CRED_TAJIRI, CRED_NISHINO, CRED_SEYA, CRED_TEXT_FADE_MON + db CRED_TESTING, CRED_SEKINE, CRED_SEYA, CRED_TEXT_FADE + db CRED_TESTING, CRED_SHIMAMURA, CRED_SHIMOYAMADA, CRED_TEXT_MON + db CRED_SPECIAL_THANKS, CRED_SHOGAKUKAN, CRED_TEXT_FADE_MON + db CRED_PIKACHU_VOICE, CRED_OOTANI, CRED_TEXT_FADE_MON + db CRED_PRODUCER, CRED_IZUSHI, CRED_TEXT_FADE + db CRED_PRODUCER, CRED_KAWAGUCHI, CRED_TEXT + db CRED_PRODUCER, CRED_ISHIHARA, CRED_TEXT_MON + db CRED_U_S_STAFF, CRED_TEXT_FADE + db CRED_U_S_COORD, CRED_TILDEN, CRED_TEXT_FADE + db CRED_U_S_COORD, CRED_KAWAKAMI, CRED_NAKAMURA2, CRED_TEXT + db CRED_U_S_COORD, CRED_SHOEMAKE, CRED_OSBORNE, CRED_TEXT + db CRED_TRANSLATION, CRED_OGASAWARA, CRED_TEXT_FADE + db CRED_PROGRAMMERS, CRED_MURAKAWA, CRED_FUKUI, CRED_TEXT_FADE + db CRED_CHARACTER_DESIGN, CRED_HOSOKAWA, CRED_TEXT_FADE + db CRED_SPECIAL_THANKS, CRED_OKUBO, CRED_HARADA2, CRED_TEXT_FADE + db CRED_SPECIAL_THANKS, CRED_NAKAMICHI, CRED_YOSHIMURA, CRED_YAMAZAKI, CRED_TEXT + db CRED_TESTING, CRED_PAAD, CRED_SUPER_MARIO_CLUB2, CRED_TEXT_FADE + db CRED_EXECUTIVE_PRODUCER, CRED_YAMAUCHI, CRED_TEXT_FADE_MON + db CRED_COPYRIGHT + db CRED_TEXT_FADE_MON + db CRED_THE_END diff --git a/data/evos_moves.asm b/data/evos_moves.asm index a668ea3e..d819b916 100755 --- a/data/evos_moves.asm +++ b/data/evos_moves.asm @@ -222,11 +222,11 @@ Mon032_EvosMoves: db 0 ;Learnset db 8,HORN_ATTACK - db 14,POISON_STING - db 21,FOCUS_ENERGY - db 29,FURY_ATTACK - db 36,HORN_DRILL - db 43,DOUBLE_KICK + db 12,DOUBLE_KICK + db 17,POISON_STING + db 23,FOCUS_ENERGY + db 30,FURY_ATTACK + db 38,HORN_DRILL db 0 Mon035_EvosMoves: @@ -275,7 +275,7 @@ Mon034_EvosMoves: db 0 ;Learnset db 8,HORN_ATTACK - db 14,POISON_STING + db 12,DOUBLE_KICK db 23,THRASH db 0 @@ -372,11 +372,11 @@ Mon029_EvosMoves: db 0 ;Learnset db 8,SCRATCH - db 14,POISON_STING - db 21,TAIL_WHIP - db 29,BITE - db 36,FURY_SWIPES - db 43,DOUBLE_KICK + db 12,DOUBLE_KICK + db 17,POISON_STING + db 23,TAIL_WHIP + db 30,BITE + db 38,FURY_SWIPES db 0 Mon031_EvosMoves: @@ -385,7 +385,7 @@ Mon031_EvosMoves: db 0 ;Learnset db 8,SCRATCH - db 14,POISON_STING + db 12,DOUBLE_KICK db 23,BODY_SLAM db 0 @@ -395,6 +395,9 @@ Mon104_EvosMoves: db EV_LEVEL,28,MAROWAK db 0 ;Learnset + db 10,BONE_CLUB + db 13,TAIL_WHIP + db 18,HEADBUTT db 25,LEER db 31,FOCUS_ENERGY db 38,THRASH @@ -509,6 +512,7 @@ Mon123_EvosMoves: db 29,SLASH db 35,SWORDS_DANCE db 42,AGILITY + db 50,WING_ATTACK db 0 Mon120_EvosMoves: @@ -544,6 +548,7 @@ Mon127_EvosMoves: ;Evolutions db 0 ;Learnset + db 21,BIND db 25,SEISMIC_TOSS db 30,GUILLOTINE db 36,FOCUS_ENERGY @@ -557,23 +562,25 @@ Mon114_EvosMoves: ;Evolutions db 0 ;Learnset - db 29,ABSORB + db 24,BIND + db 27,ABSORB + db 29,VINE_WHIP db 32,POISONPOWDER db 36,STUN_SPORE db 39,SLEEP_POWDER db 45,SLAM - db 49,GROWTH + db 48,GROWTH db 0 Mon152_EvosMoves: -;MISSINGNO +;MISSINGNO_1F ;Evolutions db 0 ;Learnset db 0 Mon153_EvosMoves: -;MISSINGNO +;MISSINGNO_20 ;Evolutions db 0 ;Learnset @@ -677,6 +684,7 @@ Mon113_EvosMoves: ;Evolutions db 0 ;Learnset + db 12,DOUBLESLAP db 24,SING db 30,GROWL db 38,MINIMIZE @@ -799,7 +807,7 @@ Mon076_EvosMoves: db 0 Mon154_EvosMoves: -;MISSINGNO +;MISSINGNO_32 ;Evolutions db 0 ;Learnset @@ -819,7 +827,7 @@ Mon126_EvosMoves: db 0 Mon155_EvosMoves: -;MISSINGNO +;MISSINGNO_34 ;Evolutions db 0 ;Learnset @@ -864,7 +872,7 @@ Mon109_EvosMoves: db 0 Mon156_EvosMoves: -;MISSINGNO +;MISSINGNO_38 ;Evolutions db 0 ;Learnset @@ -876,11 +884,13 @@ Mon056_EvosMoves: db EV_LEVEL,28,PRIMEAPE db 0 ;Learnset + db 9,LOW_KICK db 15,KARATE_CHOP db 21,FURY_SWIPES db 27,FOCUS_ENERGY db 33,SEISMIC_TOSS db 39,THRASH + db 45,SCREECH db 0 Mon086_EvosMoves: @@ -922,28 +932,28 @@ Mon128_EvosMoves: db 0 Mon157_EvosMoves: -;MISSINGNO +;MISSINGNO_3D ;Evolutions db 0 ;Learnset db 0 Mon158_EvosMoves: -;MISSINGNO +;MISSINGNO_3E ;Evolutions db 0 ;Learnset db 0 Mon159_EvosMoves: -;MISSINGNO +;MISSINGNO_3F ;Evolutions db 0 ;Learnset db 0 Mon083_EvosMoves: -;FARFETCHD +;FARFETCH_D ;Evolutions db 0 ;Learnset @@ -960,7 +970,9 @@ Mon048_EvosMoves: db EV_LEVEL,31,VENOMOTH db 0 ;Learnset - db 24,POISONPOWDER + db 11,SUPERSONIC + db 19,CONFUSION + db 22,POISONPOWDER db 27,LEECH_LIFE db 30,STUN_SPORE db 35,PSYBEAM @@ -981,21 +993,21 @@ Mon149_EvosMoves: db 0 Mon160_EvosMoves: -;MISSINGNO +;MISSINGNO_43 ;Evolutions db 0 ;Learnset db 0 Mon161_EvosMoves: -;MISSINGNO +;MISSINGNO_44 ;Evolutions db 0 ;Learnset db 0 Mon162_EvosMoves: -;MISSINGNO +;MISSINGNO_45 ;Evolutions db 0 ;Learnset @@ -1106,21 +1118,21 @@ Mon098_EvosMoves: db 0 Mon163_EvosMoves: -;MISSINGNO +;MISSINGNO_4F ;Evolutions db 0 ;Learnset db 0 Mon164_EvosMoves: -;MISSINGNO +;MISSINGNO_50 ;Evolutions db 0 ;Learnset db 0 Mon165_EvosMoves: -;MISSINGNO +;MISSINGNO_51 ;Evolutions db 0 ;Learnset @@ -1152,11 +1164,15 @@ Mon025_EvosMoves: db EV_ITEM,THUNDER_STONE,1,RAICHU db 0 ;Learnset - db 9,THUNDER_WAVE - db 16,QUICK_ATTACK - db 26,SWIFT + db 6,TAIL_WHIP + db 8,THUNDER_WAVE + db 11,QUICK_ATTACK + db 15,DOUBLE_TEAM + db 20,SLAM + db 26,THUNDERBOLT db 33,AGILITY - db 43,THUNDER + db 41,THUNDER + db 50,LIGHT_SCREEN db 0 Mon026_EvosMoves: @@ -1167,14 +1183,14 @@ Mon026_EvosMoves: db 0 Mon166_EvosMoves: -;MISSINGNO +;MISSINGNO_56 ;Evolutions db 0 ;Learnset db 0 Mon167_EvosMoves: -;MISSINGNO +;MISSINGNO_57 ;Evolutions db 0 ;Learnset @@ -1255,14 +1271,14 @@ Mon117_EvosMoves: db 0 Mon168_EvosMoves: -;MISSINGNO +;MISSINGNO_5E ;Evolutions db 0 ;Learnset db 0 Mon169_EvosMoves: -;MISSINGNO +;MISSINGNO_5F ;Evolutions db 0 ;Learnset @@ -1345,12 +1361,13 @@ Mon133_EvosMoves: db EV_ITEM,THUNDER_STONE,1,JOLTEON db EV_ITEM,WATER_STONE,1,VAPOREON db 0 -Mon133_EvosEnd: ;Learnset - db 27,QUICK_ATTACK - db 31,TAIL_WHIP - db 37,BITE - db 45,TAKE_DOWN + db 8,SAND_ATTACK + db 16,GROWL + db 23,QUICK_ATTACK + db 30,BITE + db 36,FOCUS_ENERGY + db 42,TAKE_DOWN db 0 Mon136_EvosMoves: @@ -1358,14 +1375,14 @@ Mon136_EvosMoves: ;Evolutions db 0 ;Learnset - db 27,QUICK_ATTACK - db 31,EMBER - db 37,TAIL_WHIP - db 40,BITE - db 42,LEER - db 44,FIRE_SPIN - db 48,RAGE - db 54,FLAMETHROWER + db 8,SAND_ATTACK + db 16,EMBER + db 23,QUICK_ATTACK + db 30,BITE + db 36,FIRE_SPIN + db 42,SMOG + db 47,LEER + db 52,FLAMETHROWER db 0 Mon135_EvosMoves: @@ -1373,14 +1390,14 @@ Mon135_EvosMoves: ;Evolutions db 0 ;Learnset - db 27,QUICK_ATTACK - db 31,THUNDERSHOCK - db 37,TAIL_WHIP - db 40,THUNDER_WAVE - db 42,DOUBLE_KICK - db 44,AGILITY - db 48,PIN_MISSILE - db 54,THUNDER + db 8,SAND_ATTACK + db 16,THUNDERSHOCK + db 23,QUICK_ATTACK + db 30,DOUBLE_KICK + db 36,PIN_MISSILE + db 42,THUNDER_WAVE + db 47,AGILITY + db 52,THUNDER db 0 Mon134_EvosMoves: @@ -1388,14 +1405,15 @@ Mon134_EvosMoves: ;Evolutions db 0 ;Learnset - db 27,QUICK_ATTACK - db 31,WATER_GUN - db 37,TAIL_WHIP - db 40,BITE - db 42,ACID_ARMOR - db 44,HAZE - db 48,MIST - db 54,HYDRO_PUMP + db 8,SAND_ATTACK + db 16,WATER_GUN + db 23,QUICK_ATTACK + db 30,BITE + db 36,AURORA_BEAM + db 42,HAZE + db 42,MIST + db 47,ACID_ARMOR + db 52,HYDRO_PUMP db 0 Mon066_EvosMoves: @@ -1503,7 +1521,7 @@ Mon015_EvosMoves: db 0 Mon170_EvosMoves: -;MISSINGNO +;MISSINGNO_73 ;Evolutions db 0 ;Learnset @@ -1527,11 +1545,14 @@ Mon057_EvosMoves: ;Evolutions db 0 ;Learnset + db 9,LOW_KICK db 15,KARATE_CHOP db 21,FURY_SWIPES db 27,FOCUS_ENERGY + db 28,RAGE db 37,SEISMIC_TOSS db 46,THRASH + db 45,SCREECH db 0 Mon051_EvosMoves: @@ -1551,7 +1572,7 @@ Mon049_EvosMoves: ;Evolutions db 0 ;Learnset - db 24,POISONPOWDER + db 22,POISONPOWDER db 27,LEECH_LIFE db 30,STUN_SPORE db 38,PSYBEAM @@ -1572,14 +1593,14 @@ Mon087_EvosMoves: db 0 Mon171_EvosMoves: -;MISSINGNO +;MISSINGNO_79 ;Evolutions db 0 ;Learnset db 0 Mon172_EvosMoves: -;MISSINGNO +;MISSINGNO_7A ;Evolutions db 0 ;Learnset @@ -1599,6 +1620,7 @@ Mon011_EvosMoves: db EV_LEVEL,10,BUTTERFREE db 0 ;Learnset + db 7,HARDEN db 0 Mon012_EvosMoves: @@ -1606,13 +1628,14 @@ Mon012_EvosMoves: ;Evolutions db 0 ;Learnset - db 12,CONFUSION - db 15,POISONPOWDER - db 16,STUN_SPORE - db 17,SLEEP_POWDER - db 21,SUPERSONIC - db 26,WHIRLWIND - db 32,PSYBEAM + db 10,CONFUSION + db 13,POISONPOWDER + db 14,STUN_SPORE + db 15,SLEEP_POWDER + db 18,SUPERSONIC + db 23,WHIRLWIND + db 28,GUST + db 34,PSYBEAM db 0 Mon068_EvosMoves: @@ -1628,7 +1651,7 @@ Mon068_EvosMoves: db 0 Mon173_EvosMoves: -;MISSINGNO +;MISSINGNO_7F ;Evolutions db 0 ;Learnset @@ -1704,14 +1727,14 @@ Mon129_EvosMoves: db 0 Mon174_EvosMoves: -;MISSINGNO +;MISSINGNO_86 ;Evolutions db 0 ;Learnset db 0 Mon175_EvosMoves: -;MISSINGNO +;MISSINGNO_87 ;Evolutions db 0 ;Learnset @@ -1731,7 +1754,7 @@ Mon089_EvosMoves: db 0 Mon176_EvosMoves: -;MISSINGNO +;MISSINGNO_8A ;Evolutions db 0 ;Learnset @@ -1758,7 +1781,7 @@ Mon091_EvosMoves: db 0 Mon177_EvosMoves: -;MISSINGNO +;MISSINGNO_8C ;Evolutions db 0 ;Learnset @@ -1812,6 +1835,9 @@ Mon105_EvosMoves: ;Evolutions db 0 ;Learnset + db 10,BONE_CLUB + db 13,TAIL_WHIP + db 18,HEADBUTT db 25,LEER db 33,FOCUS_ENERGY db 41,THRASH @@ -1820,7 +1846,7 @@ Mon105_EvosMoves: db 0 Mon178_EvosMoves: -;MISSINGNO +;MISSINGNO_92 ;Evolutions db 0 ;Learnset @@ -1936,7 +1962,7 @@ Mon073_EvosMoves: db 0 Mon179_EvosMoves: -;MISSINGNO +;MISSINGNO_9C ;Evolutions db 0 ;Learnset @@ -1970,28 +1996,28 @@ Mon119_EvosMoves: db 0 Mon180_EvosMoves: -;MISSINGNO +;MISSINGNO_9F ;Evolutions db 0 ;Learnset db 0 Mon181_EvosMoves: -;MISSINGNO +;MISSINGNO_A0 ;Evolutions db 0 ;Learnset db 0 Mon182_EvosMoves: -;MISSINGNO +;MISSINGNO_A1 ;Evolutions db 0 ;Learnset db 0 Mon183_EvosMoves: -;MISSINGNO +;MISSINGNO_A2 ;Evolutions db 0 ;Learnset @@ -2054,11 +2080,11 @@ Mon033_EvosMoves: db 0 ;Learnset db 8,HORN_ATTACK - db 14,POISON_STING - db 23,FOCUS_ENERGY - db 32,FURY_ATTACK - db 41,HORN_DRILL - db 50,DOUBLE_KICK + db 12,DOUBLE_KICK + db 19,POISON_STING + db 27,FOCUS_ENERGY + db 36,FURY_ATTACK + db 46,HORN_DRILL db 0 Mon030_EvosMoves: @@ -2068,11 +2094,11 @@ Mon030_EvosMoves: db 0 ;Learnset db 8,SCRATCH - db 14,POISON_STING - db 23,TAIL_WHIP - db 32,BITE - db 41,FURY_SWIPES - db 50,DOUBLE_KICK + db 12,DOUBLE_KICK + db 19,POISON_STING + db 27,TAIL_WHIP + db 36,BITE + db 46,FURY_SWIPES db 0 Mon074_EvosMoves: @@ -2112,7 +2138,7 @@ Mon142_EvosMoves: db 0 Mon184_EvosMoves: -;MISSINGNO +;MISSINGNO_AC ;Evolutions db 0 ;Learnset @@ -2133,14 +2159,14 @@ Mon081_EvosMoves: db 0 Mon185_EvosMoves: -;MISSINGNO +;MISSINGNO_AE ;Evolutions db 0 ;Learnset db 0 Mon186_EvosMoves: -;MISSINGNO +;MISSINGNO_AF ;Evolutions db 0 ;Learnset @@ -2216,28 +2242,28 @@ Mon006_EvosMoves: db 0 Mon187_EvosMoves: -;MISSINGNO +;MISSINGNO_B5 ;Evolutions db 0 ;Learnset db 0 Mon188_EvosMoves: -;MISSINGNO +;FOSSIL_KABUTOPS ;Evolutions db 0 ;Learnset db 0 Mon189_EvosMoves: -;MISSINGNO +;FOSSIL_AERODACTYL ;Evolutions db 0 ;Learnset db 0 Mon190_EvosMoves: -;MISSINGNO +;MON_GHOST ;Evolutions db 0 ;Learnset @@ -2320,3 +2346,4 @@ Mon071_EvosMoves: db 15,POISONPOWDER db 18,SLEEP_POWDER db 0 + diff --git a/data/facing.asm b/data/facing.asm index c412247a..3e965132 100644 --- a/data/facing.asm +++ b/data/facing.asm @@ -1,57 +1,133 @@ SpriteFacingAndAnimationTable: - dw SpriteFacingDownAndStanding, SpriteOAMParameters ; facing down, walk animation frame 0 - dw SpriteFacingDownAndWalking, SpriteOAMParameters ; facing down, walk animation frame 1 - dw SpriteFacingDownAndStanding, SpriteOAMParameters ; facing down, walk animation frame 2 - dw SpriteFacingDownAndWalking, SpriteOAMParametersFlipped ; facing down, walk animation frame 3 - dw SpriteFacingUpAndStanding, SpriteOAMParameters ; facing up, walk animation frame 0 - dw SpriteFacingUpAndWalking, SpriteOAMParameters ; facing up, walk animation frame 1 - dw SpriteFacingUpAndStanding, SpriteOAMParameters ; facing up, walk animation frame 2 - dw SpriteFacingUpAndWalking, SpriteOAMParametersFlipped ; facing up, walk animation frame 3 - dw SpriteFacingLeftAndStanding, SpriteOAMParameters ; facing left, walk animation frame 0 - dw SpriteFacingLeftAndWalking, SpriteOAMParameters ; facing left, walk animation frame 1 - dw SpriteFacingLeftAndStanding, SpriteOAMParameters ; facing left, walk animation frame 2 - dw SpriteFacingLeftAndWalking, SpriteOAMParameters ; facing left, walk animation frame 3 - dw SpriteFacingLeftAndStanding, SpriteOAMParametersFlipped ; facing right, walk animation frame 0 - dw SpriteFacingLeftAndWalking, SpriteOAMParametersFlipped ; facing right, walk animation frame 1 - dw SpriteFacingLeftAndStanding, SpriteOAMParametersFlipped ; facing right, walk animation frame 2 - dw SpriteFacingLeftAndWalking, SpriteOAMParametersFlipped ; facing right, walk animation frame 3 - dw SpriteFacingDownAndStanding, SpriteOAMParameters ; --- - dw SpriteFacingDownAndStanding, SpriteOAMParameters ; This table is used for sprites $a and $b. - dw SpriteFacingDownAndStanding, SpriteOAMParameters ; All orientation and animation parameters - dw SpriteFacingDownAndStanding, SpriteOAMParameters ; lead to the same result. Used for immobile - dw SpriteFacingDownAndStanding, SpriteOAMParameters ; sprites like items on the ground - dw SpriteFacingDownAndStanding, SpriteOAMParameters ; --- - dw SpriteFacingDownAndStanding, SpriteOAMParameters - dw SpriteFacingDownAndStanding, SpriteOAMParameters - dw SpriteFacingDownAndStanding, SpriteOAMParameters - dw SpriteFacingDownAndStanding, SpriteOAMParameters - dw SpriteFacingDownAndStanding, SpriteOAMParameters - dw SpriteFacingDownAndStanding, SpriteOAMParameters - dw SpriteFacingDownAndStanding, SpriteOAMParameters - dw SpriteFacingDownAndStanding, SpriteOAMParameters - dw SpriteFacingDownAndStanding, SpriteOAMParameters - dw SpriteFacingDownAndStanding, SpriteOAMParameters + dw SpriteFacingDownAndStanding ; facing down, walk animation frame 0 + dw SpriteFacingDownAndWalking ; facing down, walk animation frame 1 + dw SpriteFacingDownAndStanding ; facing down, walk animation frame 2 + dw SpriteFacingDownAndWalking2 ; facing down, walk animation frame 3 + + dw SpriteFacingUpAndStanding ; facing up, walk animation frame 0 + dw SpriteFacingUpAndWalking ; facing up, walk animation frame 1 + dw SpriteFacingUpAndStanding ; facing up, walk animation frame 2 + dw SpriteFacingUpAndWalking2 ; facing up, walk animation frame 3 + + dw SpriteFacingLeftAndStanding ; facing left, walk animation frame 0 + dw SpriteFacingLeftAndWalking ; facing left, walk animation frame 1 + dw SpriteFacingLeftAndStanding ; facing left, walk animation frame 2 + dw SpriteFacingLeftAndWalking ; facing left, walk animation frame 3 + + dw SpriteFacingRightAndStanding ; facing right, walk animation frame 0 + dw SpriteFacingRightAndWalking ; facing right, walk animation frame 1 + dw SpriteFacingRightAndStanding ; facing right, walk animation frame 2 + dw SpriteFacingRightAndWalking ; facing right, walk animation frame 3 + + dw SpriteFacingDownAndStanding ; --- + dw SpriteFacingDownAndStanding ; This table is used for sprites $a and $b. + dw SpriteFacingDownAndStanding ; All orientation and animation parameters + dw SpriteFacingDownAndStanding ; lead to the same result. Used for immobile + dw SpriteFacingDownAndStanding ; sprites like items on the ground + dw SpriteFacingDownAndStanding ; --- + dw SpriteFacingDownAndStanding + dw SpriteFacingDownAndStanding + dw SpriteFacingDownAndStanding + dw SpriteFacingDownAndStanding + dw SpriteFacingDownAndStanding + dw SpriteFacingDownAndStanding + dw SpriteFacingDownAndStanding + dw SpriteFacingDownAndStanding + dw SpriteFacingDownAndStanding + dw SpriteFacingDownAndStanding +; special case + dw SpriteSpecialCase ; pikachu maybe? SpriteFacingDownAndStanding: - db $00,$01,$02,$03 + db $04 +; Sprite OAM Parameters + db $00,$00,$00,$00 ; top left + db $00,$08,$01,$00 ; top right + db $08,$00,$02,OAMFLAG_CANBEMASKED ; bottom left + db $08,$08,$03,OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right + SpriteFacingDownAndWalking: - db $80,$81,$82,$83 + db $04 +; Sprite OAM Parameters + db $00,$00,$80,$00 ; top left + db $00,$08,$81,$00 ; top right + db $08,$00,$82,OAMFLAG_CANBEMASKED ; bottom left + db $08,$08,$83,OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right + +SpriteFacingDownAndWalking2: + db $04 +; Sprite OAM Parameters + db $00,$08,$80,OAMFLAG_VFLIPPED ; top left + db $00,$00,$81,OAMFLAG_VFLIPPED ; top right + db $08,$08,$82,OAMFLAG_VFLIPPED | OAMFLAG_CANBEMASKED ; bottom left + db $08,$00,$83,OAMFLAG_VFLIPPED | OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right + SpriteFacingUpAndStanding: - db $04,$05,$06,$07 + db $04 +; Sprite OAM Parameters + db $00,$00,$04,$00 ; top left + db $00,$08,$05,$00 ; top right + db $08,$00,$06,OAMFLAG_CANBEMASKED ; bottom left + db $08,$08,$07,OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right + SpriteFacingUpAndWalking: - db $84,$85,$86,$87 + db $04 +; Sprite OAM Parameters + db $00,$00,$84,$00 ; top left + db $00,$08,$85,$00 ; top right + db $08,$00,$86,OAMFLAG_CANBEMASKED ; bottom left + db $08,$08,$87,OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right + +SpriteFacingUpAndWalking2: + db $04 +; Sprite OAM Parameters + db $00,$08,$84,OAMFLAG_VFLIPPED ; top left + db $00,$00,$85,OAMFLAG_VFLIPPED ; top right + db $08,$08,$86,OAMFLAG_VFLIPPED | OAMFLAG_CANBEMASKED ; bottom left + db $08,$00,$87,OAMFLAG_VFLIPPED | OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right + SpriteFacingLeftAndStanding: - db $08,$09,$0a,$0b + db $04 +; Sprite OAM Parameters + db $00,$00,$08,$00 ; top left + db $00,$08,$09,$00 ; top right + db $08,$00,$0a,OAMFLAG_CANBEMASKED ; bottom left + db $08,$08,$0b,OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right + SpriteFacingLeftAndWalking: - db $88,$89,$8a,$8b - -SpriteOAMParameters: - db $00,$00, $00 ; top left - db $00,$08, $00 ; top right - db $08,$00, OAMFLAG_CANBEMASKED ; bottom left - db $08,$08, OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right -SpriteOAMParametersFlipped: - db $00,$08, OAMFLAG_VFLIPPED - db $00,$00, OAMFLAG_VFLIPPED - db $08,$08, OAMFLAG_VFLIPPED | OAMFLAG_CANBEMASKED - db $08,$00, OAMFLAG_VFLIPPED | OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA + db $04 +; Sprite OAM Parameters + db $00,$00,$88,$00 ; top left + db $00,$08,$89,$00 ; top right + db $08,$00,$8a,OAMFLAG_CANBEMASKED ; bottom left + db $08,$08,$8b,OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right + +SpriteFacingRightAndStanding: + db $04 +; Sprite OAM Parameters + db $00,$08,$08,OAMFLAG_VFLIPPED ; top left + db $00,$00,$09,OAMFLAG_VFLIPPED ; top right + db $08,$08,$0a,OAMFLAG_VFLIPPED | OAMFLAG_CANBEMASKED ; bottom left + db $08,$00,$0b,OAMFLAG_VFLIPPED | OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right + +SpriteFacingRightAndWalking: + db $04 +; Sprite OAM Parameters + db $00,$08,$88,OAMFLAG_VFLIPPED ; top left + db $00,$00,$89,OAMFLAG_VFLIPPED ; top right + db $08,$08,$8a,OAMFLAG_VFLIPPED | OAMFLAG_CANBEMASKED ; bottom left + db $08,$00,$8b,OAMFLAG_VFLIPPED | OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right + +SpriteSpecialCase ; 40ec (1:40ec) + db $09 +; Sprite OAM Parameters + db -$4,-$4,$00,$00 + db -$4,$04,$01,$00 + db -$4,$0c,$00,OAMFLAG_VFLIPPED + db $04,-$4,$01,$00 + db $04,$04,$02,$00 + db $04,$0c,$01,$00 + db $0c,-$4,$00,OAM_VFLIP | OAMFLAG_CANBEMASKED + db $0c,$04,$01,OAMFLAG_CANBEMASKED + db $0c,$0c,$00,OAM_VFLIP | OAM_HFLIP | OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA + diff --git a/data/hidden_item_coords.asm b/data/hidden_item_coords.asm index 96c4a07b..e94ebf80 100755 --- a/data/hidden_item_coords.asm +++ b/data/hidden_item_coords.asm @@ -1,57 +1,58 @@ HiddenItemCoords: ; map ID, then coords - db VIRIDIAN_FOREST,$12,$01 - db VIRIDIAN_FOREST,$2a,$10 - db MT_MOON_3,$0c,$12 - db ROUTE_25,$03,$26 - db ROUTE_9,$07,$0e - db SS_ANNE_6,$09,$0d - db SS_ANNE_10,$01,$03 - db ROUTE_10,$11,$09 - db ROUTE_10,$35,$10 - db ROCKET_HIDEOUT_1,$0f,$15 - db ROCKET_HIDEOUT_3,$11,$1b - db ROCKET_HIDEOUT_4,$01,$19 - db POKEMONTOWER_5,$0c,$04 - db ROUTE_13,$0e,$01 - db ROUTE_13,$0d,$10 - db MANSION_4,$09,$01 - db SAFARI_ZONE_ENTRANCE,$01,$0a - db SAFARI_ZONE_WEST,$05,$06 - db SILPH_CO_5F,$03,$0c - db SILPH_CO_9F,$0f,$02 - db COPYCATS_HOUSE_2F,$01,$01 - db UNKNOWN_DUNGEON_1,$0b,$0e - db UNKNOWN_DUNGEON_3,$03,$1b - db POWER_PLANT,$10,$11 - db POWER_PLANT,$01,$0c - db SEAFOAM_ISLANDS_3,$0f,$0f - db SEAFOAM_ISLANDS_5,$11,$19 - db MANSION_1,$10,$08 - db MANSION_3,$09,$01 - db ROUTE_23,$2c,$09 - db ROUTE_23,$46,$13 - db ROUTE_23,$5a,$08 - db VICTORY_ROAD_2,$02,$05 - db VICTORY_ROAD_2,$07,$1a - db UNUSED_MAP_6F,$0b,$0e - db VIRIDIAN_CITY,$04,$0e - db ROUTE_11,$05,$30 - db ROUTE_12,$3f,$02 - db ROUTE_17,$0e,$0f - db ROUTE_17,$2d,$08 - db ROUTE_17,$48,$11 - db ROUTE_17,$5b,$04 - db ROUTE_17,$79,$08 - db UNDERGROUND_PATH_NS,$04,$03 - db UNDERGROUND_PATH_NS,$22,$04 - db UNDERGROUND_PATH_WE,$02,$0c - db UNDERGROUND_PATH_WE,$05,$15 - db CELADON_CITY,$0f,$30 - db ROUTE_25,$01,$0a - db MT_MOON_3,$09,$21 - db SEAFOAM_ISLANDS_4,$10,$09 - db VERMILION_CITY,$0b,$0e - db CERULEAN_CITY,$08,$0f - db ROUTE_4,$03,$28 + db SILPH_CO_5F, $03, $0c + db SILPH_CO_9F, $0f, $02 + db MANSION_3, $09, $01 + db MANSION_4, $09, $01 + db SAFARI_ZONE_WEST, $05, $06 + db UNKNOWN_DUNGEON_2, $0d, $10 + db UNKNOWN_DUNGEON_3, $0e, $08 + db UNUSED_MAP_6F, $0b, $0e + db SEAFOAM_ISLANDS_3, $0f, $0f + db SEAFOAM_ISLANDS_4, $10, $09 + db SEAFOAM_ISLANDS_5, $11, $19 + db VIRIDIAN_FOREST, $12, $01 + db VIRIDIAN_FOREST, $2a, $10 + db MT_MOON_3, $0c, $12 + db MT_MOON_3, $09, $21 + db SS_ANNE_10, $01, $03 + db SS_ANNE_6, $09, $0d + db UNDERGROUND_PATH_NS, $04, $03 + db UNDERGROUND_PATH_NS, $22, $04 + db UNDERGROUND_PATH_WE, $02, $0c + db UNDERGROUND_PATH_WE, $05, $15 + db ROCKET_HIDEOUT_1, $0f, $15 + db ROCKET_HIDEOUT_3, $11, $1b + db ROCKET_HIDEOUT_4, $01, $19 + db ROUTE_10, $11, $09 + db ROUTE_10, $35, $10 + db POWER_PLANT, $10, $11 + db POWER_PLANT, $01, $0c + db ROUTE_11, $05, $30 + db ROUTE_12, $3f, $02 + db ROUTE_13, $0e, $01 + db ROUTE_13, $0d, $10 + db ROUTE_17, $0e, $0f + db ROUTE_17, $2d, $08 + db ROUTE_17, $48, $11 + db ROUTE_17, $5b, $04 + db ROUTE_17, $79, $08 + db ROUTE_23, $2c, $09 + db ROUTE_23, $46, $13 + db ROUTE_23, $5a, $08 + db VICTORY_ROAD_2, $02, $05 + db VICTORY_ROAD_2, $07, $1a + db ROUTE_25, $03, $26 + db ROUTE_25, $01, $0a + db ROUTE_4, $03, $28 + db ROUTE_9, $07, $0e + db COPYCATS_HOUSE_2F, $01, $01 + db VIRIDIAN_CITY, $04, $0e + db CERULEAN_CITY, $08, $0f + db UNKNOWN_DUNGEON_1, $07, $12 + db POKEMONTOWER_5, $0c, $04 + db VERMILION_CITY, $0b, $0e + db CELADON_CITY, $0f, $30 + db SAFARI_ZONE_ENTRANCE, $01, $0a + db MANSION_1, $10, $08 db $ff diff --git a/data/hidden_objects.asm b/data/hidden_objects.asm index 43627bfc..7ba90bd3 100755 --- a/data/hidden_objects.asm +++ b/data/hidden_objects.asm @@ -1,853 +1,547 @@ HiddenObjectMaps: - db REDS_HOUSE_2F - db BLUES_HOUSE - db OAKS_LAB - db VIRIDIAN_POKECENTER - db VIRIDIAN_MART - db VIRIDIAN_SCHOOL - db VIRIDIAN_GYM - db MUSEUM_1F - db PEWTER_GYM - db PEWTER_MART - db PEWTER_POKECENTER - db CERULEAN_POKECENTER - db CERULEAN_GYM - db CERULEAN_MART - db LAVENDER_POKECENTER - db VERMILION_POKECENTER - db VERMILION_GYM - db CELADON_MANSION_2 - db CELADON_POKECENTER - db CELADON_GYM - db GAME_CORNER - db CELADON_HOTEL - db FUCHSIA_POKECENTER - db FUCHSIA_GYM - db CINNABAR_GYM - db CINNABAR_POKECENTER - db SAFFRON_GYM - db MT_MOON_POKECENTER - db ROCK_TUNNEL_POKECENTER - db TRADE_CENTER - db COLOSSEUM - db VIRIDIAN_FOREST - db MT_MOON_3 - db INDIGO_PLATEAU - db ROUTE_25 - db ROUTE_9 - db SS_ANNE_6 - db SS_ANNE_10 - db ROCKET_HIDEOUT_1 - db ROCKET_HIDEOUT_3 - db ROCKET_HIDEOUT_4 - db SAFFRON_POKECENTER - db POKEMONTOWER_5 - db ROUTE_13 - db SAFARI_ZONE_ENTRANCE - db SAFARI_ZONE_WEST - db SILPH_CO_5F - db SILPH_CO_9F - db COPYCATS_HOUSE_2F - db UNKNOWN_DUNGEON_1 - db UNKNOWN_DUNGEON_3 - db POWER_PLANT - db SEAFOAM_ISLANDS_3 - db SEAFOAM_ISLANDS_5 - db MANSION_1 - db MANSION_3 - db ROUTE_23 - db VICTORY_ROAD_2 - db $6F - db BILLS_HOUSE - db VIRIDIAN_CITY - db SAFARI_ZONE_REST_HOUSE_2 - db SAFARI_ZONE_REST_HOUSE_3 - db SAFARI_ZONE_REST_HOUSE_4 - db ROUTE_15_GATE_2F - db LAVENDER_HOUSE_1 - db CELADON_MANSION_5 - db FIGHTING_DOJO - db ROUTE_10 - db INDIGO_PLATEAU_LOBBY - db CINNABAR_LAB_4 - db BIKE_SHOP - db ROUTE_11 - db ROUTE_12 - db MANSION_2 - db MANSION_4 - db SILPH_CO_11F - db ROUTE_17 - db UNDERGROUND_PATH_NS - db UNDERGROUND_PATH_WE - db CELADON_CITY - db SEAFOAM_ISLANDS_4 - db VERMILION_CITY - db CERULEAN_CITY - db ROUTE_4 - db $FF - -HiddenObjectPointers: -; each of these pointers is for the corresponding map in HiddenObjectMaps - dw RedsHouse2FHiddenObjects - dw BluesHouseHiddenObjects - dw OaksLabHiddenObjects - dw ViridianPokecenterHiddenObjects - dw ViridianMartHiddenObjects - dw ViridianSchoolHiddenObjects - dw ViridianGymHiddenObjects - dw Museum1FHiddenObjects - dw PewterGymHiddenObjects - dw PewterMartHiddenObjects - dw PewterPokecenterHiddenObjects - dw CeruleanPokecenterHiddenObjects - dw CeruleanGymHiddenObjects - dw CeruleanMartHiddenObjects - dw LavenderPokecenterHiddenObjects - dw VermilionPokecenterHiddenObjects - dw VermilionGymHiddenObjects - dw CeladonMansion2HiddenObjects - dw CeladonPokecenterHiddenObjects - dw CeladonGymHiddenObjects - dw GameCornerHiddenObjects - dw CeladonHotelHiddenObjects - dw FuchsiaPokecenterHiddenObjects - dw FuchsiaGymHiddenObjects - dw CinnabarGymHiddenObjects - dw CinnabarPokecenterHiddenObjects - dw SaffronGymHiddenObjects - dw MtMoonPokecenterHiddenObjects - dw RockTunnelPokecenterHiddenObjects - dw TradeCenterHiddenObjects - dw ColosseumHiddenObjects - dw ViridianForestHiddenObjects - dw MtMoon3HiddenObjects - dw IndigoPlateauHiddenObjects - dw Route25HiddenObjects - dw Route9HiddenObjects - dw SSAnne6HiddenObjects - dw SSAnne10HiddenObjects - dw RocketHideout1HiddenObjects - dw RocketHideout3HiddenObjects - dw RocketHideout4HiddenObjects - dw SaffronPokecenterHiddenObjects - dw PokemonTower5HiddenObjects - dw Route13HiddenObjects - dw SafariZoneEntranceHiddenObjects - dw SafariZoneWestHiddenObjects - dw SilphCo5FHiddenObjects - dw SilphCo9FHiddenObjects - dw CopycatsHouse2FHiddenObjects - dw UnknownDungeon1HiddenObjects - dw UnknownDungeon3HiddenObjects - dw PowerPlantHiddenObjects - dw SeafoamIslands3HiddenObjects - dw SeafoamIslands5HiddenObjects - dw Mansion1HiddenObjects - dw Mansion3HiddenObjects - dw Route23HiddenObjects - dw VictoryRoad2HiddenObjects - dw Unused6FHiddenObjects - dw BillsHouseHiddenObjects - dw ViridianCityHiddenObjects - dw SafariZoneRestHouse2HiddenObjects - dw SafariZoneRestHouse3HiddenObjects - dw SafariZoneRestHouse4HiddenObjects - dw Route15GateUpstairsHiddenObjects - dw LavenderHouse1HiddenObjects - dw CeladonMansion5HiddenObjects - dw FightingDojoHiddenObjects - dw Route10HiddenObjects - dw IndigoPlateauLobbyHiddenObjects - dw CinnabarLab4HiddenObjects - dw BikeShopHiddenObjects - dw Route11HiddenObjects - dw Route12HiddenObjects - dw Mansion2HiddenObjects - dw Mansion4HiddenObjects - dw SilphCo11FHiddenObjects - dw Route17HiddenObjects - dw UndergroundPathNsHiddenObjects - dw UndergroundPathWeHiddenObjects - dw CeladonCityHiddenObjects - dw SeafoamIslands4HiddenObjects - dw VermilionCityHiddenObjects - dw CeruleanCityHiddenObjects - dw Route4HiddenObjects + dbw SILPH_CO_11F, SilphCo11FHiddenObjects + dbw SILPH_CO_5F, SilphCo5FHiddenObjects + dbw SILPH_CO_9F, SilphCo9FHiddenObjects + dbw MANSION_2, Mansion2HiddenObjects + dbw MANSION_3, Mansion3HiddenObjects + dbw MANSION_4, Mansion4HiddenObjects + dbw SAFARI_ZONE_WEST, SafariZoneWestHiddenObjects + dbw UNKNOWN_DUNGEON_2, UnknownDungeon2HiddenObjects + dbw UNKNOWN_DUNGEON_3, UnknownDungeon3HiddenObjects + dbw UNUSED_MAP_6F, UnusedMap6FHiddenObjects + dbw SEAFOAM_ISLANDS_3, SeafoamIslands3HiddenObjects + dbw SEAFOAM_ISLANDS_4, SeafoamIslands4HiddenObjects + dbw SEAFOAM_ISLANDS_5, SeafoamIslands5HiddenObjects + dbw VIRIDIAN_FOREST, ViridianForestHiddenObjects + dbw MT_MOON_3, MtMoon3HiddenObjects + dbw SS_ANNE_10, SSAnne10HiddenObjects + dbw SS_ANNE_6, SSAnne6HiddenObjects + dbw UNDERGROUND_PATH_NS, UndergroundPathNsHiddenObjects + dbw UNDERGROUND_PATH_WE, UndergroundPathWeHiddenObjects + dbw ROCKET_HIDEOUT_1, RocketHideout1HiddenObjects + dbw ROCKET_HIDEOUT_3, RocketHideout3HiddenObjects + dbw ROCKET_HIDEOUT_4, RocketHideout4HiddenObjects + dbw ROUTE_10, Route10HiddenObjects + dbw ROCK_TUNNEL_POKECENTER, RockTunnelPokecenterHiddenObjects + dbw POWER_PLANT, PowerPlantHiddenObjects + dbw ROUTE_11, Route11HiddenObjects + dbw ROUTE_12, Route12HiddenObjects + dbw ROUTE_13, Route13HiddenObjects + dbw ROUTE_15_GATE_2F, Route15Gate2FHiddenObjects + dbw ROUTE_17, Route17HiddenObjects + dbw ROUTE_23, Route23HiddenObjects + dbw VICTORY_ROAD_2, VictoryRoad2HiddenObjects + dbw ROUTE_25, Route25HiddenObjects + dbw BILLS_HOUSE, BillsHouseHiddenObjects + dbw ROUTE_4, Route4HiddenObjects + dbw MT_MOON_POKECENTER, MtMoonPokecenterHiddenObjects + dbw ROUTE_9, Route9HiddenObjects + dbw TRADE_CENTER, TradeCenterHiddenObjects + dbw COLOSSEUM, ColosseumHiddenObjects + dbw INDIGO_PLATEAU, IndigoPlateauHiddenObjects + dbw INDIGO_PLATEAU_LOBBY, IndigoPlateauLobbyHiddenObjects + dbw COPYCATS_HOUSE_2F, CopycatsHouse2FHiddenObjects + dbw FIGHTING_DOJO, FightingDojoHiddenObjects + dbw SAFFRON_GYM, SaffronGymHiddenObjects + dbw SAFFRON_POKECENTER, SaffronPokecenterHiddenObjects + dbw REDS_HOUSE_2F, RedsHouse2FHiddenObjects + dbw BLUES_HOUSE, BluesHouseHiddenObjects + dbw OAKS_LAB, OaksLabHiddenObjects + dbw VIRIDIAN_CITY, ViridianCityHiddenObjects + dbw VIRIDIAN_POKECENTER, ViridianPokecenterHiddenObjects + dbw VIRIDIAN_SCHOOL, ViridianSchoolHiddenObjects + dbw VIRIDIAN_GYM, ViridianGymHiddenObjects + dbw MUSEUM_1F, Museum1FHiddenObjects + dbw PEWTER_GYM, PewterGymHiddenObjects + dbw PEWTER_POKECENTER, PewterPokecenterHiddenObjects + dbw CERULEAN_CITY, CeruleanCityHiddenObjects + dbw CERULEAN_POKECENTER, CeruleanPokecenterHiddenObjects + dbw CERULEAN_GYM, CeruleanGymHiddenObjects + dbw BIKE_SHOP, BikeShopHiddenObjects + dbw UNKNOWN_DUNGEON_1, UnknownDungeon1HiddenObjects + dbw LAVENDER_POKECENTER, LavenderPokecenterHiddenObjects + dbw POKEMONTOWER_5, Pokemontower5HiddenObjects + dbw LAVENDER_HOUSE_1, LavenderHouse1HiddenObjects + dbw VERMILION_CITY, VermilionCityHiddenObjects + dbw VERMILION_POKECENTER, VermilionPokecenterHiddenObjects + dbw POKEMON_FAN_CLUB, PokemonFanClubHiddenObjects + dbw VERMILION_GYM, VermilionGymHiddenObjects + dbw CELADON_CITY, CeladonCityHiddenObjects + dbw CELADON_HOTEL, CeladonHotelHiddenObjects + dbw CELADON_MANSION_2, CeladonMansion2HiddenObjects + dbw CELADON_MANSION_5, CeladonMansion5HiddenObjects + dbw CELADON_POKECENTER, CeladonPokecenterHiddenObjects + dbw CELADON_GYM, CeladonGymHiddenObjects + dbw GAME_CORNER, GameCornerHiddenObjects + dbw FUCHSIA_POKECENTER, FuchsiaPokecenterHiddenObjects + dbw SAFARI_ZONE_ENTRANCE, SafariZoneEntranceHiddenObjects + dbw FUCHSIA_GYM, FuchsiaGymHiddenObjects + dbw MANSION_1, Mansion1HiddenObjects + dbw CINNABAR_GYM, CinnabarGymHiddenObjects + dbw CINNABAR_LAB_4, CinnabarLab4HiddenObjects + dbw CINNABAR_POKECENTER, CinnabarPokecenterHiddenObjects + db $ff ; format: y-coord, x-coord, text id/item id, object routine +hidden_object: macro + db \1, \2, \3 + dba \4 + endm + +SilphCo11FHiddenObjects: + hidden_object 12, 10, SPRITE_FACING_UP, OpenPokemonCenterPC + db $ff + +SilphCo5FHiddenObjects: + hidden_object 3, 12, ELIXER, HiddenItems + db $ff + +SilphCo9FHiddenObjects: + hidden_object 15, 2, MAX_POTION, HiddenItems + db $ff + +Mansion2HiddenObjects: + hidden_object 11, 2, SPRITE_FACING_UP, Mansion2Script_Switches + db $ff + +Mansion3HiddenObjects: + hidden_object 9, 1, MAX_REVIVE, HiddenItems + hidden_object 5, 10, SPRITE_FACING_UP, Mansion3Script_Switches + db $ff + +Mansion4HiddenObjects: + hidden_object 9, 1, RARE_CANDY, HiddenItems + hidden_object 3, 20, SPRITE_FACING_UP, Mansion4Script_Switches + hidden_object 25, 18, SPRITE_FACING_UP, Mansion4Script_Switches + db $ff + +SafariZoneWestHiddenObjects: + hidden_object 5, 6, REVIVE, HiddenItems + db $ff + +UnknownDungeon2HiddenObjects: + hidden_object 13, 16, PP_UP, HiddenItems + db $ff + +UnknownDungeon3HiddenObjects: + hidden_object 14, 8, PP_UP, HiddenItems + db $ff + +UnusedMap6FHiddenObjects: + hidden_object 11, 14, MAX_ELIXER, HiddenItems + db $ff + +SeafoamIslands3HiddenObjects: + hidden_object 15, 15, NUGGET, HiddenItems + db $ff + +SeafoamIslands4HiddenObjects: + hidden_object 16, 9, MAX_ELIXER, HiddenItems + db $ff + +SeafoamIslands5HiddenObjects: + hidden_object 17, 25, ULTRA_BALL, HiddenItems + db $ff + +ViridianForestHiddenObjects: + hidden_object 18, 1, POTION, HiddenItems + hidden_object 42, 16, ANTIDOTE, HiddenItems + db $ff + +MtMoon3HiddenObjects: + hidden_object 12, 18, MOON_STONE, HiddenItems + hidden_object 9, 33, ETHER, HiddenItems + db $ff + +SSAnne10HiddenObjects: + hidden_object 1, 3, HYPER_POTION, HiddenItems + db $ff + +SSAnne6HiddenObjects: + hidden_object 5, 13, SPRITE_FACING_DOWN, PrintTrashText + hidden_object 7, 13, SPRITE_FACING_DOWN, PrintTrashText + hidden_object 9, 13, GREAT_BALL, HiddenItems + db $ff + +UndergroundPathNsHiddenObjects: + hidden_object 4, 3, FULL_RESTORE, HiddenItems + hidden_object 34, 4, X_SPECIAL, HiddenItems + db $ff + +UndergroundPathWeHiddenObjects: + hidden_object 2, 12, NUGGET, HiddenItems + hidden_object 5, 21, ELIXER, HiddenItems + db $ff + +RocketHideout1HiddenObjects: + hidden_object 15, 21, PP_UP, HiddenItems + db $ff + +RocketHideout3HiddenObjects: + hidden_object 17, 27, NUGGET, HiddenItems + db $ff + +RocketHideout4HiddenObjects: + hidden_object 1, 25, SUPER_POTION, HiddenItems + db $ff + +Route10HiddenObjects: + hidden_object 17, 9, SUPER_POTION, HiddenItems + hidden_object 53, 16, MAX_ETHER, HiddenItems + db $ff + +RockTunnelPokecenterHiddenObjects: + hidden_object 4, 0, SPRITE_FACING_LEFT, PrintBenchGuyText + hidden_object 3, 13, SPRITE_FACING_UP, OpenPokemonCenterPC + db $ff + +PowerPlantHiddenObjects: + hidden_object 16, 17, MAX_ELIXER, HiddenItems + hidden_object 1, 12, PP_UP, HiddenItems + db $ff + +Route11HiddenObjects: + hidden_object 5, 48, ESCAPE_ROPE, HiddenItems + db $ff + +Route12HiddenObjects: + hidden_object 63, 2, HYPER_POTION, HiddenItems + db $ff + +Route13HiddenObjects: + hidden_object 14, 1, PP_UP, HiddenItems + hidden_object 13, 16, CALCIUM, HiddenItems + db $ff + +Route15Gate2FHiddenObjects: + hidden_object 2, 1, SPRITE_FACING_UP, Route15GateLeftBinoculars + db $ff + +Route17HiddenObjects: + hidden_object 14, 15, RARE_CANDY, HiddenItems + hidden_object 45, 8, FULL_RESTORE, HiddenItems + hidden_object 72, 17, PP_UP, HiddenItems + hidden_object 91, 4, MAX_REVIVE, HiddenItems + hidden_object 121, 8, MAX_ELIXER, HiddenItems + db $ff + +Route23HiddenObjects: + hidden_object 44, 9, FULL_RESTORE, HiddenItems + hidden_object 70, 19, ULTRA_BALL, HiddenItems + hidden_object 90, 8, MAX_ETHER, HiddenItems + db $ff + +VictoryRoad2HiddenObjects: + hidden_object 2, 5, ULTRA_BALL, HiddenItems + hidden_object 7, 26, FULL_RESTORE, HiddenItems + db $ff + +Route25HiddenObjects: + hidden_object 3, 38, ETHER, HiddenItems + hidden_object 1, 10, ELIXER, HiddenItems + db $ff + +BillsHouseHiddenObjects: + hidden_object 4, 1, SPRITE_FACING_UP, BillsHousePC + db $ff + +Route4HiddenObjects: + hidden_object 3, 40, GREAT_BALL, HiddenItems + db $ff + +MtMoonPokecenterHiddenObjects: + hidden_object 4, 0, SPRITE_FACING_LEFT, PrintBenchGuyText + hidden_object 3, 13, SPRITE_FACING_UP, OpenPokemonCenterPC + db $ff + +Route9HiddenObjects: + hidden_object 7, 14, ETHER, HiddenItems + db $ff + TradeCenterHiddenObjects: - db $04,$05,$d0 - db BANK(CableClubRightGameboy) - dw CableClubRightGameboy - db $04,$04,$d0 - db BANK(CableClubLeftGameboy) - dw CableClubLeftGameboy - db $FF + hidden_object 4, 5, $d0, CableClubRightGameboy + hidden_object 4, 4, $d0, CableClubLeftGameboy + db $ff + ColosseumHiddenObjects: - db $04,$05,$d0 - db BANK(CableClubRightGameboy) - dw CableClubRightGameboy - db $04,$04,$d0 - db BANK(CableClubLeftGameboy) - dw CableClubLeftGameboy - db $FF + hidden_object 4, 5, $d0, CableClubRightGameboy + hidden_object 4, 4, $d0, CableClubLeftGameboy + db $ff + +IndigoPlateauHiddenObjects: + hidden_object 13, 8, $ff, PrintIndigoPlateauHQText + hidden_object 13, 11, SPRITE_FACING_DOWN, PrintIndigoPlateauHQText + db $ff + +IndigoPlateauLobbyHiddenObjects: + hidden_object 7, 15, SPRITE_FACING_UP, OpenPokemonCenterPC + db $ff + +CopycatsHouse2FHiddenObjects: + hidden_object 1, 1, NUGGET, HiddenItems + db $ff + +FightingDojoHiddenObjects: + hidden_object 9, 3, SPRITE_FACING_UP, PrintFightingDojoText + hidden_object 9, 6, SPRITE_FACING_UP, PrintFightingDojoText + hidden_object 0, 4, SPRITE_FACING_UP, PrintFightingDojoText2 + hidden_object 0, 5, SPRITE_FACING_UP, PrintFightingDojoText3 + db $ff + +SaffronGymHiddenObjects: + hidden_object 15, 9, SPRITE_FACING_UP, GymStatues + db $ff + +SaffronPokecenterHiddenObjects: + hidden_object 4, 0, SPRITE_FACING_UP, PrintBenchGuyText + hidden_object 3, 13, SPRITE_FACING_UP, OpenPokemonCenterPC + db $ff + RedsHouse2FHiddenObjects: - db $01,$00,$04 - dbw BANK(OpenRedsPC), OpenRedsPC - db $05,$03,$d0 - dbw BANK(PrintRedSNESText), PrintRedSNESText - db $FF + hidden_object 1, 0, SPRITE_FACING_UP, OpenRedsPC + hidden_object 5, 3, $d0, PrintRedSNESText + db $ff + BluesHouseHiddenObjects: - db $01,$00,$04 - db BANK(PrintBookcaseText) - dw PrintBookcaseText - db $01,$01,$04 - db BANK(PrintBookcaseText) - dw PrintBookcaseText - db $01,$07,$04 - db BANK(PrintBookcaseText) - dw PrintBookcaseText - db $FF + hidden_object 1, 0, SPRITE_FACING_UP, PrintBookcaseText + hidden_object 1, 1, SPRITE_FACING_UP, PrintBookcaseText + hidden_object 1, 7, SPRITE_FACING_UP, PrintBookcaseText + db $ff + OaksLabHiddenObjects: - db $00,$04,$04 - db BANK(DisplayOakLabLeftPoster) - dw DisplayOakLabLeftPoster - db $00,$05,$04 - db BANK(DisplayOakLabRightPoster) - dw DisplayOakLabRightPoster - db $01,$00,$04 - db BANK(DisplayOakLabEmailText) - dw DisplayOakLabEmailText - db $01,$01,$04 - db BANK(DisplayOakLabEmailText) - dw DisplayOakLabEmailText - db $FF + hidden_object 0, 4, SPRITE_FACING_UP, DisplayOakLabLeftPoster + hidden_object 0, 5, SPRITE_FACING_UP, DisplayOakLabRightPoster + hidden_object 1, 0, SPRITE_FACING_UP, DisplayOakLabEmailText + hidden_object 1, 1, SPRITE_FACING_UP, DisplayOakLabEmailText + db $ff + +ViridianCityHiddenObjects: + hidden_object 4, 14, POTION, HiddenItems + db $ff + ViridianPokecenterHiddenObjects: - db $04,$00,$08 - db Bank(PrintBenchGuyText) - dw PrintBenchGuyText - db $03,$0d,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $FF -ViridianMartHiddenObjects: - db $FF + hidden_object 4, 0, SPRITE_FACING_LEFT, PrintBenchGuyText + hidden_object 3, 13, SPRITE_FACING_UP, OpenPokemonCenterPC + db $ff + ViridianSchoolHiddenObjects: - db $04,$03,(ViridianSchoolNotebook_id - TextPredefs) / 2 + 1 - db Bank(PrintNotebookText) - dw PrintNotebookText - db $00,$03,(ViridianSchoolBlackboard_id - TextPredefs) / 2 + 1 - db BANK(PrintBlackboardLinkCableText) - dw PrintBlackboardLinkCableText - db $FF + hidden_object 4, 3, (ViridianSchoolNotebook_id - TextPredefs) / 2 + 1, PrintNotebookText + hidden_object 0, 3, (ViridianSchoolBlackboard_id - TextPredefs) / 2 + 1, PrintBlackboardLinkCableText + db $ff + ViridianGymHiddenObjects: - db $0f,$0f,$04 - dbw BANK(GymStatues),GymStatues - db $0f,$12,$04 - dbw BANK(GymStatues),GymStatues - db $FF + hidden_object 15, 15, SPRITE_FACING_UP, GymStatues + hidden_object 15, 18, SPRITE_FACING_UP, GymStatues + db $ff + Museum1FHiddenObjects: - db $03,$02,$04 - dbw BANK(AerodactylFossil), AerodactylFossil - db $06,$02,$04 - dbw BANK(KabutopsFossil), KabutopsFossil - db $FF + hidden_object 3, 2, SPRITE_FACING_UP, AerodactylFossil + hidden_object 6, 2, SPRITE_FACING_UP, KabutopsFossil + db $ff + PewterGymHiddenObjects: - db $0a,$03,$04 - dbw BANK(GymStatues),GymStatues - db $0a,$06,$04 - dbw BANK(GymStatues),GymStatues - db $FF -PewterMartHiddenObjects: - db $FF + hidden_object 10, 3, SPRITE_FACING_UP, GymStatues + hidden_object 10, 6, SPRITE_FACING_UP, GymStatues + db $ff + PewterPokecenterHiddenObjects: - db $04,$00,$08 - db Bank(PrintBenchGuyText) - dw PrintBenchGuyText - db $03,$0d,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $FF + hidden_object 4, 0, SPRITE_FACING_LEFT, PrintBenchGuyText + hidden_object 3, 13, SPRITE_FACING_UP, OpenPokemonCenterPC + db $ff + +CeruleanCityHiddenObjects: + hidden_object 8, 15, RARE_CANDY, HiddenItems + db $ff + CeruleanPokecenterHiddenObjects: - db $04,$00,$08 - db Bank(PrintBenchGuyText) - dw PrintBenchGuyText - db $03,$0d,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $FF + hidden_object 4, 0, SPRITE_FACING_LEFT, PrintBenchGuyText + hidden_object 3, 13, SPRITE_FACING_UP, OpenPokemonCenterPC + db $ff + CeruleanGymHiddenObjects: - db $0b,$03,$04 - dbw BANK(GymStatues),GymStatues - db $0b,$06,$04 - dbw BANK(GymStatues),GymStatues - db $FF -CeruleanMartHiddenObjects: - db $FF + hidden_object 11, 3, SPRITE_FACING_UP, GymStatues + hidden_object 11, 6, SPRITE_FACING_UP, GymStatues + db $ff + +BikeShopHiddenObjects: + hidden_object 0, 1, $d0, PrintNewBikeText + hidden_object 1, 2, $d0, PrintNewBikeText + hidden_object 2, 1, $d0, PrintNewBikeText + hidden_object 2, 3, $d0, PrintNewBikeText + hidden_object 4, 0, $d0, PrintNewBikeText + hidden_object 5, 1, $d0, PrintNewBikeText + db $ff + +UnknownDungeon1HiddenObjects: + hidden_object 7, 18, PP_UP, HiddenItems + db $ff + LavenderPokecenterHiddenObjects: - db $04,$00,$08 - db Bank(PrintBenchGuyText) - dw PrintBenchGuyText - db $03,$0d,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $FF + hidden_object 4, 0, SPRITE_FACING_LEFT, PrintBenchGuyText + hidden_object 3, 13, SPRITE_FACING_UP, OpenPokemonCenterPC + db $ff + +Pokemontower5HiddenObjects: + hidden_object 12, 4, ELIXER, HiddenItems + db $ff + +LavenderHouse1HiddenObjects: + hidden_object 1, 0, SPRITE_FACING_DOWN, PrintMagazinesText + hidden_object 1, 1, SPRITE_FACING_DOWN, PrintMagazinesText + hidden_object 1, 7, SPRITE_FACING_DOWN, PrintMagazinesText + db $ff + +VermilionCityHiddenObjects: + hidden_object 11, 14, MAX_ETHER, HiddenItems + db $ff + VermilionPokecenterHiddenObjects: - db $03,$0d,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $04,$00,$04 - db Bank(PrintBenchGuyText) - dw PrintBenchGuyText - db $FF + hidden_object 3, 13, SPRITE_FACING_UP, OpenPokemonCenterPC + hidden_object 4, 0, SPRITE_FACING_UP, PrintBenchGuyText + db $ff + +PokemonFanClubHiddenObjects: + hidden_object 0, 1, SPRITE_FACING_UP, FanClubPicture1 + hidden_object 0, 6, SPRITE_FACING_UP, FanClubPicture2 + db $ff + VermilionGymHiddenObjects: - db $0e,$03,$04 - dbw BANK(GymStatues), GymStatues - db $0e,$06,$04 - dbw BANK(GymStatues), GymStatues - db $01,$06,$00 - dbw BANK(PrintTrashText), PrintTrashText - db $07,$01,$00 - dbw BANK(GymTrashScript), GymTrashScript - db $09,$01,$01 - dbw BANK(GymTrashScript), GymTrashScript - db $0b,$01,$02 - dbw BANK(GymTrashScript), GymTrashScript - db $07,$03,$03 - dbw BANK(GymTrashScript), GymTrashScript - db $09,$03,$04 - dbw BANK(GymTrashScript), GymTrashScript - db $0b,$03,$05 - dbw BANK(GymTrashScript), GymTrashScript - db $07,$05,$06 - dbw BANK(GymTrashScript), GymTrashScript - db $09,$05,$07 - dbw BANK(GymTrashScript), GymTrashScript - db $0b,$05,$08 - dbw BANK(GymTrashScript), GymTrashScript - db $07,$07,$09 - dbw BANK(GymTrashScript), GymTrashScript - db $09,$07,$0a - dbw BANK(GymTrashScript), GymTrashScript - db $0b,$07,$0b - dbw BANK(GymTrashScript), GymTrashScript - db $07,$09,$0c - dbw BANK(GymTrashScript), GymTrashScript - db $09,$09,$0d - dbw BANK(GymTrashScript), GymTrashScript - db $0b,$09,$0e - dbw BANK(GymTrashScript), GymTrashScript - db $FF + hidden_object 14, 3, SPRITE_FACING_UP, GymStatues + hidden_object 14, 6, SPRITE_FACING_UP, GymStatues + hidden_object 1, 6, SPRITE_FACING_DOWN, PrintTrashText + hidden_object 7, 1, 0, GymTrashScript + hidden_object 9, 1, 1, GymTrashScript + hidden_object 11, 1, 2, GymTrashScript + hidden_object 7, 3, 3, GymTrashScript + hidden_object 9, 3, 4, GymTrashScript + hidden_object 11, 3, 5, GymTrashScript + hidden_object 7, 5, 6, GymTrashScript + hidden_object 9, 5, 7, GymTrashScript + hidden_object 11, 5, 8, GymTrashScript + hidden_object 7, 7, 9, GymTrashScript + hidden_object 9, 7, 10, GymTrashScript + hidden_object 11, 7, 11, GymTrashScript + hidden_object 7, 9, 12, GymTrashScript + hidden_object 9, 9, 13, GymTrashScript + hidden_object 11, 9, 14, GymTrashScript + db $ff + +CeladonCityHiddenObjects: + hidden_object 15, 48, PP_UP, HiddenItems + db $ff + +CeladonHotelHiddenObjects: + hidden_object 4, 0, SPRITE_FACING_LEFT, PrintBenchGuyText + db $ff + CeladonMansion2HiddenObjects: - db $05,$00,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $FF + hidden_object 5, 0, SPRITE_FACING_UP, OpenPokemonCenterPC + db $ff + +CeladonMansion5HiddenObjects: + hidden_object 0, 3, (LinkCableHelp_id - TextPredefs) / 2 + 1, PrintBlackboardLinkCableText + hidden_object 0, 4, (LinkCableHelp_id - TextPredefs) / 2 + 1, PrintBlackboardLinkCableText + hidden_object 4, 3, (TMNotebook_id - TextPredefs) / 2 + 1, PrintNotebookText + db $ff + CeladonPokecenterHiddenObjects: - db $04,$00,$08 - db Bank(PrintBenchGuyText) - dw PrintBenchGuyText - db $03,$0d,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $FF + hidden_object 4, 0, SPRITE_FACING_LEFT, PrintBenchGuyText + hidden_object 3, 13, SPRITE_FACING_UP, OpenPokemonCenterPC + db $ff + CeladonGymHiddenObjects: - db $0f,$03,$04 - dbw BANK(GymStatues),GymStatues - db $0f,$06,$04 - dbw BANK(GymStatues),GymStatues - db $FF + hidden_object 15, 3, SPRITE_FACING_UP, GymStatues + hidden_object 15, 6, SPRITE_FACING_UP, GymStatues + db $ff + GameCornerHiddenObjects: - db $0f,$12,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0e,$12,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0d,$12,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0c,$12,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0b,$12,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0a,$12,$ff ; "Someone's Keys" - dbw BANK(StartSlotMachine), StartSlotMachine - db $0a,$0d,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0b,$0d,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0c,$0d,$fe ; "Out To Lunch" - dbw BANK(StartSlotMachine), StartSlotMachine - db $0d,$0d,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0e,$0d,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0f,$0d,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0f,$0c,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0e,$0c,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0d,$0c,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0c,$0c,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0b,$0c,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0a,$0c,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0a,$07,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0b,$07,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0c,$07,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0d,$07,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0e,$07,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0f,$07,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0f,$06,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0e,$06,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0d,$06,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0c,$06,$fd ; "Out Of Order" - dbw BANK(StartSlotMachine), StartSlotMachine - db $0b,$06,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0a,$06,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0a,$01,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0b,$01,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0c,$01,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0d,$01,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0e,$01,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $0f,$01,$d0 - dbw BANK(StartSlotMachine), StartSlotMachine - db $08,$00,COIN+10 - dbw BANK(HiddenCoins),HiddenCoins - db $10,$01,COIN+10 - dbw BANK(HiddenCoins),HiddenCoins - db $0b,$03,COIN+20 - dbw BANK(HiddenCoins),HiddenCoins - db $0e,$03,COIN+10 - dbw BANK(HiddenCoins),HiddenCoins - db $0c,$04,COIN+10 - dbw BANK(HiddenCoins),HiddenCoins - db $0c,$09,COIN+20 - dbw BANK(HiddenCoins),HiddenCoins - db $0f,$09,COIN+10 - dbw BANK(HiddenCoins),HiddenCoins - db $0e,$10,COIN+10 - dbw BANK(HiddenCoins),HiddenCoins - db $10,$0a,COIN+10 - dbw BANK(HiddenCoins),HiddenCoins - db $07,$0b,COIN+40 - dbw BANK(HiddenCoins),HiddenCoins - db $08,$0f,COIN+100 - dbw BANK(HiddenCoins),HiddenCoins - db $0f,$0c,COIN+10 - dbw BANK(HiddenCoins),HiddenCoins - db $FF -CeladonHotelHiddenObjects: - db $03,$0d,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $04,$00,$08 - db Bank(PrintBenchGuyText) - dw PrintBenchGuyText - db $FF + hidden_object 15, 18, $d0, StartSlotMachine + hidden_object 14, 18, $d0, StartSlotMachine + hidden_object 13, 18, $d0, StartSlotMachine + hidden_object 12, 18, $d0, StartSlotMachine + hidden_object 11, 18, $d0, StartSlotMachine + hidden_object 10, 18, $ff, StartSlotMachine ; "Someone's Keys" + hidden_object 10, 13, $d0, StartSlotMachine + hidden_object 11, 13, $d0, StartSlotMachine + hidden_object 12, 13, $fe, StartSlotMachine ; "Out To Lunch" + hidden_object 13, 13, $d0, StartSlotMachine + hidden_object 14, 13, $d0, StartSlotMachine + hidden_object 15, 13, $d0, StartSlotMachine + hidden_object 15, 12, $d0, StartSlotMachine + hidden_object 14, 12, $d0, StartSlotMachine + hidden_object 13, 12, $d0, StartSlotMachine + hidden_object 12, 12, $d0, StartSlotMachine + hidden_object 11, 12, $d0, StartSlotMachine + hidden_object 10, 12, $d0, StartSlotMachine + hidden_object 10, 7, $d0, StartSlotMachine + hidden_object 11, 7, $d0, StartSlotMachine + hidden_object 12, 7, $d0, StartSlotMachine + hidden_object 13, 7, $d0, StartSlotMachine + hidden_object 14, 7, $d0, StartSlotMachine + hidden_object 15, 7, $d0, StartSlotMachine + hidden_object 15, 6, $d0, StartSlotMachine + hidden_object 14, 6, $d0, StartSlotMachine + hidden_object 13, 6, $d0, StartSlotMachine + hidden_object 12, 6, $fd, StartSlotMachine ; "Out Of Order" + hidden_object 11, 6, $d0, StartSlotMachine + hidden_object 10, 6, $d0, StartSlotMachine + hidden_object 10, 1, $d0, StartSlotMachine + hidden_object 11, 1, $d0, StartSlotMachine + hidden_object 12, 1, $d0, StartSlotMachine + hidden_object 13, 1, $d0, StartSlotMachine + hidden_object 14, 1, $d0, StartSlotMachine + hidden_object 15, 1, $d0, StartSlotMachine + hidden_object 8, 0, COIN + 10, HiddenCoins + hidden_object 16, 1, COIN + 10, HiddenCoins + hidden_object 11, 3, COIN + 20, HiddenCoins + hidden_object 14, 3, COIN + 10, HiddenCoins + hidden_object 12, 4, COIN + 10, HiddenCoins + hidden_object 12, 9, COIN + 20, HiddenCoins + hidden_object 15, 9, COIN + 10, HiddenCoins + hidden_object 14, 16, COIN + 10, HiddenCoins + hidden_object 16, 10, COIN + 10, HiddenCoins + hidden_object 7, 11, COIN + 40, HiddenCoins + hidden_object 8, 15, COIN + 100, HiddenCoins + hidden_object 15, 12, COIN + 10, HiddenCoins + db $ff + FuchsiaPokecenterHiddenObjects: - db $03,$0d,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $04,$00,$04 - db Bank(PrintBenchGuyText) - dw PrintBenchGuyText - db $FF -FuchsiaGymHiddenObjects: - db $0f,$03,$04 - dbw BANK(GymStatues),GymStatues - db $0f,$06,$04 - dbw BANK(GymStatues),GymStatues - db $FF -CinnabarGymHiddenObjects: - db $0d,$11,$04 - dbw BANK(GymStatues),GymStatues - db $07,$0f,$01 - db Bank(PrintCinnabarQuiz) - dw PrintCinnabarQuiz - db $01,$0a,$12 - db Bank(PrintCinnabarQuiz) - dw PrintCinnabarQuiz - db $07,$09,$13 - db Bank(PrintCinnabarQuiz) - dw PrintCinnabarQuiz - db $0d,$09,$14 - db Bank(PrintCinnabarQuiz) - dw PrintCinnabarQuiz - db $0d,$01,$05 - db Bank(PrintCinnabarQuiz) - dw PrintCinnabarQuiz - db $07,$01,$16 - db Bank(PrintCinnabarQuiz) - dw PrintCinnabarQuiz - db $FF -CinnabarPokecenterHiddenObjects: - db $04,$00,$04 - db Bank(PrintBenchGuyText) - dw PrintBenchGuyText - db $03,$0d,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $FF -SaffronGymHiddenObjects: - db $0f,$09,$04 - dbw BANK(GymStatues),GymStatues - db $FF -MtMoonPokecenterHiddenObjects: - db $04,$00,$08 - db Bank(PrintBenchGuyText) - dw PrintBenchGuyText - db $03,$0d,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $FF -RockTunnelPokecenterHiddenObjects: - db $04,$00,$08 - db Bank(PrintBenchGuyText) - dw PrintBenchGuyText - db $03,$0d,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $FF -ViridianForestHiddenObjects: - db $12,$01,POTION - dbw BANK(HiddenItems),HiddenItems - db $2a,$10,ANTIDOTE - dbw BANK(HiddenItems),HiddenItems - db $FF -MtMoon3HiddenObjects: - db $0c,$12,MOON_STONE - dbw BANK(HiddenItems),HiddenItems - db $09,$21,ETHER - dbw BANK(HiddenItems),HiddenItems - db $FF -IndigoPlateauHiddenObjects: - db $0d,$08,$ff - db BANK(PrintIndigoPlateauHQText) - dw PrintIndigoPlateauHQText - db $0d,$0b,$00 - db BANK(PrintIndigoPlateauHQText) - dw PrintIndigoPlateauHQText - db $FF -Route25HiddenObjects: - db $03,$26,ETHER - dbw BANK(HiddenItems),HiddenItems - db $01,$0a,ELIXER - dbw BANK(HiddenItems),HiddenItems - db $FF -Route9HiddenObjects: - db $07,$0e,ETHER - dbw BANK(HiddenItems),HiddenItems - db $FF -SSAnne6HiddenObjects: - db $05,$0d,$00 - dbw BANK(PrintTrashText), PrintTrashText - db $07,$0d,$00 - dbw BANK(PrintTrashText), PrintTrashText - db $09,$0d,GREAT_BALL - dbw BANK(HiddenItems),HiddenItems - db $FF -SSAnne10HiddenObjects: - db $01,$03,HYPER_POTION - dbw BANK(HiddenItems),HiddenItems - db $FF -Route10HiddenObjects: - db $11,$09,SUPER_POTION - dbw BANK(HiddenItems),HiddenItems - db $35,$10,MAX_ETHER - dbw BANK(HiddenItems),HiddenItems - db $FF -RocketHideout1HiddenObjects: - db $0f,$15,PP_UP - dbw BANK(HiddenItems),HiddenItems - db $FF -RocketHideout3HiddenObjects: - db $11,$1b,NUGGET - dbw BANK(HiddenItems),HiddenItems - db $FF -RocketHideout4HiddenObjects: - db $01,$19,SUPER_POTION - dbw BANK(HiddenItems),HiddenItems - db $FF -SaffronPokecenterHiddenObjects: - db $04,$00,$04 - db Bank(PrintBenchGuyText) - dw PrintBenchGuyText - db $03,$0d,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $FF -PokemonTower5HiddenObjects: - db $0c,$04,ELIXER - dbw BANK(HiddenItems),HiddenItems - db $FF -Route13HiddenObjects: - db $0e,$01,PP_UP - dbw BANK(HiddenItems),HiddenItems - db $0d,$10,CALCIUM - dbw BANK(HiddenItems),HiddenItems - db $FF + hidden_object 3, 13, SPRITE_FACING_UP, OpenPokemonCenterPC + hidden_object 4, 0, SPRITE_FACING_UP, PrintBenchGuyText + db $ff + SafariZoneEntranceHiddenObjects: - db $01,$0a,NUGGET - dbw BANK(HiddenItems),HiddenItems - db $FF -SafariZoneWestHiddenObjects: - db $05,$06,REVIVE - dbw BANK(HiddenItems),HiddenItems - db $FF -SilphCo5FHiddenObjects: - db $03,$0c,ELIXER - dbw BANK(HiddenItems),HiddenItems - db $FF -SilphCo9FHiddenObjects: - db $0f,$02,MAX_POTION - dbw BANK(HiddenItems),HiddenItems - db $FF -CopycatsHouse2FHiddenObjects: - db $01,$01,NUGGET - dbw BANK(HiddenItems),HiddenItems - db $FF -UnknownDungeon1HiddenObjects: - db $0b,$0e,RARE_CANDY - dbw BANK(HiddenItems),HiddenItems - db $FF -UnknownDungeon3HiddenObjects: - db $03,$1b,ULTRA_BALL - dbw BANK(HiddenItems),HiddenItems - db $FF -PowerPlantHiddenObjects: - db $10,$11,MAX_ELIXER - dbw BANK(HiddenItems),HiddenItems - db $01,$0c,PP_UP - dbw BANK(HiddenItems),HiddenItems - db $FF -SeafoamIslands3HiddenObjects: - db $0f,$0f,NUGGET - dbw BANK(HiddenItems),HiddenItems - db $FF -SeafoamIslands5HiddenObjects: - db $11,$19,ULTRA_BALL - dbw BANK(HiddenItems),HiddenItems - db $FF + hidden_object 1, 10, NUGGET, HiddenItems + db $ff + +FuchsiaGymHiddenObjects: + hidden_object 15, 3, SPRITE_FACING_UP, GymStatues + hidden_object 15, 6, SPRITE_FACING_UP, GymStatues + db $ff + Mansion1HiddenObjects: - db $10,$08,MOON_STONE - dbw BANK(HiddenItems),HiddenItems - db $05,$02,$04 - db BANK(Mansion1Script_Switches) - dw Mansion1Script_Switches - db $FF -Mansion2HiddenObjects: - db $0b,$02,$04 - db BANK(Mansion2Script_Switches) - dw Mansion2Script_Switches - db $FF -Mansion3HiddenObjects: - db $09,$01,MAX_REVIVE - dbw BANK(HiddenItems),HiddenItems - db $05,$0a,$04 - db BANK(Mansion3Script_Switches) - dw Mansion3Script_Switches - db $FF -Mansion4HiddenObjects: - db $09,$01,RARE_CANDY - dbw BANK(HiddenItems),HiddenItems - db $03,$14,$04 - db BANK(Mansion4Script_Switches) - dw Mansion4Script_Switches - db $19,$12,$04 - db BANK(Mansion4Script_Switches) - dw Mansion4Script_Switches - db $FF -Route23HiddenObjects: - db $2c,$09,FULL_RESTORE - dbw BANK(HiddenItems),HiddenItems - db $46,$13,ULTRA_BALL - dbw BANK(HiddenItems),HiddenItems - db $5a,$08,MAX_ETHER - dbw BANK(HiddenItems),HiddenItems - db $FF -VictoryRoad2HiddenObjects: - db $02,$05,ULTRA_BALL - dbw BANK(HiddenItems),HiddenItems - db $07,$1a,FULL_RESTORE - dbw BANK(HiddenItems),HiddenItems - db $FF -Unused6FHiddenObjects: - db $0b,$0e,MAX_ELIXER - dbw BANK(HiddenItems),HiddenItems - db $FF -BillsHouseHiddenObjects: - db $04,$01,$04 - dbw BANK(BillsHousePC), BillsHousePC - db $FF -ViridianCityHiddenObjects: - db $04,$0e,POTION - dbw BANK(HiddenItems),HiddenItems - db $FF -SafariZoneRestHouse2HiddenObjects: - db $04,$00,$08 - db Bank(PrintBenchGuyText) - dw PrintBenchGuyText - db $03,$0d,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $FF -SafariZoneRestHouse3HiddenObjects: - db $04,$00,$08 - db Bank(PrintBenchGuyText) - dw PrintBenchGuyText - db $03,$0d,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $FF -SafariZoneRestHouse4HiddenObjects: - db $04,$00,$08 - db Bank(PrintBenchGuyText) - dw PrintBenchGuyText - db $03,$0d,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $FF -Route15GateUpstairsHiddenObjects: - db $02,$01,$04 - db BANK(Route15GateLeftBinoculars) - dw Route15GateLeftBinoculars - db $FF -LavenderHouse1HiddenObjects: - db $01,$00,$00 - db BANK(PrintMagazinesText) - dw PrintMagazinesText - db $01,$01,$00 - db BANK(PrintMagazinesText) - dw PrintMagazinesText - db $01,$07,$00 - db BANK(PrintMagazinesText) - dw PrintMagazinesText - db $FF -CeladonMansion5HiddenObjects: - db $00,$03,(LinkCableHelp_id - TextPredefs) / 2 + 1 - db BANK(PrintBlackboardLinkCableText) - dw PrintBlackboardLinkCableText - db $00,$04,(LinkCableHelp_id - TextPredefs) / 2 + 1 - db BANK(PrintBlackboardLinkCableText) - dw PrintBlackboardLinkCableText - db $04,$03,(TMNotebook_id - TextPredefs) / 2 + 1 - db Bank(PrintNotebookText) - dw PrintNotebookText - db $FF -FightingDojoHiddenObjects: - db $09,$03,$04 - db BANK(PrintFightingDojoText) - dw PrintFightingDojoText - db $09,$06,$04 - db BANK(PrintFightingDojoText) - dw PrintFightingDojoText - db $00,$04,$04 - db BANK(PrintFightingDojoText2) - dw PrintFightingDojoText2 - db $00,$05,$04 - db BANK(PrintFightingDojoText3) - dw PrintFightingDojoText3 - db $FF -IndigoPlateauLobbyHiddenObjects: - db $07,$0f,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $FF + hidden_object 16, 8, MOON_STONE, HiddenItems + hidden_object 5, 2, SPRITE_FACING_UP, Mansion1Script_Switches + db $ff + +CinnabarGymHiddenObjects: + hidden_object 13, 17, SPRITE_FACING_UP, GymStatues + hidden_object 7, 15, (0 << 4) | 1, PrintCinnabarQuiz + hidden_object 1, 10, (1 << 4) | 2, PrintCinnabarQuiz + hidden_object 7, 9, (1 << 4) | 3, PrintCinnabarQuiz + hidden_object 13, 9, (1 << 4) | 4, PrintCinnabarQuiz + hidden_object 13, 1, (0 << 4) | 5, PrintCinnabarQuiz + hidden_object 7, 1, (1 << 4) | 6, PrintCinnabarQuiz + db $ff + CinnabarLab4HiddenObjects: - db $04,$00,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $04,$02,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $FF -BikeShopHiddenObjects: - db $00,$01,$d0 - dbw BANK(PrintNewBikeText), PrintNewBikeText - db $01,$02,$d0 - dbw BANK(PrintNewBikeText), PrintNewBikeText - db $02,$01,$d0 - dbw BANK(PrintNewBikeText), PrintNewBikeText - db $02,$03,$d0 - dbw BANK(PrintNewBikeText), PrintNewBikeText - db $04,$00,$d0 - dbw BANK(PrintNewBikeText), PrintNewBikeText - db $05,$01,$d0 - dbw BANK(PrintNewBikeText), PrintNewBikeText - db $FF -Route11HiddenObjects: - db $05,$30,ESCAPE_ROPE - dbw BANK(HiddenItems),HiddenItems - db $FF -Route12HiddenObjects: - db $3f,$02,HYPER_POTION - dbw BANK(HiddenItems),HiddenItems - db $FF -SilphCo11FHiddenObjects: - db $0c,$0a,$04 - db BANK(OpenPokemonCenterPC) - dw OpenPokemonCenterPC - db $FF -Route17HiddenObjects: - db $0e,$0f,RARE_CANDY - dbw BANK(HiddenItems),HiddenItems - db $2d,$08,FULL_RESTORE - dbw BANK(HiddenItems),HiddenItems - db $48,$11,PP_UP - dbw BANK(HiddenItems),HiddenItems - db $5b,$04,MAX_REVIVE - dbw BANK(HiddenItems),HiddenItems - db $79,$08,MAX_ELIXER - dbw BANK(HiddenItems),HiddenItems - db $FF -UndergroundPathNsHiddenObjects: - db $04,$03,FULL_RESTORE - dbw BANK(HiddenItems),HiddenItems - db $22,$04,X_SPECIAL - dbw BANK(HiddenItems),HiddenItems - db $FF -UndergroundPathWeHiddenObjects: - db $02,$0c,NUGGET - dbw BANK(HiddenItems),HiddenItems - db $05,$15,ELIXER - dbw BANK(HiddenItems),HiddenItems - db $FF -CeladonCityHiddenObjects: - db $0f,$30,PP_UP - dbw BANK(HiddenItems),HiddenItems - db $FF -SeafoamIslands4HiddenObjects: - db $10,$09,MAX_ELIXER - dbw BANK(HiddenItems),HiddenItems - db $FF -VermilionCityHiddenObjects: - db $0b,$0e,MAX_ETHER - dbw BANK(HiddenItems),HiddenItems - db $FF -CeruleanCityHiddenObjects: - db $08,$0f,RARE_CANDY - dbw BANK(HiddenItems),HiddenItems - db $FF -Route4HiddenObjects: - db $03,$28,GREAT_BALL - dbw BANK(HiddenItems),HiddenItems - db $FF + hidden_object 4, 0, SPRITE_FACING_UP, OpenPokemonCenterPC + hidden_object 4, 2, SPRITE_FACING_UP, OpenPokemonCenterPC + db $ff + +CinnabarPokecenterHiddenObjects: ; 6cc3 + hidden_object 4, 0, SPRITE_FACING_UP, PrintBenchGuyText + hidden_object 3, 13, SPRITE_FACING_UP, OpenPokemonCenterPC + db $ff + +; 6cd0 diff --git a/data/hide_show_data.asm b/data/hide_show_data.asm index f3ea62ef..72822a40 100755 --- a/data/hide_show_data.asm +++ b/data/hide_show_data.asm @@ -68,7 +68,7 @@ MapHSPointers: dw MapHSXX dw MapHS3D dw MapHSXX - dw MapHSXX + dw MapHS3F dw MapHSXX dw MapHSXX dw MapHSXX @@ -253,6 +253,7 @@ MapHSPointers: dw MapHSXX dw MapHSXX dw MapHSXX + dw MapHSXX ; beach house dw $FFFF ; Structure: @@ -266,312 +267,327 @@ MapHSPointers: ; This Data is loaded into RAM at wd5ce-$D5F?. (wMissableObjectList) ; These constants come from the bytes for Predef functions: -Hide equ $11 -Show equ $15 +Hide EQU $11 ; (HideObjectPredef - PredefPointers) / 3 +Show EQU $15 ; (ShowObjectPredef - PredefPointers) / 3 MapHSXX: - db $FF,$FF,$FF + db $FF, $FF, $FF MapHS00: - db PALLET_TOWN,$01,Hide + db PALLET_TOWN, $01, Hide MapHS01: - db VIRIDIAN_CITY,$05,Show - db VIRIDIAN_CITY,$07,Hide + db VIRIDIAN_CITY, $05, Show + db VIRIDIAN_CITY, $07, Hide + db VIRIDIAN_CITY, $08, Hide MapHS02: - db PEWTER_CITY,$03,Show - db PEWTER_CITY,$05,Show + db PEWTER_CITY, $03, Show + db PEWTER_CITY, $05, Show MapHS03: - db CERULEAN_CITY,$01,Hide - db CERULEAN_CITY,$02,Show - db CERULEAN_CITY,$06,Hide - db CERULEAN_CITY,$0A,Show - db CERULEAN_CITY,$0B,Show + db CERULEAN_CITY, $01, Hide + db CERULEAN_CITY, $02, Show + db CERULEAN_CITY, $06, Hide + db CERULEAN_CITY, $0A, Show + db CERULEAN_CITY, $0B, Show MapHS0A: - db SAFFRON_CITY,$01,Show - db SAFFRON_CITY,$02,Show - db SAFFRON_CITY,$03,Show - db SAFFRON_CITY,$04,Show - db SAFFRON_CITY,$05,Show - db SAFFRON_CITY,$06,Show - db SAFFRON_CITY,$07,Show - db SAFFRON_CITY,$08,Hide - db SAFFRON_CITY,$09,Hide - db SAFFRON_CITY,$0A,Hide - db SAFFRON_CITY,$0B,Hide - db SAFFRON_CITY,$0C,Hide - db SAFFRON_CITY,$0D,Hide - db SAFFRON_CITY,$0E,Show - db SAFFRON_CITY,$0F,Hide + db SAFFRON_CITY, $01, Show + db SAFFRON_CITY, $02, Show + db SAFFRON_CITY, $03, Show + db SAFFRON_CITY, $04, Show + db SAFFRON_CITY, $05, Show + db SAFFRON_CITY, $06, Show + db SAFFRON_CITY, $07, Show + db SAFFRON_CITY, $08, Hide + db SAFFRON_CITY, $09, Hide + db SAFFRON_CITY, $0A, Hide + db SAFFRON_CITY, $0B, Hide + db SAFFRON_CITY, $0C, Hide + db SAFFRON_CITY, $0D, Hide + db SAFFRON_CITY, $0E, Show + db SAFFRON_CITY, $0F, Hide MapHS0D: - db ROUTE_2,$01,Show - db ROUTE_2,$02,Show + db ROUTE_2, $01, Show + db ROUTE_2, $02, Show MapHS0F: - db ROUTE_4,$03,Show + db ROUTE_4, $03, Show MapHS14: - db ROUTE_9,$0A,Show + db ROUTE_9, $0A, Show MapHS17: - db ROUTE_12,$01,Show - db ROUTE_12,$09,Show - db ROUTE_12,$0A,Show + db ROUTE_12, $01, Show + db ROUTE_12, $09, Show + db ROUTE_12, $0A, Show MapHS1A: - db ROUTE_15,$0B,Show + db ROUTE_15, $0B, Show MapHS1B: - db ROUTE_16,$07,Show + db ROUTE_16, $07, Show MapHS21: - db ROUTE_22,$01,Hide - db ROUTE_22,$02,Hide + db ROUTE_22, $01, Hide + db ROUTE_22, $02, Hide MapHS23: - db ROUTE_24,$01,Show - db ROUTE_24,$08,Show + db ROUTE_24, $01, Show + db ROUTE_24, $08, Show MapHS24: - db ROUTE_25,$0A,Show + db ROUTE_25, $0A, Show MapHS27: - db BLUES_HOUSE,$01,Show - db BLUES_HOUSE,$02,Hide - db BLUES_HOUSE,$03,Show + db BLUES_HOUSE, $01, Show + db BLUES_HOUSE, $02, Hide + db BLUES_HOUSE, $03, Show MapHS28: - db OAKS_LAB,$01,Show - db OAKS_LAB,$02,Show - db OAKS_LAB,$03,Show - db OAKS_LAB,$04,Show - db OAKS_LAB,$05,Hide - db OAKS_LAB,$06,Show - db OAKS_LAB,$07,Show - db OAKS_LAB,$08,Hide + db OAKS_LAB, $01, Show + db OAKS_LAB, $02, Show + db OAKS_LAB, $03, Hide + db OAKS_LAB, $04, Show + db OAKS_LAB, $05, Show + db OAKS_LAB, $06, Hide MapHS2D: - db VIRIDIAN_GYM,$01,Show - db VIRIDIAN_GYM,$0B,Show + db VIRIDIAN_GYM, $01, Show + db VIRIDIAN_GYM, $0B, Show MapHS34: - db MUSEUM_1F,$05,Show + db MUSEUM_1F, $05, Show +MapHS3F: ; c92e (3:492e) ; bulbasaur adoption house + db CERULEAN_HOUSE_1, $02, Show MapHSE4: - db UNKNOWN_DUNGEON_1,$01,Show - db UNKNOWN_DUNGEON_1,$02,Show - db UNKNOWN_DUNGEON_1,$03,Show + db UNKNOWN_DUNGEON_1, $01, Show + db UNKNOWN_DUNGEON_1, $02, Show + db UNKNOWN_DUNGEON_1, $03, Show + db UNKNOWN_DUNGEON_1, $04, Show MapHS8F: - db POKEMONTOWER_2,$01,Show + db POKEMONTOWER_2, $01, Show MapHS90: - db POKEMONTOWER_3,$04,Show + db POKEMONTOWER_3, $04, Show MapHS91: - db POKEMONTOWER_4,$04,Show - db POKEMONTOWER_4,$05,Show - db POKEMONTOWER_4,$06,Show + db POKEMONTOWER_4, $04, Show + db POKEMONTOWER_4, $05, Show + db POKEMONTOWER_4, $06, Show MapHS92: - db POKEMONTOWER_5,$06,Show + db POKEMONTOWER_5, $06, Show MapHS93: - db POKEMONTOWER_6,$04,Show - db POKEMONTOWER_6,$05,Show + db POKEMONTOWER_6, $04, Show + db POKEMONTOWER_6, $05, Show MapHS94: - db POKEMONTOWER_7,$01,Show - db POKEMONTOWER_7,$02,Show - db POKEMONTOWER_7,$03,Show - db POKEMONTOWER_7,$04,Show + db POKEMONTOWER_7, $01, Hide ; jessie & james? + db POKEMONTOWER_7, $02, Hide + db POKEMONTOWER_7, $03, Show MapHS95: - db LAVENDER_HOUSE_1,$05,Hide + db LAVENDER_HOUSE_1, $05, Hide MapHS84: - db CELADON_MANSION_5,$02,Show + db CELADON_MANSION_5, $02, Show MapHS87: - db GAME_CORNER,$0B,Show + db GAME_CORNER, $0B, Show MapHS9B: - db FUCHSIA_HOUSE_2,$02,Show + db FUCHSIA_HOUSE_2, $02, Show MapHSA5: - db MANSION_1,$02,Show - db MANSION_1,$03,Show + db MANSION_1, $02, Show + db MANSION_1, $03, Show MapHSB1: - db FIGHTING_DOJO,$06,Show - db FIGHTING_DOJO,$07,Show + db FIGHTING_DOJO, $06, Show + db FIGHTING_DOJO, $07, Show MapHSB5: - db SILPH_CO_1F,$01,Hide + db SILPH_CO_1F, $01, Hide MapHS53: - db POWER_PLANT,$01,Show - db POWER_PLANT,$02,Show - db POWER_PLANT,$03,Show - db POWER_PLANT,$04,Show - db POWER_PLANT,$05,Show - db POWER_PLANT,$06,Show - db POWER_PLANT,$07,Show - db POWER_PLANT,$08,Show - db POWER_PLANT,$09,Show - db POWER_PLANT,$0A,Show - db POWER_PLANT,$0B,Show - db POWER_PLANT,$0C,Show - db POWER_PLANT,$0D,Show - db POWER_PLANT,$0E,Show + db POWER_PLANT, $01, Show + db POWER_PLANT, $02, Show + db POWER_PLANT, $03, Show + db POWER_PLANT, $04, Show + db POWER_PLANT, $05, Show + db POWER_PLANT, $06, Show + db POWER_PLANT, $07, Show + db POWER_PLANT, $08, Show + db POWER_PLANT, $09, Show + db POWER_PLANT, $0A, Show + db POWER_PLANT, $0B, Show + db POWER_PLANT, $0C, Show + db POWER_PLANT, $0D, Show + db POWER_PLANT, $0E, Show MapHSC2: - db VICTORY_ROAD_2,$06,Show - db VICTORY_ROAD_2,$07,Show - db VICTORY_ROAD_2,$08,Show - db VICTORY_ROAD_2,$09,Show - db VICTORY_ROAD_2,$0A,Show - db VICTORY_ROAD_2,$0D,Show + db VICTORY_ROAD_2, $06, Show + db VICTORY_ROAD_2, $07, Show + db VICTORY_ROAD_2, $08, Show + db VICTORY_ROAD_2, $09, Show + db VICTORY_ROAD_2, $0A, Show + db VICTORY_ROAD_2, $0D, Show MapHS58: - db BILLS_HOUSE,$01,Show - db BILLS_HOUSE,$02,Hide - db BILLS_HOUSE,$03,Hide + db BILLS_HOUSE, $01, Show + db BILLS_HOUSE, $02, Hide + db BILLS_HOUSE, $03, Hide MapHS33: - db VIRIDIAN_FOREST,$05,Show - db VIRIDIAN_FOREST,$06,Show - db VIRIDIAN_FOREST,$07,Show + db VIRIDIAN_FOREST, $07, Show + db VIRIDIAN_FOREST, $08, Show + db VIRIDIAN_FOREST, $09, Show MapHS3B: - db MT_MOON_1,$08,Show - db MT_MOON_1,$09,Show - db MT_MOON_1,$0A,Show - db MT_MOON_1,$0B,Show - db MT_MOON_1,$0C,Show - db MT_MOON_1,$0D,Show + db MT_MOON_1, $08, Show + db MT_MOON_1, $09, Show + db MT_MOON_1, $0A, Show + db MT_MOON_1, $0B, Show + db MT_MOON_1, $0C, Show + db MT_MOON_1, $0D, Show MapHS3D: - db MT_MOON_3,$06,Show - db MT_MOON_3,$07,Show - db MT_MOON_3,$08,Show - db MT_MOON_3,$09,Show + db MT_MOON_3, $02, Hide + db MT_MOON_3, $06, Hide + db MT_MOON_3, $07, Show + db MT_MOON_3, $08, Show + db MT_MOON_3, $09, Show + db MT_MOON_3, $0A, Show MapHS60: - db SS_ANNE_2,$02,Hide + db SS_ANNE_2, $02, Hide MapHS66: - db SS_ANNE_8,$0A,Show + db SS_ANNE_8, $0A, Show MapHS67: - db SS_ANNE_9,$06,Show - db SS_ANNE_9,$09,Show + db SS_ANNE_9, $06, Show + db SS_ANNE_9, $09, Show MapHS68: - db SS_ANNE_10,$09,Show - db SS_ANNE_10,$0A,Show - db SS_ANNE_10,$0B,Show + db SS_ANNE_10, $09, Show + db SS_ANNE_10, $0A, Show + db SS_ANNE_10, $0B, Show MapHSC6: - db VICTORY_ROAD_3,$05,Show - db VICTORY_ROAD_3,$06,Show - db VICTORY_ROAD_3,$0A,Show + db VICTORY_ROAD_3, $05, Show + db VICTORY_ROAD_3, $06, Show + db VICTORY_ROAD_3, $0A, Show MapHSC7: - db ROCKET_HIDEOUT_1,$06,Show - db ROCKET_HIDEOUT_1,$07,Show + db ROCKET_HIDEOUT_1, $06, Show + db ROCKET_HIDEOUT_1, $07, Show MapHSC8: - db ROCKET_HIDEOUT_2,$02,Show - db ROCKET_HIDEOUT_2,$03,Show - db ROCKET_HIDEOUT_2,$04,Show - db ROCKET_HIDEOUT_2,$05,Show + db ROCKET_HIDEOUT_2, $02, Show + db ROCKET_HIDEOUT_2, $03, Show + db ROCKET_HIDEOUT_2, $04, Show + db ROCKET_HIDEOUT_2, $05, Show MapHSC9: - db ROCKET_HIDEOUT_3,$03,Show - db ROCKET_HIDEOUT_3,$04,Show + db ROCKET_HIDEOUT_3, $03, Show + db ROCKET_HIDEOUT_3, $04, Show MapHSCA: - db ROCKET_HIDEOUT_4,$01,Show - db ROCKET_HIDEOUT_4,$05,Show - db ROCKET_HIDEOUT_4,$06,Show - db ROCKET_HIDEOUT_4,$07,Show - db ROCKET_HIDEOUT_4,$08,Hide - db ROCKET_HIDEOUT_4,$09,Hide + db ROCKET_HIDEOUT_4, $01, Show + db ROCKET_HIDEOUT_4, $02, Hide + db ROCKET_HIDEOUT_4, $03, Hide + db ROCKET_HIDEOUT_4, $05, Show + db ROCKET_HIDEOUT_4, $06, Show + db ROCKET_HIDEOUT_4, $07, Show + db ROCKET_HIDEOUT_4, $08, Hide + db ROCKET_HIDEOUT_4, $09, Hide MapHSCF: - db SILPH_CO_2F,$01,Show - db SILPH_CO_2F,$02,Show - db SILPH_CO_2F,$03,Show - db SILPH_CO_2F,$04,Show - db SILPH_CO_2F,$05,Show + db SILPH_CO_2F, $01, Show + db SILPH_CO_2F, $02, Show + db SILPH_CO_2F, $03, Show + db SILPH_CO_2F, $04, Show + db SILPH_CO_2F, $05, Show MapHSD0: - db SILPH_CO_3F,$02,Show - db SILPH_CO_3F,$03,Show - db SILPH_CO_3F,$04,Show + db SILPH_CO_3F, $02, Show + db SILPH_CO_3F, $03, Show + db SILPH_CO_3F, $04, Show MapHSD1: - db SILPH_CO_4F,$02,Show - db SILPH_CO_4F,$03,Show - db SILPH_CO_4F,$04,Show - db SILPH_CO_4F,$05,Show - db SILPH_CO_4F,$06,Show - db SILPH_CO_4F,$07,Show + db SILPH_CO_4F, $02, Show + db SILPH_CO_4F, $03, Show + db SILPH_CO_4F, $04, Show + db SILPH_CO_4F, $05, Show + db SILPH_CO_4F, $06, Show + db SILPH_CO_4F, $07, Show MapHSD2: - db SILPH_CO_5F,$02,Show - db SILPH_CO_5F,$03,Show - db SILPH_CO_5F,$04,Show - db SILPH_CO_5F,$05,Show - db SILPH_CO_5F,$06,Show - db SILPH_CO_5F,$07,Show - db SILPH_CO_5F,$08,Show + db SILPH_CO_5F, $02, Show + db SILPH_CO_5F, $03, Show + db SILPH_CO_5F, $04, Show + db SILPH_CO_5F, $05, Show + db SILPH_CO_5F, $06, Show + db SILPH_CO_5F, $07, Show + db SILPH_CO_5F, $08, Show MapHSD3: - db SILPH_CO_6F,$06,Show - db SILPH_CO_6F,$07,Show - db SILPH_CO_6F,$08,Show - db SILPH_CO_6F,$09,Show - db SILPH_CO_6F,$0A,Show + db SILPH_CO_6F, $06, Show + db SILPH_CO_6F, $07, Show + db SILPH_CO_6F, $08, Show + db SILPH_CO_6F, $09, Show + db SILPH_CO_6F, $0A, Show MapHSD4: - db SILPH_CO_7F,$05,Show - db SILPH_CO_7F,$06,Show - db SILPH_CO_7F,$07,Show - db SILPH_CO_7F,$08,Show - db SILPH_CO_7F,$09,Show - db SILPH_CO_7F,$0A,Show - db SILPH_CO_7F,$0B,Show - db SILPH_CO_7F,$0C,Show + db SILPH_CO_7F, $05, Show + db SILPH_CO_7F, $06, Show + db SILPH_CO_7F, $07, Show + db SILPH_CO_7F, $08, Show + db SILPH_CO_7F, $09, Show + db SILPH_CO_7F, $0A, Show + db SILPH_CO_7F, $0B, Show + db SILPH_CO_7F, $0C, Show MapHSD5: - db SILPH_CO_8F,$02,Show - db SILPH_CO_8F,$03,Show - db SILPH_CO_8F,$04,Show + db SILPH_CO_8F, $02, Show + db SILPH_CO_8F, $03, Show + db SILPH_CO_8F, $04, Show MapHSE9: - db SILPH_CO_9F,$02,Show - db SILPH_CO_9F,$03,Show - db SILPH_CO_9F,$04,Show + db SILPH_CO_9F, $02, Show + db SILPH_CO_9F, $03, Show + db SILPH_CO_9F, $04, Show MapHSEA: - db SILPH_CO_10F,$01,Show - db SILPH_CO_10F,$02,Show - db SILPH_CO_10F,$03,Show - db SILPH_CO_10F,$04,Show - db SILPH_CO_10F,$05,Show - db SILPH_CO_10F,$06,Show + db SILPH_CO_10F, $01, Show + db SILPH_CO_10F, $02, Show + db SILPH_CO_10F, $03, Show + db SILPH_CO_10F, $04, Show + db SILPH_CO_10F, $05, Show + db SILPH_CO_10F, $06, Show MapHSEB: - db SILPH_CO_11F,$03,Show - db SILPH_CO_11F,$04,Show - db SILPH_CO_11F,$05,Show + db SILPH_CO_11F, $03, Show + db SILPH_CO_11F, $04, Show + db SILPH_CO_11F, $05, Show + db SILPH_CO_11F, $06, Show MapHSF4: - db $F4,$02,Show + db $F4, $02, Show MapHSD6: - db MANSION_2,$02,Show + db MANSION_2, $02, Show MapHSD7: - db MANSION_3,$03,Show - db MANSION_3,$04,Show + db MANSION_3, $03, Show + db MANSION_3, $04, Show MapHSD8: - db MANSION_4,$03,Show - db MANSION_4,$04,Show - db MANSION_4,$05,Show - db MANSION_4,$06,Show - db MANSION_4,$08,Show + db MANSION_4, $03, Show + db MANSION_4, $04, Show + db MANSION_4, $05, Show + db MANSION_4, $06, Show + db MANSION_4, $08, Show MapHSD9: - db SAFARI_ZONE_EAST,$01,Show - db SAFARI_ZONE_EAST,$02,Show - db SAFARI_ZONE_EAST,$03,Show - db SAFARI_ZONE_EAST,$04,Show + db SAFARI_ZONE_EAST, $01, Show + db SAFARI_ZONE_EAST, $02, Show + db SAFARI_ZONE_EAST, $03, Show + db SAFARI_ZONE_EAST, $04, Show MapHSDA: - db SAFARI_ZONE_NORTH,$01,Show - db SAFARI_ZONE_NORTH,$02,Show + db SAFARI_ZONE_NORTH, $01, Show + db SAFARI_ZONE_NORTH, $02, Show MapHSDB: - db SAFARI_ZONE_WEST,$01,Show - db SAFARI_ZONE_WEST,$02,Show - db SAFARI_ZONE_WEST,$03,Show - db SAFARI_ZONE_WEST,$04,Show + db SAFARI_ZONE_WEST, $01, Show + db SAFARI_ZONE_WEST, $02, Show + db SAFARI_ZONE_WEST, $03, Show + db SAFARI_ZONE_WEST, $04, Show MapHSDC: - db SAFARI_ZONE_CENTER,$01,Show + db SAFARI_ZONE_CENTER, $01, Show MapHSE2: - db UNKNOWN_DUNGEON_2,$01,Show - db UNKNOWN_DUNGEON_2,$02,Show - db UNKNOWN_DUNGEON_2,$03,Show + db UNKNOWN_DUNGEON_2, $01, Show + db UNKNOWN_DUNGEON_2, $02, Show + db UNKNOWN_DUNGEON_2, $03, Show + db UNKNOWN_DUNGEON_2, $04, Show MapHSE3: - db UNKNOWN_DUNGEON_3,$01,Show - db UNKNOWN_DUNGEON_3,$02,Show - db UNKNOWN_DUNGEON_3,$03,Show + db UNKNOWN_DUNGEON_3, $01, Show + db UNKNOWN_DUNGEON_3, $02, Show + db UNKNOWN_DUNGEON_3, $03, Show + db UNKNOWN_DUNGEON_3, $04, Show + db UNKNOWN_DUNGEON_3, $05, Show MapHS6C: - db VICTORY_ROAD_1,$03,Show - db VICTORY_ROAD_1,$04,Show + db VICTORY_ROAD_1, $03, Show + db VICTORY_ROAD_1, $04, Show MapHS78: - db CHAMPIONS_ROOM,$02,Hide + db CHAMPIONS_ROOM, $02, Hide MapHSC0: - db SEAFOAM_ISLANDS_1,$01,Show - db SEAFOAM_ISLANDS_1,$02,Show + db SEAFOAM_ISLANDS_1, $01, Show + db SEAFOAM_ISLANDS_1, $02, Show MapHS9F: - db SEAFOAM_ISLANDS_2,$01,Hide - db SEAFOAM_ISLANDS_2,$02,Hide + db SEAFOAM_ISLANDS_2, $01, Hide + db SEAFOAM_ISLANDS_2, $02, Hide MapHSA0: - db SEAFOAM_ISLANDS_3,$01,Hide - db SEAFOAM_ISLANDS_3,$02,Hide + db SEAFOAM_ISLANDS_3, $01, Hide + db SEAFOAM_ISLANDS_3, $02, Hide MapHSA1: - db SEAFOAM_ISLANDS_4,$02,Show - db SEAFOAM_ISLANDS_4,$03,Show - db SEAFOAM_ISLANDS_4,$05,Hide - db SEAFOAM_ISLANDS_4,$06,Hide + db SEAFOAM_ISLANDS_4, $02, Show + db SEAFOAM_ISLANDS_4, $03, Show + db SEAFOAM_ISLANDS_4, $05, Hide + db SEAFOAM_ISLANDS_4, $06, Hide MapHSA2: - db SEAFOAM_ISLANDS_5,$01,Hide - db SEAFOAM_ISLANDS_5,$02,Hide - db SEAFOAM_ISLANDS_5,$03,Show + db SEAFOAM_ISLANDS_5, $01, Hide + db SEAFOAM_ISLANDS_5, $02, Hide + db SEAFOAM_ISLANDS_5, $03, Show + +MapHS27Copy: +; doesn't seem to be referenced + db BLUES_HOUSE, $01, Show + db BLUES_HOUSE, $02, Hide + db BLUES_HOUSE, $03, Show - db $FF,$01,Show + db $FF, $01, Show diff --git a/data/mapHeaders/beach_house.asm b/data/mapHeaders/beach_house.asm new file mode 100644 index 00000000..99d237f6 --- /dev/null +++ b/data/mapHeaders/beach_house.asm @@ -0,0 +1,7 @@ +BeachHouse_h: + + db BEACH_HOUSE_TILESET + db BEACH_HOUSE_HEIGHT, BEACH_HOUSE_WIDTH ; dimensions (y, x) + dw BeachHouseBlockdata,BeachHouseTextPointers,BeachHouseScript ; blocks, texts, scripts + db 0 ; connections + dw BeachHouseObjects ; objects diff --git a/data/mapHeaders/colosseum.asm b/data/mapHeaders/colosseum.asm index 67e1188b..67e1188b 100755..100644 --- a/data/mapHeaders/colosseum.asm +++ b/data/mapHeaders/colosseum.asm diff --git a/data/mapHeaders/tradecenter.asm b/data/mapHeaders/tradecenter.asm index 09217ff0..09217ff0 100755..100644 --- a/data/mapHeaders/tradecenter.asm +++ b/data/mapHeaders/tradecenter.asm diff --git a/data/mapObjects/beach_house.asm b/data/mapObjects/beach_house.asm new file mode 100644 index 00000000..847883d1 --- /dev/null +++ b/data/mapObjects/beach_house.asm @@ -0,0 +1,20 @@ +BeachHouseObjects: ; 0xf23a4 + db $a ; border block + + db 2 ; warps + db 7,2,0,$ff + db 7,3,0,$ff + + db 4 ; signs + db 0,3,3 + db 0,7,4 + db 0,$b,5 + db 1,$d,6 + + db 2 ; objects + object SPRITE_FISHER, 2, 3, STAY, DOWN, 1 ; surfin' dude + object $3d, 5, 3, WALK, $01, 2 ; pikachu + + ; warp-to + EVENT_DISP BEACH_HOUSE_WIDTH,7,2 + EVENT_DISP BEACH_HOUSE_WIDTH,7,3 diff --git a/data/mapObjects/blueshouse.asm b/data/mapObjects/blueshouse.asm index 231e852d..08b11853 100755 --- a/data/mapObjects/blueshouse.asm +++ b/data/mapObjects/blueshouse.asm @@ -8,9 +8,9 @@ BluesHouseObject: db $0 ; signs db $3 ; objects - object SPRITE_DAISY, $2, $3, STAY, RIGHT, $1 ; Daisy, sitting by map - object SPRITE_DAISY, $6, $4, WALK, $1, $2, $0 ; Daisy, walking around - object SPRITE_BOOK_MAP_DEX, $3, $3, STAY, NONE, $3, $0 ; map on table + object SPRITE_DAISY, $2, $3, STAY, RIGHT, $81, $0 ; Daisy, sitting by map + object SPRITE_DAISY, $6, $4, WALK, $1, $82, $0 ; Daisy, walking around + object SPRITE_BOOK_MAP_DEX, $3, $3, STAY, NONE, $83, $0 ; map on table ; warp-to EVENT_DISP BLUES_HOUSE_WIDTH, $7, $2 diff --git a/data/mapObjects/celadongamecorner.asm b/data/mapObjects/celadongamecorner.asm index 46b1c906..af59d2b1 100755 --- a/data/mapObjects/celadongamecorner.asm +++ b/data/mapObjects/celadongamecorner.asm @@ -18,8 +18,8 @@ CeladonGameCornerObject: object SPRITE_MOM_GEISHA, $8, $b, STAY, LEFT, $6 ; person object SPRITE_GYM_HELPER, $8, $e, STAY, LEFT, $7 ; person object SPRITE_GAMBLER, $b, $f, STAY, RIGHT, $8 ; person - object SPRITE_MART_GUY, $e, $b, STAY, LEFT, $9 ; person - object SPRITE_GENTLEMAN, $11, $d, STAY, RIGHT, $a ; person + object SPRITE_FAT_BALD_GUY, $e, $b, STAY, LEFT, $9 ; person + object SPRITE_FISHER, $11, $d, STAY, RIGHT, $a ; person object SPRITE_ROCKET, $9, $5, STAY, UP, $b, OPP_ROCKET, $7 ; warp-to diff --git a/data/mapObjects/celadonmart3.asm b/data/mapObjects/celadonmart3.asm index 41054371..45f12b2c 100755 --- a/data/mapObjects/celadonmart3.asm +++ b/data/mapObjects/celadonmart3.asm @@ -22,9 +22,9 @@ CeladonMart3Object: db $5 ; objects object SPRITE_MART_GUY, $10, $5, STAY, NONE, $1 ; person - object SPRITE_GAMEBOY_KID_COPY, $b, $6, STAY, RIGHT, $2 ; person - object SPRITE_GAMEBOY_KID_COPY, $7, $2, STAY, DOWN, $3 ; person - object SPRITE_GAMEBOY_KID_COPY, $8, $2, STAY, DOWN, $4 ; person + object SPRITE_GAMEBOY_KID, $b, $6, STAY, RIGHT, $2 ; person + object SPRITE_GAMEBOY_KID, $7, $2, STAY, DOWN, $3 ; person + object SPRITE_GAMEBOY_KID, $8, $2, STAY, DOWN, $4 ; person object SPRITE_YOUNG_BOY, $2, $5, STAY, UP, $5 ; person ; warp-to diff --git a/data/mapObjects/celadonpokecenter.asm b/data/mapObjects/celadonpokecenter.asm index c4ce1700..6691eaaa 100755 --- a/data/mapObjects/celadonpokecenter.asm +++ b/data/mapObjects/celadonpokecenter.asm @@ -7,11 +7,12 @@ CeladonPokecenterObject: db $0 ; signs - db $4 ; objects + db $5 ; objects object SPRITE_NURSE, $3, $1, STAY, DOWN, $1 ; person - object SPRITE_GENTLEMAN, $7, $3, WALK, $2, $2 ; person + object SPRITE_GENTLEMAN, $7, $3, STAY, DOWN, $2 ; person object SPRITE_FOULARD_WOMAN, $a, $5, WALK, $0, $3 ; person object SPRITE_CABLE_CLUB_WOMAN, $b, $2, STAY, DOWN, $4 ; person + object SPRITE_CHANSEY, $4, $1, STAY, DOWN, $5 ; person ; warp-to EVENT_DISP CELADON_POKECENTER_WIDTH, $7, $3 diff --git a/data/mapObjects/ceruleancity.asm b/data/mapObjects/ceruleancity.asm index b6317e2c..318f03b9 100755 --- a/data/mapObjects/ceruleancity.asm +++ b/data/mapObjects/ceruleancity.asm @@ -1,5 +1,5 @@ CeruleanCityObject: - db $f ; border block + db $a ; border block db $a ; warps db $b, $1b, $0, TRASHED_HOUSE @@ -27,12 +27,12 @@ CeruleanCityObject: object SPRITE_BLACK_HAIR_BOY_1, $1f, $14, STAY, DOWN, $3 ; person object SPRITE_BLACK_HAIR_BOY_2, $f, $12, WALK, $1, $4 ; person object SPRITE_BLACK_HAIR_BOY_2, $9, $15, WALK, $2, $5 ; person - object SPRITE_GUARD, $1c, $c, STAY, DOWN, $6 ; person + object SPRITE_OFFICER_JENNY, $1c, $c, STAY, DOWN, $6 ; person object SPRITE_LASS, $1d, $1a, STAY, LEFT, $7 ; person - object SPRITE_SLOWBRO, $1c, $1a, STAY, DOWN, $8 ; person + object SPRITE_BALL, $1c, $1a, STAY, DOWN, $8 ; person object SPRITE_LASS, $9, $1b, WALK, $2, $9 ; person object SPRITE_BLACK_HAIR_BOY_2, $4, $c, STAY, DOWN, $a ; person - object SPRITE_GUARD, $1b, $c, STAY, DOWN, $b ; person + object SPRITE_OFFICER_JENNY, $1b, $c, STAY, DOWN, $b ; person ; warp-to EVENT_DISP CERULEAN_CITY_WIDTH, $b, $1b ; TRASHED_HOUSE diff --git a/data/mapObjects/ceruleanhouse1.asm b/data/mapObjects/ceruleanhouse1.asm index 27373825..97e5b52d 100755 --- a/data/mapObjects/ceruleanhouse1.asm +++ b/data/mapObjects/ceruleanhouse1.asm @@ -7,9 +7,11 @@ CeruleanHouse1Object: db $0 ; signs - db $2 ; objects - object SPRITE_OLD_MEDIUM_WOMAN, $5, $4, STAY, LEFT, $1 ; person - object SPRITE_GAMBLER, $1, $2, STAY, NONE, $2 ; person + db $4 ; objects + object SPRITE_GIRL, $3, $1, STAY, DOWN, $1 ; person + object SPRITE_BULBASAUR, $4, $1, STAY, DOWN, $2 ; person + object SPRITE_ODDISH, $1, $4, STAY, NONE, $3 ; person + object SPRITE_SANDSHREW, $5, $3, STAY, LEFT, $4 ; person ; warp-to EVENT_DISP CERULEAN_HOUSE_1_WIDTH, $7, $2 diff --git a/data/mapObjects/ceruleanpokecenter.asm b/data/mapObjects/ceruleanpokecenter.asm index 1e92ec07..a8ad26d4 100755 --- a/data/mapObjects/ceruleanpokecenter.asm +++ b/data/mapObjects/ceruleanpokecenter.asm @@ -7,11 +7,12 @@ CeruleanPokecenterObject: db $0 ; signs - db $4 ; objects + db $5 ; objects object SPRITE_NURSE, $3, $1, STAY, DOWN, $1 ; person object SPRITE_BLACK_HAIR_BOY_2, $a, $5, WALK, $0, $2 ; person - object SPRITE_GENTLEMAN, $4, $3, STAY, DOWN, $3 ; person + object SPRITE_GENTLEMAN, $4, $3, STAY, UP, $3 ; person object SPRITE_CABLE_CLUB_WOMAN, $b, $2, STAY, DOWN, $4 ; person + object SPRITE_CHANSEY, $4, $1, STAY, DOWN, $5 ; person ; warp-to EVENT_DISP CERULEAN_POKECENTER_WIDTH, $7, $3 diff --git a/data/mapObjects/cinnabargym.asm b/data/mapObjects/cinnabargym.asm index 24bdba3d..28960150 100755 --- a/data/mapObjects/cinnabargym.asm +++ b/data/mapObjects/cinnabargym.asm @@ -8,7 +8,7 @@ CinnabarGymObject: db $0 ; signs db $9 ; objects - object SPRITE_FAT_BALD_GUY, $3, $3, STAY, DOWN, $1, OPP_BLAINE, $1 + object SPRITE_MR_MASTERBALL, $3, $3, STAY, DOWN, $1, OPP_BLAINE, $1 object SPRITE_BLACK_HAIR_BOY_2, $11, $2, STAY, DOWN, $2, OPP_SUPER_NERD, $9 object SPRITE_BLACK_HAIR_BOY_2, $11, $8, STAY, DOWN, $3, OPP_BURGLAR, $4 object SPRITE_BLACK_HAIR_BOY_2, $b, $4, STAY, DOWN, $4, OPP_SUPER_NERD, $a diff --git a/data/mapObjects/cinnabarpokecenter.asm b/data/mapObjects/cinnabarpokecenter.asm index 7d15f050..b9779eb5 100755 --- a/data/mapObjects/cinnabarpokecenter.asm +++ b/data/mapObjects/cinnabarpokecenter.asm @@ -7,11 +7,12 @@ CinnabarPokecenterObject: db $0 ; signs - db $4 ; objects + db $5 ; objects object SPRITE_NURSE, $3, $1, STAY, DOWN, $1 ; person object SPRITE_LASS, $9, $4, WALK, $0, $2 ; person object SPRITE_GENTLEMAN, $2, $6, STAY, NONE, $3 ; person object SPRITE_CABLE_CLUB_WOMAN, $b, $2, STAY, DOWN, $4 ; person + object SPRITE_CHANSEY, $4, $1, STAY, DOWN, $5 ; person ; warp-to EVENT_DISP CINNABAR_POKECENTER_WIDTH, $7, $3 diff --git a/data/mapObjects/colosseum.asm b/data/mapObjects/colosseum.asm index 91fea6b9..91fea6b9 100755..100644 --- a/data/mapObjects/colosseum.asm +++ b/data/mapObjects/colosseum.asm diff --git a/data/mapObjects/copycatshouse1f.asm b/data/mapObjects/copycatshouse1f.asm index 7d842cad..c6702cfa 100755 --- a/data/mapObjects/copycatshouse1f.asm +++ b/data/mapObjects/copycatshouse1f.asm @@ -11,7 +11,7 @@ CopycatsHouse1FObject: db $3 ; objects object SPRITE_MOM_GEISHA, $2, $2, STAY, DOWN, $1 ; person object SPRITE_FAT_BALD_GUY, $5, $4, STAY, LEFT, $2 ; person - object SPRITE_CLEFAIRY, $1, $4, WALK, $1, $3 ; person + object SPRITE_CHANSEY, $1, $4, STAY, NONE, $3 ; person ; warp-to EVENT_DISP COPYCATS_HOUSE_1F_WIDTH, $7, $2 diff --git a/data/mapObjects/fanclub.asm b/data/mapObjects/fanclub.asm index f0f544ef..1dbb2dca 100755 --- a/data/mapObjects/fanclub.asm +++ b/data/mapObjects/fanclub.asm @@ -5,14 +5,12 @@ FanClubObject: db $7, $2, $1, $ff db $7, $3, $1, $ff - db $2 ; signs - db $0, $1, $7 ; FanClubText7 - db $0, $6, $8 ; FanClubText8 + db $0 ; signs db $6 ; objects object SPRITE_FISHER2, $6, $3, STAY, LEFT, $1 ; person object SPRITE_GIRL, $1, $3, STAY, RIGHT, $2 ; person - object SPRITE_CLEFAIRY, $6, $4, STAY, LEFT, $3 ; person + object SPRITE_CLEFAIRY_2, $6, $4, STAY, LEFT, $3 ; person object SPRITE_SEEL, $1, $4, STAY, RIGHT, $4 ; person object SPRITE_GENTLEMAN, $3, $1, STAY, DOWN, $5 ; person object SPRITE_CABLE_CLUB_WOMAN, $5, $1, STAY, DOWN, $6 ; person diff --git a/data/mapObjects/fuchsiacity.asm b/data/mapObjects/fuchsiacity.asm index bcca4004..f4bb842b 100755 --- a/data/mapObjects/fuchsiacity.asm +++ b/data/mapObjects/fuchsiacity.asm @@ -33,7 +33,7 @@ FuchsiaCityObject: object SPRITE_GAMBLER, $1c, $11, WALK, $2, $2 ; person object SPRITE_FISHER2, $1e, $e, STAY, DOWN, $3 ; person object SPRITE_BUG_CATCHER, $18, $8, STAY, UP, $4 ; person - object SPRITE_CLEFAIRY, $1f, $5, WALK, $0, $5 ; person + object SPRITE_CHANSEY, $1f, $5, STAY, DOWN, $5 ; person object SPRITE_BALL, $19, $6, STAY, NONE, $6 ; person object SPRITE_SLOWBRO, $c, $6, WALK, $2, $7 ; person object SPRITE_SLOWBRO, $1e, $c, WALK, $2, $8 ; person diff --git a/data/mapObjects/fuchsiagym.asm b/data/mapObjects/fuchsiagym.asm index 023c23d3..86f62d21 100755 --- a/data/mapObjects/fuchsiagym.asm +++ b/data/mapObjects/fuchsiagym.asm @@ -8,7 +8,7 @@ FuchsiaGymObject: db $0 ; signs db $8 ; objects - object SPRITE_BLACKBELT, $4, $a, STAY, DOWN, $1, OPP_KOGA, $1 + object SPRITE_LAPRAS_GIVER, $4, $a, STAY, DOWN, $1, OPP_KOGA, $1 object SPRITE_ROCKER, $8, $d, STAY, DOWN, $2, OPP_JUGGLER, $7 object SPRITE_ROCKER, $7, $8, STAY, RIGHT, $3, OPP_JUGGLER, $3 object SPRITE_ROCKER, $1, $c, STAY, DOWN, $4, OPP_JUGGLER, $8 diff --git a/data/mapObjects/fuchsiapokecenter.asm b/data/mapObjects/fuchsiapokecenter.asm index 8cf103fa..bf9abe99 100755 --- a/data/mapObjects/fuchsiapokecenter.asm +++ b/data/mapObjects/fuchsiapokecenter.asm @@ -7,11 +7,12 @@ FuchsiaPokecenterObject: db $0 ; signs - db $4 ; objects + db $5 ; objects object SPRITE_NURSE, $3, $1, STAY, DOWN, $1 ; person - object SPRITE_ROCKER, $2, $3, STAY, NONE, $2 ; person + object SPRITE_ROCKER, $4, $3, STAY, UP, $2 ; person object SPRITE_LASS, $6, $5, WALK, $2, $3 ; person object SPRITE_CABLE_CLUB_WOMAN, $b, $2, STAY, DOWN, $4 ; person + object SPRITE_CHANSEY, $4, $1, STAY, DOWN, $5 ; person ; warp-to EVENT_DISP FUCHSIA_POKECENTER_WIDTH, $7, $3 diff --git a/data/mapObjects/indigoplateaulobby.asm b/data/mapObjects/indigoplateaulobby.asm index 13438153..dbeaa85b 100755 --- a/data/mapObjects/indigoplateaulobby.asm +++ b/data/mapObjects/indigoplateaulobby.asm @@ -8,12 +8,13 @@ IndigoPlateauLobbyObject: db $0 ; signs - db $5 ; objects + db $6 ; objects object SPRITE_NURSE, $7, $5, STAY, DOWN, $1 ; person object SPRITE_GYM_HELPER, $4, $9, STAY, RIGHT, $2 ; person object SPRITE_LASS, $5, $1, STAY, DOWN, $3 ; person object SPRITE_MART_GUY, $0, $5, STAY, RIGHT, $4 ; person object SPRITE_CABLE_CLUB_WOMAN, $d, $6, STAY, DOWN, $5 ; person + object SPRITE_CHANSEY, $8, $5, STAY, DOWN, $6 ; person ; warp-to EVENT_DISP INDIGO_PLATEAU_LOBBY_WIDTH, $b, $7 diff --git a/data/mapObjects/lavenderpokecenter.asm b/data/mapObjects/lavenderpokecenter.asm index 617e7fb8..f98cede4 100755 --- a/data/mapObjects/lavenderpokecenter.asm +++ b/data/mapObjects/lavenderpokecenter.asm @@ -7,11 +7,12 @@ LavenderPokecenterObject: db $0 ; signs - db $4 ; objects + db $5 ; objects object SPRITE_NURSE, $3, $1, STAY, DOWN, $1 ; person object SPRITE_GENTLEMAN, $5, $3, STAY, NONE, $2 ; person - object SPRITE_LITTLE_GIRL, $2, $6, WALK, $1, $3 ; person + object SPRITE_LITTLE_GIRL, $a, $5, WALK, $2, $3 ; person object SPRITE_CABLE_CLUB_WOMAN, $b, $2, STAY, DOWN, $4 ; person + object SPRITE_CHANSEY, $4, $1, STAY, DOWN, $5 ; person ; warp-to EVENT_DISP LAVENDER_POKECENTER_WIDTH, $7, $3 diff --git a/data/mapObjects/mtmoon3.asm b/data/mapObjects/mtmoon3.asm index 7fe29180..43891ec3 100755 --- a/data/mapObjects/mtmoon3.asm +++ b/data/mapObjects/mtmoon3.asm @@ -9,16 +9,17 @@ MtMoon3Object: db $0 ; signs - db $9 ; objects + db $a ; objects object SPRITE_BLACK_HAIR_BOY_2, $c, $8, STAY, RIGHT, $1, OPP_SUPER_NERD, $2 - object SPRITE_ROCKET, $b, $10, STAY, DOWN, $2, OPP_ROCKET, $1 + object SPRITE_JESSIE, $9, $3, STAY, LEFT, $2 object SPRITE_ROCKET, $f, $16, STAY, DOWN, $3, OPP_ROCKET, $2 object SPRITE_ROCKET, $1d, $b, STAY, UP, $4, OPP_ROCKET, $3 - object SPRITE_ROCKET, $1d, $11, STAY, LEFT, $5, OPP_ROCKET, $4 - object SPRITE_OMANYTE, $c, $6, STAY, NONE, $6 ; person - object SPRITE_OMANYTE, $d, $6, STAY, NONE, $7 ; person - object SPRITE_BALL, $19, $15, STAY, NONE, $8, HP_UP - object SPRITE_BALL, $1d, $5, STAY, NONE, $9, TM_01 + object SPRITE_ROCKET, $1d, $11, STAY, LEFT, $5, OPP_ROCKET, $1 + object SPRITE_JAMES, $9, $4, STAY, LEFT, $6 + object SPRITE_OMANYTE, $c, $6, STAY, NONE, $7 ; person + object SPRITE_OMANYTE, $d, $6, STAY, NONE, $8 ; person + object SPRITE_BALL, $19, $15, STAY, NONE, $9, HP_UP + object SPRITE_BALL, $1d, $5, STAY, NONE, $a, TM_01 ; warp-to EVENT_DISP MT_MOON_3_WIDTH, $9, $19 ; MT_MOON_2 diff --git a/data/mapObjects/mtmoonpokecenter.asm b/data/mapObjects/mtmoonpokecenter.asm index 1e168895..d1ac34fb 100755 --- a/data/mapObjects/mtmoonpokecenter.asm +++ b/data/mapObjects/mtmoonpokecenter.asm @@ -7,13 +7,14 @@ MtMoonPokecenterObject: db $0 ; signs - db $6 ; objects + db $7 ; objects object SPRITE_NURSE, $3, $1, STAY, DOWN, $1 ; person object SPRITE_BUG_CATCHER, $4, $3, STAY, UP, $2 ; person object SPRITE_GENTLEMAN, $7, $3, STAY, UP, $3 ; person object SPRITE_FAT_BALD_GUY, $a, $6, WALK, $2, $4 ; person object SPRITE_CLIPBOARD, $7, $2, STAY, NONE, $5 ; person object SPRITE_CABLE_CLUB_WOMAN, $b, $2, STAY, DOWN, $6 ; person + object SPRITE_CHANSEY, $4, $1, STAY, DOWN, $7 ; person ; warp-to EVENT_DISP MT_MOON_POKECENTER_WIDTH, $7, $3 diff --git a/data/mapObjects/oakslab.asm b/data/mapObjects/oakslab.asm index 3834c49a..1efb1e72 100755 --- a/data/mapObjects/oakslab.asm +++ b/data/mapObjects/oakslab.asm @@ -7,18 +7,16 @@ OaksLabObject: db $0 ; signs - db $b ; objects + db $9 ; objects object SPRITE_BLUE, $4, $3, STAY, NONE, $1, OPP_SONY1, $1 - object SPRITE_BALL, $6, $3, STAY, NONE, $2 ; person - object SPRITE_BALL, $7, $3, STAY, NONE, $3 ; person - object SPRITE_BALL, $8, $3, STAY, NONE, $4 ; person - object SPRITE_OAK, $5, $2, STAY, DOWN, $5 ; person - object SPRITE_BOOK_MAP_DEX, $2, $1, STAY, NONE, $6 ; person - object SPRITE_BOOK_MAP_DEX, $3, $1, STAY, NONE, $7 ; person - object SPRITE_OAK, $5, $a, STAY, UP, $8 ; person - object SPRITE_GIRL, $1, $9, WALK, $1, $9 ; person - object SPRITE_OAK_AIDE, $2, $a, STAY, NONE, $a ; person - object SPRITE_OAK_AIDE, $8, $a, STAY, NONE, $b ; person + object SPRITE_BALL, $7, $3, STAY, NONE, $2 ; person + object SPRITE_OAK, $5, $2, STAY, DOWN, $3 ; person + object SPRITE_BOOK_MAP_DEX, $2, $1, STAY, NONE, $4 ; person + object SPRITE_BOOK_MAP_DEX, $3, $1, STAY, NONE, $5 ; person + object SPRITE_OAK, $5, $a, STAY, UP, $6 ; person + object SPRITE_GIRL, $1, $9, WALK, $1, $7 ; person + object SPRITE_OAK_AIDE, $2, $a, STAY, NONE, $8 ; person + object SPRITE_OAK_AIDE, $8, $a, STAY, NONE, $9 ; person ; warp-to EVENT_DISP OAKS_LAB_WIDTH, $b, $4 diff --git a/data/mapObjects/pallettown.asm b/data/mapObjects/pallettown.asm index d02cbae2..e22f79a6 100755 --- a/data/mapObjects/pallettown.asm +++ b/data/mapObjects/pallettown.asm @@ -13,7 +13,7 @@ PalletTownObject: db $5, $b, $7 ; PalletTownText7 db $3 ; objects - object SPRITE_OAK, $8, $5, STAY, NONE, $1 ; person + object SPRITE_OAK, $a, $4, STAY, NONE, $1 ; person object SPRITE_GIRL, $3, $8, WALK, $0, $2 ; person object SPRITE_FISHER2, $b, $e, WALK, $0, $3 ; person diff --git a/data/mapObjects/pewterpokecenter.asm b/data/mapObjects/pewterpokecenter.asm index 44e10ed6..4c7444bb 100755 --- a/data/mapObjects/pewterpokecenter.asm +++ b/data/mapObjects/pewterpokecenter.asm @@ -7,11 +7,13 @@ PewterPokecenterObject: db $0 ; signs - db $4 ; objects + db $6 ; objects object SPRITE_NURSE, $3, $1, STAY, DOWN, $1 ; person object SPRITE_GENTLEMAN, $b, $7, STAY, LEFT, $2 ; person - object SPRITE_CLEFAIRY, $1, $3, STAY, DOWN, $3 ; person + object SPRITE_JIGGLYPUFF, $1, $3, STAY, DOWN, $3 ; person object SPRITE_CABLE_CLUB_WOMAN, $b, $2, STAY, DOWN, $4 ; person + object SPRITE_LASS, $4, $3, STAY, UP, $5 ; person + object SPRITE_CHANSEY, $4, $1, STAY, DOWN, $6 ; person ; warp-to EVENT_DISP PEWTER_POKECENTER_WIDTH, $7, $3 diff --git a/data/mapObjects/pokemontower7.asm b/data/mapObjects/pokemontower7.asm index 6ee1e8fd..76435c04 100755 --- a/data/mapObjects/pokemontower7.asm +++ b/data/mapObjects/pokemontower7.asm @@ -6,11 +6,10 @@ PokemonTower7Object: db $0 ; signs - db 4 ; objects - object SPRITE_ROCKET, $9, $b, STAY, RIGHT, $1, OPP_ROCKET, $13 - object SPRITE_ROCKET, $c, $9, STAY, LEFT, $2, OPP_ROCKET, $14 - object SPRITE_ROCKET, $9, $7, STAY, RIGHT, $3, OPP_ROCKET, $15 - object SPRITE_MR_FUJI, $a, $3, STAY, DOWN, $4 ; person + db $3 ; objects + object SPRITE_JESSIE, $a, $8, STAY, DOWN, $1 + object SPRITE_JAMES, $b, $8, STAY, DOWN, $2 + object SPRITE_MR_FUJI, $a, $3, STAY, DOWN, $3 ; warp-to EVENT_DISP POKEMONTOWER_7_WIDTH, $10, $9 ; POKEMONTOWER_6 diff --git a/data/mapObjects/rockethideout4.asm b/data/mapObjects/rockethideout4.asm index b4e98d04..42e58b23 100755 --- a/data/mapObjects/rockethideout4.asm +++ b/data/mapObjects/rockethideout4.asm @@ -10,8 +10,8 @@ RocketHideout4Object: db $9 ; objects object SPRITE_GIOVANNI, $19, $3, STAY, DOWN, $1, OPP_GIOVANNI, $1 - object SPRITE_ROCKET, $17, $c, STAY, DOWN, $2, OPP_ROCKET, $10 - object SPRITE_ROCKET, $1a, $c, STAY, DOWN, $3, OPP_ROCKET, $11 + object SPRITE_JAMES, $19, $a, STAY, DOWN, $2 + object SPRITE_JESSIE, $18, $a, STAY, DOWN, $3 object SPRITE_ROCKET, $b, $2, STAY, DOWN, $4, OPP_ROCKET, $12 object SPRITE_BALL, $a, $c, STAY, NONE, $5, HP_UP object SPRITE_BALL, $9, $4, STAY, NONE, $6, TM_02 diff --git a/data/mapObjects/rocktunnelpokecenter.asm b/data/mapObjects/rocktunnelpokecenter.asm index 90efc3ea..06a2e39d 100755 --- a/data/mapObjects/rocktunnelpokecenter.asm +++ b/data/mapObjects/rocktunnelpokecenter.asm @@ -7,11 +7,12 @@ RockTunnelPokecenterObject: db $0 ; signs - db $4 ; objects + db $5 ; objects object SPRITE_NURSE, $3, $1, STAY, DOWN, $1 ; person - object SPRITE_GENTLEMAN, $7, $3, WALK, $2, $2 ; person + object SPRITE_GENTLEMAN, $7, $3, STAY, DOWN, $2 ; person object SPRITE_FISHER2, $2, $5, STAY, NONE, $3 ; person object SPRITE_CABLE_CLUB_WOMAN, $b, $2, STAY, DOWN, $4 ; person + object SPRITE_CHANSEY, $4, $1, STAY, DOWN, $5 ; person ; warp-to EVENT_DISP ROCK_TUNNEL_POKECENTER_WIDTH, $7, $3 diff --git a/data/mapObjects/route11.asm b/data/mapObjects/route11.asm index 0c7828f2..8b6b5d3f 100755 --- a/data/mapObjects/route11.asm +++ b/data/mapObjects/route11.asm @@ -3,9 +3,9 @@ Route11Object: db $5 ; warps db $8, $31, $0, ROUTE_11_GATE_1F - db $9, $31, $1, ROUTE_11_GATE_1F + db $9, $31, $0, ROUTE_11_GATE_1F db $8, $3a, $2, ROUTE_11_GATE_1F - db $9, $3a, $3, ROUTE_11_GATE_1F + db $9, $3a, $2, ROUTE_11_GATE_1F db $5, $4, $0, DIGLETTS_CAVE_ENTRANCE db $1 ; signs diff --git a/data/mapObjects/route12.asm b/data/mapObjects/route12.asm index dd461e6c..2dc7f9e7 100755 --- a/data/mapObjects/route12.asm +++ b/data/mapObjects/route12.asm @@ -3,7 +3,7 @@ Route12Object: db $4 ; warps db $f, $a, $0, ROUTE_12_GATE_1F - db $f, $b, $1, ROUTE_12_GATE_1F + db $f, $b, $0, ROUTE_12_GATE_1F db $15, $a, $2, ROUTE_12_GATE_1F db $4d, $b, $0, ROUTE_12_HOUSE diff --git a/data/mapObjects/route15.asm b/data/mapObjects/route15.asm index 1d83b20d..30fc39c4 100755 --- a/data/mapObjects/route15.asm +++ b/data/mapObjects/route15.asm @@ -3,9 +3,9 @@ Route15Object: db $4 ; warps db $8, $7, $0, ROUTE_15_GATE_1F - db $9, $7, $1, ROUTE_15_GATE_1F + db $9, $7, $0, ROUTE_15_GATE_1F db $8, $e, $2, ROUTE_15_GATE_1F - db $9, $e, $3, ROUTE_15_GATE_1F + db $9, $e, $2, ROUTE_15_GATE_1F db $1 ; signs db $9, $27, $c ; Route15Text12 diff --git a/data/mapObjects/route16.asm b/data/mapObjects/route16.asm index a342d106..b7da1dbb 100755 --- a/data/mapObjects/route16.asm +++ b/data/mapObjects/route16.asm @@ -3,13 +3,13 @@ Route16Object: db $9 ; warps db $a, $11, $0, ROUTE_16_GATE_1F - db $b, $11, $1, ROUTE_16_GATE_1F + db $b, $11, $0, ROUTE_16_GATE_1F db $a, $18, $2, ROUTE_16_GATE_1F - db $b, $18, $3, ROUTE_16_GATE_1F + db $b, $18, $2, ROUTE_16_GATE_1F db $4, $11, $4, ROUTE_16_GATE_1F - db $5, $11, $5, ROUTE_16_GATE_1F + db $5, $11, $4, ROUTE_16_GATE_1F db $4, $18, $6, ROUTE_16_GATE_1F - db $5, $18, $7, ROUTE_16_GATE_1F + db $5, $18, $6, ROUTE_16_GATE_1F db $5, $7, $0, ROUTE_16_HOUSE db $2 ; signs diff --git a/data/mapObjects/route18.asm b/data/mapObjects/route18.asm index 8b36ab7c..41b971b0 100755 --- a/data/mapObjects/route18.asm +++ b/data/mapObjects/route18.asm @@ -3,9 +3,9 @@ Route18Object: db $4 ; warps db $8, $21, $0, ROUTE_18_GATE_1F - db $9, $21, $1, ROUTE_18_GATE_1F + db $9, $21, $0, ROUTE_18_GATE_1F db $8, $28, $2, ROUTE_18_GATE_1F - db $9, $28, $3, ROUTE_18_GATE_1F + db $9, $28, $2, ROUTE_18_GATE_1F db $2 ; signs db $7, $2b, $4 ; Route18Text4 diff --git a/data/mapObjects/route18gateupstairs.asm b/data/mapObjects/route18gateupstairs.asm index 671b3215..1ad911e8 100755 --- a/data/mapObjects/route18gateupstairs.asm +++ b/data/mapObjects/route18gateupstairs.asm @@ -9,7 +9,7 @@ Route18GateUpstairsObject: db $2, $6, $3 ; Route18GateUpstairsText3 db $1 ; objects - object SPRITE_BUG_CATCHER, $4, $2, WALK, $2, $1 ; person + object SPRITE_COOK, $4, $2, WALK, $2, $1 ; person ; warp-to EVENT_DISP ROUTE_18_GATE_2F_WIDTH, $7, $7 ; ROUTE_18_GATE_1F diff --git a/data/mapObjects/route19.asm b/data/mapObjects/route19.asm index 956caa6e..0f963cfd 100755 --- a/data/mapObjects/route19.asm +++ b/data/mapObjects/route19.asm @@ -1,21 +1,24 @@ Route19Object: db $43 ; border block - db $0 ; warps + db $1 ; warps + db $9, $5, $0, BEACH_HOUSE db $1 ; signs - db $9, $b, $b ; Route19Text11 + db $b,$b,$b db $a ; objects - object SPRITE_BLACK_HAIR_BOY_1, $8, $7, STAY, LEFT, 1, OPP_SWIMMER, 2 - object SPRITE_BLACK_HAIR_BOY_1, $d, $7, STAY, LEFT, 2, OPP_SWIMMER, 3 - object SPRITE_SWIMMER, $d, $19, STAY, LEFT, $3, OPP_SWIMMER, $4 - object SPRITE_SWIMMER, $4, $1b, STAY, RIGHT, $4, OPP_SWIMMER, $5 - object SPRITE_SWIMMER, $10, $1f, STAY, UP, $5, OPP_SWIMMER, $6 - object SPRITE_SWIMMER, $9, $b, STAY, DOWN, $6, OPP_SWIMMER, $7 - object SPRITE_SWIMMER, $8, $2b, STAY, LEFT, $7, OPP_BEAUTY, $c - object SPRITE_SWIMMER, $b, $2b, STAY, RIGHT, $8, OPP_BEAUTY, $d - object SPRITE_SWIMMER, $9, $2a, STAY, UP, $9, OPP_SWIMMER, $8 - object SPRITE_SWIMMER, $a, $2c, STAY, DOWN, $a, OPP_BEAUTY, $e + + object SPRITE_BLACK_HAIR_BOY_1, $09, $07, STAY, RIGHT, $1, OPP_SWIMMER, $2 + object SPRITE_BLACK_HAIR_BOY_1, $0c, $09, STAY, LEFT, $2, OPP_SWIMMER, $3 + object SPRITE_SWIMMER, $0d, $19, STAY, LEFT, $3, OPP_SWIMMER, $4 + object SPRITE_SWIMMER, $04, $1b, STAY, RIGHT, $4, OPP_SWIMMER, $5 + object SPRITE_SWIMMER, $10, $1f, STAY, UP, $5, OPP_SWIMMER, $6 + object SPRITE_SWIMMER, $09, $0d, STAY, DOWN, $6, OPP_SWIMMER, $7 + object SPRITE_SWIMMER, $08, $2b, STAY, LEFT, $7, OPP_BEAUTY, $c + object SPRITE_SWIMMER, $0b, $2b, STAY, RIGHT, $8, OPP_BEAUTY, $d + object SPRITE_SWIMMER, $09, $2a, STAY, UP, $9, OPP_SWIMMER, $8 + object SPRITE_SWIMMER, $0a, $2c, STAY, DOWN, $a, OPP_BEAUTY, $e ; warp-to + EVENT_DISP ROUTE_19_WIDTH, $9, $5 ; BEACH_HOUSE diff --git a/data/mapObjects/route2.asm b/data/mapObjects/route2.asm index 7db8fe09..a8b0a7a5 100755 --- a/data/mapObjects/route2.asm +++ b/data/mapObjects/route2.asm @@ -1,13 +1,14 @@ Route2Object: db $f ; border block - db $6 ; warps + db $7 ; warps db $9, $c, $0, DIGLETTS_CAVE_EXIT db $b, $3, $1, VIRIDIAN_FOREST_EXIT db $13, $f, $0, ROUTE_2_HOUSE db $23, $10, $1, ROUTE_2_GATE db $27, $f, $2, ROUTE_2_GATE db $2b, $3, $2, VIRIDIAN_FOREST_ENTRANCE + db $23, $11, $1, ROUTE_2_GATE db $2 ; signs db $41, $5, $3 ; Route2Text3 @@ -24,10 +25,12 @@ Route2Object: EVENT_DISP ROUTE_2_WIDTH, $23, $10 ; ROUTE_2_GATE EVENT_DISP ROUTE_2_WIDTH, $27, $f ; ROUTE_2_GATE EVENT_DISP ROUTE_2_WIDTH, $2b, $3 ; VIRIDIAN_FOREST_ENTRANCE + EVENT_DISP ROUTE_2_WIDTH, $23, $11 ; ROUTE_2_GATE ; unused EVENT_DISP $4, $7, $2 - db $12, $c7, $9, $7 + dw $c712 + db $9, $7 EVENT_DISP $4, $7, $2 EVENT_DISP $4, $7, $2 EVENT_DISP $4, $7, $2 diff --git a/data/mapObjects/route22gate.asm b/data/mapObjects/route22gate.asm index 2798311b..e75c4d50 100755 --- a/data/mapObjects/route22gate.asm +++ b/data/mapObjects/route22gate.asm @@ -5,7 +5,7 @@ Route22GateObject: db $7, $4, $0, $ff db $7, $5, $0, $ff db $0, $4, $0, $ff - db $0, $5, $1, $ff + db $0, $5, $0, $ff db $0 ; signs diff --git a/data/mapObjects/route24.asm b/data/mapObjects/route24.asm index 5af90a4b..78a4d573 100755 --- a/data/mapObjects/route24.asm +++ b/data/mapObjects/route24.asm @@ -5,7 +5,7 @@ Route24Object: db $0 ; signs - db $8 ; objects + db $9 ; objects object SPRITE_BLACK_HAIR_BOY_1, $b, $f, STAY, LEFT, $1, OPP_ROCKET, $6 object SPRITE_BLACK_HAIR_BOY_1, $5, $14, STAY, UP, $2, OPP_JR_TRAINER_M, $2 object SPRITE_BLACK_HAIR_BOY_1, $b, $13, STAY, LEFT, $3, OPP_JR_TRAINER_M, $3 @@ -14,3 +14,4 @@ Route24Object: object SPRITE_LASS, $a, $1c, STAY, RIGHT, $6, OPP_LASS, $8 object SPRITE_BUG_CATCHER, $b, $1f, STAY, LEFT, $7, OPP_BUG_CATCHER, $9 object SPRITE_BALL, $a, $5, STAY, NONE, $8, TM_45 + object SPRITE_BLACK_HAIR_BOY_1, $6, $5, STAY, DOWN, $9 diff --git a/data/mapObjects/route2house.asm b/data/mapObjects/route2house.asm index d6665020..7d1d224d 100755 --- a/data/mapObjects/route2house.asm +++ b/data/mapObjects/route2house.asm @@ -9,7 +9,7 @@ Route2HouseObject: db $2 ; objects object SPRITE_OAK_AIDE, $2, $4, STAY, RIGHT, $1 ; person - object SPRITE_GAMEBOY_KID_COPY, $4, $1, STAY, DOWN, $2 ; person + object SPRITE_GAMEBOY_KID, $4, $1, STAY, DOWN, $2 ; person ; warp-to EVENT_DISP ROUTE_2_HOUSE_WIDTH, $7, $2 diff --git a/data/mapObjects/route5.asm b/data/mapObjects/route5.asm index 6065f599..eefcaa92 100755 --- a/data/mapObjects/route5.asm +++ b/data/mapObjects/route5.asm @@ -2,7 +2,7 @@ Route5Object: db $a ; border block db $5 ; warps - db $1d, $a, $3, ROUTE_5_GATE + db $1d, $a, $2, ROUTE_5_GATE db $1d, $9, $2, ROUTE_5_GATE db $21, $a, $0, ROUTE_5_GATE db $1b, $11, $0, PATH_ENTRANCE_ROUTE_5 diff --git a/data/mapObjects/route6.asm b/data/mapObjects/route6.asm index bfd88fac..6ab90621 100755 --- a/data/mapObjects/route6.asm +++ b/data/mapObjects/route6.asm @@ -11,8 +11,8 @@ Route6Object: db $f, $13, $7 ; Route6Text7 db $6 ; objects - object SPRITE_BLACK_HAIR_BOY_1, $a, $15, STAY, RIGHT, $1, OPP_JR_TRAINER_M, $4 - object SPRITE_LASS, $b, $15, STAY, LEFT, $2, OPP_JR_TRAINER_F, $2 + object SPRITE_BLACK_HAIR_BOY_1, $a, $15, STAY, RIGHT, $1, OPP_JR_TRAINER_M, $a + object SPRITE_LASS, $b, $15, STAY, LEFT, $2, OPP_JR_TRAINER_F, $19 object SPRITE_BUG_CATCHER, $0, $f, STAY, RIGHT, $3, OPP_BUG_CATCHER, $a object SPRITE_BLACK_HAIR_BOY_1, $b, $1f, STAY, LEFT, $4, OPP_JR_TRAINER_M, $5 object SPRITE_LASS, $b, $1e, STAY, LEFT, $5, OPP_JR_TRAINER_F, $3 diff --git a/data/mapObjects/route7.asm b/data/mapObjects/route7.asm index d039cb3c..3f753830 100755 --- a/data/mapObjects/route7.asm +++ b/data/mapObjects/route7.asm @@ -3,9 +3,9 @@ Route7Object: db $5 ; warps db $9, $12, $2, ROUTE_7_GATE - db $a, $12, $3, ROUTE_7_GATE + db $a, $12, $2, ROUTE_7_GATE db $9, $b, $0, ROUTE_7_GATE - db $a, $b, $1, ROUTE_7_GATE + db $a, $b, $0, ROUTE_7_GATE db $d, $5, $0, PATH_ENTRANCE_ROUTE_7 db $1 ; signs diff --git a/data/mapObjects/route7gate.asm b/data/mapObjects/route7gate.asm index 3aea6a88..8f65891b 100755 --- a/data/mapObjects/route7gate.asm +++ b/data/mapObjects/route7gate.asm @@ -4,7 +4,7 @@ Route7GateObject: db $4 ; warps db $3, $0, $3, $ff db $4, $0, $3, $ff - db $3, $5, $0, $ff + db $3, $5, $1, $ff db $4, $5, $1, $ff db $0 ; signs diff --git a/data/mapObjects/route8.asm b/data/mapObjects/route8.asm index 8aa16b82..8f336e03 100755 --- a/data/mapObjects/route8.asm +++ b/data/mapObjects/route8.asm @@ -3,9 +3,9 @@ Route8Object: db $5 ; warps db $9, $1, $0, ROUTE_8_GATE - db $a, $1, $1, ROUTE_8_GATE + db $a, $1, $0, ROUTE_8_GATE db $9, $8, $2, ROUTE_8_GATE - db $a, $8, $3, ROUTE_8_GATE + db $a, $8, $2, ROUTE_8_GATE db $3, $d, $0, PATH_ENTRANCE_ROUTE_8 db $1 ; signs diff --git a/data/mapObjects/route8gate.asm b/data/mapObjects/route8gate.asm index b059fb36..a3e21618 100755 --- a/data/mapObjects/route8gate.asm +++ b/data/mapObjects/route8gate.asm @@ -2,9 +2,9 @@ Route8GateObject: db $a ; border block db $4 ; warps - db $3, $0, $0, $ff + db $3, $0, $1, $ff db $4, $0, $1, $ff - db $3, $5, $2, $ff + db $3, $5, $3, $ff db $4, $5, $3, $ff db $0 ; signs diff --git a/data/mapObjects/route9.asm b/data/mapObjects/route9.asm index 9e079eab..cdfd801c 100755 --- a/data/mapObjects/route9.asm +++ b/data/mapObjects/route9.asm @@ -8,7 +8,7 @@ Route9Object: db $a ; objects object SPRITE_LASS, $d, $a, STAY, LEFT, $1, OPP_JR_TRAINER_F, $5 - object SPRITE_BLACK_HAIR_BOY_1, $18, $7, STAY, LEFT, $2, OPP_JR_TRAINER_M, $7 + object SPRITE_BLACK_HAIR_BOY_1, $18, $7, STAY, LEFT, $2, OPP_YOUNGSTER, $e object SPRITE_BLACK_HAIR_BOY_1, $1f, $7, STAY, RIGHT, $3, OPP_JR_TRAINER_M, $8 object SPRITE_LASS, $30, $8, STAY, RIGHT, $4, OPP_JR_TRAINER_F, $6 object SPRITE_HIKER, $10, $f, STAY, LEFT, $5, OPP_HIKER, $b diff --git a/data/mapObjects/saffroncity.asm b/data/mapObjects/saffroncity.asm index 7275800a..730d8be5 100755 --- a/data/mapObjects/saffroncity.asm +++ b/data/mapObjects/saffroncity.asm @@ -23,7 +23,7 @@ SaffronCityObject: db $1d, $1b, $18 ; SaffronCityText24 db $13, $1, $19 ; SaffronCityText25 - db $f ; objects + db $e ; objects object SPRITE_ROCKET, $7, $6, STAY, NONE, $1 ; person object SPRITE_ROCKET, $14, $8, WALK, $2, $2 ; person object SPRITE_ROCKET, $22, $4, STAY, NONE, $3 ; person @@ -38,7 +38,6 @@ SaffronCityObject: object SPRITE_BIRD, $1f, $c, STAY, DOWN, $c ; person object SPRITE_ROCKER, $12, $8, STAY, UP, $d ; person object SPRITE_ROCKET, $12, $16, STAY, DOWN, $e ; person - object SPRITE_ROCKET, $13, $16, STAY, DOWN, $f ; person ; warp-to EVENT_DISP SAFFRON_CITY_WIDTH, $5, $7 ; COPYCATS_HOUSE_1F diff --git a/data/mapObjects/saffrongym.asm b/data/mapObjects/saffrongym.asm index 6a770fdc..629ab760 100755 --- a/data/mapObjects/saffrongym.asm +++ b/data/mapObjects/saffrongym.asm @@ -38,7 +38,7 @@ SaffronGymObject: db $0 ; signs db $9 ; objects - object SPRITE_GIRL, $9, $8, STAY, DOWN, $1, OPP_SABRINA, $1 + object SPRITE_LASS, $9, $8, STAY, DOWN, $1, OPP_SABRINA, $1 object SPRITE_MEDIUM, $a, $1, STAY, DOWN, $2, OPP_CHANNELER, $16 object SPRITE_BUG_CATCHER, $11, $1, STAY, DOWN, $3, OPP_PSYCHIC_TR, $1 object SPRITE_MEDIUM, $3, $7, STAY, DOWN, $4, OPP_CHANNELER, $17 diff --git a/data/mapObjects/saffronpokecenter.asm b/data/mapObjects/saffronpokecenter.asm index 896b550a..b82be083 100755 --- a/data/mapObjects/saffronpokecenter.asm +++ b/data/mapObjects/saffronpokecenter.asm @@ -7,11 +7,12 @@ SaffronPokecenterObject: db $0 ; signs - db $4 ; objects + db $5 ; objects object SPRITE_NURSE, $3, $1, STAY, DOWN, $1 ; person object SPRITE_FOULARD_WOMAN, $5, $5, STAY, NONE, $2 ; person object SPRITE_GENTLEMAN, $8, $3, STAY, DOWN, $3 ; person object SPRITE_CABLE_CLUB_WOMAN, $b, $2, STAY, DOWN, $4 ; person + object SPRITE_CHANSEY, $4, $1, STAY, DOWN, $5 ; person ; warp-to EVENT_DISP SAFFRON_POKECENTER_WIDTH, $7, $3 diff --git a/data/mapObjects/school.asm b/data/mapObjects/school.asm index 53f7fc00..3fe629da 100755 --- a/data/mapObjects/school.asm +++ b/data/mapObjects/school.asm @@ -7,9 +7,10 @@ SchoolObject: db $0 ; signs - db $2 ; objects + db $3 ; objects object SPRITE_BRUNETTE_GIRL, $3, $5, STAY, UP, $1 ; person object SPRITE_LASS, $4, $1, STAY, DOWN, $2 ; person + object SPRITE_LITTLE_GIRL, $4, $5, STAY, UP, $3 ; person ; warp-to EVENT_DISP VIRIDIAN_SCHOOL_WIDTH, $7, $2 diff --git a/data/mapObjects/seafoamislands1.asm b/data/mapObjects/seafoamislands1.asm index 4f7f7a8e..eaa9036e 100755 --- a/data/mapObjects/seafoamislands1.asm +++ b/data/mapObjects/seafoamislands1.asm @@ -24,7 +24,3 @@ SeafoamIslands1Object: EVENT_DISP SEAFOAM_ISLANDS_1_WIDTH, $5, $7 ; SEAFOAM_ISLANDS_2 EVENT_DISP SEAFOAM_ISLANDS_1_WIDTH, $3, $19 ; SEAFOAM_ISLANDS_2 EVENT_DISP SEAFOAM_ISLANDS_1_WIDTH, $f, $17 ; SEAFOAM_ISLANDS_2 - - ; holes - EVENT_DISP SEAFOAM_ISLANDS_1_WIDTH, $6, $11 - EVENT_DISP SEAFOAM_ISLANDS_1_WIDTH, $6, $18 diff --git a/data/mapObjects/silphco11.asm b/data/mapObjects/silphco11.asm index 95712629..a1bb5d81 100755 --- a/data/mapObjects/silphco11.asm +++ b/data/mapObjects/silphco11.asm @@ -9,12 +9,13 @@ SilphCo11Object: db $0 ; signs - db $5 ; objects + db $6 ; objects object SPRITE_MR_MASTERBALL, $7, $5, STAY, DOWN, $1 ; person object SPRITE_FOULARD_WOMAN, $a, $5, STAY, DOWN, $2 ; person object SPRITE_GIOVANNI, $6, $9, STAY, DOWN, $3, OPP_GIOVANNI, $2 - object SPRITE_ROCKET, $3, $10, STAY, UP, $4, OPP_ROCKET, $29 + object SPRITE_JAMES, $2, $8, STAY, UP, $4 object SPRITE_ROCKET, $f, $9, STAY, UP, $5, OPP_ROCKET, $28 + object SPRITE_JESSIE, $3, $8, STAY, UP, $6 ; warp-to EVENT_DISP SILPH_CO_11F_WIDTH, $0, $9 ; SILPH_CO_10F diff --git a/data/mapObjects/ssanne8.asm b/data/mapObjects/ssanne8.asm index 37c8cf61..0d1ea2f3 100755 --- a/data/mapObjects/ssanne8.asm +++ b/data/mapObjects/ssanne8.asm @@ -19,7 +19,7 @@ SSAnne8Object: object SPRITE_GIRL, $16, $3, WALK, $1, $5 ; person object SPRITE_FAT_BALD_GUY, $0, $e, STAY, NONE, $6 ; person object SPRITE_LITTLE_GIRL, $2, $b, STAY, DOWN, $7 ; person - object SPRITE_CLEFAIRY, $3, $b, STAY, DOWN, $8 ; person + object SPRITE_JIGGLYPUFF, $3, $b, STAY, DOWN, $8 ; person object SPRITE_GIRL, $a, $d, STAY, RIGHT, $9 ; person object SPRITE_BALL, $c, $f, STAY, NONE, $a, TM_08 object SPRITE_GENTLEMAN, $15, $d, WALK, $2, $b ; person diff --git a/data/mapObjects/tradecenter.asm b/data/mapObjects/tradecenter.asm index f482fc4f..f482fc4f 100755..100644 --- a/data/mapObjects/tradecenter.asm +++ b/data/mapObjects/tradecenter.asm diff --git a/data/mapObjects/unknowndungeon1.asm b/data/mapObjects/unknowndungeon1.asm index e0393f2e..5348dab8 100755 --- a/data/mapObjects/unknowndungeon1.asm +++ b/data/mapObjects/unknowndungeon1.asm @@ -14,10 +14,11 @@ UnknownDungeon1Object: db $0 ; signs - db $3 ; objects - object SPRITE_BALL, $7, $d, STAY, NONE, $1, FULL_RESTORE - object SPRITE_BALL, $13, $3, STAY, NONE, $2, MAX_ELIXER - object SPRITE_BALL, $5, $0, STAY, NONE, $3, NUGGET + db $4 ; objects + object SPRITE_BALL, $1d, $10, STAY, NONE, $1, RARE_CANDY + object SPRITE_BALL, $7, $b, STAY, NONE, $2, MAX_ELIXER + object SPRITE_BALL, $1d, $9, STAY, NONE, $3, MAX_REVIVE + object SPRITE_BALL, $12, $3, STAY, NONE, $4, ULTRA_BALL ; warp-to EVENT_DISP UNKNOWN_DUNGEON_1_WIDTH, $11, $18 diff --git a/data/mapObjects/unknowndungeon2.asm b/data/mapObjects/unknowndungeon2.asm index e1a443bb..8e696462 100755 --- a/data/mapObjects/unknowndungeon2.asm +++ b/data/mapObjects/unknowndungeon2.asm @@ -11,10 +11,11 @@ UnknownDungeon2Object: db $0 ; signs - db $3 ; objects - object SPRITE_BALL, $1d, $9, STAY, NONE, $1, PP_UP - object SPRITE_BALL, $4, $f, STAY, NONE, $2, ULTRA_BALL - object SPRITE_BALL, $d, $6, STAY, NONE, $3, FULL_RESTORE + db $4 ; objects + object SPRITE_BALL, $0, $b, STAY, NONE, $1, RARE_CANDY + object SPRITE_BALL, $10, $7, STAY, NONE, $2, ULTRA_BALL + object SPRITE_BALL, $13, $b, STAY, NONE, $3, MAX_REVIVE + object SPRITE_BALL, $1b, $9, STAY, NONE, $4, FULL_RESTORE ; warp-to EVENT_DISP UNKNOWN_DUNGEON_2_WIDTH, $1, $1d ; UNKNOWN_DUNGEON_1 diff --git a/data/mapObjects/unknowndungeon3.asm b/data/mapObjects/unknowndungeon3.asm index 84fe5e5d..18439368 100755 --- a/data/mapObjects/unknowndungeon3.asm +++ b/data/mapObjects/unknowndungeon3.asm @@ -6,10 +6,12 @@ UnknownDungeon3Object: db $0 ; signs - db $3 ; objects + db $5 ; objects object SPRITE_SLOWBRO, $1b, $d, STAY, DOWN, $1, MEWTWO, 70 - object SPRITE_BALL, $10, $9, STAY, NONE, $2, ULTRA_BALL - object SPRITE_BALL, $12, $1, STAY, NONE, $3, MAX_REVIVE + object SPRITE_BALL, $1a, $1, STAY, NONE, $2, ULTRA_BALL + object SPRITE_BALL, $2, $d, STAY, NONE, $3, ULTRA_BALL + object SPRITE_BALL, $3, $d, STAY, NONE, $4, MAX_REVIVE + object SPRITE_BALL, $f, $3, STAY, NONE, $5, MAX_ELIXER ; warp-to EVENT_DISP UNKNOWN_DUNGEON_3_WIDTH, $6, $3 ; UNKNOWN_DUNGEON_1 diff --git a/data/mapObjects/vermilioncity.asm b/data/mapObjects/vermilioncity.asm index 8f64e894..8342a2a6 100755 --- a/data/mapObjects/vermilioncity.asm +++ b/data/mapObjects/vermilioncity.asm @@ -13,21 +13,22 @@ VermilionCityObject: db $3, $7, $0, VERMILION_HOUSE_2 db $7 ; signs - db $3, $1b, $7 ; VermilionCityText7 - db $d, $25, $8 ; VermilionCityText8 - db $d, $18, $9 ; MartSignText - db $3, $c, $a ; PokeCenterSignText - db $d, $7, $b ; VermilionCityText11 - db $13, $7, $c ; VermilionCityText12 - db $f, $1d, $d ; VermilionCityText13 + db $3, $1b, $8 ; VermilionCityText7 + db $d, $25, $9 ; VermilionCityText8 + db $d, $18, $a ; MartSignText + db $3, $c, $b ; PokeCenterSignText + db $d, $7, $c ; VermilionCityText11 + db $13, $7, $d ; VermilionCityText12 + db $f, $1d, $e ; VermilionCityText13 - db $6 ; objects - object SPRITE_FOULARD_WOMAN, $13, $7, WALK, $2, $1 ; person + db $7 ; objects + object SPRITE_LASS, $13, $7, WALK, $2, $1 ; person object SPRITE_GAMBLER, $e, $6, STAY, NONE, $2 ; person object SPRITE_SAILOR, $13, $1e, STAY, UP, $3 ; person object SPRITE_GAMBLER, $1e, $7, STAY, NONE, $4 ; person object SPRITE_SLOWBRO, $1d, $9, WALK, $1, $5 ; person object SPRITE_SAILOR, $19, $1b, WALK, $2, $6 ; person + object SPRITE_OFFICER_JENNY, $13, $f, STAY, NONE, $7 ; person ; warp-to EVENT_DISP VERMILION_CITY_WIDTH, $3, $b ; VERMILION_POKECENTER diff --git a/data/mapObjects/vermilionhouse3.asm b/data/mapObjects/vermilionhouse3.asm index 2b8e007b..3d269364 100755 --- a/data/mapObjects/vermilionhouse3.asm +++ b/data/mapObjects/vermilionhouse3.asm @@ -8,7 +8,7 @@ VermilionHouse3Object: db $0 ; signs db $1 ; objects - object SPRITE_LITTLE_GIRL, $3, $5, STAY, UP, $1 ; person + object SPRITE_GENTLEMAN, $3, $5, STAY, UP, $1 ; person ; warp-to EVENT_DISP VERMILION_HOUSE_3_WIDTH, $7, $2 diff --git a/data/mapObjects/vermilionpokecenter.asm b/data/mapObjects/vermilionpokecenter.asm index 727af039..1440531f 100755 --- a/data/mapObjects/vermilionpokecenter.asm +++ b/data/mapObjects/vermilionpokecenter.asm @@ -7,11 +7,12 @@ VermilionPokecenterObject: db $0 ; signs - db $4 ; objects + db $5 ; objects object SPRITE_NURSE, $3, $1, STAY, DOWN, $1 ; person object SPRITE_FISHER, $a, $5, STAY, NONE, $2 ; person object SPRITE_SAILOR, $5, $4, STAY, NONE, $3 ; person object SPRITE_CABLE_CLUB_WOMAN, $b, $2, STAY, DOWN, $4 ; person + object SPRITE_CHANSEY, $4, $1, STAY, DOWN, $5 ; person ; warp-to EVENT_DISP VERMILION_POKECENTER_WIDTH, $7, $3 diff --git a/data/mapObjects/viridiancity.asm b/data/mapObjects/viridiancity.asm index ca40cc4f..465d53bc 100755 --- a/data/mapObjects/viridiancity.asm +++ b/data/mapObjects/viridiancity.asm @@ -9,14 +9,14 @@ ViridianCityObject: db $7, $20, $0, VIRIDIAN_GYM db $6 ; signs - db $11, $11, $8 ; ViridianCityText8 - db $1, $13, $9 ; ViridianCityText9 - db $1d, $15, $a ; ViridianCityText10 - db $13, $1e, $b ; MartSignText - db $19, $18, $c ; PokeCenterSignText - db $7, $1b, $d ; ViridianCityText13 + db $11, $11, $9 ; ViridianCityText8 + db $1, $13, $a ; ViridianCityText9 + db $1d, $15, $b ; ViridianCityText10 + db $13, $1e, $c ; MartSignText + db $19, $18, $d ; PokeCenterSignText + db $7, $1b, $e ; ViridianCityText13 - db $7 ; objects + db $8 ; objects object SPRITE_BUG_CATCHER, $d, $14, WALK, $0, $1 ; person object SPRITE_GAMBLER, $1e, $8, STAY, NONE, $2 ; person object SPRITE_BUG_CATCHER, $1e, $19, WALK, $0, $3 ; person @@ -24,6 +24,7 @@ ViridianCityObject: object SPRITE_LYING_OLD_MAN, $12, $9, STAY, NONE, $5 ; person object SPRITE_FISHER2, $6, $17, STAY, DOWN, $6 ; person object SPRITE_GAMBLER, $11, $5, WALK, $2, $7 ; person + object SPRITE_GAMBLER, $12, $9, STAY, NONE, $8 ; warp-to EVENT_DISP VIRIDIAN_CITY_WIDTH, $19, $17 ; VIRIDIAN_POKECENTER diff --git a/data/mapObjects/viridianforest.asm b/data/mapObjects/viridianforest.asm index 0e466a70..0bb67f82 100755 --- a/data/mapObjects/viridianforest.asm +++ b/data/mapObjects/viridianforest.asm @@ -3,29 +3,31 @@ ViridianForestObject: db $6 ; warps db $0, $1, $2, VIRIDIAN_FOREST_EXIT - db $0, $2, $3, VIRIDIAN_FOREST_EXIT + db $0, $2, $2, VIRIDIAN_FOREST_EXIT db $2f, $f, $1, VIRIDIAN_FOREST_ENTRANCE db $2f, $10, $1, VIRIDIAN_FOREST_ENTRANCE db $2f, $11, $1, VIRIDIAN_FOREST_ENTRANCE db $2f, $12, $1, VIRIDIAN_FOREST_ENTRANCE db $6 ; signs - db $28, $18, $9 ; ViridianForestText9 - db $20, $10, $a ; ViridianForestText10 - db $11, $1a, $b ; ViridianForestText11 - db $18, $4, $c ; ViridianForestText12 - db $2d, $12, $d ; ViridianForestText13 - db $1, $2, $e ; ViridianForestText14 + db $28, $18, $b ; ViridianForestText9 + db $20, $10, $c ; ViridianForestText10 + db $11, $1a, $d ; ViridianForestText11 + db $18, $4, $e ; ViridianForestText12 + db $2d, $12, $f ; ViridianForestText13 + db $1, $2, $10 ; ViridianForestText14 - db $8 ; objects + db $a ; objects object SPRITE_BUG_CATCHER, $10, $2b, STAY, NONE, $1 ; person object SPRITE_BUG_CATCHER, $1e, $21, STAY, LEFT, $2, OPP_BUG_CATCHER, $1 object SPRITE_BUG_CATCHER, $1e, $13, STAY, LEFT, $3, OPP_BUG_CATCHER, $2 object SPRITE_BUG_CATCHER, $2, $12, STAY, LEFT, $4, OPP_BUG_CATCHER, $3 - object SPRITE_BALL, $19, $b, STAY, NONE, $5, ANTIDOTE - object SPRITE_BALL, $c, $1d, STAY, NONE, $6, POTION - object SPRITE_BALL, $1, $1f, STAY, NONE, $7, POKE_BALL - object SPRITE_BUG_CATCHER, $1b, $28, STAY, NONE, $8 ; person + object SPRITE_LASS, $2, $29, STAY, NONE, $5, OPP_LASS, $13 + object SPRITE_BUG_CATCHER, $d, $11, STAY, RIGHT, $6, OPP_BUG_CATCHER, $f + object SPRITE_BALL, $19, $b, STAY, NONE, $7, POTION + object SPRITE_BALL, $c, $1d, STAY, NONE, $8, POTION + object SPRITE_BALL, $1, $1f, STAY, NONE, $9, POKE_BALL + object SPRITE_BUG_CATCHER, $1b, $28, STAY, NONE, $a ; person ; warp-to EVENT_DISP VIRIDIAN_FOREST_WIDTH, $0, $1 ; VIRIDIAN_FOREST_EXIT diff --git a/data/mapObjects/viridianforestentrance.asm b/data/mapObjects/viridianforestentrance.asm index 06faad72..8fe934ae 100755 --- a/data/mapObjects/viridianforestentrance.asm +++ b/data/mapObjects/viridianforestentrance.asm @@ -3,7 +3,7 @@ ViridianForestEntranceObject: db $4 ; warps db $0, $4, $3, VIRIDIAN_FOREST - db $0, $5, $4, VIRIDIAN_FOREST + db $0, $5, $3, VIRIDIAN_FOREST db $7, $4, $5, $ff db $7, $5, $5, $ff diff --git a/data/mapObjects/viridianpokecenter.asm b/data/mapObjects/viridianpokecenter.asm index 2e96ca58..39432c17 100755 --- a/data/mapObjects/viridianpokecenter.asm +++ b/data/mapObjects/viridianpokecenter.asm @@ -7,11 +7,12 @@ ViridianPokecenterObject: db $0 ; signs - db $4 ; objects + db $5 ; objects object SPRITE_NURSE, $3, $1, STAY, DOWN, $1 ; person object SPRITE_GENTLEMAN, $a, $5, WALK, $1, $2 ; person - object SPRITE_BLACK_HAIR_BOY_1, $4, $3, STAY, NONE, $3 ; person + object SPRITE_BLACK_HAIR_BOY_1, $4, $3, STAY, UP, $3 ; person object SPRITE_CABLE_CLUB_WOMAN, $b, $2, STAY, DOWN, $4 ; person + object SPRITE_CHANSEY, $4, $1, STAY, DOWN, $5 ; person ; warp-to EVENT_DISP VIRIDIAN_POKECENTER_WIDTH, $7, $3 diff --git a/data/map_header_banks.asm b/data/map_header_banks.asm index ab8ae1ca..f26b305d 100755..100644 --- a/data/map_header_banks.asm +++ b/data/map_header_banks.asm @@ -1,5 +1,5 @@ ; see also MapHeaderPointers -MapHeaderBanks: +MapHeaderBanks:: db BANK(PalletTown_h) ;PALLET_TOWN db BANK(ViridianCity_h) ; VIRIDIAN_CITY db BANK(PewterCity_h) ; PEWTER_CITY @@ -11,7 +11,7 @@ MapHeaderBanks: db BANK(CinnabarIsland_h) ; CINNABAR_ISLAND db BANK(IndigoPlateau_h) ; INDIGO_PLATEAU db BANK(SaffronCity_h) ; SAFFRON_CITY - db $1 ; unused + db $01 ; unused db BANK(Route1_h) ; ROUTE_1 db BANK(Route2_h) ; ROUTE_2 db BANK(Route3_h) ; ROUTE_3 @@ -105,19 +105,19 @@ MapHeaderBanks: db BANK(SSAnne8_h) db BANK(SSAnne9_h) db BANK(SSAnne10_h) - db $1D ;unused - db $1D ;unused - db $1D ;unused + db $1d ; unused + db $1d ; unused + db $1d ; unused db BANK(VictoryRoad1_h) - db $1D ;unused - db $1D ;unused - db $1D ;unused - db $1D ;unused + db $1d ; unused + db $1d ; unused + db $1d ; unused + db $1d ; unused db BANK(Lance_h) - db $1D ;unused - db $1D ;unused - db $1D ;unused - db $1D ;unused + db $1d ; unused + db $1d ; unused + db $1d ; unused + db $1d ; unused db BANK(HallofFameRoom_h) db BANK(UndergroundPathNS_h) db BANK(Gary_h) @@ -204,9 +204,9 @@ MapHeaderBanks: db BANK(RocketHideout3_h) db BANK(RocketHideout4_h) db BANK(RocketHideoutElevator_h) - db $01 - db $01 - db $01 + db $01 ; unused + db $01 ; unused + db $01 ; unused db BANK(SilphCo2_h) db BANK(SilphCo3_h) db BANK(SilphCo4_h) @@ -231,20 +231,21 @@ MapHeaderBanks: db BANK(UnknownDungeon1_h) db BANK(NameRater_h) db BANK(CeruleanHouse2_h) - db $01 + db $01 ; unused db BANK(RockTunnel2_h) db BANK(SilphCo9_h) db BANK(SilphCo10_h) db BANK(SilphCo11_h) db BANK(SilphCoElevator_h) - db $11 - db $11 + db $11 ; unused + db $11 ; unused db BANK(TradeCenter_h) db BANK(Colosseum_h) - db $11 - db $11 - db $11 - db $11 + db $11 ; unused + db $11 ; unused + db $11 ; unused + db $11 ; unused db BANK(Lorelei_h) db BANK(Bruno_h) db BANK(Agatha_h) + db BANK(BeachHouse_h) diff --git a/data/map_header_pointers.asm b/data/map_header_pointers.asm index b777e4ca..325ff4bb 100755..100644 --- a/data/map_header_pointers.asm +++ b/data/map_header_pointers.asm @@ -248,3 +248,4 @@ MapHeaderPointers:: dw Lorelei_h dw Bruno_h dw Agatha_h ;247 + dw BeachHouse_h diff --git a/data/map_songs.asm b/data/map_songs.asm index 892f475e..973f6945 100755..100644 --- a/data/map_songs.asm +++ b/data/map_songs.asm @@ -238,8 +238,8 @@ MapSongBanks: db MUSIC_SILPH_CO, BANK(Music_SilphCo) ; SilphCoElevator db MUSIC_SILPH_CO, BANK(Music_SilphCo) db MUSIC_SILPH_CO, BANK(Music_SilphCo) - db MUSIC_CELADON, BANK(Music_Celadon) ; TradeCenter - db MUSIC_CELADON, BANK(Music_Celadon) ; Colosseum + db MUSIC_CELADON, BANK(Music_Celadon) ; BattleCenterM + db MUSIC_CELADON, BANK(Music_Celadon) ; TradeCenterM db MUSIC_SILPH_CO, BANK(Music_SilphCo) db MUSIC_SILPH_CO, BANK(Music_SilphCo) db MUSIC_SILPH_CO, BANK(Music_SilphCo) @@ -247,3 +247,4 @@ MapSongBanks: db MUSIC_GYM, BANK(Music_Gym) ; Lorelei db MUSIC_DUNGEON1, BANK(Music_Dungeon1) ; Bruno db MUSIC_POKEMON_TOWER, BANK(Music_PokemonTower) ; Agatha + db MUSIC_ROUTES3, BANK(Music_Routes3) ; BeachHouse diff --git a/data/mart_inventories.asm b/data/mart_inventories.asm index 35ae2e9d..b821f4d7 100755 --- a/data/mart_inventories.asm +++ b/data/mart_inventories.asm @@ -3,62 +3,62 @@ ; Viridian ViridianCashierText:: - TX_MART POKE_BALL, ANTIDOTE, PARLYZ_HEAL, BURN_HEAL + TX_MART POKE_BALL,POTION,ANTIDOTE,PARLYZ_HEAL,BURN_HEAL ; Pewter PewterCashierText:: - TX_MART POKE_BALL, POTION, ESCAPE_ROPE, ANTIDOTE, BURN_HEAL, AWAKENING, PARLYZ_HEAL + TX_MART POKE_BALL,POTION,ESCAPE_ROPE,ANTIDOTE,BURN_HEAL,AWAKENING,PARLYZ_HEAL ; Cerulean CeruleanCashierText:: - TX_MART POKE_BALL, POTION, REPEL, ANTIDOTE, BURN_HEAL, AWAKENING, PARLYZ_HEAL + TX_MART POKE_BALL,POTION,ESCAPE_ROPE,REPEL,ANTIDOTE,BURN_HEAL,AWAKENING,PARLYZ_HEAL ; Bike shop TX_MART BICYCLE ; Vermilion VermilionCashierText:: - TX_MART POKE_BALL, SUPER_POTION, ICE_HEAL, AWAKENING, PARLYZ_HEAL, REPEL + TX_MART POKE_BALL,SUPER_POTION,ICE_HEAL,AWAKENING,PARLYZ_HEAL,REPEL ; Lavender LavenderCashierText:: - TX_MART GREAT_BALL, SUPER_POTION, REVIVE, ESCAPE_ROPE, SUPER_REPEL, ANTIDOTE, BURN_HEAL, ICE_HEAL, PARLYZ_HEAL + TX_MART GREAT_BALL,SUPER_POTION,REVIVE,ESCAPE_ROPE,SUPER_REPEL,ANTIDOTE,BURN_HEAL,ICE_HEAL,PARLYZ_HEAL ; Celadon Dept. Store 2F (1) CeladonMart2Clerk1Text:: - TX_MART GREAT_BALL, SUPER_POTION, REVIVE, SUPER_REPEL, ANTIDOTE, BURN_HEAL, ICE_HEAL, AWAKENING, PARLYZ_HEAL + TX_MART GREAT_BALL,SUPER_POTION,REVIVE,SUPER_REPEL,ANTIDOTE,BURN_HEAL,ICE_HEAL,AWAKENING,PARLYZ_HEAL ; Celadon Dept. Store 2F (2) CeladonMart2Clerk2Text:: - TX_MART TM_32, TM_33, TM_02, TM_07, TM_37, TM_01, TM_05, TM_09, TM_17 + TX_MART TM_32,TM_33,TM_02,TM_07,TM_37,TM_01,TM_05,TM_09,TM_17 ; Celadon Dept. Store 4F CeladonMart4ClerkText:: - TX_MART POKE_DOLL, FIRE_STONE, THUNDER_STONE, WATER_STONE, LEAF_STONE + TX_MART POKE_DOLL,FIRE_STONE,THUNDER_STONE,WATER_STONE,LEAF_STONE ; Celadon Dept. Store 5F (1) CeladonMart5Clerk1Text:: - TX_MART X_ACCURACY, GUARD_SPEC, DIRE_HIT, X_ATTACK, X_DEFEND, X_SPEED, X_SPECIAL + TX_MART X_ACCURACY,GUARD_SPEC,DIRE_HIT,X_ATTACK,X_DEFEND,X_SPEED,X_SPECIAL ; Celadon Dept. Store 5F (2) CeladonMart5Clerk2Text:: - TX_MART HP_UP, PROTEIN, IRON, CARBOS, CALCIUM + TX_MART HP_UP,PROTEIN,IRON,CARBOS,CALCIUM ; Fuchsia FuchsiaCashierText:: - TX_MART ULTRA_BALL, GREAT_BALL, SUPER_POTION, REVIVE, FULL_HEAL, SUPER_REPEL + TX_MART ULTRA_BALL,GREAT_BALL,HYPER_POTION,REVIVE,FULL_HEAL,SUPER_REPEL ; unused? - TX_MART GREAT_BALL, HYPER_POTION, SUPER_POTION, FULL_HEAL, REVIVE + TX_MART GREAT_BALL,HYPER_POTION,SUPER_POTION,FULL_HEAL,REVIVE ; Cinnabar CinnabarCashierText:: - TX_MART ULTRA_BALL, GREAT_BALL, HYPER_POTION, MAX_REPEL, ESCAPE_ROPE, FULL_HEAL, REVIVE + TX_MART ULTRA_BALL,GREAT_BALL,HYPER_POTION,MAX_REPEL,ESCAPE_ROPE,FULL_HEAL,REVIVE ; Saffron SaffronCashierText:: - TX_MART GREAT_BALL, HYPER_POTION, MAX_REPEL, ESCAPE_ROPE, FULL_HEAL, REVIVE + TX_MART GREAT_BALL,HYPER_POTION,MAX_REPEL,ESCAPE_ROPE,FULL_HEAL,REVIVE ; Indigo IndigoCashierText:: - TX_MART ULTRA_BALL, GREAT_BALL, FULL_RESTORE, MAX_POTION, FULL_HEAL, REVIVE, MAX_REPEL + TX_MART ULTRA_BALL,GREAT_BALL,FULL_RESTORE,MAX_POTION,FULL_HEAL,REVIVE,MAX_REPEL diff --git a/data/mon_palettes.asm b/data/mon_palettes.asm index 8c4d0bc0..065db93e 100755 --- a/data/mon_palettes.asm +++ b/data/mon_palettes.asm @@ -151,3 +151,4 @@ MonsterPalettes: db PAL_BROWNMON ; DRAGONITE db PAL_MEWMON ; MEWTWO db PAL_MEWMON ; MEW +; 1c:69b9 diff --git a/data/mon_party_sprites.asm b/data/mon_party_sprites.asm index d83e7b4e..81600f45 100755 --- a/data/mon_party_sprites.asm +++ b/data/mon_party_sprites.asm @@ -1,77 +1,88 @@ MonPartyData: - dn SPRITE_GRASS, SPRITE_GRASS ;Bulbasaur/Ivysaur - dn SPRITE_GRASS, SPRITE_MON ;Venusaur/Charmander - dn SPRITE_MON, SPRITE_MON ;Charmeleon/Charizard - dn SPRITE_WATER, SPRITE_WATER ;Squirtle/Wartortle - dn SPRITE_WATER, SPRITE_BUG ;Blastoise/Caterpie - dn SPRITE_BUG, SPRITE_BUG ;Metapod/Butterfree - dn SPRITE_BUG, SPRITE_BUG ;Weedle/Kakuna - dn SPRITE_BUG, SPRITE_BIRD_M ;Beedrill/Pidgey - dn SPRITE_BIRD_M, SPRITE_BIRD_M ;Pidgeotto/Pidgeot - dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Rattata/Raticate - dn SPRITE_BIRD_M, SPRITE_BIRD_M ;Spearow/Fearow - dn SPRITE_SNAKE, SPRITE_SNAKE ;Ekans/Arbok - dn SPRITE_FAIRY, SPRITE_FAIRY ;Pikachu/Raichu - dn SPRITE_MON, SPRITE_MON ;Sandshrew/Sandslash - dn SPRITE_MON, SPRITE_MON ;NidoranF/Nidorina - dn SPRITE_MON, SPRITE_MON ;Nidoqueen/NidoranM - dn SPRITE_MON, SPRITE_MON ;Nidorino/Nidoking - dn SPRITE_FAIRY, SPRITE_FAIRY ;Clefairy/Clefable - dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Vulpix/Ninetales - dn SPRITE_FAIRY, SPRITE_FAIRY ;Jigglypuff/Wigglytuff - dn SPRITE_MON, SPRITE_MON ;Zubat/Golbat - dn SPRITE_GRASS, SPRITE_GRASS ;Oddish/Gloom - dn SPRITE_GRASS, SPRITE_BUG ;Vileplume/Paras - dn SPRITE_BUG, SPRITE_BUG ;Parasect/Venonat - dn SPRITE_BUG, SPRITE_MON ;Venomoth/Diglett - dn SPRITE_MON, SPRITE_MON ;Dugtrio/Meowth - dn SPRITE_MON, SPRITE_MON ;Persian/Psyduck - dn SPRITE_MON, SPRITE_MON ;Golduck/Mankey - dn SPRITE_MON, SPRITE_QUADRUPED ;Primeape/Growlithe - dn SPRITE_QUADRUPED, SPRITE_MON ;Arcanine/Poliwag - dn SPRITE_MON, SPRITE_MON ;Poliwhirl/Poliwrath - dn SPRITE_MON, SPRITE_MON ;Abra/Kadabra - dn SPRITE_MON, SPRITE_MON ;Alakazam/Machop - dn SPRITE_MON, SPRITE_MON ;Machoke/Machamp - dn SPRITE_GRASS, SPRITE_GRASS ;Bellsprout/Weepinbell - dn SPRITE_GRASS, SPRITE_WATER ;Victreebel/Tentacool - dn SPRITE_WATER, SPRITE_MON ;Tentacruel/Geodude - dn SPRITE_MON, SPRITE_MON ;Graveler/Golem - dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Ponyta/Rapidash - dn SPRITE_QUADRUPED, SPRITE_MON ;Slowpoke/Slowbro - dn SPRITE_BALL_M, SPRITE_BALL_M ;Magnemite/Magneton - dn SPRITE_BIRD_M, SPRITE_BIRD_M ;Farfetch'd/Doduo - dn SPRITE_BIRD_M, SPRITE_WATER ;Dodrio/Seel - dn SPRITE_WATER, SPRITE_MON ;Dewgong/Grimer - dn SPRITE_MON, SPRITE_HELIX ;Muk/Shellder - dn SPRITE_HELIX, SPRITE_MON ;Cloyster/Gastly - dn SPRITE_MON, SPRITE_MON ;Haunter/Gengar - dn SPRITE_SNAKE, SPRITE_MON ;Onix/Drowzee - dn SPRITE_MON, SPRITE_WATER ;Hypno/Krabby - dn SPRITE_WATER, SPRITE_BALL_M ;Kingler/Voltorb - dn SPRITE_BALL_M, SPRITE_GRASS ;Electrode/Exeggcute - dn SPRITE_GRASS, SPRITE_MON ;Exeggutor/Cubone - dn SPRITE_MON, SPRITE_MON ;Marowak/Hitmonlee - dn SPRITE_MON, SPRITE_MON ;Hitmonchan/Lickitung - dn SPRITE_MON, SPRITE_MON ;Koffing/Weezing - dn SPRITE_QUADRUPED, SPRITE_MON ;Rhyhorn/Rhydon - dn SPRITE_FAIRY, SPRITE_GRASS ;Chansey/Tangela - dn SPRITE_MON, SPRITE_WATER ;Kangaskhan/Horsea - dn SPRITE_WATER, SPRITE_WATER ;Seadra/Goldeen - dn SPRITE_WATER, SPRITE_HELIX ;Seaking/Staryu - dn SPRITE_HELIX, SPRITE_MON ;Starmie/Mr.Mime - dn SPRITE_BUG, SPRITE_MON ;Scyther/Jynx - dn SPRITE_MON, SPRITE_MON ;Electabuzz/Magmar - dn SPRITE_BUG, SPRITE_QUADRUPED ;Pinsir/Tauros - dn SPRITE_WATER, SPRITE_SNAKE ;Magikarp/Gyarados - dn SPRITE_WATER, SPRITE_MON ;Lapras/Ditto - dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Eevee/Vaporeon - dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Jolteon/Flareon - dn SPRITE_MON, SPRITE_HELIX ;Porygon/Omanyte - dn SPRITE_HELIX, SPRITE_HELIX ;Omastar/Kabuto - dn SPRITE_HELIX, SPRITE_BIRD_M ;Kabutops/Aerodactyl - dn SPRITE_MON, SPRITE_BIRD_M ;Snorlax/Articuno - dn SPRITE_BIRD_M, SPRITE_BIRD_M ;Zapdos/Moltres - dn SPRITE_SNAKE, SPRITE_SNAKE ;Dratini/Dragonair - dn SPRITE_SNAKE, SPRITE_MON ;Dragonite/Mewtwo - dn SPRITE_MON, 0 ;Mew/Padding +; MON = 0 +; BALL_M = 1 +; HELIX = 2 +; FAIRY = 3 +; BIRD_M = 4 +; WATER = 5 +; BUG = 6 +; GRASS = 7 +; SNAKE = 8 +; QUADRUPED = 9 +; PIKACHU = A + dn SPRITE_GRASS, SPRITE_GRASS ;Bulbasaur/Ivysaur + dn SPRITE_GRASS, SPRITE_MON ;Venusaur/Charmander + dn SPRITE_MON, SPRITE_MON ;Charmeleon/Charizard + dn SPRITE_WATER, SPRITE_WATER ;Squirtle/Wartortle + dn SPRITE_WATER, SPRITE_BUG ;Blastoise/Caterpie + dn SPRITE_BUG, SPRITE_BUG ;Metapod/Butterfree + dn SPRITE_BUG, SPRITE_BUG ;Weedle/Kakuna + dn SPRITE_BUG, SPRITE_BIRD_M ;Beedrill/Pidgey + dn SPRITE_BIRD_M, SPRITE_BIRD_M ;Pidgeotto/Pidgeot + dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Rattata/Raticate + dn SPRITE_BIRD_M, SPRITE_BIRD_M ;Spearow/Fearow + dn SPRITE_SNAKE, SPRITE_SNAKE ;Ekans/Arbok + dn SPRITE_PIKACHU_FAMILY, SPRITE_PIKACHU_FAMILY ;Pikachu/Raichu + dn SPRITE_MON, SPRITE_MON ;Sandshrew/Sandslash + dn SPRITE_MON, SPRITE_MON ;NidoranF/Nidorina + dn SPRITE_MON, SPRITE_MON ;Nidoqueen/NidoranM + dn SPRITE_MON, SPRITE_MON ;Nidorino/Nidoking + dn SPRITE_FAIRY, SPRITE_FAIRY ;Clefairy/Clefable + dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Vulpix/Ninetales + dn SPRITE_FAIRY, SPRITE_FAIRY ;Jigglypuff/Wigglytuff + dn SPRITE_MON, SPRITE_MON ;Zubat/Golbat + dn SPRITE_GRASS, SPRITE_GRASS ;Oddish/Gloom + dn SPRITE_GRASS, SPRITE_BUG ;Vileplume/Paras + dn SPRITE_BUG, SPRITE_BUG ;Parasect/Venonat + dn SPRITE_BUG, SPRITE_MON ;Venomoth/Diglett + dn SPRITE_MON, SPRITE_MON ;Dugtrio/Meowth + dn SPRITE_MON, SPRITE_MON ;Persian/Psyduck + dn SPRITE_MON, SPRITE_MON ;Golduck/Mankey + dn SPRITE_MON, SPRITE_QUADRUPED ;Primeape/Growlithe + dn SPRITE_QUADRUPED, SPRITE_MON ;Arcanine/Poliwag + dn SPRITE_MON, SPRITE_MON ;Poliwhirl/Poliwrath + dn SPRITE_MON, SPRITE_MON ;Abra/Kadabra + dn SPRITE_MON, SPRITE_MON ;Alakazam/Machop + dn SPRITE_MON, SPRITE_MON ;Machoke/Machamp + dn SPRITE_GRASS, SPRITE_GRASS ;Bellsprout/Weepinbell + dn SPRITE_GRASS, SPRITE_WATER ;Victreebel/Tentacool + dn SPRITE_WATER, SPRITE_MON ;Tentacruel/Geodude + dn SPRITE_MON, SPRITE_MON ;Graveler/Golem + dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Ponyta/Rapidash + dn SPRITE_QUADRUPED, SPRITE_MON ;Slowpoke/Slowbro + dn SPRITE_BALL_M, SPRITE_BALL_M ;Magnemite/Magneton + dn SPRITE_BIRD_M, SPRITE_BIRD_M ;Farfetch'd/Doduo + dn SPRITE_BIRD_M, SPRITE_WATER ;Dodrio/Seel + dn SPRITE_WATER, SPRITE_MON ;Dewgong/Grimer + dn SPRITE_MON, SPRITE_HELIX ;Muk/Shellder + dn SPRITE_HELIX, SPRITE_MON ;Cloyster/Gastly + dn SPRITE_MON, SPRITE_MON ;Haunter/Gengar + dn SPRITE_SNAKE, SPRITE_MON ;Onix/Drowzee + dn SPRITE_MON, SPRITE_WATER ;Hypno/Krabby + dn SPRITE_WATER, SPRITE_BALL_M ;Kingler/Voltorb + dn SPRITE_BALL_M, SPRITE_GRASS ;Electrode/Exeggcute + dn SPRITE_GRASS, SPRITE_MON ;Exeggutor/Cubone + dn SPRITE_MON, SPRITE_MON ;Marowak/Hitmonlee + dn SPRITE_MON, SPRITE_MON ;Hitmonchan/Lickitung + dn SPRITE_MON, SPRITE_MON ;Koffing/Weezing + dn SPRITE_QUADRUPED, SPRITE_MON ;Rhyhorn/Rhydon + dn SPRITE_FAIRY, SPRITE_GRASS ;Chansey/Tangela + dn SPRITE_MON, SPRITE_WATER ;Kangaskhan/Horsea + dn SPRITE_WATER, SPRITE_WATER ;Seadra/Goldeen + dn SPRITE_WATER, SPRITE_HELIX ;Seaking/Staryu + dn SPRITE_HELIX, SPRITE_MON ;Starmie/Mr.Mime + dn SPRITE_BUG, SPRITE_MON ;Scyther/Jynx + dn SPRITE_MON, SPRITE_MON ;Electabuzz/Magmar + dn SPRITE_BUG, SPRITE_QUADRUPED ;Pinsir/Tauros + dn SPRITE_WATER, SPRITE_SNAKE ;Magikarp/Gyarados + dn SPRITE_WATER, SPRITE_MON ;Lapras/Ditto + dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Eevee/Vaporeon + dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Jolteon/Flareon + dn SPRITE_MON, SPRITE_HELIX ;Porygon/Omanyte + dn SPRITE_HELIX, SPRITE_HELIX ;Omastar/Kabuto + dn SPRITE_HELIX, SPRITE_BIRD_M ;Kabutops/Aerodactyl + dn SPRITE_MON, SPRITE_BIRD_M ;Snorlax/Articuno + dn SPRITE_BIRD_M, SPRITE_BIRD_M ;Zapdos/Moltres + dn SPRITE_SNAKE, SPRITE_SNAKE ;Dratini/Dragonair + dn SPRITE_SNAKE, SPRITE_MON ;Dragonite/Mewtwo + dn SPRITE_MON, 0 ;Mew/Padding diff --git a/data/pikachu_emotions.asm b/data/pikachu_emotions.asm new file mode 100755 index 00000000..f72beaa4 --- /dev/null +++ b/data/pikachu_emotions.asm @@ -0,0 +1,266 @@ +PikachuEmotion0: + db $ff + +PikachuEmotion2: + pikaemotion_dummy2 + pikaemotion_emotebubble SMILE_BUBBLE + pikaemotion_pcm PikachuCry35 + pikaemotion_pikapic PikaPicAnimScript2 + db $ff + +PikachuEmotion10: + pikaemotion_dummy2 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + pikaemotion_emotebubble HEART_BUBBLE + pikaemotion_pcm PikachuCry5 + pikaemotion_pikapic PikaPicAnimScript10 + db $ff + +PikachuEmotion7: + pikaemotion_dummy2 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + pikaemotion_movement PikachuMovementData_fd224 + pikaemotion_pcm PikachuCry1 + pikaemotion_movement PikachuMovementData_fd224 + pikaemotion_pikapic PikaPicAnimScript7 + db $ff + +PikachuEmotion4: + pikaemotion_dummy2 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + pikaemotion_movement PikachuMovementData_fd230 + pikaemotion_pcm PikachuCry29 + pikaemotion_pikapic PikaPicAnimScript4 + db $ff + +PikachuEmotion1: + pikaemotion_dummy2 + pikaemotion_pcm + pikaemotion_pikapic PikaPicAnimScript1 + db $ff + +PikachuEmotion8: + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry39 + pikaemotion_pikapic PikaPicAnimScript8 + db $ff + +PikachuEmotion5: + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry31 + pikaemotion_pikapic PikaPicAnimScript5 + db $ff + +PikachuEmotion6: + pikaemotion_dummy2 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + pikaemotion_pcm + pikaemotion_movement PikachuMovementData_fd21e + pikaemotion_emotebubble SKULL_BUBBLE + pikaemotion_pikapic PikaPicAnimScript6 + db $ff + +PikachuEmotion3: + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry40 + pikaemotion_pikapic PikaPicAnimScript3 + db $ff + +PikachuEmotion9: + pikaemotion_dummy2 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + pikaemotion_pcm PikachuCry6 + pikaemotion_movement PikachuMovementData_fd218 + pikaemotion_emotebubble SKULL_BUBBLE + pikaemotion_pikapic PikaPicAnimScript9 + db $ff + +PikachuEmotion11: + pikaemotion_emotebubble ZZZ_BUBBLE + pikaemotion_pcm PikachuCry37 + pikaemotion_pikapic PikaPicAnimScript11 + db $ff + +PikachuEmotion12: + pikaemotion_dummy2 + pikaemotion_pcm + pikaemotion_pikapic PikaPicAnimScript12 + db $ff + +PikachuEmotion13: + pikaemotion_dummy2 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADEXTRAPIKASPRITES + pikaemotion_movement PikachuMovementData_fd21e + pikaemotion_pikapic PikaPicAnimScript13 + db $ff + +PikachuEmotion14: + pikaemotion_dummy2 + pikaemotion_emotebubble BOLT_BUBBLE + pikaemotion_pcm PikachuCry10 + pikaemotion_pikapic PikaPicAnimScript14 + db $ff + +PikachuEmotion15: + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry34 + pikaemotion_pikapic PikaPicAnimScript15 + db $ff + +PikachuEmotion16: + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry33 + pikaemotion_pikapic PikaPicAnimScript16 + db $ff + +PikachuEmotion17: + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry13 + pikaemotion_pikapic PikaPicAnimScript17 + db $ff + +PikachuEmotion18: + pikaemotion_dummy2 + pikaemotion_pcm + pikaemotion_pikapic PikaPicAnimScript18 + db $ff + +PikachuEmotion19: + pikaemotion_dummy2 + pikaemotion_emotebubble HEART_BUBBLE + pikaemotion_pcm PikachuCry33 + pikaemotion_pikapic PikaPicAnimScript19 + db $ff + +PikachuEmotion20: + pikaemotion_dummy2 + pikaemotion_emotebubble HEART_BUBBLE + pikaemotion_pcm PikachuCry5 + pikaemotion_pikapic PikaPicAnimScript20 + db $ff + +PikachuEmotion21: + pikaemotion_dummy2 + pikaemotion_emotebubble FISH_BUBBLE + pikaemotion_pcm + pikaemotion_pikapic PikaPicAnimScript21 + db $ff + +PikachuEmotion22: + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry4 + pikaemotion_pikapic PikaPicAnimScript22 + db $ff + +PikachuEmotion23: + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry19 + pikaemotion_pikapic PikaPicAnimScript23 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW + db $ff + +PikachuEmotion24: + pikaemotion_dummy2 + pikaemotion_emotebubble EXCLAMATION_BUBBLE + pikaemotion_pcm + pikaemotion_pikapic PikaPicAnimScript24 + db $ff + +PikachuEmotion25: + pikaemotion_dummy2 + pikaemotion_emotebubble BOLT_BUBBLE + pikaemotion_pcm PikachuCry35 + pikaemotion_pikapic PikaPicAnimScript25 + db $ff + +PikachuEmotion26: + pikaemotion_dummy2 + pikaemotion_emotebubble ZZZ_BUBBLE + pikaemotion_pcm PikachuCry37 + pikaemotion_pikapic PikaPicAnimScript26 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW + pikaemotion_subcmd PIKAEMOTION_SUBCMD_CHECKPEWTERCENTER + db $ff + +PikachuEmotion27: + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry9 + pikaemotion_pikapic PikaPicAnimScript27 + db $ff + +PikachuEmotion28: + pikaemotion_dummy2 + pikaemotion_pcm PikachuCry15 + pikaemotion_pikapic PikaPicAnimScript28 + db $ff + +PikachuEmotion29: + pikaemotion_pcm PikachuCry5 + pikaemotion_pikapic PikaPicAnimScript10 + db $ff + +PikachuEmotion30: + pikaemotion_9 + pikaemotion_emotebubble HEART_BUBBLE + pikaemotion_pcm PikachuCry5 + pikaemotion_pikapic PikaPicAnimScript20 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW + pikaemotion_subcmd PIKAEMOTION_SUBCMD_LOADFONT + pikaemotion_subcmd PIKAEMOTION_SUBCMD_CHECKLAVENDERTOWER + db $ff + +PikachuEmotion31: + pikaemotion_pcm PikachuCry19 + pikaemotion_pikapic PikaPicAnimScript23 + pikaemotion_subcmd PIKAEMOTION_SUBCMD_SHOWMAPVIEW + pikaemotion_subcmd PIKAEMOTION_SUBCMD_CHECKBILLSHOUSE + db $ff + +PikachuEmotion32: + pikaemotion_pcm PikachuCry26 + pikaemotion_pikapic PikaPicAnimScript23 + db $ff + +PikachuMovementData_fd218: + db $00 + db $39, 2 - 1 + db $3e, 31 - 1 + db $3f + +PikachuMovementData_fd21e: + db $00 + db $39, 1 - 1 + db $3e, 31 - 1 + db $3f + +PikachuMovementData_fd224: + db $00 + db $3c, 8 - 1, (2 << 4) | (16 - 1) + db $3c, 8 - 1, (2 << 4) | (16 - 1) + db $3f + +PikachuMovementData_fd22c: + db $3b, 32 - 1, 4 - 1 + db $3f + +PikachuMovementData_fd230: + db $00 + db $3c, 16 - 1, (1 << 4) | (16 - 1) + db $3c, 16 - 1, (1 << 4) | (16 - 1) + db $3f + +PikachuMovementData_fd238: + db $00 + db $05, 8 - 1 + db $39, 1 - 1 + db $05, 8 - 1 + db $06, 8 - 1 + db $39, 1 - 1 + db $06, 8 - 1 + db $08, 8 - 1 + db $39, 1 - 1 + db $08, 8 - 1 + db $07, 8 - 1 + db $39, 1 - 1 + db $07, 8 - 1 + db $3f diff --git a/data/pikachu_pic_animation.asm b/data/pikachu_pic_animation.asm new file mode 100755 index 00000000..d10f65dd --- /dev/null +++ b/data/pikachu_pic_animation.asm @@ -0,0 +1,399 @@ +PikaPicAnimThunderboltPals: + db 4, %11000000 + db 4, %11100100 + db 4, %11000000 + db 4, %11100100 + db 4, %11000000 + db 4, %11100100 + db 4, %11000000 + db 4, %11100100 + db 4, %11000000 + db 4, %11100100 + db 4, %11000000 + db 4, %11100100 + db 4, %11000000 + db 4, %11100100 + db 4, %11000000 + db 4, %11100100 + db 4, %11000000 + db 4, %11100100 + db 4, %11000000 + db 4, %11100100 + db $ff + +Data_fe26b: + pikapic_loadgfx Pic_e4000 + pikapic_loadgfx Pic_e49d1 + pikapic_loadgfx PikachuSprite + pikapic_animation PikaPicAnimBGFrames_1, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_2, $b2, $5, $5 + pikapic_animation PikaPicAnimBGFrames_3, $b6, $5, $5 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript0: +PikaPicAnimScript1: +PikaPicAnimScript29: + pikapic_setduration 40 + pikapic_loadgfx Pic_e4000 + pikapic_loadgfx GFX_e40cc + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_6, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry PikachuCry3 + pikapic_looptofinish + +PikaPicAnimScript2: + pikapic_setduration 44 + pikapic_loadgfx Pic_e411c + pikapic_loadgfx GFX_e41d2 + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_7, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript3: + pikapic_setduration 80 + pikapic_loadgfx Pic_e4272 + pikapic_loadgfx GFX_e4323 + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_8, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript4: + pikapic_setduration 70 + pikapic_loadgfx Pic_e4383 + pikapic_loadgfx GFX_e444b + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_9, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript5: + pikapic_setduration 32 + pikapic_loadgfx Pic_e458b + pikapic_loadgfx GFX_e463b + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_10, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript6: + pikapic_setduration 50 + pikapic_loadgfx Pic_e467b + pikapic_loadgfx GFX_e472e + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_11, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry PikachuCry38 + pikapic_looptofinish + +PikaPicAnimScript7: + pikapic_setduration 58 + pikapic_loadgfx Pic_e476e + pikapic_loadgfx GFX_e4841 + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_12, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript8: + pikapic_setduration 44 + pikapic_loadgfx Pic_e49d1 + pikapic_loadgfx GFX_e4a99 + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_13, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript9: + pikapic_setduration 56 + pikapic_loadgfx Pic_e4b39 + pikapic_loadgfx GFX_e4bde + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_14, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript10: + pikapic_setduration 56 + pikapic_loadgfx Pic_e4c3e + pikapic_loadgfx GFX_e4ce0 + pikapic_loadgfx GFX_e4e70 + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_16, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript11: + pikapic_setduration 100 + pikapic_loadgfx Pic_e5000 + pikapic_loadgfx GFX_e50af + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_17, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript12: + pikapic_setduration 50 + pikapic_loadgfx Pic_e523f + pikapic_loadgfx GFX_e52fe + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_18, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry PikachuCry25 + pikapic_looptofinish + +PikaPicAnimScript13: + pikapic_setduration 50 + pikapic_loadgfx Pic_e548e + pikapic_loadgfx GFX_e5541 + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_19, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript14: + pikapic_setduration 40 + pikapic_loadgfx Pic_e56d1 + pikapic_loadgfx GFX_e5794 + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_20, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript15: + pikapic_setduration 50 + pikapic_loadgfx Pic_e5924 + pikapic_loadgfx GFX_e59ed + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_21, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript16: + pikapic_setduration 32 + pikapic_loadgfx Pic_e5b7d + pikapic_loadgfx GFX_e5c4d + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_22, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript17: + pikapic_setduration 100 + pikapic_loadgfx Pic_e5ddd + pikapic_loadgfx GFX_e5e90 + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_23, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript18: + pikapic_setduration 32 + pikapic_loadgfx GFX_e6020 + pikapic_loadgfx GFX_e61b0 + pikapic_animation PikaPicAnimBGFrames_5, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_24, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry PikachuCry18 + pikapic_looptofinish + +PikaPicAnimScript19: + pikapic_setduration 44 + pikapic_loadgfx Pic_e6340 + pikapic_loadgfx GFX_e63f7 + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_25, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript20: + pikapic_setduration 50 + pikapic_loadgfx Pic_e6587 + pikapic_loadgfx GFX_e6646 + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_26, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript21: + pikapic_setduration 40 + pikapic_loadgfx Pic_e67d6 + pikapic_loadgfx GFX_e682f + pikapic_loadgfx GFX_e69bf + pikapic_loadgfx GFX_e6b4f + pikapic_loadgfx GFX_e6cdf + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_27, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry PikachuCry20 + pikapic_looptofinish + +PikaPicAnimScript22: + pikapic_setduration 40 + pikapic_loadgfx GFX_e6e6f + pikapic_loadgfx GFX_e6fff + pikapic_animation PikaPicAnimBGFrames_5, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_28, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript23: + pikapic_setduration 70 + pikapic_loadgfx GFX_e718f + pikapic_loadgfx GFX_e731f + pikapic_animation PikaPicAnimBGFrames_5, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_29, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript24: + pikapic_setduration 60 + pikapic_loadgfx GFX_e74af + pikapic_loadgfx GFX_e763f + pikapic_animation PikaPicAnimBGFrames_5, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_30, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript25: + pikapic_setduration 50 + pikapic_loadgfx Pic_e77cf + pikapic_loadgfx GFX_e7863 + pikapic_loadgfx GFX_e79f3 + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_31, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_writebyte 13 + pikapic_waitbgmap + pikapic_thunderbolt + pikapic_ret + +Data_fe51f: + pikapic_waitbgmap +PikaPicAnimScript26: + pikapic_setduration 100 + pikapic_loadgfx Pic_e5000 + pikapic_loadgfx GFX_e50af + pikapic_loadgfx GFX_e7b83 + pikapic_loadgfx GFX_e7d13 + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_32, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript27: + pikapic_setduration 30 + pikapic_loadgfx Pic_f0abf + pikapic_loadgfx GFX_f0b64 + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_33, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimScript28: + pikapic_setduration 64 + pikapic_loadgfx Pic_f0cf4 + pikapic_loadgfx GFX_f0d82 + pikapic_animation PikaPicAnimBGFrames_4, $80, $0, $0 + pikapic_animation PikaPicAnimBGFrames_34, $99, $0, $0 + pikapic_waitbgmap + pikapic_cry + pikapic_looptofinish + +PikaPicAnimGFXHeaders: +pikapicanimgfx: MACRO +\2_id:: + db \1 ; size (-1 if compressed) + dba \2 ; pointer + endm + +PikaPicAnimGFX_Null_id:: + dbbw 1, $39,$0000 ; 00 + pikapicanimgfx -1, Pic_e4000 ; 01 + pikapicanimgfx 5, GFX_e40cc ; 02 + pikapicanimgfx -1, Pic_e411c ; 03 + pikapicanimgfx 10, GFX_e41d2 ; 04 + pikapicanimgfx -1, Pic_e4272 ; 05 + pikapicanimgfx 6, GFX_e4323 ; 06 + pikapicanimgfx -1, Pic_e4383 ; 07 + pikapicanimgfx 20, GFX_e444b ; 08 + pikapicanimgfx -1, Pic_e458b ; 09 + pikapicanimgfx 4, GFX_e463b ; 0a + pikapicanimgfx -1, Pic_e467b ; 0b + pikapicanimgfx 4, GFX_e472e ; 0c + pikapicanimgfx -1, Pic_e476e ; 0d + pikapicanimgfx 25, GFX_e4841 ; 0e + pikapicanimgfx -1, Pic_e49d1 ; 0f + pikapicanimgfx 10, GFX_e4a99 ; 00 + pikapicanimgfx -1, Pic_e4b39 ; 11 + pikapicanimgfx 6, GFX_e4bde ; 12 + pikapicanimgfx -1, Pic_e4c3e ; 13 + pikapicanimgfx 25, GFX_e4ce0 ; 14 + pikapicanimgfx 25, GFX_e4e70 ; 15 + pikapicanimgfx -1, Pic_e5000 ; 16 + pikapicanimgfx 25, GFX_e50af ; 17 + pikapicanimgfx -1, Pic_e523f ; 18 + pikapicanimgfx 25, GFX_e52fe ; 19 + pikapicanimgfx -1, Pic_e548e ; 1a + pikapicanimgfx 25, GFX_e5541 ; 1b + pikapicanimgfx -1, Pic_e56d1 ; 1c + pikapicanimgfx 25, GFX_e5794 ; 1d + pikapicanimgfx -1, Pic_e5924 ; 1e + pikapicanimgfx 25, GFX_e59ed ; 1f + pikapicanimgfx -1, Pic_e5b7d ; 20 + pikapicanimgfx 25, GFX_e5c4d ; 21 + pikapicanimgfx -1, Pic_e5ddd ; 22 + pikapicanimgfx 25, GFX_e5e90 ; 23 + pikapicanimgfx 25, GFX_e6020 ; 24 + pikapicanimgfx 25, GFX_e61b0 ; 25 + pikapicanimgfx -1, Pic_e6340 ; 26 + pikapicanimgfx 25, GFX_e63f7 ; 27 + pikapicanimgfx -1, Pic_e6587 ; 28 + pikapicanimgfx 25, GFX_e6646 ; 29 + pikapicanimgfx -1, Pic_e67d6 ; 2a + pikapicanimgfx 25, GFX_e682f ; 2b + pikapicanimgfx 25, GFX_e69bf ; 2c + pikapicanimgfx 25, GFX_e6b4f ; 2d + pikapicanimgfx 25, GFX_e6cdf ; 2e + pikapicanimgfx 25, GFX_e6e6f ; 2f + pikapicanimgfx 25, GFX_e6fff ; 30 + pikapicanimgfx 25, GFX_e718f ; 31 + pikapicanimgfx 25, GFX_e731f ; 32 + pikapicanimgfx 25, GFX_e74af ; 33 + pikapicanimgfx 25, GFX_e763f ; 34 + pikapicanimgfx -1, Pic_e77cf ; 35 + pikapicanimgfx 25, GFX_e7863 ; 36 + pikapicanimgfx 25, GFX_e79f3 ; 37 + pikapicanimgfx 25, GFX_e7b83 ; 38 + pikapicanimgfx 25, GFX_e7d13 ; 39 + pikapicanimgfx -1, Pic_f0abf ; 3a + pikapicanimgfx 25, GFX_f0b64 ; 3b + pikapicanimgfx -1, Pic_f0cf4 ; 3c + pikapicanimgfx 25, GFX_f0d82 ; 3d + pikapicanimgfx 24, PikachuSprite ; 3e diff --git a/data/pikachu_pic_objects.asm b/data/pikachu_pic_objects.asm new file mode 100755 index 00000000..940c1141 --- /dev/null +++ b/data/pikachu_pic_objects.asm @@ -0,0 +1,300 @@ +PikaPicAnimBGFramesPointers: +pikaanim_def: macro +\1_id: dw \1 + endm + + pikaanim_def PikaPicAnimBGFrames_0 ; 00 + pikaanim_def PikaPicAnimBGFrames_1 ; 01 + pikaanim_def PikaPicAnimBGFrames_2 ; 02 + pikaanim_def PikaPicAnimBGFrames_3 ; 03 + pikaanim_def PikaPicAnimBGFrames_4 ; 04 + pikaanim_def PikaPicAnimBGFrames_5 ; 05 + pikaanim_def PikaPicAnimBGFrames_6 ; 06 + pikaanim_def PikaPicAnimBGFrames_7 ; 07 + pikaanim_def PikaPicAnimBGFrames_8 ; 08 + pikaanim_def PikaPicAnimBGFrames_9 ; 09 + pikaanim_def PikaPicAnimBGFrames_10 ; 0a + pikaanim_def PikaPicAnimBGFrames_11 ; 0b + pikaanim_def PikaPicAnimBGFrames_12 ; 0c + pikaanim_def PikaPicAnimBGFrames_13 ; 0d + pikaanim_def PikaPicAnimBGFrames_14 ; 0e + pikaanim_def PikaPicAnimBGFrames_15 ; 0f + pikaanim_def PikaPicAnimBGFrames_16 ; 10 + pikaanim_def PikaPicAnimBGFrames_17 ; 11 + pikaanim_def PikaPicAnimBGFrames_18 ; 12 + pikaanim_def PikaPicAnimBGFrames_19 ; 13 + pikaanim_def PikaPicAnimBGFrames_20 ; 14 + pikaanim_def PikaPicAnimBGFrames_21 ; 15 + pikaanim_def PikaPicAnimBGFrames_22 ; 16 + pikaanim_def PikaPicAnimBGFrames_23 ; 17 + pikaanim_def PikaPicAnimBGFrames_24 ; 18 + pikaanim_def PikaPicAnimBGFrames_25 ; 19 + pikaanim_def PikaPicAnimBGFrames_26 ; 1a + pikaanim_def PikaPicAnimBGFrames_27 ; 1b + pikaanim_def PikaPicAnimBGFrames_28 ; 1c + pikaanim_def PikaPicAnimBGFrames_29 ; 1d + pikaanim_def PikaPicAnimBGFrames_30 ; 1e + pikaanim_def PikaPicAnimBGFrames_31 ; 1f + pikaanim_def PikaPicAnimBGFrames_32 ; 20 + pikaanim_def PikaPicAnimBGFrames_33 ; 21 + pikaanim_def PikaPicAnimBGFrames_34 ; 22 + pikaanim_def PikaPicAnimBGFrames_35 ; 23 + +PikaPicAnimBGFrames_0: +PikaPicAnimBGFrames_1: + ; Tilemap idx, duration + pikaframe PikaAnimTilemap_1, 20 + pikaframe PikaAnimTilemap_7, 2 + pikaframe PikaAnimTilemap_1, 1 + pikaframe PikaAnimTilemap_7, 2 + pikaframe PikaAnimTilemap_1, 1 + pikaframe PikaAnimTilemap_7, 8 + pikaframeend + +PikaPicAnimBGFrames_fdc1e: ; unreferenced + pikaframe PikaAnimTilemap_2, 2 + pikaframe PikaAnimTilemap_1, 1 + pikaframe PikaAnimTilemap_2, 2 + pikaframe PikaAnimTilemap_1, 1 + pikaframe PikaAnimTilemap_2, 8 + pikaframeend + +PikaPicAnimBGFrames_2: + pikaframedelay 8 + pikaframe PikaAnimTilemap_8, 8 + pikaframedelay 8 + pikaframe PikaAnimTilemap_8, 8 + pikaframeend + +PikaPicAnimBGFrames_3: + pikaframe PikaAnimTilemap_8, 8 + pikaframedelay 8 + pikaframe PikaAnimTilemap_8, 8 + pikaframedelay 8 + pikaframeend + +PikaPicAnimBGFrames_4: +PikaPicAnimBGFrames_35: + pikaframe PikaAnimTilemap_1, 0 + pikaframeend + +PikaPicAnimBGFrames_5: + pikaframe PikaAnimTilemap_9, 0 + pikaframeend + +PikaPicAnimBGFrames_6: + pikaframedelay 2 + pikaframe PikaAnimTilemap_14, 4 + pikaframedelay 8 + pikaframe PikaAnimTilemap_14, 4 + pikaframedelay 64 + pikaframe PikaAnimTilemap_14, 4 + pikaframedelay 64 + pikaframeend + +PikaPicAnimBGFrames_7: + pikaframedelay 4 + pikaframe PikaAnimTilemap_15, 4 + pikaframedelay 4 + pikaframe PikaAnimTilemap_15, 4 + pikaframedelay 8 + pikaframe PikaAnimTilemap_15, 4 + pikaframedelay 8 + pikaframe PikaAnimTilemap_15, 4 + pikaframeend + +PikaPicAnimBGFrames_8: + pikaframe PikaAnimTilemap_16, 1 + pikaframedelay 1 + pikaframe PikaAnimTilemap_16, 1 + pikaframedelay 64 + pikaframe PikaAnimTilemap_16, 1 + pikaframedelay 64 + pikaframeend + +PikaPicAnimBGFrames_9: + pikaframedelay 8 + pikaframe PikaAnimTilemap_17, 8 + pikaframedelay 20 + pikaframe PikaAnimTilemap_17, 8 + pikaframeend + +PikaPicAnimBGFrames_10: + pikaframedelay 2 + pikaframe PikaAnimTilemap_18, 2 + pikaframedelay 2 + pikaframe PikaAnimTilemap_18, 64 + pikaframedelay 3 + pikaframe PikaAnimTilemap_18, 64 + pikaframeend + +PikaPicAnimBGFrames_11: + pikaframedelay 8 + pikaframe PikaAnimTilemap_19, 64 + pikaframedelay 4 + pikaframe PikaAnimTilemap_19, 64 + pikaframeend + +PikaPicAnimBGFrames_12: + pikaframe PikaAnimTilemap_20, 8 + pikaframedelay 2 + pikaframe PikaAnimTilemap_20, 8 + pikaframedelay 2 + pikaframe PikaAnimTilemap_20, 8 + pikaframeend + +PikaPicAnimBGFrames_13: + pikaframe PikaAnimTilemap_21, 4 + pikaframedelay 8 + pikaframe PikaAnimTilemap_21, 4 + pikaframedelay 64 + pikaframe PikaAnimTilemap_21, 4 + pikaframedelay 64 + pikaframeend + +PikaPicAnimBGFrames_14: + pikaframedelay 2 + pikaframe PikaAnimTilemap_22, 2 + pikaframedelay 2 + pikaframe PikaAnimTilemap_22, 2 + pikaframedelay 20 + pikaframe PikaAnimTilemap_22, 2 + pikaframeend + +PikaPicAnimBGFrames_15: + pikaframedelay 8 + pikaframe PikaAnimTilemap_23, 8 + pikaframeend + +PikaPicAnimBGFrames_16: + pikaframedelay 8 + pikaframe PikaAnimTilemap_23, 3 + pikaframe PikaAnimTilemap_24, 5 + pikaframe PikaAnimTilemap_23, 3 + pikaframedelay 5 + pikaframeend + +PikaPicAnimBGFrames_17: + pikaframedelay 20 + pikaframe PikaAnimTilemap_25, 8 + pikaframedelay 20 + pikaframe PikaAnimTilemap_25, 8 + pikaframeend + +PikaPicAnimBGFrames_18: + pikaframedelay 13 + pikaframe PikaAnimTilemap_26, 12 + pikaframedelay 100 + pikaframe PikaAnimTilemap_26, 8 + pikaframeend + +PikaPicAnimBGFrames_19: + pikaframedelay 5 + pikaframe PikaAnimTilemap_27, 5 + pikaframedelay 5 + pikaframe PikaAnimTilemap_27, 5 + pikaframedelay 100 + pikaframeend + +PikaPicAnimBGFrames_20: + pikaframedelay 2 + pikaframe PikaAnimTilemap_28, 2 + pikaframedelay 2 + pikaframe PikaAnimTilemap_28, 2 + pikaframeend + +PikaPicAnimBGFrames_21: + pikaframedelay 5 + pikaframe PikaAnimTilemap_29, 5 + pikaframedelay 5 + pikaframe PikaAnimTilemap_29, 5 + pikaframeend + +PikaPicAnimBGFrames_22: + pikaframe PikaAnimTilemap_30, 8 + pikaframedelay 100 + pikaframeend + +PikaPicAnimBGFrames_23: + pikaframedelay 10 + pikaframe PikaAnimTilemap_31, 3 + pikaframedelay 3 + pikaframe PikaAnimTilemap_31, 3 + pikaframedelay 100 + pikaframeend + +PikaPicAnimBGFrames_24: + pikaframedelay 3 + pikaframe PikaAnimTilemap_32, 100 + pikaframedelay 8 + pikaframe PikaAnimTilemap_32, 8 + pikaframeend + +PikaPicAnimBGFrames_25: + pikaframe PikaAnimTilemap_33, 6 + pikaframedelay 6 + pikaframe PikaAnimTilemap_33, 6 + pikaframedelay 6 + pikaframeend + +PikaPicAnimBGFrames_26: + pikaframedelay 8 + pikaframe PikaAnimTilemap_34, 12 + pikaframedelay 8 + pikaframe PikaAnimTilemap_34, 12 + pikaframeend + +PikaPicAnimBGFrames_27: + pikaframedelay 8 + pikaframe PikaAnimTilemap_9, 2 + pikaframe PikaAnimTilemap_10, 1 + pikaframe PikaAnimTilemap_11, 1 + pikaframe PikaAnimTilemap_12, 100 + pikaframeend + +PikaPicAnimBGFrames_28: + pikaframedelay 8 + pikaframe PikaAnimTilemap_36, 100 + pikaframeend + +PikaPicAnimBGFrames_29: + pikaframedelay 16 + pikaframe PikaAnimTilemap_37, 16 + pikaframedelay 16 + pikaframe PikaAnimTilemap_37, 16 + pikaframeend + +PikaPicAnimBGFrames_30: + pikaframedelay 6 + pikaframe PikaAnimTilemap_38, 6 + pikaframedelay 6 + pikaframe PikaAnimTilemap_38, 6 + pikaframedelay 100 + pikaframeend + +PikaPicAnimBGFrames_31: + pikaframedelay 6 + pikaframe PikaAnimTilemap_9, 6 + pikaframe PikaAnimTilemap_10, 100 + pikaframeend + +PikaPicAnimBGFrames_32: + pikaframedelay 20 + pikaframe PikaAnimTilemap_9, 8 + pikaframedelay 20 + pikaframe PikaAnimTilemap_9, 8 + pikaframe PikaAnimTilemap_10, 8 + pikaframe PikaAnimTilemap_11, 100 + pikaframeend + +PikaPicAnimBGFrames_33: + pikaframedelay 4 + pikaframe PikaAnimTilemap_9, 100 + pikaframeend + +PikaPicAnimBGFrames_34: + pikaframedelay 12 + pikaframe PikaAnimTilemap_9, 12 + pikaframedelay 12 + pikaframe PikaAnimTilemap_9, 100 + pikaframeend diff --git a/data/pikachu_pic_tilemaps.asm b/data/pikachu_pic_tilemaps.asm new file mode 100755 index 00000000..95882711 --- /dev/null +++ b/data/pikachu_pic_tilemaps.asm @@ -0,0 +1,253 @@ +PikaPicTilemapPointers: +pikatilemap_def: macro +\1_id: dw \1 + endm + + pikatilemap_def PikaAnimTilemap_0 + pikatilemap_def PikaAnimTilemap_1 + pikatilemap_def PikaAnimTilemap_2 + pikatilemap_def PikaAnimTilemap_3 + pikatilemap_def PikaAnimTilemap_4 + pikatilemap_def PikaAnimTilemap_5 + pikatilemap_def PikaAnimTilemap_6 + pikatilemap_def PikaAnimTilemap_7 + pikatilemap_def PikaAnimTilemap_8 + pikatilemap_def PikaAnimTilemap_9 + pikatilemap_def PikaAnimTilemap_10 + pikatilemap_def PikaAnimTilemap_11 + pikatilemap_def PikaAnimTilemap_12 + pikatilemap_def PikaAnimTilemap_13 + pikatilemap_def PikaAnimTilemap_14 + pikatilemap_def PikaAnimTilemap_15 + pikatilemap_def PikaAnimTilemap_16 + pikatilemap_def PikaAnimTilemap_17 + pikatilemap_def PikaAnimTilemap_18 + pikatilemap_def PikaAnimTilemap_19 + pikatilemap_def PikaAnimTilemap_20 + pikatilemap_def PikaAnimTilemap_21 + pikatilemap_def PikaAnimTilemap_22 + pikatilemap_def PikaAnimTilemap_23 + pikatilemap_def PikaAnimTilemap_24 + pikatilemap_def PikaAnimTilemap_25 + pikatilemap_def PikaAnimTilemap_26 + pikatilemap_def PikaAnimTilemap_27 + pikatilemap_def PikaAnimTilemap_28 + pikatilemap_def PikaAnimTilemap_29 + pikatilemap_def PikaAnimTilemap_30 + pikatilemap_def PikaAnimTilemap_31 + pikatilemap_def PikaAnimTilemap_32 + pikatilemap_def PikaAnimTilemap_33 + pikatilemap_def PikaAnimTilemap_34 + pikatilemap_def PikaAnimTilemap_35 + pikatilemap_def PikaAnimTilemap_36 + pikatilemap_def PikaAnimTilemap_37 + pikatilemap_def PikaAnimTilemap_38 + pikatilemap_def PikaAnimTilemap_39 + pikatilemap_def PikaAnimTilemap_40 + pikatilemap_def PikaAnimTilemap_41 + pikatilemap_def PikaAnimTilemap_42 + +PikaAnimTilemap_0: + db $ff ; unused + + + ; $ff inhibits overwriting that tile +PikaAnimTilemap_1: +PikaAnimTilemap_42: + db 5, 5 + db $00, $05, $0a, $0f, $14 + db $01, $06, $0b, $10, $15 + db $02, $07, $0c, $11, $16 + db $03, $08, $0d, $12, $17 + db $04, $09, $0e, $13, $18 + +PikaAnimTilemap_2: + db 5, 5 + db $19, $1e, $23, $28, $2d + db $1a, $1f, $24, $29, $2e + db $1b, $20, $25, $2a, $2f + db $1c, $21, $26, $2b, $30 + db $1d, $22, $27, $2c, $31 + +PikaAnimTilemap_7: + db 5, 5 + db $ff, $ff, $ff, $ff, $ff + db $ff, $ff, $ff, $ff, $ff + db $ff, $20, $25, $ff, $ff + db $ff, $21, $26, $ff, $ff + db $ff, $ff, $ff, $ff, $ff + +PikaAnimTilemap_3: + db 1, 1 + db $00 + +PikaAnimTilemap_4: + db 2, 1 + db $00 + db $01 + +PikaAnimTilemap_5: + db 1, 2 + db $00, $01 + +PikaAnimTilemap_6: +PikaAnimTilemap_8: + db 2, 2 + db $00, $01 + db $02, $03 + +PikaAnimTilemap_fde71: ; unused + db 3, 2 + db $00, $01 + db $02, $03 + db $04, $05 + +PikaAnimTilemap_fde79: ; unused + db 2, 3 + db $00, $01, $02 + db $03, $04, $05 + +PikaAnimTilemap_14: + db 5, 5 + db $ff, $ff, $ff, $ff, $ff + db $ff, $ff, $ff, $ff, $ff + db $00, $01, $02, $03, $04 + db $ff, $ff, $ff, $ff, $ff + db $ff, $ff, $ff, $ff, $ff + +PikaAnimTilemap_15: + db 5, 5 + db $ff, $ff, $ff, $ff, $ff + db $ff, $ff, $ff, $ff, $ff + db $ff, $ff, $ff, $ff, $ff + db $00, $01, $02, $03, $04 + db $05, $06, $07, $08, $09 + +PikaAnimTilemap_16: + db 5, 5 + db $00, $01, $ff, $ff, $ff + db $02, $03, $ff, $ff, $ff + db $04, $05, $ff, $ff, $ff + db $ff, $ff, $ff, $ff, $ff + db $ff, $ff, $ff, $ff, $ff + +PikaAnimTilemap_17: + db 5, 5 + db $ff, $ff, $ff, $ff, $ff + db $00, $01, $02, $03, $04 + db $05, $06, $07, $08, $09 + db $0a, $0b, $0c, $0d, $0e + db $0f, $10, $11, $12, $13 + +PikaAnimTilemap_18: + db 5, 5 + db $ff, $ff, $ff, $ff, $ff + db $ff, $ff, $ff, $00, $01 + db $ff, $ff, $ff, $02, $03 + db $ff, $ff, $ff, $ff, $ff + db $ff, $ff, $ff, $ff, $ff + +PikaAnimTilemap_19: + db 5, 5 + db $ff, $ff, $ff, $ff, $ff + db $ff, $ff, $ff, $ff, $ff + db $00, $01, $ff, $ff, $ff + db $02, $03, $ff, $ff, $ff + db $ff, $ff, $ff, $ff, $ff + +PikaAnimTilemap_20: + db 5, 5 + db $00, $01, $02, $03, $04 + db $05, $06, $07, $08, $09 + db $0a, $0b, $0c, $0d, $0e + db $0f, $10, $11, $12, $13 + db $14, $15, $16, $17, $18 + +PikaAnimTilemap_21: + db 5, 5 + db $ff, $ff, $ff, $ff, $ff + db $ff, $ff, $ff, $ff, $ff + db $00, $01, $02, $03, $04 + db $05, $06, $07, $08, $09 + db $ff, $ff, $ff, $ff, $ff + +PikaAnimTilemap_22: + db 5, 5 + db $ff, $ff, $ff, $ff, $ff + db $ff, $ff, $ff, $ff, $ff + db $00, $01, $ff, $ff, $ff + db $02, $03, $ff, $ff, $ff + db $04, $05, $ff, $ff, $ff + +PikaAnimTilemap_23: + db 5, 5 + db $00, $01, $02, $03, $04 + db $05, $06, $07, $08, $09 + db $0a, $0b, $0c, $0d, $0e + db $0f, $10, $11, $12, $13 + db $14, $15, $16, $17, $18 + +PikaAnimTilemap_24: + db 5, 5 + db $19, $1a, $1b, $1c, $1d + db $1e, $1f, $20, $21, $22 + db $23, $24, $25, $26, $27 + db $28, $29, $2a, $2b, $2c + db $2d, $2e, $2f, $30, $31 + +PikaAnimTilemap_9: +PikaAnimTilemap_25: +PikaAnimTilemap_26: +PikaAnimTilemap_27: +PikaAnimTilemap_28: +PikaAnimTilemap_29: +PikaAnimTilemap_30: +PikaAnimTilemap_31: +PikaAnimTilemap_32: +PikaAnimTilemap_33: +PikaAnimTilemap_34: +PikaAnimTilemap_35: +PikaAnimTilemap_36: +PikaAnimTilemap_37: +PikaAnimTilemap_38: +PikaAnimTilemap_39: + db 5, 5 + db $00, $01, $02, $03, $04 + db $05, $06, $07, $08, $09 + db $0a, $0b, $0c, $0d, $0e + db $0f, $10, $11, $12, $13 + db $14, $15, $16, $17, $18 + +PikaAnimTilemap_10: +PikaAnimTilemap_40: + db 5, 5 + db $19, $1a, $1b, $1c, $1d + db $1e, $1f, $20, $21, $22 + db $23, $24, $25, $26, $27 + db $28, $29, $2a, $2b, $2c + db $2d, $2e, $2f, $30, $31 + +PikaAnimTilemap_11: +PikaAnimTilemap_41: + db 5, 5 + db $32, $33, $34, $35, $36 + db $37, $38, $39, $3a, $3b + db $3c, $3d, $3e, $3f, $40 + db $41, $42, $43, $44, $45 + db $46, $47, $48, $49, $4a + +PikaAnimTilemap_12: + db 5, 5 + db $4b, $4c, $4d, $4e, $4f + db $50, $51, $52, $53, $54 + db $55, $56, $57, $58, $59 + db $5a, $5b, $5c, $5d, $5e + db $5f, $60, $61, $62, $63 + +PikaAnimTilemap_13: + db 5, 5 + db $64, $65, $66, $67, $68 + db $69, $6a, $6b, $6c, $6d + db $6e, $6f, $70, $71, $72 + db $73, $74, $75, $76, $77 + db $78, $79, $7a, $7b, $7c diff --git a/data/pokedex_entries.asm b/data/pokedex_entries.asm index 3fb2d3c6..1f35a0d5 100755 --- a/data/pokedex_entries.asm +++ b/data/pokedex_entries.asm @@ -195,60 +195,11 @@ PokedexEntryPointers: ; weight in pounds ; text entry -RhydonDexEntry: - db "DRILL@" - db 6,3 - dw 2650 - TX_FAR _RhydonDexEntry - db "@" - -KangaskhanDexEntry: - db "PARENT@" - db 7,3 - dw 1760 - TX_FAR _KangaskhanDexEntry - db "@" - -NidoranMDexEntry: - db "POISON PIN@" - db 1,8 - dw 200 - TX_FAR _NidoranMDexEntry - db "@" - -ClefairyDexEntry: - db "FAIRY@" - db 2,0 - dw 170 - TX_FAR _ClefairyDexEntry - db "@" - -SpearowDexEntry: - db "TINY BIRD@" - db 1,0 - dw 40 - TX_FAR _SpearowDexEntry - db "@" - -VoltorbDexEntry: - db "BALL@" - db 1,8 - dw 230 - TX_FAR _VoltorbDexEntry - db "@" - -NidokingDexEntry: - db "DRILL@" - db 4,7 - dw 1370 - TX_FAR _NidokingDexEntry - db "@" - -SlowbroDexEntry: - db "HERMITCRAB@" - db 5,3 - dw 1730 - TX_FAR _SlowbroDexEntry +BulbasaurDexEntry: + db "SEED@" + db 2,4 + dw 150 + TX_FAR _BulbasaurDexEntry db "@" IvysaurDexEntry: @@ -258,165 +209,137 @@ IvysaurDexEntry: TX_FAR _IvysaurDexEntry db "@" -ExeggutorDexEntry: - db "COCONUT@" +VenusaurDexEntry: + db "SEED@" db 6,7 - dw 2650 - TX_FAR _ExeggutorDexEntry - db "@" - -LickitungDexEntry: - db "LICKING@" - db 3,11 - dw 1440 - TX_FAR _LickitungDexEntry - db "@" - -ExeggcuteDexEntry: - db "EGG@" - db 1,4 - dw 60 - TX_FAR _ExeggcuteDexEntry - db "@" - -GrimerDexEntry: - db "SLUDGE@" - db 2,11 - dw 660 - TX_FAR _GrimerDexEntry + dw 2210 + TX_FAR _VenusaurDexEntry db "@" -GengarDexEntry: - db "SHADOW@" - db 4,11 - dw 890 - TX_FAR _GengarDexEntry +CharmanderDexEntry: + db "LIZARD@" + db 2, + dw 190 + TX_FAR _CharmanderDexEntry db "@" -NidoranFDexEntry: - db "POISON PIN@" - db 1,4 - dw 150 - TX_FAR _NidoranFDexEntry +CharmeleonDexEntry: + db "FLAME@" + db 3,7 + dw 420 + TX_FAR _CharmeleonDexEntry db "@" -NidoqueenDexEntry: - db "DRILL@" - db 4,3 - dw 1320 - TX_FAR _NidoqueenDexEntry +CharizardDexEntry: + db "FLAME@" + db 5,7 + dw 2000 + TX_FAR _CharizardDexEntry db "@" -CuboneDexEntry: - db "LONELY@" - db 1,4 - dw 140 - TX_FAR _CuboneDexEntry +SquirtleDexEntry: + db "TINYTURTLE@" + db 1,8 + dw 200 + TX_FAR _SquirtleDexEntry db "@" -RhyhornDexEntry: - db "SPIKES@" +WartortleDexEntry: + db "TURTLE@" db 3,3 - dw 2540 - TX_FAR _RhyhornDexEntry - db "@" - -LaprasDexEntry: - db "TRANSPORT@" - db 8,2 - dw 4850 - TX_FAR _LaprasDexEntry + dw 500 + TX_FAR _WartortleDexEntry db "@" -ArcanineDexEntry: - db "LEGENDARY@" - db 6,3 - dw 3420 - TX_FAR _ArcanineDexEntry +BlastoiseDexEntry: + db "SHELLFISH@" + db 5,3 + dw 1890 + TX_FAR _BlastoiseDexEntry db "@" -MewDexEntry: - db "NEW SPECIE@" - db 1,4 - dw 90 - TX_FAR _MewDexEntry +CaterpieDexEntry: + db "WORM@" + db 1, + dw 60 + TX_FAR _CaterpieDexEntry db "@" -GyaradosDexEntry: - db "ATROCIOUS@" - db 21,4 - dw 5180 - TX_FAR _GyaradosDexEntry +MetapodDexEntry: + db "COCOON@" + db 2,4 + dw 220 + TX_FAR _MetapodDexEntry db "@" -ShellderDexEntry: - db "BIVALVE@" - db 1,0 - dw 90 - TX_FAR _ShellderDexEntry +ButterfreeDexEntry: + db "BUTTERFLY@" + db 3,7 + dw 710 + TX_FAR _ButterfreeDexEntry db "@" -TentacoolDexEntry: - db "JELLYFISH@" - db 2,11 - dw 1000 - TX_FAR _TentacoolDexEntry +WeedleDexEntry: + db "HAIRY BUG@" + db 1, + dw 70 + TX_FAR _WeedleDexEntry db "@" -GastlyDexEntry: - db "GAS@" - db 4,3 - dw 2 - TX_FAR _GastlyDexEntry +KakunaDexEntry: + db "COCOON@" + db 2, + dw 220 + TX_FAR _KakunaDexEntry db "@" -ScytherDexEntry: - db "MANTIS@" - db 4,11 - dw 1230 - TX_FAR _ScytherDexEntry +BeedrillDexEntry: + db "POISON BEE@" + db 3,3 + dw 650 + TX_FAR _BeedrillDexEntry db "@" -StaryuDexEntry: - db "STARSHAPE@" - db 2,7 - dw 760 - TX_FAR _StaryuDexEntry +PidgeyDexEntry: + db "TINY BIRD@" + db 1, + dw 40 + TX_FAR _PidgeyDexEntry db "@" -BlastoiseDexEntry: - db "SHELLFISH@" - db 5,3 - dw 1890 - TX_FAR _BlastoiseDexEntry +PidgeottoDexEntry: + db "BIRD@" + db 3,7 + dw 660 + TX_FAR _PidgeottoDexEntry db "@" -PinsirDexEntry: - db "STAGBEETLE@" +PidgeotDexEntry: + db "BIRD@" db 4,11 - dw 1210 - TX_FAR _PinsirDexEntry + dw 870 + TX_FAR _PidgeotDexEntry db "@" -TangelaDexEntry: - db "VINE@" - db 3,3 - dw 770 - TX_FAR _TangelaDexEntry +RattataDexEntry: + db "RAT@" + db 1, + dw 80 + TX_FAR _RattataDexEntry db "@" -GrowlitheDexEntry: - db "PUPPY@" +RaticateDexEntry: + db "RAT@" db 2,4 - dw 420 - TX_FAR _GrowlitheDexEntry + dw 410 + TX_FAR _RaticateDexEntry db "@" -OnixDexEntry: - db "ROCK SNAKE@" - db 28,10 - dw 4630 - TX_FAR _OnixDexEntry +SpearowDexEntry: + db "TINY BIRD@" + db 1, + dw 40 + TX_FAR _SpearowDexEntry db "@" FearowDexEntry: @@ -426,165 +349,179 @@ FearowDexEntry: TX_FAR _FearowDexEntry db "@" -PidgeyDexEntry: - db "TINY BIRD@" - db 1,0 - dw 40 - TX_FAR _PidgeyDexEntry - db "@" - -SlowpokeDexEntry: - db "DOPEY@" - db 3,11 - dw 790 - TX_FAR _SlowpokeDexEntry +EkansDexEntry: + db "SNAKE@" + db 6,7 + dw 150 + TX_FAR _EkansDexEntry db "@" -KadabraDexEntry: - db "PSI@" - db 4,3 - dw 1250 - TX_FAR _KadabraDexEntry +ArbokDexEntry: + db "COBRA@" + db 11,6 + dw 1430 + TX_FAR _ArbokDexEntry db "@" -GravelerDexEntry: - db "ROCK@" - db 3,3 - dw 2320 - TX_FAR _GravelerDexEntry +PikachuDexEntry: + db "MOUSE@" + db 1,4 + dw 130 + TX_FAR _PikachuDexEntry db "@" -ChanseyDexEntry: - db "EGG@" - db 3,7 - dw 760 - TX_FAR _ChanseyDexEntry +RaichuDexEntry: + db "MOUSE@" + db 2,7 + dw 660 + TX_FAR _RaichuDexEntry db "@" -MachokeDexEntry: - db "SUPERPOWER@" - db 4,11 - dw 1550 - TX_FAR _MachokeDexEntry +SandshrewDexEntry: + db "MOUSE@" + db 2, + dw 260 + TX_FAR _SandshrewDexEntry db "@" -MrMimeDexEntry: - db "BARRIER@" - db 4,3 - dw 1200 - TX_FAR _MrMimeDexEntry +SandslashDexEntry: + db "MOUSE@" + db 3,3 + dw 650 + TX_FAR _SandslashDexEntry db "@" -HitmonleeDexEntry: - db "KICKING@" - db 4,11 - dw 1100 - TX_FAR _HitmonleeDexEntry +NidoranFDexEntry: + db "POISON PIN@" + db 1,4 + dw 150 + TX_FAR _NidoranFDexEntry db "@" -HitmonchanDexEntry: - db "PUNCHING@" - db 4,7 - dw 1110 - TX_FAR _HitmonchanDexEntry +NidorinaDexEntry: + db "POISON PIN@" + db 2,7 + dw 440 + TX_FAR _NidorinaDexEntry db "@" -ArbokDexEntry: - db "COBRA@" - db 11,6 - dw 1430 - TX_FAR _ArbokDexEntry +NidoqueenDexEntry: + db "DRILL@" + db 4,3 + dw 1320 + TX_FAR _NidoqueenDexEntry db "@" -ParasectDexEntry: - db "MUSHROOM@" - db 3,3 - dw 650 - TX_FAR _ParasectDexEntry +NidoranMDexEntry: + db "POISON PIN@" + db 1,8 + dw 200 + TX_FAR _NidoranMDexEntry db "@" -PsyduckDexEntry: - db "DUCK@" - db 2,7 +NidorinoDexEntry: + db "POISON PIN@" + db 2,11 dw 430 - TX_FAR _PsyduckDexEntry + TX_FAR _NidorinoDexEntry db "@" -DrowzeeDexEntry: - db "HYPNOSIS@" - db 3,3 - dw 710 - TX_FAR _DrowzeeDexEntry +NidokingDexEntry: + db "DRILL@" + db 4,7 + dw 1370 + TX_FAR _NidokingDexEntry db "@" -GolemDexEntry: - db "MEGATON@" - db 4,7 - dw 6620 - TX_FAR _GolemDexEntry +ClefairyDexEntry: + db "FAIRY@" + db 2, + dw 170 + TX_FAR _ClefairyDexEntry db "@" -MagmarDexEntry: - db "SPITFIRE@" +ClefableDexEntry: + db "FAIRY@" db 4,3 - dw 980 - TX_FAR _MagmarDexEntry + dw 880 + TX_FAR _ClefableDexEntry db "@" -ElectabuzzDexEntry: - db "ELECTRIC@" +VulpixDexEntry: + db "FOX@" + db 2, + dw 220 + TX_FAR _VulpixDexEntry + db "@" + +NinetalesDexEntry: + db "FOX@" db 3,7 - dw 660 - TX_FAR _ElectabuzzDexEntry + dw 440 + TX_FAR _NinetalesDexEntry db "@" -MagnetonDexEntry: - db "MAGNET@" +JigglypuffDexEntry: + db "BALLOON@" + db 1,8 + dw 120 + TX_FAR _JigglypuffDexEntry + db "@" + +WigglytuffDexEntry: + db "BALLOON@" db 3,3 - dw 1320 - TX_FAR _MagnetonDexEntry + dw 260 + TX_FAR _WigglytuffDexEntry db "@" -KoffingDexEntry: - db "POISON GAS@" - db 2,0 - dw 20 - TX_FAR _KoffingDexEntry +ZubatDexEntry: + db "BAT@" + db 2,7 + dw 170 + TX_FAR _ZubatDexEntry db "@" -MankeyDexEntry: - db "PIG MONKEY@" +GolbatDexEntry: + db "BAT@" + db 5,3 + dw 1210 + TX_FAR _GolbatDexEntry + db "@" + +OddishDexEntry: + db "WEED@" db 1,8 - dw 620 - TX_FAR _MankeyDexEntry + dw 120 + TX_FAR _OddishDexEntry db "@" -SeelDexEntry: - db "SEA LION@" - db 3,7 - dw 1980 - TX_FAR _SeelDexEntry +GloomDexEntry: + db "WEED@" + db 2,7 + dw 190 + TX_FAR _GloomDexEntry db "@" -DiglettDexEntry: - db "MOLE@" - db 0,8 - dw 20 - TX_FAR _DiglettDexEntry +VileplumeDexEntry: + db "FLOWER@" + db 3,11 + dw 410 + TX_FAR _VileplumeDexEntry db "@" -TaurosDexEntry: - db "WILD BULL@" - db 4,7 - dw 1950 - TX_FAR _TaurosDexEntry +ParasDexEntry: + db "MUSHROOM@" + db 1, + dw 120 + TX_FAR _ParasDexEntry db "@" -FarfetchdDexEntry: - db "WILD DUCK@" - db 2,7 - dw 330 - TX_FAR _FarfetchdDexEntry +ParasectDexEntry: + db "MUSHROOM@" + db 3,3 + dw 650 + TX_FAR _ParasectDexEntry db "@" VenonatDexEntry: @@ -594,60 +531,25 @@ VenonatDexEntry: TX_FAR _VenonatDexEntry db "@" -DragoniteDexEntry: - db "DRAGON@" - db 7,3 - dw 4630 - TX_FAR _DragoniteDexEntry - db "@" - -DoduoDexEntry: - db "TWIN BIRD@" - db 4,7 - dw 860 - TX_FAR _DoduoDexEntry - db "@" - -PoliwagDexEntry: - db "TADPOLE@" - db 2,0 - dw 270 - TX_FAR _PoliwagDexEntry - db "@" - -JynxDexEntry: - db "HUMANSHAPE@" - db 4,7 - dw 900 - TX_FAR _JynxDexEntry - db "@" - -MoltresDexEntry: - db "FLAME@" - db 6,7 - dw 1320 - TX_FAR _MoltresDexEntry - db "@" - -ArticunoDexEntry: - db "FREEZE@" - db 5,7 - dw 1220 - TX_FAR _ArticunoDexEntry +VenomothDexEntry: + db "POISONMOTH@" + db 4,11 + dw 280 + TX_FAR _VenomothDexEntry db "@" -ZapdosDexEntry: - db "ELECTRIC@" - db 5,3 - dw 1160 - TX_FAR _ZapdosDexEntry +DiglettDexEntry: + db "MOLE@" + db ,8 + dw 20 + TX_FAR _DiglettDexEntry db "@" -DittoDexEntry: - db "TRANSFORM@" - db 1,0 - dw 90 - TX_FAR _DittoDexEntry +DugtrioDexEntry: + db "MOLE@" + db 2,4 + dw 730 + TX_FAR _DugtrioDexEntry db "@" MeowthDexEntry: @@ -657,214 +559,228 @@ MeowthDexEntry: TX_FAR _MeowthDexEntry db "@" -KrabbyDexEntry: - db "RIVER CRAB@" - db 1,4 - dw 140 - TX_FAR _KrabbyDexEntry +PersianDexEntry: + db "CLASSY CAT@" + db 3,3 + dw 710 + TX_FAR _PersianDexEntry db "@" -VulpixDexEntry: - db "FOX@" - db 2,0 - dw 220 - TX_FAR _VulpixDexEntry +PsyduckDexEntry: + db "DUCK@" + db 2,7 + dw 430 + TX_FAR _PsyduckDexEntry db "@" -NinetalesDexEntry: - db "FOX@" - db 3,7 - dw 440 - TX_FAR _NinetalesDexEntry +GolduckDexEntry: + db "DUCK@" + db 5,7 + dw 1690 + TX_FAR _GolduckDexEntry db "@" -PikachuDexEntry: - db "MOUSE@" - db 1,4 - dw 130 - TX_FAR _PikachuDexEntry +MankeyDexEntry: + db "PIG MONKEY@" + db 1,8 + dw 620 + TX_FAR _MankeyDexEntry db "@" -RaichuDexEntry: - db "MOUSE@" - db 2,7 - dw 660 - TX_FAR _RaichuDexEntry +PrimeapeDexEntry: + db "PIG MONKEY@" + db 3,3 + dw 710 + TX_FAR _PrimeapeDexEntry db "@" -DratiniDexEntry: - db "DRAGON@" - db 5,11 - dw 70 - TX_FAR _DratiniDexEntry +GrowlitheDexEntry: + db "PUPPY@" + db 2,4 + dw 420 + TX_FAR _GrowlitheDexEntry db "@" -DragonairDexEntry: - db "DRAGON@" - db 13,1 - dw 360 - TX_FAR _DragonairDexEntry +ArcanineDexEntry: + db "LEGENDARY@" + db 6,3 + dw 3420 + TX_FAR _ArcanineDexEntry db "@" -KabutoDexEntry: - db "SHELLFISH@" - db 1,8 - dw 250 - TX_FAR _KabutoDexEntry +PoliwagDexEntry: + db "TADPOLE@" + db 2, + dw 270 + TX_FAR _PoliwagDexEntry db "@" -KabutopsDexEntry: - db "SHELLFISH@" +PoliwhirlDexEntry: + db "TADPOLE@" + db 3,3 + dw 440 + TX_FAR _PoliwhirlDexEntry + db "@" + +PoliwrathDexEntry: + db "TADPOLE@" db 4,3 - dw 890 - TX_FAR _KabutopsDexEntry + dw 1190 + TX_FAR _PoliwrathDexEntry db "@" -HorseaDexEntry: - db "DRAGON@" - db 1,4 - dw 180 - TX_FAR _HorseaDexEntry +AbraDexEntry: + db "PSI@" + db 2,11 + dw 430 + TX_FAR _AbraDexEntry db "@" -SeadraDexEntry: - db "DRAGON@" - db 3,11 - dw 550 - TX_FAR _SeadraDexEntry +KadabraDexEntry: + db "PSI@" + db 4,3 + dw 1250 + TX_FAR _KadabraDexEntry db "@" -SandshrewDexEntry: - db "MOUSE@" - db 2,0 - dw 260 - TX_FAR _SandshrewDexEntry +AlakazamDexEntry: + db "PSI@" + db 4,11 + dw 1060 + TX_FAR _AlakazamDexEntry db "@" -SandslashDexEntry: - db "MOUSE@" - db 3,3 - dw 650 - TX_FAR _SandslashDexEntry +MachopDexEntry: + db "SUPERPOWER@" + db 2,7 + dw 430 + TX_FAR _MachopDexEntry db "@" -OmanyteDexEntry: - db "SPIRAL@" - db 1,4 - dw 170 - TX_FAR _OmanyteDexEntry +MachokeDexEntry: + db "SUPERPOWER@" + db 4,11 + dw 1550 + TX_FAR _MachokeDexEntry db "@" -OmastarDexEntry: - db "SPIRAL@" - db 3,3 - dw 770 - TX_FAR _OmastarDexEntry +MachampDexEntry: + db "SUPERPOWER@" + db 5,3 + dw 2870 + TX_FAR _MachampDexEntry db "@" -JigglypuffDexEntry: - db "BALLOON@" - db 1,8 - dw 120 - TX_FAR _JigglypuffDexEntry +BellsproutDexEntry: + db "FLOWER@" + db 2,4 + dw 90 + TX_FAR _BellsproutDexEntry db "@" -WigglytuffDexEntry: - db "BALLOON@" +WeepinbellDexEntry: + db "FLYCATCHER@" db 3,3 - dw 260 - TX_FAR _WigglytuffDexEntry + dw 140 + TX_FAR _WeepinbellDexEntry db "@" -EeveeDexEntry: - db "EVOLUTION@" - db 1,0 - dw 140 - TX_FAR _EeveeDexEntry +VictreebelDexEntry: + db "FLYCATCHER@" + db 5,7 + dw 340 + TX_FAR _VictreebelDexEntry db "@" -FlareonDexEntry: - db "FLAME@" +TentacoolDexEntry: + db "JELLYFISH@" db 2,11 - dw 550 - TX_FAR _FlareonDexEntry + dw 1000 + TX_FAR _TentacoolDexEntry db "@" -JolteonDexEntry: - db "LIGHTNING@" - db 2,7 - dw 540 - TX_FAR _JolteonDexEntry +TentacruelDexEntry: + db "JELLYFISH@" + db 5,3 + dw 1210 + TX_FAR _TentacruelDexEntry db "@" -VaporeonDexEntry: - db "BUBBLE JET@" +GeodudeDexEntry: + db "ROCK@" + db 1,4 + dw 440 + TX_FAR _GeodudeDexEntry + db "@" + +GravelerDexEntry: + db "ROCK@" db 3,3 - dw 640 - TX_FAR _VaporeonDexEntry + dw 2320 + TX_FAR _GravelerDexEntry db "@" -MachopDexEntry: - db "SUPERPOWER@" - db 2,7 - dw 430 - TX_FAR _MachopDexEntry +GolemDexEntry: + db "MEGATON@" + db 4,7 + dw 6620 + TX_FAR _GolemDexEntry db "@" -ZubatDexEntry: - db "BAT@" - db 2,7 - dw 170 - TX_FAR _ZubatDexEntry +PonytaDexEntry: + db "FIRE HORSE@" + db 3,3 + dw 660 + TX_FAR _PonytaDexEntry db "@" -EkansDexEntry: - db "SNAKE@" - db 6,7 - dw 150 - TX_FAR _EkansDexEntry +RapidashDexEntry: + db "FIRE HORSE@" + db 5,7 + dw 2090 + TX_FAR _RapidashDexEntry db "@" -ParasDexEntry: - db "MUSHROOM@" - db 1,0 - dw 120 - TX_FAR _ParasDexEntry +SlowpokeDexEntry: + db "DOPEY@" + db 3,11 + dw 790 + TX_FAR _SlowpokeDexEntry db "@" -PoliwhirlDexEntry: - db "TADPOLE@" - db 3,3 - dw 440 - TX_FAR _PoliwhirlDexEntry +SlowbroDexEntry: + db "HERMITCRAB@" + db 5,3 + dw 1730 + TX_FAR _SlowbroDexEntry db "@" -PoliwrathDexEntry: - db "TADPOLE@" - db 4,3 - dw 1190 - TX_FAR _PoliwrathDexEntry +MagnemiteDexEntry: + db "MAGNET@" + db 1, + dw 130 + TX_FAR _MagnemiteDexEntry db "@" -WeedleDexEntry: - db "HAIRY BUG@" - db 1,0 - dw 70 - TX_FAR _WeedleDexEntry +MagnetonDexEntry: + db "MAGNET@" + db 3,3 + dw 1320 + TX_FAR _MagnetonDexEntry db "@" -KakunaDexEntry: - db "COCOON@" - db 2,0 - dw 220 - TX_FAR _KakunaDexEntry +FarfetchdDexEntry: + db "WILD DUCK@" + db 2,7 + dw 330 + TX_FAR _FarfetchdDexEntry db "@" -BeedrillDexEntry: - db "POISON BEE@" - db 3,3 - dw 650 - TX_FAR _BeedrillDexEntry +DoduoDexEntry: + db "TWIN BIRD@" + db 4,7 + dw 860 + TX_FAR _DoduoDexEntry db "@" DodrioDexEntry: @@ -874,25 +790,11 @@ DodrioDexEntry: TX_FAR _DodrioDexEntry db "@" -PrimeapeDexEntry: - db "PIG MONKEY@" - db 3,3 - dw 710 - TX_FAR _PrimeapeDexEntry - db "@" - -DugtrioDexEntry: - db "MOLE@" - db 2,4 - dw 730 - TX_FAR _DugtrioDexEntry - db "@" - -VenomothDexEntry: - db "POISONMOTH@" - db 4,11 - dw 280 - TX_FAR _VenomothDexEntry +SeelDexEntry: + db "SEA LION@" + db 3,7 + dw 1980 + TX_FAR _SeelDexEntry db "@" DewgongDexEntry: @@ -902,81 +804,81 @@ DewgongDexEntry: TX_FAR _DewgongDexEntry db "@" -CaterpieDexEntry: - db "WORM@" - db 1,0 - dw 60 - TX_FAR _CaterpieDexEntry +GrimerDexEntry: + db "SLUDGE@" + db 2,11 + dw 660 + TX_FAR _GrimerDexEntry db "@" -MetapodDexEntry: - db "COCOON@" - db 2,4 - dw 220 - TX_FAR _MetapodDexEntry +MukDexEntry: + db "SLUDGE@" + db 3,11 + dw 660 + TX_FAR _MukDexEntry db "@" -ButterfreeDexEntry: - db "BUTTERFLY@" - db 3,7 - dw 710 - TX_FAR _ButterfreeDexEntry +ShellderDexEntry: + db "BIVALVE@" + db 1, + dw 90 + TX_FAR _ShellderDexEntry db "@" -MachampDexEntry: - db "SUPERPOWER@" - db 5,3 - dw 2870 - TX_FAR _MachampDexEntry +CloysterDexEntry: + db "BIVALVE@" + db 4,11 + dw 2920 + TX_FAR _CloysterDexEntry db "@" -GolduckDexEntry: - db "DUCK@" - db 5,7 - dw 1690 - TX_FAR _GolduckDexEntry +GastlyDexEntry: + db "GAS@" + db 4,3 + dw 2 + TX_FAR _GastlyDexEntry db "@" -HypnoDexEntry: - db "HYPNOSIS@" +HaunterDexEntry: + db "GAS@" db 5,3 - dw 1670 - TX_FAR _HypnoDexEntry + dw 2 + TX_FAR _HaunterDexEntry db "@" -GolbatDexEntry: - db "BAT@" - db 5,3 - dw 1210 - TX_FAR _GolbatDexEntry +GengarDexEntry: + db "SHADOW@" + db 4,11 + dw 890 + TX_FAR _GengarDexEntry db "@" -MewtwoDexEntry: - db "GENETIC@" - db 6,7 - dw 2690 - TX_FAR _MewtwoDexEntry +OnixDexEntry: + db "ROCK SNAKE@" + db 28,10 + dw 4630 + TX_FAR _OnixDexEntry db "@" -SnorlaxDexEntry: - db "SLEEPING@" - db 6,11 - dw 10140 - TX_FAR _SnorlaxDexEntry +DrowzeeDexEntry: + db "HYPNOSIS@" + db 3,3 + dw 710 + TX_FAR _DrowzeeDexEntry db "@" -MagikarpDexEntry: - db "FISH@" - db 2,11 - dw 220 - TX_FAR _MagikarpDexEntry +HypnoDexEntry: + db "HYPNOSIS@" + db 5,3 + dw 1670 + TX_FAR _HypnoDexEntry db "@" -MukDexEntry: - db "SLUDGE@" - db 3,11 - dw 660 - TX_FAR _MukDexEntry +KrabbyDexEntry: + db "RIVER CRAB@" + db 1,4 + dw 140 + TX_FAR _KrabbyDexEntry db "@" KinglerDexEntry: @@ -986,11 +888,11 @@ KinglerDexEntry: TX_FAR _KinglerDexEntry db "@" -CloysterDexEntry: - db "BIVALVE@" - db 4,11 - dw 2920 - TX_FAR _CloysterDexEntry +VoltorbDexEntry: + db "BALL@" + db 1,8 + dw 230 + TX_FAR _VoltorbDexEntry db "@" ElectrodeDexEntry: @@ -1000,25 +902,25 @@ ElectrodeDexEntry: TX_FAR _ElectrodeDexEntry db "@" -ClefableDexEntry: - db "FAIRY@" - db 4,3 - dw 880 - TX_FAR _ClefableDexEntry +ExeggcuteDexEntry: + db "EGG@" + db 1,4 + dw 60 + TX_FAR _ExeggcuteDexEntry db "@" -WeezingDexEntry: - db "POISON GAS@" - db 3,11 - dw 210 - TX_FAR _WeezingDexEntry +ExeggutorDexEntry: + db "COCONUT@" + db 6,7 + dw 2650 + TX_FAR _ExeggutorDexEntry db "@" -PersianDexEntry: - db "CLASSY CAT@" - db 3,3 - dw 710 - TX_FAR _PersianDexEntry +CuboneDexEntry: + db "LONELY@" + db 1,4 + dw 140 + TX_FAR _CuboneDexEntry db "@" MarowakDexEntry: @@ -1028,72 +930,93 @@ MarowakDexEntry: TX_FAR _MarowakDexEntry db "@" -HaunterDexEntry: - db "GAS@" - db 5,3 - dw 2 - TX_FAR _HaunterDexEntry +HitmonleeDexEntry: + db "KICKING@" + db 4,11 + dw 1100 + TX_FAR _HitmonleeDexEntry db "@" -AbraDexEntry: - db "PSI@" - db 2,11 - dw 430 - TX_FAR _AbraDexEntry +HitmonchanDexEntry: + db "PUNCHING@" + db 4,7 + dw 1110 + TX_FAR _HitmonchanDexEntry db "@" -AlakazamDexEntry: - db "PSI@" - db 4,11 - dw 1060 - TX_FAR _AlakazamDexEntry +LickitungDexEntry: + db "LICKING@" + db 3,11 + dw 1440 + TX_FAR _LickitungDexEntry db "@" -PidgeottoDexEntry: - db "BIRD@" - db 3,7 - dw 660 - TX_FAR _PidgeottoDexEntry +KoffingDexEntry: + db "POISON GAS@" + db 2, + dw 20 + TX_FAR _KoffingDexEntry db "@" -PidgeotDexEntry: - db "BIRD@" - db 4,11 - dw 870 - TX_FAR _PidgeotDexEntry +WeezingDexEntry: + db "POISON GAS@" + db 3,11 + dw 210 + TX_FAR _WeezingDexEntry db "@" -StarmieDexEntry: - db "MYSTERIOUS@" +RhyhornDexEntry: + db "SPIKES@" + db 3,3 + dw 2540 + TX_FAR _RhyhornDexEntry + db "@" + +RhydonDexEntry: + db "DRILL@" + db 6,3 + dw 2650 + TX_FAR _RhydonDexEntry + db "@" + +ChanseyDexEntry: + db "EGG@" db 3,7 - dw 1760 - TX_FAR _StarmieDexEntry + dw 760 + TX_FAR _ChanseyDexEntry db "@" -BulbasaurDexEntry: - db "SEED@" - db 2,4 - dw 150 - TX_FAR _BulbasaurDexEntry +TangelaDexEntry: + db "VINE@" + db 3,3 + dw 770 + TX_FAR _TangelaDexEntry db "@" -VenusaurDexEntry: - db "SEED@" - db 6,7 - dw 2210 - TX_FAR _VenusaurDexEntry +KangaskhanDexEntry: + db "PARENT@" + db 7,3 + dw 1760 + TX_FAR _KangaskhanDexEntry db "@" -TentacruelDexEntry: - db "JELLYFISH@" - db 5,3 - dw 1210 - TX_FAR _TentacruelDexEntry +HorseaDexEntry: + db "DRAGON@" + db 1,4 + dw 180 + TX_FAR _HorseaDexEntry + db "@" + +SeadraDexEntry: + db "DRAGON@" + db 3,11 + dw 550 + TX_FAR _SeadraDexEntry db "@" GoldeenDexEntry: db "GOLDFISH@" - db 2,0 + db 2, dw 330 TX_FAR _GoldeenDexEntry db "@" @@ -1105,53 +1028,123 @@ SeakingDexEntry: TX_FAR _SeakingDexEntry db "@" -PonytaDexEntry: - db "FIRE HORSE@" - db 3,3 +StaryuDexEntry: + db "STARSHAPE@" + db 2,7 + dw 760 + TX_FAR _StaryuDexEntry + db "@" + +StarmieDexEntry: + db "MYSTERIOUS@" + db 3,7 + dw 1760 + TX_FAR _StarmieDexEntry + db "@" + +MrMimeDexEntry: + db "BARRIER@" + db 4,3 + dw 1200 + TX_FAR _MrMimeDexEntry + db "@" + +ScytherDexEntry: + db "MANTIS@" + db 4,11 + dw 1230 + TX_FAR _ScytherDexEntry + db "@" + +JynxDexEntry: + db "HUMANSHAPE@" + db 4,7 + dw 900 + TX_FAR _JynxDexEntry + db "@" + +ElectabuzzDexEntry: + db "ELECTRIC@" + db 3,7 dw 660 - TX_FAR _PonytaDexEntry + TX_FAR _ElectabuzzDexEntry db "@" -RapidashDexEntry: - db "FIRE HORSE@" - db 5,7 - dw 2090 - TX_FAR _RapidashDexEntry +MagmarDexEntry: + db "SPITFIRE@" + db 4,3 + dw 980 + TX_FAR _MagmarDexEntry db "@" -RattataDexEntry: - db "RAT@" - db 1,0 - dw 80 - TX_FAR _RattataDexEntry +PinsirDexEntry: + db "STAGBEETLE@" + db 4,11 + dw 1210 + TX_FAR _PinsirDexEntry db "@" -RaticateDexEntry: - db "RAT@" - db 2,4 - dw 410 - TX_FAR _RaticateDexEntry +TaurosDexEntry: + db "WILD BULL@" + db 4,7 + dw 1950 + TX_FAR _TaurosDexEntry db "@" -NidorinoDexEntry: - db "POISON PIN@" +MagikarpDexEntry: + db "FISH@" db 2,11 - dw 430 - TX_FAR _NidorinoDexEntry + dw 220 + TX_FAR _MagikarpDexEntry db "@" -NidorinaDexEntry: - db "POISON PIN@" +GyaradosDexEntry: + db "ATROCIOUS@" + db 21,4 + dw 5180 + TX_FAR _GyaradosDexEntry + db "@" + +LaprasDexEntry: + db "TRANSPORT@" + db 8,2 + dw 4850 + TX_FAR _LaprasDexEntry + db "@" + +DittoDexEntry: + db "TRANSFORM@" + db 1, + dw 90 + TX_FAR _DittoDexEntry + db "@" + +EeveeDexEntry: + db "EVOLUTION@" + db 1, + dw 140 + TX_FAR _EeveeDexEntry + db "@" + +VaporeonDexEntry: + db "BUBBLE JET@" + db 3,3 + dw 640 + TX_FAR _VaporeonDexEntry + db "@" + +JolteonDexEntry: + db "LIGHTNING@" db 2,7 - dw 440 - TX_FAR _NidorinaDexEntry + dw 540 + TX_FAR _JolteonDexEntry db "@" -GeodudeDexEntry: - db "ROCK@" - db 1,4 - dw 440 - TX_FAR _GeodudeDexEntry +FlareonDexEntry: + db "FLAME@" + db 2,11 + dw 550 + TX_FAR _FlareonDexEntry db "@" PorygonDexEntry: @@ -1161,99 +1154,112 @@ PorygonDexEntry: TX_FAR _PorygonDexEntry db "@" -AerodactylDexEntry: - db "FOSSIL@" - db 5,11 - dw 1300 - TX_FAR _AerodactylDexEntry +OmanyteDexEntry: + db "SPIRAL@" + db 1,4 + dw 170 + TX_FAR _OmanyteDexEntry db "@" -MagnemiteDexEntry: - db "MAGNET@" - db 1,0 - dw 130 - TX_FAR _MagnemiteDexEntry +OmastarDexEntry: + db "SPIRAL@" + db 3,3 + dw 770 + TX_FAR _OmastarDexEntry db "@" -CharmanderDexEntry: - db "LIZARD@" - db 2,0 - dw 190 - TX_FAR _CharmanderDexEntry +KabutoDexEntry: + db "SHELLFISH@" + db 1,8 + dw 250 + TX_FAR _KabutoDexEntry db "@" -SquirtleDexEntry: - db "TINYTURTLE@" - db 1,8 - dw 200 - TX_FAR _SquirtleDexEntry +KabutopsDexEntry: + db "SHELLFISH@" + db 4,3 + dw 890 + TX_FAR _KabutopsDexEntry db "@" -CharmeleonDexEntry: - db "FLAME@" - db 3,7 - dw 420 - TX_FAR _CharmeleonDexEntry +AerodactylDexEntry: + db "FOSSIL@" + db 5,11 + dw 1300 + TX_FAR _AerodactylDexEntry db "@" -WartortleDexEntry: - db "TURTLE@" - db 3,3 - dw 500 - TX_FAR _WartortleDexEntry +SnorlaxDexEntry: + db "SLEEPING@" + db 6,11 + dw 10140 + TX_FAR _SnorlaxDexEntry db "@" -CharizardDexEntry: - db "FLAME@" +ArticunoDexEntry: + db "FREEZE@" db 5,7 - dw 2000 - TX_FAR _CharizardDexEntry + dw 1220 + TX_FAR _ArticunoDexEntry db "@" -OddishDexEntry: - db "WEED@" - db 1,8 - dw 120 - TX_FAR _OddishDexEntry +ZapdosDexEntry: + db "ELECTRIC@" + db 5,3 + dw 1160 + TX_FAR _ZapdosDexEntry db "@" -GloomDexEntry: - db "WEED@" - db 2,7 - dw 190 - TX_FAR _GloomDexEntry +MoltresDexEntry: + db "FLAME@" + db 6,7 + dw 1320 + TX_FAR _MoltresDexEntry db "@" -VileplumeDexEntry: - db "FLOWER@" - db 3,11 - dw 410 - TX_FAR _VileplumeDexEntry +DratiniDexEntry: + db "DRAGON@" + db 5,11 + dw 70 + TX_FAR _DratiniDexEntry db "@" -BellsproutDexEntry: - db "FLOWER@" - db 2,4 - dw 90 - TX_FAR _BellsproutDexEntry +DragonairDexEntry: + db "DRAGON@" + db 13,1 + dw 360 + TX_FAR _DragonairDexEntry db "@" -WeepinbellDexEntry: - db "FLYCATCHER@" - db 3,3 - dw 140 - TX_FAR _WeepinbellDexEntry +DragoniteDexEntry: + db "DRAGON@" + db 7,3 + dw 4630 + TX_FAR _DragoniteDexEntry db "@" -VictreebelDexEntry: - db "FLYCATCHER@" - db 5,7 - dw 340 - TX_FAR _VictreebelDexEntry +MewtwoDexEntry: + db "GENETIC@" + db 6,7 + dw 2690 + TX_FAR _MewtwoDexEntry + db "@" + +MewDexEntry: + db "NEW SPECIE@" + db 1,4 + dw 90 + TX_FAR _MewDexEntry db "@" MissingNoDexEntry: db "???@" db 10 ; 1.0 m db 100 ; 10.0 kg - db 0,"コメント さくせいちゅう@" ; コメント作成中 (Comment to be written) + text "コメント さくせいちゅう@" ; コメント作成中 (Comment to be written) + +; what the game sees +; db "???@" +; db 10,100 ; 10 feet, 100 inches +; dw 35072 ; dw ("コ" << 8 | 0), 3507.2 lbs +; db "メント さくせいちゅう@" ; a whole bunch of sound effects diff --git a/data/prize_mon_levels.asm b/data/prize_mon_levels.asm index bffa4440..eb126d37 100755 --- a/data/prize_mon_levels.asm +++ b/data/prize_mon_levels.asm @@ -1,19 +1,8 @@ PrizeMonLevelDictionary: -IF DEF(_RED) - db ABRA,9 - db CLEFAIRY,8 - db NIDORINA,17 + db ABRA,15 + db VULPIX,18 + db WIGGLYTUFF,22 - db DRATINI,18 - db SCYTHER,25 + db SCYTHER,30 + db PINSIR,30 db PORYGON,26 -ENDC -IF DEF(_BLUE) - db ABRA,6 - db CLEFAIRY,12 - db NIDORINO,17 - - db PINSIR,20 - db DRATINI,24 - db PORYGON,18 -ENDC diff --git a/data/prizes.asm b/data/prizes.asm index 1120c0d0..b113c7cb 100755 --- a/data/prizes.asm +++ b/data/prizes.asm @@ -8,55 +8,28 @@ PrizeDifferentMenuPtrs: dw PrizeMenuTMsEntries dw PrizeMenuTMsCost -NoThanksText: - db "NO THANKS@" - PrizeMenuMon1Entries: db ABRA - db CLEFAIRY -IF DEF(_RED) - db NIDORINA -ENDC -IF DEF(_BLUE) - db NIDORINO -ENDC + db VULPIX + db WIGGLYTUFF db "@" PrizeMenuMon1Cost: -IF DEF(_RED) - coins 180 - coins 500 -ENDC -IF DEF(_BLUE) - coins 120 - coins 750 -ENDC - coins 1200 + coins 230 + coins 1000 + coins 2680 db "@" PrizeMenuMon2Entries: -IF DEF(_RED) - db DRATINI db SCYTHER -ENDC -IF DEF(_BLUE) db PINSIR - db DRATINI -ENDC db PORYGON db "@" PrizeMenuMon2Cost: -IF DEF(_RED) - coins 2800 - coins 5500 - coins 9999 -ENDC -IF DEF(_BLUE) - coins 2500 - coins 4600 coins 6500 -ENDC + coins 6500 + coins 9999 db "@" PrizeMenuTMsEntries: diff --git a/data/sgb_border.asm b/data/sgb_border.asm index c2afc193..0080b4d2 100755 --- a/data/sgb_border.asm +++ b/data/sgb_border.asm @@ -1,62 +1,87 @@ BorderPalettes: -IF DEF(_RED) - INCBIN "gfx/red/sgbborder.map" -ENDC -IF DEF(_BLUE) - INCBIN "gfx/blue/sgbborder.map" -ENDC + INCBIN "gfx/tilemaps/sgbborder.map" ds $100 -IF DEF(_RED) - RGB 30,29,29 ; PAL_SGB1 - RGB 25,22,25 - RGB 25,17,21 - RGB 24,14,12 -ENDC -IF DEF(_BLUE) - RGB 0,0,0 ; PAL_SGB1 (the first color is not defined, but if used, turns up as 30,29,29... o_O) - RGB 10,17,26 - RGB 5,9,20 - RGB 16,20,27 -ENDC - - ds $18 - -IF DEF(_RED) - RGB 30,29,29 ; PAL_SGB2 - RGB 22,31,16 - RGB 27,20,6 - RGB 15,15,15 -ENDC -IF DEF(_BLUE) - RGB 30,29,29 ; PAL_SGB2 - RGB 27,11,6 - RGB 5,9,20 - RGB 28,25,15 -ENDC - - ds $18 - -IF DEF(_RED) - RGB 30,29,29 ; PAL_SGB3 - RGB 31,31,17 - RGB 18,21,29 - RGB 15,15,15 -ENDC -IF DEF(_BLUE) - RGB 30,29,29 ; PAL_SGB3 - RGB 12,15,11 - RGB 5,9,20 - RGB 14,22,17 -ENDC - - ds $18 + RGB 24, 6, 6 + RGB 31, 25, 9 + RGB 25, 10, 10 + RGB 0, 0, 0 + + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + + RGB 18, 24, 18 + RGB 25, 10, 10 + RGB 15, 25, 15 + RGB 0, 0, 0 + + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + + RGB 18, 6, 31 + RGB 31, 25, 9 + RGB 15, 25, 15 + RGB 0, 0, 0 + + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + + RGB 12, 31, 6 + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 + RGB 31, 31, 25 SGBBorderGraphics: -IF DEF(_RED) - INCBIN "gfx/red/sgbborder.2bpp" -ENDC -IF DEF(_BLUE) - INCBIN "gfx/blue/sgbborder.2bpp" -ENDC + INCBIN "gfx/pokemon_yellow.t6.2bpp" diff --git a/data/sgb_packets.asm b/data/sgb_packets.asm index cae91883..b2cb6e9b 100755 --- a/data/sgb_packets.asm +++ b/data/sgb_packets.asm @@ -52,186 +52,136 @@ DATA_SND: MACRO ENDM BlkPacket_WholeScreen: - ATTR_BLK 1 - ATTR_BLK_DATA %011, 0,0,0, 00,00, 19,17 - ds 8 + db $21 + db $1,$3,$0,$0,$0,$13,$11,$0 + db $0,$0,$0,$0,$0,$0,$0 +BlkPacket_Battle: + db $22 + db $5,$7,$a,$0,$c,$13,$11,$3,$5,$1 + db $0,$a,$3,$3,$0,$a,$7,$13,$a + db $3,$a,$0,$4,$8,$b,$3,$f,$b + db $0,$13,$6 +BlkPacket_StatusScreen: + db $21 + db $1,$7,$5,$1,$0 + db $7,$6,$0,$0,$0,$0,$0,$0,$0 + db $0 +BlkPacket_Pokedex: + db $21 + db $1,$7,$5,$1,$1,$8,$8 + db $0,$0,$0,$0,$0,$0,$0,$0 +BlkPacket_Slots: + db $22 + db $5,$3,$5,$0,$0,$13,$b,$3,$a + db $0,$4,$13,$9,$2,$f,$0,$6,$13 + db $7,$3,$0,$4,$4,$f,$9,$3,$0 + db $0,$c,$13,$11 +BlkPacket_Titlescreen: + db $22 + db $3,$3,$0,$0 + db $0,$13,$7,$3,$a,$0,$8,$13,$11 + db $2,$0,$9,$8,$a,$8,$0,$0,$0 + db $0,$0,$0,$0,$0,$0,$0,$0,$0 +BlkPacket_NidorinoIntro ; 726a1 (1c:66a1) + db $22 + db $3,$3,$5,$0,$0,$13,$3,$3 + db $0,$0,$4,$13,$d,$3,$5,$0,$e + db $13,$11,$0,$0,$0,$0,$0,$0,$0 + db $0,$0,$0,$0,$0 +BlkPacket_PartyMenu: + db $23 + db $7,$6,$10 + db $1,$0,$2,$c,$2,$0,$5,$1,$b + db $1,$2,$0,$5,$3,$b,$3,$2,$0 + db $5,$5,$b,$5,$2,$0,$5,$7,$b + db $7,$2,$0,$5,$9,$b,$9,$2,$0 + db $5,$b,$b,$b,$0,$0,$0,$0 +BlkPacket_TrainerCard: + db $24 + db $a,$2,$0,$3,$c,$4,$d,$2,$5 + db $7,$c,$8,$d,$2,$f,$b,$c,$c + db $d,$2,$a,$10,$b,$11,$c,$2,$5 + db $e,$d,$f,$d,$2,$f,$10,$d,$11 + db $d,$2,$a,$3,$f,$4,$10,$2,$f + db $7,$f,$8,$10,$2,$a,$b,$f,$c + db $10,$2,$5,$f,$f,$10,$10,$0,$0 +BlkPacket_GameFreakIntro: + db $22 + db $3,$7,$5,$5,$b,$7,$d,$2 + db $a,$8,$b,$9,$d,$3,$f,$c,$b + db $e,$d,$0,$0,$0,$0,$0,$0,$0 + db $0,$0,$0,$0,$0 +UnknownPacket_72751: + db $21,$1,$7,$5 + db $4,$0,$f,$5,$0,$0,$0,$0,$0 + db $0,$0,$0 - db $03,$00,$00,$13,$11,$00,$00 +PalPacket_Empty: + PAL_SET 0, 0, 0, 0 -BlkPacket_Battle: - ATTR_BLK 5 - ATTR_BLK_DATA %111, 2,2,0, 00,12, 19,17 ; message box: pal 2 - ATTR_BLK_DATA %011, 1,1,0, 01,00, 10,03 ; enemy HP bar: pal 1 - ATTR_BLK_DATA %011, 0,0,0, 10,07, 19,10 ; player HP bar: pal 0 - ATTR_BLK_DATA %011, 2,2,0, 00,04, 08,11 ; player mon: pal 2 - ATTR_BLK_DATA %011, 3,3,0, 11,00, 19,06 ; enemy mon : pal 3 - - db $03,$00,$00,$13,$0b,$00 - db $03,$00,$0c,$13,$11,$02 - db $03,$01,$00,$0a,$03,$01 - db $03,$0a,$08,$13,$0a,$00 - db $03,$00,$04,$08,$0b,$02 - db $03,$0b,$00,$13,$07,$03 - db $00 +PalPacket_PartyMenu: + PAL_SET PAL_MEWMON, PAL_GREENBAR, PAL_YELLOWBAR, PAL_REDBAR -BlkPacket_StatusScreen: - ATTR_BLK 1 - ATTR_BLK_DATA %111, 1,1,0, 01,00, 07,06 ; mon: pal 1, HP bar: pal 0 - ds 8 +PalPacket_Black: + PAL_SET PAL_BLACK, PAL_BLACK, PAL_BLACK, PAL_BLACK - db $02,$00,$00,$11,$00,$03 - db $01,$00,$07,$06,$01,$03 - db $01,$07,$13,$11,$00,$03 - db $08,$00,$13,$06,$00,$00 +PalPacket_TownMap: + PAL_SET PAL_TOWNMAP, 0, 0, 0 -BlkPacket_Pokedex: - ATTR_BLK 1 - ATTR_BLK_DATA %111, 1,1,0, 01,01, 08,08 ; mon: pal 1, everything else: pal 0 - ds 8 +PalPacket_Pokedex: + PAL_SET PAL_BROWNMON, 0, 0, 0 - db $02,$00,$00,$11,$00,$01 - db $00,$01,$13,$00,$03,$01 - db $01,$08,$08,$01,$03,$01 - db $09,$08,$11,$00,$03,$09 - db $01,$13,$11,$00,$00 +PalPacket_Slots: + PAL_SET PAL_SLOTS1, PAL_SLOTS2, PAL_SLOTS3, PAL_SLOTS4 -BlkPacket_Slots: - ATTR_BLK 5 - ATTR_BLK_DATA %011, 1,1,0, 00,00, 19,11 ; "3" rows and top of screen: pal 1 - ATTR_BLK_DATA %011, 2,2,0, 00,04, 19,09 ; "2" rows: pal 2 - ATTR_BLK_DATA %010, 3,3,0, 00,06, 19,07 ; "1" row: pal 3 - ATTR_BLK_DATA %011, 0,0,0, 04,04, 15,09 ; slot reels: pal 0 - ATTR_BLK_DATA %011, 0,0,0, 00,12, 19,17 ; message box: pal 0 - - db $03,$00,$00,$13,$0b,$01 - db $03,$00,$04,$13,$09,$02 - db $03,$00,$06,$13,$07,$03 - db $03,$04,$04,$0f,$09,$00 - db $03,$00,$0c,$13,$11,$00 - db $00 +PalPacket_Titlescreen: + PAL_SET PAL_LOGO2, PAL_LOGO1, PAL_MEWMON, PAL_PURPLEMON -BlkPacket_Titlescreen: - ATTR_BLK 3 - ATTR_BLK_DATA %011, 0,0,0, 00,00, 19,07 ; pokemon logo: pal 0 - ATTR_BLK_DATA %010, 1,1,0, 00,08, 19,09 ; version text: pal 1 - ATTR_BLK_DATA %011, 2,2,0, 00,10, 19,17 ; player, mon, copyright text: pal 2 - ds 12 - - db $03,$00,$00,$13,$07,$00 - db $03,$00,$08,$13,$09,$01 - db $03,$00,$0a,$13,$11,$02 - db $00 - -BlkPacket_NidorinoIntro: - ATTR_BLK 3 - ATTR_BLK_DATA %011, 1,1,0, 00,00, 19,03 ; upper black bar: pal 1 - ATTR_BLK_DATA %011, 0,0,0, 00,04, 19,13 ; letterbox: pal 0 - ATTR_BLK_DATA %011, 1,1,0, 00,14, 19,17 ; lower black bar: pal 1 - ds 12 - - db $03,$00,$00,$13,$03,$01 - db $03,$00,$04,$13,$0d,$00 - db $03,$00,$0e,$13,$11,$01 - db $00 +PalPacket_TrainerCard: + PAL_SET PAL_MEWMON, PAL_BADGE, PAL_REDMON, PAL_YELLOWMON -BlkPacket_PartyMenu: - ATTR_BLK 7 - ATTR_BLK_DATA %110, 0,0,1, 01,00, 02,12 ; mon sprites: pal 0, everything else: pal 1 - ATTR_BLK_DATA %010, 0,0,0, 05,01, 11,01 ; HP bar 0: pal set dynamically - ATTR_BLK_DATA %010, 0,0,0, 05,03, 11,03 ; HP bar 1: pal set dynamically - ATTR_BLK_DATA %010, 0,0,0, 05,05, 11,05 ; HP bar 2: pal set dynamically - ATTR_BLK_DATA %010, 0,0,0, 05,07, 11,07 ; HP bar 3: pal set dynamically - ATTR_BLK_DATA %010, 0,0,0, 05,09, 11,09 ; HP bar 4: pal set dynamically - ATTR_BLK_DATA %010, 0,0,0, 05,11, 11,11 ; HP bar 5: pal set dynamically - ds 4 - - db $02,$00,$00,$11,$01,$03 - db $01,$00,$02,$0c,$00,$03 - db $01,$0d,$02,$11,$01,$03 - db $03,$00,$13,$11,$01,$03 - db $0c,$00,$12,$01,$00,$03 - db $0c,$02,$12,$03,$00,$03 - db $0c,$04,$12,$05,$00,$03 - db $0c,$06,$12,$07,$00,$03 - db $0c,$08,$12,$09,$00,$03 - db $0c,$0a,$12,$0b,$00,$00 +PalPacket_Generic: + PAL_SET PAL_MEWMON, 0, 0, 0 -BlkPacket_TrainerCard: - ATTR_BLK 10 - ATTR_BLK_DATA %010, 0,0,0, 03,12, 04,13 ; Boulder Badge - ATTR_BLK_DATA %010, 1,1,0, 07,12, 08,13 ; Cascade Badge - ATTR_BLK_DATA %010, 3,3,0, 11,12, 12,13 ; Thunder Badge - ATTR_BLK_DATA %010, 2,2,0, 16,11, 17,12 ; Rainbow Badge - ATTR_BLK_DATA %010, 1,1,0, 14,13, 15,14 ; Rainbow Badge - ATTR_BLK_DATA %010, 3,3,0, 16,13, 17,14 ; Rainbow Badge - ATTR_BLK_DATA %010, 2,2,0, 03,15, 04,16 ; Soul Badge - ATTR_BLK_DATA %010, 3,3,0, 07,15, 08,16 ; Marsh Badge - ATTR_BLK_DATA %010, 2,2,0, 11,15, 12,16 ; Volcano Badge - ATTR_BLK_DATA %010, 1,1,0, 15,15, 16,16 ; Earth Badge - ds 2 - - db $03,$03,$0c,$04,$0d,$00 - db $03,$07,$0c,$08,$0d,$01 - db $03,$0b,$0c,$0c,$0d,$03 - db $03,$10,$0b,$11,$0c,$02 - db $03,$0e,$0d,$0f,$0e,$01 - db $03,$10,$0d,$11,$0e,$03 - db $03,$03,$0f,$04,$10,$02 - db $03,$07,$0f,$08,$10,$03 - db $03,$0b,$0f,$0c,$10,$02 - db $03,$0f,$0f,$10,$10,$01 - db $00 +PalPacket_NidorinoIntro: + PAL_SET PAL_PURPLEMON, PAL_BLACK, 0, 0 -BlkPacket_GameFreakIntro: - ATTR_BLK 3 - ATTR_BLK_DATA %111, 1,1,0, 05,11, 07,13 ; falling stars (left): pal 1, GameFreak logo: pal 0 - ATTR_BLK_DATA %010, 2,2,0, 08,11, 09,13 ; falling stars (middle): pal 2 - ATTR_BLK_DATA %011, 3,3,0, 12,11, 14,13 ; falling stars (right): pal 3 - ds 12 - - db $03,$00,$00,$13,$0a,$00 - db $03,$00,$0b,$04,$0d,$00 - db $03,$05,$0b,$07,$0d,$01 - db $03,$08,$0b,$13,$0d,$00 - db $03,$00,$0e,$13,$11,$00 - db $03,$08,$0b,$09,$0d,$02 - db $03,$0c,$0b,$0e,$0d,$03 - db $00 - - -PalPacket_Empty: PAL_SET 0, 0, 0, 0 -PalPacket_PartyMenu: PAL_SET PAL_MEWMON, PAL_GREENBAR, PAL_YELLOWBAR, PAL_REDBAR -PalPacket_Black: PAL_SET PAL_BLACK, PAL_BLACK, PAL_BLACK, PAL_BLACK -PalPacket_TownMap: PAL_SET PAL_TOWNMAP, 0, 0, 0 -PalPacket_Pokedex: PAL_SET PAL_BROWNMON, 0, 0, 0 -PalPacket_Slots: PAL_SET PAL_SLOTS1, PAL_SLOTS2, PAL_SLOTS3, PAL_SLOTS4 -PalPacket_Titlescreen: PAL_SET PAL_LOGO2, PAL_LOGO1, PAL_MEWMON, PAL_PURPLEMON -PalPacket_TrainerCard: PAL_SET PAL_MEWMON, PAL_BADGE, PAL_REDMON, PAL_YELLOWMON -PalPacket_Generic: PAL_SET PAL_MEWMON, 0, 0, 0 -PalPacket_NidorinoIntro: PAL_SET PAL_PURPLEMON, PAL_BLACK, 0, 0 -PalPacket_GameFreakIntro: PAL_SET PAL_GAMEFREAK, PAL_REDMON, PAL_VIRIDIAN, PAL_BLUEMON - -PalTrnPacket: PAL_TRN -MltReq1Packet: MLT_REQ 1 -MltReq2Packet: MLT_REQ 2 -ChrTrnPacket: CHR_TRN 0, 0 -PctTrnPacket: PCT_TRN - -MaskEnFreezePacket: MASK_EN 1 -MaskEnCancelPacket: MASK_EN 0 +PalPacket_GameFreakIntro: + PAL_SET PAL_GAMEFREAK, PAL_REDMON, PAL_VIRIDIAN, PAL_BLUEMON + +UnknownPalPacket_72811: + db $51,$25,$0,$25,$0,$25,$0,$25,$0,$0,$0,$0,$0,$0,$0,$0 + +UnknownPalPacket_72821: + db $51,$25,$0,$27,$0,$25,$0,$25,$0,$0,$0,$0,$0,$0,$0,$0 + +PalTrnPacket: + PAL_TRN +MltReq1Packet: + MLT_REQ 1 +MltReq2Packet: + MLT_REQ 2 +ChrTrnPacket: + CHR_TRN 0, 0 +PctTrnPacket: + PCT_TRN +MaskEnFreezePacket: + MASK_EN 1 +MaskEnCancelPacket: + MASK_EN 0 ; These are DATA_SND packets containing SNES code. ; This set of packets is found in several Japanese SGB-compatible titles. ; It appears to be part of NCL's SGB devkit. -DataSnd_72548: DATA_SND $85d, $0, 11 +DataSnd_728a1: DATA_SND $85d, $0, 11 ; 728a1 (1c:68a1) db $8C ; cpx #$8c (2) db $D0, $F4 ; bne -$0c db $60 ; rts ds 7 -DataSnd_72558: DATA_SND $852, $0, 11 +DataSnd_728b1: DATA_SND $852, $0, 11 ; 728b1 (1c:68b1) db $A9, $E7 ; lda #$e7 db $9F, $01, $C0, $7E ; sta $7ec001, x db $E8 ; inx @@ -240,7 +190,7 @@ DataSnd_72558: DATA_SND $852, $0, 11 db $E8 ; inx db $E0 ; cpx #$8c (1) -DataSnd_72568: DATA_SND $847, $0, 11 +DataSnd_728c1: DATA_SND $847, $0, 11 ; 728c1 (1c:68c1) db $C4 ; cmp #$c4 (2) db $D0, $16 ; bne +$16 db $A5 ; lda dp @@ -249,7 +199,7 @@ DataSnd_72568: DATA_SND $847, $0, 11 db $D0, $10 ; bne +$10 db $A2, $28 ; ldx #$28 -DataSnd_72578: DATA_SND $83c, $0, 11 +DataSnd_728d1: DATA_SND $83c, $0, 11 ; 728d1 (1c:68d1) db $F0, $12 ; beq +$12 db $A5 ; lda dp db $C9, $C9 ; cmp #$c9 @@ -259,7 +209,7 @@ DataSnd_72578: DATA_SND $83c, $0, 11 db $CA ; dex db $C9 ; cmp #$c4 (1) -DataSnd_72588: DATA_SND $831, $0, 11 +DataSnd_728e1: DATA_SND $831, $0, 11 ; 728e1 (1c:68e1) dbw $0C, $CAA5 ; tsb $caa5 db $C9, $7E ; cmp #$7e db $D0, $06 ; bne +$06 @@ -267,7 +217,7 @@ DataSnd_72588: DATA_SND $831, $0, 11 db $CB ; wai db $C9, $7E ; cmp #$7e -DataSnd_72598: DATA_SND $826, $0, 11 +DataSnd_728f1: DATA_SND $826, $0, 11 ; 728f1 (1c:68f1) db $39 ; bne +$39 (2) dbw $CD, $C48 ; cmp $c48 db $D0, $34 ; bne +$34 @@ -275,7 +225,7 @@ DataSnd_72598: DATA_SND $826, $0, 11 db $C9, $C9 ; cmp #$c9 db $80, $D0 ; bra -$30 -DataSnd_725a8: DATA_SND $81b, $0, 11 +DataSnd_72901: DATA_SND $81b, $0, 11 ; 72901 (1c:6901) db $EA ; nop db $EA ; nop db $EA ; nop @@ -286,7 +236,7 @@ DataSnd_725a8: DATA_SND $81b, $0, 11 dbw $CD,$C4F ; cmp $c4f db $D0 ; bne +$39 (1) -DataSnd_725b8: DATA_SND $810, $0, 11 +DataSnd_72911: DATA_SND $810, $0, 11 ; 72911 (1c:6911) dbw $4C, $820 ; jmp $820 db $EA ; nop db $EA ; nop diff --git a/data/sprite_sets.asm b/data/sprite_sets.asm index 5b0e1e00..d74c9d2f 100755 --- a/data/sprite_sets.asm +++ b/data/sprite_sets.asm @@ -60,32 +60,33 @@ SplitMapSpriteSets: SpriteSets: ; sprite set $01 + db SPRITE_PIKACHU db SPRITE_BLUE db SPRITE_BUG_CATCHER db SPRITE_GIRL db SPRITE_FISHER2 db SPRITE_BLACK_HAIR_BOY_1 db SPRITE_GAMBLER - db SPRITE_SEEL db SPRITE_OAK db SPRITE_SWIMMER db SPRITE_BALL db SPRITE_LYING_OLD_MAN ; sprite set $02 + db SPRITE_PIKACHU db SPRITE_BUG_CATCHER db SPRITE_ROCKET db SPRITE_BLACK_HAIR_BOY_2 db SPRITE_HIKER - db SPRITE_SLOWBRO db SPRITE_BLUE - db SPRITE_GUARD + db SPRITE_OFFICER_JENNY db SPRITE_LASS db SPRITE_BLACK_HAIR_BOY_1 db SPRITE_BALL db SPRITE_LYING_OLD_MAN_UNUSED_2 ; sprite set $03 + db SPRITE_PIKACHU db SPRITE_LITTLE_GIRL db SPRITE_GIRL db SPRITE_BLACK_HAIR_BOY_2 @@ -94,17 +95,16 @@ SpriteSets: db SPRITE_SLOWBRO db SPRITE_LASS db SPRITE_BLACK_HAIR_BOY_1 - db SPRITE_GUARD db SPRITE_BALL db SPRITE_LYING_OLD_MAN_UNUSED_2 ; sprite set $04 - db SPRITE_FOULARD_WOMAN + db SPRITE_PIKACHU + db SPRITE_OFFICER_JENNY db SPRITE_BLACK_HAIR_BOY_2 db SPRITE_BUG_CATCHER db SPRITE_GAMBLER db SPRITE_SLOWBRO - db SPRITE_GUARD db SPRITE_SAILOR db SPRITE_LASS db SPRITE_BLACK_HAIR_BOY_1 @@ -112,6 +112,7 @@ SpriteSets: db SPRITE_LYING_OLD_MAN_UNUSED_2 ; sprite set $05 + db SPRITE_PIKACHU db SPRITE_LITTLE_GIRL db SPRITE_YOUNG_BOY db SPRITE_GIRL @@ -119,13 +120,12 @@ SpriteSets: db SPRITE_FAT_BALD_GUY db SPRITE_OLD_PERSON db SPRITE_SLOWBRO - db SPRITE_GUARD db SPRITE_ROCKET db SPRITE_BALL db SPRITE_SNORLAX ; sprite set $06 - db SPRITE_BUG_CATCHER + db SPRITE_PIKACHU db SPRITE_GYM_HELPER db SPRITE_SLOWBRO db SPRITE_BLUE @@ -138,6 +138,7 @@ SpriteSets: db SPRITE_LYING_OLD_MAN_UNUSED_2 ; sprite set $07 + db SPRITE_PIKACHU db SPRITE_ROCKET db SPRITE_OAK_AIDE db SPRITE_LAPRAS_GIVER @@ -146,11 +147,11 @@ SpriteSets: db SPRITE_BIRD db SPRITE_ROCKER db SPRITE_BLACK_HAIR_BOY_1 - db SPRITE_SLOWBRO db SPRITE_BALL db SPRITE_LYING_OLD_MAN_UNUSED_2 ; sprite set $08 + db SPRITE_PIKACHU db SPRITE_BIKER db SPRITE_BLACK_HAIR_BOY_2 db SPRITE_FAT_BALD_GUY @@ -159,11 +160,11 @@ SpriteSets: db SPRITE_FOULARD_WOMAN db SPRITE_FISHER2 db SPRITE_ROCKER - db SPRITE_SLOWBRO db SPRITE_BALL db SPRITE_SNORLAX ; sprite set $09 + db SPRITE_PIKACHU db SPRITE_BIKER db SPRITE_BLACK_HAIR_BOY_1 db SPRITE_LAPRAS_GIVER @@ -172,14 +173,13 @@ SpriteSets: db SPRITE_HIKER db SPRITE_GAMBLER db SPRITE_FAT_BALD_GUY - db SPRITE_BLACK_HAIR_BOY_2 db SPRITE_BALL db SPRITE_SNORLAX ; sprite set $0a - db SPRITE_BIRD + db SPRITE_PIKACHU db SPRITE_BLACK_HAIR_BOY_1 - db SPRITE_CLEFAIRY + db SPRITE_CHANSEY db SPRITE_FISHER2 db SPRITE_GAMBLER db SPRITE_SLOWBRO @@ -340,10 +340,10 @@ SpriteSheetPointerTable: db $c0 ; byte count db BANK(LanceSprite) - ; SPRITE_OAK_SCIENTIST_AIDE - dw OakAideSprite + ; SPRITE_UNUSED_1 + dw RedSprite db $c0 ; byte count - db BANK(OakAideSprite) + db BANK(RedSprite) ; SPRITE_OAK_AIDE dw OakAideSprite @@ -435,10 +435,10 @@ SpriteSheetPointerTable: db $c0 ; byte count db BANK(GuardSprite) - ; $32 - dw GuardSprite + ; SPRITE_UNUSED_2 + dw RedSprite db $c0 ; byte count - db BANK(GuardSprite) + db BANK(RedSprite) ; SPRITE_MOM dw MomSprite @@ -455,12 +455,12 @@ SpriteSheetPointerTable: db $c0 ; byte count db BANK(YoungBoySprite) - ; SPRITE_GAMEBOY_KID - dw GameboyKidSprite + ; SPRITE_UNUSED_3 + dw RedSprite db $c0 ; byte count - db BANK(GameboyKidSprite) + db BANK(RedSprite) - ; SPRITE_GAMEBOY_KID_COPY + ; SPRITE_GAMEBOY_KID dw GameboyKidSprite db $c0 ; byte count db BANK(GameboyKidSprite) @@ -490,6 +490,56 @@ SpriteSheetPointerTable: db $c0 ; byte count db BANK(SeelSprite) + ; SPRITE_PIKACHU + dw PikachuSprite + db $c0 + db BANK(PikachuSprite) + + ; SPRITE_OFFICER_JENNY + dw OfficerJennySprite + db $c0 + db BANK(OfficerJennySprite) + + ; SPRITE_SANDSHREW + dw SandshrewSprite + db $c0 + db BANK(SandshrewSprite) + + ; SPRITE_ODDISH + dw OddishSprite + db $c0 + db BANK(OddishSprite) + + ; SPRITE_BULBASAUR + dw BulbasaurSprite + db $c0 + db BANK(BulbasaurSprite) + + ; SPRITE_JIGGLYPUFF + dw JigglypuffSprite + db $c0 + db BANK(JigglypuffSprite) + + ; SPRITE_CLEFAIRY_2 + dw Clefairy2Sprite + db $c0 + db BANK(Clefairy2Sprite) + + ; SPRITE_CHANSEY + dw ChanseySprite + db $c0 + db BANK(ChanseySprite) + + ; SPRITE_JESSIE + dw JessieSprite + db $c0 + db BANK(JessieSprite) + + ; SPRITE_JAMES + dw JamesSprite + db $c0 + db BANK(JamesSprite) + ; SPRITE_BALL dw BallSprite db $40 ; byte count diff --git a/data/super_palettes.asm b/data/super_palettes.asm index 97f1d8ec..f5ec3d86 100755 --- a/data/super_palettes.asm +++ b/data/super_palettes.asm @@ -1,174 +1,401 @@ -; palettes for overworlds, title screen, monsters SuperPalettes: - RGB 31,29,31 ; PAL_ROUTE - RGB 21,28,11 - RGB 20,26,31 - RGB 3,2,2 - RGB 31,29,31 ; PAL_PALLET - RGB 25,28,27 - RGB 20,26,31 - RGB 3,2,2 - RGB 31,29,31 ; PAL_VIRIDIAN - RGB 17,26,3 - RGB 20,26,31 - RGB 3,2,2 - RGB 31,29,31 ; PAL_PEWTER - RGB 23,25,16 - RGB 20,26,31 - RGB 3,2,2 - RGB 31,29,31 ; PAL_CERULEAN - RGB 17,20,30 - RGB 20,26,31 - RGB 3,2,2 - RGB 31,29,31 ; PAL_LAVENDER - RGB 27,20,27 - RGB 20,26,31 - RGB 3,2,2 - RGB 31,29,31 ; PAL_VERMILION - RGB 30,18,0 - RGB 20,26,31 - RGB 3,2,2 - RGB 31,29,31 ; PAL_CELADON - RGB 16,30,22 - RGB 20,26,31 - RGB 3,2,2 - RGB 31,29,31 ; PAL_FUCHSIA - RGB 31,15,22 - RGB 20,26,31 - RGB 3,2,2 - RGB 31,29,31 ; PAL_CINNABAR - RGB 26,10,6 - RGB 20,26,31 - RGB 3,2,2 - RGB 31,29,31 ; PAL_INDIGO - RGB 22,14,24 - RGB 20,26,31 - RGB 3,2,2 - RGB 31,29,31 ; PAL_SAFFRON - RGB 27,27,3 - RGB 20,26,31 - RGB 3,2,2 - RGB 31,29,31 ; PAL_TOWNMAP - RGB 20,26,31 - RGB 17,23,10 - RGB 3,2,2 -IF DEF(_RED) - RGB 31,29,31 ; PAL_LOGO1 - RGB 30,30,17 - RGB 17,23,10 - RGB 21,0,4 -ENDC -IF DEF(_BLUE) - RGB 31,29,31 ; PAL_LOGO1 - RGB 30,30,17 - RGB 21,0,4 - RGB 14,19,29 -ENDC - RGB 31,29,31 ; PAL_LOGO2 - RGB 30,30,17 - RGB 18,18,24 - RGB 7,7,16 - RGB 31,29,31 ; PAL_0F - RGB 24,20,30 - RGB 11,20,30 - RGB 3,2,2 - RGB 31,29,31 ; PAL_MEWMON - RGB 30,22,17 - RGB 16,14,19 - RGB 3,2,2 - RGB 31,29,31 ; PAL_BLUEMON - RGB 18,20,27 - RGB 11,15,23 - RGB 3,2,2 - RGB 31,29,31 ; PAL_REDMON - RGB 31,20,10 - RGB 26,10,6 - RGB 3,2,2 - RGB 31,29,31 ; PAL_CYANMON - RGB 21,25,29 - RGB 14,19,25 - RGB 3,2,2 - RGB 31,29,31 ; PAL_PURPLEMON - RGB 27,22,24 - RGB 21,15,23 - RGB 3,2,2 - RGB 31,29,31 ; PAL_BROWNMON - RGB 28,20,15 - RGB 21,14,9 - RGB 3,2,2 - RGB 31,29,31 ; PAL_GREENMON - RGB 20,26,16 - RGB 9,20,11 - RGB 3,2,2 - RGB 31,29,31 ; PAL_PINKMON - RGB 30,22,24 - RGB 28,15,21 - RGB 3,2,2 - RGB 31,29,31 ; PAL_YELLOWMON - RGB 31,28,14 - RGB 26,20,0 - RGB 3,2,2 - RGB 31,29,31 ; PAL_GREYMON - RGB 26,21,22 - RGB 15,15,18 - RGB 3,2,2 - RGB 31,29,31 ; PAL_SLOTS1 - RGB 26,21,22 - RGB 27,20,6 - RGB 3,2,2 - RGB 31,29,31 ; PAL_SLOTS2 - RGB 31,31,17 -IF DEF(_RED) - RGB 25,17,21 -ENDC -IF DEF(_BLUE) - RGB 16,19,29 -ENDC - RGB 3,2,2 - RGB 31,29,31 ; PAL_SLOTS3 - RGB 22,31,16 -IF DEF(_RED) - RGB 25,17,21 -ENDC -IF DEF(_BLUE) - RGB 16,19,29 -ENDC - RGB 3,2,2 - RGB 31,29,31 ; PAL_SLOTS4 -IF DEF(_RED) - RGB 16,19,29 - RGB 25,17,21 -ENDC -IF DEF(_BLUE) - RGB 25,17,21 - RGB 16,19,29 -ENDC - RGB 3,2,2 - RGB 31,29,31 ; PAL_BLACK - RGB 7,7,7 - RGB 2,3,3 - RGB 3,2,2 - RGB 31,29,31 ; PAL_GREENBAR - RGB 30,26,15 - RGB 9,20,11 - RGB 3,2,2 - RGB 31,29,31 ; PAL_YELLOWBAR - RGB 30,26,15 - RGB 26,20,0 - RGB 3,2,2 - RGB 31,29,31 ; PAL_REDBAR - RGB 30,26,15 - RGB 26,10,6 - RGB 3,2,2 - RGB 31,29,31 ; PAL_BADGE - RGB 30,22,17 - RGB 11,15,23 - RGB 3,2,2 - RGB 31,29,31 ; PAL_CAVE - RGB 21,14,9 - RGB 18,24,22 - RGB 3,2,2 - RGB 31,29,31 ; PAL_GAMEFREAK - RGB 31,28,14 - RGB 24,20,10 - RGB 3,2,2 + RGB 31, 31, 30 + RGB 23, 26, 19 + RGB 23, 27, 31 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 28, 27, 31 + RGB 23, 27, 31 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 26, 31, 21 + RGB 23, 27, 31 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 23, 23, 22 + RGB 23, 27, 31 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 22, 23, 31 + RGB 23, 27, 31 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 27, 23, 29 + RGB 23, 27, 31 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 31, 25, 16 + RGB 23, 27, 31 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 22, 31, 22 + RGB 23, 27, 31 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 31, 26, 26 + RGB 23, 27, 31 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 31, 15, 14 + RGB 23, 27, 31 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 17, 17, 25 + RGB 23, 27, 31 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 31, 31, 19 + RGB 23, 27, 31 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 20, 26, 31 + RGB 17, 23, 10 + RGB 3, 2, 2 + + RGB 31, 31, 30 + RGB 30, 30, 17 + RGB 21, 0, 4 + RGB 21, 0, 4 + + RGB 31, 31, 30 + RGB 30, 30, 17 + RGB 18, 18, 24 + RGB 7, 7, 16 + + RGB 31, 31, 30 + RGB 24, 20, 30 + RGB 11, 20, 30 + RGB 3, 2, 2 + + RGB 31, 31, 30 + RGB 31, 30, 22 + RGB 27, 16, 16 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 21, 22, 31 + RGB 9, 10, 20 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 31, 24, 11 + RGB 26, 9, 6 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 26, 28, 31 + RGB 7, 24, 28 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 27, 22, 30 + RGB 22, 15, 23 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 26, 23, 18 + RGB 18, 14, 10 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 24, 28, 18 + RGB 13, 21, 15 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 31, 24, 26 + RGB 31, 18, 21 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 31, 31, 19 + RGB 28, 23, 9 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 25, 25, 18 + RGB 16, 16, 14 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 27, 22, 30 + RGB 26, 9, 6 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 31, 23, 26 + RGB 29, 29, 8 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 23, 31, 20 + RGB 29, 29, 8 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 23, 29, 31 + RGB 29, 29, 8 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 6, 6, 6 + RGB 6, 6, 6 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 31, 31, 19 + RGB 0, 21, 0 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 31, 31, 19 + RGB 28, 23, 9 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 31, 31, 19 + RGB 26, 9, 6 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 20, 15, 11 + RGB 22, 21, 20 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 20, 15, 11 + RGB 22, 21, 20 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 28, 24, 14 + RGB 20, 20, 11 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 31, 30, 22 + RGB 23, 27, 31 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 28, 23, 9 + RGB 18, 14, 10 + RGB 6, 6, 6 + + RGB 31, 31, 30 + RGB 16, 16, 16 + RGB 31, 25, 9 + RGB 6, 6, 6 + +GBCBasePalettes: + RGB 31, 31, 31 + RGB 16, 31, 4 + RGB 11, 23, 31 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 23, 17, 31 + RGB 11, 23, 31 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 19, 31, 0 + RGB 11, 23, 31 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 18, 18, 15 + RGB 11, 23, 31 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 5, 8, 31 + RGB 11, 23, 31 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 25, 4, 31 + RGB 11, 23, 31 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 31, 19, 0 + RGB 11, 23, 31 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 5, 31, 5 + RGB 11, 23, 31 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 31, 15, 15 + RGB 11, 23, 31 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 31, 8, 8 + RGB 11, 23, 31 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 11, 8, 31 + RGB 11, 23, 31 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 31, 31, 0 + RGB 11, 23, 31 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 0, 21, 31 + RGB 10, 28, 0 + RGB 1, 1, 1 + + RGB 31, 31, 31 + RGB 31, 31, 0 + RGB 31, 0, 0 + RGB 31, 0, 0 + + RGB 31, 31, 31 + RGB 31, 31, 0 + RGB 7, 7, 25 + RGB 0, 0, 17 + + RGB 31, 31, 31 + RGB 13, 1, 31 + RGB 0, 9, 31 + RGB 1, 1, 1 + + RGB 31, 31, 31 + RGB 31, 31, 0 + RGB 31, 1, 1 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 16, 18, 31 + RGB 0, 1, 25 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 31, 17, 0 + RGB 31, 0, 0 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 16, 26, 31 + RGB 0, 17, 31 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 25, 15, 31 + RGB 19, 0, 22 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 29, 18, 10 + RGB 17, 9, 5 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 17, 31, 11 + RGB 1, 22, 6 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 31, 15, 18 + RGB 31, 0, 6 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 31, 31, 0 + RGB 28, 14, 0 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 20, 23, 10 + RGB 11, 11, 5 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 25, 1, 31 + RGB 31, 0, 0 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 31, 4, 19 + RGB 31, 31, 0 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 8, 31, 0 + RGB 31, 31, 0 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 0, 31, 31 + RGB 31, 31, 0 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 3, 3, 3 + RGB 3, 3, 3 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 31, 31, 0 + RGB 0, 31, 0 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 31, 31, 0 + RGB 31, 18, 0 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 31, 31, 0 + RGB 31, 0, 0 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 23, 8, 0 + RGB 17, 14, 11 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 23, 8, 0 + RGB 17, 14, 11 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 31, 19, 0 + RGB 19, 19, 0 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 31, 31, 0 + RGB 11, 23, 31 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 31, 18, 0 + RGB 19, 7, 1 + RGB 3, 3, 3 + + RGB 31, 31, 31 + RGB 9, 9, 9 + RGB 31, 21, 0 + RGB 3, 3, 3 diff --git a/data/super_rod.asm b/data/super_rod.asm index 93ea992b..1303edbb 100755 --- a/data/super_rod.asm +++ b/data/super_rod.asm @@ -1,100 +1,33 @@ -; super rod data -; format: map, pointer to fishing group -SuperRodData: - dbw PALLET_TOWN, FishingGroup1 - dbw VIRIDIAN_CITY, FishingGroup1 - dbw CERULEAN_CITY, FishingGroup3 - dbw VERMILION_CITY, FishingGroup4 - dbw CELADON_CITY, FishingGroup5 - dbw FUCHSIA_CITY, FishingGroup10 - dbw CINNABAR_ISLAND, FishingGroup8 - dbw ROUTE_4, FishingGroup3 - dbw ROUTE_6, FishingGroup4 - dbw ROUTE_10, FishingGroup5 - dbw ROUTE_11, FishingGroup4 - dbw ROUTE_12, FishingGroup7 - dbw ROUTE_13, FishingGroup7 - dbw ROUTE_17, FishingGroup7 - dbw ROUTE_18, FishingGroup7 - dbw ROUTE_19, FishingGroup8 - dbw ROUTE_20, FishingGroup8 - dbw ROUTE_21, FishingGroup8 - dbw ROUTE_22, FishingGroup2 - dbw ROUTE_23, FishingGroup9 - dbw ROUTE_24, FishingGroup3 - dbw ROUTE_25, FishingGroup3 - dbw CERULEAN_GYM, FishingGroup3 - dbw VERMILION_DOCK, FishingGroup4 - dbw SEAFOAM_ISLANDS_4, FishingGroup8 - dbw SEAFOAM_ISLANDS_5, FishingGroup8 - dbw SAFARI_ZONE_EAST, FishingGroup6 - dbw SAFARI_ZONE_NORTH, FishingGroup6 - dbw SAFARI_ZONE_WEST, FishingGroup6 - dbw SAFARI_ZONE_CENTER, FishingGroup6 - dbw UNKNOWN_DUNGEON_2, FishingGroup9 - dbw UNKNOWN_DUNGEON_3, FishingGroup9 - dbw UNKNOWN_DUNGEON_1, FishingGroup9 - db $FF - -; fishing groups -; number of monsters, followed by level/monster pairs -FishingGroup1: - db 2 - db 15,TENTACOOL - db 15,POLIWAG - -FishingGroup2: - db 2 - db 15,GOLDEEN - db 15,POLIWAG - -FishingGroup3: - db 3 - db 15,PSYDUCK - db 15,GOLDEEN - db 15,KRABBY - -FishingGroup4: - db 2 - db 15,KRABBY - db 15,SHELLDER - -FishingGroup5: - db 2 - db 23,POLIWHIRL - db 15,SLOWPOKE - -FishingGroup6: - db 4 - db 15,DRATINI - db 15,KRABBY - db 15,PSYDUCK - db 15,SLOWPOKE - -FishingGroup7: - db 4 - db 5,TENTACOOL - db 15,KRABBY - db 15,GOLDEEN - db 15,MAGIKARP - -FishingGroup8: - db 4 - db 15,STARYU - db 15,HORSEA - db 15,SHELLDER - db 15,GOLDEEN - -FishingGroup9: - db 4 - db 23,SLOWBRO - db 23,SEAKING - db 23,KINGLER - db 23,SEADRA - -FishingGroup10: - db 4 - db 23,SEAKING - db 15,KRABBY - db 15,GOLDEEN - db 15,MAGIKARP +FishingSlots:: + db PALLET_TOWN,STARYU,10,TENTACOOL,10,STARYU,5,TENTACOOL,20 + db VIRIDIAN_CITY,POLIWAG,5,POLIWAG,10,POLIWAG,15,POLIWAG,10 + db CERULEAN_CITY,GOLDEEN,25,GOLDEEN,30,SEAKING,30,SEAKING,40 + db VERMILION_CITY,TENTACOOL,15,TENTACOOL,20,TENTACOOL,10,HORSEA,5 + db CELADON_CITY,GOLDEEN,5,GOLDEEN,10,GOLDEEN,15,GOLDEEN,20 + db FUCHSIA_CITY,MAGIKARP,5,MAGIKARP,10,MAGIKARP,15,GYARADOS,15 + db CINNABAR_ISLAND,STARYU,15,TENTACOOL,15,STARYU,10,TENTACOOL,30 + db ROUTE_4,GOLDEEN,20,GOLDEEN,25,GOLDEEN,30,SEAKING,30 + db ROUTE_6,GOLDEEN,5,GOLDEEN,10,GOLDEEN,15,GOLDEEN,20 + db ROUTE_24,GOLDEEN,20,GOLDEEN,25,GOLDEEN,30,SEAKING,30 + db ROUTE_25,KRABBY,10,KRABBY,15,KINGLER,15,KINGLER,25 + db ROUTE_10,KRABBY,15,KRABBY,20,HORSEA,10,KINGLER,25 + db ROUTE_11,TENTACOOL,15,TENTACOOL,20,TENTACOOL,10,HORSEA,5 + db ROUTE_12,HORSEA,20,HORSEA,25,SEADRA,25,SEADRA,35 + db ROUTE_13,HORSEA,15,HORSEA,20,TENTACOOL,10,SEADRA,20 + db ROUTE_17,TENTACOOL,5,TENTACOOL,15,SHELLDER,25,SHELLDER,35 + db ROUTE_18,TENTACOOL,15,SHELLDER,20,SHELLDER,30,SHELLDER,40 + db ROUTE_19,TENTACOOL,15,STARYU,20,TENTACOOL,30,TENTACRUEL,30 + db ROUTE_20,TENTACOOL,20,TENTACRUEL,20,STARYU,30,TENTACRUEL,40 + db ROUTE_21,TENTACOOL,15,STARYU,20,TENTACOOL,30,TENTACRUEL,30 + db ROUTE_22,POLIWAG,5,POLIWAG,10,POLIWAG,15,POLIWHIRL,15 + db ROUTE_23,POLIWAG,25,POLIWAG,30,POLIWHIRL,30,POLIWHIRL,40 + db VERMILION_DOCK,TENTACOOL,10,TENTACOOL,15,STARYU,15,SHELLDER,10 + db SAFARI_ZONE_CENTER,MAGIKARP,5,MAGIKARP,10,DRATINI,10,DRAGONAIR,15 + db SAFARI_ZONE_EAST,MAGIKARP,5,MAGIKARP,10,MAGIKARP,15,DRATINI,15 + db SAFARI_ZONE_NORTH,MAGIKARP,5,MAGIKARP,10,MAGIKARP,15,DRATINI,15 + db SAFARI_ZONE_WEST,MAGIKARP,5,MAGIKARP,10,MAGIKARP,15,DRATINI,15 + db SEAFOAM_ISLANDS_4,KRABBY,25,STARYU,20,KINGLER,35,STARYU,40 + db SEAFOAM_ISLANDS_5,KRABBY,25,STARYU,20,KINGLER,35,STARYU,40 + db UNKNOWN_DUNGEON_1,GOLDEEN,25,SEAKING,35,SEAKING,45,SEAKING,55 + db UNKNOWN_DUNGEON_3,GOLDEEN,30,SEAKING,40,SEAKING,50,SEAKING,60 + db $ff diff --git a/data/tileset_headers.asm b/data/tileset_headers.asm index d8e0d9b4..c85a51e5 100755 --- a/data/tileset_headers.asm +++ b/data/tileset_headers.asm @@ -1,4 +1,5 @@ Tilesets: + tileset Overworld_Block, Overworld_GFX, Overworld_Coll, $FF,$FF,$FF, $52, OUTDOOR tileset RedsHouse1_Block, RedsHouse1_GFX, RedsHouse1_Coll, $FF,$FF,$FF, $FF, INDOOR tileset Mart_Block, Mart_GFX, Mart_Coll, $18,$19,$1E, $FF, INDOOR @@ -23,3 +24,4 @@ Tilesets: tileset Club_Block, Club_GFX, Club_Coll, $07,$17,$FF, $FF, INDOOR tileset Facility_Block, Facility_GFX, Facility_Coll, $12,$FF,$FF, $FF, CAVE tileset Plateau_Block, Plateau_GFX, Plateau_Coll, $FF,$FF,$FF, $45, CAVE + tileset BeachHouse_Block, BeachHouse_GFX, BeachHouse_Coll, $FF,$FF,$FF, $FF, INDOOR diff --git a/data/title_mons.asm b/data/title_mons.asm deleted file mode 100755 index c5d94301..00000000 --- a/data/title_mons.asm +++ /dev/null @@ -1,56 +0,0 @@ -TitleMons: -; mons on the title screen are randomly chosen from here -IF DEF(_RED) - db CHARMANDER - db SQUIRTLE - db BULBASAUR - db WEEDLE - db NIDORAN_M - db SCYTHER - db PIKACHU - db CLEFAIRY - db RHYDON - db ABRA - db GASTLY - db DITTO - db PIDGEOTTO - db ONIX - db PONYTA - db MAGIKARP -ENDC -IF DEF(_GREEN) - db BULBASAUR - db CHARMANDER - db SQUIRTLE - db CATERPIE - db NIDORAN_F - db PINSIR - db PIKACHU - db CLEFAIRY - db RHYDON - db ABRA - db GASTLY - db DITTO - db PIDGEOTTO - db ONIX - db PONYTA - db MAGIKARP -ENDC -IF DEF(_BLUE) - db SQUIRTLE - db CHARMANDER - db BULBASAUR - db MANKEY - db HITMONLEE - db VULPIX - db CHANSEY - db AERODACTYL - db JOLTEON - db SNORLAX - db GLOOM - db POLIWAG - db DODUO - db PORYGON - db GENGAR - db RAICHU -ENDC diff --git a/data/tms.asm b/data/tms.asm index 23c1685e..d61392c4 100755 --- a/data/tms.asm +++ b/data/tms.asm @@ -54,3 +54,4 @@ TechnicalMachines: db SURF db STRENGTH db FLASH + db $ff ; terminator diff --git a/data/town_map_entries.asm b/data/town_map_entries.asm index abf584de..e9ced645 100755 --- a/data/town_map_entries.asm +++ b/data/town_map_entries.asm @@ -98,4 +98,5 @@ InternalMapEntries: IMAP ROCK_TUNNEL_2, $E,$3,RockTunnelName IMAP SILPH_CO_ELEVATOR, $A,$5,SilphCoName IMAP AGATHAS_ROOM, $0,$2,PokemonLeagueName + IMAP BEACH_HOUSE, $6,$F,Route19Name db $FF diff --git a/data/trades.asm b/data/trades.asm index cf0fcbfd..4fa52d30 100755 --- a/data/trades.asm +++ b/data/trades.asm @@ -1,12 +1,12 @@ TradeMons: ; givemonster, getmonster, textstring, nickname (11 bytes), 14 bytes total - db NIDORINO, NIDORINA, 0,"TERRY@@@@@@" - db ABRA, MR_MIME, 0,"MARCEL@@@@@" - db BUTTERFREE,BEEDRILL, 2,"CHIKUCHIKU@" - db PONYTA, SEEL, 0,"SAILOR@@@@@" - db SPEAROW, FARFETCHD,2,"DUX@@@@@@@@" - db SLOWBRO, LICKITUNG,0,"MARC@@@@@@@" - db POLIWHIRL, JYNX, 1,"LOLA@@@@@@@" - db RAICHU, ELECTRODE,1,"DORIS@@@@@@" - db VENONAT, TANGELA, 2,"CRINKLES@@@" - db NIDORAN_M, NIDORAN_F,2,"SPOT@@@@@@@" + db LICKITUNG, DUGTRIO, 0,"GURIO@@@@@@" + db CLEFAIRY, MR_MIME, 0,"MILES@@@@@@" + db BUTTERFREE,BEEDRILL,2,"STINGER@@@@" + db KANGASKHAN,MUK, 0,"STICKY@@@@@" + db MEW, MEW, 2,"BART@@@@@@@" + db TANGELA, PARASECT,0,"SPIKE@@@@@@" + db PIDGEOT, PIDGEOT, 1,"MARTY@@@@@@" + db GOLDUCK, RHYDON, 1,"BUFFY@@@@@@" + db GROWLITHE, DEWGONG, 2,"CEZANNE@@@@" + db CUBONE, MACHOKE, 2,"RICKY@@@@@@" diff --git a/data/trainer_moves.asm b/data/trainer_moves.asm index 2e7b52a5..696253e3 100755 --- a/data/trainer_moves.asm +++ b/data/trainer_moves.asm @@ -1,32 +1,160 @@ -LoneMoves: -; these are used for gym leaders. -; this is not automatic! you have to write the number you want to wLoneAttackNo -; first. e.g., erika's script writes 4 to wLoneAttackNo to get mega drain, -; the fourth entry in the list. - -; first byte: pokemon in the trainer's party that gets the move -; second byte: move -; unterminated - db 1,BIDE - db 1,BUBBLEBEAM - db 2,THUNDERBOLT - db 2,MEGA_DRAIN - db 3,TOXIC - db 3,PSYWAVE - db 3,FIRE_BLAST - db 4,FISSURE - -TeamMoves: -; these are used for elite four. -; this is automatic, based on trainer class. -; don't be confused by LoneMoves above, the two data structures are - ; _completely_ unrelated. - -; first byte: trainer (all trainers in this class have this move) -; second byte: move -; ff-terminated - db LORELEI,BLIZZARD - db BRUNO,FISSURE - db AGATHA,TOXIC - db LANCE,BARRIER - db $FF +; yellow has its own format. + +; entry = trainerclass, trainerid, moveset+, 0 +; moveset = partymon location, partymon's move, moveid + +SpecialTrainerMoves: + db BUG_CATCHER,$f + db 2,2,TACKLE + db 2,3,STRING_SHOT + db 0 + + db YOUNGSTER,$e + db 1,4,FISSURE + db 0 + + db BROCK,$1 + db 2,3,BIND + db 2,4,BIDE + db 0 + + db MISTY,$1 + db 2,4,BUBBLEBEAM + db 0 + + db LT_SURGE,$1 + db 1,1,THUNDERBOLT + db 1,2,MEGA_PUNCH + db 1,3,MEGA_KICK + db 1,4,GROWL + db 0 + + db ERIKA,$1 + db 1,3,MEGA_DRAIN + db 2,1,RAZOR_LEAF + db 3,1,PETAL_DANCE + db 0 + + db KOGA,$1 + db 1,1,TOXIC + db 1,2,TACKLE + db 2,1,TOXIC + db 2,3,SUPERSONIC + db 3,1,TOXIC + db 3,2,DOUBLE_EDGE + db 4,1,LEECH_LIFE + db 4,2,DOUBLE_TEAM + db 4,3,PSYCHIC_M + db 4,4,TOXIC + db 0 + + db BLAINE,$1 + db 1,1,FLAMETHROWER + db 1,4,CONFUSE_RAY + db 3,1,FLAMETHROWER + db 3,2,FIRE_BLAST + db 3,3,REFLECT + db 0 + + db SABRINA,$1 + db 1,1,FLASH + db 2,1,KINESIS + db 2,4,PSYWAVE + db 3,1,PSYWAVE + db 0 + + db GIOVANNI,$3 + db 1,3,FISSURE + db 2,2,DOUBLE_TEAM + db 3,1,EARTHQUAKE + db 3,3,THUNDER + db 4,1,EARTHQUAKE + db 4,2,LEER + db 4,3,THUNDER + db 5,1,ROCK_SLIDE + db 5,4,EARTHQUAKE + db 0 + + db LORELEI,$1 + db 1,1,BUBBLEBEAM + db 2,3,ICE_BEAM + db 3,1,PSYCHIC_M + db 3,2,SURF + db 4,3,LOVELY_KISS + db 5,3,BLIZZARD + db 0 + + db BRUNO,$1 + db 1,1,ROCK_SLIDE + db 1,2,SCREECH + db 1,4,DIG + db 2,3,FIRE_PUNCH + db 2,4,DOUBLE_TEAM + db 3,1,DOUBLE_KICK + db 3,2,MEGA_KICK + db 3,4,DOUBLE_TEAM + db 4,1,ROCK_SLIDE + db 4,2,SCREECH + db 4,4,EARTHQUAKE + db 5,2,KARATE_CHOP + db 5,3,STRENGTH + db 0 + + db AGATHA,$1 + db 1,2,SUBSTITUTE + db 1,3,LICK + db 1,4,MEGA_DRAIN + db 2,2,TOXIC + db 2,4,LEECH_LIFE + db 3,2,LICK + db 4,1,WRAP + db 5,2,PSYCHIC_M + db 0 + + db LANCE,$1 + db 1,1,DRAGON_RAGE + db 2,1,THUNDER_WAVE + db 2,3,THUNDERBOLT + db 3,1,BUBBLEBEAM + db 3,2,WRAP + db 3,3,ICE_BEAM + db 4,1,WING_ATTACK + db 4,2,SWIFT + db 4,3,FLY + db 5,1,BLIZZARD + db 5,2,FIRE_BLAST + db 5,3,THUNDER + db 0 + + db SONY3,$1 + db 1,3,EARTHQUAKE + db 2,4,KINESIS + db 3,4,LEECH_SEED + db 4,1,ICE_BEAM + db 5,1,CONFUSE_RAY + db 5,4,FIRE_SPIN + db 6,3,QUICK_ATTACK + db 0 + + db SONY3,$2 + db 1,3,EARTHQUAKE + db 2,4,KINESIS + db 3,4,LEECH_SEED + db 4,1,THUNDERBOLT + db 5,1,ICE_BEAM + db 6,2,REFLECT + db 6,3,QUICK_ATTACK + db 0 + + db SONY3,$3 + db 1,3,EARTHQUAKE + db 2,4,KINESIS + db 3,4,LEECH_SEED + db 4,1,CONFUSE_RAY + db 4,4,FIRE_SPIN + db 5,1,THUNDERBOLT + db 6,1,AURORA_BEAM + db 6,3,QUICK_ATTACK + db 0 + + db $ff diff --git a/data/trainer_parties.asm b/data/trainer_parties.asm index c186dd00..48de8bce 100755 --- a/data/trainer_parties.asm +++ b/data/trainer_parties.asm @@ -57,7 +57,6 @@ TrainerDataPointers: ; null-terminated YoungsterData: -; Route 3 db 11,RATTATA,EKANS,0 db 14,SPEAROW,0 db 10,RATTATA,RATTATA,ZUBAT,0 @@ -71,12 +70,11 @@ YoungsterData: db 17,RATTATA,RATTATA,RATICATE,0 db 18,NIDORAN_M,NIDORINO,0 db 17,SPEAROW,RATTATA,RATTATA,SPEAROW,0 + db 24,SANDSHREW,0 BugCatcherData: -; Viridian Forest - db 6,WEEDLE,CATERPIE,0 - db 7,WEEDLE,KAKUNA,WEEDLE,0 - db 9,WEEDLE,0 -; Route 3 + db 7,CATERPIE,CATERPIE,0 + db 6,METAPOD,CATERPIE,METAPOD,0 + db 10,CATERPIE,0 db 10,CATERPIE,WEEDLE,CATERPIE,0 db 9,WEEDLE,KAKUNA,CATERPIE,METAPOD,0 db 11,CATERPIE,METAPOD,0 @@ -88,8 +86,8 @@ BugCatcherData: db 18,METAPOD,CATERPIE,VENONAT,0 db 19,BEEDRILL,BEEDRILL,0 db 20,CATERPIE,WEEDLE,VENONAT,0 + db 8,CATERPIE,METAPOD,0 LassData: -; Route 3 db 9,PIDGEY,PIDGEY,0 db 10,RATTATA,NIDORAN_M,0 db 14,JIGGLYPUFF,0 @@ -101,13 +99,14 @@ LassData: db 15,NIDORAN_M,NIDORAN_F,0 db 13,ODDISH,PIDGEY,ODDISH,0 db 18,PIDGEY,NIDORAN_F,0 - db 18,RATTATA,PIKACHU,0 + db 20,JIGGLYPUFF,0 db 23,NIDORAN_F,NIDORINA,0 db 24,MEOWTH,MEOWTH,MEOWTH,0 - db 19,PIDGEY,RATTATA,NIDORAN_M,MEOWTH,PIKACHU,0 + db 19,PIDGEY,RATTATA,NIDORAN_F,MEOWTH,NIDORAN_M,0 db 22,CLEFAIRY,CLEFAIRY,0 db 23,BELLSPROUT,WEEPINBELL,0 db 23,ODDISH,GLOOM,0 + db 6,NIDORAN_F,NIDORAN_M,0 SailorData: db 18,MACHOP,SHELLDER,0 db 17,MACHOP,TENTACOOL,0 @@ -116,9 +115,9 @@ SailorData: db 18,TENTACOOL,STARYU,0 db 17,HORSEA,HORSEA,HORSEA,0 db 20,MACHOP,0 - db 21,PIKACHU,PIKACHU,0 + db 24,MAGNEMITE,0 JrTrainerMData: - db 11,DIGLETT,SANDSHREW,0 + db 9,DIGLETT,SANDSHREW,0 db 14,RATTATA,EKANS,0 db 18,MANKEY,0 db 20,SQUIRTLE,0 @@ -127,19 +126,20 @@ JrTrainerMData: db 21,GROWLITHE,CHARMANDER,0 db 19,RATTATA,DIGLETT,EKANS,SANDSHREW,0 db 29,NIDORAN_M,NIDORINO,0 + db 16,WEEPINBELL,0 JrTrainerFData: db 19,GOLDEEN,0 - db 16,RATTATA,PIKACHU,0 + db 16,ODDISH,BELLSPROUT,0 db 16,PIDGEY,PIDGEY,PIDGEY,0 db 22,BULBASAUR,0 db 18,ODDISH,BELLSPROUT,ODDISH,BELLSPROUT,0 db 23,MEOWTH,0 - db 20,PIKACHU,CLEFAIRY,0 + db 20,JIGGLYPUFF,CLEFAIRY,0 db 21,PIDGEY,PIDGEOTTO,0 db 21,JIGGLYPUFF,PIDGEY,MEOWTH,0 db 22,ODDISH,BULBASAUR,0 db 24,BULBASAUR,IVYSAUR,0 - db 24,PIDGEY,MEOWTH,RATTATA,PIKACHU,MEOWTH,0 + db 24,PIDGEY,MEOWTH,RATTATA,PIDGEY,MEOWTH,0 db 30,POLIWAG,POLIWAG,0 db 27,PIDGEY,MEOWTH,PIDGEY,PIDGEOTTO,0 db 28,GOLDEEN,POLIWAG,HORSEA,0 @@ -148,10 +148,11 @@ JrTrainerFData: db 20,MEOWTH,ODDISH,PIDGEY,0 db 19,PIDGEY,RATTATA,RATTATA,BELLSPROUT,0 db 28,GLOOM,ODDISH,ODDISH,0 - db 29,PIKACHU,RAICHU,0 + db 29,PIDGEY,PIDGEOTTO,0 db 33,CLEFAIRY,0 db 29,BELLSPROUT,ODDISH,TANGELA,0 db 30,TENTACOOL,HORSEA,SEEL,0 + db 20,CUBONE,0 PokemaniacData: db 30,RHYHORN,LICKITUNG,0 db 20,CUBONE,SLOWPOKE,0 @@ -270,7 +271,7 @@ BeautyData: db 21,ODDISH,BELLSPROUT,ODDISH,BELLSPROUT,0 db 24,BELLSPROUT,BELLSPROUT,0 db 26,EXEGGCUTE,0 - db 27,RATTATA,PIKACHU,RATTATA,0 + db 27,RATTATA,VULPIX,RATTATA,0 db 29,CLEFAIRY,MEOWTH,0 db 35,SEAKING,0 db 30,SHELLDER,SHELLDER,CLOYSTER,0 @@ -288,7 +289,7 @@ PsychicData: db 33,SLOWPOKE,SLOWPOKE,SLOWBRO,0 db 38,SLOWBRO,0 RockerData: - db 20,VOLTORB,MAGNEMITE,VOLTORB,0 + db 20,VOLTORB,VOLTORB,VOLTORB,0 db 29,VOLTORB,ELECTRODE,0 JugglerData: db 29,KADABRA,MR_MIME,0 @@ -335,15 +336,9 @@ BlackbeltData: db 38,MACHOKE,MACHOP,MACHOKE,0 db 43,MACHOKE,MACHOP,MACHOKE,0 Green1Data: - db 5,SQUIRTLE,0 - db 5,BULBASAUR,0 - db 5,CHARMANDER,0 - db $FF,9,PIDGEY,8,SQUIRTLE,0 - db $FF,9,PIDGEY,8,BULBASAUR,0 - db $FF,9,PIDGEY,8,CHARMANDER,0 - db $FF,18,PIDGEOTTO,15,ABRA,15,RATTATA,17,SQUIRTLE,0 - db $FF,18,PIDGEOTTO,15,ABRA,15,RATTATA,17,BULBASAUR,0 - db $FF,18,PIDGEOTTO,15,ABRA,15,RATTATA,17,CHARMANDER,0 + db 5,EEVEE,0 + db $FF,9,SPEAROW,8,EEVEE,0 + db $FF,18,SPEAROW,15,SANDSHREW,15,RATTATA,17,EEVEE,0 ProfOakData: db $FF,66,TAUROS,67,EXEGGUTOR,68,ARCANINE,69,BLASTOISE,70,GYARADOS,0 db $FF,66,TAUROS,67,EXEGGUTOR,68,ARCANINE,69,VENUSAUR,70,GYARADOS,0 @@ -365,9 +360,9 @@ ScientistData: db 33,MAGNEMITE,MAGNETON,VOLTORB,0 db 34,MAGNEMITE,ELECTRODE,0 GiovanniData: - db $FF,25,ONIX,24,RHYHORN,29,KANGASKHAN,0 - db $FF,37,NIDORINO,35,KANGASKHAN,37,RHYHORN,41,NIDOQUEEN,0 - db $FF,45,RHYHORN,42,DUGTRIO,44,NIDOQUEEN,45,NIDOKING,50,RHYDON,0 + db $FF,25,ONIX,24,RHYHORN,29,PERSIAN,0 + db $FF,37,NIDORINO,35,PERSIAN,37,RHYHORN,41,NIDOQUEEN,0 + db $FF,50,DUGTRIO,53,PERSIAN,53,NIDOQUEEN,55,NIDOKING,55,RHYDON,0 RocketData: db 13,RATTATA,ZUBAT,0 db 11,SANDSHREW,RATTATA,ZUBAT,0 @@ -410,6 +405,15 @@ RocketData: db 33,MACHOKE,0 db 25,RATTATA,RATTATA,ZUBAT,RATTATA,EKANS,0 db 32,CUBONE,DROWZEE,MAROWAK,0 +JessieJamesData: + db 14,EKANS,MEOWTH,KOFFING,0 + db 25,KOFFING,MEOWTH,EKANS,0 + db 27,MEOWTH,ARBOK,WEEZING,0 + db 31,WEEZING,ARBOK,MEOWTH,0 + db 16,KOFFING,0 + db 27,KOFFING,0 + db 29,WEEZING,0 + db 33,WEEZING,0 CooltrainerMData: db 39,NIDORINO,NIDOKING,0 db 43,EXEGGUTOR,CLOYSTER,ARCANINE,0 @@ -433,42 +437,40 @@ CooltrainerFData: BrunoData: db $FF,53,ONIX,55,HITMONCHAN,55,HITMONLEE,56,ONIX,58,MACHAMP,0 BrockData: - db $FF,12,GEODUDE,14,ONIX,0 + db $FF,10,GEODUDE,12,ONIX,0 MistyData: db $FF,18,STARYU,21,STARMIE,0 LtSurgeData: - db $FF,21,VOLTORB,18,PIKACHU,24,RAICHU,0 + db $FF,28,RAICHU,0 ErikaData: - db $FF,29,VICTREEBEL,24,TANGELA,29,VILEPLUME,0 + db $FF,30,TANGELA,32,WEEPINBELL,32,GLOOM,0 KogaData: - db $FF,37,KOFFING,39,MUK,37,KOFFING,43,WEEZING,0 + db $FF,44,VENONAT,46,VENONAT,48,VENONAT,50,VENOMOTH,0 BlaineData: - db $FF,42,GROWLITHE,40,PONYTA,42,RAPIDASH,47,ARCANINE,0 + db $FF,48,NINETALES,50,RAPIDASH,54,ARCANINE,0 SabrinaData: - db $FF,38,KADABRA,37,MR_MIME,38,VENOMOTH,43,ALAKAZAM,0 + db $FF,50,ABRA,50,KADABRA,50,ALAKAZAM,0 GentlemanData: db 18,GROWLITHE,GROWLITHE,0 db 19,NIDORAN_M,NIDORAN_F,0 - db 23,PIKACHU,0 + db 22,VOLTORB,MAGNEMITE,0 db 48,PRIMEAPE,0 db 17,GROWLITHE,PONYTA,0 Green2Data: - db $FF,19,PIDGEOTTO,16,RATICATE,18,KADABRA,20,WARTORTLE,0 - db $FF,19,PIDGEOTTO,16,RATICATE,18,KADABRA,20,IVYSAUR,0 - db $FF,19,PIDGEOTTO,16,RATICATE,18,KADABRA,20,CHARMELEON,0 - db $FF,25,PIDGEOTTO,23,GROWLITHE,22,EXEGGCUTE,20,KADABRA,25,WARTORTLE,0 - db $FF,25,PIDGEOTTO,23,GYARADOS,22,GROWLITHE,20,KADABRA,25,IVYSAUR,0 - db $FF,25,PIDGEOTTO,23,EXEGGCUTE,22,GYARADOS,20,KADABRA,25,CHARMELEON,0 - db $FF,37,PIDGEOT,38,GROWLITHE,35,EXEGGCUTE,35,ALAKAZAM,40,BLASTOISE,0 - db $FF,37,PIDGEOT,38,GYARADOS,35,GROWLITHE,35,ALAKAZAM,40,VENUSAUR,0 - db $FF,37,PIDGEOT,38,EXEGGCUTE,35,GYARADOS,35,ALAKAZAM,40,CHARIZARD,0 - db $FF,47,PIDGEOT,45,RHYHORN,45,GROWLITHE,47,EXEGGCUTE,50,ALAKAZAM,53,BLASTOISE,0 - db $FF,47,PIDGEOT,45,RHYHORN,45,GYARADOS,47,GROWLITHE,50,ALAKAZAM,53,VENUSAUR,0 - db $FF,47,PIDGEOT,45,RHYHORN,45,EXEGGCUTE,47,GYARADOS,50,ALAKAZAM,53,CHARIZARD,0 + db $FF,19,SPEAROW,16,RATTATA,18,SANDSHREW,20,EEVEE,0 + db $FF,25,FEAROW,23,SHELLDER,22,VULPIX,20,SANDSHREW,25,EEVEE,0 + db $FF,25,FEAROW,23,MAGNEMITE,22,SHELLDER,20,SANDSHREW,25,EEVEE,0 + db $FF,25,FEAROW,23,VULPIX,22,MAGNEMITE,20,SANDSHREW,25,EEVEE,0 + db $FF,38,SANDSLASH,35,NINETALES,37,CLOYSTER,35,KADABRA,40,JOLTEON,0 + db $FF,38,SANDSLASH,35,CLOYSTER,37,MAGNETON,35,KADABRA,40,FLAREON,0 + db $FF,38,SANDSLASH,35,MAGNETON,37,NINETALES,35,KADABRA,40,VAPOREON,0 + db $FF,47,SANDSLASH,45,EXEGGCUTE,45,NINETALES,47,CLOYSTER,50,KADABRA,53,JOLTEON,0 + db $FF,47,SANDSLASH,45,EXEGGCUTE,45,CLOYSTER,47,MAGNETON,50,KADABRA,53,FLAREON,0 + db $FF,47,SANDSLASH,45,EXEGGCUTE,45,MAGNETON,47,NINETALES,50,KADABRA,53,VAPOREON,0 Green3Data: - db $FF,61,PIDGEOT,59,ALAKAZAM,61,RHYDON,61,ARCANINE,63,EXEGGUTOR,65,BLASTOISE,0 - db $FF,61,PIDGEOT,59,ALAKAZAM,61,RHYDON,61,GYARADOS,63,ARCANINE,65,VENUSAUR,0 - db $FF,61,PIDGEOT,59,ALAKAZAM,61,RHYDON,61,EXEGGUTOR,63,GYARADOS,65,CHARIZARD,0 + db $FF,61,SANDSLASH,59,ALAKAZAM,61,EXEGGUTOR,61,CLOYSTER,63,NINETALES,65,JOLTEON,0 + db $FF,61,SANDSLASH,59,ALAKAZAM,61,EXEGGUTOR,61,MAGNETON,63,CLOYSTER,65,FLAREON,0 + db $FF,61,SANDSLASH,59,ALAKAZAM,61,EXEGGUTOR,61,NINETALES,63,MAGNETON,65,VAPOREON,0 LoreleiData: db $FF,54,DEWGONG,53,CLOYSTER,54,SLOWBRO,56,JYNX,56,LAPRAS,0 ChannelerData: diff --git a/data/trainer_types.asm b/data/trainer_types.asm index cc7ca605..ef02c8a8 100755 --- a/data/trainer_types.asm +++ b/data/trainer_types.asm @@ -14,4 +14,5 @@ EvilTrainerList:: db OPP_SCIENTIST db OPP_GIOVANNI db OPP_ROCKET - db $FF + + db $ff diff --git a/data/warp_tile_ids.asm b/data/warp_tile_ids.asm index 6fd326cc..4edc48a5 100755 --- a/data/warp_tile_ids.asm +++ b/data/warp_tile_ids.asm @@ -23,6 +23,7 @@ WarpTileIDPointers: dw ClubWarpTileIDs dw FacilityWarpTileIDs dw PlateauWarpTileIDs + dw BeachHouseWarpTileIDs OverworldWarpTileIDs: db $1B,$58,$FF @@ -83,3 +84,6 @@ PlateauWarpTileIDs: ShipPortWarpTileIDs: ClubWarpTileIDs: db $FF + +BeachHouseWarpTileIDs: + db $FF diff --git a/data/wildPokemon/diglettscave.asm b/data/wildPokemon/diglettscave.asm index 37512687..0b8ec1c7 100755 --- a/data/wildPokemon/diglettscave.asm +++ b/data/wildPokemon/diglettscave.asm @@ -11,3 +11,4 @@ CaveMons: db 29,DUGTRIO db 31,DUGTRIO db $00 + diff --git a/data/wildPokemon/mansion1.asm b/data/wildPokemon/mansion1.asm index 22ad032b..2e5a8f51 100755 --- a/data/wildPokemon/mansion1.asm +++ b/data/wildPokemon/mansion1.asm @@ -1,27 +1,14 @@ MansionMons1: db $0A - IF DEF(_RED) - db 32,KOFFING - db 30,KOFFING - db 34,PONYTA - db 30,PONYTA - db 34,GROWLITHE - db 32,PONYTA - db 30,GRIMER - db 28,PONYTA - db 37,WEEZING - db 39,MUK - ENDC - IF DEF(_BLUE) - db 32,GRIMER - db 30,GRIMER - db 34,PONYTA - db 30,PONYTA - db 34,VULPIX - db 32,PONYTA - db 30,KOFFING - db 28,PONYTA - db 37,MUK - db 39,WEEZING - ENDC + db 34,RATTATA + db 34,RATICATE + db 23,GRIMER + db 26,GROWLITHE + db 37,RATTATA + db 37,RATICATE + db 30,GROWLITHE + db 26,GRIMER + db 34,GROWLITHE + db 38,GROWLITHE db $00 + diff --git a/data/wildPokemon/mansion2.asm b/data/wildPokemon/mansion2.asm index 985474fc..e830560a 100755 --- a/data/wildPokemon/mansion2.asm +++ b/data/wildPokemon/mansion2.asm @@ -1,27 +1,14 @@ MansionMons2: db $0A - IF DEF(_RED) - db 32,GROWLITHE - db 34,KOFFING - db 34,KOFFING - db 30,PONYTA - db 30,KOFFING - db 32,PONYTA - db 30,GRIMER - db 28,PONYTA - db 39,WEEZING - db 37,MUK - ENDC - IF DEF(_BLUE) - db 32,VULPIX - db 34,GRIMER - db 34,GRIMER - db 30,PONYTA - db 30,GRIMER - db 32,PONYTA - db 30,KOFFING - db 28,PONYTA - db 39,MUK - db 37,WEEZING - ENDC + db 37,RATTATA + db 37,RATICATE + db 26,GRIMER + db 29,GRIMER + db 40,RATTATA + db 40,RATICATE + db 32,GRIMER + db 35,GRIMER + db 35,MUK + db 38,MUK db $00 + diff --git a/data/wildPokemon/mansion3.asm b/data/wildPokemon/mansion3.asm index 9c5521ae..cc180e3b 100755 --- a/data/wildPokemon/mansion3.asm +++ b/data/wildPokemon/mansion3.asm @@ -1,27 +1,14 @@ MansionMons3: db $0A - IF DEF(_RED) - db 31,KOFFING - db 33,GROWLITHE - db 35,KOFFING - db 32,PONYTA - db 34,PONYTA - db 40,WEEZING - db 34,GRIMER - db 38,WEEZING - db 36,PONYTA - db 42,MUK - ENDC - IF DEF(_BLUE) - db 31,GRIMER - db 33,VULPIX - db 35,GRIMER - db 32,PONYTA - db 34,MAGMAR - db 40,MUK - db 34,KOFFING - db 38,MUK - db 36,PONYTA - db 42,WEEZING - ENDC + db 40,RATTATA + db 40,RATICATE + db 32,GRIMER + db 35,GRIMER + db 43,RATTATA + db 43,RATICATE + db 38,GRIMER + db 38,GRIMER + db 38,MUK + db 41,MUK db $00 + diff --git a/data/wildPokemon/mansionb1.asm b/data/wildPokemon/mansionb1.asm index 83266ddd..dcace0d8 100755 --- a/data/wildPokemon/mansionb1.asm +++ b/data/wildPokemon/mansionb1.asm @@ -1,27 +1,13 @@ MansionMonsB1: db $0A - IF DEF(_RED) - db 33,KOFFING - db 31,KOFFING - db 35,GROWLITHE - db 32,PONYTA - db 31,KOFFING - db 40,WEEZING - db 34,PONYTA - db 35,GRIMER - db 42,WEEZING - db 42,MUK - ENDC - IF DEF(_BLUE) - db 33,GRIMER - db 31,GRIMER - db 35,VULPIX - db 32,PONYTA - db 31,GRIMER - db 40,MUK - db 34,PONYTA - db 35,KOFFING - db 38,MAGMAR - db 42,WEEZING - ENDC + db 35,GRIMER + db 38,GRIMER + db 37,RATICATE + db 40,RATICATE + db 41,MUK + db 43,RATICATE + db 24,DITTO + db 46,RATICATE + db 18,DITTO + db 12,DITTO db $00 diff --git a/data/wildPokemon/mtmoon1.asm b/data/wildPokemon/mtmoon1.asm index 44b34c45..75f19efd 100755 --- a/data/wildPokemon/mtmoon1.asm +++ b/data/wildPokemon/mtmoon1.asm @@ -1,13 +1,14 @@ MoonMons1: db $0A db 8,ZUBAT - db 7,ZUBAT db 9,ZUBAT - db 8,GEODUDE + db 10,GEODUDE db 6,ZUBAT + db 7,ZUBAT db 10,ZUBAT db 10,GEODUDE - db 8,PARAS db 11,ZUBAT - db 8,CLEFAIRY + db 12,SANDSHREW + db 11,CLEFAIRY db $00 + diff --git a/data/wildPokemon/mtmoonb1.asm b/data/wildPokemon/mtmoonb1.asm index 5c0d8a53..61c0b05c 100755 --- a/data/wildPokemon/mtmoonb1.asm +++ b/data/wildPokemon/mtmoonb1.asm @@ -1,13 +1,14 @@ MoonMonsB1: db $0A db 8,ZUBAT - db 7,ZUBAT - db 7,GEODUDE - db 8,GEODUDE db 9,ZUBAT - db 10,PARAS db 10,ZUBAT + db 10,GEODUDE + db 11,GEODUDE db 11,ZUBAT - db 9,CLEFAIRY - db 9,GEODUDE + db 9,PARAS + db 11,PARAS + db 10,CLEFAIRY + db 12,CLEFAIRY db $00 + diff --git a/data/wildPokemon/mtmoonb2.asm b/data/wildPokemon/mtmoonb2.asm index cbf97e7e..27c76500 100755 --- a/data/wildPokemon/mtmoonb2.asm +++ b/data/wildPokemon/mtmoonb2.asm @@ -1,13 +1,14 @@ MoonMonsB2: db $0A - db 9,ZUBAT - db 9,GEODUDE db 10,ZUBAT - db 10,GEODUDE + db 11,GEODUDE + db 13,PARAS + db 11,ZUBAT db 11,ZUBAT - db 10,PARAS - db 12,PARAS - db 10,CLEFAIRY db 12,ZUBAT - db 12,CLEFAIRY + db 13,ZUBAT + db 9,CLEFAIRY + db 11,CLEFAIRY + db 13,CLEFAIRY db $00 + diff --git a/data/wildPokemon/nomons.asm b/data/wildPokemon/nomons.asm index ce7f7ede..895cf2e0 100755 --- a/data/wildPokemon/nomons.asm +++ b/data/wildPokemon/nomons.asm @@ -1,3 +1,4 @@ NoMons: db $00 db $00 + diff --git a/data/wildPokemon/pokemontower1.asm b/data/wildPokemon/pokemontower1.asm index df951e70..4911c790 100755 --- a/data/wildPokemon/pokemontower1.asm +++ b/data/wildPokemon/pokemontower1.asm @@ -1,3 +1,4 @@ TowerMons1: db $00 db $00 + diff --git a/data/wildPokemon/pokemontower2.asm b/data/wildPokemon/pokemontower2.asm index dcbe0da0..a849668d 100755 --- a/data/wildPokemon/pokemontower2.asm +++ b/data/wildPokemon/pokemontower2.asm @@ -1,3 +1,4 @@ TowerMons2: db $00 db $00 + diff --git a/data/wildPokemon/pokemontower3.asm b/data/wildPokemon/pokemontower3.asm index 135ed84f..c071c972 100755 --- a/data/wildPokemon/pokemontower3.asm +++ b/data/wildPokemon/pokemontower3.asm @@ -4,10 +4,11 @@ TowerMons3: db 21,GASTLY db 22,GASTLY db 23,GASTLY + db 24,GASTLY db 19,GASTLY db 18,GASTLY - db 24,GASTLY - db 20,CUBONE - db 22,CUBONE + db 25,GASTLY + db 20,HAUNTER db 25,HAUNTER db $00 + diff --git a/data/wildPokemon/pokemontower4.asm b/data/wildPokemon/pokemontower4.asm index 0c84b0cf..35be620e 100755 --- a/data/wildPokemon/pokemontower4.asm +++ b/data/wildPokemon/pokemontower4.asm @@ -4,10 +4,11 @@ TowerMons4: db 21,GASTLY db 22,GASTLY db 23,GASTLY + db 24,GASTLY db 19,GASTLY db 18,GASTLY + db 25,GASTLY + db 20,HAUNTER db 25,HAUNTER - db 20,CUBONE - db 22,CUBONE - db 24,GASTLY db $00 + diff --git a/data/wildPokemon/pokemontower5.asm b/data/wildPokemon/pokemontower5.asm index 440dbf8d..55fe2e27 100755 --- a/data/wildPokemon/pokemontower5.asm +++ b/data/wildPokemon/pokemontower5.asm @@ -1,13 +1,14 @@ TowerMons5: - db $0A - db 20,GASTLY - db 21,GASTLY + db $0F db 22,GASTLY db 23,GASTLY - db 19,GASTLY - db 18,GASTLY - db 25,HAUNTER - db 20,CUBONE - db 22,CUBONE db 24,GASTLY + db 25,GASTLY + db 26,GASTLY + db 21,GASTLY + db 20,CUBONE + db 27,GASTLY + db 22,HAUNTER + db 27,HAUNTER db $00 + diff --git a/data/wildPokemon/pokemontower6.asm b/data/wildPokemon/pokemontower6.asm index 553fdb5d..6e914c5c 100755 --- a/data/wildPokemon/pokemontower6.asm +++ b/data/wildPokemon/pokemontower6.asm @@ -1,13 +1,14 @@ TowerMons6: db $0F - db 21,GASTLY db 22,GASTLY db 23,GASTLY db 24,GASTLY - db 20,GASTLY - db 19,GASTLY - db 26,HAUNTER + db 25,GASTLY + db 26,GASTLY + db 21,GASTLY db 22,CUBONE - db 24,CUBONE - db 28,HAUNTER + db 27,GASTLY + db 22,HAUNTER + db 27,HAUNTER db $00 + diff --git a/data/wildPokemon/pokemontower7.asm b/data/wildPokemon/pokemontower7.asm index 0f7e66e9..34ca6225 100755 --- a/data/wildPokemon/pokemontower7.asm +++ b/data/wildPokemon/pokemontower7.asm @@ -1,13 +1,14 @@ TowerMons7: - db $0F - db 21,GASTLY - db 22,GASTLY - db 23,GASTLY + db $14 db 24,GASTLY - db 20,GASTLY - db 28,HAUNTER - db 22,CUBONE + db 25,GASTLY + db 26,GASTLY + db 27,GASTLY + db 28,GASTLY + db 23,GASTLY db 24,CUBONE - db 28,HAUNTER - db 30,HAUNTER + db 29,GASTLY + db 24,HAUNTER + db 29,HAUNTER db $00 + diff --git a/data/wildPokemon/powerplant.asm b/data/wildPokemon/powerplant.asm index 35eece95..8a1667a5 100755 --- a/data/wildPokemon/powerplant.asm +++ b/data/wildPokemon/powerplant.asm @@ -1,19 +1,13 @@ PowerPlantMons: db $0A - db 21,VOLTORB - db 21,MAGNEMITE - db 20,PIKACHU - db 24,PIKACHU - db 23,MAGNEMITE - db 23,VOLTORB - db 32,MAGNETON - db 35,MAGNETON - IF DEF(_RED) - db 33,ELECTABUZZ - db 36,ELECTABUZZ - ENDC - IF DEF(_BLUE) - db 33,RAICHU - db 36,RAICHU - ENDC + db 30,MAGNEMITE + db 35,MAGNEMITE + db 33,MAGNETON + db 33,VOLTORB + db 37,VOLTORB + db 33,GRIMER + db 37,GRIMER + db 38,MAGNETON + db 33,MUK + db 37,MUK db $00 diff --git a/data/wildPokemon/rocktunnel1.asm b/data/wildPokemon/rocktunnel1.asm index a36f2092..9999490e 100755 --- a/data/wildPokemon/rocktunnel1.asm +++ b/data/wildPokemon/rocktunnel1.asm @@ -1,13 +1,14 @@ TunnelMonsB1: db $0F - db 16,ZUBAT - db 17,ZUBAT - db 17,GEODUDE - db 15,MACHOP - db 16,GEODUDE - db 18,ZUBAT db 15,ZUBAT + db 16,GEODUDE + db 17,ZUBAT + db 19,ZUBAT + db 18,GEODUDE + db 20,GEODUDE + db 21,ZUBAT db 17,MACHOP - db 13,ONIX - db 15,ONIX + db 19,MACHOP + db 21,MACHOP db $00 + diff --git a/data/wildPokemon/rocktunnel2.asm b/data/wildPokemon/rocktunnel2.asm index 2fc7ef94..41111909 100755 --- a/data/wildPokemon/rocktunnel2.asm +++ b/data/wildPokemon/rocktunnel2.asm @@ -1,13 +1,14 @@ TunnelMonsB2: db $0F - db 16,ZUBAT - db 17,ZUBAT + db 20,ZUBAT db 17,GEODUDE - db 15,MACHOP - db 16,GEODUDE - db 18,ZUBAT - db 17,MACHOP - db 17,ONIX - db 13,ONIX - db 18,GEODUDE + db 18,MACHOP + db 21,ZUBAT + db 22,ZUBAT + db 21,GEODUDE + db 20,MACHOP + db 14,ONIX + db 18,ONIX + db 22,ONIX db $00 + diff --git a/data/wildPokemon/route1.asm b/data/wildPokemon/route1.asm index f618c34f..4b85ba40 100755 --- a/data/wildPokemon/route1.asm +++ b/data/wildPokemon/route1.asm @@ -1,13 +1,14 @@ Route1Mons: db $19 db 3,PIDGEY - db 3,RATTATA - db 3,RATTATA + db 4,PIDGEY db 2,RATTATA + db 3,RATTATA db 2,PIDGEY db 3,PIDGEY - db 3,PIDGEY - db 4,RATTATA - db 4,PIDGEY db 5,PIDGEY + db 4,RATTATA + db 6,PIDGEY + db 7,PIDGEY db $00 + diff --git a/data/wildPokemon/route10.asm b/data/wildPokemon/route10.asm index 34e0b5ee..af835c99 100755 --- a/data/wildPokemon/route10.asm +++ b/data/wildPokemon/route10.asm @@ -1,27 +1,14 @@ Route10Mons: db $0F - IF DEF(_RED) - db 16,VOLTORB - db 16,SPEAROW - db 14,VOLTORB - db 11,EKANS - db 13,SPEAROW - db 15,EKANS - db 17,VOLTORB - db 17,SPEAROW - db 13,EKANS - db 17,EKANS - ENDC - IF DEF(_BLUE) - db 16,VOLTORB - db 16,SPEAROW - db 14,VOLTORB - db 11,SANDSHREW - db 13,SPEAROW - db 15,SANDSHREW - db 17,VOLTORB - db 17,SPEAROW - db 13,SANDSHREW - db 17,SANDSHREW - ENDC + db 16,MAGNEMITE + db 18,RATTATA + db 18,MAGNEMITE + db 20,MAGNEMITE + db 17,NIDORAN_M + db 17,NIDORAN_F + db 22,MAGNEMITE + db 20,RATICATE + db 16,MACHOP + db 18,MACHOP db $00 + diff --git a/data/wildPokemon/route11.asm b/data/wildPokemon/route11.asm index 9e4e3644..0b1425c0 100755 --- a/data/wildPokemon/route11.asm +++ b/data/wildPokemon/route11.asm @@ -1,27 +1,14 @@ Route11Mons: db $0F - IF DEF(_RED) - db 14,EKANS - db 15,SPEAROW - db 12,EKANS - db 9,DROWZEE - db 13,SPEAROW - db 13,DROWZEE - db 15,EKANS - db 17,SPEAROW - db 11,DROWZEE - db 15,DROWZEE - ENDC - IF DEF(_BLUE) - db 14,SANDSHREW - db 15,SPEAROW - db 12,SANDSHREW - db 9,DROWZEE - db 13,SPEAROW - db 13,DROWZEE - db 15,SANDSHREW - db 17,SPEAROW - db 11,DROWZEE - db 15,DROWZEE - ENDC + db 16,PIDGEY + db 15,RATTATA + db 18,PIDGEY + db 15,DROWZEE + db 17,RATTATA + db 17,DROWZEE + db 18,PIDGEOTTO + db 20,PIDGEOTTO + db 19,DROWZEE + db 17,RATICATE db $00 + diff --git a/data/wildPokemon/route12.asm b/data/wildPokemon/route12.asm index 45dfbc9d..6dc3d739 100755 --- a/data/wildPokemon/route12.asm +++ b/data/wildPokemon/route12.asm @@ -1,27 +1,25 @@ Route12Mons: db $0F - IF DEF(_RED) - db 24,ODDISH - db 25,PIDGEY - db 23,PIDGEY - db 24,VENONAT - db 22,ODDISH - db 26,VENONAT - db 26,ODDISH - db 27,PIDGEY - db 28,GLOOM - db 30,GLOOM - ENDC - IF DEF(_BLUE) - db 24,BELLSPROUT - db 25,PIDGEY - db 23,PIDGEY - db 24,VENONAT - db 22,BELLSPROUT - db 26,VENONAT - db 26,BELLSPROUT - db 27,PIDGEY - db 28,WEEPINBELL - db 30,WEEPINBELL - ENDC - db $00 + db 25,ODDISH + db 25,BELLSPROUT + db 28,PIDGEY + db 28,PIDGEOTTO + db 27,ODDISH + db 27,BELLSPROUT + db 29,GLOOM + db 29,WEEPINBELL + db 26,FARFETCHD + db 31,FARFETCHD + + db $03 + db 15,SLOWPOKE + db 15,SLOWPOKE + db 15,SLOWPOKE + db 15,SLOWPOKE + db 15,SLOWPOKE + db 15,SLOWPOKE + db 15,SLOWPOKE + db 15,SLOWPOKE + db 15,SLOWBRO + db 20,SLOWBRO + diff --git a/data/wildPokemon/route13.asm b/data/wildPokemon/route13.asm index 2a1a6cb5..3b6ca152 100755 --- a/data/wildPokemon/route13.asm +++ b/data/wildPokemon/route13.asm @@ -1,28 +1,25 @@ Route13Mons: - IF DEF(_RED) - db $14 - db 24,ODDISH - db 25,PIDGEY - db 27,PIDGEY - db 24,VENONAT - db 22,ODDISH - db 26,VENONAT - db 26,ODDISH - db 25,DITTO - db 28,GLOOM - db 30,GLOOM - ENDC - IF DEF(_BLUE) - db $14 - db 24,BELLSPROUT - db 25,PIDGEY - db 27,PIDGEY - db 24,VENONAT - db 22,BELLSPROUT - db 26,VENONAT - db 26,BELLSPROUT - db 25,DITTO - db 28,WEEPINBELL - db 30,WEEPINBELL - ENDC - db $00 + db $0F + db 25,ODDISH + db 25,BELLSPROUT + db 28,PIDGEOTTO + db 28,PIDGEY + db 27,ODDISH + db 27,BELLSPROUT + db 29,GLOOM + db 29,WEEPINBELL + db 26,FARFETCHD + db 31,FARFETCHD + + db $03 + db 15,SLOWPOKE + db 15,SLOWPOKE + db 15,SLOWPOKE + db 15,SLOWPOKE + db 15,SLOWPOKE + db 15,SLOWPOKE + db 15,SLOWPOKE + db 15,SLOWPOKE + db 15,SLOWBRO + db 20,SLOWBRO + diff --git a/data/wildPokemon/route14.asm b/data/wildPokemon/route14.asm index aad5aa48..9eb0e4c5 100755 --- a/data/wildPokemon/route14.asm +++ b/data/wildPokemon/route14.asm @@ -1,27 +1,14 @@ Route14Mons: db $0F - IF DEF(_RED) - db 24,ODDISH - db 26,PIDGEY - db 23,DITTO - db 24,VENONAT - db 22,ODDISH - db 26,VENONAT - db 26,ODDISH - db 30,GLOOM - db 28,PIDGEOTTO - db 30,PIDGEOTTO - ENDC - IF DEF(_BLUE) - db 24,BELLSPROUT - db 26,PIDGEY - db 23,DITTO - db 24,VENONAT - db 22,BELLSPROUT - db 26,VENONAT - db 26,BELLSPROUT - db 30,WEEPINBELL - db 28,PIDGEOTTO - db 30,PIDGEOTTO - ENDC + db 26,ODDISH + db 26,BELLSPROUT + db 24,VENONAT + db 30,PIDGEOTTO + db 28,ODDISH + db 28,BELLSPROUT + db 30,GLOOM + db 30,WEEPINBELL + db 27,VENONAT + db 30,VENOMOTH db $00 + diff --git a/data/wildPokemon/route15.asm b/data/wildPokemon/route15.asm index b4762230..30d96ed2 100755 --- a/data/wildPokemon/route15.asm +++ b/data/wildPokemon/route15.asm @@ -1,27 +1,14 @@ Route15Mons: db $0F - IF DEF(_RED) - db 24,ODDISH - db 26,DITTO - db 23,PIDGEY - db 26,VENONAT - db 22,ODDISH - db 28,VENONAT - db 26,ODDISH - db 30,GLOOM - db 28,PIDGEOTTO - db 30,PIDGEOTTO - ENDC - IF DEF(_BLUE) - db 24,BELLSPROUT - db 26,DITTO - db 23,PIDGEY - db 26,VENONAT - db 22,BELLSPROUT - db 28,VENONAT - db 26,BELLSPROUT - db 30,WEEPINBELL - db 28,PIDGEOTTO - db 30,PIDGEOTTO - ENDC + db 26,ODDISH + db 26,BELLSPROUT + db 24,VENONAT + db 32,PIDGEOTTO + db 28,ODDISH + db 28,BELLSPROUT + db 30,GLOOM + db 30,WEEPINBELL + db 27,VENONAT + db 30,VENOMOTH db $00 + diff --git a/data/wildPokemon/route16.asm b/data/wildPokemon/route16.asm index c2421c50..eeefa9ba 100755 --- a/data/wildPokemon/route16.asm +++ b/data/wildPokemon/route16.asm @@ -1,13 +1,14 @@ Route16Mons: db $19 - db 20,SPEAROW db 22,SPEAROW - db 18,RATTATA - db 20,DODUO - db 20,RATTATA - db 18,DODUO db 22,DODUO - db 22,RATTATA - db 23,RATICATE + db 23,RATTATA + db 24,DODUO + db 24,RATTATA + db 26,DODUO + db 23,SPEAROW + db 24,FEAROW db 25,RATICATE + db 26,RATICATE db $00 + diff --git a/data/wildPokemon/route17.asm b/data/wildPokemon/route17.asm index 8dffd9a3..ce72f376 100755 --- a/data/wildPokemon/route17.asm +++ b/data/wildPokemon/route17.asm @@ -1,13 +1,14 @@ Route17Mons: db $19 - db 20,SPEAROW - db 22,SPEAROW - db 25,RATICATE - db 24,DODUO - db 27,RATICATE db 26,DODUO - db 28,DODUO - db 29,RATICATE - db 25,FEAROW db 27,FEAROW + db 27,DODUO + db 28,DODUO + db 28,PONYTA + db 30,PONYTA + db 29,FEAROW + db 28,DODUO + db 32,PONYTA + db 29,DODRIO db $00 + diff --git a/data/wildPokemon/route18.asm b/data/wildPokemon/route18.asm index 47bd247d..62ce6c3e 100755 --- a/data/wildPokemon/route18.asm +++ b/data/wildPokemon/route18.asm @@ -1,13 +1,14 @@ Route18Mons: db $19 - db 20,SPEAROW db 22,SPEAROW - db 25,RATICATE + db 22,DODUO + db 23,RATTATA db 24,DODUO - db 25,FEAROW + db 24,RATTATA db 26,DODUO - db 28,DODUO - db 29,RATICATE - db 27,FEAROW - db 29,FEAROW + db 23,SPEAROW + db 24,FEAROW + db 25,RATICATE + db 26,RATICATE db $00 + diff --git a/data/wildPokemon/waterpokemon.asm b/data/wildPokemon/route19.asm index 07c6a187..77e1e3ef 100755..100644 --- a/data/wildPokemon/waterpokemon.asm +++ b/data/wildPokemon/route19.asm @@ -1,5 +1,6 @@ -WaterMons: +Route19Mons: db $00 + db $05 db 5,TENTACOOL db 10,TENTACOOL @@ -11,3 +12,4 @@ WaterMons: db 30,TENTACOOL db 35,TENTACOOL db 40,TENTACOOL + diff --git a/data/wildPokemon/route2.asm b/data/wildPokemon/route2.asm index fb3a5e82..93f3726f 100755 --- a/data/wildPokemon/route2.asm +++ b/data/wildPokemon/route2.asm @@ -2,23 +2,13 @@ Route2Mons: db $19 db 3,RATTATA db 3,PIDGEY - db 4,PIDGEY db 4,RATTATA + db 4,NIDORAN_M + db 4,NIDORAN_F db 5,PIDGEY - if DEF(_RED) - db 3,WEEDLE - ENDC - if DEF(_BLUE) - db 3,CATERPIE - ENDC - db 2,RATTATA - db 5,RATTATA - if DEF(_RED) - db 4,WEEDLE - db 5,WEEDLE - ENDC - if DEF(_BLUE) - db 4,CATERPIE - db 5,CATERPIE - ENDC + db 6,NIDORAN_M + db 6,NIDORAN_F + db 7,PIDGEY + db 7,PIDGEY db $00 + diff --git a/data/wildPokemon/route20.asm b/data/wildPokemon/route20.asm new file mode 100644 index 00000000..b955c330 --- /dev/null +++ b/data/wildPokemon/route20.asm @@ -0,0 +1,15 @@ +Route20Mons: + db $00 + + db $05 + db 5,TENTACOOL + db 10,TENTACOOL + db 15,TENTACOOL + db 5,TENTACOOL + db 10,TENTACOOL + db 15,TENTACOOL + db 20,TENTACOOL + db 30,TENTACOOL + db 35,TENTACOOL + db 40,TENTACOOL + diff --git a/data/wildPokemon/route21.asm b/data/wildPokemon/route21.asm index 3cc73ba0..11ac7e6b 100755 --- a/data/wildPokemon/route21.asm +++ b/data/wildPokemon/route21.asm @@ -1,15 +1,16 @@ Route21Mons: db $19 - db 21,RATTATA - db 23,PIDGEY - db 30,RATICATE - db 23,RATTATA - db 21,PIDGEY - db 30,PIDGEOTTO - db 32,PIDGEOTTO - db 28,TANGELA - db 30,TANGELA - db 32,TANGELA + db 15,PIDGEY + db 13,RATTATA + db 13,PIDGEY + db 11,PIDGEY + db 17,PIDGEY + db 15,RATTATA + db 15,RATICATE + db 17,PIDGEOTTO + db 19,PIDGEOTTO + db 15,PIDGEOTTO + db $05 db 5,TENTACOOL db 10,TENTACOOL @@ -21,3 +22,4 @@ Route21Mons: db 30,TENTACOOL db 35,TENTACOOL db 40,TENTACOOL + diff --git a/data/wildPokemon/route22.asm b/data/wildPokemon/route22.asm index 750a2f4e..39f1f29c 100755 --- a/data/wildPokemon/route22.asm +++ b/data/wildPokemon/route22.asm @@ -1,27 +1,14 @@ Route22Mons: db $19 - IF DEF(_RED) - db 3,RATTATA - db 3,NIDORAN_M - db 4,RATTATA - db 4,NIDORAN_M - db 2,RATTATA - db 2,NIDORAN_M - db 3,SPEAROW - db 5,SPEAROW - db 3,NIDORAN_F - db 4,NIDORAN_F - ENDC - IF DEF(_BLUE) - db 3,RATTATA - db 3,NIDORAN_F - db 4,RATTATA - db 4,NIDORAN_F - db 2,RATTATA - db 2,NIDORAN_F - db 3,SPEAROW - db 5,SPEAROW - db 3,NIDORAN_M - db 4,NIDORAN_M - ENDC + db 2,NIDORAN_M + db 2,NIDORAN_F + db 3,MANKEY + db 3,RATTATA + db 4,NIDORAN_M + db 4,NIDORAN_F + db 5,MANKEY + db 2,SPEAROW + db 4,SPEAROW + db 6,SPEAROW db $00 + diff --git a/data/wildPokemon/route23.asm b/data/wildPokemon/route23.asm index a96a0d3c..43de8c2b 100755 --- a/data/wildPokemon/route23.asm +++ b/data/wildPokemon/route23.asm @@ -1,23 +1,14 @@ Route23Mons: db $0A - IF DEF(_RED) - db 26,EKANS - ENDC - IF !DEF(_RED) - db 26,SANDSHREW - ENDC - db 33,DITTO - db 26,SPEAROW - db 38,FEAROW - db 38,DITTO - db 38,FEAROW - IF DEF(_RED) - db 41,ARBOK - ENDC - IF !DEF(_RED) - db 41,SANDSLASH - ENDC - db 43,DITTO - db 41,FEAROW - db 43,FEAROW + db 41,NIDORINO + db 41,NIDORINA + db 36,MANKEY + db 44,NIDORINO + db 44,NIDORINA + db 40,FEAROW + db 41,MANKEY + db 45,FEAROW + db 41,PRIMEAPE + db 46,PRIMEAPE db $00 + diff --git a/data/wildPokemon/route24.asm b/data/wildPokemon/route24.asm index 3a745f36..df4a3bce 100755 --- a/data/wildPokemon/route24.asm +++ b/data/wildPokemon/route24.asm @@ -1,27 +1,14 @@ Route24Mons: db $19 - IF DEF(_RED) - db 7,WEEDLE - db 8,KAKUNA - db 12,PIDGEY - db 12,ODDISH - db 13,ODDISH - db 10,ABRA - db 14,ODDISH - db 13,PIDGEY - db 8,ABRA - db 12,ABRA - ENDC - IF DEF(_BLUE) - db 7,CATERPIE - db 8,METAPOD - db 12,PIDGEY - db 12,BELLSPROUT - db 13,BELLSPROUT - db 10,ABRA - db 14,BELLSPROUT - db 13,PIDGEY - db 8,ABRA - db 12,ABRA - ENDC + db 12,ODDISH + db 12,BELLSPROUT + db 13,PIDGEY + db 14,ODDISH + db 14,BELLSPROUT + db 15,PIDGEY + db 13,VENONAT + db 16,VENONAT + db 17,PIDGEY + db 17,PIDGEOTTO db $00 + diff --git a/data/wildPokemon/route25.asm b/data/wildPokemon/route25.asm index 4884fa64..1546dd74 100755 --- a/data/wildPokemon/route25.asm +++ b/data/wildPokemon/route25.asm @@ -1,27 +1,14 @@ Route25Mons: db $0F - IF DEF(_RED) - db 8,WEEDLE - db 9,KAKUNA - db 13,PIDGEY - db 12,ODDISH - db 13,ODDISH - db 12,ABRA - db 14,ODDISH - db 10,ABRA - db 7,METAPOD - db 8,CATERPIE - ENDC - IF DEF(_BLUE) - db 8,CATERPIE - db 9,METAPOD - db 13,PIDGEY - db 12,BELLSPROUT - db 13,BELLSPROUT - db 12,ABRA - db 14,BELLSPROUT - db 10,ABRA - db 7,KAKUNA - db 8,WEEDLE - ENDC + db 12,ODDISH + db 12,BELLSPROUT + db 13,PIDGEY + db 14,ODDISH + db 14,BELLSPROUT + db 15,PIDGEY + db 13,VENONAT + db 16,VENONAT + db 17,PIDGEY + db 17,PIDGEOTTO db $00 + diff --git a/data/wildPokemon/route3.asm b/data/wildPokemon/route3.asm index dea820a4..f867fbbf 100755 --- a/data/wildPokemon/route3.asm +++ b/data/wildPokemon/route3.asm @@ -1,13 +1,14 @@ Route3Mons: db $14 - db 6,PIDGEY - db 5,SPEAROW - db 7,PIDGEY - db 6,SPEAROW - db 7,SPEAROW - db 8,PIDGEY db 8,SPEAROW - db 3,JIGGLYPUFF - db 5,JIGGLYPUFF - db 7,JIGGLYPUFF + db 9,SPEAROW + db 9,MANKEY + db 10,SPEAROW + db 8,SANDSHREW + db 10,RATTATA + db 10,SANDSHREW + db 12,RATTATA + db 11,SPEAROW + db 12,SPEAROW db $00 + diff --git a/data/wildPokemon/route4.asm b/data/wildPokemon/route4.asm index 624d58de..b62126d8 100755 --- a/data/wildPokemon/route4.asm +++ b/data/wildPokemon/route4.asm @@ -1,27 +1,14 @@ Route4Mons: db $14 - IF DEF(_RED) - db 10,RATTATA - db 10,SPEAROW - db 8,RATTATA - db 6,EKANS - db 8,SPEAROW - db 10,EKANS - db 12,RATTATA - db 12,SPEAROW - db 8,EKANS - db 12,EKANS - ENDC - IF DEF(_BLUE) - db 10,RATTATA - db 10,SPEAROW - db 8,RATTATA - db 6,SANDSHREW - db 8,SPEAROW - db 10,SANDSHREW - db 12,RATTATA - db 12,SPEAROW - db 8,SANDSHREW - db 12,SANDSHREW - ENDC + db 8,SPEAROW + db 9,SPEAROW + db 9,MANKEY + db 10,SPEAROW + db 8,SANDSHREW + db 10,RATTATA + db 10,SANDSHREW + db 12,RATTATA + db 11,SPEAROW + db 12,SPEAROW db $00 + diff --git a/data/wildPokemon/route5.asm b/data/wildPokemon/route5.asm index cb8c583b..1e9703a7 100755 --- a/data/wildPokemon/route5.asm +++ b/data/wildPokemon/route5.asm @@ -1,27 +1,14 @@ Route5Mons: db $0F - IF DEF(_RED) - db 13,ODDISH - db 13,PIDGEY - db 15,PIDGEY - db 10,MANKEY - db 12,MANKEY - db 15,ODDISH - db 16,ODDISH - db 16,PIDGEY - db 14,MANKEY - db 16,MANKEY - ENDC - IF DEF(_BLUE) - db 13,BELLSPROUT - db 13,PIDGEY - db 15,PIDGEY - db 10,MEOWTH - db 12,MEOWTH - db 15,BELLSPROUT - db 16,BELLSPROUT - db 16,PIDGEY - db 14,MEOWTH - db 16,MEOWTH - ENDC + db 15,PIDGEY + db 14,RATTATA + db 7,ABRA + db 16,PIDGEY + db 16,RATTATA + db 17,PIDGEY + db 17,PIDGEOTTO + db 3,JIGGLYPUFF + db 5,JIGGLYPUFF + db 7,JIGGLYPUFF db $00 + diff --git a/data/wildPokemon/route6.asm b/data/wildPokemon/route6.asm index 92512ffb..b84e5029 100755 --- a/data/wildPokemon/route6.asm +++ b/data/wildPokemon/route6.asm @@ -1,27 +1,25 @@ Route6Mons: db $0F - IF DEF(_RED) - db 13,ODDISH - db 13,PIDGEY - db 15,PIDGEY - db 10,MANKEY - db 12,MANKEY - db 15,ODDISH - db 16,ODDISH - db 16,PIDGEY - db 14,MANKEY - db 16,MANKEY - ENDC - IF DEF(_BLUE) - db 13,BELLSPROUT - db 13,PIDGEY - db 15,PIDGEY - db 10,MEOWTH - db 12,MEOWTH - db 15,BELLSPROUT - db 16,BELLSPROUT - db 16,PIDGEY - db 14,MEOWTH - db 16,MEOWTH - ENDC - db $00 + db 15,PIDGEY + db 14,RATTATA + db 7,ABRA + db 16,PIDGEY + db 16,RATTATA + db 17,PIDGEY + db 17,PIDGEOTTO + db 3,JIGGLYPUFF + db 5,JIGGLYPUFF + db 7,JIGGLYPUFF + + db $03 + db 15,PSYDUCK + db 15,PSYDUCK + db 15,PSYDUCK + db 15,PSYDUCK + db 15,PSYDUCK + db 15,PSYDUCK + db 15,PSYDUCK + db 15,PSYDUCK + db 15,GOLDUCK + db 20,GOLDUCK + diff --git a/data/wildPokemon/route7.asm b/data/wildPokemon/route7.asm index 559c98ee..dad77e69 100755 --- a/data/wildPokemon/route7.asm +++ b/data/wildPokemon/route7.asm @@ -1,27 +1,14 @@ Route7Mons: db $0F - IF DEF(_RED) - db 19,PIDGEY - db 19,ODDISH - db 17,MANKEY - db 22,ODDISH - db 22,PIDGEY - db 18,MANKEY - db 18,GROWLITHE - db 20,GROWLITHE - db 19,MANKEY - db 20,MANKEY - ENDC - IF DEF(_BLUE) - db 19,PIDGEY - db 19,BELLSPROUT - db 17,MEOWTH - db 22,BELLSPROUT - db 22,PIDGEY - db 18,MEOWTH - db 18,VULPIX - db 20,VULPIX - db 19,MEOWTH - db 20,MEOWTH - ENDC + db 20,PIDGEY + db 22,PIDGEY + db 20,RATTATA + db 15,ABRA + db 19,ABRA + db 24,PIDGEOTTO + db 26,ABRA + db 19,JIGGLYPUFF + db 24,JIGGLYPUFF + db 24,JIGGLYPUFF db $00 + diff --git a/data/wildPokemon/route8.asm b/data/wildPokemon/route8.asm index 8a0bfa31..8b47b163 100755 --- a/data/wildPokemon/route8.asm +++ b/data/wildPokemon/route8.asm @@ -1,27 +1,14 @@ Route8Mons: db $0F - IF DEF(_RED) - db 18,PIDGEY - db 18,MANKEY - db 17,EKANS - db 16,GROWLITHE - db 20,PIDGEY - db 20,MANKEY - db 19,EKANS - db 17,GROWLITHE - db 15,GROWLITHE - db 18,GROWLITHE - ENDC - IF DEF(_BLUE) - db 18,PIDGEY - db 18,MEOWTH - db 17,SANDSHREW - db 16,VULPIX - db 20,PIDGEY - db 20,MEOWTH - db 19,SANDSHREW - db 17,VULPIX - db 15,VULPIX - db 18,VULPIX - ENDC + db 20,PIDGEY + db 22,PIDGEY + db 20,RATTATA + db 15,ABRA + db 19,ABRA + db 24,PIDGEOTTO + db 19,JIGGLYPUFF + db 24,JIGGLYPUFF + db 20,KADABRA + db 27,KADABRA db $00 + diff --git a/data/wildPokemon/route9.asm b/data/wildPokemon/route9.asm index 716589b0..95f5b451 100755 --- a/data/wildPokemon/route9.asm +++ b/data/wildPokemon/route9.asm @@ -1,27 +1,14 @@ Route9Mons: db $0F - IF DEF(_RED) - db 16,RATTATA - db 16,SPEAROW - db 14,RATTATA - db 11,EKANS - db 13,SPEAROW - db 15,EKANS - db 17,RATTATA - db 17,SPEAROW - db 13,EKANS - db 17,EKANS - ENDC - IF DEF(_BLUE) - db 16,RATTATA - db 16,SPEAROW - db 14,RATTATA - db 11,SANDSHREW - db 13,SPEAROW - db 15,SANDSHREW - db 17,RATTATA - db 17,SPEAROW - db 13,SANDSHREW - db 17,SANDSHREW - ENDC + db 16,NIDORAN_M + db 16,NIDORAN_F + db 18,RATTATA + db 18,NIDORAN_M + db 18,NIDORAN_F + db 17,SPEAROW + db 18,NIDORINO + db 18,NIDORINA + db 20,RATICATE + db 19,FEAROW db $00 + diff --git a/data/wildPokemon/safarizone1.asm b/data/wildPokemon/safarizone1.asm index 3d77b6fe..c8632351 100755 --- a/data/wildPokemon/safarizone1.asm +++ b/data/wildPokemon/safarizone1.asm @@ -1,27 +1,14 @@ ZoneMons1: db $1E - IF DEF(_RED) - db 24,NIDORAN_M - db 26,DODUO - db 22,PARAS - db 25,EXEGGCUTE - db 33,NIDORINO - db 23,EXEGGCUTE - db 24,NIDORAN_F - db 25,PARASECT - db 25,KANGASKHAN - db 28,SCYTHER - ENDC - IF DEF(_BLUE) - db 24,NIDORAN_F - db 26,DODUO - db 22,PARAS - db 25,EXEGGCUTE - db 33,NIDORINA - db 23,EXEGGCUTE - db 24,NIDORAN_M - db 25,PARASECT - db 25,KANGASKHAN - db 28,PINSIR - ENDC + db 21,NIDORAN_M + db 29,NIDORAN_F + db 22,EXEGGCUTE + db 21,TAUROS + db 32,NIDORINA + db 19,CUBONE + db 26,EXEGGCUTE + db 24,MAROWAK + db 21,CHANSEY + db 15,SCYTHER db $00 + diff --git a/data/wildPokemon/safarizone2.asm b/data/wildPokemon/safarizone2.asm index c1b6a547..1e4a6744 100755 --- a/data/wildPokemon/safarizone2.asm +++ b/data/wildPokemon/safarizone2.asm @@ -1,28 +1,14 @@ ZoneMons2: db $1E - IF DEF(_RED) - db 22,NIDORAN_M - ENDC - IF DEF(_BLUE) - db 22,NIDORAN_F - ENDC - db 26,RHYHORN - db 23,PARAS - db 25,EXEGGCUTE - IF DEF(_RED) - db 30,NIDORINO - ENDC - IF DEF(_BLUE) - db 30,NIDORINA - ENDC - db 27,EXEGGCUTE - IF DEF(_RED) - db 30,NIDORINA - ENDC - IF DEF(_BLUE) - db 30,NIDORINO - ENDC - db 32,VENOMOTH - db 26,CHANSEY - db 28,TAUROS + db 36,NIDORAN_M + db 14,NIDORAN_F + db 20,EXEGGCUTE + db 25,RHYHORN + db 23,NIDORINA + db 28,KANGASKHAN + db 16,CUBONE + db 33,KANGASKHAN + db 25,SCYTHER + db 15,PINSIR db $00 + diff --git a/data/wildPokemon/safarizone3.asm b/data/wildPokemon/safarizone3.asm index 47b6a102..3424f1d7 100755 --- a/data/wildPokemon/safarizone3.asm +++ b/data/wildPokemon/safarizone3.asm @@ -1,27 +1,14 @@ ZoneMons3: db $1E - IF DEF(_RED) - db 25,NIDORAN_M - db 26,DODUO - db 23,VENONAT - db 24,EXEGGCUTE - db 33,NIDORINO - db 26,EXEGGCUTE - db 25,NIDORAN_F - db 31,VENOMOTH - db 26,TAUROS - db 28,KANGASKHAN - ENDC - IF DEF(_BLUE) - db 25,NIDORAN_F - db 26,DODUO - db 23,VENONAT - db 24,EXEGGCUTE - db 33,NIDORINA - db 26,EXEGGCUTE - db 25,NIDORAN_M - db 31,VENOMOTH - db 26,TAUROS - db 28,KANGASKHAN - ENDC + db 29,NIDORAN_M + db 21,NIDORAN_F + db 22,EXEGGCUTE + db 21,TAUROS + db 32,NIDORINO + db 19,CUBONE + db 26,EXEGGCUTE + db 24,MAROWAK + db 25,PINSIR + db 27,TANGELA db $00 + diff --git a/data/wildPokemon/safarizonecenter.asm b/data/wildPokemon/safarizonecenter.asm index 0cd5323a..e563fff2 100755 --- a/data/wildPokemon/safarizonecenter.asm +++ b/data/wildPokemon/safarizonecenter.asm @@ -1,27 +1,14 @@ ZoneMonsCenter: db $1E - IF DEF(_RED) - db 22,NIDORAN_M - db 25,RHYHORN - db 22,VENONAT - db 24,EXEGGCUTE - db 31,NIDORINO - db 25,EXEGGCUTE - db 31,NIDORINA - db 30,PARASECT - db 23,SCYTHER - db 23,CHANSEY - ENDC - IF DEF(_BLUE) - db 22,NIDORAN_F - db 25,RHYHORN - db 22,VENONAT - db 24,EXEGGCUTE - db 31,NIDORINA - db 25,EXEGGCUTE - db 31,NIDORINO - db 30,PARASECT - db 23,PINSIR - db 23,CHANSEY - ENDC + db 14,NIDORAN_M + db 36,NIDORAN_F + db 24,EXEGGCUTE + db 20,RHYHORN + db 23,NIDORINO + db 27,PARASECT + db 27,PARAS + db 32,PARASECT + db 22,TANGELA + db 7,CHANSEY db $00 + diff --git a/data/wildPokemon/seafoamisland1.asm b/data/wildPokemon/seafoamisland1.asm index 3c431f9a..f4799c12 100755 --- a/data/wildPokemon/seafoamisland1.asm +++ b/data/wildPokemon/seafoamisland1.asm @@ -1,27 +1,14 @@ IslandMons1: db $0F - IF DEF(_RED) - db 30,SEEL - db 30,SLOWPOKE - db 30,SHELLDER - db 30,HORSEA - db 28,HORSEA - db 21,ZUBAT - db 29,GOLBAT - db 28,PSYDUCK - db 28,SHELLDER - db 38,GOLDUCK - ENDC - IF DEF(_BLUE) - db 30,SEEL - db 30,PSYDUCK - db 30,STARYU - db 30,KRABBY - db 28,KRABBY - db 21,ZUBAT - db 29,GOLBAT - db 28,SLOWPOKE - db 28,STARYU - db 38,SLOWBRO - ENDC + db 18,ZUBAT + db 25,KRABBY + db 27,KRABBY + db 27,ZUBAT + db 36,ZUBAT + db 28,SLOWPOKE + db 30,SLOWPOKE + db 9,ZUBAT + db 27,GOLBAT + db 36,GOLBAT db $00 + diff --git a/data/wildPokemon/seafoamislandb1.asm b/data/wildPokemon/seafoamislandb1.asm index 6f96f240..2f0f255e 100755 --- a/data/wildPokemon/seafoamislandb1.asm +++ b/data/wildPokemon/seafoamislandb1.asm @@ -1,27 +1,14 @@ IslandMonsB1: db $0A - IF DEF(_RED) - db 30,STARYU - db 30,HORSEA - db 32,SHELLDER - db 32,HORSEA - db 28,SLOWPOKE - db 30,SEEL - db 30,SLOWPOKE - db 28,SEEL - db 38,DEWGONG - db 37,SEADRA - ENDC - IF DEF(_BLUE) - db 30,SHELLDER - db 30,KRABBY - db 32,STARYU - db 32,KRABBY - db 28,PSYDUCK - db 30,SEEL - db 30,PSYDUCK - db 28,SEEL - db 38,DEWGONG - db 37,KINGLER - ENDC + db 27,ZUBAT + db 26,KRABBY + db 36,ZUBAT + db 28,KRABBY + db 27,GOLBAT + db 29,SLOWPOKE + db 18,ZUBAT + db 28,KINGLER + db 22,SEEL + db 26,SEEL db $00 + diff --git a/data/wildPokemon/seafoamislandb2.asm b/data/wildPokemon/seafoamislandb2.asm index 7191fea9..f3a23b07 100755 --- a/data/wildPokemon/seafoamislandb2.asm +++ b/data/wildPokemon/seafoamislandb2.asm @@ -1,27 +1,14 @@ IslandMonsB2: db $0A - IF DEF(_RED) - db 30,SEEL - db 30,SLOWPOKE - db 32,SEEL - db 32,SLOWPOKE - db 28,HORSEA - db 30,STARYU - db 30,HORSEA - db 28,SHELLDER - db 30,GOLBAT - db 37,SLOWBRO - ENDC - IF DEF(_BLUE) - db 30,SEEL - db 30,PSYDUCK - db 32,SEEL - db 32,PSYDUCK - db 28,KRABBY - db 30,SHELLDER - db 30,KRABBY - db 28,STARYU - db 30,GOLBAT - db 37,GOLDUCK - ENDC + db 27,ZUBAT + db 27,KRABBY + db 36,ZUBAT + db 27,GOLBAT + db 28,KINGLER + db 24,SEEL + db 29,KRABBY + db 36,GOLBAT + db 31,SLOWPOKE + db 31,SLOWBRO db $00 + diff --git a/data/wildPokemon/seafoamislandb3.asm b/data/wildPokemon/seafoamislandb3.asm index 9778c0e9..ddf6acd3 100755 --- a/data/wildPokemon/seafoamislandb3.asm +++ b/data/wildPokemon/seafoamislandb3.asm @@ -1,27 +1,25 @@ IslandMonsB3: db $0A - IF DEF(_RED) - db 31,SLOWPOKE - db 31,SEEL - db 33,SLOWPOKE - db 33,SEEL - db 29,HORSEA - db 31,SHELLDER - db 31,HORSEA - db 29,SHELLDER - db 39,SEADRA - db 37,DEWGONG - ENDC - IF DEF(_BLUE) - db 31,PSYDUCK - db 31,SEEL - db 33,PSYDUCK - db 33,SEEL - db 29,KRABBY - db 31,STARYU - db 31,KRABBY - db 29,STARYU - db 39,KINGLER - db 37,DEWGONG - ENDC - db $00 + db 27,GOLBAT + db 36,ZUBAT + db 29,KRABBY + db 27,ZUBAT + db 30,KINGLER + db 26,SEEL + db 31,KRABBY + db 30,SEEL + db 28,DEWGONG + db 32,DEWGONG + + db $05 + db 25,TENTACOOL + db 30,TENTACOOL + db 20,TENTACOOL + db 30,STARYU + db 35,TENTACOOL + db 30,STARYU + db 40,TENTACOOL + db 30,STARYU + db 30,STARYU + db 30,STARYU + diff --git a/data/wildPokemon/seafoamislandb4.asm b/data/wildPokemon/seafoamislandb4.asm index 3948470b..dd842dda 100755 --- a/data/wildPokemon/seafoamislandb4.asm +++ b/data/wildPokemon/seafoamislandb4.asm @@ -1,27 +1,25 @@ IslandMonsB4: db $0A - IF DEF(_RED) - db 31,HORSEA - db 31,SHELLDER - db 33,HORSEA - db 33,SHELLDER - db 29,SLOWPOKE - db 31,SEEL - db 31,SLOWPOKE - db 29,SEEL - db 39,SLOWBRO - db 32,GOLBAT - ENDC - IF DEF(_BLUE) - db 31,KRABBY - db 31,STARYU - db 33,KRABBY - db 33,STARYU - db 29,PSYDUCK - db 31,SEEL - db 31,PSYDUCK - db 29,SEEL - db 39,GOLDUCK - db 32,GOLBAT - ENDC - db $00 + db 36,GOLBAT + db 36,ZUBAT + db 30,KRABBY + db 32,KINGLER + db 28,SEEL + db 32,SEEL + db 27,GOLBAT + db 45,ZUBAT + db 30,DEWGONG + db 34,DEWGONG + + db $05 + db 25,TENTACOOL + db 30,TENTACOOL + db 20,TENTACOOL + db 30,STARYU + db 35,TENTACOOL + db 30,STARYU + db 40,TENTACOOL + db 30,STARYU + db 30,STARYU + db 30,STARYU + diff --git a/data/wildPokemon/unknowndungeon1.asm b/data/wildPokemon/unknowndungeon1.asm index 70f680b7..ff7be04e 100755 --- a/data/wildPokemon/unknowndungeon1.asm +++ b/data/wildPokemon/unknowndungeon1.asm @@ -1,18 +1,14 @@ DungeonMons1: db $0A - db 46,GOLBAT - db 46,HYPNO - db 46,MAGNETON - db 49,DODRIO - db 49,VENOMOTH - IF DEF(_RED) - db 52,ARBOK - ENDC - IF !DEF(_RED) - db 52,SANDSLASH - ENDC - db 49,KADABRA - db 52,PARASECT - db 53,RAICHU - db 53,DITTO + db 50,GOLBAT + db 55,GOLBAT + db 45,GRAVELER + db 55,GLOOM + db 55,WEEPINBELL + db 52,SANDSLASH + db 54,VENOMOTH + db 54,PARASECT + db 55,DITTO + db 60,DITTO db $00 + diff --git a/data/wildPokemon/unknowndungeon2.asm b/data/wildPokemon/unknowndungeon2.asm index 5afe55ac..1fd20019 100755 --- a/data/wildPokemon/unknowndungeon2.asm +++ b/data/wildPokemon/unknowndungeon2.asm @@ -1,13 +1,14 @@ DungeonMons2: db $0F - db 51,DODRIO - db 51,VENOMOTH - db 51,KADABRA - db 52,RHYDON - db 52,MAROWAK - db 52,ELECTRODE - db 56,CHANSEY - db 54,WIGGLYTUFF - db 55,DITTO + db 52,GOLBAT + db 57,GOLBAT + db 50,GRAVELER + db 56,SANDSLASH + db 50,RHYHORN db 60,DITTO + db 58,GLOOM + db 58,WEEPINBELL + db 60,RHYDON + db 58,RHYDON db $00 + diff --git a/data/wildPokemon/unknowndungeonb1.asm b/data/wildPokemon/unknowndungeonb1.asm index 245d5912..5848678f 100755 --- a/data/wildPokemon/unknowndungeonb1.asm +++ b/data/wildPokemon/unknowndungeonb1.asm @@ -1,18 +1,14 @@ DungeonMonsB1: db $19 - db 55,RHYDON - db 55,MAROWAK - db 55,ELECTRODE - db 64,CHANSEY - db 64,PARASECT - db 64,RAICHU - IF DEF(_RED) - db 57,ARBOK - ENDC - IF DEF(_BLUE) - db 57,SANDSLASH - ENDC + db 54,GOLBAT + db 59,GOLBAT + db 55,GRAVELER + db 52,RHYHORN + db 62,RHYDON + db 60,DITTO + db 56,CHANSEY db 65,DITTO - db 63,DITTO - db 67,DITTO + db 55,LICKITUNG + db 50,LICKITUNG db $00 + diff --git a/data/wildPokemon/victoryroad1.asm b/data/wildPokemon/victoryroad1.asm index 60aae31a..f3e029fa 100755 --- a/data/wildPokemon/victoryroad1.asm +++ b/data/wildPokemon/victoryroad1.asm @@ -1,13 +1,14 @@ PlateauMons1: db $0F - db 24,MACHOP db 26,GEODUDE - db 22,ZUBAT - db 36,ONIX - db 39,ONIX - db 42,ONIX + db 31,GEODUDE + db 36,GEODUDE + db 39,ZUBAT + db 44,ZUBAT + db 41,GEODUDE + db 43,ONIX + db 45,ONIX db 41,GRAVELER - db 41,GOLBAT - db 42,MACHOKE - db 43,MAROWAK + db 47,GRAVELER db $00 + diff --git a/data/wildPokemon/victoryroad2.asm b/data/wildPokemon/victoryroad2.asm index 580d644d..fcd910d2 100755 --- a/data/wildPokemon/victoryroad2.asm +++ b/data/wildPokemon/victoryroad2.asm @@ -1,13 +1,14 @@ PlateauMons2: db $0A - db 22,MACHOP - db 24,GEODUDE - db 26,ZUBAT - db 36,ONIX - db 39,ONIX - db 42,ONIX - db 41,MACHOKE - db 40,GOLBAT - db 40,MAROWAK - db 43,GRAVELER + db 31,GEODUDE + db 36,GEODUDE + db 41,GEODUDE + db 44,ZUBAT + db 39,GOLBAT + db 44,GRAVELER + db 45,ONIX + db 47,ONIX + db 39,MACHOKE + db 42,MACHOKE db $00 + diff --git a/data/wildPokemon/victoryroad3.asm b/data/wildPokemon/victoryroad3.asm index 80d7ef3e..ed4d773b 100755 --- a/data/wildPokemon/victoryroad3.asm +++ b/data/wildPokemon/victoryroad3.asm @@ -1,13 +1,14 @@ PlateauMons3: db $0F - db 24,MACHOP - db 26,GEODUDE - db 22,ZUBAT - db 42,ONIX - db 40,VENOMOTH - db 45,ONIX - db 43,GRAVELER - db 41,GOLBAT + db 36,GEODUDE + db 44,GOLBAT + db 41,GEODUDE + db 49,ONIX + db 46,GEODUDE + db 41,GRAVELER db 42,MACHOKE db 45,MACHOKE + db 47,GRAVELER + db 47,GRAVELER db $00 + diff --git a/data/wildPokemon/viridianforest.asm b/data/wildPokemon/viridianforest.asm index ae9a5a70..eb4889a7 100755 --- a/data/wildPokemon/viridianforest.asm +++ b/data/wildPokemon/viridianforest.asm @@ -1,25 +1,14 @@ ForestMons: - db $08 - IF DEF(_RED) - db 4,WEEDLE - db 5,KAKUNA - db 3,WEEDLE - db 5,WEEDLE - db 4,KAKUNA - db 6,KAKUNA - db 4,METAPOD - db 3,CATERPIE - ENDC - IF DEF(_BLUE) - db 4,CATERPIE - db 5,METAPOD - db 3,CATERPIE - db 5,CATERPIE - db 4,METAPOD - db 6,METAPOD - db 4,KAKUNA - db 3,WEEDLE - ENDC - db 3,PIKACHU - db 5,PIKACHU + db $19 + db 3,CATERPIE + db 4,METAPOD + db 4,CATERPIE + db 5,CATERPIE + db 4,PIDGEY + db 6,PIDGEY + db 6,CATERPIE + db 6,METAPOD + db 8,PIDGEY + db 9,PIDGEOTTO db $00 + diff --git a/data/wild_mons.asm b/data/wild_mons.asm index a4265565..c1c44e95 100755 --- a/data/wild_mons.asm +++ b/data/wild_mons.asm @@ -29,8 +29,8 @@ WildDataPointers: dw Route16Mons ; ROUTE_16 dw Route17Mons ; ROUTE_17 dw Route18Mons ; ROUTE_18 - dw WaterMons ; ROUTE_19 - dw WaterMons ; ROUTE_20 + dw Route19Mons ; ROUTE_19 + dw Route20Mons ; ROUTE_20 dw Route21Mons ; ROUTE_21 dw Route22Mons ; ROUTE_22 dw Route23Mons ; ROUTE_23 @@ -247,6 +247,7 @@ WildDataPointers: dw NoMons dw NoMons dw NoMons + dw NoMons dw $FFFF ; wild pokemon data is divided into two parts. @@ -299,7 +300,8 @@ INCLUDE "data/wildPokemon/safarizonecenter.asm" INCLUDE "data/wildPokemon/safarizone1.asm" INCLUDE "data/wildPokemon/safarizone2.asm" INCLUDE "data/wildPokemon/safarizone3.asm" -INCLUDE "data/wildPokemon/waterpokemon.asm" +INCLUDE "data/wildPokemon/route19.asm" +INCLUDE "data/wildPokemon/route20.asm" INCLUDE "data/wildPokemon/seafoamisland1.asm" INCLUDE "data/wildPokemon/seafoamislandb1.asm" INCLUDE "data/wildPokemon/seafoamislandb2.asm" diff --git a/engine/HoF_room_pc.asm b/engine/HoF_room_pc.asm index 09c8d5af..d18ebca5 100755 --- a/engine/HoF_room_pc.asm +++ b/engine/HoF_room_pc.asm @@ -1,173 +1,214 @@ HallOfFamePC: - callba AnimateHallOfFame + callab FallingStarEnd call ClearScreen ld c, 100 call DelayFrames + call DisableLCD - ld hl, vFont - ld bc, $800 / 2 - call ZeroMemory - ld hl, vChars2 + $600 - ld bc, $200 / 2 - call ZeroMemory - ld hl, vChars2 + $7e0 - ld bc, $10 - ld a, $ff - call FillMemory + ld a, $a7 + ld [rWX], a + xor a + ld [rSCX], a + ld [rSCY], a + ld [hSCX], a + ld [hSCY], a + ld [hWY], a + ld [rWY], a + call CreditsLoadFont coord hl, 0, 0 call FillFourRowsWithBlack coord hl, 0, 14 call FillFourRowsWithBlack - ld a, $c0 + ld a, %11000000 ld [rBGP], a + call UpdateGBCPal_BGP call EnableLCD - ld a, $ff - call PlaySoundWaitForCurrent + call StopAllMusic + ld hl, vBGMap1 + call CreditsCopyTileMapToVRAM + ld hl, vBGMap0 + call CreditsCopyTileMapToVRAM ld c, BANK(Music_Credits) ld a, MUSIC_CREDITS call PlayMusic ld c, 128 call DelayFrames xor a - ld [wUnusedCD3D], a ; not read + ld [wHoFMonSpecies], a ld [wNumCreditsMonsDisplayed], a jp Credits FadeInCreditsText: + ld a, $1 + ld [H_AUTOBGTRANSFERENABLED], a ld hl, HoFGBPalettes ld b, 4 -.asm_740bf +.asm_f0f91 ld a, [hli] ld [rBGP], a + call UpdateGBCPal_BGP ld c, 5 call DelayFrames dec b - jr nz, .asm_740bf + jr nz, .asm_f0f91 ret +HoFGBPalettes: + db %11000000 + db %11010000 + db %11100000 + db %11110000 + DisplayCreditsMon: + ld hl, vBGMap1 + call CreditsCopyTileMapToVRAM xor a - ld [H_AUTOBGTRANSFERENABLED],a - call SaveScreenTilesToBuffer1 + ld [H_AUTOBGTRANSFERENABLED], a + ld hl, rLCDC + set 3, [hl] + call SaveScreenTilesToBuffer2 call FillMiddleOfScreenWithWhite - - ; display the next monster from CreditsMons - ld hl,wNumCreditsMonsDisplayed - ld c,[hl] ; how many monsters have we displayed so far? - inc [hl] - ld b,0 - ld hl,CreditsMons - add hl,bc ; go that far in the list of monsters and get the next one - ld a,[hl] - ld [wcf91],a - ld [wd0b5],a - coord hl, 8, 6 - call GetMonHeader - call LoadFrontSpriteByMonIndex - ld hl,vBGMap0 + $c + call GetNextCreditsMon + ld hl, vBGMap0 + 12 call CreditsCopyTileMapToVRAM xor a - ld [H_AUTOBGTRANSFERENABLED],a - call LoadScreenTilesFromBuffer1 - ld hl,vBGMap0 - call CreditsCopyTileMapToVRAM - ld a,$A7 - ld [rWX],a - ld hl,vBGMap1 + ld [H_AUTOBGTRANSFERENABLED], a + call LoadScreenTilesFromBuffer2DisableBGTransfer + ld hl, vBGMap0 call CreditsCopyTileMapToVRAM - call FillMiddleOfScreenWithWhite - ld a,%11111100 ; make the mon a black silhouette - ld [rBGP],a - -; scroll the mon left by one tile 7 times - ld bc,7 -.scrollLoop1 + ld a, %11111100 + ld [rBGP], a + call UpdateGBCPal_BGP + ld hl, rLCDC + res 3, [hl] + ld a, 1 + ld [H_AUTOBGTRANSFERENABLED], a + ld b, 0 + ld c, 10 call ScrollCreditsMonLeft - dec c - jr nz,.scrollLoop1 - -; scroll the mon left by one tile 20 times -; This time, we have to move the window left too in order to hide the text that -; is wrapping around to the right side of the screen. - ld c,20 -.scrollLoop2 + call FillLeftHalfOfScreenWithWhite + ld c, 10 call ScrollCreditsMonLeft - ld a,[rWX] - sub 8 - ld [rWX],a - dec c - jr nz,.scrollLoop2 - + call FillRightHalfOfScreenWithWhite + ld c, 8 + call ScrollCreditsMonLeft + ld a, %11000000 + ld [rBGP], a + call UpdateGBCPal_BGP xor a - ld [hWY],a - ld a,%11000000 - ld [rBGP],a + ld [hSCX], a ret -INCLUDE "data/credit_mons.asm" - ScrollCreditsMonLeft: - ld h, b - ld l, $20 - call ScrollCreditsMonLeft_SetSCX - ld h, $0 - ld l, $70 - call ScrollCreditsMonLeft_SetSCX +.asm_f0fff ld a, b - add $8 + ld [hSCX], a + add 8 ld b, a + call DelayFrame + dec c + jr nz, .asm_f0fff ret -ScrollCreditsMonLeft_SetSCX: - ld a, [rLY] - cp l - jr nz, ScrollCreditsMonLeft_SetSCX - ld a, h - ld [rSCX], a -.loop - ld a, [rLY] - cp h - jr z, .loop +GetNextCreditsMon: + ld hl, wNumCreditsMonsDisplayed + ld c, [hl] + inc [hl] + ld b, 0 + ld hl, CreditsMons + add hl, bc + ld a, [hl] + ld [wcf91], a + ld [wd0b5], a + coord hl, 8, 6 + call GetMonHeader + call LoadFrontSpriteByMonIndex ret -HoFGBPalettes: - db %11000000 - db %11010000 - db %11100000 - db %11110000 +INCLUDE "data/credit_mons.asm" CreditsCopyTileMapToVRAM: ld a, l - ld [H_AUTOBGTRANSFERDEST], a + ld [$ffbc], a ld a, h - ld [H_AUTOBGTRANSFERDEST + 1], a - ld a, 1 + ld [$ffbd], a + ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a jp Delay3 +CreditsLoadFont: + call LoadFontTilePatterns + ld hl, vChars1 + ld bc, $40 * $10 + call ZeroMemory + + call LoadTextBoxTilePatterns + ld hl, vChars2 + $60 * $10 + ld bc, $10 * $10 + call ZeroMemory + + ld hl, vChars2 + $7e * $10 + ld bc, $1 * $10 + ld a, $ff + call FillMemory + ret + ZeroMemory: -; zero bc bytes at hl +.asm_f1071 ld [hl], 0 inc hl inc hl dec bc ld a, b or c - jr nz, ZeroMemory + jr nz, .asm_f1071 ret FillFourRowsWithBlack: - ld bc, SCREEN_WIDTH * 4 + ld bc, 4 * SCREEN_WIDTH ld a, $7e jp FillMemory FillMiddleOfScreenWithWhite: coord hl, 0, 4 - ld bc, SCREEN_WIDTH * 10 + ld bc, 10 * SCREEN_WIDTH ld a, " " jp FillMemory -Credits: +FillLeftHalfOfScreenWithWhite: + coord hl, 0, 4 + push bc + call FillHalfOfScreenWithWhite + pop bc + ret + +FillRightHalfOfScreenWithWhite: + coord hl, 10, 4 + push bc + call FillHalfOfScreenWithWhite + pop bc + ret + +FillHalfOfScreenWithWhite: + ld b, 10 + ld c, 10 + ld a, " " +.asm_f10a6 + push bc + push hl +.asm_f10a8 + ld [hli], a + dec c + jr nz, .asm_f10a8 + pop hl + ld bc, SCREEN_WIDTH + add hl, bc + pop bc + dec b + jr nz, .asm_f10a6 + ret + +Credits: ; Roll credits ld de, CreditsOrder push de .nextCreditsScreen @@ -192,58 +233,48 @@ Credits: jr z, .showCopyrightText cp $fa jr z, .showTheEnd - push hl - push hl - ld hl, CreditsTextPointers - add a - ld c, a - ld b, 0 - add hl, bc - ld e, [hl] - inc hl - ld d, [hl] - ld a, [de] - inc de - ld c, a - ld b, $ff - pop hl - add hl, bc - call PlaceString - pop hl - ld bc, SCREEN_WIDTH * 2 - add hl, bc + call PlaceCreditsText pop de jr .nextCreditsCommand + +.showCopyrightText + callba LoadCopyrightTiles + pop de + jr .nextCreditsCommand + + .fadeInTextAndShowMon call FadeInCreditsText - ld c, 90 + ld c, 102 jr .next1 + .showTextAndShowMon - ld c, 110 + ld c, 122 .next1 call DelayFrames call DisplayCreditsMon jr .nextCreditsScreen + .fadeInText call FadeInCreditsText - ld c, 120 + ld c, 132 jr .next2 + .showText - ld c, 140 + ld c, 152 .next2 call DelayFrames jr .nextCreditsScreen -.showCopyrightText - push de - callba LoadCopyrightTiles - pop de - pop de - jr .nextCreditsCommand + .showTheEnd - ld c, 16 + call ShowTheEndGFX + pop de + ret + +ShowTheEndGFX: + ld c, 24 call DelayFrames call FillMiddleOfScreenWithWhite - pop de ld de, TheEndGfx ld hl, vChars2 + $600 lb bc, BANK(TheEndGfx), (TheEndGfxEnd - TheEndGfx) / $10 @@ -258,8 +289,31 @@ Credits: TheEndTextString: ; "T H E E N D" - db $60," ",$62," ",$64," ",$64," ",$66," ",$68,"@" - db $61," ",$63," ",$65," ",$65," ",$67," ",$69,"@" + db $60, " ", $62, " ", $64, " ", $64, " ", $66, " ", $68, "@" + db $61, " ", $63, " ", $65, " ", $65, " ", $67, " ", $69, "@" + +PlaceCreditsText: + push hl + push hl + ld hl, CreditsTextPointers + ld c, a + ld b, 0 + add hl, bc + add hl, bc + ld e, [hl] + inc hl + ld d, [hl] + pop hl + ld a, [de] + inc de + ld c, a + ld b, $ff + add hl, bc + call PlaceString + pop hl + ld bc, SCREEN_WIDTH * 2 + add hl, bc + ret INCLUDE "data/credits_order.asm" @@ -268,3 +322,4 @@ INCLUDE "text/credits_text.asm" TheEndGfx: INCBIN "gfx/theend.interleave.2bpp" TheEndGfxEnd: + diff --git a/engine/add_party_mon.asm b/engine/add_party_mon.asm new file mode 100644 index 00000000..1aa6bd16 --- /dev/null +++ b/engine/add_party_mon.asm @@ -0,0 +1,345 @@ +_AddPartyMon: +; Adds a new mon to the player's or enemy's party. +; [wMonDataLocation] is used in an unusual way in this function. +; If the lower nybble is 0, the mon is added to the player's party, else the enemy's. +; If the entire value is 0, then the player is allowed to name the mon. + ld de, wPartyCount + ld a, [wMonDataLocation] + and $f + jr z, .next + ld de, wEnemyPartyCount +.next + ld a, [de] + inc a + cp PARTY_LENGTH + 1 + ret nc ; return if the party is already full + ld [de], a + ld a, [de] + ld [hNewPartyLength], a + add e + ld e, a + jr nc, .noCarry + inc d +.noCarry + ld a, [wcf91] + ld [de], a ; write species of new mon in party list + inc de + ld a, $ff ; terminator + ld [de], a + ld hl, wPartyMonOT + ld a, [wMonDataLocation] + and $f + jr z, .next2 + ld hl, wEnemyMonOT +.next2 + ld a, [hNewPartyLength] + dec a + call SkipFixedLengthTextEntries + ld d, h + ld e, l + ld hl, wPlayerName + ld bc, NAME_LENGTH + call CopyData + ld a, [wMonDataLocation] + and a + jr nz, .skipNaming + ld hl, wPartyMonNicks + ld a, [hNewPartyLength] + dec a + call SkipFixedLengthTextEntries + ld a, NAME_MON_SCREEN + ld [wNamingScreenType], a + predef AskName +.skipNaming + ld hl, wPartyMons + ld a, [wMonDataLocation] + and $f + jr z, .next3 + ld hl, wEnemyMons +.next3 + ld a, [hNewPartyLength] + dec a + ld bc, wPartyMon2 - wPartyMon1 + call AddNTimes + ld e, l + ld d, h + push hl + ld a, [wcf91] + ld [wd0b5], a + call GetMonHeader + ld hl, wMonHeader + ld a, [hli] + ld [de], a ; species + inc de + pop hl + push hl + ld a, [wMonDataLocation] + and $f + ld a, $98 ; set enemy trainer mon IVs to fixed average values + ld b, $88 + jr nz, .next4 + +; If the mon is being added to the player's party, update the pokedex. + ld a, [wcf91] + ld [wd11e], a + push de + predef IndexToPokedex + pop de + ld a, [wd11e] + dec a + ld c, a + ld b, FLAG_TEST + ld hl, wPokedexOwned + call FlagAction + ld a, c ; whether the mon was already flagged as owned + ld [wUnusedD153], a ; not read + ld a, [wd11e] + dec a + ld c, a + ld b, FLAG_SET + push bc + call FlagAction + pop bc + ld hl, wPokedexSeen + call FlagAction + + pop hl + push hl + + ld a, [wIsInBattle] + and a ; is this a wild mon caught in battle? + jr nz, .copyEnemyMonData + +; Not wild. + call Random ; generate random IVs + ld b, a + call Random + +.next4 + push bc + ld bc, wPartyMon1DVs - wPartyMon1 + add hl, bc + pop bc + ld [hli], a + ld [hl], b ; write IVs + ld bc, (wPartyMon1HPExp - 1) - (wPartyMon1DVs + 1) + add hl, bc + ld a, 1 + ld c, a + xor a + ld b, a + call CalcStat ; calc HP stat (set cur Hp to max HP) + ld a, [H_MULTIPLICAND+1] + ld [de], a + inc de + ld a, [H_MULTIPLICAND+2] + ld [de], a + inc de + xor a + ld [de], a ; box level + inc de + ld [de], a ; status ailments + inc de + jr .copyMonTypesAndMoves +.copyEnemyMonData + ld bc, wEnemyMon1DVs - wEnemyMon1 + add hl, bc + ld a, [wEnemyMonDVs] ; copy IVs from cur enemy mon + ld [hli], a + ld a, [wEnemyMonDVs + 1] + ld [hl], a + ld a, [wEnemyMonHP] ; copy HP from cur enemy mon + ld [de], a + inc de + ld a, [wEnemyMonHP+1] + ld [de], a + inc de + xor a + ld [de], a ; box level + inc de + ld a, [wEnemyMonStatus] ; copy status ailments from cur enemy mon + ld [de], a + inc de +.copyMonTypesAndMoves + ld hl, wMonHTypes + ld a, [hli] ; type 1 + ld [de], a + inc de + ld a, [hli] ; type 2 + ld [de], a + inc de + ld a, [hli] ; catch rate (held item in gen 2) + ld [de], a + ld a, [wcf91] + cp KADABRA + jr nz, .skipGivingTwistedSpoon + ld a, $60 ; twistedspoon in gen 2 + ld [de], a +.skipGivingTwistedSpoon + ld hl, wMonHMoves + ld a, [hli] + inc de + push de + ld [de], a + ld a, [hli] + inc de + ld [de], a + ld a, [hli] + inc de + ld [de], a + ld a, [hli] + inc de + ld [de], a + push de + dec de + dec de + dec de + xor a + ld [wLearningMovesFromDayCare], a + predef WriteMonMoves + pop de + ld a, [wPlayerID] ; set trainer ID to player ID + inc de + ld [de], a + ld a, [wPlayerID + 1] + inc de + ld [de], a + push de + ld a, [wCurEnemyLVL] + ld d, a + callab CalcExperience + pop de + inc de + ld a, [hExperience] ; write experience + ld [de], a + inc de + ld a, [hExperience + 1] + ld [de], a + inc de + ld a, [hExperience + 2] + ld [de], a + xor a + ld b, NUM_STATS * 2 +.writeEVsLoop ; set all EVs to 0 + inc de + ld [de], a + dec b + jr nz, .writeEVsLoop + inc de + inc de + pop hl + call AddPartyMon_WriteMovePP + inc de + ld a, [wCurEnemyLVL] + ld [de], a + inc de + ld a, [wIsInBattle] + dec a + jr nz, .calcFreshStats + ld hl, wEnemyMonMaxHP + ld bc, $a + call CopyData ; copy stats of cur enemy mon + pop hl + jr .done +.calcFreshStats + pop hl + ld bc, wPartyMon1HPExp - 1 - wPartyMon1 + add hl, bc + ld b, $0 + call CalcStats ; calculate fresh set of stats +.done + scf + ret + +LoadMovePPs: + call GetPredefRegisters + ; fallthrough +AddPartyMon_WriteMovePP: + ld b, NUM_MOVES +.pploop + ld a, [hli] ; read move ID + and a + jr z, .empty + dec a + push hl + push de + push bc + ld hl, Moves + ld bc, MoveEnd - Moves + call AddNTimes + ld de, wcd6d + ld a, BANK(Moves) + call FarCopyData + pop bc + pop de + pop hl + ld a, [wcd6d + 5] ; PP is byte 5 of move data +.empty + inc de + ld [de], a + dec b + jr nz, .pploop ; there are still moves to read + ret + +; adds enemy mon [wcf91] (at position [wWhichPokemon] in enemy list) to own party +; used in the cable club trade center +_AddEnemyMonToPlayerParty: + ld hl, wPartyCount + ld a, [hl] + cp PARTY_LENGTH + scf + ret z ; party full, return failure + inc a + ld [hl], a ; add 1 to party members + ld c, a + ld b, $0 + add hl, bc + ld a, [wcf91] + ld [hli], a ; add mon as last list entry + ld [hl], $ff ; write new sentinel + ld hl, wPartyMons + ld a, [wPartyCount] + dec a + ld bc, wPartyMon2 - wPartyMon1 + call AddNTimes + ld e, l + ld d, h + ld hl, wLoadedMon + call CopyData ; write new mon's data (from wLoadedMon) + ld hl, wPartyMonOT + ld a, [wPartyCount] + dec a + call SkipFixedLengthTextEntries + ld d, h + ld e, l + ld hl, wEnemyMonOT + ld a, [wWhichPokemon] + call SkipFixedLengthTextEntries + ld bc, NAME_LENGTH + call CopyData ; write new mon's OT name (from an enemy mon) + ld hl, wPartyMonNicks + ld a, [wPartyCount] + dec a + call SkipFixedLengthTextEntries + ld d, h + ld e, l + ld hl, wEnemyMonNicks + ld a, [wWhichPokemon] + call SkipFixedLengthTextEntries + ld bc, NAME_LENGTH + call CopyData ; write new mon's nickname (from an enemy mon) + ld a, [wcf91] + ld [wd11e], a + predef IndexToPokedex + ld a, [wd11e] + dec a + ld c, a + ld b, FLAG_SET + ld hl, wPokedexOwned + push bc + call FlagAction ; add to owned pokemon + pop bc + ld hl, wPokedexSeen + call FlagAction ; add to seen pokemon + and a + ret ; return success diff --git a/engine/animated_objects_3e.asm b/engine/animated_objects_3e.asm new file mode 100755 index 00000000..63a94350 --- /dev/null +++ b/engine/animated_objects_3e.asm @@ -0,0 +1,394 @@ +ClearObjectAnimationBuffers: + ld hl, wAnimatedObjectsData + ld bc, wAnimatedObjectsDataEnd - wAnimatedObjectsData + xor a + call FillMemory + ret + +RunObjectAnimations: + ld hl, wAnimatedObjectDataStructs + ld e, 10 +.loop + ld a, [hl] + and a + jr z, .next + ld c, l + ld b, h + push hl + push de + call ExecuteCurrentAnimatedObjectCallback + call UpdateCurrentAnimatedObjectFrame + pop de + pop hl + jr c, .quit +.next + ld bc, $10 + add hl, bc + dec e + jr nz, .loop + ld a, [wCurrentAnimatedObjectOAMBufferOffset] + ld l, a + ld h, wOAMBuffer / $100 +.deinit_unused_oam_loop + ld a, l + cp wOAMBufferEnd % $100 + jr nc, .quit + xor a + ld [hli], a + jr .deinit_unused_oam_loop + +.quit + ret + +SpawnAnimatedObject: + push de + push af + ld hl, wAnimatedObjectDataStructs + ld e, 10 +.loop + ld a, [hl] + and a + jr z, .init + ld bc, $10 + add hl, bc + dec e + jr nz, .loop + pop af + pop de + scf + ret + +.init + pop af + ld c, l + ld b, h + ld hl, wNumLoadedAnimatedObjects + inc [hl] + ld e, a + ld d, $0 + ld a, [wAnimatedObjectSpawnStateDataPointer] + ld l, a + ld a, [wAnimatedObjectSpawnStateDataPointer + 1] + ld h, a + add hl, de + add hl, de + add hl, de + ld e, l + ld d, h + ld hl, $0 + add hl, bc + ld a, [wNumLoadedAnimatedObjects] + ld [hli], a + ld a, [de] + ld [hli], a + inc de + ld a, [de] + ld [hli], a + inc de + xor a + ld [hli], a + pop de + ld hl, $4 + add hl, bc + ld a, e + ld [hli], a + ld a, d + ld [hli], a + xor a + ld [hli], a + ld [hli], a + xor a + ld [hli], a + ld [hli], a + dec a + ld [hli], a + xor a + ld [hli], a + ld [hli], a + ld [hli], a + ld [hli], a + ld [hl], a + ret + +MaskCurrentAnimatedObjectStruct: + ld hl, $0 + add hl, bc + ld [hl], $0 + ret + +MaskAllAnimatedObjectStructs: + ld hl, wAnimatedObjectDataStructs + ld e, 10 +.loop + ld [hl], $0 + ld bc, $10 + add hl, bc + dec e + jr nz, .loop + ret + +UpdateCurrentAnimatedObjectFrame: + xor a + ld [wCurAnimatedObjectOAMAttributes], a + ld hl, $3 + add hl, bc + ld a, [hli] + ld [wCurrentAnimatedObjectVTileOffset], a + ld a, [hli] + ld [wCurrentAnimatedObjectXCoord], a + ld a, [hli] + ld [wCurrentAnimatedObjectYCoord], a + ld a, [hli] + ld [wCurrentAnimatedObjectXOffset], a + ld a, [hl] + ld [wCurrentAnimatedObjectYOffset], a + call UpdateDurationTimerAndFrameStateForCurrentAnimatedObject + cp $fd + jr z, .finish + cp $fc + jr z, .delete_animation + call GetCurrentAnimatedObjectOAMDataPointer + ld a, [wCurrentAnimatedObjectVTileOffset] + add [hl] + ld [wCurrentAnimatedObjectVTileOffset], a + inc hl + ld a, [hli] + ld h, [hl] + ld l, a + push bc + ld a, [wCurrentAnimatedObjectOAMBufferOffset] + ld e, a + ld d, wOAMBuffer / $100 + ld a, [hli] + ld c, a +.loop + ld a, [wCurrentAnimatedObjectYCoord] + ld b, a + ld a, [wCurrentAnimatedObjectYOffset] + add b + ld b, a + ld a, [wAnimatedObjectGlobalYOffset] + add b + ld b, a + call GetCurrentAnimatedObjectTileYCoordinate + add b + ld [de], a + inc hl + inc de + ld a, [wCurrentAnimatedObjectXCoord] + ld b, a + ld a, [wCurrentAnimatedObjectXOffset] + add b + ld b, a + ld a, [wAnimatedObjectGlobalXOffset] + add b + ld b, a + call GetCurrentAnimatedObjectTileXCoordinate + add b + ld [de], a + inc hl + inc de + ld a, [wCurrentAnimatedObjectVTileOffset] + add [hl] + ld [de], a + inc hl + inc de + call SetCurrentAnimatedObjectOAMAttributes + ld b, a + ld a, [wc634] + cp $7 + ld a, b + jr z, .skip_load + ld [de], a +.skip_load + inc hl + inc de + ld a, e + ld [wCurrentAnimatedObjectOAMBufferOffset], a + cp wOAMBufferEnd % $100 + jr nc, .oam_is_full + dec c + jr nz, .loop + pop bc + jr .finish + +.delete_animation + call MaskCurrentAnimatedObjectStruct +.finish + and a + ret + +.oam_is_full + pop bc + scf + ret + +GetCurrentAnimatedObjectTileYCoordinate: + push hl + ld a, [hl] + ld hl, wCurAnimatedObjectOAMAttributes + bit 6, [hl] + jr z, .no_flip + add $8 + xor $ff + inc a +.no_flip + pop hl + ret + +GetCurrentAnimatedObjectTileXCoordinate: + push hl + ld a, [hl] + ld hl, wCurAnimatedObjectOAMAttributes + bit 5, [hl] + jr z, .no_flip + add $8 + xor $ff + inc a +.no_flip + pop hl + ret + +SetCurrentAnimatedObjectOAMAttributes: + ld a, [wCurAnimatedObjectOAMAttributes] + ld b, a + ld a, [hl] + xor b + and $e0 + ld b, a + ld a, [hl] + and $10 + or b + bit 4, a + ret z + or $4 + ret + +GetCurrentAnimatedObjectOAMDataPointer: + ld e, a + ld d, $0 + ld a, [wAnimatedObjectOAMDataPointer] + ld l, a + ld a, [wAnimatedObjectOAMDataPointer + 1] + ld h, a + add hl, de + add hl, de + add hl, de + ret + +SetCurrentAnimatedObjectCallbackAndResetFrameStateRegisters: + ld hl, $1 + add hl, bc + ld [hl], a + ld hl, $8 + add hl, bc + ld [hl], $0 + ld hl, $9 + add hl, bc + ld [hl], $0 + ld hl, $a + add hl, bc + ld [hl], $ff + ret + +UpdateDurationTimerAndFrameStateForCurrentAnimatedObject: +.loop + ld hl, $8 + add hl, bc + ld a, [hl] + and a + jr z, .next_frame + dec [hl] + call GetPointerToCurrentAnimatedObjectFrameScript + ld a, [hli] + push af + jr .finish + +.next_frame + ld hl, $a + add hl, bc + inc [hl] + call GetPointerToCurrentAnimatedObjectFrameScript + ld a, [hli] + cp $fe + jr z, .restart_anim + cp $ff + jr z, .hold_last_frame_state + push af + ld a, [hl] + push hl + and $3f + ld hl, $9 + add hl, bc + add [hl] + ld hl, $8 + add hl, bc + ld [hl], a + pop hl +.finish + ld a, [hl] + and $c0 + srl a + ld [wCurAnimatedObjectOAMAttributes], a + pop af + ret + +.hold_last_frame_state + xor a + ld hl, $8 + add hl, bc + ld [hl], a + ld hl, $a + add hl, bc + dec [hl] + dec [hl] + jr .loop + +.restart_anim + xor a + ld hl, $8 + add hl, bc + ld [hl], a + dec a + ld hl, $a + add hl, bc + ld [hl], a + jr .loop + +GetPointerToCurrentAnimatedObjectFrameScript: + ld hl, $1 + add hl, bc + ld e, [hl] + ld d, $0 + ld a, [wAnimatedObjectFramesDataPointer] + ld l, a + ld a, [wAnimatedObjectFramesDataPointer + 1] + ld h, a + add hl, de + add hl, de + ld e, [hl] + inc hl + ld d, [hl] + ld hl, $a + add hl, bc + ld l, [hl] + ld h, $0 + add hl, hl + add hl, de + ret + +ExecuteCurrentAnimatedObjectCallback: + ld hl, $2 + add hl, bc + ld e, [hl] + ld d, $0 + ld a, [wAnimatedObjectJumptablePointer] + ld l, a + ld a, [wAnimatedObjectJumptablePointer + 1] + ld h, a + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] diff --git a/engine/bank30.bin b/engine/bank30.bin Binary files differnew file mode 100644 index 00000000..6309c149 --- /dev/null +++ b/engine/bank30.bin diff --git a/engine/bank3c.asm b/engine/bank3c.asm new file mode 100644 index 00000000..7ae059e7 --- /dev/null +++ b/engine/bank3c.asm @@ -0,0 +1,235 @@ +INCLUDE "engine/pikachu_pcm.asm" +INCLUDE "engine/overworld/advance_player_sprite.asm" + +ResetStatusAndHalveMoneyOnBlackout: +; Reset player status on blackout. + xor a + ld [wd435], a + xor a ; gamefreak copypasting functions (double xor a) + ld [wBattleResult], a + ld [wWalkBikeSurfState], a + ld [wIsInBattle], a + ld [wMapPalOffset], a + ld [wNPCMovementScriptFunctionNum], a + ld [hJoyHeld], a + ld [wNPCMovementScriptPointerTableNum], a + ld [wFlags_0xcd60], a + + ld [hMoney], a + ld [hMoney + 1], a + ld [hMoney + 2], a + call HasEnoughMoney + jr c, .lostmoney ; never happens + + ; Halve the player's money. + ld a, [wPlayerMoney] + ld [hMoney], a + ld a, [wPlayerMoney + 1] + ld [hMoney + 1], a + ld a, [wPlayerMoney + 2] + ld [hMoney + 2], a + xor a + ld [hDivideBCDDivisor], a + ld [hDivideBCDDivisor + 1], a + ld a, 2 + ld [hDivideBCDDivisor + 2], a + predef DivideBCDPredef3 + ld a, [hDivideBCDQuotient] + ld [wPlayerMoney], a + ld a, [hDivideBCDQuotient + 1] + ld [wPlayerMoney + 1], a + ld a, [hDivideBCDQuotient + 2] + ld [wPlayerMoney + 2], a + +.lostmoney + ld hl, wd732 + set 2, [hl] + res 3, [hl] + set 6, [hl] + ld a, %11111111 + ld [wJoyIgnore], a + predef_jump HealParty + +SetMapSpecificScriptFlagsOnMapReload: + ld a, [wCurMap] + cp VERMILION_GYM ; ??? new thing about verm gym? + jr z, .verm_gym + ld c, a + ld hl, .MapList +.search_loop + ld a, [hli] + cp c + jr z, .in_list + cp a, $ff + jr nz, .search_loop + ret + +.verm_gym + ld hl, wCurrentMapScriptFlags + set 6, [hl] + ret + +.in_list + ld hl, wCurrentMapScriptFlags + set 5, [hl] + ret + +.MapList ; f02fa (3c:42fa) + db SILPH_CO_2F + db SILPH_CO_3F + db SILPH_CO_4F + db SILPH_CO_5F + db SILPH_CO_6F + db SILPH_CO_7F + db SILPH_CO_8F + db SILPH_CO_9F + db SILPH_CO_10F + db SILPH_CO_11F + db MANSION_2 + db MANSION_3 + db MANSION_4 + db MANSION_1 + db CINNABAR_GYM + db GAME_CORNER + db ROCKET_HIDEOUT_1 + db ROCKET_HIDEOUT_4 + db VICTORY_ROAD_3 + db VICTORY_ROAD_1 + db VICTORY_ROAD_2 + db LANCES_ROOM + db LORELEIS_ROOM + db BRUNOS_ROOM + db AGATHAS_ROOM + db $ff + +BeachHouse_GFX: + INCBIN "gfx/tilesets/beachhouse.2bpp" + +BeachHouse_Block: + INCBIN "gfx/blocksets/beachhouse.bst" + +Func_f0a54: + ret + +LoadUnusedBluesHouseMissableObjectData: +; referenced in an unused function + ld hl, .MissableObjectsMaps +.loop + ld a, [hli] + cp a, $ff + ret z + ld b, a + ld a, [wCurMap] + cp b + jr z, .found + inc hl + inc hl + inc hl + jr .loop + +.found + ld a, [hli] + ld c, a + ld b, 0 + ld a, [hli] + ld h, [hl] + ld l, a + ld de, wMissableObjectList + call CopyData + ret + +.MissableObjectsMaps: + dbbw BLUES_HOUSE, .End - .Start, .Start + db $ff + +.Start: + db 1, HS_DAISY_SITTING_COPY + db 2, HS_DAISY_WALKING_COPY + db 3, HS_TOWN_MAP_COPY + db $ff +.End: + +TryApplyPikachuMovementData: ; f0a82 + ld a, [wd472] + bit 7, a + ret z + ld a, [wWalkBikeSurfState] + and a + ret nz + push hl + push bc + callab GetPikachuFacingDirectionAndReturnToE + pop bc + pop hl + ld a, b + cp e + ret nz + push hl + ld a, [wUpdateSpritesEnabled] + push af + ld a, $ff + ld [wUpdateSpritesEnabled], a + callab LoadPikachuShadowIntoVRAM + pop af + ld [wUpdateSpritesEnabled], a + pop hl + call ApplyPikachuMovementData + callab RefreshPikachuFollow + ret + +Pic_f0abf: +INCBIN "gfx/pikachu/unknown_f0abf.pic" +GFX_f0b64: +INCBIN "gfx/pikachu/unknown_f0b64.2bpp" +Pic_f0cf4: +INCBIN "gfx/pikachu/unknown_f0cf4.pic" +GFX_f0d82: +INCBIN "gfx/pikachu/unknown_f0d82.2bpp" + +PokecenterChanseyText: + ld hl, NurseChanseyText + call PrintText + ld a, CHANSEY + call PlayCry + call WaitForSoundToFinish + ret + +NurseChanseyText: + TX_FAR _NurseChanseyText + db "@" + +INCLUDE "engine/HoF_room_pc.asm" +INCLUDE "scripts/viridiancity2.asm" +INCLUDE "scripts/vermilioncity2.asm" +INCLUDE "scripts/celadoncity2.asm" +INCLUDE "scripts/route1_2.asm" +INCLUDE "scripts/route22_2.asm" +INCLUDE "scripts/redshouse1f2.asm" +INCLUDE "scripts/oakslab2.asm" +INCLUDE "scripts/school2.asm" +INCLUDE "scripts/museum1f2.asm" +INCLUDE "scripts/pewterpokecenter2.asm" +INCLUDE "scripts/pokemontower2_2.asm" +INCLUDE "scripts/celadonmart3_2.asm" +INCLUDE "scripts/celadonmansion1_2.asm" +INCLUDE "scripts/celadonmansion3_2.asm" +INCLUDE "scripts/celadongamecorner2.asm" +INCLUDE "scripts/celadondiner2.asm" +INCLUDE "scripts/safarizoneentrance2.asm" +INCLUDE "scripts/cinnabargym3.asm" +INCLUDE "scripts/mtmoonpokecenter2.asm" + +INCLUDE "data/mapHeaders/beach_house.asm" +INCLUDE "scripts/beach_house.asm" +BeachHouseBlockdata: +INCBIN "maps/beach_house.blk" +INCLUDE "data/mapObjects/beach_house.asm" + +INCLUDE "scripts/beach_house2.asm" +INCLUDE "scripts/billshouse2.asm" +INCLUDE "scripts/viridianforest2.asm" +INCLUDE "scripts/ssanne9_2.asm" +INCLUDE "scripts/silphco11_2.asm" + +INCLUDE "engine/overworld/hidden_objects.asm" +INCLUDE "engine/vermilion_gym_trash_cans.asm" diff --git a/engine/bank3d.asm b/engine/bank3d.asm new file mode 100644 index 00000000..6efff351 --- /dev/null +++ b/engine/bank3d.asm @@ -0,0 +1,697 @@ +INCLUDE "engine/battle/common_text.asm" +INCLUDE "engine/battle/link_battle_versus_text.asm" +INCLUDE "engine/battle/unused_stats_functions.asm" +INCLUDE "engine/battle/scroll_draw_trainer_pic.asm" + +StarterPikachuBattleEntranceAnimation: + coord hl, 0, 5 + ld c, 0 +.loop1 + inc c + ld a, c + cp 9 + ret z + ld d, 7 * 13 + push bc + push hl +.loop2 + call .PlaceColumn + dec hl + ld a, d + sub 7 + ld d, a + dec c + jr nz, .loop2 + ld c, 2 + call DelayFrames + pop hl + pop bc + inc hl + jr .loop1 + +.PlaceColumn: + push hl + push de + push bc + ld e, 7 +.loop3 + ld a, d + cp 7 * 7 + jr nc, .okay + ld a, $7f +.okay + ld [hl], a + ld bc, SCREEN_WIDTH + add hl, bc + inc d + dec e + jr nz, .loop3 + pop bc + pop de + pop hl + ret + +INCLUDE "engine/battle/decrement_pp.asm" + +ModifyPikachuHappiness:: + ld a, d + cp PIKAHAPPY_GYMLEADER + jr z, .checkanywhereinparty + cp PIKAHAPPY_WALKING + jr z, .checkanywhereinparty + push de + callab IsThisPartymonStarterPikachu_Party + pop de + ret nc + jr .proceed + +.checkanywhereinparty + push de + callab IsStarterPikachuInOurParty + pop de + ret nc + +.proceed + push de + ; Divide [wPikachuHappiness] by 100. Hold the integer part in e. + ld e, $0 + ld a, [wPikachuHappiness] + cp 100 + jr c, .wPikachuHappiness_div_100 + inc e + cp 200 + jr c, .wPikachuHappiness_div_100 + inc e +.wPikachuHappiness_div_100 + ; Get the (d, e) entry from HappinessChangeTable. + ld c, d + dec c + ld b, $0 + ld hl, HappinessChangeTable + add hl, bc + add hl, bc + add hl, bc + ld d, $0 + add hl, de + ld a, [hl] + ; If [hl] is positive, take min(0xff, [hl] + [wPikachuHappiness]). + ; If [hl] is negative, take max(0x00, [hl] + [wPikachuHappiness]). + ; Inexplicably, we're using 100 as the threshold for comparison. + cp 100 + ld a, [wPikachuHappiness] + jr nc, .negative + add [hl] + jr nc, .okay + ld a, -1 + jr .okay + +.negative + add [hl] + jr c, .okay + xor a +.okay + ld [wPikachuHappiness], a + + ; Restore d and get the d'th entry in PikachuMoods. + pop de + dec d + ld hl, PikachuMoods + ld e, d + ld d, $0 + add hl, de + ld a, [hl] + ld b, a + ; Modify Pikachu's mood + cp $80 + jr z, .done + ld a, [wPikachuMood] + jr c, .decreased + cp b + jr nc, .done + ld a, [wd49c] + and a + jr nz, .done + jr .update_mood + +.decreased + cp b + jr c, .done +.update_mood + ld a, b + ld [wPikachuMood], a +.done + ret + +HappinessChangeTable: + ; Increase + db 5, 3, 2 ; Gained a level + db 5, 3, 2 ; HP restore + db 1, 1, 0 ; Used X item + db 3, 2, 1 ; Challenged Gym Leader + db 1, 1, 0 ; Teach TM/HM + db 2, 1, 1 ; Walking around + ; Decrease + db -3, -3, -5 ; Deposited + db -1, -1, -1 ; Fainted in battle + db -5, -5, -10 ; Fainted due to Poison outside of battle + db -5, -5, -10 ; Unknown (d = 10) + db -10, -10, -20 ; Unknown (d = 11) + +PikachuMoods: + ; Increase + db $8a ; Gained a level + db $83 ; HP restore + db $80 ; Teach TM/HM + db $80 ; Challenged Gym Leader + db $94 ; Unknown (d = 5) + db $80 ; Unknown (d = 6) + ; Decrease + db $62 ; Deposited + db $6c ; Fainted + db $62 ; Unknown (d = 9) + db $6c ; Unknown (d = 10) + db $00 ; Unknown (d = 11) + +RedPicBack: INCBIN "pic/trainer/redb.pic" +OldManPic: INCBIN "pic/trainer/oldman.pic" +ProfOakPicBack: INCBIN "pic/ytrainer/prof.oakb.pic" + +LoadYellowTitleScreenGFX: + ld hl, PokemonLogoGraphics + ld de, vChars2 + ld bc, 115 * $10 + ld a, BANK(PokemonLogoGraphics) ; redundant because this function is in bank3d + call FarCopyData + ld hl, YellowLogoGraphics + 35 * $10 + ld de, vChars0 + 253 * $10 + ld bc, 3 * $10 + ld a, BANK(YellowLogoGraphics) + call FarCopyData + ld hl, YellowLogoGraphics + 38 * $10 + ld de, vChars1 + ld bc, 64 * $10 + ld a, BANK(YellowLogoGraphics) + call FarCopyData + ld hl, YellowLogoGraphics + 102 * $10 + ld de, vChars0 + 240 * $10 + ld bc, 12 * $10 + ld a, BANK(YellowLogoGraphics) + call FarCopyData + ret + +TitleScreen_PlacePokemonLogo: + coord hl, 2, 1 + ld de, TitleScreenPokemonLogoTilemap + lb bc, 7, 16 + call Bank3D_CopyBox + ret + +TitleScreen_PlacePikaSpeechBubble: + coord hl, 6, 4 + ld de, TitleScreenPikaBubbleTilemap + lb bc, 4, 7 + call Bank3D_CopyBox + coord hl, 9, 8 + ld [hl], $64 + inc hl + ld [hl], $65 + ret + +TitleScreen_PlacePikachu: + coord hl, 4, 8 + ld de, TitleScreenPikachuTilemap + lb bc, 9, 12 + call Bank3D_CopyBox + coord hl, 16, 10 + ld [hl], $96 + coord hl, 16, 11 + ld [hl], $9d + coord hl, 16, 12 + ld [hl], $a7 + coord hl, 16, 13 + ld [hl], $b1 + ld hl, TitleScreenPikachuEyesOAMData + ld de, wOAMBuffer + ld bc, $20 + call CopyData + ret + +TitleScreenPikachuEyesOAMData: + db $60, $40, $f1, $22 + db $60, $48, $f0, $22 + db $68, $40, $f3, $22 + db $68, $48, $f2, $22 + db $60, $60, $f0, $02 + db $60, $68, $f1, $02 + db $68, $60, $f2, $02 + db $68, $68, $f3, $02 + +Bank3D_CopyBox: +; copy cxb (xy) screen area from de to hl +.row + push bc + push hl +.col + ld a, [de] + inc de + ld [hli], a + dec c + jr nz, .col + pop hl + ld bc, SCREEN_WIDTH + add hl, bc + pop bc + dec b + jr nz, .row + ret + +TitleScreenPokemonLogoTilemap: +; 16x7 (xy) + db $f4, $f4, $f4, $f4, $f4, $f4, $49, $f4, $72, $30, $f4, $f4, $f4, $f4, $f4, $f4 + db $fd, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $f4, $0d, $0e, $0f + db $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $1a, $1b, $1c, $1d, $1e, $1f + db $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $2a, $2b, $2c, $2d, $2e, $2f + db $f4, $31, $32, $33, $34, $35, $36, $37, $38, $39, $3a, $3b, $3c, $3d, $3e, $3f + db $f4, $41, $42, $43, $44, $45, $46, $47, $48, $f4, $4a, $4b, $4c, $4d, $4e, $4f + db $f4, $6a, $6b, $6c, $6d, $f4, $f4, $f4, $f4, $f4, $f4, $6e, $6f, $70, $71, $f4 + +Pointer_f4669: +; Unreferenced + db $47, $48, $49, $4a, $4b, $4c, $4d, $4e, $4f, $5f + +TitleScreenPikaBubbleTilemap: +; 7x4 (xy) + db $24, $25, $66, $67, $68, $69, $2a + db $50, $51, $52, $53, $54, $55, $56 + db $57, $58, $59, $5a, $5b, $5c, $5d + db $6d, $5e, $5f, $60, $61, $62, $63 + +TitleScreenPikachuTilemap: +; 12x9 (xy) + db $80, $81, $82, $83, $00, $00, $00, $00, $84, $85, $86, $87 + db $88, $89, $8a, $8b, $8c, $8d, $8d, $8e, $8f, $8a, $90, $91 + db $00, $92, $93, $8a, $8a, $8a, $8a, $8a, $8a, $94, $95, $00 + db $00, $00, $97, $8a, $8a, $98, $99, $8a, $8a, $9a, $9b, $9c + db $00, $00, $9e, $9f, $a0, $a1, $a2, $a3, $a4, $a5, $a6, $8a + db $00, $a8, $a9, $aa, $8a, $ab, $ac, $8a, $ad, $ae, $af, $b0 + db $00, $b2, $b3, $b4, $8a, $8a, $8a, $8a, $b5, $b6, $b7, $b8 + db $00, $b9, $ba, $8a, $8a, $8a, $8a, $8a, $8a, $bb, $bc, $00 + db $00, $00, $bd, $8a, $8a, $8a, $8a, $8a, $8a, $be, $bf, $00 + +; f46f9 (3d:46f9) +PokemonLogoGraphics: INCBIN "gfx/pokemon_logo.2bpp" +PokemonLogoGraphicsEnd: +YellowLogoGraphics: INCBIN "gfx/yellow_titlescreen.2bpp" +YellowLogoGraphicsEnd: + +INCLUDE "engine/menu/link_menu.asm" + +HandleMenuInputDouble: + xor a + ld [wPartyMenuAnimMonEnabled], a + +HandleMenuInputPokemonSelectionDouble: + ld a, [H_DOWNARROWBLINKCNT1] + push af + ld a, [H_DOWNARROWBLINKCNT2] + push af ; save existing values on stack + xor a + ld [H_DOWNARROWBLINKCNT1], a ; blinking down arrow timing value 1 + ld a, $06 + ld [H_DOWNARROWBLINKCNT2], a ; blinking down arrow timing value 2 +.loop1 + xor a + ld [wAnimCounter], a ; counter for pokemon shaking animation + call .UpdateCursorTile + call JoypadLowSensitivity + ld a, [hJoy5] + and a ; was a key pressed? + jr nz, .keyPressed + pop af + ld [H_DOWNARROWBLINKCNT2], a + pop af + ld [H_DOWNARROWBLINKCNT1], a ; restore previous values + xor a + ld [wMenuWrappingEnabled], a ; disable menu wrapping + ret +.keyPressed + xor a + ld [wCheckFor180DegreeTurn], a + ld a, [hJoy5] + ld b, a + bit 6, a ; pressed Up key? + jr z, .checkIfDownPressed +.upPressed + ld a, [wCurrentMenuItem] ; selected menu item + and a ; already at the top of the menu? + jr z, .checkOtherKeys +.notAtTop + dec a + ld [wCurrentMenuItem], a ; move selected menu item up one space + jr .checkOtherKeys +.checkIfDownPressed + bit 7, a + jr z, .checkOtherKeys +.downPressed + ld a, [wCurrentMenuItem] + inc a + ld c, a + ld a, [wMaxMenuItem] + cp c + jr c, .checkOtherKeys + ld a, c + ld [wCurrentMenuItem], a +.checkOtherKeys + ld a, [wMenuWatchedKeys] + and b ; does the menu care about any of the pressed keys? + jp z, .loop1 +.checkIfAButtonOrBButtonPressed + ld a, [hJoy5] + and A_BUTTON | B_BUTTON + jr z, .skipPlayingSound +.AButtonOrBButtonPressed + ld a, SFX_PRESS_AB + call PlaySound ; play sound +.skipPlayingSound + pop af + ld [H_DOWNARROWBLINKCNT2], a + pop af + ld [H_DOWNARROWBLINKCNT1], a ; restore previous values + ld a, [hJoy5] + ret + +.UpdateCursorTile: + ld a, [wTopMenuItemY] + and a + jr z, .asm_f5ac0 + coord hl, 0, 0 + ld bc, SCREEN_WIDTH +.loop + add hl, bc + dec a + jr nz, .loop +.asm_f5ac0 + ld a, [wTopMenuItemX] + ld b, $0 + ld c, a + add hl, bc + push hl + ld a, [wLastMenuItem] + and a + jr z, .asm_f5ad5 + ld bc, $28 +.loop2 + add hl, bc + dec a + jr nz, .loop2 +.asm_f5ad5 + ld a, [hl] + cp "▶" + jr nz, .asm_f5ade + ld a, [wTileBehindCursor] + ld [hl], a +.asm_f5ade + pop hl + ld a, [wCurrentMenuItem] + and a + jr z, .asm_f5aec + ld bc, $28 +.loop3 + add hl, bc + dec a + jr nz, .loop3 +.asm_f5aec + ld a, [hl] + cp "▶" + jr z, .asm_f5af4 + ld [wTileBehindCursor], a +.asm_f5af4 + ld a, "▶" + ld [hl], a + ld a, l + ld [wMenuCursorLocation], a + ld a, h + ld [wMenuCursorLocation + 1], a + ld a, [wCurrentMenuItem] + ld [wLastMenuItem], a + ret + +PrintStrengthTxt: + ld hl, wd728 + set 0, [hl] + ld hl, Text_f5b17 + call PrintText + ld hl, Text_f5b28 + jp PrintText + +Text_f5b17: + TX_FAR _UsedStrengthText ; 2d:417e + TX_ASM + ld a, [wcf91] + call PlayCry + call Delay3 + jp TextScriptEnd + +Text_f5b28: + TX_FAR _CanMoveBouldersText ; 2d:4193 + db "@" + +IsSurfingAllowed: +; Returns whether surfing is allowed in bit 1 of wd728. +; Surfing isn't allowed on the Cycling Road or in the lowest level of the +; Seafoam Islands before the current has been slowed with boulders. + ld hl, wd728 + set 1, [hl] + ld a, [wd732] + bit 5, a + jr nz, .forcedToRideBike + ld a, [wCurMap] + cp SEAFOAM_ISLANDS_5 + ret nz + CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE + ret z + ld hl, CoordsData_f5b64 + call ArePlayerCoordsInArray + ret nc + ld hl, wd728 + res 1, [hl] + ld hl, CurrentTooFastText + jp PrintText +.forcedToRideBike + ld hl, wd728 + res 1, [hl] + ld hl, CyclingIsFunText + jp PrintText + +CoordsData_f5b64: + db 11, 07 + db $ff + +CurrentTooFastText: + TX_FAR _CurrentTooFastText ; 2d:41ab + db "@" + +CyclingIsFunText: + TX_FAR _CyclingIsFunText ; 2d:41ca + db "@" + +AddItemToInventory_: + ld a, [wItemQuantity] ; a = item quantity + push af + push bc + push de + push hl + push hl + ld d, PC_ITEM_CAPACITY ; how many items the PC can hold + ld a, wNumBagItems & $FF + cp l + jr nz, .checkIfInventoryFull + ld a, wNumBagItems >> 8 + cp h + jr nz, .checkIfInventoryFull +; if the destination is the bag + ld d, BAG_ITEM_CAPACITY ; how many items the bag can hold +.checkIfInventoryFull + ld a, [hl] + sub d + ld d, a + ld a, [hli] + and a + jr z, .addNewItem +.notAtEndOfInventory + ld a, [hli] + ld b, a ; b = ID of current item in table + ld a, [wcf91] ; a = ID of item being added + cp b ; does the current item in the table match the item being added? + jp z, .increaseItemQuantity ; if so, increase the item's quantity + inc hl +.loop + ld a, [hl] + cp a, $ff ; is it the end of the table? + jr nz, .notAtEndOfInventory +.addNewItem ; add an item not yet in the inventory + pop hl + ld a, d + and a ; is there room for a new item slot? + jr z, .done +; if there is room + inc [hl] ; increment the number of items in the inventory + ld a, [hl] ; the number of items will be the index of the new item + add a + dec a + ld c, a + ld b, 0 + add hl, bc ; hl = address to store the item + ld a, [wcf91] + ld [hli], a ; store item ID + ld a, [wItemQuantity] + ld [hli], a ; store item quantity + ld [hl], $ff ; store terminator + jp .success +.increaseItemQuantity ; increase the quantity of an item already in the inventory + ld a, [wItemQuantity] + ld b, a ; b = quantity to add + ld a, [hl] ; a = existing item quantity + add b ; a = new item quantity + cp a, 100 + jp c, .storeNewQuantity ; if the new quantity is less than 100, store it +; if the new quantity is greater than or equal to 100, +; try to max out the current slot and add the rest in a new slot + sub a, 99 + ld [wItemQuantity], a ; a = amount left over (to put in the new slot) + ld a, d + and a ; is there room for a new item slot? + jr z, .increaseItemQuantityFailed +; if so, store 99 in the current slot and store the rest in a new slot + ld a, 99 + ld [hli], a + jp .loop +.increaseItemQuantityFailed + pop hl + and a + jr .done +.storeNewQuantity + ld [hl], a + pop hl +.success + scf +.done + pop hl + pop de + pop bc + pop bc + ld a, b + ld [wItemQuantity], a ; restore the initial value from when the function was called + ret + +; function to remove an item (in varying quantities) from the player's bag or PC box +; INPUT: +; hl = address of inventory (either wNumBagItems or wNumBoxItems) +; [wWhichPokemon] = index (within the inventory) of the item to remove +; [wItemQuantity] = quantity to remove +RemoveItemFromInventory_: + push hl + inc hl + ld a, [wWhichPokemon] ; index (within the inventory) of the item being removed + add a + add l + ld l, a + jr nc, .noCarry + inc h +.noCarry + inc hl + ld a, [wItemQuantity] ; quantity being removed + ld e, a + ld a, [hl] ; a = current quantity + sub e + ld [hld], a ; store new quantity + ld [wMaxItemQuantity], a + and a + jr nz, .skipMovingUpSlots +; if the remaining quantity is 0, +; remove the emptied item slot and move up all the following item slots +.moveSlotsUp + ld e, l + ld d, h + inc de + inc de ; de = address of the slot following the emptied one +.loop ; loop to move up the following slots + ld a, [de] + inc de + ld [hli], a + cp a, $ff + jr nz, .loop +; update menu info + xor a + ld [wListScrollOffset], a + ld [wCurrentMenuItem], a + ld [wBagSavedMenuItem], a + ld [wSavedListScrollOffset], a + pop hl + ld a, [hl] ; a = number of items in inventory + dec a ; decrement the number of items + ld [hl], a ; store new number of items + ld [wListCount], a + cp a, 2 + jr c, .done + ld [wMaxMenuItem], a + jr .done +.skipMovingUpSlots + pop hl +.done + ret + +TrainerInfoTextBoxTileGraphics: INCBIN "gfx/trainer_info.2bpp" +TrainerInfoTextBoxTileGraphicsEnd: +BlankLeaderNames: INCBIN "gfx/blank_leader_names.2bpp" +CircleTile: INCBIN "gfx/circle_tile.2bpp" +BadgeNumbersTileGraphics: INCBIN "gfx/badge_numbers.2bpp" + +ReadSuperRodData: + ld a, [wCurMap] + ld c, a + ld hl, FishingSlots +.loop + ld a, [hli] + cp $ff + jr z, .notfound + cp c + jr z, .found + ld de, $8 + add hl, de + jr .loop +.found + call GenerateRandomFishingEncounter + ret +.notfound + ld de, $0 + ret + +GenerateRandomFishingEncounter: + call Random + cp $66 + jr c, .asm_f5ed6 + inc hl + inc hl + cp $b2 + jr c, .asm_f5ed6 + inc hl + inc hl + cp $e5 + jr c, .asm_f5ed6 + inc hl + inc hl +.asm_f5ed6 + ld e, [hl] + inc hl + ld d, [hl] + ret + +INCLUDE "data/super_rod.asm" +INCLUDE "engine/battle/bank3d_battle.asm" +INCLUDE "engine/items/tm_prices.asm" +INCLUDE "engine/multiply_divide.asm" +INCLUDE "engine/give_pokemon.asm" +INCLUDE "engine/battle/get_trainer_name.asm" +INCLUDE "engine/random.asm" +INCLUDE "engine/predefs.asm" diff --git a/engine/bank3e.asm b/engine/bank3e.asm new file mode 100644 index 00000000..32f5ebfd --- /dev/null +++ b/engine/bank3e.asm @@ -0,0 +1,5 @@ +INCLUDE "engine/surfing_minigame.asm" +INCLUDE "engine/yellow_intro.asm" +INCLUDE "data/animated_objects_3e_2.asm" +YellowIntroGraphics: INCBIN "gfx/yellow_intro.2bpp" +INCLUDE "engine/animated_objects_3e.asm" diff --git a/engine/bank3f.asm b/engine/bank3f.asm new file mode 100644 index 00000000..23eadbb1 --- /dev/null +++ b/engine/bank3f.asm @@ -0,0 +1,23 @@ +INCLUDE "data/map_songs.asm" +INCLUDE "data/map_header_pointers.asm" +INCLUDE "data/map_header_banks.asm" +INCLUDE "engine/pikachu_follow.asm" +INCLUDE "engine/pikachu_status.asm" +INCLUDE "engine/pikachu_emotions.asm" +INCLUDE "engine/pikachu_movement.asm" +INCLUDE "engine/pikachu_pic_animation.asm" + +Func_fe66e: + ret + +OfficerJennySprite: INCBIN "gfx/sprites/officer_jenny.2bpp" +PikachuSprite: INCBIN "gfx/sprites/pikachu.2bpp" +SandshrewSprite: INCBIN "gfx/sprites/sandshrew.2bpp" +OddishSprite: INCBIN "gfx/sprites/oddish.2bpp" +BulbasaurSprite: INCBIN "gfx/sprites/bulbasaur.2bpp" +JigglypuffSprite: INCBIN "gfx/sprites/jigglypuff.2bpp" +Clefairy2Sprite: INCBIN "gfx/sprites/clefairy2.2bpp" +ChanseySprite: INCBIN "gfx/sprites/chansey.2bpp" +SurfingPikachuSprite: INCBIN "gfx/sprites/surfing_pikachu.2bpp" +JessieSprite: INCBIN "gfx/sprites/jessie.2bpp" +JamesSprite: INCBIN "gfx/sprites/james.2bpp" diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 2578ee28..8df31e1c 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -1,202 +1,229 @@ ; Draws a "frame block". Frame blocks are blocks of tiles that are put ; together to form frames in battle animations. DrawFrameBlock: - ld l,c - ld h,b - ld a,[hli] - ld [wNumFBTiles],a - ld a,[wFBDestAddr + 1] - ld e,a - ld a,[wFBDestAddr] - ld d,a + ld l, c + ld h, b + ld a, [hli] + ld [wNumFBTiles], a + ld a, [wFBDestAddr + 1] + ld e, a + ld a, [wFBDestAddr] + ld d, a xor a - ld [wFBTileCounter],a ; loop counter + ld [wFBTileCounter], a ; loop counter .loop - ld a,[wFBTileCounter] + ld a, [wFBTileCounter] inc a - ld [wFBTileCounter],a - ld a,[wSubAnimTransform] + ld [wFBTileCounter], a + ld a, $2 + ld [wdef5], a + ld a, [wSubAnimTransform] dec a - jr z,.flipHorizontalAndVertical ; 1 + jr z, .flipHorizontalAndVertical ; 1 dec a - jp z,.flipHorizontalTranslateDown ; 2 + jp z, .flipHorizontalTranslateDown ; 2 dec a - jr z,.flipBaseCoords ; 3 + jr z, .flipBaseCoords ; 3 .noTransformation - ld a,[wBaseCoordY] + ld a, [wBaseCoordY] add [hl] - ld [de],a ; store Y + ld [de], a ; store Y inc hl inc de - ld a,[wBaseCoordX] + ld a, [wBaseCoordX] jr .finishCopying .flipBaseCoords - ld a,[wBaseCoordY] - ld b,a - ld a,136 + ld a, [wBaseCoordY] + ld b, a + ld a, 136 sub b ; flip Y base coordinate add [hl] ; Y offset - ld [de],a ; store Y + ld [de], a ; store Y inc hl inc de - ld a,[wBaseCoordX] - ld b,a - ld a,168 + ld a, [wBaseCoordX] + ld b, a + ld a, 168 sub b ; flip X base coordinate .finishCopying ; finish copying values to OAM (when [wSubAnimTransform] not 1 or 2) add [hl] ; X offset - ld [de],a ; store X + ld [de], a ; store X + cp 88 + jr c, .asm_78056 + ld a, [wdef5] + inc a + ld [wdef5], a +.asm_78056 inc hl inc de - ld a,[hli] - add a,$31 ; base tile ID for battle animations - ld [de],a ; store tile ID + ld a, [hli] + add a, $31 ; base tile ID for battle animations + ld [de], a ; store tile ID inc de - ld a,[hli] - ld [de],a ; store flags + ld a, [hli] + ld b, a + ld a, [wdef5] + or b + ld [de], a ; store flags inc de jp .nextTile .flipHorizontalAndVertical - ld a,[wBaseCoordY] + ld a, [wBaseCoordY] add [hl] ; Y offset - ld b,a - ld a,136 + ld b, a + ld a, 136 sub b ; flip Y coordinate - ld [de],a ; store Y + ld [de], a ; store Y inc hl inc de - ld a,[wBaseCoordX] + ld a, [wBaseCoordX] add [hl] ; X offset - ld b,a - ld a,168 + ld b, a + ld a, 168 sub b ; flip X coordinate - ld [de],a ; store X + ld [de], a ; store X + cp 88 + jr c, .asm_78087 + ld a, [wdef5] + inc a + ld [wdef5], a +.asm_78087 inc hl inc de - ld a,[hli] - add a,$31 ; base tile ID for battle animations - ld [de],a ; store tile ID + ld a, [hli] + add a, $31 ; base tile ID for battle animations + ld [de], a ; store tile ID inc de ; toggle horizontal and vertical flip - ld a,[hli] ; flags + ld a, [hli] ; flags and a - ld b,OAM_VFLIP | OAM_HFLIP - jr z,.storeFlags1 - cp a,OAM_HFLIP - ld b,OAM_VFLIP - jr z,.storeFlags1 - cp a,OAM_VFLIP - ld b,OAM_HFLIP - jr z,.storeFlags1 - ld b,0 + ld b, OAM_VFLIP | OAM_HFLIP + jr z, .storeFlags1 + cp a, OAM_HFLIP + ld b, OAM_VFLIP + jr z, .storeFlags1 + cp a, OAM_VFLIP + ld b, OAM_HFLIP + jr z, .storeFlags1 + ld b, 0 .storeFlags1 - ld a,b - ld [de],a + ld a, [wdef5] + or b + ld [de], a inc de jp .nextTile .flipHorizontalTranslateDown - ld a,[wBaseCoordY] + ld a, [wBaseCoordY] add [hl] - add a,40 ; translate Y coordinate downwards - ld [de],a ; store Y + add a, 40 ; translate Y coordinate downwards + ld [de], a ; store Y inc hl inc de - ld a,[wBaseCoordX] + ld a, [wBaseCoordX] add [hl] - ld b,a - ld a,168 + ld b, a + ld a, 168 sub b ; flip X coordinate - ld [de],a ; store X + ld [de], a ; store X + cp 88 + jr c, .asm_780c8 + ld a, [wdef5] + inc a + ld [wdef5], a +.asm_780c8 inc hl inc de - ld a,[hli] - add a,$31 ; base tile ID for battle animations - ld [de],a ; store tile ID + ld a, [hli] + add a, $31 ; base tile ID for battle animations + ld [de], a ; store tile ID inc de - ld a,[hli] - bit 5,a ; is horizontal flip enabled? - jr nz,.disableHorizontalFlip + ld a, [hli] + bit 5, a ; is horizontal flip enabled? + jr nz, .disableHorizontalFlip .enableHorizontalFlip - set 5,a + set 5, a jr .storeFlags2 .disableHorizontalFlip - res 5,a + res 5, a .storeFlags2 - ld [de],a + ld b, a + ld a, [wdef5] + or b + ld [de], a inc de .nextTile - ld a,[wFBTileCounter] - ld c,a - ld a,[wNumFBTiles] + ld a, [wFBTileCounter] + ld c, a + ld a, [wNumFBTiles] cp c - jp nz,.loop ; go back up if there are more tiles to draw + jp nz, .loop ; go back up if there are more tiles to draw .afterDrawingTiles - ld a,[wFBMode] - cp a,2 - jr z,.advanceFrameBlockDestAddr; skip delay and don't clean OAM buffer - ld a,[wSubAnimFrameDelay] - ld c,a + ld a, [wFBMode] + cp a, 2 + jr z, .advanceFrameBlockDestAddr; skip delay and don't clean OAM buffer + ld a, [wSubAnimFrameDelay] + ld c, a call DelayFrames - ld a,[wFBMode] - cp a,3 - jr z,.advanceFrameBlockDestAddr ; skip cleaning OAM buffer - cp a,4 - jr z,.done ; skip cleaning OAM buffer and don't advance the frame block destination address - ld a,[wAnimationID] - cp a,GROWL - jr z,.resetFrameBlockDestAddr + ld a, [wFBMode] + cp a, 3 + jr z, .advanceFrameBlockDestAddr ; skip cleaning OAM buffer + cp a, 4 + jr z, .done ; skip cleaning OAM buffer and don't advance the frame block destination address + ld a, [wAnimationID] + cp a, GROWL + jr z, .resetFrameBlockDestAddr call AnimationCleanOAM .resetFrameBlockDestAddr - ld hl,wOAMBuffer ; OAM buffer - ld a,l - ld [wFBDestAddr + 1],a - ld a,h - ld [wFBDestAddr],a ; set destination address to beginning of OAM buffer + ld hl, wOAMBuffer ; OAM buffer + ld a, l + ld [wFBDestAddr + 1], a + ld a, h + ld [wFBDestAddr], a ; set destination address to beginning of OAM buffer ret .advanceFrameBlockDestAddr - ld a,e - ld [wFBDestAddr + 1],a - ld a,d - ld [wFBDestAddr],a + ld a, e + ld [wFBDestAddr + 1], a + ld a, d + ld [wFBDestAddr], a .done ret PlayAnimation: xor a - ld [$FF8B],a ; it looks like nothing reads this - ld [wSubAnimTransform],a - ld a,[wAnimationID] ; get animation number + ld [$FF8B], a ; it looks like nothing reads this + ld [wSubAnimTransform], a + ld a, [wAnimationID] ; get animation number dec a - ld l,a - ld h,0 - add hl,hl - ld de,AttackAnimationPointers ; animation command stream pointers - add hl,de - ld a,[hli] - ld h,[hl] - ld l,a + ld l, a + ld h, 0 + add hl, hl + ld de, AttackAnimationPointers ; animation command stream pointers + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a .animationLoop - ld a,[hli] - cp a,$FF - jr z,.AnimationOver - cp a,$C0 ; is this subanimation or a special effect? - jr c,.playSubanimation + ld a, [hli] + cp a, $FF + jr z, .AnimationOver + cp a, $C0 ; is this subanimation or a special effect? + jr c, .playSubanimation .doSpecialEffect - ld c,a - ld de,SpecialEffectPointers + ld c, a + ld de, SpecialEffectPointers .searchSpecialEffectTableLoop - ld a,[de] + ld a, [de] cp c - jr z,.foundMatch + jr z, .foundMatch inc de inc de inc de jr .searchSpecialEffectTableLoop .foundMatch - ld a,[hli] - cp a,$FF ; is there a sound to play? - jr z,.skipPlayingSound - ld [wAnimSoundID],a ; store sound + ld a, [hli] + cp a, $FF ; is there a sound to play? + jr z, .skipPlayingSound + ld [wAnimSoundID], a ; store sound push hl push de call GetMoveSound @@ -206,50 +233,52 @@ PlayAnimation: .skipPlayingSound push hl inc de - ld a,[de] - ld l,a + ld a, [de] + ld l, a inc de - ld a,[de] - ld h,a - ld de,.nextAnimationCommand + ld a, [de] + ld h, a + ld de, .nextAnimationCommand push de jp [hl] ; jump to special effect function .playSubanimation - ld c,a - and a,%00111111 - ld [wSubAnimFrameDelay],a + ld c, a + and a, %00111111 + ld [wSubAnimFrameDelay], a xor a sla c rla sla c rla - ld [wWhichBattleAnimTileset],a - ld a,[hli] ; sound - ld [wAnimSoundID],a ; store sound - ld a,[hli] ; subanimation ID - ld c,l - ld b,h - ld l,a - ld h,0 - add hl,hl - ld de,SubanimationPointers - add hl,de - ld a,l - ld [wSubAnimAddrPtr],a - ld a,h - ld [wSubAnimAddrPtr + 1],a - ld l,c - ld h,b + ld [wWhichBattleAnimTileset], a + ld a, [hli] ; sound + ld [wAnimSoundID], a ; store sound + ld a, [hli] ; subanimation ID + ld c, l + ld b, h + ld l, a + ld h, 0 + add hl, hl + ld de, SubanimationPointers + add hl, de + ld a, l + ld [wSubAnimAddrPtr], a + ld a, h + ld [wSubAnimAddrPtr + 1], a + ld l, c + ld h, b push hl - ld a,[rOBP0] + ld a, [rOBP0] push af - ld a,[wAnimPalette] - ld [rOBP0],a + ld a, [wAnimPalette] + ld [rOBP0], a + call UpdateGBCPal_OBP0 call LoadAnimationTileset call LoadSubanimation call PlaySubanimation pop af - ld [rOBP0],a + ld [rOBP0], a + call UpdateGBCPal_OBP0 .nextAnimationCommand pop hl jr .animationLoop @@ -257,22 +286,22 @@ PlayAnimation: ret LoadSubanimation: - ld a,[wSubAnimAddrPtr + 1] - ld h,a - ld a,[wSubAnimAddrPtr] - ld l,a - ld a,[hli] - ld e,a - ld a,[hl] - ld d,a ; de = address of subanimation - ld a,[de] - ld b,a - and a,31 - ld [wSubAnimCounter],a ; number of frame blocks - ld a,b - and a,%11100000 - cp a,5 << 5 ; is subanimation type 5? - jr nz,.isNotType5 + ld a, [wSubAnimAddrPtr + 1] + ld h, a + ld a, [wSubAnimAddrPtr] + ld l, a + ld a, [hli] + ld e, a + ld a, [hl] + ld d, a ; de = address of subanimation + ld a, [de] + ld b, a + and a, 31 + ld [wSubAnimCounter], a ; number of frame blocks + ld a, b + and a, %11100000 + cp a, 5 << 5 ; is subanimation type 5? + jr nz, .isNotType5 .isType5 call GetSubanimationTransform2 jr .saveTransformation @@ -282,35 +311,35 @@ LoadSubanimation: ; place the upper 3 bits of a into bits 0-2 of a before storing srl a swap a - ld [wSubAnimTransform],a - cp a,4 ; is the animation reversed? - ld hl,0 - jr nz,.storeSubentryAddr + ld [wSubAnimTransform], a + cp a, 4 ; is the animation reversed? + ld hl, 0 + jr nz, .storeSubentryAddr ; if the animation is reversed, then place the initial subentry address at the end of the list of subentries - ld a,[wSubAnimCounter] + ld a, [wSubAnimCounter] dec a - ld bc,3 + ld bc, 3 .loop - add hl,bc + add hl, bc dec a - jr nz,.loop + jr nz, .loop .storeSubentryAddr inc de - add hl,de - ld a,l - ld [wSubAnimSubEntryAddr],a - ld a,h - ld [wSubAnimSubEntryAddr + 1],a + add hl, de + ld a, l + ld [wSubAnimSubEntryAddr], a + ld a, h + ld [wSubAnimSubEntryAddr + 1], a ret ; called if the subanimation type is not 5 ; sets the transform to 0 (i.e. no transform) if it's the player's turn ; sets the transform to the subanimation type if it's the enemy's turn GetSubanimationTransform1: - ld b,a - ld a,[H_WHOSETURN] + ld b, a + ld a, [H_WHOSETURN] and a - ld a,b + ld a, b ret nz xor a ret @@ -319,32 +348,32 @@ GetSubanimationTransform1: ; sets the transform to 2 (i.e. horizontal and vertical flip) if it's the player's turn ; sets the transform to 0 (i.e. no transform) if it's the enemy's turn GetSubanimationTransform2: - ld a,[H_WHOSETURN] + ld a, [H_WHOSETURN] and a - ld a,2 << 5 + ld a, 2 << 5 ret z xor a ret ; loads tile patterns for battle animations LoadAnimationTileset: - ld a,[wWhichBattleAnimTileset] + ld a, [wWhichBattleAnimTileset] add a add a - ld hl,AnimationTilesetPointers - ld e,a - ld d,0 - add hl,de - ld a,[hli] - ld [wTempTilesetNumTiles],a ; number of tiles - ld a,[hli] - ld e,a - ld a,[hl] - ld d,a ; de = address of tileset - ld hl,vSprites + $310 + ld hl, AnimationTilesetPointers + ld e, a + ld d, 0 + add hl, de + ld a, [hli] + ld [wTempTilesetNumTiles], a ; number of tiles + ld a, [hli] + ld e, a + ld a, [hl] + ld d, a ; de = address of tileset + ld hl, vSprites + $310 ld b, BANK(AnimationTileset1) ; ROM bank - ld a,[wTempTilesetNumTiles] - ld c,a ; number of tiles + ld a, [wTempTilesetNumTiles] + ld c, a ; number of tiles jp CopyVideoData ; load tileset AnimationTilesetPointers: @@ -367,12 +396,7 @@ AnimationTileset2: INCBIN "gfx/attack_anim_2.2bpp" SlotMachineTiles2: -IF DEF(_RED) - INCBIN "gfx/red/slotmachine2.2bpp" -ENDC -IF DEF(_BLUE) - INCBIN "gfx/blue/slotmachine2.2bpp" -ENDC + INCBIN "gfx/slotmachine2.2bpp" MoveAnimation: push hl @@ -381,38 +405,38 @@ MoveAnimation: push af call WaitForSoundToFinish call SetAnimationPalette - ld a,[wAnimationID] + ld a, [wAnimationID] and a - jr z,.AnimationFinished + jr z, .animationFinished ; if throwing a Poké Ball, skip the regular animation code - cp a,TOSS_ANIM - jr nz,.MoveAnimation - ld de,.AnimationFinished + cp a, TOSS_ANIM + jr nz, .moveAnimation + ld de, .animationFinished push de jp TossBallAnimation -.MoveAnimation +.moveAnimation ; check if battle animations are disabled in the options - ld a,[wOptions] - bit 7,a - jr nz,.AnimationsDisabled + ld a, [wOptions] + bit 7, a + jr nz, .animationsDisabled call ShareMoveAnimations call PlayAnimation jr .next4 -.AnimationsDisabled - ld c,30 +.animationsDisabled + ld c, 30 call DelayFrames .next4 call PlayApplyingAttackAnimation ; shake the screen or flash the pic in and out (to show damage) -.AnimationFinished +.animationFinished call WaitForSoundToFinish xor a - ld [wSubAnimSubEntryAddr],a - ld [wUnusedD09B],a - ld [wSubAnimTransform],a + ld [wSubAnimSubEntryAddr], a + ld [wUnusedD09B], a + ld [wSubAnimTransform], a dec a - ld [wAnimSoundID],a + ld [wAnimSoundID], a pop af pop bc pop de @@ -421,42 +445,42 @@ MoveAnimation: ShareMoveAnimations: ; some moves just reuse animations from status conditions - ld a,[H_WHOSETURN] + ld a, [H_WHOSETURN] and a ret z ; opponent’s turn - ld a,[wAnimationID] + ld a, [wAnimationID] - cp a,AMNESIA - ld b,CONF_ANIM - jr z,.Replace + cp a, AMNESIA + ld b, CONF_ANIM + jr z, .replaceAnim - cp a,REST - ld b,SLP_ANIM + cp a, REST + ld b, SLP_ANIM ret nz -.Replace - ld a,b - ld [wAnimationID],a +.replaceAnim + ld a, b + ld [wAnimationID], a ret PlayApplyingAttackAnimation: ; Generic animation that shows after the move's individual animation ; Different animation depending on whether the move has an additional effect and on whose turn it is - ld a,[wAnimationType] + ld a, [wAnimationType] and a ret z dec a add a - ld c,a - ld b,0 - ld hl,AnimationTypePointerTable - add hl,bc - ld a,[hli] - ld h,[hl] - ld l,a + ld c, a + ld b, 0 + ld hl, AnimationTypePointerTable + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a jp [hl] AnimationTypePointerTable: @@ -537,6 +561,8 @@ SetAnimationPalette: ld [rOBP0], a ld a, $6c ld [rOBP1], a + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 ret .notSGB ld a, $e4 @@ -544,72 +570,94 @@ SetAnimationPalette: ld [rOBP0], a ld a, $6c ld [rOBP1], a + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 + ret + +Func_78e98: + call SaveScreenTilesToBuffer2 + xor a + ld [H_AUTOBGTRANSFERENABLED], a + call ClearScreen + ld h, vBGMap0 / $100 + call WriteLowerByteOfBGMapAndEnableBGTransfer + call Delay3 + xor a + ld [H_AUTOBGTRANSFERENABLED], a + call LoadScreenTilesFromBuffer2 + ld h, vBGMap1 / $100 + +WriteLowerByteOfBGMapAndEnableBGTransfer: + ld l, vBGMap0 & $ff + call BattleAnimCopyTileMapToVRAM + ld a, $1 + ld [H_AUTOBGTRANSFERENABLED], a ret PlaySubanimation: - ld a,[wAnimSoundID] - cp a,$FF - jr z,.skipPlayingSound + ld a, [wAnimSoundID] + cp a, $FF + jr z, .skipPlayingSound call GetMoveSound call PlaySound .skipPlayingSound - ld hl,wOAMBuffer ; base address of OAM buffer - ld a,l - ld [wFBDestAddr + 1],a - ld a,h - ld [wFBDestAddr],a - ld a,[wSubAnimSubEntryAddr + 1] - ld h,a - ld a,[wSubAnimSubEntryAddr] - ld l,a + ld hl, wOAMBuffer ; base address of OAM buffer + ld a, l + ld [wFBDestAddr + 1], a + ld a, h + ld [wFBDestAddr], a + ld a, [wSubAnimSubEntryAddr + 1] + ld h, a + ld a, [wSubAnimSubEntryAddr] + ld l, a .loop push hl - ld c,[hl] ; frame block ID - ld b,0 - ld hl,FrameBlockPointers - add hl,bc - add hl,bc - ld a,[hli] - ld c,a - ld a,[hli] - ld b,a + ld c, [hl] ; frame block ID + ld b, 0 + ld hl, FrameBlockPointers + add hl, bc + add hl, bc + ld a, [hli] + ld c, a + ld a, [hli] + ld b, a pop hl inc hl push hl - ld e,[hl] ; base coordinate ID - ld d,0 - ld hl,FrameBlockBaseCoords ; base coordinate table - add hl,de - add hl,de - ld a,[hli] - ld [wBaseCoordY],a - ld a,[hl] - ld [wBaseCoordX],a + ld e, [hl] ; base coordinate ID + ld d, 0 + ld hl, FrameBlockBaseCoords ; base coordinate table + add hl, de + add hl, de + ld a, [hli] + ld [wBaseCoordY], a + ld a, [hl] + ld [wBaseCoordX], a pop hl inc hl - ld a,[hl] ; frame block mode - ld [wFBMode],a + ld a, [hl] ; frame block mode + ld [wFBMode], a call DrawFrameBlock call DoSpecialEffectByAnimationId ; run animation-specific function (if there is one) - ld a,[wSubAnimCounter] + ld a, [wSubAnimCounter] dec a - ld [wSubAnimCounter],a + ld [wSubAnimCounter], a ret z - ld a,[wSubAnimSubEntryAddr + 1] - ld h,a - ld a,[wSubAnimSubEntryAddr] - ld l,a - ld a,[wSubAnimTransform] - cp a,4 ; is the animation reversed? - ld bc,3 - jr nz,.nextSubanimationSubentry - ld bc,-3 + ld a, [wSubAnimSubEntryAddr + 1] + ld h, a + ld a, [wSubAnimSubEntryAddr] + ld l, a + ld a, [wSubAnimTransform] + cp a, 4 ; is the animation reversed? + ld bc, 3 + jr nz, .nextSubanimationSubentry + ld bc, -3 .nextSubanimationSubentry - add hl,bc - ld a,h - ld [wSubAnimSubEntryAddr + 1],a - ld a,l - ld [wSubAnimSubEntryAddr],a + add hl, bc + ld a, h + ld [wSubAnimSubEntryAddr + 1], a + ld a, l + ld [wSubAnimSubEntryAddr], a jp .loop AnimationCleanOAM: @@ -631,16 +679,16 @@ DoSpecialEffectByAnimationId: push hl push de push bc - ld a,[wAnimationID] - ld hl,AnimationIdSpecialEffects - ld de,3 + ld a, [wAnimationID] + ld hl, AnimationIdSpecialEffects + ld de, 3 call IsInArray - jr nc,.done + jr nc, .done inc hl - ld a,[hli] - ld h,[hl] - ld l,a - ld de,.done + ld a, [hli] + ld h, [hl] + ld l, a + ld de, .done push de jp [hl] .done @@ -691,7 +739,7 @@ AnimationIdSpecialEffects: dw DoExplodeSpecialEffects db SPORE - dw AnimationFlashScreen + dw FlashScreenEveryFourFrameBlocks db EXPLOSION dw DoExplodeSpecialEffects @@ -726,38 +774,39 @@ AnimationIdSpecialEffects: db $FF ; terminator DoBallTossSpecialEffects: - ld a,[wcf91] - cp a,3 ; is it a Master Ball or Ultra Ball? - jr nc,.skipFlashingEffect + ld a, [wcf91] + cp a, 3 ; is it a Master Ball or Ultra Ball? + jr nc, .skipFlashingEffect .flashingEffect ; do a flashing effect if it's Master Ball or Ultra Ball - ld a,[rOBP0] - xor a,%00111100 ; complement colors 1 and 2 - ld [rOBP0],a + ld a, [rOBP0] + xor a, %00111100 ; complement colors 1 and 2 + ld [rOBP0], a + call UpdateGBCPal_OBP0 .skipFlashingEffect - ld a,[wSubAnimCounter] - cp a,11 ; is it the beginning of the subanimation? - jr nz,.skipPlayingSound + ld a, [wSubAnimCounter] + cp a, 11 ; is it the beginning of the subanimation? + jr nz, .skipPlayingSound ; if it is the beginning of the subanimation, play a sound - ld a,SFX_BALL_TOSS + ld a, SFX_BALL_TOSS call PlaySound .skipPlayingSound - ld a,[wIsInBattle] - cp a,02 ; is it a trainer battle? - jr z,.isTrainerBattle - ld a,[wd11e] - cp a,$10 ; is the enemy pokemon the Ghost Marowak? + ld a, [wIsInBattle] + cp a, 02 ; is it a trainer battle? + jr z, .isTrainerBattle + ld a, [wd11e] + cp a, $10 ; is the enemy pokemon the Ghost Marowak? ret nz ; if the enemy pokemon is the Ghost Marowak, make it dodge during the last 3 frames - ld a,[wSubAnimCounter] - cp a,3 - jr z,.moveGhostMarowakLeft - cp a,2 - jr z,.moveGhostMarowakLeft - cp a,1 + ld a, [wSubAnimCounter] + cp a, 3 + jr z, .moveGhostMarowakLeft + cp a, 2 + jr z, .moveGhostMarowakLeft + cp a, 1 ret nz .moveGhostMarowakLeft coord hl, 17, 0 - ld de,20 + ld de, 20 lb bc, 7, 7 .loop push hl @@ -765,152 +814,152 @@ DoBallTossSpecialEffects: call AnimCopyRowRight ; move row of tiles left pop bc pop hl - add hl,de + add hl, de dec b - jr nz,.loop - ld a,%00001000 - ld [rNR10],a ; Channel 1 sweep register + jr nz, .loop + ld a, %00001000 + ld [rNR10], a ; Channel 1 sweep register ret .isTrainerBattle ; if it's a trainer battle, shorten the animation by one frame - ld a,[wSubAnimCounter] - cp a,3 + ld a, [wSubAnimCounter] + cp a, 3 ret nz dec a - ld [wSubAnimCounter],a + ld [wSubAnimCounter], a ret DoBallShakeSpecialEffects: - ld a,[wSubAnimCounter] - cp a,4 ; is it the beginning of a shake? - jr nz,.skipPlayingSound + ld a, [wSubAnimCounter] + cp a, 4 ; is it the beginning of a shake? + jr nz, .skipPlayingSound ; if it is the beginning of a shake, play a sound and wait 2/3 of a second - ld a,SFX_TINK + ld a, SFX_TINK call PlaySound - ld c,40 + ld c, 40 call DelayFrames .skipPlayingSound - ld a,[wSubAnimCounter] + ld a, [wSubAnimCounter] dec a ret nz ; if it's the end of the ball shaking subanimation, check if more shakes are left and restart the subanimation - ld a,[wNumShakes] ; number of shakes + ld a, [wNumShakes] ; number of shakes dec a ; decrement number of shakes - ld [wNumShakes],a + ld [wNumShakes], a ret z ; if there are shakes left, restart the subanimation - ld a,[wSubAnimSubEntryAddr] - ld l,a - ld a,[wSubAnimSubEntryAddr + 1] - ld h,a - ld de,-(4 * 3) ; 4 subentries and 3 bytes per subentry - add hl,de - ld a,l - ld [wSubAnimSubEntryAddr],a - ld a,h - ld [wSubAnimSubEntryAddr + 1],a - ld a,5 ; number of subentries in the ball shaking subanimation plus one - ld [wSubAnimCounter],a + ld a, [wSubAnimSubEntryAddr] + ld l, a + ld a, [wSubAnimSubEntryAddr + 1] + ld h, a + ld de, -(4 * 3) ; 4 subentries and 3 bytes per subentry + add hl, de + ld a, l + ld [wSubAnimSubEntryAddr], a + ld a, h + ld [wSubAnimSubEntryAddr + 1], a + ld a, 5 ; number of subentries in the ball shaking subanimation plus one + ld [wSubAnimCounter], a ret ; plays a sound after the second frame of the poof animation DoPoofSpecialEffects: - ld a,[wSubAnimCounter] - cp a,5 + ld a, [wSubAnimCounter] + cp a, 5 ret nz - ld a,SFX_BALL_POOF + ld a, SFX_BALL_POOF jp PlaySound DoRockSlideSpecialEffects: - ld a,[wSubAnimCounter] - cp a,12 + ld a, [wSubAnimCounter] + cp a, 12 ret nc - cp a,8 - jr nc,.shakeScreen - cp a,1 - jp z,AnimationFlashScreen ; if it's the end of the subanimation, flash the screen + cp a, 8 + jr nc, .shakeScreen + cp a, 1 + jp z, AnimationFlashScreen ; if it's the end of the subanimation, flash the screen ret ; if the subaninmation counter is between 8 and 11, shake the screen horizontally and vertically .shakeScreen - ld b,1 + ld b, 1 predef PredefShakeScreenHorizontally ; shake horizontally - ld b,1 + ld b, 1 predef_jump PredefShakeScreenVertically ; shake vertically FlashScreenEveryEightFrameBlocks: - ld a,[wSubAnimCounter] - and a,7 ; is the subanimation counter exactly 8? - call z,AnimationFlashScreen ; if so, flash the screen + ld a, [wSubAnimCounter] + and a, 7 ; is the subanimation counter exactly 8? + call z, AnimationFlashScreen ; if so, flash the screen ret ; flashes the screen if the subanimation counter is divisible by 4 FlashScreenEveryFourFrameBlocks: - ld a,[wSubAnimCounter] - and a,3 - call z,AnimationFlashScreen + ld a, [wSubAnimCounter] + and a, 3 + call z, AnimationFlashScreen ret ; used for Explosion and Selfdestruct DoExplodeSpecialEffects: - ld a,[wSubAnimCounter] - cp a,1 ; is it the end of the subanimation? - jr nz,FlashScreenEveryFourFrameBlocks + ld a, [wSubAnimCounter] + cp a, 1 ; is it the end of the subanimation? + jr nz, FlashScreenEveryFourFrameBlocks ; if it's the end of the subanimation, make the attacking pokemon disappear coord hl, 1, 5 jp AnimationHideMonPic ; make pokemon disappear ; flashes the screen when subanimation counter is 1 modulo 4 DoBlizzardSpecialEffects: - ld a,[wSubAnimCounter] - cp a,13 - jp z,AnimationFlashScreen - cp a,9 - jp z,AnimationFlashScreen - cp a,5 - jp z,AnimationFlashScreen - cp a,1 - jp z,AnimationFlashScreen + ld a, [wSubAnimCounter] + cp a, 13 + jp z, AnimationFlashScreen + cp a, 9 + jp z, AnimationFlashScreen + cp a, 5 + jp z, AnimationFlashScreen + cp a, 1 + jp z, AnimationFlashScreen ret ; flashes the screen at 3 points in the subanimation ; unused FlashScreenUnused: - ld a,[wSubAnimCounter] - cp a,14 - jp z,AnimationFlashScreen - cp a,9 - jp z,AnimationFlashScreen - cp a,2 - jp z,AnimationFlashScreen + ld a, [wSubAnimCounter] + cp a, 14 + jp z, AnimationFlashScreen + cp a, 9 + jp z, AnimationFlashScreen + cp a, 2 + jp z, AnimationFlashScreen ret ; function to make the pokemon disappear at the beginning of the animation TradeHidePokemon: - ld a,[wSubAnimCounter] - cp a,6 + ld a, [wSubAnimCounter] + cp a, 6 ret nz - ld a,2 * SCREEN_WIDTH + 7 + ld a, 2 * SCREEN_WIDTH + 7 jp ClearMonPicFromTileMap ; make pokemon disappear ; function to make a shaking pokeball jump up at the end of the animation TradeShakePokeball: - ld a,[wSubAnimCounter] - cp a,1 + ld a, [wSubAnimCounter] + cp a, 1 ret nz ; if it's the end of the animation, make the ball jump up - ld de,BallMoveDistances1 + ld de, BallMoveDistances1 .loop - ld hl,wOAMBuffer ; OAM buffer - ld bc,4 + ld hl, wOAMBuffer ; OAM buffer + ld bc, 4 .innerLoop - ld a,[de] - cp a,$ff - jr z,.done + ld a, [de] + cp a, $ff + jr z, .done add [hl] ; add to Y value of OAM entry - ld [hl],a - add hl,bc - ld a,l - cp a,4 * 4 ; there are 4 entries, each 4 bytes - jr nz,.innerLoop + ld [hl], a + add hl, bc + ld a, l + cp a, 4 * 4 ; there are 4 entries, each 4 bytes + jr nz, .innerLoop inc de push bc call Delay3 @@ -918,74 +967,73 @@ TradeShakePokeball: jr .loop .done call AnimationCleanOAM - ld a,SFX_TRADE_MACHINE + ld a, SFX_TRADE_MACHINE jp PlaySound BallMoveDistances1: - db -12,-12,-8 + db -12, -12, -8 db $ff ; terminator ; function to make the pokeball jump up TradeJumpPokeball: - ld de,BallMoveDistances2 + ld de, BallMoveDistances2 .loop - ld hl,wOAMBuffer ; OAM buffer - ld bc,4 + ld hl, wOAMBuffer ; OAM buffer + ld bc, 4 .innerLoop - ld a,[de] - cp a,$ff - jp z,ClearScreen + ld a, [de] + cp a, $ff + jp z, ClearScreen add [hl] - ld [hl],a - add hl,bc - ld a,l - cp a,4 * 4 ; there are 4 entries, each 4 bytes - jr nz,.innerLoop + ld [hl], a + add hl, bc + ld a, l + cp a, 4 * 4 ; there are 4 entries, each 4 bytes + jr nz, .innerLoop inc de push de - ld a,[de] - cp a,12 - jr z,.playSound - cp a,$ff - jr nz,.skipPlayingSound + ld a, [de] + cp a, 12 + jr z, .playSound + cp a, $ff + jr nz, .skipPlayingSound .playSound ; play sound if next move distance is 12 or this is the last one - ld a,SFX_BATTLE_18 + ld a, SFX_BATTLE_18 call PlaySound .skipPlayingSound push bc - ld c,5 + ld c, 5 call DelayFrames pop bc - ld a,[hSCX] ; background scroll X - sub a,8 ; scroll to the left - ld [hSCX],a + ld a, [hSCX] ; background scroll X + sub a, 8 ; scroll to the left + ld [hSCX], a pop de jr .loop BallMoveDistances2: - db 11,12,-12,-7,7,12,-8,8 + db 11, 12, -12, -7, 7, 12, -8, 8 db $ff ; terminator ; this function copies the current musical note graphic ; so that there are two musical notes flying towards the defending pokemon DoGrowlSpecialEffects: - ld hl,wOAMBuffer ; OAM buffer - ld de,wOAMBuffer + $10 - ld bc,$10 + ld hl, wOAMBuffer ; OAM buffer + ld de, wOAMBuffer + $10 + ld bc, $10 call CopyData ; copy the musical note graphic - ld a,[wSubAnimCounter] + ld a, [wSubAnimCounter] dec a - call z,AnimationCleanOAM ; clean up at the end of the subanimation + call z, AnimationCleanOAM ; clean up at the end of the subanimation ret ; this is associated with Tail Whip, but Tail Whip doesn't use any subanimations TailWhipAnimationUnused: - ld a,1 - ld [wSubAnimCounter],a - ld c,20 + ld a, 1 + ld [wSubAnimCounter], a + ld c, 20 jp DelayFrames -; Format: Special Effect ID (1 byte), Address (2 bytes) SpecialEffectPointers: db SE_DARK_SCREEN_FLASH ; $FE dw AnimationFlashScreen @@ -1068,48 +1116,49 @@ SpecialEffectPointers: db $FF AnimationDelay10: - ld c,10 + ld c, 10 jp DelayFrames ; calls a function with the turn flipped from player to enemy or vice versa ; input - hl - address of function to call CallWithTurnFlipped: - ld a,[H_WHOSETURN] + ld a, [H_WHOSETURN] push af - xor a,1 - ld [H_WHOSETURN],a - ld de,.returnAddress + xor a, 1 + ld [H_WHOSETURN], a + ld de, .returnAddress push de jp [hl] .returnAddress pop af - ld [H_WHOSETURN],a + ld [H_WHOSETURN], a ret ; flashes the screen for an extended period (48 frames) AnimationFlashScreenLong: - ld a,3 ; cycle through the palettes 3 times - ld [wFlashScreenLongCounter],a - ld a,[wOnSGB] ; running on SGB? + ld a, 3 ; cycle through the palettes 3 times + ld [wFlashScreenLongCounter], a + ld a, [wOnSGB] ; running on SGB? and a - ld hl,FlashScreenLongMonochrome - jr z,.loop - ld hl,FlashScreenLongSGB + ld hl, FlashScreenLongMonochrome + jr z, .loop + ld hl, FlashScreenLongSGB .loop push hl .innerLoop - ld a,[hli] - cp a,$01 ; is it the end of the palettes? - jr z,.endOfPalettes - ld [rBGP],a + ld a, [hli] + cp a, $01 ; is it the end of the palettes? + jr z, .endOfPalettes + ld [rBGP], a + call UpdateGBCPal_BGP call FlashScreenLongDelay jr .innerLoop .endOfPalettes - ld a,[wFlashScreenLongCounter] + ld a, [wFlashScreenLongCounter] dec a - ld [wFlashScreenLongCounter],a + ld [wFlashScreenLongCounter], a pop hl - jr nz,.loop + jr nz, .loop ret ; BG palettes @@ -1147,31 +1196,34 @@ FlashScreenLongSGB: ; causes a delay of 2 frames for the first cycle ; causes a delay of 1 frame for the second and third cycles FlashScreenLongDelay: - ld a,[wFlashScreenLongCounter] - cp a,4 ; never true since [wFlashScreenLongCounter] starts at 3 - ld c,4 - jr z,.delayFrames - cp a,3 - ld c,2 - jr z,.delayFrames - cp a,2 ; nothing is done with this - ld c,1 + ld a, [wFlashScreenLongCounter] + cp a, 4 ; never true since [wFlashScreenLongCounter] starts at 3 + ld c, 4 + jr z, .delayFrames + cp a, 3 + ld c, 2 + jr z, .delayFrames + cp a, 2 ; nothing is done with this + ld c, 1 .delayFrames jp DelayFrames AnimationFlashScreen: - ld a,[rBGP] + ld a, [rBGP] push af ; save initial palette - ld a,%00011011 ; 0, 1, 2, 3 (inverted colors) - ld [rBGP],a - ld c,2 + ld a, %00011011 ; 0, 1, 2, 3 (inverted colors) + ld [rBGP], a + call UpdateGBCPal_BGP + ld c, 2 call DelayFrames xor a ; white out background - ld [rBGP],a - ld c,2 + ld [rBGP], a + call UpdateGBCPal_BGP + ld c, 2 call DelayFrames pop af - ld [rBGP],a ; restore initial palette + ld [rBGP], a ; restore initial palette + call UpdateGBCPal_BGP ret AnimationDarkScreenPalette: @@ -1217,6 +1269,7 @@ SetAnimationBGPalette: ld a, c .next ld [rBGP], a + call UpdateGBCPal_BGP ret ld b, $5 @@ -1261,15 +1314,30 @@ AnimationWaterDropletsEverywhere: _AnimationWaterDroplets: ld hl, wOAMBuffer .loop + ld a, $1 + ld [wdef5], a ld a, [wBaseCoordY] ld [hli], a ; Y + cp 40 + jr c, .asm_792d7 + ld a, [wdef5] + inc a + ld [wdef5], a +.asm_792d7 ld a, [wBaseCoordX] add 27 ld [wBaseCoordX], a ld [hli], a ; X + cp 88 + jr c, .asm_792ee + ld a, [wdef5] + add $2 + and $3 + ld [wdef5], a +.asm_792ee ld a, [wDropletTile] ld [hli], a ; tile - xor a + ld a, [wdef5] ld [hli], a ; attribute ld a, [wBaseCoordX] cp 144 @@ -1412,16 +1480,30 @@ BattleAnimWriteOAMEntry: ; Y coordinate = e (increased by 8 each call, before the write to OAM) ; X coordinate = [wBaseCoordX] ; tile = d -; attributes = 0 +; attributes = variable (dependant on coords) + ld a, $1 + ld [wdef5], a ld a, e add 8 ld e, a ld [hli], a + cp 40 + jr c, .asm_793d8 + ld a, [wdef5] + inc a + ld [wdef5], a +.asm_793d8 ld a, [wBaseCoordX] ld [hli], a + cp 88 + jr c, .asm_793e8 + ld a, [wdef5] + add $2 + ld [wdef5], a +.asm_793e8 ld a, d ld [hli], a - xor a + ld a, [wdef5] ld [hli], a ret @@ -1473,7 +1555,7 @@ AdjustOAMBlockYPos2: ret AnimationBlinkEnemyMon: -; Make the enemy mon's sprite blink on and off for a second or two + ; Make the enemy mon's sprite blink on and off for a second or two ld hl, AnimationBlinkMon jp CallWithTurnFlipped @@ -1626,6 +1708,8 @@ AnimationSpiralBallsInward: ld a, [hl] cp $ff jr z, .done + ld a, $2 + ld [wdef5], a ld a, [wSpiralBallsBaseY] add [hl] ld [de], a ; Y @@ -1634,9 +1718,20 @@ AnimationSpiralBallsInward: ld a, [wSpiralBallsBaseX] add [hl] ld [de], a ; X + cp 88 + jr c, .asm_79524 + ld a, $3 + ld [wdef5], a +.asm_79524 inc hl inc de inc de + ld a, [de] + and $f0 + ld b, a + ld a, [wdef5] + or b + ld [de], a inc de dec c jr nz, .innerLoop @@ -1845,13 +1940,13 @@ AnimationMinimizeMon: ld hl, wTempPic push hl xor a - ld bc, $310 + ld bc, 7 * 7 * $10 call FillMemory pop hl ld de, $194 add hl, de ld de, MinimizedMonSprite - ld c, $5 + ld c, MinimizedMonSpriteEnd - MinimizedMonSprite .loop ld a, [de] ld [hli], a @@ -1865,6 +1960,7 @@ AnimationMinimizeMon: MinimizedMonSprite: INCBIN "gfx/minimized_mon_sprite.1bpp" +MinimizedMonSpriteEnd: AnimationSlideMonDownAndHide: ; Slides the mon's sprite down and disappears. Used in Acid Armor. @@ -1937,7 +2033,7 @@ _AnimationSlideMonOff: jr nz, .slideLoop ret -; Since mon pic tile numbers go from top to bottom, left to right in order, +; Since mon pic tile numbers go from top to bottom, left to right in order, ; adding the height of the mon pic in tiles to a tile number gives the tile ; number of the tile one column to the right (and thus subtracting the height ; gives the reverse). If the next tile would be past the edge of the pic, the 2 @@ -1947,10 +2043,8 @@ _AnimationSlideMonOff: .PlayerNextTile ld a, [hl] add 7 -; This is a bug. The lower right corner tile of the mon back pic is blanked -; while the mon is sliding off the screen. It should compare with the max tile -; plus one instead. - cp $61 +; bugfix: compares against the max tile + 1 as opposed to the max tile + cp $62 ret c ld a, " " ret @@ -2087,18 +2181,24 @@ AnimationSubstitute: CopySlowbroSpriteData: ld bc, $0010 ld a, BANK(SlowbroSprite) - jp FarCopyData2 + jp FarCopyData HideSubstituteShowMonAnim: ld a, [H_WHOSETURN] and a ld hl, wPlayerMonMinimized + ld de, wPlayerBattleStatus1 + ld bc, wPlayerMoveNum ld a, [wPlayerBattleStatus2] jr z, .next1 ld hl, wEnemyMonMinimized + ld de, wEnemyBattleStatus1 + ld bc, wEnemyMoveNum ld a, [wEnemyBattleStatus2] .next1 push hl + push de + push bc ; if the substitute broke, slide it down, else slide it offscreen horizontally bit HasSubstituteUp, a jr nz, .substituteStillUp @@ -2107,12 +2207,65 @@ HideSubstituteShowMonAnim: .substituteStillUp call AnimationSlideMonOff .next2 + pop bc + pop de + ld a, [de] + bit Invulnerable, a pop hl + jr nz, .invulnerable + ld a, [bc] + cp FLY + jr z, .flyOrDig + cp DIG + jr z, .flyOrDig +.invulnerable ld a, [hl] and a jp nz, AnimationMinimizeMon call AnimationFlashMonPic jp AnimationShowMonPic +.flyOrDig + ld a, [H_WHOSETURN] + and a + jr nz, .enemy + ld a, [wPlayerMonMinimized] + and a + jr nz, .monIsMinimized + ld a, [wBattleMonSpecies] + ld [wcf91], a + ld [wd0b5], a + call GetMonHeader + predef LoadMonBackPic + ret +.enemy + ld a, [wEnemyMonMinimized] + and a + jr nz, .monIsMinimized + ld a, [wEnemyMonSpecies] + ld [wcf91], a + ld [wd0b5], a + call GetMonHeader + ld de, vFrontPic + jp LoadMonFrontSprite +.monIsMinimized + ld hl, wTempPic + push hl + xor a + ld bc, 7 * 7 * $10 + call FillMemory + pop hl + ld de, $194 + add hl, de + ld de, MinimizedMonSprite + ld c, MinimizedMonSpriteEnd - MinimizedMonSprite +.loop + ld a, [de] + ld [hli], a + ld [hli], a + inc de + dec c + jr nz, .loop + jp CopyTempPicToMonPic ReshowSubstituteAnim: call AnimationSlideMonOff @@ -2180,6 +2333,23 @@ AnimationHideEnemyMonPic: ld [H_AUTOBGTRANSFERENABLED], a jp Delay3 +Func_79929: + ld hl, wPlayerMonMinimized + ld a, [H_WHOSETURN] + and a + jr z, .playerTurn + ld hl, wEnemyMonMinimized +.playerTurn + ld a, [hl] + and a + jr z, .notMinimized + call AnimationMinimizeMon + ret +.notMinimized + call AnimationFlashMonPic + call AnimationShowMonPic + ret + InitMultipleObjectsOAM: ; Writes c OAM entries with tile d. ; Sets their Y coordinates to sequential multiples of 8, starting from 0. @@ -2201,6 +2371,8 @@ InitMultipleObjectsOAM: jr nz, .loop ret + ret ; unreferenced + AnimationHideMonPic: ; Hides the mon's sprite. ld a, [H_WHOSETURN] @@ -2227,7 +2399,7 @@ ClearMonPicFromTileMap: ret ; puts the tile map destination address of a mon sprite in hl, given the row count in b -; The usual row count is 7, but it may be smaller when sliding a mon sprite in/out, +; The usual row count is 7, but it may be smaller when sliding a mon sprite in/out, ; in order to show only a portion of the mon sprite. GetMonSpriteTileMapPointerFromRowCount: push de @@ -2308,54 +2480,53 @@ GetMoveSoundB: ld b, a ret -; get the sound of the (move id - 1) in a GetMoveSound: - ld hl,MoveSoundTable - ld e,a - ld d,0 - add hl,de - add hl,de - add hl,de - ld a,[hli] - ld b,a + ld hl, MoveSoundTable + ld e, a + ld d, 0 + add hl, de + add hl, de + add hl, de + ld a, [hli] + ld b, a call IsCryMove - jr nc,.NotCryMove - ld a,[H_WHOSETURN] + jr nc, .NotCryMove + ld a, [H_WHOSETURN] and a - jr nz,.next - ld a,[wBattleMonSpecies] ; get number of current monster + jr nz, .next + ld a, [wBattleMonSpecies] ; get number of current monster jr .Continue .next - ld a,[wEnemyMonSpecies] + ld a, [wEnemyMonSpecies] .Continue push hl call GetCryData - ld b,a + ld b, a pop hl - ld a,[wFrequencyModifier] + ld a, [wFrequencyModifier] add [hl] - ld [wFrequencyModifier],a + ld [wFrequencyModifier], a inc hl - ld a,[wTempoModifier] + ld a, [wTempoModifier] add [hl] - ld [wTempoModifier],a + ld [wTempoModifier], a jr .done .NotCryMove - ld a,[hli] - ld [wFrequencyModifier],a - ld a,[hli] - ld [wTempoModifier],a + ld a, [hli] + ld [wFrequencyModifier], a + ld a, [hli] + ld [wTempoModifier], a .done - ld a,b + ld a, b ret IsCryMove: ; set carry if the move animation involves playing a monster cry - ld a,[wAnimationID] - cp a,GROWL - jr z,.CryMove - cp a,ROAR - jr z,.CryMove + ld a, [wAnimationID] + cp a, GROWL + jr z, .CryMove + cp a, ROAR + jr z, .CryMove and a ; clear carry ret .CryMove @@ -2363,172 +2534,173 @@ IsCryMove: ret MoveSoundTable: - db SFX_POUND, $00,$80 ; POUND - db SFX_BATTLE_0C, $10,$80 ; KARATE_CHOP - db SFX_DOUBLESLAP, $00,$80 ; DOUBLESLAP - db SFX_BATTLE_0B, $01,$80 ; COMET_PUNCH - db SFX_BATTLE_0D, $00,$40 ; MEGA_PUNCH - db SFX_SILPH_SCOPE, $00,$ff ; PAY_DAY - db SFX_BATTLE_0D, $10,$60 ; FIRE_PUNCH - db SFX_BATTLE_0D, $20,$80 ; ICE_PUNCH - db SFX_BATTLE_0D, $00,$a0 ; THUNDERPUNCH - db SFX_DAMAGE, $00,$80 ; SCRATCH - db SFX_BATTLE_0F, $20,$40 ; VICEGRIP - db SFX_BATTLE_0F, $00,$80 ; GUILLOTINE - db SFX_BATTLE_0E, $00,$a0 ; RAZOR_WIND - db SFX_NOT_VERY_EFFECTIVE,$10,$c0 ; SWORDS_DANCE - db SFX_NOT_VERY_EFFECTIVE,$00,$a0 ; CUT - db SFX_BATTLE_12, $00,$c0 ; GUST - db SFX_BATTLE_12, $10,$a0 ; WING_ATTACK - db SFX_BATTLE_13, $00,$e0 ; WHIRLWIND - db SFX_NOT_VERY_EFFECTIVE,$20,$c0 ; FLY - db SFX_BATTLE_14, $00,$80 ; BIND - db SFX_BATTLE_22, $00,$80 ; SLAM - db SFX_VINE_WHIP, $01,$80 ; VINE_WHIP - db SFX_BATTLE_20, $00,$80 ; STOMP - db SFX_BATTLE_17, $f0,$40 ; DOUBLE_KICK - db SFX_SUPER_EFFECTIVE, $00,$80 ; MEGA_KICK - db SFX_BATTLE_17, $00,$80 ; JUMP_KICK - db SFX_BATTLE_21, $10,$80 ; ROLLING_KICK - db SFX_BATTLE_1B, $01,$a0 ; SAND_ATTACK - db SFX_BATTLE_18, $00,$80 ; HEADBUTT - db SFX_BATTLE_1E, $00,$60 ; HORN_ATTACK - db SFX_BATTLE_1E, $01,$40 ; FURY_ATTACK - db SFX_HORN_DRILL, $00,$a0 ; HORN_DRILL - db SFX_SUPER_EFFECTIVE, $10,$a0 ; TACKLE - db SFX_BATTLE_20, $00,$c0 ; BODY_SLAM - db SFX_BATTLE_14, $10,$60 ; WRAP - db SFX_SUPER_EFFECTIVE, $00,$a0 ; TAKE_DOWN - db SFX_BATTLE_22, $11,$c0 ; THRASH - db SFX_SUPER_EFFECTIVE, $20,$c0 ; DOUBLE_EDGE - db SFX_BATTLE_21, $00,$80 ; TAIL_WHIP - db SFX_BATTLE_1B, $00,$80 ; POISON_STING - db SFX_BATTLE_1B, $20,$c0 ; TWINEEDLE - db SFX_BATTLE_19, $00,$80 ; PIN_MISSILE - db SFX_BATTLE_31, $ff,$40 ; LEER - db SFX_BATTLE_1E, $00,$80 ; BITE - db SFX_BATTLE_0B, $00,$c0 ; GROWL - db SFX_BATTLE_0B, $00,$40 ; ROAR - db SFX_BATTLE_35, $00,$80 ; SING - db SFX_BATTLE_27, $40,$60 ; SUPERSONIC - db SFX_BATTLE_27, $00,$80 ; SONICBOOM - db SFX_BATTLE_27, $ff,$40 ; DISABLE - db SFX_BATTLE_2A, $80,$c0 ; ACID - db SFX_BATTLE_19, $10,$a0 ; EMBER - db SFX_BATTLE_19, $21,$e0 ; FLAMETHROWER - db SFX_BATTLE_29, $00,$80 ; MIST - db SFX_BATTLE_24, $20,$60 ; WATER_GUN - db SFX_BATTLE_2A, $00,$80 ; HYDRO_PUMP - db SFX_BATTLE_2C, $00,$80 ; SURF - db SFX_BATTLE_28, $40,$80 ; ICE_BEAM - db SFX_BATTLE_29, $f0,$e0 ; BLIZZARD - db SFX_PSYBEAM, $00,$80 ; PSYBEAM - db SFX_BATTLE_2A, $f0,$60 ; BUBBLEBEAM - db SFX_BATTLE_28, $00,$80 ; AURORA_BEAM - db SFX_BATTLE_36, $00,$80 ; HYPER_BEAM - db SFX_PECK,$01, $a0 ; PECK - db SFX_BATTLE_13, $f0,$20 ; DRILL_PECK - db SFX_BATTLE_23, $01,$c0 ; SUBMISSION - db SFX_BATTLE_23, $00,$80 ; LOW_KICK - db SFX_SUPER_EFFECTIVE, $00,$e0 ; COUNTER - db SFX_BATTLE_26, $01,$60 ; SEISMIC_TOSS - db SFX_BATTLE_26, $20,$40 ; STRENGTH - db SFX_BATTLE_24, $00,$80 ; ABSORB - db SFX_BATTLE_24, $40,$c0 ; MEGA_DRAIN - db SFX_BATTLE_1B, $03,$60 ; LEECH_SEED - db SFX_BATTLE_25, $11,$e0 ; GROWTH - db SFX_BATTLE_12, $20,$e0 ; RAZOR_LEAF - db SFX_BATTLE_2E, $00,$80 ; SOLARBEAM - db SFX_BATTLE_1C, $00,$80 ; POISONPOWDER - db SFX_BATTLE_1C, $11,$a0 ; STUN_SPORE - db SFX_BATTLE_1C, $01,$c0 ; SLEEP_POWDER - db SFX_BATTLE_13, $14,$c0 ; PETAL_DANCE - db SFX_BATTLE_1B, $02,$a0 ; STRING_SHOT - db SFX_BATTLE_29, $f0,$80 ; DRAGON_RAGE - db SFX_BATTLE_29, $20,$c0 ; FIRE_SPIN - db SFX_BATTLE_2F, $00,$20 ; THUNDERSHOCK - db SFX_BATTLE_2F, $20,$80 ; THUNDERBOLT - db SFX_BATTLE_2E, $12,$60 ; THUNDER_WAVE - db SFX_BATTLE_26, $00,$80 ; THUNDER - db SFX_BATTLE_14, $01,$e0 ; ROCK_THROW - db SFX_BATTLE_29, $0f,$e0 ; EARTHQUAKE - db SFX_BATTLE_29, $11,$20 ; FISSURE - db SFX_DAMAGE, $10,$40 ; DIG - db SFX_BATTLE_0F, $10,$c0 ; TOXIC - db SFX_BATTLE_14, $00,$20 ; CONFUSION - db SFX_PSYCHIC_M, $00,$80 ; PSYCHIC_M - db SFX_BATTLE_35, $11,$18 ; HYPNOSIS - db SFX_BATTLE_09, $20,$c0 ; MEDITATE - db SFX_FAINT_FALL, $20,$c0 ; AGILITY - db SFX_BATTLE_25, $00,$10 ; QUICK_ATTACK - db SFX_BATTLE_26, $f0,$20 ; RAGE - db SFX_BATTLE_33, $f0,$c0 ; TELEPORT - db SFX_NOT_VERY_EFFECTIVE,$f0,$e0 ; NIGHT_SHADE - db SFX_BATTLE_09, $f0,$40 ; MIMIC - db SFX_BATTLE_31, $00,$80 ; SCREECH - db SFX_BATTLE_33, $80,$40 ; DOUBLE_TEAM - db SFX_BATTLE_33, $00,$80 ; RECOVER - db SFX_BATTLE_14, $11,$20 ; HARDEN - db SFX_BATTLE_14, $22,$10 ; MINIMIZE - db SFX_BATTLE_1B, $f1,$ff ; SMOKESCREEN - db SFX_BATTLE_13, $f1,$ff ; CONFUSE_RAY - db SFX_BATTLE_14, $33,$30 ; WITHDRAW - db SFX_BATTLE_32, $40,$c0 ; DEFENSE_CURL - db SFX_BATTLE_0E, $20,$20 ; BARRIER - db SFX_BATTLE_0E, $f0,$10 ; LIGHT_SCREEN - db SFX_BATTLE_0F, $f8,$10 ; HAZE - db SFX_NOT_VERY_EFFECTIVE,$f0,$10 ; REFLECT - db SFX_BATTLE_25, $00,$80 ; FOCUS_ENERGY - db SFX_BATTLE_18, $00,$c0 ; BIDE - db SFX_BATTLE_32, $c0,$ff ; METRONOME - db SFX_BATTLE_09, $f2,$20 ; MIRROR_MOVE - db SFX_BATTLE_34, $00,$80 ; SELFDESTRUCT - db SFX_BATTLE_34, $00,$40 ; EGG_BOMB - db SFX_BATTLE_09, $00,$40 ; LICK - db SFX_NOT_VERY_EFFECTIVE,$10,$ff ; SMOG - db SFX_BATTLE_2A, $20,$20 ; SLUDGE - db SFX_BATTLE_32, $00,$80 ; BONE_CLUB - db SFX_BATTLE_29, $1f,$20 ; FIRE_BLAST - db SFX_BATTLE_25, $2f,$80 ; WATERFALL - db SFX_BATTLE_0F, $1f,$ff ; CLAMP - db SFX_BATTLE_2B, $1f,$60 ; SWIFT - db SFX_BATTLE_26, $1e,$20 ; SKULL_BASH - db SFX_BATTLE_26, $1f,$18 ; SPIKE_CANNON - db SFX_BATTLE_14, $0f,$80 ; CONSTRICT - db SFX_BATTLE_09, $f8,$10 ; AMNESIA - db SFX_FAINT_FALL, $18,$20 ; KINESIS - db SFX_BATTLE_32, $08,$40 ; SOFTBOILED - db SFX_BATTLE_17, $01,$e0 ; HI_JUMP_KICK - db SFX_NOT_VERY_EFFECTIVE,$09,$ff ; GLARE - db SFX_BATTLE_35, $42,$01 ; DREAM_EATER - db SFX_BATTLE_1C, $00,$ff ; POISON_GAS - db SFX_BATTLE_32, $08,$e0 ; BARRAGE - db SFX_BATTLE_24, $00,$80 ; LEECH_LIFE - db SFX_BATTLE_09, $88,$10 ; LOVELY_KISS - db SFX_BATTLE_25, $48,$ff ; SKY_ATTACK - db SFX_FAINT_FALL, $ff,$ff ; TRANSFORM - db SFX_BATTLE_24, $ff,$10 ; BUBBLE - db SFX_FAINT_FALL, $ff,$04 ; DIZZY_PUNCH - db SFX_BATTLE_1C, $01,$ff ; SPORE - db SFX_BATTLE_13, $f8,$ff ; FLASH - db SFX_BATTLE_0C, $f0,$f0 ; PSYWAVE - db SFX_BATTLE_0F, $08,$10 ; SPLASH - db SFX_BATTLE_0D, $f0,$ff ; ACID_ARMOR - db SFX_SUPER_EFFECTIVE, $f0,$ff ; CRABHAMMER - db SFX_BATTLE_34, $10,$ff ; EXPLOSION - db SFX_BATTLE_0E, $f0,$20 ; FURY_SWIPES - db SFX_BATTLE_2B, $f0,$60 ; BONEMERANG - db SFX_BATTLE_21, $12,$10 ; REST - db SFX_BATTLE_36, $f0,$20 ; ROCK_SLIDE - db SFX_BATTLE_1E, $12,$ff ; HYPER_FANG - db SFX_BATTLE_31, $80,$04 ; SHARPEN - db SFX_BATTLE_33, $f0,$10 ; CONVERSION - db SFX_BATTLE_29, $f8,$ff ; TRI_ATTACK - db SFX_BATTLE_26, $f0,$ff ; SUPER_FANG - db SFX_NOT_VERY_EFFECTIVE,$01,$ff ; SLASH - db SFX_BATTLE_2C, $d8,$04 ; SUBSTITUTE - db SFX_BATTLE_0B, $00,$80 ; STRUGGLE - db SFX_BATTLE_0B, $00,$80 + ; ID, pitch mod, tempo mod + db SFX_POUND, $00, $80 ; POUND + db SFX_BATTLE_0C, $10, $80 ; KARATE_CHOP + db SFX_DOUBLESLAP, $00, $80 ; DOUBLESLAP + db SFX_BATTLE_0B, $01, $80 ; COMET_PUNCH + db SFX_BATTLE_0D, $00, $40 ; MEGA_PUNCH + db SFX_SILPH_SCOPE, $00, $ff ; PAY_DAY + db SFX_BATTLE_0D, $10, $60 ; FIRE_PUNCH + db SFX_BATTLE_0D, $20, $80 ; ICE_PUNCH + db SFX_BATTLE_0D, $00, $a0 ; THUNDERPUNCH + db SFX_DAMAGE, $00, $80 ; SCRATCH + db SFX_BATTLE_0F, $20, $40 ; VICEGRIP + db SFX_BATTLE_0F, $00, $80 ; GUILLOTINE + db SFX_BATTLE_0E, $00, $a0 ; RAZOR_WIND + db SFX_NOT_VERY_EFFECTIVE, $10, $c0 ; SWORDS_DANCE + db SFX_NOT_VERY_EFFECTIVE, $00, $a0 ; CUT + db SFX_BATTLE_12, $00, $c0 ; GUST + db SFX_BATTLE_12, $10, $a0 ; WING_ATTACK + db SFX_BATTLE_13, $00, $e0 ; WHIRLWIND + db SFX_NOT_VERY_EFFECTIVE, $20, $c0 ; FLY + db SFX_BATTLE_14, $00, $80 ; BIND + db SFX_BATTLE_22, $00, $80 ; SLAM + db SFX_VINE_WHIP, $01, $80 ; VINE_WHIP + db SFX_BATTLE_20, $00, $80 ; STOMP + db SFX_BATTLE_17, $f0, $40 ; DOUBLE_KICK + db SFX_SUPER_EFFECTIVE, $00, $80 ; MEGA_KICK + db SFX_BATTLE_17, $00, $80 ; JUMP_KICK + db SFX_BATTLE_21, $10, $80 ; ROLLING_KICK + db SFX_BATTLE_1B, $01, $a0 ; SAND_ATTACK + db SFX_BATTLE_18, $00, $80 ; HEADBUTT + db SFX_BATTLE_1E, $00, $60 ; HORN_ATTACK + db SFX_BATTLE_1E, $01, $40 ; FURY_ATTACK + db SFX_HORN_DRILL, $00, $a0 ; HORN_DRILL + db SFX_SUPER_EFFECTIVE, $10, $a0 ; TACKLE + db SFX_BATTLE_20, $00, $c0 ; BODY_SLAM + db SFX_BATTLE_14, $10, $60 ; WRAP + db SFX_SUPER_EFFECTIVE, $00, $a0 ; TAKE_DOWN + db SFX_BATTLE_22, $11, $c0 ; THRASH + db SFX_SUPER_EFFECTIVE, $20, $c0 ; DOUBLE_EDGE + db SFX_BATTLE_21, $00, $80 ; TAIL_WHIP + db SFX_BATTLE_1B, $00, $80 ; POISON_STING + db SFX_BATTLE_1B, $20, $c0 ; TWINEEDLE + db SFX_BATTLE_19, $00, $80 ; PIN_MISSILE + db SFX_BATTLE_31, $ff, $40 ; LEER + db SFX_BATTLE_1E, $00, $80 ; BITE + db SFX_BATTLE_0B, $00, $c0 ; GROWL + db SFX_BATTLE_0B, $00, $40 ; ROAR + db SFX_BATTLE_35, $00, $80 ; SING + db SFX_BATTLE_27, $40, $60 ; SUPERSONIC + db SFX_BATTLE_27, $00, $80 ; SONICBOOM + db SFX_BATTLE_27, $ff, $40 ; DISABLE + db SFX_BATTLE_2A, $80, $c0 ; ACID + db SFX_BATTLE_19, $10, $a0 ; EMBER + db SFX_BATTLE_19, $21, $e0 ; FLAMETHROWER + db SFX_EARTHQUAKE, $00, $80 ; MIST + db SFX_BATTLE_24, $20, $60 ; WATER_GUN + db SFX_BATTLE_2A, $00, $80 ; HYDRO_PUMP + db SFX_BATTLE_2C, $00, $80 ; SURF + db SFX_BATTLE_28, $40, $80 ; ICE_BEAM + db SFX_EARTHQUAKE, $f0, $e0 ; BLIZZARD + db SFX_PSYBEAM, $00, $80 ; PSYBEAM + db SFX_BATTLE_2A, $f0, $60 ; BUBBLEBEAM + db SFX_BATTLE_28, $00, $80 ; AURORA_BEAM + db SFX_BATTLE_36, $00, $80 ; HYPER_BEAM + db SFX_PECK, $01, $a0 ; PECK + db SFX_BATTLE_13, $f0, $20 ; DRILL_PECK + db SFX_BATTLE_23, $01, $c0 ; SUBMISSION + db SFX_BATTLE_23, $00, $80 ; LOW_KICK + db SFX_SUPER_EFFECTIVE, $00, $e0 ; COUNTER + db SFX_BATTLE_26, $01, $60 ; SEISMIC_TOSS + db SFX_BATTLE_26, $20, $40 ; STRENGTH + db SFX_BATTLE_24, $00, $80 ; ABSORB + db SFX_BATTLE_24, $40, $c0 ; MEGA_DRAIN + db SFX_BATTLE_1B, $03, $60 ; LEECH_SEED + db SFX_BATTLE_25, $11, $e0 ; GROWTH + db SFX_BATTLE_12, $20, $e0 ; RAZOR_LEAF + db SFX_BATTLE_2E, $00, $80 ; SOLARBEAM + db SFX_BATTLE_1C, $00, $80 ; POISONPOWDER + db SFX_BATTLE_1C, $11, $a0 ; STUN_SPORE + db SFX_BATTLE_1C, $01, $c0 ; SLEEP_POWDER + db SFX_BATTLE_13, $14, $c0 ; PETAL_DANCE + db SFX_BATTLE_1B, $02, $a0 ; STRING_SHOT + db SFX_EARTHQUAKE, $f0, $80 ; DRAGON_RAGE + db SFX_EARTHQUAKE, $20, $c0 ; FIRE_SPIN + db SFX_THUNDERBOLT, $00, $20 ; THUNDERSHOCK + db SFX_THUNDERBOLT, $20, $80 ; THUNDERBOLT + db SFX_BATTLE_2E, $12, $60 ; THUNDER_WAVE + db SFX_BATTLE_26, $00, $80 ; THUNDER + db SFX_BATTLE_14, $01, $e0 ; ROCK_THROW + db SFX_EARTHQUAKE, $0f, $e0 ; EARTHQUAKE + db SFX_EARTHQUAKE, $11, $20 ; FISSURE + db SFX_DAMAGE, $10, $40 ; DIG + db SFX_BATTLE_0F, $10, $c0 ; TOXIC + db SFX_BATTLE_14, $00, $20 ; CONFUSION + db SFX_PSYCHIC_M, $00, $80 ; PSYCHIC_M + db SFX_BATTLE_35, $11, $18 ; HYPNOSIS + db SFX_BATTLE_09, $20, $c0 ; MEDITATE + db SFX_FAINT_FALL, $20, $c0 ; AGILITY + db SFX_BATTLE_25, $00, $10 ; QUICK_ATTACK + db SFX_BATTLE_26, $f0, $20 ; RAGE + db SFX_BATTLE_33, $f0, $c0 ; TELEPORT + db SFX_NOT_VERY_EFFECTIVE, $f0, $e0 ; NIGHT_SHADE + db SFX_BATTLE_09, $f0, $40 ; MIMIC + db SFX_BATTLE_31, $00, $80 ; SCREECH + db SFX_BATTLE_33, $80, $40 ; DOUBLE_TEAM + db SFX_BATTLE_33, $00, $80 ; RECOVER + db SFX_BATTLE_14, $11, $20 ; HARDEN + db SFX_BATTLE_14, $22, $10 ; MINIMIZE + db SFX_BATTLE_1B, $f1, $ff ; SMOKESCREEN + db SFX_BATTLE_13, $f1, $ff ; CONFUSE_RAY + db SFX_BATTLE_14, $33, $30 ; WITHDRAW + db SFX_BATTLE_32, $40, $c0 ; DEFENSE_CURL + db SFX_BATTLE_0E, $20, $20 ; BARRIER + db SFX_BATTLE_0E, $f0, $10 ; LIGHT_SCREEN + db SFX_BATTLE_0F, $f8, $10 ; HAZE + db SFX_NOT_VERY_EFFECTIVE, $f0, $10 ; REFLECT + db SFX_BATTLE_25, $00, $80 ; FOCUS_ENERGY + db SFX_BATTLE_18, $00, $c0 ; BIDE + db SFX_BATTLE_32, $c0, $ff ; METRONOME + db SFX_BATTLE_09, $f2, $20 ; MIRROR_MOVE + db SFX_BATTLE_34, $00, $80 ; SELFDESTRUCT + db SFX_BATTLE_34, $00, $40 ; EGG_BOMB + db SFX_BATTLE_09, $00, $40 ; LICK + db SFX_NOT_VERY_EFFECTIVE, $10, $ff ; SMOG + db SFX_BATTLE_2A, $20, $20 ; SLUDGE + db SFX_BATTLE_32, $00, $80 ; BONE_CLUB + db SFX_EARTHQUAKE, $1f, $20 ; FIRE_BLAST + db SFX_BATTLE_25, $2f, $80 ; WATERFALL + db SFX_BATTLE_0F, $1f, $ff ; CLAMP + db SFX_BATTLE_2B, $1f, $60 ; SWIFT + db SFX_BATTLE_26, $1e, $20 ; SKULL_BASH + db SFX_BATTLE_26, $1f, $18 ; SPIKE_CANNON + db SFX_BATTLE_14, $0f, $80 ; CONSTRICT + db SFX_BATTLE_09, $f8, $10 ; AMNESIA + db SFX_FAINT_FALL, $18, $20 ; KINESIS + db SFX_BATTLE_32, $08, $40 ; SOFTBOILED + db SFX_BATTLE_17, $01, $e0 ; HI_JUMP_KICK + db SFX_NOT_VERY_EFFECTIVE, $09, $ff ; GLARE + db SFX_BATTLE_35, $42, $01 ; DREAM_EATER + db SFX_BATTLE_1C, $00, $ff ; POISON_GAS + db SFX_BATTLE_32, $08, $e0 ; BARRAGE + db SFX_BATTLE_24, $00, $80 ; LEECH_LIFE + db SFX_BATTLE_09, $88, $10 ; LOVELY_KISS + db SFX_BATTLE_25, $48, $ff ; SKY_ATTACK + db SFX_FAINT_FALL, $ff, $ff ; TRANSFORM + db SFX_BATTLE_24, $ff, $10 ; BUBBLE + db SFX_FAINT_FALL, $ff, $04 ; DIZZY_PUNCH + db SFX_BATTLE_1C, $01, $ff ; SPORE + db SFX_BATTLE_13, $f8, $ff ; FLASH + db SFX_BATTLE_0C, $f0, $f0 ; PSYWAVE + db SFX_BATTLE_0F, $08, $10 ; SPLASH + db SFX_BATTLE_0D, $f0, $ff ; ACID_ARMOR + db SFX_SUPER_EFFECTIVE, $f0, $ff ; CRABHAMMER + db SFX_BATTLE_34, $10, $ff ; EXPLOSION + db SFX_BATTLE_0E, $f0, $20 ; FURY_SWIPES + db SFX_BATTLE_2B, $f0, $60 ; BONEMERANG + db SFX_BATTLE_21, $12, $10 ; REST + db SFX_BATTLE_36, $f0, $20 ; ROCK_SLIDE + db SFX_BATTLE_1E, $12, $ff ; HYPER_FANG + db SFX_BATTLE_31, $80, $04 ; SHARPEN + db SFX_BATTLE_33, $f0, $10 ; CONVERSION + db SFX_EARTHQUAKE, $f8, $ff ; TRI_ATTACK + db SFX_BATTLE_26, $f0, $ff ; SUPER_FANG + db SFX_NOT_VERY_EFFECTIVE, $01, $ff ; SLASH + db SFX_BATTLE_2C, $d8, $04 ; SUBSTITUTE + db SFX_BATTLE_0B, $00, $80 ; STRUGGLE + db SFX_BATTLE_0B, $00, $80 CopyPicTiles: ld a, [H_WHOSETURN] @@ -2586,112 +2758,108 @@ CopyTileIDs: ret TileIDListPointerTable: - dw Unknown_79b24 - db $77 - dw Unknown_79b55 - db $57 - dw Unknown_79b78 - db $37 - dw Unknown_79b8d - db $77 - dw Unknown_79bbe - db $77 - dw Unknown_79bef - db $77 - dw Unknown_79c20 - db $86 - dw Unknown_79c50 - db $3C + dw DownscaledMonTiles_7x7 + dn 7, 7 + dw DownscaledMonTiles_5x7 + dn 5, 7 + dw DownscaledMonTiles_3x7 + dn 3, 7 + dw DownscaledMonTiles_79ce9 + dn 7, 7 + dw DownscaledMonTiles_79d1a + dn 7, 7 + dw DownscaledMonTiles_79d4b + dn 7, 7 + dw DownscaledMonTiles_79d7c + dn 8, 6 + dw DownscaledMonTiles_79dac + dn 3, 12 DownscaledMonTiles_5x5: - db $31,$38,$46,$54,$5B - db $32,$39,$47,$55,$5C - db $34,$3B,$49,$57,$5E - db $36,$3D,$4B,$59,$60 - db $37,$3E,$4C,$5A,$61 + db $31, $38, $46, $54, $5B + db $32, $39, $47, $55, $5C + db $34, $3B, $49, $57, $5E + db $36, $3D, $4B, $59, $60 + db $37, $3E, $4C, $5A, $61 DownscaledMonTiles_3x3: - db $31,$46,$5B - db $34,$49,$5E - db $37,$4C,$61 - -Unknown_79b24: - db $00,$07,$0E,$15,$1C,$23,$2A - db $01,$08,$0F,$16,$1D,$24,$2B - db $02,$09,$10,$17,$1E,$25,$2C - db $03,$0A,$11,$18,$1F,$26,$2D - db $04,$0B,$12,$19,$20,$27,$2E - db $05,$0C,$13,$1A,$21,$28,$2F - db $06,$0D,$14,$1B,$22,$29,$30 - -Unknown_79b55: - db $00,$07,$0E,$15,$1C,$23,$2A - db $01,$08,$0F,$16,$1D,$24,$2B - db $03,$0A,$11,$18,$1F,$26,$2D - db $04,$0B,$12,$19,$20,$27,$2E - db $05,$0C,$13,$1A,$21,$28,$2F - -Unknown_79b78: - db $00,$07,$0E,$15,$1C,$23,$2A - db $02,$09,$10,$17,$1E,$25,$2C - db $04,$0B,$12,$19,$20,$27,$2E - -Unknown_79b8d: - db $00,$00,$00,$00,$00,$00,$00 - db $00,$00,$00,$00,$00,$19,$00 - db $02,$06,$0B,$10,$14,$1A,$00 - db $00,$07,$0C,$11,$15,$1B,$00 - db $03,$08,$0D,$12,$16,$1C,$00 - db $04,$09,$0E,$13,$17,$1D,$1F - db $05,$0A,$0F,$01,$18,$1E,$20 - -Unknown_79bbe: - db $00,$00,$00,$30,$00,$37,$00 - db $00,$00,$2B,$31,$34,$38,$3D - db $21,$26,$2C,$01,$35,$39,$3E - db $22,$27,$2D,$32,$36,$01,$00 - db $23,$28,$2E,$33,$01,$3A,$00 - db $24,$29,$2F,$01,$01,$3B,$00 - db $25,$2A,$01,$01,$01,$3C,$00 - -Unknown_79bef: - db $00,$00,$00,$00,$00,$00,$00 - db $00,$00,$47,$4D,$00,$00,$00 - db $00,$00,$48,$4E,$52,$56,$5B - db $3F,$43,$49,$4F,$53,$57,$5C - db $40,$44,$4A,$50,$54,$58,$00 - db $41,$45,$4B,$51,$4C,$59,$5D - db $42,$46,$4C,$4C,$55,$5A,$5E - -Unknown_79c20: - db $31,$32,$32,$32,$32,$33 - db $34,$35,$36,$36,$37,$38 - db $34,$39,$3A,$3A,$3B,$38 - db $3C,$3D,$3E,$3E,$3F,$40 - db $41,$42,$43,$43,$44,$45 - db $46,$47,$43,$48,$49,$4A - db $41,$43,$4B,$4C,$4D,$4E - db $4F,$50,$50,$50,$51,$52 - -Unknown_79c50: - db $43,$55,$56,$53,$53,$53,$53,$53,$53,$53,$53,$53 - db $43,$57,$58,$54,$54,$54,$54,$54,$54,$54,$54,$54 - db $43,$59,$5A,$43,$43,$43,$43,$43,$43,$43,$43,$43 + db $31, $46, $5B + db $34, $49, $5E + db $37, $4C, $61 + +DownscaledMonTiles_7x7: + db $00, $07, $0E, $15, $1C, $23, $2A + db $01, $08, $0F, $16, $1D, $24, $2B + db $02, $09, $10, $17, $1E, $25, $2C + db $03, $0A, $11, $18, $1F, $26, $2D + db $04, $0B, $12, $19, $20, $27, $2E + db $05, $0C, $13, $1A, $21, $28, $2F + db $06, $0D, $14, $1B, $22, $29, $30 + +DownscaledMonTiles_5x7: + db $00, $07, $0E, $15, $1C, $23, $2A + db $01, $08, $0F, $16, $1D, $24, $2B + db $03, $0A, $11, $18, $1F, $26, $2D + db $04, $0B, $12, $19, $20, $27, $2E + db $05, $0C, $13, $1A, $21, $28, $2F + +DownscaledMonTiles_3x7: + db $00, $07, $0E, $15, $1C, $23, $2A + db $02, $09, $10, $17, $1E, $25, $2C + db $04, $0B, $12, $19, $20, $27, $2E + +DownscaledMonTiles_79ce9: + db $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $00, $00, $00, $19, $00 + db $02, $06, $0B, $10, $14, $1A, $00 + db $00, $07, $0C, $11, $15, $1B, $00 + db $03, $08, $0D, $12, $16, $1C, $00 + db $04, $09, $0E, $13, $17, $1D, $1F + db $05, $0A, $0F, $01, $18, $1E, $20 + +DownscaledMonTiles_79d1a: + db $00, $00, $00, $30, $00, $37, $00 + db $00, $00, $2B, $31, $34, $38, $3D + db $21, $26, $2C, $01, $35, $39, $3E + db $22, $27, $2D, $32, $36, $01, $00 + db $23, $28, $2E, $33, $01, $3A, $00 + db $24, $29, $2F, $01, $01, $3B, $00 + db $25, $2A, $01, $01, $01, $3C, $00 + +DownscaledMonTiles_79d4b: + db $00, $00, $00, $00, $00, $00, $00 + db $00, $00, $47, $4D, $00, $00, $00 + db $00, $00, $48, $4E, $52, $56, $5B + db $3F, $43, $49, $4F, $53, $57, $5C + db $40, $44, $4A, $50, $54, $58, $00 + db $41, $45, $4B, $51, $4C, $59, $5D + db $42, $46, $4C, $4C, $55, $5A, $5E + +DownscaledMonTiles_79d7c: + db $31, $32, $32, $32, $32, $33 + db $34, $35, $36, $36, $37, $38 + db $34, $39, $3A, $3A, $3B, $38 + db $3C, $3D, $3E, $3E, $3F, $40 + db $41, $42, $43, $43, $44, $45 + db $46, $47, $43, $48, $49, $4A + db $41, $43, $4B, $4C, $4D, $4E + db $4F, $50, $50, $50, $51, $52 + +DownscaledMonTiles_79dac: + db $43, $55, $56, $53, $53, $53, $53, $53, $53, $53, $53, $53 + db $43, $57, $58, $54, $54, $54, $54, $54, $54, $54, $54, $54 + db $43, $59, $5A, $43, $43, $43, $43, $43, $43, $43, $43, $43 AnimationLeavesFalling: ; Makes leaves float down from the top of the screen. This is used ; in Razor Leaf's animation. - ld a, [rOBP0] - push af ld a, [wAnimPalette] ld [rOBP0], a + call UpdateGBCPal_OBP0 ld d, $37 ; leaf tile ld a, 3 ; number of leaves ld [wNumFallingObjects], a - call AnimationFallingObjects - pop af - ld [rOBP0], a - ret + jp AnimationFallingObjects AnimationPetalsFalling: ; Makes lots of petals fall down from the top of the screen. It's used in @@ -2746,6 +2914,8 @@ FallingObjects_UpdateOAMEntry: ; movement byte. ld hl, wOAMBuffer add hl, de + ld a, $1 + ld [wdef5], a ld a, [hl] inc a inc a @@ -2754,6 +2924,12 @@ FallingObjects_UpdateOAMEntry: ld a, 160 ; if Y >= 112, put it off-screen .next ld [hli], a ; Y + cp 40 + jr c, .asm_79e51 + ld a, [wdef5] + inc a + ld [wdef5], a +.asm_79e51 ld a, [wFallingObjectMovementByte] ld b, a ld de, FallingObjects_DeltaXs @@ -2770,6 +2946,13 @@ FallingObjects_UpdateOAMEntry: ld a, [de] add [hl] ld [hli], a ; X + cp 88 + jr c, .asm_79e75 + ld a, [wdef5] + add $2 + and $3 + ld [wdef5], a +.asm_79e75 inc hl xor a ; no horizontal flip jr .next2 @@ -2779,9 +2962,19 @@ FallingObjects_UpdateOAMEntry: ld a, [hl] sub b ld [hli], a ; X + cp 88 + jr c, .asm_79e5c + ld a, [wdef5] + add $2 + and $3 + ld [wdef5], a +.asm_79e5c inc hl ld a, (1 << OAM_X_FLIP) .next2 + ld b, a + ld a, [wdef5] + or b ld [hl], a ; attribute ret @@ -2821,7 +3014,7 @@ FallingObjects_InitXCoords: ret FallingObjects_InitialXCoords: - db $38,$40,$50,$60,$70,$88,$90,$56,$67,$4A,$77,$84,$98,$32,$22,$5C,$6C,$7D,$8E,$99 + db $38, $40, $50, $60, $70, $88, $90, $56, $67, $4A, $77, $84, $98, $32, $22, $5C, $6C, $7D, $8E, $99 FallingObjects_InitMovementData: ld hl, wFallingObjectsMovementData @@ -2837,7 +3030,7 @@ FallingObjects_InitMovementData: ret FallingObjects_InitialMovementData: - db $00,$84,$06,$81,$02,$88,$01,$83,$05,$89,$09,$80,$07,$87,$03,$82,$04,$85,$08,$86 + db $00, $84, $06, $81, $02, $88, $01, $83, $05, $89, $09, $80, $07, $87, $03, $82, $04, $85, $08, $86 AnimationShakeEnemyHUD: ; Shakes the enemy HUD. @@ -2866,6 +3059,14 @@ AnimationShakeEnemyHUD: ld hl, vBGMap1 - $20 * 7 call BattleAnimCopyTileMapToVRAM +; update BGMap attributes + ld a, [hGBC] + and a + jr z, .notGBC + ld c, 13 + callba LoadBGMapAttributes +.notGBC + ; Move the window so that the row below the enemy HUD (in BG map 0) lines up ; with the top row of the window on the screen. This makes it so that the window ; covers everything below the enemy HD with a copy that looks just like what @@ -2899,13 +3100,18 @@ AnimationShakeEnemyHUD: ld [hWY], a ld hl, vBGMap1 call BattleAnimCopyTileMapToVRAM +; update BGMap attributes + ld a, [hGBC] + and a + jr z, .notGBC2 + ld c, 11 + callba LoadBGMapAttributes +.notGBC2 xor a ld [hWY], a call SaveScreenTilesToBuffer1 ld hl, vBGMap0 call BattleAnimCopyTileMapToVRAM - call ClearScreen - call Delay3 call LoadScreenTilesFromBuffer1 ld hl, vBGMap1 jp BattleAnimCopyTileMapToVRAM @@ -2950,60 +3156,60 @@ BattleAnimCopyTileMapToVRAM: jp Delay3 TossBallAnimation: - ld a,[wIsInBattle] - cp a,2 - jr z,.BlockBall ; if in trainer battle, play different animation - ld a,[wPokeBallAnimData] - ld b,a + ld a, [wIsInBattle] + cp a, 2 + jr z, .BlockBall ; if in trainer battle, play different animation + ld a, [wPokeBallAnimData] + ld b, a ; upper nybble: how many animations (from PokeBallAnimations) to play ; this will be 4 for successful capture, 6 for breakout - and a,$F0 + and a, $F0 swap a - ld c,a + ld c, a ; lower nybble: number of shakes ; store these for later - ld a,b - and a,$F - ld [wNumShakes],a + ld a, b + and a, $F + ld [wNumShakes], a - ld hl,.PokeBallAnimations + ld hl, .PokeBallAnimations ; choose which toss animation to use - ld a,[wcf91] - cp a,POKE_BALL - ld b,TOSS_ANIM - jr z,.done - cp a,GREAT_BALL - ld b,GREATTOSS_ANIM - jr z,.done - ld b,ULTRATOSS_ANIM + ld a, [wcf91] + cp a, POKE_BALL + ld b, TOSS_ANIM + jr z, .done + cp a, GREAT_BALL + ld b, GREATTOSS_ANIM + jr z, .done + ld b, ULTRATOSS_ANIM .done - ld a,b + ld a, b .PlayNextAnimation - ld [wAnimationID],a + ld [wAnimationID], a push bc push hl call PlayAnimation pop hl - ld a,[hli] + ld a, [hli] pop bc dec c - jr nz,.PlayNextAnimation + jr nz, .PlayNextAnimation ret .PokeBallAnimations: ; sequence of animations that make up the Poké Ball toss - db POOF_ANIM,HIDEPIC_ANIM,SHAKE_ANIM,POOF_ANIM,SHOWPIC_ANIM + db POOF_ANIM, HIDEPIC_ANIM, SHAKE_ANIM, POOF_ANIM, SHOWPIC_ANIM .BlockBall - ld a,TOSS_ANIM - ld [wAnimationID],a + ld a, TOSS_ANIM + ld [wAnimationID], a call PlayAnimation - ld a,SFX_FAINT_THUD + ld a, SFX_FAINT_THUD call PlaySound - ld a,BLOCKBALL_ANIM - ld [wAnimationID],a + ld a, BLOCKBALL_ANIM + ld [wAnimationID], a jp PlayAnimation PlayApplyingAttackSound: diff --git a/engine/battle/bank3d_battle.asm b/engine/battle/bank3d_battle.asm new file mode 100644 index 00000000..3719841f --- /dev/null +++ b/engine/battle/bank3d_battle.asm @@ -0,0 +1,291 @@ +InitBattle: + ld a, [wCurOpponent] + and a + jr z, asm_f6003 + +InitOpponent: + ld a, [wCurOpponent] + ld [wcf91], a + ld [wEnemyMonSpecies2], a + jr asm_f601d +asm_f6003: + ld a, [wd732] + bit 1, a + jr z, .asm_f600f + ld a, [hJoyHeld] + bit 1, a ; B button pressed? + ret nz +.asm_f600f + ld a, [wNumberOfNoRandomBattleStepsLeft] + and a + ret nz + callab TryDoWildEncounter + ret nz +asm_f601d: + ld a, [wMapPalOffset] + push af + ld hl, wLetterPrintingDelayFlags + ld a, [hl] + push af + res 1, [hl] + call InitBattleVariables ; 3d:6236 + ld a, [wEnemyMonSpecies2] + sub $c8 + jp c, InitWildBattle + ld [wTrainerClass], a + call GetTrainerInformation + callab ReadTrainer + callab DoBattleTransitionAndInitBattleVariables + call _LoadTrainerPic ; 3d:615a + xor a + ld [wEnemyMonSpecies2], a + ld [$ffe1], a + dec a + ld [wAICount], a + coord hl, 12, 0 + predef CopyUncompressedPicToTilemap + ld a, $ff + ld [wEnemyMonPartyPos], a + ld a, $2 + ld [wIsInBattle], a + + ; Is this a major story battle? + ld a,[wLoneAttackNo] + and a + jp z,InitBattle_Common + callabd_ModifyPikachuHappiness PIKAHAPPY_GYMLEADER ; useless since already in bank3d + jp InitBattle_Common + +InitWildBattle: + ld a, $1 + ld [wIsInBattle], a + callab LoadEnemyMonData + callab DoBattleTransitionAndInitBattleVariables + ld a, [wCurOpponent] + cp MAROWAK + jr z, .isGhost + callab IsGhostBattle + jr nz, .isNoGhost +.isGhost + ld hl, wMonHSpriteDim + ld a, $66 + ld [hli], a ; write sprite dimensions + ld bc, GhostPic + ld a, c + ld [hli], a ; write front sprite pointer + ld [hl], b + ld hl, wEnemyMonNick ; set name to "GHOST" + ld a, "G" + ld [hli], a + ld a, "H" + ld [hli], a + ld a, "O" + ld [hli], a + ld a, "S" + ld [hli], a + ld a, "T" + ld [hli], a + ld [hl], "@" + ld a, [wcf91] + push af + ld a, MON_GHOST + ld [wcf91], a + ld de, vFrontPic + call LoadMonFrontSprite ; load ghost sprite + pop af + ld [wcf91], a + jr .spriteLoaded +.isNoGhost + ld de, vFrontPic + call LoadMonFrontSprite ; load mon sprite +.spriteLoaded + xor a + ld [wTrainerClass], a + ld [$ffe1], a + coord hl, 12, 0 + predef CopyUncompressedPicToTilemap + +; common code that executes after init battle code specific to trainer or wild battles +InitBattle_Common: + ld b, $0 + call RunPaletteCommand + callab SlidePlayerAndEnemySilhouettesOnScreen + xor a + ld [H_AUTOBGTRANSFERENABLED], a + ld hl, .emptyString + call PrintText + call SaveScreenTilesToBuffer1 + call ClearScreen + ld a, $98 + ld [$ffbd], a + ld a, $1 + ld [H_AUTOBGTRANSFERENABLED], a + call Delay3 + ld a, $9c + ld [$ffbd], a + call LoadScreenTilesFromBuffer1 + coord hl, 9, 7 + ld bc, $50a + call ClearScreenArea + coord hl, 1, 0 + ld bc, $40a + call ClearScreenArea + call ClearSprites + ld a, [wIsInBattle] + dec a ; is it a wild battle? + ld hl, DrawEnemyHUDAndHPBar + ld b,BANK(DrawEnemyHUDAndHPBar) + call z, Bankswitch ; draw enemy HUD and HP bar if it's a wild battle + callab StartBattle + callab EndOfBattle + pop af + ld [wLetterPrintingDelayFlags], a + pop af + ld [wMapPalOffset], a + ld a, [wSavedTilesetType] + ld [hTilesetType], a + scf + ret +.emptyString + db "@" + +_LoadTrainerPic: +; wd033-wd034 contain pointer to pic + ld a, [wTrainerPicPointer] ; wd033 + ld e, a + ld a, [wTrainerPicPointer + 1] ; wd034 + ld d, a ; de contains pointer to trainer pic + ld a, [wLinkState] + and a + ld a, Bank(TrainerPics) ; this is where all the trainer pics are (not counting Red's) + jr z, .loadSprite + ld a, Bank(RedPicFront) +.loadSprite + call UncompressSpriteFromDE + ld de, vFrontPic + ld a, $77 + ld c, a + jp LoadUncompressedSpriteData + +LoadMonBackPic: +; Assumes the monster's attributes have +; been loaded with GetMonHeader. + ld a, [wBattleMonSpecies2] + ld [wcf91], a + coord hl, 1, 5 + ld bc,$708 + call ClearScreenArea + ld hl, wMonHBackSprite - wMonHeader + call UncompressMonSprite + predef ScaleSpriteByTwo + ld de, vBackPic + call InterlaceMergeSpriteBuffers ; combine the two buffers to a single 2bpp sprite + ld hl, vSprites + ld de, vBackPic + ld c, (2*SPRITEBUFFERSIZE)/16 ; count of 16-byte chunks to be copied + ld a, [H_LOADEDROMBANK] + ld b, a + jp CopyVideoData + +AnimateSendingOutMon: + ld a, [wPredefRegisters] + ld h, a + ld a, [wPredefRegisters + 1] + ld l, a + ld a, [$ffe1] + ld [H_DOWNARROWBLINKCNT1], a + ld b, $4c + ld a, [wIsInBattle] + and a + jr z, .asm_f61ef + add b + ld [hl], a + call Delay3 + ld bc, -41 + add hl, bc + ld a, $1 + ld [wNumMovesMinusOne], a + ld bc, $303 + predef CopyDownscaledMonTiles + ld c, $4 + call DelayFrames + ld bc, -41 + add hl, bc + xor a + ld [wNumMovesMinusOne], a + ld bc, $505 + predef CopyDownscaledMonTiles + ld c, $5 + call DelayFrames + ld bc, -41 + jr .asm_f61f2 +.asm_f61ef + ld bc, -123 +.asm_f61f2 + add hl, bc + ld a, [H_DOWNARROWBLINKCNT1] + add $31 + jr CopyUncompressedPicToHL + +CopyUncompressedPicToTilemap: + ld a, [wPredefRegisters] + ld h, a + ld a, [wPredefRegisters + 1] + ld l, a + ld a, [$ffe1] +CopyUncompressedPicToHL: + ld bc, $707 + ld de, $14 + push af + ld a, [wSpriteFlipped] + and a + jr nz, .asm_f6220 + pop af +.asm_f6211 + push bc + push hl +.asm_f6213 + ld [hl], a + add hl, de + inc a + dec c + jr nz, .asm_f6213 + pop hl + inc hl + pop bc + dec b + jr nz, .asm_f6211 + ret + +.asm_f6220 + push bc + ld b, $0 + dec c + add hl, bc + pop bc + pop af +.asm_f6227 + push bc + push hl +.asm_f6229 + ld [hl], a + add hl, de + inc a + dec c + jr nz, .asm_f6229 + pop hl + dec hl + pop bc + dec b + jr nz, .asm_f6227 + ret + +INCLUDE "engine/battle/init_battle_variables.asm" +INCLUDE "engine/battle/moveEffects/focus_energy_effect.asm" +INCLUDE "engine/battle/moveEffects/heal_effect.asm" +INCLUDE "engine/battle/moveEffects/transform_effect.asm" +INCLUDE "engine/battle/moveEffects/reflect_light_screen_effect.asm" +INCLUDE "engine/battle/moveEffects/mist_effect.asm" +INCLUDE "engine/battle/moveEffects/one_hit_ko_effect.asm" +INCLUDE "engine/battle/moveEffects/pay_day_effect.asm" +INCLUDE "engine/battle/moveEffects/paralyze_effect.asm" diff --git a/engine/battle/bank_e_misc.asm b/engine/battle/bank_e_misc.asm index 33af6f6f..df9145f2 100755 --- a/engine/battle/bank_e_misc.asm +++ b/engine/battle/bank_e_misc.asm @@ -101,22 +101,3 @@ InitList: ld a, b ld [wItemPrices + 1], a ret - -; get species of mon e in list [wMonDataLocation] for LoadMonData -GetMonSpecies: - ld hl, wPartySpecies - ld a, [wMonDataLocation] - and a - jr z, .getSpecies - dec a - jr z, .enemyParty - ld hl, wBoxSpecies - jr .getSpecies -.enemyParty - ld hl, wEnemyPartyMons -.getSpecies - ld d, 0 - add hl, de - ld a, [hl] - ld [wcf91], a - ret diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index 9e02c56f..a4871837 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -1,5 +1,5 @@ BattleTransition: - ld a, 1 + ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a call Delay3 xor a @@ -196,6 +196,9 @@ BattleTransition_BlackScreen: ld [rBGP], a ld [rOBP0], a ld [rOBP1], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 ret ; for non-dungeon trainer battles @@ -359,7 +362,8 @@ BattleTransition_FlashScreen_: cp $1 jr z, .done ld [rBGP], a - ld c, 2 + call UpdateGBCPal_BGP + ld c, $2 call DelayFrames jr .loop .done @@ -373,7 +377,7 @@ BattleTransition_FlashScreenPalettes: ; used for low level trainer dungeon battles BattleTransition_Shrink: - ld c, SCREEN_HEIGHT / 2 + ld c,9 .loop push bc xor a @@ -407,7 +411,7 @@ BattleTransition_Shrink: ; used for high level trainer dungeon battles BattleTransition_Split: - ld c, SCREEN_HEIGHT / 2 + ld c,$9 xor a ld [H_AUTOBGTRANSFERENABLED], a .loop @@ -628,7 +632,7 @@ BattleTransition_Circle_Sub1: ret BattleTransition_TransferDelay3: - ld a, 1 + ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a call Delay3 xor a diff --git a/engine/battle/common_text.asm b/engine/battle/common_text.asm index 3d46c947..02bb1a61 100644 --- a/engine/battle/common_text.asm +++ b/engine/battle/common_text.asm @@ -1,5 +1,5 @@ PrintBeginningBattleText: - ld a, [wIsInBattle] + ld a, [wIsInBattle] ; W_ISINBATTLE dec a jr nz, .trainerBattle ld a, [wCurMap] @@ -8,8 +8,20 @@ PrintBeginningBattleText: cp LAVENDER_HOUSE_1 jr c, .pokemonTower .notPokemonTower + ld a,[wBattleType] + cp BATTLE_TYPE_PIKACHU + jr nz,.notPikachuBattle + callab IsPlayerPikachuAsleepInParty + ld e,$24 + jr c,.asm_f4026 + ld e,$a +.asm_f4026 + callab PlayPikachuSoundClip + jr .continue +.notPikachuBattle ld a, [wEnemyMonSpecies2] call PlayCry +.continue ld hl, WildMonAppearedText ld a, [wMoveMissed] and a @@ -23,9 +35,13 @@ PrintBeginningBattleText: call DelayFrames ld hl, TrainerWantsToFightText .wildBattle + ld a, [wBattleType] + and a + jr nz, .doNotDrawPokeballs push hl callab DrawAllPokeballs pop hl +.doNotDrawPokeballs call PrintText jr .done .pokemonTower @@ -64,7 +80,7 @@ PrintBeginningBattleText: ld [wFrequencyModifier], a ld a, $80 ld [wTempoModifier], a - ld a, SFX_SILPH_SCOPE + ld a, $e9 ; (SFX_08_77 - SFX_Headers_08) / 3 call PlaySound jp WaitForSoundToFinish .done diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 3b474584..6805fbfe 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -157,6 +157,9 @@ SlidePlayerAndEnemySilhouettesOnScreen: ld [rBGP], a ld [rOBP0], a ld [rOBP1], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 .slideSilhouettesLoop ; slide silhouettes of the player's pic and the enemy's pic onto the screen ld h, b ld l, $40 @@ -246,10 +249,16 @@ StartBattle: call DelayFrames call SaveScreenTilesToBuffer1 .checkAnyPartyAlive + ld a, [wBattleType] + cp BATTLE_TYPE_RUN + jp z, .specialBattle + cp BATTLE_TYPE_PIKACHU + jp z, .specialBattle call AnyPartyAlive ld a, d and a jp z, HandlePlayerBlackOut ; jump if no mon is alive +.specialBattle call LoadScreenTilesFromBuffer1 ld a, [wBattleType] and a ; is it a normal battle? @@ -443,7 +452,7 @@ MainInBattleLoop: ; the link battle enemy has switched mons ld a, [wPlayerBattleStatus1] bit UsingTrappingMove, a ; check if using multi-turn move like Wrap - jr z, .asm_3c2dd + jr z, .specialMoveNotUsed ld a, [wPlayerMoveListIndex] ld hl, wBattleMonMoves ld c, a @@ -452,9 +461,9 @@ MainInBattleLoop: ld a, [hl] cp METRONOME ; a MIRROR MOVE check is missing, might lead to a desync in link battles ; when combined with multi-turn moves - jr nz, .asm_3c2dd + jr nz, .specialMoveNotUsed ld [wPlayerSelectedMove], a -.asm_3c2dd +.specialMoveNotUsed callab SwitchEnemyMon .noLinkBattle ld a, [wPlayerSelectedMove] @@ -665,7 +674,7 @@ HandlePoisonBurnLeechSeed_DecreaseOwnHP: and a jr z, .playersTurn ld hl, wEnemyBattleStatus3 - ld de, wEnemyToxcCounter + ld de, wEnemyToxicCounter .playersTurn bit BadlyPoisoned, [hl] jr z, .noToxic @@ -884,6 +893,8 @@ FaintEnemyPokemon: ld a, MUSIC_DEFEATED_WILD_MON call PlayBattleVictoryMusic .sfxplayed +; bug: win sfx is played for wild battles before checking for player mon HP +; this can lead to odd scenarios where both player and enemy faint, as the win sfx plays yet the player never won the battle ld hl, wBattleMonHP ld a, [hli] or [hl] @@ -981,6 +992,11 @@ ReplaceFaintedEnemyMon: ld hl, wEnemyHPBarColor ld e, $30 call GetBattleHealthBarColor + setpal SHADE_BLACK, SHADE_DARK, SHADE_LIGHT, SHADE_WHITE + ld [rOBP0], a + ld [rOBP1], a + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 callab DrawEnemyPokeballs ld a, [wLinkState] cp LINK_STATE_BATTLING @@ -1046,9 +1062,7 @@ TrainerDefeatedText: PlayBattleVictoryMusic: push af - ld a, $ff - ld [wNewSoundID], a - call PlaySoundWaitForCurrent + call StopAllMusic ld c, BANK(Music_DefeatedTrainer) pop af call PlayMusic @@ -1102,6 +1116,7 @@ RemoveFaintedPlayerMon: ld a, $ff ld [wLowHealthAlarm], a ;disable low health alarm call WaitForSoundToFinish + xor a .skipWaitForSound ; a is 0, so this zeroes the enemy's accumulated damage. ld hl, wEnemyBideAccumulatedDamage @@ -1126,10 +1141,36 @@ RemoveFaintedPlayerMon: and a ; was this called by HandleEnemyMonFainted? ret z ; if so, return + ld a, [wPlayerMonNumber] + ld [wWhichPokemon], a + callab IsThisPartymonStarterPikachu_Party + jr nc, .notPlayerPikachu + ld e, $3 + callab PlayPikachuSoundClip + jr .printText +.notPlayerPikachu ld a, [wBattleMonSpecies] call PlayCry +.printText ld hl, PlayerMonFaintedText - jp PrintText + call PrintText + ld a, [wPlayerMonNumber] + ld [wWhichPokemon], a + ld a, [wBattleMonLevel] + ld b, a + ld a, [wEnemyMonLevel] + sub b ; enemylevel - playerlevel + ; are we stronger than the opposing pokemon? + jr c, .regularFaint ; if so, deduct happiness regularly + + cp 30 ; is the enemy 30 levels greater than us? + jr nc, .carelessTrainer ; if so, punish the player for being careless, as they shouldn't be fighting a very high leveled trainer with such a level difference +.regularFaint + callabd_ModifyPikachuHappiness PIKAHAPPY_FAINTED + ret +.carelessTrainer + callabd_ModifyPikachuHappiness PIKAHAPPY_CARELESSTRAINER + ret PlayerMonFaintedText: TX_FAR _PlayerMonFaintedText @@ -1186,7 +1227,7 @@ ChooseNextMon: ld a, [wLinkState] cp LINK_STATE_BATTLING jr nz, .notLinkBattle - inc a + ld a, $1 ld [wActionResultOrTookBattleTurn], a call LinkBattleExchangeData .notLinkBattle @@ -1285,7 +1326,7 @@ SlideDownFaintedMonPic: call CopyData pop de pop hl - ld bc, -20 + ld bc, -SCREEN_WIDTH add hl, bc push hl ld h, d @@ -1297,7 +1338,7 @@ SlideDownFaintedMonPic: pop bc dec b jr nz, .rowLoop - ld bc, 20 + ld bc, SCREEN_WIDTH add hl, bc ld de, SevenSpacesText call PlaceString @@ -1586,6 +1627,8 @@ TryRunningFromBattle: ld a, [wBattleType] cp BATTLE_TYPE_SAFARI jp z, .canEscape ; jump if it's a safari battle + cp BATTLE_TYPE_RUN + jp z, .canEscape ; hurry, get away? ld a, [wLinkState] cp LINK_STATE_BATTLING jp z, .canEscape @@ -1841,19 +1884,46 @@ SendOutMon: call RunPaletteCommand ld hl, wEnemyBattleStatus1 res UsingTrappingMove, [hl] + callab IsThisPartymonStarterPikachu + jr c, .starterPikachu ld a, $1 ld [H_WHOSETURN], a ld a, POOF_ANIM call PlayMoveAnimation coord hl, 4, 11 predef AnimateSendingOutMon + jr .playRegularCry +.starterPikachu + xor a + ld [H_WHOSETURN], a + ld a, $1 + ld [H_AUTOBGTRANSFERENABLED], a + callab StarterPikachuBattleEntranceAnimation + callab IsPlayerPikachuAsleepInParty + ld e, $24 + jr c, .asm_3cd81 + ld e, $a +.asm_3cd81 + callab PlayPikachuSoundClip + jr .done +.playRegularCry ld a, [wcf91] call PlayCry +.done call PrintEmptyString jp SaveScreenTilesToBuffer1 ; show 2 stages of the player mon getting smaller before disappearing AnimateRetreatingPlayerMon: + ld a, [wWhichPokemon] + push af + ld a, [wPlayerMonNumber] + ld [wWhichPokemon], a + callab IsThisPartymonStarterPikachu + pop bc + ld a, b + ld [wWhichPokemon], a + jr c, .starterPikachu coord hl, 1, 5 lb bc, 7, 7 call ClearScreenArea @@ -1877,10 +1947,17 @@ AnimateRetreatingPlayerMon: call .clearScreenArea ld a, $4c Coorda 5, 11 + jr .clearScreenArea +.starterPikachu + xor a + ld [H_WHOSETURN], a + callab AnimationSlideMonOff + ret .clearScreenArea coord hl, 1, 5 lb bc, 7, 7 - jp ClearScreenArea + call ClearScreenArea ; jp + ret ; reads player's current mon's HP into wBattleMonHP ReadPlayerMonCurHPAndStatus: @@ -1925,9 +2002,9 @@ DrawPlayerHUDAndHPBar: ld de, wLoadedMonStatus call PrintStatusConditionNotFainted pop hl - jr nz, .asm_3cdae + jr nz, .doNotPrintLevel call PrintLevel -.asm_3cdae +.doNotPrintLevel ld a, [wLoadedMonSpecies] ld [wcf91], a coord hl, 10, 9 @@ -1939,14 +2016,14 @@ DrawPlayerHUDAndHPBar: ld hl, wBattleMonHP ld a, [hli] or [hl] - jr z, .asm_3cdd9 + jr z, .fainted ld a, [wLowHealthAlarmDisabled] and a ; has the alarm been disabled because the player has already won? ret nz ; if so, return ld a, [wPlayerHPBarColor] cp HP_BAR_RED - jr z, .asm_3cde6 -.asm_3cdd9 + jr z, .setLowHealthAlarm +.fainted ld hl, wLowHealthAlarm bit 7, [hl] ;low health alarm enabled? ld [hl], $0 @@ -1954,7 +2031,7 @@ DrawPlayerHUDAndHPBar: xor a ld [wChannelSoundIDs + CH4], a ret -.asm_3cde6 +.setLowHealthAlarm ld hl, wLowHealthAlarm set 7, [hl] ;enable low health alarm ret @@ -2102,36 +2179,49 @@ DisplayBattleMenu: ld [wTextBoxID], a call DisplayTextBoxID ld a, [wBattleType] - dec a - jp nz, .handleBattleMenuInput ; handle menu input if it's not the old man tutorial -; the following happens for the old man tutorial + cp BATTLE_TYPE_OLD_MAN + jr z, .doSimulatedMenuInput ; simulate menu input if it's the old man or prof. oak pikachu battle + cp BATTLE_TYPE_PIKACHU + jr z, .doSimulatedMenuInput + jp .handleBattleMenuInput +; the following happens for the old man tutorial and prof. oak pikachu battle +.doSimulatedMenuInput ld hl, wPlayerName ld de, wGrassRate ld bc, NAME_LENGTH call CopyData ; temporarily save the player name in unused space, ; which is supposed to get overwritten when entering a - ; map with wild Pokémon. Due to an oversight, the data + ; map with wild Pokémon. + ; In Red/Blue, due to an oversight, the data ; may not get overwritten (cinnabar) and the infamous - ; Missingno. glitch can show up. + ; Missingno. glitch can show up. However, + ; this has been fixed in yellow ld hl, .oldManName + ld a, [wBattleType] + dec a + jr z, .useOldManName + ld hl, .profOakName +.useOldManName ld de, wPlayerName ld bc, NAME_LENGTH call CopyData ; the following simulates the keystrokes by drawing menus on screen coord hl, 9, 14 ld [hl], "▶" - ld c, 80 + ld c, 20 call DelayFrames ld [hl], " " coord hl, 9, 16 ld [hl], "▶" - ld c, 50 + ld c, 20 call DelayFrames ld [hl], $ec ld a, $2 ; select the "ITEM" menu jp .upperLeftMenuItemWasNotSelected .oldManName db "OLD MAN@" +.profOakName + db "PROF.OAK@" .handleBattleMenuInput ld a, [wBattleAndStartSavedMenuItem] ld [wCurrentMenuItem], a @@ -2214,6 +2304,9 @@ DisplayBattleMenu: .AButtonPressed call PlaceUnfilledArrowMenuCursor ld a, [wBattleType] + cp BATTLE_TYPE_RUN + jr z, .handleUnusedBattle + ld a, [wBattleType] cp BATTLE_TYPE_SAFARI ld a, [wCurrentMenuItem] ld [wBattleAndStartSavedMenuItem], a @@ -2245,7 +2338,18 @@ DisplayBattleMenu: .throwSafariBallWasSelected ld a, SAFARI_BALL ld [wcf91], a - jr UseBagItem + jp UseBagItem +.handleUnusedBattle + ld a, [wCurrentMenuItem] + cp $3 + jp z, BattleMenu_RunWasSelected + ld hl, .RunAwayText + call PrintText + jp DisplayBattleMenu + +.RunAwayText ; 3d0df (f:50df) + TX_FAR _RunAwayText + db "@" .upperLeftMenuItemWasNotSelected ; a menu item other than the upper left item was selected cp $2 @@ -2282,19 +2386,23 @@ BagWasSelected: call DrawHUDsAndHPBars .next ld a, [wBattleType] - dec a ; is it the old man tutorial? - jr nz, DisplayPlayerBag ; no, it is a normal battle - ld hl, OldManItemList + cp BATTLE_TYPE_OLD_MAN ; is it the old man tutorial? + jr z, .simulatedInputBattle + cp BATTLE_TYPE_PIKACHU ; is it the prof oak battle with pikachu? + jr z, .simulatedInputBattle + jr DisplayPlayerBag +.simulatedInputBattle + ld hl, SimulatedInputBattleItemList ld a, l ld [wListPointer], a ld a, h ld [wListPointer + 1], a jr DisplayBagMenu -OldManItemList: - db 1 ; # items - db POKE_BALL, 50 - db -1 +SimulatedInputBattleItemList: + db 1 ; # of items + db POKE_BALL, 1 + db $ff DisplayPlayerBag: ; get the pointer to player's bag when in a normal battle @@ -2453,6 +2561,8 @@ PartyMenuOrRockOrRun: predef StatusScreen predef StatusScreen2 ; now we need to reload the enemy mon pic + ld a, $1 + ld [H_WHOSETURN], a ld a, [wEnemyBattleStatus2] bit HasSubstituteUp, a ; does the enemy mon have a substitute? ld hl, AnimationSubstitute @@ -2557,13 +2667,13 @@ MoveSelectionMenu: .writemoves ld de, wMovesString - ld a, [hFlags_0xFFF6] + ld a, [hFlags_0xFFFA] set 2, a - ld [hFlags_0xFFF6], a + ld [hFlags_0xFFFA], a call PlaceString - ld a, [hFlags_0xFFF6] + ld a, [hFlags_0xFFFA] res 2, a - ld [hFlags_0xFFF6], a + ld [hFlags_0xFFFA], a ret .regularmenu @@ -2572,9 +2682,9 @@ MoveSelectionMenu: ld hl, wBattleMonMoves call .loadmoves coord hl, 4, 12 - ld b, $4 - ld c, $e - di + lb bc, 4, 14 + di ; out of pure coincidence, it is possible for vblank to occur between the di and ei + ; so it is necessary to put the di ei block to not cause tearing call TextBoxBorder coord hl, 4, 12 ld [hl], $7a @@ -2590,8 +2700,7 @@ MoveSelectionMenu: ld hl, wEnemyMonMoves call .loadmoves coord hl, 0, 7 - ld b, $4 - ld c, $e + lb bc, 4, 14 call TextBoxBorder coord hl, 2, 8 call .writemoves @@ -2605,8 +2714,7 @@ MoveSelectionMenu: call AddNTimes call .loadmoves coord hl, 4, 7 - ld b, $4 - ld c, $e + lb bc, 4, 14 call TextBoxBorder coord hl, 6, 8 call .writemoves @@ -2620,8 +2728,6 @@ MoveSelectionMenu: ld a, [wMoveMenuType] cp $1 jr z, .selectedmoveknown - ld a, $1 - jr nc, .selectedmoveknown ld a, [wPlayerMoveListIndex] inc a .selectedmoveknown @@ -2682,15 +2788,15 @@ SelectMenuItem: call AddNTimes ld [hl], $ec .select - ld hl, hFlags_0xFFF6 + ld hl, hFlags_0xFFFA set 1, [hl] call HandleMenuInput - ld hl, hFlags_0xFFF6 + ld hl, hFlags_0xFFFA res 1, [hl] bit 6, a - jp nz, CursorUp ; up + jp nz, SelectMenuItem_CursorUp ; up bit 7, a - jp nz, CursorDown ; down + jp nz, SelectMenuItem_CursorDown ; down bit 2, a jp nz, SwapMovesInMenu ; select bit 1, a ; B, but was it reset above? @@ -2703,10 +2809,10 @@ SelectMenuItem: ld b, a ld a, [wMoveMenuType] dec a ; if not mimic - jr nz, .nob + jr nz, .notB pop af ret -.nob +.notB dec a ld a, b ld [wPlayerMoveListIndex], a @@ -2723,7 +2829,7 @@ SelectMenuItem: add hl, bc ld a, [hl] and $3f - jr z, .nopp + jr z, .noPP ld a, [wPlayerDisabledMove] swap a and $f @@ -2746,7 +2852,7 @@ SelectMenuItem: .disabled ld hl, MoveDisabledText jr .print -.nopp +.noPP ld hl, MoveNoPPText .print call PrintText @@ -2764,7 +2870,7 @@ MoveDisabledText: WhichTechniqueString: db "WHICH TECHNIQUE?@" -CursorUp: +SelectMenuItem_CursorUp: ld a, [wCurrentMenuItem] and a jp nz, SelectMenuItem @@ -2774,7 +2880,7 @@ CursorUp: ld [wCurrentMenuItem], a jp SelectMenuItem -CursorDown: +SelectMenuItem_CursorDown: ld a, [wCurrentMenuItem] ld b, a ld a, [wNumMovesMinusOne] @@ -2787,6 +2893,55 @@ CursorDown: ld [wCurrentMenuItem], a jp SelectMenuItem +Func_3d4f5: + bit 3, a + ld a, $0 + jr nz, .asm_3d4fd + ld a, $1 +.asm_3d4fd + ld [H_WHOSETURN], a + call LoadScreenTilesFromBuffer1 + call Func_3d536 + ld a, [wTestBattlePlayerSelectedMove] + and a + jp z, MoveSelectionMenu + ld [wAnimationID], a + xor a + ld [wAnimationType], a + predef MoveAnimation + callab Func_78e98 + jp MoveSelectionMenu + +Func_3d523: + ld a, [wTestBattlePlayerSelectedMove] + dec a + jr asm_3d52d +Func_3d529: + ld a, [wTestBattlePlayerSelectedMove] + inc a +asm_3d52d: + ld [wTestBattlePlayerSelectedMove], a + call Func_3d536 + jp MoveSelectionMenu + +Func_3d536: + coord hl, 10, 16 + lb bc, 2, 10 + call ClearScreenArea + coord hl, 10, 17 + ld de, wTestBattlePlayerSelectedMove + lb bc, LEADING_ZEROES | 1, 3 + call PrintNumber + ld a, [wTestBattlePlayerSelectedMove] + and a + ret z + cp STRUGGLE + ret nc + ld [wd11e], a + call GetMoveName + coord hl, 13, 17 + jp PlaceString + AnyMoveToSelect: ; return z and Struggle as the selected move if all moves have 0 PP and/or are disabled ld a, STRUGGLE @@ -2794,7 +2949,7 @@ AnyMoveToSelect: ld a, [wPlayerDisabledMove] and a ld hl, wBattleMonPP - jr nz, .asm_3d40e + jr nz, .handleDisabledMove ld a, [hli] or [hl] inc hl @@ -2803,26 +2958,29 @@ AnyMoveToSelect: or [hl] and $3f ret nz - jr .asm_3d423 -.asm_3d40e + jr .noMovesLeft +.handleDisabledMove swap a - and $f + and $f ; get move disabled ld b, a - ld d, $5 + ld d, NUM_MOVES + 1 xor a -.asm_3d416 +.handleDisabledMovePPLoop dec d - jr z, .asm_3d421 - ld c, [hl] + jr z, .allMovesChecked + ld c, [hl] ; get move PP inc hl - dec b - jr z, .asm_3d416 + dec b ; is this the disabled move? + jr z, .handleDisabledMovePPLoop ; if so, ignore its PP value or c - jr .asm_3d416 -.asm_3d421 - and a - ret nz -.asm_3d423 + jr .handleDisabledMovePPLoop +.allMovesChecked +; bugfix: only check PP value and not PP up bits +; in case all other moves have no PP left and a move has a PP up used on it +; and a non-PP up move is disabled + and $3f ; any PP left? + ret nz ; return if a move has PP left +.noMovesLeft ld hl, NoMovesLeftText call PrintText ld c, 60 @@ -2835,6 +2993,9 @@ NoMovesLeftText: db "@" SwapMovesInMenu: + ld a, [wPlayerBattleStatus3] + bit Transformed, a + jp nz, MoveSelectionMenu ld a, [wMenuItemToSwap] and a jr z, .noMenuItemSelected @@ -2914,8 +3075,7 @@ PrintMenuItem: xor a ld [H_AUTOBGTRANSFERENABLED], a coord hl, 0, 8 - ld b, $3 - ld c, $9 + lb bc, 3, 9 call TextBoxBorder ld a, [wPlayerDisabledMove] and a @@ -2982,7 +3142,7 @@ PrintMenuItem: jp Delay3 DisabledText: - db "disabled!@" + db "Disabled!@" TypeText: db "TYPE@" @@ -2997,7 +3157,7 @@ SelectEnemyMove: call LoadScreenTilesFromBuffer1 ld a, [wSerialExchangeNybbleReceiveData] cp $e - jp z, .asm_3d601 + jp z, .linkedOpponentUsedStruggle cp $d jr z, .unableToSelectMove cp $4 @@ -3075,7 +3235,7 @@ SelectEnemyMove: .done ld [wEnemySelectedMove], a ret -.asm_3d601 +.linkedOpponentUsedStruggle ld a, STRUGGLE jr .done @@ -3205,7 +3365,7 @@ PlayerCalcMoveDamage: call RandomizeDamage .moveHitTest call MoveHitTest -handleIfPlayerMoveMissed +handleIfPlayerMoveMissed: ld a,[wMoveMissed] and a jr z,getPlayerAnimationType @@ -3213,13 +3373,13 @@ handleIfPlayerMoveMissed sub a,EXPLODE_EFFECT jr z,playPlayerMoveAnimation ; don't play any animation if the move missed, unless it was EXPLODE_EFFECT jr playerCheckIfFlyOrChargeEffect -getPlayerAnimationType +getPlayerAnimationType: ld a,[wPlayerMoveEffect] and a ld a,4 ; move has no effect other than dealing damage jr z,playPlayerMoveAnimation ld a,5 ; move has effect -playPlayerMoveAnimation +playPlayerMoveAnimation ; 3d890 (f:5890) push af ld a,[wPlayerBattleStatus2] bit HasSubstituteUp,a @@ -3238,7 +3398,7 @@ playPlayerMoveAnimation ld b,BANK(ReshowSubstituteAnim) call nz,Bankswitch jr MirrorMoveCheck -playerCheckIfFlyOrChargeEffect +playerCheckIfFlyOrChargeEffect ; 3d8bd (f:58bd) ld c,30 call DelayFrames ld a,[wPlayerMoveEffect] @@ -3252,7 +3412,7 @@ playerCheckIfFlyOrChargeEffect ld [wAnimationType],a ld a,STATUS_AFFECTED_ANIM call PlayMoveAnimation -MirrorMoveCheck +MirrorMoveCheck: ld a,[wPlayerMoveEffect] cp a,MIRROR_MOVE_EFFECT jr nz,.metronomeCheck @@ -3785,10 +3945,10 @@ MonName1Text: and a ld a, [wPlayerMoveNum] ld hl, wPlayerUsedMove - jr z, .asm_3db11 + jr z, .playerTurn ld a, [wEnemyMoveNum] ld hl, wEnemyUsedMove -.asm_3db11 +.playerTurn ld [hl], a ld [wd11e], a call DetermineExclamationPointTextNum @@ -3902,11 +4062,13 @@ DetermineExclamationPointTextNum: ret ExclamationPointMoveSets: +; a grammar mistake was fixed (only concerning japanese) +; BIDE is in category 3, moved from category 2 db SWORDS_DANCE, GROWTH db $00 - db RECOVER, BIDE, SELFDESTRUCT, AMNESIA + db RECOVER, SELFDESTRUCT, AMNESIA db $00 - db MEDITATE, AGILITY, TELEPORT, MIMIC, DOUBLE_TEAM, BARRAGE + db MEDITATE, AGILITY, TELEPORT, MIMIC, DOUBLE_TEAM, BIDE, BARRAGE db $00 db POUND, SCRATCH, VICEGRIP, WING_ATTACK, FLY, BIND, SLAM, HORN_ATTACK, BODY_SLAM db WRAP, THRASH, TAIL_WHIP, LEER, BITE, GROWL, ROAR, SING, PECK, COUNTER @@ -3943,7 +4105,7 @@ PrintMoveFailureText: ret nz ; if you get here, the mon used jump kick or hi jump kick and missed - ld hl, wDamage ; since the move missed, wDamage will always contain 0 at this point. + ld hl, wDamage ; since the move missed, W_DAMAGE will always contain 0 at this point. ; Thus, recoil damage will always be equal to 1 ; even if it was intended to be potential damage/8. ld a, [hli] @@ -4590,31 +4752,31 @@ CalculateDamage: ld a, [H_QUOTIENT + 3] add b ld [H_QUOTIENT + 3], a - jr nc, .asm_3dfd0 + jr nc, .asm_3e142 ld a, [H_QUOTIENT + 2] inc a ld [H_QUOTIENT + 2], a and a - jr z, .asm_3e004 + jr z, .asm_3e176 -.asm_3dfd0 +.asm_3e142 ld a, [H_QUOTIENT] ld b, a ld a, [H_QUOTIENT + 1] or a - jr nz, .asm_3e004 + jr nz, .asm_3e176 ld a, [H_QUOTIENT + 2] cp 998 / $100 - jr c, .asm_3dfe8 + jr c, .asm_3e15a cp 998 / $100 + 1 - jr nc, .asm_3e004 + jr nc, .asm_3e176 ld a, [H_QUOTIENT + 3] cp 998 % $100 - jr nc, .asm_3e004 + jr nc, .asm_3e176 -.asm_3dfe8 +.asm_3e15a inc hl ld a, [H_QUOTIENT + 3] ld b, [hl] @@ -4625,26 +4787,26 @@ CalculateDamage: ld b, [hl] adc b ld [hl], a - jr c, .asm_3e004 + jr c, .asm_3e176 ld a, [hl] cp 998 / $100 - jr c, .asm_3e00a + jr c, .asm_3e17c cp 998 / $100 + 1 - jr nc, .asm_3e004 + jr nc, .asm_3e176 inc hl ld a, [hld] cp 998 % $100 - jr c, .asm_3e00a + jr c, .asm_3e17c -.asm_3e004 +.asm_3e176 ; cap at 997 ld a, 997 / $100 ld [hli], a ld a, 997 % $100 ld [hld], a -.asm_3e00a +.asm_3e17c ; add 2 inc hl ld a, [hl] @@ -4674,7 +4836,7 @@ UnusedHighCriticalMoves: db $FF ; determines if attack is a critical hit -; azure heights claims "the fastest pokémon (who are,not coincidentally, +; azure heights claims "the fastest pokémon (who are, not coincidentally, ; among the most popular) tend to CH about 20 to 25% of the time." CriticalHitTest: xor a @@ -4682,9 +4844,9 @@ CriticalHitTest: ld a, [H_WHOSETURN] and a ld a, [wEnemyMonSpecies] - jr nz, .asm_3e032 + jr nz, .handleEnemy ld a, [wBattleMonSpecies] -.asm_3e032 +.handleEnemy ld [wd0b5], a call GetMonHeader ld a, [wMonHBaseSpeed] @@ -5051,7 +5213,7 @@ ApplyDamageToPlayerPokemon: ld a,$01 ld [wHPBarType],a predef UpdateHPBar2 ; animate the HP bar shortening -ApplyAttackToPlayerPokemonDone +ApplyAttackToPlayerPokemonDone: jp DrawHUDsAndHPBars AttackSubstitute: @@ -5095,7 +5257,7 @@ AttackSubstitute: ld a,[H_WHOSETURN] xor a,$01 ld [H_WHOSETURN],a - callab HideSubstituteShowMonAnim ; animate the substitute breaking + callab Func_79929 ; animate the substitute breaking ; flip the turn back to the way it was ld a,[H_WHOSETURN] xor a,$01 @@ -5392,32 +5554,26 @@ AdjustDamageForMoveType: .done ret -; function to tell how effective the type of an enemy attack is on the player's current pokemon -; this doesn't take into account the effects that dual types can have -; (e.g. 4x weakness / resistance, weaknesses and resistances canceling) -; the result is stored in [wTypeEffectiveness] -; ($05 is not very effective, $10 is neutral, $14 is super effective) -; as far is can tell, this is only used once in some AI code to help decide which move to use AIGetTypeEffectiveness: ld a,[wEnemyMoveType] - ld d,a ; d = type of enemy move + ld d,a ; d = type of enemy move ld hl,wBattleMonType - ld b,[hl] ; b = type 1 of player's pokemon + ld b,[hl] ; b = type 1 of player's pokemon inc hl - ld c,[hl] ; c = type 2 of player's pokemon + ld c,[hl] ; c = type 2 of player's pokemon ld a,$10 - ld [wTypeEffectiveness],a ; initialize to neutral effectiveness + ld [wd11e],a ; initialize [wd11e] to neutral effectiveness ld hl,TypeEffects .loop ld a,[hli] cp a,$ff ret z - cp d ; match the type of the move + cp d ; match the type of the move jr nz,.nextTypePair1 ld a,[hli] - cp b ; match with type 1 of pokemon + cp b ; match with type 1 of pokemon jr z,.done - cp c ; or match with type 2 of pokemon + cp c ; or match with type 2 of pokemon jr z,.done jr .nextTypePair2 .nextTypePair1 @@ -5425,9 +5581,21 @@ AIGetTypeEffectiveness: .nextTypePair2 inc hl jr .loop + .done + ld a, [wTrainerClass] + cp LORELEI + jr nz, .ok + ld a, [wEnemyMonSpecies] + cp DEWGONG + jr nz, .ok + call BattleRandom + cp $66 ; 40 percent + ret c +.ok + ld a,[hl] - ld [wTypeEffectiveness],a ; store damage multiplier + ld [wd11e],a ; store damage multiplier ret INCLUDE "data/type_effects.asm" @@ -5751,12 +5919,12 @@ EnemyMoveHitTest: handleIfEnemyMoveMissed: ld a, [wMoveMissed] and a - jr z, .asm_3e791 + jr z, .moveDidNotMiss ld a, [wEnemyMoveEffect] cp EXPLODE_EFFECT - jr z, asm_3e7a0 + jr z, handleExplosionMiss jr EnemyCheckIfFlyOrChargeEffect -.asm_3e791 +.moveDidNotMiss call SwapPlayerAndEnemyLevels GetEnemyAnimationType: @@ -5766,7 +5934,7 @@ GetEnemyAnimationType: jr z, playEnemyMoveAnimation ld a, $2 jr playEnemyMoveAnimation -asm_3e7a0: +handleExplosionMiss: call SwapPlayerAndEnemyLevels xor a playEnemyMoveAnimation: @@ -5824,19 +5992,19 @@ EnemyCheckIfMirrorMoveEffect: jp c, JumpMoveEffect ld a, [wMoveMissed] and a - jr z, .asm_3e82b + jr z, .moveDidNotMiss call PrintMoveFailureText ld a, [wEnemyMoveEffect] cp EXPLODE_EFFECT - jr z, .asm_3e83e + jr z, .handleExplosionMiss jp ExecuteEnemyMoveDone -.asm_3e82b +.moveDidNotMiss call ApplyAttackToPlayerPokemon call PrintCriticalOHKOText callab DisplayEffectiveness ld a, 1 ld [wMoveDidntMiss], a -.asm_3e83e +.handleExplosionMiss ld a, [wEnemyMoveEffect] ld hl, AlwaysHappenSideEffects ld de, $1 @@ -5850,7 +6018,7 @@ EnemyCheckIfMirrorMoveEffect: call HandleBuildingRage ld hl, wEnemyBattleStatus1 bit AttackingMultipleTimes, [hl] ; is mon hitting multiple times? (example: double kick) - jr z, .asm_3e873 + jr z, .notMultiHitMove push hl ld hl, wEnemyNumAttacksLeft dec [hl] @@ -5861,7 +6029,7 @@ EnemyCheckIfMirrorMoveEffect: call PrintText xor a ld [wEnemyNumHits], a -.asm_3e873 +.notMultiHitMove ld a, [wEnemyMoveEffect] and a jr z, ExecuteEnemyMoveDone @@ -6406,10 +6574,13 @@ SwapPlayerAndEnemyLevels: ; (for use when scrolling the player sprite and enemy's silhouettes on screen) LoadPlayerBackPic: ld a, [wBattleType] - dec a ; is it the old man tutorial? - ld de, RedPicBack - jr nz, .next ld de, OldManPic + cp BATTLE_TYPE_OLD_MAN ; is it the old man tutorial? + jr z, .next + ld de, ProfOakPicBack + cp BATTLE_TYPE_PIKACHU ; is it the pikachu battle at the beginning of the game? + jr z, .next + ld de, RedPicBack .next ld a, BANK(RedPicBack) call UncompressSpriteFromDE @@ -6434,6 +6605,8 @@ LoadPlayerBackPic: ld [hli], a ; OAM tile number inc a ; increment tile number ld [hOAMTile], a + ld a, $2 + ld [hl], a inc hl dec c jr nz, .innerLoop @@ -6447,18 +6620,15 @@ LoadPlayerBackPic: jr nz, .loop ld de, vBackPic call InterlaceMergeSpriteBuffers - ld a, $a - ld [$0], a - xor a - ld [$4000], a + ld a, $0 + call SwitchSRAMBankAndLatchClockData ld hl, vSprites ld de, sSpriteBuffer1 ld a, [H_LOADEDROMBANK] ld b, a ld c, 7 * 7 call CopyVideoData - xor a - ld [$0], a + call PrepareRTCDataAndDisableSRAM ld a, $31 ld [hStartTileID], a coord hl, 1, 5 @@ -6801,16 +6971,16 @@ HandleExplodingAnimation: ld hl, wEnemyMonType1 ld de, wEnemyBattleStatus1 ld a, [wPlayerMoveNum] - jr z, .asm_3eeea + jr z, .player ld hl, wBattleMonType1 ld de, wEnemyBattleStatus1 ld a, [wEnemyMoveNum] -.asm_3eeea +.player cp SELFDESTRUCT - jr z, .asm_3eef1 + jr z, .isExplodingMove cp EXPLOSION ret nz -.asm_3eef1 +.isExplodingMove ld a, [de] bit Invulnerable, a ; fly/dig ret nz @@ -6829,292 +6999,10 @@ HandleExplodingAnimation: PlayMoveAnimation: ld [wAnimationID],a call Delay3 - predef_jump MoveAnimation - -InitBattle: - ld a, [wCurOpponent] - and a - jr z, DetermineWildOpponent - -InitOpponent: - ld a, [wCurOpponent] - ld [wcf91], a - ld [wEnemyMonSpecies2], a - jr InitBattleCommon - -DetermineWildOpponent: - ld a, [wd732] - bit 1, a - jr z, .asm_3ef2f - ld a, [hJoyHeld] - bit 1, a ; B button pressed? - ret nz -.asm_3ef2f - ld a, [wNumberOfNoRandomBattleStepsLeft] - and a - ret nz - callab TryDoWildEncounter - ret nz -InitBattleCommon: - ld a, [wMapPalOffset] - push af - ld hl, wLetterPrintingDelayFlags - ld a, [hl] - push af - res 1, [hl] - callab InitBattleVariables - ld a, [wEnemyMonSpecies2] - sub 200 - jp c, InitWildBattle - ld [wTrainerClass], a - call GetTrainerInformation - callab ReadTrainer - call DoBattleTransitionAndInitBattleVariables - call _LoadTrainerPic - xor a - ld [wEnemyMonSpecies2], a - ld [hStartTileID], a - dec a - ld [wAICount], a - coord hl, 12, 0 - predef CopyUncompressedPicToTilemap - ld a, $ff - ld [wEnemyMonPartyPos], a - ld a, $2 - ld [wIsInBattle], a - jp _InitBattleCommon - -InitWildBattle: - ld a, $1 - ld [wIsInBattle], a - call LoadEnemyMonData - call DoBattleTransitionAndInitBattleVariables - ld a, [wCurOpponent] - cp MAROWAK - jr z, .isGhost - call IsGhostBattle - jr nz, .isNoGhost -.isGhost - ld hl, wMonHSpriteDim - ld a, $66 - ld [hli], a ; write sprite dimensions - ld bc, GhostPic - ld a, c - ld [hli], a ; write front sprite pointer - ld [hl], b - ld hl, wEnemyMonNick ; set name to "GHOST" - ld a, "G" - ld [hli], a - ld a, "H" - ld [hli], a - ld a, "O" - ld [hli], a - ld a, "S" - ld [hli], a - ld a, "T" - ld [hli], a - ld [hl], "@" - ld a, [wcf91] - push af - ld a, MON_GHOST - ld [wcf91], a - ld de, vFrontPic - call LoadMonFrontSprite ; load ghost sprite - pop af - ld [wcf91], a - jr .spriteLoaded -.isNoGhost - ld de, vFrontPic - call LoadMonFrontSprite ; load mon sprite -.spriteLoaded - xor a - ld [wTrainerClass], a - ld [hStartTileID], a - coord hl, 12, 0 - predef CopyUncompressedPicToTilemap - -; common code that executes after init battle code specific to trainer or wild battles -_InitBattleCommon: - ld b, SET_PAL_BATTLE_BLACK - call RunPaletteCommand - call SlidePlayerAndEnemySilhouettesOnScreen - xor a - ld [H_AUTOBGTRANSFERENABLED], a - ld hl, .emptyString - call PrintText - call SaveScreenTilesToBuffer1 - call ClearScreen - ld a, $98 - ld [H_AUTOBGTRANSFERDEST + 1], a - ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a - call Delay3 - ld a, $9c - ld [H_AUTOBGTRANSFERDEST + 1], a - call LoadScreenTilesFromBuffer1 - coord hl, 9, 7 - lb bc, 5, 10 - call ClearScreenArea - coord hl, 1, 0 - lb bc, 4, 10 - call ClearScreenArea - call ClearSprites - ld a, [wIsInBattle] - dec a ; is it a wild battle? - call z, DrawEnemyHUDAndHPBar ; draw enemy HUD and HP bar if it's a wild battle - call StartBattle - callab EndOfBattle - pop af - ld [wLetterPrintingDelayFlags], a - pop af - ld [wMapPalOffset], a - ld a, [wSavedTilesetType] - ld [hTilesetType], a - scf - ret -.emptyString - db "@" - -_LoadTrainerPic: -; wd033-wd034 contain pointer to pic - ld a, [wTrainerPicPointer] - ld e, a - ld a, [wTrainerPicPointer + 1] - ld d, a ; de contains pointer to trainer pic - ld a, [wLinkState] - and a - ld a, Bank(TrainerPics) ; this is where all the trainer pics are (not counting Red's) - jr z, .loadSprite - ld a, Bank(RedPicFront) -.loadSprite - call UncompressSpriteFromDE - ld de, vFrontPic - ld a, $77 - ld c, a - jp LoadUncompressedSpriteData - -; unreferenced -ResetCryModifiers: - xor a - ld [wFrequencyModifier], a - ld [wTempoModifier], a - jp PlaySound - -; animates the mon "growing" out of the pokeball -AnimateSendingOutMon: - ld a, [wPredefRegisters] - ld h, a - ld a, [wPredefRegisters + 1] - ld l, a - ld a, [hStartTileID] - ld [hBaseTileID], a - ld b, $4c - ld a, [wIsInBattle] - and a - jr z, .notInBattle - add b - ld [hl], a - call Delay3 - ld bc, -(SCREEN_WIDTH * 2 + 1) - add hl, bc - ld a, 1 - ld [wDownscaledMonSize], a - lb bc, 3, 3 - predef CopyDownscaledMonTiles - ld c, 4 - call DelayFrames - ld bc, -(SCREEN_WIDTH * 2 + 1) - add hl, bc - xor a - ld [wDownscaledMonSize], a - lb bc, 5, 5 - predef CopyDownscaledMonTiles - ld c, 5 - call DelayFrames - ld bc, -(SCREEN_WIDTH * 2 + 1) - jr .next -.notInBattle - ld bc, -(SCREEN_WIDTH * 6 + 3) -.next - add hl, bc - ld a, [hBaseTileID] - add $31 - jr CopyUncompressedPicToHL - -CopyUncompressedPicToTilemap: - ld a, [wPredefRegisters] - ld h, a - ld a, [wPredefRegisters + 1] - ld l, a - ld a, [hStartTileID] -CopyUncompressedPicToHL: - lb bc, 7, 7 - ld de, SCREEN_WIDTH - push af - ld a, [wSpriteFlipped] - and a - jr nz, .flipped - pop af -.loop - push bc - push hl -.innerLoop - ld [hl], a - add hl, de - inc a - dec c - jr nz, .innerLoop - pop hl - inc hl - pop bc - dec b - jr nz, .loop - ret - -.flipped - push bc - ld b, 0 - dec c - add hl, bc - pop bc - pop af -.flippedLoop - push bc - push hl -.flippedInnerLoop - ld [hl], a - add hl, de - inc a - dec c - jr nz, .flippedInnerLoop - pop hl - dec hl - pop bc - dec b - jr nz, .flippedLoop + predef MoveAnimation + callab Func_78e98 ret -LoadMonBackPic: -; Assumes the monster's attributes have -; been loaded with GetMonHeader. - ld a, [wBattleMonSpecies2] - ld [wcf91], a - coord hl, 1, 5 - ld b, 7 - ld c, 8 - call ClearScreenArea - ld hl, wMonHBackSprite - wMonHeader - call UncompressMonSprite - predef ScaleSpriteByTwo - ld de, vBackPic - call InterlaceMergeSpriteBuffers ; combine the two buffers to a single 2bpp sprite - ld hl, vSprites - ld de, vBackPic - ld c, (2*SPRITEBUFFERSIZE)/16 ; count of 16-byte chunks to be copied - ld a, [H_LOADEDROMBANK] - ld b, a - jp CopyVideoData - JumpMoveEffect: call _JumpMoveEffect ld b, $1 @@ -7263,6 +7151,16 @@ SleepEffect: call BattleRandom and $7 jr z, .setSleepCounter + ld b, a + ld a, [wUnknownSerialFlag_d499] + and a + jr z, .asm_3f1ba ; XXX stadium stuff? + ld a, b + and $3 + jr z, .setSleepCounter + ld b, a +.asm_3f1ba + ld a, b ld [de], a call PlayCurrentMoveAnimation2 ld hl, FellAsleepText @@ -7274,7 +7172,7 @@ FellAsleepText: TX_FAR _FellAsleepText db "@" -AlreadyAsleepText: +AlreadyAsleepText: ; 3f1cd (f:71cds) TX_FAR _AlreadyAsleepText db "@" @@ -7333,7 +7231,7 @@ PoisonEffect: jr nz, .ok ld b, ANIM_A9 ld hl, wEnemyBattleStatus3 - ld de, wEnemyToxcCounter + ld de, wEnemyToxicCounter .ok cp TOXIC jr nz, .normalPoison ; done if move is not Toxic @@ -7341,18 +7239,18 @@ PoisonEffect: xor a ld [de], a ld hl, BadlyPoisonedText - jr .asm_3f2c0 + jr .continue .normalPoison ld hl, PoisonedText -.asm_3f2c0 +.continue pop de ld a, [de] cp POISON_EFFECT - jr z, .asm_3f2cd + jr z, .regularPoisonEffect ld a, b call PlayBattleAnimation2 jp PrintText -.asm_3f2cd +.regularPoisonEffect call PlayCurrentMoveAnimation2 jp PrintText .noEffect @@ -7401,7 +7299,7 @@ FreezeBurnParalyzeEffect: ret nz ; return if they have a substitute, can't effect them ld a, [H_WHOSETURN] and a - jp nz, opponentAttacker + jp nz, .opponentAttacker ld a, [wEnemyMonStatus] and a jp nz, CheckDefrost ; can't inflict status if opponent is already statused @@ -7414,6 +7312,16 @@ FreezeBurnParalyzeEffect: cp b ; do target type 2 and move type match? ret z ; return if they match ld a, [wPlayerMoveEffect] + cp UNUSED_EFFECT_23 ; more stadium stuff + jr nz, .asm_3f2c7 + ld a, [wUnknownSerialFlag_d499] + and a + ld a, FREEZE_SIDE_EFFECT + ld b, $4d ; else use 0x4D/0x100 or 77/256 = 30.1%~ chance + jr z, .next1 + ld b, $1a ; 0x1A/0x100 or 26/256 = 10.2%~ chance + jr .next1 +.asm_3f2c7 cp a, PARALYZE_SIDE_EFFECT1 + 1 ; 10% status effects are 04, 05, 06 so 07 will set carry for those ld b, $1a ; 0x1A/0x100 or 26/256 = 10.2%~ chance jr c, .next1 ; branch ahead if this is a 10% chance effect.. @@ -7427,9 +7335,9 @@ FreezeBurnParalyzeEffect: ret nc ; do nothing if random value is >= 1A or 4D [no status applied] ld a, b ; what type of effect is this? cp a, BURN_SIDE_EFFECT1 - jr z, .burn + jr z, .burn1 cp a, FREEZE_SIDE_EFFECT - jr z, .freeze + jr z, .freeze1 ; .paralyze ld a, 1 << PAR ld [wEnemyMonStatus], a @@ -7437,7 +7345,7 @@ FreezeBurnParalyzeEffect: ld a, ANIM_A9 call PlayBattleAnimation jp PrintMayNotAttackText ; print paralysis text -.burn +.burn1 ld a, 1 << BRN ld [wEnemyMonStatus], a call HalveAttackDueToBurn ; halve attack of affected mon @@ -7445,7 +7353,7 @@ FreezeBurnParalyzeEffect: call PlayBattleAnimation ld hl, BurnedText jp PrintText -.freeze +.freeze1 call ClearHyperBeam ; resets hyper beam (recharge) condition from target ld a, 1 << FRZ ld [wEnemyMonStatus], a @@ -7453,7 +7361,7 @@ FreezeBurnParalyzeEffect: call PlayBattleAnimation ld hl, FrozenText jp PrintText -opponentAttacker: +.opponentAttacker ; 3f382 (f:7382) ld a, [wBattleMonStatus] ; mostly same as above with addresses swapped for opponent and a jp nz, CheckDefrost @@ -7466,12 +7374,22 @@ opponentAttacker: cp b ret z ld a, [wEnemyMoveEffect] + cp UNUSED_EFFECT_23 ; more stadium stuff + jr nz, .asm_3f341 + ld a, [wUnknownSerialFlag_d499] + and a + ld a, FREEZE_SIDE_EFFECT + ld b, $4d ; else use 0x4D/0x100 or 77/256 = 30.1%~ chance + jr z, .next2 + ld b, $1a ; 0x1A/0x100 or 26/256 = 10.2%~ chance + jr .next2 +.asm_3f341 cp a, PARALYZE_SIDE_EFFECT1 + 1 ld b, $1a - jr c, .next1 + jr c, .next2 ld b, $4d sub a, $1e -.next1 +.next2 push af call BattleRandom cp b @@ -7479,23 +7397,29 @@ opponentAttacker: ret nc ld a, b cp a, BURN_SIDE_EFFECT1 - jr z, .burn + jr z, .burn2 cp a, FREEZE_SIDE_EFFECT - jr z, .freeze + jr z, .freeze2 ld a, 1 << PAR ld [wBattleMonStatus], a call QuarterSpeedDueToParalysis + ld a, ANIM_C7 + call PlayBattleAnimation2 jp PrintMayNotAttackText -.burn +.burn2 ld a, 1 << BRN ld [wBattleMonStatus], a call HalveAttackDueToBurn + ld a, ANIM_C7 + call PlayBattleAnimation2 ld hl, BurnedText jp PrintText -.freeze +.freeze2 ; hyper beam bits aren't reseted for opponent's side ld a, 1 << FRZ ld [wBattleMonStatus], a + ld a, ANIM_C7 + call PlayBattleAnimation2 ld hl, FrozenText jp PrintText @@ -7660,25 +7584,25 @@ UpdateStatDone: ld bc, wPlayerMonMinimized ld a, [H_WHOSETURN] and a - jr z, .asm_3f4e6 + jr z, .playerTurn ld hl, wEnemyBattleStatus2 ld de, wEnemyMoveNum ld bc, wEnemyMonMinimized -.asm_3f4e6 +.playerTurn ld a, [de] cp MINIMIZE - jr nz, .asm_3f4f9 + jr nz, .notMinimize ; if a substitute is up, slide off the substitute and show the mon pic before ; playing the minimize animation bit HasSubstituteUp, [hl] push af push bc + push de ld hl, HideSubstituteShowMonAnim ld b, BANK(HideSubstituteShowMonAnim) - push de call nz, Bankswitch pop de -.asm_3f4f9 +.notMinimize call PlayCurrentMoveAnimation ld a, [de] cp MINIMIZE @@ -7717,9 +7641,9 @@ MonsStatsRoseText: ld a, [H_WHOSETURN] and a ld a, [wPlayerMoveEffect] - jr z, .asm_3f53b + jr z, .playerTurn ld a, [wEnemyMoveEffect] -.asm_3f53b +.playerTurn cp ATTACK_DOWN1_EFFECT ret nc ld hl, RoseText @@ -7728,7 +7652,7 @@ MonsStatsRoseText: GreatlyRoseText: db $0a TX_FAR _GreatlyRoseText - +; fallthrough RoseText: TX_FAR _RoseText db "@" @@ -7817,9 +7741,9 @@ StatModifierDownEffect: ld a, c add e ld e, a - jr nc, .asm_3f5e4 + jr nc, .noCarry inc d ; de = unmodified stat -.asm_3f5e4 +.noCarry pop bc ld a, [hld] sub $1 ; can't lower stat below 1 (-6) @@ -7919,12 +7843,13 @@ MonsStatsFellText: ld a, [H_WHOSETURN] and a ld a, [wPlayerMoveEffect] - jr z, .asm_3f674 + jr z, .playerTurn ld a, [wEnemyMoveEffect] -.asm_3f674 - cp $1a +.playerTurn +; check if the move's effect decreases a stat by 2 + cp BIDE_EFFECT ret c - cp $44 + cp ATTACK_DOWN_SIDE_EFFECT ret nc ld hl, GreatlyFellText ret @@ -7932,7 +7857,7 @@ MonsStatsFellText: GreatlyFellText: db $0a TX_FAR _GreatlyFellText - +; fallthrough FellText: TX_FAR _FellText db "@" @@ -7940,15 +7865,15 @@ FellText: PrintStatText: ld hl, StatsTextStrings ld c, "@" -.asm_3f68d +.findStatName_outer dec b - jr z, .asm_3f696 -.asm_3f690 + jr z, .foundStatName +.findStatName_inner ld a, [hli] cp c - jr z, .asm_3f68d - jr .asm_3f690 -.asm_3f696 + jr z, .findStatName_outer + jr .findStatName_inner +.foundStatName ld de, wcf4b ld bc, $a jp CopyData @@ -8026,41 +7951,42 @@ ThrashPetalDanceEffect: SwitchAndTeleportEffect: ld a, [H_WHOSETURN] and a - jr nz, .asm_3f791 + jr nz, .handleEnemy ld a, [wIsInBattle] dec a - jr nz, .asm_3f77e + jr nz, .notWildBattle1 ld a, [wCurEnemyLVL] ld b, a ld a, [wBattleMonLevel] - cp b - jr nc, .asm_3f76e + cp b ; is the player's level greater than the enemy's level? + jr nc, .playerMoveWasSuccessful ; if so, teleport will always succeed add b ld c, a - inc c -.asm_3f751 + inc c ; c = sum of player level and enemy level +.rejectionSampleLoop1 call BattleRandom - cp c - jr nc, .asm_3f751 - srl b + cp c ; get a random number between 0 and c + jr nc, .rejectionSampleLoop1 srl b - cp b - jr nc, .asm_3f76e + srl b ; b = enemy level * 4 +; bug: does not account for overflow, so levels above 63 can lead to erroneousness results + cp b ; is rand[0, playerLevel + enemyLevel] > enemyLevel? + jr nc, .playerMoveWasSuccessful ; if so, allow teleporting ld c, 50 call DelayFrames ld a, [wPlayerMoveNum] cp TELEPORT jp nz, PrintDidntAffectText jp PrintButItFailedText_ -.asm_3f76e +.playerMoveWasSuccessful call ReadPlayerMonCurHPAndStatus xor a ld [wAnimationType], a inc a ld [wEscapedFromBattle], a ld a, [wPlayerMoveNum] - jr .asm_3f7e4 -.asm_3f77e + jr .playAnimAndPrintText +.notWildBattle1 ld c, 50 call DelayFrames ld hl, IsUnaffectedText @@ -8068,41 +7994,41 @@ SwitchAndTeleportEffect: cp TELEPORT jp nz, PrintText jp PrintButItFailedText_ -.asm_3f791 +.handleEnemy ld a, [wIsInBattle] dec a - jr nz, .asm_3f7d1 + jr nz, .notWildBattle2 ld a, [wBattleMonLevel] ld b, a ld a, [wCurEnemyLVL] cp b - jr nc, .asm_3f7c1 + jr nc, .enemyMoveWasSuccessful add b ld c, a inc c -.asm_3f7a4 +.rejectionSampleLoop2 call BattleRandom cp c - jr nc, .asm_3f7a4 + jr nc, .rejectionSampleLoop2 srl b srl b cp b - jr nc, .asm_3f7c1 + jr nc, .enemyMoveWasSuccessful ld c, 50 call DelayFrames ld a, [wEnemyMoveNum] cp TELEPORT jp nz, PrintDidntAffectText jp PrintButItFailedText_ -.asm_3f7c1 +.enemyMoveWasSuccessful call ReadPlayerMonCurHPAndStatus xor a ld [wAnimationType], a inc a ld [wEscapedFromBattle], a ld a, [wEnemyMoveNum] - jr .asm_3f7e4 -.asm_3f7d1 + jr .playAnimAndPrintText +.notWildBattle2 ld c, 50 call DelayFrames ld hl, IsUnaffectedText @@ -8110,7 +8036,7 @@ SwitchAndTeleportEffect: cp TELEPORT jp nz, PrintText jp ConditionalPrintButItFailed -.asm_3f7e4 +.playAnimAndPrintText push af call PlayBattleAnimation ld c, 20 @@ -8118,12 +8044,12 @@ SwitchAndTeleportEffect: pop af ld hl, RanFromBattleText cp TELEPORT - jr z, .asm_3f7ff + jr z, .printText ld hl, RanAwayScaredText cp ROAR - jr z, .asm_3f7ff + jr z, .printText ld hl, WasBlownAwayText -.asm_3f7ff +.printText jp PrintText RanFromBattleText: @@ -8168,10 +8094,11 @@ TwoToFiveAttacksEffect: call BattleRandom and $3 cp $2 - jr c, .asm_3f851 + jr c, .gotNumHits +; if the number of hits was greater than 2, re-roll again for a lower chance call BattleRandom and $3 -.asm_3f851 +.gotNumHits inc a inc a .saveNumberOfHits @@ -8194,6 +8121,9 @@ FlinchSideEffect: ld hl, wPlayerBattleStatus1 ld de, wEnemyMoveEffect .flinchSideEffect + ld a, [wLinkState] + cp LINK_STATE_BATTLING + call z, ClearHyperBeam ld a, [de] cp FLINCH_SIDE_EFFECT1 ld b, $1a ; ~10% chance of flinch @@ -8235,10 +8165,27 @@ ChargeEffect: set Invulnerable, [hl] ; mon is now invulnerable to typical attacks (fly/dig) ld b, ANIM_C0 .notDigOrFly + push de + push bc + inc hl ; battle status 2 + push hl + ld a, [hl] + bit HasSubstituteUp, a + ld hl, HideSubstituteShowMonAnim + ld b, BANK(HideSubstituteShowMonAnim) + call nz, Bankswitch + pop hl + pop bc xor a ld [wAnimationType], a ld a, b call PlayBattleAnimation + ld a, [hl] + bit HasSubstituteUp, a + ld hl, ReshowSubstituteAnim + ld b, BANK(ReshowSubstituteAnim) + call nz, Bankswitch + pop de ld a, [de] ld [wChargeMoveNum], a ld hl, ChargeMoveEffectText @@ -8250,22 +8197,22 @@ ChargeMoveEffectText: ld a, [wChargeMoveNum] cp RAZOR_WIND ld hl, MadeWhirlwindText - jr z, .asm_3f8f8 + jr z, .gotText cp SOLARBEAM ld hl, TookInSunlightText - jr z, .asm_3f8f8 + jr z, .gotText cp SKULL_BASH ld hl, LoweredItsHeadText - jr z, .asm_3f8f8 + jr z, .gotText cp SKY_ATTACK ld hl, SkyAttackGlowingText - jr z, .asm_3f8f8 + jr z, .gotText cp FLY ld hl, FlewUpHighText - jr z, .asm_3f8f8 + jr z, .gotText cp DIG ld hl, DugAHoleText -.asm_3f8f8 +.gotText ret MadeWhirlwindText: @@ -8328,7 +8275,7 @@ RecoilEffect: ConfusionSideEffect: call BattleRandom - cp $19 + cp $19 ; ~10% chance ret nc jr ConfusionSideEffectSuccess @@ -8398,9 +8345,9 @@ ClearHyperBeam: ld hl, wEnemyBattleStatus2 ld a, [H_WHOSETURN] and a - jr z, .asm_3f9db + jr z, .playerTurn ld hl, wPlayerBattleStatus2 -.asm_3f9db +.playerTurn res NeedsToRecharge, [hl] ; mon no longer needs to recharge pop hl ret @@ -8421,21 +8368,21 @@ MimicEffect: call MoveHitTest ld a, [wMoveMissed] and a - jr nz, .asm_3fa74 + jr nz, .mimicMissed ld a, [H_WHOSETURN] and a ld hl, wBattleMonMoves ld a, [wPlayerBattleStatus1] - jr nz, .asm_3fa13 + jr nz, .enemyTurn ld a, [wLinkState] cp LINK_STATE_BATTLING - jr nz, .asm_3fa3a + jr nz, .letPlayerChooseMove ld hl, wEnemyMonMoves ld a, [wEnemyBattleStatus1] -.asm_3fa13 +.enemyTurn bit Invulnerable, a - jr nz, .asm_3fa74 -.asm_3fa17 + jr nz, .mimicMissed +.getRandomMove push hl call BattleRandom and $3 @@ -8445,20 +8392,20 @@ MimicEffect: ld a, [hl] pop hl and a - jr z, .asm_3fa17 + jr z, .getRandomMove ld d, a ld a, [H_WHOSETURN] and a ld hl, wBattleMonMoves ld a, [wPlayerMoveListIndex] - jr z, .asm_3fa5f + jr z, .playerTurn ld hl, wEnemyMonMoves ld a, [wEnemyMoveListIndex] - jr .asm_3fa5f -.asm_3fa3a + jr .playerTurn +.letPlayerChooseMove ld a, [wEnemyBattleStatus1] bit Invulnerable, a - jr nz, .asm_3fa74 + jr nz, .mimicMissed ld a, [wCurrentMenuItem] push af ld a, $1 @@ -8473,7 +8420,7 @@ MimicEffect: ld d, [hl] pop af ld hl, wBattleMonMoves -.asm_3fa5f +.playerTurn ld c, a ld b, $0 add hl, bc @@ -8484,7 +8431,7 @@ MimicEffect: call PlayCurrentMoveAnimation ld hl, MimicLearnedMoveText jp PrintText -.asm_3fa74 +.mimicMissed jp PrintButItFailedText_ MimicLearnedMoveText: @@ -8708,6 +8655,7 @@ PlayBattleAnimationGotID: push de push bc predef MoveAnimation + callab Func_78e98 pop bc pop de pop hl diff --git a/engine/battle/decrement_pp.asm b/engine/battle/decrement_pp.asm index 984af087..fd1a3184 100644 --- a/engine/battle/decrement_pp.asm +++ b/engine/battle/decrement_pp.asm @@ -33,7 +33,7 @@ DecrementPP: ld a, [wPlayerMonNumber] ; which mon in party is active ld bc, wPartyMon2 - wPartyMon1 call AddNTimes ; calculate address of the mon to modify -.DecrementPP +.DecrementPP ; f4301 (3d:4301) ld a, [wPlayerMoveListIndex] ; which move (0, 1, 2, 3) did we use? ld c, a ld b, 0 diff --git a/engine/battle/draw_hud_pokeball_gfx.asm b/engine/battle/draw_hud_pokeball_gfx.asm index f44d64f5..8f9dce46 100644 --- a/engine/battle/draw_hud_pokeball_gfx.asm +++ b/engine/battle/draw_hud_pokeball_gfx.asm @@ -27,6 +27,8 @@ SetupOwnPartyPokeballs: ld [hl], a ld a, 8 ld [wHUDPokeballGfxOffsetX], a + xor a + ld [wdef5], a ld hl, wOAMBuffer jp WritePokeballOAMData @@ -41,6 +43,8 @@ SetupEnemyPartyPokeballs: ld [hl], $20 ld a, -8 ld [wHUDPokeballGfxOffsetX], a + ld a, $1 + ld [wdef5], a ld hl, wOAMBuffer + PARTY_LENGTH * 4 jp WritePokeballOAMData @@ -104,7 +108,7 @@ WritePokeballOAMData: ld [hli], a ld a, [de] ld [hli], a - xor a + ld a, [wdef5] ld [hli], a ld a, [wBaseCoordX] ld b, a @@ -174,6 +178,8 @@ SetupPlayerAndEnemyPokeballs: ld [hl], $40 ld a, 8 ld [wHUDPokeballGfxOffsetX], a + xor a + ld [wdef5], a ld hl, wOAMBuffer call WritePokeballOAMData ld hl, wEnemyMons @@ -183,6 +189,8 @@ SetupPlayerAndEnemyPokeballs: ld a, $50 ld [hli], a ld [hl], $68 + ld a, $1 + ld [wdef5], a ld hl, wOAMBuffer + $18 jp WritePokeballOAMData diff --git a/engine/battle/end_of_battle.asm b/engine/battle/end_of_battle.asm index 2d6ab2e9..47c9fa5d 100755 --- a/engine/battle/end_of_battle.asm +++ b/engine/battle/end_of_battle.asm @@ -10,6 +10,8 @@ EndOfBattle: ld a, [wEnemyMonStatus] ld [hl], a call ClearScreen + ld b, SET_PAL_OVERWORLD + call RunPaletteCommand callab DisplayLinkBattleVersusTextBox ld a, [wBattleResult] cp $1 @@ -43,6 +45,8 @@ EndOfBattle: xor a ld [wForceEvolution], a predef EvolutionAfterBattle + ld d, $82 + callab UpdatePikachuMoodAfterBattle .resetVariables xor a ld [wLowHealthAlarm], a ;disable low health alarm diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index c1914806..9946c6c6 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -43,17 +43,17 @@ GainExperience: inc de jr .nextBaseStat .maxStatExp ; if the upper byte also overflowed, then we have hit the max stat exp - ld a, $ff + dec a ; a is 0 from previous check ld [de], a inc de ld [de], a .nextBaseStat dec c - jr z, .asm_552a1 + jr z, .statExpDone inc de inc de jr .gainStatExpLoop -.asm_552a1 +.statExpDone xor a ld [H_MULTIPLICAND], a ld [H_MULTIPLICAND + 1], a @@ -233,13 +233,19 @@ GainExperience: .recalcStatChanges xor a ; battle mon ld [wCalculateWhoseStats], a - callab CalculateModifiedStats - callab ApplyBurnAndParalysisPenaltiesToPlayer - callab ApplyBadgeStatBoosts - callab DrawPlayerHUDAndHPBar - callab PrintEmptyString + ld hl, CalculateModifiedStats + call Bankswitch15ToF + ld hl, ApplyBurnAndParalysisPenaltiesToPlayer + call Bankswitch15ToF + ld hl, ApplyBadgeStatBoosts + call Bankswitch15ToF + ld hl, DrawPlayerHUDAndHPBar + call Bankswitch15ToF + ld hl, PrintEmptyString + call Bankswitch15ToF call SaveScreenTilesToBuffer1 .printGrewLevelText + callabd_ModifyPikachuHappiness PIKAHAPPY_LEVELUP ld hl, GrewLevelText call PrintText xor a ; PLAYER_PARTY_DATA @@ -339,6 +345,10 @@ BoostExp: ld [H_QUOTIENT + 2], a ret +Bankswitch15ToF: + ld b, BANK(BattleCore) + jp Bankswitch + GainedText: TX_FAR _GainedText TX_ASM diff --git a/engine/battle/get_trainer_name.asm b/engine/battle/get_trainer_name.asm index deed8e95..e051a02a 100644 --- a/engine/battle/get_trainer_name.asm +++ b/engine/battle/get_trainer_name.asm @@ -2,15 +2,15 @@ GetTrainerName_: ld hl, wGrassRate ld a, [wLinkState] and a - jr nz, .rival + jr nz, .foundName ld hl, wRivalName ld a, [wTrainerClass] cp SONY1 - jr z, .rival + jr z, .foundName cp SONY2 - jr z, .rival + jr z, .foundName cp SONY3 - jr z, .rival + jr z, .foundName ld [wd0b5], a ld a, TRAINER_NAME ld [wNameListType], a @@ -18,6 +18,7 @@ GetTrainerName_: ld [wPredefBank], a call GetName ld hl, wcd6d +.foundName .rival ld de, wTrainerName ld bc, $d diff --git a/engine/battle/ghost_marowak_anim.asm b/engine/battle/ghost_marowak_anim.asm index 7adb20d8..5bb3e308 100644 --- a/engine/battle/ghost_marowak_anim.asm +++ b/engine/battle/ghost_marowak_anim.asm @@ -2,6 +2,7 @@ MarowakAnim: ; animate the ghost being unveiled as a Marowak ld a, $e4 ld [rOBP1], a + call UpdateGBCPal_OBP1 call CopyMonPicFromBGToSpriteVRAM ; cover the BG ghost pic with a sprite ghost pic that looks the same ; now that the ghost pic is being displayed using sprites, clear the ghost pic from the BG tilemap coord hl, 12, 0 @@ -27,6 +28,7 @@ MarowakAnim: sla a sla a ld [rOBP1], a + call UpdateGBCPal_OBP1 jr nz, .fadeOutGhostLoop call ClearSprites call CopyMonPicFromBGToSpriteVRAM ; copy Marowak pic from BG to sprite VRAM @@ -40,6 +42,7 @@ MarowakAnim: srl b rra ld [rOBP1], a + call UpdateGBCPal_OBP1 ld a, b and a jr nz, .fadeInMarowakLoop @@ -74,7 +77,7 @@ CopyMonPicFromBGToSpriteVRAM: ld [hli], a ld a, d ld [hli], a - ld a, $10 ; use OBP1 + ld a, $14 ; use OBP1 ld [hli], a inc d dec c diff --git a/engine/battle/link_battle_versus_text.asm b/engine/battle/link_battle_versus_text.asm index 57e7f1bb..5edf13e6 100644 --- a/engine/battle/link_battle_versus_text.asm +++ b/engine/battle/link_battle_versus_text.asm @@ -2,8 +2,7 @@ DisplayLinkBattleVersusTextBox: call LoadTextBoxTilePatterns coord hl, 3, 4 - ld b, $7 - ld c, $c + ld bc, $70c call TextBoxBorder coord hl, 4, 5 ld de, wPlayerName diff --git a/engine/battle/moveEffects/heal_effect.asm b/engine/battle/moveEffects/heal_effect.asm index b7d8283f..377c14c4 100644 --- a/engine/battle/moveEffects/heal_effect.asm +++ b/engine/battle/moveEffects/heal_effect.asm @@ -86,7 +86,7 @@ HealEffect_: ld [wHPBarNewHP], a .playAnim ld hl, PlayCurrentMoveAnimation - call BankswitchEtoF + call Bankswitch3DtoF ld a, [H_WHOSETURN] and a coord hl, 10, 9 @@ -98,14 +98,14 @@ HealEffect_: ld [wHPBarType], a predef UpdateHPBar2 ld hl, DrawHUDsAndHPBars - call BankswitchEtoF + call Bankswitch3DtoF ld hl, RegainedHealthText jp PrintText .failed ld c, 50 call DelayFrames ld hl, PrintButItFailedText_ - jp BankswitchEtoF + jp Bankswitch3DtoF StartedSleepingEffect: TX_FAR _StartedSleepingEffect diff --git a/engine/battle/moveEffects/reflect_light_screen_effect.asm b/engine/battle/moveEffects/reflect_light_screen_effect.asm index b45fbe20..f2165956 100644 --- a/engine/battle/moveEffects/reflect_light_screen_effect.asm +++ b/engine/battle/moveEffects/reflect_light_screen_effect.asm @@ -23,14 +23,14 @@ ReflectLightScreenEffect_: .playAnim push hl ld hl, PlayCurrentMoveAnimation - call BankswitchEtoF + call Bankswitch3DtoF pop hl jp PrintText .moveFailed ld c, 50 call DelayFrames ld hl, PrintButItFailedText_ - jp BankswitchEtoF + jp Bankswitch3DtoF LightScreenProtectedText: TX_FAR _LightScreenProtectedText @@ -40,6 +40,6 @@ ReflectGainedArmorText: TX_FAR _ReflectGainedArmorText db "@" -BankswitchEtoF: +Bankswitch3DtoF: ld b, BANK(BattleCore) jp Bankswitch diff --git a/engine/battle/moveEffects/transform_effect.asm b/engine/battle/moveEffects/transform_effect.asm index 45f8c910..2906de11 100644 --- a/engine/battle/moveEffects/transform_effect.asm +++ b/engine/battle/moveEffects/transform_effect.asm @@ -100,18 +100,11 @@ TransformEffect_: and a jr z, .lessThanFourMoves ld a, $5 - ld [de], a - inc de - dec b - jr nz, .copyPPLoop - jr .copyStats .lessThanFourMoves -; 0 PP for blank moves - xor a ld [de], a inc de dec b - jr nz, .lessThanFourMoves + jr nz, .copyPPLoop .copyStats ; original (unmodified) stats and stat mods pop hl @@ -141,7 +134,7 @@ TransformEffect_: .failed ld hl, PrintButItFailedText_ - jp BankswitchEtoF + jp Bankswitch3DtoF TransformedText: TX_FAR _TransformedText diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index 3672d8dc..3f10a85d 100755 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -15,9 +15,9 @@ ReadTrainer: ld [hl],a ; get the pointer to trainer data for this class - ld a,[wCurOpponent] - sub $C9 ; convert value from pokemon to trainer - add a,a + ld a,[wTrainerClass] ; get trainer class + dec a + add a ld hl,TrainerDataPointers ld c,a ld b,0 @@ -53,7 +53,7 @@ ReadTrainer: .LoopTrainerData ld a,[hli] and a ; have we reached the end of the trainer data? - jr z,.FinishUp + jp z, .AddAdditionalMoveData ld [wcf91],a ; write species somewhere (XXX why?) ld a,ENEMY_PARTY_DATA ld [wMonDataLocation],a @@ -68,7 +68,7 @@ ReadTrainer: ; - if [wLoneAttackNo] != 0, one pokemon on the team has a special move ld a,[hli] and a ; have we reached the end of the trainer data? - jr z,.AddLoneMove + jr z,.AddAdditionalMoveData ld [wCurEnemyLVL],a ld a,[hli] ld [wcf91],a @@ -78,69 +78,48 @@ ReadTrainer: call AddPartyMon pop hl jr .SpecialTrainer -.AddLoneMove -; does the trainer have a single monster with a different move - ld a,[wLoneAttackNo] ; Brock is 01, Misty is 02, Erika is 04, etc +.AddAdditionalMoveData +; does the trainer have additional move data? + ld a, [wTrainerClass] + ld b, a + ld a, [wTrainerNo] + ld c, a + ld hl, SpecialTrainerMoves +.loopAdditionalMoveData + ld a, [hli] + cp $ff + jr z, .FinishUp + cp b + jr nz, .asm_39c46 + ld a, [hli] + cp c + jr nz, .asm_39c46 + ld d, h + ld e, l +.writeAdditionalMoveDataLoop + ld a, [de] + inc de and a - jr z,.AddTeamMove + jp z, .FinishUp dec a - add a,a - ld c,a - ld b,0 - ld hl,LoneMoves - add hl,bc - ld a,[hli] - ld d,[hl] - ld hl,wEnemyMon1Moves + 2 - ld bc,wEnemyMon2 - wEnemyMon1 + ld hl, wEnemyMon1Moves + ld bc, wEnemyMon2 - wEnemyMon1 call AddNTimes - ld [hl],d - jr .FinishUp -.AddTeamMove -; check if our trainer's team has special moves - -; get trainer class number - ld a,[wCurOpponent] - sub 200 - ld b,a - ld hl,TeamMoves - -; iterate through entries in TeamMoves, checking each for our trainer class -.IterateTeamMoves - ld a,[hli] - cp b - jr z,.GiveTeamMoves ; is there a match? - inc hl ; if not, go to the next entry - inc a - jr nz,.IterateTeamMoves - -; no matches found. is this trainer champion rival? - ld a,b - cp SONY3 - jr z,.ChampionRival - jr .FinishUp ; nope -.GiveTeamMoves - ld a,[hl] - ld [wEnemyMon5Moves + 2],a - jr .FinishUp -.ChampionRival ; give moves to his team - -; pidgeot - ld a,SKY_ATTACK - ld [wEnemyMon1Moves + 2],a - -; starter - ld a,[wRivalStarter] - cp STARTER3 - ld b,MEGA_DRAIN - jr z,.GiveStarterMove - cp STARTER1 - ld b,FIRE_BLAST - jr z,.GiveStarterMove - ld b,BLIZZARD ; must be squirtle -.GiveStarterMove - ld a,b - ld [wEnemyMon6Moves + 2],a + ld a, [de] + inc de + dec a + ld c, a + ld b, 0 + add hl,bc + ld a, [de] + inc de + ld [hl], a + jr .writeAdditionalMoveDataLoop +.asm_39c46 + ld a, [hli] + and a + jr nz, .asm_39c46 + jr .loopAdditionalMoveData .FinishUp ; clear wAmountMoneyWon addresses xor a diff --git a/engine/battle/safari_zone.asm b/engine/battle/safari_zone.asm index 1eb1a615..c6c0fa80 100755 --- a/engine/battle/safari_zone.asm +++ b/engine/battle/safari_zone.asm @@ -2,18 +2,18 @@ PrintSafariZoneBattleText: ld hl, wSafariBaitFactor ld a, [hl] and a - jr z, .asm_4284 + jr z, .asm_411e dec [hl] ld hl, SafariZoneEatingText - jr .asm_429f -.asm_4284 + jr .asm_4138 +.asm_411e dec hl ld a, [hl] and a ret z dec [hl] ld hl, SafariZoneAngryText - jr nz, .asm_429f + jr nz, .asm_4138 push hl ld a, [wEnemyMonSpecies] ld [wd0b5], a @@ -21,7 +21,7 @@ PrintSafariZoneBattleText: ld a, [wMonHCatchRate] ld [wEnemyMonCatchRate], a pop hl -.asm_429f +.asm_4138 push hl call LoadScreenTilesFromBuffer1 pop hl diff --git a/engine/battle/scale_sprites.asm b/engine/battle/scale_sprites.asm index 98521528..c614d638 100644 --- a/engine/battle/scale_sprites.asm +++ b/engine/battle/scale_sprites.asm @@ -2,6 +2,13 @@ ; assumes that input sprite chunks are 4x4 tiles, and the rightmost and bottommost 4 pixels will be ignored ; resulting in a 7*7 tile output sprite chunk ScaleSpriteByTwo: + ld a, $0 + call SwitchSRAMBankAndLatchClockData + call ScaleSpriteByTwo_ + call PrepareRTCDataAndDisableSRAM + ret + +ScaleSpriteByTwo_: ld de, sSpriteBuffer1 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped ld hl, sSpriteBuffer0 + SPRITEBUFFERSIZE - 1 ; end of destination buffer call ScaleLastSpriteColumnByTwo ; last tile column is special case diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index 7999a7a0..2f2c46a6 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -182,7 +182,7 @@ AIMoveChoiceModification2: jr c, .preferMove jr .nextMove .preferMove - dec [hl] ; sligthly encourage this move + dec [hl] ; slightly encourage this move jr .nextMove ; encourages moves that are effective against the player's mon (even if non-damaging). @@ -295,7 +295,7 @@ TrainerClassMoveChoiceModifications: db 1,0 ; GAMBLER db 1,3,0 ; BEAUTY db 1,2,0 ; PSYCHIC_TR - db 1,3,0 ; ROCKER + db 1,0 ; ROCKER db 1,0 ; JUGGLER db 1,0 ; TAMER db 1,0 ; BIRD_KEEPER @@ -311,11 +311,11 @@ TrainerClassMoveChoiceModifications: db 1,0 ; BRUNO db 1,0 ; BROCK db 1,3,0 ; MISTY - db 1,3,0 ; LT_SURGE + db 1,0 ; LT_SURGE db 1,3,0 ; ERIKA db 1,3,0 ; KOGA - db 1,3,0 ; BLAINE - db 1,3,0 ; SABRINA + db 1,0 ; BLAINE + db 1,0 ; SABRINA db 1,2,0 ; GENTLEMAN db 1,3,0 ; SONY2 db 1,3,0 ; SONY3 @@ -337,13 +337,19 @@ INCLUDE "data/trainer_moves.asm" INCLUDE "data/trainer_parties.asm" TrainerAI: - and a ld a,[wIsInBattle] dec a - ret z ; if not a trainer, we're done here + jr z, .done ; if not a trainer, we're done here ld a,[wLinkState] cp LINK_STATE_BATTLING - ret z + jr z, .done ; if in a link battle, we're done as well + ld a, [wEnemyBattleStatus1] + and 1 << ChargingUp | 1 << ThrashingAbout | 1 << StoringEnergy ; %10011 + jr nz, .done ; don't follow trainer ai if opponent is in a locked state + ld a, [wEnemyBattleStatus2] + and 1 << UsingRage ; %1000000 + jr nz, .done ; don't follow trainer ai if opponent is locked in rage + ; note that this doesn't check for hyper beam recharge which can cause problems ld a,[wTrainerClass] ; what trainer class is this? dec a ld c,a @@ -354,7 +360,7 @@ TrainerAI: add hl,bc ld a,[wAICount] and a - ret z ; if no AI uses left, we're done here + jr z, .done; if no AI uses left, we're done here inc hl inc a jr nz,.getpointer @@ -367,6 +373,9 @@ TrainerAI: ld l,a call Random jp [hl] +.done + and a + ret TrainerAIPointers: ; one entry per trainer class @@ -476,22 +485,22 @@ ErikaAI: jp AIUseSuperPotion KogaAI: - cp $40 + cp $20 ret nc jp AIUseXAttack BlaineAI: cp $40 ret nc + ld a,$A + call AICheckIfHPBelowFraction + ret nc jp AIUseSuperPotion SabrinaAI: cp $40 ret nc - ld a,$A - call AICheckIfHPBelowFraction - ret nc - jp AIUseHyperPotion + jp AIUseXDefend Sony2AI: cp $20 diff --git a/engine/battle/wild_encounters.asm b/engine/battle/wild_encounters.asm index 231c46e7..0285346e 100644 --- a/engine/battle/wild_encounters.asm +++ b/engine/battle/wild_encounters.asm @@ -24,8 +24,9 @@ TryDoWildEncounter: ld [wRepelRemainingSteps], a .next ; determine if wild pokemon can appear in the half-block we're standing in -; is the bottom right tile (9,9) of the half-block we're standing in a grass/water tile? - coord hl, 9, 9 +; is the bottom left tile (8,9) of the half-block we're standing in a grass/water tile? +; note that by using the bottom left tile, this prevents the "left-shore" tiles from generating grass encounters + coord hl, 8, 9 ld c, [hl] ld a, [wGrassTile] cp c @@ -68,8 +69,6 @@ TryDoWildEncounter: cp $14 ; is the bottom left tile (8,9) of the half-block we're standing in a water tile? jr nz, .gotWildEncounterType ; else, it's treated as a grass tile by default ld hl, wWaterMons -; since the bottom right tile of a "left shore" half-block is $14 but the bottom left tile is not, -; "left shore" half-blocks (such as the one in the east coast of Cinnabar) load grass encounters. .gotWildEncounterType ld b, 0 add hl, bc diff --git a/engine/bcd.asm b/engine/bcd.asm new file mode 100644 index 00000000..204c2e40 --- /dev/null +++ b/engine/bcd.asm @@ -0,0 +1,216 @@ +; divide hMoney by hDivideBCDDivisor +; return output in hDivideBCDQuotient (same as hDivideBCDDivisor) +; used only to halve player money upon losing a fight +DivideBCDPredef:: +DivideBCDPredef2:: +DivideBCDPredef3:: ; only used function +DivideBCDPredef4:: + call GetPredefRegisters + +DivideBCD:: + xor a + ld [hDivideBCDBuffer], a + ld [hDivideBCDBuffer + 1], a + ld [hDivideBCDBuffer + 2], a + ld d, $1 +.loop1 + ld a, [hDivideBCDDivisor] + and $f0 + jr nz, .go + inc d + ld a, [hDivideBCDDivisor] + swap a + and $f0 + ld b, a + ld a, [hDivideBCDDivisor + 1] + swap a + ld [hDivideBCDDivisor + 1], a + and $f + or b + ld [hDivideBCDDivisor], a + ld a, [hDivideBCDDivisor + 1] + and $f0 + ld b, a + ld a, [hDivideBCDDivisor + 2] + swap a + ld [hDivideBCDDivisor + 2], a + and $f + or b + ld [hDivideBCDDivisor + 1], a + ld a, [hDivideBCDDivisor + 2] + and $f0 + ld [hDivideBCDDivisor + 2], a + jr .loop1 + +.go + push de + push de + call DivideBCD_f686 + pop de + ld a, b + swap a + and $f0 + ld [hDivideBCDBuffer], a + dec d + jr z, .skip + push de + call DivideBCD_f65d + call DivideBCD_f686 + pop de + ld a, [hDivideBCDBuffer] + or b + ld [hDivideBCDBuffer], a + dec d + jr z, .skip + push de + call DivideBCD_f65d + call DivideBCD_f686 + pop de + ld a, b + swap a + and $f0 + ld [hDivideBCDBuffer + 1], a + dec d + jr z, .skip + push de + call DivideBCD_f65d + call DivideBCD_f686 + pop de + ld a, [hDivideBCDBuffer + 1] + or b + ld [hDivideBCDBuffer + 1], a + dec d + jr z, .skip + push de + call DivideBCD_f65d + call DivideBCD_f686 + pop de + ld a, b + swap a + and $f0 + ld [hDivideBCDBuffer + 2], a + dec d + jr z, .skip + push de + call DivideBCD_f65d + call DivideBCD_f686 + pop de + ld a, [hDivideBCDBuffer + 2] + or b + ld [hDivideBCDBuffer + 2], a +.skip + ld a, [hDivideBCDBuffer] + ld [hDivideBCDQuotient], a + ld a, [hDivideBCDBuffer + 1] + ld [hDivideBCDQuotient + 1], a + ld a, [hDivideBCDBuffer + 2] + ld [hDivideBCDQuotient + 2], a + pop de + ld a, $6 + sub d + and a + ret z +.loop2 + push af + call DivideBCD_f65d + pop af + dec a + jr nz, .loop2 + ret + +DivideBCD_f65d: + ld a, [hDivideBCDDivisor + 2] + swap a + and $f + ld b, a + ld a, [hDivideBCDDivisor + 1] + swap a + ld [hDivideBCDDivisor + 1], a + and $f0 + or b + ld [hDivideBCDDivisor + 2], a + ld a, [hDivideBCDDivisor + 1] + and $f + ld b, a + ld a, [hDivideBCDDivisor] + swap a + ld [hDivideBCDDivisor], a + and $f0 + or b + ld [hDivideBCDDivisor + 1], a + ld a, [hDivideBCDDivisor] + and $f + ld [hDivideBCDDivisor], a + ret + +DivideBCD_f686: + ld bc, $3 +.asm_f689 + ld de, hMoney + ld hl, hDivideBCDDivisor + push bc + call StringCmp + pop bc + ret c + inc b + ld de, hMoney + 2 + ld hl, hDivideBCDDivisor + 2 + push bc + call SubBCD + pop bc + jr .asm_f689 + + +AddBCDPredef:: + call GetPredefRegisters + +AddBCD:: + and a + ld b, c +.add + ld a, [de] + adc [hl] + daa + ld [de], a + dec de + dec hl + dec c + jr nz, .add + jr nc, .done + ld a, $99 + inc de +.fill + ld [de], a + inc de + dec b + jr nz, .fill +.done + ret + + +SubBCDPredef:: + call GetPredefRegisters + +SubBCD:: + and a + ld b, c +.sub + ld a, [de] + sbc [hl] + daa + ld [de], a + dec de + dec hl + dec c + jr nz, .sub + jr nc, .done + ld a, $00 + inc de +.fill + ld [de], a + inc de + dec b + jr nz, .fill + scf +.done + ret diff --git a/engine/bg_map_attributes.asm b/engine/bg_map_attributes.asm new file mode 100644 index 00000000..90df9e27 --- /dev/null +++ b/engine/bg_map_attributes.asm @@ -0,0 +1,219 @@ +INCLUDE "data/bg_map_attributes.asm" + +LoadBGMapAttributes:: + ld hl, BGMapAttributesPointers + ld a, c ; c = which packet + push af ; save for later (to determine if we're handling the trainer card or party menu) + dec a ; read this code as: + add a ; dec a + ld e, a ; add a + xor a ; ld e, a + ld d, a ; ld d, 0 + add hl, de ; add hl, de + ld a, [hli] ; ld a, [hli] + ld e, a ; ld h, [hl] + ld a, [hl] ; ld l, a + ld h, a + ld a, e + ld l, a + + di + ld a, $1 + ld [rVBK], a + push hl + ld a, [hl] + ld c, a ; save attribute count for later + ld de, $10 + add hl, de + ld a, h + ld [rHDMA1], a + ld a, l + ld [rHDMA2], a + ld de, vBGMap0 + ld a, d + ld [rHDMA3], a + ld a, e + ld [rHDMA4], a + + ld a, [rLCDC] + and rLCDC_ENABLE_MASK ; is LCD off? + jr z, .lcdOff ; if off, transfer immediately +; wait for VBlank if LCD is on +.waitForVBlankLoop1 + ld a, [rLY] + cp $90 + jr nz, .waitForVBlankLoop1 +.waitForAccessibleVRAMLoop1 + ld a, [rSTAT] + and %10 ; are we in HBlank or VBlank? + jr nz, .waitForAccessibleVRAMLoop1 ; loop until we're in a safe period to transfer to VRAM +.lcdOff + ld a, c ; number of BG attributes to transfer, plus 1 times 16 + ld [rHDMA5], a ; initiate transfer + call Func_3082 ; update audio so it doesn't "lag" + pop hl + ld a, [hli] + ld c, a ; number of BG attributes to transfer, plus 1 times 16 + ld a, [hli] + ld e, a + ld a, [hli] + ld d, a ; offset of the attributes + add hl, de ; hl = new pointer + ld a, h + ld [rHDMA1], a + ld a, l + ld [rHDMA2], a + ld de, vBGMap1 ; copy to vBGMap1 + ld a, d + ld [rHDMA3], a + ld a, e + ld [rHDMA4], a +; LCD check again + ld a, [rLCDC] + and rLCDC_ENABLE_MASK ; is LCD off? + jr z, .lcdOff2 ; if off, transfer immediately +; wait for VBlank if LCD is on +.waitForVBlankLoop2 + ld a, [rLY] + cp $90 + jr nz, .waitForVBlankLoop2 +.waitForAccessibleVRAMLoop2 + ld a, [rSTAT] + and %10 ; are we in HBlank or VBlank? + jr nz, .waitForAccessibleVRAMLoop2 ; loop until we're in a safe period to transfer to VRAM +.lcdOff2 + ld a, c + ld [rHDMA5], a + pop af + dec a + dec a + dec a + dec a + jr nz, .checkIfHandlingPartyMenu + call HandleBadgeFaceAttributes + jr .done +.checkIfHandlingPartyMenu + dec a + call z, HandlePartyHPBarAttributes +.done + call Func_3082 + ld a, [rIF] + res VBLANK, a + ld [rIF], a + xor a + ld [rVBK], a + ei + ret + +BGMapAttributesPointers: + dw BGMapAttributes_Unknown1 + dw BGMapAttributes_Unknown2 + dw BGMapAttributes_GameFreakIntro + dw BGMapAttributes_TrainerCard + dw BGMapAttributes_PartyMenu + dw BGMapAttributes_NidorinoIntro + dw BGMapAttributes_TitleScreen + dw BGMapAttributes_Slots + dw BGMapAttributes_Pokedex + dw BGMapAttributes_StatusScreen + dw BGMapAttributes_Battle + dw BGMapAttributes_WholeScreen + dw BGMapAttributes_Unknown13 + +HandleBadgeFaceAttributes: +; zero out the attributes if the player doesn't have the respective badge +; BOULDERBADGE + ld hl, vBGMap1 + $183 + ld de, wTrainerCardBadgeAttributes + 6 * 0 + ld a, [de] + and a + call z, ZeroOutCurrentBadgeAttributes +; CASCADEBADGE + ld hl, vBGMap1 + $187 + ld de, wTrainerCardBadgeAttributes + 6 * 1 + ld a, [de] + and a + call z, ZeroOutCurrentBadgeAttributes +; THUNDERBADGE + ld hl, vBGMap1 + $18b + ld de, wTrainerCardBadgeAttributes + 6 * 2 + ld a, [de] + and a + call z, ZeroOutCurrentBadgeAttributes +; RAINBOWBADGE + ld hl, vBGMap1 + $18f + ld de, wTrainerCardBadgeAttributes + 6 * 3 + ld a, [de] + and a + call z, ZeroOutCurrentBadgeAttributes +; SOULBADGE + ld hl, vBGMap1 + $1e3 + ld de, wTrainerCardBadgeAttributes + 6 * 6 + ld a, [de] + and a + call z, ZeroOutCurrentBadgeAttributes +; MARSHBADGE + ld hl, vBGMap1 + $1e7 + ld de, wTrainerCardBadgeAttributes + 6 * 7 + ld a, [de] + and a + call z, ZeroOutCurrentBadgeAttributes +; VOLCANOBADGE + ld hl, vBGMap1 + $1eb + ld de, wTrainerCardBadgeAttributes + 6 * 8 + ld a, [de] + and a + call z, ZeroOutCurrentBadgeAttributes +; EARTHBADGE + ld hl, vBGMap1 + $1ef + ld de, wTrainerCardBadgeAttributes + 6 * 9 + ld a, [de] + and a + call z, ZeroOutCurrentBadgeAttributes + ret + +ZeroOutCurrentBadgeAttributes: + push hl + xor a + ld [hli], a + ld [hl], a + ld bc, $1f + add hl, bc + ld [hli], a + ld [hl], a + pop hl + ret + +HandlePartyHPBarAttributes: +; hp bars require 3 (green, orange, red) colours, when there are only 2 "free" colours per palette +; therefore, we must transfer individual bg attributes where the locations of the hp bars are in vram + ld hl, vBGMap1 + $25 ; location of start of the HP bar in vram + ld de, wPartyHPBarAttributes + ld c, PARTY_LENGTH +.loop + push bc + push hl + ld a, [de] + and $3 ; 4 possible palettes + rept 7 ; hp bar length in tiles + ld [hli], a + endr + pop hl + ld bc, $40 ; get 2nd party location + add hl, bc + push hl + + push de ; (inefficiently) copy de to hl + pop hl + + ld bc, $6 + add hl, bc ; get the next palette + + push hl + pop de ; copy back to de + + pop hl + pop bc + dec c + jr nz, .loop + ret diff --git a/engine/cable_club.asm b/engine/cable_club.asm index bd9ed683..a6552939 100755 --- a/engine/cable_club.asm +++ b/engine/cable_club.asm @@ -10,8 +10,7 @@ CableClub_DoBattleOrTrade: call LoadHpBarAndStatusTilePatterns call LoadTrainerInfoTextBoxTiles coord hl, 3, 8 - ld b, 2 - ld c, 12 + lb bc, 2, 12 call CableClub_TextBoxBorder coord hl, 4, 10 ld de, PleaseWaitString @@ -27,10 +26,10 @@ CableClub_DoBattleOrTradeAgain: ld hl, wSerialPlayerDataBlock ld a, SERIAL_PREAMBLE_BYTE ld b, 6 -.writePlayeDataBlockPreambleLoop +.writePlayerDataBlockPreambleLoop ld [hli], a dec b - jr nz, .writePlayeDataBlockPreambleLoop + jr nz, .writePlayerDataBlockPreambleLoop ld hl, wSerialRandomNumberListBlock ld a, SERIAL_PREAMBLE_BYTE ld b, 7 @@ -119,6 +118,7 @@ CableClub_DoBattleOrTradeAgain: ld [rSC], a .skipSendingTwoZeroBytes call Delay3 + call StopAllMusic ld a, (1 << SERIAL) ld [rIE], a ld hl, wSerialRandomNumberListBlock @@ -139,8 +139,6 @@ CableClub_DoBattleOrTradeAgain: call Serial_ExchangeBytes ld a, (1 << SERIAL) | (1 << TIMER) | (1 << VBLANK) ld [rIE], a - ld a, $ff - call PlaySound ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK jr z, .skipCopyingRandomNumberList ; the list generated by the gameboy clocking the connection is used by both gameboys @@ -255,14 +253,13 @@ CableClub_DoBattleOrTradeAgain: ld hl, wEnemyMons + (SERIAL_PREAMBLE_BYTE - 1) dec c jr nz, .unpatchEnemyMonsLoop - ld a, wEnemyMonOT % $100 + ld a, wEnemyMonOT & $ff ld [wUnusedCF8D], a ld a, wEnemyMonOT / $100 ld [wUnusedCF8D + 1], a xor a ld [wTradeCenterPointerTableIndex], a - ld a, $ff - call PlaySound + call StopAllMusic ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK ld c, 66 @@ -271,19 +268,27 @@ CableClub_DoBattleOrTradeAgain: cp LINK_STATE_START_BATTLE ld a, LINK_STATE_TRADING ld [wLinkState], a - jr nz, .asm_5506 + jr nz, .asm_55a0 ld a, LINK_STATE_BATTLING ld [wLinkState], a ld a, OPP_SONY1 ld [wCurOpponent], a call ClearScreen call Delay3 + ld b, $9 + call RunPaletteCommand ld hl, wOptions res 7, [hl] + ld a, [wLetterPrintingDelayFlags] + push af + xor a + ld [wLetterPrintingDelayFlags], a predef InitOpponent + pop af + ld [wLetterPrintingDelayFlags], a predef HealParty jp ReturnToCableClubRoom -.asm_5506 +.asm_55a0 ld c, BANK(Music_GameCorner) ld a, MUSIC_GAME_CORNER call PlayMusic @@ -308,6 +313,9 @@ CallCurrentTradeCenterFunction: TradeCenter_SelectMon: call ClearScreen + call Delay3 + ld b, $9 + call RunPaletteCommand call LoadTrainerInfoTextBoxTiles call TradeCenter_DrawPartyLists call TradeCenter_DrawCancelBox @@ -338,10 +346,10 @@ TradeCenter_SelectMon: ld a, 1 ld [wTopMenuItemX], a .enemyMonMenu_HandleInput - ld hl, hFlags_0xFFF6 + ld hl, hFlags_0xFFFA set 1, [hl] call HandleMenuInput - ld hl, hFlags_0xFFF6 + ld hl, hFlags_0xFFFA res 1, [hl] and a jp z, .getNewInput @@ -403,10 +411,10 @@ TradeCenter_SelectMon: lb bc, 6, 1 call ClearScreenArea .playerMonMenu_HandleInput - ld hl, hFlags_0xFFF6 + ld hl, hFlags_0xFFFA set 1, [hl] call HandleMenuInput - ld hl, hFlags_0xFFF6 + ld hl, hFlags_0xFFFA res 1, [hl] and a ; was anything pressed? jr nz, .playerMonMenu_SomethingPressed @@ -438,6 +446,7 @@ TradeCenter_SelectMon: ld a, [wEnemyPartyCount] dec a cp b + ; continue jr nc, .notPastLastEnemyMon ; when switching to the enemy mon menu, if the menu selection would be past the last enemy mon, select the last enemy mon ld [wCurrentMenuItem], a @@ -465,8 +474,7 @@ TradeCenter_SelectMon: .displayStatsTradeMenu push af coord hl, 0, 14 - ld b, 2 - ld c, 18 + lb bc, 2, 18 call CableClub_TextBoxBorder coord hl, 2, 16 ld de, .statsTrade @@ -601,8 +609,7 @@ TradeCenter_DrawCancelBox: ld bc, 2 * SCREEN_WIDTH + 9 call FillMemory coord hl, 0, 15 - ld b, 1 - ld c, 9 + lb bc, 1, 9 call CableClub_TextBoxBorder coord hl, 2, 16 ld de, CancelTextString @@ -624,6 +631,9 @@ TradeCenter_DisplayStats: ld [wWhichPokemon], a predef StatusScreen predef StatusScreen2 + call Delay3 + ld b, $9 + call RunPaletteCommand call GBPalNormal call LoadTrainerInfoTextBoxTiles call TradeCenter_DrawPartyLists @@ -631,12 +641,10 @@ TradeCenter_DisplayStats: TradeCenter_DrawPartyLists: coord hl, 0, 0 - ld b, 6 - ld c, 18 + lb bc, 6, 18 call CableClub_TextBoxBorder coord hl, 0, 8 - ld b, 6 - ld c, 18 + lb bc, 6, 18 call CableClub_TextBoxBorder coord hl, 5, 0 ld de, wPlayerName @@ -685,8 +693,7 @@ TradeCenter_Trade: ld [wMenuWatchMovingOutOfBounds], a ld [wMenuJoypadPollCount], a coord hl, 0, 12 - ld b, 4 - ld c, 18 + lb bc, 4, 18 call CableClub_TextBoxBorder ld a, [wTradingWhichPlayerMon] ld hl, wPartySpecies @@ -727,8 +734,7 @@ TradeCenter_Trade: ld a, $1 ld [wSerialExchangeNybbleSendData], a coord hl, 0, 12 - ld b, 4 - ld c, 18 + lb bc, 4, 18 call CableClub_TextBoxBorder coord hl, 1, 14 ld de, TradeCanceled @@ -744,8 +750,7 @@ TradeCenter_Trade: jr nz, .doTrade ; if the other person cancelled coord hl, 0, 12 - ld b, 4 - ld c, 18 + lb bc, 4, 18 call CableClub_TextBoxBorder coord hl, 1, 14 ld de, TradeCanceled @@ -792,6 +797,7 @@ TradeCenter_Trade: add hl, bc ld a, [hl] ld [wTradedPlayerMonSpecies], a + callabd_ModifyPikachuHappiness PIKAHAPPY_TRADE xor a ld [wRemoveMonFromBox], a call RemovePokemon @@ -845,15 +851,18 @@ TradeCenter_Trade: .usingExternalClock predef ExternalClockTradeAnim .tradeCompleted +; continue callab TryEvolvingMon call ClearScreen call LoadTrainerInfoTextBoxTiles call Serial_PrintWaitingTextAndSyncAndExchangeNybble ld c, 40 call DelayFrames + call Delay3 + ld b, $9 + call RunPaletteCommand coord hl, 0, 12 - ld b, 4 - ld c, 18 + lb bc, 4, 18 call CableClub_TextBoxBorder coord hl, 1, 14 ld de, TradeCompleted @@ -900,16 +909,16 @@ CableClub_Run: call CableClub_DoBattleOrTrade ld hl, Club_GFX ld a, h - ld [wTileSetGFXPtr + 1], a + ld [wTilesetGFXPtr + 1], a ld a, l - ld [wTileSetGFXPtr], a + ld [wTilesetGFXPtr], a ld a, Bank(Club_GFX) - ld [wTileSetBank], a + ld [wTilesetBank], a ld hl, Club_Coll ld a, h - ld [wTileSetCollisionPtr + 1], a + ld [wTilesetCollisionPtr + 1], a ld a, l - ld [wTileSetCollisionPtr], a + ld [wTilesetCollisionPtr], a xor a ld [wGrassRate], a inc a ; LINK_STATE_IN_CABLE_CLUB @@ -964,8 +973,14 @@ CableClub_TextBoxBorder: ; c = width CableClub_DrawHorizontalLine: ld d, c -.asm_5ae1 +.drawHorizontalLineLoop ld [hli], a dec d - jr nz, .asm_5ae1 + jr nz, .drawHorizontalLineLoop ret + +LoadTrainerInfoTextBoxTiles: + ld de, TrainerInfoTextBoxTileGraphics + ld hl, vChars2 + $760 + lb bc, BANK(TrainerInfoTextBoxTileGraphics), (TrainerInfoTextBoxTileGraphicsEnd - TrainerInfoTextBoxTileGraphics) / $10 + jp CopyVideoData diff --git a/engine/clear_save.asm b/engine/clear_save.asm index b47cd6c4..ab2a6aa8 100755 --- a/engine/clear_save.asm +++ b/engine/clear_save.asm @@ -1,10 +1,12 @@ -DoClearSaveDialogue: +DoClearSaveDialogue: ; DoClearSaveDialogue: call ClearScreen call RunDefaultPaletteCommand call LoadFontTilePatterns call LoadTextBoxTilePatterns ld hl, ClearSaveDataText call PrintText + ld a, B_BUTTON + ld [wJoyIgnore], a coord hl, 14, 7 lb bc, 8, 15 ld a, NO_YES_MENU @@ -12,6 +14,8 @@ DoClearSaveDialogue: ld a, TWO_OPTION_MENU ld [wTextBoxID], a call DisplayTextBoxID + ld a, 0 + ld [wJoyIgnore], a ld a, [wCurrentMenuItem] and a jp z, Init diff --git a/engine/debug1.asm b/engine/debug1.asm new file mode 100644 index 00000000..a39e8cac --- /dev/null +++ b/engine/debug1.asm @@ -0,0 +1,24 @@ +; not IshiharaTeam +SetDebugTeam: + ld de, DebugTeam +.loop + ld a, [de] + cp $ff + ret z + ld [wcf91], a + inc de + ld a, [de] + ld [wCurEnemyLVL], a + inc de + call AddPartyMon + jr .loop + +DebugTeam: + db SNORLAX,80 + db PERSIAN,80 + db JIGGLYPUFF,15 + db PIKACHU,5 + db $FF + +EmptyFunc: + ret diff --git a/engine/diploma_3a.asm b/engine/diploma_3a.asm new file mode 100755 index 00000000..3b633a1b --- /dev/null +++ b/engine/diploma_3a.asm @@ -0,0 +1,167 @@ +_DisplayDiploma: + call GBPalWhiteOutWithDelay3 + call ClearScreen + ld de, SurfingPikachu3Graphics + ld hl, vChars2 + lb bc, BANK(SurfingPikachu3Graphics), (SurfingPikachu3GraphicsEnd - SurfingPikachu3Graphics) / $10 + call CopyVideoData + + coord hl, 0, 0 + call Func_e9bdf + + coord hl, 0, 0 + call Func_e9beb + + coord hl, 19, 0 + call Func_e9beb + + ld a, $00 + coord hl, 0, 0 + ld [hl], a + coord hl, 19, 0 + ld [hl], a + + ld de, String_e9a73 + coord hl, 5, 2 + call PlaceString + + ld de, String_e9a7d + coord hl, 3, 4 + call PlaceString + + ld de, wPlayerName + coord hl, 10, 4 + call PlaceString + + ld de, String_e9a84 + coord hl, 2, 6 + call PlaceString + + ld de, String_e9ac8 + coord hl, 9, 16 + call PlaceString + + ld b, SET_PAL_GENERIC + call RunPaletteCommand + ld a, $01 + ld [$ffba], a + call Delay3 + call GBPalNormal + ret + +; e9a73 +String_e9a73: + db $10, "Diploma", $10, "@" + +String_e9a7d: + db "Player@" + +String_e9a84: + db "Congrats! This" + next "diploma certifies" + next "that you have" + next "completed your" + next "#DEX.@" + +String_e9ac8: + db "GAME FREAK@" + +Func_e9ad3: + call ClearScreen + coord hl, 0, 17 + call Func_e9bdf + coord hl, 0, 0 + call Func_e9beb + coord hl, 19, 0 + call Func_e9beb + ld a, $00 + coord hl, 0, 17 + ld [hl], a + coord hl, 19, 17 + ld [hl], a + ld de, Tilemap_e9b3e + coord hl, 6, 2 + lb bc, 10, 12 + call Diploma_Surfing_CopyBox + ld de, Tilemap_e9bb6 + coord hl, 5, 13 + lb bc, 1, 11 + call Diploma_Surfing_CopyBox + ld de, String_e9bd5 + coord hl, 2, 15 + call PlaceString + coord hl, 12, 15 + ld de, wPlayTimeHours + lb bc, $40 | 1, 3 + call PrintNumber + ld [hl], $16 + inc hl + ld de, wPlayTimeMinutes + lb bc, $80 | 1, 2 + call PrintNumber + ld a, [wNumSetBits] + cp 151 + ret nz + ld de, TileMap_e9bc1 + coord hl, 2, 0 + lb bc, 4, 5 + call Diploma_Surfing_CopyBox + ret + +Tilemap_e9b3e: + db $7f, $7f, $7f, $1a, $1b, $7f, $7f, $7f, $7f, $7f + db $7f, $7f, $7f, $7f, $7f, $1c, $1d, $1e, $1f, $20 + db $7f, $21, $22, $23, $7f, $24, $25, $26, $27, $28 + db $29, $2a, $2b, $2c, $2d, $2e, $2f, $30, $31, $32 + db $33, $34, $35, $36, $37, $38, $39, $3a, $3b, $3c + db $7f, $3d, $3e, $3f, $40, $41, $42, $43, $29, $44 + db $45, $46, $47, $48, $49, $4a, $4b, $29, $29, $4c + db $4d, $4e, $4f, $50, $51, $52, $53, $54, $55, $56 + db $57, $58, $59, $7f, $7f, $7f, $5a, $5b, $5c, $5d + db $5e, $5f, $60, $61, $62, $7f, $7f, $7f, $7f, $63 + db $64, $65, $66, $67, $68, $7f, $7f, $7f, $7f, $7f + db $7f, $69, $6a, $6b, $6c, $6d, $6e, $7f, $7f, $7f + +Tilemap_e9bb6: + db $05 + db $06 + db $07 + db $08 + db $09 + db $0a + db $0b + db $0c + db $0d + db $0e + db $0f + +TileMap_e9bc1: + db $70, $71, $7f, $72, $7f + db $73, $74, $75, $76, $77 + db $7f, $78, $11, $12, $13 + db $7f, $7f, $14, $15, $7f + +String_e9bd5: db "PLAY TIME@" + +Func_e9bdf: + ld c, 10 +.asm_e9be1 + ld [hl], $02 + inc hl + ld [hl], $01 + inc hl + dec c + jr nz, .asm_e9be1 + ret + +Func_e9beb: + ld c, 9 + ld de, SCREEN_WIDTH +.asm_e9bed + ld [hl], $04 + add hl, de + ld [hl], $03 + add hl, de + dec c + jr nz, .asm_e9bed + ret diff --git a/engine/display_pokedex.asm b/engine/display_pokedex.asm new file mode 100644 index 00000000..96a2dd6c --- /dev/null +++ b/engine/display_pokedex.asm @@ -0,0 +1,19 @@ +_DisplayPokedex: + ld hl, wd730 + set 6, [hl] + predef ShowPokedexData + ld hl, wd730 + res 6, [hl] + call ReloadMapData + ld c, 10 + call DelayFrames + predef IndexToPokedex + ld a, [wd11e] + dec a + ld c, a + ld b, FLAG_SET + ld hl, wPokedexSeen + predef FlagActionPredef + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ret diff --git a/engine/draw_badges.asm b/engine/draw_badges.asm new file mode 100644 index 00000000..412197b2 --- /dev/null +++ b/engine/draw_badges.asm @@ -0,0 +1,120 @@ +DrawBadges: +; Draw 4x2 gym leader faces, with the faces replaced by +; badges if they are owned. Used in the player status screen. + +; In Japanese versions, names are displayed above faces. +; Instead of removing relevant code, the name graphics were erased. + +; Tile ids for face/badge graphics. + ld de, wBadgeOrFaceTiles + ld hl, .FaceBadgeTiles + ld bc, 8 + call CopyData + +; Booleans for each badge. + ld hl, wTempObtainedBadgesBooleans + ld bc, 8 + xor a + call FillMemory + +; Alter these based on owned badges. + ld de, wTempObtainedBadgesBooleans + ld hl, wBadgeOrFaceTiles + ld a, [wObtainedBadges] + ld b, a + ld c, 8 +.CheckBadge + srl b + jr nc, .NextBadge + ld a, [hl] + add 4 ; Badge graphics are after each face + ld [hl], a + ld a, 1 + ld [de], a +.NextBadge + inc hl + inc de + dec c + jr nz, .CheckBadge + +; Draw two rows of badges. + ld hl, wBadgeNumberTile + ld a, $d8 ; [1] + ld [hli], a + ld [hl], $60 ; First name + + coord hl, 2, 11 + ld de, wTempObtainedBadgesBooleans + call .DrawBadgeRow + + coord hl, 2, 14 + ld de, wTempObtainedBadgesBooleans + 4 +; call .DrawBadgeRow +; ret + +.DrawBadgeRow ; e8c9 (3:68c9) +; Draw 4 badges. + + ld c, 4 +.DrawBadge + push de + push hl + +; Badge no. + ld a, [wBadgeNumberTile] + ld [hli], a + inc a + ld [wBadgeNumberTile], a + +; Names aren't printed if the badge is owned. + ld a, [de] + and a + ld a, [wBadgeNameTile] + jr nz, .SkipName + call .PlaceTiles + jr .PlaceBadge + +.SkipName + inc a + inc a + inc hl + +.PlaceBadge + ld [wBadgeNameTile], a + ld de, SCREEN_WIDTH - 1 + add hl, de + ld a, [wBadgeOrFaceTiles] + call .PlaceTiles + add hl, de + call .PlaceTiles + +; Shift badge array back one byte. + push bc + ld hl, wBadgeOrFaceTiles + 1 + ld de, wBadgeOrFaceTiles + ld bc, 8 + call CopyData + pop bc + + pop hl + ld de, 4 + add hl, de + + pop de + inc de + dec c + jr nz, .DrawBadge + ret + +.PlaceTiles + ld [hli], a + inc a + ld [hl], a + inc a + ret + +.FaceBadgeTiles + db $20, $28, $30, $38, $40, $48, $50, $58 + +GymLeaderFaceAndBadgeTileGraphics: + INCBIN "gfx/badges.2bpp" diff --git a/engine/evolution.asm b/engine/evolution.asm index c0a3434a..9cefff27 100755 --- a/engine/evolution.asm +++ b/engine/evolution.asm @@ -9,9 +9,7 @@ EvolveMon: xor a ld [wLowHealthAlarm], a ld [wChannelSoundIDs + CH4], a - dec a - ld [wNewSoundID], a - call PlaySound + call StopAllMusic ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a ld a, SFX_TINK @@ -67,9 +65,7 @@ EvolveMon: ld a, [wEvoNewSpecies] .done ld [wWholeScreenPaletteMonSpecies], a - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic ld a, [wWholeScreenPaletteMonSpecies] call PlayCry ld c, 0 diff --git a/engine/evolve_trade.asm b/engine/evolve_trade.asm deleted file mode 100755 index e17fc05c..00000000 --- a/engine/evolve_trade.asm +++ /dev/null @@ -1,44 +0,0 @@ -EvolveTradeMon: -; Verify the TradeMon's species name before -; attempting to initiate a trade evolution. - -; The names of the trade evolutions in Blue (JP) -; are checked. In that version, TradeMons that -; can evolve are Graveler and Haunter. - -; In localization, this check was translated -; before monster names were finalized. -; Then, Haunter's name was "Spectre". -; Since its name no longer starts with -; "SP", it is prevented from evolving. - -; This may have been why Red/Green's trades -; were used instead, where none can evolve. - -; This was fixed in Yellow. - - ld a, [wInGameTradeReceiveMonName] - - ; GRAVELER - cp "G" - jr z, .ok - - ; "SPECTRE" (HAUNTER) - cp "S" - ret nz - ld a, [wInGameTradeReceiveMonName + 1] - cp "P" - ret nz - -.ok - ld a, [wPartyCount] - dec a - ld [wWhichPokemon], a - ld a, $1 - ld [wForceEvolution], a - ld a, LINK_STATE_TRADING - ld [wLinkState], a - callab TryEvolvingMon - xor a ; LINK_STATE_NONE - ld [wLinkState], a - jp PlayDefaultMusic diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm index f50f8081..78ead030 100755 --- a/engine/evos_moves.asm +++ b/engine/evos_moves.asm @@ -1,5 +1,6 @@ ; try to evolve the mon in [wWhichPokemon] TryEvolvingMon: +EvolveTradeMon: ld hl, wCanEvolveFlags xor a ld [hl], a @@ -23,7 +24,8 @@ EvolutionAfterBattle: ld hl, wPartyCount push hl -Evolution_PartyMonLoop: ; loop over party mons +Evolution_PartyMonLoop: +; loop over party mons ld hl, wWhichPokemon inc [hl] pop hl @@ -93,9 +95,13 @@ Evolution_PartyMonLoop: ; loop over party mons jp c, Evolution_PartyMonLoop ; if so, go the next mon jr .doEvolution .checkItemEvo + ld a, [wIsInBattle] ; are we in battle? + and a ld a, [hli] + jp nz, .nextEvoEntry1 ; don't evolve if we're in a battle as wcf91 could be holding the last mon sent out + ld b, a ; evolution item - ld a, [wcf91] ; this is supposed to be the last item used, but it is also used to hold species numbers + ld a, [wcf91] ; last item used cp b ; was the evolution item in this entry used? jp nz, .nextEvoEntry1 ; if not, go to the next evolution entry .checkLevel @@ -140,7 +146,7 @@ Evolution_PartyMonLoop: ; loop over party mons ld [wEvoNewSpecies], a ld a, MONSTER_NAME ld [wNameListType], a - ld a, BANK(TrainerNames) ; bank is not used for monster names + ld a, BANK(MonsterNames) ; bank is not used for monster names ld [wPredefBank], a call GetName push hl @@ -307,7 +313,7 @@ StoppedEvolvingText: TX_FAR _StoppedEvolvingText db "@" -IsEvolvingText: +IsEvolvingText: ; 3affe (e:6ffes) TX_FAR _IsEvolvingText db "@" @@ -318,23 +324,9 @@ Evolution_ReloadTilesetTilePatterns: jp ReloadTilesetTilePatterns LearnMoveFromLevelUp: - ld hl, EvosMovesPointerTable ld a, [wd11e] ; species ld [wcf91], a - dec a - ld bc, 0 - ld hl, EvosMovesPointerTable - add a - rl b - ld c, a - add hl, bc - ld a, [hli] - ld h, [hl] - ld l, a -.skipEvolutionDataLoop ; loop to skip past the evolution data, which comes before the move data - ld a, [hli] - and a ; have we reached the end of the evolution data? - jr nz, .skipEvolutionDataLoop ; if not, jump back up + call GetMonLearnset .learnSetLoop ; loop over the learn set until we reach a move that is learnt at the current level or the end of the list ld a, [hli] and a ; have we reached the end of the learn set? @@ -370,33 +362,180 @@ LearnMoveFromLevelUp: call GetMoveName call CopyStringToCF4B predef LearnMove + ld a, b + and a + jr z, .done + callab IsThisPartymonStarterPikachu_Party + jr nc, .done + ld a, [wMoveNum] + cp THUNDERBOLT + jr z, .foundThunderOrThunderbolt + cp THUNDER + jr nz, .done +.foundThunderOrThunderbolt + ld a, $5 + ld [wd49c], a + ld a, $85 + ld [wPikachuMood], a .done ld a, [wcf91] ld [wd11e], a ret -; writes the moves a mon has at level [wCurEnemyLVL] to [de] -; move slots are being filled up sequentially and shifted if all slots are full -WriteMonMoves: - call GetPredefRegisters - push hl - push de - push bc +Func_3b079: + ld a, [wcf91] + push af + call Func_3b0a2 + jr c, .asm_3b09c + + call Func_3b10f + jr nc, .asm_3b096 + + call Func_3b0a2 + jr c, .asm_3b09c + + call Func_3b10f + jr nc, .asm_3b096 + + call Func_3b0a2 + jr c, .asm_3b09c +.asm_3b096 + pop af + ld [wcf91], a + and a + ret +.asm_3b09c + pop af + ld [wcf91], a + scf + ret + +Func_3b0a2: +; XXX what is wcf91 entering this function? + ld a, [wd11e] + ld [wMoveNum], a + predef CanLearnTM + ld a, c + and a + jr nz, .asm_3b0ec + ld hl, Pointer_3b0ee + ld a, [wcf91] + ld de, $1 + call IsInArray + jr c, .asm_3b0d2 + ld a, $ff + ld [wMonHGrowthRate], a + ld a, [wd11e] + ld hl, wMonHMoves + ld de, $1 + call IsInArray + jr c, .asm_3b0ec +.asm_3b0d2 + ld a, [wd11e] + ld d, a + call GetMonLearnset +.loop + ld a, [hli] + and a + jr z, .asm_3b0ea + ld b, a + ld a, [wCurEnemyLVL] + cp b + jr c, .asm_3b0ea + ld a, [hli] + cp d + jr z, .asm_3b0ec + jr .loop +.asm_3b0ea + and a + ret +.asm_3b0ec + scf + ret + +Pointer_3b0ee: + db NIDOKING + db IVYSAUR + db EXEGGUTOR + db GENGAR + db NIDOQUEEN + db ARCANINE + db GYARADOS + db BLASTOISE + db GOLEM + db DRAGONITE + db NINETALES + db DRAGONAIR + db KABUTOPS + db OMASTAR + db JIGGLYPUFF + db FLAREON + db JOLTEON + db VAPOREON + db BEEDRILL + db BUTTERFREE + db MACHAMP + db CLOYSTER + db CLEFABLE + db ALAKAZAM + db STARMIE + db VENUSAUR + db TENTACRUEL + db CHARMELEON + db WARTORTLE + db CHARIZARD + db VILEPLUME + db VICTREEBEL + db $ff + +Func_3b10f: + ld c, $0 +.asm_3b111 ld hl, EvosMovesPointerTable - ld b, 0 - ld a, [wcf91] ; cur mon ID - dec a - add a - rl b - ld c, a + ld b, $0 + add hl, bc add hl, bc ld a, [hli] ld h, [hl] ld l, a -.skipEvoEntriesLoop +.asm_3b11b ld a, [hli] and a - jr nz, .skipEvoEntriesLoop + jr z, .asm_3b130 + cp $2 + jr nz, .asm_3b124 + inc hl +.asm_3b124 + inc hl + ld a, [wcf91] + cp [hl] + jr z, .asm_3b138 + inc hl + ld a, [hl] + and a + jr nz, .asm_3b11b +.asm_3b130 + inc c + ld a, c + cp VICTREEBEL + jr c, .asm_3b111 + and a + ret +.asm_3b138 + inc c + ld a, c + ld [wcf91], a + scf + ret + +; writes the moves a mon has at level [wCurEnemyLVL] to [de] +; move slots are being filled up sequentially and shifted if all slots are full +WriteMonMoves: + call GetPredefRegisters + push hl + push de + push bc + call GetMonLearnset jr .firstMove .nextMove pop de @@ -510,4 +649,21 @@ WriteMonMoves_ShiftMoveData: Evolution_FlagAction: predef_jump FlagActionPredef +GetMonLearnset: + ld hl, EvosMovesPointerTable + ld b, 0 + ld a, [wcf91] + dec a + ld c, a + add hl, bc + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a +.skipEvolutionDataLoop ; loop to skip past the evolution data, which comes before the move data + ld a, [hli] + and a ; have we reached the end of the evolution data? + jr nz, .skipEvolutionDataLoop ; if not, jump back up + ret + INCLUDE "data/evos_moves.asm" diff --git a/engine/flag_action_predef.asm b/engine/flag_action_predef.asm new file mode 100644 index 00000000..dc516887 --- /dev/null +++ b/engine/flag_action_predef.asm @@ -0,0 +1,73 @@ +FlagActionPredef: + call GetPredefRegisters + +FlagAction: +; Perform action b on bit c +; in the bitfield at hl. +; 0: reset +; 1: set +; 2: read +; Return the result in c. + + push hl + push de + push bc + + ; bit + ld a, c + ld d, a + and 7 + ld e, a + + ; byte + ld a, d + srl a + srl a + srl a + add l + ld l, a + jr nc, .ok + inc h +.ok + + ; d = 1 << e (bitmask) + inc e + ld d, 1 +.shift + dec e + jr z, .shifted + sla d + jr .shift +.shifted + + ld a, b + and a + jr z, .reset + cp 2 + jr z, .read + +.set + ld b, [hl] + ld a, d + or b + ld [hl], a + jr .done + +.reset + ld b, [hl] + ld a, d + xor $ff + and b + ld [hl], a + jr .done + +.read + ld b, [hl] + ld a, d + and b +.done + pop bc + pop de + pop hl + ld c, a + ret diff --git a/engine/gamefreak.asm b/engine/gamefreak.asm index 69c059ff..6545e216 100755 --- a/engine/gamefreak.asm +++ b/engine/gamefreak.asm @@ -2,12 +2,14 @@ LoadShootingStarGraphics: ld a, $f9 ld [rOBP0], a ld a, $a4 - ld [rOBP1], a - ld de, AnimationTileset2 + $30 ; star tile (top left quadrant) + ld [rOBP1], a ; $ff49 + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 + ld de, AnimationTileset2 + $30 ; $4757 ; star tile (top left quadrant) ld hl, vChars1 + $200 lb bc, BANK(AnimationTileset2), $01 call CopyVideoData - ld de, AnimationTileset2 + $130 ; star tile (bottom left quadrant) + ld de, AnimationTileset2 + $130 ; $481e ; star tile (bottom left quadrant) ld hl, vChars1 + $210 lb bc, BANK(AnimationTileset2), $01 call CopyVideoData @@ -37,7 +39,7 @@ AnimateShootingStar: push bc .bigStarInnerLoop ld a, [hl] ; Y - add 4 + add 4 ; y ld [hli], a ld a, [hl] ; X add -4 @@ -58,11 +60,11 @@ AnimateShootingStar: .next cp b jr nz, .bigStarLoop - -; Clear big star OAM. ld hl, wOAMBuffer ld c, 4 ld de, 4 + +; Clear big star OAM. .clearOAMLoop ld [hl], 160 add hl, de @@ -72,22 +74,22 @@ AnimateShootingStar: ; Make Gamefreak logo flash. ld b, 3 .flashLogoLoop - ld hl, rOBP0 + ld hl, rOBP0 ; $ff48 rrc [hl] rrc [hl] + call UpdateGBCPal_OBP0 ld c, 10 call CheckForUserInterruption ret c dec b jr nz, .flashLogoLoop - ; Copy 24 instances of the small stars OAM data. ; Note that their coordinates put them off-screen. ld de, wOAMBuffer ld a, 24 .initSmallStarsOAMLoop push af - ld hl, SmallStarsOAM + ld hl, SmallStarsOAM ; $40ee ld bc, SmallStarsOAMEnd - SmallStarsOAM call CopyData pop af @@ -96,8 +98,8 @@ AnimateShootingStar: ; Animate the small stars falling from the Gamefreak logo. xor a - ld [wMoveDownSmallStarsOAMCount], a - ld hl, SmallStarsWaveCoordsPointerTable + ld [wMoveDownSmallStarsOAMCount], a ; wWhichTrade + ld hl, SmallStarsWaveCoordsPointerTable ; 1c:4105 ld c, 6 .smallStarsLoop ld a, [hli] @@ -118,6 +120,15 @@ AnimateShootingStar: ld [hli], a ; X inc de inc hl + push bc + ld a, [de] + ld b,a + ld a, [hl] + and $f0 + or b + ld [hl], a + inc de + pop bc inc hl dec c jr nz, .smallStarsInnerLoop @@ -162,27 +173,35 @@ SmallStarsWaveCoordsPointerTable: SmallStarsWave1Coords: db $68,$30 - db $68,$40 + db $05,$68 + db $40,$05 db $68,$58 - db $68,$78 + db $04,$68 + db $78,$07 SmallStarsWave2Coords: db $68,$38 - db $68,$48 + db $05,$68 + db $48,$06 db $68,$60 - db $68,$70 + db $04,$68 + db $70,$07 SmallStarsWave3Coords: db $68,$34 - db $68,$4C + db $05,$68 + db $4c,$06 db $68,$54 - db $68,$64 + db $06,$68 + db $64,$07 SmallStarsWave4Coords: - db $68,$3C - db $68,$5C - db $68,$6C - db $68,$74 + db $68,$3c + db $05,$68 + db $5c,$04 + db $68,$6c + db $07,$68 + db $74,$07 SmallStarsEmptyWave: db $FF @@ -195,17 +214,16 @@ MoveDownSmallStars: ld de, -4 ld c, a .innerLoop - inc [hl] ; Y + inc [hl] add hl, de dec c jr nz, .innerLoop - ; Toggle the palette so that the lower star in the small stars tile blinks in ; and out. - ld a, [rOBP1] + ld a, [rOBP1] ; $ff49 xor %10100000 - ld [rOBP1], a - + ld [rOBP1], a ; $ff49 + call UpdateGBCPal_OBP1 ld c, 3 call CheckForUserInterruption ret c @@ -233,10 +251,10 @@ GameFreakLogoOAMData: GameFreakLogoOAMDataEnd: GameFreakShootingStarOAMData: - db $00,$A0,$A0,$10 - db $00,$A8,$A0,$30 - db $08,$A0,$A1,$10 - db $08,$A8,$A1,$30 + db $00,$A0,$A0,$14 + db $00,$A8,$A0,$34 + db $08,$A0,$A1,$14 + db $08,$A8,$A1,$34 GameFreakShootingStarOAMDataEnd: FallingStar: diff --git a/engine/get_bag_item_quantity.asm b/engine/get_bag_item_quantity.asm new file mode 100644 index 00000000..f10df1a0 --- /dev/null +++ b/engine/get_bag_item_quantity.asm @@ -0,0 +1,18 @@ +GetQuantityOfItemInBag: +; In: b = item ID +; Out: b = how many of that item are in the bag + call GetPredefRegisters + ld hl, wNumBagItems +.loop + inc hl + ld a, [hli] + cp $ff + jr z, .notInBag + cp b + jr nz, .loop + ld a, [hl] + ld b, a + ret +.notInBag + ld b, 0 + ret diff --git a/engine/give_pokemon.asm b/engine/give_pokemon.asm index 549a042d..9cbb4039 100755 --- a/engine/give_pokemon.asm +++ b/engine/give_pokemon.asm @@ -44,6 +44,8 @@ _GivePokemon: ret .addToParty call SetPokedexOwnedFlag + ld hl, UnknownTerminator_f6794 + call PrintText call AddPartyMon ld a, 1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a @@ -68,6 +70,9 @@ SetPokedexOwnedFlag: ld hl, GotMonText jp PrintText +UnknownTerminator_f6794: + db "@" + GotMonText: TX_FAR _GotMonText db $0b diff --git a/engine/hall_of_fame.asm b/engine/hall_of_fame.asm index 0e35f709..59e97892 100755 --- a/engine/hall_of_fame.asm +++ b/engine/hall_of_fame.asm @@ -33,8 +33,8 @@ AnimateHallOfFame: .skipInc ld a, $90 ld [hWY], a - ld c, BANK(Music_HallOfFame) - ld a, MUSIC_HALL_OF_FAME + ld c, $1f ; BANK(Music_HallOfFame) + ld a, $ca ; MUSIC_HALL_OF_FAME call PlayMusic ld hl, wPartySpecies ld c, $ff @@ -58,8 +58,7 @@ AnimateHallOfFame: ld c, 80 call DelayFrames coord hl, 2, 13 - ld b, $3 - ld c, $e + lb bc, $3, $e call TextBoxBorder coord hl, 4, 15 ld de, HallOfFameText @@ -77,7 +76,7 @@ AnimateHallOfFame: ld bc, HOF_MON call AddNTimes ld [hl], $ff - call SaveHallOfFameTeams + callab SaveHallOfFameTeams ; useless since in same bank xor a ld [wHoFMonSpecies], a inc a @@ -122,6 +121,7 @@ HoFShowMonOrPlayer: call RunPaletteCommand ld a, %11100100 ld [rBGP], a + call UpdateGBCPal_BGP ld c, $31 ; back pic call HoFLoadMonPlayerPicTileIDs ld d, $a0 @@ -151,15 +151,30 @@ HoFShowMonOrPlayer: HoFDisplayAndRecordMonInfo: ld a, [wHoFPartyMonIndex] - ld hl, wPartyMonNicks + ld hl, wPartyMonNicks ; wPartyMonNicks call GetPartyMonName call HoFDisplayMonInfo + ld a, [wHoFPartyMonIndex] + ld [wWhichPokemon], a + callab IsThisPartymonStarterPikachu_Party ; 3f:4e18 + jr nc, .asm_70336 + ld e, $22 + callab PlayPikachuSoundClip + jr .asm_7033c +.asm_70336 + ld a,[wHoFMonSpecies] + call PlayCry +.asm_7033c jp HoFRecordMonInfo +Func_7033f: + call HoFDisplayMonInfo + ld a,[wHoFMonSpecies] + jp PlayCry + HoFDisplayMonInfo: coord hl, 0, 2 - ld b, 9 - ld c, 10 + lb bc, 9, 10 call TextBoxBorder coord hl, 2, 6 ld de, HoFMonInfoText @@ -174,8 +189,7 @@ HoFDisplayMonInfo: ld [wd0b5], a coord hl, 3, 9 predef PrintMonType - ld a, [wHoFMonSpecies] - jp PlayCry + ret HoFMonInfoText: db "LEVEL/" @@ -183,13 +197,16 @@ HoFMonInfoText: next "TYPE2/@" HoFLoadPlayerPics: - ld de, RedPicFront + ld de, RedPicFront ; $6ede ld a, BANK(RedPicFront) call UncompressSpriteFromDE + ld a,$0 + call SwitchSRAMBankAndLatchClockData ld hl, sSpriteBuffer1 ld de, sSpriteBuffer0 ld bc, $310 call CopyData + call PrepareRTCDataAndDisableSRAM ld de, vFrontPic call InterlaceMergeSpriteBuffers ld de, RedPicBack @@ -201,8 +218,7 @@ HoFLoadPlayerPics: ld c, $1 HoFLoadMonPlayerPicTileIDs: -; c = base tile ID - ld b, 0 + ld b, $0 coord hl, 12, 5 predef_jump CopyTileIDsFromList @@ -210,12 +226,10 @@ HoFDisplayPlayerStats: SetEvent EVENT_HALL_OF_FAME_DEX_RATING predef DisplayDexRating coord hl, 0, 4 - ld b, $6 - ld c, $a + lb bc, 6, 10 call TextBoxBorder coord hl, 5, 0 - ld b, $2 - ld c, $9 + lb bc, 2, 9 call TextBoxBorder coord hl, 7, 2 ld de, wPlayerName diff --git a/engine/heal_party.asm b/engine/heal_party.asm new file mode 100644 index 00000000..7aaa1bd1 --- /dev/null +++ b/engine/heal_party.asm @@ -0,0 +1,99 @@ +HealParty: +; Restore HP and PP. + + ld hl, wPartySpecies + ld de, wPartyMon1HP +.healmon + ld a, [hli] + cp $ff + jr z, .done + + push hl + push de + + ld hl, wPartyMon1Status - wPartyMon1HP + add hl, de + xor a + ld [hl], a + + push de + ld b, NUM_MOVES ; A Pokémon has 4 moves +.pp + ld hl, wPartyMon1Moves - wPartyMon1HP + add hl, de + + ld a, [hl] + and a + jr z, .nextmove + + dec a + ld hl, wPartyMon1PP - wPartyMon1HP + add hl, de + + push hl + push de + push bc + + ld hl, Moves + ld bc, MoveEnd - Moves + call AddNTimes + ld de, wcd6d + ld a, BANK(Moves) + call FarCopyData + ld a, [wcd6d + 5] ; PP is byte 5 of move data + + pop bc + pop de + pop hl + + inc de + push bc + ld b, a + ld a, [hl] + and $c0 + add b + ld [hl], a + pop bc + +.nextmove + dec b + jr nz, .pp + pop de + + ld hl, wPartyMon1MaxHP - wPartyMon1HP + add hl, de + ld a, [hli] + ld [de], a + inc de + ld a, [hl] + ld [de], a + + pop de + pop hl + + push hl + ld bc, wPartyMon2 - wPartyMon1 + ld h, d + ld l, e + add hl, bc + ld d, h + ld e, l + pop hl + jr .healmon + +.done + xor a + ld [wWhichPokemon], a + ld [wd11e], a + + ld a, [wPartyCount] + ld b, a +.ppup + push bc + call RestoreBonusPP + pop bc + ld hl, wWhichPokemon + inc [hl] + dec b + jr nz, .ppup + ret diff --git a/engine/hidden_object_functions14.asm b/engine/hidden_object_functions14.asm index 7591fac0..2781e182 100755 --- a/engine/hidden_object_functions14.asm +++ b/engine/hidden_object_functions14.asm @@ -66,18 +66,18 @@ ViridianSchoolNotebookText4: PrintFightingDojoText2: call EnableAutoTextBoxDrawing - tx_pre_jump FightingDojoText_52a10 + tx_pre_jump EnemiesOnEverySideText -FightingDojoText_52a10: - TX_FAR _FightingDojoText_52a10 +EnemiesOnEverySideText: + TX_FAR _EnemiesOnEverySideText db "@" PrintFightingDojoText3: call EnableAutoTextBoxDrawing - tx_pre_jump FightingDojoText_52a1d + tx_pre_jump WhatGoesAroundComesAroundText -FightingDojoText_52a1d: - TX_FAR _FightingDojoText_52a1d +WhatGoesAroundComesAroundText: + TX_FAR _WhatGoesAroundComesAroundText db "@" PrintFightingDojoText: @@ -89,7 +89,7 @@ FightingDojoText: db "@" PrintIndigoPlateauHQText: - ld a, [wSpriteStateData1 + 9] + ld a, [wPlayerFacingDirection] cp SPRITE_FACING_UP ret nz call EnableAutoTextBoxDrawing diff --git a/engine/hidden_object_functions17.asm b/engine/hidden_object_functions17.asm index 1b571d35..2279225e 100755 --- a/engine/hidden_object_functions17.asm +++ b/engine/hidden_object_functions17.asm @@ -14,7 +14,7 @@ RedBedroomPCText: TX_PLAYERS_PC Route15GateLeftBinoculars: - ld a, [wSpriteStateData1 + 9] + ld a, [wPlayerFacingDirection] cp SPRITE_FACING_UP ret nz call EnableAutoTextBoxDrawing @@ -22,7 +22,10 @@ Route15GateLeftBinoculars: ld a, ARTICUNO ld [wcf91], a call PlayCry - jp DisplayMonFrontSpriteInBox + call DisplayMonFrontSpriteInBox + xor a + ld [H_AUTOBGTRANSFERENABLED], a + ret Route15UpstairsBinocularsText: TX_FAR _Route15UpstairsBinocularsText @@ -52,6 +55,30 @@ KabutopsFossilText: TX_FAR _KabutopsFossilText db "@" +FanClubPicture1: + ld a, RAPIDASH + ld [wcf91], a + call DisplayMonFrontSpriteInBox + call EnableAutoTextBoxDrawing + tx_pre FanClubPicture1Text + ret + +FanClubPicture1Text: + TX_FAR _FanClubPicture1Text + db "@" + +FanClubPicture2: + ld a, FEAROW + ld [wcf91], a + call DisplayMonFrontSpriteInBox + call EnableAutoTextBoxDrawing + tx_pre FanClubPicture2Text + ret + +FanClubPicture2Text: + TX_FAR _FanClubPicture2Text + db "@" + DisplayMonFrontSpriteInBox: ; Displays a pokemon's front sprite in a pop-up window. ; [wcf91] = pokemon interal id number @@ -95,23 +122,22 @@ LinkCableHelp: ld hl, LinkCableHelpText1 call PrintText xor a - ld [wMenuItemOffset], a ; not used + ld [wMenuItemOffset], a ld [wCurrentMenuItem], a ld [wLastMenuItem], a ld a, A_BUTTON | B_BUTTON ld [wMenuWatchedKeys], a - ld a, 3 + ld a, $3 ld [wMaxMenuItem], a - ld a, 2 + ld a, $2 ld [wTopMenuItemY], a - ld a, 1 + ld a, $1 ld [wTopMenuItemX], a .linkHelpLoop ld hl, wd730 set 6, [hl] coord hl, 0, 0 - ld b, 8 - ld c, 13 + lb bc, $8, $d call TextBoxBorder coord hl, 2, 2 ld de, HowToLinkText @@ -122,13 +148,13 @@ LinkCableHelp: bit 1, a ; pressed b jr nz, .exit ld a, [wCurrentMenuItem] - cp 3 ; pressed a on "STOP READING" + cp $3 ; pressed a on "STOP READING" jr z, .exit ld hl, wd730 res 6, [hl] ld hl, LinkCableInfoTexts add a - ld d, 0 + ld d, $0 ld e, a add hl, de ld a, [hli] @@ -184,11 +210,11 @@ ViridianSchoolBlackboard: ld [wLastMenuItem], a ld a, D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON ld [wMenuWatchedKeys], a - ld a, 2 + ld a, $2 ld [wMaxMenuItem], a - ld a, 2 + ld a, $2 ld [wTopMenuItemY], a - ld a, 1 + ld a, $1 ld [wTopMenuItemX], a .blackboardLoop ld hl, wd730 @@ -210,24 +236,24 @@ ViridianSchoolBlackboard: bit 4, a ; pressed right jr z, .didNotPressRight ; move cursor to right column - ld a, 2 + ld a, $2 ld [wMaxMenuItem], a - ld a, 2 + ld a, $2 ld [wTopMenuItemY], a - ld a, 6 + ld a, $6 ld [wTopMenuItemX], a - ld a, 3 ; in the the right column, use an offset to prevent overlap + ld a, $3 ; in the the right column, use an offset to prevent overlap ld [wMenuItemOffset], a jr .blackboardLoop .didNotPressRight bit 5, a ; pressed left jr z, .didNotPressLeftOrRight ; move cursor to left column - ld a, 2 + ld a, $2 ld [wMaxMenuItem], a - ld a, 2 + ld a, $2 ld [wTopMenuItemY], a - ld a, 1 + ld a, $1 ld [wTopMenuItemX], a xor a ld [wMenuItemOffset], a @@ -235,9 +261,9 @@ ViridianSchoolBlackboard: .didNotPressLeftOrRight ld a, [wCurrentMenuItem] ld b, a - ld a, [wMenuItemOffset] + ld a, [wAnimationID] add b - cp 5 ; cursor is pointing to "QUIT" + cp $5 ; cursor is pointing to "QUIT" jr z, .exitBlackboard ; we must have pressed a on a status condition ; so print the text @@ -245,7 +271,7 @@ ViridianSchoolBlackboard: res 6, [hl] ld hl, ViridianBlackboardStatusPointers add a - ld d, 0 + ld d, $0 ld e, a add hl, de ld a, [hli] @@ -339,53 +365,17 @@ GymTrashScript: .openFirstLock ; Next can is trying for the second switch. SetEvent EVENT_1ST_LOCK_OPENED - - ld hl, GymTrashCans - ld a, [wGymTrashCanIndex] - ; * 5 - ld b, a - add a - add a - add b - - ld d, 0 - ld e, a - add hl, de - ld a, [hli] - -; There is a bug in this code. It should calculate a value in the range [0, 3] -; but if the mask and random number don't have any 1 bits in common, then -; the result of the AND will be 0. When 1 is subtracted from that, the value -; will become $ff. This will result in 255 being added to hl, which will cause -; hl to point to one of the zero bytes that pad the end of the ROM bank. -; Trash can 0 was intended to be able to have the second lock only when the -; first lock was in trash can 1 or 3. However, due to this bug, trash can 0 can -; have the second lock regardless of which trash can had the first lock. - - ld [hGymTrashCanRandNumMask], a - push hl - call Random - swap a - ld b, a - ld a, [hGymTrashCanRandNumMask] - and b - dec a - pop hl - - ld d, 0 - ld e, a - add hl, de - ld a, [hl] - and $f - ld [wSecondLockTrashCanIndex], a - + callab Yellow_SampleSecondTrashCan tx_pre_id VermilionGymTrashSuccessText1 jr .done .trySecondLock - ld a, [wSecondLockTrashCanIndex] - ld b, a ld a, [wGymTrashCanIndex] + ld b, a + ld a, [wSecondLockTrashCanIndex] + cp b + jr z, .openSecondLock + ld a, [wSecondLockTrashCanIndex + 1] cp b jr z, .openSecondLock @@ -413,25 +403,26 @@ GymTrashScript: GymTrashCans: ; byte 0: mask for random number ; bytes 1-4: indices of the trash cans that can have the second lock -; (but see the comment above explaining a bug regarding this) ; Note that the mask is simply the number of valid trash can indices that -; follow. The remaining bytes are filled with 0 to pad the length of each entry +; follow. The remaining bytes are filled with -1 to pad the length of each entry ; to 5 bytes. - db 2, 1, 3, 0, 0 ; 0 - db 3, 0, 2, 4, 0 ; 1 - db 2, 1, 5, 0, 0 ; 2 - db 3, 0, 4, 6, 0 ; 3 +; This is functionally replaced with GymTrashCans3a but was never removed from source. + + db 2, 1, 3, -1, -1 ; 0 + db 3, 0, 2, 4, -1 ; 1 + db 2, 1, 5, -1, -1 ; 2 + db 3, 0, 4, 6, -1 ; 3 db 4, 1, 3, 5, 7 ; 4 - db 3, 2, 4, 8, 0 ; 5 - db 3, 3, 7, 9, 0 ; 6 + db 3, 2, 4, 8, -1 ; 5 + db 3, 3, 7, 9, -1 ; 6 db 4, 4, 6, 8, 10 ; 7 - db 3, 5, 7, 11, 0 ; 8 - db 3, 6, 10, 12, 0 ; 9 + db 3, 5, 7, 11, -1 ; 8 + db 3, 6, 10, 12, -1 ; 9 db 4, 7, 9, 11, 13 ; 10 - db 3, 8, 10, 14, 0 ; 11 - db 2, 9, 13, 0, 0 ; 12 - db 3, 10, 12, 14, 0 ; 13 - db 2, 11, 13, 0, 0 ; 14 + db 3, 8, 10, 14, -1 ; 11 + db 2, 9, 13, -1, -1 ; 12 + db 3, 10, 12, 14, -1 ; 13 + db 2, 11, 13, -1, -1 ; 14 VermilionGymTrashSuccessText1: TX_FAR _VermilionGymTrashSuccessText1 diff --git a/engine/hidden_object_functions18.asm b/engine/hidden_object_functions18.asm index 6ce582ed..f96f0e3a 100755 --- a/engine/hidden_object_functions18.asm +++ b/engine/hidden_object_functions18.asm @@ -3,7 +3,7 @@ GymStatues: ; if in a gym and don’t have the corresponding badge, a = GymStatueText1_id and jp PrintPredefTextID ; else ret call EnableAutoTextBoxDrawing - ld a, [wSpriteStateData1 + 9] + ld a, [wPlayerFacingDirection] cp SPRITE_FACING_UP ret nz ld hl, .BadgeFlags @@ -29,14 +29,14 @@ GymStatues: jp PrintPredefTextID .BadgeFlags: - db PEWTER_GYM, %00000001 - db CERULEAN_GYM, %00000010 - db VERMILION_GYM,%00000100 - db CELADON_GYM, %00001000 - db FUCHSIA_GYM, %00010000 - db SAFFRON_GYM, %00100000 - db CINNABAR_GYM, %01000000 - db VIRIDIAN_GYM, %10000000 + db PEWTER_GYM, %00000001 + db CERULEAN_GYM, %00000010 + db VERMILION_GYM, %00000100 + db CELADON_GYM, %00001000 + db FUCHSIA_GYM, %00010000 + db SAFFRON_GYM, %00100000 + db CINNABAR_GYM, %01000000 + db VIRIDIAN_GYM, %10000000 db $ff GymStatueText1: @@ -64,7 +64,7 @@ PrintBenchGuyText: .match ld a, [hli] ld b, a - ld a, [wSpriteStateData1 + 9] + ld a, [wPlayerFacingDirection] cp b jr nz, .loop ; player isn't facing left at the bench guy ld a, [hl] @@ -72,30 +72,36 @@ PrintBenchGuyText: ; format: db map id, player sprite facing direction, text id of PredefTextIDPointerTable BenchGuyTextPointers: - db VIRIDIAN_POKECENTER, SPRITE_FACING_LEFT - db (ViridianCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 - db PEWTER_POKECENTER, SPRITE_FACING_LEFT - db (PewterCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 - db CERULEAN_POKECENTER, SPRITE_FACING_LEFT - db (CeruleanCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 - db LAVENDER_POKECENTER, SPRITE_FACING_LEFT - db (LavenderCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 - db VERMILION_POKECENTER, SPRITE_FACING_LEFT - db (VermilionCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 - db CELADON_POKECENTER, SPRITE_FACING_LEFT - db (CeladonCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 - db CELADON_HOTEL, SPRITE_FACING_LEFT - db (CeladonCityHotelText_id - TextPredefs) / 2 + 1 - db FUCHSIA_POKECENTER, SPRITE_FACING_LEFT - db (FuchsiaCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 - db CINNABAR_POKECENTER, SPRITE_FACING_LEFT - db (CinnabarIslandPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 - db SAFFRON_POKECENTER, SPRITE_FACING_LEFT - db (SaffronCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 - db MT_MOON_POKECENTER, SPRITE_FACING_LEFT - db (MtMoonPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 - db ROCK_TUNNEL_POKECENTER,SPRITE_FACING_LEFT - db (RockTunnelPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db VIRIDIAN_POKECENTER, SPRITE_FACING_LEFT + db_tx_pre ViridianCityPokecenterBenchGuyText + db PEWTER_POKECENTER, SPRITE_FACING_LEFT + db_tx_pre PewterCityPokecenterBenchGuyText + db CERULEAN_POKECENTER, SPRITE_FACING_LEFT + db_tx_pre CeruleanCityPokecenterBenchGuyText + db LAVENDER_POKECENTER, SPRITE_FACING_LEFT + db_tx_pre LavenderCityPokecenterBenchGuyText + db VERMILION_POKECENTER, SPRITE_FACING_LEFT + db_tx_pre VermilionCityPokecenterBenchGuyText + db CELADON_POKECENTER, SPRITE_FACING_LEFT + db_tx_pre CeladonCityPokecenterBenchGuyText + db CELADON_HOTEL, SPRITE_FACING_LEFT + db_tx_pre CeladonCityHotelText + db FUCHSIA_POKECENTER, SPRITE_FACING_LEFT + db_tx_pre FuchsiaCityPokecenterBenchGuyText + db CINNABAR_POKECENTER, SPRITE_FACING_LEFT + db_tx_pre CinnabarIslandPokecenterBenchGuyText + db SAFFRON_POKECENTER, SPRITE_FACING_LEFT + db_tx_pre SaffronCityPokecenterBenchGuyText + db MT_MOON_POKECENTER, SPRITE_FACING_LEFT + db_tx_pre MtMoonPokecenterBenchGuyText + db ROCK_TUNNEL_POKECENTER, SPRITE_FACING_LEFT + db_tx_pre RockTunnelPokecenterBenchGuyText + db SAFARI_ZONE_REST_HOUSE_2,SPRITE_FACING_LEFT + db_tx_pre UnusedBenchGuyText1 + db SAFARI_ZONE_REST_HOUSE_3,SPRITE_FACING_LEFT + db_tx_pre UnusedBenchGuyText2 + db SAFARI_ZONE_REST_HOUSE_4,SPRITE_FACING_LEFT + db_tx_pre UnusedBenchGuyText3 db $FF ViridianCityPokecenterBenchGuyText: @@ -186,7 +192,7 @@ BookcaseText: db "@" OpenPokemonCenterPC: - ld a, [wSpriteStateData1 + 9] + ld a, [wPlayerFacingDirection] cp SPRITE_FACING_UP ; check to see if player is facing up ret nz call EnableAutoTextBoxDrawing @@ -195,4 +201,4 @@ OpenPokemonCenterPC: tx_pre_jump PokemonCenterPCText PokemonCenterPCText: - TX_POKECENTER_PC + db $F9 ; FuncTX_PokemonCenterPC diff --git a/engine/hidden_object_functions3.asm b/engine/hidden_object_functions3.asm index efdbd081..06dc7560 100755 --- a/engine/hidden_object_functions3.asm +++ b/engine/hidden_object_functions3.asm @@ -1,6 +1,6 @@ ; prints text for bookshelves in buildings without sign events PrintBookshelfText: - ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction + ld a, [wPlayerFacingDirection] ; player's sprite facing direction cp SPRITE_FACING_UP jr nz, .noMatch ; facing up @@ -39,39 +39,39 @@ PrintBookshelfText: ; format: db tileset id, bookshelf tile id, text id BookshelfTileIDs: db PLATEAU, $30 - db (IndigoPlateauStatues_id - TextPredefs) / 2 + 1 + db_tx_pre IndigoPlateauStatues db HOUSE, $3D - db (TownMapText_id - TextPredefs) / 2 + 1 + db_tx_pre TownMapText db HOUSE, $1E - db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db_tx_pre BookOrSculptureText db MANSION, $32 - db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db_tx_pre BookOrSculptureText db REDS_HOUSE_1, $32 - db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db_tx_pre BookOrSculptureText db LAB, $28 - db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db_tx_pre BookOrSculptureText db LOBBY, $16 - db (ElevatorText_id - TextPredefs) / 2 + 1 + db_tx_pre ElevatorText db GYM, $1D - db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db_tx_pre BookOrSculptureText db DOJO, $1D - db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db_tx_pre BookOrSculptureText db GATE, $22 - db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db_tx_pre BookOrSculptureText db MART, $54 - db (PokemonStuffText_id - TextPredefs) / 2 + 1 + db_tx_pre PokemonStuffText db MART, $55 - db (PokemonStuffText_id - TextPredefs) / 2 + 1 + db_tx_pre PokemonStuffText db POKECENTER, $54 - db (PokemonStuffText_id - TextPredefs) / 2 + 1 + db_tx_pre PokemonStuffText db POKECENTER, $55 - db (PokemonStuffText_id - TextPredefs) / 2 + 1 + db_tx_pre PokemonStuffText db LOBBY, $50 - db (PokemonStuffText_id - TextPredefs) / 2 + 1 + db_tx_pre PokemonStuffText db LOBBY, $52 - db (PokemonStuffText_id - TextPredefs) / 2 + 1 + db_tx_pre PokemonStuffText db SHIP, $36 - db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db_tx_pre BookOrSculptureText db $FF IndigoPlateauStatues: @@ -81,9 +81,9 @@ IndigoPlateauStatues: ld a, [wXCoord] bit 0, a ld hl, IndigoPlateauStatuesText2 - jr nz, .asm_fbd3 + jr nz, .asm_fa61 ld hl, IndigoPlateauStatuesText3 -.asm_fbd3 +.asm_fa61 call PrintText jp TextScriptEnd @@ -104,12 +104,12 @@ BookOrSculptureText: ld hl, PokemonBooksText ld a, [wCurMapTileset] cp MANSION ; Celadon Mansion tileset - jr nz, .asm_fbfd + jr nz, .asm_fa8b aCoord 8, 6 cp $38 - jr nz, .asm_fbfd + jr nz, .asm_fa8b ld hl, DiglettSculptureText -.asm_fbfd +.asm_fa8b call PrintText jp TextScriptEnd diff --git a/engine/hidden_object_functions7.asm b/engine/hidden_object_functions7.asm index 9b1532bc..691d05f2 100755 --- a/engine/hidden_object_functions7.asm +++ b/engine/hidden_object_functions7.asm @@ -65,15 +65,14 @@ SafariZoneGameOver: call EnableAutoTextBoxDrawing xor a ld [wAudioFadeOutControl], a - dec a - call PlaySound + call StopAllMusic ld c, BANK(SFX_Safari_Zone_PA) ld a, SFX_SAFARI_ZONE_PA call PlayMusic -.asm_1e9c2 +.waitForMusicToPlay ld a, [wChannelSoundIDs + CH4] - cp $b9 - jr nz, .asm_1e9c2 + cp SFX_SAFARI_ZONE_PA + jr nz, .waitForMusicToPlay ld a, TEXT_SAFARI_GAME_OVER ld [hSpriteIndexOrTextID], a call DisplayTextID @@ -86,7 +85,7 @@ SafariZoneGameOver: ld a, $5 ld [wSafariZoneEntranceCurScript], a SetEvent EVENT_SAFARI_GAME_OVER - ld a, 1 + ld a, $1 ld [wSafariZoneGameOver], a ret @@ -100,10 +99,10 @@ SafariGameOverText: TX_ASM ld a, [wNumSafariBalls] and a - jr z, .asm_1ea04 + jr z, .noMoreSafariBalls ld hl, TimesUpText call PrintText -.asm_1ea04 +.noMoreSafariBalls ld hl, GameOverText call PrintText jp TextScriptEnd @@ -117,7 +116,7 @@ GameOverText: db "@" PrintCinnabarQuiz: - ld a, [wSpriteStateData1 + 9] + ld a, [wPlayerFacingDirection] cp SPRITE_FACING_UP ret nz call EnableAutoTextBoxDrawing @@ -127,6 +126,8 @@ CinnabarGymQuiz: TX_ASM xor a ld [wOpponentAfterWrongAnswer], a + ld hl, wd475 + res 7, [hl] ld a, [wHiddenObjectFunctionArgument] push af and $f @@ -135,7 +136,12 @@ CinnabarGymQuiz: and $f0 swap a ld [$ffdc], a + ld a, [hGymGateIndex] ld hl, CinnabarGymQuizIntroText + cp $1 + jr z, .onFirstQuestion + ld hl, CinnabarGymQuizShortIntroText +.onFirstQuestion call PrintText ld a, [hGymGateIndex] dec a @@ -148,15 +154,23 @@ CinnabarGymQuiz: ld h, [hl] ld l, a call PrintText - ld a, 1 + ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a call CinnabarGymQuiz_1ea92 jp TextScriptEnd +CinnabarGymQuizDummyIntroText: + TX_FAR _CinnabarGymQuizDummyIntroText + db "@" + CinnabarGymQuizIntroText: TX_FAR _CinnabarGymQuizIntroText db "@" +CinnabarGymQuizShortIntroText: + TX_FAR _CinnabarGymQuizShortIntroText + db "@" + CinnabarQuizQuestions: dw CinnabarQuizQuestionsText1 dw CinnabarQuizQuestionsText2 @@ -189,10 +203,6 @@ CinnabarQuizQuestionsText6: TX_FAR _CinnabarQuizQuestionsText6 db "@" -CinnabarGymGateFlagAction: - EventFlagAddress hl, EVENT_CINNABAR_GYM_GATE0_UNLOCKED - predef_jump FlagActionPredef - CinnabarGymQuiz_1ea92: call YesNoChoice ld a, [$ffdc] @@ -232,6 +242,8 @@ CinnabarGymQuiz_1ea92: ld a, [hGymGateIndex] add $2 ld [wOpponentAfterWrongAnswer], a + ld hl, wd475 + set 7, [hl] ret CinnabarGymQuizCorrectText: @@ -258,6 +270,10 @@ CinnabarGymQuizIncorrectText: TX_FAR _CinnabarGymQuizIncorrectText db "@" +CinnabarGymGateFlagAction: + EventFlagAddress hl, EVENT_CINNABAR_GYM_GATE0_UNLOCKED + predef_jump FlagActionPredef + UpdateCinnabarGymGateTileBlocks_: ; Update the overworld map with open floor blocks or locked gate blocks ; depending on event flags. @@ -295,10 +311,11 @@ UpdateCinnabarGymGateTileBlocks_: .next pop bc ld [wNewTileBlockID], a - predef ReplaceTileBlock + call CinnabarGym_ReplaceTileBlock ld hl, hGymGateIndex dec [hl] jr nz, .loop + callab RedrawMapView ret CinnabarGymGateCoords: @@ -311,6 +328,34 @@ CinnabarGymGateCoords: db $02,$06,$54,$00 db $02,$03,$54,$00 + +CinnabarGym_ReplaceTileBlock: +; basically a copy of the first half of ReplaceTileBlock +; before checking if it is necessary to redraw the map view + ld hl, wOverworldMap + ld a, [wCurMapWidth] + add $6 + ld e, a + ld d, $0 + add hl, de + add hl, de + add hl, de + ld e, $3 + add hl, de + ld e, a + ld a, b + and a + jr z, .addX +.addWidthYTimesLoop + add hl, de + dec b + jr nz, .addWidthYTimesLoop +.addX + add hl, bc + ld a, [wNewTileBlockID] + ld [hl], a + ret + PrintMagazinesText: call EnableAutoTextBoxDrawing tx_pre MagazinesText @@ -322,18 +367,18 @@ MagazinesText: BillsHousePC: call EnableAutoTextBoxDrawing - ld a, [wSpriteStateData1 + 9] + ld a, [wPlayerFacingDirection] cp SPRITE_FACING_UP ret nz CheckEvent EVENT_LEFT_BILLS_HOUSE_AFTER_HELPING - jr nz, .asm_1ebd2 + jr nz, .displayBillsHousePokemonList CheckEventReuseA EVENT_USED_CELL_SEPARATOR_ON_BILL - jr nz, .asm_1eb86 + jr nz, .displayBillsHouseMonitorText CheckEventReuseA EVENT_BILL_SAID_USE_CELL_SEPARATOR - jr nz, .asm_1eb8b -.asm_1eb86 + jr nz, .doCellSeparator +.displayBillsHouseMonitorText tx_pre_jump BillsHouseMonitorText -.asm_1eb8b +.doCellSeparator ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a tx_pre BillsHouseInitiatedText @@ -360,7 +405,7 @@ BillsHousePC: call PlayDefaultMusic SetEvent EVENT_USED_CELL_SEPARATOR_ON_BILL ret -.asm_1ebd2 +.displayBillsHousePokemonList ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a tx_pre BillsHousePokemonList @@ -374,9 +419,7 @@ BillsHouseInitiatedText: TX_FAR _BillsHouseInitiatedText db $06 TX_ASM - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic ld c, 16 call DelayFrames ld a, SFX_SWITCH @@ -392,23 +435,22 @@ BillsHousePokemonList: ld hl, BillsHousePokemonListText1 call PrintText xor a - ld [wMenuItemOffset], a ; not used + ld [wMenuItemOffset], a ld [wCurrentMenuItem], a ld [wLastMenuItem], a ld a, A_BUTTON | B_BUTTON ld [wMenuWatchedKeys], a - ld a, 4 + ld a, $4 ld [wMaxMenuItem], a - ld a, 2 + ld a, $2 ld [wTopMenuItemY], a - ld a, 1 + ld a, $1 ld [wTopMenuItemX], a .billsPokemonLoop ld hl, wd730 set 6, [hl] coord hl, 0, 0 - ld b, 10 - ld c, 9 + lb bc, 10, 9 call TextBoxBorder coord hl, 2, 2 ld de, BillsMonListText @@ -456,11 +498,12 @@ BillsHousePokemonListText2: db "@" DisplayOakLabEmailText: - ld a, [wSpriteStateData1 + 9] + ld a, [wPlayerFacingDirection] cp SPRITE_FACING_UP ret nz call EnableAutoTextBoxDrawing - tx_pre_jump OakLabEmailText + tx_pre OakLabEmailText + ret OakLabEmailText: TX_FAR _OakLabEmailText diff --git a/engine/hp_bar.asm b/engine/hp_bar.asm index 3fa01208..b4abf028 100755 --- a/engine/hp_bar.asm +++ b/engine/hp_bar.asm @@ -95,7 +95,7 @@ UpdateHPBar2: call UpdateHPBar_CalcOldNewHPBarPixels ld a, e sub d ; calc pixel difference - jr .asm_fa7e + jr .asm_f90e .HPIncrease inc bc ; add 1 HP ld a, c @@ -105,7 +105,7 @@ UpdateHPBar2: call UpdateHPBar_CalcOldNewHPBarPixels ld a, d sub e ; calc pixel difference -.asm_fa7e +.asm_f90e call UpdateHPBar_PrintHPNumber and a jr z, .noPixelDifference @@ -212,13 +212,11 @@ UpdateHPBar_PrintHPNumber: ld a, [wHPBarOldHP + 1] ld [wHPBarTempHP], a push hl - ld a, [hFlags_0xFFF6] + ld de, $15 + ld a, [hFlags_0xFFFA] bit 0, a - jr z, .asm_fb15 + jr z, .next ld de, $9 - jr .next -.asm_fb15 - ld de, $15 .next add hl, de push hl diff --git a/engine/in_game_trades.asm b/engine/in_game_trades.asm index bacf531b..20069e30 100755 --- a/engine/in_game_trades.asm +++ b/engine/in_game_trades.asm @@ -3,13 +3,8 @@ DoInGameTradeDialogue: call SaveScreenTilesToBuffer2 ld hl,TradeMons ld a,[wWhichTrade] - ld b,a - swap a - sub b - sub b - ld c,a - ld b,0 - add hl,bc + ld bc,$e + call AddNTimes ld a,[hli] ld [wInGameTradeGiveMonSpecies],a ld a,[hli] @@ -21,7 +16,7 @@ DoInGameTradeDialogue: call CopyData pop af ld l,a - ld h,$0 + ld h,0 ld de,InGameTradeTextPointers add hl,hl add hl,de @@ -35,18 +30,15 @@ DoInGameTradeDialogue: ld a,[wInGameTradeReceiveMonSpecies] ld de,wInGameTradeReceiveMonName call InGameTrade_GetMonName - ld hl,wCompletedInGameTradeFlags - ld a,[wWhichTrade] - ld c,a + ld a,$4 + ld [wInGameTradeTextPointerTableIndex],a ld b,FLAG_TEST - predef FlagActionPredef + call InGameTrade_FlagActionPredef ld a,c and a - ld a,$4 - ld [wInGameTradeTextPointerTableIndex],a jr nz,.printText ; if the trade hasn't been done yet - xor a + ld a,$0 ld [wInGameTradeTextPointerTableIndex],a call .printText ld a,$1 @@ -109,11 +101,8 @@ InGameTrade_DoTrade: call AddNTimes ld a,[hl] ld [wCurEnemyLVL],a - ld hl,wCompletedInGameTradeFlags - ld a,[wWhichTrade] - ld c,a ld b,FLAG_SET - predef FlagActionPredef + call InGameTrade_FlagActionPredef ld hl, ConnectCableText call PrintText ld a,[wWhichPokemon] @@ -137,14 +126,14 @@ InGameTrade_DoTrade: ld [wMonDataLocation],a call AddPartyMon call InGameTrade_CopyDataToReceivedMon - callab EvolveTradeMon + call InGameTrade_CheckForTradeEvo call ClearScreen call InGameTrade_RestoreScreen callba RedrawMapView and a ld a,$3 jr .tradeSucceeded -.tradeFailed +.tradeFailed ; never jumped to scf .tradeSucceeded ld [wInGameTradeTextPointerTableIndex],a @@ -229,6 +218,37 @@ InGameTrade_GetReceivedMonPointer: ld d, h ret +InGameTrade_FlagActionPredef: + ld hl,wCompletedInGameTradeFlags + ld a,[wWhichTrade] + ld c,a + predef_jump FlagActionPredef + +InGameTrade_CheckForTradeEvo: + ld a,[wInGameTradeReceiveMonSpecies] + cp KADABRA + jr z,.tradeEvo + cp GRAVELER + jr z,.tradeEvo + cp MACHOKE + jr z,.tradeEvo + cp HAUNTER + jr z,.tradeEvo + ret + +.tradeEvo + ld a,[wPartyCount] + dec a + ld [wWhichPokemon],a + ld a,$1 + ld [wForceEvolution],a + ld a,LINK_STATE_TRADING + ld [wLinkState],a + callab EvolveTradeMon + xor a ; LINK_STATE_NONE + ld [wLinkState],a + jp PlayDefaultMusic + InGameTrade_TrainerString: ; "TRAINER@@@@@@@@@@" db $5d, "@@@@@@@@@@" diff --git a/engine/init_player_data.asm b/engine/init_player_data.asm new file mode 100644 index 00000000..5883547c --- /dev/null +++ b/engine/init_player_data.asm @@ -0,0 +1,60 @@ +InitPlayerData: +InitPlayerData2: + + call Random + ld a, [hRandomSub] + ld [wPlayerID], a + + call Random + ld a, [hRandomAdd] + ld [wPlayerID + 1], a + + ld a, $ff + ld [wUnusedD71B], a + + ld a, 90 ; initialize happiness to 90 + ld [wPikachuHappiness], a + ld a, $80 + ld [wPikachuMood], a ; initialize mood + + ld hl, wPartyCount + call InitializeEmptyList + ld hl, wNumInBox + call InitializeEmptyList + ld hl, wNumBagItems + call InitializeEmptyList + ld hl, wNumBoxItems + call InitializeEmptyList + +START_MONEY EQU $3000 + ld hl, wPlayerMoney + 1 + ld a, START_MONEY / $100 + ld [hld], a + xor a + ld [hli], a + inc hl + ld [hl], a + + ld [wMonDataLocation], a + + ld hl, wObtainedBadges + ld [hli], a + + ld [hl], a + + ld hl, wPlayerCoins + ld [hli], a + ld [hl], a + + ld hl, wGameProgressFlags + ld bc, wGameProgressFlagsEnd - wGameProgressFlags + call FillMemory ; clear all game progress flags + + jp InitializeMissableObjectsFlags + +InitializeEmptyList: + xor a ; count + ld [hli], a + dec a ; terminator + ld [hl], a + ret diff --git a/engine/intro.asm b/engine/intro.asm index 320267c7..9bc1f503 100755 --- a/engine/intro.asm +++ b/engine/intro.asm @@ -8,8 +8,7 @@ PlayIntro: inc a ld [H_AUTOBGTRANSFERENABLED], a call PlayShootingStar - call PlayIntroScene - call GBFadeOutToWhite + callab PlayIntroScene ; 3e:582d xor a ld [hSCX], a ld [H_AUTOBGTRANSFERENABLED], a @@ -17,162 +16,6 @@ PlayIntro: call DelayFrame ret -PlayIntroScene: - ld b, SET_PAL_NIDORINO_INTRO - call RunPaletteCommand - ld a, %11100100 - ld [rBGP], a - ld [rOBP0], a - ld [rOBP1], a - xor a - ld [hSCX], a - ld b, $3 ; Gengar tiles - call IntroCopyTiles - ld a, 0 - ld [wBaseCoordX], a - ld a, 80 - ld [wBaseCoordY], a - lb bc, 6, 6 - call InitIntroNidorinoOAM - lb de, 80 / 2, MOVE_NIDORINO_RIGHT - call IntroMoveMon - ret c - -; hip - ld a, SFX_INTRO_HIP - call PlaySound - xor a - ld [wIntroNidorinoBaseTile], a - ld de, IntroNidorinoAnimation1 - call AnimateIntroNidorino -; hop - ld a, SFX_INTRO_HOP - call PlaySound - ld de, IntroNidorinoAnimation2 - call AnimateIntroNidorino - ld c, $a - call CheckForUserInterruption - ret c - -; hip - ld a, SFX_INTRO_HIP - call PlaySound - ld de, IntroNidorinoAnimation1 - call AnimateIntroNidorino -; hop - ld a, SFX_INTRO_HOP - call PlaySound - ld de, IntroNidorinoAnimation2 - call AnimateIntroNidorino - ld c, $1e - call CheckForUserInterruption - ret c - -; raise - ld b, $4 - call IntroCopyTiles - ld a, SFX_INTRO_RAISE - call PlaySound - lb de, 8 / 2, MOVE_GENGAR_LEFT - call IntroMoveMon - ld c, $1e - call CheckForUserInterruption - ret c - -; slash - ld b, $5 - call IntroCopyTiles - ld a, SFX_INTRO_CRASH - call PlaySound - lb de, 16 / 2, MOVE_GENGAR_RIGHT - call IntroMoveMon -; hip - ld a, SFX_INTRO_HIP - call PlaySound - ld a, $24 - ld [wIntroNidorinoBaseTile], a - ld de, IntroNidorinoAnimation3 - call AnimateIntroNidorino - ld c, $1e - call CheckForUserInterruption - ret c - - lb de, 8 / 2, MOVE_GENGAR_LEFT - call IntroMoveMon - ld b, $3 - call IntroCopyTiles - ld c, $3c - call CheckForUserInterruption - ret c - -; hip - ld a, SFX_INTRO_HIP - call PlaySound - xor a - ld [wIntroNidorinoBaseTile], a - ld de, IntroNidorinoAnimation4 - call AnimateIntroNidorino -; hop - ld a, SFX_INTRO_HOP - call PlaySound - ld de, IntroNidorinoAnimation5 - call AnimateIntroNidorino - ld c, $14 - call CheckForUserInterruption - ret c - - ld a, $24 - ld [wIntroNidorinoBaseTile], a - ld de, IntroNidorinoAnimation6 - call AnimateIntroNidorino - ld c, $1e - call CheckForUserInterruption - ret c - -; lunge - ld a, SFX_INTRO_LUNGE - call PlaySound - ld a, $48 - ld [wIntroNidorinoBaseTile], a - ld de, IntroNidorinoAnimation7 - jp AnimateIntroNidorino - -AnimateIntroNidorino: - ld a, [de] - cp $50 - ret z - ld [wBaseCoordY], a - inc de - ld a, [de] - ld [wBaseCoordX], a - push de - ld c, 6 * 6 - call UpdateIntroNidorinoOAM - ld c, 5 - call DelayFrames - pop de - inc de - jr AnimateIntroNidorino - -UpdateIntroNidorinoOAM: - ld hl, wOAMBuffer - ld a, [wIntroNidorinoBaseTile] - ld d, a -.loop - ld a, [wBaseCoordY] - add [hl] - ld [hli], a ; Y - ld a, [wBaseCoordX] - add [hl] - ld [hli], a ; X - ld a, d - ld [hli], a ; tile - inc hl - inc d - dec c - jr nz, .loop - ret - InitIntroNidorinoOAM: ld hl, wOAMBuffer ld d, 0 @@ -229,84 +72,17 @@ IntroPlaceBlackTiles: jr nz, .loop ret -IntroMoveMon: -; d = number of times to move the mon (2 pixels each time) -; e: $00 = move Gengar right, $01 = move Gengar left, $ff = move Nidorino right - ld a, e - cp $ff - jr z, .moveNidorinoRight - cp $1 - jr z, .moveGengarLeft -; move Gengar right - ld a, [hSCX] - dec a - dec a - jr .next -.moveNidorinoRight - push de - ld a, 2 - ld [wBaseCoordX], a - xor a - ld [wBaseCoordY], a - ld c, 6 * 6 - call UpdateIntroNidorinoOAM - pop de -.moveGengarLeft - ld a, [hSCX] - inc a - inc a -.next - ld [hSCX], a - push de - ld c, 2 - call CheckForUserInterruption - pop de - ret c - dec d - jr nz, IntroMoveMon - ret - -IntroCopyTiles: - coord hl, 13, 7 - CopyTileIDsFromList_ZeroBaseTileID: ld c, 0 predef_jump CopyTileIDsFromList -PlayMoveSoundB: -; unused - predef GetMoveSoundB - ld a, b - jp PlaySound - -LoadIntroGraphics: - ld hl, FightIntroBackMon - ld de, vChars2 - ld bc, FightIntroBackMonEnd - FightIntroBackMon - ld a, BANK(FightIntroBackMon) - call FarCopyData2 - ld hl, GameFreakIntro - ld de, vChars2 + $600 - ld bc, GameFreakIntroEnd - GameFreakIntro - ld a, BANK(GameFreakIntro) - call FarCopyData2 - ld hl, GameFreakIntro - ld de, vChars1 - ld bc, GameFreakIntroEnd - GameFreakIntro - ld a, BANK(GameFreakIntro) - call FarCopyData2 - ld hl, FightIntroFrontMon - ld de, vChars0 - ld bc, FightIntroFrontMonEnd - FightIntroFrontMon - ld a, BANK(FightIntroFrontMon) - jp FarCopyData2 - PlayShootingStar: ld b, SET_PAL_GAME_FREAK_INTRO call RunPaletteCommand callba LoadCopyrightAndTextBoxTiles - ld a, $e4 + ld a, %11100100 ld [rBGP], a + call UpdateGBCPal_BGP ld c, 180 call DelayFrames call ClearScreen @@ -314,7 +90,27 @@ PlayShootingStar: xor a ld [wCurOpponent], a call IntroDrawBlackBars - call LoadIntroGraphics +; write the black and white tiles + ld hl, vChars2 + ld bc, $10 + xor a + call FillMemory + ld hl, vChars2 + $10 + ld bc, $10 + ld a, $ff + call FillMemory +; copy gamefreak logo and others + ld hl, GameFreakIntro + ld de, vChars2 + $600 + ld bc, GameFreakIntroEnd - GameFreakIntro + ld a, BANK(GameFreakIntro) + call FarCopyData + ld hl, GameFreakIntro + ld de, vChars1 + ld bc, GameFreakIntroEnd - GameFreakIntro + ld a, BANK(GameFreakIntro) + call FarCopyData + call EnableLCD ld hl, rLCDC res 5, [hl] @@ -328,12 +124,6 @@ PlayShootingStar: ld c, 40 call DelayFrames .next - ld a, BANK(Music_IntroBattle) - ld [wAudioROMBank], a - ld [wAudioSavedROMBank], a - ld a, MUSIC_INTRO_BATTLE - ld [wNewSoundID], a - call PlaySound call IntroClearMiddleOfScreen call ClearSprites jp Delay3 @@ -357,102 +147,8 @@ IntroDrawBlackBars: EmptyFunc4: ret -IntroNidorinoAnimation0: - db 0, 0 - db $50 - -IntroNidorinoAnimation1: -; This is a sequence of pixel movements for part of the Nidorino animation. This -; list describes how Nidorino should hop. -; First byte is y movement, second byte is x movement - db 0, 0 - db -2, 2 - db -1, 2 - db 1, 2 - db 2, 2 - db $50 ; list terminator - -IntroNidorinoAnimation2: -; This is a sequence of pixel movements for part of the Nidorino animation. -; First byte is y movement, second byte is x movement - db 0, 0 - db -2, -2 - db -1, -2 - db 1, -2 - db 2, -2 - db $50 ; list terminator - -IntroNidorinoAnimation3: -; This is a sequence of pixel movements for part of the Nidorino animation. -; First byte is y movement, second byte is x movement - db 0, 0 - db -12, 6 - db -8, 6 - db 8, 6 - db 12, 6 - db $50 ; list terminator - -IntroNidorinoAnimation4: -; This is a sequence of pixel movements for part of the Nidorino animation. -; First byte is y movement, second byte is x movement - db 0, 0 - db -8, -4 - db -4, -4 - db 4, -4 - db 8, -4 - db $50 ; list terminator - -IntroNidorinoAnimation5: -; This is a sequence of pixel movements for part of the Nidorino animation. -; First byte is y movement, second byte is x movement - db 0, 0 - db -8, 4 - db -4, 4 - db 4, 4 - db 8, 4 - db $50 ; list terminator - -IntroNidorinoAnimation6: -; This is a sequence of pixel movements for part of the Nidorino animation. -; First byte is y movement, second byte is x movement - db 0, 0 - db 2, 0 - db 2, 0 - db 0, 0 - db $50 ; list terminator - -IntroNidorinoAnimation7: -; This is a sequence of pixel movements for part of the Nidorino animation. -; First byte is y movement, second byte is x movement - db -8, -16 - db -7, -14 - db -6, -12 - db -4, -10 - db $50 ; list terminator - GameFreakIntro: INCBIN "gfx/gamefreak_intro.2bpp" INCBIN "gfx/gamefreak_logo.2bpp" ds $10 ; blank tile GameFreakIntroEnd: - -FightIntroBackMon: - INCBIN "gfx/intro_fight.2bpp" -FightIntroBackMonEnd: - -FightIntroFrontMon: - -IF DEF(_RED) - INCBIN "gfx/red/intro_nido_1.6x6.2bpp" - INCBIN "gfx/red/intro_nido_2.6x6.2bpp" - INCBIN "gfx/red/intro_nido_3.6x6.2bpp" -ENDC -IF DEF(_BLUE) - INCBIN "gfx/blue/intro_purin_1.6x6.2bpp" - INCBIN "gfx/blue/intro_purin_2.6x6.2bpp" - INCBIN "gfx/blue/intro_purin_3.6x6.2bpp" -ENDC - -FightIntroFrontMonEnd: - - ds $10 ; blank tile diff --git a/engine/items/items.asm b/engine/items/items.asm index a6717494..3fb4b7e1 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -1,18 +1,18 @@ UseItem_: - ld a,1 - ld [wActionResultOrTookBattleTurn],a ; initialise to success value - ld a,[wcf91] ;contains item_ID - cp a,HM_01 - jp nc,ItemUseTMHM - ld hl,ItemUsePtrTable + ld a, 1 + ld [wActionResultOrTookBattleTurn], a ; initialise to success value + ld a, [wcf91] ;contains item_ID + cp HM_01 + jp nc, ItemUseTMHM + ld hl, ItemUsePtrTable dec a add a - ld c,a - ld b,0 - add hl,bc - ld a,[hli] - ld h,[hl] - ld l,a + ld c, a + ld b, 0 + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a jp [hl] ItemUsePtrTable: @@ -113,7 +113,9 @@ ItemUseBall: ; If this is for the old man battle, skip checking if the party & box are full. ld a,[wBattleType] - dec a + cp BATTLE_TYPE_OLD_MAN + jr z,.canUseBall + cp BATTLE_TYPE_PIKACHU jr z,.canUseBall ld a,[wPartyCount] ; is party full? @@ -152,16 +154,26 @@ ItemUseBall: jp z,.setAnimData ld a,[wBattleType] - dec a - jr nz,.notOldManBattle + cp BATTLE_TYPE_OLD_MAN + jr z,.oldManBattle + cp BATTLE_TYPE_PIKACHU + jr z,.oldManBattle ; pikachu battle technically old man battle + jr .notOldManBattle .oldManBattle ld hl,wGrassRate ld de,wPlayerName ld bc,NAME_LENGTH call CopyData ; save the player's name in the Wild Monster data (part of the Cinnabar Island Missingno. glitch) + ld a, [wBattleType] + cp BATTLE_TYPE_OLD_MAN + jp nz,.captured + ld a,$1 + ld [wCapturedMonSpecies], a + CheckEvent EVENT_02F + ld b, $63 + jp nz,.setAnimData jp .captured - .notOldManBattle ; If the player is fighting the ghost Marowak, set the value that indicates the ; Pokémon can't be caught and skip the capture calculations. @@ -187,6 +199,7 @@ ItemUseBall: ; Get the item ID. ld hl,wcf91 +.asm_d54a ld a,[hl] ; The Master Ball always succeeds. @@ -229,7 +242,7 @@ ItemUseBall: jr z,.notFrozenOrAsleep ld c,25 .notFrozenOrAsleep - ld a,b + ld a, b sub c jp c,.captured ld b,a @@ -251,7 +264,7 @@ ItemUseBall: ; Determine BallFactor. It's 8 for Great Balls and 12 for the others. ld a,[wcf91] - cp a,GREAT_BALL + cp GREAT_BALL ld a,12 jr nz,.skip1 ld a,8 @@ -280,6 +293,7 @@ ItemUseBall: inc a .skip2 + ; Let W = ((MaxHP * 255) / BallFactor) / max(HP / 4, 1). Calculate W. ld [H_DIVISOR],a ld b,4 @@ -337,16 +351,17 @@ ItemUseBall: ; Ultra/Safari Ball: BallFactor2 = 150 ld a,[wcf91] ld b,255 - cp a,POKE_BALL + cp POKE_BALL jr z,.skip4 ld b,200 - cp a,GREAT_BALL + cp GREAT_BALL jr z,.skip4 ld b,150 - cp a,ULTRA_BALL + cp ULTRA_BALL jr z,.skip4 .skip4 + ; Let Y = (CatchRate * 100) / BallFactor2. Calculate Y. ld a,b ld [H_DIVISOR],a @@ -371,7 +386,7 @@ ItemUseBall: ld [H_DIVISOR],a ld b,4 call Divide - + ; Determine Status2. ; no status ailment: Status2 = 0 ; Burn/Paralysis/Poison: Status2 = 5 @@ -379,7 +394,7 @@ ItemUseBall: ld a,[wEnemyMonStatus] and a jr z,.skip5 - and a, 1 << FRZ | SLP + and 1 << FRZ | SLP ld b,5 jr z,.addAilmentValue ld b,10 @@ -422,16 +437,16 @@ ItemUseBall: ld a,TOSS_ANIM ld [wAnimationID],a xor a - ld [H_WHOSETURN],a - ld [wAnimationType],a - ld [wDamageMultipliers],a - ld a,[wWhichPokemon] + ld [H_WHOSETURN], a + ld [wAnimationType], a + ld [wDamageMultipliers], a + ld a, [wWhichPokemon] push af - ld a,[wcf91] + ld a, [wcf91] push af predef MoveAnimation pop af - ld [wcf91],a + ld [wcf91], a pop af ld [wWhichPokemon],a @@ -491,19 +506,19 @@ ItemUseBall: .skip6 ld a,[wcf91] push af - ld a,[wEnemyMonSpecies2] - ld [wcf91],a - ld a,[wEnemyMonLevel] - ld [wCurEnemyLVL],a + ld a, [wEnemyMonSpecies2] + ld [wcf91], a + ld a, [wEnemyMonLevel] + ld [wCurEnemyLVL], a callab LoadEnemyMonData pop af - ld [wcf91],a + ld [wcf91], a pop hl pop af - ld [hld],a + ld [hld], a dec hl pop af - ld [hld],a + ld [hld], a pop af ld [hl],a ld a,[wEnemyMonSpecies] @@ -511,26 +526,27 @@ ItemUseBall: ld [wcf91],a ld [wd11e],a ld a,[wBattleType] - dec a ; is this the old man battle? - jr z,.oldManCaughtMon ; if so, don't give the player the caught Pokémon - + cp BATTLE_TYPE_OLD_MAN ; is this the old man battle? + jp z,.oldManCaughtMon ; if so, don't give the player the caught Pokémon + cp BATTLE_TYPE_PIKACHU + jr z,.oldManCaughtMon ; same with Pikachu battle ld hl,ItemUseBallText05 call PrintText ; Add the caught Pokémon to the Pokédex. predef IndexToPokedex - ld a,[wd11e] + ld a, [wd11e] dec a - ld c,a - ld b,FLAG_TEST - ld hl,wPokedexOwned + ld c, a + ld b, FLAG_TEST + ld hl, wPokedexOwned predef FlagActionPredef - ld a,c + ld a, c push af - ld a,[wd11e] + ld a, [wd11e] dec a - ld c,a - ld b,FLAG_SET + ld c, a + ld b, FLAG_SET predef FlagActionPredef pop af @@ -545,12 +561,18 @@ ItemUseBall: predef ShowPokedexData .skipShowingPokedexData + ld a, $1 + ld [wd49c], a + ld a, $85 + ld [wPikachuMood], a ld a,[wPartyCount] - cp a,PARTY_LENGTH ; is party full? + cp PARTY_LENGTH ; is party full? jr z,.sendToBox xor a ; PLAYER_PARTY_DATA - ld [wMonDataLocation],a + ld [wMonDataLocation], a call ClearSprites + ld hl, .emptyString + call PrintText call AddPartyMon jr .done @@ -580,9 +602,12 @@ ItemUseBall: ; Remove a ball from the bag. ld hl,wNumBagItems inc a - ld [wItemQuantity],a + ld [wItemQuantity], a jp RemoveItemFromInventory +.emptyString + db "@" + ItemUseBallText00: ;"It dodged the thrown ball!" ;"This pokemon can't be caught" @@ -608,7 +633,7 @@ ItemUseBallText05: ;"All right! {MonName} was caught!" ;play sound TX_FAR _ItemUseBallText05 - db $12,$06 + db $12, $06 db "@" ItemUseBallText07: ;"X was transferred to Bill's PC" @@ -623,123 +648,130 @@ ItemUseBallText06: ;"New DEX data will be added..." ;play sound TX_FAR _ItemUseBallText06 - db $13,$06 + db $13, $06 db "@" ItemUseTownMap: - ld a,[wIsInBattle] + ld a, [wIsInBattle] and a - jp nz,ItemUseNotTime + jp nz, ItemUseNotTime jpba DisplayTownMap ItemUseBicycle: - ld a,[wIsInBattle] + ld a, [wIsInBattle] and a - jp nz,ItemUseNotTime - ld a,[wWalkBikeSurfState] - ld [wWalkBikeSurfStateCopy],a - cp a,2 ; is the player surfing? - jp z,ItemUseNotTime + jp nz, ItemUseNotTime + ld a, [wWalkBikeSurfState] + ld [wWalkBikeSurfStateCopy], a + cp 2 ; is the player surfing? + jp z, ItemUseNotTime dec a ; is player already bicycling? - jr nz,.tryToGetOnBike + jr nz, .tryToGetOnBike .getOffBike call ItemUseReloadOverworldData xor a - ld [wWalkBikeSurfState],a ; change player state to walking + ld [wWalkBikeSurfState], a ; change player state to walking + ld a, $00 + ld [wPikachuSpawnState], a call PlayDefaultMusic ; play walking music - ld hl,GotOffBicycleText - jr .printText + ld hl, GotOffBicycleText + jp PrintText + .tryToGetOnBike call IsBikeRidingAllowed - jp nc,NoCyclingAllowedHere + jp nc, NoCyclingAllowedHere call ItemUseReloadOverworldData xor a ; no keys pressed - ld [hJoyHeld],a ; current joypad state - inc a - ld [wWalkBikeSurfState],a ; change player state to bicycling - ld hl,GotOnBicycleText + ld [hJoyHeld], a ; current joypad state + ld a, $1 + ld [wWalkBikeSurfState], a ; change player state to bicycling call PlayDefaultMusic ; play bike riding music -.printText - jp PrintText + xor a + ld [wWalkBikeSurfState], a + ld hl, GotOnBicycleText + call PrintText + ld a, $1 + ld [wWalkBikeSurfState], a + ret ; used for Surf out-of-battle effect ItemUseSurfboard: - ld a,[wWalkBikeSurfState] - ld [wWalkBikeSurfStateCopy],a - cp a,2 ; is the player already surfing? - jr z,.tryToStopSurfing + ld a, [wWalkBikeSurfState] + ld [wWalkBikeSurfStateCopy], a + cp 2 ; is the player already surfing? + jr z, .tryToStopSurfing .tryToSurf call IsNextTileShoreOrWater - jp c,SurfingAttemptFailed - ld hl,TilePairCollisionsWater + jp nc, SurfingAttemptFailed + ld hl, TilePairCollisionsWater call CheckForTilePairCollisions - jp c,SurfingAttemptFailed + jp c, SurfingAttemptFailed .surf call .makePlayerMoveForward - ld hl,wd730 - set 7,[hl] - ld a,2 - ld [wWalkBikeSurfState],a ; change player state to surfing + ld hl, wd730 + set 7, [hl] + ld a, 2 + ld [wWalkBikeSurfState], a ; change player state to surfing call PlayDefaultMusic ; play surfing music - ld hl,SurfingGotOnText + ld hl, SurfingGotOnText jp PrintText + .tryToStopSurfing xor a - ld [hSpriteIndexOrTextID],a - ld d,16 ; talking range in pixels (normal range) + ld [hSpriteIndexOrTextID], a + ld d, 16 ; talking range in pixels (normal range) call IsSpriteInFrontOfPlayer2 - res 7,[hl] - ld a,[hSpriteIndexOrTextID] + res 7, [hl] + ld a, [hSpriteIndexOrTextID] and a ; is there a sprite in the way? - jr nz,.cannotStopSurfing - ld hl,TilePairCollisionsWater + jr nz, .cannotStopSurfing + ld hl, TilePairCollisionsWater call CheckForTilePairCollisions - jr c,.cannotStopSurfing - ld hl,wTileSetCollisionPtr ; pointer to list of passable tiles - ld a,[hli] - ld h,[hl] - ld l,a ; hl now points to passable tiles - ld a,[wTileInFrontOfPlayer] ; tile in front of the player - ld b,a -.passableTileLoop - ld a,[hli] - cp b - jr z,.stopSurfing - cp a,$ff - jr nz,.passableTileLoop + jr c, .cannotStopSurfing + ld a, [wTileInFrontOfPlayer] + ld c, a + call IsTilePassable + jr nc, .stopSurfing .cannotStopSurfing - ld hl,SurfingNoPlaceToGetOffText + ld hl, SurfingNoPlaceToGetOffText jp PrintText + .stopSurfing call .makePlayerMoveForward - ld hl,wd730 - set 7,[hl] + ld a, $3 + ld [wPikachuSpawnState], a + ld hl, wPikachuOverworldStateFlags + set 5, [hl] + ld hl, wd730 + set 7, [hl] xor a - ld [wWalkBikeSurfState],a ; change player state to walking + ld [wWalkBikeSurfState], a ; change player state to walking dec a - ld [wJoyIgnore],a + ld [wJoyIgnore], a call PlayDefaultMusic ; play walking music + call GBPalWhiteOutWithDelay3 jp LoadWalkingPlayerSpriteGraphics + ; uses a simulated button press to make the player move forward .makePlayerMoveForward - ld a,[wPlayerDirection] ; direction the player is going - bit PLAYER_DIR_BIT_UP,a - ld b,D_UP - jr nz,.storeSimulatedButtonPress - bit PLAYER_DIR_BIT_DOWN,a - ld b,D_DOWN - jr nz,.storeSimulatedButtonPress - bit PLAYER_DIR_BIT_LEFT,a - ld b,D_LEFT - jr nz,.storeSimulatedButtonPress - ld b,D_RIGHT + ld a, [wPlayerDirection] ; direction the player is going + bit PLAYER_DIR_BIT_UP, a + ld b, D_UP + jr nz, .storeSimulatedButtonPress + bit PLAYER_DIR_BIT_DOWN, a + ld b, D_DOWN + jr nz, .storeSimulatedButtonPress + bit PLAYER_DIR_BIT_LEFT, a + ld b, D_LEFT + jr nz, .storeSimulatedButtonPress + ld b, D_RIGHT .storeSimulatedButtonPress - ld a,b - ld [wSimulatedJoypadStatesEnd],a + ld a, b + ld [wSimulatedJoypadStatesEnd], a xor a - ld [wWastedByteCD39],a + ld [wWastedByteCD39], a inc a - ld [wSimulatedJoypadStatesIndex],a + ld [wSimulatedJoypadStatesIndex], a ret SurfingGotOnText: @@ -754,152 +786,221 @@ ItemUsePokedex: predef_jump ShowPokedexMenu ItemUseEvoStone: - ld a,[wIsInBattle] + ld a, [wIsInBattle] and a - jp nz,ItemUseNotTime - ld a,[wWhichPokemon] + jp nz, ItemUseNotTime + ld a, [wWhichPokemon] push af - ld a,[wcf91] - ld [wEvoStoneItemID],a + ld a, [wcf91] + ld [wEvoStoneItemID], a push af - ld a,EVO_STONE_PARTY_MENU - ld [wPartyMenuTypeOrMessageID],a - ld a,$ff - ld [wUpdateSpritesEnabled],a + ld a, EVO_STONE_PARTY_MENU + ld [wPartyMenuTypeOrMessageID], a + ld a, $ff + ld [wUpdateSpritesEnabled], a call DisplayPartyMenu + ld a, [wcf91] + ld [wLoadedMon], a pop bc - jr c,.canceledItemUse - ld a,b - ld [wcf91],a - ld a,$01 - ld [wForceEvolution],a - ld a,SFX_HEAL_AILMENT + jr c, .canceledItemUse + ld a, b + ld [wcf91], a + call Func_d85d + jr nc, .noEffect + callab IsThisPartymonStarterPikachu_Party + jr nc, .notPlayerPikachu + ld e, $1b + callab PlayPikachuSoundClip + ld a, [wWhichPokemon] + ld hl, wPartyMonNicks + call GetPartyMonName + ld hl, RefusingText + call PrintText + ld a, $4 + ld [wd49c], a + ld a, $82 + ld [wPikachuMood], a + jr .canceledItemUse + +.notPlayerPikachu + ld a, SFX_HEAL_AILMENT call PlaySoundWaitForCurrent call WaitForSoundToFinish + ld a, $01 + ld [wForceEvolution], a callab TryEvolvingMon ; try to evolve pokemon - ld a,[wEvolutionOccurred] - and a - jr z,.noEffect pop af - ld [wWhichPokemon],a - ld hl,wNumBagItems - ld a,1 ; remove 1 stone - ld [wItemQuantity],a + ld [wWhichPokemon], a + ld hl, wNumBagItems + ld a, 1 ; remove 1 stone + ld [wItemQuantity], a jp RemoveItemFromInventory + .noEffect call ItemUseNoEffect .canceledItemUse xor a - ld [wActionResultOrTookBattleTurn],a ; item not used + ld [wActionResultOrTookBattleTurn], a ; item not used pop af ret +Func_d85d: + ld hl, EvosMovesPointerTable + ld a, [wLoadedMon] + dec a + ld c, a + ld b, $0 + add hl, bc + add hl, bc + ld de, wcd6d + ld a, BANK(TryEvolvingMon) + ld bc, $2 + call FarCopyData + ld hl, wcd6d + ld a, [hli] + ld h, [hl] + ld l, a + ld de, wcd6d + ld a, BANK(TryEvolvingMon) + ld bc, 13 + call FarCopyData + ld hl, wcd6d +.loop + ld a, [hli] + and a + jr z, .cannotEvolveWithUsedStone + inc hl + inc hl + cp EV_ITEM + jr nz, .loop + dec hl + dec hl + ld b, [hl] + ld a, [wcf91] + inc hl + inc hl + inc hl + cp b + jr nz, .loop + scf + ret + +.cannotEvolveWithUsedStone + and a + ret + +RefusingText: + TX_FAR _RefusingText + db "@" + ItemUseVitamin: - ld a,[wIsInBattle] + ld a, [wIsInBattle] and a - jp nz,ItemUseNotTime + jp nz, ItemUseNotTime ItemUseMedicine: - ld a,[wPartyCount] + ld a, [wPartyCount] and a - jp z,.emptyParty - ld a,[wWhichPokemon] + jp z, Func_e4bf + ld a, [wWhichPokemon] push af - ld a,[wcf91] + ld a, [wcf91] push af - ld a,USE_ITEM_PARTY_MENU - ld [wPartyMenuTypeOrMessageID],a - ld a,$ff - ld [wUpdateSpritesEnabled],a - ld a,[wPseudoItemID] + ld a, USE_ITEM_PARTY_MENU + ld [wPartyMenuTypeOrMessageID], a + ld a, $ff + ld [wUpdateSpritesEnabled], a + ld a, [wPseudoItemID] and a ; using Softboiled? - jr z,.notUsingSoftboiled + jr z, .notUsingSoftboiled ; if using softboiled call GoBackToPartyMenu jr .getPartyMonDataAddress -.emptyParty - ld hl,.emptyPartyText - xor a - ld [wActionResultOrTookBattleTurn],a ; item use failed - jp PrintText -.emptyPartyText - text "You don't have" - line "any #MON!" - prompt + .notUsingSoftboiled call DisplayPartyMenu .getPartyMonDataAddress - jp c,.canceledItemUse - ld hl,wPartyMons - ld bc,wPartyMon2 - wPartyMon1 - ld a,[wWhichPokemon] + jp c, .canceledItemUse + ld hl, wPartyMons + ld bc, wPartyMon2 - wPartyMon1 + ld a, [wWhichPokemon] call AddNTimes - ld a,[wWhichPokemon] - ld [wUsedItemOnWhichPokemon],a - ld d,a - ld a,[wcf91] - ld e,a - ld [wd0b5],a + ld a, [wWhichPokemon] + ld [wUsedItemOnWhichPokemon], a + ld d, a + ld a, [wcf91] + ld e, a + ld [wd0b5], a pop af - ld [wcf91],a + push af + cp $28 + jr nc, .asm_d906 + push hl + push de + callabd_ModifyPikachuHappiness PIKAHAPPY_USEDITEM + pop de + pop hl +.asm_d906 pop af - ld [wWhichPokemon],a - ld a,[wPseudoItemID] + ld [wcf91], a + pop af + ld [wWhichPokemon], a + ld a, [wPseudoItemID] and a ; using Softboiled? - jr z,.checkItemType + jr z, .checkItemType ; if using softboiled - ld a,[wWhichPokemon] + ld a, [wWhichPokemon] cp d ; is the pokemon trying to use softboiled on itself? - jr z,ItemUseMedicine ; if so, force another choice + jr z, ItemUseMedicine ; if so, force another choice .checkItemType - ld a,[wcf91] - cp a,REVIVE - jr nc,.healHP ; if it's a Revive or Max Revive - cp a,FULL_HEAL - jr z,.cureStatusAilment ; if it's a Full Heal - cp a,HP_UP - jp nc,.useVitamin ; if it's a vitamin or Rare Candy - cp a,FULL_RESTORE - jr nc,.healHP ; if it's a Full Restore or one of the potions + ld a, [wcf91] + cp REVIVE + jr nc, .healHP ; if it's a Revive or Max Revive + cp FULL_HEAL + jr z, .cureStatusAilment ; if it's a Full Heal + cp HP_UP + jp nc, .useVitamin ; if it's a vitamin or Rare Candy + cp FULL_RESTORE + jr nc, .healHP ; if it's a Full Restore or one of the potions ; fall through if it's one of the status-specifc healing items .cureStatusAilment ld bc,wPartyMon1Status - wPartyMon1 add hl,bc ; hl now points to status ld a,[wcf91] lb bc, ANTIDOTE_MSG, 1 << PSN - cp a,ANTIDOTE - jr z,.checkMonStatus + cp ANTIDOTE + jr z, .checkMonStatus lb bc, BURN_HEAL_MSG, 1 << BRN - cp a,BURN_HEAL - jr z,.checkMonStatus + cp BURN_HEAL + jr z, .checkMonStatus lb bc, ICE_HEAL_MSG, 1 << FRZ - cp a,ICE_HEAL - jr z,.checkMonStatus + cp ICE_HEAL + jr z, .checkMonStatus lb bc, AWAKENING_MSG, SLP - cp a,AWAKENING - jr z,.checkMonStatus + cp AWAKENING + jr z, .checkMonStatus lb bc, PARALYZ_HEAL_MSG, 1 << PAR - cp a,PARLYZ_HEAL - jr z,.checkMonStatus + cp PARLYZ_HEAL + jr z, .checkMonStatus lb bc, FULL_HEAL_MSG, $ff ; Full Heal .checkMonStatus - ld a,[hl] ; pokemon's status + ld a, [hl] ; pokemon's status and c ; does the pokemon have a status ailment the item can cure? - jp z,.healingItemNoEffect + jp z, .healingItemNoEffect ; if the pokemon has a status the item can heal xor a - ld [hl],a ; remove the status ailment in the party data - ld a,b - ld [wPartyMenuTypeOrMessageID],a ; the message to display for the item used - ld a,[wPlayerMonNumber] + ld [hl], a ; remove the status ailment in the party data + ld a, b + ld [wPartyMenuTypeOrMessageID], a ; the message to display for the item used + ld a, [wPlayerMonNumber] cp d ; is pokemon the item was used on active in battle? - jp nz,.doneHealing + jp nz, .doneHealing ; if it is active in battle xor a - ld [wBattleMonStatus],a ; remove the status ailment in the in-battle pokemon data + ld [wBattleMonStatus], a ; remove the status ailment in the in-battle pokemon data push hl - ld hl,wPlayerBattleStatus3 - res BadlyPoisoned,[hl] ; heal Toxic status + ld hl, wPlayerBattleStatus3 + res BadlyPoisoned, [hl] ; heal Toxic status pop hl ld bc,wPartyMon1Stats - wPartyMon1Status add hl,bc ; hl now points to party stats @@ -908,87 +1009,105 @@ ItemUseMedicine: call CopyData ; copy party stats to in-battle stat data predef DoubleOrHalveSelectedStats jp .doneHealing + .healHP inc hl ; hl = address of current HP - ld a,[hli] - ld b,a - ld [wHPBarOldHP+1],a - ld a,[hl] - ld c,a - ld [wHPBarOldHP],a ; current HP stored at wHPBarOldHP (2 bytes, big-endian) + ld a, [hli] + ld b, a + ld [wHPBarOldHP+1], a + ld a, [hl] + ld c, a + ld [wHPBarOldHP], a ; current HP stored at wHPBarOldHP (2 bytes, big-endian) or b - jr nz,.notFainted + jr nz, .notFainted .fainted - ld a,[wcf91] - cp a,REVIVE - jr z,.updateInBattleFaintedData - cp a,MAX_REVIVE - jr z,.updateInBattleFaintedData + ld a, [wcf91] + cp REVIVE + jr z, .updateInBattleFaintedData + cp MAX_REVIVE + jr z, .updateInBattleFaintedData jp .healingItemNoEffect + .updateInBattleFaintedData - ld a,[wIsInBattle] + ld a, [wWhichPokemon] + push af + ld a, [wUsedItemOnWhichPokemon] + ld [wWhichPokemon], a + push hl + push de + push bc + callab Func_2fd6a + pop bc + pop de + pop hl + pop af + ld [wWhichPokemon], a + + ld a, [wIsInBattle] and a - jr z,.compareCurrentHPToMaxHP + jr z, .compareCurrentHPToMaxHP push hl push de push bc - ld a,[wUsedItemOnWhichPokemon] - ld c,a - ld hl,wPartyFoughtCurrentEnemyFlags - ld b,FLAG_TEST + ld a, [wUsedItemOnWhichPokemon] + ld c, a + ld hl, wPartyFoughtCurrentEnemyFlags + ld b, FLAG_TEST predef FlagActionPredef - ld a,c + ld a, c and a - jr z,.next - ld a,[wUsedItemOnWhichPokemon] - ld c,a - ld hl,wPartyGainExpFlags - ld b,FLAG_SET + jr z, .next + ld a, [wUsedItemOnWhichPokemon] + ld c, a + ld hl, wPartyGainExpFlags + ld b, FLAG_SET predef FlagActionPredef .next pop bc pop de pop hl jr .compareCurrentHPToMaxHP + .notFainted - ld a,[wcf91] - cp a,REVIVE - jp z,.healingItemNoEffect - cp a,MAX_REVIVE - jp z,.healingItemNoEffect + ld a, [wcf91] + cp REVIVE + jp z, .healingItemNoEffect + cp MAX_REVIVE + jp z, .healingItemNoEffect .compareCurrentHPToMaxHP push hl push bc ld bc,wPartyMon1MaxHP - (wPartyMon1HP + 1) add hl,bc ; hl now points to max HP pop bc - ld a,[hli] + ld a, [hli] cp b - jr nz,.skipComparingLSB ; no need to compare the LSB's if the MSB's don't match - ld a,[hl] + jr nz, .skipComparingLSB ; no need to compare the LSB's if the MSB's don't match + ld a, [hl] cp c .skipComparingLSB pop hl - jr nz,.notFullHP + jr nz, .notFullHP .fullHP ; if the pokemon's current HP equals its max HP - ld a,[wcf91] - cp a,FULL_RESTORE - jp nz,.healingItemNoEffect + ld a, [wcf91] + cp FULL_RESTORE + jp nz, .healingItemNoEffect inc hl inc hl - ld a,[hld] ; status ailment + ld a, [hld] ; status ailment and a ; does the pokemon have a status ailment? - jp z,.healingItemNoEffect - ld a,FULL_HEAL - ld [wcf91],a + jp z, .healingItemNoEffect + ld a, FULL_HEAL + ld [wcf91], a dec hl dec hl dec hl jp .cureStatusAilment + .notFullHP ; if the pokemon's current HP doesn't equal its max HP xor a - ld [wLowHealthAlarm],a ;disable low health alarm - ld [wChannelSoundIDs + CH4],a + ld [wLowHealthAlarm], a ;disable low health alarm + ld [wChannelSoundIDs + CH4], a push hl push de ld bc,wPartyMon1MaxHP - (wPartyMon1HP + 1) @@ -999,105 +1118,106 @@ ItemUseMedicine: ld [wHPBarMaxHP],a ; max HP stored at wHPBarMaxHP (2 bytes, big-endian) ld a,[wPseudoItemID] and a ; using Softboiled? - jp z,.notUsingSoftboiled2 + jp z, .notUsingSoftboiled2 ; if using softboiled - ld hl,wHPBarMaxHP - ld a,[hli] + ld hl, wHPBarMaxHP + ld a, [hli] push af - ld a,[hli] + ld a, [hli] push af - ld a,[hli] + ld a, [hli] push af - ld a,[hl] + ld a, [hl] push af - ld hl,wPartyMon1MaxHP - ld a,[wWhichPokemon] - ld bc,wPartyMon2 - wPartyMon1 + ld hl, wPartyMon1MaxHP + ld a, [wWhichPokemon] + ld bc, wPartyMon2 - wPartyMon1 call AddNTimes - ld a,[hli] - ld [wHPBarMaxHP + 1],a - ld [H_DIVIDEND],a - ld a,[hl] - ld [wHPBarMaxHP],a - ld [H_DIVIDEND + 1],a - ld a,5 - ld [H_DIVISOR],a - ld b,2 ; number of bytes + ld a, [hli] + ld [wHPBarMaxHP + 1], a + ld [H_DIVIDEND], a + ld a, [hl] + ld [wHPBarMaxHP], a + ld [H_DIVIDEND + 1], a + ld a, 5 + ld [H_DIVISOR], a + ld b, 2 ; number of bytes call Divide ; get 1/5 of max HP of pokemon that used Softboiled ld bc,(wPartyMon1HP + 1) - (wPartyMon1MaxHP + 1) add hl,bc ; hl now points to LSB of current HP of pokemon that used Softboiled ; subtract 1/5 of max HP from current HP of pokemon that used Softboiled - ld a,[H_QUOTIENT + 3] + ld a, [H_QUOTIENT + 3] push af - ld b,a - ld a,[hl] - ld [wHPBarOldHP],a + ld b, a + ld a, [hl] + ld [wHPBarOldHP], a sub b - ld [hld],a - ld [wHPBarNewHP],a - ld a,[H_QUOTIENT + 2] - ld b,a - ld a,[hl] - ld [wHPBarOldHP+1],a + ld [hld], a + ld [wHPBarNewHP], a + ld a, [H_QUOTIENT + 2] + ld b, a + ld a, [hl] + ld [wHPBarOldHP+1], a sbc b - ld [hl],a - ld [wHPBarNewHP+1],a + ld [hl], a + ld [wHPBarNewHP+1], a coord hl, 4, 1 - ld a,[wWhichPokemon] - ld bc,2 * SCREEN_WIDTH + ld a, [wWhichPokemon] + ld bc, 2 * SCREEN_WIDTH call AddNTimes ; calculate coordinates of HP bar of pokemon that used Softboiled - ld a,SFX_HEAL_HP + ld a, SFX_HEAL_HP call PlaySoundWaitForCurrent - ld a,[hFlags_0xFFF6] - set 0,a - ld [hFlags_0xFFF6],a - ld a,$02 - ld [wHPBarType],a + ld a, [hFlags_0xFFFA] + set 0, a + ld [hFlags_0xFFFA], a + ld a, $02 + ld [wHPBarType], a predef UpdateHPBar2 ; animate HP bar decrease of pokemon that used Softboiled - ld a,[hFlags_0xFFF6] - res 0,a - ld [hFlags_0xFFF6],a + ld a, [hFlags_0xFFFA] + res 0, a + ld [hFlags_0xFFFA], a pop af - ld b,a ; store heal amount (1/5 of max HP) - ld hl,wHPBarOldHP + 1 + ld b, a ; store heal amount (1/5 of max HP) + ld hl, wHPBarOldHP + 1 pop af - ld [hld],a + ld [hld], a pop af - ld [hld],a + ld [hld], a pop af - ld [hld],a + ld [hld], a pop af - ld [hl],a + ld [hl], a jr .addHealAmount + .notUsingSoftboiled2 - ld a,[wcf91] - cp a,SODA_POP - ld b,60 ; Soda Pop heal amount - jr z,.addHealAmount - ld b,80 ; Lemonade heal amount - jr nc,.addHealAmount - cp a,FRESH_WATER - ld b,50 ; Fresh Water heal amount - jr z,.addHealAmount - cp a,SUPER_POTION - ld b,200 ; Hyper Potion heal amount - jr c,.addHealAmount - ld b,50 ; Super Potion heal amount - jr z,.addHealAmount - ld b,20 ; Potion heal amount + ld a, [wcf91] + cp SODA_POP + ld b, 60 ; Soda Pop heal amount + jr z, .addHealAmount + ld b, 80 ; Lemonade heal amount + jr nc, .addHealAmount + cp FRESH_WATER + ld b, 50 ; Fresh Water heal amount + jr z, .addHealAmount + cp SUPER_POTION + ld b, 200 ; Hyper Potion heal amount + jr c, .addHealAmount + ld b, 50 ; Super Potion heal amount + jr z, .addHealAmount + ld b, 20 ; Potion heal amount .addHealAmount pop de pop hl - ld a,[hl] + ld a, [hl] add b - ld [hld],a - ld [wHPBarNewHP],a - ld a,[hl] - ld [wHPBarNewHP+1],a - jr nc,.noCarry + ld [hld], a + ld [wHPBarNewHP], a + ld a, [hl] + ld [wHPBarNewHP+1], a + jr nc, .noCarry inc [hl] - ld a,[hl] - ld [wHPBarNewHP + 1],a + ld a, [hl] + ld [wHPBarNewHP + 1], a .noCarry push de inc hl @@ -1113,38 +1233,40 @@ ItemUseMedicine: ld a,[de] sub b dec de - ld b,[hl] - ld a,[de] + ld b, [hl] + ld a, [de] sbc b - jr nc,.setCurrentHPToMaxHp ; if current HP exceeds max HP after healing - ld a,[wcf91] - cp a,HYPER_POTION - jr c,.setCurrentHPToMaxHp ; if using a Full Restore or Max Potion - cp a,MAX_REVIVE - jr z,.setCurrentHPToMaxHp ; if using a Max Revive + jr nc, .setCurrentHPToMaxHp ; if current HP exceeds max HP after healing + ld a, [wcf91] + cp HYPER_POTION + jr c, .setCurrentHPToMaxHp ; if using a Full Restore or Max Potion + cp MAX_REVIVE + jr z, .setCurrentHPToMaxHp ; if using a Max Revive jr .updateInBattleData + .setCurrentHPToHalfMaxHP dec hl dec de - ld a,[hli] + ld a, [hli] srl a - ld [de],a - ld [wHPBarNewHP+1],a - ld a,[hl] + ld [de], a + ld [wHPBarNewHP+1], a + ld a, [hl] rr a inc de - ld [de],a - ld [wHPBarNewHP],a + ld [de], a + ld [wHPBarNewHP], a dec de jr .doneHealingPartyHP + .setCurrentHPToMaxHp - ld a,[hli] - ld [de],a - ld [wHPBarNewHP+1],a + ld a, [hli] + ld [de], a + ld [wHPBarNewHP+1], a inc de - ld a,[hl] - ld [de],a - ld [wHPBarNewHP],a + ld a, [hl] + ld [de], a + ld [wHPBarNewHP], a dec de .doneHealingPartyHP ; done updating the pokemon's current HP in the party data structure ld a,[wcf91] @@ -1153,101 +1275,106 @@ ItemUseMedicine: ld bc,wPartyMon1Status - (wPartyMon1MaxHP + 1) add hl,bc xor a - ld [hl],a ; remove the status ailment in the party data + ld [hl], a ; remove the status ailment in the party data .updateInBattleData - ld h,d - ld l,e + ld h, d + ld l, e pop de - ld a,[wPlayerMonNumber] + ld a, [wPlayerMonNumber] cp d ; is pokemon the item was used on active in battle? - jr nz,.calculateHPBarCoords + jr nz, .calculateHPBarCoords ; copy party HP to in-battle HP - ld a,[hli] - ld [wBattleMonHP],a - ld a,[hld] - ld [wBattleMonHP + 1],a - ld a,[wcf91] - cp a,FULL_RESTORE - jr nz,.calculateHPBarCoords + ld a, [hli] + ld [wBattleMonHP], a + ld a, [hld] + ld [wBattleMonHP + 1], a + ld a, [wcf91] + cp FULL_RESTORE + jr nz, .calculateHPBarCoords xor a - ld [wBattleMonStatus],a ; remove the status ailment in the in-battle pokemon data + ld [wBattleMonStatus], a ; remove the status ailment in the in-battle pokemon data .calculateHPBarCoords ld hl,wOAMBuffer + $90 ld bc,2 * SCREEN_WIDTH inc d .calculateHPBarCoordsLoop - add hl,bc + add hl, bc dec d - jr nz,.calculateHPBarCoordsLoop + jr nz, .calculateHPBarCoordsLoop jr .doneHealing + .healingItemNoEffect call ItemUseNoEffect jp .done + .doneHealing - ld a,[wPseudoItemID] + ld a, [wPseudoItemID] and a ; using Softboiled? - jr nz,.skipRemovingItem ; no item to remove if using Softboiled + jr nz, .skipRemovingItem ; no item to remove if using Softboiled push hl call RemoveUsedItem pop hl .skipRemovingItem - ld a,[wcf91] - cp a,FULL_RESTORE - jr c,.playStatusAilmentCuringSound - cp a,FULL_HEAL - jr z,.playStatusAilmentCuringSound - ld a,SFX_HEAL_HP + ld a, [wcf91] + cp FULL_RESTORE + jr c, .playStatusAilmentCuringSound + cp FULL_HEAL + jr z, .playStatusAilmentCuringSound + ld a, SFX_HEAL_HP call PlaySoundWaitForCurrent - ld a,[hFlags_0xFFF6] - set 0,a - ld [hFlags_0xFFF6],a - ld a,$02 - ld [wHPBarType],a + ld a, [hFlags_0xFFFA] + set 0, a + ld [hFlags_0xFFFA], a + ld a, $02 + ld [wHPBarType], a predef UpdateHPBar2 ; animate the HP bar lengthening - ld a,[hFlags_0xFFF6] - res 0,a - ld [hFlags_0xFFF6],a - ld a,REVIVE_MSG - ld [wPartyMenuTypeOrMessageID],a - ld a,[wcf91] - cp a,REVIVE - jr z,.showHealingItemMessage - cp a,MAX_REVIVE - jr z,.showHealingItemMessage - ld a,POTION_MSG - ld [wPartyMenuTypeOrMessageID],a + ld a, [hFlags_0xFFFA] + res 0, a + ld [hFlags_0xFFFA], a + ld a, REVIVE_MSG + ld [wPartyMenuTypeOrMessageID], a + ld a, [wcf91] + cp REVIVE + jr z, .showHealingItemMessage + cp MAX_REVIVE + jr z, .showHealingItemMessage + ld a, POTION_MSG + ld [wPartyMenuTypeOrMessageID], a jr .showHealingItemMessage + .playStatusAilmentCuringSound - ld a,SFX_HEAL_AILMENT + ld a, SFX_HEAL_AILMENT call PlaySoundWaitForCurrent .showHealingItemMessage xor a - ld [H_AUTOBGTRANSFERENABLED],a + ld [H_AUTOBGTRANSFERENABLED], a call ClearScreen dec a - ld [wUpdateSpritesEnabled],a + ld [wUpdateSpritesEnabled], a call RedrawPartyMenu ; redraws the party menu and displays the message - ld a,1 - ld [H_AUTOBGTRANSFERENABLED],a - ld c,50 + ld a, 1 + ld [H_AUTOBGTRANSFERENABLED], a + ld c, 50 call DelayFrames call WaitForTextScrollButtonPress jr .done + .canceledItemUse xor a - ld [wActionResultOrTookBattleTurn],a ; item use failed + ld [wActionResultOrTookBattleTurn], a ; item use failed pop af pop af .done - ld a,[wPseudoItemID] + ld a, [wPseudoItemID] and a ; using Softboiled? ret nz ; if so, return call GBPalWhiteOut - call z,RunDefaultPaletteCommand - ld a,[wIsInBattle] + call z, RunDefaultPaletteCommand + ld a, [wIsInBattle] and a ret nz jp ReloadMapData + .useVitamin push hl ld a,[hl] @@ -1259,64 +1386,67 @@ ItemUseMedicine: ld [wCurEnemyLVL],a ; store level call GetMonHeader push de - ld a,d - ld hl,wPartyMonNicks + ld a, d + ld hl, wPartyMonNicks call GetPartyMonName pop de pop hl - ld a,[wcf91] - cp a,RARE_CANDY - jp z,.useRareCandy + ld a, [wcf91] + cp RARE_CANDY + jp z, .useRareCandy push hl - sub a,HP_UP + sub HP_UP add a ld bc,wPartyMon1HPExp - wPartyMon1 add hl,bc add l - ld l,a - jr nc,.noCarry2 + ld l, a + jr nc, .noCarry2 inc h .noCarry2 - ld a,10 - ld b,a - ld a,[hl] ; a = MSB of stat experience of the appropriate stat - cp a,100 ; is there already at least 25600 (256 * 100) stat experience? - jr nc,.vitaminNoEffect ; if so, vitamins can't add any more + ld a, 10 + ld b, a + ld a, [hl] ; a = MSB of stat experience of the appropriate stat + cp 100 ; is there already at least 25600 (256 * 100) stat experience? + jr nc, .vitaminNoEffect ; if so, vitamins can't add any more add b ; add 2560 (256 * 10) stat experience - jr nc,.noCarry3 ; a carry should be impossible here, so this will always jump - ld a,255 + jr nc, .noCarry3 ; a carry should be impossible here, so this will always jump + ld a, 255 .noCarry3 - ld [hl],a + ld [hl], a pop hl call .recalculateStats - ld hl,VitaminText - ld a,[wcf91] - sub a,HP_UP - 1 - ld c,a + ld hl, VitaminText + ld a, [wcf91] + sub HP_UP - 1 + ld c, a .statNameLoop ; loop to get the address of the name of the stat the vitamin increases dec c - jr z,.gotStatName + jr z, .gotStatName .statNameInnerLoop - ld a,[hli] - ld b,a - ld a,$50 + ld a, [hli] + ld b, a + ld a, $50 cp b - jr nz,.statNameInnerLoop + jr nz, .statNameInnerLoop jr .statNameLoop + .gotStatName - ld de,wcf4b - ld bc,10 + ld de, wcf4b + ld bc, 10 call CopyData ; copy the stat's name to wcf4b - ld a,SFX_HEAL_AILMENT + ld a, SFX_HEAL_AILMENT call PlaySound - ld hl,VitaminStatRoseText + ld hl, VitaminStatRoseText call PrintText jp RemoveUsedItem + .vitaminNoEffect pop hl - ld hl,VitaminNoEffectText + ld hl, VitaminNoEffectText call PrintText jp GBPalWhiteOut + .recalculateStats ld bc,wPartyMon1Stats - wPartyMon1 add hl,bc @@ -1334,27 +1464,27 @@ ItemUseMedicine: cp a, MAX_LEVEL jr z,.vitaminNoEffect ; can't raise level above 100 inc a - ld [hl],a ; store incremented level - ld [wCurEnemyLVL],a + ld [hl], a ; store incremented level + ld [wCurEnemyLVL], a push hl push de - ld d,a + ld d, a callab CalcExperience ; calculate experience for next level and store it at $ff96 pop de pop hl ld bc,wPartyMon1Exp - wPartyMon1Level add hl,bc ; hl now points to MSB of experience ; update experience to minimum for new level - ld a,[hExperience] - ld [hli],a - ld a,[hExperience + 1] - ld [hli],a - ld a,[hExperience + 2] - ld [hl],a + ld a, [hExperience] + ld [hli], a + ld a, [hExperience + 1] + ld [hli], a + ld a, [hExperience + 2] + ld [hl], a pop hl - ld a,[wWhichPokemon] + ld a, [wWhichPokemon] push af - ld a,[wcf91] + ld a, [wcf91] push af push de push hl @@ -1371,47 +1501,57 @@ ItemUseMedicine: ld bc,(wPartyMon1MaxHP + 1) - wPartyMon1 add hl,bc ; hl now points to LSB of max HP pop bc - ld a,[hld] + ld a, [hld] sub c - ld c,a - ld a,[hl] + ld c, a + ld a, [hl] sbc b - ld b,a ; bc = the amount of max HP gained from leveling up + ld b, a ; bc = the amount of max HP gained from leveling up ; add the amount gained to the current HP ld de,(wPartyMon1HP + 1) - wPartyMon1MaxHP add hl,de ; hl now points to LSB of current HP ld a,[hl] add c - ld [hld],a - ld a,[hl] + ld [hld], a + ld a, [hl] adc b - ld [hl],a - ld a,RARE_CANDY_MSG - ld [wPartyMenuTypeOrMessageID],a + ld [hl], a + ld a, RARE_CANDY_MSG + ld [wPartyMenuTypeOrMessageID], a call RedrawPartyMenu pop de - ld a,d - ld [wWhichPokemon],a - ld a,e - ld [wd11e],a + ld a, d + ld [wWhichPokemon], a + ld a, e + ld [wd11e], a xor a ; PLAYER_PARTY_DATA - ld [wMonDataLocation],a + ld [wMonDataLocation], a call LoadMonData - ld d,$01 + ld d, $01 callab PrintStatsBox ; display new stats text box call WaitForTextScrollButtonPress ; wait for button press xor a ; PLAYER_PARTY_DATA - ld [wMonDataLocation],a + ld [wMonDataLocation], a predef LearnMoveFromLevelUp ; learn level up move, if any + xor a - ld [wForceEvolution],a - callab TryEvolvingMon ; evolve pokemon, if appropriate - ld a,$01 - ld [wUpdateSpritesEnabled],a + ld [wForceEvolution], a + callabd_ModifyPikachuHappiness PIKAHAPPY_LEVELUP + ld a, [wWhichPokemon] + push af + ld a, [wUsedItemOnWhichPokemon] + ld [wWhichPokemon], a + callab Func_2fd6a ; evolve pokemon, if appropriate pop af - ld [wcf91],a + ld [wWhichPokemon], a + + callab TryEvolvingMon + ld a, $01 + ld [wUpdateSpritesEnabled], a pop af - ld [wWhichPokemon],a + ld [wcf91], a + pop af + ld [wWhichPokemon], a jp RemoveUsedItem VitaminStatRoseText: @@ -1430,50 +1570,50 @@ VitaminText: db "SPECIAL@" ItemUseBait: - ld hl,ThrewBaitText + ld hl, ThrewBaitText call PrintText - ld hl,wEnemyMonCatchRate ; catch rate + ld hl, wEnemyMonCatchRate ; catch rate srl [hl] ; halve catch rate - ld a,BAIT_ANIM - ld hl,wSafariBaitFactor ; bait factor - ld de,wSafariEscapeFactor ; escape factor + ld a, BAIT_ANIM + ld hl, wSafariBaitFactor ; bait factor + ld de, wSafariEscapeFactor ; escape factor jr BaitRockCommon ItemUseRock: - ld hl,ThrewRockText + ld hl, ThrewRockText call PrintText - ld hl,wEnemyMonCatchRate ; catch rate - ld a,[hl] + ld hl, wEnemyMonCatchRate ; catch rate + ld a, [hl] add a ; double catch rate - jr nc,.noCarry - ld a,$ff + jr nc, .noCarry + ld a, $ff .noCarry - ld [hl],a - ld a,ROCK_ANIM - ld hl,wSafariEscapeFactor ; escape factor - ld de,wSafariBaitFactor ; bait factor + ld [hl], a + ld a, ROCK_ANIM + ld hl, wSafariEscapeFactor ; escape factor + ld de, wSafariBaitFactor ; bait factor BaitRockCommon: - ld [wAnimationID],a + ld [wAnimationID], a xor a - ld [wAnimationType],a - ld [H_WHOSETURN],a - ld [de],a ; zero escape factor (for bait), zero bait factor (for rock) + ld [wAnimationType], a + ld [H_WHOSETURN], a + ld [de], a ; zero escape factor (for bait), zero bait factor (for rock) .randomLoop ; loop until a random number less than 5 is generated call Random - and a,7 - cp a,5 - jr nc,.randomLoop + and 7 + cp 5 + jr nc, .randomLoop inc a ; increment the random number, giving a range from 1 to 5 inclusive - ld b,a - ld a,[hl] + ld b, a + ld a, [hl] add b ; increase bait factor (for bait), increase escape factor (for rock) - jr nc,.noCarry - ld a,$ff + jr nc, .noCarry + ld a, $ff .noCarry - ld [hl],a + ld [hl], a predef MoveAnimation ; do animation - ld c,70 + ld c, 70 jp DelayFrames ThrewBaitText: @@ -1486,40 +1626,46 @@ ThrewRockText: ; also used for Dig out-of-battle effect ItemUseEscapeRope: - ld a,[wIsInBattle] + ld a, [wIsInBattle] and a - jr nz,.notUsable - ld a,[wCurMap] - cp a,AGATHAS_ROOM - jr z,.notUsable - ld a,[wCurMapTileset] - ld b,a - ld hl,EscapeRopeTilesets + jr nz, .notUsable + ld a, [wCurMap] + cp AGATHAS_ROOM + jr z, .notUsable + cp BILLS_HOUSE + jr z, .notUsable + cp POKEMON_FAN_CLUB + jr z, .notUsable + ld a, [wCurMapTileset] + ld b, a + ld hl, EscapeRopeTilesets .loop - ld a,[hli] - cp a,$ff - jr z,.notUsable + ld a, [hli] + cp $ff + jr z, .notUsable cp b - jr nz,.loop - ld hl,wd732 - set 3,[hl] - set 6,[hl] - ld hl,wd72e - res 4,[hl] + jr nz, .loop + ld hl, wd732 + set 3, [hl] + set 6, [hl] + call Func_1510 + ld hl, wd72e + res 4, [hl] ResetEvent EVENT_IN_SAFARI_ZONE xor a - ld [wNumSafariBalls],a - ld [wSafariZoneEntranceCurScript],a + ld [wNumSafariBalls], a + ld [wSafariZoneEntranceCurScript], a inc a - ld [wEscapedFromBattle],a - ld [wActionResultOrTookBattleTurn],a ; item used - ld a,[wPseudoItemID] + ld [wEscapedFromBattle], a + ld [wActionResultOrTookBattleTurn], a ; item used + ld a, [wPseudoItemID] and a ; using Dig? ret nz ; if so, return call ItemUseReloadOverworldData - ld c,30 + ld c, 30 call DelayFrames jp RemoveUsedItem + .notUsable jp ItemUseNotTime @@ -1528,63 +1674,67 @@ EscapeRopeTilesets: db $ff ; terminator ItemUseRepel: - ld b,100 + ld b, 100 ItemUseRepelCommon: - ld a,[wIsInBattle] + ld a, [wIsInBattle] and a - jp nz,ItemUseNotTime - ld a,b - ld [wRepelRemainingSteps],a + jp nz, ItemUseNotTime + ld a, b + ld [wRepelRemainingSteps], a jp PrintItemUseTextAndRemoveItem ; handles X Accuracy item ItemUseXAccuracy: - ld a,[wIsInBattle] + ld a, [wIsInBattle] and a - jp z,ItemUseNotTime - ld hl,wPlayerBattleStatus2 - set UsingXAccuracy,[hl] ; X Accuracy bit + jp z, ItemUseNotTime + ld hl, wPlayerBattleStatus2 + set UsingXAccuracy, [hl] ; X Accuracy bit + callabd_ModifyPikachuHappiness PIKAHAPPY_USEDXITEM jp PrintItemUseTextAndRemoveItem ; This function is bugged and never works. It always jumps to ItemUseNotTime. ; The Card Key is handled in a different way. ItemUseCardKey: xor a - ld [wUnusedD71F],a + ld [wUnusedD71F], a call GetTileAndCoordsInFrontOfPlayer ld a,[GetTileAndCoordsInFrontOfPlayer] cp a,$18 jr nz,.next0 ld hl,CardKeyTable1 jr .next1 + .next0 - cp a,$24 - jr nz,.next2 - ld hl,CardKeyTable2 + cp $24 + jr nz, .next2 + ld hl, CardKeyTable2 jr .next1 + .next2 - cp a,$5e - jp nz,ItemUseNotTime - ld hl,CardKeyTable3 + cp $5e + jp nz, ItemUseNotTime + ld hl, CardKeyTable3 .next1 - ld a,[wCurMap] - ld b,a + ld a, [wCurMap] + ld b, a .loop - ld a,[hli] - cp a,$ff - jp z,ItemUseNotTime + ld a, [hli] + cp $ff + jp z, ItemUseNotTime cp b - jr nz,.nextEntry1 - ld a,[hli] + jr nz, .nextEntry1 + ld a, [hli] cp d - jr nz,.nextEntry2 - ld a,[hli] + jr nz, .nextEntry2 + ld a, [hli] cp e - jr nz,.nextEntry3 - ld a,[hl] - ld [wUnusedD71F],a + jr nz, .nextEntry3 + ld a, [hl] + ld [wUnusedD71F], a jr .done + .nextEntry1 inc hl .nextEntry2 @@ -1592,11 +1742,12 @@ ItemUseCardKey: .nextEntry3 inc hl jr .loop + .done - ld hl,ItemUseText00 + ld hl, ItemUseText00 call PrintText - ld hl,wd728 - set 7,[hl] + ld hl, wd728 + set 7, [hl] ret ; These tables are probably supposed to be door locations in Silph Co., @@ -1610,176 +1761,228 @@ ItemUseCardKey: ; 03: ID? CardKeyTable1: - db SILPH_CO_2F,$04,$04,$00 - db SILPH_CO_2F,$04,$05,$01 - db SILPH_CO_4F,$0C,$04,$02 - db SILPH_CO_4F,$0C,$05,$03 - db SILPH_CO_7F,$06,$0A,$04 - db SILPH_CO_7F,$06,$0B,$05 - db SILPH_CO_9F,$04,$12,$06 - db SILPH_CO_9F,$04,$13,$07 - db SILPH_CO_10F,$08,$0A,$08 - db SILPH_CO_10F,$08,$0B,$09 + db SILPH_CO_2F, $04, $04, $00 + db SILPH_CO_2F, $04, $05, $01 + db SILPH_CO_4F, $0C, $04, $02 + db SILPH_CO_4F, $0C, $05, $03 + db SILPH_CO_7F, $06, $0A, $04 + db SILPH_CO_7F, $06, $0B, $05 + db SILPH_CO_9F, $04, $12, $06 + db SILPH_CO_9F, $04, $13, $07 + db SILPH_CO_10F, $08, $0A, $08 + db SILPH_CO_10F, $08, $0B, $09 db $ff CardKeyTable2: - db SILPH_CO_3F,$08,$09,$0A - db SILPH_CO_3F,$09,$09,$0B - db SILPH_CO_5F,$04,$07,$0C - db SILPH_CO_5F,$05,$07,$0D - db SILPH_CO_6F,$0C,$05,$0E - db SILPH_CO_6F,$0D,$05,$0F - db SILPH_CO_8F,$08,$07,$10 - db SILPH_CO_8F,$09,$07,$11 - db SILPH_CO_9F,$08,$03,$12 - db SILPH_CO_9F,$09,$03,$13 + db SILPH_CO_3F, $08, $09, $0A + db SILPH_CO_3F, $09, $09, $0B + db SILPH_CO_5F, $04, $07, $0C + db SILPH_CO_5F, $05, $07, $0D + db SILPH_CO_6F, $0C, $05, $0E + db SILPH_CO_6F, $0D, $05, $0F + db SILPH_CO_8F, $08, $07, $10 + db SILPH_CO_8F, $09, $07, $11 + db SILPH_CO_9F, $08, $03, $12 + db SILPH_CO_9F, $09, $03, $13 db $ff CardKeyTable3: - db SILPH_CO_11F,$08,$09,$14 - db SILPH_CO_11F,$09,$09,$15 + db SILPH_CO_11F, $08, $09, $14 + db SILPH_CO_11F, $09, $09, $15 db $ff ItemUsePokedoll: - ld a,[wIsInBattle] + ld a, [wIsInBattle] dec a - jp nz,ItemUseNotTime - ld a,$01 - ld [wEscapedFromBattle],a + jp nz, ItemUseNotTime + ld a, $01 + ld [wEscapedFromBattle], a jp PrintItemUseTextAndRemoveItem ItemUseGuardSpec: - ld a,[wIsInBattle] + ld a, [wIsInBattle] and a - jp z,ItemUseNotTime - ld hl,wPlayerBattleStatus2 - set ProtectedByMist,[hl] ; Mist bit + jp z, ItemUseNotTime + + ld a, [wWhichPokemon] + push af + ld a, [wPlayerMonNumber] + ld [wWhichPokemon], a + callabd_ModifyPikachuHappiness PIKAHAPPY_USEDXITEM + pop af + ld [wWhichPokemon], a + + ld hl, wPlayerBattleStatus2 + set ProtectedByMist, [hl] ; Mist bit jp PrintItemUseTextAndRemoveItem ItemUseSuperRepel: - ld b,200 + ld b, 200 jp ItemUseRepelCommon ItemUseMaxRepel: - ld b,250 + ld b, 250 jp ItemUseRepelCommon ItemUseDireHit: - ld a,[wIsInBattle] + ld a, [wIsInBattle] and a - jp z,ItemUseNotTime - ld hl,wPlayerBattleStatus2 - set GettingPumped,[hl] ; Focus Energy bit + jp z, ItemUseNotTime + + ld a, [wWhichPokemon] + push af + ld a, [wPlayerMonNumber] + ld [wWhichPokemon], a + callabd_ModifyPikachuHappiness PIKAHAPPY_USEDXITEM + pop af + ld [wWhichPokemon], a + + ld hl, wPlayerBattleStatus2 + set GettingPumped, [hl] ; Focus Energy bit jp PrintItemUseTextAndRemoveItem ItemUseXStat: - ld a,[wIsInBattle] + ld a, [wIsInBattle] and a - jr nz,.inBattle + jr nz, .inBattle call ItemUseNotTime - ld a,2 - ld [wActionResultOrTookBattleTurn],a ; item not used + ld a, 2 + ld [wActionResultOrTookBattleTurn], a ; item not used ret + .inBattle - ld hl,wPlayerMoveNum - ld a,[hli] + ld hl, wPlayerMoveNum + ld a, [hli] push af ; save [wPlayerMoveNum] - ld a,[hl] + ld a, [hl] push af ; save [wPlayerMoveEffect] push hl - ld a,[wcf91] - sub a,X_ATTACK - ATTACK_UP1_EFFECT - ld [hl],a ; store player move effect + ld a, [wcf91] + sub X_ATTACK - ATTACK_UP1_EFFECT + ld [hl], a ; store player move effect call PrintItemUseTextAndRemoveItem - ld a,XSTATITEM_ANIM ; X stat item animation ID - ld [wPlayerMoveNum],a + ld a, XSTATITEM_ANIM ; X stat item animation ID + ld [wPlayerMoveNum], a call LoadScreenTilesFromBuffer1 ; restore saved screen call Delay3 xor a - ld [H_WHOSETURN],a ; set turn to player's turn + ld [H_WHOSETURN], a ; set turn to player's turn callba StatModifierUpEffect ; do stat increase move + + ld a, [wWhichPokemon] + push af + ld a, [wPlayerMonNumber] + ld [wWhichPokemon], a + callabd_ModifyPikachuHappiness PIKAHAPPY_USEDXITEM + pop af + ld [wWhichPokemon], a + pop hl pop af - ld [hld],a ; restore [wPlayerMoveEffect] + ld [hld], a ; restore [wPlayerMoveEffect] pop af - ld [hl],a ; restore [wPlayerMoveNum] + ld [hl], a ; restore [wPlayerMoveNum] ret ItemUsePokeflute: - ld a,[wIsInBattle] + ld a, [wIsInBattle] and a - jr nz,.inBattle + jr nz, .inBattle ; if not in battle call ItemUseReloadOverworldData - ld a,[wCurMap] - cp a,ROUTE_12 - jr nz,.notRoute12 + ld a, [wCurMap] + cp ROUTE_12 + jr nz, .notRoute12 CheckEvent EVENT_BEAT_ROUTE12_SNORLAX - jr nz,.noSnorlaxToWakeUp + jr nz, .noSnorlaxOrPikachuToWakeUp ; if the player hasn't beaten Route 12 Snorlax - ld hl,Route12SnorlaxFluteCoords + ld hl, Route12SnorlaxFluteCoords call ArePlayerCoordsInArray - jr nc,.noSnorlaxToWakeUp - ld hl,PlayedFluteHadEffectText + jr nc, .noSnorlaxOrPikachuToWakeUp + ld hl, PlayedFluteHadEffectText call PrintText SetEvent EVENT_FIGHT_ROUTE12_SNORLAX ret + .notRoute12 - cp a,ROUTE_16 - jr nz,.noSnorlaxToWakeUp + cp ROUTE_16 + jr nz, .notRoute16 CheckEvent EVENT_BEAT_ROUTE16_SNORLAX - jr nz,.noSnorlaxToWakeUp + jr nz, .noSnorlaxOrPikachuToWakeUp ; if the player hasn't beaten Route 16 Snorlax - ld hl,Route16SnorlaxFluteCoords + ld hl, Route16SnorlaxFluteCoords call ArePlayerCoordsInArray - jr nc,.noSnorlaxToWakeUp - ld hl,PlayedFluteHadEffectText + jr nc, .noSnorlaxOrPikachuToWakeUp + ld hl, PlayedFluteHadEffectText call PrintText SetEvent EVENT_FIGHT_ROUTE16_SNORLAX ret -.noSnorlaxToWakeUp - ld hl,PlayedFluteNoEffectText + +.notRoute16 + cp PEWTER_POKECENTER + jr nz, .noSnorlaxOrPikachuToWakeUp + call CheckPikachuFollowingPlayer + jr z, .noSnorlaxOrPikachuToWakeUp + callab IsPikachuRightNextToPlayer + jr nc, .noSnorlaxOrPikachuToWakeUp + ld hl, PlayedFluteHadEffectText + call PrintText + call ItemUseReloadOverworldData + ldpikaemotion e, PikachuEmotion26 + callab PlaySpecificPikachuEmotion + ret + +.noSnorlaxOrPikachuToWakeUp + ld hl, PlayedFluteNoEffectText jp PrintText + .inBattle xor a - ld [wWereAnyMonsAsleep],a - ld b,~SLP & $ff - ld hl,wPartyMon1Status + ld [wWereAnyMonsAsleep], a + ld b, $ff ^ SLP + ld hl, wPartyMon1Status call WakeUpEntireParty - ld a,[wIsInBattle] + ld a, [wIsInBattle] dec a ; is it a trainer battle? - jr z,.skipWakingUpEnemyParty + jr z, .skipWakingUpEnemyParty ; if it's a trainer battle - ld hl,wEnemyMon1Status + ld hl, wEnemyMon1Status call WakeUpEntireParty .skipWakingUpEnemyParty - ld hl,wBattleMonStatus - ld a,[hl] + ld hl, wBattleMonStatus + ld a, [hl] and b ; remove Sleep status - ld [hl],a - ld hl,wEnemyMonStatus - ld a,[hl] + ld [hl], a + ld hl, wEnemyMonStatus + ld a, [hl] + ld c, a and b ; remove Sleep status - ld [hl],a + ld [hl], a + ld a, c + and SLP + jr z, .asm_e063 + ld a, $1 + ld [wWereAnyMonsAsleep], a +.asm_e063 call LoadScreenTilesFromBuffer2 ; restore saved screen - ld a,[wWereAnyMonsAsleep] + ld a, [wWereAnyMonsAsleep] and a ; were any pokemon asleep before playing the flute? - ld hl,PlayedFluteNoEffectText - jp z,PrintText ; if no pokemon were asleep + ld hl, PlayedFluteNoEffectText + jp z, PrintText ; if no pokemon were asleep ; if some pokemon were asleep - ld hl,PlayedFluteHadEffectText + ld hl, PlayedFluteHadEffectText call PrintText - ld a,[wLowHealthAlarm] - and a,$80 - jr nz,.skipMusic + ld a, [wLowHealthAlarm] + and $80 + jr nz, .skipMusic call WaitForSoundToFinish ; wait for sound to end callba Music_PokeFluteInBattle ; play in-battle pokeflute music .musicWaitLoop ; wait for music to finish playing - ld a,[wChannelSoundIDs + CH6] + ld a, [wChannelSoundIDs + CH6] and a ; music off? - jr nz,.musicWaitLoop + jr nz, .musicWaitLoop .skipMusic - ld hl,FluteWokeUpText + ld hl, FluteWokeUpText jp PrintText ; wakes up all party pokemon @@ -1790,40 +1993,40 @@ ItemUsePokeflute: ; OUTPUT: ; [wWereAnyMonsAsleep]: set to 1 if any pokemon were asleep WakeUpEntireParty: - ld de,44 - ld c,6 + ld de, 44 + ld c, 6 .loop - ld a,[hl] + ld a, [hl] push af - and a,SLP ; is pokemon asleep? - jr z,.notAsleep - ld a,1 - ld [wWereAnyMonsAsleep],a ; indicate that a pokemon had to be woken up + and SLP ; is pokemon asleep? + jr z, .notAsleep + ld a, 1 + ld [wWereAnyMonsAsleep], a ; indicate that a pokemon had to be woken up .notAsleep pop af and b ; remove Sleep status - ld [hl],a - add hl,de + ld [hl], a + add hl, de dec c - jr nz,.loop + jr nz, .loop ret ; Format: ; 00: Y ; 01: X Route12SnorlaxFluteCoords: - db 62,9 ; one space West of Snorlax - db 61,10 ; one space North of Snorlax - db 63,10 ; one space South of Snorlax - db 62,11 ; one space East of Snorlax + db 62, 9 ; one space West of Snorlax + db 61, 10 ; one space North of Snorlax + db 63, 10 ; one space South of Snorlax + db 62, 11 ; one space East of Snorlax db $ff ; terminator ; Format: ; 00: Y ; 01: X Route16SnorlaxFluteCoords: - db 10,27 ; one space East of Snorlax - db 10,25 ; one space West of Snorlax + db 10, 27 ; one space East of Snorlax + db 10, 25 ; one space West of Snorlax db $ff ; terminator PlayedFluteNoEffectText: @@ -1838,28 +2041,27 @@ PlayedFluteHadEffectText: TX_FAR _PlayedFluteHadEffectText db $06 TX_ASM - ld a,[wIsInBattle] + ld a, [wIsInBattle] and a - jr nz,.done + jr nz, .done ; play out-of-battle pokeflute music - ld a,$ff - call PlaySound ; turn off music - ld a, SFX_POKEFLUE + call StopAllMusic ; turn off music + ld a, SFX_POKEFLUTE ld c, BANK(SFX_Pokeflute) call PlayMusic .musicWaitLoop ; wait for music to finish playing - ld a,[wChannelSoundIDs + CH2] - cp a, SFX_POKEFLUE - jr z,.musicWaitLoop + ld a, [wChannelSoundIDs + CH2] + cp SFX_POKEFLUTE + jr z, .musicWaitLoop call PlayDefaultMusic ; start playing normal music again .done jp TextScriptEnd ; end text ItemUseCoinCase: - ld a,[wIsInBattle] + ld a, [wIsInBattle] and a - jp nz,ItemUseNotTime - ld hl,CoinCaseNumCoinsText + jp nz, ItemUseNotTime + ld hl, CoinCaseNumCoinsText jp PrintText CoinCaseNumCoinsText: @@ -1875,7 +2077,7 @@ ItemUseOldRod: ItemUseGoodRod: call FishingInit - jp c,ItemUseNotTime + jp c, ItemUseNotTime .RandomLoop call Random srl a @@ -1884,17 +2086,17 @@ ItemUseGoodRod: cp 2 jr nc, .RandomLoop ; choose which monster appears - ld hl,GoodRodMons - add a,a - ld c,a - ld b,0 - add hl,bc - ld b,[hl] + ld hl, GoodRodMons + add a + ld c, a + ld b, 0 + add hl, bc + ld b, [hl] inc hl - ld c,[hl] + ld c, [hl] and a .SetBite - ld a,0 + ld a, 0 rla xor 1 jr RodResponse @@ -1904,13 +2106,28 @@ INCLUDE "data/good_rod.asm" ItemUseSuperRod: call FishingInit jp c, ItemUseNotTime - call ReadSuperRodData - ld a, e + callab ReadSuperRodData + ld c, e + ld b, d + ld a, $2 + ld [wRodResponse], a + ld a, c + and a ; are there fish in the map? + jr z, DoNotGenerateFishingEncounter ; if not, do not generate an encounter + ld a, $1 + ld [wRodResponse], a + call Random + and $1 + jr nz, RodResponse + xor a + ld [wRodResponse], a + jr DoNotGenerateFishingEncounter + RodResponse: ld [wRodResponse], a dec a ; is there a bite? - jr nz, .next + jr nz, DoNotGenerateFishingEncounter ; if yes, store level and species data ld a, 1 ld [wMoveMissed], a @@ -1919,7 +2136,7 @@ RodResponse: ld a, c ; species ld [wCurOpponent], a -.next +DoNotGenerateFishingEncounter: ld hl, wWalkBikeSurfState ld a, [hl] ; store the value in a push af @@ -1934,27 +2151,33 @@ RodResponse: ; checks if fishing is possible and if so, runs initialization code common to all rods ; unsets carry if fishing is possible, sets carry if not FishingInit: - ld a,[wIsInBattle] + ld a, [wIsInBattle] and a - jr z,.notInBattle + jr z, .notInBattle scf ; can't fish during battle ret + .notInBattle call IsNextTileShoreOrWater - ret c - ld a,[wWalkBikeSurfState] - cp a,2 ; Surfing? - jr z,.surfing + jr nc, .cannotFish + ld a, [wWalkBikeSurfState] + cp 2 ; Surfing? + jr z, .cannotFish call ItemUseReloadOverworldData - ld hl,ItemUseText00 + ld hl, ItemUseText00 call PrintText - ld a,SFX_HEAL_AILMENT + ld a, SFX_HEAL_AILMENT call PlaySound - ld c,80 + ld a, $2 + ld [wd49c], a + ld a, $81 + ld [wPikachuMood], a + ld c, 80 call DelayFrames and a ret -.surfing + +.cannotFish scf ; can't fish when surfing ret @@ -1962,22 +2185,22 @@ ItemUseOaksParcel: jp ItemUseNotYoursToUse ItemUseItemfinder: - ld a,[wIsInBattle] + ld a, [wIsInBattle] and a - jp nz,ItemUseNotTime + jp nz, ItemUseNotTime call ItemUseReloadOverworldData callba HiddenItemNear ; check for hidden items - ld hl,ItemfinderFoundNothingText - jr nc,.printText ; if no hidden items - ld c,4 + ld hl, ItemfinderFoundNothingText + jr nc, .printText ; if no hidden items + ld c, 4 .loop - ld a,SFX_HEALING_MACHINE + ld a, SFX_HEALING_MACHINE call PlaySoundWaitForCurrent - ld a,SFX_PURCHASE + ld a, SFX_PURCHASE call PlaySoundWaitForCurrent dec c - jr nz,.loop - ld hl,ItemfinderFoundItemText + jr nz, .loop + ld hl, ItemfinderFoundItemText .printText jp PrintText @@ -1990,54 +2213,70 @@ ItemfinderFoundNothingText: db "@" ItemUsePPUp: - ld a,[wIsInBattle] + ld a, [wIsInBattle] and a - jp nz,ItemUseNotTime + jp nz, ItemUseNotTime ItemUsePPRestore: - ld a,[wWhichPokemon] + ld a, [wWhichPokemon] push af - ld a,[wcf91] - ld [wPPRestoreItem],a + ld a, [wcf91] + ld [wPPRestoreItem], a .chooseMon xor a - ld [wUpdateSpritesEnabled],a - ld a,USE_ITEM_PARTY_MENU - ld [wPartyMenuTypeOrMessageID],a + ld [wUpdateSpritesEnabled], a + ld a, USE_ITEM_PARTY_MENU + ld [wPartyMenuTypeOrMessageID], a call DisplayPartyMenu - jr nc,.chooseMove + jr nc, .chooseMove jp .itemNotUsed + .chooseMove - ld a,[wPPRestoreItem] - cp a,ELIXER - jp nc,.useElixir ; if Elixir or Max Elixir - ld a,$02 - ld [wMoveMenuType],a - ld hl,RaisePPWhichTechniqueText - ld a,[wPPRestoreItem] - cp a,ETHER ; is it a PP Up? - jr c,.printWhichTechniqueMessage ; if so, print the raise PP message - ld hl,RestorePPWhichTechniqueText ; otherwise, print the restore PP message + ld a, [wIsInBattle] + and a + jr z, .usePPItem + ld a, [wWhichPokemon] + ld b, a + ld a, [wPlayerMonNumber] + cp b + jr nz, .usePPItem + ld a, [wPlayerBattleStatus3] + bit Transformed, a + jr z, .usePPItem + call ItemUseNotTime + jp .itemNotUsed + +.usePPItem + ld a, [wPPRestoreItem] + cp ELIXER + jp nc, .useElixir ; if Elixir or Max Elixir + ld a, $02 + ld [wMoveMenuType], a + ld hl, RaisePPWhichTechniqueText + ld a, [wPPRestoreItem] + cp ETHER ; is it a PP Up? + jr c, .printWhichTechniqueMessage ; if so, print the raise PP message + ld hl, RestorePPWhichTechniqueText ; otherwise, print the restore PP message .printWhichTechniqueMessage call PrintText xor a - ld [wPlayerMoveListIndex],a + ld [wPlayerMoveListIndex], a callab MoveSelectionMenu ; move selection menu - ld a,0 - ld [wPlayerMoveListIndex],a - jr nz,.chooseMon - ld hl,wPartyMon1Moves + ld a, 0 + ld [wPlayerMoveListIndex], a + jr nz, .chooseMon + ld hl, wPartyMon1Moves ld bc, wPartyMon2 - wPartyMon1 call GetSelectedMoveOffset push hl - ld a,[hl] - ld [wd11e],a + ld a, [hl] + ld [wd11e], a call GetMoveName call CopyStringToCF4B ; copy name to wcf4b pop hl - ld a,[wPPRestoreItem] - cp a,ETHER - jr nc,.useEther ; if Ether or Max Ether + ld a, [wPPRestoreItem] + cp ETHER + jr nc, .useEther ; if Ether or Max Ether .usePPUp ld bc,wPartyMon1PP - wPartyMon1Moves add hl,bc @@ -2047,79 +2286,86 @@ ItemUsePPRestore: ld hl,PPMaxedOutText call PrintText jr .chooseMove + .PPNotMaxedOut - ld a,[hl] - add a,1 << 6 ; increase PP Up count by 1 - ld [hl],a - ld a,1 ; 1 PP Up used - ld [wd11e],a + ld a, [hl] + add 1 << 6 ; increase PP Up count by 1 + ld [hl], a + ld a, 1 ; 1 PP Up used + ld [wd11e], a call RestoreBonusPP ; add the bonus PP to current PP - ld hl,PPIncreasedText + ld a, SFX_HEAL_AILMENT + call PlaySound + ld hl, PPIncreasedText call PrintText .done pop af - ld [wWhichPokemon],a + ld [wWhichPokemon], a call GBPalWhiteOut call RunDefaultPaletteCommand jp RemoveUsedItem + .afterRestoringPP ; after using a (Max) Ether/Elixir - ld a,[wWhichPokemon] - ld b,a - ld a,[wPlayerMonNumber] + ld a, [wWhichPokemon] + ld b, a + ld a, [wPlayerMonNumber] cp b ; is the pokemon whose PP was restored active in battle? - jr nz,.skipUpdatingInBattleData - ld hl,wPartyMon1PP + jr nz, .skipUpdatingInBattleData + ld hl, wPartyMon1PP ld bc, wPartyMon2 - wPartyMon1 call AddNTimes - ld de,wBattleMonPP - ld bc,4 + ld de, wBattleMonPP + ld bc, 4 call CopyData ; copy party data to in-battle data .skipUpdatingInBattleData - ld a,SFX_HEAL_AILMENT + ld a, SFX_HEAL_AILMENT call PlaySound - ld hl,PPRestoredText + ld hl, PPRestoredText call PrintText jr .done + .useEther call .restorePP - jr nz,.afterRestoringPP + jr nz, .afterRestoringPP jp .noEffect + ; unsets zero flag if PP was restored, sets zero flag if not ; however, this is bugged for Max Ethers and Max Elixirs (see below) .restorePP xor a ; PLAYER_PARTY_DATA - ld [wMonDataLocation],a + ld [wMonDataLocation], a call GetMaxPP - ld hl,wPartyMon1Moves + ld hl, wPartyMon1Moves ld bc, wPartyMon2 - wPartyMon1 call GetSelectedMoveOffset ld bc, wPartyMon1PP - wPartyMon1Moves - add hl,bc ; hl now points to move's PP - ld a,[wMaxPP] - ld b,a - ld a,[wPPRestoreItem] - cp a,MAX_ETHER - jr z,.fullyRestorePP - ld a,[hl] ; move PP - and a,%00111111 ; lower 6 bit bits store current PP + add hl, bc ; hl now points to move's PP + ld a, [wMaxPP] + ld b, a + ld a, [wPPRestoreItem] + cp MAX_ETHER + jr z, .fullyRestorePP + ld a, [hl] ; move PP + and %00111111 ; lower 6 bit bits store current PP cp b ; does current PP equal max PP? ret z ; if so, return - add a,10 ; increase current PP by 10 + add 10 ; increase current PP by 10 ; b holds the max PP amount and b will hold the new PP amount. ; So, if the new amount meets or exceeds the max amount, ; cap the amount to the max amount by leaving b unchanged. ; Otherwise, store the new amount in b. cp b ; does the new amount meet or exceed the maximum? - jr nc,.storeNewAmount - ld b,a + jr nc, .storeNewAmount + ld b, a .storeNewAmount - ld a,[hl] ; move PP - and a,%11000000 ; PP Up counter bits + ld a, [hl] ; move PP + and %11000000 ; PP Up counter bits add b - ld [hl],a + ld [hl], a ret + .fullyRestorePP - ld a,[hl] ; move PP + ld a, [hl] ; move PP ; Note that this code has a bug. It doesn't mask out the upper two bits, which ; are used to count how many PP Ups have been used on the move. So, Max Ethers ; and Max Elixirs will not be detected as having no effect on a move with full @@ -2127,39 +2373,40 @@ ItemUsePPRestore: cp b ; does current PP equal max PP? ret z jr .storeNewAmount + .useElixir ; decrement the item ID so that ELIXER becomes ETHER and MAX_ELIXER becomes MAX_ETHER - ld hl,wPPRestoreItem + ld hl, wPPRestoreItem dec [hl] dec [hl] xor a - ld hl,wCurrentMenuItem - ld [hli],a - ld [hl],a ; zero the counter for number of moves that had their PP restored - ld b,4 + ld hl, wCurrentMenuItem + ld [hli], a + ld [hl], a ; zero the counter for number of moves that had their PP restored + ld b, 4 ; loop through each move and restore PP .elixirLoop push bc - ld hl,wPartyMon1Moves + ld hl, wPartyMon1Moves ld bc, wPartyMon2 - wPartyMon1 call GetSelectedMoveOffset - ld a,[hl] + ld a, [hl] and a ; does the current slot have a move? - jr z,.nextMove + jr z, .nextMove call .restorePP - jr z,.nextMove + jr z, .nextMove ; if some PP was restored - ld hl,wTileBehindCursor ; counter for number of moves that had their PP restored + ld hl, wTileBehindCursor ; counter for number of moves that had their PP restored inc [hl] .nextMove - ld hl,wCurrentMenuItem + ld hl, wCurrentMenuItem inc [hl] pop bc dec b - jr nz,.elixirLoop - ld a,[wTileBehindCursor] + jr nz, .elixirLoop + ld a, [wTileBehindCursor] and a ; did any moves have their PP restored? - jp nz,.afterRestoringPP + jp nz, .afterRestoringPP .noEffect call ItemUseNoEffect .itemNotUsed @@ -2167,7 +2414,7 @@ ItemUsePPRestore: call RunDefaultPaletteCommand pop af xor a - ld [wActionResultOrTookBattleTurn],a ; item use failed + ld [wActionResultOrTookBattleTurn], a ; item use failed ret RaisePPWhichTechniqueText: @@ -2195,63 +2442,64 @@ UnusableItem: jp ItemUseNotTime ItemUseTMHM: - ld a,[wIsInBattle] + ld a, [wIsInBattle] and a - jp nz,ItemUseNotTime - ld a,[wcf91] - sub a,TM_01 + jp nz, ItemUseNotTime + ld a, [wcf91] + sub TM_01 push af - jr nc,.skipAdding - add a,55 ; if item is an HM, add 55 + jr nc, .skipAdding + add 55 ; if item is an HM, add 55 .skipAdding inc a - ld [wd11e],a + ld [wd11e], a predef TMToMove ; get move ID from TM/HM ID - ld a,[wd11e] - ld [wMoveNum],a + ld a, [wd11e] + ld [wMoveNum], a call GetMoveName call CopyStringToCF4B ; copy name to wcf4b pop af - ld hl,BootedUpTMText - jr nc,.printBootedUpMachineText - ld hl,BootedUpHMText + ld hl, BootedUpTMText + jr nc, .printBootedUpMachineText + ld hl, BootedUpHMText .printBootedUpMachineText call PrintText - ld hl,TeachMachineMoveText + ld hl, TeachMachineMoveText call PrintText coord hl, 14, 7 lb bc, 8, 15 - ld a,TWO_OPTION_MENU - ld [wTextBoxID],a + ld a, TWO_OPTION_MENU + ld [wTextBoxID], a call DisplayTextBoxID ; yes/no menu - ld a,[wCurrentMenuItem] + ld a, [wCurrentMenuItem] and a - jr z,.useMachine - ld a,2 - ld [wActionResultOrTookBattleTurn],a ; item not used + jr z, .useMachine + ld a, 2 + ld [wActionResultOrTookBattleTurn], a ; item not used ret + .useMachine - ld a,[wWhichPokemon] + ld a, [wWhichPokemon] push af - ld a,[wcf91] + ld a, [wcf91] push af .chooseMon - ld hl,wcf4b - ld de,wTempMoveNameBuffer - ld bc,14 + ld hl, wcf4b + ld de, wTempMoveNameBuffer + ld bc, 14 call CopyData ; save the move name because DisplayPartyMenu will overwrite it - ld a,$ff - ld [wUpdateSpritesEnabled],a - ld a,TMHM_PARTY_MENU - ld [wPartyMenuTypeOrMessageID],a + ld a, $ff + ld [wUpdateSpritesEnabled], a + ld a, TMHM_PARTY_MENU + ld [wPartyMenuTypeOrMessageID], a call DisplayPartyMenu push af - ld hl,wTempMoveNameBuffer - ld de,wcf4b - ld bc,14 + ld hl, wTempMoveNameBuffer + ld de, wcf4b + ld bc, 14 call CopyData pop af - jr nc,.checkIfAbleToLearnMove + jr nc, .checkIfAbleToLearnMove ; if the player canceled teaching the move pop af pop af @@ -2262,31 +2510,56 @@ ItemUseTMHM: .checkIfAbleToLearnMove predef CanLearnTM ; check if the pokemon can learn the move push bc - ld a,[wWhichPokemon] - ld hl,wPartyMonNicks + ld a, [wWhichPokemon] + ld hl, wPartyMonNicks call GetPartyMonName pop bc - ld a,c + ld a, c and a ; can the pokemon learn the move? - jr nz,.checkIfAlreadyLearnedMove + jr nz, .checkIfAlreadyLearnedMove ; if the pokemon can't learn the move - ld a,SFX_DENIED + ld a, SFX_DENIED call PlaySoundWaitForCurrent - ld hl,MonCannotLearnMachineMoveText + ld hl, MonCannotLearnMachineMoveText call PrintText jr .chooseMon + .checkIfAlreadyLearnedMove callab CheckIfMoveIsKnown ; check if the pokemon already knows the move - jr c,.chooseMon + jr c, .chooseMon predef LearnMove ; teach move + ld a, [wWhichPokemon] + ld d, a pop af - ld [wcf91],a + ld [wcf91], a pop af - ld [wWhichPokemon],a - ld a,b + ld [wWhichPokemon], a + ld a, b and a ret z - ld a,[wcf91] + + ld a, [wWhichPokemon] + push af + ld a, d + ld [wWhichPokemon], a + callabd_ModifyPikachuHappiness PIKAHAPPY_USEDTMHM + callab IsThisPartymonStarterPikachu_Party + jr nc, .notTeachingThunderboltOrThunderToPikachu + ld a, [wcf91] + cp TM_24 ; are we teaching thunderbolt to the player pikachu? + jr z, .teachingThunderboltOrThunderToPlayerPikachu + cp TM_25 ; are we teaching thunder then? + jr nz, .notTeachingThunderboltOrThunderToPikachu +.teachingThunderboltOrThunderToPlayerPikachu + ld a, $5 + ld [wd49c], a + ld a, $85 + ld [wPikachuMood], a +.notTeachingThunderboltOrThunderToPikachu + pop af + ld [wWhichPokemon], a + + ld a, [wcf91] call IsItemHM ret c jp RemoveUsedItem @@ -2308,57 +2581,63 @@ MonCannotLearnMachineMoveText: db "@" PrintItemUseTextAndRemoveItem: - ld hl,ItemUseText00 + ld hl, ItemUseText00 call PrintText - ld a,SFX_HEAL_AILMENT + ld a, SFX_HEAL_AILMENT call PlaySound call WaitForTextScrollButtonPress ; wait for button press RemoveUsedItem: - ld hl,wNumBagItems - ld a,1 ; one item - ld [wItemQuantity],a + ld hl, wNumBagItems + ld a, 1 ; one item + ld [wItemQuantity], a jp RemoveItemFromInventory ItemUseNoEffect: - ld hl,ItemUseNoEffectText + ld hl, ItemUseNoEffectText jr ItemUseFailed ItemUseNotTime: - ld hl,ItemUseNotTimeText + ld hl, ItemUseNotTimeText jr ItemUseFailed ItemUseNotYoursToUse: - ld hl,ItemUseNotYoursToUseText + ld hl, ItemUseNotYoursToUseText jr ItemUseFailed +Func_e4bf: + ld a, $2 + ld [wActionResultOrTookBattleTurn], a + ld hl, DontHavePokemonText + jp PrintText + ThrowBallAtTrainerMon: call RunDefaultPaletteCommand call LoadScreenTilesFromBuffer1 ; restore saved screen call Delay3 - ld a,TOSS_ANIM - ld [wAnimationID],a + ld a, TOSS_ANIM + ld [wAnimationID], a predef MoveAnimation ; do animation - ld hl,ThrowBallAtTrainerMonText1 + ld hl, ThrowBallAtTrainerMonText1 call PrintText - ld hl,ThrowBallAtTrainerMonText2 + ld hl, ThrowBallAtTrainerMonText2 call PrintText jr RemoveUsedItem NoCyclingAllowedHere: - ld hl,NoCyclingAllowedHereText + ld hl, NoCyclingAllowedHereText jr ItemUseFailed BoxFullCannotThrowBall: - ld hl,BoxFullCannotThrowBallText + ld hl, BoxFullCannotThrowBallText jr ItemUseFailed SurfingAttemptFailed: - ld hl,NoSurfingHereText + ld hl, NoSurfingHereText ItemUseFailed: xor a - ld [wActionResultOrTookBattleTurn],a ; item use failed + ld [wActionResultOrTookBattleTurn], a ; item use failed jp PrintText ItemUseNotTimeText: @@ -2393,6 +2672,10 @@ BoxFullCannotThrowBallText: TX_FAR _BoxFullCannotThrowBallText db "@" +DontHavePokemonText: + TX_FAR _DontHavePokemonText + db "@" + ItemUseText00: TX_FAR _ItemUseText001 db $05 @@ -2417,37 +2700,37 @@ GotOffBicycleText: ; [wWhichPokemon] = index of pokemon in party ; [wCurrentMenuItem] = index of move (when using a PP Up) RestoreBonusPP: - ld hl,wPartyMon1Moves + ld hl, wPartyMon1Moves ld bc, wPartyMon2 - wPartyMon1 - ld a,[wWhichPokemon] + ld a, [wWhichPokemon] call AddNTimes push hl - ld de,wNormalMaxPPList - 1 + ld de, wNormalMaxPPList - 1 predef LoadMovePPs ; loads the normal max PP of each of the pokemon's moves to wNormalMaxPPList pop hl ld c, wPartyMon1PP - wPartyMon1Moves - ld b,0 - add hl,bc ; hl now points to move 1 PP - ld de,wNormalMaxPPList - ld b,0 ; initialize move counter to zero + ld b, 0 + add hl, bc ; hl now points to move 1 PP + ld de, wNormalMaxPPList + ld b, 0 ; initialize move counter to zero ; loop through the pokemon's moves .loop inc b - ld a,b - cp a,5 ; reached the end of the pokemon's moves? + ld a, b + cp 5 ; reached the end of the pokemon's moves? ret z ; if so, return - ld a,[wUsingPPUp] + ld a, [wUsingPPUp] dec a ; using a PP Up? - jr nz,.skipMenuItemIDCheck + jr nz, .skipMenuItemIDCheck ; if using a PP Up, check if this is the move it's being used on - ld a,[wCurrentMenuItem] + ld a, [wCurrentMenuItem] inc a cp b - jr nz,.nextMove + jr nz, .nextMove .skipMenuItemIDCheck - ld a,[hl] - and a,%11000000 ; have any PP Ups been used? - call nz,AddBonusPP ; if so, add bonus PP + ld a, [hl] + and %11000000 ; have any PP Ups been used? + call nz, AddBonusPP ; if so, add bonus PP .nextMove inc hl inc de @@ -2460,38 +2743,38 @@ RestoreBonusPP: ; [hl] = move PP AddBonusPP: push bc - ld a,[de] ; normal max PP of move - ld [H_DIVIDEND + 3],a + ld a, [de] ; normal max PP of move + ld [H_DIVIDEND + 3], a xor a - ld [H_DIVIDEND],a - ld [H_DIVIDEND + 1],a - ld [H_DIVIDEND + 2],a - ld a,5 - ld [H_DIVISOR],a - ld b,4 + ld [H_DIVIDEND], a + ld [H_DIVIDEND + 1], a + ld [H_DIVIDEND + 2], a + ld a, 5 + ld [H_DIVISOR], a + ld b, 4 call Divide - ld a,[hl] ; move PP - ld b,a + ld a, [hl] ; move PP + ld b, a swap a - and a,%00001111 + and %1111 srl a srl a - ld c,a ; c = number of PP Ups used + ld c, a ; c = number of PP Ups used .loop - ld a,[H_QUOTIENT + 3] - cp a,8 ; is the amount greater than or equal to 8? - jr c,.addAmount - ld a,7 ; cap the amount at 7 + ld a, [H_QUOTIENT + 3] + cp 8 ; is the amount greater than or equal to 8? + jr c, .addAmount + ld a, 7 ; cap the amount at 7 .addAmount add b - ld b,a - ld a,[wUsingPPUp] + ld b, a + ld a, [wUsingPPUp] dec a ; is the player using a PP Up right now? - jr z,.done ; if so, only add the bonus once + jr z, .done ; if so, only add the bonus once dec c - jr nz,.loop + jr nz, .loop .done - ld [hl],b + ld [hl], b pop bc ret @@ -2508,74 +2791,75 @@ AddBonusPP: ; OUTPUT: ; [wMaxPP] = max PP GetMaxPP: - ld a,[wMonDataLocation] + ld a, [wMonDataLocation] and a - ld hl,wPartyMon1Moves - ld bc,wPartyMon2 - wPartyMon1 - jr z,.sourceWithMultipleMon - ld hl,wEnemyMon1Moves + ld hl, wPartyMon1Moves + ld bc, wPartyMon2 - wPartyMon1 + jr z, .sourceWithMultipleMon + ld hl, wEnemyMon1Moves dec a - jr z,.sourceWithMultipleMon - ld hl,wBoxMon1Moves - ld bc,wBoxMon2 - wBoxMon1 + jr z, .sourceWithMultipleMon + ld hl, wBoxMon1Moves + ld bc, wBoxMon2 - wBoxMon1 dec a - jr z,.sourceWithMultipleMon - ld hl,wDayCareMonMoves + jr z, .sourceWithMultipleMon + ld hl, wDayCareMonMoves dec a - jr z,.sourceWithOneMon - ld hl,wBattleMonMoves ; player's in-battle pokemon + jr z, .sourceWithOneMon + ld hl, wBattleMonMoves ; player's in-battle pokemon .sourceWithOneMon call GetSelectedMoveOffset2 jr .next + .sourceWithMultipleMon call GetSelectedMoveOffset .next - ld a,[hl] + ld a, [hl] dec a push hl - ld hl,Moves - ld bc,MoveEnd - Moves + ld hl, Moves + ld bc, MoveEnd - Moves call AddNTimes - ld de,wcd6d - ld a,BANK(Moves) + ld de, wcd6d + ld a, BANK(Moves) call FarCopyData - ld de,wcd6d + 5 ; PP is byte 5 of move data - ld a,[de] - ld b,a ; b = normal max PP + ld de, wcd6d + 5 ; PP is byte 5 of move data + ld a, [de] + ld b, a ; b = normal max PP pop hl push bc - ld bc,wPartyMon1PP - wPartyMon1Moves ; PP offset if not player's in-battle pokemon data - ld a,[wMonDataLocation] - cp a,4 ; player's in-battle pokemon? - jr nz,.addPPOffset - ld bc,wBattleMonPP - wBattleMonMoves ; PP offset if player's in-battle pokemon data + ld bc, wPartyMon1PP - wPartyMon1Moves ; PP offset if not player's in-battle pokemon data + ld a, [wMonDataLocation] + cp 4 ; player's in-battle pokemon? + jr nz, .addPPOffset + ld bc, wBattleMonPP - wBattleMonMoves ; PP offset if player's in-battle pokemon data .addPPOffset - add hl,bc - ld a,[hl] ; a = current PP - and a,%11000000 ; get PP Up count + add hl, bc + ld a, [hl] ; a = current PP + and %11000000 ; get PP Up count pop bc or b ; place normal max PP in 6 lower bits of a - ld h,d - ld l,e + ld h, d + ld l, e inc hl ; hl = wcd73 - ld [hl],a + ld [hl], a xor a ; add the bonus for the existing PP Up count - ld [wUsingPPUp],a + ld [wUsingPPUp], a call AddBonusPP ; add bonus PP from PP Ups - ld a,[hl] - and a,%00111111 ; mask out the PP Up count - ld [wMaxPP],a ; store max PP + ld a, [hl] + and %00111111 ; mask out the PP Up count + ld [wMaxPP], a ; store max PP ret GetSelectedMoveOffset: - ld a,[wWhichPokemon] + ld a, [wWhichPokemon] call AddNTimes GetSelectedMoveOffset2: - ld a,[wCurrentMenuItem] - ld c,a - ld b,0 - add hl,bc + ld a, [wCurrentMenuItem] + ld c, a + ld b, 0 + add hl, bc ret ; confirms the item toss and then tosses the item @@ -2588,49 +2872,50 @@ GetSelectedMoveOffset2: ; clears carry flag if the item is tossed, sets carry flag if not TossItem_: push hl - ld a,[wcf91] + ld a, [wcf91] call IsItemHM pop hl - jr c,.tooImportantToToss + jr c, .tooImportantToToss push hl call IsKeyItem_ - ld a,[wIsKeyItem] + ld a, [wIsKeyItem] pop hl and a - jr nz,.tooImportantToToss + jr nz, .tooImportantToToss push hl - ld a,[wcf91] - ld [wd11e],a + ld a, [wcf91] + ld [wd11e], a call GetItemName call CopyStringToCF4B ; copy name to wcf4b - ld hl,IsItOKToTossItemText + ld hl, IsItOKToTossItemText call PrintText coord hl, 14, 7 lb bc, 8, 15 - ld a,TWO_OPTION_MENU - ld [wTextBoxID],a + ld a, TWO_OPTION_MENU + ld [wTextBoxID], a call DisplayTextBoxID ; yes/no menu - ld a,[wMenuExitMethod] - cp a,CHOSE_SECOND_ITEM + ld a, [wMenuExitMethod] + cp CHOSE_SECOND_ITEM pop hl scf ret z ; return if the player chose No ; if the player chose Yes push hl - ld a,[wWhichPokemon] + ld a, [wWhichPokemon] call RemoveItemFromInventory - ld a,[wcf91] - ld [wd11e],a + ld a, [wcf91] + ld [wd11e], a call GetItemName call CopyStringToCF4B ; copy name to wcf4b - ld hl,ThrewAwayItemText + ld hl, ThrewAwayItemText call PrintText pop hl and a ret + .tooImportantToToss push hl - ld hl,TooImportantToTossText + ld hl, TooImportantToTossText call PrintText pop hl scf @@ -2656,32 +2941,32 @@ TooImportantToTossText: ; 00: item is not key item ; 01: item is key item IsKeyItem_: - ld a,$01 - ld [wIsKeyItem],a - ld a,[wcf91] - cp a,HM_01 ; is the item an HM or TM? - jr nc,.checkIfItemIsHM + ld a, $01 + ld [wIsKeyItem], a + ld a, [wcf91] + cp HM_01 ; is the item an HM or TM? + jr nc, .checkIfItemIsHM ; if the item is not an HM or TM push af - ld hl,KeyItemBitfield - ld de,wBuffer - ld bc,15 ; only 11 bytes are actually used + ld hl, KeyItemBitfield + ld de, wBuffer + ld bc, 15 ; only 11 bytes are actually used call CopyData pop af dec a - ld c,a - ld hl,wBuffer - ld b,FLAG_TEST + ld c, a + ld hl, wBuffer + ld b, FLAG_TEST predef FlagActionPredef - ld a,c + ld a, c and a ret nz .checkIfItemIsHM - ld a,[wcf91] + ld a, [wcf91] call IsItemHM ret c xor a - ld [wIsKeyItem],a + ld [wIsKeyItem], a ret INCLUDE "data/key_items.asm" @@ -2694,7 +2979,7 @@ SendNewMonToBox: ld a, [wcf91] ld [wd0b5], a ld c, a -.asm_e7b1 +.asm_e6f5 inc de ld a, [de] ld b, a @@ -2702,13 +2987,13 @@ SendNewMonToBox: ld c, b ld [de], a cp $ff - jr nz, .asm_e7b1 + jr nz, .asm_e6f5 call GetMonHeader ld hl, wBoxMonOT ld bc, NAME_LENGTH ld a, [wNumInBox] dec a - jr z, .asm_e7ee + jr z, .asm_e732 dec a call AddNTimes push hl @@ -2720,7 +3005,7 @@ SendNewMonToBox: ld a, [wNumInBox] dec a ld b, a -.asm_e7db +.asm_e71f push bc push hl ld bc, NAME_LENGTH @@ -2732,15 +3017,15 @@ SendNewMonToBox: add hl, bc pop bc dec b - jr nz, .asm_e7db -.asm_e7ee + jr nz, .asm_e71f +.asm_e732 ld hl, wPlayerName ld de, wBoxMonOT ld bc, NAME_LENGTH call CopyData ld a, [wNumInBox] dec a - jr z, .asm_e82a + jr z, .asm_e76e ld hl, wBoxMonNicks ld bc, NAME_LENGTH dec a @@ -2754,7 +3039,7 @@ SendNewMonToBox: ld a, [wNumInBox] dec a ld b, a -.asm_e817 +.asm_e75b push bc push hl ld bc, NAME_LENGTH @@ -2766,15 +3051,15 @@ SendNewMonToBox: add hl, bc pop bc dec b - jr nz, .asm_e817 -.asm_e82a + jr nz, .asm_e75b +.asm_e76e ld hl, wBoxMonNicks ld a, NAME_MON_SCREEN ld [wNamingScreenType], a predef AskName ld a, [wNumInBox] dec a - jr z, .asm_e867 + jr z, .asm_e7ab ld hl, wBoxMons ld bc, wBoxMon2 - wBoxMon1 dec a @@ -2788,7 +3073,7 @@ SendNewMonToBox: ld a, [wNumInBox] dec a ld b, a -.asm_e854 +.asm_e798 push bc push hl ld bc, wBoxMon2 - wBoxMon1 @@ -2800,8 +3085,8 @@ SendNewMonToBox: add hl, bc pop bc dec b - jr nz, .asm_e854 -.asm_e867 + jr nz, .asm_e798 +.asm_e7ab ld a, [wEnemyMonLevel] ld [wEnemyMonBoxLevel], a ld hl, wEnemyMon @@ -2831,11 +3116,11 @@ SendNewMonToBox: inc de xor a ld b, NUM_STATS * 2 -.asm_e89f +.asm_e7e3 ld [de], a inc de dec b - jr nz, .asm_e89f + jr nz, .asm_e7e3 ld hl, wEnemyMonDVs ld a, [hli] ld [de], a @@ -2844,12 +3129,18 @@ SendNewMonToBox: ld [de], a ld hl, wEnemyMonPP ld b, NUM_MOVES -.asm_e8b1 +.asm_e7f5 ld a, [hli] inc de ld [de], a dec b - jr nz, .asm_e8b1 + jr nz, .asm_e7f5 + ld a, [wcf91] + cp KADABRA + jr nz, .notKadabra + ld a, $60 ; twistedspoon in gsc + ld [wBoxMon1CatchRate], a +.notKadabra ret ; checks if the tile in front of the player is a shore or water tile @@ -2858,25 +3149,22 @@ SendNewMonToBox: IsNextTileShoreOrWater: ld a, [wCurMapTileset] ld hl, WaterTilesets - ld de,1 - call IsInArray - jr nc, .notShoreOrWater + ld de, 1 + call IsInArray ; does the current map allow surfing? + ret nc ; if not, return + ld hl, WaterTile ld a, [wCurMapTileset] cp SHIP_PORT ; Vermilion Dock tileset - ld a, [wTileInFrontOfPlayer] ; tile in front of player jr z, .skipShoreTiles ; if it's the Vermilion Dock tileset - cp $48 ; eastern shore tile in Safari Zone - jr z, .shoreOrWater - cp $32 ; usual eastern shore tile - jr z, .shoreOrWater + cp GYM ; eastern shore tile in Safari Zone + jr z, .skipShoreTiles + cp DOJO ; usual eastern shore tile + jr z, .skipShoreTiles + ld hl, ShoreTiles .skipShoreTiles - cp $14 ; water tile - jr z, .shoreOrWater -.notShoreOrWater - scf - ret -.shoreOrWater - and a + ld a, [wTileInFrontOfPlayer] + ld de, $1 + call IsInArray ret ; tilesets with water @@ -2884,52 +3172,12 @@ WaterTilesets: db OVERWORLD, FOREST, DOJO, GYM, SHIP, SHIP_PORT, CAVERN, FACILITY, PLATEAU db $ff ; terminator -ReadSuperRodData: -; return e = 2 if no fish on this map -; return e = 1 if a bite, bc = level,species -; return e = 0 if no bite - ld a, [wCurMap] - ld de, 3 ; each fishing group is three bytes wide - ld hl, SuperRodData - call IsInArray - jr c, .ReadFishingGroup - ld e, $2 ; $2 if no fishing groups found - ret - -.ReadFishingGroup -; hl points to the fishing group entry in the index - inc hl ; skip map id - - ; read fishing group address - ld a, [hli] - ld h, [hl] - ld l, a - - ld b, [hl] ; how many mons in group - inc hl ; point to data - ld e, $0 ; no bite yet - -.RandomLoop - call Random - srl a - ret c ; 50% chance of no battle - - and %11 ; 2-bit random number - cp b - jr nc, .RandomLoop ; if a is greater than the number of mons, regenerate - - ; get the mon - add a - ld c, a - ld b, $0 - add hl, bc - ld b, [hl] ; level - inc hl - ld c, [hl] ; species - ld e, $1 ; $1 if there's a bite - ret - -INCLUDE "data/super_rod.asm" +; shore tiles +ShoreTiles: + db $48, $32 +WaterTile: + db $14 + db $ff ; terminator ; reloads map view and processes sprite data ; for items that cause the overworld to be displayed @@ -2963,6 +3211,7 @@ FindWildLocationsOfMon: inc hl inc c jr .loop + .done ld a, $ff ; list terminator ld [de], a diff --git a/engine/items/tms.asm b/engine/items/tms.asm index da1b5e72..84770747 100755 --- a/engine/items/tms.asm +++ b/engine/items/tms.asm @@ -11,6 +11,8 @@ CanLearnTM: ld hl, TechnicalMachines .findTMloop ld a, [hli] + cp $ff ; reached terminator? + jr z, .done cp b jr z, .TMfoundLoop inc c @@ -19,6 +21,10 @@ CanLearnTM: pop hl ld b, FLAG_TEST predef_jump FlagActionPredef +.done + pop hl + ld c, 0 + ret ; converts TM/HM number in wd11e into move number ; HMs start at 51 diff --git a/engine/joypad.asm b/engine/joypad.asm index 31e197e2..4126568c 100644 --- a/engine/joypad.asm +++ b/engine/joypad.asm @@ -1,12 +1,48 @@ +ReadJoypad_:: +; Poll joypad input. +; Unlike the hardware register, button +; presses are indicated by a set bit. + ld a, [hDisableJoypadPolling] + and a + ret nz + + ld a, 1 << 5 ; select direction keys + ;ld c, 0 + + ld [rJOYP], a + ld a, [rJOYP] + ld a, [rJOYP] + cpl + and %1111 + swap a + ld b, a + + ld a, 1 << 4 ; select button keys + ld [rJOYP], a + rept 6 + ld a, [rJOYP] + endr + cpl + and %1111 + or b + + ld [hJoyInput], a + + ld a, 1 << 4 + 1 << 5 ; deselect keys + ld [rJOYP], a + ret + + _Joypad:: ; hJoyReleased: (hJoyLast ^ hJoyInput) & hJoyLast ; hJoyPressed: (hJoyLast ^ hJoyInput) & hJoyInput ld a, [hJoyInput] + ld b,a + and $4F cp A_BUTTON + B_BUTTON + SELECT + START ; soft reset jp z, TrySoftReset - ld b, a ld a, [hJoyLast] ld e, a xor b diff --git a/engine/learn_move.asm b/engine/learn_move.asm index 5fa6df08..dcaf4235 100755 --- a/engine/learn_move.asm +++ b/engine/learn_move.asm @@ -121,18 +121,17 @@ TryingToLearn: ld hl, WhichMoveToForgetText call PrintText coord hl, 4, 7 - ld b, 4 - ld c, 14 + lb bc, 4, 14 call TextBoxBorder coord hl, 6, 8 ld de, wMovesString - ld a, [hFlags_0xFFF6] + ld a, [hFlags_0xFFFA] set 2, a - ld [hFlags_0xFFF6], a + ld [hFlags_0xFFFA], a call PlaceString - ld a, [hFlags_0xFFF6] + ld a, [hFlags_0xFFFA] res 2, a - ld [hFlags_0xFFF6], a + ld [hFlags_0xFFFA], a ld hl, wTopMenuItemY ld a, 8 ld [hli], a ; wTopMenuItemY @@ -146,10 +145,10 @@ TryingToLearn: ld a, A_BUTTON | B_BUTTON ld [hli], a ; wMenuWatchedKeys ld [hl], 0 ; wLastMenuItem - ld hl, hFlags_0xFFF6 + ld hl, hFlags_0xFFFA set 1, [hl] call HandleMenuInput - ld hl, hFlags_0xFFF6 + ld hl, hFlags_0xFFFA res 1, [hl] push af call LoadScreenTilesFromBuffer1 @@ -204,11 +203,36 @@ TryingToLearnText: db "@" OneTwoAndText: +; bugfix: In Red/Blue, the SFX_SWAP sound was played in the wrong bank, which played an incorrect sound +; Yellow has fixed this by swapping to the correct bank TX_FAR _OneTwoAndText db $a TX_ASM + push af + push bc + push de + push hl + ld a, $1 + ld [wMuteAudioAndPauseMusic], a + call DelayFrame + ld a, [wAudioROMBank] + push af + ld a, BANK(SFX_Swap_1) + ld [wAudioROMBank], a + ld [wAudioSavedROMBank], a + call WaitForSoundToFinish ld a, SFX_SWAP - call PlaySoundWaitForCurrent + call PlaySound + call WaitForSoundToFinish + pop af + ld [wAudioROMBank], a + ld [wAudioSavedROMBank], a + xor a + ld [wMuteAudioAndPauseMusic], a + pop hl + pop de + pop bc + pop af ld hl, PoofText ret diff --git a/engine/load_mon_data.asm b/engine/load_mon_data.asm new file mode 100644 index 00000000..e708113f --- /dev/null +++ b/engine/load_mon_data.asm @@ -0,0 +1,68 @@ +LoadMonData_: +; Load monster [wWhichPokemon] from list [wMonDataLocation]: +; 0: partymon +; 1: enemymon +; 2: boxmon +; 3: daycaremon +; Return monster id at wcf91 and its data at wLoadedMon. +; Also load base stats at wMonHeader for convenience. + + ld a, [wDayCareMonSpecies] + ld [wcf91], a + ld a, [wMonDataLocation] + cp DAYCARE_DATA + jr z, .GetMonHeader + + ld a, [wWhichPokemon] + ld e, a + call GetMonSpecies + +.GetMonHeader + ld a, [wcf91] + ld [wd0b5], a ; input for GetMonHeader + call GetMonHeader + + ld hl, wPartyMons + ld bc, wPartyMon2 - wPartyMon1 + ld a, [wMonDataLocation] + cp ENEMY_PARTY_DATA + jr c, .getMonEntry + + ld hl, wEnemyMons + jr z, .getMonEntry + + cp 2 + ld hl, wBoxMons + ld bc, wBoxMon2 - wBoxMon1 + jr z, .getMonEntry + + ld hl, wDayCareMon + jr .copyMonData + +.getMonEntry + ld a, [wWhichPokemon] + call AddNTimes + +.copyMonData + ld de, wLoadedMon + ld bc, wPartyMon2 - wPartyMon1 + jp CopyData + +; get species of mon e in list [wMonDataLocation] for LoadMonData +GetMonSpecies: + ld hl, wPartySpecies + ld a, [wMonDataLocation] + and a + jr z, .getSpecies + dec a + jr z, .enemyParty + ld hl, wBoxSpecies + jr .getSpecies +.enemyParty + ld hl, wEnemyPartyMons +.getSpecies + ld d, 0 + add hl, de + ld a, [hl] + ld [wcf91], a + ret diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm index f6865b6c..57699b8f 100644 --- a/engine/menu/bills_pc.asm +++ b/engine/menu/bills_pc.asm @@ -11,18 +11,15 @@ DisplayPCMainMenu:: and a jr nz, .leaguePCAvailable coord hl, 0, 0 - ld b, 8 - ld c, 14 + lb bc, 8, 14 jr .next .noOaksPC coord hl, 0, 0 - ld b, 6 - ld c, 14 + lb bc, 6, 14 jr .next .leaguePCAvailable coord hl, 0, 0 - ld b, 10 - ld c, 14 + lb bc, 10, 14 .next call TextBoxBorder call UpdateSprites @@ -119,10 +116,13 @@ BillsPCMenu: lb bc, BANK(PokeballTileGraphics), $01 call CopyVideoData call LoadScreenTilesFromBuffer2DisableBGTransfer + coord hl, 0, 12 + lb bc, 4, 18 + call TextBoxBorder coord hl, 0, 0 - ld b, 10 - ld c, 12 + lb bc, 12, 12 call TextBoxBorder + call UpdateSprites coord hl, 2, 2 ld de, BillsPCMenuText call PlaceString @@ -133,7 +133,7 @@ BillsPCMenu: ld [hli], a ; wTopMenuItemX inc hl inc hl - ld a, 4 + ld a, 5 ld [hli], a ; wMaxMenuItem ld a, A_BUTTON | B_BUTTON ld [hli], a ; wMenuWatchedKeys @@ -144,11 +144,8 @@ BillsPCMenu: ld [hli], a ; wListScrollOffset ld [hl], a ; wMenuWatchMovingOutOfBounds ld [wPlayerMonNumber], a - ld hl, WhatText - call PrintText coord hl, 9, 14 - ld b, 2 - ld c, 9 + lb bc, 2, 9 call TextBoxBorder ld a, [wCurrentBoxNum] and $7f @@ -184,6 +181,8 @@ BillsPCMenu: jp z, BillsPCRelease ; release cp $3 jp z, BillsPCChangeBox ; change box + cp $4 + jp z, BillsPCPrintBox ExitBillsPC: ld a, [wFlags_0xcd60] @@ -204,6 +203,10 @@ ExitBillsPC: res 6, [hl] ret +BillsPCPrintBox: + callab PrintPCBox + jp BillsPCMenu + BillsPCDeposit: ld a, [wPartyCount] dec a @@ -222,11 +225,26 @@ BillsPCDeposit: ld hl, wPartyCount call DisplayMonListMenu jp c, BillsPCMenu + callab IsThisPartymonStarterPikachu_Party + jr nc, .asm_215ad + call CheckPikachuFollowingPlayer + jr z, .asm_215ad + ld hl, SleepingPikachuText2 + call PrintText + jp BillsPCMenu +.asm_215ad call DisplayDepositWithdrawMenu jp nc, BillsPCMenu + callab IsThisPartymonStarterPikachu_Party + jr nc, .asm_215c9 + ld e, $1b + callab PlayPikachuSoundClip + jr .asm_215cf +.asm_215c9 ld a, [wcf91] - call GetCryData - call PlaySoundWaitForCurrent + call PlayCry +.asm_215cf + callabd_ModifyPikachuHappiness PIKAHAPPY_DEPOSITED ld a, PARTY_TO_BOX ld [wMoveMonType], a call MoveMon @@ -236,7 +254,7 @@ BillsPCDeposit: call WaitForSoundToFinish ld hl, wBoxNumString ld a, [wCurrentBoxNum] - and $7f + and " " cp 9 jr c, .singleDigitBoxNum sub 9 @@ -248,11 +266,15 @@ BillsPCDeposit: add "1" .next ld [hli], a - ld [hl], $50 + ld [hl], "@" ld hl, MonWasStoredText call PrintText jp BillsPCMenu +SleepingPikachuText2: + TX_FAR _SleepingPikachuText2 + db "@" + BillsPCWithdraw: ld a, [wNumInBox] and a @@ -276,9 +298,15 @@ BillsPCWithdraw: ld a, [wWhichPokemon] ld hl, wBoxMonNicks call GetPartyMonName + callab IsThisPartymonStarterPikachu_Box + jr nc, .asm_21660 + ld e, $22 + callab PlayPikachuSoundClip + jr .asm_21666 +.asm_21660 ld a, [wcf91] - call GetCryData - call PlaySoundWaitForCurrent + call PlayCry +.asm_21666 xor a ; BOX_TO_PARTY ld [wMoveMonType], a call MoveMon @@ -301,6 +329,8 @@ BillsPCRelease: ld hl, wNumInBox call DisplayMonListMenu jp c, BillsPCMenu + callab IsThisPartymonStarterPikachu_Box + jr c, .asm_216cb ld hl, OnceReleasedText call PrintText call YesNoChoice @@ -317,6 +347,16 @@ BillsPCRelease: call PrintText jp BillsPCMenu +.asm_216cb + ld a, [wWhichPokemon] + ld hl, wBoxMonNicks + call GetPartyMonName + ld e, $27 + callab PlayPikachuSoundClip + ld hl, PikachuUnhappyText + call PrintText + jp BillsPCMenu + BillsPCChangeBox: callba ChangeBox jp BillsPCMenu @@ -343,6 +383,7 @@ BillsPCMenuText: next "DEPOSIT ", $4a next "RELEASE ", $4a next "CHANGE BOX" + next "PRINT BOX" next "SEE YA!" db "@" @@ -382,12 +423,11 @@ HMMoveArray: db SURF db STRENGTH db FLASH - db -1 + db $ff DisplayDepositWithdrawMenu: coord hl, 9, 10 - ld b, 6 - ld c, 9 + lb bc, 6, 9 call TextBoxBorder ld a, [wParentMenuItem] and a ; was the Deposit or Withdraw item selected in the parent menu? @@ -493,6 +533,10 @@ CantTakeMonText: TX_FAR _CantTakeMonText db "@" +PikachuUnhappyText: + TX_FAR _PikachuUnhappyText + db "@" + ReleaseWhichMonText: TX_FAR _ReleaseWhichMonText db "@" @@ -509,7 +553,7 @@ CableClubLeftGameboy:: ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK ret z - ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction + ld a, [wPlayerFacingDirection] ; player's sprite facing direction cp SPRITE_FACING_RIGHT ret nz ld a, [wCurMap] @@ -526,7 +570,7 @@ CableClubRightGameboy:: ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK ret z - ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction + ld a, [wPlayerFacingDirection] ; player's sprite facing direction cp SPRITE_FACING_LEFT ret nz ld a, [wCurMap] @@ -543,7 +587,7 @@ JustAMomentText:: TX_FAR _JustAMomentText db "@" - ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction + ld a, [wPlayerFacingDirection] ; player's sprite facing direction cp SPRITE_FACING_UP ret nz call EnableAutoTextBoxDrawing @@ -551,4 +595,3 @@ JustAMomentText:: OpenBillsPCText:: db $FD ; FuncTX_BillsPC - diff --git a/engine/menu/diploma.asm b/engine/menu/diploma.asm deleted file mode 100755 index 09ba123e..00000000 --- a/engine/menu/diploma.asm +++ /dev/null @@ -1,113 +0,0 @@ -DisplayDiploma: - call SaveScreenTilesToBuffer2 - call GBPalWhiteOutWithDelay3 - call ClearScreen - xor a - ld [wUpdateSpritesEnabled], a - ld hl, wd730 - set 6, [hl] - call DisableLCD - ld hl, CircleTile - ld de, vChars2 + $700 - ld bc, $0010 - ld a, BANK(CircleTile) - call FarCopyData2 - coord hl, 0, 0 - lb bc, 16, 18 - predef Diploma_TextBoxBorder - ld hl, DiplomaTextPointersAndCoords - ld c, $5 -.asm_56715 - push bc - ld a, [hli] - ld e, a - ld a, [hli] - ld d, a - ld a, [hli] - push hl - ld h, [hl] - ld l, a - call PlaceString - pop hl - inc hl - pop bc - dec c - jr nz, .asm_56715 - coord hl, 10, 4 - ld de, wPlayerName - call PlaceString - callba DrawPlayerCharacter - -; Move the player 33 pixels right and set the priority bit so he appears -; behind the background layer. - ld hl, wOAMBuffer + $01 - lb bc, $80, $28 -.adjustPlayerGfxLoop - ld a, [hl] ; X - add 33 - ld [hli], a - inc hl - ld a, b - ld [hli], a ; attributes - inc hl - dec c - jr nz, .adjustPlayerGfxLoop - - call EnableLCD - callba LoadTrainerInfoTextBoxTiles - ld b, SET_PAL_GENERIC - call RunPaletteCommand - call Delay3 - call GBPalNormal - ld a, $90 - ld [rOBP0], a - call WaitForTextScrollButtonPress - ld hl, wd730 - res 6, [hl] - call GBPalWhiteOutWithDelay3 - call RestoreScreenTilesAndReloadTilePatterns - call Delay3 - jp GBPalNormal - -UnusedPlayerNameLengthFunc: -; Unused function that does a calculation involving the length of the player's -; name. - ld hl, wPlayerName - ld bc, $ff00 -.loop - ld a, [hli] - cp "@" - ret z - dec c - jr .loop - -DiplomaTextPointersAndCoords: - dw DiplomaText - dwCoord 5, 2 - dw DiplomaPlayer - dwCoord 3, 4 - dw DiplomaEmptyText - dwCoord 15, 4 - dw DiplomaCongrats - dwCoord 2, 6 - dw DiplomaGameFreak - dwCoord 9, 16 - -DiplomaText: - db $70,"Diploma",$70,"@" - -DiplomaPlayer: - db "Player@" - -DiplomaEmptyText: - db "@" - -DiplomaCongrats: - db "Congrats! This" - next "diploma certifies" - next "that you have" - next "completed your" - next "#DEX.@" - -DiplomaGameFreak: - db "GAME FREAK@" diff --git a/engine/menu/diploma_1.asm b/engine/menu/diploma_1.asm new file mode 100644 index 00000000..3f309bd2 --- /dev/null +++ b/engine/menu/diploma_1.asm @@ -0,0 +1,17 @@ +DisplayDiploma: + call SaveScreenTilesToBuffer2 + call GBPalWhiteOutWithDelay3 + call ClearScreen + xor a + ld [wUpdateSpritesEnabled], a + ld hl, wd730 + set 6, [hl] + callab _DisplayDiploma + call WaitForTextScrollButtonPress + ld hl, wd730 + res 6, [hl] + call GBPalWhiteOutWithDelay3 + call ReloadTilesetTilePatterns + call RestoreScreenTilesAndReloadTilePatterns + call Delay3 + jp GBPalNormal diff --git a/engine/menu/league_pc.asm b/engine/menu/league_pc.asm index 170c0ef3..9946b90d 100755 --- a/engine/menu/league_pc.asm +++ b/engine/menu/league_pc.asm @@ -100,8 +100,7 @@ LeaguePCShowMon: call LoadFrontSpriteByMonIndex call GBPalNormal coord hl, 0, 13 - ld b, 2 - ld c, $12 + lb bc, 2, 18 call TextBoxBorder coord hl, 1, 15 ld de, HallOfFameNoText @@ -110,7 +109,7 @@ LeaguePCShowMon: ld de, wHoFTeamNo lb bc, 1, 3 call PrintNumber - jpba HoFDisplayMonInfo + jpba Func_7033f HallOfFameNoText: db "HALL OF FAME No @" diff --git a/engine/menu/link_menu.asm b/engine/menu/link_menu.asm new file mode 100644 index 00000000..458f653b --- /dev/null +++ b/engine/menu/link_menu.asm @@ -0,0 +1,910 @@ +Func_f531b:: + ld c,$14 + call DelayFrames + ld a,$1 + ld [wBuffer],a + xor a + ld [wUnknownSerialFlag_d499],a + coord hl, 0,0 + lb bc, 4, 5 + call TextBoxBorder + ld de,Text_f5791 + coord hl, 1,2 + call PlaceString + coord hl, 8,0 + lb bc, 8, 10 + call TextBoxBorder + coord hl, 10,2 + ld de,Text_f579c + call PlaceString + coord hl, 0,10 + lb bc, 6, 18 + call TextBoxBorder + call UpdateSprites + xor a + ld [wUnusedCD37],a + ld [wd72d],a + ld [wd11e],a + ld hl,wTopMenuItemY + ld a,$2 + ld [hli],a + ld a,$9 + ld [hli],a + xor a + ld [hli],a + inc hl + ld a,$3 + ld [hli],a + ld a,$3 + ld [hli],a + xor a + ld [hl],a +.asm_f5377 + call Func_f56bd + call HandleMenuInput + and $3 + add a + add a + ld b,a + ld a,[wCurrentMenuItem] + cp $3 + jr nz,.asm_f5390 + bit 2,b + jr z,.asm_f5390 + dec a + ld b,$8 +.asm_f5390 + add b + add $c0 + ld [wLinkMenuSelectionSendBuffer],a + ld [wLinkMenuSelectionSendBuffer+1],a +.asm_f5399 + ld hl,wLinkMenuSelectionSendBuffer + ld a,[hl] + ld [hSerialSendData],a + call Serial_ExchangeByte + push af + ld hl,wLinkMenuSelectionSendBuffer + ld a,[hl] + ld [hSerialSendData],a + call Serial_ExchangeByte + pop bc + cp b + jr nz,.asm_f5399 + and $f0 + cp $c0 + jr nz,.asm_f5399 + ld a,b + and $c + jr nz,.asm_f53c4 + ld a,[wLinkMenuSelectionSendBuffer] + and $c + jr z,.asm_f5377 + jr .asm_f53df +.asm_f53c4 + ld a,[wLinkMenuSelectionSendBuffer] + and $c + jr z,.asm_f53d1 + ld a,[hSerialConnectionStatus] + cp $2 + jr z,.asm_f53df +.asm_f53d1 + ld a,$1 + ld [wd11e],a + ld a,b + ld [wLinkMenuSelectionSendBuffer],a + and $3 + ld [wCurrentMenuItem],a +.asm_f53df + call DelayFrame + call DelayFrame + ld hl,wLinkMenuSelectionSendBuffer + ld a,[hl] + ld [hSerialSendData],a + call Serial_ExchangeByte + call Serial_ExchangeByte + ld b,$14 +.loop + call DelayFrame + call Serial_SendZeroByte + dec b + jr nz,.loop + ld b,$7f + ld c,$7f + ld d,$7f + ld e,$ec + ld a,[wLinkMenuSelectionSendBuffer] + bit 3,a + jr nz,.asm_f541a + ld b,e + ld e,c + ld a,[wCurrentMenuItem] + and a + jr z,.asm_f541a + ld c,b + ld b,d + dec a + jr z,.asm_f541a + ld d,c + ld c,b +.asm_f541a + ld a,b + Coorda 9,2 + ld a,c + Coorda 9,4 + ld a,d + Coorda 9,6 + ld a,e + Coorda 9,8 + ld c,40 + call DelayFrames + ld a,[wLinkMenuSelectionSendBuffer] + bit 3,a + jr nz,asm_f547f + ld a,[wCurrentMenuItem] + cp $3 + jr z,asm_f547f + inc a + ld [wUnknownSerialFlag_d499],a + ld a,[wCurrentMenuItem] + ld hl,PointerTable_f5488 + ld c,a + ld b,$0 + add hl,bc + add hl,bc + ld a,[hli] + ld h,[hl] + ld l,a + ld de,.returnaddress + push de + jp hl +.returnaddress + ld [wLinkMenuSelectionSendBuffer],a + xor a + ld [wUnknownSerialCounter],a + ld [wUnknownSerialCounter+1],a + call Serial_SyncAndExchangeNybble + ld a,[wLinkMenuSelectionSendBuffer] + and a + jr nz,asm_f547c + ld a, [wLinkMenuSelectionReceiveBuffer] + and a + jr nz, Func_f5476 + xor a + ld [wUnknownSerialCounter],a + ld [wUnknownSerialCounter+1],a + and a + ret + +Func_f5476:: + ld hl,ColosseumIneligibleText + call PrintText +asm_f547c:: + jp Func_f531b + +asm_f547f:: + xor a + ld [wUnknownSerialCounter],a + ld [wUnknownSerialCounter+1],a + scf + ret + +PointerTable_f5488:: + dw PokeCup + dw PikaCup + dw PetitCup + +PokeCup:: + ld hl,wPartyCount + ld a,[hli] + cp $3 + jp nz,NotThreeMonsInParty + ld b,$3 +.loop + ld a,[hli] + cp MEW + jp z,MewInParty + dec b + jr nz,.loop + dec hl + dec hl + cp [hl] ; is third mon second mon? + jp z,DuplicateSpecies + dec hl ; wPartySpecies + cp [hl] ; is third mon first mon? + jp z,DuplicateSpecies + ld a,[hli] + cp [hl] ; is first mon second mon? + jp z,DuplicateSpecies + ld a,[wPartyMon1Level] + cp 56 + jp nc,LevelAbove55 + cp 50 + jp c,LevelUnder50 + ld b,a + ld a,[wPartyMon2Level] + cp 56 + jp nc,LevelAbove55 + cp 50 + jp c,LevelUnder50 + ld c,a + ld a,[wPartyMon3Level] + cp 56 + jp nc,LevelAbove55 + cp 50 + jp c,LevelUnder50 + add b + add c + cp 156 + jp nc,CombinedLevelsGreaterThan155 + xor a + ret + +PikaCup:: + ld hl,wPartyCount + ld a,[hli] + cp $3 + jp nz,NotThreeMonsInParty + ld b,$3 +.loop + ld a,[hli] ; wPartySpecies + cp MEW + jp z,MewInParty + dec b + jr nz,.loop + dec hl + dec hl + cp [hl] ; is third mon second mon? + jp z,DuplicateSpecies + dec hl ; wPartySpecies + cp [hl] ; is third mon first mon? + jp z,DuplicateSpecies + ld a,[hli] + cp [hl] ; is first mon second mon? + jp z,DuplicateSpecies + ld a,[wPartyMon1Level] + cp 21 + jp nc,LevelAbove20 + cp 15 + jp c,LevelUnder15 + ld b,a + ld a,[wPartyMon2Level] + cp 21 + jp nc,LevelAbove20 + cp 15 + jp c,LevelUnder15 + ld c,a + ld a,[wPartyMon3Level] + cp 21 + jp nc,LevelAbove20 + cp 15 + jp c,LevelUnder15 + add b + add c + cp 51 + jp nc,CombinedLevelsAbove50 + xor a + ret + +PetitCup:: + ld hl,wPartyCount + ld a,[hli] + cp $3 + jp nz,NotThreeMonsInParty + ld b,$3 +.loop + ld a,[hli] + cp MEW + jp z,MewInParty + dec b + jr nz,.loop + dec hl + dec hl + cp [hl] ; is third mon second mon? + jp z,DuplicateSpecies + dec hl ; wPartySpecies + cp [hl] ; is third mon first mon? + jp z,DuplicateSpecies + ld a,[hli] + cp [hl] ; is first mon second mon? + jp z,DuplicateSpecies + dec hl + ld a,[hl] + ld [wcf91],a + push hl + callab Func_3b10f + pop hl + jp c,asm_f56ad + inc hl + ld a,[hl] + ld [wcf91],a + push hl + callab Func_3b10f + pop hl + jp c,asm_f56ad + inc hl + ld a,[hl] + ld [wcf91],a + push hl + callab Func_3b10f + pop hl + jp c,asm_f56ad + dec hl + dec hl + ld b,$3 +.bigloop + ld a,[hli] + push hl + push bc + push af + dec a + ld c,a + ld b,$0 + ld hl,PokedexEntryPointers + add hl,bc + add hl,bc + ld de,wcd6d + ld bc,$2 + ld a,BANK(PokedexEntryPointers) + call FarCopyData + ld hl,wcd6d + ld a,[hli] + ld h,[hl] + ld l,a + ld de,wcd6d + ld bc,$14 + ld a,BANK(PokedexEntryPointers) + call FarCopyData + ld hl,wcd6d +.loop2 + ld a,[hli] + cp "@" + jr nz,.loop2 + ld a,[hli] + cp $7 + jp nc,asm_f5689 + add a + add a + ld b,a + add a + add b + ld b,a + ld a,[hli] + add b + cp $51 + jp nc,asm_f5689 + ld a,[hli] + sub $b9 + ld a,[hl] + sbc $1 + jp nc,asm_f569b + pop af + pop bc + pop hl + dec b + jr nz,.bigloop + ld a,[wPartyMon1Level] + cp 31 + jp nc,LevelAbove30 + cp 25 + jp c,LevelUnder25 + ld b,a + ld a,[wPartyMon2Level] + cp 31 + jp nc,LevelAbove30 + cp 25 + jp c,LevelUnder25 + ld c,a + ld a,[wPartyMon3Level] + cp 31 + jp nc,LevelAbove30 + cp 25 + jp c,LevelUnder25 + add b + add c + cp 81 + jp nc,CombinedLevelsAbove80 + xor a + ret + +NotThreeMonsInParty:: + ld hl,Colosseum3MonsText + call PrintText + ld a,$1 + ret + +MewInParty:: + ld hl,ColosseumMewText + call PrintText + ld a,$2 + ret + +DuplicateSpecies:: + ld hl,ColosseumDifferentMonsText + call PrintText + ld a,$3 + ret + +LevelAbove55:: + ld hl,ColosseumMaxL55Text + call PrintText + ld a,$4 + ret + +LevelUnder50:: + ld hl,ColosseumMinL50Text + call PrintText + ld a,$5 + ret + +CombinedLevelsGreaterThan155:: + ld hl,ColosseumTotalL155Text + call PrintText + ld a,$6 + ret + +LevelAbove30:: + ld hl,ColosseumMaxL30Text + call PrintText + ld a,$7 + ret + +LevelUnder25:: + ld hl,ColosseumMinL25Text + call PrintText + ld a,$8 + ret + +CombinedLevelsAbove80:: + ld hl,ColosseumTotalL80Text + call PrintText + ld a,$9 + ret + +LevelAbove20:: + ld hl,ColosseumMaxL20Text + call PrintText + ld a,$a + ret + +LevelUnder15:: + ld hl,ColosseumMinL15Text + call PrintText + ld a,$b + ret + +CombinedLevelsAbove50:: + ld hl,ColosseumTotalL50Text + call PrintText + ld a,$c + ret + +asm_f5689:: + pop af + pop bc + pop hl + ld [wd11e],a + call GetMonName + ld hl,ColosseumHeightText + call PrintText + ld a,$d + ret + +asm_f569b:: + pop af + pop bc + pop hl + ld [wd11e],a + call GetMonName + ld hl,ColosseumWeightText + call PrintText + ld a,$e + ret + +asm_f56ad:: + ld a,[hl] + ld [wd11e],a + call GetMonName + ld hl,ColosseumEvolvedText + call PrintText + ld a,$f + ret + +Func_f56bd:: + xor a + ld [H_AUTOBGTRANSFERENABLED],a + coord hl, 1,11 + lb bc, 6, 18 + call ClearScreenArea + ld a,[wCurrentMenuItem] + cp $3 + jr nc,.asm_f56e6 + ld hl,PointerTable_f56ee + ld a,[wCurrentMenuItem] + ld c,a + ld b,$0 + add hl,bc + add hl,bc + ld a,[hli] + ld h,[hl] + ld l,a + ld d,h + ld e,l + coord hl, 1,12 + call PlaceString +.asm_f56e6 + call Delay3 + ld a,$1 + ld [H_AUTOBGTRANSFERENABLED],a + ret + +PointerTable_f56ee:: + dw Text_f56f4 + dw Text_f5728 + dw Text_f575b + +Text_f56f4:: + db "LVs of 3<pkmn>:50-55" + next "Sum of LVs:155 MAX" + next "MEW can't attend.@" + +Text_f5728:: + db "LVs of 3<pkmn>:15-20" + next "Sum of LVs:50 MAX" + next "MEW can't attend.@" + +Text_f575b:: + db "3 Basic <pkmn>.LV25-30" + next "Sum of LVs:80 MAX" + next "6′8″ and 44lb MAX@" + +Text_f5791:: + db "View" + next "Rules@" + +Text_f579c:: + db "# Cup" + next "Pika Cup" + next "Petit Cup" + next "CANCEL@" + +Colosseum3MonsText:: + TX_FAR _Colosseum3MonsText ; a0a2b + db "@" + +ColosseumMewText:: + TX_FAR _ColosseumMewText ; a0a46 + db "@" + +ColosseumDifferentMonsText:: + TX_FAR _ColosseumDifferentMonsText ; a0a5f + db "@" + +ColosseumMaxL55Text:: + TX_FAR _ColosseumMaxL55Text ; a0a81 + db "@" + +ColosseumMinL50Text:: + TX_FAR _ColosseumMinL50Text ; a0a9a + db "@" + +ColosseumTotalL155Text:: + TX_FAR _ColosseumTotalL155Text ; a0aba + db "@" + +ColosseumMaxL30Text:: + TX_FAR _ColosseumMaxL30Text ; a0ad9 + db "@" + +ColosseumMinL25Text:: + TX_FAR _ColosseumMinL25Text ; a0af2 + db "@" + +ColosseumTotalL80Text:: + TX_FAR _ColosseumTotalL80Text ; a0b12 + db "@" + +ColosseumMaxL20Text:: + TX_FAR _ColosseumMaxL20Text ; a0b30 + db "@" + +ColosseumMinL15Text:: + TX_FAR _ColosseumMinL15Text ; a0b49 + db "@" + +ColosseumTotalL50Text:: + TX_FAR _ColosseumTotalL50Text ; a0b69 + db "@" + +ColosseumHeightText:: + TX_FAR _ColosseumHeightText ; a0b87 + db "@" + +ColosseumWeightText:: + TX_FAR _ColosseumWeightText ; a0b9f + db "@" + +ColosseumEvolvedText:: + TX_FAR _ColosseumEvolvedText ; a0bbb + db "@" + +ColosseumIneligibleText:: + TX_FAR _ColosseumIneligibleText ; a0bd4 + db "@" + +LinkMenu: + xor a + ld [wLetterPrintingDelayFlags], a + ld hl, wd72e + set 6, [hl] + ld hl, TextTerminator_f5a16 + call PrintText + call SaveScreenTilesToBuffer1 + ld hl, ColosseumWhereToText + call PrintText + coord hl, 5, 3 + lb bc, 8, 13 + call TextBoxBorder + call UpdateSprites + coord hl, 7, 5 + ld de, TradeCenterText + call PlaceString + xor a + ld [wUnusedCD37], a + ld [wd72d], a + ld [wd11e], a + ld hl, wTopMenuItemY + ld a, $5 + ld [hli], a + ld a, $6 + ld [hli], a + xor a + ld [hli], a + inc hl + ld a, $3 + ld [hli], a + ld [hli], a + xor a + ld [hl], a +.waitForInputLoop + call HandleMenuInput + and A_BUTTON | B_BUTTON + add a + add a + ld b, a + ld a, [wCurrentMenuItem] + cp $3 + jr nz,.asm_f586b + bit 2,b + jr z,.asm_f586b + dec a + ld b,$8 +.asm_f586b + add b + add $d0 + ld [wLinkMenuSelectionSendBuffer], a + ld [wLinkMenuSelectionSendBuffer + 1], a +.exchangeMenuSelectionLoop + call Serial_ExchangeLinkMenuSelection + ld a, [wLinkMenuSelectionReceiveBuffer] + ld b, a + and $f0 + cp $d0 + jr z, .asm_f5c7d + ld a, [wLinkMenuSelectionReceiveBuffer + 1] + ld b, a + and $f0 + cp $d0 + jr nz, .exchangeMenuSelectionLoop +.asm_f5c7d + ld a, b + and $c ; did the enemy press A or B? + jr nz, .enemyPressedAOrB +; the enemy didn't press A or B + ld a, [wLinkMenuSelectionSendBuffer] + and $c ; did the player press A or B? + jr z, .waitForInputLoop ; if neither the player nor the enemy pressed A or B, try again + jr .doneChoosingMenuSelection ; if the player pressed A or B but the enemy didn't, use the player's selection +.enemyPressedAOrB + ld a, [wLinkMenuSelectionSendBuffer] + and $c ; did the player press A or B? + jr z, .useEnemyMenuSelection ; if the enemy pressed A or B but the player didn't, use the enemy's selection +; the enemy and the player both pressed A or B +; The gameboy that is clocking the connection wins. + ld a, [hSerialConnectionStatus] + cp USING_INTERNAL_CLOCK + jr z, .doneChoosingMenuSelection +.useEnemyMenuSelection + ld a, $1 + ld [wd11e], a + ld a, b + ld [wLinkMenuSelectionSendBuffer], a + and $3 + ld [wCurrentMenuItem], a ; wCurrentMenuItem +.doneChoosingMenuSelection + ld a, [hSerialConnectionStatus] + cp USING_INTERNAL_CLOCK + jr nz, .skipStartingTransfer + call DelayFrame + call DelayFrame + ld a, START_TRANSFER_INTERNAL_CLOCK + ld [rSC], a +.skipStartingTransfer + ld b, " " + ld c, " " + ld d, " " + ld e, "▷" + ld a, [wLinkMenuSelectionSendBuffer] + and (B_BUTTON << 2) ; was B button pressed? + jr nz, .updateCursorPosition +; A button was pressed + ld a, [wCurrentMenuItem] + cp $2 + jp z, .asm_f5963 + ld b, e + ld e, c + ld a, [wCurrentMenuItem] + and a + jr z, .updateCursorPosition + ld c, b + ld b, d + dec a + jr z, .updateCursorPosition + ld d, c + ld c, b +.updateCursorPosition + call Func_f59ec + call LoadScreenTilesFromBuffer1 + ld a, [wLinkMenuSelectionSendBuffer] + and (B_BUTTON << 2) ; was B button pressed? + jr nz, .choseCancel ; cancel if B pressed + ld a, [wCurrentMenuItem] + cp $2 + jr z, .choseCancel + xor a + ld [wWalkBikeSurfState], a ; start walking + ld a, [wCurrentMenuItem] + and a + ld a, COLOSSEUM + jr nz, .next + ld a, TRADE_CENTER +.next + ld [wd72d], a + ld hl, ColosseumPleaseWaitText + call PrintText + ld c, 50 + call DelayFrames + ld hl, wd732 + res 1, [hl] + ld a, [wDefaultMap] + ld [wDestinationMap], a + callab SpecialWarpIn + ld c, 20 + call DelayFrames + xor a + ld [wMenuJoypadPollCount], a + ld [wSerialExchangeNybbleSendData], a + inc a ; LINK_STATE_IN_CABLE_CLUB + ld [wLinkState], a + ld [wEnteringCableClub], a + jpab SpecialEnterMap +.choseCancel + xor a + ld [wMenuJoypadPollCount], a + call Delay3 + callab CloseLinkConnection + ld hl, ColosseumCanceledText + call PrintText + ld hl, wd72e + res 6, [hl] + ret + +.asm_f5963 + ld a,[wd11e] + and a + jr nz,.asm_f5974 + ld b," " + ld c," " + ld d,"▷" + ld e," " + call Func_f59ec +.asm_f5974 + xor a + ld [wBuffer], a + ld a,$ff + ld [wSerialExchangeNybbleReceiveData],a + ld a, $b + ld [wLinkMenuSelectionSendBuffer], a + ld b,$78 +.loop + ld a,[hSerialConnectionStatus] + cp $2 + call z,DelayFrame + dec b + jr z,.asm_f59b2 + call Serial_ExchangeNybble + call DelayFrame + ld a,[wSerialExchangeNybbleReceiveData] + inc a + jr z,.loop + ld b,$f +.loop2 + call DelayFrame + call Serial_ExchangeNybble + dec b + jr nz,.loop2 + ld b,$f +.loop3 + call DelayFrame + call Serial_SendZeroByte + dec b + jr nz,.loop3 + jr .asm_f59d6 + +.asm_f59b2 + xor a + ld [wUnknownSerialCounter],a + ld [wUnknownSerialCounter+1],a + ld a,[wd11e] + and a + jr z,.asm_f59cd + ld b," " + ld c," " + ld d," " + ld e,"▷" + call Func_f59ec + jp .choseCancel + +.asm_f59cd + ld hl,ColosseumVersionText + call PrintText + jp .choseCancel + +.asm_f59d6 + ld b," " + ld c," " + ld d,"▷" + ld e," " + call Func_f59ec + call Func_f531b + jp c,.choseCancel + ld a,$f0 + jp .next + +Func_f59ec:: + ld a, b + Coorda 6, 5 + ld a, c + Coorda 6, 7 + ld a, d + Coorda 6, 9 + ld a, e + Coorda 6, 11 + ld c, 40 + call DelayFrames + ret + +ColosseumWhereToText: + TX_FAR _ColosseumWhereToText + db "@" + +ColosseumPleaseWaitText: + TX_FAR _ColosseumPleaseWaitText + db "@" + +ColosseumCanceledText: + TX_FAR _ColosseumCanceledText + db "@" + +ColosseumVersionText: + TX_FAR _ColosseumVersionText ; 28:4c47 + db "@" + +TextTerminator_f5a16: + db "@" + +TradeCenterText: + db "TRADE CENTER" + next "COLOSSEUM" + next "COLOSSEUM2" + next "CANCEL@" diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index d3152e4e..cf837a54 100755 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -34,8 +34,7 @@ MainMenu: jr z,.noSaveFile ; there's a save file coord hl, 0, 0 - ld b,6 - ld c,13 + lb bc, 6, 13 call TextBoxBorder coord hl, 2, 2 ld de,ContinueText @@ -43,8 +42,7 @@ MainMenu: jr .next2 .noSaveFile coord hl, 0, 0 - ld b,4 - ld c,13 + lb bc, 4, 13 call TextBoxBorder coord hl, 2, 2 ld de,NewGameText @@ -129,185 +127,29 @@ InitOptions: ld [wLetterPrintingDelayFlags],a ld a,3 ; medium speed ld [wOptions],a + ld a,64 ; audio? + ld [wPrinterSettings], a ret -LinkMenu: - xor a - ld [wLetterPrintingDelayFlags], a - ld hl, wd72e - set 6, [hl] - ld hl, TextTerminator_6b20 - call PrintText - call SaveScreenTilesToBuffer1 - ld hl, WhereWouldYouLikeText - call PrintText - coord hl, 5, 5 - ld b, $6 - ld c, $d - call TextBoxBorder - call UpdateSprites - coord hl, 7, 7 - ld de, CableClubOptionsText - call PlaceString - xor a - ld [wUnusedCD37], a - ld [wd72d], a - ld hl, wTopMenuItemY - ld a, $7 - ld [hli], a - ld a, $6 - ld [hli], a - xor a - ld [hli], a - inc hl - ld a, $2 - ld [hli], a - inc a - ; ld a, A_BUTTON | B_BUTTON - ld [hli], a ; wMenuWatchedKeys - xor a - ld [hl], a -.waitForInputLoop - call HandleMenuInput - and A_BUTTON | B_BUTTON - add a - add a - ld b, a - ld a, [wCurrentMenuItem] - add b - add $d0 - ld [wLinkMenuSelectionSendBuffer], a - ld [wLinkMenuSelectionSendBuffer + 1], a -.exchangeMenuSelectionLoop - call Serial_ExchangeLinkMenuSelection - ld a, [wLinkMenuSelectionReceiveBuffer] - ld b, a - and $f0 - cp $d0 - jr z, .asm_5c7d - ld a, [wLinkMenuSelectionReceiveBuffer + 1] - ld b, a - and $f0 - cp $d0 - jr nz, .exchangeMenuSelectionLoop -.asm_5c7d - ld a, b - and $c ; did the enemy press A or B? - jr nz, .enemyPressedAOrB -; the enemy didn't press A or B - ld a, [wLinkMenuSelectionSendBuffer] - and $c ; did the player press A or B? - jr z, .waitForInputLoop ; if neither the player nor the enemy pressed A or B, try again - jr .doneChoosingMenuSelection ; if the player pressed A or B but the enemy didn't, use the player's selection -.enemyPressedAOrB - ld a, [wLinkMenuSelectionSendBuffer] - and $c ; did the player press A or B? - jr z, .useEnemyMenuSelection ; if the enemy pressed A or B but the player didn't, use the enemy's selection -; the enemy and the player both pressed A or B -; The gameboy that is clocking the connection wins. - ld a, [hSerialConnectionStatus] - cp USING_INTERNAL_CLOCK - jr z, .doneChoosingMenuSelection -.useEnemyMenuSelection - ld a, b - ld [wLinkMenuSelectionSendBuffer], a - and $3 - ld [wCurrentMenuItem], a -.doneChoosingMenuSelection - ld a, [hSerialConnectionStatus] - cp USING_INTERNAL_CLOCK - jr nz, .skipStartingTransfer - call DelayFrame - call DelayFrame - ld a, START_TRANSFER_INTERNAL_CLOCK - ld [rSC], a -.skipStartingTransfer - ld b, $7f - ld c, $7f - ld d, $ec - ld a, [wLinkMenuSelectionSendBuffer] - and (B_BUTTON << 2) ; was B button pressed? - jr nz, .updateCursorPosition -; A button was pressed - ld a, [wCurrentMenuItem] - cp $2 - jr z, .updateCursorPosition - ld c, d - ld d, b - dec a - jr z, .updateCursorPosition - ld b, c - ld c, d -.updateCursorPosition - ld a, b - Coorda 6, 7 - ld a, c - Coorda 6, 9 - ld a, d - Coorda 6, 11 - ld c, 40 - call DelayFrames - call LoadScreenTilesFromBuffer1 - ld a, [wLinkMenuSelectionSendBuffer] - and (B_BUTTON << 2) ; was B button pressed? - jr nz, .choseCancel ; cancel if B pressed - ld a, [wCurrentMenuItem] - cp $2 - jr z, .choseCancel - xor a - ld [wWalkBikeSurfState], a ; start walking - ld a, [wCurrentMenuItem] - and a - ld a, COLOSSEUM - jr nz, .next - ld a, TRADE_CENTER -.next - ld [wd72d], a - ld hl, PleaseWaitText - call PrintText - ld c, 50 - call DelayFrames - ld hl, wd732 - res 1, [hl] - ld a, [wDefaultMap] - ld [wDestinationMap], a - call SpecialWarpIn - ld c, 20 - call DelayFrames - xor a - ld [wMenuJoypadPollCount], a - ld [wSerialExchangeNybbleSendData], a - inc a ; LINK_STATE_IN_CABLE_CLUB - ld [wLinkState], a - ld [wEnteringCableClub], a - jr SpecialEnterMap -.choseCancel - xor a - ld [wMenuJoypadPollCount], a - call Delay3 - call CloseLinkConnection - ld hl, LinkCanceledText +Func_5cc1: +; unused? + ld a, $6d + cp $80 + ret c ; will always be executed + ld hl, NotEnoughMemoryText call PrintText - ld hl, wd72e - res 6, [hl] ret -WhereWouldYouLikeText: - TX_FAR _WhereWouldYouLikeText - db "@" - -PleaseWaitText: - TX_FAR _PleaseWaitText - db "@" - -LinkCanceledText: - TX_FAR _LinkCanceledText +NotEnoughMemoryText: + TX_FAR _NotEnoughMemoryText db "@" StartNewGame: ld hl, wd732 res 1, [hl] call OakSpeech + ld a, $8 + ld [wPlayerMovingDirection], a ld c, 20 call DelayFrames @@ -323,6 +165,7 @@ SpecialEnterMap: call ResetPlayerSpriteData ld c, 20 call DelayFrames + call Func_5cc1 ld a, [wEnteringCableClub] and a ret nz @@ -335,17 +178,11 @@ NewGameText: db "NEW GAME", $4e db "OPTION@" -CableClubOptionsText: - db "TRADE CENTER", $4e - db "COLOSSEUM", $4e - db "CANCEL@" - DisplayContinueGameInfo: xor a ld [H_AUTOBGTRANSFERENABLED], a coord hl, 4, 7 - ld b, 8 - ld c, 14 + lb bc, 8, 14 call TextBoxBorder coord hl, 5, 9 ld de, SaveScreenInfoText @@ -368,8 +205,7 @@ PrintSaveScreenText: xor a ld [H_AUTOBGTRANSFERENABLED], a coord hl, 4, 0 - ld b, $8 - ld c, $e + lb bc, 8, 14 call TextBoxBorder call LoadTextBoxTilePatterns call UpdateSprites @@ -427,260 +263,9 @@ SaveScreenInfoText: next "TIME@" DisplayOptionMenu: - coord hl, 0, 0 - ld b,3 - ld c,18 - call TextBoxBorder - coord hl, 0, 5 - ld b,3 - ld c,18 - call TextBoxBorder - coord hl, 0, 10 - ld b,3 - ld c,18 - call TextBoxBorder - coord hl, 1, 1 - ld de,TextSpeedOptionText - call PlaceString - coord hl, 1, 6 - ld de,BattleAnimationOptionText - call PlaceString - coord hl, 1, 11 - ld de,BattleStyleOptionText - call PlaceString - coord hl, 2, 16 - ld de,OptionMenuCancelText - call PlaceString - xor a - ld [wCurrentMenuItem],a - ld [wLastMenuItem],a - inc a - ld [wLetterPrintingDelayFlags],a - ld [wUnusedCD40],a - ld a,3 ; text speed cursor Y coordinate - ld [wTopMenuItemY],a - call SetCursorPositionsFromOptions - ld a,[wOptionsTextSpeedCursorX] ; text speed cursor X coordinate - ld [wTopMenuItemX],a - ld a,$01 - ld [H_AUTOBGTRANSFERENABLED],a ; enable auto background transfer - call Delay3 -.loop - call PlaceMenuCursor - call SetOptionsFromCursorPositions -.getJoypadStateLoop - call JoypadLowSensitivity - ld a,[hJoy5] - ld b,a - and a,A_BUTTON | B_BUTTON | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ; any key besides select pressed? - jr z,.getJoypadStateLoop - bit 1,b ; B button pressed? - jr nz,.exitMenu - bit 3,b ; Start button pressed? - jr nz,.exitMenu - bit 0,b ; A button pressed? - jr z,.checkDirectionKeys - ld a,[wTopMenuItemY] - cp a,16 ; is the cursor on Cancel? - jr nz,.loop -.exitMenu - ld a,SFX_PRESS_AB - call PlaySound - ret -.eraseOldMenuCursor - ld [wTopMenuItemX],a - call EraseMenuCursor - jp .loop -.checkDirectionKeys - ld a,[wTopMenuItemY] - bit 7,b ; Down pressed? - jr nz,.downPressed - bit 6,b ; Up pressed? - jr nz,.upPressed - cp a,8 ; cursor in Battle Animation section? - jr z,.cursorInBattleAnimation - cp a,13 ; cursor in Battle Style section? - jr z,.cursorInBattleStyle - cp a,16 ; cursor on Cancel? - jr z,.loop -.cursorInTextSpeed - bit 5,b ; Left pressed? - jp nz,.pressedLeftInTextSpeed - jp .pressedRightInTextSpeed -.downPressed - cp a,16 - ld b,-13 - ld hl,wOptionsTextSpeedCursorX - jr z,.updateMenuVariables - ld b,5 - cp a,3 - inc hl - jr z,.updateMenuVariables - cp a,8 - inc hl - jr z,.updateMenuVariables - ld b,3 - inc hl - jr .updateMenuVariables -.upPressed - cp a,8 - ld b,-5 - ld hl,wOptionsTextSpeedCursorX - jr z,.updateMenuVariables - cp a,13 - inc hl - jr z,.updateMenuVariables - cp a,16 - ld b,-3 - inc hl - jr z,.updateMenuVariables - ld b,13 - inc hl -.updateMenuVariables - add b - ld [wTopMenuItemY],a - ld a,[hl] - ld [wTopMenuItemX],a - call PlaceUnfilledArrowMenuCursor - jp .loop -.cursorInBattleAnimation - ld a,[wOptionsBattleAnimCursorX] ; battle animation cursor X coordinate - xor a,$0b ; toggle between 1 and 10 - ld [wOptionsBattleAnimCursorX],a - jp .eraseOldMenuCursor -.cursorInBattleStyle - ld a,[wOptionsBattleStyleCursorX] ; battle style cursor X coordinate - xor a,$0b ; toggle between 1 and 10 - ld [wOptionsBattleStyleCursorX],a - jp .eraseOldMenuCursor -.pressedLeftInTextSpeed - ld a,[wOptionsTextSpeedCursorX] ; text speed cursor X coordinate - cp a,1 - jr z,.updateTextSpeedXCoord - cp a,7 - jr nz,.fromSlowToMedium - sub a,6 - jr .updateTextSpeedXCoord -.fromSlowToMedium - sub a,7 - jr .updateTextSpeedXCoord -.pressedRightInTextSpeed - ld a,[wOptionsTextSpeedCursorX] ; text speed cursor X coordinate - cp a,14 - jr z,.updateTextSpeedXCoord - cp a,7 - jr nz,.fromFastToMedium - add a,7 - jr .updateTextSpeedXCoord -.fromFastToMedium - add a,6 -.updateTextSpeedXCoord - ld [wOptionsTextSpeedCursorX],a ; text speed cursor X coordinate - jp .eraseOldMenuCursor - -TextSpeedOptionText: - db "TEXT SPEED" - next " FAST MEDIUM SLOW@" - -BattleAnimationOptionText: - db "BATTLE ANIMATION" - next " ON OFF@" - -BattleStyleOptionText: - db "BATTLE STYLE" - next " SHIFT SET@" - -OptionMenuCancelText: - db "CANCEL@" - -; sets the options variable according to the current placement of the menu cursors in the options menu -SetOptionsFromCursorPositions: - ld hl,TextSpeedOptionData - ld a,[wOptionsTextSpeedCursorX] ; text speed cursor X coordinate - ld c,a -.loop - ld a,[hli] - cp c - jr z,.textSpeedMatchFound - inc hl - jr .loop -.textSpeedMatchFound - ld a,[hl] - ld d,a - ld a,[wOptionsBattleAnimCursorX] ; battle animation cursor X coordinate - dec a - jr z,.battleAnimationOn -.battleAnimationOff - set 7,d - jr .checkBattleStyle -.battleAnimationOn - res 7,d -.checkBattleStyle - ld a,[wOptionsBattleStyleCursorX] ; battle style cursor X coordinate - dec a - jr z,.battleStyleShift -.battleStyleSet - set 6,d - jr .storeOptions -.battleStyleShift - res 6,d -.storeOptions - ld a,d - ld [wOptions],a + callab DisplayOptionMenu_ ; 10:5c70 ret -; reads the options variable and places menu cursors in the correct positions within the options menu -SetCursorPositionsFromOptions: - ld hl,TextSpeedOptionData + 1 - ld a,[wOptions] - ld c,a - and a,$3f - push bc - ld de,2 - call IsInArray - pop bc - dec hl - ld a,[hl] - ld [wOptionsTextSpeedCursorX],a ; text speed cursor X coordinate - coord hl, 0, 3 - call .placeUnfilledRightArrow - sla c - ld a,1 ; On - jr nc,.storeBattleAnimationCursorX - ld a,10 ; Off -.storeBattleAnimationCursorX - ld [wOptionsBattleAnimCursorX],a ; battle animation cursor X coordinate - coord hl, 0, 8 - call .placeUnfilledRightArrow - sla c - ld a,1 - jr nc,.storeBattleStyleCursorX - ld a,10 -.storeBattleStyleCursorX - ld [wOptionsBattleStyleCursorX],a ; battle style cursor X coordinate - coord hl, 0, 13 - call .placeUnfilledRightArrow -; cursor in front of Cancel - coord hl, 0, 16 - ld a,1 -.placeUnfilledRightArrow - ld e,a - ld d,0 - add hl,de - ld [hl],$ec ; unfilled right arrow menu cursor - ret - -; table that indicates how the 3 text speed options affect frame delays -; Format: -; 00: X coordinate of menu cursor -; 01: delay after printing a letter (in frames) -TextSpeedOptionData: - db 14,5 ; Slow - db 7,3 ; Medium - db 1,1 ; Fast - db 7 ; default X coordinate (Medium) - db $ff ; terminator - CheckForPlayerNameInSRAM: ; Check if the player name data in SRAM has a string terminator character ; (indicating that a name may have been saved there) and return whether it does diff --git a/engine/menu/naming_screen.asm b/engine/menu/naming_screen.asm index 217d6e54..911c4e99 100755 --- a/engine/menu/naming_screen.asm +++ b/engine/menu/naming_screen.asm @@ -5,9 +5,8 @@ AskName: ld a, [wIsInBattle] dec a coord hl, 0, 0 - ld b, 4 - ld c, 11 - call z, ClearScreenArea ; only if in wild batle + lb bc, 4, 11 + call z, ClearScreenArea ; only if in wild battle ld a, [wcf91] ld [wd11e], a call GetMonName @@ -40,7 +39,7 @@ AskName: pop af ld [wUpdateSpritesEnabled], a ld a, [wcf4b] - cp $50 + cp "@" ret nz .declinedNickname ld d, h @@ -94,8 +93,7 @@ DisplayNamingScreen: call LoadEDTile callba LoadMonPartySpriteGfx coord hl, 0, 4 - ld b, 9 - ld c, 18 + lb bc, 9, 18 call TextBoxBorder call PrintNamingText ld a, 3 @@ -108,7 +106,7 @@ DisplayNamingScreen: ld [wMenuWatchedKeys], a ld a, 7 ld [wMaxMenuItem], a - ld a, $50 + ld a, "@" ld [wcf4b], a xor a ld hl, wNamingScreenSubmitName @@ -153,7 +151,7 @@ DisplayNamingScreen: ld h, [hl] ld l, a push de - jp [hl] + jp hl .submitNickname pop de @@ -259,7 +257,7 @@ DisplayNamingScreen: .addLetter ld a, [wNamingScreenLetter] ld [hli], a - ld [hl], $50 + ld [hl], "@" ld a, SFX_PRESS_AB call PlaySound ret @@ -324,12 +322,28 @@ DisplayNamingScreen: jp EraseMenuCursor LoadEDTile: +; In Red/Blue, the bank for the ED_tile was defined incorrectly as bank0 +; Luckily, the MBC3 treats loading $0 into $2000-$2fff range as loading bank1 into $4000-$7fff range +; Because Yellow uses the MBC5, loading $0 into $2000 - $2fff range will load bank0 instead of bank1 and thus incorrectly load the tile +; Instead of defining the correct bank, GameFreak decided to simply copy the ED_Tile in the function during HBlank ld de, ED_Tile ld hl, vFont + $700 - ld bc, (ED_TileEnd - ED_Tile) / $8 - ; to fix the graphical bug on poor emulators - ;lb bc, BANK(ED_Tile), (ED_TileEnd - ED_Tile) / $8 - jp CopyVideoDataDouble + ld c, $4 ; number of copies needed +.waitForHBlankLoop + ld a, [rSTAT] + and %10 ; in HBlank? + jr nz, .waitForHBlankLoop + ld a, [de] + ld [hli], a + ld [hli], a + inc de + ld a, [de] + ld [hli], a + ld [hli], a + inc de + dec c + jr nz, .waitForHBlankLoop + ret ED_Tile: INCBIN "gfx/ED_tile.1bpp" diff --git a/engine/menu/oaks_pc.asm b/engine/menu/oaks_pc.asm index 55852b63..e4172ec7 100755 --- a/engine/menu/oaks_pc.asm +++ b/engine/menu/oaks_pc.asm @@ -7,9 +7,9 @@ OpenOaksPC: call YesNoChoice ld a, [wCurrentMenuItem] and a - jr nz, .asm_1e932 + jr nz, .closePC predef DisplayDexRating -.asm_1e932 +.closePC ld hl, ClosedOaksPCText call PrintText jp LoadScreenTilesFromBuffer2 diff --git a/engine/menu/options.asm b/engine/menu/options.asm new file mode 100644 index 00000000..7bed30ae --- /dev/null +++ b/engine/menu/options.asm @@ -0,0 +1,443 @@ +DisplayOptionMenu_: + call Func_41f06 +.optionMenuLoop + call JoypadLowSensitivity + ld a, [hJoy5] + and START | B_BUTTON + jr nz, .exitOptionMenu + call Func_41eb7 + jr c, .asm_41c86 + call Func_41c95 + jr c, .exitOptionMenu +.asm_41c86 + call Func_41ee9 + call DelayFrame + call DelayFrame + call DelayFrame + jr .optionMenuLoop +.exitOptionMenu + ret + +Func_41c95: + ld a, [wOptionsCursorLocation] + ld e, a + ld d, $0 + ld hl, OptionMenuJumpTable + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp hl + +OptionMenuJumpTable: + dw OptionsMenu_TextSpeed + dw OptionsMenu_BattleAnimations + dw OptionsMenu_BattleStyle + dw OptionsMenu_SpeakerSettings + dw OptionsMenu_GBPrinterBrightness + dw OptionsMenu_Dummy + dw OptionsMenu_Dummy + dw OptionsMenu_Cancel + +OptionsMenu_TextSpeed: + call Func_41d07 + ld a, [hJoy5] + bit 4, a ; right + jr nz, .pressedRight + bit 5, a + jr nz, .pressedLeft + jr .asm_41ce0 +.pressedRight + ld a, c + cp $2 + jr c, .asm_41cca + ld c, $ff +.asm_41cca + inc c + ld a, e + jr .asm_41cd6 +.pressedLeft + ld a, c + and a + jr nz, .asm_41cd4 + ld c, $3 +.asm_41cd4 + dec c + ld a, d +.asm_41cd6 + ld b, a + ld a, [wOptions] + and $f0 + or b + ld [wOptions], a +.asm_41ce0 + ld b, $0 + ld hl, TextSpeedStringsPointerTable + add hl, bc + add hl, bc + ld e, [hl] + inc hl + ld d, [hl] + coord hl, 14, 2 + call PlaceString + and a + ret + +TextSpeedStringsPointerTable: + dw FastText + dw MidText + dw SlowText + +FastText: + db "FAST@" +MidText: + db "MID @" +SlowText: + db "SLOW@" + +Func_41d07: + ld a, [wOptions] + and $f + cp $5 + jr z, .slowTextOption + cp $1 + jr z, .fastTextOption +; mid text option + ld c, $1 + lb de, 1, 5 + ret +.slowTextOption + ld c, $2 + lb de, 3, 1 + ret +.fastTextOption + ld c, $0 + lb de, 5, 3 + ret + +OptionsMenu_BattleAnimations: + ld a, [hJoy5] + and D_RIGHT | D_LEFT + jr nz, .asm_41d33 + ld a, [wOptions] + and $80 ; mask other bits + jr .asm_41d3b +.asm_41d33 + ld a, [wOptions] + xor $80 + ld [wOptions], a +.asm_41d3b + ld bc, $0 + sla a + rl c + ld hl, AnimationOptionStringsPointerTable + add hl, bc + add hl, bc + ld e, [hl] + inc hl + ld d, [hl] + coord hl, 14, 4 + call PlaceString + and a + ret + +AnimationOptionStringsPointerTable: + dw AnimationOnText + dw AnimationOffText + +AnimationOnText: + db "ON @" +AnimationOffText: + db "OFF@" + +OptionsMenu_BattleStyle: + ld a, [hJoy5] + and D_LEFT | D_RIGHT + jr nz, .asm_41d6b + ld a, [wOptions] + and $40 ; mask other bits + jr .asm_41d73 +.asm_41d6b + ld a, [wOptions] + xor $40 + ld [wOptions], a +.asm_41d73 + ld bc, $0 + sla a + sla a + rl c + ld hl, BattleStyleOptionStringsPointerTable + add hl, bc + add hl, bc + ld e, [hl] + inc hl + ld d, [hl] + coord hl, 14, 6 + call PlaceString + and a + ret + +BattleStyleOptionStringsPointerTable: + dw BattleStyleShiftText + dw BattleStyleSetText + +BattleStyleShiftText: + db "SHIFT@" +BattleStyleSetText: + db "SET @" + +OptionsMenu_SpeakerSettings: + ld a, [wOptions] + and $30 + swap a + ld c, a + ld a, [hJoy5] + bit 4, a + jr nz, .pressedRight + bit 5, a + jr nz, .pressedLeft + jr .asm_41dca +.pressedRight + ld a, c + inc a + and $3 + jr .asm_41dba +.pressedLeft + ld a, c + dec a + and $3 +.asm_41dba + ld c, a + swap a + ld b, a + xor a + ld [rNR51], a + ld a, [wOptions] + and $cf + or b + ld [wOptions], a +.asm_41dca + ld b, $0 + ld hl, SpeakerOptionStringsPointerTable + add hl, bc + add hl, bc + ld e, [hl] + inc hl + ld d, [hl] + coord hl, 8, 8 + call PlaceString + and a + ret + +SpeakerOptionStringsPointerTable: + dw MonoSoundText + dw Earphone1SoundText + dw Earphone2SoundText + dw Earphone3SoundText + +MonoSoundText: + db "MONO @" +Earphone1SoundText: + db "EARPHONE1@" +Earphone2SoundText: + db "EARPHONE2@" +Earphone3SoundText: + db "EARPHONE3@" + +OptionsMenu_GBPrinterBrightness: + call Func_41e7b + ld a, [hJoy5] + bit 4, a + jr nz, .pressedRight + bit 5, a + jr nz, .pressedLeft + jr .asm_41e32 +.pressedRight + ld a, c + cp $4 + jr c, .asm_41e22 + ld c, $ff +.asm_41e22 + inc c + ld a, e + jr .asm_41e2e +.pressedLeft + ld a, c + and a + jr nz, .asm_41e2c + ld c, $5 +.asm_41e2c + dec c + ld a, d +.asm_41e2e + ld b, a + ld [wPrinterSettings], a +.asm_41e32 + ld b, $0 + ld hl, GBPrinterOptionStringsPointerTable + add hl, bc + add hl, bc + ld e, [hl] + inc hl + ld d, [hl] + coord hl, 8, 10 + call PlaceString + and a + ret + +GBPrinterOptionStringsPointerTable: + dw LightestPrintText + dw LighterPrintText + dw NormalPrintText + dw DarkerPrintText + dw DarkestPrintText + +LightestPrintText: + db "LIGHTEST@" +LighterPrintText: + db "LIGHTER @" +NormalPrintText: + db "NORMAL @" +DarkerPrintText: + db "DARKER @" +DarkestPrintText: + db "DARKEST @" + +Func_41e7b: + ld a, [wPrinterSettings] + and a + jr z, .asm_41e93 + cp $20 + jr z, .asm_41e99 + cp $60 + jr z, .asm_41e9f + cp $7f + jr z, .asm_41ea5 + ld c, $2 + lb de, $20, $60 + ret +.asm_41e93 + ld c, $0 + lb de, $7f, $20 + ret +.asm_41e99 + ld c, $1 + lb de, $0, $40 + ret +.asm_41e9f + ld c, $3 + lb de, $40, $7f + ret +.asm_41ea5 + ld c, $4 + lb de, $60, $0 + ret + +OptionsMenu_Dummy: + and a + ret + +OptionsMenu_Cancel: + ld a, [hJoy5] + and A_BUTTON + jr nz, .pressedCancel + and a + ret +.pressedCancel + scf + ret + +Func_41eb7: + ld hl, wOptionsCursorLocation + ld a, [hJoy5] + cp D_DOWN + jr z, .pressedDown + cp D_UP + jr z, .pressedUp + and a + ret +.pressedDown + ld a, [hl] + cp $7 + jr nz, .doNotWrapAround + ld [hl], $0 + scf + ret +.doNotWrapAround + cp $4 + jr c, .regularIncrement + ld [hl], $6 +.regularIncrement + inc [hl] + scf + ret +.pressedUp + ld a, [hl] + cp $7 + jr nz, .doNotMoveCursorToPrintOption + ld [hl], $4 + scf + ret +.doNotMoveCursorToPrintOption + and a + jr nz, .regularDecrement + ld [hl], $8 +.regularDecrement + dec [hl] + scf + ret + +Func_41ee9: + coord hl, 1, 1 + ld de, SCREEN_WIDTH + ld c, 16 +.loop + ld [hl], " " + add hl, de + dec c + jr nz, .loop + coord hl, 1, 2 + ld bc, SCREEN_WIDTH * 2 + ld a, [wOptionsCursorLocation] + call AddNTimes + ld [hl], "▶" + ret + +Func_41f06: + coord hl, 0, 0 + lb bc, SCREEN_HEIGHT - 2, SCREEN_WIDTH - 2 + call TextBoxBorder + coord hl, 2, 2 + ld de, AllOptionsText + call PlaceString + coord hl, 2, 16 + ld de, OptionMenuCancelText + call PlaceString + xor a + ld [wOptionsCursorLocation], a + ld c, 5 +.loop + push bc + call Func_41c95 + pop bc + ld hl, wOptionsCursorLocation + inc [hl] + dec c + jr nz, .loop + xor a + ld [wOptionsCursorLocation], a + inc a + ld [H_AUTOBGTRANSFERENABLED], a + call Delay3 + ret + +AllOptionsText: + db "TEXT SPEED :" + next "ANIMATION :" + next "BATTLESTYLE:" + next "SOUND:" + next "PRINT:@" + +OptionMenuCancelText: + db "CANCEL@" diff --git a/engine/menu/party_menu.asm b/engine/menu/party_menu.asm index 7ef14232..669d49db 100755 --- a/engine/menu/party_menu.asm +++ b/engine/menu/party_menu.asm @@ -49,9 +49,17 @@ RedrawPartyMenu_: call GetPartyMonName pop hl call PlaceString ; print the pokemon's name - callba WriteMonPartySpriteOAMByPartyIndex ; place the appropriate pokemon icon ld a,[hPartyMonIndex] ld [wWhichPokemon],a + callab IsThisPartymonStarterPikachu_Party + jr nc, .regularMon + call CheckPikachuFollowingPlayer + jr z, .regularMon + ld a, $ff + ld [hPartyMonIndex], a +.regularMon + callba WriteMonPartySpriteOAMByPartyIndex ; place the appropriate pokemon icon + ld a, [wWhichPokemon] inc a ld [hPartyMonIndex],a call LoadMonData @@ -88,14 +96,14 @@ RedrawPartyMenu_: pop hl push hl ld bc,20 + 1 ; down 1 row and right 1 column - ld a,[hFlags_0xFFF6] + ld a,[hFlags_0xFFFA] set 0,a - ld [hFlags_0xFFF6],a + ld [hFlags_0xFFFA],a add hl,bc predef DrawHP2 ; draw HP bar and prints current / max HP - ld a,[hFlags_0xFFF6] + ld a,[hFlags_0xFFFA] res 0,a - ld [hFlags_0xFFF6],a + ld [hFlags_0xFFFA],a call SetPartyMenuHPBarColor ; color the HP bar (on SGB) pop hl jr .printLevel @@ -109,8 +117,8 @@ RedrawPartyMenu_: jr nz,.placeMoveLearnabilityString ld de,.notAbleToLearnMoveText .placeMoveLearnabilityString - ld bc,20 + 9 ; down 1 row and right 9 columns push hl + ld bc,20 + 9 ; down 1 row and right 9 columns add hl,bc call PlaceString pop hl @@ -150,7 +158,7 @@ RedrawPartyMenu_: ld l,a ld de,wcd6d ld a,BANK(EvosMovesPointerTable) - ld bc,Mon133_EvosEnd - Mon133_EvosMoves + ld bc, $0d ; Mon133_EvosEnd - Mon133_EvosMoves call FarCopyData ld hl,wcd6d ld de,.notAbleToEvolveText @@ -176,9 +184,9 @@ RedrawPartyMenu_: ; if it does match ld de,.ableToEvolveText .placeEvolutionStoneString - ld bc,20 + 9 ; down 1 row and right 9 columns pop hl push hl + ld bc,20 + 9 ; down 1 row and right 9 columns add hl,bc call PlaceString pop hl diff --git a/engine/menu/pc.asm b/engine/menu/pc.asm index 8ec31226..b31970c8 100755 --- a/engine/menu/pc.asm +++ b/engine/menu/pc.asm @@ -121,18 +121,18 @@ RemoveItemByID: ld b, a xor a ld [hItemToRemoveIndex], a -.asm_17f40 +.loop ld a, [hli] - cp $ff + cp $ff ; have we reached the cancel button (terminator) ret z - cp b - jr z, .asm_17f4f + cp b ; is the current item the item we want? + jr z, .foundItem ; if so, remove it from the inventory inc hl ld a, [hItemToRemoveIndex] inc a ld [hItemToRemoveIndex], a - jr .asm_17f40 -.asm_17f4f + jr .loop +.foundItem ld a, $1 ld [wItemQuantity], a ld a, [hItemToRemoveIndex] diff --git a/engine/menu/players_pc.asm b/engine/menu/players_pc.asm index bc2be4ef..1cc02cbf 100755 --- a/engine/menu/players_pc.asm +++ b/engine/menu/players_pc.asm @@ -1,6 +1,4 @@ PlayerPC: - ld hl, wd730 - set 6, [hl] ld a, ITEM_NAME ld [wNameListType], a call SaveScreenTilesToBuffer1 @@ -17,14 +15,15 @@ PlayerPC: call PrintText PlayerPCMenu: + ld hl, wd730 + set 6, [hl] ld a, [wParentMenuItem] ld [wCurrentMenuItem], a ld hl, wFlags_0xcd60 set 5, [hl] call LoadScreenTilesFromBuffer2 coord hl, 0, 0 - ld b, $8 - ld c, $e + lb bc, 8, 14 call TextBoxBorder call UpdateSprites coord hl, 2, 2 diff --git a/engine/menu/pokedex.asm b/engine/menu/pokedex.asm index 3078f1a9..5bc8f119 100755 --- a/engine/menu/pokedex.asm +++ b/engine/menu/pokedex.asm @@ -2,53 +2,57 @@ ShowPokedexMenu: call GBPalWhiteOut call ClearScreen call UpdateSprites - ld a,[wListScrollOffset] + ld a, [wListScrollOffset] push af xor a - ld [wCurrentMenuItem],a - ld [wListScrollOffset],a - ld [wLastMenuItem],a + ld [wCurrentMenuItem], a + ld [wListScrollOffset], a + ld [wLastMenuItem], a inc a - ld [wd11e],a - ld [hJoy7],a + ld [wd11e], a + ld [hJoy7], a .setUpGraphics + callab LoadPokedexTilePatterns +.loop ld b, SET_PAL_GENERIC call RunPaletteCommand - callab LoadPokedexTilePatterns .doPokemonListMenu - ld hl,wTopMenuItemY - ld a,3 - ld [hli],a ; top menu item Y + ld hl, wTopMenuItemY + ld a, 3 + ld [hli], a ; top menu item Y xor a - ld [hli],a ; top menu item X + ld [hli], a ; top menu item X inc a - ld [wMenuWatchMovingOutOfBounds],a + ld [wMenuWatchMovingOutOfBounds], a inc hl inc hl - ld a,6 - ld [hli],a ; max menu item ID - ld [hl],D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON + ld a, 6 + ld [hli], a ; max menu item ID + ld [hl], D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON call HandlePokedexListMenu - jr c,.goToSideMenu ; if the player chose a pokemon from the list + jr c, .goToSideMenu ; if the player chose a pokemon from the list .exitPokedex xor a - ld [wMenuWatchMovingOutOfBounds],a - ld [wCurrentMenuItem],a - ld [wLastMenuItem],a - ld [hJoy7],a - ld [wWastedByteCD3A],a - ld [wOverrideSimulatedJoypadStatesMask],a + ld [wMenuWatchMovingOutOfBounds], a + ld [wCurrentMenuItem], a + ld [wLastMenuItem], a + ld [hJoy7], a + ld [wWastedByteCD3A], a + ld [wOverrideSimulatedJoypadStatesMask], a pop af - ld [wListScrollOffset],a + ld [wListScrollOffset], a call GBPalWhiteOutWithDelay3 call RunDefaultPaletteCommand jp ReloadMapData + .goToSideMenu call HandlePokedexSideMenu dec b - jr z,.exitPokedex ; if the player chose Quit + jr z, .exitPokedex ; if the player chose Quit + dec b + jr z, .doPokemonListMenu ; if pokemon not seen or player pressed B button dec b - jr z,.doPokemonListMenu ; if pokemon not seen or player pressed B button + jr z, .loop jp .setUpGraphics ; if pokemon data or area was shown ; handles the menu on the lower right in the pokedex screen @@ -59,204 +63,337 @@ ShowPokedexMenu: ; 02: the pokemon has not been seen yet or the player pressed the B button HandlePokedexSideMenu: call PlaceUnfilledArrowMenuCursor - ld a,[wCurrentMenuItem] + ld a, [wCurrentMenuItem] push af - ld b,a - ld a,[wLastMenuItem] + ld b, a + ld a, [wLastMenuItem] push af - ld a,[wListScrollOffset] + ld a, [wListScrollOffset] push af add b inc a - ld [wd11e],a - ld a,[wd11e] + ld [wd11e], a + ld a, [wd11e] push af - ld a,[wDexMaxSeenMon] + ld a, [wDexMaxSeenMon] push af ; this doesn't need to be preserved - ld hl,wPokedexSeen + ld hl, wPokedexSeen call IsPokemonBitSet - ld b,2 - jr z,.exitSideMenu + ld b, 2 + jr z, .exitSideMenu call PokedexToIndex - ld hl,wTopMenuItemY - ld a,10 - ld [hli],a ; top menu item Y - ld a,15 - ld [hli],a ; top menu item X + ld hl, wTopMenuItemY + ld a, 8 + ld [hli], a ; top menu item Y + ld a, 15 + ld [hli], a ; top menu item X xor a - ld [hli],a ; current menu item ID + ld [hli], a ; current menu item ID inc hl - ld a,3 - ld [hli],a ; max menu item ID - ;ld a, A_BUTTON | B_BUTTON - ld [hli],a ; menu watched keys (A button and B button) + ld a, 4 + ld [hli], a ; max menu item ID + ld a, A_BUTTON | B_BUTTON + ld [hli], a ; menu watched keys (A button and B button) xor a - ld [hli],a ; old menu item ID - ld [wMenuWatchMovingOutOfBounds],a + ld [hli], a ; old menu item ID + ld [wMenuWatchMovingOutOfBounds], a + ld [hJoy7], a .handleMenuInput call HandleMenuInput - bit 1,a ; was the B button pressed? - ld b,2 - jr nz,.buttonBPressed - ld a,[wCurrentMenuItem] + bit 1, a ; was the B button pressed? + ld b, 2 + jr nz, .buttonBPressed + ld a, [wCurrentMenuItem] and a - jr z,.choseData + jr z, .choseData + dec a + jr z, .choseCry dec a - jr z,.choseCry + jr z, .choseArea dec a - jr z,.choseArea + jr z, .chosePrint .choseQuit - ld b,1 + ld b, 1 .exitSideMenu pop af - ld [wDexMaxSeenMon],a + ld [wDexMaxSeenMon], a pop af - ld [wd11e],a + ld [wd11e], a pop af - ld [wListScrollOffset],a + ld [wListScrollOffset], a pop af - ld [wLastMenuItem],a + ld [wLastMenuItem], a pop af - ld [wCurrentMenuItem],a + ld [wCurrentMenuItem], a + ld a, $1 + ld [hJoy7], a push bc coord hl, 0, 3 - ld de,20 + ld de, 20 lb bc, " ", 13 call DrawTileLine ; cover up the menu cursor in the pokemon list pop bc ret + .buttonBPressed push bc - coord hl, 15, 10 - ld de,20 - lb bc, " ", 7 + coord hl, 15, 8 + ld de, 20 + lb bc, " ", 9 call DrawTileLine ; cover up the menu cursor in the side menu pop bc jr .exitSideMenu + .choseData call ShowPokedexDataInternal - ld b,0 + ld b, 0 jr .exitSideMenu + ; play pokemon cry .choseCry - ld a,[wd11e] + ld a, [wd11e] call GetCryData call PlaySound jr .handleMenuInput + .choseArea predef LoadTownMap_Nest ; display pokemon areas - ld b,0 + ld b, 0 + jr .exitSideMenu + +.chosePrint + ld a, [hTilesetType] + push af + xor a + ld [hTilesetType], a + ld a, [wd11e] + ld [wcf91], a + callab PrintPokedexEntry + xor a + ld [H_AUTOBGTRANSFERENABLED], a + call ClearScreen + pop af + ld [hTilesetType], a + ld b, $3 jr .exitSideMenu ; handles the list of pokemon on the left of the pokedex screen ; sets carry flag if player presses A, unsets carry flag if player presses B HandlePokedexListMenu: + call Pokedex_DrawInterface +.loop + call Pokedex_PlacePokemonList + call GBPalNormal + call HandleMenuInput + bit BIT_B_BUTTON, a ; was the B button pressed? + jp nz, .buttonBPressed + bit BIT_A_BUTTON, a ; was the A button pressed? + jp nz, .buttonAPressed +.checkIfUpPressed + bit BIT_D_UP, a ; was Up pressed? + jr z, .checkIfDownPressed +.upPressed ; scroll up one row + ld a, [wListScrollOffset] + and a + jp z, .loop + dec a + ld [wListScrollOffset], a + jp .loop + +.checkIfDownPressed + bit BIT_D_DOWN, a ; was Down pressed? + jr z, .checkIfRightPressed +.downPressed ; scroll down one row + ld a, [wDexMaxSeenMon] + cp a, 7 + jp c, .loop ; can't if the list is shorter than 7 + sub a, 7 + ld b, a + ld a, [wListScrollOffset] + cp b + jp z, .loop + inc a + ld [wListScrollOffset], a + jp .loop + +.checkIfRightPressed + bit BIT_D_RIGHT, a ; was Right pressed? + jr z, .checkIfLeftPressed +.rightPressed ; scroll down 7 rows + ld a, [wDexMaxSeenMon] + cp a, 7 + jp c, .loop ; can't if the list is shorter than 7 + sub a, 6 + ld b, a + ld a, [wListScrollOffset] + add a, 7 + ld [wListScrollOffset], a + cp b + jp c, .loop + dec b + ld a, b + ld [wListScrollOffset], a + jp .loop + +.checkIfLeftPressed ; scroll up 7 rows + bit BIT_D_LEFT, a ; was Left pressed? + jr z, .buttonAPressed +.leftPressed + ld a, [wListScrollOffset] + sub a, 7 + ld [wListScrollOffset], a + jp nc, .loop + xor a + ld [wListScrollOffset], a + jp .loop + +.buttonAPressed + scf + ret + +.buttonBPressed + and a + ret + +Pokedex_DrawInterface: xor a - ld [H_AUTOBGTRANSFERENABLED],a + ld [H_AUTOBGTRANSFERENABLED], a ; draw the horizontal line separating the seen and owned amounts from the menu - coord hl, 15, 8 - ld a,$7a ; horizontal line tile - ld [hli],a - ld [hli],a - ld [hli],a - ld [hli],a - ld [hli],a + coord hl, 15, 6 + ld a, $7a ; horizontal line tile + ld [hli], a + ld [hli], a + ld [hli], a + ld [hli], a + ld [hli], a coord hl, 14, 0 - ld [hl],$71 ; vertical line tile + ld [hl], $71 ; vertical line tile coord hl, 14, 1 call DrawPokedexVerticalLine coord hl, 14, 9 call DrawPokedexVerticalLine - ld hl,wPokedexSeen - ld b,wPokedexSeenEnd - wPokedexSeen + ld hl, wPokedexSeen + ld b, wPokedexSeenEnd - wPokedexSeen call CountSetBits ld de, wNumSetBits - coord hl, 16, 3 + coord hl, 16, 2 lb bc, 1, 3 call PrintNumber ; print number of seen pokemon - ld hl,wPokedexOwned - ld b,wPokedexOwnedEnd - wPokedexOwned + ld hl, wPokedexOwned + ld b, wPokedexOwnedEnd - wPokedexOwned call CountSetBits ld de, wNumSetBits - coord hl, 16, 6 + coord hl, 16, 5 lb bc, 1, 3 call PrintNumber ; print number of owned pokemon - coord hl, 16, 2 - ld de,PokedexSeenText + coord hl, 16, 1 + ld de, PokedexSeenText call PlaceString - coord hl, 16, 5 - ld de,PokedexOwnText + coord hl, 16, 4 + ld de, PokedexOwnText call PlaceString coord hl, 1, 1 - ld de,PokedexContentsText + ld de, PokedexContentsText call PlaceString - coord hl, 16, 10 - ld de,PokedexMenuItemsText + coord hl, 16, 8 + ld de, PokedexMenuItemsText call PlaceString ; find the highest pokedex number among the pokemon the player has seen - ld hl,wPokedexSeenEnd - 1 - ld b,(wPokedexSeenEnd - wPokedexSeen) * 8 + 1 + ld hl, wPokedexSeenEnd - 1 + ld b, (wPokedexSeenEnd - wPokedexSeen) * 8 + 1 .maxSeenPokemonLoop - ld a,[hld] - ld c,8 + ld a, [hld] + ld c, 8 .maxSeenPokemonInnerLoop dec b sla a - jr c,.storeMaxSeenPokemon + jr c, .storeMaxSeenPokemon dec c - jr nz,.maxSeenPokemonInnerLoop + jr nz, .maxSeenPokemonInnerLoop jr .maxSeenPokemonLoop + .storeMaxSeenPokemon - ld a,b - ld [wDexMaxSeenMon],a + ld a, b + ld [wDexMaxSeenMon], a + ret + +DrawPokedexVerticalLine: + ld c, 9 ; height of line + ld de, SCREEN_WIDTH ; width of screen + ld a, $71 ; vertical line tile .loop + ld [hl], a + add hl, de + xor a, 1 ; toggle between vertical line tile and box tile + dec c + jr nz, .loop + ret + +PokedexSeenText: + db "SEEN@" + +PokedexOwnText: + db "OWN@" + +PokedexContentsText: + db "CONTENTS@" + +PokedexMenuItemsText: + db "DATA" + next "CRY" + next "AREA" + next "PRNT" + next "QUIT@" + +Pokedex_PlacePokemonList: xor a - ld [H_AUTOBGTRANSFERENABLED],a + ld [H_AUTOBGTRANSFERENABLED], a coord hl, 4, 2 lb bc, 14, 10 call ClearScreenArea coord hl, 1, 3 - ld a,[wListScrollOffset] - ld [wd11e],a - ld d,7 - ld a,[wDexMaxSeenMon] - cp a,7 - jr nc,.printPokemonLoop - ld d,a + ld a, [wListScrollOffset] + ld [wd11e], a + ld d, 7 + ld a, [wDexMaxSeenMon] + cp a, 7 + jr nc, .printPokemonLoop + ld d, a dec a - ld [wMaxMenuItem],a + ld [wMaxMenuItem], a ; loop to print pokemon pokedex numbers and names ; if the player has owned the pokemon, it puts a pokeball beside the name .printPokemonLoop - ld a,[wd11e] + ld a, [wd11e] inc a - ld [wd11e],a + ld [wd11e], a push af push de push hl - ld de,-SCREEN_WIDTH - add hl,de - ld de,wd11e + ld de, -SCREEN_WIDTH + add hl, de + ld de, wd11e lb bc, LEADING_ZEROES | 1, 3 call PrintNumber ; print the pokedex number - ld de,SCREEN_WIDTH - add hl,de + ld de, SCREEN_WIDTH + add hl, de dec hl push hl - ld hl,wPokedexOwned + ld hl, wPokedexOwned call IsPokemonBitSet pop hl - ld a," " - jr z,.writeTile - ld a,$72 ; pokeball tile + ld a, " " + jr z, .writeTile + ld a, $72 ; pokeball tile .writeTile - ld [hl],a ; put a pokeball next to pokemon that the player has owned + ld [hl], a ; put a pokeball next to pokemon that the player has owned push hl - ld hl,wPokedexSeen + ld hl, wPokedexSeen call IsPokemonBitSet - jr nz,.getPokemonName ; if the player has seen the pokemon - ld de,.dashedLine ; print a dashed line in place of the name if the player hasn't seen the pokemon + jr nz, .getPokemonName ; if the player has seen the pokemon + ld de, .dashedLine ; print a dashed line in place of the name if the player hasn't seen the pokemon jr .skipGettingName + .dashedLine ; for unseen pokemon in the list db "----------@" .getPokemonName @@ -267,119 +404,29 @@ HandlePokedexListMenu: inc hl call PlaceString pop hl - ld bc,2 * 20 - add hl,bc + ld bc, 2 * 20 + add hl, bc pop de pop af - ld [wd11e],a + ld [wd11e], a dec d - jr nz,.printPokemonLoop - ld a,01 - ld [H_AUTOBGTRANSFERENABLED],a + jr nz, .printPokemonLoop + ld a, 01 + ld [H_AUTOBGTRANSFERENABLED], a call Delay3 - call GBPalNormal - call HandleMenuInput - bit 1,a ; was the B button pressed? - jp nz,.buttonBPressed -.checkIfUpPressed - bit 6,a ; was Up pressed? - jr z,.checkIfDownPressed -.upPressed ; scroll up one row - ld a,[wListScrollOffset] - and a - jp z,.loop - dec a - ld [wListScrollOffset],a - jp .loop -.checkIfDownPressed - bit 7,a ; was Down pressed? - jr z,.checkIfRightPressed -.downPressed ; scroll down one row - ld a,[wDexMaxSeenMon] - cp a,7 - jp c,.loop ; can't if the list is shorter than 7 - sub a,7 - ld b,a - ld a,[wListScrollOffset] - cp b - jp z,.loop - inc a - ld [wListScrollOffset],a - jp .loop -.checkIfRightPressed - bit 4,a ; was Right pressed? - jr z,.checkIfLeftPressed -.rightPressed ; scroll down 7 rows - ld a,[wDexMaxSeenMon] - cp a,7 - jp c,.loop ; can't if the list is shorter than 7 - sub a,6 - ld b,a - ld a,[wListScrollOffset] - add a,7 - ld [wListScrollOffset],a - cp b - jp c,.loop - dec b - ld a,b - ld [wListScrollOffset],a - jp .loop -.checkIfLeftPressed ; scroll up 7 rows - bit 5,a ; was Left pressed? - jr z,.buttonAPressed -.leftPressed - ld a,[wListScrollOffset] - sub a,7 - ld [wListScrollOffset],a - jp nc,.loop - xor a - ld [wListScrollOffset],a - jp .loop -.buttonAPressed - scf - ret -.buttonBPressed - and a - ret - -DrawPokedexVerticalLine: - ld c,9 ; height of line - ld de,20 ; width of screen - ld a,$71 ; vertical line tile -.loop - ld [hl],a - add hl,de - xor a,1 ; toggle between vertical line tile and box tile - dec c - jr nz,.loop ret -PokedexSeenText: - db "SEEN@" - -PokedexOwnText: - db "OWN@" - -PokedexContentsText: - db "CONTENTS@" - -PokedexMenuItemsText: - db "DATA" - next "CRY" - next "AREA" - next "QUIT@" - ; tests if a pokemon's bit is set in the seen or owned pokemon bit fields ; INPUT: ; [wd11e] = pokedex number ; hl = address of bit field IsPokemonBitSet: - ld a,[wd11e] + ld a, [wd11e] dec a - ld c,a - ld b,FLAG_TEST + ld c, a + ld b, FLAG_TEST predef FlagActionPredef - ld a,c + ld a, c and a ret @@ -392,195 +439,255 @@ ShowPokedexData: ; function to display pokedex data from inside the pokedex ShowPokedexDataInternal: - ld hl,wd72c - set 1,[hl] - ld a,$33 ; 3/7 volume - ld [rNR50],a + ld hl, wd72c + set 1, [hl] + ld a, $33 ; 3/7 volume + ld [rNR50], a + ld a, [hTilesetType] + push af + xor a + ld [hTilesetType], a call GBPalWhiteOut ; zero all palettes - call ClearScreen - ld a,[wd11e] ; pokemon ID - ld [wcf91],a + ld a, [wd11e] ; pokemon ID + ld [wcf91], a push af ld b, SET_PAL_POKEDEX call RunPaletteCommand pop af - ld [wd11e],a - ld a,[hTilesetType] - push af - xor a - ld [hTilesetType],a + ld [wd11e], a + call DrawDexEntryOnScreen + call c, Pokedex_PrintFlavorTextAtRow11 +.waitForButtonPress + call JoypadLowSensitivity + ld a, [hJoy5] + and a, A_BUTTON | B_BUTTON + jr z, .waitForButtonPress + pop af + ld [hTilesetType], a + call GBPalWhiteOut + call ClearScreen + call RunDefaultPaletteCommand + call LoadTextBoxTilePatterns + call GBPalNormal + ld hl, wd72c + res 1, [hl] + ld a, $77 ; max volume + ld [rNR50], a + ret + +HeightWeightText: + db "HT ?", $60, "??", $61 + next "WT ???lb@" + +; XXX does anything point to this? +PokeText: + db "#@" + +; horizontal line that divides the pokedex text description from the rest of the data +PokedexDataDividerLine: + db $68, $69, $6B, $69, $6B + db $69, $6B, $69, $6B, $6B + db $6B, $6B, $69, $6B, $69 + db $6B, $69, $6B, $69, $6A + db "@" + +DrawDexEntryOnScreen: + call ClearScreen + coord hl, 0, 0 - ld de,1 + ld de, 1 lb bc, $64, SCREEN_WIDTH call DrawTileLine ; draw top border + coord hl, 0, 17 ld b, $6f call DrawTileLine ; draw bottom border + coord hl, 0, 1 - ld de,20 + ld de, 20 lb bc, $66, $10 call DrawTileLine ; draw left border + coord hl, 19, 1 - ld b,$67 + ld b, $67 call DrawTileLine ; draw right border - ld a,$63 ; upper left corner tile + + ld a, $63 ; upper left corner tile Coorda 0, 0 - ld a,$65 ; upper right corner tile + ld a, $65 ; upper right corner tile Coorda 19, 0 - ld a,$6c ; lower left corner tile + ld a, $6c ; lower left corner tile Coorda 0, 17 - ld a,$6e ; lower right corner tile + ld a, $6e ; lower right corner tile + Coorda 19, 17 coord hl, 0, 9 - ld de,PokedexDataDividerLine + + ld de, PokedexDataDividerLine call PlaceString ; draw horizontal divider line + coord hl, 9, 6 - ld de,HeightWeightText + ld de, HeightWeightText call PlaceString + call GetMonName coord hl, 9, 2 call PlaceString - ld hl,PokedexEntryPointers - ld a,[wd11e] + + ld hl, PokedexEntryPointers + ld a, [wd11e] dec a - ld e,a - ld d,0 - add hl,de - add hl,de - ld a,[hli] - ld e,a - ld d,[hl] ; de = address of pokedex entry + ld e, a + ld d, 0 + add hl, de + add hl, de + ld a, [hli] + ld e, a + ld d, [hl] ; de = address of pokedex entry + coord hl, 9, 4 call PlaceString ; print species name - ld h,b - ld l,c + + ld h, b + ld l, c push de - ld a,[wd11e] + ld a, [wd11e] push af call IndexToPokedex + coord hl, 2, 8 ld a, "№" - ld [hli],a - ld a,$f2 - ld [hli],a - ld de,wd11e + ld [hli], a + ld a, $f2 + ld [hli], a + ld de, wd11e lb bc, LEADING_ZEROES | 1, 3 call PrintNumber ; print pokedex number - ld hl,wPokedexOwned + + ld hl, wPokedexOwned call IsPokemonBitSet pop af - ld [wd11e],a - ld a,[wcf91] - ld [wd0b5],a + ld [wd11e], a + ld a, [wcf91] + ld [wd0b5], a pop de + push af push bc push de push hl + call Delay3 call GBPalNormal call GetMonHeader ; load pokemon picture location coord hl, 1, 1 call LoadFlippedFrontSpriteByMonIndex ; draw pokemon picture - ld a,[wcf91] + ld a, [wcf91] call PlayCry ; play pokemon cry + pop hl pop de pop bc pop af - ld a,c + + ld a, c and a - jp z,.waitForButtonPress ; if the pokemon has not been owned, don't print the height, weight, or description + ret z ; if the pokemon has not been owned, don't print the height, weight, or description + inc de ; de = address of feet (height) - ld a,[de] ; reads feet, but a is overwritten without being used + ld a, [de] ; reads feet, but a is overwritten without being used coord hl, 12, 6 lb bc, 1, 2 call PrintNumber ; print feet (height) - ld a,$60 ; feet symbol tile (one tick) - ld [hl],a + ld a, $60 ; feet symbol tile (one tick) + ld [hl], a inc de inc de ; de = address of inches (height) coord hl, 15, 6 lb bc, LEADING_ZEROES | 1, 2 call PrintNumber ; print inches (height) - ld a,$61 ; inches symbol tile (two ticks) - ld [hl],a + ld a, $61 ; inches symbol tile (two ticks) + ld [hl], a ; now print the weight (note that weight is stored in tenths of pounds internally) inc de inc de inc de ; de = address of upper byte of weight push de ; put weight in big-endian order at hDexWeight - ld hl,hDexWeight - ld a,[hl] ; save existing value of [hDexWeight] + ld hl, hDexWeight + ld a, [hl] ; save existing value of [hDexWeight] push af - ld a,[de] ; a = upper byte of weight - ld [hli],a ; store upper byte of weight in [hDexWeight] - ld a,[hl] ; save existing value of [hDexWeight + 1] + ld a, [de] ; a = upper byte of weight + ld [hli], a ; store upper byte of weight in [hDexWeight] + ld a, [hl] ; save existing value of [hDexWeight + 1] push af dec de - ld a,[de] ; a = lower byte of weight - ld [hl],a ; store lower byte of weight in [hDexWeight + 1] - ld de,hDexWeight + ld a, [de] ; a = lower byte of weight + ld [hl], a ; store lower byte of weight in [hDexWeight + 1] + ld de, hDexWeight coord hl, 11, 8 lb bc, 2, 5 ; 2 bytes, 5 digits call PrintNumber ; print weight coord hl, 14, 8 - ld a,[hDexWeight + 1] - sub a,10 - ld a,[hDexWeight] - sbc a,0 - jr nc,.next - ld [hl],"0" ; if the weight is less than 10, put a 0 before the decimal point + ld a, [hDexWeight + 1] + sub a, 10 + ld a, [hDexWeight] + sbc a, 0 + jr nc, .next + ld [hl], "0" ; if the weight is less than 10, put a 0 before the decimal point .next inc hl - ld a,[hli] - ld [hld],a ; make space for the decimal point by moving the last digit forward one tile - ld [hl],$f2 ; decimal point tile + ld a, [hli] + ld [hld], a ; make space for the decimal point by moving the last digit forward one tile + ld [hl], $f2 ; decimal point tile pop af - ld [hDexWeight + 1],a ; restore original value of [hDexWeight + 1] + ld [hDexWeight + 1], a ; restore original value of [hDexWeight + 1] pop af - ld [hDexWeight],a ; restore original value of [hDexWeight] + ld [hDexWeight], a ; restore original value of [hDexWeight] pop hl inc hl ; hl = address of pokedex description text + scf + ret + +Pokedex_PrintFlavorTextAtRow11: coord bc, 1, 11 - ld a,2 - ld [$fff4],a +Pokedex_PrintFlavorTextAtBC: + ld a, 2 + ld [$fff9], a call TextCommandProcessor ; print pokedex description text xor a - ld [$fff4],a -.waitForButtonPress - call JoypadLowSensitivity - ld a,[hJoy5] - and a,A_BUTTON | B_BUTTON - jr z,.waitForButtonPress - pop af - ld [hTilesetType],a - call GBPalWhiteOut - call ClearScreen - call RunDefaultPaletteCommand - call LoadTextBoxTilePatterns - call GBPalNormal - ld hl,wd72c - res 1,[hl] - ld a,$77 ; max volume - ld [rNR50],a + ld [$fff9], a ret -HeightWeightText: - db "HT ?",$60,"??",$61,$4E,"WT ???lb@" - -; XXX does anything point to this? -PokeText: - db "#@" - -; horizontal line that divides the pokedex text description from the rest of the data -PokedexDataDividerLine: - db $68,$69,$6B,$69,$6B - db $69,$6B,$69,$6B,$6B - db $6B,$6B,$69,$6B,$69 - db $6B,$69,$6B,$69,$6A - db $50 +Pokedex_PrepareDexEntryForPrinting: + coord hl, 0, 0 + ld de, SCREEN_WIDTH + lb bc, $66, $d + call DrawTileLine + coord hl, 19, 0 + ld b, $67 + call DrawTileLine + coord hl, 0, 13 + ld de, $1 + lb bc, $6f, SCREEN_WIDTH + call DrawTileLine + ld a, $6c + Coorda 0, 13 + ld a, $6e + Coorda 19, 13 + ld a, [wPrinterPokedexEntryTextPointer] + ld l, a + ld a, [wPrinterPokedexEntryTextPointer + 1] + ld h, a + coord bc, 1, 1 + ld a, [hFlags_0xFFFA] + set 3, a + ld [hFlags_0xFFFA], a + call Pokedex_PrintFlavorTextAtBC + ld a, [hFlags_0xFFFA] + res 3, a + ld [hFlags_0xFFFA], a + ret ; draws a line of tiles ; INPUT: @@ -592,10 +699,10 @@ DrawTileLine: push bc push de .loop - ld [hl],b - add hl,de + ld [hl], b + add hl, de dec c - jr nz,.loop + jr nz, .loop pop de pop bc ret @@ -606,19 +713,19 @@ PokedexToIndex: ; converts the Pokédex number at wd11e to an index push bc push hl - ld a,[wd11e] - ld b,a - ld c,0 - ld hl,PokedexOrder + ld a, [wd11e] + ld b, a + ld c, 0 + ld hl, PokedexOrder .loop ; go through the list until we find an entry with a matching dex number inc c - ld a,[hli] + ld a, [hli] cp b - jr nz,.loop + jr nz, .loop - ld a,c - ld [wd11e],a + ld a, c + ld [wd11e], a pop hl pop bc ret @@ -627,14 +734,14 @@ IndexToPokedex: ; converts the indexédex number at wd11e to a Pokédex number push bc push hl - ld a,[wd11e] + ld a, [wd11e] dec a - ld hl,PokedexOrder - ld b,0 - ld c,a - add hl,bc - ld a,[hl] - ld [wd11e],a + ld hl, PokedexOrder + ld b, 0 + ld c, a + add hl, bc + ld a, [hl] + ld [wd11e], a pop hl pop bc ret diff --git a/engine/menu/prize_menu.asm b/engine/menu/prize_menu.asm index b48fa99c..2a8dcb83 100755 --- a/engine/menu/prize_menu.asm +++ b/engine/menu/prize_menu.asm @@ -23,8 +23,7 @@ CeladonPrizeMenu: ld [wTopMenuItemX],a call PrintPrizePrice coord hl, 0, 2 - ld b,$08 - ld c,$10 + lb bc, 8, 16 call TextBoxBorder call GetPrizeMenuId call UpdateSprites @@ -32,14 +31,14 @@ CeladonPrizeMenu: call PrintText call HandleMenuInput ; menu choice handler bit 1,a ; keypress = B (Cancel) - jr nz,.NoChoice + jr nz, .noChoice ld a,[wCurrentMenuItem] - cp a,$03 ; "NO,THANKS" choice - jr z,.NoChoice + cp $03 ; "NO,THANKS" choice + jr z, .noChoice call HandlePrizeChoice -.NoChoice - ld hl,wd730 - res 6,[hl] +.noChoice + ld hl, wd730 + res 6, [hl] ret RequireCoinCaseTextPtr: @@ -64,70 +63,70 @@ GetPrizeMenuId: ; display the three prizes' names ; (distinguishing between Pokemon names ; and Items (specifically TMs) names) - ld a,[hSpriteIndexOrTextID] - sub a,3 ; prize-texts' id are 3, 4 and 5 - ld [wWhichPrizeWindow],a ; prize-texts' id (relative, i.e. 0, 1 or 2) + ld a, [hSpriteIndexOrTextID] + sub 3 ; prize-texts' id are 3, 4 and 5 + ld [wWhichPrizeWindow], a ; prize-texts' id (relative, i.e. 0, 1 or 2) add a add a - ld d,0 - ld e,a - ld hl,PrizeDifferentMenuPtrs - add hl,de - ld a,[hli] - ld d,[hl] - ld e,a + ld d, $0 + ld e, a + ld hl, PrizeDifferentMenuPtrs + add hl, de + ld a, [hli] + ld d, [hl] + ld e, a inc hl push hl - ld hl,wPrize1 + ld hl, wPrize1 call CopyString pop hl - ld a,[hli] - ld h,[hl] - ld l,a - ld de,wPrize1Price - ld bc,6 + ld a, [hli] + ld h, [hl] + ld l, a + ld de, wPrize1Price + ld bc, $6 call CopyData - ld a,[wWhichPrizeWindow] - cp a,$02 ;is TM_menu? - jr nz,.putMonName - ld a,[wPrize1] - ld [wd11e],a + ld a, [wWhichPrizeWindow] + cp $02 ;is TM_menu? + jr nz, .putMonName + ld a, [wPrize1] + ld [wd11e], a call GetItemName coord hl, 2, 4 call PlaceString - ld a,[wPrize2] - ld [wd11e],a + ld a, [wPrize2] + ld [wd11e], a call GetItemName coord hl, 2, 6 call PlaceString - ld a,[wPrize3] - ld [wd11e],a + ld a, [wPrize3] + ld [wd11e], a call GetItemName coord hl, 2, 8 call PlaceString jr .putNoThanksText .putMonName - ld a,[wPrize1] - ld [wd11e],a + ld a, [wPrize1] + ld [wd11e], a call GetMonName coord hl, 2, 4 call PlaceString - ld a,[wPrize2] - ld [wd11e],a + ld a, [wPrize2] + ld [wd11e], a call GetMonName coord hl, 2, 6 call PlaceString - ld a,[wPrize3] - ld [wd11e],a + ld a, [wPrize3] + ld [wd11e], a call GetMonName coord hl, 2, 8 call PlaceString .putNoThanksText coord hl, 2, 10 - ld de,NoThanksText + ld de, NoThanksText call PlaceString ; put prices on the right side of the textbox - ld de,wPrize1Price + ld de, wPrize1Price coord hl, 13, 5 ; reg. c: ; [low nybble] number of bytes @@ -138,91 +137,93 @@ GetPrizeMenuId: call PrintBCDNumber ld de,wPrize2Price coord hl, 13, 7 - ld c,(%1 << 7 | 2) + ld c, (1 << 7 | 2) call PrintBCDNumber - ld de,wPrize3Price + ld de, wPrize3Price coord hl, 13, 9 - ld c,(1 << 7 | 2) + ld c, (1 << 7 | 2) jp PrintBCDNumber +NoThanksText: + db "NO THANKS@" + INCLUDE "data/prizes.asm" PrintPrizePrice: coord hl, 11, 0 - ld b,$01 - ld c,$07 + lb bc, 1, 7 call TextBoxBorder call UpdateSprites coord hl, 12, 0 - ld de,.CoinText + ld de, CoinString call PlaceString coord hl, 13, 1 - ld de,.SixSpacesText + ld de, SixSpacesString call PlaceString coord hl, 13, 1 ld de,wPlayerCoins - ld c,%10000010 + ld c, (1 << 7 | 2) call PrintBCDNumber ret -.CoinText +CoinString: db "COIN@" -.SixSpacesText +SixSpacesString: db " @" LoadCoinsToSubtract: ld a,[wWhichPrize] add a - ld d,0 - ld e,a - ld hl,wPrize1Price - add hl,de ; get selected prize's price + ld d, $0 + ld e, a + ld hl, wPrize1Price + add hl, de ; get selected prize's price xor a - ld [hUnusedCoinsByte],a - ld a,[hli] - ld [hCoins],a - ld a,[hl] - ld [hCoins + 1],a + ld [hUnusedCoinsByte], a + ld a, [hli] + ld [hCoins], a + ld a, [hl] + ld [hCoins + 1], a ret HandlePrizeChoice: - ld a,[wCurrentMenuItem] - ld [wWhichPrize],a - ld d,0 - ld e,a - ld hl,wPrize1 - add hl,de - ld a,[hl] - ld [wd11e],a - ld a,[wWhichPrizeWindow] - cp a,$02 ; is prize a TM? - jr nz,.GetMonName + ld a, [wCurrentMenuItem] + ld [wWhichPrize], a + ld d, $0 + ld e, a + ld hl, wPrize1 + add hl, de + ld a, [hl] + ld [wd11e], a + ld a, [wWhichPrizeWindow] + cp $02 ; is prize a TM? + jr nz, .getMonName call GetItemName - jr .GivePrize -.GetMonName + jr .givePrize +.getMonName call GetMonName -.GivePrize +.givePrize ld hl,SoYouWantPrizeTextPtr call PrintText call YesNoChoice - ld a,[wCurrentMenuItem] ; yes/no answer (Y=0, N=1) + ld a, [wCurrentMenuItem] ; yes/no answer (Y=0, N=1) and a - jr nz,.PrintOhFineThen + jr nz, .printOhFineThen call LoadCoinsToSubtract call HasEnoughCoins - jr c,.NotEnoughCoins - ld a,[wWhichPrizeWindow] - cp a,$02 - jr nz,.GiveMon + jr c, .notEnoughCoins + ld a, [wWhichPrizeWindow] + cp $02 + jr nz, .giveMon ld a,[wd11e] - ld b,a - ld a,1 - ld c,a + ld b, a + ld a, 1 + ld c, a call GiveItem - jr nc,.BagFull - jr .SubtractCoins -.GiveMon + jr nc, .bagFull + jr .subtractCoins +.giveMon ld a,[wd11e] ld [wcf91],a push af @@ -243,24 +244,24 @@ HandlePrizeChoice: ; were full), return without subtracting coins. ret nc -.SubtractCoins +.subtractCoins call LoadCoinsToSubtract ld hl,hCoins + 1 ld de,wPlayerCoins + 1 ld c,$02 ; how many bytes predef SubBCDPredef jp PrintPrizePrice -.BagFull +.bagFull ld hl,PrizeRoomBagIsFullTextPtr jp PrintText -.NotEnoughCoins +.notEnoughCoins ld hl,SorryNeedMoreCoinsText jp PrintText -.PrintOhFineThen +.printOhFineThen ld hl,OhFineThenTextPtr jp PrintText -UnknownData52951: +UnknownData528b1: ; XXX what's this? db $00,$01,$00,$01,$00,$01,$00,$00,$01 @@ -289,18 +290,18 @@ OhFineThenTextPtr: db "@" GetPrizeMonLevel: - ld a,[wcf91] - ld b,a - ld hl,PrizeMonLevelDictionary + ld a, [wcf91] + ld b, a + ld hl, PrizeMonLevelDictionary .loop - ld a,[hli] + ld a, [hli] cp b - jr z,.matchFound + jr z, .matchFound inc hl jr .loop .matchFound - ld a,[hl] - ld [wCurEnemyLVL],a + ld a, [hl] + ld [wCurEnemyLVL], a ret INCLUDE "data/prize_mon_levels.asm" diff --git a/engine/menu/start_menu.asm b/engine/menu/start_menu.asm index 029d8c01..16a9973d 100755 --- a/engine/menu/start_menu.asm +++ b/engine/menu/start_menu.asm @@ -1,85 +1,84 @@ DisplayStartMenu:: - ld a,BANK(StartMenu_Pokedex) - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - ld a,[wWalkBikeSurfState] ; walking/biking/surfing - ld [wWalkBikeSurfStateCopy],a - ld a, SFX_START_MENU + switchbank StartMenu_Pokedex ; also bank for other functions + ld a, [wWalkBikeSurfState] ; walking/biking/surfing + ld [wWalkBikeSurfStateCopy], a + ld a, $8f ; (SFX_02_3f - SFX_Headers_02) / 3 ; Start menu sound call PlaySound RedisplayStartMenu:: callba DrawStartMenu +RedisplayStartMenu_DoNotDrawStartMenu: callba PrintSafariZoneSteps ; print Safari Zone info, if in Safari Zone call UpdateSprites .loop call HandleMenuInput - ld b,a + ld b, a .checkIfUpPressed - bit 6,a ; was Up pressed? - jr z,.checkIfDownPressed - ld a,[wCurrentMenuItem] ; menu selection + bit 6, a ; was Up pressed? + jr z, .checkIfDownPressed + ld a, [wCurrentMenuItem] ; menu selection and a - jr nz,.loop - ld a,[wLastMenuItem] + jr nz, .loop + ld a, [wLastMenuItem] and a - jr nz,.loop + jr nz, .loop ; if the player pressed tried to go past the top item, wrap around to the bottom - CheckEvent EVENT_GOT_POKEDEX - ld a,6 ; there are 7 menu items with the pokedex, so the max index is 6 - jr nz,.wrapMenuItemId + CheckEvent EVENT_GOT_POKEDEX ; does the player have the pokedex? + ld a, 6 ; there are 7 menu items with the pokedex, so the max index is 6 + jr nz, .wrapMenuItemId dec a ; there are only 6 menu items without the pokedex .wrapMenuItemId - ld [wCurrentMenuItem],a + ld [wCurrentMenuItem], a call EraseMenuCursor jr .loop .checkIfDownPressed - bit 7,a - jr z,.buttonPressed + bit 7, a + jr z, .buttonPressed ; if the player pressed tried to go past the bottom item, wrap around to the top - CheckEvent EVENT_GOT_POKEDEX - ld a,[wCurrentMenuItem] - ld c,7 ; there are 7 menu items with the pokedex - jr nz,.checkIfPastBottom + CheckEvent EVENT_GOT_POKEDEX ; does the player have the pokedex? + ld a, [wCurrentMenuItem] + ld c, 7 ; there are 7 menu items with the pokedex + jr nz, .checkIfPastBottom dec c ; there are only 6 menu items without the pokedex .checkIfPastBottom cp c - jr nz,.loop + jr nz, .loop ; the player went past the bottom, so wrap to the top xor a - ld [wCurrentMenuItem],a + ld [wCurrentMenuItem], a call EraseMenuCursor jr .loop .buttonPressed ; A, B, or Start button pressed call PlaceUnfilledArrowMenuCursor - ld a,[wCurrentMenuItem] - ld [wBattleAndStartSavedMenuItem],a ; save current menu selection - ld a,b - and a,%00001010 ; was the Start button or B button pressed? - jp nz,CloseStartMenu + ld a, [wCurrentMenuItem] + ld [wBattleAndStartSavedMenuItem], a ; save current menu selection + ld a, b + and a, %00001010 ; was the Start button or B button pressed? + jp nz, CloseStartMenu call SaveScreenTilesToBuffer2 ; copy background from wTileMap to wTileMapBackup2 - CheckEvent EVENT_GOT_POKEDEX - ld a,[wCurrentMenuItem] - jr nz,.displayMenuItem + CheckEvent EVENT_GOT_POKEDEX ; does the player have the pokedex? + ld a, [wCurrentMenuItem] + jr nz, .displayMenuItem inc a ; adjust position to account for missing pokedex menu item .displayMenuItem - cp a,0 - jp z,StartMenu_Pokedex - cp a,1 - jp z,StartMenu_Pokemon - cp a,2 - jp z,StartMenu_Item - cp a,3 - jp z,StartMenu_TrainerInfo - cp a,4 - jp z,StartMenu_SaveReset - cp a,5 - jp z,StartMenu_Option + cp a, 0 + jp z, StartMenu_Pokedex + cp a, 1 + jp z, StartMenu_Pokemon + cp a, 2 + jp z, StartMenu_Item + cp a, 3 + jp z, StartMenu_TrainerInfo + cp a, 4 + jp z, StartMenu_SaveReset + cp a, 5 + jp z, StartMenu_Option ; EXIT falls through to here CloseStartMenu:: call Joypad - ld a,[hJoyPressed] - bit 0,a ; was A button newly pressed? - jr nz,CloseStartMenu + ld a, [hJoyPressed] + bit 0, a ; was A button newly pressed? + jr nz, CloseStartMenu call LoadTextBoxTilePatterns jp CloseTextDisplay diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm index 9ae6cbe5..fc553d93 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menu/start_sub_menus.asm @@ -34,7 +34,7 @@ StartMenu_Pokemon: ld [wTextBoxID],a call DisplayTextBoxID ; display pokemon menu options ld hl,wFieldMoves - lb bc, $02, $0c ; max menu item ID, top menu item Y + lb bc, 2, 12 ; max menu item ID, top menu item Y ld e,5 .adjustMenuVariablesLoop dec e @@ -129,7 +129,7 @@ StartMenu_Pokemon: dw .dig dw .teleport dw .softboiled -.fly +.fly ; 11d1b (4:5d1b) bit 2,a ; does the player have the Thunder Badge? jp z,.newBadgeRequired call CheckIfInOutsideMap @@ -144,12 +144,15 @@ StartMenu_Pokemon: call ChooseFlyDestination ld a,[wd732] bit 3,a ; did the player decide to fly? - jp nz,.goBackToMap + jr nz,.asm_5d4c call LoadFontTilePatterns ld hl,wd72e set 1,[hl] jp StartMenu_Pokemon -.cut +.asm_5d4c + call Func_1510 + jp .goBackToMap +.cut ; 11d52 (4:5d52) bit 1,a ; does the player have the Cascade Badge? jp z,.newBadgeRequired predef UsedCut @@ -157,7 +160,7 @@ StartMenu_Pokemon: and a jp z,.loop jp CloseTextDisplay -.surf +.surf ; 11d66 (4:5d66) bit 4,a ; does the player have the Soul Badge? jp z,.newBadgeRequired callba IsSurfingAllowed @@ -165,22 +168,35 @@ StartMenu_Pokemon: bit 1,[hl] res 1,[hl] jp z,.loop + ld a, [wcf91] + cp PIKACHU ; is this surfing pikachu? + jr z, .surfingPikachu + ld a, $1 + jr .continue +.surfingPikachu + ld a, $2 +.continue + ld [wd473], a ld a,SURFBOARD ld [wcf91],a ld [wPseudoItemID],a call UseItem ld a,[wActionResultOrTookBattleTurn] and a - jp z,.loop + jr z,.reloadNormalSprite call GBPalWhiteOutWithDelay3 jp .goBackToMap -.strength +.reloadNormalSprite + xor a + ld [wd473], a + jp .loop +.strength ; 11dab (4:5dab) bit 3,a ; does the player have the Rainbow Badge? jp z,.newBadgeRequired predef PrintStrengthTxt call GBPalWhiteOutWithDelay3 jp .goBackToMap -.flash +.flash ; 11dbb (4:5dbb) bit 0,a ; does the player have the Boulder Badge? jp z,.newBadgeRequired xor a @@ -192,7 +208,7 @@ StartMenu_Pokemon: .flashLightsAreaText TX_FAR _FlashLightsAreaText db "@" -.dig +.dig ; 11dd5 (4:5dd5) ld a,ESCAPE_ROPE ld [wcf91],a ld [wPseudoItemID],a @@ -202,7 +218,7 @@ StartMenu_Pokemon: jp z,.loop call GBPalWhiteOutWithDelay3 jp .goBackToMap -.teleport +.teleport ; 11ded (4:5ded) call CheckIfInOutsideMap jr z,.canTeleport ld a,[wWhichPokemon] @@ -217,12 +233,13 @@ StartMenu_Pokemon: ld hl,wd732 set 3,[hl] set 6,[hl] + call Func_1510 ld hl,wd72e set 1,[hl] res 4,[hl] ld c,60 call DelayFrames - call GBPalWhiteOutWithDelay3 ; zero all three palettes and wait 3 V-blanks + call GBPalWhiteOutWithDelay3 ; zero all three palettes and wait 3 frames jp .goBackToMap .warpToLastPokemonCenterText TX_FAR _WarpToLastPokemonCenterText @@ -233,7 +250,7 @@ StartMenu_Pokemon: .cannotFlyHereText TX_FAR _CannotFlyHereText db "@" -.softboiled +.softboiled ; 11e35 (4:5e35) ld hl,wPartyMon1MaxHP ld a,[wWhichPokemon] ld bc,wPartyMon2 - wPartyMon1 @@ -307,11 +324,10 @@ StartMenu_Item: call PrintText jr .exitMenu .notInCableClubRoom - ld bc,wNumBagItems ld hl,wListPointer - ld a,c - ld [hli],a - ld [hl],b ; store item bag pointer in wListPointer (for DisplayListMenuID) + ld [hl], wNumBagItems & $ff + inc hl + ld [hl], wNumBagItems / $100 ; store item bag pointer in wListPointer (for DisplayListMenuID) xor a ld [wPrintItemPrices],a ld a,ITEMLISTMENU @@ -515,10 +531,11 @@ StartMenu_TrainerInfo: call LoadScreenTilesFromBuffer2 ; restore saved screen call RunDefaultPaletteCommand call ReloadMapData + callba DrawStartMenu ; XXX what difference does this make? call LoadGBPal pop af ld [hTilesetType],a - jp RedisplayStartMenu + jp RedisplayStartMenu_DoNotDrawStartMenu ; loads tile patterns and draws everything except for gym leader faces / badges DrawTrainerInfo: @@ -552,7 +569,7 @@ DrawTrainerInfo: ld de,vChars2 + $200 ld bc,$0400 ld a,$03 - call FarCopyData2 + call FarCopyData ld hl,TextBoxGraphics ld de,$00d0 add hl,de ; hl = colon tile pattern @@ -560,7 +577,7 @@ DrawTrainerInfo: ld bc,$0010 ld a,$04 push bc - call FarCopyData2 + call FarCopyData pop bc ld hl,TrainerInfoTextBoxTileGraphics + $80 ; background tile pattern ld de,vChars1 + $570 @@ -612,7 +629,7 @@ DrawTrainerInfo: TrainerInfo_FarCopyData: ld a,BANK(TrainerInfoTextBoxTileGraphics) - jp FarCopyData2 + jp FarCopyData TrainerInfo_NameMoneyTimeText: db "NAME/" diff --git a/engine/menu/status_screen.asm b/engine/menu/status_screen.asm index a7076d35..4adfb543 100755 --- a/engine/menu/status_screen.asm +++ b/engine/menu/status_screen.asm @@ -40,7 +40,7 @@ DrawHP_: push hl call DrawHPBar pop hl - ld a, [hFlags_0xFFF6] + ld a, [hFlags_0xFFFA] bit 0, a jr z, .printFractionBelowBar ld bc, $9 ; right of bar @@ -170,8 +170,25 @@ StatusScreen: call GBPalNormal coord hl, 1, 0 call LoadFlippedFrontSpriteByMonIndex ; draw Pokémon picture + ld a, [wMonDataLocation] + cp ENEMY_PARTY_DATA + jr z, .playRegularCry + cp BOX_DATA + jr z, .checkBoxData + callab IsThisPartymonStarterPikachu_Party + jr nc, .playRegularCry + jr .playPikachuSoundClip +.checkBoxData + callab IsThisPartymonStarterPikachu_Box + jr nc, .playRegularCry +.playPikachuSoundClip + ld e, 16 + callab PlayPikachuSoundClip + jr .continue +.playRegularCry ld a, [wcf91] call PlayCry ; play Pokémon cry +.continue call WaitForTextScrollButtonPress ; wait for button pop af ld [hTilesetType], a @@ -249,16 +266,14 @@ PrintStatsBox: and a ; a is 0 from the status screen jr nz, .DifferentBox coord hl, 0, 8 - ld b, $8 - ld c, $8 + lb bc, 8, 8 call TextBoxBorder ; Draws the box coord hl, 1, 9 ; Start printing stats from here ld bc, $0019 ; Number offset jr .PrintStats .DifferentBox coord hl, 9, 2 - ld b, $8 - ld c, $9 + lb bc, 8, 9 call TextBoxBorder coord hl, 11, 3 ld bc, $0018 @@ -279,7 +294,7 @@ PrintStatsBox: call PrintStat ld de, wLoadedMonSpecial jp PrintNumber -PrintStat +PrintStat: push hl call PrintNumber pop hl @@ -313,8 +328,7 @@ StatusScreen2: coord hl, 19, 3 ld [hl], $78 coord hl, 0, 8 - ld b, 8 - ld c, 18 + lb bc, 8, 18 call TextBoxBorder ; Draw move container coord hl, 2, 9 ld de, wMovesString diff --git a/engine/menu/swap_items.asm b/engine/menu/swap_items.asm new file mode 100644 index 00000000..b1fa78be --- /dev/null +++ b/engine/menu/swap_items.asm @@ -0,0 +1,149 @@ +HandleItemListSwapping: + ld a,[wListMenuID] + cp a,ITEMLISTMENU + jp nz,DisplayListMenuIDLoop ; only rearrange item list menus + push hl + ld hl,wListPointer + ld a,[hli] + ld h,[hl] + ld l,a + inc hl ; hl = beginning of list entries + ld a,[wCurrentMenuItem] + ld b,a + ld a,[wListScrollOffset] + add b + add a + ld c,a + ld b,0 + add hl,bc ; hl = address of currently selected item entry + ld a,[hl] + pop hl + inc a + jp z,DisplayListMenuIDLoop ; ignore attempts to swap the Cancel menu item + ld a,[wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) + and a ; has the first item to swap already been chosen? + jr nz,.swapItems +; if not, set the currently selected item as the first item + ld a,[wCurrentMenuItem] + inc a + ld b,a + ld a,[wListScrollOffset] ; index of top (visible) menu item within the list + add b + ld [wMenuItemToSwap],a ; ID of item chosen for swapping (counts from 1) + ld c,20 + call DelayFrames + jp DisplayListMenuIDLoop +.swapItems + ld a,[wCurrentMenuItem] + inc a + ld b,a + ld a,[wListScrollOffset] + add b + ld b,a + ld a,[wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) + cp b ; is the currently selected item the same as the first item to swap? + jp z,DisplayListMenuIDLoop ; ignore attempts to swap an item with itself + dec a + ld [wMenuItemToSwap],a ; ID of item chosen for swapping (counts from 1) + ld c,20 + call DelayFrames + push hl + push de + ld hl,wListPointer + ld a,[hli] + ld h,[hl] + ld l,a + inc hl ; hl = beginning of list entries + ld d,h + ld e,l ; de = beginning of list entries + ld a,[wCurrentMenuItem] + ld b,a + ld a,[wListScrollOffset] + add b + add a + ld c,a + ld b,0 + add hl,bc ; hl = address of currently selected item entry + ld a,[wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) + add a + add e + ld e,a + jr nc,.noCarry + inc d +.noCarry ; de = address of first item to swap + ld a,[de] + ld b,a + ld a,[hli] + cp b + jr z,.swapSameItemType +.swapDifferentItems + ld [$ff95],a ; [$ff95] = second item ID + ld a,[hld] + ld [$ff96],a ; [$ff96] = second item quantity + ld a,[de] + ld [hli],a ; put first item ID in second item slot + inc de + ld a,[de] + ld [hl],a ; put first item quantity in second item slot + ld a,[$ff96] + ld [de],a ; put second item quantity in first item slot + dec de + ld a,[$ff95] + ld [de],a ; put second item ID in first item slot + xor a + ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped + pop de + pop hl + jp DisplayListMenuIDLoop +.swapSameItemType + inc de + ld a,[hl] + ld b,a + ld a,[de] + add b ; a = sum of both item quantities + cp a,100 ; is the sum too big for one item slot? + jr c,.combineItemSlots +; swap enough items from the first slot to max out the second slot if they can't be combined + sub a,99 + ld [de],a + ld a,99 + ld [hl],a + jr .done +.combineItemSlots + ld [hl],a ; put the sum in the second item slot + ld hl,wListPointer + ld a,[hli] + ld h,[hl] + ld l,a + dec [hl] ; decrease the number of items + ld a,[hl] + ld [wListCount],a ; update number of items variable + cp a,1 + jr nz,.skipSettingMaxMenuItemID + ld [wMaxMenuItem],a ; if the number of items is only one now, update the max menu item ID +.skipSettingMaxMenuItemID + dec de + ld h,d + ld l,e + inc hl + inc hl ; hl = address of item after first item to swap +.moveItemsUpLoop ; erase the first item slot and move up all the following item slots to fill the gap + ld a,[hli] + ld [de],a + inc de + inc a ; reached the $ff terminator? + jr z,.afterMovingItemsUp + ld a,[hli] + ld [de],a + inc de + jr .moveItemsUpLoop +.afterMovingItemsUp + xor a + ld [wListScrollOffset],a + ld [wCurrentMenuItem],a +.done + xor a + ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped + pop de + pop hl + jp DisplayListMenuIDLoop diff --git a/engine/menu/text_ids1.asm b/engine/menu/text_ids1.asm new file mode 100644 index 00000000..e2fd76f4 --- /dev/null +++ b/engine/menu/text_ids1.asm @@ -0,0 +1,163 @@ +; function that performs initialization for DisplayTextID +DisplayTextIDInit: + xor a + ld [wListMenuID],a + ld a,[wAutoTextBoxDrawingControl] + bit 0,a + jr nz,.skipDrawingTextBoxBorder + ld a,[hSpriteIndexOrTextID] ; text ID (or sprite ID) + and a + jr nz,.notStartMenu +; if text ID is 0 (i.e. the start menu) +; Note that the start menu text border is also drawn in the function directly +; below this, so this seems unnecessary. + CheckEvent EVENT_GOT_POKEDEX +; start menu with pokedex + coord hl, 10, 0 + lb bc, 14, 8 + jr nz,.drawTextBoxBorder +; start menu without pokedex + coord hl, 10, 0 + lb bc, 12, 8 + jr .drawTextBoxBorder +; if text ID is not 0 (i.e. not the start menu) then do a standard dialogue text box +.notStartMenu + coord hl, 0, 12 + lb bc, 4, 18 +.drawTextBoxBorder + call TextBoxBorder +.skipDrawingTextBoxBorder + ld hl,wFontLoaded + set 0,[hl] + ld hl,wFlags_0xcd60 + bit 4,[hl] + res 4,[hl] + jr nz,.skipMovingSprites + call UpdateSprites +.skipMovingSprites +; loop to copy C1X9 (direction the sprite is facing) to C2X9 for each sprite +; this is done because when you talk to an NPC, they turn to look your way +; the original direction they were facing must be restored after the dialogue is over + ld hl,wSpriteStateData1 + $19 + ld c,$0f + ld de,$0010 +.spriteFacingDirectionCopyLoop + ld a,[hl] + inc h + ld [hl],a + dec h + add hl,de + dec c + jr nz,.spriteFacingDirectionCopyLoop +; loop to force all the sprites in the middle of animation to stand still +; (so that they don't like they're frozen mid-step during the dialogue) + ld hl,wSpriteStateData1 + 2 + ld de,$0010 + ld c,e +.spriteStandStillLoop + ld a,[hl] + cp a,$ff ; is the sprite visible? + jr z,.nextSprite +; if it is visible + and a,$fc + ld [hl],a +.nextSprite + add hl,de + dec c + jr nz,.spriteStandStillLoop + ld b,vBGMap1 / $100 ; window background address + call CopyScreenTileBufferToVRAM ; transfer background in WRAM to VRAM + xor a + ld [hWY],a ; put the window on the screen + call LoadFontTilePatterns + ld a,$01 + ld [H_AUTOBGTRANSFERENABLED],a ; enable continuous WRAM to VRAM transfer each V-blank + ret + +; function that displays the start menu +DrawStartMenu: + CheckEvent EVENT_GOT_POKEDEX +; menu with pokedex + coord hl, 10, 0 + lb bc, 14, 8 + jr nz,.drawTextBoxBorder +; shorter menu if the player doesn't have the pokedex + coord hl, 10, 0 + lb bc, 12, 8 +.drawTextBoxBorder + call TextBoxBorder + ld a,D_DOWN | D_UP | START | B_BUTTON | A_BUTTON + ld [wMenuWatchedKeys],a + ld a,$02 + ld [wTopMenuItemY],a ; Y position of first menu choice + ld a,$0b + ld [wTopMenuItemX],a ; X position of first menu choice + ld a,[wBattleAndStartSavedMenuItem] ; remembered menu selection from last time + ld [wCurrentMenuItem],a + ld [wLastMenuItem],a + xor a + ld [wMenuWatchMovingOutOfBounds],a + ld hl,wd730 + set 6,[hl] ; no pauses between printing each letter + coord hl, 12, 2 + CheckEvent EVENT_GOT_POKEDEX +; case for not having pokdex + ld a,$06 + jr z,.storeMenuItemCount +; case for having pokedex + ld de,StartMenuPokedexText + call PrintStartMenuItem + ld a,$07 +.storeMenuItemCount + ld [wMaxMenuItem],a ; number of menu items + ld de,StartMenuPokemonText + call PrintStartMenuItem + ld de,StartMenuItemText + call PrintStartMenuItem + ld de,wPlayerName ; player's name + call PrintStartMenuItem + ld a,[wd72e] + bit 6,a ; is the player using the link feature? +; case for not using link feature + ld de,StartMenuSaveText + jr z,.printSaveOrResetText +; case for using link feature + ld de,StartMenuResetText +.printSaveOrResetText + call PrintStartMenuItem + ld de,StartMenuOptionText + call PrintStartMenuItem + ld de,StartMenuExitText + call PlaceString + ld hl,wd730 + res 6,[hl] ; turn pauses between printing letters back on + ret + +StartMenuPokedexText: + db "POKéDEX@" + +StartMenuPokemonText: + db "#MON@" + +StartMenuItemText: + db "ITEM@" + +StartMenuSaveText: + db "SAVE@" + +StartMenuResetText: + db "RESET@" + +StartMenuExitText: + db "EXIT@" + +StartMenuOptionText: + db "OPTION@" + +PrintStartMenuItem: + push hl + call PlaceString + pop hl + ld de,SCREEN_WIDTH * 2 + add hl,de + ret diff --git a/engine/menu/text_ids2.asm b/engine/menu/text_ids2.asm new file mode 100644 index 00000000..fbac3986 --- /dev/null +++ b/engine/menu/text_ids2.asm @@ -0,0 +1,733 @@ +; function to draw various text boxes +DisplayTextBoxID_: + ld a,[wTextBoxID] + cp a,TWO_OPTION_MENU + jp z,DisplayTwoOptionMenu + ld c,a + ld hl,TextBoxFunctionTable + ld de,3 + call SearchTextBoxTable + jr c,.functionTableMatch + ld hl,TextBoxCoordTable + ld de,5 + call SearchTextBoxTable + jr c,.coordTableMatch + ld hl,TextBoxTextAndCoordTable + ld de,9 + call SearchTextBoxTable + jr c,.textAndCoordTableMatch +.done + ret +.functionTableMatch + ld a,[hli] + ld h,[hl] + ld l,a ; hl = address of function + ld de,.done + push de + jp [hl] ; jump to the function +.coordTableMatch + call GetTextBoxIDCoords + call GetAddressOfScreenCoords + call TextBoxBorder + ret +.textAndCoordTableMatch + call GetTextBoxIDCoords + push hl + call GetAddressOfScreenCoords + call TextBoxBorder + pop hl + call GetTextBoxIDText + ld a,[wd730] + push af + ld a,[wd730] + set 6,a ; no pauses between printing each letter + ld [wd730],a + call PlaceString + pop af + ld [wd730],a + call UpdateSprites + ret + +; function to search a table terminated with $ff for a byte matching c in increments of de +; sets carry flag if a match is found and clears carry flag if not +SearchTextBoxTable: + dec de +.loop + ld a,[hli] + cp a,$ff + jr z,.notFound + cp c + jr z,.found + add hl,de + jr .loop +.found + scf +.notFound + ret + +; function to load coordinates from the TextBoxCoordTable or the TextBoxTextAndCoordTable +; INPUT: +; hl = address of coordinates +; OUTPUT: +; b = height +; c = width +; d = row of upper left corner +; e = column of upper left corner +GetTextBoxIDCoords: + ld a,[hli] ; column of upper left corner + ld e,a + ld a,[hli] ; row of upper left corner + ld d,a + ld a,[hli] ; column of lower right corner + sub e + dec a + ld c,a ; c = width + ld a,[hli] ; row of lower right corner + sub d + dec a + ld b,a ; b = height + ret + +; function to load a text address and text coordinates from the TextBoxTextAndCoordTable +GetTextBoxIDText: + ld a,[hli] + ld e,a + ld a,[hli] + ld d,a ; de = address of text + push de ; save text address + ld a,[hli] + ld e,a ; column of upper left corner of text + ld a,[hl] + ld d,a ; row of upper left corner of text + call GetAddressOfScreenCoords + pop de ; restore text address + ret + +; function to point hl to the screen coordinates +; INPUT: +; d = row +; e = column +; OUTPUT: +; hl = address of upper left corner of text box +GetAddressOfScreenCoords: + push bc + coord hl, 0, 0 + ld bc,20 +.loop ; loop to add d rows to the base address + ld a,d + and a + jr z,.addedRows + add hl,bc + dec d + jr .loop +.addedRows + pop bc + add hl,de + ret + +; Format: +; 00: text box ID +; 01-02: function address +TextBoxFunctionTable: + dbw MONEY_BOX, DisplayMoneyBox + dbw BUY_SELL_QUIT_MENU, DoBuySellQuitMenu + dbw FIELD_MOVE_MON_MENU, DisplayFieldMoveMonMenu + db $ff ; terminator + +; Format: +; 00: text box ID +; 01: column of upper left corner +; 02: row of upper left corner +; 03: column of lower right corner +; 04: row of lower right corner +TextBoxCoordTable: + db MESSAGE_BOX, 0, 12, 19, 17 + db $03, 0, 0, 19, 14 + db $07, 0, 0, 11, 6 + db LIST_MENU_BOX, 4, 2, 19, 12 + db $10, 7, 0, 19, 17 + db MON_SPRITE_POPUP, 6, 4, 14, 13 + db $ff ; terminator + +; Format: +; 00: text box ID +; 01: column of upper left corner +; 02: row of upper left corner +; 03: column of lower right corner +; 04: row of lower right corner +; 05-06: address of text +; 07: column of beginning of text +; 08: row of beginning of text +; table of window positions and corresponding text [key, start column, start row, end column, end row, text pointer [2 bytes], text column, text row] +TextBoxTextAndCoordTable: + db JP_MOCHIMONO_MENU_TEMPLATE + db 0,0,14,17 ; text box coordinates + dw JapaneseMochimonoText + db 3,0 ; text coordinates + + db USE_TOSS_MENU_TEMPLATE + db 13,10,19,14 ; text box coordinates + dw UseTossText + db 15,11 ; text coordinates + + db JP_SAVE_MESSAGE_MENU_TEMPLATE + db 0,0,7,5 ; text box coordinates + dw JapaneseSaveMessageText + db 2,2 ; text coordinates + + db JP_SPEED_OPTIONS_MENU_TEMPLATE + db 0,6,5,10 ; text box coordinates + dw JapaneseSpeedOptionsText + db 2,7 ; text coordinates + + db BATTLE_MENU_TEMPLATE + db 8,12,19,17 ; text box coordinates + dw BattleMenuText + db 10,14 ; text coordinates + + db SAFARI_BATTLE_MENU_TEMPLATE + db 0,12,19,17 ; text box coordinates + dw SafariZoneBattleMenuText + db 2,14 ; text coordinates + + db SWITCH_STATS_CANCEL_MENU_TEMPLATE + db 11,11,19,17 ; text box coordinates + dw SwitchStatsCancelText + db 13,12 ; text coordinates + + db BUY_SELL_QUIT_MENU_TEMPLATE + db 0,0,10,6 ; text box coordinates + dw BuySellQuitText + db 2,1 ; text coordinates + + db MONEY_BOX_TEMPLATE + db 11,0,19,2 ; text box coordinates + dw MoneyText + db 13,0 ; text coordinates + + db JP_AH_MENU_TEMPLATE + db 7,6,11,10 ; text box coordinates + dw JapaneseAhText + db 8,8 ; text coordinates + + db JP_POKEDEX_MENU_TEMPLATE + db 11,8,19,17 ; text box coordinates + dw JapanesePokedexMenu + db 12,10 ; text coordinates + +; note that there is no terminator + +BuySellQuitText: + db "BUY" + next "SELL" + next "QUIT@@" + +UseTossText: + db "USE" + next "TOSS@" + +JapaneseSaveMessageText: + db "きろく" + next "メッセージ@" + +JapaneseSpeedOptionsText: + db "はやい" + next "おそい@" + +MoneyText: + db "MONEY@" + +JapaneseMochimonoText: + db "もちもの@" + +JapaneseMainMenuText: + db "つづきから" + next "さいしょから@" + +BattleMenuText: + db "FIGHT ",$E1,$E2 + next "ITEM RUN@" + +SafariZoneBattleMenuText: + db "BALL× BAIT" + next "THROW ROCK RUN@" + +SwitchStatsCancelText: + db "SWITCH" + next "STATS" + next "CANCEL@" + +JapaneseAhText: + db "アッ!@" + +JapanesePokedexMenu: + db "データをみる" + next "なきごえ" + next "ぶんぷをみる" + next "キャンセル@" + +DisplayMoneyBox: + ld hl, wd730 + set 6, [hl] + ld a, MONEY_BOX_TEMPLATE + ld [wTextBoxID], a + call DisplayTextBoxID + coord hl, 13, 1 + lb bc, 1, 6 + call ClearScreenArea + coord hl, 12, 1 + ld de, wPlayerMoney + ld c, $a3 + call PrintBCDNumber + ld hl, wd730 + res 6, [hl] + ret + +CurrencyString: + db " ¥@" + +DoBuySellQuitMenu: + ld a, [wd730] + set 6, a ; no printing delay + ld [wd730], a + xor a + ld [wChosenMenuItem], a + ld a, BUY_SELL_QUIT_MENU_TEMPLATE + ld [wTextBoxID], a + call DisplayTextBoxID + ld a, A_BUTTON | B_BUTTON + ld [wMenuWatchedKeys], a + ld a, $2 + ld [wMaxMenuItem], a + ld a, $1 + ld [wTopMenuItemY], a + ld a, $1 + ld [wTopMenuItemX], a + xor a + ld [wCurrentMenuItem], a + ld [wLastMenuItem], a + ld [wMenuWatchMovingOutOfBounds], a + ld a, [wd730] + res 6, a ; turn on the printing delay + ld [wd730], a + call HandleMenuInput + call PlaceUnfilledArrowMenuCursor + bit 0, a ; was A pressed? + jr nz, .pressedA + bit 1, a ; was B pressed? (always true since only A/B are watched) + jr z, .pressedA + ld a, CANCELLED_MENU + ld [wMenuExitMethod], a + jr .quit +.pressedA + ld a, CHOSE_MENU_ITEM + ld [wMenuExitMethod], a + ld a, [wCurrentMenuItem] + ld [wChosenMenuItem], a + ld b, a + ld a, [wMaxMenuItem] + cp b + jr z, .quit + ret +.quit + ld a, CANCELLED_MENU + ld [wMenuExitMethod], a + ld a, [wCurrentMenuItem] + ld [wChosenMenuItem], a + scf + ret + +; displays a menu with two options to choose from +; b = Y of upper left corner of text region +; c = X of upper left corner of text region +; hl = address where the text box border should be drawn +DisplayTwoOptionMenu: + push hl + ld a, [wd730] + set 6, a ; no printing delay + ld [wd730], a + +; pointless because both values are overwritten before they are read + xor a + ld [wChosenMenuItem], a + ld [wMenuExitMethod], a + + ld a, A_BUTTON | B_BUTTON + ld [wMenuWatchedKeys], a + ld a, $1 + ld [wMaxMenuItem], a + ld a, b + ld [wTopMenuItemY], a + ld a, c + ld [wTopMenuItemX], a + xor a + ld [wLastMenuItem], a + ld [wMenuWatchMovingOutOfBounds], a + push hl + ld hl, wTwoOptionMenuID + bit 7, [hl] ; select second menu item by default? + res 7, [hl] + jr z, .storeCurrentMenuItem + inc a +.storeCurrentMenuItem + ld [wCurrentMenuItem], a + pop hl + push hl + push hl + call TwoOptionMenu_SaveScreenTiles + ld a, [wTwoOptionMenuID] + ld hl, TwoOptionMenuStrings + ld e, a + ld d, $0 + ld a, $5 +.menuStringLoop + add hl, de + dec a + jr nz, .menuStringLoop + ld a, [hli] + ld c, a + ld a, [hli] + ld b, a + ld e, l + ld d, h + pop hl + push de + ld a, [wTwoOptionMenuID] + cp TRADE_CANCEL_MENU + jr nz, .notTradeCancelMenu + call CableClub_TextBoxBorder + jr .afterTextBoxBorder +.notTradeCancelMenu + call TextBoxBorder +.afterTextBoxBorder + call UpdateSprites + pop hl + ld a, [hli] + and a ; put blank line before first menu item? + ld bc, 20 + 2 + jr z, .noBlankLine + ld bc, 2 * 20 + 2 +.noBlankLine + ld a, [hli] + ld e, a + ld a, [hli] + ld d, a + pop hl + add hl, bc + call PlaceString + xor a + ld [wTwoOptionMenuID], a + ld hl, wd730 + res 6, [hl] + call HandleMenuInput + pop hl + bit 1, a ; A button pressed? + jr nz, .choseSecondMenuItem ; automatically choose the second option if B is pressed +.pressedAButton + ld a, [wCurrentMenuItem] + ld [wChosenMenuItem], a + and a + jr nz, .choseSecondMenuItem +; chose first menu item + ld a, CHOSE_FIRST_ITEM + ld [wMenuExitMethod], a + ld c, 15 + call DelayFrames + call TwoOptionMenu_RestoreScreenTiles + and a + ret +.choseSecondMenuItem + ld a, 1 + ld [wCurrentMenuItem], a + ld [wChosenMenuItem], a + ld a, CHOSE_SECOND_ITEM + ld [wMenuExitMethod], a + ld c, 15 + call DelayFrames + call TwoOptionMenu_RestoreScreenTiles + scf + ret + +; Some of the wider/taller two option menus will not have the screen areas +; they cover be fully saved/restored by the two functions below. +; The bottom and right edges of the menu may remain after the function returns. + +TwoOptionMenu_SaveScreenTiles: + ld de, wBuffer + lb bc, 5, 6 +.loop + ld a, [hli] + ld [de], a + inc de + dec c + jr nz, .loop + push bc + ld bc, SCREEN_WIDTH - 6 + add hl, bc + pop bc + ld c, $6 + dec b + jr nz, .loop + ret + +TwoOptionMenu_RestoreScreenTiles: + ld de, wBuffer + lb bc, 5, 6 +.loop + ld a, [de] + inc de + ld [hli], a + dec c + jr nz, .loop + push bc + ld bc, SCREEN_WIDTH - 6 + add hl, bc + pop bc + ld c, 6 + dec b + jr nz, .loop + call UpdateSprites + ret + +; Format: +; 00: byte width +; 01: byte height +; 02: byte put blank line before first menu item +; 03: word text pointer +TwoOptionMenuStrings: + db 4,3,0 + dw .YesNoMenu + db 6,3,0 + dw .NorthWestMenu + db 6,3,0 + dw .SouthEastMenu + db 6,3,0 + dw .YesNoMenu + db 6,3,0 + dw .NorthEastMenu + db 7,3,0 + dw .TradeCancelMenu + db 7,4,1 + dw .HealCancelMenu + db 4,3,0 + dw .NoYesMenu + +.NoYesMenu ; 7542 (1:7542) + db "NO",$4E,"YES@" +.YesNoMenu ; 7549 (1:7549) + db "YES",$4E,"NO@" +.NorthWestMenu ; 7550 (1:7550) + db "NORTH",$4E,"WEST@" +.SouthEastMenu ; 755b (1:755b) + db "SOUTH",$4E,"EAST@" +.NorthEastMenu ; 7566 (1:7566) + db "NORTH",$4E,"EAST@" +.TradeCancelMenu ; 7571 (1:7571) + db "TRADE",$4E,"CANCEL@" +.HealCancelMenu ; 757e (1:757e) + db "HEAL",$4E,"CANCEL@" + +DisplayFieldMoveMonMenu: + xor a + ld hl, wFieldMoves + ld [hli], a ; wFieldMoves + ld [hli], a ; wFieldMoves + 1 + ld [hli], a ; wFieldMoves + 2 + ld [hli], a ; wFieldMoves + 3 + ld [hli], a ; wNumFieldMoves + ld [hl], 12 ; wFieldMovesLeftmostXCoord + call GetMonFieldMoves + ld a, [wNumFieldMoves] + and a + jr nz, .fieldMovesExist + +; no field moves + coord hl, 11, 11 + lb bc, 5, 7 + call TextBoxBorder + call UpdateSprites + ld a, 12 + ld [hFieldMoveMonMenuTopMenuItemX], a ; fffb, not fff7 + coord hl, 13, 12 + ld de, PokemonMenuEntries + jp PlaceString + +.fieldMovesExist + push af + +; Calculate the text box position and dimensions based on the leftmost X coord +; of the field move names before adjusting for the number of field moves. + coord hl, 0, 11 + ld a, [wFieldMovesLeftmostXCoord] + dec a + ld e, a + ld d, 0 + add hl, de + ld b, 5 + ld a, 18 + sub e + ld c, a + pop af + +; For each field move, move the top of the text box up 2 rows while the leaving +; the bottom of the text box at the bottom of the screen. + ld de, -SCREEN_WIDTH * 2 +.textBoxHeightLoop + add hl, de + inc b + inc b + dec a + jr nz, .textBoxHeightLoop + +; Make space for an extra blank row above the top field move. + ld de, -SCREEN_WIDTH + add hl, de + inc b + + call TextBoxBorder + call UpdateSprites + +; Calculate the position of the first field move name to print. + coord hl, 0, 12 + ld a, [wFieldMovesLeftmostXCoord] + inc a + ld e, a + ld d, 0 + add hl, de + ld de, -SCREEN_WIDTH * 2 + ld a, [wNumFieldMoves] +.calcFirstFieldMoveYLoop + add hl, de + dec a + jr nz, .calcFirstFieldMoveYLoop + + xor a + ld [wNumFieldMoves], a + ld de, wFieldMoves +.printNamesLoop + push hl + ld hl, FieldMoveNames + ld a, [de] + and a + jr z, .donePrintingNames + inc de + ld b, a ; index of name +.skipNamesLoop ; skip past names before the name we want + dec b + jr z, .reachedName +.skipNameLoop ; skip past current name + ld a, [hli] + cp "@" + jr nz, .skipNameLoop + jr .skipNamesLoop +.reachedName + ld b, h + ld c, l + pop hl + push de + ld d, b + ld e, c + call PlaceString + ld bc, SCREEN_WIDTH * 2 + add hl, bc + pop de + jr .printNamesLoop + +.donePrintingNames + pop hl + ld a, [wFieldMovesLeftmostXCoord] + ld [hFieldMoveMonMenuTopMenuItemX], a + coord hl, 0, 12 + ld a, [wFieldMovesLeftmostXCoord] + inc a + ld e, a + ld d, 0 + add hl, de + ld de, PokemonMenuEntries + jp PlaceString + +FieldMoveNames: + db "CUT@" + db "FLY@" + db "@" + db "SURF@" + db "STRENGTH@" + db "FLASH@" + db "DIG@" + db "TELEPORT@" + db "SOFTBOILED@" + +PokemonMenuEntries: + db "STATS" + next "SWITCH" + next "CANCEL@" + +GetMonFieldMoves: + ld a, [wWhichPokemon] + ld hl, wPartyMon1Moves + ld bc, wPartyMon2 - wPartyMon1 + call AddNTimes + ld d, h + ld e, l + ld c, NUM_MOVES + 1 + ld hl, wFieldMoves +.loop + push hl +.nextMove + dec c + jr z, .done + ld a, [de] ; move ID + and a + jr z, .done + ld b, a + inc de + ld hl, FieldMoveDisplayData +.fieldMoveLoop + ld a, [hli] + cp $ff + jr z, .nextMove ; if the move is not a field move + cp b + jr z, .foundFieldMove + inc hl + inc hl + jr .fieldMoveLoop +.foundFieldMove + ld a, b + ld [wLastFieldMoveID], a + ld a, [hli] ; field move name index + ld b, [hl] ; field move leftmost X coordinate + pop hl + ld [hli], a ; store name index in wFieldMoves + ld a, [wNumFieldMoves] + inc a + ld [wNumFieldMoves], a + ld a, [wFieldMovesLeftmostXCoord] + cp b + jr c, .skipUpdatingLeftmostXCoord + ld a, b + ld [wFieldMovesLeftmostXCoord], a +.skipUpdatingLeftmostXCoord + ld a, [wLastFieldMoveID] + ld b, a + jr .loop +.done + pop hl + ret + +; Format: [Move id], [name index], [leftmost tile] +; Move id = id of move +; Name index = index of name in FieldMoveNames +; Leftmost tile = -1 + tile column in which the first letter of the move's name should be displayed +; "SOFTBOILED" is $08 because it has 4 more letters than "SURF", for example, whose value is $0C +FieldMoveDisplayData: + db CUT, $01, $0C + db FLY, $02, $0C + db $B4, $03, $0C ; unused field move + db SURF, $04, $0C + db STRENGTH, $05, $0A + db FLASH, $06, $0C + db DIG, $07, $0C + db TELEPORT, $08, $0A + db SOFTBOILED, $09, $08 + db $ff ; list terminator + diff --git a/engine/menu/vending_machine.asm b/engine/menu/vending_machine.asm index b32568f9..d864141d 100755 --- a/engine/menu/vending_machine.asm +++ b/engine/menu/vending_machine.asm @@ -18,8 +18,7 @@ VendingMachineMenu: ld hl, wd730 set 6, [hl] coord hl, 0, 3 - ld b, 8 - ld c, 12 + lb bc, 8, 12 call TextBoxBorder call UpdateSprites coord hl, 2, 5 @@ -130,6 +129,9 @@ LoadVendingMachineItem: ret VendingPrices: - db FRESH_WATER,$00,$02,$00 - db SODA_POP, $00,$03,$00 - db LEMONADE, $00,$03,$50 + db FRESH_WATER + money 200 + db SODA_POP + money 300 + db LEMONADE + money 350 diff --git a/engine/mon_party_sprites.asm b/engine/mon_party_sprites.asm index aa9bdaeb..6f17f876 100755 --- a/engine/mon_party_sprites.asm +++ b/engine/mon_party_sprites.asm @@ -91,7 +91,7 @@ PartyMonSpeeds: LoadMonPartySpriteGfx: ; Load mon party sprite tile patterns into VRAM during V-blank. ld hl, MonPartySpritePointers - ld a, $1c + ld a, $1e LoadAnimSpriteGfx: ; Load animated sprite tile patterns into VRAM during V-blank. hl is the address @@ -130,9 +130,9 @@ LoadMonPartySpriteGfxWithLCDDisabled: ; LCD. call DisableLCD ld hl, MonPartySpritePointers - ld a, $1c + ld a, $1e ld bc, $0 -.asm_7179c +.loop push af push bc push hl @@ -151,7 +151,7 @@ LoadMonPartySpriteGfxWithLCDDisabled: inc hl ld d, [hl] pop hl - call FarCopyData2 + call FarCopyData pop hl pop bc ld a, $6 @@ -159,7 +159,7 @@ LoadMonPartySpriteGfxWithLCDDisabled: ld c, a pop af dec a - jr nz, .asm_7179c + jr nz, .loop jp EnableLCD MonPartySpritePointers: @@ -228,6 +228,11 @@ MonPartySpritePointers: db BANK(MonPartySprites) dw vSprites + $260 + dw PikachuSprite + db $40 / $10 ; $40 bytes + db BANK(PikachuSprite) + dw vSprites + $280 + dw MonPartySprites + $100 db $40 / $10 ; $40 bytes db BANK(MonPartySprites) @@ -298,6 +303,11 @@ MonPartySpritePointers: db BANK(MonPartySprites) dw vSprites + $660 + dw PikachuSprite + $C0 + db $40 / $10 ; $40 bytes + db BANK(PikachuSprite) + dw vSprites + $680 + dw MonPartySprites + $140 db $40 / $10 ; $40 bytes db BANK(MonPartySprites) @@ -309,6 +319,8 @@ WriteMonPartySpriteOAMByPartyIndex: push de push bc ld a, [hPartyMonIndex] + cp $ff + jr z, .asm_7191f ld hl, wPartySpecies ld e, a ld d, 0 @@ -322,6 +334,16 @@ WriteMonPartySpriteOAMByPartyIndex: pop hl ret +.asm_7191f + ld hl, wOAMBuffer + ld de, wMonPartySpritesSavedOAM + ld bc, $60 + call CopyData + pop bc + pop de + pop hl + ret + WriteMonPartySpriteOAMBySpecies: ; Write OAM blocks for the party sprite of the species in ; [wMonPartySpriteSpecies]. @@ -343,7 +365,7 @@ UnusedPartyMonSpriteFunction: ld hl, vSprites call .LoadTilePatterns pop af - add $54 + add $5A ld hl, vSprites + $40 call .LoadTilePatterns xor a diff --git a/engine/move_mon.asm b/engine/move_mon.asm new file mode 100644 index 00000000..3471875e --- /dev/null +++ b/engine/move_mon.asm @@ -0,0 +1,172 @@ +_MoveMon: + ld a, [wMoveMonType] + and a + jr z, .checkPartyMonSlots + cp DAYCARE_TO_PARTY + jr z, .checkPartyMonSlots + cp PARTY_TO_DAYCARE + ld hl, wDayCareMon + jr z, .asm_f3fb + ld hl, wNumInBox + ld a, [hl] + cp MONS_PER_BOX + jr nz, .partyOrBoxNotFull + jr .boxFull +.checkPartyMonSlots + ld hl, wPartyCount + ld a, [hl] + cp PARTY_LENGTH + jr nz, .partyOrBoxNotFull +.boxFull + scf + ret +.partyOrBoxNotFull + inc a + ld [hl], a ; increment number of mons in party/box + ld c, a + ld b, 0 + add hl, bc + ld a, [wMoveMonType] + cp DAYCARE_TO_PARTY + ld a, [wDayCareMon] + jr z, .asm_f3dc + ld a, [wcf91] +.asm_f3dc + ld [hli], a ; write new mon ID + ld [hl], $ff ; write new sentinel + ld a, [wMoveMonType] + dec a + ld hl, wPartyMons + ld bc, wPartyMon2 - wPartyMon1 ; $2c + ld a, [wPartyCount] + jr nz, .skipToNewMonEntry + ld hl, wBoxMons + ld bc, wBoxMon2 - wBoxMon1 ; $21 + ld a, [wNumInBox] +.skipToNewMonEntry + dec a + call AddNTimes +.asm_f3fb + push hl + ld e, l + ld d, h + ld a, [wMoveMonType] + and a + ld hl, wBoxMons + ld bc, wBoxMon2 - wBoxMon1 ; $21 + jr z, .asm_f417 + cp DAYCARE_TO_PARTY + ld hl, wDayCareMon + jr z, .asm_f41d + ld hl, wPartyMons + ld bc, wPartyMon2 - wPartyMon1 ; $2c +.asm_f417 + ld a, [wWhichPokemon] + call AddNTimes +.asm_f41d + push hl + push de + ld bc, wBoxMon2 - wBoxMon1 + call CopyData + pop de + pop hl + ld a, [wMoveMonType] + and a + jr z, .asm_f43a + cp DAYCARE_TO_PARTY + jr z, .asm_f43a + ld bc, wBoxMon2 - wBoxMon1 + add hl, bc + ld a, [hl] + inc de + inc de + inc de + ld [de], a +.asm_f43a + ld a, [wMoveMonType] + cp PARTY_TO_DAYCARE + ld de, wDayCareMonOT + jr z, .asm_f459 + dec a + ld hl, wPartyMonOT + ld a, [wPartyCount] + jr nz, .asm_f453 + ld hl, wBoxMonOT + ld a, [wNumInBox] +.asm_f453 + dec a + call SkipFixedLengthTextEntries + ld d, h + ld e, l +.asm_f459 + ld hl, wBoxMonOT + ld a, [wMoveMonType] + and a + jr z, .asm_f46c + ld hl, wDayCareMonOT + cp DAYCARE_TO_PARTY + jr z, .asm_f472 + ld hl, wPartyMonOT +.asm_f46c + ld a, [wWhichPokemon] + call SkipFixedLengthTextEntries +.asm_f472 + ld bc, NAME_LENGTH + call CopyData + ld a, [wMoveMonType] + cp PARTY_TO_DAYCARE + ld de, wDayCareMonName + jr z, .asm_f497 + dec a + ld hl, wPartyMonNicks + ld a, [wPartyCount] + jr nz, .asm_f491 + ld hl, wBoxMonNicks + ld a, [wNumInBox] +.asm_f491 + dec a + call SkipFixedLengthTextEntries + ld d, h + ld e, l +.asm_f497 + ld hl, wBoxMonNicks + ld a, [wMoveMonType] + and a + jr z, .asm_f4aa + ld hl, wDayCareMonName + cp DAYCARE_TO_PARTY + jr z, .asm_f4b0 + ld hl, wPartyMonNicks +.asm_f4aa + ld a, [wWhichPokemon] + call SkipFixedLengthTextEntries +.asm_f4b0 + ld bc, NAME_LENGTH + call CopyData + pop hl + ld a, [wMoveMonType] + cp PARTY_TO_BOX + jr z, .asm_f4ea + cp PARTY_TO_DAYCARE + jr z, .asm_f4ea + push hl + srl a + add $2 + ld [wMonDataLocation], a + call LoadMonData + callba CalcLevelFromExperience + ld a, d + ld [wCurEnemyLVL], a + pop hl + ld bc, wBoxMon2 - wBoxMon1 + add hl, bc + ld [hli], a + ld d, h + ld e, l + ld bc, -18 + add hl, bc + ld b, $1 + call CalcStats +.asm_f4ea + and a + ret diff --git a/engine/multiply_divide.asm b/engine/multiply_divide.asm index 52e86b36..2bc26de2 100755 --- a/engine/multiply_divide.asm +++ b/engine/multiply_divide.asm @@ -2,16 +2,17 @@ _Multiply: ld a, $8 ld b, a xor a - ld [H_PRODUCT], a - ld [H_MULTIPLYBUFFER], a - ld [H_MULTIPLYBUFFER+1], a - ld [H_MULTIPLYBUFFER+2], a - ld [H_MULTIPLYBUFFER+3], a -.loop - ld a, [H_MULTIPLIER] + ld [H_PRODUCT], a ; $ff95 + ld [H_MULTIPLYBUFFER], a ; $ff9b + ld [H_MULTIPLYBUFFER+1], a ; $ff9c + ld [H_MULTIPLYBUFFER+2], a ; $ff9d + ld [H_MULTIPLYBUFFER+3], a ; $ff9e +.multiplyLoop + ld a, [H_MULTIPLIER] ; $ff99 srl a - ld [H_MULTIPLIER], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) - jr nc, .smallMultiplier + ld [H_MULTIPLIER], a ; $ff99 + jr nc, .smallMultiplier ; less than $80 +; code to possibly multiply the multiplicand by 2 and divide the multiplier by 2? ld a, [H_MULTIPLYBUFFER+3] ld c, a ld a, [H_MULTIPLICAND+2] @@ -22,14 +23,14 @@ _Multiply: ld a, [H_MULTIPLICAND+1] adc c ld [H_MULTIPLYBUFFER+2], a - ld a, [H_MULTIPLYBUFFER+1] + ld a, [H_MULTIPLYBUFFER+1] ; $ff9c ld c, a - ld a, [H_MULTIPLICAND] ; (aliases: H_MULTIPLICAND) + ld a, [H_MULTIPLICAND] ; $ff96 adc c - ld [H_MULTIPLYBUFFER+1], a + ld [H_MULTIPLYBUFFER+1], a ; $ff9c ld a, [H_MULTIPLYBUFFER] ld c, a - ld a, [H_PRODUCT] ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld a, [H_PRODUCT] ; $ff95 adc c ld [H_MULTIPLYBUFFER], a .smallMultiplier @@ -41,103 +42,103 @@ _Multiply: ld a, [H_MULTIPLICAND+1] rl a ld [H_MULTIPLICAND+1], a - ld a, [H_MULTIPLICAND] + ld a, [H_MULTIPLICAND] ; $ff96 rl a - ld [H_MULTIPLICAND], a - ld a, [H_PRODUCT] + ld [H_MULTIPLICAND], a ; $ff96 + ld a, [H_PRODUCT] ; $ff95 rl a - ld [H_PRODUCT], a - jr .loop + ld [H_PRODUCT], a ; $ff95 + jr .multiplyLoop .done ld a, [H_MULTIPLYBUFFER+3] ld [H_PRODUCT+3], a ld a, [H_MULTIPLYBUFFER+2] ld [H_PRODUCT+2], a - ld a, [H_MULTIPLYBUFFER+1] - ld [H_PRODUCT+1], a + ld a, [H_MULTIPLYBUFFER+1] ; $ff9c + ld [H_PRODUCT+1], a ; $ff96 ld a, [H_MULTIPLYBUFFER] - ld [H_PRODUCT], a + ld [H_PRODUCT], a ; $ff95 ret _Divide: xor a - ld [H_DIVIDEBUFFER], a - ld [H_DIVIDEBUFFER+1], a - ld [H_DIVIDEBUFFER+2], a - ld [H_DIVIDEBUFFER+3], a - ld [H_DIVIDEBUFFER+4], a + ld [H_DIVIDEBUFFER], a ; ff9a + ld [H_DIVIDEBUFFER+1], a ; ff9b + ld [H_DIVIDEBUFFER+2], a ; ff9c + ld [H_DIVIDEBUFFER+3], a ; ff9d + ld [H_DIVIDEBUFFER+4], a ; ff9e ld a, $9 ld e, a -.asm_37db3 +.asm_f6680 ld a, [H_DIVIDEBUFFER] ld c, a - ld a, [H_DIVIDEND+1] ; (aliases: H_MULTIPLICAND) + ld a, [H_DIVIDEND+1] ; $ff96 sub c ld d, a - ld a, [H_DIVISOR] ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + ld a, [H_DIVISOR] ; $ff99 ld c, a - ld a, [H_DIVIDEND] ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld a, [H_DIVIDEND] ; $ff95 sbc c - jr c, .asm_37dce - ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + jr c, .asm_f669b + ld [H_DIVIDEND], a ; $ff95 ld a, d - ld [H_DIVIDEND+1], a ; (aliases: H_MULTIPLICAND) + ld [H_DIVIDEND+1], a ; $ff96 ld a, [H_DIVIDEBUFFER+4] inc a ld [H_DIVIDEBUFFER+4], a - jr .asm_37db3 -.asm_37dce + jr .asm_f6680 +.asm_f669b ld a, b cp $1 - jr z, .asm_37e18 + jr z, .done ld a, [H_DIVIDEBUFFER+4] sla a ld [H_DIVIDEBUFFER+4], a ld a, [H_DIVIDEBUFFER+3] rl a ld [H_DIVIDEBUFFER+3], a - ld a, [H_DIVIDEBUFFER+2] + ld a, [H_DIVIDEBUFFER+2] ; $ff9c rl a - ld [H_DIVIDEBUFFER+2], a + ld [H_DIVIDEBUFFER+2], a ; $ff9c ld a, [H_DIVIDEBUFFER+1] rl a ld [H_DIVIDEBUFFER+1], a dec e - jr nz, .asm_37e04 + jr nz, .asm_f66d1 ld a, $8 ld e, a ld a, [H_DIVIDEBUFFER] - ld [H_DIVISOR], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + ld [H_DIVISOR], a ; $ff99 xor a ld [H_DIVIDEBUFFER], a - ld a, [H_DIVIDEND+1] ; (aliases: H_MULTIPLICAND) - ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld a, [H_DIVIDEND+1] ; $ff96 + ld [H_DIVIDEND], a ; $ff95 ld a, [H_DIVIDEND+2] - ld [H_DIVIDEND+1], a ; (aliases: H_MULTIPLICAND) + ld [H_DIVIDEND+1], a ; $ff96 ld a, [H_DIVIDEND+3] ld [H_DIVIDEND+2], a -.asm_37e04 +.asm_f66d1 ld a, e cp $1 - jr nz, .asm_37e0a + jr nz, .asm_f66d7 dec b -.asm_37e0a - ld a, [H_DIVISOR] ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) +.asm_f66d7 + ld a, [H_DIVISOR] ; $ff99 srl a - ld [H_DIVISOR], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + ld [H_DIVISOR], a ; $ff99 ld a, [H_DIVIDEBUFFER] rr a ld [H_DIVIDEBUFFER], a - jr .asm_37db3 -.asm_37e18 - ld a, [H_DIVIDEND+1] ; (aliases: H_MULTIPLICAND) - ld [H_REMAINDER], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + jr .asm_f6680 +.done + ld a, [H_DIVIDEND+1] ; $ff96 + ld [H_REMAINDER], a ; $ff99 ld a, [H_DIVIDEBUFFER+4] ld [H_QUOTIENT+3], a ld a, [H_DIVIDEBUFFER+3] ld [H_QUOTIENT+2], a - ld a, [H_DIVIDEBUFFER+2] - ld [H_QUOTIENT+1], a ; (aliases: H_MULTIPLICAND) + ld a, [H_DIVIDEBUFFER+2] ; $ff9c + ld [H_QUOTIENT+1], a ; $ff96 ld a, [H_DIVIDEBUFFER+1] - ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld [H_QUOTIENT], a ; $ff95 ret diff --git a/engine/oak_speech.asm b/engine/oak_speech.asm index 31c00fd0..38fe66f9 100755 --- a/engine/oak_speech.asm +++ b/engine/oak_speech.asm @@ -5,14 +5,22 @@ SetDefaultNames: push af ld a, [wd732] push af + ld a, [wPrinterSettings] + push af ld hl, wPlayerName - ld bc, $d8a + ld bc, wBoxDataEnd - wPlayerName xor a call FillMemory ld hl, wSpriteStateData1 ld bc, $200 xor a call FillMemory + xor a + ld [wSurfingMinigameHiScore], a + ld [wSurfingMinigameHiScore + 1], a + ld [wSurfingMinigameHiScore + 2], a + pop af + ld [wPrinterSettings], a pop af ld [wd732], a pop af @@ -29,11 +37,11 @@ SetDefaultNames: ld hl, SonyText ld de, wRivalName ld bc, NAME_LENGTH - jp CopyData + call CopyData ; rip optimizations + ret OakSpeech: - ld a,$FF - call PlaySound ; stop music + call StopAllMusic ; stop music ld a, BANK(Music_Routes2) ld c,a ld a, MUSIC_ROUTES2 @@ -64,7 +72,7 @@ OakSpeech: call PrintText call GBFadeOutToWhite call ClearScreen - ld a,NIDORINO + ld a,PIKACHU ld [wd0b5],a ld [wcf91],a call GetMonHeader @@ -109,13 +117,13 @@ OakSpeech: ld a,SFX_SHRINK call PlaySound pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + call BankswitchCommon ld c,4 call DelayFrames - ld de,RedSprite ld hl,vSprites - lb bc, BANK(RedSprite), $0C + ld de,RedSprite + ld b, BANK(RedSprite) + ld c, $0C call CopyVideoData ld de,ShrinkPic1 lb bc, BANK(ShrinkPic1), $00 @@ -133,17 +141,13 @@ OakSpeech: ld [wAudioSavedROMBank],a ld a, 10 ld [wAudioFadeOutControl],a - ld a,$FF - ld [wNewSoundID],a - call PlaySound ; stop music + call StopAllMusic ; stop music pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + call BankswitchCommon ld c,20 call DelayFrames coord hl, 6, 5 - ld b,7 - ld c,7 + lb bc, 7, 7 call ClearScreenArea call LoadTextBoxTilePatterns ld a,1 @@ -151,7 +155,9 @@ OakSpeech: ld c,50 call DelayFrames call GBFadeOutToWhite - jp ClearScreen + call ClearScreen ; rip more tail-end optimizations + ret + OakSpeechText1: TX_FAR _OakSpeechText1 db "@" @@ -176,6 +182,7 @@ FadeInIntroPic: .next ld a,[hli] ld [rBGP],a + call UpdateGBCPal_BGP ld c,10 call DelayFrames dec b @@ -195,8 +202,9 @@ MovePicLeft: ld [rWX],a call DelayFrame - ld a,$E4 + ld a,%11100100 ld [rBGP],a + call UpdateGBCPal_BGP .next call DelayFrame ld a,[rWX] @@ -215,10 +223,13 @@ IntroDisplayPicCenteredOrUpperRight: push bc ld a,b call UncompressSpriteFromDE + ld a, $0 + call SwitchSRAMBankAndLatchClockData ld hl,sSpriteBuffer1 ld de,sSpriteBuffer0 ld bc,$310 call CopyData + call PrepareRTCDataAndDisableSRAM ld de,vFrontPic call InterlaceMergeSpriteBuffers pop bc diff --git a/engine/oak_speech2.asm b/engine/oak_speech2.asm index 1258c59b..80f1bafc 100755 --- a/engine/oak_speech2.asm +++ b/engine/oak_speech2.asm @@ -108,6 +108,7 @@ OakSpeechSlidePicCommon: .loop xor a ld [H_AUTOBGTRANSFERENABLED], a + ld [H_AUTOBGTRANSFERPORTION], a ld a, [hSlideDirection] and a jr nz, .slideLeft @@ -129,8 +130,8 @@ OakSpeechSlidePicCommon: ; If sliding left, we need to zero the last tile in the pic (there is no need ; to take a corresponding action when sliding right because hl initially points ; to a 0 tile in that case). - xor a dec hl + xor a ld [hl], a .next3 ld a, 1 @@ -162,8 +163,7 @@ OakSpeechSlidePicCommon: DisplayIntroNameTextBox: push de coord hl, 0, 0 - ld b, $a - ld c, $9 + lb bc, 10, 9 call TextBoxBorder coord hl, 3, 0 ld de, .namestring @@ -187,10 +187,9 @@ DisplayIntroNameTextBox: .namestring db "NAME@" -IF DEF(_RED) DefaultNamesPlayer: db "NEW NAME" - next "RED" + next "YELLOW" next "ASH" next "JACK" db "@" @@ -201,23 +200,6 @@ DefaultNamesRival: next "GARY" next "JOHN" db "@" -ENDC - -IF DEF(_BLUE) -DefaultNamesPlayer: - db "NEW NAME" - next "BLUE" - next "GARY" - next "JOHN" - db "@" - -DefaultNamesRival: - db "NEW NAME" - next "RED" - next "ASH" - next "JACK" - db "@" -ENDC GetDefaultName: ; a = name index @@ -243,30 +225,17 @@ GetDefaultName: ld bc, $14 jp CopyData -IF DEF(_RED) DefaultNamesPlayerList: db "NEW NAME@" - db "RED@" + db "YELLOW@" db "ASH@" db "JACK@" + DefaultNamesRivalList: db "NEW NAME@" db "BLUE@" db "GARY@" db "JOHN@" -ENDC -IF DEF(_BLUE) -DefaultNamesPlayerList: - db "NEW NAME@" - db "BLUE@" - db "GARY@" - db "JOHN@" -DefaultNamesRivalList: - db "NEW NAME@" - db "RED@" - db "ASH@" - db "JACK@" -ENDC TextTerminator_6b20: db "@" diff --git a/engine/overworld/advance_player_sprite.asm b/engine/overworld/advance_player_sprite.asm new file mode 100644 index 00000000..6b4a0cbb --- /dev/null +++ b/engine/overworld/advance_player_sprite.asm @@ -0,0 +1,241 @@ +_AdvancePlayerSprite:: + ld a,[wSpriteStateData1 + 3] ; delta Y + ld b,a + ld a,[wSpriteStateData1 + 5] ; delta X + ld c,a + ld hl,wWalkCounter ; walking animation counter + dec [hl] + jr nz,.afterUpdateMapCoords +; if it's the end of the animation, update the player's map coordinates + ld hl, wPikachuOverworldStateFlags + res 5, [hl] + ld a,[wYCoord] + add b + ld [wYCoord],a + ld a,[wXCoord] + add c + ld [wXCoord],a +.afterUpdateMapCoords + ld a,[wWalkCounter] ; walking animation counter + cp a,$07 + jp nz,.scrollBackgroundAndSprites +; if this is the first iteration of the animation + ld a,c + cp a,$01 + jr nz,.checkIfMovingWest +; moving east + ld a,[wMapViewVRAMPointer] + ld e,a + and $e0 + ld d,a + ld a,e + add $02 + and $1f + or d + ld [wMapViewVRAMPointer],a + jr .adjustXCoordWithinBlock +.checkIfMovingWest + cp a,$ff + jr nz,.checkIfMovingSouth +; moving west + ld a,[wMapViewVRAMPointer] + ld e,a + and a,$e0 + ld d,a + ld a,e + sub $02 + and $1f + or d + ld [wMapViewVRAMPointer],a + jr .adjustXCoordWithinBlock +.checkIfMovingSouth + ld a,b + cp a,$01 + jr nz,.checkIfMovingNorth +; moving south + ld a,[wMapViewVRAMPointer] + add $40 + ld [wMapViewVRAMPointer],a + jr nc,.adjustXCoordWithinBlock + ld a,[wMapViewVRAMPointer + 1] + inc a + and $03 + or $98 + ld [wMapViewVRAMPointer + 1],a + jr .adjustXCoordWithinBlock +.checkIfMovingNorth + cp a,$ff + jr nz,.adjustXCoordWithinBlock +; moving north + ld a,[wMapViewVRAMPointer] + sub $40 + ld [wMapViewVRAMPointer],a + jr nc,.adjustXCoordWithinBlock + ld a,[wMapViewVRAMPointer + 1] + dec a + and $03 + or $98 + ld [wMapViewVRAMPointer + 1],a +.adjustXCoordWithinBlock + ld a,c + and a + jr z,.pointlessJump ; mistake? +.pointlessJump + ld hl,wXBlockCoord + ld a,[hl] + add c + ld [hl],a + cp $02 + jr nz,.checkForMoveToWestBlock +; moved into the tile block to the east + xor a + ld [hl],a + ld hl,wXOffsetSinceLastSpecialWarp + inc [hl] + ld de,wCurrentTileBlockMapViewPointer + call MoveTileBlockMapPointerEast + jr .updateMapView +.checkForMoveToWestBlock + cp a,$ff + jr nz,.adjustYCoordWithinBlock +; moved into the tile block to the west + ld a,$1 + ld [hl],a + ld hl,wXOffsetSinceLastSpecialWarp + dec [hl] + ld de,wCurrentTileBlockMapViewPointer + call MoveTileBlockMapPointerWest + jr .updateMapView +.adjustYCoordWithinBlock + ld hl,wYBlockCoord + ld a,[hl] + add b + ld [hl],a + cp $2 + jr nz,.checkForMoveToNorthBlock +; moved into the tile block to the south + xor a + ld [hl],a + ld hl,wYOffsetSinceLastSpecialWarp + inc [hl] + ld de,wCurrentTileBlockMapViewPointer + ld a,[wCurMapWidth] + call MoveTileBlockMapPointerSouth + jr .updateMapView +.checkForMoveToNorthBlock + cp a,$ff + jr nz,.updateMapView +; moved into the tile block to the north + ld a,$1 + ld [hl],a + ld hl,wYOffsetSinceLastSpecialWarp + dec [hl] + ld de,wCurrentTileBlockMapViewPointer + ld a,[wCurMapWidth] + call MoveTileBlockMapPointerNorth +.updateMapView + call LoadCurrentMapView + ld a,[wSpriteStateData1 + 3] ; delta Y + cp $1 + jr nz,.checkIfMovingNorth2 +; if moving south + call ScheduleSouthRowRedraw + jr .scrollBackgroundAndSprites +.checkIfMovingNorth2 + cp $ff + jr nz,.checkIfMovingEast2 +; if moving north + call ScheduleNorthRowRedraw + jr .scrollBackgroundAndSprites +.checkIfMovingEast2 + ld a,[wSpriteStateData1 + 5] ; delta X + cp $1 + jr nz,.checkIfMovingWest2 +; if moving east + call ScheduleEastColumnRedraw + jr .scrollBackgroundAndSprites +.checkIfMovingWest2 + cp $ff + jr nz,.scrollBackgroundAndSprites +; if moving west + call ScheduleWestColumnRedraw +.scrollBackgroundAndSprites + ld a,[wSpriteStateData1 + 3] ; delta Y + add a + ld b,a + ld a,[wSpriteStateData1 + 5] ; delta X + add a + ld c,a +; shift all the sprites in the direction opposite of the player's motion +; so that the player appears to move relative to them + ld hl,wSpriteStateData1 + $14 + ld e,15 +.spriteShiftLoop + ld a,[hl] + sub b + ld [hli],a + inc l + ld a,[hl] + sub c + ld [hl],a + ld a,$0e + add l + ld l,a + dec e + jr nz,.spriteShiftLoop +.done + ld a,[hSCY] + add b + ld [hSCY],a ; update background scroll Y + ld a,[hSCX] + add c + ld [hSCX],a ; update background scroll X + ret + +MoveTileBlockMapPointerEast:: + ld a,[de] + add $1 + ld [de],a + ret nc + inc de + ld a,[de] + inc a + ld [de],a + ret + +MoveTileBlockMapPointerWest:: + ld a,[de] + sub $1 + ld [de],a + ret nc + inc de + ld a,[de] + dec a + ld [de],a + ret + +MoveTileBlockMapPointerSouth:: + add $6 + ld b,a + ld a,[de] + add b + ld [de],a + ret nc + inc de + ld a,[de] + inc a + ld [de],a + ret + +MoveTileBlockMapPointerNorth:: + add $6 + ld b,a + ld a,[de] + sub b + ld [de],a + ret nc + inc de + ld a,[de] + dec a + ld [de],a + ret diff --git a/engine/overworld/boulders.asm b/engine/overworld/boulders.asm new file mode 100644 index 00000000..669b7b83 --- /dev/null +++ b/engine/overworld/boulders.asm @@ -0,0 +1,94 @@ +CheckForCollisionWhenPushingBoulder: + call GetTileTwoStepsInFrontOfPlayer + call IsTilePassable + jr c, .done + ld hl, TilePairCollisionsLand + call CheckForTilePairCollisions2 + ld a, $ff + jr c, .done ; if there is an elevation difference between the current tile and the one two steps ahead + ld a, [wTileInFrontOfBoulderAndBoulderCollisionResult] + cp $15 ; stairs tile + ld a, $ff + jr z, .done ; if the tile two steps ahead is stairs + call CheckForBoulderCollisionWithSprites +.done + ld [wTileInFrontOfBoulderAndBoulderCollisionResult], a + ret + +; sets a to $ff if there is a collision and $00 if there is no collision +CheckForBoulderCollisionWithSprites: + ld a, [wBoulderSpriteIndex] + dec a + swap a + ld d, 0 + ld e, a + ld hl, wSpriteStateData2 + $14 + add hl, de + ld a, [hli] ; map Y position + ld [$ffdc], a + ld a, [hl] ; map X position + ld [$ffdd], a + ld a, [wNumSprites] + ld c, a + ld de, $f + ld hl, wSpriteStateData2 + $14 + ld a, [$ffdb] + and $3 ; facing up or down? + jr z, .pushingHorizontallyLoop +.pushingVerticallyLoop + inc hl + ld a, [$ffdd] + cp [hl] + jr nz, .nextSprite1 ; if X coordinates don't match + dec hl + ld a, [hli] + ld b, a + ld a, [$ffdb] + rrca + jr c, .pushingDown +; pushing up + ld a, [$ffdc] + dec a + jr .compareYCoords +.pushingDown + ld a, [$ffdc] + inc a +.compareYCoords + cp b + jr z, .failure +.nextSprite1 + dec c + jr z, .success + add hl, de + jr .pushingVerticallyLoop +.pushingHorizontallyLoop + ld a, [hli] + ld b, a + ld a, [$ffdc] + cp b + jr nz, .nextSprite2 + ld b, [hl] + ld a, [$ffdb] + bit 2, a + jr nz, .pushingLeft +; pushing right + ld a, [$ffdd] + inc a + jr .compareXCoords +.pushingLeft + ld a, [$ffdd] + dec a +.compareXCoords + cp b + jr z, .failure +.nextSprite2 + dec c + jr z, .success + add hl, de + jr .pushingHorizontallyLoop +.failure + ld a, $ff + ret +.success + xor a + ret diff --git a/engine/overworld/cable_club_npc.asm b/engine/overworld/cable_club_npc.asm index 70b499a0..e3ce8e8d 100755 --- a/engine/overworld/cable_club_npc.asm +++ b/engine/overworld/cable_club_npc.asm @@ -1,9 +1,12 @@ CableClubNPC: ld hl, CableClubNPCWelcomeText call PrintText + call CheckPikachuFollowingPlayer + jr nz, .asm_7048 CheckEvent EVENT_GOT_POKEDEX jp nz, .receivedPokedex ; if the player hasn't received the pokedex +.asm_7048 ld c, 60 call DelayFrames ld hl, CableClubNPCMakingPreparationsText @@ -107,7 +110,61 @@ CableClubNPC: xor a ld [hld], a ld [hl], a - jpab LinkMenu + ld a, [wLetterPrintingDelayFlags] + push af + callab LinkMenu + pop af + ld [wLetterPrintingDelayFlags], a + ret + +; seems to be similar of Serial_SyncAndExchangeNybble +Serial_SyncAndExchangeNybbleDouble: + ld a, $ff + ld [wSerialExchangeNybbleReceiveData], a +.loop + call Serial_ExchangeNybble + call DelayFrame + push hl + ld hl, wUnknownSerialCounter + 1 + dec [hl] + jr nz, .next + dec hl + dec [hl] + jr nz, .next + pop hl + jr .setUnknownSerialCounterToFFFF +.next + pop hl + ld a, [wSerialExchangeNybbleReceiveData] + inc a + jr z, .loop + call DelayFrame + ld a, $ff + ld [wSerialExchangeNybbleReceiveData], a + call Serial_ExchangeNybble + ld a, [wSerialExchangeNybbleReceiveData] + inc a + jr z, .loop + ld b, 10 +.syncLoop1 + call DelayFrame + call Serial_ExchangeNybble + dec b + jr nz, .syncLoop1 + ld b, 10 +.syncLoop2 + call DelayFrame + call Serial_SendZeroByte + dec b + jr nz, .syncLoop2 + ld a, [wSerialExchangeNybbleReceiveData] + ld [wSerialSyncAndExchangeNybbleReceiveData], a + ret +.setUnknownSerialCounterToFFFF + ld a, $ff + ld [wUnknownSerialCounter], a + ld [wUnknownSerialCounter + 1], a + ret CableClubNPCAreaReservedFor2FriendsLinkedByCableText: TX_FAR _CableClubNPCAreaReservedFor2FriendsLinkedByCableText diff --git a/engine/overworld/card_key.asm b/engine/overworld/card_key.asm index 61e512de..e1fc9160 100755 --- a/engine/overworld/card_key.asm +++ b/engine/overworld/card_key.asm @@ -8,7 +8,8 @@ PrintCardKeyText: ret z cp b jr nz, .silphCoMapListLoop - predef GetTileAndCoordsInFrontOfPlayer +; does not check for tile in front of player. This might be buggy + ;predef GetTileAndCoordsInFrontOfPlayer ld a, [wTileInFrontOfPlayer] cp $18 jr z, .cardKeyDoorInFrontOfPlayer @@ -25,12 +26,12 @@ PrintCardKeyText: ld b, CARD_KEY call IsItemInBag jr z, .noCardKey - call GetCoordsInFrontOfPlayer - push de + xor a + ld [wPlayerMovingDirection], a tx_pre_id CardKeySuccessText ld [hSpriteIndexOrTextID], a call PrintPredefTextID - pop de + call GetCoordsInFrontOfPlayer srl d ld a, d ld b, a @@ -73,7 +74,7 @@ SilphCoMapList: CardKeySuccessText: TX_FAR _CardKeySuccessText1 - db $0b + TX_SFX_ITEM TX_FAR _CardKeySuccessText2 db "@" @@ -88,7 +89,7 @@ GetCoordsInFrontOfPlayer: ld d, a ld a, [wXCoord] ld e, a - ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction + ld a, [wPlayerFacingDirection] ; player's sprite facing direction and a jr nz, .notFacingDown ; facing down diff --git a/engine/overworld/check_player_state.asm b/engine/overworld/check_player_state.asm new file mode 100644 index 00000000..5fad4fc5 --- /dev/null +++ b/engine/overworld/check_player_state.asm @@ -0,0 +1,236 @@ +; only used for setting bit 2 of wd736 upon entering a new map +IsPlayerStandingOnWarp: + ld a, [wNumberOfWarps] + and a + ret z + ld c, a + ld hl, wWarpEntries +.loop + ld a, [wYCoord] + cp [hl] + jr nz, .nextWarp1 + inc hl + ld a, [wXCoord] + cp [hl] + jr nz, .nextWarp2 + inc hl + ld a, [hli] ; target warp + ld [wDestinationWarpID], a + ld a, [hl] ; target map + ld [$ff8b], a + ld hl, wd736 + set 2, [hl] ; standing on warp flag + ret +.nextWarp1 + inc hl +.nextWarp2 + inc hl + inc hl + inc hl + dec c + jr nz, .loop + ret + +CheckForceBikeOrSurf: + ld hl, wd732 + bit 5, [hl] + ret nz + ld hl, ForcedBikeOrSurfMaps + ld a, [wYCoord] + ld b, a + ld a, [wXCoord] + ld c, a + ld a, [wCurMap] + ld d, a +.loop + ld a, [hli] + cp $ff + ret z ;if we reach FF then it's not part of the list + cp d ;compare to current map + jr nz, .incorrectMap + ld a, [hli] + cp b ;compare y-coord + jr nz, .incorrectY + ld a, [hli] + cp c ;compare x-coord + jr nz, .loop ; incorrect x-coord, check next item + ld a, [wCurMap] + cp SEAFOAM_ISLANDS_4 + ld a, $2 + ld [wSeafoamIslands4CurScript], a + jr z, .forceSurfing + ld a, [wCurMap] + cp SEAFOAM_ISLANDS_5 + ld a, $2 + ld [wSeafoamIslands5CurScript], a + jr z, .forceSurfing + ;force bike riding + ld hl, wd732 + set 5, [hl] + ld a, $1 + ld [wWalkBikeSurfState], a + ld [wWalkBikeSurfStateCopy], a + call ForceBikeOrSurf + ret +.incorrectMap + inc hl +.incorrectY + inc hl + jr .loop +.forceSurfing + ld a, $2 + ld [wWalkBikeSurfState], a + ld [wWalkBikeSurfStateCopy], a + call ForceBikeOrSurf + ret + +INCLUDE "data/force_bike_surf.asm" + +IsPlayerFacingEdgeOfMap: + push hl + push de + push bc + ld a, [wPlayerFacingDirection] ; player sprite's facing direction + srl a + ld c, a + ld b, $0 + ld hl, .functionPointerTable + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + ld a, [wYCoord] + ld b, a + ld a, [wXCoord] + ld c, a + ld de, .returnaddress + push de + jp [hl] +.returnaddress + pop bc + pop de + pop hl + ret + +.functionPointerTable + dw .facingDown + dw .facingUp + dw .facingLeft + dw .facingRight + +.facingDown + ld a, [wCurMapHeight] + add a + dec a + cp b + jr z, .setCarry + jr .resetCarry + +.facingUp + ld a, b + and a + jr z, .setCarry + jr .resetCarry + +.facingLeft + ld a, c + and a + jr z, .setCarry + jr .resetCarry + +.facingRight + ld a, [wCurMapWidth] + add a + dec a + cp c + jr z, .setCarry + jr .resetCarry +.resetCarry + and a + ret +.setCarry + scf + ret + +IsWarpTileInFrontOfPlayer: + push hl + push de + push bc + call _GetTileAndCoordsInFrontOfPlayer + ld a, [wCurMap] + cp SS_ANNE_5 + jr z, .ssAnne5 + ld a, [wPlayerFacingDirection] ; player sprite's facing direction + srl a + ld c, a + ld b, 0 + ld hl, .warpTileListPointers + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + ld a, [wTileInFrontOfPlayer] + ld de, $1 + call IsInArray +.done + pop bc + pop de + pop hl + ret + +.warpTileListPointers: + dw .facingDownWarpTiles + dw .facingUpWarpTiles + dw .facingLeftWarpTiles + dw .facingRightWarpTiles + +.facingDownWarpTiles + db $01,$12,$17,$3D,$04,$18,$33,$FF + +.facingUpWarpTiles + db $01,$5C,$FF + +.facingLeftWarpTiles + db $1A,$4B,$FF + +.facingRightWarpTiles + db $0F,$4E,$FF + +.ssAnne5 + ld a, [wTileInFrontOfPlayer] + cp $15 + jr nz, .notSSAnne5Warp + scf + jr .done +.notSSAnne5Warp + and a + jr .done + +IsPlayerStandingOnDoorTileOrWarpTile: + push hl + push de + push bc + callba IsPlayerStandingOnDoorTile ; 6:6785 + jr c, .done + ld a, [wCurMapTileset] + add a + ld c, a + ld b, $0 + ld hl, WarpTileIDPointers + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + ld de, $1 + aCoord 8, 9 + call IsInArray + jr nc, .done + ld hl, wd736 + res 2, [hl] +.done + pop bc + pop de + pop hl + ret + +INCLUDE "data/warp_tile_ids.asm" diff --git a/engine/overworld/clear_loadmapdata_vars.asm b/engine/overworld/clear_loadmapdata_vars.asm new file mode 100644 index 00000000..c5dc21fa --- /dev/null +++ b/engine/overworld/clear_loadmapdata_vars.asm @@ -0,0 +1,20 @@ +ClearVariablesAfterLoadingMapData: + ld a, $90 + ld [hWY], a + ld [rWY], a + xor a + ld [H_AUTOBGTRANSFERENABLED], a + ld [wStepCounter], a + ld [wLoneAttackNo], a ; wGymLeaderNo + ld [hJoyPressed], a + ld [hJoyReleased], a + ld [hJoyHeld], a + ld [wActionResultOrTookBattleTurn], a + ld [wUnusedD5A3], a + ld hl, wCardKeyDoorY + ld [hli], a + ld [hl], a + ld hl, wUnusedCD3D + ld bc, wStandingOnWarpPadOrHole - wUnusedCD3D + call FillMemory + ret diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 2f13dfba..462e3e8e 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -74,8 +74,9 @@ UsedCutText: InitCutAnimOAM: xor a ld [wWhichAnimationOffsets], a - ld a, $e4 + ld a, %11100100 ld [rOBP1], a + call UpdateGBCPal_OBP1 ld a, [wCutTile] cp $52 jr z, .grass @@ -123,8 +124,8 @@ WriteCutOrBoulderDustAnimationOAMBlock: jp WriteOAMBlock CutOrBoulderDustAnimationTilesAndAttributes: - db $FC,$10,$FD,$10 - db $FE,$10,$FF,$10 + db $FC,$14,$FD,$14 + db $FE,$14,$FF,$14 GetCutOrBoulderDustAnimationOffsets: ld hl, wSpriteStateData1 + 4 @@ -187,7 +188,7 @@ ReplaceTreeTileBlock: ld h, [hl] ld l, a add hl, bc - ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction + ld a, [wPlayerFacingDirection] ; player sprite's facing direction and a jr z, .down cp SPRITE_FACING_UP diff --git a/engine/overworld/cut2.asm b/engine/overworld/cut2.asm index f16fed66..37490f95 100755 --- a/engine/overworld/cut2.asm +++ b/engine/overworld/cut2.asm @@ -18,6 +18,7 @@ AnimCut: ld a, [rOBP1] xor $64 ld [rOBP1], a + call UpdateGBCPal_OBP1 call DelayFrame pop bc dec c @@ -68,6 +69,7 @@ AnimCutGrass_UpdateOAMEntries: ld a, [rOBP1] xor $64 ld [rOBP1], a + call UpdateGBCPal_OBP1 call DelayFrame pop bc dec c diff --git a/engine/overworld/daycare_exp.asm b/engine/overworld/daycare_exp.asm new file mode 100644 index 00000000..dbe4023a --- /dev/null +++ b/engine/overworld/daycare_exp.asm @@ -0,0 +1,18 @@ +IncrementDayCareMonExp: + ld a, [wDayCareInUse] + and a + ret z + ld hl, wDayCareMonExp + 2 + inc [hl] + ret nz + dec hl + inc [hl] + ret nz + dec hl + inc [hl] + ld a, [hl] + cp $50 + ret c + ld a, $50 + ld [hl], a + ret diff --git a/engine/overworld/doors.asm b/engine/overworld/doors.asm index c39e096d..8bde8600 100755 --- a/engine/overworld/doors.asm +++ b/engine/overworld/doors.asm @@ -39,6 +39,7 @@ DoorTileIDPointers: dbw LAB, LabDoorTileIDs dbw FACILITY, FacilityDoorTileIDs dbw PLATEAU, PlateauDoorTileIDs + dbw INTERIOR, InteriorDoorTileIDs db $ff OverworldDoorTileIDs: @@ -73,3 +74,6 @@ FacilityDoorTileIDs: PlateauDoorTileIDs: db $3b,$1b,$00 + +InteriorDoorTileIDs: + db $04,$15,$00 diff --git a/engine/overworld/dungeon_warps.asm b/engine/overworld/dungeon_warps.asm new file mode 100644 index 00000000..f47dfb01 --- /dev/null +++ b/engine/overworld/dungeon_warps.asm @@ -0,0 +1,15 @@ +IsPlayerOnDungeonWarp: + xor a + ld [wWhichDungeonWarp], a + ld a, [wd72d] + bit 4, a + ret nz + call ArePlayerCoordsInArray + ret nc + ld a, [wCoordIndex] + ld [wWhichDungeonWarp], a + ld hl, wd72d + set 4, [hl] + ld hl, wd732 + set 4, [hl] + ret diff --git a/engine/overworld/elevator.asm b/engine/overworld/elevator.asm index 4ec34922..cd7bf5ba 100755 --- a/engine/overworld/elevator.asm +++ b/engine/overworld/elevator.asm @@ -4,8 +4,7 @@ ShakeElevator: ld de, SCREEN_HEIGHT * $20 call ShakeElevatorRedrawRow call Delay3 - ld a, $ff - call PlaySound + call StopAllMusic ld a, [hSCY] ld d, a ld e, $1 @@ -27,14 +26,13 @@ ShakeElevator: jr nz, .shakeLoop ld a, d ld [hSCY], a - ld a, $ff - call PlaySound + call StopAllMusic ld c, BANK(SFX_Safari_Zone_PA) ld a, SFX_SAFARI_ZONE_PA call PlayMusic .musicLoop ld a, [wChannelSoundIDs + CH4] - cp $b9 + cp SFX_SAFARI_ZONE_PA jr z, .musicLoop call UpdateSprites jp PlayDefaultMusic @@ -56,7 +54,7 @@ ShakeElevatorRedrawRow: add hl, de ld a, h and $3 - or $98 + or vBGMap0 / $100 ld d, a ld a, l pop hl diff --git a/engine/overworld/emotion_bubbles.asm b/engine/overworld/emotion_bubbles.asm index 4df8b6f6..7c7f5e7d 100755 --- a/engine/overworld/emotion_bubbles.asm +++ b/engine/overworld/emotion_bubbles.asm @@ -1,13 +1,16 @@ EmotionBubble: ld a, [wWhichEmotionBubble] + and $f + swap a ld c, a - ld b, 0 - ld hl, EmotionBubblesPointerTable + ld b, $0 + ld hl, EmotionBubbles + add hl, bc ; each emotion bubble is 16 bytes, so calculate the offset directly instead of with a pointer table add hl, bc add hl, bc - ld e, [hl] - inc hl - ld d, [hl] + add hl, bc + ld e, l + ld d, h ld hl, vChars1 + $780 lb bc, BANK(EmotionBubbles), $04 call CopyVideoData @@ -17,11 +20,11 @@ EmotionBubble: ld [wUpdateSpritesEnabled], a ld a, [wd736] bit 6, a ; are the last 4 OAM entries reserved for a shadow or fishing rod? - ld hl, wOAMBuffer + $8f - ld de, wOAMBuffer + $9f + ld hl, wOAMBuffer + 4 * 35 + $3 ; $8f + ld de, wOAMBuffer + 4 * 39 + $3 ; $9f jr z, .next - ld hl, wOAMBuffer + $7f - ld de, wOAMBuffer + $8f + ld hl, wOAMBuffer + 4 * 31 + $3 ; $7f + ld de, wOAMBuffer + 4 * 35 + $3 ; $8f ; Copy OAM data 16 bytes forward to make room for emotion bubble OAM data at the ; start of the OAM buffer. @@ -59,12 +62,9 @@ EmotionBubble: pop af ld [wUpdateSpritesEnabled], a call DelayFrame - jp UpdateSprites - -EmotionBubblesPointerTable: - dw EmotionBubbles - dw EmotionBubbles + $40 - dw EmotionBubbles + $80 + call UpdateSprites + ret + ; jp UpdateSprites EmotionBubblesOAM: db $F8,$00,$F9,$00 diff --git a/engine/overworld/get_coords_tile_in_front_of_player.asm b/engine/overworld/get_coords_tile_in_front_of_player.asm new file mode 100644 index 00000000..e8bbc660 --- /dev/null +++ b/engine/overworld/get_coords_tile_in_front_of_player.asm @@ -0,0 +1,87 @@ +GetTileAndCoordsInFrontOfPlayer: + call GetPredefRegisters + +_GetTileAndCoordsInFrontOfPlayer: + ld a, [wYCoord] + ld d, a + ld a, [wXCoord] + ld e, a + ld a, [wPlayerFacingDirection] ; player's sprite facing direction + and a ; cp SPRITE_FACING_DOWN + jr nz, .notFacingDown +; facing down + aCoord 8, 11 + inc d + jr .storeTile +.notFacingDown + cp SPRITE_FACING_UP + jr nz, .notFacingUp +; facing up + aCoord 8, 7 + dec d + jr .storeTile +.notFacingUp + cp SPRITE_FACING_LEFT + jr nz, .notFacingLeft +; facing left + aCoord 6, 9 + dec e + jr .storeTile +.notFacingLeft + cp SPRITE_FACING_RIGHT + jr nz, .storeTile +; facing right + aCoord 10, 9 + inc e +.storeTile + ld c, a + ld [wTileInFrontOfPlayer], a + ret + +GetTileTwoStepsInFrontOfPlayer: + xor a + ld [$ffdb], a + ld hl, wYCoord + ld a, [hli] + ld d, a + ld e, [hl] + ld a, [wPlayerFacingDirection] ; player's sprite facing direction + and a ; cp SPRITE_FACING_DOWN + jr nz, .notFacingDown +; facing down + ld hl, $ffdb + set 0, [hl] + aCoord 8, 13 + inc d + jr .storeTile +.notFacingDown + cp SPRITE_FACING_UP + jr nz, .notFacingUp +; facing up + ld hl, $ffdb + set 1, [hl] + aCoord 8, 5 + dec d + jr .storeTile +.notFacingUp + cp SPRITE_FACING_LEFT + jr nz, .notFacingLeft +; facing left + ld hl, $ffdb + set 2, [hl] + aCoord 4, 9 + dec e + jr .storeTile +.notFacingLeft + cp SPRITE_FACING_RIGHT + jr nz, .storeTile +; facing right + ld hl, $ffdb + set 3, [hl] + aCoord 12, 9 + inc e +.storeTile + ld c, a + ld [wTileInFrontOfBoulderAndBoulderCollisionResult], a + ld [wTileInFrontOfPlayer], a + ret diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm index 38a44cfb..1dc74e2d 100755 --- a/engine/overworld/healing_machine.asm +++ b/engine/overworld/healing_machine.asm @@ -1,5 +1,5 @@ AnimateHealingMachine: - ld de, PokeCenterFlashingMonitorAndHealBall + ld de, PokeCenterFlashingMonitorAndHealBall ; $44b7 ld hl, vChars0 + $7c0 lb bc, BANK(PokeCenterFlashingMonitorAndHealBall), $03 ; loads one too many tiles call CopyVideoData @@ -11,52 +11,50 @@ AnimateHealingMachine: ld a, [rOBP1] push af ld a, $e0 - ld [rOBP1], a + ld [rOBP1], a ; $ff49 + call UpdateGBCPal_OBP1 ld hl, wOAMBuffer + $84 - ld de, PokeCenterOAMData + ld de, PokeCenterOAMData ; $44d7 call CopyHealingMachineOAM ld a, 4 ld [wAudioFadeOutControl], a - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic .waitLoop ld a, [wAudioFadeOutControl] - and a ; is fade-out finished? - jr nz, .waitLoop ; if not, check again - ld a, [wPartyCount] + and a + jr nz, .waitLoop + ld a, [wPartyCount] ; wPartyCount ld b, a .partyLoop call CopyHealingMachineOAM - ld a, SFX_HEALING_MACHINE + ld a, $9e ; (SFX_02_4a - SFX_Headers_02) / 3 call PlaySound ld c, 30 call DelayFrames dec b jr nz, .partyLoop ld a, [wAudioROMBank] - cp BANK(Audio3_UpdateMusic) + cp $1f ld [wAudioSavedROMBank], a jr nz, .next - ld a, $ff - ld [wNewSoundID], a - call PlaySound - ld a, BANK(Music_PkmnHealed) + call StopAllMusic + ld a, $2 ; BANK(Music_PkmnHealed) ld [wAudioROMBank], a .next - ld a, MUSIC_PKMN_HEALED + ld a, $e8 ; MUSIC_PKMN_HEALED ld [wNewSoundID], a call PlaySound ld d, $28 call FlashSprite8Times .waitLoop2 ld a, [wChannelSoundIDs] - cp MUSIC_PKMN_HEALED ; is the healed music still playing? - jr z, .waitLoop2 ; if so, check gain + cp $e8 ; MUSIC_PKMN_HEALED + jr z, .waitLoop2 ld c, 32 call DelayFrames pop af - ld [rOBP1], a + ld [rOBP1], a ; $ff49 + call UpdateGBCPal_OBP1 pop hl pop af ld [hl], a @@ -66,13 +64,13 @@ PokeCenterFlashingMonitorAndHealBall: INCBIN "gfx/pokecenter_ball.2bpp" PokeCenterOAMData: - db $24,$34,$7C,$10 ; heal machine monitor - db $2B,$30,$7D,$10 ; pokeballs 1-6 - db $2B,$38,$7D,$30 - db $30,$30,$7D,$10 - db $30,$38,$7D,$30 - db $35,$30,$7D,$10 - db $35,$38,$7D,$30 + db $24,$34,$7C,$14 ; heal machine monitor + db $2B,$30,$7D,$14 ; pokeballs 1-6 + db $2B,$38,$7D,$34 + db $30,$30,$7D,$14 + db $30,$38,$7D,$34 + db $35,$30,$7D,$14 + db $35,$38,$7D,$34 ; d = value to xor with palette FlashSprite8Times: @@ -81,6 +79,7 @@ FlashSprite8Times: ld a, [rOBP1] xor d ld [rOBP1], a + call UpdateGBCPal_OBP1 ld c, 10 call DelayFrames dec b diff --git a/engine/overworld/hidden_items.asm b/engine/overworld/hidden_items.asm index 11e6ad55..15082847 100755 --- a/engine/overworld/hidden_items.asm +++ b/engine/overworld/hidden_items.asm @@ -9,7 +9,7 @@ HiddenItems: predef FlagActionPredef ld a, c and a - ret nz + jr nz, .itemAlreadyFound call EnableAutoTextBoxDrawing ld a, 1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a @@ -18,6 +18,11 @@ HiddenItems: call GetItemName tx_pre_jump FoundHiddenItemText +.itemAlreadyFound + ld a, $ff + ld [hItemAlreadyFound], a + ret + INCLUDE "data/hidden_item_coords.asm" FoundHiddenItemText: @@ -27,7 +32,7 @@ FoundHiddenItemText: ld b, a ld c, 1 call GiveItem - jr nc, .BagFull + jr nc, .bagFull ld hl, wObtainedHiddenItemsFlags ld a, [wHiddenItemOrCoinsIndex] ld c, a @@ -37,7 +42,7 @@ FoundHiddenItemText: call PlaySoundWaitForCurrent call WaitForSoundToFinish jp TextScriptEnd -.BagFull +.bagFull call WaitForTextScrollButtonPress ; wait for button press xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a @@ -54,7 +59,7 @@ HiddenCoins: predef GetQuantityOfItemInBag ld a, b and a - ret z + jr z, .doNotPickUpCoins ld hl, HiddenCoinCoords call FindHiddenItemOrCoinsIndex ld [wHiddenItemOrCoinsIndex], a @@ -65,7 +70,7 @@ HiddenCoins: predef FlagActionPredef ld a, c and a - ret nz + jr nz, .doNotPickUpCoins xor a ld [hUnusedCoinsByte], a ld [hCoins], a @@ -77,24 +82,30 @@ HiddenCoins: cp 20 jr z, .bcd20 cp 40 - jr z, .bcd20 + jr z, .bcd20 ; should be bcd40 jr .bcd100 + +.doNotPickUpCoins + ld a, $ff + ld [hItemAlreadyFound], a + ret + .bcd10 ld a, $10 ld [hCoins + 1], a - jr .bcddone + jr .bcdDone .bcd20 ld a, $20 ld [hCoins + 1], a - jr .bcddone + jr .bcdDone .bcd40 ; due to a typo, this is never used ld a, $40 ld [hCoins + 1], a - jr .bcddone + jr .bcdDone .bcd100 ld a, $1 ld [hCoins], a -.bcddone +.bcdDone ld de, wPlayerCoins + 1 ld hl, hCoins + 1 ld c, $2 @@ -107,13 +118,13 @@ HiddenCoins: call EnableAutoTextBoxDrawing ld a, [wPlayerCoins] cp $99 - jr nz, .RoomInCoinCase + jr nz, .roomInCoinCase ld a, [wPlayerCoins + 1] cp $99 - jr nz, .RoomInCoinCase + jr nz, .roomInCoinCase tx_pre_id DroppedHiddenCoinsText jr .done -.RoomInCoinCase +.roomInCoinCase tx_pre_id FoundHiddenCoinsText .done jp PrintPredefTextID diff --git a/engine/overworld/hidden_objects.asm b/engine/overworld/hidden_objects.asm index dcdf8537..9a81dcfc 100755 --- a/engine/overworld/hidden_objects.asm +++ b/engine/overworld/hidden_objects.asm @@ -1,43 +1,17 @@ -IsPlayerOnDungeonWarp: - xor a - ld [wWhichDungeonWarp], a - ld a, [wd72d] - bit 4, a - ret nz - call ArePlayerCoordsInArray - ret nc - ld a, [wCoordIndex] - ld [wWhichDungeonWarp], a - ld hl, wd72d - set 4, [hl] - ld hl, wd732 - set 4, [hl] - ret - -; if a hidden object was found, stores $00 in [$ffee], else stores $ff +; if a hidden object was found, stores $00 in [hDidntFindAnyHiddenObject], else stores $ff CheckForHiddenObject: - ld hl, $ffeb + ld hl, hItemAlreadyFound xor a ld [hli], a ld [hli], a ld [hli], a ld [hl], a - ld de, $0 ld hl, HiddenObjectMaps -.hiddenMapLoop - ld a, [hli] - ld b, a - cp $ff - jr z, .noMatch + ld de, 3 ld a, [wCurMap] - cp b - jr z, .foundMatchingMap - inc de - inc de - jr .hiddenMapLoop -.foundMatchingMap - ld hl, HiddenObjectPointers - add hl, de + call IsInArray + jr nc, .noMatch + inc hl ld a, [hli] ld h, [hl] ld l, a @@ -81,13 +55,13 @@ CheckForHiddenObject: ret .noMatch ld a, $ff - ld [$ffee], a + ld [hDidntFindAnyHiddenObject], a ret ; checks if the coordinates in front of the player's sprite match Y in b and X in c ; [hCoordsInFrontOfPlayerMatch] = $00 if they match, $ff if they don't match CheckIfCoordsInFrontOfPlayerMatch: - ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction + ld a, [wPlayerFacingDirection] ; player's sprite facing direction cp SPRITE_FACING_UP jr z, .facingUp cp SPRITE_FACING_LEFT diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm index 342540b2..e7874637 100755 --- a/engine/overworld/ledges.asm +++ b/engine/overworld/ledges.asm @@ -6,7 +6,7 @@ HandleLedges: and a ; OVERWORLD ret nz predef GetTileAndCoordsInFrontOfPlayer - ld a, [wSpriteStateData1 + 9] + ld a, [wPlayerFacingDirection] ld b, a aCoord 8, 9 ld c, a @@ -71,10 +71,13 @@ LoadHoppingShadowOAM: ld de, LedgeHoppingShadow lb bc, BANK(LedgeHoppingShadow), (LedgeHoppingShadowEnd - LedgeHoppingShadow) / $8 call CopyVideoDataDouble - ld a, $9 - lb bc, $54, $48 ; b, c = y, x coordinates of shadow - ld de, LedgeHoppingShadowOAM - call WriteOAMBlock + ld hl, LedgeHoppingShadowOAM + ld de, wOAMBuffer + 36 * 4 + ld bc, LedgeHoppingShadowOAMEnd - LedgeHoppingShadowOAM + call CopyData + ld a, $a0 + ld [wOAMBuffer + 38 * 4], a + ld [wOAMBuffer + 39 * 4], a ret LedgeHoppingShadow: @@ -82,5 +85,6 @@ LedgeHoppingShadow: LedgeHoppingShadowEnd: LedgeHoppingShadowOAM: - db $FF,$10,$FF,$20 - db $FF,$40,$FF,$60 + db $58,$48,$FF,$00 + db $58,$50,$FF,$20 +LedgeHoppingShadowOAMEnd: diff --git a/engine/overworld/load_tileset_header.asm b/engine/overworld/load_tileset_header.asm new file mode 100644 index 00000000..05061651 --- /dev/null +++ b/engine/overworld/load_tileset_header.asm @@ -0,0 +1,51 @@ +LoadTilesetHeader: + call GetPredefRegisters + push hl + ld d, 0 + ld a, [wCurMapTileset] + add a + add a + ld e, a + ld hl, Tilesets + add hl, de + add hl, de + add hl, de + ld de, wTilesetBank + ld bc, $b + call CopyData + ld a, [hl] + ld [hTilesetType], a + xor a + ld [$ffd8], a + pop hl + ld a, [wCurMapTileset] + push hl + push de + ld hl, DungeonTilesets + ld de, $1 + call IsInArray + pop de + pop hl + jr c, .notDungeonTileset + ld a, [wCurMapTileset] + ld b, a + ld a, [hPreviousTileset] + cp b + jr z, .done +.notDungeonTileset + ld a, [wDestinationWarpID] + cp $ff + jr z, .done + call LoadDestinationWarpPosition + ld a, [wYCoord] + and $1 + ld [wYBlockCoord], a + ld a, [wXCoord] + and $1 + ld [wXBlockCoord], a +.done + ret + +INCLUDE "data/dungeon_tilesets.asm" + +INCLUDE "data/tileset_headers.asm" diff --git a/engine/overworld/load_wild_data.asm b/engine/overworld/load_wild_data.asm new file mode 100644 index 00000000..6444ab7e --- /dev/null +++ b/engine/overworld/load_wild_data.asm @@ -0,0 +1,33 @@ +LoadWildData: + ld hl,WildDataPointers + ld a,[wCurMap] + + ; get wild data for current map + ld c,a + ld b,0 + add hl,bc + add hl,bc + ld a,[hli] + ld h,[hl] + ld l,a ; hl now points to wild data for current map + ld a,[hli] + ld [wGrassRate],a + and a + jr z,.NoGrassData ; if no grass data, skip to surfing data + push hl + ld de,wGrassMons ; otherwise, load grass data + ld bc,$0014 + call CopyData + pop hl + ld bc,$0014 + add hl,bc +.NoGrassData + ld a,[hli] + ld [wWaterRate],a + and a + ret z ; if no water data, we're done + ld de,wWaterMons ; otherwise, load surfing data + ld bc,$0014 + jp CopyData + +INCLUDE "data/wild_mons.asm" diff --git a/engine/overworld/map_sprite_functions1.asm b/engine/overworld/map_sprite_functions1.asm new file mode 100644 index 00000000..f0a718bd --- /dev/null +++ b/engine/overworld/map_sprite_functions1.asm @@ -0,0 +1,390 @@ +_UpdateSprites: + ld h, wSpriteStateData1 / $100 + inc h + ld a, $e ; (wSpriteStateData2 + $0e) & $ff +.spriteLoop + ld l, a + sub $e + ld c, a + ld [H_CURRENTSPRITEOFFSET], a + ld a, [hl] + and a + jr z, .skipSprite ; tests $c2Xe + push hl + push de + push bc + call .updateCurrentSprite + pop bc + pop de + pop hl +.skipSprite + ld a, l + add $10 ; move to next sprite + cp $e ; test for overflow (back at $0e) + jr nz, .spriteLoop + ret +.updateCurrentSprite ; 4bd7 (1:4bd7) + ld a, [H_CURRENTSPRITEOFFSET] + and a + jp z, UpdatePlayerSprite + cp $f0 ; pikachu + jp z, SpawnPikachu + ld a, [hl] + +UpdateNonPlayerSprite: + dec a + swap a + ld [$ff93], a ; $10 * sprite# + ld a, [wNPCMovementScriptSpriteOffset] ; some sprite offset? + ld b, a + ld a, [H_CURRENTSPRITEOFFSET] + cp b + jr nz, .unequal + jp DoScriptedNPCMovement +.unequal + jp UpdateNPCSprite + +; This detects if the current sprite (whose offset is at H_CURRENTSPRITEOFFSET) +; is going to collide with another sprite by looping over the other sprites. +; The current sprite's offset will be labelled with i (e.g. $c1i0). +; The loop sprite's offset will labelled with j (e.g. $c1j0). +; +; Note that the Y coordinate of the sprite (in [$c1k4]) is one of the following +; 9 values when the sprite is aligned with the grid: $fc, $0c, $1c, $2c, ..., $7c. +; The reason that 4 is added below to the coordinate is to make it align with a +; multiple of $10 to make comparisons easier. +DetectCollisionBetweenSprites: + ; nop + + ld h, wSpriteStateData1 / $100 + ld a, [H_CURRENTSPRITEOFFSET] + ld l, a + + ld a, [hl] ; a = [$c1i0] (picture) (0 if slot is unused) + and a ; is this sprite slot slot used? + ret z ; return if not used + + ld a, l + add 3 + ld l, a + + ld a, [hli] ; a = [$c1i3] (delta Y) (-1, 0, or 1) + call SetSpriteCollisionValues + + ld a, [hli] ; a = [$C1i4] (Y screen coordinate) + add 4 ; align with multiple of $10 + +; The effect of the following 3 lines is to +; add 7 to a if moving south or +; subtract 7 from a if moving north. + add b + and $f0 + or c + + ld [$ff90], a ; store Y coordinate adjusted for direction of movement + + ld a, [hli] ; a = [$c1i5] (delta X) (-1, 0, or 1) + call SetSpriteCollisionValues + ld a, [hl] ; a = [$C1i6] (X screen coordinate) + +; The effect of the following 3 lines is to +; add 7 to a if moving east or +; subtract 7 from a if moving west. + add b + and $f0 + or c + + ld [$ff91], a ; store X coordinate adjusted for direction of movement + + ld a, l + add 7 + ld l, a + + xor a + ld [hld], a ; zero [$c1id] XXX what's [$c1id] for? + ld [hld], a ; zero [$c1ic] (directions in which collisions occurred) + + ld a, [$ff91] + ld [hld], a ; [$c1ib] = adjusted X coordinate + ld a, [$ff90] + ld [hl], a ; [$c1ia] = adjusted Y coordinate + + xor a ; zero the loop counter + +.loop + ld [$ff8f], a ; store loop counter + swap a + ld e, a + ld a, [H_CURRENTSPRITEOFFSET] + cp e ; does the loop sprite match the current sprite? + jp z, .next ; go to the next sprite if they match + + ld d, h + ld a, [de] ; a = [$c1j0] (picture) (0 if slot is unused) + and a ; is this sprite slot slot used? + jp z, .next ; go the next sprite if not used + + inc e + inc e + ld a, [de] ; a = [$c1j2] ($ff means the sprite is offscreen) + inc a + jp z, .next ; go the next sprite if offscreen + + ld a, [H_CURRENTSPRITEOFFSET] + add 10 + ld l, a + + inc e + ld a, [de] ; a = [$c1j3] (delta Y) + call SetSpriteCollisionValues + + inc e + ld a, [de] ; a = [$C1j4] (Y screen coordinate) + add 4 ; align with multiple of $10 + +; The effect of the following 3 lines is to +; add 7 to a if moving south or +; subtract 7 from a if moving north. + add b + and $f0 + or c + + sub [hl] ; subtract the adjusted Y coordinate of sprite i ([$c1ia]) from that of sprite j + +; calculate the absolute value of the difference to get the distance + jr nc, .noCarry1 + cpl + inc a +.noCarry1 + ld [$ff90], a ; store the distance between the two sprites' adjusted Y values + +; Use the carry flag set by the above subtraction to determine which sprite's +; Y coordinate is larger. This information is used later to set [$c1ic], +; which stores which direction the collision occurred in. +; The following 5 lines set the lowest 2 bits of c, which are later shifted left by 2. +; If sprite i's Y is larger, set lowest 2 bits of c to 10. +; If sprite j's Y is larger or both are equal, set lowest 2 bits of c to 01. + push af + rl c + pop af + ccf + rl c + +; If sprite i's delta Y is 0, then b = 7, else b = 9. + ld b, 7 + ld a, [hl] ; a = [$c1ia] (adjusted Y coordinate) + and $f + jr z, .next1 + ld b, 9 + +.next1 + ld a, [$ff90] ; a = distance between adjusted Y coordinates + sub b + ld [$ff92], a ; store distance adjusted using sprite i's direction + ld a, b + ld [$ff90], a ; store 7 or 9 depending on sprite i's delta Y + jr c, .checkXDistance + +; If sprite j's delta Y is 0, then b = 7, else b = 9. + ld b, 7 + dec e + ld a, [de] ; a = [$c1j3] (delta Y) + inc e + and a + jr z, .next2 + ld b, 9 + +.next2 + ld a, [$ff92] ; a = distance adjusted using sprite i's direction + sub b ; adjust distance using sprite j's direction + jr z, .checkXDistance + jr nc, .next ; go to next sprite if distance is still positive after both adjustments + +.checkXDistance + inc e + inc l + ld a, [de] ; a = [$c1j5] (delta X) + + push bc + + call SetSpriteCollisionValues + inc e + ld a, [de] ; a = [$c1j6] (X screen coordinate) + +; The effect of the following 3 lines is to +; add 7 to a if moving east or +; subtract 7 from a if moving west. + add b + and $f0 + or c + + pop bc + + sub [hl] ; subtract the adjusted X coordinate of sprite i ([$c1ib]) from that of sprite j + +; calculate the absolute value of the difference to get the distance + jr nc, .noCarry2 + cpl + inc a +.noCarry2 + ld [$ff91], a ; store the distance between the two sprites' adjusted X values + +; Use the carry flag set by the above subtraction to determine which sprite's +; X coordinate is larger. This information is used later to set [$c1ic], +; which stores which direction the collision occurred in. +; The following 5 lines set the lowest 2 bits of c. +; If sprite i's X is larger, set lowest 2 bits of c to 10. +; If sprite j's X is larger or both are equal, set lowest 2 bits of c to 01. + push af + rl c + pop af + ccf + rl c + +; If sprite i's delta X is 0, then b = 7, else b = 9. + ld b, 7 + ld a, [hl] ; a = [$c1ib] (adjusted X coordinate) + and $f + jr z, .next3 + ld b, 9 + +.next3 + ld a, [$ff91] ; a = distance between adjusted X coordinates + sub b + ld [$ff92], a ; store distance adjusted using sprite i's direction + ld a, b + ld [$ff91], a ; store 7 or 9 depending on sprite i's delta X + jr c, .collision + +; If sprite j's delta X is 0, then b = 7, else b = 9. + ld b, 7 + dec e + ld a, [de] ; a = [$c1j5] (delta X) + inc e + and a + jr z, .next4 + ld b, 9 + +.next4 + ld a, [$ff92] ; a = distance adjusted using sprite i's direction + sub b ; adjust distance using sprite j's direction + jr z, .collision + jr nc, .next ; go to next sprite if distance is still positive after both adjustments + +.collision + ld a, l + and $f0 ; collision with pikachu? + jr nz, .asm_4cd9 + xor a + ld [wd434], a + ld a, [$ff8f] + cp $f + jr nz, .asm_4cd9 + call Func_4d0a + jr .asm_4cef +.asm_4cd9 + ld a, [$ff91] ; a = 7 or 9 depending on sprite i's delta X + ld b, a + ld a, [$ff90] ; a = 7 or 9 depending on sprite i's delta Y + inc l + +; If delta X isn't 0 and delta Y is 0, then b = %0011, else b = %1100. +; (note that normally if delta X isn't 0, then delta Y must be 0 and vice versa) + cp b + jr c, .next5 + ld b, %1100 + jr .next6 +.next5 + ld b, %0011 + +.next6 + ld a, c ; c has 2 bits set (one of bits 0-1 is set for the X axis and one of bits 2-3 for the Y axis) + and b ; we select either the bit in bits 0-1 or bits 2-3 based on the calculation immediately above + or [hl] ; or with existing collision direction bits in [$c1ic] + ld [hl], a ; store new value + ld a, c ; useless code because a is overwritten before being used again + +; set bit in [$c1ie] or [$c1if] to indicate which sprite the collision occurred with + inc l + inc l +.asm_4cef + ld a, [$ff8f] ; a = loop counter + ld de, SpriteCollisionBitTable + add a + add e + ld e, a + jr nc, .noCarry3 + inc d +.noCarry3 + ld a, [de] + or [hl] + ld [hli], a + inc de + ld a, [de] + or [hl] + ld [hl], a + +.next + ld a, [$ff8f] ; a = loop counter + inc a + cp $10 + jp nz, .loop + ret + +; takes delta X or delta Y in a +; b = delta X/Y +; c = 0 if delta X/Y is 0 +; c = 7 if delta X/Y is 1 +; c = 9 if delta X/Y is -1 +Func_4d0a: + ld a, [$ff91] + ld b, a + ld a, [$ff90] + inc l + cp b + jr c, .asm_4d17 + ld b, %1100 + jr .asm_4d19 +.asm_4d17 + ld b, %11 +.asm_4d19 + ld a, c + and b + ld [wd434], a + ld a, c + inc l + inc l + ret + +SetSpriteCollisionValues: + and a + ld b, 0 + ld c, 0 + jr z, .done + ld c, 9 + cp -1 + jr z, .ok + ld c, 7 + ld a, 0 +.ok + ld b, a +.done + ret + +SpriteCollisionBitTable: + db %00000000,%00000001 + db %00000000,%00000010 + db %00000000,%00000100 + db %00000000,%00001000 + db %00000000,%00010000 + db %00000000,%00100000 + db %00000000,%01000000 + db %00000000,%10000000 + db %00000001,%00000000 + db %00000010,%00000000 + db %00000100,%00000000 + db %00001000,%00000000 + db %00010000,%00000000 + db %00100000,%00000000 + db %01000000,%00000000 + db %10000000,%00000000 diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index 05588321..43b44946 100755 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -8,433 +8,361 @@ ; fields, respectively, within loops. The X is the loop index. ; If there is an inner loop, Y is the inner loop index, i.e. $C1Y* and $C2Y* ; denote fields of the sprite slots interated over in the inner loop. -InitMapSprites: +_InitMapSprites: call InitOutsideMapSprites ret c ; return if the map is an outside map (already handled by above call) ; if the map is an inside map (i.e. mapID >= $25) - ld hl,wSpriteStateData1 - ld de,wSpriteStateData2 + $0d -; Loop to copy picture ID's from $C1X0 to $C2XD for LoadMapSpriteTilePatterns. -.copyPictureIDLoop - ld a,[hl] ; $C1X0 (picture ID) - ld [de],a ; $C2XD - ld a,$10 - add e - ld e,a - ld a,$10 - add l - ld l,a - jr nz,.copyPictureIDLoop - -; This is used for both inside and outside maps, since it is called by -; InitOutsideMapSprites. -; Loads tile pattern data for sprites into VRAM. -LoadMapSpriteTilePatterns: - ld a,[wNumSprites] - and a ; are there any sprites? - jr nz,.spritesExist - ret -.spritesExist - ld c,a ; c = [wNumSprites] - ld b,$10 ; number of sprite slots - ld hl,wSpriteStateData2 + $0d - xor a - ld [hFourTileSpriteCount],a -.copyPictureIDLoop ; loop to copy picture ID from $C2XD to $C2XE - ld a,[hli] ; $C2XD (sprite picture ID) - ld [hld],a ; $C2XE - ld a,l - add a,$10 - ld l,a - dec b - jr nz,.copyPictureIDLoop - ld hl,wSpriteStateData2 + $1e -.loadTilePatternLoop - ld de,wSpriteStateData2 + $1d -; Check if the current picture ID has already had its tile patterns loaded. -; This done by looping through the previous sprite slots and seeing if any of -; their picture ID's match that of the current sprite slot. -.checkIfAlreadyLoadedLoop - ld a,e - and a,$f0 - ld b,a ; b = offset of the wSpriteStateData2 sprite slot being checked against - ld a,l - and a,$f0 ; a = offset of current wSpriteStateData2 sprite slot - cp b ; done checking all previous sprite slots? - jr z,.notAlreadyLoaded - ld a,[de] ; picture ID of the wSpriteStateData2 sprite slot being checked against - cp [hl] ; do the picture ID's match? - jp z,.alreadyLoaded - ld a,e - add a,$10 - ld e,a - jr .checkIfAlreadyLoadedLoop -.notAlreadyLoaded - ld de,wSpriteStateData2 + $0e - ld b,$01 -; loop to find the highest tile pattern VRAM slot (among the first 10 slots) used by a previous sprite slot -; this is done in order to find the first free VRAM slot available -.findNextVRAMSlotLoop - ld a,e - add a,$10 - ld e,a - ld a,l - cp e ; reached current slot? - jr z,.foundNextVRAMSlot - ld a,[de] ; $C2YE (VRAM slot) - cp a,11 ; is it one of the first 10 slots? - jr nc,.findNextVRAMSlotLoop - cp b ; compare the slot being checked to the current max - jr c,.findNextVRAMSlotLoop ; if the slot being checked is less than the current max -; if the slot being checked is greater than or equal to the current max - ld b,a ; store new max VRAM slot - jr .findNextVRAMSlotLoop -.foundNextVRAMSlot - inc b ; increment previous max value to get next VRAM tile pattern slot - ld a,b ; a = next VRAM tile pattern slot - push af - ld a,[hl] ; $C2XE (sprite picture ID) - ld b,a ; b = current sprite picture ID - cp a,SPRITE_BALL ; is it a 4-tile sprite? - jr c,.notFourTileSprite - pop af - ld a,[hFourTileSpriteCount] - add a,11 - jr .storeVRAMSlot -.notFourTileSprite - pop af -.storeVRAMSlot - ld [hl],a ; store VRAM slot at $C2XE - ld [hVRAMSlot],a ; used to determine if it's 4-tile sprite later - ld a,b ; a = current sprite picture ID - dec a - add a - add a - push bc - push hl - ld hl,SpriteSheetPointerTable - jr nc,.noCarry - inc h -.noCarry - add l - ld l,a - jr nc,.noCarry2 - inc h -.noCarry2 - push hl - call ReadSpriteSheetData - push af - push de - push bc - ld hl,vNPCSprites ; VRAM base address - ld bc,$c0 ; number of bytes per VRAM slot - ld a,[hVRAMSlot] - cp a,11 ; is it a 4-tile sprite? - jr nc,.fourTileSpriteVRAMAddr - ld d,a - dec d -; Equivalent to multiplying $C0 (number of bytes in 12 tiles) times the VRAM -; slot and adding the result to $8000 (the VRAM base address). -.calculateVRAMAddrLoop - add hl,bc - dec d - jr nz,.calculateVRAMAddrLoop - jr .loadStillTilePattern -.fourTileSpriteVRAMAddr - ld hl,vSprites + $7c0 ; address for second 4-tile sprite - ld a,[hFourTileSpriteCount] - and a - jr nz,.loadStillTilePattern -; if it's the first 4-tile sprite - ld hl,vSprites + $780 ; address for first 4-tile sprite - inc a - ld [hFourTileSpriteCount],a -.loadStillTilePattern - pop bc - pop de - pop af - push hl - push hl - ld h,d - ld l,e - pop de - ld b,a - ld a,[wFontLoaded] - bit 0,a ; reloading upper half of tile patterns after displaying text? - jr nz,.skipFirstLoad ; if so, skip loading data into the lower half - ld a,b - ld b,0 - call FarCopyData2 ; load tile pattern data for sprite when standing still -.skipFirstLoad - pop de - pop hl - ld a,[hVRAMSlot] - cp a,11 ; is it a 4-tile sprite? - jr nc,.skipSecondLoad ; if so, there is no second block - push de - call ReadSpriteSheetData - push af - ld a,$c0 - add e - ld e,a - jr nc,.noCarry3 - inc d -.noCarry3 - ld a,[wFontLoaded] - bit 0,a ; reloading upper half of tile patterns after displaying text? - jr nz,.loadWhileLCDOn - pop af - pop hl - set 3,h ; add $800 to hl - push hl - ld h,d - ld l,e - pop de - call FarCopyData2 ; load tile pattern data for sprite when walking - jr .skipSecondLoad -; When reloading the upper half of tile patterns after diplaying text, the LCD -; will be on, so CopyVideoData (which writes to VRAM only during V-blank) must -; be used instead of FarCopyData2. -.loadWhileLCDOn - pop af - pop hl - set 3,h ; add $800 to hl - ld b,a - swap c - call CopyVideoData ; load tile pattern data for sprite when walking -.skipSecondLoad - pop hl - pop bc - jr .nextSpriteSlot -.alreadyLoaded ; if the current picture ID has already had its tile patterns loaded - inc de - ld a,[de] ; a = VRAM slot for the current picture ID (from $C2YE) - ld [hl],a ; store VRAM slot in current wSpriteStateData2 sprite slot (at $C2XE) -.nextSpriteSlot - ld a,l - add a,$10 - ld l,a - dec c - jp nz,.loadTilePatternLoop - ld hl,wSpriteStateData2 + $0d - ld b,$10 -; the pictures ID's stored at $C2XD are no longer needed, so zero them -.zeroStoredPictureIDLoop - xor a - ld [hl],a ; $C2XD - ld a,$10 - add l - ld l,a - dec b - jr nz,.zeroStoredPictureIDLoop - ret - -; reads data from SpriteSheetPointerTable -; INPUT: -; hl = address of sprite sheet entry -; OUTPUT: -; de = pointer to sprite sheet -; bc = length in bytes -; a = ROM bank -ReadSpriteSheetData: - ld a,[hli] - ld e,a - ld a,[hli] - ld d,a - ld a,[hli] - ld c,a - xor a - ld b,a - ld a,[hli] + call LoadSpriteSetFromMapHeader + call LoadMapSpriteTilePatterns + call Func_14150 ret ; Loads sprite set for outside maps (cities and routes) and sets VRAM slots. ; sets carry if the map is a city or route, unsets carry if not InitOutsideMapSprites: - ld a,[wCurMap] - cp a,REDS_HOUSE_1F ; is the map a city or a route (map ID less than $25)? + ld a, [wCurMap] + cp a, REDS_HOUSE_1F ; is the map a city or a route (map ID less than $25)? ret nc ; if not, return - ld hl,MapSpriteSets - add l - ld l,a - jr nc,.noCarry - inc h -.noCarry - ld a,[hl] ; a = spriteSetID - cp a,$f0 ; does the map have 2 sprite sets? - call nc,GetSplitMapSpriteSetID ; if so, choose the appropriate one - ld b,a ; b = spriteSetID - ld a,[wFontLoaded] - bit 0,a ; reloading upper half of tile patterns after displaying text? - jr nz,.loadSpriteSet ; if so, forcibly reload the sprite set - ld a,[wSpriteSetID] + call GetSplitMapSpriteSetID +; if so, choose the appropriate one + ld b, a ; b = spriteSetID + ld a, [wFontLoaded] + bit 0, a ; reloading upper half of tile patterns after displaying text? + jr nz, .loadSpriteSet ; if so, forcibly reload the sprite set + ld a, [wSpriteSetID] cp b ; has the sprite set ID changed? - jr z,.skipLoadingSpriteSet ; if not, don't load it again + jr z, .skipLoadingSpriteSet ; if not, don't load it again .loadSpriteSet - ld a,b - ld [wSpriteSetID],a + ld a, b + ld [wSpriteSetID], a dec a - ld b,a - sla a - ld c,a - sla a - sla a - add c - add b ; a = (spriteSetID - 1) * 11 - ld de,SpriteSets -; add a to de to get offset of sprite set - add e - ld e,a - jr nc,.noCarry2 - inc d -.noCarry2 - ld hl,wSpriteStateData2 + $0d - ld a,SPRITE_RED - ld [hl],a - ld bc,wSpriteSet -; Load the sprite set into RAM. -; This loop also fills $C2XD (sprite picture ID) where X is from $0 to $A -; with picture ID's. This is done so that LoadMapSpriteTilePatterns will -; load tile patterns for all sprite pictures in the sprite set. -.loadSpriteSetLoop - ld a,$10 - add l - ld l,a - ld a,[de] ; sprite picture ID from sprite set - ld [hl],a ; $C2XD (sprite picture ID) - ld [bc],a - inc de - inc bc - ld a,l - cp a,$bd ; reached 11th sprite slot? - jr nz,.loadSpriteSetLoop - ld b,4 ; 4 remaining sprite slots -.zeroRemainingSlotsLoop ; loop to zero the picture ID's of the remaining sprite slots - ld a,$10 - add l - ld l,a - xor a - ld [hl],a ; $C2XD (sprite picture ID) - dec b - jr nz,.zeroRemainingSlotsLoop - ld a,[wNumSprites] - push af ; save number of sprites - ld a,11 ; 11 sprites in sprite set - ld [wNumSprites],a + ld c, a + ld b, 0 + ld a, (wSpriteSetID - wSpriteSet) + ld hl, SpriteSets + call AddNTimes ; get sprite set offset + ld de, wSpriteSet + ld bc, (wSpriteSetID - wSpriteSet) + call CopyData ; copy it to wSpriteSet call LoadMapSpriteTilePatterns - pop af - ld [wNumSprites],a ; restore number of sprites - ld hl,wSpriteStateData2 + $1e - ld b,$0f -; The VRAM tile pattern slots that LoadMapSpriteTilePatterns set are in the -; order of the map's sprite set, not the order of the actual sprites loaded -; for the current map. So, they are not needed and are zeroed by this loop. -.zeroVRAMSlotsLoop - xor a - ld [hl],a ; $C2XE (VRAM slot) - ld a,$10 - add l - ld l,a - dec b - jr nz,.zeroVRAMSlotsLoop .skipLoadingSpriteSet - ld hl,wSpriteStateData1 + $10 + call Func_14150 + scf + ret + +LoadSpriteSetFromMapHeader: ; This loop stores the correct VRAM tile pattern slots according the sprite ; data from the map's header. Since the VRAM tile pattern slots are filled in ; the order of the sprite set, in order to find the VRAM tile pattern slot ; for a sprite slot, the picture ID for the sprite is looked up within the -; sprite set. The index of the picture ID within the sprite set plus one -; (since the Red sprite always has the first VRAM tile pattern slot) is the -; VRAM tile pattern slot. +; sprite set. The index of the picture ID within the sprite set plus two +; (since the Red sprite always has the first VRAM tile pattern slot and the +; Pikachu sprite reserves the second slot) is the VRAM tile pattern slot. + ld hl, wSpriteSet + ld bc, (wSpriteSetID - wSpriteSet) + xor a + call FillMemory + ld a, SPRITE_PIKACHU ; load Pikachu separately + ld [wSpriteSet], a + ld hl, wSprite01SpriteStateData1 + ld a, 14 .storeVRAMSlotsLoop - ld c,0 - ld a,[hl] ; $C1X0 (picture ID) (zero if sprite slot is not used) + push af + ld a, [hl] ; $C1X0 (picture ID) (zero if sprite slot is not used) and a ; is the sprite slot used? - jr z,.skipGettingPictureIndex ; if the sprite slot is not used - ld b,a ; b = picture ID - ld de,wSpriteSet -; Loop to find the index of the sprite's picture ID within the sprite set. -.getPictureIndexLoop - inc c - ld a,[de] + jr z, .continue ; if the sprite slot is not used + ld c, a + call CheckForFourTileSprite ; is this a four tile sprite? + jr nc, .isFourTileSprite +; loop through the space reserved for four tile picture IDs + ld de, wSpriteSet + 9 + ld b, 2 + call CheckIfPictureIDAlreadyLoaded + jr .continue + +.isFourTileSprite +; loop through the space reserved for regular picture IDs + ld de, wSpriteSet + ld b, 9 + call CheckIfPictureIDAlreadyLoaded +.continue + ld de, wSprite02SpriteStateData1 - wSprite01SpriteStateData1 + add hl, de + pop af + dec a + jr nz, .storeVRAMSlotsLoop + ret + +CheckIfPictureIDAlreadyLoaded: +; Check if the current picture ID has already had its tile patterns loaded. +; This done by looping through the previous sprite slots and seeing if any of +; their picture ID's match that of the current sprite slot. +.loop + ld a, [de] + and a ; is sprite set slot not taken up yet? + jr z, .spriteSlotNotTaken ; if so, load it as it signifies we've reached + ; the end of data for the last sprite set + + cp c ; is the tile pattern already loaded? + ret z ; don't redundantly load + dec b ; have we reached the end of the sprite set? + jr z, .spriteNotAlreadyLoaded ; if so, we're done here inc de - cp b ; does the picture ID match? - jr nz,.getPictureIndexLoop - inc c -.skipGettingPictureIndex - push hl - inc h - ld a,$0e - add l - ld l,a - ld a,c ; a = VRAM slot (zero if sprite slot is not used) - ld [hl],a ; $C2XE (VRAM slot) - pop hl - ld a,$10 - add l - ld l,a + jr .loop + +.spriteSlotNotTaken + ld a, c + ld [de], a + ret +.spriteNotAlreadyLoaded + scf + ret + +CheckForFourTileSprite: +; Checks for a sprite added in yellow +; Returns no carry if the sprite is Pikachu, as its sprite is handled separately +; Else, returns carry if the sprite uses 4 tiles + cp SPRITE_PIKACHU ; is this the Pikachu Sprite? + ret z ; return if yes + + cp SPRITE_BALL ; is this a four tile sprite? + jr nc, .notYellowSprite ; set carry if yes +; regular sprite and a - jr nz,.storeVRAMSlotsLoop + ret + +.notYellowSprite scf ret +LoadMapSpriteTilePatterns: + ld a, 0 +.loop + ld [hVRAMSlot], a + cp 9 + jr nc, .fourTileSprite + call LoadStillTilePattern + call LoadWalkingTilePattern + jr .continue + +.fourTileSprite + call LoadStillTilePattern +.continue + ld a, [hVRAMSlot] + inc a + cp 11 + jr nz, .loop + ret + +ReloadWalkingTilePatterns: + xor a +.loop + ld [hVRAMSlot], a + cp 9 + jr nc, .fourTileSprite + call LoadWalkingTilePattern +.fourTileSprite + ld a, [hVRAMSlot] + inc a + cp 11 + jr nz, .loop + ret + +LoadStillTilePattern: + ld a, [wFontLoaded] + bit 0, a ; reloading upper half of tile patterns after displaying text? + ret nz ; if so, skip loading data into the lower half + call ReadSpriteSheetData + ret nc + call GetSpriteVRAMAddress + call CopyVideoDataAlternate ; new yellow function + ret + +LoadWalkingTilePattern: + call ReadSpriteSheetData + ret nc + ld hl, $c0 + add hl, de + ld d, h + ld e, l + call GetSpriteVRAMAddress + set 3, h ; add $800 to hl + call CopyVideoDataAlternate + ret + +GetSpriteVRAMAddress: + push bc + ld a, [hVRAMSlot] + ld c, a + ld b, 0 + ld hl, SpriteVRAMAddresses + add hl, bc + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + pop bc + ret + +SpriteVRAMAddresses: +; Equivalent to multiplying $C0 (number of bytes in 12 tiles) times the VRAM +; slot and adding the result to $8000 (the VRAM base address). + dw vChars0 + $0c0 + dw vChars0 + $180 + dw vChars0 + $240 + dw vChars0 + $300 + dw vChars0 + $3c0 + dw vChars0 + $480 + dw vChars0 + $540 + dw vChars0 + $600 + dw vChars0 + $6c0 + dw vChars0 + $780 ; 4-tile sprites + dw vChars0 + $7c0 ; 4-tile sprites + +ReadSpriteSheetData: + ld a, [hVRAMSlot] + ld e, a + ld d, 0 + ld hl, wSpriteSet + add hl, de + ld a, [hl] + and a + ret z + + dec a + ld l, a + ld h, 0 + add hl, hl + add hl, hl + ld de, SpriteSheetPointerTable + add hl, de + ld e, [hl] + inc hl + ld d, [hl] + inc hl + ld c, [hl] + swap c ; get the number of tiles, not the raw byte length + ; this is because of the use of CopyVideoDataAlternate + inc hl + ld b, [hl] + inc hl + scf + ret + +Func_14150: + ld a, $1 + ld [wPlayerSpriteImageBaseOffset], a ; vram slot for player + ld a, $2 + ld [wPikachuSpriteImageBaseOffset], a ; vram slot for Pikachu + ld a, $e + ld hl, wSprite01SpriteStateData1 +.loop + ld [hVRAMSlot], a ; store current sprite set slot as a counter + ld a, [hl] ; $c1x0 (picture ID) + and a ; is the sprite unused? + jr z, .spriteUnused + call Func_14179 + push hl + ld de, (wPlayerSpriteImageBaseOffset) - (wSpriteStateData1) ; $10e + add hl, de ; get $c2xe (sprite image base offset) + ld [hl], a ; write offset + pop hl +.spriteUnused + ld de, wSprite02SpriteStateData1 - wSprite01SpriteStateData1 + add hl, de + ld a, [hVRAMSlot] + dec a + jr nz, .loop + ret + +Func_14179: + push de + push bc + ld c, a ; c = picture ID + ld b, 11 + ld de, wSpriteSet +.findSpriteImageBaseOffsetLoop + ld a, [de] ; a = sprite set picture ID + cp c ; have we found a match? + jr z, .foundSpritePictureID ; if so, get the sprite image base offset and return + inc de + dec b ; have we looped through all entries in wSpriteSet? + jr nz, .findSpriteImageBaseOffsetLoop ; continue looping if not + ld a, $1 ; assume slot one if this ever happens + jr .done +.foundSpritePictureID + ld a, 13 + sub b ; get sprite image base offset +.done + pop bc + pop de + ret + +GetSplitMapSpriteSetID: + ld e, a + ld d, 0 + ld hl, MapSpriteSets + add hl, de + ld a, [hl] ; a = spriteSetID + cp a, $f0 ; does the map have 2 sprite sets? + ret c ; Chooses the correct sprite set ID depending on the player's position within ; the map for maps with two sprite sets. -GetSplitMapSpriteSetID: - cp a,$f8 - jr z,.route20 - ld hl,SplitMapSpriteSets - and a,$0f + cp a, $f8 + jr z, .route20 + ld hl, SplitMapSpriteSets + and a, $0f dec a - sla a - sla a + add a + add a add l - ld l,a - jr nc,.noCarry + ld l, a + jr nc, .noCarry inc h .noCarry - ld a,[hli] ; determines whether the map is split East/West or North/South - cp a,$01 - ld a,[hli] ; position of dividing line - ld b,a - jr z,.eastWestDivide + ld a, [hli] ; determines whether the map is split East/West or North/South + cp a, $01 + ld a, [hli] ; position of dividing line + ld b, a + jr z, .eastWestDivide .northSouthDivide - ld a,[wYCoord] + ld a, [wYCoord] jr .compareCoord + .eastWestDivide - ld a,[wXCoord] + ld a, [wXCoord] .compareCoord cp b - jr c,.loadSpriteSetID + jr c, .loadSpriteSetID ; if in the East side or South side inc hl .loadSpriteSetID - ld a,[hl] + ld a, [hl] ret ; Uses sprite set $01 for West side and $0A for East side. ; Route 20 is a special case because the two map sections have a more complex ; shape instead of the map simply being split horizontally or vertically. .route20 - ld hl,wXCoord - ld a,[hl] - cp a,$2b - ld a,$01 + ld hl, wXCoord + ld a, [hl] + cp a, $2b + ld a, $01 ret c - ld a,[hl] - cp a,$3e - ld a,$0a + ld a, [hl] + cp a, $3e + ld a, $0a ret nc - ld a,[hl] - cp a,$37 - ld b,$08 - jr nc,.next - ld b,$0d + ld a, [hl] + cp a, $37 + ld b, $08 + jr nc, .next + ld b, $0d .next - ld a,[wYCoord] + ld a, [wYCoord] cp b - ld a,$0a + ld a, $0a ret c - ld a,$01 + ld a, $01 ret INCLUDE "data/sprite_sets.asm" diff --git a/engine/overworld/missable_objects.asm b/engine/overworld/missable_objects.asm new file mode 100644 index 00000000..dd601451 --- /dev/null +++ b/engine/overworld/missable_objects.asm @@ -0,0 +1,212 @@ +MarkTownVisitedAndLoadMissableObjects: + ld a, [wCurMap] + cp ROUTE_1 + jr nc, .notInTown + ld c, a + ld b, FLAG_SET + ld hl, wTownVisitedFlag ; mark town as visited (for flying) + predef FlagActionPredef +.notInTown + ld hl, MapHSPointers + ld a, [wCurMap] + ld b, $0 + ld c, a + add hl, bc + add hl, bc + ld a, [hli] ; load missable objects pointer in hl + ld h, [hl] + ; fall through + +; LoadMissableObjects: +; seems to not exist in yellow (predef replaced with something near TryPushingBoulder) + ld l, a + push hl + ld a, l + sub MapHS00 & $ff ; calculate difference between out pointer and the base pointer + ld l, a + ld a, h + sbc MapHS00 / $100 + ld h, a + ld a, h + ld [H_DIVIDEND], a + ld a, l + ld [H_DIVIDEND + 1], a + xor a + ld [H_DIVIDEND + 2], a + ld [H_DIVIDEND + 3], a + ld a, $3 + ld [H_DIVISOR], a + ld b, $2 + call Divide ; divide difference by 3, resulting in the global offset (number of missable items before ours) + ld a, [wCurMap] + ld b, a + ld a, [H_DIVIDEND + 3] + ld c, a ; store global offset in c + ld de, wMissableObjectList + pop hl +.writeMissableObjectsListLoop + ld a, [hli] + cp $ff + jr z, .done ; end of list + cp b + jr nz, .done ; not for current map anymore + ld a, [hli] + inc hl + ld [de], a ; write (map-local) sprite ID + inc de + ld a, c + inc c + ld [de], a ; write (global) missable object index + inc de + jr .writeMissableObjectsListLoop +.done + ld a, $ff + ld [de], a ; write sentinel + ret + +InitializeMissableObjectsFlags: + ld hl, wMissableObjectFlags + ld bc, wMissableObjectFlagsEnd - wMissableObjectFlags + xor a + call FillMemory ; clear missable objects flags + ld hl, MapHS00 + xor a + ld [wMissableObjectCounter], a +.missableObjectsLoop + ld a, [hli] + cp $ff ; end of list + ret z + push hl + inc hl + ld a, [hl] + cp Hide + jr nz, .skip + ld hl, wMissableObjectFlags + ld a, [wMissableObjectCounter] + ld c, a + ld b, FLAG_SET + call MissableObjectFlagAction ; set flag if Item is hidden +.skip + ld hl, wMissableObjectCounter + inc [hl] + pop hl + inc hl + inc hl + jr .missableObjectsLoop + +; tests if current sprite is a missable object that is hidden/has been removed +IsObjectHidden: + ld a, [H_CURRENTSPRITEOFFSET] + swap a + ld b, a + ld hl, wMissableObjectList +.loop + ld a, [hli] + cp $ff + jr z, .notHidden ; not missable -> not hidden + cp b + ld a, [hli] + jr nz, .loop + ld c, a + ld b, FLAG_TEST + ld hl, wMissableObjectFlags + call MissableObjectFlagAction + ld a, c + and a + jr nz, .hidden +.notHidden + xor a +.hidden + ld [$ffe5], a + ret + +; adds missable object (items, leg. pokemon, etc.) to the map +; [wMissableObjectIndex]: index of the missable object to be added (global index) +ShowObject: +ShowObject2: + ld hl, wMissableObjectFlags + ld a, [wMissableObjectIndex] + ld c, a + ld b, FLAG_RESET + call MissableObjectFlagAction ; reset "removed" flag + jp UpdateSprites + +; removes missable object (items, leg. pokemon, etc.) from the map +; [wMissableObjectIndex]: index of the missable object to be removed (global index) +HideObject: + ld hl, wMissableObjectFlags + ld a, [wMissableObjectIndex] + ld c, a + ld b, FLAG_SET + call MissableObjectFlagAction ; set "removed" flag + jp UpdateSprites + +MissableObjectFlagAction: +; identical to FlagAction + + push hl + push de + push bc + + ; bit + ld a, c + ld d, a + and 7 + ld e, a + + ; byte + ld a, d + srl a + srl a + srl a + add l + ld l, a + jr nc, .ok + inc h +.ok + + ; d = 1 << e (bitmask) + inc e + ld d, 1 +.shift + dec e + jr z, .shifted + sla d + jr .shift +.shifted + + ld a, b + and a + jr z, .reset + cp 2 + jr z, .read + +.set + ld a, [hl] + ld b, a + ld a, d + or b + ld [hl], a + jr .done + +.reset + ld a, [hl] + ld b, a + ld a, d + xor $ff + and b + ld [hl], a + jr .done + +.read + ld a, [hl] + ld b, a + ld a, d + and b + +.done + pop bc + pop de + pop hl + ld c, a + ret diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index e60f820a..ad4515ff 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -20,7 +20,13 @@ UpdatePlayerSprite: ld [wSpriteStateData1 + 2], a ret .lowerLeftTileIsMapTile + ld a, [wUpdateSpritesEnabled] + push af + ld a, $ff + ld [wUpdateSpritesEnabled], a call DetectCollisionBetweenSprites + pop af + ld [wUpdateSpritesEnabled], a ld h, wSpriteStateData1 / $100 ld a, [wWalkCounter] and a @@ -46,42 +52,24 @@ UpdatePlayerSprite: jr z, .notMoving ld a, SPRITE_FACING_RIGHT jr .next +.next + ld [wPlayerFacingDirection], a ; facing direction + ld a, [wFontLoaded] + bit 0, a + jr z, .moving .notMoving ; zero the animation counters xor a ld [wSpriteStateData1 + 7], a ld [wSpriteStateData1 + 8], a - jr .calcImageIndex -.next - ld [wSpriteStateData1 + 9], a ; facing direction - ld a, [wFontLoaded] - bit 0, a - jr nz, .notMoving + call Func_4e32 + jr .skipSpriteAnim .moving ld a, [wd736] bit 7, a ; is the player sprite spinning due to a spin tile? jr nz, .skipSpriteAnim - ld a, [H_CURRENTSPRITEOFFSET] - add $7 - ld l, a - ld a, [hl] - inc a - ld [hl], a - cp 4 - jr nz, .calcImageIndex - xor a - ld [hl], a - inc hl - ld a, [hl] - inc a - and $3 - ld [hl], a -.calcImageIndex - ld a, [wSpriteStateData1 + 8] - ld b, a - ld a, [wSpriteStateData1 + 9] - add b - ld [wSpriteStateData1 + 2], a + call Func_5274 + call Func_4e32 .skipSpriteAnim ; If the player is standing on a grass tile, make the player's sprite have ; lower priority than the background so that it's partially obscured by the @@ -95,18 +83,15 @@ UpdatePlayerSprite: jr nz, .next2 ld a, $80 .next2 - ld [wSpriteStateData2 + 7], a + ld [wSpriteStateData2 + $07], a ret -UnusedReadSpriteDataFunction: - push bc - push af - ld a, [H_CURRENTSPRITEOFFSET] - ld c, a - pop af - add c - ld l, a - pop bc +Func_4e32: + ld a, [wSpriteStateData1 + 8] + ld b, a + ld a, [wPlayerFacingDirection] + add b + ld [wSpriteStateData1 + 2], a ret UpdateNPCSprite: @@ -119,7 +104,7 @@ UpdateNPCSprite: ld l, a ld a, [hl] ; read movement byte 2 ld [wCurSpriteMovement2], a - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] ld l, a inc l @@ -128,7 +113,7 @@ UpdateNPCSprite: jp z, InitializeSpriteStatus call CheckSpriteAvailability ret c ; if sprite is invisible, on tile >=$60, in grass or player is currently walking - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] ld l, a inc l @@ -144,19 +129,21 @@ UpdateNPCSprite: jp z, UpdateSpriteMovementDelay ; c1x1 == 2 cp $3 jp z, UpdateSpriteInWalkingAnimation ; c1x1 == 3 + cp $4 + jp z, Func_5357 ld a, [wWalkCounter] and a ret nz ; don't do anything yet if player is currently moving (redundant, already tested in CheckSpriteAvailability) call InitializeSpriteScreenPosition - ld h, $c2 + ld h, wSpriteStateData2 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $6 ld l, a ld a, [hl] ; c2x6: movement byte 1 inc a - jr z, .randomMovement ; value $FF + jp z, .randomMovement ; value $FF inc a - jr z, .randomMovement ; value $FE + jp z, .randomMovement ; value $FE ; scripted movement dec a ld [hl], a ; increment movement byte 1 (movement data index) @@ -181,12 +168,18 @@ UpdateNPCSprite: ret .next cp WALK - jr nz, .determineDirection + jr nz, .asm_4ecb ; current NPC movement data is $fe. this seems buggy ld [hl], $1 ; set movement byte 1 to $1 ld de, wNPCMovementDirections call LoadDEPlusA ; a = [wNPCMovementDirections + $fe] (?) - jr .determineDirection +.asm_4ecb + push af + call Func_5288 + pop bc + ld a, b + jr nc, .determineDirection + ret .randomMovement call GetTileSpriteStandsOn call Random @@ -261,59 +254,25 @@ ChangeFacingDirection: ; set carry on failure, clears carry on success TryWalking: push hl - ld h, $c1 - ld a, [H_CURRENTSPRITEOFFSET] - add $9 - ld l, a - ld [hl], c ; c1x9 (update facing direction) - ld a, [H_CURRENTSPRITEOFFSET] - add $3 - ld l, a - ld [hl], d ; c1x3 (update Y movement delta) - inc l - inc l - ld [hl], e ; c1x5 (update X movement delta) + call Func_5337 pop hl push de - ld c, [hl] ; read tile to walk onto + ld c, [hl] call CanWalkOntoTile pop de - ret c ; cannot walk there (reinitialization of delay values already done) - ld h, $c2 - ld a, [H_CURRENTSPRITEOFFSET] - add $4 - ld l, a - ld a, [hl] ; c2x4: Y position - add d - ld [hli], a ; update Y position - ld a, [hl] ; c2x5: X position - add e - ld [hl], a ; update X position + ret c + call Func_5349 ld a, [H_CURRENTSPRITEOFFSET] ld l, a - ld [hl], $10 ; c2x0=16: walk animation counter + ld [hl], $10 ; c1x9 (update facing direction) dec h inc l - ld [hl], $3 ; c1x1: set movement status to walking + ld [hl], $3 jp UpdateSpriteImage ; update the walking animation parameters for a sprite that is currently walking UpdateSpriteInWalkingAnimation: - ld a, [H_CURRENTSPRITEOFFSET] - add $7 - ld l, a - ld a, [hl] ; c1x7 (counter until next walk animation frame) - inc a - ld [hl], a ; c1x7 += 1 - cp $4 - jr nz, .noNextAnimationFrame - xor a - ld [hl], a ; c1x7 = 0 - inc l - ld a, [hl] ; c1x8 (walk animation frame) - inc a - and $3 - ld [hl], a ; advance to next animation frame every 4 ticks (16 ticks total for one step) + call Func_5274 .noNextAnimationFrame ld a, [H_CURRENTSPRITEOFFSET] add $3 @@ -393,7 +352,7 @@ UpdateSpriteMovementDelay: ld l, a ld [hl], $1 ; c1x1 = 1 (mark as ready to move) notYetMoving: - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $8 ld l, a @@ -408,7 +367,6 @@ MakeNPCFacePlayer: ld a, [wd72d] bit 5, a jr nz, notYetMoving - res 7, [hl] ld a, [wPlayerDirection] bit PLAYER_DIR_BIT_UP, a @@ -445,11 +403,12 @@ InitializeSpriteStatus: ld a, $8 ld [hli], a ; $c2x2: set Y displacement to 8 ld [hl], a ; $c2x3: set X displacement to 8 + call InitializeSpriteScreenPosition ; could have done fallthrough here ret ; calculates the spprite's scrren position form its map position and the player position InitializeSpriteScreenPosition: - ld h, $c2 + ld h, wSpriteStateData2 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $4 ld l, a @@ -457,7 +416,7 @@ InitializeSpriteScreenPosition: ld b, a ld a, [hl] ; c2x4 (Y position + 4) sub b ; relative to player position - swap a ; * 16 + call Func_5033 sub $4 ; - 4 dec h ld [hli], a ; c1x4 (screen Y position) @@ -466,18 +425,30 @@ InitializeSpriteScreenPosition: ld b, a ld a, [hli] ; c2x6 (X position + 4) sub b ; relative to player position - swap a ; * 16 + call Func_5033 dec h ld [hl], a ; c1x6 (screen X position) ret +Func_5033: + jr nc, .asm_503c + cpl + inc a + swap a + cpl + inc a + ret +.asm_503c + swap a + ret + ; tests if sprite is off screen or otherwise unable to do anything CheckSpriteAvailability: predef IsObjectHidden ld a, [$ffe5] and a jp nz, .spriteInvisible - ld h, $c2 + ld h, wSpriteStateData2 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $6 ld l, a @@ -525,7 +496,7 @@ CheckSpriteAvailability: cp d jr c, .spriteVisible ; standing on tile with ID >=$60 (top right tile) .spriteInvisible - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $2 ld l, a @@ -579,7 +550,7 @@ UpdateSpriteImage: ; e: X movement delta (-1, 0 or 1) ; set carry on failure, clears carry on success CanWalkOntoTile: - ld h, $c2 + ld h, wSpriteStateData2 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $6 ld l, a @@ -590,24 +561,16 @@ CanWalkOntoTile: and a ret .notScripted - ld a, [wTileSetCollisionPtr] - ld l, a - ld a, [wTileSetCollisionPtr+1] - ld h, a -.tilePassableLoop - ld a, [hli] - cp $ff - jr z, .impassable - cp c - jr nz, .tilePassableLoop - ld h, $c2 + call _IsTilePassable + jr c, .impassable + ld h, wSpriteStateData2 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $6 ld l, a ld a, [hl] ; $c2x6 (movement byte 1) inc a jr z, .impassable ; if $ff, no movement allowed (however, changing direction is) - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $4 ld l, a @@ -623,17 +586,23 @@ CanWalkOntoTile: jr nc, .impassable ; don't walk off screen push de push bc + ld a, [wUpdateSpritesEnabled] + push af + ld a, $ff + ld [wUpdateSpritesEnabled], a call DetectCollisionBetweenSprites + pop af + ld [wUpdateSpritesEnabled], a pop bc pop de - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $c ld l, a ld a, [hl] ; c1xc (directions in which sprite collision would occur) and b ; check against chosen direction (1,2,4 or 8) jr nz, .impassable ; collision between sprites, don't go there - ld h, $c2 + ld h, wSpriteStateData2 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $2 ld l, a @@ -642,7 +611,7 @@ CanWalkOntoTile: jr nz, .upwards add d cp $5 - jr c, .impassable ; if c2x2+d < 5, don't go ;bug: this tests probably were supposed to prevent sprites + ;jr c, .impassable (bugfix) ; if c2x2+d < 5, don't go ;bug: this tests probably were supposed to prevent sprites jr .checkHorizontal ; from walking out too far, but this line makes sprites get stuck .upwards ; whenever they walked upwards 5 steps sub $1 ; on the other hand, the amount a sprite can walk out to the @@ -664,7 +633,7 @@ CanWalkOntoTile: and a ; clear carry (marking success) ret .impassable - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] inc a ld l, a @@ -690,13 +659,13 @@ CanWalkOntoTile: ; this is always the lower left tile of the 2x2 tile blocks all sprites are snapped to ; hl: output pointer GetTileSpriteStandsOn: - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $4 ld l, a ld a, [hli] ; c1x4: screen Y position add $4 ; align to 2*2 tile blocks (Y position is always off 4 pixels to the top) - and $f0 ; in case object is currently moving + and $f8 ; in case object is currently moving (XXX why changed to $f8?) srl a ; screen Y tile * 4 ld c, a ld b, $0 @@ -862,20 +831,235 @@ AnimScriptedNPCMovement: ret AdvanceScriptedNPCAnimFrameCounter: + call Func_5274 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] - add $7 + add $8 ld l, a ld a, [hl] ; intra-animation frame counter + and $3 + ld [hSpriteAnimFrameCounter], a + ret + +Func_5274: + ld a, [H_CURRENTSPRITEOFFSET] + add $7 + ld l, a + ld h, wSpriteStateData1 / $100 + ld a, [hl] ; c1x7 (counter until next walk animation frame) + inc a + and $3 + ld [hl], a ; c1x7 += 1 + ret nz ; c1x7 = 0 + inc l + ld a, [hl] ; c1x8 (walk animation frame) inc a + and $3 + ld [hl], a ; advance to next animation frame every 4 ticks (16 ticks total for one step) + ret + +Func_5288: +; nice lookup table +; a is supposedly [wNPCMovementDirections + $fe] + cp $5 + jr z, .asm_52af + cp $4 + jr z, .asm_52aa + cp $6 + jr z, .asm_52b4 + cp $7 + jr z, .asm_52b9 + cp $11 + jr z, .asm_52c3 + cp $12 + jr z, .asm_52be + cp $13 + jr z, .asm_52c8 + cp $14 + jr z, .asm_52cd + xor a + ret +; set 1? +.asm_52aa + call Func_531f + jr .asm_52e6 +.asm_52af + call Func_5325 + jr .asm_52e6 +.asm_52b4 + call Func_5331 + jr .asm_52e6 +.asm_52b9 + call Func_532b + jr .asm_52e6 +; set 2? +.asm_52be + call Func_531f + jr .asm_52fa +.asm_52c3 + call Func_5325 + jr .asm_52fa +.asm_52c8 + call Func_5331 + jr .asm_52fa +.asm_52cd + call Func_532b + jr .asm_52fa +; set 3? (unused) +.asm_52d2 + call Func_531f + jr .asm_530b +.asm_52d7 + call Func_5325 + jr .asm_530b +.asm_52dc + call Func_5331 + jr .asm_530b +.asm_52e1 + call Func_532b + jr .asm_530b + +.asm_52e6 + call Func_5337 + call Func_5349 + ld a, [H_CURRENTSPRITEOFFSET] + ld l, a + ld [hl], $8 + dec h + inc l + ld [hl], $4 + call UpdateSpriteImage + scf + ret + +.asm_52fa + call Func_5337 + ld a, [H_CURRENTSPRITEOFFSET] + ld l, a + ld [hl], $8 + dec h + inc l + ld [hl], $3 + call UpdateSpriteImage + scf + ret + +.asm_530b + call Func_5337 + call Func_5349 + ld a, [H_CURRENTSPRITEOFFSET] + ld l, a + ld [hl], $8 + dec h + inc l + ld [hl], $3 + call UpdateSpriteImage + scf + ret + +Func_531f: + lb de, 1, 0 + ld c, SPRITE_FACING_DOWN + ret + +Func_5325: + lb de, -1, 0 + ld c, SPRITE_FACING_UP + ret + +Func_532b: + lb de, 0, 1 + ld c, SPRITE_FACING_RIGHT + ret + +Func_5331: + lb de, 0, -1 + ld c, SPRITE_FACING_LEFT + ret + +Func_5337: + ld a, [H_CURRENTSPRITEOFFSET] + add $9 + ld l, a + ld h, wSpriteStateData1 / $100 + ld [hl], c ; c1x9 (update facing direction) + ld a, [H_CURRENTSPRITEOFFSET] + add $3 + ld l, a + ld [hl], d ; c1x3 (update Y movement delta) + inc l + inc l + ld [hl], e ; c1x5 (update X movement delta) + ret + +Func_5349: + ld h, wSpriteStateData2 / $100 + ld a, [H_CURRENTSPRITEOFFSET] + add $4 + ld l, a + ld a, [hl] ; c2x4: Y position + add d + ld [hli], a ; update Y position + ld a, [hl] ; c2x5: X position + add e + ld [hl], a ; update X position + ret + +Func_5357: + call Func_5274 + ld a, [H_CURRENTSPRITEOFFSET] + add $3 + ld l, a + ld h, wSpriteStateData1 / $100 + ld a, [hli] + add a + ld b, a + ld a, [hl] + add b + ld [hli], a + ld a, [hli] + add a + ld b, a + ld a, [hl] + add b ld [hl], a - cp 4 + ld a, [H_CURRENTSPRITEOFFSET] + ld l, a + ld h, wSpriteStateData2 / $100 + dec [hl] ret nz + ld a, $6 + add l + ld l, a + ld a, [hl] + cp $fe + jr nc, .asm_5386 + ld a, [H_CURRENTSPRITEOFFSET] + inc a + ld l, a + ld h, wSpriteStateData1 / $100 + ld [hl], $1 + ret +.asm_5386 + call Random + ld a, [H_CURRENTSPRITEOFFSET] + add $8 + ld l, a + ld h, wSpriteStateData2 / $100 + ld a, [hRandomAdd] + and $7f + ld [hl], a + dec h + ld a, [H_CURRENTSPRITEOFFSET] + inc a + ld l, a + ld [hl], $2 + inc l + inc l xor a - ld [hl], a ; reset intra-animation frame counter + ld b, [hl] + ld [hli], a inc l - ld a, [hl] ; animation frame counter - inc a - and $3 + ld c, [hl] ld [hl], a - ld [hSpriteAnimFrameCounter], a ret diff --git a/engine/overworld/npc_movement.asm b/engine/overworld/npc_movement.asm index 98d1b7a7..333779fa 100755 --- a/engine/overworld/npc_movement.asm +++ b/engine/overworld/npc_movement.asm @@ -37,8 +37,8 @@ _EndNPCMovementScript: res 1, [hl] xor a ld [wNPCMovementScriptSpriteOffset], a - ld [wNPCMovementScriptPointerTableNum], a ld [wNPCMovementScriptFunctionNum], a + ld [wNPCMovementScriptPointerTableNum], a ld [wWastedByteCD3A], a ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesEnd], a @@ -79,6 +79,10 @@ PalletMovementScript_OakMoveLeft: ld a, $3 ld [wNPCMovementScriptFunctionNum], a .done + ld a, BANK(Music_MuseumGuy) + ld c, a + ld a, MUSIC_MUSEUM_GUY + call PlayMusic ld hl, wFlags_D733 set 1, [hl] ld a, $fc @@ -127,8 +131,9 @@ PalletMovementScript_WalkToLab: ld [wNPCMovementScriptFunctionNum], a ret + RLEList_ProfOakWalkToLab: - db NPC_MOVEMENT_DOWN, $05 + db NPC_MOVEMENT_DOWN, $06 ; differs from red db NPC_MOVEMENT_LEFT, $01 db NPC_MOVEMENT_DOWN, $05 db NPC_MOVEMENT_RIGHT, $03 @@ -141,7 +146,7 @@ RLEList_PlayerWalkToLab: db D_RIGHT, $03 db D_DOWN, $05 db D_LEFT, $01 - db D_DOWN, $06 + db D_DOWN, $07 ; differs from red db $FF PalletMovementScript_Done: @@ -163,11 +168,9 @@ PewterMuseumGuyMovementScriptPointerTable: PewterMovementScript_WalkToMuseum: ld a, BANK(Music_MuseumGuy) - ld [wAudioROMBank], a - ld [wAudioSavedROMBank], a + ld c, a ld a, MUSIC_MUSEUM_GUY - ld [wNewSoundID], a - call PlaySound + call PlayMusic ld a, [wSpriteIndex] swap a ld [wNPCMovementScriptSpriteOffset], a @@ -179,7 +182,7 @@ PewterMovementScript_WalkToMuseum: ld [wSimulatedJoypadStatesIndex], a xor a ld [wWhichPewterGuy], a - predef PewterGuys + call PewterGuys ld hl, wNPCMovementDirections2 ld de, RLEList_PewterMuseumGuy call DecodeRLEList @@ -219,11 +222,9 @@ PewterGymGuyMovementScriptPointerTable: PewterMovementScript_WalkToGym: ld a, BANK(Music_MuseumGuy) - ld [wAudioROMBank], a - ld [wAudioSavedROMBank], a + ld c, a ld a, MUSIC_MUSEUM_GUY - ld [wNewSoundID], a - call PlaySound + call PlayMusic ld a, [wSpriteIndex] swap a ld [wNPCMovementScriptSpriteOffset], a @@ -236,7 +237,7 @@ PewterMovementScript_WalkToGym: ld [wSimulatedJoypadStatesIndex], a ld a, 1 ld [wWhichPewterGuy], a - predef PewterGuys + call PewterGuys ld hl, wNPCMovementDirections2 ld de, RLEList_PewterGymGuy call DecodeRLEList @@ -266,27 +267,4 @@ RLEList_PewterGymGuy: db NPC_MOVEMENT_RIGHT, $03 db $FF -FreezeEnemyTrainerSprite: - ld a, [wCurMap] - cp POKEMONTOWER_7 - ret z ; the Rockets on Pokemon Tower 7F leave after battling, so don't freeze them - ld hl, RivalIDs - ld a, [wEngagedTrainerClass] - ld b, a -.loop - ld a, [hli] - cp $ff - jr z, .notRival - cp b - ret z ; the rival leaves after battling, so don't freeze him - jr .loop -.notRival - ld a, [wSpriteIndex] - ld [H_SPRITEINDEX], a - jp SetSpriteMovementBytesToFF - -RivalIDs: - db OPP_SONY1 - db OPP_SONY2 - db OPP_SONY3 - db $ff +INCLUDE "engine/overworld/pewter_guys.asm" diff --git a/engine/overworld/npc_movement_2.asm b/engine/overworld/npc_movement_2.asm new file mode 100755 index 00000000..06ee9319 --- /dev/null +++ b/engine/overworld/npc_movement_2.asm @@ -0,0 +1,24 @@ +FreezeEnemyTrainerSprite: + ld a, [wCurMap] + cp POKEMONTOWER_7 + ret z ; the Rockets on Pokemon Tower 7F leave after battling, so don't freeze them + ld hl, RivalIDs + ld a, [wEngagedTrainerClass] + ld b, a +.loop + ld a, [hli] + cp $ff + jr z, .notRival + cp b + ret z ; the rival leaves after battling, so don't freeze him + jr .loop +.notRival + ld a, [wSpriteIndex] + ld [H_SPRITEINDEX], a + jp SetSpriteMovementBytesToFF + +RivalIDs: + db OPP_SONY1 + db OPP_SONY2 + db OPP_SONY3 + db $ff diff --git a/engine/overworld/npc_pathfinding.asm b/engine/overworld/npc_pathfinding.asm new file mode 100644 index 00000000..f3d23b7c --- /dev/null +++ b/engine/overworld/npc_pathfinding.asm @@ -0,0 +1,201 @@ +FindPathToPlayer: + xor a + ld hl, hFindPathNumSteps + ld [hli], a ; hFindPathNumSteps + ld [hli], a ; hFindPathFlags + ld [hli], a ; hFindPathYProgress + ld [hl], a ; hFindPathXProgress + ld hl, wNPCMovementDirections2 + ld de, $0 +.loop + ld a, [hFindPathYProgress] + ld b, a + ld a, [hNPCPlayerYDistance] ; Y distance in steps + call CalcDifference + ld d, a + and a + jr nz, .asm_f76a + ld a, [hFindPathFlags] + set 0, a ; current end of path matches the player's Y coordinate + ld [hFindPathFlags], a +.asm_f76a + ld a, [hFindPathXProgress] + ld b, a + ld a, [hNPCPlayerXDistance] ; X distance in steps + call CalcDifference + ld e, a + and a + jr nz, .asm_f77c + ld a, [hFindPathFlags] + set 1, a ; current end of path matches the player's X coordinate + ld [hFindPathFlags], a +.asm_f77c + ld a, [hFindPathFlags] + cp $3 ; has the end of the path reached the player's position? + jr z, .done +; Compare whether the X distance between the player and the current of the path +; is greater or if the Y distance is. Then, try to reduce whichever is greater. + ld a, e + cp d + jr c, .yDistanceGreater +; x distance is greater + ld a, [hNPCPlayerRelativePosFlags] + bit 1, a + jr nz, .playerIsLeftOfNPC + ld d, NPC_MOVEMENT_RIGHT + jr .next1 +.playerIsLeftOfNPC + ld d, NPC_MOVEMENT_LEFT +.next1 + ld a, [hFindPathXProgress] + add 1 + ld [hFindPathXProgress], a + jr .storeDirection +.yDistanceGreater + ld a, [hNPCPlayerRelativePosFlags] + bit 0, a + jr nz, .playerIsAboveNPC + ld d, NPC_MOVEMENT_DOWN + jr .next2 +.playerIsAboveNPC + ld d, NPC_MOVEMENT_UP +.next2 + ld a, [hFindPathYProgress] + add 1 + ld [hFindPathYProgress], a +.storeDirection + ld a, d + ld [hli], a + ld a, [hFindPathNumSteps] + inc a + ld [hFindPathNumSteps], a + jp .loop +.done + ld [hl], $ff + ret + +CalcPositionOfPlayerRelativeToNPC: + xor a + ld [hNPCPlayerRelativePosFlags], a + ld a, [wSpriteStateData1 + 4] ; player's sprite screen Y position in pixels + ld d, a + ld a, [wSpriteStateData1 + 6] ; player's sprite screen X position in pixels + ld e, a + ld hl, wSpriteStateData1 + ld a, [hNPCSpriteOffset] + add l + add $4 + ld l, a + jr nc, .noCarry + inc h +.noCarry + ld a, d + ld b, a + ld a, [hli] ; NPC sprite screen Y position in pixels + call CalcDifference + jr nc, .NPCSouthOfOrAlignedWithPlayer +.NPCNorthOfPlayer + push hl + ld hl, hNPCPlayerRelativePosFlags + bit 0, [hl] + set 0, [hl] + pop hl + jr .divideYDistance +.NPCSouthOfOrAlignedWithPlayer + push hl + ld hl, hNPCPlayerRelativePosFlags + bit 0, [hl] + res 0, [hl] + pop hl +.divideYDistance + push hl + ld hl, hDividend2 + ld [hli], a + ld a, 16 + ld [hli], a + call DivideBytes ; divide Y absolute distance by 16 + ld a, [hl] ; quotient + ld [hNPCPlayerYDistance], a + pop hl + inc hl + ld b, e + ld a, [hl] ; NPC sprite screen X position in pixels + call CalcDifference + jr nc, .NPCEastOfOrAlignedWithPlayer +.NPCWestOfPlayer + push hl + ld hl, hNPCPlayerRelativePosFlags + bit 1, [hl] + set 1, [hl] + pop hl + jr .divideXDistance +.NPCEastOfOrAlignedWithPlayer + push hl + ld hl, hNPCPlayerRelativePosFlags + bit 1, [hl] + res 1, [hl] + pop hl +.divideXDistance + ld [hDividend2], a + ld a, 16 + ld [hDivisor2], a + call DivideBytes ; divide X absolute distance by 16 + ld a, [hQuotient2] + ld [hNPCPlayerXDistance], a + ld a, [hNPCPlayerRelativePosPerspective] + and a + ret z + ld a, [hNPCPlayerRelativePosFlags] + cpl + and $3 + ld [hNPCPlayerRelativePosFlags], a + ret + +ConvertNPCMovementDirectionsToJoypadMasks: + ld a, [hNPCMovementDirections2Index] + ld [wNPCMovementDirections2Index], a + dec a + ld de, wSimulatedJoypadStatesEnd + ld hl, wNPCMovementDirections2 + add l + ld l, a + jr nc, .loop + inc h +.loop + ld a, [hld] + call ConvertNPCMovementDirectionToJoypadMask + ld [de], a + inc de + ld a, [hNPCMovementDirections2Index] + dec a + ld [hNPCMovementDirections2Index], a + jr nz, .loop + ret + +ConvertNPCMovementDirectionToJoypadMask: + push hl + ld b, a + ld hl, NPCMovementDirectionsToJoypadMasksTable +.loop + ld a, [hli] + cp $ff + jr z, .done + cp b + jr z, .loadJoypadMask + inc hl + jr .loop +.loadJoypadMask + ld a, [hl] +.done + pop hl + ret + +NPCMovementDirectionsToJoypadMasksTable: + db NPC_MOVEMENT_UP, D_UP + db NPC_MOVEMENT_DOWN, D_DOWN + db NPC_MOVEMENT_LEFT, D_LEFT + db NPC_MOVEMENT_RIGHT, D_RIGHT + db $ff + +; unreferenced + ret diff --git a/engine/overworld/oam.asm b/engine/overworld/oam.asm index 94082beb..5b9831b0 100644 --- a/engine/overworld/oam.asm +++ b/engine/overworld/oam.asm @@ -1,12 +1,14 @@ PrepareOAMData: ; Determine OAM data for currently visible ; sprites and write it to wOAMBuffer. +; Yellow code has been changed to use registers more efficiently +; as well as tweaking the code to show gbc palettes ld a, [wUpdateSpritesEnabled] dec a jr z, .updateEnabled - cp 0 - 1 + cp $ff ret nz ld [wUpdateSpritesEnabled], a jp HideSprites @@ -18,9 +20,9 @@ PrepareOAMData: .spriteLoop ld [hSpriteOffset2], a - ld d, wSpriteStateData1 / $100 - ld a, [hSpriteOffset2] ld e, a + ld d, wSpriteStateData1 / $100 + ld a, [de] ; c1x0 and a jp z, .nextSprite @@ -40,16 +42,22 @@ PrepareOAMData: jr c, .usefacing ; unchanging - and $f - add $10 ; skip to the second half of the table which doesn't account for facing direction + ld a, $0 jr .next .usefacing and $f .next +; read the entry from the table + ld c, a + ld b, 0 + ld hl, SpriteFacingAndAnimationTable + add hl, bc + add hl, bc + ld a, [hli] + ld h, [hl] ld l, a - ; get sprite priority push de inc d @@ -61,65 +69,46 @@ PrepareOAMData: ld [hSpritePriority], a ; temp store sprite priority pop de -; read the entry from the table - ld h, 0 - ld bc, SpriteFacingAndAnimationTable - add hl, hl - add hl, hl - add hl, bc - ld a, [hli] - ld c, a - ld a, [hli] - ld b, a - ld a, [hli] - ld h, [hl] - ld l, a call GetSpriteScreenXY ld a, [hOAMBufferOffset] + add [hl] + cp $a0 + jr z, .hidden + jr nc, .asm_4a41 +.hidden + call Func_4a7b + ld [wd5cd], a + ld a, [hOAMBufferOffset] + ld e, a ld d, wOAMBuffer / $100 .tileLoop + ld a, [hli] + ld c, a +.loop ld a, [hSpriteScreenY] ; temp for sprite Y position add $10 ; Y=16 is top of screen (Y=0 is invisible) add [hl] ; add Y offset from table ld [de], a ; write new sprite OAM Y position inc hl + inc e ld a, [hSpriteScreenX] ; temp for sprite X position add $8 ; X=8 is left of screen (X=0 is invisible) add [hl] ; add X offset from table + ld [de], a + inc hl inc e - ld [de], a ; write new sprite OAM X position - inc e - ld a, [bc] ; read pattern number offset (accommodates orientation (offset 0,4 or 8) and animation (offset 0 or $80)) - inc bc - push bc + ld a, [wd5cd] + add [hl] + cp $80 + jr c, .asm_4a1c ld b, a - - ld a, [wd5cd] ; temp copy of c1x2 - swap a ; high nybble determines sprite used (0 is always player sprite, next are some npcs) - and $f - - ; Sprites $a and $b have one face (and therefore 4 tiles instead of 12). - ; As a result, sprite $b's tile offset is less than normal. - cp $b - jr nz, .notFourTileSprite - ld a, $a * 12 + 4 - jr .next2 - -.notFourTileSprite - ; a *= 12 - sla a - sla a - ld c, a - sla a - add c - -.next2 - add b ; add the tile offset from the table (based on frame and facing direction) - pop bc + ld a, [$fffc] + add b +.asm_4a1c ld [de], a ; tile id inc hl inc e @@ -129,15 +118,19 @@ PrepareOAMData: ld a, [hSpritePriority] or [hl] .skipPriority - inc hl + and $f0 + bit 4, a ; OBP0 or OBP1 + jr z, .spriteusesOBP0 + or %100 ; palettes 4-7 are OBP1 +.spriteusesOBP0 ld [de], a + inc hl inc e - bit 0, a ; OAMFLAG_ENDOFDATA - jr z, .tileLoop + dec c + jr nz, .loop ld a, e ld [hOAMBufferOffset], a - .nextSprite ld a, [hSpriteOffset2] add $10 @@ -145,26 +138,31 @@ PrepareOAMData: jp nz, .spriteLoop ; Clear unused OAM. - ld a, [hOAMBufferOffset] - ld l, a - ld h, wOAMBuffer / $100 - ld de, $4 - ld b, $a0 +.asm_4a41 ld a, [wd736] bit 6, a ; jumping down ledge or fishing animation? - ld a, $a0 + ld c, $a0 jr z, .clear ; Don't clear the last 4 entries because they are used for the shadow in the ; jumping down ledge animation and the rod in the fishing animation. - ld a, $90 + ld c, $90 .clear - cp l - ret z + ld a, [hOAMBufferOffset] + cp c + ret nc + ld l, a + ld h, wOAMBuffer / $100 + ld a, c + ld de, $4 ; entry size + ld b, $a0 +.clearLoop ld [hl], b add hl, de - jr .clear + cp l + jr nz, .clearLoop + ret GetSpriteScreenXY: inc e @@ -187,3 +185,48 @@ GetSpriteScreenXY: and $f0 ld [de], a ; c1xb (x) ret + +Func_4a7b: + push bc + ld a, [wd5cd] ; temp copy of c1x2 + swap a ; high nybble determines sprite used (0 is always player sprite, next are some npcs) + and $f + + ; Sprites $a and $b have one face (and therefore 4 tiles instead of 12). + ; As a result, sprite $b's tile offset is less than normal. + cp $b + jr nz, .notFourTileSprite + ld a, $a * 12 + 4 ; $7c + jr .done + +.notFourTileSprite + ; a *= 12 + add a + add a + ld c, a + add a + add c +.done + pop bc + ret + +INCLUDE "engine/oam_dma.asm" + +_IsTilePassable:: + ld hl,wTilesetCollisionPtr ; pointer to list of passable tiles + ld a,[hli] + ld h,[hl] + ld l,a ; hl now points to passable tiles +.loop + ld a,[hli] + cp a,$ff + jr z,.tileNotPassable + cp c + jr nz,.loop + xor a + ret +.tileNotPassable + scf + ret + +INCLUDE "data/collision.asm" ; probably diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index f7b63aaa..eea1b375 100755 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -9,15 +9,15 @@ EnterMapAnim: bit 7, [hl] ; used fly out of battle? res 7, [hl] jr nz, .flyAnimation - ld a, SFX_TELEPORT_ENTER_1 + ld a, $a0 ; (SFX_02_4c - SFX_Headers_02) / 3 call PlaySound ld hl, wd732 bit 4, [hl] ; used dungeon warp? - res 4, [hl] pop hl + ;res 4, [hl] jr nz, .dungeonWarpAnimation call PlayerSpinWhileMovingDown - ld a, SFX_TELEPORT_ENTER_2 + ld a, $a3 ; (SFX_02_4f - SFX_Headers_02) / 3 call PlaySound call IsPlayerStandingOnWarpPadOrHole ld a, b @@ -34,23 +34,24 @@ EnterMapAnim: ld [hl], $ff ; wPlayerSpinInPlaceAnimSoundID ld hl, wFacingDirectionList call PlayerSpinInPlace + ld a, $1 + ld [wPikachuSpawnState], a .restoreDefaultMusic call PlayDefaultMusic .done + call Func_151d jp RestoreFacingDirectionAndYScreenPos .dungeonWarpAnimation ld c, 50 call DelayFrames call PlayerSpinWhileMovingDown + ld a, $0 + ld [wPikachuSpawnState], a jr .done .flyAnimation pop hl - ld de, BirdSprite - ld hl, vNPCSprites - lb bc, BANK(BirdSprite), $0c - call CopyVideoData call LoadBirdSpriteGraphics - ld a, SFX_FLY + ld a, $a4 ; SFX_BIRD_FLY call PlaySound ld hl, wFlyAnimUsingCoordList xor a ; is using coord list @@ -61,6 +62,8 @@ EnterMapAnim: ld de, FlyAnimationEnterScreenCoords call DoFlyAnimation call LoadPlayerSpriteGraphics + ld a, $1 + ld [wPikachuSpawnState], a jr .restoreDefaultMusic FlyAnimationEnterScreenCoords: @@ -90,7 +93,9 @@ PlayerSpinWhileMovingDown: ld [hl], a ; wPlayerSpinWhileMovingUpOrDownAnimFrameDelay jp PlayerSpinWhileMovingUpOrDown + _LeaveMapAnim: + call Func_1510 call InitFacingDirectionList call IsPlayerStandingOnWarpPadOrHole ld a, b @@ -99,7 +104,7 @@ _LeaveMapAnim: dec a jp nz, LeaveMapThroughHoleAnim .spinWhileMovingUp - ld a, SFX_TELEPORT_EXIT_1 + ld a, $9f ; (SFX_02_4b - SFX_Headers_02) / 3 call PlaySound ld hl, wPlayerSpinWhileMovingUpOrDownAnimDeltaY ld a, -$10 @@ -133,7 +138,7 @@ _LeaveMapAnim: ld [hli], a ; wPlayerSpinInPlaceAnimFrameDelayDelta xor a ld [hli], a ; wPlayerSpinInPlaceAnimFrameDelayEndValue - ld [hl], SFX_TELEPORT_EXIT_2 ; wPlayerSpinInPlaceAnimSoundID + ld [hl], $a1 ; SFX_TELEPORT_EXIT_2 ld hl, wFacingDirectionList call PlayerSpinInPlace jr .spinWhileMovingUp @@ -146,7 +151,7 @@ _LeaveMapAnim: ld [hli], a ; wFlyAnimCounter ld [hl], $c ; wFlyAnimBirdSpriteImageIndex call DoFlyAnimation - ld a, SFX_FLY + ld a, $a4 ; SFX_FLY call PlaySound ld hl, wFlyAnimUsingCoordList xor a ; is using coord list @@ -248,13 +253,15 @@ DoFlyAnimation: ret LoadBirdSpriteGraphics: - ld de, BirdSprite + ld de, BirdSprite ; $4d80 + ld b, BANK(BirdSprite) + ld c, $c ld hl, vNPCSprites - lb bc, BANK(BirdSprite), $0c call CopyVideoData - ld de, BirdSprite + $c0 ; moving animation sprite + ld de, BirdSprite + $c0 ; $4e40 ; moving amination sprite + ld b, BANK(BirdSprite) + ld c, $0c ld hl, vNPCSprites2 - lb bc, BANK(BirdSprite), $0c jp CopyVideoData InitFacingDirectionList: @@ -385,10 +392,11 @@ FishingAnim: ld c, 10 call DelayFrames ld hl, wd736 - set 6, [hl] ; reserve the last 4 OAM entries - ld de, RedSprite + set 6, [hl] ld hl, vNPCSprites - lb bc, BANK(RedSprite), $0c + ld de, RedSprite ; $4180 + ld b, BANK(RedSprite) + ld c, $c call CopyVideoData ld a, $4 ld hl, RedFishingTiles @@ -414,6 +422,7 @@ FishingAnim: ; there was a bite ; shake the player's sprite vertically + ld b, 10 .loop ld hl, wSpriteStateData1 + 4 ; player's sprite Y screen position @@ -426,19 +435,17 @@ FishingAnim: ; If the player is facing up, hide the fishing rod so it doesn't overlap with ; the exclamation bubble that will be shown next. - ld a, [wSpriteStateData1 + 2] ; player's sprite facing direction + ld a, [wSpriteStateData1 + 2] cp SPRITE_FACING_UP jr nz, .skipHidingFishingRod ld a, $a0 ld [wOAMBuffer + $9c], a - .skipHidingFishingRod ld hl, wEmotionBubbleSpriteIndex xor a ld [hli], a ; player's sprite ld [hl], a ; EXCLAMATION_BUBBLE predef EmotionBubble - ; If the player is facing up, unhide the fishing rod. ld a, [wSpriteStateData1 + 2] ; player's sprite facing direction cp SPRITE_FACING_UP @@ -456,7 +463,7 @@ FishingAnim: call LoadFontTilePatterns ret -.ShakePlayerSprite +.ShakePlayerSprite ; 708a3 (1c:48a3) ld a, [hl] xor $1 ld [hl], a diff --git a/engine/overworld/pokecenter.asm b/engine/overworld/pokecenter.asm index 3a302d70..1801d9e9 100755 --- a/engine/overworld/pokecenter.asm +++ b/engine/overworld/pokecenter.asm @@ -1,4 +1,13 @@ DisplayPokemonCenterDialogue_: + ld a, [wCurMap] + cp PEWTER_POKECENTER + jr nz, .regularCenter + call CheckPikachuFollowingPlayer + jr z, .regularCenter + ld hl, LooksContentText ; if pikachu is sleeping, don't heal + call PrintText + ret +.regularCenter call SaveScreenTilesToBuffer1 ; save screen ld hl, PokemonCenterWelcomeText call PrintText @@ -11,18 +20,36 @@ DisplayPokemonCenterDialogue_: call PrintText .skipShallWeHealYourPokemon call YesNoChoicePokeCenter ; yes/no menu + call UpdateSprites ld a, [wCurrentMenuItem] and a - jr nz, .declinedHealing ; if the player chose No + jp nz, .declinedHealing ; if the player chose No call SetLastBlackoutMap - call LoadScreenTilesFromBuffer1 ; restore screen + callab IsStarterPikachuInOurParty + jr nc, .notHealingPlayerPikachu + call CheckPikachuFollowingPlayer + jr nz, .notHealingPlayerPikachu + call LoadCurrentMapView + call Delay3 + call UpdateSprites + callab PikachuWalksToNurseJoy ; todo +.notHealingPlayerPikachu ld hl, NeedYourPokemonText call PrintText - ld a, $18 - ld [wSpriteStateData1 + $12], a ; make the nurse turn to face the machine - call Delay3 - predef HealParty + ld c, 64 + call DelayFrames + call CheckPikachuFollowingPlayer + jr nz, .playerPikachuNotOnScreen + call DisablePikachuOverworldSpriteDrawing + callab IsStarterPikachuInOurParty + call c, Func_6eaa +.playerPikachuNotOnScreen + lb bc, 1, 8 + call Func_6ebb + ld c, 30 + call DelayFrames callba AnimateHealingMachine ; do the healing machine animation + predef HealParty xor a ld [wAudioFadeOutControl], a ld a, [wAudioSavedROMBank] @@ -31,19 +58,69 @@ DisplayPokemonCenterDialogue_: ld [wLastMusicSoundID], a ld [wNewSoundID], a call PlaySound + call CheckPikachuFollowingPlayer + jr nz, .doNotReturnPikachu + callab IsStarterPikachuInOurParty + call c, Func_6eaa + ld a, $5 + ld [wPikachuSpawnState], a + call EnablePikachuOverworldSpriteDrawing +.doNotReturnPikachu + lb bc, 1, 0 + call Func_6ebb ld hl, PokemonFightingFitText call PrintText - ld a, $14 - ld [wSpriteStateData1 + $12], a ; make the nurse bow - ld c, a + callab IsStarterPikachuInOurParty + jr nc, .notInParty + lb bc, 15, 0 + call Func_6ebb +.notInParty + call LoadCurrentMapView + call Delay3 + call UpdateSprites + callab ReloadWalkingTilePatterns + ld a, $1 + ld [H_SPRITEINDEX], a + ld a, $1 + ld [hSpriteImageIndex], a + call SpriteFunc_34a1 + ld c, 40 call DelayFrames + call UpdateSprites + call LoadFontTilePatterns jr .done .declinedHealing call LoadScreenTilesFromBuffer1 ; restore screen .done ld hl, PokemonCenterFarewellText call PrintText - jp UpdateSprites + call UpdateSprites + ret + +Func_6eaa: + ld a, $1 + ld [H_SPRITEINDEX], a + ld a, $4 + ld [hSpriteImageIndex], a + call SpriteFunc_34a1 + ld c, 64 + call DelayFrames + ret + +Func_6ebb: + ld a, b + ld [H_SPRITEINDEX], a + ld a, c + ld [hSpriteImageIndex], a + push bc + call SetSpriteFacingDirectionAndDelay + pop bc + ld a, b + ld [H_SPRITEINDEX], a + ld a, c + ld [hSpriteImageIndex], a + call SpriteFunc_34a1 + ret PokemonCenterWelcomeText: TX_FAR _PokemonCenterWelcomeText @@ -66,3 +143,7 @@ PokemonCenterFarewellText: db $a TX_FAR _PokemonCenterFarewellText db "@" + +LooksContentText: + TX_FAR _LooksContentText + db "@" diff --git a/engine/overworld/pokemart.asm b/engine/overworld/pokemart.asm index e50c508e..823939b1 100755 --- a/engine/overworld/pokemart.asm +++ b/engine/overworld/pokemart.asm @@ -85,7 +85,7 @@ DisplayPokemartDialogue_: lb bc, 14, 1 ; location that PrintText always prints to, this is useless call PrintText coord hl, 14, 7 - lb bc, 08, 15 + lb bc, 8, 15 ld a,TWO_OPTION_MENU ld [wTextBoxID],a call DisplayTextBoxID ; yes/no menu diff --git a/engine/overworld/print_safari_steps.asm b/engine/overworld/print_safari_steps.asm new file mode 100644 index 00000000..01dd34e0 --- /dev/null +++ b/engine/overworld/print_safari_steps.asm @@ -0,0 +1,36 @@ +PrintSafariZoneSteps: + ld a, [wCurMap] + cp SAFARI_ZONE_EAST + ret c + cp UNKNOWN_DUNGEON_2 + ret nc + coord hl, 0, 0 + lb bc, 3, 7 + call TextBoxBorder + coord hl, 1, 1 + ld de, wSafariSteps + lb bc, 2, 3 + call PrintNumber + coord hl, 4, 1 + ld de, SafariSteps + call PlaceString + coord hl, 1, 3 + ld de, SafariBallText + call PlaceString + ld a, [wNumSafariBalls] + cp 10 + jr nc, .numSafariBallsTwoDigits + coord hl, 5, 3 + ld a, " " + ld [hl], a +.numSafariBallsTwoDigits + coord hl, 6, 3 + ld de, wNumSafariBalls + lb bc, 1, 2 + jp PrintNumber + +SafariSteps: + db "/500@" + +SafariBallText: + db "BALL×× @" diff --git a/engine/overworld/replace_tile_block.asm b/engine/overworld/replace_tile_block.asm new file mode 100644 index 00000000..8577b9e7 --- /dev/null +++ b/engine/overworld/replace_tile_block.asm @@ -0,0 +1,126 @@ +; replaces a tile block with the one specified in [wNewTileBlockID] +; and redraws the map view if necessary +; b = Y +; c = X +ReplaceTileBlock: + call GetPredefRegisters + ld hl, wOverworldMap + ld a, [wCurMapWidth] + add $6 + ld e, a + ld d, $0 + add hl, de + add hl, de + add hl, de + ld e, $3 + add hl, de + ld e, a + ld a, b + and a + jr z, .addX +; add width * Y +.addWidthYTimesLoop + add hl, de + dec b + jr nz, .addWidthYTimesLoop +.addX + add hl, bc ; add X + ld a, [wNewTileBlockID] + ld [hl], a + ld a, [wCurrentTileBlockMapViewPointer] + ld c, a + ld a, [wCurrentTileBlockMapViewPointer + 1] + ld b, a + call CompareHLWithBC + ret c ; return if the replaced tile block is below the map view in memory + push hl + ld l, e + ld h, $0 + ld e, $6 + ld d, h + add hl, hl + add hl, hl + add hl, de + add hl, bc + pop bc + call CompareHLWithBC + ret c ; return if the replaced tile block is above the map view in memory + +RedrawMapView: + ld a, [wIsInBattle] + inc a + ret z + ld a, [H_AUTOBGTRANSFERENABLED] + push af + ld a, [hTilesetType] + push af + xor a + ld [H_AUTOBGTRANSFERENABLED], a + ld [hTilesetType], a ; no flower/water BG tile animations + call LoadCurrentMapView + call RunDefaultPaletteCommand + ld hl, wMapViewVRAMPointer + ld a, [hli] + ld h, [hl] + ld l, a + ld de, -2 * 32 + add hl, de + ld a, h + and $3 + or $98 + ld a, l + ld [wBuffer], a + ld a, h + ld [wBuffer + 1], a ; this copy of the address is not used + ld a, 2 + ld [$ffbe], a + ld c, 9 ; number of rows of 2x2 tiles (this covers the whole screen) +.redrawRowLoop + push bc + push hl + push hl + ld hl, wTileMap - 2 * SCREEN_WIDTH + ld de, SCREEN_WIDTH + ld a, [$ffbe] +.calcWRAMAddrLoop + add hl, de + dec a + jr nz, .calcWRAMAddrLoop + call CopyToRedrawRowOrColumnSrcTiles + pop hl + ld de, $20 + ld a, [$ffbe] + ld c, a +.calcVRAMAddrLoop + add hl, de + ld a, h + and $3 + or $98 + dec c + jr nz, .calcVRAMAddrLoop + ld [hRedrawRowOrColumnDest + 1], a + ld a, l + ld [hRedrawRowOrColumnDest], a + ld a, REDRAW_ROW + ld [hRedrawRowOrColumnMode], a + call DelayFrame + ld hl, $ffbe + inc [hl] + inc [hl] + pop hl + pop bc + dec c + jr nz, .redrawRowLoop + pop af + ld [hTilesetType], a + pop af + ld [H_AUTOBGTRANSFERENABLED], a + ret + +CompareHLWithBC: + ld a, h + sub b + ret nz + ld a, l + sub c + ret diff --git a/engine/overworld/set_blackout_map.asm b/engine/overworld/set_blackout_map.asm new file mode 100644 index 00000000..9bfe82bd --- /dev/null +++ b/engine/overworld/set_blackout_map.asm @@ -0,0 +1,29 @@ +SetLastBlackoutMap: +; Set the map to return to when +; blacking out or using Teleport or Dig. +; Safari rest houses don't count. + + push hl + ld hl, SafariZoneRestHouses + ld a, [wCurMap] + ld b, a +.loop + ld a, [hli] + cp -1 + jr z, .notresthouse + cp b + jr nz, .loop + jr .done + +.notresthouse + ld a, [wLastMap] + ld [wLastBlackoutMap], a +.done + pop hl + ret + +SafariZoneRestHouses: + db SAFARI_ZONE_REST_HOUSE_2 + db SAFARI_ZONE_REST_HOUSE_3 + db SAFARI_ZONE_REST_HOUSE_4 + db -1 diff --git a/engine/overworld/special_warps.asm b/engine/overworld/special_warps.asm new file mode 100644 index 00000000..4814e668 --- /dev/null +++ b/engine/overworld/special_warps.asm @@ -0,0 +1,147 @@ +SpecialWarpIn: + call LoadSpecialWarpData + predef LoadTilesetHeader + ld hl,wd732 + bit 2,[hl] ; dungeon warp or fly warp? + res 2,[hl] + jr z,.next +; if dungeon warp or fly warp + ld a,[wDestinationMap] + jr .next2 +.next + bit 1,[hl] + jr z,.next3 + call EmptyFunc +.next3 + ld a,0 +.next2 + ld b,a + ld a,[wd72d] + and a + jr nz,.next4 + ld a,b +.next4 + ld hl,wd732 + bit 4,[hl] ; dungeon warp? + ret nz +; if not dungeon warp + ld [wLastMap],a + ret + +; gets the map ID, tile block map view pointer, tileset, and coordinates +LoadSpecialWarpData: + ld a, [wd72d] + cp TRADE_CENTER + jr nz, .notTradeCenter + ld hl, TradeCenterSpec1 + ld a, [hSerialConnectionStatus] + cp USING_INTERNAL_CLOCK ; which gameboy is clocking determines who is on the left and who is on the right + jr z, .copyWarpData + ld hl, TradeCenterSpec2 + jr .copyWarpData +.notTradeCenter + cp COLOSSEUM + jr nz, .notColosseum + ld hl, ColosseumSpec1 + ld a, [hSerialConnectionStatus] + cp USING_INTERNAL_CLOCK + jr z, .copyWarpData + ld hl, ColosseumSpec2 + jr .copyWarpData +.notColosseum + ld a, [wd732] + bit 1, a + jr nz, .notFirstMap + bit 2, a + jr nz, .notFirstMap + ld hl, FirstMapSpec +.copyWarpData + ld de, wCurMap + ld c, $7 +.copyWarpDataLoop + ld a, [hli] + ld [de], a + inc de + dec c + jr nz, .copyWarpDataLoop + ld a, [hli] + ld [wCurMapTileset], a + xor a + jr .done +.notFirstMap + ld a, [wLastMap] ; this value is overwritten before it's ever read + ld hl, wd732 + bit 4, [hl] ; used dungeon warp (jumped down hole/waterfall)? + jr nz, .usedDunegonWarp + bit 6, [hl] ; return to last pokemon center (or player's house)? + res 6, [hl] + jr z, .otherDestination +; return to last pokemon center or player's house + ld a, [wLastBlackoutMap] + jr .usedFlyWarp +.usedDunegonWarp + ld hl, wd72d + res 4, [hl] + ld a, [wDungeonWarpDestinationMap] + ld b, a + ld [wCurMap], a + ld a, [wWhichDungeonWarp] + ld c, a + ld hl, DungeonWarpList + ld de, 0 + ld a, 6 + ld [wDungeonWarpDataEntrySize], a +.dungeonWarpListLoop + ld a, [hli] + cp b + jr z, .matchedDungeonWarpDestinationMap + inc hl + jr .nextDungeonWarp +.matchedDungeonWarpDestinationMap + ld a, [hli] + cp c + jr z, .matchedDungeonWarpID +.nextDungeonWarp + ld a, [wDungeonWarpDataEntrySize] + add e + ld e, a + jr .dungeonWarpListLoop +.matchedDungeonWarpID + ld hl, DungeonWarpData + add hl, de + jr .copyWarpData2 +.otherDestination + ld a, [wDestinationMap] +.usedFlyWarp + ld b, a + ld [wCurMap], a + ld hl, FlyWarpDataPtr +.flyWarpDataPtrLoop + ld a, [hli] + inc hl + cp b + jr z, .foundFlyWarpMatch + inc hl + inc hl + jr .flyWarpDataPtrLoop +.foundFlyWarpMatch + ld a, [hli] + ld h, [hl] + ld l, a +.copyWarpData2 + ld de, wCurrentTileBlockMapViewPointer + ld c, $6 +.copyWarpDataLoop2 + ld a, [hli] + ld [de], a + inc de + dec c + jr nz, .copyWarpDataLoop2 + xor a ; OVERWORLD + ld [wCurMapTileset], a +.done + ld [wYOffsetSinceLastSpecialWarp], a + ld [wXOffsetSinceLastSpecialWarp], a + ld a, $ff ; the player's coordinates have already been updated using a special warp, so don't use any of the normal warps + ld [wDestinationWarpID], a + ret diff --git a/engine/overworld/ssanne.asm b/engine/overworld/ssanne.asm index 712c53ed..347dc459 100755 --- a/engine/overworld/ssanne.asm +++ b/engine/overworld/ssanne.asm @@ -7,6 +7,7 @@ AnimateBoulderDust: ld [wUpdateSpritesEnabled], a ld a, %11100100 ld [rOBP1], a + call UpdateGBCPal_OBP1 call LoadSmokeTileFourTimes callba WriteCutOrBoulderDustAnimationOAMBlock ld c, 8 ; number of steps in animation @@ -21,6 +22,7 @@ AnimateBoulderDust: ld a, [rOBP1] xor %01100100 ld [rOBP1], a + call UpdateGBCPal_OBP1 call Delay3 pop bc dec c @@ -30,7 +32,7 @@ AnimateBoulderDust: jp LoadPlayerSpriteGraphics GetMoveBoulderDustFunctionPointer: - ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction + ld a, [wPlayerFacingDirection] ; player's sprite facing direction ld hl, MoveBoulderDustFunctionPointerTable ld c, a ld b, $0 diff --git a/engine/overworld/step_functions.asm b/engine/overworld/step_functions.asm new file mode 100644 index 00000000..84b09291 --- /dev/null +++ b/engine/overworld/step_functions.asm @@ -0,0 +1,151 @@ +ApplyOutOfBattlePoisonDamage: + ld a, [wd730] + add a + jp c, .noBlackOut ; no black out if joypad states are being simulated + ld a, [wd492] + bit 7, a + jp nz, .noBlackOut + ld a, [wd72e] + bit 6, a + jp nz, .noBlackOut + ld a, [wPartyCount] + and a + jp z, .noBlackOut + call IncrementDayCareMonExp + call Func_c4c7 + ld a, [wStepCounter] + and $3 ; is the counter a multiple of 4? + jp nz, .skipPoisonEffectAndSound ; only apply poison damage every fourth step + ld [wWhichPokemon], a + ld hl, wPartyMon1Status + ld de, wPartySpecies +.applyDamageLoop + ld a, [hl] + and (1 << PSN) + jr z, .nextMon2 ; not poisoned + dec hl + dec hl + ld a, [hld] + ld b, a + ld a, [hli] + or b + jr z, .nextMon ; already fainted +; subtract 1 from HP + ld a, [hl] + dec a + ld [hld], a + inc a + jr nz, .noBorrow +; borrow 1 from upper byte of HP + dec [hl] + inc hl + jr .nextMon +.noBorrow + ld a, [hli] + or [hl] + jr nz, .nextMon ; didn't faint from damage +; the mon fainted from the damage + push hl + inc hl + inc hl + ld [hl], a + ld a, [de] + ld [wd11e], a + push de + ld a, [wWhichPokemon] + ld hl, wPartyMonNicks + call GetPartyMonName + xor a + ld [wJoyIgnore], a + call EnableAutoTextBoxDrawing + ld a, $d0 + ld [hSpriteIndexOrTextID], a + call DisplayTextID + callab IsThisPartymonStarterPikachu_Party + jr nc, .curMonNotPlayerPikachu + ld e, $3 + callab PlayPikachuSoundClip + calladb_ModifyPikachuHappiness PIKAHAPPY_PSNFNT +.curMonNotPlayerPikachu + pop de + pop hl +.nextMon + inc hl + inc hl +.nextMon2 + inc de + ld a, [de] + inc a + jr z, .applyDamageLoopDone + ld bc, wPartyMon2 - wPartyMon1 + add hl, bc + push hl + ld hl, wWhichPokemon + inc [hl] + pop hl + jr .applyDamageLoop +.applyDamageLoopDone + ld hl, wPartyMon1Status + ld a, [wPartyCount] + ld d, a + ld e, 0 +.countPoisonedLoop + ld a, [hl] + and (1 << PSN) + or e + ld e, a + ld bc, wPartyMon2 - wPartyMon1 + add hl, bc + dec d + jr nz, .countPoisonedLoop + ld a, e + and a ; are any party members poisoned? + jr z, .skipPoisonEffectAndSound + ld b, $2 + predef InvertBGPal_4Frames ; change BG white to dark grey for 4 frames + ld a, SFX_POISONED + call PlaySound +.skipPoisonEffectAndSound + predef AnyPartyAlive + ld a, d + and a + jr nz, .noBlackOut + call EnableAutoTextBoxDrawing + ld a, $d1 + ld [hSpriteIndexOrTextID], a + call DisplayTextID + ld hl, wd72e + set 5, [hl] + ld a, $ff + jr .done +.noBlackOut + xor a +.done + ld [wOutOfBattleBlackout], a + ret + +Func_c4c7: + ld a, [wStepCounter] + and a + jr nz, .asm_c4de + call Random + and $1 + jr z, .asm_c4de + calladb_ModifyPikachuHappiness $6 +.asm_c4de + ld hl, wPikachuMood + ld a, [hl] + cp $80 + jr z, .asm_c4ef + jr c, .asm_c4ea + dec a + dec a +.asm_c4ea + inc a + ld [hl], a + cp $80 + ret nz +.asm_c4ef + xor a + ld [wd49c], a + ret diff --git a/engine/overworld/trainers.asm b/engine/overworld/trainers.asm index 1d0340c9..3ee19e8a 100755 --- a/engine/overworld/trainers.asm +++ b/engine/overworld/trainers.asm @@ -4,16 +4,16 @@ _GetSpritePosition1: ld a, [wSpriteIndex] ld [H_SPRITEINDEX], a call GetSpriteDataPointer - ld a, [hli] + ld a, [hli] ; c1x4 (screen Y pos) ld [$ffeb], a inc hl - ld a, [hl] + ld a, [hl] ; c1x6 (screen X pos) ld [$ffec], a - ld de, $fe + ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) add hl, de - ld a, [hli] + ld a, [hli] ; c2x4 (map Y pos) ld [$ffed], a - ld a, [hl] + ld a, [hl] ; c2x5 (map X pos) ld [$ffee], a ret @@ -28,7 +28,7 @@ _GetSpritePosition2: inc hl ld a, [hl] ; c1x6 (screen X pos) ld [wSavedSpriteScreenX], a - ld de, $104 - $6 + ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) add hl, de ld a, [hli] ; c2x4 (map Y pos) ld [wSavedSpriteMapY], a @@ -47,7 +47,7 @@ _SetSpritePosition1: inc hl ld a, [$ffec] ; c1x6 (screen X pos) ld [hl], a - ld de, $104 - $6 + ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) add hl, de ld a, [$ffed] ; c2x4 (map Y pos) ld [hli], a @@ -57,21 +57,21 @@ _SetSpritePosition1: _SetSpritePosition2: ld hl, wSpriteStateData1 - ld de, $0004 + ld de, $4 ld a, [wSpriteIndex] ld [H_SPRITEINDEX], a call GetSpriteDataPointer ld a, [wSavedSpriteScreenY] - ld [hli], a + ld [hli], a ; c1x4 (screen Y pos) inc hl ld a, [wSavedSpriteScreenX] - ld [hl], a - ld de, $00fe + ld [hl], a ; c1x6 (screen X pos) + ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) add hl, de ld a, [wSavedSpriteMapY] - ld [hli], a + ld [hli], a ; c2x4 (map Y pos) ld a, [wSavedSpriteMapX] - ld [hl], a + ld [hl], a ; c2x5 (map X pos) ret TrainerWalkUpToPlayer: @@ -80,11 +80,11 @@ TrainerWalkUpToPlayer: ld [wTrainerSpriteOffset], a call ReadTrainerScreenPosition ld a, [wTrainerFacingDirection] - and a + and a ; SPRITE_FACING_DOWN jr z, .facingDown - cp $4 + cp SPRITE_FACING_UP jr z, .facingUp - cp $8 + cp SPRITE_FACING_LEFT jr z, .facingLeft jr .facingRight .facingDown @@ -148,7 +148,7 @@ TrainerWalkUpToPlayer: jp MoveSprite_ ; input: de = offset within sprite entry -; output: de = pointer to sprite data +; output: hl = pointer to sprite data GetSpriteDataPointer: push de add hl, de @@ -225,7 +225,7 @@ TrainerEngage: set 0, [hl] call EngageMapTrainer ld a, $ff -.noEngage: +.noEngage ld [wTrainerSpriteOffset], a pop de pop hl @@ -239,7 +239,7 @@ ReadTrainerScreenPosition: ld e, a ld hl, wSpriteStateData1 add hl, de - ld a, [hl] + ld a, [hl] ; c1x4 (sprite Y pos) ld [wTrainerScreenY], a ld a, [wTrainerSpriteOffset] add $6 @@ -247,7 +247,7 @@ ReadTrainerScreenPosition: ld e, a ld hl, wSpriteStateData1 add hl, de - ld a, [hl] + ld a, [hl] ; c1x6 (sprite X pos) ld [wTrainerScreenX], a ret @@ -262,13 +262,13 @@ CheckSpriteCanSeePlayer: jr .notInLine ; player too far away .checkIfLinedUp ld a, [wTrainerFacingDirection] ; sprite facing direction - cp $0 ; down + cp SPRITE_FACING_DOWN ; down jr z, .checkXCoord - cp $4 ; up + cp SPRITE_FACING_UP ; up jr z, .checkXCoord - cp $8 ; left + cp SPRITE_FACING_LEFT ; left jr z, .checkYCoord - cp $c ; right + cp SPRITE_FACING_RIGHT ; right jr z, .checkYCoord jr .notInLine .checkXCoord @@ -315,21 +315,21 @@ CheckPlayerIsInFrontOfSprite: ld a, [hl] ; c1x6 (sprite screen X pos) ld [wTrainerScreenX], a ld a, [wTrainerFacingDirection] ; facing direction - cp $0 + cp SPRITE_FACING_DOWN jr nz, .notFacingDown ld a, [wTrainerScreenY] ; sprite screen Y pos cp $3c jr c, .engage ; sprite above player jr .noEngage ; sprite below player .notFacingDown - cp $4 + cp SPRITE_FACING_UP jr nz, .notFacingUp ld a, [wTrainerScreenY] ; sprite screen Y pos cp $3c jr nc, .engage ; sprite below player jr .noEngage ; sprite above player .notFacingUp - cp $8 + cp SPRITE_FACING_LEFT jr nz, .notFacingLeft ld a, [wTrainerScreenX] ; sprite screen X pos cp $40 diff --git a/engine/overworld/try_pushing_boulder.asm b/engine/overworld/try_pushing_boulder.asm new file mode 100644 index 00000000..a00790b9 --- /dev/null +++ b/engine/overworld/try_pushing_boulder.asm @@ -0,0 +1,107 @@ +TryPushingBoulder: + ld a, [wd728] + bit 0, a ; using Strength? + ret z +Func_f0a7: +; where LoadMissableObjects predef points to now + ld a, [wFlags_0xcd60] + bit 1, a ; has boulder dust animation from previous push played yet? + ret nz + xor a + ld [hSpriteIndexOrTextID], a + call IsSpriteInFrontOfPlayer + ld a, [hSpriteIndexOrTextID] + ld [wBoulderSpriteIndex], a + and a + jp z, ResetBoulderPushFlags + ld hl, wSpriteStateData1 + 1 + ld d, $0 + ld a, [hSpriteIndexOrTextID] + swap a + ld e, a + add hl, de + res 7, [hl] + call GetSpriteMovementByte2Pointer + ld a, [hl] + cp BOULDER_MOVEMENT_BYTE_2 + jp nz, ResetBoulderPushFlags + ld hl, wFlags_0xcd60 + bit 6, [hl] + set 6, [hl] ; indicate that the player has tried pushing + ret z ; the player must try pushing twice before the boulder will move + ld a, [hJoyHeld] + and D_RIGHT | D_LEFT | D_UP | D_DOWN + ret z + predef CheckForCollisionWhenPushingBoulder + ld a, [wTileInFrontOfBoulderAndBoulderCollisionResult] + and a ; was there a collision? + jp nz, ResetBoulderPushFlags + ld a, [hJoyHeld] + ld b, a + ld a, [wPlayerFacingDirection] ; player's sprite facing direction + cp SPRITE_FACING_UP + jr z, .pushBoulderUp + cp SPRITE_FACING_LEFT + jr z, .pushBoulderLeft + cp SPRITE_FACING_RIGHT + jr z, .pushBoulderRight +.pushBoulderDown + bit 7, b + ret z + ld de, PushBoulderDownMovementData + jr .done +.pushBoulderUp + bit 6, b + ret z + ld de, PushBoulderUpMovementData + jr .done +.pushBoulderLeft + bit 5, b + ret z + ld de, PushBoulderLeftMovementData + jr .done +.pushBoulderRight + bit 4, b + ret z + ld de, PushBoulderRightMovementData +.done + call MoveSprite + ld a, SFX_PUSH_BOULDER + call PlaySound + ld hl, wFlags_0xcd60 + set 1, [hl] + ret + +PushBoulderUpMovementData: + db NPC_MOVEMENT_UP,$FF + +PushBoulderDownMovementData: + db NPC_MOVEMENT_DOWN,$FF + +PushBoulderLeftMovementData: + db NPC_MOVEMENT_LEFT,$FF + +PushBoulderRightMovementData: + db NPC_MOVEMENT_RIGHT,$FF + +DoBoulderDustAnimation: + ld a, [wd730] + bit 0, a + ret nz + callab AnimateBoulderDust + call DiscardButtonPresses + ld [wJoyIgnore], a + call ResetBoulderPushFlags + set 7, [hl] + ld a, [wBoulderSpriteIndex] + ld [H_SPRITEINDEX], a + call GetSpriteMovementByte2Pointer + ld [hl], $10 + ld a, SFX_CUT + jp PlaySound + +ResetBoulderPushFlags: + ld hl, wFlags_0xcd60 + res 1, [hl] + res 6, [hl] + ret diff --git a/engine/palettes.asm b/engine/palettes.asm index 4785ade2..9418fb72 100755 --- a/engine/palettes.asm +++ b/engine/palettes.asm @@ -19,7 +19,7 @@ _RunPaletteCommand: push de jp [hl] -SetPal_BattleBlack: +SetPal_Black: ld hl, PalPacket_Black ld de, BlkPacket_Battle ret @@ -30,11 +30,19 @@ SetPal_Battle: ld de, wPalPacket ld bc, $10 call CopyData - ld a, [wPlayerBattleStatus3] + ;ld a, [wPlayerBattleStatus3] ld hl, wBattleMonSpecies + ld a, [hl] + and a + jr z, .asm_71ef9 + ld hl, wPartyMon1 + ld a, [wPlayerMonNumber] + ld bc, wPartyMon2 - wPartyMon1 + call AddNTimes +.asm_71ef9 call DeterminePaletteID ld b, a - ld a, [wEnemyBattleStatus3] + ;ld a, [wEnemyBattleStatus3] ld hl, wEnemyMonSpecies2 call DeterminePaletteID ld c, a @@ -110,7 +118,7 @@ SetPal_Slots: ld de, BlkPacket_Slots ret -SetPal_TitleScreen: +SetPal_Titlescreen: ld hl, PalPacket_Titlescreen ld de, BlkPacket_Titlescreen ret @@ -155,6 +163,10 @@ SetPal_Overworld: jr z, .Lorelei cp BRUNOS_ROOM jr z, .caveOrBruno + cp TRADE_CENTER + jr z, .trade_center_colosseum + cp COLOSSEUM + jr z, .trade_center_colosseum .normalDungeonOrBuilding ld a, [wLastMap] ; town or route that current dungeon or building is located .townOrRoute @@ -169,16 +181,23 @@ SetPal_Overworld: ld a, SET_PAL_OVERWORLD ld [wDefaultPaletteCommand], a ret + .PokemonTowerOrAgatha ld a, PAL_GREYMON - 1 jr .town + .caveOrBruno ld a, PAL_CAVE - 1 jr .town + .Lorelei xor a jr .town +.trade_center_colosseum + ld a, PAL_GREYMON - 1 + jr .town + ; used when a Pokemon is the only thing on the screen ; such as evolution, trading and the Hall of Fame SetPal_PokemonWholeScreen: @@ -240,14 +259,24 @@ SetPal_TrainerCard: ld de, wTrainerCardBlkPacket ret +SendUnknownPalPacket_7205d:: + ld hl, UnknownPalPacket_72811 + ld de, BlkPacket_WholeScreen + ret + +SendUnknownPalPacket_72064:: + ld hl, UnknownPalPacket_72821 + ld de, UnknownPacket_72751 + ret + SetPalFunctions: - dw SetPal_BattleBlack + dw SetPal_Black dw SetPal_Battle dw SetPal_TownMap dw SetPal_StatusScreen dw SetPal_Pokedex dw SetPal_Slots - dw SetPal_TitleScreen + dw SetPal_Titlescreen dw SetPal_NidorinoIntro dw SetPal_Generic dw SetPal_Overworld @@ -255,6 +284,8 @@ SetPalFunctions: dw SetPal_PokemonWholeScreen dw SetPal_GameFreakIntro dw SetPal_TrainerCard + dw SendUnknownPalPacket_7205d + dw SendUnknownPalPacket_72064 ; The length of the blk data of each badge on the Trainer Card. ; The Rainbow Badge has 3 entries because of its many colors. @@ -269,9 +300,6 @@ BadgeBlkDataLengths: db 6 ; Earth Badge DeterminePaletteID: - bit Transformed, a ; a is battle status 3 - ld a, PAL_GREYMON ; if the mon has used Transform, use Ditto's palette - ret nz ld a, [hl] DeterminePaletteIDOutOfBattle: ld [wd11e], a @@ -289,6 +317,132 @@ DeterminePaletteIDOutOfBattle: ld a, [hl] ret +YellowIntroPaletteAction:: + ld a, e + and a + jr nz, .asm_720bd + ld hl, PalPacket_Generic + ld a, [hGBC] + and a + jp z, SendSGBPacket + jp InitGBCPalettes + +.asm_720bd + ld hl, UnknownPalPacket_72811 + ld a, [hGBC] + and a + jp z, SendSGBPacket + call InitGBCPalettes + ld hl, PalPacket_Generic + inc hl + ld a, [hli] + call GetGBCBasePalAddress + ld a, e + ld [wGBCBasePalPointers + 2], a + ld a, d + ld [wGBCBasePalPointers + 2 + 1], a + xor a ; CONVERT_BGP + call DMGPalToGBCPal + ld a, 1 + call TransferCurBGPData + ret + +LoadOverworldPikachuFrontpicPalettes:: + ld hl, PalPacket_Empty + ld de, wPalPacket + ld bc, $10 + call CopyData + call GetPal_Pikachu + ld hl, wPartyMenuBlkPacket + ld [hl], a + ld hl, wPartyMenuBlkPacket + 2 + ld a, $26 + ld [hl], a + ld hl, wPalPacket + ld a, [hGBC] + and a + jr nz, .cgb_1 + call SendSGBPacket + jr .okay_1 + +.cgb_1 + call InitGBCPalettes +.okay_1 + ld hl, BlkPacket_WholeScreen + ld de, wPalPacket + ld bc, $10 + call CopyData + ld hl, wPartyMenuBlkPacket + 2 + ld a, $5 + ld [hli], a + ld a, $7 + ld [hli], a + ld a, $6 + ld [hli], a + ld a, $b + ld [hli], a + ld a, $a + ld [hl], a + ld hl, wPalPacket + ld a, [hGBC] + and a + jr nz, .cgb_2 + call SendSGBPacket + jr .okay_2 + +.cgb_2 + call InitGBCPalettes +.okay_2 + ret + +GetPal_Pikachu:: +; similar to SetPal_Overworld + ld a, [wCurMapTileset] + cp CEMETERY + jr z, .PokemonTowerOrAgatha + cp CAVERN + jr z, .caveOrBruno + ld a, [wCurMap] + cp REDS_HOUSE_1F + jr c, .townOrRoute + cp UNKNOWN_DUNGEON_2 + jr c, .normalDungeonOrBuilding + cp NAME_RATERS_HOUSE + jr c, .caveOrBruno + cp LORELEIS_ROOM + jr z, .Lorelei + cp BRUNOS_ROOM + jr z, .caveOrBruno + cp TRADE_CENTER + jr z, .battleOrTradeCenter + cp COLOSSEUM + jr z, .battleOrTradeCenter +.normalDungeonOrBuilding + ld a, [wLastMap] ; town or route that current dungeon or building is located +.townOrRoute + cp SAFFRON_CITY + 1 + jr c, .town + ld a, PAL_ROUTE - 1 +.town + inc a ; a town's pallete ID is its map ID + 1 + ret + +.PokemonTowerOrAgatha + ld a, PAL_GREYMON - 1 + jr .town + +.caveOrBruno + ld a, PAL_CAVE - 1 + jr .town + +.Lorelei + xor a ; PAL_PALLET - 1 + jr .town + +.battleOrTradeCenter + ld a, PAL_GREYMON - 1 + jr .town + InitPartyMenuBlkPacket: ld hl, BlkPacket_PartyMenu ld de, wPartyMenuBlkPacket @@ -324,62 +478,66 @@ UpdatePartyMenuBlkPacket: ret SendSGBPacket: + ld a, 1 + ld [hDisableJoypadPolling], a ; don't poll joypad while sending packet + call _SendSGBPacket + xor a + ld [hDisableJoypadPolling], a + ret + +_SendSGBPacket: ;check number of packets - ld a,[hl] - and a,$07 + ld a, [hl] + and a, $07 ret z ; store number of packets in B - ld b,a + ld b, a .loop2 ; save B for later use push bc -; disable ReadJoypad to prevent it from interfering with sending the packet - ld a, 1 - ld [hDisableJoypadPolling], a ; send RESET signal (P14=LOW, P15=LOW) xor a - ld [rJOYP],a + ld [rJOYP], a ; set P14=HIGH, P15=HIGH - ld a,$30 - ld [rJOYP],a + ld a, $30 + ld [rJOYP], a ;load length of packets (16 bytes) - ld b,$10 + ld b, $10 .nextByte ;set bit counter (8 bits per byte) - ld e,$08 + ld e, $08 ; get next byte in the packet - ld a,[hli] - ld d,a + ld a, [hli] + ld d, a .nextBit0 - bit 0,d -; if 0th bit is not zero set P14=HIGH,P15=LOW (send bit 1) - ld a,$10 - jr nz,.next0 -; else (if 0th bit is zero) set P14=LOW,P15=HIGH (send bit 0) - ld a,$20 + bit 0, d +; if 0th bit is not zero set P14=HIGH, P15=LOW (send bit 1) + ld a, $10 + jr nz, .next0 +; else (if 0th bit is zero) set P14=LOW, P15=HIGH (send bit 0) + ld a, $20 .next0 - ld [rJOYP],a -; must set P14=HIGH,P15=HIGH between each "pulse" - ld a,$30 - ld [rJOYP],a + ld [rJOYP], a +; must set P14=HIGH, P15=HIGH between each "pulse" + ld a, $30 + ld [rJOYP], a ; rotation will put next bit in 0th position (so we can always use command -; "bit 0,d" to fetch the bit that has to be sent) +; "bit 0, d" to fetch the bit that has to be sent) rr d ; decrease bit counter so we know when we have sent all 8 bits of current byte dec e - jr nz,.nextBit0 + jr nz, .nextBit0 dec b - jr nz,.nextByte + jr nz, .nextByte ; send bit 1 as a "stop bit" (end of parameter data) - ld a,$20 - ld [rJOYP],a -; set P14=HIGH,P15=HIGH - ld a,$30 - ld [rJOYP],a - xor a - ld [hDisableJoypadPolling],a -; wait for about 70000 cycles + ld a, $20 + ld [rJOYP], a +; set P14=HIGH, P15=HIGH + ld a, $30 + ld [rJOYP], a call Wait7000 +; wait for about 70000 cycles +; call Wait7000 ; restore (previously pushed) number of packets pop bc dec b @@ -392,14 +550,17 @@ LoadSGB: xor a ld [wOnSGB], a call CheckSGB - ret nc - ld a, 1 - ld [wOnSGB], a - ld a, [wGBC] + jr c, .onSGB + ld a, [hGBC] and a - jr z, .notGBC + jr z, .onDMG + ld a, $1 + ld [wOnSGB], a +.onDMG ret -.notGBC +.onSGB + ld a, $1 + ld [wOnSGB], a di call PrepareSuperNintendoVRAMTransfer ei @@ -439,26 +600,21 @@ PrepareSuperNintendoVRAMTransfer: jr nz, .loop ret -.packetPointers +.packetPointers ; 7225b (1c:625b) ; Only the first packet is needed. dw MaskEnFreezePacket - dw DataSnd_72548 - dw DataSnd_72558 - dw DataSnd_72568 - dw DataSnd_72578 - dw DataSnd_72588 - dw DataSnd_72598 - dw DataSnd_725a8 - dw DataSnd_725b8 + dw DataSnd_728a1 + dw DataSnd_728b1 + dw DataSnd_728c1 + dw DataSnd_728d1 + dw DataSnd_728e1 + dw DataSnd_728f1 + dw DataSnd_72901 + dw DataSnd_72911 CheckSGB: -; Returns whether the game is running on an SGB in carry. ld hl, MltReq2Packet - di call SendSGBPacket - ld a, 1 - ld [hDisableJoypadPolling], a - ei call Wait7000 ld a, [rJOYP] and $3 @@ -514,6 +670,7 @@ CopyGfxToSuperNintendoVRAM: call DisableLCD ld a, $e4 ld [rBGP], a + call _UpdateGBCPal_BGP_CheckDMG ld de, vChars1 ld a, [wCopyingSGBTileData] and a @@ -544,6 +701,7 @@ CopyGfxToSuperNintendoVRAM: call SendSGBPacket xor a ld [rBGP], a + call _UpdateGBCPal_BGP_CheckDMG ei ret @@ -561,13 +719,17 @@ Wait7000: ret SendSGBPackets: - ld a, [wGBC] + ld a, [hGBC] and a jr z, .notGBC push de call InitGBCPalettes pop hl - call EmptyFunc5 + call InitGBCPalettes + ld a, [rLCDC] + and rLCDC_ENABLE_MASK + ret z + call Delay3 ret .notGBC push de @@ -576,30 +738,349 @@ SendSGBPackets: jp SendSGBPacket InitGBCPalettes: - ld a, $80 ; index 0 with auto-increment - ld [rBGPI], a - inc hl - ld c, $20 -.loop - ld a, [hli] + ld a, [hl] + and $f8 + cp $20 + jp z, TranslatePalPacketToBGMapAttributes + inc hl + +index = 0 + + REPT NUM_ACTIVE_PALS + IF index > 0 + pop hl + ENDC + + ld a, [hli] + inc hl + + IF index < (NUM_ACTIVE_PALS + -1) + push hl + ENDC + + call GetGBCBasePalAddress + ld a, e + ld [wGBCBasePalPointers + index * 2], a + ld a, d + ld [wGBCBasePalPointers + index * 2 + 1], a + + xor a ; CONVERT_BGP + call DMGPalToGBCPal + ld a, index + call TransferCurBGPData + + ld a, CONVERT_OBP0 + call DMGPalToGBCPal + ld a, index + call TransferCurOBPData + + ld a, CONVERT_OBP1 + call DMGPalToGBCPal + ld a, index + 4 + call TransferCurOBPData + +index = index + 1 + ENDR + + ret + +GetGBCBasePalAddress:: +; Input: a = palette ID +; Output: de = palette address + push hl + ld l, a + xor a + ld h, a + add hl, hl + add hl, hl + add hl, hl + ld de, GBCBasePalettes + add hl, de + ld a, l + ld e, a + ld a, h + ld d, a + pop hl + ret + +DMGPalToGBCPal:: +; Populate wGBCPal with colors from a base palette, selected using one of the +; DMG palette registers. +; Input: +; a = which DMG palette register +; de = address of GBC base palette + and a + jr nz, .notBGP + ld a, [rBGP] + ld [wLastBGP], a + jr .convert +.notBGP + dec a + jr nz, .notOBP0 + ld a, [rOBP0] + ld [wLastOBP0], a + jr .convert +.notOBP0 + ld a, [rOBP1] + ld [wLastOBP1], a +.convert +color_index = 0 + REPT NUM_COLORS + ld b, a + and %11 + call .GetColorAddress + ld a, [hli] + ld [wGBCPal + color_index * 2], a + ld a, [hl] + ld [wGBCPal + color_index * 2 + 1], a + + IF color_index < (NUM_COLORS + -1) + ld a, b + rrca + rrca + ENDC + +color_index = color_index + 1 + ENDR + ret + +.GetColorAddress: + add a + ld l, a + xor a + ld h, a + add hl, de + ret + +TransferCurBGPData:: + push de add a add a add a - ld de, SuperPalettes - add e - jr nc, .noCarry - inc d -.noCarry + or $80 ; auto-increment + ld [rBGPI], a + ld de, rBGPD + ld hl, wGBCPal + ld b, %10 ; mask for non-V-blank/non-H-blank STAT mode + ld a, [rLCDC] + and rLCDC_ENABLE_MASK + jr nz, .lcdEnabled + rept NUM_COLORS + call TransferPalColorLCDDisabled + endr + jr .done +.lcdEnabled + rept NUM_COLORS + call TransferPalColorLCDEnabled + endr +.done + pop de + ret + +BufferBGPPal:: +; Copy wGBCPal to palette a in wBGPPalsBuffer. + push de + add a + add a + add a + ld l, a + xor a + ld h, a + ld de, wBGPPalsBuffer + add hl, de + ld de, wGBCPal + ld c, PAL_SIZE +.loop ld a, [de] - ld [rBGPD], a + ld [hli], a + inc de dec c jr nz, .loop + pop de ret -EmptyFunc5: +TransferBGPPals:: +; Transfer the buffered BG palettes. + ld a, [rLCDC] + and rLCDC_ENABLE_MASK + jr z, .lcdDisabled + di +.waitLoop + ld a, [rLY] + cp 144 + jr c, .waitLoop +.lcdDisabled + call .DoTransfer + ei ret +.DoTransfer: + xor a + or $80 ; auto-increment + ld [rBGPI], a + ld de, rBGPD + ld hl, wBGPPalsBuffer + ld c, 4 * PAL_SIZE +.loop + ld a, [hli] + ld [de], a + dec c + jr nz, .loop + ret + +TransferCurOBPData: + push de + add a + add a + add a + or $80 ; auto-increment + ld [rOBPI], a + ld de, rOBPD + ld hl, wGBCPal + ld b, %10 ; mask for non-V-blank/non-H-blank STAT mode + ld a, [rLCDC] + and rLCDC_ENABLE_MASK + jr nz, .lcdEnabled + rept NUM_COLORS + call TransferPalColorLCDDisabled + endr + jr .done +.lcdEnabled + rept NUM_COLORS + call TransferPalColorLCDEnabled + endr +.done + pop de + ret + +TransferPalColorLCDEnabled: +; Transfer a palette color while the LCD is enabled. + +; In case we're already in H-blank or V-blank, wait for it to end. This is a +; precaution so that the transfer doesn't extend past the blanking period. + ld a, [rSTAT] + and b + jr z, TransferPalColorLCDEnabled + +; Wait for H-blank or V-blank to begin. +.notInBlankingPeriod + ld a, [rSTAT] + and b + jr nz, .notInBlankingPeriod +; fall through + +TransferPalColorLCDDisabled: +; Transfer a palette color while the LCD is disabled. + ld a, [hli] + ld [de], a + ld a, [hli] + ld [de], a + ret + +_UpdateGBCPal_BGP_CheckDMG:: + ld a, [hGBC] + and a + ret z +; fall through + +_UpdateGBCPal_BGP:: +index = 0 + + REPT NUM_ACTIVE_PALS + ld a, [wGBCBasePalPointers + index * 2] + ld e, a + ld a, [wGBCBasePalPointers + index * 2 + 1] + ld d, a + xor a ; CONVERT_BGP + call DMGPalToGBCPal + ld a, index + call BufferBGPPal + +index = index + 1 + ENDR + + call TransferBGPPals + ret + +_UpdateGBCPal_OBP:: +index = 0 + + REPT NUM_ACTIVE_PALS + ld a, [wGBCBasePalPointers + index * 2] + ld e, a + ld a, [wGBCBasePalPointers + index * 2 + 1] + ld d, a + ld a, c + call DMGPalToGBCPal + ld a, c + dec a + rlca + rlca + + IF index > 0 + IF index == 1 + inc a + ELSE + add index + ENDC + ENDC + + call TransferCurOBPData + +index = index + 1 + ENDR + + ret + +TranslatePalPacketToBGMapAttributes:: +; translate the SGB pal packets into something usable for the GBC + push hl + pop de + ld hl, PalPacketPointers + ld a, [hli] + ld c, a +.loop + ld a, e +.innerLoop + cp [hl] + jr z, .checkHighByte + inc hl + inc hl + dec c + jr nz, .innerLoop + ret +.checkHighByte +; the low byte of pointer matched, so check the high byte + inc hl + ld a, d + cp [hl] + jr z, .foundMatchingPointer + inc hl + dec c + jr nz, .loop + ret +.foundMatchingPointer + callba LoadBGMapAttributes + ret + +PalPacketPointers:: + db (palPacketPointersEnd - palPacketPointers) / 2 +palPacketPointers + dw BlkPacket_WholeScreen + dw BlkPacket_Battle + dw BlkPacket_StatusScreen + dw BlkPacket_Pokedex + dw BlkPacket_Slots + dw BlkPacket_Titlescreen + dw BlkPacket_NidorinoIntro + dw wPartyMenuBlkPacket + dw wTrainerCardBlkPacket + dw BlkPacket_GameFreakIntro + dw wPalPacket + dw UnknownPacket_72751 +palPacketPointersEnd + CopySGBBorderTiles: ; SGB tile data is stored in a 4BPP planar format. ; Each tile is 32 bytes. The first 16 bytes contain bit planes 1 and 2, while @@ -607,9 +1088,7 @@ CopySGBBorderTiles: ; This function converts 2BPP planar data into this format by mapping ; 2BPP colors 0-3 to 4BPP colors 0-3. 4BPP colors 4-15 are not used. ld b, 128 - .tileLoop - ; Copy bit planes 1 and 2 of the tile data. ld c, 16 .copyLoop diff --git a/engine/pikachu_emotions.asm b/engine/pikachu_emotions.asm new file mode 100755 index 00000000..8702bc3f --- /dev/null +++ b/engine/pikachu_emotions.asm @@ -0,0 +1,421 @@ +IsPlayerTalkingToPikachu: + ld a, [wd436] + and a + ret z + ld a, [hSpriteIndexOrTextID] + cp $f + ret nz + call InitializePikachuTextID + xor a + ld [hSpriteIndexOrTextID], a + ld [wd436], a + ret + +InitializePikachuTextID: + ld a, $d4 ; display + ld [hSpriteIndexOrTextID], a + xor a + ld [wPlayerMovingDirection], a + ld a, $1 + ld [wAutoTextBoxDrawingControl], a + call DisplayTextID + xor a + ld [wAutoTextBoxDrawingControl], a + ret + +DoStarterPikachuEmotions: + ld e, a + ld d, 0 + add hl, de + add hl, de + ld e, [hl] + inc hl + ld d, [hl] +.loop + ld a, [de] + inc de + cp $ff + jr z, .done + ld c, a + ld b, 0 + ld hl, StarterPikachuEmotionsJumptable + add hl, bc + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + call JumpToAddress + jr .loop + +.done + ret + +StarterPikachuEmotionsJumptable: + dw StarterPikachuEmotionCommand_nop ; 0 + dw StarterPikachuEmotionCommand_text ; 1 + dw StarterPikachuEmotionCommand_pcm ; 2 + dw StarterPikachuEmotionCommand_emote ; 3 + dw StarterPikachuEmotionCommand_movement ; 4 + dw StarterPikachuEmotionCommand_pikapic ; 5 + dw StarterPikachuEmotionCommand_subcmd ; 6 + dw StarterPikachuEmotionCommand_delay ; 7 + dw StarterPikachuEmotionCommand_nop2 ; 8 + dw StarterPikachuEmotionCommand_9 ; 9 + dw StarterPikachuEmotionCommand_nop3 ; a + +StarterPikachuEmotionCommand_nop: +StarterPikachuEmotionCommand_nop3: + ret + +StarterPikachuEmotionCommand_text: + ld a, [de] + ld l, a + inc de + ld a, [de] + ld h, a + inc de + push de + call PrintText + pop de + ret + +StarterPikachuEmotionCommand_pcm: + ld a, [de] + inc de + push de + ld e, a + nop + call PlayPikachuSoundClip_ + pop de + ret + +PlayPikachuSoundClip_: + cp $ff + ret z + callab PlayPikachuSoundClip + ret + +StarterPikachuEmotionCommand_emote: + ld a, [wUpdateSpritesEnabled] + push af + ld a, $ff + ld [wUpdateSpritesEnabled], a + ld a, [de] + inc de + push de + call ShowPikachuEmoteBubble + pop de + pop af + ld [wUpdateSpritesEnabled], a + ret + +ShowPikachuEmoteBubble: + ld [wWhichEmotionBubble], a + ld a, $f ; Pikachu + ld [wEmotionBubbleSpriteIndex], a + predef EmotionBubble + ret + +StarterPikachuEmotionCommand_movement: + ld a, [de] + inc de + ld l, a + ld a, [de] + inc de + ld h, a + push de + ld b, BANK(DoStarterPikachuEmotions) + call ApplyPikachuMovementData_ + pop de + ret + +StarterPikachuEmotionCommand_delay: + ld a, [de] + inc de + push de + ld c, a + call DelayFrames + pop de + ret + +StarterPikachuEmotionCommand_subcmd: + ld a, [de] + inc de + push de + ld e, a + ld d, 0 + ld hl, .Subcommands + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + call JumpToAddress + pop de + ret + +.Subcommands: + dw LoadPikachuSpriteIntoVRAM + dw LoadFontTilePatterns + dw Pikachu_LoadCurrentMapViewUpdateSpritesAndDelay3 + dw WaitForTextScrollButtonPress + dw PikachuPewterPokecenterCheck + dw PikachuFanClubCheck + dw PikachuBillsHouseCheck + +StarterPikachuEmotionCommand_nop2: + ret + +StarterPikachuEmotionCommand_9: + push de + call StarterPikachuEmotionCommand_turnawayfromplayer + call UpdateSprites + pop de + ret + +StarterPikachuEmotionCommand_turnawayfromplayer: + ld a, [wPlayerFacingDirection] + xor $4 + ld [wPikachuFacingDirection], a + ret + +DeletedFunction_fcffb: +; Inexplicably empty. + rept 5 + nop + endr + ret + +PlaySpecificPikachuEmotion: + ld a, e + jr load_expression + +TalkToPikachu: + call MapSpecificPikachuExpression + jr c, load_expression + call GetPikaPicAnimationScriptIndex + call DeletedFunction_fcffb +load_expression: + ld [wExpressionNumber], a + ld hl, PikachuEmotionTable + call DoStarterPikachuEmotions + ret + +PikachuEmotionTable: +pikaemotion_def: MACRO +\1_id: dw \1 + endm + + pikaemotion_def PikachuEmotion0 + pikaemotion_def PikachuEmotion1 + pikaemotion_def PikachuEmotion2 + pikaemotion_def PikachuEmotion3 + pikaemotion_def PikachuEmotion4 + pikaemotion_def PikachuEmotion5 + pikaemotion_def PikachuEmotion6 + pikaemotion_def PikachuEmotion7 + pikaemotion_def PikachuEmotion8 + pikaemotion_def PikachuEmotion9 + pikaemotion_def PikachuEmotion10 + pikaemotion_def PikachuEmotion11 + pikaemotion_def PikachuEmotion12 + pikaemotion_def PikachuEmotion13 + pikaemotion_def PikachuEmotion14 + pikaemotion_def PikachuEmotion15 + pikaemotion_def PikachuEmotion16 + pikaemotion_def PikachuEmotion17 + pikaemotion_def PikachuEmotion18 + pikaemotion_def PikachuEmotion19 + pikaemotion_def PikachuEmotion20 + pikaemotion_def PikachuEmotion21 ; used a fishing rod + pikaemotion_def PikachuEmotion22 + pikaemotion_def PikachuEmotion23 + pikaemotion_def PikachuEmotion24 + pikaemotion_def PikachuEmotion25 + pikaemotion_def PikachuEmotion26 ; wake up pikachu in pewter pokemon center + pikaemotion_def PikachuEmotion27 + pikaemotion_def PikachuEmotion28 + pikaemotion_def PikachuEmotion29 + pikaemotion_def PikachuEmotion30 + pikaemotion_def PikachuEmotion31 + pikaemotion_def PikachuEmotion32 + pikaemotion_def PikachuEmotion33 + +PikachuEmotion33: + db $ff + +MapSpecificPikachuExpression: + ld a, [wCurMap] + cp POKEMON_FAN_CLUB + jr nz, .notFanClub + ld hl, wd492 + bit 7, [hl] + ldpikaemotion a, PikachuEmotion29 + jr z, .play_emotion + call CheckPikachuFollowingPlayer + ldpikaemotion a, PikachuEmotion30 + jr nz, .play_emotion + jr .check_pikachu_status + +.notFanClub + ld a, [wCurMap] + cp PEWTER_POKECENTER + jr nz, .notPewterPokecenter + call CheckPikachuFollowingPlayer + ldpikaemotion a, PikachuEmotion26 + jr nz, .play_emotion + jr .check_pikachu_status + +.notPewterPokecenter + callab Func_f24ae + ld a, e + cp $ff + jr nz, .play_emotion + jr .check_pikachu_status ; useless + +.check_pikachu_status + call IsPlayerPikachuAsleepInParty + ldpikaemotion a, PikachuEmotion11 + jr c, .play_emotion + callab CheckPikachuFaintedOrStatused ; same bank + ldpikaemotion a, PikachuEmotion28 + jr c, .play_emotion + ld a, [wCurMap] + cp POKEMONTOWER_1 + jr c, .notInLavenderTower + cp POKEMONTOWER_7 + 1 + ldpikaemotion a, PikachuEmotion22 + jr c, .play_emotion +.notInLavenderTower + ld a, [wd49c] + and a + jr z, .mood_based_emotion + dec a + ld c, a + ld b, $0 + ld hl, .Emotions + add hl, bc + ld a, [hl] + jr .play_emotion + +.mood_based_emotion + and a + ret + +.play_emotion + scf + ret + +.Emotions: + dpikaemotion PikachuEmotion18 + dpikaemotion PikachuEmotion21 + dpikaemotion PikachuEmotion23 + dpikaemotion PikachuEmotion24 + dpikaemotion PikachuEmotion25 + +IsPlayerPikachuAsleepInParty: + xor a + ld [wWhichPokemon], a +.loop + ld a, [wWhichPokemon] + ld c, a + ld b, 0 + ld hl, wPartySpecies + add hl, bc + ld a, [hl] + cp $ff + jr z, .done + cp PIKACHU + jr nz, .curMonNotStarterPikachu + callab IsThisPartymonStarterPikachu + jr nc, .curMonNotStarterPikachu + ld a, [wWhichPokemon] + ld hl, wPartyMon1Status + ld bc, wPartyMon2 - wPartyMon1 + call AddNTimes + ld a, [hl] + and SLP + jr z, .done + jr .curMonSleepingPikachu + +.curMonNotStarterPikachu + ld a, [wWhichPokemon] + cp PARTY_LENGTH - 1 + jr z, .done + inc a + ld [wWhichPokemon], a + jr .loop + +.curMonSleepingPikachu + scf + ret + +.done + and a + ret + +INCLUDE "data/pikachu_emotions.asm" + +PikachuWalksToNurseJoy: + ld a, $40 + ld [h_0xFFFC], a + call LoadPikachuSpriteIntoVRAM + call .GetMovementData + and a + jr z, .skip + call ApplyPikachuMovementData +.skip + xor a + ld [h_0xFFFC], a + ret + +.GetMovementData: + ld a, [wPikachuMapY] + ld e, a + ld a, [wPikachuMapX] + ld d, a + ld a, [wYCoord] + add 4 + cp e + jr z, .pikachu_at_same_y_as_player + jr nc, .pikachu_above_player + ld hl, .PikaMovementData1 + ld a, 1 + ret + +.pikachu_above_player + xor a + ret + +.pikachu_at_same_y_as_player + ld a, [wXCoord] + add 4 + cp d + jr c, .pikachu_to_right_of_player + ld hl, .PikaMovementData2 + ld a, 2 + ret + +.pikachu_to_right_of_player + ld hl, .PikaMovementData3 + ld a, 3 + ret + +.PikaMovementData1: + db $00 ; init + db $36 ; look up + db $2b ; walk up left + db $34 ; hop up right + db $3f ; ret + +.PikaMovementData2: + db $00 ; init + db $36 ; look up + db $34 ; hop up right + db $3f ; ret + +.PikaMovementData3: + db $00 ; init + db $36 ; look up + db $33 ; hop up left + db $3f ; ret diff --git a/engine/pikachu_follow.asm b/engine/pikachu_follow.asm new file mode 100755 index 00000000..b5791919 --- /dev/null +++ b/engine/pikachu_follow.asm @@ -0,0 +1,1578 @@ +ShouldPikachuSpawn:: +; possibly to test if pika should be out? + ld a, [wPikachuOverworldStateFlags] + bit 5, a + jr nz, .hide ; 3f:44f8 + ld a, [wPikachuOverworldStateFlags] + bit 7, a + jr nz, .hide + call IsStarterPikachuInOurParty + jr nc, .hide + ld a, [wWalkBikeSurfState] + and a + jr nz, .hide + scf + ret + +.hide + and a + ret + +SchedulePikachuSpawnForAfterText:: + ld hl, wPikachuOverworldStateFlags + bit 4, [hl] + res 4, [hl] + jr nz, .normal_spawn_state + call EnablePikachuFollowingPlayer + call ClearPikachuSpriteStateData + ld a, $ff + ld [wPikachuSpriteImageIdx], a + call ClearPikachuFollowCommandBuffer + call CalculatePikachuFacingDirection + ret + +.normal_spawn_state + call CalculatePikachuPlacementCoords + xor a + ld [wPikachuSpawnState], a + ld a, [wPlayerFacingDirection] + ld [wPikachuFacingDirection], a + ret + +ClearPikachuSpriteStateData:: + ld hl, wPikachuPictureID + call .clear + ld hl, wPikachuSpriteStateData2 +.clear + ld bc, $10 + xor a + call FillMemory + ret + +CalculatePikachuSpawnCoordsAndFacing:: + call CalculatePikachuPlacementCoords + call CalculatePikachuFacingDirection + xor a + ld [wPikachuSpawnState], a + ret + +CalculatePikachuPlacementCoords:: + ld bc, wPikachuPictureID + ld a, [wYCoord] + add $4 + ld e, a + ld a, [wXCoord] + add $4 + ld d, a + ld a, [wPikachuSpawnState] + and a + jr z, .load_coords + cp $1 + jr z, .right_of_player + cp $2 + jr z, .check_player_facing2 + cp $3 + jr z, .load_coords + cp $4 + jr z, .below_player + cp $5 + jr z, .above_player + cp $6 + jr z, .left_of_player + cp $7 + jr z, .check_player_facing + jr .right_of_player + +.check_player_facing + ld a, [wPlayerFacingDirection] + and a ; SPRITE_FACING_DOWN + jr z, .below_player + cp SPRITE_FACING_UP + jr z, .above_player + cp SPRITE_FACING_LEFT + jr z, .left_of_player + cp SPRITE_FACING_RIGHT + jr z, .right_of_player +.check_player_facing2 + ld a, [wPlayerFacingDirection] + and a + jr nz, .check_up + dec e + jr .load_coords + +.check_up + cp SPRITE_FACING_UP + jr nz, .check_left + inc e + jr .load_coords + +.check_left + cp SPRITE_FACING_LEFT + jr nz, .left_of_player_2 + inc d + jr .load_coords + +.left_of_player_2 + dec d + jr .load_coords + +.right_of_player + inc d + jr .load_coords + +.left_of_player + dec d + jr .load_coords + +.below_player + inc e + jr .load_coords + +.above_player + dec e + jr .load_coords ; useless jr +.load_coords + ld hl, wPlayerMapY - wPlayerSpriteStateData1 + add hl, bc + ld [hl], e + inc hl + ld [hl], d + inc hl + ld [hl], $fe + push hl + ld hl, wd472 + set 5, [hl] + pop hl + ret + +CalculatePikachuFacingDirection:: + ld a, $49 + ld [wPikachuPictureID], a + ld a, $ff + ld [wPikachuSpriteImageIdx], a + ld a, [wPikachuSpawnState] + and a + jr z, .copy_player_facing + cp $1 + jr z, .copy_player_facing + cp $3 + jr z, .force_facing_down + cp $4 + jr z, .copy_player_facing + cp $6 + jr z, .copy_player_facing + cp $7 + jr z, .face_the_other_way + call ComputePikachuFacingDirection + ret + +.copy_player_facing + ld a, [wPlayerFacingDirection] + ld [wPikachuFacingDirection], a + ret + +.force_facing_down + ld a, SPRITE_FACING_DOWN + ld [wPikachuFacingDirection], a + ret + +.face_the_other_way + ld a, [wPlayerFacingDirection] + xor $4 + ld [wPikachuFacingDirection], a + ret + +CalculatePikachuSpawnState1:: + ld a, [wCurMap] + cp OAKS_LAB + jr z, .oaks_lab + cp ROUTE_22_GATE + jr z, .route_22_gate + cp MT_MOON_2 + jr z, .mt_moon_2 + cp ROCK_TUNNEL_1 + jr z, .rock_tunnel_1 + ld a, [wCurMap] + ld hl, Pointer_fc64b + call Pikachu_IsInArray ; similar to IsInArray, but not the same + jr c, .map_list_1 + ld a, [wCurMap] + ld hl, Pointer_fc653 + call Pikachu_IsInArray + jr nc, .not_map_list_2 + ld a, [wPlayerFacingDirection] + and a + jr nz, .not_map_list_2 + ld a, $3 + jr .load + +.route_22_gate + ld a, [wPlayerFacingDirection] + and a + jr z, .rock_tunnel_1 + jr .not_map_list_2 + +.mt_moon_2 + ld a, $3 + jr .load + +.map_list_1 + ld a, $4 + jr .load + +.oaks_lab + ld a, $6 + jr .load + +.not_map_list_2 + ld a, $1 + jr .load + +.rock_tunnel_1 + ld a, $3 +.load + ld [wPikachuSpawnState], a + ret + +Pointer_fc64b:: + db VICTORY_ROAD_2 + db ROUTE_7_GATE + db ROUTE_8_GATE + db ROUTE_16_GATE_1F + db ROUTE_18_GATE_1F + db ROUTE_15_GATE_1F + db ROUTE_11_GATE_1F + db $ff + +Pointer_fc653:: + db VIRIDIAN_FOREST_EXIT + db CERULEAN_HOUSE_2 + db TRASHED_HOUSE + db VERMILION_DOCK + db CELADON_MANSION_1 + db ROUTE_2_GATE + db FUCHSIA_HOUSE_3 + db $ff + +CalculatePikachuSpawnState2:: + ld a, [wCurMap] + cp VIRIDIAN_FOREST_EXIT + jr z, .viridian_forest_exit + cp VIRIDIAN_FOREST_ENTRANCE + jr z, .viridian_forest_entrance + ld a, [wCurMap] + ld hl, Pointer_fc68e + call Pikachu_IsInArray + jr c, .in_array + jr .not_in_array + +.viridian_forest_exit + ld a, [wPlayerFacingDirection] + cp SPRITE_FACING_UP + jr z, .in_array + jr .not_in_array + +.viridian_forest_entrance + ld a, [wPlayerFacingDirection] + and a ; SPRITE_FACING_DOWN + jr z, .not_in_array + jr .in_array + +.not_in_array + ld a, $0 + jr .load_spawn_state + +.in_array + ld a, $1 +.load_spawn_state + ld [wPikachuSpawnState], a + ret + +Pointer_fc68e:: + db VIRIDIAN_FOREST + db SAFARI_ZONE_REST_HOUSE_1 + db SAFARI_ZONE_REST_HOUSE_2 + db SAFARI_ZONE_REST_HOUSE_3 + db SAFARI_ZONE_REST_HOUSE_4 + db SAFARI_ZONE_SECRET_HOUSE + db SILPH_CO_ELEVATOR + db CELADON_MART_ELEVATOR + db CINNABAR_LAB_2 + db CINNABAR_LAB_3 + db CINNABAR_LAB_4 + db $ff + +CalculatePikachuSpawnState3:: + ld a, [wCurMap] + cp ROUTE_22_GATE + jr z, .asm_fc6a7 + cp ROUTE_2_GATE + jr z, .asm_fc6b0 + jr .asm_fc6bd + +.asm_fc6a7 + ld a, [wPlayerFacingDirection] + cp SPRITE_FACING_UP + jr z, .asm_fc6b9 + jr .asm_fc6bd + +.asm_fc6b0 + ld a, [wPlayerFacingDirection] + cp SPRITE_FACING_UP + jr z, .asm_fc6b9 + jr .asm_fc6bd + +.asm_fc6b9 + ld a, $1 + jr .asm_fc6c1 + +.asm_fc6bd + ld a, $3 + jr .asm_fc6c1 + +.asm_fc6c1 + ld [wPikachuSpawnState], a + ret + +SetPikachuOverworldStateFlag2:: + push hl + ld hl, wPikachuOverworldStateFlags + set 2, [hl] + pop hl + ret + +ResetPikachuOverworldStateFlag2:: + push hl + ld hl, wPikachuOverworldStateFlags + res 2, [hl] + pop hl + ret + +SpawnPikachu_:: + call ResetPikachuOverworldStateFlag2 + call TrySpawnPikachu + ret nc + + push bc + call WillPikachuSpawnOnTheScreen + pop bc + ret c + + ld bc, wPikachuSpriteStateData1 + ld hl, wPikachuMovementStatus - wPikachuSpriteStateData1 + add hl, bc + bit 7, [hl] + jp nz, Func_fc745 + ld a, [wFontLoaded] + bit 0, a + jp nz, Func_fc76a + call CheckPikachuFollowingPlayer + jp nz, Func_fc76a + ld a, [hl] + and $7f + cp $a + jr c, .valid + xor a +.valid + add a + ld e, a + ld d, 0 + ld hl, PointerTable_fc710 + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp hl + +PointerTable_fc710: + dw Func_fc793 + dw Func_fc7aa + dw Func_fc803 + dw asm_fc9c3 + dw asm_fca1c + dw asm_fc9ee + dw asm_fc87f + dw asm_fc904 + dw asm_fc937 + dw asm_fc969 + dw .nop + +.nop: + ret + +TrySpawnPikachu: + call ShouldPikachuSpawn + jr nc, .dont_spawn + ld a, [wPikachuMovementStatus] + and a + jr nz, .already_spawned + push bc + push hl + call CalculatePikachuSpawnCoordsAndFacing + pop hl + pop bc +.already_spawned + scf + ret + +.dont_spawn + ld hl, wPikachuSpriteImageIdx + ld [hl], $ff + dec hl + ld [hl], $0 + xor a + ret + +Func_fc745: + ld hl, wPikachuMovementStatus - wPikachuSpriteStateData1 + add hl, bc + res 7, [hl] + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + ld [hl], a + call CheckPikachuFollowingPlayer + jr nz, .okay + ; Have Pikachu face in the opposite direction of you + ld a, [wPlayerFacingDirection] + xor $4 + ld hl, wPikachuFacingDirection - wPikachuSpriteStateData1 + add hl, bc + ld [hl], a +.okay + xor a + ld hl, wPikachuIntraAnimFrameCounter - wPikachuSpriteStateData1 + add hl, bc + ld [hli], a + ld [hl], a + call UpdatePikachuWalkingSprite + ret + +Func_fc76a: + xor a + ld hl, wPikachuIntraAnimFrameCounter - wPikachuSpriteStateData1 + add hl, bc + ld [hli], a + ld [hl], a + call UpdatePikachuWalkingSprite + call Func_fc82e + jr c, .skip + push bc + callab InitializeSpriteScreenPosition + pop bc +.skip + ld hl, wPikachuMovementStatus - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $1 + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $0 + call RefreshPikachuFollow + ret + +Func_fc793: + call RefreshPikachuFollow + push bc + callab InitializeSpriteScreenPosition + pop bc + ld hl, wPikachuSpriteImageIdx - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $ff + dec hl + ld [hl], $1 + ret + +Func_fc7aa: + call Func_fcc92 + jp c, Func_fc803 + dec a + ld l, a + ld h, $0 + add hl, hl + add hl, hl + ld de, Pointer_fc7e3 + add hl, de + ld d, h + ld e, l + ld a, [de] + inc de + ld hl, wPikachuFacingDirection - wPikachuSpriteStateData1 + add hl, bc + ld [hl], a + ld a, [de] + inc de + ld hl, wPikachuXStepVector - wPikachuSpriteStateData1 + add hl, bc + ld [hl], a + dec hl + dec hl + ld a, [de] + ld [hl], a + inc de + ld a, [de] + ld hl, wPikachuMovementStatus - wPikachuSpriteStateData1 + add hl, bc + ld [hl], a + cp $4 + jp z, Func_fca0a + call AreThereAtLeastTwoStepsInPikachuFollowCommandBuffer + jp c, FastPikachuFollow + jp NormalPikachuFollow + +Pointer_fc7e3: + db 0, 0 + db 1, 3 + db 4, 0 + db -1, 3 + db 8, -1 + db 0, 3 + db 12, 1 + db 0, 3 + db 0, 0 + db 1, 4 + db 4, 0 + db -1, 4 + db 8, -1 + db 0, 4 + db 12, 1 + db 0, 4 + +Func_fc803: + call Func_fcae2 + ret c + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + dec [hl] + jr nz, .asm_fc823 + push hl + call GetPikachuFollowCommand + pop hl + cp $5 + jr nc, Func_fc842 + ld [hl], $20 + call Random + and $c + ld hl, wPikachuFacingDirection - wPikachuSpriteStateData1 + add hl, bc + ld [hl], a +.asm_fc823 + xor a + ld hl, wPikachuIntraAnimFrameCounter - wPikachuSpriteStateData1 + add hl, bc + ld [hli], a + ld [hl], a + call UpdatePikachuWalkingSprite + ret + +Func_fc82e: + ld a, [wWalkCounter] + and a + ret z + scf + ret + +Func_fc835: + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $10 + ld hl, wPikachuMovementStatus - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $1 + ret + +Func_fc842: + ld hl, $0 + push af + call Random + ld a, [hRandomAdd] + and %11 + ld e, a + ld d, $0 + ld hl, PointerTable_fc85a + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + pop af + jp hl + +PointerTable_fc85a: + dw Func_fc862 + dw Func_fc8f8 + dw Func_fc92b + dw Func_fc95d + +Func_fc862: + dec a + add a + add a + and $c + ld hl, wPikachuFacingDirection - wPikachuSpriteStateData1 + add hl, bc + ld [hl], a + ld hl, wPikachuMovementStatus - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $6 + xor a + ld [wd432], a + ld [wd433], a + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $11 +asm_fc87f: + ld a, [wd432] + ld e, a + ld a, [wd433] + ld d, a + call Func_fc82e + jr c, Func_fc8c7 + call SetPikachuOverworldStateFlag2 + ld hl, wPikachuYPixels - wPikachuSpriteStateData1 + add hl, bc + ld a, [hl] + sub e + ld e, a + inc hl + inc hl + ld a, [hl] + sub d + ld d, a + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + ld a, [hl] + dec a + add a + add Pointer_fc8d6 % $100 + ld l, a + ld a, Pointer_fc8d6 / $100 + adc $0 + ld h, a + ld a, [hli] + ld [wd432], a + add e + ld e, a + ld a, [hl] + ld [wd433], a + add d + ld d, a + ld hl, wPikachuYPixels - wPikachuSpriteStateData1 + add hl, bc + ld [hl], e + inc hl + inc hl + ld [hl], d + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + dec [hl] + ret nz + jp Func_fc835 + +Func_fc8c7: + ld hl, wPikachuYPixels - wPikachuSpriteStateData1 + add hl, bc + ld a, [hl] + sub e + ld [hl], a + inc hl + inc hl + ld a, [hl] + sub d + ld [hl], a + jp Func_fc835 + +Pointer_fc8d6: + db 0, 0 + db -2, 1 + db -4, 2 + db -2, 3 + db 0, 4 + db -2, 3 + db -4, 2 + db -2, 1 + db 0, 0 + db -2, -1 + db -4, -2 + db -2, -3 + db 0, -4 + db -2, -3 + db -4, -2 + db -2, -1 + db 0, 0 + +Func_fc8f8: + ld hl, wPikachuMovementStatus - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $7 + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $30 +asm_fc904: + call Func_fc82e + jp c, Func_fc835 + call SetPikachuOverworldStateFlag2 + ld hl, wPikachuIntraAnimFrameCounter - wPikachuSpriteStateData1 + add hl, bc + ld a, [hl] + inc a + cp $8 + ld [hl], a + jr nz, .asm_fc91f + xor a + ld [hli], a + ld a, [hl] + inc a + and %11 + ld [hl], a +.asm_fc91f + call UpdatePikachuWalkingSprite + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + dec [hl] + ret nz + jp Func_fc835 + +Func_fc92b: + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $20 + ld hl, wPikachuMovementStatus - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $8 +asm_fc937: + call Func_fc82e + jp c, Func_fc835 + call SetPikachuOverworldStateFlag2 + ld hl, wPikachuIntraAnimFrameCounter - wPikachuSpriteStateData1 + add hl, bc + ld a, [hl] + inc a + cp $8 + ld [hl], a + jr nz, .asm_fc951 + xor a + ld [hli], a + ld a, [hl] + xor $1 + ld [hl], a +.asm_fc951 + call UpdatePikachuWalkingSprite + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + dec [hl] + ret nz + jp Func_fc835 + +Func_fc95d: + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $20 + ld hl, wPikachuMovementStatus - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $9 +asm_fc969: + call Func_fc82e + jp c, Func_fc835 + call SetPikachuOverworldStateFlag2 + ld hl, wPikachuIntraAnimFrameCounter - wPikachuSpriteStateData1 + add hl, bc + ld a, [hl] + inc a + cp $8 + ld [hl], a + jr nz, .skip + xor a + ld [hl], a + ld hl, wPikachuFacingDirection - wPikachuSpriteStateData1 + add hl, bc + ld a, [hl] + call .TurnClockwise + ld [hl], a +.skip + call UpdatePikachuWalkingSprite + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + dec [hl] + ret nz + jp Func_fc835 + +.TurnClockwise: + push hl + ld hl, .Facings + ld d, a +.loop + ld a, [hli] + cp d + jr nz, .loop + ld a, [hl] + pop hl + ret + +.TurnCounterclockwise: + push hl + ld hl, .Facings_End + ld d, a +.loop_ + ld a, [hld] + cp d + jr nz, .loop_ + ld a, [hl] + pop hl + ret + +.Facings: + db SPRITE_FACING_DOWN, SPRITE_FACING_LEFT, SPRITE_FACING_UP, SPRITE_FACING_RIGHT + db SPRITE_FACING_DOWN, SPRITE_FACING_LEFT, SPRITE_FACING_UP, SPRITE_FACING_RIGHT +.Facings_End: + +NormalPikachuFollow: + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $8 + ld hl, wPikachuMovementStatus - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $3 + call AddPikachuStepVector +asm_fc9c3: + call TryDoubleAddPikachuStepVectorToScreenPixelCoords + call GetPikachuWalkingAnimationSpeed + call UpdatePikachuWalkingSprite + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + dec [hl] + ret nz + call ResetPikachuStepVector + call ComputePikachuFacingDirection + ld hl, wPikachuMovementStatus - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $1 + ret + +FastPikachuFollow: + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $4 + ld hl, wPikachuMovementStatus - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $5 + call AddPikachuStepVector +asm_fc9ee: + call DoubleAddPikachuStepVectorToScreenPixelCoords + call GetPikachuWalkingAnimationSpeed + call UpdatePikachuWalkingSprite + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + dec [hl] + ret nz + call ResetPikachuStepVector + call ComputePikachuFacingDirection + ld hl, wPikachuMovementStatus - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $1 + ret + +Func_fca0a: + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $8 + ld hl, wPikachuMovementStatus - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $4 + call AddPikachuStepVector + call AddPikachuStepVector +asm_fca1c: + call DoubleAddPikachuStepVectorToScreenPixelCoords + call GetPikachuWalkingAnimationSpeed + call UpdatePikachuWalkingSprite + ld hl, wPikachuWalkAnimationCounter - wPikachuSpriteStateData1 + add hl, bc + dec [hl] + ret nz + call ResetPikachuStepVector + call ComputePikachuFacingDirection + ld hl, wPikachuMovementStatus - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $1 + ret + +AddPikachuStepVector: + ld hl, wPikachuYStepVector - wPikachuSpriteStateData1 + add hl, bc + ld e, [hl] + inc hl + inc hl + ld d, [hl] + ld hl, wPikachuMapY - wPikachuSpriteStateData1 + add hl, bc + ld a, [hl] + add e + ld [hli], a + ld a, [hl] + add d + ld [hl], a + ret + +TryDoubleAddPikachuStepVectorToScreenPixelCoords: + ld a, [wWalkBikeSurfState] + cp $1 ; biking + jr nz, AddPikachuStepVectorToScreenPixelCoords + ld a, [wd736] + bit 6, a + jr nz, AddPikachuStepVectorToScreenPixelCoords +DoubleAddPikachuStepVectorToScreenPixelCoords: + ld hl, wPikachuYStepVector - wPikachuSpriteStateData1 + add hl, bc + ld a, [hli] + add a + add a + add [hl] + ld [hli], a + ld a, [hli] + add a + add a + add [hl] + ld [hl], a + ret + +AddPikachuStepVectorToScreenPixelCoords: + ld hl, wPikachuYStepVector - wPikachuSpriteStateData1 + add hl, bc + ld a, [hli] + add a + add [hl] + ld [hli], a + ld a, [hli] + add a + add [hl] + ld [hli], a + ret + +ResetPikachuStepVector: + ld hl, wPikachuYStepVector - wPikachuSpriteStateData1 + add hl, bc + xor a + ld [hli], a + inc hl + ld [hl], a + ret + +GetPikachuWalkingAnimationSpeed: + call ComparePikachuHappinessTo80 + ld d, $2 + jr nc, .happy + ld d, $5 +.happy + ld hl, wPikachuIntraAnimFrameCounter - wPikachuSpriteStateData1 + add hl, bc + ld a, [hl] + inc a + cp d + jr nz, .dont_reset + xor a +.dont_reset + ld [hli], a + ret nz + ld a, [hl] + inc a + and $3 + ld [hl], a + ret + +UpdatePikachuWalkingSprite: + ld a, [wPikachuOverworldStateFlags] + bit 3, a + jr nz, .uninitialized + ld hl, wPikachuSpriteImageBaseOffset - wPikachuSpriteStateData1 + add hl, bc + ld a, [hl] + dec a + swap a + ld d, a + ld a, [wd736] + bit 7, a + jr nz, .copy_player + ld hl, wPikachuFacingDirection - wPikachuSpriteStateData1 + add hl, bc + ld a, [hl] + or d + ld d, a + ld a, [wFontLoaded] + bit 0, a + jr z, .normal_get_sprite_index + call Func_fcae2 + ret c + jr .load_sprite_index + +.normal_get_sprite_index + ld hl, wPikachuAnimFrameCounter - wPikachuSpriteStateData1 + add hl, bc + ld a, d + or [hl] + ld d, a +.load_sprite_index + ld hl, wPikachuSpriteImageIdx - wPikachuSpriteStateData1 + add hl, bc + ld [hl], d + ret + +.uninitialized + ld hl, wPikachuSpriteImageIdx - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $ff + ret + +.copy_player + ld a, [wPlayerSpriteImageIdx] + and $f + or d + ld [wPikachuSpriteImageIdx], a + ret + +Func_fcae2: + ld hl, wPikachuMapY - wPikachuSpriteStateData1 + add hl, bc + ld a, [wYCoord] + add $4 + cp [hl] + jr nz, .on_screen + inc hl + ld a, [wXCoord] + add $4 + cp [hl] + jr nz, .on_screen + ld hl, wPikachuSpriteImageIdx - wPikachuSpriteStateData1 + add hl, bc + ld [hl], $ff + scf + ret + +.on_screen + and a + ret + +IsPikachuRightNextToPlayer: + push bc + push de + push hl + ld bc, wPikachuPictureID + ld a, [wXCoord] + add $4 + ld d, a + ld a, [wYCoord] + add $4 + ld e, a + ld hl, wPlayerMapY - wPlayerSpriteStateData1 + add hl, bc + ld a, [hl] + sub e + and a + jr z, .equal + cp $ff + jr z, .one_away + cp $1 + jr z, .one_away + jr .bad + +.one_away + ld hl, wPlayerMapX - wPlayerSpriteStateData1 + add hl, bc + ld a, [hl] + sub d + jr z, .good + jr .bad + +.equal + ld hl, wPlayerMapX - wPlayerSpriteStateData1 + add hl, bc + ld a, [hl] + sub d + cp $ff + jr z, .good + cp $1 + jr z, .good + and a + jr z, .good + jr .bad + +.good + pop hl + pop de + pop bc + scf + ret + +.bad + pop hl + pop de + pop bc + xor a + ret + +GetPikachuFacingDirectionAndReturnToE: + call GetPikachuFacingDirection + ld e, a + ret + +GetPikachuFacingDirection: + ld bc, wPikachuPictureID + ld a, [wXCoord] + add $4 + ld d, a + ld a, [wYCoord] + add $4 + ld e, a + ld hl, wPlayerMapY - wPlayerSpriteStateData1 + add hl, bc + ld a, [hl] + cp e + jr z, .asm_fcb71 + jr nc, .asm_fcb6e + ld a, SPRITE_FACING_UP + ret + +.asm_fcb6e + ld a, SPRITE_FACING_DOWN + ret + +.asm_fcb71 + ld hl, wPlayerMapX - wPlayerSpriteStateData1 + add hl, bc + ld a, [hl] + cp d + jr z, .asm_fcb81 + jr nc, .asm_fcb7e + ld a, SPRITE_FACING_LEFT + ret + +.asm_fcb7e + ld a, SPRITE_FACING_RIGHT + ret + +.asm_fcb81 + ld a, $ff ; standing + ret + +ClearPikachuFollowCommandBuffer: + push bc + ld hl, wPikachuFollowCommandBufferSize + ld [hl], $ff + inc hl + ld bc, $10 + xor a + call FillMemory + pop bc + ret + +AppendPikachuFollowCommandToBuffer: + ld hl, wPikachuFollowCommandBufferSize + inc [hl] + ld e, [hl] + ld d, 0 + ld hl, wPikachuFollowCommandBuffer + add hl, de + ld [hl], a + ret + +RefreshPikachuFollow: + call ClearPikachuFollowCommandBuffer + call ComputePikachuFollowCommand + ret c + call AppendPikachuFollowCommandToBuffer + ret + +ComputePikachuFollowCommand: + ld bc, wPikachuPictureID + ld hl, wPlayerMapY - wPlayerSpriteStateData1 + add hl, bc + ld a, [wYCoord] + add $4 + sub [hl] + jr z, .checkXCoord + jr c, .pikaAbovePlayer + call CheckAbsoluteValueLessThan2 + jr c, .return1 + ld a, $5 + and a + ret + +.return1 + ld a, $1 + and a + ret + +.pikaAbovePlayer + call CheckAbsoluteValueLessThan2 + jr c, .return2 + ld a, $6 + and a + ret + +.return2 + ld a, $2 + and a + ret + +.checkXCoord + ld hl, wPlayerMapX - wPlayerSpriteStateData1 + add hl, bc + ld a, [wXCoord] + add $4 + sub [hl] + jr z, .pikachuOnTopOfPlayer + jr c, .pikaToLeftOfPlayer + call CheckAbsoluteValueLessThan2 + jr c, .return4 + ld a, $8 + and a + ret + +.return4 + ld a, $4 + and a + ret + +.pikaToLeftOfPlayer + call CheckAbsoluteValueLessThan2 + jr c, .return3 + ld a, $7 + and a + ret + +.return3 + ld a, $3 + and a + ret + +.pikachuOnTopOfPlayer + scf + ret + +CheckAbsoluteValueLessThan2: + jr nc, .positive + cpl + inc a +.positive + cp $2 + ret + +Func_fcc08:: + call Func_fcc23 + ret nc + ld a, [wd736] + bit 6, a + jr nz, .asm_fcc1b + call Func_fcc42 + ret c + call AppendPikachuFollowCommandToBuffer + ret + +.asm_fcc1b + call Func_fcc64 + ret c + call AppendPikachuFollowCommandToBuffer + ret + +Func_fcc23: + ld a, [wPikachuOverworldStateFlags] + bit 5, a + jr nz, .asm_fcc40 + ld a, [wPikachuOverworldStateFlags] + bit 7, a + jr nz, .asm_fcc40 + ld a, [wd472] + bit 7, a + jr z, .asm_fcc40 + ld a, [wWalkBikeSurfState] + and a + jr nz, .asm_fcc40 + scf + ret + +.asm_fcc40 + and a + ret + +Func_fcc42: + xor a + ld a, [wPlayerDirection] + bit 3, a + jr nz, .asm_fcc58 + bit 2, a + jr nz, .asm_fcc5b + bit 1, a + jr nz, .asm_fcc5e + bit 0, a + jr nz, .asm_fcc61 + scf + ret + +.asm_fcc58 + ld a, $2 + ret + +.asm_fcc5b + ld a, $1 + ret + +.asm_fcc5e + ld a, $3 + ret + +.asm_fcc61 + ld a, $4 + ret + +Func_fcc64: + ld hl, wPikachuOverworldStateFlags + bit 6, [hl] + jr z, .asm_fcc6e + res 6, [hl] + ret + +.asm_fcc6e + set 6, [hl] + xor a + ld a, [wPlayerDirection] + bit 3, a + jr nz, .asm_fcc86 + bit 2, a + jr nz, .asm_fcc89 + bit 1, a + jr nz, .asm_fcc8c + bit 0, a + jr nz, .asm_fcc8f + scf + ret + +.asm_fcc86 + ld a, $6 + ret + +.asm_fcc89 + ld a, $5 + ret + +.asm_fcc8c + ld a, $7 + ret + +.asm_fcc8f + ld a, $8 + ret + +Func_fcc92: + ld hl, wPikachuFollowCommandBufferSize + ld a, [hl] + cp $ff + jr z, .asm_fccb0 + and a + jr z, .asm_fccb0 + dec [hl] + ld e, a + ld d, 0 + ld hl, wPikachuFollowCommandBuffer + add hl, de + inc e + ld a, $ff +.asm_fcca8 + ld d, [hl] + ldd [hl], a + ld a, d + dec e + jr nz, .asm_fcca8 + and a + ret + +.asm_fccb0 + scf + ret + +ComputePikachuFacingDirection:: + call GetPikachuFollowCommandIfBufferSizeNonzero + and a + jr z, .check_y + dec a + and $3 + add a + add a + jr .load + +.check_y + ld a, [wYCoord] + add $4 + ld d, a + ld a, [wXCoord] + add $4 + ld e, a + ld a, [wPikachuMapY] + cp d + jr z, .check_x + ld a, SPRITE_FACING_DOWN + jr c, .load + ld a, SPRITE_FACING_UP + jr .load + +.check_x + ld a, [wPikachuMapX] + cp e + jr z, .copy_from_player + ld a, SPRITE_FACING_RIGHT + jr c, .load + ld a, SPRITE_FACING_LEFT + jr .load + +.copy_from_player + ld a, [wPlayerFacingDirection] +.load + ld [wPikachuFacingDirection], a + ret + +GetPikachuFollowCommand: + ld hl, wPikachuFollowCommandBufferSize + ld a, [hl] + cp $ff + jr z, .asm_fccff + ld e, a + ld d, 0 + ld hl, wPikachuFollowCommandBuffer + add hl, de + ld a, [hl] + ret + +.asm_fccff + xor a + ret + +GetPikachuFollowCommandIfBufferSizeNonzero: + ld hl, wPikachuFollowCommandBufferSize + ld a, [hl] + cp $ff + jr z, .default + and a + jr z, .default + ld e, a + ld d, 0 + ld hl, wPikachuFollowCommandBuffer + add hl, de + ld a, [hl] + ret + +.default + xor a + ret + +AreThereAtLeastTwoStepsInPikachuFollowCommandBuffer: + ld a, [wPikachuFollowCommandBufferSize] + cp $ff + ret z + cp $2 + jr nc, .set_carry + and a + ret + +.set_carry + scf + ret + +WillPikachuSpawnOnTheScreen: + ld h, wSpriteStateData2 / $100 + ld a, [H_CURRENTSPRITEOFFSET] ; If we're here, this can only be $f0 + add wPikachuMapY - wPikachuSpriteStateData2 + ld l, a + ld b, [hl] + ld a, [wYCoord] + cp b + jr z, .same_y + jr nc, .not_on_screen + add (SCREEN_HEIGHT / 2) - 1 + cp b + jr c, .not_on_screen +.same_y + inc l + ld b, [hl] + ld a, [wXCoord] + cp b + jr z, .same_x + jr nc, .not_on_screen + add (SCREEN_WIDTH / 2) - 1 + cp b + jr c, .not_on_screen +.same_x + call .GetNPCCurrentTile + ld d, $60 + ld a, [hli] + ld e, a + cp d + jr nc, .not_on_screen + ld a, [hld] + cp d + jr nc, .not_on_screen + ld bc, -20 + add hl, bc + ld a, [hli] + cp d + jr nc, .not_on_screen + ld a, [hl] + cp d + jr c, .on_screen +.not_on_screen + ld h, wSpriteStateData1 / $100 + ld a, [H_CURRENTSPRITEOFFSET] + add wPikachuSpriteImageIdx - wPikachuSpriteStateData1 + ld l, a + ld [hl], $ff + scf + jr .return + +.on_screen + ld h, wSpriteStateData2 / $100 + ld a, [H_CURRENTSPRITEOFFSET] + add wPikachuGrassPriority - wPikachuSpriteStateData2 + ld l, a + ld a, [wGrassTile] + cp e + ld a, $0 + jr nz, .priority + ld a, $80 +.priority + ld [hl], a + and a +.return + ret + +.GetNPCCurrentTile: + ld h, wSpriteStateData1 / $100 + ld a, [H_CURRENTSPRITEOFFSET] + add wPikachuYPixels - wPikachuSpriteStateData1 + ld l, a + ld a, [hli] + add $4 + and $f0 + srl a + ld c, a + ld b, $0 + inc l + ld a, [hl] + add $2 + srl a + srl a + srl a + add SCREEN_WIDTH + ld d, 0 + ld e, a + ld hl, wTileMap + rept 5 + add hl, bc + endr + add hl, de + ret + +ComparePikachuHappinessTo80: +; preserves a and bc + push bc + push af + ld a, [wPikachuHappiness] + cp 80 + pop bc + ld a, b + pop bc + ret diff --git a/engine/pikachu_movement.asm b/engine/pikachu_movement.asm new file mode 100755 index 00000000..8eb09b3b --- /dev/null +++ b/engine/pikachu_movement.asm @@ -0,0 +1,1048 @@ +ApplyPikachuMovementData_:: + ld a, b + ld [wPikachuMovementScriptBank], a + ld a, l + ld [wPikachuMovementScriptAddress], a + ld a, h + ld [wPikachuMovementScriptAddress + 1], a + call .SwapSpriteStateData +.loop + call LoadPikachuMovementCommandData + jr nc, .done + call ExecutePikachuMovementCommand + jr .loop + +.done + call .SwapSpriteStateData + call DelayFrame + ret + +.SwapSpriteStateData: + ld a, [wUpdateSpritesEnabled] + push af + ld a, $ff + ld [wUpdateSpritesEnabled], a + push hl + push de + push bc + + ld hl, wPlayerSpriteStateData1 + ld de, wPikachuSpriteStateData1 + ld c, $10 + call .SwapBytes + + ld hl, wPlayerSpriteStateData2 + ld de, wPikachuSpriteStateData2 + ld c, $10 + call .SwapBytes + + pop bc + pop de + pop hl + pop af + ld [wUpdateSpritesEnabled], a + ret + +.SwapBytes: + ld b, [hl] + ld a, [de] + ld [hli], a + ld a, b + ld [de], a + inc de + dec c + jr nz, .SwapBytes + ret + +LoadPikachuMovementCommandData: + call GetPikachuMovementScriptByte + cp $3f + ret z + ld c, a + ld b, 0 + ld hl, PikachuMovementDatabase + add hl, bc + add hl, bc + add hl, bc + add hl, bc + ld a, [hli] + ld [wCurPikaMovementFunc1], a + ld a, [hli] + cp $80 + jr nz, .no_param + call GetPikachuMovementScriptByte +.no_param + ld [wCurPikaMovementParam1], a + ld a, [hli] + ld [wCurPikaMovementFunc2], a + ld a, [hli] + cp $80 + jr nz, .no_param2 + call GetPikachuMovementScriptByte +.no_param2 + ld [wCurPikaMovementParam2], a + xor a + ld [wd451], a + scf + ret + +ExecutePikachuMovementCommand: + xor a + ld [wPikachuMovementFlags], a + ld [wPikachuStepTimer], a + ld [wPikachuStepSubtimer], a + ld a, [wPlayerGrassPriority] + push af +.loop + ld bc, wPlayerSpriteStateData1 ; Currently holds Pikachu's sprite state data + ld a, [wCurPikaMovementFunc1] + ld hl, PikaMovementFunc1Jumptable + call .JumpTable + ld a, [wCurPikaMovementFunc2] + ld hl, PikaMovementFunc2Jumptable + call .JumpTable + call GetCoordsForPikachuShadow + call AnimatePikachuShadow + call DelayFrame + call DelayFrame + ld hl, wPikachuMovementFlags + bit 7, [hl] + jr z, .loop + pop af + ld [wPlayerGrassPriority], a + scf + ret + +.JumpTable: + ld e, a + ld d, 0 + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] + +GetCoordsForPikachuShadow: + ld hl, wPlayerSpriteImageIdx - wPlayerSpriteStateData1 + add hl, bc + ld a, [wCurPikaMovementSpriteImageIdx] + ld [hl], a + ld a, [wPikaSpriteY] + ld d, a + ld a, [wPikachuMovementYOffset] + add d + ld hl, wPlayerYPixels - wPlayerSpriteStateData1 + add hl, bc + ld [hl], a + ld a, [wPikaSpriteX] + ld d, a + ld a, [wPikachuMovementXOffset] + add d + ld hl, wPlayerXPixels - wPlayerSpriteStateData1 + add hl, bc + ld [hl], a + ld hl, wPikachuMovementFlags + bit 6, [hl] + ret z + ld hl, wPlayerGrassPriority - wPlayerSpriteStateData1 + add hl, bc + ld [hl], 0 + ret + +AnimatePikachuShadow: + ld hl, wPikachuMovementFlags + bit 6, [hl] + res 6, [hl] + ld hl, wd736 + res 6, [hl] + ret z + set 6, [hl] + call LoadPikachuShadowOAMData + ret + +PikachuMovementDatabase: + db $01, 1 - 1, $00, 1 - 1 ; $00 start + + db $03, $80, $01, 1 - 1 ; $01 + db $04, $80, $01, 1 - 1 ; $02 + db $05, $80, $01, 1 - 1 ; $03 + db $06, $80, $01, 1 - 1 ; $04 + db $07, $80, $01, 1 - 1 ; $05 + db $08, $80, $01, 1 - 1 ; $06 + db $09, $80, $01, 1 - 1 ; $07 + db $0a, $80, $01, 1 - 1 ; $08 + + db $03, $80, $06, 1 - 1 ; $09 + db $04, $80, $06, 1 - 1 ; $0a + db $05, $80, $06, 1 - 1 ; $0b + db $06, $80, $06, 1 - 1 ; $0c + db $07, $80, $06, 1 - 1 ; $0d + db $08, $80, $06, 1 - 1 ; $0e + db $09, $80, $06, 1 - 1 ; $0f + db $0a, $80, $06, 1 - 1 ; $10 + + db $03, $80, $03, $80 ; $11 + db $04, $80, $03, $80 ; $12 + db $05, $80, $03, $80 ; $13 + db $06, $80, $03, $80 ; $14 + db $07, $80, $03, $80 ; $15 + db $08, $80, $03, $80 ; $16 + db $09, $80, $03, $80 ; $17 + db $0a, $80, $03, $80 ; $18 + + db $03, $80, $07, $80 ; $19 + db $04, $80, $07, $80 ; $1a + db $05, $80, $07, $80 ; $1b + db $06, $80, $07, $80 ; $1c + + db $0b, (1 << 5) | 8 - 1, $02, 1 - 1 ; $1d step down + db $0c, (1 << 5) | 8 - 1, $02, 1 - 1 ; $1e step up + db $0d, (1 << 5) | 8 - 1, $02, 1 - 1 ; $1f step left + db $0e, (1 << 5) | 8 - 1, $02, 1 - 1 ; $20 step right + db $0f, (1 << 5) | 8 - 1, $02, 1 - 1 ; $21 step down left + db $10, (1 << 5) | 8 - 1, $02, 1 - 1 ; $22 step down right + db $11, (1 << 5) | 8 - 1, $02, 1 - 1 ; $23 step up left + db $12, (1 << 5) | 8 - 1, $02, 1 - 1 ; $24 step up right + + db $0b, 16 - 1, $02, 1 - 1 ; $25 slide down + db $0c, 16 - 1, $02, 1 - 1 ; $26 slide up + db $0d, 16 - 1, $02, 1 - 1 ; $27 slide left + db $0e, 16 - 1, $02, 1 - 1 ; $28 slide right + db $0f, 16 - 1, $02, 1 - 1 ; $29 slide down left + db $10, 16 - 1, $02, 1 - 1 ; $2a slide down right + db $11, 16 - 1, $02, 1 - 1 ; $2b slide up left + db $12, 16 - 1, $02, 1 - 1 ; $2c slide up right + + db $0b, 16 - 1, $08, (1 << 4) | 8 - 1 ; $2d hop down + db $0c, 16 - 1, $08, (1 << 4) | 8 - 1 ; $2e hop up + db $0d, 16 - 1, $08, (1 << 4) | 8 - 1 ; $2f hop left + db $0e, 16 - 1, $08, (1 << 4) | 8 - 1 ; $30 hop right + db $0f, 16 - 1, $08, (1 << 4) | 8 - 1 ; $31 hop down left + db $10, 16 - 1, $08, (1 << 4) | 8 - 1 ; $32 hop down right + db $11, 16 - 1, $08, (1 << 4) | 8 - 1 ; $33 hop up left + db $12, 16 - 1, $08, (1 << 4) | 8 - 1 ; $34 hop up right + + db $13, 16 - 1, $06, 1 - 1 ; $35 look down + db $14, 16 - 1, $06, 1 - 1 ; $36 look up + db $15, 16 - 1, $06, 1 - 1 ; $37 look left + db $16, 16 - 1, $06, 1 - 1 ; $38 look right + + db $02, $80, $04, 1 - 1 ; $39 + db $02, $80, $05, 1 - 1 ; $3a + db $02, $80, $03, $80 ; $3b + db $02, $80, $07, $80 ; $3c + db $02, $80, $09, $80 ; $3d + db $02, $80, $06, 1 - 1 ; $3e + +PikaMovementFunc1Jumptable: + dw PikaMovementFunc1_EndCommand_ ; 00 + dw PikaMovementFunc1_LoadPikachuCurrentPosition ; 01 + dw PikaMovementFunc1_DelayFrames ; 02 + dw PikaMovementFunc1_WalkInCurrentFacingDirection ; 03 + dw PikaMovementFunc1_WalkInOppositeFacingDirection ; 04 + dw PikaMovementFunc1_StepTurningCounterclockwise ; 05 + dw PikaMovementFunc1_StepTurningClockwise ; 06 + dw PikaMovementFunc1_StepForwardLeft ; 07 + dw PikaMovementFunc1_StepForwardRight ; 08 + dw PikaMovementFunc1_StepBackwardLeft ; 09 + dw PikaMovementFunc1_StepBackwardRight ; 0a + dw PikaMovementFunc1_MoveDown ; 0b + dw PikaMovementFunc1_MoveUp ; 0c + dw PikaMovementFunc1_MoveLeft ; 0d + dw PikaMovementFunc1_MoveRight ; 0e + dw PikaMovementFunc1_MoveDownLeft ; 0f + dw PikaMovementFunc1_MoveDownRight ; 10 + dw PikaMovementFunc1_MoveUpLeft ; 11 + dw PikaMovementFunc1_MoveUpRight ; 12 + dw PikaMovementFunc1_LookDown ; 13 + dw PikaMovementFunc1_LookUp ; 14 + dw PikaMovementFunc1_LookLeft ; 15 + dw PikaMovementFunc1_LookRight ; 16 + dw PikaMovementFunc1_EndCommand_ ; 17 + +PikaMovementFunc1_EndCommand: + ld a, [wPikachuMovementFlags] + set 7, a + ld [wPikachuMovementFlags], a + ret + +PikaMovementFunc1_EndCommand_: + call PikaMovementFunc1_EndCommand + ret + +PikaMovementFunc1_LoadPikachuCurrentPosition: + ld hl, wPlayerYPixels - wPlayerSpriteStateData1 + add hl, bc + ld a, [hl] + ld [wPikaSpriteY], a + ld hl, wPlayerXPixels - wPlayerSpriteStateData1 + add hl, bc + ld a, [hl] + ld [wPikaSpriteX], a + xor a + ld [wPikachuMovementYOffset], a + ld [wPikachuMovementXOffset], a + call PikaMovementFunc1_EndCommand + ret + +PikaMovementFunc1_DelayFrames: + call CheckPikachuStepTimer1 + ret nz + call PikaMovementFunc1_EndCommand + ret + +PikaMovementFunc1_WalkInCurrentFacingDirection: + call GetPikachuFacing + jr PikaMovementFunc1_ApplyStepVector + +PikaMovementFunc1_WalkInOppositeFacingDirection: + call GetPikachuFacing + xor %100 + jr PikaMovementFunc1_ApplyStepVector + +PikaMovementFunc1_StepTurningCounterclockwise: + call GetPikachuFacing + ld hl, .Data + call PikaMovementFunc1_GetNextFacing + jr PikaMovementFunc1_ApplyStepVector + +.Data: + db SPRITE_FACING_DOWN, PIKASTEPDIR_RIGHT << 2 + db SPRITE_FACING_UP, PIKASTEPDIR_LEFT << 2 + db SPRITE_FACING_LEFT, PIKASTEPDIR_DOWN << 2 + db SPRITE_FACING_RIGHT, PIKASTEPDIR_UP << 2 + db $ff + +PikaMovementFunc1_StepTurningClockwise: + call GetPikachuFacing + ld hl, .Data + call PikaMovementFunc1_GetNextFacing + jr PikaMovementFunc1_ApplyStepVector + +.Data: + db SPRITE_FACING_DOWN, PIKASTEPDIR_LEFT << 2 + db SPRITE_FACING_UP, PIKASTEPDIR_RIGHT << 2 + db SPRITE_FACING_LEFT, PIKASTEPDIR_UP << 2 + db SPRITE_FACING_RIGHT, PIKASTEPDIR_DOWN << 2 + db $ff + +PikaMovementFunc1_StepForwardLeft: + call GetPikachuFacing + ld hl, .Data + call PikaMovementFunc1_GetNextFacing + jr PikaMovementFunc1_ApplyStepVector + +.Data: + db SPRITE_FACING_DOWN, PIKASTEPDIR_DOWN_RIGHT << 2 + db SPRITE_FACING_UP, PIKASTEPDIR_UP_LEFT << 2 + db SPRITE_FACING_LEFT, PIKASTEPDIR_DOWN_LEFT << 2 + db SPRITE_FACING_RIGHT, PIKASTEPDIR_UP_RIGHT << 2 + +PikaMovementFunc1_StepForwardRight: + call GetPikachuFacing + ld hl, .Data + call PikaMovementFunc1_GetNextFacing + jr PikaMovementFunc1_ApplyStepVector + +.Data: + db SPRITE_FACING_DOWN, PIKASTEPDIR_DOWN_LEFT << 2 + db SPRITE_FACING_UP, PIKASTEPDIR_UP_RIGHT << 2 + db SPRITE_FACING_LEFT, PIKASTEPDIR_UP_LEFT << 2 + db SPRITE_FACING_RIGHT, PIKASTEPDIR_DOWN_RIGHT << 2 + +PikaMovementFunc1_StepBackwardLeft: + call GetPikachuFacing + ld hl, .Data + call PikaMovementFunc1_GetNextFacing + jr PikaMovementFunc1_ApplyStepVector + +.Data: + db SPRITE_FACING_DOWN, PIKASTEPDIR_UP_RIGHT << 2 + db SPRITE_FACING_UP, PIKASTEPDIR_DOWN_LEFT << 2 + db SPRITE_FACING_LEFT, PIKASTEPDIR_DOWN_RIGHT << 2 + db SPRITE_FACING_RIGHT, PIKASTEPDIR_UP_LEFT << 2 + +PikaMovementFunc1_StepBackwardRight: + call GetPikachuFacing + ld hl, .Data + call PikaMovementFunc1_GetNextFacing + jr PikaMovementFunc1_ApplyStepVector + +.Data: + db SPRITE_FACING_DOWN, PIKASTEPDIR_UP_LEFT << 2 + db SPRITE_FACING_UP, PIKASTEPDIR_DOWN_RIGHT << 2 + db SPRITE_FACING_LEFT, PIKASTEPDIR_UP_RIGHT << 2 + db SPRITE_FACING_RIGHT, PIKASTEPDIR_DOWN_LEFT << 2 + +PikaMovementFunc1_ApplyStepVector: + rrca + rrca + and $7 + ld e, a + call GetPikachuStepVectorMagnitude + ld d, a + call UpdatePikachuPosition + call CheckPikachuStepTimer1 + ret nz + call PikaMovementFunc1_EndCommand + ret + +PikaMovementFunc1_GetNextFacing: + push de + ld d, a +.loop + ld a, [hli] + cp d + jr z, .found + inc hl + cp $ff + jr nz, .loop + pop de + ret + +.found + ld a, [hl] + pop de + scf + ret + +PikaMovementFunc1_MoveDown: + ld a, PIKASTEPDIR_DOWN + jr PikaMovementFunc1_ApplyFacingAndMove + +PikaMovementFunc1_MoveUp: + ld a, PIKASTEPDIR_UP + jr PikaMovementFunc1_ApplyFacingAndMove + +PikaMovementFunc1_MoveLeft: + ld a, PIKASTEPDIR_LEFT + jr PikaMovementFunc1_ApplyFacingAndMove + +PikaMovementFunc1_MoveRight: + ld a, PIKASTEPDIR_RIGHT + jr PikaMovementFunc1_ApplyFacingAndMove + +PikaMovementFunc1_MoveDownLeft: + ld e, PIKASTEPDIR_DOWN_LEFT + jr PikaMovementFunc1_MoveDiagonally + +PikaMovementFunc1_MoveDownRight: + ld e, PIKASTEPDIR_DOWN_RIGHT + jr PikaMovementFunc1_MoveDiagonally + +PikaMovementFunc1_MoveUpLeft: + ld e, PIKASTEPDIR_UP_LEFT + jr PikaMovementFunc1_MoveDiagonally + +PikaMovementFunc1_MoveUpRight: + ld e, PIKASTEPDIR_UP_RIGHT + jr PikaMovementFunc1_MoveDiagonally + +PikaMovementFunc1_ApplyFacingAndMove: + ld e, a + call SetPikachuFacing +PikaMovementFunc1_MoveDiagonally: + call GetPikachuStepVectorMagnitude + ld d, a + push de + call UpdatePikachuPosition + pop de + call CheckPikachuStepTimer1 + ret nz + ld a, e + call ApplyPikachuStepVector + call PikaMovementFunc1_EndCommand + ret + +PikaMovementFunc1_LookDown: + ld a, PIKASTEPDIR_DOWN + jr PikaMovementFunc1_ApplyFacing + +PikaMovementFunc1_LookUp: + ld a, PIKASTEPDIR_UP + jr PikaMovementFunc1_ApplyFacing + +PikaMovementFunc1_LookLeft: + ld a, PIKASTEPDIR_LEFT + jr PikaMovementFunc1_ApplyFacing + +PikaMovementFunc1_LookRight: + ld a, PIKASTEPDIR_RIGHT + jr PikaMovementFunc1_ApplyFacing + +PikaMovementFunc1_ApplyFacing: + call SetPikachuFacing + call PikaMovementFunc1_EndCommand + ret + +UpdatePikachuPosition: + push de + ld d, 0 + ld hl, .Jumptable + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + pop de + ld a, d + jp [hl] + +.Jumptable: + dw .Down + dw .Up + dw .Left + dw .Right + dw .DownLeft + dw .DownRight + dw .UpLeft + dw .UpRight + +.Down: + ld d, 0 + ld e, a + jr .ApplyVector + +.Up: + ld d, 0 + cpl + inc a + ld e, a + jr .ApplyVector + +.Left: + cpl + inc a + ld d, a + ld e, 0 + jr .ApplyVector + +.Right: + ld d, a + ld e, 0 + jr .ApplyVector + +.DownLeft: + ld e, a + cpl + inc a + ld d, a + jr .ApplyVector + +.DownRight: + ld e, a + ld d, a + jr .ApplyVector + +.UpLeft: + cpl + inc a + ld e, a + ld d, a + jr .ApplyVector + +.UpRight: + ld d, a + cpl + inc a + ld e, a + jr .ApplyVector + +.ApplyVector: + ld a, [wPikaSpriteX] + add d + ld [wPikaSpriteX], a + ld a, [wPikaSpriteY] + add e + ld [wPikaSpriteY], a + ret + +PikaMovementFunc2Jumptable: + dw PikaMovementFunc2_ResetFrameCounterAndFaceCurrent ; 0 + dw PikaMovementFunc2_UpdateSpriteImageIdxWithPreviousImageIdxDirection ; 1 + dw PikaMovementFunc2_UpdateSpriteImageIdxWithFacing ; 2 + dw PikaMovementFunc2_TurnParameter ; 3 + dw PikaMovementFunc2_TurnClockwise ; 4 + dw PikaMovementFunc2_TurnCounterClockwise ; 5 + dw PikaMovementFunc2_CopySpriteImageIdxDirectionToSpriteImageIdx ; 6 + dw PikaMovementFunc2_UpdateJumpWithPreviousImageIdxDirection ; 7 + dw PikaMovementFunc2_UpdateJumpWithFacing ; 8 + dw PikaMovementFunc2_CopyFacingToJump ; 9 + dw PikaMovementFunc2_nop ; 10 + +PikaMovement_SetSpawnShadow: + ld hl, wPikachuMovementFlags + set 6, [hl] + ret + +PikaMovementFunc2_ResetFrameCounterAndFaceCurrent: + ld hl, wPlayerIntraAnimFrameCounter - wPlayerSpriteStateData1 + add hl, bc + xor a + ld [hli], a + ld [hl], a + call PikaMovementFunc2_GetImageBaseOffset + ld d, a + call GetPikachuFacing + or d + ld [wCurPikaMovementSpriteImageIdx], a + ret + +PikaMovementFunc2_nop: + ret + +PikaMovementFunc2_CopySpriteImageIdxDirectionToSpriteImageIdx: + call PikaMovementFunc2_GetImageBaseOffset + ld d, a + call PikaMovementFunc2_GetSpriteImageIdxDirection + or d + ld [wCurPikaMovementSpriteImageIdx], a + ret + +PikaMovementFunc2_UpdateSpriteImageIdxWithFacing: + call PikaMovementFunc2_GetImageBaseOffset + ld d, a + call GetPikachuFacing + or d + ld d, a + jr PikaMovementFunc2_UpdateSpriteImageIdx + +PikaMovementFunc2_UpdateSpriteImageIdxWithPreviousImageIdxDirection: + call PikaMovementFunc2_GetImageBaseOffset + ld d, a + call PikaMovementFunc2_GetSpriteImageIdxDirection + or d + ld d, a +PikaMovementFunc2_UpdateSpriteImageIdx: + ld hl, wPlayerAnimFrameCounter - wPlayerSpriteStateData1 + add hl, bc + call CheckPikachuStepTimer2 ; does not preserve hl + jr nz, .skip + inc [hl] +.skip + ld a, [hl] + rrca + rrca + and 3 + or d + ld [wCurPikaMovementSpriteImageIdx], a + ret + +PikaMovementFunc2_UpdateJumpWithFacing: + call GetPikachuFacing + ld d, a + jr PikaMovementFunc2_UpdateJump + +PikaMovementFunc2_UpdateJumpWithPreviousImageIdxDirection: + call PikaMovementFunc2_GetSpriteImageIdxDirection + ld d, a +PikaMovementFunc2_UpdateJump: + call PikaMovementFunc2_GetImageBaseOffset + or d + ld d, a + call PikaMovementFunc2_Timer + or d + ld [wCurPikaMovementSpriteImageIdx], a + call PikaMovementFunc_Sine + ld [wPikachuMovementYOffset], a + and a + ret z + call PikaMovement_SetSpawnShadow + ret + +PikaMovementFunc2_CopyFacingToJump: + call GetPikachuFacing + ld d, a + call PikaMovementFunc2_GetImageBaseOffset + or d + ld [wCurPikaMovementSpriteImageIdx], a + call PikaMovementFunc_Sine + ld [wPikachuMovementYOffset], a + ret + +PikaMovementFunc2_TurnParameter: + ld a, [wCurPikaMovementParam2] + and $40 + cp $40 + jr z, PikaMovementFunc2_TurnClockwise + jr PikaMovementFunc2_TurnCounterClockwise + +PikaMovementFunc2_TurnClockwise: + call PikaMovementFunc2_GetSpriteImageIdxDirection + ld d, a + call CheckPikachuStepTimer2 + jr nz, .skip + ld hl, Data_fd731 +.loop + ld a, [hli] + cp d + jr nz, .loop + ld d, [hl] +.skip + call PikaMovementFunc2_GetImageBaseOffset + or d + ld [wCurPikaMovementSpriteImageIdx], a + ret + +PikaMovementFunc2_TurnCounterClockwise: + call PikaMovementFunc2_GetSpriteImageIdxDirection + ld d, a + call CheckPikachuStepTimer2 + jr nz, .skip + ld hl, Data_fd731End +.loop + ld a, [hld] + cp d + jr nz, .loop + ld d, [hl] +.skip + call PikaMovementFunc2_GetImageBaseOffset + or d + ld [wCurPikaMovementSpriteImageIdx], a + ret + +Data_fd731: + db SPRITE_FACING_DOWN + db SPRITE_FACING_LEFT + db SPRITE_FACING_UP + db SPRITE_FACING_RIGHT + db SPRITE_FACING_DOWN +Data_fd731End: + +PikaMovementFunc2_Timer: + push hl + ld hl, wPlayerIntraAnimFrameCounter - wPlayerSpriteStateData1 + add hl, bc + ld a, [hl] + inc a + and $3 + ld [hli], a + jr nz, .load_pop + ld a, [hl] + inc a + and $3 + ld [hl], a +.load_pop + ld a, [hl] + pop hl + ret + +PikaMovementFunc2_GetImageBaseOffset: + push hl + ld hl, wPlayerSpriteImageBaseOffset - wPlayerSpriteStateData1 + add hl, bc + ld a, [hl] + dec a + swap a + pop hl + ret + +PikaMovementFunc2_GetSpriteImageIdxDirection: + push hl + ld hl, wPlayerSpriteImageIdx - wPlayerSpriteStateData1 + add hl, bc + ld a, [hl] + and $c + pop hl + ret + +GetPikachuFacing: + push hl + ld hl, wPlayerFacingDirection - wPlayerSpriteStateData1 + add hl, bc + ld a, [hl] + and $c + pop hl + ret + +SetPikachuFacing: + push hl + ld hl, wPlayerFacingDirection - wPlayerSpriteStateData1 + add hl, bc + add a + add a + and $c + ld [hl], a + pop hl + ret + +CheckPikachuStepTimer1: + ld hl, wPikachuStepTimer + inc [hl] + ld a, [wCurPikaMovementParam1] + and $1f + inc a + cp [hl] + ret nz + ld [hl], 0 + ret + +GetPikachuStepVectorMagnitude: + ; *XX***** + ld a, [wCurPikaMovementParam1] + swap a + rrca + and $3 + inc a + ret + +CheckPikachuStepTimer2: + ld hl, wPikachuStepSubtimer + inc [hl] + ld a, [wCurPikaMovementParam2] + and $f + inc a + cp [hl] + ret nz + ld [hl], 0 + ret + +PikaMovementFunc_Sine: + call .GetArgument + ld a, [wPikachuStepSubtimer] + add e + ld [wPikachuStepSubtimer], a + add $20 + ld e, a + push hl + push bc + call Sine_e + pop bc + pop hl + ret + +.GetArgument: + ld a, [wCurPikaMovementParam2] + and $f + inc a + ld d, a + ld a, [wCurPikaMovementParam2] + swap a + and $7 + ld e, a + ld a, 1 + jr z, .okay +.loop + add a + dec e + jr nz, .loop +.okay + ld e, a + ret + +ApplyPikachuStepVector: + push bc + ld c, a + ld b, 0 + ld hl, .StepVectors + add hl, bc + add hl, bc + ld d, [hl] + inc hl + ld e, [hl] + pop bc + ld hl, wPlayerMapY - wPlayerSpriteStateData1 + add hl, bc + ld a, [hl] + add e + ld [hli], a + ld a, [hl] + add d + ld [hl], a + ret + +.StepVectors: + db 0, 1 + db 0, -1 + db -1, 0 + db 1, 0 + db -1, 1 + db 1, 1 + db -1, -1 + db 1, -1 + +LoadPikachuShadowOAMData: + push bc + push de + push hl + + ld bc, wOAMBuffer + 4 * 36 + ld a, [wPikaSpriteY] + ld e, a + ld a, [wPikaSpriteX] + ld d, a + ld hl, .OAMData + call .LoadOAMData + + pop hl + pop de + pop bc + ret + +.OAMData: + db 2 + db $0c, $00, $ff, 0 + db $0c, $08, $ff, 1 << OAM_X_FLIP + +.LoadOAMData: + ld a, e + add $10 + ld e, a + ld a, d + add $8 + ld d, a + ld a, [hli] +.loop + push af + ld a, [hli] + add e + ld [bc], a + inc bc + ld a, [hli] + add d + ld [bc], a + inc bc + ld a, [hli] + ld [bc], a + inc bc + ld a, [hli] + ld [bc], a + inc bc + pop af + dec a + jr nz, .loop + ret + +LoadPikachuShadowIntoVRAM: + ld hl, vNPCSprites2 + $7f * $10 + ld de, LedgeHoppingShadowGFX_3F + lb bc, BANK(LedgeHoppingShadowGFX_3F), (LedgeHoppingShadowGFX_3FEnd - LedgeHoppingShadowGFX_3F) / 8 + jp CopyVideoDataDoubleAlternate + +LedgeHoppingShadowGFX_3F: +INCBIN "gfx/ledge_hopping_shadow.1bpp" +LedgeHoppingShadowGFX_3FEnd: + +LoadPikachuBallIconIntoVRAM: + ld hl, vNPCSprites2 + $7e * $10 + ld de, GFX_fd86b + lb bc, BANK(GFX_fd86b), 1 + jp CopyVideoDataDoubleAlternate + +Func_fd851: + ld hl, vNPCSprites + $c * $10 + ld a, 3 +.loop + push af + push hl + ld de, GFX_fd86b + lb bc, BANK(GFX_fd86b), 4 + call CopyVideoDataAlternate + pop hl + ld de, 4 * $10 + add hl, de + pop af + dec a + jr nz, .loop + ret + +GFX_fd86b: +INCBIN "gfx/unknown_fd86b.2bpp" + +LoadPikachuSpriteIntoVRAM: + ld de, PikachuSprite + lb bc, BANK(PikachuSprite), (SandshrewSprite - PikachuSprite) / 32 + ld hl, vNPCSprites + $c * $10 + push bc + call CopyVideoDataAlternate + ld de, PikachuSprite + $c * $10 + ld hl, vNPCSprites2 + $c * $10 + ld a, [h_0xFFFC] + and a + jr z, .load + ld de, PikachuSprite + $c * $10 + ld hl, vNPCSprites2 + $4c * $10 +.load + pop bc + call CopyVideoDataAlternate + call LoadPikachuShadowIntoVRAM + call LoadPikachuBallIconIntoVRAM + ret + +PikachuPewterPokecenterCheck: + ld a, [wCurMap] + cp PEWTER_POKECENTER + ret nz + call EnablePikachuFollowingPlayer + call StarterPikachuEmotionCommand_turnawayfromplayer + ret + +PikachuFanClubCheck: + ld a, [wCurMap] + cp POKEMON_FAN_CLUB + ret nz + call EnablePikachuFollowingPlayer + call StarterPikachuEmotionCommand_turnawayfromplayer + ret + +PikachuBillsHouseCheck: + ld a, [wCurMap] + cp BILLS_HOUSE + ret nz + call EnablePikachuFollowingPlayer + ret + +Pikachu_LoadCurrentMapViewUpdateSpritesAndDelay3: + call LoadCurrentMapView + call UpdateSprites + call Delay3 + ret + +Cosine_e: ; cosine? + ld a, e + add $10 + jr asm_fd908 + +Sine_e: ; sine? + ld a, e +asm_fd908 + and $3f + cp $20 + jr nc, .asm_fd913 + call GetSine + ld a, h + ret + +.asm_fd913 + and $1f + call GetSine + ld a, h + cpl + inc a + ret + +GetSine: + ld e, a + ld a, d + ld d, 0 + ld hl, SineWave_3f + add hl, de + add hl, de + ld e, [hl] + inc hl + ld d, [hl] + ld hl, 0 +.asm_fd92b + srl a + jr nc, .asm_fd930 + add hl, de +.asm_fd930 + sla e + rl d + and a + jr nz, .asm_fd92b + ret + +SineWave_3f: + sine_wave $100 diff --git a/engine/pikachu_pcm.asm b/engine/pikachu_pcm.asm new file mode 100755 index 00000000..043f702c --- /dev/null +++ b/engine/pikachu_pcm.asm @@ -0,0 +1,154 @@ +PlayPikachuSoundClip:: + ld a, e + ld e, a + ld d, $0 + ld hl, PikachuCriesPointerTable + add hl, de + add hl, de + add hl, de + ld b, [hl] ; bank of pikachu cry data + inc hl + ld a, [hli] ; cry data pointer + ld h, [hl] + ld l, a + ld c, $4 +.loop + dec c + jr z, .done_delay + call DelayFrame + jr .loop + +.done_delay + di + push bc + push hl + ld a, $80 + ld [rNR52], a + ld a, $77 + ld [rNR50], a + xor a + ld [rNR30], a + ld hl, $ff30 ; wave data + ld de, wRedrawRowOrColumnSrcTiles +.saveWaveDataLoop + ld a, [hl] + ld [de], a + inc de + ld a, $ff + ld [hli], a + ld a, l + cp $40 ; end of wave data + jr nz, .saveWaveDataLoop + ld a, $80 + ld [rNR30], a + ld a, [rNR51] + or $44 + ld [rNR51], a + ld a, $ff + ld [rNR31], a + ld a, $20 + ld [rNR32], a + ld a, $ff + ld [rNR33], a + ld a, $87 + ld [rNR34], a + pop hl + pop bc + call PlayPikachuPCM + xor a + ld [wc0f3], a + ld [wc0f4], a + ld a, $80 + ld [rNR52], a + xor a + ld [rNR30], a + ld hl, $ff30 + ld de, wRedrawRowOrColumnSrcTiles +.reloadWaveDataLoop + ld a, [de] + inc de + ld [hli], a + ld a, l + cp $40 ; end of wave data + jr nz, .reloadWaveDataLoop + ld a, $80 + ld [rNR30], a + ld a, [rNR51] + and $bb + ld [rNR51], a + xor a + ld [wChannelSoundIDs+CH4], a + ld [wChannelSoundIDs+CH5], a + ld [wChannelSoundIDs+CH6], a + ld [wChannelSoundIDs+CH7], a + ld a, [H_LOADEDROMBANK] + ei + ret + +PikachuCriesPointerTable: +; format: +; db bank +; dw pointer to cry + +; bank 21 + pikacry_def PikachuCry1 ; 21:4000 + pikacry_def PikachuCry2 ; 21:491a + pikacry_def PikachuCry3 ; 21:4fdc + pikacry_def PikachuCry4 ; 21:59ee + +; bank 22 + pikacry_def PikachuCry5 ; 22:4000 + pikacry_def PikachuCry6 ; 22:5042 + pikacry_def PikachuCry7 ; 22:6254 + +; bank 23 + pikacry_def PikachuCry8 ; 23:4000 + pikacry_def PikachuCry9 ; 23:50ca + pikacry_def PikachuCry10 ; 23:5e0c + +; bank 24 + pikacry_def PikachuCry11 ; 24:4000 + pikacry_def PikachuCry12 ; 24:4722 + pikacry_def PikachuCry13 ; 24:54a4 + +; bank 25 + pikacry_def PikachuCry14 ; 25:4000 + pikacry_def PikachuCry15 ; 25:589a + +; banks 31-34, in no particular order + + pikacry_def PikachuCry16 ; 31:4000 + pikacry_def PikachuCry17 ; 34:4000 + pikacry_def PikachuCry18 ; 31:549a + pikacry_def PikachuCry19 ; 33:4000 + pikacry_def PikachuCry20 ; 32:4000 + pikacry_def PikachuCry21 ; 32:6002 + pikacry_def PikachuCry22 ; 31:63a4 + pikacry_def PikachuCry23 ; 34:4862 + pikacry_def PikachuCry24 ; 33:5632 + pikacry_def PikachuCry25 ; 34:573c + pikacry_def PikachuCry26 ; 33:725c + +; bank 35 + pikacry_def PikachuCry27 ; 35:4000 + pikacry_def PikachuCry28 ; 35:4b5a + pikacry_def PikachuCry29 ; 35:5da4 + pikacry_def PikachuCry30 ; 35:69ce + pikacry_def PikachuCry31 ; 35:6e80 + +; bank 36 + pikacry_def PikachuCry32 ; 36:4000 + pikacry_def PikachuCry33 ; 36:458a + pikacry_def PikachuCry34 ; 36:523c + +; bank 37 + pikacry_def PikachuCry35 ; 37:4000 + pikacry_def PikachuCry36 ; 37:522a + +; banks 36-38 + pikacry_def PikachuCry37 ; 38:4000 + pikacry_def PikachuCry38 ; 38:4dfa + pikacry_def PikachuCry39 ; 37:6e0c + pikacry_def PikachuCry40 ; 38:5a64 + pikacry_def PikachuCry41 ; 36:6746 + pikacry_def PikachuCry42 ; 38:6976 diff --git a/engine/pikachu_pic_animation.asm b/engine/pikachu_pic_animation.asm new file mode 100755 index 00000000..c04382c1 --- /dev/null +++ b/engine/pikachu_pic_animation.asm @@ -0,0 +1,851 @@ +GetPikaPicAnimationScriptIndex: + ld hl, PikachuMoodLookupTable + ld a, [wPikachuMood] + ld d, a +.get_mood_param + ld a, [hli] + inc hl + cp d + jr c, .get_mood_param + dec hl + ld e, [hl] + ld hl, PikaPicAnimationScriptPointerLookupTable + ld a, [wPikachuHappiness] + ld d, a + ld bc, 6 +.get_happiness_param + ld a, [hl] + cp d + jr nc, .got_animation + add hl, bc + jr .get_happiness_param + +.got_animation + ld d, 0 + add hl, de + ld a, [hl] + ret + +PikachuMoodLookupTable: +; First byte: mood threshold +; Second byte: column index in PikaPicAnimationScriptPointerLookupTable + db 40, 1 + db 127, 2 + db 128, 3 + db 210, 4 + db 255, 5 + +PikaPicAnimationScriptPointerLookupTable: +; First byte: happiness threshold +; Remaining bytes: loaded based on Pikachu's mood + db 50 + dpikapic PikaPicAnimScript14 + dpikapic PikaPicAnimScript14 + dpikapic PikaPicAnimScript6 + dpikapic PikaPicAnimScript13 + dpikapic PikaPicAnimScript13 + + db 100 + dpikapic PikaPicAnimScript9 + dpikapic PikaPicAnimScript9 + dpikapic PikaPicAnimScript5 + dpikapic PikaPicAnimScript12 + dpikapic PikaPicAnimScript12 + + db 130 + dpikapic PikaPicAnimScript3 + dpikapic PikaPicAnimScript3 + dpikapic PikaPicAnimScript1 + dpikapic PikaPicAnimScript8 + dpikapic PikaPicAnimScript8 + + db 160 + dpikapic PikaPicAnimScript3 + dpikapic PikaPicAnimScript3 + dpikapic PikaPicAnimScript4 + dpikapic PikaPicAnimScript15 + dpikapic PikaPicAnimScript15 + + db 200 + dpikapic PikaPicAnimScript17 + dpikapic PikaPicAnimScript17 + dpikapic PikaPicAnimScript7 + dpikapic PikaPicAnimScript2 + dpikapic PikaPicAnimScript2 + + db 250 + dpikapic PikaPicAnimScript17 + dpikapic PikaPicAnimScript17 + dpikapic PikaPicAnimScript16 + dpikapic PikaPicAnimScript10 + dpikapic PikaPicAnimScript10 + + db 255 + dpikapic PikaPicAnimScript17 + dpikapic PikaPicAnimScript17 + dpikapic PikaPicAnimScript19 + dpikapic PikaPicAnimScript20 + dpikapic PikaPicAnimScript20 + +StarterPikachuEmotionCommand_pikapic: + ld a, [H_AUTOBGTRANSFERENABLED] + push af + xor a + ld [H_AUTOBGTRANSFERENABLED], a + ld a, [de] + ld [wPikaPicAnimNumber], a + inc de + push de + call .RunPikapic + pop de + pop af + ld [H_AUTOBGTRANSFERENABLED], a + ret + +.RunPikapic: + call PlacePikapicTextBoxBorder + callab LoadOverworldPikachuFrontpicPalettes + call ResetPikaPicAnimBuffer + call LoadCurrentPikaPicAnimScriptPointer + call ExecutePikaPicAnimScript + call PlacePikapicTextBoxBorder + call RunDefaultPaletteCommand + ret + +ResetPikaPicAnimBuffer: + ld hl, wCurPikaMovementData + ld bc, wCurPikaMovementDataEnd - wCurPikaMovementData + xor a + call FillMemory + ld hl, wPikaPicAnimObjectDataBufferSize + ld bc, wPikaPicAnimObjectDataBufferEnd - wPikaPicAnimObjectDataBufferSize + xor a + call FillMemory + call ClearPikaPicUsedGFXBuffer + ld hl, 100 + ld a, l + ld [wPikaPicAnimTimer], a + ld a, h + ld [wPikaPicAnimTimer + 1], a + ld a, $7 + ld [wPikaPicPikaDrawStartX], a + ld a, $6 + ld [wPikaPicPikaDrawStartY], a + ret + +PlacePikapicTextBoxBorder: + xor a + ld [H_AUTOBGTRANSFERENABLED], a + coord hl, 6, 5 + lb bc, 5, 5 + call TextBoxBorder + call Delay3 + call UpdateSprites + ld a, $1 + ld [H_AUTOBGTRANSFERENABLED], a + call Delay3 + ret + +LoadCurrentPikaPicAnimScriptPointer: + ld a, [wPikaPicAnimNumber] + cp $1d + jr c, .valid + ld a, $0 +.valid + ld e, a + ld d, 0 + ld hl, PikaPicAnimPointers + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + call UpdatePikaPicAnimPointer + ret + +PikaPicAnimPointers: +pikapic_def: macro +\1_id: dw \1 +endm + + pikapic_def PikaPicAnimScript0 ; 00 + pikapic_def PikaPicAnimScript1 ; 01 + pikapic_def PikaPicAnimScript2 ; 02 + pikapic_def PikaPicAnimScript3 ; 03 + pikapic_def PikaPicAnimScript4 ; 04 + pikapic_def PikaPicAnimScript5 ; 05 + pikapic_def PikaPicAnimScript6 ; 06 + pikapic_def PikaPicAnimScript7 ; 07 + pikapic_def PikaPicAnimScript8 ; 08 + pikapic_def PikaPicAnimScript9 ; 09 + pikapic_def PikaPicAnimScript10 ; 0a + pikapic_def PikaPicAnimScript11 ; 0b + pikapic_def PikaPicAnimScript12 ; 0c + pikapic_def PikaPicAnimScript13 ; 0d + pikapic_def PikaPicAnimScript14 ; 0e + pikapic_def PikaPicAnimScript15 ; 0f + pikapic_def PikaPicAnimScript16 ; 10 + pikapic_def PikaPicAnimScript17 ; 11 + pikapic_def PikaPicAnimScript18 ; 12 + pikapic_def PikaPicAnimScript19 ; 13 + pikapic_def PikaPicAnimScript20 ; 14 + pikapic_def PikaPicAnimScript21 ; 15 + pikapic_def PikaPicAnimScript22 ; 16 + pikapic_def PikaPicAnimScript23 ; 17 + pikapic_def PikaPicAnimScript24 ; 18 + pikapic_def PikaPicAnimScript25 ; 19 + pikapic_def PikaPicAnimScript26 ; 1a + pikapic_def PikaPicAnimScript27 ; 1b + pikapic_def PikaPicAnimScript28 ; 1c + pikapic_def PikaPicAnimScript29 ; 1d + +ExecutePikaPicAnimScript: +.loop + xor a + ld [H_AUTOBGTRANSFERENABLED], a + call RunPikaPicAnimSetupScript + call DummyFunction_fdad5 + call AnimateCurrentPikaPicAnimFrame + call DummyFunction_fdad5 + ld a, $1 + ld [H_AUTOBGTRANSFERENABLED], a + call PikaPicAnimTimerAndJoypad + and a + jr z, .loop + ret + +PikaPicAnimTimerAndJoypad: + call Delay3 + call CheckPikaPicAnimTimer + and a + ret nz + call JoypadLowSensitivity + ld a, [hJoyPressed] + and A_BUTTON | B_BUTTON + ret + +CheckPikaPicAnimTimer: + ld hl, wPikaPicAnimTimer + dec [hl] + jr nz, .not_done_yet + inc hl + ld a, [hl] + and a + jr z, .timer_expired + dec [hl] +.not_done_yet + xor a + ret + +.timer_expired + ld a, $1 + ret + +DummyFunction_fdad5: + ret + +AnimateCurrentPikaPicAnimFrame: + ld bc, wPikaPicAnimObjectDataBuffer + ld a, 4 +.loop + push af + push bc + ld hl, 0 ; struct index + add hl, bc + ld a, [hli] + and a + jr z, .skip + ld a, [hli] + ld [wCurPikaPicAnimObjectScriptIdx], a + ld a, [hli] + ld [wCurPikaPicAnimObjectFrameIdx], a + ld a, [hli] + ld [wCurPikaPicAnimObjectFrameTimer], a + ld a, [hli] + ld [wCurPikaPicAnimObjectVTileOffset], a + ld a, [hli] + ld [wCurPikaPicAnimObjectXOffset], a + ld a, [hli] + ld [wCurPikaPicAnimObjectYOffset], a + ld a, [hli] + ld [wCurPikaPicAnimObject + 6], a + push bc + call LoadPikaPicAnimObjectData + pop bc + ld hl, 1 ; script index + add hl, bc + ld a, [wCurPikaPicAnimObjectScriptIdx] + ld [hli], a + ld a, [wCurPikaPicAnimObjectFrameIdx] + ld [hli], a + ld a, [wCurPikaPicAnimObjectFrameTimer] + ld [hli], a + ld a, [wCurPikaPicAnimObjectVTileOffset] + ld [hli], a + ld a, [wCurPikaPicAnimObjectXOffset] + ld [hli], a + ld a, [wCurPikaPicAnimObjectYOffset] + ld [hli], a + ld a, [wCurPikaPicAnimObject + 6] + ld [hl], a +.skip + pop bc + ld hl, 8 + add hl, bc + ld b, h + ld c, l + pop af + dec a + jr nz, .loop + ret + +PikaPicAnimCommand_object: + ld hl, wPikaPicAnimObjectDataBuffer + ld de, 8 + ld c, 4 +.loop + ld a, [hl] + and a + jr z, .found + add hl, de + dec c + jr nz, .loop + scf + ret + +.found + ld a, [wPikaPicAnimObjectDataBufferSize] + inc a + ld [wPikaPicAnimObjectDataBufferSize], a + ld [hli], a + call GetPikaPicAnimByte + ld [hli], a + call GetPikaPicAnimByte + ld [hl], a + xor a + ld [hli], a ; overloads + ld [hli], a + call GetPikaPicAnimByte + ld [hli], a + call GetPikaPicAnimByte + ld [hli], a + call GetPikaPicAnimByte + ld [hli], a + and a + ret + +PikaPicAnimCommand_deleteobject: + call GetPikaPicAnimByte + ld b, a + ld hl, wPikaPicAnimObjectDataBuffer + ld de, 8 + ld c, 4 +.search + ld a, [hl] + cp b + jr z, .delete + add hl, de + dec c + jr nz, .search + scf + ret + +.delete + xor a + ld [hl], a + ret + +LoadPikaPicAnimObjectData: +.loop + ld a, [wCurPikaPicAnimObjectScriptIdx] + cp $23 + jr c, .valid + ld a, $4 +.valid + ld e, a + ld d, 0 + ld hl, PikaPicAnimBGFramesPointers + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + ld a, [wCurPikaPicAnimObjectFrameIdx] + ld e, a + ld d, 0 + add hl, de + add hl, de + ld a, [hli] + cp $e0 + jr z, .end + jr .init + +.end + xor a + ld [wCurPikaPicAnimObjectFrameIdx], a + ld [wCurPikaPicAnimObjectFrameTimer], a + jr .loop + +.init + push hl + call LoadCurPikaPicObjectTilemap + pop hl + ld a, [hl] + and a + jr z, .not_done ; lasts forever + ld a, [wCurPikaPicAnimObjectFrameTimer] + inc a + ld [wCurPikaPicAnimObjectFrameTimer], a + cp [hl] + jr nz, .not_done + xor a + ld [wCurPikaPicAnimObjectFrameTimer], a + ld a, [wCurPikaPicAnimObjectFrameIdx] + inc a + ld [wCurPikaPicAnimObjectFrameIdx], a +.not_done + ret + +INCLUDE "data/pikachu_pic_objects.asm" + +LoadCurPikaPicObjectTilemap: + and a + ret z + ld e, a + ld d, 0 + ld hl, PikaPicTilemapPointers + add hl, de + add hl, de + ld e, [hl] + inc hl + ld d, [hl] + ld a, [de] + ld c, a + inc de + ld a, [de] + ld b, a + inc de + push de + push bc + call .GetStartCoords + pop bc + pop de +.row + push bc + push hl + ld a, [wCurPikaPicAnimObjectVTileOffset] ; tile id offset + ld c, a +.col + ld a, [de] + inc de + cp $ff + jr z, .skip + add c + ld [hl], a +.skip + inc hl + dec b + jr nz, .col + pop hl + ld bc, SCREEN_WIDTH + add hl, bc + pop bc + dec c + jr nz, .row + ret + +.GetStartCoords: + push bc + ld a, [wCurPikaPicAnimObjectYOffset] ; Y offset + ld b, a + ld a, [wPikaPicPikaDrawStartY] + add b + coord hl, 0, 0 + ld bc, SCREEN_WIDTH + call AddNTimes + ld a, [wCurPikaPicAnimObjectXOffset] ; X offset + ld c, a + ld a, [wPikaPicPikaDrawStartX] + add c + ld c, a + ld b, 0 + add hl, bc + pop bc + ret + +INCLUDE "data/pikachu_pic_tilemaps.asm" + +LoadPikaPicAnimGFXHeader: + push hl + ld e, a + ld d, 0 + ld hl, PikaPicAnimGFXHeaders + add hl, de + add hl, de + add hl, de + add hl, de + ld a, [hli] + ld c, a + ld a, [hli] + ld b, a + ld a, [hli] + ld e, a + ld a, [hli] + ld d, a + pop hl + ret + +RunPikaPicAnimSetupScript: + call .CheckAndAdvanceTimer + ret c + xor a + ld [wPikaPicAnimPointerSetupFinished], a +.loop + call GetPikaPicAnimByte + ld e, a + ld d, 0 + ld hl, .Jumptable + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + call JumpToAddress + ld a, [wPikaPicAnimPointerSetupFinished] + and a + jr z, .loop + ret + +.CheckAndAdvanceTimer: + ld a, [wPikaPicAnimDelay] + and a + ret z + dec a + ld [wPikaPicAnimDelay], a + scf + ret + +.Jumptable: + dw PikaPicAnimCommand_nop ; 00, 0 params + dw PikaPicAnimCommand_writebyte ; 01, 1 param + dw PikaPicAnimCommand_loadgfx ; 02, 1 param + dw PikaPicAnimCommand_object ; 03, 5 params + dw PikaPicAnimCommand_nop4 ; 04, 0 params + dw PikaPicAnimCommand_nop5 ; 05, 0 params + dw PikaPicAnimCommand_deleteobject ; 06, 1 param + dw PikaPicAnimCommand_nop7 ; 07, 0 params + dw PikaPicAnimCommand_nop8 ; 08, 0 params + dw PikaPicAnimCommand_jump ; 09, 1 dw param + dw PikaPicAnimCommand_setduration ; 0a, 1 dw param + dw PikaPicAnimCommand_cry ; 0b, 1 param + dw PikaPicAnimCommand_thunderbolt ; 0c, 0 params + dw PikaPicAnimCommand_run ; 0d, 0 params (ret) + dw PikaPicAnimCommand_ret ; 0e, 0 params (ret) + +PikaPicAnimCommand_nop: + ret + +PikaPicAnimCommand_ret: + ld a, 1 + ld [wPikaPicAnimTimer], a + xor a + ld [wPikaPicAnimTimer + 1], a + jr PikaPicAnimCommand_run + +; XXX + ret + +PikaPicAnimCommand_setduration: + call GetPikaPicAnimByte + ld [wPikaPicAnimTimer], a + call GetPikaPicAnimByte + ld [wPikaPicAnimTimer + 1], a + ret + +PikaPicAnimCommand_run: + ld a, $ff + ld [wPikaPicAnimPointerSetupFinished], a + ret + +PikaPicAnimCommand_writebyte: + call GetPikaPicAnimByte + ld [wPikaPicAnimDelay], a + ret + +PikaPicAnimCommand_nop4: +PikaPicAnimCommand_nop5: +PikaPicAnimCommand_nop7: +PikaPicAnimCommand_nop8: + ret + +PikaPicAnimCommand_jump: + call GetPikaPicAnimByte + ld l, a + call GetPikaPicAnimByte + ld h, a + call UpdatePikaPicAnimPointer + ret + +GetPikaPicAnimByte: + push hl + ld hl, wPikaPicAnimPointer + ld a, [hli] + ld h, [hl] + ld l, a + ld a, [hli] + call UpdatePikaPicAnimPointer + pop hl + ret + +UpdatePikaPicAnimPointer: + push af + ld a, l + ld [wPikaPicAnimPointer], a + ld a, h + ld [wPikaPicAnimPointer + 1], a + pop af + ret + +PikaPicAnimCommand_loadgfx: + ld a, [wUpdateSpritesEnabled] + push af + ld a, $ff + ld [wUpdateSpritesEnabled], a + ld a, [H_AUTOBGTRANSFERENABLED] + push af + xor a + ld [H_AUTOBGTRANSFERENABLED], a + ld a, [hTilesetType] + push af + xor a + ld [hTilesetType], a + call GetPikaPicAnimByte + ld [wPikaPicAnimCurGraphicID], a + ld a, [wPikaPicAnimCurGraphicID] + call LoadPikaPicAnimGFXHeader + ld a, c + cp a, $ff + jr z, .compressed + call RequestPikaPicAnimGFX + jr .done + +.compressed + call DecompressRequestPikaPicAnimGFX +.done + pop af + ld [hTilesetType], a + pop af + ld [H_AUTOBGTRANSFERENABLED], a + pop af + ld [wUpdateSpritesEnabled], a + ret + +RequestPikaPicAnimGFX: ; fe114 + push de + ld a, [wPikaPicAnimCurGraphicID] + ld d, a + ld e, c + call CheckIfThereIsRoomForPikaPicAnimGFX + pop de + jr c, .failed + call GetPikaPicVRAMAddressForNewGFX + call CopyVideoDataAlternate + and a +.failed + ret + +DecompressRequestPikaPicAnimGFX: ; fe128 + push de + ld a, [wPikaPicAnimCurGraphicID] + ld d, a + ld e, 5 * 5 + call CheckIfThereIsRoomForPikaPicAnimGFX + pop de + jr c, .failed + ld a, b + call UncompressSpriteFromDE + ld a, BANK(sSpriteBuffer1) + call SwitchSRAMBankAndLatchClockData + ld hl, sSpriteBuffer1 + ld de, sSpriteBuffer0 + ld bc, SPRITEBUFFERSIZE * 2 + call CopyData + call PrepareRTCDataAndDisableSRAM + ld a, [wPikaPicAnimCurGraphicID] + call LookUpTileOffsetForCurrentPikaPicAnimGFX + call GetPikaPicVRAMAddressForNewGFX + ld d, h + ld e, l + call InterlaceMergeSpriteBuffers +.failed + ret + +ClearPikaPicUsedGFXBuffer: + ld hl, wPikaPicUsedGFXCount + ld bc, wPikaPicUsedGFXEnd - wPikaPicUsedGFXCount + xor a + call FillMemory + ret + +GetPikaPicVRAMAddressForNewGFX: + ld hl, vNPCSprites + push bc + ld b, a + and $f + swap a + ld c, a + ld a, b + and $f0 + swap a + ld b, a + add hl, bc + pop bc + ret + +CheckIfThereIsRoomForPikaPicAnimGFX: +; d: idx +; e: size +; FATAL: If the graphic has already been loaded, or if there are +; already 8 graphics objects loaded, the game will execute arbitrary +; code. + push bc + push hl + ld hl, wPikaPicUsedGFX + ld c, 8 +.loop + ld a, [hl] + and a + jr z, .empty + cp d + jr z, .found + inc hl + inc hl + dec c + jr nz, .loop + scf + ret ; execute hl, then bc + +.found + inc hl + ld a, [hl] + ret ; execute hl, then bc + +.empty + ld [hl], d + inc hl + ld a, [wPikaPicUsedGFXCount] + add $80 + ld [hl], a + ld a, [wPikaPicUsedGFXCount] + add e + ld [wPikaPicUsedGFXCount], a + cp $80 + jr z, .okay + jr nc, .failed +.okay + ld a, [hl] + and a + jr .pop_ret + +.failed + scf +.pop_ret + pop hl + pop bc + ret + +LookUpTileOffsetForCurrentPikaPicAnimGFX: + push bc + push hl + ld b, a + ld hl, wPikaPicUsedGFX + ld c, 8 +.loop + ld a, [hli] + cp b + jr z, .found + inc hl + dec c + jr nz, .loop + scf + jr .pop_ret + +.found + ld a, [hl] + and a +.pop_ret + pop hl + pop bc + ret + +PikaPicAnimCommand_cry: + call GetPikaPicAnimByte + cp $ff + ret z + ld e, a + callab PlayPikachuSoundClip + ret + +PikaPicAnimCommand_thunderbolt: + ld a, $1 + ld [wMuteAudioAndPauseMusic], a + call DelayFrame + ld a, [wAudioROMBank] + push af + ld a, BANK(SFX_Thunderbolt) + ld [wAudioROMBank], a + ld [wAudioSavedROMBank], a + call .LoadAudio + call PlaySound + call .FlashScreen + call WaitForSoundToFinish + pop af + ld [wAudioROMBank], a + ld [wAudioSavedROMBank], a + xor a + ld [wMuteAudioAndPauseMusic], a + ret + +.LoadAudio: + ld hl, MoveSoundTable + ld e, THUNDERBOLT + ld d, 0 + add hl, de + add hl, de + add hl, de + ld a, BANK(MoveSoundTable) + call GetFarByte + ld b, a + inc hl + ld a, BANK(MoveSoundTable) + call GetFarByte + inc hl + ld [wFrequencyModifier], a + ld a, BANK(MoveSoundTable) + call GetFarByte + ld [wTempoModifier], a + ld a, b + ret + +.FlashScreen: + ld hl, PikaPicAnimThunderboltPals +.loop + ld a, [hli] + cp $ff + ret z + ld c, a + ld b, [hl] + inc hl + push hl + call .UpdatePal + pop hl + jr .loop + +.UpdatePal: + ld a, b + ld [rBGP], a + call UpdateGBCPal_BGP + call DelayFrames + ret + +INCLUDE "data/pikachu_pic_animation.asm" diff --git a/engine/pikachu_status.asm b/engine/pikachu_status.asm new file mode 100755 index 00000000..c73d3b3f --- /dev/null +++ b/engine/pikachu_status.asm @@ -0,0 +1,258 @@ +IsStarterPikachuInOurParty:: + ld hl, wPartySpecies + ld de, wPartyMon1OTID + ld bc, wPartyMonOT + push hl +.loop + pop hl + ld a, [hli] + push hl + inc a + jr z, .noPlayerPikachu + cp PIKACHU + 1 + jr nz, .curMonNotPlayerPikachu + ld h, d + ld l, e + ld a, [wPlayerID] + cp [hl] + jr nz, .curMonNotPlayerPikachu + inc hl + ld a, [wPlayerID+1] + cp [hl] + jr nz, .curMonNotPlayerPikachu + push de + push bc + ld hl, wPlayerName + ld d, $6 ; possible player length - 1 +.nameCompareLoop + dec d + jr z, .sameOT + ld a, [bc] + inc bc + cp [hl] + inc hl + jr z, .nameCompareLoop + pop bc + pop de +.curMonNotPlayerPikachu + ld hl, wPartyMon2 - wPartyMon1 + add hl, de + ld d, h + ld e, l + ld hl, NAME_LENGTH + add hl, bc + ld b, h + ld c, l + jr .loop + +.sameOT + pop bc + pop de + ld h, d + ld l, e + ld bc, -NAME_LENGTH + add hl, bc + ld a, [hli] + or [hl] + jr z, .noPlayerPikachu ; XXX how is this determined? + pop hl + scf + ret + +.noPlayerPikachu + pop hl + and a + ret + +IsThisPartymonStarterPikachu_Box:: + ld hl, wBoxMon1 + ld bc, wBoxMon2 - wBoxMon1 + ld de, wBoxMonOT + jr asm_fce21 + +IsThisPartymonStarterPikachu_Party:: +IsThisPartymonStarterPikachu:: + ld hl, wPartyMon1 + ld bc, wPartyMon2 - wPartyMon1 + ld de, wPartyMonOT +asm_fce21: + ld a, [wWhichPokemon] + call AddNTimes + ld a, [hl] + cp PIKACHU + jr nz, .notPlayerPikachu + ld bc, wPartyMon1OTID - wPartyMon1 + add hl, bc + ld a, [wPlayerID] + cp [hl] + jr nz, .notPlayerPikachu + inc hl + ld a, [wPlayerID+1] + cp [hl] + jr nz, .notPlayerPikachu + ld h, d + ld l, e + ld a, [wWhichPokemon] + ld bc, NAME_LENGTH + call AddNTimes + ld de, wPlayerName + ld b, $6 +.loop + dec b + jr z, .isPlayerPikachu + ld a, [de] + inc de + cp [hl] + inc hl + jr z, .loop +.notPlayerPikachu + and a + ret + +.isPlayerPikachu + scf + ret + +UpdatePikachuMoodAfterBattle:: +; because d is always $82 at this function, it serves to +; ensure Pikachu's mood is at least 130 after battle + push de + call IsStarterPikachuInOurParty + pop de + ret nc + ld a, d + cp 128 + ld a, [wPikachuMood] + jr c, .d_less_than_128 ; we never jump + cp d + jr c, .load_d_into_mood + ret + +.d_less_than_128 + cp d + ret c +.load_d_into_mood + ld a, d + ld [wPikachuMood], a + ret + +CheckPikachuFaintedOrStatused:: +; function to test if Pikachu is alive? + xor a + ld [wWhichPokemon], a + ld hl, wPartyCount +.loop + inc hl + ld a, [hl] + cp $ff + jr z, .dead_or_not_in_party + push hl + call IsThisPartymonStarterPikachu_Party + pop hl + jr nc, .next + ld a, [wWhichPokemon] + ld hl, wPartyMon1HP + ld bc, wPartyMon2 - wPartyMon1 + call AddNTimes + ld a, [hli] + or [hl] + ld d, a + inc hl + inc hl + ld a, [hl] ; status + and a + jr nz, .alive + jr .dead_or_not_in_party + +.next + ld a, [wWhichPokemon] + inc a + ld [wWhichPokemon], a + jr .loop + +.alive + scf + ret + +.dead_or_not_in_party + and a + ret + +IsSurfingPikachuInThePlayersParty:: + ld hl, wPartySpecies + ld de, wPartyMon1Moves + ld bc, wPartyMonOT + push hl +.loop + pop hl + ld a, [hli] + push hl + inc a + jr z, .noSurfingPlayerPikachu + cp PIKACHU+1 + jr nz, .curMonNotSurfingPlayerPikachu + ld h, d + ld l, e + push hl + push bc + ld b, NUM_MOVES +.moveSearchLoop + ld a, [hli] + cp SURF + jr z, .foundSurfingPikachu + dec b + jr nz, .moveSearchLoop + pop bc + pop hl + jr .curMonNotSurfingPlayerPikachu + +.foundSurfingPikachu + pop bc + pop hl + inc hl + inc hl + inc hl + inc hl + ld a, [wPlayerID] + cp [hl] + jr nz, .curMonNotSurfingPlayerPikachu + inc hl + ld a, [wPlayerID+1] + cp [hl] + jr nz, .curMonNotSurfingPlayerPikachu + push de + push bc + ld hl, wPlayerName + ld d, $6 +.nameCompareLoop + dec d + jr z, .foundSurfingPlayerPikachu + ld a, [bc] + inc bc + cp [hl] + inc hl + jr z, .nameCompareLoop + pop bc + pop de +.curMonNotSurfingPlayerPikachu + ld hl, wPartyMon2 - wPartyMon1 + add hl, de + ld d, h + ld e, l + ld hl, NAME_LENGTH + add hl, bc + ld b, h + ld c, l + jr .loop + +.foundSurfingPlayerPikachu + pop bc + pop de + pop hl + scf + ret + +.noSurfingPlayerPikachu + pop hl + and a + ret diff --git a/engine/pokedex_rating.asm b/engine/pokedex_rating.asm index f8e29e5c..97bbfc24 100755 --- a/engine/pokedex_rating.asm +++ b/engine/pokedex_rating.asm @@ -26,7 +26,7 @@ DisplayDexRating: CheckAndResetEventA EVENT_HALL_OF_FAME_DEX_RATING jr nz, .hallOfFame push hl - ld hl, PokedexRatingText_441cc + ld hl, DexCompletionText call PrintText pop hl call PrintText @@ -51,104 +51,104 @@ DisplayDexRating: ld [de], a ret -PokedexRatingText_441cc: - TX_FAR _OaksLabText_441cc +DexCompletionText: + TX_FAR _DexCompletionText db "@" DexRatingsTable: db 10 - dw PokedexRatingText_44201 + dw DexRatingText_Own0To9 db 20 - dw PokedexRatingText_44206 + dw DexRatingText_Own10To19 db 30 - dw PokedexRatingText_4420b + dw DexRatingText_Own20To29 db 40 - dw PokedexRatingText_44210 + dw DexRatingText_Own30To39 db 50 - dw PokedexRatingText_44215 + dw DexRatingText_Own40To49 db 60 - dw PokedexRatingText_4421a + dw DexRatingText_Own50To59 db 70 - dw PokedexRatingText_4421f + dw DexRatingText_Own60To69 db 80 - dw PokedexRatingText_44224 + dw DexRatingText_Own70To79 db 90 - dw PokedexRatingText_44229 + dw DexRatingText_Own80To89 db 100 - dw PokedexRatingText_4422e + dw DexRatingText_Own90To99 db 110 - dw PokedexRatingText_44233 + dw DexRatingText_Own100To109 db 120 - dw PokedexRatingText_44238 + dw DexRatingText_Own110To119 db 130 - dw PokedexRatingText_4423d + dw DexRatingText_Own120To129 db 140 - dw PokedexRatingText_44242 + dw DexRatingText_Own130To139 db 150 - dw PokedexRatingText_44247 + dw DexRatingText_Own140To149 db 152 - dw PokedexRatingText_4424c + dw DexRatingText_Own150To151 -PokedexRatingText_44201: - TX_FAR _OaksLabText_44201 +DexRatingText_Own0To9: + TX_FAR _DexRatingText_Own0To9 db "@" -PokedexRatingText_44206: - TX_FAR _OaksLabText_44206 +DexRatingText_Own10To19: + TX_FAR _DexRatingText_Own10To19 db "@" -PokedexRatingText_4420b: - TX_FAR _OaksLabText_4420b +DexRatingText_Own20To29: + TX_FAR _DexRatingText_Own20To29 db "@" -PokedexRatingText_44210: - TX_FAR _OaksLabText_44210 +DexRatingText_Own30To39: + TX_FAR _DexRatingText_Own30To39 db "@" -PokedexRatingText_44215: - TX_FAR _OaksLabText_44215 +DexRatingText_Own40To49: + TX_FAR _DexRatingText_Own40To49 db "@" -PokedexRatingText_4421a: - TX_FAR _OaksLabText_4421a +DexRatingText_Own50To59: + TX_FAR _DexRatingText_Own50To59 db "@" -PokedexRatingText_4421f: - TX_FAR _OaksLabText_4421f +DexRatingText_Own60To69: + TX_FAR _DexRatingText_Own60To69 db "@" -PokedexRatingText_44224: - TX_FAR _OaksLabText_44224 +DexRatingText_Own70To79: + TX_FAR _DexRatingText_Own70To79 db "@" -PokedexRatingText_44229: - TX_FAR _OaksLabText_44229 +DexRatingText_Own80To89: + TX_FAR _DexRatingText_Own80To89 db "@" -PokedexRatingText_4422e: - TX_FAR _OaksLabText_4422e +DexRatingText_Own90To99: + TX_FAR _DexRatingText_Own90To99 db "@" -PokedexRatingText_44233: - TX_FAR _OaksLabText_44233 +DexRatingText_Own100To109: + TX_FAR _DexRatingText_Own100To109 db "@" -PokedexRatingText_44238: - TX_FAR _OaksLabText_44238 +DexRatingText_Own110To119: + TX_FAR _DexRatingText_Own110To119 db "@" -PokedexRatingText_4423d: - TX_FAR _OaksLabText_4423d +DexRatingText_Own120To129: + TX_FAR _DexRatingText_Own120To129 db "@" -PokedexRatingText_44242: - TX_FAR _OaksLabText_44242 +DexRatingText_Own130To139: + TX_FAR _DexRatingText_Own130To139 db "@" -PokedexRatingText_44247: - TX_FAR _OaksLabText_44247 +DexRatingText_Own140To149: + TX_FAR _DexRatingText_Own140To149 db "@" -PokedexRatingText_4424c: - TX_FAR _OaksLabText_4424c +DexRatingText_Own150To151: + TX_FAR _DexRatingText_Own150To151 db "@" diff --git a/engine/predefs.asm b/engine/predefs.asm index fd11475b..8b26706a 100755 --- a/engine/predefs.asm +++ b/engine/predefs.asm @@ -1,66 +1,67 @@ GetPredefPointer: -; Store the contents of the register -; pairs (hl, de, bc) at wPredefRegisters. -; Then put the bank and address of predef -; wPredefID in [wPredefBank] and hl. + ; Store the contents of the register + ; pairs (hl, de, bc) at wPredefRegisters. + ; Then put the bank and address of predef + ; wPredefID in [wPredefBank] and hl. - ld a,h - ld [wPredefRegisters],a - ld a,l - ld [wPredefRegisters + 1],a + ld a, h + ld [wPredefRegisters], a + ld a, l + ld [wPredefRegisters + 1], a - ld hl,wPredefRegisters + 2 - ld a,d - ld [hli],a - ld a,e - ld [hli],a + ld hl, wPredefRegisters + 2 + ld a, d + ld [hli], a + ld a, e + ld [hli], a - ld a,b - ld [hli],a - ld [hl],c + ld a, b + ld [hli], a + ld [hl], c - ld hl,PredefPointers - ld de,0 + ld hl, PredefPointers + ld de, 0 - ld a,[wPredefID] - ld e,a + ld a, [wPredefID] + ld e, a add a add e - ld e,a - jr nc,.next + ld e, a + jr nc, .nocarry inc d -.next - add hl,de - ld d,h - ld e,l +.nocarry + add hl, de + ld d, h + ld e, l ; get bank of predef routine - ld a,[de] - ld [wPredefBank],a + ld a, [de] + ld [wPredefBank], a ; get pointer inc de - ld a,[de] - ld l,a + ld a, [de] + ld l, a inc de - ld a,[de] - ld h,a + ld a, [de] + ld h, a ret PredefPointers:: -; these are pointers to ASM routines. -; they appear to be used in overworld map scripts. + ; these are pointers to ASM routines. + ; they appear to be used in overworld map scripts. + const_def add_predef DrawPlayerHUDAndHPBar add_predef CopyUncompressedPicToTilemap add_predef AnimateSendingOutMon add_predef ScaleSpriteByTwo add_predef LoadMonBackPic add_predef CopyDownscaledMonTiles - add_predef LoadMissableObjects + add_predef Func_f0a7 add_predef HealParty - add_predef MoveAnimation; 08 play move animation + add_predef MoveAnimation ; 08 play move animation (1e:4d97) add_predef DivideBCDPredef add_predef DivideBCDPredef2 add_predef AddBCDPredef @@ -81,9 +82,13 @@ PredefPointers:: add_predef LearnMoveFromLevelUp add_predef LearnMove add_predef GetQuantityOfItemInBag - dbw $03,CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; for these two, the bank number is actually 0 - dbw $03,GiveItem - add_predef ChangeBGPalColor0_4Frames + + predef_const CheckForHiddenObjectOrBookshelfOrCardKeyDoor + predef_const GiveItem + dbw $03, CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; home bank + dbw $03, GiveItem ; home bank + + add_predef InvertBGPal_4Frames add_predef FindPathToPlayer add_predef PredefShakeScreenVertically add_predef CalcPositionOfPlayerRelativeToNPC @@ -111,7 +116,7 @@ PredefPointers:: add_predef InternalClockTradeAnim add_predef TrainerEngage add_predef IndexToPokedex - add_predef DisplayPicCenteredOrUpperRight + add_predef DisplayPicCenteredOrUpperRight ; 3B display pic? (01:600d) add_predef UsedCut add_predef ShowPokedexData add_predef WriteMonMoves @@ -122,32 +127,36 @@ PredefPointers:: add_predef CanLearnTM add_predef TMToMove add_predef _RunPaletteCommand - add_predef StarterDex ; 46 + add_predef StarterDex ; 46 (17:40d4) add_predef _AddPartyMon add_predef UpdateHPBar2 add_predef DrawEnemyHUDAndHPBar add_predef LoadTownMap_Nest add_predef PrintMonType - add_predef EmotionBubble - add_predef EmptyFunc3; return immediately + add_predef EmotionBubble ; 4C player exclamation (10:516f) + add_predef EmptyFunc3 ; return immediately (01:5b63) add_predef AskName add_predef PewterGuys add_predef SaveSAVtoSRAM2 add_predef LoadSAV2 add_predef LoadSAV add_predef SaveSAVtoSRAM1 - add_predef DoInGameTradeDialogue + add_predef DoInGameTradeDialogue ; 54 initiate trade (1c:5b86) add_predef HallOfFamePC add_predef DisplayDexRating + + predef_const _LeaveMapAnim + predef_const EnterMapAnim dbw $1E, _LeaveMapAnim ; wrong bank dbw $1E, EnterMapAnim ; wrong bank + add_predef GetTileTwoStepsInFrontOfPlayer add_predef CheckForCollisionWhenPushingBoulder add_predef PrintStrengthTxt add_predef PickUpItem add_predef PrintMoveType add_predef LoadMovePPs - add_predef DrawHP ; 5F + add_predef DrawHP ; 5F (04:5468) add_predef DrawHP2 add_predef DisplayElevatorFloorMenu add_predef OaksAideScript diff --git a/engine/predefs7.asm b/engine/predefs7.asm index 752bdd1a..bfa0ab57 100755 --- a/engine/predefs7.asm +++ b/engine/predefs7.asm @@ -1,6 +1,12 @@ DisplayElevatorFloorMenu: + ld hl, wd730 + ld a, [hl] + push af + set 6, [hl] ld hl, WhichFloorText call PrintText + pop af + ld [wd730], a ld hl, wItemList ld a, l ld [wListPointer], a diff --git a/engine/predefs12.asm b/engine/predefsA.asm index 95f0ea25..eb28b646 100755..100644 --- a/engine/predefs12.asm +++ b/engine/predefsA.asm @@ -1,14 +1,16 @@ -; b = new colour for BG colour 0 (usually white) for 4 frames -ChangeBGPalColor0_4Frames: - call GetPredefRegisters +; inverts the BGP for 4 (6 on CGB due to lag) frames +InvertBGPal_4Frames: + call GetPredefRegisters ; leftover of red/blue, has no use here ld a, [rBGP] - or b + xor $ff ld [rBGP], a + call UpdateGBCPal_BGP ld c, 4 call DelayFrames ld a, [rBGP] - and %11111100 + xor $ff ld [rBGP], a + call UpdateGBCPal_BGP ret PredefShakeScreenVertically: diff --git a/engine/print_waiting_text.asm b/engine/print_waiting_text.asm new file mode 100644 index 00000000..bd2180a1 --- /dev/null +++ b/engine/print_waiting_text.asm @@ -0,0 +1,19 @@ +PrintWaitingText: + coord hl, 3, 10 + lb bc, 1, 11 + ld a, [wIsInBattle] + and a + jr z, .asm_4b9a + call TextBoxBorder + jr .asm_4b9d +.asm_4b9a + call CableClub_TextBoxBorder +.asm_4b9d + coord hl, 4, 11 + ld de, WaitingText + call PlaceString + ld c, 50 + jp DelayFrames + +WaitingText: + db "Waiting...!@" diff --git a/engine/printer.asm b/engine/printer.asm new file mode 100644 index 00000000..46eb2c59 --- /dev/null +++ b/engine/printer.asm @@ -0,0 +1,999 @@ + const_def + const PRINTER_STATUS_BLANK + const PRINTER_STATUS_CHECKING_LINK + const PRINTER_STATUS_TRANSMITTING + const PRINTER_STATUS_PRINTING + const PRINTER_ERROR_1 + const PRINTER_ERROR_2 + const PRINTER_ERROR_3 + const PRINTER_ERROR_4 + const PRINTER_ERROR_WRONG_DEVICE + +INCLUDE "engine/printer/serial.asm" + +PrintPokedexEntry: + ld a, [wUpdateSpritesEnabled] + push af + xor a + ld [wUpdateSpritesEnabled], a + ld [hCanceledPrinting], a + call Printer_PlayPrinterMusic + ld a, [rIE] + push af + xor a + ld [rIF], a + ld a, $9 + ld [rIE], a + xor a + ld [H_AUTOBGTRANSFERENABLED], a + call Printer_GetDexEntryRegisters + call Printer_StartTransmission + ld a, [wPrinterPokedexMonIsOwned] + and a + jr z, .not_caught + ld a, 16 + jr .got_size + +.not_caught + ld a, 19 +.got_size + ld [wcae2], a + call Printer_CopyTileMapToPrinterTileBuffer + call ClearScreen + callab Pokedex_DrawInterface + callab Pokedex_PlacePokemonList + ld a, $1 + ld [H_AUTOBGTRANSFERENABLED], a + call .TryPrintPage + jr c, .finish_printing + ld a, [wPrinterPokedexMonIsOwned] + and a + jr z, .finish_printing + xor a + ld [wPrinterConnectionOpen], a + ld [wPrinterOpcode], a + ld c, $c + call DelayFrames + call SaveScreenTilesToBuffer1 + xor a + ld [H_AUTOBGTRANSFERENABLED], a + call Printer_PrepareDexEntryForPrinting + ld a, $7 + call Printer_StartTransmission + ld a, $3 + ld [wcae2], a + call Printer_CopyTileMapToPrinterTileBuffer + call LoadScreenTilesFromBuffer1 + ld a, $1 + ld [H_AUTOBGTRANSFERENABLED], a + call .TryPrintPage +.finish_printing + xor a + ld [wPrinterConnectionOpen], a + ld [wPrinterOpcode], a + xor a + ld [rIF], a + pop af + ld [rIE], a + call ReloadMapAfterPrinter + call Printer_PlayMapMusic + pop af + ld [wUpdateSpritesEnabled], a + ret + +.TryPrintPage: + call Printer_ResetJoypadHRAM +.print_loop + call JoypadLowSensitivity + call Printer_CheckPressingB + jr c, .pressed_b + ld a, [wPrinterSendState] + bit 7, a + jr nz, .completed + call PrinterTransmissionJumptable + call GBPrinter_CheckForErrors + call GBPrinter_UpdateStatusMessage + call DelayFrame + jr .print_loop + +.completed + and a + ret + +.pressed_b + scf + ret + +Printer_GetDexEntryRegisters: + callab DrawDexEntryOnScreen + ld a, l + ld [wPrinterPokedexEntryTextPointer], a + ld a, h + ld [wPrinterPokedexEntryTextPointer + 1], a + ld a, $0 + rla ; copy carry flag state to bit 0 + ld [wPrinterPokedexMonIsOwned], a + and a + jr z, .not_caught + ld a, $5 + jr .got_num_rows + +.not_caught + ld a, $9 +.got_num_rows + ret + +Printer_PrepareDexEntryForPrinting: + call ClearScreen + callab Pokedex_PrepareDexEntryForPrinting + ret + +PrintSurfingMinigameHighScore: + xor a + ld [hCanceledPrinting], a + call Printer_PlayPrinterMusic + call Printer_PrepareSurfingMinigameHighScoreTileMap + ld a, [rIE] + push af + xor a + ld [rIF], a + ld a, $9 + ld [rIE], a + call StartTransmission_Send9Rows + ld a, $13 + ld [wcae2], a + call Printer_CopyTileMapToPrinterTileBuffer + call Printer_ResetJoypadHRAM +.loop + call JoypadLowSensitivity + call Printer_CheckPressingB + jr c, .quit + ld a, [wPrinterSendState] + bit 7, a + jr nz, .quit + call PrinterTransmissionJumptable + call GBPrinter_CheckForErrors + call GBPrinter_UpdateStatusMessage + call DelayFrame + jr .loop + +.quit + xor a + ld [wPrinterConnectionOpen], a + ld [wPrinterOpcode], a + call Printer_CopyTileMapFromPrinterTileBuffer + xor a + ld [rIF], a + pop af + ld [rIE], a + call ReloadMapAfterPrinter + call Printer_PlayMapMusic + ret + +PrintDiploma: + xor a + ld [hCanceledPrinting], a + call Printer_PlayPrinterMusic + call _DisplayDiploma + ld a, [rIE] + push af + xor a + ld [rIF], a + ld a, $9 + ld [rIE], a + call StartTransmission_Send9Rows + ld a, $10 + ld [wcae2], a + call Printer_CopyTileMapToPrinterTileBuffer + call Func_e8d11 + jr c, .asm_e8cfa + xor a + ld [wPrinterConnectionOpen], a + ld [wPrinterOpcode], a + ld c, $c + call DelayFrames + call SaveScreenTilesToBuffer1 + xor a + ld [H_AUTOBGTRANSFERENABLED], a + call Func_e9ad3 + call StartTransmission_Send9Rows + ld a, $3 + ld [wcae2], a + call Printer_CopyTileMapToPrinterTileBuffer + call LoadScreenTilesFromBuffer1 + call Func_e8d11 +.asm_e8cfa + xor a + ld [wPrinterConnectionOpen], a + ld [wPrinterOpcode], a + call Printer_CopyTileMapFromPrinterTileBuffer + xor a + ld [rIF], a + pop af + ld [rIE], a + call ReloadMapAfterPrinter + call Printer_PlayMapMusic + ret + +Func_e8d11: + call Printer_ResetJoypadHRAM +.asm_e8d14 + call JoypadLowSensitivity + call Printer_CheckPressingB + jr c, .asm_e8d33 + ld a, [wPrinterSendState] + bit 7, a + jr nz, .asm_e8d31 + call PrinterTransmissionJumptable + call GBPrinter_CheckForErrors + call GBPrinter_UpdateStatusMessage + call DelayFrame + jr .asm_e8d14 + +.asm_e8d31 + and a + ret + +.asm_e8d33 + scf + ret + +PrintPCBox:: + ld a, [wBoxDataStart] + and a + jp z, Func_e8df4 + ld a, [wUpdateSpritesEnabled] + push af + xor a + ld [wUpdateSpritesEnabled], a + ld [hCanceledPrinting], a + call Printer_PlayPrinterMusic + ld a, [rIE] + push af + xor a + ld [rIF], a + ld a, $9 + ld [rIE], a + call SaveScreenTilesToBuffer1 + xor a + ld [H_AUTOBGTRANSFERENABLED], a + call PrintPCBox_DrawPage1 + call StartTransmission_Send9Rows + ld a, $10 + ld [wcae2], a + call Printer_CopyTileMapToPrinterTileBuffer + call LoadScreenTilesFromBuffer1 + call Func_e8dfb + jr c, .asm_e8ddc + xor a + ld [wPrinterConnectionOpen], a + ld [wPrinterOpcode], a + ld c, 12 + call DelayFrames + xor a + ld [H_AUTOBGTRANSFERENABLED], a + call PrintPCBox_DrawPage2 + call StartTransmission_Send9Rows + ld a, $0 + ld [wcae2], a + call Printer_CopyTileMapToPrinterTileBuffer + call LoadScreenTilesFromBuffer1 + call Func_e8dfb + jr c, .asm_e8ddc + xor a + ld [wPrinterConnectionOpen], a + ld [wPrinterOpcode], a + ld c, 12 + call DelayFrames + xor a + ld [H_AUTOBGTRANSFERENABLED], a + call PrintPCBox_DrawPage3 + call StartTransmission_Send9Rows + ld a, $0 + ld [wcae2], a + call Printer_CopyTileMapToPrinterTileBuffer + call LoadScreenTilesFromBuffer1 + call Func_e8dfb + jr c, .asm_e8ddc + xor a + ld [wPrinterConnectionOpen], a + ld [wPrinterOpcode], a + ld c, 12 + call DelayFrames + xor a + ld [H_AUTOBGTRANSFERENABLED], a + call PrintPCBox_DrawPage4 + call StartTransmission_Send9Rows + ld a, $3 + ld [wcae2], a + call Printer_CopyTileMapToPrinterTileBuffer + call LoadScreenTilesFromBuffer1 + call Func_e8dfb +.asm_e8ddc + xor a + ld [wPrinterConnectionOpen], a + ld [wPrinterOpcode], a + xor a + ld [rIF], a + pop af + ld [rIE], a + call ReloadMapAfterPrinter + call Printer_PlayMapMusic + pop af + ld [wUpdateSpritesEnabled], a + ret + +Func_e8df4: ; e8df4 + ld hl, String_e8e1f + call PrintText + ret + +Func_e8dfb: ; e8dfb + call Printer_ResetJoypadHRAM +.asm_e8dfe + call JoypadLowSensitivity + call Printer_CheckPressingB + jr c, .asm_e8e1d + ld a, [wPrinterSendState] + bit 7, a + jr nz, .asm_e8e1b + call PrinterTransmissionJumptable + call GBPrinter_CheckForErrors + call GBPrinter_UpdateStatusMessage + call DelayFrame + jr .asm_e8dfe + +.asm_e8e1b + and a + ret + +.asm_e8e1d + scf + ret + +String_e8e1f: ; e8e1f + TX_FAR _NoPokemonText + db "@" + +PrintFanClubPortrait: ; e8e24 + xor a + ld [hCanceledPrinting], a + call Printer_PlayPrinterMusic + call Printer_GetMonStats + ld a, [rIE] + push af + xor a + ld [rIF], a + ld a, $9 + ld [rIE], a + call StartTransmission_Send9Rows + ld a, $13 + ld [wcae2], a + call Printer_CopyTileMapToPrinterTileBuffer + call Printer_ResetJoypadHRAM +.asm_e8e45 + call JoypadLowSensitivity + call Printer_CheckPressingB + jr c, .asm_e8e62 + ld a, [wPrinterSendState] + bit 7, a + jr nz, .asm_e8e62 + call PrinterTransmissionJumptable + call GBPrinter_CheckForErrors + call GBPrinter_UpdateStatusMessage + call DelayFrame + jr .asm_e8e45 + +.asm_e8e62 + xor a + ld [wPrinterConnectionOpen], a + ld [wPrinterOpcode], a + call Printer_CopyTileMapFromPrinterTileBuffer + xor a + ld [rIF], a + pop af + ld [rIE], a + call ReloadMapAfterPrinter + call Printer_PlayMapMusic + ret + +PrinterDebug: + push af + push bc + push de + push hl + call StopAllMusic + ld a, [rIE] + push af + xor a + ld [rIF], a + ld a, $9 + ld [rIE], a + call StartTransmission_Send9Rows + ld a, $13 + ld [wcae2], a + ld a, $1 + ld [H_AUTOBGTRANSFERENABLED], a + call Printer_CopyTileMapToPrinterTileBuffer + call PrinterDebug_LoadGFX +.loop + ld a, [wPrinterSendState] + bit 7, a + jr nz, .quit + call PrinterDebug_DoFunction + call PrinterDebug_ConvertStatusFlagsToTiles + call DelayFrame + jr .loop + +.quit + xor a + ld [wPrinterConnectionOpen], a + ld [wPrinterOpcode], a + ld hl, wOAMBuffer + 32 * 4 + ld bc, 8 * 4 + xor a + call FillMemory + xor a + ld [rIF], a + pop af + ld [rIE], a + pop hl + pop de + pop bc + pop af + ret + +Printer_CheckPressingB: + ld a, [hJoyHeld] + and B_BUTTON + jr nz, .quit + and a + ret + +.quit + ld a, [wPrinterSendState] + cp $c + jr nz, .already_done +.wait_current_task + ld a, [wPrinterOpcode] + and a + jr nz, .wait_current_task + ld a, $16 + ld [wPrinterOpcode], a + ld a, $88 + ld [rSB], a + ld a, $1 + ld [rSC], a + ld a, $81 + ld [rSC], a +.wait_send_cancel + ld a, [wPrinterOpcode] + and a + jr nz, .wait_send_cancel +.already_done + ld a, $1 + ld [hCanceledPrinting], a + scf + ret + +Printer_CopyTileMapToPrinterTileBuffer: + coord hl, 0, 0 + coord de, 0, 0, wPrinterTileBuffer + ld bc, SCREEN_HEIGHT * SCREEN_WIDTH + call CopyData + ret + +Printer_CopyTileMapFromPrinterTileBuffer: + coord hl, 0, 0, wPrinterTileBuffer + coord de, 0, 0 + ld bc, SCREEN_HEIGHT * SCREEN_WIDTH + call CopyData + ret + +Printer_ResetJoypadHRAM: + xor a + ld [hJoyLast], a + ld [hJoyReleased], a + ld [hJoyPressed], a + ld [hJoyHeld], a + ld [hJoy5], a + ld [hJoy6], a + ret + +Printer_PlayPrinterMusic: + call Printer_FadeOutMusicAndWait + ld a, [wAudioROMBank] + ld [wAudioSavedROMBank], a + ld a, BANK(Music_GBPrinter) + ld [wAudioROMBank], a + ld a, MUSIC_GB_PRINTER + ld [wNewSoundID], a + call PlaySound + ret + +Printer_PlayMapMusic: + call Printer_FadeOutMusicAndWait + call PlayDefaultMusic + ret + +Printer_FadeOutMusicAndWait: + ld a, $4 + ld [wAudioFadeOutControl], a + call StopAllMusic +.wait_music_stop + ld a, [wAudioFadeOutControl] + and a + jr nz, .wait_music_stop + ret + +GBPrinter_CheckForErrors: + ld a, [wPrinterHandshake] + cp $81 + jr z, .check_other_errors + ld a, [wPrinterStatusFlags] + cp $ff + jr z, .error2 + xor a + jr .load_status + +.check_other_errors + ld a, [wPrinterStatusFlags] + and %11100000 + ret z + bit 7, a + jr nz, .error1 + bit 6, a + jr nz, .error4 + ; error 3 + ld a, PRINTER_ERROR_3 + jr .load_status + +.error4 + ld a, PRINTER_ERROR_4 + jr .load_status + +.error1 + ld a, PRINTER_ERROR_1 + jr .load_status + +.error2 + ld a, PRINTER_ERROR_2 +.load_status + ld [wPrinterStatusIndicator], a + ret + +GBPrinter_UpdateStatusMessage: + ld a, [wPrinterStatusIndicator] + and a + ret z + push af + xor a + ld [H_AUTOBGTRANSFERENABLED], a + coord hl, 0, 5 + lb bc, 10, 18 + call TextBoxBorder + pop af + ld e, a + ld d, $0 + ld hl, .PrinterStatusMessages + add hl, de + add hl, de + ld e, [hl] + inc hl + ld d, [hl] + coord hl, 1, 7 + call PlaceString + coord hl, 2, 15 + ld de, .PressBToCancel + call PlaceString + ld a, $1 + ld [H_AUTOBGTRANSFERENABLED], a + xor a + ld [wPrinterStatusIndicator], a + ret + +.PressBToCancel: + db "Press B to Cancel@" + +.PrinterStatusMessages: + dw .Blank + dw .CheckingLink + dw .Transmitting + dw .Printing + dw .Error1 + dw .Error2 + dw .Error3 + dw .Error4 + dw .WrongDevice + +.Blank: + db "@" +.CheckingLink: + db "" + next " CHECKING LINK...@" +.Transmitting: + db "" + next " TRANSMITTING...@" +.Printing: + db "" + next " PRINTING...@" +.Error1: + db " Printer Error 1" + next "" + next "Check the Game Boy" + next "Printer Manual.@" +.Error2: + db " Printer Error 2" + next "" + next "Check the Game Boy" + next "Printer Manual.@" +.Error3: + db " Printer Error 3" + next "" + next "Check the Game Boy" + next "Printer Manual.@" +.Error4: + db " Printer Error 4" + next "" + next "Check the Game Boy" + next "Printer Manual.@" +.WrongDevice: + db "This is not the" + next "Game Boy Printer!@" + +Printer_PrepareSurfingMinigameHighScoreTileMap: + call GBPalWhiteOutWithDelay3 + call ClearScreen + ld de, SurfingPikachu2Graphics + ld hl, vChars2 + lb bc, BANK(SurfingPikachu2Graphics), (SurfingPikachu2GraphicsEnd - SurfingPikachu2Graphics) / $10 + call CopyVideoData + coord hl, 0, 0 + call .PlaceRowAlternatingTiles + coord hl, 0, 17 + call .PlaceRowAlternatingTiles + coord hl, 0, 0 + call .PlaceColumnAlternatingTiles + coord hl, 19, 0 + call .PlaceColumnAlternatingTiles + ld a, $4 + coord hl, 0, 0 + ld [hl], a + coord hl, 0, 17 + ld [hl], a + coord hl, 19, 0 + ld [hl], a + coord hl, 19, 17 + ld [hl], a + ld de, .Tilemap1 + coord hl, 10, 8 + lb bc, 3, 8 + call Diploma_Surfing_CopyBox + ld de, .Tilemap2 + coord hl, 2, 11 + lb bc, 6, 16 + call Diploma_Surfing_CopyBox + ld de, .PikachusBeachString + coord hl, 3, 2 + call PlaceString + ld de, .HiScoreString + coord hl, 9, 4 + call PlaceString + ld de, .PointsString + coord hl, 12, 6 + call PlaceString + ld de, wPlayerName + ld hl, wPlayerName + ld bc, 0 +.find_end_of_name + ld a, [hli] + inc c + cp "@" + jr nz, .find_end_of_name + ld a, 8 + sub c + jr nc, .got_name_length + xor a +.got_name_length + ld c, a + coord hl, 2, 4 + add hl, bc + call PlaceString + call CopySurfingMinigameScore + ld b, 8 + call RunPaletteCommand + ld a, $1 + ld [H_AUTOBGTRANSFERENABLED], a + call Delay3 + call GBPalNormal + ret + +.PlaceRowAlternatingTiles: + ld c, SCREEN_WIDTH / 2 +.row_loop + ld [hl], $0 + inc hl + ld [hl], $1 + inc hl + dec c + jr nz, .row_loop + ret + +.PlaceColumnAlternatingTiles: + ld c, SCREEN_HEIGHT / 2 + ld de, SCREEN_WIDTH +.col_loop + ld [hl], $2 + add hl, de + ld [hl], $3 + add hl, de + dec c + jr nz, .col_loop + ret + +.Tilemap1: + db $7f, $7f, $10, $11, $12, $13, $14, $15 + db $0f, $3c, $3d, $3e, $20, $21, $30, $31 + db $4c, $4d, $4e, $50, $34, $1a, $51, $2d + +.Tilemap2: + db $7f, $7f, $7f, $7f, $7f, $7f, $16, $17, $18, $19, $7f, $1b, $1c, $1d, $1e, $1f + db $7f, $7f, $22, $23, $24, $25, $26, $27, $28, $29, $2a, $2b, $2c, $7f, $2e, $2f + db $7f, $7f, $32, $33, $33, $35, $36, $37, $38, $39, $3a, $3b, $7f, $7f, $7f, $3f + db $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $4a, $4b, $40, $40, $40, $4f + db $52, $52, $52, $53, $54, $55, $56, $57, $58, $59, $5a, $5b, $5c, $5d, $5d, $5e + db $7f, $7f, $7f, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $7f, $7f, $7f + +.PikachusBeachString: + db "Pikachu's Beach@" +.HiScoreString: + db "'s Hi-Score@" +.PointsString: + db "Points@" + +Diploma_Surfing_CopyBox: +.y + push bc + push hl +.x + ld a, [de] + inc de + ld [hli], a + dec c + jr nz, .x + pop hl + ld bc, SCREEN_WIDTH + add hl, bc + pop bc + dec b + jr nz, .y + ret + +CopySurfingMinigameScore: + ld de, wSurfingMinigameHiScore + 1 + coord hl, 7, 6 + ld a, [de] + call .BCDConvertScore + ld a, [de] +.BCDConvertScore: + ld c, a + swap a + and $f + add -10 + ld [hli], a + ld a, c + and $f + add -10 + ld [hli], a + dec de + ret + +SurfingPikachu2Graphics: INCBIN "gfx/surfing_pikachu_2.2bpp" +SurfingPikachu2GraphicsEnd: + +PrintPCBox_DrawPage1: + xor a + ld [wBoxNumString], a + call ClearScreen + call PrintPCBox_PlaceHorizontalLines + coord hl, 0, 0 + ld bc, 11 * SCREEN_WIDTH + ld a, " " + call FillMemory + call PrintPCBox_DrawLeftAndRightBorders + call PrintPCBox_DrawTopBorder + coord hl, 4, 4 + ld de, .PokemonListString + call PlaceString + coord hl, 7, 6 + ld de, .BoxString + call PlaceString + coord hl, 11, 6 + ld a, [wCurrentBoxNum] + and $7f + cp 9 + jr c, .less_than_9 + sub 9 + ld [hl], "1" + inc hl + add "0" + jr .placed_box_number + +.less_than_9 + add "1" +.placed_box_number + ld [hl], a + coord hl, 4, 9 + ld de, wBoxSpecies + ld c, $3 + call PrintPCBox_PlaceBoxMonInfo + ret + +.PokemonListString: db "POKéMON LIST@" +.BoxString: db "BOX@" + +PrintPCBox_DrawPage2: + call ClearScreen + call PrintPCBox_PlaceHorizontalLines + call PrintPCBox_DrawLeftAndRightBorders + ld a, [wBoxDataStart] + cp 4 + ret c + coord hl, 4, 0 + ld de, wBoxSpecies + 3 + ld c, 6 + call PrintPCBox_PlaceBoxMonInfo + ret + +PrintPCBox_DrawPage3: + call ClearScreen + call PrintPCBox_PlaceHorizontalLines + call PrintPCBox_DrawLeftAndRightBorders + ld a, [wBoxDataStart] + cp 10 + ret c + coord hl, 4, 0 + ld de, wBoxSpecies + 9 + ld c, 6 + call PrintPCBox_PlaceBoxMonInfo + ret + +PrintPCBox_DrawPage4: + call ClearScreen + call PrintPCBox_PlaceHorizontalLines + call PrintPCBox_DrawLeftAndRightBorders + coord hl, 0, 15 + call PrintPCBox_DrawBottomBorderAtHL + coord hl, 0, 16 + ld bc, 2 * SCREEN_WIDTH + ld a, " " + call FillMemory + ld a, [wBoxDataStart] + cp 16 + ret c + coord hl, 4, 0 + ld de, wBoxSpecies + 15 + ld c, 5 + call PrintPCBox_PlaceBoxMonInfo + ret + +PrintPCBox_PlaceBoxMonInfo: +.loop + ld a, c + and a + jr z, .done + dec c + ld a, [de] + cp $ff + jr z, .done + ld [wd11e], a + push bc + push hl + push de + push hl + ld bc, 12 + ld a, " " + call FillMemory + pop hl + push hl + ld de, SCREEN_WIDTH + add hl, de + ld bc, 12 + ld a, " " + call FillMemory + pop hl + push hl + call GetMonName + pop hl + call PlaceString + push hl + ld hl, wBoxMonNicks + ld bc, NAME_LENGTH + ld a, [wBoxNumString] + call AddNTimes + ld e, l + ld d, h + pop hl + ld bc, SCREEN_WIDTH + 1 + add hl, bc + ld [hl], " " + inc hl + call PlaceString + ld hl, wBoxNumString + inc [hl] + pop de + pop hl + ld bc, 3 * SCREEN_WIDTH + add hl, bc + pop bc + inc de + jr .loop + +.done + ret + +PrintPCBox_DrawTopBorder: + coord hl, 0, 0 + ld a, $79 + ld [hli], a + ld a, $7a + ld c, SCREEN_WIDTH - 2 +.loop + ld [hli], a + dec c + jr nz, .loop + ld a, $7b + ld [hl], a + ret + +PrintPCBox_DrawLeftAndRightBorders: + coord hl, 0, 0 + ld de, SCREEN_WIDTH - 1 + ld c, SCREEN_HEIGHT +.loop + ld a, $7c + ld [hl], a + add hl, de + ld a, $7c + ld [hli], a + dec c + jr nz, .loop + ret + +PrintPCBox_DrawBottomBorder: + coord hl, 0, 17 +PrintPCBox_DrawBottomBorderAtHL: + ld a, $7d + ld [hli], a + ld a, $7a + ld c, SCREEN_WIDTH - 2 +.loop + ld [hli], a + dec c + jr nz, .loop + ld a, $7e + ld [hl], a + ret + +PrintPCBox_PlaceHorizontalLines: + coord hl, 4, 0 + ld c, 6 + call .PlaceHorizontalLine + coord hl, 6, 1 + ld c, 6 +.PlaceHorizontalLine: +.loop + push bc + push hl + ld de, .HorizontalLineString + call PlaceString + pop hl + ld bc, 3 * SCREEN_WIDTH + add hl, bc + pop bc + dec c + jr nz, .loop + ret + +.HorizontalLineString: + db "----------@" diff --git a/engine/printer/serial.asm b/engine/printer/serial.asm new file mode 100755 index 00000000..b5d71596 --- /dev/null +++ b/engine/printer/serial.asm @@ -0,0 +1,622 @@ +StartTransmission_Send9Rows: + ld a, 9 +Printer_StartTransmission: + push af + ld hl, wPrinterData + ld bc, wPrinterDataEnd - wPrinterData + xor a + call Printer_FillMemory + xor a + ld [rSB], a + ld [rSC], a + ld [wPrinterOpcode], a + ld hl, wPrinterConnectionOpen + set 0, [hl] + ld a, [wPrinterSettings] + ld [wPrinterSettingsTempCopy], a + pop af + ld [wPrinterQueueLength], a + ret + +; e87a8 +PrinterTransmissionJumptable: + ld a, [wPrinterSendState] + ld e, a + ld d, 0 + ld hl, .Jumptable + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] + +.Jumptable: + dw Printer_InitSerial ; 00 + dw Printer_CheckConnectionStatus ; 01 + dw Printer_WaitSerial ; 02 + dw Printer_StartTransmittingTilemap ; 03 + dw Printer_TransmissionLoop ; 04 + dw Printer_WaitSerialAndLoopBack2 ; 05 + dw Printer_EndTilemapTransmission ; 06 + dw Printer_TransmissionLoop ; 07 + dw Printer_WaitSerial ; 08 + + dw Printer_SignalSendHeader ; 09 + dw Printer_TransmissionLoop ; 0a + dw Printer_WaitSerial ; 0b + dw Printer_WaitUntilFinished ; 0c + dw Printer_Quit ; 0d + + dw Printer_Next_ ; 0e + dw Printer_WaitSerial ; 0f + dw Printer_SignalLoopBack ; 10 + dw Printer_LoopBack ; 11 + dw Printer_WaitLoopBack ; 12 + dw Printer_WaitLoopBack_ ; 13 + +Printer_Next: + ld hl, wPrinterSendState + inc [hl] + ret + +Printer_Back: + ld hl, wPrinterSendState + dec [hl] + ret + +Printer_Quit: + xor a + ld [wPrinterStatusFlags], a + ld hl, wPrinterSendState + set 7, [hl] + ret + +Printer_Next_: + call Printer_Next + ret + +Printer_LoopBack: + ld a, $1 + ld [wPrinterSendState], a + ret + +Printer_InitSerial: + call ResetPrinterData + ld hl, PrinterDataPacket1 + call CopyPrinterDataHeader + xor a + ld [wPrinterDataSize], a + ld [wPrinterDataSize + 1], a + ld a, [wPrinterQueueLength] + ld [wPrinterRowIndex], a + call Printer_Next + call Printer_PrepareToSend + ld a, PRINTER_STATUS_CHECKING_LINK + ld [wPrinterStatusIndicator], a + ret + +Printer_StartTransmittingTilemap: + call ResetPrinterData + ld hl, wPrinterRowIndex + ld a, [hl] + and a + jr z, Printer_EndTilemapTransmission + ld hl, PrinterDataPacket3 + call CopyPrinterDataHeader + call Printer_Convert2RowsTo2bpp + ld a, (wPrinterSendDataSource1End - wPrinterSendDataSource1) % $100 + ld [wPrinterDataSize], a + ld a, (wPrinterSendDataSource1End - wPrinterSendDataSource1) / $100 + ld [wPrinterDataSize + 1], a + call ComputePrinterChecksum + call Printer_Next + call Printer_PrepareToSend + ld a, PRINTER_STATUS_TRANSMITTING + ld [wPrinterStatusIndicator], a + ret + +Printer_EndTilemapTransmission: + ld a, $6 + ld [wPrinterSendState], a + ld hl, PrinterDataPacket4 + call CopyPrinterDataHeader + xor a + ld [wPrinterDataSize], a + ld [wPrinterDataSize + 1], a + call Printer_Next + call Printer_PrepareToSend + ret + +Printer_SignalSendHeader: + call ResetPrinterData + ld hl, PrinterDataPacket2 + call CopyPrinterDataHeader + call Printer_StageHeaderForSend + ld a, $4 + ld [wPrinterDataSize], a + ld a, $0 + ld [wPrinterDataSize + 1], a + call ComputePrinterChecksum + call Printer_Next + call Printer_PrepareToSend + ld a, PRINTER_STATUS_PRINTING + ld [wPrinterStatusIndicator], a + ret + +Printer_SignalLoopBack: + call ResetPrinterData + ld hl, PrinterDataPacket1 + call CopyPrinterDataHeader + xor a + ld [wPrinterDataSize], a + ld [wPrinterDataSize + 1], a + ld a, [wPrinterQueueLength] + ld [wPrinterRowIndex], a + call Printer_Next + call Printer_PrepareToSend + ret + +Printer_WaitSerial: + ld hl, wPrinterSerialFrameDelay + inc [hl] + ld a, [hl] + cp $6 + ret c + xor a + ld [hl], a + call Printer_Next + ret + +Printer_WaitSerialAndLoopBack2: + ld hl, wPrinterSerialFrameDelay + inc [hl] + ld a, [hl] + cp $6 + ret c + xor a + ld [hl], a + ld hl, wPrinterRowIndex + dec [hl] + call Printer_Back + call Printer_Back + ret + +Printer_CheckConnectionStatus: + ld a, [wPrinterOpcode] + and a + ret nz + ld a, [wPrinterHandshake] + cp $ff + jr nz, .asm_e88dc + ld a, [wPrinterStatusFlags] + cp $ff + jr z, .asm_e88f8 +.asm_e88dc + ld a, [wPrinterHandshake] + cp $81 + jr nz, .asm_e88f8 + ld a, [wPrinterStatusFlags] + cp $0 + jr nz, .asm_e88f8 + ld hl, wPrinterConnectionOpen + set 1, [hl] + ld a, $5 + ld [wHandshakeFrameDelay], a + call Printer_Next + ret + +.asm_e88f8 + ld a, $ff + ld [wPrinterHandshake], a + ld [wPrinterStatusFlags], a + ld a, $e + ld [wPrinterSendState], a + ret + +Printer_TransmissionLoop: + ld a, [wPrinterOpcode] + and a + ret nz + ld a, [wPrinterStatusFlags] + and $f0 + jr nz, .asm_e8921 + ld a, [wPrinterStatusFlags] + and $1 + jr nz, .asm_e891d + call Printer_Next + ret + +.asm_e891d + call Printer_Back + ret + +.asm_e8921 + ld a, $12 + ld [wPrinterSendState], a + ret + +Printer_WaitUntilFinished: + ld a, [wPrinterOpcode] + and a + ret nz + ld a, [wPrinterStatusFlags] + and $f3 + ret nz + call Printer_Next + ret + +Printer_WaitLoopBack: + call Printer_Next +Printer_WaitLoopBack_: + ld a, [wPrinterOpcode] + and a + ret nz + ld a, [wPrinterStatusFlags] + and $f0 + ret nz + xor a + ld [wPrinterSendState], a + ret + +Printer_PrepareToSend: +.wait_printer_operation + ld a, [wPrinterOpcode] + and a + jr nz, .wait_printer_operation + xor a + ld [wPrinterSendByteOffset], a + ld [wPrinterSendByteOffset + 1], a + ld a, $1 + ld [wPrinterOpcode], a + ld a, $88 + ld [rSB], a + ld a, $1 + ld [rSC], a + ld a, $81 + ld [rSC], a + ret + +CopyPrinterDataHeader: + ld a, [hli] + ld [wPrinterDataHeader], a + ld a, [hli] + ld [wPrinterDataHeader + 1], a + ld a, [hli] + ld [wPrinterDataHeader + 2], a + ld a, [hli] + ld [wPrinterDataHeader + 3], a + ld a, [hli] + ld [wPrinterChecksum], a + ld a, [hl] + ld [wPrinterChecksum + 1], a + ret + +ResetPrinterData: + xor a + ld hl, wPrinterDataHeader + ld [hli], a + ld [hli], a + ld [hli], a + ld [hl], a + ld hl, wPrinterChecksum + ld [hli], a + ld [hl], a + xor a + ld [wPrinterDataSize], a + ld [wPrinterDataSize + 1], a + ld hl, wPrinterSendDataSource1 + ld bc, wPrinterSendDataSource1End - wPrinterSendDataSource1 + call Printer_FillMemory + ret + +ComputePrinterChecksum: + ld hl, $0 + ld bc, $4 + ld de, wPrinterDataHeader + call .AddToChecksum + ld a, [wPrinterDataSize] + ld c, a + ld a, [wPrinterDataSize + 1] + ld b, a + ld de, wPrinterSendDataSource1 + call .AddToChecksum + ld a, l + ld [wPrinterChecksum], a + ld a, h + ld [wPrinterChecksum + 1], a + ret + +.AddToChecksum: +.loop + ld a, [de] + inc de + add l + jr nc, .no_carry + inc h +.no_carry + ld l, a + dec bc + ld a, c + or b + jr nz, .loop + ret + +Printer_StageHeaderForSend: + ld a, $1 + ld [wPrinterSendDataSource1], a + ld a, [wcae2] + ld [wPrinterSendDataSource1 + 1], a + ld a, %11100100 + ld [wPrinterSendDataSource1 + 2], a + ld a, [wPrinterSettingsTempCopy] + ld [wPrinterSendDataSource1 + 3], a + ret + +Printer_Convert2RowsTo2bpp: + ld a, [wPrinterRowIndex] + ld b, a + ld a, [wPrinterQueueLength] + sub b + ld hl, wPrinterTileBuffer + ld de, 2 * SCREEN_WIDTH +.get_row + and a + jr z, .got_row + add hl, de + dec a + jr .get_row + +.got_row + ld e, l + ld d, h + ld hl, wPrinterSendDataSource1 + ld c, 2 * SCREEN_WIDTH +.loop + ld a, [de] + inc de + push bc + push de + push hl + swap a + ld d, a + and $f0 + ld e, a + ld a, d + and $f + ld d, a + and $8 + ld a, d + jr nz, .vchars1 + or $90 + jr .got_addr + +.vchars1 + or $80 +.got_addr + ld d, a + lb bc, BANK(Printer_Convert2RowsTo2bpp), 1 + call CopyVideoData + pop hl + ld de, $10 + add hl, de + pop de + pop bc + dec c + jr nz, .loop + ret + +Printer_FillMemory: + push de + ld e, a +.loop + ld [hl], e + inc hl + dec bc + ld a, c + or b + jr nz, .loop + ld a, e + pop de + ret + +PrinterDataPacket1: + db 1, 0, $00, 0 + dw 1 +PrinterDataPacket2: + db 2, 0, $04, 0 + dw 0 +PrinterDataPacket3: + db 4, 0, $80, 2 + dw 0 +PrinterDataPacket4: + db 4, 0, $00, 0 + dw 4 +PrinterDataPacket5: ; unused + db 8, 0, $00, 0 + dw 8 +PrinterDataPacket6: ; unused + db 15, 0, $00, 0 + dw 15 + +PrinterSerial_: + ld a, [wPrinterOpcode] + ld e, a + ld d, 0 + ld hl, .Jumptable + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] + +.Jumptable: + dw .Nop + + dw .SignalTransmissionStart + dw .SendHeaderByte1 + dw .SendHeaderByte2 + dw .SendHeaderByte3 + dw .SendHeaderByte4 + dw .DataByte + dw .SendChecksumLo + dw .SendChecksumHi + dw .SignalTransmissionEnd + dw .Receive1 + dw .Receive2 + + dw .SignalTransmissionStart + dw .Send_0F + dw .Send_00 + dw .Send_00 + dw .Send_00 + dw .Send_0F + dw .Send_00 + dw .SignalTransmissionEnd + dw .Receive1 + dw .Receive2_ + + dw .SignalTransmissionStart + dw .SignalQuit + dw .Send_00 + dw .Send_00 + dw .Send_00 + dw .SignalQuit + dw .Send_00 + dw .SignalTransmissionEnd + dw .Receive1 + dw .Receive2 + +.NextInstruction: + ld hl, wPrinterOpcode + inc [hl] + ret + +.Nop: + ret + +.SignalTransmissionStart: + ld a, $33 + call .SendByte + call .NextInstruction + ret + +.SendHeaderByte1: + ld a, [wPrinterDataHeader] + call .SendByte + call .NextInstruction + ret + +.SendHeaderByte2: + ld a, [wPrinterDataHeader + 1] + call .SendByte + call .NextInstruction + ret + +.SendHeaderByte3: + ld a, [wPrinterDataHeader + 2] + call .SendByte + call .NextInstruction + ret + +.SendHeaderByte4: + ld a, [wPrinterDataHeader + 3] + call .SendByte + call .NextInstruction + ret + +.DataByte: + ld hl, wPrinterDataSize + ld e, [hl] + inc hl + ld d, [hl] + ld a, e + or d + jr z, .sent_last_byte + dec de + ld [hl], d + dec hl + ld [hl], e + ld a, [wPrinterSendByteOffset] + ld e, a + ld a, [wPrinterSendByteOffset + 1] + ld d, a + ld hl, wPrinterSendDataSource1 + add hl, de + inc de + ld a, e + ld [wPrinterSendByteOffset], a + ld a, d + ld [wPrinterSendByteOffset + 1], a + ld a, [hl] + call .SendByte + ret + +.sent_last_byte + call .NextInstruction +.SendChecksumLo: + ld a, [wPrinterChecksum] + call .SendByte + call .NextInstruction + ret + +.SendChecksumHi: + ld a, [wPrinterChecksum + 1] + call .SendByte + call .NextInstruction + ret + +.SignalTransmissionEnd: + ld a, $0 + call .SendByte + call .NextInstruction + ret + +.Receive1: + ld a, [rSB] + ld [wPrinterHandshake], a + ld a, $0 + call .SendByte + call .NextInstruction + ret + +.Receive2: + ld a, [rSB] + ld [wPrinterStatusFlags], a + xor a + ld [wPrinterOpcode], a + ret + +.Send_0F: + ld a, $f + call .SendByte + call .NextInstruction + ret + +.Send_00: + ld a, $0 + call .SendByte + call .NextInstruction + ret + +.SignalQuit: + ld a, $8 + call .SendByte + call .NextInstruction + ret + +.SendByte: + ld [rSB], a + ld a, $1 + ld [rSC], a + ld a, $81 + ld [rSC], a + ret + +.Receive2_: + ld a, [rSB] + ld [wPrinterStatusFlags], a + xor a + ld [wPrinterOpcode], a + ret diff --git a/engine/remove_pokemon.asm b/engine/remove_pokemon.asm new file mode 100644 index 00000000..f29a428d --- /dev/null +++ b/engine/remove_pokemon.asm @@ -0,0 +1,95 @@ +_RemovePokemon: + ld hl, wPartyCount + ld a, [wRemoveMonFromBox] + and a + jr z, .usePartyCount + ld hl, wNumInBox +.usePartyCount + ld a, [hl] + dec a + ld [hli], a + ld a, [wWhichPokemon] + ld c, a + ld b, $0 + add hl, bc + ld e, l + ld d, h + inc de +.shiftMonSpeciesLoop + ld a, [de] + inc de + ld [hli], a + inc a ; reached terminator? + jr nz, .shiftMonSpeciesLoop ; if not, continue shifting species + ld hl, wPartyMonOT + ld d, PARTY_LENGTH - 1 ; max number of pokemon to shift + ld a, [wRemoveMonFromBox] + and a + jr z, .usePartyMonOTs + ld hl, wBoxMonOT + ld d, MONS_PER_BOX - 1 +.usePartyMonOTs + ld a, [wWhichPokemon] + call SkipFixedLengthTextEntries + ld a, [wWhichPokemon] + cp d ; are we removing the last pokemon? + jr nz, .notRemovingLastMon ; if not, shift the pokemon below + ld [hl], $ff ; else, write the terminator and return + ret +.notRemovingLastMon + ld d, h + ld e, l + ld bc, NAME_LENGTH + add hl, bc + ld bc, wPartyMonNicks + ld a, [wRemoveMonFromBox] + and a + jr z, .usePartyMonNicks + ld bc, wBoxMonNicks +.usePartyMonNicks + call CopyDataUntil + ld hl, wPartyMons + ld bc, wPartyMon2 - wPartyMon1 + ld a, [wRemoveMonFromBox] + and a + jr z, .usePartyMonStructs + ld hl, wBoxMons + ld bc, wBoxMon2 - wBoxMon1 +.usePartyMonStructs + ld a, [wWhichPokemon] + call AddNTimes ; get address of the pokemon removed + ld d, h ; store in de for CopyDataUntil + ld e, l + ld a, [wRemoveMonFromBox] + and a + jr z, .copyUntilPartyMonOTs + ld bc, wBoxMon2 - wBoxMon1 + add hl, bc ; get address of pokemon after the pokemon removed + ld bc, wBoxMonOT ; address of when to stop copying + jr .continue +.copyUntilPartyMonOTs + ld bc, wPartyMon2 - wPartyMon1 + add hl, bc ; get address of pokemon after the pokemon removed + ld bc, wPartyMonOT ; address of when to stop copying +.continue + call CopyDataUntil ; shift all pokemon data after the removed mon to the removed mon's location + ld hl, wPartyMonNicks + ld a, [wRemoveMonFromBox] + and a + jr z, .usePartyMonNicks2 + ld hl, wBoxMonNicks +.usePartyMonNicks2 + ld bc, NAME_LENGTH + ld a, [wWhichPokemon] + call AddNTimes + ld d, h + ld e, l + ld bc, NAME_LENGTH + add hl, bc + ld bc, wPartyMonNicksEnd + ld a, [wRemoveMonFromBox] + and a + jr z, .copyUntilPartyMonNicksEnd + ld bc, wBoxMonNicksEnd +.copyUntilPartyMonNicksEnd + jp CopyDataUntil diff --git a/engine/save.asm b/engine/save.asm index 58326187..171fd055 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -32,10 +32,8 @@ FileDataDestroyedText: db "@" LoadSAV0: - ld a, SRAM_ENABLE - ld [MBC1SRamEnable], a + call EnableSRAMAndLatchClockData ld a, $1 - ld [MBC1SRamBankingMode], a ld [MBC1SRamBank], a ld hl, sPlayerName ; hero name located in SRAM ld bc, sMainDataCheckSum - sPlayerName ; but here checks the full SAV @@ -79,10 +77,8 @@ LoadSAV0: jp SAVGoodChecksum LoadSAV1: - ld a, SRAM_ENABLE - ld [MBC1SRamEnable], a + call EnableSRAMAndLatchClockData ld a, $1 - ld [MBC1SRamBankingMode], a ld [MBC1SRamBank], a ld hl, sPlayerName ; hero name located in SRAM ld bc, sMainDataCheckSum - sPlayerName ; but here checks the full SAV @@ -99,10 +95,8 @@ LoadSAV1: jp SAVGoodChecksum LoadSAV2: - ld a, SRAM_ENABLE - ld [MBC1SRamEnable], a + call EnableSRAMAndLatchClockData ld a, $1 - ld [MBC1SRamBankingMode], a ld [MBC1SRamBank], a ld hl, sPlayerName ; hero name located in SRAM ld bc, sMainDataCheckSum - sPlayerName ; but here checks the full SAV @@ -126,9 +120,7 @@ SAVBadCheckSum: scf SAVGoodChecksum: - ld a, $0 - ld [MBC1SRamBankingMode], a - ld [MBC1SRamEnable], a + call DisableSRAMAndPrepareClockData ret LoadSAVIgnoreBadCheckSum: @@ -139,12 +131,16 @@ LoadSAVIgnoreBadCheckSum: SaveSAV: callba PrintSaveScreenText + ld c,10 + call DelayFrames ld hl,WouldYouLikeToSaveText call SaveSAVConfirm and a ;|0 = Yes|1 = No| ret nz + ld c,10 + call DelayFrames ld a,[wSaveFileStatus] - dec a + cp $1 jr z,.save call SAVCheckRandomID jr z,.save @@ -154,24 +150,20 @@ SaveSAV: ret nz .save call SaveSAVtoSRAM - coord hl, 1, 13 - lb bc, 4, 18 - call ClearScreenArea - coord hl, 1, 14 - ld de,NowSavingString - call PlaceString - ld c,120 + ld hl,SavingText + call PrintText + ld c,128 call DelayFrames ld hl,GameSavedText call PrintText - ld a, SFX_SAVE + ld c,10 + call DelayFrames + ld a, $b6 ; SFX_SAVE call PlaySoundWaitForCurrent call WaitForSoundToFinish ld c,30 - jp DelayFrames - -NowSavingString: - db "Now saving...@" + call DelayFrames + ret SaveSAVConfirm: call PrintText @@ -187,6 +179,10 @@ WouldYouLikeToSaveText: TX_FAR _WouldYouLikeToSaveText db "@" +SavingText: + TX_FAR _SavingText + db "@" + GameSavedText: TX_FAR _GameSavedText db "@" @@ -196,10 +192,8 @@ OlderFileWillBeErasedText: db "@" SaveSAVtoSRAM0: - ld a, SRAM_ENABLE - ld [MBC1SRamEnable], a + call EnableSRAMAndLatchClockData ld a, $1 - ld [MBC1SRamBankingMode], a ld [MBC1SRamBank], a ld hl, wPlayerName ld de, sPlayerName @@ -223,17 +217,13 @@ SaveSAVtoSRAM0: ld bc, sMainDataCheckSum - sPlayerName call SAVCheckSum ld [sMainDataCheckSum], a - xor a - ld [MBC1SRamBankingMode], a - ld [MBC1SRamEnable], a + call DisableSRAMAndPrepareClockData ret SaveSAVtoSRAM1: ; stored pokémon - ld a, SRAM_ENABLE - ld [MBC1SRamEnable], a + call EnableSRAMAndLatchClockData ld a, $1 - ld [MBC1SRamBankingMode], a ld [MBC1SRamBank], a ld hl, wBoxDataStart ld de, sCurBoxData @@ -243,16 +233,12 @@ SaveSAVtoSRAM1: ld bc, sMainDataCheckSum - sPlayerName call SAVCheckSum ld [sMainDataCheckSum], a - xor a - ld [MBC1SRamBankingMode], a - ld [MBC1SRamEnable], a + call DisableSRAMAndPrepareClockData ret SaveSAVtoSRAM2: - ld a, SRAM_ENABLE - ld [MBC1SRamEnable], a + call EnableSRAMAndLatchClockData ld a, $1 - ld [MBC1SRamBankingMode], a ld [MBC1SRamBank], a ld hl, wPartyDataStart ld de, sPartyData @@ -262,15 +248,20 @@ SaveSAVtoSRAM2: ld de, sMainData ld bc, wPokedexSeenEnd - wPokedexOwned call CopyData + ld hl, wPikachuHappiness + ld de, sMainData + $179 + ld a, [hli] + ld [de], a + inc de + ld a, [hl] + ld [de], a ld hl, sPlayerName ld bc, sMainDataCheckSum - sPlayerName call SAVCheckSum ld [sMainDataCheckSum], a - xor a - ld [MBC1SRamBankingMode], a - ld [MBC1SRamEnable], a + call DisableSRAMAndPrepareClockData ret - +;;; SaveSAVtoSRAM: ld a, $2 ld [wSaveFileStatus], a @@ -351,13 +342,16 @@ ChangeBox:: call z, EmptyAllSRAMBoxes ; if so, empty all boxes in SRAM call DisplayChangeBoxMenu call UpdateSprites - ld hl, hFlags_0xFFF6 + ld hl, hFlags_0xFFFA set 1, [hl] call HandleMenuInput - ld hl, hFlags_0xFFF6 + ld hl, hFlags_0xFFFA res 1, [hl] bit 1, a ; pressed b ret nz + ld a, $b6 + call PlaySoundWaitForCurrent + call WaitForSoundToFinish call GetBoxSRAMLocation ld e, l ld d, h @@ -380,9 +374,6 @@ ChangeBox:: call SaveSAVtoSRAM ld hl, wChangeBoxSavedMapTextPointer call SetMapTextPointer - ld a, SFX_SAVE - call PlaySoundWaitForCurrent - call WaitForSoundToFinish ret WhenYouChangeBoxText: @@ -392,10 +383,7 @@ WhenYouChangeBoxText: CopyBoxToOrFromSRAM: ; copy an entire box from hl to de with b as the SRAM bank push hl - ld a, SRAM_ENABLE - ld [MBC1SRamEnable], a - ld a, $1 - ld [MBC1SRamBankingMode], a + call EnableSRAMAndLatchClockData ld a, b ld [MBC1SRamBank], a ld bc, wBoxDataEnd - wBoxDataStart @@ -413,9 +401,7 @@ CopyBoxToOrFromSRAM: call SAVCheckSum ld [sBank2AllBoxesChecksum], a ; sBank3AllBoxesChecksum call CalcIndividualBoxCheckSums - xor a - ld [MBC1SRamBankingMode], a - ld [MBC1SRamEnable], a + call DisableSRAMAndPrepareClockData ret DisplayChangeBoxMenu: @@ -436,21 +422,19 @@ DisplayChangeBoxMenu: ld [wCurrentMenuItem], a ld [wLastMenuItem], a coord hl, 0, 0 - ld b, 2 - ld c, 9 + lb bc, 2, 9 call TextBoxBorder ld hl, ChooseABoxText call PrintText coord hl, 11, 0 - ld b, 12 - ld c, 7 + lb bc, 12, 7 call TextBoxBorder - ld hl, hFlags_0xFFF6 + ld hl, hFlags_0xFFFA set 2, [hl] ld de, BoxNames coord hl, 13, 1 call PlaceString - ld hl, hFlags_0xFFF6 + ld hl, hFlags_0xFFFA res 2, [hl] ld a, [wCurrentBoxNum] and $7f @@ -513,19 +497,14 @@ BoxNoText: EmptyAllSRAMBoxes: ; marks all boxes in SRAM as empty (initialisation for the first time the ; player changes the box) - ld a, SRAM_ENABLE - ld [MBC1SRamEnable], a - ld a, $1 - ld [MBC1SRamBankingMode], a + call EnableSRAMAndLatchClockData ld a, 2 ld [MBC1SRamBank], a call EmptySRAMBoxesInBank ld a, 3 ld [MBC1SRamBank], a call EmptySRAMBoxesInBank - xor a - ld [MBC1SRamBankingMode], a - ld [MBC1SRamEnable], a + call DisableSRAMAndPrepareClockData ret EmptySRAMBoxesInBank: @@ -559,19 +538,14 @@ EmptySRAMBox: GetMonCountsForAllBoxes: ld hl, wBoxMonCounts push hl - ld a, SRAM_ENABLE - ld [MBC1SRamEnable], a - ld a, $1 - ld [MBC1SRamBankingMode], a + call EnableSRAMAndLatchClockData ld a, $2 ld [MBC1SRamBank], a call GetMonCountsForBoxesInBank ld a, $3 ld [MBC1SRamBank], a call GetMonCountsForBoxesInBank - xor a - ld [MBC1SRamBankingMode], a - ld [MBC1SRamEnable], a + call DisableSRAMAndPrepareClockData pop hl ; copy the count for the current box from WRAM @@ -604,15 +578,13 @@ SAVCheckRandomID: ;checks if Sav file is the same by checking player's name 1st letter ($a598) ; and the two random numbers generated at game beginning ;(which are stored at wPlayerID)s - ld a,$0a - ld [MBC1SRamEnable],a - ld a,$01 - ld [MBC1SRamBankingMode],a - ld [MBC1SRamBank],a - ld a,[sPlayerName] + call EnableSRAMAndLatchClockData + ld a, $1 + ld [MBC1SRamBank], a + ld a, [sPlayerName] and a - jr z,.next - ld hl,sPlayerName + jr z, .next + ld hl, sPlayerName ld bc, sMainDataCheckSum - sPlayerName call SAVCheckSum ld c,a @@ -638,7 +610,7 @@ SaveHallOfFameTeams: ld a, [wNumHoFTeams] dec a cp HOF_TEAM_CAPACITY - jr nc, .asm_73b28 + jr nc, .shiftHOFTeams ld hl, sHallOfFame ld bc, HOF_TEAM call AddNTimes @@ -648,7 +620,9 @@ SaveHallOfFameTeams: ld bc, HOF_TEAM jr HallOfFame_Copy -.asm_73b28 +.shiftHOFTeams +; if the space designated for HOF teams is full, then shift all HOF teams to the next slot, making space for the new HOF team +; this deletes the last HOF team though ld hl, sHallOfFame + HOF_TEAM ld de, sHallOfFame ld bc, HOF_TEAM * (HOF_TEAM_CAPACITY - 1) @@ -668,34 +642,23 @@ LoadHallOfFameTeams: ; fallthrough HallOfFame_Copy: - ld a, SRAM_ENABLE - ld [MBC1SRamEnable], a - ld a, $1 - ld [MBC1SRamBankingMode], a + call EnableSRAMAndLatchClockData xor a ld [MBC1SRamBank], a call CopyData - xor a - ld [MBC1SRamBankingMode], a - ld [MBC1SRamEnable], a + call DisableSRAMAndPrepareClockData ret ClearSAV: - ld a, SRAM_ENABLE - ld [MBC1SRamEnable], a - ld a, $1 - ld [MBC1SRamBankingMode], a - xor a - call PadSRAM_FF - ld a, $1 - call PadSRAM_FF - ld a, $2 - call PadSRAM_FF - ld a, $3 + call EnableSRAMAndLatchClockData + ld a, $4 +.loop + dec a + push af call PadSRAM_FF - xor a - ld [MBC1SRamBankingMode], a - ld [MBC1SRamEnable], a + pop af + jr nz, .loop + call DisableSRAMAndPrepareClockData ret PadSRAM_FF: @@ -704,3 +667,16 @@ PadSRAM_FF: ld bc, $2000 ld a, $ff jp FillMemory + +EnableSRAMAndLatchClockData: + ld a, $1 + ld [MBC1SRamBankingMode], a + ld a, SRAM_ENABLE + ld [MBC1SRamEnable], a + ret + +DisableSRAMAndPrepareClockData: + ld a, SRAM_DISABLE + ld [MBC1SRamBankingMode], a + ld [MBC1SRamEnable], a + ret diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index 733cc29c..769a3f37 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -23,9 +23,11 @@ PromptUserToPlaySlots: call LoadFontTilePatterns ld b, SET_PAL_SLOTS call RunPaletteCommand + call Delay3 call GBPalNormal ld a, $e4 ld [rOBP0], a + call UpdateGBCPal_OBP0 ld hl, wd730 set 6, [hl] xor a @@ -80,8 +82,7 @@ MainSlotMachineLoop: ld [wLastMenuItem], a ld [wMenuWatchMovingOutOfBounds], a coord hl, 14, 11 - ld b, 5 - ld c, 4 + lb bc, 5, 4 call TextBoxBorder coord hl, 16, 12 ld de, CoinMultiplierSlotMachineText @@ -457,6 +458,7 @@ SlotMachine_CheckForMatches: ld a, [rBGP] xor $40 ld [rBGP], a + call UpdateGBCPal_BGP ld c, 5 call DelayFrames dec b @@ -473,6 +475,7 @@ SlotMachine_CheckForMatches: call SlotMachine_PrintPayoutCoins ld a, $e4 ld [rOBP0], a + call UpdateGBCPal_OBP0 jp .done SymbolLinedUpSlotMachineText: @@ -697,6 +700,7 @@ SlotMachine_PayCoinsToPlayer: ld a, [rOBP0] xor $40 ; make the slot wheel symbols flash ld [rOBP0], a + call UpdateGBCPal_OBP0 ld a, 5 .skip1 ld [wAnimCounter], a @@ -851,20 +855,20 @@ LoadSlotMachineTiles: ld de, vChars0 ld bc, $1c0 ld a, BANK(SlotMachineTiles2) - call FarCopyData2 + call FarCopyData ld hl, SlotMachineTiles1 ld de, vChars2 ld bc, $250 ld a, BANK(SlotMachineTiles1) - call FarCopyData2 + call FarCopyData ld hl, SlotMachineTiles2 ld de, vChars2 + $250 ld bc, $1c0 ld a, BANK(SlotMachineTiles2) - call FarCopyData2 + call FarCopyData ld hl, SlotMachineMap coord de, 0, 0 - ld bc, $00f0 + ld bc, SlotMachineMapEnd - SlotMachineMap call CopyData call EnableLCD ld hl, wSlotMachineWheel1Offset @@ -878,13 +882,9 @@ LoadSlotMachineTiles: SlotMachineMap: INCBIN "gfx/tilemaps/slotmachine.map" +SlotMachineMapEnd: INCLUDE "data/slot_machine_wheels.asm" SlotMachineTiles1: -IF DEF(_RED) - INCBIN "gfx/red/slotmachine1.2bpp" -ENDC -IF DEF(_BLUE) - INCBIN "gfx/blue/slotmachine1.2bpp" -ENDC + INCBIN "gfx/slotmachine1.2bpp" diff --git a/engine/subtract_paid_money.asm b/engine/subtract_paid_money.asm new file mode 100644 index 00000000..a6a6ec2e --- /dev/null +++ b/engine/subtract_paid_money.asm @@ -0,0 +1,17 @@ +; subtracts the amount the player paid from their money +; sets carry flag if there is enough money and unsets carry flag if not +SubtractAmountPaidFromMoney_: + ld de, wPlayerMoney + ld hl, hMoney ; total price of items + ld c, 3 ; length of money in bytes + call StringCmp + ret c + ld de, wPlayerMoney + 2 + ld hl, hMoney + 2 ; total price of items + ld c, 3 ; length of money in bytes + predef SubBCDPredef ; subtract total price from money + ld a, MONEY_BOX + ld [wTextBoxID], a + call DisplayTextBoxID ; redraw money text box + and a + ret diff --git a/engine/surfing_minigame.asm b/engine/surfing_minigame.asm new file mode 100755 index 00000000..48aaca53 --- /dev/null +++ b/engine/surfing_minigame.asm @@ -0,0 +1,2862 @@ +SurfingPikachuMinigame: + call SurfingPikachuMinigame_BlankPals + call DelayFrame + call DelayFrame + call DelayFrame + ld a, [hTilesetType] + push af + xor a + ld [hTilesetType], a + ld a, [wUpdateSpritesEnabled] + push af + ld a, $ff + ld [wUpdateSpritesEnabled], a + ld a, [rIE] + push af + xor a + ld [rIF], a + ld a, $f + ld [rIE], a + ld a, $8 + ld [rSTAT], a + ld a, [H_AUTOBGTRANSFERDEST + 1] + push af + ld a, $98 + ld [H_AUTOBGTRANSFERDEST + 1], a + call SurfingPikachuMinigameIntro + call SurfingPikachuLoop + xor a + ld [rBGP], a + ld [rOBP0], a + ld [rOBP1], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 + call ClearObjectAnimationBuffers + call ClearSprites + xor a + ld [hLCDCPointer], a + ld [hSCX], a + ld [hSCY], a + ld a, $90 + ld [hWY], a + call DelayFrame + pop af + ld [H_AUTOBGTRANSFERDEST + 1], a + xor a + ld [rIF], a + pop af + ld [rIE], a + xor a + ld [rSTAT], a + call RunDefaultPaletteCommand + call ReloadMapAfterSurfingMinigame + call PlayDefaultMusic + call GBPalNormal + pop af + ld [wUpdateSpritesEnabled], a + pop af + ld [hTilesetType], a + ret + +SurfingPikachuLoop: + call SurfingPikachuMinigame_LoadGFXAndLayout + call DelayFrame + ld b, $e + call RunPaletteCommand +.loop + ld a, [wSurfingMinigameRoutineNumber] + bit 7, a + ret nz + call SurfingPikachu_GetJoypad_3FrameBuffer + call SurfingPikachu_CheckPressedSelect + ret nz + call RunSurfingMinigameRoutine + ld a, $3c + ld [wCurrentAnimatedObjectOAMBufferOffset], a + call RunObjectAnimations + call Func_f8848 + call .DelayFrame + call SurfingMinigame_UpdateMusicTempo + jr .loop + +.DelayFrame: + call DelayFrame + ret + +SurfingPikachu_CheckPressedSelect: + ld hl, wd492 + bit 1, [hl] + ret z + ld a, [hJoyPressed] + and SELECT + ret + +Func_f80b7: + ld a, [hJoyPressed] + and START + ret z + ld hl, wc5e2 + ld a, [hl] + xor $1 + ld [hl], a + ret + +SurfingMinigame_UpdateMusicTempo: + ld a, [wc634] + and a + ret z + + ; check that all channels are on their last frame of note delay + ld hl, wChannelNoteDelayCounters + ld a, $1 + cp [hl] + ret nz + inc hl + cp [hl] + ret nz + inc hl + cp [hl] + ret nz + + ; de = ([wc5e3] & 0x3f) * 2 + ld a, [wc5e3] + ld e, a + ld a, [wc5e3 + 1] + and $3 + ld d, a + sla e + rl d + ld e, d + ld d, $0 + ld hl, .Tempos + add hl, de + add hl, de + ld a, [hli] + ld [wMusicTempo + 1], a + ld a, [hl] + ld [wMusicTempo], a + ret + +.Tempos: + dw 117 + dw 109 + dw 101 + dw 93 + dw 85 + +SurfingMinigame_ResetMusicTempo: + ld hl, wChannelNoteDelayCounters + ld a, $1 + cp [hl] + ret nz + inc hl + cp [hl] + ret nz + inc hl + cp [hl] + ret nz + ld a, 117 + ld [wMusicTempo + 1], a + xor a + ld [wMusicTempo], a + ret + +SurfingPikachuMinigame_LoadGFXAndLayout: + call SurfingPikachu_ClearTileMap + call ClearSprites + call DisableLCD + ld hl, wSurfingMinigameData + ld bc, wSurfingMinigameDataEnd - wSurfingMinigameData + xor a + call FillMemory + ld hl, wLYOverrides + ld bc, wLYOverridesBufferEnd - wLYOverrides + xor a + call FillMemory + xor a + ld [H_AUTOBGTRANSFERENABLED], a + call ClearObjectAnimationBuffers + + ld hl, SurfingPikachu1Graphics1 + ld de, $9000 + ld bc, $500 + ld a, BANK(SurfingPikachu1Graphics1) + call FarCopyData + + ld hl, SurfingPikachu1Graphics2 + ld de, $8000 + ld bc, $1000 + ld a, BANK(SurfingPikachu1Graphics2) + call FarCopyData + + ld a, SurfingPikachuSpawnStateDataPointer % $100 + ld [wAnimatedObjectSpawnStateDataPointer], a + ld a, SurfingPikachuSpawnStateDataPointer / $100 + ld [wAnimatedObjectSpawnStateDataPointer + 1], a + + ld a, SurfingPikachuObjectJumptable % $100 + ld [wAnimatedObjectJumptablePointer], a + ld a, SurfingPikachuObjectJumptable / $100 + ld [wAnimatedObjectJumptablePointer + 1], a + + ld a, SurfingPikachuOAMData % $100 + ld [wAnimatedObjectOAMDataPointer], a + ld a, SurfingPikachuOAMData / $100 + ld [wAnimatedObjectOAMDataPointer + 1], a + + ld a, SurfingPikachuFrames % $100 + ld [wAnimatedObjectFramesDataPointer], a + ld a, SurfingPikachuFrames / $100 + ld [wAnimatedObjectFramesDataPointer + 1], a + + ld hl, vBGMap0 + ld bc, $800 + ld a, $0 + call FillMemory + + ld hl, $98c0 + ld bc, $180 + ld a, $b + call FillMemory + + ld a, $1 + lb de, $74, $58 + call SpawnAnimatedObject + + ld a, $74 + ld [wSurfingMinigamePikachuObjectHeight], a + + call SurfingMinigame_InitScanlineOverrides + + xor a + ld [hSCX], a + ld [hSCY], a + ld a, $7e + ld [hWY], a + ld a, rSCY - $ff00 + ld [hLCDCPointer], a + ld a, $40 + ld [wc5e3], a + xor a + ld [wc5e3 + 1], a + xor a + ld [wSurfingMinigamePikachuHP], a + ld a, $60 + ld [wSurfingMinigamePikachuHP + 1], a + ld hl, wSurfingMinigameWaveHeight + ld bc, $14 + ld a, $74 + call FillMemory + call Func_f81ff + call Func_f8256 + ld a, $e3 + ld [rLCDC], a + call SurfingPikachuMinigame_SetBGPals + ld a, $e4 + ld [rOBP0], a + ld a, $e0 + ld [rOBP1], a + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 + ret + +SurfingPikachuMinigame_SetBGPals: + ld a, [wOnSGB] + and a + jr nz, .sgb + ld a, $d0 + ld [rBGP], a + call UpdateGBCPal_BGP + ret + +.sgb + ld a, $e4 + ld [rBGP], a + call UpdateGBCPal_BGP + ret + +Func_f81ff: + ld hl, wSpriteDataEnd + ld de, Unkn_f8249 + ld b, $97 + ld c, $80 + ld a, $4 + call Func_f8233 + ld de, Unkn_f8248 + ld b, $96 + ld c, $50 + ld a, $1 + call Func_f8233 + ld de, Unkn_f824d + ld b, $14 + ld c, $20 + ld a, $5 + call Func_f8233 + ld de, Unkn_f8252 + ld b, $20 + ld c, $80 + ld a, $4 + call Func_f8233 + ret + +Func_f8233: +.asm_f8233 + push af + ld [hl], b + inc hl + ld [hl], c + inc hl + ld a, [de] + ld [hl], a + inc hl + ld [hl], $0 + inc hl + ld a, c + add $8 + ld c, a + inc de + pop af + dec a + jr nz, .asm_f8233 + ret + +Unkn_f8248: + db $fe + +Unkn_f8249: + db $d0 + db $d0 + db $d0 + db $d0 + +Unkn_f824d: + db $ec + db $ed + db $ed + db $ee + db $ef + +Unkn_f8252: + db $ec + db $ed + db $ee + db $ef + +Func_f8256: + ld de, $9c21 + ld hl, Unkn_f8279 + ld c, $9 +.asm_f825e + ld a, [hli] + ld [de], a + inc de + dec c + jr nz, .asm_f825e + ld hl, $9c01 + ld [hl], $15 + ld hl, $9c02 + ld [hl], $16 + ld hl, $9c2c + ld [hl], $1b + ld hl, $9c2d + ld [hl], $1c + ret + +Unkn_f8279: + db $17 + db $18 + db $19 + db $19 + db $19 + db $19 + db $19 + db $19 + db $19 + +RunSurfingMinigameRoutine: + ld a, [wSurfingMinigameRoutineNumber] + ld e, a + ld d, $0 + ld hl, .Jumptable + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] + +.Jumptable: + dw SurfingMinigameRoutine_SpawnPikachu ; 0 + dw SurfingMinigame_RunGame ; 1 + dw Func_f8324 ; 2 + dw Func_f835c ; 3 + dw SurfingMinigame_DrawResultsScreenAndWait ; 4 + dw SurfingMinigame_WriteHPLeftAndWait ; 5 + dw SurfingMinigame_WriteRadnessAndWait ; 6 + dw SurfingMinigame_WriteTotalAndWait ; 7 + dw SurfingMinigame_AddRemainingHPToTotalAndWait ; 8 + dw SurfingMinigame_AddRadnessToTotalAndWait ; 9 + dw SurfingMinigame_WaitLast ; a + dw SurfingMinigame_ExitOnPressA ; b + dw SurfingMinigame_GameOver ; c + +SurfingMinigameRoutine_SpawnPikachu: + ld a, $2 + lb de, $48, $e0 + call SpawnAnimatedObject + ld hl, wSurfingMinigameRoutineNumber + inc [hl] + ld a, $1 + ld [wc634], a + ret + +SurfingMinigame_RunGame: + ld a, [wc5e5] + cp $18 + jr nc, .asm_f82e8 + ld hl, wSurfingMinigamePikachuHP + ld a, [hli] + or [hl] + and a + jr z, .dead + call Random + ld [wc5d5], a + call SurfingMinigame_UpdateLYOverrides + call Func_f88ae + call Func_f886b + call Func_f8cb0 + call Func_f844c + call SurfingMinigame_Deduct1HP + call Func_f88fd + ret + +.asm_f82e8 + ld hl, wSurfingMinigameRoutineNumber + inc [hl] + xor a + ld [wc634], a + ld a, 192 + ld [wSurfingMinigameRoutineDelay], a + ret + +.dead + ld a, $1 + ld [wc630], a + ld a, $c + ld [wSurfingMinigameRoutineNumber], a + ld a, $80 + ld [wc631], a + ld a, $b + lb de, $88, $58 + call SpawnAnimatedObject + ld hl, ANIM_OBJ_Y_OFFSET + add hl, bc + ld [hl], $80 + ld hl, ANIM_OBJ_FIELD_B + add hl, bc + ld [hl], $80 + ld hl, ANIM_OBJ_FIELD_C + add hl, bc + ld [hl], $30 + xor a + ld [wc634], a + ret + +Func_f8324: + call SurfingMinigame_RunDelayTimer + jr c, .done_delay + xor a + ld [wc5d5], a + call SurfingMinigame_UpdateLYOverrides + call Func_f88ae + call Func_f886b + call Func_f8c97 + call SurfingMinigame_ResetMusicTempo + ret + +.done_delay + ld hl, wSurfingMinigameRoutineNumber + inc [hl] + ld a, $90 + ld [hSCX], a + ld a, $72 + ld [wSurfingMinigameWaveFunctionNumber], a + ld a, $4 + ld [wc5d2], a + xor a + ld [hLCDCPointer], a + ld [wSurfingMinigameSCX], a + ld [wSurfingMinigameSCX + 1], a + ld [wSurfingMinigameSCX + 2], a + ret + +Func_f835c: + ld a, [hSCX] + and a + jr z, .asm_f837b + call SurfingMinigame_UpdateLYOverrides + call Func_f88ae + call Func_f886b + ld a, [hSCX] + dec a + dec a + dec a + dec a + ld [hSCX], a + ld a, $e0 + ld [wSurfingMinigameXOffset], a + call Func_f8cc7 + ret + +.asm_f837b + xor a + ld [wc5e3], a + ld [wc5e3 + 1], a + ld hl, wSurfingMinigameRoutineNumber + inc [hl] + ld a, $5 + ld [wc5d2], a + ret + +SurfingMinigame_DrawResultsScreenAndWait: + call SurfingMinigame_DrawResultsScreen + ld a, 32 + ld [wSurfingMinigameRoutineDelay], a + ld hl, wSurfingMinigameRoutineNumber + inc [hl] + ret + +SurfingMinigame_WriteHPLeftAndWait: + call SurfingMinigame_RunDelayTimer + ret nc + call SurfingMinigame_WriteHPLeft + ld a, 64 + ld [wSurfingMinigameRoutineDelay], a + ld hl, wSurfingMinigameRoutineNumber + inc [hl] + ret + +SurfingMinigame_WriteRadnessAndWait: + call SurfingMinigame_RunDelayTimer + ret nc + call SurfingMinigame_WriteRadness + ld a, 64 + ld [wSurfingMinigameRoutineDelay], a + ld hl, wSurfingMinigameRoutineNumber + inc [hl] + ret + +SurfingMinigame_WriteTotalAndWait: + call SurfingMinigame_RunDelayTimer + ret nc + call SurfingMinigame_WriteTotal + ld a, 64 + ld [wSurfingMinigameRoutineDelay], a + ld hl, wSurfingMinigameRoutineNumber + inc [hl] + ret + +SurfingMinigame_AddRemainingHPToTotalAndWait: + call SurfingMinigame_RunDelayTimer + ret nc + call SurfingMinigame_AddRemainingHPToTotal + push af + call SurfingMinigame_BCDPrintTotalScore + pop af + ret nc + ld a, 64 + ld [wSurfingMinigameRoutineDelay], a + ld hl, wSurfingMinigameRoutineNumber + inc [hl] + ret + +SurfingMinigame_AddRadnessToTotalAndWait: + call SurfingMinigame_RunDelayTimer + ret nc + call SurfingMinigame_AddRadnessToTotal + push af + call SurfingMinigame_BCDPrintTotalScore + pop af + ret nc + ld a, 128 + ld [wSurfingMinigameRoutineDelay], a + ld hl, wSurfingMinigameRoutineNumber + inc [hl] + call DidPlayerGetAHighScore + ret nc + call SurfingMinigame_PrintTextHiScore + ld a, $6 + ld [wc5d2], a + ret + +SurfingMinigame_WaitLast: + call SurfingMinigame_RunDelayTimer + ret nc + ld hl, wSurfingMinigameRoutineNumber + inc [hl] + ret + +SurfingMinigame_ExitOnPressA: + call SurfingMinigame_UpdateLYOverrides + ld a, [hJoyPressed] + and A_BUTTON + ret z + ld hl, wSurfingMinigameRoutineNumber + set 7, [hl] + ret + +SurfingMinigame_GameOver: + call SurfingMinigame_UpdateLYOverrides + call Func_f88ae + call Func_f886b + call Func_f8cb0 + call SurfingMinigame_ResetMusicTempo + ld hl, wc631 + ld a, [hl] + and a + jr z, .wait_press_a + dec [hl] + ret + +.wait_press_a + ld a, [hJoyPressed] + and A_BUTTON + ret z + ld hl, wSurfingMinigameRoutineNumber + set 7, [hl] + ret + +SurfingMinigame_RunDelayTimer: + ld hl, wSurfingMinigameRoutineDelay + ld a, [hl] + and a + jr z, .set_carry + dec [hl] + and a + ret + +.set_carry + scf + ret + +Func_f844c: + ld a, [wc5e5 + 1] + ld h, a + ld a, [wc5e5 + 2] + ld l, a + ld a, [wc5e3] + ld e, a + ld a, [wc5e3 + 1] + ld d, a + add hl, de + ld a, h + ld [wc5e5 + 1], a + ld a, l + ld [wc5e5 + 2], a + ret nc + ld hl, wc5e5 + inc [hl] + ld hl, wOAMBuffer + 4 * 4 + 1 + dec [hl] + dec [hl] + ret + +SurfingMinigameAnimatedObjectFn_Pikachu + ld a, [wc5d2] + ld e, a + ld d, $0 + ld hl, Jumptable_f847f + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] + +Jumptable_f847f: + dw Func_f848d + dw SurfingMinigame_ScoreCurrentWave + dw Func_f8516 + dw Func_f8545 + dw Func_f8561 + dw Func_f856d + dw Func_f8579 + +Func_f848d: + ld a, [wc630] + and a + jr nz, .asm_f84d2 + call Func_f87b5 + ld a, [wSurfingMinigamePikachuObjectHeight] + ld hl, ANIM_OBJ_Y_COORD + add hl, bc + ld [hl], a + call Func_f871e + jr c, .splash + call Func_f8742 + call Func_f86b8 + ret + +.splash + call Func_f8742 + ld a, $1 ; on a wave + ld [wc5d2], a + xor a + ld hl, ANIM_OBJ_FIELD_C + add hl, bc + ld [hl], a + ld hl, ANIM_OBJ_FIELD_D + add hl, bc + ld [hl], a + ld hl, ANIM_OBJ_FIELD_E + add hl, bc + ld [hl], a + ld [wSurfingMinigameRadnessMeter], a + ld [wSurfingMinigameTrickFlags], a + xor a + ld [wChannelSoundIDs + CH7], a + ld a, SFX_UNKNOWN_801B3_4 + call PlaySound + ret + +.asm_f84d2 + xor a + ld [wc5e3], a + ld [wc5e3 + 1], a + ld a, $4 + ld [wc5d2], a + call Func_f8742 + ret + +SurfingMinigame_ScoreCurrentWave: + call SurfingMinigame_DPadAction + call SurfingMinigame_UpdatePikachuHeight + ret nc + call SurfingMinigame_TileInteraction + jr c, .splash + call SurfingMinigame_CalculateAndAddRadnessFromStunt + ld hl, ANIM_OBJ_FIELD_C + add hl, bc + ld [hl], $0 + ld a, $2 + ld [wc5d2], a + ret + +.splash + ld a, $3 + ld [wc5d2], a + ld a, $60 + ld [wc5e1], a + ld a, $10 + call SetCurrentAnimatedObjectCallbackAndResetFrameStateRegisters + xor a + ld [wChannelSoundIDs + CH7], a + ld a, SFX_UNKNOWN_801B9_4 + call PlaySound + ret + +Func_f8516: + ld hl, ANIM_OBJ_FIELD_C + add hl, bc + ld a, [hl] + cp $20 + jr nc, .asm_f8539 + inc [hl] + inc [hl] + inc [hl] + inc [hl] + ld d, $4 + call SurfingPikachu_Sine + ld hl, ANIM_OBJ_Y_OFFSET + add hl, bc + ld [hl], a + call Func_f87b5 + ld a, [wSurfingMinigamePikachuObjectHeight] + ld hl, ANIM_OBJ_Y_COORD + add hl, bc + ld [hl], a + ret + +.asm_f8539 + ld hl, ANIM_OBJ_Y_OFFSET + add hl, bc + ld [hl], $0 + ld a, $0 + ld [wc5d2], a + ret + +Func_f8545: + ld hl, wc5e1 + ld a, [hl] + and a + jr z, .asm_f8556 + dec [hl] + ld a, [wSurfingMinigamePikachuObjectHeight] + ld hl, ANIM_OBJ_Y_COORD + add hl, bc + ld [hl], a + ret + +.asm_f8556 + ld a, $0 + ld [wc5d2], a + ld a, $4 + call SetCurrentAnimatedObjectCallbackAndResetFrameStateRegisters + ret + +Func_f8561: + ld a, [wSurfingMinigamePikachuObjectHeight] + ld hl, ANIM_OBJ_Y_COORD + add hl, bc + ld [hl], a + call Func_f8742 + ret + +Func_f856d: + ld a, $f + call SetCurrentAnimatedObjectCallbackAndResetFrameStateRegisters + ld hl, ANIM_OBJ_FIELD_C + add hl, bc + ld [hl], $0 + ret + +Func_f8579: + ld hl, ANIM_OBJ_FIELD_C + add hl, bc + ld a, [hl] + inc [hl] + inc [hl] + and $3f + cp $20 + jr c, .asm_f8591 + ld d, $10 + call SurfingPikachu_Sine + ld hl, ANIM_OBJ_Y_OFFSET + add hl, bc + ld [hl], a + ret + +.asm_f8591 + ld hl, ANIM_OBJ_Y_OFFSET + add hl, bc + ld [hl], $0 + ret + +SurfingMinigame_DPadAction: + ld de, hJoy5 + ld a, [de] + and D_LEFT + jr nz, .d_left + ld a, [de] + and D_RIGHT + jr nz, .d_right + ret + +.d_left + ld hl, ANIM_OBJ_FIELD_E + add hl, bc + ld [hl], $0 + ld hl, ANIM_OBJ_FIELD_D + add hl, bc + ld a, [hl] + inc [hl] + cp $b + jr c, .d_left_skip + call .StartTrick + ld hl, wSurfingMinigameTrickFlags + set 0, [hl] +.d_left_skip + ld hl, ANIM_OBJ_FRAME_SET + add hl, bc + ld a, [hl] + cp $e + jr nc, .d_left_reset + inc [hl] + ret + +.d_left_reset + ld [hl], $1 + ret + +.d_right + ld hl, ANIM_OBJ_FIELD_D + add hl, bc + ld [hl], $0 + ld hl, ANIM_OBJ_FIELD_E + add hl, bc + ld a, [hl] + inc [hl] + cp $d + jr c, .d_right_skip + call .StartTrick + ld hl, wSurfingMinigameTrickFlags + set 1, [hl] +.d_right_skip + ld hl, ANIM_OBJ_FRAME_SET + add hl, bc + ld a, [hl] + cp $1 + jr z, .d_right_reset + dec [hl] + ret + +.d_right_reset + ld [hl], $e + ret + +.StartTrick: + call SurfingMinigame_IncreaseRadnessMeter + xor a + ld hl, ANIM_OBJ_FIELD_D + add hl, bc + ld [hl], a + ld hl, ANIM_OBJ_FIELD_E + add hl, bc + ld [hl], a + ld a, SFX_UNKNOWN_801B6_4 + call PlaySound + ret + +SurfingMinigame_TileInteraction: + ld hl, ANIM_OBJ_FRAME_SET + add hl, bc + ld a, [wSurfingMinigameBGMapReadBuffer] + cp $6 + jr z, .tile_06 + cp $14 + jr z, .tile_14 + cp $12 + jr z, .tile_12 + cp $7 + jr z, .tile_07 + ld a, [hl] + cp $1 + jp z, .action_0 + cp $2 + jr z, .action_1 + cp $3 + jr z, .action_2 + cp $4 + jr z, .action_3 + cp $5 + jr z, .action_2 + cp $6 + jr z, .action_1 + cp $7 + jr z, .action_0 + jr .action_0 + +.tile_06 + ld a, [hl] + cp $1 + jr z, .action_0 + cp $2 + jr z, .action_0 + cp $3 + jr z, .action_0 + cp $4 + jr z, .action_1 + cp $5 + jr z, .action_2 + cp $6 + jr z, .action_3 + cp $7 + jr z, .action_2 + jr .action_0 + +.tile_07 + ld a, [hl] + cp $1 + jr z, .action_2 + cp $2 + jr z, .action_3 + cp $3 + jr z, .action_2 + cp $4 + jr z, .action_1 + cp $5 + jr z, .action_0 + cp $6 + jr z, .action_0 + cp $7 + jr z, .action_0 + jr .action_0 + +.tile_12 +.tile_14 + ld a, [hl] + cp $1 + jr z, .action_0 + cp $2 + jr z, .action_1 + cp $3 + jr z, .action_2 + cp $4 + jr z, .action_3 + cp $5 + jr z, .action_3 + cp $6 + jr z, .action_2 + cp $7 + jr z, .action_1 + jr .action_0 + +.action_1 + call Subtract128Fromwc5e3 + jr .action_3 + +.action_2 + call Subtract64Fromwc5e3 +.action_3 + xor a + ld [wChannelSoundIDs + CH7], a + ld a, SFX_UNKNOWN_801BF_4 + call PlaySound + and a + ret + +.action_0 + ld a, $40 + ld [wc5e3], a + xor a + ld [wc5e3 + 1], a + scf + ret + +Func_f86b8: + ld a, [wc5e3 + 1] + cp $2 + ret nc + ld h, a + ld a, [wc5e3] + ld l, a + ld de, $2 + add hl, de + ld a, h + ld [wc5e3 + 1], a + ld a, l + ld [wc5e3], a + ret + +Subtract64Fromwc5e3: + ld a, [wc5e3 + 1] + and a + jr nz, .go + ld a, [wc5e3] + cp $40 + jr nc, .go + xor a + ld [wc5e3], a + ret + +.go + ld a, [wc5e3 + 1] + ld h, a + ld a, [wc5e3] + ld l, a + ld de, -$40 + add hl, de + ld a, h + ld [wc5e3 + 1], a + ld a, l + ld [wc5e3], a + ret + +Subtract128Fromwc5e3: + ld a, [wc5e3 + 1] + and a + jr nz, .go + ld a, [wc5e3] + cp $80 + jr nc, .go + xor a + ld [wc5e3], a + ret + +.go + ld a, [wc5e3 + 1] + ld h, a + ld a, [wc5e3] + ld l, a + ld de, -$80 + add hl, de + ld a, h + ld [wc5e3 + 1], a + ld a, l + ld [wc5e3], a + ret + +Func_f871e: + ld a, [hSCX] + and $7 + cp $3 + jr c, .asm_f8740 + cp $5 + jr nc, .asm_f8740 + ld a, [wSurfingMinigameBGMapReadBuffer] + cp $14 + jr nz, .asm_f8740 + call Func_f87a8 + cp $a + jr c, .asm_f8740 + ld [wc5ec], a + call Func_f9284 + scf + ret + +.asm_f8740 + and a + ret + +Func_f8742: + ld a, [hSCX] + and $7 + cp $3 + ret c + cp $5 + ret nc + ld a, [wSurfingMinigameBGMapReadBuffer] + cp $6 + jr z, .asm_f8766 + cp $14 + jr z, .asm_f8766 + cp $7 + jr z, .asm_f876a + call Func_f8778 + ld a, $4 + ld hl, ANIM_OBJ_FRAME_SET + add hl, bc + ld [hl], a + ret + +.asm_f8766 + ld a, $6 + jr .asm_f876c + +.asm_f876a + ld a, $2 +.asm_f876c + ld e, a + ld a, [wc5de] + dec a + add e + ld hl, ANIM_OBJ_FRAME_SET + add hl, bc + ld [hl], a + ret + +Func_f8778: + ld hl, wc5e0 + ld a, [hl] + inc [hl] + and $7 + ret nz + ld a, [wc5df] + and a + jr z, .asm_f8796 + ld a, [wc5de] + and a + jr z, .asm_f8791 + dec a + ld [wc5de], a + ret + +.asm_f8791 + xor a + ld [wc5df], a + ret + +.asm_f8796 + ld a, [wc5de] + cp $2 + jr z, .asm_f87a2 + inc a + ld [wc5de], a + ret + +.asm_f87a2 + ld a, $1 + ld [wc5df], a + ret + +Func_f87a8: + ld a, [wc5e3] + ld l, a + ld a, [wc5e3 + 1] + ld h, a + add hl, hl + add hl, hl + add hl, hl + ld a, h + ret + +Func_f87b5: + ld hl, wc5eb + ld a, [hl] + inc [hl] + and $3 + ret nz + call .GetYCoord + ld d, a + ld hl, ANIM_OBJ_X_COORD + add hl, bc + ld e, [hl] + ld a, $a + push bc + call SpawnAnimatedObject + pop bc + ret + +.GetYCoord: + ld a, [hSCX] + and $8 + jr nz, .get_height_plus_9 + ld hl, wSurfingMinigameWaveHeight + 8 + jr .got_hl + +.get_height_plus_9 + ld hl, wSurfingMinigameWaveHeight + 9 +.got_hl + ld a, [wSurfingMinigameBGMapReadBuffer + 1] + cp $6 + jr z, .six_or_twenty + cp $14 + jr z, .six_or_twenty + cp $7 + jr z, .seven + ld a, [hl] + ret + +.six_or_twenty + ld a, [hSCX] + and $7 + ld e, a + ld a, [hl] + sub e + ret + +.seven + ld a, [hSCX] + and $7 + add [hl] + ret + +Func_f87fb: + ld hl, ANIM_OBJ_X_COORD + add hl, bc + ld a, [hl] + cp $58 + ret z + add $4 + ld [hl], a + ret + +Func_f8807: ; unreferenced + call MaskCurrentAnimatedObjectStruct + ret + +SurfingMinigameAnimatedObjectFn_FlippingPika: + ld hl, ANIM_OBJ_FIELD_B + add hl, bc + ld a, [hl] + and a + ret z + dec [hl] + dec [hl] + ld d, a + ld hl, ANIM_OBJ_FIELD_C + add hl, bc + ld a, [hl] + inc [hl] + call SurfingPikachu_Sine + cp $80 + jr nc, .positive + xor $ff + inc a +.positive + ld hl, ANIM_OBJ_Y_OFFSET + add hl, bc + ld [hl], a + ret + +SurfingMinigameAnimatedObjectFn_IntroAnimationPikachu: + ld hl, ANIM_OBJ_FIELD_B + add hl, bc + ld a, [hl] + inc [hl] + and $1 + ret z + ld hl, ANIM_OBJ_X_COORD + add hl, bc + ld a, [hl] + cp $c0 + jr z, .done + inc [hl] + ret + +.done + ld a, $1 + ld [wSurfingMinigameIntroAnimationFinished], a + call MaskCurrentAnimatedObjectStruct + ret + +Func_f8848: + ld a, [wc635] + ld e, a + ld d, $0 + ld a, [wc5e3] + ld l, a + ld a, [wc5e3 + 1] + ld h, a + add hl, de + ld a, l + ld [wc635], a + ld d, h + ld hl, wOAMBuffer + 5 * 4 + 1 + ld e, $9 +.loop + ld a, [hl] + add d + ld [hli], a + inc hl + inc hl + inc hl + dec e + jr nz, .loop + ret + +Func_f886b: + ld a, [wSurfingMinigameBGMapReadBuffer] ; ??? + ld a, [hSCX] + add $48 + ld e, a + srl e + srl e + srl e + ld d, $0 + ld hl, vBGMap0 + add hl, de + ld a, [wSurfingMinigamePikachuObjectHeight] + srl a + srl a + srl a + ld c, a +.loop + ld a, c + and a + jr z, .copy + dec c + ld de, $20 + add hl, de + ld a, h + and $3 + or $98 + ld h, a + jr .loop + +.copy + ld de, wSurfingMinigameBGMapReadBuffer + ld a, e + ld [H_VBCOPYDEST], a + ld a, d + ld [H_VBCOPYDEST + 1], a + ld a, l + ld [H_VBCOPYSRC], a + ld a, h + ld [H_VBCOPYSRC + 1], a + ld a, 16 / $10 + ld [H_VBCOPYSIZE], a + ret + +Func_f88ae: + ld a, [hSCX] + and $8 + jr nz, .asm_f88b9 + ld hl, wSurfingMinigameWaveHeight + 7 + jr .asm_f88bc + +.asm_f88b9 + ld hl, wSurfingMinigameWaveHeight + 8 +.asm_f88bc + ld a, [wSurfingMinigameBGMapReadBuffer] + cp $6 + jr z, .asm_f88d0 + cp $14 + jr z, .asm_f88d0 + cp $7 + jr z, .asm_f88db + ld a, [hl] + ld [wSurfingMinigamePikachuObjectHeight], a + ret + +.asm_f88d0 + ld a, [hSCX] + and $7 + ld e, a + ld a, [hl] + sub e + ld [wSurfingMinigamePikachuObjectHeight], a + ret + +.asm_f88db + ld a, [hSCX] + and $7 + add [hl] + ld [wSurfingMinigamePikachuObjectHeight], a + ret + +SurfingMinigame_Deduct1HP: + ld hl, wSurfingMinigamePikachuHP + ld e, $99 + call .BCD_Deduct + ret nc + inc hl + ld e, $99 +.BCD_Deduct: + ld a, [hl] + and a + jr z, .roll_over + sub $1 + daa + ld [hl], a + and a + ret + +.roll_over + ld [hl], e + scf + ret + +Func_f88fd: + ld de, wSurfingMinigamePikachuHP + 1 + ld hl, wOAMBuffer + 0 * 4 + 2 + ld a, [de] + call .PlaceBCDNumber + ld hl, wOAMBuffer + 2 * 4 + 2 + ld a, [de] +.PlaceBCDNumber: + ld c, a + swap a + and $f + add $d0 + ld [hli], a + inc hl + inc hl + inc hl + ld a, c + and $f + add $d0 + ld [hl], a + dec de + ret + +SurfingMinigame_DrawResultsScreen: + ld hl, wTileMap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT + xor a + call FillMemory + ld hl, .BeachTilemap + coord de, 0, 6 + ld bc, .BeachTilemapEnd - .BeachTilemap + call CopyData + call .PlaceTextbox + ld hl, wOAMBuffer + 5 * 4 + 1 + ld bc, 9 * 4 + xor a + call FillMemory + ld a, $1 + ld [H_AUTOBGTRANSFERENABLED], a + ret + +.BeachTilemap: +INCBIN "gfx/unknown_f8946.map" +.BeachTilemapEnd: + +.PlaceTextbox: + coord hl, 1, 1 + lb de, $3b, $3c + ld a, $40 + call .place_row + coord hl, 1, 2 + lb de, $3f, $3f + ld a, $ff + call .place_row + coord hl, 1, 3 + lb de, $3f, $3f + ld a, $ff + call .place_row + coord hl, 1, 4 + lb de, $3f, $3f + ld a, $ff + call .place_row + coord hl, 1, 5 + lb de, $3f, $3f + ld a, $ff + call .place_row + coord hl, 1, 6 + lb de, $3f, $3f + ld a, $ff + call .place_row + coord hl, 1, 7 + lb de, $3f, $3f + ld a, $ff + call .place_row + coord hl, 1, 8 + lb de, $3f, $3f + ld a, $ff + call .place_row + coord hl, 1, 9 + lb de, $3d, $3e + ld a, $40 + call .place_row + ret + +.place_row: + ld [hl], d + inc hl + ld c, $10 +.loop + ld [hli], a + dec c + jr nz, .loop + ld [hl], e + ret + +SurfingMinigame_PrintTextHiScore: + ld hl, .Hi_Score + coord de, 6, 8 + ld bc, $9 + call CopyData + ret + +.Hi_Score: + db $20,$2e,$2f,$30,$31,$2c,$32,$23,$33 ; Hi-Score!! + +SurfingMinigame_WriteHPLeft: + ld hl, .HP_Left + coord de, 2, 2 + ld bc, $7 + call CopyData + call SurfingMinigame_BCDPrintHPLeft + ret + +.HP_Left: + db $20,$21,$ff,$22,$23,$24,$25 ; HP Left + +SurfingMinigame_AddRemainingHPToTotal: + ld c, 99 +.loop + push bc + ld hl, wSurfingMinigamePikachuHP + ld a, [hli] + or [hl] + and a + jr z, .dead + call SurfingMinigame_Deduct1HP + ld e, $1 + call SurfingMinigame_AddPointsToTotal + pop bc + dec c + jr nz, .loop + ld a, SFX_UNKNOWN_801B0_4 + call PlaySound + and a + ret + +.dead + pop bc + scf + ret + +SurfingMinigame_BCDPrintHPLeft: + coord hl, 10, 2 + ld de, wSurfingMinigamePikachuHP + 1 + ld a, [de] + call SurfingPikachu_PlaceBCDNumber + inc hl + ld a, [de] + call SurfingPikachu_PlaceBCDNumber + inc hl + inc hl + ld [hl], $21 ; P + inc hl + ld [hl], $25 ; t + inc hl + ld [hl], $26 ; s + ret + +SurfingMinigame_WriteRadness: + ld hl, .Radness + coord de, 2, 4 + ld bc, $7 + call CopyData + call SurfingMinigame_BCDPrintRadness + ret + +.Radness: + db $27,$28,$29,$2a,$23,$26,$26 ; Radness + +SurfingMinigame_AddRadnessToTotal: + ld c, 99 +.loop + push bc + ld hl, wSurfingMinigameRadnessScore + ld a, [hli] + ld e, a + or [hl] + jr z, .done + ld d, [hl] + ld a, e + sub $1 + daa + ld e, a + ld a, d + sbc $0 + daa + ld [hld], a + ld [hl], e + ld e, $1 + call SurfingMinigame_AddPointsToTotal + pop bc + dec c + jr nz, .loop + ld a, SFX_UNKNOWN_801B0_4 + call PlaySound + and a + ret + +.done + pop bc + scf + ret + +SurfingMinigame_BCDPrintRadness: + ld a, [wSurfingMinigameRadnessScore + 1] + coord hl, 10, 4 + call SurfingPikachu_PlaceBCDNumber + ld a, [wSurfingMinigameRadnessScore] + coord hl, 12, 4 + call SurfingPikachu_PlaceBCDNumber + inc hl + inc hl + ld [hl], $21 ; P + inc hl + ld [hl], $25 ; t + inc hl + ld [hl], $26 ; s + ret + +SurfingMinigame_AddPointsToTotal: + ld a, [wSurfingMinigameTotalScore] + add e + daa + ld [wSurfingMinigameTotalScore], a + ld a, [wSurfingMinigameTotalScore + 1] + adc $0 + daa + ld [wSurfingMinigameTotalScore + 1], a + ret nc + ld a, $99 + ld [wSurfingMinigameTotalScore], a + ld [wSurfingMinigameTotalScore + 1], a + ret + +SurfingMinigame_BCDPrintTotalScore: + ld a, [wSurfingMinigameTotalScore + 1] + coord hl, 10, 6 + call SurfingPikachu_PlaceBCDNumber + ld a, [wSurfingMinigameTotalScore] + coord hl, 12, 6 + call SurfingPikachu_PlaceBCDNumber + inc hl + inc hl + ld [hl], $21 ; P + inc hl + ld [hl], $25 ; t + inc hl + ld [hl], $26 ; s + ret + +SurfingMinigame_WriteTotal: + ld hl, .Total + coord de, 2, 6 + ld bc, $5 + call CopyData + call SurfingMinigame_BCDPrintRadness + call SurfingMinigame_BCDPrintTotalScore + ret + +.Total: + db $2b,$2c,$25,$28,$2d ; Total + +DidPlayerGetAHighScore: + ld hl, wSurfingMinigameHiScore + 1 + ld a, [wSurfingMinigameTotalScore + 1] + cp [hl] + jr c, .not_high_score + jr nz, .high_score + dec hl + ld a, [wSurfingMinigameTotalScore] + cp [hl] + jr c, .not_high_score + jr nz, .high_score +.not_high_score + call WaitForSoundToFinish + ldpikacry e, PikachuCry28 + call SurfingMinigame_PlayPikaCryIfSurfingPikaInParty + and a + ret + +.high_score + ld a, [wSurfingMinigameTotalScore] + ld [wSurfingMinigameHiScore], a + ld a, [wSurfingMinigameTotalScore + 1] + ld [wSurfingMinigameHiScore + 1], a + call WaitForSoundToFinish + ldpikacry e, PikachuCry34 + call SurfingMinigame_PlayPikaCryIfSurfingPikaInParty + ld a, SFX_GET_ITEM2_4_2 + call PlaySound + scf + ret + +SurfingMinigame_PlayPikaCryIfSurfingPikaInParty: + push de + callab IsSurfingPikachuInThePlayersParty + pop de + ret nc + callab PlayPikachuSoundClip + ret + +SurfingMinigame_IncreaseRadnessMeter: + ld a, [wSurfingMinigameRadnessMeter] + inc a + cp $4 + jr c, .cap + ld a, $3 +.cap + ld [wSurfingMinigameRadnessMeter], a + ret + +SurfingMinigame_CalculateAndAddRadnessFromStunt: + ; Compute the amount of radness points from the + ; current trick based on the number of + ; consecutive flips + ; Single flip: +0050 + ; 2 of the same flip: +0150 + ; 3 or more of the same flip: +0350 + ; 2 different flips: +0180 + ; 3 or more different flips: +0500 + ld a, [wSurfingMinigameRadnessMeter] + and a + ret z + ld a, [wSurfingMinigameTrickFlags] + and $3 + cp $3 ; did a combination of front and back flips + jr z, .mixed_chain + ld a, [wSurfingMinigameRadnessMeter] + ld d, a + ld e, $1 + ld a, $0 +.get_amount_of_radness + add e + sla e + dec d + jr nz, .get_amount_of_radness +.add_radness_50_at_a_time + push af + ld e, $50 + call SurfingMinigame_AddRadness + pop af + dec a + jr nz, .add_radness_50_at_a_time + ld hl, ANIM_OBJ_Y_COORD + add hl, bc + ld a, [hl] + sub $10 + ld d, a + ld hl, ANIM_OBJ_X_COORD + add hl, bc + ld e, [hl] + ld a, [wSurfingMinigameRadnessMeter] + add $3 + push bc + call SpawnAnimatedObject + pop bc + ret + +.mixed_chain + ld a, [wSurfingMinigameRadnessMeter] + cp $3 + jr c, .add_180_radness_points + ld a, 10 +.add_500_radness_50_at_a_time + push af + ld e, $50 + call SurfingMinigame_AddRadness + pop af + dec a + jr nz, .add_500_radness_50_at_a_time + ld hl, ANIM_OBJ_Y_COORD + add hl, bc + ld a, [hl] + sub $10 + ld d, a + ld hl, ANIM_OBJ_X_COORD + add hl, bc + ld e, [hl] + ld a, $9 + push bc + call SpawnAnimatedObject + pop bc + ret + +.add_180_radness_points + ld e, $50 + call SurfingMinigame_AddRadness + ld e, $50 + call SurfingMinigame_AddRadness + ld e, $50 + call SurfingMinigame_AddRadness + ld e, $30 + call SurfingMinigame_AddRadness + ld hl, ANIM_OBJ_Y_COORD + add hl, bc + ld a, [hl] + sub $10 + ld d, a + ld hl, ANIM_OBJ_X_COORD + add hl, bc + ld e, [hl] + ld a, $8 + push bc + call SpawnAnimatedObject + pop bc + ret + +SurfingMinigame_AddRadness: + ld a, [wSurfingMinigameRadnessScore] + add e + daa + ld [wSurfingMinigameRadnessScore], a + ld a, [wSurfingMinigameRadnessScore + 1] + adc $0 + daa + ld [wSurfingMinigameRadnessScore + 1], a + ret nc + ld a, $99 + ld [wSurfingMinigameRadnessScore], a + ld [wSurfingMinigameRadnessScore + 1], a + ret + +Func_f8c97: + ld a, $a0 + ld [wSurfingMinigameXOffset], a + ld a, [hSCX] + ld h, a + ld a, [wSurfingMinigameSCX] + ld l, a + ld de, $900 + add hl, de + ld a, l + ld [wSurfingMinigameSCX], a + ld a, h + ld [hSCX], a + jr Func_f8cc7 + +Func_f8cb0: + ld a, $a0 + ld [wSurfingMinigameXOffset], a + ld a, [hSCX] + ld h, a + ld a, [wSurfingMinigameSCX] + ld l, a + ld de, $180 + add hl, de + ld a, l + ld [wSurfingMinigameSCX], a + ld a, h + ld [hSCX], a +Func_f8cc7: + ld hl, wSurfingMinigameSCX + 1 + ld a, [hSCX] + cp [hl] + ret z + ld [hl], a + and $f0 + ld hl, wSurfingMinigameSCX + 2 + cp [hl] + ret z + ld [hl], a + call SurfingMinigame_GetWaveDataPointers + ; b and c contain the height of the next wave to appear + ; on screen, in number of pixels from the top of the screen + ld a, b + ld [wSurfingMinigameWaveHeightBuffer], a + ld a, c + ld [wSurfingMinigameWaveHeightBuffer + 1], a + push de + ld hl, wSurfingMinigameWaveHeight + ld de, wSurfingMinigameWaveHeight + 2 + ld c, SCREEN_WIDTH - 2 +.copy_loop + ld a, [de] + inc de + ld [hli], a + dec c + jr nz, .copy_loop + ld a, [wSurfingMinigameWaveHeightBuffer] + ld [hli], a + ld a, [wSurfingMinigameWaveHeightBuffer + 1] + ld [hl], a + pop de + ld hl, wRedrawRowOrColumnSrcTiles + ld c, $8 +.loop + ld a, [de] + call .CopyRedrawSrcTiles + inc de + dec c + jr nz, .loop + ld a, [wSurfingMinigameXOffset] + ld e, a + ld a, [hSCX] + add e + and $f0 + srl a + srl a + srl a + ld e, a + ld d, $0 + ld hl, vBGMap0 + add hl, de + ld a, l + ld [hRedrawRowOrColumnDest], a + ld a, h + ld [hRedrawRowOrColumnDest + 1], a + ld a, $1 + ld [hRedrawRowOrColumnMode], a + ret + +.CopyRedrawSrcTiles: + push de + push hl + ld l, a + ld h, $0 + ld de, Unkn_f96e5 + add hl, hl + add hl, hl + add hl, de + ld e, l + ld d, h + pop hl + ld a, [de] + inc de + ld [hli], a + ld a, [de] + inc de + ld [hli], a + ld a, [de] + inc de + ld [hli], a + ld a, [de] + inc de + ld [hli], a + pop de + ret + +SurfingMinigame_GetWaveDataPointers: + ld a, [wSurfingMinigameWaveFunctionNumber] + ld e, a + ld d, $0 + ld hl, Jumptable_f8d53 + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] + +Jumptable_f8d53: + dw SurfingMinigameWaveFunction_NoWave ; 00 + + dw Func_f8f28 ; 01 + dw Func_f8f31 ; 02 + dw Func_f8f3a ; 03 + dw Func_f8f43 ; 04 + dw Func_f8e7d ; 05 + dw Func_f8f4c ; 06 + dw Func_f8f55 ; 07 + dw Func_f8f5e ; 08 + dw Func_f8e7d ; 09 + dw Func_f8e7d ; 0a + dw Func_f8e7d ; 0b + dw Func_f8e7d ; 0c + dw Func_f8f94 ; 0d + + dw Func_f8ec5 ; 0e + dw Func_f8ece ; 0f + dw Func_f8ed7 ; 10 + dw Func_f8ee0 ; 11 + dw Func_f8ee9 ; 12 + dw Func_f8ef2 ; 13 + dw Func_f8e7d ; 14 + dw Func_f8e7d ; 15 + dw Func_f8e7d ; 16 + dw Func_f8e7d ; 17 + dw Func_f8e7d ; 18 + dw Func_f8f94 ; 19 + + dw Func_f8efb ; 1a + dw Func_f8f04 ; 1b + dw Func_f8f0d ; 1c + dw Func_f8f16 ; 1d + dw Func_f8f1f ; 1e + dw Func_f8efb ; 1f + dw Func_f8f04 ; 20 + dw Func_f8f0d ; 21 + dw Func_f8f16 ; 22 + dw Func_f8f1f ; 23 + dw Func_f8e7d ; 24 + dw Func_f8e7d ; 25 + dw Func_f8e7d ; 26 + dw Func_f8e7d ; 27 + dw Func_f8f94 ; 28 + + dw Func_f8f28 ; 29 + dw Func_f8f31 ; 2a + dw Func_f8f3a ; 2b + dw Func_f8f43 ; 2c + dw Func_f8e7d ; 2d + dw Func_f8e7d ; 2e + dw Func_f8e7d ; 2f + dw Func_f8e7d ; 30 + dw Func_f8f94 ; 31 + + dw Func_f8f4c ; 32 + dw Func_f8f55 ; 33 + dw Func_f8f5e ; 34 + dw Func_f8f4c ; 35 + dw Func_f8f55 ; 36 + dw Func_f8f5e ; 37 + dw Func_f8f4c ; 38 + dw Func_f8f55 ; 39 + dw Func_f8f5e ; 3a + dw Func_f8e7d ; 3b + dw Func_f8e7d ; 3c + dw Func_f8e7d ; 3d + dw Func_f8e7d ; 3e + dw Func_f8f94 ; 3f + + dw Func_f8f67 ; 40 + dw Func_f8f70 ; 41 + dw Func_f8efb ; 42 + dw Func_f8f04 ; 43 + dw Func_f8f0d ; 44 + dw Func_f8f16 ; 45 + dw Func_f8f1f ; 46 + dw Func_f8f67 ; 47 + dw Func_f8f70 ; 48 + dw Func_f8e7d ; 49 + dw Func_f8e7d ; 4a + dw Func_f8e7d ; 4b + dw Func_f8f94 ; 4c + + dw Func_f8ec5 ; 4d + dw Func_f8ece ; 4e + dw Func_f8ed7 ; 4f + dw Func_f8ee0 ; 50 + dw Func_f8ee9 ; 51 + dw Func_f8ef2 ; 52 + dw Func_f8e7d ; 53 + dw Func_f8f67 ; 54 + dw Func_f8f70 ; 55 + dw Func_f8f67 ; 56 + dw Func_f8f70 ; 57 + dw Func_f8e7d ; 58 + dw Func_f8e7d ; 59 + dw Func_f8e7d ; 5a + dw Func_f8f94 ; 5b + + dw Func_f8efb ; 5c + dw Func_f8f04 ; 5d + dw Func_f8f0d ; 5e + dw Func_f8f16 ; 5f + dw Func_f8f1f ; 60 + dw Func_f8f28 ; 61 + dw Func_f8f31 ; 62 + dw Func_f8f3a ; 63 + dw Func_f8f43 ; 64 + dw Func_f8e7d ; 65 + dw Func_f8e7d ; 66 + dw Func_f8e7d ; 67 + dw Func_f8e7d ; 68 + dw Func_f8f94 ; 69 + + dw Func_f8e86 ; 6a + dw Func_f8e8f ; 6b + dw Func_f8e98 ; 6c + dw Func_f8ea1 ; 6d + dw Func_f8eaa ; 6e + dw Func_f8eb3 ; 6f + dw Func_f8ebc ; 70 + dw Func_f8f9d ; 71 + + dw Func_f8e7d ; 72 + dw Func_f8f79 ; 73 + dw Func_f8f82 ; 74 + dw Func_f8f82 ; 75 + dw Func_f8f82 ; 76 + dw Func_f8f82 ; 77 + dw Func_f8f82 ; 78 + dw Func_f8f82 ; 79 + dw Func_f8f82 ; 7a + dw Func_f8f8b ; 7b + +SurfingMinigameWaveFunction_NoWave: + ld a, [wc5e5] + cp $16 + jr c, .check_param + jr z, .big_kahuna + jr nc, .got_wave +.big_kahuna + ld a, $6a + jr .got_next_fn + +.check_param + ld a, [wc5d5] + and a + jr z, .got_wave + dec a + and $7 + ld e, a + ld d, $0 + ld hl, Unkn_f8e75 + add hl, de + ld a, [hl] +.got_next_fn + ld [wSurfingMinigameWaveFunctionNumber], a +.got_wave + lb bc, $74, $74 + ld de, Unkn_f973d + ret + +Unkn_f8e75: + db $01,$0e,$1a,$29,$32,$40,$4d,$5c + +Func_f8e7d: + lb bc, $74, $74 + ld de, Unkn_f973d + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8e86: + lb bc, $74, $6c + ld de, Unkn_f9745 + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8e8f: + lb bc, $64, $5c + ld de, Unkn_f974d + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8e98: + lb bc, $54, $4c + ld de, Unkn_f9755 + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8ea1: + lb bc, $44, $44 + ld de, Unkn_f975d + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8eaa: + lb bc, $44, $4c + ld de, Unkn_f9765 + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8eb3: + lb bc, $54, $5c + ld de, Unkn_f976d + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8ebc: + lb bc, $64, $6c + ld de, Unkn_f9775 + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8ec5: + lb bc, $74, $6c + ld de, Unkn_f977d + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8ece: + lb bc, $64, $5c + ld de, Unkn_f9785 + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8ed7: + lb bc, $54, $4c + ld de, Unkn_f978d + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8ee0: + lb bc, $4c, $4c + ld de, Unkn_f9795 + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8ee9: + lb bc, $54, $5c + ld de, Unkn_f979d + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8ef2: + lb bc, $64, $6c + ld de, Unkn_f97a5 + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8efb: + lb bc, $74, $6c + ld de, Unkn_f97ad + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8f04: + lb bc, $64, $5c + ld de, Unkn_f97b5 + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8f0d: + lb bc, $54, $54 + ld de, Unkn_f97bd + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8f16: + lb bc, $54, $5c + ld de, Unkn_f97c5 + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8f1f: + lb bc, $64, $6c + ld de, Unkn_f97cd + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8f28: + lb bc, $74, $6c + ld de, Unkn_f97d5 + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8f31: + lb bc, $64, $5c + ld de, Unkn_f97dd + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8f3a: + lb bc, $5c, $5c + ld de, Unkn_f97e5 + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8f43: + lb bc, $64, $6c + ld de, Unkn_f97ed + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8f4c: + lb bc, $74, $6c + ld de, Unkn_f97f5 + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8f55: + lb bc, $64, $64 + ld de, Unkn_f97fd + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8f5e: + lb bc, $64, $6c + ld de, Unkn_f9805 + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8f67: + lb bc, $74, $6c + ld de, Unkn_f980d + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8f70: + lb bc, $6c, $6c + ld de, Unkn_f9815 + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8f79: + lb bc, $74, $74 + ld de, Unkn_f981d + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8f82: + lb bc, $74, $74 + ld de, Unkn_f9825 + jp SurfingMinigameWaveFunction_GoToNextWaveFunction + +Func_f8f8b: + lb bc, $74, $74 + ld de, Unkn_f9825 + jp SurfingMinigameWaveFunction_ResetWaveFunction + +Func_f8f94: + lb bc, $74, $74 + ld de, Unkn_f973d + jp SurfingMinigameWaveFunction_ResetWaveFunction + +Func_f8f9d: + lb bc, $74, $74 + ld de, Unkn_f973d + ret + +Func_f8fa4: ; unused + inc a + ld [wSurfingMinigameWaveFunctionNumber], a + ret + +SurfingMinigameWaveFunction_GoToNextWaveFunction: + ld hl, wSurfingMinigameWaveFunctionNumber + inc [hl] + ret + +SurfingMinigameWaveFunction_ResetWaveFunction: + xor a + ld [wSurfingMinigameWaveFunctionNumber], a + ret + +SurfingPikachuMinigameIntro: + call SurfingPikachu_ClearTileMap + call ClearSprites + call DisableLCD + xor a + ld [H_AUTOBGTRANSFERENABLED], a + call ClearObjectAnimationBuffers + ld hl, SurfingPikachu1Graphics3 + ld de, $8800 + ld bc, $900 + ld a, BANK(SurfingPikachu1Graphics3) + call FarCopyData + ld a, SurfingPikachuSpawnStateDataPointer % $100 + ld [wAnimatedObjectSpawnStateDataPointer], a + ld a, SurfingPikachuSpawnStateDataPointer / $100 + ld [wAnimatedObjectSpawnStateDataPointer + 1], a + ld a, SurfingPikachuObjectJumptable % $100 + ld [wAnimatedObjectJumptablePointer], a + ld a, SurfingPikachuObjectJumptable / $100 + ld [wAnimatedObjectJumptablePointer + 1], a + ld a, SurfingPikachuOAMData % $100 + ld [wAnimatedObjectOAMDataPointer], a + ld a, SurfingPikachuOAMData / $100 + ld [wAnimatedObjectOAMDataPointer + 1], a + ld a, SurfingPikachuFrames % $100 + ld [wAnimatedObjectFramesDataPointer], a + ld a, SurfingPikachuFrames / $100 + ld [wAnimatedObjectFramesDataPointer + 1], a + ld a, $c + lb de, $74, $58 + call SpawnAnimatedObject + call DrawSurfingPikachuMinigameIntroBackground + xor a + ld [hSCX], a + ld [hSCY], a + ld a, $90 + ld [hWY], a + ld b, $f + call RunPaletteCommand + ld a, $e3 + ld [rLCDC], a + ld a, $1 + ld [H_AUTOBGTRANSFERENABLED], a + call DelayFrame + call DelayFrame + call DelayFrame + call SurfingPikachuMinigame_SetBGPals + ld a, $e4 + ld [rOBP0], a + ld a, $e0 + ld [rOBP1], a + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 + call DelayFrame + ld a, MUSIC_SURFING_PIKACHU + ld c, BANK(Music_SurfingPikachu) + call PlayMusic + xor a + ld [wSurfingMinigameIntroAnimationFinished], a +.loop + ld a, [wSurfingMinigameIntroAnimationFinished] + and a + ret nz + ld a, $0 + ld [wCurrentAnimatedObjectOAMBufferOffset], a + call RunObjectAnimations + call DelayFrame + jr .loop + +DrawSurfingPikachuMinigameIntroBackground: + ld hl, wTileMap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT + ld a, $ff + call FillMemory + ld hl, Tilemap_f90bc + coord de, 0, 6 + ld bc, 12 * SCREEN_WIDTH + call CopyData + ld de, Tilemap_f91c8 + coord hl, 4, 0 + lb bc, 6, 12 + call .CopyBox + coord hl, 3, 7 + lb bc, 3, 15 + call .FillBoxWithFF + ld hl, Tilemap_f91ac + coord de, 3, 7 + ld bc, 15 + call CopyData + ld hl, Tilemap_f91bb + coord de, 4, 9 + ld bc, 13 + call CopyData + ret + +.CopyBox: +.copy_row + push bc + push hl +.copy_col + ld a, [de] + inc de + ld [hli], a + dec c + jr nz, .copy_col + ld bc, SCREEN_WIDTH + pop hl + add hl, bc + pop bc + dec b + jr nz, .copy_row + ret + +.FillBoxWithFF: +.fill_row + push bc + push hl +.fill_col + ld [hl], $ff + inc hl + dec c + jr nz, .fill_col + pop hl + ld bc, SCREEN_WIDTH + add hl, bc + pop bc + dec b + jr nz, .fill_row + ret + +Tilemap_f90bc: INCBIN "gfx/unknown_f90bc.map" +Tilemap_f91ac: INCBIN "gfx/unknown_f91ac.map" +Tilemap_f91bb: INCBIN "gfx/unknown_f91bb.map" +Tilemap_f91c8: INCBIN "gfx/unknown_f91c8.map" + +SurfingMinigame_UpdateLYOverrides: + ld hl, wLYOverrides + $10 + ld de, wLYOverrides + $11 + ld c, $80 + ld a, [hl] + push af +.loop + ld a, [de] + inc de + ld [hli], a + dec c + jr nz, .loop + pop af + ld [hl], a + ret + +SurfingMinigame_InitScanlineOverrides: + ld hl, wLYOverrides + ld bc, wLYOverridesEnd - wLYOverrides + ld de, $0 +.loop + ld a, e + and $1f + ld e, a + push hl + ld hl, SurfingMinigame_LYOverridesInitialSineWave + add hl, de + ld a, [hl] + pop hl + ld [hli], a + inc e + dec bc + ld a, c + or b + jr nz, .loop + ret + +SurfingPikachu_GetJoypad_3FrameBuffer: + call Joypad + ld a, [H_FRAMECOUNTER] + and a + jr nz, .delayed + ld a, [hJoyHeld] + ld [hJoy5], a + ld a, $2 + ld [H_FRAMECOUNTER], a + ret + +.delayed + xor a + ld [hJoy5], a + ret + +SurfingPikachuMinigame_BlankPals: + xor a + ld [rBGP], a + ld [rOBP0], a + ld [rOBP1], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 + ret + +SurfingPikachuMinigame_NormalPals: + ld a, $e4 + ld [rBGP], a + ld [rOBP0], a + ld a, $e0 + ld [rOBP1], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 + ret + +SurfingPikachu_ClearTileMap: + ld hl, wTileMap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT + xor a + call FillMemory + ret + +Func_f9284: + xor a + ld [wc5ed], a + ld [wc5ee], a + ret + +SurfingMinigame_UpdatePikachuHeight: + ld a, [wc5ed] + and a + jr nz, .positive + ld a, [wc5ec] + ld d, a + ld a, [wc5ee] + or d + jr z, .done + ld a, [wc5ee] + ld e, a + ld hl, -$80 + add hl, de + ld a, l + ld [wc5ee], a + ld a, h + ld [wc5ec], a + + ; -(4 * a ** 2) + ld e, a + ld d, $0 + call SurfingMinigame_NTimesDE + ld e, l + ld d, h + ld a, $4 + call SurfingMinigame_NTimesDE + ld a, l + xor $ff + inc a + ld l, a + ld a, h + xor $ff + ld h, a + + push hl + ld hl, ANIM_OBJ_Y_COORD + add hl, bc + ld d, [hl] + ld hl, ANIM_OBJ_FIELD_C + add hl, bc + ld e, [hl] + pop hl + + add hl, de + ld e, l + ld d, h + + ld hl, ANIM_OBJ_Y_COORD + add hl, bc + ld [hl], d + ld hl, ANIM_OBJ_FIELD_C + add hl, bc + ld [hl], e + and a + ret + +.done + ld a, $1 + ld [wc5ed], a + and a + ret + +.positive + ld a, [wSurfingMinigamePikachuObjectHeight] + ld e, a + ld hl, ANIM_OBJ_Y_COORD + add hl, bc + ld a, [hl] + cp $90 + jr nc, .okay + cp e + jr nc, .reset +.okay + ld a, [wc5ec] + ld d, a + ld a, [wc5ee] + ld e, a + ld hl, $80 + add hl, de + ld a, l + ld [wc5ee], a + ld a, h + ld [wc5ec], a + + ; 4 * a ** 2 + ld e, a + ld d, $0 + call SurfingMinigame_NTimesDE + ld e, l + ld d, h + ld a, $4 + call SurfingMinigame_NTimesDE + + push hl + ld hl, ANIM_OBJ_Y_COORD + add hl, bc + ld d, [hl] + ld hl, ANIM_OBJ_FIELD_C + add hl, bc + ld e, [hl] + pop hl + + add hl, de + ld e, l + ld d, h + + ld hl, ANIM_OBJ_Y_COORD + add hl, bc + ld [hl], d + ld hl, ANIM_OBJ_FIELD_C + add hl, bc + ld [hl], e + and a + ret + +.reset + ld hl, ANIM_OBJ_Y_COORD + add hl, bc + ld a, [wSurfingMinigamePikachuObjectHeight] + ld [hl], a + ld hl, ANIM_OBJ_FIELD_C + add hl, bc + ld [hl], $0 + scf + ret + +SurfingMinigame_NTimesDE: + ld hl, $0 +.loop + srl a + jr nc, .no_add + add hl, de +.no_add + sla e + rl d + and a + jr nz, .loop + ret + +SurfingPikachu_PlaceBCDNumber: + ld c, a + swap a + and $f + add $d0 + ld [hli], a + ld a, c + and $f + add $d0 + ld [hl], a + dec de + ret + +SurfingPikachu_Cosine: ; cosine + add $10 +SurfingPikachu_Sine: ; sine + and $3f + cp $20 + jr nc, .positive + call .GetSine + ld a, h + ret + +.positive + and $1f + call .GetSine + ld a, h + xor $ff + inc a + ret + +.GetSine: + ld e, a + ld a, d + ld d, $0 + ld hl, .SineWave + add hl, de + add hl, de + ld e, [hl] + inc hl + ld d, [hl] + ld hl, $0 +.loop + srl a + jr nc, .no_add + add hl, de +.no_add + sla e + rl d + and a + jr nz, .loop + ret + +.SineWave: + sine_wave $100 + +SurfingPikachuSpawnStateDataPointer: + db $00, $00, $00 ; 0 + db $04, $01, $00 ; 1 + db $11, $02, $00 ; 2 + db $12, $02, $00 ; 3 + db $15, $00, $00 ; 4 + db $16, $00, $00 ; 5 + db $17, $00, $00 ; 6 + db $18, $00, $00 ; 7 + db $19, $00, $00 ; 8 + db $1a, $00, $00 ; 9 + db $14, $00, $00 ; a + db $13, $03, $00 ; b + db $1b, $04, $00 ; c + +SurfingPikachuObjectJumptable: + dw SurfingMinigameAnimatedObjectFn_nop ; 0 + dw SurfingMinigameAnimatedObjectFn_Pikachu ; 1 + dw Func_f87fb ; 2 + dw SurfingMinigameAnimatedObjectFn_FlippingPika ; 3 + dw SurfingMinigameAnimatedObjectFn_IntroAnimationPikachu ; 4 + +SurfingMinigameAnimatedObjectFn_nop: + ret + +INCLUDE "data/animated_objects_3e_1.asm" + +SurfingMinigame_LYOverridesInitialSineWave: +; a sine wave with amplitude 2 + db 0, 0, 0, 1, 1, 1, 1, 2 + db 2, 2, 1, 1, 1, 1, 0, 0 + db 0, 0, 0, -1, -1, -1, -1, -2 + db -2, -2, -1, -1, -1, -1, 0, 0 + +Unkn_f96e5: + db $00, $00, $00, $00 ; 00 + db $0b, $0b, $0b, $0b ; 01 + db $0b, $02, $02, $06 ; 02 + db $03, $0b, $07, $03 ; 03 + db $06, $06, $06, $06 ; 04 + db $07, $07, $07, $07 ; 05 + db $06, $04, $04, $08 ; 06 + db $05, $07, $08, $05 ; 07 + db $0b, $0b, $11, $12 ; 08 + db $0b, $0b, $13, $03 ; 09 + db $14, $12, $04, $08 ; 0a + db $13, $07, $08, $05 ; 0b + db $06, $14, $06, $14 ; 0c + db $13, $07, $13, $07 ; 0d + db $08, $08, $08, $08 ; 0e + db $14, $12, $14, $12 ; 0f + db $0b, $11, $02, $14 ; 10 + db $06, $14, $06, $14 ; 11 + db $0c, $0c, $0d, $0d ; 12 + db $0d, $0d, $0d, $0d ; 13 + db $0e, $0f, $10, $0b ; 14 + db $12, $13, $12, $13 ; 15 + +Unkn_f973d: + db $00, $00, $00, $01, $01, $01, $01, $01 +Unkn_f9745: + db $00, $00, $00, $01, $01, $02, $04, $06 +Unkn_f974d: + db $00, $00, $00, $01, $02, $04, $06, $0e +Unkn_f9755: + db $00, $00, $00, $10, $11, $06, $0e, $0e +Unkn_f975d: + db $00, $00, $00, $15, $15, $0e, $0e, $0e +Unkn_f9765: + db $00, $00, $00, $03, $05, $07, $0e, $0e +Unkn_f976d: + db $00, $00, $00, $01, $03, $05, $07, $0e +Unkn_f9775: + db $00, $00, $00, $01, $01, $03, $05, $07 +Unkn_f977d: + db $00, $00, $00, $01, $01, $02, $04, $06 +Unkn_f9785: + db $00, $00, $00, $01, $02, $04, $06, $0e +Unkn_f978d: + db $00, $00, $00, $08, $0f, $0a, $0e, $0e +Unkn_f9795: + db $00, $00, $00, $09, $0d, $0b, $0e, $0e +Unkn_f979d: + db $00, $00, $00, $01, $03, $05, $07, $0e +Unkn_f97a5: + db $00, $00, $00, $01, $01, $03, $05, $07 +Unkn_f97ad: + db $00, $00, $00, $01, $01, $02, $04, $06 +Unkn_f97b5: + db $00, $00, $00, $01, $10, $11, $06, $0e +Unkn_f97bd: + db $00, $00, $00, $01, $15, $15, $0e, $0e +Unkn_f97c5: + db $00, $00, $00, $01, $03, $05, $07, $0e +Unkn_f97cd: + db $00, $00, $00, $01, $01, $03, $05, $07 +Unkn_f97d5: + db $00, $00, $00, $01, $01, $02, $04, $06 +Unkn_f97dd: + db $00, $00, $00, $01, $08, $0f, $0a, $0e +Unkn_f97e5: + db $00, $00, $00, $01, $09, $0d, $0b, $0e +Unkn_f97ed: + db $00, $00, $00, $01, $01, $03, $05, $07 +Unkn_f97f5: + db $00, $00, $00, $01, $01, $10, $11, $06 +Unkn_f97fd: + db $00, $00, $00, $01, $01, $15, $15, $0e +Unkn_f9805: + db $00, $00, $00, $01, $01, $03, $05, $07 +Unkn_f980d: + db $00, $00, $00, $01, $01, $08, $0f, $0a +Unkn_f9815: + db $00, $00, $00, $01, $01, $09, $0d, $0b +Unkn_f981d: + db $00, $00, $00, $14, $14, $14, $14, $14 +Unkn_f9825: + db $00, $00, $00, $12, $13, $13, $13, $13 diff --git a/engine/titlescreen.asm b/engine/titlescreen.asm index ecccbf32..c4dff73c 100755 --- a/engine/titlescreen.asm +++ b/engine/titlescreen.asm @@ -1,8 +1,3 @@ -; copy text of fixed length NAME_LENGTH (like player name, rival name, mon names, ...) -CopyFixedLengthText: - ld bc, NAME_LENGTH - jp CopyData - SetDefaultNamesBeforeTitlescreen: ld hl, NintenText ld de, wPlayerName @@ -35,98 +30,35 @@ DisplayTitleScreen: call ClearScreen call DisableLCD call LoadFontTilePatterns - ld hl, NintendoCopyrightLogoGraphics - ld de, vTitleLogo2 + $100 +; todo: fix hl pointers + ld hl, NintendoCopyrightLogoGraphics ; 4:4c48 + ld de, vTitleLogo + $600 ld bc, $50 ld a, BANK(NintendoCopyrightLogoGraphics) - call FarCopyData2 - ld hl, GamefreakLogoGraphics - ld de, vTitleLogo2 + $100 + $50 - ld bc, $90 + call FarCopyData + ld hl, NineTile ; 4:4e08 + ld de, vTitleLogo + $6e0 + ld bc, $10 + ld a, BANK(NineTile) + call FarCopyData + ld hl, GamefreakLogoGraphics ; 4:4d78 + ld de, vTitleLogo + 101 * $10 + ld bc, 9 * $10 ld a, BANK(GamefreakLogoGraphics) - call FarCopyData2 - ld hl, PokemonLogoGraphics - ld de, vTitleLogo - ld bc, $600 - ld a, BANK(PokemonLogoGraphics) - call FarCopyData2 ; first chunk - ld hl, PokemonLogoGraphics+$600 - ld de, vTitleLogo2 - ld bc, $100 - ld a, BANK(PokemonLogoGraphics) - call FarCopyData2 ; second chunk - ld hl, Version_GFX - ld de,vChars2 + $600 - (Version_GFXEnd - Version_GFX - $50) - ld bc, Version_GFXEnd - Version_GFX - ld a, BANK(Version_GFX) - call FarCopyDataDouble - call ClearBothBGMaps - -; place tiles for pokemon logo (except for the last row) - coord hl, 2, 1 - ld a, $80 - ld de, SCREEN_WIDTH - ld c, 6 -.pokemonLogoTileLoop - ld b, $10 - push hl -.pokemonLogoTileRowLoop ; place tiles for one row - ld [hli], a - inc a - dec b - jr nz, .pokemonLogoTileRowLoop - pop hl - add hl, de - dec c - jr nz, .pokemonLogoTileLoop - -; place tiles for the last row of the pokemon logo - coord hl, 2, 7 - ld a, $31 - ld b, $10 -.pokemonLogoLastTileRowLoop - ld [hli], a - inc a - dec b - jr nz, .pokemonLogoLastTileRowLoop - - call DrawPlayerCharacter - -; put a pokeball in the player's hand - ld hl, wOAMBuffer + $28 - ld a, $74 - ld [hl], a - -; place tiles for title screen copyright - coord hl, 2, 17 - ld de, .tileScreenCopyrightTiles - ld b, $10 -.tileScreenCopyrightTilesLoop - ld a, [de] - ld [hli], a - inc de - dec b - jr nz, .tileScreenCopyrightTilesLoop - - jr .next - -.tileScreenCopyrightTiles - db $41,$42,$43,$42,$44,$42,$45,$46,$47,$48,$49,$4A,$4B,$4C,$4D,$4E ; ©'95.'96.'98 GAME FREAK inc. - -.next + call FarCopyData + callab LoadYellowTitleScreenGFX + ld hl, vBGMap0 + ld bc, (vBGMap1 + $400) - vBGMap0 + ld a, " " + call FillMemory + callab TitleScreen_PlacePokemonLogo + call FillSpriteBuffer0WithAA + call .WriteCopyrightTiles call SaveScreenTilesToBuffer2 call LoadScreenTilesFromBuffer2 call EnableLCD -IF DEF(_RED) - ld a,CHARMANDER ; which Pokemon to show first on the title screen -ENDC -IF DEF(_BLUE) - ld a,SQUIRTLE ; which Pokemon to show first on the title screen -ENDC - - ld [wTitleMonSpecies], a - call LoadTitleMonSprite - ld a, (vBGMap0 + $300) / $100 + callab TitleScreen_PlacePikachu + ld a, $9b call TitleScreenCopyTileMapToVRAM call SaveScreenTilesToBuffer1 ld a, $40 @@ -137,8 +69,9 @@ ENDC ld b, SET_PAL_TITLE_SCREEN call RunPaletteCommand call GBPalNormal - ld a, %11100100 + ld a, %11100000 ld [rOBP0], a + call UpdateGBCPal_OBP0 ; make pokemon logo bounce up and down ld bc, hSCY ; background scroll Y @@ -158,7 +91,7 @@ ENDC call .ScrollTitleScreenPokemonLogo jr .bouncePokemonLogoLoop -.TitleScreenPokemonLogoYScrolls: +.TitleScreenPokemonLogoYScrolls ; 4228 (1:4228) ; Controls the bouncing effect of the Pokemon logo on the title screen db -4,16 ; y scroll amount, number of times to scroll db 3,4 @@ -169,7 +102,7 @@ ENDC db -1,2 db 0 ; terminate list with 0 -.ScrollTitleScreenPokemonLogo +.ScrollTitleScreenPokemonLogo ; 4237 (1:4237) ; Scrolls the Pokemon logo on the title screen to create the bouncing effect ; Scrolls d pixels e times call DelayFrame @@ -180,7 +113,22 @@ ENDC jr nz, .ScrollTitleScreenPokemonLogo ret -.finishedBouncingPokemonLogo +; place tiles for title screen copyright +.WriteCopyrightTiles ; 4241 (1:4241) + coord hl, 2, 17 + ld de, .tileScreenCopyrightTiles +.titleScreenCopyrightTilesLoop + ld a, [de] + inc de + cp $ff + ret z + ld [hli], a + jr .titleScreenCopyrightTilesLoop + +.tileScreenCopyrightTiles ; 424f (1:424f) + db $e0,$e1,$e2,$e3,$e1,$e2,$ee,$e5,$e6,$e7,$e8,$e9,$ea,$eb,$ec,$ed,$ff ; ©1995-1999 GAME FREAK inc. + +.finishedBouncingPokemonLogo ; 4260 (1:4260) call LoadScreenTilesFromBuffer1 ld c, 36 call DelayFrames @@ -188,52 +136,42 @@ ENDC call PlaySound ; scroll game version in from the right - call PrintGameVersionOnTitleScreen + callab TitleScreen_PlacePikaSpeechBubble ld a, SCREEN_HEIGHT_PIXELS ld [hWY], a - ld d, 144 -.scrollTitleScreenGameVersionLoop - ld h, d - ld l, 64 - call ScrollTitleScreenGameVersion - ld h, 0 - ld l, 80 - call ScrollTitleScreenGameVersion - ld a, d - add 4 - ld d, a - and a - jr nz, .scrollTitleScreenGameVersionLoop - - ld a, vBGMap1 / $100 - call TitleScreenCopyTileMapToVRAM - call LoadScreenTilesFromBuffer2 - call PrintGameVersionOnTitleScreen call Delay3 + ld e, 0 + call TitleScreen_PlayPikachuPCM call WaitForSoundToFinish + call StopAllMusic ld a, MUSIC_TITLE_SCREEN ld [wNewSoundID], a call PlaySound +.loop xor a ld [wUnusedCC5B], a - -; Keep scrolling in new mons indefinitely until the user performs input. -.awaitUserInterruptionLoop - ld c, 200 - call CheckForUserInterruption - jr c, .finishedWaiting - call TitleScreenScrollInMon - ld c, 1 - call CheckForUserInterruption - jr c, .finishedWaiting - callba TitleScreenAnimateBallIfStarterOut - call TitleScreenPickNewMon - jr .awaitUserInterruptionLoop - -.finishedWaiting - ld a, [wTitleMonSpecies] - call PlayCry - call WaitForSoundToFinish + ld [wTitleScreenScene], a + ld [wTitleScreenScene + 1], a + ld [wTitleScreenScene + 2], a + ld [wTitleScreenScene + 3], a + ld a, $f + ld [wTitleScreenScene + 4], a +.titleScreenLoop + call IncrementResetCounter + jp c, .doTitlescreenReset + call DelayFrame + call JoypadLowSensitivity + ld a, [hJoyHeld] + cp D_UP | SELECT | B_BUTTON + jr z, .go_to_main_menu + and A_BUTTON | START + jr nz, .go_to_main_menu + call DoTitleScreenFunction + jr .titleScreenLoop + +.go_to_main_menu + ld e, $a + call TitleScreen_PlayPikachuPCM call GBPalWhiteOutWithDelay3 call ClearSprites xor a @@ -254,108 +192,39 @@ ENDC jp z, .doClearSaveDialogue jp MainMenu -.doClearSaveDialogue - jpba DoClearSaveDialogue - -TitleScreenPickNewMon: - ld a, vBGMap0 / $100 - call TitleScreenCopyTileMapToVRAM - -.loop -; Keep looping until a mon different from the current one is picked. - call Random - and $f - ld c, a - ld b, 0 - ld hl, TitleMons - add hl, bc - ld a, [hl] - ld hl, wTitleMonSpecies - -; Can't be the same as before. - cp [hl] - jr z, .loop +.asm_42f0 ; 42f0 (1:42f0) +; unreferenced + callab PrinterDebug + jp .loop - ld [hl], a - call LoadTitleMonSprite - - ld a, $90 - ld [hWY], a - ld d, 1 ; scroll out - callba TitleScroll - ret - -TitleScreenScrollInMon: - ld d, 0 ; scroll in - callba TitleScroll - xor a - ld [hWY], a - ret - -ScrollTitleScreenGameVersion: -.wait - ld a, [rLY] - cp l - jr nz, .wait - - ld a, h - ld [rSCX], a - -.wait2 - ld a, [rLY] - cp h - jr z, .wait2 - ret - -DrawPlayerCharacter: - ld hl, PlayerCharacterTitleGraphics - ld de, vSprites - ld bc, PlayerCharacterTitleGraphicsEnd - PlayerCharacterTitleGraphics - ld a, BANK(PlayerCharacterTitleGraphics) - call FarCopyData2 - call ClearSprites - xor a - ld [wPlayerCharacterOAMTile], a - ld hl, wOAMBuffer - ld de, $605a - ld b, 7 -.loop - push de - ld c, 5 -.innerLoop - ld a, d - ld [hli], a ; Y - ld a, e - ld [hli], a ; X - add 8 - ld e, a - ld a, [wPlayerCharacterOAMTile] - ld [hli], a ; tile +.asm_42fb ; 42fb (1:42fb) +; unreferenced + ld a, [wTitleScreenScene + 4] inc a - ld [wPlayerCharacterOAMTile], a - inc hl - dec c - jr nz, .innerLoop - pop de - ld a, 8 - add d - ld d, a - dec b - jr nz, .loop - ret + cp $2a + jr c, .asm_4305 + ld a, $f +.asm_4305 + ld [wTitleScreenScene + 4], a + ld e, a + callab PlayPikachuSoundClip + xor a + ld [wTitleScreenScene + 2], a + ld [wTitleScreenScene + 3], a + jp .titleScreenLoop + +.doTitlescreenReset ; 431b (1:431b) + ld [wAudioFadeOutControl], a + call StopAllMusic +.audioFadeLoop + ld a, [wAudioFadeOutControl] + and a + jr nz, .audioFadeLoop + jp Init -ClearBothBGMaps: - ld hl, vBGMap0 - ld bc, $400 * 2 - ld a, " " - jp FillMemory +.doClearSaveDialogue ; 432a (1:432a) + jpba DoClearSaveDialogue -LoadTitleMonSprite: - ld [wcf91], a - ld [wd0b5], a - coord hl, 5, 10 - call GetMonHeader - jp LoadFrontSpriteByMonIndex TitleScreenCopyTileMapToVRAM: ld [H_AUTOBGTRANSFERDEST + 1], a @@ -370,31 +239,132 @@ LoadCopyrightAndTextBoxTiles: LoadCopyrightTiles: ld de, NintendoCopyrightLogoGraphics ld hl, vChars2 + $600 - lb bc, BANK(NintendoCopyrightLogoGraphics), (GamefreakLogoGraphicsEnd - NintendoCopyrightLogoGraphics) / $10 + lb bc, BANK(NintendoCopyrightLogoGraphics), (TextBoxGraphics + $10 - NintendoCopyrightLogoGraphics) / $10 ; bug: overflows into text box graphics and copies the "A" tile call CopyVideoData coord hl, 2, 7 ld de, CopyrightTextString jp PlaceString CopyrightTextString: - db $60,$61,$62,$61,$63,$61,$64,$7F,$65,$66,$67,$68,$69,$6A ; ©'95.'96.'98 Nintendo - next $60,$61,$62,$61,$63,$61,$64,$7F,$6B,$6C,$6D,$6E,$6F,$70,$71,$72 ; ©'95.'96.'98 Creatures inc. - next $60,$61,$62,$61,$63,$61,$64,$7F,$73,$74,$75,$76,$77,$78,$79,$7A,$7B ; ©'95.'96.'98 GAME FREAK inc. + db $60,$61,$62,$63,$61,$62,$7c,$7f,$65,$66,$67,$68,$69,$6a ; ©1995-1999 Nintendo + next $60,$61,$62,$63,$61,$62,$7c,$7f,$6b,$6c,$6d,$6e,$6f,$70,$71,$72 ; ©1995-1999 Creatures inc. + next $60,$61,$62,$63,$61,$62,$7c,$7f,$73,$74,$75,$76,$77,$78,$79,$7a,$7b ; ©1995-1999 GAME FREAK inc. db "@" -INCLUDE "data/title_mons.asm" +TitleScreen_PlayPikachuPCM: + callab PlayPikachuSoundClip + ret + +DoTitleScreenFunction: + call .CheckTimer + ld a, [wTitleScreenScene] + ld e, a + ld d, 0 + ld hl, .Jumptable + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] + + +.Jumptable: + dw .Nop + dw .BlinkHalf + dw .BlinkWait + dw .BlinkWait + dw .BlinkClosed + dw .BlinkWait + dw .BlinkWait + dw .BlinkHalf + dw .BlinkWait + dw .BlinkWait + dw .BlinkOpen + dw .GoBackToStart + +.GoBackToStart: + xor a + ld [wTitleScreenScene], a +.Nop + ret + +.BlinkOpen: + ld e, 0 + jr .LoadBlinkFrame + +.BlinkHalf: + ld e, 4 + jr .LoadBlinkFrame + +.BlinkClosed: + ld e, 8 +.LoadBlinkFrame: + ld hl, wOAMBuffer + 2 + ld c, 8 +.loop + ld a, [hl] + and $f3 + or e + ld [hli], a + inc hl + inc hl + inc hl + dec c + jr nz, .loop +.BlinkWait: + ld hl, wTitleScreenScene + inc [hl] + ret + +.CheckTimer: + ld hl, wTitleScreenTimer + ld a, [hl] + inc [hl] + and a + jr z, .restart + cp $80 + jr z, .restart + cp $90 + ret nz +.restart + ld a, $1 + ld [wTitleScreenScene], a + ret -; prints version text (red, blue) -PrintGameVersionOnTitleScreen: - coord hl, 7, 8 - ld de, VersionOnTitleScreenText - jp PlaceString +; copy text of fixed length NAME_LENGTH (like player name, rival name, mon names, ...) +CopyFixedLengthText: + ld bc, NAME_LENGTH + jp CopyData -; these point to special tiles specifically loaded for that purpose and are not usual text -VersionOnTitleScreenText: -IF DEF(_RED) - db $60,$61,$7F,$65,$66,$67,$68,$69,"@" ; "Red Version" -ENDC -IF DEF(_BLUE) - db $61,$62,$63,$64,$65,$66,$67,$68,"@" ; "Blue Version" -ENDC +NintenText: db "NINTEN@" +SonyText: db "SONY@" + +IncrementResetCounter: + ld hl, wTitleScreenScene + 2 + ld e, [hl] + inc hl + ld d, [hl] + inc de + ld a, d + cp $c + jr z, .doReset + ld [hl], d + dec hl + ld [hl], e + and a + ret + +.doReset + scf + ret + +FillSpriteBuffer0WithAA: + xor a + call SwitchSRAMBankAndLatchClockData + ld hl, sSpriteBuffer0 + ld bc, $20 + ld a, $aa + call FillMemory + call PrepareRTCDataAndDisableSRAM + ret diff --git a/engine/titlescreen2.asm b/engine/titlescreen2.asm index 6f47b080..2a1bf0dc 100755 --- a/engine/titlescreen2.asm +++ b/engine/titlescreen2.asm @@ -1,3 +1,5 @@ +; Leftover of Red/Blue. Seemingly unused + TitleScroll_WaitBall: ; Wait around for the TitleBall animation to play out. ; hi: speed @@ -89,7 +91,7 @@ TitleBallYTable: TitleScreenAnimateBallIfStarterOut: ; Animate the TitleBall if a starter just got scrolled out. - ld a, [wTitleMonSpecies] + ld a, [wTitleScreenScene] cp STARTER1 jr z, .ok cp STARTER2 diff --git a/engine/town_map.asm b/engine/town_map.asm index b2f1e656..65a10912 100755 --- a/engine/town_map.asm +++ b/engine/town_map.asm @@ -27,7 +27,7 @@ DisplayTownMap: pop af jr .enterLoop -.townMapLoop +.townMapLoop ; 70ef4 (1c:4ef4) coord hl, 0, 0 lb bc, 1, 20 call ClearScreenArea @@ -37,7 +37,7 @@ DisplayTownMap: ld b, 0 add hl, bc ld a, [hl] -.enterLoop +.enterLoop ; 70f08 (1c:4f08) ld de, wTownMapCoords call LoadTownMapEntry ld a, [de] @@ -69,7 +69,7 @@ DisplayTownMap: ld b, a and A_BUTTON | B_BUTTON | D_UP | D_DOWN jr z, .inputLoop - ld a, SFX_TINK + ld a, $8c call PlaySound bit 6, b jr nz, .pressedUp @@ -84,6 +84,7 @@ DisplayTownMap: pop af ld [hl], a ret + .pressedUp ld a, [wWhichTownMapLocation] inc a @@ -103,6 +104,13 @@ DisplayTownMap: ld [wWhichTownMapLocation], a jp .townMapLoop +.asm_70f87 + ld a,[hJoy5] + and D_DOWN | D_UP + ret z + callab PlayPikachuSoundClip + ret + INCLUDE "data/town_map_order.asm" TownMapCursor: @@ -137,11 +145,14 @@ MonsNestText: LoadTownMap_Fly: call ClearSprites call LoadTownMap + ld a, $1 + ld [hJoy7], a call LoadPlayerSpriteGraphics call LoadFontTilePatterns - ld de, BirdSprite + ld de, BirdSprite ; $4d80 + ld b, BANK(BirdSprite) + ld c, $c ld hl, vSprites + $40 - lb bc, BANK(BirdSprite), $0c call CopyVideoData ld de, TownMapUpArrow ld hl, vChars1 + $6d0 @@ -179,7 +190,7 @@ LoadTownMap_Fly: ld c, 15 call DelayFrames coord hl, 18, 0 - ld [hl], $ed + ld [hl], "▶" coord hl, 19, 0 ld [hl], $ee pop hl @@ -194,7 +205,7 @@ LoadTownMap_Fly: jr z, .inputLoop bit 0, b jr nz, .pressedA - ld a, SFX_TINK + ld a, $8c ; SFX_TINK call PlaySound bit 6, b jr nz, .pressedUp @@ -202,7 +213,7 @@ LoadTownMap_Fly: jr nz, .pressedDown jr .pressedB .pressedA - ld a, SFX_HEAL_AILMENT + ld a, $8e ; SFX_HEAL_AILMENT call PlaySound ld a, [hl] ld [wDestinationMap], a @@ -213,6 +224,7 @@ LoadTownMap_Fly: .pressedB xor a ld [wTownMapSpriteBlinkingEnabled], a + ld [hJoy7], a call GBPalWhiteOutWithDelay3 pop hl pop af @@ -279,16 +291,15 @@ LoadTownMap: call ClearScreen call UpdateSprites coord hl, 0, 0 - ld b, $12 - ld c, $12 + lb bc, $12, $12 call TextBoxBorder call DisableLCD ld hl, WorldMapTileGraphics ld de, vChars2 + $600 ld bc, WorldMapTileGraphicsEnd - WorldMapTileGraphics ld a, BANK(WorldMapTileGraphics) - call FarCopyData2 - ld hl, MonNestIcon + call FarCopyData + ld hl, MonNestIcon ; $574b ld de, vSprites + $40 ld bc, MonNestIconEnd - MonNestIcon ld a, BANK(MonNestIcon) @@ -355,12 +366,12 @@ DrawPlayerOrBirdSprite: call WritePlayerOrBirdSpriteOAM pop hl ld de, wcd6d -.asm_711dc +.asm_71266 ld a, [hli] ld [de], a inc de - cp $50 - jr nz, .asm_711dc + cp "@" + jr nz, .asm_71266 ld hl, wOAMBuffer ld de, wTileMapBackup ld bc, $a0 @@ -397,8 +408,7 @@ DisplayWildLocations: jr nz, .drawPlayerSprite ; if no OAM entries were written, print area unknown text coord hl, 1, 7 - ld b, $2 - ld c, $f + lb bc, 2, 15 call TextBoxBorder coord hl, 2, 9 ld de, AreaUnknownText @@ -455,7 +465,7 @@ WriteTownMapSpriteOAM: pop hl WriteAsymmetricMonPartySpriteOAM: -; Writes 4 OAM blocks for a helix mon party sprite, since it does not have +; Writes 4 OAM blocks for a helix mon party sprite, since is does not have ; a vertical line of symmetry. lb de, 2, 2 .loop @@ -473,14 +483,14 @@ WriteAsymmetricMonPartySpriteOAM: xor a ld [hli], a inc d - ld a, 8 + ld a, $8 add c ld c, a dec e jr nz, .innerLoop pop bc pop de - ld a, 8 + ld a, $8 add b ld b, a dec d @@ -582,9 +592,14 @@ LoadTownMapEntry: ld l, a ret +; ExternalMapEntries: + ; dr $7139c,$7140b +; InternalMapEntries: + ; dr $7140b,$7174b + INCLUDE "data/town_map_entries.asm" -INCLUDE "text/map_names.asm" +INCLUDE "text/map_names.asm" ; TODO: relabel addresses MonNestIcon: INCBIN "gfx/mon_nest_icon.1bpp" diff --git a/engine/trade.asm b/engine/trade.asm index 78444cf6..bbd43779 100755 --- a/engine/trade.asm +++ b/engine/trade.asm @@ -20,12 +20,13 @@ ExternalClockTradeAnim: TradeAnimCommon: ld a, [wOptions] push af + and %110000 ; preserve speaker options + ld [wOptions], a ld a, [hSCY] push af ld a, [hSCX] push af xor a - ld [wOptions], a ld [hSCY], a ld [hSCX], a push de @@ -160,12 +161,12 @@ LoadTradingGFXAndMonNames: ld de, vChars2 + $310 ld bc, TradingAnimationGraphicsEnd - TradingAnimationGraphics ld a, BANK(TradingAnimationGraphics) - call FarCopyData2 + call FarCopyData ld hl, TradingAnimationGraphics2 ld de, vSprites + $7c0 ld bc, TradingAnimationGraphics2End - TradingAnimationGraphics2 ld a, BANK(TradingAnimationGraphics2) - call FarCopyData2 + call FarCopyData ld hl, vBGMap0 ld bc, $800 ld a, " " @@ -182,6 +183,7 @@ LoadTradingGFXAndMonNames: ld a, $f0 ; SGB OBP0 .next ld [rOBP0], a + call UpdateGBCPal_OBP0 call EnableLCD xor a ld [H_AUTOBGTRANSFERENABLED], a @@ -199,6 +201,7 @@ LoadTradingGFXAndMonNames: Trade_LoadMonPartySpriteGfx: ld a, %11010000 ld [rOBP1], a + call UpdateGBCPal_OBP1 jpba LoadMonPartySpriteGfx Trade_SwapNames: @@ -233,8 +236,7 @@ Trade_ShowPlayerMon: xor a ld [H_AUTOBGTRANSFERENABLED], a coord hl, 4, 0 - ld b, 6 - ld c, 10 + lb bc, 6, 10 call TextBoxBorder call Trade_PrintPlayerMonInfoText ld b, vBGMap0 / $100 @@ -251,7 +253,7 @@ Trade_ShowPlayerMon: ld [hSCX], a dec a dec a - and a + and a ; useless since flags are updated with dec a jr nz, .slideScreenLoop call Trade_Delay80 ld a, TRADE_BALL_POOF_ANIM @@ -303,9 +305,10 @@ Trade_AnimateBallEnteringLinkCable: call DelayFrames ld a, %11100100 ld [rOBP0], a + call UpdateGBCPal_OBP0 xor a ld [wLinkCableAnimBulgeToggle], a - ld bc, $2060 + lb bc, $20, $60 .moveBallInsideLinkCableLoop push bc xor a @@ -354,8 +357,7 @@ Trade_ShowEnemyMon: call Trade_ShowAnimation call Trade_ShowClearedWindow coord hl, 4, 10 - ld b, 6 - ld c, 10 + lb bc, 6, 10 call TextBoxBorder call Trade_PrintEnemyMonInfoText call Trade_CopyTileMapToVRAM @@ -380,8 +382,9 @@ Trade_AnimLeftToRight: call Trade_InitGameboyTransferGfx ld a, $1 ld [wTradedMonMovingRight], a - ld a, $e4 + ld a, %11100100 ld [rOBP0], a + call UpdateGBCPal_OBP0 ld a, $54 ld [wBaseCoordX], a ld a, $1c @@ -446,6 +449,8 @@ Trade_InitGameboyTransferGfx: ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a call ClearScreen + ld b, SET_PAL_GENERIC + call RunPaletteCommand xor a ld [H_AUTOBGTRANSFERENABLED], a call Trade_LoadMonPartySpriteGfx @@ -466,7 +471,7 @@ Trade_DrawLeftGameboy: ld a, $5d ld [hli], a ld a, $5e - ld c, $8 + ld c, 8 .loop ld [hli], a dec c @@ -479,8 +484,7 @@ Trade_DrawLeftGameboy: ; draw text box with player name below gameboy pic coord hl, 4, 12 - ld b, 2 - ld c, 7 + lb bc, 2, 7 call TextBoxBorder coord hl, 5, 14 ld de, wPlayerName @@ -526,8 +530,7 @@ Trade_DrawRightGameboy: ; draw text box with enemy name above link cable coord hl, 6, 0 - ld b, $2 - ld c, $7 + lb bc, 2, 7 call TextBoxBorder coord hl, 7, 2 ld de, wLinkEnemyTrainerName @@ -599,6 +602,7 @@ Trade_AnimCircledMon: ld a, [rBGP] xor $3c ; make link cable flash ld [rBGP], a + call UpdateGBCPal_BGP ld hl, wOAMBuffer + $02 ld de, $4 ld c, $14 @@ -620,7 +624,7 @@ Trade_WriteCircledMonOAM: Trade_AddOffsetsToOAMCoords: ld hl, wOAMBuffer - ld c, $14 + ld c, $14 ; SCREEN_WIDTH? .loop ld a, [wBaseCoordY] add [hl] diff --git a/engine/trade2.asm b/engine/trade2.asm index 16d07b17..c47da36a 100755 --- a/engine/trade2.asm +++ b/engine/trade2.asm @@ -43,7 +43,7 @@ Trade_PrintEnemyMonInfoText: jp PrintNumber Trade_MonInfoText: - db "──",$74,$F2,$4E - db $4E - db "OT/",$4E - db $73,"№",$F2,"@" + db "──",$74,$F2 + db $4e ; next + next "OT/" + next $73,"№",$F2,"@" diff --git a/engine/turn_sprite.asm b/engine/turn_sprite.asm deleted file mode 100755 index e8a47a8f..00000000 --- a/engine/turn_sprite.asm +++ /dev/null @@ -1,25 +0,0 @@ -UpdateSpriteFacingOffsetAndDelayMovement: - ld h, $c2 - ld a, [H_CURRENTSPRITEOFFSET] - add $8 - ld l, a - ld a, $7f ; maximum movement delay - ld [hl], a ; c2x8 (movement delay) - dec h - ld a, [H_CURRENTSPRITEOFFSET] - add $9 - ld l, a - ld a, [hld] ; c1x9 (facing direction) - ld b, a - xor a - ld [hld], a - ld [hl], a ; c1x8 (walk animation frame) - ld a, [H_CURRENTSPRITEOFFSET] - add $2 - ld l, a - ld a, [hl] ; c1x2 (facing and animation table offset) - or b ; or in the facing direction - ld [hld], a - ld a, $2 ; delayed movement status - ld [hl], a ; c1x1 (movement status) - ret diff --git a/engine/unknown_ea3ea.asm b/engine/unknown_ea3ea.asm new file mode 100755 index 00000000..ca5d8bff --- /dev/null +++ b/engine/unknown_ea3ea.asm @@ -0,0 +1,977 @@ +Printer_GetMonStats: + call GBPalWhiteOutWithDelay3 + call ClearScreen + call LoadHpBarAndStatusTilePatterns + ld de, GFX_ea563 + ld hl, vChars2 + $710 + lb bc, BANK(GFX_ea563), (GFX_ea563End - GFX_ea563) / 8 + call CopyVideoDataDouble + + ld de, GFX_ea56b + ld hl, vChars2 + $6e0 + lb bc, BANK(GFX_ea56b), (GFX_ea56bEnd - GFX_ea56b) / 8 + call CopyVideoDataDouble + + xor a + ld [H_AUTOBGTRANSFERENABLED], a + xor a + ld [wWhichTradeMonSelectionMenu], a + call LoadMonData + + ld hl, wTileMap + lb bc, 16, 18 + call TextBoxBorder + + coord hl, 0, 12 + lb bc, 4, 18 + call TextBoxBorder + + coord hl, 3, 10 + call PrintLevelFull + + coord hl, 2, 10 + ld a, $6e + ld [hli], a + ld [hl], " " + + coord hl, 2, 11 + ld [hl], "′" + + coord hl, 4, 11 + ld de, wLoadedMonMaxHP + lb bc, 2, 3 + call PrintNumber + + ld a, [wMonHeader] + ld [wPokeBallAnimData], a + ld [wd0b5], a + ld hl, wPartyMonNicks + call .GetNamePointer + coord hl, 8, 2 + call PlaceString + + call GetMonName + coord hl, 9, 3 + call PlaceString + + predef IndexToPokedex + coord hl, 2, 8 + ld [hl], "№" + inc hl + ld [hl], $f2 + inc hl + ld de, wPokeBallAnimData + lb bc, $80 | 1, 3 + call PrintNumber + + coord hl, 8, 4 + ld de, .OT + call PlaceString + + ld hl, wPartyMonOT + call .GetNamePointer + coord hl, 9, 5 + call PlaceString + + coord hl, 9, 6 + ld de, .IDNo + call PlaceString + + coord hl, 13, 6 + ld de, wLoadedMonOTID + lb bc, $80 | 2, 5 + call PrintNumber + + coord hl, 9, 8 + ld de, .Stats + ld a, [hFlags_0xFFFA] + set 2, a + ld [hFlags_0xFFFA], a + call PlaceString + ld a, [hFlags_0xFFFA] + res 2, a + ld [hFlags_0xFFFA], a + + coord hl, 16, 8 + ld de, wLoadedMonAttack + ld a, 4 +.loop + push af + push de + + push hl + lb bc, 2, 3 + call PrintNumber + pop hl + ld bc, SCREEN_WIDTH + add hl, bc + + pop de + inc de + inc de + pop af + dec a + jr nz, .loop + + coord hl, 1, 13 + ld a, [wLoadedMonMoves] + call .PlaceMoveName + + coord hl, 1, 14 + ld a, [wLoadedMonMoves + 1] + call .PlaceMoveName + + coord hl, 1, 15 + ld a, [wLoadedMonMoves + 2] + call .PlaceMoveName + + coord hl, 1, 16 + ld a, [wLoadedMonMoves + 3] + call .PlaceMoveName + + ld b, $4 ; SET_PAL_STATUS_SCREEN + call RunPaletteCommand + + ld a, $1 + ld [H_AUTOBGTRANSFERENABLED], a + call Delay3 + call GBPalNormal + coord hl, 1, 1 + call LoadFlippedFrontSpriteByMonIndex + ret + +.GetNamePointer: + ld bc, NAME_LENGTH + ld a, [wWhichPokemon] + call AddNTimes + ld e, l + ld d, h + ret + +.PlaceMoveName: + and a + jr z, .no_move + ld [wPokeBallAnimData], a + call GetMoveName + jr .place_string + +.no_move + ld de, .Blank +.place_string + call PlaceString + ret +; ea52f + +.OT: + db "OT/@" +; ea533 + +.IDNo: + db $73, "№/@" +; ea537 + +.Stats: + db "ATTACK" + next "DEFENSE" + next "SPEED" + next "SPECIAL@" +; ea554 + +.Blank: + db "--------------@" + +GFX_ea563: +INCBIN "gfx/stats_screen_hp.1bpp" +GFX_ea563End: + +GFX_ea56b: +INCBIN "gfx/stats_screen_lv.1bpp" +GFX_ea56bEnd: + +PrinterDebug_LoadGFX: + ld hl, vChars1 + $7e0 + ld de, GFX_ea597 + lb bc, BANK(GFX_ea597), (GFX_ea597End - GFX_ea597) / 16 + call CopyVideoData + + ld hl, wOAMBuffer + 32 * 4 + ld a, $8 + ld c, $8 +.loop + ld [hl], $10 + inc hl + ld [hl], a + inc hl + ld [hl], $fe + inc hl + ld [hl], $0 + inc hl + add $8 + dec c + jr nz, .loop + ret + +GFX_ea597: +INCBIN "gfx/zero_one_ea597.2bpp" +GFX_ea597End: + +PrinterDebug_ConvertStatusFlagsToTiles: + ld hl, wOAMBuffer + 32 * 4 + 2 + ld de, 4 + ld a, [wPrinterStatusFlags] + ld c, 8 +.loop + sla a + jr c, .place_1 + ld [hl], $fe + jr .okay + +.place_1 + ld [hl], $ff +.okay + add hl, de + dec c + jr nz, .loop + ret + +PrinterDebug_DoFunction: + ld a, [wPrinterSendState] + ld e, a + ld d, 0 + ld hl, .Jumptable + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] + +.Jumptable: + dw Func_ea623 + dw Func_ea6d2 + dw Func_ea6af + dw Func_ea645 + dw Func_ea701 + dw Func_ea6bd + dw Func_ea671 + dw Func_ea701 + dw Func_ea6af + dw Func_ea68a + dw Func_ea701 + dw Func_ea6af + dw Func_ea721 + dw Func_ea610 + dw Func_ea61a + dw Func_ea6af + dw Func_ea61e + dw Func_ea72f + dw Func_ea732 + +Func_ea606: + ld hl, wPrinterSendState + inc [hl] + ret + +Func_ea60b: + ld hl, wPrinterSendState + dec [hl] + ret + +Func_ea610: + xor a + ld [wPrinterStatusFlags], a + ld hl, wPrinterSendState + set 7, [hl] + ret + +Func_ea61a: + call Func_ea606 + ret + +Func_ea61e: + xor a + ld [wPrinterSendState], a + ret + +Func_ea623: + call Func_ea784 + ld hl, Data_ea9de + call Func_ea76b + xor a + ld [wPrinterDataSize], a + ld [wPrinterDataSize + 1], a + ld a, [wPrinterQueueLength] + ld [wPrinterRowIndex], a + call Func_ea606 + call Func_ea74c + ld a, $1 + ld [wPrinterStatusIndicator], a + ret + +Func_ea645: + call Func_ea784 + ld hl, wPrinterRowIndex + ld a, [hl] + and a + jr z, Func_ea671 + ld hl, Data_ea9ea + call Func_ea76b + call PrinterDebug_PrepOAMForPrinting + ld a, $80 + ld [wPrinterDataSize], a + ld a, $2 + ld [wPrinterDataSize + 1], a + call Func_ea7a2 + call Func_ea606 + call Func_ea74c + ld a, $2 + ld [wPrinterStatusIndicator], a + ret + +Func_ea671: + ld a, $6 + ld [wPrinterSendState], a + ld hl, Data_ea9f0 + call Func_ea76b + xor a + ld [wPrinterDataSize], a + ld [wPrinterDataSize + 1], a + call Func_ea606 + call Func_ea74c + ret + +Func_ea68a: + call Func_ea784 + ld hl, Data_ea9e4 + call Func_ea76b + call Func_ea7d2 + ld a, $4 + ld [wPrinterDataSize], a + ld a, $0 + ld [wPrinterDataSize + 1], a + call Func_ea7a2 + call Func_ea606 + call Func_ea74c + ld a, $3 + ld [wPrinterStatusIndicator], a + ret + +Func_ea6af: + ld hl, wPrinterSerialFrameDelay + inc [hl] + ld a, [hl] + cp a, $6 + ret c + xor a + ld [hl], a + call Func_ea606 + ret + +Func_ea6bd: + ld hl, wPrinterSerialFrameDelay + inc [hl] + ld a, [hl] + cp 6 + ret c + xor a + ld [hl], a + ld hl, wPrinterRowIndex + dec [hl] + call Func_ea60b + call Func_ea60b + ret + +Func_ea6d2: + call Func_ea742 + ret c + ld a, [wPrinterHandshake] + cp a, $ff + jr nz, .asm_ea6e4 + ld a, [wPrinterStatusFlags] + cp a, $ff + jr z, .asm_ea6fb +.asm_ea6e4 + ld a, [wPrinterHandshake] + cp a, $81 + jr nz, .asm_ea6fb + ld a, [wPrinterStatusFlags] + cp a, $0 + jr nz, .asm_ea6fb + ld hl, wPrinterConnectionOpen + set 1, [hl] + call Func_ea606 + ret + +.asm_ea6fb + ld a, $e + ld [wPrinterSendState], a + ret + +Func_ea701: + call Func_ea742 + ret c + ld a, [wPrinterStatusFlags] + and $f0 + jr nz, .asm_ea71b + ld a, [wPrinterStatusFlags] + and $1 + jr nz, .asm_ea717 + call Func_ea606 + ret + +.asm_ea717 + call Func_ea60b + ret + +.asm_ea71b + ld a, $11 + ld [wPrinterSendState], a + ret + +Func_ea721: + call Func_ea742 + ret c + ld a, [wPrinterStatusFlags] + and $f3 + ret nz + call Func_ea606 + ret + +Func_ea72f: + call Func_ea606 +Func_ea732: + ld a, [wPrinterOpcode] + and a + ret nz + ld a, [wPrinterStatusFlags] + and $f0 + ret nz + xor a + ld [wPrinterSendState], a + ret + +Func_ea742: + ld a, [wPrinterOpcode] + and a + jr nz, .asm_ea74a + and a + ret + +.asm_ea74a + scf + ret + +Func_ea74c: +.asm_ea74c + ld a, [wPrinterOpcode] + and a + jr nz, .asm_ea74c + ld a, $1 + ld [wPrinterOpcode], a + xor a + ld [wPrinterSendByteOffset], a + ld [wPrinterSendByteOffset + 1], a + ld a, $88 + ld [rSB], a + ld a, $1 + ld [rSC], a + ld a, $81 + ld [rSC], a + ret + +Func_ea76b: + ld a, [hli] + ld [wPrinterDataHeader], a + ld a, [hli] + ld [wPrinterDataHeader + 1], a + ld a, [hli] + ld [wPrinterDataHeader + 2], a + ld a, [hli] + ld [wPrinterDataHeader + 3], a + ld a, [hli] + ld [wPrinterDataHeader + 4], a + ld a, [hl] + ld [wPrinterDataHeader + 5], a + ret + +Func_ea784: + xor a + ld hl, wPrinterDataHeader + ld [hli], a + ld [hli], a + ld [hli], a + ld [hl], a + ld hl, wPrinterDataHeader + 4 + ld [hli], a + ld [hl], a + xor a + ld [wPrinterDataSize], a + ld [wPrinterDataSize + 1], a + ld hl, wPrinterSendDataSource1 + ld bc, $280 + call FillMemory + ret + +Func_ea7a2: + ld hl, $0 + ld bc, $4 + ld de, wPrinterDataHeader + call Func_ea7c5 + ld a, [wPrinterDataSize] + ld c, a + ld a, [wPrinterDataSize + 1] + ld b, a + ld de, wPrinterSendDataSource1 + call Func_ea7c5 + ld a, l + ld [wPrinterDataHeader + 4], a + ld a, h + ld [wPrinterDataHeader + 5], a + ret + +Func_ea7c5: +.asm_ea7c5 + ld a, [de] + inc de + add l + jr nc, .asm_ea7cb + inc h +.asm_ea7cb + ld l, a + dec bc + ld a, c + or b + jr nz, .asm_ea7c5 + ret + +Func_ea7d2: + ld a, $1 + ld [wPrinterSendDataSource1], a + ld a, [wcae2] + ld [wPrinterStatusReceived], a + ld a, $e4 + ld [wc6f2], a + ld a, [wPrinterSettingsTempCopy] + ld [wc6f3], a + ret + +PrinterDebug_PrepOAMForPrinting: + ld a, [wPrinterRowIndex] + ld b, a + ld a, [wPrinterQueueLength] + sub b + ld hl, wPrinterTileBuffer + ld de, $28 +.get_start_addr + and a + jr z, .start_working + add hl, de + dec a + jr .get_start_addr + +.start_working + ld e, l + ld d, h + ld hl, wPrinterSendDataSource1 + ld c, $28 +.prep_loop + ld a, [de] + inc de + push bc + push de + push hl + swap a + ld d, a + and $f0 + ld e, a + ld a, d + and $f + ld d, a + and $8 + ld a, d + jr nz, .vtiles1 + or $90 + jr .got_vram_address + +.vtiles1 + or $80 +.got_vram_address + ld d, a + lb bc, BANK(PrinterDebug_PrepOAMForPrinting), $1 + call CopyVideoData + pop hl + ld de, $10 + add hl, de + pop de + pop bc + dec c + jr nz, .prep_loop + call .UnnecessaryCall + ret + +.UnnecessaryCall: + ld hl, wcbdc + ld bc, $20 + xor a + call FillMemory + ld hl, wOAMBuffer + ld c, $28 +.master_loop + push bc + push hl + call .AreWePrintingThisSegment + jr nc, .skip_segment + call .GetVRAMAddress + call .GetOAMFlags + call .ApplyObjectPalettes + call .PlaceObject +.skip_segment + pop hl + inc hl + inc hl + inc hl + inc hl + pop bc + dec c + jr nz, .master_loop + ret + +.AreWePrintingThisSegment: + ld a, [wPrinterRowIndex] + ld b, a + ld a, [wPrinterQueueLength] + sub b + ld c, a + ld b, $10 +.add_n_times + ld a, c + and a + jr z, .check + ld a, b + add $10 + ld b, a + dec c + jr .add_n_times + +.check + ld a, b + ld e, a + add $10 + ld d, a + ld a, [hl] + cp e + jr c, .not_printing + cp d + jr nc, .not_printing + scf + ret + +.not_printing + and a + ret + +.GetVRAMAddress: + push hl + inc hl + inc hl + ld a, [hl] + swap a + ld d, a + and $f0 + ld e, a + ld a, d + and $f + or $80 + ld d, a + ld hl, wcbdc + lb bc, BANK(.GetVRAMAddress), $1 + call CopyVideoData + pop hl + ret + +.GetOAMFlags: + push hl + inc hl + inc hl + inc hl + ld a, [hl] + call .DoBitOperation + pop hl + ret + +.DoBitOperation: + and $60 + swap a + ld e, a + ld d, 0 + ld hl, .Jumptable + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] + +.Jumptable: + dw .nop + dw .xflip + dw .yflip + dw .both + +.nop: + ret + +.xflip: + call .XFlip + ret + +.yflip: + call .YFlip + ret + +.both: + call .XFlip + call .YFlip + ret + +.XFlip: + ld hl, wcbdc + ld c, 16 +.byte_loop + ld d, [hl] + ld a, 0 + ld b, 8 +.bit_loop + sla d + rr a + dec b + jr nz, .bit_loop + ld [hli], a + dec c + jr nz, .byte_loop + ret + +.YFlip: + ld hl, wcbdc + ld de, wcbea + ld c, $4 +.swap_loop + ld b, [hl] + ld a, [de] + ld [hli], a + ld a, b + ld [de], a + inc de + ld b, [hl] + ld a, [de] + ld [hli], a + ld a, b + ld [de], a + dec de + dec de + dec de + dec c + jr nz, .swap_loop + ret + +.ApplyObjectPalettes: + push hl + ld hl, wcbdc + ld de, wcbec + ld a, 8 +.loop1 + push af + ld bc, $0 + ld a, 8 +.loop2 + push af + xor a + rlc [hl] + rl a + inc hl + rlc [hl] + rl a + dec hl + push hl + push de + call .ExpandPalettesToBC + pop de + pop hl + pop af + dec a + jr nz, .loop2 + inc hl + inc hl + ld a, b + ld [de], a + inc de + ld a, c + ld [de], a + inc de + pop af + dec a + jr nz, .loop1 + pop hl + ret + +.ExpandPalettesToBC: + call .GetPaletteFunction + call .ApplyPaletteFunction + ret + +.GetPaletteFunction: + ld e, a + ld d, 0 + ld hl, .PalJumptable + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] + +.PalJumptable: + dw .Pal0 + dw .Pal1 + dw .Pal2 + dw .Pal3 + +.Pal0: + ld a, [rOBP0] + and $3 + ret + +.Pal2: + ld a, [rOBP0] + and $c + srl a + srl a + ret + +.Pal1: + ld a, [rOBP0] + and $30 + swap a + ret + +.Pal3: + ld a, [rOBP0] + and $c0 + rlca + rlca + ret + +.ApplyPaletteFunction: + ld e, a + ld d, 0 + ld hl, .PalFunJumptable + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] + +.PalFunJumptable: + dw .zero_zero + dw .xflip_zero + dw .zero_xflip + dw .xflip_xflip + +.zero_zero: + sla b + sla c + ret + +.xflip_zero: + scf + rl b + sla c + ret + +.zero_xflip: + sla b + scf + rl c + ret + +.xflip_xflip: + scf + rl b + scf + rl c + ret + +.PlaceObject: + push hl + ld a, [hli] + ld c, [hl] + and $8 + jr nz, .use_source_2 + ld hl, wPrinterSendDataSource1 + jr .got_data_source + +.use_source_2 + ld hl, wPrinterSendDataSource2 +.got_data_source + ld b, $0 + ld a, c + and %11111000 + sub $8 + ld c, a + sla c + rl b + add hl, bc + ld e, l + ld d, h + ld hl, wcbec + ld c, $8 +.coord_copy_loop + call .GetBitMask + ld a, [de] + and b + or [hl] + ld [de], a + inc hl + inc de + ld a, [de] + and b + or [hl] + ld [de], a + inc hl + inc de + dec c + jr nz, .coord_copy_loop + pop hl + ret + +.GetBitMask: + push hl + push de + ld de, -$10 + add hl, de + ld a, [hli] + or [hl] + xor $ff + ld b, a + pop de + pop hl + ret + +Data_ea9de: ; ea9de + db 1, 0, $00, 0 + dw 1 +Data_ea9e4: ; ea9e4 + db 2, 0, $04, 0 + dw 0 +Data_ea9ea: ; ea9ea + db 4, 0, $80, 2 + dw 0 +Data_ea9f0: ; ea9f0 + db 4, 0, $00, 0 + dw 4 +Data_ea9f6: ; ea9f6 + db 8, 0, $00, 0 + dw 8 +Data_ea9fc: ; ea9fc + db 15, 0, $00, 0 + dw 15 diff --git a/engine/vermilion_gym_trash_cans.asm b/engine/vermilion_gym_trash_cans.asm new file mode 100755 index 00000000..49dee50c --- /dev/null +++ b/engine/vermilion_gym_trash_cans.asm @@ -0,0 +1,108 @@ +TrashCanRandom: + ld d, 0 + ld hl, .Jumptable + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + call JumpToAddress + ld e, a + ld d, 0 + ret + +.Jumptable: + dw .zero + dw .one + dw .two + dw .three + dw .four + +.zero +.one + ld a, 0 + ret + +.two + call Random + and $1 + ret + +.three ; should return to a, instead returns to b + call Random + swap a + cp 1 * $ff / 3 + ld b, 0 + ret c + cp 2 * $ff / 3 + ld b, 1 + ret c + ld b, 2 + ret + +.four + call Random + and $3 + ret + +Yellow_SampleSecondTrashCan: + ld hl, GymTrashCans3c + ld a, [wGymTrashCanIndex] + ld c, a + ld b, 0 + ld a, 9 + call AddNTimes + call AddNTimes ; ???? + ld a, [hli] + ld [hGymTrashCanRandNumMask], a + ld e, a + push hl + call TrashCanRandom + pop hl + add hl, de + add hl, de + ld a, [hli] + ld [wSecondLockTrashCanIndex], a + ld a, [hl] + ld [wSecondLockTrashCanIndex + 1], a + ret + +GymTrashCans3c: +; First byte: number of trashcan entries +; Following four byte pairs: indices for the second trash can. +; BUG: Rows that have 3 trashcan entries are sampled incorrectly. +; The sampling occurs by taking a random number and seeing which +; third of the range 0-255 the number falls in. However, it returns +; that value to the wrong register, so the result is never used. +; Instead of using an offset in [0,1,2], the offset is instead +; in the full range 0-255. This results in truly random behavior. + db 4 + db 1,3, 3,1, 1,-1, 3,-1 + db 3 + db 0,2, 2,4, 4,0, -1,-1 + db 4 + db 1,5, 5,1, 1,-1, 5,-1 + db 3 + db 0,4, 4,6, 6,0, -1,-1 + db 4 + db 1,3, 3,1, 5,5, 7,7 + db 3 + db 2,4, 4,8, 8,2, -1,-1 + db 3 + db 3,7, 7,9, 9,3, -1,-1 + db 4 + db 4,8, 6,10, 8,4, 10,6 + db 3 + db 5,7, 7,11, 11,5, -1,-1 + db 3 + db 6,10, 10,12, 12,6, -1,-1 + db 4 + db 7,9, 9,7, 11,13, 13,11 + db 3 + db 8,10, 10,14, 14,8, -1,-1 + db 4 + db 9,13, 13,9, 9,-1, 13,-1 + db 3 + db 10,12, 12,14, 14,10, -1,-1 + db 4 + db 11,13, 13,11, 11,-1, 13,-1 diff --git a/engine/yellow_intro.asm b/engine/yellow_intro.asm new file mode 100755 index 00000000..3adb72b5 --- /dev/null +++ b/engine/yellow_intro.asm @@ -0,0 +1,1081 @@ +PlayIntroScene: + ld a, [rIE] + push af + xor a + ld [rIF], a + ld a, $f + ld [rIE], a + ld a, $8 + ld [rSTAT], a + call InitYellowIntroGFXAndMusic + call DelayFrame +.loop + ld a, [wYellowIntroCurrentScene] + bit 7, a + jr nz, .go_to_title_screen + call JoypadLowSensitivity + ld a, [hJoyPressed] + and A_BUTTON | B_BUTTON | START + jr nz, .go_to_title_screen + call Func_f98fc + ld a, $0 + ld [wCurrentAnimatedObjectOAMBufferOffset], a + call RunObjectAnimations + ld a, [wYellowIntroCurrentScene] + cp $7 + call z, Func_f98a2 + cp $b + call z, Func_f98cb + call DelayFrame + jr .loop + +.go_to_title_screen + call YellowIntro_BlankPalettes + xor a + ld [hLCDCPointer], a + call DelayFrame + xor a + ld [rIF], a + pop af + ld [rIE], a + ld a, $90 + ld [hWY], a + call ClearObjectAnimationBuffers + ld hl, wTileMap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT + xor a + call Bank3E_FillMemory + call YellowIntro_BlankOAMBuffer + ld a, $1 + ld [H_AUTOBGTRANSFERENABLED], a + call DelayFrame + call DelayFrame + call DelayFrame + xor a + ld [H_AUTOBGTRANSFERENABLED], a + ret + +Func_f98a2: + ld a, [wOAMBuffer + 8 * 4 + 3] + or $1 + ld [wOAMBuffer + 8 * 4 + 3], a + ld a, [wOAMBuffer + 14 * 4 + 3] + or $1 + ld [wOAMBuffer + 14 * 4 + 3], a + ld a, [wOAMBuffer + 16 * 4 + 3] + or $1 + ld [wOAMBuffer + 16 * 4 + 3], a + ld a, [wOAMBuffer + 18 * 4 + 3] + or $1 + ld [wOAMBuffer + 18 * 4 + 3], a + ld a, [wOAMBuffer + 19 * 4 + 3] + or $1 + ld [wOAMBuffer + 19 * 4 + 3], a + ret + +Func_f98cb: + ld a, [wOAMBuffer + 18 * 4 + 3] + or $1 + ld [wOAMBuffer + 18 * 4 + 3], a + ld a, [wOAMBuffer + 19 * 4 + 3] + or $1 + ld [wOAMBuffer + 19 * 4 + 3], a + ld a, [wOAMBuffer + 20 * 4 + 3] + or $1 + ld [wOAMBuffer + 20 * 4 + 3], a + ld a, [wOAMBuffer + 25 * 4 + 3] + or $1 + ld [wOAMBuffer + 25 * 4 + 3], a + ld a, [wOAMBuffer + 26 * 4 + 3] + or $1 + ld [wOAMBuffer + 26 * 4 + 3], a + ld a, [wOAMBuffer + 28 * 4 + 3] + or $1 + ld [wOAMBuffer + 28 * 4 + 3], a + ret + +Func_f98fc: + ld a, [wYellowIntroCurrentScene] + ld hl, Jumptable_f9906 + call Func_fa06e + jp [hl] + +Jumptable_f9906: + dw YellowIntroScene0 ; running pika 1 + dw YellowIntroScene1 ; wait last + dw YellowIntroScene2 ; pikachu kick + dw YellowIntroScene3 ; wait last + dw YellowIntroScene4 ; running pika 2 + dw YellowIntroScene5 ; wait last + dw YellowIntroScene6 ; surfing pika + dw YellowIntroScene7 ; wait last + dw YellowIntroScene8 ; running pika 3 + dw YellowIntroScene9 ; wait last + dw YellowIntroScene10 ; flying pika + dw YellowIntroScene11 ; wait last + dw YellowIntroScene12 ; pika close up + dw YellowIntroScene13 ; wait last + dw YellowIntroScene14 ; pika thunderbolt + dw YellowIntroScene15 ; wait last + dw YellowIntroScene16 ; fade to white + dw YellowIntroScene17 ; wait and quit + +YellowIntro_NextScene: + ld hl, wYellowIntroCurrentScene + inc [hl] + ret + +YellowIntroScene0: + xor a + ld [hLCDCPointer], a + lb de, $58, $58 + ld a, $1 + call YellowIntro_SpawnAnimatedObjectAndSavePointer + xor a + ld [hSCX], a + ld [hSCY], a + ld a, $90 + ld [hWY], a + ld a, $e4 + ld [rBGP], a + ld [rOBP0], a + ld a, $c4 + ld [rOBP1], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 + ld a, 130 + ld [wYellowIntroSceneTimer], a + call YellowIntro_NextScene + ret + +YellowIntroScene1: + call YellowIntro_CheckFrameTimerDecrement + ret nc + call YellowIntro_MaskCurrentAnimatedObjectStruct + call YellowIntro_NextScene + ret + +YellowIntroScene2: + call YellowIntro_BlankPalsDelay2AndDisableLCD + ld c, $8 + call UpdateMusicCTimes + xor a + ld [hLCDCPointer], a + ld hl, vBGMap0 + ld bc, $400 + xor a + call Bank3E_FillMemory + call YellowIntroScene2_PlaceGraphic + lb de, $58, $b8 ; overloaded + ld a, $4 ; overloaded + call LoadYellowIntroFlyingSpeedBars + ld a, $1 + call Func_f9e9a + call YellowIntro_SetTimerFor128Frames + call YellowIntro_NextScene + ret + +YellowIntroScene2_PlaceGraphic: + ld hl, $98d4 ; (20, 6) + ld de, $20 + ld b, $6 + ld a, $90 +.row + ld c, $6 + push af + push hl +.col + ld [hli], a + inc a + dec c + jr nz, .col + pop hl + add hl, de + pop af + add $10 + dec b + jr nz, .row + ld a, [hGBC] + and a + jr z, .dmg_sgb + ; We can actually set palettes! + ld hl, $98d4 ; (20, 6) + ld de, $20 + ld b, $6 + ld a, $1 + ld [rVBK], a +.attr_row + ld c, $6 + push hl +.attr_col + ld [hli], a + dec c + jr nz, .attr_col + pop hl + add hl, de + dec b + jr nz, .attr_row + xor a + ld [rVBK], a +.dmg_sgb + ret + +LoadYellowIntroFlyingSpeedBars: + ld hl, YellowIntroFlyingSpeedBarData + ld a, $8 +.loop +; Spawn object $8 at indicated coordinates with indicated speeds + push af + ld e, [hl] + inc hl + ld d, [hl] + inc hl + ld a, [hli] + push hl + push af + ld a, $8 + call SpawnAnimatedObject + pop af + ld hl, $b + add hl, bc + ld [hl], a + pop hl + pop af + dec a + jr nz, .loop + ret + +YellowIntroFlyingSpeedBarData: + ; y, x, speed + db $d0, $20, $02 + db $f0, $30, $04 + db $d0, $40, $06 + db $c0, $50, $08 + db $e0, $60, $08 + db $c0, $70, $06 + db $e0, $80, $04 + db $f0, $90, $02 + +YellowIntroScene3: + call YellowIntro_CheckFrameTimerDecrement + jr c, .expired + ld a, [hSCX] + cp $68 + ret z + add $4 + ld [hSCX], a + ret + +.expired + call MaskAllAnimatedObjectStructs + call YellowIntro_NextScene + ret + +YellowIntroScene4: + call YellowIntro_BlankPalsDelay2AndDisableLCD + ld c, $5 + call UpdateMusicCTimes + ld a, [hGBC] + and a + jr z, .dmg_sgb + ; We can actually set palettes! + ld hl, $98d4 + ld de, $20 + ld b, $6 + ld a, $1 + ld [rVBK], a + xor a +.attr_row + ld c, $6 + push hl +.attr_col + ld [hli], a + dec c + jr nz, .attr_col + pop hl + add hl, de + dec b + jr nz, .attr_row + xor a + ld [rVBK], a +.dmg_sgb + xor a + ld [hLCDCPointer], a + call Func_f9e5f + lb de, $58, $58 + ld a, $2 + call YellowIntro_SpawnAnimatedObjectAndSavePointer + xor a + call Func_f9e9a + call YellowIntro_SetTimerFor128Frames + call YellowIntro_NextScene + ret + +YellowIntroScene5: + call YellowIntro_CheckFrameTimerDecrement + ret nc + call YellowIntro_MaskCurrentAnimatedObjectStruct + call YellowIntro_NextScene + ret + +YellowIntroScene6: + call YellowIntro_BlankPalsDelay2AndDisableLCD + ld c, $5 + call UpdateMusicCTimes + ld a, rSCY - $ff00 + ld [hLCDCPointer], a + call YellowIntro_Copy8BitSineWave + ld hl, vBGMap0 + ld bc, $60 + xor a + call Bank3E_FillMemory + ld hl, $9860 + ld c, $10 + ld a, $20 +.asm_f9a8b + ld [hli], a + inc a + ld [hli], a + dec a + dec c + jr nz, .asm_f9a8b + ld hl, $9880 + ld bc, $300 + ld a, $10 + call Bank3E_FillMemory + lb de, $40, $f8 + ld a, $5 + call YellowIntro_SpawnAnimatedObjectAndSavePointer + ld a, $1 + call Func_f9e9a + call YellowIntro_SetTimerFor88Frames + call YellowIntro_NextScene + ret + +YellowIntroScene7: + call YellowIntro_CheckFrameTimerDecrement + jr c, .expired + ld hl, hSCX + inc [hl] + inc [hl] + ld hl, wLYOverridesBuffer + ld de, wLYOverridesBuffer + 1 + ld a, [hl] + push af + ld c, $ff +.shift_loop + ld a, [de] + inc de + ld [hli], a + dec c + jr nz, .shift_loop + pop af + ld [hl], a + call Request7TileTransferFromC810ToC710 + ret + +.expired + call YellowIntro_MaskCurrentAnimatedObjectStruct + call YellowIntro_NextScene + ret + +YellowIntroScene8: + call YellowIntro_BlankPalsDelay2AndDisableLCD + ld c, $5 + call UpdateMusicCTimes + xor a + ld [hLCDCPointer], a + call Func_f9e5f + lb de, $58, $58 + ld a, $3 + call YellowIntro_SpawnAnimatedObjectAndSavePointer + xor a + call Func_f9e9a + call YellowIntro_SetTimerFor128Frames + call YellowIntro_NextScene + ret + +YellowIntroScene9: + call YellowIntro_CheckFrameTimerDecrement + ret nc + call YellowIntro_MaskCurrentAnimatedObjectStruct + call YellowIntro_NextScene + ret + +YellowIntroScene10: + call YellowIntro_BlankPalsDelay2AndDisableLCD + ld c, $5 + call UpdateMusicCTimes + xor a + ld [hLCDCPointer], a + ld hl, vBGMap0 + ld bc, $400 + xor a + call Bank3E_FillMemory + ld hl, vBGMap0 + ld bc, $100 + ld a, $2 + call Bank3E_FillMemory + ld hl, $9900 + ld de, Unkn_f9b6e + lb bc, 6, 20 + call .FillBGMapBox + ld hl, $988c + ld de, Unkn_f9be6 + lb bc, 3, 4 + call .FillBGMapBox + ld hl, $98e3 + ld de, Unkn_f9bf2 + lb bc, 2, 2 + call .FillBGMapBox + lb de, $98, $58 + ld a, $6 + call YellowIntro_SpawnAnimatedObjectAndSavePointer + ld a, $1 + call Func_f9e9a + call YellowIntro_SetTimerFor128Frames + call YellowIntro_NextScene + ret + +.FillBGMapBox: +.fill_row + push bc + push hl +.fill_col + ld a, [de] + inc de + ld [hli], a + dec c + jr nz, .fill_col + pop hl + ld bc, $20 + add hl, bc + pop bc + dec b + jr nz, .fill_row + ret + +Unkn_f9b6e: INCBIN "gfx/unknown_f9b6e.map" +Unkn_f9be6: INCBIN "gfx/unknown_f9be6.map" +Unkn_f9bf2: INCBIN "gfx/unknown_f9bf2.map" + +YellowIntroScene11: + call YellowIntro_CheckFrameTimerDecrement + jr c, .expired + ld a, [wYellowIntroSceneTimer] + and $7 + ret nz + ld a, [wYellowIntroSceneTimer] + and $8 + sla a + sla a + sla a + ld e, a + ld d, $0 + ld hl, YellowIntroCloudGFX1 + add hl, de + ld a, l + ld [H_VBCOPYSRC], a + ld a, h + ld [H_VBCOPYSRC + 1], a + xor a + ld [H_VBCOPYDEST], a + ld a, $96 + ld [H_VBCOPYDEST + 1], a + ld a, $4 + ld [H_VBCOPYSIZE], a + ret + +.expired + call YellowIntro_MaskCurrentAnimatedObjectStruct + call YellowIntro_NextScene + ret + +YellowIntroCloudGFX1: INCBIN "gfx/unknown_f9c2c.2bpp" +YellowIntroCloudGFX2: INCBIN "gfx/unknown_f9c6c.2bpp" ; indirectly referenced + +YellowIntroScene12: + call YellowIntro_BlankPalsDelay2AndDisableLCD + ld c, $5 + call UpdateMusicCTimes + xor a + ld [hLCDCPointer], a + ld hl, vBGMap0 + ld bc, $80 + ld a, $1 + call Bank3E_FillMemory + ld hl, $9880 + ld bc, $140 + xor a + call Bank3E_FillMemory + ld hl, $99c0 + ld bc, $80 + ld a, $1 + call Bank3E_FillMemory + + ; paste 8x12 graphic into vBGMap0 at (5, 6) starting at tile 4, skipping 4 vtiles at the end of each row + ld hl, $98c5 + ld de, $20 + ld a, $4 + ld b, 8 +.row + ld c, 12 + push hl +.col + ld [hli], a + inc a + dec c + jr nz, .col + pop hl + add hl, de + add $4 + dec b + jr nz, .row + + ld hl, $98c4 ; (4, 6) + ld [hl], $3 + ld hl, $98e4 ; (4, 7) + ld [hl], $74 + ld hl, $99a5 ; (5, 5) + ld [hl], $0 + lb de, $60, $58 + ld a, $9 + call YellowIntro_SpawnAnimatedObjectAndSavePointer + xor a + call Func_f9e9a + call YellowIntro_SetTimerFor128Frames + call YellowIntro_NextScene + ret + +YellowIntroScene13: + call YellowIntro_CheckFrameTimerDecrement + ret nc + lb de, $68, $58 + ld a, $a + call SpawnAnimatedObject + call YellowIntro_NextScene + ret + +YellowIntroScene14: + ld de, YellowIntroPalSequence_f9dd6 + call YellowIntro_LoadDMGPalAndIncrementCounter + jr c, .expired + ld [rBGP], a + ld [rOBP0], a + and $f0 + ld [rOBP1], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 + ret + +.expired + call MaskAllAnimatedObjectStructs + call YellowIntro_BlankOAMBuffer + ld hl, wTileMap + ld bc, $50 + ld a, $1 + call Bank3E_FillMemory + coord hl, 0, 4 + ld bc, CopyVideoDataAlternate + xor a + call Bank3E_FillMemory + coord hl, 0, 14 + ld bc, $50 + ld a, $1 + call Bank3E_FillMemory + ld a, $1 + ld [H_AUTOBGTRANSFERENABLED], a + call DelayFrame + call DelayFrame + call DelayFrame + xor a + ld [H_AUTOBGTRANSFERENABLED], a + ld a, $e4 + ld [rOBP0], a + ld [rBGP], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + lb de, $58, $58 + ld a, $7 + call YellowIntro_SpawnAnimatedObjectAndSavePointer + call YellowIntro_NextScene + ld a, $28 + ld [wYellowIntroSceneTimer], a + ret + +YellowIntroScene15: + call YellowIntro_CheckFrameTimerDecrement + jr c, .expired + ld a, [wYellowIntroSceneTimer] + and $3 + ret nz + ld a, [rOBP0] + xor $ff + ld [rOBP0], a + ld a, [rBGP] + xor $3 + ld [rBGP], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + ret + +.expired + xor a + ld [hLCDCPointer], a + ld a, $e4 + ld [rBGP], a + ld [rOBP0], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + call YellowIntro_NextScene +YellowIntroScene16: + ld de, YellowIntroPalSequence_f9e0a + call YellowIntro_LoadDMGPalAndIncrementCounter + jr c, .expired + ld [rOBP0], a + ld [rBGP], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + ret + +.expired + call YellowIntro_NextScene + ret + +YellowIntroPalSequence_f9dd6: + db $e4, $c0, $c0, $e4 + db $e4, $c0, $c0, $e4 + db $e4, $c0, $c0, $e4 + db $e4, $c0, $c0, $e4 + db $e4, $c0, $c0, $e4 + db $e4, $c0, $c0, $e4 + db $e4, $c0, $c0, $e4 + db $e4, $c0, $c0, $e4 + db $e4, $c0, $c0, $e4 + db $e4, $c0, $c0, $e4 + db $e4, $c0, $c0, $e4 + db $e4, $c0, $c0, $e4 + db $e4, $c0, $c0, $ff + +YellowIntroPalSequence_f9e0a: + db $e4, $90, $90, $40 + db $40, $00, $00, $ff + +YellowIntroScene17: + ld c, 64 + call DelayFrames + ld hl, wYellowIntroCurrentScene + set 7, [hl] + ret + +YellowIntro_SpawnAnimatedObjectAndSavePointer: + call SpawnAnimatedObject + ld a, c + ld [wYellowIntroAnimatedObjectStructPointer], a + ld a, b + ld [wYellowIntroAnimatedObjectStructPointer + 1], a + ret + +YellowIntro_MaskCurrentAnimatedObjectStruct: + ld a, [wYellowIntroAnimatedObjectStructPointer] + ld c, a + ld a, [wYellowIntroAnimatedObjectStructPointer + 1] + ld b, a + call MaskCurrentAnimatedObjectStruct + ret + +YellowIntro_SetTimerFor128Frames: + ld a, 128 + ld [wYellowIntroSceneTimer], a + ret + +YellowIntro_SetTimerFor88Frames: + ld a, 88 + ld [wYellowIntroSceneTimer], a + ret + +YellowIntro_CheckFrameTimerDecrement: + ld hl, wYellowIntroSceneTimer + ld a, [hl] + and a + jr z, .asm_f9e4b + dec [hl] + and a + ret + +.asm_f9e4b + scf + ret + +YellowIntro_LoadDMGPalAndIncrementCounter: + ld hl, wYellowIntroSceneTimer + ld a, [hl] + inc [hl] + ld l, a + ld h, $0 + add hl, de + ld a, [hl] + cp $ff + jr z, .asm_f9e5d + and a + ret + +.asm_f9e5d + scf + ret + +Func_f9e5f: + ld hl, vBGMap0 + ld bc, $80 + ld a, $1 + call Bank3E_FillMemory + ld hl, $9880 + ld bc, $140 + xor a + call Bank3E_FillMemory + ld hl, $99c0 + ld bc, $80 + ld a, $1 + call Bank3E_FillMemory + ret + +YellowIntro_BlankPalsDelay2AndDisableLCD: + xor a + ld [rBGP], a + ld [rOBP0], a + ld [rOBP1], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 + call DelayFrame + call DelayFrame + call DisableLCD + ret + +Func_f9e9a: + ld e, a + callab YellowIntroPaletteAction + xor a + ld [hSCX], a + ld [hSCY], a + ld a, $90 + ld [hWY], a + ld a, $e3 + ld [rLCDC], a + ld a, $e4 + ld [rBGP], a + ld [rOBP0], a + ld a, $e0 + ld [rOBP1], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 + ret + +YellowIntro_Copy8BitSineWave: + ; Copy this sine wave into wLYOverridesBuffer 8 times (end just before wc900) + ld de, wLYOverridesBuffer + ld a, $8 +.loop + push af + ld hl, .SineWave + ld bc, .SineWaveEnd - .SineWave + call Bank3E_CopyData + pop af + dec a + jr nz, .loop + ret + +.SineWave: +; a sine wave with amplitude 4 + db 0, 0, 1, 2, 2, 3, 3, 3 + db 4, 3, 3, 3, 2, 2, 1, 0 + db 0, 0, -1, -2, -2, -3, -3, -3 + db -4, -3, -3, -3, -2, -2, -1, 0 +.SineWaveEnd: + +Request7TileTransferFromC810ToC710: + ld a, $10 + ld [H_VBCOPYSRC], a + ld a, wLYOverridesBuffer / $100 + ld [H_VBCOPYSRC + 1], a + ld a, $10 + ld [H_VBCOPYDEST], a + ld a, wLYOverrides / $100 + ld [H_VBCOPYDEST + 1], a + ld a, $7 + ld [H_VBCOPYSIZE], a + ret + +InitYellowIntroGFXAndMusic: + xor a + ld [H_AUTOBGTRANSFERENABLED], a + ld [hSCX], a + ld [hSCY], a + ld [H_AUTOBGTRANSFERDEST], a + ld a, $98 + ld [H_AUTOBGTRANSFERDEST + 1], a + call YellowIntro_BlankTileMap + ld hl, wTileMap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT + ld a, $1 + call Bank3E_FillMemory + coord hl, 0, 4 + ld bc, CopyVideoDataAlternate + xor a + call Bank3E_FillMemory + ld a, $1 + ld [H_AUTOBGTRANSFERENABLED], a + call DelayFrame + call DelayFrame + call DelayFrame + xor a + ld [H_AUTOBGTRANSFERENABLED], a + ld de, $6b5a + ld hl, $8000 + ld bc, $3eff + call CopyVideoData + ld de, $635a + ld hl, $9000 + ld bc, $3e80 + call CopyVideoData + call ClearObjectAnimationBuffers + call LoadYellowIntroObjectAnimationDataPointers + ld b, $8 + call RunPaletteCommand + xor a + ld hl, wYellowIntroCurrentScene + ld [hli], a + ld [hli], a + ld [hli], a + ld [hl], a + ld a, MUSIC_INTRO_BATTLE + ld c, BANK(Music_IntroBattle) + call PlayMusic + ret + +LoadYellowIntroObjectAnimationDataPointers: + ld a, YellowIntro_AnimatedObjectSpawnStateData % $100 + ld [wAnimatedObjectSpawnStateDataPointer], a + ld a, YellowIntro_AnimatedObjectSpawnStateData / $100 + ld [wAnimatedObjectSpawnStateDataPointer + 1], a + ld a, YellowIntro_AnimatedObjectJumptable % $100 + ld [wAnimatedObjectJumptablePointer], a + ld a, YellowIntro_AnimatedObjectJumptable / $100 + ld [wAnimatedObjectJumptablePointer + 1], a + ld a, YellowIntro_AnimatedObjectOAMData % $100 + ld [wAnimatedObjectOAMDataPointer], a + ld a, YellowIntro_AnimatedObjectOAMData / $100 + ld [wAnimatedObjectOAMDataPointer + 1], a + ld a, YellowIntro_AnimatedObjectFramesData % $100 + ld [wAnimatedObjectFramesDataPointer], a + ld a, YellowIntro_AnimatedObjectFramesData / $100 + ld [wAnimatedObjectFramesDataPointer + 1], a + ret + +YellowIntro_BlankTileMap: + ld hl, wTileMap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT + ld a, $7f + call Bank3E_FillMemory + ret + +Bank3E_CopyData: +.loop + ld a, [hli] + ld [de], a + inc de + dec bc + ld a, c + or b + jr nz, .loop + ret + +Bank3E_FillMemory: + push de + ld e, a +.loop + ld a, e + ld [hli], a + dec bc + ld a, c + or b + jr nz, .loop + pop de + ret + +YellowIntro_BlankOAMBuffer: + ld hl, wOAMBuffer + ld bc, wOAMBufferEnd - wOAMBuffer + xor a + call Bank3E_FillMemory + ret + +YellowIntro_BlankPalettes: + xor a + ld [rBGP], a + ld [rOBP0], a + ld [rOBP1], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 + ret + +YellowIntro_AnimatedObjectSpawnStateData: + db $00, $00, $00 + db $01, $01, $00 + db $02, $01, $00 + db $03, $01, $00 + db $04, $02, $00 + db $05, $03, $00 + db $06, $04, $00 + db $07, $01, $00 + db $08, $05, $00 + db $09, $01, $00 + db $0a, $01, $00 + +YellowIntro_AnimatedObjectJumptable: + dw Func_fa007 + dw Func_fa007 + dw Func_fa008 + dw Func_fa014 + dw Func_fa02b + dw Func_fa062 + +Func_fa007: + ret + +Func_fa008: + ld hl, $4 + add hl, bc + ld a, [hl] + cp $58 + ret z + sub $4 + ld [hl], a + ret + +Func_fa014: + ld hl, $4 + add hl, bc + ld a, [hl] + cp $58 + jr z, .asm_fa020 + add $4 + ld [hl], a +.asm_fa020 + ld hl, $5 + add hl, bc + cp $58 + ret z + add $1 + ld [hl], a + ret + +Func_fa02b: + ld hl, $b + add hl, bc + ld e, [hl] + ld d, $0 + ld hl, Jumptable_fa03b + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] + +Jumptable_fa03b: + dw Func_fa03f + dw Func_fa051 + +Func_fa03f: + ld hl, $5 + add hl, bc + ld a, [hl] + cp $58 + jr z, .asm_fa04c + sub $2 + ld [hl], a + ret + +.asm_fa04c + ld hl, $b + add hl, bc + inc [hl] +Func_fa051: + ld hl, $c + add hl, bc + ld a, [hl] + inc [hl] + ld d, $8 + call Func_fa079 + ld hl, $7 + add hl, bc + ld [hl], a + ret + +Func_fa062: + ld hl, $b + add hl, bc + ld a, [hl] + ld hl, $4 + add hl, bc + add [hl] + ld [hl], a + ret + +Func_fa06e: + ld e, a + ld d, $0 + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + ret + +Func_fa077: ; cosine + add $10 +Func_fa079: + and $3f + cp $20 + jr nc, .asm_fa084 + call Func_fa08e + ld a, h + ret + +.asm_fa084 + and $1f + call Func_fa08e + ld a, h + xor $ff + inc a + ret + +Func_fa08e: + ld e, a + ld a, d + ld d, $0 + ld hl, Unkn_fa0aa + add hl, de + add hl, de + ld e, [hl] + inc hl + ld d, [hl] + ld hl, $0 +.asm_fa09d + srl a + jr nc, .asm_fa0a2 + add hl, de +.asm_fa0a2 + sla e + rl d + and a + jr nz, .asm_fa09d + ret + +Unkn_fa0aa: + sine_wave $100 @@ -0,0 +1,1931 @@ +# -*- coding: utf-8 -*- + +import os +import sys +sys.path.insert(0,(os.path.abspath(os.path.dirname(__file__) + 'extras/pokemontools'))) # correct module path to pokemontools +import png +from math import sqrt, floor, ceil +import argparse + +import configuration +config = configuration.Config() + +import pokemon_constants +import trainers +import romstr + + +def load_rom(): + rom = romstr.RomStr.load(filename=config.rom_path) + return rom + + +def split(list_, interval): + """ + Split a list by length. + """ + for i in xrange(0, len(list_), interval): + j = min(i + interval, len(list_)) + yield list_[i:j] + + +def hex_dump(data, length=0x10): + """ + just use hexdump -C + """ + margin = len('%x' % len(data)) + output = [] + address = 0 + for line in split(data, length): + output += [ + hex(address)[2:].zfill(margin) + + ' | ' + + ' '.join('%.2x' % byte for byte in line) + ] + address += length + return '\n'.join(output) + + +def get_tiles(image): + """ + Split a 2bpp image into 8x8 tiles. + """ + return list(split(image, 0x10)) + +def connect(tiles): + """ + Combine 8x8 tiles into a 2bpp image. + """ + return [byte for tile in tiles for byte in tile] + +def transpose(tiles, width=None): + """ + Transpose a tile arrangement along line y=-x. + + 00 01 02 03 04 05 00 06 0c 12 18 1e + 06 07 08 09 0a 0b 01 07 0d 13 19 1f + 0c 0d 0e 0f 10 11 <-> 02 08 0e 14 1a 20 + 12 13 14 15 16 17 03 09 0f 15 1b 21 + 18 19 1a 1b 1c 1d 04 0a 10 16 1c 22 + 1e 1f 20 21 22 23 05 0b 11 17 1d 23 + """ + if width == None: + width = int(sqrt(len(tiles))) # assume square image + tiles = sorted(enumerate(tiles), key= lambda (i, tile): i % width) + return [tile for i, tile in tiles] + +def transpose_tiles(image, width=None): + return connect(transpose(get_tiles(image), width)) + +def interleave(tiles, width): + """ + 00 01 02 03 04 05 00 02 04 06 08 0a + 06 07 08 09 0a 0b 01 03 05 07 09 0b + 0c 0d 0e 0f 10 11 --> 0c 0e 10 12 14 16 + 12 13 14 15 16 17 0d 0f 11 13 15 17 + 18 19 1a 1b 1c 1d 18 1a 1c 1e 20 22 + 1e 1f 20 21 22 23 19 1b 1d 1f 21 23 + """ + interleaved = [] + left, right = split(tiles[::2], width), split(tiles[1::2], width) + for l, r in zip(left, right): + interleaved += l + r + return interleaved + +def deinterleave(tiles, width): + """ + 00 02 04 06 08 0a 00 01 02 03 04 05 + 01 03 05 07 09 0b 06 07 08 09 0a 0b + 0c 0e 10 12 14 16 --> 0c 0d 0e 0f 10 11 + 0d 0f 11 13 15 17 12 13 14 15 16 17 + 18 1a 1c 1e 20 22 18 19 1a 1b 1c 1d + 19 1b 1d 1f 21 23 1e 1f 20 21 22 23 + """ + deinterleaved = [] + rows = list(split(tiles, width)) + for left, right in zip(rows[::2], rows[1::2]): + for l, r in zip(left, right): + deinterleaved += [l, r] + return deinterleaved + +def interleave_tiles(image, width): + return connect(interleave(get_tiles(image), width)) + +def deinterleave_tiles(image, width): + return connect(deinterleave(get_tiles(image), width)) + + +def condense_tiles_to_map(image): + tiles = get_tiles(image) + new_tiles = [] + tilemap = [] + for tile in tiles: + if tile not in new_tiles: + new_tiles += [tile] + tilemap += [new_tiles.index(tile)] + new_image = connect(new_tiles) + return new_image, tilemap + + +def to_file(filename, data): + file = open(filename, 'wb') + for byte in data: + file.write('%c' % byte) + file.close() + + + +""" +A rundown of Pokemon Crystal's compression scheme: + +Control commands occupy bits 5-7. +Bits 0-4 serve as the first parameter <n> for each command. +""" +lz_commands = { + 'literal': 0, # n values for n bytes + 'iterate': 1, # one value for n bytes + 'alternate': 2, # alternate two values for n bytes + 'blank': 3, # zero for n bytes +} + +""" +Repeater commands repeat any data that was just decompressed. +They take an additional signed parameter <s> to mark a relative starting point. +These wrap around (positive from the start, negative from the current position). +""" +lz_commands.update({ + 'repeat': 4, # n bytes starting from s + 'flip': 5, # n bytes in reverse bit order starting from s + 'reverse': 6, # n bytes backwards starting from s +}) + +""" +The long command is used when 5 bits aren't enough. Bits 2-4 contain a new control code. +Bits 0-1 are appended to a new byte as 8-9, allowing a 10-bit parameter. +""" +lz_commands.update({ + 'long': 7, # n is now 10 bits for a new control code +}) +max_length = 1 << 10 # can't go higher than 10 bits +lowmax = 1 << 5 # standard 5-bit param + +""" +If 0xff is encountered instead of a command, decompression ends. +""" +lz_end = 0xff + + +class Compressed: + + """ + Compress arbitrary data, usually 2bpp. + """ + + def __init__(self, image=None, mode='horiz', size=None): + assert image, 'need something to compress!' + image = list(image) + self.image = image + self.pic = [] + self.animtiles = [] + + # only transpose pic (animtiles were never transposed in decompression) + if size != None: + for byte in range((size*size)*16): + self.pic += image[byte] + for byte in range(((size*size)*16),len(image)): + self.animtiles += image[byte] + else: + self.pic = image + + if mode == 'vert': + self.tiles = get_tiles(self.pic) + self.tiles = transpose(self.tiles) + self.pic = connect(self.tiles) + + self.image = self.pic + self.animtiles + + self.end = len(self.image) + + self.byte = None + self.address = 0 + + self.stream = [] + + self.zeros = [] + self.alts = [] + self.iters = [] + self.repeats = [] + self.flips = [] + self.reverses = [] + self.literals = [] + + self.output = [] + + self.compress() + + + def compress(self): + """ + Incomplete, but outputs working compressed data. + """ + + self.address = 0 + + # todo + #self.scanRepeats() + + while ( self.address < self.end ): + + #if (self.repeats): + # self.doRepeats() + + #if (self.flips): + # self.doFlips() + + #if (self.reverses): + # self.doReverses + + if (self.checkWhitespace()): + self.doLiterals() + self.doWhitespace() + + elif (self.checkIter()): + self.doLiterals() + self.doIter() + + elif (self.checkAlts()): + self.doLiterals() + self.doAlts() + + else: # doesn't fit any pattern -> literal + self.addLiteral() + self.next() + + self.doStream() + + # add any literals we've been sitting on + self.doLiterals() + + # done + self.output.append(lz_end) + + + def getCurByte(self): + if self.address < self.end: + self.byte = ord(self.image[self.address]) + else: self.byte = None + + def next(self): + self.address += 1 + self.getCurByte() + + def addLiteral(self): + self.getCurByte() + self.literals.append(self.byte) + if len(self.literals) > max_length: + raise Exception, "literals exceeded max length and the compressor didn't catch it" + elif len(self.literals) == max_length: + self.doLiterals() + + def doLiterals(self): + if len(self.literals) > lowmax: + self.output.append( (lz_commands['long'] << 5) | (lz_commands['literal'] << 2) | ((len(self.literals) - 1) >> 8) ) + self.output.append( (len(self.literals) - 1) & 0xff ) + elif len(self.literals) > 0: + self.output.append( (lz_commands['literal'] << 5) | (len(self.literals) - 1) ) + for byte in self.literals: + self.output.append(byte) + self.literals = [] + + def doStream(self): + for byte in self.stream: + self.output.append(byte) + self.stream = [] + + + def scanRepeats(self): + """ + Works, but doesn't do flipped/reversed streams yet. + + This takes up most of the compress time and only saves a few bytes. + It might be more effective to exclude it entirely. + """ + + self.repeats = [] + self.flips = [] + self.reverses = [] + + # make a 5-letter word list of the sequence + letters = 5 # how many bytes it costs to use a repeat over a literal + # any shorter and it's not worth the trouble + num_words = len(self.image) - letters + words = [] + for i in range(self.address,num_words): + word = [] + for j in range(letters): + word.append( ord(self.image[i+j]) ) + words.append((word, i)) + + zeros = [] + for zero in range(letters): + zeros.append( 0 ) + + # check for matches + def get_matches(): + # TODO: + # append to 3 different match lists instead of yielding to one + # + #flipped = [] + #for byte in enumerate(this[0]): + # flipped.append( sum(1<<(7-i) for i in range(8) if (this[0][byte])>>i&1) ) + #reversed = this[0][::-1] + # + for whereabout, this in enumerate(words): + for that in range(whereabout+1,len(words)): + if words[that][0] == this[0]: + if words[that][1] - this[1] >= letters: + # remove zeros + if this[0] != zeros: + yield [this[0], this[1], words[that][1]] + + matches = list(get_matches()) + + # remove more zeros + buffer = [] + for match in matches: + # count consecutive zeros in a word + num_zeros = 0 + highest = 0 + for j in range(letters): + if match[0][j] == 0: + num_zeros += 1 + else: + if highest < num_zeros: highest = num_zeros + num_zeros = 0 + if highest < 4: + # any more than 3 zeros in a row isn't worth it + # (and likely to already be accounted for) + buffer.append(match) + matches = buffer + + # combine overlapping matches + buffer = [] + for this, match in enumerate(matches): + if this < len(matches) - 1: # special case for the last match + if matches[this+1][1] <= (match[1] + len(match[0])): # check overlap + if match[1] + len(match[0]) < match[2]: + # next match now contains this match's bytes too + # this only appends the last byte (assumes overlaps are +1 + match[0].append(matches[this+1][0][-1]) + matches[this+1] = match + elif match[1] + len(match[0]) == match[2]: + # we've run into the thing we matched + buffer.append(match) + # else we've gone past it and we can ignore it + else: # no more overlaps + buffer.append(match) + else: # last match, so there's nothing to check + buffer.append(match) + matches = buffer + + # remove alternating sequences + buffer = [] + for match in matches: + for i in range(6 if letters > 6 else letters): + if match[0][i] != match[0][i&1]: + buffer.append(match) + break + matches = buffer + + self.repeats = matches + + + def doRepeats(self): + """doesn't output the right values yet""" + + unusedrepeats = [] + for repeat in self.repeats: + if self.address >= repeat[2]: + + # how far in we are + length = (len(repeat[0]) - (self.address - repeat[2])) + + # decide which side we're copying from + if (self.address - repeat[1]) <= 0x80: + self.doLiterals() + self.stream.append( (lz_commands['repeat'] << 5) | length - 1 ) + + # wrong? + self.stream.append( (((self.address - repeat[1])^0xff)+1)&0xff ) + + else: + self.doLiterals() + self.stream.append( (lz_commands['repeat'] << 5) | length - 1 ) + + # wrong? + self.stream.append(repeat[1]>>8) + self.stream.append(repeat[1]&0xff) + + #print hex(self.address) + ': ' + hex(len(self.output)) + ' ' + hex(length) + self.address += length + + else: unusedrepeats.append(repeat) + + self.repeats = unusedrepeats + + + def checkWhitespace(self): + self.zeros = [] + self.getCurByte() + original_address = self.address + + if ( self.byte == 0 ): + while ( self.byte == 0 ) & ( len(self.zeros) <= max_length ): + self.zeros.append(self.byte) + self.next() + if len(self.zeros) > 1: + return True + self.address = original_address + return False + + def doWhitespace(self): + if (len(self.zeros) + 1) >= lowmax: + self.stream.append( (lz_commands['long'] << 5) | (lz_commands['blank'] << 2) | ((len(self.zeros) - 1) >> 8) ) + self.stream.append( (len(self.zeros) - 1) & 0xff ) + elif len(self.zeros) > 1: + self.stream.append( lz_commands['blank'] << 5 | (len(self.zeros) - 1) ) + else: + raise Exception, "checkWhitespace() should prevent this from happening" + + + def checkAlts(self): + self.alts = [] + self.getCurByte() + original_address = self.address + num_alts = 0 + + # make sure we don't check for alts at the end of the file + if self.address+3 >= self.end: return False + + self.alts.append(self.byte) + self.alts.append(ord(self.image[self.address+1])) + + # are we onto smething? + if ( ord(self.image[self.address+2]) == self.alts[0] ): + cur_alt = 0 + while (ord(self.image[(self.address)+1]) == self.alts[num_alts&1]) & (num_alts <= max_length): + num_alts += 1 + self.next() + # include the last alternated byte + num_alts += 1 + self.address = original_address + if num_alts > lowmax: + return True + elif num_alts > 2: + return True + return False + + def doAlts(self): + original_address = self.address + self.getCurByte() + + #self.alts = [] + #num_alts = 0 + + #self.alts.append(self.byte) + #self.alts.append(ord(self.image[self.address+1])) + + #i = 0 + #while (ord(self.image[self.address+1]) == self.alts[i^1]) & (num_alts <= max_length): + # num_alts += 1 + # i ^=1 + # self.next() + ## include the last alternated byte + #num_alts += 1 + + num_alts = len(self.iters) + 1 + + if num_alts > lowmax: + self.stream.append( (lz_commands['long'] << 5) | (lz_commands['alternate'] << 2) | ((num_alts - 1) >> 8) ) + self.stream.append( num_alts & 0xff ) + self.stream.append( self.alts[0] ) + self.stream.append( self.alts[1] ) + elif num_alts > 2: + self.stream.append( (lz_commands['alternate'] << 5) | (num_alts - 1) ) + self.stream.append( self.alts[0] ) + self.stream.append( self.alts[1] ) + else: + raise Exception, "checkAlts() should prevent this from happening" + + self.address = original_address + self.address += num_alts + + + def checkIter(self): + self.iters = [] + self.getCurByte() + iter = self.byte + original_address = self.address + while (self.byte == iter) & (len(self.iters) < max_length): + self.iters.append(self.byte) + self.next() + self.address = original_address + if len(self.iters) > 3: + # 3 or fewer isn't worth the trouble and actually longer + # if part of a larger literal set + return True + + return False + + def doIter(self): + self.getCurByte() + iter = self.byte + original_address = self.address + + self.iters = [] + while (self.byte == iter) & (len(self.iters) < max_length): + self.iters.append(self.byte) + self.next() + + if (len(self.iters) - 1) >= lowmax: + self.stream.append( (lz_commands['long'] << 5) | (lz_commands['iterate'] << 2) | ((len(self.iters)-1) >> 8) ) + self.stream.append( (len(self.iters) - 1) & 0xff ) + self.stream.append( iter ) + elif len(self.iters) > 3: + # 3 or fewer isn't worth the trouble and actually longer + # if part of a larger literal set + self.stream.append( (lz_commands['iterate'] << 5) | (len(self.iters) - 1) ) + self.stream.append( iter ) + else: + self.address = original_address + raise Exception, "checkIter() should prevent this from happening" + + +class Decompressed: + """ + Parse compressed data, usually 2bpp. + + parameters: + [compressed data] + [tile arrangement] default: 'vert' + [size of pic] default: None + [start] (optional) + + splits output into pic [size] and animation tiles if applicable + data can be fed in from rom if [start] is specified + """ + + def __init__(self, lz=None, mode=None, size=None, start=0): + # todo: play nice with Compressed + + assert lz, 'need something to compress!' + self.lz = lz + + self.byte = None + self.address = 0 + self.start = start + + self.output = [] + + self.decompress() + + debug = False + # print tuple containing start and end address + if debug: print '(' + hex(self.start) + ', ' + hex(self.start + self.address+1) + '),' + + # only transpose pic + self.pic = [] + self.animtiles = [] + + if size != None: + self.tiles = get_tiles(self.output) + self.pic = connect(self.tiles[:(size*size)]) + self.animtiles = connect(self.tiles[(size*size):]) + else: self.pic = self.output + + if mode == 'vert': + self.tiles = get_tiles(self.pic) + self.tiles = transpose(self.tiles) + self.pic = connect(self.tiles) + + self.output = self.pic + self.animtiles + + + def decompress(self): + """ + Replica of crystal's decompression. + """ + + self.output = [] + + while True: + self.getCurByte() + + if (self.byte == lz_end): + break + + self.cmd = (self.byte & 0b11100000) >> 5 + + if self.cmd == lz_commands['long']: # 10-bit param + self.cmd = (self.byte & 0b00011100) >> 2 + self.length = (self.byte & 0b00000011) << 8 + self.next() + self.length += self.byte + 1 + else: # 5-bit param + self.length = (self.byte & 0b00011111) + 1 + + # literals + if self.cmd == lz_commands['literal']: + self.doLiteral() + elif self.cmd == lz_commands['iterate']: + self.doIter() + elif self.cmd == lz_commands['alternate']: + self.doAlt() + elif self.cmd == lz_commands['blank']: + self.doZeros() + + else: # repeaters + self.next() + if self.byte > 0x7f: # negative + self.displacement = self.byte & 0x7f + self.displacement = len(self.output) - self.displacement - 1 + else: # positive + self.displacement = self.byte * 0x100 + self.next() + self.displacement += self.byte + + if self.cmd == lz_commands['flip']: + self.doFlip() + elif self.cmd == lz_commands['reverse']: + self.doReverse() + else: # lz_commands['repeat'] + self.doRepeat() + + self.address += 1 + #self.next() # somewhat of a hack + + + def getCurByte(self): + self.byte = ord(self.lz[self.start+self.address]) + + def next(self): + self.address += 1 + self.getCurByte() + + def doLiteral(self): + """ + Copy data directly. + """ + for byte in range(self.length): + self.next() + self.output.append(self.byte) + + def doIter(self): + """ + Write one byte repeatedly. + """ + self.next() + for byte in range(self.length): + self.output.append(self.byte) + + def doAlt(self): + """ + Write alternating bytes. + """ + self.alts = [] + self.next() + self.alts.append(self.byte) + self.next() + self.alts.append(self.byte) + + for byte in range(self.length): + self.output.append(self.alts[byte&1]) + + def doZeros(self): + """ + Write zeros. + """ + for byte in range(self.length): + self.output.append(0x00) + + def doFlip(self): + """ + Repeat flipped bytes from output. + + eg 11100100 -> 00100111 + quat 3 2 1 0 -> 0 2 1 3 + """ + for byte in range(self.length): + flipped = sum(1<<(7-i) for i in range(8) if self.output[self.displacement+byte]>>i&1) + self.output.append(flipped) + + def doReverse(self): + """ + Repeat reversed bytes from output. + """ + for byte in range(self.length): + self.output.append(self.output[self.displacement-byte]) + + def doRepeat(self): + """ + Repeat bytes from output. + """ + for byte in range(self.length): + self.output.append(self.output[self.displacement+byte]) + + + +sizes = [ + 5, 6, 7, 5, 6, 7, 5, 6, 7, 5, 5, 7, 5, 5, 7, 5, + 6, 7, 5, 6, 5, 7, 5, 7, 5, 7, 5, 6, 5, 6, 7, 5, + 6, 7, 5, 6, 6, 7, 5, 6, 5, 7, 5, 6, 7, 5, 7, 5, + 7, 5, 7, 5, 7, 5, 7, 5, 7, 5, 7, 5, 6, 7, 5, 6, + 7, 5, 7, 7, 5, 6, 7, 5, 6, 5, 6, 6, 6, 7, 5, 7, + 5, 6, 6, 5, 7, 6, 7, 5, 7, 5, 7, 7, 6, 6, 7, 6, + 7, 5, 7, 5, 5, 7, 7, 5, 6, 7, 6, 7, 6, 7, 7, 7, + 6, 6, 7, 5, 6, 6, 7, 6, 6, 6, 7, 6, 6, 6, 7, 7, + 6, 7, 7, 5, 5, 6, 6, 6, 6, 5, 6, 5, 6, 7, 7, 7, + 7, 7, 5, 6, 7, 7, 5, 5, 6, 7, 5, 6, 7, 5, 6, 7, + 6, 6, 5, 7, 6, 6, 5, 7, 7, 6, 6, 5, 5, 5, 5, 7, + 5, 6, 5, 6, 7, 7, 5, 7, 6, 7, 5, 6, 7, 5, 5, 6, + 6, 5, 6, 6, 6, 6, 7, 6, 5, 6, 7, 5, 7, 6, 6, 7, + 6, 6, 5, 7, 5, 6, 6, 5, 7, 5, 6, 5, 6, 6, 5, 6, + 6, 7, 7, 6, 7, 7, 5, 7, 6, 7, 7, 5, 7, 5, 6, 6, + 6, 7, 7, 7, 7, 5, 6, 7, 7, 7, 5, +] + +def make_sizes(): + """ + Front pics have specified sizes. + """ + rom = load_rom() + top = 251 + base_stats = 0x51424 + # print monster sizes + address = base_stats + 0x11 + + output = '' + + for id in range(top): + size = (ord(rom[address])) & 0x0f + if id % 16 == 0: output += '\n\t' + output += str(size) + ', ' + address += 0x20 + + print output + + + +def decompress_fx_by_id(id, fxs=0xcfcf6): + rom = load_rom() + address = fxs + id*4 # len_fxptr + # get size + num_tiles = ord(rom[address]) # # tiles + # get pointer + bank = ord(rom[address+1]) + address = (ord(rom[address+3]) << 8) + ord(rom[address+2]) + address = (bank * 0x4000) + (address & 0x3fff) + # decompress + fx = Decompressed(rom, 'horiz', num_tiles, address) + return fx + +def decompress_fx(num_fx=40): + for id in range(num_fx): + fx = decompress_fx_by_id(id) + filename = './gfx/fx/' + str(id).zfill(3) + '.2bpp' # ./gfx/fx/039.2bpp + to_file(filename, fx.pic) + + +num_pics = 2 +front = 0 +back = 1 + +monsters = 0x120000 +num_monsters = 251 + +unowns = 0x124000 +num_unowns = 26 +unown_dex = 201 + +def decompress_monster_by_id(id=0, type=front): + rom = load_rom() + # no unowns here + if id + 1 == unown_dex: return None + # get size + if type == front: + size = sizes[id] + else: size = None + # get pointer + address = monsters + (id*2 + type)*3 # bank, address + bank = ord(rom[address]) + 0x36 # crystal + address = (ord(rom[address+2]) << 8) + ord(rom[address+1]) + address = (bank * 0x4000) + (address & 0x3fff) + # decompress + monster = Decompressed(rom, 'vert', size, address) + return monster + +def decompress_monsters(type=front): + for id in range(num_monsters): + # decompress + monster = decompress_monster_by_id(id, type) + if monster != None: # no unowns here + if not type: # front + filename = 'front.2bpp' + folder = './gfx/pics/' + str(id+1).zfill(3) + '/' + to_file(folder+filename, monster.pic) + filename = 'tiles.2bpp' + folder = './gfx/pics/' + str(id+1).zfill(3) + '/' + to_file(folder+filename, monster.animtiles) + else: # back + filename = 'back.2bpp' + folder = './gfx/pics/' + str(id+1).zfill(3) + '/' + to_file(folder+filename, monster.pic) + + +def decompress_unown_by_id(letter, type=front): + rom = load_rom() + # get size + if type == front: + size = sizes[unown_dex-1] + else: size = None + # get pointer + address = unowns + (letter*2 + type)*3 # bank, address + bank = ord(rom[address]) + 0x36 # crystal + address = (ord(rom[address+2]) << 8) + ord(rom[address+1]) + address = (bank * 0x4000) + (address & 0x3fff) + # decompress + unown = Decompressed(rom, 'vert', size, address) + return unown + +def decompress_unowns(type=front): + for letter in range(num_unowns): + # decompress + unown = decompress_unown_by_id(letter, type) + + if not type: # front + filename = 'front.2bpp' + folder = './gfx/pics/' + str(unown_dex).zfill(3) + chr(ord('a') + letter) + '/' + to_file(folder+filename, unown.pic) + filename = 'tiles.2bpp' + folder = './gfx/anim/' + to_file(folder+filename, unown.animtiles) + else: # back + filename = 'back.2bpp' + folder = './gfx/pics/' + str(unown_dex).zfill(3) + chr(ord('a') + letter) + '/' + to_file(folder+filename, unown.pic) + + +trainers = 0x128000 +num_trainers = 67 + +def decompress_trainer_by_id(id): + rom = load_rom() + # get pointer + address = trainers + id*3 # bank, address + bank = ord(rom[address]) + 0x36 # crystal + address = (ord(rom[address+2]) << 8) + ord(rom[address+1]) + address = (bank * 0x4000) + (address & 0x3fff) + # decompress + trainer = Decompressed(rom, 'vert', None, address) + return trainer + +def decompress_trainers(): + for id in range(num_trainers): + # decompress + trainer = decompress_trainer_by_id(id) + filename = './gfx/trainers/' + str(id).zfill(3) + '.2bpp' # ./gfx/trainers/066.2bpp + to_file(filename, trainer.pic) + + +# in order of use (sans repeats) +intro_gfx = [ + ('logo', 0x109407), + ('001', 0xE641D), # tilemap + ('unowns', 0xE5F5D), + ('pulse', 0xE634D), + ('002', 0xE63DD), # tilemap + ('003', 0xE5ECD), # tilemap + ('background', 0xE5C7D), + ('004', 0xE5E6D), # tilemap + ('005', 0xE647D), # tilemap + ('006', 0xE642D), # tilemap + ('pichu_wooper', 0xE592D), + ('suicune_run', 0xE555D), + ('007', 0xE655D), # tilemap + ('008', 0xE649D), # tilemap + ('009', 0xE76AD), # tilemap + ('suicune_jump', 0xE6DED), + ('unown_back', 0xE785D), + ('010', 0xE764D), # tilemap + ('011', 0xE6D0D), # tilemap + ('suicune_close', 0xE681D), + ('012', 0xE6C3D), # tilemap + ('013', 0xE778D), # tilemap + ('suicune_back', 0xE72AD), + ('014', 0xE76BD), # tilemap + ('015', 0xE676D), # tilemap + ('crystal_unowns', 0xE662D), + ('017', 0xE672D), # tilemap +] + +def decompress_intro(): + rom = load_rom() + for name, address in intro_gfx: + filename = './gfx/intro/' + name + '.2bpp' + gfx = Decompressed( rom, 'horiz', None, address ) + to_file(filename, gfx.output) + + +title_gfx = [ + ('suicune', 0x10EF46), + ('logo', 0x10F326), + ('crystal', 0x10FCEE), +] + +def decompress_title(): + rom = load_rom() + for name, address in title_gfx: + filename = './gfx/title/' + name + '.2bpp' + gfx = Decompressed( rom, 'horiz', None, address ) + to_file(filename, gfx.output) + +def decompress_tilesets(): + rom = load_rom() + tileset_headers = 0x4d596 + len_tileset = 15 + num_tilesets = 0x25 + for tileset in range(num_tilesets): + ptr = tileset*len_tileset + tileset_headers + address = (ord(rom[ptr])*0x4000) + (((ord(rom[ptr+1]))+ord(rom[ptr+2])*0x100)&0x3fff) + tiles = Decompressed( rom, 'horiz', None, address ) + filename = './gfx/tilesets/'+str(tileset).zfill(2)+'.2bpp' + to_file( filename, tiles.output ) + #print '(' + hex(address) + ', '+ hex(address+tiles.address+1) + '),' + +misc = [ + ('player', 0x2BA1A, 'vert'), + ('dude', 0x2BBAA, 'vert'), + ('town_map', 0xF8BA0, 'horiz'), + ('pokegear', 0x1DE2E4, 'horiz'), + ('pokegear_sprites', 0x914DD, 'horiz'), +] +def decompress_misc(): + rom = load_rom() + for name, address, mode in misc: + filename = './gfx/misc/' + name + '.2bpp' + gfx = Decompressed( rom, mode, None, address ) + to_file(filename, gfx.output) + +def decompress_all(debug=False): + """ + Decompress all known compressed data in baserom. + """ + + if debug: print 'fronts' + decompress_monsters(front) + if debug: print 'backs' + decompress_monsters(back) + if debug: print 'unown fronts' + decompress_unowns(front) + if debug: print 'unown backs' + decompress_unowns(back) + + if debug: print 'trainers' + decompress_trainers() + + if debug: print 'fx' + decompress_fx() + + if debug: print 'intro' + decompress_intro() + + if debug: print 'title' + decompress_title() + + if debug: print 'tilesets' + decompress_tilesets() + + if debug: print 'misc' + decompress_misc() + + return + + +def decompress_from_address(address, mode='horiz', filename='de.2bpp', size=None): + """ + Write decompressed data from an address to a 2bpp file. + """ + rom = load_rom() + image = Decompressed(rom, mode, size, address) + to_file(filename, image.pic) + + +def decompress_file(filein, fileout, mode='horiz', size=None): + f = open(filein, 'rb') + image = f.read() + f.close() + + de = Decompressed(image, mode, size) + + to_file(fileout, de.pic) + + +def compress_file(filein, fileout, mode='horiz'): + f = open(filein, 'rb') + image = f.read() + f.close() + + lz = Compressed(image, mode) + + to_file(fileout, lz.output) + + + + +def compress_monster_frontpic(id, fileout): + mode = 'vert' + + fpic = './gfx/pics/' + str(id).zfill(3) + '/front.2bpp' + fanim = './gfx/pics/' + str(id).zfill(3) + '/tiles.2bpp' + + pic = open(fpic, 'rb').read() + anim = open(fanim, 'rb').read() + image = pic + anim + + lz = Compressed(image, mode, sizes[id-1]) + + out = './gfx/pics/' + str(id).zfill(3) + '/front.lz' + + to_file(out, lz.output) + + + +def get_uncompressed_gfx(start, num_tiles, filename): + """ + Grab tiles directly from rom and write to file. + """ + rom = load_rom() + bytes_per_tile = 0x10 + length = num_tiles*bytes_per_tile + end = start + length + image = [] + for address in range(start,end): + image.append(ord(rom[address])) + to_file(filename, image) + + + +def bin_to_rgb(word): + red = word & 0b11111 + word >>= 5 + green = word & 0b11111 + word >>= 5 + blue = word & 0b11111 + return (red, green, blue) + +def rgb_from_rom(address, length=0x80): + rom = load_rom() + return convert_binary_pal_to_text(rom[address:address+length]) + +def convert_binary_pal_to_text_by_filename(filename): + with open(filename) as f: + pal = bytearray(f.read()) + return convert_binary_pal_to_text(pal) + +def convert_binary_pal_to_text(pal): + output = '' + words = [hi * 0x100 + lo for lo, hi in zip(pal[::2], pal[1::2])] + for word in words: + red, green, blue = ['%.2d' % c for c in bin_to_rgb(word)] + output += '\tRGB ' + ', '.join((red, green, blue)) + output += '\n' + return output + +def read_rgb_macros(lines): + colors = [] + for line in lines: + macro = line.split(" ")[0].strip() + if macro == 'RGB': + params = ' '.join(line.split(" ")[1:]).split(',') + red, green, blue = [int(v) for v in params] + colors += [[red, green, blue]] + return colors + + +def rewrite_binary_pals_to_text(filenames): + for filename in filenames: + pal_text = convert_binary_pal_to_text_by_filename(filename) + with open(filename, 'w') as out: + out.write(pal_text) + + +def dump_monster_pals(): + rom = load_rom() + + pals = 0xa8d6 + pal_length = 0x4 + for mon in range(251): + + name = pokemon_constants.pokemon_constants[mon+1].title().replace('_','') + num = str(mon+1).zfill(3) + dir = 'gfx/pics/'+num+'/' + + address = pals + mon*pal_length*2 + + + pal_data = [] + for byte in range(pal_length): + pal_data.append(ord(rom[address])) + address += 1 + + filename = 'normal.pal' + to_file('../'+dir+filename, pal_data) + + spacing = ' ' * (15 - len(name)) + #print name+'Palette:'+spacing+' INCBIN "'+dir+filename+'"' + + + pal_data = [] + for byte in range(pal_length): + pal_data.append(ord(rom[address])) + address += 1 + + filename = 'shiny.pal' + to_file('../'+dir+filename, pal_data) + + spacing = ' ' * (10 - len(name)) + #print name+'ShinyPalette:'+spacing+' INCBIN "'+dir+filename+'"' + + +def dump_trainer_pals(): + rom = load_rom() + + pals = 0xb0d2 + pal_length = 0x4 + for trainer in range(67): + + name = trainers.trainer_group_names[trainer+1]['constant'].title().replace('_','') + num = str(trainer).zfill(3) + dir = 'gfx/trainers/' + + address = pals + trainer*pal_length + + pal_data = [] + for byte in range(pal_length): + pal_data.append(ord(rom[address])) + address += 1 + + filename = num+'.pal' + to_file('../'+dir+filename, pal_data) + + spacing = ' ' * (12 - len(name)) + print name+'Palette:'+spacing+' INCBIN"'+dir+filename+'"' + + + +def flatten(planar): + """ + Flatten planar 2bpp image data into a quaternary pixel map. + """ + strips = [] + for bottom, top in split(planar, 2): + bottom = ord(bottom) + top = ord(top) + strip = [] + for i in xrange(7,-1,-1): + color = ( + (bottom >> i & 1) + + (top *2 >> i & 2) + ) + strip += [color] + strips += strip + return strips + + +def to_lines(image, width): + """ + Convert a tiled quaternary pixel map to lines of quaternary pixels. + """ + tile_width = 8 + tile_height = 8 + num_columns = width / tile_width + height = len(image) / width + + lines = [] + for cur_line in xrange(height): + tile_row = cur_line / tile_height + line = [] + for column in xrange(num_columns): + anchor = ( + num_columns * tile_row * tile_width * tile_height + + column * tile_width * tile_height + + cur_line % tile_height * tile_width + ) + line += image[anchor : anchor + tile_width] + lines += [line] + return lines + + +def dmg2rgb(word): + """ + For PNGs. + """ + def shift(value): + while True: + yield value & (2**5 - 1) + value >>= 5 + word = shift(word) + # distribution is less even w/ << 3 + red, green, blue = [int(color * 8.25) for color in [word.next() for _ in xrange(3)]] + alpha = 255 + return (red, green, blue, alpha) + + +def rgb_to_dmg(color): + """ + For PNGs. + """ + word = (color['r'] / 8) + word += (color['g'] / 8) << 5 + word += (color['b'] / 8) << 10 + return word + + +def pal_to_png(filename): + """ + Interpret a .pal file as a png palette. + """ + with open(filename) as rgbs: + colors = read_rgb_macros(rgbs.readlines()) + a = 255 + palette = [] + for color in colors: + # even distribution over 000-255 + r, g, b = [int(hue * 8.25) for hue in color] + palette += [(r, g, b, a)] + white = (255,255,255,255) + black = (000,000,000,255) + if white not in palette and len(palette) < 4: + palette = [white] + palette + if black not in palette and len(palette) < 4: + palette = palette + [black] + return palette + + +def png_to_rgb(palette): + """ + Convert a png palette to rgb macros. + """ + output = '' + for color in palette: + r, g, b = [color[c] / 8 for c in 'rgb'] + output += '\tRGB ' + ', '.join(['%.2d' % hue for hue in (r, g, b)]) + output += '\n' + return output + + +def read_filename_arguments(filename): + int_args = { + 'w': 'width', + 'h': 'height', + 't': 'tile_padding', + } + parsed_arguments = {} + arguments = os.path.splitext(filename)[0].split('.')[1:] + for argument in arguments: + arg = argument[0] + param = argument[1:] + if param.isdigit(): + arg = int_args.get(arg, False) + if arg: + parsed_arguments[arg] = int(param) + elif len(argument) == 3: + w, x, h = argument[:3] + if w.isdigit() and h.isdigit() and x == 'x': + parsed_arguments['pic_dimensions'] = (int(w), int(h)) + elif argument == 'interleave': + parsed_arguments['interleave'] = True + elif argument == 'norepeat': + parsed_arguments['norepeat'] = True + elif argument == 'arrange': + parsed_arguments['norepeat'] = True + parsed_arguments['tilemap'] = True + return parsed_arguments + + +def export_2bpp_to_png(filein, fileout=None, pal_file=None, height=0, width=0, tile_padding=0, pic_dimensions=None): + + if fileout == None: + fileout = os.path.splitext(filein)[0] + '.png' + + image = open(filein, 'rb').read() + + arguments = { + 'width': width, + 'height': height, + 'pal_file': pal_file, + 'tile_padding': tile_padding, + 'pic_dimensions': pic_dimensions, + } + arguments.update(read_filename_arguments(filein)) + + if pal_file == None: + if os.path.exists(os.path.splitext(fileout)[0]+'.pal'): + arguments['pal_file'] = os.path.splitext(fileout)[0]+'.pal' + + result = convert_2bpp_to_png(image, **arguments) + width, height, palette, greyscale, bitdepth, px_map = result + + w = png.Writer( + width, + height, + palette=palette, + compression=9, + greyscale=greyscale, + bitdepth=bitdepth + ) + with open(fileout, 'wb') as f: + w.write(f, px_map) + + +def convert_2bpp_to_png(image, **kwargs): + """ + Convert a planar 2bpp graphic to png. + """ + + width = kwargs.get('width', 0) + height = kwargs.get('height', 0) + tile_padding = kwargs.get('tile_padding', 0) + pic_dimensions = kwargs.get('pic_dimensions', None) + pal_file = kwargs.get('pal_file', None) + interleave = kwargs.get('interleave', False) + + # Width must be specified to interleave. + if interleave and width: + image = ''.join(interleave_tiles(image, width / 8)) + + # Pad the image by a given number of tiles if asked. + image += chr(0) * 0x10 * tile_padding + + # Some images are transposed in blocks. + if pic_dimensions: + w, h = pic_dimensions + if not width: width = w * 8 + + pic_length = w * h * 0x10 + + trailing = len(image) % pic_length + + pic = [] + for i in xrange(0, len(image) - trailing, pic_length): + pic += transpose_tiles(image[i:i+pic_length], w) + image = ''.join(pic) + image[len(image) - trailing:] + + # Pad out trailing lines. + image += chr(0) * 0x10 * ((w - (len(image) / 0x10) % h) % w) + + def px_length(img): + return len(img) * 4 + def tile_length(img): + return len(img) * 4 / (8*8) + + if width and height: + tile_width = width / 8 + more_tile_padding = (tile_width - (tile_length(image) % tile_width or tile_width)) + image += chr(0) * 0x10 * more_tile_padding + + elif width and not height: + tile_width = width / 8 + more_tile_padding = (tile_width - (tile_length(image) % tile_width or tile_width)) + image += chr(0) * 0x10 * more_tile_padding + height = px_length(image) / width + + elif height and not width: + tile_height = height / 8 + more_tile_padding = (tile_height - (tile_length(image) % tile_height or tile_height)) + image += chr(0) * 0x10 * more_tile_padding + width = px_length(image) / height + + # at least one dimension should be given + if width * height != px_length(image): + # look for possible combos of width/height that would form a rectangle + matches = [] + # Height need not be divisible by 8, but width must. + # See pokered gfx/minimize_pic.1bpp. + for w in range(8, px_length(image) / 2 + 1, 8): + h = px_length(image) / w + if w * h == px_length(image): + matches += [(w, h)] + # go for the most square image + if len(matches): + width, height = sorted(matches, key= lambda (w, h): (h % 8 != 0, w + h))[0] # favor height + else: + raise Exception, 'Image can\'t be divided into tiles (%d px)!' % (px_length(image)) + + # convert tiles to lines + lines = to_lines(flatten(image), width) + + if pal_file == None: + palette = None + greyscale = True + bitdepth = 2 + px_map = [[3 - pixel for pixel in line] for line in lines] + + else: # gbc color + palette = pal_to_png(pal_file) + greyscale = False + bitdepth = 8 + px_map = [[pixel for pixel in line] for line in lines] + + return width, height, palette, greyscale, bitdepth, px_map + + +def export_png_to_2bpp(filein, fileout=None, palout=None, tile_padding=0, pic_dimensions=None): + + arguments = { + 'tile_padding': tile_padding, + 'pic_dimensions': pic_dimensions, + } + arguments.update(read_filename_arguments(filein)) + + image, palette, tmap = png_to_2bpp(filein, **arguments) + + if fileout == None: + fileout = os.path.splitext(filein)[0] + '.2bpp' + to_file(fileout, image) + + if tmap != None: + mapout = os.path.splitext(fileout)[0] + '.tilemap' + to_file(mapout, tmap) + + if palout == None: + palout = os.path.splitext(fileout)[0] + '.pal' + export_palette(palette, palout) + + +def get_image_padding(width, height, wstep=8, hstep=8): + + padding = { + 'left': 0, + 'right': 0, + 'top': 0, + 'bottom': 0, + } + + if width % wstep and width >= wstep: + pad = float(width % wstep) / 2 + padding['left'] = int(ceil(pad)) + padding['right'] = int(floor(pad)) + + if height % hstep and height >= hstep: + pad = float(height % hstep) / 2 + padding['top'] = int(ceil(pad)) + padding['bottom'] = int(floor(pad)) + + return padding + + +def png_to_2bpp(filein, **kwargs): + """ + Convert a png image to planar 2bpp. + """ + + tile_padding = kwargs.get('tile_padding', 0) + pic_dimensions = kwargs.get('pic_dimensions', None) + interleave = kwargs.get('interleave', False) + norepeat = kwargs.get('norepeat', False) + tilemap = kwargs.get('tilemap', False) + + with open(filein, 'rb') as data: + width, height, rgba, info = png.Reader(data).asRGBA8() + rgba = list(rgba) + greyscale = info['greyscale'] + + # png.Reader returns flat pixel data. Nested is easier to work with + len_px = 4 # rgba + image = [] + palette = [] + for line in rgba: + newline = [] + for px in xrange(0, len(line), len_px): + color = { 'r': line[px ], + 'g': line[px+1], + 'b': line[px+2], + 'a': line[px+3], } + newline += [color] + if color not in palette: + palette += [color] + image += [newline] + + assert len(palette) <= 4, 'Palette should be 4 colors, is really %d' % len(palette) + + # Pad out smaller palettes with greyscale colors + hues = { + 'white': { 'r': 0xff, 'g': 0xff, 'b': 0xff, 'a': 0xff }, + 'black': { 'r': 0x00, 'g': 0x00, 'b': 0x00, 'a': 0xff }, + 'grey': { 'r': 0x55, 'g': 0x55, 'b': 0x55, 'a': 0xff }, + 'gray': { 'r': 0xaa, 'g': 0xaa, 'b': 0xaa, 'a': 0xff }, + } + for hue in hues.values(): + if len(palette) >= 4: + break + if hue not in palette: + palette += [hue] + + # Sort palettes by luminance + def luminance(color): + rough = { 'r': 4.7, + 'g': 1.4, + 'b': 13.8, } + return sum(color[key] * rough[key] for key in rough.keys()) + palette.sort(key=luminance) + + # Game Boy palette order + palette.reverse() + + # Map pixels to quaternary color ids + padding = get_image_padding(width, height) + width += padding['left'] + padding['right'] + height += padding['top'] + padding['bottom'] + pad = [0] + + qmap = [] + qmap += pad * width * padding['top'] + for line in image: + qmap += pad * padding['left'] + for color in line: + qmap += [palette.index(color)] + qmap += pad * padding['right'] + qmap += pad * width * padding['bottom'] + + # Graphics are stored in tiles instead of lines + tile_width = 8 + tile_height = 8 + num_columns = max(width, tile_width) / tile_width + num_rows = max(height, tile_height) / tile_height + image = [] + + for row in xrange(num_rows): + for column in xrange(num_columns): + + # Split it up into strips to convert to planar data + for strip in xrange(min(tile_height, height)): + anchor = ( + row * num_columns * tile_width * tile_height + + column * tile_width + + strip * width + ) + line = qmap[anchor : anchor + tile_width] + bottom, top = 0, 0 + for bit, quad in enumerate(line): + bottom += (quad & 1) << (7 - bit) + top += (quad /2 & 1) << (7 - bit) + image += [bottom, top] + + if pic_dimensions: + w, h = pic_dimensions + + tiles = get_tiles(image) + pic_length = w * h + tile_width = width / 8 + trailing = len(tiles) % pic_length + new_image = [] + for block in xrange(len(tiles) / pic_length): + offset = (h * tile_width) * ((block * w) / tile_width) + ((block * w) % tile_width) + pic = [] + for row in xrange(h): + index = offset + (row * tile_width) + pic += tiles[index:index + w] + new_image += transpose(pic, w) + new_image += tiles[len(tiles) - trailing:] + image = connect(new_image) + + # Remove any tile padding used to make the png rectangular. + image = image[:len(image) - tile_padding * 0x10] + + if interleave: + image = deinterleave_tiles(image, num_columns) + + if norepeat: + image, tmap = condense_tiles_to_map(image) + if not tilemap: + tmap = None + + return image, palette, tmap + + +def export_palette(palette, filename): + """ + Export a palette from png to rgb macros in a .pal file. + """ + + if os.path.exists(filename): + + # Pic palettes are 2 colors (black/white are added later). + with open(filename) as rgbs: + colors = read_rgb_macros(rgbs.readlines()) + + if len(colors) == 2: + palette = palette[1:3] + + text = png_to_rgb(palette) + with open(filename, 'w') as out: + out.write(text) + + +def png_to_lz(filein): + + name = os.path.splitext(filein)[0] + + export_png_to_2bpp(filein) + image = open(name+'.2bpp', 'rb').read() + to_file(name+'.2bpp'+'.lz', Compressed(image).output) + + + +def convert_2bpp_to_1bpp(data): + """ + Convert planar 2bpp image data to 1bpp. Assume images are two colors. + """ + return data[::2] + +def convert_1bpp_to_2bpp(data): + """ + Convert 1bpp image data to planar 2bpp (black/white). + """ + output = [] + for i in data: + output += [i, i] + return output + + +def export_2bpp_to_1bpp(filename): + name, extension = os.path.splitext(filename) + image = open(filename, 'rb').read() + image = convert_2bpp_to_1bpp(image) + to_file(name + '.1bpp', image) + +def export_1bpp_to_2bpp(filename): + name, extension = os.path.splitext(filename) + image = open(filename, 'rb').read() + image = convert_1bpp_to_2bpp(image) + to_file(name + '.2bpp', image) + + +def export_1bpp_to_png(filename, fileout=None): + + if fileout == None: + fileout = os.path.splitext(filename)[0] + '.png' + + arguments = read_filename_arguments(filename) + + image = open(filename, 'rb').read() + image = convert_1bpp_to_2bpp(image) + + result = convert_2bpp_to_png(image, **arguments) + width, height, palette, greyscale, bitdepth, px_map = result + + w = png.Writer(width, height, palette=palette, compression=9, greyscale=greyscale, bitdepth=bitdepth) + with open(fileout, 'wb') as f: + w.write(f, px_map) + + +def export_png_to_1bpp(filename, fileout=None): + + if fileout == None: + fileout = os.path.splitext(filename)[0] + '.1bpp' + + arguments = read_filename_arguments(filename) + image = png_to_1bpp(filename, **arguments) + + to_file(fileout, image) + +def png_to_1bpp(filename, **kwargs): + image, palette, tmap = png_to_2bpp(filename, **kwargs) + return convert_2bpp_to_1bpp(image) + + +def mass_to_png(debug=False): + # greyscale + for root, dirs, files in os.walk('./gfx/'): + for name in files: + if debug: print os.path.splitext(name), os.path.join(root, name) + if os.path.splitext(name)[1] == '.2bpp': + export_2bpp_to_png(os.path.join(root, name)) + +def mass_to_colored_png(debug=False): + # greyscale, unless a palette is detected + for root, dirs, files in os.walk('./gfx/'): + if 'pics' not in root and 'trainers' not in root: + for name in files: + if debug: print os.path.splitext(name), os.path.join(root, name) + if os.path.splitext(name)[1] == '.2bpp': + export_2bpp_to_png(os.path.join(root, name)) + os.utime(os.path.join(root, name), None) + elif os.path.splitext(name)[1] == '.1bpp': + export_1bpp_to_png(os.path.join(root, name)) + os.utime(os.path.join(root, name), None) + + # only monster and trainer pics for now + for root, dirs, files in os.walk('./gfx/pics/'): + for name in files: + if debug: print os.path.splitext(name), os.path.join(root, name) + if os.path.splitext(name)[1] == '.2bpp': + if 'normal.pal' in files: + export_2bpp_to_png(os.path.join(root, name), None, os.path.join(root, 'normal.pal')) + else: + export_2bpp_to_png(os.path.join(root, name)) + os.utime(os.path.join(root, name), None) + + for root, dirs, files in os.walk('./gfx/trainers/'): + for name in files: + if debug: print os.path.splitext(name), os.path.join(root, name) + if os.path.splitext(name)[1] == '.2bpp': + export_2bpp_to_png(os.path.join(root, name)) + os.utime(os.path.join(root, name), None) + + +def mass_decompress(debug=False): + for root, dirs, files in os.walk('./gfx/'): + for name in files: + if 'lz' in name: + if '/pics' in root: + if 'front' in name: + id = root.split('pics/')[1][:3] + if id != 'egg': + with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert', sizes[int(id)-1]) + else: + with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert', 4) + to_file(os.path.join(root, 'front.2bpp'), de.pic) + to_file(os.path.join(root, 'tiles.2bpp'), de.animtiles) + elif 'back' in name: + with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert') + to_file(os.path.join(root, 'back.2bpp'), de.output) + elif '/trainers' in root or '/fx' in root: + with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert') + to_file(os.path.join(root, os.path.splitext(name)[0]+'.2bpp'), de.output) + else: + with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read()) + to_file(os.path.join(root, os.path.splitext(name)[0]+'.2bpp'), de.output) + os.utime(os.path.join(root, name), None) + +def append_terminator_to_lzs(directory): + # fix lzs that were extracted with a missing terminator + for root, dirs, files in os.walk(directory): + for file in files: + if '.lz' in file: + data = open(root+file,'rb').read() + if data[-1] != chr(0xff): + data += chr(0xff) + new = open(root+file,'wb') + new.write(data) + new.close() + +def export_lz_to_png(filename): + """ + Convert a lz file to png. Dump a 2bpp file too. + """ + assert filename[-3:] == ".lz" + lz_data = open(filename, "rb").read() + + bpp = Decompressed(lz_data).output + bpp_filename = os.path.splitext(filename)[0] + to_file(bpp_filename, bpp) + + export_2bpp_to_png(bpp_filename) + + # touch the lz file so it doesn't get remade + os.utime(filename, None) + +def dump_tileset_pngs(): + """ + Convert .lz format tilesets into .png format tilesets. + + Also, leaves a bunch of wonderful .2bpp files everywhere for your amusement. + """ + for tileset_id in range(37): + tileset_filename = "./gfx/tilesets/" + str(tileset_id).zfill(2) + ".lz" + export_lz_to_png(tileset_filename) + +def decompress_frontpic(lz_file): + """ + Convert the pic portion of front.lz to front.2bpp + """ + lz = open(lz_file, 'rb').read() + to_file(Decompressed(lz).pic, os.path.splitext(filein)[0] + '.2bpp') + +def decompress_frontpic_anim(lz_file): + """ + Convert the animation tile portion of front.lz to tiles.2bpp + """ + lz = open(lz_file, 'rb').read() + to_file(Decompressed(lz).animtiles, 'tiles.2bpp') + +def expand_pic_palettes(): + """ + Add white and black to palette files with fewer than 4 colors. + + Pokemon Crystal only defines two colors for a pic palette to + save space, filling in black/white at runtime. + Instead of managing palette files of varying length, black + and white are added to pic palettes and excluded from incbins. + """ + for root, dirs, files in os.walk('./gfx/'): + if 'gfx/pics' in root or 'gfx/trainers' in root: + for name in files: + if os.path.splitext(name)[1] == '.pal': + filename = os.path.join(root, name) + palette = bytearray(open(filename, 'rb').read()) + w = bytearray([0xff, 0x7f]) + b = bytearray([0x00, 0x00]) + if len(palette) == 4: + with open(filename, 'wb') as out: + out.write(w + palette + b) + + +def convert_to_2bpp(filenames=[]): + for filename in filenames: + filename, name, extension = try_decompress(filename) + if extension == '.1bpp': + export_1bpp_to_2bpp(filename) + elif extension == '.2bpp': + pass + elif extension == '.png': + export_png_to_2bpp(filename) + else: + raise Exception, "Don't know how to convert {} to 2bpp!".format(filename) + +def convert_to_1bpp(filenames=[]): + for filename in filenames: + filename, name, extension = try_decompress(filename) + if extension == '.1bpp': + pass + elif extension == '.2bpp': + export_2bpp_to_1bpp(filename) + elif extension == '.png': + export_png_to_1bpp(filename) + else: + raise Exception, "Don't know how to convert {} to 1bpp!".format(filename) + +def convert_to_png(filenames=[]): + for filename in filenames: + filename, name, extension = try_decompress(filename) + if extension == '.1bpp': + export_1bpp_to_png(filename) + elif extension == '.2bpp': + export_2bpp_to_png(filename) + elif extension == '.png': + pass + else: + raise Exception, "Don't know how to convert {} to png!".format(filename) + +def compress(filenames=[]): + for filename in filenames: + data = open(filename, 'rb').read() + lz_data = Compressed(data).output + to_file(filename + '.lz', lz_data) + +def decompress(filenames=[]): + for filename in filenames: + name, extension = os.path.splitext(filename) + lz_data = open(filename, 'rb').read() + data = Decompressed(lz_data).output + to_file(name, data) + +def try_decompress(filename): + """ + Try to decompress a graphic when determining the filetype. + This skips the manual unlz step when attempting + to convert lz-compressed graphics to png. + """ + name, extension = os.path.splitext(filename) + if extension == '.lz': + decompress([filename]) + filename = name + name, extension = os.path.splitext(filename) + return filename, name, extension + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument('mode') + ap.add_argument('filenames', nargs='*') + args = ap.parse_args() + + method = { + '2bpp': convert_to_2bpp, + '1bpp': convert_to_1bpp, + 'png': convert_to_png, + 'lz': compress, + 'unlz': decompress, + }.get(args.mode, None) + + if method == None: + raise Exception, "Unknown conversion method!" + + method(args.filenames) + + +if __name__ == "__main__": + main() + diff --git a/gfx/9_tile.png b/gfx/9_tile.png Binary files differnew file mode 100644 index 00000000..e6fc8911 --- /dev/null +++ b/gfx/9_tile.png diff --git a/gfx/badges.png b/gfx/badges.png Binary files differindex 8b0fc516..46e7add3 100644 --- a/gfx/badges.png +++ b/gfx/badges.png diff --git a/gfx/blocksets/beachhouse.bst b/gfx/blocksets/beachhouse.bst Binary files differnew file mode 100644 index 00000000..bafbe0b2 --- /dev/null +++ b/gfx/blocksets/beachhouse.bst diff --git a/gfx/blocksets/facility.bst b/gfx/blocksets/facility.bst Binary files differindex 1ed2d436..31d69fd1 100644 --- a/gfx/blocksets/facility.bst +++ b/gfx/blocksets/facility.bst diff --git a/gfx/blocksets/gym.bst b/gfx/blocksets/gym.bst Binary files differindex 48889bfa..f903c964 100644 --- a/gfx/blocksets/gym.bst +++ b/gfx/blocksets/gym.bst diff --git a/gfx/blocksets/gate.bst b/gfx/blocksets/museum.bst Binary files differindex e4c820a4..e4c820a4 100644 --- a/gfx/blocksets/gate.bst +++ b/gfx/blocksets/museum.bst diff --git a/gfx/blocksets/plateau.bst b/gfx/blocksets/plateau.bst Binary files differindex 26435dc8..54c3ffec 100644 --- a/gfx/blocksets/plateau.bst +++ b/gfx/blocksets/plateau.bst diff --git a/gfx/blocksets/pokecenter.bst b/gfx/blocksets/pokecenter.bst Binary files differindex a82460f5..213460aa 100644 --- a/gfx/blocksets/pokecenter.bst +++ b/gfx/blocksets/pokecenter.bst diff --git a/gfx/blocksets/reds_house.bst b/gfx/blocksets/redshouse2.bst Binary files differindex 6c9f4749..6c9f4749 100644 --- a/gfx/blocksets/reds_house.bst +++ b/gfx/blocksets/redshouse2.bst diff --git a/gfx/blocksets/ship_port.bst b/gfx/blocksets/shipport.bst Binary files differindex 60b4767e..60b4767e 100644 --- a/gfx/blocksets/ship_port.bst +++ b/gfx/blocksets/shipport.bst diff --git a/gfx/blue/intro_purin_1.6x6.png b/gfx/blue/intro_purin_1.6x6.png Binary files differdeleted file mode 100644 index 0e53582c..00000000 --- a/gfx/blue/intro_purin_1.6x6.png +++ /dev/null diff --git a/gfx/blue/intro_purin_2.6x6.png b/gfx/blue/intro_purin_2.6x6.png Binary files differdeleted file mode 100644 index 21107af0..00000000 --- a/gfx/blue/intro_purin_2.6x6.png +++ /dev/null diff --git a/gfx/blue/intro_purin_3.6x6.png b/gfx/blue/intro_purin_3.6x6.png Binary files differdeleted file mode 100644 index 1c30a0e8..00000000 --- a/gfx/blue/intro_purin_3.6x6.png +++ /dev/null diff --git a/gfx/blue/sgbborder.map b/gfx/blue/sgbborder.map Binary files differdeleted file mode 100644 index b0b0b94b..00000000 --- a/gfx/blue/sgbborder.map +++ /dev/null diff --git a/gfx/blue/sgbborder.png b/gfx/blue/sgbborder.png Binary files differdeleted file mode 100644 index 098df2b6..00000000 --- a/gfx/blue/sgbborder.png +++ /dev/null diff --git a/gfx/blue/slotmachine1.png b/gfx/blue/slotmachine1.png Binary files differdeleted file mode 100644 index 41ebfdea..00000000 --- a/gfx/blue/slotmachine1.png +++ /dev/null diff --git a/gfx/blue/slotmachine2.png b/gfx/blue/slotmachine2.png Binary files differdeleted file mode 100644 index ee8c688e..00000000 --- a/gfx/blue/slotmachine2.png +++ /dev/null diff --git a/gfx/blue/blueversion.png b/gfx/blueversion.png Binary files differindex a9c87be8..a9c87be8 100644 --- a/gfx/blue/blueversion.png +++ b/gfx/blueversion.png diff --git a/gfx/copyright.png b/gfx/copyright.png Binary files differindex 49174349..71a2085f 100644 --- a/gfx/copyright.png +++ b/gfx/copyright.png diff --git a/gfx/emotion_bubbles.png b/gfx/emotion_bubbles.png Binary files differindex 31deacf4..652c56b1 100644 --- a/gfx/emotion_bubbles.png +++ b/gfx/emotion_bubbles.png diff --git a/gfx/intro_fight.png b/gfx/intro_fight.png Binary files differdeleted file mode 100644 index d7774c01..00000000 --- a/gfx/intro_fight.png +++ /dev/null diff --git a/gfx/ledge_hopping_shadow.png b/gfx/ledge_hopping_shadow.png Binary files differindex 8e760056..ba3dab5b 100644 --- a/gfx/ledge_hopping_shadow.png +++ b/gfx/ledge_hopping_shadow.png diff --git a/gfx/pikachu/unknown_e4000.png b/gfx/pikachu/unknown_e4000.png Binary files differnew file mode 100644 index 00000000..75a54919 --- /dev/null +++ b/gfx/pikachu/unknown_e4000.png diff --git a/gfx/pikachu/unknown_e40cc.png b/gfx/pikachu/unknown_e40cc.png Binary files differnew file mode 100644 index 00000000..adce99ad --- /dev/null +++ b/gfx/pikachu/unknown_e40cc.png diff --git a/gfx/pikachu/unknown_e411c.png b/gfx/pikachu/unknown_e411c.png Binary files differnew file mode 100644 index 00000000..40e3d336 --- /dev/null +++ b/gfx/pikachu/unknown_e411c.png diff --git a/gfx/pikachu/unknown_e41d2.png b/gfx/pikachu/unknown_e41d2.png Binary files differnew file mode 100644 index 00000000..34d71c02 --- /dev/null +++ b/gfx/pikachu/unknown_e41d2.png diff --git a/gfx/pikachu/unknown_e4272.png b/gfx/pikachu/unknown_e4272.png Binary files differnew file mode 100644 index 00000000..8b23b56e --- /dev/null +++ b/gfx/pikachu/unknown_e4272.png diff --git a/gfx/pikachu/unknown_e4323.png b/gfx/pikachu/unknown_e4323.png Binary files differnew file mode 100644 index 00000000..6d8d5c22 --- /dev/null +++ b/gfx/pikachu/unknown_e4323.png diff --git a/gfx/pikachu/unknown_e4383.png b/gfx/pikachu/unknown_e4383.png Binary files differnew file mode 100644 index 00000000..5ac60dc3 --- /dev/null +++ b/gfx/pikachu/unknown_e4383.png diff --git a/gfx/pikachu/unknown_e444b.png b/gfx/pikachu/unknown_e444b.png Binary files differnew file mode 100644 index 00000000..d0240c72 --- /dev/null +++ b/gfx/pikachu/unknown_e444b.png diff --git a/gfx/pikachu/unknown_e458b.png b/gfx/pikachu/unknown_e458b.png Binary files differnew file mode 100644 index 00000000..e374a571 --- /dev/null +++ b/gfx/pikachu/unknown_e458b.png diff --git a/gfx/pikachu/unknown_e463b.png b/gfx/pikachu/unknown_e463b.png Binary files differnew file mode 100644 index 00000000..2e31d6f6 --- /dev/null +++ b/gfx/pikachu/unknown_e463b.png diff --git a/gfx/pikachu/unknown_e467b.png b/gfx/pikachu/unknown_e467b.png Binary files differnew file mode 100644 index 00000000..d088d590 --- /dev/null +++ b/gfx/pikachu/unknown_e467b.png diff --git a/gfx/pikachu/unknown_e472e.png b/gfx/pikachu/unknown_e472e.png Binary files differnew file mode 100644 index 00000000..1a1ac334 --- /dev/null +++ b/gfx/pikachu/unknown_e472e.png diff --git a/gfx/pikachu/unknown_e476e.png b/gfx/pikachu/unknown_e476e.png Binary files differnew file mode 100644 index 00000000..2ca64b68 --- /dev/null +++ b/gfx/pikachu/unknown_e476e.png diff --git a/gfx/pikachu/unknown_e4841.png b/gfx/pikachu/unknown_e4841.png Binary files differnew file mode 100644 index 00000000..f3425637 --- /dev/null +++ b/gfx/pikachu/unknown_e4841.png diff --git a/gfx/pikachu/unknown_e49d1.png b/gfx/pikachu/unknown_e49d1.png Binary files differnew file mode 100644 index 00000000..1414cd6e --- /dev/null +++ b/gfx/pikachu/unknown_e49d1.png diff --git a/gfx/pikachu/unknown_e4a99.png b/gfx/pikachu/unknown_e4a99.png Binary files differnew file mode 100644 index 00000000..e97998c1 --- /dev/null +++ b/gfx/pikachu/unknown_e4a99.png diff --git a/gfx/pikachu/unknown_e4b39.png b/gfx/pikachu/unknown_e4b39.png Binary files differnew file mode 100644 index 00000000..948c46fe --- /dev/null +++ b/gfx/pikachu/unknown_e4b39.png diff --git a/gfx/pikachu/unknown_e4bde.png b/gfx/pikachu/unknown_e4bde.png Binary files differnew file mode 100644 index 00000000..18209284 --- /dev/null +++ b/gfx/pikachu/unknown_e4bde.png diff --git a/gfx/pikachu/unknown_e4c3e.png b/gfx/pikachu/unknown_e4c3e.png Binary files differnew file mode 100644 index 00000000..698c15e8 --- /dev/null +++ b/gfx/pikachu/unknown_e4c3e.png diff --git a/gfx/pikachu/unknown_e4ce0.png b/gfx/pikachu/unknown_e4ce0.png Binary files differnew file mode 100644 index 00000000..68a6832b --- /dev/null +++ b/gfx/pikachu/unknown_e4ce0.png diff --git a/gfx/pikachu/unknown_e4e70.png b/gfx/pikachu/unknown_e4e70.png Binary files differnew file mode 100644 index 00000000..ee849b32 --- /dev/null +++ b/gfx/pikachu/unknown_e4e70.png diff --git a/gfx/pikachu/unknown_e5000.png b/gfx/pikachu/unknown_e5000.png Binary files differnew file mode 100644 index 00000000..9b2685e4 --- /dev/null +++ b/gfx/pikachu/unknown_e5000.png diff --git a/gfx/pikachu/unknown_e50af.png b/gfx/pikachu/unknown_e50af.png Binary files differnew file mode 100644 index 00000000..04acf34f --- /dev/null +++ b/gfx/pikachu/unknown_e50af.png diff --git a/gfx/pikachu/unknown_e523f.png b/gfx/pikachu/unknown_e523f.png Binary files differnew file mode 100644 index 00000000..810c752a --- /dev/null +++ b/gfx/pikachu/unknown_e523f.png diff --git a/gfx/pikachu/unknown_e52fe.png b/gfx/pikachu/unknown_e52fe.png Binary files differnew file mode 100644 index 00000000..7a33deec --- /dev/null +++ b/gfx/pikachu/unknown_e52fe.png diff --git a/gfx/pikachu/unknown_e548e.png b/gfx/pikachu/unknown_e548e.png Binary files differnew file mode 100644 index 00000000..442025a2 --- /dev/null +++ b/gfx/pikachu/unknown_e548e.png diff --git a/gfx/pikachu/unknown_e5541.png b/gfx/pikachu/unknown_e5541.png Binary files differnew file mode 100644 index 00000000..889fa5f6 --- /dev/null +++ b/gfx/pikachu/unknown_e5541.png diff --git a/gfx/pikachu/unknown_e56d1.png b/gfx/pikachu/unknown_e56d1.png Binary files differnew file mode 100644 index 00000000..85f96a92 --- /dev/null +++ b/gfx/pikachu/unknown_e56d1.png diff --git a/gfx/pikachu/unknown_e5794.png b/gfx/pikachu/unknown_e5794.png Binary files differnew file mode 100644 index 00000000..4926e791 --- /dev/null +++ b/gfx/pikachu/unknown_e5794.png diff --git a/gfx/pikachu/unknown_e5924.png b/gfx/pikachu/unknown_e5924.png Binary files differnew file mode 100644 index 00000000..b4f15591 --- /dev/null +++ b/gfx/pikachu/unknown_e5924.png diff --git a/gfx/pikachu/unknown_e59ed.png b/gfx/pikachu/unknown_e59ed.png Binary files differnew file mode 100644 index 00000000..971075ab --- /dev/null +++ b/gfx/pikachu/unknown_e59ed.png diff --git a/gfx/pikachu/unknown_e5b7d.png b/gfx/pikachu/unknown_e5b7d.png Binary files differnew file mode 100644 index 00000000..2b141191 --- /dev/null +++ b/gfx/pikachu/unknown_e5b7d.png diff --git a/gfx/pikachu/unknown_e5c4d.png b/gfx/pikachu/unknown_e5c4d.png Binary files differnew file mode 100644 index 00000000..07f70a39 --- /dev/null +++ b/gfx/pikachu/unknown_e5c4d.png diff --git a/gfx/pikachu/unknown_e5ddd.png b/gfx/pikachu/unknown_e5ddd.png Binary files differnew file mode 100644 index 00000000..e95e11ba --- /dev/null +++ b/gfx/pikachu/unknown_e5ddd.png diff --git a/gfx/pikachu/unknown_e5e90.png b/gfx/pikachu/unknown_e5e90.png Binary files differnew file mode 100644 index 00000000..8e896836 --- /dev/null +++ b/gfx/pikachu/unknown_e5e90.png diff --git a/gfx/pikachu/unknown_e6020.png b/gfx/pikachu/unknown_e6020.png Binary files differnew file mode 100644 index 00000000..7b938b8d --- /dev/null +++ b/gfx/pikachu/unknown_e6020.png diff --git a/gfx/pikachu/unknown_e61b0.png b/gfx/pikachu/unknown_e61b0.png Binary files differnew file mode 100644 index 00000000..d0260da7 --- /dev/null +++ b/gfx/pikachu/unknown_e61b0.png diff --git a/gfx/pikachu/unknown_e6340.png b/gfx/pikachu/unknown_e6340.png Binary files differnew file mode 100644 index 00000000..1bb0b1d9 --- /dev/null +++ b/gfx/pikachu/unknown_e6340.png diff --git a/gfx/pikachu/unknown_e63f7.png b/gfx/pikachu/unknown_e63f7.png Binary files differnew file mode 100644 index 00000000..71ed5a1f --- /dev/null +++ b/gfx/pikachu/unknown_e63f7.png diff --git a/gfx/pikachu/unknown_e6587.png b/gfx/pikachu/unknown_e6587.png Binary files differnew file mode 100644 index 00000000..0ec65607 --- /dev/null +++ b/gfx/pikachu/unknown_e6587.png diff --git a/gfx/pikachu/unknown_e6646.png b/gfx/pikachu/unknown_e6646.png Binary files differnew file mode 100644 index 00000000..c45de678 --- /dev/null +++ b/gfx/pikachu/unknown_e6646.png diff --git a/gfx/pikachu/unknown_e67d6.png b/gfx/pikachu/unknown_e67d6.png Binary files differnew file mode 100644 index 00000000..ee5bdacf --- /dev/null +++ b/gfx/pikachu/unknown_e67d6.png diff --git a/gfx/pikachu/unknown_e682f.png b/gfx/pikachu/unknown_e682f.png Binary files differnew file mode 100644 index 00000000..d0f522dc --- /dev/null +++ b/gfx/pikachu/unknown_e682f.png diff --git a/gfx/pikachu/unknown_e69bf.png b/gfx/pikachu/unknown_e69bf.png Binary files differnew file mode 100644 index 00000000..ce8de250 --- /dev/null +++ b/gfx/pikachu/unknown_e69bf.png diff --git a/gfx/pikachu/unknown_e6b4f.png b/gfx/pikachu/unknown_e6b4f.png Binary files differnew file mode 100644 index 00000000..4ea34714 --- /dev/null +++ b/gfx/pikachu/unknown_e6b4f.png diff --git a/gfx/pikachu/unknown_e6cdf.png b/gfx/pikachu/unknown_e6cdf.png Binary files differnew file mode 100644 index 00000000..f0f96237 --- /dev/null +++ b/gfx/pikachu/unknown_e6cdf.png diff --git a/gfx/pikachu/unknown_e6e6f.png b/gfx/pikachu/unknown_e6e6f.png Binary files differnew file mode 100644 index 00000000..608af942 --- /dev/null +++ b/gfx/pikachu/unknown_e6e6f.png diff --git a/gfx/pikachu/unknown_e6fff.png b/gfx/pikachu/unknown_e6fff.png Binary files differnew file mode 100644 index 00000000..a722794a --- /dev/null +++ b/gfx/pikachu/unknown_e6fff.png diff --git a/gfx/pikachu/unknown_e718f.png b/gfx/pikachu/unknown_e718f.png Binary files differnew file mode 100644 index 00000000..1276764c --- /dev/null +++ b/gfx/pikachu/unknown_e718f.png diff --git a/gfx/pikachu/unknown_e731f.png b/gfx/pikachu/unknown_e731f.png Binary files differnew file mode 100644 index 00000000..2d6d6bdb --- /dev/null +++ b/gfx/pikachu/unknown_e731f.png diff --git a/gfx/pikachu/unknown_e74af.png b/gfx/pikachu/unknown_e74af.png Binary files differnew file mode 100644 index 00000000..0aa1592b --- /dev/null +++ b/gfx/pikachu/unknown_e74af.png diff --git a/gfx/pikachu/unknown_e763f.png b/gfx/pikachu/unknown_e763f.png Binary files differnew file mode 100644 index 00000000..72f9ef29 --- /dev/null +++ b/gfx/pikachu/unknown_e763f.png diff --git a/gfx/pikachu/unknown_e77cf.png b/gfx/pikachu/unknown_e77cf.png Binary files differnew file mode 100644 index 00000000..ad94af7a --- /dev/null +++ b/gfx/pikachu/unknown_e77cf.png diff --git a/gfx/pikachu/unknown_e7863.png b/gfx/pikachu/unknown_e7863.png Binary files differnew file mode 100644 index 00000000..cd02d18d --- /dev/null +++ b/gfx/pikachu/unknown_e7863.png diff --git a/gfx/pikachu/unknown_e79f3.png b/gfx/pikachu/unknown_e79f3.png Binary files differnew file mode 100644 index 00000000..07b8230d --- /dev/null +++ b/gfx/pikachu/unknown_e79f3.png diff --git a/gfx/pikachu/unknown_e7b83.png b/gfx/pikachu/unknown_e7b83.png Binary files differnew file mode 100644 index 00000000..8a835dfb --- /dev/null +++ b/gfx/pikachu/unknown_e7b83.png diff --git a/gfx/pikachu/unknown_e7d13.png b/gfx/pikachu/unknown_e7d13.png Binary files differnew file mode 100644 index 00000000..3204f702 --- /dev/null +++ b/gfx/pikachu/unknown_e7d13.png diff --git a/gfx/pikachu/unknown_f0abf.png b/gfx/pikachu/unknown_f0abf.png Binary files differnew file mode 100644 index 00000000..dd553a8a --- /dev/null +++ b/gfx/pikachu/unknown_f0abf.png diff --git a/gfx/pikachu/unknown_f0b64.png b/gfx/pikachu/unknown_f0b64.png Binary files differnew file mode 100644 index 00000000..6b0424a8 --- /dev/null +++ b/gfx/pikachu/unknown_f0b64.png diff --git a/gfx/pikachu/unknown_f0cf4.png b/gfx/pikachu/unknown_f0cf4.png Binary files differnew file mode 100644 index 00000000..a4a4e5f4 --- /dev/null +++ b/gfx/pikachu/unknown_f0cf4.png diff --git a/gfx/pikachu/unknown_f0d82.png b/gfx/pikachu/unknown_f0d82.png Binary files differnew file mode 100644 index 00000000..1af4b770 --- /dev/null +++ b/gfx/pikachu/unknown_f0d82.png diff --git a/gfx/pokemon_logo.png b/gfx/pokemon_logo.png Binary files differindex cc7582c5..64f9b23f 100644 --- a/gfx/pokemon_logo.png +++ b/gfx/pokemon_logo.png diff --git a/gfx/pokemon_logo_japan.png b/gfx/pokemon_logo_japan.png Binary files differnew file mode 100644 index 00000000..d75bb302 --- /dev/null +++ b/gfx/pokemon_logo_japan.png diff --git a/gfx/pokemon_yellow.t6.png b/gfx/pokemon_yellow.t6.png Binary files differnew file mode 100644 index 00000000..7c86a1ec --- /dev/null +++ b/gfx/pokemon_yellow.t6.png diff --git a/gfx/red/intro_nido_1.6x6.png b/gfx/red/intro_nido_1.6x6.png Binary files differdeleted file mode 100644 index 4c7804a1..00000000 --- a/gfx/red/intro_nido_1.6x6.png +++ /dev/null diff --git a/gfx/red/intro_nido_2.6x6.png b/gfx/red/intro_nido_2.6x6.png Binary files differdeleted file mode 100644 index a29a4814..00000000 --- a/gfx/red/intro_nido_2.6x6.png +++ /dev/null diff --git a/gfx/red/intro_nido_3.6x6.png b/gfx/red/intro_nido_3.6x6.png Binary files differdeleted file mode 100644 index e920d55d..00000000 --- a/gfx/red/intro_nido_3.6x6.png +++ /dev/null diff --git a/gfx/red/redgreenversion.png b/gfx/red/redgreenversion.png Binary files differdeleted file mode 100644 index e41b4295..00000000 --- a/gfx/red/redgreenversion.png +++ /dev/null diff --git a/gfx/red/sgbborder.map b/gfx/red/sgbborder.map Binary files differdeleted file mode 100644 index 4077ed8e..00000000 --- a/gfx/red/sgbborder.map +++ /dev/null diff --git a/gfx/red/sgbborder.png b/gfx/red/sgbborder.png Binary files differdeleted file mode 100644 index 7549bb47..00000000 --- a/gfx/red/sgbborder.png +++ /dev/null diff --git a/gfx/red/slotmachine1.png b/gfx/red/slotmachine1.png Binary files differdeleted file mode 100644 index 785c74f9..00000000 --- a/gfx/red/slotmachine1.png +++ /dev/null diff --git a/gfx/red/slotmachine2.png b/gfx/red/slotmachine2.png Binary files differdeleted file mode 100644 index 779d0cd8..00000000 --- a/gfx/red/slotmachine2.png +++ /dev/null diff --git a/gfx/yellow/slotmachine1.png b/gfx/slotmachine1.png Binary files differindex 335ce97c..335ce97c 100644 --- a/gfx/yellow/slotmachine1.png +++ b/gfx/slotmachine1.png diff --git a/gfx/yellow/slotmachine2.png b/gfx/slotmachine2.png Binary files differindex b4bdf8a8..b4bdf8a8 100644 --- a/gfx/yellow/slotmachine2.png +++ b/gfx/slotmachine2.png diff --git a/gfx/sprites/bike_shop_guy.png b/gfx/sprites/bike_shop_guy.png Binary files differindex 1ea83685..da3d5ac6 100644 --- a/gfx/sprites/bike_shop_guy.png +++ b/gfx/sprites/bike_shop_guy.png diff --git a/gfx/sprites/bulbasaur.png b/gfx/sprites/bulbasaur.png Binary files differnew file mode 100644 index 00000000..a26d3a37 --- /dev/null +++ b/gfx/sprites/bulbasaur.png diff --git a/gfx/sprites/chansey.png b/gfx/sprites/chansey.png Binary files differnew file mode 100644 index 00000000..7efade25 --- /dev/null +++ b/gfx/sprites/chansey.png diff --git a/gfx/sprites/clefairy2.png b/gfx/sprites/clefairy2.png Binary files differnew file mode 100644 index 00000000..e8502ddd --- /dev/null +++ b/gfx/sprites/clefairy2.png diff --git a/gfx/sprites/daisy.png b/gfx/sprites/daisy.png Binary files differindex 9bad9116..84f330f1 100644 --- a/gfx/sprites/daisy.png +++ b/gfx/sprites/daisy.png diff --git a/gfx/sprites/james.png b/gfx/sprites/james.png Binary files differnew file mode 100644 index 00000000..a96772cb --- /dev/null +++ b/gfx/sprites/james.png diff --git a/gfx/sprites/jessie.png b/gfx/sprites/jessie.png Binary files differnew file mode 100644 index 00000000..2f4f5a29 --- /dev/null +++ b/gfx/sprites/jessie.png diff --git a/gfx/sprites/jigglypuff.png b/gfx/sprites/jigglypuff.png Binary files differnew file mode 100644 index 00000000..2fc06ecc --- /dev/null +++ b/gfx/sprites/jigglypuff.png diff --git a/gfx/sprites/mom_geisha.png b/gfx/sprites/mom_geisha.png Binary files differindex c9b556ea..13862615 100644 --- a/gfx/sprites/mom_geisha.png +++ b/gfx/sprites/mom_geisha.png diff --git a/gfx/sprites/nurse.png b/gfx/sprites/nurse.png Binary files differindex b49768c8..5defe155 100644 --- a/gfx/sprites/nurse.png +++ b/gfx/sprites/nurse.png diff --git a/gfx/sprites/oddish.png b/gfx/sprites/oddish.png Binary files differnew file mode 100644 index 00000000..c63e9cc7 --- /dev/null +++ b/gfx/sprites/oddish.png diff --git a/gfx/sprites/officer_jenny.png b/gfx/sprites/officer_jenny.png Binary files differnew file mode 100644 index 00000000..06eb3e10 --- /dev/null +++ b/gfx/sprites/officer_jenny.png diff --git a/gfx/sprites/pikachu.png b/gfx/sprites/pikachu.png Binary files differnew file mode 100644 index 00000000..8f00f6d1 --- /dev/null +++ b/gfx/sprites/pikachu.png diff --git a/gfx/sprites/question_mark.png b/gfx/sprites/question_mark.png Binary files differnew file mode 100644 index 00000000..9c58264e --- /dev/null +++ b/gfx/sprites/question_mark.png diff --git a/gfx/sprites/sandshrew.png b/gfx/sprites/sandshrew.png Binary files differnew file mode 100644 index 00000000..8a31d24c --- /dev/null +++ b/gfx/sprites/sandshrew.png diff --git a/gfx/sprites/surfing_pikachu.png b/gfx/sprites/surfing_pikachu.png Binary files differnew file mode 100644 index 00000000..546ecbaf --- /dev/null +++ b/gfx/sprites/surfing_pikachu.png diff --git a/gfx/stats_screen_hp.png b/gfx/stats_screen_hp.png Binary files differnew file mode 100644 index 00000000..adf086ca --- /dev/null +++ b/gfx/stats_screen_hp.png diff --git a/gfx/stats_screen_lv.png b/gfx/stats_screen_lv.png Binary files differnew file mode 100644 index 00000000..0d5c6620 --- /dev/null +++ b/gfx/stats_screen_lv.png diff --git a/gfx/surfing_pikachu_1.t4.png b/gfx/surfing_pikachu_1.t4.png Binary files differnew file mode 100644 index 00000000..abaf4ba4 --- /dev/null +++ b/gfx/surfing_pikachu_1.t4.png diff --git a/gfx/surfing_pikachu_1a.png b/gfx/surfing_pikachu_1a.png Binary files differnew file mode 100644 index 00000000..0bc11684 --- /dev/null +++ b/gfx/surfing_pikachu_1a.png diff --git a/gfx/surfing_pikachu_1b.png b/gfx/surfing_pikachu_1b.png Binary files differnew file mode 100644 index 00000000..a64eb4c7 --- /dev/null +++ b/gfx/surfing_pikachu_1b.png diff --git a/gfx/surfing_pikachu_1c.t5.png b/gfx/surfing_pikachu_1c.t5.png Binary files differnew file mode 100644 index 00000000..eeedb243 --- /dev/null +++ b/gfx/surfing_pikachu_1c.t5.png diff --git a/gfx/surfing_pikachu_2.png b/gfx/surfing_pikachu_2.png Binary files differnew file mode 100644 index 00000000..f8752966 --- /dev/null +++ b/gfx/surfing_pikachu_2.png diff --git a/gfx/surfing_pikachu_3.t1.png b/gfx/surfing_pikachu_3.t1.png Binary files differnew file mode 100644 index 00000000..91d4a607 --- /dev/null +++ b/gfx/surfing_pikachu_3.t1.png diff --git a/gfx/tilemaps/sgbborder.map b/gfx/tilemaps/sgbborder.map Binary files differnew file mode 100644 index 00000000..9c97c339 --- /dev/null +++ b/gfx/tilemaps/sgbborder.map diff --git a/gfx/tilesets/beachhouse.png b/gfx/tilesets/beachhouse.png Binary files differnew file mode 100644 index 00000000..f5dccf7a --- /dev/null +++ b/gfx/tilesets/beachhouse.png diff --git a/gfx/tilesets/beachhouse.tilecoll b/gfx/tilesets/beachhouse.tilecoll new file mode 100644 index 00000000..54ddac19 --- /dev/null +++ b/gfx/tilesets/beachhouse.tilecoll @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/gfx/tilesets/gate.t1.png b/gfx/tilesets/museum.t1.png Binary files differindex 372e6751..372e6751 100644 --- a/gfx/tilesets/gate.t1.png +++ b/gfx/tilesets/museum.t1.png diff --git a/gfx/tilesets/overworld.png b/gfx/tilesets/overworld.png Binary files differnew file mode 100644 index 00000000..a707eec4 --- /dev/null +++ b/gfx/tilesets/overworld.png diff --git a/gfx/tilesets/overworld.t2.png b/gfx/tilesets/overworld.t2.png Binary files differdeleted file mode 100644 index c7533e40..00000000 --- a/gfx/tilesets/overworld.t2.png +++ /dev/null diff --git a/gfx/tilesets/reds_house.t7.png b/gfx/tilesets/redshouse2.t7.png Binary files differindex 5f210d04..5f210d04 100644 --- a/gfx/tilesets/reds_house.t7.png +++ b/gfx/tilesets/redshouse2.t7.png diff --git a/gfx/tilesets/ship_port.t2.png b/gfx/tilesets/shipport.t2.png Binary files differindex fa5bbb27..fa5bbb27 100644 --- a/gfx/tilesets/ship_port.t2.png +++ b/gfx/tilesets/shipport.t2.png diff --git a/gfx/unknown_f8946.map b/gfx/unknown_f8946.map new file mode 100644 index 00000000..a89a52b8 --- /dev/null +++ b/gfx/unknown_f8946.map @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/gfx/unknown_f90bc.map b/gfx/unknown_f90bc.map Binary files differnew file mode 100644 index 00000000..98b8ba51 --- /dev/null +++ b/gfx/unknown_f90bc.map diff --git a/gfx/unknown_f91ac.map b/gfx/unknown_f91ac.map new file mode 100644 index 00000000..8a1f06b7 --- /dev/null +++ b/gfx/unknown_f91ac.map @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/gfx/unknown_f91bb.map b/gfx/unknown_f91bb.map new file mode 100644 index 00000000..6d8ebb43 --- /dev/null +++ b/gfx/unknown_f91bb.map @@ -0,0 +1,2 @@ + +
\ No newline at end of file diff --git a/gfx/unknown_f91c8.map b/gfx/unknown_f91c8.map new file mode 100644 index 00000000..20d18de5 --- /dev/null +++ b/gfx/unknown_f91c8.map @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/gfx/unknown_f9b6e.map b/gfx/unknown_f9b6e.map Binary files differnew file mode 100644 index 00000000..3ce924dc --- /dev/null +++ b/gfx/unknown_f9b6e.map diff --git a/gfx/unknown_f9be6.map b/gfx/unknown_f9be6.map new file mode 100644 index 00000000..18560135 --- /dev/null +++ b/gfx/unknown_f9be6.map @@ -0,0 +1 @@ +0123@ABCPQRS
\ No newline at end of file diff --git a/gfx/unknown_f9bf2.map b/gfx/unknown_f9bf2.map new file mode 100644 index 00000000..e587b7ce --- /dev/null +++ b/gfx/unknown_f9bf2.map @@ -0,0 +1 @@ +"#
\ No newline at end of file diff --git a/gfx/unknown_f9c2c.png b/gfx/unknown_f9c2c.png Binary files differnew file mode 100644 index 00000000..b5c68424 --- /dev/null +++ b/gfx/unknown_f9c2c.png diff --git a/gfx/unknown_f9c6c.png b/gfx/unknown_f9c6c.png Binary files differnew file mode 100644 index 00000000..3725d6cc --- /dev/null +++ b/gfx/unknown_f9c6c.png diff --git a/gfx/unknown_fd86b.png b/gfx/unknown_fd86b.png Binary files differnew file mode 100644 index 00000000..20bcf5a7 --- /dev/null +++ b/gfx/unknown_fd86b.png diff --git a/gfx/yellow_intro.png b/gfx/yellow_intro.png Binary files differnew file mode 100644 index 00000000..a9a2773c --- /dev/null +++ b/gfx/yellow_intro.png diff --git a/gfx/yellow_titlescreen.png b/gfx/yellow_titlescreen.png Binary files differnew file mode 100644 index 00000000..285309ce --- /dev/null +++ b/gfx/yellow_titlescreen.png diff --git a/gfx/zero_one_ea597.png b/gfx/zero_one_ea597.png Binary files differnew file mode 100644 index 00000000..0c11b9da --- /dev/null +++ b/gfx/zero_one_ea597.png @@ -21,8 +21,8 @@ SECTION "rst 38", ROM0 [$38] SECTION "vblank", ROM0 [$40] jp VBlank SECTION "hblank", ROM0 [$48] - rst $38 -SECTION "timer", ROM0 [$50] + jp LCDC +SECTION "timer", ROM0 [$50] jp Timer SECTION "serial", ROM0 [$58] jp Serial @@ -87,7 +87,7 @@ INCLUDE "home/copy.asm" SECTION "Entry", ROM0 [$100] nop - jp Start + jp Start ; 01ab SECTION "Header", ROM0 [$104] @@ -101,25 +101,74 @@ SECTION "Header", ROM0 [$104] SECTION "Main", ROM0 +PlayPikachuPCM:: + ld a, [H_LOADEDROMBANK] + push af + ld a, b + call BankswitchCommon + ld a, [hli] + ld c, a + ld a, [hli] + ld b, a +.loop + ld a, [hli] + ld d, a + ld a, $3 +.playSingleSample + dec a + jr nz, .playSingleSample + + rept 7 + call LoadNextSoundClipSample + call PlaySoundClipSample + endr + + call LoadNextSoundClipSample + dec bc + ld a, c + or b + jr nz, .loop + pop af + call BankswitchCommon + ret + +LoadNextSoundClipSample:: + ld a, d + and $80 + srl a + srl a + ld [rNR32], a + sla d + ret + +PlaySoundClipSample:: + ld a, $3 +.loop + dec a + jr nz, .loop + ret + Start:: cp GBC jr z, .gbc xor a jr .ok .gbc - ld a, 0 + ld a, $1 .ok - ld [wGBC], a + ld [hGBC], a jp Init +Joypad:: + homecall_jump _Joypad -INCLUDE "home/joypad.asm" -INCLUDE "data/map_header_pointers.asm" -INCLUDE "home/overworld.asm" +ReadJoypad:: + homecall_jump ReadJoypad_ +INCLUDE "home/overworld.asm" CheckForUserInterruption:: -; Return carry if Up+Select+B, Start or A are pressed in c frames. +; Return carry if Up + Select + B, Start or A are pressed in c frames. ; Used only in the intro and title screen. call DelayFrame @@ -149,24 +198,24 @@ CheckForUserInterruption:: ; INPUT: ; a = ID of destination warp within destination map LoadDestinationWarpPosition:: - ld b,a - ld a,[H_LOADEDROMBANK] + ld b, a + ld a, [H_LOADEDROMBANK] push af - ld a,[wPredefParentBank] - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - ld a,b + ld a, [wPredefParentBank] + ld [H_LOADEDROMBANK], a + ld [MBC1RomBank], a + ld a, b add a add a - ld c,a - ld b,0 - add hl,bc - ld bc,4 - ld de,wCurrentTileBlockMapViewPointer + ld c, a + ld b, 0 + add hl, bc + ld bc, 4 + ld de, wCurrentTileBlockMapViewPointer call CopyData pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + ld [H_LOADEDROMBANK], a + ld [MBC1RomBank], a ret @@ -177,7 +226,7 @@ DrawHPBar:: push hl push de - push bc + ;push bc ; Left ld a, $71 ; "HP:" @@ -190,18 +239,18 @@ DrawHPBar:: ; Middle ld a, $63 ; empty .draw - ld [hli],a + ld [hli], a dec d jr nz, .draw ; Right - ld a,[wHPBarType] + ld a, [wHPBarType] dec a ld a, $6d ; status screen and battle jr z, .ok dec a ; pokemon menu .ok - ld [hl],a + ld [hl], a pop hl @@ -233,7 +282,7 @@ DrawHPBar:: add e ld [hl], a .done - pop bc + ;pop bc pop de pop hl ret @@ -251,11 +300,10 @@ DrawHPBar:: ; OUTPUT: ; [wcf91] = pokemon ID ; wLoadedMon = base address of pokemon data -; wMonHeader = base address of base stats +; W_MONHDEXNUM = base address of base stats LoadMonData:: jpab LoadMonData_ - OverwritewMoves:: ; Write c to [wMoves + b]. Unused. ld hl, wMoves @@ -297,25 +345,31 @@ LoadFrontSpriteByMonIndex:: pop hl ld a, [H_LOADEDROMBANK] push af - ld a, Bank(CopyUncompressedPicToHL) - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + switchbank CopyUncompressedPicToHL xor a ld [hStartTileID], a call CopyUncompressedPicToHL xor a ld [wSpriteFlipped], a pop af - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a - ret - + jp BankswitchCommon PlayCry:: ; Play monster a's cry. + push bc + ld b, a + ld a, [wLowHealthAlarm] + push af + xor a + ld [wLowHealthAlarm], a + ld a, b call GetCryData call PlaySound - jp WaitForSoundToFinish + call WaitForSoundToFinish + pop af + ld [wLowHealthAlarm], a + pop bc + ret GetCryData:: ; Load cry data for monster a. @@ -327,7 +381,7 @@ GetCryData:: add hl, bc add hl, bc - ld a, Bank(CryData) + ld a, BANK(CryData) call BankswitchHome ld a, [hli] ld b, a ; cry id @@ -347,12 +401,11 @@ GetCryData:: add c ret - DisplayPartyMenu:: - ld a,[hTilesetType] + ld a, [hTilesetType] push af xor a - ld [hTilesetType],a + ld [hTilesetType], a call GBPalWhiteOutWithDelay3 call ClearSprites call PartyMenuInit @@ -360,10 +413,10 @@ DisplayPartyMenu:: jp HandlePartyMenuInput GoBackToPartyMenu:: - ld a,[hTilesetType] + ld a, [hTilesetType] push af xor a - ld [hTilesetType],a + ld [hTilesetType], a call PartyMenuInit call RedrawPartyMenu jp HandlePartyMenuInput @@ -408,67 +461,90 @@ PartyMenuInit:: ret HandlePartyMenuInput:: - ld a,1 - ld [wMenuWrappingEnabled],a - ld a,$40 - ld [wPartyMenuAnimMonEnabled],a - call HandleMenuInput_ + ld a, 1 + ld [wMenuWrappingEnabled], a + ld a, $40 + ld [wPartyMenuAnimMonEnabled], a + call HandleMenuInputPokemonSelection + push af ; save hJoy5 OR wMenuWrapping enabled, if no inputs were selected within a certain period of time + bit 1, a ; was B button pressed? + ld a, $0 + ld [wPartyMenuAnimMonEnabled], a + ld a, [wCurrentMenuItem] + ld [wPartyAndBillsPCSavedMenuItem], a + jr nz, .asm_1258 + ld a, [wCurrentMenuItem] + ld [wWhichPokemon], a + callab IsThisPartymonStarterPikachu_Party ; 3f:4e18 + jr nc, .asm_1258 + call CheckPikachuFollowingPlayer + jr nz, .asm_128f +.asm_1258 + pop af call PlaceUnfilledArrowMenuCursor - ld b,a - xor a - ld [wPartyMenuAnimMonEnabled],a - ld a,[wCurrentMenuItem] - ld [wPartyAndBillsPCSavedMenuItem],a - ld hl,wd730 - res 6,[hl] ; turn on letter printing delay - ld a,[wMenuItemToSwap] + ld b, a + ld hl, wd730 + res 6, [hl] ; turn on letter printing delay + ld a, [wMenuItemToSwap] and a - jp nz,.swappingPokemon - pop af - ld [hTilesetType],a - bit 1,b - jr nz,.noPokemonChosen - ld a,[wPartyCount] + jp nz, .swappingPokemon + pop af ; double pop af? + ld [hTilesetType], a + bit 1, b + jr nz, .noPokemonChosen + ld a, [wPartyCount] and a - jr z,.noPokemonChosen - ld a,[wCurrentMenuItem] - ld [wWhichPokemon],a - ld hl,wPartySpecies - ld b,0 - ld c,a - add hl,bc - ld a,[hl] - ld [wcf91],a - ld [wBattleMonSpecies2],a + jr z, .noPokemonChosen + ld a, [wCurrentMenuItem] + ld [wWhichPokemon], a + ld hl, wPartySpecies + ld b, 0 + ld c, a + add hl, bc + ld a, [hl] + ld [wcf91], a + ld [wBattleMonSpecies2], a call BankswitchBack and a ret +.asm_128f + pop af + ld hl, PartyMenuText_12cc + call PrintText + xor a + ld [wMenuItemToSwap], a + pop af + ld [hTilesetType], a .noPokemonChosen call BankswitchBack scf ret .swappingPokemon - bit 1,b ; was the B button pressed? - jr z,.handleSwap ; if not, handle swapping the pokemon + bit 1, b ; was the B button pressed? + jr z, .handleSwap ; if not, handle swapping the pokemon .cancelSwap ; if the B button was pressed - callba ErasePartyMenuCursors + callba ErasePartyMenuCursors ; 4:5e98 xor a - ld [wMenuItemToSwap],a - ld [wPartyMenuTypeOrMessageID],a + ld [wMenuItemToSwap], a + ld [wPartyMenuTypeOrMessageID], a call RedrawPartyMenu - jr HandlePartyMenuInput + jp HandlePartyMenuInput .handleSwap - ld a,[wCurrentMenuItem] - ld [wWhichPokemon],a - callba SwitchPartyMon - jr HandlePartyMenuInput + ld a, [wCurrentMenuItem] + ld [wWhichPokemon], a + callba SwitchPartyMon ; 4:61c5 + jp HandlePartyMenuInput + +PartyMenuText_12cc:: + TX_FAR _SleepingPikachuText1 ; 28:411b + db "@" DrawPartyMenu:: - ld hl, DrawPartyMenu_ + ld hl, DrawPartyMenu_ ; 4:5875 jr DrawPartyMenuCommon RedrawPartyMenu:: - ld hl, RedrawPartyMenu_ + ld hl, RedrawPartyMenu_ ; 4:5886 DrawPartyMenuCommon:: ld b, BANK(RedrawPartyMenu_) @@ -482,45 +558,36 @@ PrintStatusCondition:: push de dec de dec de ; de = address of current HP - ld a,[de] - ld b,a + ld a, [de] + ld b, a dec de - ld a,[de] + ld a, [de] or b ; is the pokemon's HP zero? pop de - jr nz,PrintStatusConditionNotFainted + jr nz, PrintStatusConditionNotFainted ; if the pokemon's HP is 0, print "FNT" - ld a,"F" - ld [hli],a - ld a,"N" - ld [hli],a - ld [hl],"T" + ld a, "F" + ld [hli], a + ld a, "N" + ld [hli], a + ld [hl], "T" and a ret + PrintStatusConditionNotFainted: - ld a,[H_LOADEDROMBANK] - push af - ld a,BANK(PrintStatusAilment) - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - call PrintStatusAilment ; print status condition - pop bc - ld a,b - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - ret + homecall_jump_sf PrintStatusAilment ; function to print pokemon level, leaving off the ":L" if the level is at least 100 ; INPUT: ; hl = destination address ; [wLoadedMonLevel] = level PrintLevel:: - ld a,$6e ; ":L" tile ID - ld [hli],a - ld c,2 ; number of digits - ld a,[wLoadedMonLevel] ; level - cp a,100 - jr c,PrintLevelCommon + ld a, $6e ; ":L" tile ID + ld [hli], a + ld c, 2 ; number of digits + ld a, [wLoadedMonLevel] ; level + cp 100 + jr c, PrintLevelCommon ; if level at least 100, write over the ":L" tile dec hl inc c ; increment number of digits to 3 @@ -531,105 +598,95 @@ PrintLevel:: ; hl = destination address ; [wLoadedMonLevel] = level PrintLevelFull:: - ld a,$6e ; ":L" tile ID - ld [hli],a - ld c,3 ; number of digits - ld a,[wLoadedMonLevel] ; level + ld a, $6e ; ":L" tile ID + ld [hli], a + ld c, 3 ; number of digits + ld a, [wLoadedMonLevel] ; level PrintLevelCommon:: - ld [wd11e],a - ld de,wd11e - ld b,LEFT_ALIGN | 1 ; 1 byte + ld [wd11e], a + ld de, wd11e + ld b, LEFT_ALIGN | 1 ; 1 byte jp PrintNumber GetwMoves:: ; Unused. Returns the move at index a from wMoves in a - ld hl,wMoves - ld c,a - ld b,0 - add hl,bc - ld a,[hl] + ld hl, wMoves + ld c, a + ld b, 0 + add hl, bc + ld a, [hl] ret ; copies the base stat data of a pokemon to wMonHeader ; INPUT: ; [wd0b5] = pokemon ID GetMonHeader:: - ld a,[H_LOADEDROMBANK] + ld a, [H_LOADEDROMBANK] push af - ld a,BANK(BaseStats) - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + switchbank BaseStats push bc push de push hl - ld a,[wd11e] + ld a, [wd11e] push af - ld a,[wd0b5] - ld [wd11e],a - ld de,FossilKabutopsPic - ld b,$66 ; size of Kabutops fossil and Ghost sprites - cp a,FOSSIL_KABUTOPS ; Kabutops fossil - jr z,.specialID - ld de,GhostPic - cp a,MON_GHOST ; Ghost - jr z,.specialID - ld de,FossilAerodactylPic - ld b,$77 ; size of Aerodactyl fossil sprite - cp a,FOSSIL_AERODACTYL ; Aerodactyl fossil - jr z,.specialID - cp a,MEW - jr z,.mew + ld a, [wd0b5] + ld [wd11e], a + ld de, FossilKabutopsPic + ld b, $66 ; size of Kabutops fossil and Ghost sprites + cp FOSSIL_KABUTOPS ; Kabutops fossil + jr z, .specialID + ld de, GhostPic + cp MON_GHOST ; Ghost + jr z, .specialID + ld de, FossilAerodactylPic + ld b, $77 ; size of Aerodactyl fossil sprite + cp FOSSIL_AERODACTYL ; Aerodactyl fossil + jr z, .specialID + ;cp MEW + ;jr z, .mew predef IndexToPokedex ; convert pokemon ID in [wd11e] to pokedex number - ld a,[wd11e] + ld a, [wd11e] dec a - ld bc,MonBaseStatsEnd - MonBaseStats - ld hl,BaseStats + ld bc, 28 + ld hl, BaseStats call AddNTimes - ld de,wMonHeader - ld bc,MonBaseStatsEnd - MonBaseStats + ld de, wMonHeader + ld bc, 28 call CopyData jr .done .specialID - ld hl,wMonHSpriteDim - ld [hl],b ; write sprite dimensions + ld hl, wMonHSpriteDim + ld [hl], b ; write sprite dimensions inc hl - ld [hl],e ; write front sprite pointer + ld [hl], e ; write front sprite pointer inc hl - ld [hl],d - jr .done -.mew - ld hl,MewBaseStats - ld de,wMonHeader - ld bc,MonBaseStatsEnd - MonBaseStats - ld a,BANK(MewBaseStats) - call FarCopyData + ld [hl], d .done - ld a,[wd0b5] - ld [wMonHIndex],a + ld a, [wd0b5] + ld [wMonHIndex], a pop af - ld [wd11e],a + ld [wd11e], a pop hl pop de pop bc pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + call BankswitchCommon ret ; copy party pokemon's name to wcd6d GetPartyMonName2:: - ld a,[wWhichPokemon] ; index within party - ld hl,wPartyMonNicks + ld a, [wWhichPokemon] ; index within party + ld hl, wPartyMonNicks ; this is called more often GetPartyMonName:: push hl push bc call SkipFixedLengthTextEntries ; add NAME_LENGTH to hl, a times - ld de,wcd6d + ld de, wcd6d push de - ld bc,NAME_LENGTH + ld bc, NAME_LENGTH call CopyData pop de pop bc @@ -650,38 +707,38 @@ GetPartyMonName:: ; Note that bits 5 and 7 are modified during execution. The above reflects ; their meaning at the beginning of the functions's execution. PrintBCDNumber:: - ld b,c ; save flags in b - res 7,c - res 6,c - res 5,c ; c now holds the length - bit 5,b - jr z,.loop - bit 7,b - jr nz,.loop - ld [hl],"¥" + ld b, c ; save flags in b + res 7, c + res 6, c + res 5, c ; c now holds the length + bit 5, b + jr z, .loop + bit 7, b + jr nz, .loop + ld [hl], "¥" inc hl .loop - ld a,[de] + ld a, [de] swap a call PrintBCDDigit ; print upper digit - ld a,[de] + ld a, [de] call PrintBCDDigit ; print lower digit inc de dec c - jr nz,.loop - bit 7,b ; were any non-zero digits printed? - jr z,.done ; if so, we are done + jr nz, .loop + bit 7, b ; were any non-zero digits printed? + jr z, .done ; if so, we are done .numberEqualsZero ; if every digit of the BCD number is zero - bit 6,b ; left or right alignment? - jr nz,.skipRightAlignmentAdjustment + bit 6, b ; left or right alignment? + jr nz, .skipRightAlignmentAdjustment dec hl ; if the string is right-aligned, it needs to be moved back one space .skipRightAlignmentAdjustment - bit 5,b - jr z,.skipCurrencySymbol - ld [hl],"¥" + bit 5, b + jr z, .skipCurrencySymbol + ld [hl], "¥" inc hl .skipCurrencySymbol - ld [hl],"0" + ld [hl], "0" call PrintLetterDelay inc hl .done @@ -690,26 +747,26 @@ PrintBCDNumber:: PrintBCDDigit:: and $f and a - jr z,.zeroDigit + jr z, .zeroDigit .nonzeroDigit - bit 7,b ; have any non-space characters been printed? - jr z,.outputDigit + bit 7, b ; have any non-space characters been printed? + jr z, .outputDigit ; if bit 7 is set, then no numbers have been printed yet - bit 5,b ; print the currency symbol? - jr z,.skipCurrencySymbol - ld [hl],"¥" + bit 5, b ; print the currency symbol? + jr z, .skipCurrencySymbol + ld [hl], "¥" inc hl - res 5,b + res 5, b .skipCurrencySymbol - res 7,b ; unset 7 to indicate that a nonzero digit has been reached + res 7, b ; unset 7 to indicate that a nonzero digit has been reached .outputDigit - add a,"0" - ld [hli],a + add "0" + ld [hli], a jp PrintLetterDelay .zeroDigit - bit 7,b ; either printing leading zeroes or already reached a nonzero digit? - jr z,.outputDigit ; if so, print a zero digit - bit 6,b ; left or right alignment? + bit 7, b ; either printing leading zeroes or already reached a nonzero digit? + jr z, .outputDigit ; if so, print a zero digit + bit 6, b ; left or right alignment? ret nz inc hl ; if right-aligned, "print" a space by advancing the pointer ret @@ -718,12 +775,12 @@ PrintBCDDigit:: ; assumes the corresponding mon header is already loaded ; hl contains offset to sprite pointer ($b for front or $d for back) UncompressMonSprite:: - ld bc,wMonHeader - add hl,bc - ld a,[hli] - ld [wSpriteInputPtr],a ; fetch sprite input pointer - ld a,[hl] - ld [wSpriteInputPtr+1],a + ld bc, wMonHeader + add hl, bc + ld a, [hli] + ld [wSpriteInputPtr], a ; fetch sprite input pointer + ld a, [hl] + ld [wSpriteInputPtr + 1], a ; define (by index number) the bank that a pokemon's image is in ; index = Mew, bank 1 ; index = Kabutops fossil, bank $B @@ -731,35 +788,35 @@ UncompressMonSprite:: ; $1F ≤ index < $4A, bank $A ; $4A ≤ index < $74, bank $B ; $74 ≤ index < $99, bank $C -; $99 ≤ index, bank $D - ld a,[wcf91] ; XXX name for this ram location - ld b,a - cp MEW - ld a,BANK(MewPicFront) - jr z,.GotBank - ld a,b +; $99 ≤ index, bank $D + ld a, [wcf91] ; XXX name for this ram location + ld b, a + ;cp MEW + ;ld a, BANK(MewPicFront) + ;jr z, .GotBank + ;ld a, b cp FOSSIL_KABUTOPS - ld a,BANK(FossilKabutopsPic) - jr z,.GotBank - ld a,b + ld a, BANK(FossilKabutopsPic) + jr z, .GotBank + ld a, b cp TANGELA + 1 - ld a,BANK(TangelaPicFront) - jr c,.GotBank - ld a,b + ld a, BANK(TangelaPicFront) + jr c, .GotBank + ld a, b cp MOLTRES + 1 - ld a,BANK(MoltresPicFront) - jr c,.GotBank - ld a,b + ld a, BANK(MoltresPicFront) + jr c, .GotBank + ld a, b cp BEEDRILL + 2 - ld a,BANK(BeedrillPicFront) - jr c,.GotBank - ld a,b + ld a, BANK(BeedrillPicFront) + jr c, .GotBank + ld a, b cp STARMIE + 1 - ld a,BANK(StarmiePicFront) - jr c,.GotBank - ld a,BANK(VictreebelPicFront) + ld a, BANK(StarmiePicFront) + jr c, .GotBank + ld a, BANK(VictreebelPicFront) .GotBank - jp UncompressSpriteData + jp UncompressSpriteData ; 23f8 ; de: destination location LoadMonFrontSprite:: @@ -775,7 +832,7 @@ LoadMonFrontSprite:: ; postprocesses uncompressed sprite chunks to a 2bpp sprite and loads it into video ram ; calculates alignment parameters to place both sprite chunks in the center of the 7*7 tile sprite buffers ; de: destination location -; a,c: sprite dimensions (in tiles of 8x8 each) +; a, c: sprite dimensions (in tiles of 8x8 each) LoadUncompressedSpriteData:: push de and $f @@ -808,8 +865,8 @@ LoadUncompressedSpriteData:: add a add a ; 8*(7*((8-w)/2) + 7-h) ; combined overall offset (in bytes) ld [H_SPRITEOFFSET], a - xor a - ld [$4000], a + ld a, $0 + call SwitchSRAMBankAndLatchClockData ld hl, sSpriteBuffer0 call ZeroSpriteBuffer ; zero buffer 0 ld de, sSpriteBuffer1 @@ -820,8 +877,9 @@ LoadUncompressedSpriteData:: ld de, sSpriteBuffer2 ld hl, sSpriteBuffer1 call AlignSpriteDataCentered ; copy and align buffer 2 to 1 (containing the LSB of the 2bpp sprite) + call PrepareRTCDataAndDisableSRAM pop de - jp InterlaceMergeSpriteBuffers + jp InterlaceMergeSpriteBuffers ; 14c7 ; copies and aligns the sprite data properly inside the sprite buffer ; sprite buffers are 7*7 tiles in size, the loaded sprite is centered within this area @@ -866,8 +924,8 @@ ZeroSpriteBuffer:: ; in the resulting sprite, the rows of the two source sprites are interlaced ; de: output address InterlaceMergeSpriteBuffers:: - xor a - ld [$4000], a + ld a, $0 + call SwitchSRAMBankAndLatchClockData push de ld hl, sSpriteBuffer2 + (SPRITEBUFFERSIZE - 1) ; destination: end of buffer 2 ld de, sSpriteBuffer1 + (SPRITEBUFFERSIZE - 1) ; source 2: end of buffer 1 @@ -909,16 +967,26 @@ InterlaceMergeSpriteBuffers:: ld c, (2*SPRITEBUFFERSIZE)/16 ; $31, number of 16 byte chunks to be copied ld a, [H_LOADEDROMBANK] ld b, a - jp CopyVideoData + call CopyVideoData + jp PrepareRTCDataAndDisableSRAM +INCLUDE "home/pikachu.asm" +;INCLUDE "data/collision.asm" + +INCLUDE "home/lcdc.asm" + +IsTilePassable:: +; sets carry if tile is passable, resets carry otherwise + homecall_sf _IsTilePassable ; 1:4aaa + ret -INCLUDE "data/collision.asm" INCLUDE "home/copy2.asm" INCLUDE "home/text.asm" INCLUDE "home/vcopy.asm" INCLUDE "home/init.asm" INCLUDE "home/vblank.asm" INCLUDE "home/fade.asm" +INCLUDE "home/play_time.asm" INCLUDE "home/serial.asm" INCLUDE "home/timer.asm" INCLUDE "home/audio.asm" @@ -930,13 +998,14 @@ UpdateSprites:: ret nz ld a, [H_LOADEDROMBANK] push af - ld a, Bank(_UpdateSprites) - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a - call _UpdateSprites + switchbank _UpdateSprites + ld a, $ff + ld [wUpdateSpritesEnabled], a + call _UpdateSprites ; 1:4bb7 + ld a, $1 + ld [wUpdateSpritesEnabled], a pop af - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + call BankswitchCommon ret INCLUDE "data/mart_inventories.asm" @@ -944,7 +1013,7 @@ INCLUDE "data/mart_inventories.asm" TextScriptEndingChar:: db "@" TextScriptEnd:: - ld hl,TextScriptEndingChar + ld hl, TextScriptEndingChar ret ExclamationText:: @@ -968,7 +1037,6 @@ PokeCenterSignText:: db "@" PickUpItemText:: -; XXX better label (what does predef $5C do?) TX_ASM predef PickUpItem jp TextScriptEnd @@ -996,19 +1064,21 @@ ResetPlayerSpriteData:: ResetPlayerSpriteData_ClearSpriteData:: ld bc, $10 xor a - jp FillMemory + call FillMemory ; XXX why replaced with call + ret? + ret + ;jp FillMemory FadeOutAudio:: ld a, [wAudioFadeOutControl] and a - jr nz, .asm_28dc + jr nz, .asm_27d3 ld a, [wd72c] bit 1, a ret nz ld a, $77 ld [rNR50], a ret -.asm_28dc +.asm_27d3 ld a, [wAudioFadeOutCounter] and a jr z, .counterReachedZero @@ -1020,7 +1090,7 @@ FadeOutAudio:: ld [wAudioFadeOutCounter], a ld a, [rNR50] and a - jr z, .asm_2903 + jr z, .asm_27fa ld b, a and $f dec a @@ -1033,183 +1103,174 @@ FadeOutAudio:: or c ld [rNR50], a ret -.asm_2903 +.asm_27fa ld a, [wAudioFadeOutControl] ld b, a xor a ld [wAudioFadeOutControl], a - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic ld a, [wAudioSavedROMBank] ld [wAudioROMBank], a ld a, b ld [wNewSoundID], a jp PlaySound +UnknownText_2812:: + TX_FAR _PokemonText ; 2c:749a + db "@" + ; this function is used to display sign messages, sprite dialog, etc. ; INPUT: [hSpriteIndexOrTextID] = sprite ID or text ID DisplayTextID:: - ld a,[H_LOADEDROMBANK] + ld a, [H_LOADEDROMBANK] push af callba DisplayTextIDInit ; initialization - ld hl,wTextPredefFlag - bit 0,[hl] - res 0,[hl] - jr nz,.skipSwitchToMapBank - ld a,[wCurMap] + ld hl, wTextPredefFlag + bit 0, [hl] + res 0, [hl] + jr nz, .skipSwitchToMapBank + ld a, [wCurMap] call SwitchToMapRomBank .skipSwitchToMapBank - ld a,30 ; half a second - ld [H_FRAMECOUNTER],a ; used as joypad poll timer - ld hl,wMapTextPtr - ld a,[hli] - ld h,[hl] - ld l,a ; hl = map text pointer - ld d,$00 - ld a,[hSpriteIndexOrTextID] ; text ID - ld [wSpriteIndex],a + ld a, 30 ; half a second + ld [H_FRAMECOUNTER], a ; used as joypad poll timer + ld hl, wMapTextPtr + ld a, [hli] + ld h, [hl] + ld l, a ; hl = map text pointer + ld d, $00 + ld a, [hSpriteIndexOrTextID] ; text ID + ld [wSpriteIndex], a and a - jp z,DisplayStartMenu - cp a,TEXT_SAFARI_GAME_OVER - jp z,DisplaySafariGameOverText - cp a,TEXT_MON_FAINTED - jp z,DisplayPokemonFaintedText - cp a,TEXT_BLACKED_OUT - jp z,DisplayPlayerBlackedOutText - cp a,TEXT_REPEL_WORE_OFF - jp z,DisplayRepelWoreOffText - ld a,[wNumSprites] - ld e,a - ld a,[hSpriteIndexOrTextID] ; sprite ID + jp z, DisplayStartMenu + cp TEXT_PIKACHU_ANIM ; new yellow asm + jp z, DisplayPikachuEmotion + cp TEXT_SAFARI_GAME_OVER + jp z, DisplaySafariGameOverText + cp TEXT_MON_FAINTED + jp z, DisplayPokemonFaintedText + cp TEXT_BLACKED_OUT + jp z, DisplayPlayerBlackedOutText + cp TEXT_REPEL_WORE_OFF + jp z, DisplayRepelWoreOffText + ld a, [wNumSprites] + ld e, a + ld a, [hSpriteIndexOrTextID] ; sprite ID cp e - jr z,.spriteHandling - jr nc,.skipSpriteHandling + jr z, .spriteHandling + jr nc, .skipSpriteHandling .spriteHandling ; get the text ID of the sprite push hl - push de - push bc - callba UpdateSpriteFacingOffsetAndDelayMovement ; update the graphics of the sprite the player is talking to (to face the right direction) - pop bc - pop de - ld hl,wMapSpriteData ; NPC text entries - ld a,[hSpriteIndexOrTextID] + ;push de + ;push bc + ;callba UpdateSpriteFacingOffsetAndDelayMovement ; update the graphics of the sprite the player is talking to (to face the right direction) + ;pop bc + ;pop de + ld hl, wMapSpriteData ; NPC text entries + ld a, [hSpriteIndexOrTextID] dec a add a - add l - ld l,a - jr nc,.noCarry - inc h -.noCarry + ld e, a + ld d, $0 + add hl, de inc hl - ld a,[hl] ; a = text ID of the sprite + ld a, [hl] ; a = text ID of the sprite pop hl .skipSpriteHandling ; look up the address of the text in the map's text entries dec a - ld e,a - sla e - add hl,de - ld a,[hli] - ld h,[hl] - ld l,a ; hl = address of the text - ld a,[hl] ; a = first byte of text + ld e, a + ld d, $0 + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a ; hl = address of the text + ld a, [hl] ; a = first byte of text ; check first byte of text for special cases - cp a,$fe ; Pokemart NPC - jp z,DisplayPokemartDialogue - cp a,$ff ; Pokemon Center NPC - jp z,DisplayPokemonCenterDialogue - cp a,$fc ; Item Storage PC - jp z,FuncTX_ItemStoragePC - cp a,$fd ; Bill's PC - jp z,FuncTX_BillsPC - cp a,$f9 ; Pokemon Center PC - jp z,FuncTX_PokemonCenterPC - cp a,$f5 ; Vending Machine - jr nz,.notVendingMachine + cp $fe ; Pokemart NPC + jp z, DisplayPokemartDialogue + cp $ff ; Pokemon Center NPC + jp z, DisplayPokemonCenterDialogue + cp $fc ; Item Storage PC + jp z, FuncTX_ItemStoragePC + cp $fd ; Bill's PC + jp z, FuncTX_BillsPC + cp $f9 ; Pokemon Center PC + jp z, FuncTX_PokemonCenterPC + cp $f5 ; Vending Machine + jr nz, .notVendingMachine callba VendingMachineMenu ; jump banks to vending machine routine jr AfterDisplayingTextID .notVendingMachine - cp a,$f7 ; slot machine - jp z,FuncTX_SlotMachine - cp a,$f6 ; cable connection NPC in Pokemon Center - jr nz,.notSpecialCase + cp $f7 ; slot machine + jp z, FuncTX_GameCornerPrizeMenu + cp $f6 ; cable connection NPC in Pokemon Center + jr nz, .notSpecialCase callab CableClubNPC jr AfterDisplayingTextID .notSpecialCase call PrintText_NoCreatingTextBox ; display the text - ld a,[wDoNotWaitForButtonPressAfterDisplayingText] + ld a, [wDoNotWaitForButtonPressAfterDisplayingText] and a - jr nz,HoldTextDisplayOpen + jr nz, HoldTextDisplayOpen AfterDisplayingTextID:: - ld a,[wEnteringCableClub] + ld a, [wEnteringCableClub] and a - jr nz,HoldTextDisplayOpen + jr nz, HoldTextDisplayOpen call WaitForTextScrollButtonPress ; wait for a button press after displaying all the text ; loop to hold the dialogue box open as long as the player keeps holding down the A button HoldTextDisplayOpen:: call Joypad - ld a,[hJoyHeld] - bit 0,a ; is the A button being pressed? - jr nz,HoldTextDisplayOpen + ld a, [hJoyHeld] + bit 0, a ; is the A button being pressed? + jr nz, HoldTextDisplayOpen CloseTextDisplay:: - ld a,[wCurMap] + ld a, [wCurMap] call SwitchToMapRomBank - ld a,$90 - ld [hWY],a ; move the window off the screen + ld a, $90 + ld [hWY], a ; move the window off the screen call DelayFrame call LoadGBPal xor a - ld [H_AUTOBGTRANSFERENABLED],a ; disable continuous WRAM to VRAM transfer each V-blank + ld [H_AUTOBGTRANSFERENABLED], a ; disable continuous WRAM to VRAM transfer each V-blank ; loop to make sprites face the directions they originally faced before the dialogue - ld hl,wSpriteStateData2 + $19 - ld c,$0f - ld de,$0010 + ld hl, wSpriteStateData2 + $19 + ld c, $0f + ld de, $0010 .restoreSpriteFacingDirectionLoop - ld a,[hl] + ld a, [hl] dec h - ld [hl],a + ld [hl], a inc h - add hl,de + add hl, de dec c - jr nz,.restoreSpriteFacingDirectionLoop - ld a,BANK(InitMapSprites) - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + jr nz, .restoreSpriteFacingDirectionLoop call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns) - ld hl,wFontLoaded - res 0,[hl] - ld a,[wd732] - bit 3,a ; used fly warp - call z,LoadPlayerSpriteGraphics + ld hl, wFontLoaded + res 0, [hl] + ld a, [wd732] + bit 3, a ; used fly warp + call z, LoadPlayerSpriteGraphics call LoadCurrentMapView pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + call BankswitchCommon jp UpdateSprites DisplayPokemartDialogue:: push hl - ld hl,PokemartGreetingText + ld hl, PokemartGreetingText call PrintText pop hl inc hl call LoadItemList - ld a,PRICEDITEMLISTMENU - ld [wListMenuID],a - ld a,[H_LOADEDROMBANK] - push af - ld a,Bank(DisplayPokemartDialogue_) - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - call DisplayPokemartDialogue_ - pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + ld a, PRICEDITEMLISTMENU + ld [wListMenuID], a ; selects between subtypes of menus + homecall DisplayPokemartDialogue_ jp AfterDisplayingTextID PokemartGreetingText:: @@ -1217,38 +1278,30 @@ PokemartGreetingText:: db "@" LoadItemList:: - ld a,1 - ld [wUpdateSpritesEnabled],a - ld a,h - ld [wItemListPointer],a - ld a,l - ld [wItemListPointer + 1],a - ld de,wItemList + ld a, 1 + ld [wUpdateSpritesEnabled], a + ld a, h + ld [wItemListPointer], a + ld a, l + ld [wItemListPointer + 1], a + ld de, wItemList .loop - ld a,[hli] - ld [de],a + ld a, [hli] + ld [de], a inc de - cp a,$ff - jr nz,.loop + cp $ff + jr nz, .loop ret DisplayPokemonCenterDialogue:: ; zeroing these doesn't appear to serve any purpose xor a - ld [$ff8b],a - ld [$ff8c],a - ld [$ff8d],a + ld [$ff8b], a + ld [$ff8c], a + ld [$ff8d], a inc hl - ld a,[H_LOADEDROMBANK] - push af - ld a,Bank(DisplayPokemonCenterDialogue_) - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - call DisplayPokemonCenterDialogue_ - pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + homecall DisplayPokemonCenterDialogue_ jp AfterDisplayingTextID DisplaySafariGameOverText:: @@ -1256,7 +1309,7 @@ DisplaySafariGameOverText:: jp AfterDisplayingTextID DisplayPokemonFaintedText:: - ld hl,PokemonFaintedText + ld hl, PokemonFaintedText call PrintText jp AfterDisplayingTextID @@ -1265,11 +1318,21 @@ PokemonFaintedText:: db "@" DisplayPlayerBlackedOutText:: - ld hl,PlayerBlackedOutText + ld hl, PlayerBlackedOutText call PrintText - ld a,[wd732] - res 5,a ; reset forced to use bike bit - ld [wd732],a + ld a, [wd732] + res 5, a ; reset forced to use bike bit + ld [wd732], a + CheckEvent EVENT_IN_SAFARI_ZONE + jr z, .didnotblackoutinsafari + xor a + ld [wNumSafariBalls], a + ld [wSafariSteps], a + ld [wSafariSteps + 1], a + EventFlagAddressa EVENT_IN_SAFARI_ZONE + ld [wcf0d], a + ld [wSafariZoneEntranceCurScript], a +.didnotblackoutinsafari jp HoldTextDisplayOpen PlayerBlackedOutText:: @@ -1277,7 +1340,7 @@ PlayerBlackedOutText:: db "@" DisplayRepelWoreOffText:: - ld hl,RepelWoreOffText + ld hl, RepelWoreOffText call PrintText jp AfterDisplayingTextID @@ -1285,6 +1348,10 @@ RepelWoreOffText:: TX_FAR _RepelWoreOffText db "@" +DisplayPikachuEmotion:: + callab TalkToPikachu ; 3f:5004 + jp CloseTextDisplay + INCLUDE "engine/menu/start_menu.asm" ; function to count how many bits are set in a string of bytes @@ -1294,22 +1361,22 @@ INCLUDE "engine/menu/start_menu.asm" ; OUTPUT: ; [wNumSetBits] = number of set bits CountSetBits:: - ld c,0 + ld c, 0 .loop - ld a,[hli] - ld e,a - ld d,8 + ld a, [hli] + ld e, a + ld d, 8 .innerLoop ; count how many bits are set in the current byte srl e - ld a,0 + ld a, 0 adc c - ld c,a + ld c, a dec d - jr nz,.innerLoop + jr nz, .innerLoop dec b - jr nz,.loop - ld a,c - ld [wNumSetBits],a + jr nz, .loop + ld a, c + ld [wNumSetBits], a ret ; subtracts the amount the player paid from their money @@ -1319,16 +1386,16 @@ SubtractAmountPaidFromMoney:: ; adds the amount the player sold to their money AddAmountSoldToMoney:: - ld de,wPlayerMoney + 2 - ld hl,$ffa1 ; total price of items - ld c,3 ; length of money in bytes + ld de, wPlayerMoney + 2 + ld hl, $ffa1 ; total price of items + ld c, 3 ; length of money in bytes predef AddBCDPredef ; add total price to money - ld a,MONEY_BOX - ld [wTextBoxID],a + ld a, MONEY_BOX + ld [wTextBoxID], a call DisplayTextBoxID ; redraw money text box - ld a, SFX_PURCHASE - call PlaySoundWaitForCurrent - jp WaitForSoundToFinish + ld a, $b2 ; SFX_PURCHASE + call PlaySoundWaitForCurrent ; play sound + jp WaitForSoundToFinish ; wait until sound is done playing ; function to remove an item (in varying quantities) from the player's bag or PC box ; INPUT: @@ -1336,15 +1403,7 @@ AddAmountSoldToMoney:: ; [wWhichPokemon] = index (within the inventory) of the item to remove ; [wItemQuantity] = quantity to remove RemoveItemFromInventory:: - ld a,[H_LOADEDROMBANK] - push af - ld a,BANK(RemoveItemFromInventory_) - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - call RemoveItemFromInventory_ - pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + homecall RemoveItemFromInventory_ ret ; function to add an item (in varying quantities) to the player's bag or PC box @@ -1355,16 +1414,7 @@ RemoveItemFromInventory:: ; sets carry flag if successful, unsets carry flag if unsuccessful AddItemToInventory:: push bc - ld a,[H_LOADEDROMBANK] - push af - ld a,BANK(AddItemToInventory_) - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - call AddItemToInventory_ - pop bc - ld a,b - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + homecall_sf AddItemToInventory_ pop bc ret @@ -1373,80 +1423,80 @@ AddItemToInventory:: ; [wListPointer] = address of the list (2 bytes) DisplayListMenuID:: xor a - ld [H_AUTOBGTRANSFERENABLED],a ; disable auto-transfer - ld a,1 - ld [hJoy7],a ; joypad state update flag - ld a,[wBattleType] + ld [H_AUTOBGTRANSFERENABLED], a ; disable auto-transfer + ld a, 1 + ld [hJoy7], a ; joypad state update flag + ld a, [wBattleType] and a ; is it the Old Man battle? - jr nz,.specialBattleType - ld a,$01 ; hardcoded bank + jr nz, .specialBattleType + ld a, $01 ; hardcoded bank jr .bankswitch .specialBattleType ; Old Man battle - ld a, Bank(DisplayBattleMenu) + ld a, $f ; BANK(DisplayBattleMenu) .bankswitch call BankswitchHome - ld hl,wd730 - set 6,[hl] ; turn off letter printing delay + ld hl, wd730 + set 6, [hl] ; turn off letter printing delay xor a - ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped - ld [wListCount],a - ld a,[wListPointer] - ld l,a - ld a,[wListPointer + 1] - ld h,a ; hl = address of the list - ld a,[hl] ; the first byte is the number of entries in the list - ld [wListCount],a - ld a,LIST_MENU_BOX - ld [wTextBoxID],a + ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped + ld [wListCount], a + ld a, [wListPointer] + ld l, a + ld a, [wListPointer + 1] + ld h, a ; hl = address of the list + ld a, [hl] ; the first byte is the number of entries in the list + ld [wListCount], a + ld a, LIST_MENU_BOX + ld [wTextBoxID], a call DisplayTextBoxID ; draw the menu text box call UpdateSprites ; disable sprites behind the text box ; the code up to .skipMovingSprites appears to be useless coord hl, 4, 2 ; coordinates of upper left corner of menu text box lb de, 9, 14 ; height and width of menu text box - ld a,[wListMenuID] + ld a, [wListMenuID] and a ; is it a PC pokemon list? - jr nz,.skipMovingSprites + jr nz, .skipMovingSprites call UpdateSprites .skipMovingSprites - ld a,1 ; max menu item ID is 1 if the list has less than 2 entries - ld [wMenuWatchMovingOutOfBounds],a - ld a,[wListCount] - cp a,2 ; does the list have less than 2 entries? - jr c,.setMenuVariables - ld a,2 ; max menu item ID is 2 if the list has at least 2 entries + ld a, 1 ; max menu item ID is 1 if the list has less than 2 entries + ld [wMenuWatchMovingOutOfBounds], a + ld a, [wListCount] + cp 2 ; does the list have less than 2 entries? + jr c, .setMenuVariables + ld a, 2 ; max menu item ID is 2 if the list has at least 2 entries .setMenuVariables - ld [wMaxMenuItem],a - ld a,4 - ld [wTopMenuItemY],a - ld a,5 - ld [wTopMenuItemX],a - ld a,A_BUTTON | B_BUTTON | SELECT - ld [wMenuWatchedKeys],a - ld c,10 + ld [wMaxMenuItem], a + ld a, 4 + ld [wTopMenuItemY], a + ld a, 5 + ld [wTopMenuItemX], a + ld a, A_BUTTON | B_BUTTON | SELECT + ld [wMenuWatchedKeys], a + ld c, 10 call DelayFrames DisplayListMenuIDLoop:: xor a - ld [H_AUTOBGTRANSFERENABLED],a ; disable transfer + ld [H_AUTOBGTRANSFERENABLED], a ; disable transfer call PrintListMenuEntries - ld a,1 - ld [H_AUTOBGTRANSFERENABLED],a ; enable transfer + ld a, 1 + ld [H_AUTOBGTRANSFERENABLED], a ; enable transfer call Delay3 - ld a,[wBattleType] + ld a, [wBattleType] and a ; is it the Old Man battle? - jr z,.notOldManBattle + jr z, .notOldManBattle .oldManBattle - ld a,"▶" + ld a, "▶" Coorda 5, 4 ; place menu cursor in front of first menu entry - ld c,80 + ld c, 20 call DelayFrames xor a - ld [wCurrentMenuItem],a + ld [wCurrentMenuItem], a coord hl, 5, 4 - ld a,l - ld [wMenuCursorLocation],a - ld a,h - ld [wMenuCursorLocation + 1],a + ld a, l + ld [wMenuCursorLocation], a + ld a, h + ld [wMenuCursorLocation + 1], a jr .buttonAPressed .notOldManBattle call LoadGBPal @@ -1454,231 +1504,229 @@ DisplayListMenuIDLoop:: push af call PlaceMenuCursor pop af - bit 0,a ; was the A button pressed? - jp z,.checkOtherKeys + bit 0, a ; was the A button pressed? + jp z, .checkOtherKeys .buttonAPressed - ld a,[wCurrentMenuItem] + ld a, [wCurrentMenuItem] call PlaceUnfilledArrowMenuCursor ; pointless because both values are overwritten before they are read - ld a,$01 - ld [wMenuExitMethod],a - ld [wChosenMenuItem],a + ld a, $01 + ld [wMenuExitMethod], a + ld [wChosenMenuItem], a xor a - ld [wMenuWatchMovingOutOfBounds],a - ld a,[wCurrentMenuItem] - ld c,a - ld a,[wListScrollOffset] + ld [wMenuWatchMovingOutOfBounds], a + ld a, [wCurrentMenuItem] + ld c, a + ld a, [wListScrollOffset] add c - ld c,a - ld a,[wListCount] + ld c, a + ld a, [wListCount] and a ; is the list empty? - jp z,ExitListMenu ; if so, exit the menu + jp z, ExitListMenu ; if so, exit the menu dec a cp c ; did the player select Cancel? - jp c,ExitListMenu ; if so, exit the menu - ld a,c - ld [wWhichPokemon],a - ld a,[wListMenuID] - cp a,ITEMLISTMENU - jr nz,.skipMultiplying + jp c, ExitListMenu ; if so, exit the menu + ld a, c + ld [wWhichPokemon], a + ld a, [wListMenuID] + cp ITEMLISTMENU + jr nz, .skipMultiplying ; if it's an item menu sla c ; item entries are 2 bytes long, so multiply by 2 .skipMultiplying - ld a,[wListPointer] - ld l,a - ld a,[wListPointer + 1] - ld h,a + ld a, [wListPointer] + ld l, a + ld a, [wListPointer + 1] + ld h, a inc hl ; hl = beginning of list entries - ld b,0 - add hl,bc - ld a,[hl] - ld [wcf91],a - ld a,[wListMenuID] + ld b, 0 + add hl, bc + ld a, [hl] + ld [wcf91], a + ld a, [wListMenuID] and a ; is it a PC pokemon list? - jr z,.pokemonList + jr z, .pokemonList push hl call GetItemPrice pop hl - ld a,[wListMenuID] - cp a,ITEMLISTMENU - jr nz,.skipGettingQuantity + ld a, [wListMenuID] + cp ITEMLISTMENU + jr nz, .skipGettingQuantity ; if it's an item menu inc hl - ld a,[hl] ; a = item quantity - ld [wMaxItemQuantity],a + ld a, [hl] ; a = item quantity + ld [wMaxItemQuantity], a .skipGettingQuantity - ld a,[wcf91] - ld [wd0b5],a - ld a,BANK(ItemNames) - ld [wPredefBank],a + ld a, [wcf91] + ld [wd0b5], a + ld a, BANK(ItemNames) + ld [wPredefBank], a call GetName jr .storeChosenEntry .pokemonList - ld hl,wPartyCount - ld a,[wListPointer] + ld hl, wPartyCount + ld a, [wListPointer] cp l ; is it a list of party pokemon or box pokemon? - ld hl,wPartyMonNicks - jr z,.getPokemonName + ld hl, wPartyMonNicks + jr z, .getPokemonName ld hl, wBoxMonNicks ; box pokemon names .getPokemonName - ld a,[wWhichPokemon] + ld a, [wWhichPokemon] call GetPartyMonName .storeChosenEntry ; store the menu entry that the player chose and return - ld de,wcd6d + ld de, wcd6d call CopyStringToCF4B ; copy name to wcf4b - ld a,CHOSE_MENU_ITEM - ld [wMenuExitMethod],a - ld a,[wCurrentMenuItem] - ld [wChosenMenuItem],a + ld a, CHOSE_MENU_ITEM + ld [wMenuExitMethod], a + ld a, [wCurrentMenuItem] + ld [wChosenMenuItem], a xor a - ld [hJoy7],a ; joypad state update flag - ld hl,wd730 - res 6,[hl] ; turn on letter printing delay + ld [hJoy7], a ; joypad state update flag + ld hl, wd730 + res 6, [hl] ; turn on letter printing delay jp BankswitchBack .checkOtherKeys ; check B, SELECT, Up, and Down keys - bit 1,a ; was the B button pressed? - jp nz,ExitListMenu ; if so, exit the menu - bit 2,a ; was the select button pressed? - jp nz,HandleItemListSwapping ; if so, allow the player to swap menu entries - ld b,a - bit 7,b ; was Down pressed? - ld hl,wListScrollOffset - jr z,.upPressed + bit 1, a ; was the B button pressed? + jp nz, ExitListMenu ; if so, exit the menu + bit 2, a ; was the select button pressed? + jp nz, HandleItemListSwapping ; if so, allow the player to swap menu entries + ld b, a + bit 7, b ; was Down pressed? + ld hl, wListScrollOffset + jr z, .upPressed .downPressed - ld a,[hl] - add a,3 - ld b,a - ld a,[wListCount] + ld a, [hl] + add 3 + ld b, a + ld a, [wListCount] cp b ; will going down scroll past the Cancel button? - jp c,DisplayListMenuIDLoop + jp c, DisplayListMenuIDLoop inc [hl] ; if not, go down jp DisplayListMenuIDLoop .upPressed - ld a,[hl] + ld a, [hl] and a - jp z,DisplayListMenuIDLoop + jp z, DisplayListMenuIDLoop dec [hl] jp DisplayListMenuIDLoop DisplayChooseQuantityMenu:: ; text box dimensions/coordinates for just quantity coord hl, 15, 9 - ld b,1 ; height - ld c,3 ; width - ld a,[wListMenuID] - cp a,PRICEDITEMLISTMENU - jr nz,.drawTextBox + lb bc, 1, 3 ; height and width + ld a, [wListMenuID] + cp PRICEDITEMLISTMENU + jr nz, .drawTextBox ; text box dimensions/coordinates for quantity and price coord hl, 7, 9 - ld b,1 ; height - ld c,11 ; width + lb bc, 1, 11 ; height and width .drawTextBox call TextBoxBorder coord hl, 16, 10 - ld a,[wListMenuID] - cp a,PRICEDITEMLISTMENU - jr nz,.printInitialQuantity + ld a, [wListMenuID] + cp PRICEDITEMLISTMENU + jr nz, .printInitialQuantity coord hl, 8, 10 .printInitialQuantity - ld de,InitialQuantityText + ld de, InitialQuantityText call PlaceString xor a - ld [wItemQuantity],a ; initialize current quantity to 0 + ld [wItemQuantity], a ; initialize current quantity to 0 jp .incrementQuantity .waitForKeyPressLoop call JoypadLowSensitivity - ld a,[hJoyPressed] ; newly pressed buttons - bit 0,a ; was the A button pressed? - jp nz,.buttonAPressed - bit 1,a ; was the B button pressed? - jp nz,.buttonBPressed - bit 6,a ; was Up pressed? - jr nz,.incrementQuantity - bit 7,a ; was Down pressed? - jr nz,.decrementQuantity + ld a, [hJoyPressed] ; newly pressed buttons + bit 0, a ; was the A button pressed? + jp nz, .buttonAPressed + bit 1, a ; was the B button pressed? + jp nz, .buttonBPressed + bit 6, a ; was Up pressed? + jr nz, .incrementQuantity + bit 7, a ; was Down pressed? + jr nz, .decrementQuantity jr .waitForKeyPressLoop .incrementQuantity - ld a,[wMaxItemQuantity] + ld a, [wMaxItemQuantity] inc a - ld b,a - ld hl,wItemQuantity ; current quantity + ld b, a + ld hl, wItemQuantity ; current quantity inc [hl] - ld a,[hl] + ld a, [hl] cp b - jr nz,.handleNewQuantity + jr nz, .handleNewQuantity ; wrap to 1 if the player goes above the max quantity - ld a,1 - ld [hl],a + ld a, 1 + ld [hl], a jr .handleNewQuantity .decrementQuantity - ld hl,wItemQuantity ; current quantity + ld hl, wItemQuantity ; current quantity dec [hl] - jr nz,.handleNewQuantity + jr nz, .handleNewQuantity ; wrap to the max quantity if the player goes below 1 - ld a,[wMaxItemQuantity] - ld [hl],a + ld a, [wMaxItemQuantity] + ld [hl], a .handleNewQuantity coord hl, 17, 10 - ld a,[wListMenuID] - cp a,PRICEDITEMLISTMENU - jr nz,.printQuantity + ld a, [wListMenuID] + cp PRICEDITEMLISTMENU + jr nz, .printQuantity .printPrice - ld c,$03 - ld a,[wItemQuantity] - ld b,a - ld hl,hMoney ; total price + ld c, $03 + ld a, [wItemQuantity] + ld b, a + ld hl, hMoney ; total price ; initialize total price to 0 xor a - ld [hli],a - ld [hli],a - ld [hl],a + ld [hli], a + ld [hli], a + ld [hl], a .addLoop ; loop to multiply the individual price by the quantity to get the total price - ld de,hMoney + 2 - ld hl,hItemPrice + 2 + ld de, hMoney + 2 + ld hl, hItemPrice + 2 push bc predef AddBCDPredef ; add the individual price to the current sum pop bc dec b - jr nz,.addLoop - ld a,[hHalveItemPrices] + jr nz, .addLoop + ld a, [hHalveItemPrices] and a ; should the price be halved (for selling items)? - jr z,.skipHalvingPrice + jr z, .skipHalvingPrice xor a - ld [hDivideBCDDivisor],a - ld [hDivideBCDDivisor + 1],a - ld a,$02 - ld [hDivideBCDDivisor + 2],a + ld [hDivideBCDDivisor], a + ld [hDivideBCDDivisor + 1], a + ld a, $02 + ld [hDivideBCDDivisor + 2], a predef DivideBCDPredef3 ; halves the price ; store the halved price - ld a,[hDivideBCDQuotient] - ld [hMoney],a - ld a,[hDivideBCDQuotient + 1] - ld [hMoney + 1],a - ld a,[hDivideBCDQuotient + 2] - ld [hMoney + 2],a + ld a, [hDivideBCDQuotient] + ld [hMoney], a + ld a, [hDivideBCDQuotient + 1] + ld [hMoney + 1], a + ld a, [hDivideBCDQuotient + 2] + ld [hMoney + 2], a .skipHalvingPrice coord hl, 12, 10 - ld de,SpacesBetweenQuantityAndPriceText + ld de, SpacesBetweenQuantityAndPriceText call PlaceString - ld de,hMoney ; total price - ld c,$a3 + ld de, hMoney ; total price + ld c, $a3 call PrintBCDNumber coord hl, 9, 10 .printQuantity - ld de,wItemQuantity ; current quantity + ld de, wItemQuantity ; current quantity lb bc, LEADING_ZEROES | 1, 2 ; 1 byte, 2 digits call PrintNumber jp .waitForKeyPressLoop .buttonAPressed ; the player chose to make the transaction xor a - ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped + ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped ret .buttonBPressed ; the player chose to cancel the transaction xor a - ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped - ld a,$ff + ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped + ld a, $ff ret InitialQuantityText:: @@ -1688,84 +1736,83 @@ SpacesBetweenQuantityAndPriceText:: db " @" ExitListMenu:: - ld a,[wCurrentMenuItem] - ld [wChosenMenuItem],a - ld a,CANCELLED_MENU - ld [wMenuExitMethod],a - ld [wMenuWatchMovingOutOfBounds],a + ld a, [wCurrentMenuItem] + ld [wChosenMenuItem], a + ld a, CANCELLED_MENU + ld [wMenuExitMethod], a + ld [wMenuWatchMovingOutOfBounds], a xor a - ld [hJoy7],a - ld hl,wd730 - res 6,[hl] + ld [hJoy7], a + ld hl, wd730 + res 6, [hl] call BankswitchBack xor a - ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped + ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped scf ret PrintListMenuEntries:: coord hl, 5, 3 - ld b,9 - ld c,14 + lb bc, 9, 14 call ClearScreenArea - ld a,[wListPointer] - ld e,a - ld a,[wListPointer + 1] - ld d,a + ld a, [wListPointer] + ld e, a + ld a, [wListPointer + 1] + ld d, a inc de ; de = beginning of list entries - ld a,[wListScrollOffset] - ld c,a - ld a,[wListMenuID] - cp a,ITEMLISTMENU - ld a,c - jr nz,.skipMultiplying + ld a, [wListScrollOffset] + ld c, a + ld a, [wListMenuID] + cp ITEMLISTMENU + ld a, c + jr nz, .skipMultiplying ; if it's an item menu ; item entries are 2 bytes long, so multiply by 2 - sla a + add a sla c .skipMultiplying add e - ld e,a - jr nc,.noCarry + ld e, a + jr nc, .noCarry inc d .noCarry coord hl, 6, 4 ; coordinates of first list entry name - ld b,4 ; print 4 names + ld b, 4 ; print 4 names .loop - ld a,b - ld [wWhichPokemon],a - ld a,[de] - ld [wd11e],a - cp a,$ff - jp z,.printCancelMenuItem + ld a, b + ld [wWhichPokemon], a + ld a, [de] + ld [wd11e], a + cp $ff + jp z, .printCancelMenuItem push bc push de push hl push hl push de - ld a,[wListMenuID] + ld a, [wListMenuID] and a - jr z,.pokemonPCMenu - cp a,$01 - jr z,.movesMenu + jr z, .pokemonPCMenu + cp $01 + jr z, .movesMenu .itemMenu call GetItemName jr .placeNameString .pokemonPCMenu push hl - ld hl,wPartyCount - ld a,[wListPointer] + ld hl, wPartyCount + ld a, [wListPointer] cp l ; is it a list of party pokemon or box pokemon? - ld hl,wPartyMonNicks - jr z,.getPokemonName + ld hl, wPartyMonNicks + jr z, .getPokemonName ld hl, wBoxMonNicks ; box pokemon names .getPokemonName - ld a,[wWhichPokemon] - ld b,a - ld a,4 + ld a, [wWhichPokemon] + ld b, a + ld a, 4 sub b - ld b,a - ld a,[wListScrollOffset] + ld b, a + ld a, [wListScrollOffset] add b call GetPartyMonName pop hl @@ -1776,90 +1823,90 @@ PrintListMenuEntries:: call PlaceString pop de pop hl - ld a,[wPrintItemPrices] + ld a, [wPrintItemPrices] and a ; should prices be printed? - jr z,.skipPrintingItemPrice + jr z, .skipPrintingItemPrice .printItemPrice push hl - ld a,[de] - ld de,ItemPrices - ld [wcf91],a + ld a, [de] + ld de, ItemPrices + ld [wcf91], a call GetItemPrice ; get price pop hl ld bc, SCREEN_WIDTH + 5 ; 1 row down and 5 columns right - add hl,bc - ld c,$a3 ; no leading zeroes, right-aligned, print currency symbol, 3 bytes + add hl, bc + ld c, $a3 ; no leading zeroes, right-aligned, print currency symbol, 3 bytes call PrintBCDNumber .skipPrintingItemPrice - ld a,[wListMenuID] + ld a, [wListMenuID] and a - jr nz,.skipPrintingPokemonLevel + jr nz, .skipPrintingPokemonLevel .printPokemonLevel - ld a,[wd11e] + ld a, [wd11e] push af push hl - ld hl,wPartyCount - ld a,[wListPointer] + ld hl, wPartyCount + ld a, [wListPointer] cp l ; is it a list of party pokemon or box pokemon? - ld a,PLAYER_PARTY_DATA - jr z,.next - ld a,BOX_DATA + ld a, PLAYER_PARTY_DATA + jr z, .next + ld a, BOX_DATA .next - ld [wMonDataLocation],a - ld hl,wWhichPokemon - ld a,[hl] - ld b,a - ld a,$04 + ld [wMonDataLocation], a + ld hl, wWhichPokemon + ld a, [hl] + ld b, a + ld a, $04 sub b - ld b,a - ld a,[wListScrollOffset] + ld b, a + ld a, [wListScrollOffset] add b - ld [hl],a + ld [hl], a call LoadMonData - ld a,[wMonDataLocation] + ld a, [wMonDataLocation] and a ; is it a list of party pokemon or box pokemon? - jr z,.skipCopyingLevel + jr z, .skipCopyingLevel .copyLevel - ld a,[wLoadedMonBoxLevel] - ld [wLoadedMonLevel],a + ld a, [wLoadedMonBoxLevel] + ld [wLoadedMonLevel], a .skipCopyingLevel pop hl - ld bc,$001c - add hl,bc + ld bc, $001c + add hl, bc call PrintLevel pop af - ld [wd11e],a + ld [wd11e], a .skipPrintingPokemonLevel pop hl pop de inc de - ld a,[wListMenuID] - cp a,ITEMLISTMENU - jr nz,.nextListEntry + ld a, [wListMenuID] + cp ITEMLISTMENU + jr nz, .nextListEntry .printItemQuantity - ld a,[wd11e] - ld [wcf91],a + ld a, [wd11e] + ld [wcf91], a call IsKeyItem ; check if item is unsellable - ld a,[wIsKeyItem] + ld a, [wIsKeyItem] and a ; is the item unsellable? - jr nz,.skipPrintingItemQuantity ; if so, don't print the quantity + jr nz, .skipPrintingItemQuantity ; if so, don't print the quantity push hl ld bc, SCREEN_WIDTH + 8 ; 1 row down and 8 columns right - add hl,bc - ld a,"×" - ld [hli],a - ld a,[wd11e] + add hl, bc + ld a, "×" + ld [hli], a + ld a, [wd11e] push af - ld a,[de] - ld [wMaxItemQuantity],a + ld a, [de] + ld [wMaxItemQuantity], a push de - ld de,wd11e - ld [de],a + ld de, wd11e + ld [de], a lb bc, 1, 2 call PrintNumber pop de pop af - ld [wd11e],a + ld [wd11e], a pop hl .skipPrintingItemQuantity inc de @@ -1867,29 +1914,29 @@ PrintListMenuEntries:: inc c push bc inc c - ld a,[wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) + ld a, [wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) and a ; is an item being swapped? - jr z,.nextListEntry - sla a + jr z, .nextListEntry + add a cp c ; is it this item? - jr nz,.nextListEntry + jr nz, .nextListEntry dec hl - ld a,$ec ; unfilled right arrow menu cursor to indicate an item being swapped - ld [hli],a + ld a, $ec ; unfilled right arrow menu cursor to indicate an item being swapped + ld [hli], a .nextListEntry - ld bc,2 * SCREEN_WIDTH ; 2 rows - add hl,bc + ld bc, 2 * SCREEN_WIDTH ; 2 rows + add hl, bc pop bc inc c dec b - jp nz,.loop - ld bc,-8 - add hl,bc - ld a,$ee ; down arrow - ld [hl],a + jp nz, .loop + ld bc, -8 + add hl, bc + ld a, $ee ; down arrow + ld [hl], a ret .printCancelMenuItem - ld de,ListMenuCancelText + ld de, ListMenuCancelText jp PlaceString ListMenuCancelText:: @@ -1897,27 +1944,27 @@ ListMenuCancelText:: GetMonName:: push hl - ld a,[H_LOADEDROMBANK] + ld a, [H_LOADEDROMBANK] push af - ld a,BANK(MonsterNames) - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - ld a,[wd11e] + ld a, BANK(MonsterNames) ; 3a + ld [H_LOADEDROMBANK], a + ld [MBC1RomBank], a + ld a, [wd11e] dec a - ld hl,MonsterNames - ld c,10 - ld b,0 + ld hl, MonsterNames ; 4000 + ld c, 10 + ld b, 0 call AddNTimes - ld de,wcd6d + ld de, wcd6d push de - ld bc,10 + ld bc, 10 call CopyData - ld hl,wcd6d + 10 + ld hl, wcd6d + 10 ld [hl], "@" pop de pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + ld [H_LOADEDROMBANK], a + ld [MBC1RomBank], a pop hl ret @@ -1926,22 +1973,22 @@ GetItemName:: ; starting at wcd6d push hl push bc - ld a,[wd11e] + ld a, [wd11e] cp HM_01 ; is this a TM/HM? - jr nc,.Machine + jr nc, .Machine - ld [wd0b5],a - ld a,ITEM_NAME - ld [wNameListType],a - ld a,BANK(ItemNames) - ld [wPredefBank],a + ld [wd0b5], a + ld a, ITEM_NAME + ld [wNameListType], a + ld a, BANK(ItemNames) + ld [wPredefBank], a call GetName jr .Finish .Machine call GetMachineName .Finish - ld de,wcd6d ; pointer to where item name is stored in RAM + ld de, wcd6d ; pointer to where item name is stored in RAM pop bc pop hl ret @@ -1951,49 +1998,48 @@ GetMachineName:: push hl push de push bc - ld a,[wd11e] + ld a, [wd11e] push af cp TM_01 ; is this a TM? [not HM] - jr nc,.WriteTM + jr nc, .WriteTM ; if HM, then write "HM" and add 5 to the item ID, so we can reuse the ; TM printing code add 5 - ld [wd11e],a - ld hl,HiddenPrefix ; points to "HM" - ld bc,2 + ld [wd11e], a + ld hl, HiddenPrefix ; points to "HM" + ld bc, 2 jr .WriteMachinePrefix .WriteTM - ld hl,TechnicalPrefix ; points to "TM" - ld bc,2 + ld hl, TechnicalPrefix ; points to "TM" + ld bc, 2 .WriteMachinePrefix - ld de,wcd6d + ld de, wcd6d call CopyData ; now get the machine number and convert it to text - ld a,[wd11e] + ld a, [wd11e] sub TM_01 - 1 ld b, "0" .FirstDigit sub 10 - jr c,.SecondDigit + jr c, .SecondDigit inc b jr .FirstDigit .SecondDigit add 10 push af - ld a,b - ld [de],a + ld a, b + ld [de], a inc de pop af ld b, "0" add b - ld [de],a + ld [de], a inc de - ld a,"@" - ld [de],a - + ld a, "@" + ld [de], a pop af - ld [wd11e],a + ld [wd11e], a pop bc pop de pop hl @@ -2007,9 +2053,9 @@ HiddenPrefix:: ; sets carry if item is HM, clears carry if item is not HM ; Input: a = item ID IsItemHM:: - cp a,HM_01 - jr c,.notHM - cp a,TM_01 + cp HM_01 + jr c, .notHM + cp TM_01 ret .notHM and a @@ -2018,32 +2064,32 @@ IsItemHM:: ; sets carry if move is an HM, clears carry if move is not an HM ; Input: a = move ID IsMoveHM:: - ld hl,HMMoves - ld de,1 + ld hl, HMMoves + ld de, 1 jp IsInArray HMMoves:: - db CUT,FLY,SURF,STRENGTH,FLASH + db CUT, FLY, SURF, STRENGTH, FLASH db $ff ; terminator GetMoveName:: push hl - ld a,MOVE_NAME - ld [wNameListType],a - ld a,[wd11e] - ld [wd0b5],a - ld a,BANK(MoveNames) - ld [wPredefBank],a + ld a, MOVE_NAME + ld [wNameListType], a + ld a, [wd11e] + ld [wd0b5], a + ld a, BANK(MoveNames) + ld [wPredefBank], a call GetName - ld de,wcd6d ; pointer to where move name is stored in RAM + ld de, wcd6d ; pointer to where move name is stored in RAM pop hl ret ; reloads text box tile patterns, current map view, and tileset tile patterns ReloadMapData:: - ld a,[H_LOADEDROMBANK] + ld a, [H_LOADEDROMBANK] push af - ld a,[wCurMap] + ld a, [wCurMap] call SwitchToMapRomBank call DisableLCD call LoadTextBoxTilePatterns @@ -2051,34 +2097,60 @@ ReloadMapData:: call LoadTilesetTilePatternData call EnableLCD pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + call BankswitchCommon ret ; reloads tileset tile patterns ReloadTilesetTilePatterns:: - ld a,[H_LOADEDROMBANK] + ld a, [H_LOADEDROMBANK] push af - ld a,[wCurMap] + ld a, [wCurMap] call SwitchToMapRomBank call DisableLCD call LoadTilesetTilePatternData call EnableLCD pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + call BankswitchCommon ret ; shows the town map and lets the player choose a destination to fly to ChooseFlyDestination:: - ld hl,wd72e - res 4,[hl] + ld hl, wd72e + res 4, [hl] jpba LoadTownMap_Fly +PrinterSerial:: + homecall PrinterSerial_ + ret + +SerialFunction:: + ld a, [wPrinterConnectionOpen] + bit 0, a + ret z + ld a, [wPrinterOpcode] + and a + ret nz + ld hl, wOverworldMap + 650 + inc [hl] + ld a, [hl] + cp $6 + ret c + xor a + ld [hl], a + ld a, $0c + ld [wPrinterOpcode], a + ld a, $88 + ld [rSB], a + ld a, $1 + ld [rSC], a + ld a, START_TRANSFER_INTERNAL_CLOCK + ld [rSC], a + ret + ; causes the text box to close without waiting for a button press after displaying text DisableWaitingAfterTextDisplay:: - ld a,$01 - ld [wDoNotWaitForButtonPressAfterDisplayingText],a + ld a, $01 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a ret ; uses an item @@ -2102,16 +2174,16 @@ UseItem:: ; OUTPUT: ; clears carry flag if the item is tossed, sets carry flag if not TossItem:: - ld a,[H_LOADEDROMBANK] + ld a, [H_LOADEDROMBANK] push af - ld a,BANK(TossItem_) - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + ld a, BANK(TossItem_) + ld [H_LOADEDROMBANK], a + ld [MBC1RomBank], a call TossItem_ pop de - ld a,d - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + ld a, d + ld [H_LOADEDROMBANK], a + ld [MBC1RomBank], a ret ; checks if an item is a key item @@ -2134,18 +2206,90 @@ IsKeyItem:: ; function to draw various text boxes ; INPUT: ; [wTextBoxID] = text box ID -; b, c = y, x cursor position (TWO_OPTION_MENU only) DisplayTextBoxID:: - ld a,[H_LOADEDROMBANK] + homecall_sf DisplayTextBoxID_ + ret + +UpdateGBCPal_BGP:: + push af + ld a, [hGBC] + and a + jr z, .notGBC + push bc + push de + push hl + ld a, [rBGP] + ld b, a + ld a, [wLastBGP] + cp b + jr z, .noChangeInBGP + callba _UpdateGBCPal_BGP +.noChangeInBGP + pop hl + pop de + pop bc +.notGBC + pop af + ret + +UpdateGBCPal_OBP0:: + push af + ld a, [hGBC] + and a + jr z, .notGBC + push bc + push de + push hl + ld a, [rOBP0] + ld b, a + ld a, [wLastOBP0] + cp b + jr z, .noChangeInOBP0 + ld b, BANK(_UpdateGBCPal_OBP) + ld hl, _UpdateGBCPal_OBP + ld c, CONVERT_OBP0 + call Bankswitch +.noChangeInOBP0 + pop hl + pop de + pop bc +.notGBC + pop af + ret + +UpdateGBCPal_OBP1:: push af - ld a,BANK(DisplayTextBoxID_) - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - call DisplayTextBoxID_ + ld a, [hGBC] + and a + jr z, .notGBC + push bc + push de + push hl + ld a, [rOBP1] + ld b, a + ld a, [wLastOBP1] + cp b + jr z, .noChangeInOBP1 + ld b, BANK(_UpdateGBCPal_OBP) + ld hl, _UpdateGBCPal_OBP + ld c, CONVERT_OBP1 + call Bankswitch +.noChangeInOBP1 + pop hl + pop de pop bc - ld a,b - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a +.notGBC + pop af + ret + +Func_3082:: + ld a, [H_LOADEDROMBANK] + push af + call FadeOutAudio + callbs Music_DoLowHealthAlarm + callbs Audio1_UpdateMusic + pop af + call BankswitchCommon ret ; not zero if an NPC movement script is running, the player character is @@ -2181,14 +2325,13 @@ RunNPCMovementScript:: ld a, [H_LOADEDROMBANK] push af ld a, [wNPCMovementScriptBank] - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + call BankswitchCommon ld a, [wNPCMovementScriptFunctionNum] - call CallFunctionInTable + call JumpTable pop af - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + call BankswitchCommon ret + .NPCMovementScriptPointerTables dw PalletMovementScriptPointerTable dw PewterMuseumGuyMovementScriptPointerTable @@ -2207,7 +2350,7 @@ StoreTrainerHeaderPointer:: ld a, h ld [wTrainerHeaderPtr], a ld a, l - ld [wTrainerHeaderPtr+1], a + ld [wTrainerHeaderPtr + 1], a ret ; executes the current map script from the function pointer array provided in hl. @@ -2227,7 +2370,7 @@ ExecuteCurMapScriptInTable:: .useProvidedIndex pop hl ld [wCurMapScript], a - call CallFunctionInTable + call JumpTable ld a, [wCurMapScript] ret @@ -2581,17 +2724,6 @@ TrainerEndBattleText:: call TextCommandProcessor jp TextScriptEnd -; only engage withe trainer if the player is not already -; engaged with another trainer -; XXX unused? -CheckIfAlreadyEngaged:: - ld a, [wFlags_0xcd60] - bit 0, a - ret nz - call EngageMapTrainer - xor a - ret - PlayTrainerMusic:: ld a, [wEngagedTrainerClass] cp OPP_SONY1 @@ -2605,8 +2737,7 @@ PlayTrainerMusic:: ret nz xor a ld [wAudioFadeOutControl], a - ld a, $ff - call PlaySound + call StopAllMusic ; stop music ld a, BANK(Music_MeetEvilTrainer) ld [wAudioROMBank], a ld [wAudioSavedROMBank], a @@ -2679,11 +2810,11 @@ FuncTX_BillsPC:: ld hl, BillsPC_ jr bankswitchAndContinue -FuncTX_SlotMachine:: +FuncTX_GameCornerPrizeMenu:: ; XXX find a better name for this function ; special_F7 - ld b,BANK(CeladonPrizeMenu) - ld hl,CeladonPrizeMenu + ld b, BANK(CeladonPrizeMenu) + ld hl, CeladonPrizeMenu bankswitchAndContinue:: call Bankswitch jp HoldTextDisplayOpen ; continue to main text-engine function @@ -2707,10 +2838,64 @@ IsItemInBag:: ; else reset zero flag ; related to Pokémon Tower and ghosts predef GetQuantityOfItemInBag - ld a,b + ld a, b and a ret +IsSurfingPikachuInParty:: +; set bit 6 of wd472 if true +; also calls Func_3467, which is a bankswitch to IsStarterPikachuInOurParty + ld a, [wd472] + and $3f + ld [wd472], a + ld hl, wPartyMon1 + ld c, PARTY_LENGTH + ld b, SURF +.loop + ld a, [hl] + cp PIKACHU + jr nz, .notPikachu + push hl + ld de, $8 + add hl, de + ld a, [hli] + cp b ; does pikachu have surf as one of its moves + jr z, .hasSurf + ld a, [hli] + cp b + jr z, .hasSurf + ld a, [hli] + cp b + jr z, .hasSurf + ld a, [hli] + cp b + jr nz, .noSurf +.hasSurf + ld a, [wd472] + set 6, a + ld [wd472], a +.noSurf + pop hl +.notPikachu + ld de, wPartyMon2 - wPartyMon1 + add hl, de + dec c + jr nz, .loop + call Func_3467 + ret + +Func_3467:: + push hl + push bc + callab IsStarterPikachuInOurParty + pop bc + pop hl + ret nc + ld a, [wd472] + set 7, a + ld [wd472], a + ret + DisplayPokedex:: ld [wd11e], a jpba _DisplayPokedex @@ -2734,6 +2919,26 @@ SetSpriteImageIndexAfterSettingFacingDirection:: ld [hl], a ret +SpriteFunc_34a1:: + ld a, [H_SPRITEINDEX] + swap a + add $e + ld l, a + ld h, $c2 + ld c, [hl] + dec c + swap c + ld a, [$ff8d] + add c + ld c, a + ld a, [$ff8c] + swap a + add $2 + ld l, a + dec h + ld [hl], c + ret + ; tests if the player's coordinates are in a specified array ; INPUT: ; hl = address of array @@ -2741,32 +2946,32 @@ SetSpriteImageIndexAfterSettingFacingDirection:: ; [wCoordIndex] = if there is match, the matching array index ; sets carry if the coordinates are in the array, clears carry if not ArePlayerCoordsInArray:: - ld a,[wYCoord] - ld b,a - ld a,[wXCoord] - ld c,a + ld a, [wYCoord] + ld b, a + ld a, [wXCoord] + ld c, a ; fallthrough CheckCoords:: xor a - ld [wCoordIndex],a + ld [wCoordIndex], a .loop - ld a,[hli] - cp a,$ff ; reached terminator? - jr z,.notInArray + ld a, [hli] + cp $ff ; reached terminator? + jr z, .notInArray push hl - ld hl,wCoordIndex + ld hl, wCoordIndex inc [hl] pop hl .compareYCoord cp b - jr z,.compareXCoord + jr z, .compareXCoord inc hl jr .loop .compareXCoord - ld a,[hli] + ld a, [hli] cp c - jr nz,.loop + jr nz, .loop .inArray scf ret @@ -2860,31 +3065,31 @@ SetSpriteMovementBytesToFE:: SetSpriteMovementBytesToFF:: push hl call GetSpriteMovementByte1Pointer - ld [hl],$FF + ld [hl], $FF call GetSpriteMovementByte2Pointer - ld [hl],$FF ; prevent person from walking? + ld [hl], $FF ; prevent person from walking? pop hl ret ; returns the sprite movement byte 1 pointer for sprite [H_SPRITEINDEX] in hl GetSpriteMovementByte1Pointer:: - ld h,$C2 - ld a,[H_SPRITEINDEX] + ld h, $C2 + ld a, [H_SPRITEINDEX] swap a - add a,6 - ld l,a + add 6 + ld l, a ret ; returns the sprite movement byte 2 pointer for sprite [H_SPRITEINDEX] in hl GetSpriteMovementByte2Pointer:: push de - ld hl,wMapSpriteData - ld a,[H_SPRITEINDEX] + ld hl, wMapSpriteData + ld a, [H_SPRITEINDEX] dec a add a - ld d,0 - ld e,a - add hl,de + ld e, a + ld d, 0 + add hl, de pop de ret @@ -2893,7 +3098,7 @@ GetTrainerInformation:: ld a, [wLinkState] and a jr nz, .linkBattle - ld a, Bank(TrainerPicAndMoneyPointers) + ld a, BANK(TrainerPicAndMoneyPointers) call BankswitchHome ld a, [wTrainerClass] dec a @@ -2912,6 +3117,7 @@ GetTrainerInformation:: inc de ld a, [hli] ld [de], a + call IsFightingJessieJames jp BankswitchBack .linkBattle ld hl, wTrainerPicPointer @@ -2921,10 +3127,27 @@ GetTrainerInformation:: ld [hl], d ret +IsFightingJessieJames:: + ld a, [wTrainerClass] + cp ROCKET + ret nz + ld a, [wTrainerNo] + cp $2a + ret c + ld de, JessieJamesPic + cp $2e + jr c, .dummy + ld de, JessieJamesPic ; possibly meant to add another pic +.dummy + ld hl, wTrainerPicPointer + ld a, e + ld [hli], a + ld [hl], d + ret + GetTrainerName:: jpba GetTrainerName_ - HasEnoughMoney:: ; Check if the player has at least as much ; money as the 3-byte BCD value at hMoney. @@ -2945,37 +3168,17 @@ HasEnoughCoins:: BankswitchHome:: ; switches to bank # in a ; Only use this when in the home bank! - ld [wBankswitchHomeTemp],a - ld a,[H_LOADEDROMBANK] - ld [wBankswitchHomeSavedROMBank],a - ld a,[wBankswitchHomeTemp] - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + ld [wBankswitchHomeTemp], a + ld a, [H_LOADEDROMBANK] + ld [wBankswitchHomeSavedROMBank], a + ld a, [wBankswitchHomeTemp] + call BankswitchCommon ret BankswitchBack:: ; returns from BankswitchHome - ld a,[wBankswitchHomeSavedROMBank] - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - ret - -Bankswitch:: -; self-contained bankswitch, use this when not in the home bank -; switches to the bank in b - ld a,[H_LOADEDROMBANK] - push af - ld a,b - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - ld bc,.Return - push bc - jp [hl] -.Return - pop bc - ld a,b - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + ld a, [wBankswitchHomeSavedROMBank] + call BankswitchCommon ret ; displays yes/no choice @@ -2985,7 +3188,7 @@ YesNoChoice:: call InitYesNoTextBoxParameters jr DisplayYesNoChoice -Func_35f4:: +Func_35f7:: ld a, TWO_OPTION_MENU ld [wTextBoxID], a call InitYesNoTextBoxParameters @@ -3006,7 +3209,7 @@ YesNoChoicePokeCenter:: lb bc, 8, 12 jr DisplayYesNoChoice -Func_361a:: +Func_361d:: call SaveScreenTilesToBuffer1 ld a, WIDE_YES_NO_MENU ld [wTwoOptionMenuID], a @@ -3036,37 +3239,37 @@ MoveSprite_:: push bc call GetSpriteMovementByte1Pointer xor a - ld [hl],a - ld hl,wNPCMovementDirections - ld c,0 + ld [hl], a + ld hl, wNPCMovementDirections + ld c, 0 .loop - ld a,[de] - ld [hli],a + ld a, [de] + ld [hli], a inc de inc c - cp a,$FF ; have we reached the end of the movement data? - jr nz,.loop + cp $FF ; have we reached the end of the movement data? + jr nz, .loop - ld a,c - ld [wNPCNumScriptedSteps],a ; number of steps taken + ld a, c + ld [wNPCNumScriptedSteps], a ; number of steps taken pop bc - ld hl,wd730 - set 0,[hl] + ld hl, wd730 + set 0, [hl] pop hl xor a - ld [wOverrideSimulatedJoypadStatesMask],a - ld [wSimulatedJoypadStatesEnd],a + ld [wOverrideSimulatedJoypadStatesMask], a + ld [wSimulatedJoypadStatesEnd], a dec a - ld [wJoyIgnore],a - ld [wWastedByteCD3A],a + ld [wJoyIgnore], a + ld [wWastedByteCD3A], a ret ; divides [hDividend2] by [hDivisor2] and stores the quotient in [hQuotient2] DivideBytes:: push hl - ld hl, $ffe7 + ld hl, hQuotient2 xor a ld [hld], a ld a, [hld] @@ -3110,7 +3313,7 @@ LoadTextBoxTilePatterns:: ld de, vChars2 + $600 ld bc, TextBoxGraphicsEnd - TextBoxGraphics ld a, BANK(TextBoxGraphics) - jp FarCopyData2 ; if LCD is off, transfer all at once + jp FarCopyData ; if LCD is off, transfer all at once .on ld de, TextBoxGraphics ld hl, vChars2 + $600 @@ -3126,29 +3329,13 @@ LoadHpBarAndStatusTilePatterns:: ld de, vChars2 + $620 ld bc, HpBarAndStatusGraphicsEnd - HpBarAndStatusGraphics ld a, BANK(HpBarAndStatusGraphics) - jp FarCopyData2 ; if LCD is off, transfer all at once + jp FarCopyData ; if LCD is off, transfer all at once .on ld de, HpBarAndStatusGraphics ld hl, vChars2 + $620 lb bc, BANK(HpBarAndStatusGraphics), (HpBarAndStatusGraphicsEnd - HpBarAndStatusGraphics) / $10 jp CopyVideoData ; if LCD is on, transfer during V-blank - -FillMemory:: -; Fill bc bytes at hl with a. - push de - ld d, a -.loop - ld a, d - ld [hli], a - dec bc - ld a, b - or c - jr nz, .loop - pop de - ret - - UncompressSpriteFromDE:: ; Decompress pic at a:de. ld hl, wSpriteInputPtr @@ -3157,17 +3344,15 @@ UncompressSpriteFromDE:: ld [hl], d jp UncompressSpriteData - SaveScreenTilesToBuffer2:: coord hl, 0, 0 ld de, wTileMapBackup2 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT - call CopyData - ret + jp CopyData LoadScreenTilesFromBuffer2:: call LoadScreenTilesFromBuffer2DisableBGTransfer - ld a, 1 + ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a ret @@ -3178,8 +3363,7 @@ LoadScreenTilesFromBuffer2DisableBGTransfer:: ld hl, wTileMapBackup2 coord de, 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT - call CopyData - ret + jp CopyData SaveScreenTilesToBuffer1:: coord hl, 0, 0 @@ -3194,15 +3378,15 @@ LoadScreenTilesFromBuffer1:: coord de, 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call CopyData - ld a, 1 + ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a ret DelayFrames:: -; wait n frames, where n is the value in c +; wait c frames call DelayFrame dec c - jr nz,DelayFrames + jr nz, DelayFrames ret PlaySoundWaitForCurrent:: @@ -3226,6 +3410,7 @@ WaitForSoundToFinish:: inc hl inc hl or [hl] + and a jr nz, .waitLoop pop hl ret @@ -3246,82 +3431,80 @@ GetName:: ; [wPredefBank] = bank of list ; ; returns pointer to name in de - ld a,[wd0b5] - ld [wd11e],a + ld a, [wd0b5] + ld [wd11e], a ; TM names are separate from item names. ; BUG: This applies to all names instead of just items. cp HM_01 jp nc, GetMachineName - ld a,[H_LOADEDROMBANK] + ld a, [H_LOADEDROMBANK] push af push hl push bc push de - ld a,[wNameListType] ;List3759_entrySelector + ld a, [wNameListType] ;List3759_entrySelector dec a - jr nz,.otherEntries + jr nz, .otherEntries ;1 = MON_NAMES call GetMonName - ld hl,NAME_LENGTH - add hl,de - ld e,l - ld d,h + ld hl, NAME_LENGTH + add hl, de + ld e, l + ld d, h jr .gotPtr .otherEntries ;2-7 = OTHER ENTRIES - ld a,[wPredefBank] - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - ld a,[wNameListType] ;VariousNames' entryID + ld a, [wPredefBank] + call BankswitchCommon + ld a, [wNameListType] ;VariousNames' entryID dec a add a - ld d,0 - ld e,a - jr nc,.skip + ld d, 0 + ld e, a + jr nc, .skip inc d .skip - ld hl,NamePointers - add hl,de - ld a,[hli] - ld [$ff96],a - ld a,[hl] - ld [$ff95],a - ld a,[$ff95] - ld h,a - ld a,[$ff96] - ld l,a - ld a,[wd0b5] - ld b,a - ld c,0 + ld hl, NamePointers + add hl, de + ld a, [hli] + ld [$ff96], a + ld a, [hl] + ld [$ff95], a + ld a, [$ff95] + ld h, a + ld a, [$ff96] + ld l, a + ld a, [wd0b5] + ld b, a + ld c, 0 .nextName - ld d,h - ld e,l + ld d, h + ld e, l .nextChar - ld a,[hli] - cp a, "@" - jr nz,.nextChar + ld a, [hli] + cp "@" + jr nz, .nextChar inc c ;entry counter - ld a,b ;wanted entry + ld a, b ;wanted entry cp c - jr nz,.nextName - ld h,d - ld l,e - ld de,wcd6d - ld bc,$0014 + jr nz, .nextName + ld h, d + ld l, e + ld de, wcd6d + ld bc, $0014 call CopyData .gotPtr - ld a,e - ld [wUnusedCF8D],a - ld a,d - ld [wUnusedCF8D + 1],a + ld a, e + ld [wUnusedCF8D], a + ld a, d + ld [wUnusedCF8D + 1], a pop de pop bc pop hl pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + call BankswitchCommon ret GetItemPrice:: @@ -3332,11 +3515,10 @@ GetItemPrice:: ld a, [wListMenuID] cp MOVESLISTMENU ld a, BANK(ItemPrices) - jr nz, .asm_37ed + jr nz, .asm_37e0 ld a, $f ; hardcoded Bank -.asm_37ed - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a +.asm_37e0 + call BankswitchCommon ld hl, wItemPrices ld a, [hli] ld h, [hl] @@ -3345,10 +3527,10 @@ GetItemPrice:: cp HM_01 jr nc, .getTMPrice ld bc, $3 -.asm_3802 +.asm_37f3 add hl, bc dec a - jr nz, .asm_3802 + jr nz, .asm_37f3 dec hl ld a, [hld] ld [hItemPrice + 2], a @@ -3356,17 +3538,13 @@ GetItemPrice:: ld [hItemPrice + 1], a ld a, [hl] ld [hItemPrice], a - jr .asm_381c + jr .asm_380b .getTMPrice - ld a, Bank(GetMachinePrice) - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a - call GetMachinePrice -.asm_381c + callbs GetMachinePrice +.asm_380b ld de, hItemPrice pop af - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + call BankswitchCommon ret ; copies a string from [de] to [wcf4b] @@ -3400,41 +3578,41 @@ CopyString:: ; ([hJoy7] == 1, [hJoy6] == 0) JoypadLowSensitivity:: call Joypad - ld a,[hJoy7] ; flag + ld a, [hJoy7] ; flag and a ; get all currently pressed buttons or only newly pressed buttons? - ld a,[hJoyPressed] ; newly pressed buttons - jr z,.storeButtonState - ld a,[hJoyHeld] ; all currently pressed buttons + ld a, [hJoyPressed] ; newly pressed buttons + jr z, .storeButtonState + ld a, [hJoyHeld] ; all currently pressed buttons .storeButtonState - ld [hJoy5],a - ld a,[hJoyPressed] ; newly pressed buttons + ld [hJoy5], a + ld a, [hJoyPressed] ; newly pressed buttons and a ; have any buttons been newly pressed since last check? - jr z,.noNewlyPressedButtons + jr z, .noNewlyPressedButtons .newlyPressedButtons - ld a,30 ; half a second delay - ld [H_FRAMECOUNTER],a + ld a, 30 ; half a second delay + ld [H_FRAMECOUNTER], a ret .noNewlyPressedButtons - ld a,[H_FRAMECOUNTER] + ld a, [H_FRAMECOUNTER] and a ; is the delay over? - jr z,.delayOver + jr z, .delayOver .delayNotOver xor a - ld [hJoy5],a ; report no buttons as pressed + ld [hJoy5], a ; report no buttons as pressed ret .delayOver ; if [hJoy6] = 0 and A or B is pressed, report no buttons as pressed - ld a,[hJoyHeld] + ld a, [hJoyHeld] and A_BUTTON | B_BUTTON - jr z,.setShortDelay - ld a,[hJoy6] ; flag + jr z, .setShortDelay + ld a, [hJoy6] ; flag and a - jr nz,.setShortDelay + jr nz, .setShortDelay xor a - ld [hJoy5],a + ld [hJoy5], a .setShortDelay - ld a,5 ; 1/12 of a second delay - ld [H_FRAMECOUNTER],a + ld a, 5 ; 1/12 of a second delay + ld [H_FRAMECOUNTER], a ret WaitForTextScrollButtonPress:: @@ -3451,7 +3629,11 @@ WaitForTextScrollButtonPress:: ld a, [wTownMapSpriteBlinkingEnabled] and a jr z, .skipAnimation - call TownMapSpriteBlinkingAnimation + push de + push bc + callab TownMapSpriteBlinkingAnimation ; 1c:5753 + pop bc + pop de .skipAnimation coord hl, 18, 16 call HandleDownArrowBlinkTiming @@ -3473,7 +3655,8 @@ ManualTextScroll:: cp LINK_STATE_BATTLING jr z, .inLinkBattle call WaitForTextScrollButtonPress - ld a, SFX_PRESS_AB + call WaitForSoundToFinish + ld a, $90 ; SFX_PRESS_AB jp PlaySound .inLinkBattle ld c, 65 @@ -3489,7 +3672,7 @@ ManualTextScroll:: Multiply:: push hl push bc - callab _Multiply + callab _Multiply ; 3d:660e pop bc pop hl ret @@ -3507,15 +3690,7 @@ Divide:: push hl push de push bc - ld a,[H_LOADEDROMBANK] - push af - ld a,Bank(_Divide) - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - call _Divide - pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + homecall _Divide pop bc pop de pop hl @@ -3525,42 +3700,42 @@ Divide:: ; screen unless the player presses the A/B button or the delay is turned off ; through the [wd730] or [wLetterPrintingDelayFlags] flags. PrintLetterDelay:: - ld a,[wd730] - bit 6,a + ld a, [wd730] + bit 6, a ret nz - ld a,[wLetterPrintingDelayFlags] - bit 1,a + ld a, [wLetterPrintingDelayFlags] + bit 1, a ret z push hl push de push bc - ld a,[wLetterPrintingDelayFlags] - bit 0,a - jr z,.waitOneFrame - ld a,[wOptions] + ld a, [wLetterPrintingDelayFlags] + bit 0, a + jr z, .waitOneFrame + ld a, [wOptions] and $f - ld [H_FRAMECOUNTER],a + ld [H_FRAMECOUNTER], a jr .checkButtons .waitOneFrame - ld a,1 - ld [H_FRAMECOUNTER],a + ld a, 1 + ld [H_FRAMECOUNTER], a .checkButtons call Joypad - ld a,[hJoyHeld] + ld a, [hJoyHeld] .checkAButton - bit 0,a ; is the A button pressed? - jr z,.checkBButton + bit 0, a ; is the A button pressed? + jr z, .checkBButton jr .endWait .checkBButton - bit 1,a ; is the B button pressed? - jr z,.buttonsNotPressed + bit 1, a ; is the B button pressed? + jr z, .buttonsNotPressed .endWait call DelayFrame jr .done .buttonsNotPressed ; if neither A nor B is pressed - ld a,[H_FRAMECOUNTER] + ld a, [H_FRAMECOUNTER] and a - jr nz,.checkButtons + jr nz, .checkButtons .done pop bc pop de @@ -3571,15 +3746,15 @@ PrintLetterDelay:: ; In other words, the source data is from hl up to but not including bc, ; and the destination is de. CopyDataUntil:: - ld a,[hli] - ld [de],a + ld a, [hli] + ld [de], a inc de - ld a,h + ld a, h cp b - jr nz,CopyDataUntil - ld a,l + jr nz, CopyDataUntil + ld a, l cp c - jr nz,CopyDataUntil + jr nz, CopyDataUntil ret ; Function to remove a pokemon from the party or the current box. @@ -3605,10 +3780,10 @@ CalcStats:: .statsLoop inc c call CalcStat - ld a, [H_MULTIPLICAND+1] + ld a, [H_MULTIPLICAND + 1] ld [de], a inc de - ld a, [H_MULTIPLICAND+2] + ld a, [H_MULTIPLICAND + 2] ld [de], a inc de ld a, c @@ -3617,7 +3792,7 @@ CalcStats:: ret ; calculates stat c of current mon -; c: stat to calc (HP=1,Atk=2,Def=3,Spd=4,Spc=5) +; c: stat to calc (HP=1, Atk=2, Def=3, Spd=4, Spc=5) ; b: consider stat exp? ; hl: base ptr to stat exp values ([hl + 2*c - 1] and [hl + 2*c]) CalcStat:: @@ -3642,12 +3817,12 @@ CalcStat:: .statExpLoop ; calculates ceil(Sqrt(stat exp)) in b xor a ld [H_MULTIPLICAND], a - ld [H_MULTIPLICAND+1], a + ld [H_MULTIPLICAND + 1], a inc b ; increment current stat exp bonus ld a, b cp $ff jr z, .statExpDone - ld [H_MULTIPLICAND+2], a + ld [H_MULTIPLICAND + 2], a ld [H_MULTIPLIER], a call Multiply ld a, [hld] @@ -3736,9 +3911,9 @@ CalcStat:: jr nc, .noCarry2 inc d ; da = (Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4 .noCarry2 - ld [H_MULTIPLICAND+2], a + ld [H_MULTIPLICAND + 2], a ld a, d - ld [H_MULTIPLICAND+1], a + ld [H_MULTIPLICAND + 1], a xor a ld [H_MULTIPLICAND], a ld a, [wCurEnemyLVL] @@ -3746,10 +3921,10 @@ CalcStat:: call Multiply ; ((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level ld a, [H_MULTIPLICAND] ld [H_DIVIDEND], a - ld a, [H_MULTIPLICAND+1] - ld [H_DIVIDEND+1], a - ld a, [H_MULTIPLICAND+2] - ld [H_DIVIDEND+2], a + ld a, [H_MULTIPLICAND + 1] + ld [H_DIVIDEND + 1], a + ld a, [H_MULTIPLICAND + 2] + ld [H_DIVIDEND + 2], a ld a, $64 ld [H_DIVISOR], a ld a, $3 @@ -3761,38 +3936,38 @@ CalcStat:: jr nz, .notHPStat ld a, [wCurEnemyLVL] ld b, a - ld a, [H_MULTIPLICAND+2] + ld a, [H_MULTIPLICAND + 2] add b - ld [H_MULTIPLICAND+2], a + ld [H_MULTIPLICAND + 2], a jr nc, .noCarry3 - ld a, [H_MULTIPLICAND+1] + ld a, [H_MULTIPLICAND + 1] inc a - ld [H_MULTIPLICAND+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level + ld [H_MULTIPLICAND + 1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level .noCarry3 - ld a, 10 ; +10 for HP stat + ld a, 10 ; + 10 for HP stat .notHPStat ld b, a - ld a, [H_MULTIPLICAND+2] + ld a, [H_MULTIPLICAND + 2] add b - ld [H_MULTIPLICAND+2], a + ld [H_MULTIPLICAND + 2], a jr nc, .noCarry4 - ld a, [H_MULTIPLICAND+1] + ld a, [H_MULTIPLICAND + 1] inc a ; non-HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + 5 - ld [H_MULTIPLICAND+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level + 10 + ld [H_MULTIPLICAND + 1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level + 10 .noCarry4 - ld a, [H_MULTIPLICAND+1] ; check for overflow (>999) + ld a, [H_MULTIPLICAND + 1] ; check for overflow (>999) cp 999 / $100 + 1 jr nc, .overflow cp 999 / $100 jr c, .noOverflow - ld a, [H_MULTIPLICAND+2] + ld a, [H_MULTIPLICAND + 2] cp 999 % $100 + 1 jr c, .noOverflow .overflow ld a, 999 / $100 ; overflow: cap at 999 - ld [H_MULTIPLICAND+1], a + ld [H_MULTIPLICAND + 1], a ld a, 999 % $100 - ld [H_MULTIPLICAND+2], a + ld [H_MULTIPLICAND + 2], a .noOverflow pop bc pop de @@ -3800,29 +3975,11 @@ CalcStat:: ret AddEnemyMonToPlayerParty:: - ld a, [H_LOADEDROMBANK] - push af - ld a, BANK(_AddEnemyMonToPlayerParty) - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a - call _AddEnemyMonToPlayerParty - pop bc - ld a, b - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + homecall_sf _AddEnemyMonToPlayerParty ret MoveMon:: - ld a, [H_LOADEDROMBANK] - push af - ld a, BANK(_MoveMon) - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a - call _MoveMon - pop bc - ld a, b - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + homecall_sf _MoveMon ret ; skips a text entries, each of size NAME_LENGTH (like trainer name, OT name, rival name, ...) @@ -3842,21 +3999,21 @@ AddNTimes:: and a ret z .loop - add hl,bc + add hl, bc dec a - jr nz,.loop + jr nz, .loop ret ; Compare strings, c bytes in length, at de and hl. ; Often used to compare big endian numbers in battle calculations. StringCmp:: - ld a,[de] + ld a, [de] cp [hl] ret nz inc de inc hl dec c - jr nz,StringCmp + jr nz, StringCmp ret ; INPUT: @@ -3865,228 +4022,226 @@ StringCmp:: ; c = X coordinate of upper left corner of sprite ; de = base address of 4 tile number and attribute pairs WriteOAMBlock:: - ld h,wOAMBuffer / $100 + ld h, wOAMBuffer / $100 swap a ; multiply by 16 - ld l,a + ld l, a call .writeOneEntry ; upper left push bc - ld a,8 + ld a, 8 add c - ld c,a + ld c, a call .writeOneEntry ; upper right pop bc - ld a,8 + ld a, 8 add b - ld b,a + ld b, a call .writeOneEntry ; lower left - ld a,8 + ld a, 8 add c - ld c,a + ld c, a ; lower right -.writeOneEntry - ld [hl],b ; Y coordinate +.writeOneEntry ; 3aa0 (0:3aa0) + ld [hl], b ; Y coordinate inc hl - ld [hl],c ; X coordinate + ld [hl], c ; X coordinate inc hl - ld a,[de] ; tile number + ld a, [de] ; tile number inc de - ld [hli],a - ld a,[de] ; attribute + ld [hli], a + ld a, [de] ; attribute inc de - ld [hli],a + ld [hli], a ret HandleMenuInput:: xor a - ld [wPartyMenuAnimMonEnabled],a + ld [wPartyMenuAnimMonEnabled], a -HandleMenuInput_:: - ld a,[H_DOWNARROWBLINKCNT1] +HandleMenuInputPokemonSelection:: + ld a, [H_DOWNARROWBLINKCNT1] push af - ld a,[H_DOWNARROWBLINKCNT2] + ld a, [H_DOWNARROWBLINKCNT2] push af ; save existing values on stack xor a - ld [H_DOWNARROWBLINKCNT1],a ; blinking down arrow timing value 1 - ld a,6 - ld [H_DOWNARROWBLINKCNT2],a ; blinking down arrow timing value 2 + ld [H_DOWNARROWBLINKCNT1], a ; blinking down arrow timing value 1 + ld a, 6 + ld [H_DOWNARROWBLINKCNT2], a ; blinking down arrow timing value 2 .loop1 xor a - ld [wAnimCounter],a ; counter for pokemon shaking animation + ld [wAnimCounter], a ; counter for pokemon shaking animation call PlaceMenuCursor call Delay3 .loop2 push hl - ld a,[wPartyMenuAnimMonEnabled] + ld a, [wPartyMenuAnimMonEnabled] and a ; is it a pokemon selection menu? - jr z,.getJoypadState - callba AnimatePartyMon ; shake mini sprite of selected pokemon + jr z, .getJoypadState + callba AnimatePartyMon ; shake mini sprite of selected pokemon (1c:578c) .getJoypadState pop hl call JoypadLowSensitivity - ld a,[hJoy5] + ld a, [hJoy5] and a ; was a key pressed? - jr nz,.keyPressed + jr nz, .keyPressed push hl coord hl, 18, 11 ; coordinates of blinking down arrow in some menus call HandleDownArrowBlinkTiming ; blink down arrow (if any) pop hl - ld a,[wMenuJoypadPollCount] + ld a, [wMenuJoypadPollCount] dec a - jr z,.giveUpWaiting + jr z, .giveUpWaiting jr .loop2 .giveUpWaiting ; if a key wasn't pressed within the specified number of checks pop af - ld [H_DOWNARROWBLINKCNT2],a + ld [H_DOWNARROWBLINKCNT2], a pop af - ld [H_DOWNARROWBLINKCNT1],a ; restore previous values + ld [H_DOWNARROWBLINKCNT1], a ; restore previous values xor a - ld [wMenuWrappingEnabled],a ; disable menu wrapping + ld [wMenuWrappingEnabled], a ; disable menu wrapping ret .keyPressed xor a - ld [wCheckFor180DegreeTurn],a - ld a,[hJoy5] - ld b,a - bit 6,a ; pressed Up key? - jr z,.checkIfDownPressed + ld [wCheckFor180DegreeTurn], a + ld a, [hJoy5] + ld b, a + bit 0, a ; pressed A key? + jr nz, .checkOtherKeys + bit 6, a ; pressed Up key? + jr z, .checkIfDownPressed .upPressed - ld a,[wCurrentMenuItem] ; selected menu item + ld a, [wCurrentMenuItem] ; selected menu item and a ; already at the top of the menu? - jr z,.alreadyAtTop + jr z, .alreadyAtTop .notAtTop dec a - ld [wCurrentMenuItem],a ; move selected menu item up one space + ld [wCurrentMenuItem], a ; move selected menu item up one space jr .checkOtherKeys .alreadyAtTop - ld a,[wMenuWrappingEnabled] + ld a, [wMenuWrappingEnabled] and a ; is wrapping around enabled? - jr z,.noWrappingAround - ld a,[wMaxMenuItem] - ld [wCurrentMenuItem],a ; wrap to the bottom of the menu + jr z, .noWrappingAround + ld a, [wMaxMenuItem] + ld [wCurrentMenuItem], a ; wrap to the bottom of the menu jr .checkOtherKeys .checkIfDownPressed - bit 7,a - jr z,.checkOtherKeys + bit 7, a + jr z, .checkOtherKeys .downPressed - ld a,[wCurrentMenuItem] + ld a, [wCurrentMenuItem] inc a - ld c,a - ld a,[wMaxMenuItem] + ld c, a + ld a, [wMaxMenuItem] cp c - jr nc,.notAtBottom + jr nc, .notAtBottom .alreadyAtBottom - ld a,[wMenuWrappingEnabled] + ld a, [wMenuWrappingEnabled] and a ; is wrapping around enabled? - jr z,.noWrappingAround - ld c,$00 ; wrap from bottom to top + jr z, .noWrappingAround + ld c, $00 ; wrap from bottom to top .notAtBottom - ld a,c - ld [wCurrentMenuItem],a + ld a, c + ld [wCurrentMenuItem], a .checkOtherKeys - ld a,[wMenuWatchedKeys] + ld a, [wMenuWatchedKeys] and b ; does the menu care about any of the pressed keys? - jp z,.loop1 + jp z, .loop1 .checkIfAButtonOrBButtonPressed - ld a,[hJoy5] + ld a, [hJoy5] and A_BUTTON | B_BUTTON - jr z,.skipPlayingSound + jr z, .skipPlayingSound .AButtonOrBButtonPressed push hl - ld hl,wFlags_0xcd60 - bit 5,[hl] + ld hl, wFlags_0xcd60 + bit 5, [hl] pop hl - jr nz,.skipPlayingSound - ld a,SFX_PRESS_AB - call PlaySound + jr nz, .skipPlayingSound + ld a, $90 ; SFX_PRESS_AB + call PlaySound ; play sound .skipPlayingSound pop af - ld [H_DOWNARROWBLINKCNT2],a + ld [H_DOWNARROWBLINKCNT2], a pop af - ld [H_DOWNARROWBLINKCNT1],a ; restore previous values + ld [H_DOWNARROWBLINKCNT1], a ; restore previous values xor a - ld [wMenuWrappingEnabled],a ; disable menu wrapping - ld a,[hJoy5] + ld [wMenuWrappingEnabled], a ; disable menu wrapping + ld a, [hJoy5] ret .noWrappingAround - ld a,[wMenuWatchMovingOutOfBounds] + ld a, [wMenuWatchMovingOutOfBounds] and a ; should we return if the user tried to go past the top or bottom? - jr z,.checkOtherKeys + jr z, .checkOtherKeys jr .checkIfAButtonOrBButtonPressed PlaceMenuCursor:: - ld a,[wTopMenuItemY] + ld a, [wTopMenuItemY] and a ; is the y coordinate 0? - jr z,.adjustForXCoord + jr z, .adjustForXCoord coord hl, 0, 0 - ld bc,SCREEN_WIDTH + ld bc, SCREEN_WIDTH .topMenuItemLoop - add hl,bc + add hl, bc dec a - jr nz,.topMenuItemLoop + jr nz, .topMenuItemLoop .adjustForXCoord - ld a,[wTopMenuItemX] - ld b,0 - ld c,a - add hl,bc + ld a, [wTopMenuItemX] + ld b, 0 + ld c, a + add hl, bc push hl - ld a,[wLastMenuItem] + ld a, [wLastMenuItem] and a ; was the previous menu id 0? - jr z,.checkForArrow1 + jr z, .checkForArrow1 + ld bc, 40 push af - ld a,[hFlags_0xFFF6] - bit 1,a ; is the menu double spaced? - jr z,.doubleSpaced1 - ld bc,20 - jr .getOldMenuItemScreenPosition + ld a, [hFlags_0xFFFA] + bit 1, a ; is the menu double spaced? + jr z, .doubleSpaced1 + ld bc, 20 .doubleSpaced1 - ld bc,40 -.getOldMenuItemScreenPosition pop af .oldMenuItemLoop - add hl,bc + add hl, bc dec a - jr nz,.oldMenuItemLoop + jr nz, .oldMenuItemLoop .checkForArrow1 - ld a,[hl] - cp a,"▶" ; was an arrow next to the previously selected menu item? - jr nz,.skipClearingArrow + ld a, [hl] + cp "▶" ; was an arrow next to the previously selected menu item? + jr nz, .skipClearingArrow .clearArrow - ld a,[wTileBehindCursor] - ld [hl],a + ld a, [wTileBehindCursor] + ld [hl], a .skipClearingArrow pop hl - ld a,[wCurrentMenuItem] + ld a, [wCurrentMenuItem] and a - jr z,.checkForArrow2 + jr z, .checkForArrow2 + ld bc, 40 push af - ld a,[hFlags_0xFFF6] - bit 1,a ; is the menu double spaced? - jr z,.doubleSpaced2 - ld bc,20 - jr .getCurrentMenuItemScreenPosition + ld a, [hFlags_0xFFFA] + bit 1, a ; is the menu double spaced? + jr z, .doubleSpaced2 + ld bc, 20 .doubleSpaced2 - ld bc,40 -.getCurrentMenuItemScreenPosition pop af .currentMenuItemLoop - add hl,bc + add hl, bc dec a - jr nz,.currentMenuItemLoop + jr nz, .currentMenuItemLoop .checkForArrow2 - ld a,[hl] - cp a,"▶" ; has the right arrow already been placed? - jr z,.skipSavingTile ; if so, don't lose the saved tile - ld [wTileBehindCursor],a ; save tile before overwriting with right arrow + ld a, [hl] + cp "▶" ; has the right arrow already been placed? + jr z, .skipSavingTile ; if so, don't lose the saved tile + ld [wTileBehindCursor], a ; save tile before overwriting with right arrow .skipSavingTile - ld a,"▶" ; place right arrow - ld [hl],a - ld a,l - ld [wMenuCursorLocation],a - ld a,h - ld [wMenuCursorLocation + 1],a - ld a,[wCurrentMenuItem] - ld [wLastMenuItem],a + ld a, "▶" ; place right arrow + ld [hl], a + ld a, l + ld [wMenuCursorLocation], a + ld a, h + ld [wMenuCursorLocation + 1], a + ld a, [wCurrentMenuItem] + ld [wLastMenuItem], a ret ; This is used to mark a menu cursor other than the one currently being @@ -4094,22 +4249,22 @@ PlaceMenuCursor:: ; the menu cursor in the parent menu. In the case of swapping items in list, ; this is used to mark the item that was first chosen to be swapped. PlaceUnfilledArrowMenuCursor:: - ld b,a - ld a,[wMenuCursorLocation] - ld l,a - ld a,[wMenuCursorLocation + 1] - ld h,a - ld [hl],$ec ; outline of right arrow - ld a,b + ld b, a + ld a, [wMenuCursorLocation] + ld l, a + ld a, [wMenuCursorLocation + 1] + ld h, a + ld [hl], $ec ; outline of right arrow + ld a, b ret ; Replaces the menu cursor with a blank space. EraseMenuCursor:: - ld a,[wMenuCursorLocation] - ld l,a - ld a,[wMenuCursorLocation + 1] - ld h,a - ld [hl]," " + ld a, [wMenuCursorLocation] + ld l, a + ld a, [wMenuCursorLocation + 1] + ld h, a + ld [hl], " " ret ; This toggles a blinking down arrow at hl on and off after a delay has passed. @@ -4121,44 +4276,44 @@ EraseMenuCursor:: ; That allows this to be called without worrying about if a down arrow should ; be blinking. HandleDownArrowBlinkTiming:: - ld a,[hl] - ld b,a - ld a,$ee ; down arrow + ld a, [hl] + ld b, a + ld a, $ee ; down arrow cp b - jr nz,.downArrowOff + jr nz, .downArrowOff .downArrowOn - ld a,[H_DOWNARROWBLINKCNT1] + ld a, [H_DOWNARROWBLINKCNT1] dec a - ld [H_DOWNARROWBLINKCNT1],a + ld [H_DOWNARROWBLINKCNT1], a ret nz - ld a,[H_DOWNARROWBLINKCNT2] + ld a, [H_DOWNARROWBLINKCNT2] dec a - ld [H_DOWNARROWBLINKCNT2],a + ld [H_DOWNARROWBLINKCNT2], a ret nz - ld a," " - ld [hl],a - ld a,$ff - ld [H_DOWNARROWBLINKCNT1],a - ld a,$06 - ld [H_DOWNARROWBLINKCNT2],a + ld a, " " + ld [hl], a + ld a, $ff + ld [H_DOWNARROWBLINKCNT1], a + ld a, $06 + ld [H_DOWNARROWBLINKCNT2], a ret .downArrowOff - ld a,[H_DOWNARROWBLINKCNT1] + ld a, [H_DOWNARROWBLINKCNT1] and a ret z dec a - ld [H_DOWNARROWBLINKCNT1],a + ld [H_DOWNARROWBLINKCNT1], a ret nz dec a - ld [H_DOWNARROWBLINKCNT1],a - ld a,[H_DOWNARROWBLINKCNT2] + ld [H_DOWNARROWBLINKCNT1], a + ld a, [H_DOWNARROWBLINKCNT2] dec a - ld [H_DOWNARROWBLINKCNT2],a + ld [H_DOWNARROWBLINKCNT2], a ret nz - ld a,$06 - ld [H_DOWNARROWBLINKCNT2],a - ld a,$ee ; down arrow - ld [hl],a + ld a, $06 + ld [H_DOWNARROWBLINKCNT2], a + ld a, $ee ; down arrow + ld [hl], a ret ; The following code either enables or disables the automatic drawing of @@ -4170,19 +4325,19 @@ EnableAutoTextBoxDrawing:: jr AutoTextBoxDrawingCommon DisableAutoTextBoxDrawing:: - ld a,$01 + ld a, $01 AutoTextBoxDrawingCommon:: - ld [wAutoTextBoxDrawingControl],a + ld [wAutoTextBoxDrawingControl], a xor a - ld [wDoNotWaitForButtonPressAfterDisplayingText],a ; make DisplayTextID wait for button press + ld [wDoNotWaitForButtonPressAfterDisplayingText], a ; make DisplayTextID wait for button press ret PrintText:: ; Print text hl at (1, 14). push hl - ld a,MESSAGE_BOX - ld [wTextBoxID],a + ld a, MESSAGE_BOX + ld [wTextBoxID], a call DisplayTextBoxID call UpdateSprites call Delay3 @@ -4191,6 +4346,16 @@ PrintText_NoCreatingTextBox:: coord bc, 1, 14 jp TextCommandProcessor +FarPrintText:: +; print text b:hl at (1, 14) + ld a, [H_LOADEDROMBANK] + push af + ld a, b + call BankswitchCommon + call PrintText + pop af + call BankswitchCommon + ret PrintNumber:: ; Print the c-digit, b-byte value at de. @@ -4411,7 +4576,6 @@ endm ret -CallFunctionInTable:: JumpTable:: ; Call function a in jumptable hl. ; de is not preserved. @@ -4461,6 +4625,8 @@ IsInRestOfArray:: scf ret +InitMapSprites:: + jpab _InitMapSprites RestoreScreenTilesAndReloadTilePatterns:: call ClearSprites @@ -4488,21 +4654,27 @@ GBPalNormal:: ld [rBGP], a ld a, %11010000 ; 3100 ld [rOBP0], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 ret GBPalWhiteOut:: ; White out all palettes. xor a - ld [rBGP],a - ld [rOBP0],a - ld [rOBP1],a + ld [rBGP], a + ld [rOBP0], a + ld [rOBP1], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 ret RunDefaultPaletteCommand:: - ld b,$ff + ld b, $ff RunPaletteCommand:: - ld a,[wOnSGB] + ld a, [wOnSGB] and a ret z predef_jump _RunPaletteCommand @@ -4533,7 +4705,7 @@ ReloadMapSpriteTilePatterns:: xor a ld [wSpriteSetID], a call DisableLCD - callba InitMapSprites + call InitMapSprites call EnableLCD pop hl pop af @@ -4552,7 +4724,7 @@ GiveItem:: ld [wcf91], a ld a, c ld [wItemQuantity], a - ld hl,wNumBagItems + ld hl, wNumBagItems call AddItemToInventory ret nc call GetItemName @@ -4568,8 +4740,7 @@ GivePokemon:: ld [wCurEnemyLVL], a xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a - jpba _GivePokemon - + jpba _GivePokemon ; 3d:66fa Random:: ; Return a random number in a. @@ -4584,12 +4755,52 @@ Random:: pop hl ret +BankswitchCommon:: + ld [H_LOADEDROMBANK], a + ld [MBC1RomBank], a + ret -INCLUDE "home/predef.asm" +Bankswitch:: +; self-contained bankswitch, use this when not in the home bank +; switches to the bank in b + ld a, [H_LOADEDROMBANK] + push af + ld a, b + ld [H_LOADEDROMBANK], a + ld [MBC1RomBank], a + call JumpToAddress + pop bc + ld a, b + ld [H_LOADEDROMBANK], a + ld [MBC1RomBank], a + ret +JumpToAddress:: + jp [hl] +SwitchSRAMBankAndLatchClockData:: + push af + ld a, $1 + ld [MBC1SRamBankingMode], a + ld a, SRAM_ENABLE + ld [MBC1SRamEnable], a + pop af + ld [MBC1SRamBank], a + ret + +PrepareRTCDataAndDisableSRAM:: + push af + ld a, $0 + ld [MBC1SRamBankingMode], a + ld [MBC1SRamEnable], a + pop af + ret + +INCLUDE "home/predef.asm" UpdateCinnabarGymGateTileBlocks:: - jpba UpdateCinnabarGymGateTileBlocks_ + callba UpdateCinnabarGymGateTileBlocks_ + ret ; again? + ;jp Bankswitch CheckForHiddenObjectOrBookshelfOrCardKeyDoor:: ld a, [H_LOADEDROMBANK] @@ -4598,23 +4809,19 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor:: bit 0, a ; A button jr z, .nothingFound ; A button is pressed - ld a, Bank(CheckForHiddenObject) - ld [MBC1RomBank], a - ld [H_LOADEDROMBANK], a - call CheckForHiddenObject + callbs CheckForHiddenObject ld a, [$ffee] and a jr nz, .hiddenObjectNotFound - ld a, [wHiddenObjectFunctionRomBank] - ld [MBC1RomBank], a - ld [H_LOADEDROMBANK], a - ld de, .returnAddress - push de - jp [hl] -.returnAddress xor a + ld [$ffeb], a + ld a, [wHiddenObjectFunctionRomBank] + call BankswitchCommon + call JumpToAddress + ld a, [$ffeb] jr .done .hiddenObjectNotFound + predef GetTileAndCoordsInFrontOfPlayer callba PrintBookshelfText ld a, [$ffdb] and a @@ -4624,12 +4831,11 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor:: .done ld [$ffeb], a pop af - ld [MBC1RomBank], a - ld [H_LOADEDROMBANK], a + call BankswitchCommon ret PrintPredefTextID:: - ld [hSpriteIndexOrTextID], a + ld [hSpriteIndexOrTextID], a ; $ff8c ld hl, TextPredefs call SetMapTextPointer ld hl, wTextPredefFlag @@ -4656,6 +4862,8 @@ SetMapTextPointer:: ret TextPredefs:: +const_value = 1 + add_tx_pre CardKeySuccessText ; 01 add_tx_pre CardKeyFailText ; 02 add_tx_pre RedBedroomPCText ; 03 @@ -4667,58 +4875,64 @@ TextPredefs:: add_tx_pre AerodactylFossilText ; 09 add_tx_pre Route15UpstairsBinocularsText ; 0A add_tx_pre KabutopsFossilText ; 0B - add_tx_pre GymStatueText1 ; 0C - add_tx_pre GymStatueText2 ; 0D - add_tx_pre BookcaseText ; 0E - add_tx_pre ViridianCityPokecenterBenchGuyText ; 0F - add_tx_pre PewterCityPokecenterBenchGuyText ; 10 - add_tx_pre CeruleanCityPokecenterBenchGuyText ; 11 - add_tx_pre LavenderCityPokecenterBenchGuyText ; 12 - add_tx_pre VermilionCityPokecenterBenchGuyText ; 13 - add_tx_pre CeladonCityPokecenterBenchGuyText ; 14 - add_tx_pre CeladonCityHotelText ; 15 - add_tx_pre FuchsiaCityPokecenterBenchGuyText ; 16 - add_tx_pre CinnabarIslandPokecenterBenchGuyText ; 17 - add_tx_pre SaffronCityPokecenterBenchGuyText ; 18 - add_tx_pre MtMoonPokecenterBenchGuyText ; 19 - add_tx_pre RockTunnelPokecenterBenchGuyText ; 1A - add_tx_pre UnusedBenchGuyText1 ; 1B XXX unused - add_tx_pre UnusedBenchGuyText2 ; 1C XXX unused - add_tx_pre UnusedBenchGuyText3 ; 1D XXX unused - add_tx_pre UnusedPredefText ; 1E XXX unused - add_tx_pre PokemonCenterPCText ; 1F - add_tx_pre ViridianSchoolNotebook ; 20 - add_tx_pre ViridianSchoolBlackboard ; 21 - add_tx_pre JustAMomentText ; 22 - add_tx_pre OpenBillsPCText ; 23 - add_tx_pre FoundHiddenItemText ; 24 - add_tx_pre HiddenItemBagFullText ; 25 XXX unused - add_tx_pre VermilionGymTrashText ; 26 - add_tx_pre IndigoPlateauHQText ; 27 - add_tx_pre GameCornerOutOfOrderText ; 28 - add_tx_pre GameCornerOutToLunchText ; 29 - add_tx_pre GameCornerSomeonesKeysText ; 2A - add_tx_pre FoundHiddenCoinsText ; 2B - add_tx_pre DroppedHiddenCoinsText ; 2C - add_tx_pre BillsHouseMonitorText ; 2D - add_tx_pre BillsHouseInitiatedText ; 2E - add_tx_pre BillsHousePokemonList ; 2F - add_tx_pre MagazinesText ; 30 - add_tx_pre CinnabarGymQuiz ; 31 - add_tx_pre GameCornerNoCoinsText ; 32 - add_tx_pre GameCornerCoinCaseText ; 33 - add_tx_pre LinkCableHelp ; 34 - add_tx_pre TMNotebook ; 35 - add_tx_pre FightingDojoText ; 36 - add_tx_pre FightingDojoText_52a10 ; 37 - add_tx_pre FightingDojoText_52a1d ; 38 - add_tx_pre NewBicycleText ; 39 - add_tx_pre IndigoPlateauStatues ; 3A - add_tx_pre VermilionGymTrashSuccessText1 ; 3B - add_tx_pre VermilionGymTrashSuccessText2 ; 3C XXX unused - add_tx_pre VermilionGymTrashSuccessText3 ; 3D - add_tx_pre VermilionGymTrashFailText ; 3E - add_tx_pre TownMapText ; 3F - add_tx_pre BookOrSculptureText ; 40 - add_tx_pre ElevatorText ; 41 - add_tx_pre PokemonStuffText ; 42 + add_tx_pre FanClubPicture1Text ; 0C + add_tx_pre FanClubPicture2Text ; 0D + add_tx_pre GymStatueText1 ; 0E + add_tx_pre GymStatueText2 ; 0F + add_tx_pre BookcaseText ; 10 + add_tx_pre ViridianCityPokecenterBenchGuyText ; 11 + add_tx_pre PewterCityPokecenterBenchGuyText ; 12 + add_tx_pre CeruleanCityPokecenterBenchGuyText ; 13 + add_tx_pre LavenderCityPokecenterBenchGuyText ; 14 + add_tx_pre VermilionCityPokecenterBenchGuyText ; 15 + add_tx_pre CeladonCityPokecenterBenchGuyText ; 16 + add_tx_pre CeladonCityHotelText ; 17 + add_tx_pre FuchsiaCityPokecenterBenchGuyText ; 18 + add_tx_pre CinnabarIslandPokecenterBenchGuyText ; 19 + add_tx_pre SaffronCityPokecenterBenchGuyText ; 1A + add_tx_pre MtMoonPokecenterBenchGuyText ; 1B + add_tx_pre RockTunnelPokecenterBenchGuyText ; 1C + add_tx_pre UnusedBenchGuyText1 ; 1D + add_tx_pre UnusedBenchGuyText2 ; 1E + add_tx_pre UnusedBenchGuyText3 ; 1F + add_tx_pre UnusedPredefText ; 20 + add_tx_pre PokemonCenterPCText ; 21 + add_tx_pre ViridianSchoolNotebook ; 22 + add_tx_pre ViridianSchoolBlackboard ; 23 + ; add_tx_pre FakeTextPredef22 + ; add_tx_pre FakeTextPredef23 + add_tx_pre JustAMomentText ; 24 + add_tx_pre OpenBillsPCText ; 25 + add_tx_pre FoundHiddenItemText ; 26 + add_tx_pre HiddenItemBagFullText ; 27 + add_tx_pre VermilionGymTrashText ; 28 + add_tx_pre IndigoPlateauHQText ; 29 + add_tx_pre GameCornerOutOfOrderText ; 2A + add_tx_pre GameCornerOutToLunchText ; 2B + add_tx_pre GameCornerSomeonesKeysText ; 2C + add_tx_pre FoundHiddenCoinsText ; 2D + add_tx_pre DroppedHiddenCoinsText ; 2E + add_tx_pre BillsHouseMonitorText ; 2F + add_tx_pre BillsHouseInitiatedText ; 30 + add_tx_pre BillsHousePokemonList ; 31 + add_tx_pre MagazinesText ; 32 + add_tx_pre CinnabarGymQuiz ; 33 + add_tx_pre GameCornerNoCoinsText ; 34 + add_tx_pre GameCornerCoinCaseText ; 35 + add_tx_pre LinkCableHelp ; 36 + add_tx_pre TMNotebook ; 37 + add_tx_pre FightingDojoText ; 38 + add_tx_pre EnemiesOnEverySideText ; 39 + add_tx_pre WhatGoesAroundComesAroundText ; 3A + add_tx_pre NewBicycleText ; 3B + add_tx_pre IndigoPlateauStatues ; 3C XXX unused + add_tx_pre VermilionGymTrashSuccessText1 ; 3D + add_tx_pre VermilionGymTrashSuccessText2 ; 3E + add_tx_pre VermilionGymTrashSuccessText3 ; 3F + add_tx_pre VermilionGymTrashFailText ; 40 + add_tx_pre TownMapText ; 41 + add_tx_pre BookOrSculptureText ; 42 + add_tx_pre ElevatorText ; 43 + add_tx_pre PokemonStuffText ; 44 + + ; dr $3f67, $4000 diff --git a/home/audio.asm b/home/audio.asm index 7c0c5238..8157e758 100644 --- a/home/audio.asm +++ b/home/audio.asm @@ -17,13 +17,14 @@ PlayDefaultMusicFadeOutCurrent:: ld [wLastMusicSoundID], a ld c, 8 ld d, c - PlayDefaultMusicCommon:: ld a, [wWalkBikeSurfState] and a jr z, .walking cp $2 jr z, .surfing + call CheckForNoBikingMusicMap + jr c, .walking ld a, MUSIC_BIKE_RIDING jr .next @@ -34,7 +35,7 @@ PlayDefaultMusicCommon:: ld b, a ld a, d and a ; should current music be faded out first? - ld a, BANK(Music_BikeRiding) + ld a, $1f ; BANK(Music_BikeRiding) jr nz, .next2 ; Only change the audio ROM bank if the current music isn't going to be faded @@ -66,35 +67,32 @@ PlayDefaultMusicCommon:: ld [wNewSoundID], a jp PlaySound -UpdateMusic6Times:: -; This is called when entering a map, before fading out the current music and -; playing the default music (i.e. the map's music or biking/surfing music). - ld a, [wAudioROMBank] - ld b, a - cp BANK(Audio1_UpdateMusic) - jr nz, .checkForAudio2 - -; audio 1 - ld hl, Audio1_UpdateMusic - jr .next - -.checkForAudio2 - cp BANK(Audio2_UpdateMusic) - jr nz, .audio3 - -; audio 2 - ld hl, Audio2_UpdateMusic - jr .next - -.audio3 - ld hl, Audio3_UpdateMusic +CheckForNoBikingMusicMap:: +; probably used to not change music upon getting on bike + ld a, [wCurMap] + cp ROUTE_23 + jr z, .found + cp VICTORY_ROAD_1 + jr z, .found + cp VICTORY_ROAD_2 + jr z, .found + cp VICTORY_ROAD_3 + jr z, .found + cp INDIGO_PLATEAU + jr z, .found + and a + ret +.found + scf + ret -.next - ld c, 6 +UpdateMusic6Times:: + ld c, $6 +UpdateMusicCTimes:: .loop push bc push hl - call Bankswitch + callba Audio1_UpdateMusic ; 2:509d pop hl pop bc dec c @@ -137,7 +135,20 @@ PlayMusic:: ld [wAudioROMBank], a ld [wAudioSavedROMBank], a ld a, b + jr PlaySound + +Func_2223:: + xor a + ld [wChannelSoundIDs + CH4], a + ld [wChannelSoundIDs + CH5], a + ld [wChannelSoundIDs + CH6], a + ld [wChannelSoundIDs + CH7], a + ld [rNR10], a + ret +StopAllMusic:: + ld a, $FF + ld [wNewSoundID], a ; plays music specified by a. If value is $ff, music is stopped PlaySound:: push hl @@ -154,65 +165,130 @@ PlaySound:: ld [wChannelSoundIDs + CH7], a .next ld a, [wAudioFadeOutControl] - and a ; has a fade-out length been specified? + and a jr z, .noFadeOut ld a, [wNewSoundID] - and a ; is the new sound ID 0? - jr z, .done ; if so, do nothing + and a + jr z, .done xor a ld [wNewSoundID], a ld a, [wLastMusicSoundID] - cp $ff ; has the music been stopped? - jr nz, .fadeOut ; if not, fade out the current music -; If it has been stopped, start playing the new music immediately. + cp $ff + jr nz, .fadeOut xor a ld [wAudioFadeOutControl], a .noFadeOut xor a ld [wNewSoundID], a + call DetermineAudioFunction + jr .done + +.fadeOut + ld a, b + ld [wLastMusicSoundID], a + ld a, [wAudioFadeOutControl] + ld [wAudioFadeOutCounterReloadValue], a + ld [wAudioFadeOutCounter], a + ld a, b + ld [wAudioFadeOutControl], a +.done + pop bc + pop de + pop hl + ret + +GetNextMusicByte:: ld a, [H_LOADEDROMBANK] - ld [hSavedROMBank], a + push af ld a, [wAudioROMBank] - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a - cp BANK(Audio1_PlaySound) - jr nz, .checkForAudio2 + call BankswitchCommon + ld d, $0 + ld a, c + add a + ld e, a + ld hl, wChannelCommandPointers + add hl, de + ld a, [hli] + ld e, a + ld a, [hld] + ld d, a + ld a, [de] + inc de + ld [hl], e + inc hl + ld [hl], d + ld e, a + pop af + call BankswitchCommon + ld a, e + ret + +InitMusicVariables:: + push hl + push de + push bc + homecall Audio2_InitMusicVariables ; 8:59f8 + pop bc + pop de + pop hl + ret + +InitSFXVariables:: + push hl + push de + push bc + homecall Audio2_InitSFXVariables ; 8:5ab7 + pop bc + pop de + pop hl + ret -; audio 1 +StopAllAudio:: + push hl + push de + push bc + homecall Audio2_StopAllAudio + pop bc + pop de + pop hl + ret + +DetermineAudioFunction:: + ld a, [H_LOADEDROMBANK] + push af + ld a, [wAudioROMBank] + call BankswitchCommon +; determine the audio function, based on the bank + cp BANK(Audio1_PlaySound) + jr nz, .checkForBank08 +; bank 02 (audio 1) ld a, b call Audio1_PlaySound - jr .next2 + jr .done -.checkForAudio2 +.checkForBank08 cp BANK(Audio2_PlaySound) - jr nz, .audio3 - -; audio 2 + jr nz, .checkForBank1F +; bank 08 (audio 2) ld a, b call Audio2_PlaySound - jr .next2 + jr .done -.audio3 +.checkForBank1F + cp BANK(Audio3_PlaySound) + jr nz, .bank20 +; bank 1f (audio 3) ld a, b call Audio3_PlaySound - -.next2 - ld a, [hSavedROMBank] - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a jr .done -.fadeOut +.bank20 +; invalid banks will default to XX:6bd4 +; this is seen when encountering Missingno, as its sprite dimensions overflow to wAudioROMBank ld a, b - ld [wLastMusicSoundID], a - ld a, [wAudioFadeOutControl] - ld [wAudioFadeOutCounterReloadValue], a - ld [wAudioFadeOutCounter], a - ld a, b - ld [wAudioFadeOutControl], a - + call Audio4_PlaySound .done - pop bc - pop de - pop hl + pop af + call BankswitchCommon ret + diff --git a/home/copy.asm b/home/copy.asm index be9c8c0c..4f1d5017 100644 --- a/home/copy.asm +++ b/home/copy.asm @@ -1,24 +1,74 @@ FarCopyData:: ; Copy bc bytes from a:hl to de. - ld [wBuffer], a + ld [wFarCopyDataSavedROMBank], a ld a, [H_LOADEDROMBANK] push af - ld a, [wBuffer] - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + ld a, [wFarCopyDataSavedROMBank] + call BankswitchCommon call CopyData pop af - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + call BankswitchCommon ret CopyData:: ; Copy bc bytes from hl to de. + ld a,b + and a + jr z, .copybytes + ld a,c + and a ; is lower byte 0 + jr z, .loop + inc b ; if not, increment b as there are <$100 bytes to copy +.loop + call .copybytes + dec b + jr nz,.loop + ret + +.copybytes ; 00c1 ld a, [hli] ld [de], a inc de - dec bc - ld a, c - or b - jr nz, CopyData + dec c + jr nz, .copybytes ret + +CopyVideoDataAlternate:: + ld a, [rLCDC] + bit 7,a ; LCD enabled? + jp nz, CopyVideoData ; if yes, then copy video data + push hl + ld h,d + ld l,e + pop de + ld a,b ; save bank + push af + swap c + ld a,$f + and c + ld b,a + ld a,$f0 + and c + ld c,a + pop af + jp FarCopyData + +CopyVideoDataDoubleAlternate:: + ld a, [rLCDC] + bit 7,a ; LCD enabled? + jp nz, CopyVideoDataDouble ; if yes, then copy video data + push de + ld d,h + ld e,l + ld a,b + push af ; save bank to switch to + ld h,$0 + ld l,c + add hl,hl ; get raw length of bytes to copy + add hl,hl + add hl,hl + ld b,h + ld c,l + pop af + pop hl + jp FarCopyDataDouble diff --git a/home/copy2.asm b/home/copy2.asm index 830440b0..ad47c4a0 100644 --- a/home/copy2.asm +++ b/home/copy2.asm @@ -1,62 +1,36 @@ -FarCopyData2:: -; Identical to FarCopyData, but uses hROMBankTemp -; as temp space instead of wBuffer. - ld [hROMBankTemp],a - ld a,[H_LOADEDROMBANK] - push af - ld a,[hROMBankTemp] - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - call CopyData - pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - ret - -FarCopyData3:: -; Copy bc bytes from a:de to hl. - ld [hROMBankTemp],a - ld a,[H_LOADEDROMBANK] - push af - ld a,[hROMBankTemp] - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - push hl - push de - push de - ld d,h - ld e,l - pop hl - call CopyData - pop de - pop hl - pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - ret - FarCopyDataDouble:: ; Expand bc bytes of 1bpp image data -; from a:hl to 2bpp data at de. - ld [hROMBankTemp],a +; from a:de to 2bpp data at hl. + ld [wFarCopyDataSavedROMBank],a ld a,[H_LOADEDROMBANK] push af - ld a,[hROMBankTemp] - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a -.loop - ld a,[hli] - ld [de],a - inc de - ld [de],a - inc de - dec bc + ld a,[wFarCopyDataSavedROMBank] + call BankswitchCommon + ld a,h ; swap hl and de + ld h,d + ld d,a + ld a,l + ld l,e + ld e,a + ld a,b + and a + jr z,.eightbitcopyamount ld a,c - or b - jr nz,.loop + and a ; multiple of $100 + jr z, .expandloop ; if so, do not increment b because the first instance of dec c results in underflow +.eightbitcopyamount + inc b +.expandloop + ld a,[de] + inc de + ld [hli],a + ld [hli],a + dec c + jr nz, .expandloop + dec b + jr nz, .expandloop pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + call BankswitchCommon ret CopyVideoData:: @@ -70,11 +44,10 @@ CopyVideoData:: ld [H_AUTOBGTRANSFERENABLED], a ld a, [H_LOADEDROMBANK] - ld [hROMBankTemp], a + push af ld a, b - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + call BankswitchCommon ld a, e ld [H_VBCOPYSRC], a @@ -94,9 +67,8 @@ CopyVideoData:: .done ld [H_VBCOPYSIZE], a call DelayFrame - ld a, [hROMBankTemp] - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + pop af + call BankswitchCommon pop af ld [H_AUTOBGTRANSFERENABLED], a ret @@ -119,11 +91,10 @@ CopyVideoDataDouble:: xor a ; disable auto-transfer while copying ld [H_AUTOBGTRANSFERENABLED], a ld a, [H_LOADEDROMBANK] - ld [hROMBankTemp], a + push af ld a, b - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + call BankswitchCommon ld a, e ld [H_VBCOPYDOUBLESRC], a @@ -143,9 +114,8 @@ CopyVideoDataDouble:: .done ld [H_VBCOPYDOUBLESIZE], a call DelayFrame - ld a, [hROMBankTemp] - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + pop af + call BankswitchCommon pop af ld [H_AUTOBGTRANSFERENABLED], a ret @@ -159,6 +129,42 @@ CopyVideoDataDouble:: ld c, a jr .loop +FillMemory:: + push af + ld a,b + and a + jr z, .eightbitcopyamount + ld a,c + and a + jr z, .mulitpleof0x100 +.eightbitcopyamount + inc b +.mulitpleof0x100 + pop af +.loop + ld [hli],a + dec c + jr nz, .loop + dec b + jr nz, .loop + ret + +GetFarByte:: +; get a byte from a:hl +; and return it in a + push bc + ld b, a + ld a, [H_LOADEDROMBANK] + push af + ld a, b + call BankswitchCommon + ld b, [hl] + pop af + call BankswitchCommon + ld a, b + pop bc + ret + ClearScreenArea:: ; Clear tilemap area cxb at hl. ld a, " " ; blank tile diff --git a/home/fade.asm b/home/fade.asm index 08e087b4..1259f92b 100644 --- a/home/fade.asm +++ b/home/fade.asm @@ -1,7 +1,7 @@ ; These routines manage gradual fading ; (e.g., entering a doorway) LoadGBPal:: - ld a, [wMapPalOffset] ;tells if cur.map is dark (requires HM5_FLASH?) + ld a, [wMapPalOffset] ; tells if wCurMap is dark (requires HM5_FLASH?) ld b, a ld hl, FadePal4 ld a, l @@ -16,6 +16,9 @@ LoadGBPal:: ld [rOBP0], a ld a, [hli] ld [rOBP1], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 ret GBFadeInFromBlack:: @@ -34,6 +37,9 @@ GBFadeIncCommon: ld [rOBP0], a ld a, [hli] ld [rOBP1], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 ld c, 8 call DelayFrames dec b @@ -56,6 +62,9 @@ GBFadeDecCommon: ld [rOBP0], a ld a, [hld] ld [rBGP], a + call UpdateGBCPal_BGP + call UpdateGBCPal_OBP0 + call UpdateGBCPal_OBP1 ld c, 8 call DelayFrames dec b diff --git a/home/init.asm b/home/init.asm index cb5c6583..6aa14608 100644 --- a/home/init.asm +++ b/home/init.asm @@ -3,8 +3,6 @@ SoftReset:: call GBPalWhiteOut ld c, 32 call DelayFrames - ; fallthrough - Init:: ; Program init. @@ -51,10 +49,10 @@ rLCDC_DEFAULT EQU %11100011 or c jr nz, .loop - call ClearVram + call ClearVram ; 1dc6 ld hl, $ff80 - ld bc, $ffff - $ff80 + ld bc, $fffe - $ff80 call FillMemory call ClearSprites @@ -70,6 +68,8 @@ rLCDC_DEFAULT EQU %11100011 ld [hSCX], a ld [hSCY], a ld [rIF], a + ld [wc0f3], a + ld [wc0f4], a ld a, 1 << VBLANK + 1 << TIMER + 1 << SERIAL ld [rIE], a @@ -126,12 +126,11 @@ ClearVram: StopAllSounds:: - ld a, BANK(Audio1_UpdateMusic) + ld a, $2 ld [wAudioROMBank], a ld [wAudioSavedROMBank], a xor a ld [wAudioFadeOutControl], a ld [wNewSoundID], a ld [wLastMusicSoundID], a - dec a - jp PlaySound + jp StopAllMusic diff --git a/home/joypad.asm b/home/joypad.asm deleted file mode 100644 index 2002bb29..00000000 --- a/home/joypad.asm +++ /dev/null @@ -1,39 +0,0 @@ -ReadJoypad:: -; Poll joypad input. -; Unlike the hardware register, button -; presses are indicated by a set bit. - - ld a, 1 << 5 ; select direction keys - ld c, 0 - - ld [rJOYP], a - rept 6 - ld a, [rJOYP] - endr - cpl - and %1111 - swap a - ld b, a - - ld a, 1 << 4 ; select button keys - ld [rJOYP], a - rept 10 - ld a, [rJOYP] - endr - cpl - and %1111 - or b - - ld [hJoyInput], a - - ld a, 1 << 4 + 1 << 5 ; deselect keys - ld [rJOYP], a - ret - -Joypad:: -; Update the joypad state variables: -; [hJoyReleased] keys released since last time -; [hJoyPressed] keys pressed since last time -; [hJoyHeld] currently pressed keys - homecall _Joypad - ret diff --git a/home/lcdc.asm b/home/lcdc.asm new file mode 100644 index 00000000..6172dd0d --- /dev/null +++ b/home/lcdc.asm @@ -0,0 +1,20 @@ +LCDC:: + push af + ld a, [hLCDCPointer] ; doubles as enabling byte + and a + jr z, .noLCDCInterrupt + push hl + ; [C700 + [rLY]] --> [FF00 + [hLCDCPointer]] + ld a, [rLY] + ld l, a + ld h, wLYOverrides / $100 + ld h, [hl] ; h != not part of pointer + ld a, [hLCDCPointer] + ld l, a + ld a, h + ld h, $ff + ld [hl], a + pop hl +.noLCDCInterrupt + pop af + reti diff --git a/home/overworld.asm b/home/overworld.asm index fad9f29d..0b2f527f 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -1,14 +1,9 @@ -HandleMidJump:: -; Handle the player jumping down -; a ledge in the overworld. - jpba _HandleMidJump - EnterMap:: ; Load a new map. ld a, $ff ld [wJoyIgnore], a call LoadMapData - callba ClearVariablesAfterLoadingMapData + callba ClearVariablesAfterLoadingMapData ; 3:407c ld hl, wd72c bit 0, [hl] ; has the player already made 3 steps since the last battle? jr z, .skipGivingThreeStepsOfNoRandomBattles @@ -24,11 +19,18 @@ EnterMap:: ld a, [hl] and 1 << 4 | 1 << 3 ; fly warp or dungeon warp jr z, .didNotEnterUsingFlyWarpOrDungeonWarp - res 3, [hl] callba EnterMapAnim call UpdateSprites + ld hl, wd732 + res 3, [hl] + ld hl, wd72e + res 4, [hl] .didNotEnterUsingFlyWarpOrDungeonWarp + call IsSurfingPikachuInParty callba CheckForceBikeOrSurf ; handle currents in SF islands and forced bike riding in cycling road + ld hl, wd732 + bit 4, [hl] + res 4, [hl] ld hl, wd72d res 5, [hl] call UpdateSprites @@ -42,645 +44,652 @@ OverworldLoop:: call DelayFrame OverworldLoopLessDelay:: call DelayFrame + call IsSurfingPikachuInParty call LoadGBPal - ld a,[wd736] - bit 6,a ; jumping down a ledge? - call nz, HandleMidJump - ld a,[wWalkCounter] + call HandleMidJump + ld a, [wWalkCounter] and a - jp nz,.moveAhead ; if the player sprite has not yet completed the walking animation + jp nz, .moveAhead ; if the player sprite has not yet completed the walking animation call JoypadOverworld ; get joypad state (which is possibly simulated) - callba SafariZoneCheck - ld a,[wSafariZoneGameOver] + callba SafariZoneCheck ; 7:6321 + ld a, [wSafariZoneGameOver] and a - jp nz,WarpFound2 - ld hl,wd72d - bit 3,[hl] - res 3,[hl] - jp nz,WarpFound2 - ld a,[wd732] - and a,1 << 4 | 1 << 3 ; fly warp or dungeon warp - jp nz,HandleFlyWarpOrDungeonWarp - ld a,[wCurOpponent] + jp nz, WarpFound2 + ld hl, wd72d + bit 3, [hl] + res 3, [hl] + jp nz, WarpFound2 + ld a, [wd732] + and 1 << 4 | 1 << 3 ; fly warp or dungeon warp + jp nz, HandleFlyWarpOrDungeonWarp + ld a, [wCurOpponent] and a - jp nz,.newBattle - ld a,[wd730] - bit 7,a ; are we simulating button presses? - jr z,.notSimulating - ld a,[hJoyHeld] + jp nz, .newBattle + ld a, [wd730] + bit 7, a ; are we simulating button presses? + jr z, .notSimulating + ld a, [hJoyHeld] jr .checkIfStartIsPressed + .notSimulating - ld a,[hJoyPressed] + ld a, [hJoyPressed] .checkIfStartIsPressed - bit 3,a ; start button - jr z,.startButtonNotPressed + bit 3, a ; start button + jr z, .startButtonNotPressed ; if START is pressed xor a - ld [hSpriteIndexOrTextID],a ; start menu text ID + ld [hSpriteIndexOrTextID], a ; start menu text ID jp .displayDialogue + .startButtonNotPressed - bit 0,a ; A button - jp z,.checkIfDownButtonIsPressed + bit 0, a ; A button + jp z, .checkIfDownButtonIsPressed ; if A is pressed - ld a,[wd730] - bit 2,a - jp nz,.noDirectionButtonsPressed + ld a, [wd730] + bit 2, a + jp nz, .noDirectionButtonsPressed call IsPlayerCharacterBeingControlledByGame - jr nz,.checkForOpponent + jr nz, .checkForOpponent call CheckForHiddenObjectOrBookshelfOrCardKeyDoor - ld a,[$ffeb] + ld a, [$ffeb] and a - jp z,OverworldLoop ; jump if a hidden object or bookshelf was found, but not if a card key door was found + jp z, OverworldLoop ; jump if a hidden object or bookshelf was found, but not if a card key door was found + xor a + ld [wd436], a ; new yellow address call IsSpriteOrSignInFrontOfPlayer - ld a,[hSpriteIndexOrTextID] + call Func_0ffe + ld a, [hSpriteIndexOrTextID] and a - jp z,OverworldLoop + jp z, OverworldLoop .displayDialogue predef GetTileAndCoordsInFrontOfPlayer call UpdateSprites - ld a,[wFlags_0xcd60] - bit 2,a - jr nz,.checkForOpponent - bit 0,a - jr nz,.checkForOpponent + ld a, [wFlags_0xcd60] + bit 2, a + jr nz, .checkForOpponent + bit 0, a + jr nz, .checkForOpponent aCoord 8, 9 - ld [wTilePlayerStandingOn],a ; unused? + ld [wTilePlayerStandingOn], a ; unused? call DisplayTextID ; display either the start menu or the NPC/sign text - ld a,[wEnteringCableClub] + ld a, [wEnteringCableClub] and a - jr z,.checkForOpponent - dec a - ld a,0 - ld [wEnteringCableClub],a - jr z,.changeMap -; XXX can this code be reached? - predef LoadSAV - ld a,[wCurMap] - ld [wDestinationMap],a - call SpecialWarpIn - ld a,[wCurMap] - call SwitchToMapRomBank ; switch to the ROM bank of the current map - ld hl,wCurMapTileset - set 7,[hl] -.changeMap + jr z, .checkForOpponent + xor a + ld [wLinkTimeoutCounter], a jp EnterMap + +; predef LoadSAV +; ld a, [wCurMap] +; ld [wDestinationMap], a +; call SpecialWarpIn +; ld a, [wCurMap] +; call SwitchToMapRomBank ; switch to the ROM bank of the current map +; ld hl, wCurMapTileset +; set 7, [hl] .checkForOpponent - ld a,[wCurOpponent] + ld a, [wCurOpponent] and a - jp nz,.newBattle + jp nz, .newBattle jp OverworldLoop + .noDirectionButtonsPressed - ld hl,wFlags_0xcd60 - res 2,[hl] - call UpdateSprites - ld a,1 - ld [wCheckFor180DegreeTurn],a - ld a,[wPlayerMovingDirection] ; the direction that was pressed last time + call UpdateSprites ; 231c + ld hl, wFlags_0xcd60 + res 2, [hl] + xor a + ld [wd435], a + ld a, $1 + ld [wCheckFor180DegreeTurn], a + ld a, [wPlayerMovingDirection] ; the direction that was pressed last time and a - jp z,OverworldLoop + jr z, .overworldloop ; if a direction was pressed last time - ld [wPlayerLastStopDirection],a ; save the last direction + ld [wPlayerLastStopDirection], a ; save the last direction xor a - ld [wPlayerMovingDirection],a ; zero the direction + ld [wPlayerMovingDirection], a ; zero the direction +.overworldloop jp OverworldLoop + .checkIfDownButtonIsPressed - ld a,[hJoyHeld] ; current joypad state - bit 7,a ; down button - jr z,.checkIfUpButtonIsPressed - ld a,1 - ld [wSpriteStateData1 + 3],a ; delta Y - ld a,PLAYER_DIR_DOWN + ld a, [hJoyHeld] ; current joypad state + bit 7, a ; down button + jr z, .checkIfUpButtonIsPressed + ld a, 1 + ld [wSpriteStateData1 + 3], a ; delta Y + ld a, PLAYER_DIR_DOWN jr .handleDirectionButtonPress + .checkIfUpButtonIsPressed - bit 6,a ; up button - jr z,.checkIfLeftButtonIsPressed - ld a,-1 - ld [wSpriteStateData1 + 3],a ; delta Y - ld a,PLAYER_DIR_UP + bit 6, a ; up button + jr z, .checkIfLeftButtonIsPressed + ld a, -1 + ld [wSpriteStateData1 + 3], a ; delta Y + ld a, PLAYER_DIR_UP jr .handleDirectionButtonPress + .checkIfLeftButtonIsPressed - bit 5,a ; left button - jr z,.checkIfRightButtonIsPressed - ld a,-1 - ld [wSpriteStateData1 + 5],a ; delta X - ld a,PLAYER_DIR_LEFT + bit 5, a ; left button + jr z, .checkIfRightButtonIsPressed + ld a, -1 + ld [wSpriteStateData1 + 5], a ; delta X + ld a, PLAYER_DIR_LEFT jr .handleDirectionButtonPress + .checkIfRightButtonIsPressed - bit 4,a ; right button - jr z,.noDirectionButtonsPressed - ld a,1 ; PLAYER_DIR_RIGHT - ld [wSpriteStateData1 + 5],a ; delta X + bit 4, a ; right button + jr z, .noDirectionButtonsPressed + ld a, $1 + ld [wSpriteStateData1 + 5], a + ld a, $1 .handleDirectionButtonPress - ld [wPlayerDirection],a ; new direction - ld a,[wd730] - bit 7,a ; are we simulating button presses? - jr nz,.noDirectionChange ; ignore direction changes if we are - ld a,[wCheckFor180DegreeTurn] + ld [wPlayerDirection], a ; new direction + ld a, [wd730] + bit 7, a ; are we simulating button presses? + jr nz, .noDirectionChange ; ignore direction changes if we are + ld a, [wCheckFor180DegreeTurn] and a - jr z,.noDirectionChange - ld a,[wPlayerDirection] ; new direction - ld b,a - ld a,[wPlayerLastStopDirection] ; old direction + jr z, .noDirectionChange + ld a, [wPlayerDirection] ; new direction + ld b, a + ld a, [wPlayerLastStopDirection] ; old direction cp b - jr z,.noDirectionChange -; Check whether the player did a 180-degree turn. -; It appears that this code was supposed to show the player rotate by having -; the player's sprite face an intermediate direction before facing the opposite -; direction (instead of doing an instantaneous about-face), but the intermediate -; direction is only set for a short period of time. It is unlikely for it to -; ever be visible because DelayFrame is called at the start of OverworldLoop and -; normally not enough cycles would be executed between then and the time the -; direction is set for V-blank to occur while the direction is still set. - swap a ; put old direction in upper half - or b ; put new direction in lower half - cp a,(PLAYER_DIR_DOWN << 4) | PLAYER_DIR_UP ; change dir from down to up - jr nz,.notDownToUp - ld a,PLAYER_DIR_LEFT - ld [wPlayerMovingDirection],a - jr .holdIntermediateDirectionLoop -.notDownToUp - cp a,(PLAYER_DIR_UP << 4) | PLAYER_DIR_DOWN ; change dir from up to down - jr nz,.notUpToDown - ld a,PLAYER_DIR_RIGHT - ld [wPlayerMovingDirection],a - jr .holdIntermediateDirectionLoop -.notUpToDown - cp a,(PLAYER_DIR_RIGHT << 4) | PLAYER_DIR_LEFT ; change dir from right to left - jr nz,.notRightToLeft - ld a,PLAYER_DIR_DOWN - ld [wPlayerMovingDirection],a - jr .holdIntermediateDirectionLoop -.notRightToLeft - cp a,(PLAYER_DIR_LEFT << 4) | PLAYER_DIR_RIGHT ; change dir from left to right - jr nz,.holdIntermediateDirectionLoop - ld a,PLAYER_DIR_UP - ld [wPlayerMovingDirection],a -.holdIntermediateDirectionLoop - ld hl,wFlags_0xcd60 - set 2,[hl] - ld hl,wCheckFor180DegreeTurn - dec [hl] - jr nz,.holdIntermediateDirectionLoop - ld a,[wPlayerDirection] - ld [wPlayerMovingDirection],a + jr z, .noDirectionChange + ld a, $8 + ld [wd435], a +; unlike in red/blue, yellow does not have the 180 degrees odd code + ld hl, wFlags_0xcd60 + set 2, [hl] + xor a + ld [wCheckFor180DegreeTurn], a + ld a, [wPlayerDirection] + ld [wPlayerMovingDirection], a call NewBattle - jp c,.battleOccurred + jp c, .battleOccurred jp OverworldLoop + .noDirectionChange - ld a,[wPlayerDirection] ; current direction - ld [wPlayerMovingDirection],a ; save direction + ld a, [wPlayerDirection] ; current direction + ld [wPlayerMovingDirection], a ; save direction call UpdateSprites - ld a,[wWalkBikeSurfState] - cp a,$02 ; surfing - jr z,.surfing + ld a, [wWalkBikeSurfState] + cp $02 ; surfing + jr z, .surfing ; not surfing call CollisionCheckOnLand - jr nc,.noCollision + jr nc, .noCollision ; collision occurred push hl - ld hl,wd736 - bit 2,[hl] ; standing on warp flag + ld hl, wd736 + bit 2, [hl] ; standing on warp flag pop hl - jp z,OverworldLoop + jp z, OverworldLoop ; collision occurred while standing on a warp push hl call ExtraWarpCheck ; sets carry if there is a potential to warp pop hl - jp c,CheckWarpsCollision + jp c, CheckWarpsCollision jp OverworldLoop + .surfing call CollisionCheckOnWater - jp c,OverworldLoop + jp c, OverworldLoop .noCollision - ld a,$08 - ld [wWalkCounter],a + ld a, $08 + ld [wWalkCounter], a + callab Func_fcc08 jr .moveAhead2 + .moveAhead - ld a,[wd736] - bit 7,a - jr z,.noSpinning - callba LoadSpinnerArrowTiles ; spin while moving -.noSpinning - call UpdateSprites + call IsSpinning + call UpdateSprites ; move sprites .moveAhead2 - ld hl,wFlags_0xcd60 - res 2,[hl] - ld a,[wWalkBikeSurfState] - dec a ; riding a bike? - jr nz,.normalPlayerSpriteAdvancement - ld a,[wd736] - bit 6,a ; jumping a ledge? - jr nz,.normalPlayerSpriteAdvancement - call BikeSpeedup ; if riding a bike and not jumping a ledge -.normalPlayerSpriteAdvancement + ld hl, wFlags_0xcd60 + res 2, [hl] + xor a + ld [wd435], a + call DoBikeSpeedup call AdvancePlayerSprite - ld a,[wWalkCounter] + ld a, [wWalkCounter] and a - jp nz,CheckMapConnections ; it seems like this check will never succeed (the other place where CheckMapConnections is run works) + jp nz, CheckMapConnections ; it seems like this check will never succeed (the other place where CheckMapConnections is run works) ; walking animation finished - ld a,[wd730] - bit 7,a - jr nz,.doneStepCounting ; if button presses are being simulated, don't count steps -; step counting - ld hl,wStepCounter - dec [hl] - ld a,[wd72c] - bit 0,a - jr z,.doneStepCounting - ld hl,wNumberOfNoRandomBattleStepsLeft - dec [hl] - jr nz,.doneStepCounting - ld hl,wd72c - res 0,[hl] ; indicate that the player has stepped thrice since the last battle -.doneStepCounting - CheckEvent EVENT_IN_SAFARI_ZONE - jr z,.notSafariZone + call StepCountCheck + CheckEvent EVENT_IN_SAFARI_ZONE ; in the safari zone? + jr z, .notSafariZone callba SafariZoneCheckSteps - ld a,[wSafariZoneGameOver] + ld a, [wSafariZoneGameOver] and a - jp nz,WarpFound2 + jp nz, WarpFound2 .notSafariZone - ld a,[wIsInBattle] + ld a, [wIsInBattle] and a - jp nz,CheckWarpsNoCollision + jp nz, CheckWarpsNoCollision predef ApplyOutOfBattlePoisonDamage ; also increment daycare mon exp - ld a,[wOutOfBattleBlackout] + ld a, [wOutOfBattleBlackout] and a - jp nz,HandleBlackOut ; if all pokemon fainted + jp nz, HandleBlackOut ; if all pokemon fainted .newBattle call NewBattle - ld hl,wd736 - res 2,[hl] ; standing on warp flag - jp nc,CheckWarpsNoCollision ; check for warps if there was no battle + ld hl, wd736 + res 2, [hl] ; standing on warp flag + jp nc, CheckWarpsNoCollision ; check for warps if there was no battle .battleOccurred - ld hl,wd72d - res 6,[hl] - ld hl,wFlags_D733 - res 3,[hl] - ld hl,wCurrentMapScriptFlags - set 5,[hl] - set 6,[hl] + ld hl, wd72d + res 6, [hl] + ld hl, wFlags_D733 + res 3, [hl] + ld hl, wCurrentMapScriptFlags + set 5, [hl] + set 6, [hl] xor a - ld [hJoyHeld],a - ld a,[wCurMap] - cp a,CINNABAR_GYM - jr nz,.notCinnabarGym + ld [hJoyHeld], a + ld a, [wCurMap] + cp CINNABAR_GYM + jr nz, .notCinnabarGym SetEvent EVENT_2A7 .notCinnabarGym - ld hl,wd72e - set 5,[hl] - ld a,[wCurMap] - cp a,OAKS_LAB - jp z,.noFaintCheck ; no blacking out if the player lost to the rival in Oak's lab + ld hl, wd72e + set 5, [hl] + ld a, [wCurMap] + cp OAKS_LAB + jp z, .noFaintCheck ; no blacking out if the player lost to the rival in Oak's lab callab AnyPartyAlive - ld a,d + ld a, d and a - jr z,.allPokemonFainted + jr z, AllPokemonFainted .noFaintCheck - ld c,10 + ld c, 10 call DelayFrames jp EnterMap -.allPokemonFainted - ld a,$ff - ld [wIsInBattle],a + +StepCountCheck:: + ld a, [wd730] + bit 7, a + jr nz, .doneStepCounting ; if button presses are being simulated, don't count steps +; step counting + ld hl, wStepCounter + dec [hl] + ld a, [wd72c] + bit 0, a + jr z, .doneStepCounting + ld hl, wNumberOfNoRandomBattleStepsLeft + dec [hl] + jr nz, .doneStepCounting + ld hl, wd72c + res 0, [hl] ; indicate that the player has stepped thrice since the last battle +.doneStepCounting + ret + +AllPokemonFainted:: + ld a, $ff + ld [wIsInBattle], a call RunMapScript jp HandleBlackOut ; function to determine if there will be a battle and execute it (either a trainer battle or wild battle) ; sets carry if a battle occurred and unsets carry if not NewBattle:: - ld a,[wd72d] - bit 4,a - jr nz,.noBattle + ld a, [wd72d] + bit 4, a + jr nz, .noBattle call IsPlayerCharacterBeingControlledByGame - jr nz,.noBattle ; no battle if the player character is under the game's control - ld a,[wd72e] - bit 4,a - jr nz,.noBattle - jpba InitBattle + jr nz, .noBattle ; no battle if the player character is under the game's control + ld a, [wd72e] + bit 4, a + jr nz, .noBattle + jpba InitBattle ; 3d:5ff2 .noBattle and a ret -; function to make bikes twice as fast as walking -BikeSpeedup:: - ld a,[wNPCMovementScriptPointerTableNum] +DoBikeSpeedup:: + ld a, [wWalkBikeSurfState] + dec a ; riding a bike? + ret nz + ld a, [wd736] + bit 6, a + ret nz + ld a, [wNPCMovementScriptPointerTableNum] and a ret nz - ld a,[wCurMap] - cp a,ROUTE_17 ; Cycling Road - jr nz,.goFaster - ld a,[hJoyHeld] - and a,D_UP | D_LEFT | D_RIGHT + ld a, [wCurMap] + cp ROUTE_17 ; cycling road + jr nz, .goFaster + ld a, [hJoyHeld] + and D_UP | D_LEFT | D_RIGHT ret nz .goFaster - jp AdvancePlayerSprite + call AdvancePlayerSprite + ret ; check if the player has stepped onto a warp after having not collided CheckWarpsNoCollision:: - ld a,[wNumberOfWarps] + ld a, [wNumberOfWarps] and a - jp z,CheckMapConnections - ld a,[wNumberOfWarps] - ld b,0 - ld c,a - ld a,[wYCoord] - ld d,a - ld a,[wXCoord] - ld e,a - ld hl,wWarpEntries + jp z, CheckMapConnections + ld b, 0 + ld a, [wNumberOfWarps] + ld c, a + ld a, [wYCoord] + ld d, a + ld a, [wXCoord] + ld e, a + ld hl, wWarpEntries CheckWarpsNoCollisionLoop:: - ld a,[hli] ; check if the warp's Y position matches + ld a, [hli] ; check if the warp's Y position matches cp d - jr nz,CheckWarpsNoCollisionRetry1 - ld a,[hli] ; check if the warp's X position matches + jr nz, CheckWarpsNoCollisionRetry1 + ld a, [hli] ; check if the warp's X position matches cp e - jr nz,CheckWarpsNoCollisionRetry2 + jr nz, CheckWarpsNoCollisionRetry2 ; if a match was found push hl push bc - ld hl,wd736 - set 2,[hl] ; standing on warp flag + ld hl, wd736 + set 2, [hl] ; standing on warp flag callba IsPlayerStandingOnDoorTileOrWarpTile pop bc pop hl - jr c,WarpFound1 ; jump if standing on door or warp + jr c, WarpFound1 ; jump if standing on door or warp push hl push bc call ExtraWarpCheck pop bc pop hl - jr nc,CheckWarpsNoCollisionRetry2 + jr nc, CheckWarpsNoCollisionRetry2 ; if the extra check passed - ld a,[wFlags_D733] - bit 2,a - jr nz,WarpFound1 + ld a, [wFlags_D733] + bit 2, a + jr nz, WarpFound1 push de push bc call Joypad pop bc pop de - ld a,[hJoyHeld] - and a,D_DOWN | D_UP | D_LEFT | D_RIGHT - jr z,CheckWarpsNoCollisionRetry2 ; if directional buttons aren't being pressed, do not pass through the warp + ld a, [hJoyHeld] + and D_DOWN | D_UP | D_LEFT | D_RIGHT + jr z, CheckWarpsNoCollisionRetry2 ; if directional buttons aren't being pressed, do not pass through the warp jr WarpFound1 +CheckWarpsNoCollisionRetry1:: + inc hl +CheckWarpsNoCollisionRetry2:: + inc hl + inc hl +ContinueCheckWarpsNoCollisionLoop:: + inc b ; increment warp number + dec c ; decrement number of warps + jp nz, CheckWarpsNoCollisionLoop + jp CheckMapConnections + ; check if the player has stepped onto a warp after having collided CheckWarpsCollision:: - ld a,[wNumberOfWarps] - ld c,a - ld hl,wWarpEntries + ld a, [wNumberOfWarps] + ld c, a + ld hl, wWarpEntries .loop - ld a,[hli] ; Y coordinate of warp - ld b,a - ld a,[wYCoord] + ld a, [hli] ; Y coordinate of warp + ld b, a + ld a, [wYCoord] cp b - jr nz,.retry1 - ld a,[hli] ; X coordinate of warp - ld b,a - ld a,[wXCoord] + jr nz, .retry1 + ld a, [hli] ; X coordinate of warp + ld b, a + ld a, [wXCoord] cp b - jr nz,.retry2 - ld a,[hli] - ld [wDestinationWarpID],a - ld a,[hl] - ld [hWarpDestinationMap],a + jr nz, .retry2 + ld a, [hli] + ld [wDestinationWarpID], a + ld a, [hl] + ld [hWarpDestinationMap], a jr WarpFound2 + .retry1 inc hl .retry2 inc hl inc hl dec c - jr nz,.loop + jr nz, .loop jp OverworldLoop -CheckWarpsNoCollisionRetry1:: - inc hl -CheckWarpsNoCollisionRetry2:: - inc hl - inc hl - jp ContinueCheckWarpsNoCollisionLoop - WarpFound1:: - ld a,[hli] - ld [wDestinationWarpID],a - ld a,[hli] - ld [hWarpDestinationMap],a + ld a, [hli] + ld [wDestinationWarpID], a + ld a, [hli] + ld [hWarpDestinationMap], a WarpFound2:: - ld a,[wNumberOfWarps] + ld a, [wNumberOfWarps] sub c - ld [wWarpedFromWhichWarp],a ; save ID of used warp - ld a,[wCurMap] - ld [wWarpedFromWhichMap],a + ld [wWarpedFromWhichWarp], a ; save ID of used warp + ld a, [wCurMap] + ld [wWarpedFromWhichMap], a call CheckIfInOutsideMap - jr nz,.indoorMaps + jr nz, .indoorMaps ; this is for handling "outside" maps that can't have the 0xFF destination map - ld a,[wCurMap] - ld [wLastMap],a - ld a,[wCurMapWidth] - ld [wUnusedD366],a ; not read - ld a,[hWarpDestinationMap] - ld [wCurMap],a - cp a,ROCK_TUNNEL_1 - jr nz,.notRockTunnel - ld a,$06 - ld [wMapPalOffset],a + ld a, [wCurMap] + ld [wLastMap], a + ld a, [wCurMapWidth] + ld [wUnusedD366], a ; not read + ld a, [hWarpDestinationMap] + ld [wCurMap], a + cp ROCK_TUNNEL_1 + jr nz, .notRockTunnel + ld a, $06 + ld [wMapPalOffset], a call GBFadeOutToBlack .notRockTunnel + callab CalculatePikachuSpawnState1 ; 3f:45fa call PlayMapChangeSound jr .done -; for maps that can have the 0xFF destination map, which means to return to the outside map; not all these maps are necessarily indoors, though + +; for maps that can have the 0xFF destination map, which means to return to the outside map +; not all these maps are necessarily indoors, though .indoorMaps - ld a,[hWarpDestinationMap] ; destination map - cp a,$ff - jr z,.goBackOutside + ld a, [hWarpDestinationMap] ; destination map + cp $ff + jr z, .goBackOutside ; if not going back to the previous map - ld [wCurMap],a + ld [wCurMap], a callba IsPlayerStandingOnWarpPadOrHole - ld a,[wStandingOnWarpPadOrHole] + ld a, [wStandingOnWarpPadOrHole] dec a ; is the player on a warp pad? - jr nz,.notWarpPad + jr nz, .notWarpPad ; if the player is on a warp pad - ld hl,wd732 - set 3,[hl] call LeaveMapAnim + ld hl, wd732 + set 3, [hl] jr .skipMapChangeSound + .notWarpPad call PlayMapChangeSound .skipMapChangeSound - ld hl,wd736 - res 0,[hl] - res 1,[hl] + ld hl, wd736 + res 0, [hl] + res 1, [hl] + callab CalculatePikachuSpawnState2 ; 3f:465b jr .done + .goBackOutside - ld a,[wLastMap] - ld [wCurMap],a + callab CalculatePikachuSpawnState3 ; 3f:469a + ld a, [wLastMap] + ld [wCurMap], a call PlayMapChangeSound xor a - ld [wMapPalOffset],a + ld [wMapPalOffset], a .done - ld hl,wd736 - set 0,[hl] ; have the player's sprite step out from the door (if there is one) + ld hl, wd736 + set 0, [hl] ; have the player's sprite step out from the door (if there is one) call IgnoreInputForHalfSecond jp EnterMap -ContinueCheckWarpsNoCollisionLoop:: - inc b ; increment warp number - dec c ; decrement number of warps - jp nz,CheckWarpsNoCollisionLoop - ; if no matching warp was found CheckMapConnections:: .checkWestMap - ld a,[wXCoord] - cp a,$ff - jr nz,.checkEastMap - ld a,[wMapConn3Ptr] - ld [wCurMap],a - ld a,[wWestConnectedMapXAlignment] ; new X coordinate upon entering west map - ld [wXCoord],a - ld a,[wYCoord] - ld c,a - ld a,[wWestConnectedMapYAlignment] ; Y adjustment upon entering west map + ld a, [wXCoord] + cp $ff + jr nz, .checkEastMap + ld a, [wMapConn3Ptr] + ld [wCurMap], a + ld a, [wWestConnectedMapXAlignment] ; new X coordinate upon entering west map + ld [wXCoord], a + ld a, [wYCoord] + ld c, a + ld a, [wWestConnectedMapYAlignment] ; Y adjustment upon entering west map add c - ld c,a - ld [wYCoord],a - ld a,[wWestConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for Y position - ld l,a - ld a,[wWestConnectedMapViewPointer + 1] - ld h,a + ld c, a + ld [wYCoord], a + ld a, [wWestConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for Y position + ld l, a + ld a, [wWestConnectedMapViewPointer + 1] + ld h, a srl c - jr z,.savePointer1 + jr z, .savePointer1 .pointerAdjustmentLoop1 - ld a,[wWestConnectedMapWidth] ; width of connected map - add a,MAP_BORDER * 2 - ld e,a - ld d,0 - ld b,0 - add hl,de + ld a, [wWestConnectedMapWidth] ; width of connected map + add MAP_BORDER * 2 + ld e, a + ld d, 0 + ld b, 0 + add hl, de dec c - jr nz,.pointerAdjustmentLoop1 + jr nz, .pointerAdjustmentLoop1 .savePointer1 - ld a,l - ld [wCurrentTileBlockMapViewPointer],a ; pointer to upper left corner of current tile block map section - ld a,h - ld [wCurrentTileBlockMapViewPointer + 1],a + ld a, l + ld [wCurrentTileBlockMapViewPointer], a ; pointer to upper left corner of current tile block map section + ld a, h + ld [wCurrentTileBlockMapViewPointer + 1], a jp .loadNewMap + .checkEastMap - ld b,a - ld a,[wCurrentMapWidth2] ; map width + ld b, a + ld a, [wCurrentMapWidth2] ; map width cp b - jr nz,.checkNorthMap - ld a,[wMapConn4Ptr] - ld [wCurMap],a - ld a,[wEastConnectedMapXAlignment] ; new X coordinate upon entering east map - ld [wXCoord],a - ld a,[wYCoord] - ld c,a - ld a,[wEastConnectedMapYAlignment] ; Y adjustment upon entering east map + jr nz, .checkNorthMap + ld a, [wMapConn4Ptr] + ld [wCurMap], a + ld a, [wEastConnectedMapXAlignment] ; new X coordinate upon entering east map + ld [wXCoord], a + ld a, [wYCoord] + ld c, a + ld a, [wEastConnectedMapYAlignment] ; Y adjustment upon entering east map add c - ld c,a - ld [wYCoord],a - ld a,[wEastConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for Y position - ld l,a - ld a,[wEastConnectedMapViewPointer + 1] - ld h,a + ld c, a + ld [wYCoord], a + ld a, [wEastConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for Y position + ld l, a + ld a, [wEastConnectedMapViewPointer + 1] + ld h, a srl c - jr z,.savePointer2 + jr z, .savePointer2 .pointerAdjustmentLoop2 - ld a,[wEastConnectedMapWidth] - add a,MAP_BORDER * 2 - ld e,a - ld d,0 - ld b,0 - add hl,de + ld a, [wEastConnectedMapWidth] + add MAP_BORDER * 2 + ld e, a + ld d, 0 + ld b, 0 + add hl, de dec c - jr nz,.pointerAdjustmentLoop2 + jr nz, .pointerAdjustmentLoop2 .savePointer2 - ld a,l - ld [wCurrentTileBlockMapViewPointer],a ; pointer to upper left corner of current tile block map section - ld a,h - ld [wCurrentTileBlockMapViewPointer + 1],a + ld a, l + ld [wCurrentTileBlockMapViewPointer], a ; pointer to upper left corner of current tile block map section + ld a, h + ld [wCurrentTileBlockMapViewPointer + 1], a jp .loadNewMap + .checkNorthMap - ld a,[wYCoord] - cp a,$ff - jr nz,.checkSouthMap - ld a,[wMapConn1Ptr] - ld [wCurMap],a - ld a,[wNorthConnectedMapYAlignment] ; new Y coordinate upon entering north map - ld [wYCoord],a - ld a,[wXCoord] - ld c,a - ld a,[wNorthConnectedMapXAlignment] ; X adjustment upon entering north map + ld a, [wYCoord] + cp $ff + jr nz, .checkSouthMap + ld a, [wMapConn1Ptr] + ld [wCurMap], a + ld a, [wNorthConnectedMapYAlignment] ; new Y coordinate upon entering north map + ld [wYCoord], a + ld a, [wXCoord] + ld c, a + ld a, [wNorthConnectedMapXAlignment] ; X adjustment upon entering north map add c - ld c,a - ld [wXCoord],a - ld a,[wNorthConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for X position - ld l,a - ld a,[wNorthConnectedMapViewPointer + 1] - ld h,a - ld b,0 + ld c, a + ld [wXCoord], a + ld a, [wNorthConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for X position + ld l, a + ld a, [wNorthConnectedMapViewPointer + 1] + ld h, a + ld b, 0 srl c - add hl,bc - ld a,l - ld [wCurrentTileBlockMapViewPointer],a ; pointer to upper left corner of current tile block map section - ld a,h - ld [wCurrentTileBlockMapViewPointer + 1],a + add hl, bc + ld a, l + ld [wCurrentTileBlockMapViewPointer], a ; pointer to upper left corner of current tile block map section + ld a, h + ld [wCurrentTileBlockMapViewPointer + 1], a jp .loadNewMap + .checkSouthMap - ld b,a - ld a,[wCurrentMapHeight2] + ld b, a + ld a, [wCurrentMapHeight2] cp b - jr nz,.didNotEnterConnectedMap - ld a,[wMapConn2Ptr] - ld [wCurMap],a - ld a,[wSouthConnectedMapYAlignment] ; new Y coordinate upon entering south map - ld [wYCoord],a - ld a,[wXCoord] - ld c,a - ld a,[wSouthConnectedMapXAlignment] ; X adjustment upon entering south map + jr nz, .didNotEnterConnectedMap + ld a, [wMapConn2Ptr] + ld [wCurMap], a + ld a, [wSouthConnectedMapYAlignment] ; new Y coordinate upon entering south map + ld [wYCoord], a + ld a, [wXCoord] + ld c, a + ld a, [wSouthConnectedMapXAlignment] ; X adjustment upon entering south map add c - ld c,a - ld [wXCoord],a - ld a,[wSouthConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for X position - ld l,a - ld a,[wSouthConnectedMapViewPointer + 1] - ld h,a - ld b,0 + ld c, a + ld [wXCoord], a + ld a, [wSouthConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for X position + ld l, a + ld a, [wSouthConnectedMapViewPointer + 1] + ld h, a + ld b, 0 srl c - add hl,bc - ld a,l - ld [wCurrentTileBlockMapViewPointer],a ; pointer to upper left corner of current tile block map section - ld a,h - ld [wCurrentTileBlockMapViewPointer + 1],a -.loadNewMap ; load the connected map that was entered - call LoadMapHeader - call PlayDefaultMusicFadeOutCurrent + add hl, bc + ld a, l + ld [wCurrentTileBlockMapViewPointer], a ; pointer to upper left corner of current tile block map section + ld a, h + ld [wCurrentTileBlockMapViewPointer + 1], a +.loadNewMap ; 06ce (0:06ce) +; load the connected map that was entered + ld hl, wPikachuOverworldStateFlags + set 4, [hl] + ld a, $2 + ld [wPikachuSpawnState], a + call LoadMapHeader ; 0dab (0:0dab) + call PlayDefaultMusicFadeOutCurrent ; music ld b, SET_PAL_OVERWORLD call RunPaletteCommand ; Since the sprite set shouldn't change, this will just update VRAM slots at ; $C2XE without loading any tile patterns. - callba InitMapSprites + call InitMapSprites call LoadTileBlockMap jp OverworldLoopLessDelay + .didNotEnterConnectedMap jp OverworldLoop ; function to play a sound when changing maps PlayMapChangeSound:: + ld a, [wCurMapTileset] + cp FACILITY + jr z, .didNotGoThroughDoor + cp CEMETERY + jr z, .didNotGoThroughDoor aCoord 8, 8 ; upper left tile of the 4x4 square the player's sprite is standing on - cp a,$0b ; door tile in tileset 0 - jr nz,.didNotGoThroughDoor - ld a,SFX_GO_INSIDE + cp UNDERGROUND ; door tile in tileset 0 + jr nz, .didNotGoThroughDoor + ld a, $ad ; SFX_GO_INSIDE jr .playSound + .didNotGoThroughDoor - ld a,SFX_GO_OUTSIDE + ld a, $b5 ; SFX_GO_OUTSIDE .playSound call PlaySound - ld a,[wMapPalOffset] + ld a, [wMapPalOffset] and a ret nz jp GBFadeOutToBlack @@ -723,6 +732,7 @@ ExtraWarpCheck:: .useFunction1 ld hl, IsPlayerFacingEdgeOfMap jr .doBankswitch + .useFunction2 ld hl, IsWarpTileInFrontOfPlayer .doBankswitch @@ -731,9 +741,9 @@ ExtraWarpCheck:: MapEntryAfterBattle:: callba IsPlayerStandingOnWarp ; for enabling warp testing after collisions - ld a,[wMapPalOffset] + ld a, [wMapPalOffset] and a - jp z,GBFadeInFromWhite + jp z, GBFadeInFromWhite jp LoadGBPal HandleBlackOut:: @@ -745,19 +755,15 @@ HandleBlackOut:: call StopMusic ld hl, wd72e res 5, [hl] - ld a, Bank(ResetStatusAndHalveMoneyOnBlackout) ; also Bank(SpecialWarpIn) and Bank(SpecialEnterMap) - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a - call ResetStatusAndHalveMoneyOnBlackout + switchbank SpecialWarpIn ; also Bank(SpecialEnterMap) + callab ResetStatusAndHalveMoneyOnBlackout ; 3c:4274 call SpecialWarpIn call PlayDefaultMusicFadeOutCurrent jp SpecialEnterMap StopMusic:: ld [wAudioFadeOutControl], a - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic .wait ld a, [wAudioFadeOutControl] and a @@ -769,22 +775,31 @@ HandleFlyWarpOrDungeonWarp:: call Delay3 xor a ld [wBattleResult], a - ld [wWalkBikeSurfState], a ld [wIsInBattle], a ld [wMapPalOffset], a ld hl, wd732 set 2, [hl] ; fly warp or dungeon warp res 5, [hl] ; forced to ride bike call LeaveMapAnim - ld a, Bank(SpecialWarpIn) - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a - call SpecialWarpIn + call Func_07c4 + callbs SpecialWarpIn jp SpecialEnterMap LeaveMapAnim:: jpba _LeaveMapAnim +Func_07c4:: + ld a, [wWalkBikeSurfState] + and a + ret z + xor a + ld [wWalkBikeSurfState], a + ld hl, wd732 + bit 4, [hl] + ret z + call PlayDefaultMusic + ret + LoadPlayerSpriteGraphics:: ; Load sprite graphics based on whether the player is standing, biking, or surfing. @@ -820,7 +835,7 @@ LoadPlayerSpriteGraphics:: dec a jp z, LoadBikePlayerSpriteGraphics dec a - jp z, LoadSurfingPlayerSpriteGraphics + jp z, LoadSurfingPlayerSpriteGraphics2 jp LoadWalkingPlayerSpriteGraphics IsBikeRidingAllowed:: @@ -854,384 +869,412 @@ INCLUDE "data/bike_riding_tilesets.asm" ; load the tile pattern data of the current tileset into VRAM LoadTilesetTilePatternData:: - ld a,[wTileSetGFXPtr] - ld l,a - ld a,[wTileSetGFXPtr + 1] - ld h,a - ld de,vTileset - ld bc,$600 - ld a,[wTileSetBank] - jp FarCopyData2 + ld a, [wTilesetGFXPtr] + ld l, a + ld a, [wTilesetGFXPtr + 1] + ld h, a + ld de, vTileset + ld bc, $600 + ld a, [wTilesetBank] + jp FarCopyData ; this loads the current maps complete tile map (which references blocks, not individual tiles) to C6E8 ; it can also load partial tile maps of connected maps into a border of length 3 around the current map LoadTileBlockMap:: ; fill C6E8-CBFB with the background tile - ld hl,wOverworldMap - ld a,[wMapBackgroundTile] - ld d,a - ld bc,$0514 -.backgroundTileLoop - ld a,d - ld [hli],a - dec bc - ld a,c - or b - jr nz,.backgroundTileLoop + ld hl, wOverworldMap + ld bc, $0514 + ld a, [wMapBackgroundTile] ; background tile number + call FillMemory ; load tile map of current map (made of tile block IDs) ; a 3-byte border at the edges of the map is kept so that there is space for map connections - ld hl,wOverworldMap - ld a,[wCurMapWidth] - ld [hMapWidth],a - add a,MAP_BORDER * 2 ; east and west - ld [hMapStride],a ; map width + border - ld b,0 - ld c,a + ld hl, wOverworldMap + ld a, [wCurMapWidth] + ld [hMapWidth], a + add MAP_BORDER * 2 ; east and west + ld [hMapStride], a ; map width + border + ld b, 0 + ld c, a ; make space for north border (next 3 lines) - add hl,bc - add hl,bc - add hl,bc - ld c,MAP_BORDER - add hl,bc ; this puts us past the (west) border - ld a,[wMapDataPtr] ; tile map pointer - ld e,a - ld a,[wMapDataPtr + 1] - ld d,a ; de = tile map pointer - ld a,[wCurMapHeight] - ld b,a + add hl, bc + add hl, bc + add hl, bc + ld c, MAP_BORDER + add hl, bc ; this puts us past the (west) border + ld a, [wMapDataPtr] ; tile map pointer + ld e, a + ld a, [wMapDataPtr + 1] + ld d, a ; de = tile map pointer + ld a, [wCurMapHeight] + ld b, a .rowLoop ; copy one row each iteration push hl - ld a,[hMapWidth] ; map width (without border) - ld c,a + ld a, [hMapWidth] ; map width (without border) + ld c, a .rowInnerLoop - ld a,[de] + ld a, [de] inc de - ld [hli],a + ld [hli], a dec c - jr nz,.rowInnerLoop + jr nz, .rowInnerLoop ; add the map width plus the border to the base address of the current row to get the next row's address pop hl - ld a,[hMapStride] ; map width + border + ld a, [hMapStride] ; map width + border add l - ld l,a - jr nc,.noCarry + ld l, a + jr nc, .noCarry inc h .noCarry dec b - jr nz,.rowLoop + jr nz, .rowLoop .northConnection - ld a,[wMapConn1Ptr] - cp a,$ff - jr z,.southConnection + ld a, [wMapConn1Ptr] + cp $ff + jr z, .southConnection call SwitchToMapRomBank - ld a,[wNorthConnectionStripSrc] - ld l,a - ld a,[wNorthConnectionStripSrc + 1] - ld h,a - ld a,[wNorthConnectionStripDest] - ld e,a - ld a,[wNorthConnectionStripDest + 1] - ld d,a - ld a,[wNorthConnectionStripWidth] - ld [hNorthSouthConnectionStripWidth],a - ld a,[wNorthConnectedMapWidth] - ld [hNorthSouthConnectedMapWidth],a + ld a, [wNorthConnectionStripSrc] + ld l, a + ld a, [wNorthConnectionStripSrc + 1] + ld h, a + ld a, [wNorthConnectionStripDest] + ld e, a + ld a, [wNorthConnectionStripDest + 1] + ld d, a + ld a, [wNorthConnectionStripWidth] + ld [hNorthSouthConnectionStripWidth], a + ld a, [wNorthConnectedMapWidth] + ld [hNorthSouthConnectedMapWidth], a call LoadNorthSouthConnectionsTileMap .southConnection - ld a,[wMapConn2Ptr] - cp a,$ff - jr z,.westConnection + ld a, [wMapConn2Ptr] + cp $ff + jr z, .westConnection call SwitchToMapRomBank - ld a,[wSouthConnectionStripSrc] - ld l,a - ld a,[wSouthConnectionStripSrc + 1] - ld h,a - ld a,[wSouthConnectionStripDest] - ld e,a - ld a,[wSouthConnectionStripDest + 1] - ld d,a - ld a,[wSouthConnectionStripWidth] - ld [hNorthSouthConnectionStripWidth],a - ld a,[wSouthConnectedMapWidth] - ld [hNorthSouthConnectedMapWidth],a + ld a, [wSouthConnectionStripSrc] + ld l, a + ld a, [wSouthConnectionStripSrc + 1] + ld h, a + ld a, [wSouthConnectionStripDest] + ld e, a + ld a, [wSouthConnectionStripDest + 1] + ld d, a + ld a, [wSouthConnectionStripWidth] + ld [hNorthSouthConnectionStripWidth], a + ld a, [wSouthConnectedMapWidth] + ld [hNorthSouthConnectedMapWidth], a call LoadNorthSouthConnectionsTileMap .westConnection - ld a,[wMapConn3Ptr] - cp a,$ff - jr z,.eastConnection + ld a, [wMapConn3Ptr] + cp $ff + jr z, .eastConnection call SwitchToMapRomBank - ld a,[wWestConnectionStripSrc] - ld l,a - ld a,[wWestConnectionStripSrc + 1] - ld h,a - ld a,[wWestConnectionStripDest] - ld e,a - ld a,[wWestConnectionStripDest + 1] - ld d,a - ld a,[wWestConnectionStripHeight] - ld b,a - ld a,[wWestConnectedMapWidth] - ld [hEastWestConnectedMapWidth],a + ld a, [wWestConnectionStripSrc] + ld l, a + ld a, [wWestConnectionStripSrc + 1] + ld h, a + ld a, [wWestConnectionStripDest] + ld e, a + ld a, [wWestConnectionStripDest + 1] + ld d, a + ld a, [wWestConnectionStripHeight] + ld b, a + ld a, [wWestConnectedMapWidth] + ld [hEastWestConnectedMapWidth], a call LoadEastWestConnectionsTileMap .eastConnection - ld a,[wMapConn4Ptr] - cp a,$ff - jr z,.done + ld a, [wMapConn4Ptr] + cp $ff + jr z, .done call SwitchToMapRomBank - ld a,[wEastConnectionStripSrc] - ld l,a - ld a,[wEastConnectionStripSrc + 1] - ld h,a - ld a,[wEastConnectionStripDest] - ld e,a - ld a,[wEastConnectionStripDest + 1] - ld d,a - ld a,[wEastConnectionStripHeight] - ld b,a - ld a,[wEastConnectedMapWidth] - ld [hEastWestConnectedMapWidth],a + ld a, [wEastConnectionStripSrc] + ld l, a + ld a, [wEastConnectionStripSrc + 1] + ld h, a + ld a, [wEastConnectionStripDest] + ld e, a + ld a, [wEastConnectionStripDest + 1] + ld d, a + ld a, [wEastConnectionStripHeight] + ld b, a + ld a, [wEastConnectedMapWidth] + ld [hEastWestConnectedMapWidth], a call LoadEastWestConnectionsTileMap .done ret LoadNorthSouthConnectionsTileMap:: - ld c,MAP_BORDER + ld c, MAP_BORDER .loop push de push hl - ld a,[hNorthSouthConnectionStripWidth] - ld b,a + ld a, [hNorthSouthConnectionStripWidth] + ld b, a .innerLoop - ld a,[hli] - ld [de],a + ld a, [hli] + ld [de], a inc de dec b - jr nz,.innerLoop + jr nz, .innerLoop pop hl pop de - ld a,[hNorthSouthConnectedMapWidth] + ld a, [hNorthSouthConnectedMapWidth] add l - ld l,a - jr nc,.noCarry1 + ld l, a + jr nc, .noCarry1 inc h .noCarry1 - ld a,[wCurMapWidth] - add a,MAP_BORDER * 2 + ld a, [wCurMapWidth] + add MAP_BORDER * 2 add e - ld e,a - jr nc,.noCarry2 + ld e, a + jr nc, .noCarry2 inc d .noCarry2 dec c - jr nz,.loop + jr nz, .loop ret LoadEastWestConnectionsTileMap:: push hl push de - ld c,MAP_BORDER + ld c, MAP_BORDER .innerLoop - ld a,[hli] - ld [de],a + ld a, [hli] + ld [de], a inc de dec c - jr nz,.innerLoop + jr nz, .innerLoop pop de pop hl - ld a,[hEastWestConnectedMapWidth] + ld a, [hEastWestConnectedMapWidth] add l - ld l,a - jr nc,.noCarry1 + ld l, a + jr nc, .noCarry1 inc h .noCarry1 - ld a,[wCurMapWidth] - add a,MAP_BORDER * 2 + ld a, [wCurMapWidth] + add MAP_BORDER * 2 add e - ld e,a - jr nc,.noCarry2 + ld e, a + jr nc, .noCarry2 inc d .noCarry2 dec b - jr nz,LoadEastWestConnectionsTileMap + jr nz, LoadEastWestConnectionsTileMap ret ; function to check if there is a sign or sprite in front of the player -; if so, it is stored in [hSpriteIndexOrTextID] -; if not, [hSpriteIndexOrTextID] is set to 0 +; if so, carry is set. otherwise, carry is cleared IsSpriteOrSignInFrontOfPlayer:: xor a - ld [hSpriteIndexOrTextID],a - ld a,[wNumSigns] + ld [hSpriteIndexOrTextID], a + ld a, [wNumSigns] and a - jr z,.extendRangeOverCounter + jr z, .extendRangeOverCounter ; if there are signs predef GetTileAndCoordsInFrontOfPlayer ; get the coordinates in front of the player in de - ld hl,wSignCoords - ld a,[wNumSigns] - ld b,a - ld c,0 -.signLoop - inc c - ld a,[hli] ; sign Y - cp d - jr z,.yCoordMatched - inc hl - jr .retry -.yCoordMatched - ld a,[hli] ; sign X - cp e - jr nz,.retry -.xCoordMatched -; found sign - push hl - push bc - ld hl,wSignTextIDs - ld b,0 - dec c - add hl,bc - ld a,[hl] - ld [hSpriteIndexOrTextID],a ; store sign text ID - pop bc - pop hl - ret -.retry - dec b - jr nz,.signLoop -; check if the player is front of a counter in a pokemon center, pokemart, etc. and if so, extend the range at which he can talk to the NPC + call SignLoop + ret c .extendRangeOverCounter +; check if the player is front of a counter in a pokemon center, pokemart, etc. and if so, extend the range at which he can talk to the NPC predef GetTileAndCoordsInFrontOfPlayer ; get the tile in front of the player in c - ld hl,wTileSetTalkingOverTiles ; list of tiles that extend talking range (counter tiles) - ld b,3 - ld d,$20 ; talking range in pixels (long range) + ld hl, wTileSetTalkingOverTiles ; list of tiles that extend talking range (counter tiles) + ld b, 3 + ld d, $20 ; talking range in pixels (long range) .counterTilesLoop - ld a,[hli] + ld a, [hli] cp c - jr z,IsSpriteInFrontOfPlayer2 ; jumps if the tile in front of the player is a counter tile + jr z, IsSpriteInFrontOfPlayer2 ; jumps if the tile in front of the player is a counter tile dec b - jr nz,.counterTilesLoop + jr nz, .counterTilesLoop -; part of the above function, but sometimes its called on its own, when signs are irrelevant -; the caller must zero [hSpriteIndexOrTextID] +; sets carry flag if a sprite is in front of the player, resets if not IsSpriteInFrontOfPlayer:: - ld d,$10 ; talking range in pixels (normal range) + ld d, $10 ; talking range in pixels (normal range) IsSpriteInFrontOfPlayer2:: lb bc, $3c, $40 ; Y and X position of player sprite - ld a,[wSpriteStateData1 + 9] ; direction the player is facing + ld a, [wPlayerFacingDirection] ; direction the player is facing .checkIfPlayerFacingUp cp SPRITE_FACING_UP - jr nz,.checkIfPlayerFacingDown + jr nz, .checkIfPlayerFacingDown ; facing up - ld a,b + ld a, b sub d - ld b,a - ld a,PLAYER_DIR_UP + ld b, a + ld a, PLAYER_DIR_UP jr .doneCheckingDirection + .checkIfPlayerFacingDown cp SPRITE_FACING_DOWN - jr nz,.checkIfPlayerFacingRight + jr nz, .checkIfPlayerFacingRight ; facing down - ld a,b + ld a, b add d - ld b,a - ld a,PLAYER_DIR_DOWN + ld b, a + ld a, PLAYER_DIR_DOWN jr .doneCheckingDirection + .checkIfPlayerFacingRight cp SPRITE_FACING_RIGHT - jr nz,.playerFacingLeft + jr nz, .playerFacingLeft ; facing right - ld a,c + ld a, c add d - ld c,a - ld a,PLAYER_DIR_RIGHT + ld c, a + ld a, PLAYER_DIR_RIGHT jr .doneCheckingDirection + .playerFacingLeft ; facing left - ld a,c + ld a, c sub d - ld c,a - ld a,PLAYER_DIR_LEFT + ld c, a + ld a, PLAYER_DIR_LEFT .doneCheckingDirection - ld [wPlayerDirection],a - ld a,[wNumSprites] ; number of sprites - and a - ret z -; if there are sprites - ld hl,wSpriteStateData1 + $10 - ld d,a - ld e,$01 + ld [wPlayerDirection], a + ld hl, wSpriteStateData1 + $10 +; yellow does not have the "if sprites are existant" check + ld e, $01 + ld d, $f .spriteLoop push hl - ld a,[hli] ; image (0 if no sprite) + ld a, [hli] ; image (0 if no sprite) and a - jr z,.nextSprite + jr z, .nextSprite inc l - ld a,[hli] ; sprite visibility + ld a, [hli] ; sprite visibility inc a - jr z,.nextSprite + jr z, .nextSprite inc l - ld a,[hli] ; Y location + ld a, [hli] ; Y location cp b - jr nz,.nextSprite + jr nz, .nextSprite inc l - ld a,[hl] ; X location + ld a, [hl] ; X location cp c - jr z,.foundSpriteInFrontOfPlayer + jr z, .foundSpriteInFrontOfPlayer .nextSprite pop hl - ld a,l - add a,$10 - ld l,a + ld a, l + add $10 + ld l, a inc e dec d - jr nz,.spriteLoop + jr nz, .spriteLoop + xor a ret + .foundSpriteInFrontOfPlayer pop hl - ld a,l - and a,$f0 + ld a, l + and $f0 inc a - ld l,a ; hl = $c1x1 - set 7,[hl] ; set flag to make the sprite face the player - ld a,e - ld [hSpriteIndexOrTextID],a + ld l, a ; hl = $c1x1 + set 7, [hl] ; set flag to make the sprite face the player + ld a, e + ld [hSpriteIndexOrTextID], a + ld a, [hSpriteIndexOrTextID] ; possible useless read because a already has the value of the read address + cp $f + jr nz, .dontwritetowd436 + ld a, $FF + ld [wd436], a +.dontwritetowd436 + scf + ret + +SignLoop:: +; search if a player is facing a sign + ld hl, wSignCoords ; start of sign coordinates + ld a, [wNumSigns] ; number of signs in the map + ld b, a + ld c, $00 +.signLoop + inc c + ld a, [hli] ; sign Y + cp d + jr z, .yCoordMatched + inc hl + jr .retry + +.yCoordMatched + ld a, [hli] ; sign X + cp e + jr nz, .retry +.xCoordMatched +; found sign + push hl + push bc + ld hl, wSignTextIDs ; start of sign text ID's + ld b, $00 + dec c + add hl, bc + ld a, [hl] + ld [hSpriteIndexOrTextID], a ; store sign text ID + pop bc + pop hl + scf + ret + +.retry + dec b + jr nz, .signLoop + xor a ret ; function to check if the player will jump down a ledge and check if the tile ahead is passable (when not surfing) ; sets the carry flag if there is a collision, and unsets it if there isn't a collision CollisionCheckOnLand:: - ld a,[wd736] - bit 6,a ; is the player jumping? - jr nz,.noCollision + ld a, [wd736] + bit 6, a ; is the player jumping? + jr nz, .noCollision ; if not jumping a ledge - ld a,[wSimulatedJoypadStatesIndex] + ld a, [wSimulatedJoypadStatesIndex] and a - jr nz,.noCollision ; no collisions when the player's movements are being controlled by the game - ld a,[wPlayerDirection] ; the direction that the player is trying to go in - ld d,a - ld a,[wSpriteStateData1 + 12] ; the player sprite's collision data (bit field) (set in the sprite movement code) + jr nz, .noCollision ; no collisions when the player's movements are being controlled by the game + ld a, [wPlayerDirection] ; the direction that the player is trying to go in + ld d, a + ld a, [wSpriteStateData1 + 12] ; the player sprite's collision data (bit field) (set in the sprite movement code) and d ; check if a sprite is in the direction the player is trying to go - jr nz,.collision + nop ; ??? why is this in the code + jr nz, .collision xor a - ld [hSpriteIndexOrTextID],a + ld [hSpriteIndexOrTextID], a call IsSpriteInFrontOfPlayer ; check for sprite collisions again? when does the above check fail to detect a sprite collision? - ld a,[hSpriteIndexOrTextID] + jr nc, .asm_0a5c + res 7, [hl] + ld a, [hSpriteIndexOrTextID] and a ; was there a sprite collision? - jr nz,.collision + jr z, .asm_0a5c ; if no sprite collision - ld hl,TilePairCollisionsLand + cp $f + jr nz, .collision + call CheckPikachuFollowingPlayer + jr nz, .collision + ld a, [hJoyHeld] + and $2 + jr nz, .asm_0a5c + ld hl, wd435 + ld a, [hl] + and a + jr z, .asm_0a5c + dec [hl] + jr nz, .collision +.asm_0a5c + ld hl, TilePairCollisionsLand call CheckForJumpingAndTilePairCollisions - jr c,.collision + jr c, .collision call CheckTilePassable - jr nc,.noCollision + jr nc, .noCollision .collision - ld a,[wChannelSoundIDs + CH4] - cp a,SFX_COLLISION ; check if collision sound is already playing - jr z,.setCarry - ld a,SFX_COLLISION + ld a, [wChannelSoundIDs + CH4] + cp $b4 ; SFX_COLLISION ; check if collision sound is already playing + jr z, .setCarry + ld a, $b4 ; SFX_COLLISION call PlaySound ; play collision sound (if it's not already playing) .setCarry scf ret + .noCollision and a ret @@ -1240,21 +1283,9 @@ CollisionCheckOnLand:: ; clears carry if it is, sets carry if not CheckTilePassable:: predef GetTileAndCoordsInFrontOfPlayer ; get tile in front of player - ld a,[wTileInFrontOfPlayer] ; tile in front of player - ld c,a - ld hl,wTileSetCollisionPtr ; pointer to list of passable tiles - ld a,[hli] - ld h,[hl] - ld l,a ; hl now points to passable tiles -.loop - ld a,[hli] - cp a,$ff - jr z,.tileNotPassable - cp c - ret z - jr .loop -.tileNotPassable - scf + ld a, [wTileInFrontOfPlayer] ; tile in front of player + ld c, a + call IsTilePassable ret ; check if the player is going to jump down a small ledge @@ -1266,61 +1297,66 @@ CheckForJumpingAndTilePairCollisions:: predef GetTileAndCoordsInFrontOfPlayer ; get the tile in front of the player push de push bc - callba HandleLedges ; check if the player is trying to jump a ledge + callba HandleLedges ; 6:67f4 + ; check if the player is trying to jump a ledge pop bc pop de pop hl and a - ld a,[wd736] - bit 6,a ; is the player jumping? + ld a, [wd736] + bit 6, a ; is the player jumping? ret nz ; if not jumping CheckForTilePairCollisions2:: aCoord 8, 9 ; tile the player is on - ld [wTilePlayerStandingOn],a + ld [wTilePlayerStandingOn], a CheckForTilePairCollisions:: - ld a,[wTileInFrontOfPlayer] - ld c,a + ld a, [wTileInFrontOfPlayer] + ld c, a .tilePairCollisionLoop - ld a,[wCurMapTileset] ; tileset number - ld b,a - ld a,[hli] - cp a,$ff - jr z,.noMatch + ld a, [wCurMapTileset] ; tileset number + ld b, a + ld a, [hli] + cp $ff + jr z, .noMatch cp b - jr z,.tilesetMatches + jr z, .tilesetMatches inc hl .retry inc hl jr .tilePairCollisionLoop + .tilesetMatches - ld a,[wTilePlayerStandingOn] ; tile the player is on - ld b,a - ld a,[hl] + ld a, [wTilePlayerStandingOn] ; tile the player is on + ld b, a + ld a, [hl] cp b - jr z,.currentTileMatchesFirstInPair + jr z, .currentTileMatchesFirstInPair inc hl - ld a,[hl] + ld a, [hl] cp b - jr z,.currentTileMatchesSecondInPair + jr z, .currentTileMatchesSecondInPair jr .retry + .currentTileMatchesFirstInPair inc hl - ld a,[hl] + ld a, [hl] cp c - jr z,.foundMatch + jr z, .foundMatch jr .tilePairCollisionLoop + .currentTileMatchesSecondInPair dec hl - ld a,[hli] + ld a, [hli] cp c inc hl - jr nz,.tilePairCollisionLoop + jr nz, .tilePairCollisionLoop .foundMatch scf ret + .noMatch and a ret @@ -1352,27 +1388,26 @@ TilePairCollisionsWater:: ; this builds a tile map from the tile block map based on the current X/Y coordinates of the player's character LoadCurrentMapView:: - ld a,[H_LOADEDROMBANK] + ld a, [H_LOADEDROMBANK] push af - ld a,[wTileSetBank] ; tile data ROM bank - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a ; switch to ROM bank that contains tile data - ld a,[wCurrentTileBlockMapViewPointer] ; address of upper left corner of current map view - ld e,a - ld a,[wCurrentTileBlockMapViewPointer + 1] - ld d,a - ld hl,wTileMapBackup - ld b,$05 + ld a, [wTilesetBank] ; tile data ROM bank + call BankswitchCommon ; switch to ROM bank that contains tile data + ld a, [wCurrentTileBlockMapViewPointer] ; address of upper left corner of current map view + ld e, a + ld a, [wCurrentTileBlockMapViewPointer + 1] + ld d, a + ld hl, wTileMapBackup + ld b, $05 .rowLoop ; each loop iteration fills in one row of tile blocks push hl push de - ld c,$06 + ld c, $06 .rowInnerLoop ; loop to draw each tile block of the current row push bc push de push hl - ld a,[de] - ld c,a ; tile block number + ld a, [de] + ld c, a ; tile block number call DrawTileBlock pop hl pop de @@ -1383,308 +1418,73 @@ LoadCurrentMapView:: inc hl inc de dec c - jr nz,.rowInnerLoop + jr nz, .rowInnerLoop ; update tile block map pointer to next row's address pop de - ld a,[wCurMapWidth] - add a,MAP_BORDER * 2 + ld a, [wCurMapWidth] + add MAP_BORDER * 2 add e - ld e,a - jr nc,.noCarry + ld e, a + jr nc, .noCarry inc d .noCarry ; update tile map pointer to next row's address pop hl - ld a,$60 + ld a, $60 add l - ld l,a - jr nc,.noCarry2 + ld l, a + jr nc, .noCarry2 inc h .noCarry2 dec b - jr nz,.rowLoop - ld hl,wTileMapBackup - ld bc,$0000 + jr nz, .rowLoop + ld hl, wTileMapBackup + ld bc, $0000 .adjustForYCoordWithinTileBlock - ld a,[wYBlockCoord] + ld a, [wYBlockCoord] and a - jr z,.adjustForXCoordWithinTileBlock - ld bc,$0030 - add hl,bc + jr z, .adjustForXCoordWithinTileBlock + ld bc, $0030 + add hl, bc .adjustForXCoordWithinTileBlock - ld a,[wXBlockCoord] + ld a, [wXBlockCoord] and a - jr z,.copyToVisibleAreaBuffer - ld bc,$0002 - add hl,bc + jr z, .copyToVisibleAreaBuffer + ld bc, $0002 + add hl, bc .copyToVisibleAreaBuffer coord de, 0, 0 ; base address for the tiles that are directly transferred to VRAM during V-blank ld b, SCREEN_HEIGHT .rowLoop2 ld c, SCREEN_WIDTH .rowInnerLoop2 - ld a,[hli] - ld [de],a + ld a, [hli] + ld [de], a inc de dec c - jr nz,.rowInnerLoop2 - ld a,$04 + jr nz, .rowInnerLoop2 + ld a, $04 add l - ld l,a - jr nc,.noCarry3 + ld l, a + jr nc, .noCarry3 inc h .noCarry3 dec b - jr nz,.rowLoop2 + jr nz, .rowLoop2 pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a ; restore previous ROM bank + call BankswitchCommon ; restore previous ROM bank ret AdvancePlayerSprite:: - ld a,[wSpriteStateData1 + 3] ; delta Y - ld b,a - ld a,[wSpriteStateData1 + 5] ; delta X - ld c,a - ld hl,wWalkCounter ; walking animation counter - dec [hl] - jr nz,.afterUpdateMapCoords -; if it's the end of the animation, update the player's map coordinates - ld a,[wYCoord] - add b - ld [wYCoord],a - ld a,[wXCoord] - add c - ld [wXCoord],a -.afterUpdateMapCoords - ld a,[wWalkCounter] ; walking animation counter - cp a,$07 - jp nz,.scrollBackgroundAndSprites -; if this is the first iteration of the animation - ld a,c - cp a,$01 - jr nz,.checkIfMovingWest -; moving east - ld a,[wMapViewVRAMPointer] - ld e,a - and a,$e0 - ld d,a - ld a,e - add a,$02 - and a,$1f - or d - ld [wMapViewVRAMPointer],a - jr .adjustXCoordWithinBlock -.checkIfMovingWest - cp a,$ff - jr nz,.checkIfMovingSouth -; moving west - ld a,[wMapViewVRAMPointer] - ld e,a - and a,$e0 - ld d,a - ld a,e - sub a,$02 - and a,$1f - or d - ld [wMapViewVRAMPointer],a - jr .adjustXCoordWithinBlock -.checkIfMovingSouth - ld a,b - cp a,$01 - jr nz,.checkIfMovingNorth -; moving south - ld a,[wMapViewVRAMPointer] - add a,$40 - ld [wMapViewVRAMPointer],a - jr nc,.adjustXCoordWithinBlock - ld a,[wMapViewVRAMPointer + 1] - inc a - and a,$03 - or a,$98 - ld [wMapViewVRAMPointer + 1],a - jr .adjustXCoordWithinBlock -.checkIfMovingNorth - cp a,$ff - jr nz,.adjustXCoordWithinBlock -; moving north - ld a,[wMapViewVRAMPointer] - sub a,$40 - ld [wMapViewVRAMPointer],a - jr nc,.adjustXCoordWithinBlock - ld a,[wMapViewVRAMPointer + 1] - dec a - and a,$03 - or a,$98 - ld [wMapViewVRAMPointer + 1],a -.adjustXCoordWithinBlock - ld a,c - and a - jr z,.pointlessJump ; mistake? -.pointlessJump - ld hl,wXBlockCoord - ld a,[hl] - add c - ld [hl],a - cp a,$02 - jr nz,.checkForMoveToWestBlock -; moved into the tile block to the east - xor a - ld [hl],a - ld hl,wXOffsetSinceLastSpecialWarp - inc [hl] - ld de,wCurrentTileBlockMapViewPointer - call MoveTileBlockMapPointerEast - jr .updateMapView -.checkForMoveToWestBlock - cp a,$ff - jr nz,.adjustYCoordWithinBlock -; moved into the tile block to the west - ld a,$01 - ld [hl],a - ld hl,wXOffsetSinceLastSpecialWarp - dec [hl] - ld de,wCurrentTileBlockMapViewPointer - call MoveTileBlockMapPointerWest - jr .updateMapView -.adjustYCoordWithinBlock - ld hl,wYBlockCoord - ld a,[hl] - add b - ld [hl],a - cp a,$02 - jr nz,.checkForMoveToNorthBlock -; moved into the tile block to the south - xor a - ld [hl],a - ld hl,wYOffsetSinceLastSpecialWarp - inc [hl] - ld de,wCurrentTileBlockMapViewPointer - ld a,[wCurMapWidth] - call MoveTileBlockMapPointerSouth - jr .updateMapView -.checkForMoveToNorthBlock - cp a,$ff - jr nz,.updateMapView -; moved into the tile block to the north - ld a,$01 - ld [hl],a - ld hl,wYOffsetSinceLastSpecialWarp - dec [hl] - ld de,wCurrentTileBlockMapViewPointer - ld a,[wCurMapWidth] - call MoveTileBlockMapPointerNorth -.updateMapView - call LoadCurrentMapView - ld a,[wSpriteStateData1 + 3] ; delta Y - cp a,$01 - jr nz,.checkIfMovingNorth2 -; if moving south - call ScheduleSouthRowRedraw - jr .scrollBackgroundAndSprites -.checkIfMovingNorth2 - cp a,$ff - jr nz,.checkIfMovingEast2 -; if moving north - call ScheduleNorthRowRedraw - jr .scrollBackgroundAndSprites -.checkIfMovingEast2 - ld a,[wSpriteStateData1 + 5] ; delta X - cp a,$01 - jr nz,.checkIfMovingWest2 -; if moving east - call ScheduleEastColumnRedraw - jr .scrollBackgroundAndSprites -.checkIfMovingWest2 - cp a,$ff - jr nz,.scrollBackgroundAndSprites -; if moving west - call ScheduleWestColumnRedraw -.scrollBackgroundAndSprites - ld a,[wSpriteStateData1 + 3] ; delta Y - ld b,a - ld a,[wSpriteStateData1 + 5] ; delta X - ld c,a - sla b - sla c - ld a,[hSCY] - add b - ld [hSCY],a ; update background scroll Y - ld a,[hSCX] - add c - ld [hSCX],a ; update background scroll X -; shift all the sprites in the direction opposite of the player's motion -; so that the player appears to move relative to them - ld hl,wSpriteStateData1 + $14 - ld a,[wNumSprites] ; number of sprites - and a ; are there any sprites? - jr z,.done - ld e,a -.spriteShiftLoop - ld a,[hl] - sub b - ld [hli],a - inc l - ld a,[hl] - sub c - ld [hl],a - ld a,$0e - add l - ld l,a - dec e - jr nz,.spriteShiftLoop -.done - ret - -; the following four functions are used to move the pointer to the upper left -; corner of the tile block map in the direction of motion - -MoveTileBlockMapPointerEast:: - ld a,[de] - add a,$01 - ld [de],a - ret nc - inc de - ld a,[de] - inc a - ld [de],a - ret - -MoveTileBlockMapPointerWest:: - ld a,[de] - sub a,$01 - ld [de],a - ret nc - inc de - ld a,[de] - dec a - ld [de],a - ret - -MoveTileBlockMapPointerSouth:: - add a,MAP_BORDER * 2 - ld b,a - ld a,[de] - add b - ld [de],a - ret nc - inc de - ld a,[de] - inc a - ld [de],a - ret - -MoveTileBlockMapPointerNorth:: - add a,MAP_BORDER * 2 - ld b,a - ld a,[de] - sub b - ld [de],a - ret nc - inc de - ld a,[de] - dec a - ld [de],a + ld a, [wUpdateSpritesEnabled] + push af + ld a, $FF + ld [wUpdateSpritesEnabled], a + ld hl, _AdvancePlayerSprite ; 3c:410c + ld b, BANK(_AdvancePlayerSprite) + call Bankswitch + pop af + ld [wUpdateSpritesEnabled], a ret ; the following 6 functions are used to tell the V-blank handler to redraw @@ -1693,197 +1493,216 @@ MoveTileBlockMapPointerNorth:: ScheduleNorthRowRedraw:: coord hl, 0, 0 call CopyToRedrawRowOrColumnSrcTiles - ld a,[wMapViewVRAMPointer] - ld [hRedrawRowOrColumnDest],a - ld a,[wMapViewVRAMPointer + 1] - ld [hRedrawRowOrColumnDest + 1],a - ld a,REDRAW_ROW - ld [hRedrawRowOrColumnMode],a + ld a, [wMapViewVRAMPointer] + ld [hRedrawRowOrColumnDest], a + ld a, [wMapViewVRAMPointer + 1] + ld [hRedrawRowOrColumnDest + 1], a + ld a, REDRAW_ROW + ld [hRedrawRowOrColumnMode], a ret CopyToRedrawRowOrColumnSrcTiles:: - ld de,wRedrawRowOrColumnSrcTiles - ld c,2 * SCREEN_WIDTH + ld de, wRedrawRowOrColumnSrcTiles + ld c, 2 * SCREEN_WIDTH .loop - ld a,[hli] - ld [de],a + ld a, [hli] + ld [de], a inc de dec c - jr nz,.loop + jr nz, .loop ret ScheduleSouthRowRedraw:: coord hl, 0, 16 call CopyToRedrawRowOrColumnSrcTiles - ld a,[wMapViewVRAMPointer] - ld l,a - ld a,[wMapViewVRAMPointer + 1] - ld h,a - ld bc,$0200 - add hl,bc - ld a,h - and a,$03 - or a,$98 - ld [hRedrawRowOrColumnDest + 1],a - ld a,l - ld [hRedrawRowOrColumnDest],a - ld a,REDRAW_ROW - ld [hRedrawRowOrColumnMode],a + ld a, [wMapViewVRAMPointer] + ld l, a + ld a, [wMapViewVRAMPointer + 1] + ld h, a + ld bc, $0200 + add hl, bc + ld a, h + and $03 + or $98 + ld [hRedrawRowOrColumnDest + 1], a + ld a, l + ld [hRedrawRowOrColumnDest], a + ld a, REDRAW_ROW + ld [hRedrawRowOrColumnMode], a ret ScheduleEastColumnRedraw:: coord hl, 18, 0 call ScheduleColumnRedrawHelper - ld a,[wMapViewVRAMPointer] - ld c,a - and a,$e0 - ld b,a - ld a,c - add a,18 - and a,$1f + ld a, [wMapViewVRAMPointer] + ld c, a + and $e0 + ld b, a + ld a, c + add 18 + and $1f or b - ld [hRedrawRowOrColumnDest],a - ld a,[wMapViewVRAMPointer + 1] - ld [hRedrawRowOrColumnDest + 1],a - ld a,REDRAW_COL - ld [hRedrawRowOrColumnMode],a + ld [hRedrawRowOrColumnDest], a + ld a, [wMapViewVRAMPointer + 1] + ld [hRedrawRowOrColumnDest + 1], a + ld a, REDRAW_COL + ld [hRedrawRowOrColumnMode], a ret ScheduleColumnRedrawHelper:: - ld de,wRedrawRowOrColumnSrcTiles - ld c,SCREEN_HEIGHT + ld de, wRedrawRowOrColumnSrcTiles + ld c, SCREEN_HEIGHT .loop - ld a,[hli] - ld [de],a + ld a, [hli] + ld [de], a inc de - ld a,[hl] - ld [de],a + ld a, [hl] + ld [de], a inc de - ld a,19 + ld a, 19 add l - ld l,a - jr nc,.noCarry + ld l, a + jr nc, .noCarry inc h .noCarry dec c - jr nz,.loop + jr nz, .loop ret ScheduleWestColumnRedraw:: coord hl, 0, 0 call ScheduleColumnRedrawHelper - ld a,[wMapViewVRAMPointer] - ld [hRedrawRowOrColumnDest],a - ld a,[wMapViewVRAMPointer + 1] - ld [hRedrawRowOrColumnDest + 1],a - ld a,REDRAW_COL - ld [hRedrawRowOrColumnMode],a + ld a, [wMapViewVRAMPointer] + ld [hRedrawRowOrColumnDest], a + ld a, [wMapViewVRAMPointer + 1] + ld [hRedrawRowOrColumnDest + 1], a + ld a, REDRAW_COL + ld [hRedrawRowOrColumnMode], a ret ; function to write the tiles that make up a tile block to memory ; Input: c = tile block ID, hl = destination address DrawTileBlock:: push hl - ld a,[wTileSetBlocksPtr] ; pointer to tiles - ld l,a - ld a,[wTileSetBlocksPtr + 1] - ld h,a - ld a,c + ld a, [wTileSetBlocksPtr] ; pointer to tiles + ld l, a + ld a, [wTileSetBlocksPtr + 1] + ld h, a + ld a, c swap a - ld b,a - and a,$f0 - ld c,a - ld a,b - and a,$0f - ld b,a ; bc = tile block ID * 0x10 - add hl,bc - ld d,h - ld e,l ; de = address of the tile block's tiles + ld b, a + and $f0 + ld c, a + ld a, b + and $0f + ld b, a ; bc = tile block ID * 0x10 + add hl, bc + ld d, h + ld e, l ; de = address of the tile block's tiles pop hl - ld c,$04 ; 4 loop iterations + ld c, $04 ; 4 loop iterations .loop ; each loop iteration, write 4 tile numbers push bc - ld a,[de] - ld [hli],a + ld a, [de] + ld [hli], a inc de - ld a,[de] - ld [hli],a + ld a, [de] + ld [hli], a inc de - ld a,[de] - ld [hli],a + ld a, [de] + ld [hli], a inc de - ld a,[de] - ld [hl],a + ld a, [de] + ld [hl], a inc de - ld bc,$0015 - add hl,bc + ld bc, $0015 + add hl, bc pop bc dec c - jr nz,.loop + jr nz, .loop ret ; function to update joypad state and simulate button presses JoypadOverworld:: xor a - ld [wSpriteStateData1 + 3],a - ld [wSpriteStateData1 + 5],a + ld [wSpriteStateData1 + 3], a + ld [wSpriteStateData1 + 5], a call RunMapScript call Joypad - ld a,[wFlags_D733] - bit 3,a ; check if a trainer wants a challenge - jr nz,.notForcedDownwards - ld a,[wCurMap] - cp a,ROUTE_17 ; Cycling Road - jr nz,.notForcedDownwards - ld a,[hJoyHeld] - and a,D_DOWN | D_UP | D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON - jr nz,.notForcedDownwards - ld a,D_DOWN - ld [hJoyHeld],a ; on the cycling road, if there isn't a trainer and the player isn't pressing buttons, simulate a down press -.notForcedDownwards - ld a,[wd730] - bit 7,a + call ForceBikeDown + call AreInputsSimulated + ret + +ForceBikeDown:: + ld a, [wFlags_D733] + bit 3, a ; check if a trainer wants a challenge + ret nz + ld a, [wCurMap] + cp ROUTE_17 ; Cycling Road + ret nz + ld a, [hJoyHeld] + and D_DOWN | D_UP | D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON + ret nz + ld a, D_DOWN + ld [hJoyHeld], a ; on the cycling road, if there isn't a trainer and the player isn't pressing buttons, simulate a down press + ret + +AreInputsSimulated:: + ld a, [wd730] + bit 7, a ret z ; if simulating button presses - ld a,[hJoyHeld] - ld b,a - ld a,[wOverrideSimulatedJoypadStatesMask] ; bit mask for button presses that override simulated ones + ld a, [hJoyHeld] + ld b, a + ld a, [wOverrideSimulatedJoypadStatesMask] ; bit mask for button presses that override simulated ones and b ret nz ; return if the simulated button presses are overridden - ld hl,wSimulatedJoypadStatesIndex - dec [hl] - ld a,[hl] - cp a,$ff - jr z,.doneSimulating ; if the end of the simulated button presses has been reached - ld hl,wSimulatedJoypadStatesEnd - add l - ld l,a - jr nc,.noCarry - inc h -.noCarry - ld a,[hl] - ld [hJoyHeld],a ; store simulated button press in joypad state + call GetSimulatedInput + jr nc, .doneSimulating + ld [hJoyHeld], a ; store simulated button press in joypad state and a ret nz - ld [hJoyPressed],a - ld [hJoyReleased],a + ld [hJoyPressed], a + ld [hJoyReleased], a ret + ; if done simulating button presses .doneSimulating xor a - ld [wWastedByteCD3A],a - ld [wSimulatedJoypadStatesIndex],a - ld [wSimulatedJoypadStatesEnd],a - ld [wJoyIgnore],a - ld [hJoyHeld],a - ld hl,wd736 - ld a,[hl] - and a,$f8 - ld [hl],a - ld hl,wd730 - res 7,[hl] + ld [wWastedByteCD3A], a + ld [wSimulatedJoypadStatesIndex], a + ld [wSimulatedJoypadStatesEnd], a + ld [wJoyIgnore], a + ld [hJoyHeld], a + ld hl, wd736 + ld a, [hl] + and $f8 + ld [hl], a + ld hl, wd730 + res 7, [hl] + ret + +GetSimulatedInput:: + ld hl, wSimulatedJoypadStatesIndex + dec [hl] + ld a, [hl] + cp $ff + jr z, .endofsimulatedinputs ; if the end of the simulated button presses has been reached + push de + ld e, a + ld d, $0 + ld hl, wSimulatedJoypadStatesEnd + add hl, de + ld a, [hl] + pop de + scf ret +.endofsimulatedinputs + and a + ret + + ; function to check the tile ahead to determine if the character should get on land or keep surfing ; sets carry if there is a collision and clears carry otherwise ; It seems that this function has a bug in it, but due to luck, it doesn't @@ -1894,62 +1713,54 @@ JoypadOverworld:: ; and 2429 always sets c to 0xF0. There is no 0xF0 background tile, so it ; is considered impassable and it is detected as a collision. CollisionCheckOnWater:: - ld a,[wd730] - bit 7,a - jp nz,.noCollision ; return and clear carry if button presses are being simulated - ld a,[wPlayerDirection] ; the direction that the player is trying to go in - ld d,a - ld a,[wSpriteStateData1 + 12] ; the player sprite's collision data (bit field) (set in the sprite movement code) + ld a, [wd730] + bit 7, a + jp nz, .noCollision ; return and clear carry if button presses are being simulated + ld a, [wPlayerDirection] ; the direction that the player is trying to go in + ld d, a + ld a, [wSpriteStateData1 + 12] ; the player sprite's collision data (bit field) (set in the sprite movement code) and d ; check if a sprite is in the direction the player is trying to go - jr nz,.checkIfNextTileIsPassable ; bug? - ld hl,TilePairCollisionsWater + jr nz, .collision ; bug? + ld hl, TilePairCollisionsWater call CheckForJumpingAndTilePairCollisions - jr c,.collision + jr c, .collision predef GetTileAndCoordsInFrontOfPlayer ; get tile in front of player (puts it in c and [wTileInFrontOfPlayer]) - ld a,[wTileInFrontOfPlayer] ; tile in front of player - cp a,$14 ; water tile - jr z,.noCollision ; keep surfing if it's a water tile - cp a,$32 ; either the left tile of the S.S. Anne boarding platform or the tile on eastern coastlines (depending on the current tileset) - jr z,.checkIfVermilionDockTileset - cp a,$48 ; tile on right on coast lines in Safari Zone - jr z,.noCollision ; keep surfing -; check if the [land] tile in front of the player is passable -.checkIfNextTileIsPassable - ld hl,wTileSetCollisionPtr ; pointer to list of passable tiles - ld a,[hli] - ld h,[hl] - ld l,a -.loop - ld a,[hli] - cp a,$ff - jr z,.collision - cp c - jr z,.stopSurfing ; stop surfing if the tile is passable - jr .loop + callab IsNextTileShoreOrWater ; 3:6808 + jr c, .noCollision + ld a, [wTileInFrontOfPlayer] ; tile in front of player + ld c, a + call IsTilePassable + jr nc, .stopSurfing .collision - ld a,[wChannelSoundIDs + CH4] - cp a,SFX_COLLISION ; check if collision sound is already playing - jr z,.setCarry - ld a,SFX_COLLISION + ld a, [wChannelSoundIDs + CH4] + cp $b4 ; SFX_COLLISION + jr z, .setCarry + ld a, $b4 ; SFX_COLLISION call PlaySound ; play collision sound (if it's not already playing) .setCarry scf jr .done -.noCollision - and a -.done - ret -.stopSurfing - xor a - ld [wWalkBikeSurfState],a - call LoadPlayerSpriteGraphics - call PlayDefaultMusic - jr .noCollision + .checkIfVermilionDockTileset ld a, [wCurMapTileset] ; tileset cp SHIP_PORT ; Vermilion Dock tileset jr nz, .noCollision ; keep surfing if it's not the boarding platform tile jr .stopSurfing ; if it is the boarding platform tile, stop surfing +.stopSurfing ; based game freak + ld a, $3 + ld [wPikachuSpawnState], a + ld hl, wPikachuOverworldStateFlags + set 5, [hl] + xor a + ld [wWalkBikeSurfState], a + call LoadPlayerSpriteGraphics + call PlayDefaultMusic + jr .noCollision + +.noCollision ; ...and they do the same mistake twice + and a +.done + ret ; function to run the current map's script RunMapScript:: @@ -1957,407 +1768,343 @@ RunMapScript:: push de push bc callba TryPushingBoulder - ld a,[wFlags_0xcd60] - bit 1,a ; play boulder dust animation - jr z,.afterBoulderEffect + ld a, [wFlags_0xcd60] + bit 1, a ; play boulder dust animation + jr z, .afterBoulderEffect callba DoBoulderDustAnimation .afterBoulderEffect pop bc pop de pop hl call RunNPCMovementScript - ld a,[wCurMap] ; current map number + ld a, [wCurMap] ; current map number call SwitchToMapRomBank ; change to the ROM bank the map's data is in - ld hl,wMapScriptPtr - ld a,[hli] - ld h,[hl] - ld l,a - ld de,.return + ld hl, wMapScriptPtr + ld a, [hli] + ld h, [hl] + ld l, a + ld de, .return push de jp [hl] ; jump to script .return ret LoadWalkingPlayerSpriteGraphics:: - ld de,RedSprite - ld hl,vNPCSprites +; new sprite copy stuff + xor a + ld [wd473], a + ld b, BANK(RedSprite) + ld de, RedSprite ; $4180 + jr LoadPlayerSpriteGraphicsCommon + +LoadSurfingPlayerSpriteGraphics2:: + ld a, [wd473] + and a + jr z, .asm_0d75 + dec a + jr z, LoadSurfingPlayerSpriteGraphics + dec a + jr z, .asm_0d7c +.asm_0d75 + ld a, [wd472] + bit 6, a + jr z, LoadSurfingPlayerSpriteGraphics +.asm_0d7c + ld b, BANK(SurfingPikachuSprite) + ld de, SurfingPikachuSprite ; 3f:6def jr LoadPlayerSpriteGraphicsCommon LoadSurfingPlayerSpriteGraphics:: - ld de,SeelSprite - ld hl,vNPCSprites + ld b, BANK(RedSprite) ; not sure, but probably same bank (5) + ld de, SeelSprite jr LoadPlayerSpriteGraphicsCommon LoadBikePlayerSpriteGraphics:: - ld de,RedCyclingSprite - ld hl,vNPCSprites - + ld b, BANK(RedCyclingSprite) + ld de, RedCyclingSprite LoadPlayerSpriteGraphicsCommon:: + ld hl, vNPCSprites push de push hl - lb bc, BANK(RedSprite), $0c + push bc + ld c, $c call CopyVideoData + pop bc pop hl pop de - ld a,$c0 + ld a, $c0 add e - ld e,a - jr nc,.noCarry + ld e, a + jr nc, .noCarry inc d .noCarry - set 3,h - lb bc, BANK(RedSprite), $0c + set 3, h + ld c, $c jp CopyVideoData ; function to load data from the map header LoadMapHeader:: callba MarkTownVisitedAndLoadMissableObjects - ld a,[wCurMapTileset] - ld [wUnusedD119],a - ld a,[wCurMap] + jr asm_0dbd + +Func_0db5:: ; XXX + callba LoadUnusedBluesHouseMissableObjectData ; 3c:4a55 +asm_0dbd + ld a, [wCurMapTileset] + ld [wUnusedD119], a + ld a, [wCurMap] call SwitchToMapRomBank - ld a,[wCurMapTileset] - ld b,a - res 7,a - ld [wCurMapTileset],a - ld [hPreviousTileset],a - bit 7,b + ld a, [wCurMapTileset] + ld b, a + res 7, a + ld [wCurMapTileset], a + ld [hPreviousTileset], a + bit 7, b ret nz - ld hl,MapHeaderPointers - ld a,[wCurMap] - sla a - jr nc,.noCarry1 - inc h -.noCarry1 - add l - ld l,a - jr nc,.noCarry2 - inc h -.noCarry2 - ld a,[hli] - ld h,[hl] - ld l,a ; hl = base of map header + call GetMapHeaderPointer ; copy the first 10 bytes (the fixed area) of the map data to D367-D370 - ld de,wCurMapTileset - ld c,$0a + ld de, wCurMapTileset + ld c, $0a .copyFixedHeaderLoop - ld a,[hli] - ld [de],a + ld a, [hli] + ld [de], a inc de dec c - jr nz,.copyFixedHeaderLoop + jr nz, .copyFixedHeaderLoop ; initialize all the connected maps to disabled at first, before loading the actual values - ld a,$ff - ld [wMapConn1Ptr],a - ld [wMapConn2Ptr],a - ld [wMapConn3Ptr],a - ld [wMapConn4Ptr],a + ld a, $ff + ld [wMapConn1Ptr], a + ld [wMapConn2Ptr], a + ld [wMapConn3Ptr], a + ld [wMapConn4Ptr], a ; copy connection data (if any) to WRAM - ld a,[wMapConnections] - ld b,a + ld a, [wMapConnections] + ld b, a .checkNorth - bit 3,b - jr z,.checkSouth - ld de,wMapConn1Ptr + bit 3, b + jr z, .checkSouth + ld de, wMapConn1Ptr call CopyMapConnectionHeader .checkSouth - bit 2,b - jr z,.checkWest - ld de,wMapConn2Ptr + bit 2, b + jr z, .checkWest + ld de, wMapConn2Ptr call CopyMapConnectionHeader .checkWest - bit 1,b - jr z,.checkEast - ld de,wMapConn3Ptr + bit 1, b + jr z, .checkEast + ld de, wMapConn3Ptr call CopyMapConnectionHeader .checkEast - bit 0,b - jr z,.getObjectDataPointer - ld de,wMapConn4Ptr + bit 0, b + jr z, .getObjectDataPointer + ld de, wMapConn4Ptr call CopyMapConnectionHeader .getObjectDataPointer - ld a,[hli] - ld [wObjectDataPointerTemp],a - ld a,[hli] - ld [wObjectDataPointerTemp + 1],a + ld a, [hli] + ld [wObjectDataPointerTemp], a + ld a, [hli] + ld [wObjectDataPointerTemp + 1], a push hl - ld a,[wObjectDataPointerTemp] - ld l,a - ld a,[wObjectDataPointerTemp + 1] - ld h,a ; hl = base of object data - ld de,wMapBackgroundTile - ld a,[hli] - ld [de],a + ld a, [wObjectDataPointerTemp] + ld l, a + ld a, [wObjectDataPointerTemp + 1] + ld h, a ; hl = base of object data + ld de, wMapBackgroundTile + ld a, [hli] + ld [de], a .loadWarpData - ld a,[hli] - ld [wNumberOfWarps],a + ld a, [hli] + ld [wNumberOfWarps], a and a - jr z,.loadSignData - ld c,a - ld de,wWarpEntries + jr z, .loadSignData + ld c, a + ld de, wWarpEntries .warpLoop ; one warp per loop iteration - ld b,$04 + ld b, $04 .warpInnerLoop - ld a,[hli] - ld [de],a + ld a, [hli] + ld [de], a inc de dec b - jr nz,.warpInnerLoop + jr nz, .warpInnerLoop dec c - jr nz,.warpLoop + jr nz, .warpLoop .loadSignData - ld a,[hli] ; number of signs - ld [wNumSigns],a + ld a, [hli] ; number of signs + ld [wNumSigns], a and a ; are there any signs? - jr z,.loadSpriteData ; if not, skip this - ld c,a - ld de,wSignTextIDs - ld a,d - ld [hSignCoordPointer],a - ld a,e - ld [hSignCoordPointer + 1],a - ld de,wSignCoords -.signLoop - ld a,[hli] - ld [de],a - inc de - ld a,[hli] - ld [de],a - inc de - push de - ld a,[hSignCoordPointer] - ld d,a - ld a,[hSignCoordPointer + 1] - ld e,a - ld a,[hli] - ld [de],a - inc de - ld a,d - ld [hSignCoordPointer],a - ld a,e - ld [hSignCoordPointer + 1],a - pop de - dec c - jr nz,.signLoop + jr z, .loadSpriteData ; if not, skip this + call CopySignData ; 0eb3 (0:0eb3) .loadSpriteData - ld a,[wd72e] - bit 5,a ; did a battle happen immediately before this? - jp nz,.finishUp ; if so, skip this because battles don't destroy this data - ld a,[hli] - ld [wNumSprites],a ; save the number of sprites - push hl -; zero C110-C1FF and C210-C2FF - ld hl,wSpriteStateData1 + $10 - ld de,wSpriteStateData2 + $10 - xor a - ld b,$f0 -.zeroSpriteDataLoop - ld [hli],a - ld [de],a - inc e - dec b - jr nz,.zeroSpriteDataLoop -; initialize all C100-C1FF sprite entries to disabled (other than player's) - ld hl,wSpriteStateData1 + $12 - ld de,$0010 - ld c,$0f -.disableSpriteEntriesLoop - ld [hl],$ff - add hl,de - dec c - jr nz,.disableSpriteEntriesLoop - pop hl - ld de,wSpriteStateData1 + $10 - ld a,[wNumSprites] ; number of sprites - and a ; are there any sprites? - jp z,.finishUp ; if there are no sprites, skip the rest - ld b,a - ld c,$00 -.loadSpriteLoop - ld a,[hli] - ld [de],a ; store picture ID at C1X0 - inc d - ld a,$04 - add e - ld e,a - ld a,[hli] - ld [de],a ; store Y position at C2X4 - inc e - ld a,[hli] - ld [de],a ; store X position at C2X5 - inc e - ld a,[hli] - ld [de],a ; store movement byte 1 at C2X6 - ld a,[hli] - ld [hLoadSpriteTemp1],a ; save movement byte 2 - ld a,[hli] - ld [hLoadSpriteTemp2],a ; save text ID and flags byte - push bc - push hl - ld b,$00 - ld hl,wMapSpriteData - add hl,bc - ld a,[hLoadSpriteTemp1] - ld [hli],a ; store movement byte 2 in byte 0 of sprite entry - ld a,[hLoadSpriteTemp2] - ld [hl],a ; this appears pointless, since the value is overwritten immediately after - ld a,[hLoadSpriteTemp2] - ld [hLoadSpriteTemp1],a - and a,$3f - ld [hl],a ; store text ID in byte 1 of sprite entry - pop hl - ld a,[hLoadSpriteTemp1] - bit 6,a - jr nz,.trainerSprite - bit 7,a - jr nz,.itemBallSprite - jr .regularSprite -.trainerSprite - ld a,[hli] - ld [hLoadSpriteTemp1],a ; save trainer class - ld a,[hli] - ld [hLoadSpriteTemp2],a ; save trainer number (within class) - push hl - ld hl,wMapSpriteExtraData - add hl,bc - ld a,[hLoadSpriteTemp1] - ld [hli],a ; store trainer class in byte 0 of the entry - ld a,[hLoadSpriteTemp2] - ld [hl],a ; store trainer number in byte 1 of the entry - pop hl - jr .nextSprite -.itemBallSprite - ld a,[hli] - ld [hLoadSpriteTemp1],a ; save item number - push hl - ld hl,wMapSpriteExtraData - add hl,bc - ld a,[hLoadSpriteTemp1] - ld [hli],a ; store item number in byte 0 of the entry - xor a - ld [hl],a ; zero byte 1, since it is not used - pop hl - jr .nextSprite -.regularSprite - push hl - ld hl,wMapSpriteExtraData - add hl,bc -; zero both bytes, since regular sprites don't use this extra space - xor a - ld [hli],a - ld [hl],a - pop hl -.nextSprite - pop bc - dec d - ld a,$0a - add e - ld e,a - inc c - inc c - dec b - jp nz,.loadSpriteLoop + ld a, [wd72e] + bit 5, a ; did a battle happen immediately before this? + jr nz, .finishUp ; if so, skip this because battles don't destroy this data + call InitSprites .finishUp predef LoadTilesetHeader - callab LoadWildData + ld a, [wd72e] + bit 5, a ; did a battle happen immediately before this? + jr nz, .skip_pika_spawn + callab SchedulePikachuSpawnForAfterText ; 3f:44fa +.skip_pika_spawn + callab LoadWildData ; 3:4b62 pop hl ; restore hl from before going to the warp/sign/sprite data (this value was saved for seemingly no purpose) - ld a,[wCurMapHeight] ; map height in 4x4 tile blocks + ld a, [wCurMapHeight] ; map height in 4x4 tile blocks add a ; double it - ld [wCurrentMapHeight2],a ; store map height in 2x2 tile blocks - ld a,[wCurMapWidth] ; map width in 4x4 tile blocks + ld [wCurrentMapHeight2], a ; store map height in 2x2 tile blocks + ld a, [wCurMapWidth] ; map width in 4x4 tile blocks add a ; double it - ld [wCurrentMapWidth2],a ; map width in 2x2 tile blocks - ld a,[wCurMap] - ld c,a - ld b,$00 - ld a,[H_LOADEDROMBANK] + ld [wCurrentMapWidth2], a ; map width in 2x2 tile blocks + ld a, [wCurMap] + ld c, a + ld b, $00 + ld a, [H_LOADEDROMBANK] push af - ld a, BANK(MapSongBanks) - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a - ld hl, MapSongBanks - add hl,bc - add hl,bc - ld a,[hli] - ld [wMapMusicSoundID],a ; music 1 - ld a,[hl] - ld [wMapMusicROMBank],a ; music 2 + switchbank MapSongBanks + ld hl, MapSongBanks ; 3f:4000 + add hl, bc + add hl, bc + ld a, [hli] + ld [wMapMusicSoundID], a ; music 1 + ld a, [hl] + ld [wMapMusicROMBank], a ; music 2 pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + call BankswitchCommon ret ; function to copy map connection data from ROM to WRAM ; Input: hl = source, de = destination CopyMapConnectionHeader:: - ld c,$0b + ld c, $0b .loop - ld a,[hli] - ld [de],a + ld a, [hli] + ld [de], a inc de dec c - jr nz,.loop + jr nz, .loop + ret + +CopySignData:: + ld de, wSignCoords ; start of sign coords + ld bc, wSignTextIDs ; start of sign text ids + ld a, [wNumSigns] ; number of signs +.signcopyloop + push af + ld a, [hli] + ld [de], a ; copy y coord + inc de + ld a, [hli] + ld [de], a ; copy x coord + inc de + ld a, [hli] + ld [bc], a ; copy sign text id + inc bc + pop af + dec a + jr nz, .signcopyloop ret ; function to load map data LoadMapData:: - ld a,[H_LOADEDROMBANK] + ld a, [H_LOADEDROMBANK] push af call DisableLCD - ld a,$98 - ld [wMapViewVRAMPointer + 1],a - xor a - ld [wMapViewVRAMPointer],a - ld [hSCY],a - ld [hSCX],a - ld [wWalkCounter],a - ld [wUnusedD119],a - ld [wWalkBikeSurfStateCopy],a - ld [wSpriteSetID],a + call ResetMapVariables call LoadTextBoxTilePatterns call LoadMapHeader - callba InitMapSprites ; load tile pattern data for sprites + call InitMapSprites ; load tile pattern data for sprites + call LoadScreenRelatedData + call CopyMapViewToVRAM + ld a, $01 + ld [wUpdateSpritesEnabled], a + call EnableLCD + ld b, $09 + call RunPaletteCommand + call LoadPlayerSpriteGraphics + ld a, [wd732] + and 1 << 4 | 1 << 3 ; fly warp or dungeon warp + jr nz, .restoreRomBank + ld a, [wFlags_D733] + bit 1, a + jr nz, .restoreRomBank + call UpdateMusic6Times ; music related + call PlayDefaultMusicFadeOutCurrent ; music related +.restoreRomBank + pop af + call BankswitchCommon + ret + +LoadScreenRelatedData:: call LoadTileBlockMap call LoadTilesetTilePatternData call LoadCurrentMapView + ret + +ReloadMapAfterSurfingMinigame:: + ld a, [H_LOADEDROMBANK] + push af + call DisableLCD + call ResetMapVariables + ld a, [wCurMap] + call SwitchToMapRomBank + call LoadScreenRelatedData + call CopyMapViewToVRAM + ld de, vBGMap1 + call CopyMapViewToVRAM2 + call EnableLCD + call ReloadMapSpriteTilePatterns + pop af + call BankswitchCommon + jr asm_0f4d + +ReloadMapAfterPrinter:: + ld a, [H_LOADEDROMBANK] + push af + ld a, [wCurMap] + call SwitchToMapRomBank + call LoadTileBlockMap + pop af + call BankswitchCommon +asm_0f4d: + jpab SetMapSpecificScriptFlagsOnMapReload + ret ; useless? + +ResetMapVariables:: + ld a, $98 + ld [wMapViewVRAMPointer + 1], a + xor a + ld [wMapViewVRAMPointer], a + ld [hSCY], a + ld [hSCX], a + ld [wWalkCounter], a + ld [wUnusedD119], a + ld [wSpriteSetID], a + ld [wWalkBikeSurfStateCopy], a + ret + +CopyMapViewToVRAM:: ; copy current map view to VRAM - coord hl, 0, 0 - ld de,vBGMap0 - ld b,18 + ld de, vBGMap0 +CopyMapViewToVRAM2: + ld hl, wTileMap + ld b, 18 .vramCopyLoop - ld c,20 + ld c, 20 .vramCopyInnerLoop - ld a,[hli] - ld [de],a + ld a, [hli] + ld [de], a inc e dec c - jr nz,.vramCopyInnerLoop - ld a,32 - 20 + jr nz, .vramCopyInnerLoop + ld a, 32 - 20 ; total vram map width in tiles - screen width in tiles add e - ld e,a - jr nc,.noCarry + ld e, a + jr nc, .noCarry inc d .noCarry dec b - jr nz,.vramCopyLoop - ld a,$01 - ld [wUpdateSpritesEnabled],a - call EnableLCD - ld b, SET_PAL_OVERWORLD - call RunPaletteCommand - call LoadPlayerSpriteGraphics - ld a,[wd732] - and a,1 << 4 | 1 << 3 ; fly warp or dungeon warp - jr nz,.restoreRomBank - ld a,[wFlags_D733] - bit 1,a - jr nz,.restoreRomBank - call UpdateMusic6Times - call PlayDefaultMusicFadeOutCurrent -.restoreRomBank - pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + jr nz, .vramCopyLoop ret ; function to switch to the ROM bank that a map is stored in @@ -2365,28 +2112,45 @@ LoadMapData:: SwitchToMapRomBank:: push hl push bc - ld c,a - ld b,$00 - ld a,Bank(MapHeaderBanks) - call BankswitchHome ; switch to ROM bank 3 - ld hl,MapHeaderBanks - add hl,bc - ld a,[hl] - ld [$ffe8],a ; save map ROM bank + ld c, a + ld b, $00 + ld a, BANK(MapHeaderBanks) + call BankswitchHome ; switch to ROM bank 3F + ld hl, MapHeaderBanks + add hl, bc + ld a, [hl] + ld [$ffe8], a ; save map ROM bank call BankswitchBack - ld a,[$ffe8] - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a ; switch to map ROM bank + ld a, [$ffe8] + call BankswitchCommon pop bc pop hl ret +GetMapHeaderPointer:: + ld a, [H_LOADEDROMBANK] + push af + switchbank MapHeaderPointers ; 3f:41f2 + push de + ld a, [wCurMap] + ld e, a + ld d, $0 + ld hl, MapHeaderPointers + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + pop de + pop af + jp BankswitchCommon + IgnoreInputForHalfSecond: ld a, 30 ld [wIgnoreInputCounter], a ld hl, wd730 ld a, [hl] - or $26 + or %00100110 ; $26 ld [hl], a ; set ignore input bit ret @@ -2400,3 +2164,160 @@ ForceBikeOrSurf:: ld hl, LoadPlayerSpriteGraphics call Bankswitch jp PlayDefaultMusic ; update map/player state? + +; Handle the player jumping down +; a ledge in the overworld. +HandleMidJump:: + ld a, [wd736] + bit 6, a ; jumping down a ledge? + ret z + callba _HandleMidJump + ret + +IsSpinning:: + ld a, [wd736] + bit 7, a + ret z ; no spinning + jpba LoadSpinnerArrowTiles ; spin while moving + +Func_0ffe:: + jpab IsPlayerTalkingToPikachu + +InitSprites:: + ld a, [hli] + ld [wNumSprites], a ; save the number of sprites + push hl + push de + push bc + call ZeroSpriteStateData + call DisableRegularSprites + ld hl, wMapSpriteData + ld bc, $20 + xor a + call FillMemory + pop bc + pop de + pop hl + ld a, [wNumSprites] + and a ; are sprites existant? + ret z ; don't copy sprite data if not + ld b, a + ld c, $0 + ld de, wSpriteStateData1 + $10 +; copy sprite stuff? +.loadSpriteLoop + ld a, [hli] + ld [de], a ; store picture ID at C1X0 + inc d + ld a, e + add $4 + ld e, a + ld a, [hli] + ld [de], a ; store Y position at C2X4 + inc e + ld a, [hli] + ld [de], a ; store X position at C2X5 + inc e + ld a, [hli] + ld [de], a ; store movement byte 1 at C2X6 + ld a, [hli] + ld [$ff8d], a ; save movement byte 2 + ld a, [hli] + ld [$ff8e], a ; save text ID and flags byte + push bc + call LoadSprite + pop bc + dec d + ld a, e + add $a + ld e, a + inc c + inc c + dec b + jr nz, .loadSpriteLoop + ret + +ZeroSpriteStateData:: +; zero C110-C1EF and C210-C2EF +; C1F0-C1FF and C2F0-C2FF is used for Pikachu + ld hl, wSpriteStateData1 + $10 + ld de, wSpriteStateData2 + $10 + xor a + ld b, 14 * $10 +.loop + ld [hli], a + ld [de], a + inc e + dec b + jr nz, .loop + ret + +DisableRegularSprites:: +; initialize all C100-C1FF sprite entries to disabled (other than player's and pikachu) + ld hl, wSpriteStateData1 + 1 * $10 + 2 + ld de, $10 + ld c, $e +.loop + ld [hl], $ff + add hl, de + dec c + jr nz, .loop + ret + +LoadSprite:: + push hl + ld b, $0 + ld hl, wMapSpriteData + add hl, bc + ld a, [$ff8d] + ld [hli], a ; store movement byte 2 in byte 0 of sprite entry + ld a, [$ff8e] + ld [hl], a ; this appears pointless, since the value is overwritten immediately after + ld a, [$ff8e] + ld [$ff8d], a + and $3f + ld [hl], a ; store text ID in byte 1 of sprite entry + pop hl + ld a, [$ff8d] + bit 6, a + jr nz, .trainerSprite + bit 7, a + jr nz, .itemBallSprite +; for regular sprites + push hl + ld hl, wMapSpriteExtraData + add hl, bc +; zero both bytes, since regular sprites don't use this extra space + xor a + ld [hli], a + ld [hl], a + pop hl + ret + +.trainerSprite + ld a, [hli] + ld [$ff8d], a ; save trainer class + ld a, [hli] + ld [$ff8e], a ; save trainer number (within class) + push hl + ld hl, wMapSpriteExtraData + add hl, bc + ld a, [$ff8d] + ld [hli], a ; store trainer class in byte 0 of the entry + ld a, [$ff8e] + ld [hl], a ; store trainer number in byte 1 of the entry + pop hl + ret + +.itemBallSprite + ld a, [hli] + ld [$ff8d], a ; save item number + push hl + ld hl, wMapSpriteExtraData + add hl, bc + ld a, [$ff8d] + ld [hli], a ; store item number in byte 0 of the entry + xor a + ld [hl], a ; zero byte 1, since it is not used + pop hl + ret ; end of home/overworld.asm = 10b9 (0:10b9) diff --git a/home/pic.asm b/home/pic.asm index 15ee53ad..d0645a8c 100644 --- a/home/pic.asm +++ b/home/pic.asm @@ -5,16 +5,13 @@ UncompressSpriteData:: ld a, [H_LOADEDROMBANK] push af ld a, b - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a - ld a, $a - ld [$0], a - xor a - ld [$4000], a + call BankswitchCommon + ld a,$0 + call SwitchSRAMBankAndLatchClockData call _UncompressSpriteData + call PrepareRTCDataAndDisableSRAM pop af - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + call BankswitchCommon ret ; initializes necessary data to load a sprite and runs UncompressSpriteDataLoop @@ -531,15 +528,15 @@ ReverseNybble:: ld de, NybbleReverseTable add e ld e, a - jr nc, .asm_283f + jr nc, .asm_2735 inc d -.asm_283f +.asm_2735 ld a, [de] ret ; resets sprite buffer pointers to buffer 1 and 2, depending on wSpriteLoadFlags ResetSpriteBufferPointers:: - ld a, [wSpriteLoadFlags] + ld a, [wSpriteLoadFlags] ; wd0a8 bit 0, a jr nz, .buffer2Selected ld de, sSpriteBuffer1 diff --git a/home/pikachu.asm b/home/pikachu.asm new file mode 100755 index 00000000..d16e95db --- /dev/null +++ b/home/pikachu.asm @@ -0,0 +1,114 @@ +Func_1510:: + push hl + ld hl, wPikachuOverworldStateFlags + set 7, [hl] + ld hl, wPikachuSpriteImageIdx ; pikachu data? + ld [hl], $ff + pop hl + ret + +Func_151d:: + push hl + ld hl, wPikachuOverworldStateFlags + res 7, [hl] + pop hl + ret + +EnablePikachuOverworldSpriteDrawing:: + push hl + ld hl, wPikachuOverworldStateFlags + res 3, [hl] + pop hl + ret + +DisablePikachuOverworldSpriteDrawing:: + push hl + ld hl, wPikachuOverworldStateFlags + set 3, [hl] + ld hl, wPikachuSpriteImageIdx ; pikachu data? + ld [hl], $ff + pop hl + ret + +DisablePikachuFollowingPlayer:: + push hl + ld hl, wPikachuOverworldStateFlags + set 1, [hl] + pop hl + ret + +EnablePikachuFollowingPlayer:: + push hl + ld hl, wPikachuOverworldStateFlags + res 1, [hl] + pop hl + ret + +CheckPikachuFollowingPlayer:: + push hl + ld hl, wPikachuOverworldStateFlags + bit 1, [hl] + pop hl + ret + +SpawnPikachu:: + ld a, [hl] + dec a + swap a + ld [hTilePlayerStandingOn], a + homecall SpawnPikachu_ ; 3f:46d5 + ret + +Pikachu_IsInArray:: + ld b, $0 + ld c, a +.loop + inc b + ld a, [hli] + cp $ff + jr z, .not_in_array + cp c + jr nz, .loop + dec b + dec hl + scf + ret + +.not_in_array + dec b + dec hl + and a + ret + +GetPikachuMovementScriptByte:: + push hl + push bc + ld a, [H_LOADEDROMBANK] + push af + ld a, [wPikachuMovementScriptBank] + call BankswitchCommon + ld hl, wPikachuMovementScriptAddress + ld c, [hl] + inc hl + ld b, [hl] + ld a, [bc] + inc bc + ld [hl], b + dec hl + ld [hl], c + ld c, a + pop af + call BankswitchCommon + ld a, c + pop bc + pop hl + ret + +ApplyPikachuMovementData:: + ld a, [H_LOADEDROMBANK] + ld b, a + push af + callbs ApplyPikachuMovementData_ + pop af + call BankswitchCommon + ret diff --git a/engine/play_time.asm b/home/play_time.asm index a5202cc6..47b2a690 100755..100644 --- a/engine/play_time.asm +++ b/home/play_time.asm @@ -1,7 +1,10 @@ TrackPlayTime: call CountDownIgnoreInputBitReset - ld a, [wd732] - bit 0, a + ld hl, wd47a + bit 0, [hl] + jr nz, .maxIGT + ld a,[wd732] + bit 0,a ret z ld a, [wPlayTimeMaxed] and a @@ -32,19 +35,26 @@ TrackPlayTime: ld [wPlayTimeHours], a cp $ff ret nz + ld hl, wd47a + set 0, [hl] +.maxIGT + ld a, 59 + ld [wPlayTimeSeconds], a + ld [wPlayTimeMinutes], a ld a, $ff + ld [wPlayTimeHours], a ld [wPlayTimeMaxed], a ret CountDownIgnoreInputBitReset: ld a, [wIgnoreInputCounter] and a - jr nz, .asm_18e40 + jr nz, .asm_1f5e ld a, $ff - jr .asm_18e41 -.asm_18e40 + jr .asm_1f5f +.asm_1f5e dec a -.asm_18e41 +.asm_1f5f ld [wIgnoreInputCounter], a and a ret nz diff --git a/home/predef.asm b/home/predef.asm index 2fac9aca..c55760d7 100644 --- a/home/predef.asm +++ b/home/predef.asm @@ -19,8 +19,7 @@ Predef:: call GetPredefPointer ld a, [wPredefBank] - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + call BankswitchCommon ld de, .done push de @@ -28,8 +27,7 @@ Predef:: .done pop af - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + call BankswitchCommon ret GetPredefRegisters:: diff --git a/home/serial.asm b/home/serial.asm index 7a515118..508148df 100644 --- a/home/serial.asm +++ b/home/serial.asm @@ -3,6 +3,9 @@ Serial:: push bc push de push hl + ld a, [wPrinterConnectionOpen] + bit 0, a + jp nz, PrinterSerial__ ld a, [hSerialConnectionStatus] inc a jr z, .connectionNotYetEstablished @@ -91,79 +94,79 @@ Serial_ExchangeByte:: ld [hSerialReceivedNewData], a ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK - jr nz, .asm_21a7 + jr nz, .asm_2003 ld a, START_TRANSFER_INTERNAL_CLOCK ld [rSC], a -.asm_21a7 +.asm_2003 ld a, [hSerialReceivedNewData] and a - jr nz, .asm_21f1 + jr nz, .asm_204d ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK - jr nz, .asm_21cc + jr nz, .asm_2028 call IsUnknownCounterZero - jr z, .asm_21cc + jr z, .asm_2028 call WaitLoop_15Iterations push hl ld hl, wUnknownSerialCounter + 1 inc [hl] - jr nz, .asm_21c3 + jr nz, .asm_201f dec hl inc [hl] -.asm_21c3 +.asm_201f pop hl call IsUnknownCounterZero - jr nz, .asm_21a7 + jr nz, .asm_2003 jp SetUnknownCounterToFFFF -.asm_21cc +.asm_2028 ld a, [rIE] and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK) cp (1 << SERIAL) - jr nz, .asm_21a7 + jr nz, .asm_2003 ld a, [wUnknownSerialCounter2] dec a ld [wUnknownSerialCounter2], a - jr nz, .asm_21a7 + jr nz, .asm_2003 ld a, [wUnknownSerialCounter2 + 1] dec a ld [wUnknownSerialCounter2 + 1], a - jr nz, .asm_21a7 + jr nz, .asm_2003 ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK - jr z, .asm_21f1 + jr z, .asm_204d ld a, 255 .waitLoop dec a jr nz, .waitLoop -.asm_21f1 +.asm_204d xor a ld [hSerialReceivedNewData], a ld a, [rIE] and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK) sub (1 << SERIAL) - jr nz, .asm_2204 + jr nz, .asm_2060 ld [wUnknownSerialCounter2], a ld a, $50 ld [wUnknownSerialCounter2 + 1], a -.asm_2204 +.asm_2060 ld a, [hSerialReceiveData] cp SERIAL_NO_DATA_BYTE ret nz call IsUnknownCounterZero - jr z, .asm_221f + jr z, .asm_207b push hl ld hl, wUnknownSerialCounter + 1 ld a, [hl] dec a ld [hld], a inc a - jr nz, .asm_2219 + jr nz, .asm_2075 dec [hl] -.asm_2219 +.asm_2075 pop hl call IsUnknownCounterZero jr z, SetUnknownCounterToFFFF -.asm_221f +.asm_207b ld a, [rIE] and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK) cp (1 << SERIAL) @@ -225,7 +228,7 @@ Serial_ExchangeLinkMenuSelection:: Serial_PrintWaitingTextAndSyncAndExchangeNybble:: call SaveScreenTilesToBuffer1 - callab PrintWaitingText + callab PrintWaitingText ; 1:4b89 call Serial_SyncAndExchangeNybble jp LoadScreenTilesFromBuffer1 @@ -310,3 +313,11 @@ Serial_TryEstablishingExternallyClockedConnection:: ld a, START_TRANSFER_EXTERNAL_CLOCK ld [rSC], a ret + +PrinterSerial__:: + call PrinterSerial + pop hl + pop de + pop bc + pop af + reti diff --git a/home/text.asm b/home/text.asm index e9c0efdd..9c661f21 100644 --- a/home/text.asm +++ b/home/text.asm @@ -18,7 +18,7 @@ TextBoxBorder:: .next push hl ld a, "│" - ld [hli],a + ld [hli], a ld a, " " call NPlaceChar ld [hl], "│" @@ -49,89 +49,79 @@ NPlaceChar:: PlaceString:: push hl PlaceNextChar:: - ld a,[de] + ld a, [de] cp "@" - jr nz,.PlaceText - ld b,h - ld c,l + jr nz, Char4ETest + ld b, h + ld c, l pop hl ret -.PlaceText - cp $4E - jr nz,.next - ld bc,SCREEN_WIDTH * 2 - ld a,[hFlags_0xFFF6] - bit 2,a - jr z,.next2 - ld bc,SCREEN_WIDTH +Char4ETest:: + cp $4E ; next + jr nz, .next + ld bc, 2 * SCREEN_WIDTH + ld a, [hFlags_0xFFFA] + bit 2, a + jr z, .next2 + ld bc, SCREEN_WIDTH .next2 pop hl - add hl,bc + add hl, bc push hl - jp PlaceNextChar_inc + jp PlaceNextChar_inc ; 17b6 .next - cp $4F - jr nz,.next3 + cp $4F ; line + jr nz, .next3 pop hl coord hl, 1, 16 push hl jp PlaceNextChar_inc .next3 ; Check against a dictionary +dict: macro +if \1 == 0 and a - jp z,Char00 - cp $4C - jp z,Char4C - cp $4B - jp z,Char4B - cp $51 - jp z,Char51 - cp $49 - jp z,Char49 - cp $52 - jp z,Char52 - cp $53 - jp z,Char53 - cp $54 - jp z,Char54 - cp $5B - jp z,Char5B - cp $5E - jp z,Char5E - cp $5C - jp z,Char5C - cp $5D - jp z,Char5D - cp $55 - jp z,Char55 - cp $56 - jp z,Char56 - cp $57 - jp z,Char57 - cp $58 - jp z,Char58 - cp $4A - jp z,Char4A - cp $5F - jp z,Char5F - cp $59 - jp z,Char59 - cp $5A - jp z,Char5A - ld [hli],a +else + cp \1 +endc + jp z, \2 +endm + + dict $00, Char00 ; error + dict $4C, Char4C ; autocont + dict $4B, Char4B ; cont_ + dict $51, Char51 ; para + dict $49, Char49 ; page + dict $52, Char52 ; player + dict $53, Char53 ; rival + dict $54, Char54 ; POKé + dict $5B, Char5B ; PC + dict $5E, Char5E ; ROCKET + dict $5C, Char5C ; TM + dict $5D, Char5D ; TRAINER + dict $55, Char55 ; cont + dict $56, Char56 ; 6 dots + dict $57, Char57 ; done + dict $58, Char58 ; prompt + dict $4A, Char4A ; PKMN + dict $5F, Char5F ; dex + dict $59, Char59 ; TARGET + dict $5A, Char5A ; USER + + ld [hli], a call PrintLetterDelay PlaceNextChar_inc:: inc de jp PlaceNextChar Char00:: - ld b,h - ld c,l + ld b, h + ld c, l pop hl - ld de,Char00Text + ld de, Char00Text dec de ret @@ -141,47 +131,47 @@ Char00Text:: ; “%d ERROR.” Char52:: ; player’s name push de - ld de,wPlayerName + ld de, wPlayerName jr FinishDTE Char53:: ; rival’s name push de - ld de,wRivalName + ld de, wRivalName jr FinishDTE Char5D:: ; TRAINER push de - ld de,Char5DText + ld de, Char5DText jr FinishDTE Char5C:: ; TM push de - ld de,Char5CText + ld de, Char5CText jr FinishDTE Char5B:: ; PC push de - ld de,Char5BText + ld de, Char5BText jr FinishDTE Char5E:: ; ROCKET push de - ld de,Char5EText + ld de, Char5EText jr FinishDTE Char54:: ; POKé push de - ld de,Char54Text + ld de, Char54Text jr FinishDTE Char56:: ; …… push de - ld de,Char56Text + ld de, Char56Text jr FinishDTE Char4A:: ; PKMN push de - ld de,Char4AText + ld de, Char4AText jr FinishDTE Char59:: @@ -190,7 +180,7 @@ Char59:: ; or ; player active monster’s name ; (like Char5A but flipped) - ld a,[H_WHOSETURN] + ld a, [H_WHOSETURN] xor 1 jr MonsterNameCharsCommon @@ -199,27 +189,26 @@ Char5A:: ; player active monster’s name ; or ; enemy active monster’s name, prefixed with “Enemy ” - ld a,[H_WHOSETURN] + ld a, [H_WHOSETURN] MonsterNameCharsCommon:: push de and a - jr nz,.Enemy - ld de,wBattleMonNick ; player active monster name + jr nz, .Enemy + ld de, wBattleMonNick ; player active monster name jr FinishDTE .Enemy ; print “Enemy ” - ld de,Char5AText + ld de, Char5AText call PlaceString - - ld h,b - ld l,c - ld de,wEnemyMonNick ; enemy active monster name + ld h, b + ld l, c + ld de, wEnemyMonNick ; enemy active monster name FinishDTE:: call PlaceString - ld h,b - ld l,c + ld h, b + ld l, c pop de inc de jp PlaceNextChar @@ -239,76 +228,83 @@ Char56Text:: Char5AText:: db "Enemy @" Char4AText:: - db $E1,$E2,"@" ; PKMN + db $E1, $E2, "@" ; PKMN Char55:: push de - ld b,h - ld c,l - ld hl,Char55Text - call TextCommandProcessor - ld h,b - ld l,c + ld b, h + ld c, l + ld hl, Char55Text + call TextCommandProcessor ; 1919 + ld h, b + ld l, c pop de inc de jp PlaceNextChar Char55Text:: ; equivalent to Char4B - TX_FAR _Char55Text + TX_FAR _Char55Text ; a0c73 (28:4c73) db "@" Char5F:: ; ends a Pokédex entry - ld [hl],"." + ld [hl], "." pop hl ret -Char58:: - ld a,[wLinkState] +Char58:: ; 1863 (0:1863) prompt + ld a, [wLinkState] cp LINK_STATE_BATTLING - jp z,Next1AA2 - ld a,$EE + jp z, .next + ld a, $EE Coorda 18, 16 -Next1AA2:: - call ProtectedDelay3 - call ManualTextScroll - ld a, " " +.next ; 1870 (0:1870) + call ProtectedDelay3 ; 1913 + call ManualTextScroll ; 388e + ld a, " " ; space Coorda 18, 16 -Char57:: +Char57:: ; 1aad (0:1aad) done pop hl - ld de,Char58Text + ld de, Char58Text dec de ret Char58Text:: db "@" -Char51:: +Char51:: ; 1882 (0:1882) para push de - ld a,$EE + ld a, $EE Coorda 18, 16 call ProtectedDelay3 call ManualTextScroll coord hl, 1, 13 lb bc, 4, 18 call ClearScreenArea - ld c,20 + ld c, 20 call DelayFrames pop de coord hl, 1, 14 jp PlaceNextChar_inc Char49:: + ld a, [hFlags_0xFFFA] + bit 3, a + jr z, .Char49 + ld a, $4e + jp Char4ETest + +.Char49 push de - ld a,$EE + ld a, $EE Coorda 18, 16 call ProtectedDelay3 call ManualTextScroll coord hl, 1, 10 lb bc, 7, 18 call ClearScreenArea - ld c,20 + ld c, 20 call DelayFrames pop de pop hl @@ -317,7 +313,7 @@ Char49:: jp PlaceNextChar_inc Char4B:: - ld a,$EE + ld a, $EE Coorda 18, 16 call ProtectedDelay3 push de @@ -328,36 +324,36 @@ Char4B:: ;fall through Char4C:: push de - call Next1B18 - call Next1B18 + call ScrollTextUpOneLine ; 18f1 + call ScrollTextUpOneLine coord hl, 1, 16 pop de jp PlaceNextChar_inc -Next1B18:: +ScrollTextUpOneLine:: coord hl, 0, 14 coord de, 0, 13 - ld b,60 + ld b, 60 .next - ld a,[hli] - ld [de],a + ld a, [hli] + ld [de], a inc de dec b - jr nz,.next + jr nz, .next coord hl, 1, 16 ld a, " " - ld b,SCREEN_WIDTH - 2 + ld b, SCREEN_WIDTH - 2 .next2 - ld [hli],a + ld [hli], a dec b - jr nz,.next2 + jr nz, .next2 ; wait five frames - ld b,5 + ld b, 5 .WaitFrame call DelayFrame dec b - jr nz,.WaitFrame + jr nz, .WaitFrame ret @@ -368,42 +364,42 @@ ProtectedDelay3:: ret TextCommandProcessor:: - ld a,[wLetterPrintingDelayFlags] + ld a, [wLetterPrintingDelayFlags] push af - set 1,a - ld e,a - ld a,[$fff4] + set 1, a + ld e, a + ld a, [$fff9] xor e - ld [wLetterPrintingDelayFlags],a - ld a,c - ld [wUnusedCC3A],a - ld a,b - ld [wUnusedCC3B],a + ld [wLetterPrintingDelayFlags], a + ld a, c + ld [wTextDestinationTileAddrBuffer], a + ld a, b + ld [wTextDestinationTileAddrBuffer + 1], a NextTextCommand:: - ld a,[hli] + ld a, [hli] cp a, "@" ; terminator - jr nz,.doTextCommand + jr nz, .doTextCommand pop af - ld [wLetterPrintingDelayFlags],a + ld [wLetterPrintingDelayFlags], a ret .doTextCommand push hl - cp a,$17 - jp z,TextCommand17 - cp a,$0e - jp nc,TextCommand0B ; if a != 0x17 and a >= 0xE, go to command 0xB + cp a, $17 + jp z, TextCommand17 + cp a, $0e + jp nc, TextCommand0B ; if a != 0x17 and a >= 0xE, go to command 0xB ; if a < 0xE, use a jump table - ld hl,TextCommandJumpTable + ld hl, TextCommandJumpTable push bc add a - ld b,$00 - ld c,a - add hl,bc + ld b, $00 + ld c, a + add hl, bc pop bc - ld a,[hli] - ld h,[hl] - ld l,a + ld a, [hli] + ld h, [hl] + ld l, a jp [hl] ; draw box @@ -413,17 +409,17 @@ NextTextCommand:: ; CC = width TextCommand04:: pop hl - ld a,[hli] - ld e,a - ld a,[hli] - ld d,a - ld a,[hli] - ld b,a - ld a,[hli] - ld c,a + ld a, [hli] + ld e, a + ld a, [hli] + ld d, a + ld a, [hli] + ld b, a + ld a, [hli] + ld c, a push hl - ld h,d - ld l,e + ld h, d + ld l, e call TextBoxBorder pop hl jr NextTextCommand @@ -432,13 +428,13 @@ TextCommand04:: ; 00{string} TextCommand00:: pop hl - ld d,h - ld e,l - ld h,b - ld l,c + ld d, h + ld e, l + ld h, b + ld l, c call PlaceString - ld h,d - ld l,e + ld h, d + ld l, e inc hl jr NextTextCommand @@ -447,13 +443,13 @@ TextCommand00:: ; AAAA = address of string TextCommand01:: pop hl - ld a,[hli] - ld e,a - ld a,[hli] - ld d,a + ld a, [hli] + ld e, a + ld a, [hli] + ld d, a push hl - ld h,b - ld l,c + ld h, b + ld l, c call PlaceString pop hl jr NextTextCommand @@ -466,18 +462,18 @@ TextCommand01:: ; bits 5-7 = unknown flags TextCommand02:: pop hl - ld a,[hli] - ld e,a - ld a,[hli] - ld d,a - ld a,[hli] + ld a, [hli] + ld e, a + ld a, [hli] + ld d, a + ld a, [hli] push hl - ld h,b - ld l,c - ld c,a + ld h, b + ld l, c + ld c, a call PrintBCDNumber - ld b,h - ld c,l + ld b, h + ld c, l pop hl jr NextTextCommand @@ -486,12 +482,12 @@ TextCommand02:: ; AAAA = new destination address TextCommand03:: pop hl - ld a,[hli] - ld [wUnusedCC3A],a - ld c,a - ld a,[hli] - ld [wUnusedCC3B],a - ld b,a + ld a, [hli] + ld [wTextDestinationTileAddrBuffer], a + ld c, a + ld a, [hli] + ld [wTextDestinationTileAddrBuffer + 1], a + ld b, a jp NextTextCommand ; repoint destination to second line of dialogue text box @@ -506,15 +502,15 @@ TextCommand05:: ; 06 ; (no arguments) TextCommand06:: - ld a,[wLinkState] - cp a,LINK_STATE_BATTLING - jp z,TextCommand0D - ld a,$ee ; down arrow + ld a, [wLinkState] + cp a, LINK_STATE_BATTLING + jp z, TextCommand0D + ld a, $ee ; down arrow Coorda 18, 16 ; place down arrow in lower right corner of dialogue text box push bc call ManualTextScroll ; blink arrow and wait for A or B to be pressed pop bc - ld a," " + ld a, " " Coorda 18, 16 ; overwrite down arrow with blank space pop hl jp NextTextCommand @@ -523,10 +519,10 @@ TextCommand06:: ; 07 ; (no arguments) TextCommand07:: - ld a," " + ld a, " " Coorda 18, 16 ; place blank space in lower right corner of dialogue text box - call Next1B18 ; scroll up text - call Next1B18 + call ScrollTextUpOneLine ; scroll up text + call ScrollTextUpOneLine pop hl coord bc, 1, 16 ; address of second line of dialogue text box jp NextTextCommand @@ -535,7 +531,7 @@ TextCommand07:: ; 08{code} TextCommand08:: pop hl - ld de,NextTextCommand + ld de, NextTextCommand push de ; return address jp [hl] @@ -547,25 +543,25 @@ TextCommand08:: ; bits 4-7 = how long the number is in bytes TextCommand09:: pop hl - ld a,[hli] - ld e,a - ld a,[hli] - ld d,a - ld a,[hli] + ld a, [hli] + ld e, a + ld a, [hli] + ld d, a + ld a, [hli] push hl - ld h,b - ld l,c - ld b,a - and a,$0f - ld c,a - ld a,b - and a,$f0 + ld h, b + ld l, c + ld b, a + and a, $0f + ld c, a + ld a, b + and a, $f0 swap a - set BIT_LEFT_ALIGN,a - ld b,a + set BIT_LEFT_ALIGN, a + ld b, a call PrintNumber - ld b,h - ld c,l + ld b, h + ld c, l pop hl jp NextTextCommand @@ -575,10 +571,10 @@ TextCommand09:: TextCommand0A:: push bc call Joypad - ld a,[hJoyHeld] - and a,A_BUTTON | B_BUTTON - jr nz,.skipDelay - ld c,30 + ld a, [hJoyHeld] + and a, A_BUTTON | B_BUTTON + jr nz, .skipDelay + ld c, 30 call DelayFrames .skipDelay pop bc @@ -592,24 +588,24 @@ TextCommand0B:: pop hl push bc dec hl - ld a,[hli] - ld b,a ; b = command number that got us here + ld a, [hli] + ld b, a ; b = command number that got us here push hl - ld hl,TextCommandSounds + ld hl, TextCommandSounds .loop - ld a,[hli] + ld a, [hli] cp b - jr z,.matchFound + jr z, .matchFound inc hl jr .loop .matchFound - cp a,$14 - jr z,.pokemonCry - cp a,$15 - jr z,.pokemonCry - cp a,$16 - jr z,.pokemonCry - ld a,[hl] + cp a, $14 + jr z, .pokemonCry + cp a, $15 + jr z, .pokemonCry + cp a, $16 + jr z, .pokemonCry + ld a, [hl] call PlaySound call WaitForSoundToFinish pop hl @@ -617,7 +613,7 @@ TextCommand0B:: jp NextTextCommand .pokemonCry push de - ld a,[hl] + ld a, [hl] call PlayCry pop de pop hl @@ -626,43 +622,43 @@ TextCommand0B:: ; format: text command ID, sound ID or cry ID TextCommandSounds:: - db $0B,SFX_GET_ITEM_1 - db $12,SFX_CAUGHT_MON - db $0E,SFX_POKEDEX_RATING - db $0F,SFX_GET_ITEM_1 - db $10,SFX_GET_ITEM_2 - db $11,SFX_GET_KEY_ITEM - db $13,SFX_DEX_PAGE_ADDED - db $14,NIDORINA ; used in OakSpeech - db $15,PIDGEOT ; used in SaffronCityText12 - db $16,DEWGONG ; unused? + db $0B, SFX_GET_ITEM_1 + db $12, SFX_TURN_OFF_PC + db $0E, SFX_POKEDEX_RATING + db $0F, SFX_GET_ITEM_1 + db $10, SFX_GET_ITEM_2 + db $11, SFX_GET_KEY_ITEM + db $13, SFX_TRADE_MACHINE + db $14, PIKACHU ; used in OakSpeech + db $15, PIDGEOT ; used in SaffronCityText12 + db $16, DEWGONG ; unused? ; draw ellipses ; 0CAA ; AA = number of ellipses to draw TextCommand0C:: pop hl - ld a,[hli] - ld d,a + ld a, [hli] + ld d, a push hl - ld h,b - ld l,c + ld h, b + ld l, c .loop - ld a,$75 ; ellipsis - ld [hli],a + ld a, $75 ; ellipsis + ld [hli], a push de call Joypad pop de - ld a,[hJoyHeld] ; joypad state - and a,A_BUTTON | B_BUTTON - jr nz,.skipDelay ; if so, skip the delay - ld c,10 + ld a, [hJoyHeld] ; joypad state + and a, A_BUTTON | B_BUTTON + jr nz, .skipDelay ; if so, skip the delay + ld c, 10 call DelayFrames .skipDelay dec d - jr nz,.loop - ld b,h - ld c,l + jr nz, .loop + ld b, h + ld c, l pop hl jp NextTextCommand @@ -682,23 +678,23 @@ TextCommand0D:: ; BB = bank TextCommand17:: pop hl - ld a,[H_LOADEDROMBANK] + ld a, [H_LOADEDROMBANK] push af - ld a,[hli] - ld e,a - ld a,[hli] - ld d,a - ld a,[hli] - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + ld a, [hli] + ld e, a + ld a, [hli] + ld d, a + ld a, [hli] + ld [H_LOADEDROMBANK], a + ld [MBC1RomBank], a push hl - ld l,e - ld h,d + ld l, e + ld h, d call TextCommandProcessor pop hl pop af - ld [H_LOADEDROMBANK],a - ld [MBC1RomBank],a + ld [H_LOADEDROMBANK], a + ld [MBC1RomBank], a jp NextTextCommand TextCommandJumpTable:: diff --git a/home/vblank.asm b/home/vblank.asm index f69d4a86..9cc8d42f 100644 --- a/home/vblank.asm +++ b/home/vblank.asm @@ -5,6 +5,11 @@ VBlank:: push de push hl + ld a, [rVBK] ; vram bank + push af + xor a + ld [rVBK], a ; reset vram bank to 0 + ld a, [H_LOADEDROMBANK] ld [wVBlankSavedROMBank], a @@ -27,14 +32,16 @@ VBlank:: call VBlankCopyDouble call UpdateMovingBgTiles call $ff80 ; hOAMDMA - ld a, Bank(PrepareOAMData) + ld a, BANK(PrepareOAMData) ld [H_LOADEDROMBANK], a ld [MBC1RomBank], a call PrepareOAMData ; VBlank-sensitive operations end. + call TrackPlayTime ; keep track of time played call Random + call ReadJoypad ld a, [H_VBLANKOCCURRED] and a @@ -48,40 +55,22 @@ VBlank:: jr z, .skipDec dec a ld [H_FRAMECOUNTER], a - .skipDec + call FadeOutAudio - ld a, [wAudioROMBank] ; music ROM bank - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + callbs Music_DoLowHealthAlarm + callbs Audio1_UpdateMusic - cp BANK(Audio1_UpdateMusic) - jr nz, .checkForAudio2 -.audio1 - call Audio1_UpdateMusic - jr .afterMusic -.checkForAudio2 - cp BANK(Audio2_UpdateMusic) - jr nz, .audio3 -.audio2 - call Music_DoLowHealthAlarm - call Audio2_UpdateMusic - jr .afterMusic -.audio3 - call Audio3_UpdateMusic -.afterMusic - - callba TrackPlayTime ; keep track of time played - - ld a, [hDisableJoypadPolling] - and a - call z, ReadJoypad + call SerialFunction ld a, [wVBlankSavedROMBank] ld [H_LOADEDROMBANK], a ld [MBC1RomBank], a + pop af + ld [rVBK],a + pop hl pop de pop bc diff --git a/home/vcopy.asm b/home/vcopy.asm index b7fb099e..2974dfec 100644 --- a/home/vcopy.asm +++ b/home/vcopy.asm @@ -33,13 +33,13 @@ ClearBgMap:: jr nz,.loop ret -RedrawRowOrColumn:: ; This function redraws a BG row of height 2 or a BG column of width 2. ; One of its main uses is redrawing the row or column that will be exposed upon ; scrolling the BG when the player takes a step. Redrawing only the exposed ; row or column is more efficient than redrawing the entire screen. ; However, this function is also called repeatedly to redraw the whole screen ; when necessary. It is also used in trade animation and elevator code. +RedrawRowOrColumn:: ld a,[hRedrawRowOrColumnMode] and a ret z @@ -123,11 +123,7 @@ AutoBgMapTransfer:: ld a,[H_AUTOBGTRANSFERENABLED] and a ret z - ld hl,[sp + 0] - ld a,h - ld [H_SPTEMP],a - ld a,l - ld [H_SPTEMP + 1],a ; save stack pinter + ld [H_SPTEMP],sp ; save stack pinter ld a,[H_AUTOBGTRANSFERPORTION] and a jr z,.transferTopThird @@ -193,9 +189,9 @@ TransferBgRows:: jr nz, TransferBgRows ld a, [H_SPTEMP] - ld h, a - ld a, [H_SPTEMP + 1] ld l, a + ld a, [H_SPTEMP + 1] + ld h, a ld sp, hl ret @@ -205,11 +201,7 @@ VBlankCopyBgMap:: ld a,[H_VBCOPYBGSRC] ; doubles as enabling byte and a ret z - ld hl,[sp + 0] - ld a,h - ld [H_SPTEMP],a - ld a,l - ld [H_SPTEMP + 1],a ; save stack pointer + ld [H_SPTEMP],sp ; save stack pointer ld a,[H_VBCOPYBGSRC] ld l,a ld a,[H_VBCOPYBGSRC + 1] @@ -238,11 +230,7 @@ VBlankCopyDouble:: and a ret z - ld hl, [sp + 0] - ld a, h - ld [H_SPTEMP], a - ld a, l - ld [H_SPTEMP + 1], a + ld [H_SPTEMP],sp ; save stack pointer ld a, [H_VBCOPYDOUBLESRC] ld l, a @@ -285,21 +273,14 @@ VBlankCopyDouble:: dec b jr nz, .loop - ld a, l - ld [H_VBCOPYDOUBLEDEST], a - ld a, h - ld [H_VBCOPYDOUBLEDEST + 1], a - - ld hl, [sp + 0] - ld a, l - ld [H_VBCOPYDOUBLESRC], a - ld a, h - ld [H_VBCOPYDOUBLESRC + 1], a + ld [H_VBCOPYDOUBLESRC],sp + ld sp,hl ; load destination into sp to save time with ld [$xxxx],sp + ld [H_VBCOPYDOUBLEDEST], sp ld a, [H_SPTEMP] - ld h, a - ld a, [H_SPTEMP + 1] ld l, a + ld a, [H_SPTEMP + 1] + ld h, a ld sp, hl ret @@ -316,11 +297,7 @@ VBlankCopy:: and a ret z - ld hl, [sp + 0] - ld a, h - ld [H_SPTEMP], a - ld a, l - ld [H_SPTEMP + 1], a + ld [H_SPTEMP],sp ld a, [H_VBCOPYSRC] ld l, a @@ -355,21 +332,14 @@ VBlankCopy:: dec b jr nz, .loop - ld a, l - ld [H_VBCOPYDEST], a - ld a, h - ld [H_VBCOPYDEST + 1], a - - ld hl, [sp + 0] - ld a, l - ld [H_VBCOPYSRC], a - ld a, h - ld [H_VBCOPYSRC + 1], a + ld [H_VBCOPYSRC],sp + ld sp,hl + ld [H_VBCOPYDEST],sp ld a, [H_SPTEMP] - ld h, a - ld a, [H_SPTEMP + 1] ld l, a + ld a, [H_SPTEMP + 1] + ld h, a ld sp, hl ret @@ -383,6 +353,10 @@ UpdateMovingBgTiles:: and a ret z ; no animations if indoors (or if a menu set this to 0) + ld a,[rLY] + cp $90 ; check if not in vblank period??? (maybe if vblank is too long) + ret c + ld a, [hMovingBGTilesCounter1] inc a ld [hMovingBGTilesCounter1], a @@ -16,8 +16,6 @@ hWarpDestinationMap EQU $FF8B hOAMTile EQU $FF8B -hROMBankTemp EQU $FF8B - hPreviousTileset EQU $FF8B hEastWestConnectedMapWidth EQU $FF8B @@ -155,6 +153,8 @@ hCoins EQU $FFA0 ; 2-byte BCD number hDivideBCDDivisor EQU $FFA2 ; 3-byte BCD number hDivideBCDQuotient EQU $FFA2 ; 3-byte BCD number +hDivideBCDBuffer EQU $FFA5 ; 3 bytes + hSerialReceivedNewData EQU $FFA9 @@ -271,6 +271,8 @@ H_CURRENTSPRITEOFFSET EQU $FFDA ; multiple of $10 hItemCounter EQU $FFDB +hCanceledPrinting EQU $FFDB + hGymGateIndex EQU $FFDB hGymTrashCanRandNumMask EQU $FFDB @@ -309,15 +311,24 @@ hCoordsInFrontOfPlayerMatch EQU $FFEA hSpriteAnimFrameCounter EQU $FFEA +hItemAlreadyFound EQU $FFEB + +hDidntFindAnyHiddenObject EQU $FFEE + H_WHOSETURN EQU $FFF3 ; 0 on player’s turn, 1 on enemy’s turn +hLCDCPointer EQU $FFF4 + +hJoyInput EQU $FFF5 + +hDisableJoypadPolling EQU $FFF8 ; non-zero value disables polling of joypad + ; bit 0: draw HP fraction to the right of bar instead of below (for party menu) ; bit 1: menu is double spaced -hFlags_0xFFF6 EQU $FFF6 - -hFieldMoveMonMenuTopMenuItemX EQU $FFF7 +hFlags_0xFFFA EQU $FFFA -hDisableJoypadPolling EQU $FFF9 +hFieldMoveMonMenuTopMenuItemX EQU $FFFB -hJoyInput EQU $FFF8 +h_0xFFFC EQU $FFFC +hGBC EQU $FFFE ; 0 if DMG, != 0 if GBC @@ -17,6 +17,22 @@ lb: MACRO ; r, hi, lo ld \1, (\2) << 8 + ((\3) & $ff) ENDM +SHADE_BLACK EQU %11 +SHADE_DARK EQU %10 +SHADE_LIGHT EQU %01 +SHADE_WHITE EQU %00 + +setpal: MACRO + ld a, \1 << 6 | \2 << 4 | \3 << 2 | \4 +ENDM + +setpalBGP: MACRO + setpal SHADE_BLACK, SHADE_DARK, SHADE_LIGHT, SHADE_WHITE +ENDM + +setpalOBP: MACRO + setpal SHADE_BLACK, SHADE_DARK, SHADE_WHITE, SHADE_WHITE +ENDM ; Constant enumeration is useful for monsters, items, moves, etc. const_def: MACRO @@ -28,20 +44,58 @@ const: MACRO const_value = const_value + 1 ENDM +homecall_jump: MACRO + ld a, [H_LOADEDROMBANK] + push af + ld a, BANK(\1) + call BankswitchCommon + call \1 + pop af + jp BankswitchCommon + ENDM + +homecall_jump_sf: MACRO + ld a, [H_LOADEDROMBANK] + push af + ld a, BANK(\1) + call BankswitchCommon + call \1 + pop bc + ld a,b + jp BankswitchCommon + ENDM homecall: MACRO ld a, [H_LOADEDROMBANK] push af ld a, BANK(\1) - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + call BankswitchCommon call \1 pop af - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a + call BankswitchCommon + ENDM + +homecall_sf: MACRO ; homecall but save flags by popping into bc instead of af + ld a, [H_LOADEDROMBANK] + push af + ld a, BANK(\1) + call BankswitchCommon + call \1 + pop bc + ld a,b + call BankswitchCommon ENDM -farcall EQUS "callba" +switchbank: MACRO + ld a, BANK(\1) + call BankswitchCommon + ENDM + +callbs: MACRO + ld a, BANK(\1) + call BankswitchCommon + call \1 + ENDM callba: MACRO ld b, BANK(\1) @@ -55,6 +109,20 @@ callab: MACRO call Bankswitch ENDM +calladb_ModifyPikachuHappiness: MACRO + ld hl, ModifyPikachuHappiness + ld d, \1 + ld b, BANK(ModifyPikachuHappiness) + call Bankswitch + ENDM + +callabd_ModifyPikachuHappiness: MACRO + ld hl, ModifyPikachuHappiness + ld b, BANK(ModifyPikachuHappiness) + ld d, \1 + call Bankswitch + ENDM + jpba: MACRO ld b, BANK(\1) ld hl, \1 @@ -81,29 +149,62 @@ bcd3: MACRO coins equs "bcd2" money equs "bcd3" +validateCoords: MACRO + if \1 >= SCREEN_WIDTH + fail "x coord out of range" + endc + if \2 >= SCREEN_HEIGHT + fail "y coord out of range" + endc + endm + ;\1 = r ;\2 = X ;\3 = Y +;\4 = which tilemap (optional) coord: MACRO - ld \1, wTileMap + 20 * \3 + \2 + validateCoords \2, \3 +if _NARG >= 4 + ld \1, \4 + SCREEN_WIDTH * \3 + \2 +else + ld \1, wTileMap + SCREEN_WIDTH * \3 + \2 +endc ENDM ;\1 = X ;\2 = Y +;\3 = which tilemap (optional) aCoord: MACRO - ld a, [wTileMap + 20 * \2 + \1] + validateCoords \1, \2 +if _NARG >= 3 + ld a, [\3 + SCREEN_WIDTH * \2 + \1] +else + ld a, [wTileMap + SCREEN_WIDTH * \2 + \1] +endc ENDM ;\1 = X ;\2 = Y +;\3 = which tilemap (optional) Coorda: MACRO - ld [wTileMap + 20 * \2 + \1], a + validateCoords \1, \2 +if _NARG >= 3 + ld [\3 + SCREEN_WIDTH * \2 + \1], a +else + ld [wTileMap + SCREEN_WIDTH * \2 + \1], a +endc ENDM ;\1 = X ;\2 = Y +;\3 = which tilemap (optional) dwCoord: MACRO - dw wTileMap + 20 * \2 + \1 + validateCoords \1, \2 +if _NARG >= 3 + dw \3 + SCREEN_WIDTH * \2 + \1 +else + dw wTileMap + SCREEN_WIDTH * \2 + \1 +endc ENDM ;\1 = r @@ -134,7 +235,7 @@ EMAP: MACRO ; emap x-coordinate,y-coordinate,textpointer ; nybble: y-coordinate ; nybble: x-coordinate ; word : pointer to map name - db (\1 + (\2 << 4)) + dn \2, \1 dw \3 ENDM @@ -146,7 +247,7 @@ IMAP: MACRO ; imap mapid_less_than,x-coordinate,y-coordinate,textpointer ; nybble: x-coordinate ; word : pointer to map name db \1 + 1 - db \2 + \3 << 4 + dn \3, \2 dw \4 ENDM @@ -174,28 +275,30 @@ dbw: MACRO dw \2 ENDM -; data format macros -RGB: MACRO - dw (\3 << 10 | \2 << 5 | \1) +dba: MACRO + dbw BANK(\1), \1 ENDM -; text macros -TX_NUM: MACRO -; print a big-endian decimal number. -; \1: address to read from -; \2: number of bytes to read -; \3: number of digits to display - db $09 +dwb: MACRO dw \1 - db \2 << 4 | \3 + db \2 ENDM -TX_FAR: MACRO - db $17 - dw \1 - db BANK(\1) +dab: MACRO + dwb \1, BANK(\1) ENDM +dbbw: MACRO + db \1, \2 + dw \3 + ENDM + +; data format macros +RGB: MACRO + dw (\3 << 10 | \2 << 5 | \1) + ENDM + +; text macros ; text engine command $1 TX_RAM: MACRO ; prints text to screen @@ -212,32 +315,62 @@ TX_BCD: MACRO db \2 ENDM -TX_MART: MACRO - db $FE, _NARG - rept _NARG - db \1 - shift - endr - db $FF +TX_CURSOR: MACRO +; Move cursor to (\1, \2) +; \1: X coord (0 - 19) +; \2: Y coord (0 - 17) + db $3 + dwCoord \1, \2 ENDM TX_LINE EQUS "db $05" TX_BUTTON_SOUND EQUS "db $06" TX_ASM EQUS "db $08" + +TX_NUM: MACRO +; print a big-endian decimal number. +; \1: address to read from +; \2: number of bytes to read +; \3: number of digits to display + db $09 + dw \1 + db \2 << 4 | \3 + ENDM + TX_SFX_ITEM EQUS "db $0b" TX_WAIT_BUTTON EQUS "db $0d" TX_SFX_CONGRATS EQUS "db $10" TX_SFX_KEY_ITEM EQUS "db $11" +TX_FAR: MACRO +; 17AAAABB (call text at BB:AAAA) + db $17 + dab \1 + ENDM + TX_VENDING_MACHINE EQUS "db $f5" TX_CABLE_CLUB_RECEPTIONIST EQUS "db $f6" TX_PRIZE_VENDOR EQUS "db $f7" TX_POKECENTER_PC EQUS "db $f9" TX_PLAYERS_PC EQUS "db $fc" TX_BILLS_PC EQUS "db $fd" + +TX_MART: MACRO + db $FE, _NARG + rept _NARG + db \1 + shift + endr + db $FF + ENDM + TX_POKECENTER_NURSE EQUS "db $ff" ; Predef macro. +predef_const: MACRO + const \1PredefID + ENDM + add_predef: MACRO \1Predef:: db BANK(\1) @@ -258,11 +391,18 @@ predef_jump: MACRO jp Predef ENDM +tx_pre_const: MACRO + const \1_id + ENDM add_tx_pre: MACRO \1_id:: dw \1 ENDM +db_tx_pre: MACRO + db (\1_id - TextPredefs) / 2 + 1 +ENDM + tx_pre_id: MACRO ld a, (\1_id - TextPredefs) / 2 + 1 ENDM @@ -315,11 +455,6 @@ object: MACRO ENDC ENDM -StopAllMusic: macro - ld a, $ff - call PlaySound - endm - ;1_channel EQU $00 ;2_channels EQU $40 ;3_channels EQU $80 @@ -674,10 +809,60 @@ ENDM tmlearn: MACRO x = 0 rept _NARG -if \1 != 0 +IF \1 != 0 x = x | (1 << ((\1 - 1) % 8)) -endc +ENDC shift endr db x ENDM + +sine_wave: MACRO +; \1: amplitude + +x = 0 + rept $20 + ; Round up. + dw (sin(x) + (sin(x) & $ff)) >> 8 +x = x + (\1) * $40000 + endr +ENDM + +enum_start: macro +if _NARG >= 1 +__enum__ = \1 +else +__enum__ = 0 +endc +if _NARG >= 2 +__enumdir__ = \2 +else +__enumdir__ = +1 +endc +endm + +enum: macro +\1 = __enum__ +__enum__ = __enum__ + __enumdir__ +endm + +enum_set: macro +__enum__ = \1 +endm + +ANIM_OBJ_INDEX EQUS "AnimatedObject0Index - AnimatedObject0" +ANIM_OBJ_FRAME_SET EQUS "AnimatedObject0FramesetID - AnimatedObject0" +ANIM_OBJ_CALLBACK EQUS "AnimatedObject0AnimSeqID - AnimatedObject0" +ANIM_OBJ_TILE EQUS "AnimatedObject0TileID - AnimatedObject0" +ANIM_OBJ_X_COORD EQUS "AnimatedObject0XCoord - AnimatedObject0" +ANIM_OBJ_Y_COORD EQUS "AnimatedObject0YCoord - AnimatedObject0" +ANIM_OBJ_X_OFFSET EQUS "AnimatedObject0XOffset - AnimatedObject0" +ANIM_OBJ_Y_OFFSET EQUS "AnimatedObject0YOffset - AnimatedObject0" +ANIM_OBJ_DURATION EQUS "AnimatedObject0Duration - AnimatedObject0" +ANIM_OBJ_DURATION_OFFSET EQUS "AnimatedObject0DurationOffset - AnimatedObject0" +ANIM_OBJ_FRAME_IDX EQUS "AnimatedObject0FrameIndex - AnimatedObject0" +ANIM_OBJ_FIELD_B EQU $b +ANIM_OBJ_FIELD_C EQU $c +ANIM_OBJ_FIELD_D EQU $d +ANIM_OBJ_FIELD_E EQU $e +ANIM_OBJ_FIELD_F EQU $f @@ -1,3 +1,4 @@ +INCLUDE "charmap.asm" INCLUDE "constants.asm" NPC_SPRITES_1 EQU $4 @@ -11,4730 +12,137 @@ PICS_3 EQU $B PICS_4 EQU $C PICS_5 EQU $D - INCLUDE "home.asm" -SECTION "bank1",ROMX,BANK[$1] +SECTION "bank01",ROMX,BANK[$01] INCLUDE "data/facing.asm" -ResetStatusAndHalveMoneyOnBlackout:: -; Reset player status on blackout. - xor a - ld [wBattleResult], a - ld [wWalkBikeSurfState], a - ld [wIsInBattle], a - ld [wMapPalOffset], a - ld [wNPCMovementScriptFunctionNum], a - ld [hJoyHeld], a - ld [wNPCMovementScriptPointerTableNum], a - ld [wFlags_0xcd60], a - - ld [hMoney], a - ld [hMoney + 1], a - ld [hMoney + 2], a - call HasEnoughMoney - jr c, .lostmoney ; never happens - - ; Halve the player's money. - ld a, [wPlayerMoney] - ld [hMoney], a - ld a, [wPlayerMoney + 1] - ld [hMoney + 1], a - ld a, [wPlayerMoney + 2] - ld [hMoney + 2], a - xor a - ld [hDivideBCDDivisor], a - ld [hDivideBCDDivisor + 1], a - ld a, 2 - ld [hDivideBCDDivisor + 2], a - predef DivideBCDPredef3 - ld a, [hDivideBCDQuotient] - ld [wPlayerMoney], a - ld a, [hDivideBCDQuotient + 1] - ld [wPlayerMoney + 1], a - ld a, [hDivideBCDQuotient + 2] - ld [wPlayerMoney + 2], a - -.lostmoney - ld hl, wd732 - set 2, [hl] - res 3, [hl] - set 6, [hl] - ld a, %11111111 - ld [wJoyIgnore], a - predef_jump HealParty - - -MewPicFront:: INCBIN "pic/bmon/mew.pic" -MewPicBack:: INCBIN "pic/monback/mewb.pic" -INCLUDE "data/baseStats/mew.asm" - INCLUDE "engine/battle/safari_zone.asm" INCLUDE "engine/titlescreen.asm" - -NintenText: db "NINTEN@" -SonyText: db "SONY@" - - -LoadMonData_: -; Load monster [wWhichPokemon] from list [wMonDataLocation]: -; 0: partymon -; 1: enemymon -; 2: boxmon -; 3: daycaremon -; Return monster id at wcf91 and its data at wLoadedMon. -; Also load base stats at wMonHeader for convenience. - - ld a, [wDayCareMonSpecies] - ld [wcf91], a - ld a, [wMonDataLocation] - cp DAYCARE_DATA - jr z, .GetMonHeader - - ld a, [wWhichPokemon] - ld e, a - callab GetMonSpecies - -.GetMonHeader - ld a, [wcf91] - ld [wd0b5], a ; input for GetMonHeader - call GetMonHeader - - ld hl, wPartyMons - ld bc, wPartyMon2 - wPartyMon1 - ld a, [wMonDataLocation] - cp ENEMY_PARTY_DATA - jr c, .getMonEntry - - ld hl, wEnemyMons - jr z, .getMonEntry - - cp 2 - ld hl, wBoxMons - ld bc, wBoxMon2 - wBoxMon1 - jr z, .getMonEntry - - ld hl, wDayCareMon - jr .copyMonData - -.getMonEntry - ld a, [wWhichPokemon] - call AddNTimes - -.copyMonData - ld de, wLoadedMon - ld bc, wPartyMon2 - wPartyMon1 - jp CopyData - +INCLUDE "engine/load_mon_data.asm" INCLUDE "data/item_prices.asm" INCLUDE "text/item_names.asm" - -UnusedNames: - db "かみなりバッヂ@" - db "かいがらバッヂ@" - db "おじぞうバッヂ@" - db "はやぶさバッヂ@" - db "ひんやりバッヂ@" - db "なかよしバッヂ@" - db "バラバッヂ@" - db "ひのたまバッヂ@" - db "ゴールドバッヂ@" - db "たまご@" - db "ひよこ@" - db "ブロンズ@" - db "シルバー@" - db "ゴールド@" - db "プチキャプテン@" - db "キャプテン@" - db "プチマスター@" - db "マスター@" - db "エクセレント" +INCLUDE "text/unused_names.asm" INCLUDE "engine/overworld/oam.asm" -INCLUDE "engine/oam_dma.asm" - -PrintWaitingText: - coord hl, 3, 10 - ld b, $1 - ld c, $b - ld a, [wIsInBattle] - and a - jr z, .asm_4c17 - call TextBoxBorder - jr .asm_4c1a -.asm_4c17 - call CableClub_TextBoxBorder -.asm_4c1a - coord hl, 4, 11 - ld de, WaitingText - call PlaceString - ld c, 50 - jp DelayFrames - -WaitingText: - db "Waiting...!@" - - -_UpdateSprites: - ld h, $c1 - inc h - ld a, $e ; wSpriteStateData2 + $0e -.spriteLoop - ld l, a - sub $e - ld c, a - ld [H_CURRENTSPRITEOFFSET], a - ld a, [hl] - and a - jr z, .skipSprite ; tests $c2Xe - push hl - push de - push bc - call .updateCurrentSprite - pop bc - pop de - pop hl -.skipSprite - ld a, l - add $10 ; move to next sprite - cp $e ; test for overflow (back at $0e) - jr nz, .spriteLoop - ret -.updateCurrentSprite - cp $1 - jp nz, UpdateNonPlayerSprite - jp UpdatePlayerSprite - -UpdateNonPlayerSprite: - dec a - swap a - ld [$ff93], a ; $10 * sprite# - ld a, [wNPCMovementScriptSpriteOffset] ; some sprite offset? - ld b, a - ld a, [H_CURRENTSPRITEOFFSET] - cp b - jr nz, .unequal - jp DoScriptedNPCMovement -.unequal - jp UpdateNPCSprite - -; This detects if the current sprite (whose offset is at H_CURRENTSPRITEOFFSET) -; is going to collide with another sprite by looping over the other sprites. -; The current sprite's offset will be labelled with i (e.g. $c1i0). -; The loop sprite's offset will labelled with j (e.g. $c1j0). -; -; Note that the Y coordinate of the sprite (in [$c1k4]) is one of the following -; 9 values when the sprite is aligned with the grid: $fc, $0c, $1c, $2c, ..., $7c. -; The reason that 4 is added below to the coordinate is to make it align with a -; multiple of $10 to make comparisons easier. -DetectCollisionBetweenSprites: - nop - - ld h, wSpriteStateData1 / $100 - ld a, [H_CURRENTSPRITEOFFSET] - add wSpriteStateData1 % $100 - ld l, a - - ld a, [hl] ; a = [$c1i0] (picture) (0 if slot is unused) - and a ; is this sprite slot slot used? - ret z ; return if not used - - ld a, l - add 3 - ld l, a - - ld a, [hli] ; a = [$c1i3] (delta Y) (-1, 0, or 1) - call SetSpriteCollisionValues - - ld a, [hli] ; a = [$C1i4] (Y screen coordinate) - add 4 ; align with multiple of $10 - -; The effect of the following 3 lines is to -; add 7 to a if moving south or -; subtract 7 from a if moving north. - add b - and $f0 - or c - - ld [$ff90], a ; store Y coordinate adjusted for direction of movement - - ld a, [hli] ; a = [$c1i5] (delta X) (-1, 0, or 1) - call SetSpriteCollisionValues - ld a, [hl] ; a = [$C1i6] (X screen coordinate) - -; The effect of the following 3 lines is to -; add 7 to a if moving east or -; subtract 7 from a if moving west. - add b - and $f0 - or c - - ld [$ff91], a ; store X coordinate adjusted for direction of movement - - ld a, l - add 7 - ld l, a - - xor a - ld [hld], a ; zero [$c1id] XXX what's [$c1id] for? - ld [hld], a ; zero [$c1ic] (directions in which collisions occurred) - - ld a, [$ff91] - ld [hld], a ; [$c1ib] = adjusted X coordinate - ld a, [$ff90] - ld [hl], a ; [$c1ia] = adjusted Y coordinate - - xor a ; zero the loop counter - -.loop - ld [$ff8f], a ; store loop counter - swap a - ld e, a - ld a, [H_CURRENTSPRITEOFFSET] - cp e ; does the loop sprite match the current sprite? - jp z, .next ; go to the next sprite if they match - - ld d, h - ld a, [de] ; a = [$c1j0] (picture) (0 if slot is unused) - and a ; is this sprite slot slot used? - jp z, .next ; go the next sprite if not used - - inc e - inc e - ld a, [de] ; a = [$c1j2] ($ff means the sprite is offscreen) - inc a - jp z, .next ; go the next sprite if offscreen - - ld a, [H_CURRENTSPRITEOFFSET] - add 10 - ld l, a - - inc e - ld a, [de] ; a = [$c1j3] (delta Y) - call SetSpriteCollisionValues - - inc e - ld a, [de] ; a = [$C1j4] (Y screen coordinate) - add 4 ; align with multiple of $10 - -; The effect of the following 3 lines is to -; add 7 to a if moving south or -; subtract 7 from a if moving north. - add b - and $f0 - or c - - sub [hl] ; subtract the adjusted Y coordinate of sprite i ([$c1ia]) from that of sprite j - -; calculate the absolute value of the difference to get the distance - jr nc, .noCarry1 - cpl - inc a -.noCarry1 - ld [$ff90], a ; store the distance between the two sprites' adjusted Y values - -; Use the carry flag set by the above subtraction to determine which sprite's -; Y coordinate is larger. This information is used later to set [$c1ic], -; which stores which direction the collision occurred in. -; The following 5 lines set the lowest 2 bits of c, which are later shifted left by 2. -; If sprite i's Y is larger, set lowest 2 bits of c to 10. -; If sprite j's Y is larger or both are equal, set lowest 2 bits of c to 01. - push af - rl c - pop af - ccf - rl c - -; If sprite i's delta Y is 0, then b = 7, else b = 9. - ld b, 7 - ld a, [hl] ; a = [$c1ia] (adjusted Y coordinate) - and $f - jr z, .next1 - ld b, 9 - -.next1 - ld a, [$ff90] ; a = distance between adjusted Y coordinates - sub b - ld [$ff92], a ; store distance adjusted using sprite i's direction - ld a, b - ld [$ff90], a ; store 7 or 9 depending on sprite i's delta Y - jr c, .checkXDistance - -; If sprite j's delta Y is 0, then b = 7, else b = 9. - ld b, 7 - dec e - ld a, [de] ; a = [$c1j3] (delta Y) - inc e - and a - jr z, .next2 - ld b, 9 - -.next2 - ld a, [$ff92] ; a = distance adjusted using sprite i's direction - sub b ; adjust distance using sprite j's direction - jr z, .checkXDistance - jr nc, .next ; go to next sprite if distance is still positive after both adjustments - -.checkXDistance - inc e - inc l - ld a, [de] ; a = [$c1j5] (delta X) - - push bc - - call SetSpriteCollisionValues - inc e - ld a, [de] ; a = [$c1j6] (X screen coordinate) - -; The effect of the following 3 lines is to -; add 7 to a if moving east or -; subtract 7 from a if moving west. - add b - and $f0 - or c - - pop bc - - sub [hl] ; subtract the adjusted X coordinate of sprite i ([$c1ib]) from that of sprite j - -; calculate the absolute value of the difference to get the distance - jr nc, .noCarry2 - cpl - inc a -.noCarry2 - ld [$ff91], a ; store the distance between the two sprites' adjusted X values - -; Use the carry flag set by the above subtraction to determine which sprite's -; X coordinate is larger. This information is used later to set [$c1ic], -; which stores which direction the collision occurred in. -; The following 5 lines set the lowest 2 bits of c. -; If sprite i's X is larger, set lowest 2 bits of c to 10. -; If sprite j's X is larger or both are equal, set lowest 2 bits of c to 01. - push af - rl c - pop af - ccf - rl c - -; If sprite i's delta X is 0, then b = 7, else b = 9. - ld b, 7 - ld a, [hl] ; a = [$c1ib] (adjusted X coordinate) - and $f - jr z, .next3 - ld b, 9 - -.next3 - ld a, [$ff91] ; a = distance between adjusted X coordinates - sub b - ld [$ff92], a ; store distance adjusted using sprite i's direction - ld a, b - ld [$ff91], a ; store 7 or 9 depending on sprite i's delta X - jr c, .collision - -; If sprite j's delta X is 0, then b = 7, else b = 9. - ld b, 7 - dec e - ld a, [de] ; a = [$c1j5] (delta X) - inc e - and a - jr z, .next4 - ld b, 9 - -.next4 - ld a, [$ff92] ; a = distance adjusted using sprite i's direction - sub b ; adjust distance using sprite j's direction - jr z, .collision - jr nc, .next ; go to next sprite if distance is still positive after both adjustments - -.collision - ld a, [$ff91] ; a = 7 or 9 depending on sprite i's delta X - ld b, a - ld a, [$ff90] ; a = 7 or 9 depending on sprite i's delta Y - inc l - -; If delta X isn't 0 and delta Y is 0, then b = %0011, else b = %1100. -; (note that normally if delta X isn't 0, then delta Y must be 0 and vice versa) - cp b - jr c, .next5 - ld b, %1100 - jr .next6 -.next5 - ld b, %0011 - -.next6 - ld a, c ; c has 2 bits set (one of bits 0-1 is set for the X axis and one of bits 2-3 for the Y axis) - and b ; we select either the bit in bits 0-1 or bits 2-3 based on the calculation immediately above - or [hl] ; or with existing collision direction bits in [$c1ic] - ld [hl], a ; store new value - ld a, c ; useless code because a is overwritten before being used again - -; set bit in [$c1ie] or [$c1if] to indicate which sprite the collision occurred with - inc l - inc l - ld a, [$ff8f] ; a = loop counter - ld de, SpriteCollisionBitTable - add a - add e - ld e, a - jr nc, .noCarry3 - inc d -.noCarry3 - ld a, [de] - or [hl] - ld [hli], a - inc de - ld a, [de] - or [hl] - ld [hl], a - -.next - ld a, [$ff8f] ; a = loop counter - inc a - cp $10 - jp nz, .loop - ret -; takes delta X or delta Y in a -; b = delta X/Y -; c = 0 if delta X/Y is 0 -; c = 7 if delta X/Y is 1 -; c = 9 if delta X/Y is -1 -SetSpriteCollisionValues: - and a - ld b, 0 - ld c, 0 - jr z, .done - ld c, 9 - cp -1 - jr z, .ok - ld c, 7 - ld a, 0 -.ok - ld b, a -.done - ret - -SpriteCollisionBitTable: - db %00000000,%00000001 - db %00000000,%00000010 - db %00000000,%00000100 - db %00000000,%00001000 - db %00000000,%00010000 - db %00000000,%00100000 - db %00000000,%01000000 - db %00000000,%10000000 - db %00000001,%00000000 - db %00000010,%00000000 - db %00000100,%00000000 - db %00001000,%00000000 - db %00010000,%00000000 - db %00100000,%00000000 - db %01000000,%00000000 - db %10000000,%00000000 - -TestBattle: - ret - -.loop - call GBPalNormal - - ; Don't mess around - ; with obedience. - ld a, %10000000 ; EARTHBADGE - ld [wObtainedBadges], a - - ld hl, wFlags_D733 - set BIT_TEST_BATTLE, [hl] - - ; Reset the party. - ld hl, wPartyCount - xor a - ld [hli], a - dec a - ld [hl], a - - ; Give the player a - ; level 20 Rhydon. - ld a, RHYDON - ld [wcf91], a - ld a, 20 - ld [wCurEnemyLVL], a - xor a - ld [wMonDataLocation], a - ld [wCurMap], a - call AddPartyMon - - ; Fight against a - ; level 20 Rhydon. - ld a, RHYDON - ld [wCurOpponent], a - - predef InitOpponent - - ; When the battle ends, - ; do it all again. - ld a, 1 - ld [wUpdateSpritesEnabled], a - ld [H_AUTOBGTRANSFERENABLED], a - jr .loop +INCLUDE "engine/print_waiting_text.asm" +INCLUDE "engine/overworld/map_sprite_functions1.asm" INCLUDE "engine/overworld/item.asm" INCLUDE "engine/overworld/movement.asm" - INCLUDE "engine/cable_club.asm" - -LoadTrainerInfoTextBoxTiles: - ld de, TrainerInfoTextBoxTileGraphics - ld hl, vChars2 + $760 - lb bc, BANK(TrainerInfoTextBoxTileGraphics), (TrainerInfoTextBoxTileGraphicsEnd - TrainerInfoTextBoxTileGraphics) / $10 - jp CopyVideoData - INCLUDE "engine/menu/main_menu.asm" - INCLUDE "engine/oak_speech.asm" - -SpecialWarpIn: - call LoadSpecialWarpData - predef LoadTilesetHeader - ld hl,wd732 - bit 2,[hl] ; dungeon warp or fly warp? - res 2,[hl] - jr z,.next -; if dungeon warp or fly warp - ld a,[wDestinationMap] - jr .next2 -.next - bit 1,[hl] - jr z,.next3 - call EmptyFunc -.next3 - ld a,0 -.next2 - ld b,a - ld a,[wd72d] - and a - jr nz,.next4 - ld a,b -.next4 - ld hl,wd732 - bit 4,[hl] ; dungeon warp? - ret nz -; if not dungeon warp - ld [wLastMap],a - ret - -; gets the map ID, tile block map view pointer, tileset, and coordinates -LoadSpecialWarpData: - ld a, [wd72d] - cp TRADE_CENTER - jr nz, .notTradeCenter - ld hl, TradeCenterSpec1 - ld a, [hSerialConnectionStatus] - cp USING_INTERNAL_CLOCK ; which gameboy is clocking determines who is on the left and who is on the right - jr z, .copyWarpData - ld hl, TradeCenterSpec2 - jr .copyWarpData -.notTradeCenter - cp COLOSSEUM - jr nz, .notColosseum - ld hl, ColosseumSpec1 - ld a, [hSerialConnectionStatus] - cp USING_INTERNAL_CLOCK - jr z, .copyWarpData - ld hl, ColosseumSpec2 - jr .copyWarpData -.notColosseum - ld a, [wd732] - bit 1, a - jr nz, .notFirstMap - bit 2, a - jr nz, .notFirstMap - ld hl, FirstMapSpec -.copyWarpData - ld de, wCurMap - ld c, $7 -.copyWarpDataLoop - ld a, [hli] - ld [de], a - inc de - dec c - jr nz, .copyWarpDataLoop - ld a, [hli] - ld [wCurMapTileset], a - xor a - jr .done -.notFirstMap - ld a, [wLastMap] ; this value is overwritten before it's ever read - ld hl, wd732 - bit 4, [hl] ; used dungeon warp (jumped down hole/waterfall)? - jr nz, .usedDunegonWarp - bit 6, [hl] ; return to last pokemon center (or player's house)? - res 6, [hl] - jr z, .otherDestination -; return to last pokemon center or player's house - ld a, [wLastBlackoutMap] - jr .usedFlyWarp -.usedDunegonWarp - ld hl, wd72d - res 4, [hl] - ld a, [wDungeonWarpDestinationMap] - ld b, a - ld [wCurMap], a - ld a, [wWhichDungeonWarp] - ld c, a - ld hl, DungeonWarpList - ld de, 0 - ld a, 6 - ld [wDungeonWarpDataEntrySize], a -.dungeonWarpListLoop - ld a, [hli] - cp b - jr z, .matchedDungeonWarpDestinationMap - inc hl - jr .nextDungeonWarp -.matchedDungeonWarpDestinationMap - ld a, [hli] - cp c - jr z, .matchedDungeonWarpID -.nextDungeonWarp - ld a, [wDungeonWarpDataEntrySize] - add e - ld e, a - jr .dungeonWarpListLoop -.matchedDungeonWarpID - ld hl, DungeonWarpData - add hl, de - jr .copyWarpData2 -.otherDestination - ld a, [wDestinationMap] -.usedFlyWarp - ld b, a - ld [wCurMap], a - ld hl, FlyWarpDataPtr -.flyWarpDataPtrLoop - ld a, [hli] - inc hl - cp b - jr z, .foundFlyWarpMatch - inc hl - inc hl - jr .flyWarpDataPtrLoop -.foundFlyWarpMatch - ld a, [hli] - ld h, [hl] - ld l, a -.copyWarpData2 - ld de, wCurrentTileBlockMapViewPointer - ld c, $6 -.copyWarpDataLoop2 - ld a, [hli] - ld [de], a - inc de - dec c - jr nz, .copyWarpDataLoop2 - xor a ; OVERWORLD - ld [wCurMapTileset], a -.done - ld [wYOffsetSinceLastSpecialWarp], a - ld [wXOffsetSinceLastSpecialWarp], a - ld a, $ff ; the player's coordinates have already been updated using a special warp, so don't use any of the normal warps - ld [wDestinationWarpID], a - ret +INCLUDE "engine/overworld/special_warps.asm" INCLUDE "data/special_warps.asm" -; This function appears to never be used. -; It is likely a debugging feature to give the player Tsunekazu Ishihara's -; favorite Pokemon. This is indicated by the overpowered Exeggutor, which -; Ishihara (president of Creatures Inc.) said was his favorite Pokemon in an ABC -; interview on February 8, 2000. -; "Exeggutor is my favorite. That's because I was always using this character -; while I was debugging the program." -; http://www.ign.com/articles/2000/02/09/abc-news-pokamon-chat-transcript - -SetIshiharaTeam: - ld de, IshiharaTeam -.loop - ld a, [de] - cp $ff - ret z - ld [wcf91], a - inc de - ld a, [de] - ld [wCurEnemyLVL], a - inc de - call AddPartyMon - jr .loop - -IshiharaTeam: - db EXEGGUTOR,90 - db MEW,20 - db JOLTEON,56 - db DUGTRIO,56 - db ARTICUNO,57 - db $FF - -EmptyFunc: - ret +INCLUDE "engine/debug1.asm" INCLUDE "engine/menu/naming_screen.asm" INCLUDE "engine/oak_speech2.asm" -; subtracts the amount the player paid from their money -; sets carry flag if there is enough money and unsets carry flag if not -SubtractAmountPaidFromMoney_: - ld de,wPlayerMoney - ld hl,hMoney ; total price of items - ld c,3 ; length of money in bytes - call StringCmp - ret c - ld de,wPlayerMoney + 2 - ld hl,hMoney + 2 ; total price of items - ld c,3 ; length of money in bytes - predef SubBCDPredef ; subtract total price from money - ld a,MONEY_BOX - ld [wTextBoxID],a - call DisplayTextBoxID ; redraw money text box - and a - ret +INCLUDE "engine/subtract_paid_money.asm" -HandleItemListSwapping: - ld a,[wListMenuID] - cp a,ITEMLISTMENU - jp nz,DisplayListMenuIDLoop ; only rearrange item list menus - push hl - ld hl,wListPointer - ld a,[hli] - ld h,[hl] - ld l,a - inc hl ; hl = beginning of list entries - ld a,[wCurrentMenuItem] - ld b,a - ld a,[wListScrollOffset] - add b - add a - ld c,a - ld b,0 - add hl,bc ; hl = address of currently selected item entry - ld a,[hl] - pop hl - inc a - jp z,DisplayListMenuIDLoop ; ignore attempts to swap the Cancel menu item - ld a,[wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) - and a ; has the first item to swap already been chosen? - jr nz,.swapItems -; if not, set the currently selected item as the first item - ld a,[wCurrentMenuItem] - inc a - ld b,a - ld a,[wListScrollOffset] ; index of top (visible) menu item within the list - add b - ld [wMenuItemToSwap],a ; ID of item chosen for swapping (counts from 1) - ld c,20 - call DelayFrames - jp DisplayListMenuIDLoop -.swapItems - ld a,[wCurrentMenuItem] - inc a - ld b,a - ld a,[wListScrollOffset] - add b - ld b,a - ld a,[wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) - cp b ; is the currently selected item the same as the first item to swap? - jp z,DisplayListMenuIDLoop ; ignore attempts to swap an item with itself - dec a - ld [wMenuItemToSwap],a ; ID of item chosen for swapping (counts from 1) - ld c,20 - call DelayFrames - push hl - push de - ld hl,wListPointer - ld a,[hli] - ld h,[hl] - ld l,a - inc hl ; hl = beginning of list entries - ld d,h - ld e,l ; de = beginning of list entries - ld a,[wCurrentMenuItem] - ld b,a - ld a,[wListScrollOffset] - add b - add a - ld c,a - ld b,0 - add hl,bc ; hl = address of currently selected item entry - ld a,[wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) - add a - add e - ld e,a - jr nc,.noCarry - inc d -.noCarry ; de = address of first item to swap - ld a,[de] - ld b,a - ld a,[hli] - cp b - jr z,.swapSameItemType -.swapDifferentItems - ld [$ff95],a ; [$ff95] = second item ID - ld a,[hld] - ld [$ff96],a ; [$ff96] = second item quantity - ld a,[de] - ld [hli],a ; put first item ID in second item slot - inc de - ld a,[de] - ld [hl],a ; put first item quantity in second item slot - ld a,[$ff96] - ld [de],a ; put second item quantity in first item slot - dec de - ld a,[$ff95] - ld [de],a ; put second item ID in first item slot - xor a - ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped - pop de - pop hl - jp DisplayListMenuIDLoop -.swapSameItemType - inc de - ld a,[hl] - ld b,a - ld a,[de] - add b ; a = sum of both item quantities - cp a,100 ; is the sum too big for one item slot? - jr c,.combineItemSlots -; swap enough items from the first slot to max out the second slot if they can't be combined - sub a,99 - ld [de],a - ld a,99 - ld [hl],a - jr .done -.combineItemSlots - ld [hl],a ; put the sum in the second item slot - ld hl,wListPointer - ld a,[hli] - ld h,[hl] - ld l,a - dec [hl] ; decrease the number of items - ld a,[hl] - ld [wListCount],a ; update number of items variable - cp a,1 - jr nz,.skipSettingMaxMenuItemID - ld [wMaxMenuItem],a ; if the number of items is only one now, update the max menu item ID -.skipSettingMaxMenuItemID - dec de - ld h,d - ld l,e - inc hl - inc hl ; hl = address of item after first item to swap -.moveItemsUpLoop ; erase the first item slot and move up all the following item slots to fill the gap - ld a,[hli] - ld [de],a - inc de - inc a ; reached the $ff terminator? - jr z,.afterMovingItemsUp - ld a,[hli] - ld [de],a - inc de - jr .moveItemsUpLoop -.afterMovingItemsUp - xor a - ld [wListScrollOffset],a - ld [wCurrentMenuItem],a -.done - xor a - ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped - pop de - pop hl - jp DisplayListMenuIDLoop +INCLUDE "engine/menu/swap_items.asm" INCLUDE "engine/overworld/pokemart.asm" - INCLUDE "engine/learn_move.asm" - INCLUDE "engine/overworld/pokecenter.asm" +INCLUDE "engine/overworld/set_blackout_map.asm" -SetLastBlackoutMap: -; Set the map to return to when -; blacking out or using Teleport or Dig. -; Safari rest houses don't count. - - push hl - ld hl, SafariZoneRestHouses - ld a, [wCurMap] - ld b, a -.loop - ld a, [hli] - cp -1 - jr z, .notresthouse - cp b - jr nz, .loop - jr .done - -.notresthouse - ld a, [wLastMap] - ld [wLastBlackoutMap], a -.done - pop hl - ret - -SafariZoneRestHouses: - db SAFARI_ZONE_REST_HOUSE_2 - db SAFARI_ZONE_REST_HOUSE_3 - db SAFARI_ZONE_REST_HOUSE_4 - db -1 - -; function that performs initialization for DisplayTextID -DisplayTextIDInit: - xor a - ld [wListMenuID],a - ld a,[wAutoTextBoxDrawingControl] - bit 0,a - jr nz,.skipDrawingTextBoxBorder - ld a,[hSpriteIndexOrTextID] ; text ID (or sprite ID) - and a - jr nz,.notStartMenu -; if text ID is 0 (i.e. the start menu) -; Note that the start menu text border is also drawn in the function directly -; below this, so this seems unnecessary. - CheckEvent EVENT_GOT_POKEDEX -; start menu with pokedex - coord hl, 10, 0 - ld b,$0e - ld c,$08 - jr nz,.drawTextBoxBorder -; start menu without pokedex - coord hl, 10, 0 - ld b,$0c - ld c,$08 - jr .drawTextBoxBorder -; if text ID is not 0 (i.e. not the start menu) then do a standard dialogue text box -.notStartMenu - coord hl, 0, 12 - ld b,$04 - ld c,$12 -.drawTextBoxBorder - call TextBoxBorder -.skipDrawingTextBoxBorder - ld hl,wFontLoaded - set 0,[hl] - ld hl,wFlags_0xcd60 - bit 4,[hl] - res 4,[hl] - jr nz,.skipMovingSprites - call UpdateSprites -.skipMovingSprites -; loop to copy C1X9 (direction the sprite is facing) to C2X9 for each sprite -; this is done because when you talk to an NPC, they turn to look your way -; the original direction they were facing must be restored after the dialogue is over - ld hl,wSpriteStateData1 + $19 - ld c,$0f - ld de,$0010 -.spriteFacingDirectionCopyLoop - ld a,[hl] - inc h - ld [hl],a - dec h - add hl,de - dec c - jr nz,.spriteFacingDirectionCopyLoop -; loop to force all the sprites in the middle of animation to stand still -; (so that they don't like they're frozen mid-step during the dialogue) - ld hl,wSpriteStateData1 + 2 - ld de,$0010 - ld c,e -.spriteStandStillLoop - ld a,[hl] - cp a,$ff ; is the sprite visible? - jr z,.nextSprite -; if it is visible - and a,$fc - ld [hl],a -.nextSprite - add hl,de - dec c - jr nz,.spriteStandStillLoop - ld b,$9c ; window background address - call CopyScreenTileBufferToVRAM ; transfer background in WRAM to VRAM - xor a - ld [hWY],a ; put the window on the screen - call LoadFontTilePatterns - ld a,$01 - ld [H_AUTOBGTRANSFERENABLED],a ; enable continuous WRAM to VRAM transfer each V-blank - ret - -; function that displays the start menu -DrawStartMenu: - CheckEvent EVENT_GOT_POKEDEX -; menu with pokedex - coord hl, 10, 0 - ld b,$0e - ld c,$08 - jr nz,.drawTextBoxBorder -; shorter menu if the player doesn't have the pokedex - coord hl, 10, 0 - ld b,$0c - ld c,$08 -.drawTextBoxBorder - call TextBoxBorder - ld a,D_DOWN | D_UP | START | B_BUTTON | A_BUTTON - ld [wMenuWatchedKeys],a - ld a,$02 - ld [wTopMenuItemY],a ; Y position of first menu choice - ld a,$0b - ld [wTopMenuItemX],a ; X position of first menu choice - ld a,[wBattleAndStartSavedMenuItem] ; remembered menu selection from last time - ld [wCurrentMenuItem],a - ld [wLastMenuItem],a - xor a - ld [wMenuWatchMovingOutOfBounds],a - ld hl,wd730 - set 6,[hl] ; no pauses between printing each letter - coord hl, 12, 2 - CheckEvent EVENT_GOT_POKEDEX -; case for not having pokdex - ld a,$06 - jr z,.storeMenuItemCount -; case for having pokedex - ld de,StartMenuPokedexText - call PrintStartMenuItem - ld a,$07 -.storeMenuItemCount - ld [wMaxMenuItem],a ; number of menu items - ld de,StartMenuPokemonText - call PrintStartMenuItem - ld de,StartMenuItemText - call PrintStartMenuItem - ld de,wPlayerName ; player's name - call PrintStartMenuItem - ld a,[wd72e] - bit 6,a ; is the player using the link feature? -; case for not using link feature - ld de,StartMenuSaveText - jr z,.printSaveOrResetText -; case for using link feature - ld de,StartMenuResetText -.printSaveOrResetText - call PrintStartMenuItem - ld de,StartMenuOptionText - call PrintStartMenuItem - ld de,StartMenuExitText - call PlaceString - ld hl,wd730 - res 6,[hl] ; turn pauses between printing letters back on - ret - -StartMenuPokedexText: - db "POKéDEX@" - -StartMenuPokemonText: - db "POKéMON@" - -StartMenuItemText: - db "ITEM@" - -StartMenuSaveText: - db "SAVE@" - -StartMenuResetText: - db "RESET@" - -StartMenuExitText: - db "EXIT@" - -StartMenuOptionText: - db "OPTION@" - -PrintStartMenuItem: - push hl - call PlaceString - pop hl - ld de,SCREEN_WIDTH * 2 - add hl,de - ret - +INCLUDE "engine/menu/text_ids1.asm" INCLUDE "engine/overworld/cable_club_npc.asm" - -; function to draw various text boxes -DisplayTextBoxID_: - ld a,[wTextBoxID] - cp a,TWO_OPTION_MENU - jp z,DisplayTwoOptionMenu - ld c,a - ld hl,TextBoxFunctionTable - ld de,3 - call SearchTextBoxTable - jr c,.functionTableMatch - ld hl,TextBoxCoordTable - ld de,5 - call SearchTextBoxTable - jr c,.coordTableMatch - ld hl,TextBoxTextAndCoordTable - ld de,9 - call SearchTextBoxTable - jr c,.textAndCoordTableMatch -.done - ret -.functionTableMatch - ld a,[hli] - ld h,[hl] - ld l,a ; hl = address of function - ld de,.done - push de - jp [hl] ; jump to the function -.coordTableMatch - call GetTextBoxIDCoords - call GetAddressOfScreenCoords - call TextBoxBorder - ret -.textAndCoordTableMatch - call GetTextBoxIDCoords - push hl - call GetAddressOfScreenCoords - call TextBoxBorder - pop hl - call GetTextBoxIDText - ld a,[wd730] - push af - ld a,[wd730] - set 6,a ; no pauses between printing each letter - ld [wd730],a - call PlaceString - pop af - ld [wd730],a - call UpdateSprites - ret - -; function to search a table terminated with $ff for a byte matching c in increments of de -; sets carry flag if a match is found and clears carry flag if not -SearchTextBoxTable: - dec de -.loop - ld a,[hli] - cp a,$ff - jr z,.notFound - cp c - jr z,.found - add hl,de - jr .loop -.found - scf -.notFound - ret - -; function to load coordinates from the TextBoxCoordTable or the TextBoxTextAndCoordTable -; INPUT: -; hl = address of coordinates -; OUTPUT: -; b = height -; c = width -; d = row of upper left corner -; e = column of upper left corner -GetTextBoxIDCoords: - ld a,[hli] ; column of upper left corner - ld e,a - ld a,[hli] ; row of upper left corner - ld d,a - ld a,[hli] ; column of lower right corner - sub e - dec a - ld c,a ; c = width - ld a,[hli] ; row of lower right corner - sub d - dec a - ld b,a ; b = height - ret - -; function to load a text address and text coordinates from the TextBoxTextAndCoordTable -GetTextBoxIDText: - ld a,[hli] - ld e,a - ld a,[hli] - ld d,a ; de = address of text - push de ; save text address - ld a,[hli] - ld e,a ; column of upper left corner of text - ld a,[hl] - ld d,a ; row of upper left corner of text - call GetAddressOfScreenCoords - pop de ; restore text address - ret - -; function to point hl to the screen coordinates -; INPUT: -; d = row -; e = column -; OUTPUT: -; hl = address of upper left corner of text box -GetAddressOfScreenCoords: - push bc - coord hl, 0, 0 - ld bc,20 -.loop ; loop to add d rows to the base address - ld a,d - and a - jr z,.addedRows - add hl,bc - dec d - jr .loop -.addedRows - pop bc - add hl,de - ret - -; Format: -; 00: text box ID -; 01-02: function address -TextBoxFunctionTable: - dbw MONEY_BOX, DisplayMoneyBox - dbw BUY_SELL_QUIT_MENU, DoBuySellQuitMenu - dbw FIELD_MOVE_MON_MENU, DisplayFieldMoveMonMenu - db $ff ; terminator - -; Format: -; 00: text box ID -; 01: column of upper left corner -; 02: row of upper left corner -; 03: column of lower right corner -; 04: row of lower right corner -TextBoxCoordTable: - db MESSAGE_BOX, 0, 12, 19, 17 - db $03, 0, 0, 19, 14 - db $07, 0, 0, 11, 6 - db LIST_MENU_BOX, 4, 2, 19, 12 - db $10, 7, 0, 19, 17 - db MON_SPRITE_POPUP, 6, 4, 14, 13 - db $ff ; terminator - -; Format: -; 00: text box ID -; 01: column of upper left corner -; 02: row of upper left corner -; 03: column of lower right corner -; 04: row of lower right corner -; 05-06: address of text -; 07: column of beginning of text -; 08: row of beginning of text -; table of window positions and corresponding text [key, start column, start row, end column, end row, text pointer [2 bytes], text column, text row] -TextBoxTextAndCoordTable: - db JP_MOCHIMONO_MENU_TEMPLATE - db 0,0,14,17 ; text box coordinates - dw JapaneseMochimonoText - db 3,0 ; text coordinates - - db USE_TOSS_MENU_TEMPLATE - db 13,10,19,14 ; text box coordinates - dw UseTossText - db 15,11 ; text coordinates - - db JP_SAVE_MESSAGE_MENU_TEMPLATE - db 0,0,7,5 ; text box coordinates - dw JapaneseSaveMessageText - db 2,2 ; text coordinates - - db JP_SPEED_OPTIONS_MENU_TEMPLATE - db 0,6,5,10 ; text box coordinates - dw JapaneseSpeedOptionsText - db 2,7 ; text coordinates - - db BATTLE_MENU_TEMPLATE - db 8,12,19,17 ; text box coordinates - dw BattleMenuText - db 10,14 ; text coordinates - - db SAFARI_BATTLE_MENU_TEMPLATE - db 0,12,19,17 ; text box coordinates - dw SafariZoneBattleMenuText - db 2,14 ; text coordinates - - db SWITCH_STATS_CANCEL_MENU_TEMPLATE - db 11,11,19,17 ; text box coordinates - dw SwitchStatsCancelText - db 13,12 ; text coordinates - - db BUY_SELL_QUIT_MENU_TEMPLATE - db 0,0,10,6 ; text box coordinates - dw BuySellQuitText - db 2,1 ; text coordinates - - db MONEY_BOX_TEMPLATE - db 11,0,19,2 ; text box coordinates - dw MoneyText - db 13,0 ; text coordinates - - db JP_AH_MENU_TEMPLATE - db 7,6,11,10 ; text box coordinates - dw JapaneseAhText - db 8,8 ; text coordinates - - db JP_POKEDEX_MENU_TEMPLATE - db 11,8,19,17 ; text box coordinates - dw JapanesePokedexMenu - db 12,10 ; text coordinates - -; note that there is no terminator - -BuySellQuitText: - db "BUY" - next "SELL" - next "QUIT@@" - -UseTossText: - db "USE" - next "TOSS@" - -JapaneseSaveMessageText: - db "きろく" - next "メッセージ@" - -JapaneseSpeedOptionsText: - db "はやい" - next "おそい@" - -MoneyText: - db "MONEY@" - -JapaneseMochimonoText: - db "もちもの@" - -JapaneseMainMenuText: - db "つづきから" - next "さいしょから@" - -BattleMenuText: - db "FIGHT ",$E1,$E2 - next "ITEM RUN@" - -SafariZoneBattleMenuText: - db "BALL× BAIT" - next "THROW ROCK RUN@" - -SwitchStatsCancelText: - db "SWITCH" - next "STATS" - next "CANCEL@" - -JapaneseAhText: - db "アッ!@" - -JapanesePokedexMenu: - db "データをみる" - next "なきごえ" - next "ぶんぷをみる" - next "キャンセル@" - -DisplayMoneyBox: - ld hl, wd730 - set 6, [hl] - ld a, MONEY_BOX_TEMPLATE - ld [wTextBoxID], a - call DisplayTextBoxID - coord hl, 13, 1 - ld b, 1 - ld c, 6 - call ClearScreenArea - coord hl, 12, 1 - ld de, wPlayerMoney - ld c, $a3 - call PrintBCDNumber - ld hl, wd730 - res 6, [hl] - ret - -CurrencyString: - db " ¥@" - -DoBuySellQuitMenu: - ld a, [wd730] - set 6, a ; no printing delay - ld [wd730], a - xor a - ld [wChosenMenuItem], a - ld a, BUY_SELL_QUIT_MENU_TEMPLATE - ld [wTextBoxID], a - call DisplayTextBoxID - ld a, A_BUTTON | B_BUTTON - ld [wMenuWatchedKeys], a - ld a, $2 - ld [wMaxMenuItem], a - ld a, $1 - ld [wTopMenuItemY], a - ld a, $1 - ld [wTopMenuItemX], a - xor a - ld [wCurrentMenuItem], a - ld [wLastMenuItem], a - ld [wMenuWatchMovingOutOfBounds], a - ld a, [wd730] - res 6, a ; turn on the printing delay - ld [wd730], a - call HandleMenuInput - call PlaceUnfilledArrowMenuCursor - bit 0, a ; was A pressed? - jr nz, .pressedA - bit 1, a ; was B pressed? (always true since only A/B are watched) - jr z, .pressedA - ld a, CANCELLED_MENU - ld [wMenuExitMethod], a - jr .quit -.pressedA - ld a, CHOSE_MENU_ITEM - ld [wMenuExitMethod], a - ld a, [wCurrentMenuItem] - ld [wChosenMenuItem], a - ld b, a - ld a, [wMaxMenuItem] - cp b - jr z, .quit - ret -.quit - ld a, CANCELLED_MENU - ld [wMenuExitMethod], a - ld a, [wCurrentMenuItem] - ld [wChosenMenuItem], a - scf - ret - -; displays a menu with two options to choose from -; b = Y of upper left corner of text region -; c = X of upper left corner of text region -; hl = address where the text box border should be drawn -DisplayTwoOptionMenu: - push hl - ld a, [wd730] - set 6, a ; no printing delay - ld [wd730], a - -; pointless because both values are overwritten before they are read - xor a - ld [wChosenMenuItem], a - ld [wMenuExitMethod], a - - ld a, A_BUTTON | B_BUTTON - ld [wMenuWatchedKeys], a - ld a, $1 - ld [wMaxMenuItem], a - ld a, b - ld [wTopMenuItemY], a - ld a, c - ld [wTopMenuItemX], a - xor a - ld [wLastMenuItem], a - ld [wMenuWatchMovingOutOfBounds], a - push hl - ld hl, wTwoOptionMenuID - bit 7, [hl] ; select second menu item by default? - res 7, [hl] - jr z, .storeCurrentMenuItem - inc a -.storeCurrentMenuItem - ld [wCurrentMenuItem], a - pop hl - push hl - push hl - call TwoOptionMenu_SaveScreenTiles - ld a, [wTwoOptionMenuID] - ld hl, TwoOptionMenuStrings - ld e, a - ld d, $0 - ld a, $5 -.menuStringLoop - add hl, de - dec a - jr nz, .menuStringLoop - ld a, [hli] - ld c, a - ld a, [hli] - ld b, a - ld e, l - ld d, h - pop hl - push de - ld a, [wTwoOptionMenuID] - cp TRADE_CANCEL_MENU - jr nz, .notTradeCancelMenu - call CableClub_TextBoxBorder - jr .afterTextBoxBorder -.notTradeCancelMenu - call TextBoxBorder -.afterTextBoxBorder - call UpdateSprites - pop hl - ld a, [hli] - and a ; put blank line before first menu item? - ld bc, 20 + 2 - jr z, .noBlankLine - ld bc, 2 * 20 + 2 -.noBlankLine - ld a, [hli] - ld e, a - ld a, [hli] - ld d, a - pop hl - add hl, bc - call PlaceString - ld hl, wd730 - res 6, [hl] ; turn on the printing delay - ld a, [wTwoOptionMenuID] - cp NO_YES_MENU - jr nz, .notNoYesMenu -; No/Yes menu -; this menu type ignores the B button -; it only seems to be used when confirming the deletion of a save file - xor a - ld [wTwoOptionMenuID], a - ld a, [wFlags_0xcd60] - push af - push hl - ld hl, wFlags_0xcd60 - bit 5, [hl] - set 5, [hl] ; don't play sound when A or B is pressed in menu - pop hl -.noYesMenuInputLoop - call HandleMenuInput - bit 1, a ; A button pressed? - jr nz, .noYesMenuInputLoop ; try again if A was not pressed - pop af - pop hl - ld [wFlags_0xcd60], a - ld a, SFX_PRESS_AB - call PlaySound - jr .pressedAButton -.notNoYesMenu - xor a - ld [wTwoOptionMenuID], a - call HandleMenuInput - pop hl - bit 1, a ; A button pressed? - jr nz, .choseSecondMenuItem ; automatically choose the second option if B is pressed -.pressedAButton - ld a, [wCurrentMenuItem] - ld [wChosenMenuItem], a - and a - jr nz, .choseSecondMenuItem -; chose first menu item - ld a, CHOSE_FIRST_ITEM - ld [wMenuExitMethod], a - ld c, 15 - call DelayFrames - call TwoOptionMenu_RestoreScreenTiles - and a - ret -.choseSecondMenuItem - ld a, 1 - ld [wCurrentMenuItem], a - ld [wChosenMenuItem], a - ld a, CHOSE_SECOND_ITEM - ld [wMenuExitMethod], a - ld c, 15 - call DelayFrames - call TwoOptionMenu_RestoreScreenTiles - scf - ret - -; Some of the wider/taller two option menus will not have the screen areas -; they cover be fully saved/restored by the two functions below. -; The bottom and right edges of the menu may remain after the function returns. - -TwoOptionMenu_SaveScreenTiles: - ld de, wBuffer - lb bc, 5, 6 -.loop - ld a, [hli] - ld [de], a - inc de - dec c - jr nz, .loop - push bc - ld bc, SCREEN_WIDTH - 6 - add hl, bc - pop bc - ld c, $6 - dec b - jr nz, .loop - ret - -TwoOptionMenu_RestoreScreenTiles: - ld de, wBuffer - lb bc, 5, 6 -.loop - ld a, [de] - inc de - ld [hli], a - dec c - jr nz, .loop - push bc - ld bc, SCREEN_WIDTH - 6 - add hl, bc - pop bc - ld c, 6 - dec b - jr nz, .loop - call UpdateSprites - ret - -; Format: -; 00: byte width -; 01: byte height -; 02: byte put blank line before first menu item -; 03: word text pointer -TwoOptionMenuStrings: - db 4,3,0 - dw .YesNoMenu - db 6,3,0 - dw .NorthWestMenu - db 6,3,0 - dw .SouthEastMenu - db 6,3,0 - dw .YesNoMenu - db 6,3,0 - dw .NorthEastMenu - db 7,3,0 - dw .TradeCancelMenu - db 7,4,1 - dw .HealCancelMenu - db 4,3,0 - dw .NoYesMenu - -.NoYesMenu - db "NO",$4E,"YES@" -.YesNoMenu - db "YES",$4E,"NO@" -.NorthWestMenu - db "NORTH",$4E,"WEST@" -.SouthEastMenu - db "SOUTH",$4E,"EAST@" -.NorthEastMenu - db "NORTH",$4E,"EAST@" -.TradeCancelMenu - db "TRADE",$4E,"CANCEL@" -.HealCancelMenu - db "HEAL",$4E,"CANCEL@" - -DisplayFieldMoveMonMenu: - xor a - ld hl, wFieldMoves - ld [hli], a ; wFieldMoves - ld [hli], a ; wFieldMoves + 1 - ld [hli], a ; wFieldMoves + 2 - ld [hli], a ; wFieldMoves + 3 - ld [hli], a ; wNumFieldMoves - ld [hl], 12 ; wFieldMovesLeftmostXCoord - call GetMonFieldMoves - ld a, [wNumFieldMoves] - and a - jr nz, .fieldMovesExist - -; no field moves - coord hl, 11, 11 - ld b, 5 - ld c, 7 - call TextBoxBorder - call UpdateSprites - ld a, 12 - ld [hFieldMoveMonMenuTopMenuItemX], a - coord hl, 13, 12 - ld de, PokemonMenuEntries - jp PlaceString - -.fieldMovesExist - push af - -; Calculate the text box position and dimensions based on the leftmost X coord -; of the field move names before adjusting for the number of field moves. - coord hl, 0, 11 - ld a, [wFieldMovesLeftmostXCoord] - dec a - ld e, a - ld d, 0 - add hl, de - ld b, 5 - ld a, 18 - sub e - ld c, a - pop af - -; For each field move, move the top of the text box up 2 rows while the leaving -; the bottom of the text box at the bottom of the screen. - ld de, -SCREEN_WIDTH * 2 -.textBoxHeightLoop - add hl, de - inc b - inc b - dec a - jr nz, .textBoxHeightLoop - -; Make space for an extra blank row above the top field move. - ld de, -SCREEN_WIDTH - add hl, de - inc b - - call TextBoxBorder - call UpdateSprites - -; Calculate the position of the first field move name to print. - coord hl, 0, 12 - ld a, [wFieldMovesLeftmostXCoord] - inc a - ld e, a - ld d, 0 - add hl, de - ld de, -SCREEN_WIDTH * 2 - ld a, [wNumFieldMoves] -.calcFirstFieldMoveYLoop - add hl, de - dec a - jr nz, .calcFirstFieldMoveYLoop - - xor a - ld [wNumFieldMoves], a - ld de, wFieldMoves -.printNamesLoop - push hl - ld hl, FieldMoveNames - ld a, [de] - and a - jr z, .donePrintingNames - inc de - ld b, a ; index of name -.skipNamesLoop ; skip past names before the name we want - dec b - jr z, .reachedName -.skipNameLoop ; skip past current name - ld a, [hli] - cp "@" - jr nz, .skipNameLoop - jr .skipNamesLoop -.reachedName - ld b, h - ld c, l - pop hl - push de - ld d, b - ld e, c - call PlaceString - ld bc, SCREEN_WIDTH * 2 - add hl, bc - pop de - jr .printNamesLoop - -.donePrintingNames - pop hl - ld a, [wFieldMovesLeftmostXCoord] - ld [hFieldMoveMonMenuTopMenuItemX], a - coord hl, 0, 12 - ld a, [wFieldMovesLeftmostXCoord] - inc a - ld e, a - ld d, 0 - add hl, de - ld de, PokemonMenuEntries - jp PlaceString - -FieldMoveNames: - db "CUT@" - db "FLY@" - db "@" - db "SURF@" - db "STRENGTH@" - db "FLASH@" - db "DIG@" - db "TELEPORT@" - db "SOFTBOILED@" - -PokemonMenuEntries: - db "STATS" - next "SWITCH" - next "CANCEL@" - -GetMonFieldMoves: - ld a, [wWhichPokemon] - ld hl, wPartyMon1Moves - ld bc, wPartyMon2 - wPartyMon1 - call AddNTimes - ld d, h - ld e, l - ld c, NUM_MOVES + 1 - ld hl, wFieldMoves -.loop - push hl -.nextMove - dec c - jr z, .done - ld a, [de] ; move ID - and a - jr z, .done - ld b, a - inc de - ld hl, FieldMoveDisplayData -.fieldMoveLoop - ld a, [hli] - cp $ff - jr z, .nextMove ; if the move is not a field move - cp b - jr z, .foundFieldMove - inc hl - inc hl - jr .fieldMoveLoop -.foundFieldMove - ld a, b - ld [wLastFieldMoveID], a - ld a, [hli] ; field move name index - ld b, [hl] ; field move leftmost X coordinate - pop hl - ld [hli], a ; store name index in wFieldMoves - ld a, [wNumFieldMoves] - inc a - ld [wNumFieldMoves], a - ld a, [wFieldMovesLeftmostXCoord] - cp b - jr c, .skipUpdatingLeftmostXCoord - ld a, b - ld [wFieldMovesLeftmostXCoord], a -.skipUpdatingLeftmostXCoord - ld a, [wLastFieldMoveID] - ld b, a - jr .loop -.done - pop hl - ret - -; Format: [Move id], [name index], [leftmost tile] -; Move id = id of move -; Name index = index of name in FieldMoveNames -; Leftmost tile = -1 + tile column in which the first letter of the move's name should be displayed -; "SOFTBOILED" is $08 because it has 4 more letters than "SURF", for example, whose value is $0C -FieldMoveDisplayData: - db CUT, $01, $0C - db FLY, $02, $0C - db $B4, $03, $0C ; unused field move - db SURF, $04, $0C - db STRENGTH, $05, $0A - db FLASH, $06, $0C - db DIG, $07, $0C - db TELEPORT, $08, $0A - db SOFTBOILED, $09, $08 - db $ff ; list terminator - +INCLUDE "engine/menu/text_ids2.asm" INCLUDE "engine/battle/moveEffects/drain_hp_effect.asm" - INCLUDE "engine/menu/players_pc.asm" - -_RemovePokemon: - ld hl, wPartyCount - ld a, [wRemoveMonFromBox] - and a - jr z, .asm_7b74 - ld hl, wNumInBox -.asm_7b74 - ld a, [hl] - dec a - ld [hli], a - ld a, [wWhichPokemon] - ld c, a - ld b, $0 - add hl, bc - ld e, l - ld d, h - inc de -.asm_7b81 - ld a, [de] - inc de - ld [hli], a - inc a - jr nz, .asm_7b81 - ld hl, wPartyMonOT - ld d, $5 - ld a, [wRemoveMonFromBox] - and a - jr z, .asm_7b97 - ld hl, wBoxMonOT - ld d, $13 -.asm_7b97 - ld a, [wWhichPokemon] - call SkipFixedLengthTextEntries - ld a, [wWhichPokemon] - cp d - jr nz, .asm_7ba6 - ld [hl], $ff - ret -.asm_7ba6 - ld d, h - ld e, l - ld bc, NAME_LENGTH - add hl, bc - ld bc, wPartyMonNicks - ld a, [wRemoveMonFromBox] - and a - jr z, .asm_7bb8 - ld bc, wBoxMonNicks -.asm_7bb8 - call CopyDataUntil - ld hl, wPartyMons - ld bc, wPartyMon2 - wPartyMon1 - ld a, [wRemoveMonFromBox] - and a - jr z, .asm_7bcd - ld hl, wBoxMons - ld bc, wBoxMon2 - wBoxMon1 -.asm_7bcd - ld a, [wWhichPokemon] - call AddNTimes - ld d, h - ld e, l - ld a, [wRemoveMonFromBox] - and a - jr z, .asm_7be4 - ld bc, wBoxMon2 - wBoxMon1 - add hl, bc - ld bc, wBoxMonOT - jr .asm_7beb -.asm_7be4 - ld bc, wPartyMon2 - wPartyMon1 - add hl, bc - ld bc, wPartyMonOT -.asm_7beb - call CopyDataUntil - ld hl, wPartyMonNicks - ld a, [wRemoveMonFromBox] - and a - jr z, .asm_7bfa - ld hl, wBoxMonNicks -.asm_7bfa - ld bc, NAME_LENGTH - ld a, [wWhichPokemon] - call AddNTimes - ld d, h - ld e, l - ld bc, NAME_LENGTH - add hl, bc - ld bc, wPokedexOwned - ld a, [wRemoveMonFromBox] - and a - jr z, .asm_7c15 - ld bc, wBoxMonNicksEnd -.asm_7c15 - jp CopyDataUntil - -_DisplayPokedex: - ld hl, wd730 - set 6, [hl] - predef ShowPokedexData - ld hl, wd730 - res 6, [hl] - call ReloadMapData - ld c, 10 - call DelayFrames - predef IndexToPokedex - ld a, [wd11e] - dec a - ld c, a - ld b, FLAG_SET - ld hl, wPokedexSeen - predef FlagActionPredef - ld a, $1 - ld [wDoNotWaitForButtonPressAfterDisplayingText], a - ret +INCLUDE "engine/remove_pokemon.asm" +INCLUDE "engine/display_pokedex.asm" -SECTION "bank3",ROMX,BANK[$3] +SECTION "bank03",ROMX,BANK[$03] INCLUDE "engine/joypad.asm" -INCLUDE "data/map_songs.asm" - -INCLUDE "data/map_header_banks.asm" - -ClearVariablesAfterLoadingMapData: - ld a, SCREEN_HEIGHT_PIXELS - ld [hWY], a - ld [rWY], a - xor a - ld [H_AUTOBGTRANSFERENABLED], a - ld [wStepCounter], a - ld [wLoneAttackNo], a - ld [hJoyPressed], a - ld [hJoyReleased], a - ld [hJoyHeld], a - ld [wActionResultOrTookBattleTurn], a - ld [wUnusedD5A3], a - ld hl, wCardKeyDoorY - ld [hli], a - ld [hl], a - ld hl, wWhichTrade - ld bc, wStandingOnWarpPadOrHole - wWhichTrade - call FillMemory - ret - -; only used for setting bit 2 of wd736 upon entering a new map -IsPlayerStandingOnWarp: - ld a, [wNumberOfWarps] - and a - ret z - ld c, a - ld hl, wWarpEntries -.loop - ld a, [wYCoord] - cp [hl] - jr nz, .nextWarp1 - inc hl - ld a, [wXCoord] - cp [hl] - jr nz, .nextWarp2 - inc hl - ld a, [hli] ; target warp - ld [wDestinationWarpID], a - ld a, [hl] ; target map - ld [hWarpDestinationMap], a - ld hl, wd736 - set 2, [hl] ; standing on warp flag - ret -.nextWarp1 - inc hl -.nextWarp2 - inc hl - inc hl - inc hl - dec c - jr nz, .loop - ret - -CheckForceBikeOrSurf: - ld hl, wd732 - bit 5, [hl] - ret nz - ld hl, ForcedBikeOrSurfMaps - ld a, [wYCoord] - ld b, a - ld a, [wXCoord] - ld c, a - ld a, [wCurMap] - ld d, a -.loop - ld a, [hli] - cp $ff - ret z ;if we reach FF then it's not part of the list - cp d ;compare to current map - jr nz, .incorrectMap - ld a, [hli] - cp b ;compare y-coord - jr nz, .incorrectY - ld a, [hli] - cp c ;compare x-coord - jr nz, .loop ; incorrect x-coord, check next item - ld a, [wCurMap] - cp SEAFOAM_ISLANDS_4 - ld a, $2 - ld [wSeafoamIslands4CurScript], a - jr z, .forceSurfing - ld a, [wCurMap] - cp SEAFOAM_ISLANDS_5 - ld a, $2 - ld [wSeafoamIslands5CurScript], a - jr z, .forceSurfing - ;force bike riding - ld hl, wd732 - set 5, [hl] - ld a, $1 - ld [wWalkBikeSurfState], a - ld [wWalkBikeSurfStateCopy], a - jp ForceBikeOrSurf -.incorrectMap - inc hl -.incorrectY - inc hl - jr .loop -.forceSurfing - ld a, $2 - ld [wWalkBikeSurfState], a - ld [wWalkBikeSurfStateCopy], a - jp ForceBikeOrSurf - -INCLUDE "data/force_bike_surf.asm" - -IsPlayerFacingEdgeOfMap: - push hl - push de - push bc - ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction - srl a - ld c, a - ld b, $0 - ld hl, .functionPointerTable - add hl, bc - ld a, [hli] - ld h, [hl] - ld l, a - ld a, [wYCoord] - ld b, a - ld a, [wXCoord] - ld c, a - ld de, .asm_c41e - push de - jp [hl] -.asm_c41e - pop bc - pop de - pop hl - ret - -.functionPointerTable - dw .facingDown - dw .facingUp - dw .facingLeft - dw .facingRight - -.facingDown - ld a, [wCurMapHeight] - add a - dec a - cp b - jr z, .setCarry - jr .resetCarry - -.facingUp - ld a, b - and a - jr z, .setCarry - jr .resetCarry - -.facingLeft - ld a, c - and a - jr z, .setCarry - jr .resetCarry - -.facingRight - ld a, [wCurMapWidth] - add a - dec a - cp c - jr z, .setCarry - jr .resetCarry -.resetCarry - and a - ret -.setCarry - scf - ret - -IsWarpTileInFrontOfPlayer: - push hl - push de - push bc - call _GetTileAndCoordsInFrontOfPlayer - ld a, [wCurMap] - cp SS_ANNE_5 - jr z, .ssAnne5 - ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction - srl a - ld c, a - ld b, 0 - ld hl, .warpTileListPointers - add hl, bc - ld a, [hli] - ld h, [hl] - ld l, a - ld a, [wTileInFrontOfPlayer] - ld de, $1 - call IsInArray -.done - pop bc - pop de - pop hl - ret - -.warpTileListPointers: - dw .facingDownWarpTiles - dw .facingUpWarpTiles - dw .facingLeftWarpTiles - dw .facingRightWarpTiles - -.facingDownWarpTiles - db $01,$12,$17,$3D,$04,$18,$33,$FF - -.facingUpWarpTiles - db $01,$5C,$FF - -.facingLeftWarpTiles - db $1A,$4B,$FF - -.facingRightWarpTiles - db $0F,$4E,$FF - -.ssAnne5 - ld a, [wTileInFrontOfPlayer] - cp $15 - jr nz, .notSSAnne5Warp - scf - jr .done -.notSSAnne5Warp - and a - jr .done - -IsPlayerStandingOnDoorTileOrWarpTile: - push hl - push de - push bc - callba IsPlayerStandingOnDoorTile - jr c, .done - ld a, [wCurMapTileset] - add a - ld c, a - ld b, $0 - ld hl, WarpTileIDPointers - add hl, bc - ld a, [hli] - ld h, [hl] - ld l, a - ld de, $1 - aCoord 8, 9 - call IsInArray - jr nc, .done - ld hl, wd736 - res 2, [hl] -.done - pop bc - pop de - pop hl - ret - -INCLUDE "data/warp_tile_ids.asm" - -PrintSafariZoneSteps: - ld a, [wCurMap] - cp SAFARI_ZONE_EAST - ret c - cp UNKNOWN_DUNGEON_2 - ret nc - coord hl, 0, 0 - ld b, 3 - ld c, 7 - call TextBoxBorder - coord hl, 1, 1 - ld de, wSafariSteps - lb bc, 2, 3 - call PrintNumber - coord hl, 4, 1 - ld de, SafariSteps - call PlaceString - coord hl, 1, 3 - ld de, SafariBallText - call PlaceString - ld a, [wNumSafariBalls] - cp 10 - jr nc, .asm_c56d - coord hl, 5, 3 - ld a, " " - ld [hl], a -.asm_c56d - coord hl, 6, 3 - ld de, wNumSafariBalls - lb bc, 1, 2 - jp PrintNumber - -SafariSteps: - db "/500@" - -SafariBallText: - db "BALL×× @" - -GetTileAndCoordsInFrontOfPlayer: - call GetPredefRegisters - -_GetTileAndCoordsInFrontOfPlayer: - ld a, [wYCoord] - ld d, a - ld a, [wXCoord] - ld e, a - ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction - and a ; cp SPRITE_FACING_DOWN - jr nz, .notFacingDown -; facing down - aCoord 8, 11 - inc d - jr .storeTile -.notFacingDown - cp SPRITE_FACING_UP - jr nz, .notFacingUp -; facing up - aCoord 8, 7 - dec d - jr .storeTile -.notFacingUp - cp SPRITE_FACING_LEFT - jr nz, .notFacingLeft -; facing left - aCoord 6, 9 - dec e - jr .storeTile -.notFacingLeft - cp SPRITE_FACING_RIGHT - jr nz, .storeTile -; facing right - aCoord 10, 9 - inc e -.storeTile - ld c, a - ld [wTileInFrontOfPlayer], a - ret - -GetTileTwoStepsInFrontOfPlayer: - xor a - ld [$ffdb], a - ld hl, wYCoord - ld a, [hli] - ld d, a - ld e, [hl] - ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction - and a ; cp SPRITE_FACING_DOWN - jr nz, .notFacingDown -; facing down - ld hl, $ffdb - set 0, [hl] - aCoord 8, 13 - inc d - jr .storeTile -.notFacingDown - cp SPRITE_FACING_UP - jr nz, .notFacingUp -; facing up - ld hl, $ffdb - set 1, [hl] - aCoord 8, 5 - dec d - jr .storeTile -.notFacingUp - cp SPRITE_FACING_LEFT - jr nz, .notFacingLeft -; facing left - ld hl, $ffdb - set 2, [hl] - aCoord 4, 9 - dec e - jr .storeTile -.notFacingLeft - cp SPRITE_FACING_RIGHT - jr nz, .storeTile -; facing right - ld hl, $ffdb - set 3, [hl] - aCoord 12, 9 - inc e -.storeTile - ld c, a - ld [wTileInFrontOfBoulderAndBoulderCollisionResult], a - ld [wTileInFrontOfPlayer], a - ret - -CheckForCollisionWhenPushingBoulder: - call GetTileTwoStepsInFrontOfPlayer - ld hl, wTileSetCollisionPtr - ld a, [hli] - ld h, [hl] - ld l, a -.loop - ld a, [hli] - cp $ff - jr z, .done ; if the tile two steps ahead is not passable - cp c - jr nz, .loop - ld hl, TilePairCollisionsLand - call CheckForTilePairCollisions2 - ld a, $ff - jr c, .done ; if there is an elevation difference between the current tile and the one two steps ahead - ld a, [wTileInFrontOfBoulderAndBoulderCollisionResult] - cp $15 ; stairs tile - ld a, $ff - jr z, .done ; if the tile two steps ahead is stairs - call CheckForBoulderCollisionWithSprites -.done - ld [wTileInFrontOfBoulderAndBoulderCollisionResult], a - ret - -; sets a to $ff if there is a collision and $00 if there is no collision -CheckForBoulderCollisionWithSprites: - ld a, [wBoulderSpriteIndex] - dec a - swap a - ld d, 0 - ld e, a - ld hl, wSpriteStateData2 + $14 - add hl, de - ld a, [hli] ; map Y position - ld [$ffdc], a - ld a, [hl] ; map X position - ld [$ffdd], a - ld a, [wNumSprites] - ld c, a - ld de, $f - ld hl, wSpriteStateData2 + $14 - ld a, [$ffdb] - and $3 ; facing up or down? - jr z, .pushingHorizontallyLoop -.pushingVerticallyLoop - inc hl - ld a, [$ffdd] - cp [hl] - jr nz, .nextSprite1 ; if X coordinates don't match - dec hl - ld a, [hli] - ld b, a - ld a, [$ffdb] - rrca - jr c, .pushingDown -; pushing up - ld a, [$ffdc] - dec a - jr .compareYCoords -.pushingDown - ld a, [$ffdc] - inc a -.compareYCoords - cp b - jr z, .failure -.nextSprite1 - dec c - jr z, .success - add hl, de - jr .pushingVerticallyLoop -.pushingHorizontallyLoop - ld a, [hli] - ld b, a - ld a, [$ffdc] - cp b - jr nz, .nextSprite2 - ld b, [hl] - ld a, [$ffdb] - bit 2, a - jr nz, .pushingLeft -; pushing right - ld a, [$ffdd] - inc a - jr .compareXCoords -.pushingLeft - ld a, [$ffdd] - dec a -.compareXCoords - cp b - jr z, .failure -.nextSprite2 - dec c - jr z, .success - add hl, de - jr .pushingHorizontallyLoop -.failure - ld a, $ff - ret -.success - xor a - ret - -ApplyOutOfBattlePoisonDamage: - ld a, [wd730] - add a - jp c, .noBlackOut ; no black out if joypad states are being simulated - ld a, [wPartyCount] - and a - jp z, .noBlackOut - call IncrementDayCareMonExp - ld a, [wStepCounter] - and $3 ; is the counter a multiple of 4? - jp nz, .noBlackOut ; only apply poison damage every fourth step - ld [wWhichPokemon], a - ld hl, wPartyMon1Status - ld de, wPartySpecies -.applyDamageLoop - ld a, [hl] - and (1 << PSN) - jr z, .nextMon2 ; not poisoned - dec hl - dec hl - ld a, [hld] - ld b, a - ld a, [hli] - or b - jr z, .nextMon ; already fainted -; subtract 1 from HP - ld a, [hl] - dec a - ld [hld], a - inc a - jr nz, .noBorrow -; borrow 1 from upper byte of HP - dec [hl] - inc hl - jr .nextMon -.noBorrow - ld a, [hli] - or [hl] - jr nz, .nextMon ; didn't faint from damage -; the mon fainted from the damage - push hl - inc hl - inc hl - ld [hl], a - ld a, [de] - ld [wd11e], a - push de - ld a, [wWhichPokemon] - ld hl, wPartyMonNicks - call GetPartyMonName - xor a - ld [wJoyIgnore], a - call EnableAutoTextBoxDrawing - ld a, $d0 - ld [hSpriteIndexOrTextID], a - call DisplayTextID - pop de - pop hl -.nextMon - inc hl - inc hl -.nextMon2 - inc de - ld a, [de] - inc a - jr z, .applyDamageLoopDone - ld bc, wPartyMon2 - wPartyMon1 - add hl, bc - push hl - ld hl, wWhichPokemon - inc [hl] - pop hl - jr .applyDamageLoop -.applyDamageLoopDone - ld hl, wPartyMon1Status - ld a, [wPartyCount] - ld d, a - ld e, 0 -.countPoisonedLoop - ld a, [hl] - and (1 << PSN) - or e - ld e, a - ld bc, wPartyMon2 - wPartyMon1 - add hl, bc - dec d - jr nz, .countPoisonedLoop - ld a, e - and a ; are any party members poisoned? - jr z, .skipPoisonEffectAndSound - ld b, $2 - predef ChangeBGPalColor0_4Frames ; change BG white to dark grey for 4 frames - ld a, SFX_POISONED - call PlaySound -.skipPoisonEffectAndSound - predef AnyPartyAlive - ld a, d - and a - jr nz, .noBlackOut - call EnableAutoTextBoxDrawing - ld a, $d1 - ld [hSpriteIndexOrTextID], a - call DisplayTextID - ld hl, wd72e - set 5, [hl] - ld a, $ff - jr .done -.noBlackOut - xor a -.done - ld [wOutOfBattleBlackout], a - ret - -LoadTilesetHeader: - call GetPredefRegisters - push hl - ld d, 0 - ld a, [wCurMapTileset] - add a - add a - ld b, a - add a - add b ; a = tileset * 12 - jr nc, .noCarry - inc d -.noCarry - ld e, a - ld hl, Tilesets - add hl, de - ld de, wTileSetBank - ld c, $b -.copyTilesetHeaderLoop - ld a, [hli] - ld [de], a - inc de - dec c - jr nz, .copyTilesetHeaderLoop - ld a, [hl] - ld [hTilesetType], a - xor a - ld [$ffd8], a - pop hl - ld a, [wCurMapTileset] - push hl - push de - ld hl, DungeonTilesets - ld de, $1 - call IsInArray - pop de - pop hl - jr c, .asm_c797 - ld a, [wCurMapTileset] - ld b, a - ld a, [hPreviousTileset] - cp b - jr z, .done -.asm_c797 - ld a, [wDestinationWarpID] - cp $ff - jr z, .done - call LoadDestinationWarpPosition - ld a, [wYCoord] - and $1 - ld [wYBlockCoord], a - ld a, [wXCoord] - and $1 - ld [wXBlockCoord], a -.done - ret - -INCLUDE "data/dungeon_tilesets.asm" - -INCLUDE "data/tileset_headers.asm" - -IncrementDayCareMonExp: - ld a, [wDayCareInUse] - and a - ret z - ld hl, wDayCareMonExp + 2 - inc [hl] - ret nz - dec hl - inc [hl] - ret nz - dec hl - inc [hl] - ld a, [hl] - cp $50 - ret c - ld a, $50 - ld [hl], a - ret +INCLUDE "engine/overworld/clear_loadmapdata_vars.asm" +INCLUDE "engine/overworld/check_player_state.asm" +INCLUDE "engine/overworld/print_safari_steps.asm" +INCLUDE "engine/overworld/get_coords_tile_in_front_of_player.asm" +INCLUDE "engine/overworld/boulders.asm" +INCLUDE "engine/overworld/step_functions.asm" +INCLUDE "engine/overworld/load_tileset_header.asm" +INCLUDE "engine/overworld/daycare_exp.asm" INCLUDE "data/hide_show_data.asm" -PrintStrengthTxt: - ld hl, wd728 - set 0, [hl] - ld hl, UsedStrengthText - call PrintText - ld hl, CanMoveBouldersText - jp PrintText - -UsedStrengthText: - TX_FAR _UsedStrengthText - TX_ASM - ld a, [wcf91] - call PlayCry - call Delay3 - jp TextScriptEnd - -CanMoveBouldersText: - TX_FAR _CanMoveBouldersText - db "@" - -IsSurfingAllowed: -; Returns whether surfing is allowed in bit 1 of wd728. -; Surfing isn't allowed on the Cycling Road or in the lowest level of the -; Seafoam Islands before the current has been slowed with boulders. - ld hl, wd728 - set 1, [hl] - ld a, [wd732] - bit 5, a - jr nz, .forcedToRideBike - ld a, [wCurMap] - cp SEAFOAM_ISLANDS_5 - ret nz - CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE - ret z - ld hl, CoordsData_cdf7 - call ArePlayerCoordsInArray - ret nc - ld hl, wd728 - res 1, [hl] - ld hl, CurrentTooFastText - jp PrintText -.forcedToRideBike - ld hl, wd728 - res 1, [hl] - ld hl, CyclingIsFunText - jp PrintText - -CoordsData_cdf7: - db $0B,$07,$FF - -CurrentTooFastText: - TX_FAR _CurrentTooFastText - db "@" - -CyclingIsFunText: - TX_FAR _CyclingIsFunText - db "@" - -; function to add an item (in varying quantities) to the player's bag or PC box -; INPUT: -; hl = address of inventory (either wNumBagItems or wNumBoxItems) -; [wcf91] = item ID -; [wItemQuantity] = item quantity -; sets carry flag if successful, unsets carry flag if unsuccessful -AddItemToInventory_: - ld a,[wItemQuantity] ; a = item quantity - push af - push bc - push de - push hl - push hl - ld d,PC_ITEM_CAPACITY ; how many items the PC can hold - ld a,wNumBagItems & $FF - cp l - jr nz,.checkIfInventoryFull - ld a,wNumBagItems >> 8 - cp h - jr nz,.checkIfInventoryFull -; if the destination is the bag - ld d,BAG_ITEM_CAPACITY ; how many items the bag can hold -.checkIfInventoryFull - ld a,[hl] - sub d - ld d,a - ld a,[hli] - and a - jr z,.addNewItem -.loop - ld a,[hli] - ld b,a ; b = ID of current item in table - ld a,[wcf91] ; a = ID of item being added - cp b ; does the current item in the table match the item being added? - jp z,.increaseItemQuantity ; if so, increase the item's quantity - inc hl - ld a,[hl] - cp a,$ff ; is it the end of the table? - jr nz,.loop -.addNewItem ; add an item not yet in the inventory - pop hl - ld a,d - and a ; is there room for a new item slot? - jr z,.done -; if there is room - inc [hl] ; increment the number of items in the inventory - ld a,[hl] ; the number of items will be the index of the new item - add a - dec a - ld c,a - ld b,0 - add hl,bc ; hl = address to store the item - ld a,[wcf91] - ld [hli],a ; store item ID - ld a,[wItemQuantity] - ld [hli],a ; store item quantity - ld [hl],$ff ; store terminator - jp .success -.increaseItemQuantity ; increase the quantity of an item already in the inventory - ld a,[wItemQuantity] - ld b,a ; b = quantity to add - ld a,[hl] ; a = existing item quantity - add b ; a = new item quantity - cp a,100 - jp c,.storeNewQuantity ; if the new quantity is less than 100, store it -; if the new quantity is greater than or equal to 100, -; try to max out the current slot and add the rest in a new slot - sub a,99 - ld [wItemQuantity],a ; a = amount left over (to put in the new slot) - ld a,d - and a ; is there room for a new item slot? - jr z,.increaseItemQuantityFailed -; if so, store 99 in the current slot and store the rest in a new slot - ld a,99 - ld [hli],a - jp .loop -.increaseItemQuantityFailed - pop hl - and a - jr .done -.storeNewQuantity - ld [hl],a - pop hl -.success - scf -.done - pop hl - pop de - pop bc - pop bc - ld a,b - ld [wItemQuantity],a ; restore the initial value from when the function was called - ret - -; function to remove an item (in varying quantities) from the player's bag or PC box -; INPUT: -; hl = address of inventory (either wNumBagItems or wNumBoxItems) -; [wWhichPokemon] = index (within the inventory) of the item to remove -; [wItemQuantity] = quantity to remove -RemoveItemFromInventory_: - push hl - inc hl - ld a,[wWhichPokemon] ; index (within the inventory) of the item being removed - sla a - add l - ld l,a - jr nc,.noCarry - inc h -.noCarry - inc hl - ld a,[wItemQuantity] ; quantity being removed - ld e,a - ld a,[hl] ; a = current quantity - sub e - ld [hld],a ; store new quantity - ld [wMaxItemQuantity],a - and a - jr nz,.skipMovingUpSlots -; if the remaining quantity is 0, -; remove the emptied item slot and move up all the following item slots -.moveSlotsUp - ld e,l - ld d,h - inc de - inc de ; de = address of the slot following the emptied one -.loop ; loop to move up the following slots - ld a,[de] - inc de - ld [hli],a - cp a,$ff - jr nz,.loop -; update menu info - xor a - ld [wListScrollOffset],a - ld [wCurrentMenuItem],a - ld [wBagSavedMenuItem],a - ld [wSavedListScrollOffset],a - pop hl - ld a,[hl] ; a = number of items in inventory - dec a ; decrement the number of items - ld [hl],a ; store new number of items - ld [wListCount],a - cp a,2 - jr c,.done - ld [wMaxMenuItem],a - jr .done -.skipMovingUpSlots - pop hl -.done - ret - -; wild pokemon data: from 4EB8 to 55C7 - -LoadWildData: - ld hl,WildDataPointers - ld a,[wCurMap] - - ; get wild data for current map - ld c,a - ld b,0 - add hl,bc - add hl,bc - ld a,[hli] - ld h,[hl] - ld l,a ; hl now points to wild data for current map - ld a,[hli] - ld [wGrassRate],a - and a - jr z,.NoGrassData ; if no grass data, skip to surfing data - push hl - ld de,wGrassMons ; otherwise, load grass data - ld bc,$0014 - call CopyData - pop hl - ld bc,$0014 - add hl,bc -.NoGrassData - ld a,[hli] - ld [wWaterRate],a - and a - ret z ; if no water data, we're done - ld de,wWaterMons ; otherwise, load surfing data - ld bc,$0014 - jp CopyData - -INCLUDE "data/wild_mons.asm" +INCLUDE "engine/overworld/load_wild_data.asm" INCLUDE "engine/items/items.asm" -DrawBadges: -; Draw 4x2 gym leader faces, with the faces replaced by -; badges if they are owned. Used in the player status screen. - -; In Japanese versions, names are displayed above faces. -; Instead of removing relevant code, the name graphics were erased. - -; Tile ids for face/badge graphics. - ld de, wBadgeOrFaceTiles - ld hl, .FaceBadgeTiles - ld bc, 8 - call CopyData - -; Booleans for each badge. - ld hl, wTempObtainedBadgesBooleans - ld bc, 8 - xor a - call FillMemory - -; Alter these based on owned badges. - ld de, wTempObtainedBadgesBooleans - ld hl, wBadgeOrFaceTiles - ld a, [wObtainedBadges] - ld b, a - ld c, 8 -.CheckBadge - srl b - jr nc, .NextBadge - ld a, [hl] - add 4 ; Badge graphics are after each face - ld [hl], a - ld a, 1 - ld [de], a -.NextBadge - inc hl - inc de - dec c - jr nz, .CheckBadge - -; Draw two rows of badges. - ld hl, wBadgeNumberTile - ld a, $d8 ; [1] - ld [hli], a - ld [hl], $60 ; First name - - coord hl, 2, 11 - ld de, wTempObtainedBadgesBooleans - call .DrawBadgeRow - - coord hl, 2, 14 - ld de, wTempObtainedBadgesBooleans + 4 -; call .DrawBadgeRow -; ret - -.DrawBadgeRow -; Draw 4 badges. - - ld c, 4 -.DrawBadge - push de - push hl - -; Badge no. - ld a, [wBadgeNumberTile] - ld [hli], a - inc a - ld [wBadgeNumberTile], a - -; Names aren't printed if the badge is owned. - ld a, [de] - and a - ld a, [wBadgeNameTile] - jr nz, .SkipName - call .PlaceTiles - jr .PlaceBadge - -.SkipName - inc a - inc a - inc hl - -.PlaceBadge - ld [wBadgeNameTile], a - ld de, SCREEN_WIDTH - 1 - add hl, de - ld a, [wBadgeOrFaceTiles] - call .PlaceTiles - add hl, de - call .PlaceTiles - -; Shift badge array back one byte. - push bc - ld hl, wBadgeOrFaceTiles + 1 - ld de, wBadgeOrFaceTiles - ld bc, 8 - call CopyData - pop bc - - pop hl - ld de, 4 - add hl, de - - pop de - inc de - dec c - jr nz, .DrawBadge - ret - -.PlaceTiles - ld [hli], a - inc a - ld [hl], a - inc a - ret - -.FaceBadgeTiles - db $20, $28, $30, $38, $40, $48, $50, $58 - -GymLeaderFaceAndBadgeTileGraphics: - INCBIN "gfx/badges.2bpp" - -; replaces a tile block with the one specified in [wNewTileBlockID] -; and redraws the map view if necessary -; b = Y -; c = X -ReplaceTileBlock: - call GetPredefRegisters - ld hl, wOverworldMap - ld a, [wCurMapWidth] - add $6 - ld e, a - ld d, $0 - add hl, de - add hl, de - add hl, de - ld e, $3 - add hl, de - ld e, a - ld a, b - and a - jr z, .addX -; add width * Y -.addWidthYTimesLoop - add hl, de - dec b - jr nz, .addWidthYTimesLoop -.addX - add hl, bc ; add X - ld a, [wNewTileBlockID] - ld [hl], a - ld a, [wCurrentTileBlockMapViewPointer] - ld c, a - ld a, [wCurrentTileBlockMapViewPointer + 1] - ld b, a - call CompareHLWithBC - ret c ; return if the replaced tile block is below the map view in memory - push hl - ld l, e - ld h, $0 - ld e, $6 - ld d, h - add hl, hl - add hl, hl - add hl, de - add hl, bc - pop bc - call CompareHLWithBC - ret c ; return if the replaced tile block is above the map view in memory - -RedrawMapView: - ld a, [wIsInBattle] - inc a - ret z - ld a, [H_AUTOBGTRANSFERENABLED] - push af - ld a, [hTilesetType] - push af - xor a - ld [H_AUTOBGTRANSFERENABLED], a - ld [hTilesetType], a ; no flower/water BG tile animations - call LoadCurrentMapView - call RunDefaultPaletteCommand - ld hl, wMapViewVRAMPointer - ld a, [hli] - ld h, [hl] - ld l, a - ld de, -2 * 32 - add hl, de - ld a, h - and $3 - or $98 - ld a, l - ld [wBuffer], a - ld a, h - ld [wBuffer + 1], a ; this copy of the address is not used - ld a, 2 - ld [$ffbe], a - ld c, 9 ; number of rows of 2x2 tiles (this covers the whole screen) -.redrawRowLoop - push bc - push hl - push hl - ld hl, wTileMap - 2 * SCREEN_WIDTH - ld de, SCREEN_WIDTH - ld a, [$ffbe] -.calcWRAMAddrLoop - add hl, de - dec a - jr nz, .calcWRAMAddrLoop - call CopyToRedrawRowOrColumnSrcTiles - pop hl - ld de, $20 - ld a, [$ffbe] - ld c, a -.calcVRAMAddrLoop - add hl, de - ld a, h - and $3 - or $98 - dec c - jr nz, .calcVRAMAddrLoop - ld [hRedrawRowOrColumnDest + 1], a - ld a, l - ld [hRedrawRowOrColumnDest], a - ld a, REDRAW_ROW - ld [hRedrawRowOrColumnMode], a - call DelayFrame - ld hl, $ffbe - inc [hl] - inc [hl] - pop hl - pop bc - dec c - jr nz, .redrawRowLoop - pop af - ld [hTilesetType], a - pop af - ld [H_AUTOBGTRANSFERENABLED], a - ret - -CompareHLWithBC: - ld a, h - sub b - ret nz - ld a, l - sub c - ret +INCLUDE "engine/draw_badges.asm" +INCLUDE "engine/overworld/replace_tile_block.asm" INCLUDE "engine/overworld/cut.asm" +INCLUDE "engine/overworld/missable_objects.asm" +INCLUDE "engine/overworld/try_pushing_boulder.asm" -MarkTownVisitedAndLoadMissableObjects: - ld a, [wCurMap] - cp ROUTE_1 - jr nc, .notInTown - ld c, a - ld b, FLAG_SET - ld hl, wTownVisitedFlag ; mark town as visited (for flying) - predef FlagActionPredef -.notInTown - ld hl, MapHSPointers - ld a, [wCurMap] - ld b, $0 - ld c, a - add hl, bc - add hl, bc - ld a, [hli] ; load missable objects pointer in hl - ld h, [hl] - ; fall through - -LoadMissableObjects: - ld l, a - push hl - ld de, MapHS00 ; calculate difference between out pointer and the base pointer - ld a, l - sub e - jr nc, .asm_f13c - dec h -.asm_f13c - ld l, a - ld a, h - sub d - ld h, a - ld a, h - ld [H_DIVIDEND], a - ld a, l - ld [H_DIVIDEND+1], a - xor a - ld [H_DIVIDEND+2], a - ld [H_DIVIDEND+3], a - ld a, $3 - ld [H_DIVISOR], a - ld b, $2 - call Divide ; divide difference by 3, resulting in the global offset (number of missable items before ours) - ld a, [wCurMap] - ld b, a - ld a, [H_DIVIDEND+3] - ld c, a ; store global offset in c - ld de, wMissableObjectList - pop hl -.writeMissableObjectsListLoop - ld a, [hli] - cp $ff - jr z, .done ; end of list - cp b - jr nz, .done ; not for current map anymore - ld a, [hli] - inc hl - ld [de], a ; write (map-local) sprite ID - inc de - ld a, c - inc c - ld [de], a ; write (global) missable object index - inc de - jr .writeMissableObjectsListLoop -.done - ld a, $ff - ld [de], a ; write sentinel - ret - -InitializeMissableObjectsFlags: - ld hl, wMissableObjectFlags - ld bc, wMissableObjectFlagsEnd - wMissableObjectFlags - xor a - call FillMemory ; clear missable objects flags - ld hl, MapHS00 - xor a - ld [wMissableObjectCounter], a -.missableObjectsLoop - ld a, [hli] - cp $ff ; end of list - ret z - push hl - inc hl - ld a, [hl] - cp Hide - jr nz, .skip - ld hl, wMissableObjectFlags - ld a, [wMissableObjectCounter] - ld c, a - ld b, FLAG_SET - call MissableObjectFlagAction ; set flag if Item is hidden -.skip - ld hl, wMissableObjectCounter - inc [hl] - pop hl - inc hl - inc hl - jr .missableObjectsLoop - -; tests if current sprite is a missable object that is hidden/has been removed -IsObjectHidden: - ld a, [H_CURRENTSPRITEOFFSET] - swap a - ld b, a - ld hl, wMissableObjectList -.loop - ld a, [hli] - cp $ff - jr z, .notHidden ; not missable -> not hidden - cp b - ld a, [hli] - jr nz, .loop - ld c, a - ld b, FLAG_TEST - ld hl, wMissableObjectFlags - call MissableObjectFlagAction - ld a, c - and a - jr nz, .hidden -.notHidden - xor a -.hidden - ld [$ffe5], a - ret +INCLUDE "engine/add_party_mon.asm" +INCLUDE "engine/move_mon.asm" +INCLUDE "engine/flag_action_predef.asm" +INCLUDE "engine/heal_party.asm" +INCLUDE "engine/bcd.asm" -; adds missable object (items, leg. pokemon, etc.) to the map -; [wMissableObjectIndex]: index of the missable object to be added (global index) -ShowObject: -ShowObject2: - ld hl, wMissableObjectFlags - ld a, [wMissableObjectIndex] - ld c, a - ld b, FLAG_RESET - call MissableObjectFlagAction ; reset "removed" flag - jp UpdateSprites - -; removes missable object (items, leg. pokemon, etc.) from the map -; [wMissableObjectIndex]: index of the missable object to be removed (global index) -HideObject: - ld hl, wMissableObjectFlags - ld a, [wMissableObjectIndex] - ld c, a - ld b, FLAG_SET - call MissableObjectFlagAction ; set "removed" flag - jp UpdateSprites - -MissableObjectFlagAction: -; identical to FlagAction - - push hl - push de - push bc - - ; bit - ld a, c - ld d, a - and 7 - ld e, a - - ; byte - ld a, d - srl a - srl a - srl a - add l - ld l, a - jr nc, .ok - inc h -.ok - - ; d = 1 << e (bitmask) - inc e - ld d, 1 -.shift - dec e - jr z, .shifted - sla d - jr .shift -.shifted - - ld a, b - and a - jr z, .reset - cp 2 - jr z, .read - -.set - ld a, [hl] - ld b, a - ld a, d - or b - ld [hl], a - jr .done - -.reset - ld a, [hl] - ld b, a - ld a, d - xor $ff - and b - ld [hl], a - jr .done - -.read - ld a, [hl] - ld b, a - ld a, d - and b - -.done - pop bc - pop de - pop hl - ld c, a - ret +INCLUDE "engine/init_player_data.asm" -TryPushingBoulder: - ld a, [wd728] - bit 0, a ; using Strength? - ret z - ld a, [wFlags_0xcd60] - bit 1, a ; has boulder dust animation from previous push played yet? - ret nz - xor a - ld [hSpriteIndexOrTextID], a - call IsSpriteInFrontOfPlayer - ld a, [hSpriteIndexOrTextID] - ld [wBoulderSpriteIndex], a - and a - jp z, ResetBoulderPushFlags - ld hl, wSpriteStateData1 + 1 - ld d, $0 - ld a, [hSpriteIndexOrTextID] - swap a - ld e, a - add hl, de - res 7, [hl] - call GetSpriteMovementByte2Pointer - ld a, [hl] - cp BOULDER_MOVEMENT_BYTE_2 - jp nz, ResetBoulderPushFlags - ld hl, wFlags_0xcd60 - bit 6, [hl] - set 6, [hl] ; indicate that the player has tried pushing - ret z ; the player must try pushing twice before the boulder will move - ld a, [hJoyHeld] - and D_RIGHT | D_LEFT | D_UP | D_DOWN - ret z - predef CheckForCollisionWhenPushingBoulder - ld a, [wTileInFrontOfBoulderAndBoulderCollisionResult] - and a ; was there a collision? - jp nz, ResetBoulderPushFlags - ld a, [hJoyHeld] - ld b, a - ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction - cp SPRITE_FACING_UP - jr z, .pushBoulderUp - cp SPRITE_FACING_LEFT - jr z, .pushBoulderLeft - cp SPRITE_FACING_RIGHT - jr z, .pushBoulderRight -.pushBoulderDown - bit 7, b - ret z - ld de, PushBoulderDownMovementData - jr .done -.pushBoulderUp - bit 6, b - ret z - ld de, PushBoulderUpMovementData - jr .done -.pushBoulderLeft - bit 5, b - ret z - ld de, PushBoulderLeftMovementData - jr .done -.pushBoulderRight - bit 4, b - ret z - ld de, PushBoulderRightMovementData -.done - call MoveSprite - ld a, SFX_PUSH_BOULDER - call PlaySound - ld hl, wFlags_0xcd60 - set 1, [hl] - ret +INCLUDE "engine/get_bag_item_quantity.asm" -PushBoulderUpMovementData: - db NPC_MOVEMENT_UP,$FF - -PushBoulderDownMovementData: - db NPC_MOVEMENT_DOWN,$FF - -PushBoulderLeftMovementData: - db NPC_MOVEMENT_LEFT,$FF - -PushBoulderRightMovementData: - db NPC_MOVEMENT_RIGHT,$FF - -DoBoulderDustAnimation: - ld a, [wd730] - bit 0, a - ret nz - callab AnimateBoulderDust - call DiscardButtonPresses - ld [wJoyIgnore], a - call ResetBoulderPushFlags - set 7, [hl] - ld a, [wBoulderSpriteIndex] - ld [H_SPRITEINDEX], a - call GetSpriteMovementByte2Pointer - ld [hl], $10 - ld a, SFX_CUT - jp PlaySound - -ResetBoulderPushFlags: - ld hl, wFlags_0xcd60 - res 1, [hl] - res 6, [hl] - ret - -_AddPartyMon: -; Adds a new mon to the player's or enemy's party. -; [wMonDataLocation] is used in an unusual way in this function. -; If the lower nybble is 0, the mon is added to the player's party, else the enemy's. -; If the entire value is 0, then the player is allowed to name the mon. - ld de, wPartyCount - ld a, [wMonDataLocation] - and $f - jr z, .next - ld de, wEnemyPartyCount -.next - ld a, [de] - inc a - cp PARTY_LENGTH + 1 - ret nc ; return if the party is already full - ld [de], a - ld a, [de] - ld [hNewPartyLength], a - add e - ld e, a - jr nc, .noCarry - inc d -.noCarry - ld a, [wcf91] - ld [de], a ; write species of new mon in party list - inc de - ld a, $ff ; terminator - ld [de], a - ld hl, wPartyMonOT - ld a, [wMonDataLocation] - and $f - jr z, .next2 - ld hl, wEnemyMonOT -.next2 - ld a, [hNewPartyLength] - dec a - call SkipFixedLengthTextEntries - ld d, h - ld e, l - ld hl, wPlayerName - ld bc, NAME_LENGTH - call CopyData - ld a, [wMonDataLocation] - and a - jr nz, .skipNaming - ld hl, wPartyMonNicks - ld a, [hNewPartyLength] - dec a - call SkipFixedLengthTextEntries - ld a, NAME_MON_SCREEN - ld [wNamingScreenType], a - predef AskName -.skipNaming - ld hl, wPartyMons - ld a, [wMonDataLocation] - and $f - jr z, .next3 - ld hl, wEnemyMons -.next3 - ld a, [hNewPartyLength] - dec a - ld bc, wPartyMon2 - wPartyMon1 - call AddNTimes - ld e, l - ld d, h - push hl - ld a, [wcf91] - ld [wd0b5], a - call GetMonHeader - ld hl, wMonHeader - ld a, [hli] - ld [de], a ; species - inc de - pop hl - push hl - ld a, [wMonDataLocation] - and $f - ld a, $98 ; set enemy trainer mon IVs to fixed average values - ld b, $88 - jr nz, .next4 - -; If the mon is being added to the player's party, update the pokedex. - ld a, [wcf91] - ld [wd11e], a - push de - predef IndexToPokedex - pop de - ld a, [wd11e] - dec a - ld c, a - ld b, FLAG_TEST - ld hl, wPokedexOwned - call FlagAction - ld a, c ; whether the mon was already flagged as owned - ld [wUnusedD153], a ; not read - ld a, [wd11e] - dec a - ld c, a - ld b, FLAG_SET - push bc - call FlagAction - pop bc - ld hl, wPokedexSeen - call FlagAction - - pop hl - push hl - - ld a, [wIsInBattle] - and a ; is this a wild mon caught in battle? - jr nz, .copyEnemyMonData - -; Not wild. - call Random ; generate random IVs - ld b, a - call Random - -.next4 - push bc - ld bc, wPartyMon1DVs - wPartyMon1 - add hl, bc - pop bc - ld [hli], a - ld [hl], b ; write IVs - ld bc, (wPartyMon1HPExp - 1) - (wPartyMon1DVs + 1) - add hl, bc - ld a, 1 - ld c, a - xor a - ld b, a - call CalcStat ; calc HP stat (set cur Hp to max HP) - ld a, [H_MULTIPLICAND+1] - ld [de], a - inc de - ld a, [H_MULTIPLICAND+2] - ld [de], a - inc de - xor a - ld [de], a ; box level - inc de - ld [de], a ; status ailments - inc de - jr .copyMonTypesAndMoves -.copyEnemyMonData - ld bc, wEnemyMon1DVs - wEnemyMon1 - add hl, bc - ld a, [wEnemyMonDVs] ; copy IVs from cur enemy mon - ld [hli], a - ld a, [wEnemyMonDVs + 1] - ld [hl], a - ld a, [wEnemyMonHP] ; copy HP from cur enemy mon - ld [de], a - inc de - ld a, [wEnemyMonHP+1] - ld [de], a - inc de - xor a - ld [de], a ; box level - inc de - ld a, [wEnemyMonStatus] ; copy status ailments from cur enemy mon - ld [de], a - inc de -.copyMonTypesAndMoves - ld hl, wMonHTypes - ld a, [hli] ; type 1 - ld [de], a - inc de - ld a, [hli] ; type 2 - ld [de], a - inc de - ld a, [hli] ; catch rate (held item in gen 2) - ld [de], a - ld hl, wMonHMoves - ld a, [hli] - inc de - push de - ld [de], a - ld a, [hli] - inc de - ld [de], a - ld a, [hli] - inc de - ld [de], a - ld a, [hli] - inc de - ld [de], a - push de - dec de - dec de - dec de - xor a - ld [wLearningMovesFromDayCare], a - predef WriteMonMoves - pop de - ld a, [wPlayerID] ; set trainer ID to player ID - inc de - ld [de], a - ld a, [wPlayerID + 1] - inc de - ld [de], a - push de - ld a, [wCurEnemyLVL] - ld d, a - callab CalcExperience - pop de - inc de - ld a, [hExperience] ; write experience - ld [de], a - inc de - ld a, [hExperience + 1] - ld [de], a - inc de - ld a, [hExperience + 2] - ld [de], a - xor a - ld b, NUM_STATS * 2 -.writeEVsLoop ; set all EVs to 0 - inc de - ld [de], a - dec b - jr nz, .writeEVsLoop - inc de - inc de - pop hl - call AddPartyMon_WriteMovePP - inc de - ld a, [wCurEnemyLVL] - ld [de], a - inc de - ld a, [wIsInBattle] - dec a - jr nz, .calcFreshStats - ld hl, wEnemyMonMaxHP - ld bc, $a - call CopyData ; copy stats of cur enemy mon - pop hl - jr .done -.calcFreshStats - pop hl - ld bc, wPartyMon1HPExp - 1 - wPartyMon1 - add hl, bc - ld b, $0 - call CalcStats ; calculate fresh set of stats -.done - scf - ret - -LoadMovePPs: - call GetPredefRegisters - ; fallthrough -AddPartyMon_WriteMovePP: - ld b, NUM_MOVES -.pploop - ld a, [hli] ; read move ID - and a - jr z, .empty - dec a - push hl - push de - push bc - ld hl, Moves - ld bc, MoveEnd - Moves - call AddNTimes - ld de, wcd6d - ld a, BANK(Moves) - call FarCopyData - pop bc - pop de - pop hl - ld a, [wcd6d + 5] ; PP is byte 5 of move data -.empty - inc de - ld [de], a - dec b - jr nz, .pploop ; there are still moves to read - ret +INCLUDE "engine/overworld/npc_pathfinding.asm" -; adds enemy mon [wcf91] (at position [wWhichPokemon] in enemy list) to own party -; used in the cable club trade center -_AddEnemyMonToPlayerParty: - ld hl, wPartyCount - ld a, [hl] - cp PARTY_LENGTH - scf - ret z ; party full, return failure - inc a - ld [hl], a ; add 1 to party members - ld c, a - ld b, $0 - add hl, bc - ld a, [wcf91] - ld [hli], a ; add mon as last list entry - ld [hl], $ff ; write new sentinel - ld hl, wPartyMons - ld a, [wPartyCount] - dec a - ld bc, wPartyMon2 - wPartyMon1 - call AddNTimes - ld e, l - ld d, h - ld hl, wLoadedMon - call CopyData ; write new mon's data (from wLoadedMon) - ld hl, wPartyMonOT - ld a, [wPartyCount] - dec a - call SkipFixedLengthTextEntries - ld d, h - ld e, l - ld hl, wEnemyMonOT - ld a, [wWhichPokemon] - call SkipFixedLengthTextEntries - ld bc, NAME_LENGTH - call CopyData ; write new mon's OT name (from an enemy mon) - ld hl, wPartyMonNicks - ld a, [wPartyCount] - dec a - call SkipFixedLengthTextEntries - ld d, h - ld e, l - ld hl, wEnemyMonNicks - ld a, [wWhichPokemon] - call SkipFixedLengthTextEntries - ld bc, NAME_LENGTH - call CopyData ; write new mon's nickname (from an enemy mon) - ld a, [wcf91] - ld [wd11e], a - predef IndexToPokedex - ld a, [wd11e] - dec a - ld c, a - ld b, FLAG_SET - ld hl, wPokedexOwned - push bc - call FlagAction ; add to owned pokemon - pop bc - ld hl, wPokedexSeen - call FlagAction ; add to seen pokemon - and a - ret ; return success - -_MoveMon: - ld a, [wMoveMonType] - and a - jr z, .checkPartyMonSlots - cp DAYCARE_TO_PARTY - jr z, .checkPartyMonSlots - cp PARTY_TO_DAYCARE - ld hl, wDayCareMon - jr z, .asm_f575 - ld hl, wNumInBox - ld a, [hl] - cp MONS_PER_BOX - jr nz, .partyOrBoxNotFull - jr .boxFull -.checkPartyMonSlots - ld hl, wPartyCount - ld a, [hl] - cp PARTY_LENGTH - jr nz, .partyOrBoxNotFull -.boxFull - scf - ret -.partyOrBoxNotFull - inc a - ld [hl], a ; increment number of mons in party/box - ld c, a - ld b, 0 - add hl, bc - ld a, [wMoveMonType] - cp DAYCARE_TO_PARTY - ld a, [wDayCareMon] - jr z, .asm_f556 - ld a, [wcf91] -.asm_f556 - ld [hli], a ; write new mon ID - ld [hl], $ff ; write new sentinel - ld a, [wMoveMonType] - dec a - ld hl, wPartyMons - ld bc, wPartyMon2 - wPartyMon1 ; $2c - ld a, [wPartyCount] - jr nz, .skipToNewMonEntry - ld hl, wBoxMons - ld bc, wBoxMon2 - wBoxMon1 ; $21 - ld a, [wNumInBox] -.skipToNewMonEntry - dec a - call AddNTimes -.asm_f575 - push hl - ld e, l - ld d, h - ld a, [wMoveMonType] - and a - ld hl, wBoxMons - ld bc, wBoxMon2 - wBoxMon1 ; $21 - jr z, .asm_f591 - cp DAYCARE_TO_PARTY - ld hl, wDayCareMon - jr z, .asm_f597 - ld hl, wPartyMons - ld bc, wPartyMon2 - wPartyMon1 ; $2c -.asm_f591 - ld a, [wWhichPokemon] - call AddNTimes -.asm_f597 - push hl - push de - ld bc, wBoxMon2 - wBoxMon1 - call CopyData - pop de - pop hl - ld a, [wMoveMonType] - and a - jr z, .asm_f5b4 - cp DAYCARE_TO_PARTY - jr z, .asm_f5b4 - ld bc, wBoxMon2 - wBoxMon1 - add hl, bc - ld a, [hl] - inc de - inc de - inc de - ld [de], a -.asm_f5b4 - ld a, [wMoveMonType] - cp PARTY_TO_DAYCARE - ld de, wDayCareMonOT - jr z, .asm_f5d3 - dec a - ld hl, wPartyMonOT - ld a, [wPartyCount] - jr nz, .asm_f5cd - ld hl, wBoxMonOT - ld a, [wNumInBox] -.asm_f5cd - dec a - call SkipFixedLengthTextEntries - ld d, h - ld e, l -.asm_f5d3 - ld hl, wBoxMonOT - ld a, [wMoveMonType] - and a - jr z, .asm_f5e6 - ld hl, wDayCareMonOT - cp DAYCARE_TO_PARTY - jr z, .asm_f5ec - ld hl, wPartyMonOT -.asm_f5e6 - ld a, [wWhichPokemon] - call SkipFixedLengthTextEntries -.asm_f5ec - ld bc, NAME_LENGTH - call CopyData - ld a, [wMoveMonType] - cp PARTY_TO_DAYCARE - ld de, wDayCareMonName - jr z, .asm_f611 - dec a - ld hl, wPartyMonNicks - ld a, [wPartyCount] - jr nz, .asm_f60b - ld hl, wBoxMonNicks - ld a, [wNumInBox] -.asm_f60b - dec a - call SkipFixedLengthTextEntries - ld d, h - ld e, l -.asm_f611 - ld hl, wBoxMonNicks - ld a, [wMoveMonType] - and a - jr z, .asm_f624 - ld hl, wDayCareMonName - cp DAYCARE_TO_PARTY - jr z, .asm_f62a - ld hl, wPartyMonNicks -.asm_f624 - ld a, [wWhichPokemon] - call SkipFixedLengthTextEntries -.asm_f62a - ld bc, NAME_LENGTH - call CopyData - pop hl - ld a, [wMoveMonType] - cp PARTY_TO_BOX - jr z, .asm_f664 - cp PARTY_TO_DAYCARE - jr z, .asm_f664 - push hl - srl a - add $2 - ld [wMonDataLocation], a - call LoadMonData - callba CalcLevelFromExperience - ld a, d - ld [wCurEnemyLVL], a - pop hl - ld bc, wBoxMon2 - wBoxMon1 - add hl, bc - ld [hli], a - ld d, h - ld e, l - ld bc, -18 - add hl, bc - ld b, $1 - call CalcStats -.asm_f664 - and a - ret - - -FlagActionPredef: - call GetPredefRegisters - -FlagAction: -; Perform action b on bit c -; in the bitfield at hl. -; 0: reset -; 1: set -; 2: read -; Return the result in c. - - push hl - push de - push bc - - ; bit - ld a, c - ld d, a - and 7 - ld e, a - - ; byte - ld a, d - srl a - srl a - srl a - add l - ld l, a - jr nc, .ok - inc h -.ok - - ; d = 1 << e (bitmask) - inc e - ld d, 1 -.shift - dec e - jr z, .shifted - sla d - jr .shift -.shifted - - ld a, b - and a - jr z, .reset - cp 2 - jr z, .read - -.set - ld b, [hl] - ld a, d - or b - ld [hl], a - jr .done - -.reset - ld b, [hl] - ld a, d - xor $ff - and b - ld [hl], a - jr .done - -.read - ld b, [hl] - ld a, d - and b -.done - pop bc - pop de - pop hl - ld c, a - ret - - -HealParty: -; Restore HP and PP. - - ld hl, wPartySpecies - ld de, wPartyMon1HP -.healmon - ld a, [hli] - cp $ff - jr z, .done - - push hl - push de - - ld hl, wPartyMon1Status - wPartyMon1HP - add hl, de - xor a - ld [hl], a - - push de - ld b, NUM_MOVES ; A Pokémon has 4 moves -.pp - ld hl, wPartyMon1Moves - wPartyMon1HP - add hl, de - - ld a, [hl] - and a - jr z, .nextmove - - dec a - ld hl, wPartyMon1PP - wPartyMon1HP - add hl, de - - push hl - push de - push bc - - ld hl, Moves - ld bc, MoveEnd - Moves - call AddNTimes - ld de, wcd6d - ld a, BANK(Moves) - call FarCopyData - ld a, [wcd6d + 5] ; PP is byte 5 of move data - - pop bc - pop de - pop hl - - inc de - push bc - ld b, a - ld a, [hl] - and $c0 - add b - ld [hl], a - pop bc - -.nextmove - dec b - jr nz, .pp - pop de - - ld hl, wPartyMon1MaxHP - wPartyMon1HP - add hl, de - ld a, [hli] - ld [de], a - inc de - ld a, [hl] - ld [de], a - - pop de - pop hl - - push hl - ld bc, wPartyMon2 - wPartyMon1 - ld h, d - ld l, e - add hl, bc - ld d, h - ld e, l - pop hl - jr .healmon - -.done - xor a - ld [wWhichPokemon], a - ld [wd11e], a - - ld a, [wPartyCount] - ld b, a -.ppup - push bc - call RestoreBonusPP - pop bc - ld hl, wWhichPokemon - inc [hl] - dec b - jr nz, .ppup - ret - - -DivideBCDPredef:: -DivideBCDPredef2:: -DivideBCDPredef3:: -DivideBCDPredef4:: - call GetPredefRegisters - -DivideBCD:: - xor a - ld [$ffa5], a - ld [$ffa6], a - ld [$ffa7], a - ld d, $1 -.asm_f72a - ld a, [$ffa2] - and $f0 - jr nz, .asm_f75b - inc d - ld a, [$ffa2] - swap a - and $f0 - ld b, a - ld a, [$ffa3] - swap a - ld [$ffa3], a - and $f - or b - ld [$ffa2], a - ld a, [$ffa3] - and $f0 - ld b, a - ld a, [$ffa4] - swap a - ld [$ffa4], a - and $f - or b - ld [$ffa3], a - ld a, [$ffa4] - and $f0 - ld [$ffa4], a - jr .asm_f72a -.asm_f75b - push de - push de - call DivideBCD_f800 - pop de - ld a, b - swap a - and $f0 - ld [$ffa5], a - dec d - jr z, .asm_f7bc - push de - call DivideBCD_f7d7 - call DivideBCD_f800 - pop de - ld a, [$ffa5] - or b - ld [$ffa5], a - dec d - jr z, .asm_f7bc - push de - call DivideBCD_f7d7 - call DivideBCD_f800 - pop de - ld a, b - swap a - and $f0 - ld [$ffa6], a - dec d - jr z, .asm_f7bc - push de - call DivideBCD_f7d7 - call DivideBCD_f800 - pop de - ld a, [$ffa6] - or b - ld [$ffa6], a - dec d - jr z, .asm_f7bc - push de - call DivideBCD_f7d7 - call DivideBCD_f800 - pop de - ld a, b - swap a - and $f0 - ld [$ffa7], a - dec d - jr z, .asm_f7bc - push de - call DivideBCD_f7d7 - call DivideBCD_f800 - pop de - ld a, [$ffa7] - or b - ld [$ffa7], a -.asm_f7bc - ld a, [$ffa5] - ld [$ffa2], a - ld a, [$ffa6] - ld [$ffa3], a - ld a, [$ffa7] - ld [$ffa4], a - pop de - ld a, $6 - sub d - and a - ret z -.asm_f7ce - push af - call DivideBCD_f7d7 - pop af - dec a - jr nz, .asm_f7ce - ret - -DivideBCD_f7d7: - ld a, [$ffa4] - swap a - and $f - ld b, a - ld a, [$ffa3] - swap a - ld [$ffa3], a - and $f0 - or b - ld [$ffa4], a - ld a, [$ffa3] - and $f - ld b, a - ld a, [$ffa2] - swap a - ld [$ffa2], a - and $f0 - or b - ld [$ffa3], a - ld a, [$ffa2] - and $f - ld [$ffa2], a - ret - -DivideBCD_f800: - ld bc, $3 -.asm_f803 - ld de, $ff9f - ld hl, $ffa2 - push bc - call StringCmp - pop bc - ret c - inc b - ld de, $ffa1 - ld hl, $ffa4 - push bc - call SubBCD - pop bc - jr .asm_f803 - - -AddBCDPredef:: - call GetPredefRegisters - -AddBCD:: - and a - ld b, c -.add - ld a, [de] - adc [hl] - daa - ld [de], a - dec de - dec hl - dec c - jr nz, .add - jr nc, .done - ld a, $99 - inc de -.fill - ld [de], a - inc de - dec b - jr nz, .fill -.done - ret - - -SubBCDPredef:: - call GetPredefRegisters - -SubBCD:: - and a - ld b, c -.sub - ld a, [de] - sbc [hl] - daa - ld [de], a - dec de - dec hl - dec c - jr nz, .sub - jr nc, .done - ld a, $00 - inc de -.fill - ld [de], a - inc de - dec b - jr nz, .fill - scf -.done - ret - - -InitPlayerData: -InitPlayerData2: - - call Random - ld a, [hRandomSub] - ld [wPlayerID], a - - call Random - ld a, [hRandomAdd] - ld [wPlayerID + 1], a - - ld a, $ff - ld [wUnusedD71B], a - - ld hl, wPartyCount - call InitializeEmptyList - ld hl, wNumInBox - call InitializeEmptyList - ld hl, wNumBagItems - call InitializeEmptyList - ld hl, wNumBoxItems - call InitializeEmptyList - -START_MONEY EQU $3000 - ld hl, wPlayerMoney + 1 - ld a, START_MONEY / $100 - ld [hld], a - xor a - ld [hli], a - inc hl - ld [hl], a - - ld [wMonDataLocation], a - - ld hl, wObtainedBadges - ld [hli], a - - ld [hl], a - - ld hl, wPlayerCoins - ld [hli], a - ld [hl], a - - ld hl, wGameProgressFlags - ld bc, wGameProgressFlagsEnd - wGameProgressFlags - call FillMemory ; clear all game progress flags - - jp InitializeMissableObjectsFlags - -InitializeEmptyList: - xor a ; count - ld [hli], a - dec a ; terminator - ld [hl], a - ret - - -GetQuantityOfItemInBag: -; In: b = item ID -; Out: b = how many of that item are in the bag - call GetPredefRegisters - ld hl, wNumBagItems -.loop - inc hl - ld a, [hli] - cp $ff - jr z, .notInBag - cp b - jr nz, .loop - ld a, [hl] - ld b, a - ret -.notInBag - ld b, 0 - ret - -FindPathToPlayer: - xor a - ld hl, hFindPathNumSteps - ld [hli], a ; hFindPathNumSteps - ld [hli], a ; hFindPathFlags - ld [hli], a ; hFindPathYProgress - ld [hl], a ; hFindPathXProgress - ld hl, wNPCMovementDirections2 - ld de, $0 -.loop - ld a, [hFindPathYProgress] - ld b, a - ld a, [hNPCPlayerYDistance] ; Y distance in steps - call CalcDifference - ld d, a - and a - jr nz, .asm_f8da - ld a, [hFindPathFlags] - set 0, a ; current end of path matches the player's Y coordinate - ld [hFindPathFlags], a -.asm_f8da - ld a, [hFindPathXProgress] - ld b, a - ld a, [hNPCPlayerXDistance] ; X distance in steps - call CalcDifference - ld e, a - and a - jr nz, .asm_f8ec - ld a, [hFindPathFlags] - set 1, a ; current end of path matches the player's X coordinate - ld [hFindPathFlags], a -.asm_f8ec - ld a, [hFindPathFlags] - cp $3 ; has the end of the path reached the player's position? - jr z, .done -; Compare whether the X distance between the player and the current of the path -; is greater or if the Y distance is. Then, try to reduce whichever is greater. - ld a, e - cp d - jr c, .yDistanceGreater -; x distance is greater - ld a, [hNPCPlayerRelativePosFlags] - bit 1, a - jr nz, .playerIsLeftOfNPC - ld d, NPC_MOVEMENT_RIGHT - jr .next1 -.playerIsLeftOfNPC - ld d, NPC_MOVEMENT_LEFT -.next1 - ld a, [hFindPathXProgress] - add 1 - ld [hFindPathXProgress], a - jr .storeDirection -.yDistanceGreater - ld a, [hNPCPlayerRelativePosFlags] - bit 0, a - jr nz, .playerIsAboveNPC - ld d, NPC_MOVEMENT_DOWN - jr .next2 -.playerIsAboveNPC - ld d, NPC_MOVEMENT_UP -.next2 - ld a, [hFindPathYProgress] - add 1 - ld [hFindPathYProgress], a -.storeDirection - ld a, d - ld [hli], a - ld a, [hFindPathNumSteps] - inc a - ld [hFindPathNumSteps], a - jp .loop -.done - ld [hl], $ff - ret - -CalcPositionOfPlayerRelativeToNPC: - xor a - ld [hNPCPlayerRelativePosFlags], a - ld a, [wSpriteStateData1 + 4] ; player's sprite screen Y position in pixels - ld d, a - ld a, [wSpriteStateData1 + 6] ; player's sprite screen X position in pixels - ld e, a - ld hl, wSpriteStateData1 - ld a, [hNPCSpriteOffset] - add l - add $4 - ld l, a - jr nc, .noCarry - inc h -.noCarry - ld a, d - ld b, a - ld a, [hli] ; NPC sprite screen Y position in pixels - call CalcDifference - jr nc, .NPCSouthOfOrAlignedWithPlayer -.NPCNorthOfPlayer - push hl - ld hl, hNPCPlayerRelativePosFlags - bit 0, [hl] - set 0, [hl] - pop hl - jr .divideYDistance -.NPCSouthOfOrAlignedWithPlayer - push hl - ld hl, hNPCPlayerRelativePosFlags - bit 0, [hl] - res 0, [hl] - pop hl -.divideYDistance - push hl - ld hl, hDividend2 - ld [hli], a - ld a, 16 - ld [hli], a - call DivideBytes ; divide Y absolute distance by 16 - ld a, [hl] ; quotient - ld [hNPCPlayerYDistance], a - pop hl - inc hl - ld b, e - ld a, [hl] ; NPC sprite screen X position in pixels - call CalcDifference - jr nc, .NPCEastOfOrAlignedWithPlayer -.NPCWestOfPlayer - push hl - ld hl, hNPCPlayerRelativePosFlags - bit 1, [hl] - set 1, [hl] - pop hl - jr .divideXDistance -.NPCEastOfOrAlignedWithPlayer - push hl - ld hl, hNPCPlayerRelativePosFlags - bit 1, [hl] - res 1, [hl] - pop hl -.divideXDistance - ld [hDividend2], a - ld a, 16 - ld [hDivisor2], a - call DivideBytes ; divide X absolute distance by 16 - ld a, [hQuotient2] - ld [hNPCPlayerXDistance], a - ld a, [hNPCPlayerRelativePosPerspective] - and a - ret z - ld a, [hNPCPlayerRelativePosFlags] - cpl - and $3 - ld [hNPCPlayerRelativePosFlags], a - ret +INCLUDE "engine/hp_bar.asm" +INCLUDE "engine/hidden_object_functions3.asm" -ConvertNPCMovementDirectionsToJoypadMasks: - ld a, [hNPCMovementDirections2Index] - ld [wNPCMovementDirections2Index], a - dec a - ld de, wSimulatedJoypadStatesEnd - ld hl, wNPCMovementDirections2 - add l - ld l, a - jr nc, .loop - inc h -.loop - ld a, [hld] - call ConvertNPCMovementDirectionToJoypadMask - ld [de], a - inc de - ld a, [hNPCMovementDirections2Index] - dec a - ld [hNPCMovementDirections2Index], a - jr nz, .loop - ret -ConvertNPCMovementDirectionToJoypadMask: - push hl - ld b, a - ld hl, NPCMovementDirectionsToJoypadMasksTable -.loop - ld a, [hli] - cp $ff - jr z, .done - cp b - jr z, .loadJoypadMask - inc hl - jr .loop -.loadJoypadMask - ld a, [hl] -.done - pop hl - ret +SECTION "Graphics", ROMX, BANK[GFX] -NPCMovementDirectionsToJoypadMasksTable: - db NPC_MOVEMENT_UP, D_UP - db NPC_MOVEMENT_DOWN, D_DOWN - db NPC_MOVEMENT_LEFT, D_LEFT - db NPC_MOVEMENT_RIGHT, D_RIGHT - db $ff +PokemonLogoJapanGraphics: INCBIN "gfx/pokemon_logo_japan.2bpp" +FontGraphics: INCBIN "gfx/font.1bpp" +FontGraphicsEnd: +ABTiles: INCBIN "gfx/AB.2bpp" +HpBarAndStatusGraphics: INCBIN "gfx/hp_bar_and_status.2bpp" +HpBarAndStatusGraphicsEnd: +BattleHudTiles1: INCBIN "gfx/battle_hud1.1bpp" +BattleHudTiles1End: +BattleHudTiles2: INCBIN "gfx/battle_hud2.1bpp" +BattleHudTiles3: INCBIN "gfx/battle_hud3.1bpp" +BattleHudTiles3End: +NintendoCopyrightLogoGraphics: INCBIN "gfx/copyright.2bpp" +GamefreakLogoGraphics: INCBIN "gfx/gamefreak.2bpp" +GamefreakLogoGraphicsEnd: +NineTile: INCBIN "gfx/9_tile.2bpp" +TextBoxGraphics: INCBIN "gfx/text_box.2bpp" +TextBoxGraphicsEnd: +PokedexTileGraphics: INCBIN "gfx/pokedex.2bpp" +PokedexTileGraphicsEnd: +WorldMapTileGraphics: INCBIN "gfx/town_map.2bpp" +WorldMapTileGraphicsEnd: +PlayerCharacterTitleGraphics: INCBIN "gfx/player_title.2bpp" -; unreferenced - ret +INCLUDE "engine/menu/status_screen.asm" +INCLUDE "engine/menu/party_menu.asm" -INCLUDE "engine/hp_bar.asm" +RedPicFront: INCBIN "pic/ytrainer/red.pic" +ShrinkPic1: INCBIN "pic/trainer/shrink1.pic" +ShrinkPic2: INCBIN "pic/trainer/shrink2.pic" -INCLUDE "engine/hidden_object_functions3.asm" +INCLUDE "engine/menu/start_sub_menus.asm" +INCLUDE "engine/items/tms.asm" SECTION "NPC Sprites 1", ROMX, BANK[NPC_SPRITES_1] @@ -4766,58 +174,20 @@ ClipboardSprite: INCBIN "gfx/sprites/clipboard.2bpp" SnorlaxSprite: INCBIN "gfx/sprites/snorlax.2bpp" OldAmberSprite: INCBIN "gfx/sprites/old_amber.2bpp" LyingOldManSprite: INCBIN "gfx/sprites/lying_old_man.2bpp" +QuestionMarkSprite: INCBIN "gfx/sprites/question_mark.2bpp" - -SECTION "Graphics", ROMX, BANK[GFX] - -PokemonLogoGraphics: INCBIN "gfx/pokemon_logo.2bpp" -FontGraphics: INCBIN "gfx/font.1bpp" -FontGraphicsEnd: -ABTiles: INCBIN "gfx/AB.2bpp" -HpBarAndStatusGraphics: INCBIN "gfx/hp_bar_and_status.2bpp" -HpBarAndStatusGraphicsEnd: -BattleHudTiles1: INCBIN "gfx/battle_hud1.1bpp" -BattleHudTiles1End: -BattleHudTiles2: INCBIN "gfx/battle_hud2.1bpp" -BattleHudTiles3: INCBIN "gfx/battle_hud3.1bpp" -BattleHudTiles3End: -NintendoCopyrightLogoGraphics: INCBIN "gfx/copyright.2bpp" -GamefreakLogoGraphics: INCBIN "gfx/gamefreak.2bpp" -GamefreakLogoGraphicsEnd: -TextBoxGraphics: INCBIN "gfx/text_box.2bpp" -TextBoxGraphicsEnd: -PokedexTileGraphics: INCBIN "gfx/pokedex.2bpp" -PokedexTileGraphicsEnd: -WorldMapTileGraphics: INCBIN "gfx/town_map.2bpp" -WorldMapTileGraphicsEnd: -PlayerCharacterTitleGraphics: INCBIN "gfx/player_title.2bpp" -PlayerCharacterTitleGraphicsEnd: - - -SECTION "Battle (bank 4)", ROMX, BANK[$4] - -INCLUDE "engine/overworld/is_player_just_outside_map.asm" -INCLUDE "engine/menu/status_screen.asm" -INCLUDE "engine/menu/party_menu.asm" - -RedPicFront:: INCBIN "pic/trainer/red.pic" -ShrinkPic1:: INCBIN "pic/trainer/shrink1.pic" -ShrinkPic2:: INCBIN "pic/trainer/shrink2.pic" - -INCLUDE "engine/turn_sprite.asm" -INCLUDE "engine/menu/start_sub_menus.asm" -INCLUDE "engine/items/tms.asm" INCLUDE "engine/battle/end_of_battle.asm" INCLUDE "engine/battle/wild_encounters.asm" INCLUDE "engine/battle/moveEffects/recoil_effect.asm" INCLUDE "engine/battle/moveEffects/conversion_effect.asm" INCLUDE "engine/battle/moveEffects/haze_effect.asm" -INCLUDE "engine/battle/get_trainer_name.asm" -INCLUDE "engine/random.asm" SECTION "NPC Sprites 2", ROMX, BANK[NPC_SPRITES_2] +INCLUDE "engine/load_pokedex_tiles.asm" +INCLUDE "engine/overworld/map_sprites.asm" + RedCyclingSprite: INCBIN "gfx/sprites/cycling.2bpp" RedSprite: INCBIN "gfx/sprites/red.2bpp" BlueSprite: INCBIN "gfx/sprites/blue.2bpp" @@ -4859,18 +229,11 @@ BrunoSprite: INCBIN "gfx/sprites/bruno.2bpp" LoreleiSprite: INCBIN "gfx/sprites/lorelei.2bpp" SeelSprite: INCBIN "gfx/sprites/seel.2bpp" - -SECTION "Battle (bank 5)", ROMX, BANK[$5] - -INCLUDE "engine/load_pokedex_tiles.asm" -INCLUDE "engine/overworld/map_sprites.asm" -INCLUDE "engine/overworld/emotion_bubbles.asm" -INCLUDE "engine/evolve_trade.asm" INCLUDE "engine/battle/moveEffects/substitute_effect.asm" INCLUDE "engine/menu/pc.asm" -SECTION "bank6",ROMX,BANK[$6] +SECTION "bank06",ROMX,BANK[$06] INCLUDE "data/mapHeaders/celadoncity.asm" INCLUDE "data/mapObjects/celadoncity.asm" @@ -4890,17 +253,15 @@ PewterCityBlocks: INCBIN "maps/pewtercity.blk" INCLUDE "data/mapHeaders/ceruleancity.asm" INCLUDE "data/mapObjects/ceruleancity.asm" -CeruleanCityBlocks: INCBIN "maps/ceruleancity.blk" +CeruleanCityBlocks: INCBIN "maps/ceruleancity.blk" ; 18836 INCLUDE "data/mapHeaders/vermilioncity.asm" INCLUDE "data/mapObjects/vermilioncity.asm" VermilionCityBlocks: INCBIN "maps/vermilioncity.blk" - INCLUDE "data/mapHeaders/fuchsiacity.asm" INCLUDE "data/mapObjects/fuchsiacity.asm" FuchsiaCityBlocks: INCBIN "maps/fuchsiacity.blk" -INCLUDE "engine/play_time.asm" INCLUDE "scripts/pallettown.asm" INCLUDE "scripts/viridiancity.asm" @@ -4945,7 +306,7 @@ INCLUDE "engine/overworld/doors.asm" INCLUDE "engine/overworld/ledges.asm" -SECTION "bank7",ROMX,BANK[$7] +SECTION "bank07",ROMX,BANK[$07] INCLUDE "data/mapHeaders/cinnabarisland.asm" INCLUDE "data/mapObjects/cinnabarisland.asm" @@ -4953,41 +314,32 @@ CinnabarIslandBlocks: INCBIN "maps/cinnabarisland.blk" INCLUDE "data/mapHeaders/route1.asm" INCLUDE "data/mapObjects/route1.asm" -Route1Blocks: INCBIN "maps/route1.blk" +Route1Blocks: INCBIN "maps/route1.blk" ; 1c0fc UndergroundPathEntranceRoute8Blocks: INCBIN "maps/undergroundpathentranceroute8.blk" - OaksLabBlocks: INCBIN "maps/oakslab.blk" - -Route16HouseBlocks: +ViridianHouseBlocks: Route2HouseBlocks: -SaffronHouse1Blocks: -SaffronHouse2Blocks: +PewterHouse1Blocks: +PewterHouse2Blocks: +CeruleanHouse1Blocks: VermilionHouse1Blocks: -NameRaterBlocks: LavenderHouse1Blocks: LavenderHouse2Blocks: -CeruleanHouse1Blocks: -PewterHouse1Blocks: -PewterHouse2Blocks: -ViridianHouseBlocks: INCBIN "maps/viridianhouse.blk" - -CeladonMansion5Blocks: -SchoolBlocks: INCBIN "maps/school.blk" - +SaffronHouse1Blocks: +SaffronHouse2Blocks: +Route16HouseBlocks: +NameRaterBlocks: INCBIN "maps/viridianhouse.blk" +SchoolBlocks: +CeladonMansion5Blocks: INCBIN "maps/school.blk" CeruleanHouseTrashedBlocks: INCBIN "maps/ceruleanhousetrashed.blk" - -DiglettsCaveEntranceRoute11Blocks: -DiglettsCaveRoute2Blocks: INCBIN "maps/diglettscaveroute2.blk" - -INCLUDE "text/monster_names.asm" +DiglettsCaveRoute2Blocks: +DiglettsCaveEntranceRoute11Blocks: INCBIN "maps/diglettscaveroute2.blk" INCLUDE "engine/clear_save.asm" - INCLUDE "engine/predefs7.asm" INCLUDE "scripts/cinnabarisland.asm" - INCLUDE "scripts/route1.asm" INCLUDE "data/mapHeaders/oakslab.asm" @@ -4997,7 +349,8 @@ INCLUDE "data/mapObjects/oakslab.asm" INCLUDE "data/mapHeaders/viridianmart.asm" INCLUDE "scripts/viridianmart.asm" INCLUDE "data/mapObjects/viridianmart.asm" -ViridianMartBlocks: INCBIN "maps/viridianmart.blk" +ViridianMartBlocks: +CeladonMartBlocks: INCBIN "maps/viridianmart.blk" INCLUDE "data/mapHeaders/school.asm" INCLUDE "scripts/school.asm" @@ -5077,22 +430,22 @@ INCLUDE "data/mapObjects/route2house.asm" INCLUDE "data/mapHeaders/route5gate.asm" INCLUDE "scripts/route5gate.asm" INCLUDE "data/mapObjects/route5gate.asm" -Route5GateBlocks: INCBIN "maps/route5gate.blk" +Route5GateBlocks: INCBIN "maps/route5gate.blk" ; 1d92f INCLUDE "data/mapHeaders/route6gate.asm" INCLUDE "scripts/route6gate.asm" INCLUDE "data/mapObjects/route6gate.asm" -Route6GateBlocks: INCBIN "maps/route6gate.blk" +Route6GateBlocks: INCBIN "maps/route6gate.blk" ; 1d9f2 INCLUDE "data/mapHeaders/route7gate.asm" INCLUDE "scripts/route7gate.asm" INCLUDE "data/mapObjects/route7gate.asm" -Route7GateBlocks: INCBIN "maps/route7gate.blk" +Route7GateBlocks: INCBIN "maps/route7gate.blk" ; 1dab9 INCLUDE "data/mapHeaders/route8gate.asm" INCLUDE "scripts/route8gate.asm" INCLUDE "data/mapObjects/route8gate.asm" -Route8GateBlocks: INCBIN "maps/route8gate.blk" +Route8GateBlocks: INCBIN "maps/route8gate.blk" ; 1dab9 INCLUDE "data/mapHeaders/undergroundpathentranceroute8.asm" INCLUDE "scripts/undergroundpathentranceroute8.asm" @@ -5128,384 +481,362 @@ INCLUDE "engine/hidden_object_functions7.asm" SECTION "Pics 1", ROMX, BANK[PICS_1] -RhydonPicFront:: INCBIN "pic/bmon/rhydon.pic" -RhydonPicBack:: INCBIN "pic/monback/rhydonb.pic" -KangaskhanPicFront:: INCBIN "pic/bmon/kangaskhan.pic" -KangaskhanPicBack:: INCBIN "pic/monback/kangaskhanb.pic" -NidoranMPicFront:: INCBIN "pic/bmon/nidoranm.pic" -NidoranMPicBack:: INCBIN "pic/monback/nidoranmb.pic" -ClefairyPicFront:: INCBIN "pic/bmon/clefairy.pic" -ClefairyPicBack:: INCBIN "pic/monback/clefairyb.pic" -SpearowPicFront:: INCBIN "pic/bmon/spearow.pic" -SpearowPicBack:: INCBIN "pic/monback/spearowb.pic" -VoltorbPicFront:: INCBIN "pic/bmon/voltorb.pic" -VoltorbPicBack:: INCBIN "pic/monback/voltorbb.pic" -NidokingPicFront:: INCBIN "pic/bmon/nidoking.pic" -NidokingPicBack:: INCBIN "pic/monback/nidokingb.pic" -SlowbroPicFront:: INCBIN "pic/bmon/slowbro.pic" -SlowbroPicBack:: INCBIN "pic/monback/slowbrob.pic" -IvysaurPicFront:: INCBIN "pic/bmon/ivysaur.pic" -IvysaurPicBack:: INCBIN "pic/monback/ivysaurb.pic" -ExeggutorPicFront:: INCBIN "pic/bmon/exeggutor.pic" -ExeggutorPicBack:: INCBIN "pic/monback/exeggutorb.pic" -LickitungPicFront:: INCBIN "pic/bmon/lickitung.pic" -LickitungPicBack:: INCBIN "pic/monback/lickitungb.pic" -ExeggcutePicFront:: INCBIN "pic/bmon/exeggcute.pic" -ExeggcutePicBack:: INCBIN "pic/monback/exeggcuteb.pic" -GrimerPicFront:: INCBIN "pic/bmon/grimer.pic" -GrimerPicBack:: INCBIN "pic/monback/grimerb.pic" -GengarPicFront:: INCBIN "pic/bmon/gengar.pic" -GengarPicBack:: INCBIN "pic/monback/gengarb.pic" -NidoranFPicFront:: INCBIN "pic/bmon/nidoranf.pic" -NidoranFPicBack:: INCBIN "pic/monback/nidoranfb.pic" -NidoqueenPicFront:: INCBIN "pic/bmon/nidoqueen.pic" -NidoqueenPicBack:: INCBIN "pic/monback/nidoqueenb.pic" -CubonePicFront:: INCBIN "pic/bmon/cubone.pic" -CubonePicBack:: INCBIN "pic/monback/cuboneb.pic" -RhyhornPicFront:: INCBIN "pic/bmon/rhyhorn.pic" -RhyhornPicBack:: INCBIN "pic/monback/rhyhornb.pic" -LaprasPicFront:: INCBIN "pic/bmon/lapras.pic" -LaprasPicBack:: INCBIN "pic/monback/laprasb.pic" -ArcaninePicFront:: INCBIN "pic/bmon/arcanine.pic" -ArcaninePicBack:: INCBIN "pic/monback/arcanineb.pic" -GyaradosPicFront:: INCBIN "pic/bmon/gyarados.pic" -GyaradosPicBack:: INCBIN "pic/monback/gyaradosb.pic" -ShellderPicFront:: INCBIN "pic/bmon/shellder.pic" -ShellderPicBack:: INCBIN "pic/monback/shellderb.pic" -TentacoolPicFront:: INCBIN "pic/bmon/tentacool.pic" -TentacoolPicBack:: INCBIN "pic/monback/tentacoolb.pic" -GastlyPicFront:: INCBIN "pic/bmon/gastly.pic" -GastlyPicBack:: INCBIN "pic/monback/gastlyb.pic" -ScytherPicFront:: INCBIN "pic/bmon/scyther.pic" -ScytherPicBack:: INCBIN "pic/monback/scytherb.pic" -StaryuPicFront:: INCBIN "pic/bmon/staryu.pic" -StaryuPicBack:: INCBIN "pic/monback/staryub.pic" -BlastoisePicFront:: INCBIN "pic/bmon/blastoise.pic" -BlastoisePicBack:: INCBIN "pic/monback/blastoiseb.pic" -PinsirPicFront:: INCBIN "pic/bmon/pinsir.pic" -PinsirPicBack:: INCBIN "pic/monback/pinsirb.pic" -TangelaPicFront:: INCBIN "pic/bmon/tangela.pic" -TangelaPicBack:: INCBIN "pic/monback/tangelab.pic" - - -SECTION "Battle (bank 9)", ROMX, BANK[$9] +RhydonPicFront: INCBIN "pic/ymon/rhydon.pic" +RhydonPicBack: INCBIN "pic/monback/rhydonb.pic" +KangaskhanPicFront: INCBIN "pic/ymon/kangaskhan.pic" +KangaskhanPicBack: INCBIN "pic/monback/kangaskhanb.pic" +NidoranMPicFront: INCBIN "pic/ymon/nidoranm.pic" +NidoranMPicBack: INCBIN "pic/monback/nidoranmb.pic" +ClefairyPicFront: INCBIN "pic/ymon/clefairy.pic" +ClefairyPicBack: INCBIN "pic/monback/clefairyb.pic" +SpearowPicFront: INCBIN "pic/ymon/spearow.pic" +SpearowPicBack: INCBIN "pic/monback/spearowb.pic" +VoltorbPicFront: INCBIN "pic/ymon/voltorb.pic" +VoltorbPicBack: INCBIN "pic/monback/voltorbb.pic" +NidokingPicFront: INCBIN "pic/ymon/nidoking.pic" +NidokingPicBack: INCBIN "pic/monback/nidokingb.pic" +SlowbroPicFront: INCBIN "pic/ymon/slowbro.pic" +SlowbroPicBack: INCBIN "pic/monback/slowbrob.pic" +IvysaurPicFront: INCBIN "pic/ymon/ivysaur.pic" +IvysaurPicBack: INCBIN "pic/monback/ivysaurb.pic" +ExeggutorPicFront: INCBIN "pic/ymon/exeggutor.pic" +ExeggutorPicBack: INCBIN "pic/monback/exeggutorb.pic" +LickitungPicFront: INCBIN "pic/ymon/lickitung.pic" +LickitungPicBack: INCBIN "pic/monback/lickitungb.pic" +ExeggcutePicFront: INCBIN "pic/ymon/exeggcute.pic" +ExeggcutePicBack: INCBIN "pic/monback/exeggcuteb.pic" +GrimerPicFront: INCBIN "pic/ymon/grimer.pic" +GrimerPicBack: INCBIN "pic/monback/grimerb.pic" +GengarPicFront: INCBIN "pic/ymon/gengar.pic" +GengarPicBack: INCBIN "pic/monback/gengarb.pic" +NidoranFPicFront: INCBIN "pic/ymon/nidoranf.pic" +NidoranFPicBack: INCBIN "pic/monback/nidoranfb.pic" +NidoqueenPicFront: INCBIN "pic/ymon/nidoqueen.pic" +NidoqueenPicBack: INCBIN "pic/monback/nidoqueenb.pic" +CubonePicFront: INCBIN "pic/ymon/cubone.pic" +CubonePicBack: INCBIN "pic/monback/cuboneb.pic" +RhyhornPicFront: INCBIN "pic/ymon/rhyhorn.pic" +RhyhornPicBack: INCBIN "pic/monback/rhyhornb.pic" +LaprasPicFront: INCBIN "pic/ymon/lapras.pic" +LaprasPicBack: INCBIN "pic/monback/laprasb.pic" +ArcaninePicFront: INCBIN "pic/ymon/arcanine.pic" +ArcaninePicBack: INCBIN "pic/monback/arcanineb.pic" +MewPicFront: INCBIN "pic/ymon/mew.pic" +MewPicBack: INCBIN "pic/monback/mewb.pic" +GyaradosPicFront: INCBIN "pic/ymon/gyarados.pic" +GyaradosPicBack: INCBIN "pic/monback/gyaradosb.pic" +ShellderPicFront: INCBIN "pic/ymon/shellder.pic" +ShellderPicBack: INCBIN "pic/monback/shellderb.pic" +TentacoolPicFront: INCBIN "pic/ymon/tentacool.pic" +TentacoolPicBack: INCBIN "pic/monback/tentacoolb.pic" +GastlyPicFront: INCBIN "pic/ymon/gastly.pic" +GastlyPicBack: INCBIN "pic/monback/gastlyb.pic" +ScytherPicFront: INCBIN "pic/ymon/scyther.pic" +ScytherPicBack: INCBIN "pic/monback/scytherb.pic" +StaryuPicFront: INCBIN "pic/ymon/staryu.pic" +StaryuPicBack: INCBIN "pic/monback/staryub.pic" +BlastoisePicFront: INCBIN "pic/ymon/blastoise.pic" +BlastoisePicBack: INCBIN "pic/monback/blastoiseb.pic" +PinsirPicFront: INCBIN "pic/ymon/pinsir.pic" +PinsirPicBack: INCBIN "pic/monback/pinsirb.pic" +TangelaPicFront: INCBIN "pic/ymon/tangela.pic" +TangelaPicBack: INCBIN "pic/monback/tangelab.pic" + INCLUDE "engine/battle/print_type.asm" INCLUDE "engine/battle/save_trainer_name.asm" -INCLUDE "engine/battle/moveEffects/focus_energy_effect.asm" SECTION "Pics 2", ROMX, BANK[PICS_2] -GrowlithePicFront:: INCBIN "pic/bmon/growlithe.pic" -GrowlithePicBack:: INCBIN "pic/monback/growlitheb.pic" -OnixPicFront:: INCBIN "pic/bmon/onix.pic" -OnixPicBack:: INCBIN "pic/monback/onixb.pic" -FearowPicFront:: INCBIN "pic/bmon/fearow.pic" -FearowPicBack:: INCBIN "pic/monback/fearowb.pic" -PidgeyPicFront:: INCBIN "pic/bmon/pidgey.pic" -PidgeyPicBack:: INCBIN "pic/monback/pidgeyb.pic" -SlowpokePicFront:: INCBIN "pic/bmon/slowpoke.pic" -SlowpokePicBack:: INCBIN "pic/monback/slowpokeb.pic" -KadabraPicFront:: INCBIN "pic/bmon/kadabra.pic" -KadabraPicBack:: INCBIN "pic/monback/kadabrab.pic" -GravelerPicFront:: INCBIN "pic/bmon/graveler.pic" -GravelerPicBack:: INCBIN "pic/monback/gravelerb.pic" -ChanseyPicFront:: INCBIN "pic/bmon/chansey.pic" -ChanseyPicBack:: INCBIN "pic/monback/chanseyb.pic" -MachokePicFront:: INCBIN "pic/bmon/machoke.pic" -MachokePicBack:: INCBIN "pic/monback/machokeb.pic" -MrMimePicFront:: INCBIN "pic/bmon/mr.mime.pic" -MrMimePicBack:: INCBIN "pic/monback/mr.mimeb.pic" -HitmonleePicFront:: INCBIN "pic/bmon/hitmonlee.pic" -HitmonleePicBack:: INCBIN "pic/monback/hitmonleeb.pic" -HitmonchanPicFront:: INCBIN "pic/bmon/hitmonchan.pic" -HitmonchanPicBack:: INCBIN "pic/monback/hitmonchanb.pic" -ArbokPicFront:: INCBIN "pic/bmon/arbok.pic" -ArbokPicBack:: INCBIN "pic/monback/arbokb.pic" -ParasectPicFront:: INCBIN "pic/bmon/parasect.pic" -ParasectPicBack:: INCBIN "pic/monback/parasectb.pic" -PsyduckPicFront:: INCBIN "pic/bmon/psyduck.pic" -PsyduckPicBack:: INCBIN "pic/monback/psyduckb.pic" -DrowzeePicFront:: INCBIN "pic/bmon/drowzee.pic" -DrowzeePicBack:: INCBIN "pic/monback/drowzeeb.pic" -GolemPicFront:: INCBIN "pic/bmon/golem.pic" -GolemPicBack:: INCBIN "pic/monback/golemb.pic" -MagmarPicFront:: INCBIN "pic/bmon/magmar.pic" -MagmarPicBack:: INCBIN "pic/monback/magmarb.pic" -ElectabuzzPicFront:: INCBIN "pic/bmon/electabuzz.pic" -ElectabuzzPicBack:: INCBIN "pic/monback/electabuzzb.pic" -MagnetonPicFront:: INCBIN "pic/bmon/magneton.pic" -MagnetonPicBack:: INCBIN "pic/monback/magnetonb.pic" -KoffingPicFront:: INCBIN "pic/bmon/koffing.pic" -KoffingPicBack:: INCBIN "pic/monback/koffingb.pic" -MankeyPicFront:: INCBIN "pic/bmon/mankey.pic" -MankeyPicBack:: INCBIN "pic/monback/mankeyb.pic" -SeelPicFront:: INCBIN "pic/bmon/seel.pic" -SeelPicBack:: INCBIN "pic/monback/seelb.pic" -DiglettPicFront:: INCBIN "pic/bmon/diglett.pic" -DiglettPicBack:: INCBIN "pic/monback/diglettb.pic" -TaurosPicFront:: INCBIN "pic/bmon/tauros.pic" -TaurosPicBack:: INCBIN "pic/monback/taurosb.pic" -FarfetchdPicFront:: INCBIN "pic/bmon/farfetchd.pic" -FarfetchdPicBack:: INCBIN "pic/monback/farfetchdb.pic" -VenonatPicFront:: INCBIN "pic/bmon/venonat.pic" -VenonatPicBack:: INCBIN "pic/monback/venonatb.pic" -DragonitePicFront:: INCBIN "pic/bmon/dragonite.pic" -DragonitePicBack:: INCBIN "pic/monback/dragoniteb.pic" -DoduoPicFront:: INCBIN "pic/bmon/doduo.pic" -DoduoPicBack:: INCBIN "pic/monback/doduob.pic" -PoliwagPicFront:: INCBIN "pic/bmon/poliwag.pic" -PoliwagPicBack:: INCBIN "pic/monback/poliwagb.pic" -JynxPicFront:: INCBIN "pic/bmon/jynx.pic" -JynxPicBack:: INCBIN "pic/monback/jynxb.pic" -MoltresPicFront:: INCBIN "pic/bmon/moltres.pic" -MoltresPicBack:: INCBIN "pic/monback/moltresb.pic" - - -SECTION "Battle (bank A)", ROMX, BANK[$A] +GrowlithePicFront: INCBIN "pic/ymon/growlithe.pic" +GrowlithePicBack: INCBIN "pic/monback/growlitheb.pic" +OnixPicFront: INCBIN "pic/ymon/onix.pic" +OnixPicBack: INCBIN "pic/monback/onixb.pic" +FearowPicFront: INCBIN "pic/ymon/fearow.pic" +FearowPicBack: INCBIN "pic/monback/fearowb.pic" +PidgeyPicFront: INCBIN "pic/ymon/pidgey.pic" +PidgeyPicBack: INCBIN "pic/monback/pidgeyb.pic" +SlowpokePicFront: INCBIN "pic/ymon/slowpoke.pic" +SlowpokePicBack: INCBIN "pic/monback/slowpokeb.pic" +KadabraPicFront: INCBIN "pic/ymon/kadabra.pic" +KadabraPicBack: INCBIN "pic/monback/kadabrab.pic" +GravelerPicFront: INCBIN "pic/ymon/graveler.pic" +GravelerPicBack: INCBIN "pic/monback/gravelerb.pic" +ChanseyPicFront: INCBIN "pic/ymon/chansey.pic" +ChanseyPicBack: INCBIN "pic/monback/chanseyb.pic" +MachokePicFront: INCBIN "pic/ymon/machoke.pic" +MachokePicBack: INCBIN "pic/monback/machokeb.pic" +MrMimePicFront: INCBIN "pic/ymon/mr.mime.pic" +MrMimePicBack: INCBIN "pic/monback/mr.mimeb.pic" +HitmonleePicFront: INCBIN "pic/ymon/hitmonlee.pic" +HitmonleePicBack: INCBIN "pic/monback/hitmonleeb.pic" +HitmonchanPicFront: INCBIN "pic/ymon/hitmonchan.pic" +HitmonchanPicBack: INCBIN "pic/monback/hitmonchanb.pic" +ArbokPicFront: INCBIN "pic/ymon/arbok.pic" +ArbokPicBack: INCBIN "pic/monback/arbokb.pic" +ParasectPicFront: INCBIN "pic/ymon/parasect.pic" +ParasectPicBack: INCBIN "pic/monback/parasectb.pic" +PsyduckPicFront: INCBIN "pic/ymon/psyduck.pic" +PsyduckPicBack: INCBIN "pic/monback/psyduckb.pic" +DrowzeePicFront: INCBIN "pic/ymon/drowzee.pic" +DrowzeePicBack: INCBIN "pic/monback/drowzeeb.pic" +GolemPicFront: INCBIN "pic/ymon/golem.pic" +GolemPicBack: INCBIN "pic/monback/golemb.pic" +MagmarPicFront: INCBIN "pic/ymon/magmar.pic" +MagmarPicBack: INCBIN "pic/monback/magmarb.pic" +ElectabuzzPicFront: INCBIN "pic/ymon/electabuzz.pic" +ElectabuzzPicBack: INCBIN "pic/monback/electabuzzb.pic" +MagnetonPicFront: INCBIN "pic/ymon/magneton.pic" +MagnetonPicBack: INCBIN "pic/monback/magnetonb.pic" +KoffingPicFront: INCBIN "pic/ymon/koffing.pic" +KoffingPicBack: INCBIN "pic/monback/koffingb.pic" +MankeyPicFront: INCBIN "pic/ymon/mankey.pic" +MankeyPicBack: INCBIN "pic/monback/mankeyb.pic" +SeelPicFront: INCBIN "pic/ymon/seel.pic" +SeelPicBack: INCBIN "pic/monback/seelb.pic" +DiglettPicFront: INCBIN "pic/ymon/diglett.pic" +DiglettPicBack: INCBIN "pic/monback/diglettb.pic" +TaurosPicFront: INCBIN "pic/ymon/tauros.pic" +TaurosPicBack: INCBIN "pic/monback/taurosb.pic" +FarfetchdPicFront: INCBIN "pic/ymon/farfetchd.pic" +FarfetchdPicBack: INCBIN "pic/monback/farfetchdb.pic" +VenonatPicFront: INCBIN "pic/ymon/venonat.pic" +VenonatPicBack: INCBIN "pic/monback/venonatb.pic" +DragonitePicFront: INCBIN "pic/ymon/dragonite.pic" +DragonitePicBack: INCBIN "pic/monback/dragoniteb.pic" +DoduoPicFront: INCBIN "pic/ymon/doduo.pic" +DoduoPicBack: INCBIN "pic/monback/doduob.pic" +PoliwagPicFront: INCBIN "pic/ymon/poliwag.pic" +PoliwagPicBack: INCBIN "pic/monback/poliwagb.pic" +JynxPicFront: INCBIN "pic/ymon/jynx.pic" +JynxPicBack: INCBIN "pic/monback/jynxb.pic" +MoltresPicFront: INCBIN "pic/ymon/moltres.pic" +MoltresPicBack: INCBIN "pic/monback/moltresb.pic" + +INCLUDE "engine/predefsA.asm" INCLUDE "engine/battle/moveEffects/leech_seed_effect.asm" SECTION "Pics 3", ROMX, BANK[PICS_3] -ArticunoPicFront:: INCBIN "pic/bmon/articuno.pic" -ArticunoPicBack:: INCBIN "pic/monback/articunob.pic" -ZapdosPicFront:: INCBIN "pic/bmon/zapdos.pic" -ZapdosPicBack:: INCBIN "pic/monback/zapdosb.pic" -DittoPicFront:: INCBIN "pic/bmon/ditto.pic" -DittoPicBack:: INCBIN "pic/monback/dittob.pic" -MeowthPicFront:: INCBIN "pic/bmon/meowth.pic" -MeowthPicBack:: INCBIN "pic/monback/meowthb.pic" -KrabbyPicFront:: INCBIN "pic/bmon/krabby.pic" -KrabbyPicBack:: INCBIN "pic/monback/krabbyb.pic" -VulpixPicFront:: INCBIN "pic/bmon/vulpix.pic" -VulpixPicBack:: INCBIN "pic/monback/vulpixb.pic" -NinetalesPicFront:: INCBIN "pic/bmon/ninetales.pic" -NinetalesPicBack:: INCBIN "pic/monback/ninetalesb.pic" -PikachuPicFront:: INCBIN "pic/bmon/pikachu.pic" -PikachuPicBack:: INCBIN "pic/monback/pikachub.pic" -RaichuPicFront:: INCBIN "pic/bmon/raichu.pic" -RaichuPicBack:: INCBIN "pic/monback/raichub.pic" -DratiniPicFront:: INCBIN "pic/bmon/dratini.pic" -DratiniPicBack:: INCBIN "pic/monback/dratinib.pic" -DragonairPicFront:: INCBIN "pic/bmon/dragonair.pic" -DragonairPicBack:: INCBIN "pic/monback/dragonairb.pic" -KabutoPicFront:: INCBIN "pic/bmon/kabuto.pic" -KabutoPicBack:: INCBIN "pic/monback/kabutob.pic" -KabutopsPicFront:: INCBIN "pic/bmon/kabutops.pic" -KabutopsPicBack:: INCBIN "pic/monback/kabutopsb.pic" -HorseaPicFront:: INCBIN "pic/bmon/horsea.pic" -HorseaPicBack:: INCBIN "pic/monback/horseab.pic" -SeadraPicFront:: INCBIN "pic/bmon/seadra.pic" -SeadraPicBack:: INCBIN "pic/monback/seadrab.pic" -SandshrewPicFront:: INCBIN "pic/bmon/sandshrew.pic" -SandshrewPicBack:: INCBIN "pic/monback/sandshrewb.pic" -SandslashPicFront:: INCBIN "pic/bmon/sandslash.pic" -SandslashPicBack:: INCBIN "pic/monback/sandslashb.pic" -OmanytePicFront:: INCBIN "pic/bmon/omanyte.pic" -OmanytePicBack:: INCBIN "pic/monback/omanyteb.pic" -OmastarPicFront:: INCBIN "pic/bmon/omastar.pic" -OmastarPicBack:: INCBIN "pic/monback/omastarb.pic" -JigglypuffPicFront:: INCBIN "pic/bmon/jigglypuff.pic" -JigglypuffPicBack:: INCBIN "pic/monback/jigglypuffb.pic" -WigglytuffPicFront:: INCBIN "pic/bmon/wigglytuff.pic" -WigglytuffPicBack:: INCBIN "pic/monback/wigglytuffb.pic" -EeveePicFront:: INCBIN "pic/bmon/eevee.pic" -EeveePicBack:: INCBIN "pic/monback/eeveeb.pic" -FlareonPicFront:: INCBIN "pic/bmon/flareon.pic" -FlareonPicBack:: INCBIN "pic/monback/flareonb.pic" -JolteonPicFront:: INCBIN "pic/bmon/jolteon.pic" -JolteonPicBack:: INCBIN "pic/monback/jolteonb.pic" -VaporeonPicFront:: INCBIN "pic/bmon/vaporeon.pic" -VaporeonPicBack:: INCBIN "pic/monback/vaporeonb.pic" -MachopPicFront:: INCBIN "pic/bmon/machop.pic" -MachopPicBack:: INCBIN "pic/monback/machopb.pic" -ZubatPicFront:: INCBIN "pic/bmon/zubat.pic" -ZubatPicBack:: INCBIN "pic/monback/zubatb.pic" -EkansPicFront:: INCBIN "pic/bmon/ekans.pic" -EkansPicBack:: INCBIN "pic/monback/ekansb.pic" -ParasPicFront:: INCBIN "pic/bmon/paras.pic" -ParasPicBack:: INCBIN "pic/monback/parasb.pic" -PoliwhirlPicFront:: INCBIN "pic/bmon/poliwhirl.pic" -PoliwhirlPicBack:: INCBIN "pic/monback/poliwhirlb.pic" -PoliwrathPicFront:: INCBIN "pic/bmon/poliwrath.pic" -PoliwrathPicBack:: INCBIN "pic/monback/poliwrathb.pic" -WeedlePicFront:: INCBIN "pic/bmon/weedle.pic" -WeedlePicBack:: INCBIN "pic/monback/weedleb.pic" -KakunaPicFront:: INCBIN "pic/bmon/kakuna.pic" -KakunaPicBack:: INCBIN "pic/monback/kakunab.pic" -BeedrillPicFront:: INCBIN "pic/bmon/beedrill.pic" -BeedrillPicBack:: INCBIN "pic/monback/beedrillb.pic" - -FossilKabutopsPic:: INCBIN "pic/bmon/fossilkabutops.pic" - - -SECTION "Battle (bank B)", ROMX, BANK[$B] +ArticunoPicFront: INCBIN "pic/ymon/articuno.pic" +ArticunoPicBack: INCBIN "pic/monback/articunob.pic" +ZapdosPicFront: INCBIN "pic/ymon/zapdos.pic" +ZapdosPicBack: INCBIN "pic/monback/zapdosb.pic" +DittoPicFront: INCBIN "pic/ymon/ditto.pic" +DittoPicBack: INCBIN "pic/monback/dittob.pic" +MeowthPicFront: INCBIN "pic/ymon/meowth.pic" +MeowthPicBack: INCBIN "pic/monback/meowthb.pic" +KrabbyPicFront: INCBIN "pic/ymon/krabby.pic" +KrabbyPicBack: INCBIN "pic/monback/krabbyb.pic" +VulpixPicFront: INCBIN "pic/ymon/vulpix.pic" +VulpixPicBack: INCBIN "pic/monback/vulpixb.pic" +NinetalesPicFront: INCBIN "pic/ymon/ninetales.pic" +NinetalesPicBack: INCBIN "pic/monback/ninetalesb.pic" +PikachuPicFront: INCBIN "pic/ymon/pikachu.pic" +PikachuPicBack: INCBIN "pic/monback/pikachub.pic" +RaichuPicFront: INCBIN "pic/ymon/raichu.pic" +RaichuPicBack: INCBIN "pic/monback/raichub.pic" +DratiniPicFront: INCBIN "pic/ymon/dratini.pic" +DratiniPicBack: INCBIN "pic/monback/dratinib.pic" +DragonairPicFront: INCBIN "pic/ymon/dragonair.pic" +DragonairPicBack: INCBIN "pic/monback/dragonairb.pic" +KabutoPicFront: INCBIN "pic/ymon/kabuto.pic" +KabutoPicBack: INCBIN "pic/monback/kabutob.pic" +KabutopsPicFront: INCBIN "pic/ymon/kabutops.pic" +KabutopsPicBack: INCBIN "pic/monback/kabutopsb.pic" +HorseaPicFront: INCBIN "pic/ymon/horsea.pic" +HorseaPicBack: INCBIN "pic/monback/horseab.pic" +SeadraPicFront: INCBIN "pic/ymon/seadra.pic" +SeadraPicBack: INCBIN "pic/monback/seadrab.pic" +SandshrewPicFront: INCBIN "pic/ymon/sandshrew.pic" +SandshrewPicBack: INCBIN "pic/monback/sandshrewb.pic" +SandslashPicFront: INCBIN "pic/ymon/sandslash.pic" +SandslashPicBack: INCBIN "pic/monback/sandslashb.pic" +OmanytePicFront: INCBIN "pic/ymon/omanyte.pic" +OmanytePicBack: INCBIN "pic/monback/omanyteb.pic" +OmastarPicFront: INCBIN "pic/ymon/omastar.pic" +OmastarPicBack: INCBIN "pic/monback/omastarb.pic" +JigglypuffPicFront: INCBIN "pic/ymon/jigglypuff.pic" +JigglypuffPicBack: INCBIN "pic/monback/jigglypuffb.pic" +WigglytuffPicFront: INCBIN "pic/ymon/wigglytuff.pic" +WigglytuffPicBack: INCBIN "pic/monback/wigglytuffb.pic" +EeveePicFront: INCBIN "pic/ymon/eevee.pic" +EeveePicBack: INCBIN "pic/monback/eeveeb.pic" +FlareonPicFront: INCBIN "pic/ymon/flareon.pic" +FlareonPicBack: INCBIN "pic/monback/flareonb.pic" +JolteonPicFront: INCBIN "pic/ymon/jolteon.pic" +JolteonPicBack: INCBIN "pic/monback/jolteonb.pic" +VaporeonPicFront: INCBIN "pic/ymon/vaporeon.pic" +VaporeonPicBack: INCBIN "pic/monback/vaporeonb.pic" +MachopPicFront: INCBIN "pic/ymon/machop.pic" +MachopPicBack: INCBIN "pic/monback/machopb.pic" +ZubatPicFront: INCBIN "pic/ymon/zubat.pic" +ZubatPicBack: INCBIN "pic/monback/zubatb.pic" +EkansPicFront: INCBIN "pic/ymon/ekans.pic" +EkansPicBack: INCBIN "pic/monback/ekansb.pic" +ParasPicFront: INCBIN "pic/ymon/paras.pic" +ParasPicBack: INCBIN "pic/monback/parasb.pic" +PoliwhirlPicFront: INCBIN "pic/ymon/poliwhirl.pic" +PoliwhirlPicBack: INCBIN "pic/monback/poliwhirlb.pic" +PoliwrathPicFront: INCBIN "pic/ymon/poliwrath.pic" +PoliwrathPicBack: INCBIN "pic/monback/poliwrathb.pic" +WeedlePicFront: INCBIN "pic/ymon/weedle.pic" +WeedlePicBack: INCBIN "pic/monback/weedleb.pic" +KakunaPicFront: INCBIN "pic/ymon/kakuna.pic" +KakunaPicBack: INCBIN "pic/monback/kakunab.pic" +BeedrillPicFront: INCBIN "pic/ymon/beedrill.pic" +BeedrillPicBack: INCBIN "pic/monback/beedrillb.pic" + +FossilKabutopsPic: INCBIN "pic/ymon/fossilkabutops.pic" INCLUDE "engine/battle/display_effectiveness.asm" +INCLUDE "engine/items/tmhm.asm" -TrainerInfoTextBoxTileGraphics: INCBIN "gfx/trainer_info.2bpp" -TrainerInfoTextBoxTileGraphicsEnd: -BlankLeaderNames: INCBIN "gfx/blank_leader_names.2bpp" -CircleTile: INCBIN "gfx/circle_tile.2bpp" -BadgeNumbersTileGraphics: INCBIN "gfx/badge_numbers.2bpp" +Func_2fd6a: + callab IsThisPartymonStarterPikachu_Party + ret nc + ld a, $3 + ld [wPikachuSpawnState], a + ret -INCLUDE "engine/items/tmhm.asm" INCLUDE "engine/battle/scale_sprites.asm" -INCLUDE "engine/battle/moveEffects/pay_day_effect.asm" INCLUDE "engine/game_corner_slots2.asm" SECTION "Pics 4", ROMX, BANK[PICS_4] -DodrioPicFront:: INCBIN "pic/bmon/dodrio.pic" -DodrioPicBack:: INCBIN "pic/monback/dodriob.pic" -PrimeapePicFront:: INCBIN "pic/bmon/primeape.pic" -PrimeapePicBack:: INCBIN "pic/monback/primeapeb.pic" -DugtrioPicFront:: INCBIN "pic/bmon/dugtrio.pic" -DugtrioPicBack:: INCBIN "pic/monback/dugtriob.pic" -VenomothPicFront:: INCBIN "pic/bmon/venomoth.pic" -VenomothPicBack:: INCBIN "pic/monback/venomothb.pic" -DewgongPicFront:: INCBIN "pic/bmon/dewgong.pic" -DewgongPicBack:: INCBIN "pic/monback/dewgongb.pic" -CaterpiePicFront:: INCBIN "pic/bmon/caterpie.pic" -CaterpiePicBack:: INCBIN "pic/monback/caterpieb.pic" -MetapodPicFront:: INCBIN "pic/bmon/metapod.pic" -MetapodPicBack:: INCBIN "pic/monback/metapodb.pic" -ButterfreePicFront:: INCBIN "pic/bmon/butterfree.pic" -ButterfreePicBack:: INCBIN "pic/monback/butterfreeb.pic" -MachampPicFront:: INCBIN "pic/bmon/machamp.pic" -MachampPicBack:: INCBIN "pic/monback/machampb.pic" -GolduckPicFront:: INCBIN "pic/bmon/golduck.pic" -GolduckPicBack:: INCBIN "pic/monback/golduckb.pic" -HypnoPicFront:: INCBIN "pic/bmon/hypno.pic" -HypnoPicBack:: INCBIN "pic/monback/hypnob.pic" -GolbatPicFront:: INCBIN "pic/bmon/golbat.pic" -GolbatPicBack:: INCBIN "pic/monback/golbatb.pic" -MewtwoPicFront:: INCBIN "pic/bmon/mewtwo.pic" -MewtwoPicBack:: INCBIN "pic/monback/mewtwob.pic" -SnorlaxPicFront:: INCBIN "pic/bmon/snorlax.pic" -SnorlaxPicBack:: INCBIN "pic/monback/snorlaxb.pic" -MagikarpPicFront:: INCBIN "pic/bmon/magikarp.pic" -MagikarpPicBack:: INCBIN "pic/monback/magikarpb.pic" -MukPicFront:: INCBIN "pic/bmon/muk.pic" -MukPicBack:: INCBIN "pic/monback/mukb.pic" -KinglerPicFront:: INCBIN "pic/bmon/kingler.pic" -KinglerPicBack:: INCBIN "pic/monback/kinglerb.pic" -CloysterPicFront:: INCBIN "pic/bmon/cloyster.pic" -CloysterPicBack:: INCBIN "pic/monback/cloysterb.pic" -ElectrodePicFront:: INCBIN "pic/bmon/electrode.pic" -ElectrodePicBack:: INCBIN "pic/monback/electrodeb.pic" -ClefablePicFront:: INCBIN "pic/bmon/clefable.pic" -ClefablePicBack:: INCBIN "pic/monback/clefableb.pic" -WeezingPicFront:: INCBIN "pic/bmon/weezing.pic" -WeezingPicBack:: INCBIN "pic/monback/weezingb.pic" -PersianPicFront:: INCBIN "pic/bmon/persian.pic" -PersianPicBack:: INCBIN "pic/monback/persianb.pic" -MarowakPicFront:: INCBIN "pic/bmon/marowak.pic" -MarowakPicBack:: INCBIN "pic/monback/marowakb.pic" -HaunterPicFront:: INCBIN "pic/bmon/haunter.pic" -HaunterPicBack:: INCBIN "pic/monback/haunterb.pic" -AbraPicFront:: INCBIN "pic/bmon/abra.pic" -AbraPicBack:: INCBIN "pic/monback/abrab.pic" -AlakazamPicFront:: INCBIN "pic/bmon/alakazam.pic" -AlakazamPicBack:: INCBIN "pic/monback/alakazamb.pic" -PidgeottoPicFront:: INCBIN "pic/bmon/pidgeotto.pic" -PidgeottoPicBack:: INCBIN "pic/monback/pidgeottob.pic" -PidgeotPicFront:: INCBIN "pic/bmon/pidgeot.pic" -PidgeotPicBack:: INCBIN "pic/monback/pidgeotb.pic" -StarmiePicFront:: INCBIN "pic/bmon/starmie.pic" -StarmiePicBack:: INCBIN "pic/monback/starmieb.pic" - -RedPicBack:: INCBIN "pic/trainer/redb.pic" -OldManPic:: INCBIN "pic/trainer/oldman.pic" - - -SECTION "Battle (bank C)", ROMX, BANK[$C] -INCLUDE "engine/battle/moveEffects/mist_effect.asm" -INCLUDE "engine/battle/moveEffects/one_hit_ko_effect.asm" +DodrioPicFront: INCBIN "pic/ymon/dodrio.pic" +DodrioPicBack: INCBIN "pic/monback/dodriob.pic" +PrimeapePicFront: INCBIN "pic/ymon/primeape.pic" +PrimeapePicBack: INCBIN "pic/monback/primeapeb.pic" +DugtrioPicFront: INCBIN "pic/ymon/dugtrio.pic" +DugtrioPicBack: INCBIN "pic/monback/dugtriob.pic" +VenomothPicFront: INCBIN "pic/ymon/venomoth.pic" +VenomothPicBack: INCBIN "pic/monback/venomothb.pic" +DewgongPicFront: INCBIN "pic/ymon/dewgong.pic" +DewgongPicBack: INCBIN "pic/monback/dewgongb.pic" +CaterpiePicFront: INCBIN "pic/ymon/caterpie.pic" +CaterpiePicBack: INCBIN "pic/monback/caterpieb.pic" +MetapodPicFront: INCBIN "pic/ymon/metapod.pic" +MetapodPicBack: INCBIN "pic/monback/metapodb.pic" +ButterfreePicFront: INCBIN "pic/ymon/butterfree.pic" +ButterfreePicBack: INCBIN "pic/monback/butterfreeb.pic" +MachampPicFront: INCBIN "pic/ymon/machamp.pic" +MachampPicBack: INCBIN "pic/monback/machampb.pic" +GolduckPicFront: INCBIN "pic/ymon/golduck.pic" +GolduckPicBack: INCBIN "pic/monback/golduckb.pic" +HypnoPicFront: INCBIN "pic/ymon/hypno.pic" +HypnoPicBack: INCBIN "pic/monback/hypnob.pic" +GolbatPicFront: INCBIN "pic/ymon/golbat.pic" +GolbatPicBack: INCBIN "pic/monback/golbatb.pic" +MewtwoPicFront: INCBIN "pic/ymon/mewtwo.pic" +MewtwoPicBack: INCBIN "pic/monback/mewtwob.pic" +SnorlaxPicFront: INCBIN "pic/ymon/snorlax.pic" +SnorlaxPicBack: INCBIN "pic/monback/snorlaxb.pic" +MagikarpPicFront: INCBIN "pic/ymon/magikarp.pic" +MagikarpPicBack: INCBIN "pic/monback/magikarpb.pic" +MukPicFront: INCBIN "pic/ymon/muk.pic" +MukPicBack: INCBIN "pic/monback/mukb.pic" +KinglerPicFront: INCBIN "pic/ymon/kingler.pic" +KinglerPicBack: INCBIN "pic/monback/kinglerb.pic" +CloysterPicFront: INCBIN "pic/ymon/cloyster.pic" +CloysterPicBack: INCBIN "pic/monback/cloysterb.pic" +ElectrodePicFront: INCBIN "pic/ymon/electrode.pic" +ElectrodePicBack: INCBIN "pic/monback/electrodeb.pic" +ClefablePicFront: INCBIN "pic/ymon/clefable.pic" +ClefablePicBack: INCBIN "pic/monback/clefableb.pic" +WeezingPicFront: INCBIN "pic/ymon/weezing.pic" +WeezingPicBack: INCBIN "pic/monback/weezingb.pic" +PersianPicFront: INCBIN "pic/ymon/persian.pic" +PersianPicBack: INCBIN "pic/monback/persianb.pic" +MarowakPicFront: INCBIN "pic/ymon/marowak.pic" +MarowakPicBack: INCBIN "pic/monback/marowakb.pic" +HaunterPicFront: INCBIN "pic/ymon/haunter.pic" +HaunterPicBack: INCBIN "pic/monback/haunterb.pic" +AbraPicFront: INCBIN "pic/ymon/abra.pic" +AbraPicBack: INCBIN "pic/monback/abrab.pic" +AlakazamPicFront: INCBIN "pic/ymon/alakazam.pic" +AlakazamPicBack: INCBIN "pic/monback/alakazamb.pic" +PidgeottoPicFront: INCBIN "pic/ymon/pidgeotto.pic" +PidgeottoPicBack: INCBIN "pic/monback/pidgeottob.pic" +PidgeotPicFront: INCBIN "pic/ymon/pidgeot.pic" +PidgeotPicBack: INCBIN "pic/monback/pidgeotb.pic" +StarmiePicFront: INCBIN "pic/ymon/starmie.pic" +StarmiePicBack: INCBIN "pic/monback/starmieb.pic" SECTION "Pics 5", ROMX, BANK[PICS_5] -BulbasaurPicFront:: INCBIN "pic/bmon/bulbasaur.pic" -BulbasaurPicBack:: INCBIN "pic/monback/bulbasaurb.pic" -VenusaurPicFront:: INCBIN "pic/bmon/venusaur.pic" -VenusaurPicBack:: INCBIN "pic/monback/venusaurb.pic" -TentacruelPicFront:: INCBIN "pic/bmon/tentacruel.pic" -TentacruelPicBack:: INCBIN "pic/monback/tentacruelb.pic" -GoldeenPicFront:: INCBIN "pic/bmon/goldeen.pic" -GoldeenPicBack:: INCBIN "pic/monback/goldeenb.pic" -SeakingPicFront:: INCBIN "pic/bmon/seaking.pic" -SeakingPicBack:: INCBIN "pic/monback/seakingb.pic" -PonytaPicFront:: INCBIN "pic/bmon/ponyta.pic" -RapidashPicFront:: INCBIN "pic/bmon/rapidash.pic" -PonytaPicBack:: INCBIN "pic/monback/ponytab.pic" -RapidashPicBack:: INCBIN "pic/monback/rapidashb.pic" -RattataPicFront:: INCBIN "pic/bmon/rattata.pic" -RattataPicBack:: INCBIN "pic/monback/rattatab.pic" -RaticatePicFront:: INCBIN "pic/bmon/raticate.pic" -RaticatePicBack:: INCBIN "pic/monback/raticateb.pic" -NidorinoPicFront:: INCBIN "pic/bmon/nidorino.pic" -NidorinoPicBack:: INCBIN "pic/monback/nidorinob.pic" -NidorinaPicFront:: INCBIN "pic/bmon/nidorina.pic" -NidorinaPicBack:: INCBIN "pic/monback/nidorinab.pic" -GeodudePicFront:: INCBIN "pic/bmon/geodude.pic" -GeodudePicBack:: INCBIN "pic/monback/geodudeb.pic" -PorygonPicFront:: INCBIN "pic/bmon/porygon.pic" -PorygonPicBack:: INCBIN "pic/monback/porygonb.pic" -AerodactylPicFront:: INCBIN "pic/bmon/aerodactyl.pic" -AerodactylPicBack:: INCBIN "pic/monback/aerodactylb.pic" -MagnemitePicFront:: INCBIN "pic/bmon/magnemite.pic" -MagnemitePicBack:: INCBIN "pic/monback/magnemiteb.pic" -CharmanderPicFront:: INCBIN "pic/bmon/charmander.pic" -CharmanderPicBack:: INCBIN "pic/monback/charmanderb.pic" -SquirtlePicFront:: INCBIN "pic/bmon/squirtle.pic" -SquirtlePicBack:: INCBIN "pic/monback/squirtleb.pic" -CharmeleonPicFront:: INCBIN "pic/bmon/charmeleon.pic" -CharmeleonPicBack:: INCBIN "pic/monback/charmeleonb.pic" -WartortlePicFront:: INCBIN "pic/bmon/wartortle.pic" -WartortlePicBack:: INCBIN "pic/monback/wartortleb.pic" -CharizardPicFront:: INCBIN "pic/bmon/charizard.pic" -CharizardPicBack:: INCBIN "pic/monback/charizardb.pic" -FossilAerodactylPic:: INCBIN "pic/bmon/fossilaerodactyl.pic" -GhostPic:: INCBIN "pic/other/ghost.pic" -OddishPicFront:: INCBIN "pic/bmon/oddish.pic" -OddishPicBack:: INCBIN "pic/monback/oddishb.pic" -GloomPicFront:: INCBIN "pic/bmon/gloom.pic" -GloomPicBack:: INCBIN "pic/monback/gloomb.pic" -VileplumePicFront:: INCBIN "pic/bmon/vileplume.pic" -VileplumePicBack:: INCBIN "pic/monback/vileplumeb.pic" -BellsproutPicFront:: INCBIN "pic/bmon/bellsprout.pic" -BellsproutPicBack:: INCBIN "pic/monback/bellsproutb.pic" -WeepinbellPicFront:: INCBIN "pic/bmon/weepinbell.pic" -WeepinbellPicBack:: INCBIN "pic/monback/weepinbellb.pic" -VictreebelPicFront:: INCBIN "pic/bmon/victreebel.pic" -VictreebelPicBack:: INCBIN "pic/monback/victreebelb.pic" - - -SECTION "Battle (bank D)", ROMX, BANK[$D] +BulbasaurPicFront: INCBIN "pic/ymon/bulbasaur.pic" +BulbasaurPicBack: INCBIN "pic/monback/bulbasaurb.pic" +VenusaurPicFront: INCBIN "pic/ymon/venusaur.pic" +VenusaurPicBack: INCBIN "pic/monback/venusaurb.pic" +TentacruelPicFront: INCBIN "pic/ymon/tentacruel.pic" +TentacruelPicBack: INCBIN "pic/monback/tentacruelb.pic" +GoldeenPicFront: INCBIN "pic/ymon/goldeen.pic" +GoldeenPicBack: INCBIN "pic/monback/goldeenb.pic" +SeakingPicFront: INCBIN "pic/ymon/seaking.pic" +SeakingPicBack: INCBIN "pic/monback/seakingb.pic" +PonytaPicFront: INCBIN "pic/ymon/ponyta.pic" +RapidashPicFront: INCBIN "pic/ymon/rapidash.pic" +PonytaPicBack: INCBIN "pic/monback/ponytab.pic" +RapidashPicBack: INCBIN "pic/monback/rapidashb.pic" +RattataPicFront: INCBIN "pic/ymon/rattata.pic" +RattataPicBack: INCBIN "pic/monback/rattatab.pic" +RaticatePicFront: INCBIN "pic/ymon/raticate.pic" +RaticatePicBack: INCBIN "pic/monback/raticateb.pic" +NidorinoPicFront: INCBIN "pic/ymon/nidorino.pic" +NidorinoPicBack: INCBIN "pic/monback/nidorinob.pic" +NidorinaPicFront: INCBIN "pic/ymon/nidorina.pic" +NidorinaPicBack: INCBIN "pic/monback/nidorinab.pic" +GeodudePicFront: INCBIN "pic/ymon/geodude.pic" +GeodudePicBack: INCBIN "pic/monback/geodudeb.pic" +PorygonPicFront: INCBIN "pic/ymon/porygon.pic" +PorygonPicBack: INCBIN "pic/monback/porygonb.pic" +AerodactylPicFront: INCBIN "pic/ymon/aerodactyl.pic" +AerodactylPicBack: INCBIN "pic/monback/aerodactylb.pic" +MagnemitePicFront: INCBIN "pic/ymon/magnemite.pic" +MagnemitePicBack: INCBIN "pic/monback/magnemiteb.pic" +CharmanderPicFront: INCBIN "pic/ymon/charmander.pic" +CharmanderPicBack: INCBIN "pic/monback/charmanderb.pic" +SquirtlePicFront: INCBIN "pic/ymon/squirtle.pic" +SquirtlePicBack: INCBIN "pic/monback/squirtleb.pic" +CharmeleonPicFront: INCBIN "pic/ymon/charmeleon.pic" +CharmeleonPicBack: INCBIN "pic/monback/charmeleonb.pic" +WartortlePicFront: INCBIN "pic/ymon/wartortle.pic" +WartortlePicBack: INCBIN "pic/monback/wartortleb.pic" +CharizardPicFront: INCBIN "pic/ymon/charizard.pic" +CharizardPicBack: INCBIN "pic/monback/charizardb.pic" +FossilAerodactylPic: INCBIN "pic/ymon/fossilaerodactyl.pic" +GhostPic: INCBIN "pic/other/ghost.pic" +OddishPicFront: INCBIN "pic/ymon/oddish.pic" +OddishPicBack: INCBIN "pic/monback/oddishb.pic" +GloomPicFront: INCBIN "pic/ymon/gloom.pic" +GloomPicBack: INCBIN "pic/monback/gloomb.pic" +VileplumePicFront: INCBIN "pic/ymon/vileplume.pic" +VileplumePicBack: INCBIN "pic/monback/vileplumeb.pic" +BellsproutPicFront: INCBIN "pic/ymon/bellsprout.pic" +BellsproutPicBack: INCBIN "pic/monback/bellsproutb.pic" +WeepinbellPicFront: INCBIN "pic/ymon/weepinbell.pic" +WeepinbellPicBack: INCBIN "pic/monback/weepinbellb.pic" +VictreebelPicFront: INCBIN "pic/ymon/victreebel.pic" +VictreebelPicBack: INCBIN "pic/monback/victreebelb.pic" INCLUDE "engine/titlescreen2.asm" -INCLUDE "engine/battle/link_battle_versus_text.asm" INCLUDE "engine/slot_machine.asm" -INCLUDE "engine/overworld/pewter_guys.asm" -INCLUDE "engine/multiply_divide.asm" INCLUDE "engine/game_corner_slots.asm" -SECTION "bankE",ROMX,BANK[$E] +SECTION "bank0E",ROMX,BANK[$0E] INCLUDE "data/moves.asm" BaseStats: INCLUDE "data/base_stats.asm" INCLUDE "data/cries.asm" -INCLUDE "engine/battle/unused_stats_functions.asm" -INCLUDE "engine/battle/scroll_draw_trainer_pic.asm" INCLUDE "engine/battle/trainer_ai.asm" INCLUDE "engine/battle/draw_hud_pokeball_gfx.asm" -TradingAnimationGraphics: - INCBIN "gfx/game_boy.norepeat.2bpp" +TradingAnimationGraphics: INCBIN "gfx/game_boy.norepeat.2bpp" INCBIN "gfx/link_cable.2bpp" TradingAnimationGraphicsEnd: @@ -5515,12 +846,9 @@ TradingAnimationGraphics2: TradingAnimationGraphics2End: INCLUDE "engine/evos_moves.asm" -INCLUDE "engine/battle/moveEffects/heal_effect.asm" -INCLUDE "engine/battle/moveEffects/transform_effect.asm" -INCLUDE "engine/battle/moveEffects/reflect_light_screen_effect.asm" -SECTION "bankF",ROMX,BANK[$F] +SECTION "bank0F",ROMX,BANK[$0F] INCLUDE "engine/battle/core.asm" @@ -5528,9 +856,11 @@ INCLUDE "engine/battle/core.asm" SECTION "bank10",ROMX,BANK[$10] INCLUDE "engine/menu/pokedex.asm" +INCLUDE "engine/overworld/emotion_bubbles.asm" INCLUDE "engine/trade.asm" INCLUDE "engine/intro.asm" INCLUDE "engine/trade2.asm" +INCLUDE "engine/menu/options.asm" SECTION "bank11",ROMX,BANK[$11] @@ -5538,9 +868,7 @@ SECTION "bank11",ROMX,BANK[$11] INCLUDE "data/mapHeaders/lavendertown.asm" INCLUDE "data/mapObjects/lavendertown.asm" LavenderTownBlocks: INCBIN "maps/lavendertown.blk" - ViridianPokecenterBlocks: INCBIN "maps/viridianpokecenter.blk" - SafariZoneRestHouse1Blocks: SafariZoneRestHouse2Blocks: SafariZoneRestHouse3Blocks: @@ -5554,6 +882,11 @@ INCLUDE "data/mapHeaders/viridianpokecenter.asm" INCLUDE "scripts/viridianpokecenter.asm" INCLUDE "data/mapObjects/viridianpokecenter.asm" +INCLUDE "data/mapHeaders/celadonmart1.asm" +INCLUDE "scripts/celadonmart1.asm" +INCLUDE "data/mapObjects/celadonmart1.asm" +CeladonMart1Blocks: INCBIN "maps/celadonmart1.blk" + INCLUDE "data/mapHeaders/mansion1.asm" INCLUDE "scripts/mansion1.asm" INCLUDE "data/mapObjects/mansion1.asm" @@ -5675,31 +1008,25 @@ INCLUDE "scripts/seafoamislands5.asm" INCLUDE "data/mapObjects/seafoamislands5.asm" SeafoamIslands5Blocks: INCBIN "maps/seafoamislands5.blk" -INCLUDE "engine/overworld/hidden_objects.asm" +INCLUDE "engine/overworld/dungeon_warps.asm" SECTION "bank12",ROMX,BANK[$12] INCLUDE "data/mapHeaders/route7.asm" INCLUDE "data/mapObjects/route7.asm" -Route7Blocks: INCBIN "maps/route7.blk" - -CeladonPokecenterBlocks: +Route7Blocks: INCBIN "maps/route7.blk" ; 48051 +MtMoonPokecenterBlocks: RockTunnelPokecenterBlocks: -MtMoonPokecenterBlocks: INCBIN "maps/mtmoonpokecenter.blk" - -Route18GateBlocks: +CeladonPokecenterBlocks: INCBIN "maps/mtmoonpokecenter.blk" +Route11GateBlocks: Route15GateBlocks: -Route11GateBlocks: INCBIN "maps/route11gate.blk" - -Route18GateUpstairsBlocks: -Route16GateUpstairsBlocks: +Route18GateBlocks: INCBIN "maps/route11gate.blk" +Route11GateUpstairsBlocks: Route12GateUpstairsBlocks: Route15GateUpstairsBlocks: -Route11GateUpstairsBlocks: INCBIN "maps/route11gateupstairs.blk" - -INCLUDE "engine/predefs12.asm" - +Route16GateUpstairsBlocks: +Route18GateUpstairsBlocks: INCBIN "maps/route11gateupstairs.blk" INCLUDE "scripts/route7.asm" INCLUDE "data/mapHeaders/redshouse1f.asm" @@ -5845,6 +1172,7 @@ INCLUDE "data/mapHeaders/mtmoon3.asm" INCLUDE "scripts/mtmoon3.asm" INCLUDE "data/mapObjects/mtmoon3.asm" MtMoon3Blocks: INCBIN "maps/mtmoon3.blk" +INCLUDE "scripts/mtmoon3_2.asm" INCLUDE "data/mapHeaders/safarizonewest.asm" INCLUDE "scripts/safarizonewest.asm" @@ -5859,75 +1187,75 @@ SafariZoneSecretHouseBlocks: INCBIN "maps/safarizonesecrethouse.blk" SECTION "bank13",ROMX,BANK[$13] -TrainerPics:: -YoungsterPic:: INCBIN "pic/trainer/youngster.pic" -BugCatcherPic:: INCBIN "pic/trainer/bugcatcher.pic" -LassPic:: INCBIN "pic/trainer/lass.pic" -SailorPic:: INCBIN "pic/trainer/sailor.pic" -JrTrainerMPic:: INCBIN "pic/trainer/jr.trainerm.pic" -JrTrainerFPic:: INCBIN "pic/trainer/jr.trainerf.pic" -PokemaniacPic:: INCBIN "pic/trainer/pokemaniac.pic" -SuperNerdPic:: INCBIN "pic/trainer/supernerd.pic" -HikerPic:: INCBIN "pic/trainer/hiker.pic" -BikerPic:: INCBIN "pic/trainer/biker.pic" -BurglarPic:: INCBIN "pic/trainer/burglar.pic" -EngineerPic:: INCBIN "pic/trainer/engineer.pic" -FisherPic:: INCBIN "pic/trainer/fisher.pic" -SwimmerPic:: INCBIN "pic/trainer/swimmer.pic" -CueBallPic:: INCBIN "pic/trainer/cueball.pic" -GamblerPic:: INCBIN "pic/trainer/gambler.pic" -BeautyPic:: INCBIN "pic/trainer/beauty.pic" -PsychicPic:: INCBIN "pic/trainer/psychic.pic" -RockerPic:: INCBIN "pic/trainer/rocker.pic" -JugglerPic:: INCBIN "pic/trainer/juggler.pic" -TamerPic:: INCBIN "pic/trainer/tamer.pic" -BirdKeeperPic:: INCBIN "pic/trainer/birdkeeper.pic" -BlackbeltPic:: INCBIN "pic/trainer/blackbelt.pic" -Rival1Pic:: INCBIN "pic/trainer/rival1.pic" -ProfOakPic:: INCBIN "pic/trainer/prof.oak.pic" -ChiefPic:: -ScientistPic:: INCBIN "pic/trainer/scientist.pic" -GiovanniPic:: INCBIN "pic/trainer/giovanni.pic" -RocketPic:: INCBIN "pic/trainer/rocket.pic" -CooltrainerMPic:: INCBIN "pic/trainer/cooltrainerm.pic" -CooltrainerFPic:: INCBIN "pic/trainer/cooltrainerf.pic" -BrunoPic:: INCBIN "pic/trainer/bruno.pic" -BrockPic:: INCBIN "pic/trainer/brock.pic" -MistyPic:: INCBIN "pic/trainer/misty.pic" -LtSurgePic:: INCBIN "pic/trainer/lt.surge.pic" -ErikaPic:: INCBIN "pic/trainer/erika.pic" -KogaPic:: INCBIN "pic/trainer/koga.pic" -BlainePic:: INCBIN "pic/trainer/blaine.pic" -SabrinaPic:: INCBIN "pic/trainer/sabrina.pic" -GentlemanPic:: INCBIN "pic/trainer/gentleman.pic" -Rival2Pic:: INCBIN "pic/trainer/rival2.pic" -Rival3Pic:: INCBIN "pic/trainer/rival3.pic" -LoreleiPic:: INCBIN "pic/trainer/lorelei.pic" -ChannelerPic:: INCBIN "pic/trainer/channeler.pic" -AgathaPic:: INCBIN "pic/trainer/agatha.pic" -LancePic:: INCBIN "pic/trainer/lance.pic" +TrainerPics: +YoungsterPic: INCBIN "pic/trainer/youngster.pic" +BugCatcherPic: INCBIN "pic/trainer/bugcatcher.pic" +LassPic: INCBIN "pic/trainer/lass.pic" +SailorPic: INCBIN "pic/trainer/sailor.pic" +JrTrainerMPic: INCBIN "pic/trainer/jr.trainerm.pic" +JrTrainerFPic: INCBIN "pic/trainer/jr.trainerf.pic" +PokemaniacPic: INCBIN "pic/trainer/pokemaniac.pic" +SuperNerdPic: INCBIN "pic/trainer/supernerd.pic" +HikerPic: INCBIN "pic/trainer/hiker.pic" +BikerPic: INCBIN "pic/trainer/biker.pic" +BurglarPic: INCBIN "pic/trainer/burglar.pic" +EngineerPic: INCBIN "pic/trainer/engineer.pic" +FisherPic: INCBIN "pic/trainer/fisher.pic" +SwimmerPic: INCBIN "pic/trainer/swimmer.pic" +CueBallPic: INCBIN "pic/trainer/cueball.pic" +GamblerPic: INCBIN "pic/trainer/gambler.pic" +BeautyPic: INCBIN "pic/trainer/beauty.pic" +PsychicPic: INCBIN "pic/trainer/psychic.pic" +RockerPic: INCBIN "pic/trainer/rocker.pic" +JugglerPic: INCBIN "pic/trainer/juggler.pic" +TamerPic: INCBIN "pic/trainer/tamer.pic" +BirdKeeperPic: INCBIN "pic/trainer/birdkeeper.pic" +BlackbeltPic: INCBIN "pic/trainer/blackbelt.pic" +Rival1Pic: INCBIN "pic/ytrainer/rival1.pic" +ProfOakPic: INCBIN "pic/trainer/prof.oak.pic" +ChiefPic: +ScientistPic: INCBIN "pic/trainer/scientist.pic" +GiovanniPic: INCBIN "pic/trainer/giovanni.pic" +RocketPic: INCBIN "pic/trainer/rocket.pic" +CooltrainerMPic: INCBIN "pic/trainer/cooltrainerm.pic" +CooltrainerFPic: INCBIN "pic/trainer/cooltrainerf.pic" +BrunoPic: INCBIN "pic/trainer/bruno.pic" +BrockPic: INCBIN "pic/ytrainer/brock.pic" +MistyPic: INCBIN "pic/ytrainer/misty.pic" +LtSurgePic: INCBIN "pic/trainer/lt.surge.pic" +ErikaPic: INCBIN "pic/ytrainer/erika.pic" +KogaPic: INCBIN "pic/trainer/koga.pic" +BlainePic: INCBIN "pic/trainer/blaine.pic" +SabrinaPic: INCBIN "pic/trainer/sabrina.pic" +GentlemanPic: INCBIN "pic/trainer/gentleman.pic" +Rival2Pic: INCBIN "pic/ytrainer/rival2.pic" +Rival3Pic: INCBIN "pic/ytrainer/rival3.pic" +LoreleiPic: INCBIN "pic/trainer/lorelei.pic" +ChannelerPic: INCBIN "pic/trainer/channeler.pic" +AgathaPic: INCBIN "pic/trainer/agatha.pic" +LancePic: INCBIN "pic/trainer/lance.pic" +JessieJamesPic: INCBIN "pic/ytrainer/jessiejames.pic" + +; 4fe79 (13:7e79) INCLUDE "data/mapHeaders/tradecenter.asm" INCLUDE "scripts/tradecenter.asm" INCLUDE "data/mapObjects/tradecenter.asm" TradeCenterBlocks: INCBIN "maps/tradecenter.blk" +; 4fee6 (13:7ee6) + INCLUDE "data/mapHeaders/colosseum.asm" INCLUDE "scripts/colosseum.asm" INCLUDE "data/mapObjects/colosseum.asm" ColosseumBlocks: INCBIN "maps/colosseum.blk" -INCLUDE "engine/give_pokemon.asm" - -INCLUDE "engine/predefs.asm" - SECTION "bank14",ROMX,BANK[$14] INCLUDE "data/mapHeaders/route22.asm" INCLUDE "data/mapObjects/route22.asm" Route22Blocks: INCBIN "maps/route22.blk" - INCLUDE "data/mapHeaders/route20.asm" INCLUDE "data/mapObjects/route20.asm" Route20Blocks: INCBIN "maps/route20.blk" @@ -5938,22 +1266,22 @@ Route23Blocks: INCBIN "maps/route23.blk" INCLUDE "data/mapHeaders/route24.asm" INCLUDE "data/mapObjects/route24.asm" -Route24Blocks: INCBIN "maps/route24.blk" +Route24Blocks: INCBIN "maps/route24.blk" ; 506ed (14:46ed) INCLUDE "data/mapHeaders/route25.asm" INCLUDE "data/mapObjects/route25.asm" -Route25Blocks: INCBIN "maps/route25.blk" +Route25Blocks: INCBIN "maps/route25.blk" ; 50816 (14:4816) +; indigoplateau INCLUDE "data/mapHeaders/indigoplateau.asm" INCLUDE "scripts/indigoplateau.asm" INCLUDE "data/mapObjects/indigoplateau.asm" -IndigoPlateauBlocks: INCBIN "maps/indigoplateau.blk" +IndigoPlateauBlocks: INCBIN "maps/indigoplateau.blk" ; 50950 (14:4950) INCLUDE "data/mapHeaders/saffroncity.asm" INCLUDE "data/mapObjects/saffroncity.asm" -SaffronCityBlocks: INCBIN "maps/saffroncity.blk" +SaffronCityBlocks: INCBIN "maps/saffroncity.blk" ; 50a98 (14:4a98) INCLUDE "scripts/saffroncity.asm" - INCLUDE "scripts/route20.asm" INCLUDE "scripts/route22.asm" INCLUDE "scripts/route23.asm" @@ -5990,9 +1318,6 @@ INCLUDE "scripts/mansion4.asm" INCLUDE "data/mapObjects/mansion4.asm" Mansion4Blocks: INCBIN "maps/mansion4.blk" -INCLUDE "engine/battle/init_battle_variables.asm" -INCLUDE "engine/battle/moveEffects/paralyze_effect.asm" - INCLUDE "engine/overworld/card_key.asm" INCLUDE "engine/menu/prize_menu.asm" @@ -6004,23 +1329,23 @@ SECTION "bank15",ROMX,BANK[$15] INCLUDE "data/mapHeaders/route2.asm" INCLUDE "data/mapObjects/route2.asm" -Route2Blocks: INCBIN "maps/route2.blk" +Route2Blocks: INCBIN "maps/route2.blk" ; 54086 INCLUDE "data/mapHeaders/route3.asm" INCLUDE "data/mapObjects/route3.asm" -Route3Blocks: INCBIN "maps/route3.blk" +Route3Blocks: INCBIN "maps/route3.blk" ; 5425d INCLUDE "data/mapHeaders/route4.asm" INCLUDE "data/mapObjects/route4.asm" -Route4Blocks: INCBIN "maps/route4.blk" +Route4Blocks: INCBIN "maps/route4.blk" ; 543f4 INCLUDE "data/mapHeaders/route5.asm" INCLUDE "data/mapObjects/route5.asm" -Route5Blocks: INCBIN "maps/route5.blk" +Route5Blocks: INCBIN "maps/route5.blk" ; 545da INCLUDE "data/mapHeaders/route9.asm" INCLUDE "data/mapObjects/route9.asm" -Route9Blocks: INCBIN "maps/route9.blk" +Route9Blocks: INCBIN "maps/route9.blk" ; 54706 INCLUDE "data/mapHeaders/route13.asm" INCLUDE "data/mapObjects/route13.asm" @@ -6040,12 +1365,11 @@ Route19Blocks: INCBIN "maps/route19.blk" INCLUDE "data/mapHeaders/route21.asm" INCLUDE "data/mapObjects/route21.asm" -Route21Blocks: INCBIN "maps/route21.blk" +Route21Blocks: INCBIN "maps/route21.blk" ; 5507d +DayCareMBlocks: VermilionHouse2Blocks: -Route12HouseBlocks: -DayCareMBlocks: INCBIN "maps/daycarem.blk" - +Route12HouseBlocks: INCBIN "maps/daycarem.blk" FuchsiaHouse3Blocks: INCBIN "maps/fuchsiahouse3.blk" INCLUDE "engine/battle/experience.asm" @@ -6087,7 +1411,7 @@ INCLUDE "scripts/silphco8.asm" INCLUDE "data/mapObjects/silphco8.asm" SilphCo8Blocks: INCBIN "maps/silphco8.blk" -INCLUDE "engine/menu/diploma.asm" +INCLUDE "engine/menu/diploma_1.asm" INCLUDE "engine/overworld/trainers.asm" @@ -6096,11 +1420,11 @@ SECTION "bank16",ROMX,BANK[$16] INCLUDE "data/mapHeaders/route6.asm" INCLUDE "data/mapObjects/route6.asm" -Route6Blocks: INCBIN "maps/route6.blk" +Route6Blocks: INCBIN "maps/route6.blk" ; 58079 INCLUDE "data/mapHeaders/route8.asm" INCLUDE "data/mapObjects/route8.asm" -Route8Blocks: INCBIN "maps/route8.blk" +Route8Blocks: INCBIN "maps/route8.blk" ; 581c6 INCLUDE "data/mapHeaders/route10.asm" INCLUDE "data/mapObjects/route10.asm" @@ -6108,7 +1432,7 @@ Route10Blocks: INCBIN "maps/route10.blk" INCLUDE "data/mapHeaders/route11.asm" INCLUDE "data/mapObjects/route11.asm" -Route11Blocks: INCBIN "maps/route11.blk" +Route11Blocks: INCBIN "maps/route11.blk" ; 5855f INCLUDE "data/mapHeaders/route12.asm" INCLUDE "data/mapObjects/route12.asm" @@ -6120,18 +1444,18 @@ Route15Blocks: INCBIN "maps/route15.blk" INCLUDE "data/mapHeaders/route16.asm" INCLUDE "data/mapObjects/route16.asm" -Route16Blocks: INCBIN "maps/route16.blk" +Route16Blocks: INCBIN "maps/route16.blk" ; 58b84 INCLUDE "data/mapHeaders/route18.asm" INCLUDE "data/mapObjects/route18.asm" Route18Blocks: INCBIN "maps/route18.blk" - INCBIN "maps/unusedblocks58d7d.blk" - -INCLUDE "engine/battle/common_text.asm" +INCBIN "maps/unusedblocks58d7d.blk" INCLUDE "engine/experience.asm" +INCLUDE "engine/status_ailments.asm" + INCLUDE "engine/overworld/oaks_aide.asm" INCLUDE "scripts/route6.asm" @@ -6146,69 +1470,57 @@ INCLUDE "scripts/route18.asm" INCLUDE "data/mapHeaders/fanclub.asm" INCLUDE "scripts/fanclub.asm" INCLUDE "data/mapObjects/fanclub.asm" -FanClubBlocks: - INCBIN "maps/fanclub.blk" +FanClubBlocks: INCBIN "maps/fanclub.blk" INCLUDE "data/mapHeaders/silphco2.asm" INCLUDE "scripts/silphco2.asm" INCLUDE "data/mapObjects/silphco2.asm" -SilphCo2Blocks: - INCBIN "maps/silphco2.blk" +SilphCo2Blocks: INCBIN "maps/silphco2.blk" INCLUDE "data/mapHeaders/silphco3.asm" INCLUDE "scripts/silphco3.asm" INCLUDE "data/mapObjects/silphco3.asm" -SilphCo3Blocks: - INCBIN "maps/silphco3.blk" +SilphCo3Blocks: INCBIN "maps/silphco3.blk" INCLUDE "data/mapHeaders/silphco10.asm" INCLUDE "scripts/silphco10.asm" INCLUDE "data/mapObjects/silphco10.asm" -SilphCo10Blocks: - INCBIN "maps/silphco10.blk" +SilphCo10Blocks: INCBIN "maps/silphco10.blk" INCLUDE "data/mapHeaders/lance.asm" INCLUDE "scripts/lance.asm" INCLUDE "data/mapObjects/lance.asm" -LanceBlocks: - INCBIN "maps/lance.blk" +LanceBlocks: INCBIN "maps/lance.blk" INCLUDE "data/mapHeaders/halloffameroom.asm" INCLUDE "scripts/halloffameroom.asm" INCLUDE "data/mapObjects/halloffameroom.asm" -HallofFameRoomBlocks: - INCBIN "maps/halloffameroom.blk" +HallofFameRoomBlocks: INCBIN "maps/halloffameroom.blk" INCLUDE "engine/overworld/saffron_guards.asm" SECTION "bank17",ROMX,BANK[$17] -SaffronMartBlocks: -LavenderMartBlocks: CeruleanMartBlocks: -VermilionMartBlocks: INCBIN "maps/vermilionmart.blk" - -CopycatsHouse2FBlocks: -RedsHouse2FBlocks: INCBIN "maps/redshouse2f.blk" - +VermilionMartBlocks: +LavenderMartBlocks: +SaffronMartBlocks: INCBIN "maps/ceruleanmart.blk" +RedsHouse2FBlocks: +CopycatsHouse2FBlocks: INCBIN "maps/redshouse2f.blk" Museum1FBlocks: INCBIN "maps/museum1f.blk" - Museum2FBlocks: INCBIN "maps/museum2f.blk" - -SaffronPokecenterBlocks: +PewterPokecenterBlocks: VermilionPokecenterBlocks: LavenderPokecenterBlocks: -PewterPokecenterBlocks: INCBIN "maps/pewterpokecenter.blk" - -UndergroundPathEntranceRoute7Blocks: -UndergroundPathEntranceRoute7CopyBlocks: +SaffronPokecenterBlocks: INCBIN "maps/pewterpokecenter.blk" +UndergroundPathEntranceRoute5Blocks: UndergroundPathEntranceRoute6Blocks: -UndergroundPathEntranceRoute5Blocks: INCBIN "maps/undergroundpathentranceroute5.blk" - -Route2GateBlocks: +UndergroundPathEntranceRoute7Blocks: +UndergroundPathEntranceRoute7CopyBlocks: INCBIN "maps/undergroundpathentranceroute5.blk" ViridianForestEntranceBlocks: -ViridianForestExitBlocks: INCBIN "maps/viridianforestexit.blk" +ViridianForestExitBlocks: +Route2GateBlocks: INCBIN "maps/viridianforestentrance.blk" INCLUDE "data/mapHeaders/redshouse2f.asm" INCLUDE "scripts/redshouse2f.asm" @@ -6333,6 +1645,8 @@ INCLUDE "scripts/victoryroad1.asm" INCLUDE "data/mapObjects/victoryroad1.asm" VictoryRoad1Blocks: INCBIN "maps/victoryroad1.blk" +INCLUDE "engine/evolution.asm" + INCLUDE "engine/predefs17_2.asm" INCLUDE "engine/hidden_object_functions17.asm" @@ -6340,14 +1654,14 @@ INCLUDE "engine/hidden_object_functions17.asm" SECTION "bank18",ROMX,BANK[$18] -ViridianForestBlocks: INCBIN "maps/viridianforest.blk" +ViridianForestBlocks: INCBIN "maps/viridianforest.blk" UndergroundPathNSBlocks: INCBIN "maps/undergroundpathns.blk" UndergroundPathWEBlocks: INCBIN "maps/undergroundpathwe.blk" - INCBIN "maps/unusedblocks60258.blk" +INCBIN "maps/unusedblocks60258.blk" -SSAnne10Blocks: -SSAnne9Blocks: INCBIN "maps/ssanne9.blk" +SSAnne9Blocks: +SSAnne10Blocks: INCBIN "maps/ssanne9.blk" INCLUDE "data/mapHeaders/pokemontower1.asm" INCLUDE "scripts/pokemontower1.asm" @@ -6379,18 +1693,13 @@ INCLUDE "scripts/pokemontower6.asm" INCLUDE "data/mapObjects/pokemontower6.asm" PokemonTower6Blocks: INCBIN "maps/pokemontower6.blk" - INCBIN "maps/unusedblocks60cef.blk" +INCBIN "maps/unusedblocks60cef.blk" INCLUDE "data/mapHeaders/pokemontower7.asm" INCLUDE "scripts/pokemontower7.asm" INCLUDE "data/mapObjects/pokemontower7.asm" PokemonTower7Blocks: INCBIN "maps/pokemontower7.blk" -INCLUDE "data/mapHeaders/celadonmart1.asm" -INCLUDE "scripts/celadonmart1.asm" -INCLUDE "data/mapObjects/celadonmart1.asm" -CeladonMart1Blocks: INCBIN "maps/celadonmart1.blk" - INCLUDE "engine/overworld/cinnabar_lab.asm" INCLUDE "data/mapHeaders/viridianforest.asm" @@ -6463,20 +1772,18 @@ INCLUDE "engine/hidden_object_functions18.asm" SECTION "bank19",ROMX,BANK[$19] -Overworld_GFX: INCBIN "gfx/tilesets/overworld.t2.2bpp" +Overworld_GFX: INCBIN "gfx/tilesets/overworld.2bpp" Overworld_Block: INCBIN "gfx/blocksets/overworld.bst" - RedsHouse1_GFX: -RedsHouse2_GFX: INCBIN "gfx/tilesets/reds_house.t7.2bpp" +RedsHouse2_GFX: INCBIN "gfx/tilesets/redshouse2.t7.2bpp" RedsHouse1_Block: -RedsHouse2_Block: INCBIN "gfx/blocksets/reds_house.bst" - +RedsHouse2_Block: INCBIN "gfx/blocksets/redshouse2.bst" House_GFX: INCBIN "gfx/tilesets/house.t2.2bpp" House_Block: INCBIN "gfx/blocksets/house.bst" Mansion_GFX: INCBIN "gfx/tilesets/mansion.t2.2bpp" Mansion_Block: INCBIN "gfx/blocksets/mansion.bst" -ShipPort_GFX: INCBIN "gfx/tilesets/ship_port.t2.2bpp" -ShipPort_Block: INCBIN "gfx/blocksets/ship_port.bst" +ShipPort_GFX: INCBIN "gfx/tilesets/shipport.t2.2bpp" +ShipPort_Block: INCBIN "gfx/blocksets/shipport.bst" Interior_GFX: INCBIN "gfx/tilesets/interior.t1.2bpp" Interior_Block: INCBIN "gfx/blocksets/interior.bst" Plateau_GFX: INCBIN "gfx/tilesets/plateau.t10.2bpp" @@ -6485,34 +1792,22 @@ Plateau_Block: INCBIN "gfx/blocksets/plateau.bst" SECTION "bank1A",ROMX,BANK[$1A] -INCLUDE "engine/battle/decrement_pp.asm" - -Version_GFX: -IF DEF(_RED) - INCBIN "gfx/red/redgreenversion.1bpp" ; 10 tiles -ENDC -IF DEF(_BLUE) - INCBIN "gfx/blue/blueversion.1bpp" ; 8 tiles -ENDC -Version_GFXEnd: +INCBIN "gfx/blueversion.1bpp" ; unused Dojo_GFX: Gym_GFX: INCBIN "gfx/tilesets/gym.2bpp" Dojo_Block: Gym_Block: INCBIN "gfx/blocksets/gym.bst" - Mart_GFX: Pokecenter_GFX: INCBIN "gfx/tilesets/pokecenter.2bpp" Mart_Block: Pokecenter_Block: INCBIN "gfx/blocksets/pokecenter.bst" - ForestGate_GFX: -Museum_GFX: -Gate_GFX: INCBIN "gfx/tilesets/gate.t1.2bpp" +Gate_GFX: +Museum_GFX: INCBIN "gfx/tilesets/museum.t1.2bpp" ForestGate_Block: -Museum_Block: -Gate_Block: INCBIN "gfx/blocksets/gate.bst" - +Gate_Block: +Museum_Block: INCBIN "gfx/blocksets/museum.bst" Forest_GFX: INCBIN "gfx/tilesets/forest.2bpp" Forest_Block: INCBIN "gfx/blocksets/forest.bst" Facility_GFX: INCBIN "gfx/tilesets/facility.2bpp" @@ -6555,23 +1850,14 @@ INCLUDE "engine/save.asm" SECTION "bank1D",ROMX,BANK[$1D] CopycatsHouse1FBlocks: INCBIN "maps/copycatshouse1f.blk" - -CinnabarMartBlocks: -PewterMartBlocks: INCBIN "maps/pewtermart.blk" - +PewterMartBlocks: +CinnabarMartBlocks: INCBIN "maps/pewtermart.blk" FuchsiaHouse1Blocks: INCBIN "maps/fuchsiahouse1.blk" - -CinnabarPokecenterBlocks: -FuchsiaPokecenterBlocks: INCBIN "maps/fuchsiapokecenter.blk" - +FuchsiaPokecenterBlocks: +CinnabarPokecenterBlocks: INCBIN "maps/fuchsiapokecenter.blk" CeruleanHouse2Blocks: INCBIN "maps/ceruleanhouse2.blk" -INCLUDE "engine/HoF_room_pc.asm" - -INCLUDE "engine/status_ailments.asm" - INCLUDE "engine/items/itemfinder.asm" - INCLUDE "scripts/ceruleancity2.asm" INCLUDE "data/mapHeaders/viridiangym.asm" @@ -6608,9 +1894,9 @@ INCLUDE "data/mapObjects/fuchsiahouse2.asm" FuchsiaHouse2Blocks: INCBIN "maps/fuchsiahouse2.blk" INCLUDE "data/mapHeaders/safarizoneentrance.asm" -INCLUDE "scripts/safarizoneentrance.asm" INCLUDE "data/mapObjects/safarizoneentrance.asm" SafariZoneEntranceBlocks: INCBIN "maps/safarizoneentrance.blk" +INCLUDE "scripts/safarizoneentrance.asm" INCLUDE "data/mapHeaders/fuchsiagym.asm" INCLUDE "scripts/fuchsiagym.asm" @@ -6626,6 +1912,7 @@ INCLUDE "data/mapHeaders/cinnabargym.asm" INCLUDE "scripts/cinnabargym.asm" INCLUDE "data/mapObjects/cinnabargym.asm" CinnabarGymBlocks: INCBIN "maps/cinnabargym.blk" +INCLUDE "scripts/cinnabargym2.asm" INCLUDE "data/mapHeaders/lab1.asm" INCLUDE "scripts/lab1.asm" @@ -6681,6 +1968,8 @@ AgathaBlocks: INCBIN "maps/agatha.blk" INCLUDE "engine/menu/league_pc.asm" +INCLUDE "engine/overworld/elevator.asm" + INCLUDE "engine/overworld/hidden_items.asm" @@ -6699,8 +1988,167 @@ RedFishingRodTiles: INCBIN "gfx/red_fishingrod_tiles.2bpp" INCLUDE "data/animations.asm" -INCLUDE "engine/evolution.asm" -INCLUDE "engine/overworld/elevator.asm" +SECTION "bank2f",ROMX[$5000],BANK[$2F] + +INCLUDE "engine/bg_map_attributes.asm" + + +SECTION "bank30",ROMX,BANK[$30] + +; This whole bank is garbage data. +INCBIN "engine/bank30.bin" + + +SECTION "bank39",ROMX,BANK[$39] + +Pic_e4000: ; e4000 +INCBIN "gfx/pikachu/unknown_e4000.pic" +GFX_e40cc: ; e40cc +INCBIN "gfx/pikachu/unknown_e40cc.2bpp" +Pic_e411c: ; e411c +INCBIN "gfx/pikachu/unknown_e411c.pic" +GFX_e41d2: ; e41d2 +INCBIN "gfx/pikachu/unknown_e41d2.2bpp" +Pic_e4272: ; e4272 +INCBIN "gfx/pikachu/unknown_e4272.pic" +GFX_e4323: ; e4323 +INCBIN "gfx/pikachu/unknown_e4323.2bpp" +Pic_e4383: ; e4383 +INCBIN "gfx/pikachu/unknown_e4383.pic" +GFX_e444b: ; e444b +INCBIN "gfx/pikachu/unknown_e444b.2bpp" +Pic_e458b: ; e458b +INCBIN "gfx/pikachu/unknown_e458b.pic" +GFX_e463b: ; e463b +INCBIN "gfx/pikachu/unknown_e463b.2bpp" +Pic_e467b: ; e467b +INCBIN "gfx/pikachu/unknown_e467b.pic" +GFX_e472e: ; e472e +INCBIN "gfx/pikachu/unknown_e472e.2bpp" +Pic_e476e: ; e476e +INCBIN "gfx/pikachu/unknown_e476e.pic" +GFX_e4841: ; e4841 +INCBIN "gfx/pikachu/unknown_e4841.2bpp" +Pic_e49d1: ; e49d1 +INCBIN "gfx/pikachu/unknown_e49d1.pic" +GFX_e4a99: ; e4a99 +INCBIN "gfx/pikachu/unknown_e4a99.2bpp" +Pic_e4b39: ; e4b39 +INCBIN "gfx/pikachu/unknown_e4b39.pic" +GFX_e4bde: ; e4bde +INCBIN "gfx/pikachu/unknown_e4bde.2bpp" +Pic_e4c3e: ; e4c3e +INCBIN "gfx/pikachu/unknown_e4c3e.pic" +GFX_e4ce0: ; e4ce0 +INCBIN "gfx/pikachu/unknown_e4ce0.2bpp" +GFX_e4e70: ; e4e70 +INCBIN "gfx/pikachu/unknown_e4e70.2bpp" +Pic_e5000: ; e5000 +INCBIN "gfx/pikachu/unknown_e5000.pic" +GFX_e50af: ; e50af +INCBIN "gfx/pikachu/unknown_e50af.2bpp" +Pic_e523f: ; e523f +INCBIN "gfx/pikachu/unknown_e523f.pic" +GFX_e52fe: ; e52fe +INCBIN "gfx/pikachu/unknown_e52fe.2bpp" +Pic_e548e: ; e548e +INCBIN "gfx/pikachu/unknown_e548e.pic" +GFX_e5541: ; e5541 +INCBIN "gfx/pikachu/unknown_e5541.2bpp" +Pic_e56d1: ; e56d1 +INCBIN "gfx/pikachu/unknown_e56d1.pic" +GFX_e5794: ; e5794 +INCBIN "gfx/pikachu/unknown_e5794.2bpp" +Pic_e5924: ; e5924 +INCBIN "gfx/pikachu/unknown_e5924.pic" +GFX_e59ed: ; e59ed +INCBIN "gfx/pikachu/unknown_e59ed.2bpp" +Pic_e5b7d: ; e5b7d +INCBIN "gfx/pikachu/unknown_e5b7d.pic" +GFX_e5c4d: ; e5c4d +INCBIN "gfx/pikachu/unknown_e5c4d.2bpp" +Pic_e5ddd: ; e5ddd +INCBIN "gfx/pikachu/unknown_e5ddd.pic" +GFX_e5e90: ; e5e90 +INCBIN "gfx/pikachu/unknown_e5e90.2bpp" +GFX_e6020: ; e6020 +INCBIN "gfx/pikachu/unknown_e6020.2bpp" +GFX_e61b0: ; e61b0 +INCBIN "gfx/pikachu/unknown_e61b0.2bpp" +Pic_e6340: ; e6340 +INCBIN "gfx/pikachu/unknown_e6340.pic" +GFX_e63f7: ; e63f7 +INCBIN "gfx/pikachu/unknown_e63f7.2bpp" +Pic_e6587: ; e6587 +INCBIN "gfx/pikachu/unknown_e6587.pic" +GFX_e6646: ; e6646 +INCBIN "gfx/pikachu/unknown_e6646.2bpp" +Pic_e67d6: ; e67d6 +INCBIN "gfx/pikachu/unknown_e67d6.pic" +GFX_e682f: ; e682f +INCBIN "gfx/pikachu/unknown_e682f.2bpp" +GFX_e69bf: ; e69bf +INCBIN "gfx/pikachu/unknown_e69bf.2bpp" +GFX_e6b4f: ; e6b4f +INCBIN "gfx/pikachu/unknown_e6b4f.2bpp" +GFX_e6cdf: ; e6cdf +INCBIN "gfx/pikachu/unknown_e6cdf.2bpp" +GFX_e6e6f: ; e6e6f +INCBIN "gfx/pikachu/unknown_e6e6f.2bpp" +GFX_e6fff: ; e6fff +INCBIN "gfx/pikachu/unknown_e6fff.2bpp" +GFX_e718f: ; e718f +INCBIN "gfx/pikachu/unknown_e718f.2bpp" +GFX_e731f: ; e731f +INCBIN "gfx/pikachu/unknown_e731f.2bpp" +GFX_e74af: ; e74af +INCBIN "gfx/pikachu/unknown_e74af.2bpp" +GFX_e763f: ; e763f +INCBIN "gfx/pikachu/unknown_e763f.2bpp" +Pic_e77cf: ; e77cf +INCBIN "gfx/pikachu/unknown_e77cf.pic" +GFX_e7863: ; e7863 +INCBIN "gfx/pikachu/unknown_e7863.2bpp" +GFX_e79f3: ; e79f3 +INCBIN "gfx/pikachu/unknown_e79f3.2bpp" +GFX_e7b83: ; e7b83 +INCBIN "gfx/pikachu/unknown_e7b83.2bpp" +GFX_e7d13: ; e7d13 +INCBIN "gfx/pikachu/unknown_e7d13.2bpp" + + +SECTION "bank3A",ROMX,BANK[$3A] + +INCLUDE "text/monster_names.asm" + +INCLUDE "engine/overworld/is_player_just_outside_map.asm" + +INCLUDE "engine/printer.asm" +INCLUDE "engine/diploma_3a.asm" + +SurfingPikachu3Graphics: INCBIN "gfx/surfing_pikachu_3.t1.2bpp" +SurfingPikachu3GraphicsEnd: + +INCLUDE "engine/unknown_ea3ea.asm" + +INCLUDE "engine/overworld/npc_movement_2.asm" + +SECTION "bank3C",ROMX,BANK[$3C] + +INCLUDE "engine/bank3c.asm" + + +SECTION "bank3D",ROMX,BANK[$3D] + +INCLUDE "engine/bank3d.asm" + + +SECTION "bank3E",ROMX,BANK[$3E] + +INCLUDE "engine/bank3e.asm" + + +SECTION "bank3F",ROMX,BANK[$3F] -INCLUDE "engine/items/tm_prices.asm" +INCLUDE "engine/bank3f.asm" diff --git a/maps/beach_house.blk b/maps/beach_house.blk new file mode 100644 index 00000000..5bcdb58a --- /dev/null +++ b/maps/beach_house.blk @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/maps/celadongamecorner.blk b/maps/celadongamecorner.blk index 82fd0b61..8c8b1fd8 100644 --- a/maps/celadongamecorner.blk +++ b/maps/celadongamecorner.blk @@ -2,4 +2,4 @@ -4***C*///3 : : : :9!9!9!99!9!9!98!8!8!8 ()
\ No newline at end of file +4***C*///3 : : : :9!9!9!99!9!9!98!8!8!8 ()
\ No newline at end of file diff --git a/maps/celadongym.blk b/maps/celadongym.blk index dcecc50c..7ac1b683 100644 --- a/maps/celadongym.blk +++ b/maps/celadongym.blk @@ -1 +1 @@ -38:933<3=33;?>3344356344321
\ No newline at end of file +58:963<3=33;?>3344356344321
\ No newline at end of file diff --git a/maps/celadonhotel.blk b/maps/celadonhotel.blk index 07a8b781..d1399446 100644 --- a/maps/celadonhotel.blk +++ b/maps/celadonhotel.blk @@ -1,2 +1,2 @@ - +&
\ No newline at end of file diff --git a/maps/celadonpokecenter.blk b/maps/celadonpokecenter.blk index 9641efe4..dd54efd9 100644 --- a/maps/celadonpokecenter.blk +++ b/maps/celadonpokecenter.blk @@ -1,2 +1,2 @@ -
!"# +
'"#
\ No newline at end of file diff --git a/maps/ceruleanmart.blk b/maps/ceruleanmart.blk index 1da8fffc..62385406 100644 --- a/maps/ceruleanmart.blk +++ b/maps/ceruleanmart.blk @@ -1 +1 @@ -
\ No newline at end of file + %
\ No newline at end of file diff --git a/maps/ceruleanpokecenter.blk b/maps/ceruleanpokecenter.blk index 9641efe4..dd54efd9 100644 --- a/maps/ceruleanpokecenter.blk +++ b/maps/ceruleanpokecenter.blk @@ -1,2 +1,2 @@ -
!"# +
'"#
\ No newline at end of file diff --git a/maps/cinnabarmart.blk b/maps/cinnabarmart.blk index 1da8fffc..62385406 100644 --- a/maps/cinnabarmart.blk +++ b/maps/cinnabarmart.blk @@ -1 +1 @@ -
\ No newline at end of file + %
\ No newline at end of file diff --git a/maps/cinnabarpokecenter.blk b/maps/cinnabarpokecenter.blk index 9641efe4..dd54efd9 100644 --- a/maps/cinnabarpokecenter.blk +++ b/maps/cinnabarpokecenter.blk @@ -1,2 +1,2 @@ -
!"# +
'"#
\ No newline at end of file diff --git a/maps/fuchsiamart.blk b/maps/fuchsiamart.blk index 1da8fffc..62385406 100644 --- a/maps/fuchsiamart.blk +++ b/maps/fuchsiamart.blk @@ -1 +1 @@ -
\ No newline at end of file + %
\ No newline at end of file diff --git a/maps/fuchsiapokecenter.blk b/maps/fuchsiapokecenter.blk index 9641efe4..dd54efd9 100644 --- a/maps/fuchsiapokecenter.blk +++ b/maps/fuchsiapokecenter.blk @@ -1,2 +1,2 @@ -
!"# +
'"#
\ No newline at end of file diff --git a/maps/lavendermart.blk b/maps/lavendermart.blk index 1da8fffc..62385406 100644 --- a/maps/lavendermart.blk +++ b/maps/lavendermart.blk @@ -1 +1 @@ -
\ No newline at end of file + %
\ No newline at end of file diff --git a/maps/lavenderpokecenter.blk b/maps/lavenderpokecenter.blk index 9641efe4..dd54efd9 100644 --- a/maps/lavenderpokecenter.blk +++ b/maps/lavenderpokecenter.blk @@ -1,2 +1,2 @@ -
!"# +
'"#
\ No newline at end of file diff --git a/maps/mtmoonpokecenter.blk b/maps/mtmoonpokecenter.blk index 9641efe4..dd54efd9 100644 --- a/maps/mtmoonpokecenter.blk +++ b/maps/mtmoonpokecenter.blk @@ -1,2 +1,2 @@ -
!"# +
'"#
\ No newline at end of file diff --git a/maps/pewtermart.blk b/maps/pewtermart.blk index 1da8fffc..62385406 100644 --- a/maps/pewtermart.blk +++ b/maps/pewtermart.blk @@ -1 +1 @@ -
\ No newline at end of file + %
\ No newline at end of file diff --git a/maps/pewterpokecenter.blk b/maps/pewterpokecenter.blk index 9641efe4..dd54efd9 100644 --- a/maps/pewterpokecenter.blk +++ b/maps/pewterpokecenter.blk @@ -1,2 +1,2 @@ -
!"# +
'"#
\ No newline at end of file diff --git a/maps/rocktunnelpokecenter.blk b/maps/rocktunnelpokecenter.blk index 9641efe4..dd54efd9 100644 --- a/maps/rocktunnelpokecenter.blk +++ b/maps/rocktunnelpokecenter.blk @@ -1,2 +1,2 @@ -
!"# +
'"#
\ No newline at end of file diff --git a/maps/route19.blk b/maps/route19.blk index 0bd469e7..3fc58494 100644 --- a/maps/route19.blk +++ b/maps/route19.blk @@ -1 +1 @@ -(,)(,)(,)$W%$W%CCC11111CCk1111kkCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCkkkkkkkkk
\ No newline at end of file +(,)(,)(,)$W%$W%CCC11111CCC111CCk1111kkCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCkkkkkkkkk
\ No newline at end of file diff --git a/maps/route4.blk b/maps/route4.blk index cb6a6a74..11fefc62 100644 --- a/maps/route4.blk +++ b/maps/route4.blk @@ -61,4 +61,4 @@ N -,,)>??,,,,,,,,,,,?????????????????????;tt
\ No newline at end of file +,,)>??,,,,,,,,,,,?????????????????????;tt
\ No newline at end of file diff --git a/maps/saffronmart.blk b/maps/saffronmart.blk index 1da8fffc..62385406 100644 --- a/maps/saffronmart.blk +++ b/maps/saffronmart.blk @@ -1 +1 @@ -
\ No newline at end of file + %
\ No newline at end of file diff --git a/maps/saffronpokecenter.blk b/maps/saffronpokecenter.blk index 9641efe4..dd54efd9 100644 --- a/maps/saffronpokecenter.blk +++ b/maps/saffronpokecenter.blk @@ -1,2 +1,2 @@ -
!"# +
'"#
\ No newline at end of file diff --git a/maps/unknowndungeon1.blk b/maps/unknowndungeon1.blk index 574613af..7cc9d4d5 100644 --- a/maps/unknowndungeon1.blk +++ b/maps/unknowndungeon1.blk @@ -1,2 +1,3 @@ - "||b -}fN_vvvvvvvv#vvvvr}|qvv,-Xv=,vtfvvvfvf+}_ "vv- -
} "$
\ No newline at end of file + "b
^|bz qmf_fX +z'nn>}MMt "__ ">nzrfvvv_r " +^t "vv
"_ "_Onnvvvvvvvvvvvv$L
\ No newline at end of file diff --git a/maps/unknowndungeon2.blk b/maps/unknowndungeon2.blk index 6eb27eee..f82b5aed 100644 --- a/maps/unknowndungeon2.blk +++ b/maps/unknowndungeon2.blk @@ -1,3 +1,7 @@ -}( ((
-
-}(# ( }
\ No newline at end of file +
( ((
} + (#}( +
} +} + + +
\ No newline at end of file diff --git a/maps/unknowndungeon3.blk b/maps/unknowndungeon3.blk index 858f0529..581ade79 100644 --- a/maps/unknowndungeon3.blk +++ b/maps/unknowndungeon3.blk @@ -1 +1,2 @@ -,--Nr02a}f
D+,v
"pfvvv}fXfvv^tvvtvv)
"vvvSvvvv
\ No newline at end of file +
n z "
rf-j[o "nrfaXrO
"} +Qmn } "__rv "m
v}vvv)
r "vvQr)Svvvvvvvvvvvvr
\ No newline at end of file diff --git a/maps/unusedblocks58d7d.blk b/maps/unusedblocks58d7d.blk index 9641efe4..dd54efd9 100755 --- a/maps/unusedblocks58d7d.blk +++ b/maps/unusedblocks58d7d.blk @@ -1,2 +1,2 @@ -
!"# +
'"#
\ No newline at end of file diff --git a/maps/vermilionmart.blk b/maps/vermilionmart.blk index 1da8fffc..62385406 100644 --- a/maps/vermilionmart.blk +++ b/maps/vermilionmart.blk @@ -1 +1 @@ -
\ No newline at end of file + %
\ No newline at end of file diff --git a/maps/vermilionpokecenter.blk b/maps/vermilionpokecenter.blk index 9641efe4..dd54efd9 100644 --- a/maps/vermilionpokecenter.blk +++ b/maps/vermilionpokecenter.blk @@ -1,2 +1,2 @@ -
!"# +
'"#
\ No newline at end of file diff --git a/maps/viridianmart.blk b/maps/viridianmart.blk index 1da8fffc..62385406 100644 --- a/maps/viridianmart.blk +++ b/maps/viridianmart.blk @@ -1 +1 @@ -
\ No newline at end of file + %
\ No newline at end of file diff --git a/maps/viridianpokecenter.blk b/maps/viridianpokecenter.blk index 9641efe4..dd54efd9 100644 --- a/maps/viridianpokecenter.blk +++ b/maps/viridianpokecenter.blk @@ -1,2 +1,2 @@ -
!"# +
'"#
\ No newline at end of file diff --git a/pic/bmon/abra.png b/pic/bmon/abra.png Binary files differdeleted file mode 100644 index 12045ee3..00000000 --- a/pic/bmon/abra.png +++ /dev/null diff --git a/pic/bmon/aerodactyl.png b/pic/bmon/aerodactyl.png Binary files differdeleted file mode 100644 index 4cbfdeeb..00000000 --- a/pic/bmon/aerodactyl.png +++ /dev/null diff --git a/pic/bmon/alakazam.png b/pic/bmon/alakazam.png Binary files differdeleted file mode 100644 index 9c379b6a..00000000 --- a/pic/bmon/alakazam.png +++ /dev/null diff --git a/pic/bmon/arbok.png b/pic/bmon/arbok.png Binary files differdeleted file mode 100644 index bd8da001..00000000 --- a/pic/bmon/arbok.png +++ /dev/null diff --git a/pic/bmon/arcanine.png b/pic/bmon/arcanine.png Binary files differdeleted file mode 100644 index 5d25961d..00000000 --- a/pic/bmon/arcanine.png +++ /dev/null diff --git a/pic/bmon/articuno.png b/pic/bmon/articuno.png Binary files differdeleted file mode 100644 index 66986add..00000000 --- a/pic/bmon/articuno.png +++ /dev/null diff --git a/pic/bmon/beedrill.png b/pic/bmon/beedrill.png Binary files differdeleted file mode 100644 index 36b4a06f..00000000 --- a/pic/bmon/beedrill.png +++ /dev/null diff --git a/pic/bmon/bellsprout.png b/pic/bmon/bellsprout.png Binary files differdeleted file mode 100644 index e4fc5e18..00000000 --- a/pic/bmon/bellsprout.png +++ /dev/null diff --git a/pic/bmon/blastoise.png b/pic/bmon/blastoise.png Binary files differdeleted file mode 100644 index 2192b43a..00000000 --- a/pic/bmon/blastoise.png +++ /dev/null diff --git a/pic/bmon/bulbasaur.png b/pic/bmon/bulbasaur.png Binary files differdeleted file mode 100644 index a2a924c7..00000000 --- a/pic/bmon/bulbasaur.png +++ /dev/null diff --git a/pic/bmon/butterfree.png b/pic/bmon/butterfree.png Binary files differdeleted file mode 100644 index 8f1a69aa..00000000 --- a/pic/bmon/butterfree.png +++ /dev/null diff --git a/pic/bmon/caterpie.png b/pic/bmon/caterpie.png Binary files differdeleted file mode 100644 index 8e1a49dd..00000000 --- a/pic/bmon/caterpie.png +++ /dev/null diff --git a/pic/bmon/chansey.png b/pic/bmon/chansey.png Binary files differdeleted file mode 100644 index 832ba27c..00000000 --- a/pic/bmon/chansey.png +++ /dev/null diff --git a/pic/bmon/charizard.png b/pic/bmon/charizard.png Binary files differdeleted file mode 100644 index ad29e489..00000000 --- a/pic/bmon/charizard.png +++ /dev/null diff --git a/pic/bmon/charmander.png b/pic/bmon/charmander.png Binary files differdeleted file mode 100644 index 12d16f01..00000000 --- a/pic/bmon/charmander.png +++ /dev/null diff --git a/pic/bmon/charmeleon.png b/pic/bmon/charmeleon.png Binary files differdeleted file mode 100644 index a5cff72f..00000000 --- a/pic/bmon/charmeleon.png +++ /dev/null diff --git a/pic/bmon/clefable.png b/pic/bmon/clefable.png Binary files differdeleted file mode 100644 index 2fcfac0a..00000000 --- a/pic/bmon/clefable.png +++ /dev/null diff --git a/pic/bmon/clefairy.png b/pic/bmon/clefairy.png Binary files differdeleted file mode 100644 index 5a7f3721..00000000 --- a/pic/bmon/clefairy.png +++ /dev/null diff --git a/pic/bmon/cloyster.png b/pic/bmon/cloyster.png Binary files differdeleted file mode 100644 index 71f63a7f..00000000 --- a/pic/bmon/cloyster.png +++ /dev/null diff --git a/pic/bmon/cubone.png b/pic/bmon/cubone.png Binary files differdeleted file mode 100644 index 23e3a23a..00000000 --- a/pic/bmon/cubone.png +++ /dev/null diff --git a/pic/bmon/dewgong.png b/pic/bmon/dewgong.png Binary files differdeleted file mode 100644 index aac4e65c..00000000 --- a/pic/bmon/dewgong.png +++ /dev/null diff --git a/pic/bmon/diglett.png b/pic/bmon/diglett.png Binary files differdeleted file mode 100644 index f92ae5bc..00000000 --- a/pic/bmon/diglett.png +++ /dev/null diff --git a/pic/bmon/ditto.png b/pic/bmon/ditto.png Binary files differdeleted file mode 100644 index 4485e6ec..00000000 --- a/pic/bmon/ditto.png +++ /dev/null diff --git a/pic/bmon/dodrio.png b/pic/bmon/dodrio.png Binary files differdeleted file mode 100644 index 92e6839d..00000000 --- a/pic/bmon/dodrio.png +++ /dev/null diff --git a/pic/bmon/doduo.png b/pic/bmon/doduo.png Binary files differdeleted file mode 100644 index 20cba7ba..00000000 --- a/pic/bmon/doduo.png +++ /dev/null diff --git a/pic/bmon/dragonair.png b/pic/bmon/dragonair.png Binary files differdeleted file mode 100644 index 55d1ef5b..00000000 --- a/pic/bmon/dragonair.png +++ /dev/null diff --git a/pic/bmon/dragonite.png b/pic/bmon/dragonite.png Binary files differdeleted file mode 100644 index 4c387c3e..00000000 --- a/pic/bmon/dragonite.png +++ /dev/null diff --git a/pic/bmon/dratini.png b/pic/bmon/dratini.png Binary files differdeleted file mode 100644 index 9df332e4..00000000 --- a/pic/bmon/dratini.png +++ /dev/null diff --git a/pic/bmon/drowzee.png b/pic/bmon/drowzee.png Binary files differdeleted file mode 100644 index cc85510b..00000000 --- a/pic/bmon/drowzee.png +++ /dev/null diff --git a/pic/bmon/dugtrio.png b/pic/bmon/dugtrio.png Binary files differdeleted file mode 100644 index 433f95ef..00000000 --- a/pic/bmon/dugtrio.png +++ /dev/null diff --git a/pic/bmon/eevee.png b/pic/bmon/eevee.png Binary files differdeleted file mode 100644 index 956f8ce0..00000000 --- a/pic/bmon/eevee.png +++ /dev/null diff --git a/pic/bmon/ekans.png b/pic/bmon/ekans.png Binary files differdeleted file mode 100644 index 6dffaf84..00000000 --- a/pic/bmon/ekans.png +++ /dev/null diff --git a/pic/bmon/electabuzz.png b/pic/bmon/electabuzz.png Binary files differdeleted file mode 100644 index 0ddccbe1..00000000 --- a/pic/bmon/electabuzz.png +++ /dev/null diff --git a/pic/bmon/electrode.png b/pic/bmon/electrode.png Binary files differdeleted file mode 100644 index 8df79e6a..00000000 --- a/pic/bmon/electrode.png +++ /dev/null diff --git a/pic/bmon/exeggcute.png b/pic/bmon/exeggcute.png Binary files differdeleted file mode 100644 index 0ddf8e32..00000000 --- a/pic/bmon/exeggcute.png +++ /dev/null diff --git a/pic/bmon/exeggutor.png b/pic/bmon/exeggutor.png Binary files differdeleted file mode 100644 index 89ccbdc4..00000000 --- a/pic/bmon/exeggutor.png +++ /dev/null diff --git a/pic/bmon/farfetchd.png b/pic/bmon/farfetchd.png Binary files differdeleted file mode 100644 index 490e2b7c..00000000 --- a/pic/bmon/farfetchd.png +++ /dev/null diff --git a/pic/bmon/fearow.png b/pic/bmon/fearow.png Binary files differdeleted file mode 100644 index c2c65257..00000000 --- a/pic/bmon/fearow.png +++ /dev/null diff --git a/pic/bmon/flareon.png b/pic/bmon/flareon.png Binary files differdeleted file mode 100644 index eadebd27..00000000 --- a/pic/bmon/flareon.png +++ /dev/null diff --git a/pic/bmon/gastly.png b/pic/bmon/gastly.png Binary files differdeleted file mode 100644 index 081b121d..00000000 --- a/pic/bmon/gastly.png +++ /dev/null diff --git a/pic/bmon/gengar.png b/pic/bmon/gengar.png Binary files differdeleted file mode 100644 index 450662d7..00000000 --- a/pic/bmon/gengar.png +++ /dev/null diff --git a/pic/bmon/geodude.png b/pic/bmon/geodude.png Binary files differdeleted file mode 100644 index 4202192a..00000000 --- a/pic/bmon/geodude.png +++ /dev/null diff --git a/pic/bmon/gloom.png b/pic/bmon/gloom.png Binary files differdeleted file mode 100644 index c2ea9ba4..00000000 --- a/pic/bmon/gloom.png +++ /dev/null diff --git a/pic/bmon/golbat.png b/pic/bmon/golbat.png Binary files differdeleted file mode 100644 index 6abc6f0a..00000000 --- a/pic/bmon/golbat.png +++ /dev/null diff --git a/pic/bmon/goldeen.png b/pic/bmon/goldeen.png Binary files differdeleted file mode 100644 index e8cbfddc..00000000 --- a/pic/bmon/goldeen.png +++ /dev/null diff --git a/pic/bmon/golduck.png b/pic/bmon/golduck.png Binary files differdeleted file mode 100644 index 5448f7c8..00000000 --- a/pic/bmon/golduck.png +++ /dev/null diff --git a/pic/bmon/golem.png b/pic/bmon/golem.png Binary files differdeleted file mode 100644 index 1dba6a67..00000000 --- a/pic/bmon/golem.png +++ /dev/null diff --git a/pic/bmon/graveler.png b/pic/bmon/graveler.png Binary files differdeleted file mode 100644 index 0d9da672..00000000 --- a/pic/bmon/graveler.png +++ /dev/null diff --git a/pic/bmon/grimer.png b/pic/bmon/grimer.png Binary files differdeleted file mode 100644 index 255b10b9..00000000 --- a/pic/bmon/grimer.png +++ /dev/null diff --git a/pic/bmon/growlithe.png b/pic/bmon/growlithe.png Binary files differdeleted file mode 100644 index b753bce7..00000000 --- a/pic/bmon/growlithe.png +++ /dev/null diff --git a/pic/bmon/gyarados.png b/pic/bmon/gyarados.png Binary files differdeleted file mode 100644 index a7ed0c17..00000000 --- a/pic/bmon/gyarados.png +++ /dev/null diff --git a/pic/bmon/haunter.png b/pic/bmon/haunter.png Binary files differdeleted file mode 100644 index 4d6c758d..00000000 --- a/pic/bmon/haunter.png +++ /dev/null diff --git a/pic/bmon/hitmonchan.png b/pic/bmon/hitmonchan.png Binary files differdeleted file mode 100644 index d8a6ffd3..00000000 --- a/pic/bmon/hitmonchan.png +++ /dev/null diff --git a/pic/bmon/hitmonlee.png b/pic/bmon/hitmonlee.png Binary files differdeleted file mode 100644 index 36042c68..00000000 --- a/pic/bmon/hitmonlee.png +++ /dev/null diff --git a/pic/bmon/horsea.png b/pic/bmon/horsea.png Binary files differdeleted file mode 100644 index cd28df8c..00000000 --- a/pic/bmon/horsea.png +++ /dev/null diff --git a/pic/bmon/hypno.png b/pic/bmon/hypno.png Binary files differdeleted file mode 100644 index e7434ea4..00000000 --- a/pic/bmon/hypno.png +++ /dev/null diff --git a/pic/bmon/ivysaur.png b/pic/bmon/ivysaur.png Binary files differdeleted file mode 100644 index dad10ae0..00000000 --- a/pic/bmon/ivysaur.png +++ /dev/null diff --git a/pic/bmon/jigglypuff.png b/pic/bmon/jigglypuff.png Binary files differdeleted file mode 100644 index a5475777..00000000 --- a/pic/bmon/jigglypuff.png +++ /dev/null diff --git a/pic/bmon/jolteon.png b/pic/bmon/jolteon.png Binary files differdeleted file mode 100644 index 7ecd6fbb..00000000 --- a/pic/bmon/jolteon.png +++ /dev/null diff --git a/pic/bmon/jynx.png b/pic/bmon/jynx.png Binary files differdeleted file mode 100644 index 583bd5da..00000000 --- a/pic/bmon/jynx.png +++ /dev/null diff --git a/pic/bmon/kabuto.png b/pic/bmon/kabuto.png Binary files differdeleted file mode 100644 index e8e44e15..00000000 --- a/pic/bmon/kabuto.png +++ /dev/null diff --git a/pic/bmon/kabutops.png b/pic/bmon/kabutops.png Binary files differdeleted file mode 100644 index 39fcb900..00000000 --- a/pic/bmon/kabutops.png +++ /dev/null diff --git a/pic/bmon/kadabra.png b/pic/bmon/kadabra.png Binary files differdeleted file mode 100644 index 36589440..00000000 --- a/pic/bmon/kadabra.png +++ /dev/null diff --git a/pic/bmon/kakuna.png b/pic/bmon/kakuna.png Binary files differdeleted file mode 100644 index ee350ffd..00000000 --- a/pic/bmon/kakuna.png +++ /dev/null diff --git a/pic/bmon/kangaskhan.png b/pic/bmon/kangaskhan.png Binary files differdeleted file mode 100644 index 1c0ba99c..00000000 --- a/pic/bmon/kangaskhan.png +++ /dev/null diff --git a/pic/bmon/kingler.png b/pic/bmon/kingler.png Binary files differdeleted file mode 100644 index b2bd7418..00000000 --- a/pic/bmon/kingler.png +++ /dev/null diff --git a/pic/bmon/koffing.png b/pic/bmon/koffing.png Binary files differdeleted file mode 100644 index 36961502..00000000 --- a/pic/bmon/koffing.png +++ /dev/null diff --git a/pic/bmon/krabby.png b/pic/bmon/krabby.png Binary files differdeleted file mode 100644 index b280e8db..00000000 --- a/pic/bmon/krabby.png +++ /dev/null diff --git a/pic/bmon/lapras.png b/pic/bmon/lapras.png Binary files differdeleted file mode 100644 index 822c00e9..00000000 --- a/pic/bmon/lapras.png +++ /dev/null diff --git a/pic/bmon/lickitung.png b/pic/bmon/lickitung.png Binary files differdeleted file mode 100644 index 050f7d23..00000000 --- a/pic/bmon/lickitung.png +++ /dev/null diff --git a/pic/bmon/machamp.png b/pic/bmon/machamp.png Binary files differdeleted file mode 100644 index c854a2cf..00000000 --- a/pic/bmon/machamp.png +++ /dev/null diff --git a/pic/bmon/machoke.png b/pic/bmon/machoke.png Binary files differdeleted file mode 100644 index 317dad96..00000000 --- a/pic/bmon/machoke.png +++ /dev/null diff --git a/pic/bmon/machop.png b/pic/bmon/machop.png Binary files differdeleted file mode 100644 index 63909c11..00000000 --- a/pic/bmon/machop.png +++ /dev/null diff --git a/pic/bmon/magikarp.png b/pic/bmon/magikarp.png Binary files differdeleted file mode 100644 index e71402f8..00000000 --- a/pic/bmon/magikarp.png +++ /dev/null diff --git a/pic/bmon/magmar.png b/pic/bmon/magmar.png Binary files differdeleted file mode 100644 index 9bc1d929..00000000 --- a/pic/bmon/magmar.png +++ /dev/null diff --git a/pic/bmon/magnemite.png b/pic/bmon/magnemite.png Binary files differdeleted file mode 100644 index f2254bed..00000000 --- a/pic/bmon/magnemite.png +++ /dev/null diff --git a/pic/bmon/magneton.png b/pic/bmon/magneton.png Binary files differdeleted file mode 100644 index 4d0f2cc7..00000000 --- a/pic/bmon/magneton.png +++ /dev/null diff --git a/pic/bmon/mankey.png b/pic/bmon/mankey.png Binary files differdeleted file mode 100644 index 303ce1f2..00000000 --- a/pic/bmon/mankey.png +++ /dev/null diff --git a/pic/bmon/marowak.png b/pic/bmon/marowak.png Binary files differdeleted file mode 100644 index b2d18437..00000000 --- a/pic/bmon/marowak.png +++ /dev/null diff --git a/pic/bmon/meowth.png b/pic/bmon/meowth.png Binary files differdeleted file mode 100644 index 0e706c35..00000000 --- a/pic/bmon/meowth.png +++ /dev/null diff --git a/pic/bmon/metapod.png b/pic/bmon/metapod.png Binary files differdeleted file mode 100644 index cbfa6e1e..00000000 --- a/pic/bmon/metapod.png +++ /dev/null diff --git a/pic/bmon/mew.png b/pic/bmon/mew.png Binary files differdeleted file mode 100644 index 7e25a96d..00000000 --- a/pic/bmon/mew.png +++ /dev/null diff --git a/pic/bmon/mewtwo.png b/pic/bmon/mewtwo.png Binary files differdeleted file mode 100644 index b7a31296..00000000 --- a/pic/bmon/mewtwo.png +++ /dev/null diff --git a/pic/bmon/moltres.png b/pic/bmon/moltres.png Binary files differdeleted file mode 100644 index 7c153998..00000000 --- a/pic/bmon/moltres.png +++ /dev/null diff --git a/pic/bmon/mr.mime.png b/pic/bmon/mr.mime.png Binary files differdeleted file mode 100644 index d9085ec6..00000000 --- a/pic/bmon/mr.mime.png +++ /dev/null diff --git a/pic/bmon/muk.png b/pic/bmon/muk.png Binary files differdeleted file mode 100644 index f69b83b7..00000000 --- a/pic/bmon/muk.png +++ /dev/null diff --git a/pic/bmon/nidoking.png b/pic/bmon/nidoking.png Binary files differdeleted file mode 100644 index 24330538..00000000 --- a/pic/bmon/nidoking.png +++ /dev/null diff --git a/pic/bmon/nidoqueen.png b/pic/bmon/nidoqueen.png Binary files differdeleted file mode 100644 index c0043e1b..00000000 --- a/pic/bmon/nidoqueen.png +++ /dev/null diff --git a/pic/bmon/nidoranf.png b/pic/bmon/nidoranf.png Binary files differdeleted file mode 100644 index 6b58b274..00000000 --- a/pic/bmon/nidoranf.png +++ /dev/null diff --git a/pic/bmon/nidoranm.png b/pic/bmon/nidoranm.png Binary files differdeleted file mode 100644 index 92d0cb49..00000000 --- a/pic/bmon/nidoranm.png +++ /dev/null diff --git a/pic/bmon/nidorina.png b/pic/bmon/nidorina.png Binary files differdeleted file mode 100644 index 68aca7c4..00000000 --- a/pic/bmon/nidorina.png +++ /dev/null diff --git a/pic/bmon/nidorino.png b/pic/bmon/nidorino.png Binary files differdeleted file mode 100644 index 795bf0c5..00000000 --- a/pic/bmon/nidorino.png +++ /dev/null diff --git a/pic/bmon/ninetales.png b/pic/bmon/ninetales.png Binary files differdeleted file mode 100644 index ed6bb398..00000000 --- a/pic/bmon/ninetales.png +++ /dev/null diff --git a/pic/bmon/oddish.png b/pic/bmon/oddish.png Binary files differdeleted file mode 100644 index e47dabe1..00000000 --- a/pic/bmon/oddish.png +++ /dev/null diff --git a/pic/bmon/omanyte.png b/pic/bmon/omanyte.png Binary files differdeleted file mode 100644 index bdfa5440..00000000 --- a/pic/bmon/omanyte.png +++ /dev/null diff --git a/pic/bmon/omastar.png b/pic/bmon/omastar.png Binary files differdeleted file mode 100644 index 3221d3d8..00000000 --- a/pic/bmon/omastar.png +++ /dev/null diff --git a/pic/bmon/onix.png b/pic/bmon/onix.png Binary files differdeleted file mode 100644 index 44a21a61..00000000 --- a/pic/bmon/onix.png +++ /dev/null diff --git a/pic/bmon/paras.png b/pic/bmon/paras.png Binary files differdeleted file mode 100644 index f4909bbd..00000000 --- a/pic/bmon/paras.png +++ /dev/null diff --git a/pic/bmon/parasect.png b/pic/bmon/parasect.png Binary files differdeleted file mode 100644 index 938bf53b..00000000 --- a/pic/bmon/parasect.png +++ /dev/null diff --git a/pic/bmon/persian.png b/pic/bmon/persian.png Binary files differdeleted file mode 100644 index cc15677a..00000000 --- a/pic/bmon/persian.png +++ /dev/null diff --git a/pic/bmon/pidgeot.png b/pic/bmon/pidgeot.png Binary files differdeleted file mode 100644 index 7daf609f..00000000 --- a/pic/bmon/pidgeot.png +++ /dev/null diff --git a/pic/bmon/pidgeotto.png b/pic/bmon/pidgeotto.png Binary files differdeleted file mode 100644 index c86b86f1..00000000 --- a/pic/bmon/pidgeotto.png +++ /dev/null diff --git a/pic/bmon/pidgey.png b/pic/bmon/pidgey.png Binary files differdeleted file mode 100644 index 70d9dd4a..00000000 --- a/pic/bmon/pidgey.png +++ /dev/null diff --git a/pic/bmon/pikachu.png b/pic/bmon/pikachu.png Binary files differdeleted file mode 100644 index 159e47e9..00000000 --- a/pic/bmon/pikachu.png +++ /dev/null diff --git a/pic/bmon/pinsir.png b/pic/bmon/pinsir.png Binary files differdeleted file mode 100644 index 320c79cb..00000000 --- a/pic/bmon/pinsir.png +++ /dev/null diff --git a/pic/bmon/poliwag.png b/pic/bmon/poliwag.png Binary files differdeleted file mode 100644 index 397d2e66..00000000 --- a/pic/bmon/poliwag.png +++ /dev/null diff --git a/pic/bmon/poliwhirl.png b/pic/bmon/poliwhirl.png Binary files differdeleted file mode 100644 index a7039145..00000000 --- a/pic/bmon/poliwhirl.png +++ /dev/null diff --git a/pic/bmon/poliwrath.png b/pic/bmon/poliwrath.png Binary files differdeleted file mode 100644 index f31d0680..00000000 --- a/pic/bmon/poliwrath.png +++ /dev/null diff --git a/pic/bmon/ponyta.png b/pic/bmon/ponyta.png Binary files differdeleted file mode 100644 index 4d8c1bee..00000000 --- a/pic/bmon/ponyta.png +++ /dev/null diff --git a/pic/bmon/porygon.png b/pic/bmon/porygon.png Binary files differdeleted file mode 100644 index ba3500c6..00000000 --- a/pic/bmon/porygon.png +++ /dev/null diff --git a/pic/bmon/primeape.png b/pic/bmon/primeape.png Binary files differdeleted file mode 100644 index 7c5a1a09..00000000 --- a/pic/bmon/primeape.png +++ /dev/null diff --git a/pic/bmon/psyduck.png b/pic/bmon/psyduck.png Binary files differdeleted file mode 100644 index 86772256..00000000 --- a/pic/bmon/psyduck.png +++ /dev/null diff --git a/pic/bmon/raichu.png b/pic/bmon/raichu.png Binary files differdeleted file mode 100644 index a29731e5..00000000 --- a/pic/bmon/raichu.png +++ /dev/null diff --git a/pic/bmon/rapidash.png b/pic/bmon/rapidash.png Binary files differdeleted file mode 100644 index 62d47506..00000000 --- a/pic/bmon/rapidash.png +++ /dev/null diff --git a/pic/bmon/raticate.png b/pic/bmon/raticate.png Binary files differdeleted file mode 100644 index 64340846..00000000 --- a/pic/bmon/raticate.png +++ /dev/null diff --git a/pic/bmon/rattata.png b/pic/bmon/rattata.png Binary files differdeleted file mode 100644 index 9b391cca..00000000 --- a/pic/bmon/rattata.png +++ /dev/null diff --git a/pic/bmon/rhydon.png b/pic/bmon/rhydon.png Binary files differdeleted file mode 100644 index 92406476..00000000 --- a/pic/bmon/rhydon.png +++ /dev/null diff --git a/pic/bmon/rhyhorn.png b/pic/bmon/rhyhorn.png Binary files differdeleted file mode 100644 index 9452b701..00000000 --- a/pic/bmon/rhyhorn.png +++ /dev/null diff --git a/pic/bmon/sandshrew.png b/pic/bmon/sandshrew.png Binary files differdeleted file mode 100644 index bcf52215..00000000 --- a/pic/bmon/sandshrew.png +++ /dev/null diff --git a/pic/bmon/sandslash.png b/pic/bmon/sandslash.png Binary files differdeleted file mode 100644 index 3b212a60..00000000 --- a/pic/bmon/sandslash.png +++ /dev/null diff --git a/pic/bmon/scyther.png b/pic/bmon/scyther.png Binary files differdeleted file mode 100644 index 3fe6eeae..00000000 --- a/pic/bmon/scyther.png +++ /dev/null diff --git a/pic/bmon/seadra.png b/pic/bmon/seadra.png Binary files differdeleted file mode 100644 index e8af292f..00000000 --- a/pic/bmon/seadra.png +++ /dev/null diff --git a/pic/bmon/seaking.png b/pic/bmon/seaking.png Binary files differdeleted file mode 100644 index ebe70c7e..00000000 --- a/pic/bmon/seaking.png +++ /dev/null diff --git a/pic/bmon/seel.png b/pic/bmon/seel.png Binary files differdeleted file mode 100644 index c4b2315a..00000000 --- a/pic/bmon/seel.png +++ /dev/null diff --git a/pic/bmon/shellder.png b/pic/bmon/shellder.png Binary files differdeleted file mode 100644 index cf44a7fe..00000000 --- a/pic/bmon/shellder.png +++ /dev/null diff --git a/pic/bmon/slowbro.png b/pic/bmon/slowbro.png Binary files differdeleted file mode 100644 index e61ad34b..00000000 --- a/pic/bmon/slowbro.png +++ /dev/null diff --git a/pic/bmon/slowpoke.png b/pic/bmon/slowpoke.png Binary files differdeleted file mode 100644 index fdf701d7..00000000 --- a/pic/bmon/slowpoke.png +++ /dev/null diff --git a/pic/bmon/snorlax.png b/pic/bmon/snorlax.png Binary files differdeleted file mode 100644 index 5b571a18..00000000 --- a/pic/bmon/snorlax.png +++ /dev/null diff --git a/pic/bmon/spearow.png b/pic/bmon/spearow.png Binary files differdeleted file mode 100644 index 835800a5..00000000 --- a/pic/bmon/spearow.png +++ /dev/null diff --git a/pic/bmon/squirtle.png b/pic/bmon/squirtle.png Binary files differdeleted file mode 100644 index bc0c9979..00000000 --- a/pic/bmon/squirtle.png +++ /dev/null diff --git a/pic/bmon/starmie.png b/pic/bmon/starmie.png Binary files differdeleted file mode 100644 index 24025ddf..00000000 --- a/pic/bmon/starmie.png +++ /dev/null diff --git a/pic/bmon/staryu.png b/pic/bmon/staryu.png Binary files differdeleted file mode 100644 index 394732e9..00000000 --- a/pic/bmon/staryu.png +++ /dev/null diff --git a/pic/bmon/tangela.png b/pic/bmon/tangela.png Binary files differdeleted file mode 100644 index eff9c5a5..00000000 --- a/pic/bmon/tangela.png +++ /dev/null diff --git a/pic/bmon/tauros.png b/pic/bmon/tauros.png Binary files differdeleted file mode 100644 index 3a4edfee..00000000 --- a/pic/bmon/tauros.png +++ /dev/null diff --git a/pic/bmon/tentacool.png b/pic/bmon/tentacool.png Binary files differdeleted file mode 100644 index 534e5496..00000000 --- a/pic/bmon/tentacool.png +++ /dev/null diff --git a/pic/bmon/tentacruel.png b/pic/bmon/tentacruel.png Binary files differdeleted file mode 100644 index 7a26a305..00000000 --- a/pic/bmon/tentacruel.png +++ /dev/null diff --git a/pic/bmon/vaporeon.png b/pic/bmon/vaporeon.png Binary files differdeleted file mode 100644 index 48dafce6..00000000 --- a/pic/bmon/vaporeon.png +++ /dev/null diff --git a/pic/bmon/venomoth.png b/pic/bmon/venomoth.png Binary files differdeleted file mode 100644 index e28b1017..00000000 --- a/pic/bmon/venomoth.png +++ /dev/null diff --git a/pic/bmon/venonat.png b/pic/bmon/venonat.png Binary files differdeleted file mode 100644 index edf15889..00000000 --- a/pic/bmon/venonat.png +++ /dev/null diff --git a/pic/bmon/venusaur.png b/pic/bmon/venusaur.png Binary files differdeleted file mode 100644 index dd39184a..00000000 --- a/pic/bmon/venusaur.png +++ /dev/null diff --git a/pic/bmon/victreebel.png b/pic/bmon/victreebel.png Binary files differdeleted file mode 100644 index 29a471c8..00000000 --- a/pic/bmon/victreebel.png +++ /dev/null diff --git a/pic/bmon/vileplume.png b/pic/bmon/vileplume.png Binary files differdeleted file mode 100644 index e788425e..00000000 --- a/pic/bmon/vileplume.png +++ /dev/null diff --git a/pic/bmon/voltorb.png b/pic/bmon/voltorb.png Binary files differdeleted file mode 100644 index 22d0c675..00000000 --- a/pic/bmon/voltorb.png +++ /dev/null diff --git a/pic/bmon/vulpix.png b/pic/bmon/vulpix.png Binary files differdeleted file mode 100644 index f4780ef2..00000000 --- a/pic/bmon/vulpix.png +++ /dev/null diff --git a/pic/bmon/wartortle.png b/pic/bmon/wartortle.png Binary files differdeleted file mode 100644 index bd844562..00000000 --- a/pic/bmon/wartortle.png +++ /dev/null diff --git a/pic/bmon/weedle.png b/pic/bmon/weedle.png Binary files differdeleted file mode 100644 index 445fe8f3..00000000 --- a/pic/bmon/weedle.png +++ /dev/null diff --git a/pic/bmon/weepinbell.png b/pic/bmon/weepinbell.png Binary files differdeleted file mode 100644 index 6ee57334..00000000 --- a/pic/bmon/weepinbell.png +++ /dev/null diff --git a/pic/bmon/weezing.png b/pic/bmon/weezing.png Binary files differdeleted file mode 100644 index deb2a623..00000000 --- a/pic/bmon/weezing.png +++ /dev/null diff --git a/pic/bmon/wigglytuff.png b/pic/bmon/wigglytuff.png Binary files differdeleted file mode 100644 index c7cd495b..00000000 --- a/pic/bmon/wigglytuff.png +++ /dev/null diff --git a/pic/bmon/zapdos.png b/pic/bmon/zapdos.png Binary files differdeleted file mode 100644 index 0bd71f4e..00000000 --- a/pic/bmon/zapdos.png +++ /dev/null diff --git a/pic/bmon/zubat.png b/pic/bmon/zubat.png Binary files differdeleted file mode 100644 index 73078725..00000000 --- a/pic/bmon/zubat.png +++ /dev/null diff --git a/pic/bmon/fossilaerodactyl.png b/pic/ymon/fossilaerodactyl.png Binary files differindex eb7fc3a3..eb7fc3a3 100644 --- a/pic/bmon/fossilaerodactyl.png +++ b/pic/ymon/fossilaerodactyl.png diff --git a/pic/bmon/fossilkabutops.png b/pic/ymon/fossilkabutops.png Binary files differindex dd8d41ea..dd8d41ea 100644 --- a/pic/bmon/fossilkabutops.png +++ b/pic/ymon/fossilkabutops.png diff --git a/replace.sh b/replace.sh new file mode 100644 index 00000000..a4688225 --- /dev/null +++ b/replace.sh @@ -0,0 +1,3 @@ +sed -i 's/\<'$1'\>/'$2'/' $(grep -lwr --include "*.asm" $1) +# $1: phrase to find +# $2: phrase to replace $1
\ No newline at end of file @@ -1,2 +1 @@ -3d45c1ee9abd5738df46d2bdda8b57dc pokered.gbc -50927e843568814f7ed45ec4f944bd8b pokeblue.gbc +d9290db87b1f0a23b89f99ee4469e34b pokeyellow.gbc diff --git a/scripts/agatha.asm b/scripts/agatha.asm index 26068977..6f611071 100755 --- a/scripts/agatha.asm +++ b/scripts/agatha.asm @@ -20,7 +20,8 @@ AgathaShowOrHideExitBlock: jp .setExitBlock .blockExitToNextRoom ld a, $3b -.setExitBlock: + +.setExitBlock ld [wNewTileBlockID], a lb bc, 0, 2 predef_jump ReplaceTileBlock diff --git a/scripts/beach_house.asm b/scripts/beach_house.asm new file mode 100644 index 00000000..19554ba7 --- /dev/null +++ b/scripts/beach_house.asm @@ -0,0 +1,191 @@ +BeachHouseScript: + call $3c29 + ret + +BeachHouseTextPointers: + dw SurfinDudeText + dw BeachHousePikachuText + dw BeachHouseSign1Text + dw BeachHouseSign2Text + dw BeachHouseSign3Text + dw BeachHouseSign4Text + +SurfinDudeText: + TX_ASM + ld a, [wd472] + bit 6, a + jr nz, .next + ld hl, .SurfinDudeText4 + call PrintText + jr .done +.next + ld hl, wd492 + bit 0, [hl] + set 0, [hl] + jr nz, .next2 + ld hl, .SurfinDudeText1 + jr .next3 +.next2 + ld hl, .SurfinDudeText3 +.next3 + call PrintText + call YesNoChoice + ld a, [wCurrentMenuItem] + and a + jr nz, .asm_f226b + ld a, 1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + callba SurfingPikachuMinigame + ld hl, wd492 + set 1, [hl] + jr .done +.asm_f226b + ld hl, .SurfinDudeText2 + call PrintText +.done + jp TextScriptEnd + +.SurfinDudeText1 + TX_FAR _SurfinDudeText1 + db "@" +.SurfinDudeText2 + TX_FAR _SurfinDudeText2 + db "@" +.SurfinDudeText3 + TX_FAR _SurfinDudeText3 + db "@" +.SurfinDudeText4 + TX_FAR _SurfinDudeText4 + db "@" + +BeachHousePikachuText: + TX_ASM + ld hl, .BeachHousePikachuText + call PrintText + ld a, PIKACHU + call PlayCry + call WaitForSoundToFinish + jp TextScriptEnd + +.BeachHousePikachuText + TX_FAR _BeachHousePikachuText + db "@" + +BeachHouseSign1Text: + TX_ASM + ld hl, .BeachHouseSign1Text2 + ld a, [wd472] + bit 6, a + jr z, .next + ld hl, .BeachHouseSign1Text1 +.next + call PrintText + jp TextScriptEnd + +.BeachHouseSign1Text1 + TX_FAR _BeachHouseSign1Text1 + db "@" +.BeachHouseSign1Text2 + TX_FAR _BeachHouseSign1Text2 + db "@" + +BeachHouseSign2Text: + TX_ASM + ld hl, .BeachHouseSign2Text2 + ld a, [wd472] + bit 6, a + jr z, .next + ld hl, .BeachHouseSign2Text1 +.next + call PrintText + jp TextScriptEnd + +.BeachHouseSign2Text1 + TX_FAR _BeachHouseSign2Text1 + db "@" +.BeachHouseSign2Text2 + TX_FAR _BeachHouseSign2Text2 + db "@" + +BeachHouseSign3Text: + TX_ASM + ld hl, .BeachHouseSign3Text2 + ld a, [wd472] + bit 6, a + jr z, .next + ld hl, .BeachHouseSign3Text1 +.next + call PrintText + jp TextScriptEnd + +.BeachHouseSign3Text1 + TX_FAR _BeachHouseSign3Text1 + db "@" +.BeachHouseSign3Text2 + TX_FAR _BeachHouseSign3Text2 + db "@" + +BeachHouseSign4Text: + TX_ASM + ld a, 1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld a, [wd472] + bit 6, a + jr z, .asm_f2369 + + ld hl, wd492 + bit 1, [hl] + jr z, .next2 + ld a, 0 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a +.next2 + ld hl, .BeachHousePrinterText2 + call PrintText + ld a, [wd492] + bit 1, a + jr z, .asm_f236f + + ld a, 1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld hl, .BeachHousePrinterText3 + call PrintText + call YesNoChoice + ld a, [wCurrentMenuItem] + and a + jp z, Func_f23d0 + call SaveScreenTilesToBuffer2 + ld hl, wd730 + set 6, [hl] + xor a + ld [wUpdateSpritesEnabled], a + callab Printer_PrepareSurfingMinigameHighScoreTileMap + call WaitForTextScrollButtonPress + ld hl, wd730 + res 6, [hl] + call GBPalWhiteOutWithDelay3 + call ReloadTilesetTilePatterns + call RestoreScreenTilesAndReloadTilePatterns + call LoadScreenTilesFromBuffer2 + call Delay3 + call GBPalNormal + ld a, 1 + ld [wUpdateSpritesEnabled], a + jr .asm_f236f +.asm_f2369 + ld hl, .BeachHousePrinterText1 + call PrintText +.asm_f236f + jp TextScriptEnd + +.BeachHousePrinterText1 + TX_FAR _BeachHousePrinterText1 + db $d, "@" +.BeachHousePrinterText2 + TX_FAR _BeachHousePrinterText2 + db $d, "@" +.BeachHousePrinterText3 + TX_FAR _BeachHousePrinterText3 + db "@" +.BeachHousePrinterText4 + TX_FAR _BeachHousePrinterText4 + db "@" diff --git a/scripts/beach_house2.asm b/scripts/beach_house2.asm new file mode 100755 index 00000000..03e77ecb --- /dev/null +++ b/scripts/beach_house2.asm @@ -0,0 +1,33 @@ +Func_f23d0: + call SaveScreenTilesToBuffer2 + xor a + ld [wUpdateSpritesEnabled], a + ld hl, wd730 + set 6, [hl] + callab PrintSurfingMinigameHighScore + ld hl, wd730 + res 6, [hl] + call GBPalWhiteOutWithDelay3 + call ReloadTilesetTilePatterns + call RestoreScreenTilesAndReloadTilePatterns + call LoadScreenTilesFromBuffer2 + call Delay3 + call GBPalNormal + ld hl, Text_f2412 + ld a, [hOaksAideResult] + and a + jr nz, .asm_f2406 + ld hl, Text_f240c +.asm_f2406 + call PrintText + jp TextScriptEnd + +Text_f240c: + TX_FAR _BeachHousePrinterText5 + TX_WAIT_BUTTON + db "@" + +Text_f2412: + TX_FAR _BeachHousePrinterText6 + TX_WAIT_BUTTON + db "@" diff --git a/scripts/bikeshop.asm b/scripts/bikeshop.asm index 866c04b0..5ebd1fb6 100755 --- a/scripts/bikeshop.asm +++ b/scripts/bikeshop.asm @@ -1,5 +1,6 @@ BikeShopScript: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret BikeShopTextPointers: dw BikeShopText1 @@ -13,6 +14,7 @@ BikeShopText1: ld hl, BikeShopText_1d82f call PrintText jp .Done + .asm_260d4 ld b, BIKE_VOUCHER call IsItemInBag @@ -29,10 +31,12 @@ BikeShopText1: ld hl, BikeShopText_1d824 call PrintText jr .Done + .BagFull ld hl, BikeShopText_1d834 call PrintText jr .Done + .asm_41190 ld hl, BikeShopText_1d810 call PrintText @@ -50,8 +54,7 @@ BikeShopText1: ld hl, wd730 set 6, [hl] coord hl, 0, 0 - ld b, $4 - ld c, $f + lb bc, 4, 15 call TextBoxBorder call UpdateSprites coord hl, 2, 2 @@ -62,11 +65,12 @@ BikeShopText1: call PlaceString ld hl, BikeShopText_1d815 call PrintText - call HandleMenuInput - bit 1, a - jr nz, .cancel + ; This fixes the bike shop instatext glitch ld hl, wd730 res 6, [hl] + call HandleMenuInput + bit BIT_B_BUTTON, a + jr nz, .cancel ld a, [wCurrentMenuItem] and a jr nz, .cancel @@ -103,7 +107,8 @@ BikeShopText_1d81f: BikeShopText_1d824: TX_FAR _BikeShopText_1d824 - db $11, "@" + TX_SFX_KEY_ITEM + db "@" BikeShopComeAgainText: TX_FAR _BikeShopComeAgainText diff --git a/scripts/billshouse.asm b/scripts/billshouse.asm index c2d10f0e..c7fd74f9 100755 --- a/scripts/billshouse.asm +++ b/scripts/billshouse.asm @@ -1,8 +1,10 @@ BillsHouseScript: + call BillsHouseScript_1e09e call EnableAutoTextBoxDrawing ld a, [wBillsHouseCurScript] ld hl, BillsHouseScriptPointers - jp CallFunctionInTable + call JumpTable + ret BillsHouseScriptPointers: dw BillsHouseScript0 @@ -11,21 +13,64 @@ BillsHouseScriptPointers: dw BillsHouseScript3 dw BillsHouseScript4 dw BillsHouseScript5 + dw BillsHouseScript6 + dw BillsHouseScript7 + dw BillsHouseScript8 + dw BillsHouseScript9 + +BillsHouseScript_1e09e: + ld hl, wd492 + bit 7, [hl] + set 7, [hl] + ret nz + CheckEventHL EVENT_MET_BILL_2 + jr z, .asm_1e0af + jr .asm_1e0b3 + +.asm_1e0af + ld a, $0 + jr .asm_1e0b5 + +.asm_1e0b3 + ld a, $9 +.asm_1e0b5 + ld [wBillsHouseCurScript], a + ret BillsHouseScript0: + ld a, [wd472] + bit 7, a + jr z, .asm_1e0d2 + callab CheckPikachuFaintedOrStatused + jr c, .asm_1e0d2 + callab Func_f24d5 +.asm_1e0d2 + xor a + ld [wJoyIgnore], a + ld a, $1 + ld [wBillsHouseCurScript], a ret BillsHouseScript1: - ld a, [wSpriteStateData1 + 9] + ret + +BillsHouseScript2: + ld a, $ff + ld [wJoyIgnore], a + ld a, [wPlayerFacingDirection] and a ; cp SPRITE_FACING_DOWN ld de, MovementData_1e79c jr nz, .notDown + call CheckPikachuFollowingPlayer + jr nz, .asm_1e0f8 + callab Func_f250b +.asm_1e0f8 ld de, MovementData_1e7a0 .notDown ld a, $1 ld [H_SPRITEINDEX], a call MoveSprite - ld a, $2 + ld a, $3 ld [wBillsHouseCurScript], a ret @@ -44,25 +89,58 @@ MovementData_1e7a0: db NPC_MOVEMENT_UP db $FF -BillsHouseScript2: +BillsHouseScript3: ld a, [wd730] bit 0, a ret nz ld a, HS_BILL_POKEMON ld [wMissableObjectIndex], a predef HideObject - SetEvent EVENT_BILL_SAID_USE_CELL_SEPARATOR + call CheckPikachuFollowingPlayer + jr z, .asm_1e13e + ld hl, PikachuMovementData_1e14d + ld a, [wPlayerFacingDirection] + and a ; cp SPRITE_FACING_DOWN + jr nz, .asm_1e133 + ld hl, PikachuMovementData_1e152 +.asm_1e133 + call ApplyPikachuMovementData + callab InitializePikachuTextID +.asm_1e13e xor a ld [wJoyIgnore], a - ld a, $3 + SetEvent EVENT_BILL_SAID_USE_CELL_SEPARATOR + ld a, $4 ld [wBillsHouseCurScript], a ret -BillsHouseScript3: +PikachuMovementData_1e14d: + db $00 + db $1e + db $1e + db $1e + db $3f + +PikachuMovementData_1e152: + db $00 + db $1e + db $1f + db $1e + db $1e + db $20 + db $36 + db $3f + +BillsHouseScript4: CheckEvent EVENT_USED_CELL_SEPARATOR_ON_BILL ret z - ld a, $f0 + ld a, $fc ld [wJoyIgnore], a + ld a, $5 + ld [wBillsHouseCurScript], a + ret + +BillsHouseScript5: ld a, $2 ld [wSpriteIndex], a ld a, $c @@ -79,11 +157,30 @@ BillsHouseScript3: predef ShowObject ld c, 8 call DelayFrames + ld hl, wd472 + bit 7, [hl] + jr z, .asm_1e1c6 + call CheckPikachuFollowingPlayer + jr z, .asm_1e1c6 + ld a, $2 + ld [H_SPRITEINDEX], a + ld a, SPRITE_FACING_DOWN + ld [hSpriteFacingDirection], a + call SetSpriteFacingDirectionAndDelay + ld hl, PikachuMovementData_1e1a9 + call ApplyPikachuMovementData + ld a, $f + ld [wEmotionBubbleSpriteIndex], a + ld a, $0 + ld [wWhichEmotionBubble], a + predef EmotionBubble + callab InitializePikachuTextID +.asm_1e1c6 ld a, $2 ld [H_SPRITEINDEX], a ld de, MovementData_1e807 call MoveSprite - ld a, $4 + ld a, $6 ld [wBillsHouseCurScript], a ret @@ -95,26 +192,67 @@ MovementData_1e807: db NPC_MOVEMENT_DOWN db $FF -BillsHouseScript4: +PikachuMovementData_1e1a9: + db $00 + db $37 + db $3f + +BillsHouseScript6: ld a, [wd730] bit 0, a ret nz - xor a - ld [wJoyIgnore], a SetEvent EVENT_MET_BILL_2 ; this event seems redundant SetEvent EVENT_MET_BILL - ld a, $0 + ld a, $7 ld [wBillsHouseCurScript], a ret -BillsHouseScript5: - ld a, $4 +BillsHouseScript7: + xor a + ld [wPlayerMovingDirection], a + ld a, SPRITE_FACING_UP + ld [wPlayerFacingDirection], a + ld a, $FF ^ (A_BUTTON | B_BUTTON) + ld [wJoyIgnore], a + ld de, RLE_1e219 + ld hl, wSimulatedJoypadStatesEnd + call DecodeRLEList + dec a + ld [wSimulatedJoypadStatesIndex], a + call StartSimulatingJoypadStates + ld a, $8 + ld [wBillsHouseCurScript], a + ret + +RLE_1e219: + db D_RIGHT,$3 + db $FF + +BillsHouseScript8: + ld a, [wSimulatedJoypadStatesIndex] + and a + ret nz + xor a + ld [wPlayerMovingDirection], a + ld a, SPRITE_FACING_UP + ld [wPlayerFacingDirection], a + ld a, $2 + ld [H_SPRITEINDEX], a + ld a, SPRITE_FACING_DOWN + ld [hSpriteFacingDirection], a + call SetSpriteFacingDirectionAndDelay + xor a + ld [wJoyIgnore], a + ld a, $2 ld [hSpriteIndexOrTextID], a call DisplayTextID - ld a, $0 + ld a, $9 ld [wBillsHouseCurScript], a ret +BillsHouseScript9: + ret + BillsHouseTextPointers: dw BillsHouseText1 dw BillsHouseText2 @@ -122,93 +260,20 @@ BillsHouseTextPointers: dw BillsHouseText4 BillsHouseText4: - TX_BILLS_PC + TX_FAR _BillsHouseDontLeaveText + db "@" BillsHouseText1: TX_ASM - ld hl, BillsHouseText_1e865 - call PrintText - call YesNoChoice - ld a, [wCurrentMenuItem] - and a - jr nz, .asm_1e85a -.asm_1e84d - ld hl, BillsHouseText_1e86a - call PrintText - ld a, $1 - ld [wBillsHouseCurScript], a - jr .asm_1e862 -.asm_1e85a - ld hl, BillsHouseText_1e86f - call PrintText - jr .asm_1e84d -.asm_1e862 + callba Func_f2418 jp TextScriptEnd -BillsHouseText_1e865: - TX_FAR _BillsHouseText_1e865 - db "@" - -BillsHouseText_1e86a: - TX_FAR _BillsHouseText_1e86a - db "@" - -BillsHouseText_1e86f: - TX_FAR _BillsHouseText_1e86f - db "@" - BillsHouseText2: TX_ASM - CheckEvent EVENT_GOT_SS_TICKET - jr nz, .asm_1e8a9 - ld hl, BillThankYouText - call PrintText - lb bc, S_S_TICKET, 1 - call GiveItem - jr nc, .BagFull - ld hl, SSTicketReceivedText - call PrintText - SetEvent EVENT_GOT_SS_TICKET - ld a, HS_CERULEAN_GUARD_1 - ld [wMissableObjectIndex], a - predef ShowObject - ld a, HS_CERULEAN_GUARD_2 - ld [wMissableObjectIndex], a - predef HideObject -.asm_1e8a9 - ld hl, BillsHouseText_1e8cb - call PrintText - jr .asm_1e8b7 -.BagFull - ld hl, SSTicketNoRoomText - call PrintText -.asm_1e8b7 + callba Func_f244a jp TextScriptEnd -BillThankYouText: - TX_FAR _BillThankYouText - db "@" - -SSTicketReceivedText: - TX_FAR _SSTicketReceivedText - TX_SFX_KEY_ITEM - TX_BUTTON_SOUND - db "@" - -SSTicketNoRoomText: - TX_FAR _SSTicketNoRoomText - db "@" - -BillsHouseText_1e8cb: - TX_FAR _BillsHouseText_1e8cb - db "@" - BillsHouseText3: TX_ASM - ld hl, BillsHouseText_1e8da - call PrintText + callba Func_f24a2 jp TextScriptEnd - -BillsHouseText_1e8da: - TX_FAR _BillsHouseText_1e8da - db "@" diff --git a/scripts/billshouse2.asm b/scripts/billshouse2.asm new file mode 100755 index 00000000..87016aa8 --- /dev/null +++ b/scripts/billshouse2.asm @@ -0,0 +1,158 @@ +Func_f2418: + ld hl, BillsHouseText_f243b + call PrintText + call YesNoChoice + ld a, [wCurrentMenuItem] + and a + jr nz, .asm_f2433 +.asm_f2427 + ld hl, BillsHouseText_f2440 + call PrintText + ld a, $2 + ld [wBillsHouseCurScript], a + ret + +.asm_f2433 + ld hl, BillsHouseText_f2445 + call PrintText + jr .asm_f2427 + +BillsHouseText_f243b: + TX_FAR _BillsHouseText_1e865 + db "@" + +BillsHouseText_f2440: + TX_FAR _BillsHouseText_1e86a + db "@" + +BillsHouseText_f2445: + TX_FAR _BillsHouseText_1e86f + db "@" + +Func_f244a: + CheckEvent EVENT_GOT_SS_TICKET + jr nz, .asm_f247e + ld hl, BillsHouseText_f248c + call PrintText + lb bc, S_S_TICKET, 1 + call GiveItem + jr nc, .asm_f2485 + ld hl, BillsHouseText_f2491 + call PrintText + SetEvent EVENT_GOT_SS_TICKET + ld a, HS_CERULEAN_GUARD_1 + ld [wMissableObjectIndex], a + predef ShowObject + ld a, HS_CERULEAN_GUARD_2 + ld [wMissableObjectIndex], a + predef HideObject +.asm_f247e + ld hl, BillsHouseText_f249d + call PrintText + ret + +.asm_f2485 + ld hl, BillsHouseText_f2498 + call PrintText + ret + +BillsHouseText_f248c: + TX_FAR _BillThankYouText + db "@" + +BillsHouseText_f2491: + TX_FAR _SSTicketReceivedText + TX_SFX_KEY_ITEM + TX_BUTTON_SOUND + db "@" + +BillsHouseText_f2498: + TX_FAR _SSTicketNoRoomText + db "@" + +BillsHouseText_f249d: + TX_FAR _BillsHouseText_1e8cb + db "@" + +Func_f24a2: + ld hl, BillsHouseText_f24a9 + call PrintText + ret + +BillsHouseText_f24a9: + TX_FAR _BillsHouseText_1e8da + db "@" + +Func_f24ae: + ld a, [wCurMap] + cp BILLS_HOUSE + jr nz, .asm_f24d2 + call CheckPikachuFollowingPlayer + jr z, .asm_f24d2 + ld a, [wBillsHouseCurScript] + cp $5 + ld e, $1b + ret z + cp $0 + ld e, $17 + ret z + CheckEventHL EVENT_MET_BILL_2 + ld e, $20 + ret z + ld e, $1f + ret + +.asm_f24d2 + ld e, $ff + ret + +Func_f24d5: + ld a, $ff + ld [wJoyIgnore], a + xor a + ld [wPlayerMovingDirection], a + call UpdateSprites + call UpdateSprites + ld hl, Data_f2505 + call ApplyPikachuMovementData + ld a, $f ; pikachu + ld [wEmotionBubbleSpriteIndex], a + ld a, $1 + ld [wWhichEmotionBubble], a + predef EmotionBubble + call DisablePikachuFollowingPlayer + callab InitializePikachuTextID + ret + +Data_f2505: + db $00 + db $20 + db $20 + db $20 + db $1e + db $3f + +Func_f250b: + ld hl, Data_f251c + ld b, SPRITE_FACING_UP + call TryApplyPikachuMovementData + ld hl, Data_f2521 + ld b, SPRITE_FACING_RIGHT + call TryApplyPikachuMovementData + ret + +Data_f251c: + db $00 + db $1f + db $1d + db $38 + db $3f + +Data_f2521: + db $00 + db $1e + db $1f + db $1f + db $1d + db $38 + db $3f diff --git a/scripts/blueshouse.asm b/scripts/blueshouse.asm index 2b72ef97..b727bbd1 100755 --- a/scripts/blueshouse.asm +++ b/scripts/blueshouse.asm @@ -1,8 +1,9 @@ BluesHouseScript: call EnableAutoTextBoxDrawing ld hl, BluesHouseScriptPointers - ld a, [wBluesHouseCurScript] - jp CallFunctionInTable + xor a + call JumpTable + ret BluesHouseScriptPointers: dw BluesHouseScript0 @@ -14,8 +15,6 @@ BluesHouseScript0: ; trigger the next script ld a, 1 ld [wBluesHouseCurScript], a - ret - BluesHouseScript1: ret @@ -33,7 +32,6 @@ BluesHouseText1: ld hl, DaisyInitialText call PrintText jr .done - .GiveMap ld hl, DaisyOfferMapText call PrintText @@ -47,12 +45,10 @@ BluesHouseText1: call PrintText SetEvent EVENT_GOT_TOWN_MAP jr .done - .GotMap ld hl, DaisyUseMapText call PrintText jr .done - .BagFull ld hl, DaisyBagFullText call PrintText diff --git a/scripts/bruno.asm b/scripts/bruno.asm index 4a7ecdaf..a10a1e49 100755 --- a/scripts/bruno.asm +++ b/scripts/bruno.asm @@ -20,6 +20,7 @@ BrunoShowOrHideExitBlock: jp .setExitBlock .blockExitToNextRoom ld a, $24 + .setExitBlock ld [wNewTileBlockID], a lb bc, 0, 2 diff --git a/scripts/celadoncity.asm b/scripts/celadoncity.asm index d904f484..04fa0a28 100755 --- a/scripts/celadoncity.asm +++ b/scripts/celadoncity.asm @@ -1,5 +1,14 @@ CeladonCityScript: call EnableAutoTextBoxDrawing + ld hl, CeladonCityScriptPointers + ld a, [wCeladonCityCurScript] + call JumpTable + ret + +CeladonCityScriptPointers: + dw CeladonCityScript1 + +CeladonCityScript1: ResetEvents EVENT_1B8, EVENT_1BF ResetEvent EVENT_67F ret @@ -99,8 +108,9 @@ CeladonCityText9: db "@" CeladonCityText10: - TX_FAR _CeladonCityText10 - db "@" + TX_ASM + callba Func_f1ac6 + jp TextScriptEnd CeladonCityText11: TX_FAR _CeladonCityText11 diff --git a/scripts/celadoncity2.asm b/scripts/celadoncity2.asm new file mode 100755 index 00000000..12f7b366 --- /dev/null +++ b/scripts/celadoncity2.asm @@ -0,0 +1,8 @@ +Func_f1ac6: + ld hl, Text_f1acd + call PrintText + ret + +Text_f1acd: + TX_FAR _CeladonCityText10 + db "@" diff --git a/scripts/celadondiner.asm b/scripts/celadondiner.asm index 55263560..6ecada9e 100755 --- a/scripts/celadondiner.asm +++ b/scripts/celadondiner.asm @@ -27,39 +27,5 @@ CeladonDinerText4: CeladonDinerText5: TX_ASM - CheckEvent EVENT_GOT_COIN_CASE - jr nz, .asm_eb14d - ld hl, CeladonDinerText_491a7 - call PrintText - lb bc, COIN_CASE, 1 - call GiveItem - jr nc, .BagFull - SetEvent EVENT_GOT_COIN_CASE - ld hl, ReceivedCoinCaseText - call PrintText - jr .asm_68b61 -.BagFull - ld hl, CoinCaseNoRoomText - call PrintText - jr .asm_68b61 -.asm_eb14d - ld hl, CeladonDinerText_491b7 - call PrintText -.asm_68b61 + callab Func_f1f31 jp TextScriptEnd - -CeladonDinerText_491a7: - TX_FAR _CeladonDinerText_491a7 - db "@" - -ReceivedCoinCaseText: - TX_FAR _ReceivedCoinCaseText - db $11, "@" - -CoinCaseNoRoomText: - TX_FAR _CoinCaseNoRoomText - db "@" - -CeladonDinerText_491b7: - TX_FAR _CeladonDinerText_491b7 - db "@" diff --git a/scripts/celadondiner2.asm b/scripts/celadondiner2.asm new file mode 100755 index 00000000..8cd66a19 --- /dev/null +++ b/scripts/celadondiner2.asm @@ -0,0 +1,38 @@ +Func_f1f31: + CheckEvent EVENT_GOT_COIN_CASE + jr nz, .asm_eb14d + ld hl, CeladonDinerText_491a7 + call PrintText + lb bc, COIN_CASE, 1 + call GiveItem + jr nc, .BagFull + SetEvent EVENT_GOT_COIN_CASE + ld hl, ReceivedCoinCaseText + call PrintText + jr .asm_68b61 +.BagFull + ld hl, CoinCaseNoRoomText + call PrintText + jr .asm_68b61 +.asm_eb14d + ld hl, CeladonDinerText_491b7 + call PrintText +.asm_68b61 + ret + +CeladonDinerText_491a7: + TX_FAR _CeladonDinerText_491a7 + db "@" + +ReceivedCoinCaseText: + TX_FAR _ReceivedCoinCaseText + TX_SFX_KEY_ITEM + db "@" + +CoinCaseNoRoomText: + TX_FAR _CoinCaseNoRoomText + db "@" + +CeladonDinerText_491b7: + TX_FAR _CeladonDinerText_491b7 + db "@" diff --git a/scripts/celadongamecorner.asm b/scripts/celadongamecorner.asm index 0c4fd963..43aae927 100755 --- a/scripts/celadongamecorner.asm +++ b/scripts/celadongamecorner.asm @@ -4,7 +4,7 @@ CeladonGameCornerScript: call EnableAutoTextBoxDrawing ld hl, CeladonGameCornerScriptPointers ld a, [wCeladonGameCornerCurScript] - jp CallFunctionInTable + jp JumpTable CeladonGameCornerScript_48bcf: ld hl, wCurrentMapScriptFlags @@ -71,8 +71,12 @@ CeladonGameCornerScript1: .asm_48c43 ld a, [wXCoord] cp $8 - jr nz, .asm_48c4d + jr nz, .pikachu ld de, MovementData_48c63 + jr .asm_48c4d +.pikachu + callab Func_f1f23 + ld de, MovementData_48c5a .asm_48c4d ld a, $b ld [H_SPRITEINDEX], a @@ -85,8 +89,8 @@ MovementData_48c5a: db NPC_MOVEMENT_DOWN db NPC_MOVEMENT_RIGHT db NPC_MOVEMENT_RIGHT - db NPC_MOVEMENT_UP db NPC_MOVEMENT_RIGHT + db NPC_MOVEMENT_UP db NPC_MOVEMENT_RIGHT db NPC_MOVEMENT_RIGHT db NPC_MOVEMENT_RIGHT @@ -144,7 +148,7 @@ CeladonGameCornerText2: ld a, [wCurrentMenuItem] and a jr nz, .asm_48d0f - ld b,COIN_CASE + ld b, COIN_CASE call IsItemInBag jr z, .asm_48d19 call Has9990Coins @@ -345,8 +349,7 @@ CeladonGameCornerText_48e26: Received20CoinsText: TX_FAR _Received20CoinsText - TX_SFX_ITEM - db "@" + db $0B, "@" CeladonGameCornerText_48e31: TX_FAR _CeladonGameCornerText_48e31 @@ -362,7 +365,7 @@ CeladonGameCornerText10: jr nz, .asm_48e75 ld hl, CeladonGameCornerText_48e88 call PrintText - ld b,COIN_CASE + ld b, COIN_CASE call IsItemInBag jr z, .asm_48e7f call Has9990Coins @@ -397,8 +400,7 @@ CeladonGameCornerText_48e88: CeladonGameCornerText_48e8d: TX_FAR _CeladonGameCornerText_48e8d - TX_SFX_ITEM - db "@" + db $0B, "@" CeladonGameCornerText_48e93: TX_FAR _CeladonGameCornerText_48e93 @@ -475,13 +477,11 @@ CeladonGameCornerScript_48f1e: ld hl, wd730 set 6, [hl] coord hl, 11, 0 - ld b, $5 - ld c, $7 + lb bc, 5, 7 call TextBoxBorder call UpdateSprites coord hl, 12, 1 - ld b, 4 - ld c, 7 + lb bc, 4, 7 call ClearScreenArea coord hl, 12, 2 ld de, GameCornerMoneyText @@ -491,7 +491,7 @@ CeladonGameCornerScript_48f1e: call PlaceString coord hl, 12, 3 ld de, wPlayerMoney - ld c, $a3 + ld c, 3 | MONEY_SIGN | LEADING_ZEROES call PrintBCDNumber coord hl, 12, 4 ld de, GameCornerCoinText diff --git a/scripts/celadongamecorner2.asm b/scripts/celadongamecorner2.asm new file mode 100755 index 00000000..f8d25905 --- /dev/null +++ b/scripts/celadongamecorner2.asm @@ -0,0 +1,12 @@ +Func_f1f23: + ld hl, PikachuMovementData_f1f2c + ld b, SPRITE_FACING_DOWN + call TryApplyPikachuMovementData + ret + +PikachuMovementData_f1f2c: + db $00 + db $20 + db $1e + db $35 + db $3f diff --git a/scripts/celadonmansion1.asm b/scripts/celadonmansion1.asm index f6ef7669..59d9d1d8 100755 --- a/scripts/celadonmansion1.asm +++ b/scripts/celadonmansion1.asm @@ -1,5 +1,6 @@ CeladonMansion1Script: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret CeladonMansion1TextPointers: dw CeladonMansion1Text1 @@ -8,31 +9,39 @@ CeladonMansion1TextPointers: dw CeladonMansion1Text4 dw CeladonMansion1Text5 -CeladonMansion1_486a1: - call PlayCry - jp TextScriptEnd - CeladonMansion1Text1: TX_FAR _CeladonMansion1Text1 TX_ASM ld a, MEOWTH - jp CeladonMansion1_486a1 + call PlayCry + jp TextScriptEnd CeladonMansion1Text2: - TX_FAR _CeladonMansion1Text2 - db "@" + TX_ASM + callba Func_f1e70 + ld a, [wPikachuHappiness] + cp 251 + jr c, .asm_485d9 + ld c, 50 + call DelayFrames + ldpikacry e, PikachuCry23 + callab PlayPikachuSoundClip +.asm_485d9 + jp TextScriptEnd CeladonMansion1Text3: TX_FAR _CeladonMansion1Text3 TX_ASM ld a, CLEFAIRY - jp CeladonMansion1_486a1 + call PlayCry + jp TextScriptEnd CeladonMansion1Text4: TX_FAR _CeladonMansion1Text4 TX_ASM ld a, NIDORAN_F - jp CeladonMansion1_486a1 + call PlayCry + jp TextScriptEnd CeladonMansion1Text5: TX_FAR _CeladonMansion1Text5 diff --git a/scripts/celadonmansion1_2.asm b/scripts/celadonmansion1_2.asm new file mode 100755 index 00000000..0e1c2389 --- /dev/null +++ b/scripts/celadonmansion1_2.asm @@ -0,0 +1,78 @@ +Func_f1e70: + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld hl, CeladonMansion1Text_f1e96 + call PrintText + callab IsStarterPikachuInOurParty + ret nc + ld hl, CeladonMansionText_f1e9c + call PrintText + ld a, $0 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + call Func_f1ea2 + call PrintText + ret + +CeladonMansion1Text_f1e96: + TX_FAR _CeladonMansion1Text2 + TX_WAIT_BUTTON + db "@" + +CeladonMansionText_f1e9c: + TX_FAR _CeladonMansion1Text6 + TX_BUTTON_SOUND + db "@" + +Func_f1ea2: + ld hl, PikachuHappinessThresholds_f1eb9 +.asm_f1ea5 + ld a, [hli] + inc hl + and a + jr z, .asm_f1eb5 + ld b, a + ld a, [wPikachuHappiness] + cp b + jr c, .asm_f1eb5 + inc hl + inc hl + jr .asm_f1ea5 + +.asm_f1eb5 + ld a, [hli] + ld h, [hl] + ld l, a + ret + +PikachuHappinessThresholds_f1eb9 + dw 51, CeladonMansion1Text_f1ed5 + dw 101, CeladonMansion1Text_f1eda + dw 131, CeladonMansion1Text_f1edf + dw 161, CeladonMansion1Text_f1ee4 + dw 201, CeladonMansion1Text_f1ee9 + dw 255, CeladonMansion1Text_f1eee + dbbw 0, $ff, CeladonMansion1Text_f1eee + +CeladonMansion1Text_f1ed5: + TX_FAR _CeladonMansion1Text7 + db "@" + +CeladonMansion1Text_f1eda: + TX_FAR _CeladonMansion1Text8 + db "@" + +CeladonMansion1Text_f1edf: + TX_FAR _CeladonMansion1Text9 + db "@" + +CeladonMansion1Text_f1ee4: + TX_FAR _CeladonMansion1Text10 + db "@" + +CeladonMansion1Text_f1ee9: + TX_FAR _CeladonMansion1Text11 + db "@" + +CeladonMansion1Text_f1eee: + TX_FAR _CeladonMansion1Text12 + db "@" diff --git a/scripts/celadonmansion3.asm b/scripts/celadonmansion3.asm index 7b5d5294..6693f6a6 100755 --- a/scripts/celadonmansion3.asm +++ b/scripts/celadonmansion3.asm @@ -1,5 +1,13 @@ CeladonMansion3Script: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret + +CeladonMansion3_PokedexCount: + ld hl, wPokedexOwned + ld b, wPokedexOwnedEnd - wPokedexOwned + call CountSetBits + ld a, [wNumSetBits] + ret CeladonMansion3TextPointers: dw ProgrammerText @@ -12,31 +20,120 @@ CeladonMansion3TextPointers: dw GameFreakSignText ProgrammerText: + TX_ASM + call CeladonMansion3_PokedexCount + cp 150 + ld hl, CeladonMansion3Text_486f5 + jr nc, .print + ld hl, CeladonMansion3Text_486f0 +.print + call PrintText + jp TextScriptEnd + +CeladonMansion3Text_486f0: TX_FAR _ProgrammerText db "@" +CeladonMansion3Text_486f5: + TX_FAR _ProgrammerText2 + db "@" + GraphicArtistText: + TX_ASM + call CeladonMansion3_PokedexCount + cp 150 + jr nc, .completed + ld hl, CeladonMansion3Text_48757 + jr .print + +.completed + ld hl, CeladonMansion3Text_4875c + call PrintText + call YesNoChoice + ld a, [wCurrentMenuItem] + and a + jr nz, .declined_print + call SaveScreenTilesToBuffer2 + xor a + ld [wUpdateSpritesEnabled], a + ld hl, wd730 + set 6, [hl] + callab PrintDiploma + ld hl, wd730 + res 6, [hl] + call GBPalWhiteOutWithDelay3 + call ReloadTilesetTilePatterns + call RestoreScreenTilesAndReloadTilePatterns + call LoadScreenTilesFromBuffer2 + call Delay3 + call GBPalNormal + ld hl, CeladonMansion3Text_4876b + ld a, [$ffdb] + and a + jr nz, .print + ld hl, CeladonMansion3Text_48766 + jr .print + +.declined_print + ld hl, CeladonMansion3Text_48761 +.print + call PrintText + jp TextScriptEnd + +CeladonMansion3Text_48757: TX_FAR _GraphicArtistText db "@" +CeladonMansion3Text_4875c: + TX_FAR _GraphicArtistText2 + db "@" + +CeladonMansion3Text_48761: + TX_FAR _GraphicArtistText3 + db "@" + +CeladonMansion3Text_48766: + TX_FAR _GraphicArtistText4 + db "@" + +CeladonMansion3Text_4876b: + TX_FAR _GraphicArtistText5 + db "@" + WriterText: + TX_ASM + call CeladonMansion3_PokedexCount + cp 150 + ld hl, CeladonMansion3Text_48789 + jr nc, .print + ld hl, CeladonMansion3Text_48784 +.print + call PrintText + jp TextScriptEnd + +CeladonMansion3Text_48784: TX_FAR _WriterText db "@" +CeladonMansion3Text_48789: + TX_FAR _WriterText2 + db "@" + DirectorText: TX_ASM - + call CeladonMansion3_PokedexCount ; check pokédex - ld hl, wPokedexOwned - ld b, wPokedexOwnedEnd - wPokedexOwned - call CountSetBits - ld a, [wNumSetBits] cp 150 jr nc, .CompletedDex ld hl, .GameDesigner jr .done .CompletedDex ld hl, .CompletedDexText + call PrintText + call Delay3 + xor a + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld hl, .UnlockedDiplomaPrinting .done call PrintText jp TextScriptEnd @@ -47,25 +144,33 @@ DirectorText: .CompletedDexText TX_FAR _CompletedDexText - db $6 + TX_BUTTON_SOUND TX_ASM callab DisplayDiploma ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a jp TextScriptEnd -GameFreakPCText1: - TX_FAR _CeladonMansion3Text5 +.UnlockedDiplomaPrinting + TX_FAR _CompletedDexText2 db "@" +GameFreakPCText1: + TX_ASM + callba Func_f1ef3 + jp TextScriptEnd + GameFreakPCText2: - TX_FAR _CeladonMansion3Text6 - db "@" + TX_ASM + callba Func_f1eff + jp TextScriptEnd GameFreakPCText3: - TX_FAR _CeladonMansion3Text7 - db "@" + TX_ASM + callba Func_f1f0b + jp TextScriptEnd GameFreakSignText: - TX_FAR _CeladonMansion3Text8 - db "@" + TX_ASM + callba Func_f1f17 + jp TextScriptEnd diff --git a/scripts/celadonmansion3_2.asm b/scripts/celadonmansion3_2.asm new file mode 100755 index 00000000..3a7035ba --- /dev/null +++ b/scripts/celadonmansion3_2.asm @@ -0,0 +1,35 @@ +Func_f1ef3: + ld hl, CeladonMansion3Text_f1efa + call PrintText + ret + +CeladonMansion3Text_f1efa: + TX_FAR _CeladonMansion3Text5 + db "@" + +Func_f1eff: + ld hl, CeladonMansion3Text_f1f06 + call PrintText + ret + +CeladonMansion3Text_f1f06: + TX_FAR _CeladonMansion3Text6 + db "@" + +Func_f1f0b: + ld hl, CeladonMansion3Text_f1f12 + call PrintText + ret + +CeladonMansion3Text_f1f12: + TX_FAR _CeladonMansion3Text7 + db "@" + +Func_f1f17: + ld hl, CeladonMansion3Text_f1f1e + call PrintText + ret + +CeladonMansion3Text_f1f1e: + TX_FAR _CeladonMansion3Text8 + db "@" diff --git a/scripts/celadonmansion4.asm b/scripts/celadonmansion4.asm index 80d887e9..483aa4fd 100755 --- a/scripts/celadonmansion4.asm +++ b/scripts/celadonmansion4.asm @@ -1,5 +1,6 @@ CeladonMansion4Script: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret CeladonMansion4TextPointers: dw CeladonMansion4Text1 diff --git a/scripts/celadonmansion5.asm b/scripts/celadonmansion5.asm index 197a0f54..c2da8c6d 100755 --- a/scripts/celadonmansion5.asm +++ b/scripts/celadonmansion5.asm @@ -1,5 +1,6 @@ CeladonMansion5Script: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret CeladonMansion5TextPointers: dw CeladonMansion5Text1 diff --git a/scripts/celadonmart1.asm b/scripts/celadonmart1.asm index 0f67972b..64c4a087 100755 --- a/scripts/celadonmart1.asm +++ b/scripts/celadonmart1.asm @@ -1,5 +1,6 @@ CeladonMart1Script: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret CeladonMart1TextPointers: dw CeladonMart1Text1 diff --git a/scripts/celadonmart3.asm b/scripts/celadonmart3.asm index 7b9940fa..25bf4e80 100755 --- a/scripts/celadonmart3.asm +++ b/scripts/celadonmart3.asm @@ -22,41 +22,9 @@ CeladonMart3TextPointers: CeladonMart3Text1: TX_ASM - CheckEvent EVENT_GOT_TM18 - jr nz, .asm_a5463 - ld hl, TM18PreReceiveText - call PrintText - lb bc, TM_18, 1 - call GiveItem - jr nc, .BagFull - SetEvent EVENT_GOT_TM18 - ld hl, ReceivedTM18Text - jr .asm_81359 -.BagFull - ld hl, TM18NoRoomText - jr .asm_81359 -.asm_a5463 - ld hl, TM18ExplanationText -.asm_81359 - call PrintText + callab Func_f1e30 jp TextScriptEnd -TM18PreReceiveText: - TX_FAR _TM18PreReceiveText - db "@" - -ReceivedTM18Text: - TX_FAR _ReceivedTM18Text - db $0B, "@" - -TM18ExplanationText: - TX_FAR _TM18ExplanationText - db "@" - -TM18NoRoomText: - TX_FAR _TM18NoRoomText - db "@" - CeladonMart3Text2: TX_FAR _CeladonMart3Text2 db "@" diff --git a/scripts/celadonmart3_2.asm b/scripts/celadonmart3_2.asm new file mode 100755 index 00000000..1c9f0db1 --- /dev/null +++ b/scripts/celadonmart3_2.asm @@ -0,0 +1,38 @@ +Func_f1e30 + CheckEvent EVENT_GOT_TM18 + jr nz, .asm_f1e54 + ld hl, CeladonMart3Text_f1e5b + call PrintText + lb bc, TM_18, 1 + call GiveItem + jr nc, .asm_f1e4f + SetEvent EVENT_GOT_TM18 + ld hl, CeladonMart3Text_f1e60 + jr .asm_f1e57 + +.asm_f1e4f + ld hl, CeladonMart3Text_f1e6b + jr .asm_f1e57 + +.asm_f1e54 + ld hl, CeladonMart3Text_f1e66 +.asm_f1e57 + call PrintText + ret + +CeladonMart3Text_f1e5b: + TX_FAR _TM18PreReceiveText + db "@" + +CeladonMart3Text_f1e60: + TX_FAR _ReceivedTM18Text + TX_SFX_ITEM + db "@" + +CeladonMart3Text_f1e66: + TX_FAR _TM18ExplanationText + db "@" + +CeladonMart3Text_f1e6b: + TX_FAR _TM18NoRoomText + db "@" diff --git a/scripts/celadonmart5.asm b/scripts/celadonmart5.asm index 7b7371a7..f65b42bc 100755 --- a/scripts/celadonmart5.asm +++ b/scripts/celadonmart5.asm @@ -1,5 +1,6 @@ CeladonMart5Script: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret CeladonMart5TextPointers: dw CeladonMart5Text1 diff --git a/scripts/celadonmartroof.asm b/scripts/celadonmartroof.asm index 1f3bcb64..22a83780 100755 --- a/scripts/celadonmartroof.asm +++ b/scripts/celadonmartroof.asm @@ -1,5 +1,6 @@ CeladonMartRoofScript: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret CeladonMartRoofScript_GetDrinksInBag: ; construct a list of all drinks in the player's bag @@ -71,7 +72,7 @@ CeladonMartRoofScript_GiveDrinkToGirl: ld hl, wd730 res 6, [hl] call HandleMenuInput - bit 1, a ; pressed b + bit BIT_B_BUTTON, a ; pressed b ret nz ld hl, wFilteredBagItems ld a, [wCurrentMenuItem] @@ -125,13 +126,16 @@ CeladonMartRoofScript_GiveDrinkToGirl: ret .bagFull ld hl, CeladonMartRoofText_48526 - jp PrintText + call PrintText + ret .alreadyGaveDrink ld hl, CeladonMartRoofText_4852c - jp PrintText + call PrintText + ret RemoveItemByIDBank12: - jpba RemoveItemByID + callba RemoveItemByID + ret CeladonMartRoofText_484ee: TX_FAR _CeladonMartRoofText_484ee @@ -139,48 +143,48 @@ CeladonMartRoofText_484ee: CeladonMartRoofText_484f3: TX_FAR _CeladonMartRoofText_484f3 - TX_WAIT_BUTTON + db $0d db "@" CeladonMartRoofText_484f9: TX_FAR _CeladonMartRoofText_484f9 - TX_SFX_ITEM + db $0b TX_FAR _CeladonMartRoofText_484fe - TX_WAIT_BUTTON + db $0d db "@" CeladonMartRoofText_48504: TX_FAR _CeladonMartRoofText_48504 - TX_WAIT_BUTTON + db $0d db "@" CeladonMartRoofText_4850a: TX_FAR _CeladonMartRoofText_4850a - TX_SFX_ITEM + db $0b TX_FAR _CeladonMartRoofText_4850f - TX_WAIT_BUTTON + db $0d db "@" CeladonMartRoofText_48515: TX_FAR _CeladonMartRoofText_48515 - TX_WAIT_BUTTON + db $0d db "@" ReceivedTM49Text: TX_FAR _ReceivedTM49Text - TX_SFX_ITEM + db $0b TX_FAR _CeladonMartRoofText_48520 - TX_WAIT_BUTTON + db $0d db "@" CeladonMartRoofText_48526: TX_FAR _CeladonMartRoofText_48526 - TX_WAIT_BUTTON + db $0d db "@" CeladonMartRoofText_4852c: TX_FAR _CeladonMartRoofText_4852c - TX_WAIT_BUTTON + db $0d db "@" CeladonMartRoofScript_PrintDrinksInBag: diff --git a/scripts/celadonpokecenter.asm b/scripts/celadonpokecenter.asm index bd91af20..acbae2ec 100755 --- a/scripts/celadonpokecenter.asm +++ b/scripts/celadonpokecenter.asm @@ -7,6 +7,7 @@ CeladonPokecenterTextPointers: dw CeladonPokecenterText2 dw CeladonPokecenterText3 dw CeladonTradeNurseText + dw CeladonPokecenterText5 CeladonTradeNurseText: TX_CABLE_CLUB_RECEPTIONIST @@ -21,3 +22,8 @@ CeladonPokecenterText2: CeladonPokecenterText3: TX_FAR _CeladonPokecenterText3 db "@" + +CeladonPokecenterText5: + TX_ASM + callab PokecenterChanseyText + jp TextScriptEnd diff --git a/scripts/ceruleancity.asm b/scripts/ceruleancity.asm index 94f90f2b..4243d35c 100755 --- a/scripts/ceruleancity.asm +++ b/scripts/ceruleancity.asm @@ -2,7 +2,7 @@ CeruleanCityScript: call EnableAutoTextBoxDrawing ld hl, CeruleanCityScriptPointers ld a, [wCeruleanCityCurScript] - jp CallFunctionInTable + jp JumpTable CeruleanCityScript_1948c: xor a @@ -64,9 +64,7 @@ CeruleanCityScript0: ld a, [wWalkBikeSurfState] and a jr z, .asm_19512 - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic .asm_19512 ld c, BANK(Music_MeetRival) ld a, MUSIC_MEET_RIVAL @@ -136,23 +134,8 @@ CeruleanCityScript1: call SaveEndBattleTextPointers ld a, OPP_SONY1 ld [wCurOpponent], a - - ; select which team to use during the encounter - ld a, [wRivalStarter] - cp STARTER2 - jr nz, .NotSquirtle - ld a, $7 - jr .done -.NotSquirtle - cp STARTER3 - jr nz, .Charmander - ld a, $8 - jr .done -.Charmander - ld a, $9 -.done + ld a, 3 ld [wTrainerNo], a - xor a ld [hJoyHeld], a call CeruleanCityScript_1955d @@ -171,9 +154,7 @@ CeruleanCityScript2: ld a, $1 ld [hSpriteIndexOrTextID], a call DisplayTextID - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic callba Music_RivalAlternateStart ld a, $1 ld [H_SPRITEINDEX], a diff --git a/scripts/ceruleangym.asm b/scripts/ceruleangym.asm index ee71595f..448ce744 100755 --- a/scripts/ceruleangym.asm +++ b/scripts/ceruleangym.asm @@ -55,6 +55,7 @@ CeruleanGymScript_5c70d: call DisplayTextID SetEvent EVENT_GOT_TM11 jr .asm_5c736 + .BagFull ld a, $7 ld [hSpriteIndexOrTextID], a @@ -158,7 +159,7 @@ CeruleanGymText7: CeruleanGymText_5c7d8: TX_FAR _CeruleanGymText_5c7d8 - db $11, $6, "@" + db "@" CeruleanGymText2: TX_ASM diff --git a/scripts/ceruleanhouse1.asm b/scripts/ceruleanhouse1.asm index 181a22c3..ba75c240 100755 --- a/scripts/ceruleanhouse1.asm +++ b/scripts/ceruleanhouse1.asm @@ -1,17 +1,106 @@ CeruleanHouse1Script: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret CeruleanHouse1TextPointers: dw CeruleanHouse1Text1 dw CeruleanHouse1Text2 + dw CeruleanHouse1Text3 + dw CeruleanHouse1Text4 CeruleanHouse1Text1: - TX_FAR _CeruleanHouse1Text1 + TX_ASM + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + CheckEvent EVENT_GOT_BULBASAUR_IN_CERULEAN + jr nz, .asm_1cfbf + ld hl, CeruleanHouse1Text_1cfc8 + call PrintText + ld a, [wPikachuHappiness] + cp 147 + jr c, .asm_1cfb3 + ld hl, CeruleanHouse1Text_1cfce + call PrintText + call YesNoChoice + ld a, [wCurrentMenuItem] + and a + jr nz, .asm_1cfb6 + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld a, BULBASAUR + ld [wd11e], a + ld [wcf91], a + call GetMonName + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + lb bc, BULBASAUR, 10 + call GivePokemon + jr nc, .asm_1cfb3 + ld a, [wAddedToParty] + and a + call z, WaitForTextScrollButtonPress + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld hl, CeruleanHouse1Text_1cfd3 + call PrintText + ld a, HS_CERULEAN_BULBASAUR + ld [wMissableObjectIndex], a + predef HideObject + SetEvent EVENT_GOT_BULBASAUR_IN_CERULEAN +.asm_1cfb3 + jp TextScriptEnd + +.asm_1cfb6 + ld hl, CeruleanHouse1Text_1cfdf + call PrintText + jp TextScriptEnd + +.asm_1cfbf + ld hl, CeruleanHouse1Text_1cfd9 + call PrintText + jp TextScriptEnd + +CeruleanHouse1Text_1cfc8: + TX_FAR MelanieText1 + TX_WAIT_BUTTON + db "@" + +CeruleanHouse1Text_1cfce: + TX_FAR MelanieText2 + db "@" + +CeruleanHouse1Text_1cfd3: + TX_FAR MelanieText3 + TX_WAIT_BUTTON + db "@" + +CeruleanHouse1Text_1cfd9: + TX_FAR MelanieText4 + TX_WAIT_BUTTON + db "@" + +CeruleanHouse1Text_1cfdf: + TX_FAR MelanieText5 + TX_WAIT_BUTTON db "@" CeruleanHouse1Text2: + TX_FAR MelanieBulbasaurText + TX_ASM + ld a, BULBASAUR + call PlayCry + jp TextScriptEnd + +CeruleanHouse1Text3: + TX_FAR MelanieOddishText + TX_ASM + ld a, ODDISH + call PlayCry + jp TextScriptEnd + +CeruleanHouse1Text4: + TX_FAR MelanieSandshrewText TX_ASM - ld a, $6 - ld [wWhichTrade], a - predef DoInGameTradeDialogue + ld a, SANDSHREW + call PlayCry jp TextScriptEnd diff --git a/scripts/ceruleanpokecenter.asm b/scripts/ceruleanpokecenter.asm index b758f497..876d2bbd 100755 --- a/scripts/ceruleanpokecenter.asm +++ b/scripts/ceruleanpokecenter.asm @@ -7,6 +7,7 @@ CeruleanPokecenterTextPointers: dw CeruleanPokecenterText2 dw CeruleanPokecenterText3 dw CeruleanTradeNurseText + dw CeruleanPokecenterText5 CeruleanTradeNurseText: TX_CABLE_CLUB_RECEPTIONIST @@ -21,3 +22,8 @@ CeruleanPokecenterText2: CeruleanPokecenterText3: TX_FAR _CeruleanPokecenterText3 db "@" + +CeruleanPokecenterText5: + TX_ASM + callab PokecenterChanseyText + jp TextScriptEnd diff --git a/scripts/cinnabargym.asm b/scripts/cinnabargym.asm index 4cae9989..1ebf943a 100755 --- a/scripts/cinnabargym.asm +++ b/scripts/cinnabargym.asm @@ -3,7 +3,7 @@ CinnabarGymScript: call EnableAutoTextBoxDrawing ld hl, CinnabarGymScriptPointers ld a, [wCinnabarGymCurScript] - jp CallFunctionInTable + jp JumpTable CinnabarGymScript_75759: ld hl, wCurrentMapScriptFlags @@ -35,11 +35,14 @@ CinnabarGymScript_75792: ld [wOpponentAfterWrongAnswer], a ret -CinnabarGymScript_757a0: +CinnabarGymScript_74f48: ld a, [hSpriteIndexOrTextID] ld [wTrainerHeaderFlagBit], a ret +CinnabarGymFlagAction: + predef_jump FlagActionPredef + CinnabarGymScriptPointers: dw CinnabarGymScript0 dw CinnabarGymScript1 @@ -55,12 +58,18 @@ CinnabarGymScript0: jr nz, .asm_757c3 ld a, PLAYER_DIR_DOWN ld [wPlayerMovingDirection], a + ld hl, PikachuMovementData_74f97 + ld b, SPRITE_FACING_DOWN + call CinnabarGymScript_74fa3 ld de, MovementData_757d7 jr .asm_757cb .asm_757c3 - ld de, MovementData_757da ld a, PLAYER_DIR_RIGHT ld [wPlayerMovingDirection], a + ld hl, PikachuMovementData_74f9e + ld b, SPRITE_FACING_RIGHT + call CinnabarGymScript_74fa3 + ld de, MovementData_757da .asm_757cb call MoveSprite ld a, $1 @@ -73,10 +82,39 @@ MovementData_757d7: db NPC_MOVEMENT_UP db $FF +PikachuMovementData_74f97: + db $00 + db $20 + db $1e + db $35 + db $3f + MovementData_757da: db NPC_MOVEMENT_LEFT db $FF +PikachuMovementData_74f9e: + db $00 + db $1d + db $1f + db $38 + db $3f + +CinnabarGymScript_74fa3: + ld a, [wd472] + bit 7, a + ret z + push hl + push bc + callab GetPikachuFacingDirectionAndReturnToE + pop bc + pop hl + ld a, b + cp e + ret nz + call ApplyPikachuMovementData + ret + CinnabarGymScript1: ld a, [wd730] bit 0, a @@ -88,52 +126,74 @@ CinnabarGymScript1: ld [hSpriteIndexOrTextID], a jp DisplayTextID -CinnabarGymFlagAction: - predef_jump FlagActionPredef - CinnabarGymScript2: + call CinnabarGymScript_753e9 ld a, [wIsInBattle] cp $ff jp z, CinnabarGymScript_75792 ld a, [wTrainerHeaderFlagBit] - ld [$ffdb], a - AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2 + sub 2 ld c, a ld b, FLAG_TEST - EventFlagAddress hl, EVENT_BEAT_CINNABAR_GYM_TRAINER_0 + EventFlagAddress hl, EVENT_CINNABAR_GYM_GATE0_UNLOCKED call CinnabarGymFlagAction ld a, c and a - jr nz, .asm_7581b + jr nz, .asm_7500d + ld a, [wTrainerHeaderFlagBit] + cp 2 + jr z, .asm_7500d + ld c, 30 + call DelayFrames + call CinnabarGymScript_75023 + call CinnabarGymScript_75041 call WaitForSoundToFinish ld a, SFX_GO_INSIDE call PlaySound call WaitForSoundToFinish -.asm_7581b + jr .asm_75013 +.asm_7500d + call CinnabarGymScript_75023 + call CinnabarGymScript_75041 +.asm_75013 + xor a + ld [wJoyIgnore], a + ld [wOpponentAfterWrongAnswer], a + ld a, $0 + ld [wCinnabarGymCurScript], a + ld [wCurMapScript], a + ret + +CinnabarGymScript_75023: ld a, [wTrainerHeaderFlagBit] ld [$ffdb], a - AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2 ld c, a ld b, FLAG_SET EventFlagAddress hl, EVENT_BEAT_CINNABAR_GYM_TRAINER_0 call CinnabarGymFlagAction + ret + +CinnabarGymScript_75032: ld a, [wTrainerHeaderFlagBit] - sub $2 - AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0 + ld [$ffdb], a + ld c, a + ld b, FLAG_TEST + EventFlagAddress hl, EVENT_BEAT_CINNABAR_GYM_TRAINER_0 + call CinnabarGymFlagAction + ret + +CinnabarGymScript_75041: + ld a, [wTrainerHeaderFlagBit] + sub 2 ld c, a ld b, FLAG_SET EventFlagAddress hl, EVENT_CINNABAR_GYM_GATE0_UNLOCKED call CinnabarGymFlagAction call UpdateCinnabarGymGateTileBlocks - xor a - ld [wJoyIgnore], a - ld [wOpponentAfterWrongAnswer], a - ld a, $0 - ld [wCinnabarGymCurScript], a - ld [wCurMapScript], a ret CinnabarGymScript3: + call CinnabarGymScript_753e9 ld a, [wIsInBattle] cp $ff jp z, CinnabarGymScript_75792 @@ -184,7 +244,7 @@ CinnabarGymTextPointers: dw ReceivedTM38Text dw TM38NoRoomText -CinnabarGymScript_758b7: +CinnabarGymScript_750c3: ld a, [hSpriteIndexOrTextID] ld [wSpriteIndex], a call EngageMapTrainer @@ -225,7 +285,7 @@ CinnabarGymText1: call SaveEndBattleTextPointers ld a, $7 ld [wGymLeaderNo], a - jp CinnabarGymScript_758b7 + jp CinnabarGymScript_750c3 BlaineBattleText: TX_FAR _BlaineBattleText @@ -257,7 +317,7 @@ TM38NoRoomText: CinnabarGymText2: TX_ASM - call CinnabarGymScript_757a0 + call CinnabarGymScript_74f48 CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_0 jr nz, .asm_46bb4 ld hl, CinnabarGymText_7595f @@ -265,7 +325,7 @@ CinnabarGymText2: ld hl, CinnabarGymText_75964 ld de, CinnabarGymText_75964 call SaveEndBattleTextPointers - jp CinnabarGymScript_758b7 + jp CinnabarGymScript_750c3 .asm_46bb4 ld hl, CinnabarGymText_75969 call PrintText @@ -285,16 +345,25 @@ CinnabarGymText_75969: CinnabarGymText3: TX_ASM - call CinnabarGymScript_757a0 + call CinnabarGymScript_74f48 CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_1 - jr nz, .asm_4b406 + jr nz, .asm_751a8 + call CinnabarGymScript_753f3 + jr nz, .asm_75196 + CheckEvent EVENT_CINNABAR_GYM_GATE1_UNLOCKED + jr nz, .asm_75196 + ld e, $00 + jp CinnabarGymScript_753de + +.asm_75196 ld hl, CinnabarGymText_75994 call PrintText ld hl, CinnabarGymText_75999 ld de, CinnabarGymText_75999 call SaveEndBattleTextPointers - jp CinnabarGymScript_758b7 -.asm_4b406 + jp CinnabarGymScript_750c3 + +.asm_751a8 ld hl, CinnabarGymText_7599e call PrintText jp TextScriptEnd @@ -313,16 +382,24 @@ CinnabarGymText_7599e: CinnabarGymText4: TX_ASM - call CinnabarGymScript_757a0 + call CinnabarGymScript_74f48 CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_2 - jr nz, .asm_c0673 + jr nz, .asm_751ee + call CinnabarGymScript_753f3 + jr nz, .asm_751dc + CheckEvent EVENT_CINNABAR_GYM_GATE2_UNLOCKED + jr nz, .asm_751dc + ld e, $1 + jp CinnabarGymScript_753de + +.asm_751dc ld hl, CinnabarGymText_759c9 call PrintText ld hl, CinnabarGymText_759ce ld de, CinnabarGymText_759ce call SaveEndBattleTextPointers - jp CinnabarGymScript_758b7 -.asm_c0673 + jp CinnabarGymScript_750c3 +.asm_751ee ld hl, CinnabarGymText_759d3 call PrintText jp TextScriptEnd @@ -341,16 +418,24 @@ CinnabarGymText_759d3: CinnabarGymText5: TX_ASM - call CinnabarGymScript_757a0 + call CinnabarGymScript_74f48 CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_3 - jr nz, .asm_5cfd7 + jr nz, .asm_75234 + call CinnabarGymScript_753f3 + jr nz, .asm_75222 + CheckEvent EVENT_CINNABAR_GYM_GATE3_UNLOCKED + jr nz, .asm_75222 + ld e, $2 + jp CinnabarGymScript_753de + +.asm_75222 ld hl, CinnabarGymText_759fe call PrintText ld hl, CinnabarGymText_75a03 ld de, CinnabarGymText_75a03 call SaveEndBattleTextPointers - jp CinnabarGymScript_758b7 -.asm_5cfd7 + jp CinnabarGymScript_750c3 +.asm_75234 ld hl, CinnabarGymText_75a08 call PrintText jp TextScriptEnd @@ -369,15 +454,23 @@ CinnabarGymText_75a08: CinnabarGymText6: TX_ASM - call CinnabarGymScript_757a0 + call CinnabarGymScript_74f48 CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_4 jr nz, .asm_776b4 + call CinnabarGymScript_753f3 + jr nz, .asm_75222 + CheckEvent EVENT_CINNABAR_GYM_GATE4_UNLOCKED + jr nz, .asm_75222 + ld e, $3 + jp CinnabarGymScript_753de + +.asm_75222 ld hl, CinnabarGymText_75a33 call PrintText ld hl, CinnabarGymText_75a38 ld de, CinnabarGymText_75a38 call SaveEndBattleTextPointers - jp CinnabarGymScript_758b7 + jp CinnabarGymScript_750c3 .asm_776b4 ld hl, CinnabarGymText_75a3d call PrintText @@ -397,15 +490,23 @@ CinnabarGymText_75a3d: CinnabarGymText7: TX_ASM - call CinnabarGymScript_757a0 + call CinnabarGymScript_74f48 CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_5 jr nz, .asm_2f755 + call CinnabarGymScript_753f3 + jr nz, .asm_75222 + CheckEvent EVENT_CINNABAR_GYM_GATE5_UNLOCKED + jr nz, .asm_75222 + ld e, $4 + jp CinnabarGymScript_753de + +.asm_75222 ld hl, CinnabarGymText_75a68 call PrintText ld hl, CinnabarGymText_75a6d ld de, CinnabarGymText_75a6d call SaveEndBattleTextPointers - jp CinnabarGymScript_758b7 + jp CinnabarGymScript_750c3 .asm_2f755 ld hl, CinnabarGymText_75a72 call PrintText @@ -425,15 +526,23 @@ CinnabarGymText_75a72: CinnabarGymText8: TX_ASM - call CinnabarGymScript_757a0 + call CinnabarGymScript_74f48 CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_6 jr nz, .asm_d87be + call CinnabarGymScript_753f3 + jr nz, .asm_75222 + CheckEvent EVENT_CINNABAR_GYM_GATE6_UNLOCKED + jr nz, .asm_75222 + ld e, $5 + jp CinnabarGymScript_753de + +.asm_75222 ld hl, CinnabarGymText_75a9d call PrintText ld hl, CinnabarGymText_75aa2 ld de, CinnabarGymText_75aa2 call SaveEndBattleTextPointers - jp CinnabarGymScript_758b7 + jp CinnabarGymScript_750c3 .asm_d87be ld hl, CinnabarGymText_75aa7 call PrintText @@ -453,20 +562,5 @@ CinnabarGymText_75aa7: CinnabarGymText9: TX_ASM - CheckEvent EVENT_BEAT_BLAINE - jr nz, .asm_627d9 - ld hl, CinnabarGymText_75ac2 - jr .asm_0b11d -.asm_627d9 - ld hl, CinnabarGymText_75ac7 -.asm_0b11d - call PrintText + callab Func_f2133 jp TextScriptEnd - -CinnabarGymText_75ac2: - TX_FAR _CinnabarGymText_75ac2 - db "@" - -CinnabarGymText_75ac7: - TX_FAR _CinnabarGymText_75ac7 - db "@" diff --git a/scripts/cinnabargym2.asm b/scripts/cinnabargym2.asm new file mode 100755 index 00000000..00118fb5 --- /dev/null +++ b/scripts/cinnabargym2.asm @@ -0,0 +1,18 @@ +CinnabarGymScript_753de: + callab Func_f2150 + jp TextScriptEnd + +CinnabarGymScript_753e9: + push hl + ld hl, wd475 + bit 7, [hl] + res 7, [hl] + pop hl + ret + +CinnabarGymScript_753f3: + push hl + ld hl, wd475 + bit 7, [hl] + pop hl + ret diff --git a/scripts/cinnabargym3.asm b/scripts/cinnabargym3.asm new file mode 100755 index 00000000..9e8cad74 --- /dev/null +++ b/scripts/cinnabargym3.asm @@ -0,0 +1,64 @@ +Func_f2133: + CheckEvent EVENT_BEAT_BLAINE + jr nz, .asm_627d9 + ld hl, CinnabarGymText_75ac2 + jr .asm_0b11d +.asm_627d9 + ld hl, CinnabarGymText_75ac7 +.asm_0b11d + call PrintText + ret + +CinnabarGymText_75ac2: + TX_FAR _CinnabarGymText_75ac2 + db "@" + +CinnabarGymText_75ac7: + TX_FAR _CinnabarGymText_75ac7 + db "@" + +Func_f2150: + ld hl, TextPointers_f215d + ld d, 0 + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp PrintText + +TextPointers_f215d: + dw CinnabarGymText_f2169 + dw CinnabarGymText_f216e + dw CinnabarGymText_f2173 + dw CinnabarGymText_f2178 + dw CinnabarGymText_f217d + dw CinnabarGymText_f2182 + +CinnabarGymText_f2169: + TX_FAR _CinnabarGymText_1 + db "@" + +CinnabarGymText_f216e: + TX_FAR _CinnabarGymText_2 + db "@" + +CinnabarGymText_f2173: + TX_FAR _CinnabarGymText_3 + db "@" + +CinnabarGymText_f2178: + TX_FAR _CinnabarGymText_4 + db "@" + +CinnabarGymText_f217d: + TX_FAR _CinnabarGymText_5 + db "@" + +CinnabarGymText_f2182: + TX_FAR _CinnabarGymText_6 + db "@" + +CinnabarGymText_f2187: + TX_FAR _CinnabarGymText_7 ; unused + db "@" diff --git a/scripts/cinnabarisland.asm b/scripts/cinnabarisland.asm index 8549042f..4dbec159 100755 --- a/scripts/cinnabarisland.asm +++ b/scripts/cinnabarisland.asm @@ -6,7 +6,7 @@ CinnabarIslandScript: ResetEvent EVENT_LAB_STILL_REVIVING_FOSSIL ld hl, CinnabarIslandScriptPointers ld a, [wCinnabarIslandCurScript] - jp CallFunctionInTable + jp JumpTable CinnabarIslandScriptPointers: dw CinnabarIslandScript0 @@ -35,7 +35,7 @@ CinnabarIslandScript0: ld [wSimulatedJoypadStatesEnd], a call StartSimulatingJoypadStates xor a - ld [wSpriteStateData1 + 9], a + ld [wPlayerFacingDirection], a ld [wJoyIgnore], a ld a, $1 ld [wCinnabarIslandCurScript], a diff --git a/scripts/cinnabarpokecenter.asm b/scripts/cinnabarpokecenter.asm index 2f6d5791..a43e5385 100755 --- a/scripts/cinnabarpokecenter.asm +++ b/scripts/cinnabarpokecenter.asm @@ -7,6 +7,7 @@ CinnabarPokecenterTextPointers: dw CinnabarPokecenterText2 dw CinnabarPokecenterText3 dw CinnabarTradeNurseText + dw CinnabarPokecenterText5 CinnabarHealNurseText: TX_POKECENTER_NURSE @@ -21,3 +22,8 @@ CinnabarPokecenterText3: CinnabarTradeNurseText: TX_CABLE_CLUB_RECEPTIONIST + +CinnabarPokecenterText5: + TX_ASM + callab PokecenterChanseyText + jp TextScriptEnd diff --git a/scripts/colosseum.asm b/scripts/colosseum.asm index bdfa3c44..bdfa3c44 100755..100644 --- a/scripts/colosseum.asm +++ b/scripts/colosseum.asm diff --git a/scripts/copycatshouse2f.asm b/scripts/copycatshouse2f.asm index 830bad50..7bf8d0e9 100755 --- a/scripts/copycatshouse2f.asm +++ b/scripts/copycatshouse2f.asm @@ -82,7 +82,7 @@ CopycatsHouse2FText6: CopycatsHouse2FText7: TX_ASM - ld a, [wSpriteStateData1 + 9] + ld a, [wPlayerFacingDirection] cp SPRITE_FACING_UP ld hl, CopycatsHouse2FText_5cd1c jr nz, .notUp diff --git a/scripts/daycarem.asm b/scripts/daycarem.asm index 60daa3d5..187f8579 100755 --- a/scripts/daycarem.asm +++ b/scripts/daycarem.asm @@ -50,11 +50,21 @@ DayCareMText1: ld a, PARTY_TO_DAYCARE ld [wMoveMonType], a call MoveMon + callab IsThisPartymonStarterPikachu + push af xor a ld [wRemoveMonFromBox], a call RemovePokemon + pop af + jr c, .depositedPikachuIntoDayCare ld a, [wcf91] call PlayCry + jr .asm_562e3 + +.depositedPikachuIntoDayCare + ldpikacry e, PikachuCry28 + callab PlayPikachuSoundClip +.asm_562e3 ld hl, DayCareComeSeeMeInAWhileText jp .done @@ -197,8 +207,27 @@ DayCareMText1: ld a, [hl] ld [de], a + ld a, [wPartyCount] + dec a + ld [wWhichPokemon], a + callab IsThisPartymonStarterPikachu + jr c, .withdrewPikachuFromDayCare ld a, [wcf91] call PlayCry + jr .asm_56430 + +.withdrewPikachuFromDayCare + ld a, $6 + ld [wPikachuSpawnState], a + + ; GameFreak... TriHard + ld hl, SchedulePikachuSpawnForAfterText + ld b, BANK(SchedulePikachuSpawnForAfterText) + ld hl, Bankswitch + + ldpikacry e, PikachuCry35 + callab PlayPikachuSoundClip +.asm_56430 ld hl, DayCareGotMonBackText jr .done diff --git a/scripts/fanclub.asm b/scripts/fanclub.asm index f4244e46..01d6269b 100755 --- a/scripts/fanclub.asm +++ b/scripts/fanclub.asm @@ -1,15 +1,72 @@ FanClubScript: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ld hl, FanClubScriptPointers + ld a, [wFanClubCurScript] + call JumpTable + ret -FanClubBikeInBag: -; check if any bike paraphernalia in bag - CheckEvent EVENT_GOT_BIKE_VOUCHER - ret nz - ld b, BICYCLE - call IsItemInBag - ret nz - ld b, BIKE_VOUCHER - jp IsItemInBag +FanClubScriptPointers: + dw FanClubScript1 + dw FanClubScript2 + +FanClubScript1: + ld hl, wd492 + bit 7, [hl] + call z, FanClubScript_59a44 + ld hl, wd492 + set 7, [hl] + ret + +FanClubScript2: + ld hl, wd492 + bit 7, [hl] + call z, FanClubScript_59a39 + ld hl, wd492 + set 7, [hl] + ret + +FanClubScript_59a39: + call Random + ld a, [hRandomAdd] + cp 25 + call c, FanClubScript_59a44 + ret + +FanClubScript_59a44: + ld a, [wd472] + bit 7, a + ret z + callab CheckPikachuFaintedOrStatused + ret c + ld a, $1 + ld [wFanClubCurScript], a + xor a + ld [wPlayerMovingDirection], a + call UpdateSprites + call UpdateSprites + ld a, $0 + ld [wWhichEmotionBubble], a + ld a, $f ; Pikachu + ld [wEmotionBubbleSpriteIndex], a + predef EmotionBubble + ld hl, PikachuMovementScript_59a8c + call ApplyPikachuMovementData + ld a, $2 + ld [wSpriteStateData1 + 3 * $10 + 1], a ; Seel + xor a ; SPRITE_FACING_DOWN + ld [wSpriteStateData1 + 3 * $10 + 9], a + callab InitializePikachuTextID + call DisablePikachuFollowingPlayer + ret + +PikachuMovementScript_59a8c: + db $00 + db $26 + db $20 + db $20 + db $20 + db $1e + db $3f FanClubTextPointers: dw FanClubText1 @@ -18,22 +75,28 @@ FanClubTextPointers: dw FanClubText4 dw FanClubText5 dw FanClubText6 - dw FanClubText7 - dw FanClubText8 FanClubText1: -; pikachu fan +; clefairy fan TX_ASM - CheckEvent EVENT_PIKACHU_FAN_BOAST + CheckEventHL EVENT_152 + jr z, .asm_59aaf + ld hl, .yellowtext + call PrintText + jr .done + +.asm_59aaf + CheckEventReuseHL EVENT_PIKACHU_FAN_BOAST jr nz, .mineisbetter + SetEventReuseHL EVENT_SEEL_FAN_BOAST ld hl, .normaltext call PrintText - SetEvent EVENT_SEEL_FAN_BOAST jr .done + .mineisbetter + ResetEventReuseHL EVENT_PIKACHU_FAN_BOAST ld hl, .bettertext call PrintText - ResetEvent EVENT_PIKACHU_FAN_BOAST .done jp TextScriptEnd @@ -45,19 +108,29 @@ FanClubText1: TX_FAR PikachuFanBetterText db "@" +.yellowtext + TX_FAR PikachuFanPrintText + db "@" + FanClubText2: ; seel fan TX_ASM - CheckEvent EVENT_SEEL_FAN_BOAST + CheckEventHL EVENT_152 + jr z, .asm_59ae7 + ld hl, .yellowtext + call PrintText + jr .done +.asm_59ae7 + CheckEventReuseHL EVENT_SEEL_FAN_BOAST jr nz, .mineisbetter + SetEventReuseHL EVENT_PIKACHU_FAN_BOAST ld hl, .normaltext call PrintText - SetEvent EVENT_PIKACHU_FAN_BOAST jr .done .mineisbetter + ResetEventReuseHL EVENT_SEEL_FAN_BOAST ld hl, .bettertext call PrintText - ResetEvent EVENT_SEEL_FAN_BOAST .done jp TextScriptEnd @@ -69,12 +142,16 @@ FanClubText2: TX_FAR SeelFanBetterText db "@" +.yellowtext + TX_FAR SeelFanPrintText + db "@" + FanClubText3: ; pikachu TX_ASM ld hl, .text call PrintText - ld a, PIKACHU + ld a, CLEFAIRY call PlayCry call WaitForSoundToFinish jp TextScriptEnd @@ -100,74 +177,131 @@ FanClubText4: FanClubText5: ; chair TX_ASM - call FanClubBikeInBag - jr nz, .nothingleft - - ld hl, .meetchairtext + CheckEventHL EVENT_152 + jr z, .check_bike_voucher + ld hl, Text_59c1f call PrintText call YesNoChoice ld a, [wCurrentMenuItem] and a - jr nz, .nothanks + jr z, .select_mon_to_print + ld hl, Text_59c24 + jr .gbpals_print_text - ; tell the story - ld hl, .storytext +.check_bike_voucher + CheckEvent EVENT_GOT_BIKE_VOUCHER + jr nz, .got_bike_voucher_already + ld hl, Text_59bfc + call PrintText + call YesNoChoice + ld a, [wCurrentMenuItem] + and a + jr nz, .declined_story + ld hl, Text_59c01 call PrintText lb bc, BIKE_VOUCHER, 1 call GiveItem - jr nc, .BagFull - ld hl, .receivedvouchertext + jr nc, .no_room_for_voucher + ld hl, Text_59c06 call PrintText SetEvent EVENT_GOT_BIKE_VOUCHER - jr .done -.BagFull - ld hl, .bagfulltext - call PrintText - jr .done -.nothanks - ld hl, .nostorytext - call PrintText - jr .done -.nothingleft - ld hl, .finaltext + jp TextScriptEnd + +.no_room_for_voucher + ld hl, Text_59c1a + jr .gbpals_print_text + +.declined_story + ld hl, Text_59c10 + jr .gbpals_print_text + +.got_bike_voucher_already + ld hl, Text_59c15 +.gbpals_print_text + push hl + call LoadGBPal + pop hl call PrintText -.done jp TextScriptEnd -.meetchairtext +.select_mon_to_print + call GBPalWhiteOutWithDelay3 + call LoadCurrentMapView + call SaveScreenTilesToBuffer2 + ld a, $ff + ld [wUpdateSpritesEnabled], a + ld a, $00 + ld [wTempTilesetNumTiles], a + call DisplayPartyMenu + jp nc, .print + call GBPalWhiteOutWithDelay3 + call RestoreScreenTilesAndReloadTilePatterns + ld hl, Text_59c24 + jr .gbpals_print_text + +.print + xor a + ld [wUpdateSpritesEnabled], a + ld hl, wd730 + set 6, [hl] + callab PrintFanClubPortrait + ld hl, wd730 + res 6, [hl] + call GBPalWhiteOutWithDelay3 + call ReloadTilesetTilePatterns + call RestoreScreenTilesAndReloadTilePatterns + call LoadScreenTilesFromBuffer2 + call Delay3 + call GBPalNormal + ld hl, Text_59c2e + ld a, [hOaksAideResult] + and a + jr nz, .gbpals_print_text + ld hl, Text_59c29 + jr .gbpals_print_text + +Text_59bfc: TX_FAR FanClubMeetChairText db "@" -.storytext +Text_59c01: TX_FAR FanClubChairStoryText db "@" -.receivedvouchertext +Text_59c06: TX_FAR ReceivedBikeVoucherText - db $11 + TX_SFX_KEY_ITEM TX_FAR ExplainBikeVoucherText db "@" -.nostorytext +Text_59c10: TX_FAR FanClubNoStoryText db "@" -.finaltext +Text_59c15: TX_FAR FanClubChairFinalText db "@" -.bagfulltext +Text_59c1a: TX_FAR FanClubBagFullText db "@" -FanClubText6: - TX_FAR _FanClubText6 +Text_59c1f: + TX_FAR FanClubChairPrintText1 + db "@" + +Text_59c24: + TX_FAR FanClubChairPrintText2 + db "@" + +Text_59c29: + TX_FAR FanClubChairPrintText3 db "@" -FanClubText7: - TX_FAR _FanClubText7 +Text_59c2e: + TX_FAR FanClubChairPrintText4 db "@" -FanClubText8: - TX_FAR _FanClubText8 +FanClubText6: + TX_FAR _FanClubText6 db "@" diff --git a/scripts/fuchsiamart.asm b/scripts/fuchsiamart.asm index 96df9290..32dbe773 100755 --- a/scripts/fuchsiamart.asm +++ b/scripts/fuchsiamart.asm @@ -1,5 +1,6 @@ FuchsiaMartScript: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret FuchsiaMartTextPointers: dw FuchsiaCashierText diff --git a/scripts/fuchsiapokecenter.asm b/scripts/fuchsiapokecenter.asm index a6111e84..50f5ba76 100755 --- a/scripts/fuchsiapokecenter.asm +++ b/scripts/fuchsiapokecenter.asm @@ -7,6 +7,7 @@ FuchsiaPokecenterTextPointers: dw FuchsiaPokecenterText2 dw FuchsiaPokecenterText3 dw FuchsiaTradeNurseText + dw FuchsiaPokecenterText5 FuchsiaHealNurseText: TX_POKECENTER_NURSE @@ -21,3 +22,8 @@ FuchsiaPokecenterText3: FuchsiaTradeNurseText: TX_CABLE_CLUB_RECEPTIONIST + +FuchsiaPokecenterText5: + TX_ASM + callab PokecenterChanseyText + jp TextScriptEnd diff --git a/scripts/gary.asm b/scripts/gary.asm index 1fe65fb0..ef1a7328 100755 --- a/scripts/gary.asm +++ b/scripts/gary.asm @@ -2,7 +2,8 @@ GaryScript: call EnableAutoTextBoxDrawing ld hl, GaryScriptPointers ld a, [wGaryCurScript] - jp CallFunctionInTable + call JumpTable + ret ResetGaryScript: xor a @@ -40,9 +41,9 @@ GaryScript1: ret GaryEntrance_RLEMovement: - db D_UP,1 - db D_RIGHT,1 - db D_UP,3 + db D_UP, 1 + db D_RIGHT, 1 + db D_UP, 3 db $ff GaryScript2: @@ -69,18 +70,7 @@ GaryScript2: ; select which team to use during the encounter ld a, [wRivalStarter] - cp STARTER2 - jr nz, .NotStarter2 - ld a, $1 - jr .saveTrainerId -.NotStarter2 - cp STARTER3 - jr nz, .NotStarter3 - ld a, $2 - jr .saveTrainerId -.NotStarter3 - ld a, $3 -.saveTrainerId + add $0 ; Wow GameFreak ld [wTrainerNo], a xor a @@ -217,8 +207,8 @@ GaryScript9: ret WalkToHallOfFame_RLEMovment: - db D_UP,4 - db D_LEFT,1 + db D_UP, 4 + db D_LEFT, 1 db $ff GaryScript10: diff --git a/scripts/halloffameroom.asm b/scripts/halloffameroom.asm index 94e64431..1bba347b 100755 --- a/scripts/halloffameroom.asm +++ b/scripts/halloffameroom.asm @@ -2,7 +2,7 @@ HallofFameRoomScript: call EnableAutoTextBoxDrawing ld hl, HallofFameRoomScriptPointers ld a, [wHallOfFameRoomCurScript] - jp CallFunctionInTable + jp JumpTable HallofFameRoomScript_5a4aa: xor a diff --git a/scripts/indigoplateaulobby.asm b/scripts/indigoplateaulobby.asm index c26f6f0c..36ed7fd5 100755 --- a/scripts/indigoplateaulobby.asm +++ b/scripts/indigoplateaulobby.asm @@ -20,6 +20,7 @@ IndigoPlateauLobbyTextPointers: dw IndigoPlateauLobbyText3 dw IndigoCashierText dw IndigoTradeNurseText + dw IndigoPlateauLobbyText6 IndigoHealNurseText: TX_POKECENTER_NURSE @@ -34,3 +35,8 @@ IndigoPlateauLobbyText3: IndigoTradeNurseText: TX_CABLE_CLUB_RECEPTIONIST + +IndigoPlateauLobbyText6: + TX_ASM + callab PokecenterChanseyText + jp TextScriptEnd diff --git a/scripts/lance.asm b/scripts/lance.asm index b0ec7f6a..7d67f6cd 100755 --- a/scripts/lance.asm +++ b/scripts/lance.asm @@ -18,23 +18,22 @@ LanceShowOrHideEntranceBlocks: ; open entrance ld a, $31 ld b, $32 - jp LanceSetEntranceBlocks + jp .LanceSetEntranceBlocks + .closeEntrance ld a, $72 ld b, $73 - -LanceSetEntranceBlocks: +.LanceSetEntranceBlocks ; Replaces the tile blocks so the player can't leave. push bc ld [wNewTileBlockID], a lb bc, 6, 2 - call LanceSetEntranceBlock + call .LanceSetEntranceBlock pop bc ld a, b ld [wNewTileBlockID], a lb bc, 6, 3 - -LanceSetEntranceBlock: +.LanceSetEntranceBlock predef_jump ReplaceTileBlock ResetLanceScript: @@ -110,7 +109,7 @@ WalkToLance: ret WalkToLance_RLEList: - db D_UP, $0C + db D_UP, $0D db D_LEFT, $0C db D_DOWN, $07 db D_LEFT, $06 diff --git a/scripts/lavenderpokecenter.asm b/scripts/lavenderpokecenter.asm index 61d0b887..67960c1b 100755 --- a/scripts/lavenderpokecenter.asm +++ b/scripts/lavenderpokecenter.asm @@ -7,6 +7,7 @@ LavenderPokecenterTextPointers: dw LavenderPokecenterText2 dw LavenderPokecenterText3 dw LavenderTradeNurseText + dw LavenderPokecenterText5 LavenderTradeNurseText: TX_CABLE_CLUB_RECEPTIONIST @@ -21,3 +22,8 @@ LavenderPokecenterText2: LavenderPokecenterText3: TX_FAR _LavenderPokecenterText3 db "@" + +LavenderPokecenterText5: + TX_ASM + callab PokecenterChanseyText + jp TextScriptEnd diff --git a/scripts/mansion1.asm b/scripts/mansion1.asm index e37a09cd..fb0a92bc 100755 --- a/scripts/mansion1.asm +++ b/scripts/mansion1.asm @@ -46,7 +46,7 @@ Mansion1ReplaceBlock: ret Mansion1Script_Switches: - ld a, [wSpriteStateData1 + 9] + ld a, [wPlayerFacingDirection] cp SPRITE_FACING_UP ret nz xor a diff --git a/scripts/mansion2.asm b/scripts/mansion2.asm index a9f9ffec..0ba8a245 100755 --- a/scripts/mansion2.asm +++ b/scripts/mansion2.asm @@ -42,7 +42,7 @@ Mansion2Script_5202f: predef_jump ReplaceTileBlock Mansion2Script_Switches: - ld a, [wSpriteStateData1 + 9] + ld a, [wPlayerFacingDirection] cp SPRITE_FACING_UP ret nz xor a diff --git a/scripts/mansion3.asm b/scripts/mansion3.asm index afb46671..c71979d5 100755 --- a/scripts/mansion3.asm +++ b/scripts/mansion3.asm @@ -73,7 +73,7 @@ Mansion3Script_5225b: ret Mansion3Script_Switches: - ld a, [wSpriteStateData1 + 9] + ld a, [wPlayerFacingDirection] cp SPRITE_FACING_UP ret nz xor a diff --git a/scripts/mansion4.asm b/scripts/mansion4.asm index 5ae3fea2..12420990 100755 --- a/scripts/mansion4.asm +++ b/scripts/mansion4.asm @@ -44,7 +44,7 @@ Mansion4Script_523cf: ret Mansion4Script_Switches: - ld a, [wSpriteStateData1 + 9] + ld a, [wPlayerFacingDirection] cp SPRITE_FACING_UP ret nz xor a diff --git a/scripts/mtmoon1.asm b/scripts/mtmoon1.asm index 11f7e2e4..604e490a 100755 --- a/scripts/mtmoon1.asm +++ b/scripts/mtmoon1.asm @@ -97,42 +97,37 @@ MtMoon1TrainerHeader7: MtMoon1Text1: TX_ASM ld hl, MtMoon1TrainerHeader0 - call TalkToTrainer - jp TextScriptEnd + jr MtMoon1TalkToTrainer MtMoon1Text2: TX_ASM ld hl, MtMoon1TrainerHeader2 - call TalkToTrainer - jp TextScriptEnd + jr MtMoon1TalkToTrainer MtMoon1Text3: TX_ASM ld hl, MtMoon1TrainerHeader3 - call TalkToTrainer - jp TextScriptEnd + jr MtMoon1TalkToTrainer MtMoon1Text4: TX_ASM ld hl, MtMoon1TrainerHeader4 - call TalkToTrainer - jp TextScriptEnd + jr MtMoon1TalkToTrainer MtMoon1Text5: TX_ASM ld hl, MtMoon1TrainerHeader5 - call TalkToTrainer - jp TextScriptEnd + jr MtMoon1TalkToTrainer MtMoon1Text6: TX_ASM ld hl, MtMoon1TrainerHeader6 - call TalkToTrainer - jp TextScriptEnd + jr MtMoon1TalkToTrainer MtMoon1Text7: TX_ASM ld hl, MtMoon1TrainerHeader7 +MtMoon1TalkToTrainer: call TalkToTrainer jp TextScriptEnd diff --git a/scripts/mtmoon3.asm b/scripts/mtmoon3.asm index 27651ef9..b8d14bd5 100755 --- a/scripts/mtmoon3.asm +++ b/scripts/mtmoon3.asm @@ -1,6 +1,6 @@ MtMoon3Script: call EnableAutoTextBoxDrawing - ld hl, MtMoon3TrainerHeader0 + ld hl, MtMoon3TrainerHeaders ld de, MtMoon3ScriptPointers ld a, [wMtMoon3CurScript] call ExecuteCurMapScriptInTable @@ -37,13 +37,23 @@ CoordsData_49d37: db $08,$0E db $FF -MtMoon3Script_49d58: +MtMoon3Script_49cd7: + CheckAndResetEvent EVENT_57E + call nz, MtMoon3Script_49cec xor a ld [wJoyIgnore], a +MtMoon3Script_49ce5: ld [wMtMoon3CurScript], a ld [wCurMapScript], a ret +MtMoon3Script_49cec: + ld a, HS_MT_MOON_JESSIE + call MtMoon3Script_49f93 + ld a, HS_MT_MOON_JAMES + call MtMoon3Script_49f93 + ret + MtMoon3ScriptPointers: dw MtMoon3Script0 dw DisplayEnemyTrainerTextAndStartBattle @@ -51,23 +61,41 @@ MtMoon3ScriptPointers: dw MtMoon3Script3 dw MtMoon3Script4 dw MtMoon3Script5 + dw MtMoon3Script6 + dw MtMoon3Script7 + dw MtMoon3Script8 + dw MtMoon3Script9 + dw MtMoon3Script10 + dw MtMoon3Script11 + dw MtMoon3Script12 + dw MtMoon3Script13 + dw MtMoon3Script14 + dw MtMoon3Script15 MtMoon3Script0: + CheckEitherEventSet EVENT_GOT_DOME_FOSSIL, EVENT_GOT_HELIX_FOSSIL + call z, MtMoon3Script_49d28 + CheckEvent EVENT_BEAT_MT_MOON_3_TRAINER_0 + call z, MtMoon3Script_49e15 + ret + +MtMoon3Script_49d28: CheckEvent EVENT_BEAT_MT_MOON_EXIT_SUPER_NERD - jp nz, MtMoon3Script_49d91 + jp nz, .asm_49d4b ld a, [wYCoord] cp $8 - jp nz, MtMoon3Script_49d91 + jp nz, .asm_49d4b ld a, [wXCoord] cp $d - jp nz, MtMoon3Script_49d91 + jp nz, .asm_49d4b xor a ld [hJoyHeld], a ld a, $1 ld [hSpriteIndexOrTextID], a - jp DisplayTextID + call DisplayTextID + ret -MtMoon3Script_49d91: +.asm_49d4b CheckEitherEventSet EVENT_GOT_DOME_FOSSIL, EVENT_GOT_HELIX_FOSSIL jp z, CheckFightingMapTrainers ret @@ -75,57 +103,93 @@ MtMoon3Script_49d91: MtMoon3Script3: ld a, [wIsInBattle] cp $ff - jp z, MtMoon3Script_49d58 + jp z, MtMoon3Script_49cd7 call UpdateSprites call Delay3 SetEvent EVENT_BEAT_MT_MOON_EXIT_SUPER_NERD xor a ld [wJoyIgnore], a ld a, $0 - ld [wMtMoon3CurScript], a - ld [wCurMapScript], a + call MtMoon3Script_49ce5 ret MtMoon3Script4: ld a, $1 ld [H_SPRITEINDEX], a call SetSpriteMovementBytesToFF - ld hl, CoordsData_49dea + ld hl, CoordsData_49dc7 + call ArePlayerCoordsInArray + jr c, .asm_49da8 + ld hl, CoordsData_49dc0 call ArePlayerCoordsInArray - jr c, .asm_49dd7 - ld hl, CoordsData_49df1 + jr c, .asm_49db0 + ld hl, CoordsData_49dd5 call ArePlayerCoordsInArray - jp nc, CheckFightingMapTrainers - ld de, MovementData_49df9 - jr .asm_49dda -.asm_49dd7 - ld de, MovementData_49df8 -.asm_49dda + jr c, .asm_49d9b + ld hl, CoordsData_49dce + call ArePlayerCoordsInArray + jr c, .asm_49da3 + jp CheckFightingMapTrainers + +.asm_49d9b + ld b, SPRITE_FACING_LEFT + ld hl, PikachuMovementData_49dd8 + call MtMoon3Script_4a325 +.asm_49da3 + ld de, MovementData_49ddd + jr .asm_49db3 + +.asm_49da8 + ld b, SPRITE_FACING_RIGHT + ld hl, PikachuMovementData_49dca + call MtMoon3Script_4a325 +.asm_49db0 + ld de, MovementData_49ddc +.asm_49db3 ld a, $1 ld [H_SPRITEINDEX], a call MoveSprite ld a, $5 - ld [wMtMoon3CurScript], a - ld [wCurMapScript], a + call MtMoon3Script_49ce5 ret -CoordsData_49dea: +CoordsData_49dc0: db $07,$0C db $06,$0B db $05,$0C db $FF -CoordsData_49df1: +CoordsData_49dc7: + db $07,$0C + db $FF + +PikachuMovementData_49dca: + db $00 + db $35 + db $33 + db $3f + +CoordsData_49dce: db $07,$0D db $06,$0E db $05,$0E db $FF -MovementData_49df8: - db NPC_MOVEMENT_RIGHT +CoordsData_49dd5: + db $07,$0D + db $FF + +PikachuMovementData_49dd8: + db $00 + db $35 + db $34 + db $3f -MovementData_49df9: - db NPC_MOVEMENT_UP,$FF +MovementData_49ddc: + db NPC_MOVEMENT_RIGHT +MovementData_49ddd: + db NPC_MOVEMENT_UP + db $FF MtMoon3Script5: ld a, [wd730] @@ -135,23 +199,213 @@ MtMoon3Script5: ld [wJoyIgnore], a ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a - ld a, $a + ld a, $b ld [hSpriteIndexOrTextID], a call DisplayTextID - CheckEvent EVENT_GOT_DOME_FOSSIL + CheckEvent EVENT_GOT_HELIX_FOSSIL jr z, .asm_49e1d - ld a, HS_MT_MOON_3_FOSSIL_2 + ld a, HS_MT_MOON_3_FOSSIL_1 jr .asm_49e1f .asm_49e1d - ld a, HS_MT_MOON_3_FOSSIL_1 + ld a, HS_MT_MOON_3_FOSSIL_2 .asm_49e1f ld [wMissableObjectIndex], a predef HideObject xor a ld [wJoyIgnore], a ld a, $0 - ld [wMtMoon3CurScript], a - ld [wCurMapScript], a + call MtMoon3Script_49ce5 + ret + +MtMoon3Script_49e15: + ld a, [wXCoord] + cp $3 + ret nz + ld a, [wYCoord] + cp $5 + ret nz + call StopAllMusic + ld c, BANK(Music_MeetJessieJames) + ld a, MUSIC_MEET_JESSIE_JAMES + call PlayMusic + xor a + ld [hJoyHeld], a + ld a, $FF ^ (A_BUTTON | B_BUTTON) + ld [wJoyIgnore], a + ld a, HS_MT_MOON_JESSIE + call MtMoon3Script_49f84 + ld a, HS_MT_MOON_JAMES + call MtMoon3Script_49f84 + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld a, $c + ld [hSpriteIndexOrTextID], a + call DisplayTextID + xor a + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld a, $1 + ld [wSimulatedJoypadStatesIndex], a + ld a, D_UP + ld [wSimulatedJoypadStatesEnd], a + call StartSimulatingJoypadStates + ld a, $ff + ld [wJoyIgnore], a + ld a, $6 + call MtMoon3Script_49ce5 + ret + +MovementData_f9e65: + db $06 +MovementData_f9e66: + db $06 + db $06 + db $06 + db $06 + db $06 + db $FF + +MtMoon3Script6: + ld a, $ff + ld [wJoyIgnore], a + ld a, [wSimulatedJoypadStatesIndex] + and a + ret nz + call Delay3 + ld a, $2 + ld [H_SPRITEINDEX], a + ld de, MovementData_f9e65 + call MoveSprite + ld a, $ff + ld [wJoyIgnore], a + ld a, $7 + call MtMoon3Script_49ce5 + ret + +MtMoon3Script7: + ld a, $ff + ld [wJoyIgnore], a + ld a, [wd730] + bit 0, a + ret nz +MtMoon3Script8: + ld a, $2 + ld [wSpriteStateData1 + 2 * $10 + 1], a + ld a, SPRITE_FACING_DOWN + ld [wSpriteStateData1 + 2 * $10 + 9], a +MtMoon3Script9: + ld a, $6 + ld [H_SPRITEINDEX], a + ld de, MovementData_f9e66 + call MoveSprite + ld a, $ff + ld [wJoyIgnore], a + ld a, $a + call MtMoon3Script_49ce5 + ret + +MtMoon3Script10: + ld a, $ff + ld [wJoyIgnore], a + ld a, [wd730] + bit 0, a + ret nz +MtMoon3Script11: + ld a, $2 + ld [wSpriteStateData1 + 6 * $10 + 1], a + ld a, SPRITE_FACING_LEFT + ld [wSpriteStateData1 + 6 * $10 + 9], a + call Delay3 + ld a, $FF ^ (A_BUTTON | B_BUTTON) + ld [wJoyIgnore], a + ld a, $d + ld [hSpriteIndexOrTextID], a + call DisplayTextID +MtMoon3Script12: + ld hl, wd72d + set 6, [hl] + set 7, [hl] + ld hl, MtMoon3JessieJamesEndBattleText + ld de, MtMoon3JessieJamesEndBattleText + call SaveEndBattleTextPointers + ld a, OPP_ROCKET + ld [wCurOpponent], a + ld a, $2a + ld [wTrainerNo], a + xor a + ld [hJoyHeld], a + ld [wJoyIgnore], a + SetEvent EVENT_57E + ld a, $d + call MtMoon3Script_49ce5 + ret + +MtMoon3Script13: + ld a, $ff + ld [wJoyIgnore], a + ld a, [wIsInBattle] + cp $ff + jp z, MtMoon3Script_49cd7 + ld a, $2 + ld [wSpriteStateData1 + 2 * $10 + 1], a + ld [wSpriteStateData1 + 6 * $10 + 1], a + xor a + ld [wSpriteStateData1 + 2 * $10 + 9], a + ld [wSpriteStateData1 + 6 * $10 + 9], a + ld a, $FF ^ (A_BUTTON | B_BUTTON) + ld [wJoyIgnore], a + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld a, $e + ld [hSpriteIndexOrTextID], a + call DisplayTextID + xor a + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + call StopAllMusic + ld c, BANK(Music_MeetJessieJames) + ld a, MUSIC_MEET_JESSIE_JAMES + call PlayMusic + ld a, $ff + ld [wJoyIgnore], a + ld a, $e + call MtMoon3Script_49ce5 + ret + +MtMoon3Script14: + ld a, $ff + ld [wJoyIgnore], a + call GBFadeOutToBlack + ld a, HS_MT_MOON_JESSIE + call MtMoon3Script_49f93 + ld a, HS_MT_MOON_JAMES + call MtMoon3Script_49f93 + call UpdateSprites + call Delay3 + call GBFadeInFromBlack + ld a, $f + call MtMoon3Script_49ce5 + ret + +MtMoon3Script15: + call PlayDefaultMusic + xor a + ld [hJoyHeld], a + ld [wJoyIgnore], a + SetEvent EVENT_BEAT_MT_MOON_3_TRAINER_0 + ResetEventReuseHL EVENT_57E + ld a, $0 + call MtMoon3Script_49ce5 + ret + +MtMoon3Script_49f84: + ld [wMissableObjectIndex], a + predef ShowObject + call UpdateSprites + call Delay3 + ret + +MtMoon3Script_49f93: + ld [wMissableObjectIndex], a + predef HideObject ret MtMoon3TextPointers: @@ -162,208 +416,223 @@ MtMoon3TextPointers: dw MtMoon3Text5 dw MtMoon3Text6 dw MtMoon3Text7 + dw MtMoon3Text8 dw PickUpItemText dw PickUpItemText - dw MtMoon3Text_49f99 + dw MtMoon3Text11 + dw MtMoon3Text12 + dw MtMoon3Text13 + dw MtMoon3Text14 MtMoon3TrainerHeaders: MtMoon3TrainerHeader0: - dbEventFlagBit EVENT_BEAT_MT_MOON_3_TRAINER_0 - db ($4 << 4) ; trainer's view range - dwEventFlagAddress EVENT_BEAT_MT_MOON_3_TRAINER_0 - dw MtMoon3BattleText2 ; TextBeforeBattle - dw MtMoon3AfterBattleText2 ; TextAfterBattle - dw MtMoon3EndBattleText2 ; TextEndBattle - dw MtMoon3EndBattleText2 ; TextEndBattle - -MtMoon3TrainerHeader2: dbEventFlagBit EVENT_BEAT_MT_MOON_3_TRAINER_2 - db ($4 << 4) ; trainer's view range + db ($4 << 4) dwEventFlagAddress EVENT_BEAT_MT_MOON_3_TRAINER_2 - dw MtMoon3BattleText3 ; TextBeforeBattle - dw MtMoon3AfterBattleText3 ; TextAfterBattle - dw MtMoon3EndBattleText3 ; TextEndBattle - dw MtMoon3EndBattleText3 ; TextEndBattle + dw MtMoon3BattleText3 + dw MtMoon3AfterBattleText3 + dw MtMoon3EndBattleText3 + dw MtMoon3EndBattleText3 -MtMoon3TrainerHeader3: +MtMoon3TrainerHeader1: dbEventFlagBit EVENT_BEAT_MT_MOON_3_TRAINER_3 - db ($4 << 4) ; trainer's view range + db ($4 << 4) dwEventFlagAddress EVENT_BEAT_MT_MOON_3_TRAINER_3 - dw MtMoon3BattleText4 ; TextBeforeBattle - dw MtMoon3AfterBattleText4 ; TextAfterBattle - dw MtMoon3EndBattleText4 ; TextEndBattle - dw MtMoon3EndBattleText4 ; TextEndBattle + dw MtMoon3BattleText4 + dw MtMoon3AfterBattleText4 + dw MtMoon3EndBattleText4 + dw MtMoon3EndBattleText4 -MtMoon3TrainerHeader4: +MtMoon3TrainerHeader2: dbEventFlagBit EVENT_BEAT_MT_MOON_3_TRAINER_4 - db ($4 << 4) ; trainer's view range + db ($4 << 4) dwEventFlagAddress EVENT_BEAT_MT_MOON_3_TRAINER_4 - dw MtMoon3BattleText5 ; TextBeforeBattle - dw MtMoon3AfterBattleText5 ; TextAfterBattle - dw MtMoon3EndBattleText5 ; TextEndBattle - dw MtMoon3EndBattleText5 ; TextEndBattle + dw MtMoon3BattleText5 + dw MtMoon3AfterBattleText5 + dw MtMoon3EndBattleText5 + dw MtMoon3EndBattleText5 + + db $FF + +MtMoon3Text2: +MtMoon3Text6: + db "@" + +MtMoon3Text12: + TX_FAR _MtMoonJessieJamesText1 + TX_ASM + ld c, 10 + call DelayFrames + ld a, PLAYER_DIR_UP + ld [wPlayerMovingDirection], a + ld a, $0 + ld [wEmotionBubbleSpriteIndex], a + ld a, $0 + ld [wWhichEmotionBubble], a + predef EmotionBubble + ld c, 20 + call DelayFrames + jp TextScriptEnd - db $ff +MtMoon3Text13: + TX_FAR _MtMoonJessieJamesText2 + db "@" + +MtMoon3JessieJamesEndBattleText: + TX_FAR _MtMoonJessieJamesText3 + db "@" + +MtMoon3Text14: + TX_FAR _MtMoonJessieJamesText4 + TX_ASM + ld c, 64 + call DelayFrames + jp TextScriptEnd MtMoon3Text1: TX_ASM CheckEvent EVENT_BEAT_MT_MOON_EXIT_SUPER_NERD - jr z, .asm_49e8d - and $c0 - jr nz, .asm_49eb8 - ld hl, MtMoon3Text_49f8f + jr z, .asm_4a02f + and $81 ; CheckEitherEventSetReuseA EVENT_GOT_DOME_FOSSIL, EVENT_GOT_HELIX_FOSSIL + jr nz, .asm_4a057 + ld hl, MtMoon3Text_4a116 call PrintText - jr .asm_49ebe -.asm_49e8d - ld hl, MtMoon3Text_49f85 + jr .asm_4a05d + +.asm_4a02f + ld hl, MtMoon3Text_4a10c call PrintText ld hl, wd72d set 6, [hl] set 7, [hl] - ld hl, MtMoon3Text_49f8a - ld de, MtMoon3Text_49f8a + ld hl, MtMoon3SuperNerdEndBattleText + ld de, MtMoon3SuperNerdEndBattleText call SaveEndBattleTextPointers ld a, [H_SPRITEINDEX] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters ld a, $3 - ld [wMtMoon3CurScript], a - ld [wCurMapScript], a - jr .asm_49ebe -.asm_49eb8 - ld hl, MtMoon3Text_49f94 - call PrintText -.asm_49ebe - jp TextScriptEnd + call MtMoon3Script_49ce5 + jr .asm_4a05d -MtMoon3Text2: - TX_ASM - ld hl, MtMoon3TrainerHeader0 - call TalkToTrainer +.asm_4a057 + ld hl, MtMoon3Text_4a11b + call PrintText +.asm_4a05d jp TextScriptEnd MtMoon3Text3: TX_ASM - ld hl, MtMoon3TrainerHeader2 - call TalkToTrainer - jp TextScriptEnd + ld hl, MtMoon3TrainerHeader0 + jr MtMoon3TalkToTrainer MtMoon3Text4: TX_ASM - ld hl, MtMoon3TrainerHeader3 - call TalkToTrainer - jp TextScriptEnd + ld hl, MtMoon3TrainerHeader1 + jr MtMoon3TalkToTrainer + MtMoon3Text5: TX_ASM - ld hl, MtMoon3TrainerHeader4 + ld hl, MtMoon3TrainerHeader2 +MtMoon3TalkToTrainer: call TalkToTrainer jp TextScriptEnd -MtMoon3Text6: +MtMoon3Text7: TX_ASM ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a - ld hl, MtMoon3Text_49f24 + ld hl, MtMoon3Text_4a0ae call PrintText call YesNoChoice ld a, [wCurrentMenuItem] and a - jr nz, .asm_49f21 + jr nz, .asm_4a0ab lb bc, DOME_FOSSIL, 1 call GiveItem - jp nc, MtMoon3Script_49f76 - call MtMoon3Script_49f69 + jp nc, MtMoon3Script_4a0fd + call MtMoon3Script_4a0f0 ld a, HS_MT_MOON_3_FOSSIL_1 ld [wMissableObjectIndex], a predef HideObject SetEvent EVENT_GOT_DOME_FOSSIL ld a, $4 - ld [wMtMoon3CurScript], a - ld [wCurMapScript], a -.asm_49f21 + call MtMoon3Script_49ce5 +.asm_4a0ab jp TextScriptEnd -MtMoon3Text_49f24: +MtMoon3Text_4a0ae: TX_FAR _MtMoon3Text_49f24 db "@" -MtMoon3Text7: +MtMoon3Text8: TX_ASM ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a - ld hl, MtMoon3Text_49f64 + ld hl, MtMoon3Text_4a0eb call PrintText call YesNoChoice ld a, [wCurrentMenuItem] and a - jr nz, .asm_49f61 + jr nz, .asm_4a0e8 lb bc, HELIX_FOSSIL, 1 call GiveItem - jp nc, MtMoon3Script_49f76 - call MtMoon3Script_49f69 + jp nc, MtMoon3Script_4a0fd + call MtMoon3Script_4a0f0 ld a, HS_MT_MOON_3_FOSSIL_2 ld [wMissableObjectIndex], a predef HideObject SetEvent EVENT_GOT_HELIX_FOSSIL ld a, $4 - ld [wMtMoon3CurScript], a - ld [wCurMapScript], a -.asm_49f61 + call MtMoon3Script_49ce5 +.asm_4a0e8 jp TextScriptEnd -MtMoon3Text_49f64: +MtMoon3Text_4a0eb: TX_FAR _MtMoon3Text_49f64 db "@" -MtMoon3Script_49f69: - ld hl, MtMoon3Text_49f6f +MtMoon3Script_4a0f0: + ld hl, MtMoon3Text_4a0f6 jp PrintText -MtMoon3Text_49f6f: +MtMoon3Text_4a0f6: TX_FAR _MtMoon3Text_49f6f - db $11, $d, "@" + TX_SFX_KEY_ITEM + TX_WAIT_BUTTON + db "@" -MtMoon3Script_49f76: - ld hl, MtMoon3Text_49f7f +MtMoon3Script_4a0fd: + ld hl, MtMoon3Text_4a106 call PrintText jp TextScriptEnd -MtMoon3Text_49f7f: +MtMoon3Text_4a106: TX_FAR _MtMoon3Text_49f7f - db $d, "@" + TX_WAIT_BUTTON + db "@" -MtMoon3Text_49f85: +MtMoon3Text_4a10c: TX_FAR _MtMoon3Text_49f85 db "@" -MtMoon3Text_49f8a: +MtMoon3SuperNerdEndBattleText: TX_FAR _MtMoon3Text_49f8a db "@" -MtMoon3Text_49f8f: +MtMoon3Text_4a116: TX_FAR _MtMoon3Text_49f8f db "@" -MtMoon3Text_49f94: +MtMoon3Text_4a11b: TX_FAR _MtMoon3Text_49f94 db "@" -MtMoon3Text_49f99: +MtMoon3Text11: TX_FAR _MtMoon3Text_49f99 - db $11, "@" - -MtMoon3BattleText2: - TX_FAR _MtMoon3BattleText2 - db "@" - -MtMoon3EndBattleText2: - TX_FAR _MtMoon3EndBattleText2 - db "@" - -MtMoon3AfterBattleText2: - TX_FAR _MtMoon3AfterBattleText2 + TX_SFX_KEY_ITEM db "@" MtMoon3BattleText3: @@ -401,3 +670,4 @@ MtMoon3EndBattleText5: MtMoon3AfterBattleText5: TX_FAR _MtMoon3AfterBattleText5 db "@" + diff --git a/scripts/mtmoon3_2.asm b/scripts/mtmoon3_2.asm new file mode 100755 index 00000000..c6ec92b4 --- /dev/null +++ b/scripts/mtmoon3_2.asm @@ -0,0 +1,28 @@ +MtMoon3Script_4a325: ; pikachu-related function? + ld a, [wd472] + bit 7, a + ret z + ld a, [wWalkBikeSurfState] + and a + ret nz + + push hl + push bc + callab GetPikachuFacingDirectionAndReturnToE + pop bc + pop hl + ld a, b + cp e + ret nz + + push hl + ld a, [wUpdateSpritesEnabled] + push af + ld a, $ff + ld [wUpdateSpritesEnabled], a + callab LoadPikachuShadowIntoVRAM + pop af + ld [wUpdateSpritesEnabled], a + pop hl + call ApplyPikachuMovementData + ret diff --git a/scripts/mtmoonpokecenter.asm b/scripts/mtmoonpokecenter.asm index b5edee8d..76cc472a 100755 --- a/scripts/mtmoonpokecenter.asm +++ b/scripts/mtmoonpokecenter.asm @@ -9,9 +9,10 @@ MtMoonPokecenterTextPointers: dw MagikarpSalesmanText dw MtMoonPokecenterText5 dw MtMoonTradeNurseText + dw MtMoonPokecenterText7 MtMoonHealNurseText: - db $ff + TX_POKECENTER_NURSE MtMoonPokecenterText2: TX_FAR _MtMoonPokecenterText1 @@ -23,72 +24,17 @@ MtMoonPokecenterText3: MagikarpSalesmanText: TX_ASM - CheckEvent EVENT_BOUGHT_MAGIKARP, 1 - jp c, .alreadyBoughtMagikarp - ld hl, .Text1 - call PrintText - ld a, MONEY_BOX - ld [wTextBoxID], a - call DisplayTextBoxID - call YesNoChoice - ld a, [wCurrentMenuItem] - and a - jp nz, .choseNo - ld [hMoney], a - ld [hMoney + 2], a - ld a, $5 - ld [hMoney + 1], a - call HasEnoughMoney - jr nc, .enoughMoney - ld hl, .NoMoneyText - jr .printText -.enoughMoney - lb bc, MAGIKARP, 5 - call GivePokemon - jr nc, .done - xor a - ld [wPriceTemp], a - ld [wPriceTemp + 2], a - ld a, $5 - ld [wPriceTemp + 1], a - ld hl, wPriceTemp + 2 - ld de, wPlayerMoney + 2 - ld c, $3 - predef SubBCDPredef - ld a, MONEY_BOX - ld [wTextBoxID], a - call DisplayTextBoxID - SetEvent EVENT_BOUGHT_MAGIKARP - jr .done -.choseNo - ld hl, .RefuseText - jr .printText -.alreadyBoughtMagikarp - ld hl, .Text2 -.printText - call PrintText -.done + callab MagikarpSalesman jp TextScriptEnd -.Text1 - TX_FAR _MagikarpSalesmanText1 - db "@" - -.RefuseText - TX_FAR _MagikarpSalesmanNoText - db "@" - -.NoMoneyText - TX_FAR _MagikarpSalesmanNoMoneyText - db "@" - -.Text2 - TX_FAR _MagikarpSalesmanText2 - db "@" - MtMoonPokecenterText5: TX_FAR _MtMoonPokecenterText5 db "@" MtMoonTradeNurseText: - db $f6 + TX_CABLE_CLUB_RECEPTIONIST + +MtMoonPokecenterText7: + TX_ASM + callab PokecenterChanseyText + jp TextScriptEnd diff --git a/scripts/mtmoonpokecenter2.asm b/scripts/mtmoonpokecenter2.asm new file mode 100755 index 00000000..6097342b --- /dev/null +++ b/scripts/mtmoonpokecenter2.asm @@ -0,0 +1,66 @@ +MagikarpSalesman: + CheckEvent EVENT_BOUGHT_MAGIKARP, 1 + jp c, .alreadyBoughtMagikarp + ld hl, .Text1 + call PrintText + ld a, MONEY_BOX + ld [wTextBoxID], a + call DisplayTextBoxID + call YesNoChoice + ld a, [wCurrentMenuItem] + and a + jp nz, .choseNo + ; $000500 + xor a + ld [hMoney], a + ld [hMoney + 2], a + ld a, $5 + ld [hMoney + 1], a + call HasEnoughMoney + jr nc, .enoughMoney + ld hl, .NoMoneyText + jr .printText +.enoughMoney + lb bc, MAGIKARP, 5 + call GivePokemon + jr nc, .done + ; $000500 + xor a + ld [wPriceTemp], a + ld [wPriceTemp + 2], a + ld a, $5 + ld [wPriceTemp + 1], a + ld hl, wPriceTemp + 2 + ld de, wPlayerMoney + 2 + ld c, $3 + predef SubBCDPredef + ld a, MONEY_BOX + ld [wTextBoxID], a + call DisplayTextBoxID + SetEvent EVENT_BOUGHT_MAGIKARP + jr .done +.choseNo + ld hl, .RefuseText + jr .printText +.alreadyBoughtMagikarp + ld hl, .Text2 +.printText + call PrintText +.done + ret + +.Text1 + TX_FAR _MagikarpSalesmanText1 + db "@" + +.RefuseText + TX_FAR _MagikarpSalesmanNoText + db "@" + +.NoMoneyText + TX_FAR _MagikarpSalesmanNoMoneyText + db "@" + +.Text2 + TX_FAR _MagikarpSalesmanText2 + db "@" diff --git a/scripts/museum1f.asm b/scripts/museum1f.asm index f24cc2c3..30e6f594 100755 --- a/scripts/museum1f.asm +++ b/scripts/museum1f.asm @@ -4,8 +4,9 @@ Museum1FScript: xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld hl, Museum1FScriptPointers - ld a, [wMuseum1fCurScript] - jp CallFunctionInTable + ld a, [wMuseum1FCurScript] + call JumpTable + ret Museum1FScriptPointers: dw Museum1FScript0 @@ -40,207 +41,25 @@ Museum1FTextPointers: Museum1FText1: TX_ASM - ld a, [wYCoord] - cp $4 - jr nz, .asm_8774b - ld a, [wXCoord] - cp $d - jp z, Museum1FScript_5c1f9 - jr .asm_b8709 -.asm_8774b - cp $3 - jr nz, .asm_d49e7 - ld a, [wXCoord] - cp $c - jp z, Museum1FScript_5c1f9 -.asm_d49e7 - CheckEvent EVENT_BOUGHT_MUSEUM_TICKET - jr nz, .asm_31a16 - ld hl, Museum1FText_5c23d - call PrintText - jp Museum1FScriptEnd -.asm_b8709 - CheckEvent EVENT_BOUGHT_MUSEUM_TICKET - jr z, .asm_3ded4 -.asm_31a16 - ld hl, Museum1FText_5c242 - call PrintText - jp Museum1FScriptEnd -.asm_3ded4 - ld a, MONEY_BOX - ld [wTextBoxID], a - call DisplayTextBoxID - xor a - ld [hJoyHeld], a - ld hl, Museum1FText_5c21f - call PrintText - call YesNoChoice - ld a, [wCurrentMenuItem] - and a - jr nz, .asm_de133 - xor a - ld [hMoney], a - ld [hMoney + 1], a - ld a, $50 - ld [hMoney + 2], a - call HasEnoughMoney - jr nc, .asm_0f3e3 - ld hl, Museum1FText_5c229 - call PrintText - jp .asm_de133 -.asm_0f3e3 - ld hl, Museum1FText_5c224 - call PrintText - SetEvent EVENT_BOUGHT_MUSEUM_TICKET - xor a - ld [wPriceTemp], a - ld [wPriceTemp + 1], a - ld a, $50 - ld [wPriceTemp + 2], a - ld hl, wPriceTemp + 2 - ld de, wPlayerMoney + 2 - ld c, $3 - predef SubBCDPredef - ld a, MONEY_BOX - ld [wTextBoxID], a - call DisplayTextBoxID - ld a, SFX_PURCHASE - call PlaySoundWaitForCurrent - call WaitForSoundToFinish - jr .asm_0b094 -.asm_de133 - ld hl, Museum1FText_5c21a - call PrintText - ld a, $1 - ld [wSimulatedJoypadStatesIndex], a - ld a, D_DOWN - ld [wSimulatedJoypadStatesEnd], a - call StartSimulatingJoypadStates - call UpdateSprites - jr Museum1FScriptEnd -.asm_0b094 - ld a, $1 - ld [wMuseum1fCurScript], a - jr Museum1FScriptEnd - -Museum1FScript_5c1f9: - ld hl, Museum1FText_5c22e - call PrintText - call YesNoChoice - ld a, [wCurrentMenuItem] - cp $0 - jr nz, .asm_d1144 - ld hl, Museum1FText_5c233 - call PrintText - jr Museum1FScriptEnd -.asm_d1144 - ld hl, Museum1FText_5c238 - call PrintText -Museum1FScriptEnd: + callba Func_f1c1b jp TextScriptEnd -Museum1FText_5c21a: - TX_FAR _Museum1FText_5c21a - db "@" - -Museum1FText_5c21f: - TX_FAR _Museum1FText_5c21f - db "@" - -Museum1FText_5c224: - TX_FAR _Museum1FText_5c224 - db "@" - -Museum1FText_5c229: - TX_FAR _Museum1FText_5c229 - db "@" - -Museum1FText_5c22e: - TX_FAR _Museum1FText_5c22e - db "@" - -Museum1FText_5c233: - TX_FAR _Museum1FText_5c233 - db "@" - -Museum1FText_5c238: - TX_FAR _Museum1FText_5c238 - db "@" - -Museum1FText_5c23d: - TX_FAR _Museum1FText_5c23d - db "@" - -Museum1FText_5c242: - TX_FAR _Museum1FText_5c242 - db "@" - Museum1FText2: TX_ASM - ld hl, Museum1FText_5c251 - call PrintText + callba Func_f1d2a jp TextScriptEnd -Museum1FText_5c251: - TX_FAR _Museum1FText_5c251 - db "@" - Museum1FText3: TX_ASM - CheckEvent EVENT_GOT_OLD_AMBER - jr nz, .asm_5c285 - ld hl, Museum1FText_5c28e - call PrintText - lb bc, OLD_AMBER, 1 - call GiveItem - jr nc, .BagFull - SetEvent EVENT_GOT_OLD_AMBER - ld a, HS_OLD_AMBER - ld [wMissableObjectIndex], a - predef HideObject - ld hl, ReceivedOldAmberText - jr .asm_5c288 -.BagFull - ld hl, Museum1FText_5c29e - jr .asm_5c288 -.asm_5c285 - ld hl, Museum1FText_5c299 -.asm_5c288 - call PrintText + callba Func_f1d36 jp TextScriptEnd -Museum1FText_5c28e: - TX_FAR _Museum1FText_5c28e - db "@" - -ReceivedOldAmberText: - TX_FAR _ReceivedOldAmberText - db $0B, "@" - -Museum1FText_5c299: - TX_FAR _Museum1FText_5c299 - db "@" - -Museum1FText_5c29e: - TX_FAR _Museum1FText_5c29e - db "@" - Museum1FText4: TX_ASM - ld hl, Museum1FText_5c2ad - call PrintText + callba Func_f1d80 jp TextScriptEnd -Museum1FText_5c2ad: - TX_FAR _Museum1FText_5c2ad - db "@" - Museum1FText5: TX_ASM - ld hl, Museum1FText_5c2bc - call PrintText + callba Func_f1d8c jp TextScriptEnd - -Museum1FText_5c2bc: - TX_FAR _Museum1FText_5c2bc - db "@" diff --git a/scripts/museum1f2.asm b/scripts/museum1f2.asm new file mode 100755 index 00000000..7e8878a2 --- /dev/null +++ b/scripts/museum1f2.asm @@ -0,0 +1,211 @@ +Func_f1c1b: + ld a, [wYCoord] + cp $4 + jr nz, .asm_f1c2c + ld a, [wXCoord] + cp $d + jp z, .asm_f1cde + jr .asm_f1c48 + +.asm_f1c2c + cp $3 + jr nz, .asm_f1c38 + ld a, [wXCoord] + cp a, $c + jp z, .asm_f1cde +.asm_f1c38 + CheckEvent EVENT_BOUGHT_MUSEUM_TICKET + jr nz, .asm_f1c4f + ld hl, Museum1FText_f1d20 + call PrintText + jp .asm_f1cfc + +.asm_f1c48 + CheckEvent EVENT_BOUGHT_MUSEUM_TICKET + jr z, .asm_f1c58 +.asm_f1c4f + ld hl, Museum1FText_f1d25 + call PrintText + jp .asm_f1cfc + +.asm_f1c58 + ld a, $13 + ld [wTextBoxID], a + call DisplayTextBoxID + xor a + ld [hJoyHeld], a + ld hl, Museum1FText_f1d02 + call PrintText + call YesNoChoice + ld a, [wCurrentMenuItem] + and a + jr nz, .asm_f1cbf + xor a + ld [hMoney], a + ld [hMoney + 1], a + ld a, $50 + ld [hMoney + 2], a + call HasEnoughMoney + jr nc, .asm_f1c89 + ld hl, Museum1FText_f1d0c + call PrintText + jp .asm_f1cbf + +.asm_f1c89 + ld hl, Museum1FText_f1d07 + call PrintText + SetEvent EVENT_BOUGHT_MUSEUM_TICKET + xor a + ld [wPriceTemp], a + ld [wPriceTemp + 1], a + ld a, $50 + ld [wPriceTemp + 2], a + ld hl, wPriceTemp + 2 + ld de, wPlayerMoney + 2 + ld c, 3 + predef SubBCDPredef + ld a, $13 + ld [wTextBoxID], a + call DisplayTextBoxID + ld a, SFX_PURCHASE + call PlaySoundWaitForCurrent + call WaitForSoundToFinish + jr .asm_f1cd7 + +.asm_f1cbf + ld hl, Museum1FText_f1cfd + call PrintText + ld a, $1 + ld [wSimulatedJoypadStatesIndex], a + ld a, D_DOWN + ld [wSimulatedJoypadStatesEnd], a + call StartSimulatingJoypadStates + call UpdateSprites + jr .asm_f1cfc + +.asm_f1cd7 + ld a, $1 + ld [wMuseum1FCurScript], a + jr .asm_f1cfc + +.asm_f1cde + ld hl, Museum1FText_f1d11 + call PrintText + call YesNoChoice + ld a, [wCurrentMenuItem] + cp 0 + jr nz, .asm_f1cf6 + ld hl, Museum1FText_f1d16 + call PrintText + jr .asm_f1cfc + +.asm_f1cf6 + ld hl, Museum1FText_f1d1b + call PrintText +.asm_f1cfc + ret + +Museum1FText_f1cfd: + TX_FAR _Museum1FText_5c21a + db "@" + +Museum1FText_f1d02: + TX_FAR _Museum1FText_5c21f + db "@" + +Museum1FText_f1d07: + TX_FAR _Museum1FText_5c224 + db "@" + +Museum1FText_f1d0c: + TX_FAR _Museum1FText_5c229 + db "@" + +Museum1FText_f1d11: + TX_FAR _Museum1FText_5c22e + db "@" + +Museum1FText_f1d16: + TX_FAR _Museum1FText_5c233 + db "@" + +Museum1FText_f1d1b: + TX_FAR _Museum1FText_5c238 + db "@" + +Museum1FText_f1d20: + TX_FAR _Museum1FText_5c23d + db "@" + +Museum1FText_f1d25: + TX_FAR _Museum1FText_5c242 + db "@" + +Func_f1d2a: + ld hl, Museum1FText_f1d31 + call PrintText + ret + +Museum1FText_f1d31: + TX_FAR _Museum1FText_5c251 + db "@" + +Func_f1d36: + CheckEvent EVENT_GOT_OLD_AMBER + jr nz, .asm_f1d64 + ld hl, Museum1FText_f1d6b + call PrintText + lb bc, OLD_AMBER, 1 + call GiveItem + jr nc, .asm_f1d5f + SetEvent EVENT_GOT_OLD_AMBER + ld a, HS_OLD_AMBER + ld [wMissableObjectIndex], a + predef HideObject + ld hl, Museum1FText_f1d70 + jr .asm_f1d67 + +.asm_f1d5f + ld hl, Museum1FText_f1d7b + jr .asm_f1d67 + +.asm_f1d64 + ld hl, Museum1FText_f1d76 +.asm_f1d67 + call PrintText + ret + +Museum1FText_f1d6b: + TX_FAR _Museum1FText_5c28e + db "@" + +Museum1FText_f1d70: + TX_FAR _ReceivedOldAmberText + TX_SFX_ITEM + db "@" + +Museum1FText_f1d76: + TX_FAR _Museum1FText_5c299 + db "@" + +Museum1FText_f1d7b: + TX_FAR _Museum1FText_5c29e + db "@" + +Func_f1d80: + ld hl, Museum1FText_f1d87 + call PrintText + ret + +Museum1FText_f1d87: + TX_FAR _Museum1FText_5c2ad + db "@" + +Func_f1d8c: + ld hl, Museum1FText_f1d93 + call PrintText + ret + +Museum1FText_f1d93: + TX_FAR _Museum1FText_5c2bc + db "@" diff --git a/scripts/museum2f.asm b/scripts/museum2f.asm index 6ee8d72a..93a8396e 100755 --- a/scripts/museum2f.asm +++ b/scripts/museum2f.asm @@ -1,5 +1,6 @@ Museum2FScript: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret Museum2FTextPointers: dw Museum2FText1 @@ -27,9 +28,40 @@ Museum2FText4: db "@" Museum2FText5: + TX_ASM + ld a, [wd472] + bit 7, a + jr nz, .asm_5c1f6 + ld hl, Museum2FText_5c20e + call PrintText + jr .asm_5c20b + +.asm_5c1f6 + ld a, [wPikachuHappiness] + cp 101 + jr c, .asm_5c205 + ld hl, Museum2FText_5c218 + call PrintText + jr .asm_5c20b + +.asm_5c205 + ld hl, Museum2FText_5c213 + call PrintText +.asm_5c20b + jp TextScriptEnd + +Museum2FText_5c20e: TX_FAR _Museum2FText5 db "@" +Museum2FText_5c213: + TX_FAR _Museum2FPikachuText1 + db "@" + +Museum2FText_5c218: + TX_FAR _Museum2FPikachuText2 + db "@" + Museum2FText6: TX_FAR _Museum2FText6 db "@" diff --git a/scripts/oakslab.asm b/scripts/oakslab.asm index b91abd43..55b58b39 100755 --- a/scripts/oakslab.asm +++ b/scripts/oakslab.asm @@ -7,7 +7,8 @@ OaksLabScript: ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld hl, OaksLabScriptPointers ld a, [wOaksLabCurScript] - jp CallFunctionInTable + call JumpTable + ret OaksLabScriptPointers: dw OaksLabScript0 @@ -29,6 +30,10 @@ OaksLabScriptPointers: dw OaksLabScript16 dw OaksLabScript17 dw OaksLabScript18 + dw OaksLabScript19 + dw OaksLabScript20 + dw OaksLabScript21 + dw OaksLabScript22 OaksLabScript0: CheckEvent EVENT_OAK_APPEARED_IN_PALLET @@ -47,7 +52,7 @@ OaksLabScript0: ret OaksLabScript1: - ld a, $8 + ld a, $6 ld [H_SPRITEINDEX], a ld de, OakEntryMovement call MoveSprite @@ -90,7 +95,7 @@ OaksLabScript3: xor a ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay - ld a, $5 + ld a, $3 ld [H_SPRITEINDEX], a xor a ld [hSpriteFacingDirection], a @@ -115,7 +120,6 @@ OaksLabScript4: ld a, SPRITE_FACING_UP ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay - call UpdateSprites ld hl, wFlags_D733 res 1, [hl] call PlayDefaultMusic @@ -125,24 +129,28 @@ OaksLabScript4: ret OaksLabScript5: + SetEvent EVENT_OAK_ASKED_TO_CHOOSE_MON ld a, $fc ld [wJoyIgnore], a - ld a, $11 + ld a, $d ld [hSpriteIndexOrTextID], a call DisplayTextID call Delay3 - ld a, $12 + ld a, $e ld [hSpriteIndexOrTextID], a call DisplayTextID call Delay3 - ld a, $13 + ld a, $2 + ld [wSpriteStateData1 + 1 * $10 + 1], a + ld a, SPRITE_FACING_UP + ld [wSpriteStateData1 + 1 * $10 + 9], a + ld a, $f ld [hSpriteIndexOrTextID], a call DisplayTextID call Delay3 - ld a, $14 + ld a, $10 ld [hSpriteIndexOrTextID], a call DisplayTextID - SetEvent EVENT_OAK_ASKED_TO_CHOOSE_MON xor a ld [wJoyIgnore], a @@ -154,7 +162,7 @@ OaksLabScript6: ld a, [wYCoord] cp $6 ret nz - ld a, $5 + ld a, $3 ld [H_SPRITEINDEX], a xor a ; SPRITE_FACING_DOWN ld [hSpriteFacingDirection], a @@ -165,7 +173,7 @@ OaksLabScript6: ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay call UpdateSprites - ld a, $c + ld a, $a ld [hSpriteIndexOrTextID], a call DisplayTextID ld a, $1 @@ -191,176 +199,130 @@ OaksLabScript7: ret OaksLabScript8: - ld a, [wPlayerStarter] - cp STARTER1 - jr z, .Charmander - cp STARTER2 - jr z, .Squirtle - jr .Bulbasaur -.Charmander - ld de, .MiddleBallMovement1 - ld a, [wYCoord] - cp $4 ; is the player standing below the table? - jr z, .asm_1ccf3 - ld de, .MiddleBallMovement2 - jr .asm_1ccf3 - -.MiddleBallMovement1 - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_RIGHT - db NPC_MOVEMENT_RIGHT - db NPC_MOVEMENT_RIGHT - db NPC_MOVEMENT_UP - db $FF - -.MiddleBallMovement2 - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_RIGHT - db NPC_MOVEMENT_RIGHT - db NPC_MOVEMENT_RIGHT - db $FF - -.Squirtle - ld de, .RightBallMovement1 - ld a, [wYCoord] - cp $4 ; is the player standing below the table? - jr z, .asm_1ccf3 - ld de, .RightBallMovement2 - jr .asm_1ccf3 - -.RightBallMovement1 - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_RIGHT - db NPC_MOVEMENT_RIGHT - db NPC_MOVEMENT_RIGHT - db NPC_MOVEMENT_RIGHT - db NPC_MOVEMENT_UP - db $FF - -.RightBallMovement2 - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_RIGHT - db NPC_MOVEMENT_RIGHT - db NPC_MOVEMENT_RIGHT - db NPC_MOVEMENT_RIGHT - db $FF - -.Bulbasaur - ld de, .LeftBallMovement1 - ld a, [wXCoord] - cp $9 ; is the player standing to the right of the table? - jr nz, .asm_1ccf3 - push hl ld a, $1 - ld [H_SPRITEINDEX], a - ld a, $4 - ld [H_SPRITEDATAOFFSET], a - call GetPointerWithinSpriteStateData1 - push hl - ld [hl], $4c - inc hl - inc hl - ld [hl], $0 - pop hl - inc h - ld [hl], $8 - inc hl - ld [hl], $9 - ld de, .LeftBallMovement2 ; the rival is not currently onscreen, so account for that - pop hl - jr .asm_1ccf3 - -.LeftBallMovement1 - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_RIGHT ; not yet terminated! -.LeftBallMovement2 - db NPC_MOVEMENT_RIGHT - db $FF - -.asm_1ccf3 - ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndexOrTextID], a + ld de, .SonyPushesPlayerAwayFromEeveeBall call MoveSprite - ld a, $9 ld [wOaksLabCurScript], a ret +.SonyPushesPlayerAwayFromEeveeBall + db $00 + db $07 + db $07 + db $07 + db $FF + OaksLabScript9: ld a, [wd730] bit 0, a - ret nz - ld a, $fc - ld [wJoyIgnore], a + jr nz, .asm_1c564 + ld a, HS_STARTER_BALL_1 + ld [wMissableObjectIndex], a + predef HideObject ld a, $1 ld [H_SPRITEINDEX], a ld a, SPRITE_FACING_UP ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay - ld a, $d - ld [hSpriteIndexOrTextID], a - call DisplayTextID - ld a, [wRivalStarterBallSpriteIndex] - cp $2 - jr nz, .asm_1cd28 - ld a, HS_STARTER_BALL_1 - jr .asm_1cd32 -.asm_1cd28 - cp $3 - jr nz, .asm_1cd30 - ld a, HS_STARTER_BALL_2 - jr .asm_1cd32 -.asm_1cd30 - ld a, HS_STARTER_BALL_3 -.asm_1cd32 - ld [wMissableObjectIndex], a - predef HideObject - call Delay3 - ld a, [wRivalStarterTemp] + ld a, 1 ld [wRivalStarter], a - ld [wcf91], a + ld a, EEVEE ld [wd11e], a call GetMonName + ld a, $FF ^ (A_BUTTON | B_BUTTON) + ld [wJoyIgnore], a + ld a, $11 + ld [hSpriteIndexOrTextID], a + call DisplayTextID + + ld a, $a + ld [wOaksLabCurScript], a + ret + +.asm_1c564 + ld a, [wYCoord] + cp $4 + ret nz + ld a, [wNPCNumScriptedSteps] + cp 1 + ret nz + ld a, PLAYER_DIR_LEFT + ld [wPlayerMovingDirection], a + ld a, $2 + ld [wSimulatedJoypadStatesIndex], a + ld a, D_RIGHT + ld [wSimulatedJoypadStatesEnd], a + ld [wSimulatedJoypadStatesEnd + 1], a + call StartSimulatingJoypadStates + ret + +OaksLabScript10: + ld a, [wYCoord] + cp $4 + jr z, .asm_1c599 ld a, $1 - ld [H_SPRITEINDEX], a - ld a, SPRITE_FACING_UP - ld [hSpriteFacingDirection], a - call SetSpriteFacingDirectionAndDelay - ld a, $e + ld [wSimulatedJoypadStatesIndex], a + ld a, D_LEFT + ld [wSimulatedJoypadStatesEnd], a + jr .asm_1c5a6 + +.asm_1c599 + ld hl, wSimulatedJoypadStatesEnd + ld de, OaksLabRLE_PlayerWalksToOak + call DecodeRLEList + dec a + ld [wSimulatedJoypadStatesIndex], a +.asm_1c5a6 + call StartSimulatingJoypadStates + ld a, $b + ld [wOaksLabCurScript], a + ret + +OaksLabRLE_PlayerWalksToOak: + db D_UP, 2 + db D_LEFT, 3 + db D_DOWN, 1 + db D_LEFT, 1 + db $FF + +OaksLabScript11: + ld a, [wSimulatedJoypadStatesIndex] + and a + ret nz + ld a, $12 ld [hSpriteIndexOrTextID], a call DisplayTextID - SetEvent EVENT_GOT_STARTER xor a ld [wJoyIgnore], a - ld a, $a + ld a, $c ld [wOaksLabCurScript], a ret -OaksLabScript10: +OaksLabScript12: ld a, [wYCoord] cp $6 ret nz + ld a, PLAYER_DIR_UP + ld [wPlayerMovingDirection], a ld a, $1 - ld [H_SPRITEINDEX], a - xor a ; SPRITE_FACING_DOWN + ld [hSpriteIndexOrTextID], a + xor a ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay - ld a, PLAYER_DIR_UP - ld [wPlayerMovingDirection], a ld c, BANK(Music_MeetRival) ld a, MUSIC_MEET_RIVAL call PlayMusic - ld a, $f + ld a, $b ld [hSpriteIndexOrTextID], a call DisplayTextID ld a, $1 ld [hNPCPlayerRelativePosPerspective], a ld a, $1 swap a - ld [hNPCSpriteOffset], a + ld [hNPCPlayerYDistance], a predef CalcPositionOfPlayerRelativeToNPC ld a, [hNPCPlayerYDistance] dec a @@ -368,40 +330,25 @@ OaksLabScript10: predef FindPathToPlayer ld de, wNPCMovementDirections2 ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndexOrTextID], a call MoveSprite - - ld a, $b + ld a, $d ld [wOaksLabCurScript], a ret -OaksLabScript11: +OaksLabScript13: ld a, [wd730] bit 0, a ret nz - - ; define which team rival uses, and fight it + ld a, $1 + ld [wSpriteIndex], a + call GetSpritePosition1 ld a, OPP_SONY1 ld [wCurOpponent], a - ld a, [wRivalStarter] - cp STARTER2 - jr nz, .NotSquirtle ld a, $1 - jr .done -.NotSquirtle - cp STARTER3 - jr nz, .Charmander - ld a, $2 - jr .done -.Charmander - ld a, $3 -.done ld [wTrainerNo], a - ld a, $1 - ld [wSpriteIndex], a - call GetSpritePosition1 - ld hl, OaksLabText_1d3be - ld de, OaksLabText_1d3c3 + ld hl, OaksLabRivalDefeatedText + ld de, OaksLabRivalBeatYouText call SaveEndBattleTextPointers ld hl, wd72d set 6, [hl] @@ -410,12 +357,28 @@ OaksLabScript11: ld [wJoyIgnore], a ld a, PLAYER_DIR_UP ld [wPlayerMovingDirection], a - ld a, $c + ld a, $e ld [wOaksLabCurScript], a ret -OaksLabScript12: - ld a, $f0 +OaksLabScript14: + ld a, $ff + ld [wJoyIgnore], a + + ; If you beat your rival here, his Eevee will evolve into + ; Jolteon if you beat him on Route 22, or Flareon if you + ; skip or lose that battle. + ; Otherwise, it will evolve into Vaporeon. + ld a, [wBattleResult] + and a + ld b, $3 + jr nz, .asm_1c660 + ld b, $2 +.asm_1c660 + ld a, b + ld [wRivalStarter], a + + ld a, $ff ^ (A_BUTTON | B_BUTTON) ld [wJoyIgnore], a ld a, PLAYER_DIR_UP ld [wPlayerMovingDirection], a @@ -423,101 +386,123 @@ OaksLabScript12: ld a, $1 ld [wSpriteIndex], a call SetSpritePosition1 - ld a, $1 - ld [H_SPRITEINDEX], a - xor a ; SPRITE_FACING_DOWN - ld [hSpriteFacingDirection], a - call SetSpriteFacingDirectionAndDelay + ld a, $2 + ld [wSpriteStateData1 + 1 * $10 + 1], a + xor a + ld [wSpriteStateData1 + 1 * $10 + 9], a predef HealParty SetEvent EVENT_BATTLED_RIVAL_IN_OAKS_LAB - - ld a, $d + ld a, $f ld [wOaksLabCurScript], a ret -OaksLabScript13: +OaksLabScript15: ld c, 20 call DelayFrames - ld a, $10 + ld a, $c ld [hSpriteIndexOrTextID], a call DisplayTextID callba Music_RivalAlternateStart ld a, $1 - ld [H_SPRITEINDEX], a - ld de, .RivalExitMovement + ld [hSpriteIndexOrTextID], a + ld de, .OaksLabMovement_RivalWalksOut1 call MoveSprite ld a, [wXCoord] cp $4 - ; move left or right depending on where the player is standing - jr nz, .moveLeft + jr nz, .asm_1c6bb ld a, NPC_MOVEMENT_RIGHT - jr .next -.moveLeft + jr .asm_1c6bd + +.asm_1c6bb ld a, NPC_MOVEMENT_LEFT -.next +.asm_1c6bd ld [wNPCMovementDirections], a - - ld a, $e + ld a, $10 ld [wOaksLabCurScript], a ret -.RivalExitMovement - db $E0 ; change sprite facing direction - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db $FF +.OaksLabMovement_RivalWalksOut1 + db $e0 + db $00 + db $04 + db $04 + db $04 + db $04 + db $04 + db $ff -OaksLabScript14: +OaksLabScript16: ld a, [wd730] bit 0, a - jr nz, .asm_1ce8c + jr nz, .asm_1c6ed + ld a, $ff ^ (A_BUTTON | B_BUTTON) + ld [wJoyIgnore], a ld a, HS_OAKS_LAB_RIVAL ld [wMissableObjectIndex], a predef HideObject - xor a - ld [wJoyIgnore], a - call PlayDefaultMusic ; reset to map music - ld a, $12 + call PlayDefaultMusic + ld a, $11 ld [wOaksLabCurScript], a - jr .done -; make the player keep facing the rival as he walks away -.asm_1ce8c + ret + +.asm_1c6ed ld a, [wNPCNumScriptedSteps] - cp $5 - jr nz, .asm_1cea8 + cp 5 + jr nz, .asm_1c703 ld a, [wXCoord] - cp $4 - jr nz, .asm_1cea1 + cp 4 + jr nz, .asm_1c6ff ld a, SPRITE_FACING_RIGHT - ld [wSpriteStateData1 + 9], a - jr .done -.asm_1cea1 + jr .asm_1c707 + +.asm_1c6ff ld a, SPRITE_FACING_LEFT - ld [wSpriteStateData1 + 9], a - jr .done -.asm_1cea8 - cp $4 + jr .asm_1c707 + +.asm_1c703 + cp 4 ret nz - xor a ; ld a, SPRITE_FACING_DOWN - ld [wSpriteStateData1 + 9], a -.done + xor a +.asm_1c707 + ld [wPlayerFacingDirection], a ret -OaksLabScript15: +OaksLabScript17: +; Pikachu comes out + ld a, SPRITE_FACING_UP + ld [wPlayerFacingDirection], a + ld a, $2 + ld [wPikachuSpawnState], a + callba SchedulePikachuSpawnForAfterText + call EnablePikachuOverworldSpriteDrawing + ld a, $1a + ld [hSpriteIndexOrTextID], a + call DisplayTextID + ld a, $12 + ld [wOaksLabCurScript], a + ret + +OaksLabScript18: + ld a, $1b + ld [hSpriteIndexOrTextID], a + call DisplayTextID + xor a + ld [wJoyIgnore], a + ld a, $16 + ld [wOaksLabCurScript], a + ret + +OaksLabScript19: xor a ld [hJoyHeld], a call EnableAutoTextBoxDrawing - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic callba Music_RivalAlternateStart - ld a, $15 + ld a, $13 ld [hSpriteIndexOrTextID], a call DisplayTextID - call OaksLabScript_1d02b + callab Func_f1be0 + call OaksLabScript_1c8b9 ld a, HS_OAKS_LAB_RIVAL ld [wMissableObjectIndex], a predef ShowObject @@ -530,50 +515,50 @@ OaksLabScript15: call FillMemory ld [hl], $ff ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndexOrTextID], a ld de, wNPCMovementDirections2 call MoveSprite - - ld a, $10 + ld a, $14 ld [wOaksLabCurScript], a ret -OaksLabScript_1cefd: +OaksLabScript_1c78e: ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndexOrTextID], a ld a, SPRITE_FACING_UP ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay - ld a, $8 - ld [H_SPRITEINDEX], a - xor a ; SPRITE_FACING_DOWN + ld a, $6 + ld [hSpriteIndexOrTextID], a + xor a ld [hSpriteFacingDirection], a - jp SetSpriteFacingDirectionAndDelay + call SetSpriteFacingDirectionAndDelay + ret -OaksLabScript16: +OaksLabScript20: ld a, [wd730] bit 0, a ret nz call EnableAutoTextBoxDrawing call PlayDefaultMusic - ld a, $fc + ld a, $ff ^ (A_BUTTON | B_BUTTON) ld [wJoyIgnore], a - call OaksLabScript_1cefd - ld a, $16 + call OaksLabScript_1c78e + ld a, $14 ld [hSpriteIndexOrTextID], a call DisplayTextID call DelayFrame - call OaksLabScript_1cefd - ld a, $17 + call OaksLabScript_1c78e + ld a, $15 ld [hSpriteIndexOrTextID], a call DisplayTextID call DelayFrame - call OaksLabScript_1cefd - ld a, $18 + call OaksLabScript_1c78e + ld a, $16 ld [hSpriteIndexOrTextID], a call DisplayTextID call DelayFrame - ld a, $19 + ld a, $17 ld [hSpriteIndexOrTextID], a call DisplayTextID call Delay3 @@ -583,20 +568,22 @@ OaksLabScript16: ld a, HS_POKEDEX_2 ld [wMissableObjectIndex], a predef HideObject - call OaksLabScript_1cefd - ld a, $1a + call OaksLabScript_1c78e + ld a, $18 ld [hSpriteIndexOrTextID], a call DisplayTextID ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndexOrTextID], a ld a, SPRITE_FACING_RIGHT ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay call Delay3 - ld a, $1b + ld a, $19 ld [hSpriteIndexOrTextID], a call DisplayTextID SetEvent EVENT_GOT_POKEDEX + ld a, $1 + ld [wViridianCityCurScript], a SetEvent EVENT_OAK_GOT_PARCEL ld a, HS_LYING_OLD_MAN ld [wMissableObjectIndex], a @@ -608,23 +595,20 @@ OaksLabScript16: ld b, 0 ld c, a ld hl, wNPCMovementDirections2 - xor a ; NPC_MOVEMENT_DOWN + xor a call FillMemory ld [hl], $ff - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic callba Music_RivalAlternateStart ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndexOrTextID], a ld de, wNPCMovementDirections2 call MoveSprite - - ld a, $11 + ld a, $15 ld [wOaksLabCurScript], a ret -OaksLabScript17: +OaksLabScript21: ld a, [wd730] bit 0, a ret nz @@ -638,71 +622,73 @@ OaksLabScript17: ld a, HS_ROUTE_22_RIVAL_1 ld [wMissableObjectIndex], a predef ShowObject - ld a, $5 - ld [wPalletTownCurScript], a xor a ld [wJoyIgnore], a - - ld a, $12 + ld a, $16 ld [wOaksLabCurScript], a ret -OaksLabScript18: +OaksLabScript22: ret -OaksLabScript_RemoveParcel: +OaksLabScript_1c897: ld hl, wBagItems - ld bc, $0000 -.loop + ld bc, 0 +.asm_1c89d ld a, [hli] cp $ff ret z cp OAKS_PARCEL - jr z, .foundParcel + jr z, .asm_1c8a9 inc hl inc c - jr .loop -.foundParcel + jr .asm_1c89d + +.asm_1c8a9 ld hl, wNumBagItems ld a, c ld [wWhichPokemon], a - ld a, $1 + ld a, 1 ld [wItemQuantity], a - jp RemoveItemFromInventory + call RemoveItemFromInventory + ret -OaksLabScript_1d02b: +OaksLabScript_1c8b9: ld a, $7c ld [$ffeb], a ld a, $8 ld [$ffee], a ld a, [wYCoord] - cp $3 - jr nz, .asm_1d045 + cp 3 + jr nz, .asm_1c8d3 ld a, $4 ld [wNPCMovementDirections2Index], a ld a, $30 ld b, $b - jr .asm_1d068 -.asm_1d045 + jr .asm_1c8f6 + +.asm_1c8d3 cp $1 - jr nz, .asm_1d054 + jr nz, .asm_1c8e2 ld a, $2 ld [wNPCMovementDirections2Index], a ld a, $30 ld b, $9 - jr .asm_1d068 -.asm_1d054 + jr .asm_1c8f6 + +.asm_1c8e2 ld a, $3 ld [wNPCMovementDirections2Index], a ld b, $a ld a, [wXCoord] cp $4 - jr nz, .asm_1d066 + jr nz, .asm_1c8f4 ld a, $40 - jr .asm_1d068 -.asm_1d066 + jr .asm_1c8f6 + +.asm_1c8f4 ld a, $20 -.asm_1d068 +.asm_1c8f6 ld [$ffec], a ld a, b ld [$ffed], a @@ -712,11 +698,11 @@ OaksLabScript_1d02b: ret OaksLabScript_1d076: - ld hl, OaksLabTextPointers + $36 ; starts at OaksLabText28 + ld hl, OaksLabTextPointers2 ld a, l ld [wMapTextPtr], a ld a, h - ld [wMapTextPtr+1], a + ld [wMapTextPtr + 1], a ret OaksLabTextPointers: @@ -747,495 +733,428 @@ OaksLabTextPointers: dw OaksLabText25 dw OaksLabText26 dw OaksLabText27 - dw OaksLabText28 - dw OaksLabText29 - dw OaksLabText30 - dw OaksLabText31 - dw OaksLabText32 - dw OaksLabText33 - dw OaksLabText34 - dw OaksLabText35 - dw OaksLabText36 - dw OaksLabText37 - dw OaksLabText38 - -OaksLabText28: + +OaksLabTextPointers2: + dw OaksLabText1 + dw OaksLabText2 + dw OaksLabText3 + dw OaksLabText4 + dw OaksLabText5 + dw OaksLabText6 + dw OaksLabText7 + dw OaksLabText8 + dw OaksLabText9 + OaksLabText1: TX_ASM CheckEvent EVENT_FOLLOWED_OAK_INTO_LAB_2 - jr nz, .asm_1d0de - ld hl, OaksLabGaryText1 + jr nz, .asm_1c968 + ld hl, OaksLabText_1c97d call PrintText - jr .asm_1d0f0 -.asm_1d0de - bit 2, a - jr nz, .asm_1d0ea - ld hl, OaksLabText40 + jr .asm_1c97a + +.asm_1c968 + CheckEventReuseA EVENT_GOT_STARTER + jr nz, .asm_1c974 + ld hl, OaksLabText_1c982 call PrintText - jr .asm_1d0f0 -.asm_1d0ea - ld hl, OaksLabText41 + jr .asm_1c97a + +.asm_1c974 + ld hl, OaksLabText_1c987 call PrintText -.asm_1d0f0 +.asm_1c97a jp TextScriptEnd -OaksLabGaryText1: +OaksLabText_1c97d: TX_FAR _OaksLabGaryText1 db "@" -OaksLabText40: +OaksLabText_1c982: TX_FAR _OaksLabText40 db "@" -OaksLabText41: +OaksLabText_1c987: TX_FAR _OaksLabText41 db "@" -OaksLabText29: OaksLabText2: TX_ASM - ld a, STARTER2 - ld [wRivalStarterTemp], a - ld a, $3 - ld [wRivalStarterBallSpriteIndex], a - ld a, STARTER1 - ld b, $2 - jr OaksLabScript_1d133 - -OaksLabText30: -OaksLabText3: - TX_ASM - ld a, STARTER3 - ld [wRivalStarterTemp], a - ld a, $4 - ld [wRivalStarterBallSpriteIndex], a - ld a, STARTER2 - ld b, $3 - jr OaksLabScript_1d133 - -OaksLabText31: -OaksLabText4: - TX_ASM - ld a, STARTER1 - ld [wRivalStarterTemp], a - ld a, $2 - ld [wRivalStarterBallSpriteIndex], a - ld a, STARTER3 - ld b, $4 - -OaksLabScript_1d133: - ld [wcf91], a - ld [wd11e], a - ld a, b - ld [wSpriteIndex], a - CheckEvent EVENT_GOT_STARTER - jp nz, OaksLabScript_1d22d - CheckEventReuseA EVENT_OAK_ASKED_TO_CHOOSE_MON - jr nz, OaksLabScript_1d157 - ld hl, OaksLabText39 + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + CheckEvent EVENT_OAK_ASKED_TO_CHOOSE_MON + jr nz, OaksLabScript_1c9ac + ld a, $0 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld hl, OaksLabText_1c9a7 call PrintText jp TextScriptEnd -OaksLabText39: +OaksLabText_1c9a7: TX_FAR _OaksLabText39 db "@" -OaksLabScript_1d157: - ld a, $5 - ld [H_SPRITEINDEX], a - ld a, $9 - ld [H_SPRITEDATAOFFSET], a - call GetPointerWithinSpriteStateData1 - ld [hl], SPRITE_FACING_DOWN +OaksLabScript_1c9ac: ld a, $1 - ld [H_SPRITEINDEX], a - ld a, $9 - ld [H_SPRITEDATAOFFSET], a - call GetPointerWithinSpriteStateData1 - ld [hl], SPRITE_FACING_RIGHT - ld hl, wd730 - set 6, [hl] - predef StarterDex - ld hl, wd730 - res 6, [hl] - call ReloadMapData - ld c, 10 - call DelayFrames - ld a, [wSpriteIndex] - cp $2 - jr z, OaksLabLookAtCharmander - cp $3 - jr z, OaksLabLookAtSquirtle - jr OaksLabLookAtBulbasaur - -OaksLabLookAtCharmander: - ld hl, OaksLabCharmanderText - jr OaksLabMonChoiceMenu -OaksLabCharmanderText: - TX_FAR _OaksLabCharmanderText - db "@" - -OaksLabLookAtSquirtle: - ld hl, OaksLabSquirtleText - jr OaksLabMonChoiceMenu -OaksLabSquirtleText: - TX_FAR _OaksLabSquirtleText - db "@" - -OaksLabLookAtBulbasaur: - ld hl, OaksLabBulbasaurText - jr OaksLabMonChoiceMenu -OaksLabBulbasaurText: - TX_FAR _OaksLabBulbasaurText - db "@" - -OaksLabMonChoiceMenu: - call PrintText - ld a, $1 - ld [wDoNotWaitForButtonPressAfterDisplayingText], a - call YesNoChoice ; yes/no menu - ld a, [wCurrentMenuItem] - and a - jr nz, OaksLabMonChoiceEnd - ld a, [wcf91] - ld [wPlayerStarter], a - ld [wd11e], a - call GetMonName - ld a, [wSpriteIndex] - cp $2 - jr nz, .asm_1d1db - ld a, HS_STARTER_BALL_1 - jr .asm_1d1e5 -.asm_1d1db - cp $3 - jr nz, .asm_1d1e3 - ld a, HS_STARTER_BALL_2 - jr .asm_1d1e5 -.asm_1d1e3 - ld a, HS_STARTER_BALL_3 -.asm_1d1e5 - ld [wMissableObjectIndex], a - predef HideObject - ld a, $1 - ld [wDoNotWaitForButtonPressAfterDisplayingText], a - ld hl, OaksLabMonEnergeticText - call PrintText - ld hl, OaksLabReceivedMonText - call PrintText - xor a ; PLAYER_PARTY_DATA - ld [wMonDataLocation], a - ld a, 5 - ld [wCurEnemyLVL], a - ld a, [wcf91] - ld [wd11e], a - call AddPartyMon - ld hl, wd72e - set 3, [hl] - ld a, $fc - ld [wJoyIgnore], a + ld [wEmotionBubbleSpriteIndex], a + xor a + ld [wWhichEmotionBubble], a + predef EmotionBubble ld a, $8 ld [wOaksLabCurScript], a -OaksLabMonChoiceEnd: jp TextScriptEnd -OaksLabMonEnergeticText: - TX_FAR _OaksLabMonEnergeticText - db "@" - -OaksLabReceivedMonText: - TX_FAR _OaksLabReceivedMonText - TX_SFX_KEY_ITEM - db "@" - -OaksLabScript_1d22d: - ld a, $5 - ld [H_SPRITEINDEX], a - ld a, $9 - ld [H_SPRITEDATAOFFSET], a - call GetPointerWithinSpriteStateData1 - ld [hl], $0 - ld hl, OaksLabLastMonText - call PrintText - jp TextScriptEnd - -OaksLabLastMonText: - TX_FAR _OaksLabLastMonText - db "@" - -OaksLabText32: -OaksLabText5: +OaksLabText3: TX_ASM CheckEvent EVENT_PALLET_AFTER_GETTING_POKEBALLS - jr nz, .asm_1d266 + jr nz, .asm_1c9d9 ld hl, wPokedexOwned ld b, wPokedexOwnedEnd - wPokedexOwned call CountSetBits ld a, [wNumSetBits] cp 2 - jr c, .asm_1d279 - CheckEvent EVENT_GOT_POKEDEX - jr z, .asm_1d279 -.asm_1d266 - ld hl, OaksLabText_1d31d + jr c, .asm_1c9ec +.asm_1c9d9 + ld hl, OaksLabText_1ca9f call PrintText ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a predef DisplayDexRating - jp .asm_1d2ed -.asm_1d279 - ld b,POKE_BALL + jp .asm_1ca6f + +.asm_1c9ec + ld b, POKE_BALL call IsItemInBag - jr nz, .asm_1d2e7 + jr nz, .asm_1ca69 + ld hl, wPokedexOwned + ld b, wPokedexOwnedEnd - wPokedexOwned + call CountSetBits + ld a, [wNumSetBits] + cp 2 + jr nc, .asm_1ca69 CheckEvent EVENT_BEAT_ROUTE22_RIVAL_1ST_BATTLE - jr nz, .asm_1d2d0 + jr nz, .asm_1ca52 CheckEvent EVENT_GOT_POKEDEX - jr nz, .asm_1d2c8 + jr nz, .asm_1ca4a CheckEventReuseA EVENT_BATTLED_RIVAL_IN_OAKS_LAB - jr nz, .asm_1d2a9 + jr nz, .asm_1ca2b ld a, [wd72e] bit 3, a - jr nz, .asm_1d2a1 - ld hl, OaksLabText_1d2f0 + jr nz, .asm_1ca23 + ld hl, OaksLabText_1ca72 call PrintText - jr .asm_1d2ed -.asm_1d2a1 - ld hl, OaksLabText_1d2f5 + jr .asm_1ca6f + +.asm_1ca23 + ld hl, OaksLabText_1ca77 call PrintText - jr .asm_1d2ed -.asm_1d2a9 + jr .asm_1ca6f + +.asm_1ca2b ld b, OAKS_PARCEL call IsItemInBag - jr nz, .asm_1d2b8 - ld hl, OaksLabText_1d2fa + jr nz, .asm_1ca3a + ld hl, OaksLabText_1ca7c call PrintText - jr .asm_1d2ed -.asm_1d2b8 - ld hl, OaksLabDeliverParcelText + jr .asm_1ca6f + +.asm_1ca3a + ld hl, OaksLabText_1ca81 call PrintText - call OaksLabScript_RemoveParcel - ld a, $f + call OaksLabScript_1c897 + ld a, $13 ld [wOaksLabCurScript], a - jr .asm_1d2ed -.asm_1d2c8 - ld hl, OaksLabAroundWorldText + jr .asm_1ca6f + +.asm_1ca4a + ld hl, OaksLabText_1ca8b call PrintText - jr .asm_1d2ed -.asm_1d2d0 + jr .asm_1ca6f + +.asm_1ca52 CheckAndSetEvent EVENT_GOT_POKEBALLS_FROM_OAK - jr nz, .asm_1d2e7 + jr nz, .asm_1ca69 lb bc, POKE_BALL, 5 call GiveItem - ld hl, OaksLabGivePokeballsText + ld hl, OaksLabText_1ca90 call PrintText - jr .asm_1d2ed -.asm_1d2e7 - ld hl, OaksLabPleaseVisitText + jr .asm_1ca6f + +.asm_1ca69 + ld hl, OaksLabText_1ca9a call PrintText -.asm_1d2ed +.asm_1ca6f jp TextScriptEnd -OaksLabText_1d2f0: - TX_FAR _OaksLabText_1d2f0 +OaksLabText_1ca72: + TX_FAR _OaksLabPikachuText db "@" -OaksLabText_1d2f5: +OaksLabText_1ca77: TX_FAR _OaksLabText_1d2f5 db "@" -OaksLabText_1d2fa: +OaksLabText_1ca7c: TX_FAR _OaksLabText_1d2fa db "@" -OaksLabDeliverParcelText: +OaksLabText_1ca81: TX_FAR _OaksLabDeliverParcelText1 TX_SFX_KEY_ITEM TX_FAR _OaksLabDeliverParcelText2 db "@" -OaksLabAroundWorldText: +OaksLabText_1ca8b: TX_FAR _OaksLabAroundWorldText db "@" -OaksLabGivePokeballsText: +OaksLabText_1ca90: TX_FAR _OaksLabGivePokeballsText1 TX_SFX_KEY_ITEM TX_FAR _OaksLabGivePokeballsText2 db "@" -OaksLabPleaseVisitText: +OaksLabText_1ca9a: TX_FAR _OaksLabPleaseVisitText db "@" -OaksLabText_1d31d: +OaksLabText_1ca9f: TX_FAR _OaksLabText_1d31d db "@" -OaksLabText34: -OaksLabText33: -OaksLabText7: -OaksLabText6: +OaksLabText4: +OaksLabText5: TX_ASM - ld hl, OaksLabText_1d32c + ld hl, OaksLabText_1caae call PrintText jp TextScriptEnd -OaksLabText_1d32c: +OaksLabText_1caae: TX_FAR _OaksLabText_1d32c db "@" -OaksLabText35: -OaksLabText8: +OaksLabText6: TX_FAR _OaksLabText8 db "@" -OaksLabText36: -OaksLabText9: +OaksLabText7: TX_ASM - ld hl, OaksLabText_1d340 + ld hl, OaksLabText_1cac2 call PrintText jp TextScriptEnd -OaksLabText_1d340: +OaksLabText_1cac2: TX_FAR _OaksLabText_1d340 db "@" -OaksLabText17: +OaksLabText13: TX_ASM - ld hl, OaksLabRivalWaitingText + ld hl, OaksLabText_1cad1 call PrintText jp TextScriptEnd -OaksLabRivalWaitingText: +OaksLabText_1cad1: TX_FAR _OaksLabRivalWaitingText db "@" -OaksLabText18: +OaksLabText14: TX_ASM - ld hl, OaksLabChooseMonText + ld hl, OaksLabText_1cae0 call PrintText jp TextScriptEnd -OaksLabChooseMonText: +OaksLabText_1cae0: TX_FAR _OaksLabChooseMonText db "@" -OaksLabText19: +OaksLabText15: TX_ASM - ld hl, OaksLabRivalInterjectionText + ld hl, OaksLabText_1caef call PrintText jp TextScriptEnd -OaksLabRivalInterjectionText: +OaksLabText_1caef: TX_FAR _OaksLabRivalInterjectionText db "@" -OaksLabText20: +OaksLabText16: TX_ASM - ld hl, OaksLabBePatientText + ld hl, OaksLabText_1cafe call PrintText jp TextScriptEnd -OaksLabBePatientText: +OaksLabText_1cafe: TX_FAR _OaksLabBePatientText db "@" -OaksLabText12: +OaksLabText17: TX_ASM - ld hl, OaksLabLeavingText + ld hl, OaksLabText_1cb25 + call PrintText + ld hl, OaksLabText_1cb2a + call PrintText + ld hl, OaksLabText_1cb30 + call PrintText + ld hl, OaksLabText_1cb35 + call PrintText + ld hl, OaksLabText_1cb3a call PrintText jp TextScriptEnd -OaksLabLeavingText: - TX_FAR _OaksLabLeavingText +OaksLabText_1cb25: + TX_FAR _OaksLabRivalTakesText1 db "@" -OaksLabText13: +OaksLabText_1cb2a: + TX_FAR _OaksLabRivalTakesText2 + TX_SFX_KEY_ITEM + db "@" + +OaksLabText_1cb30: + TX_FAR _OaksLabRivalTakesText3 + db "@" + +OaksLabText_1cb35: + TX_FAR _OaksLabRivalTakesText4 + db "@" + +OaksLabText_1cb3a: + TX_FAR _OaksLabRivalTakesText5 + db "@" + +OaksLabText18: TX_ASM - ld hl, OaksLabRivalPickingMonText + ld a, PIKACHU + ld [wPlayerStarter], a + ld [wd11e], a + call GetMonName + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld hl, OaksLabText_1cb85 + call PrintText + ld hl, OaksLabText_1cb8a call PrintText + xor a + ld [wMonDataLocation], a + ld a, 5 + ld [wCurEnemyLVL], a + ld a, PIKACHU + ld [wd11e], a + ld [wcf91], a + call AddPartyMon + ld a, 163 + ld [wPartyMon1CatchRate], a + call DisablePikachuOverworldSpriteDrawing + SetEvent EVENT_GOT_STARTER + ld hl, wd72e + set 3, [hl] jp TextScriptEnd -OaksLabRivalPickingMonText: - TX_FAR _OaksLabRivalPickingMonText +OaksLabText_1cb85: + TX_FAR _OaksLabOakGivesText db "@" -OaksLabText14: +OaksLabText_1cb8a: + TX_FAR _OaksLabReceivedText + TX_SFX_KEY_ITEM + db "@" + +OaksLabText10: TX_ASM - ld hl, OaksLabRivalReceivedMonText + ld hl, OaksLabText_1cb9a call PrintText jp TextScriptEnd -OaksLabRivalReceivedMonText: - TX_FAR _OaksLabRivalReceivedMonText - TX_SFX_KEY_ITEM +OaksLabText_1cb9a: + TX_FAR _OaksLabLeavingText db "@" -OaksLabText15: +OaksLabText11: TX_ASM - ld hl, OaksLabRivalChallengeText + ld hl, OaksLabText_1cba9 call PrintText jp TextScriptEnd -OaksLabRivalChallengeText: +OaksLabText_1cba9: TX_FAR _OaksLabRivalChallengeText db "@" -OaksLabText_1d3be: +OaksLabRivalDefeatedText: TX_FAR _OaksLabText_1d3be db "@" -OaksLabText_1d3c3: +OaksLabRivalBeatYouText: TX_FAR _OaksLabText_1d3c3 db "@" -OaksLabText16: +OaksLabText12: TX_ASM - ld hl, OaksLabRivalToughenUpText + ld hl, OaksLabText_1cbc2 call PrintText jp TextScriptEnd -OaksLabRivalToughenUpText: +OaksLabText_1cbc2: TX_FAR _OaksLabRivalToughenUpText db "@" -OaksLabText21: +OaksLabText26: + TX_ASM + ldpikacry e, PikachuCry2 + callab PlayPikachuSoundClip + ld hl, OaksLabText_1cbdb + call PrintText + jp TextScriptEnd + +OaksLabText_1cbdb: + TX_FAR _OaksLabPikachuDislikesPokeballsText1 + db "@" + +OaksLabText27: + TX_ASM + ld hl, OaksLabText_1cbea + call PrintText + jp TextScriptEnd + +OaksLabText_1cbea: + TX_FAR _OaksLabPikachuDislikesPokeballsText2 + db "@" + +OaksLabText19: TX_FAR _OaksLabText21 db "@" -OaksLabText22: +OaksLabText20: TX_FAR _OaksLabText22 db "@" -OaksLabText23: +OaksLabText21: TX_FAR _OaksLabText23 db "@" -OaksLabText24: +OaksLabText22: TX_FAR _OaksLabText24 db "@" -OaksLabText25: +OaksLabText23: TX_FAR _OaksLabText25 TX_SFX_KEY_ITEM db "@" -OaksLabText26: +OaksLabText24: TX_FAR _OaksLabText26 db "@" -OaksLabText27: +OaksLabText25: TX_FAR _OaksLabText27 db "@" -OaksLabText38: -OaksLabText37: -OaksLabText11: -OaksLabText10: +OaksLabText8: +OaksLabText9: TX_ASM - ld hl, OaksLabText_1d405 + ld hl, OaksLabText_1c31d call PrintText jp TextScriptEnd -OaksLabText_1d405: +OaksLabText_1c31d: TX_FAR _OaksLabText_1d405 db "@" diff --git a/scripts/oakslab2.asm b/scripts/oakslab2.asm new file mode 100755 index 00000000..5e4e98a4 --- /dev/null +++ b/scripts/oakslab2.asm @@ -0,0 +1,28 @@ +Func_f1be0: + ld a, [wYCoord] + cp 3 + jr z, .asm_f1bf0 + ld b, SPRITE_FACING_DOWN + ld hl, Data_f1bf9 + call TryApplyPikachuMovementData + ret + +.asm_f1bf0 + ld b, SPRITE_FACING_LEFT + ld hl, Data_f1bfe + call TryApplyPikachuMovementData + ret + +Data_f1bf9: + db $00 + db $1f + db $1e + db $38 + db $3f + +Data_f1bfe: + db $00 + db $1d + db $20 + db $36 + db $3f diff --git a/scripts/pallettown.asm b/scripts/pallettown.asm index a06dfd54..803aa4f3 100755 --- a/scripts/pallettown.asm +++ b/scripts/pallettown.asm @@ -1,12 +1,12 @@ PalletTownScript: CheckEvent EVENT_GOT_POKEBALLS_FROM_OAK - jr z,.next + jr z, .next SetEvent EVENT_PALLET_AFTER_GETTING_POKEBALLS .next call EnableAutoTextBoxDrawing - ld hl,PalletTownScriptPointers - ld a,[wPalletTownCurScript] - jp CallFunctionInTable + ld hl, PalletTownScriptPointers + ld a, [wPalletTownCurScript] + jp JumpTable PalletTownScriptPointers: dw PalletTownScript0 @@ -16,136 +16,208 @@ PalletTownScriptPointers: dw PalletTownScript4 dw PalletTownScript5 dw PalletTownScript6 + dw PalletTownScript7 + dw PalletTownScript8 + dw PalletTownScript9 PalletTownScript0: CheckEvent EVENT_FOLLOWED_OAK_INTO_LAB ret nz - ld a,[wYCoord] - cp 1 ; is player near north exit? + ld a, [wYCoord] + cp 0 ; is player at north exit? ret nz + ResetEvent EVENT_PLAYER_AT_RIGHT_EXIT_TO_PALLET_TOWN + ld a, [wXCoord] + cp 10 + jr z, .asm_18e40 + SetEventReuseHL EVENT_PLAYER_AT_RIGHT_EXIT_TO_PALLET_TOWN +.asm_18e40 xor a - ld [hJoyHeld],a - ld a,PLAYER_DIR_DOWN - ld [wPlayerMovingDirection],a - ld a,$FF - call PlaySound ; stop music + ld [hJoyHeld], a + ld a, $ff + ld [wJoyIgnore], a + ld a, PLAYER_DIR_UP + ld [wPlayerMovingDirection], a + call StopAllMusic ld a, BANK(Music_MeetProfOak) - ld c,a - ld a, MUSIC_MEET_PROF_OAK ; “oak appears” music + ld c, a + ld a, MUSIC_MEET_PROF_OAK call PlayMusic - ld a,$FC - ld [wJoyIgnore],a SetEvent EVENT_OAK_APPEARED_IN_PALLET ; trigger the next script - ld a,1 - ld [wPalletTownCurScript],a + ld a, 1 + ld [wPalletTownCurScript], a ret PalletTownScript1: + ld a, $FF ^ (A_BUTTON | B_BUTTON) + ld [wJoyIgnore], a xor a - ld [wcf0d],a - ld a,1 - ld [hSpriteIndexOrTextID],a + ld [wcf0d], a + ld a, 1 + ld [hSpriteIndexOrTextID], a call DisplayTextID - ld a,$FF - ld [wJoyIgnore],a - ld a,HS_PALLET_TOWN_OAK - ld [wMissableObjectIndex],a + ld a, $FF + ld [wJoyIgnore], a + ld hl, wSpriteStateData2 + 1 * $10 + 4 + ld a, $8 + ld [hli], a + ld a, $e + ld [hl], a + ld a, HS_PALLET_TOWN_OAK + ld [wMissableObjectIndex], a predef ShowObject ; trigger the next script - ld a,2 - ld [wPalletTownCurScript],a + ld a, $2 + ld [wSpriteStateData1 + 1 * $10 + 1], a + ld a, SPRITE_FACING_UP + ld [wSpriteStateData1 + 1 * $10 + 9], a + ld a, 2 + ld [wPalletTownCurScript], a ret PalletTownScript2: - ld a,1 - ld [H_SPRITEINDEX],a - ld a,SPRITE_FACING_UP - ld [hSpriteFacingDirection],a - call SetSpriteFacingDirectionAndDelay call Delay3 - ld a,1 - ld [wYCoord],a - ld a,1 - ld [hNPCPlayerRelativePosPerspective],a - ld a,1 + ld a, 0 + ld [wYCoord], a + ld a, 1 + ld [hNPCPlayerRelativePosPerspective], a + ld a, 1 swap a - ld [hNPCSpriteOffset],a + ld [hNPCSpriteOffset], a predef CalcPositionOfPlayerRelativeToNPC - ld hl,hNPCPlayerYDistance + ld hl, hNPCPlayerYDistance dec [hl] predef FindPathToPlayer ; load Oak’s movement into wNPCMovementDirections2 - ld de,wNPCMovementDirections2 - ld a,1 ; oak - ld [H_SPRITEINDEX],a + ld de, wNPCMovementDirections2 + ld a, 1 ; oak + ld [H_SPRITEINDEX], a call MoveSprite - ld a,$FF - ld [wJoyIgnore],a ; trigger the next script - ld a,3 - ld [wPalletTownCurScript],a + ld a, 3 + ld [wPalletTownCurScript], a ret PalletTownScript3: - ld a,[wd730] - bit 0,a + ld a, [wd730] + bit 0, a ret nz - xor a ; ld a, SPRITE_FACING_DOWN - ld [wSpriteStateData1 + 9],a - ld a,1 - ld [wcf0d],a - ld a,$FC - ld [wJoyIgnore],a - ld a,1 - ld [hSpriteIndexOrTextID],a + ld a, $FF ^ (A_BUTTON | B_BUTTON) + ld [wJoyIgnore], a + ld a, 1 + ld [wcf0d], a + ld a, $2 + ld [wSpriteStateData1 + 1 * $10 + 1], a + ld a, SPRITE_FACING_UP + ld [wSpriteStateData1 + 1 * $10 + 9], a + ld a, 1 + ld [hSpriteIndexOrTextID], a call DisplayTextID -; set up movement script that causes the player to follow Oak to his lab - ld a,$FF - ld [wJoyIgnore],a - ld a,1 - ld [wSpriteIndex],a - xor a - ld [wNPCMovementScriptFunctionNum],a - ld a,1 - ld [wNPCMovementScriptPointerTableNum],a - ld a,[H_LOADEDROMBANK] - ld [wNPCMovementScriptBank],a + ; oak faces the horizontally adjacent patch of grass to face pikachu + ld a, $FF + ld [wJoyIgnore], a + ld a, $2 + ld [wSpriteStateData1 + 1 * $10 + 1], a + CheckEvent EVENT_PLAYER_AT_RIGHT_EXIT_TO_PALLET_TOWN + ld a, SPRITE_FACING_RIGHT + jr z, .asm_18f01 + ld a, SPRITE_FACING_LEFT +.asm_18f01 + ld [wSpriteStateData1 + 1 * $10 + 9], a ; trigger the next script - ld a,4 - ld [wPalletTownCurScript],a + ld a, 4 + ld [wPalletTownCurScript], a ret PalletTownScript4: - ld a,[wNPCMovementScriptPointerTableNum] - and a ; is the movement script over? - ret nz + ; start the pikachu battle + ld a, $FF ^ (A_BUTTON | B_BUTTON) + ld [wJoyIgnore], a + xor a + ld [wListScrollOffset], a + ld a, BATTLE_TYPE_PIKACHU + ld [wBattleType], a + ld a, PIKACHU + ld [wCurOpponent], a + ld a, 5 + ld [wCurEnemyLVL], a ; trigger the next script - ld a,5 - ld [wPalletTownCurScript],a + ld a, 5 + ld [wPalletTownCurScript], a ret PalletTownScript5: + ld a, $2 + ld [wcf0d], a + ld a, $1 + ld [hSpriteIndexOrTextID], a + call DisplayTextID + ld a, $2 + ld [wSpriteStateData1 + 1 * $10 + 1], a + ld a, SPRITE_FACING_UP + ld [wSpriteStateData1 + 1 * $10 + 9], a + ld a, $8 + ld [hSpriteIndexOrTextID], a + call DisplayTextID + ld a, $ff + ld [wJoyIgnore], a + + ; trigger the next script + ld a, 6 + ld [wPalletTownCurScript], a + ret + +PalletTownScript6: + xor a + ld [wPlayerFacingDirection], a + ld a, $1 + ld [wSpriteIndex], a + xor a + ld [wNPCMovementScriptFunctionNum], a + ld a, $1 + ld [wNPCMovementScriptPointerTableNum], a + ld a, [H_LOADEDROMBANK] + ld [wNPCMovementScriptBank], a + + ; trigger the next script + ld a, 7 + ld [wPalletTownCurScript], a + ret + +PalletTownScript7: + ld a, [wNPCMovementScriptPointerTableNum] + and a + ret nz + + ; trigger the next script + ld a, 8 + ld [wPalletTownCurScript], a + ret + +PalletTownScript8: CheckEvent EVENT_DAISY_WALKING - jr nz,.next - CheckBothEventsSet EVENT_GOT_TOWN_MAP, EVENT_ENTERED_BLUES_HOUSE, 1 - jr nz,.next + jr nz, .asm_18f9e + and $3 ; (EVENT_GOT_TOWN_MAP | EVENT_ENTERED_BLUES_HOUSE) + cp $3 + jr nz, .asm_18f9e SetEvent EVENT_DAISY_WALKING - ld a,HS_DAISY_SITTING - ld [wMissableObjectIndex],a + ld a, HS_DAISY_SITTING + ld [wMissableObjectIndex], a predef HideObject - ld a,HS_DAISY_WALKING - ld [wMissableObjectIndex],a + ld a, HS_DAISY_WALKING + ld [wMissableObjectIndex], a predef_jump ShowObject -.next + +.asm_18f9e CheckEvent EVENT_GOT_POKEBALLS_FROM_OAK ret z SetEvent EVENT_PALLET_AFTER_GETTING_POKEBALLS_2 -PalletTownScript6: +PalletTownScript9: ret PalletTownTextPointers: @@ -156,18 +228,25 @@ PalletTownTextPointers: dw PalletTownText5 dw PalletTownText6 dw PalletTownText7 + dw PalletTownText8 PalletTownText1: TX_ASM - ld a,[wcf0d] + ld a, [wcf0d] and a - jr nz,.next - ld a,1 - ld [wDoNotWaitForButtonPressAfterDisplayingText],a - ld hl,OakAppearsText + jr nz, .next + ld a, 1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld hl, OakAppearsText jr .done .next - ld hl,OakWalksUpText + dec a + jr nz, .asm_18fd3 + ld hl, OakWalksUpText + jr .done + +.asm_18fd3 + ld hl, PalletTownText_19002 .done call PrintText jp TextScriptEnd @@ -175,40 +254,49 @@ PalletTownText1: OakAppearsText: TX_FAR _OakAppearsText TX_ASM - ld c,10 + ld c, 10 call DelayFrames - xor a - ld [wEmotionBubbleSpriteIndex],a ; player's sprite - ld [wWhichEmotionBubble],a ; EXCLAMATION_BUBBLE + ld a, PLAYER_DIR_DOWN + ld [wPlayerMovingDirection], a + ld a, 0 + ld [wEmotionBubbleSpriteIndex], a ; player's sprite + ld a, 0 + ld [wWhichEmotionBubble], a ; EXCLAMATION_BUBBLE predef EmotionBubble - ld a,PLAYER_DIR_DOWN - ld [wPlayerMovingDirection],a jp TextScriptEnd OakWalksUpText: TX_FAR _OakWalksUpText db "@" -PalletTownText2: ; girl +PalletTownText_19002: + TX_FAR _OakWhewText + db "@" + +PalletTownText8: ; girl + TX_FAR _OakGrassText + db "@" + +PalletTownText2: ; fat man TX_FAR _PalletTownText2 db "@" -PalletTownText3: ; fat man +PalletTownText3: ; sign by lab TX_FAR _PalletTownText3 db "@" -PalletTownText4: ; sign by lab +PalletTownText4: ; sign by fence TX_FAR _PalletTownText4 db "@" -PalletTownText5: ; sign by fence +PalletTownText5: ; sign by Red’s house TX_FAR _PalletTownText5 db "@" -PalletTownText6: ; sign by Red’s house +PalletTownText6: ; sign by Blue’s house TX_FAR _PalletTownText6 db "@" -PalletTownText7: ; sign by Blue’s house +PalletTownText7: TX_FAR _PalletTownText7 db "@" diff --git a/scripts/pewtercity.asm b/scripts/pewtercity.asm index 5ee83f34..b7271b05 100755 --- a/scripts/pewtercity.asm +++ b/scripts/pewtercity.asm @@ -1,8 +1,11 @@ PewterCityScript: call EnableAutoTextBoxDrawing + ld hl, wd492 + res 7, [hl] ld hl, PewterCityScriptPointers ld a, [wPewterCityCurScript] - jp CallFunctionInTable + call JumpTable + ret PewterCityScriptPointers: dw PewterCityScript0 @@ -15,7 +18,7 @@ PewterCityScriptPointers: PewterCityScript0: xor a - ld [wMuseum1fCurScript], a + ld [wMuseum1FCurScript], a ResetEvent EVENT_BOUGHT_MUSEUM_TICKET call PewterCityScript_1925e ret @@ -26,7 +29,7 @@ PewterCityScript_1925e: ld hl, CoordsData_19277 call ArePlayerCoordsInArray ret nc - ld a, $f0 + ld a, $fc ld [wJoyIgnore], a ld a, $5 ld [hSpriteIndexOrTextID], a @@ -48,9 +51,9 @@ PewterCityScript1: ld a, SPRITE_FACING_UP ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay - ld a, ($3 << 4) | SPRITE_FACING_UP + ld a, SPRITE_FACING_UP ld [hSpriteImageIndex], a - call SetSpriteImageIndexAfterSettingFacingDirection + call SpriteFunc_34a1 call PlayDefaultMusic ld hl, wFlags_0xcd60 set 4, [hl] @@ -115,10 +118,7 @@ PewterCityScript4: ld [H_SPRITEINDEX], a ld a, SPRITE_FACING_LEFT ld [hSpriteFacingDirection], a - call SetSpriteFacingDirectionAndDelay - ld a, ($1 << 4) | SPRITE_FACING_LEFT - ld [hSpriteImageIndex], a - call SetSpriteImageIndexAfterSettingFacingDirection + call SpriteFunc_34a1 call PlayDefaultMusic ld hl, wFlags_0xcd60 set 4, [hl] diff --git a/scripts/pewtergym.asm b/scripts/pewtergym.asm index 7e5becf2..6014cf33 100755 --- a/scripts/pewtergym.asm +++ b/scripts/pewtergym.asm @@ -14,7 +14,8 @@ PewterGymScript: PewterGymScript_5c3a4: ld hl, Gym1CityName ld de, Gym1LeaderName - jp LoadGymLeaderAndCityName + call LoadGymLeaderAndCityName + ret Gym1CityName: db "PEWTER CITY@" @@ -41,7 +42,6 @@ PewterGymScript3: jp z, PewterGymScript_5c3bf ld a, $f0 ld [wJoyIgnore], a - PewterGymScript_5c3df: ld a, $4 ld [hSpriteIndexOrTextID], a @@ -55,6 +55,7 @@ PewterGymScript_5c3df: call DisplayTextID SetEvent EVENT_GOT_TM34 jr .asm_5c408 + .BagFull ld a, $6 ld [hSpriteIndexOrTextID], a @@ -149,7 +150,7 @@ PewterGymText4: PewterGymText5: TX_FAR _ReceivedTM34Text - db $0B + TX_SFX_ITEM TX_FAR _TM34ExplanationText db "@" @@ -159,7 +160,7 @@ PewterGymText6: PewterGymText_5c4bc: TX_FAR _PewterGymText_5c4bc - db $0B + TX_SFX_ITEM TX_FAR _PewterGymText_5c4c1 db "@" @@ -192,6 +193,9 @@ PewterGymText3: ld a, [wCurrentMenuItem] and a jr nz, .asm_5c4fe + ld a, [wd472] + bit 7, a + jp nz, .asm_5c3fa ld hl, PewterGymText_5c51a call PrintText jr .asm_5c504 @@ -208,6 +212,11 @@ PewterGymText3: .asm_5c512 jp TextScriptEnd +.asm_5c3fa + ld hl, PewterGymText_5c41c + call PrintText + jp TextScriptEnd + PewterGymText_5c515: TX_FAR _PewterGymText_5c515 db "@" @@ -227,3 +236,8 @@ PewterGymText_5c524: PewterGymText_5c529: TX_FAR _PewterGymText_5c529 db "@" + +PewterGymText_5c41c: + TX_FAR _PewterGymGuyText + db "@" + diff --git a/scripts/pewterhouse1.asm b/scripts/pewterhouse1.asm index 8fa8dc3c..ba0f631f 100755 --- a/scripts/pewterhouse1.asm +++ b/scripts/pewterhouse1.asm @@ -1,5 +1,6 @@ PewterHouse1Script: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret PewterHouse1TextPointers: dw PewterHouse1Text1 diff --git a/scripts/pewtermart.asm b/scripts/pewtermart.asm index d5281704..64915563 100755 --- a/scripts/pewtermart.asm +++ b/scripts/pewtermart.asm @@ -14,6 +14,7 @@ PewterMartText2: ld hl, .Text call PrintText jp TextScriptEnd + .Text TX_FAR _PewterMartText2 db "@" @@ -23,6 +24,7 @@ PewterMartText3: ld hl, .Text call PrintText jp TextScriptEnd + .Text TX_FAR _PewterMartText3 db "@" diff --git a/scripts/pewterpokecenter.asm b/scripts/pewterpokecenter.asm index bea7a47d..78bfc9fa 100755 --- a/scripts/pewterpokecenter.asm +++ b/scripts/pewterpokecenter.asm @@ -1,12 +1,17 @@ PewterPokecenterScript: + ld hl, wd492 + set 7, [hl] call Serial_TryEstablishingExternallyClockedConnection - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret PewterPokecenterTextPointers: dw PewterHealNurseText dw PewterPokecenterText2 dw PewterJigglypuffText dw PewterTradeNurseText + dw PewterPokecenterText5 + dw PewterPokecenterText6 PewterHealNurseText: TX_POKECENTER_NURSE @@ -17,68 +22,18 @@ PewterPokecenterText2: PewterJigglypuffText: TX_ASM - ld a, $1 - ld [wDoNotWaitForButtonPressAfterDisplayingText], a - ld hl, .Text - call PrintText - StopAllMusic - ld c, 32 - call DelayFrames - ld hl, JigglypuffFacingDirections - ld de, wJigglypuffFacingDirections - ld bc, JigglypuffFacingDirectionsEnd - JigglypuffFacingDirections - call CopyData - - ld a, [Sprite03SpriteImageIdx] - ld hl, wJigglypuffFacingDirections -.findMatchingFacingDirectionLoop - cp [hl] - inc hl - jr nz, .findMatchingFacingDirectionLoop - dec hl - push hl - ld c, BANK(Music_JigglypuffSong) - ld a, MUSIC_JIGGLYPUFF_SONG - call PlayMusic - pop hl -.loop - ld a, [hl] - ld [Sprite03SpriteImageIdx], a - -; rotate the array - push hl - ld hl, wJigglypuffFacingDirections - ld de, wJigglypuffFacingDirections - 1 - ld bc, JigglypuffFacingDirectionsEnd - JigglypuffFacingDirections - call CopyData - ld a, [wJigglypuffFacingDirections - 1] - ld [wJigglypuffFacingDirections + 3], a - pop hl - - ld c, 24 - call DelayFrames - - ld a, [wChannelSoundIDs] - ld b, a - ld a, [wChannelSoundIDs + CH1] - or b - jr nz, .loop - - ld c, 48 - call DelayFrames - call PlayDefaultMusic + callba PewterJigglypuff jp TextScriptEnd -.Text - TX_FAR _PewterJigglypuffText - db "@" - -JigglypuffFacingDirections: - db $30 | SPRITE_FACING_DOWN - db $30 | SPRITE_FACING_LEFT - db $30 | SPRITE_FACING_UP - db $30 | SPRITE_FACING_RIGHT -JigglypuffFacingDirectionsEnd: - PewterTradeNurseText: TX_CABLE_CLUB_RECEPTIONIST + +PewterPokecenterText5: + TX_ASM + callba Func_f1d98 + jp TextScriptEnd + +PewterPokecenterText6: + TX_ASM + callab PokecenterChanseyText + jp TextScriptEnd diff --git a/scripts/pewterpokecenter2.asm b/scripts/pewterpokecenter2.asm new file mode 100755 index 00000000..9f035fa9 --- /dev/null +++ b/scripts/pewterpokecenter2.asm @@ -0,0 +1,72 @@ +Func_f1d98: + ld hl, PewterPokecenterText_f1d9f + call PrintText + ret + +PewterPokecenterText_f1d9f: + TX_FAR _PewterPokecenterText3 + db "@" + +PewterJigglypuff: + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld hl, .Text + call PrintText + call StopAllMusic + ld c, 32 + call DelayFrames + ld hl, JigglypuffSpinData + ld de, wJigglypuffFacingDirections + ld bc, JigglypuffSpinDataEnd - JigglypuffSpinData + call CopyData + ld a, [wSpriteStateData1 + 3 * $10 + 2] + ld hl, wJigglypuffFacingDirections +.asm_f1dc9 + cp [hl] + inc hl + jr nz, .asm_f1dc9 + dec hl + push hl + ld c, BANK(Music_JigglypuffSong) + ld a, MUSIC_JIGGLYPUFF_SONG + call PlayMusic + pop hl +.asm_f1dd7 + ld a, [hl] + ld [wSpriteStateData1 + 3 * $10 + 2], a + push hl + ld hl, wJigglypuffFacingDirections + ld de, wJigglypuffFacingDirections2 + ld bc, JigglypuffSpinDataEnd - JigglypuffSpinData + call CopyData + ld a, [wJigglypuffFacingDirections2] + ld [wcd42], a + pop hl + ld c, 24 + call DelayFrames + ld a, [wChannelSoundIDs] + ld b, a + ld a, [wChannelSoundIDs + 1] + or b + jr nz, .asm_f1dd7 + ld c, 48 + call DelayFrames + call PlayDefaultMusic + ld a, [wd472] + bit 7, a + ret z + callab CheckPikachuFaintedOrStatused + ret c + call DisablePikachuFollowingPlayer + ret + +.Text + TX_FAR _PewterJigglypuffText + db "@" + +JigglypuffSpinData: + db $40 | SPRITE_FACING_DOWN + db $40 | SPRITE_FACING_LEFT + db $40 | SPRITE_FACING_UP + db $40 | SPRITE_FACING_RIGHT +JigglypuffSpinDataEnd: diff --git a/scripts/pokemontower1.asm b/scripts/pokemontower1.asm index 6d9d1b3f..1209b875 100755 --- a/scripts/pokemontower1.asm +++ b/scripts/pokemontower1.asm @@ -1,5 +1,6 @@ PokemonTower1Script: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret PokemonTower1TextPointers: dw PokemonTower1Text1 diff --git a/scripts/pokemontower2.asm b/scripts/pokemontower2.asm index 383b175d..0a0aa3d5 100755 --- a/scripts/pokemontower2.asm +++ b/scripts/pokemontower2.asm @@ -2,7 +2,7 @@ PokemonTower2Script: call EnableAutoTextBoxDrawing ld hl, PokemonTower2ScriptPointers ld a, [wPokemonTower2CurScript] - jp CallFunctionInTable + jp JumpTable PokemonTower2Script_604fe: xor a @@ -22,9 +22,7 @@ PokemonTower2Script0: ld hl, CoordsData_6055e call ArePlayerCoordsInArray ret nc - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic ld c, BANK(Music_MeetRival) ld a, MUSIC_MEET_RIVAL call PlayMusic @@ -71,14 +69,13 @@ PokemonTower2Script1: ld de, MovementData_605b2 CheckEvent EVENT_POKEMON_TOWER_RIVAL_ON_LEFT jr nz, .asm_60589 + callab Func_f1e22 ld de, MovementData_605a9 .asm_60589 ld a, $1 ld [H_SPRITEINDEX], a call MoveSprite - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic callba Music_RivalAlternateStart ld a, $2 ld [wPokemonTower2CurScript], a @@ -144,21 +141,8 @@ PokemonTower2Text1: call SaveEndBattleTextPointers ld a, OPP_SONY2 ld [wCurOpponent], a - - ; select which team to use during the encounter ld a, [wRivalStarter] - cp STARTER2 - jr nz, .NotSquirtle - ld a, $4 - jr .done -.NotSquirtle - cp STARTER3 - jr nz, .Charmander - ld a, $5 - jr .done -.Charmander - ld a, $6 -.done + add $1 ld [wTrainerNo], a ld a, $1 diff --git a/scripts/pokemontower2_2.asm b/scripts/pokemontower2_2.asm new file mode 100755 index 00000000..42659da3 --- /dev/null +++ b/scripts/pokemontower2_2.asm @@ -0,0 +1,12 @@ +Func_f1e22: + ld hl, PikachuMovementData_f1e2b + ld b, SPRITE_FACING_RIGHT + call TryApplyPikachuMovementData + ret + +PikachuMovementData_f1e2b: + db $00 + db $1d + db $1f + db $38 + db $3f diff --git a/scripts/pokemontower7.asm b/scripts/pokemontower7.asm index 348534b4..9a016d84 100755 --- a/scripts/pokemontower7.asm +++ b/scripts/pokemontower7.asm @@ -1,76 +1,241 @@ PokemonTower7Script: call EnableAutoTextBoxDrawing - ld hl, PokemonTower7TrainerHeaders - ld de, PokemonTower7ScriptPointers + ld hl, PokemonTower7ScriptPointers ld a, [wPokemonTower7CurScript] - call ExecuteCurMapScriptInTable - ld [wPokemonTower7CurScript], a + call JumpTable ret -PokemonTower7Script_60d18: +PokemonTower7Script_60d01: xor a ld [wJoyIgnore], a +PokemonTower7Script_60d05: ld [wPokemonTower7CurScript], a - ld [wCurMapScript], a ret PokemonTower7ScriptPointers: - dw CheckFightingMapTrainers - dw DisplayEnemyTrainerTextAndStartBattle + dw PokemonTower7Script0 + dw PokemonTower7Script1 dw PokemonTower7Script2 dw PokemonTower7Script3 dw PokemonTower7Script4 + dw PokemonTower7Script5 + dw PokemonTower7Script6 + dw PokemonTower7Script7 + dw PokemonTower7Script8 + dw PokemonTower7Script9 + dw PokemonTower7Script10 + dw PokemonTower7Script11 + +PokemonTower7Script0: + CheckEvent EVENT_BEAT_POKEMONTOWER_7_TRAINER_0 + call z, PokemonTower7Script_60d2a + ret -PokemonTower7Script2: - ld hl, wFlags_0xcd60 - res 0, [hl] - ld a, [wIsInBattle] - cp $ff - jp z, PokemonTower7Script_60d18 - call EndTrainerBattle - ld a, $f0 +PokemonTower7Script_60d2a: + ld a, [wYCoord] + cp $c + ret nz + ResetEvent EVENT_BEAT_POKEMONTOWER_7_TRAINER_1 + ld a, [wXCoord] + cp $a + jr z, .asm_60d47 + ld a, [wXCoord] ; why? + cp $b + ret nz + SetEvent EVENT_BEAT_POKEMONTOWER_7_TRAINER_1 +.asm_60d47 + call StopAllMusic + ld c, BANK(Music_MeetJessieJames) + ld a, MUSIC_MEET_JESSIE_JAMES + call PlayMusic + xor a + ld [hJoyHeld], a + ld a, $FF ^ (A_BUTTON | B_BUTTON) ld [wJoyIgnore], a - ld a, [wSpriteIndex] + ld a, HS_POKEMONTOWER_7_JESSIE + call PokemonTower7Script_60eaf + ld a, HS_POKEMONTOWER_7_JAMES + call PokemonTower7Script_60eaf + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld a, $4 ld [hSpriteIndexOrTextID], a call DisplayTextID - call PokemonTower7Script_60db6 - ld a, $3 - ld [wPokemonTower7CurScript], a - ld [wCurMapScript], a + ld a, $ff + ld [wJoyIgnore], a + ld a, $1 + call PokemonTower7Script_60d05 ret +PokemonTower7MovementData_60d7a: + db $4 +PokemonTower7MovementData_60d7b: + db $4 + db $4 + db $4 + db $FF + +PokemonTower7Script1: + ld de, PokemonTower7MovementData_60d7b + CheckEvent EVENT_BEAT_POKEMONTOWER_7_TRAINER_1 + jr z, .asm_60d8c + ld de, PokemonTower7MovementData_60d7a +.asm_60d8c + ld a, $1 + ld [hSpriteIndexOrTextID], a + call MoveSprite + ld a, $ff + ld [wJoyIgnore], a + ld a, $2 + call PokemonTower7Script_60d05 + ret + +PokemonTower7Script2: + ld a, $ff + ld [wJoyIgnore], a + ld a, [wd730] + bit 0, a + ret nz PokemonTower7Script3: + ld a, $0 + ld [wSpriteStateData1 + 1 * $10 + 9], a + CheckEvent EVENT_BEAT_POKEMONTOWER_7_TRAINER_1 + jr z, .asm_60dba + ld a, $c + ld [wSpriteStateData1 + 1 * $10 + 9], a +.asm_60dba + ld a, $2 + ld [wSpriteStateData1 + 1 * $10 + 1], a +PokemonTower7Script4: + ld de, PokemonTower7MovementData_60d7a + CheckEvent EVENT_BEAT_POKEMONTOWER_7_TRAINER_1 + jr z, .asm_60dcc + ld de, PokemonTower7MovementData_60d7b +.asm_60dcc + ld a, $2 + ld [hSpriteIndexOrTextID], a + call MoveSprite + ld a, $ff + ld [wJoyIgnore], a + ld a, $5 + call PokemonTower7Script_60d05 + ret +PokemonTower7Script5: + ld a, $ff + ld [wJoyIgnore], a ld a, [wd730] bit 0, a ret nz - ld hl, wMissableObjectList - ld a, [wSpriteIndex] - ld b, a -.missableObjectsListLoop - ld a, [hli] - cp b ; search for sprite ID in missing objects list - ld a, [hli] - jr nz, .missableObjectsListLoop - ld [wMissableObjectIndex], a ; remove missable object - predef HideObject +PokemonTower7Script6: + ld a, $2 + ld [wSpriteStateData1 + $2 * $10 + $1], a + ld a, $8 + ld [wSpriteStateData1 + $2 * $10 + $9], a + CheckEvent EVENT_BEAT_POKEMONTOWER_7_TRAINER_1 + jr z, .asm_60dff + ld a, $0 + ld [wSpriteStateData1 + $2 * $10 + $9], a +.asm_60dff + call Delay3 + ld a, $FF ^ (A_BUTTON | B_BUTTON) + ld [wJoyIgnore], a + ld a, $5 + ld [hSpriteIndexOrTextID], a + call DisplayTextID +PokemonTower7Script7: + ld hl, wd72d + set 6, [hl] + set 7, [hl] + ld hl, PokemonTower7JessieJamesEndBattleText + ld de, PokemonTower7JessieJamesEndBattleText + call SaveEndBattleTextPointers + ld a, OPP_ROCKET + ld [wCurOpponent], a + ld a, $2c + ld [wTrainerNo], a + xor a + ld [hJoyHeld], a + ld [wJoyIgnore], a + ld a, $8 + call PokemonTower7Script_60d05 + ret + +PokemonTower7Script8: + ld a, $ff + ld [wJoyIgnore], a + ld a, [wIsInBattle] + cp $ff + jp z, PokemonTower7Script_60d01 + ld a, $2 + ld [wSpriteStateData1 + 1 * $10 + 1], a + ld [wSpriteStateData1 + 2 * $10 + 1], a + xor a + ld [wSpriteStateData1 + 1 * $10 + 9], a + ld [wSpriteStateData1 + 2 * $10 + 9], a + ld a, $FF ^ (A_BUTTON | B_BUTTON) + ld [wJoyIgnore], a + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld a, $6 + ld [hSpriteIndexOrTextID], a + call DisplayTextID + xor a + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + call StopAllMusic + ld c, BANK(Music_MeetJessieJames) + ld a, MUSIC_MEET_JESSIE_JAMES + call PlayMusic + ld a, $ff + ld [wJoyIgnore], a + ld a, $9 + call PokemonTower7Script_60d05 + ret + +PokemonTower7Script9: + ld a, $ff + ld [wJoyIgnore], a + call GBFadeOutToBlack + ld a, HS_POKEMONTOWER_7_JESSIE + call PokemonTower7Script_60ebe + ld a, HS_POKEMONTOWER_7_JAMES + call PokemonTower7Script_60ebe + call UpdateSprites + call Delay3 + call GBFadeInFromBlack + ld a, $a + call PokemonTower7Script_60d05 + ret + +PokemonTower7Script10: + call PlayDefaultMusic xor a + ld [hJoyHeld], a ld [wJoyIgnore], a - ld [wSpriteIndex], a - ld [wTrainerHeaderFlagBit], a - ld [wUnusedDA38], a + SetEvent EVENT_BEAT_POKEMONTOWER_7_TRAINER_0 ld a, $0 - ld [wPokemonTower7CurScript], a - ld [wCurMapScript], a + call PokemonTower7Script_60d05 ret -PokemonTower7Script4: +PokemonTower7Script_60eaf: + ld [wMissableObjectIndex], a + predef ShowObject + call UpdateSprites + call Delay3 + ret + +PokemonTower7Script_60ebe + ld [wMissableObjectIndex], a + predef HideObject + ret + +PokemonTower7Script11: ld a, $ff ld [wJoyIgnore], a ld a, HS_POKEMONTOWER_7_MR_FUJI ld [wMissableObjectIndex], a predef HideObject ld a, SPRITE_FACING_UP - ld [wSpriteStateData1 + 9], a + ld [wPlayerFacingDirection], a ld a, LAVENDER_HOUSE_1 ld [hWarpDestinationMap], a ld a, $1 @@ -81,180 +246,54 @@ PokemonTower7Script4: set 3, [hl] ld a, $0 ld [wPokemonTower7CurScript], a - ld [wCurMapScript], a ret -PokemonTower7Script_60db6: - ld hl, CoordsData_60de3 - ld a, [wSpriteIndex] - dec a - swap a - ld d, $0 - ld e, a - add hl, de - ld a, [wYCoord] - ld b, a - ld a, [wXCoord] - ld c, a -.asm_60dcb - ld a, [hli] - cp b - jr nz, .asm_60dde - ld a, [hli] - cp c - jr nz, .asm_60ddf - ld a, [hli] - ld d, [hl] - ld e, a - ld a, [wSpriteIndex] - ld [H_SPRITEINDEX], a - jp MoveSprite -.asm_60dde - inc hl -.asm_60ddf - inc hl - inc hl - jr .asm_60dcb - -CoordsData_60de3: - db $0C,$09 - dw MovementData_60e13 - db $0B,$0A - dw MovementData_60e1b - db $0B,$0B - dw MovementData_60e22 - db $0B,$0C - dw MovementData_60e22 - db $0A,$0C - dw MovementData_60e28 - db $09,$0B - dw MovementData_60e30 - db $09,$0A - dw MovementData_60e22 - db $09,$09 - dw MovementData_60e22 - db $08,$09 - dw MovementData_60e37 - db $07,$0A - dw MovementData_60e22 - db $07,$0B - dw MovementData_60e22 - db $07,$0C - dw MovementData_60e22 - -MovementData_60e13: - db NPC_MOVEMENT_RIGHT - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_LEFT - db $FF - -MovementData_60e1b: - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_RIGHT - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db $FF - -MovementData_60e22: - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db $FF - -MovementData_60e28: - db NPC_MOVEMENT_LEFT - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db $FF - -MovementData_60e30: - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_LEFT - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db $FF - -MovementData_60e37: - db NPC_MOVEMENT_RIGHT - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db NPC_MOVEMENT_DOWN - db $FF - PokemonTower7TextPointers: dw PokemonTower7Text1 dw PokemonTower7Text2 dw PokemonTower7Text3 - dw PokemonTower7FujiText - -PokemonTower7TrainerHeaders: -PokemonTower7TrainerHeader0: - dbEventFlagBit EVENT_BEAT_POKEMONTOWER_7_TRAINER_0 - db ($3 << 4) ; trainer's view range - dwEventFlagAddress EVENT_BEAT_POKEMONTOWER_7_TRAINER_0 - dw PokemonTower7BattleText1 ; TextBeforeBattle - dw PokemonTower7AfterBattleText1 ; TextAfterBattle - dw PokemonTower7EndBattleText1 ; TextEndBattle - dw PokemonTower7EndBattleText1 ; TextEndBattle - -PokemonTower7TrainerHeader1: - dbEventFlagBit EVENT_BEAT_POKEMONTOWER_7_TRAINER_1 - db ($3 << 4) ; trainer's view range - dwEventFlagAddress EVENT_BEAT_POKEMONTOWER_7_TRAINER_1 - dw PokemonTower7BattleText2 ; TextBeforeBattle - dw PokemonTower7AfterBattleText2 ; TextAfterBattle - dw PokemonTower7EndBattleText2 ; TextEndBattle - dw PokemonTower7EndBattleText2 ; TextEndBattle - -PokemonTower7TrainerHeader2: - dbEventFlagBit EVENT_BEAT_POKEMONTOWER_7_TRAINER_2 - db ($3 << 4) ; trainer's view range - dwEventFlagAddress EVENT_BEAT_POKEMONTOWER_7_TRAINER_2 - dw PokemonTower7BattleText3 ; TextBeforeBattle - dw PokemonTower7AfterBattleText3 ; TextAfterBattle - dw PokemonTower7EndBattleText3 ; TextEndBattle - dw PokemonTower7EndBattleText3 ; TextEndBattle - - db $ff + dw PokemonTower7Text4 + dw PokemonTower7Text5 + dw PokemonTower7Text6 PokemonTower7Text1: - TX_ASM - ld hl, PokemonTower7TrainerHeader0 - call TalkToTrainer - jp TextScriptEnd - PokemonTower7Text2: + db "@" + +PokemonTower7Text4: + TX_FAR _PokemonTowerJessieJamesText1 TX_ASM - ld hl, PokemonTower7TrainerHeader1 - call TalkToTrainer + ld c, 10 + call DelayFrames + ld a, PLAYER_DIR_UP + ld [wPlayerMovingDirection], a + ld a, $0 + ld [wEmotionBubbleSpriteIndex], a + ld a, $0 + ld [wWhichEmotionBubble], a + predef EmotionBubble + ld c, 20 + call DelayFrames jp TextScriptEnd -PokemonTower7Text3: +PokemonTower7Text5: + TX_FAR _PokemonTowerJessieJamesText2 + db "@" + +PokemonTower7JessieJamesEndBattleText: + TX_FAR _PokemonTowerJessieJamesText3 + db "@" + +PokemonTower7Text6: + TX_FAR _PokemonTowerJessieJamesText4 TX_ASM - ld hl, PokemonTower7TrainerHeader2 - call TalkToTrainer + ld c, 64 + call DelayFrames jp TextScriptEnd -PokemonTower7FujiText: +PokemonTower7Text3: TX_ASM - ld hl, TowerRescueFujiText + ld hl, PokemonTower7Text_60f75 call PrintText SetEvent EVENT_RESCUED_MR_FUJI SetEvent EVENT_RESCUED_MR_FUJI_2 @@ -267,47 +306,10 @@ PokemonTower7FujiText: ld a, HS_SAFFRON_CITY_F ld [wMissableObjectIndex], a predef ShowObject - ld a, $4 + ld a, $b ld [wPokemonTower7CurScript], a - ld [wCurMapScript], a jp TextScriptEnd -TowerRescueFujiText: +PokemonTower7Text_60f75: TX_FAR _TowerRescueFujiText db "@" - -PokemonTower7BattleText1: - TX_FAR _PokemonTower7BattleText1 - db "@" - -PokemonTower7EndBattleText1: - TX_FAR _PokemonTower7EndBattleText1 - db "@" - -PokemonTower7AfterBattleText1: - TX_FAR _PokemonTower7AfterBattleText1 - db "@" - -PokemonTower7BattleText2: - TX_FAR _PokemonTower7BattleText2 - db "@" - -PokemonTower7EndBattleText2: - TX_FAR _PokemonTower7EndBattleText2 - db "@" - -PokemonTower7AfterBattleText2: - TX_FAR _PokemonTower7AfterBattleText2 - db "@" - -PokemonTower7BattleText3: - TX_FAR _PokemonTower7BattleText3 - db "@" - -PokemonTower7EndBattleText3: - TX_FAR _PokemonTower7EndBattleText3 - db "@" - -PokemonTower7AfterBattleText3: - TX_FAR _PokemonTower7AfterBattleText3 - db "@" diff --git a/scripts/redshouse1f.asm b/scripts/redshouse1f.asm index cbfb35c8..c302462d 100755 --- a/scripts/redshouse1f.asm +++ b/scripts/redshouse1f.asm @@ -1,5 +1,6 @@ RedsHouse1FScript: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret RedsHouse1FTextPointers: dw RedsHouse1FText1 @@ -7,63 +8,10 @@ RedsHouse1FTextPointers: RedsHouse1FText1: ; Mom TX_ASM - ld a, [wd72e] - bit 3, a - jr nz, .heal ; if player has received a Pokémon from Oak, heal team - ld hl, MomWakeUpText - call PrintText - jr .done -.heal - call MomHealPokemon -.done + callab Func_f1b73 jp TextScriptEnd -MomWakeUpText: - TX_FAR _MomWakeUpText - db "@" - -MomHealPokemon: - ld hl, MomHealText1 - call PrintText - call GBFadeOutToWhite - call ReloadMapData - predef HealParty - ld a, MUSIC_PKMN_HEALED - ld [wNewSoundID], a - call PlaySound -.next - ld a, [wChannelSoundIDs] - cp MUSIC_PKMN_HEALED - jr z, .next - ld a, [wMapMusicSoundID] - ld [wNewSoundID], a - call PlaySound - call GBFadeInFromWhite - ld hl, MomHealText2 - jp PrintText - -MomHealText1: - TX_FAR _MomHealText1 - db "@" -MomHealText2: - TX_FAR _MomHealText2 - db "@" - RedsHouse1FText2: ; TV TX_ASM - ld a,[wSpriteStateData1 + 9] - cp SPRITE_FACING_UP - ld hl,TVWrongSideText - jr nz,.notUp - ld hl,StandByMeText -.notUp - call PrintText + callab Func_f1bc4 jp TextScriptEnd - -StandByMeText: - TX_FAR _StandByMeText - db "@" - -TVWrongSideText: - TX_FAR _TVWrongSideText - db "@" diff --git a/scripts/redshouse1f2.asm b/scripts/redshouse1f2.asm new file mode 100755 index 00000000..871f2e31 --- /dev/null +++ b/scripts/redshouse1f2.asm @@ -0,0 +1,58 @@ +Func_f1b73: + ld a, [wd72e] + bit 3, a + jp nz, MomHealPokemon ; if player has received a Pokémon from Oak, heal team + ld hl, MomWakeUpText + call PrintText + ret + +MomWakeUpText: + TX_FAR _MomWakeUpText + db "@" + +MomHealPokemon: + ld hl, MomHealText1 + call PrintText + call GBFadeOutToWhite + call ReloadMapData + predef HealParty + ld a, MUSIC_PKMN_HEALED + ld [wNewSoundID], a + call PlaySound +.loop + ld a, [wChannelSoundIDs] + cp MUSIC_PKMN_HEALED + jr z, .loop + ld a, [wMapMusicSoundID] + ld [wNewSoundID], a + call PlaySound + call GBFadeInFromWhite + ld hl, MomHealText2 + call PrintText + ret + +MomHealText1: + TX_FAR _MomHealText1 + db "@" +MomHealText2: + TX_FAR _MomHealText2 + db "@" + +Func_f1bc4: + ld hl, TVWrongSideText + ld a, [wPlayerFacingDirection] + cp SPRITE_FACING_UP + jp nz, .notUp + ld hl, StandByMeText +.notUp + call PrintText + ret + +StandByMeText: + TX_FAR _StandByMeText + db "@" + +TVWrongSideText: + TX_FAR _TVWrongSideText + db "@" + diff --git a/scripts/redshouse2f.asm b/scripts/redshouse2f.asm index 60c3ea67..0945e901 100755 --- a/scripts/redshouse2f.asm +++ b/scripts/redshouse2f.asm @@ -1,23 +1,22 @@ RedsHouse2FScript: call EnableAutoTextBoxDrawing - ld hl,RedsHouse2FScriptPointers - ld a,[wRedsHouse2CurScript] - jp CallFunctionInTable + ld hl, RedsHouse2FScriptPointers + ld a, 0 + call JumpTable + ret RedsHouse2FScriptPointers: dw RedsHouse2FScript0 dw RedsHouse2FScript1 + dw RedsHouse2FScript2 + dw RedsHouse2FScript3 + dw RedsHouse2FScript4 RedsHouse2FScript0: - xor a - ld [hJoyHeld],a - ld a,PLAYER_DIR_UP - ld [wPlayerMovingDirection],a - ld a,1 - ld [wRedsHouse2CurScript],a - ret - RedsHouse2FScript1: +RedsHouse2FScript2: +RedsHouse2FScript3: +RedsHouse2FScript4: ret RedsHouse2FTextPointers: diff --git a/scripts/rockethideout4.asm b/scripts/rockethideout4.asm index 49da07b3..2b3e0e89 100755 --- a/scripts/rockethideout4.asm +++ b/scripts/rockethideout4.asm @@ -1,5 +1,4 @@ RocketHideout4Script: - call RocketHideout4Script_45473 call EnableAutoTextBoxDrawing ld hl, RocketHideout4TrainerHeader0 ld de, RocketHideout4ScriptPointers @@ -8,47 +7,44 @@ RocketHideout4Script: ld [wRocketHideout4CurScript], a ret -RocketHideout4Script_45473: - ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] - ret z - CheckEvent EVENT_ROCKET_HIDEOUT_4_DOOR_UNLOCKED - jr nz, .asm_45496 - CheckBothEventsSet EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_0, EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_2, 1 - jr z, .asm_4548c - ld a, $2d - jr .asm_45498 -.asm_4548c - ld a, SFX_GO_INSIDE - call PlaySound - SetEvent EVENT_ROCKET_HIDEOUT_4_DOOR_UNLOCKED -.asm_45496 - ld a, $e -.asm_45498 - ld [wNewTileBlockID], a - lb bc, 5, 12 - predef_jump ReplaceTileBlock - -RocketHideout4Script_454a3: +RocketHideout4Script_45510: + CheckAndResetEvent EVENT_6A0 + call nz, RocketHideout4Script_45525 xor a ld [wJoyIgnore], a +RocketHideout4Script_4551e: ld [wRocketHideout4CurScript], a ld [wCurMapScript], a ret +RocketHideout4Script_45525: + ld a, HS_ROCKET_HIDEOUT_4_JAMES + call RocketHideout4Script_45756 + ld a, HS_ROCKET_HIDEOUT_4_JESSIE + call RocketHideout4Script_45756 + ret + RocketHideout4ScriptPointers: - dw CheckFightingMapTrainers + dw RocketHideout4Script0 dw DisplayEnemyTrainerTextAndStartBattle dw EndTrainerBattle dw RocketHideout4Script3 + dw RocketHideout4Script4 + dw RocketHideout4Script5 + dw RocketHideout4Script6 + dw RocketHideout4Script7 + dw RocketHideout4Script8 + dw RocketHideout4Script9 + dw RocketHideout4Script10 + dw RocketHideout4Script11 + dw RocketHideout4Script12 + dw RocketHideout4Script13 RocketHideout4Script3: ld a, [wIsInBattle] cp $ff - jp z, RocketHideout4Script_454a3 - call UpdateSprites - ld a, $f0 + jp z, RocketHideout4Script_45510 + ld a, $fc ld [wJoyIgnore], a SetEvent EVENT_BEAT_ROCKET_HIDEOUT_GIOVANNI ld a, $a @@ -72,61 +68,295 @@ RocketHideout4Script3: ld [wCurMapScript], a ret +RocketHideout4Script0: + CheckEvent EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_0 + call z, RocketHideout4Script_455a5 + CheckEvent EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_3 + call z, CheckFightingMapTrainers + ret + +RocketHideout4Script_455a5: + ld a, [wYCoord] + cp $e + ret nz + ResetEvent EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_2 + ld a, [wXCoord] + cp $18 + jr z, .asm_455c2 + ld a, [wXCoord] + cp $19 + ret nz + SetEvent EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_2 +.asm_455c2 + xor a + ld [hJoyHeld], a + ld a, $fc + ld [wJoyIgnore], a + call StopAllMusic + ld c, BANK(Music_MeetJessieJames) + ld a, MUSIC_MEET_JESSIE_JAMES + call PlayMusic + call UpdateSprites + call Delay3 + call UpdateSprites + call Delay3 + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld a, $b + ld [hSpriteIndexOrTextID], a + call DisplayTextID + xor a + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld a, $ff + ld [wJoyIgnore], a + ld a, HS_ROCKET_HIDEOUT_4_JAMES + call RocketHideout4Script_45747 + ld a, HS_ROCKET_HIDEOUT_4_JESSIE + call RocketHideout4Script_45747 + ld a, $4 + call RocketHideout4Script_4551e + ret + +RocketHideout4JessieJamesMovementData_45605: + db $4 +RocketHideout4JessieJamesMovementData_45606: + db $4 + db $4 + db $4 + db $ff + +RocketHideout4Script4: + ld de, RocketHideout4JessieJamesMovementData_45605 + CheckEvent EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_2 + jr z, .asm_45617 + ld de, RocketHideout4JessieJamesMovementData_45606 +.asm_45617 + ld a, $2 + ld [hSpriteIndexOrTextID], a + call MoveSprite + ld a, $ff + ld [wJoyIgnore], a + ld a, $5 + call RocketHideout4Script_4551e + ret + +RocketHideout4Script5: + ld a, $ff + ld [wJoyIgnore], a + ld a, [wd730] + bit 0, a + ret nz +RocketHideout4Script6: + ld a, $2 + ld [wSpriteStateData1 + 2 * $10 + 1], a + ld a, SPRITE_FACING_LEFT + ld [wSpriteStateData1 + 2 * $10 + 9], a + CheckEvent EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_2 + jr z, .asm_4564a + ld a, SPRITE_FACING_DOWN + ld [wSpriteStateData1 + 2 * $10 + 9], a +.asm_4564a + call Delay3 + ld a, $fc + ld [wJoyIgnore], a +RocketHideout4Script7: + ld de, RocketHideout4JessieJamesMovementData_45606 + CheckEvent EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_2 + jr z, .asm_4565f + ld de, RocketHideout4JessieJamesMovementData_45605 +.asm_4565f + ld a, $3 + ld [hSpriteIndexOrTextID], a + call MoveSprite + ld a, $ff + ld [wJoyIgnore], a + ld a, $8 + call RocketHideout4Script_4551e + ret + +RocketHideout4Script8: + ld a, $ff + ld [wJoyIgnore], a + ld a, [wd730] + bit 0, a + ret nz + ld a, $fc + ld [wJoyIgnore], a +RocketHideout4Script9: + ld a, $2 + ld [wSpriteStateData1 + 3 * $10 + 1], a + ld a, SPRITE_FACING_DOWN + ld [wSpriteStateData1 + 3 * $10 + 9], a + CheckEvent EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_2 + jr z, .asm_45697 + ld a, SPRITE_FACING_RIGHT + ld [wSpriteStateData1 + 3 * $10 + 9], a +.asm_45697 + call Delay3 + ld a, $c + ld [hSpriteIndexOrTextID], a + call DisplayTextID +RocketHideout4Script10: + ld hl, wd72d + set 6, [hl] + set 7, [hl] + ld hl, RocketHideout4JessieJamesEndBattleText + ld de, RocketHideout4JessieJamesEndBattleText + call SaveEndBattleTextPointers + ld a, OPP_ROCKET + ld [wCurOpponent], a + ld a, $2b + ld [wTrainerNo], a + xor a + ld [hJoyHeld], a + ld [wJoyIgnore], a + SetEvent EVENT_6A0 + ld a, $b + call RocketHideout4Script_4551e + ret + +RocketHideout4Script11: + ld a, $ff + ld [wJoyIgnore], a + ld a, [wIsInBattle] + cp $ff + jp z, RocketHideout4Script_45510 + ld a, $2 + ld [wSpriteStateData1 + 2 * $10 + 1], a + ld [wSpriteStateData1 + 3 * $10 + 1], a + xor a + ld [wSpriteStateData1 + 2 * $10 + 9], a + ld [wSpriteStateData1 + 3 * $10 + 9], a + ld a, $fc + ld [wJoyIgnore], a + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld a, $d + ld [hSpriteIndexOrTextID], a + call DisplayTextID + xor a + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + call StopAllMusic + ld c, BANK(Music_MeetJessieJames) + ld a, MUSIC_MEET_JESSIE_JAMES + call PlayMusic + ld a, $ff + ld [wJoyIgnore], a + ld a, $c + call RocketHideout4Script_4551e + ret + +RocketHideout4Script12: + ld a, $ff + ld [wJoyIgnore], a + call GBFadeOutToBlack + ld a, HS_ROCKET_HIDEOUT_4_JAMES + call RocketHideout4Script_45756 + ld a, HS_ROCKET_HIDEOUT_4_JESSIE + call RocketHideout4Script_45756 + call UpdateSprites + call Delay3 + call GBFadeInFromBlack + ld a, $d + call RocketHideout4Script_4551e + ret + +RocketHideout4Script13: + call PlayDefaultMusic + xor a + ld [hJoyHeld], a + ld [wJoyIgnore], a + SetEvent EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_0 + ld a, $0 + call RocketHideout4Script_4551e + ret + +RocketHideout4Script_45747: + ld [wMissableObjectIndex], a + predef ShowObject + call UpdateSprites + call Delay3 + ret + +RocketHideout4Script_45756: + ld [wMissableObjectIndex], a + predef HideObject + ret + RocketHideout4TextPointers: + dw RocketHideout4Text0 dw RocketHideout4Text1 dw RocketHideout4Text2 dw RocketHideout4Text3 - dw RocketHideout4Text4 dw PickUpItemText dw PickUpItemText dw PickUpItemText dw PickUpItemText dw PickUpItemText + dw RocketHideout4Text9 dw RocketHideout4Text10 + dw RocketHideout4Text11 + dw RocketHideout4Text12 RocketHideout4TrainerHeaders: RocketHideout4TrainerHeader0: - dbEventFlagBit EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_0 - db ($0 << 4) ; trainer's view range - dwEventFlagAddress EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_0 - dw RocketHideout4BattleText2 ; TextBeforeBattle - dw RocketHideout4AfterBattleText2 ; TextAfterBattle - dw RocketHideout4EndBattleText2 ; TextEndBattle - dw RocketHideout4EndBattleText2 ; TextEndBattle - -RocketHideout4TrainerHeader2: - dbEventFlagBit EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_2 - db ($0 << 4) ; trainer's view range - dwEventFlagAddress EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_2 - dw RocketHideout4BattleText3 ; TextBeforeBattle - dw RocketHideout4AfterBattleText3 ; TextAfterBattle - dw RocketHideout4EndBattleText3 ; TextEndBattle - dw RocketHideout4EndBattleText3 ; TextEndBattle - -RocketHideout4TrainerHeader3: dbEventFlagBit EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_3 - db ($1 << 4) ; trainer's view range + db ($1 << 4) dwEventFlagAddress EVENT_BEAT_ROCKET_HIDEOUT_4_TRAINER_3 - dw RocketHideout4BattleText4 ; TextBeforeBattle - dw RocketHideout4AfterBattleText4 ; TextAfterBattle - dw RocketHideout4EndBattleText4 ; TextEndBattle - dw RocketHideout4EndBattleText4 ; TextEndBattle - + dw RocketHideout4Trainer0BeforeText + dw RocketHideout4Trainer0AfterText + dw RocketHideout4Trainer0EndBattleText + dw RocketHideout4Trainer0EndBattleText db $ff RocketHideout4Text1: +RocketHideout4Text2: + db "@" + +RocketHideout4Text10: + TX_FAR _RocketHideoutJessieJamesText1 + TX_ASM + ld c, 10 + call DelayFrames + ld a, $8 + ld [wPlayerMovingDirection], a + ld a, $0 + ld [wEmotionBubbleSpriteIndex], a + ld a, $0 + ld [wWhichEmotionBubble], a + predef EmotionBubble + ld c, 20 + call DelayFrames + jp TextScriptEnd + +RocketHideout4Text11: + TX_FAR _RocketHideoutJessieJamesText2 + db "@" + +RocketHideout4JessieJamesEndBattleText: + TX_FAR _RocketHideoutJessieJamesText3 + db "@" + +RocketHideout4Text12: + TX_FAR _RocketHideoutJessieJamesText4 + TX_ASM + ld c, 64 + call DelayFrames + jp TextScriptEnd + +RocketHideout4Text0: TX_ASM CheckEvent EVENT_BEAT_ROCKET_HIDEOUT_GIOVANNI - jp nz, .asm_545571 - ld hl, RocketHideout4Text_4557a + jp nz, .asm_457fb + ld hl, RocketHideout4Text_45804 call PrintText ld hl, wd72d set 6, [hl] set 7, [hl] - ld hl, RocketHideout4Text_4557f - ld de, RocketHideout4Text_4557f + ld hl, RocketHideout4Text_45809 + ld de, RocketHideout4Text_45809 call SaveEndBattleTextPointers - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndexOrTextID] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters @@ -135,87 +365,52 @@ RocketHideout4Text1: ld a, $3 ld [wRocketHideout4CurScript], a ld [wCurMapScript], a - jr .asm_209f0 -.asm_545571 - ld hl, RocketHideout4Text10 + jr .asm_45801 + +.asm_457fb + ld hl, RocketHideout4Text9 call PrintText -.asm_209f0 +.asm_45801 jp TextScriptEnd -RocketHideout4Text_4557a: +RocketHideout4Text_45804: TX_FAR _RocketHideout4Text_4557a db "@" -RocketHideout4Text_4557f: +RocketHideout4Text_45809: TX_FAR _RocketHideout4Text_4557f db "@" -RocketHideout4Text10: +RocketHideout4Text9: TX_FAR _RocketHideout4Text_45584 db "@" -RocketHideout4Text2: - TX_ASM - ld hl, RocketHideout4TrainerHeader0 - call TalkToTrainer - jp TextScriptEnd - -RocketHideout4BattleText2: - TX_FAR _RocketHideout4BattleText2 - db "@" - -RocketHideout4EndBattleText2: - TX_FAR _RocketHideout4EndBattleText2 - db "@" - -RocketHideout4AfterBattleText2: - TX_FAR _RocketHide4AfterBattleText2 - db "@" - RocketHideout4Text3: TX_ASM - ld hl, RocketHideout4TrainerHeader2 - call TalkToTrainer - jp TextScriptEnd - -RocketHideout4BattleText3: - TX_FAR _RocketHideout4BattleText3 - db "@" - -RocketHideout4EndBattleText3: - TX_FAR _RocketHideout4EndBattleText3 - db "@" - -RocketHideout4AfterBattleText3: - TX_FAR _RocketHide4AfterBattleText3 - db "@" - -RocketHideout4Text4: - TX_ASM - ld hl, RocketHideout4TrainerHeader3 + ld hl, RocketHideout4TrainerHeader0 call TalkToTrainer jp TextScriptEnd -RocketHideout4BattleText4: +RocketHideout4Trainer0BeforeText: TX_FAR _RocketHideout4BattleText4 db "@" -RocketHideout4EndBattleText4: +RocketHideout4Trainer0EndBattleText: TX_FAR _RocketHideout4EndBattleText4 - db "@" - -RocketHideout4AfterBattleText4: + TX_BUTTON_SOUND TX_ASM - ld hl, RocketHideout4Text_455ec - call PrintText - CheckAndSetEvent EVENT_ROCKET_DROPPED_LIFT_KEY - jr nz, .asm_455e9 + SetEvent EVENT_ROCKET_DROPPED_LIFT_KEY ld a, HS_ROCKET_HIDEOUT_4_ITEM_5 ld [wMissableObjectIndex], a predef ShowObject -.asm_455e9 jp TextScriptEnd -RocketHideout4Text_455ec: +RocketHideout4Trainer0AfterText: + TX_ASM + ld hl, RocketHideout4Text_45844 + call PrintText + jp TextScriptEnd + +RocketHideout4Text_45844: TX_FAR _RocketHideout4Text_455ec db "@" diff --git a/scripts/rocktunnelpokecenter.asm b/scripts/rocktunnelpokecenter.asm index 7bcdc1ae..68c5f31a 100755 --- a/scripts/rocktunnelpokecenter.asm +++ b/scripts/rocktunnelpokecenter.asm @@ -7,9 +7,10 @@ RockTunnelPokecenterTextPointers: dw RockTunnelPokecenterText2 dw RockTunnelPokecenterText3 dw RockTunnelTradeNurseText + dw RockTunnelPokecenterText5 RockTunnelHealNurseText: - db $ff + TX_POKECENTER_NURSE RockTunnelPokecenterText2: TX_FAR _RockTunnelPokecenterText2 @@ -20,4 +21,9 @@ RockTunnelPokecenterText3: db "@" RockTunnelTradeNurseText: - db $f6 + TX_CABLE_CLUB_RECEPTIONIST + +RockTunnelPokecenterText5: + TX_ASM + callab PokecenterChanseyText + jp TextScriptEnd diff --git a/scripts/route1.asm b/scripts/route1.asm index a4d6cde5..4d046124 100755 --- a/scripts/route1.asm +++ b/scripts/route1.asm @@ -1,5 +1,6 @@ Route1Script: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret Route1TextPointers: dw Route1Text1 @@ -8,44 +9,15 @@ Route1TextPointers: Route1Text1: TX_ASM - CheckAndSetEvent EVENT_GOT_POTION_SAMPLE - jr nz, .asm_1cada - ld hl, Route1ViridianMartSampleText - call PrintText - lb bc, POTION, 1 - call GiveItem - jr nc, .BagFull - ld hl, Route1Text_1cae8 - jr .asm_1cadd -.BagFull - ld hl, Route1Text_1caf3 - jr .asm_1cadd -.asm_1cada - ld hl, Route1Text_1caee -.asm_1cadd - call PrintText + callba Func_f1ad2 jp TextScriptEnd -Route1ViridianMartSampleText: - TX_FAR _Route1ViridianMartSampleText - db "@" - -Route1Text_1cae8: - TX_FAR _Route1Text_1cae8 - db $0b,"@" - -Route1Text_1caee: - TX_FAR _Route1Text_1caee - db "@" - -Route1Text_1caf3: - TX_FAR _Route1Text_1caf3 - db "@" - Route1Text2: - TX_FAR _Route1Text2 - db "@" + TX_ASM + callba Func_f1b0f + jp TextScriptEnd Route1Text3: - TX_FAR _Route1Text3 - db "@" + TX_ASM + callba Func_f1b1b + jp TextScriptEnd diff --git a/scripts/route11gateupstairs.asm b/scripts/route11gateupstairs.asm index 6c8d6e99..300b299a 100755 --- a/scripts/route11gateupstairs.asm +++ b/scripts/route11gateupstairs.asm @@ -9,7 +9,7 @@ Route11GateUpstairsTextPointers: Route11GateUpstairsText1: TX_ASM - xor a + ld a, $0 ld [wWhichTrade], a predef DoInGameTradeDialogue Route11GateUpstairsScriptEnd: @@ -47,7 +47,7 @@ Route11GateUpstairsText_494a3: Route11GateUpstairsText3: TX_ASM - ld a, [wSpriteStateData1 + 9] + ld a, [wPlayerFacingDirection] cp SPRITE_FACING_UP jp nz, GateUpstairsScript_PrintIfFacingUp CheckEvent EVENT_BEAT_ROUTE12_SNORLAX diff --git a/scripts/route12gateupstairs.asm b/scripts/route12gateupstairs.asm index 3c6c6231..bdbbf526 100755 --- a/scripts/route12gateupstairs.asm +++ b/scripts/route12gateupstairs.asm @@ -64,7 +64,7 @@ Route12GateUpstairsText_495c4: db "@" GateUpstairsScript_PrintIfFacingUp: - ld a, [wSpriteStateData1 + 9] + ld a, [wPlayerFacingDirection] cp SPRITE_FACING_UP jr z, .up ld a, $1 diff --git a/scripts/route16gate.asm b/scripts/route16gate.asm index e20ba6f7..df478b1f 100755 --- a/scripts/route16gate.asm +++ b/scripts/route16gate.asm @@ -4,7 +4,7 @@ Route16GateScript: call EnableAutoTextBoxDrawing ld a, [wRoute16GateCurScript] ld hl, Route16GateScriptPointers - jp CallFunctionInTable + jp JumpTable Route16GateScriptPointers: dw Route16GateScript0 diff --git a/scripts/route18.asm b/scripts/route18.asm index b89e2613..7b654e7c 100755 --- a/scripts/route18.asm +++ b/scripts/route18.asm @@ -110,3 +110,4 @@ Route18Text4: Route18Text5: TX_FAR _Route18Text5 db "@" +; 59b64 diff --git a/scripts/route18gate.asm b/scripts/route18gate.asm index 893801a1..186ea61b 100755 --- a/scripts/route18gate.asm +++ b/scripts/route18gate.asm @@ -4,7 +4,7 @@ Route18GateScript: call EnableAutoTextBoxDrawing ld a, [wRoute18GateCurScript] ld hl, Route18GateScriptPointers - jp CallFunctionInTable + jp JumpTable Route18GateScriptPointers: dw Route18GateScript0 diff --git a/scripts/route19.asm b/scripts/route19.asm index 7b6aa8f0..162c4548 100755 --- a/scripts/route19.asm +++ b/scripts/route19.asm @@ -37,7 +37,7 @@ Route19TrainerHeader0: Route19TrainerHeader1: dbEventFlagBit EVENT_BEAT_ROUTE_19_TRAINER_1 - db ($3 << 4) ; trainer's view range + db ($4 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_ROUTE_19_TRAINER_1 dw Route19BattleText2 ; TextBeforeBattle dw Route19AfterBattleText2 ; TextAfterBattle @@ -121,60 +121,52 @@ Route19TrainerHeader9: Route19Text1: TX_ASM ld hl, Route19TrainerHeader0 - call TalkToTrainer - jp TextScriptEnd + jr Route19_TalkToTrainer Route19Text2: TX_ASM ld hl, Route19TrainerHeader1 - call TalkToTrainer - jp TextScriptEnd + jr Route19_TalkToTrainer Route19Text3: TX_ASM ld hl, Route19TrainerHeader2 - call TalkToTrainer - jp TextScriptEnd + jr Route19_TalkToTrainer Route19Text4: TX_ASM ld hl, Route19TrainerHeader3 - call TalkToTrainer - jp TextScriptEnd + jr Route19_TalkToTrainer Route19Text5: TX_ASM ld hl, Route19TrainerHeader4 - call TalkToTrainer - jp TextScriptEnd + jr Route19_TalkToTrainer Route19Text6: TX_ASM ld hl, Route19TrainerHeader5 - call TalkToTrainer - jp TextScriptEnd + jr Route19_TalkToTrainer Route19Text7: TX_ASM ld hl, Route19TrainerHeader6 - call TalkToTrainer - jp TextScriptEnd + jr Route19_TalkToTrainer Route19Text8: TX_ASM ld hl, Route19TrainerHeader7 - call TalkToTrainer - jp TextScriptEnd + jr Route19_TalkToTrainer Route19Text9: TX_ASM ld hl, Route19TrainerHeader8 - call TalkToTrainer - jp TextScriptEnd + jr Route19_TalkToTrainer Route19Text10: TX_ASM ld hl, Route19TrainerHeader9 +Route19_TalkToTrainer: call TalkToTrainer jp TextScriptEnd diff --git a/scripts/route1_2.asm b/scripts/route1_2.asm new file mode 100755 index 00000000..6e9b472e --- /dev/null +++ b/scripts/route1_2.asm @@ -0,0 +1,53 @@ +Func_f1ad2: + CheckAndSetEvent EVENT_GOT_POTION_SAMPLE + jr nz, .asm_1cada + ld hl, Route1ViridianMartSampleText + call PrintText + lb bc, POTION, 1 + call GiveItem + jr nc, .BagFull + ld hl, Route1Text_f1aff + jr .asm_1cadd +.BagFull + ld hl, Route1Text_f1b0a + jr .asm_1cadd +.asm_1cada + ld hl, Route1Text_f1b05 +.asm_1cadd + call PrintText + ret + +Route1ViridianMartSampleText: + TX_FAR _Route1ViridianMartSampleText + db "@" + +Route1Text_f1aff: + TX_FAR _Route1Text_1cae8 + TX_SFX_ITEM + db "@" + +Route1Text_f1b05: + TX_FAR _Route1Text_1caee + db "@" + +Route1Text_f1b0a: + TX_FAR _Route1Text_1caf3 + db "@" + +Func_f1b0f: + ld hl, Route1Text_f1b16 + call PrintText + ret + +Route1Text_f1b16: + TX_FAR _Route1Text2 + db "@" + +Func_f1b1b: + ld hl, Route1Text_f1b22 + call PrintText + ret + +Route1Text_f1b22: + TX_FAR _Route1Text3 + db "@" diff --git a/scripts/route22.asm b/scripts/route22.asm index 86c3768b..fe881366 100755 --- a/scripts/route22.asm +++ b/scripts/route22.asm @@ -2,7 +2,7 @@ Route22Script: call EnableAutoTextBoxDrawing ld hl, Route22ScriptPointers ld a, [wRoute22CurScript] - jp CallFunctionInTable + jp JumpTable Route22ScriptPointers: dw Route22Script0 @@ -22,16 +22,17 @@ Route22Script7: ret Route22Script_50ed6: + ld a, OPP_SONY1 + ld [wCurOpponent], a + ld a, $2 + ld [wTrainerNo], a + ret + +Route22Script_50ee1: + ld a, OPP_SONY2 + ld [wCurOpponent], a ld a, [wRivalStarter] - ld b, a -.asm_50eda - ld a, [hli] - cp b - jr z, .asm_50ee1 - inc hl - jr .asm_50eda -.asm_50ee1 - ld a, [hl] + add 7 ld [wTrainerNo], a ret @@ -88,9 +89,7 @@ Route22Script0: ld a, [wWalkBikeSurfState] and a jr z, .asm_50f4e - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic .asm_50f4e ld c, BANK(Music_MeetRival) ld a, MUSIC_MEET_RIVAL @@ -131,25 +130,30 @@ Route22Script1: ld hl, Route22RivalDefeatedText1 ld de, Route22Text_511bc call SaveEndBattleTextPointers - ld a, OPP_SONY1 - ld [wCurOpponent], a - ld hl, StarterMons_50faf call Route22Script_50ed6 ld a, $2 ld [wRoute22CurScript], a ret -StarterMons_50faf: -; starter the rival picked, rival trainer number - db STARTER2,$04 - db STARTER3,$05 - db STARTER1,$06 +Route22RivalDefeatedText1: + TX_FAR _Route22RivalDefeatedText1 + db "@" + +Route22Text_511bc: + TX_FAR _Route22Text_511bc + db "@" Route22Script2: ld a, [wIsInBattle] cp $ff jp z, Route22Script_50ece - ld a, [wSpriteStateData1 + 9] + ld a, [wRivalStarter] + cp 2 + jr nz, .asm_50fc9 + ld a, $1 + ld [wRivalStarter], a +.asm_50fc9 + ld a, [wPlayerFacingDirection] and a ; cp SPRITE_FACING_DOWN jr nz, .notDown ld a, SPRITE_FACING_UP @@ -167,9 +171,7 @@ Route22Script2: ld a, $1 ld [hSpriteIndexOrTextID], a call DisplayTextID - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic callba Music_RivalAlternateStart ld a, [wcf0d] cp $1 @@ -241,13 +243,9 @@ Route22Script_5104e: ld a, [wWalkBikeSurfState] and a jr z, .skipYVisibilityTesta - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic .skipYVisibilityTesta - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic callba Music_RivalAlternateTempo ld a, $2 ld [H_SPRITEINDEX], a @@ -287,18 +285,18 @@ Route22Script4: ld hl, Route22RivalDefeatedText2 ld de, Route22Text_511d0 call SaveEndBattleTextPointers - ld a, OPP_SONY2 - ld [wCurOpponent], a - ld hl, StarterMons_510d9 - call Route22Script_50ed6 + call Route22Script_50ee1 ld a, $5 ld [wRoute22CurScript], a ret -StarterMons_510d9: - db STARTER2,$0a - db STARTER3,$0b - db STARTER1,$0c +Route22RivalDefeatedText2: + TX_FAR _Route22RivalDefeatedText2 + db "@" + +Route22Text_511d0: + TX_FAR _Route22Text_511d0 + db "@" Route22Script5: ld a, [wIsInBattle] @@ -326,9 +324,7 @@ Route22Script5: ld a, $2 ld [hSpriteIndexOrTextID], a call DisplayTextID - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic callba Music_RivalAlternateStartAndTempo ld a, [wcf0d] cp $1 @@ -384,62 +380,15 @@ Route22TextPointers: Route22Text1: TX_ASM - CheckEvent EVENT_BEAT_ROUTE22_RIVAL_1ST_BATTLE - jr z, .asm_5118b - ld hl, Route22RivalAfterBattleText1 - call PrintText - jr .asm_51191 -.asm_5118b - ld hl, Route22RivalBeforeBattleText1 - call PrintText -.asm_51191 + callba Func_f1b27 jp TextScriptEnd Route22Text2: TX_ASM - CheckEvent EVENT_BEAT_ROUTE22_RIVAL_2ND_BATTLE - jr z, .asm_511a4 - ld hl, Route22RivalAfterBattleText2 - call PrintText - jr .asm_511aa -.asm_511a4 - ld hl, Route22RivalBeforeBattleText2 - call PrintText -.asm_511aa + callba Func_f1b47 jp TextScriptEnd -Route22RivalBeforeBattleText1: - TX_FAR _Route22RivalBeforeBattleText1 - db "@" - -Route22RivalAfterBattleText1: - TX_FAR _Route22RivalAfterBattleText1 - db "@" - -Route22RivalDefeatedText1: - TX_FAR _Route22RivalDefeatedText1 - db "@" - -Route22Text_511bc: - TX_FAR _Route22Text_511bc - db "@" - -Route22RivalBeforeBattleText2: - TX_FAR _Route22RivalBeforeBattleText2 - db "@" - -Route22RivalAfterBattleText2: - TX_FAR _Route22RivalAfterBattleText2 - db "@" - -Route22RivalDefeatedText2: - TX_FAR _Route22RivalDefeatedText2 - db "@" - -Route22Text_511d0: - TX_FAR _Route22Text_511d0 - db "@" - Route22FrontGateText: - TX_FAR _Route22FrontGateText - db "@" + TX_ASM + callba Func_f1b67 + jp TextScriptEnd diff --git a/scripts/route22_2.asm b/scripts/route22_2.asm new file mode 100755 index 00000000..1cd23ed2 --- /dev/null +++ b/scripts/route22_2.asm @@ -0,0 +1,50 @@ +Func_f1b27: + CheckEvent EVENT_BEAT_ROUTE22_RIVAL_1ST_BATTLE + jr z, .asm_5118b + ld hl, Route22RivalAfterBattleText1 + call PrintText + jr .asm_51191 + +.asm_5118b + ld hl, Route22RivalBeforeBattleText1 + call PrintText +.asm_51191 + ret + +Route22RivalBeforeBattleText1: + TX_FAR _Route22RivalBeforeBattleText1 + db "@" + +Route22RivalAfterBattleText1: + TX_FAR _Route22RivalAfterBattleText1 + db "@" + +Func_f1b47: + CheckEvent EVENT_BEAT_ROUTE22_RIVAL_2ND_BATTLE + jr z, .asm_511a4 + ld hl, Route22RivalAfterBattleText2 + call PrintText + jr .asm_511aa + +.asm_511a4 + ld hl, Route22RivalBeforeBattleText2 + call PrintText +.asm_511aa + ret + +Route22RivalBeforeBattleText2: + TX_FAR _Route22RivalBeforeBattleText2 + db "@" + +Route22RivalAfterBattleText2: + TX_FAR _Route22RivalAfterBattleText2 + db "@" + +Func_f1b67: + ld hl, Route22FrontGateText_3c + call PrintText + ret + +Route22FrontGateText_3c: + TX_FAR _Route22FrontGateText + db "@" diff --git a/scripts/route22gate.asm b/scripts/route22gate.asm index ae9952a5..05fbc7e9 100755 --- a/scripts/route22gate.asm +++ b/scripts/route22gate.asm @@ -2,7 +2,7 @@ Route22GateScript: call EnableAutoTextBoxDrawing ld hl, Route22GateScriptPointers ld a, [wRoute22GateCurScript] - call CallFunctionInTable + call JumpTable ld a, [wYCoord] cp $4 ld a, ROUTE_23 @@ -23,9 +23,12 @@ Route22GateScript0: ret nc xor a ld [hJoyHeld], a + ld a, SPRITE_FACING_LEFT + ld [wSpriteStateData1 + 1 * $10 + 9], a ld a, $1 ld [hSpriteIndexOrTextID], a - jp DisplayTextID + call DisplayTextID + ret Route22GateScriptCoords: db 2,4 @@ -37,7 +40,7 @@ Route22GateScript_1e6ba: ld [wSimulatedJoypadStatesIndex], a ld a, D_DOWN ld [wSimulatedJoypadStatesEnd], a - ld [wSpriteStateData1 + 9], a + ld [wPlayerFacingDirection], a ld [wJoyIgnore], a jp StartSimulatingJoypadStates @@ -59,7 +62,7 @@ Route22GateTextPointers: Route22GateText1: TX_ASM ld a, [wObtainedBadges] - bit 0, a + bit 0, a ; BOULDERBADGE jr nz, .asm_1e6f6 ld hl, Route22GateText_1e704 call PrintText @@ -89,4 +92,5 @@ Route22GateText_1e715: Route22GateText_1e71a: TX_FAR _Route22GateText_1e71a - db $0B, "@" + TX_SFX_ITEM + db "@" diff --git a/scripts/route23.asm b/scripts/route23.asm index ed94d95c..b82ab505 100755 --- a/scripts/route23.asm +++ b/scripts/route23.asm @@ -3,7 +3,7 @@ Route23Script: call EnableAutoTextBoxDrawing ld hl, Route23ScriptPointers ld a, [wRoute23CurScript] - jp CallFunctionInTable + jp JumpTable Route23Script_511e9: ld hl, wCurrentMapScriptFlags @@ -118,7 +118,7 @@ Route23Script_512d8: ld a, D_DOWN ld [wSimulatedJoypadStatesEnd], a xor a - ld [wSpriteStateData1 + 9], a + ld [wPlayerFacingDirection], a ld [wJoyIgnore], a jp StartSimulatingJoypadStates diff --git a/scripts/route24.asm b/scripts/route24.asm index 711fb1ea..d2872ccc 100755 --- a/scripts/route24.asm +++ b/scripts/route24.asm @@ -84,6 +84,7 @@ Route24TextPointers: dw Route24Text6 dw Route24Text7 dw PickUpItemText + dw Route24Text8 Route24TrainerHeaders: Route24TrainerHeader0: @@ -191,7 +192,9 @@ Route24Text_51510: Route24Text_5151a: TX_FAR _Route24Text_5151a - db $0B, $6, "@" + TX_SFX_KEY_ITEM + TX_BUTTON_SOUND + db "@" Route24Text_51521: TX_FAR _Route24Text_51521 @@ -316,3 +319,60 @@ Route24EndBattleText6: Route24AfterBattleText6: TX_FAR _Route24AfterBattleText6 db "@" + +Route24Text8: + TX_ASM + CheckEvent EVENT_54F + jr nz, .asm_515d5 + ld hl, Route24Text_515de + call PrintText + call YesNoChoice + ld a, [wCurrentMenuItem] + and a + jr nz, .asm_515d0 + ld a, CHARMANDER + ld [wd11e], a + ld [wcf91], a + call GetMonName + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + lb bc, CHARMANDER, 10 + call GivePokemon + jp nc, TextScriptEnd + ld a, [wAddedToParty] + and a + call z, WaitForTextScrollButtonPress + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld hl, Route24Text_515e3 + call PrintText + SetEvent EVENT_54F + jp TextScriptEnd + +.asm_515d0 + ld hl, Route24Text_515e9 + jr .asm_515d8 + +.asm_515d5 + ld hl, Route24Text_515ee +.asm_515d8 + call PrintText + jp TextScriptEnd + +Route24Text_515de: + TX_FAR _Route24DamianText1 + db "@" + +Route24Text_515e3: + TX_FAR _Route24DamianText2 + db $d + db "@" + +Route24Text_515e9: + TX_FAR _Route24DamianText3 + db "@" + +Route24Text_515ee: + TX_FAR _Route24DamianText4 + db "@" + diff --git a/scripts/route25.asm b/scripts/route25.asm index 7ebfaff6..cc2e1d9d 100755 --- a/scripts/route25.asm +++ b/scripts/route25.asm @@ -1,14 +1,21 @@ Route25Script: - call Route25Script_515e1 call EnableAutoTextBoxDrawing ld hl, Route25TrainerHeaders ld de, Route25ScriptPointers ld a, [wRoute25CurScript] call ExecuteCurMapScriptInTable ld [wRoute25CurScript], a + call Route25Script_515e1 ret Route25Script_515e1: + ld hl, wd492 + res 2, [hl] + res 3, [hl] + res 4, [hl] + res 7, [hl] + xor a + ld [wBillsHouseCurScript], a ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] @@ -16,14 +23,16 @@ Route25Script_515e1: CheckEventHL EVENT_LEFT_BILLS_HOUSE_AFTER_HELPING ret nz CheckEventReuseHL EVENT_MET_BILL_2 - jr nz, .asm_515ff + jr nz, .asm_51638 ResetEventReuseHL EVENT_BILL_SAID_USE_CELL_SEPARATOR ld a, HS_BILL_POKEMON ld [wMissableObjectIndex], a - predef_jump ShowObject -.asm_515ff + predef ShowObject + jr .asm_5165c + +.asm_51638 CheckEventAfterBranchReuseHL EVENT_GOT_SS_TICKET, EVENT_MET_BILL_2 - ret z + jr z, .asm_5165c SetEventReuseHL EVENT_LEFT_BILLS_HOUSE_AFTER_HELPING ld a, HS_NUGGET_BRIDGE_GUY ld [wMissableObjectIndex], a @@ -33,7 +42,9 @@ Route25Script_515e1: predef HideObject ld a, HS_BILL_2 ld [wMissableObjectIndex], a - predef_jump ShowObject + predef ShowObject +.asm_5165c + ret Route25ScriptPointers: dw CheckFightingMapTrainers diff --git a/scripts/route5gate.asm b/scripts/route5gate.asm index ae75aff2..b3ad0aa3 100755 --- a/scripts/route5gate.asm +++ b/scripts/route5gate.asm @@ -2,7 +2,7 @@ Route5GateScript: call EnableAutoTextBoxDrawing ld a, [wRoute5GateCurScript] ld hl, Route5GateScriptPointers - jp CallFunctionInTable + jp JumpTable Route5GateScriptPointers: dw Route5GateScript0 diff --git a/scripts/route6.asm b/scripts/route6.asm index 53653b39..7f3a5dda 100755 --- a/scripts/route6.asm +++ b/scripts/route6.asm @@ -36,7 +36,7 @@ Route6TrainerHeader1: db ($0 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_ROUTE_6_TRAINER_1 dw Route6BattleText2 ; TextBeforeBattle - dw Route6AfterBattleText1 ; TextAfterBattle + dw Route6AfterBattleText2 ; TextAfterBattle dw Route6EndBattleText2 ; TextEndBattle dw Route6EndBattleText2 ; TextEndBattle @@ -110,6 +110,10 @@ Route6EndBattleText2: TX_FAR _Route6EndBattleText2 db "@" +Route6AfterBattleText2: + TX_FAR _Route6AfterBattleText2 + db "@" + Route6Text3: TX_ASM ld hl, Route6TrainerHeader2 diff --git a/scripts/route6gate.asm b/scripts/route6gate.asm index cf872f69..001a295c 100755 --- a/scripts/route6gate.asm +++ b/scripts/route6gate.asm @@ -2,7 +2,7 @@ Route6GateScript: call EnableAutoTextBoxDrawing ld hl, Route6GateScriptPointers ld a, [wRoute6GateCurScript] - call CallFunctionInTable + call JumpTable ret Route6GateScriptPointers: diff --git a/scripts/route7.asm b/scripts/route7.asm index 5e8288ea..af353821 100755 --- a/scripts/route7.asm +++ b/scripts/route7.asm @@ -1,5 +1,6 @@ Route7Script: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret Route7TextPointers: dw Route7Text1 diff --git a/scripts/route7gate.asm b/scripts/route7gate.asm index 6d4e27bb..6e62c73c 100755 --- a/scripts/route7gate.asm +++ b/scripts/route7gate.asm @@ -2,7 +2,7 @@ Route7GateScript: call EnableAutoTextBoxDrawing ld a, [wRoute7GateCurScript] ld hl, Route7GateScriptPointers - call CallFunctionInTable + call JumpTable ret Route7GateScriptPointers: diff --git a/scripts/route8gate.asm b/scripts/route8gate.asm index 28835f9d..b86458d8 100755 --- a/scripts/route8gate.asm +++ b/scripts/route8gate.asm @@ -2,7 +2,7 @@ Route8GateScript: call EnableAutoTextBoxDrawing ld hl, Route8GateScriptPointers ld a, [wRoute8GateCurScript] - jp CallFunctionInTable + jp JumpTable Route8GateScriptPointers: dw Route8GateScript0 @@ -27,7 +27,7 @@ Route8GateScript0: ld hl, CoordsData_1e22c call ArePlayerCoordsInArray ret nc - ld a, PLAYER_DIR_LEFT + ld a, PLAYER_DIR_UP ld [wPlayerMovingDirection], a xor a ld [hJoyHeld], a diff --git a/scripts/route9.asm b/scripts/route9.asm index 5776d4e6..f08e9790 100755 --- a/scripts/route9.asm +++ b/scripts/route9.asm @@ -14,7 +14,7 @@ Route9ScriptPointers: Route9TextPointers: dw Route9Text1 - dw Route9Text2 + dw Route9TextAJ dw Route9Text3 dw Route9Text4 dw Route9Text5 @@ -39,10 +39,10 @@ Route9TrainerHeader2: dbEventFlagBit EVENT_BEAT_ROUTE_9_TRAINER_2 db ($2 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_ROUTE_9_TRAINER_2 - dw Route9BattleText2 ; TextBeforeBattle - dw Route9AfterBattleText2 ; TextAfterBattle - dw Route9EndBattleText2 ; TextEndBattle - dw Route9EndBattleText2 ; TextEndBattle + dw Route9BattleTextAJ ; TextBeforeBattle + dw Route9AfterBattleTextAJ ; TextAfterBattle + dw Route9EndBattleTextAJ ; TextEndBattle + dw Route9EndBattleTextAJ ; TextEndBattle Route9TrainerHeader3: dbEventFlagBit EVENT_BEAT_ROUTE_9_TRAINER_3 @@ -114,7 +114,7 @@ Route9Text1: ld hl, Route9TrainerHeader0 jr Route9TalkToTrainer -Route9Text2: +Route9TextAJ: TX_ASM ld hl, Route9TrainerHeader2 jr Route9TalkToTrainer @@ -168,16 +168,16 @@ Route9AfterBattleText1: TX_FAR _Route9AfterBattleText1 db "@" -Route9BattleText2: - TX_FAR _Route9BattleText2 +Route9BattleTextAJ: + TX_FAR _Route9BattleTextAJ db "@" -Route9EndBattleText2: - TX_FAR _Route9EndBattleText2 +Route9EndBattleTextAJ: + TX_FAR _Route9EndBattleTextAJ db "@" -Route9AfterBattleText2: - TX_FAR _Route9AfterBattleText2 +Route9AfterBattleTextAJ: + TX_FAR _Route9AfterBattleTextAJ db "@" Route9BattleText3: diff --git a/scripts/safarizoneentrance.asm b/scripts/safarizoneentrance.asm index 5f800987..97578475 100755 --- a/scripts/safarizoneentrance.asm +++ b/scripts/safarizoneentrance.asm @@ -2,7 +2,8 @@ SafariZoneEntranceScript: call EnableAutoTextBoxDrawing ld hl, SafariZoneEntranceScriptPointers ld a, [wSafariZoneEntranceCurScript] - jp CallFunctionInTable + call JumpTable + ret SafariZoneEntranceScriptPointers: dw .SafariZoneEntranceScript0 @@ -25,7 +26,7 @@ SafariZoneEntranceScriptPointers: xor a ld [hJoyHeld], a ld a, SPRITE_FACING_RIGHT - ld [wSpriteStateData1 + 9], a + ld [wPlayerFacingDirection], a ld a, [wCoordIndex] cp $1 jr z, .asm_7520f @@ -43,8 +44,8 @@ SafariZoneEntranceScriptPointers: ret .CoordsData_75221: - db $02,$03 - db $02,$04 + db $02, $03 + db $02, $04 db $FF .SafariZoneEntranceScript1 @@ -85,6 +86,8 @@ SafariZoneEntranceScriptPointers: call DisplayTextID xor a ld [wNumSafariBalls], a + ld [wSafariSteps], a + ld [wSafariSteps], a ; ????? ld a, D_DOWN ld c, $3 call SafariZoneEntranceAutoWalk @@ -117,10 +120,10 @@ SafariZoneEntranceScriptPointers: SafariZoneEntranceAutoWalk: push af - ld b,0 - ld a,c - ld [wSimulatedJoypadStatesIndex],a - ld hl,wSimulatedJoypadStatesEnd + ld b, 0 + ld a, c + ld [wSimulatedJoypadStatesIndex], a + ld hl, wSimulatedJoypadStatesEnd pop af call FillMemory jp StartSimulatingJoypadStates @@ -143,95 +146,21 @@ SafariZoneEntranceTextPointers: db "@" .SafariZoneEntranceText4 - TX_FAR SafariZoneEntranceText_9e6e4 TX_ASM - ld a, MONEY_BOX - ld [wTextBoxID],a - call DisplayTextBoxID - call YesNoChoice - ld a,[wCurrentMenuItem] - and a - jp nz,.PleaseComeAgain - xor a - ld [hMoney],a - ld a,$05 - ld [hMoney + 1],a - ld a,$00 - ld [hMoney + 2],a - call HasEnoughMoney - jr nc,.success - ld hl,.NotEnoughMoneyText - call PrintText - jr .CantPayWalkDown - -.success - xor a - ld [wPriceTemp],a - ld a,$05 - ld [wPriceTemp + 1],a - ld a,$00 - ld [wPriceTemp + 2],a - ld hl,wPriceTemp + 2 - ld de,wPlayerMoney + 2 - ld c,3 - predef SubBCDPredef - ld a,MONEY_BOX - ld [wTextBoxID],a - call DisplayTextBoxID - ld hl,.MakePaymentText - call PrintText - ld a,30 - ld [wNumSafariBalls],a - ld a,502 / $100 - ld [wSafariSteps],a - ld a, 502 % $100 - ld [wSafariSteps + 1],a - ld a,D_UP - ld c,3 - call SafariZoneEntranceAutoWalk - SetEvent EVENT_IN_SAFARI_ZONE - ResetEventReuseHL EVENT_SAFARI_GAME_OVER - ld a,3 - ld [wSafariZoneEntranceCurScript],a - jr .done - -.PleaseComeAgain - ld hl,.PleaseComeAgainText - call PrintText -.CantPayWalkDown - ld a,D_DOWN - ld c,1 - call SafariZoneEntranceAutoWalk - ld a,4 - ld [wSafariZoneEntranceCurScript],a -.done + callab Func_f1f77 jp TextScriptEnd -.MakePaymentText - TX_FAR SafariZoneEntranceText_9e747 - db $b - TX_FAR _SafariZoneEntranceText_75360 - db "@" - -.PleaseComeAgainText - TX_FAR _SafariZoneEntranceText_75365 - db "@" - -.NotEnoughMoneyText - TX_FAR _SafariZoneEntranceText_7536a - db "@" - .SafariZoneEntranceText5 TX_FAR SafariZoneEntranceText_9e814 TX_ASM call YesNoChoice - ld a,[wCurrentMenuItem] + ld a, [wCurrentMenuItem] and a jr nz, .asm_7539c ld hl, .SafariZoneEntranceText_753bb call PrintText xor a - ld [wSpriteStateData1 + 9], a + ld [wPlayerFacingDirection], a ld a, D_DOWN ld c, $3 call SafariZoneEntranceAutoWalk @@ -243,7 +172,7 @@ SafariZoneEntranceTextPointers: ld hl, .SafariZoneEntranceText_753c0 call PrintText ld a, SPRITE_FACING_UP - ld [wSpriteStateData1 + 9], a + ld [wPlayerFacingDirection], a ld a, D_UP ld c, $1 call SafariZoneEntranceAutoWalk @@ -268,26 +197,5 @@ SafariZoneEntranceTextPointers: .SafariZoneEntranceText2 TX_ASM - ld hl,.FirstTimeQuestionText - call PrintText - call YesNoChoice - ld a,[wCurrentMenuItem] - and a - ld hl,.RegularText - jr nz,.Explanation - ld hl,.ExplanationText -.Explanation - call PrintText + callab Func_f203e jp TextScriptEnd - -.FirstTimeQuestionText - TX_FAR _SafariZoneEntranceText_753e6 - db "@" - -.ExplanationText - TX_FAR _SafariZoneEntranceText_753eb - db "@" - -.RegularText - TX_FAR _SafariZoneEntranceText_753f0 - db "@" diff --git a/scripts/safarizoneentrance2.asm b/scripts/safarizoneentrance2.asm new file mode 100755 index 00000000..4a6c23e6 --- /dev/null +++ b/scripts/safarizoneentrance2.asm @@ -0,0 +1,251 @@ +Func_f1f77: + ld hl, .WelcomeText + call PrintText + ld a, MONEY_BOX + ld [wTextBoxID], a + call DisplayTextBoxID + call YesNoChoice + ld a, [wCurrentMenuItem] + and a + jp nz, .declined + ld hl, wPlayerMoney + ld a, [hli] + or [hl] + inc hl + or [hl] + jr nz, .has_positive_balance + call SafariZoneEntranceGetLowCostAdmissionText + jr c, .deny_entry + jr .poor_mans_discount + +.has_positive_balance + xor a + ld [hMoney], a + ld a, $5 + ld [hMoney + 1], a + ld a, $0 + ld [hMoney + 2], a + call HasEnoughMoney + jr nc, .has_enough_money + ld hl, .NotEnoughMoneyText + call PrintText + call SafariZoneEntranceCalculateLowCostAdmission + jr c, .deny_entry + jr .poor_mans_discount + +.has_enough_money + xor a + ld [wPriceTemp + 0], a + ld a, $5 + ld [wPriceTemp + 1], a + ld a, $0 + ld [wPriceTemp + 2], a + ld hl, wTrainerInfoTextBoxNextRowOffset + ld de, wPlayerMoney + 2 + ld c, 3 + predef SubBCDPredef + ld a, SFX_PURCHASE + call PlaySoundWaitForCurrent + call WaitForSoundToFinish + ld a, MONEY_BOX + ld [wTextBoxID], a + call DisplayTextBoxID + ld hl, .MakePaymentText + call PrintText + ld a, 30 + ld hl, 502 +.poor_mans_discount + ld [wNumSafariBalls], a + ld a, h + ld [wSafariSteps], a + ld a, l + ld [wSafariSteps + 1], a + ld a, D_UP + ld c, 3 + call SafariZoneEntranceStartSimulatingJoypadStates + SetEvent EVENT_IN_SAFARI_ZONE + ResetEventReuseHL EVENT_SAFARI_GAME_OVER + ld a, $3 + ld [wSafariZoneEntranceCurScript], a + jr .asm_f2024 +.declined: + ld hl, .PleaseComeAgainText + call PrintText +.deny_entry + ld a, D_DOWN + ld c, 1 + call SafariZoneEntranceStartSimulatingJoypadStates + ld a, $4 + ld [wSafariZoneEntranceCurScript], a +.asm_f2024 + ret + +.WelcomeText + TX_FAR SafariZoneEntranceText_9e6e4 + db "@" + +.MakePaymentText + TX_FAR SafariZoneEntranceText_9e747 + TX_SFX_ITEM + TX_FAR _SafariZoneEntranceText_75360 + db "@" + +.PleaseComeAgainText + TX_FAR _SafariZoneEntranceText_75365 + db "@" + +.NotEnoughMoneyText + TX_FAR _SafariZoneEntranceText_7536a + db "@" + +Func_f203e: + ld hl, .FirstTimeQuestionText + call PrintText + call YesNoChoice + ld a, [wCurrentMenuItem] + and a + ld hl, .RegularText + jr nz, .Explanation + ld hl, .ExplanationText +.Explanation + call PrintText + ret + +.FirstTimeQuestionText + TX_FAR _SafariZoneEntranceText_753e6 + db "@" + +.ExplanationText + TX_FAR _SafariZoneEntranceText_753eb + db "@" + +.RegularText + TX_FAR _SafariZoneEntranceText_753f0 + db "@" + +SafariZoneEntranceStartSimulatingJoypadStates: + push af + ld b, $0 + ld a, c + ld [wSimulatedJoypadStatesIndex], a + ld hl, wParentMenuItem + pop af + call FillMemory + jp StartSimulatingJoypadStates + +SafariZoneEntranceCalculateLowCostAdmission: + ld hl, wPlayerMoney + ld de, hMoney + ld bc, $3 + call CopyData + xor a + ld [hDivideBCDDivisor], a + ld [hDivideBCDDivisor + 1], a + ld a, 23 + ld [hDivideBCDDivisor + 2], a + predef DivideBCDPredef3 + ld a, [hDivideBCDQuotient + 2] + call SafariZoneEntranceConvertBCDtoNumber + push af + ld hl, wPlayerMoney + xor a + ld bc, $3 + call FillMemory + ld hl, SafariZoneEntranceText_f20c4 + call PrintText_NoCreatingTextBox + ld a, MONEY_BOX + ld [wTextBoxID], a + call DisplayTextBoxID + ld hl, SafariZoneEntranceText_f20c9 + call PrintText + pop af + inc a + jr z, .max_balls + cp 29 + jr c, .load_balls +.max_balls + ld a, 29 +.load_balls + ld hl, 502 + and a + ret + +SafariZoneEntranceText_f20c4: + TX_FAR _SafariZoneLowCostText1 + db "@" + +SafariZoneEntranceText_f20c9: + TX_FAR _SafariZoneLowCostText2 + db "@" + +SafariZoneEntranceGetLowCostAdmissionText: + ld hl, wSafariSteps + ld a, [hl] + push af + inc [hl] + ld e, a + ld d, $0 + ld hl, Pointers_f2100 + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + call PrintText + pop af + cp $3 + jr z, .give_one_ball + scf + ret + +.give_one_ball + ld hl, SafariZoneEntranceText_f20f6 + call PrintText_NoCreatingTextBox + ld a, $1 + ld hl, 502 + and a + ret + +SafariZoneEntranceText_f20f6: + TX_FAR _SafariZoneLowCostText3 + TX_SFX_ITEM + TX_FAR _SafariZoneLowCostText4 + db "@" + +Pointers_f2100: + dw SafariZoneEntranceText_f210a + dw SafariZoneEntranceText_f210f + dw SafariZoneEntranceText_f2114 + dw SafariZoneEntranceText_f2119 + dw SafariZoneEntranceText_f2119 + +SafariZoneEntranceText_f210a: + TX_FAR _SafariZoneLowCostText5 + db "@" + +SafariZoneEntranceText_f210f: + TX_FAR _SafariZoneLowCostText6 + db "@" + +SafariZoneEntranceText_f2114: + TX_FAR _SafariZoneLowCostText7 + db "@" + +SafariZoneEntranceText_f2119: + TX_FAR _SafariZoneLowCostText8 + db "@" + +SafariZoneEntranceConvertBCDtoNumber: + push hl + ld c, a + and $f + ld l, a + ld h, $0 + ld a, c + and $f0 + swap a + ld bc, 10 + call AddNTimes + ld a, l + pop hl + ret diff --git a/scripts/saffronpokecenter.asm b/scripts/saffronpokecenter.asm index 82467215..46667927 100755 --- a/scripts/saffronpokecenter.asm +++ b/scripts/saffronpokecenter.asm @@ -7,6 +7,7 @@ SaffronPokecenterTextPointers: dw SaffronPokecenterText2 dw SaffronPokecenterText3 dw SaffronTradeNurseText + dw SaffronPokecenterText5 SaffronHealNurseText: TX_POKECENTER_NURSE @@ -21,3 +22,8 @@ SaffronPokecenterText3: SaffronTradeNurseText: TX_CABLE_CLUB_RECEPTIONIST + +SaffronPokecenterText5: + TX_ASM + callab PokecenterChanseyText + jp TextScriptEnd diff --git a/scripts/school.asm b/scripts/school.asm index 2300946b..a64189e3 100755 --- a/scripts/school.asm +++ b/scripts/school.asm @@ -1,14 +1,22 @@ SchoolScript: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret SchoolTextPointers: dw SchoolText1 dw SchoolText2 + dw SchoolText3 SchoolText1: TX_FAR _SchoolText1 db "@" SchoolText2: - TX_FAR _SchoolText2 - db "@" + TX_ASM + callba Func_f1c0f + jp TextScriptEnd + +SchoolText3: + TX_ASM + callba Func_f1c03 + jp TextScriptEnd diff --git a/scripts/school2.asm b/scripts/school2.asm new file mode 100755 index 00000000..677a43ec --- /dev/null +++ b/scripts/school2.asm @@ -0,0 +1,17 @@ +Func_f1c03: + ld hl, SchoolText_f1c0a + call PrintText + ret + +SchoolText_f1c0a: + TX_FAR _SchoolText3 + db "@" + +Func_f1c0f: + ld hl, SchoolText_f1c16 + call PrintText + ret + +SchoolText_f1c16: + TX_FAR _SchoolText2 + db "@" diff --git a/scripts/seafoamislands4.asm b/scripts/seafoamislands4.asm index 34873004..a1e4b1d8 100755 --- a/scripts/seafoamislands4.asm +++ b/scripts/seafoamislands4.asm @@ -42,7 +42,7 @@ SeafoamIslands4Script: .asm_465ed ld hl, SeafoamIslands4ScriptPointers ld a, [wSeafoamIslands4CurScript] - jp CallFunctionInTable + jp JumpTable Seafoam4HolesCoords: db $10,$03 diff --git a/scripts/seafoamislands5.asm b/scripts/seafoamislands5.asm index a233fb6a..478946fa 100755 --- a/scripts/seafoamislands5.asm +++ b/scripts/seafoamislands5.asm @@ -2,12 +2,13 @@ SeafoamIslands5Script: call EnableAutoTextBoxDrawing ld a, [wSeafoamIslands5CurScript] ld hl, SeafoamIslands5ScriptPointers - jp CallFunctionInTable + jp JumpTable SeafoamIslands5Script_467a5: xor a - ld [wSeafoamIslands5CurScript], a ld [wJoyIgnore], a + ld [wSeafoamIslands5CurScript], a + ld [wCurMapScript], a ret SeafoamIslands5ScriptPointers: diff --git a/scripts/silphco11.asm b/scripts/silphco11.asm index 994cd215..cd5a818d 100755 --- a/scripts/silphco11.asm +++ b/scripts/silphco11.asm @@ -1,5 +1,5 @@ SilphCo11Script: - call SilphCo11Script_62110 + call SilphCo11Script_62127 call EnableAutoTextBoxDrawing ld hl, SilphCo11TrainerHeaders ld de, SilphCo11ScriptPointers @@ -8,26 +8,27 @@ SilphCo11Script: ld [wSilphCo11CurScript], a ret -SilphCo11Script_62110: +SilphCo11Script_62127: ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z ld hl, SilphCo11GateCoords - call SilphCo11Script_62137 - call SilphCo11Script_62163 + call SilphCo11Script_6214f + call SilphCo11Script_6217b CheckEvent EVENT_SILPH_CO_11_UNLOCKED_DOOR ret nz ld a, $20 ld [wNewTileBlockID], a lb bc, 6, 3 - predef_jump ReplaceTileBlock + predef ReplaceTileBlock + ret SilphCo11GateCoords: db $06,$03 db $FF -SilphCo11Script_62137: +SilphCo11Script_6214f: push hl ld hl, wCardKeyDoorY ld a, [hli] @@ -63,93 +64,17 @@ SilphCo11Script_62137: ld [$ffe0], a ret -SilphCo11Script_62163: +SilphCo11Script_6217b: ld a, [$ffe0] and a ret z SetEvent EVENT_SILPH_CO_11_UNLOCKED_DOOR ret -SilphCo11Script_6216d: - ld hl, MissableObjectIDs_6219b -.asm_62170 - ld a, [hli] - cp $ff - jr z, .asm_62181 - push hl - ld [wMissableObjectIndex], a - predef HideObject - pop hl - jr .asm_62170 -.asm_62181 - ld hl, MissableObjectIDs_62194 -.asm_62184 - ld a, [hli] - cp $ff - ret z - push hl - ld [wMissableObjectIndex], a - predef ShowObject - pop hl - jr .asm_62184 - -MissableObjectIDs_62194: - db HS_SAFFRON_CITY_8 - db HS_SAFFRON_CITY_9 - db HS_SAFFRON_CITY_A - db HS_SAFFRON_CITY_B - db HS_SAFFRON_CITY_C - db HS_SAFFRON_CITY_D - db $FF - -MissableObjectIDs_6219b: - db HS_SAFFRON_CITY_1 - db HS_SAFFRON_CITY_2 - db HS_SAFFRON_CITY_3 - db HS_SAFFRON_CITY_4 - db HS_SAFFRON_CITY_5 - db HS_SAFFRON_CITY_6 - db HS_SAFFRON_CITY_7 - db HS_SAFFRON_CITY_E - db HS_SAFFRON_CITY_F - db HS_SILPH_CO_2F_2 - db HS_SILPH_CO_2F_3 - db HS_SILPH_CO_2F_4 - db HS_SILPH_CO_2F_5 - db HS_SILPH_CO_3F_1 - db HS_SILPH_CO_3F_2 - db HS_SILPH_CO_4F_1 - db HS_SILPH_CO_4F_2 - db HS_SILPH_CO_4F_3 - db HS_SILPH_CO_5F_1 - db HS_SILPH_CO_5F_2 - db HS_SILPH_CO_5F_3 - db HS_SILPH_CO_5F_4 - db HS_SILPH_CO_6F_1 - db HS_SILPH_CO_6F_2 - db HS_SILPH_CO_6F_3 - db HS_SILPH_CO_7F_1 - db HS_SILPH_CO_7F_2 - db HS_SILPH_CO_7F_3 - db HS_SILPH_CO_7F_4 - db HS_SILPH_CO_8F_1 - db HS_SILPH_CO_8F_2 - db HS_SILPH_CO_8F_3 - db HS_SILPH_CO_9F_1 - db HS_SILPH_CO_9F_2 - db HS_SILPH_CO_9F_3 - db HS_SILPH_CO_10F_1 - db HS_SILPH_CO_10F_2 - db HS_SILPH_CO_11F_1 - db HS_SILPH_CO_11F_2 - db HS_SILPH_CO_11F_3 - db $FF - -SilphCo11Script_621c4: +SilphCo11Script_62185: xor a ld [wJoyIgnore], a - -SilphCo11Script_621c8: +SilphCo11Script_62189: ld [wSilphCo11CurScript], a ld [wCurMapScript], a ret @@ -161,10 +86,26 @@ SilphCo11ScriptPointers: dw SilphCo11Script3 dw SilphCo11Script4 dw SilphCo11Script5 + dw SilphCo11Script6 + dw SilphCo11Script7 + dw SilphCo11Script8 + dw SilphCo11Script9 + dw SilphCo11Script10 + dw SilphCo11Script11 + dw SilphCo11Script12 + dw SilphCo11Script13 + dw SilphCo11Script14 SilphCo11Script0: - CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI + CheckEvent EVENT_BEAT_SILPH_CO_11F_TRAINER_0 + call z, SilphCo11Script_6229c + CheckEvent EVENT_782 ret nz + CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI + call z, SilphCo11Script_621c5 + ret + +SilphCo11Script_621c5: ld hl, CoordsData_62211 call ArePlayerCoordsInArray jp nc, CheckFightingMapTrainers @@ -182,8 +123,9 @@ SilphCo11Script0: call SetSpriteMovementBytesToFF ld de, MovementData_62216 call MoveSprite - ld a, $3 - jp SilphCo11Script_621c8 + ld a, $4 + call SilphCo11Script_62189 + ret CoordsData_62211: db $0D,$06 @@ -196,18 +138,18 @@ MovementData_62216: db NPC_MOVEMENT_DOWN db $FF -SilphCo11Script_6221a: +SilphCo11Script_621ff: ld [wPlayerMovingDirection], a - ld a, $3 - ld [H_SPRITEINDEX], a ld a, b - ld [hSpriteFacingDirection], a - jp SetSpriteFacingDirectionAndDelay + ld [wSpriteStateData1 + 3 * $10 + 9], a + ld a, $2 + ld [wSpriteStateData1 + 3 * $10 + 1], a + ret -SilphCo11Script5: +SilphCo11Script3: ld a, [wIsInBattle] cp $ff - jp z, SilphCo11Script_621c4 + jp z, SilphCo11Script_62185 ld a, [wcf0d] cp $1 jr z, .asm_6223c @@ -218,23 +160,23 @@ SilphCo11Script5: ld a, PLAYER_DIR_UP ld b, SPRITE_FACING_DOWN .asm_62240 - call SilphCo11Script_6221a + call SilphCo11Script_621ff ld a, $f0 ld [wJoyIgnore], a - ld a, $6 + ld a, $7 ld [hSpriteIndexOrTextID], a call DisplayTextID call GBFadeOutToBlack - call SilphCo11Script_6216d + callba Func_f25a0 call UpdateSprites call Delay3 call GBFadeInFromBlack SetEvent EVENT_BEAT_SILPH_CO_GIOVANNI xor a ld [wJoyIgnore], a - jp SilphCo11Script_621c8 + jp SilphCo11Script_62189 -SilphCo11Script3: +SilphCo11Script4: ld a, [wd730] bit 0, a ret nz @@ -251,26 +193,276 @@ SilphCo11Script3: ld a, PLAYER_DIR_UP ld b, SPRITE_FACING_DOWN .asm_62288 - call SilphCo11Script_6221a + call SilphCo11Script_621ff call Delay3 - ld a, $4 - jp SilphCo11Script_621c8 - -SilphCo11Script4: + xor a + ld [wJoyIgnore], a ld hl, wd72d set 6, [hl] set 7, [hl] - ld hl, SilphCo10Text_62330 - ld de, SilphCo10Text_62330 + ld hl, SilphCo10Text_62528 + ld de, SilphCo10Text_62528 call SaveEndBattleTextPointers ld a, [H_SPRITEINDEX] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters + ld a, $3 + jp SilphCo11Script_62189 + +SilphCo11Script_6229c: + ld a, [wYCoord] + cp $3 + ret nz + ld a, [wXCoord] + cp $4 + ret nc + ResetEvents EVENT_780, EVENT_781 + ld a, [wXCoord] + cp $3 + jr z, .asm_622c3 + SetEventReuseHL EVENT_780 + ld a, [wXCoord] + cp $2 + jr z, .asm_622c3 + ResetEventReuseHL EVENT_780 + SetEventReuseHL EVENT_781 +.asm_622c3 + call StopAllMusic + ld c, BANK(Music_MeetJessieJames) + ld a, MUSIC_MEET_JESSIE_JAMES + call PlayMusic + xor a + ld [hJoyHeld], a + ld a, $fc + ld [wJoyIgnore], a + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld a, $8 + ld [hSpriteIndexOrTextID], a + call DisplayTextID xor a + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld a, $ff ld [wJoyIgnore], a + SetEvent EVENT_782 ld a, $5 - jp SilphCo11Script_621c8 + call SilphCo11Script_62189 + ret +; 622f4 + +SilphCo11MovementData_622f5: + db $5 + db $5 + db $5 + db $5 + db $5 + db $ff + +SilphCo11MovementData_622fb: + db $5 + db $5 + db $5 + db $5 + db $ff + +SilphCo11MovementData_62300: + db $5 + db $5 + db $5 + db $5 + db $ff + +SilphCo11MovementData_62305: + db $5 + db $5 + db $5 + db $5 + db $5 + db $ff + +SilphCo11MovementData_6230b: + db $5 + db $5 + db $6 + db $5 + db $5 + db $ff + +SilphCo11MovementData_62311: + db $5 + db $5 + db $5 + db $6 + db $5 + db $5 + db $ff + +SilphCo11Script5: + ld de, SilphCo11MovementData_622f5 + CheckEitherEventSet EVENT_780, EVENT_781 + and a + jr z, .asm_6232d + ld de, SilphCo11MovementData_62300 + cp $1 + jr z, .asm_6232d + ld de, SilphCo11MovementData_6230b +.asm_6232d + ld a, $4 + ld [hSpriteIndexOrTextID], a + call MoveSprite + ld a, $ff + ld [wJoyIgnore], a + ld a, $6 + call SilphCo11Script_62189 + ret + +SilphCo11Script6: + ld a, $ff + ld [wJoyIgnore], a + ld a, [wd730] + bit 0, a + ret nz +SilphCo11Script7: + ld a, $2 + ld [wSpriteStateData1 + 4 * $10 + 1], a + ld hl, wSpriteStateData1 + 4 * $10 + 9 + ld [hl], SPRITE_FACING_RIGHT + CheckEitherEventSet EVENT_780, EVENT_781 + and a + jr z, .asm_6235e + ld [hl], SPRITE_FACING_UP +.asm_6235e + call Delay3 + ld a, $fc + ld [wJoyIgnore], a +SilphCo11Script8: + ld de, SilphCo11MovementData_622fb + CheckEitherEventSet EVENT_780, EVENT_781 + and a + jr z, .asm_6237b + ld de, SilphCo11MovementData_62305 + cp $1 + jr z, .asm_6237b + ld de, SilphCo11MovementData_62311 +.asm_6237b + ld a, $6 + ld [hSpriteIndexOrTextID], a + call MoveSprite + ld a, $ff + ld [wJoyIgnore], a + ld a, $9 + call SilphCo11Script_62189 + ret + +SilphCo11Script9: + ld a, $ff + ld [wJoyIgnore], a + ld a, [wd730] + bit 0, a + ret nz + ld a, $fc + ld [wJoyIgnore], a +SilphCo11Script10: + ld a, $2 + ld [wSpriteStateData1 + 6 * $10 + 1], a + ld hl, wSpriteStateData1 + 6 * $10 + 9 + ld [hl], SPRITE_FACING_UP + CheckEitherEventSet EVENT_780, EVENT_781 + and a + jr z, .asm_623b1 + ld [hl], SPRITE_FACING_LEFT +.asm_623b1 + call Delay3 + ld a, $9 + ld [hSpriteIndexOrTextID], a + call DisplayTextID +SilphCo11Script11: + ld hl, wd72d + set 6, [hl] + set 7, [hl] + ld hl, SilphCo11Text_624c2 + ld de, SilphCo11Text_624c2 + call SaveEndBattleTextPointers + ld a, OPP_ROCKET + ld [wCurOpponent], a + ld a, $2d + ld [wTrainerNo], a + xor a + ld [hJoyHeld], a + ld [wJoyIgnore], a + ld a, $c + call SilphCo11Script_62189 + ret + +SilphCo11Script12: + ld a, $ff + ld [wJoyIgnore], a + ld a, [wIsInBattle] + cp $ff + jp z, SilphCo11Script_62185 + ld a, $2 + ld [wSpriteStateData1 + 4 * $10 + 1], a + ld [wSpriteStateData1 + 6 * $10 + 1], a + xor a + ld [wSpriteStateData1 + 4 * $10 + 9], a + ld [wSpriteStateData1 + 6 * $10 + 9], a + ld a, $fc + ld [wJoyIgnore], a + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld a, $a + ld [hSpriteIndexOrTextID], a + call DisplayTextID + xor a + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + call StopAllMusic + ld c, BANK(Music_MeetJessieJames) + ld a, MUSIC_MEET_JESSIE_JAMES + call PlayMusic + ld a, $ff + ld [wJoyIgnore], a + ld a, $d + call SilphCo11Script_62189 + ret + +SilphCo11Script13: + ld a, $ff + ld [wJoyIgnore], a + call GBFadeOutToBlack + ld a, HS_SILPH_CO_11F_JAMES + call SilphCo11Script_6246d + ld a, HS_SILPH_CO_11F_JESSIE + call SilphCo11Script_6246d + call UpdateSprites + call Delay3 + call GBFadeInFromBlack + ld a, $e + call SilphCo11Script_62189 + ret + +SilphCo11Script14: + call PlayDefaultMusic + xor a + ld [hJoyHeld], a + ld [wJoyIgnore], a + ResetEvent EVENT_782 + SetEventReuseHL EVENT_BEAT_SILPH_CO_11F_TRAINER_0 + ld a, $0 + call SilphCo11Script_62189 + ret + +SilphCo11Script_6245e: + ld [wMissableObjectIndex], a + predef ShowObject + call UpdateSprites + call Delay3 + ret + +SilphCo11Script_6246d: + ld [wMissableObjectIndex], a + predef HideObject + ret SilphCo11TextPointers: dw SilphCo11Text1 @@ -279,64 +471,94 @@ SilphCo11TextPointers: dw SilphCo11Text4 dw SilphCo11Text5 dw SilphCo11Text6 + dw SilphCo11Text7 + dw SilphCo11Text8 + dw SilphCo11Text9 + dw SilphCo11Text10 SilphCo11TrainerHeaders: SilphCo11TrainerHeader0: - dbEventFlagBit EVENT_BEAT_SILPH_CO_11F_TRAINER_0 - db ($4 << 4) ; trainer's view range - dwEventFlagAddress EVENT_BEAT_SILPH_CO_11F_TRAINER_0 - dw SilphCo11BattleText1 ; TextBeforeBattle - dw SilphCo11AfterBattleText1 ; TextAfterBattle - dw SilphCo11EndBattleText1 ; TextEndBattle - dw SilphCo11EndBattleText1 ; TextEndBattle - -SilphCo11TrainerHeader1: dbEventFlagBit EVENT_BEAT_SILPH_CO_11F_TRAINER_1 - db ($3 << 4) ; trainer's view range + db ($3 << 4) dwEventFlagAddress EVENT_BEAT_SILPH_CO_11F_TRAINER_1 - dw SilphCo11BattleText2 ; TextBeforeBattle - dw SilphCo11AfterBattleText2 ; TextAfterBattle - dw SilphCo11EndBattleText2 ; TextEndBattle - dw SilphCo11EndBattleText2 ; TextEndBattle + dw SilphCo11Trainer1BattleText + dw SilphCo11Trainer1AfterBattleText + dw SilphCo11Trainer1EndBattleText + dw SilphCo11Trainer1EndBattleText - db $ff + db $ff ; no more trainers + +SilphCo11Text4: +SilphCo11Text6: +SilphCo11Text8: + TX_FAR _SilphCoJessieJamesText1 + TX_ASM + ld c, 10 + call DelayFrames + ld a, $4 + ld [wPlayerMovingDirection], a + ld a, $0 + ld [wEmotionBubbleSpriteIndex], a + ld a, $0 + ld [wWhichEmotionBubble], a + predef EmotionBubble + ld c, 20 + call DelayFrames + jp TextScriptEnd + +SilphCo11Text9: + TX_FAR _SilphCoJessieJamesText2 + db "@" + +SilphCo11Text_624c2: + TX_FAR _SilphCoJessieJamesText3 + db "@" + +SilphCo11Text10: + TX_FAR _SilphCoJessieJamesText4 + TX_ASM + ld c, 64 + call DelayFrames + jp TextScriptEnd SilphCo11Text1: TX_ASM CheckEvent EVENT_GOT_MASTER_BALL - jp nz, .asm_62308 - ld hl, SilphCoPresidentText + jp nz, .asm_62500 + ld hl, SilphCo11Text_62509 call PrintText lb bc, MASTER_BALL, 1 call GiveItem - jr nc, .BagFull - ld hl, ReceivedSilphCoMasterBallText + jr nc, .asm_624f8 + ld hl, SilphCo11Text_6250e call PrintText SetEvent EVENT_GOT_MASTER_BALL - jr .asm_6230e -.BagFull - ld hl, SilphCoMasterBallNoRoomText + jr .asm_62506 +.asm_624f8 + ld hl, SilphCo11Text_62519 call PrintText - jr .asm_6230e -.asm_62308 - ld hl, SilphCo10Text_6231c + jr .asm_62506 + +.asm_62500 + ld hl, SilphCo11Text_62514 call PrintText -.asm_6230e +.asm_62506 jp TextScriptEnd -SilphCoPresidentText: +SilphCo11Text_62509: TX_FAR _SilphCoPresidentText db "@" -ReceivedSilphCoMasterBallText: +SilphCo11Text_6250e: TX_FAR _ReceivedSilphCoMasterBallText - db $11, "@" + TX_SFX_KEY_ITEM + db "@" -SilphCo10Text_6231c: +SilphCo11Text_62514: TX_FAR _SilphCo10Text_6231c db "@" -SilphCoMasterBallNoRoomText: +SilphCo11Text_62519: TX_FAR _SilphCoMasterBallNoRoomText db "@" @@ -348,58 +570,28 @@ SilphCo11Text3: TX_FAR _SilphCo11Text3 db "@" -SilphCo10Text_62330: +SilphCo10Text_62528: TX_FAR _SilphCo10Text_62330 db "@" -SilphCo11Text6: +SilphCo11Text7: TX_FAR _SilphCo10Text_62335 db "@" -SilphCo11Text4: - TX_ASM - ld hl, SilphCo11TrainerHeader0 - call TalkToTrainer - jp TextScriptEnd - -SilphCo11BattleText1: - TX_FAR _SilphCo11BattleText1 - db "@" - -SilphCo11EndBattleText1: - TX_FAR _SilphCo11EndBattleText1 - db "@" - -SilphCo11AfterBattleText1: - TX_FAR _SilphCo11AfterBattleText1 - db "@" - SilphCo11Text5: TX_ASM - ld hl, SilphCo11TrainerHeader1 + ld hl, SilphCo11TrainerHeader0 call TalkToTrainer jp TextScriptEnd -SilphCo11BattleText2: +SilphCo11Trainer1BattleText: TX_FAR _SilphCo11BattleText2 db "@" -SilphCo11EndBattleText2: +SilphCo11Trainer1EndBattleText: TX_FAR _SilphCo11EndBattleText2 db "@" -SilphCo11AfterBattleText2: +SilphCo11Trainer1AfterBattleText: TX_FAR _SilphCo11AfterBattleText2 db "@" - -SilphCo10Text_6236c: - TX_ASM - ld hl, SilphCo10Text_6237b - call PrintText - ld a, PORYGON - call DisplayPokedex - jp TextScriptEnd - -SilphCo10Text_6237b: - TX_FAR _SilphCo10Text_6237b - db "@" diff --git a/scripts/silphco11_2.asm b/scripts/silphco11_2.asm new file mode 100755 index 00000000..bf575de5 --- /dev/null +++ b/scripts/silphco11_2.asm @@ -0,0 +1,76 @@ +Func_f25a0: + ld hl, MissableObjects_f25ce +.asm_f25a3 + ld a, [hli] + cp $ff + jr z, .asm_f25b4 + push hl + ld [wMissableObjectIndex], a + predef HideObject + pop hl + jr .asm_f25a3 + +.asm_f25b4 + ld hl, MissableObjects_f25c7 +.asm_f25b7 + ld a, [hli] + cp $ff + ret z + push hl + ld [wMissableObjectIndex], a + predef ShowObject + pop hl + jr .asm_f25b7 + +MissableObjects_f25c7: + db HS_SAFFRON_CITY_8 + db HS_SAFFRON_CITY_9 + db HS_SAFFRON_CITY_A + db HS_SAFFRON_CITY_B + db HS_SAFFRON_CITY_C + db HS_SAFFRON_CITY_D + db $FF + +MissableObjects_f25ce + db HS_SAFFRON_CITY_1 + db HS_SAFFRON_CITY_2 + db HS_SAFFRON_CITY_3 + db HS_SAFFRON_CITY_4 + db HS_SAFFRON_CITY_5 + db HS_SAFFRON_CITY_6 + db HS_SAFFRON_CITY_7 + db HS_SAFFRON_CITY_E + db HS_SAFFRON_CITY_F + db HS_SILPH_CO_2F_2 + db HS_SILPH_CO_2F_3 + db HS_SILPH_CO_2F_4 + db HS_SILPH_CO_2F_5 + db HS_SILPH_CO_3F_1 + db HS_SILPH_CO_3F_2 + db HS_SILPH_CO_4F_1 + db HS_SILPH_CO_4F_2 + db HS_SILPH_CO_4F_3 + db HS_SILPH_CO_5F_1 + db HS_SILPH_CO_5F_2 + db HS_SILPH_CO_5F_3 + db HS_SILPH_CO_5F_4 + db HS_SILPH_CO_6F_1 + db HS_SILPH_CO_6F_2 + db HS_SILPH_CO_6F_3 + db HS_SILPH_CO_7F_1 + db HS_SILPH_CO_7F_2 + db HS_SILPH_CO_7F_3 + db HS_SILPH_CO_7F_4 + db HS_SILPH_CO_8F_1 + db HS_SILPH_CO_8F_2 + db HS_SILPH_CO_8F_3 + db HS_SILPH_CO_9F_1 + db HS_SILPH_CO_9F_2 + db HS_SILPH_CO_9F_3 + db HS_SILPH_CO_10F_1 + db HS_SILPH_CO_10F_2 + db HS_SILPH_CO_11F_1 + db HS_SILPH_CO_11F_JAMES + db HS_SILPH_CO_11F_2 + db HS_SILPH_CO_11F_JESSIE + db $ff diff --git a/scripts/silphco7.asm b/scripts/silphco7.asm index 9469d294..2e93d92a 100755 --- a/scripts/silphco7.asm +++ b/scripts/silphco7.asm @@ -130,9 +130,7 @@ SilphCo7Script0: ld [wJoyIgnore], a ld a, PLAYER_DIR_DOWN ld [wPlayerMovingDirection], a - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic ld c, BANK(Music_MeetRival) ld a, MUSIC_MEET_RIVAL call PlayMusic @@ -186,21 +184,11 @@ SilphCo7Script3: ld a, OPP_SONY2 ld [wCurOpponent], a ld a, [wRivalStarter] - cp STARTER2 - jr nz, .asm_51cb6 - ld a, $7 - jr .asm_51cc0 -.asm_51cb6 - cp STARTER3 - jr nz, .asm_51cbe - ld a, $8 - jr .asm_51cc0 -.asm_51cbe - ld a, $9 -.asm_51cc0 + add 4 ld [wTrainerNo], a ld a, $4 - jp SilphCo7Text_51c10 + call SilphCo7Text_51c10 + ret SilphCo7Script4: ld a, [wIsInBattle] @@ -219,9 +207,7 @@ SilphCo7Script4: ld a, $f ld [hSpriteIndexOrTextID], a call DisplayTextID - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic callba Music_RivalAlternateStart ld de, MovementData_51d1d ld a, [wcf0d] diff --git a/scripts/ssanne2.asm b/scripts/ssanne2.asm index 654b881a..4f0ffa2f 100755 --- a/scripts/ssanne2.asm +++ b/scripts/ssanne2.asm @@ -2,7 +2,7 @@ SSAnne2Script: call EnableAutoTextBoxDrawing ld hl, SSAnne2ScriptPointers ld a, [wSSAnne2CurScript] - jp CallFunctionInTable + jp JumpTable SSAnne2Script_613ab: xor a @@ -24,9 +24,7 @@ SSAnne2Script0: ld hl, CoordsData_61411 call ArePlayerCoordsInArray ret nc - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic ld c, BANK(Music_MeetRival) ld a, MUSIC_MEET_RIVAL call PlayMusic @@ -99,23 +97,8 @@ SSAnne2Script1: call Delay3 ld a, OPP_SONY2 ld [wCurOpponent], a - - ; select which team to use during the encounter - ld a, [wRivalStarter] - cp STARTER2 - jr nz, .NotSquirtle ld a, $1 - jr .done -.NotSquirtle - cp STARTER3 - jr nz, .Charmander - ld a, $2 - jr .done -.Charmander - ld a, $3 -.done ld [wTrainerNo], a - call SSAnne2Script_61416 ld a, $2 ld [wSSAnne2CurScript], a @@ -145,9 +128,7 @@ SSAnne2Script2: ld a, $2 ld [H_SPRITEINDEX], a call MoveSprite - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic callba Music_RivalAlternateStart ld a, $3 ld [wSSAnne2CurScript], a diff --git a/scripts/ssanne7.asm b/scripts/ssanne7.asm index a2fb1387..06789cd5 100755 --- a/scripts/ssanne7.asm +++ b/scripts/ssanne7.asm @@ -3,7 +3,7 @@ SSAnne7Script: jp EnableAutoTextBoxDrawing SSAnne7Script_6189b: - CheckEvent EVENT_RUBBED_CAPTAINS_BACK + CheckEvent EVENT_GOT_HM01 ret nz ld hl, wd72d set 5, [hl] @@ -28,12 +28,12 @@ SSAnne7Text1: ld hl, ReceivedHM01Text call PrintText SetEvent EVENT_GOT_HM01 + ld hl, wd72d + res 5, [hl] jr .asm_0faf5 .BagFull ld hl, HM01NoRoomText call PrintText - ld hl, wd72d - set 5, [hl] jr .asm_0faf5 .asm_797c4 ld hl, SSAnne7Text_61932 @@ -45,12 +45,10 @@ SSAnne7RubText: TX_FAR _SSAnne7RubText TX_ASM ld a, [wAudioROMBank] - cp BANK(Audio3_UpdateMusic) + cp AUDIO_3 ld [wAudioSavedROMBank], a jr nz, .asm_61908 - ld a, $ff - ld [wNewSoundID], a - call PlaySound + call StopAllMusic ld a, Bank(Music_PkmnHealed) ld [wAudioROMBank], a .asm_61908 diff --git a/scripts/ssanne9.asm b/scripts/ssanne9.asm index 789b0fa8..6e658e5f 100755 --- a/scripts/ssanne9.asm +++ b/scripts/ssanne9.asm @@ -1,8 +1,5 @@ SSAnne9Script: - ld a, $1 - ld [wAutoTextBoxDrawingControl], a - xor a - ld [wDoNotWaitForButtonPressAfterDisplayingText], a + call DisableAutoTextBoxDrawing ld hl, SSAnne9TrainerHeaders ld de, SSAnne9ScriptPointers ld a, [wSSAnne9CurScript] @@ -129,44 +126,24 @@ SSAnne9Text_61c10: SSAnne9Text10: TX_ASM - ld hl, SSAnne9Text_61c1f - call PrintText + callba Func_f2570 jp TextScriptEnd -SSAnne9Text_61c1f: - TX_FAR _SSAnne9Text_61c1f - db "@" - SSAnne9Text11: TX_ASM - ld hl, SSAnne9Text_61c2e - call PrintText + callba Func_f257c jp TextScriptEnd -SSAnne9Text_61c2e: - TX_FAR _SSAnne9Text_61c2e - db "@" - SSAnne9Text12: TX_ASM - ld hl, SSAnne9Text_61c3d - call PrintText + callba Func_f2588 jp TextScriptEnd -SSAnne9Text_61c3d: - TX_FAR _SSAnne9Text_61c3d - db "@" - SSAnne9Text13: TX_ASM - ld hl, SSAnne9Text_61c4c - call PrintText + callba Func_f2594 jp TextScriptEnd -SSAnne9Text_61c4c: - TX_FAR _SSAnne9Text_61c4c - db "@" - SSAnne9BattleText1: TX_FAR _SSAnne9BattleText1 db "@" diff --git a/scripts/ssanne9_2.asm b/scripts/ssanne9_2.asm new file mode 100755 index 00000000..f856221c --- /dev/null +++ b/scripts/ssanne9_2.asm @@ -0,0 +1,35 @@ +Func_f2570: + ld hl, SSAnne9Text_f2577 + call PrintText + ret + +SSAnne9Text_f2577: + TX_FAR _SSAnne9Text_61c1f + db "@" + +Func_f257c: + ld hl, SSAnne9Text_f2583 + call PrintText + ret + +SSAnne9Text_f2583: + TX_FAR _SSAnne9Text_61c2e + db "@" + +Func_f2588: + ld hl, SSAnne9Text_f258f + call PrintText + ret + +SSAnne9Text_f258f: + TX_FAR _SSAnne9Text_61c3d + db "@" + +Func_f2594: + ld hl, SSAnne9Text_f259b + call PrintText + ret + +SSAnne9Text_f259b: + TX_FAR _SSAnne9Text_61c4c + db "@" diff --git a/scripts/tradecenter.asm b/scripts/tradecenter.asm index a200e719..a200e719 100755..100644 --- a/scripts/tradecenter.asm +++ b/scripts/tradecenter.asm diff --git a/scripts/unknowndungeon1.asm b/scripts/unknowndungeon1.asm index 9d7f120e..3b5fae5d 100755 --- a/scripts/unknowndungeon1.asm +++ b/scripts/unknowndungeon1.asm @@ -5,3 +5,4 @@ UnknownDungeon1TextPointers: dw PickUpItemText dw PickUpItemText dw PickUpItemText + dw PickUpItemText diff --git a/scripts/unknowndungeon2.asm b/scripts/unknowndungeon2.asm index 3ed00a45..55ebb752 100755 --- a/scripts/unknowndungeon2.asm +++ b/scripts/unknowndungeon2.asm @@ -5,3 +5,4 @@ UnknownDungeon2TextPointers: dw PickUpItemText dw PickUpItemText dw PickUpItemText + dw PickUpItemText diff --git a/scripts/unknowndungeon3.asm b/scripts/unknowndungeon3.asm index 2790694b..46a1cafd 100755 --- a/scripts/unknowndungeon3.asm +++ b/scripts/unknowndungeon3.asm @@ -7,7 +7,7 @@ UnknownDungeon3Script: ld [wUnknownDungeon3CurScript], a ret -.ScriptPointers +.ScriptPointers: dw CheckFightingMapTrainers dw DisplayEnemyTrainerTextAndStartBattle dw EndTrainerBattle @@ -16,6 +16,8 @@ UnknownDungeon3TextPointers: dw MewtwoText dw PickUpItemText dw PickUpItemText + dw PickUpItemText + dw PickUpItemText UnknownDungeon3TrainerHeaders: MewtwoTrainerHeader: diff --git a/scripts/vermilioncity.asm b/scripts/vermilioncity.asm index 0a734e25..b73797bb 100755 --- a/scripts/vermilioncity.asm +++ b/scripts/vermilioncity.asm @@ -1,5 +1,7 @@ VermilionCityScript: call EnableAutoTextBoxDrawing + ld hl, wd492 + res 7, [hl] ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] @@ -11,11 +13,24 @@ VermilionCityScript: call nz, VermilionCityScript_197c0 ld hl, VermilionCityScriptPointers ld a, [wVermilionCityCurScript] - jp CallFunctionInTable + call JumpTable + call VermilionCityScript_19869 + ret + +VermilionCityScript_19869: + CheckEventHL EVENT_152 + ret nz + CheckEventReuseHL EVENT_GOT_BIKE_VOUCHER + ret z + SetEventReuseHL EVENT_152 + ret VermilionCityScript_197c0: call Random - ld a, [$ffd4] + ld a, [hRandomAdd] + ld b, a + ld a, [hRandomSub] + adc b and $e ld [wFirstLockTrashCanIndex], a ret @@ -38,12 +53,12 @@ VermilionCityScriptPointers: dw VermilionCityScript4 VermilionCityScript0: - ld a, [wSpriteStateData1 + 9] + ld a, [wPlayerFacingDirection] and a ; cp SPRITE_FACING_DOWN - ret nz + jr nz, .asm_198de ld hl, CoordsData_19823 call ArePlayerCoordsInArray - ret nc + jr nc, .asm_198de xor a ld [hJoyHeld], a ld [wcf0d], a @@ -67,6 +82,9 @@ VermilionCityScript0: ld [wVermilionCityCurScript], a ret +.asm_198de + ret + CoordsData_19823: db $1e,$12 db $ff @@ -122,11 +140,12 @@ VermilionCityTextPointers: dw VermilionCityText6 dw VermilionCityText7 dw VermilionCityText8 + dw VermilionCityText9 dw MartSignText dw PokeCenterSignText - dw VermilionCityText11 dw VermilionCityText12 dw VermilionCityText13 + dw VermilionCityText14 VermilionCityText1: TX_FAR _VermilionCityText1 @@ -157,7 +176,7 @@ VermilionCityText3: TX_ASM CheckEvent EVENT_SS_ANNE_LEFT jr nz, .asm_198f6 - ld a, [wSpriteStateData1 + 9] + ld a, [wPlayerFacingDirection] cp SPRITE_FACING_RIGHT jr z, .asm_198c8 ld hl, VermilionCityCoords1 @@ -225,33 +244,43 @@ VermilionCityText5: ld a, MACHOP call PlayCry call WaitForSoundToFinish - ld hl, VermilionCityText14 + ld hl, VermilionCityText15 ret -VermilionCityText14: - TX_FAR _VermilionCityText14 +VermilionCityText15: + TX_FAR _VermilionCityText15 db "@" VermilionCityText6: TX_FAR _VermilionCityText6 db "@" -VermilionCityText7: - TX_FAR _VermilionCityText7 - db "@" - VermilionCityText8: - TX_FAR _VermilionCityText8 - db "@" + TX_ASM + callba Func_f1a8a + jp TextScriptEnd -VermilionCityText11: - TX_FAR _VermilionCityText11 - db "@" +VermilionCityText9: + TX_ASM + callba Func_f1a96 + jp TextScriptEnd VermilionCityText12: - TX_FAR _VermilionCityText12 - db "@" + TX_ASM + callba Func_f1aa2 + jp TextScriptEnd VermilionCityText13: - TX_FAR _VermilionCityText13 - db "@" + TX_ASM + callba Func_f1aae + jp TextScriptEnd + +VermilionCityText14: + TX_ASM + callba Func_f1aba + jp TextScriptEnd + +VermilionCityText7: + TX_ASM + callba Func_f1a0f + jp TextScriptEnd diff --git a/scripts/vermilioncity2.asm b/scripts/vermilioncity2.asm new file mode 100755 index 00000000..eb7ea37a --- /dev/null +++ b/scripts/vermilioncity2.asm @@ -0,0 +1,111 @@ +Func_f1a0f: + CheckEvent EVENT_GOT_SQUIRTLE_FROM_OFFICER_JENNY + jr nz, .asm_f1a69 + ld a, [wBeatGymFlags] + bit 2, a ; THUNDERBADGE + jr nz, .asm_f1a24 + ld hl, OfficerJennyText1 + call PrintText + ret + +.asm_f1a24 + ld hl, OfficerJennyText2 + call PrintText + call YesNoChoice + ld a, [wCurrentMenuItem] + and a + jr nz, .asm_f1a62 + ld a, SQUIRTLE + ld [wd11e], a + ld [wcf91], a + call GetMonName + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + lb bc, SQUIRTLE, 10 + call GivePokemon + ret nc + ld a, [wAddedToParty] + and a + call z, WaitForTextScrollButtonPress + ld a, $1 + ld [wDoNotWaitForButtonPressAfterDisplayingText], a + ld hl, OfficerJennyText3 + call PrintText + SetEvent EVENT_GOT_SQUIRTLE_FROM_OFFICER_JENNY + ret + +.asm_f1a62 + ld hl, OfficerJennyText4 + call PrintText + ret + +.asm_f1a69 + ld hl, OfficerJennyText5 + call PrintText + ret + +OfficerJennyText1: + TX_FAR _OfficerJennyText1 + db "@" + +OfficerJennyText2: + TX_FAR _OfficerJennyText2 + db "@" + +OfficerJennyText3: + TX_FAR _OfficerJennyText3 + db $d + db "@" + +OfficerJennyText4: + TX_FAR _OfficerJennyText4 + db "@" + +OfficerJennyText5: + TX_FAR _OfficerJennyText5 + db "@" + +Func_f1a8a: + ld hl, VermilionCityText_f1a91 + call PrintText + ret + +VermilionCityText_f1a91: + TX_FAR _VermilionCityText8 + db "@" + +Func_f1a96: + ld hl, VermilionCityText_f1a9d + call PrintText + ret + +VermilionCityText_f1a9d: + TX_FAR _VermilionCityText9 + db "@" + +Func_f1aa2: + ld hl, VermilionCityText_f1aa9 + call PrintText + ret + +VermilionCityText_f1aa9: + TX_FAR _VermilionCityText12 + db "@" + +Func_f1aae: + ld hl, VermilionCityText_f1ab5 + call PrintText + ret + +VermilionCityText_f1ab5: + TX_FAR _VermilionCityText13 + db "@" + +Func_f1aba: + ld hl, VermilionCityText_f1ac1 + call PrintText + ret + +VermilionCityText_f1ac1: + TX_FAR _VermilionCityText14 + db "@" diff --git a/scripts/vermiliondock.asm b/scripts/vermiliondock.asm index 5b5d520b..e1378db3 100755 --- a/scripts/vermiliondock.asm +++ b/scripts/vermiliondock.asm @@ -40,8 +40,7 @@ VermilionDock_1db9b: SetEventForceReuseHL EVENT_SS_ANNE_LEFT ld a, $ff ld [wJoyIgnore], a - ld [wNewSoundID], a - call PlaySound + call StopAllMusic ld c, BANK(Music_Surfing) ld a, MUSIC_SURFING call PlayMusic @@ -63,6 +62,7 @@ VermilionDock_1db9b: ld [H_AUTOBGTRANSFERENABLED], a ld [wSSAnneSmokeDriftAmount], a ld [rOBP1], a + call UpdateGBCPal_OBP1 ld a, 88 ld [wSSAnneSmokeX], a ld hl, wMapViewVRAMPointer @@ -124,7 +124,7 @@ VermilionDock_1db9b: VermilionDock_AnimSmokePuffDriftRight: push bc push de - ld hl, wOAMBuffer + $11 + ld hl, wOAMBuffer + 4 * $4 + 1 ; x coord ld a, [wSSAnneSmokeDriftAmount] swap a ld c, a diff --git a/scripts/vermiliongym.asm b/scripts/vermiliongym.asm index eb726831..90ffc34c 100755 --- a/scripts/vermiliongym.asm +++ b/scripts/vermiliongym.asm @@ -29,14 +29,15 @@ Gym3LeaderName: VermilionGymScript_5ca6d: CheckEvent EVENT_2ND_LOCK_OPENED - jr nz, .asm_5ca78 + jr nz, .opened_second_lock ld a, $24 - jr .asm_5ca7f -.asm_5ca78 + jr .load_door_tile + +.opened_second_lock ld a, SFX_GO_INSIDE call PlaySound ld a, $5 -.asm_5ca7f +.load_door_tile ld [wNewTileBlockID], a lb bc, 2, 2 predef_jump ReplaceTileBlock @@ -73,12 +74,13 @@ VermilionGymScript_5caaa: ld [hSpriteIndexOrTextID], a call DisplayTextID SetEvent EVENT_GOT_TM24 - jr .asm_5cad3 + jr .set_gym_flags + .BagFull ld a, $8 ld [hSpriteIndexOrTextID], a call DisplayTextID -.asm_5cad3 +.set_gym_flags ld hl, wObtainedBadges set 2, [hl] ld hl, wBeatGymFlags @@ -132,17 +134,19 @@ VermilionGymTrainerHeader2: VermilionGymText1: TX_ASM CheckEvent EVENT_BEAT_LT_SURGE - jr z, .asm_5cb39 + jr z, .engage_surge CheckEventReuseA EVENT_GOT_TM24 - jr nz, .asm_5cb31 + jr nz, .after_win_text call z, VermilionGymScript_5caaa call DisableWaitingAfterTextDisplay - jr .asm_5cb6a -.asm_5cb31 + jr .text_script_end + +.after_win_text ld hl, VermilionGymText_5cb72 call PrintText - jr .asm_5cb6a -.asm_5cb39 + jr .text_script_end + +.engage_surge ld hl, VermilionGymText_5cb6d call PrintText ld hl, wd72d @@ -162,7 +166,7 @@ VermilionGymText1: ld a, $3 ld [wVermilionGymCurScript], a ld [wCurMapScript], a -.asm_5cb6a +.text_script_end jp TextScriptEnd VermilionGymText_5cb6d: @@ -179,7 +183,7 @@ VermilionGymText6: VermilionGymText7: TX_FAR _ReceivedTM24Text - db $11 + TX_SFX_KEY_ITEM TX_FAR _TM24ExplanationText db "@" @@ -249,14 +253,15 @@ VermilionGymText5: TX_ASM ld a, [wBeatGymFlags] bit 2, a - jr nz, .asm_5cbeb + jr nz, .beat_surge ld hl, VermilionGymText_5cbf4 call PrintText - jr .asm_5cbf1 -.asm_5cbeb + jr .text_script_end + +.beat_surge ld hl, VermilionGymText_5cbf9 call PrintText -.asm_5cbf1 +.text_script_end jp TextScriptEnd VermilionGymText_5cbf4: diff --git a/scripts/vermilionhouse3.asm b/scripts/vermilionhouse3.asm index 1f0af501..aeada0d0 100755 --- a/scripts/vermilionhouse3.asm +++ b/scripts/vermilionhouse3.asm @@ -5,8 +5,5 @@ VermilionHouse3TextPointers: dw VermilionHouse3Text1 VermilionHouse3Text1: - TX_ASM - ld a, $4 - ld [wWhichTrade], a - predef DoInGameTradeDialogue - jp TextScriptEnd + TX_FAR TeachingHMsText + db "@" diff --git a/scripts/vermilionpokecenter.asm b/scripts/vermilionpokecenter.asm index f70aed31..af481a16 100755 --- a/scripts/vermilionpokecenter.asm +++ b/scripts/vermilionpokecenter.asm @@ -7,6 +7,7 @@ VermilionPokecenterTextPointers: dw VermilionPokecenterText2 dw VermilionPokecenterText3 dw VermilionTradeNurseText + dw VermilionPokecenterText5 VermilionHealNurseText: TX_POKECENTER_NURSE @@ -21,3 +22,8 @@ VermilionPokecenterText3: VermilionTradeNurseText: TX_CABLE_CLUB_RECEPTIONIST + +VermilionPokecenterText5: + TX_ASM + callab PokecenterChanseyText + jp TextScriptEnd diff --git a/scripts/victoryroad1.asm b/scripts/victoryroad1.asm index 8ec6725b..0f4de43e 100755 --- a/scripts/victoryroad1.asm +++ b/scripts/victoryroad1.asm @@ -29,6 +29,9 @@ VictoryRoad1Script0: ld hl, CoordsData_5da5c call CheckBoulderCoords jp nc, CheckFightingMapTrainers + ld a, [H_SPRITEINDEX] + cp $f + jp z, CheckFightingMapTrainers ld hl, wCurrentMapScriptFlags set 5, [hl] SetEvent EVENT_VICTORY_ROAD_1_BOULDER_ON_SWITCH diff --git a/scripts/victoryroad2.asm b/scripts/victoryroad2.asm index 5a3413ee..20a80461 100755 --- a/scripts/victoryroad2.asm +++ b/scripts/victoryroad2.asm @@ -17,7 +17,6 @@ VictoryRoad2Script: VictoryRoad2Script_517c4: ResetEvent EVENT_VICTORY_ROAD_1_BOULDER_ON_SWITCH - VictoryRoad2Script_517c9: CheckEvent EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH1 jr z, .asm_517da @@ -31,7 +30,6 @@ VictoryRoad2Script_517c9: ret z ld a, $1d lb bc, 7, 11 - VictoryRoad2Script_517e2: ld [wNewTileBlockID], a predef ReplaceTileBlock @@ -46,6 +44,9 @@ VictoryRoad2Script0: ld hl, CoordsData_51816 call CheckBoulderCoords jp nc, CheckFightingMapTrainers + ld a, [hSpriteIndexOrTextID] + cp $f + jp z, CheckFightingMapTrainers EventFlagAddress hl, EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH1 ld a, [wCoordIndex] cp $2 @@ -133,10 +134,10 @@ MoltresTrainerHeader: dbEventFlagBit EVENT_BEAT_MOLTRES db ($0 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_MOLTRES - dw MoltresBattleText ; TextBeforeBattle - dw MoltresBattleText ; TextAfterBattle - dw MoltresBattleText ; TextEndBattle - dw MoltresBattleText ; TextEndBattle + dw MoltresBattleText ; TextBeforeBattle + dw MoltresBattleText ; TextAfterBattle + dw MoltresBattleText ; TextEndBattle + dw MoltresBattleText ; TextEndBattle db $ff diff --git a/scripts/victoryroad3.asm b/scripts/victoryroad3.asm index ef638a0f..31e06053 100755 --- a/scripts/victoryroad3.asm +++ b/scripts/victoryroad3.asm @@ -36,6 +36,9 @@ VictoryRoad3Script0: ld a, [wCoordIndex] cp $1 jr nz, .asm_449dc + ld a, [hSpriteIndexOrTextID] + cp $f ; Pikachu + jp z, .asm_449fe ld hl, wCurrentMapScriptFlags set 5, [hl] SetEvent EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH1 diff --git a/scripts/viridiancity.asm b/scripts/viridiancity.asm index cd629d7e..5aa1dbbc 100755 --- a/scripts/viridiancity.asm +++ b/scripts/viridiancity.asm @@ -2,325 +2,363 @@ ViridianCityScript: call EnableAutoTextBoxDrawing ld hl, ViridianCityScriptPointers ld a, [wViridianCityCurScript] - jp CallFunctionInTable + call JumpTable + ret ViridianCityScriptPointers: dw ViridianCityScript0 dw ViridianCityScript1 dw ViridianCityScript2 dw ViridianCityScript3 + dw ViridianCityScript4 + dw ViridianCityScript5 + dw ViridianCityScript6 + dw ViridianCityScript7 + dw ViridianCityScript8 + dw ViridianCityScript9 + dw ViridianCityScript10 ViridianCityScript0: - call ViridianCityScript_1900b - jp ViridianCityScript_1903d + call ViridianCityScript_1905b + call ViridianCityScript_190ab + ret + +ViridianCityScript1: + call ViridianCityScript_19162 +ViridianCityScript2: + call ViridianCityScript_1905b + ret -ViridianCityScript_1900b: +ViridianCityScript_1905b: CheckEvent EVENT_VIRIDIAN_GYM_OPEN ret nz ld a, [wObtainedBadges] - cp %01111111 - jr nz, .asm_1901e + cp $7f ; all but Earthbadge + jr nz, .asm_1906e SetEvent EVENT_VIRIDIAN_GYM_OPEN ret -.asm_1901e + +.asm_1906e ld a, [wYCoord] - cp $8 + cp 8 ret nz ld a, [wXCoord] - cp $20 + cp 32 ret nz - ld a, $e + ld a, $f ld [hSpriteIndexOrTextID], a call DisplayTextID + call StartSimulatingJoypadStates + ld a, $1 + ld [wSimulatedJoypadStatesIndex], a + ld a, D_DOWN + ld [wSimulatedJoypadStatesEnd], a xor a + ld [wPlayerFacingDirection], a + ld [wJoyIgnore], a ld [hJoyHeld], a - call ViridianCityScript_190cf - ld a, $3 + ld a, $6 ld [wViridianCityCurScript], a ret -ViridianCityScript_1903d: - CheckEvent EVENT_GOT_POKEDEX +ViridianCityScript6: + ld a, [wSimulatedJoypadStatesIndex] + and a ret nz + call Delay3 + ld a, $2 + ld [wViridianCityCurScript], a + ret + +ViridianCityScript_190ab: ld a, [wYCoord] - cp $9 + cp 9 ret nz ld a, [wXCoord] - cp $13 + cp 19 ret nz ld a, $5 ld [hSpriteIndexOrTextID], a call DisplayTextID xor a ld [hJoyHeld], a - call ViridianCityScript_190cf - ld a, $3 + call ViridianCityScript_1914d + ld a, $5 ld [wViridianCityCurScript], a ret -ViridianCityScript1: - ld a, [wSpriteStateData1 + $34] - ld [$ffeb], a - ld a, [wSpriteStateData1 + $36] - ld [$ffec], a - ld a, [wSpriteStateData2 + $34] - ld [$ffed], a - ld a, [wSpriteStateData2 + $35] - ld [$ffee], a +ViridianCityScript3: + call ViridianCityScript_190ef + call ViridianCityScript_190db + ResetEvent EVENT_02F + ld a, $4 + ld [wViridianCityCurScript], a + ret + +ViridianCityScript_190db: xor a ld [wListScrollOffset], a - - ; set up battle for Old Man ld a, BATTLE_TYPE_OLD_MAN ld [wBattleType], a ld a, 5 ld [wCurEnemyLVL], a - ld a, WEEDLE + ld a, RATTATA ld [wCurOpponent], a - ld a, $2 - ld [wViridianCityCurScript], a ret -ViridianCityScript2: - ld a, [$ffeb] - ld [wSpriteStateData1 + $34], a - ld a, [$ffec] - ld [wSpriteStateData1 + $36], a - ld a, [$ffed] - ld [wSpriteStateData2 + $34], a - ld a, [$ffee] - ld [wSpriteStateData2 + $35], a +ViridianCityScript_190ef: + ld a, [wSpriteStateData1 + 3 * $10 + 4] + ld [$ffeb], a + ld a, [wSpriteStateData1 + 3 * $10 + 6] + ld [$ffec], a + ld a, [wSpriteStateData2 + 3 * $10 + 4] + ld [$ffed], a + ld a, [wSpriteStateData2 + 3 * $10 + 5] + ld [$ffee], a + ret + +ViridianCityScript4: + call ViridianCityScript_1912a call UpdateSprites call Delay3 + SetEvent EVENT_02E xor a ld [wJoyIgnore], a - ld a, $f + ld a, $10 ld [hSpriteIndexOrTextID], a call DisplayTextID xor a ld [wBattleType], a ld [wJoyIgnore], a - ld a, $0 + ld a, $2 ld [wViridianCityCurScript], a ret -ViridianCityScript3: +ViridianCityScript_1912a: + ld a, [$ffeb] + ld [wSpriteStateData1 + 3 * $10 + 4], a + ld a, [$ffec] + ld [wSpriteStateData1 + 3 * $10 + 6], a + ld a, [$ffed] + ld [wSpriteStateData2 + 3 * $10 + 4], a + ld a, [$ffee] + ld [wSpriteStateData2 + 3 * $10 + 5], a + ret + +ViridianCityScript5: ld a, [wSimulatedJoypadStatesIndex] and a ret nz call Delay3 - ld a, 0 + ld a, $0 ld [wViridianCityCurScript], a ret -ViridianCityScript_190cf: +ViridianCityScript_1914d: call StartSimulatingJoypadStates ld a, $1 ld [wSimulatedJoypadStatesIndex], a ld a, D_DOWN ld [wSimulatedJoypadStatesEnd], a xor a - ld [wSpriteStateData1 + 9], a + ld [wPlayerFacingDirection], a + ld [wJoyIgnore], a + ret + +ViridianCityScript_19162: + CheckEvent EVENT_02D + ret nz + ld a, [wYCoord] + cp 9 + ret nz + ld a, [wXCoord] + cp 19 + ret nz + ld a, $8 + ld [hSpriteIndexOrTextID], a + ld a, SPRITE_FACING_RIGHT + ld [hSpriteFacingDirection], a + call SetSpriteFacingDirectionAndDelay + ld a, $8 + ld [wPlayerFacingDirection], a + ld a, $8 + ld [hSpriteIndexOrTextID], a + call DisplayTextID + ld a, D_UP | D_DOWN | D_LEFT | D_RIGHT | START | SELECT + ld [wJoyIgnore], a + ret + +ViridianCityScript7: + call ViridianCityScript_190ef + call ViridianCityScript_190db + SetEvent EVENT_02F + ld a, D_UP | D_DOWN | D_LEFT | D_RIGHT | START | SELECT + ld [wJoyIgnore], a + ld a, $8 + ld [wViridianCityCurScript], a + ret + +ViridianCityScript8: + call ViridianCityScript_1912a + call UpdateSprites + call Delay3 + SetEvent EVENT_02D + ld a, D_UP | D_DOWN | D_LEFT | D_RIGHT | START | SELECT + ld [wJoyIgnore], a + ld a, $8 + ld [hSpriteIndexOrTextID], a + call DisplayTextID + xor a + ld [wBattleType], a + dec a ld [wJoyIgnore], a + ld a, $9 + ld [wViridianCityCurScript], a + ret + +ViridianCityScript9: + ld de, ViridianCityOldManMovementData2 + ld a, [wXCoord] + cp 19 + jr z, .asm_191e4 + callab Func_f1a01 + ld de, ViridianCityOldManMovementData1 +.asm_191e4 + ld a, $8 + ld [hSpriteIndexOrTextID], a + call MoveSprite + ld a, $a + ld [wViridianCityCurScript], a + ret + +ViridianCityOldManMovementData1: + db NPC_MOVEMENT_RIGHT +ViridianCityOldManMovementData2: + db NPC_MOVEMENT_DOWN + db NPC_MOVEMENT_DOWN + db NPC_MOVEMENT_DOWN + db NPC_MOVEMENT_DOWN + db NPC_MOVEMENT_DOWN + db NPC_MOVEMENT_DOWN + db $ff + +ViridianCityScript10: + ld a, [wd730] + bit 0, a + ret nz + ld a, $3 + ld [wMissableObjectIndex], a + predef HideObject + xor a + ld [wJoyIgnore], a + ld a, $2 + ld [wViridianCityCurScript], a ret ViridianCityTextPointers: - dw ViridianCityText1 - dw ViridianCityText2 - dw ViridianCityText3 - dw ViridianCityText4 - dw ViridianCityText5 - dw ViridianCityText6 - dw ViridianCityText7 - dw ViridianCityText8 - dw ViridianCityText9 - dw ViridianCityText10 + dw ViridianCityText_0 + dw ViridianCityText_1 + dw ViridianCityText_2 + dw ViridianCityText_3 + dw ViridianCityText_4 + dw ViridianCityText_5 + dw ViridianCityText_6 + dw ViridianCityText_7 + dw ViridianCityText_8 + dw ViridianCityText_9 + dw ViridianCityText_10 dw MartSignText dw PokeCenterSignText - dw ViridianCityText13 - dw ViridianCityText14 - dw ViridianCityText15 + dw ViridianCityText_11 + dw ViridianCityText_12 + dw ViridianCityText_13 -ViridianCityText1: - TX_FAR _ViridianCityText1 - db "@" - -ViridianCityText2: +ViridianCityText_0: TX_ASM - ld a, [wObtainedBadges] - cp %01111111 - ld hl, ViridianCityText_19127 - jr z, .asm_ae9fe - CheckEvent EVENT_BEAT_VIRIDIAN_GYM_GIOVANNI - jr nz, .asm_ae9fe - ld hl, ViridianCityText_19122 -.asm_ae9fe - call PrintText + callba Func_f18bb jp TextScriptEnd -ViridianCityText_19122: - TX_FAR _ViridianCityText_19122 - db "@" - -ViridianCityText_19127: - TX_FAR _ViridianCityText_19127 - db "@" - -ViridianCityText3: +ViridianCityText_1: TX_ASM - ld hl, ViridianCityText_1914d - call PrintText - call YesNoChoice - ld a, [wCurrentMenuItem] - and a - jr nz, .asm_6dfea - ld hl, ViridianCityText_19157 - call PrintText - jr .asm_d611f -.asm_6dfea - ld hl, ViridianCityText_19152 - call PrintText -.asm_d611f + callba Func_f18c7 jp TextScriptEnd -ViridianCityText_1914d: - TX_FAR _ViridianCityText_1914d - db "@" - -ViridianCityText_19152: - TX_FAR _ViridianCityText_19152 - db "@" - -ViridianCityText_19157: - TX_FAR _ViridianCityText_19157 - db "@" - -ViridianCityText4: +ViridianCityText_2: TX_ASM - CheckEvent EVENT_GOT_POKEDEX - jr nz, .asm_83894 - ld hl, ViridianCityText_19175 - call PrintText - jr .asm_700a6 -.asm_83894 - ld hl, ViridianCityText_1917a - call PrintText -.asm_700a6 + callba Func_f18e9 jp TextScriptEnd -ViridianCityText_19175: - TX_FAR _ViridianCityText_19175 - db "@" - -ViridianCityText_1917a: - TX_FAR _ViridianCityText_1917a - db "@" - -ViridianCityText5: +ViridianCityText_3: TX_ASM - ld hl, ViridianCityText_19191 - call PrintText - call ViridianCityScript_190cf - ld a, $3 - ld [wViridianCityCurScript], a + callba Func_f1911 jp TextScriptEnd -ViridianCityText_19191: - TX_FAR _ViridianCityText_19191 - db "@" - -ViridianCityText6: +ViridianCityText_4: TX_ASM - CheckEvent EVENT_GOT_TM42 - jr nz, .asm_4e5a0 - ld hl, ViridianCityText_191ca - call PrintText - lb bc, TM_42, 1 - call GiveItem - jr nc, .BagFull - ld hl, ReceivedTM42Text - call PrintText - SetEvent EVENT_GOT_TM42 - jr .asm_3c73c -.BagFull - ld hl, TM42NoRoomText - call PrintText - jr .asm_3c73c -.asm_4e5a0 - ld hl, TM42Explanation - call PrintText -.asm_3c73c + callba Func_f192c jp TextScriptEnd -ViridianCityText_191ca: - TX_FAR _ViridianCityText_191ca - db "@" - -ReceivedTM42Text: - TX_FAR _ReceivedTM42Text - db $10, "@" +ViridianCityText_5: + TX_ASM + callba Func_f194a + jp TextScriptEnd -TM42Explanation: - TX_FAR _TM42Explanation - db "@" +ViridianCityText_6: + TX_ASM + callba Func_f198e + jp TextScriptEnd -TM42NoRoomText: - TX_FAR _TM42NoRoomText +ViridianCityText_13: + TX_FAR _ViridianCityText_19219 db "@" -ViridianCityText7: +ViridianCityText_7: TX_ASM - ld hl, ViridianCityText_1920a + CheckEvent EVENT_02D + jr nz, .asm_192a6 + ld hl, ViridianCityText_192af call PrintText ld c, 2 call DelayFrames - call YesNoChoice - ld a, [wCurrentMenuItem] - and a - jr z, .asm_42f68 - ld hl, ViridianCityText_1920f - call PrintText - ld a, $1 + ld a, $7 ld [wViridianCityCurScript], a - jr .asm_2413a -.asm_42f68 - ld hl, ViridianCityText_19214 + jr .asm_192ac + +.asm_192a6 + ld hl, ViridianCityText_192b4 call PrintText -.asm_2413a +.asm_192ac jp TextScriptEnd -ViridianCityText_1920a: +ViridianCityText_192af: TX_FAR _ViridianCityText_1920a db "@" -ViridianCityText_1920f: - TX_FAR _ViridianCityText_1920f +ViridianCityText_192b4: + TX_FAR _OldManTextAfterBattle db "@" -ViridianCityText_19214: - TX_FAR _ViridianCityText_19214 - db "@" - -ViridianCityText15: - TX_FAR _ViridianCityText_19219 - db "@" - -ViridianCityText8: - TX_FAR _ViridianCityText8 - db "@" +ViridianCityText_8: + TX_ASM + callba Func_f19c5 + jp TextScriptEnd -ViridianCityText9: - TX_FAR _ViridianCityText9 - db "@" +ViridianCityText_9: + TX_ASM + callba Func_f19d1 + jp TextScriptEnd -ViridianCityText10: - TX_FAR _ViridianCityText10 - db "@" +ViridianCityText_10: + TX_ASM + callba Func_f19dd + jp TextScriptEnd -ViridianCityText13: - TX_FAR _ViridianCityText13 - db "@" +ViridianCityText_11: + TX_ASM + callba Func_f19e9 + jp TextScriptEnd -ViridianCityText14: - TX_FAR _ViridianCityText14 - db "@" +ViridianCityText_12: + TX_ASM + callba Func_f19f5 + jp TextScriptEnd diff --git a/scripts/viridiancity2.asm b/scripts/viridiancity2.asm new file mode 100755 index 00000000..532d57d7 --- /dev/null +++ b/scripts/viridiancity2.asm @@ -0,0 +1,218 @@ +Func_f18bb: + ld hl, ViridianCityText_f18c2 + call PrintText + ret + +ViridianCityText_f18c2: + TX_FAR _ViridianCityText1 + db "@" + +Func_f18c7: + ld hl, ViridianCityText_f18e4 + ld a, [wObtainedBadges] + cp $7f ; all but EARTHBADGE + jr z, .asm_f18db + CheckEvent EVENT_BEAT_VIRIDIAN_GYM_GIOVANNI + jr nz, .asm_f18db + ld hl, ViridianCityText_f18df +.asm_f18db + call PrintText + ret + +ViridianCityText_f18df: + TX_FAR _ViridianCityText_19122 + db "@" + +ViridianCityText_f18e4: + TX_FAR _ViridianCityText_19127 + db "@" + +Func_f18e9: + ld hl, ViridianCityText_f1902 + call PrintText + call YesNoChoice + ld a, [wCurrentMenuItem] + and a + ld hl, ViridianCityText_f1907 + jr nz, .asm_f18fe + ld hl, ViridianCityText_f190c +.asm_f18fe + call PrintText + ret + +ViridianCityText_f1902: + TX_FAR _ViridianCityText_1914d + db "@" + +ViridianCityText_f1907: + TX_FAR _ViridianCityText_19152 + db "@" + +ViridianCityText_f190c: + TX_FAR _ViridianCityText_19157 + db "@" + +Func_f1911: + ld hl, ViridianCityText_f1927 + CheckEvent EVENT_GOT_POKEDEX + jr nz, .asm_f191e + ld hl, ViridianCityText_f1922 +.asm_f191e + call PrintText + ret + +ViridianCityText_f1922: + TX_FAR _ViridianCityText_19175 + db "@" + +ViridianCityText_f1927: + TX_FAR _ViridianCityText_1917a + db "@" + +Func_f192c: + ld hl, ViridianCityText_f1945 + call PrintText + call StartSimulatingJoypadStates + ld a, $1 + ld [wSimulatedJoypadStatesIndex], a + ld a, D_DOWN + ld [wSimulatedJoypadStatesEnd], a + ld a, $5 + ld [wViridianCityCurScript], a + ret + +ViridianCityText_f1945: + TX_FAR _ViridianCityText_19191 + db "@" + +Func_f194a: + CheckEvent EVENT_GOT_TM42 + jr nz, .asm_f1972 + ld hl, ViridianCityText_f1979 + call PrintText + lb bc, TM_42, 1 + call GiveItem + jr nc, .asm_f196b + ld hl, ViridianCityText_f197e + call PrintText + SetEvent EVENT_GOT_TM42 + ret + +.asm_f196b + ld hl, ViridianCityText_f1989 + call PrintText + ret + +.asm_f1972 + ld hl, ViridianCityText_f1984 + call PrintText + ret + +ViridianCityText_f1979: + TX_FAR _ViridianCityText_191ca + db "@" + +ViridianCityText_f197e: + TX_FAR _ReceivedTM42Text + TX_SFX_CONGRATS + db "@" + +ViridianCityText_f1984: + TX_FAR _TM42Explanation + db "@" + +ViridianCityText_f1989: + TX_FAR _TM42NoRoomText + db "@" + +Func_f198e: + ld hl, ViridianCityText_f19b6 + call PrintText + ld c, 2 + call DelayFrames + call YesNoChoice + ld a, [wCurrentMenuItem] + and a + jr nz, .asm_f19af + ld hl, ViridianCityText_f19bb + call PrintText + ld a, $3 + ld [wViridianCityCurScript], a + jr .asm_f19b5 + +.asm_f19af + ld hl, ViridianCityText_f19c0 + call PrintText +.asm_f19b5 + ret + +ViridianCityText_f19b6: + TX_FAR _OldManAgainText1 + db "@" + +ViridianCityText_f19bb: + TX_FAR _OldManAgainText2 + db "@" + +ViridianCityText_f19c0: + TX_FAR _OldManAgainText3 + db "@" + +Func_f19c5: + ld hl, ViridianCityText_f19cc + call PrintText + ret + +ViridianCityText_f19cc: + TX_FAR _ViridianCityText8 + db "@" + +Func_f19d1: + ld hl, ViridianCityText_f19d8 + call PrintText + ret + +ViridianCityText_f19d8: + TX_FAR _ViridianCityText9 + db "@" + +Func_f19dd: + ld hl, ViridianCityText_f19e4 + call PrintText + ret + +ViridianCityText_f19e4: + TX_FAR _ViridianCityText10 + db "@" + +Func_f19e9: + ld hl, ViridianCityText_f19f0 + call PrintText + ret + +ViridianCityText_f19f0: + TX_FAR _ViridianCityText13 + db "@" + +Func_f19f5: + ld hl, ViridianCityText_f19fc + call PrintText + ret + +ViridianCityText_f19fc: + TX_FAR _ViridianCityText14 + db "@" + + +Func_f1a01: + ld hl, Data_f1a0a + ld b, SPRITE_FACING_RIGHT + call TryApplyPikachuMovementData + ret + +Data_f1a0a: + db $00 + db $1d + db $1f + db $38 + db $3f diff --git a/scripts/viridianforest.asm b/scripts/viridianforest.asm index 3dbfd8dd..b1b2f951 100755 --- a/scripts/viridianforest.asm +++ b/scripts/viridianforest.asm @@ -17,16 +17,18 @@ ViridianForestTextPointers: dw ViridianForestText2 dw ViridianForestText3 dw ViridianForestText4 + dw ViridianForestText5 + dw ViridianForestText6 dw PickUpItemText dw PickUpItemText dw PickUpItemText - dw ViridianForestText8 - dw ViridianForestText9 dw ViridianForestText10 dw ViridianForestText11 dw ViridianForestText12 dw ViridianForestText13 dw ViridianForestText14 + dw ViridianForestText15 + dw ViridianForestText16 ViridianForestTrainerHeaders: ViridianForestTrainerHeader0: @@ -56,6 +58,24 @@ ViridianForestTrainerHeader2: dw ViridianForestEndBattleText3 ; TextEndBattle dw ViridianForestEndBattleText3 ; TextEndBattle +ViridianForestTrainerHeader3: + dbEventFlagBit EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_3 + db ($0 << 4) ; trainer's view range + dwEventFlagAddress EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_3 + dw ViridianForestBattleText4 ; TextBeforeBattle + dw ViridianForestAfterBattleText4 ; TextAfterBattle + dw ViridianForestEndBattleText4 ; TextEndBattle + dw ViridianForestEndBattleText4 ; TextEndBattle + +ViridianForestTrainerHeader4: + dbEventFlagBit EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_4 + db ($4 << 4) ; trainer's view range + dwEventFlagAddress EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_4 + dw ViridianForestBattleText5 ; TextBeforeBattle + dw ViridianForestAfterBattleText5 ; TextAfterBattle + dw ViridianForestEndBattleText5 ; TextEndBattle + dw ViridianForestEndBattleText5 ; TextEndBattle + db $ff ViridianForestText1: @@ -65,18 +85,27 @@ ViridianForestText1: ViridianForestText2: TX_ASM ld hl, ViridianForestTrainerHeader0 - call TalkToTrainer - jp TextScriptEnd + jr ViridianForestTalkToTrainer ViridianForestText3: TX_ASM ld hl, ViridianForestTrainerHeader1 - call TalkToTrainer - jp TextScriptEnd + jr ViridianForestTalkToTrainer ViridianForestText4: TX_ASM ld hl, ViridianForestTrainerHeader2 + jr ViridianForestTalkToTrainer + +ViridianForestText5: + TX_ASM + ld hl, ViridianForestTrainerHeader3 + jr ViridianForestTalkToTrainer + +ViridianForestText6: + TX_ASM + ld hl, ViridianForestTrainerHeader4 +ViridianForestTalkToTrainer: call TalkToTrainer jp TextScriptEnd @@ -116,30 +145,63 @@ ViridianForestAfterBattleText3: TX_FAR _ViridianFrstAfterBattleText3 db "@" -ViridianForestText8: - TX_FAR _ViridianForestText8 +ViridianForestBattleText4: + TX_FAR _ViridianForestBattleTextPikaGirl + db "@" + +ViridianForestEndBattleText4: + TX_FAR _ViridianForestEndBattleTextPikaGirl + db "@" + +ViridianForestAfterBattleText4: + TX_FAR _ViridianForestAfterBattleTextPikaGirl + db "@" + +ViridianForestBattleText5: + TX_FAR _ViridianForestBattleTextSamurai db "@" -ViridianForestText9: - TX_FAR _ViridianForestText9 +ViridianForestEndBattleText5: + TX_FAR _ViridianForestEndBattleTextSamurai + db "@" + +ViridianForestAfterBattleText5: + TX_FAR _ViridianForestAfterBattleTextSamurai db "@" ViridianForestText10: - TX_FAR _ViridianForestText10 + TX_FAR _ViridianForestText8 db "@" ViridianForestText11: - TX_FAR _ViridianForestText11 - db "@" + TX_ASM + ld hl, Func_f2528 + jp ViridianForestScript_6120d ViridianForestText12: - TX_FAR _ViridianForestText12 - db "@" + TX_ASM + ld hl, Func_f2534 + jp ViridianForestScript_6120d ViridianForestText13: - TX_FAR _ViridianForestText13 - db "@" + TX_ASM + ld hl, Func_f2540 + jp ViridianForestScript_6120d ViridianForestText14: - TX_FAR _ViridianForestText14 - db "@" + TX_ASM + ld hl, Func_f254c + jp ViridianForestScript_6120d + +ViridianForestText15: + TX_ASM + ld hl, Func_f2558 + jp ViridianForestScript_6120d + +ViridianForestText16: + TX_ASM + ld hl, Func_f2528 +ViridianForestScript_6120d + ld b, BANK(Func_f2528) + call Bankswitch + jp TextScriptEnd diff --git a/scripts/viridianforest2.asm b/scripts/viridianforest2.asm new file mode 100755 index 00000000..489db39c --- /dev/null +++ b/scripts/viridianforest2.asm @@ -0,0 +1,53 @@ +Func_f2528: + ld hl, Text_f252f + call PrintText + ret + +Text_f252f: + TX_FAR _ViridianForestText9 + db "@" + +Func_f2534: + ld hl, Text_f253b + call PrintText + ret + +Text_f253b: + TX_FAR _ViridianForestText10 + db "@" + +Func_f2540: + ld hl, Text_f254a + call PrintText + ret + +Text_f254a: + TX_FAR _ViridianForestText11 + db "@" + +Func_f254c: + ld hl, Text_f2553 + call PrintText + ret + +Text_f2553: + TX_FAR _ViridianForestText12 + db "@" + +Func_f2558: + ld hl, Text_f255f + call PrintText + ret + +Text_f255f: + TX_FAR _ViridianForestText13 + db "@" + +Func_f2564: + ld hl, ViridianForestText_f256b + call PrintText + ret + +ViridianForestText_f256b: + TX_FAR _ViridianForestText14 + db "@" diff --git a/scripts/viridianforestentrance.asm b/scripts/viridianforestentrance.asm index e24225ed..95db8bbc 100755 --- a/scripts/viridianforestentrance.asm +++ b/scripts/viridianforestentrance.asm @@ -1,5 +1,6 @@ ViridianForestEntranceScript: - jp EnableAutoTextBoxDrawing + call EnableAutoTextBoxDrawing + ret ViridianForestEntranceTextPointers: dw ViridianForestEntranceText1 diff --git a/scripts/viridianmart.asm b/scripts/viridianmart.asm index 542040a6..e20ed48e 100755 --- a/scripts/viridianmart.asm +++ b/scripts/viridianmart.asm @@ -3,7 +3,8 @@ ViridianMartScript: call EnableAutoTextBoxDrawing ld hl, ViridianMartScriptPointers ld a, [wViridianMarketCurScript] - jp CallFunctionInTable + call JumpTable + ret ViridianMartScript_1d47d: CheckEvent EVENT_OAK_GOT_PARCEL @@ -11,7 +12,7 @@ ViridianMartScript_1d47d: ld hl, ViridianMartTextPointers jr .asm_1d48c .asm_1d489 - ld hl, ViridianMartTextPointers + $a ; starts at ViridianMartText6 + ld hl, ViridianMartTextPointers + $a ; starts at ViridianCashierText .asm_1d48c ld a, l ld [wMapTextPtr], a @@ -57,8 +58,19 @@ ViridianMartScript1: SetEvent EVENT_GOT_OAKS_PARCEL ld a, $2 ld [wViridianMarketCurScript], a - ; fallthrough + ret + ViridianMartScript2: + CheckEventHL EVENT_02D + ret z + CheckAndSetEventReuseHL EVENT_02C + ret nz + ld a, HS_OLD_MAN + ld [wMissableObjectIndex], a + predef HideObject + ld a, HS_OLD_MAN_1 + ld [wMissableObjectIndex], a + predef ShowObject ret ViridianMartTextPointers: @@ -81,7 +93,7 @@ ViridianMartText4: ViridianMartText5: TX_FAR ViridianMartParcelQuestText - db $11 + TX_SFX_KEY_ITEM db "@" ViridianMartText2: diff --git a/scripts/viridianpokecenter.asm b/scripts/viridianpokecenter.asm index 904ff47f..75e6ea6f 100755 --- a/scripts/viridianpokecenter.asm +++ b/scripts/viridianpokecenter.asm @@ -7,6 +7,7 @@ ViridianPokecenterTextPointers: dw ViridianPokeCenterText2 dw ViridianPokeCenterText3 dw ViridianTradeNurseText + dw ViridianPokeCenterText5 ViridianHealNurseText: TX_POKECENTER_NURSE @@ -21,3 +22,8 @@ ViridianPokeCenterText3: ViridianTradeNurseText: TX_CABLE_CLUB_RECEPTIONIST + +ViridianPokeCenterText5: + TX_ASM + callab PokecenterChanseyText + jp TextScriptEnd @@ -1,5 +1,6 @@ - -TEXT_1 EQU $20 +INCLUDE "charmap.asm" +INCLUDE "constants/text_constants.asm" +TEXT_1 EQU $26 TEXT_2 EQU TEXT_1 + 1 TEXT_3 EQU TEXT_2 + 1 TEXT_4 EQU TEXT_3 + 1 @@ -7,15 +8,11 @@ TEXT_5 EQU TEXT_4 + 1 TEXT_6 EQU TEXT_5 + 1 TEXT_7 EQU TEXT_6 + 1 TEXT_8 EQU TEXT_7 + 1 -TEXT_9 EQU TEXT_8 + 1 -TEXT_10 EQU TEXT_9 + 1 -TEXT_11 EQU TEXT_10 + 1 -POKEDEX_TEXT EQU TEXT_11 + 1 +POKEDEX_TEXT EQU TEXT_8 + 1 MOVE_NAMES EQU POKEDEX_TEXT + 1 INCLUDE "macros.asm" -INCLUDE "charmap.asm" INCLUDE "hram.asm" @@ -25,7 +22,7 @@ _CardKeySuccessText1:: text "Bingo!@@" _CardKeySuccessText2:: - db $0 + text "" line "The CARD KEY" cont "opened the door!" done @@ -79,7 +76,7 @@ _PokeCenterSignText:: done _FoundItemText:: - text $52, " found" + text "<PLAYER> found" line "@" TX_RAM wcf4b text "!@@" @@ -96,7 +93,7 @@ _OaksAideHiText:: para "If you caught @" TX_NUM hOaksAideRequirement, 1, 3 - db $0 + text "" line "kinds of #MON," cont "I'm supposed to" cont "give you an" @@ -104,7 +101,7 @@ _OaksAideHiText:: TX_RAM wOaksAideRewardItemName text "!" - para "So, ", $52, "! Have" + para "So, <PLAYER>! Have" line "you caught at" cont "least @" TX_NUM hOaksAideRequirement, 1, 3 @@ -117,7 +114,7 @@ _OaksAideUhOhText:: line "Uh-oh! You have" cont "caught only @" TX_NUM hOaksAideNumMonsOwned, 1, 3 - db $0 + text "" cont "kinds of #MON!" para "You need @" @@ -134,7 +131,7 @@ _OaksAideComeBackText:: para "When you get @" TX_NUM hOaksAideRequirement, 1, 3 - db $0 + text "" line "kinds, come back" cont "for @" TX_RAM wOaksAideRewardItemName @@ -153,7 +150,7 @@ _OaksAideHereYouGoText:: prompt _OaksAideGotItemText:: - text $52, " got the" + text "<PLAYER> got the" line "@" TX_RAM wOaksAideRewardItemName text "!@@" @@ -167,6 +164,11 @@ _OaksAideNoRoomText:: text "." done +_NurseChanseyText:: + text "CHANSEY: Chaaan" + line "sey!" + done + INCLUDE "text/maps/viridian_forest.asm" INCLUDE "text/maps/mt_moon_1f.asm" INCLUDE "text/maps/mt_moon_b1f.asm" @@ -189,17 +191,16 @@ INCLUDE "text/maps/rocket_hideout_elevator.asm" INCLUDE "text/maps/silph_co_2f.asm" INCLUDE "text/maps/silph_co_3f.asm" INCLUDE "text/maps/silph_co_4f.asm" -INCLUDE "text/maps/silph_co_5f_1.asm" - - -SECTION "Text 2", ROMX, BANK[TEXT_2] - -INCLUDE "text/maps/silph_co_5f_2.asm" +INCLUDE "text/maps/silph_co_5f.asm" INCLUDE "text/maps/silph_co_6f.asm" INCLUDE "text/maps/silph_co_7f.asm" INCLUDE "text/maps/silph_co_8f.asm" INCLUDE "text/maps/silph_co_9f.asm" INCLUDE "text/maps/silph_co_10f.asm" + + +SECTION "Text 2", ROMX, BANK[TEXT_2] + INCLUDE "text/maps/silph_co_11f.asm" INCLUDE "text/maps/mansion_2f.asm" INCLUDE "text/maps/mansion_3f.asm" @@ -221,12 +222,7 @@ INCLUDE "text/maps/champion.asm" INCLUDE "text/maps/lorelei.asm" INCLUDE "text/maps/bruno.asm" INCLUDE "text/maps/agatha.asm" -INCLUDE "text/maps/rock_tunnel_b2f_1.asm" - - -SECTION "Text 3", ROMX, BANK[TEXT_3] - -INCLUDE "text/maps/rock_tunnel_b2f_2.asm" +INCLUDE "text/maps/rock_tunnel_b2f.asm" INCLUDE "text/maps/seafoam_islands_b4f.asm" _AIBattleWithdrawText:: @@ -239,15 +235,24 @@ _AIBattleWithdrawText:: _AIBattleUseItemText:: TX_RAM wTrainerName - db $0 + text "" line "used @" TX_RAM wcd6d - db $0 + text "" cont "on @" TX_RAM wEnemyMonNick text "!" prompt +_BoxFullTest:: + text "The BOX is full!" + done + +_BoxWillBeClearedText:: + text "The BOX will be" + line "cleared." + done + _TradeWentToText:: TX_RAM wcf4b text " went" @@ -257,7 +262,7 @@ _TradeWentToText:: done _TradeForText:: - text "For ", $52, "'s" + text "For <PLAYER>'s" line "@" TX_RAM wcf4b text "," @@ -295,11 +300,11 @@ _TradeWillTradeText:: text " will" line "trade @" TX_RAM wcd6d - db $0 + text "" done _TradeforText:: - text "for ", $52, "'s" + text "for <PLAYER>'s" line "@" TX_RAM wcf4b text "." @@ -351,7 +356,7 @@ _YeahText:: _DexSeenOwnedText:: text "#DEX Seen:@" TX_NUM wDexRatingNumMonsSeen, 1, 3 - db $0 + text "" line " Owned:@" TX_NUM wDexRatingNumMonsOwned, 1, 3 db "@" @@ -362,27 +367,27 @@ _DexRatingText:: _GymStatueText1:: TX_RAM wGymCityName - db $0 + text "" line "#MON GYM" cont "LEADER: @" TX_RAM wGymLeaderName - db $0 + text "" para "WINNING TRAINERS:" - line $53 + line "<RIVAL>" done _GymStatueText2:: TX_RAM wGymCityName - db $0 + text "" line "#MON GYM" cont "LEADER: @" TX_RAM wGymLeaderName - db $0 + text "" para "WINNING TRAINERS:" - line $53 - cont $52 + line "<RIVAL>" + cont "<PLAYER>" done _ViridianCityPokecenterGuyText:: @@ -548,7 +553,7 @@ _GameOverText:: line "GAME is over!" done -_CinnabarGymQuizIntroText:: +_CinnabarGymQuizDummyIntroText:: text "#MON Quiz!" para "Get it right and" @@ -567,6 +572,34 @@ _CinnabarGymQuizIntroText:: line "Here we go!" prompt +_CinnabarGymQuizIntroText:: + text "#MON Quiz!" + + para "Get it right and" + line "the door opens to" + cont "the next room!" + + para "Get it wrong and" + line "face the trainer" + cont "blocking the way!" + + para "If you want to" + line "conserve your" + cont "#MON for the" + cont "GYM LEADER..." + + para "Then get it right!" + line "Here we go!" + para "" + done + +_CinnabarGymQuizShortIntroText:: + text "#MON Quiz!" + + line "Test your skill!" + para "" + done + _CinnabarQuizQuestionsText1:: text "CATERPIE evolves" line "into BUTTERFREE?" @@ -627,7 +660,7 @@ _BillsHouseMonitorText:: done _BillsHouseInitiatedText:: - text $52, " initiated" + text "<PLAYER> initiated" line "TELEPORTER's Cell" cont "Separator!@@" @@ -781,12 +814,12 @@ _ViridianSchoolNotebookText4:: line "#MON LEAGUE!" prompt -_FightingDojoText_52a10:: +_EnemiesOnEverySideText:: text "Enemies on every" line "side!" done -_FightingDojoText_52a1d:: +_WhatGoesAroundComesAroundText:: text "What goes around" line "comes around!" done @@ -801,7 +834,7 @@ _IndigoPlateauHQText:: done _RedBedroomSNESText:: - text $52, " is" + text "<PLAYER> is" line "playing the SNES!" cont "...Okay!" cont "It's time to go!" @@ -828,6 +861,14 @@ _KabutopsFossilText:: cont "rare #MON." done +_FanClubPicture1Text:: + text "My cute RAPIDASH." + done + +_FanClubPicture2Text:: + text "My beloved FEAROW." + done + _LinkCableHelpText1:: text "TRAINER TIPS" @@ -972,31 +1013,31 @@ _VermilionGymTrashFailText:: cont "locks were reset!@@" _FoundHiddenItemText:: - text $52, " found" + text "<PLAYER> found" line "@" TX_RAM wcd6d text "!@@" _HiddenItemBagFullText:: - text "But, ", $52, " has" + text "But, <PLAYER> has" line "no more room for" cont "other items!" done _FoundHiddenCoinsText:: - text $52, " found" + text "<PLAYER> found" line "@" - TX_BCD hCoins, $c2 + TX_BCD hCoins, 2 | LEADING_ZEROES | LEFT_ALIGN text " coins!@@" _FoundHiddenCoins2Text:: - text $52, " found" + text "<PLAYER> found" line "@" - TX_BCD hCoins, $c2 + TX_BCD hCoins, 2 | LEADING_ZEROES | LEFT_ALIGN text " coins!@@" _DroppedHiddenCoinsText:: - db $0 + text "" para "Oops! Dropped" line "some coins!" done @@ -1050,48 +1091,48 @@ _OutOfSafariBallsText:: _WildRanText:: text "Wild @" TX_RAM wEnemyMonNick - db $0 + text "" line "ran!" prompt _EnemyRanText:: text "Enemy @" TX_RAM wEnemyMonNick - db $0 + text "" line "ran!" prompt _HurtByPoisonText:: - text $5a, "'s" + text "<USER>'s" line "hurt by poison!" prompt _HurtByBurnText:: - text $5a, "'s" + text "<USER>'s" line "hurt by the burn!" prompt _HurtByLeechSeedText:: text "LEECH SEED saps" - line $5a, "!" + line "<USER>!" prompt _EnemyMonFaintedText:: text "Enemy @" TX_RAM wEnemyMonNick - db $0 + text "" line "fainted!" prompt _MoneyForWinningText:: - text $52, " got ¥@" - TX_BCD wAmountMoneyWon, $c3 - db $0 + text "<PLAYER> got ¥@" + TX_BCD wAmountMoneyWon, 3 | LEADING_ZEROES | LEFT_ALIGN + text "" line "for winning!" prompt _TrainerDefeatedText:: - text $52, " defeated" + text "<PLAYER> defeated" line "@" TX_RAM wTrainerName text "!" @@ -1099,7 +1140,7 @@ _TrainerDefeatedText:: _PlayerMonFaintedText:: TX_RAM wBattleMonNick - db $0 + text "" line "fainted!" prompt @@ -1108,20 +1149,20 @@ _UseNextMonText:: done _Sony1WinText:: - text $53, ": Yeah! Am" + text "<RIVAL>: Yeah! Am" line "I great or what?" prompt _PlayerBlackedOutText2:: - text $52, " is out of" + text "<PLAYER> is out of" line "useable #MON!" - para $52, " blacked" + para "<PLAYER> blacked" line "out!" prompt _LinkBattleLostText:: - text $52, " lost to" + text "<PLAYER> lost to" line "@" TX_RAM wTrainerName text "!" @@ -1135,7 +1176,7 @@ _TrainerAboutToUseText:: TX_RAM wEnemyMonNick text "!" - para "Will ", $52 + para "Will <PLAYER>" line "change #MON?" done @@ -1166,6 +1207,10 @@ _GotAwayText:: text "Got away safely!" prompt +_RunAwayText:: + text "Hurry, get away!" + prompt + _ItemsCantBeUsedHereText:: text "Items can't be" line "used here." @@ -1196,7 +1241,7 @@ _NoMovesLeftText:: _MultiHitText:: text "Hit the enemy" line "@" - TX_NUM wPlayerNumHits,1,1 + TX_NUM wPlayerNumHits, 1, 1 text " times!" prompt @@ -1212,42 +1257,42 @@ _GetOutText:: prompt _FastAsleepText:: - text $5A + text "<USER>" line "is fast asleep!" prompt _WokeUpText:: - text $5A + text "<USER>" line "woke up!" prompt _IsFrozenText:: - text $5A + text "<USER>" line "is frozen solid!" prompt _FullyParalyzedText:: - text $5A,"'s" + text "<USER>'s" line "fully paralyzed!" prompt _FlinchedText:: - text $5A + text "<USER>" line "flinched!" prompt _MustRechargeText:: - text $5A + text "<USER>" line "must recharge!" prompt _DisabledNoMoreText:: - text $5A,"'s" + text "<USER>'s" line "disabled no more!" prompt _IsConfusedText:: - text $5A + text "<USER>" line "is confused!" prompt @@ -1257,37 +1302,37 @@ _HurtItselfText:: prompt _ConfusedNoMoreText:: - text $5A,"'s" + text "<USER>'s" line "confused no more!" prompt _SavingEnergyText:: - text $5A + text "<USER>" line "is saving energy!" prompt _UnleashedEnergyText:: - text $5A + text "<USER>" line "unleashed energy!" prompt _ThrashingAboutText:: - text $5A,"'s" + text "<USER>'s" line "thrashing about!" done _AttackContinuesText:: - text $5A,"'s" + text "<USER>'s" line "attack continues!" done _CantMoveText:: - text $5A + text "<USER>" line "can't move!" prompt _MoveIsDisabledText:: - text $5a, "'s" + text "<USER>'s" line "@" TX_RAM wcd6d text " is" @@ -1295,14 +1340,14 @@ _MoveIsDisabledText:: prompt _MonName1Text:: - text $5a, "@@" + text "<USER>@@" _Used1Text:: - db $0 + text "" line "used @@" _Used2Text:: - db $0 + text "" line "used @@" _InsteadText:: @@ -1334,24 +1379,24 @@ _ExclamationPoint5Text:: done _AttackMissedText:: - text $5a, "'s" + text "<USER>'s" line "attack missed!" prompt _KeptGoingAndCrashedText:: - text $5a + text "<USER>" line "kept going and" cont "crashed!" prompt _UnaffectedText:: - text $59, "'s" + text "<TARGET>'s" line "unaffected!" prompt _DoesntAffectMonText:: text "It doesn't affect" - line $59, "!" + line "<TARGET>!" prompt _CriticalHitText:: @@ -1388,23 +1433,23 @@ _TurnedAwayText:: _IgnoredOrdersText:: TX_RAM wBattleMonNick - db $0 + text "" line "ignored orders!" prompt _SubstituteTookDamageText:: text "The SUBSTITUTE" line "took damage for" - cont $59, "!" + cont "<TARGET>!" prompt _SubstituteBrokeText:: - text $59, "'s" + text "<TARGET>'s" line "SUBSTITUTE broke!" prompt _BuildingRageText:: - text $5a, "'s" + text "<USER>'s" line "RAGE is building!" prompt @@ -1431,6 +1476,7 @@ _WithExpAllText:: _BoostedText:: text "a boosted" cont "@@" + _ExpPointsText:: TX_NUM wExpAmountGained, 2, 4 text " EXP. Points!" @@ -1443,10 +1489,34 @@ _GrewLevelText:: TX_NUM wCurEnemyLVL, 1, 3 text "!@@" +_SuperEffectiveText:: + text "It's super" + line "effective!" + prompt + +_NotVeryEffectiveText:: + text "It's not very" + line "effective..." + prompt + +_SafariZoneEatingText:: + text "Wild @" + TX_RAM wEnemyMonNick + text "" + line "is eating!" + prompt + +_SafariZoneAngryText:: + text "Wild @" + TX_RAM wEnemyMonNick + text "" + line "is angry!" + prompt + _WildMonAppearedText:: text "Wild @" TX_RAM wEnemyMonNick - db $0 + text "" line "appeared!" prompt @@ -1454,13 +1524,16 @@ _HookedMonAttackedText:: text "The hooked" line "@" TX_RAM wEnemyMonNick - db $0 + text "" cont "attacked!" prompt + +SECTION "Text 3", ROMX, BANK[TEXT_3] + _EnemyAppearedText:: TX_RAM wEnemyMonNick - db $0 + text "" line "appeared!" prompt @@ -1513,39 +1586,15 @@ _GoodText:: text "good!@@" _ComeBackText:: - db $0 + text "" line "Come back!" done -_SuperEffectiveText:: - text "It's super" - line "effective!" - prompt - -_NotVeryEffectiveText:: - text "It's not very" - line "effective..." - prompt - -_SafariZoneEatingText:: - text "Wild @" - TX_RAM wEnemyMonNick - db $0 - line "is eating!" - prompt - -_SafariZoneAngryText:: - text "Wild @" - TX_RAM wEnemyMonNick - db $0 - line "is angry!" - prompt - ; money related _PickUpPayDayMoneyText:: - text $52, " picked up" + text "<PLAYER> picked up" line "¥@" - TX_BCD wTotalPayDayMoney, $c3 + TX_BCD wTotalPayDayMoney, 3 | LEADING_ZEROES | LEFT_ALIGN text "!" prompt @@ -1559,6 +1608,11 @@ _WhichFloorText:: line "you want? " done +_SleepingPikachuText1:: + text "There isn't any" + line "response..." + prompt + _PartyMenuNormalText:: text "Choose a #MON." done @@ -1574,7 +1628,7 @@ _PartyMenuBattleText:: done _PartyMenuUseTMText:: - text "Use TM on which" + text "Teach to which" line "#MON?" done @@ -1585,7 +1639,7 @@ _PartyMenuSwapMonText:: _PotionText:: TX_RAM wcd6d - db $0 + text "" line "recovered by @" TX_NUM wHPBarHPDifference, 2, 3 text "!" @@ -1617,7 +1671,7 @@ _IceHealText:: _AwakeningText:: TX_RAM wcd6d - db $0 + text "" line "woke up!" done @@ -1629,7 +1683,7 @@ _FullHealText:: _ReviveText:: TX_RAM wcd6d - db $0 + text "" line "is revitalized!" done @@ -1637,11 +1691,11 @@ _RareCandyText:: TX_RAM wcd6d text " grew" line "to level @" - TX_NUM wCurEnemyLVL, $1,$3 + TX_NUM wCurEnemyLVL, 1, 3 text "!@@" _TurnedOnPC1Text:: - text $52, " turned on" + text "<PLAYER> turned on" line "the PC." prompt @@ -1669,7 +1723,7 @@ _AccessedMyPCText:: prompt _TurnedOnPC2Text:: - text $52, " turned on" + text "<PLAYER> turned on" line "the PC." prompt @@ -1746,6 +1800,11 @@ _AccessedHoFPCText:: line "OF FAME List." prompt +_SleepingPikachuText2:: + text "There isn't any" + line "response..." + prompt + _SwitchOnText:: text "Switch on!" prompt @@ -1799,6 +1858,12 @@ _CantTakeMonText:: line "first." prompt +_PikachuUnhappyText:: + TX_RAM wcd6d + text " looks" + line "unhappy about it!" + prompt + _ReleaseWhichMonText:: text "Release which" line "#MON?" @@ -1875,19 +1940,16 @@ _AccessedOaksPCText:: line "Rating System." prompt -_WhereWouldYouLikeText:: - text "Where would you" - line "like to go?" - done - -_PleaseWaitText:: - text "OK, please wait" - line "just a moment." - done +_ExpressionText:: + text "This expression is" + line "No. @" + TX_NUM wExpressionNumber, 1, 2 + text "." + prompt -_LinkCanceledText:: - text "The link was" - line "canceled." +_NotEnoughMemoryText:: + text "Not enough Yellow" + line "Version memory." done INCLUDE "text/oakspeech.asm" @@ -1902,13 +1964,13 @@ _DoYouWantToNicknameText:: _YourNameIsText:: text "Right! So your" - line "name is ", $52, "!" + line "name is <PLAYER>!" prompt _HisNameIsText:: text "That's right! I" line "remember now! His" - cont "name is ", $53, "!" + cont "name is <RIVAL>!" prompt _WillBeTradedText:: @@ -1920,13 +1982,121 @@ _WillBeTradedText:: cont "be traded." done +_Colosseum3MonsText:: + text "You need 3 #MON" + line "to fight!" + prompt + +_ColosseumMewText:: + text "Sorry, MEW can't" + line "attend!" + prompt + +_ColosseumDifferentMonsText:: + text "Your #MON must" + line "all be different!" + prompt + +_ColosseumMaxL55Text:: + text "No #MON can" + line "exceed L55!" + prompt + +_ColosseumMinL50Text:: + text "All #MON must" + line "be at least L50!" + prompt + +_ColosseumTotalL155Text:: + text "Your total levels" + line "exceed 155!" + prompt + +_ColosseumMaxL30Text:: + text "No #MON can" + line "exceed L30!" + prompt + +_ColosseumMinL25Text:: + text "All #MON must" + line "be at least L25!" + prompt + +_ColosseumTotalL80Text:: + text "Your total levels" + line "exceed 80!" + prompt + +_ColosseumMaxL20Text:: + text "No #MON can" + line "exceed L20!" + prompt + +_ColosseumMinL15Text:: + text "All #MON must" + line "be at least L15!" + prompt + +_ColosseumTotalL50Text:: + text "Your total levels" + line "exceed 50!" + prompt + +_ColosseumHeightText:: + TX_RAM wcd6d + text " is over" + line "6′8″ tall!" + prompt + +_ColosseumWeightText:: + TX_RAM wcd6d + text " weighs" + line "over 44 pounds!" + prompt + +_ColosseumEvolvedText:: + TX_RAM wcd6d + text " is an" + line "evolved #MON!" + prompt + +_ColosseumIneligibleText:: + text "Your opponent is" + line "ineligible." + prompt + +_ColosseumWhereToText:: + text "Where would you" + line "like to go?" + done + +_ColosseumPleaseWaitText:: + text "OK, please wait" + line "just a moment." + done + +_ColosseumCanceledText:: + text "The link was" + line "canceled." + done + +_ColosseumVersionText:: + text "The game versions" + line "don't match." + prompt + _Char00Text:: - TX_NUM hSpriteIndexOrTextID,1,2 - text " ERROR." + TX_NUM hSpriteIndexOrTextID, 1, 2 + text " error." done _Char55Text:: - text $4B,"@@" + text $4B, "@@" + +_NoPokemonText:: + text "There are no" + line "#MON here!" + prompt INCLUDE "text/maps/digletts_cave_route_2_entrance.asm" INCLUDE "text/maps/viridian_forest_exit.asm" @@ -1935,12 +2105,7 @@ INCLUDE "text/maps/route_2_gate.asm" INCLUDE "text/maps/viridian_forest_entrance.asm" INCLUDE "text/maps/mt_moon_pokecenter.asm" INCLUDE "text/maps/saffron_gates.asm" -INCLUDE "text/maps/daycare_1.asm" - - -SECTION "Text 4", ROMX, BANK[TEXT_4] - -INCLUDE "text/maps/daycare_2.asm" +INCLUDE "text/maps/daycare.asm" INCLUDE "text/maps/underground_path_route_6_entrance.asm" INCLUDE "text/maps/underground_path_route_7_entrance.asm" INCLUDE "text/maps/underground_path_route_7_entrance_unused.asm" @@ -1961,6 +2126,7 @@ INCLUDE "text/maps/route_16_gate_upstairs.asm" INCLUDE "text/maps/route_16_house.asm" INCLUDE "text/maps/route_18_gate.asm" INCLUDE "text/maps/route_18_gate_upstairs.asm" +INCLUDE "text/maps/beach_house.asm" INCLUDE "text/maps/pokemon_league_gate.asm" INCLUDE "text/maps/victory_road_2f.asm" INCLUDE "text/maps/bills_house.asm" @@ -1972,14 +2138,14 @@ INCLUDE "text/maps/route_5.asm" INCLUDE "text/maps/route_6.asm" INCLUDE "text/maps/route_7.asm" INCLUDE "text/maps/route_8.asm" -INCLUDE "text/maps/route_9.asm" -INCLUDE "text/maps/route_10.asm" -INCLUDE "text/maps/route_11_1.asm" +INCLUDE "text/maps/route_9_1.asm" -SECTION "Text 5", ROMX, BANK[TEXT_5] +SECTION "Text 4", ROMX, BANK[TEXT_4] -INCLUDE "text/maps/route_11_2.asm" +INCLUDE "text/maps/route_9_2.asm" +INCLUDE "text/maps/route_10.asm" +INCLUDE "text/maps/route_11.asm" INCLUDE "text/maps/route_12.asm" INCLUDE "text/maps/route_13.asm" INCLUDE "text/maps/route_14.asm" @@ -1992,12 +2158,7 @@ INCLUDE "text/maps/route_20.asm" INCLUDE "text/maps/route_21.asm" INCLUDE "text/maps/route_22.asm" INCLUDE "text/maps/route_23.asm" -INCLUDE "text/maps/route_24_1.asm" - - -SECTION "Text 6", ROMX, BANK[TEXT_6] - -INCLUDE "text/maps/route_24_2.asm" +INCLUDE "text/maps/route_24.asm" INCLUDE "text/maps/route_25.asm" _FileDataDestroyedText:: @@ -2010,8 +2171,12 @@ _WouldYouLikeToSaveText:: line "SAVE the game?" done +_SavingText:: + text "Saving..." + done + _GameSavedText:: - text $52, " saved" + text "<PLAYER> saved" line "the game!" done @@ -2031,7 +2196,7 @@ _WhenYouChangeBoxText:: _ChooseABoxText:: text "Choose a" - line $4a, " BOX.@@" + line "<pkmn> BOX.@@" _EvolvedText:: TX_RAM wcf4b @@ -2039,7 +2204,7 @@ _EvolvedText:: done _IntoText:: - db $0 + text "" line "into @" TX_RAM wcd6d text "!" @@ -2048,54 +2213,57 @@ _IntoText:: _StoppedEvolvingText:: text "Huh? @" TX_RAM wcf4b - db $0 + text "" line "stopped evolving!" prompt + +SECTION "Text 5", ROMX, BANK[TEXT_5] + _IsEvolvingText:: text "What? @" TX_RAM wcf4b - db $0 + text "" line "is evolving!" done _FellAsleepText:: - text $59 + text "<TARGET>" line "fell asleep!" prompt _AlreadyAsleepText:: - text $59, "'s" + text "<TARGET>'s" line "already asleep!" prompt _PoisonedText:: - text $59 + text "<TARGET>" line "was poisoned!" prompt _BadlyPoisonedText:: - text $59, "'s" + text "<TARGET>'s" line "badly poisoned!" prompt _BurnedText:: - text $59 + text "<TARGET>" line "was burned!" prompt _FrozenText:: - text $59 + text "<TARGET>" line "was frozen solid!" prompt _FireDefrostedText:: text "Fire defrosted" - line $59, "!" + line "<TARGET>!" prompt _MonsStatsRoseText:: - text $5a, "'s" + text "<USER>'s" line "@" TX_RAM wcf4b text "@@" @@ -2108,7 +2276,7 @@ _RoseText:: prompt _MonsStatsFellText:: - text $59, "'s" + text "<TARGET>'s" line "@" TX_RAM wcf4b text "@@" @@ -2121,60 +2289,60 @@ _FellText:: prompt _RanFromBattleText:: - text $5a + text "<USER>" line "ran from battle!" prompt _RanAwayScaredText:: - text $59 + text "<TARGET>" line "ran away scared!" prompt _WasBlownAwayText:: - text $59 + text "<TARGET>" line "was blown away!" prompt _ChargeMoveEffectText:: - text $5a, "@@" + text "<USER>@@" _MadeWhirlwindText:: - db $0 + text "" line "made a whirlwind!" prompt _TookInSunlightText:: - db $0 + text "" line "took in sunlight!" prompt _LoweredItsHeadText:: - db $0 + text "" line "lowered its head!" prompt _SkyAttackGlowingText:: - db $0 + text "" line "is glowing!" prompt _FlewUpHighText:: - db $0 + text "" line "flew up high!" prompt _DugAHoleText:: - db $0 + text "" line "dug a hole!" prompt _BecameConfusedText:: - text $59 + text "<TARGET>" line "became confused!" prompt _MimicLearnedMoveText:: - text $5a + text "<USER>" line "learned" cont "@" TX_RAM wcd6d @@ -2182,7 +2350,7 @@ _MimicLearnedMoveText:: prompt _MoveWasDisabledText:: - text $59, "'s" + text "<TARGET>'s" line "@" TX_RAM wcd6d text " was" @@ -2203,16 +2371,16 @@ _ButItFailedText:: _DidntAffectText:: text "It didn't affect" - line $59, "!" + line "<TARGET>!" prompt _IsUnaffectedText:: - text $59 + text "<TARGET>" line "is unaffected!" prompt _ParalyzedMayNotAttackText:: - text $59, "'s" + text "<TARGET>'s" line "paralyzed! It may" cont "not attack!" prompt @@ -2223,7 +2391,7 @@ _SubstituteText:: prompt _HasSubstituteText:: - text $5a + text "<USER>" line "has a SUBSTITUTE!" prompt @@ -2232,34 +2400,24 @@ _TooWeakSubstituteText:: line "a SUBSTITUTE!" prompt -_CoinsScatteredText:: - text "Coins scattered" - line "everywhere!" - prompt - -_GettingPumpedText:: - text $5a, "'s" - line "getting pumped!" - prompt - _WasSeededText:: - text $59 + text "<TARGET>" line "was seeded!" prompt _EvadedAttackText:: - text $59 + text "<TARGET>" line "evaded attack!" prompt _HitWithRecoilText:: - text $5a, "'s" + text "<USER>'s" line "hit with recoil!" prompt _ConvertedTypeText:: text "Converted type to" - line $59, "'s!" + line "<TARGET>'s!" prompt _StatusChangesEliminatedText:: @@ -2267,24 +2425,29 @@ _StatusChangesEliminatedText:: line "are eliminated!" prompt +_GettingPumpedText:: + text "<USER>'s" + line "getting pumped!" + prompt + _StartedSleepingEffect:: - text $5a + text "<USER>" line "started sleeping!" done _FellAsleepBecameHealthyText:: - text $5a + text "<USER>" line "fell asleep and" cont "became healthy!" done _RegainedHealthText:: - text $5a + text "<USER>" line "regained health!" prompt _TransformedText:: - text $5a + text "<USER>" line "transformed into" cont "@" TX_RAM wcd6d @@ -2292,28 +2455,33 @@ _TransformedText:: prompt _LightScreenProtectedText:: - text $5a, "'s" + text "<USER>'s" line "protected against" cont "special attacks!" prompt _ReflectGainedArmorText:: - text $5a + text "<USER>" line "gained armor!" prompt _ShroudedInMistText:: - text $5a, "'s" + text "<USER>'s" line "shrouded in mist!" prompt +_CoinsScatteredText:: + text "Coins scattered" + line "everywhere!" + prompt + _SuckedHealthText:: text "Sucked health from" - line $59, "!" + line "<TARGET>!" prompt _DreamWasEatenText:: - text $59, "'s" + text "<TARGET>'s" line "dream was eaten!" prompt @@ -2328,6 +2496,7 @@ _ColosseumText1:: INCLUDE "text/maps/reds_house_1f.asm" INCLUDE "text/maps/blues_house.asm" INCLUDE "text/maps/oaks_lab.asm" +INCLUDE "text/pokedex_ratings.asm" INCLUDE "text/maps/viridian_pokecenter.asm" INCLUDE "text/maps/viridian_mart.asm" INCLUDE "text/maps/school.asm" @@ -2335,12 +2504,7 @@ INCLUDE "text/maps/viridian_house.asm" INCLUDE "text/maps/viridian_gym.asm" INCLUDE "text/maps/museum_1f.asm" INCLUDE "text/maps/museum_2f.asm" -INCLUDE "text/maps/pewter_gym_1.asm" - - -SECTION "Text 7", ROMX, BANK[TEXT_7] - -INCLUDE "text/maps/pewter_gym_2.asm" +INCLUDE "text/maps/pewter_gym.asm" INCLUDE "text/maps/pewter_house_1.asm" INCLUDE "text/maps/pewter_mart.asm" INCLUDE "text/maps/pewter_house_2.asm" @@ -2351,7 +2515,12 @@ INCLUDE "text/maps/cerulean_pokecenter.asm" INCLUDE "text/maps/cerulean_gym.asm" INCLUDE "text/maps/bike_shop.asm" INCLUDE "text/maps/cerulean_mart.asm" -INCLUDE "text/maps/cerulean_badge_house.asm" +INCLUDE "text/maps/cerulean_badge_house_1.asm" + + +SECTION "Text 6", ROMX, BANK[TEXT_6] + +INCLUDE "text/maps/cerulean_badge_house_2.asm" INCLUDE "text/maps/lavender_pokecenter.asm" INCLUDE "text/maps/pokemon_tower_1f.asm" INCLUDE "text/maps/pokemon_tower_2f.asm" @@ -2367,14 +2536,21 @@ INCLUDE "text/maps/name_rater.asm" INCLUDE "text/maps/vermilion_pokecenter.asm" INCLUDE "text/maps/fan_club.asm" INCLUDE "text/maps/vermilion_mart.asm" -INCLUDE "text/maps/vermilion_gym_1.asm" +INCLUDE "text/maps/vermilion_gym.asm" +INCLUDE "text/maps/vermilion_house.asm" +INCLUDE "text/maps/vermilion_dock.asm" +TeachingHMsText:: + text "Once a #MON" + line "learns an HM, the" + cont "technique can't" + cont "be replaced." -SECTION "Text 8", ROMX, BANK[TEXT_8] + para "Better think care-" + line "fully before you" + cont "teach HM moves." + done -INCLUDE "text/maps/vermilion_gym_2.asm" -INCLUDE "text/maps/vermilion_house.asm" -INCLUDE "text/maps/vermilion_dock.asm" INCLUDE "text/maps/vermilion_fishing_house.asm" INCLUDE "text/maps/celadon_dept_store_1f.asm" INCLUDE "text/maps/celadon_dept_store_2f.asm" @@ -2388,7 +2564,12 @@ INCLUDE "text/maps/celadon_mansion_4f_outside.asm" INCLUDE "text/maps/celadon_mansion_4f_inside.asm" INCLUDE "text/maps/celadon_pokecenter.asm" INCLUDE "text/maps/celadon_gym.asm" -INCLUDE "text/maps/celadon_game_corner.asm" +INCLUDE "text/maps/celadon_game_corner_1.asm" + + +SECTION "Text 7", ROMX, BANK[TEXT_7] + +INCLUDE "text/maps/celadon_game_corner_2.asm" INCLUDE "text/maps/celadon_dept_store_5f.asm" INCLUDE "text/maps/celadon_prize_room.asm" INCLUDE "text/maps/celadon_diner.asm" @@ -2399,12 +2580,7 @@ INCLUDE "text/maps/fuchsia_house.asm" INCLUDE "text/maps/fuchsia_pokecenter.asm" INCLUDE "text/maps/wardens_house.asm" INCLUDE "text/maps/safari_zone_entrance.asm" -INCLUDE "text/maps/fuchsia_gym_1.asm" - - -SECTION "Text 9", ROMX, BANK[TEXT_9] - -INCLUDE "text/maps/fuchsia_gym_2.asm" +INCLUDE "text/maps/fuchsia_gym.asm" INCLUDE "text/maps/fuchsia_meeting_room.asm" INCLUDE "text/maps/fuchsia_fishing_house.asm" INCLUDE "text/maps/mansion_1f.asm" @@ -2426,6 +2602,10 @@ INCLUDE "text/maps/silph_co_1f.asm" INCLUDE "text/maps/saffron_pokecenter.asm" INCLUDE "text/maps/mr_psychics_house.asm" +_PokemonText:: + text "#MON!" + done + _PokemartGreetingText:: text "Hi there!" next "May I help you?" @@ -2433,15 +2613,15 @@ _PokemartGreetingText:: _PokemonFaintedText:: TX_RAM wcd6d - db $0 + text "" line "fainted!" done _PlayerBlackedOutText:: - text $52, " is out of" + text "<PLAYER> is out of" line "useable #MON!" - para $52, " blacked" + para "<PLAYER> blacked" line "out!" prompt @@ -2459,7 +2639,7 @@ _PokemartTellBuyPriceText:: text "?" line "That will be" cont "¥@" - TX_BCD hMoney, $c3 + TX_BCD hMoney, 3 | LEADING_ZEROES | LEFT_ALIGN text ". OK?" done @@ -2486,7 +2666,7 @@ _PokemonSellingGreetingText:: _PokemartTellSellPriceText:: text "I can pay you" line "¥@" - TX_BCD hMoney, $c3 + TX_BCD hMoney, 3 | LEADING_ZEROES | LEFT_ALIGN text " for that." done @@ -2530,7 +2710,7 @@ _AbandonLearningText:: _DidNotLearnText:: TX_RAM wLearnMoveMonName - db $0 + text "" line "did not learn" cont "@" TX_RAM wcf4b @@ -2547,7 +2727,7 @@ _TryingToLearnText:: para "But, @" TX_RAM wLearnMoveMonName - db $0 + text "" line "can't learn more" cont "than 4 moves!" @@ -2565,7 +2745,7 @@ _PoofText:: text " Poof!@@" _ForgotAndText:: - db $0 + text "" para "@" TX_RAM wLearnMoveMonName text " forgot" @@ -2611,6 +2791,11 @@ _PokemonCenterFarewellText:: line "you again!" done +_LooksContentText:: + text "It looks very" + line "content asleep." + done + _CableClubNPCAreaReservedFor2FriendsLinkedByCableText:: text "This area is" line "reserved for 2" @@ -2631,6 +2816,9 @@ _CableClubNPCPleaseApplyHereHaveToSaveText:: cont "to save the game." done + +SECTION "Text 8", ROMX, BANK[TEXT_8] + _CableClubNPCPleaseWaitText:: text "Please wait.@@" @@ -2644,9 +2832,6 @@ _CableClubNPCLinkClosedBecauseOfInactivityText:: cont "come again!" done - -SECTION "Text 10", ROMX, BANK[TEXT_10] - _CableClubNPCPleaseComeAgainText:: text "Please come again!" done @@ -2657,27 +2842,6 @@ _CableClubNPCMakingPreparationsText:: cont "Please wait." done -_UsedStrengthText:: - TX_RAM wcd6d - text " used" - line "STRENGTH.@@" - -_CanMoveBouldersText:: - TX_RAM wcd6d - text " can" - line "move boulders." - prompt - -_CurrentTooFastText:: - text "The current is" - line "much too fast!" - prompt - -_CyclingIsFunText:: - text "Cycling is fun!" - line "Forget SURFing!" - prompt - _FlashLightsAreaText:: text "A blinding FLASH" line "lights the area!" @@ -2720,8 +2884,29 @@ _CannotGetOffHereText:: line "here." prompt +_UsedStrengthText:: + TX_RAM wcd6d + text " used" + line "STRENGTH.@@" + +_CanMoveBouldersText:: + TX_RAM wcd6d + text " can" + line "move boulders." + prompt + +_CurrentTooFastText:: + text "The current is" + line "much too fast!" + prompt + +_CyclingIsFunText:: + text "Cycling is fun!" + line "Forget SURFing!" + prompt + _GotMonText:: - text $52, " got" + text "<PLAYER> got" line "@" TX_RAM wcd6d text "!@@" @@ -2818,7 +3003,7 @@ _ItemUseBallText06:: text "!@@" _SurfingGotOnText:: - text $52, " got on" + text "<PLAYER> got on" line "@" TX_RAM wcd6d text "!" @@ -2829,6 +3014,12 @@ _SurfingNoPlaceToGetOffText:: line "to get off!" prompt +_RefusingText:: + TX_RAM wcd6d + text "" + line "is refusing!" + prompt + _VitaminStatRoseText:: TX_RAM wcd6d text "'s" @@ -2843,12 +3034,12 @@ _VitaminNoEffectText:: prompt _ThrewBaitText:: - text $52, " threw" + text "<PLAYER> threw" line "some BAIT." done _ThrewRockText:: - text $52, " threw a" + text "<PLAYER> threw a" line "ROCK." done @@ -2866,13 +3057,13 @@ _FluteWokeUpText:: prompt _PlayedFluteHadEffectText:: - text $52, " played the" + text "<PLAYER> played the" line "# FLUTE.@@" _CoinCaseNumCoinsText:: text "Coins" line "@" - TX_BCD wPlayerCoins, $c2 + TX_BCD wPlayerCoins, 2 | LEADING_ZEROES | LEFT_ALIGN text " " prompt @@ -2929,7 +3120,7 @@ _TeachMachineMoveText:: para "Teach @" TX_RAM wcf4b - db $0 + text "" line "to a #MON?" done @@ -2948,7 +3139,7 @@ _MonCannotLearnMachineMoveText:: prompt _ItemUseNotTimeText:: - text "OAK: ", $52, "!" + text "OAK: <PLAYER>!" line "This isn't the" cont "time to use that! " prompt @@ -2990,11 +3181,13 @@ _BoxFullCannotThrowBallText:: cont "use that item!" prompt - -SECTION "Text 11", ROMX, BANK[TEXT_11] +_DontHavePokemonText:: + text "You don't have a " + line "#MON!" + prompt _ItemUseText001:: - text $52," used@@" + text "<PLAYER> used@@" _ItemUseText002:: TX_RAM wcf4b @@ -3002,7 +3195,7 @@ _ItemUseText002:: done _GotOnBicycleText1:: - text $52, " got on the@@" + text "<PLAYER> got on the@@" _GotOnBicycleText2:: TX_RAM wcf4b @@ -3010,7 +3203,7 @@ _GotOnBicycleText2:: prompt _GotOffBicycleText1:: - text $52, " got off@@" + text "<PLAYER> got off@@" _GotOffBicycleText2:: text "the @" @@ -3051,7 +3244,7 @@ _ConnectCableText:: prompt _TradedForText:: - text $52, " traded" + text "<PLAYER> traded" line "@" TX_RAM wInGameTradeGiveMonName text " for" @@ -3103,7 +3296,7 @@ _WannaTrade2Text:: para "your @" TX_RAM wInGameTradeGiveMonName - db $0 + text "" line "for @" TX_RAM wInGameTradeReceiveMonName text "?" @@ -3129,12 +3322,11 @@ _Thanks2Text:: done _AfterTrade2Text:: - text "The @" + text "Hello there! Your" + line "old @" TX_RAM wInGameTradeGiveMonName - text " you" - line "traded to me" - - para "went and evolved!" + text " is" + cont "magnificent!" done _WannaTrade3Text:: @@ -3164,7 +3356,7 @@ _WrongMon3Text:: done _Thanks3Text:: - text "Thanks pal!" + text "Thanks, pal!" done _AfterTrade3Text:: diff --git a/text/credits_text.asm b/text/credits_text.asm index a68c33d3..0010b93a 100755 --- a/text/credits_text.asm +++ b/text/credits_text.asm @@ -1,199 +1,264 @@ CreditsTextPointers: - dw CredVersion - dw CredTajiri - dw CredTaOota - dw CredMorimoto - dw CredWatanabe - dw CredMasuda - dw CredNisino - dw CredSugimori - dw CredNishida - dw CredMiyamoto - dw CredKawaguchi - dw CredIshihara - dw CredYamauchi - dw CredZinnai - dw CredHishida - dw CredSakai - dw CredYamaguchi - dw CredYamamoto - dw CredTaniguchi - dw CredNonomura - dw CredFuziwara - dw CredMatsusima - dw CredTomisawa - dw CredKawamoto - dw CredKakei - dw CredTsuchiya - dw CredTaNakamura - dw CredYuda - dw CredMon - dw CredDirector - dw CredProgrammers - dw CredCharDesign - dw CredMusic - dw CredSoundEffects - dw CredGameDesign - dw CredMonsterDesign - dw CredGameScene - dw CredParam - dw CredMap - dw CredTest - dw CredSpecial - dw CredProducers - dw CredProducer - dw CredExecutive - dw CredTamada - dw CredSaOota - dw CredYoshikawa - dw CredToOota - dw CredUSStaff - dw CredUSCoord - dw CredTilden - dw CredKawakami - dw CredHiNakamura - dw CredGiese - dw CredOsborne - dw CredTrans - dw CredOgasawara - dw CredIwata - dw CredIzushi - dw CredHarada - dw CredMurakawa - dw CredFukui - dw CredClub - dw CredPAAD + dw CreditsText_Version + dw CreditsText_Tajiri + dw CreditsText_Oota + dw CreditsText_Morimoto + dw CreditsText_Watanabe + dw CreditsText_Masuda + dw CreditsText_Nishino + dw CreditsText_Sugimori + dw CreditsText_Nishida + dw CreditsText_Miyamoto + dw CreditsText_Kawaguchi + dw CreditsText_Ishihara + dw CreditsText_Yamauchi + dw CreditsText_Zinnai + dw CreditsText_Hishida + dw CreditsText_Sakai + dw CreditsText_Yamaguchi + dw CreditsText_Yamamoto + dw CreditsText_Taniguchi + dw CreditsText_Nonomura + dw CreditsText_Fuziwara + dw CreditsText_Matsusima + dw CreditsText_Tomisawa + dw CreditsText_Kawamoto + dw CreditsText_Kakei + dw CreditsText_Tsuchiya + dw CreditsText_Nakamura + dw CreditsText_Yuda + dw CreditsText_Pokemon + dw CreditsText_Director + dw CreditsText_Programmers + dw CreditsText_CharacterDesign + dw CreditsText_Music + dw CreditsText_SoundEffects + dw CreditsText_GameDesign + dw CreditsText_MonsterDesign + dw CreditsText_GameScenario + dw CreditsText_ParametricDesign + dw CreditsText_MapDesign + dw CreditsText_Testing + dw CreditsText_SpecialThanks + dw CreditsText_Producer + dw CreditsText_ExecutiveProducer + dw CreditsText_Tamada + dw CreditsText_Oota2 + dw CreditsText_Yoshikawa + dw CreditsText_Oota23 + dw CreditsText_Yoshida + dw CreditsText_Matsumita + dw CreditsText_Seya + dw CreditsText_Sekine + dw CreditsText_Shimamura + dw CreditsText_Shimoyamada + dw CreditsText_SuperMarioClub + dw CreditsText_Izushi + dw CreditsText_Nomura + dw CreditsText_Harada + dw CreditsText_Yamagami + dw CreditsText_Nishimura + dw CreditsText_Saeki + dw CreditsText_Fuzii + dw CreditsText_Shogakukan + dw CreditsText_Ootani + dw CreditsText_PikachuVoice + dw CreditsText_USStaff + dw CreditsText_USCoord + dw CreditsText_Tilden + dw CreditsText_Kawakami + dw CreditsText_Nakamura2 + dw CreditsText_Shoemake + dw CreditsText_Osborne + dw CreditsText_Translation + dw CreditsText_Ogasawara + dw CreditsText_Iwata + dw CreditsText_Izushi2 + dw CreditsText_Harada2 + dw CreditsText_Murakawa + dw CreditsText_Fukui + dw CreditsText_SuperMarioClub2 + dw CreditsText_Paad + dw CreditsText_Producers + dw CreditsText_Hosokawa + dw CreditsText_Okubo + dw CreditsText_Nakamichi + dw CreditsText_Yoshimura + dw CreditsText_Yamazaki -CredVersion: ; this 1 byte difference makes all bank addresses offset by 1 in the blue version -IF DEF(_RED) - db -8, "RED VERSION STAFF@" -ENDC -IF DEF(_BLUE) - db -8, "BLUE VERSION STAFF@" -ENDC -CredTajiri: +CreditsText_Version: + db -6, "YELLOW VERSION" + next " STAFF@" +CreditsText_Tajiri: db -6, "SATOSHI TAJIRI@" -CredTaOota: +CreditsText_Oota: db -6, "TAKENORI OOTA@" -CredMorimoto: +CreditsText_Morimoto: db -7, "SHIGEKI MORIMOTO@" -CredWatanabe: +CreditsText_Watanabe: db -7, "TETSUYA WATANABE@" -CredMasuda: +CreditsText_Masuda: db -6, "JUNICHI MASUDA@" -CredNisino: - db -5, "KOHJI NISINO@" -CredSugimori: +CreditsText_Nishino: + db -5, "KOHJI NISHINO@" +CreditsText_Sugimori: db -5, "KEN SUGIMORI@" -CredNishida: +CreditsText_Nishida: db -6, "ATSUKO NISHIDA@" -CredMiyamoto: +CreditsText_Miyamoto: db -7, "SHIGERU MIYAMOTO@" -CredKawaguchi: +CreditsText_Kawaguchi: db -8, "TAKASHI KAWAGUCHI@" -CredIshihara: +CreditsText_Ishihara: db -8, "TSUNEKAZU ISHIHARA@" -CredYamauchi: +CreditsText_Yamauchi: db -7, "HIROSHI YAMAUCHI@" -CredZinnai: +CreditsText_Zinnai: db -7, "HIROYUKI ZINNAI@" -CredHishida: +CreditsText_Hishida: db -7, "TATSUYA HISHIDA@" -CredSakai: +CreditsText_Sakai: db -6, "YASUHIRO SAKAI@" -CredYamaguchi: +CreditsText_Yamaguchi: db -7, "WATARU YAMAGUCHI@" -CredYamamoto: +CreditsText_Yamamoto: db -8, "KAZUYUKI YAMAMOTO@" -CredTaniguchi: +CreditsText_Taniguchi: db -8, "RYOHSUKE TANIGUCHI@" -CredNonomura: +CreditsText_Nonomura: db -8, "FUMIHIRO NONOMURA@" -CredFuziwara: +CreditsText_Fuziwara: db -7, "MOTOFUMI FUZIWARA@" -CredMatsusima: +CreditsText_Matsusima: db -7, "KENJI MATSUSIMA@" -CredTomisawa: +CreditsText_Tomisawa: db -7, "AKIHITO TOMISAWA@" -CredKawamoto: +CreditsText_Kawamoto: db -7, "HIROSHI KAWAMOTO@" -CredKakei: +CreditsText_Kakei: db -6, "AKIYOSHI KAKEI@" -CredTsuchiya: +CreditsText_Tsuchiya: db -7, "KAZUKI TSUCHIYA@" -CredTaNakamura: +CreditsText_Nakamura: db -6, "TAKEO NAKAMURA@" -CredYuda: +CreditsText_Yuda: db -6, "MASAMITSU YUDA@" -CredMon: +CreditsText_Pokemon: db -3, "#MON@" -CredDirector: +CreditsText_Director: db -3, "DIRECTOR@" -CredProgrammers: +CreditsText_Programmers: db -5, "PROGRAMMERS@" -CredCharDesign: +CreditsText_CharacterDesign: db -7, "CHARACTER DESIGN@" -CredMusic: +CreditsText_Music: db -2, "MUSIC@" -CredSoundEffects: +CreditsText_SoundEffects: db -6, "SOUND EFFECTS@" -CredGameDesign: +CreditsText_GameDesign: db -5, "GAME DESIGN@" -CredMonsterDesign: +CreditsText_MonsterDesign: db -6, "MONSTER DESIGN@" -CredGameScene: +CreditsText_GameScenario: db -6, "GAME SCENARIO@" -CredParam: - db -8, "PARAMETRIC DESIGN@" -CredMap: +CreditsText_ParametricDesign: + db -7, "PARAMETRIC DESIGN@" +CreditsText_MapDesign: db -4, "MAP DESIGN@" -CredTest: - db -7, "PRODUCT TESTING@" -CredSpecial: +CreditsText_Testing: + db -6, "PRODUCT TESTING@" +CreditsText_SpecialThanks: db -6, "SPECIAL THANKS@" -CredProducers: +CreditsText_Producers: db -4, "PRODUCERS@" -CredProducer: - db -4, "PRODUCER@" -CredExecutive: +CreditsText_Producer: + db -3, "PRODUCER@" +CreditsText_ExecutiveProducer: db -8, "EXECUTIVE PRODUCER@" -CredTamada: +CreditsText_Tamada: db -6, "SOUSUKE TAMADA@" -CredSaOota: +CreditsText_Oota2: db -5, "SATOSHI OOTA@" -CredYoshikawa: +CreditsText_Yoshikawa: db -6, "RENA YOSHIKAWA@" -CredToOota: +CreditsText_Oota23: db -6, "TOMOMICHI OOTA@" -CredUSStaff: +CreditsText_Matsumita: + db -8, "TOSHINOBU MATSUMIYA@" +CreditsText_Seya: + db -5, "NOBUHIRO SEYA@" +CreditsText_Yoshida: + db -7, "HIRONOBU YOSHIDA@" +CreditsText_Sekine: + db -6, "KAZUHITO SEKINE@" +CreditsText_Shimamura: + db -7, "KAZUSHI SHIMAMURA@" +CreditsText_Shimoyamada: + db -9, "TERUYUKI SHIMOYAMADA@" +CreditsText_SuperMarioClub: + db -9, "NCL SUPER MARIO CLUB@" +CreditsText_Izushi: + db -7, "TAKEHIRO IZUSHI@" +CreditsText_Nomura: + db -5, "FUZIKO NOMURA@" +CreditsText_Harada: + db -6, "TAKAHIRO HARADA@" +CreditsText_Yamagami: + db -7, "HITOSHI YAMAGAMI@" +CreditsText_Nishimura: + db -8, "KENTAROU NISHIMURA@" +CreditsText_Saeki: + db -5, "NAOKO SAEKI@" +CreditsText_Fuzii: + db -5, "TAKAYA FUZII@" +CreditsText_Shogakukan: + db -4, "SHOGAKUKAN" + next "PRODUCTION@" +CreditsText_Ootani: + db -5, "IKUE OOTANI@" +CreditsText_PikachuVoice: + db -6, "PIKACHU VOICE@" + + db -3, "××××××××@" +CreditsText_USStaff: db -7, "US VERSION STAFF@" -CredUSCoord: +CreditsText_USCoord: db -7, "US COORDINATION@" -CredTilden: +CreditsText_Tilden: db -5, "GAIL TILDEN@" -CredKawakami: +CreditsText_Kawakami: db -6, "NAOKO KAWAKAMI@" -CredHiNakamura: +CreditsText_Nakamura2: db -6, "HIRO NAKAMURA@" -CredGiese: - db -6, "WILLIAM GIESE@" -CredOsborne: +CreditsText_Shoemake: + db -6, "RANDY SHOEMAKE@" +CreditsText_Osborne: db -5, "SARA OSBORNE@" -CredTrans: +CreditsText_Translation: db -7, "TEXT TRANSLATION@" -CredOgasawara: +CreditsText_Ogasawara: db -6, "NOB OGASAWARA@" -CredIwata: +CreditsText_Iwata: db -5, "SATORU IWATA@" -CredIzushi: +CreditsText_Izushi2: db -7, "TAKEHIRO IZUSHI@" -CredHarada: +CreditsText_Harada2: db -7, "TAKAHIRO HARADA@" -CredMurakawa: +CreditsText_Murakawa: db -7, "TERUKI MURAKAWA@" -CredFukui: +CreditsText_Fukui: db -5, "KOHTA FUKUI@" -CredClub: +CreditsText_SuperMarioClub2: db -9, "NCL SUPER MARIO CLUB@" -CredPAAD: +CreditsText_Paad: db -5, "PAAD TESTING@" +CreditsText_Hosokawa: + db -8, "TAKEHIKO HOSOKAWA@" +CreditsText_Okubo: + db -5, "KENJI OKUBO@" +CreditsText_Nakamichi: + db -7, "KIMIKO NAKAMICHI@" +CreditsText_Yoshimura: + db -6, "KAMON YOSHIMURA@" +CreditsText_Yamazaki: + db -6, "SAKAE YAMAZAKI@" diff --git a/text/map_names.asm b/text/map_names.asm index cd9f6640..c2642942 100755 --- a/text/map_names.asm +++ b/text/map_names.asm @@ -98,7 +98,7 @@ RocketHQName: SilphCoName: db "SILPH CO.@" PokemonMansionName: - db $4a," MANSION@" + db "<pkmn> MANSION@" SafariZoneName: db "SAFARI ZONE@" CeruleanCaveName: diff --git a/text/maps/agatha.asm b/text/maps/agatha.asm index 4957f4d4..45a4692d 100644 --- a/text/maps/agatha.asm +++ b/text/maps/agatha.asm @@ -23,7 +23,7 @@ _AgathaBeforeBattleText:: done _AgathaEndBattleText:: - text "Oh ho!" + text "Woo-hoo!" line "You're something" cont "special, child!" prompt diff --git a/text/maps/beach_house.asm b/text/maps/beach_house.asm new file mode 100644 index 00000000..bc50b837 --- /dev/null +++ b/text/maps/beach_house.asm @@ -0,0 +1,103 @@ +_SurfinDudeText1:: + text "Whoa!" + + para "Your PIKACHU knows" + line "how to SURF! So," + cont "I'm not alone..." + + para "Great! You earned" + line "the right to SURF" + cont "with the DUDE!" + + para "Give it a go?" + done + +_SurfinDudeText2:: + text "Come SURF anytime," + line "my friend!" + done + +_SurfinDudeText3:: + text "Wanna go SURF?" + done + +_SurfinDudeText4:: + text "Dogs and burgers" + line "on special today!" + done + +_BeachHousePikachuText:: + text "PIKACHU: Pikaa" + done + +_BeachHouseSign1Text1:: + text "SURFIN' DUDE's" + line "scribbles..." + + para "When I shoot the" + line "tube, the tunes" + cont "hit the groove!" + done + +_BeachHouseSign1Text2:: + text "30 years of waves!" + line "SURFIN' DUDE" + done + +_BeachHouseSign2Text1:: + text "SURFING TIP 1!" + + para "After flips, line" + line "the board up with" + cont "a wave for a cool" + cont "effect!" + done + +_BeachHouseSign2Text2:: + text "SUMMER BEACH HOUSE" + line "#MON welcome!" + done + +_BeachHouseSign3Text1:: + text "SURFING TIP 2!" + + para "Pulling flips in" + line "a jump is totally" + cont "rad!" + done + +_BeachHouseSign3Text2:: + text "The sea unites" + line "all in surfdom!" + done + +_BeachHousePrinterText1:: + text "It's some sort of" + line "a machine...@@" + +_BeachHousePrinterText2:: + text "SUMMER BEACH HOUSE" + line "PRINTER, it says.@@" + +_BeachHousePrinterText3:: + text "The Hi-Score is" + line "shown." + + para "PRINT it out?" + done + +_BeachHousePrinterText4:: + text "SUMMER BEACH HOUSE" + line "PRINTER, it says." + + para "The Hi-Score is" + line "shown." + + para "PRINT it out?" + done + +_BeachHousePrinterText5:: + text "PRINT completed.@@" + +_BeachHousePrinterText6:: + text "PRINT error!@@" diff --git a/text/maps/bike_shop.asm b/text/maps/bike_shop.asm index 33f53ee9..1717c552 100644 --- a/text/maps/bike_shop.asm +++ b/text/maps/bike_shop.asm @@ -25,13 +25,13 @@ _BikeShopText_1d81f:: prompt _BikeShopText_1d824:: - text $52, " exchanged" + text "<PLAYER> exchanged" line "the BIKE VOUCHER" cont "for a BICYCLE.@@" _BikeShopComeAgainText:: text "Come back again" - line "some time!" + line "sometime!" done _BikeShopText_1d82f:: diff --git a/text/maps/bills_house.asm b/text/maps/bills_house.asm index 463b13e6..dd556a7b 100644 --- a/text/maps/bills_house.asm +++ b/text/maps/bills_house.asm @@ -1,3 +1,8 @@ +_BillsHouseDontLeaveText:: + text "Whoa, don't go" + line "anywhere, wait!" + done + _BillsHouseText_1e865:: text "Hiya! I'm a" line "#MON..." diff --git a/text/maps/blues_house.asm b/text/maps/blues_house.asm index b676ea69..c7db0b2c 100644 --- a/text/maps/blues_house.asm +++ b/text/maps/blues_house.asm @@ -29,10 +29,10 @@ _DaisyUseMapText:: done _BluesHouseText2:: - text "#MON are living" - line "things! If they" - cont "get tired, give" - cont "them a rest!" + text "Spending time" + line "with your #MON" + cont "makes them more" + cont "friendly to you." done _BluesHouseText3:: diff --git a/text/maps/celadon_city.asm b/text/maps/celadon_city.asm index e2470ec1..908fcbb4 100644 --- a/text/maps/celadon_city.asm +++ b/text/maps/celadon_city.asm @@ -1,10 +1,10 @@ _CeladonCityText1:: text "I got my KOFFING" - line "in CINNABAR!" + line "from my friend!" - para "It's nice, but it" - line "breathes poison" - cont "when it's angry!" + para "We get along now," + line "because I was" + cont "very nice to it!" done _CeladonCityText2:: @@ -84,22 +84,6 @@ _CeladonCityText9:: line "ROCKET's way!" done -_CeladonCityText10:: - text "TRAINER TIPS" - - para "X ACCURACY boosts" - line "the accuracy of" - cont "techniques!" - - para "DIRE HIT jacks up" - line "the likelihood of" - cont "critical hits!" - - para "Get your items at" - line "CELADON DEPT." - cont "STORE!" - done - _CeladonCityText11:: text "CELADON CITY" line "The City of" @@ -111,7 +95,7 @@ _CeladonCityText13:: line "#MON GYM" cont "LEADER: ERIKA" - para "The Nature Loving" + para "The Nature-Loving" line "Princess!" done @@ -148,5 +132,21 @@ _CeladonCityText17:: _CeladonCityText18:: text "ROCKET GAME CORNER" line "The playground" - cont "for grown-ups!" + cont "for grownups!" + done + +_CeladonCityText10:: + text "TRAINER TIPS" + + para "X ACCURACY boosts" + line "the accuracy of" + cont "techniques!" + + para "DIRE HIT jacks up" + line "the likelihood of" + cont "critical hits!" + + para "Get your items at" + line "CELADON DEPT." + cont "STORE!" done diff --git a/text/maps/celadon_dept_store_3f.asm b/text/maps/celadon_dept_store_3f.asm index 1aad756f..4006a3bb 100644 --- a/text/maps/celadon_dept_store_3f.asm +++ b/text/maps/celadon_dept_store_3f.asm @@ -1,30 +1,3 @@ -_TM18PreReceiveText:: - text "Oh, hi! I finally" - line "finished #MON!" - - para "Not done yet?" - line "This might be" - cont "useful!" - prompt - -_ReceivedTM18Text:: - text $52, " received" - line "@" - TX_RAM wcf4b - text "!@@" - -_TM18ExplanationText:: - text "TM18 is COUNTER!" - line "Not like the one" - cont "I'm leaning on," - cont "mind you!" - done - -_TM18NoRoomText:: - text "Your pack is full" - line "of items!" - done - _CeladonMart3Text2:: text "Captured #MON" line "are registered" @@ -96,3 +69,30 @@ _CeladonMart3Text15:: text "Red and Blue!" line "Both are #MON!" done + +_TM18PreReceiveText:: + text "Oh, hi! I finally" + line "finished #MON!" + + para "Not done yet?" + line "This might be" + cont "useful!" + prompt + +_ReceivedTM18Text:: + text $52, " received" + line "@" + TX_RAM wcf4b + text "!@@" + +_TM18ExplanationText:: + text "TM18 is COUNTER!" + line "Not like the one" + cont "I'm leaning on," + cont "mind you!" + done + +_TM18NoRoomText:: + text "Your pack is full" + line "of items!" + done diff --git a/text/maps/celadon_dept_store_4f.asm b/text/maps/celadon_dept_store_4f.asm index 78fa0b66..c17483c1 100644 --- a/text/maps/celadon_dept_store_4f.asm +++ b/text/maps/celadon_dept_store_4f.asm @@ -1,7 +1,11 @@ _CeladonMart4Text2:: text "I'm getting a" - line "# DOLL for my" - cont "girl friend!" + line "gift for COPYCAT" + cont "in CERULEAN CITY." + + para "It's got to be a" + line "# DOLL. They" + cont "are trendy!" done _CeladonMart4Text3:: diff --git a/text/maps/celadon_dept_store_roof.asm b/text/maps/celadon_dept_store_roof.asm index 4689b023..319ca3f0 100644 --- a/text/maps/celadon_dept_store_roof.asm +++ b/text/maps/celadon_dept_store_roof.asm @@ -50,10 +50,7 @@ _CeladonMartRoofText_4850f:: para "@" TX_RAM wcf4b text " contains" - line "ROCK SLIDE!" - - para "It can spook the" - line "target sometimes!@@" + line "ROCK SLIDE!@@" _CeladonMartRoofText_48515:: text "Yay!" diff --git a/text/maps/celadon_game_corner.asm b/text/maps/celadon_game_corner_1.asm index 2d263e80..ad8a82b2 100644 --- a/text/maps/celadon_game_corner.asm +++ b/text/maps/celadon_game_corner_1.asm @@ -179,8 +179,3 @@ _CeladonGameCornerText_48f09:: para "A switch behind" line "the poster!?" cont "Let's push it!@@" - -_CeladonGameCornerText_48f19:: - text "Oops! Forgot the" - line "COIN CASE!" - done diff --git a/text/maps/celadon_game_corner_2.asm b/text/maps/celadon_game_corner_2.asm new file mode 100755 index 00000000..c288464d --- /dev/null +++ b/text/maps/celadon_game_corner_2.asm @@ -0,0 +1,4 @@ +_CeladonGameCornerText_48f19:: + text "Oops! Forgot the" + line "COIN CASE!" + done diff --git a/text/maps/celadon_mansion_1f.asm b/text/maps/celadon_mansion_1f.asm index fc175cd5..23123892 100644 --- a/text/maps/celadon_mansion_1f.asm +++ b/text/maps/celadon_mansion_1f.asm @@ -1,14 +1,6 @@ _CeladonMansion1Text1:: text "MEOWTH: Meow!@@" -_CeladonMansion1Text2:: - text "My dear #MON" - line "keep me company." - - para "MEOWTH even brings" - line "money home!" - done - _CeladonMansion1Text3:: text "CLEFAIRY: Pi" line "pippippi!@@" @@ -21,3 +13,52 @@ _CeladonMansion1Text5:: text "CELADON MANSION" line "Manager's Suite" done + +_CeladonMansion1Text2:: + text "My dear #MON" + line "keep me company." + + para "MEOWTH even brings" + line "money home!" + done + +_CeladonMansion1Text6:: + text "Oh, you have an" + line "adorable PIKACHU" + cont "with you.@@" + +_CeladonMansion1Text7:: + text "It seems like it" + line "hasn't been tamed" + cont "at all." + done + +_CeladonMansion1Text8:: + text "Why don't you" + line "take more care" + cont "with PIKACHU?" + done + +_CeladonMansion1Text9:: + text "You must be happy" + line "to have a #MON" + cont "that cute." + done + +_CeladonMansion1Text10:: + text "Your PIKACHU seems" + line "tamed." + done + +_CeladonMansion1Text11:: + text "Your PIKACHU looks" + line "happy with you." + done + +_CeladonMansion1Text12:: + text "You look like a" + line "fantastic duo." + + para "You're making me" + line "jealous!" + done diff --git a/text/maps/celadon_mansion_3f.asm b/text/maps/celadon_mansion_3f.asm index c8858281..baf86186 100644 --- a/text/maps/celadon_mansion_3f.asm +++ b/text/maps/celadon_mansion_3f.asm @@ -3,12 +3,48 @@ _ProgrammerText:: line "programmer!" done +_ProgrammerText2:: + text "Me? I'm the" + line "programmer!" + + para "What a surprise!" + line "I never expected" + cont "anyone to fill a" + cont "#DEX." + done + _GraphicArtistText:: text "I'm the graphic" line "artist!" cont "I drew you!" done +_GraphicArtistText2:: + text "I'm the graphic" + line "artist!" + + para "Wow, you finished" + line "your #DEX!" + cont "Want me to PRINT" + cont "out a DIPLOMA" + cont "as proof?" + done + +_GraphicArtistText3:: + text "Just tell me if" + line "you want to PRINT" + cont "out a DIPLOMA." + done + +_GraphicArtistText4:: + text "All done!" + done + +_GraphicArtistText5:: + text "OK, let's not" + line "PRINT." + done + _WriterText:: text "I wrote the story!" line "Isn't ERIKA cute?" @@ -20,6 +56,14 @@ _WriterText:: line "I like her!" done +_WriterText2:: + text "I wrote the story!" + + para "It's great you" + line "caught all the" + cont "#MON! Thanks!" + done + _GameDesignerText:: text "Is that right?" @@ -41,6 +85,13 @@ _CompletedDexText:: cont "Congratulations!" cont "...@@" +_CompletedDexText2:: + text "Go show off your" + line "DIPLOMA to" + cont "the development" + cont "crew." + done + _CeladonMansion3Text5:: text "It's the game" line "program! Messing" diff --git a/text/maps/cerulean_badge_house.asm b/text/maps/cerulean_badge_house_1.asm index 9d701443..4bba10cd 100644 --- a/text/maps/cerulean_badge_house.asm +++ b/text/maps/cerulean_badge_house_1.asm @@ -19,7 +19,7 @@ _CeruleanHouse2Text_74e7c:: done _CeruleanHouse2Text_74e81:: - text "Come visit me any" + text "Come visit me any-" line "time you wish." done @@ -29,7 +29,7 @@ _CeruleanHouse2Text_74e96:: cont "a little bit." para "It also lets you" - line "use FLASH any" + line "use FLASH any-" cont "time you desire." prompt @@ -66,32 +66,3 @@ _CeruleanHouse2Text_74ea5:: line "use STRENGTH out-" cont "side of battle." prompt - -_CeruleanHouse2Text_74eaa:: - text "The DEFENSE of all" - line "#MON increases" - cont "a little bit." - - para "It also lets you" - line "use SURF outside" - cont "of battle." - prompt - -_CeruleanHouse2Text_74eaf:: - text "#MON up to L70" - line "will obey you." - - para "Any higher, they" - line "become unruly!" - prompt - -_CeruleanHouse2Text_74eb4:: - text "Your #MON's" - line "SPECIAL abilities" - cont "increase a bit." - prompt - -_CeruleanHouse2Text_74eb9:: - text "All #MON will" - line "obey you!" - prompt diff --git a/text/maps/cerulean_badge_house_2.asm b/text/maps/cerulean_badge_house_2.asm new file mode 100755 index 00000000..e5da0622 --- /dev/null +++ b/text/maps/cerulean_badge_house_2.asm @@ -0,0 +1,28 @@ +_CeruleanHouse2Text_74eaa:: + text "The DEFENSE of all" + line "#MON increases" + cont "a little bit." + + para "It also lets you" + line "use SURF outside" + cont "of battle." + prompt + +_CeruleanHouse2Text_74eaf:: + text "#MON up to L70" + line "will obey you." + + para "Any higher, they" + line "become unruly!" + prompt + +_CeruleanHouse2Text_74eb4:: + text "Your #MON's" + line "SPECIAL abilities" + cont "increase a bit." + prompt + +_CeruleanHouse2Text_74eb9:: + text "All #MON will" + line "obey you!" + prompt diff --git a/text/maps/cerulean_city.asm b/text/maps/cerulean_city.asm index 48d97e05..4c51c5e0 100644 --- a/text/maps/cerulean_city.asm +++ b/text/maps/cerulean_city.asm @@ -120,38 +120,38 @@ _CeruleanCityText5:: done _CeruleanCityText6:: - text "The people here" - line "were robbed." + text "These poor people" + line "here were robbed." - para "It's obvious that" - line "TEAM ROCKET is" - cont "behind this most" - cont "heinous crime!" + para "We're positive" + line "that TEAM ROCKET" + cont "is behind this" + cont "terrible deed." para "Even our POLICE" - line "force has trouble" + line "FORCE has trouble" cont "with the ROCKETs!" done _CeruleanCityText_19730:: - text "OK! SLOWBRO!" + text "OK! ELECTRODE!" line "Use SONICBOOM!" - cont "Come on, SLOWBRO" + cont "Please ELECTRODE," cont "pay attention!" done _CeruleanCityText_19735:: - text "SLOWBRO punch!" + text "ELECTRODE, TACKLE!" line "No! You blew it" cont "again!" done _CeruleanCityText_1973a:: - text "SLOWBRO, WITHDRAW!" + text "ELECTRODE, SWIFT!" line "No! That's wrong!" - para "It's so hard to" - line "control #MON!" + para "Training #MON" + line "is difficult!" para "Your #MON's" line "obedience depends" @@ -160,22 +160,22 @@ _CeruleanCityText_1973a:: done _CeruleanCityText_1976f:: - text "SLOWBRO took a" + text "ELECTRODE took a" line "snooze..." done _CeruleanCityText_19774:: - text "SLOWBRO is" + text "ELECTRODE is" line "loafing around..." done _CeruleanCityText_19779:: - text "SLOWBRO turned" + text "ELECTRODE turned" line "away..." done _CeruleanCityText_1977e:: - text "SLOWBRO" + text "ELECTRODE" line "ignored orders..." done diff --git a/text/maps/cerulean_gym.asm b/text/maps/cerulean_gym.asm index dd6baaff..70cbdf0d 100644 --- a/text/maps/cerulean_gym.asm +++ b/text/maps/cerulean_gym.asm @@ -2,19 +2,21 @@ _CeruleanGymText_5c7be:: text "Hi, you're a new" line "face!" - para "Trainers who want" - line "to turn pro have" - cont "to have a policy" - cont "about #MON!" - - para "What is your" - line "approach when you" - cont "catch #MON?" + para "What's your policy" + line "on #MON? What" + cont "is your approach?" para "My policy is an" line "all-out offensive" cont "with water-type" cont "#MON!" + + para "MISTY, the world-" + line "famous beauty, is" + cont "your host!" + + para "Are you ready," + line "sweetie?" done _CeruleanGymText_5c7c3:: @@ -35,7 +37,7 @@ _CeruleanGymText_5c7c8:: para "There's more, you" line "can now use CUT" - cont "any time!" + cont "anytime!" para "You can CUT down" line "small bushes to" @@ -55,14 +57,15 @@ _CeruleanGymText_5c7d3:: done _CeruleanGymText_5c7d8:: - text "Wow!" - line "You're too much!" + text "I can't" + line "believe I lost!" para "All right!" para "You can have the" line "CASCADEBADGE to" - cont "show you beat me!@@" + cont "show you beat me!" + prompt _CeruleanGymBattleText1:: text "I'm more than good" @@ -125,7 +128,7 @@ _CeruleanGymText_5c82f:: text "You beat MISTY!" line "What'd I tell ya?" - para "You and me kid," + para "You and me, kid," line "we make a pretty" cont "darn good team!" done diff --git a/text/maps/cerulean_trade_house.asm b/text/maps/cerulean_trade_house.asm index b606613b..791c11d5 100644 --- a/text/maps/cerulean_trade_house.asm +++ b/text/maps/cerulean_trade_house.asm @@ -1,9 +1,39 @@ -_CeruleanHouse1Text1:: - text "My husband likes" - line "trading #MON." - - para "If you are a" - line "collector, would" - cont "you please trade" - cont "with him?" +MelanieText1:: + text "I take care of" + line "injured #MON." + + para "I nursed this" + line "BULBASAUR back to" + cont "health." + + para "It needs a good" + line "trainer to take" + cont "care of it now.@@" + +MelanieText2:: + text "I know! Would you" + line "take care of this" + cont "BULBASAUR?" done + +MelanieText3:: + text "Please take care" + line "of BULBASAUR!@@" + +MelanieText4:: + text "Is BULBASAUR" + line "doing well?@@" + +MelanieText5:: + text "Oh..." + line "That's too bad...@@" + +MelanieBulbasaurText:: + text "BULBASAUR: Bubba!" + line "Zoar!@@" + +MelanieOddishText:: + text "ODDISH: Orddissh!@@" + +MelanieSandshrewText:: + text "SANDSHREW: Pikii!@@" diff --git a/text/maps/cinnabar_gym.asm b/text/maps/cinnabar_gym.asm index b14f6f60..58873c2a 100644 --- a/text/maps/cinnabar_gym.asm +++ b/text/maps/cinnabar_gym.asm @@ -207,3 +207,46 @@ _CinnabarGymText_75ac7:: text $52, "! You beat" line "that fire brand!" done + +_CinnabarGymText_1:: + text "This GYM is also" + line "known as the QUIZ" + cont "GYM." + + para "You have to take a" + line "quiz if you want" + cont "to see BLAINE." + + para "You don't have to" + line "fight us if you" + cont "get it right." + done + +_CinnabarGymText_2:: + text "Think you can do" + line "it?" + done + +_CinnabarGymText_3:: + text "This one's tricky!" + done + +_CinnabarGymText_4:: + text "#MON enjoy" + line "quizzes too!" + done + +_CinnabarGymText_5:: + text "I like it here at" + line "QUIZ GYM." + done + +_CinnabarGymText_6:: + text "This is the last" + line "question." + done + +_CinnabarGymText_7:: + text "Come on, answer" + line "the question!" + done diff --git a/text/maps/cinnabar_island.asm b/text/maps/cinnabar_island.asm index 352ab8ea..54552a46 100644 --- a/text/maps/cinnabar_island.asm +++ b/text/maps/cinnabar_island.asm @@ -13,7 +13,7 @@ _CinnabarIslandText1:: _CinnabarIslandText2:: text "Scientists conduct" line "experiments in" - cont "the burned out" + cont "the burned-out" cont "building." done diff --git a/text/maps/copycats_house_1f.asm b/text/maps/copycats_house_1f.asm index 3ec2b151..bd3029fd 100644 --- a/text/maps/copycats_house_1f.asm +++ b/text/maps/copycats_house_1f.asm @@ -16,5 +16,5 @@ _CopycatsHouse1FText2:: done _CopycatsHouse1FText3:: - text "CHANSEY: Chaan!" - line "Sii!@@" + text "CHANSEY: Chaaan" + line "sey!@@" diff --git a/text/maps/daycare_1.asm b/text/maps/daycare.asm index 6e3c5737..8375ead0 100644 --- a/text/maps/daycare_1.asm +++ b/text/maps/daycare.asm @@ -17,18 +17,15 @@ _DayCareWillLookAfterMonText:: db $0 cont "for a while." prompt - _DayCareComeSeeMeInAWhileText:: text "Come see me in" line "a while." done - _DayCareMonHasGrownText:: text "Your @" TX_RAM wcd6d db $0 line "has grown a lot!" - para "By level, it's" line "grown by @" TX_NUM wDayCareNumLevelsGrown,$1,$3 @@ -36,7 +33,6 @@ _DayCareMonHasGrownText:: para "Aren't I great?" prompt - _DayCareOweMoneyText:: text "You owe me ¥@" TX_BCD wDayCareTotalCost, $c2 @@ -60,3 +56,37 @@ _DayCareMonNeedsMoreTimeText:: cont "needs some more" cont "time with me." prompt + +_DayCareAllRightThenText:: + text "All right then," + line "@@" + +_DayCareComeAgainText:: + text "Come again." + done + +_DayCareNoRoomForMonText:: + text "You have no room" + line "for this #MON!" + done + +_DayCareOnlyHaveOneMonText:: + text "You only have one" + line "#MON with you." + done + +_DayCareCantAcceptMonWithHMText:: + text "I can't accept a" + line "#MON that" + cont "knows an HM move." + done + +_DayCareHeresYourMonText:: + text "Thank you! Here's" + line "your #MON!" + prompt + +_DayCareNotEnoughMoneyText:: + text "Hey, you don't" + line "have enough ¥!" + done diff --git a/text/maps/daycare_2.asm b/text/maps/daycare_2.asm deleted file mode 100644 index 20c0e5ad..00000000 --- a/text/maps/daycare_2.asm +++ /dev/null @@ -1,33 +0,0 @@ -_DayCareAllRightThenText:: - text "All right then," - line "@@" - -_DayCareComeAgainText:: - text "come again." - done - -_DayCareNoRoomForMonText:: - text "You have no room" - line "for this #MON!" - done - -_DayCareOnlyHaveOneMonText:: - text "You only have one" - line "#MON with you." - done - -_DayCareCantAcceptMonWithHMText:: - text "I can't accept a" - line "#MON that" - cont "knows an HM move." - done - -_DayCareHeresYourMonText:: - text "Thank you! Here's" - line "your #MON!" - prompt - -_DayCareNotEnoughMoneyText:: - text "Hey, you don't" - line "have enough ¥!" - done diff --git a/text/maps/fan_club.asm b/text/maps/fan_club.asm index 7477405c..5fcd469d 100644 --- a/text/maps/fan_club.asm +++ b/text/maps/fan_club.asm @@ -1,15 +1,25 @@ PikachuFanText:: text "Won't you admire" - line "my PIKACHU's" + line "my CLEFAIRY's" cont "adorable tail?" done PikachuFanBetterText:: - text "Humph! My PIKACHU" + text "Humph! My CLEFAIRY" line "is twice as cute" cont "as that one!" done +PikachuFanPrintText:: + text "Our CHAIRMAN's new" + line "hobby is taking" + cont "#MON photos." + + para "He gave me a nice" + line "PRINT of my cute" + cont "CLEFAIRY." + done + SeelFanText:: text "I just love my" line "SEEL!" @@ -25,9 +35,15 @@ SeelFanBetterText:: line "more attractive!" done +SeelFanPrintText:: + text "I'm going to hook" + line "up the cable to" + cont "get a photo PRINT" + cont "of my SEEL!" + done + FanClubPikachuText:: - text "PIKACHU: Chu!" - line "Pikachu!" + text "CLEFAIRY: Pippii!" done FanClubSeelText:: @@ -38,8 +54,9 @@ FanClubMeetChairText:: text "I chair the" line "#MON Fan Club!" - para "I have collected" - line "over 100 #MON!" + para "I have more than" + line "100 #MON. I" + cont "love them all!" para "I'm very fussy" line "when it comes to" @@ -47,8 +64,8 @@ FanClubMeetChairText:: para "So..." - para "Did you come" - line "visit to hear" + para "Did you come to" + line "hear me brag" cont "about my #MON?" done @@ -69,7 +86,7 @@ FanClubChairStoryText:: cont "love it!" para "Hug it...when..." - cont "sleeping...warm" + line "sleeping...warm" cont "and cuddly..." cont "spectacular..." cont "ravishing..." @@ -83,13 +100,13 @@ FanClubChairStoryText:: prompt ReceivedBikeVoucherText:: - text $52, " received" + text "<PLAYER> received" line "a @" TX_RAM wcf4b text "!@@" ExplainBikeVoucherText:: - db $0 + text "" para "Exchange that for" line "a BICYCLE!" @@ -111,7 +128,7 @@ FanClubNoStoryText:: done FanClubChairFinalText:: - text "Hello, ", $52, "!" + text "Hello, <PLAYER>!" para "Did you come see" line "me about my" @@ -125,19 +142,37 @@ FanClubBagFullText:: line "this!" done -_FanClubText6:: - text "Our Chairman is" - line "very vocal about" - cont "#MON." +FanClubChairPrintText1:: + text "Hi there, <PLAYER>!" + line "Have you seen my" + cont "#MON photos?" + + para "I have them framed" + line "up on that wall." + + para "Ah, I know!" + + para "Would you like me" + line "to take a photo" + cont "of your #MON?" done -_FanClubText7:: - text "Let's all listen" - line "politely to other" - cont "trainers!" +FanClubChairPrintText2:: + text "No? That's really" + line "disappointing." done -_FanClubText8:: - text "If someone brags," - line "brag right back!" +FanClubChairPrintText3:: + text "OK, I'm done." + done + +FanClubChairPrintText4:: + text "Maybe we won't" + line "PRINT this now." + done + +_FanClubText6:: + text "Our CHAIRMAN is" + line "very vocal about" + cont "#MON." done diff --git a/text/maps/fighting_dojo.asm b/text/maps/fighting_dojo.asm index 3df069c1..a6ccc8c3 100644 --- a/text/maps/fighting_dojo.asm +++ b/text/maps/fighting_dojo.asm @@ -114,13 +114,13 @@ _FightingDojoAfterBattleText4:: _WantHitmonleeText:: text "You want the" - line "hard kicking" + line "hard-kicking" cont "HITMONLEE?" done _WantHitmonchanText:: text "You want the" - line "piston punching" + line "piston-punching" cont "HITMONCHAN?" done diff --git a/text/maps/fuchsia_city.asm b/text/maps/fuchsia_city.asm index a90d0021..0392a1ed 100644 --- a/text/maps/fuchsia_city.asm +++ b/text/maps/fuchsia_city.asm @@ -58,7 +58,7 @@ _FuchsiaCityText18:: cont "LEADER: KOGA" para "The Poisonous" - line "Ninja Master" + line "Ninja Master!" done _FuchsiaCityChanseyText:: diff --git a/text/maps/fuchsia_gym_2.asm b/text/maps/fuchsia_gym.asm index ba1970e6..6beebc69 100644 --- a/text/maps/fuchsia_gym_2.asm +++ b/text/maps/fuchsia_gym.asm @@ -1,3 +1,30 @@ +_KogaBeforeBattleText:: + text "KOGA: Fwahahaha!" + + para "A mere child like" + line "you dares to" + cont "challenge me?" + + para "Very well, I" + line "shall show you" + cont "true terror as a" + cont "ninja master!" + + para "You shall feel" + line "the despair of" + cont "poison and sleep" + cont "techniques!" + done + +_KogaAfterBattleText:: + text "Humph!" + line "You have proven" + cont "your worth!" + + para "Here! Take the" + line "SOULBADGE!" + prompt + _KogaExplainToxicText:: text "When afflicted by" line "TOXIC, #MON" @@ -51,7 +78,6 @@ _FuchsiaGymBattleText1:: cont "#MON!" para "It's strategy!" - para "I'll show you how" line "strategy can beat" cont "brute strength!" @@ -78,14 +104,12 @@ _FuchsiaGymEndBattleText2:: text "I'm done" line "for!" prompt - _FuchsiaGymAfterBattleText2:: text "I will keep on" line "training under" cont "KOGA, my ninja" cont "master!" done - _FuchsiaGymBattleText3:: text "Let's see you" line "beat my special" @@ -116,7 +140,6 @@ _FuchsiaGymEndBattleText4:: text "Whoa!" line "He's got it!" prompt - _FuchsiaGymAfterBattleText4:: text "You impressed me!" line "Here's a hint!" @@ -180,12 +203,10 @@ _FuchsiaGymText_7564e:: para "KOGA might appear" line "close, but he's" cont "blocked off!" - para "You have to find" line "gaps in the walls" cont "to reach him!" done - _FuchsiaGymText_75653:: text "It's amazing how" line "ninja can terrify" diff --git a/text/maps/fuchsia_gym_1.asm b/text/maps/fuchsia_gym_1.asm deleted file mode 100644 index 9108fc79..00000000 --- a/text/maps/fuchsia_gym_1.asm +++ /dev/null @@ -1,26 +0,0 @@ -_KogaBeforeBattleText:: - text "KOGA: Fwahahaha!" - - para "A mere child like" - line "you dares to" - cont "challenge me?" - - para "Very well, I" - line "shall show you" - cont "true terror as a" - cont "ninja master!" - - para "You shall feel" - line "the despair of" - cont "poison and sleep" - cont "techniques!" - done - -_KogaAfterBattleText:: - text "Humph!" - line "You have proven" - cont "your worth!" - - para "Here! Take the" - line "SOULBADGE!" - prompt diff --git a/text/maps/hall_of_fame.asm b/text/maps/hall_of_fame.asm index 6c5dd40e..8faefd3f 100644 --- a/text/maps/hall_of_fame.asm +++ b/text/maps/hall_of_fame.asm @@ -1,7 +1,7 @@ _HallofFameRoomText1:: text "OAK: Er-hem!" - line "Congratulations" - cont $52, "!" + line "Congratulations," + cont "<PLAYER>!" para "This floor is the" line "#MON HALL OF" @@ -16,13 +16,13 @@ _HallofFameRoomText1:: line "also recorded in" cont "the HALL OF FAME!" - para $52, "! You have" + para "<PLAYER>! You have" line "endeavored hard" cont "to become the new" cont "LEAGUE champion!" para "Congratulations," - line $52, ", you and" + line "<PLAYER>, you and" cont "your #MON are" cont "HALL OF FAMERs!" done diff --git a/text/maps/lance.asm b/text/maps/lance.asm index 3c75ce47..9c7bd677 100644 --- a/text/maps/lance.asm +++ b/text/maps/lance.asm @@ -1,6 +1,6 @@ _LanceBeforeBattleText:: text "Ah! I heard about" - line "you ", $52, "!" + line "you, ", $52, "!" para "I lead the ELITE" line "FOUR! You can" diff --git a/text/maps/lorelei.asm b/text/maps/lorelei.asm index fdbb55b4..666aa47f 100644 --- a/text/maps/lorelei.asm +++ b/text/maps/lorelei.asm @@ -30,7 +30,6 @@ _LoreleiAfterBattleText:: text "You're better" line "than I thought!" cont "Go on ahead!" - para "You only got a" line "taste of #MON" cont "LEAGUE power!" diff --git a/text/maps/mt_moon_1f.asm b/text/maps/mt_moon_1f.asm index 761a5240..2e8c960e 100644 --- a/text/maps/mt_moon_1f.asm +++ b/text/maps/mt_moon_1f.asm @@ -115,5 +115,5 @@ _MtMoon1AfterBattleText8:: _MtMoon1Text14:: text "Beware! ZUBAT is" - line "a blood sucker!" + line "a bloodsucker!" done diff --git a/text/maps/mt_moon_b2f.asm b/text/maps/mt_moon_b2f.asm index 462c9d3c..9ad1d706 100644 --- a/text/maps/mt_moon_b2f.asm +++ b/text/maps/mt_moon_b2f.asm @@ -1,3 +1,24 @@ +_MtMoonJessieJamesText1:: + text "Stop right there!@@" + +_MtMoonJessieJamesText2:: + text "That fossil is" + line "TEAM ROCKET's!" + + para "Surrender now, or " + line "prepare to fight!" + done + +_MtMoonJessieJamesText3:: + text "A" + line "brat beat us?" + prompt + +_MtMoonJessieJamesText4:: + text "TEAM ROCKET, blast" + line "off at the speed" + cont "of light!@@" + _MtMoon3Text_49f24:: text "You want the" line "DOME FOSSIL?" @@ -52,24 +73,6 @@ _MtMoon3Text_49f99:: text "All right. Then" line "this is mine!@@" -_MtMoon3BattleText2:: - text "TEAM ROCKET will" - line "find the fossils," - cont "revive and sell" - cont "them for cash!" - done - -_MtMoon3EndBattleText2:: - text "Urgh!" - line "Now I'm mad!" - prompt - -_MtMoon3AfterBattleText2:: - text "You made me mad!" - line "TEAM ROCKET will" - cont "blacklist you!" - done - _MtMoon3BattleText3:: text "We, TEAM ROCKET," line "are #MON" diff --git a/text/maps/mt_moon_pokecenter.asm b/text/maps/mt_moon_pokecenter.asm index 90fd811e..ebcada87 100644 --- a/text/maps/mt_moon_pokecenter.asm +++ b/text/maps/mt_moon_pokecenter.asm @@ -16,6 +16,10 @@ _MtMoonPokecenterText3:: cont "news!" done +_MtMoonPokecenterText5:: + db $0 + done + _MagikarpSalesmanText1:: text "MAN: Hello, there!" line "Have I got a deal" @@ -42,7 +46,3 @@ _MagikarpSalesmanText2:: text "MAN: Well, I don't" line "give refunds!" done - -_MtMoonPokecenterText5:: - db $0 - done diff --git a/text/maps/museum_1f.asm b/text/maps/museum_1f.asm index 46b4484c..ecb511aa 100644 --- a/text/maps/museum_1f.asm +++ b/text/maps/museum_1f.asm @@ -72,7 +72,7 @@ _Museum1FText_5c28e:: para "But, my colleagues" line "just ignore me!" - para "So I have a favor" + para "So, I have a favor" line "to ask!" para "Take this to a" @@ -81,7 +81,7 @@ _Museum1FText_5c28e:: prompt _ReceivedOldAmberText:: - text $52, " received" + text "<PLAYER> received" line "OLD AMBER!@@" _Museum1FText_5c299:: diff --git a/text/maps/museum_2f.asm b/text/maps/museum_2f.asm index 4f34a249..12cfe8b2 100644 --- a/text/maps/museum_2f.asm +++ b/text/maps/museum_2f.asm @@ -33,6 +33,20 @@ _Museum2FText5:: line "soon, I promise!" done +_Museum2FPikachuText1:: + text "Your PIKACHU looks" + line "untamed." + cont "May I have it for" + cont "my daughter?" + done + +_Museum2FPikachuText2:: + text "I'd like to get" + line "that PIKACHU off" + cont "you, but it's too" + cont "attached to you." + done + _Museum2FText6:: text "SPACE SHUTTLE" line "COLUMBIA" diff --git a/text/maps/name_rater.asm b/text/maps/name_rater.asm index 65d3e8a4..7194a927 100644 --- a/text/maps/name_rater.asm +++ b/text/maps/name_rater.asm @@ -43,7 +43,7 @@ _NameRaterText_1dac7:: done _NameRaterText_1dacc:: - text "Fine! Come any" + text "Fine! Come any-" line "time you like!" done diff --git a/text/maps/oaks_lab.asm b/text/maps/oaks_lab.asm index 52af450d..097fa931 100644 --- a/text/maps/oaks_lab.asm +++ b/text/maps/oaks_lab.asm @@ -1,68 +1,34 @@ _OaksLabGaryText1:: - text $53,": Yo" - line $52,"! Gramps" + text "<RIVAL>: Yo" + line "<PLAYER>! Gramps" cont "isn't around!" + + para "I ran here 'cos" + line "he said he had a" + cont "#MON for me." done _OaksLabText40:: - text $53,": Heh, I" - line "don't need to be" - cont "greedy like you!" - - para "Go ahead and" - line "choose, ", $52, "!" + text "<RIVAL>: Humph!" + line "I'll get a better" + cont "#MON than you!" done _OaksLabText41:: - text $53,": My" + text "<RIVAL>: Heh, my" line "#MON looks a" cont "lot stronger." done _OaksLabText39:: - text "Those are #" - line "BALLs. They" - cont "contain #MON!" - done - -_OaksLabCharmanderText:: - text "So! You want the" - line "fire #MON," - cont "CHARMANDER?" - done - -_OaksLabSquirtleText:: - text "So! You want the" - line "water #MON," - cont "SQUIRTLE?" - done - -_OaksLabBulbasaurText:: - text "So! You want the" - line "plant #MON," - cont "BULBASAUR?" - done - -_OaksLabMonEnergeticText:: - text "This #MON is" - line "really energetic!" - prompt - -_OaksLabReceivedMonText:: - text $52, " received" - line "a @" - TX_RAM wcd6d - text "!@@" - -_OaksLabLastMonText:: - text "That's PROF.OAK's" - line "last #MON!" + text "That's a #" + line "BALL. There's a" + cont "#MON inside!" done -_OaksLabText_1d2f0:: - text "OAK: Now, ", $52, "," - line "which #MON do" - cont "you want?" +_OaksLabPikachuText:: + text "OAK: Go ahead," + line "it's yours!" done _OaksLabText_1d2f5:: @@ -70,17 +36,19 @@ _OaksLabText_1d2f5:: line "#MON appears," cont "your #MON can" cont "fight against it!" + + para "Afterward, go on" + line "to the next town." done _OaksLabText_1d2fa:: - text "OAK: ", $52, "," - line "raise your young" - cont "#MON by making" - cont "it fight!" + text "OAK: You should" + line "talk to it and" + cont "see how it feels." done _OaksLabDeliverParcelText1:: - text "OAK: Oh, ", $52, "!" + text "OAK: Oh, <PLAYER>!" para "How is my old" line "#MON?" @@ -95,21 +63,25 @@ _OaksLabDeliverParcelText1:: para "What? You have" line "something for me?" - para $52, " delivered" + para "<PLAYER> delivered" line "OAK's PARCEL.@@" _OaksLabDeliverParcelText2:: - db $0 + text "" para "Ah! This is the" line "custom # BALL" cont "I ordered!" - cont "Thank you!" + cont "Thanks, <PLAYER>!" + + para "By the way, I must" + line "ask you to do" + cont "something for me." done _OaksLabAroundWorldText:: text "#MON around the" line "world wait for" - cont "you, ", $52, "!" + cont "you, <PLAYER>!" done _OaksLabGivePokeballsText1:: @@ -123,18 +95,19 @@ _OaksLabGivePokeballsText1:: cont "to capture wild" cont "#MON." - para $52, " got 5" + para "<PLAYER> got 5" line "# BALLs!@@" _OaksLabGivePokeballsText2:: - db $0 + text "" para "When a wild" line "#MON appears," cont "it's fair game." - para "Just throw a #" - line "BALL at it and try" - line "to catch it!" + para "Just like I showed" + line "you, throw a #" + cont "BALL at it and try" + cont "to catch it!" para "This won't always" line "work, though." @@ -182,70 +155,105 @@ _OaksLabText_1d340:: done _OaksLabRivalWaitingText:: - text $53, ": Gramps!" + text "<RIVAL>: Gramps!" line "I'm fed up with" cont "waiting!" done _OaksLabChooseMonText:: - text "OAK: ", $53, "?" - line "Let me think..." - - para "Oh, that's right," - line "I told you to" - cont "come! Just wait!" + text "OAK: Hmm? <RIVAL>?" + line "Why are you here" + cont "already?" - para "Here, ", $52, "!" + para "I said for you to" + line "come by later..." - para "There are 3" - line "#MON here!" + para "Ah, whatever!" + line "Just wait there." - para "Haha!" + para "Look, <PLAYER>! Do" + line "you see that ball" + cont "on the table?" - para "They are inside" - line "the # BALLs." + para "It's called a #" + line "BALL. It holds a" + cont "#MON inside." - para "When I was young," - line "I was a serious" - cont "#MON trainer!" - - para "In my old age, I" - line "have only 3 left," - cont "but you can have" - cont "one! Choose!" + para "You may have it!" + line "Go on, take it!" done _OaksLabRivalInterjectionText:: - text $53, ": Hey!" + text "<RIVAL>: Hey!" line "Gramps! What" cont "about me?" done _OaksLabBePatientText:: - text "OAK: Be patient!" - line $53, ", you can" - cont "have one too!" + text "OAK: Be patient," + line "<RIVAL>, I'll give" + cont "you one later." done -_OaksLabLeavingText:: - text "OAK: Hey! Don't go" - line "away yet!" - done +_OaksLabRivalTakesText1:: + text "<RIVAL>: No way!" + line "<PLAYER>, I want" + cont "this #MON!" + prompt + +_OaksLabRivalTakesText2:: + text "<RIVAL> snatched" + line "the #MON!@@" + +_OaksLabRivalTakesText3:: + text "OAK: <RIVAL>! What" + line "are you doing?" + prompt + +_OaksLabRivalTakesText4:: + text "<RIVAL>: Gramps, I" + line "want this one!" + prompt + +_OaksLabRivalTakesText5:: + text "OAK: But, I... Oh," + line "all right then." + cont "That #MON is" + cont "yours." + + para "I was going to" + line "give you one" + cont "anyway..." -_OaksLabRivalPickingMonText:: - text $53, ": I'll take" - line "this one, then!" + para "<PLAYER>, come over" + line "here." done -_OaksLabRivalReceivedMonText:: - text $53, " received" +_OaksLabOakGivesText:: + text "OAK: <PLAYER>, this" + line "is the #MON I" + cont "caught earlier." + + para "You can have it." + line "I caught it in" + cont "the wild and it's" + cont "not tame yet." + prompt + +_OaksLabReceivedText:: + text "<PLAYER> received" line "a @" TX_RAM wcd6d text "!@@" +_OaksLabLeavingText:: + text "OAK: Hey! Don't go" + line "away yet!" + done + _OaksLabRivalChallengeText:: - text $53, ": Wait" - line $52, "!" + text "<RIVAL>: Wait" + line "<PLAYER>!" cont "Let's check out" cont "our #MON!" @@ -261,33 +269,62 @@ _OaksLabText_1d3be:: prompt _OaksLabText_1d3c3:: - text $53, ": Yeah! Am" + text "<RIVAL>: Yeah! Am" line "I great or what?" prompt _OaksLabRivalToughenUpText:: - text $53, ": Okay!" + text "<RIVAL>: Okay!" line "I'll make my" cont "#MON fight to" cont "toughen it up!" - para $52, "! Gramps!" + para "<PLAYER>! Gramps!" line "Smell you later!" done +_OaksLabPikachuDislikesPokeballsText1:: + text "OAK: What?" + done + +_OaksLabPikachuDislikesPokeballsText2:: + text "OAK: Would you" + line "look at that!" + + para "It's odd, but it" + line "appears that your" + cont "PIKACHU dislikes" + cont "# BALLs." + + para "You should just" + line "keep it with you." + + para "That should make" + line "it happy!" + + para "You can talk to it" + line "and see how it" + cont "feels about you." + done + _OaksLabText21:: - text $53, ": Gramps!" + text "<RIVAL>: Gramps!" done _OaksLabText22:: - text $53, ": What did" - line "you call me for?" + text "<RIVAL>: Gramps," + line "my #MON has" + cont "grown stronger!" + cont "Check it out!" done _OaksLabText23:: - text "OAK: Oh right! I" - line "have a request" - cont "of you two." + text "OAK: Ah, <RIVAL>," + line "good timing!" + + para "I needed to ask" + line "both of you to do" + cont "something for me." done _OaksLabText24:: @@ -305,11 +342,11 @@ _OaksLabText24:: done _OaksLabText25:: - text "OAK: ", $52, " and" - line $53, "! Take" + text "OAK: <PLAYER> and" + line "<RIVAL>! Take" cont "these with you!" - para $52, " got" + para "<PLAYER> got" line "#DEX from OAK!@@" _OaksLabText26:: @@ -336,11 +373,11 @@ _OaksLabText26:: done _OaksLabText27:: - text $53, ": Alright" + text "<RIVAL>: Alright" line "Gramps! Leave it" cont "all to me!" - para $52, ", I hate to" + para "<PLAYER>, I hate to" line "say it, but I" cont "don't need you!" @@ -350,128 +387,10 @@ _OaksLabText27:: para "I'll tell her not" line "to lend you one," - cont $52, "! Hahaha!" + cont "<PLAYER>! Hahaha!" done _OaksLabText_1d405:: text "I study #MON as" line "PROF.OAK's AIDE." done - -_OaksLabText_441cc:: - text "#DEX comp-" - line "letion is:" - - para "@" - TX_NUM hDexRatingNumMonsSeen, 1, 3 - text " #MON seen" - line "@" - TX_NUM hDexRatingNumMonsOwned, 1, 3 - text " #MON owned" - - para "PROF.OAK's" - line "Rating:" - prompt - -_OaksLabText_44201:: - text "You still have" - line "lots to do." - cont "Look for #MON" - cont "in grassy areas!" - done - -_OaksLabText_44206:: - text "You're on the" - line "right track! " - cont "Get a FLASH HM" - cont "from my AIDE!" - done - -_OaksLabText_4420b:: - text "You still need" - line "more #MON!" - cont "Try to catch" - cont "other species!" - done - -_OaksLabText_44210:: - text "Good, you're" - line "trying hard!" - cont "Get an ITEMFINDER" - cont "from my AIDE!" - done - -_OaksLabText_44215:: - text "Looking good!" - line "Go find my AIDE" - cont "when you get 50!" - done - -_OaksLabText_4421a:: - text "You finally got at" - line "least 50 species!" - cont "Be sure to get" - cont "EXP.ALL from my" - cont "AIDE!" - done - -_OaksLabText_4421f:: - text "Ho! This is geting" - line "even better!" - done - -_OaksLabText_44224:: - text "Very good!" - line "Go fish for some" - cont "marine #MON!" - done - -_OaksLabText_44229:: - text "Wonderful!" - line "Do you like to" - cont "collect things?" - done - -_OaksLabText_4422e:: - text "I'm impressed!" - line "It must have been" - cont "difficult to do!" - done - -_OaksLabText_44233:: - text "You finally got at" - line "least 100 species!" - cont "I can't believe" - cont "how good you are!" - done - -_OaksLabText_44238:: - text "You even have the" - line "evolved forms of" - cont "#MON! Super!" - done - -_OaksLabText_4423d:: - text "Excellent! Trade" - line "with friends to" - cont "get some more!" - done - -_OaksLabText_44242:: - text "Outstanding!" - line "You've become a" - cont "real pro at this!" - done - -_OaksLabText_44247:: - text "I have nothing" - line "left to say!" - cont "You're the" - cont "authority now!" - done - -_OaksLabText_4424c:: - text "Your #DEX is" - line "entirely complete!" - cont "Congratulations!" - done diff --git a/text/maps/pallet_town.asm b/text/maps/pallet_town.asm index 64b3325b..741ad529 100644 --- a/text/maps/pallet_town.asm +++ b/text/maps/pallet_town.asm @@ -3,9 +3,21 @@ _OakAppearsText:: line "Don't go out!@@" _OakWalksUpText:: - text "OAK: It's unsafe!" - line "Wild #MON live" - cont "in tall grass!" + text "OAK: That was" + line "close!" + + para "Wild #MON live" + line "in tall grass!" + done + +_OakWhewText:: + text "OAK: Whew..." + done + +_OakGrassText:: + text "OAK: A #MON can" + line "appear anytime in" + cont "tall grass." para "You need your own" line "#MON for your" diff --git a/text/maps/pewter_gym_2.asm b/text/maps/pewter_gym.asm index ff5f7242..a8781b4d 100644 --- a/text/maps/pewter_gym_2.asm +++ b/text/maps/pewter_gym.asm @@ -1,14 +1,40 @@ +_PewterGymText_5c49e:: + text "I'm BROCK!" + line "I'm PEWTER's GYM" + cont "LEADER!" + + para "I believe in rock" + line "hard defense and" + cont "determination!" + + para "That's why my" + line "#MON are all" + cont "the rock-type!" + + para "Do you still want" + line "to challenge me?" + cont "Fine then! Show" + cont "me your best!" + done + _PewterGymText_5c4a3:: text "There are all" line "kinds of trainers" cont "in the world!" - para "You appear to be" - line "very gifted as a" - cont "#MON trainer!" + para "Some raise #MON" + line "for fights. Some" + cont "see them as pets." + + para "I'm in training to" + line "become a #MON" + cont "breeder." - para "Go to the GYM in" - line "CERULEAN and test" + para "If you take your" + line "#MON training" + cont "seriously, go" + cont "visit the GYM in" + cont "CERULEAN and test" cont "your abilities!" done @@ -72,7 +98,7 @@ _PewterGymText_5c4c1:: para "The technique" line "FLASH can now be" - cont "used any time!" + cont "used anytime!" prompt _PewterGymBattleText1:: @@ -140,3 +166,17 @@ _PewterGymText_5c529:: line "You're #MON" cont "champ material!" done + +_PewterGymGuyText:: + text "All right! Let's" + line "get happening!" + + para "It will be tough" + line "for your PIKACHU" + cont "at this GYM!" + + para "Electric attacks" + line "are harmless to" + cont "BROCK's ground-" + cont "type #MON." + done diff --git a/text/maps/pewter_gym_1.asm b/text/maps/pewter_gym_1.asm deleted file mode 100644 index 6426dd72..00000000 --- a/text/maps/pewter_gym_1.asm +++ /dev/null @@ -1,18 +0,0 @@ -_PewterGymText_5c49e:: - text "I'm BROCK!" - line "I'm PEWTER's GYM" - cont "LEADER!" - - para "I believe in rock" - line "hard defense and" - cont "determination!" - - para "That's why my" - line "#MON are all" - cont "the rock-type!" - - para "Do you still want" - line "to challenge me?" - cont "Fine then! Show" - cont "me your best!" - done diff --git a/text/maps/pewter_mart.asm b/text/maps/pewter_mart.asm index 0d5b07a2..4dbc3c02 100644 --- a/text/maps/pewter_mart.asm +++ b/text/maps/pewter_mart.asm @@ -1,5 +1,5 @@ _PewterMartText2:: - text "A shady, old man" + text "A shady old man" line "got me to buy" cont "this really weird" cont "fish #MON!" diff --git a/text/maps/pewter_pokecenter.asm b/text/maps/pewter_pokecenter.asm index 6a1b373e..968f6af0 100644 --- a/text/maps/pewter_pokecenter.asm +++ b/text/maps/pewter_pokecenter.asm @@ -8,6 +8,19 @@ _PewterPokecenterText2:: para "Scram!" done +_PewterPokecenterText3:: + text "#MON CENTERS" + line "are wonderful!" + + para "They heal #MON" + line "completely." + + para "Even conditions" + line "like sleep, burn," + cont "poison and others" + cont "are cured." + done + _PewterJigglypuffText:: text "JIGGLYPUFF: Puu" line "pupuu!" diff --git a/text/maps/pokemon_tower_7f.asm b/text/maps/pokemon_tower_7f.asm index 704a71eb..652cf37a 100644 --- a/text/maps/pokemon_tower_7f.asm +++ b/text/maps/pokemon_tower_7f.asm @@ -1,3 +1,27 @@ +_PokemonTowerJessieJamesText1:: + text "Stop right there!@@" + +_PokemonTowerJessieJamesText2:: + text "Grampa here wanted" + line "to complain, so" + cont "we're setting him" + cont "straight." + + para "So render yourself" + line "invisible, or" + cont "prepare to fight!" + done + +_PokemonTowerJessieJamesText3:: + text "You" + line "will regret this!" + prompt + +_PokemonTowerJessieJamesText4:: + text "Looks like TEAM" + line "ROCKET's blasting" + cont "off again!@@" + _TowerRescueFujiText:: text "MR.FUJI: Heh? You" line "came to save me?" @@ -23,56 +47,3 @@ _TowerRescueFujiText:: cont "HOUSE at the foot" cont "of this tower." done - -_PokemonTower7BattleText1:: - text "What do you want?" - line "Why are you here?" - done - -_PokemonTower7EndBattleText1:: - text "I give up!" - prompt - -_PokemonTower7AfterBattleText1:: - text "I'm not going to" - line "forget this!" - done - -_PokemonTower7BattleText2:: - text "This old guy came" - line "and complained" - cont "about us harming" - cont "useless #MON!" - - para "We're talking it" - line "over as adults!" - done - -_PokemonTower7EndBattleText2:: - text "Please!" - line "No more!" - prompt - -_PokemonTower7AfterBattleText2:: - text "#MON are only" - line "good for making" - cont "money!" - - para "Stay out of our" - line "business!" - done - -_PokemonTower7BattleText3:: - text "You're not saving" - line "anyone, kid!" - done - -_PokemonTower7EndBattleText3:: - text "Don't" - line "fight us ROCKETs!" - prompt - -_PokemonTower7AfterBattleText3:: - text "You're not getting" - line "away with this!" - done diff --git a/text/maps/reds_house_1f.asm b/text/maps/reds_house_1f.asm index 8b82f2de..e93450da 100644 --- a/text/maps/reds_house_1f.asm +++ b/text/maps/reds_house_1f.asm @@ -1,7 +1,7 @@ _MomWakeUpText:: text "MOM: Right." line "All boys leave" - cont "home some day." + cont "home someday." cont "It said so on TV." para "PROF.OAK, next" @@ -10,9 +10,14 @@ _MomWakeUpText:: done _MomHealText1:: - text "MOM: ",$52,"!" - line "You should take a" - cont "quick rest." + text "MOM: ",$52,", if" + line "you drive your" + cont "#MON too hard," + cont "they'll dislike" + cont "you." + + para "You should take a" + line "rest." prompt _MomHealText2:: diff --git a/text/maps/rock_tunnel_b2f_1.asm b/text/maps/rock_tunnel_b2f.asm index 1a565eb3..d0437de7 100644 --- a/text/maps/rock_tunnel_b2f_1.asm +++ b/text/maps/rock_tunnel_b2f.asm @@ -106,3 +106,24 @@ _RockTunnel2EndBattleText8:: text "Fired" line "away!" prompt + +_RockTunnel2AfterBattleText8:: + text "I'll raise my" + line "#MON to beat" + cont "yours, kid!" + done + +_RockTunnel2BattleText9:: + text "I draw #MON" + line "when I'm home." + done + +_RockTunnel2EndBattleText9:: + text "Whew!" + line "I'm exhausted!" + prompt + +_RockTunnel2AfterBattleText9:: + text "I'm an artist," + line "not a fighter." + done diff --git a/text/maps/rock_tunnel_b2f_2.asm b/text/maps/rock_tunnel_b2f_2.asm deleted file mode 100644 index e8e45a7f..00000000 --- a/text/maps/rock_tunnel_b2f_2.asm +++ /dev/null @@ -1,20 +0,0 @@ -_RockTunnel2AfterBattleText8:: - text "I'll raise my" - line "#MON to beat" - cont "yours, kid!" - done - -_RockTunnel2BattleText9:: - text "I draw #MON" - line "when I'm home." - done - -_RockTunnel2EndBattleText9:: - text "Whew!" - line "I'm exhausted!" - prompt - -_RockTunnel2AfterBattleText9:: - text "I'm an artist," - line "not a fighter." - done diff --git a/text/maps/rocket_hideout_b4f.asm b/text/maps/rocket_hideout_b4f.asm index f3ba43f3..d9e13457 100644 --- a/text/maps/rocket_hideout_b4f.asm +++ b/text/maps/rocket_hideout_b4f.asm @@ -1,3 +1,26 @@ +_RocketHideoutJessieJamesText1:: + text "Not another step," + line "brat!@@" + +_RocketHideoutJessieJamesText2:: + text "How dare you" + line "humiliate us at" + cont "MT.MOON!" + + para "It's payback time," + line "you brat!" + done + +_RocketHideoutJessieJamesText3:: + text "Such" + line "a dreadful twerp!" + prompt + +_RocketHideoutJessieJamesText4:: + text "Looks like TEAM" + line "ROCKET's blasting" + cont "off again!@@" + _RocketHideout4Text_4557a:: text "So! I must say, I" line "am impressed you" @@ -26,38 +49,6 @@ _RocketHideout4Text_45584:: line "again..." done -_RocketHideout4BattleText2:: - text "I know you! You" - line "ruined our plans" - cont "at MT.MOON!" - done - -_RocketHideout4EndBattleText2:: - text "Burned" - line "again!" - prompt - -_RocketHide4AfterBattleText2:: - text "Do you have" - line "something against" - cont "TEAM ROCKET?" - done - -_RocketHideout4BattleText3:: - text "How can you not" - line "see the beauty of" - cont "our evil?" - done - -_RocketHideout4EndBattleText3:: - text "Ayaya!" - prompt - -_RocketHide4AfterBattleText3:: - text "BOSS! I'm sorry I" - line "failed you!" - done - _RocketHideout4BattleText4:: text "The elevator" line "doesn't work? Who" diff --git a/text/maps/route_10.asm b/text/maps/route_10.asm index 057ddcb5..a56018f0 100644 --- a/text/maps/route_10.asm +++ b/text/maps/route_10.asm @@ -33,7 +33,7 @@ _Route10AfterBattleText2:: done _Route10BattleText3:: - text "Hi kid, want to" + text "Hi, kid, want to" line "see my #MON?" done diff --git a/text/maps/route_11_1.asm b/text/maps/route_11.asm index 13e37bdf..451d2bec 100644 --- a/text/maps/route_11_1.asm +++ b/text/maps/route_11.asm @@ -131,3 +131,32 @@ _Route11BattleText9:: text "Watch out for" line "live wires!" done + +_Route11EndBattleText9:: + text "Whoa!" + line "You spark plug!" + prompt + +_Route11AfterBattleText9:: + text "Well, better get" + line "back to work." + done + +_Route11BattleText10:: + text "My #MON should" + line "be ready by now!" + done + +_Route11EndBattleText10:: + text "Too" + line "much, too young!" + prompt + +_Route11AfterBattleText10:: + text "I better go find" + line "stronger ones!" + done + +_Route11Text11:: + text "DIGLETT's CAVE" + done diff --git a/text/maps/route_11_2.asm b/text/maps/route_11_2.asm deleted file mode 100644 index b9b68d6d..00000000 --- a/text/maps/route_11_2.asm +++ /dev/null @@ -1,28 +0,0 @@ -_Route11EndBattleText9:: - text "Whoa!" - line "You spark plug!" - prompt - -_Route11AfterBattleText9:: - text "Well, better get" - line "back to work." - done - -_Route11BattleText10:: - text "My #MON should" - line "be ready by now!" - done - -_Route11EndBattleText10:: - text "Too" - line "much, too young!" - prompt - -_Route11AfterBattleText10:: - text "I better go find" - line "stronger ones!" - done - -_Route11Text11:: - text "DIGLETT's CAVE" - done diff --git a/text/maps/route_12.asm b/text/maps/route_12.asm index 82696fda..27befda5 100644 --- a/text/maps/route_12.asm +++ b/text/maps/route_12.asm @@ -109,7 +109,7 @@ _Route12EndBattleText6:: _Route12AfterBattleText6:: text "It's all right." line "Losing doesn't" - cont "bug me any more." + cont "bug me anymore." done _Route12BattleText7:: diff --git a/text/maps/route_12_gate_upstairs.asm b/text/maps/route_12_gate_upstairs.asm index 1f2af788..a18e3d57 100644 --- a/text/maps/route_12_gate_upstairs.asm +++ b/text/maps/route_12_gate_upstairs.asm @@ -5,7 +5,7 @@ _TM39PreReceiveText:: para "You can have this" line "TM. I don't need" - cont "it any more..." + cont "it anymore..." prompt _ReceivedTM39Text:: diff --git a/text/maps/route_14.asm b/text/maps/route_14.asm index 18e85ed4..9a9de78c 100644 --- a/text/maps/route_14.asm +++ b/text/maps/route_14.asm @@ -10,7 +10,7 @@ _Route14EndBattleText1:: prompt _Route14AfterBattleText1:: - text "You have some HMs" + text "You have some HMs," line "right? #MON" cont "can't ever forget" cont "those moves." diff --git a/text/maps/route_16.asm b/text/maps/route_16.asm index 45265829..2ef6b02a 100644 --- a/text/maps/route_16.asm +++ b/text/maps/route_16.asm @@ -19,7 +19,7 @@ _Route16BattleText2:: done _Route16EndBattleText2:: - text "Knock" + text "Knock-" line "out!" prompt diff --git a/text/maps/route_17.asm b/text/maps/route_17.asm index a0affd90..f7f59683 100644 --- a/text/maps/route_17.asm +++ b/text/maps/route_17.asm @@ -133,7 +133,7 @@ _Route17AfterBattleText9:: done _Route17BattleText10:: - text "Get lost kid!" + text "Get lost, kid!" line "I'm bushed!" done diff --git a/text/maps/route_22.asm b/text/maps/route_22.asm index f2d7ae96..52d1a4c7 100644 --- a/text/maps/route_22.asm +++ b/text/maps/route_22.asm @@ -1,3 +1,36 @@ +_Route22RivalDefeatedText1:: + text "Awww!" + line "You just lucked" + cont "out!" + prompt + +_Route22Text_511bc:: + text $53, ": What?" + line "Why do I have 2" + cont "#MON?" + + para "You should catch" + cont "some more too!" + prompt + +_Route22RivalDefeatedText2:: + text "What!?" + + para "I was just" + line "careless!" + prompt + +_Route22Text_511d0:: + text $53, ": Hahaha!" + line $52, "! That's" + cont "your best? You're" + cont "nowhere near as" + cont "good as me, pal!" + + para "Go train some" + line "more! You loser!" + prompt + _Route22RivalBeforeBattleText1:: text $53, ": Hey!" line $52, "!" @@ -31,21 +64,6 @@ _Route22RivalAfterBattleText1:: cont "a move on!" done -_Route22RivalDefeatedText1:: - text "Awww!" - line "You just lucked" - cont "out!" - prompt - -_Route22Text_511bc:: - text $53, ": What?" - line "Why do I have 2" - cont "#MON?" - - para "You should catch" - cont "some more too!" - prompt - _Route22RivalBeforeBattleText2:: text $53, ": What?" line $52, "! What a" @@ -59,9 +77,9 @@ _Route22RivalBeforeBattleText2:: line "the BADGEs too?" cont "That's cool!" - para "Then I'll whip you" - line $52, " as a" - cont "warm up for" + para "Then I'll whip" + line "you, ", $52, ", as" + cont "a warmup for" cont "#MON LEAGUE!" para "Come on!" @@ -80,24 +98,6 @@ _Route22RivalAfterBattleText2:: cont "here. Smell ya!" done -_Route22RivalDefeatedText2:: - text "What!?" - - para "I was just" - line "careless!" - prompt - -_Route22Text_511d0:: - text $53, ": Hahaha!" - line $52, "! That's" - cont "your best? You're" - cont "nowhere near as" - cont "good as me, pal!" - - para "Go train some" - line "more! You loser!" - prompt - _Route22FrontGateText:: text "#MON LEAGUE" line "Front Gate" diff --git a/text/maps/route_24.asm b/text/maps/route_24.asm new file mode 100644 index 00000000..475a2602 --- /dev/null +++ b/text/maps/route_24.asm @@ -0,0 +1,183 @@ +_Route24Text_51510:: + text "Congratulations!" + line "You beat our 5" + cont "contest trainers!@@" + +_Route24Text_51515:: + text "" + para "You just earned a" + line "fabulous prize!" + prompt + +_Route24Text_5151a:: + text "<PLAYER> received" + line "a @" + TX_RAM wcf4b + text "!@@" + +_Route24Text_51521:: + text "You don't have" + line "any room!" + done + +_Route24Text_51526:: + text "By the way, would" + line "you like to join" + cont "TEAM ROCKET?" + + para "We're a group" + line "dedicated to evil" + cont "using #MON!" + + para "Want to join?" + + para "Are you sure?" + + para "Come on, join us!" + + para "I'm telling you" + line "to join!" + + para "OK, you need" + line "convincing!" + + para "I'll make you an" + line "offer you can't" + cont "refuse!" + done + +_Route24Text_5152b:: + text "Arrgh!" + line "You are good!" + prompt + +_Route24Text_51530:: + text "With your ability," + line "you could become" + cont "a top leader in" + cont "TEAM ROCKET!" + done + +_Route24BattleText1:: + text "I saw your feat" + line "from the grass!" + done + +_Route24EndBattleText1:: + text "I" + line "thought not!" + prompt + +_Route24AfterBattleText1:: + text "I hid because the" + line "people on the" + cont "bridge scared me!" + done + +_Route24BattleText2:: + text "OK! I'm No. 5!" + line "I'll stomp you!" + done + +_Route24EndBattleText2:: + text "Whoa!" + line "Too much!" + prompt + +_Route24AfterBattleText2:: + text "I did my best, I" + line "have no regrets!" + done + +_Route24BattleText3:: + text "I'm No. 4!" + line "Getting tired?" + done + +_Route24EndBattleText3:: + text "I lost" + line "too!" + prompt + +_Route24AfterBattleText3:: + text "I did my best, so" + line "I've no regrets!" + done + +_Route24BattleText4:: + text "Here's No. 3!" + line "I won't be easy!" + done + +_Route24EndBattleText4:: + text "Ow!" + line "Stomped flat!" + prompt + +_Route24AfterBattleText4:: + text "I did my best, I" + line "have no regrets!" + done + +_Route24BattleText5:: + text "I'm second!" + line "Now it's serious!" + done + +_Route24EndBattleText5:: + text "How could I" + line "lose?" + prompt + +_Route24AfterBattleText5:: + text "I did my best, I" + line "have no regrets!" + done + +_Route24BattleText6:: + text "This is NUGGET" + line "BRIDGE! Beat us 5" + cont "trainers and win" + cont "a fabulous prize!" + + para "Think you got" + line "what it takes?" + done + +_Route24EndBattleText6:: + text "Whoo!" + line "Good stuff!" + prompt + +_Route24AfterBattleText6:: + text "I did my best, I" + line "have no regrets!" + done + +_Route24DamianText1:: + text "I'm not good at" + line "raising #MON." + + para "I should release" + line "my CHARMANDER" + cont "because I haven't" + cont "raised it well..." + + para "If you promise me" + line "you'll care for" + cont "it, it's yours." + done + +_Route24DamianText2:: + text "Take good care of" + line "my CHARMANDER!@@" + +_Route24DamianText3:: + text "Oh... I'd better" + line "release it then." + done + +_Route24DamianText4:: + text "How's CHARMANDER" + line "doing?" + done diff --git a/text/maps/route_24_1.asm b/text/maps/route_24_1.asm deleted file mode 100644 index 25079b2f..00000000 --- a/text/maps/route_24_1.asm +++ /dev/null @@ -1,64 +0,0 @@ -_Route24Text_51510:: - text "Congratulations!" - line "You beat our 5" - cont "contest trainers!@@" - -_Route24Text_51515:: - db $0 - para "You just earned a" - line "fabulous prize!" - prompt - -_Route24Text_5151a:: - text $52, " received" - line "a @" - TX_RAM wcf4b - text "!@@" - -_Route24Text_51521:: - text "You don't have" - line "any room!" - done - -_Route24Text_51526:: - text "By the way, would" - line "you like to join" - cont "TEAM ROCKET?" - - para "We're a group" - line "dedicated to evil" - cont "using #MON!" - - para "Want to join?" - - para "Are you sure?" - - para "Come on, join us!" - - para "I'm telling you" - line "to join!" - - para "OK, you need" - line "convincing!" - - para "I'll make you an" - line "offer you can't" - cont "refuse!" - done - -_Route24Text_5152b:: - text "Arrgh!" - line "You are good!" - prompt - -_Route24Text_51530:: - text "With your ability," - line "you could become" - cont "a top leader in" - cont "TEAM ROCKET!" - done - -_Route24BattleText1:: - text "I saw your feat" - line "from the grass!" - done diff --git a/text/maps/route_24_2.asm b/text/maps/route_24_2.asm deleted file mode 100644 index 325dea13..00000000 --- a/text/maps/route_24_2.asm +++ /dev/null @@ -1,90 +0,0 @@ -_Route24EndBattleText1:: - text "I" - line "thought not!" - prompt - -_Route24AfterBattleText1:: - text "I hid because the" - line "people on the" - cont "bridge scared me!" - done - -_Route24BattleText2:: - text "OK! I'm No. 5!" - line "I'll stomp you!" - done - -_Route24EndBattleText2:: - text "Whoa!" - line "Too much!" - prompt - -_Route24AfterBattleText2:: - text "I did my best, I" - line "have no regrets!" - done - -_Route24BattleText3:: - text "I'm No. 4!" - line "Getting tired?" - done - -_Route24EndBattleText3:: - text "I lost" - line "too!" - prompt - -_Route24AfterBattleText3:: - text "I did my best, so" - line "I've no regrets!" - done - -_Route24BattleText4:: - text "Here's No. 3!" - line "I won't be easy!" - done - -_Route24EndBattleText4:: - text "Ow!" - line "Stomped flat!" - prompt - -_Route24AfterBattleText4:: - text "I did my best, I" - line "have no regrets!" - done - -_Route24BattleText5:: - text "I'm second!" - line "Now it's serious!" - done - -_Route24EndBattleText5:: - text "How could I" - line "lose?" - prompt - -_Route24AfterBattleText5:: - text "I did my best, I" - line "have no regrets!" - done - -_Route24BattleText6:: - text "This is NUGGET" - line "BRIDGE! Beat us 5" - cont "trainers and win" - cont "a fabulous prize!" - - para "Think you got" - line "what it takes?" - done - -_Route24EndBattleText6:: - text "Whoo!" - line "Good stuff!" - prompt - -_Route24AfterBattleText6:: - text "I did my best, I" - line "have no regrets!" - done diff --git a/text/maps/route_25.asm b/text/maps/route_25.asm index 325ab348..4786d830 100644 --- a/text/maps/route_25.asm +++ b/text/maps/route_25.asm @@ -56,8 +56,8 @@ _Route25BattleText4:: done _Route25EndBattleText4:: - text "I was in" - line "bad condition!" + text "I'm in" + line "a slump!" prompt _Route25AfterBattleText4:: diff --git a/text/maps/route_3.asm b/text/maps/route_3.asm index 966a0786..14d44e64 100644 --- a/text/maps/route_3.asm +++ b/text/maps/route_3.asm @@ -66,8 +66,8 @@ _Route3BattleText4:: _Route3EndBattleText4:: text "If I" - line "had new #MON I" - cont "would've won!" + line "had new #MON," + cont "I would've won!" prompt _Route3AfterBattleText4:: diff --git a/text/maps/route_6.asm b/text/maps/route_6.asm index c48b5d3d..71760449 100644 --- a/text/maps/route_6.asm +++ b/text/maps/route_6.asm @@ -1,30 +1,37 @@ _Route6BattleText1:: - text "Who's there?" - line "Quit listening in" - cont "on us!" + text "I'm doing this" + line "out of love." + cont "Leave me alone!" done _Route6EndBattleText1:: - text "I" - line "just can't win!" + text "No," + line "this can't be..." prompt _Route6AfterBattleText1:: - text "Whisper..." - line "whisper..." + text "My love will leave" + line "me in disgust." done _Route6BattleText2:: - text "Excuse me! This" - line "is a private" - cont "conversation!" + text "I'm training for" + line "my love. Don't" + cont "bother me!" done _Route6EndBattleText2:: - text "Ugh!" - line "I hate losing!" + text "My" + line "textbook never..." prompt +_Route6AfterBattleText2:: + text "Now I understand," + line "#MON isn't" + cont "about calculated" + cont "numbers." + done + _Route6BattleText3:: text "There aren't many" line "bugs out here." diff --git a/text/maps/route_8.asm b/text/maps/route_8.asm index 57a9a5f9..c0988d70 100644 --- a/text/maps/route_8.asm +++ b/text/maps/route_8.asm @@ -104,7 +104,7 @@ _Route8EndBattleText7:: prompt _Route8AfterBattleText7:: - text "SAFFRON's gate" + text "SAFFRON's gate-" line "keeper won't let" cont "us through." cont "He's so mean!" diff --git a/text/maps/route_9.asm b/text/maps/route_9_1.asm index 9975000d..741c990c 100644 --- a/text/maps/route_9.asm +++ b/text/maps/route_9_1.asm @@ -15,19 +15,20 @@ _Route9AfterBattleText1:: cont "dark tunnel ahead." done -_Route9BattleText2:: - text "Who's that walking" - line "with those good" - cont "looking #MON?" +_Route9BattleTextAJ:: + text "I aim to be the" + line "ultimate trainer!" done -_Route9EndBattleText2:: - text "Out" - line "like a light!" +_Route9EndBattleTextAJ:: + text "My" + line "SANDSHREW lost?" prompt -_Route9AfterBattleText2:: - text "Keep walking!" +_Route9AfterBattleTextAJ:: + text "I'll restart my" + line "100-win streak" + cont "with SANDSHREW." done _Route9BattleText3:: @@ -133,25 +134,3 @@ _Route9AfterBattleText8:: line "Us hearty guys" cont "always laugh!" done - -_Route9BattleText9:: - text "Go, my super bug" - line "#MON!" - done - -_Route9EndBattleText9:: - text "My" - line "bugs..." - prompt - -_Route9AfterBattleText9:: - text "If you don't like" - line "bug #MON, you" - cont "bug me!" - done - -_Route9Text11:: - text "ROUTE 9" - line "CERULEAN CITY-" - cont "ROCK TUNNEL" - done diff --git a/text/maps/route_9_2.asm b/text/maps/route_9_2.asm new file mode 100755 index 00000000..f3803618 --- /dev/null +++ b/text/maps/route_9_2.asm @@ -0,0 +1,21 @@ +_Route9BattleText9:: + text "Go, my super bug" + line "#MON!" + done + +_Route9EndBattleText9:: + text "My" + line "bugs..." + prompt + +_Route9AfterBattleText9:: + text "If you don't like" + line "bug #MON, you" + cont "bug me!" + done + +_Route9Text11:: + text "ROUTE 9" + line "CERULEAN CITY-" + cont "ROCK TUNNEL" + done diff --git a/text/maps/safari_zone_entrance.asm b/text/maps/safari_zone_entrance.asm index 8a018b2d..065de6a9 100644 --- a/text/maps/safari_zone_entrance.asm +++ b/text/maps/safari_zone_entrance.asm @@ -3,6 +3,25 @@ _SafariZoneEntranceText1:: line "SAFARI ZONE!" done +SafariZoneEntranceText_9e814:: + text "Leaving early?@@" + +_SafariZoneEntranceText_753bb:: + text "Please return any" + line "SAFARI BALLs you" + cont "have left." + done + +_SafariZoneEntranceText_753c0:: + text "Good Luck!" + done + +_SafariZoneEntranceText_753c5:: + text "Did you get a" + line "good haul?" + cont "Come again!" + done + SafariZoneEntranceText_9e6e4:: text "For just ¥500," line "you can catch all" @@ -13,7 +32,9 @@ SafariZoneEntranceText_9e6e4:: line "join the hunt?@@" SafariZoneEntranceText_9e747:: - text "That'll be ¥500" + text "That'll be ¥@" + TX_BCD wPriceTemp, $c3 + text "," line "please!" para "We only use a" @@ -41,25 +62,6 @@ _SafariZoneEntranceText_7536a:: line "money!" done -SafariZoneEntranceText_9e814:: - text "Leaving early?@@" - -_SafariZoneEntranceText_753bb:: - text "Please return any" - line "SAFARI BALLs you" - cont "have left." - done - -_SafariZoneEntranceText_753c0:: - text "Good Luck!" - done - -_SafariZoneEntranceText_753c5:: - text "Did you get a" - line "good haul?" - cont "Come again!" - done - _SafariZoneEntranceText_753e6:: text "Hi! Is it your" line "first time here?" @@ -91,3 +93,48 @@ _SafariZoneEntranceText_753f0:: text "Sorry, you're a" line "regular here!" done + +_SafariZoneLowCostText1:: + db 0 + para "Oh, all right, pay" + line "me what you have." + prompt + +_SafariZoneLowCostText2:: + text "But, I can't give" + line "you all 30 BALLs." + done + +_SafariZoneLowCostText3:: + db 0 + para "You're persistent," + line "aren't you?" + + para "OK, you can go in" + line "for free, but" + cont "just this once!@@" + +_SafariZoneLowCostText4:: + db 0 + done + +_SafariZoneLowCostText5:: + text "I'm sorry, but you" + line "have to pay to" + cont "enter." + done + +_SafariZoneLowCostText6:: + text "You can't enter" + line "without paying!" + done + +_SafariZoneLowCostText7:: + text "I said, no money," + line "no entry!" + done + +_SafariZoneLowCostText8:: + text "Read my lips, NO!" + line "Get it?" + done diff --git a/text/maps/saffron_gates.asm b/text/maps/saffron_gates.asm index c16e880e..0fd11d88 100644 --- a/text/maps/saffron_gates.asm +++ b/text/maps/saffron_gates.asm @@ -3,7 +3,7 @@ _SaffronGateText_1dfe7:: line "Gee, I'm thirsty," cont "though!" - para "Oh wait there," + para "Oh, wait there," line "the road's closed." done @@ -18,7 +18,7 @@ _SaffronGateText_8aaa9:: _SaffronGateText_1dff1:: db $0 para "..." - line "Glug glug..." + line "Glug, glug..." cont "..." cont "Gulp..." cont "If you want to go" diff --git a/text/maps/saffron_gym.asm b/text/maps/saffron_gym.asm index ba57e35d..23cc211b 100644 --- a/text/maps/saffron_gym.asm +++ b/text/maps/saffron_gym.asm @@ -131,8 +131,7 @@ _SaffronGymEndBattleText2:: _SaffronGymAfterBattleText2:: text "Psychic #MON" - line "fear only ghosts" - cont "and bugs!" + line "fear only bugs!" done _SaffronGymBattleText3:: diff --git a/text/maps/school.asm b/text/maps/school.asm index f6041e0d..3c5f6379 100644 --- a/text/maps/school.asm +++ b/text/maps/school.asm @@ -4,6 +4,13 @@ _SchoolText1:: cont "my notes." done +_SchoolText3:: + text "Sis says #MON" + line "will become tame" + cont "if you treat them" + cont "nicely." + done + _SchoolText2:: text "Okay!" diff --git a/text/maps/silph_co_10f.asm b/text/maps/silph_co_10f.asm index e916c64a..09894764 100644 --- a/text/maps/silph_co_10f.asm +++ b/text/maps/silph_co_10f.asm @@ -1,6 +1,6 @@ _SilphCo10Text_5a1d3:: text "Waaaaa!" - cont "I'm scared!" + line "I'm scared!" done _SilphCo10Text_5a1d8:: @@ -40,3 +40,27 @@ _SilphCo10AfterBattleText2:: line "with beating me?" cont "Then go on home!" done + +_SilphCoJessieJamesText1:: + text "Hold it right" + line "there, brat!@@" + +_SilphCoJessieJamesText2:: + text "Our BOSS is in a" + line "meeting!" + + para "You better not" + line "disturb him!" + done + +_SilphCoJessieJamesText3:: + text "Like" + line "always..." + prompt + +_SilphCoJessieJamesText4:: + text "TEAM ROCKET, blast" + line "off at the speed" + cont "of light!" + + para "Again...@@" diff --git a/text/maps/silph_co_11f.asm b/text/maps/silph_co_11f.asm index 7fccab4f..6be83c5d 100644 --- a/text/maps/silph_co_11f.asm +++ b/text/maps/silph_co_11f.asm @@ -58,7 +58,7 @@ _SilphCo11Text2:: done _SilphCo11Text3:: - text "Ah ", $52, "!" + text "Ah, ", $52, "!" line "So we meet again!" para "The PRESIDENT and" @@ -70,7 +70,7 @@ _SilphCo11Text3:: line "out of grown-up" cont "matters..." - para "Or, experience a" + para "or, experience a" line "world of pain!" done @@ -96,21 +96,6 @@ _SilphCo10Text_62335:: line "shall return!" done -_SilphCo11BattleText1:: - text "Stop right there!" - line "Don't you move!" - done - -_SilphCo11EndBattleText1:: - text "Don't..." - line "Please!" - prompt - -_SilphCo11AfterBattleText1:: - text "So, you want to" - line "see my BOSS?" - done - _SilphCo11BattleText2:: text "Halt! Do you have" line "an appointment" @@ -127,8 +112,3 @@ _SilphCo11AfterBattleText2:: line "my BOSS likes his" cont "#MON tough!" done - -_SilphCo10Text_6237b:: - text "The monitor has" - line "#MON on it!" - done diff --git a/text/maps/silph_co_2f.asm b/text/maps/silph_co_2f.asm index a48ebd23..5ef349d5 100644 --- a/text/maps/silph_co_2f.asm +++ b/text/maps/silph_co_2f.asm @@ -72,7 +72,7 @@ _SilphCo2EndBattleText3:: prompt _SilphCo2AfterBattleText3:: - text "Diamond shaped" + text "Diamond-shaped" line "tiles are" cont "teleport blocks!" diff --git a/text/maps/silph_co_5f.asm b/text/maps/silph_co_5f.asm new file mode 100644 index 00000000..9c8bfd41 --- /dev/null +++ b/text/maps/silph_co_5f.asm @@ -0,0 +1,107 @@ +_SilphCo5Text_1a010:: + text "TEAM ROCKET is" + line "in an uproar over" + cont "some intruder." + cont "That's you right?" + done + +_SilphCo5Text_1a015:: + text "TEAM ROCKET took" + line "off! You're our" + cont "hero! Thank you!" + done + +_SilphCo5BattleText2:: + text "I heard a kid was" + line "wandering around." + done + +_SilphCo5EndBattleText2:: + text "Boom!" + prompt + +_SilphCo5AfterBattleText2:: + text "It's not smart" + line "to pick a fight" + cont "with TEAM ROCKET!" + done + +_SilphCo5BattleText3:: + text "We study #" + line "BALL technology" + cont "on this floor!" + done + +_SilphCo5EndBattleText3:: + text "Dang!" + line "Blast it!" + prompt + +_SilphCo5AfterBattleText3:: + text "We worked on the" + line "ultimate #" + cont "BALL which would" + cont "catch anything!" + done + +_SilphCo5BattleText4:: + text "Whaaat? There" + line "shouldn't be any" + cont "children here!" + done + +_SilphCo5EndBattleText4:: + text "Oh" + line "goodness!" + prompt + +_SilphCo5AfterBattleText4:: + text "You're only on 5F." + line "It's a long way" + cont "to my BOSS!" + done + +_SilphCo5BattleText5:: + text "Show TEAM ROCKET" + line "a little respect!" + done + +_SilphCo5EndBattleText5:: + text "Cough..." + line "Cough..." + prompt + +_SilphCo5AfterBattleText5:: + text "Which reminds me." + + para "KOFFING evolves" + line "into WEEZING!" + done + +_SilphCo5Text9:: + text "It's a #MON" + line "REPORT!" + + para "#MON LAB" + line "created PORYGON," + cont "the first virtual" + cont "reality #MON." + done + +_SilphCo5Text10:: + text "It's a #MON" + line "REPORT!" + + para "Over 160 #MON" + line "techniques have" + cont "been confirmed." + done + +_SilphCo5Text11:: + text "It's a #MON" + line "REPORT!" + + para "4 #MON evolve" + line "only when traded" + cont "by link-cable." + done diff --git a/text/maps/silph_co_5f_1.asm b/text/maps/silph_co_5f_1.asm deleted file mode 100644 index dab42539..00000000 --- a/text/maps/silph_co_5f_1.asm +++ /dev/null @@ -1,51 +0,0 @@ -_SilphCo5Text_1a010:: - text "TEAM ROCKET is" - line "in an uproar over" - cont "some intruder." - cont "That's you right?" - done - -_SilphCo5Text_1a015:: - text "TEAM ROCKET took" - line "off! You're our" - cont "hero! Thank you!" - done - -_SilphCo5BattleText2:: - text "I heard a kid was" - line "wandering around." - done - -_SilphCo5EndBattleText2:: - text "Boom!" - prompt - -_SilphCo5AfterBattleText2:: - text "It's not smart" - line "to pick a fight" - cont "with TEAM ROCKET!" - done - -_SilphCo5BattleText3:: - text "We study #" - line "BALL technology" - cont "on this floor!" - done - -_SilphCo5EndBattleText3:: - text "Dang!" - line "Blast it!" - prompt - -_SilphCo5AfterBattleText3:: - text "We worked on the" - line "ultimate #" - cont "BALL which would" - cont "catch anything!" - done - -_SilphCo5BattleText4:: - text "Whaaat? There" - line "shouldn't be any" - cont "children here?" - done diff --git a/text/maps/silph_co_5f_2.asm b/text/maps/silph_co_5f_2.asm deleted file mode 100644 index 3c1b8ead..00000000 --- a/text/maps/silph_co_5f_2.asm +++ /dev/null @@ -1,55 +0,0 @@ -_SilphCo5EndBattleText4:: - text "Oh" - line "goodness!" - prompt - -_SilphCo5AfterBattleText4:: - text "You're only on 5F." - line "It's a long way" - cont "to my BOSS!" - done - -_SilphCo5BattleText5:: - text "Show TEAM ROCKET" - line "a little respect!" - done - -_SilphCo5EndBattleText5:: - text "Cough..." - line "Cough..." - prompt - -_SilphCo5AfterBattleText5:: - text "Which reminds me." - - para "KOFFING evolves" - line "into WEEZING!" - done - -_SilphCo5Text9:: - text "It's a #MON" - line "REPORT!" - - para "#MON LAB" - line "created PORYGON," - cont "the first virtual" - cont "reality #MON." - done - -_SilphCo5Text10:: - text "It's a #MON" - line "REPORT!" - - para "Over 160 #MON" - line "techniques have" - cont "been confirmed." - done - -_SilphCo5Text11:: - text "It's a #MON" - line "REPORT!" - - para "4 #MON evolve" - line "only when traded" - cont "by link-cable." - done diff --git a/text/maps/silph_co_7f.asm b/text/maps/silph_co_7f.asm index e6ad11c1..0373355a 100644 --- a/text/maps/silph_co_7f.asm +++ b/text/maps/silph_co_7f.asm @@ -79,7 +79,7 @@ _SilphCo7Text_51e4b:: done _SilphCo7BattleText1:: - text "Oh ho! I smell a" + text "Aha! I smell a" line "little rat!" done @@ -167,7 +167,7 @@ _SilphCo7Text_51ec3:: done _SilphCo7Text_51ec8:: - text "Oh ho!" + text "Oh-oh!" line "So, you are ready" cont "for BOSS ROCKET!" prompt diff --git a/text/maps/ss_anne_6.asm b/text/maps/ss_anne_6.asm index 7fcc9973..b7784019 100644 --- a/text/maps/ss_anne_6.asm +++ b/text/maps/ss_anne_6.asm @@ -47,7 +47,7 @@ _SSAnne6Text_61807:: prompt _SSAnne6Text_6180c:: - text "Salmon du Salad!" + text "Salade de Salmon!" para "Les guests may" line "gripe it's fish" diff --git a/text/maps/ss_anne_7.asm b/text/maps/ss_anne_7.asm index bb8ca042..a046e600 100644 --- a/text/maps/ss_anne_7.asm +++ b/text/maps/ss_anne_7.asm @@ -27,7 +27,7 @@ _ReceivingHM01Text:: para "Teach it to your" line "#MON and you" cont "can see it CUT" - cont "any time!" + cont "anytime!" prompt _ReceivedHM01Text:: @@ -40,7 +40,7 @@ _SSAnne7Text_61932:: text "CAPTAIN: Whew!" para "Now that I'm not" - line "sick any more, I" + line "sick anymore, I" cont "guess it's time." done diff --git a/text/maps/ss_anne_9.asm b/text/maps/ss_anne_9.asm index a9be8cee..c9b29119 100644 --- a/text/maps/ss_anne_9.asm +++ b/text/maps/ss_anne_9.asm @@ -1,5 +1,5 @@ _SSAnne9Text_61bf2:: - text "In all my travels" + text "In all my travels," line "I've never seen" cont "any #MON sleep" cont "like this one!" @@ -20,32 +20,6 @@ _SSAnne9Text_61c10:: line "down small bushes." done -_SSAnne9Text_61c1f:: - text "Have you gone to" - line "the SAFARI ZONE" - cont "in FUCHSIA CITY?" - - para "It had many rare" - line "kinds of #MON!!" - done - -_SSAnne9Text_61c2e:: - text "Me and my Daddy" - line "think the SAFARI" - cont "ZONE is awesome!" - done - -_SSAnne9Text_61c3d:: - text "The CAPTAIN looked" - line "really sick and" - cont "pale!" - done - -_SSAnne9Text_61c4c:: - text "I hear many people" - line "get seasick!" - done - _SSAnne9BattleText1:: text "Competing against" line "the young keeps" @@ -111,3 +85,29 @@ _SSAnne9AfterBattleText4:: text "Oh, I adore your" line "strong #MON!" done + +_SSAnne9Text_61c1f:: + text "Have you gone to" + line "the SAFARI ZONE" + cont "in FUCHSIA CITY?" + + para "It had many rare" + line "kinds of #MON!!" + done + +_SSAnne9Text_61c2e:: + text "Me and my Daddy" + line "think the SAFARI" + cont "ZONE is awesome!" + done + +_SSAnne9Text_61c3d:: + text "The CAPTAIN looked" + line "really sick and" + cont "pale!" + done + +_SSAnne9Text_61c4c:: + text "I hear many people" + line "get seasick!" + done diff --git a/text/maps/underground_path_route_7_entrance_unused.asm b/text/maps/underground_path_route_7_entrance_unused.asm index 4e0dc3ca..02c95a5c 100644 --- a/text/maps/underground_path_route_7_entrance_unused.asm +++ b/text/maps/underground_path_route_7_entrance_unused.asm @@ -17,17 +17,14 @@ _UGPathRoute7EntranceUnusedText_5d778:: _UGPathRoute7EntranceUnusedText_5d77d:: text "You're here to" line "shop in CELADON?" - para "Just step outside" line "and head west!" done - _UGPathRoute7EntranceUnusedText_5d782:: text "The UNDERGROUND" line "PATH goes beneath" cont "SAFFRON and leads" cont "to LAVENDER." - para "If you're heading" line "to CERULEAN, go" cont "to the building" diff --git a/text/maps/vermilion_city.asm b/text/maps/vermilion_city.asm index ff90cbef..2b2d125f 100644 --- a/text/maps/vermilion_city.asm +++ b/text/maps/vermilion_city.asm @@ -35,7 +35,7 @@ _SSAnneWelcomeText9:: prompt _SSAnneFlashedTicketText:: - text $52, " flashed" + text "<PLAYER> flashed" line "the S.S.TICKET!" para "Great! Welcome to" @@ -43,7 +43,7 @@ _SSAnneFlashedTicketText:: done _SSAnneNoTicketText:: - text $52, " doesn't" + text "<PLAYER> doesn't" line "have the needed" cont "S.S.TICKET." @@ -70,8 +70,8 @@ _VermilionCityText5:: text "MACHOP: Guoh!" line "Gogogoh!@@" -_VermilionCityText14:: - db $0 +_VermilionCityText15:: + text "" para "A MACHOP is" line "stomping the land" cont "flat." @@ -86,13 +86,54 @@ _VermilionCityText6:: line "once a year." done -_VermilionCityText7:: +_OfficerJennyText1:: + text "I just caught a" + line "SQUIRTLE that was" + cont "always getting" + cont "into mischief." + + para "I think it needs a" + line "good trainer to" + cont "set it straight." + done + +_OfficerJennyText2:: + text "You have the" + line "THUNDERBADGE!?" + + para "You must be a" + line "good trainer!" + + para "I just caught a" + line "SQUIRTLE that was" + cont "always getting" + cont "into mischief." + + para "Would you take" + line "good care of it?" + done + +_OfficerJennyText3:: + text "OK! Please treat" + line "SQUIRTLE right!@@" + +_OfficerJennyText4:: + text "Oh... What am I" + line "to do now?" + done + +_OfficerJennyText5:: + text "How is SQUIRTLE" + line "doing?" + done + +_VermilionCityText8:: text "VERMILION CITY" line "The Port of" cont "Exquisite Sunsets" done -_VermilionCityText8:: +_VermilionCityText9:: text "NOTICE!" para "ROUTE 12 may be" @@ -106,13 +147,13 @@ _VermilionCityText8:: para "VERMILION POLICE" done -_VermilionCityText11:: +_VermilionCityText12:: text "#MON FAN CLUB" line "All #MON fans" cont "welcome!" done -_VermilionCityText12:: +_VermilionCityText13:: text "VERMILION CITY" line "#MON GYM" cont "LEADER: LT.SURGE" @@ -121,6 +162,6 @@ _VermilionCityText12:: line "American!" done -_VermilionCityText13:: +_VermilionCityText14:: text "VERMILION HARBOR" done diff --git a/text/maps/vermilion_dock.asm b/text/maps/vermilion_dock.asm index 5d998e82..034de399 100644 --- a/text/maps/vermilion_dock.asm +++ b/text/maps/vermilion_dock.asm @@ -1,3 +1,2 @@ _VermilionDockText1:: - text "" - done + db $0, $57 diff --git a/text/maps/vermilion_gym_2.asm b/text/maps/vermilion_gym.asm index 4fd5e159..a7cce733 100644 --- a/text/maps/vermilion_gym_2.asm +++ b/text/maps/vermilion_gym.asm @@ -1,3 +1,25 @@ +_VermilionGymText_5cb6d:: + text "Ten-hut! Welcome" + line "to VERMILION GYM!" + + para "Will you look at" + line "that, a pint-size" + cont "challenger!" + + para "Hahaha! You've got" + line "big and brassy" + cont "nerves to take me" + cont "on with your puny" + cont "power!" + + para "A #MON battle" + line "is war! I'll show" + cont "you, civilian!" + + para "I'll shock you" + line "into surrender!" + done + _VermilionGymText_5cb72:: text "A little word of" line "advice, kid!" @@ -16,7 +38,7 @@ _VermilionGymText_5cb77:: cont "#MON's SPEED!" para "It also lets your" - line "#MON FLY any" + line "#MON FLY any-" cont "time, kid!" para "You're special," diff --git a/text/maps/vermilion_gym_1.asm b/text/maps/vermilion_gym_1.asm deleted file mode 100644 index f718d899..00000000 --- a/text/maps/vermilion_gym_1.asm +++ /dev/null @@ -1,21 +0,0 @@ -_VermilionGymText_5cb6d:: - text "Hey, kid! What do" - line "you think you're" - cont "doing here?" - - para "You won't live" - line "long in combat!" - cont "That's for sure!" - - para "I tell you kid," - line "electric #MON" - cont "saved me during" - cont "the war!" - - para "They zapped my" - line "enemies into" - cont "paralysis!" - - para "The same as I'll" - line "do to you!" - done diff --git a/text/maps/viridian_city.asm b/text/maps/viridian_city.asm index 17b2ec91..0cfd1fe8 100644 --- a/text/maps/viridian_city.asm +++ b/text/maps/viridian_city.asm @@ -1,3 +1,40 @@ +_ViridianCityText_19219:: ; 2d:4478 + text "First, you need" + line "to weaken the" + cont "target #MON." + done + +_ViridianCityText_1920a:: + text "Ahh, I've had my" + line "coffee now and I" + cont "feel great!" + + para "Sure, you can go" + line "through!" + + para "I'm sorry I was" + line "so rude to you!" + + para "I see you're using" + line "a #DEX." + + para "I'll show you how" + line "to catch #MON" + cont "as my apology." + done + +_OldManTextAfterBattle:: + text "That didn't work!" + line "I must be losing" + cont "my touch." + + para "I've run out of" + line "# BALLs too." + + para "I have to get some" + line "at #MON MART." + done + _ViridianCityText1:: text "Those # BALLs" line "at your waist!" @@ -5,7 +42,7 @@ _ViridianCityText1:: para "It's great that" line "you can carry and" - cont "use #MON any" + cont "use #MON any-" cont "time, anywhere!" done @@ -97,44 +134,21 @@ _TM42NoRoomText:: line "stuff already." done -_ViridianCityText_1920a:: - text "Ahh, I've had my" - line "coffee now and I" - cont "feel great!" - - para "Sure you can go" - line "through!" - - para "Are you in a" - line "hurry?" +_OldManAgainText1:: + text "Hmm? You want me" + line "to show you how" + cont "to catch #MON" + cont "again?" done -_ViridianCityText_1920f:: - text "I see you're using" - line "a #DEX." - - para "When you catch a" - line "#MON, #DEX" - cont "is automatically" - cont "updated." - - para "What? Don't you" - line "know how to catch" - cont "#MON?" - - para "I'll show you" - line "how to then." +_OldManAgainText2:: + text "Dandy! Watch what" + line "I do closely now!" done -_ViridianCityText_19214:: - text "Time is money..." - line "Go along then." - done - -_ViridianCityText_19219:: - text "First, you need" - line "to weaken the" - cont "target #MON." +_OldManAgainText3:: + text "Oh... I'm not good" + line "enough for you." done _ViridianCityText8:: diff --git a/text/maps/viridian_forest.asm b/text/maps/viridian_forest.asm index 813b193a..f88a484c 100644 --- a/text/maps/viridian_forest.asm +++ b/text/maps/viridian_forest.asm @@ -9,7 +9,7 @@ _ViridianForestText1:: _ViridianForestBattleText1:: text "Hey! You have" line "#MON! Come on!" - cont "Let's battle'em!" + cont "Let's battle 'em!" done _ViridianForestEndBattleText1:: @@ -62,6 +62,40 @@ _ViridianFrstAfterBattleText3:: cont "dropped!" done +_ViridianForestBattleTextPikaGirl:: + text "Hi, do you have a" + line "PIKACHU?" + done + +_ViridianForestEndBattleTextPikaGirl:: + text "Oh no," + line "really?" + prompt + +_ViridianForestAfterBattleTextPikaGirl:: + text "I looked forever," + line "but I never found" + cont "a PIKACHU here!" + done + +_ViridianForestBattleTextSamurai:: + text "I'm gonna be the" + line "best. You just" + cont "can't beat me!" + done + +_ViridianForestEndBattleTextSamurai:: + text "After" + line "all I did..." + prompt + +_ViridianForestAfterBattleTextSamurai:: + text "A METAPOD is cool" + line "because its" + cont "attack is its" + cont "defense!" + done + _ViridianForestText8:: text "I ran out of #" line "BALLs to catch" diff --git a/text/maps/viridian_forest_entrance.asm b/text/maps/viridian_forest_entrance.asm index c1a8df22..a5278742 100644 --- a/text/maps/viridian_forest_entrance.asm +++ b/text/maps/viridian_forest_entrance.asm @@ -6,8 +6,11 @@ _ViridianForestEntranceText1:: done _ViridianForestEntranceText2:: - text "RATTATA may be" - line "small, but its" - cont "bite is wicked!" - cont "Did you get one?" + text "You have to roam" + line "far to get new" + cont "kinds of #MON." + + para "Look for other" + line "types outside of" + cont "VIRIDIAN FOREST." done diff --git a/text/maps/viridian_gym.asm b/text/maps/viridian_gym.asm index df04e6d6..795447a5 100644 --- a/text/maps/viridian_gym.asm +++ b/text/maps/viridian_gym.asm @@ -38,7 +38,7 @@ _ViridianGymText_74ad9:: cont "of #MON!" para "Let us meet again" - line "some day!" + line "someday!" cont "Farewell!@@" _ViridianGymText12:: @@ -205,7 +205,7 @@ _ViridianGymEndBattleText8:: prompt _ViridianGymAfterBattleText8:: - text "You can go onto" + text "You can go on to" line "#MON LEAGUE" cont "only by defeating" cont "our GYM LEADER!" diff --git a/text/maps/viridian_mart.asm b/text/maps/viridian_mart.asm index aa199335..5f4e147c 100644 --- a/text/maps/viridian_mart.asm +++ b/text/maps/viridian_mart.asm @@ -20,11 +20,13 @@ ViridianMartParcelQuestText:: line "OAK's PARCEL!@@" _ViridianMartText2:: - text "This shop sells" - line "many ANTIDOTEs." + text "This shop sells a" + line "lot of PARLYZ" + cont "HEALs." done _ViridianMartText3:: - text "No! POTIONs are" - line "all sold out." + text "The shop finally" + line "has some POTIONs" + cont "in stock." done diff --git a/text/maps/viridian_pokecenter.asm b/text/maps/viridian_pokecenter.asm index 4ac18bf6..4ac18bf6 100644..100755 --- a/text/maps/viridian_pokecenter.asm +++ b/text/maps/viridian_pokecenter.asm diff --git a/text/move_names.asm b/text/move_names.asm index f8706ee3..cbb1a322 100644 --- a/text/move_names.asm +++ b/text/move_names.asm @@ -164,4 +164,3 @@ MoveNames:: db "SLASH@" db "SUBSTITUTE@" db "STRUGGLE@" - diff --git a/text/oakspeech.asm b/text/oakspeech.asm index 91aaf5c3..5911092c 100644 --- a/text/oakspeech.asm +++ b/text/oakspeech.asm @@ -53,4 +53,3 @@ _OakSpeechText3:: cont "with #MON" cont "awaits! Let's go!" done - diff --git a/text/pokedex.asm b/text/pokedex.asm index 65f3d89d..7e84a83d 100644 --- a/text/pokedex.asm +++ b/text/pokedex.asm @@ -1,1510 +1,1508 @@ -_RhydonDexEntry:: - text "Protected by an" - next "armor-like hide," - next "it is capable of" +_BulbasaurDexEntry:: + text "It can go for days" + next "without eating a" + next "single morsel." - page "living in molten" - next "lava of 3,600" - next "degrees" + page "In the bulb on" + next "its back, it" + next "stores energy" dex -_KangaskhanDexEntry:: - text "The infant rarely" - next "ventures out of" - next "its mother's" +_IvysaurDexEntry:: + text "The bulb on its" + next "back grows by" + next "drawing energy." - page "protective pouch" - next "until it is 3" - next "years old" + page "It gives off an" + next "aroma when it is" + next "ready to bloom" dex -_NidoranMDexEntry:: - text "Stiffens its ears" - next "to sense danger." - next "The larger its" +_VenusaurDexEntry:: + text "The flower on its" + next "back catches the" + next "sun's rays." - page "horns, the more" - next "powerful its" - next "secreted venom" + page "The sunlight is" + next "then absorbed and" + next "used for energy" dex -_ClefairyDexEntry:: - text "Its magical and" - next "cute appeal has" - next "many admirers." +_CharmanderDexEntry:: + text "The flame at the" + next "tip of its tail" + next "makes a sound as" - page "It is rare and" - next "found only in" - next "certain areas" + page "it burns. You can" + next "only hear it in" + next "quiet places" dex -_SpearowDexEntry:: - text "Eats bugs in" - next "grassy areas. It" - next "has to flap its" +_CharmeleonDexEntry:: + text "Tough fights could" + next "excite this" + next "#MON. When" - page "short wings at" - next "high speed to" - next "stay airborne" + page "excited, it may" + next "blow out bluish-" + next "white flames" dex -_VoltorbDexEntry:: - text "Usually found in" - next "power plants." - next "Easily mistaken" +_CharizardDexEntry:: + text "When expelling a" + next "blast of super" + next "hot fire, the red" - page "for a # BALL," - next "they have zapped" - next "many people" + page "flame at the tip" + next "of its tail burns" + next "more intensely" dex -_NidokingDexEntry:: - text "It uses its" - next "powerful tail in" - next "battle to smash," +_SquirtleDexEntry:: + text "Shoots water at" + next "prey while in the" + next "water." - page "constrict, then" - next "break the prey's" - next "bones" + page "Withdraws into" + next "its shell when in" + next "danger" dex -_SlowbroDexEntry:: - text "The SHELLDER that" - next "is latched onto" - next "SLOWPOKE's tail" +_WartortleDexEntry:: + text "When tapped, this" + next "#MON will pull" + next "in its head, but" - page "is said to feed" - next "on the host's left" - next "over scraps" + page "its tail will" + next "still stick out a" + next "little bit" dex -_IvysaurDexEntry:: - text "When the bulb on" - next "its back grows" - next "large, it appears" +_BlastoiseDexEntry:: + text "Once it takes aim" + next "at its enemy, it" + next "blasts out water" - page "to lose the" - next "ability to stand" - next "on its hind legs" + page "with even more" + next "force than a fire" + next "hose" dex -_ExeggutorDexEntry:: - text "Legend has it that" - next "on rare occasions," - next "one of its heads" +_CaterpieDexEntry:: + text "If you touch the" + next "feeler on top of" + next "its head, it will" - page "will drop off and" - next "continue on as an" - next "EXEGGCUTE" + page "release a horrible" + next "stink to protect" + next "itself" dex -_LickitungDexEntry:: - text "Its tongue can be" - next "extended like a" - next "chameleon's. It" +_MetapodDexEntry:: + text "Hardens its shell" + next "to protect itself." + next "However, a large" - page "leaves a tingling" - next "sensation when it" - next "licks enemies" + page "impact may cause" + next "it to pop out of" + next "its shell" dex -_ExeggcuteDexEntry:: - text "Often mistaken" - next "for eggs." - next "When disturbed," +_ButterfreeDexEntry:: + text "Its wings, covered" + next "with poisonous" + next "powders, repel" - page "they quickly" - next "gather and attack" - next "in swarms" + page "water. This" + next "allows it to fly" + next "in the rain" dex -_GrimerDexEntry:: - text "Appears in filthy" - next "areas. Thrives by" - next "sucking up" +_WeedleDexEntry:: + text "Beware of the" + next "sharp stinger on" + next "its head. It" - page "polluted sludge" - next "that is pumped" - next "out of factories" + page "hides in grass" + next "and bushes where" + next "it eats leaves" dex -_GengarDexEntry:: - text "Under a full moon," - next "this #MON" - next "likes to mimic" +_KakunaDexEntry:: + text "Able to move only" + next "slightly. When" + next "endangered, it" - page "the shadows of" - next "people and laugh" - next "at their fright" + page "may stick out its" + next "stinger and poison" + next "its enemy" dex -_NidoranFDexEntry:: - text "Although small," - next "its venomous" - next "barbs render this" +_BeedrillDexEntry:: + text "It has 3 poisonous" + next "stingers on its" + next "forelegs and its" - page "#MON dangerous." - next "The female has" - next "smaller horns" + page "tail. They are" + next "used to jab its" + next "enemy repeatedly" dex -_NidoqueenDexEntry:: - text "Its hard scales" - next "provide strong" - next "protection. It" +_PidgeyDexEntry:: + text "Very docile. If" + next "attacked, it will" + next "often kick up" - page "uses its hefty" - next "bulk to execute" - next "powerful moves" + page "sand to protect" + next "itself rather" + next "than fight back" dex -_CuboneDexEntry:: - text "Because it never" - next "removes its skull" - next "helmet, no one" +_PidgeottoDexEntry:: + text "This #MON is" + next "full of vitality." + next "It constantly" - page "has ever seen" - next "this #MON's" - next "real face" + page "flies around its" + next "large territory in" + next "search of prey" dex -_RhyhornDexEntry:: - text "Its massive bones" - next "are 1000 times" - next "harder than human" +_PidgeotDexEntry:: + text "This #MON flies" + next "at Mach 2 speed," + next "seeking prey." - page "bones. It can" - next "easily knock a" - next "trailer flying" + page "Its large talons" + next "are feared as" + next "wicked weapons" dex -_LaprasDexEntry:: - text "A #MON that" - next "has been over-" - next "hunted almost to" +_RattataDexEntry:: + text "Will chew on any-" + next "thing with its" + next "fangs. If you see" - page "extinction. It" - next "can ferry people" - next "across the water" + page "one, it is certain" + next "that 40 more live" + next "in the area" dex -_ArcanineDexEntry:: - text "A #MON that" - next "has been admired" - next "since the past" +_RaticateDexEntry:: + text "Its hind feet are" + next "webbed. They act" + next "as flippers, so" - page "for its beauty." - next "It runs agilely" - next "as if on wings" + page "it can swim in" + next "rivers and hunt" + next "for prey" dex -_MewDexEntry:: - text "So rare that it" - next "is still said to" - next "be a mirage by" +_SpearowDexEntry:: + text "Inept at flying" + next "high. However, it" + next "can fly around" - page "many experts. Only" - next "a few people have" - next "seen it worldwide" + page "very fast to" + next "protect its ter-" + next "ritory" dex -_GyaradosDexEntry:: - text "Rarely seen in" - next "the wild. Huge" - next "and vicious, it" +_FearowDexEntry:: + text "A #MON that" + next "dates back many" + next "years. If it" - page "is capable of" - next "destroying entire" - next "cities in a rage" + page "senses danger, it" + next "flies high and" + next "away, instantly" dex -_ShellderDexEntry:: - text "Its hard shell" - next "repels any kind" - next "of attack." +_EkansDexEntry:: + text "The older it gets," + next "the longer it" + next "grows. At night," - page "It is vulnerable" - next "only when its" - next "shell is open" + page "it wraps its long" + next "body around tree" + next "branches to rest" dex -_TentacoolDexEntry:: - text "Drifts in shallow" - next "seas. Anglers who" - next "hook them by" +_ArbokDexEntry:: + text "The frightening" + next "patterns on its" + next "belly have been" - page "accident are" - next "often punished by" - next "its stinging acid" + page "studied. Six" + next "variations have" + next "been confirmed" dex -_GastlyDexEntry:: - text "Almost invisible," - next "this gaseous" - next "#MON cloaks" +_PikachuDexEntry:: + text "It keeps its tail" + next "raised to monitor" + next "its surroundings." - page "the target and" - next "puts it to sleep" - next "without notice" + page "If you yank its" + next "tail, it will try" + next "to bite you" dex -_ScytherDexEntry:: - text "With ninja-like" - next "agility and speed," - next "it can create the" +_RaichuDexEntry:: + text "When electricity" + next "builds up inside" + next "its body, it" - page "illusion that" - next "there is more" - next "than one" + page "becomes feisty." + next "It also glows in" + next "the dark" dex -_StaryuDexEntry:: - text "An enigmatic" - next "#MON that can" - next "effortlessly" +_SandshrewDexEntry:: + text "Its body is dry." + next "When it gets cold" + next "at night, its" - page "regenerate any" - next "appendage it" - next "loses in battle" + page "hide is said to" + next "become coated with" + next "a fine dew" dex -_BlastoiseDexEntry:: - text "A brutal #MON" - next "with pressurized" - next "water jets on its" +_SandslashDexEntry:: + text "It is skilled at" + next "slashing enemies" + next "with its claws." - page "shell. They are" - next "used for high" - next "speed tackles" + page "If broken, they" + next "start to grow back" + next "in a day" dex -_PinsirDexEntry:: - text "If it fails to" - next "crush the victim" - next "in its pincers," +_NidoranFDexEntry:: + text "A mild-mannered" + next "#MON that does" + next "not like to" - page "it will swing it" - next "around and toss" - next "it hard" + page "fight. Beware, its" + next "small horns" + next "secrete venom" dex -_TangelaDexEntry:: - text "The whole body is" - next "swathed with wide" - next "vines that are" +_NidorinaDexEntry:: + text "When resting deep" + next "in its burrow, its" + next "thorns always" - page "similar to sea-" - next "weed. Its vines" - next "shake as it walks" + page "retract." + next "This is proof that" + next "it is relaxed" dex -_GrowlitheDexEntry:: - text "Very protective" - next "of its territory." - next "It will bark and" +_NidoqueenDexEntry:: + text "Tough scales cover" + next "the sturdy body" + next "of this #MON." - page "bite to repel" - next "intruders from" - next "its space" + page "It appears that" + next "the scales grow" + next "in cycles" dex -_OnixDexEntry:: - text "As it grows, the" - next "stone portions of" - next "its body harden" +_NidoranMDexEntry:: + text "Its large ears" + next "are always kept" + next "upright. If it" - page "to become similar" - next "to a diamond, but" - next "colored black" + page "senses danger, it" + next "will attack with a" + next "poisonous sting" dex -_FearowDexEntry:: - text "With its huge and" - next "magnificent wings," - next "it can keep aloft" +_NidorinoDexEntry:: + text "Its horns contain" + next "venom. If they" + next "are stabbed into" - page "without ever" - next "having to land" - next "for rest" + page "an enemy, the" + next "impact makes the" + next "poison leak out" dex -_PidgeyDexEntry:: - text "A common sight in" - next "forests and woods." - next "It flaps its" +_NidokingDexEntry:: + text "Its steel-like" + next "hide adds to its" + next "powerful tackle." - page "wings at ground" - next "level to kick up" - next "blinding sand" + page "Its horns are so" + next "hard, they can" + next "pierce a diamond" dex -_SlowpokeDexEntry:: - text "Incredibly slow" - next "and dopey. It" - next "takes 5 seconds" +_ClefairyDexEntry:: + text "Adored for their" + next "cute looks and" + next "playfulness. They" - page "for it to feel" - next "pain when under" - next "attack" + page "are thought to be" + next "rare, as they do" + next "not appear often" dex -_KadabraDexEntry:: - text "It emits special" - next "alpha waves from" - next "its body that" +_ClefableDexEntry:: + text "They appear to be" + next "very protective of" + next "their own world." - page "induce headaches" - next "just by being" - next "close by" + page "It is a kind of" + next "fairy, rarely seen" + next "by people" dex -_GravelerDexEntry:: - text "Rolls down slopes" - next "to move. It rolls" - next "over any obstacle" +_VulpixDexEntry:: + text "Both its fur and" + next "its tails are" + next "beautiful. As it" - page "without slowing" - next "or changing its" - next "direction" + page "grows, the tails" + next "split and form" + next "more tails" dex -_ChanseyDexEntry:: - text "A rare and elusive" - next "#MON that is" - next "said to bring" +_NinetalesDexEntry:: + text "According to an" + next "enduring legend," + next "9 noble saints" - page "happiness to those" - next "who manage to get" - next "it" + page "were united and" + next "reincarnated as" + next "this #MON" dex -_MachokeDexEntry:: - text "Its muscular body" - next "is so powerful, it" - next "must wear a power" +_JigglypuffDexEntry:: + text "Uses its alluring" + next "eyes to enrapture" + next "its foe. It then" - page "save belt to be" - next "able to regulate" - next "its motions" + page "sings a pleasing" + next "melody that lulls" + next "the foe to sleep" dex -_MrMimeDexEntry:: - text "If interrupted" - next "while it is" - next "miming, it will" +_WigglytuffDexEntry:: + text "Its body is full" + next "of elasticity. By" + next "inhaling deeply," - page "slap around the" - next "offender with its" - next "broad hands" + page "it can continue" + next "to inflate itself" + next "without limit" dex -_HitmonleeDexEntry:: - text "When in a hurry," - next "its legs lengthen" - next "progressively." +_ZubatDexEntry:: + text "Emits ultrasonic" + next "cries while it" + next "flies. They act" - page "It runs smoothly" - next "with extra long," - next "loping strides" + page "as a sonar used" + next "to check for ob-" + next "jects in its way" dex -_HitmonchanDexEntry:: - text "While apparently" - next "doing nothing, it" - next "fires punches in" +_GolbatDexEntry:: + text "It attacks in a" + next "stealthy manner," + next "without warning." - page "lightning fast" - next "volleys that are" - next "impossible to see" + page "Its sharp fangs" + next "are used to bite" + next "and suck blood" dex -_ArbokDexEntry:: - text "It is rumored that" - next "the ferocious" - next "warning markings" +_OddishDexEntry:: + text "It may be mistaken" + next "for a clump of" + next "weeds. If you try" - page "on its belly" - next "differ from area" - next "to area" + page "to yank it out of" + next "the ground, it" + next "shrieks horribly" dex -_ParasectDexEntry:: - text "A host-parasite" - next "pair in which the" - next "parasite mushroom" +_GloomDexEntry:: + text "Smells incredibly" + next "foul! However," + next "around 1 out of" - page "has taken over the" - next "host bug. Prefers" - next "damp places" + page "1,000 people enjoy" + next "sniffing its nose-" + next "bending stink" dex -_PsyduckDexEntry:: - text "While lulling its" - next "enemies with its" - next "vacant look, this" +_VileplumeDexEntry:: + text "Flaps its broad" + next "flower petals to" + next "scatter its" - page "wily #MON will" - next "use psychokinetic" - next "powers" + page "poisonous pollen." + next "The flapping sound" + next "is very loud" dex -_DrowzeeDexEntry:: - text "Puts enemies to" - next "sleep then eats" - next "their dreams." +_ParasDexEntry:: + text "Burrows under the" + next "ground to gnaw on" + next "tree roots. The" - page "Occasionally gets" - next "sick from eating" - next "bad dreams" + page "mushrooms on its" + next "back absorb most" + next "of the nutrition" dex -_GolemDexEntry:: - text "Its boulder-like" - next "body is extremely" - next "hard. It can" +_ParasectDexEntry:: + text "The bug host is" + next "drained of energy" + next "by the mushrooms" - page "easily withstand" - next "dynamite blasts" - next "without damage" + page "on its back. They" + next "appear to do all" + next "the thinking" dex -_MagmarDexEntry:: - text "Its body always" - next "burns with an" - next "orange glow that" +_VenonatDexEntry:: + text "Its large eyes act" + next "as radars. In a" + next "bright place, you" - page "enables it to" - next "hide perfectly" - next "among flames" + page "can see that they" + next "are clusters of" + next "many tiny eyes" dex -_ElectabuzzDexEntry:: - text "Normally found" - next "near power plants," - next "they can wander" +_VenomothDexEntry:: + text "The powdery scales" + next "on its wings are" + next "hard to remove." - page "away and cause" - next "major blackouts" - next "in cities" + page "They also contain" + next "poison that leaks" + next "out on contact" dex -_MagnetonDexEntry:: - text "Formed by several" - next "MAGNEMITEs linked" - next "together. They" +_DiglettDexEntry:: + text "It prefers dark" + next "places. It spends" + next "most of its time" - page "frequently appear" - next "when sunspots" - next "flare up" + page "underground," + next "though it may pop" + next "up in caves" dex -_KoffingDexEntry:: - text "Because it stores" - next "several kinds of" - next "toxic gases in" +_DugtrioDexEntry:: + text "A team of triplets" + next "that can burrow" + next "over 60 MPH." - page "its body, it is" - next "prone to exploding" - next "without warning" + page "Due to this, some" + next "people think it's" + next "an earthquake" dex -_MankeyDexEntry:: - text "Extremely quick to" - next "anger. It could" - next "be docile one" +_MeowthDexEntry:: + text "Appears to be more" + next "active at night." + next "It loves round" - page "moment then" - next "thrashing away" - next "the next instant" + page "and shiny things." + next "It can't stop from" + next "picking them up" dex -_SeelDexEntry:: - text "The protruding" - next "horn on its head" - next "is very hard." +_PersianDexEntry:: + text "The gem in its" + next "forehead glows on" + next "its own! It walks" - page "It is used for" - next "bashing through" - next "thick ice" + page "with all the grace" + next "and elegance of a" + next "proud queen" dex -_DiglettDexEntry:: - text "Lives about one" - next "yard underground" - next "where it feeds on" +_PsyduckDexEntry:: + text "Always tormented" + next "by headaches." + next "It uses psychic" - page "plant roots. It" - next "sometimes appears" - next "above ground" + page "powers, but it is" + next "not known if it" + next "intends to do so" dex -_TaurosDexEntry:: - text "When it targets" - next "an enemy, it" - next "charges furiously" +_GolduckDexEntry:: + text "Its slim and long" + next "limbs end in broad" + next "flippers. They" - page "while whipping its" - next "body with its" - next "long tails" + page "are used for swim-" + next "ming gracefully" + next "in lakes" dex -_FarfetchdDexEntry:: - text "The sprig of" - next "green onions it" - next "holds is its" +_MankeyDexEntry:: + text "An agile #MON" + next "that lives in" + next "trees. It angers" - page "weapon. It is" - next "used much like a" - next "metal sword" + page "easily and will" + next "not hesitate to" + next "attack anything" dex -_VenonatDexEntry:: - text "Lives in the" - next "shadows of tall" - next "trees where it" +_PrimeapeDexEntry:: + text "It stops being" + next "angry only when" + next "nobody else is" - page "eats insects. It" - next "is attracted by" - next "light at night" + page "around. To view" + next "this moment is" + next "very difficult" dex -_DragoniteDexEntry:: - text "An extremely" - next "rarely seen" - next "marine #MON." +_GrowlitheDexEntry:: + text "A #MON with a" + next "friendly nature." + next "However, it will" - page "Its intelligence" - next "is said to match" - next "that of humans" + page "bark fiercely at" + next "anything invading" + next "its territory" dex -_DoduoDexEntry:: - text "A bird that makes" - next "up for its poor" - next "flying with its" +_ArcanineDexEntry:: + text "A legendary #-" + next "MON in China." + next "Many people are" - page "fast foot speed." - next "Leaves giant" - next "footprints" + page "charmed by its" + next "grace and beauty" + next "while running" dex _PoliwagDexEntry:: - text "Its newly grown" - next "legs prevent it" - next "from running. It" + text "The direction of" + next "the spiral on the" + next "belly differs by" - page "appears to prefer" - next "swimming than" - next "trying to stand" + page "area. It is more" + next "adept at swimming" + next "than walking" dex -_JynxDexEntry:: - text "It seductively" - next "wiggles its hips" - next "as it walks. It" +_PoliwhirlDexEntry:: + text "Under attack, it" + next "uses its belly " + next "spiral to put the" - page "can cause people" - next "to dance in" - next "unison with it" + page "foe to sleep. It" + next "then makes its" + next "escape" dex -_MoltresDexEntry:: - text "Known as the" - next "legendary bird of" - next "fire. Every flap" +_PoliwrathDexEntry:: + text "Swims powerfully" + next "using all the" + next "muscles in its" - page "of its wings" - next "creates a dazzling" - next "flash of flames" + page "body. It can even" + next "overtake champion" + next "swimmers" dex -_ArticunoDexEntry:: - text "A legendary bird" - next "#MON that is" - next "said to appear to" +_AbraDexEntry:: + text "Sleeps 18 hours a" + next "day. If it senses" + next "danger, it will" - page "doomed people who" - next "are lost in icy" - next "mountains" + page "teleport itself to" + next "safety even as it" + next "sleeps" dex -_ZapdosDexEntry:: - text "A legendary bird" - next "#MON that is" - next "said to appear" +_KadabraDexEntry:: + text "Many odd things" + next "happen if this" + next "#MON is close" - page "from clouds while" - next "dropping enormous" - next "lightning bolts" + page "by. For example," + next "it makes clocks" + next "run backwards" dex -_DittoDexEntry:: - text "Capable of copying" - next "an enemy's genetic" - next "code to instantly" +_AlakazamDexEntry:: + text "A #MON that can" + next "memorize anything." + next "It never forgets" - page "transform itself" - next "into a duplicate" - next "of the enemy" + page "what it learns--" + next "that's why this" + next "#MON is smart" dex -_MeowthDexEntry:: - text "Adores circular" - next "objects. Wanders" - next "the streets on a" +_MachopDexEntry:: + text "Very powerful in" + next "spite of its small" + next "size. Its mastery" - page "nightly basis to" - next "look for dropped" - next "loose change" + page "of many types of" + next "martial arts makes" + next "it very tough" dex -_KrabbyDexEntry:: - text "Its pincers are" - next "not only powerful" - next "weapons, they are" +_MachokeDexEntry:: + text "The belt around" + next "its waist holds" + next "back its energy." - page "used for balance" - next "when walking" - next "sideways" + page "Without it, this" + next "#MON would be" + next "unstoppable" dex -_VulpixDexEntry:: - text "At the time of" - next "birth, it has" - next "just one tail." +_MachampDexEntry:: + text "One arm alone can" + next "move mountains." + next "Using all four" - page "The tail splits" - next "from its tip as" - next "it grows older" + page "arms, this #MON" + next "fires off awesome" + next "punches" dex -_NinetalesDexEntry:: - text "Very smart and" - next "very vengeful." - next "Grabbing one of" +_BellsproutDexEntry:: + text "Prefers hot and" + next "humid places." + next "It ensnares tiny" - page "its many tails" - next "could result in a" - next "1000-year curse" + page "insects with its" + next "vines and devours" + next "them" dex -_PikachuDexEntry:: - text "When several of" - next "these #MON" - next "gather, their" +_WeepinbellDexEntry:: + text "When hungry, it" + next "swallows anything" + next "that moves. Its" - page "electricity could" - next "build and cause" - next "lightning storms" + page "hapless prey is" + next "melted inside by" + next "strong acids" dex -_RaichuDexEntry:: - text "Its long tail" - next "serves as a" - next "ground to protect" +_VictreebelDexEntry:: + text "Lures prey with" + next "the sweet aroma of" + next "honey. Swallowed" - page "itself from its" - next "own high voltage" - next "power" + page "whole, the prey is" + next "melted in a day," + next "bones and all" dex -_DratiniDexEntry:: - text "Long considered a" - next "mythical #MON" - next "until recently" +_TentacoolDexEntry:: + text "It can sometimes" + next "be found all dry" + next "and shriveled up" - page "when a small" - next "colony was found" - next "living underwater" + page "on a beach. Toss" + next "it back into the" + next "sea to revive it" dex -_DragonairDexEntry:: - text "A mystical #MON" - next "that exudes a" - next "gentle aura." +_TentacruelDexEntry:: + text "Its 80 tentacles" + next "can stretch and" + next "contract freely." - page "Has the ability" - next "to change climate" - next "conditions" + page "They wrap around" + next "prey and weaken" + next "it with poison" dex -_KabutoDexEntry:: - text "A #MON that" - next "was resurrected" - next "from a fossil" +_GeodudeDexEntry:: + text "Commonly found" + next "near mountain" + next "trails, etc." - page "found in what was" - next "once the ocean" - next "floor eons ago" + page "If you step on" + next "one by accident," + next "it gets angry" dex -_KabutopsDexEntry:: - text "Its sleek shape is" - next "perfect for swim-" - next "ming. It slashes" +_GravelerDexEntry:: + text "Often seen rolling" + next "down mountain" + next "trails. Obstacles" - page "prey with its" - next "claws and drains" - next "the body fluids" + page "are just things to" + next "roll straight" + next "over, not avoid" dex -_HorseaDexEntry:: - text "Known to shoot" - next "down flying bugs" - next "with precision" +_GolemDexEntry:: + text "Once it sheds its" + next "skin, its body" + next "turns tender and" - page "blasts of ink" - next "from the surface" - next "of the water" + page "whitish. Its hide" + next "hardens when it's" + next "exposed to air" dex -_SeadraDexEntry:: - text "Capable of swim-" - next "ming backwards by" - next "rapidly flapping" +_PonytaDexEntry:: + text "Capable of jumping" + next "incredibly high." + next "Its hooves and" - page "its wing-like" - next "pectoral fins and" - next "stout tail" + page "sturdy legs absorb" + next "the impact of a" + next "hard landing" dex -_SandshrewDexEntry:: - text "Burrows deep" - next "underground in" - next "arid locations" +_RapidashDexEntry:: + text "Just loves to run." + next "If it sees some-" + next "thing faster than" - page "far from water." - next "It only emerges" - next "to hunt for food" + page "itself, it will" + next "give chase at top" + next "speed" dex -_SandslashDexEntry:: - text "Curls up into a" - next "spiny ball when" - next "threatened. It" +_SlowpokeDexEntry:: + text "Incredibly slow" + next "and sluggish. It" + next "is quite content" - page "can roll while" - next "curled up to" - next "attack or escape" + page "to loll about" + next "without worrying" + next "about the time" dex -_OmanyteDexEntry:: - text "Although long" - next "extinct, in rare" - next "cases, it can be" +_SlowbroDexEntry:: + text "Lives lazily by" + next "the sea. If the" + next "SHELLDER on its" - page "genetically" - next "resurrected from" - next "fossils" + page "tail comes off," + next "it becomes a" + next "SLOWPOKE again" dex -_OmastarDexEntry:: - text "A prehistoric" - next "#MON that died" - next "out when its" +_MagnemiteDexEntry:: + text "It is born with" + next "the ability to" + next "defy gravity. It" - page "heavy shell made" - next "it impossible to" - next "catch prey" + page "floats in air on" + next "powerful electro-" + next "magnetic waves" dex -_JigglypuffDexEntry:: - text "When its huge eyes" - next "light up, it sings" - next "a mysteriously" +_MagnetonDexEntry:: + text "Generates strange" + next "radio signals. It" + next "raises the tem-" - page "soothing melody" - next "that lulls its" - next "enemies to sleep" + page "perature by 3.6F" + next "degrees within" + next "3,300 feet" dex -_WigglytuffDexEntry:: - text "The body is soft" - next "and rubbery. When" - next "angered, it will" +_FarfetchdDexEntry:: + text "Lives where reedy" + next "plants grow. They" + next "are rarely seen," - page "suck in air and" - next "inflate itself to" - next "an enormous size" + page "so it's thought" + next "their numbers are" + next "decreasing" dex -_EeveeDexEntry:: - text "Its genetic code" - next "is irregular." - next "It may mutate if" +_DoduoDexEntry:: + text "Its short wings" + next "make flying dif-" + next "ficult. Instead," - page "it is exposed to" - next "radiation from" - next "element STONEs" + page "this #MON runs" + next "at high speed on" + next "developed legs" dex -_FlareonDexEntry:: - text "When storing" - next "thermal energy in" - next "its body, its" +_DodrioDexEntry:: + text "One of DODUO's 2" + next "heads splits to" + next "form a unique" - page "temperature could" - next "soar to over 1600" - next "degrees" + page "species. It runs" + next "close to 40 MPH" + next "in prairies" dex -_JolteonDexEntry:: - text "It accumulates" - next "negative ions in" - next "the atmosphere to" +_SeelDexEntry:: + text "Loves freezing" + next "cold conditions." + next "Relishes swimming" - page "blast out 10000-" - next "volt lightning" - next "bolts" + page "in a frigid cli-" + next "mate of around 14F" + next "degrees" dex -_VaporeonDexEntry:: - text "Lives close to" - next "water. Its long" - next "tail is ridged" +_DewgongDexEntry:: + text "Its entire body is" + next "a snowy-white." + next "Unharmed by even" - page "with a fin which" - next "is often mistaken" - next "for a mermaid's" + page "intense cold, it" + next "swims powerfully" + next "in icy waters" dex -_MachopDexEntry:: - text "Loves to build" - next "its muscles." - next "It trains in all" +_GrimerDexEntry:: + text "Made of hardened" + next "sludge. It smells" + next "too putrid to" - page "styles of martial" - next "arts to become" - next "even stronger" + page "touch." + next "Even weeds won't" + next "grow in its path" dex -_ZubatDexEntry:: - text "Forms colonies in" - next "perpetually dark" - next "places. Uses" +_MukDexEntry:: + text "Smells so awful," + next "it can cause" + next "fainting. Through" - page "ultrasonic waves" - next "to identify and" - next "approach targets" + page "degeneration, it" + next "lost its sense of" + next "smell" dex -_EkansDexEntry:: - text "Moves silently" - next "and stealthily." - next "Eats the eggs of" +_ShellderDexEntry:: + text "The shell can" + next "withstand any" + next "attack. However," - page "birds, such as" - next "PIDGEY and" - next "SPEAROW, whole" + page "when it is open," + next "the tender body" + next "is exposed" dex -_ParasDexEntry:: - text "Burrows to suck" - next "tree roots. The" - next "mushrooms on its" +_CloysterDexEntry:: + text "For protection, it" + next "uses its harder-" + next "than-diamonds" - page "back grow by draw-" - next "ing nutrients from" - next "the bug host" + page "shell. It also" + next "shoots spikes from" + next "the shell" dex -_PoliwhirlDexEntry:: - text "Capable of living" - next "in or out of" - next "water. When out" +_GastlyDexEntry:: + text "Said to appear in" + next "decrepit, deserted" + next "buildings. It has" - page "of water, it" - next "sweats to keep" - next "its body slimy" + page "no real shape as" + next "it appears to be" + next "made of a gas" dex -_PoliwrathDexEntry:: - text "An adept swimmer" - next "at both the front" - next "crawl and breast" +_HaunterDexEntry:: + text "By licking, it" + next "saps the victim's" + next "life. It causes" - page "stroke. Easily" - next "overtakes the best" - next "human swimmers" + page "shaking that won't" + next "stop until the" + next "victim's demise" dex -_WeedleDexEntry:: - text "Often found in" - next "forests, eating" - next "leaves." +_GengarDexEntry:: + text "A GENGAR is close" + next "by if you feel a" + next "sudden chill." - page "It has a sharp" - next "venomous stinger" - next "on its head" + page "It may be trying" + next "to lay a curse" + next "on you" dex -_KakunaDexEntry:: - text "Almost incapable" - next "of moving, this" - next "#MON can only" +_OnixDexEntry:: + text "Burrows at high" + next "speed in search" + next "of food. The" - page "harden its shell" - next "to protect itself" - next "from predators" + page "tunnels it leaves" + next "are used as homes" + next "by DIGLETTs" dex -_BeedrillDexEntry:: - text "Flies at high" - next "speed and attacks" - next "using its large" +_DrowzeeDexEntry:: + text "If you sleep by" + next "it all the time," + next "it will sometimes" - page "venomous stingers" - next "on its forelegs" - next "and tail" + page "show you dreams" + next "it has eaten in" + next "the past" dex -_DodrioDexEntry:: - text "Uses its three" - next "brains to execute" - next "complex plans." +_HypnoDexEntry:: + text "Avoid eye contact" + next "if you come across" + next "one. It will try" - page "While two heads" - next "sleep, one head" - next "stays awake" + page "to put you to" + next "sleep by using" + next "its pendulum" dex -_PrimeapeDexEntry:: - text "Always furious" - next "and tenacious to" - next "boot. It will not" +_KrabbyDexEntry:: + text "Its pincers are" + next "superb weapons." + next "They sometimes" - page "abandon chasing" - next "its quarry until" - next "it is caught" + page "break off during" + next "battle, but they" + next "grow back fast" dex -_DugtrioDexEntry:: - text "A team of DIGLETT" - next "triplets." - next "It triggers huge" +_KinglerDexEntry:: + text "One claw grew" + next "massively and as" + next "hard as steel." - page "earthquakes by" - next "burrowing 60 miles" - next "underground" + page "It has 10,000-HP" + next "strength. However," + next "it is too heavy" dex -_VenomothDexEntry:: - text "The dust-like" - next "scales covering" - next "its wings are" +_VoltorbDexEntry:: + text "It is said to" + next "camouflage itself" + next "as a # BALL. It" - page "color coded to" - next "indicate the kinds" - next "of poison it has" + page "will self-destruct" + next "with very little" + next "stimulus" dex -_DewgongDexEntry:: - text "Stores thermal" - next "energy in its" - next "body. Swims at a" +_ElectrodeDexEntry:: + text "Stores electrical" + next "energy inside its" + next "body. Even the" - page "steady 8 knots" - next "even in intensely" - next "cold waters" + page "slightest shock" + next "could trigger a" + next "huge explosion" dex -_CaterpieDexEntry:: - text "Its short feet" - next "are tipped with" - next "suction pads that" +_ExeggcuteDexEntry:: + text "The heads attract" + next "each other and" + next "spin around." - page "enable it to" - next "tirelessly climb" - next "slopes and walls" + page "There must be 6" + next "heads for it to" + next "maintain balance" dex -_MetapodDexEntry:: - text "This #MON is" - next "vulnerable to" - next "attack while its" +_ExeggutorDexEntry:: + text "Its cries are very" + next "noisy. This is" + next "because each of" - page "shell is soft," - next "exposing its weak" - next "and tender body" + page "the 3 heads thinks" + next "about whatever it" + next "likes" dex -_ButterfreeDexEntry:: - text "In battle, it" - next "flaps its wings" - next "at high speed to" +_CuboneDexEntry:: + text "Wears the skull" + next "of its deceased" + next "mother. Its cries" - page "release highly" - next "toxic dust into" - next "the air" + page "echo inside the" + next "skull and come out" + next "as a sad melody" dex -_MachampDexEntry:: - text "Using its heavy" - next "muscles, it throws" - next "powerful punches" +_MarowakDexEntry:: + text "Small and weak," + next "this #MON is" + next "adept with its" - page "that can send the" - next "victim clear over" - next "the horizon" + page "bone club. It has" + next "grown more vicious" + next "over the ages" dex -_GolduckDexEntry:: - text "Often seen swim-" - next "ming elegantly by" - next "lake shores. It" +_HitmonleeDexEntry:: + text "When kicking, the" + next "sole of its foot" + next "turns as hard as" - page "is often mistaken" - next "for the Japanese" - next "monster, Kappa" + page "a diamond on im-" + next "pact and destroys" + next "its enemy" dex -_HypnoDexEntry:: - text "When it locks eyes" - next "with an enemy, it" - next "will use a mix of" +_HitmonchanDexEntry:: + text "Punches in cork-" + next "screw fashion. It" + next "can punch its way" - page "PSI moves such as" - next "HYPNOSIS and" - next "CONFUSION" + page "through a concrete" + next "wall in the same" + next "way as a drill" dex -_GolbatDexEntry:: - text "Once it strikes," - next "it will not stop" - next "draining energy" +_LickitungDexEntry:: + text "Its tongue spans" + next "almost 7 feet and" + next "moves more freely" - page "from the victim" - next "even if it gets" - next "too heavy to fly" + page "than its forelegs." + next "Its licks can" + next "cause paralysis" dex -_MewtwoDexEntry:: - text "It was created by" - next "a scientist after" - next "years of horrific" +_KoffingDexEntry:: + text "In hot places, its" + next "internal gases" + next "could expand and" - page "gene splicing and" - next "DNA engineering" - next "experiments" - dex + page "explode without" + next "any warning. Be" + next "very careful!@@" -_SnorlaxDexEntry:: - text "Very lazy. Just" - next "eats and sleeps." - next "As its rotund" +_WeezingDexEntry:: + text "It lives and grows" + next "by absorbing dust," + next "germs and poison" - page "bulk builds, it" - next "becomes steadily" - next "more slothful" + page "gases that are" + next "contained in toxic" + next "waste and garbage" dex -_MagikarpDexEntry:: - text "In the distant" - next "past, it was" - next "somewhat stronger" +_RhyhornDexEntry:: + text "A #MON with a" + next "one-track mind." + next "Once it charges, " - page "than the horribly" - next "weak descendants" - next "that exist today" + page "it won't stop" + next "running until it" + next "falls asleep" dex -_MukDexEntry:: - text "Thickly covered" - next "with a filthy," - next "vile sludge. It" +_RhydonDexEntry:: + text "Walks on its hind" + next "legs. Shows signs" + next "of intelligence." - page "is so toxic, even" - next "its footprints" - next "contain poison" + page "Its armor-like" + next "hide even repels" + next "molten lava" dex -_KinglerDexEntry:: - text "The large pincer" - next "has 10000 hp of" - next "crushing power." +_ChanseyDexEntry:: + text "A gentle and kind-" + next "hearted #MON" + next "that shares its" - page "However, its huge" - next "size makes it" - next "unwieldy to use" + page "nutritious eggs" + next "if it sees an" + next "injured #MON" dex -_CloysterDexEntry:: - text "When attacked, it" - next "launches its" - next "horns in quick" +_TangelaDexEntry:: + text "Its identity is" + next "obscured by masses" + next "of thick, blue" - page "volleys. Its" - next "innards have" - next "never been seen" + page "vines. The vines" + next "are said to never" + next "stop growing" dex -_ElectrodeDexEntry:: - text "It stores electric" - next "energy under very" - next "high pressure." +_KangaskhanDexEntry:: + text "Raises its young" + next "in its belly" + next "pouch. Won't run" - page "It often explodes" - next "with little or no" - next "provocation" + page "from any fight" + next "to keep its young" + next "protected" dex -_ClefableDexEntry:: - text "A timid fairy" - next "#MON that is" - next "rarely seen. It" +_HorseaDexEntry:: + text "If it senses any" + next "danger, it will" + next "vigorously spray" - page "will run and hide" - next "the moment it" - next "senses people" + page "water or a special" + next "type of ink from" + next "its mouth" dex -_WeezingDexEntry:: - text "Where two kinds" - next "of poison gases" - next "meet, 2 KOFFINGs" +_SeadraDexEntry:: + text "Touching the back" + next "fin causes numb-" + next "ness. It hooks" - page "can fuse into a" - next "WEEZING over many" - next "years" + page "its tail to coral" + next "to stay in place" + next "while sleeping" dex -_PersianDexEntry:: - text "Although its fur" - next "has many admirers," - next "it is tough to" +_GoldeenDexEntry:: + text "When it is time" + next "for them to lay" + next "eggs, they can be" - page "raise as a pet" - next "because of its" - next "fickle meanness" + page "seen swimming up" + next "rivers and falls" + next "in large groups" dex -_MarowakDexEntry:: - text "The bone it holds" - next "is its key weapon." - next "It throws the" +_SeakingDexEntry:: + text "It is the male's" + next "job to make a" + next "nest by carving" - page "bone skillfully" - next "like a boomerang" - next "to KO targets" + page "out boulders in a" + next "stream using the" + next "horn on its head" dex -_HaunterDexEntry:: - text "Because of its" - next "ability to slip" - next "through block" +_StaryuDexEntry:: + text "As long as the" + next "center section is" + next "unharmed, it can" - page "walls, it is said" - next "to be from an-" - next "other dimension" + page "grow back fully" + next "even if it is" + next "chopped to bits" dex -_AbraDexEntry:: - text "Using its ability" - next "to read minds, it" - next "will identify" +_StarmieDexEntry:: + text "The center section" + next "is named the core." + next "People think it" - page "impending danger" - next "and TELEPORT to" - next "safety" + page "is communicating" + next "when it glows in" + next "7 colors" dex -_AlakazamDexEntry:: - text "Its brain can out-" - next "perform a super-" - next "computer." +_MrMimeDexEntry:: + text "Always practices" + next "its pantomime act." + next "It makes enemies" - page "Its intelligence" - next "quotient is said" - next "to be 5,000" + page "believe something" + next "exists that" + next "really doesn't" dex -_PidgeottoDexEntry:: - text "Very protective" - next "of its sprawling" - next "territorial area," +_ScytherDexEntry:: + text "Leaps out of tall" + next "grass and slices" + next "prey with its" - page "this #MON will" - next "fiercely peck at" - next "any intruder" + page "scythes. The move-" + next "ment looks like" + next "that of a ninja" dex -_PidgeotDexEntry:: - text "When hunting, it" - next "skims the surface" - next "of water at high" +_JynxDexEntry:: + text "Appears to move" + next "to a rhythm of" + next "its own, as if it" - page "speed to pick off" - next "unwary prey such" - next "as MAGIKARP" + page "were dancing. It" + next "wiggles its hips" + next "as it walks" dex -_StarmieDexEntry:: - text "Its central core" - next "glows with the" - next "seven colors of" +_ElectabuzzDexEntry:: + text "If a major power" + next "outage occurs, it" + next "is certain that" - page "the rainbow. Some" - next "people value the" - next "core as a gem" + page "this #MON has" + next "eaten electricity" + next "at a power plant" dex -_BulbasaurDexEntry:: - text "A strange seed was" - next "planted on its" - next "back at birth." +_MagmarDexEntry:: + text "Born in an active" + next "volcano. Its body" + next "is always cloaked" - page "The plant sprouts" - next "and grows with" - next "this #MON" + page "in flames, so it" + next "looks like a big" + next "ball of fire" dex -_VenusaurDexEntry:: - text "The plant blooms" - next "when it is" - next "absorbing solar" +_PinsirDexEntry:: + text "Grips its prey in" + next "its pincers and" + next "squeezes hard! It" - page "energy. It stays" - next "on the move to" - next "seek sunlight" + page "can't move if it's" + next "cold, so it lives" + next "in warm places" dex -_TentacruelDexEntry:: - text "The tentacles are" - next "normally kept" - next "short. On hunts," +_TaurosDexEntry:: + text "A rowdy #MON" + next "with a lot of" + next "stamina. Once" - page "they are extended" - next "to ensnare and" - next "immobilize prey" + page "running, it won't" + next "stop until it hits" + next "something" dex -_GoldeenDexEntry:: - text "Its tail fin" - next "billows like an" - next "elegant ballroom" +_MagikarpDexEntry:: + text "Famous for being" + next "very unreliable." + next "It can be found" - page "dress, giving it" - next "the nickname of" - next "the Water Queen" + page "swimming in seas," + next "lakes, rivers and" + next "shallow puddles" dex -_SeakingDexEntry:: - text "In the autumn" - next "spawning season," - next "they can be seen" +_GyaradosDexEntry:: + text "Brutally vicious" + next "and enormously" + next "destructive." - page "swimming power-" - next "fully up rivers" - next "and creeks" + page "Known for totally" + next "destroying cities" + next "in ancient times" dex -_PonytaDexEntry:: - text "Its hooves are 10" - next "times harder than" - next "diamonds. It can" +_LaprasDexEntry:: + text "A gentle soul that" + next "can read the minds" + next "of people. It can" - page "trample anything" - next "completely flat" - next "in little time" + page "ferry people" + next "across the sea on" + next "its back" dex -_RapidashDexEntry:: - text "Very competitive," - next "this #MON will" - next "chase anything" +_DittoDexEntry:: + text "When it spots an" + next "enemy, its body" + next "transfigures into" - page "that moves fast" - next "in the hopes of" - next "racing it" + page "an almost perfect" + next "copy of its oppo-" + next "nent" dex -_RattataDexEntry:: - text "Bites anything" - next "when it attacks." - next "Small and very" +_EeveeDexEntry:: + text "Its genetic code" + next "is unstable, so it" + next "could evolve in" - page "quick, it is a" - next "common sight in" - next "many places" + page "a variety of ways." + next "There are only a" + next "few alive" dex -_RaticateDexEntry:: - text "It uses its whis-" - next "kers to maintain" - next "its balance." +_VaporeonDexEntry:: + text "Its cell structure" + next "is similar to" + next "water molecules." - page "It apparently" - next "slows down if" - next "they are cut off" + page "It will melt away" + next "and become invis-" + next "ible in water" dex -_NidorinoDexEntry:: - text "An aggressive" - next "#MON that is" - next "quick to attack." +_JolteonDexEntry:: + text "A sensitive #-" + next "MON that easily" + next "becomes sad or" - page "The horn on its" - next "head secretes a" - next "powerful venom" + page "angry. Every time" + next "its mood changes," + next "it charges power" dex -_NidorinaDexEntry:: - text "The female's horn" - next "develops slowly." - next "Prefers physical" +_FlareonDexEntry:: + text "It has a flame" + next "chamber inside its" + next "body. It inhales," - page "attacks such as" - next "clawing and" - next "biting" + page "then blows out" + next "fire that is over" + next "3,000F degrees" dex -_GeodudeDexEntry:: - text "Found in fields" - next "and mountains." - next "Mistaking them" +_PorygonDexEntry:: + text "The only #MON" + next "people anticipate" + next "can fly into" - page "for boulders," - next "people often step" - next "or trip on them" + page "space. None has" + next "managed the feat" + next "yet, however" dex -_PorygonDexEntry:: - text "A #MON that" - next "consists entirely" - next "of programming" +_OmanyteDexEntry:: + text "An ancient #MON" + next "that was recovered" + next "from a fossil. It" - page "code. Capable of" - next "moving freely in" - next "cyberspace" + page "swims by cleverly" + next "twisting its 10" + next "tentacles about" dex -_AerodactylDexEntry:: - text "A ferocious, pre-" - next "historic #MON" - next "that goes for the" +_OmastarDexEntry:: + text "Sharp beaks ring" + next "its mouth. Its" + next "shell was too big" - page "enemy's throat" - next "with its serrated" - next "saw-like fangs" + page "for it to move" + next "freely, so it" + next "became extinct" dex -_MagnemiteDexEntry:: - text "Uses anti-gravity" - next "to stay suspended." - next "Appears without" +_KabutoDexEntry:: + text "A #MON that was" + next "recovered from a" + next "fossil. It uses" - page "warning and uses" - next "THUNDER WAVE and" - next "similar moves" + page "the eyes on its" + next "back while hiding" + next "on the sea floor" dex -_CharmanderDexEntry:: - text "Obviously prefers" - next "hot places. When" - next "it rains, steam" +_KabutopsDexEntry:: + text "A slim and fast" + next "swimmer. It slices" + next "its prey with its" - page "is said to spout" - next "from the tip of" - next "its tail" + page "sharp sickles and" + next "drinks the body" + next "fluids" dex -_SquirtleDexEntry:: - text "After birth, its" - next "back swells and" - next "hardens into a" +_AerodactylDexEntry:: + text "A savage #MON" + next "that died out in" + next "ancient times. It" - page "shell. Powerfully" - next "sprays foam from" - next "its mouth" + page "was resurrected" + next "using DNA taken" + next "from amber" dex -_CharmeleonDexEntry:: - text "When it swings" - next "its burning tail," - next "it elevates the" +_SnorlaxDexEntry:: + text "Will eat anything," + next "even if the food" + next "happens to be a" - page "temperature to" - next "unbearably high" - next "levels" + page "little moldy. It" + next "never gets an" + next "upset stomach" dex -_WartortleDexEntry:: - text "Often hides in" - next "water to stalk" - next "unwary prey. For" +_ArticunoDexEntry:: + text "A legendary bird" + next "#MON. It" + next "freezes water" - page "swimming fast, it" - next "moves its ears to" - next "maintain balance" + page "that is contained" + next "in winter air and" + next "makes it snow" dex -_CharizardDexEntry:: - text "Spits fire that" - next "is hot enough to" - next "melt boulders." +_ZapdosDexEntry:: + text "This legendary" + next "bird #MON is" + next "said to appear" - page "Known to cause" - next "forest fires" - next "unintentionally" + page "when the sky turns" + next "dark and lightning" + next "showers down" dex -_OddishDexEntry:: - text "During the day," - next "it keeps its face" - next "buried in the" +_MoltresDexEntry:: + text "A legendary bird" + next "#MON. As it" + next "flaps its flaming" - page "ground. At night," - next "it wanders around" - next "sowing its seeds" + page "wings, even the" + next "night sky will" + next "turn red" dex -_GloomDexEntry:: - text "The fluid that" - next "oozes from its" - next "mouth isn't drool." +_DratiniDexEntry:: + text "The existence of" + next "this mythical" + next "#MON was only" - page "It is a nectar" - next "that is used to" - next "attract prey" + page "recently confirmed" + next "by a fisherman" + next "who caught one" dex -_VileplumeDexEntry:: - text "The larger its" - next "petals, the more" - next "toxic pollen it" +_DragonairDexEntry:: + text "According to a" + next "witness, its body" + next "was surrounded by" - page "contains. Its big" - next "head is heavy and" - next "hard to hold up" + page "a strange aura" + next "that gave it a" + next "mystical look" dex -_BellsproutDexEntry:: - text "A carnivorous" - next "#MON that traps" - next "and eats bugs." +_DragoniteDexEntry:: + text "It is said that" + next "this #MON lives" + next "somewhere in the" - page "It uses its root" - next "feet to soak up" - next "needed moisture" + page "sea and that it" + next "flies. However, it" + next "is only a rumor" dex -_WeepinbellDexEntry:: - text "It spits out" - next "POISONPOWDER to" - next "immobilize the" +_MewtwoDexEntry:: + text "Its DNA is almost" + next "the same as MEW's." + next "However, its size" - page "enemy and then" - next "finishes it with" - next "a spray of ACID" + page "and disposition" + next "are vastly dif-" + next "ferent" dex -_VictreebelDexEntry:: - text "Said to live in" - next "huge colonies" - next "deep in jungles," +_MewDexEntry:: + text "When viewed" + next "through a micro-" + next "scope, this" - page "although no one" - next "has ever returned" - next "from there" + page "#MON's short," + next "fine, delicate" + next "hair can be seen" dex - diff --git a/text/pokedex_ratings.asm b/text/pokedex_ratings.asm new file mode 100644 index 00000000..b94a9868 --- /dev/null +++ b/text/pokedex_ratings.asm @@ -0,0 +1,117 @@ +_DexCompletionText:: + text "#DEX comp-" + line "letion is:" + + para "@" + TX_NUM hDexRatingNumMonsSeen, 1, 3 + text " #MON seen" + line "@" + TX_NUM hDexRatingNumMonsOwned, 1, 3 + text " #MON owned" + + para "PROF.OAK's" + line "Rating:" + prompt + +_DexRatingText_Own0To9:: + text "You still have" + line "lots to do." + cont "Look for #MON" + cont "in grassy areas!" + done + +_DexRatingText_Own10To19:: + text "You're on the" + line "right track! " + cont "Get a FLASH HM" + cont "from my AIDE!" + done + +_DexRatingText_Own20To29:: + text "You still need" + line "more #MON!" + cont "Try to catch" + cont "other species!" + done + +_DexRatingText_Own30To39:: + text "Good, you're" + line "trying hard!" + cont "Get an ITEMFINDER" + cont "from my AIDE!" + done + +_DexRatingText_Own40To49:: + text "Looking good!" + line "Go find my AIDE" + cont "when you get 50!" + done + +_DexRatingText_Own50To59:: + text "You finally got at" + line "least 50 species!" + cont "Be sure to get" + cont "EXP.ALL from my" + cont "AIDE!" + done + +_DexRatingText_Own60To69:: + text "Oh! This is get-" + line "ting even better!" + done + +_DexRatingText_Own70To79:: + text "Very good!" + line "Go fish for some" + cont "marine #MON!" + done + +_DexRatingText_Own80To89:: + text "Wonderful!" + line "Do you like to" + cont "collect things?" + done + +_DexRatingText_Own90To99:: + text "I'm impressed!" + line "It must have been" + cont "difficult to do!" + done + +_DexRatingText_Own100To109:: + text "You finally got at" + line "least 100 species!" + cont "I can't believe" + cont "how good you are!" + done + +_DexRatingText_Own110To119:: + text "You even have the" + line "evolved forms of" + cont "#MON! Super!" + done + +_DexRatingText_Own120To129:: + text "Excellent! Trade" + line "with friends to" + cont "get some more!" + done + +_DexRatingText_Own130To139:: + text "Outstanding!" + line "You've become a" + cont "real pro at this!" + done + +_DexRatingText_Own140To149:: + text "I have nothing" + line "left to say!" + cont "You're the" + cont "authority now!" + done + +_DexRatingText_Own150To151:: + text "Your #DEX is" + line "fully complete!" + cont "Congratulations!" + done diff --git a/text/unused_names.asm b/text/unused_names.asm new file mode 100644 index 00000000..dd4c9a12 --- /dev/null +++ b/text/unused_names.asm @@ -0,0 +1,20 @@ +UnusedNames: + db "かみなりバッヂ@" + db "かいがらバッヂ@" + db "おじぞうバッヂ@" + db "はやぶさバッヂ@" + db "ひんやりバッヂ@" + db "なかよしバッヂ@" + db "バラバッヂ@" + db "ひのたまバッヂ@" + db "ゴールドバッヂ@" + db "たまご@" + db "ひよこ@" + db "ブロンズ@" + db "シルバー@" + db "ゴールド@" + db "プチキャプテン@" + db "キャプテン@" + db "プチマスター@" + db "マスター@" + db "エクセレント" ; note the lack of a terminator @@ -201,8 +201,9 @@ wFrequencyModifier:: ; c0f1 wTempoModifier:: ; c0f2 ds 1 - ds 13 - +wc0f3:: ds 1 +wc0f4:: ds 1 +wc0f5:: ds 11 SECTION "Sprite State Data", WRAM0[$c100] @@ -229,19 +230,19 @@ wSpriteStateData1:: ; c100 ; C1xE ; C1xF spritestatedata1: MACRO -\1SpriteStateData1:: -\1PictureID:: db -\1MovementStatus:: db -\1SpriteImageIdx:: db -\1YStepVector:: db -\1YPixels:: db -\1XStepVector:: db -\1XPixels:: db -\1IntraAnimFrameCounter:: db -\1AnimFrameCounter:: db -\1FacingDirection:: db +w\1SpriteStateData1:: +w\1PictureID:: db ; 0 +w\1MovementStatus:: db ; 1 +w\1SpriteImageIdx:: db ; 2 +w\1YStepVector:: db ; 3 +w\1YPixels:: db ; 4 +w\1XStepVector:: db ; 5 +w\1XPixels:: db ; 6 +w\1IntraAnimFrameCounter:: db ; 7 +w\1AnimFrameCounter:: db ; 8 +w\1FacingDirection:: db ; 9 ds 6 -\1SpriteStateData1End:: +w\1SpriteStateData1End:: endm spritestatedata1 Player @@ -259,7 +260,7 @@ endm spritestatedata1 Sprite12 spritestatedata1 Sprite13 spritestatedata1 Sprite14 - spritestatedata1 Sprite15 + spritestatedata1 Pikachu ; ds $10 * $10 @@ -286,20 +287,20 @@ wSpriteStateData2:: ; c200 ; C2xE: sprite image base offset (in video ram, player always has value 1, used to compute c1x2) ; C2xF spritestatedata2: MACRO -\1SpriteStateData2:: -\1WalkAnimationCounter:: db - ds 1 -\1YDisplacement:: db -\1XDisplacement:: db -\1MapY:: db -\1MapX:: db -\1MovementByte1:: db -\1GrassPriority:: db -\1MovementDelay:: db +w\1SpriteStateData2:: +w\1WalkAnimationCounter:: db ; 0 + ds 1 +w\1YDisplacement:: db ; 2 +w\1XDisplacement:: db ; 3 +w\1MapY:: db ; 4 +w\1MapX:: db ; 5 +w\1MovementByte1:: db ; 6 +w\1GrassPriority:: db ; 7 +w\1MovementDelay:: db ; 8 ds 5 -\1SpriteImageBaseOffset:: db +w\1SpriteImageBaseOffset:: db ; e ds 1 -\1SpriteStateData2End:: +w\1SpriteStateData2End:: endm spritestatedata2 Player @@ -317,7 +318,7 @@ endm spritestatedata2 Sprite12 spritestatedata2 Sprite13 spritestatedata2 Sprite14 - spritestatedata2 Sprite15 + spritestatedata2 Pikachu ; ds $10 * $10 wSpriteDataEnd:: @@ -328,10 +329,11 @@ SECTION "OAM Buffer", WRAM0[$c300] wOAMBuffer:: ; c300 ; buffer for OAM data. Copied to OAM by DMA ds 4 * 40 +wOAMBufferEnd:: wTileMap:: ; c3a0 ; buffer for tiles that are visible on screen (20 columns by 18 rows) - ds 20 * 18 + ds SCREEN_HEIGHT * SCREEN_WIDTH wSerialPartyMonsPatchList:: ; c508 ; list of indexes to patch with SERIAL_NO_DATA_BYTE after transfer @@ -341,17 +343,243 @@ wTileMapBackup:: ; c508 ; (e.g. if menus are drawn on top) ; ds 20 * 18 - ds 200 +wAnimatedObjectsData:: +; Used by functions in BANK 3E +; This looks similar to the address structure for Gen 2 OAM animations. + +wAnimatedObjectStartTileOffsets:: + ds 10 * 2 +wAnimatedObjectDataStructs:: ; c51c +animated_object: macro +\1:: +\1Index:: db ; 0 +\1FramesetID:: db ; 1 +\1AnimSeqID:: db ; 2 +\1TileID:: db ; 3 +\1XCoord:: db ; 4 +\1YCoord:: db ; 5 +\1XOffset:: db ; 6 +\1YOffset:: db ; 7 +\1Duration:: db ; 8 +\1DurationOffset:: db ; 9 +\1FrameIndex:: db ; a + ds 5 +\1End:: + endm + + animated_object AnimatedObject0 + animated_object AnimatedObject1 + animated_object AnimatedObject2 + animated_object AnimatedObject3 + animated_object AnimatedObject4 + animated_object AnimatedObject5 + animated_object AnimatedObject6 + animated_object AnimatedObject7 + animated_object AnimatedObject8 + animated_object AnimatedObject9 + +wNumLoadedAnimatedObjects:: ; c5bc + ds 1 +wCurrentAnimatedObjectOAMBufferOffset:: ; c5bd + ds 3 +wAnimatedObjectSpawnStateDataPointer:: ; c5c0 + dw +wAnimatedObjectFramesDataPointer:: ; c5c2 + dw +wAnimatedObjectJumptablePointer:: ; c5c4 + dw +wAnimatedObjectOAMDataPointer:: ; c5c6 + dw +wCurAnimatedObjectOAMAttributes:: ; c5c8 + ds 1 +wCurrentAnimatedObjectVTileOffset:: ; c5c9 + ds 1 +wCurrentAnimatedObjectXCoord:: ; c5ca + ds 1 +wCurrentAnimatedObjectYCoord:: ; c5cb + ds 1 +wCurrentAnimatedObjectXOffset:: ; c5cc + ds 1 +wCurrentAnimatedObjectYOffset:: ; c5cd + ds 1 +wAnimatedObjectGlobalYOffset:: ; c5ce + ds 1 +wAnimatedObjectGlobalXOffset:: ; c5cf + ds 1 +wAnimatedObjectsDataEnd:: wSerialEnemyMonsPatchList:: ; c5d0 ; list of indexes to patch with SERIAL_NO_DATA_BYTE after transfer - ds 200 - ds 80 +; Surfing Minigame +wSurfingMinigameData:: ; c5d0 + ds 1 +wSurfingMinigameRoutineNumber:: ; c5d1 + ds 1 +wc5d2:: ; c5d2 + ds 1 +wSurfingMinigameWaveFunctionNumber:: ; c5d3 + ds 2 +wc5d5:: ; c5d5 + ds 1 +wSurfingMinigamePikachuHP:: ; c5d6 + ds 2 ; little-endian BCD +wc5d8:: ; c5d8 unused? + ds 1 +wSurfingMinigameRadnessMeter:: ; c5d9 +; number of consecutive tricks + ds 1 +wSurfingMinigameRadnessScore:: ; c5da + ds 2 ; little-endian BCD +wSurfingMinigameTotalScore:: ; c5dc + ds 2 ; little-endian BCD +wc5de:: ; c5de + ds 1 +wc5df:: ; c5df + ds 1 +wc5e0:: ; c5e0 + ds 1 +wc5e1:: ; c5e1 + ds 1 +wc5e2:: ; c5e2 + ds 1 +wc5e3:: ; c5e3 + ds 2 ; little-endian +wc5e5:: ; c5e5 + ds 3 ; big-endian +wSurfingMinigameWaveHeightBuffer:: ; c5e8 + ds 2 +wSurfingMinigamePikachuObjectHeight:: ; c5ea + ds 1 +wc5eb:: ; c5eb + ds 1 +wc5ec:: ; c5ec + ds 1 +wc5ed:: ; c5ed + ds 1 +wc5ee:: ; c5ee + ds 1 +wSurfingMinigameBGMapReadBuffer:: ; c5ef + ds 16 + + ds 24 +wSurfingMinigameSCX:: ; c617 + ds 3 +wSurfingMinigameWaveHeight:: ; c61a + ds SCREEN_WIDTH +wSurfingMinigameXOffset:: ; c62e + ds 1 +wSurfingMinigameTrickFlags:: ; c62f + ds 1 +wc630:: ; c630 + ds 1 +wc631:: ; c631 + ds 1 +wSurfingMinigameRoutineDelay:: ; c632 + ds 1 +wSurfingMinigameIntroAnimationFinished:: ; c633 + ds 1 + +wYellowIntroCurrentScene:: ; c634 +wc634:: ; c634 + ds 1 +wYellowIntroSceneTimer:: ; c635 +wc635:: ; c635 + ds 1 +wYellowIntroAnimatedObjectStructPointer:: ; c636 + ds 1 +wSurfingMinigameDataEnd:: ; c637 + + ds 177 -wTempPic:: +wTempPic:: ; c6e8 +wPrinterData:: ; c6e8 wOverworldMap:: ; c6e8 - ds 1300 + ; ds 1300 +wPrinterSendState:: ; c6e8 + ds 1 +wPrinterRowIndex:: ; c6e9 + ds 1 + +; Printer data header +wPrinterDataHeader:: ; c6ea +wc6ea:: ; c6ea + ds 1 +wc6eb:: ; c6eb + ds 1 +wc6ec:: ; c6ec + ds 1 +wc6ed:: ; c6ed + ds 1 +wPrinterChecksum:: ; c6ee + dw + +wPrinterSerialReceived:: ; c6f0 + ds 1 +wPrinterStatusReceived:: ; c6f1 +; bit 7: set if error 1 (battery low) +; bit 6: set if error 4 (too hot or cold) +; bit 5: set if error 3 (paper jammed or empty) +; if this and the previous byte are both $ff: error 2 (connection error) + ds 1 + +wc6f2:: ; c6f2 + ds 1 +wc6f3:: ; c6f3 + ds 13 +wLYOverrides:: ; c700 + ds $100 +wLYOverridesEnd:: +wLYOverridesBuffer:: ; c800 + ds $100 +wLYOverridesBufferEnd:: ; c900 + ds wPrinterSerialReceived - @ + +wPrinterSendDataSource1:: ; c6f0 +; two 20-tile buffers + ds $140 +wPrinterSendDataSource2:: + ds $140 +wPrinterSendDataSource1End:: ; c970 + +wPrinterHandshake:: ; c970 + ds 1 +wPrinterStatusFlags:: ; c971 + ds 1 +wHandshakeFrameDelay:: ; c972 + ds 1 +wPrinterSerialFrameDelay:: ; c973 + ds 1 +wPrinterSendByteOffset:: ; c974 + dw +wPrinterDataSize:: ; c976 + dw +wPrinterTileBuffer:: ; c978 + ds SCREEN_HEIGHT * SCREEN_WIDTH +wPrinterStatusIndicator:: ; cae0 + ds 2 +wcae2:: ; cae2 + ds 1 +wPrinterSettingsTempCopy:: ; cae3 + ds 17 +wPrinterQueueLength:: ; caf4 + ds 1 +wPrinterDataEnd:: ; caf5 + +wPrinterPokedexEntryTextPointer:: ; caf5 + dw + ds 2 +wPrinterPokedexMonIsOwned:: ; caf9 + ds 227 + +wcbdc:: ; cbdc + ds 14 + +wcbea:: ; cbea + ds 2 + +wcbec:: ; cbec + ds 16 wRedrawRowOrColumnSrcTiles:: ; cbfc ; the tiles of the row or column to be redrawn by RedrawRowOrColumn @@ -445,11 +673,7 @@ wTradeCenterPointerTableIndex:: ; cc38 ds 1 -wUnusedCC3A:: ; cc3a - ds 1 - -wUnusedCC3B:: ; cc3b - ds 1 +wTextDestinationTileAddrBuffer:: dw ; cc3a wDoNotWaitForButtonPressAfterDisplayingText:: ; cc3c ; if non-zero, skip waiting for a button press after displaying text in DisplayTextID @@ -488,9 +712,7 @@ wUnknownSerialCounter:: ; cc47 ; 2 bytes wEnteringCableClub:: ; cc47 - ds 1 - - ds 1 + ds 2 wWhichTradeMonSelectionMenu:: ; cc49 ; $00 = player mons @@ -579,19 +801,26 @@ wAnimationType:: ; cc5b ; values between 0-6. Shake screen horizontally, shake screen vertically, blink Pokemon... wNPCMovementDirections:: ; cc5b + +wPikaPicUsedGFXCount:: ; cc5b ds 1 +wPikaPicUsedGFX:: ; cc5c wDexRatingNumMonsOwned:: ; cc5c ds 1 + wDexRatingText:: ; cc5d +wTrainerCardBadgeAttributes:: ; cc5d ds 1 wSlotMachineSavedROMBank:: ; cc5e ; ROM back to return to when the player is done with the slot machine ds 1 - ds 26 + ds 13 +wPikaPicUsedGFXEnd:: ; cc6c + ds 13 wAnimPalette:: ; cc79 ds 1 @@ -600,13 +829,30 @@ wAnimPalette:: ; cc79 wNPCMovementDirections2:: ; cc97 +wPikaPicAnimObjectDataBufferSize:: ; cc97 + wSwitchPartyMonTempBuffer:: ; cc97 ; temporary buffer when swapping party mon data - ds 10 + ds 1 + +wPikaPicAnimObjectDataBuffer:: ; cc98 +; 4 structs each of length 8 +; 0: buffer index +; 1: script index +; 2: frame index +; 3: frame timer +; 4: vtile offset +; 5: x offset +; 6: y offset +; 7: unused + + ds 9 wNumStepsToTake:: ; cca1 ; used in Pallet Town scripted movement - ds 49 + ds 23 +wPikaPicAnimObjectDataBufferEnd:: ;ccb8 + ds 26 wRLEByteCount:: ; ccd2 ds 1 @@ -818,7 +1064,7 @@ wEnemyMonAccuracyMod:: ; cd32 wEnemyMonEvasionMod:: ; cd33 ds 1 -wInGameTradeReceiveMonSpecies:: +wInGameTradeReceiveMonSpecies:: ; cd34 ds 1 ds 2 @@ -899,7 +1145,7 @@ wWhichBadge:: ; cd3d wPriceTemp:: ; cd3d ; 3-byte BCD number -wTitleMonSpecies:: ; cd3d +wTitleScreenScene:: ; cd3d wPlayerCharacterOAMTile:: ; cd3d @@ -912,7 +1158,7 @@ wCoordIndex:: ; cd3d wOptionsTextSpeedCursorX:: ; cd3d -wBoxNumString:: ; cd3d +wOptionsCursorLocation:: ; cd3d wTrainerInfoTextBoxWidthPlus1:: ; cd3d @@ -950,6 +1196,8 @@ wPlayerSpinInPlaceAnimFrameDelay:: ; cd3d wPlayerSpinWhileMovingUpOrDownAnimDeltaY:: ; cd3d +wBoxNumString:: ; cd3d + wHiddenObjectFunctionArgument:: ; cd3d wWhichTrade:: ; cd3d @@ -960,6 +1208,8 @@ wTrainerSpriteOffset:: ; cd3d wUnusedCD3D:: ; cd3d ds 1 +wTitleScreenTimer:: ; cd3e + wHUDPokeballGfxOffsetX:: ; cd3e ; difference in X between the next ball and the current one @@ -1003,6 +1253,8 @@ wPlayerSpinWhileMovingUpOrDownAnimMaxY:: ; cd3e wHiddenObjectFunctionRomBank:: ; cd3e wTrainerEngageDistance:: ; cd3e + +wJigglypuffFacingDirections2:: ; cd3e ds 1 wHUDGraphicsTiles:: ; cd3f @@ -1037,6 +1289,7 @@ wPlayerSpinWhileMovingUpOrDownAnimFrameDelay:: ; cd3f wHiddenObjectIndex:: ; cd3f wTrainerFacingDirection:: ; cd3f + ds 1 wHoFMonOrPlayer:: ; cd40 @@ -1082,6 +1335,8 @@ wHoFTeamNo:: ; cd42 wSlotMachineWheel1MiddleTile:: ; cd42 wFieldMovesLeftmostXCoord:: ; cd42 + +wcd42:: ; cd42 ds 1 wLastFieldMoveID:: ; cd43 @@ -1316,7 +1571,7 @@ wAIItem:: ; cf05 ; the item that the AI used ds 1 -wUsedItemOnWhichPokemon:: ; cf05 +wUsedItemOnWhichPokemon:: ; cf06 ds 1 wAnimSoundID:: ; cf07 @@ -1368,7 +1623,7 @@ wTextPredefFlag:: ; cf11 wPredefParentBank:: ; cf12 ds 1 -wSpriteIndex:: ds 1 +wSpriteIndex:: ds 1 ; cf13 wCurSpriteMovement2:: ; cf14 ; movement byte 2 of current sprite @@ -1385,29 +1640,26 @@ wScriptedNPCWalkCounter:: ; cf18 ds 1 -wGBC:: ; cf1a - ds 1 - -wOnSGB:: ; cf1b +wOnSGB:: ; cf1a ; if running on SGB, it's 1, else it's 0 ds 1 -wDefaultPaletteCommand:: ; cf1c +wDefaultPaletteCommand:: ; cf1b ds 1 -wPlayerHPBarColor:: ; cf1d +wPlayerHPBarColor:: ; cf1c -wWholeScreenPaletteMonSpecies:: ; cf1d +wWholeScreenPaletteMonSpecies:: ; cf1c ; species of the mon whose palette is used for the whole screen ds 1 -wEnemyHPBarColor:: ; cf1e +wEnemyHPBarColor:: ; cf1d ds 1 ; 0: green ; 1: yellow ; 2: red -wPartyMenuHPBarColors:: ; cf1f +wPartyMenuHPBarColors:: ; cf1e ds 6 wStatusScreenHPBarColor:: ; cf25 @@ -1424,95 +1676,97 @@ wPalPacket:: ; cf2d wPartyMenuBlkPacket:: ; cf2e ; $30 bytes - ds 29 + ds 9 +wPartyHPBarAttributes:: ; cf36 + ds 20 -wExpAmountGained:: ; cf4b +wExpAmountGained:: ; cf4a ; 2-byte big-endian number ; the total amount of exp a mon gained wcf4b:: ds 2 ; storage buffer for various strings -wGainBoostedExp:: ; cf4d +wGainBoostedExp:: ; cf4c ds 1 ds 17 -wGymCityName:: ; cf5f +wGymCityName:: ; cf5e ds 17 -wGymLeaderName:: ; cf70 +wGymLeaderName:: ; cf6f ds NAME_LENGTH -wItemList:: ; cf7b +wItemList:: ; cf7a ds 16 -wListPointer:: ; cf8b +wListPointer:: ; cf8a ds 2 -wUnusedCF8D:: ; cf8d +wUnusedCF8D:: ; cf8c ; 2 bytes ; used to store pointers, but never read ds 2 -wItemPrices:: ; cf8f +wItemPrices:: ; cf8e ds 2 -wcf91:: ds 1 ; used with a lot of things (too much to list here) +wcf91:: ds 1 ; used with a lot of things (too much to list here) ; cf90 -wWhichPokemon:: ; cf92 +wWhichPokemon:: ; cf91 ; which pokemon you selected ds 1 -wPrintItemPrices:: ; cf93 +wPrintItemPrices:: ; cf92 ; if non-zero, then print item prices when displaying lists ds 1 -wHPBarType:: ; cf94 +wHPBarType:: ; cf93 ; type of HP bar ; $00 = enemy HUD in battle ; $01 = player HUD in battle / status screen ; $02 = party menu -wListMenuID:: ; cf94 +wListMenuID:: ; cf93 ; ID used by DisplayListMenuID ds 1 -wRemoveMonFromBox:: ; cf95 +wRemoveMonFromBox:: ; cf94 ; if non-zero, RemovePokemon will remove the mon from the current box, ; else it will remove the mon from the party -wMoveMonType:: ; cf95 +wMoveMonType:: ; cf94 ; 0 = move from box to party ; 1 = move from party to box ; 2 = move from daycare to party ; 3 = move from party to daycare ds 1 -wItemQuantity:: ; cf96 +wItemQuantity:: ; cf95 ds 1 -wMaxItemQuantity:: ; cf97 +wMaxItemQuantity:: ; cf96 ds 1 ; LoadMonData copies mon data here -wLoadedMon:: party_struct wLoadedMon ; cf98 +wLoadedMon:: party_struct wLoadedMon ; cf97 -wFontLoaded:: ; cfc4 +wFontLoaded:: ; cfc3 ; bit 0: The space in VRAM that is used to store walk animation tile patterns ; for the player and NPCs is in use for font tile patterns. ; This means that NPC movement must be disabled. ; The other bits are unused. ds 1 -wWalkCounter:: ; cfc5 +wWalkCounter:: ; cfc4 ; walk animation counter ds 1 -wTileInFrontOfPlayer:: ; cfc6 +wTileInFrontOfPlayer:: ; cfc5 ; background tile number in front of the player (either 1 or 2 steps ahead) ds 1 -wAudioFadeOutControl:: ; cfc7 +wAudioFadeOutControl:: ; cfc6 ; The desired fade counter reload value is stored here prior to calling ; PlaySound in order to cause the current music to fade out before the new ; music begins playing. Storing 0 causes no fade out to occur and the new music @@ -1524,13 +1778,13 @@ wAudioFadeOutControl:: ; cfc7 ; audio, it zeroes this variable and starts playing the sound ID stored in it. ds 1 -wAudioFadeOutCounterReloadValue:: ; cfc8 +wAudioFadeOutCounterReloadValue:: ; cfc7 ds 1 -wAudioFadeOutCounter:: ; cfc9 +wAudioFadeOutCounter:: ; cfc8 ds 1 -wLastMusicSoundID:: ; cfca +wLastMusicSoundID:: ; cfc9 ; This is used to determine whether the default music is already playing when ; attempting to play the default music (in order to avoid restarting the same ; music) and whether the music has already been stopped when attempting to @@ -1542,47 +1796,47 @@ wLastMusicSoundID:: ; cfca ; the music). ds 1 -wUpdateSpritesEnabled:: ; cfcb +wUpdateSpritesEnabled:: ; cfca ; $00 = causes sprites to be hidden and the value to change to $ff ; $01 = enabled ; $ff = disabled ; other values aren't used ds 1 -wEnemyMoveNum:: ; cfcc +wEnemyMoveNum:: ; cfcb ds 1 -wEnemyMoveEffect:: ; cfcd +wEnemyMoveEffect:: ; cfcc ds 1 -wEnemyMovePower:: ; cfce +wEnemyMovePower:: ; cfcd ds 1 -wEnemyMoveType:: ; cfcf +wEnemyMoveType:: ; cfce ds 1 -wEnemyMoveAccuracy:: ; cfd0 +wEnemyMoveAccuracy:: ; cfcf ds 1 -wEnemyMoveMaxPP:: ; cfd1 +wEnemyMoveMaxPP:: ; cfd0 ds 1 -wPlayerMoveNum:: ; cfd2 +wPlayerMoveNum:: ; cfd1 ds 1 -wPlayerMoveEffect:: ; cfd3 +wPlayerMoveEffect:: ; cfd2 ds 1 -wPlayerMovePower:: ; cfd4 +wPlayerMovePower:: ; cfd3 ds 1 -wPlayerMoveType:: ; cfd5 +wPlayerMoveType:: ; cfd4 ds 1 -wPlayerMoveAccuracy:: ; cfd6 +wPlayerMoveAccuracy:: ; cfd5 ds 1 -wPlayerMoveMaxPP:: ; cfd7 +wPlayerMoveMaxPP:: ; cfd6 ds 1 -wEnemyMonSpecies2:: ; cfd8 +wEnemyMonSpecies2:: ; cfd7 ds 1 -wBattleMonSpecies2:: ; cfd9 +wBattleMonSpecies2:: ; cfd8 ds 1 -wEnemyMonNick:: ds NAME_LENGTH ; cfda +wEnemyMonNick:: ds NAME_LENGTH ; cfd9 -wEnemyMon:: ; cfe5 +wEnemyMon:: ; cfe4 ; The wEnemyMon struct reaches past 0xcfff, ; the end of wram bank 0 on cgb. ; This has no significance on dmg, where wram @@ -1610,72 +1864,72 @@ wEnemyMonAttack:: dw wEnemyMonDefense:: dw wEnemyMonSpeed:: dw wEnemyMonSpecial:: dw -wEnemyMonPP:: ds 2 ; NUM_MOVES - 2 +wEnemyMonPP:: ds 3 ; NUM_MOVES - 1 SECTION "WRAM Bank 1", WRAMX, BANK[1] - ds 2 ; NUM_MOVES - 2 + ds 1 ; NUM_MOVES - 3 wEnemyMonBaseStats:: ds 5 wEnemyMonCatchRate:: ds 1 wEnemyMonBaseExp:: ds 1 -wBattleMonNick:: ds NAME_LENGTH ; d009 -wBattleMon:: battle_struct wBattleMon ; d014 +wBattleMonNick:: ds NAME_LENGTH ; d008 +wBattleMon:: battle_struct wBattleMon ; d013 -wTrainerClass:: ; d031 +wTrainerClass:: ; d030 ds 1 ds 1 -wTrainerPicPointer:: ; d033 +wTrainerPicPointer:: ; d032 ds 2 ds 1 -wTempMoveNameBuffer:: ; d036 +wTempMoveNameBuffer:: ; d035 -wLearnMoveMonName:: ; d036 +wLearnMoveMonName:: ; d035 ; The name of the mon that is learning a move. ds 16 -wTrainerBaseMoney:: ; d046 +wTrainerBaseMoney:: ; d045 ; 2-byte BCD number ; money received after battle = base money × level of highest-level enemy mon ds 2 -wMissableObjectCounter:: ; d048 +wMissableObjectCounter:: ; d047 ds 1 ds 1 -wTrainerName:: ; d04a +wTrainerName:: ; d049 ; 13 bytes for the letters of the opposing trainer ; the name is terminated with $50 with possible ; unused trailing letters ds 13 -wIsInBattle:: ; d057 +wIsInBattle:: ; d056 ; lost battle, this is -1 ; no battle, this is 0 ; wild battle, this is 1 ; trainer battle, this is 2 ds 1 -wPartyGainExpFlags:: ; d058 +wPartyGainExpFlags:: ; d057 ; flags that indicate which party members should be be given exp when GainExperience is called flag_array 6 -wCurOpponent:: ; d059 +wCurOpponent:: ; d058 ; in a wild battle, this is the species of pokemon ; in a trainer battle, this is the trainer class + 200 ds 1 -wBattleType:: ; d05a +wBattleType:: ; d059 ; in normal battle, this is 0 ; in old man battle, this is 1 ; in safari battle, this is 2 ds 1 -wDamageMultipliers:: ; d05b +wDamageMultipliers:: ; d05a ; bits 0-6: Effectiveness ; $0 = immune ; $5 = not very effective @@ -1684,34 +1938,34 @@ wDamageMultipliers:: ; d05b ; bit 7: STAB ds 1 -wLoneAttackNo:: ; d05c +wLoneAttackNo:: ; d05b ; which entry in LoneAttacks to use -wGymLeaderNo:: ; d05c +wGymLeaderNo:: ; d05b ; it's actually the same thing as ^ ds 1 -wTrainerNo:: ; d05d +wTrainerNo:: ; d05c ; which instance of [youngster, lass, etc] is this? ds 1 -wCriticalHitOrOHKO:: ; d05e +wCriticalHitOrOHKO:: ; d05d ; $00 = normal attack ; $01 = critical hit ; $02 = successful OHKO ; $ff = failed OHKO ds 1 -wMoveMissed:: ; d05f +wMoveMissed:: ; d05e ds 1 -wPlayerStatsToDouble:: ; d060 +wPlayerStatsToDouble:: ; d05f ; always 0 ds 1 -wPlayerStatsToHalve:: ; d061 +wPlayerStatsToHalve:: ; d060 ; always 0 ds 1 -wPlayerBattleStatus1:: ; d062 +wPlayerBattleStatus1:: ; d061 ; bit 0 - bide ; bit 1 - thrash / petal dance ; bit 2 - attacking multiple times (e.g. double kick) @@ -1722,7 +1976,7 @@ wPlayerBattleStatus1:: ; d062 ; bit 7 - confusion ds 1 -wPlayerBattleStatus2:: ; d063 +wPlayerBattleStatus2:: ; d062 ; bit 0 - X Accuracy effect ; bit 1 - protected by "mist" ; bit 2 - focus energy effect @@ -1732,106 +1986,104 @@ wPlayerBattleStatus2:: ; d063 ; bit 7 - leech seeded ds 1 -wPlayerBattleStatus3:: ; d064 +wPlayerBattleStatus3:: ; d063 ; bit 0 - toxic ; bit 1 - light screen ; bit 2 - reflect ; bit 3 - tranformed ds 1 -wEnemyStatsToDouble:: ; d065 +wEnemyStatsToDouble:: ; d064 ; always 0 ds 1 -wEnemyStatsToHalve:: ; d066 +wEnemyStatsToHalve:: ; d065 ; always 0 ds 1 -wEnemyBattleStatus1:: ; d067 +wEnemyBattleStatus1:: ; d066 ds 1 -wEnemyBattleStatus2:: ; d068 +wEnemyBattleStatus2:: ; d067 ds 1 -wEnemyBattleStatus3:: ; d069 +wEnemyBattleStatus3:: ; d068 ds 1 -wPlayerNumAttacksLeft:: +wPlayerNumAttacksLeft:: ; d069 ; when the player is attacking multiple times, the number of attacks left ds 1 -wPlayerConfusedCounter:: ; d06b +wPlayerConfusedCounter:: ; d06a ds 1 -wPlayerToxicCounter:: ; d06c +wPlayerToxicCounter:: ; d06b ds 1 - -wPlayerDisabledMove:: ; d06d +wPlayerDisabledMove:: ; d06c ; high nibble: which move is disabled (1-4) ; low nibble: disable turns left ds 1 ds 1 -wEnemyNumAttacksLeft:: ; d06f +wEnemyNumAttacksLeft:: ; d06e ; when the enemy is attacking multiple times, the number of attacks left ds 1 -wEnemyConfusedCounter:: ; d070 +wEnemyConfusedCounter:: ; d06f ds 1 -wEnemyToxcCounter:: ; d071 +wEnemyToxicCounter:: ; d070 ds 1 - -wEnemyDisabledMove:: ; d072 +wEnemyDisabledMove:: ; d071 ; high nibble: which move is disabled (1-4) ; low nibble: disable turns left ds 1 ds 1 -wPlayerNumHits:: ; d074 +wPlayerNumHits:: ; d073 ; number of hits by player in attacks like Double Slap, etc. -wPlayerBideAccumulatedDamage:: ; d074 +wPlayerBideAccumulatedDamage:: ; d073 ; the amount of damage accumulated by the player while biding (2 bytes) -wUnknownSerialCounter2:: ; d075 +wUnknownSerialCounter2:: ; d073 ; 2 bytes ds 4 -wEscapedFromBattle:: +wEscapedFromBattle:: ; d077 ; non-zero when an item or move that allows escape from battle was used ds 1 -wAmountMoneyWon:: ; d079 +wAmountMoneyWon:: ; d078 ; 3-byte BCD number -wObjectToHide:: ; d079 +wObjectToHide:: ; d078 ds 1 -wObjectToShow:: ; d07a +wObjectToShow:: ; d079 ds 1 ds 1 -wDefaultMap:: ; d07c +wDefaultMap:: ; d07b ; the map you will start at when the debug bit is set -wMenuItemOffset:: ; d07c +wMenuItemOffset:: ; d07b -wAnimationID:: ; d07c +wAnimationID:: ; d07b ; ID number of the current battle animation ds 1 -wNamingScreenType:: ; d07d +wNamingScreenType:: ; d07c -wPartyMenuTypeOrMessageID:: ; d07d +wPartyMenuTypeOrMessageID:: ; d07c -wTempTilesetNumTiles:: ; d07d +wTempTilesetNumTiles:: ; d07c ; temporary storage for the number of tiles in a tileset ds 1 -wSavedListScrollOffset:: ; d07e +wSavedListScrollOffset:: ; d07d ; used by the pokemart code to save the existing value of wListScrollOffset ; so that it can be restored when the player is done with the pokemart NPC ds 1 @@ -1839,71 +2091,71 @@ wSavedListScrollOffset:: ; d07e ds 2 ; base coordinates of frame block -wBaseCoordX:: ; d081 +wBaseCoordX:: ; d080 ds 1 -wBaseCoordY:: ; d082 +wBaseCoordY:: ; d081 ds 1 ; low health alarm counter/enable ; high bit = enable, others = timer to cycle frequencies -wLowHealthAlarm:: ds 1 ; d083 +wLowHealthAlarm:: ds 1 ; d082 -wFBTileCounter:: ; d084 +wFBTileCounter:: ; d083 ; counts how many tiles of the current frame block have been drawn ds 1 -wMovingBGTilesCounter2:: ; d085 +wMovingBGTilesCounter2:: ; d084 ds 1 -wSubAnimFrameDelay:: ; d086 +wSubAnimFrameDelay:: ; d085 ; duration of each frame of the current subanimation in terms of screen refreshes ds 1 -wSubAnimCounter:: ; d087 +wSubAnimCounter:: ; d086 ; counts the number of subentries left in the current subanimation ds 1 -wSaveFileStatus:: ; d088 +wSaveFileStatus:: ; d087 ; 1 = no save file or save file is corrupted ; 2 = save file exists and no corruption has been detected ds 1 -wNumFBTiles:: ; d089 +wNumFBTiles:: ; d088 ; number of tiles in current battle animation frame block ds 1 -wFlashScreenLongCounter:: ; d08a +wFlashScreenLongCounter:: ; d089 -wSpiralBallsBaseY:: ; d08a +wSpiralBallsBaseY:: ; d089 -wFallingObjectMovementByte:: ; d08a +wFallingObjectMovementByte:: ; d089 ; bits 0-6: index into FallingObjects_DeltaXs array (0 - 8) ; bit 7: direction; 0 = right, 1 = left -wNumShootingBalls:: ; d08a +wNumShootingBalls:: ; d089 -wTradedMonMovingRight:: ; d08a +wTradedMonMovingRight:: ; d089 ; $01 if mon is moving from left gameboy to right gameboy; $00 if vice versa -wOptionsInitialized:: ; d08a +wOptionsInitialized:: ; d089 -wNewSlotMachineBallTile:: ; d08a +wNewSlotMachineBallTile:: ; d089 -wCoordAdjustmentAmount:: ; d08a +wCoordAdjustmentAmount:: ; d089 ; how much to add to the X/Y coord -wUnusedD08A:: ; d08a +wUnusedD08A:: ; d089 ds 1 -wSpiralBallsBaseX:: ; d08b +wSpiralBallsBaseX:: ; d08a -wNumFallingObjects:: ; d08b +wNumFallingObjects:: ; d08a -wSlideMonDelay:: ; d08b +wSlideMonDelay:: ; d08a -wAnimCounter:: ; d08b +wAnimCounter:: ; d08a ; generic counter variable for various animations -wSubAnimTransform:: ; d08b +wSubAnimTransform:: ; d08a ; controls what transformations are applied to the subanimation ; 01: flip horizontally and vertically ; 02: flip horizontally and translate downwards 40 pixels @@ -1911,52 +2163,52 @@ wSubAnimTransform:: ; d08b ; 04: reverse the subanimation ds 1 -wEndBattleWinTextPointer:: ; d08c +wEndBattleWinTextPointer:: ; d08b ds 2 -wEndBattleLoseTextPointer:: ; d08e +wEndBattleLoseTextPointer:: ; d08d ds 2 ds 2 -wEndBattleTextRomBank:: ; d092 +wEndBattleTextRomBank:: ; d091 ds 1 ds 1 -wSubAnimAddrPtr:: ; d094 +wSubAnimAddrPtr:: ; d093 ; the address _of the address_ of the current subanimation entry ds 2 -wSlotMachineAllowMatchesCounter:: ; d096 +wSlotMachineAllowMatchesCounter:: ; d095 ; If non-zero, the allow matches flag is always set. ; There is a 1/256 (~0.4%) chance that this value will be set to 60, which is ; the only way it can increase. Winning certain payout amounts will decrement it ; or zero it. -wSubAnimSubEntryAddr:: ; d096 +wSubAnimSubEntryAddr:: ; d095 ; the address of the current subentry of the current subanimation ds 2 ds 2 -wOutwardSpiralTileMapPointer:: ; d09a +wOutwardSpiralTileMapPointer:: ; d099 ds 1 -wPartyMenuAnimMonEnabled:: ; d09b +wPartyMenuAnimMonEnabled:: ; d09a -wTownMapSpriteBlinkingEnabled:: ; d09b +wTownMapSpriteBlinkingEnabled:: ; d09a ; non-zero when enabled. causes nest locations to blink on and off. ; the town selection cursor will blink regardless of what this value is -wUnusedD09B:: ; d09b +wUnusedD09B:: ; d09a ds 1 -wFBDestAddr:: ; d09c +wFBDestAddr:: ; d09b ; current destination address in OAM for frame blocks (big endian) ds 2 -wFBMode:: ; d09e +wFBMode:: ; d09d ; controls how the frame blocks are put together to form frames ; specifically, after finishing drawing the frame block, the frame block's mode determines what happens ; 00: clean OAM buffer and delay @@ -1965,173 +2217,172 @@ wFBMode:: ; d09e ; 04: delay, without cleaning OAM buffer, and do not advance [wFBDestAddr], so that the next frame block will overwrite this one ds 1 -wLinkCableAnimBulgeToggle:: ; d09f +wLinkCableAnimBulgeToggle:: ; d09e ; 0 = small ; 1 = big -wIntroNidorinoBaseTile:: ; d09f +wIntroNidorinoBaseTile:: ; d09e -wOutwardSpiralCurrentDirection:: ; d09f +wOutwardSpiralCurrentDirection:: ; d09e -wDropletTile:: ; d09f +wDropletTile:: ; d09e -wNewTileBlockID:: ; d09f +wNewTileBlockID:: ; d09e -wWhichBattleAnimTileset:: ; d09f +wWhichBattleAnimTileset:: ; d09e -wSquishMonCurrentDirection:: ; d09f +wSquishMonCurrentDirection:: ; d09e ; 0 = left ; 1 = right -wSlideMonUpBottomRowLeftTile:: ; d09f +wSlideMonUpBottomRowLeftTile:: ; d09e ; the tile ID of the leftmost tile in the bottom row in AnimationSlideMonUp_ ds 1 -wDisableVBlankWYUpdate:: ds 1 ; if non-zero, don't update WY during V-blank +wDisableVBlankWYUpdate:: ds 1 ; if non-zero, don't update WY during V-blank ; d09f -wSpriteCurPosX:: ; d0a1 +wSpriteCurPosX:: ; d0a0 ds 1 -wSpriteCurPosY:: ; d0a2 +wSpriteCurPosY:: ; d0a1 ds 1 -wSpriteWidth:: ; d0a3 +wSpriteWidth:: ; d0a2 ds 1 -wSpriteHeight:: ; d0a4 +wSpriteHeight:: ; d0a3 ds 1 -wSpriteInputCurByte:: ; d0a5 +wSpriteInputCurByte:: ; d0a4 ; current input byte ds 1 -wSpriteInputBitCounter:: ; d0a6 +wSpriteInputBitCounter:: ; d0a5 ; bit offset of last read input bit ds 1 -wSpriteOutputBitOffset:: ; d0a7; determines where in the output byte the two bits are placed. Each byte contains four columns (2bpp data) +wSpriteOutputBitOffset:: ; d0a6; determines where in the output byte the two bits are placed. Each byte contains four columns (2bpp data) ; 3 -> XX000000 1st column ; 2 -> 00XX0000 2nd column ; 1 -> 0000XX00 3rd column ; 0 -> 000000XX 4th column ds 1 -wSpriteLoadFlags:: ; d0a8 +wSpriteLoadFlags:: ; d0a7 ; bit 0 determines used buffer (0 -> $a188, 1 -> $a310) ; bit 1 loading last sprite chunk? (there are at most 2 chunks per load operation) ds 1 -wSpriteUnpackMode:: ; d0a9 +wSpriteUnpackMode:: ; d0a8 ds 1 -wSpriteFlipped:: ; d0aa +wSpriteFlipped:: ; d0a9 ds 1 -wSpriteInputPtr:: ; d0ab +wSpriteInputPtr:: ; d0aa ; pointer to next input byte ds 2 -wSpriteOutputPtr:: ; d0ad +wSpriteOutputPtr:: ; d0ac ; pointer to current output byte ds 2 -wSpriteOutputPtrCached:: ; d0af +wSpriteOutputPtrCached:: ; d0ae ; used to revert pointer for different bit offsets ds 2 -wSpriteDecodeTable0Ptr:: ; d0b1 +wSpriteDecodeTable0Ptr:: ; d0b0 ; pointer to differential decoding table (assuming initial value 0) ds 2 -wSpriteDecodeTable1Ptr:: ; d0b3 +wSpriteDecodeTable1Ptr:: ; d0b2 ; pointer to differential decoding table (assuming initial value 1) ds 2 -wd0b5:: ds 1 ; used as a temp storage area for Pokemon Species, and other Pokemon/Battle related things +wd0b5:: ds 1 ; used as a temp storage area for Pokemon Species, and other Pokemon/Battle related things ; d0b4 -wNameListType:: ; d0b6 +wNameListType:: ; d0b5 ds 1 -wPredefBank:: ; d0b7 +wPredefBank:: ; d0b6 ds 1 -wMonHeader:: ; d0b8 +wMonHeader:: ; d0b7 -wMonHIndex:: ; d0b8 +wMonHIndex:: ; d0b7 ; In the ROM base stats data stucture, this is the dex number, but it is ; overwritten with the internal index number after the header is copied to WRAM. ds 1 -wMonHBaseStats:: ; d0b9 -wMonHBaseHP:: ; d0b9 +wMonHBaseStats:: ; d0b8 +wMonHBaseHP:: ; d0b8 ds 1 -wMonHBaseAttack:: ; d0ba +wMonHBaseAttack:: ; d0b9 ds 1 -wMonHBaseDefense:: ; d0bb +wMonHBaseDefense:: ; d0ba ds 1 -wMonHBaseSpeed:: ; d0bc +wMonHBaseSpeed:: ; d0bb ds 1 -wMonHBaseSpecial:: ; d0bd +wMonHBaseSpecial:: ; d0bc ds 1 -wMonHTypes:: ; d0be -wMonHType1:: ; d0be +wMonHTypes:: ; d0bd +wMonHType1:: ; d0bd ds 1 -wMonHType2:: ; d0bf +wMonHType2:: ; d0be ds 1 -wMonHCatchRate:: ; d0c0 +wMonHCatchRate:: ; d0bf ds 1 -wMonHBaseEXP:: ; d0c1 +wMonHBaseEXP:: ; d0c0 ds 1 -wMonHSpriteDim:: ; d0c2 +wMonHSpriteDim:: ; d0c1 ds 1 -wMonHFrontSprite:: ; d0c3 +wMonHFrontSprite:: ; d0c2 ds 2 -wMonHBackSprite:: ; d0c5 +wMonHBackSprite:: ; d0c4 ds 2 -wMonHMoves:: ; d0c7 - ds NUM_MOVES +wMonHMoves:: ; d0c6 + ds 4 -wMonHGrowthRate:: ; d0cb +wMonHGrowthRate:: ; d0ca ds 1 -wMonHLearnset:: ; d0cc +wMonHLearnset:: ; d0cb ; bit field flag_array 50 + 5 ds 1 -wSavedTilesetType:: ; d0d4 +wSavedTilesetType:: ; d0d3 ; saved at the start of a battle and then written back at the end of the battle ds 1 ds 2 - -wDamage:: ; d0d7 +wDamage:: ; d0d6 ds 2 ds 2 -wRepelRemainingSteps:: ; d0db +wRepelRemainingSteps:: ; d0da ds 1 -wMoves:: ; d0dc +wMoves:: ; d0db ; list of moves for FormatMovesString ds 4 -wMoveNum:: ; d0e0 +wMoveNum:: ; d0df ds 1 -wMovesString:: ; d0e1 +wMovesString:: ; d0e0 ds 56 -wUnusedD119:: ; d119 +wUnusedD119:: ; d118 ds 1 -wWalkBikeSurfStateCopy:: ; d11a +wWalkBikeSurfStateCopy:: ; d119 ; wWalkBikeSurfState is sometimes copied here, but it doesn't seem to be used for anything ds 1 -wInitListType:: ; d11b +wInitListType:: ; d11a ; the type of list for InitList to init ds 1 -wCapturedMonSpecies:: ; d11c +wCapturedMonSpecies:: ; d11b ; 0 if no mon was captured ds 1 -wFirstMonsNotOutYet:: ; d11d +wFirstMonsNotOutYet:: ; d11c ; Non-zero when the first player mon and enemy mon haven't been sent out yet. ; It prevents the game from asking if the player wants to choose another mon ; when the enemy sends out their first mon and suppresses the "no will to fight" @@ -2143,73 +2394,74 @@ wPokeBallCaptureCalcTemp:: ; d11e ; lower nybble: number of shakes ; upper nybble: number of animations to play -wPokeBallAnimData:: ; d11e +wPokeBallAnimData:: ; d11d -wUsingPPUp:: ; d11e +wUsingPPUp:: ; d11d -wMaxPP:: ; d11e +wMaxPP:: ; d11d ; 0 for player, non-zero for enemy -wCalculateWhoseStats:: ; d11e +wCalculateWhoseStats:: ; d11d -wTypeEffectiveness:: ; d11e +wTypeEffectiveness:: ; d11d -wMoveType:: ; d11e +wMoveType:: ; d11d -wNumSetBits:: ; d11e +wNumSetBits:: ; d11d wd11e:: ds 1 ; used as a Pokemon and Item storage value. Also used as an output value for CountSetBits -wForcePlayerToChooseMon:: ; d11f +wForcePlayerToChooseMon:: ; d11e ; When this value is non-zero, the player isn't allowed to exit the party menu ; by pressing B and not choosing a mon. ds 1 -wNumRunAttempts:: +wNumRunAttempts:: ; d11f ; number of times the player has tried to run from battle ds 1 -wEvolutionOccurred:: ; d121 +wEvolutionOccurred:: ; d120 ds 1 -wVBlankSavedROMBank:: ; d122 +wVBlankSavedROMBank:: ; d121 ds 1 +wFarCopyDataSavedROMBank:: ; d122 ds 1 -wIsKeyItem:: ; d124 +wIsKeyItem:: ; d123 ds 1 -wTextBoxID:: ; d125 +wTextBoxID:: ; d124 ds 1 -wCurrentMapScriptFlags:: ds 1 ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value +wCurrentMapScriptFlags:: ds 1 ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value ; d125 -wCurEnemyLVL:: ; d127 +wCurEnemyLVL:: ; d126 ds 1 -wItemListPointer:: ; d128 +wItemListPointer:: ; d127 ; pointer to list of items terminated by $FF ds 2 -wListCount:: +wListCount:: ; d129 ; number of entries in a list ds 1 -wLinkState:: ; d12b +wLinkState:: ; d12a ds 1 -wTwoOptionMenuID:: ; d12c +wTwoOptionMenuID:: ; d12b ds 1 -wChosenMenuItem:: ; d12d +wChosenMenuItem:: ; d12c ; the id of the menu item the player ultimately chose -wOutOfBattleBlackout:: ; d12d +wOutOfBattleBlackout:: ; d12c ; non-zero when the whole party has fainted due to out-of-battle poison damage ds 1 -wMenuExitMethod:: ; d12e +wMenuExitMethod:: ; d12d ; the way the user exited a menu ; for list menus and the buy/sell/quit menu: ; $01 = the user pressed A to choose a menu item @@ -2219,147 +2471,148 @@ wMenuExitMethod:: ; d12e ; $02 = the user pressed B or pressed A with the second menu item selected ds 1 -wDungeonWarpDataEntrySize:: ; d12f +wDungeonWarpDataEntrySize:: ; d12e ; the size is always 6, so they didn't need a variable in RAM for this -wWhichPewterGuy:: ; d12f +wWhichPewterGuy:: ; d12e ; 0 = museum guy ; 1 = gym guy -wWhichPrizeWindow:: ; d12f +wWhichPrizeWindow:: ; d12e ; there are 3 windows, from 0 to 2 -wGymGateTileBlock:: ; d12f +wGymGateTileBlock:: ; d12e ; a horizontal or vertical gate block ds 1 -wSavedSpriteScreenY:: ; d130 +wSavedSpriteScreenY:: ; d12f ds 1 -wSavedSpriteScreenX:: ; d131 +wSavedSpriteScreenX:: ; d130 ds 1 -wSavedSpriteMapY:: ; d132 +wSavedSpriteMapY:: ; d131 ds 1 -wSavedSpriteMapX:: ; d133 +wSavedSpriteMapX:: ; d132 ds 1 ds 5 -wWhichPrize:: ; d139 +wWhichPrize:: ; d138 ds 1 -wIgnoreInputCounter:: ; d13a +wIgnoreInputCounter:: ; d139 ; counts downward each frame ; when it hits 0, bit 5 (ignore input bit) of wd730 is reset ds 1 -wStepCounter:: ; d13b +wStepCounter:: ; d13a ; counts down once every step ds 1 -wNumberOfNoRandomBattleStepsLeft:: ; d13c +wNumberOfNoRandomBattleStepsLeft:: ; d13b ; after a battle, you have at least 3 steps before a random battle can occur ds 1 -wPrize1:: ; d13d +wPrize1:: ; d13c ds 1 -wPrize2:: ; d13e +wPrize2:: ; d13d ds 1 -wPrize3:: ; d13f +wPrize3:: ; d13e ds 1 ds 1 -wSerialRandomNumberListBlock:: ; d141 +wSerialRandomNumberListBlock:: ; d140 ; the first 7 bytes are the preamble -wPrize1Price:: ; d141 +wPrize1Price:: ; d140 ds 2 -wPrize2Price:: ; d143 +wPrize2Price:: ; d142 ds 2 -wPrize3Price:: ; d145 +wPrize3Price:: ; d144 ds 2 ds 1 -wLinkBattleRandomNumberList:: ; d148 +wLinkBattleRandomNumberList:: ; d147 ; shared list of 9 random numbers, indexed by wLinkBattleRandomNumberListIndex ds 10 -wSerialPlayerDataBlock:: ; d152 +wSerialPlayerDataBlock:: ; d151 ; the first 6 bytes are the preamble -wPseudoItemID:: ; d152 +wPseudoItemID:: ; d151 ; When a real item is being used, this is 0. ; When a move is acting as an item, this is the ID of the item it's acting as. ; For example, out-of-battle Dig is executed using a fake Escape Rope item. In ; that case, this would be ESCAPE_ROPE. ds 1 -wUnusedD153:: ; d153 +wUnusedD153:: ; d152 ds 1 ds 2 -wEvoStoneItemID:: ; d156 +wEvoStoneItemID:: ; d155 ds 1 -wSavedNPCMovementDirections2Index:: ; d157 +wSavedNPCMovementDirections2Index:: ; d156 ds 1 -wPlayerName:: ; d158 +wPlayerName:: ; d157 ds NAME_LENGTH wPartyDataStart:: -wPartyCount:: ds 1 ; d163 -wPartySpecies:: ds PARTY_LENGTH ; d164 -wPartyEnd:: ds 1 ; d16a +wPartyCount:: ds 1 ; d162 +wPartySpecies:: ds PARTY_LENGTH ; d163 +wPartyEnd:: ds 1 ; d169 wPartyMons:: -wPartyMon1:: party_struct wPartyMon1 ; d16b -wPartyMon2:: party_struct wPartyMon2 ; d197 -wPartyMon3:: party_struct wPartyMon3 ; d1c3 -wPartyMon4:: party_struct wPartyMon4 ; d1ef -wPartyMon5:: party_struct wPartyMon5 ; d21b -wPartyMon6:: party_struct wPartyMon6 ; d247 +wPartyMon1:: party_struct wPartyMon1 ; d16a +wPartyMon2:: party_struct wPartyMon2 ; d196 +wPartyMon3:: party_struct wPartyMon3 ; d1c2 +wPartyMon4:: party_struct wPartyMon4 ; d1ee +wPartyMon5:: party_struct wPartyMon5 ; d21a +wPartyMon6:: party_struct wPartyMon6 ; d246 -wPartyMonOT:: ds NAME_LENGTH * PARTY_LENGTH ; d273 -wPartyMonNicks:: ds NAME_LENGTH * PARTY_LENGTH ; d2b5 +wPartyMonOT:: ds NAME_LENGTH * PARTY_LENGTH ; d272 +wPartyMonNicks:: ds NAME_LENGTH * PARTY_LENGTH ; d2b4 +wPartyMonNicksEnd:: wPartyDataEnd:: wMainDataStart:: -wPokedexOwned:: ; d2f7 +wPokedexOwned:: ; d2f5 flag_array NUM_POKEMON wPokedexOwnedEnd:: -wPokedexSeen:: ; d30a +wPokedexSeen:: ; d309 flag_array NUM_POKEMON wPokedexSeenEnd:: -wNumBagItems:: ; d31d +wNumBagItems:: ; d31c ds 1 -wBagItems:: ; d31e +wBagItems:: ; d31d ; item, quantity ds BAG_ITEM_CAPACITY * 2 ds 1 ; end -wPlayerMoney:: ; d347 +wPlayerMoney:: ; d346 ds 3 ; BCD -wRivalName:: ; d34a +wRivalName:: ; d349 ds NAME_LENGTH -wOptions:: ; d355 +wOptions:: ; d354 ; bit 7 = battle animation ; 0: On ; 1: Off @@ -2372,557 +2625,647 @@ wOptions:: ; d355 ; 5: Slow ds 1 -wObtainedBadges:: ; d356 +wObtainedBadges:: ; d355 flag_array 8 ds 1 -wLetterPrintingDelayFlags:: ; d358 +wLetterPrintingDelayFlags:: ; d357 ; bit 0: If 0, limit the delay to 1 frame. Note that this has no effect if ; the delay has been disabled entirely through bit 1 of this variable ; or bit 6 of wd730. ; bit 1: If 0, no delay. ds 1 -wPlayerID:: ; d359 +wPlayerID:: ; d358 ds 2 -wMapMusicSoundID:: ; d35b +wMapMusicSoundID:: ; d35a ds 1 -wMapMusicROMBank:: ; d35c +wMapMusicROMBank:: ; d35b ds 1 -wMapPalOffset:: ; d35d +wMapPalOffset:: ; d35c ; offset subtracted from FadePal4 to get the background and object palettes for the current map ; normally, it is 0. it is 6 when Flash is needed, causing FadePal2 to be used instead of FadePal4 ds 1 -wCurMap:: ; d35e +wCurMap:: ; d35d ds 1 -wCurrentTileBlockMapViewPointer:: ; d35f +wCurrentTileBlockMapViewPointer:: ; d35e ; pointer to the upper left corner of the current view in the tile block map ds 2 -wYCoord:: ; d361 +wYCoord:: ; d360 ; player’s position on the current map ds 1 -wXCoord:: ; d362 +wXCoord:: ; d361 ds 1 -wYBlockCoord:: ; d363 +wYBlockCoord:: ; d362 ; player's y position (by block) ds 1 -wXBlockCoord:: ; d364 +wXBlockCoord:: ; d363 ds 1 -wLastMap:: ; d365 +wLastMap:: ; d364 ds 1 -wUnusedD366:: ; d366 +wUnusedD366:: ; d365 ds 1 -wCurMapTileset:: ; d367 +wCurMapTileset:: ; d366 ds 1 -wCurMapHeight:: ; d368 +wCurMapHeight:: ; d367 ; blocks ds 1 -wCurMapWidth:: ; d369 +wCurMapWidth:: ; d368 ; blocks ds 1 -wMapDataPtr:: ; d36a +wMapDataPtr:: ; d369 ds 2 -wMapTextPtr:: ; d36c +wMapTextPtr:: ; d36b ds 2 -wMapScriptPtr:: ; d36e +wMapScriptPtr:: ; d36d ds 2 -wMapConnections:: ; d370 +wMapConnections:: ; d36f ; connection byte ds 1 -wMapConn1Ptr:: ; d371 +wMapConn1Ptr:: ; d370 ds 1 -wNorthConnectionStripSrc:: ; d372 +wNorthConnectionStripSrc:: ; d371 ds 2 -wNorthConnectionStripDest:: ; d374 +wNorthConnectionStripDest:: ; d373 ds 2 -wNorthConnectionStripWidth:: ; d376 +wNorthConnectionStripWidth:: ; d375 ds 1 -wNorthConnectedMapWidth:: ; d377 +wNorthConnectedMapWidth:: ; d376 ds 1 -wNorthConnectedMapYAlignment:: ; d378 +wNorthConnectedMapYAlignment:: ; d377 ds 1 -wNorthConnectedMapXAlignment:: ; d379 +wNorthConnectedMapXAlignment:: ; d378 ds 1 -wNorthConnectedMapViewPointer:: ; d37a +wNorthConnectedMapViewPointer:: ; d379 ds 2 -wMapConn2Ptr:: ; d37c +wMapConn2Ptr:: ; d37b ds 1 -wSouthConnectionStripSrc:: ; d37d +wSouthConnectionStripSrc:: ; d37c ds 2 -wSouthConnectionStripDest:: ; d37f: +wSouthConnectionStripDest:: ; d37e ds 2 -wSouthConnectionStripWidth:: ; d381 +wSouthConnectionStripWidth:: ; d380 ds 1 -wSouthConnectedMapWidth:: ; d382 +wSouthConnectedMapWidth:: ; d381 ds 1 -wSouthConnectedMapYAlignment:: ; d383 +wSouthConnectedMapYAlignment:: ; d382 ds 1 -wSouthConnectedMapXAlignment:: ; d384 +wSouthConnectedMapXAlignment:: ; d383 ds 1 -wSouthConnectedMapViewPointer:: ; d385 +wSouthConnectedMapViewPointer:: ; d384 ds 2 -wMapConn3Ptr:: ; d387 +wMapConn3Ptr:: ; d386 ds 1 -wWestConnectionStripSrc:: ; d388 +wWestConnectionStripSrc:: ; d387 ds 2 -wWestConnectionStripDest:: ; d38a +wWestConnectionStripDest:: ; d389 ds 2 -wWestConnectionStripHeight:: ; d38c +wWestConnectionStripHeight:: ; d38b ds 1 -wWestConnectedMapWidth:: ; d38d +wWestConnectedMapWidth:: ; d38c ds 1 -wWestConnectedMapYAlignment:: ; d38e +wWestConnectedMapYAlignment:: ; d38d ds 1 -wWestConnectedMapXAlignment:: ; d38f +wWestConnectedMapXAlignment:: ; d38e ds 1 -wWestConnectedMapViewPointer:: ; d390 +wWestConnectedMapViewPointer:: ; d38f ds 2 -wMapConn4Ptr:: ; d392 +wMapConn4Ptr:: ; d391 ds 1 -wEastConnectionStripSrc:: ; d393 +wEastConnectionStripSrc:: ; d392 ds 2 -wEastConnectionStripDest:: ; d395 +wEastConnectionStripDest:: ; d394 ds 2 -wEastConnectionStripHeight:: ; d397 +wEastConnectionStripHeight:: ; d396 ds 1 -wEastConnectedMapWidth:: ; d398 +wEastConnectedMapWidth:: ; d397 ds 1 -wEastConnectedMapYAlignment:: ; d399 +wEastConnectedMapYAlignment:: ; d398 ds 1 -wEastConnectedMapXAlignment:: ; d39a +wEastConnectedMapXAlignment:: ; d399 ds 1 -wEastConnectedMapViewPointer:: ; d39b +wEastConnectedMapViewPointer:: ; d39a ds 2 -wSpriteSet:: ; d39d +wSpriteSet:: ; d39c ; sprite set for the current map (11 sprite picture ID's) ds 11 -wSpriteSetID:: ; d3a8 +wSpriteSetID:: ; d3a7 ; sprite set ID for the current map ds 1 -wObjectDataPointerTemp:: ; d3a9 +wObjectDataPointerTemp:: ; d3a8 ds 2 ds 2 -wMapBackgroundTile:: ; d3ad +wMapBackgroundTile:: ; d3ac ; the tile shown outside the boundaries of the map ds 1 -wNumberOfWarps:: ; d3ae +wNumberOfWarps:: ; d3ad ; number of warps in current map ds 1 -wWarpEntries:: ; d3af +wWarpEntries:: ; d3ae ; current map warp entries ds 128 -wDestinationWarpID:: ; d42f +wDestinationWarpID:: ; d42e ; if $ff, the player's coordinates are not updated when entering the map ds 1 - ds 128 +wPikachuOverworldStateFlags:: ds 1 ; d42f +wPikachuSpawnState:: ds 1 ; d430 +wd432:: ds 1 ; d431 +wd433:: ds 1 ; d432 +wd434:: ds 1 ; d433 +wd435:: ds 1 ; d434 +wd436:: ds 1 ; d435 +wPikachuFollowCommandBufferSize:: ds 1 ; d436 +wPikachuFollowCommandBuffer:: ds 16 ; d437 + +wExpressionNumber:: ; d447 + ds 1 +wPikaPicAnimNumber:: ; d448 + ds 1 + +wPikachuMovementScriptBank:: ds 1 ; d449 +wPikachuMovementScriptAddress:: dw ; d44a +wPikachuMovementFlags:: ; d44c +; bit 6 - spawn shadow +; bit 7 - signal end of command + ds 1 + +wCurPikaMovementData:: ; d44d +wCurPikaMovementParam1:: ds 1 ; d44d +wCurPikaMovementFunc1:: ds 1 ; d44e +wCurPikaMovementParam2:: ds 1 ; d44f +wCurPikaMovementFunc2:: ds 1 ; d450 +wd451:: ds 1 ; d451 +wCurPikaMovementSpriteImageIdx:: ds 1 ; d452 +wPikaSpriteX:: ds 1 ; d453 +wPikaSpriteY:: ds 1 ; d454 +wPikachuMovementXOffset:: ds 1 ; d455 +wPikachuMovementYOffset:: ds 1 ; d456 +wPikachuStepTimer:: ds 1 ; d457 +wPikachuStepSubtimer:: ds 1 ; d458 + ds 5 +wCurPikaMovementDataEnd:: ; d45e + ds wCurPikaMovementData - @ + + +wPikaPicAnimPointer:: dw ; d44d +wPikaPicAnimPointerSetupFinished:: ds 1 ; d44f +wPikaPicAnimCurGraphicID:: ds 1 ; d450 +wPikaPicAnimTimer:: ds 2 ; d451 +wPikaPicAnimDelay:: ds 1 ; d453 +wPikaPicPikaDrawStartX:: ds 1 ; d454 +wPikaPicPikaDrawStartY:: ds 1 ; d455 + +wCurPikaPicAnimObject:: ; d456 +wCurPikaPicAnimObjectVTileOffset:: db ; d456 +wCurPikaPicAnimObjectXOffset:: db ; d457 +wCurPikaPicAnimObjectYOffset:: db ; d458 +wCurPikaPicAnimObjectScriptIdx:: db ; d459 +wCurPikaPicAnimObjectFrameIdx:: db ; d45a +wCurPikaPicAnimObjectFrameTimer:: db ; d45b + ds 1 +wCurPikaPicAnimObjectEnd:: ; d45d + + ds 18 + +wPikachuHappiness:: ds 1 ; d46f +wPikachuMood:: ds 1 ; d470 +wd472:: ds 1 ; d471 +wd473:: ds 1 ; d472 + + ds 1 + +wd475:: ds 1 ; d474 + + ds 4 -wNumSigns:: ; d4b0 +wd47a:: ds 1 ; d479 + + ds 24 + +wd492:: ds 1 ; d492 + + ds 1 + +wSurfingMinigameHiScore:: ds 2 ; 4-digit BCD little-endian + ds 1 + +wPrinterSettings:: ds 1 +wUnknownSerialFlag_d499:: ds 1 ; d498 +wPrinterConnectionOpen:: ds 1 ; d499 +wPrinterOpcode:: ds 1 ; d49a +wd49c:: ds 1 ; d49b + + ds 19 + +wNumSigns:: ; d4af ; number of signs in the current map (up to 16) ds 1 -wSignCoords:: ; d4b1 +wSignCoords:: ; d4b0 ; 2 bytes each ; Y, X ds 32 -wSignTextIDs:: ; d4d1 +wSignTextIDs:: ; d4d0 ds 16 -wNumSprites:: ; d4e1 +wNumSprites:: ; d4e0 ; number of sprites on the current map ds 1 ; these two variables track the X and Y offset in blocks from the last special warp used ; they don't seem to be used for anything -wYOffsetSinceLastSpecialWarp:: ; d4e2 +wYOffsetSinceLastSpecialWarp:: ; d4e1 ds 1 -wXOffsetSinceLastSpecialWarp:: ; d4e3 +wXOffsetSinceLastSpecialWarp:: ; d4e2 ds 1 -wMapSpriteData:: ; d4e4 +wMapSpriteData:: ; d4e3 ; two bytes per sprite (movement byte 2, text ID) ds 32 -wMapSpriteExtraData:: ; d504 +wMapSpriteExtraData:: ; d503 ; two bytes per sprite (trainer class/item ID, trainer set ID) ds 32 -wCurrentMapHeight2:: ; d524 +wCurrentMapHeight2:: ; d523 ; map height in 2x2 meta-tiles ds 1 -wCurrentMapWidth2:: ; d525 +wCurrentMapWidth2:: ; d524 ; map width in 2x2 meta-tiles ds 1 -wMapViewVRAMPointer:: ; d526 +wMapViewVRAMPointer:: ; d525 ; the address of the upper left corner of the visible portion of the BG tile map in VRAM ds 2 ; In the comments for the player direction variables below, "moving" refers to ; both walking and changing facing direction without taking a step. -wPlayerMovingDirection:: ; d528 +wPlayerMovingDirection:: ; d527 ; if the player is moving, the current direction ; if the player is not moving, zero ; map scripts write to this in order to change the player's facing direction ds 1 -wPlayerLastStopDirection:: ; d529 +wPlayerLastStopDirection:: ; d528 ; the direction in which the player was moving before the player last stopped ds 1 -wPlayerDirection:: ; d52a +wPlayerDirection:: ; d529 ; if the player is moving, the current direction ; if the player is not moving, the last the direction in which the player moved ds 1 -wTileSetBank:: ; d52b +wTilesetBank:: ; d52a ds 1 -wTileSetBlocksPtr:: ; d52c +wTileSetBlocksPtr:: ; d52b ; maps blocks (4x4 tiles) to tiles ds 2 -wTileSetGFXPtr:: ; d52e +wTilesetGFXPtr:: ; d52d ds 2 -wTileSetCollisionPtr:: ; d530 +wTilesetCollisionPtr:: ; d52f ; list of all walkable tiles ds 2 -wTileSetTalkingOverTiles:: ; d532 +wTileSetTalkingOverTiles:: ; d531 ds 3 -wGrassTile:: ; d535 +wGrassTile:: ; d534 ds 1 ds 4 -wNumBoxItems:: ; d53a +wNumBoxItems:: ; d539 ds 1 -wBoxItems:: ; d53b +wBoxItems:: ; d53a ; item, quantity ds PC_ITEM_CAPACITY * 2 ds 1 ; end -wCurrentBoxNum:: ; d5a0 +wCurrentBoxNum:: ; d59f ; bits 0-6: box number ; bit 7: whether the player has changed boxes before ds 2 -wNumHoFTeams:: ; d5a2 +wNumHoFTeams:: ; d5a1 ; number of HOF teams ds 1 -wUnusedD5A3:: ; d5a3 +wUnusedD5A3:: ; d5a2 ds 1 -wPlayerCoins:: ; d5a4 +wPlayerCoins:: ; d5a3 ds 2 ; BCD -wMissableObjectFlags:: ; d5a6 +wMissableObjectFlags:: ; d5a5 ; bit array of missable objects. set = removed ds 32 -wMissableObjectFlagsEnd:: +wMissableObjectFlagsEnd:: ; d5c5 ds 7 -wd5cd:: ds 1 ; temp copy of c1x2 (sprite facing/anim) +wd5cd:: ds 1 ; temp copy of c1x2 (sprite facing/anim) ; d5cc -wMissableObjectList:: ; d5ce +wMissableObjectList:: ; d5cd ; each entry consists of 2 bytes ; * the sprite ID (depending on the current map) ; * the missable object index (global, used for wMissableObjectFlags) ; terminated with $FF ds 17 * 2 -wGameProgressFlags:: ; d5f0 +wGameProgressFlags:: ; d5e9 ; $c8 bytes - ds 0 -wOaksLabCurScript:: ; d5f0 +wOaksLabCurScript:: ; d5e9 ds 1 -wPalletTownCurScript:: ; d5f1 +wPalletTownCurScript:: ; d5f0 ds 1 ds 1 -wBluesHouseCurScript:: ; d5f3 +wBluesHouseCurScript:: ; d5f2 ds 1 -wViridianCityCurScript:: ; d5f4 +wViridianCityCurScript:: ; d5f3 ds 1 ds 2 -wPewterCityCurScript:: ; d5f7 +wPewterCityCurScript:: ; d5f6 ds 1 -wRoute3CurScript:: ; d5f8 +wRoute3CurScript:: ; d5f7 ds 1 -wRoute4CurScript:: ; d5f9 +wRoute4CurScript:: ; d5f8 ds 1 +wFanClubCurScript:: ; d5f9 ds 1 -wViridianGymCurScript:: ; d5fb +wViridianGymCurScript:: ; d5fa ds 1 -wPewterGymCurScript:: ; d5fc +wPewterGymCurScript:: ; d5fb ds 1 -wCeruleanGymCurScript:: ; d5fd +wCeruleanGymCurScript:: ; d5fc ds 1 -wVermilionGymCurScript:: ; d5fe +wVermilionGymCurScript:: ; d5fd ds 1 -wCeladonGymCurScript:: ; d5ff +wCeladonGymCurScript:: ; d5fe ds 1 -wRoute6CurScript:: ; d600 +wRoute6CurScript:: ; d5ff ds 1 -wRoute8CurScript:: ; d601 +wRoute8CurScript:: ; d600 ds 1 -wRoute24CurScript:: ; d602 +wRoute24CurScript:: ; d601 ds 1 -wRoute25CurScript:: ; d603 +wRoute25CurScript:: ; d602 ds 1 -wRoute9CurScript:: ; d604 +wRoute9CurScript:: ; d603 ds 1 -wRoute10CurScript:: ; d605 +wRoute10CurScript:: ; d604 ds 1 -wMtMoon1CurScript:: ; d606 +wMtMoon1CurScript:: ; d605 ds 1 -wMtMoon3CurScript:: ; d607 +wMtMoon3CurScript:: ; d606 ds 1 -wSSAnne8CurScript:: ; d608 +wSSAnne8CurScript:: ; d607 ds 1 -wSSAnne9CurScript:: ; d609 +wSSAnne9CurScript:: ; d608 ds 1 -wRoute22CurScript:: ; d60a +wRoute22CurScript:: ; d609 ds 1 ds 1 -wRedsHouse2CurScript:: ; d60c +wRedsHouse2CurScript:: ; d60b ds 1 -wViridianMarketCurScript:: ; d60d +wViridianMarketCurScript:: ; d60c ds 1 -wRoute22GateCurScript:: ; d60e +wRoute22GateCurScript:: ; d60d ds 1 -wCeruleanCityCurScript:: ; d60f +wCeruleanCityCurScript:: ; d60e ds 1 ds 7 -wSSAnne5CurScript:: ; d617 +wSSAnne5CurScript:: ; d616 ds 1 -wViridianForestCurScript:: ; d618 +wViridianForestCurScript:: ; d617 ds 1 -wMuseum1fCurScript:: ; d619 +wMuseum1FCurScript:: ; d618 ds 1 -wRoute13CurScript:: ; d61a +wRoute13CurScript:: ; d619 ds 1 -wRoute14CurScript:: ; d61b +wRoute14CurScript:: ; d61a ds 1 -wRoute17CurScript:: ; d61c +wRoute17CurScript:: ; d61b ds 1 -wRoute19CurScript:: ; d61d +wRoute19CurScript:: ; d61c ds 1 -wRoute21CurScript:: ; d61e +wRoute21CurScript:: ; d61d ds 1 -wSafariZoneEntranceCurScript:: ; d61f +wSafariZoneEntranceCurScript:: ; d61e ds 1 -wRockTunnel2CurScript:: ; d620 +wRockTunnel2CurScript:: ; d61f ds 1 -wRockTunnel1CurScript:: ; d621 +wRockTunnel1CurScript:: ; d620 ds 1 ds 1 -wRoute11CurScript:: ; d623 +wRoute11CurScript:: ; d622 ds 1 -wRoute12CurScript:: ; d624 +wRoute12CurScript:: ; d623 ds 1 -wRoute15CurScript:: ; d625 +wRoute15CurScript:: ; d624 ds 1 -wRoute16CurScript:: ; d626 +wRoute16CurScript:: ; d625 ds 1 -wRoute18CurScript:: ; d627 +wRoute18CurScript:: ; d626 ds 1 -wRoute20CurScript:: ; d628 +wRoute20CurScript:: ; d627 ds 1 -wSSAnne10CurScript:: ; d629 +wSSAnne10CurScript:: ; d628 ds 1 -wVermilionCityCurScript:: ; d62a +wVermilionCityCurScript:: ; d629 ds 1 -wPokemonTower2CurScript:: ; d62b +wPokemonTower2CurScript:: ; d62a ds 1 -wPokemonTower3CurScript:: ; d62c +wPokemonTower3CurScript:: ; d62b ds 1 -wPokemonTower4CurScript:: ; d62d +wPokemonTower4CurScript:: ; d62c ds 1 -wPokemonTower5CurScript:: ; d62e +wPokemonTower5CurScript:: ; d62d ds 1 -wPokemonTower6CurScript:: ; d62f +wPokemonTower6CurScript:: ; d62e ds 1 -wPokemonTower7CurScript:: ; d630 +wPokemonTower7CurScript:: ; d62f ds 1 -wRocketHideout1CurScript:: ; d631 +wRocketHideout1CurScript:: ; d630 ds 1 -wRocketHideout2CurScript:: ; d632 +wRocketHideout2CurScript:: ; d631 ds 1 -wRocketHideout3CurScript:: ; d633 +wRocketHideout3CurScript:: ; d632 ds 1 -wRocketHideout4CurScript:: ; d634 +wRocketHideout4CurScript:: ; d633 ds 2 -wRoute6GateCurScript:: ; d636 +wRoute6GateCurScript:: ; d635 ds 1 -wRoute8GateCurScript:: ; d637 +wRoute8GateCurScript:: ; d636 ds 2 -wCinnabarIslandCurScript:: ; d639 +wCinnabarIslandCurScript:: ; d638 ds 1 -wMansion1CurScript:: ; d63a +wMansion1CurScript:: ; d639 ds 2 -wMansion2CurScript:: ; d63c +wMansion2CurScript:: ; d63b ds 1 -wMansion3CurScript:: ; d63d +wMansion3CurScript:: ; d63c ds 1 -wMansion4CurScript:: ; d63e +wMansion4CurScript:: ; d63d ds 1 -wVictoryRoad2CurScript:: ; d63f +wVictoryRoad2CurScript:: ; d63e ds 1 -wVictoryRoad3CurScript:: ; d640 - ds 2 -wFightingDojoCurScript:: ; d642 +wVictoryRoad3CurScript:: ; d63f + ds 1 +wCeladonCityCurScript:: ; d640 ds 1 -wSilphCo2CurScript:: ; d643 +wFightingDojoCurScript:: ; d641 ds 1 -wSilphCo3CurScript:: ; d644 +wSilphCo2CurScript:: ; d642 ds 1 -wSilphCo4CurScript:: ; d645 +wSilphCo3CurScript:: ; d643 ds 1 -wSilphCo5CurScript:: ; d646 +wSilphCo4CurScript:: ; d644 ds 1 -wSilphCo6CurScript:: ; d647 +wSilphCo5CurScript:: ; d645 ds 1 -wSilphCo7CurScript:: ; d648 +wSilphCo6CurScript:: ; d646 ds 1 -wSilphCo8CurScript:: ; d649 +wSilphCo7CurScript:: ; d647 ds 1 -wSilphCo9CurScript:: ; d64a +wSilphCo8CurScript:: ; d648 ds 1 -wHallOfFameRoomCurScript:: ; d64b +wSilphCo9CurScript:: ; d649 ds 1 -wGaryCurScript:: ; d64c +wHallOfFameRoomCurScript:: ; d64a ds 1 -wLoreleiCurScript:: ; d64d +wGaryCurScript:: ; d64b ds 1 -wBrunoCurScript:: ; d64e +wLoreleiCurScript:: ; d64c ds 1 -wAgathaCurScript:: ; d64f +wBrunoCurScript:: ; d64d ds 1 -wUnknownDungeon3CurScript:: ; d650 +wAgathaCurScript:: ; d64e ds 1 -wVictoryRoad1CurScript:: ; d651 +wUnknownDungeon3CurScript:: ; d64f ds 1 +wVictoryRoad1CurScript:: ; d650 ds 1 -wLanceCurScript:: ; d653 + ds 1 +wLanceCurScript:: ; d652 ds 1 ds 4 -wSilphCo10CurScript:: ; d658 +wSilphCo10CurScript:: ; d657 ds 1 -wSilphCo11CurScript:: ; d659 +wSilphCo11CurScript:: ; d658 ds 1 ds 1 -wFuchsiaGymCurScript:: ; d65b +wFuchsiaGymCurScript:: ; d65a ds 1 -wSaffronGymCurScript:: ; d65c +wSaffronGymCurScript:: ; d65b ds 1 ds 1 -wCinnabarGymCurScript:: ; d65e +wCinnabarGymCurScript:: ; d65d ds 1 -wCeladonGameCornerCurScript:: ; d65f +wCeladonGameCornerCurScript:: ; d65e ds 1 -wRoute16GateCurScript:: ; d660 +wRoute16GateCurScript:: ; d65f ds 1 -wBillsHouseCurScript:: ; d661 +wBillsHouseCurScript:: ; d660 ds 1 -wRoute5GateCurScript:: ; d662 +wRoute5GateCurScript:: ; d661 ds 1 -wPowerPlantCurScript:: ; d663 +wPowerPlantCurScript:: ; d662 ; overload ds 0 -wRoute7GateCurScript:: ; d663 +wRoute7GateCurScript:: ; d662 ; overload ds 1 ds 1 -wSSAnne2CurScript:: ; d665 +wSSAnne2CurScript:: ; d664 ds 1 -wSeafoamIslands4CurScript:: ; d666 +wSeafoamIslands4CurScript:: ; d665 ds 1 -wRoute23CurScript:: ; d667 +wRoute23CurScript:: ; d666 ds 1 -wSeafoamIslands5CurScript:: ; d668 +wSeafoamIslands5CurScript:: ; d667 ds 1 -wRoute18GateCurScript:: ; d669 +wRoute18GateCurScript:: ; d668 ds 1 ds 78 -wGameProgressFlagsEnd:: +wGameProgressFlagsEnd:: ; d6b7 ds 56 -wObtainedHiddenItemsFlags:: +wObtainedHiddenItemsFlags:: ; d6ef ds 14 -wObtainedHiddenCoinsFlags:: +wObtainedHiddenCoinsFlags:: ; d6fd ds 2 -wWalkBikeSurfState:: ; d700 +wWalkBikeSurfState:: ; d6ff ; $00 = walking ; $01 = biking ; $02 = surfing @@ -2930,71 +3273,71 @@ wWalkBikeSurfState:: ; d700 ds 10 -wTownVisitedFlag:: ; d70b +wTownVisitedFlag:: ; d70a flag_array 13 -wSafariSteps:: ; d70d +wSafariSteps:: ; d70c ; starts at 502 ds 2 -wFossilItem:: ; d70f +wFossilItem:: ; d70e ; item given to cinnabar lab ds 1 -wFossilMon:: ; d710 +wFossilMon:: ; d70f ; mon that will result from the item ds 1 ds 2 -wEnemyMonOrTrainerClass:: ; d713 +wEnemyMonOrTrainerClass:: ; d712 ; trainer classes start at 200 ds 1 -wPlayerJumpingYScreenCoordsIndex:: ; d714 +wPlayerJumpingYScreenCoordsIndex:: ; d713 ds 1 -wRivalStarter:: ; d715 +wRivalStarter:: ; d714 ds 1 ds 1 -wPlayerStarter:: ; d717 +wPlayerStarter:: ; d716 ds 1 -wBoulderSpriteIndex:: ; d718 +wBoulderSpriteIndex:: ; d717 ; sprite index of the boulder the player is trying to push ds 1 -wLastBlackoutMap:: ; d719 +wLastBlackoutMap:: ; d718 ds 1 -wDestinationMap:: ; d71a +wDestinationMap:: ; d719 ; destination map (for certain types of special warps, not ordinary walking) ds 1 -wUnusedD71B:: ; d71b +wUnusedD71B:: ; d71a ds 1 -wTileInFrontOfBoulderAndBoulderCollisionResult:: ; d71c +wTileInFrontOfBoulderAndBoulderCollisionResult:: ; d71b ; used to store the tile in front of the boulder when trying to push a boulder ; also used to store the result of the collision check ($ff for a collision and $00 for no collision) ds 1 -wDungeonWarpDestinationMap:: ; d71d +wDungeonWarpDestinationMap:: ; d71c ; destination map for dungeon warps ds 1 -wWhichDungeonWarp:: ; d71e +wWhichDungeonWarp:: ; d71d ; which dungeon warp within the source map was used ds 1 -wUnusedD71F:: ; d71f +wUnusedD71F:: ; d71e ds 1 ds 8 -wd728:: ; d728 +wd728:: ; d727 ; bit 0: using Strength outside of battle ; bit 1: set by IsSurfingAllowed when surfing's allowed, but the caller resets it after checking the result ; bit 3: received Old Rod @@ -3006,19 +3349,19 @@ wd728:: ; d728 ds 1 -wBeatGymFlags:: ; d72a +wBeatGymFlags:: ; d729 ; redundant because it matches wObtainedBadges ; used to determine whether to show name on statue and in two NPC text scripts ds 1 ds 1 -wd72c:: ; d72c +wd72c:: ; d72b ; bit 0: if not set, the 3 minimum steps between random battles have passed ; bit 1: prevent audio fade out ds 1 -wd72d:: ; d72d +wd72d:: ; d72c ; This variable is used for temporary flags and as the destination map when ; warping to the Trade Center or Colosseum. ; bit 0: sprite facing directions have been initialised in the Trade Center @@ -3031,7 +3374,7 @@ wd72d:: ; d72d ; battles anyway). ds 1 -wd72e:: ; d72e +wd72e:: ; d72d ; bit 0: the player has received Lapras in the Silph Co. building ; bit 1: set in various places, but doesn't appear to have an effect ; bit 2: the player has healed pokemon at a pokemon center at least once @@ -3044,7 +3387,7 @@ wd72e:: ; d72e ds 1 -wd730:: ; d730 +wd730:: ; d72f ; bit 0: NPC sprite being moved by script ; bit 5: ignore joypad input ; bit 6: print text with no delay between each letter @@ -3053,7 +3396,7 @@ wd730:: ; d730 ds 1 -wd732:: ; d732 +wd732:: ; d731 ; bit 0: play time being counted ; bit 1: remnant of debug mode? not set by the game code. ; if it is set @@ -3067,7 +3410,7 @@ wd732:: ; d732 ; bit 6: map destination is [wLastBlackoutMap] (usually the last used pokemon center, but could be the player's house) ds 1 -wFlags_D733:: ; d733 +wFlags_D733:: ; d732 ; bit 0: running a test battle ; bit 1: prevent music from changing when entering new map ; bit 2: skip the joypad check in CheckWarpsNoCollision (used for the forced warp down the waterfall in the Seafoam Islands) @@ -3076,12 +3419,15 @@ wFlags_D733:: ; d733 ; bit 7: used fly out of battle ds 1 -wBeatLorelei:: ; d734 +wBeatLorelei:: ; d733 ; bit 1: set when you beat Lorelei and reset in Indigo Plateau lobby ; the game uses this to tell when Elite 4 events need to be reset - ds 2 + ds 1 + +wd735:: ; d734 + ds 1 -wd736:: ; d736 +wd736:: ; d735 ; bit 0: check if the player is standing on a door and make him walk down a step if so ; bit 1: the player is currently stepping down from a door ; bit 2: standing on a warp @@ -3089,61 +3435,70 @@ wd736:: ; d736 ; bit 7: player sprite spinning due to spin tiles (Rocket hidehout / Viridian Gym) ds 1 -wCompletedInGameTradeFlags:: ; d737 +wCompletedInGameTradeFlags:: ; d736 ds 2 ds 2 -wWarpedFromWhichWarp:: ; d73b +wWarpedFromWhichWarp:: ; d73a ds 1 -wWarpedFromWhichMap:: ; d73c +wWarpedFromWhichMap:: ; d73b ds 1 ds 2 -wCardKeyDoorY:: ; d73f +wCardKeyDoorY:: ; d73e ds 1 -wCardKeyDoorX:: ; d740 +wCardKeyDoorX:: ; d73f ds 1 ds 2 -wFirstLockTrashCanIndex:: ; d743 +wFirstLockTrashCanIndex:: ; d742 ds 1 wSecondLockTrashCanIndex:: ; d743 ds 1 ds 2 -wEventFlags:: ; d747 - ds 320 -wLinkEnemyTrainerName:: ; d887 +wEventFlags:: ; d746 +; below here are mostly in game flags + +; d74b +; bit 0: Prof. Oak has lead the player to the north end of his lab +; bit 1: Prof. Oak has asked the player to choose a pokemon +; bit 2: the player and the rival have received their pokemon +; bit 3: the player has battled the rival in Oak's lab +; bit 4: Prof. Oak has given the player 5 pokeballs +; bit 5: received pokedex + flag_array NUM_EVENT_FLAGS + +wLinkEnemyTrainerName:: ; d886 ; linked game's trainer name -wGrassRate:: ; d887 +wGrassRate:: ; d886 ds 1 -wGrassMons:: ; d888 - ;ds 20 +wGrassMons:: ; d887 +; ds 20 ds 11 ; Overload wGrassMons -wSerialEnemyDataBlock:: ; d893 +wSerialEnemyDataBlock:: ; d892 ds 9 -wEnemyPartyCount:: ds 1 ; d89c -wEnemyPartyMons:: ds PARTY_LENGTH + 1 ; d89d +wEnemyPartyCount:: ds 1 ; d89b +wEnemyPartyMons:: ds PARTY_LENGTH + 1 ; d89c -; Overload enemy party data -wWaterRate:: db ; d8a4 -wWaterMons:: db ; d8a5 +wWaterRate:: db ; d8a3 +wWaterMons:: db ; d8a4 ds wWaterRate - @ -wEnemyMons:: ; d8a4 +wEnemyMons:: ; d8a3 wEnemyMon1:: party_struct wEnemyMon1 wEnemyMon2:: party_struct wEnemyMon2 wEnemyMon3:: party_struct wEnemyMon3 @@ -3151,75 +3506,81 @@ wEnemyMon4:: party_struct wEnemyMon4 wEnemyMon5:: party_struct wEnemyMon5 wEnemyMon6:: party_struct wEnemyMon6 -wEnemyMonOT:: ds NAME_LENGTH * PARTY_LENGTH ; d9ac -wEnemyMonNicks:: ds NAME_LENGTH * PARTY_LENGTH ; d9ee +wEnemyMonOT:: ds NAME_LENGTH * PARTY_LENGTH ; d9ab +wEnemyMonNicks:: ds NAME_LENGTH * PARTY_LENGTH ; d9ed -wTrainerHeaderPtr:: ; da30 +wTrainerHeaderPtr:: ; da2f ds 2 ds 6 -wOpponentAfterWrongAnswer:: ; da38 +wOpponentAfterWrongAnswer:: ; da37 ; the trainer the player must face after getting a wrong answer in the Cinnabar ; gym quiz -wUnusedDA38:: ; da38 +wUnusedDA38:: ; da37 ds 1 -wCurMapScript:: ; da39 +wCurMapScript:: ; da38 ; index of current map script, mostly used as index for function pointer array ; mostly copied from map-specific map script pointer and wirtten back later ds 1 ds 7 -wPlayTimeHours:: ; da41 +wPlayTimeHours:: ; da40 ds 1 -wPlayTimeMaxed:: ; da42 +wPlayTimeMaxed:: ; da41 ds 1 -wPlayTimeMinutes:: ; da43 +wPlayTimeMinutes:: ; da42 ds 1 -wPlayTimeSeconds:: ; da44 +wPlayTimeSeconds:: ; da43 ds 1 -wPlayTimeFrames:: ; da45 +wPlayTimeFrames:: ; da44 ds 1 -wSafariZoneGameOver:: ; da46 +wSafariZoneGameOver:: ; da45 ds 1 -wNumSafariBalls:: ; da47 +wNumSafariBalls:: ; da46 ds 1 -wDayCareInUse:: ; da48 +wDayCareInUse:: ; da47 ; 0 if no pokemon is in the daycare ; 1 if pokemon is in the daycare ds 1 -wDayCareMonName:: ds NAME_LENGTH ; da49 -wDayCareMonOT:: ds NAME_LENGTH ; da54 +wDayCareMonName:: ds NAME_LENGTH ; da48 +wDayCareMonOT:: ds NAME_LENGTH ; da53 -wDayCareMon:: box_struct wDayCareMon ; da5f +wDayCareMon:: box_struct wDayCareMon ; da5e wMainDataEnd:: wBoxDataStart:: -wNumInBox:: ds 1 ; da80 -wBoxSpecies:: ds MONS_PER_BOX + 1 +wNumInBox:: ds 1 ; da7f +wBoxSpecies:: ds MONS_PER_BOX + 1 ; da80 wBoxMons:: -wBoxMon1:: box_struct wBoxMon1 ; da96 -wBoxMon2:: ds box_struct_length * (MONS_PER_BOX + -1) ; dab7 - -wBoxMonOT:: ds NAME_LENGTH * MONS_PER_BOX ; dd2a -wBoxMonNicks:: ds NAME_LENGTH * MONS_PER_BOX ; de06 -wBoxMonNicksEnd:: ; dee2 +wBoxMon1:: box_struct wBoxMon1 ; da95 +wBoxMon2:: ds box_struct_length * (MONS_PER_BOX + -1) ; dab6 +wBoxMonOT:: ds NAME_LENGTH * MONS_PER_BOX ; dd29 +wBoxMonNicks:: ds NAME_LENGTH * MONS_PER_BOX ; de05 +wBoxMonNicksEnd:: ; dee1 wBoxDataEnd:: +wGBCBasePalPointers:: ds NUM_ACTIVE_PALS * 2 ; dee1 +wGBCPal:: ds PAL_SIZE ; dee9 +wLastBGP:: ds 1 ; def1 +wLastOBP0:: ds 1 ; def2 +wLastOBP1:: ds 1 ; def3 +wdef5:: ds 1 ; def4 +wBGPPalsBuffer:: ds NUM_ACTIVE_PALS * PAL_SIZE ; def5 SECTION "Stack", WRAMX[$dfff], BANK[1] wStack:: ; dfff |