From 25a3960646548c40af70f9f59bed544f4ce8d472 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sat, 16 Dec 2017 19:00:50 -0500 Subject: [PATCH] Move some more main.asm routines into individual files --- Makefile | 19 +- data/text_buffers.asm | 9 + engine/check_battle_scene.asm | 47 ++++ engine/get_breedmon_growth.asm | 27 +++ engine/knows_move.asm | 25 +++ engine/pack.asm | 8 +- engine/player_gfx_2.asm | 5 + engine/trademon_frontpic.asm | 38 ++++ event/{itemball.asm => misc_scripts.asm} | 8 + .../{hidden_items.asm => misc_scripts_2.asm} | 0 .../std_collision.asm | 0 gfx/sprites.asm | 204 +++++++++--------- home.asm | 3 + main.asm | 186 ++-------------- mobile/mobile_40.asm | 2 + mobile/mobile_41.asm | 2 - mobile/mobile_46.asm | 1 + mobile/mobile_5e.asm | 4 - mobile/mobile_5f.asm | 4 - pokecrystal.link | 3 +- text/common_text.asm | 6 + 21 files changed, 301 insertions(+), 300 deletions(-) create mode 100644 data/text_buffers.asm create mode 100644 engine/check_battle_scene.asm create mode 100644 engine/get_breedmon_growth.asm create mode 100644 engine/knows_move.asm create mode 100644 engine/player_gfx_2.asm create mode 100644 engine/trademon_frontpic.asm rename event/{itemball.asm => misc_scripts.asm} (84%) rename event/{hidden_items.asm => misc_scripts_2.asm} (100%) rename engine/collision_stdscripts.asm => event/std_collision.asm (100%) diff --git a/Makefile b/Makefile index 83667441a..4a4c640f9 100644 --- a/Makefile +++ b/Makefile @@ -17,19 +17,20 @@ RGBLINK := rgblink crystal_obj := \ -wram.o \ -main.o \ -lib/mobile/main.o \ -home.o \ audio.o \ +home.o \ +main.o \ maps.o \ -engine/events.o \ -engine/credits.o \ +wram.o \ +data/pokemon/dex_entries.o \ data/pokemon/egg_moves.o \ data/pokemon/evos_attacks.o \ -data/pokemon/dex_entries.o \ -text/common_text.o \ -gfx/pics.o +engine/credits.o \ +engine/events.o \ +gfx/pics.o \ +gfx/sprites.o \ +lib/mobile/main.o \ +text/common_text.o crystal11_obj := $(crystal_obj:.o=11.o) diff --git a/data/text_buffers.asm b/data/text_buffers.asm new file mode 100644 index 000000000..5a03c8cc7 --- /dev/null +++ b/data/text_buffers.asm @@ -0,0 +1,9 @@ +StringBufferPointers:: ; 24000 +; entries correspond to arguments for text_buffer (TX_STRINGBUFFER) + dw StringBuffer3 ; 0 + dw StringBuffer4 ; 1 + dw StringBuffer5 ; 2 + dw StringBuffer2 ; 3 + dw StringBuffer1 ; 4 + dw EnemyMonNick ; 5 + dw BattleMonNick ; 6 diff --git a/engine/check_battle_scene.asm b/engine/check_battle_scene.asm new file mode 100644 index 000000000..b63f00907 --- /dev/null +++ b/engine/check_battle_scene.asm @@ -0,0 +1,47 @@ +CheckBattleScene: ; 4ea44 +; Return carry if battle scene is turned off. + + ld a, 0 + ld hl, wLinkMode + call GetFarWRAMByte + cp LINK_MOBILE + jr z, .mobile + + ld a, [Options] + bit BATTLE_SCENE, a + jr nz, .off + + and a + ret + +.mobile + ld a, [wcd2f] + and a + jr nz, .from_wram + + ld a, $4 + call GetSRAMBank + ld a, [$a60c] + ld c, a + call CloseSRAM + + ld a, c + bit 0, c + jr z, .off + + and a + ret + +.from_wram + ld a, $5 + ld hl, w5_dc00 + call GetFarWRAMByte + bit 0, a + jr z, .off + + and a + ret + +.off + scf + ret diff --git a/engine/get_breedmon_growth.asm b/engine/get_breedmon_growth.asm new file mode 100644 index 000000000..20c546315 --- /dev/null +++ b/engine/get_breedmon_growth.asm @@ -0,0 +1,27 @@ +GetBreedMon1LevelGrowth: ; e698 + ld hl, wBreedMon1Stats + ld de, TempMon + ld bc, BOXMON_STRUCT_LENGTH + call CopyBytes + callab CalcLevel + ld a, [wBreedMon1Level] + ld b, a + ld a, d + ld e, a + sub b + ld d, a + ret + +GetBreedMon2LevelGrowth: ; e6b3 + ld hl, wBreedMon2Stats + ld de, TempMon + ld bc, BOXMON_STRUCT_LENGTH + call CopyBytes + callab CalcLevel + ld a, [wBreedMon2Level] + ld b, a + ld a, d + ld e, a + sub b + ld d, a + ret diff --git a/engine/knows_move.asm b/engine/knows_move.asm new file mode 100644 index 000000000..4ec3da347 --- /dev/null +++ b/engine/knows_move.asm @@ -0,0 +1,25 @@ +KnowsMove: ; f9ea + ld a, MON_MOVES + call GetPartyParamLocation + ld a, [wPutativeTMHMMove] + ld b, a + ld c, NUM_MOVES +.loop + ld a, [hli] + cp b + jr z, .knows_move + dec c + jr nz, .loop + and a + ret + +.knows_move + ld hl, .Text_knows + call PrintText + scf + ret + +.Text_knows: ; 0xfa06 + ; knows @ . + text_jump UnknownText_0x1c5ea8 + db "@" diff --git a/engine/pack.asm b/engine/pack.asm index e10b70e12..858548771 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -1315,10 +1315,10 @@ DrawPackGFX: ; 1089d ; 108cc PackGFXPointers: ; 108cc - dw PackGFX + $f0 * 1 - dw PackGFX + $f0 * 3 - dw PackGFX + $f0 * 0 - dw PackGFX + $f0 * 2 + dw PackGFX + (15 tiles) * 1 + dw PackGFX + (15 tiles) * 3 + dw PackGFX + (15 tiles) * 0 + dw PackGFX + (15 tiles) * 2 ; 108d4 Pack_InterpretJoypad: ; 108d4 (4:48d4) diff --git a/engine/player_gfx_2.asm b/engine/player_gfx_2.asm new file mode 100644 index 000000000..d6e7791a3 --- /dev/null +++ b/engine/player_gfx_2.asm @@ -0,0 +1,5 @@ +ChrisBackpic: ; 2ba1a +INCBIN "gfx/player/chris_back.2bpp.lz" + +DudeBackpic: ; 2bbaa +INCBIN "gfx/battle/dude.2bpp.lz" diff --git a/engine/trademon_frontpic.asm b/engine/trademon_frontpic.asm new file mode 100644 index 000000000..1641443ea --- /dev/null +++ b/engine/trademon_frontpic.asm @@ -0,0 +1,38 @@ +GetTrademonFrontpic: ; 4d7fd + ld a, [wOTTrademonSpecies] + ld hl, wOTTrademonDVs + ld de, VTiles2 + push de + push af + predef GetUnownLetter + pop af + ld [CurPartySpecies], a + ld [CurSpecies], a + call GetBaseData + pop de + predef FrontpicPredef + ret + +AnimateTrademonFrontpic: ; 4d81e + ld a, [wOTTrademonSpecies] + call IsAPokemon + ret c + callba ShowOTTrademonStats + ld a, [wOTTrademonSpecies] + ld [CurPartySpecies], a + ld a, [wOTTrademonDVs] + ld [TempMonDVs], a + ld a, [wOTTrademonDVs + 1] + ld [TempMonDVs + 1], a + ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS + call GetSGBLayout + ld a, %11100100 ; 3,2,1,0 + call DmgToCgbBGPals + callba TradeAnim_ShowGetmonFrontpic + ld a, [wOTTrademonSpecies] + ld [CurPartySpecies], a + hlcoord 7, 2 + ld d, $0 + ld e, ANIM_MON_TRADE + predef AnimateFrontpic + ret diff --git a/event/itemball.asm b/event/misc_scripts.asm similarity index 84% rename from event/itemball.asm rename to event/misc_scripts.asm index ed0c6a9e0..97372a57a 100755 --- a/event/itemball.asm +++ b/event/misc_scripts.asm @@ -1,3 +1,11 @@ +Script_AbortBugContest: ; 0x122c1 + checkflag ENGINE_BUG_CONTEST_TIMER + iffalse .finish + setflag ENGINE_DAILY_BUG_CONTEST + special ContestReturnMons +.finish + end + FindItemInBallScript:: ; 0x122ce callasm .TryReceiveItem iffalse .no_room diff --git a/event/hidden_items.asm b/event/misc_scripts_2.asm similarity index 100% rename from event/hidden_items.asm rename to event/misc_scripts_2.asm diff --git a/engine/collision_stdscripts.asm b/event/std_collision.asm similarity index 100% rename from engine/collision_stdscripts.asm rename to event/std_collision.asm diff --git a/gfx/sprites.asm b/gfx/sprites.asm index f7740d6a6..318f7506e 100644 --- a/gfx/sprites.asm +++ b/gfx/sprites.asm @@ -1,108 +1,108 @@ SECTION "Sprites 1", ROMX -ChrisSpriteGFX: INCBIN "gfx/sprites/chris.2bpp" ; c0000 -ChrisBikeSpriteGFX: INCBIN "gfx/sprites/chris_bike.2bpp" ; c0180 -GameboyKidSpriteGFX: INCBIN "gfx/sprites/gameboy_kid.2bpp" ; c0300 -SilverSpriteGFX: INCBIN "gfx/sprites/silver.2bpp" ; c03c0 -OakSpriteGFX: INCBIN "gfx/sprites/oak.2bpp" ; c0540 -RedSpriteGFX: INCBIN "gfx/sprites/red.2bpp" ; c06c0 -BlueSpriteGFX: INCBIN "gfx/sprites/blue.2bpp" ; c0840 -BillSpriteGFX: INCBIN "gfx/sprites/bill.2bpp" ; c09c0 -ElderSpriteGFX: INCBIN "gfx/sprites/elder.2bpp" ; c0b40 -JanineSpriteGFX: INCBIN "gfx/sprites/janine.2bpp" ; c0cc0 -KurtSpriteGFX: INCBIN "gfx/sprites/kurt.2bpp" ; c0e40 -MomSpriteGFX: INCBIN "gfx/sprites/mom.2bpp" ; c0fc0 -BlaineSpriteGFX: INCBIN "gfx/sprites/blaine.2bpp" ; c1140 -RedsMomSpriteGFX: INCBIN "gfx/sprites/reds_mom.2bpp" ; c12c0 -DaisySpriteGFX: INCBIN "gfx/sprites/daisy.2bpp" ; c1440 -ElmSpriteGFX: INCBIN "gfx/sprites/elm.2bpp" ; c15c0 -WillSpriteGFX: INCBIN "gfx/sprites/will.2bpp" ; c1740 -FalknerSpriteGFX: INCBIN "gfx/sprites/falkner.2bpp" ; c1800 -WhitneySpriteGFX: INCBIN "gfx/sprites/whitney.2bpp" ; c1980 -BugsySpriteGFX: INCBIN "gfx/sprites/bugsy.2bpp" ; c1b00 -MortySpriteGFX: INCBIN "gfx/sprites/morty.2bpp" ; c1c80 -ChuckSpriteGFX: INCBIN "gfx/sprites/chuck.2bpp" ; c1e00 -JasmineSpriteGFX: INCBIN "gfx/sprites/jasmine.2bpp" ; c1f80 -PryceSpriteGFX: INCBIN "gfx/sprites/pryce.2bpp" ; c2100 -ClairSpriteGFX: INCBIN "gfx/sprites/clair.2bpp" ; c2280 -BrockSpriteGFX: INCBIN "gfx/sprites/brock.2bpp" ; c2400 -KarenSpriteGFX: INCBIN "gfx/sprites/karen.2bpp" ; c2580 -BrunoSpriteGFX: INCBIN "gfx/sprites/bruno.2bpp" ; c2640 -MistySpriteGFX: INCBIN "gfx/sprites/misty.2bpp" ; c27c0 -LanceSpriteGFX: INCBIN "gfx/sprites/lance.2bpp" ; c2940 -SurgeSpriteGFX: INCBIN "gfx/sprites/surge.2bpp" ; c2ac0 -ErikaSpriteGFX: INCBIN "gfx/sprites/erika.2bpp" ; c2c40 -KogaSpriteGFX: INCBIN "gfx/sprites/koga.2bpp" ; c2dc0 -SabrinaSpriteGFX: INCBIN "gfx/sprites/sabrina.2bpp" ; c2f40 -CooltrainerMSpriteGFX: INCBIN "gfx/sprites/cooltrainer_m.2bpp" ; c30c0 -CooltrainerFSpriteGFX: INCBIN "gfx/sprites/cooltrainer_f.2bpp" ; c3240 -BugCatcherSpriteGFX: INCBIN "gfx/sprites/bug_catcher.2bpp" ; c33c0 -TwinSpriteGFX: INCBIN "gfx/sprites/twin.2bpp" ; c3540 -YoungsterSpriteGFX: INCBIN "gfx/sprites/youngster.2bpp" ; c36c0 -LassSpriteGFX: INCBIN "gfx/sprites/lass.2bpp" ; c3840 -TeacherSpriteGFX: INCBIN "gfx/sprites/teacher.2bpp" ; c39c0 -BuenaSpriteGFX: INCBIN "gfx/sprites/buena.2bpp" ; c3b40 -SuperNerdSpriteGFX: INCBIN "gfx/sprites/super_nerd.2bpp" ; c3cc0 -RockerSpriteGFX: INCBIN "gfx/sprites/rocker.2bpp" ; c3e40 +ChrisSpriteGFX:: INCBIN "gfx/sprites/chris.2bpp" ; c0000 +ChrisBikeSpriteGFX:: INCBIN "gfx/sprites/chris_bike.2bpp" ; c0180 +GameboyKidSpriteGFX:: INCBIN "gfx/sprites/gameboy_kid.2bpp" ; c0300 +SilverSpriteGFX:: INCBIN "gfx/sprites/silver.2bpp" ; c03c0 +OakSpriteGFX:: INCBIN "gfx/sprites/oak.2bpp" ; c0540 +RedSpriteGFX:: INCBIN "gfx/sprites/red.2bpp" ; c06c0 +BlueSpriteGFX:: INCBIN "gfx/sprites/blue.2bpp" ; c0840 +BillSpriteGFX:: INCBIN "gfx/sprites/bill.2bpp" ; c09c0 +ElderSpriteGFX:: INCBIN "gfx/sprites/elder.2bpp" ; c0b40 +JanineSpriteGFX:: INCBIN "gfx/sprites/janine.2bpp" ; c0cc0 +KurtSpriteGFX:: INCBIN "gfx/sprites/kurt.2bpp" ; c0e40 +MomSpriteGFX:: INCBIN "gfx/sprites/mom.2bpp" ; c0fc0 +BlaineSpriteGFX:: INCBIN "gfx/sprites/blaine.2bpp" ; c1140 +RedsMomSpriteGFX:: INCBIN "gfx/sprites/reds_mom.2bpp" ; c12c0 +DaisySpriteGFX:: INCBIN "gfx/sprites/daisy.2bpp" ; c1440 +ElmSpriteGFX:: INCBIN "gfx/sprites/elm.2bpp" ; c15c0 +WillSpriteGFX:: INCBIN "gfx/sprites/will.2bpp" ; c1740 +FalknerSpriteGFX:: INCBIN "gfx/sprites/falkner.2bpp" ; c1800 +WhitneySpriteGFX:: INCBIN "gfx/sprites/whitney.2bpp" ; c1980 +BugsySpriteGFX:: INCBIN "gfx/sprites/bugsy.2bpp" ; c1b00 +MortySpriteGFX:: INCBIN "gfx/sprites/morty.2bpp" ; c1c80 +ChuckSpriteGFX:: INCBIN "gfx/sprites/chuck.2bpp" ; c1e00 +JasmineSpriteGFX:: INCBIN "gfx/sprites/jasmine.2bpp" ; c1f80 +PryceSpriteGFX:: INCBIN "gfx/sprites/pryce.2bpp" ; c2100 +ClairSpriteGFX:: INCBIN "gfx/sprites/clair.2bpp" ; c2280 +BrockSpriteGFX:: INCBIN "gfx/sprites/brock.2bpp" ; c2400 +KarenSpriteGFX:: INCBIN "gfx/sprites/karen.2bpp" ; c2580 +BrunoSpriteGFX:: INCBIN "gfx/sprites/bruno.2bpp" ; c2640 +MistySpriteGFX:: INCBIN "gfx/sprites/misty.2bpp" ; c27c0 +LanceSpriteGFX:: INCBIN "gfx/sprites/lance.2bpp" ; c2940 +SurgeSpriteGFX:: INCBIN "gfx/sprites/surge.2bpp" ; c2ac0 +ErikaSpriteGFX:: INCBIN "gfx/sprites/erika.2bpp" ; c2c40 +KogaSpriteGFX:: INCBIN "gfx/sprites/koga.2bpp" ; c2dc0 +SabrinaSpriteGFX:: INCBIN "gfx/sprites/sabrina.2bpp" ; c2f40 +CooltrainerMSpriteGFX:: INCBIN "gfx/sprites/cooltrainer_m.2bpp" ; c30c0 +CooltrainerFSpriteGFX:: INCBIN "gfx/sprites/cooltrainer_f.2bpp" ; c3240 +BugCatcherSpriteGFX:: INCBIN "gfx/sprites/bug_catcher.2bpp" ; c33c0 +TwinSpriteGFX:: INCBIN "gfx/sprites/twin.2bpp" ; c3540 +YoungsterSpriteGFX:: INCBIN "gfx/sprites/youngster.2bpp" ; c36c0 +LassSpriteGFX:: INCBIN "gfx/sprites/lass.2bpp" ; c3840 +TeacherSpriteGFX:: INCBIN "gfx/sprites/teacher.2bpp" ; c39c0 +BuenaSpriteGFX:: INCBIN "gfx/sprites/buena.2bpp" ; c3b40 +SuperNerdSpriteGFX:: INCBIN "gfx/sprites/super_nerd.2bpp" ; c3cc0 +RockerSpriteGFX:: INCBIN "gfx/sprites/rocker.2bpp" ; c3e40 SECTION "Sprites 2", ROMX -PokefanMSpriteGFX: INCBIN "gfx/sprites/pokefan_m.2bpp" ; c4000 -PokefanFSpriteGFX: INCBIN "gfx/sprites/pokefan_f.2bpp" ; c4180 -GrampsSpriteGFX: INCBIN "gfx/sprites/gramps.2bpp" ; c4300 -GrannySpriteGFX: INCBIN "gfx/sprites/granny.2bpp" ; c4480 -SwimmerGuySpriteGFX: INCBIN "gfx/sprites/swimmer_guy.2bpp" ; c4600 -SwimmerGirlSpriteGFX: INCBIN "gfx/sprites/swimmer_girl.2bpp" ; c4780 -BigSnorlaxSpriteGFX: INCBIN "gfx/sprites/big_snorlax.2bpp" ; c4900 -SurfingPikachuSpriteGFX: INCBIN "gfx/sprites/surfing_pikachu.2bpp" ; c4980 -RocketSpriteGFX: INCBIN "gfx/sprites/rocket.2bpp" ; c4b00 -RocketGirlSpriteGFX: INCBIN "gfx/sprites/rocket_girl.2bpp" ; c4c80 -NurseSpriteGFX: INCBIN "gfx/sprites/nurse.2bpp" ; c4e00 -LinkReceptionistSpriteGFX: INCBIN "gfx/sprites/link_receptionist.2bpp" ; c4ec0 -ClerkSpriteGFX: INCBIN "gfx/sprites/clerk.2bpp" ; c5040 -FisherSpriteGFX: INCBIN "gfx/sprites/fisher.2bpp" ; c51c0 -FishingGuruSpriteGFX: INCBIN "gfx/sprites/fishing_guru.2bpp" ; c5340 -ScientistSpriteGFX: INCBIN "gfx/sprites/scientist.2bpp" ; c54c0 -KimonoGirlSpriteGFX: INCBIN "gfx/sprites/kimono_girl.2bpp" ; c5640 -SageSpriteGFX: INCBIN "gfx/sprites/sage.2bpp" ; c57c0 -UnusedGuySpriteGFX: INCBIN "gfx/sprites/unused_guy.2bpp" ; c5940 -GentlemanSpriteGFX: INCBIN "gfx/sprites/gentleman.2bpp" ; c5ac0 -BlackBeltSpriteGFX: INCBIN "gfx/sprites/black_belt.2bpp" ; c5c40 -ReceptionistSpriteGFX: INCBIN "gfx/sprites/receptionist.2bpp" ; c5dc0 -OfficerSpriteGFX: INCBIN "gfx/sprites/officer.2bpp" ; c5f40 -CalSpriteGFX: INCBIN "gfx/sprites/cal.2bpp" ; c60c0 -SlowpokeSpriteGFX: INCBIN "gfx/sprites/slowpoke.2bpp" ; c6240 -CaptainSpriteGFX: INCBIN "gfx/sprites/captain.2bpp" ; c6280 -BigLaprasSpriteGFX: INCBIN "gfx/sprites/big_lapras.2bpp" ; c6400 -GymGuySpriteGFX: INCBIN "gfx/sprites/gym_guy.2bpp" ; c6480 -SailorSpriteGFX: INCBIN "gfx/sprites/sailor.2bpp" ; c6600 -BikerSpriteGFX: INCBIN "gfx/sprites/biker.2bpp" ; c6780 -PharmacistSpriteGFX: INCBIN "gfx/sprites/pharmacist.2bpp" ; c6900 -MonsterSpriteGFX: INCBIN "gfx/sprites/monster.2bpp" ; c6a80 -FairySpriteGFX: INCBIN "gfx/sprites/fairy.2bpp" ; c6c00 -BirdSpriteGFX: INCBIN "gfx/sprites/bird.2bpp" ; c6d80 -DragonSpriteGFX: INCBIN "gfx/sprites/dragon.2bpp" ; c6f00 -BigOnixSpriteGFX: INCBIN "gfx/sprites/big_onix.2bpp" ; c7080 -N64SpriteGFX: INCBIN "gfx/sprites/n64.2bpp" ; c7140 -SudowoodoSpriteGFX: INCBIN "gfx/sprites/sudowoodo.2bpp" ; c7180 -SurfSpriteGFX: INCBIN "gfx/sprites/surf.2bpp" ; c7200 -PokeBallSpriteGFX: INCBIN "gfx/sprites/poke_ball.2bpp" ; c7380 -PokedexSpriteGFX: INCBIN "gfx/sprites/pokedex.2bpp" ; c7500 -PaperSpriteGFX: INCBIN "gfx/sprites/paper.2bpp" ; c7680 -VirtualBoySpriteGFX: INCBIN "gfx/sprites/virtual_boy.2bpp" ; c7800 -OldLinkReceptionistSpriteGFX: INCBIN "gfx/sprites/old_link_receptionist.2bpp" ; c7840 -RockSpriteGFX: INCBIN "gfx/sprites/rock.2bpp" ; c7880 -BoulderSpriteGFX: INCBIN "gfx/sprites/boulder.2bpp" ; c78c0 -SnesSpriteGFX: INCBIN "gfx/sprites/snes.2bpp" ; c7900 -FamicomSpriteGFX: INCBIN "gfx/sprites/famicom.2bpp" ; c7940 -FruitTreeSpriteGFX: INCBIN "gfx/sprites/fruit_tree.2bpp" ; c7980 -GoldTrophySpriteGFX: INCBIN "gfx/sprites/gold_trophy.2bpp" ; c79c0 -SilverTrophySpriteGFX: INCBIN "gfx/sprites/silver_trophy.2bpp" ; c7a00 -KrisSpriteGFX: INCBIN "gfx/sprites/kris.2bpp" ; c7a40 -KrisBikeSpriteGFX: INCBIN "gfx/sprites/kris_bike.2bpp" ; c7bc0 -KurtOutsideSpriteGFX: INCBIN "gfx/sprites/kurt_outside.2bpp" ; c7d40 -SuicuneSpriteGFX: INCBIN "gfx/sprites/suicune.2bpp" ; c7e00 -EnteiSpriteGFX: INCBIN "gfx/sprites/entei.2bpp" ; c7e40 -RaikouSpriteGFX: INCBIN "gfx/sprites/raikou.2bpp" ; c7e80 -StandingYoungsterSpriteGFX: INCBIN "gfx/sprites/standing_youngster.2bpp" ; c7ec0 +PokefanMSpriteGFX:: INCBIN "gfx/sprites/pokefan_m.2bpp" ; c4000 +PokefanFSpriteGFX:: INCBIN "gfx/sprites/pokefan_f.2bpp" ; c4180 +GrampsSpriteGFX:: INCBIN "gfx/sprites/gramps.2bpp" ; c4300 +GrannySpriteGFX:: INCBIN "gfx/sprites/granny.2bpp" ; c4480 +SwimmerGuySpriteGFX:: INCBIN "gfx/sprites/swimmer_guy.2bpp" ; c4600 +SwimmerGirlSpriteGFX:: INCBIN "gfx/sprites/swimmer_girl.2bpp" ; c4780 +BigSnorlaxSpriteGFX:: INCBIN "gfx/sprites/big_snorlax.2bpp" ; c4900 +SurfingPikachuSpriteGFX:: INCBIN "gfx/sprites/surfing_pikachu.2bpp" ; c4980 +RocketSpriteGFX:: INCBIN "gfx/sprites/rocket.2bpp" ; c4b00 +RocketGirlSpriteGFX:: INCBIN "gfx/sprites/rocket_girl.2bpp" ; c4c80 +NurseSpriteGFX:: INCBIN "gfx/sprites/nurse.2bpp" ; c4e00 +LinkReceptionistSpriteGFX:: INCBIN "gfx/sprites/link_receptionist.2bpp" ; c4ec0 +ClerkSpriteGFX:: INCBIN "gfx/sprites/clerk.2bpp" ; c5040 +FisherSpriteGFX:: INCBIN "gfx/sprites/fisher.2bpp" ; c51c0 +FishingGuruSpriteGFX:: INCBIN "gfx/sprites/fishing_guru.2bpp" ; c5340 +ScientistSpriteGFX:: INCBIN "gfx/sprites/scientist.2bpp" ; c54c0 +KimonoGirlSpriteGFX:: INCBIN "gfx/sprites/kimono_girl.2bpp" ; c5640 +SageSpriteGFX:: INCBIN "gfx/sprites/sage.2bpp" ; c57c0 +UnusedGuySpriteGFX:: INCBIN "gfx/sprites/unused_guy.2bpp" ; c5940 +GentlemanSpriteGFX:: INCBIN "gfx/sprites/gentleman.2bpp" ; c5ac0 +BlackBeltSpriteGFX:: INCBIN "gfx/sprites/black_belt.2bpp" ; c5c40 +ReceptionistSpriteGFX:: INCBIN "gfx/sprites/receptionist.2bpp" ; c5dc0 +OfficerSpriteGFX:: INCBIN "gfx/sprites/officer.2bpp" ; c5f40 +CalSpriteGFX:: INCBIN "gfx/sprites/cal.2bpp" ; c60c0 +SlowpokeSpriteGFX:: INCBIN "gfx/sprites/slowpoke.2bpp" ; c6240 +CaptainSpriteGFX:: INCBIN "gfx/sprites/captain.2bpp" ; c6280 +BigLaprasSpriteGFX:: INCBIN "gfx/sprites/big_lapras.2bpp" ; c6400 +GymGuySpriteGFX:: INCBIN "gfx/sprites/gym_guy.2bpp" ; c6480 +SailorSpriteGFX:: INCBIN "gfx/sprites/sailor.2bpp" ; c6600 +BikerSpriteGFX:: INCBIN "gfx/sprites/biker.2bpp" ; c6780 +PharmacistSpriteGFX:: INCBIN "gfx/sprites/pharmacist.2bpp" ; c6900 +MonsterSpriteGFX:: INCBIN "gfx/sprites/monster.2bpp" ; c6a80 +FairySpriteGFX:: INCBIN "gfx/sprites/fairy.2bpp" ; c6c00 +BirdSpriteGFX:: INCBIN "gfx/sprites/bird.2bpp" ; c6d80 +DragonSpriteGFX:: INCBIN "gfx/sprites/dragon.2bpp" ; c6f00 +BigOnixSpriteGFX:: INCBIN "gfx/sprites/big_onix.2bpp" ; c7080 +N64SpriteGFX:: INCBIN "gfx/sprites/n64.2bpp" ; c7140 +SudowoodoSpriteGFX:: INCBIN "gfx/sprites/sudowoodo.2bpp" ; c7180 +SurfSpriteGFX:: INCBIN "gfx/sprites/surf.2bpp" ; c7200 +PokeBallSpriteGFX:: INCBIN "gfx/sprites/poke_ball.2bpp" ; c7380 +PokedexSpriteGFX:: INCBIN "gfx/sprites/pokedex.2bpp" ; c7500 +PaperSpriteGFX:: INCBIN "gfx/sprites/paper.2bpp" ; c7680 +VirtualBoySpriteGFX:: INCBIN "gfx/sprites/virtual_boy.2bpp" ; c7800 +OldLinkReceptionistSpriteGFX:: INCBIN "gfx/sprites/old_link_receptionist.2bpp" ; c7840 +RockSpriteGFX:: INCBIN "gfx/sprites/rock.2bpp" ; c7880 +BoulderSpriteGFX:: INCBIN "gfx/sprites/boulder.2bpp" ; c78c0 +SnesSpriteGFX:: INCBIN "gfx/sprites/snes.2bpp" ; c7900 +FamicomSpriteGFX:: INCBIN "gfx/sprites/famicom.2bpp" ; c7940 +FruitTreeSpriteGFX:: INCBIN "gfx/sprites/fruit_tree.2bpp" ; c7980 +GoldTrophySpriteGFX:: INCBIN "gfx/sprites/gold_trophy.2bpp" ; c79c0 +SilverTrophySpriteGFX:: INCBIN "gfx/sprites/silver_trophy.2bpp" ; c7a00 +KrisSpriteGFX:: INCBIN "gfx/sprites/kris.2bpp" ; c7a40 +KrisBikeSpriteGFX:: INCBIN "gfx/sprites/kris_bike.2bpp" ; c7bc0 +KurtOutsideSpriteGFX:: INCBIN "gfx/sprites/kurt_outside.2bpp" ; c7d40 +SuicuneSpriteGFX:: INCBIN "gfx/sprites/suicune.2bpp" ; c7e00 +EnteiSpriteGFX:: INCBIN "gfx/sprites/entei.2bpp" ; c7e40 +RaikouSpriteGFX:: INCBIN "gfx/sprites/raikou.2bpp" ; c7e80 +StandingYoungsterSpriteGFX:: INCBIN "gfx/sprites/standing_youngster.2bpp" ; c7ec0 diff --git a/home.asm b/home.asm index f7d2e7748..6aa8777cb 100644 --- a/home.asm +++ b/home.asm @@ -4,7 +4,10 @@ INCLUDE "includes.asm" SECTION "NULL", ROM0 NULL:: + INCLUDE "rst.asm" + + INCLUDE "interrupts.asm" diff --git a/main.asm b/main.asm index e0611c483..cfa9d9218 100644 --- a/main.asm +++ b/main.asm @@ -82,63 +82,10 @@ INCLUDE "engine/player_step.asm" INCLUDE "engine/anim_hp_bar.asm" INCLUDE "engine/move_mon.asm" INCLUDE "engine/billspctop.asm" - -GetBreedMon1LevelGrowth: ; e698 - ld hl, wBreedMon1Stats - ld de, TempMon - ld bc, BOXMON_STRUCT_LENGTH - call CopyBytes - callab CalcLevel - ld a, [wBreedMon1Level] - ld b, a - ld a, d - ld e, a - sub b - ld d, a - ret - -GetBreedMon2LevelGrowth: ; e6b3 - ld hl, wBreedMon2Stats - ld de, TempMon - ld bc, BOXMON_STRUCT_LENGTH - call CopyBytes - callab CalcLevel - ld a, [wBreedMon2Level] - ld b, a - ld a, d - ld e, a - sub b - ld d, a - ret - +INCLUDE "engine/get_breedmon_growth.asm" INCLUDE "event/bug_contest/caught_mon.asm" INCLUDE "engine/item_effects.asm" - -KnowsMove: ; f9ea - ld a, MON_MOVES - call GetPartyParamLocation - ld a, [wPutativeTMHMMove] - ld b, a - ld c, NUM_MOVES -.loop - ld a, [hli] - cp b - jr z, .knows_move - dec c - jr nz, .loop - and a - ret - -.knows_move - ld hl, .Text_knows - call PrintText - scf - ret - -.Text_knows: ; 0xfa06 - ; knows @ . - text_jump UnknownText_0x1c5ea8 - db "@" +INCLUDE "engine/knows_move.asm" SECTION "bank4", ROMX @@ -147,16 +94,7 @@ INCLUDE "engine/pack.asm" INCLUDE "engine/time.asm" INCLUDE "engine/tmhm.asm" INCLUDE "engine/namingscreen.asm" - -Script_AbortBugContest: ; 0x122c1 - checkflag ENGINE_BUG_CONTEST_TIMER - iffalse .finish - setflag ENGINE_DAILY_BUG_CONTEST - special ContestReturnMons -.finish - end - -INCLUDE "event/itemball.asm" +INCLUDE "event/misc_scripts.asm" INCLUDE "event/heal_machine_anim.asm" INCLUDE "event/whiteout.asm" INCLUDE "event/forced_movement.asm" @@ -165,8 +103,8 @@ INCLUDE "engine/start_menu.asm" INCLUDE "engine/select_menu.asm" INCLUDE "event/elevator.asm" INCLUDE "event/bug_contest/contest.asm" -INCLUDE "event/hidden_items.asm" -INCLUDE "engine/collision_stdscripts.asm" +INCLUDE "event/misc_scripts_2.asm" +INCLUDE "event/std_collision.asm" INCLUDE "event/bug_contest/judging.asm" INCLUDE "engine/pokerus_tick.asm" INCLUDE "event/bug_contest/contest_2.asm" @@ -201,15 +139,7 @@ INCLUDE "engine/clock_reset.asm" SECTION "bank9", ROMX -StringBufferPointers:: ; 24000 - dw StringBuffer3 - dw StringBuffer4 - dw StringBuffer5 - dw StringBuffer2 - dw StringBuffer1 - dw EnemyMonNick - dw BattleMonNick - +INCLUDE "data/text_buffers.asm" INCLUDE "engine/menu.asm" UpdateItemDescription: ; 0x244c3 @@ -296,12 +226,7 @@ SECTION "bankA", ROMX INCLUDE "engine/link.asm" INCLUDE "engine/wildmons.asm" INCLUDE "battle/link_result.asm" - -ChrisBackpic: ; 2ba1a -INCBIN "gfx/player/chris_back.2bpp.lz" - -DudeBackpic: ; 2bbaa -INCBIN "gfx/battle/dude.2bpp.lz" +INCLUDE "engine/player_gfx_2.asm" SECTION "bankB", ROMX @@ -704,45 +629,7 @@ LinkTextbox2: ; 4d35b INCLUDE "engine/delete_save_change_clock.asm" INCLUDE "tilesets/tileset_headers.asm" INCLUDE "engine/flag_predef.asm" - -GetTrademonFrontpic: ; 4d7fd - ld a, [wOTTrademonSpecies] - ld hl, wOTTrademonDVs - ld de, VTiles2 - push de - push af - predef GetUnownLetter - pop af - ld [CurPartySpecies], a - ld [CurSpecies], a - call GetBaseData - pop de - predef FrontpicPredef - ret - -AnimateTrademonFrontpic: ; 4d81e - ld a, [wOTTrademonSpecies] - call IsAPokemon - ret c - callba ShowOTTrademonStats - ld a, [wOTTrademonSpecies] - ld [CurPartySpecies], a - ld a, [wOTTrademonDVs] - ld [TempMonDVs], a - ld a, [wOTTrademonDVs + 1] - ld [TempMonDVs + 1], a - ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS - call GetSGBLayout - ld a, %11100100 ; 3,2,1,0 - call DmgToCgbBGPals - callba TradeAnim_ShowGetmonFrontpic - ld a, [wOTTrademonSpecies] - ld [CurPartySpecies], a - hlcoord 7, 2 - ld d, $0 - ld e, ANIM_MON_TRADE - predef AnimateFrontpic - ret +INCLUDE "engine/trademon_frontpic.asm" CheckPokerus: ; 4d860 ; Return carry if a monster in your party has Pokerus @@ -780,55 +667,7 @@ INCLUDE "engine/init_hof_credits.asm" INCLUDE "mobile/get_trainer_class.asm" INCLUDE "battle/sliding_intro.asm" INCLUDE "mobile/print_opp_message.asm" - -CheckBattleScene: ; 4ea44 -; Return carry if battle scene is turned off. - - ld a, 0 - ld hl, wLinkMode - call GetFarWRAMByte - cp LINK_MOBILE - jr z, .mobile - - ld a, [Options] - bit BATTLE_SCENE, a - jr nz, .off - - and a - ret - -.mobile - ld a, [wcd2f] - and a - jr nz, .from_wram - - ld a, $4 - call GetSRAMBank - ld a, [$a60c] - ld c, a - call CloseSRAM - - ld a, c - bit 0, c - jr z, .off - - and a - ret - -.from_wram - ld a, $5 - ld hl, w5_dc00 - call GetFarWRAMByte - bit 0, a - jr z, .off - - and a - ret - -.off - scf - ret - +INCLUDE "engine/check_battle_scene.asm" INCLUDE "engine/gbc_only.asm" INCLUDE "event/poke_seer.asm" @@ -969,7 +808,6 @@ SECTION "bank2F", ROMX INCLUDE "engine/std_scripts.asm" INCLUDE "engine/phone_scripts.asm" INCLUDE "engine/trainer_scripts.asm" -INCLUDE "gfx/sprites.asm" SECTION "bank32", ROMX @@ -1073,8 +911,6 @@ INCLUDE "engine/npctrade.asm" INCLUDE "event/mom_phone.asm" -SECTION "mobile_40", ROMX - INCLUDE "mobile/mobile_40.asm" @@ -1146,9 +982,13 @@ _UpdateBattleHUDs: ret +SECTION "mobile_5e", ROMX + INCLUDE "mobile/mobile_5e.asm" +SECTION "bank5F", ROMX + INCLUDE "mobile/mobile_5f.asm" diff --git a/mobile/mobile_40.asm b/mobile/mobile_40.asm index fa6a39fdf..c476e4297 100644 --- a/mobile/mobile_40.asm +++ b/mobile/mobile_40.asm @@ -1,3 +1,5 @@ +SECTION "mobile_40", ROMX + Function100000: ; 100000 ; d: 1 or 2 ; e: bank diff --git a/mobile/mobile_41.asm b/mobile/mobile_41.asm index 37e10a01e..9ab9f7ed2 100755 --- a/mobile/mobile_41.asm +++ b/mobile/mobile_41.asm @@ -1,5 +1,3 @@ -SECTION "bank41_2", ROMX - ; These functions deal with miscellaneous statistics ; which were used for Trainer Rankings in Pokémon News. diff --git a/mobile/mobile_46.asm b/mobile/mobile_46.asm index 48fed0f33..986bf9509 100755 --- a/mobile/mobile_46.asm +++ b/mobile/mobile_46.asm @@ -3015,6 +3015,7 @@ Unknown_1196b8: ; 1196b8 db "Sun" ; 1196cd + SECTION "bank46_2", ROMX ; A hack to use ascii above. diff --git a/mobile/mobile_5e.asm b/mobile/mobile_5e.asm index b22f714ea..baf247fe2 100644 --- a/mobile/mobile_5e.asm +++ b/mobile/mobile_5e.asm @@ -1,10 +1,6 @@ - -SECTION "Misc Crystal", ROMX - MobileAdapterGFX:: INCBIN "gfx/mobile/mobile_adapter.2bpp" - Function17a68f:: ; 17a68f (5e:668f) call Function17a6a8 call Function17a751 diff --git a/mobile/mobile_5f.asm b/mobile/mobile_5f.asm index 816e23394..9b0c5455b 100644 --- a/mobile/mobile_5f.asm +++ b/mobile/mobile_5f.asm @@ -1,8 +1,4 @@ - -SECTION "bank5F", ROMX - Function17c000: ; 17c000 - call DisableLCD ld hl, VTiles2 diff --git a/pokecrystal.link b/pokecrystal.link index 60ff314ff..6002adbf5 100644 --- a/pokecrystal.link +++ b/pokecrystal.link @@ -173,7 +173,6 @@ ROMX $40 "bank40_3" ROMX $41 "bank41" - "bank41_2" ROMX $42 "mobile_42" "Intro Logo" @@ -243,7 +242,7 @@ ROMX $5e "bank5E" "Songs 5" "Crystal Sound Effects" - "Misc Crystal" + "mobile_5e" ROMX $5f "bank5F" ROMX $60 diff --git a/text/common_text.asm b/text/common_text.asm index c4891ab15..d21685480 100644 --- a/text/common_text.asm +++ b/text/common_text.asm @@ -1,12 +1,18 @@ INCLUDE "includes.asm" + SECTION "Text 1", ROMX + INCLUDE "text/common_1.asm" + SECTION "Text 2", ROMX + INCLUDE "text/common_2.asm" INCLUDE "text/common_3.asm" + SECTION "Text 3", ROMX + INCLUDE "text/common_4.asm" INCLUDE "text/common_5.asm"