From 0722de77ae57ed6832b9a725ddc14511668f79c5 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Mon, 1 Jan 2018 18:32:01 -0500 Subject: Remove trailing whitespace find . -name '*.asm' -exec sed -i 's/[ \t]\+$//' {} \; --- engine/sprite_anims.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/sprite_anims.asm b/engine/sprite_anims.asm index 9fb78a5d7..965f6bc0b 100755 --- a/engine/sprite_anims.asm +++ b/engine/sprite_anims.asm @@ -43,7 +43,7 @@ DoAnimFrame: ; 8d24b dw .sprite_anim_seq_1A dw .sprite_anim_seq_1B dw .sprite_anim_seq_1C - dw .IntroSuicune + dw .IntroSuicune dw .IntroPichuWooper dw .Celebi dw .IntroUnown -- cgit v1.2.3 From 3c953efcba01422102b00f4ee2c861f611a2e84d Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Mon, 1 Jan 2018 18:33:42 -0500 Subject: Consistent *_palette_map.asm --- engine/pokegear.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/pokegear.asm b/engine/pokegear.asm index dba071b28..93ee5a79f 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -2834,7 +2834,7 @@ TownMapPals: ; 91f13 ret .PalMap: -INCLUDE "data/palettes/town_map.asm" +INCLUDE "data/palettes/town_map_palette_map.asm" ; 91f7b TownMapMon: ; 91f7b -- cgit v1.2.3 From 9a3088e50cf58158cbfb8de5ad80170967d975dc Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 2 Jan 2018 13:24:05 +0100 Subject: Clean up XXX comments for unused content --- engine/battle/battle_transition.asm | 3 +-- engine/battle/core.asm | 3 +-- engine/billspc.asm | 2 +- engine/color.asm | 24 ++++++++---------------- engine/dma_transfer.asm | 4 ++-- engine/events/kurt.asm | 2 +- engine/events/mom_phone.asm | 6 +++--- engine/events/overworld.asm | 2 +- engine/evolve.asm | 2 +- engine/mail_2.asm | 3 +-- engine/mon_stats.asm | 3 +-- engine/move_mon.asm | 2 +- engine/namingscreen.asm | 4 ++-- engine/pic_animation.asm | 2 +- engine/player_gfx.asm | 3 +-- engine/pokegear.asm | 6 +++--- engine/printer.asm | 3 +-- engine/printnum.asm | 2 +- engine/routines/printhoursmins.asm | 3 +-- engine/rtc.asm | 2 +- engine/save.asm | 12 ++++-------- engine/scripting.asm | 2 +- engine/time.asm | 4 ++-- 23 files changed, 40 insertions(+), 59 deletions(-) (limited to 'engine') diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 85ba44072..d3ac22698 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -863,8 +863,7 @@ ENDM ret ; 8c7c9 (23:47c9) -Function8c7c9: -; XXX +Unreferenced_Function8c7c9: ld a, $1 ld [hBGMapMode], a call WaitBGMap diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 08021fc8b..93eefb19c 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -8551,8 +8551,7 @@ InitEnemyWildmon: ; 3f607 ret ; 3f662 -Function3f662: ; 3f662 -; XXX +Unreferenced_Function3f662: ; 3f662 ld hl, EnemyMonMoves ld de, wListMoves_MoveIndicesBuffer ld b, NUM_MOVES diff --git a/engine/billspc.asm b/engine/billspc.asm index f94f495c6..cf25be280 100755 --- a/engine/billspc.asm +++ b/engine/billspc.asm @@ -2559,7 +2559,7 @@ BillsPC_ChangeBoxSubmenu: ; e36f9 (38:76f9) ret ; e3778 (38:7778) - hlcoord 11, 7 ; XXX + hlcoord 11, 7 ; unused .MenuDataHeader: ; 0xe377b db $40 ; flags diff --git a/engine/color.asm b/engine/color.asm index 04b24fde9..552adf1b5 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -78,8 +78,7 @@ CheckContestMon: and a ret -Function8aa4: -; XXX +Unreferenced_Function8aa4: push de push bc ld hl, PalPacket_9ce6 @@ -180,8 +179,7 @@ Function8b3f: ld hl, BlkPacket_9a86 jp PushSGBPals_ -Function8b4d: -; XXX +Unreferenced_Function8b4d: call CheckCGB jr nz, .cgb ld a, [hSGB] @@ -196,8 +194,7 @@ Function8b4d: call GetPredefPal jp LoadHLPaletteIntoDE -Function8b67: -; XXX +Unreferenced_Function8b67: call CheckCGB jr nz, .cgb ld a, [hSGB] @@ -212,8 +209,7 @@ Function8b67: call GetPredefPal jp LoadHLPaletteIntoDE -Function8b81: -; XXX +Unreferenced_Function8b81: call CheckCGB jr nz, .cgb ld a, [hSGB] @@ -281,8 +277,7 @@ got_palette_pointer_8bd7 call LoadPalette_White_Col1_Col2_Black ret -Function8bec: -; XXX +Unreferenced_Function8bec: ld a, [hCGB] and a jr nz, .cgb @@ -455,8 +450,7 @@ INCLUDE "data/palettes/mail.pal" INCLUDE "engine/cgb_layouts.asm" -Function95f0: -; XXX +Unreferenced_Function95f0: ld hl, .Palette ld de, wBGPals1 ld bc, 1 palettes @@ -768,8 +762,7 @@ Function9779: mobile BattleObjectPals: INCLUDE "data/palettes/battle_objects.pal" -Function97cc: -; XXX +Unreferenced_Function97cc: call CheckCGB ret z ld a, $90 @@ -979,8 +972,7 @@ _InitSGBBorderPals: dw PalPacket_9dd6 dw PalPacket_9de6 -Function9911: -; XXX +Unreferenced_Function9911: di xor a ld [rJOYP], a diff --git a/engine/dma_transfer.asm b/engine/dma_transfer.asm index 56e7d56da..c5d804d42 100755 --- a/engine/dma_transfer.asm +++ b/engine/dma_transfer.asm @@ -112,7 +112,7 @@ Mobile_ReloadMapPart: ; 104099 ret ; 1040d4 -; XXX +; unused ld hl, .unreferenced_1040da jp CallInSafeGFXMode @@ -136,7 +136,7 @@ Mobile_ReloadMapPart: ; 104099 ret ; 1040fb -; XXX +; unused ld hl, .unreferenced_104101 jp CallInSafeGFXMode diff --git a/engine/events/kurt.asm b/engine/events/kurt.asm index 9bc06a613..5fc65a0e8 100644 --- a/engine/events/kurt.asm +++ b/engine/events/kurt.asm @@ -163,7 +163,7 @@ Kurt_SelectQuantity: ; 880c2 db 09, 06 ; start coords db 12, 19 ; end coords - db 0, 0, -1, 0 ; XXX + db 0, 0, -1, 0 ; unused .PlaceApricornName: ; 88116 call MenuBoxCoord2Tile diff --git a/engine/events/mom_phone.asm b/engine/events/mom_phone.asm index bef7d5688..614c18943 100755 --- a/engine/events/mom_phone.asm +++ b/engine/events/mom_phone.asm @@ -217,7 +217,7 @@ endr INCLUDE "data/items/mom_phone.asm" - db 0, 0, 0 ; XXX + db 0, 0, 0 ; unused _MomText_HiHowAreYou: ; 0xfd1b1 ; Hi, ! How are you? @@ -255,10 +255,10 @@ _MomText_ItsInRoom: ; 0xfd1ca db "@" ; 0xfd1cf - db 0 ; XXX + db 0 ; unused Predef3A: ; fd1d0 ret ; fd1d1 - ret ; XXX + ret ; unused diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm index 17ec54bb1..36ba20302 100755 --- a/engine/events/overworld.asm +++ b/engine/events/overworld.asm @@ -1749,7 +1749,7 @@ Script_GetOnBike_Register: ; 0xd14e special ReplaceKrisSprite end -; XXX +; unused nop ret diff --git a/engine/evolve.asm b/engine/evolve.asm index c335229d6..d910ddca6 100755 --- a/engine/evolve.asm +++ b/engine/evolve.asm @@ -333,7 +333,7 @@ EvolveAfterBattle_MasterLoop inc hl jp .loop -; XXX +; unused pop hl .ReturnToMap: pop de diff --git a/engine/mail_2.asm b/engine/mail_2.asm index d66bbbbd7..96d755a78 100755 --- a/engine/mail_2.asm +++ b/engine/mail_2.asm @@ -725,8 +725,7 @@ MailGFX_PlaceMessage: ; b9803 jp PlaceString ; b984e -Functionb984e: ; b984e -; XXX +Unreferenced_Functionb984e: ; b984e .loop ld a, [hl] xor $ff diff --git a/engine/mon_stats.asm b/engine/mon_stats.asm index a3039eefd..522c3743e 100644 --- a/engine/mon_stats.asm +++ b/engine/mon_stats.asm @@ -324,8 +324,7 @@ ListMovePP: ; 50c50 jr nz, .load_loop ret -Function50cd0: ; 50cd0 -; XXX +Unreferenced_Function50cd0: ; 50cd0 .loop ld [hl], $32 inc hl diff --git a/engine/move_mon.asm b/engine/move_mon.asm index 90728e84c..90abe2903 100755 --- a/engine/move_mon.asm +++ b/engine/move_mon.asm @@ -1795,7 +1795,7 @@ InitNickname: ; e3de pop hl ld de, StringBuffer1 call InitName - ld a, $4 ; XXX could this be in bank 4 in pokered? + ld a, $4 ; ExitAllMenus is in bank 0, XXX could this be in bank 4 in pokered? ld hl, ExitAllMenus rst FarCall ret diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index 177f06f73..f34ca520e 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -739,7 +739,7 @@ NamingScreen_AdvanceCursor_CheckEndOfString: ; 11b27 ; 11b39 (4:5b39) -; XXX +; unused ld a, [wNamingScreenCurrNameLength] and a ret z @@ -1434,7 +1434,7 @@ MailComposition_TryAddLastCharacter: ; 121ac (4:61ac) ; 121b2 (4:61b2) -; XXX +; unused ld a, [wNamingScreenCurrNameLength] and a ret z diff --git a/engine/pic_animation.asm b/engine/pic_animation.asm index 33b770b14..b20dfef8b 100644 --- a/engine/pic_animation.asm +++ b/engine/pic_animation.asm @@ -695,7 +695,7 @@ PokeAnim_ConvertAndApplyBitmask: ; d036b ret ; d03f4 -; XXX +; unused db 6, 5, 4 .GetTilemap: ; d03f7 diff --git a/engine/player_gfx.asm b/engine/player_gfx.asm index 98a54684b..cc1d56ae2 100644 --- a/engine/player_gfx.asm +++ b/engine/player_gfx.asm @@ -1,5 +1,4 @@ -Function88248: ; 88248 -; XXX +Unreferenced_Function88248: ; 88248 ld c, CAL ld a, [wPlayerGender] bit 0, a diff --git a/engine/pokegear.asm b/engine/pokegear.asm index dba071b28..b79ec5484 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -1309,7 +1309,7 @@ PokegearPhoneContactSubmenu: ; 91342 (24:5342) ; 9146e -; XXX +; unused ld a, [hHours] cp 12 jr c, .am @@ -1499,7 +1499,7 @@ UpdateRadioStation: ; 9166f (24:566f) ; 916a1 (24:56a1) -; XXX +; unused ld [wPokegearRadioChannelBank], a ld a, [hli] ld [wPokegearRadioChannelAddr], a @@ -2932,7 +2932,7 @@ INCBIN "gfx/pokegear/dexmap_nest_icon.2bpp" FlyMapLabelBorderGFX: ; 922e1 INCBIN "gfx/pokegear/flymap_label_border.1bpp" -; XXX +Unreferenced_Function92311: xor a ld [wTownMapPlayerIconLandmark], a call ClearBGPalettes diff --git a/engine/printer.asm b/engine/printer.asm index 68c3c6c9f..002620606 100755 --- a/engine/printer.asm +++ b/engine/printer.asm @@ -596,8 +596,7 @@ PlacePrinterStatusString: ; 84785 ret ; 847bd -Function847bd: ; 847bd -; XXX +Unreferenced_Function847bd: ; 847bd ld a, [wPrinterStatus] and a ret z diff --git a/engine/printnum.asm b/engine/printnum.asm index d1d7e7ad3..fec798d5c 100755 --- a/engine/printnum.asm +++ b/engine/printnum.asm @@ -165,7 +165,7 @@ _PrintNum:: ; c4c7 dec e jr nz, .money_leading_zero inc hl - ld [hl], $f2 ; XXX + ld [hl], "" .money_leading_zero call .AdvancePointer diff --git a/engine/routines/printhoursmins.asm b/engine/routines/printhoursmins.asm index 50117188c..eb7dc1619 100644 --- a/engine/routines/printhoursmins.asm +++ b/engine/routines/printhoursmins.asm @@ -1,5 +1,4 @@ -Function1dd6a9: ; 1dd6a9 -; XXX +Unreferenced_Function1dd6a9: ; 1dd6a9 ld a, b ld b, c ld c, a diff --git a/engine/rtc.asm b/engine/rtc.asm index dc49a9630..ab198ee0f 100755 --- a/engine/rtc.asm +++ b/engine/rtc.asm @@ -1,4 +1,4 @@ -StopRTC: ; Unreferenced??? +StopRTC: ; Unreferenced ld a, SRAM_ENABLE ld [MBC3SRamEnable], a call LatchClock diff --git a/engine/save.asm b/engine/save.asm index af24b4d2f..1ce5eae49 100644 --- a/engine/save.asm +++ b/engine/save.asm @@ -415,8 +415,7 @@ EraseHallOfFame: ; 14d06 jp CloseSRAM ; 14d18 -Function14d18: ; 14d18 -; XXX +Unreferenced_Function14d18: ; 14d18 ; copy .Data to SRA4:a007 ld a, $4 call GetSRAMBank @@ -452,8 +451,7 @@ SaveData: ; 14d68 ret ; 14d6c -Function14d6c: ; 14d6c -; XXX +Unreferenced_Function14d6c: ; 14d6c ld a, $4 call GetSRAMBank ld a, [$a60b] @@ -469,8 +467,7 @@ Function14d6c: ; 14d6c ret ; 14d83 -Function14d83: ; 14d83 -; XXX +Unreferenced_Function14d83: ; 14d83 ld a, $4 call GetSRAMBank xor a @@ -480,8 +477,7 @@ Function14d83: ; 14d83 ret ; 14d93 -Function14d93: ; 14d93 -; XXX +Unreferenced_Function14d93: ; 14d93 ld a, $7 call GetSRAMBank xor a diff --git a/engine/scripting.asm b/engine/scripting.asm index 9a89c375a..8d9a394d5 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -2852,7 +2852,7 @@ Script_loadbytec2cf: ld [wc2cf], a ret - ld c, c ; XXX + ld c, c ; unused Script_closetext: ; script command 0x49 diff --git a/engine/time.asm b/engine/time.asm index 799a24f49..dafd1dd52 100755 --- a/engine/time.asm +++ b/engine/time.asm @@ -225,13 +225,13 @@ CheckUnusedTwoDayTimer: ; 1150c ret ; 1151c -; XXX +; unused ld hl, wDailyFlags set 2, [hl] ret ; 11522 -; XXX +; unused and a ld hl, wDailyFlags bit 2, [hl] -- cgit v1.2.3 From 7a24703398aba3ab112ed770368805a17c601c03 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 2 Jan 2018 15:05:14 +0100 Subject: Clean up Predef function names --- engine/battle/battle_transition.asm | 6 +++--- engine/battle/start_battle.asm | 2 +- engine/cgb_layouts.asm | 2 +- engine/events/bug_contest/display_stats.asm | 6 +++--- engine/events/mom_phone.asm | 2 +- engine/events/special.asm | 3 +-- engine/link.asm | 24 ++++++++++++------------ engine/link_trade.asm | 2 +- engine/mon_stats.asm | 2 +- engine/pic_animation.asm | 3 ++- engine/pokedex.asm | 2 +- engine/pokegear.asm | 2 +- engine/predef.asm | 26 +++++++++++++------------- engine/routines/placewaitingtext.asm | 2 +- engine/sgb_layouts.asm | 5 ++--- engine/timeofdaypals.asm | 4 ++-- 16 files changed, 46 insertions(+), 47 deletions(-) (limited to 'engine') diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index d3ac22698..2b3f5510e 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -1,4 +1,4 @@ -Predef_StartBattle: ; 8c20f +DoBattleTransition: ; 8c20f call .InitGFX ld a, [rBGP] ld [wBGP], a @@ -16,7 +16,7 @@ Predef_StartBattle: ; 8c20f ld a, [wJumptableIndex] bit 7, a jr nz, .done - call FlashyTransitionToBattle + call BattleTransitionJumptable call DelayFrame jr .loop @@ -144,7 +144,7 @@ TrainerBattlePokeballTiles: ; 8c2f4 INCBIN "gfx/overworld/trainer_battle_pokeball_tiles.2bpp" -FlashyTransitionToBattle: ; 8c314 +BattleTransitionJumptable: ; 8c314 jumptable .dw, wJumptableIndex ; 8c323 diff --git a/engine/battle/start_battle.asm b/engine/battle/start_battle.asm index 7f0bff96b..18ca2df8d 100644 --- a/engine/battle/start_battle.asm +++ b/engine/battle/start_battle.asm @@ -33,7 +33,7 @@ FindFirstAliveMonAndStartBattle: ; 2ee2f add hl, de ld a, [hl] ld [BattleMonLevel], a - predef Predef_StartBattle + predef DoBattleTransition farcall _LoadBattleFontsHPBar ld a, 1 ld [hBGMapMode], a diff --git a/engine/cgb_layouts.asm b/engine/cgb_layouts.asm index 74d476dec..a6de042fe 100644 --- a/engine/cgb_layouts.asm +++ b/engine/cgb_layouts.asm @@ -6,7 +6,7 @@ CheckCGB: ; 8d55 ret ; 8d59 -Predef_LoadSGBLayoutCGB: ; 8d59 +LoadSGBLayoutCGB: ; 8d59 ld a, b cp SCGB_RAM jr nz, .not_ram diff --git a/engine/events/bug_contest/display_stats.asm b/engine/events/bug_contest/display_stats.asm index d6ad3997e..0e2567c28 100644 --- a/engine/events/bug_contest/display_stats.asm +++ b/engine/events/bug_contest/display_stats.asm @@ -101,7 +101,7 @@ DisplayAlreadyCaughtText: ; cc0c7 text_jump UnknownText_0x1c10dd db "@" -Predef2F: -Predef38: -Predef39: ; cc0d5 +DummyPredef2F: +DummyPredef38: +DummyPredef39: ; cc0d5 ret diff --git a/engine/events/mom_phone.asm b/engine/events/mom_phone.asm index 614c18943..50496e663 100755 --- a/engine/events/mom_phone.asm +++ b/engine/events/mom_phone.asm @@ -257,7 +257,7 @@ _MomText_ItsInRoom: ; 0xfd1ca db 0 ; unused -Predef3A: ; fd1d0 +DummyPredef3A: ; fd1d0 ret ; fd1d1 diff --git a/engine/events/special.asm b/engine/events/special.asm index 939db4a25..f1cd3f4e0 100755 --- a/engine/events/special.asm +++ b/engine/events/special.asm @@ -230,6 +230,5 @@ CopyPokemonName_Buffer1_Buffer3: ; 746e ld bc, PKMN_NAME_LENGTH jp CopyBytes -Predef1: ; 747a -; not used +DummyPredef1: ; 747a ret diff --git a/engine/link.asm b/engine/link.asm index 5c45707d7..70fd3b852 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -1362,7 +1362,7 @@ Function28926: ; 28926 hlcoord 0, 15 ld b, 1 ld c, 18 - call Predef_LinkTextbox + call LinkTextboxPredef hlcoord 2, 16 ld de, .String_Stats_Trade call PlaceString @@ -1471,7 +1471,7 @@ Function28926: ; 28926 hlcoord 0, 12 ld b, 4 ld c, 18 - call Predef_LinkTextbox + call LinkTextboxPredef farcall Link_WaitBGMap ld hl, .Text_CantTradeLastMon bccoord 1, 14 @@ -1493,7 +1493,7 @@ Function28926: ; 28926 hlcoord 0, 12 ld b, 4 ld c, 18 - call Predef_LinkTextbox + call LinkTextboxPredef farcall Link_WaitBGMap ld hl, .Text_Abnormal bccoord 1, 14 @@ -1503,7 +1503,7 @@ Function28926: ; 28926 hlcoord 0, 12 ld b, 4 ld c, 18 - call Predef_LinkTextbox + call LinkTextboxPredef hlcoord 1, 14 ld de, String_TooBadTheTradeWasCanceled call PlaceString @@ -1649,7 +1649,7 @@ LinkTrade: ; 28b87 hlcoord 0, 12 ld b, $4 ld c, $12 - call Predef_LinkTextbox + call LinkTextboxPredef farcall Link_WaitBGMap ld a, [wd002] ld hl, PartySpecies @@ -1678,7 +1678,7 @@ LinkTrade: ; 28b87 hlcoord 10, 7 ld b, 3 ld c, 7 - call Predef_LinkTextbox + call LinkTextboxPredef ld de, String28eab hlcoord 12, 8 call PlaceString @@ -1718,7 +1718,7 @@ LinkTrade: ; 28b87 hlcoord 0, 12 ld b, 4 ld c, 18 - call Predef_LinkTextbox + call LinkTextboxPredef hlcoord 1, 14 ld de, String_TooBadTheTradeWasCanceled call PlaceString @@ -1735,7 +1735,7 @@ LinkTrade: ; 28b87 hlcoord 0, 12 ld b, 4 ld c, 18 - call Predef_LinkTextbox + call LinkTextboxPredef hlcoord 1, 14 ld de, String_TooBadTheTradeWasCanceled call PlaceString @@ -1965,7 +1965,7 @@ LinkTrade: ; 28b87 hlcoord 0, 12 ld b, 4 ld c, 18 - call Predef_LinkTextbox + call LinkTextboxPredef hlcoord 1, 14 ld de, String28ebd call PlaceString @@ -2002,7 +2002,7 @@ String_TooBadTheTradeWasCanceled: ; 28ece next "was canceled!@" -Predef_LinkTextbox: ; 28eef +LinkTextboxPredef: ; 28eef ld d, h ld e, l farcall LinkTextbox @@ -2025,11 +2025,11 @@ Function28f09: ; 28f09 hlcoord 0, 0 ld b, 6 ld c, 18 - call Predef_LinkTextbox + call LinkTextboxPredef hlcoord 0, 8 ld b, 6 ld c, 18 - call Predef_LinkTextbox + call LinkTextboxPredef farcall PlaceTradePartnerNamesAndParty ret ; 28f24 diff --git a/engine/link_trade.asm b/engine/link_trade.asm index f85403a29..07b471640 100755 --- a/engine/link_trade.asm +++ b/engine/link_trade.asm @@ -181,7 +181,7 @@ Function16d6e1: ; 16d6e1 hlcoord 4, 10 ld b, 1 ld c, 10 - predef Predef_LinkTextbox + predef LinkTextboxPredef hlcoord 5, 11 ld de, .Waiting call PlaceString diff --git a/engine/mon_stats.asm b/engine/mon_stats.asm index 522c3743e..994f56011 100644 --- a/engine/mon_stats.asm +++ b/engine/mon_stats.asm @@ -335,7 +335,7 @@ Unreferenced_Function50cd0: ; 50cd0 jr nz, .loop ret -Predef22: ; unreferenced predef +UnreferencedPredef22: push hl push hl ld hl, PartyMonNicknames diff --git a/engine/pic_animation.asm b/engine/pic_animation.asm index b20dfef8b..65e067298 100644 --- a/engine/pic_animation.asm +++ b/engine/pic_animation.asm @@ -1110,9 +1110,10 @@ PokeAnim_GetSpeciesOrUnown: ; d065c ret ; d0669 -Predef48: ; d0669 Predef 48 +UnreferencedPredef48: ; d0669 Predef 48 ld a, $1 ld [wBoxAlignment], a + HOF_AnimateFrontpic: ; d066e Predef 49 call AnimateMon_CheckIfPokemon jr c, .fail diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 5dc3dc2a7..9e5f0c411 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -441,7 +441,7 @@ DexEntryScreen_MenuActionJumptable: ; 402f2 call Pokedex_GetSelectedMon ld a, [wDexCurrentLocation] ld e, a - predef _Area + predef Pokedex_GetArea call Pokedex_BlackOutBG call DelayFrame xor a diff --git a/engine/pokegear.asm b/engine/pokegear.asm index b79ec5484..2d9dfdbb6 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -2440,7 +2440,7 @@ FlyMap: ; 91c90 ; 91d11 -_Area: ; 91d11 +Pokedex_GetArea: ; 91d11 ; e: Current landmark ld a, [wTownMapPlayerIconLandmark] push af diff --git a/engine/predef.asm b/engine/predef.asm index 837f7b96b..c0a10a91b 100644 --- a/engine/predef.asm +++ b/engine/predef.asm @@ -31,7 +31,7 @@ PredefPointers:: ; 856b ; address, bank add_predef LearnMove ; $0 - add_predef Predef1 + add_predef DummyPredef1 add_predef HealParty add_predef FlagPredef add_predef ComputeHPBarPixels @@ -46,7 +46,7 @@ PredefPointers:: ; 856b add_predef CalcPkmnStatC add_predef CanLearnTMHMMove add_predef GetTMHMMove - add_predef Predef_LinkTextbox ; $ 10 + add_predef LinkTextboxPredef ; $ 10 add_predef PrintMoveDesc add_predef UpdatePlayerHUD add_predef PlaceGraphic @@ -64,7 +64,7 @@ PredefPointers:: ; 856b add_predef CopyPkmnToTempMon add_predef ListMoves ; $20 add_predef PlaceNonFaintStatus - add_predef Predef22 + add_predef UnreferencedPredef22 add_predef ListMovePP add_predef GetGender add_predef StatsScreenInit @@ -77,18 +77,18 @@ PredefPointers:: ; 856b add_predef PrintMonTypes add_predef GetUnownLetter add_predef LoadPoisonBGPals - add_predef Predef2F + add_predef DummyPredef2F add_predef InitSGBBorder ; $30 - add_predef Predef_LoadSGBLayout - add_predef _Area + add_predef LoadSGBLayout + add_predef Pokedex_GetArea add_predef CheckContestMon - add_predef Predef_StartBattle - add_predef Predef35 - add_predef Predef36 + add_predef DoBattleTransition + add_predef DummyPredef35 + add_predef DummyPredef36 add_predef PlayBattleAnim - add_predef Predef38 ; $38 - add_predef Predef39 - add_predef Predef3A + add_predef DummyPredef38 ; $38 + add_predef DummyPredef39 + add_predef DummyPredef3A add_predef PartyMonItemName add_predef GetMonFrontpic add_predef GetMonBackpic @@ -102,7 +102,7 @@ PredefPointers:: ; 856b add_predef PlaceStatusString add_predef LoadMonAnimation add_predef AnimateFrontpic - add_predef Predef48 ; $48 + add_predef UnreferencedPredef48 ; $48 add_predef HOF_AnimateFrontpic dbw $ff, InexplicablyEmptyFunction ; ??? ; 864c diff --git a/engine/routines/placewaitingtext.asm b/engine/routines/placewaitingtext.asm index 37fc2a056..11b747ec5 100644 --- a/engine/routines/placewaitingtext.asm +++ b/engine/routines/placewaitingtext.asm @@ -11,7 +11,7 @@ PlaceWaitingText:: ; 4000 jr .proceed .notinbattle - predef Predef_LinkTextbox + predef LinkTextboxPredef .proceed hlcoord 4, 11 diff --git a/engine/sgb_layouts.asm b/engine/sgb_layouts.asm index 36dbde84c..b6bbe582f 100644 --- a/engine/sgb_layouts.asm +++ b/engine/sgb_layouts.asm @@ -1,7 +1,6 @@ -Predef_LoadSGBLayout: ; 864c -; LoadSGBLayout +LoadSGBLayout: ; 864c call CheckCGB - jp nz, Predef_LoadSGBLayoutCGB + jp nz, LoadSGBLayoutCGB ld a, b cp SCGB_RAM diff --git a/engine/timeofdaypals.asm b/engine/timeofdaypals.asm index 0b1ea71a2..393a9e84a 100644 --- a/engine/timeofdaypals.asm +++ b/engine/timeofdaypals.asm @@ -1,5 +1,5 @@ -Predef35: ; 8c000 -Predef36: +DummyPredef35: ; 8c000 +DummyPredef36: ret UpdateTimeOfDayPal:: ; 8c001 -- cgit v1.2.3 From 6f0b81504d6471afe7df6adae83791cc81933ca6 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 2 Jan 2018 16:04:21 +0100 Subject: More unreferenced labels cleanup --- engine/battle/core.asm | 13 +++++-------- engine/billspc.asm | 2 +- engine/billspctop.asm | 2 +- engine/breeding.asm | 3 +-- engine/color.asm | 9 +++------ engine/crystal_colors.asm | 2 +- engine/events.asm | 2 +- engine/events/overworld.asm | 2 +- engine/intro_menu.asm | 10 +++++----- engine/link.asm | 11 ++++------- engine/main_menu.asm | 2 +- engine/map_objects.asm | 3 +-- engine/map_setup.asm | 2 +- engine/mart.asm | 2 +- engine/menu.asm | 6 ++---- engine/menu_2.asm | 4 ++-- engine/mon_icons.asm | 3 +-- engine/mystery_gift.asm | 2 +- engine/npc_movement.asm | 4 ++-- engine/npctrade.asm | 6 ++---- engine/pack.asm | 6 ++---- engine/predef.asm | 2 +- engine/routines/correcterrorsinplayerparty.asm | 2 +- engine/rtc.asm | 4 ++-- engine/scripting.asm | 5 +++-- engine/scrolling_menu.asm | 2 +- engine/slot_machine.asm | 10 ++++------ engine/stats_screen.asm | 6 ++---- engine/tmhm2.asm | 6 ++---- engine/trainer_card.asm | 6 ++---- 30 files changed, 57 insertions(+), 82 deletions(-) (limited to 'engine') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 93eefb19c..c82ae93c5 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1951,8 +1951,7 @@ GetMaxHP: ; 3ccac ret ; 3ccc2 -GetHalfHP: ; 3ccc2 -; unreferenced +Unreferenced_GetHalfHP: ; 3ccc2 ld hl, BattleMonHP ld a, [hBattleTurn] and a @@ -6769,8 +6768,7 @@ CheckUnownLetter: ; 3eb75 ; 3ebc7 -SwapBattlerLevels: ; 3ebc7 -; unreferenced +Unreferenced_SwapBattlerLevels: ; 3ebc7 push bc ld a, [BattleMonLevel] ld b, a @@ -7162,7 +7160,7 @@ _LoadHPBar: ; 3eda6 ret ; 3edad -LoadHPExpBarGFX: ; unreferenced +Unreferenced_LoadHPExpBarGFX: ld de, EnemyHPBarBorderGFX ld hl, vTiles2 tile $6c lb bc, BANK(EnemyHPBarBorderGFX), 4 @@ -8104,7 +8102,7 @@ TextJump_ComeBack: ; 3f35b db "@" ; 3f360 -HandleSafariAngerEatingStatus: ; unreferenced +Unreferenced_HandleSafariAngerEatingStatus: ld hl, wSafariMonEating ld a, [hl] and a @@ -8371,8 +8369,7 @@ StartBattle: ; 3f4c1 ret ; 3f4d9 -_DoBattle: ; 3f4d9 -; unreferenced +Unreferenced_DoBattle: ; 3f4d9 call DoBattle ret ; 3f4dd diff --git a/engine/billspc.asm b/engine/billspc.asm index cf25be280..07bdf884a 100755 --- a/engine/billspc.asm +++ b/engine/billspc.asm @@ -245,7 +245,7 @@ BillsPCDepositMenuDataHeader: ; 0xe253d (38:653d) db "CANCEL@" ; 0xe2564 (38:6564) -BillsPC_ClearThreeBoxes: ; e2564 +Unreferenced_BillsPCClearThreeBoxes: ; e2564 ; unreferenced hlcoord 0, 0 ld b, 4 diff --git a/engine/billspctop.asm b/engine/billspctop.asm index c36cbe45d..699fa7887 100755 --- a/engine/billspctop.asm +++ b/engine/billspctop.asm @@ -268,7 +268,7 @@ CopyBoxmonToTempMon: ; e5bb call CloseSRAM ret -Functione5d9: ; unreferenced +Unreferenced_Functione5d9: ld a, [wCurBox] cp b jr z, .same_box diff --git a/engine/breeding.asm b/engine/breeding.asm index 234e05448..7d2209de9 100755 --- a/engine/breeding.asm +++ b/engine/breeding.asm @@ -981,8 +981,7 @@ DayCareMonCompatibilityText: ; 1746c db "@" ; 0x174b5 -DayCareMonPrintEmptyString: ; 174b5 -; unreferenced +Unreferenced_DayCareMonPrintEmptyString: ; 174b5 ld hl, .string ret ; 174b9 diff --git a/engine/color.asm b/engine/color.asm index 552adf1b5..92d14e560 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -43,8 +43,7 @@ CheckShininess: and a ret -; unreferenced -CheckContestMon: +Unreferenced_CheckContestMon: ; Check a mon's DVs at hl in the bug catching contest. ; Return carry if its DVs are good enough to place in the contest. @@ -135,8 +134,7 @@ SGB_ApplyPartyMenuHPPals: ; 8ade ld [hl], e ret -Function8b07: -; Unreferenced +Unreferenced_Function8b07: call CheckCGB ret z ; CGB only @@ -169,8 +167,7 @@ Function8b07: RGB 08, 16, 28 RGB 00, 00, 00 -Function8b3f: -; Unreferenced +Unreferenced_Function8b3f: call CheckCGB ret nz ld a, [hSGB] diff --git a/engine/crystal_colors.asm b/engine/crystal_colors.asm index 5d2ba236c..e1c4336d9 100755 --- a/engine/crystal_colors.asm +++ b/engine/crystal_colors.asm @@ -322,5 +322,5 @@ InitMG_Mobile_LinkTradePalMap: ; 49856 ret ; 4985a -Unknown_4985a: ; unreferenced +; unused INCLUDE "data/palettes/unknown/4985a.asm" diff --git a/engine/events.asm b/engine/events.asm index 7356a8910..7dd87a318 100644 --- a/engine/events.asm +++ b/engine/events.asm @@ -1060,7 +1060,7 @@ Invalid_0x96c2d: ; 96c2d end ; 96c2e -; unreferenced +; unused end ; 96c2f diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm index 36ba20302..4583733ee 100755 --- a/engine/events/overworld.asm +++ b/engine/events/overworld.asm @@ -986,7 +986,7 @@ StrengthFunction: ; cce5 jr c, .Failed jr .UseStrength -.AlreadyUsing: ; unreferenced +.Unreferenced_AlreadyUsing: ld hl, .JumpText call MenuTextBoxBackup ld a, $80 diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index 7d17b62e5..d51e32a54 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -10,7 +10,7 @@ _MainMenu: ; 5ae8 jp StartTitleScreen ; 5b04 -; unreferenced +; unused ret ; 5b05 @@ -827,7 +827,7 @@ NamePlayer: ; 0x6074 db "KRIS@@@@@@@" ; 60e9 -Function60e9: ; Unreferenced +Unreferenced_Function60e9: call LoadMenuDataHeader call VerticalMenu ld a, [wMenuCursorY] @@ -1094,7 +1094,7 @@ RunTitleScreen: ; 627b ret ; 6292 -Function6292: ; 6292 ; unreferenced +Unreferenced_Function6292: ; 6292 ld a, [hVBlankCounter] and $7 ret nz @@ -1125,7 +1125,7 @@ TitleScreenScene: ; 62a3 dw TitleScreenEnd ; 62b7 -.NextScene: ; Unreferenced +.Unreferenced_NextScene: ld hl, wJumptableIndex inc [hl] ret @@ -1329,7 +1329,7 @@ ResetClock: ; 6392 jp Init ; 639b -Function639b: ; unreferenced +Unreferenced_Function639b: ; If bit 0 or 1 of [wTitleScreenTimer] is set, we don't need to be here. ld a, [wTitleScreenTimer] and $3 diff --git a/engine/link.asm b/engine/link.asm index 70fd3b852..5ea609496 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -1597,8 +1597,7 @@ Function28b22: ; 28b22 ret ; 28b42 -Function28b42: ; 28b42 -; unreferenced +Unreferenced_Function28b42: ; 28b42 hlcoord 0, 16 ld a, "┘" ld bc, 2 * SCREEN_WIDTH @@ -2020,8 +2019,7 @@ SetTradeRoomBGPals: ; 28eff ret ; 28f09 -Function28f09: ; 28f09 -; unreferenced +Unreferenced_Function28f09: ; 28f09 hlcoord 0, 0 ld b, 6 ld c, 18 @@ -2577,12 +2575,11 @@ Special_CableClubCheckWhichChris: ; 29f47 ret ; 29f54 -UnusedGen1LinkCommsBorderGFX: ; 29f54 -; unreferenced +Unreferenced_Gen1LinkCommsBorderGFX: ; 29f54 INCBIN "gfx/trade/unused_gen_1_border_tiles.2bpp" ; 29fe4 -Function29fe4: ; unreferenced +Unreferenced_Function29fe4: ld a, BANK(sPartyMail) call GetSRAMBank ld d, $0 diff --git a/engine/main_menu.asm b/engine/main_menu.asm index cbd516cd7..d7ca810da 100755 --- a/engine/main_menu.asm +++ b/engine/main_menu.asm @@ -279,7 +279,7 @@ MainMenu_PrintCurrentTimeAndDay: ; 49e09 ret .min -; unreferenced +; unused db "min.@" ; 49e75 diff --git a/engine/map_objects.asm b/engine/map_objects.asm index fe3c13a13..b0cc073a6 100644 --- a/engine/map_objects.asm +++ b/engine/map_objects.asm @@ -418,8 +418,7 @@ UpdatePlayerStep: ; 4738 ret ; 4759 -Function4759: ; 4759 -; unreferenced +Unreferenced_Function4759: ; 4759 push bc ld e, a ld d, 0 diff --git a/engine/map_setup.asm b/engine/map_setup.asm index 078e6a2fd..a4d9d1636 100644 --- a/engine/map_setup.asm +++ b/engine/map_setup.asm @@ -137,7 +137,7 @@ LoadObjectsRunCallback_02: ; 154d7 ret ; 154ea (5:54ea) -; unreferenced +; unused ret ; 154eb diff --git a/engine/mart.asm b/engine/mart.asm index 4a8d9e17b..060aba8e9 100755 --- a/engine/mart.asm +++ b/engine/mart.asm @@ -797,7 +797,7 @@ SellMenu: ; 15eb3 ret ; 15ed3 -.NothingToSell: ; unreferenced +.Unreferenced_NothingToSell: ld hl, .NothingToSellText call MenuTextBoxBackup and a diff --git a/engine/menu.asm b/engine/menu.asm index 6fbed2848..196d45ea9 100755 --- a/engine/menu.asm +++ b/engine/menu.asm @@ -291,8 +291,7 @@ MobileMenuJoypad: ; 241ba ; 241d5 -Function241d5: ; 241d5 -; Unreferenced +Unreferenced_Function241d5: ; 241d5 call Place2DMenuCursor .loop call Move2DMenuCursor @@ -725,8 +724,7 @@ _ExitMenu:: ; 243e8 ret ; 24423 -Function24423: ; 24423 -; Unreferenced +Unreferenced_Function24423: ; 24423 ld a, [VramState] bit 0, a ret z diff --git a/engine/menu_2.asm b/engine/menu_2.asm index d88b75152..66c2b169d 100644 --- a/engine/menu_2.asm +++ b/engine/menu_2.asm @@ -112,8 +112,8 @@ CoinString: ; 24b89 ShowMoney_TerminatorString: ; 24b8e db "@" -Function24b8f: ; 24b8f -; unreferenced, related to safari? +Unreferenced_Function24b8f: ; 24b8f +; related to safari? ld hl, Options ld a, [hl] push af diff --git a/engine/mon_icons.asm b/engine/mon_icons.asm index 316ff3bac..d6013ea62 100755 --- a/engine/mon_icons.asm +++ b/engine/mon_icons.asm @@ -281,8 +281,7 @@ FlyFunction_GetMonIcon: ; 8e9bc (23:69bc) ret ; 8e9cc (23:69cc) -GetMonIcon2: ; 8e9cc -; unreferenced +Unreferenced_GetMonIcon2: ; 8e9cc push de ld a, [wd265] call ReadMonMenuIcon diff --git a/engine/mystery_gift.asm b/engine/mystery_gift.asm index 67ce10168..c4a047e7e 100755 --- a/engine/mystery_gift.asm +++ b/engine/mystery_gift.asm @@ -1369,7 +1369,7 @@ InitMysteryGiftLayout: ; 105153 (41:5153) jr .gfx_loop ; 105232 (41:5232) -.Load6GFX: ; unreferenced +.Unreferenced_Load6GFX: ld b, 6 jr .gfx_loop diff --git a/engine/npc_movement.asm b/engine/npc_movement.asm index a2508e0f6..0b43e09eb 100755 --- a/engine/npc_movement.asm +++ b/engine/npc_movement.asm @@ -279,7 +279,7 @@ WillObjectBumpIntoSomeoneElse: ; 7009 jr IsNPCAtCoord ; 7015 -Function7015: ; unreferenced +Unreferenced_Function7015: ld a, [hMapObjectIndexBuffer] call GetObjectStruct call .CheckWillBeFacingNPC @@ -482,7 +482,7 @@ IsObjectMovingOffEdgeOfScreen: ; 70ed ret ; 7113 -Function7113: ; unreferenced +Unreferenced_Function7113: ld a, [PlayerStandingMapX] ld d, a ld a, [PlayerStandingMapY] diff --git a/engine/npctrade.asm b/engine/npctrade.asm index 1455dce62..49c22829e 100755 --- a/engine/npctrade.asm +++ b/engine/npctrade.asm @@ -332,8 +332,7 @@ CopyTradeName: ; fcdf4 ret ; fcdfb -Functionfcdfb: ; fcdfb -; unreferenced +Unreferenced_Functionfcdfb: ; fcdfb ld bc, 4 call CopyBytes ld a, "@" @@ -341,8 +340,7 @@ Functionfcdfb: ; fcdfb ret ; fce05 -Functionfce05: ; fce05 -; unreferenced +Unreferenced_Functionfce05: ; fce05 ld bc, 3 call CopyBytes ld a, "@" diff --git a/engine/pack.asm b/engine/pack.asm index 047924cb0..59b7f8caa 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -534,8 +534,7 @@ TossMenu: ; 10364 ret ; 1039d -ResetPocketCursorPositions: ; 1039d -; unreferenced +Unreferenced_ResetPocketCursorPositions: ; 1039d ld a, [wCurrPocket] and a jr z, .items @@ -1511,8 +1510,7 @@ Pack_GetItemName: ; 10a1d ret ; 10a2a -Pack_ClearTilemap: ; 10a2a -; unreferenced +Unreferenced_Pack_ClearTilemap: ; 10a2a hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, " " diff --git a/engine/predef.asm b/engine/predef.asm index c0a10a91b..e799e7466 100644 --- a/engine/predef.asm +++ b/engine/predef.asm @@ -81,7 +81,7 @@ PredefPointers:: ; 856b add_predef InitSGBBorder ; $30 add_predef LoadSGBLayout add_predef Pokedex_GetArea - add_predef CheckContestMon + add_predef Unreferenced_CheckContestMon add_predef DoBattleTransition add_predef DummyPredef35 add_predef DummyPredef36 diff --git a/engine/routines/correcterrorsinplayerparty.asm b/engine/routines/correcterrorsinplayerparty.asm index 2fa98a545..639e5c544 100644 --- a/engine/routines/correcterrorsinplayerparty.asm +++ b/engine/routines/correcterrorsinplayerparty.asm @@ -1,4 +1,4 @@ -CorrectErrorsInPlayerParty: ; unreferenced +Unreferenced_CorrectErrorsInPlayerParty: ld hl, PartyCount ld a, [hl] and a diff --git a/engine/rtc.asm b/engine/rtc.asm index ab198ee0f..70b114c7a 100755 --- a/engine/rtc.asm +++ b/engine/rtc.asm @@ -1,4 +1,4 @@ -StopRTC: ; Unreferenced +Unreferenced_StopRTC: ld a, SRAM_ENABLE ld [MBC3SRamEnable], a call LatchClock @@ -58,7 +58,7 @@ TimesOfDay: ; 14044 db -1, MORN_F ; 1404e -Unknown_1404e: ; unreferenced +Unreferenced_1404e: db 20, NITE_F db 40, MORN_F db 60, DAY_F diff --git a/engine/scripting.asm b/engine/scripting.asm index 8d9a394d5..5965e372e 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -2806,7 +2806,8 @@ Script_warpcheck: farcall EnableEvents ret -Script_enableevents: ; unreferenced +Script_enableevents: +; unused farcall EnableEvents ret @@ -3037,7 +3038,7 @@ Script_check_save: ret -; unreferenced +; unused ld a, [.byte] ld [ScriptVar], a ret diff --git a/engine/scrolling_menu.asm b/engine/scrolling_menu.asm index 32f22188a..32acf2def 100755 --- a/engine/scrolling_menu.asm +++ b/engine/scrolling_menu.asm @@ -84,7 +84,7 @@ ScrollingMenuJoyAction: ; 24609 jr .loop ; 24640 -.unreferenced ; unreferenced +.unreferenced ; unused ld a, -1 and a ret diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index aea08f16a..e2292a6d8 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -232,8 +232,8 @@ SlotsLoop: ; 927af (24:67af) ; 92811 (24:6811) -Function92811: ; 92811 -; unreferenced - debug function? +Unreferenced_Function92811: ; 92811 +; debug function? ld a, [wSlotBias] add 0 daa @@ -252,8 +252,7 @@ Function92811: ; 92811 ; 9282c -Function9282c: ; 9282c -; unreferenced +Unreferenced_Function9282c: ; 9282c ; animate OAM tiles? ld hl, wcf66 ld a, [hl] @@ -854,8 +853,7 @@ Slots_UpdateReelPositionAndOAM: ; 92b53 (24:6b53) ; 92bbe (24:6bbe) -; unreferenced -Function92bbe: ; 92bbe +Unreferenced_Function92bbe: ; 92bbe push hl srl a srl a diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm index 9f632f388..a8f831408 100755 --- a/engine/stats_screen.asm +++ b/engine/stats_screen.asm @@ -447,8 +447,7 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea) dw wBufferMonNick ; 4df7f -Function4df7f: ; 4df7f -; unreferenced +Unreferenced_Function4df7f: ; 4df7f hlcoord 7, 0 ld bc, SCREEN_WIDTH ld d, SCREEN_HEIGHT @@ -962,8 +961,7 @@ StatsScreen_LoadTextBoxSpaceGFX: ; 4e307 (13:6307) ret ; 4e32a (13:632a) -; unreferenced -Unknown_4e32a: ; 4e32a +Unreferenced_4e32a: ; 4e32a ; A blank tile? ds 16 ; 4e33a diff --git a/engine/tmhm2.asm b/engine/tmhm2.asm index c111fa7f9..90e993a8b 100755 --- a/engine/tmhm2.asm +++ b/engine/tmhm2.asm @@ -447,8 +447,7 @@ TMHMPocket_GetCurrentLineCoord: ; 2ca86 (b:4a86) ret ; 2ca95 (b:4a95) -Function2ca95: ; 2ca95 -; unreferenced +Unreferenced_Function2ca95: ; 2ca95 pop hl ld bc, 3 add hl, bc @@ -499,8 +498,7 @@ TMHM_PlaySFX_ReadText2: ; 2cad6 (b:4ad6) ret ; 2cadf (b:4adf) -Function2cadf: ; 2cadf -; unreferenced +Unreferenced_Function2cadf: ; 2cadf call ConvertCurItemIntoCurTMHM call .CheckHaveRoomForTMHM ld hl, .NoRoomText diff --git a/engine/trainer_card.asm b/engine/trainer_card.asm index 87cab0103..67bc05533 100755 --- a/engine/trainer_card.asm +++ b/engine/trainer_card.asm @@ -117,8 +117,7 @@ TrainerCard_Page1_Joypad: ; 251d7 (9:51d7) ld [wJumptableIndex], a ret -.KantoCheck: -; unreferenced +.Unreferenced_KantoCheck: ld a, [wKantoBadges] and a ret z @@ -163,8 +162,7 @@ TrainerCard_Page2_Joypad: ; 25221 (9:5221) ld [wJumptableIndex], a ret -.KantoCheck: -; unreferenced +.Unreferenced_KantoCheck: ld a, [wKantoBadges] and a ret z -- cgit v1.2.3 From 7c0e903c4821b3e7ded9b795661ed3608e023cc2 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 2 Jan 2018 16:25:40 +0100 Subject: Clean up leftover code from main.asm --- engine/card_flip.asm | 7 +++++++ engine/dummy_game.asm | 4 ++-- engine/sprite_anims.asm | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'engine') diff --git a/engine/card_flip.asm b/engine/card_flip.asm index 158f3fa05..f1b985012 100755 --- a/engine/card_flip.asm +++ b/engine/card_flip.asm @@ -2,6 +2,13 @@ CARDFLIP_LIGHT_OFF EQU $ef CARDFLIP_LIGHT_ON EQU $f5 CARDFLIP_DECK_SIZE EQU 4 * 6 +; two labels below called from inside ./dummy_game.asm +Unknown_e00ed: ; e00ed (38:40ed) +; Graphics for an unused Game Corner +; game were meant to be here. +Ret_e00ed: ; e00ed (38:40ed) + ret + _CardFlip: ; e00ee (38:40ee) ld hl, Options set 4, [hl] diff --git a/engine/dummy_game.asm b/engine/dummy_game.asm index aecaa7425..9abffb232 100755 --- a/engine/dummy_game.asm +++ b/engine/dummy_game.asm @@ -77,7 +77,7 @@ _DummyGame: ; e1e5b (38:5e5b) ret .ResetBoard: - call ret_e00ed + call Ret_e00ed jr nc, .proceed ld hl, wJumptableIndex set 7, [hl] @@ -232,7 +232,7 @@ endr ld hl, wJumptableIndex inc [hl] .AskPlayAgain: - call ret_e00ed + call Ret_e00ed jr nc, .restart ld hl, wJumptableIndex set 7, [hl] diff --git a/engine/sprite_anims.asm b/engine/sprite_anims.asm index 9fb78a5d7..e141f5243 100755 --- a/engine/sprite_anims.asm +++ b/engine/sprite_anims.asm @@ -404,7 +404,7 @@ DoAnimFrame: ; 8d24b ret .ForUnusedCursor ; 8d46e (23:546e) - callfar ret_e00ed + callfar Ret_e00ed ret .PokegearArrow ; 8d475 (23:5475) -- cgit v1.2.3 From f1ea15bbfe8528143ace793b050891a9b1f99d03 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 2 Jan 2018 17:13:57 +0100 Subject: Consolidate Special function names --- engine/card_flip.asm | 2 +- engine/caught_data.asm | 2 +- engine/color.asm | 2 +- engine/decorations.asm | 4 +- engine/dummy_game.asm | 4 +- engine/events/bug_contest/contest_2.asm | 4 +- engine/events/bug_contest/judging.asm | 2 +- engine/events/field_moves.asm | 4 +- engine/events/halloffame.asm | 4 +- engine/events/happiness_egg.asm | 4 +- engine/events/heal_machine_anim.asm | 2 +- engine/events/itemfinder.asm | 4 +- engine/events/magnet_train.asm | 2 +- engine/events/misc_scripts.asm | 2 +- engine/events/move_deleter.asm | 2 +- engine/events/overworld.asm | 36 +++++----- engine/events/poisonstep_pals.asm | 4 +- engine/events/pokecenter_pc.asm | 4 +- engine/events/print_photo.asm | 2 +- engine/events/prof_oaks_pc.asm | 4 +- engine/events/sacred_ash.asm | 12 ++-- engine/events/special.asm | 4 +- engine/events/squirtbottle.asm | 2 +- engine/events/std_scripts.asm | 22 +++--- engine/events/sweet_scent.asm | 2 +- engine/events/whiteout.asm | 4 +- engine/events_2.asm | 2 +- engine/intro_menu.asm | 2 +- engine/link.asm | 2 +- engine/map_setup.asm | 6 +- engine/mart.asm | 2 +- engine/menu_2.asm | 2 +- engine/mon_stats.asm | 2 +- engine/overworld.asm | 8 +-- engine/phone/generic_calls.asm | 2 +- engine/phone/phone_callers.asm | 10 +-- engine/phone/phone_scripts.asm | 6 +- engine/pic_animation.asm | 2 +- engine/predef.asm | 6 +- engine/routines/playslowcry.asm | 2 +- engine/specials.asm | 114 ++++++++++++++++---------------- engine/sprite_anims.asm | 2 +- engine/start_menu.asm | 6 +- engine/timeofdaypals.asm | 8 +-- engine/wildmons.asm | 8 +-- 45 files changed, 166 insertions(+), 166 deletions(-) (limited to 'engine') diff --git a/engine/card_flip.asm b/engine/card_flip.asm index f1b985012..8203e041e 100755 --- a/engine/card_flip.asm +++ b/engine/card_flip.asm @@ -6,7 +6,7 @@ CARDFLIP_DECK_SIZE EQU 4 * 6 Unknown_e00ed: ; e00ed (38:40ed) ; Graphics for an unused Game Corner ; game were meant to be here. -Ret_e00ed: ; e00ed (38:40ed) +ret_e00ed: ; e00ed (38:40ed) ret _CardFlip: ; e00ee (38:40ee) diff --git a/engine/caught_data.asm b/engine/caught_data.asm index 1f8b8cac4..b5bdb532b 100644 --- a/engine/caught_data.asm +++ b/engine/caught_data.asm @@ -1,4 +1,4 @@ -CheckPartyFullAfterContest: ; 4d9e5 +Special_CheckPartyFullAfterContest: ; 4d9e5 ld a, [wContestMon] and a jp z, .DidntCatchAnything diff --git a/engine/color.asm b/engine/color.asm index 92d14e560..f2bfefac4 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -43,7 +43,7 @@ CheckShininess: and a ret -Unreferenced_CheckContestMon: +UnusedPredef_CheckContestMon: ; Check a mon's DVs at hl in the bug catching contest. ; Return carry if its DVs are good enough to place in the contest. diff --git a/engine/decorations.asm b/engine/decorations.asm index c1b703fb6..38df972c9 100755 --- a/engine/decorations.asm +++ b/engine/decorations.asm @@ -1197,7 +1197,7 @@ DecorationDesc_GiantOrnament: ; 26fdd db "@" ; 0x26feb -ToggleMaptileDecorations: ; 26feb +Special_ToggleMaptileDecorations: ; 26feb lb de, 0, 4 ld a, [Bed] call SetDecorationTile @@ -1251,7 +1251,7 @@ SetDecorationTile: ; 27037 ret ; 27043 -ToggleDecorationsVisibility: ; 27043 +Special_ToggleDecorationsVisibility: ; 27043 ld de, EVENT_KRISS_HOUSE_2F_CONSOLE ld hl, VariableSprites + SPRITE_CONSOLE - SPRITE_VARS ld a, [Console] diff --git a/engine/dummy_game.asm b/engine/dummy_game.asm index 9abffb232..aecaa7425 100755 --- a/engine/dummy_game.asm +++ b/engine/dummy_game.asm @@ -77,7 +77,7 @@ _DummyGame: ; e1e5b (38:5e5b) ret .ResetBoard: - call Ret_e00ed + call ret_e00ed jr nc, .proceed ld hl, wJumptableIndex set 7, [hl] @@ -232,7 +232,7 @@ endr ld hl, wJumptableIndex inc [hl] .AskPlayAgain: - call Ret_e00ed + call ret_e00ed jr nc, .restart ld hl, wJumptableIndex set 7, [hl] diff --git a/engine/events/bug_contest/contest_2.asm b/engine/events/bug_contest/contest_2.asm index 493c69d0c..20766185b 100755 --- a/engine/events/bug_contest/contest_2.asm +++ b/engine/events/bug_contest/contest_2.asm @@ -87,7 +87,7 @@ BugCatchingContestantEventFlagTable: ; 139fe dw EVENT_BUG_CATCHING_CONTESTANT_10A ; 13a12 -ContestDropOffMons: ; 13a12 +Special_ContestDropOffMons: ; 13a12 ld hl, PartyMon1HP ld a, [hli] or [hl] @@ -112,7 +112,7 @@ ContestDropOffMons: ; 13a12 ret ; 13a31 -ContestReturnMons: ; 13a31 +Special_ContestReturnMons: ; 13a31 ; Restore the species of the second mon. ld hl, PartySpecies + 1 ld a, [wBugContestSecondPartySpecies] diff --git a/engine/events/bug_contest/judging.asm b/engine/events/bug_contest/judging.asm index 901ae88fa..8e4b063d6 100755 --- a/engine/events/bug_contest/judging.asm +++ b/engine/events/bug_contest/judging.asm @@ -1,4 +1,4 @@ -_BugContestJudging: ; 1369d +_Special_BugContestJudging: ; 1369d call ContestScore farcall TrainerRankings_BugContestScore call BugContest_JudgeContestants diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm index a1a2e2e79..40a47fe28 100755 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -7,7 +7,7 @@ PlayWhirlpoolSound: ; 8c7d4 ; 8c7e1 BlindingFlash: ; 8c7e1 - farcall FadeOutPalettes + farcall Special_FadeOutPalettes ld hl, wStatusFlags set 2, [hl] ; Flash farcall ReplaceTimeOfDayPals @@ -15,7 +15,7 @@ BlindingFlash: ; 8c7e1 ld b, SCGB_MAPPALS call GetSGBLayout farcall LoadOW_BGPal7 - farcall FadeInPalettes + farcall Special_FadeInPalettes ret ; 8c80a diff --git a/engine/events/halloffame.asm b/engine/events/halloffame.asm index f1981c2fd..1f818b471 100755 --- a/engine/events/halloffame.asm +++ b/engine/events/halloffame.asm @@ -42,7 +42,7 @@ RedCredits:: ; 86455 ld [MusicFadeID + 1], a ld a, 10 ld [MusicFade], a - farcall FadeOutPalettes + farcall Special_FadeOutPalettes xor a ld [VramState], a ld [hMapAnims], a @@ -65,7 +65,7 @@ HallOfFame_FadeOutMusic: ; 8648e ld [MusicFadeID + 1], a ld a, 10 ld [MusicFade], a - farcall FadeOutPalettes + farcall Special_FadeOutPalettes xor a ld [VramState], a ld [hMapAnims], a diff --git a/engine/events/happiness_egg.asm b/engine/events/happiness_egg.asm index a4ae8b7e6..2b6971ca8 100755 --- a/engine/events/happiness_egg.asm +++ b/engine/events/happiness_egg.asm @@ -1,4 +1,4 @@ -GetFirstPokemonHappiness: ; 718d +Special_GetFirstPokemonHappiness: ; 718d ld hl, PartyMon1Happiness ld bc, PARTYMON_STRUCT_LENGTH ld de, PartySpecies @@ -17,7 +17,7 @@ GetFirstPokemonHappiness: ; 718d call GetPokemonName jp CopyPokemonName_Buffer1_Buffer3 -CheckFirstMonIsEgg: ; 71ac +Special_CheckFirstMonIsEgg: ; 71ac ld a, [PartySpecies] ld [wd265], a cp EGG diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm index 493330e58..d967b1ecf 100755 --- a/engine/events/heal_machine_anim.asm +++ b/engine/events/heal_machine_anim.asm @@ -1,4 +1,4 @@ -HealMachineAnim: ; 12324 +Special_HealMachineAnim: ; 12324 ; If you have no Pokemon, don't change the buffer. This can lead to some glitchy effects if you have no Pokemon. ld a, [PartyCount] and a diff --git a/engine/events/itemfinder.asm b/engine/events/itemfinder.asm index 71aaa5b69..19e40ea4b 100755 --- a/engine/events/itemfinder.asm +++ b/engine/events/itemfinder.asm @@ -30,7 +30,7 @@ ItemFinder: ; 12580 .Script_FoundSomething: ; 0x125ad reloadmappart - special UpdateTimePals + special Special_UpdateTimePals callasm .ItemfinderSound writetext .Text_FoundSomething closetext @@ -39,7 +39,7 @@ ItemFinder: ; 12580 .Script_FoundNothing: ; 0x125ba reloadmappart - special UpdateTimePals + special Special_UpdateTimePals writetext .Text_FoundNothing closetext end diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm index c85642ab8..b250741d0 100755 --- a/engine/events/magnet_train.asm +++ b/engine/events/magnet_train.asm @@ -442,7 +442,7 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae ld [wEnvironment], a ld b, SCGB_MAPPALS call GetSGBLayout - call UpdateTimePals + call Special_UpdateTimePals ld a, [rBGP] ld [wBGP], a ld a, [rOBP0] diff --git a/engine/events/misc_scripts.asm b/engine/events/misc_scripts.asm index 97372a57a..73ed89143 100755 --- a/engine/events/misc_scripts.asm +++ b/engine/events/misc_scripts.asm @@ -2,7 +2,7 @@ Script_AbortBugContest: ; 0x122c1 checkflag ENGINE_BUG_CONTEST_TIMER iffalse .finish setflag ENGINE_DAILY_BUG_CONTEST - special ContestReturnMons + special Special_ContestReturnMons .finish end diff --git a/engine/events/move_deleter.asm b/engine/events/move_deleter.asm index 95fc0f1d8..3e06113ae 100644 --- a/engine/events/move_deleter.asm +++ b/engine/events/move_deleter.asm @@ -1,4 +1,4 @@ -MoveDeletion: +Special_MoveDeletion: ld hl, .IntroText call PrintText call YesNoBox diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm index 4583733ee..35554cef3 100755 --- a/engine/events/overworld.asm +++ b/engine/events/overworld.asm @@ -208,7 +208,7 @@ CheckMapForSomethingToCut: ; c7ce Script_CutFromMenu: ; c7fe reloadmappart - special UpdateTimePals + special Special_UpdateTimePals Script_Cut: ; 0xc802 callasm GetPartyNick @@ -318,7 +318,7 @@ UseFlash: ; c8e0 Script_UseFlash: ; 0xc8e6 reloadmappart - special UpdateTimePals + special Special_UpdateTimePals writetext UnknownText_0xc8f3 callasm BlindingFlash closetext @@ -407,7 +407,7 @@ SurfFunction: ; c909 ret SurfFromMenuScript: ; c983 - special UpdateTimePals + special Special_UpdateTimePals UsedSurfScript: ; c986 writetext UsedSurfText ; "used SURF!" @@ -620,10 +620,10 @@ FlyFunction: ; ca3b .FlyScript: ; 0xcaa3 reloadmappart callasm HideSprites - special UpdateTimePals + special Special_UpdateTimePals callasm FlyFromAnim farscall Script_AbortBugContest - special WarpToSpawnPoint + special Special_WarpToSpawnPoint callasm DelayLoadingNewSprites writecode VAR_MOVEMENT, PLAYER_NORMAL newloadmap MAPSETUP_FLY @@ -680,7 +680,7 @@ CheckMapCanWaterfall: ; cb07 Script_WaterfallFromMenu: ; 0xcb1c reloadmappart - special UpdateTimePals + special Special_UpdateTimePals Script_UsedWaterfall: ; 0xcb20 callasm GetPartyNick @@ -856,13 +856,13 @@ dig_incave .UsedEscapeRopeScript: ; 0xcc2b reloadmappart - special UpdateTimePals + special Special_UpdateTimePals writetext .Text_UsedEscapeRope jump .UsedDigOrEscapeRopeScript .UsedDigScript: ; 0xcc35 reloadmappart - special UpdateTimePals + special Special_UpdateTimePals writetext .Text_UsedDig .UsedDigOrEscapeRopeScript: ; 0xcc3c @@ -871,7 +871,7 @@ dig_incave playsound SFX_WARP_TO applymovement PLAYER, .DigOut farscall Script_AbortBugContest - special WarpToSpawnPoint + special Special_WarpToSpawnPoint writecode VAR_MOVEMENT, PLAYER_NORMAL newloadmap MAPSETUP_DOOR playsound SFX_WARP_FROM @@ -950,7 +950,7 @@ TeleportFunction: ; cc61 .TeleportScript: ; 0xccbb reloadmappart - special UpdateTimePals + special Special_UpdateTimePals writetext .Text_ReturnToLastMonCenter pause 60 reloadmappart @@ -958,7 +958,7 @@ TeleportFunction: ; cc61 playsound SFX_WARP_TO applymovement PLAYER, .TeleportFrom farscall Script_AbortBugContest - special WarpToSpawnPoint + special Special_WarpToSpawnPoint writecode VAR_MOVEMENT, PLAYER_NORMAL newloadmap MAPSETUP_TELEPORT playsound SFX_WARP_FROM @@ -1021,7 +1021,7 @@ SetStrengthFlag: ; cd12 Script_StrengthFromMenu: ; 0xcd29 reloadmappart - special UpdateTimePals + special Special_UpdateTimePals Script_UsedStrength: ; 0xcd2d callasm SetStrengthFlag @@ -1183,7 +1183,7 @@ TryWhirlpoolMenu: ; cdde Script_WhirlpoolFromMenu: ; 0xce0b reloadmappart - special UpdateTimePals + special Special_UpdateTimePals Script_UsedWhirlpool: ; 0xce0f callasm GetPartyNick @@ -1284,7 +1284,7 @@ UnknownText_0xcea2: ; 0xcea2 HeadbuttFromMenuScript: ; 0xcea7 reloadmappart - special UpdateTimePals + special Special_UpdateTimePals HeadbuttScript: ; 0xceab callasm GetPartyNick @@ -1382,7 +1382,7 @@ GetFacingObject: ; cf0d RockSmashFromMenuScript: ; 0xcf2e reloadmappart - special UpdateTimePals + special Special_UpdateTimePals RockSmashScript: ; cf32 callasm GetPartyNick @@ -1611,7 +1611,7 @@ Fishing_CheckFacingUp: ; d06c Script_FishCastRod: ; 0xd07c reloadmappart loadvar hBGMapMode, $0 - special UpdateTimePals + special Special_UpdateTimePals loademote EMOTE_ROD callasm LoadFishingGFX loademote EMOTE_SHOCK @@ -1735,7 +1735,7 @@ BikeFunction: ; d0b3 Script_GetOnBike: ; 0xd13e reloadmappart - special UpdateTimePals + special Special_UpdateTimePals writecode VAR_MOVEMENT, PLAYER_BIKE writetext GotOnTheBikeText waitbutton @@ -1755,7 +1755,7 @@ Script_GetOnBike_Register: ; 0xd14e Script_GetOffBike: ; 0xd158 reloadmappart - special UpdateTimePals + special Special_UpdateTimePals writecode VAR_MOVEMENT, PLAYER_NORMAL writetext GotOffTheBikeText waitbutton diff --git a/engine/events/poisonstep_pals.asm b/engine/events/poisonstep_pals.asm index 498ae8f18..8eb8734f6 100644 --- a/engine/events/poisonstep_pals.asm +++ b/engine/events/poisonstep_pals.asm @@ -20,7 +20,7 @@ LoadPoisonBGPals: ; cbcdd call DmgToCgbBGPals ld c, 4 call DelayFrames - farcall _UpdateTimePals + farcall _Special_UpdateTimePals ret .cgb @@ -44,5 +44,5 @@ LoadPoisonBGPals: ; cbcdd ld [hCGBPalUpdate], a ld c, 4 call DelayFrames - farcall _UpdateTimePals + farcall _Special_UpdateTimePals ret diff --git a/engine/events/pokecenter_pc.asm b/engine/events/pokecenter_pc.asm index 7045dc1c8..fcc35dd28 100755 --- a/engine/events/pokecenter_pc.asm +++ b/engine/events/pokecenter_pc.asm @@ -1,4 +1,4 @@ -PokemonCenterPC: ; 1559a +Special_PokemonCenterPC: ; 1559a call PC_CheckPartyForPokemon ret c call PC_PlayBootSound @@ -216,7 +216,7 @@ Function15715: ; 15715 ld hl, KrissPCMenuData call LoadMenuDataHeader .asm_15722 - call UpdateTimePals + call Special_UpdateTimePals call DoNthMenu jr c, .asm_15731 call MenuJumptable diff --git a/engine/events/print_photo.asm b/engine/events/print_photo.asm index 06b01bbcf..54aa1892d 100755 --- a/engine/events/print_photo.asm +++ b/engine/events/print_photo.asm @@ -1,4 +1,4 @@ -PhotoStudio: ; 16dc7 +Special_PhotoStudio: ; 16dc7 ld hl, .Text_AskWhichMon call PrintText farcall SelectMonFromParty diff --git a/engine/events/prof_oaks_pc.asm b/engine/events/prof_oaks_pc.asm index 69949940b..ae84a43a5 100755 --- a/engine/events/prof_oaks_pc.asm +++ b/engine/events/prof_oaks_pc.asm @@ -3,7 +3,7 @@ ProfOaksPC: ; 0x265d3 call MenuTextBox call YesNoBox jr c, .shutdown - call ProfOaksPCBoot ; player chose "yes"? + call Special_ProfOaksPCBoot ; player chose "yes"? .shutdown ld hl, OakPCText4 call PrintText @@ -11,7 +11,7 @@ ProfOaksPC: ; 0x265d3 call ExitMenu ret -ProfOaksPCBoot ; 0x265ee +Special_ProfOaksPCBoot ; 0x265ee ld hl, OakPCText2 call PrintText call Rate diff --git a/engine/events/sacred_ash.asm b/engine/events/sacred_ash.asm index cc46eac9f..65ed83438 100755 --- a/engine/events/sacred_ash.asm +++ b/engine/events/sacred_ash.asm @@ -52,12 +52,12 @@ SacredAshScript: ; 0x50821 special HealParty reloadmappart playsound SFX_WARP_TO - special FadeOutPalettes - special FadeInPalettes - special FadeOutPalettes - special FadeInPalettes - special FadeOutPalettes - special FadeInPalettes + special Special_FadeOutPalettes + special Special_FadeInPalettes + special Special_FadeOutPalettes + special Special_FadeInPalettes + special Special_FadeOutPalettes + special Special_FadeInPalettes waitsfx writetext UnknownText_0x50845 playsound SFX_CAUGHT_MON diff --git a/engine/events/special.asm b/engine/events/special.asm index f1cd3f4e0..d2f9673c2 100755 --- a/engine/events/special.asm +++ b/engine/events/special.asm @@ -1,4 +1,4 @@ -SpecialGiveShuckle: ; 7305 +Special_GiveShuckle: ; 7305 ; Adding to the party. xor a @@ -70,7 +70,7 @@ SpecialShuckleOT: SpecialShuckleNick: db "SHUCKIE@" -SpecialReturnShuckle: ; 737e +Special_ReturnShuckle: ; 737e farcall SelectMonFromParty jr c, .refused diff --git a/engine/events/squirtbottle.asm b/engine/events/squirtbottle.asm index 1134f1bb0..4926f30c1 100755 --- a/engine/events/squirtbottle.asm +++ b/engine/events/squirtbottle.asm @@ -7,7 +7,7 @@ _Squirtbottle: ; 50730 .SquirtbottleScript: reloadmappart - special UpdateTimePals + special Special_UpdateTimePals callasm .CheckCanUseSquirtbottle iffalse .NothingHappenedScript farjump WateredWeirdTreeScript diff --git a/engine/events/std_scripts.asm b/engine/events/std_scripts.asm index 297725c60..660001560 100644 --- a/engine/events/std_scripts.asm +++ b/engine/events/std_scripts.asm @@ -113,7 +113,7 @@ PokecenterNurseScript: special HealParty playmusic MUSIC_NONE writebyte 0 ; Machine is at a Pokemon Center - special HealMachineAnim + special Special_HealMachineAnim pause 30 special RestartMapMusic spriteface LAST_TALKED, DOWN @@ -123,7 +123,7 @@ PokecenterNurseScript: iftrue .no checkflag ENGINE_POKERUS ; nurse already talked about pokerus iftrue .no - special SpecialCheckPokerus + special Special_CheckPokerus iftrue .pokerus .no @@ -203,7 +203,7 @@ HomepageScript: Radio1Script: opentext writebyte MAPRADIO_POKEMON_CHANNEL - special MapRadio + special Special_MapRadio closetext end @@ -211,7 +211,7 @@ Radio2Script: ; Lucky Channel opentext writebyte MAPRADIO_LUCKY_CHANNEL - special MapRadio + special Special_MapRadio closetext end @@ -220,7 +220,7 @@ TrashCanScript: ; 0xbc1a5 PCScript: opentext - special PokemonCenterPC + special Special_PokemonCenterPC closetext end @@ -319,7 +319,7 @@ BugContestResultsScript: opentext farwritetext ContestResults_ReadyToJudgeText waitbutton - special BugContestJudging + special Special_BugContestJudging RAM2MEM $0 if_equal 1, BugContestResults_FirstPlace if_equal 2, BugContestResults_SecondPlace @@ -345,9 +345,9 @@ BugContestResults_FinishUp iffalse BugContestResults_DidNotLeaveMons farwritetext ContestResults_ReturnPartyText waitbutton - special ContestReturnMons + special Special_ContestReturnMons BugContestResults_DidNotLeaveMons - special CheckPartyFullAfterContest + special Special_CheckPartyFullAfterContest if_equal $0, BugContestResults_CleanUp if_equal $2, BugContestResults_CleanUp farwritetext ContestResults_PartyFullText @@ -620,7 +620,7 @@ InitializeEventsScript: return AskNumber1MScript: - special RandomPhoneMon + special Special_RandomPhoneMon checkcode VAR_CALLERID if_equal PHONE_SCHOOLBOY_JACK, .Jack if_equal PHONE_SAILOR_HUEY, .Huey @@ -705,7 +705,7 @@ AskNumber1MScript: end AskNumber2MScript: - special RandomPhoneMon + special Special_RandomPhoneMon checkcode VAR_CALLERID if_equal PHONE_SCHOOLBOY_JACK, .Jack if_equal PHONE_SAILOR_HUEY, .Huey @@ -1886,7 +1886,7 @@ CoinVendor_IntroScript: ; 0xbcde0 HappinessCheckScript: faceplayer opentext - special GetFirstPokemonHappiness + special Special_GetFirstPokemonHappiness if_less_than 50, .Unhappy if_less_than 150, .KindaHappy farwritetext HappinessText3 diff --git a/engine/events/sweet_scent.asm b/engine/events/sweet_scent.asm index 9b75eb9b8..e4bc2197c 100755 --- a/engine/events/sweet_scent.asm +++ b/engine/events/sweet_scent.asm @@ -8,7 +8,7 @@ SweetScentFromMenu: ; 506bc .SweetScent: ; 0x506c8 reloadmappart - special UpdateTimePals + special Special_UpdateTimePals callasm GetPartyNick writetext UnknownText_0x50726 waitbutton diff --git a/engine/events/whiteout.asm b/engine/events/whiteout.asm index a9d6f900e..1ad5c9c65 100755 --- a/engine/events/whiteout.asm +++ b/engine/events/whiteout.asm @@ -10,7 +10,7 @@ Script_OverworldWhiteout:: ; 0x124c8 Script_Whiteout: ; 0x124ce writetext .WhitedOutText waitbutton - special FadeOutPalettes + special Special_FadeOutPalettes pause 40 special HealParty checkflag ENGINE_BUG_CONTEST_TIMER @@ -18,7 +18,7 @@ Script_Whiteout: ; 0x124ce callasm HalveMoney callasm GetWhiteoutSpawn farscall Script_AbortBugContest - special WarpToSpawnPoint + special Special_WarpToSpawnPoint newloadmap MAPSETUP_WARP end_all diff --git a/engine/events_2.asm b/engine/events_2.asm index cac736bab..aaf6995b2 100644 --- a/engine/events_2.asm +++ b/engine/events_2.asm @@ -1,7 +1,7 @@ ; More overworld event handling. -WarpToSpawnPoint:: ; 97c28 +Special_WarpToSpawnPoint:: ; 97c28 ld hl, wStatusFlags2 res 1, [hl] ; safari zone? res 2, [hl] ; bug contest diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index d51e32a54..a3efd8afe 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -1048,7 +1048,7 @@ StartTitleScreen: ; 6219 ld [hWY], a ld b, SCGB_DIPLOMA call GetSGBLayout - call UpdateTimePals + call Special_UpdateTimePals ld a, [wIntroSceneFrameCounter] cp $5 jr c, .ok diff --git a/engine/link.asm b/engine/link.asm index 5ea609496..de914c492 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -2143,7 +2143,7 @@ Special_EnterTimeCapsule: ; 29c7b ret ; 29c92 -WaitForOtherPlayerToExit: ; 29c92 +Special_WaitForOtherPlayerToExit: ; 29c92 ld c, 3 call DelayFrames ld a, -1 diff --git a/engine/map_setup.asm b/engine/map_setup.asm index a4d9d1636..a62ee6c91 100644 --- a/engine/map_setup.asm +++ b/engine/map_setup.asm @@ -91,8 +91,8 @@ MapSetupCommands: ; 15440 dba LoadMapAttributes ; 1a dba LoadMapAttributes_SkipPeople ; 1b dba ClearBGPalettes ; 1c - dba FadeOutPalettes ; 1d - dba FadeInPalettes ; 1e + dba Special_FadeOutPalettes ; 1d + dba Special_FadeInPalettes ; 1e dba GetCoordOfUpperLeftCorner ; 1f dba RestoreFacingAfterWarp ; 20 dba SpawnInFacingDown ; 21 @@ -233,7 +233,7 @@ FadeOldMapMusic: ; 15567 ; 1556d RetainOldPalettes: ; 1556d - farcall _UpdateTimePals + farcall _Special_UpdateTimePals ret RotatePalettesRightMapAndMusic: ; 15574 diff --git a/engine/mart.asm b/engine/mart.asm index 060aba8e9..dc47ba029 100755 --- a/engine/mart.asm +++ b/engine/mart.asm @@ -443,7 +443,7 @@ GetMartDialogGroup: ; 15ca3 BuyMenuLoop: ; 15cef - farcall PlaceMoneyTopRight + farcall Special_PlaceMoneyTopRight call UpdateSprites ld hl, MenuDataHeader_Buy call CopyMenuDataHeader diff --git a/engine/menu_2.asm b/engine/menu_2.asm index 66c2b169d..54d5452b3 100644 --- a/engine/menu_2.asm +++ b/engine/menu_2.asm @@ -27,7 +27,7 @@ PlaceMenuItemQuantity: ; 0x24ac3 .done ret -PlaceMoneyTopRight: ; 24ae8 +Special_PlaceMoneyTopRight: ; 24ae8 ld hl, MenuDataHeader_0x24b15 call CopyMenuDataHeader jr PlaceMoneyDataHeader diff --git a/engine/mon_stats.asm b/engine/mon_stats.asm index 994f56011..fce5fbcac 100644 --- a/engine/mon_stats.asm +++ b/engine/mon_stats.asm @@ -335,7 +335,7 @@ Unreferenced_Function50cd0: ; 50cd0 jr nz, .loop ret -UnreferencedPredef22: +UnusedPredef22: push hl push hl ld hl, PartyMonNicknames diff --git a/engine/overworld.asm b/engine/overworld.asm index 68b8adaed..78f40e4b1 100755 --- a/engine/overworld.asm +++ b/engine/overworld.asm @@ -23,7 +23,7 @@ Function14146: ; mobile push af res 7, [hl] set 6, [hl] - call MapCallbackSprites_LoadUsedSpritesGFX + call Special_MapCallbackSprites_LoadUsedSpritesGFX pop af ld [wSpriteFlags], a ret @@ -35,7 +35,7 @@ Function14157: ; mobile push af set 7, [hl] res 6, [hl] - call MapCallbackSprites_LoadUsedSpritesGFX + call Special_MapCallbackSprites_LoadUsedSpritesGFX pop af ld [wSpriteFlags], a ret @@ -43,7 +43,7 @@ Function14157: ; mobile RefreshSprites:: ; 14168 call .Refresh - call MapCallbackSprites_LoadUsedSpritesGFX + call Special_MapCallbackSprites_LoadUsedSpritesGFX ret ; 1416f @@ -164,7 +164,7 @@ AddOutdoorSprites: ; 141ee ; 14209 -MapCallbackSprites_LoadUsedSpritesGFX: ; 14209 +Special_MapCallbackSprites_LoadUsedSpritesGFX: ; 14209 ld a, MAPCALLBACK_SPRITES call RunMapCallback call GetUsedSprites diff --git a/engine/phone/generic_calls.asm b/engine/phone/generic_calls.asm index e1b53a950..937fc67c0 100644 --- a/engine/phone/generic_calls.asm +++ b/engine/phone/generic_calls.asm @@ -1240,7 +1240,7 @@ PhoneScript_Generic_Female: end PhoneScript_MonFlavorText: - special RandomPhoneMon + special Special_RandomPhoneMon farscall PhoneScript_Random2 if_equal $0, .TooEnergetic farwritetext UnknownText_0x1b518b diff --git a/engine/phone/phone_callers.asm b/engine/phone/phone_callers.asm index c90448d33..cb333ae8d 100644 --- a/engine/phone/phone_callers.asm +++ b/engine/phone/phone_callers.asm @@ -1,5 +1,5 @@ Phone_GenericCall_Male: - special RandomPhoneMon + special Special_RandomPhoneMon farscall PhoneScript_Random2 if_equal 0, .Bragging farscall PhoneScript_Generic_Male @@ -9,7 +9,7 @@ Phone_GenericCall_Male: farjump Phone_BraggingCall_Male Phone_GenericCall_Female: - special RandomPhoneMon + special Special_RandomPhoneMon farscall PhoneScript_Random2 if_equal 0, .Bragging farscall PhoneScript_Generic_Female @@ -27,7 +27,7 @@ Phone_BraggingCall_Female: farjump Phone_FoundAMon_Female Phone_FoundAMon_Male: - special RandomPhoneWildMon + special Special_RandomPhoneWildMon farscall PhoneScript_Random2 if_equal 0, .GotAway farscall Phone_WhoDefeatedMon_Male @@ -37,7 +37,7 @@ Phone_FoundAMon_Male: farjump Phone_GotAwayCall_Male Phone_FoundAMon_Female: - special RandomPhoneWildMon + special Special_RandomPhoneWildMon farscall PhoneScript_Random2 if_equal 0, .GotAway farscall Phone_WhoDefeatedMon_Female @@ -851,7 +851,7 @@ Phone_CheckIfUnseenRare_Female: farjump PhoneScript_HangupText_Female PhoneScriptRareWildMon: - special RandomUnseenWildMon + special Special_RandomUnseenWildMon end PhoneScript_BugCatchingContest: diff --git a/engine/phone/phone_scripts.asm b/engine/phone/phone_scripts.asm index 62eb4ac87..b691d5a40 100644 --- a/engine/phone/phone_scripts.asm +++ b/engine/phone/phone_scripts.asm @@ -392,7 +392,7 @@ HueyPhoneScript1: iftrue HueyWednesdayNight .NotWednesday: - special RandomPhoneMon + special Special_RandomPhoneMon farjump UnknownScript_0xa0908 .WantsBattle: @@ -629,7 +629,7 @@ JoeyPhoneScript1: iftrue JoeyMondayAfternoon .NotMonday: - special RandomPhoneMon + special Special_RandomPhoneMon farjump UnknownScript_0xa0930 .WantsBattle: @@ -851,7 +851,7 @@ LizPhoneScript1: iftrue LizThursdayAfternoon .NotThursday: - special RandomPhoneMon + special Special_RandomPhoneMon farjump UnknownScript_0xa0948 .WantsBattle: diff --git a/engine/pic_animation.asm b/engine/pic_animation.asm index 65e067298..09c800c60 100644 --- a/engine/pic_animation.asm +++ b/engine/pic_animation.asm @@ -1110,7 +1110,7 @@ PokeAnim_GetSpeciesOrUnown: ; d065c ret ; d0669 -UnreferencedPredef48: ; d0669 Predef 48 +UnusedPredef48: ; d0669 Predef 48 ld a, $1 ld [wBoxAlignment], a diff --git a/engine/predef.asm b/engine/predef.asm index e799e7466..0c8a55d90 100644 --- a/engine/predef.asm +++ b/engine/predef.asm @@ -64,7 +64,7 @@ PredefPointers:: ; 856b add_predef CopyPkmnToTempMon add_predef ListMoves ; $20 add_predef PlaceNonFaintStatus - add_predef UnreferencedPredef22 + add_predef UnusedPredef22 add_predef ListMovePP add_predef GetGender add_predef StatsScreenInit @@ -81,7 +81,7 @@ PredefPointers:: ; 856b add_predef InitSGBBorder ; $30 add_predef LoadSGBLayout add_predef Pokedex_GetArea - add_predef Unreferenced_CheckContestMon + add_predef UnusedPredef_CheckContestMon add_predef DoBattleTransition add_predef DummyPredef35 add_predef DummyPredef36 @@ -102,7 +102,7 @@ PredefPointers:: ; 856b add_predef PlaceStatusString add_predef LoadMonAnimation add_predef AnimateFrontpic - add_predef UnreferencedPredef48 ; $48 + add_predef UnusedPredef48 ; $48 add_predef HOF_AnimateFrontpic dbw $ff, InexplicablyEmptyFunction ; ??? ; 864c diff --git a/engine/routines/playslowcry.asm b/engine/routines/playslowcry.asm index 3cc347a55..636741bcf 100644 --- a/engine/routines/playslowcry.asm +++ b/engine/routines/playslowcry.asm @@ -1,4 +1,4 @@ -PlaySlowCry: ; fb841 +Special_PlaySlowCry: ; fb841 ld a, [ScriptVar] call LoadCryHeader jr c, .done diff --git a/engine/specials.asm b/engine/specials.asm index cd2394b96..b07f8ed5a 100644 --- a/engine/specials.asm +++ b/engine/specials.asm @@ -15,7 +15,7 @@ Special:: ; c01b ; c029 SpecialsPointers:: ; c029 - add_special WarpToSpawnPoint + add_special Special_WarpToSpawnPoint ; Communications add_special Special_SetBitsForLinkTradeRequest @@ -25,7 +25,7 @@ SpecialsPointers:: ; c029 add_special Special_CheckBothSelectedSameRoom add_special Special_FailedLinkToPast add_special Special_CloseLink - add_special WaitForOtherPlayerToExit + add_special Special_WaitForOtherPlayerToExit add_special Special_SetBitsForBattleRequest add_special Special_SetBitsForTimeCapsuleRequest add_special Special_CheckTimeCapsuleCompatibility @@ -39,92 +39,92 @@ SpecialsPointers:: ; c029 add_special Special_UnlockMysteryGift ; Map Events - add_special BugContestJudging - add_special CheckPartyFullAfterContest - add_special ContestDropOffMons - add_special ContestReturnMons + add_special Special_BugContestJudging + add_special Special_CheckPartyFullAfterContest + add_special Special_ContestDropOffMons + add_special Special_ContestReturnMons add_special Special_GiveParkBalls add_special Special_CheckMagikarpLength add_special Special_MagikarpHouseSign - add_special HealParty - add_special PokemonCenterPC + add_special HealParty ; this is both a special and a predef + add_special Special_PokemonCenterPC add_special Special_KrissHousePC add_special Special_DayCareMan add_special Special_DayCareLady add_special Special_DayCareManOutside - add_special MoveDeletion + add_special Special_MoveDeletion add_special Special_BankOfMom add_special Special_MagnetTrain - add_special SpecialNameRival + add_special Special_NameRival add_special Special_SetDayOfWeek add_special Special_TownMap add_special Special_UnownPrinter - add_special MapRadio + add_special Special_MapRadio add_special Special_UnownPuzzle add_special Special_SlotMachine add_special Special_CardFlip add_special Special_DummyNonfunctionalGameCornerGame add_special Special_ClearBGPalettesBufferScreen - add_special FadeOutPalettes + add_special Special_FadeOutPalettes add_special Special_BattleTowerFade add_special Special_FadeBlackQuickly - add_special FadeInPalettes + add_special Special_FadeInPalettes add_special Special_FadeInQuickly add_special Special_ReloadSpritesNoPalettes - add_special ClearBGPalettes - add_special UpdateTimePals - add_special ClearTileMap - add_special UpdateSprites - add_special ReplaceKrisSprite + add_special ClearBGPalettes ; bank 0 + add_special Special_UpdateTimePals + add_special ClearTileMap ; bank 0 + add_special UpdateSprites ; bank 0 + add_special ReplaceKrisSprite ; bank 0 add_special Special_GameCornerPrizeMonCheckDex - add_special SpecialSeenMon - add_special WaitSFX - add_special PlayMapMusic - add_special RestartMapMusic - add_special HealMachineAnim + add_special UnusedSpecial_SeenMon + add_special WaitSFX ; bank 0 + add_special PlayMapMusic ; bank 0 + add_special RestartMapMusic ; bank 0 + add_special Special_HealMachineAnim add_special Special_SurfStartStep add_special Special_FindGreaterThanThatLevel add_special Special_FindAtLeastThatHappy add_special Special_FindThatSpecies add_special Special_FindThatSpeciesYourTrainerID - add_special Special_CheckUnusedTwoDayTimer ; unreferenced + add_special UnusedSpecial_CheckUnusedTwoDayTimer add_special Special_DayCareMon1 add_special Special_DayCareMon2 add_special Special_SelectRandomBugContestContestants add_special Special_ActivateFishingSwarm - add_special ToggleMaptileDecorations - add_special ToggleDecorationsVisibility - add_special SpecialGiveShuckle - add_special SpecialReturnShuckle + add_special Special_ToggleMaptileDecorations + add_special Special_ToggleDecorationsVisibility + add_special Special_GiveShuckle + add_special Special_ReturnShuckle add_special Special_BillsGrandfather - add_special SpecialCheckPokerus + add_special Special_CheckPokerus add_special Special_DisplayCoinCaseBalance add_special Special_DisplayMoneyAndCoinBalance - add_special PlaceMoneyTopRight + add_special Special_PlaceMoneyTopRight add_special Special_CheckForLuckyNumberWinners add_special Special_CheckLuckyNumberShowFlag add_special Special_ResetLuckyNumberShowFlag add_special Special_PrintTodaysLuckyNumber add_special Special_SelectApricornForKurt - add_special SpecialNameRater + add_special Special_NameRater add_special Special_DisplayLinkRecord - add_special GetFirstPokemonHappiness - add_special CheckFirstMonIsEgg - add_special RandomUnseenWildMon - add_special RandomPhoneWildMon - add_special RandomPhoneMon - add_special MapCallbackSprites_LoadUsedSpritesGFX - add_special PlaySlowCry - add_special SpecialSnorlaxAwake + add_special Special_GetFirstPokemonHappiness + add_special Special_CheckFirstMonIsEgg + add_special Special_RandomUnseenWildMon + add_special Special_RandomPhoneWildMon + add_special Special_RandomPhoneMon + add_special Special_MapCallbackSprites_LoadUsedSpritesGFX + add_special Special_PlaySlowCry + add_special Special_SnorlaxAwake add_special Special_YoungerHaircutBrother add_special Special_OlderHaircutBrother add_special Special_DaisyMassage - add_special PlayCurMonCry - add_special ProfOaksPCBoot - add_special SpecialGameboyCheck - add_special SpecialTrainerHouse - add_special PhotoStudio - add_special InitRoamMons + add_special Special_PlayCurMonCry + add_special Special_ProfOaksPCBoot + add_special Special_GameboyCheck + add_special Special_TrainerHouse + add_special Special_PhotoStudio + add_special Special_InitRoamMons add_special Special_FadeOutMusic add_special Diploma add_special PrintDiploma @@ -219,7 +219,7 @@ Special_GameCornerPrizeMonCheckDex: ; c230 ret ; c252 -SpecialSeenMon: ; c252 +UnusedSpecial_SeenMon: ; c252 ld a, [ScriptVar] dec a call SetSeenMon @@ -265,7 +265,7 @@ FoundNone: ; c298 ret ; c29d -SpecialNameRival: ; 0xc29d +Special_NameRival: ; 0xc29d ld b, $2 ; rival ld de, RivalName farcall _NamingScreen @@ -279,7 +279,7 @@ SpecialNameRival: ; 0xc29d DefaultRivalName: ; 0xc2b2 db "SILVER@" -SpecialNameRater: ; c2b9 +Special_NameRater: ; c2b9 farcall NameRater ret ; c2c0 @@ -363,14 +363,14 @@ Special_GetMysteryGiftItem: ; c309 db "@" ; 0xc34a -BugContestJudging: ; c34a - farcall _BugContestJudging +Special_BugContestJudging: ; c34a + farcall _Special_BugContestJudging ld a, b ld [ScriptVar], a ret ; c355 -MapRadio: ; c355 +Special_MapRadio: ; c355 ld a, [ScriptVar] ld e, a farcall PlayRadio @@ -483,7 +483,7 @@ ScriptReturnCarry: ; c3e2 ret ; c3ef -Special_CheckUnusedTwoDayTimer: ; c3ef +UnusedSpecial_CheckUnusedTwoDayTimer: ; c3ef farcall CheckUnusedTwoDayTimer ld a, [wUnusedTwoDayTimer] ld [ScriptVar], a @@ -517,7 +517,7 @@ StoreSwarmMapIndices:: ; c403 ; c419 -SpecialCheckPokerus: ; c419 +Special_CheckPokerus: ; c419 ; Check if a monster in your party has Pokerus farcall CheckPokerus jp ScriptReturnCarry @@ -536,7 +536,7 @@ Special_CheckLuckyNumberShowFlag: ; c434 jp ScriptReturnCarry ; c43d -SpecialSnorlaxAwake: ; 0xc43d +Special_SnorlaxAwake: ; 0xc43d ; Check if the Poké Flute channel is playing, and if the player is standing ; next to Snorlax. @@ -587,13 +587,13 @@ SpecialSnorlaxAwake: ; 0xc43d db -1 -PlayCurMonCry: ; c472 +Special_PlayCurMonCry: ; c472 ld a, [CurPartySpecies] jp PlayCry ; c478 -SpecialGameboyCheck: ; c478 +Special_GameboyCheck: ; c478 ld a, [hCGB] and a jr nz, .cgb @@ -639,7 +639,7 @@ PrintDiploma: ; c4ac ret ; c4b9 -SpecialTrainerHouse: ; 0xc4b9 +Special_TrainerHouse: ; 0xc4b9 ld a, BANK(sMysteryGiftTrainerHouseFlag) call GetSRAMBank ld a, [sMysteryGiftTrainerHouseFlag] diff --git a/engine/sprite_anims.asm b/engine/sprite_anims.asm index e141f5243..9fb78a5d7 100755 --- a/engine/sprite_anims.asm +++ b/engine/sprite_anims.asm @@ -404,7 +404,7 @@ DoAnimFrame: ; 8d24b ret .ForUnusedCursor ; 8d46e (23:546e) - callfar Ret_e00ed + callfar ret_e00ed ret .PokegearArrow ; 8d475 (23:5475) diff --git a/engine/start_menu.asm b/engine/start_menu.asm index 913bf3780..64a740d2a 100755 --- a/engine/start_menu.asm +++ b/engine/start_menu.asm @@ -25,12 +25,12 @@ StartMenu:: ; 125cd call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap farcall LoadFonts_NoOAMUpdate call .DrawBugContestStatus - call UpdateTimePals + call Special_UpdateTimePals jr .Select .Reopen: call UpdateSprites - call UpdateTimePals + call Special_UpdateTimePals call .SetUpMenuItems ld a, [wBattleMenuCursorBuffer] ld [wMenuCursorBuffer], a @@ -78,7 +78,7 @@ StartMenu:: ; 125cd call ExitMenu .ReturnEnd2: call CloseText - call UpdateTimePals + call Special_UpdateTimePals ret .GetInput: diff --git a/engine/timeofdaypals.asm b/engine/timeofdaypals.asm index 393a9e84a..31a55a7d8 100644 --- a/engine/timeofdaypals.asm +++ b/engine/timeofdaypals.asm @@ -98,7 +98,7 @@ _TimeOfDayPals:: ; 8c011 ld [rSVBK], a ; update palettes - call _UpdateTimePals + call _Special_UpdateTimePals call DelayFrame ; successful change @@ -112,14 +112,14 @@ _TimeOfDayPals:: ; 8c011 ; 8c070 -_UpdateTimePals:: ; 8c070 +_Special_UpdateTimePals:: ; 8c070 ld c, $9 ; normal call GetTimePalFade call DmgToCgbTimePals ret ; 8c079 -FadeInPalettes:: ; 8c079 +Special_FadeInPalettes:: ; 8c079 ld c, $12 call GetTimePalFade ld b, $4 @@ -127,7 +127,7 @@ FadeInPalettes:: ; 8c079 ret ; 8c084 -FadeOutPalettes:: ; 8c084 +Special_FadeOutPalettes:: ; 8c084 call FillWhiteBGColor ld c, $9 call GetTimePalFade diff --git a/engine/wildmons.asm b/engine/wildmons.asm index dc62093b8..089b1e330 100755 --- a/engine/wildmons.asm +++ b/engine/wildmons.asm @@ -508,7 +508,7 @@ LookUpWildmonsForMapDE: ; 2a288 ; 2a2a0 -InitRoamMons: ; 2a2a0 +Special_InitRoamMons: ; 2a2a0 ; initialize wRoamMon structs ; species @@ -804,7 +804,7 @@ ValidateTempWildMonSpecies: ; 2a4a0 ; Finds a rare wild Pokemon in the route of the trainer calling, then checks if it's been Seen already. ; The trainer will then tell you about the Pokemon if you haven't seen it. -RandomUnseenWildMon: ; 2a4ab +Special_RandomUnseenWildMon: ; 2a4ab farcall GetCallerLocation ld d, b ld e, c @@ -877,7 +877,7 @@ RandomUnseenWildMon: ; 2a4ab db "@" ; 0x2a51f -RandomPhoneWildMon: ; 2a51f +Special_RandomPhoneWildMon: ; 2a51f farcall GetCallerLocation ld d, b ld e, c @@ -917,7 +917,7 @@ RandomPhoneWildMon: ; 2a51f jp CopyBytes ; 2a567 -RandomPhoneMon: ; 2a567 +Special_RandomPhoneMon: ; 2a567 ; Get a random monster owned by the trainer who's calling. farcall GetCallerLocation ld hl, TrainerGroups -- cgit v1.2.3 From b4a49351c18dcef7f4493670058ad2833206f016 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 2 Jan 2018 17:47:58 +0100 Subject: Finish consistent Special function names --- engine/events/buena.asm | 4 +- engine/events/buena_menu.asm | 2 +- engine/events/celebi.asm | 2 +- engine/events/crystal_unown.asm | 4 +- engine/events/dratini.asm | 2 +- engine/events/poke_seer.asm | 2 +- engine/events/std_scripts.asm | 2 +- engine/map_setup.asm | 2 +- engine/overworld.asm | 2 +- engine/search.asm | 4 +- engine/specials.asm | 112 ++++++++++++++++++++-------------------- engine/warp_connection.asm | 4 +- 12 files changed, 71 insertions(+), 71 deletions(-) (limited to 'engine') diff --git a/engine/events/buena.asm b/engine/events/buena.asm index 1227593eb..65f68aeff 100644 --- a/engine/events/buena.asm +++ b/engine/events/buena.asm @@ -1,4 +1,4 @@ -SpecialBuenasPassword: ; 8af6b +Special_BuenasPassword: ; 8af6b xor a ld [wWhichIndexSet], a ld hl, .MenuDataHeader @@ -64,7 +64,7 @@ SpecialBuenasPassword: ; 8af6b ret ; 8afd4 -SpecialBuenaPrize: ; 8afd4 +Special_BuenaPrize: ; 8afd4 xor a ld [wMenuScrollPosition], a ld a, $1 diff --git a/engine/events/buena_menu.asm b/engine/events/buena_menu.asm index b453da783..cf6fecf72 100644 --- a/engine/events/buena_menu.asm +++ b/engine/events/buena_menu.asm @@ -1,4 +1,4 @@ -AskRememberPassword: ; 4ae12 +Special_AskRememberPassword: ; 4ae12 call .DoMenu ld a, $0 jr c, .okay diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm index 1139ad3d5..45898219a 100755 --- a/engine/events/celebi.asm +++ b/engine/events/celebi.asm @@ -361,7 +361,7 @@ CelebiEvent_SetBattleType: ; 49bf3 ; 49bf9 -CheckCaughtCelebi: ; 49bf9 +Special_CheckCaughtCelebi: ; 49bf9 ld a, [wBattleResult] bit 6, a jr z, .false diff --git a/engine/events/crystal_unown.asm b/engine/events/crystal_unown.asm index 09d44bb9a..514f5f913 100644 --- a/engine/events/crystal_unown.asm +++ b/engine/events/crystal_unown.asm @@ -1,4 +1,4 @@ -SpecialHoOhChamber: ; 0x8addb +Special_HoOhChamber: ; 0x8addb ld hl, PartySpecies ld a, [hl] cp HO_OH ; is Ho-oh the first Pokémon in the party? @@ -11,7 +11,7 @@ SpecialHoOhChamber: ; 0x8addb ret ; 0x8adef -SpecialOmanyteChamber: ; 8adef +Special_OmanyteChamber: ; 8adef call GetSecondaryMapHeaderPointer ld de, EVENT_WALL_OPENED_IN_OMANYTE_CHAMBER ld b, CHECK_FLAG diff --git a/engine/events/dratini.asm b/engine/events/dratini.asm index f110b34ab..83732bef2 100644 --- a/engine/events/dratini.asm +++ b/engine/events/dratini.asm @@ -1,4 +1,4 @@ -SpecialDratini: ; 0x8b170 +Special_Dratini: ; 0x8b170 ; if ScriptVar is 0 or 1, change the moveset of the last Dratini in the party. ; 0: give it a special moveset with Extremespeed. ; 1: give it the normal moveset of a level 15 Dratini. diff --git a/engine/events/poke_seer.asm b/engine/events/poke_seer.asm index d6e335298..fb52d1909 100644 --- a/engine/events/poke_seer.asm +++ b/engine/events/poke_seer.asm @@ -15,7 +15,7 @@ const SEERACTION_CANT_TELL_2 const SEERACTION_LEVEL_ONLY -SpecialPokeSeer: ; 4f0bc +Special_PokeSeer: ; 4f0bc ld a, SEER_INTRO call PrintSeerText call JoyWaitAorB diff --git a/engine/events/std_scripts.asm b/engine/events/std_scripts.asm index 660001560..beb118e5c 100644 --- a/engine/events/std_scripts.asm +++ b/engine/events/std_scripts.asm @@ -107,7 +107,7 @@ PokecenterNurseScript: farwritetext NurseTakePokemonText pause 20 - special TrainerRankings_Healings + special Special_TrainerRankings_Healings spriteface LAST_TALKED, LEFT pause 10 special HealParty diff --git a/engine/map_setup.asm b/engine/map_setup.asm index a62ee6c91..7e935c0ce 100644 --- a/engine/map_setup.asm +++ b/engine/map_setup.asm @@ -79,7 +79,7 @@ MapSetupCommands: ; 15440 dba LoadGraphics ; 0e dba LoadTileset ; 0f dba LoadMapTimeOfDay ; 10 - dba LoadMapPalettes ; 11 + dba Special_LoadMapPalettes ; 11 dba LoadWildMonData ; 12 dba RefreshMapSprites ; 13 dba HandleNewMap ; 14 diff --git a/engine/overworld.asm b/engine/overworld.asm index 78f40e4b1..4b330efb1 100755 --- a/engine/overworld.asm +++ b/engine/overworld.asm @@ -41,7 +41,7 @@ Function14157: ; mobile ret ; 14168 -RefreshSprites:: ; 14168 +Special_RefreshSprites:: ; 14168 call .Refresh call Special_MapCallbackSprites_LoadUsedSpritesGFX ret diff --git a/engine/search.asm b/engine/search.asm index 76be0e159..495d4cc5e 100755 --- a/engine/search.asm +++ b/engine/search.asm @@ -1,4 +1,4 @@ -SpecialBeastsCheck: ; 0x4a6e8 +Special_BeastsCheck: ; 0x4a6e8 ; Check if the player owns all three legendary beasts. ; They must exist in either party or PC, and have the player's OT and ID. ; Return the result in ScriptVar. @@ -29,7 +29,7 @@ SpecialBeastsCheck: ; 0x4a6e8 ret -SpecialMonCheck: ; 0x4a711 +Special_MonCheck: ; 0x4a711 ; Check if the player owns any monsters of the species in ScriptVar. ; Return the result in ScriptVar. diff --git a/engine/specials.asm b/engine/specials.asm index b07f8ed5a..e208c14d4 100644 --- a/engine/specials.asm +++ b/engine/specials.asm @@ -126,73 +126,73 @@ SpecialsPointers:: ; c029 add_special Special_PhotoStudio add_special Special_InitRoamMons add_special Special_FadeOutMusic - add_special Diploma - add_special PrintDiploma + add_special Special_Diploma + add_special Special_PrintDiploma ; Crystal - add_special Function11ac3e - add_special Function11b444 - add_special Function11b5e8 - add_special Function11b7e5 - add_special Function11b879 - add_special Function11b920 - add_special Function11b93b - add_special BattleTowerRoomMenu - add_special Function1700ba - add_special Function170114 - add_special BattleTowerBattle - add_special Function1704e1 - add_special EmptySpecial_17021d - add_special Function_LoadOpponentTrainerAndPokemonsWithOTSprite - add_special Function11ba38 - add_special SpecialCheckForBattleTowerRules + add_special Special_Function11ac3e + add_special Special_Function11b444 + add_special Special_Function11b5e8 + add_special Special_Function11b7e5 + add_special Special_Function11b879 + add_special Special_Function11b920 + add_special Special_Function11b93b + add_special Special_BattleTowerRoomMenu + add_special Special_Function1700ba + add_special Special_Function170114 + add_special Special_BattleTowerBattle + add_special Special_Function1704e1 + add_special DummySpecial17021d + add_special Special_LoadOpponentTrainerAndPokemonWithOTSprite + add_special Special_Function11ba38 + add_special Special_CheckForBattleTowerRules add_special Special_GiveOddEgg - add_special Reset - add_special Function1011f1 - add_special Function101220 - add_special Function101225 - add_special Function101231 + add_special Reset ; bank 0 + add_special Special_Function1011f1 + add_special Special_Function101220 + add_special Special_Function101225 + add_special Special_Function101231 add_special Special_MoveTutor - add_special SpecialOmanyteChamber - add_special Function11c1ab - add_special BattleTowerAction + add_special Special_OmanyteChamber + add_special Special_Function11c1ab + add_special Special_BattleTowerAction add_special Special_DisplayUnownWords add_special Special_Menu_ChallengeExplanationCancel - add_special Function17d2b6 - add_special Function17d2ce - add_special BattleTowerMobileError - add_special AskMobileOrCable - add_special SpecialHoOhChamber - add_special Function102142 + add_special Special_Function17d2b6 + add_special Special_Function17d2ce + add_special Special_BattleTowerMobileError + add_special Special_AskMobileOrCable + add_special Special_HoOhChamber + add_special Special_Function102142 add_special Special_CelebiShrineEvent - add_special CheckCaughtCelebi - add_special SpecialPokeSeer - add_special SpecialBuenasPassword - add_special SpecialBuenaPrize - add_special SpecialDratini + add_special Special_CheckCaughtCelebi + add_special Special_PokeSeer + add_special Special_BuenasPassword + add_special Special_BuenaPrize + add_special Special_Dratini add_special Special_SampleKenjiBreakCountdown - add_special SpecialBeastsCheck - add_special SpecialMonCheck + add_special Special_BeastsCheck + add_special Special_MonCheck add_special Special_SetPlayerPalette - add_special ret_170bd2 - add_special Mobile_SelectThreeMons - add_special Function1037eb - add_special Function10383c - add_special TrainerRankings_Healings - add_special RefreshSprites - add_special Function1037c2 - add_special Mobile_DummyReturnFalse - add_special Function103780 - add_special Function10387b - add_special AskRememberPassword - add_special LoadMapPalettes - add_special FindItemInPCOrBag + add_special DummySpecial170bd2 + add_special Special_Mobile_SelectThreeMons + add_special Special_Function1037eb + add_special Special_Function10383c + add_special Special_TrainerRankings_Healings + add_special Special_RefreshSprites + add_special Special_Function1037c2 + add_special Special_Mobile_DummyReturnFalse + add_special Special_Function103780 + add_special Special_Function10387b + add_special Special_AskRememberPassword + add_special Special_LoadMapPalettes + add_special UnusedSpecial_FindItemInPCOrBag add_special Special_InitialSetDSTFlag add_special Special_InitialClearDSTFlag - add_special SpecialNone + add_special DummySpecialc224 ; c224 -SpecialNone: ; c224 +DummySpecialc224: ; c224 ret ; c225 @@ -625,14 +625,14 @@ Special_FadeOutMusic: ; c48f ret ; c49f -Diploma: ; c49f +Special_Diploma: ; c49f call FadeToMenu farcall _Diploma call ExitAllMenus ret ; c4ac -PrintDiploma: ; c4ac +Special_PrintDiploma: ; c4ac call FadeToMenu farcall _PrintDiploma call ExitAllMenus diff --git a/engine/warp_connection.asm b/engine/warp_connection.asm index a0784caac..3e69bd60b 100755 --- a/engine/warp_connection.asm +++ b/engine/warp_connection.asm @@ -298,12 +298,12 @@ LoadGraphics: ; 1047cf ld [hMapAnims], a xor a ld [hTileAnimFrame], a - farcall RefreshSprites + farcall Special_RefreshSprites call LoadFontsExtra farcall LoadOverworldFont ret -LoadMapPalettes: ; 1047eb +Special_LoadMapPalettes: ; 1047eb ld b, SCGB_MAPPALS jp GetSGBLayout ; 1047f0 -- cgit v1.2.3 From d435bd8911981674b45622c6534ef7e3e7fe55c5 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 2 Jan 2018 11:50:08 -0500 Subject: Reword Magikarp length comments --- engine/battle/core.asm | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'engine') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 08021fc8b..58f42f8b1 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -6376,9 +6376,9 @@ LoadEnemyMon: ; 3e8eb ; but the value is in feet and inches (one byte each). ; The first filter is supposed to make very large Magikarp even rarer, -; by targeting those 1600 mm or larger. +; by targeting those 1600 mm (= 5'3") or larger. ; After the conversion to feet, it is unable to target any, -; as the largest possible Magikarp is 5'3'', which reads as 1283. +; since the largest possible Magikarp is 5'3", and $0503 = 1283 mm. ld a, [TempEnemyMonSpecies] cp MAGIKARP jr nz, .Happiness @@ -6388,42 +6388,43 @@ LoadEnemyMon: ; 3e8eb ld bc, PlayerID callfar CalcMagikarpLength -; No reason to keep going if length > 1536 (i.e. if length / 256 != 6) +; No reason to keep going if length > 1536 mm (i.e. if HIGH(length) > 6) ld a, [wMagikarpLength] - cp HIGH(1536) ; this compares to 6'0'', should be cp 5 + cp HIGH(1536) ; should be "cp 5", since 1536 mm = 5'0", but HIGH(1536) = 6 jr nz, .CheckMagikarpArea ; 5% chance of skipping both size checks call Random cp 5 percent jr c, .CheckMagikarpArea -; Try again if length > 1615 +; Try again if length >= 1616 mm ld a, [wMagikarpLength + 1] - cp LOW(1616) ; this compares to 6'80'', should be cp 3 + cp LOW(1616) ; should be "cp 3", since 1616 mm = 5'3", but LOW(1616) = 80 jr nc, .GenerateDVs ; 20% chance of skipping this check call Random cp 20 percent - 1 jr c, .CheckMagikarpArea -; Try again if length > 1599 +; Try again if length >= 1600 mm ld a, [wMagikarpLength + 1] - cp LOW(1600) ; this compares to 6'64'', should be cp 2 + cp LOW(1600) ; should be "cp 2", since 1600 mm = 5'2", but LOW(1600) = 64 jr nc, .GenerateDVs .CheckMagikarpArea: -; The z checks are supposed to be nz -; Instead, all maps in GROUP_LAKE_OF_RAGE (mahogany area) -; and routes 20 and 44 are treated as Lake of Rage +; The "jr z" checks are supposed to be "jr nz". + +; Instead, all maps in GROUP_LAKE_OF_RAGE (Mahogany area) +; and Routes 20 and 44 are treated as Lake of Rage. ; This also means Lake of Rage Magikarp can be smaller than ones -; caught elsewhere rather than the other way around +; caught elsewhere rather than the other way around. -; Intended behavior enforces a minimum size at Lake of Rage -; The real behavior prevents size flooring in the Lake of Rage area +; Intended behavior enforces a minimum size at Lake of Rage. +; The real behavior prevents a minimum size in the Lake of Rage area. -; Moreover, due to the check not being translated to feet, all Magikarp -; smaller than 4'0'' may be caught by the filter, a lot more than intended +; Moreover, due to the check not being translated to feet+inches, all Magikarp +; smaller than 4'0" may be caught by the filter, a lot more than intended. ld a, [MapGroup] cp GROUP_LAKE_OF_RAGE jr z, .Happiness @@ -6434,9 +6435,9 @@ LoadEnemyMon: ; 3e8eb call Random cp 40 percent - 2 jr c, .Happiness -; Floor at length 1024 +; Try again if length < 1024 mm ld a, [wMagikarpLength] - cp HIGH(1024) ; compares to 4'0'', cp 3 would be closer to intended value + cp HIGH(1024) ; should be "cp 3", since 1024 mm = 3'4", but HIGH(1024) = 4 jr c, .GenerateDVs ; try again ; Finally done with DVs -- cgit v1.2.3 From be2aeedcf0f25409b1ca74155718eb51e0cfb751 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 2 Jan 2018 11:53:06 -0500 Subject: More clarification --- engine/battle/core.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engine') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 58f42f8b1..9c22331a0 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -6388,7 +6388,7 @@ LoadEnemyMon: ; 3e8eb ld bc, PlayerID callfar CalcMagikarpLength -; No reason to keep going if length > 1536 mm (i.e. if HIGH(length) > 6) +; No reason to keep going if length > 1536 mm (i.e. if HIGH(length) > 6 feet) ld a, [wMagikarpLength] cp HIGH(1536) ; should be "cp 5", since 1536 mm = 5'0", but HIGH(1536) = 6 jr nz, .CheckMagikarpArea @@ -6397,7 +6397,7 @@ LoadEnemyMon: ; 3e8eb call Random cp 5 percent jr c, .CheckMagikarpArea -; Try again if length >= 1616 mm +; Try again if length >= 1616 mm (i.e. if LOW(length) >= 3 inches) ld a, [wMagikarpLength + 1] cp LOW(1616) ; should be "cp 3", since 1616 mm = 5'3", but LOW(1616) = 80 jr nc, .GenerateDVs @@ -6406,7 +6406,7 @@ LoadEnemyMon: ; 3e8eb call Random cp 20 percent - 1 jr c, .CheckMagikarpArea -; Try again if length >= 1600 mm +; Try again if length >= 1600 mm (i.e. if LOW(length) >= 2 inches) ld a, [wMagikarpLength + 1] cp LOW(1600) ; should be "cp 2", since 1600 mm = 5'2", but LOW(1600) = 64 jr nc, .GenerateDVs @@ -6435,7 +6435,7 @@ LoadEnemyMon: ; 3e8eb call Random cp 40 percent - 2 jr c, .Happiness -; Try again if length < 1024 mm +; Try again if length < 1024 mm (i.e. if HIGH(length) < 3 feet) ld a, [wMagikarpLength] cp HIGH(1024) ; should be "cp 3", since 1024 mm = 3'4", but HIGH(1024) = 4 jr c, .GenerateDVs ; try again -- cgit v1.2.3 From d7970f749ac23786728926109be430ab732f19e6 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 2 Jan 2018 18:49:25 +0100 Subject: Consistent predef function names --- engine/battle/ai/items.asm | 4 +- engine/battle/ai/move.asm | 2 +- engine/battle/ai/scoring.asm | 2 +- engine/battle/ai/switch.asm | 16 +-- engine/battle/anim_hp_bar.asm | 10 +- engine/battle/battle_transition.asm | 2 +- engine/battle/core.asm | 146 ++++++++++++------------- engine/battle/effect_commands.asm | 42 +++---- engine/battle/effect_commands/attract.asm | 4 +- engine/battle/misc.asm | 2 +- engine/battle/read_trainer_party.asm | 8 +- engine/battle/returntobattle_useball.asm | 4 +- engine/battle/start_battle.asm | 2 +- engine/battle_anims/anim_commands.asm | 20 ++-- engine/billspc.asm | 14 +-- engine/breeding.asm | 26 ++--- engine/color.asm | 2 +- engine/debug.asm | 12 +- engine/events/catch_tutorial.asm | 2 +- engine/events/daycare.asm | 10 +- engine/events/halloffame.asm | 18 +-- engine/events/itemfinder.asm | 4 +- engine/events/magnet_train.asm | 2 +- engine/events/move_tutor.asm | 4 +- engine/events/overworld.asm | 30 ++--- engine/events/poisonstep.asm | 4 +- engine/events/poisonstep_pals.asm | 6 +- engine/events/pokecenter_pc.asm | 6 +- engine/events/pokepic.asm | 4 +- engine/events/print_unown.asm | 6 +- engine/events/special.asm | 2 +- engine/events/squirtbottle.asm | 2 +- engine/events/sweet_scent.asm | 2 +- engine/evolution_animation.asm | 4 +- engine/evolve.asm | 18 +-- engine/health.asm | 4 +- engine/intro_menu.asm | 10 +- engine/item_effects.asm | 30 ++--- engine/learn.asm | 4 +- engine/link.asm | 44 ++++---- engine/link_2.asm | 2 +- engine/link_trade.asm | 2 +- engine/map_setup.asm | 2 +- engine/mart.asm | 4 +- engine/mon_stats.asm | 24 ++-- engine/move_mon.asm | 60 +++++----- engine/mystery_gift.asm | 6 +- engine/namingscreen.asm | 2 +- engine/npctrade.asm | 10 +- engine/party_menu.asm | 8 +- engine/pic_animation.asm | 28 ++--- engine/player_gfx.asm | 6 +- engine/pokedex.asm | 8 +- engine/pokegear.asm | 4 +- engine/predef.asm | 128 +++++++++++----------- engine/print_party.asm | 8 +- engine/printer.asm | 2 +- engine/routines/correcterrorsinplayerparty.asm | 2 +- engine/routines/flagpredef.asm | 2 +- engine/routines/newpokedexentry.asm | 2 +- engine/routines/placegraphic.asm | 2 +- engine/routines/placewaitingtext.asm | 2 +- engine/routines/trademonfrontpic.asm | 6 +- engine/scripting.asm | 4 +- engine/sgb_layouts.asm | 2 +- engine/specials.asm | 6 +- engine/start_menu.asm | 28 ++--- engine/stats_screen.asm | 36 +++--- engine/tempmon.asm | 4 +- engine/time_capsule_2.asm | 2 +- engine/timeofdaypals.asm | 4 +- engine/tmhm.asm | 6 +- engine/tmhm2.asm | 16 +-- engine/trade_animation.asm | 10 +- engine/trainer_card.asm | 2 +- engine/types.asm | 10 +- 76 files changed, 492 insertions(+), 492 deletions(-) (limited to 'engine') diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm index 09595077a..b9f3fa93c 100644 --- a/engine/battle/ai/items.asm +++ b/engine/battle/ai/items.asm @@ -545,7 +545,7 @@ AI_Items: ; 39196 AIUpdateHUD: ; 38387 call UpdateEnemyMonInParty - farcall UpdateEnemyHUD + farcall Predef_UpdateEnemyHUD ld a, $1 ld [hBGMapMode], a ld hl, wEnemyItemState @@ -664,7 +664,7 @@ EnemyPotionFinish: ; 38436 xor a ld [wWhichHPBar], a call AIUsedItemSound - predef AnimateHPBar + predef Predef_AnimateHPBar jp AIUpdateHUD diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm index 11586c0da..d91ac437d 100755 --- a/engine/battle/ai/move.asm +++ b/engine/battle/ai/move.asm @@ -92,7 +92,7 @@ AIChooseMove: ; 440ce push bc ld d, BANK(TrainerClassAttributes) - predef FlagPredef + predef Predef_Flag ld d, c pop bc diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm index 44194d6f7..d7dfdb630 100644 --- a/engine/battle/ai/scoring.asm +++ b/engine/battle/ai/scoring.asm @@ -1488,7 +1488,7 @@ AI_Smart_Encore: ; 38c3b push hl ld a, [wEnemyMoveStruct + MOVE_TYPE] ld hl, EnemyMonType1 - predef CheckTypeMatchup + predef Predef_CheckTypeMatchup pop hl ld a, [wd265] diff --git a/engine/battle/ai/switch.asm b/engine/battle/ai/switch.asm index c2f83fa1f..cb278676e 100755 --- a/engine/battle/ai/switch.asm +++ b/engine/battle/ai/switch.asm @@ -28,7 +28,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e inc hl call GetMoveByte ld hl, EnemyMonType - call CheckTypeMatchup + call Predef_CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 ; 1.0 + 0.1 jr nc, .super_effective @@ -73,7 +73,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e ld a, [BattleMonType1] ld b, a ld hl, EnemyMonType1 - call CheckTypeMatchup + call Predef_CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 ; 1.0 + 0.1 jr c, .ok @@ -82,7 +82,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e ld a, [BattleMonType2] cp b jr z, .ok2 - call CheckTypeMatchup + call Predef_CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 ; 1.0 + 0.1 jr c, .ok2 @@ -123,7 +123,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e inc hl call GetMoveByte ld hl, BattleMonType1 - call CheckTypeMatchup + call Predef_CheckTypeMatchup ld a, [wTypeMatchup] ; immune @@ -390,7 +390,7 @@ FindEnemyMonsImmuneToLastCounterMove: ; 34a2a inc hl call GetMoveByte ld hl, BaseType - call CheckTypeMatchup + call Predef_CheckTypeMatchup ld a, [wTypeMatchup] and a jr nz, .next @@ -481,7 +481,7 @@ FindEnemyMonsWithASuperEffectiveMove: ; 34aa7 inc hl call GetMoveByte ld hl, BattleMonType1 - call CheckTypeMatchup + call Predef_CheckTypeMatchup ; if immune or not very effective: continue ld a, [wTypeMatchup] @@ -585,7 +585,7 @@ FindEnemyMonsThatResistPlayer: ; 34b20 .skip_move ld a, [BattleMonType1] ld hl, BaseType - call CheckTypeMatchup + call Predef_CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 jr nc, .dont_choose_mon @@ -593,7 +593,7 @@ FindEnemyMonsThatResistPlayer: ; 34b20 .check_type ld hl, BaseType - call CheckTypeMatchup + call Predef_CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 jr nc, .dont_choose_mon diff --git a/engine/battle/anim_hp_bar.asm b/engine/battle/anim_hp_bar.asm index 71276d27e..d67a46a70 100755 --- a/engine/battle/anim_hp_bar.asm +++ b/engine/battle/anim_hp_bar.asm @@ -67,7 +67,7 @@ _AnimateHPBar: ; d627 ld a, [hli] ld b, a pop hl - call ComputeHPBarPixels + call Predef_ComputeHPBarPixels ld a, e ld [wCurHPBarPixels], a @@ -79,7 +79,7 @@ _AnimateHPBar: ; d627 ld e, a ld a, [wCurHPAnimMaxHP + 1] ld d, a - call ComputeHPBarPixels + call Predef_ComputeHPBarPixels ld a, e ld [wNewHPBarPixels], a @@ -183,11 +183,11 @@ LongAnim_UpdateVariables: ; d6f5 ld c, a ld a, [hli] ld b, a - ; This routine is buggy. The result from ComputeHPBarPixels is stored + ; This routine is buggy. The result from Predef_ComputeHPBarPixels is stored ; in e. However, the pop de opcode deletes this result before it is even ; used. The game then proceeds as though it never deleted that output. ; To fix, uncomment the line below. - call ComputeHPBarPixels + call Predef_ComputeHPBarPixels ; ld a, e pop bc pop de @@ -227,7 +227,7 @@ LongHPBarAnim_UpdateTiles: ; d749 ld e, a ld a, [wCurHPAnimMaxHP + 1] ld d, a - call ComputeHPBarPixels + call Predef_ComputeHPBarPixels ld c, e ld d, HP_BAR_LENGTH ld a, [wWhichHPBar] diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 2b3f5510e..ba4f9e227 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -1,4 +1,4 @@ -DoBattleTransition: ; 8c20f +Predef_DoBattleTransition: ; 8c20f call .InitGFX ld a, [rBGP] ld [wBGP], a diff --git a/engine/battle/core.asm b/engine/battle/core.asm index c82ae93c5..9b00ba161 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -47,7 +47,7 @@ DoBattle: ; 3c000 .player_2 call LoadTileMapToTempTileMap - call CheckPlayerPartyForFitPkmn + call Predef_CheckPlayerPartyForFitPkmn ld a, d and a jp z, LostBattle @@ -1285,7 +1285,7 @@ HandleWrap: ; 3c874 xor a ld [wNumHits], a ld [FXAnimID + 1], a - predef PlayBattleAnim + predef Predef_PlayBattleAnim call SwitchTurnCore .skip_anim @@ -2047,7 +2047,7 @@ UpdateHPBar: ; 3cd3c .ok push bc ld [wWhichHPBar], a - predef AnimateHPBar + predef Predef_AnimateHPBar pop bc ret ; 3cd55 @@ -2061,7 +2061,7 @@ HandleEnemyMonFaint: ; 3cd55 xor a ld [wWhichMonFaintedFirst], a call UpdateBattleStateAndExperienceAfterEnemyFaint - call CheckPlayerPartyForFitPkmn + call Predef_CheckPlayerPartyForFitPkmn ld a, d and a jp z, LostBattle @@ -2069,7 +2069,7 @@ HandleEnemyMonFaint: ; 3cd55 ld hl, BattleMonHP ld a, [hli] or [hl] - call nz, UpdatePlayerHUD + call nz, Predef_UpdatePlayerHUD ld a, $1 ld [hBGMapMode], a @@ -2193,7 +2193,7 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01 call PlayerMonFaintHappinessMod .player_mon_did_not_faint - call CheckPlayerPartyForFitPkmn + call Predef_CheckPlayerPartyForFitPkmn ld a, d and a ret z @@ -2713,7 +2713,7 @@ HandlePlayerMonFaint: ; 3d14e ld a, $1 ld [wWhichMonFaintedFirst], a call PlayerMonFaintHappinessMod - call CheckPlayerPartyForFitPkmn + call Predef_CheckPlayerPartyForFitPkmn ld a, d and a jp z, LostBattle @@ -2759,7 +2759,7 @@ PlayerMonFaintHappinessMod: ; 3d1aa ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG - predef FlagPredef + predef Predef_Flag ld hl, EnemySubStatus3 res SUBSTATUS_IN_LOOP, [hl] xor a @@ -3356,10 +3356,10 @@ AddBattleParticipant: ; 3d581 ld hl, wBattleParticipantsNotFainted ld b, SET_FLAG push bc - predef FlagPredef + predef Predef_Flag pop bc ld hl, wBattleParticipantsIncludingFainted - predef_jump FlagPredef + predef_jump Predef_Flag ; 3d599 FindPkmnInOTPartyToSwitchIntoBattle: ; 3d599 @@ -3577,7 +3577,7 @@ LoadEnemyPkmnToSwitchTo: ; 3d6ca and a jr nz, .skip_unown ld hl, EnemyMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter ld a, [UnownLetter] ld [wFirstUnownSeen], a .skip_unown @@ -3687,8 +3687,8 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 call GetBaseData ld a, OTPARTYMON ld [MonType], a - predef CopyPkmnToTempMon - call GetEnemyMonFrontpic + predef Predef_CopyPkmnToTempMon + call Predef_GetEnemyMonFrontpic xor a ld [wNumHits], a @@ -3713,7 +3713,7 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 hlcoord 12, 0 ld d, $0 ld e, ANIM_MON_SLOW - predef AnimateFrontpic + predef Predef_AnimateFrontpic jr .skip_cry .cry_no_anim @@ -3723,7 +3723,7 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 call PlayStereoCry .skip_cry - call UpdateEnemyHUD + call Predef_UpdateEnemyHUD ld a, $1 ld [hBGMapMode], a ret @@ -3764,7 +3764,7 @@ ResetEnemyStatLevels: ; 3d867 ret ; 3d873 -CheckPlayerPartyForFitPkmn: ; 3d873 +Predef_CheckPlayerPartyForFitPkmn: ; 3d873 ; Has the player any Pkmn in his Party that can fight? ld a, [PartyCount] ld e, a @@ -4167,7 +4167,7 @@ SwitchPlayerMon: ; 3db32 SendOutPlayerMon: ; 3db5f ld hl, BattleMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter hlcoord 1, 5 ld b, 7 ld c, 8 @@ -4175,7 +4175,7 @@ SendOutPlayerMon: ; 3db5f call WaitBGMap xor a ld [hBGMapMode], a - call GetBattleMonBackpic + call Predef_GetBattleMonBackpic xor a ld [hGraphicStartTile], a ld [wBattleMenuCursorBuffer], a @@ -4215,7 +4215,7 @@ SendOutPlayerMon: ; 3db5f call PlayStereoCry .statused - call UpdatePlayerHUD + call Predef_UpdatePlayerHUD ld a, $1 ld [hBGMapMode], a ret @@ -4261,13 +4261,13 @@ BreakAttraction: ; 3dc18 SpikesDamage: ; 3dc23 ld hl, PlayerScreens ld de, BattleMonType - ld bc, UpdatePlayerHUD + ld bc, Predef_UpdatePlayerHUD ld a, [hBattleTurn] and a jr z, .ok ld hl, EnemyScreens ld de, EnemyMonType - ld bc, UpdateEnemyHUD + ld bc, Predef_UpdateEnemyHUD .ok bit SCREENS_SPIKES, [hl] @@ -4349,7 +4349,7 @@ PursuitSwitch: ; 3dc5b ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG - predef FlagPredef + predef Predef_Flag call PlayerMonFaintedAnimation ld hl, BattleText_PkmnFainted jr .done_fainted @@ -4498,7 +4498,7 @@ HandleHPHealingItem: ; 3dd2f .got_hp_bar_coords ld [wWhichHPBar], a - predef AnimateHPBar + predef Predef_AnimateHPBar UseOpponentItem: call RefreshBattleHuds callfar GetOpponentItem @@ -4521,7 +4521,7 @@ ItemRecoveryAnim: ; 3ddc8 xor a ld [wNumHits], a ld [FXAnimID + 1], a - predef PlayBattleAnim + predef Predef_PlayBattleAnim call SwitchTurnCore pop bc pop de @@ -4751,7 +4751,7 @@ UpdateBattleHUDs: ; 3df2c ret ; 3df48 -UpdatePlayerHUD:: ; 3df48 +Predef_UpdatePlayerHUD:: ; 3df48 push hl push de push bc @@ -4784,7 +4784,7 @@ DrawPlayerHUD: ; 3df58 ld b, 1 xor a ; PARTYMON ld [MonType], a - predef DrawPlayerHP + predef Predef_DrawPlayerHP ; Exp bar push de @@ -4797,7 +4797,7 @@ DrawPlayerHUD: ; 3df58 hlcoord 10, 11 ld a, [TempMonLevel] ld b, a - call FillInExpBar + call Predef_FillInExpBar pop de ret ; 3df98 @@ -4866,7 +4866,7 @@ PrintPlayerHUD: ; 3dfbf ld a, TEMPMON ld [MonType], a - callfar GetGender + callfar Predef_GetGender ld a, " " jr c, .got_gender_char ld a, "♂" @@ -4880,7 +4880,7 @@ PrintPlayerHUD: ; 3dfbf push af ; back up gender push hl ld de, BattleMonStatus - predef PlaceNonFaintStatus + predef Predef_PlaceNonFaintStatus pop hl pop bc ret nz @@ -4895,7 +4895,7 @@ PrintPlayerHUD: ; 3dfbf jp PrintLevel ; 3e036 -UpdateEnemyHUD:: ; 3e036 +Predef_UpdateEnemyHUD:: ; 3e036 push hl push de push bc @@ -4944,7 +4944,7 @@ DrawEnemyHUD: ; 3e043 ld a, TEMPMON ld [MonType], a - callfar GetGender + callfar Predef_GetGender ld a, " " jr c, .got_gender ld a, "♂" @@ -4959,7 +4959,7 @@ DrawEnemyHUD: ; 3e043 push af push hl ld de, EnemyMonStatus - predef PlaceNonFaintStatus + predef Predef_PlaceNonFaintStatus pop hl pop bc jr nz, .skip_level @@ -5184,8 +5184,8 @@ BattleMenu_Pack: ; 3e1c7 call ClearPalettes call DelayFrame call _LoadBattleFontsHPBar - call GetBattleMonBackpic - call GetEnemyMonFrontpic + call Predef_GetBattleMonBackpic + call Predef_GetEnemyMonFrontpic call ExitMenu call WaitBGMap call FinishBattleAnim @@ -5217,10 +5217,10 @@ BattleMenu_Pack: ; 3e1c7 ld a, [BattleType] cp BATTLETYPE_TUTORIAL jr z, .tutorial2 - call GetBattleMonBackpic + call Predef_GetBattleMonBackpic .tutorial2 - call GetEnemyMonFrontpic + call Predef_GetEnemyMonFrontpic ld a, $1 ld [wMenuCursorY], a call ExitMenu @@ -5574,7 +5574,7 @@ MoveSelectionScreen: ; 3e4bc .got_start_coord ld a, SCREEN_WIDTH ld [Buffer1], a - predef ListMoves + predef Predef_ListMoves ld b, 5 ld a, [wMoveSelectionMenuType] @@ -5907,7 +5907,7 @@ MoveInfoBox: ; 3e6c8 ld a, [wPlayerMoveStruct + MOVE_ANIM] ld b, a hlcoord 2, 10 - predef PrintMoveType + predef Predef_PrintMoveType .done ret @@ -6363,7 +6363,7 @@ LoadEnemyMon: ; 3e8eb ; Get letter based on DVs ld hl, EnemyMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter ; Can't use any letters that haven't been unlocked ; If combined with forced shiny battletype, causes an infinite loop call CheckUnownLetter @@ -6451,7 +6451,7 @@ LoadEnemyMon: ; 3e8eb ld de, EnemyMonMaxHP ld b, FALSE ld hl, EnemyMonDVs - (MON_DVS - MON_STAT_EXP + 1) ; LinkBattleRNs + 7 ; ? - predef CalcPkmnStats + predef Predef_CalcPkmnStats ; If we're in a trainer battle, ; get the rest of the parameters from the party struct @@ -6566,7 +6566,7 @@ LoadEnemyMon: ; 3e8eb ; Make sure the predef knows this isn't a partymon ld [wEvolutionOldSpecies], a ; Fill moves based on level - predef FillMoves + predef Predef_FillMoves .PP: ; Trainer battle? @@ -6577,7 +6577,7 @@ LoadEnemyMon: ; 3e8eb ; Fill wild PP ld hl, EnemyMonMoves ld de, EnemyMonPP - predef FillPP + predef Predef_FillPP jr .Finish .TrainerPP: @@ -6630,7 +6630,7 @@ LoadEnemyMon: ; 3e8eb ld c, a ld b, SET_FLAG ld hl, PokedexSeen - predef FlagPredef + predef Predef_Flag ld hl, EnemyMonStats ld de, EnemyStats @@ -6787,7 +6787,7 @@ BattleWinSlideInEnemyTrainerFrontpic: ; 3ebd8 ld a, [OtherTrainerClass] ld [TrainerClass], a ld de, vTiles2 - callfar GetTrainerPic + callfar Predef_GetTrainerPic hlcoord 19, 0 ld c, 0 @@ -7264,7 +7264,7 @@ Call_PlayBattleAnim: ; 3ee17 ld a, d ld [FXAnimID + 1], a call WaitBGMap - predef_jump PlayBattleAnim + predef_jump Predef_PlayBattleAnim ; 3ee27 FinishBattleAnim: ; 3ee27 @@ -7312,7 +7312,7 @@ GiveExperiencePoints: ; 3ee3b ld c, a ld b, CHECK_FLAG ld d, $0 - predef FlagPredef + predef Predef_Flag ld a, c and a pop bc @@ -7490,7 +7490,7 @@ GiveExperiencePoints: ; 3ee3b .not_max_exp xor a ; PARTYMON ld [MonType], a - predef CopyPkmnToTempMon + predef Predef_CopyPkmnToTempMon callfar CalcLevel pop bc ld hl, MON_LEVEL @@ -7527,7 +7527,7 @@ GiveExperiencePoints: ; 3ee3b add hl, bc push bc ld b, TRUE - predef CalcPkmnStats + predef Predef_CalcPkmnStats pop bc pop de ld hl, MON_MAXHP + 1 @@ -7580,7 +7580,7 @@ GiveExperiencePoints: ; 3ee3b call ApplyStatLevelMultiplierOnAllStats callfar ApplyStatusEffectOnPlayerStats callfar BadgeStatBoosts - callfar UpdatePlayerHUD + callfar Predef_UpdatePlayerHUD call EmptyBattleTextBox call LoadTileMapToTempTileMap ld a, $1 @@ -7603,14 +7603,14 @@ GiveExperiencePoints: ; 3ee3b .skip_animation2 xor a ; PARTYMON ld [MonType], a - predef CopyPkmnToTempMon + predef Predef_CopyPkmnToTempMon hlcoord 9, 0 ld b, $a ld c, $9 call TextBox hlcoord 11, 1 ld bc, 4 - predef PrintTempMonStats + predef Predef_PrintTempMonStats ld c, $1e call DelayFrames call WaitPressAorB_BlinkCursor @@ -7630,7 +7630,7 @@ GiveExperiencePoints: ; 3ee3b ld a, b ld [CurPartyLevel], a push bc - predef LearnLevelMoves + predef Predef_LearnLevelMoves pop bc ld a, b cp c @@ -7641,7 +7641,7 @@ GiveExperiencePoints: ; 3ee3b ld a, [CurPartyMon] ld c, a ld b, SET_FLAG - predef FlagPredef + predef Predef_Flag pop af ld [CurPartyLevel], a @@ -7763,7 +7763,7 @@ AnimateExpBar: ; 3f136 ld [wd002], a xor a ; PARTYMON ld [MonType], a - predef CopyPkmnToTempMon + predef Predef_CopyPkmnToTempMon ld a, [TempMonLevel] ld b, a ld e, a @@ -8134,7 +8134,7 @@ Unreferenced_HandleSafariAngerEatingStatus: jp StdBattleTextBox ; 3f390 -FillInExpBar: ; 3f390 +Predef_FillInExpBar: ; 3f390 push hl call CalcExpBar pop hl @@ -8276,7 +8276,7 @@ PlaceExpBar: ; 3f41c ret ; 3f43d -GetBattleMonBackpic: ; 3f43d +Predef_GetBattleMonBackpic: ; 3f43d ld a, [PlayerSubStatus4] bit SUBSTATUS_SUBSTITUTE, a ld hl, BattleAnimCmd_RaiseSub @@ -8292,9 +8292,9 @@ DropPlayerSub: ; 3f447 ld a, [BattleMonSpecies] ld [CurPartySpecies], a ld hl, BattleMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter ld de, vTiles2 tile $31 - predef GetMonBackpic + predef Predef_GetMonBackpic pop af ld [CurPartySpecies], a ret @@ -8312,7 +8312,7 @@ GetBattleMonBackpic_DoAnim: ; 3f46f ret ; 3f47c -GetEnemyMonFrontpic: ; 3f47c +Predef_GetEnemyMonFrontpic: ; 3f47c ld a, [EnemySubStatus4] bit SUBSTATUS_SUBSTITUTE, a ld hl, BattleAnimCmd_RaiseSub @@ -8331,9 +8331,9 @@ DropEnemySub: ; 3f486 ld [CurPartySpecies], a call GetBaseData ld hl, EnemyMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter ld de, vTiles2 - predef GetAnimatedFrontpicPredef + predef Predef_GetAnimatedFrontpic pop af ld [CurPartySpecies], a ret @@ -8350,7 +8350,7 @@ GetEnemyMonFrontpic_DoAnim: ; 3f4b4 ret ; 3f4c1 -StartBattle: ; 3f4c1 +Predef_StartBattle: ; 3f4c1 ; This check prevents you from entering a battle without any Pokemon. ; Those using walk-through-walls to bypass getting a Pokemon experience ; the effects of this check. @@ -8409,7 +8409,7 @@ BattleIntro: ; 3f4dd call ClearSprites ld a, [wBattleMode] cp WILD_BATTLE - call z, UpdateEnemyHUD + call z, Predef_UpdateEnemyHUD ld a, $1 ld [hBGMapMode], a ret @@ -8474,14 +8474,14 @@ InitEnemyTrainer: ; 3f594 .ok ld de, vTiles2 - callfar GetTrainerPic + callfar Predef_GetTrainerPic xor a ld [hGraphicStartTile], a dec a ld [wEnemyItemState], a hlcoord 12, 0 lb bc, 7, 7 - predef PlaceGraphic + predef Predef_PlaceGraphic ld a, -1 ld [CurOTMon], a ld a, TRAINER_BATTLE @@ -8527,7 +8527,7 @@ InitEnemyWildmon: ; 3f607 ld bc, NUM_MOVES call CopyBytes ld hl, EnemyMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter ld a, [CurPartySpecies] cp UNOWN jr nz, .skip_unown @@ -8538,13 +8538,13 @@ InitEnemyWildmon: ; 3f607 ld [wFirstUnownSeen], a .skip_unown ld de, vTiles2 - predef GetAnimatedFrontpicPredef + predef Predef_GetAnimatedFrontpic xor a ld [TrainerClass], a ld [hGraphicStartTile], a hlcoord 12, 0 lb bc, 7, 7 - predef PlaceGraphic + predef Predef_PlaceGraphic ret ; 3f662 @@ -8623,7 +8623,7 @@ ExitBattle: ; 3f69e call CheckPayDay xor a ld [wForceEvolution], a - predef EvolveAfterBattle + predef Predef_EvolveAfterBattle farcall GivePokerusAndConvertBerries ret ; 3f6d0 @@ -9297,7 +9297,7 @@ InitBattleDisplay: ; 3fb6c ld [hGraphicStartTile], a hlcoord 2, 6 lb bc, 6, 6 - predef PlaceGraphic + predef Predef_PlaceGraphic xor a ld [hWY], a ld [rWY], a @@ -9370,7 +9370,7 @@ GetTrainerBackpic: ; 3fbff .Decompress: ld de, vTiles2 tile $31 ld c, $31 - predef DecompressPredef + predef Predef_Decompress ret ; 3fc30 @@ -9392,7 +9392,7 @@ CopyBackpic: ; 3fc30 ld [hGraphicStartTile], a hlcoord 2, 6 lb bc, 6, 6 - predef PlaceGraphic + predef Predef_PlaceGraphic ret ; 3fc5b @@ -9472,7 +9472,7 @@ BattleStartMessage: ; 3fc8b hlcoord 12, 0 ld d, $0 ld e, ANIM_MON_NORMAL - predef AnimateFrontpic + predef Predef_AnimateFrontpic jr .skip_cry ; cry is played during the animation .cry_no_anim diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index f86f90479..d0a126b98 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -182,7 +182,7 @@ CheckPlayerTurn: call StdBattleTextBox call CantMove call UpdateBattleMonInParty - ld hl, UpdatePlayerHUD + ld hl, Predef_UpdatePlayerHUD call CallBattleCore ld a, $1 ld [hBGMapMode], a @@ -433,7 +433,7 @@ CheckEnemyTurn: ; 3421f call StdBattleTextBox call CantMove call UpdateEnemyMonInParty - ld hl, UpdateEnemyHUD + ld hl, Predef_UpdateEnemyHUD call CallBattleCore ld a, $1 ld [hBGMapMode], a @@ -670,7 +670,7 @@ HitConfusion: ; 343a5 and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND call z, PlayFXAnimID - ld hl, UpdatePlayerHUD + ld hl, Predef_UpdatePlayerHUD call CallBattleCore ld a, $1 ld [hBGMapMode], a @@ -1539,12 +1539,12 @@ BattleCheckTypeMatchup: ; 347c8 ld hl, EnemyMonType1 ld a, [hBattleTurn] and a - jr z, CheckTypeMatchup + jr z, Predef_CheckTypeMatchup ld hl, BattleMonType1 -CheckTypeMatchup: ; 347d3 +Predef_CheckTypeMatchup: ; 347d3 ; There is an incorrect assumption about this function made in the AI related code: when -; the AI calls CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing the -; offensive type in a will make this function do the right thing. Since a is overwritten, +; the AI calls Predef_CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing +; the offensive type in a will make this function do the right thing. Since a is overwritten, ; this assumption is incorrect. A simple fix would be to load the move type for the ; current move into a in BattleCheckTypeMatchup, before falling through, which is ; consistent with how the rest of the code assumes this code works like. @@ -2636,7 +2636,7 @@ BattleCommand_CheckDestinyBond: ; 351c0 ld [Buffer6], a ld h, b ld l, c - predef AnimateHPBar + predef Predef_AnimateHPBar call RefreshBattleHuds call BattleCommand_SwitchTurn @@ -4049,7 +4049,7 @@ BattleCommand_PainSplit: ; 35926 ld a, $1 ld [wWhichHPBar], a hlcoord 10, 9 - predef AnimateHPBar + predef Predef_AnimateHPBar ld hl, EnemyMonHP ld a, [hli] ld [Buffer4], a @@ -4064,7 +4064,7 @@ BattleCommand_PainSplit: ; 35926 ld [wWhichHPBar], a call ResetDamage hlcoord 2, 2 - predef AnimateHPBar + predef Predef_AnimateHPBar farcall _UpdateBattleHUDs ld hl, SharedPainText @@ -4206,7 +4206,7 @@ BattleCommand_Conversion2: ; 359e6 ld a, [hl] ld [wNamedObjectIndexBuffer], a - predef GetTypeName + predef Predef_GetTypeName ld hl, TransformedTypeText jp StdBattleTextBox @@ -4744,7 +4744,7 @@ PlayFXAnimID: ; 35d08 ld c, 3 call DelayFrames - callfar PlayBattleAnim + callfar Predef_PlayBattleAnim ret @@ -4806,7 +4806,7 @@ EnemyHurtItself: ; 35d1c hlcoord 2, 2 xor a ld [wWhichHPBar], a - predef AnimateHPBar + predef Predef_AnimateHPBar .did_no_damage jp RefreshBattleHuds @@ -4866,7 +4866,7 @@ PlayerHurtItself: ; 35d7e hlcoord 10, 9 ld a, $1 ld [wWhichHPBar], a - predef AnimateHPBar + predef Predef_AnimateHPBar .did_no_damage jp RefreshBattleHuds @@ -5334,7 +5334,7 @@ SapHealth: ; 36011 xor a .hp_bar ld [wWhichHPBar], a - predef AnimateHPBar + predef Predef_AnimateHPBar call RefreshBattleHuds jp UpdateBattleMonInParty @@ -6296,11 +6296,11 @@ BattleCommand_Curl: ; 365a7 BattleCommand_RaiseSubNoAnim: ; 365af - ld hl, GetBattleMonBackpic + ld hl, Predef_GetBattleMonBackpic ld a, [hBattleTurn] and a jr z, .PlayerTurn - ld hl, GetEnemyMonFrontpic + ld hl, Predef_GetEnemyMonFrontpic .PlayerTurn: xor a ld [hBGMapMode], a @@ -7581,7 +7581,7 @@ BattleCommand_Recoil: ; 36cb2 xor a .animate_hp_bar ld [wWhichHPBar], a - predef AnimateHPBar + predef Predef_AnimateHPBar call RefreshBattleHuds ld hl, RecoilText jp StdBattleTextBox @@ -8282,7 +8282,7 @@ BattleCommand_Conversion: ; 3707f inc de ld [de], a ld [wNamedObjectIndexBuffer], a - farcall GetTypeName + farcall Predef_GetTypeName call AnimateCurrentMove ld hl, TransformedTypeText jp StdBattleTextBox @@ -9911,7 +9911,7 @@ PlayUserBattleAnim: ; 37e47 push hl push de push bc - callfar PlayBattleAnim + callfar Predef_PlayBattleAnim pop bc pop de pop hl @@ -9933,7 +9933,7 @@ PlayOpponentBattleAnim: ; 37e54 push bc call BattleCommand_SwitchTurn - callfar PlayBattleAnim + callfar Predef_PlayBattleAnim call BattleCommand_SwitchTurn pop bc diff --git a/engine/battle/effect_commands/attract.asm b/engine/battle/effect_commands/attract.asm index 0a6d7c975..fc73d234c 100755 --- a/engine/battle/effect_commands/attract.asm +++ b/engine/battle/effect_commands/attract.asm @@ -35,7 +35,7 @@ CheckOppositeGender: ; 377f5 xor a ld [MonType], a - farcall GetGender + farcall Predef_GetGender jr c, .genderless_samegender ld b, 1 @@ -58,7 +58,7 @@ CheckOppositeGender: ; 377f5 ld [TempMonDVs + 1], a ld a, 3 ld [MonType], a - farcall GetGender + farcall Predef_GetGender pop bc jr c, .genderless_samegender diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm index c78e9fd84..46aad0c00 100644 --- a/engine/battle/misc.asm +++ b/engine/battle/misc.asm @@ -33,7 +33,7 @@ AppearUser: ; fbd77 (3e:7d77) ld a, $31 .okay ld [hGraphicStartTile], a - predef PlaceGraphic + predef Predef_PlaceGraphic FinishAppearDisappearUser: ; fbd91 (3e:7d91) ld a, $1 ld [hBGMapMode], a diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index a09c6dd08..4f3dc8e55 100755 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -103,7 +103,7 @@ TrainerType1: ; 397eb ld a, OTPARTYMON ld [MonType], a push hl - predef TryAddMonToParty + predef Predef_TryAddMonToParty pop hl jr .loop ; 39806 @@ -124,7 +124,7 @@ TrainerType2: ; 39806 ld [MonType], a push hl - predef TryAddMonToParty + predef Predef_TryAddMonToParty ld a, [OTPartyCount] dec a ld hl, OTPartyMon1Moves @@ -200,7 +200,7 @@ TrainerType3: ; 39871 ld a, OTPARTYMON ld [MonType], a push hl - predef TryAddMonToParty + predef Predef_TryAddMonToParty ld a, [OTPartyCount] dec a ld hl, OTPartyMon1Item @@ -231,7 +231,7 @@ TrainerType4: ; 3989d ld [MonType], a push hl - predef TryAddMonToParty + predef Predef_TryAddMonToParty ld a, [OTPartyCount] dec a ld hl, OTPartyMon1Item diff --git a/engine/battle/returntobattle_useball.asm b/engine/battle/returntobattle_useball.asm index e6e33f900..4254d24f4 100644 --- a/engine/battle/returntobattle_useball.asm +++ b/engine/battle/returntobattle_useball.asm @@ -4,13 +4,13 @@ _ReturnToBattle_UseBall: ; 2715c ld a, [BattleType] cp BATTLETYPE_TUTORIAL jr z, .gettutorialbackpic - farcall GetBattleMonBackpic + farcall Predef_GetBattleMonBackpic jr .continue .gettutorialbackpic farcall GetTrainerBackpic .continue - farcall GetEnemyMonFrontpic + farcall Predef_GetEnemyMonFrontpic farcall _LoadBattleFontsHPBar call GetMemSGBLayout call CloseWindow diff --git a/engine/battle/start_battle.asm b/engine/battle/start_battle.asm index 18ca2df8d..7121f5385 100644 --- a/engine/battle/start_battle.asm +++ b/engine/battle/start_battle.asm @@ -33,7 +33,7 @@ FindFirstAliveMonAndStartBattle: ; 2ee2f add hl, de ld a, [hl] ld [BattleMonLevel], a - predef DoBattleTransition + predef Predef_DoBattleTransition farcall _LoadBattleFontsHPBar ld a, 1 ld [hBGMapMode], a diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index 27d57e68f..29bb3c215 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -1,6 +1,6 @@ ; Battle animation command interpreter. -PlayBattleAnim: ; cc0d6 +Predef_PlayBattleAnim: ; cc0d6 ld a, [rSVBK] push af @@ -167,7 +167,7 @@ BattleAnimRestoreHuds: ; cc1bb ld [rSVBK], a ld hl, UpdateBattleHuds - ld a, BANK(UpdatePlayerHUD) + ld a, BANK(Predef_UpdatePlayerHUD) rst FarCall ; Why not "call UpdateBattleHuds"? pop af @@ -929,18 +929,18 @@ BattleAnimCmd_Transform: ; cc5dc (33:45dc) ld a, [TempBattleMonSpecies] ; TempBattleMonSpecies ld [CurPartySpecies], a ; CurPartySpecies ld hl, BattleMonDVs ; BattleMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter ld de, vTiles0 tile $00 - predef GetMonFrontpic + predef Predef_GetMonFrontpic jr .done .player ld a, [TempEnemyMonSpecies] ; TempEnemyMonSpecies ld [CurPartySpecies], a ; CurPartySpecies ld hl, EnemyMonDVs ; EnemyMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter ld de, vTiles0 tile $00 - predef GetMonBackpic + predef Predef_GetMonBackpic .done pop af @@ -1156,16 +1156,16 @@ BattleAnimCmd_BeatUp: ; cc776 (33:4776) jr z, .player ld hl, BattleMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter ld de, vTiles2 tile $00 - predef GetMonFrontpic + predef Predef_GetMonFrontpic jr .done .player ld hl, EnemyMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter ld de, vTiles2 tile $31 - predef GetMonBackpic + predef Predef_GetMonBackpic .done pop af diff --git a/engine/billspc.asm b/engine/billspc.asm index 07bdf884a..8bb2056ca 100755 --- a/engine/billspc.asm +++ b/engine/billspc.asm @@ -1099,10 +1099,10 @@ PCMonInfo: ; e2ac6 (38:6ac6) ld [CurPartySpecies], a ld [CurSpecies], a ld hl, TempMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter call GetBaseData ld de, vTiles2 tile $00 - predef GetMonFrontpic + predef Predef_GetMonFrontpic xor a ld [wBillsPC_MonHasMail], a ld a, [CurPartySpecies] @@ -1119,7 +1119,7 @@ PCMonInfo: ; e2ac6 (38:6ac6) ld a, $3 ld [MonType], a - farcall GetGender + farcall Predef_GetGender jr c, .skip_gender ld a, "♂" jr nz, .printgender @@ -1702,7 +1702,7 @@ BillsPC_StatsScreen: ; e2f7e (38:6f7e) call BillsPC_CopyMon ld a, $3 ld [MonType], a - predef StatsScreenInit + predef Predef_StatsScreenInit call BillsPC_InitGFX call MaxVolume ret @@ -1730,7 +1730,7 @@ StatsScreenDPad: ; e2f95 (38:6f95) ld [CurPartySpecies], a ld [CurSpecies], a ld hl, TempMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter call GetBaseData call BillsPC_CopyMon .pressed_a_b_right_left @@ -1823,7 +1823,7 @@ DepositPokemon: ; e307c (38:707c) call GetNick ld a, PC_DEPOSIT ld [wPokemonWithdrawDepositParameter], a - predef SentGetPkmnIntoFromBox + predef Predef_SendGetPkmnIntoFromBox jr c, .asm_boxisfull xor a ld [wPokemonWithdrawDepositParameter], a @@ -1878,7 +1878,7 @@ TryWithdrawPokemon: ; e30fa (38:70fa) call CloseSRAM xor a ld [wPokemonWithdrawDepositParameter], a - predef SentGetPkmnIntoFromBox + predef Predef_SendGetPkmnIntoFromBox jr c, .PartyFull ld a, PC_DEPOSIT ld [wPokemonWithdrawDepositParameter], a diff --git a/engine/breeding.asm b/engine/breeding.asm index 7d2209de9..1d075ee81 100755 --- a/engine/breeding.asm +++ b/engine/breeding.asm @@ -10,7 +10,7 @@ CheckBreedmonCompatibility: ; 16e1d ld [TempMonDVs + 1], a ld a, TEMPMON ld [MonType], a - predef GetGender + predef Predef_GetGender jr c, .genderless ld b, $1 jr nz, .breedmon2 @@ -26,7 +26,7 @@ CheckBreedmonCompatibility: ; 16e1d ld [TempMonDVs + 1], a ld a, $3 ld [MonType], a - predef GetGender + predef Predef_GetGender pop bc jr c, .genderless ld a, $1 @@ -289,7 +289,7 @@ HatchEggs: ; 16f70 (5:6f70) ld bc, MON_STAT_EXP - 1 add hl, bc ld b, $0 - predef CalcPkmnStats + predef Predef_CalcPkmnStats pop bc ld hl, MON_MAXHP add hl, bc @@ -514,7 +514,7 @@ GLOBAL EggMoves cp b jr nz, .loop5 ld [wPutativeTMHMMove], a - predef CanLearnTMHMMove + predef Predef_CanLearnTMHMMove ld a, c and a jr z, .done @@ -559,7 +559,7 @@ LoadEggMove: ; 17169 ld [hl], b ld hl, wEggMonMoves ld de, wEggMonPP - predef FillPP + predef Predef_FillPP pop bc pop de ret @@ -590,7 +590,7 @@ GetHeritableMoves: ; 17197 ld [TempMonDVs + 1], a ld a, TEMPMON ld [MonType], a - predef GetGender + predef Predef_GetGender jr c, .inherit_mon2_moves jr nz, .inherit_mon2_moves jr .inherit_mon1_moves @@ -606,7 +606,7 @@ GetHeritableMoves: ; 17197 ld [TempMonDVs + 1], a ld a, TEMPMON ld [MonType], a - predef GetGender + predef Predef_GetGender jr c, .inherit_mon1_moves jr nz, .inherit_mon1_moves @@ -647,9 +647,9 @@ GetEggFrontpic: ; 17224 (5:7224) ld [CurSpecies], a call GetBaseData ld hl, BattleMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter pop de - predef_jump GetMonFrontpic + predef_jump Predef_GetMonFrontpic GetHatchlingFrontpic: ; 1723c (5:723c) push de @@ -657,9 +657,9 @@ GetHatchlingFrontpic: ; 1723c (5:723c) ld [CurSpecies], a call GetBaseData ld hl, BattleMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter pop de - predef_jump GetAnimatedFrontpicPredef + predef_jump Predef_GetAnimatedFrontpic Hatch_UpdateFrontpicBGMapCenter: ; 17254 (5:7254) push af @@ -677,7 +677,7 @@ Hatch_UpdateFrontpicBGMapCenter: ; 17254 (5:7254) ld a, c ld [hGraphicStartTile], a lb bc, 7, 7 - predef PlaceGraphic + predef Predef_PlaceGraphic pop af call Hatch_LoadFrontpicPal call SetPalettes @@ -779,7 +779,7 @@ EggHatch_AnimationSequence: ; 1728f (5:728f) hlcoord 6, 3 ld d, $0 ld e, ANIM_MON_HATCH - predef AnimateFrontpic + predef Predef_AnimateFrontpic pop af ld [CurSpecies], a ret diff --git a/engine/color.asm b/engine/color.asm index f2bfefac4..73427f843 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -854,7 +854,7 @@ PushSGBPals: jr nz, .loop ret -InitSGBBorder: +Predef_InitSGBBorder: call CheckCGB ret nz ; SGB/DMG only diff --git a/engine/debug.asm b/engine/debug.asm index 1e0d042e0..b9031ded8 100755 --- a/engine/debug.asm +++ b/engine/debug.asm @@ -315,12 +315,12 @@ Function81adb: ; 81adb hlcoord 12, 3 call _PrepMonFrontpic ld de, vTiles2 tile $31 - predef GetMonBackpic + predef Predef_GetMonBackpic ld a, $31 ld [hGraphicStartTile], a hlcoord 2, 4 lb bc, 6, 6 - predef PlaceGraphic + predef Predef_PlaceGraphic ld a, [wd003] and a jr z, .asm_81b66 @@ -346,13 +346,13 @@ Function81adb: ; 81adb hlcoord 4, 1 call PlaceString ld de, vTiles2 - callfar GetTrainerPic + callfar Predef_GetTrainerPic xor a ld [TempEnemyMonSpecies], a ld [hGraphicStartTile], a hlcoord 2, 3 lb bc, 7, 7 - predef PlaceGraphic + predef Predef_PlaceGraphic .asm_81ba9 ld a, $1 @@ -739,7 +739,7 @@ Function81df4: ; 81df4 ld a, [wd004] inc a ld [wd265], a - predef GetTMHMMove + predef Predef_GetTMHMMove ld a, [wd265] ld [wPutativeTMHMMove], a call GetMoveName @@ -748,7 +748,7 @@ Function81df4: ; 81df4 ld a, [wd004] call Function81e55 ld [CurItem], a - predef CanLearnTMHMMove + predef Predef_CanLearnTMHMMove ld a, c and a ld de, String_81e46 diff --git a/engine/events/catch_tutorial.asm b/engine/events/catch_tutorial.asm index b9352ccd6..d91af65fe 100644 --- a/engine/events/catch_tutorial.asm +++ b/engine/events/catch_tutorial.asm @@ -41,7 +41,7 @@ CatchTutorial:: ; 4e554 ld hl, .AutoInput ld a, BANK(.AutoInput) call StartAutoInput - callfar StartBattle + callfar Predef_StartBattle call StopAutoInput pop af diff --git a/engine/events/daycare.asm b/engine/events/daycare.asm index 6395a40fb..019aa058e 100755 --- a/engine/events/daycare.asm +++ b/engine/events/daycare.asm @@ -565,7 +565,7 @@ DayCare_GiveEgg: ; 169ac pop hl push bc ld b, $0 - predef CalcPkmnStats + predef Predef_CalcPkmnStats pop bc ld hl, MON_HP add hl, bc @@ -639,7 +639,7 @@ DayCare_InitBreeding: ; 16a3b cp DITTO ld a, $0 jr z, .LoadWhichBreedmonIsTheMother - farcall GetGender + farcall Predef_GetGender ld a, $0 jr z, .LoadWhichBreedmonIsTheMother inc a @@ -684,7 +684,7 @@ DayCare_InitBreeding: ; 16a3b ld de, wEggMonMoves xor a ld [Buffer1], a - predef FillMoves + predef Predef_FillMoves farcall InitEggMoves ld hl, wEggMonID ld a, [PlayerID] @@ -726,7 +726,7 @@ DayCare_InitBreeding: ; 16a3b ld a, TEMPMON ld [MonType], a push hl - farcall GetGender + farcall Predef_GetGender pop hl ld de, wBreedMon1DVs ld bc, wBreedMon2DVs @@ -770,7 +770,7 @@ DayCare_InitBreeding: ; 16a3b call CopyBytes ld hl, wEggMonMoves ld de, wEggMonPP - predef FillPP + predef Predef_FillPP ld hl, wMonOrItemNameBuffer ld de, StringBuffer1 ld bc, NAME_LENGTH diff --git a/engine/events/halloffame.asm b/engine/events/halloffame.asm index 1f818b471..0054d3ebe 100755 --- a/engine/events/halloffame.asm +++ b/engine/events/halloffame.asm @@ -130,7 +130,7 @@ AnimateHallOfFame: ; 864c3 call WaitBGMap decoord 6, 5 ld c, $6 - predef HOF_AnimateFrontpic + predef HOF_Predef_AnimateFrontpic ld c, 60 call DelayFrames and a @@ -244,18 +244,18 @@ AnimateHOFMonEntrance: ; 865b5 ld a, [hli] ld [TempMonDVs + 1], a ld hl, TempMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, " " call ByteFill ld de, vTiles2 tile $31 - predef GetMonBackpic + predef Predef_GetMonBackpic ld a, $31 ld [hGraphicStartTile], a hlcoord 6, 6 lb bc, 6, 6 - predef PlaceGraphic + predef Predef_PlaceGraphic ld a, $d0 ld [hSCY], a ld a, $90 @@ -403,7 +403,7 @@ _HallOfFamePC: ; 86650 call SetPalettes decoord 6, 5 ld c, $6 - predef HOF_AnimateFrontpic + predef HOF_Predef_AnimateFrontpic and a ret @@ -478,7 +478,7 @@ DisplayHOFMon: ; 86748 ld [CurPartySpecies], a ld [wd265], a ld hl, TempMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter xor a ld [wBoxAlignment], a hlcoord 6, 5 @@ -499,7 +499,7 @@ DisplayHOFMon: ; 86748 call PlaceString ld a, TEMPMON ld [MonType], a - farcall GetGender + farcall Predef_GetGender ld a, " " jr c, .got_gender ld a, "♂" @@ -546,7 +546,7 @@ HOF_AnimatePlayerPic: ; 86810 ld [hGraphicStartTile], a hlcoord 6, 6 lb bc, 6, 6 - predef PlaceGraphic + predef Predef_PlaceGraphic ld a, $d0 ld [hSCY], a ld a, $90 @@ -570,7 +570,7 @@ HOF_AnimatePlayerPic: ; 86810 ld [hGraphicStartTile], a hlcoord 12, 5 lb bc, 7, 7 - predef PlaceGraphic + predef Predef_PlaceGraphic ld a, $c0 ld [hSCX], a call WaitBGMap diff --git a/engine/events/itemfinder.asm b/engine/events/itemfinder.asm index 19e40ea4b..71aaa5b69 100755 --- a/engine/events/itemfinder.asm +++ b/engine/events/itemfinder.asm @@ -30,7 +30,7 @@ ItemFinder: ; 12580 .Script_FoundSomething: ; 0x125ad reloadmappart - special Special_UpdateTimePals + special UpdateTimePals callasm .ItemfinderSound writetext .Text_FoundSomething closetext @@ -39,7 +39,7 @@ ItemFinder: ; 12580 .Script_FoundNothing: ; 0x125ba reloadmappart - special Special_UpdateTimePals + special UpdateTimePals writetext .Text_FoundNothing closetext end diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm index b250741d0..c85642ab8 100755 --- a/engine/events/magnet_train.asm +++ b/engine/events/magnet_train.asm @@ -442,7 +442,7 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae ld [wEnvironment], a ld b, SCGB_MAPPALS call GetSGBLayout - call Special_UpdateTimePals + call UpdateTimePals ld a, [rBGP] ld [wBGP], a ld a, [rOBP0] diff --git a/engine/events/move_tutor.asm b/engine/events/move_tutor.asm index a15ecaf93..9630b07a8 100644 --- a/engine/events/move_tutor.asm +++ b/engine/events/move_tutor.asm @@ -54,7 +54,7 @@ CheckCanLearnMoveTutorMove: ; 492b9 ld hl, .MenuDataHeader call LoadMenuDataHeader - predef CanLearnTMHMMove + predef Predef_CanLearnTMHMMove push bc ld a, [CurPartyMon] @@ -78,7 +78,7 @@ CheckCanLearnMoveTutorMove: ; 492b9 callfar KnowsMove jr c, .didnt_learn - predef LearnMove + predef Predef_LearnMove ld a, b and a jr z, .didnt_learn diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm index 35554cef3..27f3fd595 100755 --- a/engine/events/overworld.asm +++ b/engine/events/overworld.asm @@ -208,7 +208,7 @@ CheckMapForSomethingToCut: ; c7ce Script_CutFromMenu: ; c7fe reloadmappart - special Special_UpdateTimePals + special UpdateTimePals Script_Cut: ; 0xc802 callasm GetPartyNick @@ -318,7 +318,7 @@ UseFlash: ; c8e0 Script_UseFlash: ; 0xc8e6 reloadmappart - special Special_UpdateTimePals + special UpdateTimePals writetext UnknownText_0xc8f3 callasm BlindingFlash closetext @@ -407,7 +407,7 @@ SurfFunction: ; c909 ret SurfFromMenuScript: ; c983 - special Special_UpdateTimePals + special UpdateTimePals UsedSurfScript: ; c986 writetext UsedSurfText ; "used SURF!" @@ -620,7 +620,7 @@ FlyFunction: ; ca3b .FlyScript: ; 0xcaa3 reloadmappart callasm HideSprites - special Special_UpdateTimePals + special UpdateTimePals callasm FlyFromAnim farscall Script_AbortBugContest special Special_WarpToSpawnPoint @@ -680,7 +680,7 @@ CheckMapCanWaterfall: ; cb07 Script_WaterfallFromMenu: ; 0xcb1c reloadmappart - special Special_UpdateTimePals + special UpdateTimePals Script_UsedWaterfall: ; 0xcb20 callasm GetPartyNick @@ -856,13 +856,13 @@ dig_incave .UsedEscapeRopeScript: ; 0xcc2b reloadmappart - special Special_UpdateTimePals + special UpdateTimePals writetext .Text_UsedEscapeRope jump .UsedDigOrEscapeRopeScript .UsedDigScript: ; 0xcc35 reloadmappart - special Special_UpdateTimePals + special UpdateTimePals writetext .Text_UsedDig .UsedDigOrEscapeRopeScript: ; 0xcc3c @@ -950,7 +950,7 @@ TeleportFunction: ; cc61 .TeleportScript: ; 0xccbb reloadmappart - special Special_UpdateTimePals + special UpdateTimePals writetext .Text_ReturnToLastMonCenter pause 60 reloadmappart @@ -1021,7 +1021,7 @@ SetStrengthFlag: ; cd12 Script_StrengthFromMenu: ; 0xcd29 reloadmappart - special Special_UpdateTimePals + special UpdateTimePals Script_UsedStrength: ; 0xcd2d callasm SetStrengthFlag @@ -1183,7 +1183,7 @@ TryWhirlpoolMenu: ; cdde Script_WhirlpoolFromMenu: ; 0xce0b reloadmappart - special Special_UpdateTimePals + special UpdateTimePals Script_UsedWhirlpool: ; 0xce0f callasm GetPartyNick @@ -1284,7 +1284,7 @@ UnknownText_0xcea2: ; 0xcea2 HeadbuttFromMenuScript: ; 0xcea7 reloadmappart - special Special_UpdateTimePals + special UpdateTimePals HeadbuttScript: ; 0xceab callasm GetPartyNick @@ -1382,7 +1382,7 @@ GetFacingObject: ; cf0d RockSmashFromMenuScript: ; 0xcf2e reloadmappart - special Special_UpdateTimePals + special UpdateTimePals RockSmashScript: ; cf32 callasm GetPartyNick @@ -1611,7 +1611,7 @@ Fishing_CheckFacingUp: ; d06c Script_FishCastRod: ; 0xd07c reloadmappart loadvar hBGMapMode, $0 - special Special_UpdateTimePals + special UpdateTimePals loademote EMOTE_ROD callasm LoadFishingGFX loademote EMOTE_SHOCK @@ -1735,7 +1735,7 @@ BikeFunction: ; d0b3 Script_GetOnBike: ; 0xd13e reloadmappart - special Special_UpdateTimePals + special UpdateTimePals writecode VAR_MOVEMENT, PLAYER_BIKE writetext GotOnTheBikeText waitbutton @@ -1755,7 +1755,7 @@ Script_GetOnBike_Register: ; 0xd14e Script_GetOffBike: ; 0xd158 reloadmappart - special Special_UpdateTimePals + special UpdateTimePals writecode VAR_MOVEMENT, PLAYER_NORMAL writetext GotOffTheBikeText waitbutton diff --git a/engine/events/poisonstep.asm b/engine/events/poisonstep.asm index 00c7477bc..366ad1c03 100755 --- a/engine/events/poisonstep.asm +++ b/engine/events/poisonstep.asm @@ -104,7 +104,7 @@ DoPoisonStep:: ; 505da ld de, SFX_POISON call PlaySFX ld b, $2 - predef LoadPoisonBGPals + predef Predef_LoadPoisonBGPals call DelayFrame ret ; 50669 @@ -145,7 +145,7 @@ DoPoisonStep:: ; 505da ld a, [PartyCount] cp [hl] jr nz, .party_loop - predef CheckPlayerPartyForFitPkmn + predef Predef_CheckPlayerPartyForFitPkmn ld a, d ld [ScriptVar], a ret diff --git a/engine/events/poisonstep_pals.asm b/engine/events/poisonstep_pals.asm index 8eb8734f6..2cca433e5 100644 --- a/engine/events/poisonstep_pals.asm +++ b/engine/events/poisonstep_pals.asm @@ -1,4 +1,4 @@ -LoadPoisonBGPals: ; cbcdd +Predef_LoadPoisonBGPals: ; cbcdd call .LoadPals ld a, [hCGB] and a @@ -20,7 +20,7 @@ LoadPoisonBGPals: ; cbcdd call DmgToCgbBGPals ld c, 4 call DelayFrames - farcall _Special_UpdateTimePals + farcall _UpdateTimePals ret .cgb @@ -44,5 +44,5 @@ LoadPoisonBGPals: ; cbcdd ld [hCGBPalUpdate], a ld c, 4 call DelayFrames - farcall _Special_UpdateTimePals + farcall _UpdateTimePals ret diff --git a/engine/events/pokecenter_pc.asm b/engine/events/pokecenter_pc.asm index fcc35dd28..1d655024f 100755 --- a/engine/events/pokecenter_pc.asm +++ b/engine/events/pokecenter_pc.asm @@ -216,7 +216,7 @@ Function15715: ; 15715 ld hl, KrissPCMenuData call LoadMenuDataHeader .asm_15722 - call Special_UpdateTimePals + call UpdateTimePals call DoNthMenu jr c, .asm_15731 call MenuJumptable @@ -354,7 +354,7 @@ KrisWithdrawItemMenu: ; 0x157d1 ld [CurItemQuantity], a ld hl, PCItems call TossItem - predef PartyMonItemName + predef Predef_PartyMonItemName ld hl, .WithdrewText call MenuTextBox xor a @@ -518,7 +518,7 @@ KrisDepositItemMenu: ; 0x1588b ld [CurItemQuantity], a ld hl, NumItems call TossItem - predef PartyMonItemName + predef Predef_PartyMonItemName ld hl, .DepositText call PrintText ret diff --git a/engine/events/pokepic.asm b/engine/events/pokepic.asm index 82016403b..95eddd7f6 100755 --- a/engine/events/pokepic.asm +++ b/engine/events/pokepic.asm @@ -12,7 +12,7 @@ Pokepic:: ; 244e3 ld [CurSpecies], a call GetBaseData ld de, vTiles1 - predef GetMonFrontpic + predef Predef_GetMonFrontpic ld a, [wMenuBorderTopCoord] inc a ld b, a @@ -23,7 +23,7 @@ Pokepic:: ; 244e3 ld a, $80 ld [hGraphicStartTile], a lb bc, 7, 7 - predef PlaceGraphic + predef Predef_PlaceGraphic call WaitBGMap ret diff --git a/engine/events/print_unown.asm b/engine/events/print_unown.asm index 72248a67b..948af5937 100644 --- a/engine/events/print_unown.asm +++ b/engine/events/print_unown.asm @@ -140,13 +140,13 @@ UnownPrinter: ; 16be4 xor a ld [wBoxAlignment], a ld de, vTiles2 - predef GetMonFrontpic + predef Predef_GetMonFrontpic call .Load2bppToSRAM hlcoord 1, 6 xor a ld [hGraphicStartTile], a lb bc, 7, 7 - predef PlaceGraphic + predef Predef_PlaceGraphic ld de, vTiles2 tile $31 farcall RotateUnownFrontpic ret @@ -228,6 +228,6 @@ PlaceUnownPrinterFrontpic: ; 16dac ld a, $31 ld [hGraphicStartTile], a lb bc, 7, 7 - predef PlaceGraphic + predef Predef_PlaceGraphic ret ; 16dc7 diff --git a/engine/events/special.asm b/engine/events/special.asm index d2f9673c2..b2e1af3dc 100755 --- a/engine/events/special.asm +++ b/engine/events/special.asm @@ -10,7 +10,7 @@ Special_GiveShuckle: ; 7305 ld a, 15 ld [CurPartyLevel], a - predef TryAddMonToParty + predef Predef_TryAddMonToParty jr nc, .NotGiven ; Caught data. diff --git a/engine/events/squirtbottle.asm b/engine/events/squirtbottle.asm index 4926f30c1..1134f1bb0 100755 --- a/engine/events/squirtbottle.asm +++ b/engine/events/squirtbottle.asm @@ -7,7 +7,7 @@ _Squirtbottle: ; 50730 .SquirtbottleScript: reloadmappart - special Special_UpdateTimePals + special UpdateTimePals callasm .CheckCanUseSquirtbottle iffalse .NothingHappenedScript farjump WateredWeirdTreeScript diff --git a/engine/events/sweet_scent.asm b/engine/events/sweet_scent.asm index e4bc2197c..9b75eb9b8 100755 --- a/engine/events/sweet_scent.asm +++ b/engine/events/sweet_scent.asm @@ -8,7 +8,7 @@ SweetScentFromMenu: ; 506bc .SweetScent: ; 0x506c8 reloadmappart - special Special_UpdateTimePals + special UpdateTimePals callasm GetPartyNick writetext UnknownText_0x50726 waitbutton diff --git a/engine/evolution_animation.asm b/engine/evolution_animation.asm index 1fa55c10a..049e1677b 100755 --- a/engine/evolution_animation.asm +++ b/engine/evolution_animation.asm @@ -122,7 +122,7 @@ EvolutionAnimation: ; 4e5e1 hlcoord 7, 2 ld d, $0 ld e, ANIM_MON_EVOLVE - predef AnimateFrontpic + predef Predef_AnimateFrontpic pop af ld [CurPartySpecies], a @@ -168,7 +168,7 @@ EvolutionAnimation: ; 4e5e1 ld a, $1 ld [wBoxAlignment], a ld de, vTiles2 - predef GetAnimatedFrontpicPredef + predef Predef_GetAnimatedFrontpic xor a ld [wBoxAlignment], a ret diff --git a/engine/evolve.asm b/engine/evolve.asm index d910ddca6..c1328e34f 100755 --- a/engine/evolve.asm +++ b/engine/evolve.asm @@ -6,7 +6,7 @@ EvolvePokemon: ; 421d8 ld c, a ld b, SET_FLAG call EvoFlagAction -EvolveAfterBattle: ; 421e6 +Predef_EvolveAfterBattle: ; 421e6 xor a ld [wMonTriedToEvolve], a dec a @@ -55,7 +55,7 @@ EvolveAfterBattle_MasterLoop push hl xor a ld [MonType], a - predef CopyPkmnToTempMon + predef Predef_CopyPkmnToTempMon pop hl .loop @@ -265,7 +265,7 @@ EvolveAfterBattle_MasterLoop ld hl, TempMonExp + 2 ld de, TempMonMaxHP ld b, $1 - predef CalcPkmnStats + predef Predef_CalcPkmnStats ld a, [CurPartyMon] ld hl, PartyMons @@ -301,7 +301,7 @@ EvolveAfterBattle_MasterLoop ld [wd265], a xor a ld [MonType], a - call LearnLevelMoves + call Predef_LearnLevelMoves ld a, [wd265] dec a call SetSeenAndCaughtMon @@ -311,7 +311,7 @@ EvolveAfterBattle_MasterLoop jr nz, .skip_unown ld hl, TempMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter callfar UpdateUnownDex .skip_unown @@ -429,7 +429,7 @@ Text_WhatEvolving: ; 0x42482 ; 0x42487 -LearnLevelMoves: ; 42487 +Predef_LearnLevelMoves: ; 42487 ld a, [wd265] ld [CurPartySpecies], a dec a @@ -484,7 +484,7 @@ LearnLevelMoves: ; 42487 ld [wd265], a call GetMoveName call CopyName1 - predef LearnMove + predef Predef_LearnMove pop hl jr .find_move @@ -495,7 +495,7 @@ LearnLevelMoves: ; 42487 ; 424e1 -FillMoves: ; 424e1 +Predef_FillMoves: ; 424e1 ; Fill in moves at de for CurPartySpecies at CurPartyLevel push hl @@ -621,7 +621,7 @@ ShiftMoves: ; 4256e EvoFlagAction: ; 42577 push de ld d, $0 - predef FlagPredef + predef Predef_Flag pop de ret ; 42581 diff --git a/engine/health.asm b/engine/health.asm index 0f7ba156d..eba75ddf4 100755 --- a/engine/health.asm +++ b/engine/health.asm @@ -52,7 +52,7 @@ HealPartyMon: ; c677 farcall RestoreAllPP ret -ComputeHPBarPixels: ; c699 +Predef_ComputeHPBarPixels: ; c699 ; e = bc * (6 * 8) / de ld a, b or c @@ -103,7 +103,7 @@ ComputeHPBarPixels: ; c699 ld e, 0 ret -AnimateHPBar: ; c6e0 +Predef_AnimateHPBar: ; c6e0 call WaitBGMap call _AnimateHPBar call WaitBGMap diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index a3efd8afe..da2d4b800 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -943,24 +943,24 @@ Intro_WipeInFrontpic: ; 6182 Intro_PrepTrainerPic: ; 619c ld de, vTiles2 - farcall GetTrainerPic + farcall Predef_GetTrainerPic xor a ld [hGraphicStartTile], a hlcoord 6, 4 lb bc, 7, 7 - predef PlaceGraphic + predef Predef_PlaceGraphic ret ; 61b4 ShrinkFrame: ; 61b4 ld de, vTiles2 ld c, $31 - predef DecompressPredef + predef Predef_Decompress xor a ld [hGraphicStartTile], a hlcoord 6, 4 lb bc, 7, 7 - predef PlaceGraphic + predef Predef_PlaceGraphic ret ; 61cd @@ -1048,7 +1048,7 @@ StartTitleScreen: ; 6219 ld [hWY], a ld b, SCGB_DIPLOMA call GetSGBLayout - call Special_UpdateTimePals + call UpdateTimePals ld a, [wIntroSceneFrameCounter] cp $5 jr c, .ok diff --git a/engine/item_effects.asm b/engine/item_effects.asm index 90dfdc7e0..78506604d 100644 --- a/engine/item_effects.asm +++ b/engine/item_effects.asm @@ -415,7 +415,7 @@ ParkBall: ; e8a2 ld [hBattleTurn], a ld [Buffer2], a ld [wNumHits], a - predef PlayBattleAnim + predef Predef_PlayBattleAnim ld a, [wWildMon] and a @@ -547,7 +547,7 @@ ParkBall: ; e8a2 ld a, [EnemyMonSpecies] ld [wd265], a - predef NewPokedexEntry + predef Predef_NewPokedexEntry .skip_pokedex ld a, [BattleType] @@ -567,7 +567,7 @@ ParkBall: ; e8a2 ld [MonType], a call ClearSprites - predef TryAddMonToParty + predef Predef_TryAddMonToParty farcall SetCaughtData @@ -623,7 +623,7 @@ ParkBall: ; e8a2 .SendToPC: call ClearSprites - predef SentPkmnIntoBox + predef Predef_SendPkmnIntoBox farcall SetBoxMonCaughtData @@ -985,7 +985,7 @@ LoveBallMultiplier: ld [MonType], a ld a, [CurBattleMon] ld [CurPartyMon], a - farcall GetGender + farcall Predef_GetGender jr c, .done1 ; no effect on genderless ld d, 0 ; male @@ -999,7 +999,7 @@ LoveBallMultiplier: ld [CurPartySpecies], a ld a, WILDMON ld [MonType], a - farcall GetGender + farcall Predef_GetGender jr c, .done2 ; no effect on genderless ld d, 0 ; male @@ -1289,7 +1289,7 @@ UpdateStatsAfterItem: ; ee8c ld a, MON_STAT_EXP - 1 call GetPartyParamLocation ld b, $1 - predef_jump CalcPkmnStats + predef_jump Predef_CalcPkmnStats ; ee9f RareCandy_StatBooster_ExitMenu: ; ee9f @@ -1428,7 +1428,7 @@ RareCandy: ; ef14 xor a ; PARTYMON ld [MonType], a - predef CopyPkmnToTempMon + predef Predef_CopyPkmnToTempMon hlcoord 9, 0 ld b, 10 @@ -1437,7 +1437,7 @@ RareCandy: ; ef14 hlcoord 11, 1 ld bc, $0004 - predef PrintTempMonStats + predef Predef_PrintTempMonStats call WaitPressAorB_BlinkCursor @@ -1445,7 +1445,7 @@ RareCandy: ; ef14 ld [MonType], a ld a, [CurPartySpecies] ld [wd265], a - predef LearnLevelMoves + predef Predef_LearnLevelMoves xor a ld [wForceEvolution], a @@ -1668,7 +1668,7 @@ RevivePokemon: ; f0d6 ld d, 0 ld hl, wBattleParticipantsIncludingFainted ld b, CHECK_FLAG - predef FlagPredef + predef Predef_Flag ld a, c and a jr z, .skip_to_revive @@ -1677,7 +1677,7 @@ RevivePokemon: ; f0d6 ld c, a ld hl, wBattleParticipantsNotFainted ld b, SET_FLAG - predef FlagPredef + predef Predef_Flag .skip_to_revive xor a @@ -1844,7 +1844,7 @@ HealHP_SFX_GFX: ; f1db (3:71db) call AddNTimes ld a, $2 ld [wWhichHPBar], a - predef_jump AnimateHPBar + predef_jump Predef_AnimateHPBar UseItem_SelectMon: ; f1f9 (3:71f9) call .SelectMon @@ -2957,7 +2957,7 @@ UseBallInTrainerBattle: ; f7a0 ld [wBattleAnimParam], a ld [hBattleTurn], a ld [wNumHits], a - predef PlayBattleAnim + predef Predef_PlayBattleAnim ld hl, BlockedTheBallText call PrintText ld hl, DontBeAThiefText @@ -3104,7 +3104,7 @@ ApplyPPUp: ; f84c call GetPartyParamLocation push hl ld de, Buffer1 - predef FillPP + predef Predef_FillPP pop hl ld bc, MON_PP - MON_MOVES add hl, bc diff --git a/engine/learn.asm b/engine/learn.asm index d2751235f..ceb814650 100755 --- a/engine/learn.asm +++ b/engine/learn.asm @@ -1,4 +1,4 @@ -LearnMove: ; 6508 +Predef_LearnMove: ; 6508 call LoadTileMapToTempTileMap ld a, [CurPartyMon] ld hl, PartyMonNicknames @@ -144,7 +144,7 @@ ForgetMove: ; 65d3 hlcoord 5 + 2, 2 + 2 ld a, SCREEN_WIDTH * 2 ld [Buffer1], a - predef ListMoves + predef Predef_ListMoves ; wMenuData3 ld a, $4 ld [w2DMenuCursorInitY], a diff --git a/engine/link.asm b/engine/link.asm index de914c492..3d1fd0da4 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -150,7 +150,7 @@ TimeCapsule: ; 2805d ld [wd265], a push hl push de - callfar ConvertMon_1to2 + callfar Predef_ConvertMon_1to2 pop de pop hl ld a, [wd265] @@ -449,7 +449,7 @@ Gen2ToGen2LinkComms: ; 28177 pop af ld [rIF], a - predef StartBattle + predef Predef_StartBattle ld a, [rIF] ld h, a @@ -786,7 +786,7 @@ Link_PrepPartyData_Gen1: ; 28499 add hl, bc ld c, STAT_SATK ld b, TRUE - predef CalcPkmnStatC + predef Predef_CalcPkmnStatC pop bc pop de @@ -993,7 +993,7 @@ Function2868a: ; 2868a push bc push de ld [wd265], a - callfar ConvertMon_1to2 + callfar Predef_ConvertMon_1to2 pop de pop bc ld a, [wd265] @@ -1072,7 +1072,7 @@ Function2868a: ; 2868a add hl, bc ld c, STAT_SATK ld b, TRUE - predef CalcPkmnStatC + predef Predef_CalcPkmnStatC pop bc pop hl ld a, [hQuotient + 1] @@ -1085,7 +1085,7 @@ Function2868a: ; 2868a add hl, bc ld c, STAT_SDEF ld b, TRUE - predef CalcPkmnStatC + predef Predef_CalcPkmnStatC pop bc pop hl ld a, [hQuotient + 1] @@ -1362,7 +1362,7 @@ Function28926: ; 28926 hlcoord 0, 15 ld b, 1 ld c, 18 - call LinkTextboxPredef + call Predef_LinkTextbox hlcoord 2, 16 ld de, .String_Stats_Trade call PlaceString @@ -1471,7 +1471,7 @@ Function28926: ; 28926 hlcoord 0, 12 ld b, 4 ld c, 18 - call LinkTextboxPredef + call Predef_LinkTextbox farcall Link_WaitBGMap ld hl, .Text_CantTradeLastMon bccoord 1, 14 @@ -1493,7 +1493,7 @@ Function28926: ; 28926 hlcoord 0, 12 ld b, 4 ld c, 18 - call LinkTextboxPredef + call Predef_LinkTextbox farcall Link_WaitBGMap ld hl, .Text_Abnormal bccoord 1, 14 @@ -1503,7 +1503,7 @@ Function28926: ; 28926 hlcoord 0, 12 ld b, 4 ld c, 18 - call LinkTextboxPredef + call Predef_LinkTextbox hlcoord 1, 14 ld de, String_TooBadTheTradeWasCanceled call PlaceString @@ -1648,7 +1648,7 @@ LinkTrade: ; 28b87 hlcoord 0, 12 ld b, $4 ld c, $12 - call LinkTextboxPredef + call Predef_LinkTextbox farcall Link_WaitBGMap ld a, [wd002] ld hl, PartySpecies @@ -1677,7 +1677,7 @@ LinkTrade: ; 28b87 hlcoord 10, 7 ld b, 3 ld c, 7 - call LinkTextboxPredef + call Predef_LinkTextbox ld de, String28eab hlcoord 12, 8 call PlaceString @@ -1717,7 +1717,7 @@ LinkTrade: ; 28b87 hlcoord 0, 12 ld b, 4 ld c, 18 - call LinkTextboxPredef + call Predef_LinkTextbox hlcoord 1, 14 ld de, String_TooBadTheTradeWasCanceled call PlaceString @@ -1734,7 +1734,7 @@ LinkTrade: ; 28b87 hlcoord 0, 12 ld b, 4 ld c, 18 - call LinkTextboxPredef + call Predef_LinkTextbox hlcoord 1, 14 ld de, String_TooBadTheTradeWasCanceled call PlaceString @@ -1891,11 +1891,11 @@ LinkTrade: ; 28b87 ld a, [hLinkPlayerNumber] cp $1 jr z, .player_2 - predef TradeAnimation + predef Predef_TradeAnimation jr .done_animation .player_2 - predef TradeAnimationPlayer2 + predef Predef_TradeAnimationPlayer2 .done_animation pop af @@ -1913,7 +1913,7 @@ LinkTrade: ; 28b87 ld de, TempMonSpecies ld bc, PARTYMON_STRUCT_LENGTH call CopyBytes - predef AddTempmonToParty + predef Predef_AddTempmonToParty ld a, [PartyCount] dec a ld [CurPartyMon], a @@ -1964,7 +1964,7 @@ LinkTrade: ; 28b87 hlcoord 0, 12 ld b, 4 ld c, 18 - call LinkTextboxPredef + call Predef_LinkTextbox hlcoord 1, 14 ld de, String28ebd call PlaceString @@ -2001,7 +2001,7 @@ String_TooBadTheTradeWasCanceled: ; 28ece next "was canceled!@" -LinkTextboxPredef: ; 28eef +Predef_LinkTextbox: ; 28eef ld d, h ld e, l farcall LinkTextbox @@ -2023,11 +2023,11 @@ Unreferenced_Function28f09: ; 28f09 hlcoord 0, 0 ld b, 6 ld c, 18 - call LinkTextboxPredef + call Predef_LinkTextbox hlcoord 0, 8 ld b, 6 ld c, 18 - call LinkTextboxPredef + call Predef_LinkTextbox farcall PlaceTradePartnerNamesAndParty ret ; 28f24 @@ -2584,7 +2584,7 @@ Unreferenced_Function29fe4: call GetSRAMBank ld d, $0 ld b, CHECK_FLAG - predef FlagPredef + predef Predef_Flag call CloseSRAM ld a, c and a diff --git a/engine/link_2.asm b/engine/link_2.asm index 72e5262b3..03b95b39a 100644 --- a/engine/link_2.asm +++ b/engine/link_2.asm @@ -3,7 +3,7 @@ LinkMonStatsScreen: ; 4d319 dec a ld [CurPartyMon], a call LowVolume - predef StatsScreenInit + predef Predef_StatsScreenInit ld a, [CurPartyMon] inc a ld [wMenuCursorY], a diff --git a/engine/link_trade.asm b/engine/link_trade.asm index 07b471640..f85403a29 100755 --- a/engine/link_trade.asm +++ b/engine/link_trade.asm @@ -181,7 +181,7 @@ Function16d6e1: ; 16d6e1 hlcoord 4, 10 ld b, 1 ld c, 10 - predef LinkTextboxPredef + predef Predef_LinkTextbox hlcoord 5, 11 ld de, .Waiting call PlaceString diff --git a/engine/map_setup.asm b/engine/map_setup.asm index 7e935c0ce..b3905b71e 100644 --- a/engine/map_setup.asm +++ b/engine/map_setup.asm @@ -233,7 +233,7 @@ FadeOldMapMusic: ; 15567 ; 1556d RetainOldPalettes: ; 1556d - farcall _Special_UpdateTimePals + farcall _UpdateTimePals ret RotatePalettesRightMapAndMusic: ; 15574 diff --git a/engine/mart.asm b/engine/mart.asm index dc47ba029..4eff21fa3 100755 --- a/engine/mart.asm +++ b/engine/mart.asm @@ -525,7 +525,7 @@ StandardMartAskPurchaseQuantity: ; 15d97 MartConfirmPurchase: ; 15d97 - predef PartyMonItemName + predef Predef_PartyMonItemName ld a, MARTTEXT_COSTS_THIS_MUCH call LoadBuyMenuText call YesNoBox @@ -864,7 +864,7 @@ SellMenu: ; 15eb3 ld a, [wMartItemID] ld hl, NumItems call TossItem - predef PartyMonItemName + predef Predef_PartyMonItemName hlcoord 1, 14 lb bc, 3, 18 call ClearBox diff --git a/engine/mon_stats.asm b/engine/mon_stats.asm index fce5fbcac..1a08b2be5 100644 --- a/engine/mon_stats.asm +++ b/engine/mon_stats.asm @@ -1,8 +1,8 @@ -DrawPlayerHP: ; 50b0a +Predef_DrawPlayerHP: ; 50b0a ld a, $1 jr DrawHP -DrawEnemyHP: ; 50b0e +Predef_DrawEnemyHP: ; 50b0e ld a, $2 DrawHP: ; 50b10 @@ -43,7 +43,7 @@ DrawHP: ; 50b10 ld c, e .not_boxmon - predef ComputeHPBarPixels + predef Predef_ComputeHPBarPixels ld a, 6 ld d, a ld c, a @@ -82,7 +82,7 @@ DrawHP: ; 50b10 pop de ret -PrintTempMonStats: ; 50b7b +Predef_PrintTempMonStats: ; 50b7b ; Print TempMon's stats at hl, with spacing bc. push bc push hl @@ -121,7 +121,7 @@ PrintTempMonStats: ; 50b7b next "SPEED" next "@" -GetGender: ; 50bdd +Predef_GetGender: ; 50bdd ; Return the gender of a given monster (CurPartyMon/CurOTMon/CurWildMon). ; When calling this function, a should be set to an appropriate MonType value. @@ -235,7 +235,7 @@ GetGender: ; 50bdd scf ret -ListMovePP: ; 50c50 +Predef_ListMovePP: ; 50c50 ld a, [wNumMoves] inc a ld c, a @@ -343,7 +343,7 @@ UnusedPredef22: call GetNick pop hl call PlaceString - call CopyPkmnToTempMon + call Predef_CopyPkmnToTempMon pop hl ld a, [CurPartySpecies] cp EGG @@ -352,7 +352,7 @@ UnusedPredef22: ld bc, -12 add hl, bc ld b, $0 - call DrawEnemyHP + call Predef_DrawEnemyHP pop hl ld bc, 5 add hl, bc @@ -363,7 +363,7 @@ UnusedPredef22: .egg ret -PlaceStatusString: ; 50d0a +Predef_PlaceStatusString: ; 50d0a push de inc de inc de @@ -373,7 +373,7 @@ PlaceStatusString: ; 50d0a ld a, [de] or b pop de - jr nz, PlaceNonFaintStatus + jr nz, Predef_PlaceNonFaintStatus push de ld de, FntString call CopyStatusString @@ -396,7 +396,7 @@ CopyStatusString: ; 50d25 ld [hl], a ret -PlaceNonFaintStatus: ; 50d2e +Predef_PlaceNonFaintStatus: ; 50d2e push de ld a, [de] ld de, PsnString @@ -430,7 +430,7 @@ BrnString: db "BRN@" FrzString: db "FRZ@" ParString: db "PAR@" -ListMoves: ; 50d6f +Predef_ListMoves: ; 50d6f ; List moves at hl, spaced every [Buffer1] tiles. ld de, wListMoves_MoveIndicesBuffer ld b, $0 diff --git a/engine/move_mon.asm b/engine/move_mon.asm index 90abe2903..9128eabdd 100755 --- a/engine/move_mon.asm +++ b/engine/move_mon.asm @@ -1,4 +1,4 @@ -TryAddMonToParty: ; d88c +Predef_TryAddMonToParty: ; d88c ; Check if to copy wild Pkmn or generate new Pkmn ; Whose is it? ld de, PartyCount @@ -120,7 +120,7 @@ GeneratePartyMonStats: ; d906 endr ld [hl], a ld [Buffer1], a - predef FillMoves + predef Predef_FillMoves .next pop de @@ -195,7 +195,7 @@ endr push de inc hl inc hl - call FillPP + call Predef_FillPP pop de pop hl rept 4 @@ -224,7 +224,7 @@ endr ld a, $1 ld c, a ld b, FALSE - call CalcPkmnStatC + call Predef_CalcPkmnStatC ld a, [hProduct + 2] ld [de], a inc de @@ -297,7 +297,7 @@ endr ld bc, MON_STAT_EXP - 1 add hl, bc ld b, $0 ; if b = 1, then stat calculation takes stat exp into account. - call CalcPkmnStats + call Predef_CalcPkmnStats .next3 ld a, [MonType] @@ -311,7 +311,7 @@ endr dec a ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes - predef GetUnownLetter + predef Predef_GetUnownLetter callfar UpdateUnownDex .done @@ -319,7 +319,7 @@ endr ret ; da6d -FillPP: ; da6d +Predef_FillPP: ; da6d push bc ld b, NUM_MOVES .loop @@ -350,7 +350,7 @@ FillPP: ; da6d ret ; da96 -AddTempmonToParty: ; da96 +Predef_AddTempmonToParty: ; da96 ld hl, PartyCount ld a, [hl] cp PARTY_LENGTH @@ -422,7 +422,7 @@ AddTempmonToParty: ; da96 dec a ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes - predef GetUnownLetter + predef Predef_GetUnownLetter callfar UpdateUnownDex ld a, [wFirstUnownSeen] and a @@ -434,7 +434,7 @@ AddTempmonToParty: ; da96 and a ret -SentGetPkmnIntoFromBox: ; db3f +Predef_SendGetPkmnIntoFromBox: ; db3f ; Sents/Gets Pkmn into/from Box depending on Parameter ; wPokemonWithdrawDepositParameter == 0: get Pkmn into Party ; wPokemonWithdrawDepositParameter == 1: sent Pkmn into Box @@ -597,7 +597,7 @@ SentGetPkmnIntoFromBox: ; db3f srl a add $2 ld [MonType], a - predef CopyPkmnToTempMon + predef Predef_CopyPkmnToTempMon callfar CalcLevel ld a, d ld [CurPartyLevel], a @@ -617,7 +617,7 @@ SentGetPkmnIntoFromBox: ; db3f push bc ld b, $1 - call CalcPkmnStats + call Predef_CalcPkmnStats pop bc ld a, [wPokemonWithdrawDepositParameter] @@ -830,7 +830,7 @@ Functiondd64: ; dd64 add hl, bc push bc ld b, $1 - call CalcPkmnStats + call Predef_CalcPkmnStats ld hl, PartyMon1Moves ld a, [PartyCount] dec a @@ -840,7 +840,7 @@ Functiondd64: ; dd64 ld e, l ld a, $1 ld [Buffer1], a - predef FillMoves + predef Predef_FillMoves ld a, [PartyCount] dec a ld [CurPartyMon], a @@ -904,8 +904,8 @@ DepositBreedmon: ; de44 ld bc, BOXMON_STRUCT_LENGTH jp CopyBytes -SentPkmnIntoBox: ; de6e -; Sents the Pkmn into one of Bills Boxes +Predef_SendPkmnIntoBox: ; de6e +; Sends the Pkmn into one of Bills Boxes ; the data comes mainly from 'EnemyMon:' ld a, BANK(sBoxCount) call GetSRAMBank @@ -1010,7 +1010,7 @@ SentPkmnIntoBox: ; de6e cp UNOWN jr nz, .not_unown ld hl, sBoxMon1DVs - predef GetUnownLetter + predef Predef_GetUnownLetter callfar UpdateUnownDex .not_unown @@ -1086,7 +1086,7 @@ ShiftBoxMon: ; df47 ret ; df8c -GiveEgg:: ; df8c +Predef_GiveEgg:: ; df8c ld a, [CurPartySpecies] push af callfar GetPreEvolution @@ -1094,7 +1094,7 @@ GiveEgg:: ; df8c ld a, [CurPartySpecies] dec a -; TryAddMonToParty sets Seen and Caught flags +; Predef_TryAddMonToParty sets Seen and Caught flags ; when it is successful. This routine will make ; sure that we aren't newly setting flags. push af @@ -1104,11 +1104,11 @@ GiveEgg:: ; df8c call CheckSeenMon push bc - call TryAddMonToParty + call Predef_TryAddMonToParty ; If we haven't caught this Pokemon before receiving ; the Egg, reset the flag that was just set by -; TryAddMonToParty. +; Predef_TryAddMonToParty. pop bc ld a, c and a @@ -1119,12 +1119,12 @@ GiveEgg:: ; df8c ld d, $0 ld hl, PokedexCaught ld b, RESET_FLAG - predef FlagPredef + predef Predef_Flag .skip_caught_flag ; If we haven't seen this Pokemon before receiving ; the Egg, reset the flag that was just set by -; TryAddMonToParty. +; Predef_TryAddMonToParty. pop bc ld a, c and a @@ -1135,7 +1135,7 @@ GiveEgg:: ; df8c ld d, $0 ld hl, PokedexSeen ld b, RESET_FLAG - predef FlagPredef + predef Predef_Flag .skip_seen_flag pop af @@ -1360,7 +1360,7 @@ ComputeNPCTrademonStats: ; e134 ld a, MON_STAT_EXP - 1 call GetPartyParamLocation ld b, $1 - call CalcPkmnStats + call Predef_CalcPkmnStats pop de ld a, MON_HP call GetPartyParamLocation @@ -1372,7 +1372,7 @@ ComputeNPCTrademonStats: ; e134 ret ; e167 -CalcPkmnStats: ; e167 +Predef_CalcPkmnStats: ; e167 ; Calculates all 6 Stats of a Pkmn ; b: Take into account stat EXP if TRUE ; 'c' counts from 1-6 and points with 'BaseStats' to the base value @@ -1382,7 +1382,7 @@ CalcPkmnStats: ; e167 ld c, $0 .loop inc c - call CalcPkmnStatC + call Predef_CalcPkmnStatC ld a, [hMultiplicand + 1] ld [de], a inc de @@ -1395,7 +1395,7 @@ CalcPkmnStats: ; e167 ret ; e17b -CalcPkmnStatC: ; e17b +Predef_CalcPkmnStatC: ; e17b ; 'c' is 1-6 and points to the BaseStat ; 1: HP ; 2: Attack @@ -1596,7 +1596,7 @@ GivePoke:: ; e277 push bc xor a ; PARTYMON ld [MonType], a - call TryAddMonToParty + call Predef_TryAddMonToParty jr nc, .failed ld hl, PartyMonNicknames ld a, [PartyCount] @@ -1626,7 +1626,7 @@ GivePoke:: ; e277 ld a, [CurPartySpecies] ld [TempEnemyMonSpecies], a callfar LoadEnemyMon - call SentPkmnIntoBox + call Predef_SendPkmnIntoBox jp nc, .FailedToGiveMon ld a, BOXMON ld [MonType], a diff --git a/engine/mystery_gift.asm b/engine/mystery_gift.asm index c4a047e7e..e7cb4ea91 100755 --- a/engine/mystery_gift.asm +++ b/engine/mystery_gift.asm @@ -1117,7 +1117,7 @@ MysteryGift_CheckAndSetDecorationAlreadyReceived: ; 105069 (41:5069) ld d, $0 ld b, CHECK_FLAG ld hl, sMysteryGiftDecorationsReceived - predef_id FlagPredef + predef_id Predef_Flag push hl push bc call Predef @@ -1129,7 +1129,7 @@ MysteryGift_CheckAndSetDecorationAlreadyReceived: ; 105069 (41:5069) ret nz call GetMysteryGiftBank ld b, SET_FLAG - predef FlagPredef + predef Predef_Flag call CloseSRAM xor a ret @@ -1142,7 +1142,7 @@ MysteryGift_CopyReceivedDecosToPC: ; 105091 (41:5091) ld d, $0 ld b, CHECK_FLAG ld hl, sMysteryGiftDecorationsReceived - predef FlagPredef + predef Predef_Flag ld a, c and a pop bc diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index f34ca520e..6f9a0f557 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -103,7 +103,7 @@ NamingScreen: ; 116c1 inc de hlcoord 5, 4 call PlaceString - farcall GetGender + farcall Predef_GetGender jr c, .genderless ld a, "♂" jr nz, .place_gender diff --git a/engine/npctrade.asm b/engine/npctrade.asm index 49c22829e..c1726ed04 100755 --- a/engine/npctrade.asm +++ b/engine/npctrade.asm @@ -67,7 +67,7 @@ NPCTrade:: ; fcba8 push af ld a, [wcf64] push af - predef TradeAnimation + predef Predef_TradeAnimation pop af ld [wcf64], a pop af @@ -88,12 +88,12 @@ CheckTradeGender: ; fcc23 cp 1 jr z, .check_male - farcall GetGender + farcall Predef_GetGender jr nz, .not_matching jr .matching .check_male - farcall GetGender + farcall Predef_GetGender jr z, .not_matching .matching @@ -109,7 +109,7 @@ TradeFlagAction: ; fcc4a ld hl, wTradeFlags ld a, [wJumptableIndex] ld c, a - predef FlagPredef + predef Predef_Flag ld a, c and a ret @@ -196,7 +196,7 @@ DoNPCTrade: ; fcc63 ld [MonType], a ld [wPokemonWithdrawDepositParameter], a callfar RemoveMonFromPartyOrBox - predef TryAddMonToParty + predef Predef_TryAddMonToParty ld e, TRADE_DIALOG call GetTradeAttribute diff --git a/engine/party_menu.asm b/engine/party_menu.asm index 0415e29e4..59a9904aa 100644 --- a/engine/party_menu.asm +++ b/engine/party_menu.asm @@ -188,7 +188,7 @@ PlacePartymonHPBar: ; 50117 ld d, a ld a, [hli] ld e, a - predef ComputeHPBarPixels + predef Predef_ComputeHPBarPixels ret ; 50138 @@ -297,7 +297,7 @@ PlacePartyMonStatus: ; 501b2 ld e, l ld d, h pop hl - call PlaceStatusString + call Predef_PlaceStatusString .next pop hl @@ -329,7 +329,7 @@ PlacePartyMonTMHMCompatibility: ; 501e0 add hl, de ld a, [hl] ld [CurPartySpecies], a - predef CanLearnTMHMMove + predef Predef_CanLearnTMHMMove pop hl call .PlaceAbleNotAble call PlaceString @@ -468,7 +468,7 @@ PlacePartyMonGender: ; 502b1 ld [CurPartyMon], a xor a ld [MonType], a - call GetGender + call Predef_GetGender ld de, .unknown jr c, .got_gender ld de, .male diff --git a/engine/pic_animation.asm b/engine/pic_animation.asm index 09c800c60..0356f9922 100644 --- a/engine/pic_animation.asm +++ b/engine/pic_animation.asm @@ -1,54 +1,54 @@ ; Pic animation arrangement. -AnimateMon_Slow_Normal: ; d0000 +UnusedPredef_AnimateMon_Slow_Normal: ; d0000 hlcoord 12, 0 ld a, [wBattleMode] cp WILD_BATTLE jr z, .wild ld e, ANIM_MON_SLOW ld d, $0 - call AnimateFrontpic + call Predef_AnimateFrontpic ret .wild ld e, ANIM_MON_NORMAL ld d, $0 - call AnimateFrontpic + call Predef_AnimateFrontpic ret ; d001a AnimateMon_Menu: ; d001a ld e, ANIM_MON_MENU ld d, $0 - call AnimateFrontpic + call Predef_AnimateFrontpic ret ; d0022 AnimateMon_Trade: ; d0022 ld e, ANIM_MON_TRADE ld d, $0 - call AnimateFrontpic + call Predef_AnimateFrontpic ret ; d002a AnimateMon_Evolve: ; d002a ld e, ANIM_MON_EVOLVE ld d, $0 - call AnimateFrontpic + call Predef_AnimateFrontpic ret ; d0032 AnimateMon_Hatch: ; d0032 ld e, ANIM_MON_HATCH ld d, $0 - call AnimateFrontpic + call Predef_AnimateFrontpic ret ; d003a AnimateMon_Unused: ; d003a ld e, ANIM_MON_UNUSED ld d, $0 - call AnimateFrontpic + call Predef_AnimateFrontpic ret ; d0042 @@ -86,10 +86,10 @@ PokeAnims: ; d0042 .Egg2: pokeanim Idle, Play -AnimateFrontpic: ; d008e +Predef_AnimateFrontpic: ; d008e call AnimateMon_CheckIfPokemon ret c - call LoadMonAnimation + call Predef_LoadMonAnimation .loop call SetUpPokeAnim push af @@ -99,7 +99,7 @@ AnimateFrontpic: ; d008e ret ; d00a3 -LoadMonAnimation: ; d00a3 +Predef_LoadMonAnimation: ; d00a3 push hl ld c, e ld b, 0 @@ -1114,7 +1114,7 @@ UnusedPredef48: ; d0669 Predef 48 ld a, $1 ld [wBoxAlignment], a -HOF_AnimateFrontpic: ; d066e Predef 49 +HOF_Predef_AnimateFrontpic: ; d066e Predef 49 call AnimateMon_CheckIfPokemon jr c, .fail ld h, d @@ -1122,12 +1122,12 @@ HOF_AnimateFrontpic: ; d066e Predef 49 push bc push hl ld de, vTiles2 - predef GetAnimatedFrontpicPredef + predef Predef_GetAnimatedFrontpic pop hl pop bc ld d, 0 ld e, c - call AnimateFrontpic + call Predef_AnimateFrontpic xor a ld [wBoxAlignment], a ret diff --git a/engine/player_gfx.asm b/engine/player_gfx.asm index cc1d56ae2..15c5756f2 100644 --- a/engine/player_gfx.asm +++ b/engine/player_gfx.asm @@ -30,7 +30,7 @@ MovePlayerPic: ; 88266 xor a ld [hBGMapMode], a lb bc, 7, 7 - predef PlaceGraphic + predef Predef_PlaceGraphic xor a ld [hBGMapThird], a call WaitBGMap @@ -141,7 +141,7 @@ GetChrisBackpic: ; 88830 ld b, BANK(ChrisBackpic) ld de, vTiles2 tile $31 ld c, 7 * 7 - predef DecompressPredef + predef Predef_Decompress ret HOF_LoadTrainerFrontpic: ; 88840 @@ -203,7 +203,7 @@ DrawIntroPlayerPic: ; 88874 ld [hGraphicStartTile], a hlcoord 6, 4 lb bc, 7, 7 - predef PlaceGraphic + predef Predef_PlaceGraphic ret ChrisPic: ; 888a9 diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 9e5f0c411..2f5ade38b 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -441,7 +441,7 @@ DexEntryScreen_MenuActionJumptable: ; 402f2 call Pokedex_GetSelectedMon ld a, [wDexCurrentLocation] ld e, a - predef Pokedex_GetArea + predef Predef_Pokedex_GetArea call Pokedex_BlackOutBG call DelayFrame xor a @@ -2399,7 +2399,7 @@ Pokedex_LoadSelectedMonTiles: ; 4143b ld [CurPartySpecies], a call GetBaseData ld de, vTiles2 - predef GetMonFrontpic + predef Predef_GetMonFrontpic ret .QuestionMark: @@ -2552,7 +2552,7 @@ Pokedex_LoadUnownFrontpicTiles: ; 41a58 (10:5a58) ld [CurPartySpecies], a call GetBaseData ld de, vTiles2 tile $00 - predef GetMonFrontpic + predef Predef_GetMonFrontpic pop af ld [UnownLetter], a ret @@ -2582,7 +2582,7 @@ _NewPokedexEntry: ; 41a7f call WaitBGMap call GetBaseData ld de, vTiles2 - predef GetMonFrontpic + predef Predef_GetMonFrontpic ld a, SCGB_POKEDEX call Pokedex_GetSGBLayout ld a, [CurPartySpecies] diff --git a/engine/pokegear.asm b/engine/pokegear.asm index 2d9dfdbb6..6fe2b0aa5 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -2331,7 +2331,7 @@ HasVisitedSpawn: ; 91c50 ld hl, wVisitedSpawns ld b, CHECK_FLAG ld d, 0 - predef FlagPredef + predef Predef_Flag ld a, c ret @@ -2440,7 +2440,7 @@ FlyMap: ; 91c90 ; 91d11 -Pokedex_GetArea: ; 91d11 +Predef_Pokedex_GetArea: ; 91d11 ; e: Current landmark ld a, [wTownMapPlayerIconLandmark] push af diff --git a/engine/predef.asm b/engine/predef.asm index 0c8a55d90..a8eccfd21 100644 --- a/engine/predef.asm +++ b/engine/predef.asm @@ -30,79 +30,79 @@ PredefPointers:: ; 856b ; $4b Predef pointers ; address, bank - add_predef LearnMove ; $0 + add_predef Predef_LearnMove ; $0 add_predef DummyPredef1 - add_predef HealParty - add_predef FlagPredef - add_predef ComputeHPBarPixels - add_predef FillPP - add_predef TryAddMonToParty - add_predef AddTempmonToParty - add_predef SentGetPkmnIntoFromBox - add_predef SentPkmnIntoBox - add_predef GiveEgg - add_predef AnimateHPBar - add_predef CalcPkmnStats - add_predef CalcPkmnStatC - add_predef CanLearnTMHMMove - add_predef GetTMHMMove - add_predef LinkTextboxPredef ; $ 10 - add_predef PrintMoveDesc - add_predef UpdatePlayerHUD - add_predef PlaceGraphic - add_predef CheckPlayerPartyForFitPkmn - add_predef UpdateEnemyHUD - add_predef StartBattle - add_predef FillInExpBar - add_predef GetBattleMonBackpic ; $18 - add_predef GetEnemyMonFrontpic - add_predef LearnLevelMoves - add_predef FillMoves - add_predef EvolveAfterBattle - add_predef TradeAnimationPlayer2 - add_predef TradeAnimation - add_predef CopyPkmnToTempMon - add_predef ListMoves ; $20 - add_predef PlaceNonFaintStatus + add_predef HealParty ; this is both a special and a predef + add_predef Predef_Flag + add_predef Predef_ComputeHPBarPixels + add_predef Predef_FillPP + add_predef Predef_TryAddMonToParty + add_predef Predef_AddTempmonToParty + add_predef Predef_SendGetPkmnIntoFromBox + add_predef Predef_SendPkmnIntoBox + add_predef Predef_GiveEgg + add_predef Predef_AnimateHPBar + add_predef Predef_CalcPkmnStats + add_predef Predef_CalcPkmnStatC + add_predef Predef_CanLearnTMHMMove + add_predef Predef_GetTMHMMove + add_predef Predef_LinkTextbox ; $ 10 + add_predef Predef_PrintMoveDesc + add_predef Predef_UpdatePlayerHUD + add_predef Predef_PlaceGraphic + add_predef Predef_CheckPlayerPartyForFitPkmn + add_predef Predef_UpdateEnemyHUD + add_predef Predef_StartBattle + add_predef Predef_FillInExpBar + add_predef Predef_GetBattleMonBackpic ; $18 + add_predef Predef_GetEnemyMonFrontpic + add_predef Predef_LearnLevelMoves + add_predef Predef_FillMoves + add_predef Predef_EvolveAfterBattle + add_predef Predef_TradeAnimationPlayer2 + add_predef Predef_TradeAnimation + add_predef Predef_CopyPkmnToTempMon + add_predef Predef_ListMoves ; $20 + add_predef Predef_PlaceNonFaintStatus add_predef UnusedPredef22 - add_predef ListMovePP - add_predef GetGender - add_predef StatsScreenInit - add_predef DrawPlayerHP - add_predef DrawEnemyHP - add_predef PrintTempMonStats ; $28 - add_predef GetTypeName - add_predef PrintMoveType - add_predef PrintType - add_predef PrintMonTypes - add_predef GetUnownLetter - add_predef LoadPoisonBGPals + add_predef Predef_ListMovePP + add_predef Predef_GetGender + add_predef Predef_StatsScreenInit + add_predef Predef_DrawPlayerHP + add_predef Predef_DrawEnemyHP + add_predef Predef_PrintTempMonStats ; $28 + add_predef Predef_GetTypeName + add_predef Predef_PrintMoveType + add_predef Predef_PrintType + add_predef Predef_PrintMonTypes + add_predef Predef_GetUnownLetter + add_predef Predef_LoadPoisonBGPals add_predef DummyPredef2F - add_predef InitSGBBorder ; $30 - add_predef LoadSGBLayout - add_predef Pokedex_GetArea + add_predef Predef_InitSGBBorder ; $30 + add_predef Predef_LoadSGBLayout + add_predef Predef_Pokedex_GetArea add_predef UnusedPredef_CheckContestMon - add_predef DoBattleTransition + add_predef Predef_DoBattleTransition add_predef DummyPredef35 add_predef DummyPredef36 - add_predef PlayBattleAnim + add_predef Predef_PlayBattleAnim add_predef DummyPredef38 ; $38 add_predef DummyPredef39 add_predef DummyPredef3A - add_predef PartyMonItemName - add_predef GetMonFrontpic - add_predef GetMonBackpic - add_predef GetAnimatedFrontpicPredef - add_predef GetTrainerPic - add_predef DecompressPredef ; $40 - add_predef CheckTypeMatchup - add_predef ConvertMon_1to2 - add_predef NewPokedexEntry - add_predef AnimateMon_Slow_Normal - add_predef PlaceStatusString - add_predef LoadMonAnimation - add_predef AnimateFrontpic + add_predef Predef_PartyMonItemName + add_predef Predef_GetMonFrontpic + add_predef Predef_GetMonBackpic + add_predef Predef_GetAnimatedFrontpic + add_predef Predef_GetTrainerPic + add_predef Predef_Decompress ; $40 + add_predef Predef_CheckTypeMatchup + add_predef Predef_ConvertMon_1to2 + add_predef Predef_NewPokedexEntry + add_predef UnusedPredef_AnimateMon_Slow_Normal + add_predef Predef_PlaceStatusString + add_predef Predef_LoadMonAnimation + add_predef Predef_AnimateFrontpic add_predef UnusedPredef48 ; $48 - add_predef HOF_AnimateFrontpic + add_predef HOF_Predef_AnimateFrontpic dbw $ff, InexplicablyEmptyFunction ; ??? ; 864c diff --git a/engine/print_party.asm b/engine/print_party.asm index f2420dfe8..1902ca656 100755 --- a/engine/print_party.asm +++ b/engine/print_party.asm @@ -157,7 +157,7 @@ PrintPartyMonPage1: ; 1dc381 xor a ld [MonType], a - farcall CopyPkmnToTempMon + farcall Predef_CopyPkmnToTempMon hlcoord 0, 7 ld b, 9 ld c, 18 @@ -213,7 +213,7 @@ PrintPartyMonPage1: ; 1dc381 call Function1dc51a call Function1dc52c ld hl, TempMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter ld hl, wBoxAlignment xor a ld [hl], a @@ -241,7 +241,7 @@ PrintPartyMonPage2: ; 1dc47b call LoadFontsBattleExtra xor a ld [MonType], a - farcall CopyPkmnToTempMon + farcall Predef_CopyPkmnToTempMon hlcoord 0, 0 ld b, 15 ld c, 18 @@ -316,7 +316,7 @@ Function1dc51a: ; 1dc51a ; 1dc52c Function1dc52c: ; 1dc52c - farcall GetGender + farcall Predef_GetGender ld a, " " jr c, .got_gender ld a, "♂" diff --git a/engine/printer.asm b/engine/printer.asm index 002620606..0e0696e2b 100755 --- a/engine/printer.asm +++ b/engine/printer.asm @@ -860,7 +860,7 @@ Printer_GetMonGender: ; 8498a (21:498a) ld [CurPartyMon], a ld a, TEMPMON ld [MonType], a - farcall GetGender + farcall Predef_GetGender ld a, " " jr c, .got_gender ld a, "♂" diff --git a/engine/routines/correcterrorsinplayerparty.asm b/engine/routines/correcterrorsinplayerparty.asm index 639e5c544..fcc2f36af 100644 --- a/engine/routines/correcterrorsinplayerparty.asm +++ b/engine/routines/correcterrorsinplayerparty.asm @@ -90,7 +90,7 @@ Unreferenced_CorrectErrorsInPlayerParty: ld hl, MON_STAT_EXP - 1 add hl, bc ld b, $1 - predef CalcPkmnStats + predef Predef_CalcPkmnStats pop hl ld bc, PARTYMON_STRUCT_LENGTH add hl, bc diff --git a/engine/routines/flagpredef.asm b/engine/routines/flagpredef.asm index bd4f37882..8074e9dbe 100644 --- a/engine/routines/flagpredef.asm +++ b/engine/routines/flagpredef.asm @@ -1,4 +1,4 @@ -FlagPredef: ; 4d7c1 +Predef_Flag: ; 4d7c1 ; Perform action b on flag c in flag array hl. ; If checking a flag, check flag array d:hl unless d is 0. diff --git a/engine/routines/newpokedexentry.asm b/engine/routines/newpokedexentry.asm index acf9fca7b..c52188f6e 100644 --- a/engine/routines/newpokedexentry.asm +++ b/engine/routines/newpokedexentry.asm @@ -1,4 +1,4 @@ -NewPokedexEntry: ; fb877 +Predef_NewPokedexEntry: ; fb877 ld a, [hMapAnims] push af xor a diff --git a/engine/routines/placegraphic.asm b/engine/routines/placegraphic.asm index d72364776..28b69fc23 100644 --- a/engine/routines/placegraphic.asm +++ b/engine/routines/placegraphic.asm @@ -1,4 +1,4 @@ -PlaceGraphic: ; 2ef6e +Predef_PlaceGraphic: ; 2ef6e ; Fill wBoxAlignment-aligned box width b height c ; with iterating tile starting from hGraphicStartTile at hl. ; Predef $13 diff --git a/engine/routines/placewaitingtext.asm b/engine/routines/placewaitingtext.asm index 11b747ec5..37fc2a056 100644 --- a/engine/routines/placewaitingtext.asm +++ b/engine/routines/placewaitingtext.asm @@ -11,7 +11,7 @@ PlaceWaitingText:: ; 4000 jr .proceed .notinbattle - predef LinkTextboxPredef + predef Predef_LinkTextbox .proceed hlcoord 4, 11 diff --git a/engine/routines/trademonfrontpic.asm b/engine/routines/trademonfrontpic.asm index e312042ff..2d05a1c04 100644 --- a/engine/routines/trademonfrontpic.asm +++ b/engine/routines/trademonfrontpic.asm @@ -4,13 +4,13 @@ GetTrademonFrontpic: ; 4d7fd ld de, vTiles2 push de push af - predef GetUnownLetter + predef Predef_GetUnownLetter pop af ld [CurPartySpecies], a ld [CurSpecies], a call GetBaseData pop de - predef GetAnimatedFrontpicPredef + predef Predef_GetAnimatedFrontpic ret AnimateTrademonFrontpic: ; 4d81e @@ -34,5 +34,5 @@ AnimateTrademonFrontpic: ; 4d81e hlcoord 7, 2 ld d, $0 ld e, ANIM_MON_TRADE - predef AnimateFrontpic + predef Predef_AnimateFrontpic ret diff --git a/engine/scripting.asm b/engine/scripting.asm index 5965e372e..d8f35bdc6 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -1437,7 +1437,7 @@ Script_startbattle: ; script command 0x5f call BufferScreen - predef StartBattle + predef Predef_StartBattle ld a, [wBattleResult] and $3f ld [ScriptVar], a @@ -2506,7 +2506,7 @@ Script_giveegg: ld [CurPartySpecies], a call GetScriptByte ld [CurPartyLevel], a - farcall GiveEgg + farcall Predef_GiveEgg ret nc ld a, 2 ld [ScriptVar], a diff --git a/engine/sgb_layouts.asm b/engine/sgb_layouts.asm index b6bbe582f..bd0fdbb3b 100644 --- a/engine/sgb_layouts.asm +++ b/engine/sgb_layouts.asm @@ -1,4 +1,4 @@ -LoadSGBLayout: ; 864c +Predef_LoadSGBLayout: ; 864c call CheckCGB jp nz, LoadSGBLayoutCGB diff --git a/engine/specials.asm b/engine/specials.asm index e208c14d4..0291a6d3c 100644 --- a/engine/specials.asm +++ b/engine/specials.asm @@ -70,9 +70,9 @@ SpecialsPointers:: ; c029 add_special Special_FadeBlackQuickly add_special Special_FadeInPalettes add_special Special_FadeInQuickly - add_special Special_ReloadSpritesNoPalettes + add_special ReloadSpritesNoPalettes ; bank 0 add_special ClearBGPalettes ; bank 0 - add_special Special_UpdateTimePals + add_special UpdateTimePals ; bank 0 add_special ClearTileMap ; bank 0 add_special UpdateSprites ; bank 0 add_special ReplaceKrisSprite ; bank 0 @@ -214,7 +214,7 @@ Special_GameCornerPrizeMonCheckDex: ; c230 call FadeToMenu ld a, [ScriptVar] ld [wd265], a - farcall NewPokedexEntry + farcall Predef_NewPokedexEntry call ExitAllMenus ret ; c252 diff --git a/engine/start_menu.asm b/engine/start_menu.asm index 64a740d2a..7a2274b08 100755 --- a/engine/start_menu.asm +++ b/engine/start_menu.asm @@ -25,12 +25,12 @@ StartMenu:: ; 125cd call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap farcall LoadFonts_NoOAMUpdate call .DrawBugContestStatus - call Special_UpdateTimePals + call UpdateTimePals jr .Select .Reopen: call UpdateSprites - call Special_UpdateTimePals + call UpdateTimePals call .SetUpMenuItems ld a, [wBattleMenuCursorBuffer] ld [wMenuCursorBuffer], a @@ -78,7 +78,7 @@ StartMenu:: ; 125cd call ExitMenu .ReturnEnd2: call CloseText - call Special_UpdateTimePals + call UpdateTimePals ret .GetInput: @@ -593,7 +593,7 @@ HasNoItems: ; 129d5 TossItemFromPC: ; 129f4 push de - call PartyMonItemName + call Predef_PartyMonItemName farcall _CheckTossableItem ld a, [wItemAttributeParamBuffer] and a @@ -616,7 +616,7 @@ TossItemFromPC: ; 129f4 pop hl ld a, [CurItemQuantity] call TossItem - call PartyMonItemName + call Predef_PartyMonItemName ld hl, .TossedThisMany call MenuTextBox call ExitMenu @@ -668,7 +668,7 @@ CantUseItemText: ; 12a67 ; 12a6c -PartyMonItemName: ; 12a6c +Predef_PartyMonItemName: ; 12a6c ld a, [CurItem] ld [wd265], a call GetItemName @@ -862,7 +862,7 @@ GiveTakePartyMonItem: ; 12b60 TryGiveItemToPartymon: ; 12bd9 call SpeechTextBox - call PartyMonItemName + call Predef_PartyMonItemName call GetPartyItemLocation ld a, [hl] and a @@ -1225,7 +1225,7 @@ OpenPartyStats: ; 12e00 xor a ld [MonType], a call LowVolume - predef StatsScreenInit + predef Predef_StatsScreenInit call MaxVolume call Call_ExitMenu ld a, 0 @@ -1792,7 +1792,7 @@ SetUpMoveScreenBG: ; 13172 hlcoord 5, 1 call PlaceString push bc - farcall CopyPkmnToTempMon + farcall Predef_CopyPkmnToTempMon pop hl call PrintLevel ld hl, PlayerHPPal @@ -1809,7 +1809,7 @@ SetUpMoveList: ; 131ef ld [hBGMapMode], a ld [wMoveSwapBuffer], a ld [MonType], a - predef CopyPkmnToTempMon + predef Predef_CopyPkmnToTempMon ld hl, TempMonMoves ld de, wListMoves_MoveIndicesBuffer ld bc, NUM_MOVES @@ -1817,9 +1817,9 @@ SetUpMoveList: ; 131ef ld a, SCREEN_WIDTH * 2 ld [Buffer1], a hlcoord 2, 3 - predef ListMoves + predef Predef_ListMoves hlcoord 10, 4 - predef ListMovePP + predef Predef_ListMovePP call WaitBGMap call SetPalettes ld a, [wNumMoves] @@ -1863,7 +1863,7 @@ PlaceMoveData: ; 13256 ld a, [CurMove] ld b, a hlcoord 2, 12 - predef PrintMoveType + predef Predef_PrintMoveType ld a, [CurMove] dec a ld hl, Moves + MOVE_POWER @@ -1886,7 +1886,7 @@ PlaceMoveData: ; 13256 .description hlcoord 1, 14 - predef PrintMoveDesc + predef Predef_PrintMoveDesc ld a, $1 ld [hBGMapMode], a ret diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm index a8f831408..5fce4607a 100755 --- a/engine/stats_screen.asm +++ b/engine/stats_screen.asm @@ -1,14 +1,14 @@ BattleStatsScreenInit: ; 4dc7b (13:5c7b) ld a, [wLinkMode] cp LINK_MOBILE - jr nz, StatsScreenInit + jr nz, Predef_StatsScreenInit ld a, [wBattleMode] and a - jr z, StatsScreenInit + jr z, Predef_StatsScreenInit jr _MobileStatsScreenInit -StatsScreenInit: ; 4dc8a +Predef_StatsScreenInit: ; 4dc8a ld hl, StatsScreenMain jr StatsScreenInit_gotaddress @@ -234,7 +234,7 @@ StatsScreen_CopyToTempMon: ; 4ddf2 (13:5df2) jr .done .breedmon - farcall CopyPkmnToTempMon + farcall Predef_CopyPkmnToTempMon ld a, [CurPartySpecies] cp EGG jr z, .done @@ -419,7 +419,7 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea) ld a, [hli] ld d, a ld e, [hl] - farcall ComputeHPBarPixels + farcall Predef_ComputeHPBarPixels ld hl, wCurHPPal call SetHPPal ld b, SCGB_STATS_SCREEN_HP_PALS @@ -429,7 +429,7 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea) .PlaceGenderChar: ; 4df66 (13:5f66) push hl - farcall GetGender + farcall Predef_GetGender pop hl ret c ld a, "♂" @@ -540,7 +540,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) .PinkPage: ; 4e013 (13:6013) hlcoord 0, 9 ld b, $0 - predef DrawPlayerHP + predef Predef_DrawPlayerHP hlcoord 8, 9 ld [hl], $41 ld de, .Status_Type @@ -562,7 +562,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) hlcoord 6, 13 push hl ld de, TempMonStatus - predef PlaceStatusString + predef Predef_PlaceStatusString pop hl jr nz, .done_status jr .StatusOK @@ -576,7 +576,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) call PlaceString .done_status hlcoord 1, 15 - predef PrintMonTypes + predef Predef_PrintMonTypes hlcoord 9, 8 ld de, SCREEN_WIDTH ld b, 10 @@ -610,7 +610,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ld a, [TempMonLevel] ld b, a ld de, TempMonExp + 2 - predef FillInExpBar + predef Predef_FillInExpBar hlcoord 10, 16 ld [hl], $40 hlcoord 19, 16 @@ -703,11 +703,11 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) hlcoord 8, 10 ld a, SCREEN_WIDTH * 2 ld [Buffer1], a - predef ListMoves + predef Predef_ListMoves hlcoord 12, 11 ld a, SCREEN_WIDTH * 2 ld [Buffer1], a - predef ListMovePP + predef Predef_ListMovePP ret .GetItemName: ; 4e189 (13:6189) @@ -748,7 +748,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) jr nz, .BluePageVerticalDivider hlcoord 11, 8 ld bc, 6 - predef PrintTempMonStats + predef Predef_PrintTempMonStats ret .PlaceOTInfo: ; 4e1cc (13:61cc) @@ -801,7 +801,7 @@ OTString: ; 4e222 StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) ld hl, TempMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter call StatsScreen_GetAnimationParam jr c, .egg and a @@ -863,11 +863,11 @@ StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) ret c call StatsScreen_LoadTextBoxSpaceGFX ld de, vTiles2 tile $00 - predef GetAnimatedFrontpicPredef + predef Predef_GetAnimatedFrontpic hlcoord 0, 0 ld d, $0 ld e, ANIM_MON_MENU - predef LoadMonAnimation + predef Predef_LoadMonAnimation ld hl, wcf64 set 6, [hl] ret @@ -1067,11 +1067,11 @@ StatsScreen_AnimateEgg: ; 4e497 (13:6497) ld [wBoxAlignment], a call StatsScreen_LoadTextBoxSpaceGFX ld de, vTiles2 tile $00 - predef GetAnimatedFrontpicPredef + predef Predef_GetAnimatedFrontpic pop de hlcoord 0, 0 ld d, $0 - predef LoadMonAnimation + predef Predef_LoadMonAnimation ld hl, wcf64 set 6, [hl] ret diff --git a/engine/tempmon.asm b/engine/tempmon.asm index be989d14b..abd85a9ec 100644 --- a/engine/tempmon.asm +++ b/engine/tempmon.asm @@ -1,4 +1,4 @@ -CopyPkmnToTempMon: ; 5084a +Predef_CopyPkmnToTempMon: ; 5084a ; gets the BaseData of a Pkmn ; and copys the PkmnStructure to TempMon @@ -51,7 +51,7 @@ _TempMonStatsCalculation: ; 50893 add hl, bc push bc ld b, $1 - predef CalcPkmnStats + predef Predef_CalcPkmnStats pop bc ld hl, MON_HP add hl, bc diff --git a/engine/time_capsule_2.asm b/engine/time_capsule_2.asm index 5da72e7c8..d50bffd3f 100644 --- a/engine/time_capsule_2.asm +++ b/engine/time_capsule_2.asm @@ -18,7 +18,7 @@ ConvertMon_2to1: ; fb8f1 ret ; fb908 -ConvertMon_1to2: ; fb908 +Predef_ConvertMon_1to2: ; fb908 ; Takes the Gen-1 Pokemon number stored in wd265 and returns the corresponding value from Pokered_MonIndices in wd265. push bc push hl diff --git a/engine/timeofdaypals.asm b/engine/timeofdaypals.asm index 31a55a7d8..3679f2d23 100644 --- a/engine/timeofdaypals.asm +++ b/engine/timeofdaypals.asm @@ -98,7 +98,7 @@ _TimeOfDayPals:: ; 8c011 ld [rSVBK], a ; update palettes - call _Special_UpdateTimePals + call _UpdateTimePals call DelayFrame ; successful change @@ -112,7 +112,7 @@ _TimeOfDayPals:: ; 8c011 ; 8c070 -_Special_UpdateTimePals:: ; 8c070 +_UpdateTimePals:: ; 8c070 ld c, $9 ; normal call GetTimePalFade call DmgToCgbTimePals diff --git a/engine/tmhm.asm b/engine/tmhm.asm index 6a9c76f00..d149e02d6 100755 --- a/engine/tmhm.asm +++ b/engine/tmhm.asm @@ -1,4 +1,4 @@ -CanLearnTMHMMove: ; 11639 +Predef_CanLearnTMHMMove: ; 11639 ld a, [CurPartySpecies] ld [CurSpecies], a call GetBaseData @@ -23,7 +23,7 @@ CanLearnTMHMMove: ; 11639 ld b, CHECK_FLAG push de ld d, 0 - predef FlagPredef + predef Predef_Flag pop de ret @@ -33,7 +33,7 @@ CanLearnTMHMMove: ; 11639 ret ; 1166a -GetTMHMMove: ; 1166a +Predef_GetTMHMMove: ; 1166a ld a, [wd265] dec a ld hl, TMHMMoves diff --git a/engine/tmhm2.asm b/engine/tmhm2.asm index 90e993a8b..fc5923238 100755 --- a/engine/tmhm2.asm +++ b/engine/tmhm2.asm @@ -38,7 +38,7 @@ ConvertCurItemIntoCurTMHM: ; 2c7a7 (b:47a7) GetTMHMItemMove: ; 2c7b6 (b:47b6) call ConvertCurItemIntoCurTMHM - predef GetTMHMMove + predef Predef_GetTMHMMove ret AskTeachTMHM: ; 2c7bf (b:47bf) @@ -118,7 +118,7 @@ ChooseMonToLearnTMHM_NoRefresh: ; 2c80a ; 2c867 TeachTMHM: ; 2c867 - predef CanLearnTMHMMove + predef Predef_CanLearnTMHMMove push bc ld a, [CurPartyMon] @@ -141,7 +141,7 @@ TeachTMHM: ; 2c867 callfar KnowsMove jr c, .nope - predef LearnMove + predef Predef_LearnMove ld a, b and a jr z, .nope @@ -258,11 +258,11 @@ TMHM_ShowTMMoveDescription: ; 2c946 (b:4946) cp NUM_TMS + NUM_HMS + 1 jr nc, TMHM_JoypadLoop ld [wd265], a - predef GetTMHMMove + predef Predef_GetTMHMMove ld a, [wd265] ld [CurSpecies], a hlcoord 1, 14 - call PrintMoveDesc + call Predef_PrintMoveDesc jp TMHM_JoypadLoop TMHM_ChooseTMorHM: ; 2c974 (b:4974) @@ -386,7 +386,7 @@ TMHM_DisplayPocketItems: ; 2c9e2 (b:49e2) pop af ld [wd265], a .okay - predef GetTMHMMove + predef Predef_GetTMHMMove ld a, [wd265] ld [wPutativeTMHMMove], a call GetMoveName @@ -451,7 +451,7 @@ Unreferenced_Function2ca95: ; 2ca95 pop hl ld bc, 3 add hl, bc - predef GetTMHMMove + predef Predef_GetTMHMMove ld a, [wd265] ld [wPutativeTMHMMove], a call GetMoveName @@ -572,7 +572,7 @@ CountTMsHMs: ; 2cb2a (b:4b2a) ld [wd265], a ret -PrintMoveDesc: ; 2cb3e +Predef_PrintMoveDesc: ; 2cb3e push hl ld hl, MoveDescriptions ld a, [CurSpecies] diff --git a/engine/trade_animation.asm b/engine/trade_animation.asm index d5b97d563..10e657819 100755 --- a/engine/trade_animation.asm +++ b/engine/trade_animation.asm @@ -1,4 +1,4 @@ -TradeAnimation: ; 28f24 +Predef_TradeAnimation: ; 28f24 xor a ld [wcf66], a ld hl, wPlayerTrademonSenderName @@ -49,7 +49,7 @@ TradeAnimation: ; 28f24 tradeanim_scroll_out_right tradeanim_end -TradeAnimationPlayer2: ; 28f63 +Predef_TradeAnimationPlayer2: ; 28f63 xor a ld [wcf66], a ld hl, wOTTrademonSenderName @@ -871,13 +871,13 @@ TradeAnim_AnimateFrontpic: ; 29487 TradeAnim_GetFrontpic: ; 29491 push de push af - predef GetUnownLetter + predef Predef_GetUnownLetter pop af ld [CurPartySpecies], a ld [CurSpecies], a call GetBaseData pop de - predef GetMonFrontpic + predef Predef_GetMonFrontpic ret ; 294a9 @@ -911,7 +911,7 @@ TradeAnim_ShowFrontpic: ; 294c3 xor a ld [hGraphicStartTile], a lb bc, 7, 7 - predef PlaceGraphic + predef Predef_PlaceGraphic call WaitBGMap ret diff --git a/engine/trainer_card.asm b/engine/trainer_card.asm index 67bc05533..6be9af166 100755 --- a/engine/trainer_card.asm +++ b/engine/trainer_card.asm @@ -243,7 +243,7 @@ TrainerCard_PrintTopHalfOfCard: ; 25299 (9:5299) lb bc, 5, 7 xor a ld [hGraphicStartTile], a - predef PlaceGraphic + predef Predef_PlaceGraphic ret ; 252ec (9:52ec) diff --git a/engine/types.asm b/engine/types.asm index 375bfe434..7808abcb1 100644 --- a/engine/types.asm +++ b/engine/types.asm @@ -1,4 +1,4 @@ -PrintMonTypes: ; 5090d +Predef_PrintMonTypes: ; 5090d ; Print one or both types of [CurSpecies] ; on the stats screen at hl. @@ -24,7 +24,7 @@ PrintMonTypes: ; 5090d .Print: ld b, a - jr PrintType + jr Predef_PrintType .hide_type_2 ; Erase any type name that was here before. @@ -40,7 +40,7 @@ PrintMonTypes: ; 5090d ; 5093a -PrintMoveType: ; 5093a +Predef_PrintMoveType: ; 5093a ; Print the type of move b at hl. push hl @@ -58,7 +58,7 @@ PrintMoveType: ; 5093a ld b, a -PrintType: ; 50953 +Predef_PrintType: ; 50953 ; Print type b at hl. ld a, b @@ -78,7 +78,7 @@ PrintType: ; 50953 ; 50964 -GetTypeName: ; 50964 +Predef_GetTypeName: ; 50964 ; Copy the name of type [wd265] to StringBuffer1. ld a, [wd265] -- cgit v1.2.3 From b4e087167f3263342bbe01b5256f42fcf2d726af Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 2 Jan 2018 19:38:56 +0100 Subject: More unreferenced labels and unused text --- engine/battle/core.asm | 2 +- engine/battle_anims/anim_commands.asm | 3 +-- engine/billspc.asm | 3 +-- engine/billspctop.asm | 4 ++-- engine/clock_reset.asm | 1 + engine/events.asm | 1 + engine/events_2.asm | 2 +- engine/mart.asm | 2 +- engine/namingscreen.asm | 6 +++--- engine/party_menu.asm | 14 +++++++++++--- engine/player_movement.asm | 2 +- engine/pokegear.asm | 2 +- engine/slot_machine.asm | 4 ++-- engine/specials.asm | 2 +- engine/sprites.asm | 3 +-- engine/start_menu.asm | 2 +- engine/trade_animation.asm | 4 ++-- 17 files changed, 32 insertions(+), 25 deletions(-) (limited to 'engine') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 9b00ba161..50e94c6d8 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -8091,7 +8091,7 @@ TextJump_GoodComeBack: ; 3f352 db "@" ; 3f357 -UnusedFunction_TextJump_ComeBack: ; 3f357 +Unreferenced_TextJump_ComeBack: ; 3f357 ; this function doesn't seem to be used ld hl, TextJump_ComeBack ret diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index 29bb3c215..50f412ce2 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -232,8 +232,7 @@ ClearActorHud: ; cc207 ret ; cc220 -Functioncc220: ; cc220 -; Appears to be unused. +Unreferenced_Functioncc220: ; cc220 xor a ld [hBGMapMode], a ld a, LOW(vBGMap0 tile $28) diff --git a/engine/billspc.asm b/engine/billspc.asm index 8bb2056ca..23679197f 100755 --- a/engine/billspc.asm +++ b/engine/billspc.asm @@ -246,7 +246,6 @@ BillsPCDepositMenuDataHeader: ; 0xe253d (38:653d) ; 0xe2564 (38:6564) Unreferenced_BillsPCClearThreeBoxes: ; e2564 -; unreferenced hlcoord 0, 0 ld b, 4 ld c, 8 @@ -1586,7 +1585,7 @@ endr db -1 ; e2ed5 -BillsPC_UnusedFillBox: ; e2ed5 +Unreferenced_BillsPC_FillBox: ; e2ed5 .row push bc push hl diff --git a/engine/billspctop.asm b/engine/billspctop.asm index 699fa7887..3fc99920a 100755 --- a/engine/billspctop.asm +++ b/engine/billspctop.asm @@ -143,7 +143,7 @@ BillsPC_DepositMenu: ; e4fe (3:64fe) and a ret -Functione512: ; unused +Unreferenced_Functione512: ld a, [PartyCount] and a jr z, .no_pkmn @@ -212,7 +212,7 @@ BillsPC_WithdrawMenu: ; e559 (3:6559) and a ret -Functione56d: ; unused +Unreferenced_Functione56d: ld a, [PartyCount] cp PARTY_LENGTH jr nc, .asm_e576 diff --git a/engine/clock_reset.asm b/engine/clock_reset.asm index c81271442..82b81b85c 100755 --- a/engine/clock_reset.asm +++ b/engine/clock_reset.asm @@ -220,6 +220,7 @@ RestartClock: ; 20021 (8:4021) ret ; 20160 (8:4160) +; unused .unreferenced ; 20160 ld a, [Buffer3] ld b, a diff --git a/engine/events.asm b/engine/events.asm index 7dd87a318..7f362e07d 100644 --- a/engine/events.asm +++ b/engine/events.asm @@ -994,6 +994,7 @@ CountStep: ; 96b79 ret ; 96bd3 +; unused .unreferenced ; 96bd3 ld a, 7 scf diff --git a/engine/events_2.asm b/engine/events_2.asm index aaf6995b2..e4458d9aa 100644 --- a/engine/events_2.asm +++ b/engine/events_2.asm @@ -361,7 +361,7 @@ HandleCmdQueue:: ; 97e08 ret ; 97e25 -GetNthCmdQueueEntry: ; 97e25 unreferenced +Unreferenced_GetNthCmdQueueEntry: ; 97e25 ld hl, wCmdQueue ld bc, CMDQUEUE_ENTRY_SIZE call AddNTimes diff --git a/engine/mart.asm b/engine/mart.asm index 4eff21fa3..1dcf508e6 100755 --- a/engine/mart.asm +++ b/engine/mart.asm @@ -892,7 +892,7 @@ Text_Mart_ICanPayThisMuch: ; 0x15f78 db "@" ; 0x15f7d -DummyString ; 15f7d +.UnusedString15f7d: ; 15f7d db "!ダミー!@" Text_Mart_HowMayIHelpYou: ; 0x15f83 diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index 6f9a0f557..c674a3b8c 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -765,7 +765,7 @@ NamingScreen_AdvanceCursor_CheckEndOfString: ; 11b27 ; 11b56 -Dakutens: ; Dummied out +Dakutens: ; unused db "かが", "きぎ", "くぐ", "けげ", "こご" db "さざ", "しじ", "すず", "せぜ", "そぞ" db "ただ", "ちぢ", "つづ", "てで", "とど" @@ -776,7 +776,7 @@ Dakutens: ; Dummied out db "ハバ", "ヒビ", "フブ", "へべ", "ホボ" db $ff -Handakutens: ; Dummied out +Handakutens: ; unused db "はぱ", "ひぴ", "ふぷ", "へぺ", "ほぽ" db "ハパ", "ヒピ", "フプ", "へぺ", "ホポ" db $ff @@ -1051,7 +1051,7 @@ INCBIN "gfx/icon/mail2.2bpp" ; 11f7a (4:5f7a) -.Dummy: ; dummied out +.UnusedString11f7a: db "メールを かいてね@" ; 11f84 diff --git a/engine/party_menu.asm b/engine/party_menu.asm index 59a9904aa..13181c626 100644 --- a/engine/party_menu.asm +++ b/engine/party_menu.asm @@ -817,25 +817,33 @@ PartyMenuStrings: ; 0x504d2 ChooseAMonString: ; 0x504e4 db "Choose a #MON.@" + UseOnWhichPKMNString: ; 0x504f3 db "Use on which ?@" + WhichPKMNString: ; 0x50504 db "Which ?@" + TeachWhichPKMNString: ; 0x5050e db "Teach which ?@" + MoveToWhereString: ; 0x5051e db "Move to where?@" -ChooseAFemalePKMNString: ; 0x5052d ; UNUSED + +ChooseAFemalePKMNString: ; 0x5052d +; unused db "Choose a ♀.@" -ChooseAMalePKMNString: ; 0x5053b ; UNUSED + +ChooseAMalePKMNString: ; 0x5053b +; unused db "Choose a ♂.@" + ToWhichPKMNString: ; 0x50549 db "To which ?@" YouHaveNoPKMNString: ; 0x50556 db "You have no !@" - PrintPartyMenuActionText: ; 50566 ld a, [CurPartyMon] ld hl, PartyMonNicknames diff --git a/engine/player_movement.asm b/engine/player_movement.asm index fa7cc84a5..57d18444f 100755 --- a/engine/player_movement.asm +++ b/engine/player_movement.asm @@ -316,7 +316,7 @@ DoPlayerMovement:: ; 80000 scf ret -; unused? +; unused xor a ret diff --git a/engine/pokegear.asm b/engine/pokegear.asm index 6fe2b0aa5..0c9a991ac 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -1751,7 +1751,7 @@ LoadStation_EvolutionRadio: ; 9183e (24:583e) ; 91853 (24:5853) -LoadStation_Dummy: ; 91853 +Unreferenced_LoadStation: ; 91853 ret RadioMusicRestartDE: ; 91854 (24:5854) diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index e2292a6d8..26ffc7623 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -183,7 +183,7 @@ SlotsLoop: ; 927af (24:67af) ld [wCurrSpriteOAMAddr], a callfar DoNextFrameForFirst16Sprites call .PrintCoinsAndPayout - call .DummyFunc + call .Stubbed_Function927d3 call DelayFrame and a ret @@ -192,7 +192,7 @@ SlotsLoop: ; 927af (24:67af) scf ret -.DummyFunc: ; 927d3 (24:67d3) +.Stubbed_Function927d3: ; 927d3 (24:67d3) ; dummied out ret ld a, [wReel1ReelAction] diff --git a/engine/specials.asm b/engine/specials.asm index 0291a6d3c..60c5b745c 100644 --- a/engine/specials.asm +++ b/engine/specials.asm @@ -141,7 +141,7 @@ SpecialsPointers:: ; c029 add_special Special_Function1700ba add_special Special_Function170114 add_special Special_BattleTowerBattle - add_special Special_Function1704e1 + add_special UnusedSpecial_Function1704e1 add_special DummySpecial17021d add_special Special_LoadOpponentTrainerAndPokemonWithOTSprite add_special Special_Function11ba38 diff --git a/engine/sprites.asm b/engine/sprites.asm index e1aad4832..6551747c4 100755 --- a/engine/sprites.asm +++ b/engine/sprites.asm @@ -527,8 +527,7 @@ GetFrameOAMPointer: ; 8d1a2 ret ; 8d1ac -BrokenGetStdGraphics: ; 8d1ac -; dummied out +Unreferenced_BrokenGetStdGraphics: ; 8d1ac push hl ld l, a ld h, 0 diff --git a/engine/start_menu.asm b/engine/start_menu.asm index 7a2274b08..8f7488435 100755 --- a/engine/start_menu.asm +++ b/engine/start_menu.asm @@ -1268,7 +1268,7 @@ MonMenu_Fly: ; 12e30 ld a, $0 ret -.Unused: +.Unreferenced: ld a, $1 ret ; 12e55 diff --git a/engine/trade_animation.asm b/engine/trade_animation.asm index 10e657819..89a3ccefb 100755 --- a/engine/trade_animation.asm +++ b/engine/trade_animation.asm @@ -1563,8 +1563,8 @@ TradeAnim_WaitAnim2: ; 29886 ; 29893 -DebugTrade: ; 29893 -; This function is unreferenced. +Unreferenced_DebugTrade: ; 29893 +; This function is not referenced. ; It was meant for use in Japanese versions, so the ; constant used for copy length was changed by accident. -- cgit v1.2.3 From aa9a0a900ddeaa79a05f1b93458a8b19ae170d69 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 2 Jan 2018 20:00:14 +0100 Subject: No more mobile EQUS ret (replace with Stubbed_ + ret) --- engine/battle/core.asm | 23 ++++++++++++----------- engine/battle/effect_commands.asm | 4 ++-- engine/breeding.asm | 2 +- engine/color.asm | 3 ++- engine/events/bug_contest/judging.asm | 2 +- engine/events/fruit_trees.asm | 2 +- engine/events/lucky_number.asm | 2 +- engine/events/magikarp.asm | 2 +- engine/events/overworld.asm | 4 ++-- engine/events/std_scripts.asm | 2 +- engine/events/whiteout.asm | 2 +- engine/events_3.asm | 2 +- engine/evolve.asm | 2 +- engine/item_effects.asm | 2 +- engine/link.asm | 2 +- engine/map_objects.asm | 7 ++++--- engine/mystery_gift.asm | 2 +- engine/phone/phone.asm | 4 ++-- engine/player_step.asm | 2 +- engine/scripting.asm | 4 ++-- engine/slot_machine.asm | 8 ++++---- engine/specials.asm | 2 +- engine/start_menu.asm | 2 +- engine/tmhm2.asm | 2 +- 24 files changed, 46 insertions(+), 43 deletions(-) (limited to 'engine') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 50e94c6d8..b5ca19562 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -160,7 +160,7 @@ WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5 BattleTurn: ; 3c12f .loop - call MobileFn_3c1bf + call Stubbed_Function3c1bf call CheckContestBattleOver jp c, .quit @@ -231,7 +231,8 @@ BattleTurn: ; 3c12f ret ; 3c1bf -MobileFn_3c1bf: mobile +Stubbed_Function3c1bf: + ret ld a, $5 call GetSRAMBank ld hl, $a89b ; s5_a89b @@ -2588,7 +2589,7 @@ AddBattleMoneyToAccount: ; 3d0be push bc ld b, h ld c, l - farcall TrainerRankings_AddToBattlePayouts + farcall StubbedTrainerRankings_AddToBattlePayouts pop bc pop hl .loop @@ -8375,7 +8376,7 @@ Unreferenced_DoBattle: ; 3f4d9 ; 3f4dd BattleIntro: ; 3f4dd - farcall TrainerRankings_Battles ; mobile + farcall StubbedTrainerRankings_Battles ; mobile call LoadTrainerOrWildMonPic xor a ld [TempBattleMonSpecies], a @@ -8460,7 +8461,7 @@ BackUpBGMap2: ; 3f568 InitEnemyTrainer: ; 3f594 ld [TrainerClass], a - farcall TrainerRankings_TrainerBattles + farcall StubbedTrainerRankings_TrainerBattles xor a ld [TempEnemyMonSpecies], a callfar GetTrainerAttributes @@ -8516,7 +8517,7 @@ InitEnemyTrainer: ; 3f594 InitEnemyWildmon: ; 3f607 ld a, WILD_BATTLE ld [wBattleMode], a - farcall TrainerRankings_WildBattles + farcall StubbedTrainerRankings_WildBattles call LoadEnemyMon ld hl, EnemyMonMoves ld de, wWildMonMoves @@ -8698,7 +8699,7 @@ CheckPayDay: ; 3f71d ; 3f759 ShowLinkBattleParticipantsAfterEnd: ; 3f759 - farcall TrainerRankings_LinkBattles + farcall StubbedTrainerRankings_LinkBattles farcall BackupMobileEventIndex ld a, [CurOTMon] ld hl, OTPartyMon1Status @@ -8728,17 +8729,17 @@ DisplayLinkBattleResult: ; 3f77c cp $1 jr c, .victory jr z, .loss - farcall TrainerRankings_ColosseumDraws + farcall StubbedTrainerRankings_ColosseumDraws ld de, .Draw jr .store_result .victory - farcall TrainerRankings_ColosseumWins + farcall StubbedTrainerRankings_ColosseumWins ld de, .Win jr .store_result .loss - farcall TrainerRankings_ColosseumLosses + farcall StubbedTrainerRankings_ColosseumLosses ld de, .Lose jr .store_result @@ -9486,7 +9487,7 @@ BattleStartMessage: ; 3fc8b cp BATTLETYPE_FISH jr nz, .NotFishing - farcall TrainerRankings_HookedEncounters + farcall StubbedTrainerRankings_HookedEncounters ld hl, HookedPokemonAttackedText jr .PlaceBattleStartText diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index d0a126b98..c5a82f1bf 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -8078,7 +8078,7 @@ BattleCommand_LeechSeed: ; 36f9d BattleCommand_Splash: ; 36fe1 call AnimateCurrentMove - farcall TrainerRankings_Splash + farcall StubbedTrainerRankings_Splash jp PrintNothingHappened ; 36fed @@ -8605,7 +8605,7 @@ CheckSubstituteOpp: ; 37378 BattleCommand_Selfdestruct: ; 37380 - farcall TrainerRankings_Selfdestruct + farcall StubbedTrainerRankings_Selfdestruct ld a, BATTLEANIM_PLAYER_DAMAGE ld [wNumHits], a ld c, 3 diff --git a/engine/breeding.asm b/engine/breeding.asm index 1d075ee81..02a86ce47 100755 --- a/engine/breeding.asm +++ b/engine/breeding.asm @@ -232,7 +232,7 @@ HatchEggs: ; 16f70 (5:6f70) push de farcall SetEggMonCaughtData - farcall TrainerRankings_EggsHatched + farcall StubbedTrainerRankings_EggsHatched ld a, [CurPartyMon] ld hl, PartyMon1Species ld bc, PARTYMON_STRUCT_LENGTH diff --git a/engine/color.asm b/engine/color.asm index 73427f843..9d49c6306 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -737,7 +737,8 @@ GetMonPalettePointer_: call GetMonPalettePointer ret -Function9779: mobile +Unreferenced_Function9779: + ret call CheckCGB ret z ld hl, BattleObjectPals diff --git a/engine/events/bug_contest/judging.asm b/engine/events/bug_contest/judging.asm index 8e4b063d6..0dbd27024 100755 --- a/engine/events/bug_contest/judging.asm +++ b/engine/events/bug_contest/judging.asm @@ -1,6 +1,6 @@ _Special_BugContestJudging: ; 1369d call ContestScore - farcall TrainerRankings_BugContestScore + farcall StubbedTrainerRankings_BugContestScore call BugContest_JudgeContestants ld a, [wBugContestThirdPlaceWinnerID] call LoadContestantName diff --git a/engine/events/fruit_trees.asm b/engine/events/fruit_trees.asm index d0b0bac15..139c27612 100644 --- a/engine/events/fruit_trees.asm +++ b/engine/events/fruit_trees.asm @@ -58,7 +58,7 @@ CheckFruitTree: ; 44055 ; 4405f PickedFruitTree: ; 4405f - farcall TrainerRankings_FruitPicked + farcall StubbedTrainerRankings_FruitPicked ld b, 1 jp GetFruitTreeFlag ; 4406a diff --git a/engine/events/lucky_number.asm b/engine/events/lucky_number.asm index 4488cfcc9..a172fc431 100644 --- a/engine/events/lucky_number.asm +++ b/engine/events/lucky_number.asm @@ -103,7 +103,7 @@ Special_CheckForLuckyNumberWinners: ; 4d87a ld a, [ScriptVar] and a ret z ; found nothing - farcall TrainerRankings_LuckyNumberShow + farcall StubbedTrainerRankings_LuckyNumberShow ld a, [wFoundMatchingIDInParty] and a push af diff --git a/engine/events/magikarp.asm b/engine/events/magikarp.asm index 68e8baad7..5f21e978c 100644 --- a/engine/events/magikarp.asm +++ b/engine/events/magikarp.asm @@ -28,7 +28,7 @@ Special_CheckMagikarpLength: ; fbb32 ld c, l call CalcMagikarpLength call PrintMagikarpLength - farcall TrainerRankings_MagikarpLength + farcall StubbedTrainerRankings_MagikarpLength ld hl, .MeasureItText call PrintText diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm index 27f3fd595..c9e0a5fe5 100755 --- a/engine/events/overworld.asm +++ b/engine/events/overworld.asm @@ -427,7 +427,7 @@ UsedSurfScript: ; c986 end .empty_fn ; c9a2 - farcall TrainerRankings_Surf + farcall StubbedTrainerRankings_Surf ret UsedSurfText: ; c9a9 @@ -700,7 +700,7 @@ Script_UsedWaterfall: ; 0xcb20 ld a, [PlayerStandingTile] call CheckWaterfallTile ret z - farcall TrainerRankings_Waterfall + farcall StubbedTrainerRankings_Waterfall ld a, $1 ld [ScriptVar], a ret diff --git a/engine/events/std_scripts.asm b/engine/events/std_scripts.asm index beb118e5c..69fcc3ca7 100644 --- a/engine/events/std_scripts.asm +++ b/engine/events/std_scripts.asm @@ -107,7 +107,7 @@ PokecenterNurseScript: farwritetext NurseTakePokemonText pause 20 - special Special_TrainerRankings_Healings + special Special_StubbedTrainerRankings_Healings spriteface LAST_TALKED, LEFT pause 10 special HealParty diff --git a/engine/events/whiteout.asm b/engine/events/whiteout.asm index 1ad5c9c65..a9bee4c2b 100755 --- a/engine/events/whiteout.asm +++ b/engine/events/whiteout.asm @@ -49,7 +49,7 @@ BattleBGMap: ; 1250a ; 12513 HalveMoney: ; 12513 - farcall TrainerRankings_WhiteOuts + farcall StubbedTrainerRankings_WhiteOuts ; Halve the player's money. ld hl, Money diff --git a/engine/events_3.asm b/engine/events_3.asm index 5ee113a95..30a587576 100755 --- a/engine/events_3.asm +++ b/engine/events_3.asm @@ -360,7 +360,7 @@ CheckForHiddenItems: ; b8172 TreeMonEncounter: ; b81ea - farcall TrainerRankings_TreeEncounters + farcall StubbedTrainerRankings_TreeEncounters xor a ld [TempWildMonSpecies], a diff --git a/engine/evolve.asm b/engine/evolve.asm index c1328e34f..4f2576f89 100755 --- a/engine/evolve.asm +++ b/engine/evolve.asm @@ -247,7 +247,7 @@ EvolveAfterBattle_MasterLoop push hl ld hl, Text_EvolvedIntoPKMN call PrintTextBoxText - farcall TrainerRankings_MonsEvolved + farcall StubbedTrainerRankings_MonsEvolved ld de, MUSIC_NONE call PlayMusic diff --git a/engine/item_effects.asm b/engine/item_effects.asm index 78506604d..67ea58612 100644 --- a/engine/item_effects.asm +++ b/engine/item_effects.asm @@ -517,7 +517,7 @@ ParkBall: ; e8a2 cp BATTLETYPE_TUTORIAL jp z, .FinishTutorial - farcall TrainerRankings_WildMonsCaught + farcall StubbedTrainerRankings_WildMonsCaught ld hl, Text_GotchaMonWasCaught call PrintText diff --git a/engine/link.asm b/engine/link.asm index 3d1fd0da4..66813d776 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -1957,7 +1957,7 @@ LinkTrade: ; 28b87 .save farcall SaveAfterLinkTrade - farcall TrainerRankings_Trades + farcall StubbedTrainerRankings_Trades farcall BackupMobileEventIndex ld c, 40 call DelayFrames diff --git a/engine/map_objects.asm b/engine/map_objects.asm index b0cc073a6..8e1c9b829 100644 --- a/engine/map_objects.asm +++ b/engine/map_objects.asm @@ -1570,7 +1570,7 @@ StepType05: ; 4e0c ld [hl], a call IncrementObjectStructField1c StepType04: ; 4e21 - call MobileFn_4fb2 + call Stubbed_Function4fb2 ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld [hl], STANDING @@ -1578,7 +1578,7 @@ StepType04: ; 4e21 ; 4e2b NPCStep: ; 4e2b - call MobileFn_4fb2 + call Stubbed_Function4fb2 call AddStepVector ld hl, OBJECT_STEP_DURATION add hl, bc @@ -1841,7 +1841,8 @@ SkyfallTop: ; 4f83 ret ; 4fb2 -MobileFn_4fb2: mobile +Stubbed_Function4fb2: + ret ld hl, OBJECT_1D add hl, bc inc [hl] diff --git a/engine/mystery_gift.asm b/engine/mystery_gift.asm index e7cb4ea91..6eafa2cca 100755 --- a/engine/mystery_gift.asm +++ b/engine/mystery_gift.asm @@ -63,7 +63,7 @@ DoMysteryGift: ; 1048ba (41:48ba) jr z, .skip_append_save call .SaveMysteryGiftTrainerName farcall RestoreMobileEventIndex - farcall TrainerRankings_MysteryGift + farcall StubbedTrainerRankings_MysteryGift farcall BackupMobileEventIndex .skip_append_save ld a, [wMysteryGiftPartnerSentDeco] diff --git a/engine/phone/phone.asm b/engine/phone/phone.asm index 53bb519b3..1f184f750 100644 --- a/engine/phone/phone.asm +++ b/engine/phone/phone.asm @@ -471,7 +471,7 @@ UnknownScript_0x90261: ; 0x90261 RingTwice_StartCall: ; 9026f call .Ring call .Ring - farcall TrainerRankings_PhoneCalls + farcall StubbedTrainerRankings_PhoneCalls ret ; 9027c @@ -500,7 +500,7 @@ PhoneCall:: ; 9029a ld [PhoneCaller + 1], a call Phone_FirstOfTwoRings call Phone_FirstOfTwoRings - farcall TrainerRankings_PhoneCalls + farcall StubbedTrainerRankings_PhoneCalls ret ; 902b3 diff --git a/engine/player_step.asm b/engine/player_step.asm index 996a9b422..923ec1405 100755 --- a/engine/player_step.asm +++ b/engine/player_step.asm @@ -76,7 +76,7 @@ HandlePlayerStep: ; d4e5 (3:54e5) ret .mobile ; d509 (3:5509) - farcall TrainerRankings_StepCount + farcall StubbedTrainerRankings_StepCount ret .fail2 ; d510 (3:5510) diff --git a/engine/scripting.asm b/engine/scripting.asm index d8f35bdc6..a1a5ade49 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -2994,8 +2994,8 @@ Script_halloffame: ld hl, wGameTimerPause res 0, [hl] - farcall TrainerRankings_HallOfFame - farcall TrainerRankings_HallOfFame2 + farcall StubbedTrainerRankings_HallOfFame + farcall StubbedTrainerRankings_HallOfFame2 farcall HallOfFame ld hl, wGameTimerPause set 0, [hl] diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index 26ffc7623..b6256731e 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -85,7 +85,7 @@ _SlotMachine: call PlaySFX call WaitSFX call ClearBGPalettes - farcall TrainerRankings_EndSlotsWinStreak + farcall StubbedTrainerRankings_EndSlotsWinStreak ld hl, Options res NO_TEXT_SCROLL, [hl] ld hl, rLCDC @@ -1935,7 +1935,7 @@ Slots_GetPayout: ; 93124 (24:7124) ld a, [hl] ld [wPayout], a ld d, a - farcall TrainerRankings_AddToSlotsPayouts + farcall StubbedTrainerRankings_AddToSlotsPayouts ret .PayoutTable: @@ -1959,7 +1959,7 @@ Slots_PayoutText: ; 93158 (24:7158) jr nz, .MatchedSomething ld hl, .Text_Darn call PrintText - farcall TrainerRankings_EndSlotsWinStreak + farcall StubbedTrainerRankings_EndSlotsWinStreak ret .MatchedSomething: @@ -1983,7 +1983,7 @@ Slots_PayoutText: ; 93158 (24:7158) .return ld hl, .Text_PrintPayout call PrintText - farcall TrainerRankings_AddToSlotsWinStreak + farcall StubbedTrainerRankings_AddToSlotsWinStreak ret ; 93195 (24:7195) diff --git a/engine/specials.asm b/engine/specials.asm index 60c5b745c..83ec5bfb3 100644 --- a/engine/specials.asm +++ b/engine/specials.asm @@ -178,7 +178,7 @@ SpecialsPointers:: ; c029 add_special Special_Mobile_SelectThreeMons add_special Special_Function1037eb add_special Special_Function10383c - add_special Special_TrainerRankings_Healings + add_special Special_StubbedTrainerRankings_Healings add_special Special_RefreshSprites add_special Special_Function1037c2 add_special Special_Mobile_DummyReturnFalse diff --git a/engine/start_menu.asm b/engine/start_menu.asm index 8f7488435..76ad7ce25 100755 --- a/engine/start_menu.asm +++ b/engine/start_menu.asm @@ -1255,7 +1255,7 @@ MonMenu_Fly: ; 12e30 jr z, .Fail cp $0 jr z, .Error - farcall TrainerRankings_Fly + farcall StubbedTrainerRankings_Fly ld b, $4 ld a, $2 ret diff --git a/engine/tmhm2.asm b/engine/tmhm2.asm index fc5923238..ddc27da07 100755 --- a/engine/tmhm2.asm +++ b/engine/tmhm2.asm @@ -146,7 +146,7 @@ TeachTMHM: ; 2c867 and a jr z, .nope - farcall TrainerRankings_TMsHMsTaught + farcall StubbedTrainerRankings_TMsHMsTaught ld a, [CurItem] call IsHM ret c -- cgit v1.2.3 From 7ad8ea13c95a6ddbde90de56e7d58bf0eb161dfc Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 2 Jan 2018 12:25:13 -0500 Subject: Document more sprite anim data --- engine/sprite_anims.asm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'engine') diff --git a/engine/sprite_anims.asm b/engine/sprite_anims.asm index 965f6bc0b..55777f45a 100755 --- a/engine/sprite_anims.asm +++ b/engine/sprite_anims.asm @@ -27,7 +27,7 @@ DoAnimFrame: ; 8d24b dw .SlotsChansey dw .SlotsChanseyEgg dw .MailCursor - dw .ForUnusedCursor + dw .UnusedCursor dw .DummyGameCursor dw .PokegearArrow dw .TradePokeBall @@ -39,10 +39,10 @@ DoAnimFrame: ; 8d24b dw .FlyFrom dw .FlyLeaf dw .FlyTo - dw .sprite_anim_seq_19 - dw .sprite_anim_seq_1A - dw .sprite_anim_seq_1B - dw .sprite_anim_seq_1C + dw .ForUnused1A + dw .EZChatCursor + dw .MobileTradeSentPulse + dw .MobileTradeOTPulse dw .IntroSuicune dw .IntroPichuWooper dw .Celebi @@ -202,7 +202,7 @@ DoAnimFrame: ; 8d24b ret ; 8d35a -.sprite_anim_seq_19 ; 8d35a (23:535a) +.ForUnused1A ; 8d35a (23:535a) ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] @@ -403,7 +403,7 @@ DoAnimFrame: ; 8d24b ld [hl], a ret -.ForUnusedCursor ; 8d46e (23:546e) +.UnusedCursor ; 8d46e (23:546e) callfar ret_e00ed ret @@ -748,11 +748,11 @@ DoAnimFrame: ; 8d24b ld [hl], a ret -.sprite_anim_seq_1B ; 8d630 (23:5630) +.MobileTradeSentPulse ; 8d630 (23:5630) farcall Function108bc7 ret -.sprite_anim_seq_1C ; 8d637 (23:5637) +.MobileTradeOTPulse ; 8d637 (23:5637) farcall Function108be0 ret @@ -845,7 +845,7 @@ DoAnimFrame: ; 8d24b ld [hl], a ret -.sprite_anim_seq_1A ; 8d6b7 (23:56b7) +.EZChatCursor ; 8d6b7 (23:56b7) farcall AnimateEZChatCursor ret -- cgit v1.2.3 From 2dd9ac08a4d6ae7f26515dd99cd579b00a7d2b14 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 2 Jan 2018 14:39:24 -0500 Subject: More sprite anim documentation --- engine/sprite_anims.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/sprite_anims.asm b/engine/sprite_anims.asm index 55777f45a..f51b26e61 100755 --- a/engine/sprite_anims.asm +++ b/engine/sprite_anims.asm @@ -39,7 +39,7 @@ DoAnimFrame: ; 8d24b dw .FlyFrom dw .FlyLeaf dw .FlyTo - dw .ForUnused1A + dw .GSIntroHoOh dw .EZChatCursor dw .MobileTradeSentPulse dw .MobileTradeOTPulse @@ -202,7 +202,7 @@ DoAnimFrame: ; 8d24b ret ; 8d35a -.ForUnused1A ; 8d35a (23:535a) +.GSIntroHoOh ; 8d35a (23:535a) ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] -- cgit v1.2.3 From 776b8c73963dac72d55489f69b7983ac4e365469 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 2 Jan 2018 14:48:24 -0500 Subject: Egg hatch shell framgent data is not exactly dsprite --- engine/breeding.asm | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'engine') diff --git a/engine/breeding.asm b/engine/breeding.asm index 234e05448..3baee35a5 100755 --- a/engine/breeding.asm +++ b/engine/breeding.asm @@ -860,18 +860,23 @@ Hatch_InitShellFragments: ; 173b3 (5:73b3) ret ; 173ef (5:73ef) +shell_fragment: MACRO +; y tile, y pxl, x tile, x pxl, frameset offset, jumptable index + db (\1 * 8) % $100 + \2, (\3 * 8) % $100 + \4, \5 - SPRITE_ANIM_FRAMESET_EGG_HATCH_1, \6 +ENDM + .SpriteData: ; 173ef ; Probably OAM. - dsprite 10, 4, 9, 0, $00, $3c - dsprite 11, 4, 9, 0, $01, $04 - dsprite 10, 4, 10, 0, $00, $30 - dsprite 11, 4, 10, 0, $01, $10 - dsprite 10, 4, 11, 0, $02, $24 - dsprite 11, 4, 11, 0, $03, $1c - dsprite 10, 0, 9, 4, $00, $36 - dsprite 12, 0, 9, 4, $01, $0a - dsprite 10, 0, 10, 4, $02, $2a - dsprite 12, 0, 10, 4, $03, $16 + shell_fragment 10, 4, 9, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_1, $3c + shell_fragment 11, 4, 9, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_2, $04 + shell_fragment 10, 4, 10, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_1, $30 + shell_fragment 11, 4, 10, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_2, $10 + shell_fragment 10, 4, 11, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_3, $24 + shell_fragment 11, 4, 11, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_4, $1c + shell_fragment 10, 0, 9, 4, SPRITE_ANIM_FRAMESET_EGG_HATCH_1, $36 + shell_fragment 12, 0, 9, 4, SPRITE_ANIM_FRAMESET_EGG_HATCH_2, $0a + shell_fragment 10, 0, 10, 4, SPRITE_ANIM_FRAMESET_EGG_HATCH_3, $2a + shell_fragment 12, 0, 10, 4, SPRITE_ANIM_FRAMESET_EGG_HATCH_4, $16 db -1 ; 17418 -- cgit v1.2.3 From 648e71832aa82d5e1c91ca9db329d23834e72603 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 2 Jan 2018 14:50:04 -0500 Subject: Comment correction --- engine/breeding.asm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/breeding.asm b/engine/breeding.asm index 3baee35a5..6674f288d 100755 --- a/engine/breeding.asm +++ b/engine/breeding.asm @@ -861,12 +861,11 @@ Hatch_InitShellFragments: ; 173b3 (5:73b3) ; 173ef (5:73ef) shell_fragment: MACRO -; y tile, y pxl, x tile, x pxl, frameset offset, jumptable index +; y tile, y pxl, x tile, x pxl, frameset offset, ??? db (\1 * 8) % $100 + \2, (\3 * 8) % $100 + \4, \5 - SPRITE_ANIM_FRAMESET_EGG_HATCH_1, \6 ENDM .SpriteData: ; 173ef -; Probably OAM. shell_fragment 10, 4, 9, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_1, $3c shell_fragment 11, 4, 9, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_2, $04 shell_fragment 10, 4, 10, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_1, $30 -- cgit v1.2.3 From 0caea0f8202bf4cedb967a844a96cee04386b8df Mon Sep 17 00:00:00 2001 From: Adelaide Walter Date: Tue, 2 Jan 2018 16:46:40 -0500 Subject: Use BANK for all hardcoded banks with BANK in comments. --- engine/battle/battle_transition.asm | 6 +++--- engine/battle/core.asm | 2 +- engine/battle_anims/getpokeballwobble.asm | 2 +- engine/title.asm | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'engine') diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 85ba44072..2b9ebe091 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -298,7 +298,7 @@ StartTrainerBattle_Flash: ; 8c3ab (23:43ab) StartTrainerBattle_SetUpForWavyOutro: ; 8c3e8 (23:43e8) farcall Function5602 - ld a, $5 ; BANK(LYOverrides) + ld a, BANK(LYOverrides) ld [rSVBK], a call StartTrainerBattle_NextScene @@ -356,7 +356,7 @@ StartTrainerBattle_SineWave: ; 8c408 (23:4408) StartTrainerBattle_SetUpForSpinOutro: ; 8c43d (23:443d) farcall Function5602 - ld a, $5 ; BANK(LYOverrides) + ld a, BANK(LYOverrides) ld [rSVBK], a call StartTrainerBattle_NextScene xor a @@ -498,7 +498,7 @@ ENDM StartTrainerBattle_SetUpForRandomScatterOutro: ; 8c578 (23:4578) farcall Function5602 - ld a, $5 ; BANK(LYOverrides) + ld a, BANK(LYOverrides) ld [rSVBK], a call StartTrainerBattle_NextScene ld a, $10 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 08021fc8b..48be08bf0 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -8440,7 +8440,7 @@ InitEnemy: ; 3f55e BackUpBGMap2: ; 3f568 ld a, [rSVBK] push af - ld a, $6 ; BANK(wDecompressScratch) + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld hl, wDecompressScratch ld bc, $40 tiles ; vBGMap3 - vBGMap2 diff --git a/engine/battle_anims/getpokeballwobble.asm b/engine/battle_anims/getpokeballwobble.asm index 7fb4d3e38..2bc53d798 100755 --- a/engine/battle_anims/getpokeballwobble.asm +++ b/engine/battle_anims/getpokeballwobble.asm @@ -8,7 +8,7 @@ GetPokeBallWobble: ; f971 (3:7971) ld d, a push de - ld a, 1 ; BANK(Buffer2) + ld a, BANK(Buffer2) ld [rSVBK], a ld a, [Buffer2] diff --git a/engine/title.asm b/engine/title.asm index 2380cfedf..2b43c811a 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -162,7 +162,7 @@ _TitleScreen: ; 10ed67 ld a, [rSVBK] push af - ld a, 5 ; BANK(LYOverrides) + ld a, BANK(LYOverrides) ld [rSVBK], a ; Make alternating lines come in from opposite sides -- cgit v1.2.3 From 4f01dff6c201a56537bc43a032b07eb16273b038 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 2 Jan 2018 17:26:23 -0500 Subject: Use OAM flags in dsprite data --- engine/billspc.asm | 68 ++++++------ engine/card_flip.asm | 282 ++++++++++++++++++++++++------------------------ engine/mystery_gift.asm | 32 +++--- engine/pokedex.asm | 184 +++++++++++++++---------------- engine/pokedex_2.asm | 22 ++-- engine/unown_puzzle.asm | 36 +++---- 6 files changed, 312 insertions(+), 312 deletions(-) (limited to 'engine') diff --git a/engine/billspc.asm b/engine/billspc.asm index f94f495c6..2319bbdfc 100755 --- a/engine/billspc.asm +++ b/engine/billspc.asm @@ -1523,30 +1523,30 @@ endr ; e2e2b (38:6e2b) .OAM: ; e2e2b - dsprite 4, 6, 10, 0, $00, $00 - dsprite 4, 6, 11, 0, $00, $00 - dsprite 4, 6, 12, 0, $00, $00 - dsprite 4, 6, 13, 0, $00, $00 - dsprite 4, 6, 14, 0, $00, $00 - dsprite 4, 6, 15, 0, $00, $00 - dsprite 4, 6, 16, 0, $00, $00 - dsprite 4, 6, 17, 0, $00, $00 - dsprite 4, 6, 18, 0, $00, $00 - dsprite 4, 6, 18, 7, $00, $00 - dsprite 7, 1, 10, 0, $00, $40 - dsprite 7, 1, 11, 0, $00, $40 - dsprite 7, 1, 12, 0, $00, $40 - dsprite 7, 1, 13, 0, $00, $40 - dsprite 7, 1, 14, 0, $00, $40 - dsprite 7, 1, 15, 0, $00, $40 - dsprite 7, 1, 16, 0, $00, $40 - dsprite 7, 1, 17, 0, $00, $40 - dsprite 7, 1, 18, 0, $00, $40 - dsprite 7, 1, 18, 7, $00, $40 - dsprite 5, 6, 9, 6, $01, $00 - dsprite 6, 1, 9, 6, $01, $40 - dsprite 5, 6, 19, 1, $01, $20 - dsprite 6, 1, 19, 1, $01, $60 + dsprite 4, 6, 10, 0, $00, 0 + dsprite 4, 6, 11, 0, $00, 0 + dsprite 4, 6, 12, 0, $00, 0 + dsprite 4, 6, 13, 0, $00, 0 + dsprite 4, 6, 14, 0, $00, 0 + dsprite 4, 6, 15, 0, $00, 0 + dsprite 4, 6, 16, 0, $00, 0 + dsprite 4, 6, 17, 0, $00, 0 + dsprite 4, 6, 18, 0, $00, 0 + dsprite 4, 6, 18, 7, $00, 0 + dsprite 7, 1, 10, 0, $00, 0 | Y_FLIP + dsprite 7, 1, 11, 0, $00, 0 | Y_FLIP + dsprite 7, 1, 12, 0, $00, 0 | Y_FLIP + dsprite 7, 1, 13, 0, $00, 0 | Y_FLIP + dsprite 7, 1, 14, 0, $00, 0 | Y_FLIP + dsprite 7, 1, 15, 0, $00, 0 | Y_FLIP + dsprite 7, 1, 16, 0, $00, 0 | Y_FLIP + dsprite 7, 1, 17, 0, $00, 0 | Y_FLIP + dsprite 7, 1, 18, 0, $00, 0 | Y_FLIP + dsprite 7, 1, 18, 7, $00, 0 | Y_FLIP + dsprite 5, 6, 9, 6, $01, 0 + dsprite 6, 1, 9, 6, $01, 0 | Y_FLIP + dsprite 5, 6, 19, 1, $01, 0 | X_FLIP + dsprite 6, 1, 19, 1, $01, 0 | X_FLIP | Y_FLIP db -1 ; e2e8c @@ -1573,16 +1573,16 @@ endr ; e2eac .OAM: ; e2eac - dsprite 4, 7, 10, 0, $06, $00 - dsprite 5, 3, 11, 0, $00, $40 - dsprite 5, 3, 12, 0, $00, $40 - dsprite 5, 3, 13, 0, $00, $40 - dsprite 5, 3, 14, 0, $00, $40 - dsprite 5, 3, 15, 0, $00, $40 - dsprite 5, 3, 16, 0, $00, $40 - dsprite 5, 3, 17, 0, $00, $40 - dsprite 5, 3, 18, 0, $00, $40 - dsprite 4, 7, 19, 0, $07, $00 + dsprite 4, 7, 10, 0, $06, 0 + dsprite 5, 3, 11, 0, $00, 0 | Y_FLIP + dsprite 5, 3, 12, 0, $00, 0 | Y_FLIP + dsprite 5, 3, 13, 0, $00, 0 | Y_FLIP + dsprite 5, 3, 14, 0, $00, 0 | Y_FLIP + dsprite 5, 3, 15, 0, $00, 0 | Y_FLIP + dsprite 5, 3, 16, 0, $00, 0 | Y_FLIP + dsprite 5, 3, 17, 0, $00, 0 | Y_FLIP + dsprite 5, 3, 18, 0, $00, 0 | Y_FLIP + dsprite 4, 7, 19, 0, $07, 0 db -1 ; e2ed5 diff --git a/engine/card_flip.asm b/engine/card_flip.asm index 158f3fa05..10e06b9a9 100755 --- a/engine/card_flip.asm +++ b/engine/card_flip.asm @@ -1210,29 +1210,29 @@ PlaceOAMCardBorder: ; e0849 .SpriteData: ; e0853 db 18 - dsprite 0, 0, 0, 0, $04, $00 - dsprite 0, 0, 1, 0, $06, $00 - dsprite 0, 0, 2, 0, $06, $00 - dsprite 0, 0, 3, 0, $06, $00 - dsprite 0, 0, 4, 0, $04, $20 + dsprite 0, 0, 0, 0, $04, 0 + dsprite 0, 0, 1, 0, $06, 0 + dsprite 0, 0, 2, 0, $06, 0 + dsprite 0, 0, 3, 0, $06, 0 + dsprite 0, 0, 4, 0, $04, 0 | X_FLIP - dsprite 1, 0, 0, 0, $05, $00 - dsprite 1, 0, 4, 0, $05, $20 + dsprite 1, 0, 0, 0, $05, 0 + dsprite 1, 0, 4, 0, $05, 0 | X_FLIP - dsprite 2, 0, 0, 0, $05, $00 - dsprite 2, 0, 4, 0, $05, $20 + dsprite 2, 0, 0, 0, $05, 0 + dsprite 2, 0, 4, 0, $05, 0 | X_FLIP - dsprite 3, 0, 0, 0, $05, $00 - dsprite 3, 0, 4, 0, $05, $20 + dsprite 3, 0, 0, 0, $05, 0 + dsprite 3, 0, 4, 0, $05, 0 | X_FLIP dsprite 4, 0, 0, 0, $05, $00 - dsprite 4, 0, 4, 0, $05, $20 + dsprite 4, 0, 4, 0, $05, 0 | X_FLIP - dsprite 5, 0, 0, 0, $04, $40 - dsprite 5, 0, 1, 0, $06, $40 - dsprite 5, 0, 2, 0, $06, $40 - dsprite 5, 0, 3, 0, $06, $40 - dsprite 5, 0, 4, 0, $04, $60 + dsprite 5, 0, 0, 0, $04, 0 | Y_FLIP + dsprite 5, 0, 1, 0, $06, 0 | Y_FLIP + dsprite 5, 0, 2, 0, $06, 0 | Y_FLIP + dsprite 5, 0, 3, 0, $06, 0 | Y_FLIP + dsprite 5, 0, 4, 0, $04, 0 | X_FLIP | Y_FLIP ; e089c ChooseCard_HandleJoypad: ; e089c @@ -1471,145 +1471,145 @@ ENDM .SingleTile: ; e0a41 db 6 - dsprite 0, 0, -1, 7, $00, $80 - dsprite 0, 0, 0, 0, $02, $80 - dsprite 0, 0, 1, 0, $03, $80 - dsprite 0, 5, -1, 7, $00, $c0 - dsprite 0, 5, 0, 0, $02, $c0 - dsprite 0, 5, 1, 0, $03, $80 + dsprite 0, 0, -1, 7, $00, 0 | BEHIND_BG + dsprite 0, 0, 0, 0, $02, 0 | BEHIND_BG + dsprite 0, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 0, 5, -1, 7, $00, 0 | Y_FLIP | BEHIND_BG + dsprite 0, 5, 0, 0, $02, 0 | Y_FLIP | BEHIND_BG + dsprite 0, 5, 1, 0, $03, 0 | BEHIND_BG .PokeGroup: ; e0a5a db 26 - dsprite 0, 0, -1, 7, $00, $80 - dsprite 0, 0, 0, 0, $02, $80 - dsprite 0, 0, 1, 0, $00, $a0 - dsprite 1, 0, -1, 7, $01, $80 - dsprite 1, 0, 1, 0, $01, $a0 - dsprite 2, 0, -1, 7, $01, $80 - dsprite 2, 0, 1, 0, $03, $80 - dsprite 3, 0, -1, 7, $01, $80 - dsprite 3, 0, 1, 0, $03, $80 - dsprite 4, 0, -1, 7, $01, $80 - dsprite 4, 0, 1, 0, $03, $80 - dsprite 5, 0, -1, 7, $01, $80 - dsprite 5, 0, 1, 0, $03, $80 - dsprite 6, 0, -1, 7, $01, $80 - dsprite 6, 0, 1, 0, $03, $80 - dsprite 7, 0, -1, 7, $01, $80 - dsprite 7, 0, 1, 0, $03, $80 - dsprite 8, 0, -1, 7, $01, $80 - dsprite 8, 0, 1, 0, $03, $80 - dsprite 9, 0, -1, 7, $01, $80 - dsprite 9, 0, 1, 0, $03, $80 - dsprite 10, 0, -1, 7, $01, $80 - dsprite 10, 0, 1, 0, $03, $80 - dsprite 10, 1, -1, 7, $00, $c0 - dsprite 10, 1, 0, 0, $02, $c0 - dsprite 10, 1, 1, 0, $03, $80 + dsprite 0, 0, -1, 7, $00, 0 | BEHIND_BG + dsprite 0, 0, 0, 0, $02, 0 | BEHIND_BG + dsprite 0, 0, 1, 0, $00, 0 | X_FLIP | BEHIND_BG + dsprite 1, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 1, 0, 1, 0, $01, 0 | X_FLIP | BEHIND_BG + dsprite 2, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 2, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 3, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 3, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 4, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 4, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 5, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 5, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 6, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 6, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 7, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 7, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 8, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 8, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 9, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 9, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 10, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 10, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 10, 1, -1, 7, $00, 0 | Y_FLIP | BEHIND_BG + dsprite 10, 1, 0, 0, $02, 0 | Y_FLIP | BEHIND_BG + dsprite 10, 1, 1, 0, $03, 0 | BEHIND_BG .NumGroup: ; e0ac3 db 20 - dsprite 0, 0, -1, 7, $00, $80 - dsprite 0, 0, 0, 0, $02, $80 - dsprite 0, 0, 1, 0, $02, $80 - dsprite 0, 0, 2, 0, $03, $80 - dsprite 0, 0, 3, 0, $02, $80 - dsprite 0, 0, 4, 0, $03, $80 - dsprite 0, 0, 5, 0, $02, $80 - dsprite 0, 0, 6, 0, $03, $80 - dsprite 0, 0, 7, 0, $02, $80 - dsprite 0, 0, 8, 0, $03, $80 - dsprite 0, 5, -1, 7, $00, $c0 - dsprite 0, 5, 0, 0, $02, $c0 - dsprite 0, 5, 1, 0, $02, $c0 - dsprite 0, 5, 2, 0, $03, $80 - dsprite 0, 5, 3, 0, $02, $c0 - dsprite 0, 5, 4, 0, $03, $80 - dsprite 0, 5, 5, 0, $02, $c0 - dsprite 0, 5, 6, 0, $03, $80 - dsprite 0, 5, 7, 0, $02, $c0 - dsprite 0, 5, 8, 0, $03, $80 + dsprite 0, 0, -1, 7, $00, 0 | BEHIND_BG + dsprite 0, 0, 0, 0, $02, 0 | BEHIND_BG + dsprite 0, 0, 1, 0, $02, 0 | BEHIND_BG + dsprite 0, 0, 2, 0, $03, 0 | BEHIND_BG + dsprite 0, 0, 3, 0, $02, 0 | BEHIND_BG + dsprite 0, 0, 4, 0, $03, 0 | BEHIND_BG + dsprite 0, 0, 5, 0, $02, 0 | BEHIND_BG + dsprite 0, 0, 6, 0, $03, 0 | BEHIND_BG + dsprite 0, 0, 7, 0, $02, 0 | BEHIND_BG + dsprite 0, 0, 8, 0, $03, 0 | BEHIND_BG + dsprite 0, 5, -1, 7, $00, 0 | Y_FLIP | BEHIND_BG + dsprite 0, 5, 0, 0, $02, 0 | Y_FLIP | BEHIND_BG + dsprite 0, 5, 1, 0, $02, 0 | Y_FLIP | BEHIND_BG + dsprite 0, 5, 2, 0, $03, 0 | BEHIND_BG + dsprite 0, 5, 3, 0, $02, 0 | Y_FLIP | BEHIND_BG + dsprite 0, 5, 4, 0, $03, 0 | BEHIND_BG + dsprite 0, 5, 5, 0, $02, 0 | Y_FLIP | BEHIND_BG + dsprite 0, 5, 6, 0, $03, 0 | BEHIND_BG + dsprite 0, 5, 7, 0, $02, 0 | Y_FLIP | BEHIND_BG + dsprite 0, 5, 8, 0, $03, 0 | BEHIND_BG .NumGroupPair: ; e0b14 db 30 - dsprite 0, 0, 0, 0, $00, $80 - dsprite 0, 0, 1, 0, $02, $80 - dsprite 0, 0, 2, 0, $02, $80 - dsprite 0, 0, 3, 0, $03, $80 - dsprite 0, 0, 4, 0, $02, $80 - dsprite 0, 0, 5, 0, $03, $80 - dsprite 0, 0, 6, 0, $02, $80 - dsprite 0, 0, 7, 0, $03, $80 - dsprite 0, 0, 8, 0, $02, $80 - dsprite 0, 0, 9, 0, $03, $80 - dsprite 1, 0, 0, 0, $01, $80 - dsprite 1, 0, 3, 0, $03, $80 - dsprite 1, 0, 5, 0, $03, $80 - dsprite 1, 0, 7, 0, $03, $80 - dsprite 1, 0, 9, 0, $03, $80 - dsprite 2, 0, 0, 0, $01, $80 - dsprite 2, 0, 3, 0, $03, $80 - dsprite 2, 0, 5, 0, $03, $80 - dsprite 2, 0, 7, 0, $03, $80 - dsprite 2, 0, 9, 0, $03, $80 - dsprite 2, 1, 0, 0, $00, $c0 - dsprite 2, 1, 1, 0, $02, $c0 - dsprite 2, 1, 2, 0, $02, $c0 - dsprite 2, 1, 3, 0, $03, $80 - dsprite 2, 1, 4, 0, $03, $80 - dsprite 2, 1, 5, 0, $03, $80 - dsprite 2, 1, 6, 0, $03, $80 - dsprite 2, 1, 7, 0, $03, $80 - dsprite 2, 1, 8, 0, $03, $80 - dsprite 2, 1, 9, 0, $03, $80 + dsprite 0, 0, 0, 0, $00, 0 | BEHIND_BG + dsprite 0, 0, 1, 0, $02, 0 | BEHIND_BG + dsprite 0, 0, 2, 0, $02, 0 | BEHIND_BG + dsprite 0, 0, 3, 0, $03, 0 | BEHIND_BG + dsprite 0, 0, 4, 0, $02, 0 | BEHIND_BG + dsprite 0, 0, 5, 0, $03, 0 | BEHIND_BG + dsprite 0, 0, 6, 0, $02, 0 | BEHIND_BG + dsprite 0, 0, 7, 0, $03, 0 | BEHIND_BG + dsprite 0, 0, 8, 0, $02, 0 | BEHIND_BG + dsprite 0, 0, 9, 0, $03, 0 | BEHIND_BG + dsprite 1, 0, 0, 0, $01, 0 | BEHIND_BG + dsprite 1, 0, 3, 0, $03, 0 | BEHIND_BG + dsprite 1, 0, 5, 0, $03, 0 | BEHIND_BG + dsprite 1, 0, 7, 0, $03, 0 | BEHIND_BG + dsprite 1, 0, 9, 0, $03, 0 | BEHIND_BG + dsprite 2, 0, 0, 0, $01, 0 | BEHIND_BG + dsprite 2, 0, 3, 0, $03, 0 | BEHIND_BG + dsprite 2, 0, 5, 0, $03, 0 | BEHIND_BG + dsprite 2, 0, 7, 0, $03, 0 | BEHIND_BG + dsprite 2, 0, 9, 0, $03, 0 | BEHIND_BG + dsprite 2, 1, 0, 0, $00, 0 | Y_FLIP | BEHIND_BG + dsprite 2, 1, 1, 0, $02, 0 | Y_FLIP | BEHIND_BG + dsprite 2, 1, 2, 0, $02, 0 | Y_FLIP | BEHIND_BG + dsprite 2, 1, 3, 0, $03, 0 | BEHIND_BG + dsprite 2, 1, 4, 0, $03, 0 | BEHIND_BG + dsprite 2, 1, 5, 0, $03, 0 | BEHIND_BG + dsprite 2, 1, 6, 0, $03, 0 | BEHIND_BG + dsprite 2, 1, 7, 0, $03, 0 | BEHIND_BG + dsprite 2, 1, 8, 0, $03, 0 | BEHIND_BG + dsprite 2, 1, 9, 0, $03, 0 | BEHIND_BG .PokeGroupPair: ; e0b8d db 38 - dsprite 0, 0, -1, 7, $00, $80 - dsprite 0, 0, 3, 0, $00, $a0 - dsprite 1, 0, -1, 7, $01, $80 - dsprite 1, 0, 3, 0, $01, $a0 - dsprite 2, 0, -1, 7, $01, $80 - dsprite 2, 0, 3, 0, $01, $a0 - dsprite 3, 0, -1, 7, $01, $80 - dsprite 3, 0, 1, 0, $03, $80 - dsprite 3, 0, 3, 0, $03, $80 - dsprite 4, 0, -1, 7, $01, $80 - dsprite 4, 0, 1, 0, $03, $80 - dsprite 4, 0, 3, 0, $03, $80 - dsprite 5, 0, -1, 7, $01, $80 - dsprite 5, 0, 1, 0, $03, $80 - dsprite 5, 0, 3, 0, $03, $80 - dsprite 6, 0, -1, 7, $01, $80 - dsprite 6, 0, 1, 0, $03, $80 - dsprite 6, 0, 3, 0, $03, $80 - dsprite 7, 0, -1, 7, $01, $80 - dsprite 7, 0, 1, 0, $03, $80 - dsprite 7, 0, 3, 0, $03, $80 - dsprite 8, 0, -1, 7, $01, $80 - dsprite 8, 0, 1, 0, $03, $80 - dsprite 8, 0, 3, 0, $03, $80 - dsprite 9, 0, -1, 7, $01, $80 - dsprite 9, 0, 1, 0, $03, $80 - dsprite 9, 0, 3, 0, $03, $80 - dsprite 10, 0, -1, 7, $01, $80 - dsprite 10, 0, 1, 0, $03, $80 - dsprite 10, 0, 3, 0, $03, $80 - dsprite 11, 0, -1, 7, $01, $80 - dsprite 11, 0, 1, 0, $03, $80 - dsprite 11, 0, 3, 0, $03, $80 - dsprite 11, 1, -1, 7, $00, $c0 - dsprite 11, 1, 0, 0, $02, $c0 - dsprite 11, 1, 1, 0, $03, $c0 - dsprite 11, 1, 2, 0, $02, $c0 - dsprite 11, 1, 3, 0, $03, $e0 + dsprite 0, 0, -1, 7, $00, 0 | BEHIND_BG + dsprite 0, 0, 3, 0, $00, 0 | X_FLIP | BEHIND_BG + dsprite 1, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 1, 0, 3, 0, $01, 0 | X_FLIP | BEHIND_BG + dsprite 2, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 2, 0, 3, 0, $01, 0 | X_FLIP | BEHIND_BG + dsprite 3, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 3, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 3, 0, 3, 0, $03, 0 | BEHIND_BG + dsprite 4, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 4, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 4, 0, 3, 0, $03, 0 | BEHIND_BG + dsprite 5, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 5, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 5, 0, 3, 0, $03, 0 | BEHIND_BG + dsprite 6, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 6, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 6, 0, 3, 0, $03, 0 | BEHIND_BG + dsprite 7, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 7, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 7, 0, 3, 0, $03, 0 | BEHIND_BG + dsprite 8, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 8, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 8, 0, 3, 0, $03, 0 | BEHIND_BG + dsprite 9, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 9, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 9, 0, 3, 0, $03, 0 | BEHIND_BG + dsprite 10, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 10, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 10, 0, 3, 0, $03, 0 | BEHIND_BG + dsprite 11, 0, -1, 7, $01, 0 | BEHIND_BG + dsprite 11, 0, 1, 0, $03, 0 | BEHIND_BG + dsprite 11, 0, 3, 0, $03, 0 | BEHIND_BG + dsprite 11, 1, -1, 7, $00, 0 | Y_FLIP | BEHIND_BG + dsprite 11, 1, 0, 0, $02, 0 | Y_FLIP | BEHIND_BG + dsprite 11, 1, 1, 0, $03, 0 | Y_FLIP | BEHIND_BG + dsprite 11, 1, 2, 0, $02, 0 | Y_FLIP | BEHIND_BG + dsprite 11, 1, 3, 0, $03, 0 | X_FLIP | Y_FLIP | BEHIND_BG .Impossible: ; e0c26 db 4 - dsprite 0, 0, 0, 0, $00, $80 - dsprite 0, 0, 1, 0, $00, $a0 - dsprite 1, 0, 0, 0, $00, $c0 - dsprite 1, 0, 1, 0, $00, $e0 + dsprite 0, 0, 0, 0, $00, 0 | BEHIND_BG + dsprite 0, 0, 1, 0, $00, 0 | X_FLIP | BEHIND_BG + dsprite 1, 0, 0, 0, $00, 0 | Y_FLIP | BEHIND_BG + dsprite 1, 0, 1, 0, $00, 0 | X_FLIP | Y_FLIP | BEHIND_BG ; e0c37 CardFlip_InitAttrPals: ; e0c37 (38:4c37) diff --git a/engine/mystery_gift.asm b/engine/mystery_gift.asm index 67ce10168..03dff98e5 100755 --- a/engine/mystery_gift.asm +++ b/engine/mystery_gift.asm @@ -1713,22 +1713,22 @@ Function1057d7: ; 1057d7 (41:57d7) ; 1058f0 (41:58f0) .OAM_data: ; 1058f0 - dsprite 2, 1, 6, 4, $00, $00 - dsprite 2, 1, 7, 4, $01, $00 - dsprite 2, 1, 8, 4, $02, $00 - dsprite 2, 1, 9, 4, $03, $00 - dsprite 3, 1, 6, 4, $04, $00 - dsprite 3, 1, 7, 4, $05, $00 - dsprite 3, 1, 8, 4, $06, $00 - dsprite 3, 1, 9, 4, $07, $00 - dsprite 0, 1, 11, 4, $00, $00 - dsprite 0, 1, 12, 4, $01, $00 - dsprite 0, 1, 13, 4, $02, $00 - dsprite 0, 1, 14, 4, $03, $00 - dsprite 1, 1, 11, 4, $04, $00 - dsprite 1, 1, 12, 4, $05, $00 - dsprite 1, 1, 13, 4, $06, $00 - dsprite 1, 1, 14, 4, $07, $00 + dsprite 2, 1, 6, 4, $00, 0 + dsprite 2, 1, 7, 4, $01, 0 + dsprite 2, 1, 8, 4, $02, 0 + dsprite 2, 1, 9, 4, $03, 0 + dsprite 3, 1, 6, 4, $04, 0 + dsprite 3, 1, 7, 4, $05, 0 + dsprite 3, 1, 8, 4, $06, 0 + dsprite 3, 1, 9, 4, $07, 0 + dsprite 0, 1, 11, 4, $00, 0 + dsprite 0, 1, 12, 4, $01, 0 + dsprite 0, 1, 13, 4, $02, 0 + dsprite 0, 1, 14, 4, $03, 0 + dsprite 1, 1, 11, 4, $04, 0 + dsprite 1, 1, 12, 4, $05, 0 + dsprite 1, 1, 13, 4, $06, 0 + dsprite 1, 1, 14, 4, $07, 0 ; japanese mystery gift gfx MysteryGiftJP_GFX: ; 105930 diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 5dc3dc2a7..8a1e02008 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -2026,59 +2026,59 @@ Pokedex_PutOldModeCursorOAM: ; 41157 (10:5157) ret .CursorOAM: ; 41167 - db $18, $47, $30, $07 - db $10, $47, $31, $07 - db $10, $4f, $32, $07 - db $10, $57, $32, $07 - db $10, $5f, $32, $07 - db $10, $67, $33, $07 - db $10, $7e, $33, $27 - db $10, $86, $32, $27 - db $10, $8e, $32, $27 - db $10, $96, $32, $27 - db $10, $9e, $31, $27 - db $18, $9e, $30, $27 - db $20, $47, $30, $47 - db $28, $47, $31, $47 - db $28, $4f, $32, $47 - db $28, $57, $32, $47 - db $28, $5f, $32, $47 - db $28, $67, $33, $47 - db $28, $7e, $33, $67 - db $28, $86, $32, $67 - db $28, $8e, $32, $67 - db $28, $96, $32, $67 - db $28, $9e, $31, $67 - db $20, $9e, $30, $67 + db $18, $47, $30, 7 + db $10, $47, $31, 7 + db $10, $4f, $32, 7 + db $10, $57, $32, 7 + db $10, $5f, $32, 7 + db $10, $67, $33, 7 + db $10, $7e, $33, 7 | X_FLIP + db $10, $86, $32, 7 | X_FLIP + db $10, $8e, $32, 7 | X_FLIP + db $10, $96, $32, 7 | X_FLIP + db $10, $9e, $31, 7 | X_FLIP + db $18, $9e, $30, 7 | X_FLIP + db $20, $47, $30, 7 | Y_FLIP + db $28, $47, $31, 7 | Y_FLIP + db $28, $4f, $32, 7 | Y_FLIP + db $28, $57, $32, 7 | Y_FLIP + db $28, $5f, $32, 7 | Y_FLIP + db $28, $67, $33, 7 | Y_FLIP + db $28, $7e, $33, 7 | X_FLIP | Y_FLIP + db $28, $86, $32, 7 | X_FLIP | Y_FLIP + db $28, $8e, $32, 7 | X_FLIP | Y_FLIP + db $28, $96, $32, 7 | X_FLIP | Y_FLIP + db $28, $9e, $31, 7 | X_FLIP | Y_FLIP + db $20, $9e, $30, 7 | X_FLIP | Y_FLIP db $ff .CursorAtTopOAM: ; 411c8 ; OAM data for when the cursor is at the top of the list. The tiles at the top ; are cut off so they don't show up outside the list area. - db $18, $47, $30, $07 - db $10, $47, $34, $07 - db $10, $4f, $35, $07 - db $10, $57, $35, $07 - db $10, $5f, $35, $07 - db $10, $67, $36, $07 - db $10, $7e, $36, $27 - db $10, $86, $35, $27 - db $10, $8e, $35, $27 - db $10, $96, $35, $27 - db $10, $9e, $34, $27 - db $18, $9e, $30, $27 - db $20, $47, $30, $47 - db $28, $47, $31, $47 - db $28, $4f, $32, $47 - db $28, $57, $32, $47 - db $28, $5f, $32, $47 - db $28, $67, $33, $47 - db $28, $7e, $33, $67 - db $28, $86, $32, $67 - db $28, $8e, $32, $67 - db $28, $96, $32, $67 - db $28, $9e, $31, $67 - db $20, $9e, $30, $67 + db $18, $47, $30, 7 + db $10, $47, $34, 7 + db $10, $4f, $35, 7 + db $10, $57, $35, 7 + db $10, $5f, $35, 7 + db $10, $67, $36, 7 + db $10, $7e, $36, 7 | X_FLIP + db $10, $86, $35, 7 | X_FLIP + db $10, $8e, $35, 7 | X_FLIP + db $10, $96, $35, 7 | X_FLIP + db $10, $9e, $34, 7 | X_FLIP + db $18, $9e, $30, 7 | X_FLIP + db $20, $47, $30, 7 | Y_FLIP + db $28, $47, $31, 7 | Y_FLIP + db $28, $4f, $32, 7 | Y_FLIP + db $28, $57, $32, 7 | Y_FLIP + db $28, $5f, $32, 7 | Y_FLIP + db $28, $67, $33, 7 | Y_FLIP + db $28, $7e, $33, 7 | X_FLIP | Y_FLIP + db $28, $86, $32, 7 | X_FLIP | Y_FLIP + db $28, $8e, $32, 7 | X_FLIP | Y_FLIP + db $28, $96, $32, 7 | X_FLIP | Y_FLIP + db $28, $9e, $31, 7 | X_FLIP | Y_FLIP + db $20, $9e, $30, 7 | X_FLIP | Y_FLIP db $ff Pokedex_PutNewModeABCModeCursorOAM: ; 41229 (10:5229) @@ -2087,26 +2087,26 @@ Pokedex_PutNewModeABCModeCursorOAM: ; 41229 (10:5229) ret .CursorOAM: ; 41230 - db $1b, $47, $30, $07 - db $13, $47, $31, $07 - db $13, $4f, $32, $07 - db $13, $57, $32, $07 - db $13, $5f, $33, $07 - db $13, $80, $33, $27 - db $13, $88, $32, $27 - db $13, $90, $32, $27 - db $13, $98, $31, $27 - db $1b, $98, $30, $27 - db $23, $47, $30, $47 - db $2b, $47, $31, $47 - db $2b, $4f, $32, $47 - db $2b, $57, $32, $47 - db $2b, $5f, $33, $47 - db $2b, $80, $33, $67 - db $2b, $88, $32, $67 - db $2b, $90, $32, $67 - db $2b, $98, $31, $67 - db $23, $98, $30, $67 + db $1b, $47, $30, 7 + db $13, $47, $31, 7 + db $13, $4f, $32, 7 + db $13, $57, $32, 7 + db $13, $5f, $33, 7 + db $13, $80, $33, 7 | X_FLIP + db $13, $88, $32, 7 | X_FLIP + db $13, $90, $32, 7 | X_FLIP + db $13, $98, $31, 7 | X_FLIP + db $1b, $98, $30, 7 | X_FLIP + db $23, $47, $30, 7 | Y_FLIP + db $2b, $47, $31, 7 | Y_FLIP + db $2b, $4f, $32, 7 | Y_FLIP + db $2b, $57, $32, 7 | Y_FLIP + db $2b, $5f, $33, 7 | Y_FLIP + db $2b, $80, $33, 7 | X_FLIP | Y_FLIP + db $2b, $88, $32, 7 | X_FLIP | Y_FLIP + db $2b, $90, $32, 7 | X_FLIP | Y_FLIP + db $2b, $98, $31, 7 | X_FLIP | Y_FLIP + db $23, $98, $30, 7 | X_FLIP | Y_FLIP db $ff Pokedex_UpdateSearchResultsCursorOAM: ; 41281 (10:5281) @@ -2118,30 +2118,30 @@ Pokedex_UpdateSearchResultsCursorOAM: ; 41281 (10:5281) ret .CursorOAM: ; 41290 - db $1b, $47, $30, $07 - db $13, $47, $31, $07 - db $13, $4f, $32, $07 - db $13, $57, $32, $07 - db $13, $5f, $32, $07 - db $13, $67, $33, $07 - db $13, $7e, $33, $27 - db $13, $86, $32, $27 - db $13, $8e, $32, $27 - db $13, $96, $32, $27 - db $13, $9e, $31, $27 - db $1b, $9e, $30, $27 - db $23, $47, $30, $47 - db $2b, $47, $31, $47 - db $2b, $4f, $32, $47 - db $2b, $57, $32, $47 - db $2b, $5f, $32, $47 - db $2b, $67, $33, $47 - db $2b, $7e, $33, $67 - db $2b, $86, $32, $67 - db $2b, $8e, $32, $67 - db $2b, $96, $32, $67 - db $2b, $9e, $31, $67 - db $23, $9e, $30, $67 + db $1b, $47, $30, 7 + db $13, $47, $31, 7 + db $13, $4f, $32, 7 + db $13, $57, $32, 7 + db $13, $5f, $32, 7 + db $13, $67, $33, 7 + db $13, $7e, $33, 7 | X_FLIP + db $13, $86, $32, 7 | X_FLIP + db $13, $8e, $32, 7 | X_FLIP + db $13, $96, $32, 7 | X_FLIP + db $13, $9e, $31, 7 | X_FLIP + db $1b, $9e, $30, 7 | X_FLIP + db $23, $47, $30, 7 | Y_FLIP + db $2b, $47, $31, 7 | Y_FLIP + db $2b, $4f, $32, 7 | Y_FLIP + db $2b, $57, $32, 7 | Y_FLIP + db $2b, $5f, $32, 7 | Y_FLIP + db $2b, $67, $33, 7 | Y_FLIP + db $2b, $7e, $33, 7 | X_FLIP | Y_FLIP + db $2b, $86, $32, 7 | X_FLIP | Y_FLIP + db $2b, $8e, $32, 7 | X_FLIP | Y_FLIP + db $2b, $96, $32, 7 | X_FLIP | Y_FLIP + db $2b, $9e, $31, 7 | X_FLIP | Y_FLIP + db $23, $9e, $30, 7 | X_FLIP | Y_FLIP db $ff Pokedex_LoadCursorOAM: ; 412f1 (10:52f1) diff --git a/engine/pokedex_2.asm b/engine/pokedex_2.asm index 83b366017..f796338fb 100644 --- a/engine/pokedex_2.asm +++ b/engine/pokedex_2.asm @@ -40,7 +40,7 @@ AnimateDexSearchSlowpoke: ; 441cf DoDexSearchSlowpokeFrame: ; 44207 ld a, [wDexSearchSlowpokeFrame] - ld hl, .SpriteData + ld hl, .SlowpokeSpriteData ld de, Sprites .loop ld a, [hli] @@ -64,16 +64,16 @@ DoDexSearchSlowpokeFrame: ; 44207 inc de jr .loop -.SpriteData: ; 44228 - dsprite 11, 0, 9, 0, $00, $00 - dsprite 11, 0, 10, 0, $01, $00 - dsprite 11, 0, 11, 0, $02, $00 - dsprite 12, 0, 9, 0, $10, $00 - dsprite 12, 0, 10, 0, $11, $00 - dsprite 12, 0, 11, 0, $12, $00 - dsprite 13, 0, 9, 0, $20, $00 - dsprite 13, 0, 10, 0, $21, $00 - dsprite 13, 0, 11, 0, $22, $00 +.SlowpokeSpriteData: ; 44228 + dsprite 11, 0, 9, 0, $00, 0 + dsprite 11, 0, 10, 0, $01, 0 + dsprite 11, 0, 11, 0, $02, 0 + dsprite 12, 0, 9, 0, $10, 0 + dsprite 12, 0, 10, 0, $11, 0 + dsprite 12, 0, 11, 0, $12, 0 + dsprite 13, 0, 9, 0, $20, 0 + dsprite 13, 0, 10, 0, $21, 0 + dsprite 13, 0, 11, 0, $22, 0 db -1 DisplayDexEntry: ; 4424d diff --git a/engine/unown_puzzle.asm b/engine/unown_puzzle.asm index ee76f817c..aaad8eb4d 100755 --- a/engine/unown_puzzle.asm +++ b/engine/unown_puzzle.asm @@ -573,27 +573,27 @@ RedrawUnownPuzzlePieces: ; e14d9 ; e150f .OAM_HoldingPiece: ; e150f - dsprite -1, -4, -1, -4, $00, $00 - dsprite -1, -4, 0, -4, $01, $00 - dsprite -1, -4, 0, 4, $02, $00 - dsprite 0, -4, -1, -4, $0c, $00 - dsprite 0, -4, 0, -4, $0d, $00 - dsprite 0, -4, 0, 4, $0e, $00 - dsprite 0, 4, -1, -4, $18, $00 - dsprite 0, 4, 0, -4, $19, $00 - dsprite 0, 4, 0, 4, $1a, $00 + dsprite -1, -4, -1, -4, $00, 0 + dsprite -1, -4, 0, -4, $01, 0 + dsprite -1, -4, 0, 4, $02, 0 + dsprite 0, -4, -1, -4, $0c, 0 + dsprite 0, -4, 0, -4, $0d, 0 + dsprite 0, -4, 0, 4, $0e, 0 + dsprite 0, 4, -1, -4, $18, 0 + dsprite 0, 4, 0, -4, $19, 0 + dsprite 0, 4, 0, 4, $1a, 0 db -1 .OAM_NotHoldingPiece: ; e1534 - dsprite -1, -4, -1, -4, $00, $00 - dsprite -1, -4, 0, -4, $01, $00 - dsprite -1, -4, 0, 4, $00, $20 ; xflip - dsprite 0, -4, -1, -4, $02, $00 - dsprite 0, -4, 0, -4, $03, $00 - dsprite 0, -4, 0, 4, $02, $20 ; xflip - dsprite 0, 4, -1, -4, $00, $40 ; yflip - dsprite 0, 4, 0, -4, $01, $40 ; yflip - dsprite 0, 4, 0, 4, $00, $60 ; xflip, yflip + dsprite -1, -4, -1, -4, $00, 0 + dsprite -1, -4, 0, -4, $01, 0 + dsprite -1, -4, 0, 4, $00, 0 | X_FLIP + dsprite 0, -4, -1, -4, $02, 0 + dsprite 0, -4, 0, -4, $03, 0 + dsprite 0, -4, 0, 4, $02, 0 | X_FLIP + dsprite 0, 4, -1, -4, $00, 0 | Y_FLIP + dsprite 0, 4, 0, -4, $01, 0 | Y_FLIP + dsprite 0, 4, 0, 4, $00, 0 | X_FLIP | Y_FLIP db -1 UnownPuzzleCoordData: ; e1559 -- cgit v1.2.3 From a7fb9e124c21b2f07853319096ec6abda0d47c1a Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 2 Jan 2018 18:02:22 -0500 Subject: =?UTF-8?q?Use=20dsprite=20for=20Pok=C3=A9dex=20cursor=20OAM=20dat?= =?UTF-8?q?a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/pokedex.asm | 184 ++++++++++++++++++++++++++--------------------------- 1 file changed, 92 insertions(+), 92 deletions(-) (limited to 'engine') diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 8a1e02008..163f1afee 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -2026,59 +2026,59 @@ Pokedex_PutOldModeCursorOAM: ; 41157 (10:5157) ret .CursorOAM: ; 41167 - db $18, $47, $30, 7 - db $10, $47, $31, 7 - db $10, $4f, $32, 7 - db $10, $57, $32, 7 - db $10, $5f, $32, 7 - db $10, $67, $33, 7 - db $10, $7e, $33, 7 | X_FLIP - db $10, $86, $32, 7 | X_FLIP - db $10, $8e, $32, 7 | X_FLIP - db $10, $96, $32, 7 | X_FLIP - db $10, $9e, $31, 7 | X_FLIP - db $18, $9e, $30, 7 | X_FLIP - db $20, $47, $30, 7 | Y_FLIP - db $28, $47, $31, 7 | Y_FLIP - db $28, $4f, $32, 7 | Y_FLIP - db $28, $57, $32, 7 | Y_FLIP - db $28, $5f, $32, 7 | Y_FLIP - db $28, $67, $33, 7 | Y_FLIP - db $28, $7e, $33, 7 | X_FLIP | Y_FLIP - db $28, $86, $32, 7 | X_FLIP | Y_FLIP - db $28, $8e, $32, 7 | X_FLIP | Y_FLIP - db $28, $96, $32, 7 | X_FLIP | Y_FLIP - db $28, $9e, $31, 7 | X_FLIP | Y_FLIP - db $20, $9e, $30, 7 | X_FLIP | Y_FLIP + dsprite 3, 0, 9, -1, $30, 7 + dsprite 2, 0, 9, -1, $31, 7 + dsprite 2, 0, 10, -1, $32, 7 + dsprite 2, 0, 11, -1, $32, 7 + dsprite 2, 0, 12, -1, $32, 7 + dsprite 2, 0, 13, -1, $33, 7 + dsprite 2, 0, 16, -2, $33, 7 | X_FLIP + dsprite 2, 0, 17, -2, $32, 7 | X_FLIP + dsprite 2, 0, 18, -2, $32, 7 | X_FLIP + dsprite 2, 0, 19, -2, $32, 7 | X_FLIP + dsprite 2, 0, 20, -2, $31, 7 | X_FLIP + dsprite 3, 0, 20, -2, $30, 7 | X_FLIP + dsprite 4, 0, 9, -1, $30, 7 | Y_FLIP + dsprite 5, 0, 9, -1, $31, 7 | Y_FLIP + dsprite 5, 0, 10, -1, $32, 7 | Y_FLIP + dsprite 5, 0, 11, -1, $32, 7 | Y_FLIP + dsprite 5, 0, 12, -1, $32, 7 | Y_FLIP + dsprite 5, 0, 13, -1, $33, 7 | Y_FLIP + dsprite 5, 0, 16, -2, $33, 7 | X_FLIP | Y_FLIP + dsprite 5, 0, 17, -2, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 0, 18, -2, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 0, 19, -2, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 0, 20, -2, $31, 7 | X_FLIP | Y_FLIP + dsprite 4, 0, 20, -2, $30, 7 | X_FLIP | Y_FLIP db $ff .CursorAtTopOAM: ; 411c8 ; OAM data for when the cursor is at the top of the list. The tiles at the top ; are cut off so they don't show up outside the list area. - db $18, $47, $30, 7 - db $10, $47, $34, 7 - db $10, $4f, $35, 7 - db $10, $57, $35, 7 - db $10, $5f, $35, 7 - db $10, $67, $36, 7 - db $10, $7e, $36, 7 | X_FLIP - db $10, $86, $35, 7 | X_FLIP - db $10, $8e, $35, 7 | X_FLIP - db $10, $96, $35, 7 | X_FLIP - db $10, $9e, $34, 7 | X_FLIP - db $18, $9e, $30, 7 | X_FLIP - db $20, $47, $30, 7 | Y_FLIP - db $28, $47, $31, 7 | Y_FLIP - db $28, $4f, $32, 7 | Y_FLIP - db $28, $57, $32, 7 | Y_FLIP - db $28, $5f, $32, 7 | Y_FLIP - db $28, $67, $33, 7 | Y_FLIP - db $28, $7e, $33, 7 | X_FLIP | Y_FLIP - db $28, $86, $32, 7 | X_FLIP | Y_FLIP - db $28, $8e, $32, 7 | X_FLIP | Y_FLIP - db $28, $96, $32, 7 | X_FLIP | Y_FLIP - db $28, $9e, $31, 7 | X_FLIP | Y_FLIP - db $20, $9e, $30, 7 | X_FLIP | Y_FLIP + dsprite 3, 0, 9, -1, $30, 7 + dsprite 2, 0, 9, -1, $34, 7 + dsprite 2, 0, 10, -1, $35, 7 + dsprite 2, 0, 11, -1, $35, 7 + dsprite 2, 0, 12, -1, $35, 7 + dsprite 2, 0, 13, -1, $36, 7 + dsprite 2, 0, 16, -2, $36, 7 | X_FLIP + dsprite 2, 0, 17, -2, $35, 7 | X_FLIP + dsprite 2, 0, 18, -2, $35, 7 | X_FLIP + dsprite 2, 0, 19, -2, $35, 7 | X_FLIP + dsprite 2, 0, 20, -2, $34, 7 | X_FLIP + dsprite 3, 0, 20, -2, $30, 7 | X_FLIP + dsprite 4, 0, 9, -1, $30, 7 | Y_FLIP + dsprite 5, 0, 9, -1, $31, 7 | Y_FLIP + dsprite 5, 0, 10, -1, $32, 7 | Y_FLIP + dsprite 5, 0, 11, -1, $32, 7 | Y_FLIP + dsprite 5, 0, 12, -1, $32, 7 | Y_FLIP + dsprite 5, 0, 13, -1, $33, 7 | Y_FLIP + dsprite 5, 0, 16, -2, $33, 7 | X_FLIP | Y_FLIP + dsprite 5, 0, 17, -2, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 0, 18, -2, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 0, 19, -2, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 0, 20, -2, $31, 7 | X_FLIP | Y_FLIP + dsprite 4, 0, 20, -2, $30, 7 | X_FLIP | Y_FLIP db $ff Pokedex_PutNewModeABCModeCursorOAM: ; 41229 (10:5229) @@ -2087,26 +2087,26 @@ Pokedex_PutNewModeABCModeCursorOAM: ; 41229 (10:5229) ret .CursorOAM: ; 41230 - db $1b, $47, $30, 7 - db $13, $47, $31, 7 - db $13, $4f, $32, 7 - db $13, $57, $32, 7 - db $13, $5f, $33, 7 - db $13, $80, $33, 7 | X_FLIP - db $13, $88, $32, 7 | X_FLIP - db $13, $90, $32, 7 | X_FLIP - db $13, $98, $31, 7 | X_FLIP - db $1b, $98, $30, 7 | X_FLIP - db $23, $47, $30, 7 | Y_FLIP - db $2b, $47, $31, 7 | Y_FLIP - db $2b, $4f, $32, 7 | Y_FLIP - db $2b, $57, $32, 7 | Y_FLIP - db $2b, $5f, $33, 7 | Y_FLIP - db $2b, $80, $33, 7 | X_FLIP | Y_FLIP - db $2b, $88, $32, 7 | X_FLIP | Y_FLIP - db $2b, $90, $32, 7 | X_FLIP | Y_FLIP - db $2b, $98, $31, 7 | X_FLIP | Y_FLIP - db $23, $98, $30, 7 | X_FLIP | Y_FLIP + dsprite 3, 3, 9, -1, $30, 7 + dsprite 2, 3, 9, -1, $31, 7 + dsprite 2, 3, 10, -1, $32, 7 + dsprite 2, 3, 11, -1, $32, 7 + dsprite 2, 3, 12, -1, $33, 7 + dsprite 2, 3, 16, 0, $33, 7 | X_FLIP + dsprite 2, 3, 17, 0, $32, 7 | X_FLIP + dsprite 2, 3, 18, 0, $32, 7 | X_FLIP + dsprite 2, 3, 19, 0, $31, 7 | X_FLIP + dsprite 3, 3, 19, 0, $30, 7 | X_FLIP + dsprite 4, 3, 9, -1, $30, 7 | Y_FLIP + dsprite 5, 3, 9, -1, $31, 7 | Y_FLIP + dsprite 5, 3, 10, -1, $32, 7 | Y_FLIP + dsprite 5, 3, 11, -1, $32, 7 | Y_FLIP + dsprite 5, 3, 12, -1, $33, 7 | Y_FLIP + dsprite 5, 3, 16, 0, $33, 7 | X_FLIP | Y_FLIP + dsprite 5, 3, 17, 0, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 3, 18, 0, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 3, 19, 0, $31, 7 | X_FLIP | Y_FLIP + dsprite 4, 3, 19, 0, $30, 7 | X_FLIP | Y_FLIP db $ff Pokedex_UpdateSearchResultsCursorOAM: ; 41281 (10:5281) @@ -2118,30 +2118,30 @@ Pokedex_UpdateSearchResultsCursorOAM: ; 41281 (10:5281) ret .CursorOAM: ; 41290 - db $1b, $47, $30, 7 - db $13, $47, $31, 7 - db $13, $4f, $32, 7 - db $13, $57, $32, 7 - db $13, $5f, $32, 7 - db $13, $67, $33, 7 - db $13, $7e, $33, 7 | X_FLIP - db $13, $86, $32, 7 | X_FLIP - db $13, $8e, $32, 7 | X_FLIP - db $13, $96, $32, 7 | X_FLIP - db $13, $9e, $31, 7 | X_FLIP - db $1b, $9e, $30, 7 | X_FLIP - db $23, $47, $30, 7 | Y_FLIP - db $2b, $47, $31, 7 | Y_FLIP - db $2b, $4f, $32, 7 | Y_FLIP - db $2b, $57, $32, 7 | Y_FLIP - db $2b, $5f, $32, 7 | Y_FLIP - db $2b, $67, $33, 7 | Y_FLIP - db $2b, $7e, $33, 7 | X_FLIP | Y_FLIP - db $2b, $86, $32, 7 | X_FLIP | Y_FLIP - db $2b, $8e, $32, 7 | X_FLIP | Y_FLIP - db $2b, $96, $32, 7 | X_FLIP | Y_FLIP - db $2b, $9e, $31, 7 | X_FLIP | Y_FLIP - db $23, $9e, $30, 7 | X_FLIP | Y_FLIP + dsprite 3, 3, 9, -1, $30, 7 + dsprite 2, 3, 9, -1, $31, 7 + dsprite 2, 3, 10, -1, $32, 7 + dsprite 2, 3, 11, -1, $32, 7 + dsprite 2, 3, 12, -1, $32, 7 + dsprite 2, 3, 13, -1, $33, 7 + dsprite 2, 3, 16, -2, $33, 7 | X_FLIP + dsprite 2, 3, 17, -2, $32, 7 | X_FLIP + dsprite 2, 3, 18, -2, $32, 7 | X_FLIP + dsprite 2, 3, 19, -2, $32, 7 | X_FLIP + dsprite 2, 3, 20, -2, $31, 7 | X_FLIP + dsprite 3, 3, 20, -2, $30, 7 | X_FLIP + dsprite 4, 3, 9, -1, $30, 7 | Y_FLIP + dsprite 5, 3, 9, -1, $31, 7 | Y_FLIP + dsprite 5, 3, 10, -1, $32, 7 | Y_FLIP + dsprite 5, 3, 11, -1, $32, 7 | Y_FLIP + dsprite 5, 3, 12, -1, $32, 7 | Y_FLIP + dsprite 5, 3, 13, -1, $33, 7 | Y_FLIP + dsprite 5, 3, 16, -2, $33, 7 | X_FLIP | Y_FLIP + dsprite 5, 3, 17, -2, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 3, 18, -2, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 3, 19, -2, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 3, 20, -2, $31, 7 | X_FLIP | Y_FLIP + dsprite 4, 3, 20, -2, $30, 7 | X_FLIP | Y_FLIP db $ff Pokedex_LoadCursorOAM: ; 412f1 (10:52f1) -- cgit v1.2.3 From 3fc06b0f9da7ef993cb75315c5b2b168a3d6a3cf Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 2 Jan 2018 20:35:57 -0500 Subject: Use constants --- engine/sprites.asm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'engine') diff --git a/engine/sprites.asm b/engine/sprites.asm index e1aad4832..740c3ef68 100755 --- a/engine/sprites.asm +++ b/engine/sprites.asm @@ -36,7 +36,7 @@ PlaySpriteAnimations: ; 8cf69 DoNextFrameForAllSprites: ; 8cf7a ld hl, wSpriteAnimationStructs - ld e, 10 ; There are 10 structs here. + ld e, NUM_SPRITE_ANIM_STRUCTS .loop ld a, [hl] @@ -53,7 +53,7 @@ DoNextFrameForAllSprites: ; 8cf7a jr c, .done .next - ld bc, $10 + ld bc, SPRITEANIMSTRUCT_LENGTH add hl, bc dec e jr nz, .loop @@ -76,7 +76,7 @@ DoNextFrameForAllSprites: ; 8cf7a DoNextFrameForFirst16Sprites: ; 8cfa8 (23:4fa8) ld hl, wSpriteAnimationStructs - ld e, 10 + ld e, NUM_SPRITE_ANIM_STRUCTS .loop ld a, [hl] @@ -93,7 +93,7 @@ DoNextFrameForFirst16Sprites: ; 8cfa8 (23:4fa8) jr c, .done .next - ld bc, $10 + ld bc, SPRITEANIMSTRUCT_LENGTH add hl, bc dec e jr nz, .loop @@ -119,12 +119,12 @@ InitSpriteAnimStruct:: ; 8cfd6 push de push af ld hl, wSpriteAnimationStructs - ld e, 10 + ld e, NUM_SPRITE_ANIM_STRUCTS .loop ld a, [hl] and a jr z, .found - ld bc, $10 + ld bc, SPRITEANIMSTRUCT_LENGTH add hl, bc dec e jr nz, .loop @@ -222,8 +222,8 @@ DeinitializeSprite: ; 8d036 DeinitializeAllSprites: ; 8d03d (23:503d) ; Clear the index field of every struct in the wSpriteAnimationStructs array. ld hl, wSpriteAnimationStructs - ld bc, $10 - ld e, 10 + ld bc, SPRITEANIMSTRUCT_LENGTH + ld e, NUM_SPRITE_ANIM_STRUCTS xor a .loop ld [hl], a @@ -391,7 +391,7 @@ GetSpriteAnimVTile: ; 8d109 push bc ld hl, wSpriteAnimDict ld b, a - ld c, 10 + ld c, NUM_SPRITE_ANIM_STRUCTS .loop ld a, [hli] cp b -- cgit v1.2.3 From 51106cccd02ba305b1aa12b644f5a0e9193fd555 Mon Sep 17 00:00:00 2001 From: Adelaide Walter Date: Wed, 3 Jan 2018 00:19:54 -0500 Subject: Scrub WRAM addresses from comments & use WRAM1_Begin where appropriate. --- engine/events/battle_tower.asm | 2 +- engine/gbc_only.asm | 4 ++-- engine/link.asm | 7 ------- 3 files changed, 3 insertions(+), 10 deletions(-) (limited to 'engine') diff --git a/engine/events/battle_tower.asm b/engine/events/battle_tower.asm index a0de6ee84..530bdf41c 100644 --- a/engine/events/battle_tower.asm +++ b/engine/events/battle_tower.asm @@ -100,7 +100,7 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081 .FindARandomBattleTowerPkmn: ; From Which LevelGroup are the Pkmn loaded ; a = 1..10 - ld a, [wBTChoiceOfLvlGroup] ; [$d800] + ld a, [wBTChoiceOfLvlGroup] dec a ld hl, BattleTowerMons ld bc, BattleTowerMons2 - BattleTowerMons1 diff --git a/engine/gbc_only.asm b/engine/gbc_only.asm index efceae701..ad2785fa9 100644 --- a/engine/gbc_only.asm +++ b/engine/gbc_only.asm @@ -10,7 +10,7 @@ GBCOnlyScreen: ; 4ea82 call ClearTileMap ld hl, GBCOnlyGFX - ld de, $d000 + ld de, WRAM1_Begin ld a, [rSVBK] push af ld a, 0 @@ -19,7 +19,7 @@ GBCOnlyScreen: ; 4ea82 pop af ld [rSVBK], a - ld de, $d000 + ld de, WRAM1_Begin ld hl, vTiles2 lb bc, BANK(GBCOnlyGFX), $54 call Get2bpp diff --git a/engine/link.asm b/engine/link.asm index 5c45707d7..30d775350 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -811,31 +811,24 @@ Link_PrepPartyData_Gen2: ; 28595 inc de dec b jr nz, .loop1 - ; de = $c806 ld hl, PlayerName ld bc, NAME_LENGTH call CopyBytes - ; de = $c811 ld hl, PartyCount ld bc, 1 + PARTY_LENGTH + 1 call CopyBytes - ; de = $c819 ld hl, PlayerID ld bc, 2 call CopyBytes - ; de = $c81b ld hl, PartyMon1Species ld bc, PARTY_LENGTH * PARTYMON_STRUCT_LENGTH call CopyBytes - ; de = $c93b ld hl, PartyMonOT ld bc, PARTY_LENGTH * NAME_LENGTH call CopyBytes - ; de = $c97d ld hl, PartyMonNicknames ld bc, PARTY_LENGTH * PKMN_NAME_LENGTH call CopyBytes - ; de = $c9bf ; Okay, we did all that. Now, are we in the trade center? ld a, [wLinkMode] -- cgit v1.2.3 From 76ee2f58c432f3074d2a796e617e510cb2bcadd9 Mon Sep 17 00:00:00 2001 From: Adelaide Walter Date: Wed, 3 Jan 2018 00:40:59 -0500 Subject: WRAM1_Begin -> wd000 --- engine/gbc_only.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/gbc_only.asm b/engine/gbc_only.asm index ad2785fa9..6e26fad39 100644 --- a/engine/gbc_only.asm +++ b/engine/gbc_only.asm @@ -10,7 +10,7 @@ GBCOnlyScreen: ; 4ea82 call ClearTileMap ld hl, GBCOnlyGFX - ld de, WRAM1_Begin + ld de, wd000 ld a, [rSVBK] push af ld a, 0 @@ -19,7 +19,7 @@ GBCOnlyScreen: ; 4ea82 pop af ld [rSVBK], a - ld de, WRAM1_Begin + ld de, wd000 ld hl, vTiles2 lb bc, BANK(GBCOnlyGFX), $54 call Get2bpp -- cgit v1.2.3 From 8d095cd5b8c8aa120ec4ccb215cd0ee6345a197b Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 3 Jan 2018 01:27:12 -0500 Subject: Better names --- engine/sprite_anims.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/sprite_anims.asm b/engine/sprite_anims.asm index f51b26e61..29af03d89 100755 --- a/engine/sprite_anims.asm +++ b/engine/sprite_anims.asm @@ -430,7 +430,7 @@ DoAnimFrame: ; 8d24b ; 8d493 .TradePokeBall_zero ; 8d493 - ld a, SPRITE_ANIM_FRAMESET_TRADE_POKE_BALL_0 + ld a, SPRITE_ANIM_FRAMESET_TRADE_POKE_BALL_WIGGLE call _ReinitSpriteAnimFrame ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX -- cgit v1.2.3 From cd8a22cd2e34da018fd2cdea21f00b6238b824ff Mon Sep 17 00:00:00 2001 From: Adelaide Walter Date: Wed, 3 Jan 2018 01:29:52 -0500 Subject: Replace magic reference to PackMenuGFX. --- engine/pack.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/pack.asm b/engine/pack.asm index 047924cb0..131af0736 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -1710,7 +1710,7 @@ TextJump_YouCantUseItInABattle: ; 0x10b11 db "@" ; 0x10b16 -PackMenuGFX: +PackMenuGFX:: INCBIN "gfx/pack/pack_menu.2bpp" PackGFX: INCBIN "gfx/pack/pack.2bpp" -- cgit v1.2.3 From 10bd011d0619996783e370a602619ea802833600 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 3 Jan 2018 02:23:54 -0500 Subject: More relevant data file locations --- engine/link.asm | 2 +- engine/time_capsule.asm | 2 +- engine/time_capsule_2.asm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'engine') diff --git a/engine/link.asm b/engine/link.asm index 5c45707d7..e45f62dfd 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -1130,7 +1130,7 @@ TimeCapsule_ReplaceTeruSama: ; 28771 ret -INCLUDE "data/time_capsule/catch_rate_items.asm" +INCLUDE "data/items/catch_rate_items.asm" Link_CopyOTData: ; 2879e diff --git a/engine/time_capsule.asm b/engine/time_capsule.asm index 577b2dce8..96f61833b 100755 --- a/engine/time_capsule.asm +++ b/engine/time_capsule.asm @@ -144,4 +144,4 @@ PlaceTradePartnerNamesAndParty: ; fb60d jr .loop ; fb656 -INCLUDE "data/time_capsule/special_stats.asm" +INCLUDE "data/pokemon/rby_base_special.asm" diff --git a/engine/time_capsule_2.asm b/engine/time_capsule_2.asm index 5da72e7c8..0378ed697 100644 --- a/engine/time_capsule_2.asm +++ b/engine/time_capsule_2.asm @@ -36,4 +36,4 @@ ConvertMon_1to2: ; fb908 ; fb91c -INCLUDE "data/time_capsule/mon_order.asm" +INCLUDE "data/pokemon/rby_order.asm" -- cgit v1.2.3 From 91f97f08f06923e3548797133275df53e240d894 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Wed, 3 Jan 2018 14:58:08 +0100 Subject: Special_MapCallbackSprites_LoadUsedSpritesGFX -> Special_LoadUsedSpritesGFX --- engine/overworld.asm | 8 ++++---- engine/specials.asm | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'engine') diff --git a/engine/overworld.asm b/engine/overworld.asm index 4b330efb1..67c2f25c6 100755 --- a/engine/overworld.asm +++ b/engine/overworld.asm @@ -23,7 +23,7 @@ Function14146: ; mobile push af res 7, [hl] set 6, [hl] - call Special_MapCallbackSprites_LoadUsedSpritesGFX + call Special_LoadUsedSpritesGFX pop af ld [wSpriteFlags], a ret @@ -35,7 +35,7 @@ Function14157: ; mobile push af set 7, [hl] res 6, [hl] - call Special_MapCallbackSprites_LoadUsedSpritesGFX + call Special_LoadUsedSpritesGFX pop af ld [wSpriteFlags], a ret @@ -43,7 +43,7 @@ Function14157: ; mobile Special_RefreshSprites:: ; 14168 call .Refresh - call Special_MapCallbackSprites_LoadUsedSpritesGFX + call Special_LoadUsedSpritesGFX ret ; 1416f @@ -164,7 +164,7 @@ AddOutdoorSprites: ; 141ee ; 14209 -Special_MapCallbackSprites_LoadUsedSpritesGFX: ; 14209 +Special_LoadUsedSpritesGFX: ; 14209 ld a, MAPCALLBACK_SPRITES call RunMapCallback call GetUsedSprites diff --git a/engine/specials.asm b/engine/specials.asm index 83ec5bfb3..5b4fd45ae 100644 --- a/engine/specials.asm +++ b/engine/specials.asm @@ -113,7 +113,7 @@ SpecialsPointers:: ; c029 add_special Special_RandomUnseenWildMon add_special Special_RandomPhoneWildMon add_special Special_RandomPhoneMon - add_special Special_MapCallbackSprites_LoadUsedSpritesGFX + add_special Special_LoadUsedSpritesGFX add_special Special_PlaySlowCry add_special Special_SnorlaxAwake add_special Special_YoungerHaircutBrother -- cgit v1.2.3 From 9d0ba6bfd3b2f10fae9969a784aa7b2b573e8411 Mon Sep 17 00:00:00 2001 From: Adelaide Walter Date: Wed, 3 Jan 2018 19:12:45 -0500 Subject: Use BANK for hardcoded WRAM banks (except where bankswitches appear unnecessary). --- engine/battle/battle_transition.asm | 10 ++++---- engine/battle/core.asm | 4 +-- engine/battle/sliding_intro.asm | 2 +- engine/battle_anims/anim_commands.asm | 30 +++++++++++----------- engine/battle_anims/bg_effects.asm | 4 +-- engine/battle_anims/functions.asm | 4 +-- engine/card_flip.asm | 2 +- engine/color.asm | 12 ++++----- engine/credits.asm | 2 +- engine/crystal_intro.asm | 48 +++++++++++++++++------------------ engine/debug.asm | 10 ++++---- engine/dma_transfer.asm | 8 +++--- engine/events/heal_machine_anim.asm | 2 +- engine/events/magnet_train.asm | 8 +++--- engine/events/poisonstep_pals.asm | 2 +- engine/events/print_unown.asm | 2 +- engine/gbc_only.asm | 2 +- engine/init_hof_credits.asm | 2 +- engine/init_map.asm | 2 +- engine/intro_menu.asm | 2 +- engine/menu.asm | 4 +-- engine/pic_animation.asm | 4 +-- engine/pokedex.asm | 2 +- engine/timeofdaypals.asm | 10 ++++---- engine/title.asm | 2 +- engine/unused_title.asm | 2 +- 26 files changed, 91 insertions(+), 91 deletions(-) (limited to 'engine') diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 2b9ebe091..73f7eaef4 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -23,7 +23,7 @@ Predef_StartBattle: ; 8c20f .done ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, wBGPals1 @@ -44,7 +44,7 @@ Predef_StartBattle: ; 8c20f ld [hLYOverrideEnd], a ld [hSCY], a - ld a, $1 + ld a, 1 ; unnecessary bankswitch? ld [rSVBK], a pop af ld [hVBlank], a @@ -116,7 +116,7 @@ LoadTrainerBattlePokeballTiles: ConvertTrainerBattlePokeballTilesTo2bpp: ; 8c2cf ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a push hl ld hl, wDecompressScratch @@ -647,7 +647,7 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) .daytime ld a, [rSVBK] push af - ld a, $5 ; WRAM5 = palettes + ld a, BANK(wBGPals1) ld [rSVBK], a call .copypals push hl @@ -729,7 +729,7 @@ PokeBallTransition: WipeLYOverrides: ; 8c6d8 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(LYOverrides) ld [rSVBK], a ld hl, LYOverrides diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 48be08bf0..bac39e76f 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -9320,7 +9320,7 @@ InitBattleDisplay: ; 3fb6c .BlankBGMap: ; 3fbd6 ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld hl, wDecompressScratch @@ -9381,7 +9381,7 @@ GetTrainerBackpic: ; 3fbff CopyBackpic: ; 3fc30 ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld hl, vTiles0 ld de, vTiles2 tile $31 diff --git a/engine/battle/sliding_intro.asm b/engine/battle/sliding_intro.asm index ed78add8e..2cd242c84 100755 --- a/engine/battle/sliding_intro.asm +++ b/engine/battle/sliding_intro.asm @@ -1,7 +1,7 @@ BattleIntroSlidingPics: ; 4e980 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(LYOverrides) ld [rSVBK], a call .subfunction1 ld a, rSCX - $ff00 diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index 27d57e68f..b91aa8c6c 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -5,7 +5,7 @@ PlayBattleAnim: ; cc0d6 ld a, [rSVBK] push af - ld a, 5 + ld a, BANK(ActiveAnimObjects) ld [rSVBK], a call _PlayBattleAnim @@ -163,7 +163,7 @@ BattleAnimRestoreHuds: ; cc1bb ld a, [rSVBK] push af - ld a, $1 + ld a, BANK(CurBattleMon) ; alternatively: BANK(TempMon), BANK(PartyMon1), several others ld [rSVBK], a ld hl, UpdateBattleHuds @@ -917,7 +917,7 @@ BattleAnimCmd_E7: ; cc5db (33:45db) BattleAnimCmd_Transform: ; cc5dc (33:45dc) ld a, [rSVBK] push af - ld a, 1 + ld a, BANK(CurPartySpecies) ld [rSVBK], a ld a, [CurPartySpecies] ; CurPartySpecies push af @@ -973,7 +973,7 @@ BattleAnimCmd_RaiseSub: ; cc640 (33:4640) ld a, [rSVBK] push af - ld a, 1 + ld a, 1 ; unnecessary bankswitch? ld [rSVBK], a xor a call GetSRAMBank @@ -1047,7 +1047,7 @@ GetSubstitutePic: ; cc64c BattleAnimCmd_MinimizeOpp: ; cc6cf (33:46cf) ld a, [rSVBK] push af - ld a, $1 + ld a, 1 ; unnecessary bankswitch? ld [rSVBK], a xor a call GetSRAMBank @@ -1103,7 +1103,7 @@ INCBIN "gfx/battle/minimize.2bpp" BattleAnimCmd_Minimize: ; cc735 (33:4735) ld a, [rSVBK] push af - ld a, $1 + ld a, 1 ; unnecessary bankswitch? ld [rSVBK], a xor a call GetSRAMBank @@ -1118,7 +1118,7 @@ BattleAnimCmd_Minimize: ; cc735 (33:4735) BattleAnimCmd_DropSub: ; cc750 (33:4750) ld a, [rSVBK] push af - ld a, $1 + ld a, BANK(CurPartySpecies) ld [rSVBK], a ld a, [CurPartySpecies] ; CurPartySpecies @@ -1143,7 +1143,7 @@ BattleAnimCmd_DropSub: ; cc750 (33:4750) BattleAnimCmd_BeatUp: ; cc776 (33:4776) ld a, [rSVBK] push af - ld a, $1 + ld a, BANK(CurPartySpecies) ld [rSVBK], a ld a, [CurPartySpecies] ; CurPartySpecies push af @@ -1254,7 +1254,7 @@ endr ld a, [rSVBK] push af - ld a, 1 + ld a, BANK(EnemyMon) ; BattleMon is in WRAM0, but EnemyMon is in WRAMX ld [rSVBK], a ld a, [hBattleTurn] @@ -1262,14 +1262,14 @@ endr jr nz, .enemy ld a, $f0 - ld [CryTracks], a ; CryTracks - ld a, [BattleMonSpecies] ; BattleMonSpecies + ld [CryTracks], a + ld a, [BattleMonSpecies] jr .done_cry_tracks .enemy ld a, $0f - ld [CryTracks], a ; CryTracks - ld a, [EnemyMonSpecies] ; EnemyMon + ld [CryTracks], a + ld a, [EnemyMonSpecies] .done_cry_tracks push hl @@ -1431,7 +1431,7 @@ BattleAnim_SetBGPals: ; cc91a ret z ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, wBGPals2 ld de, wBGPals1 @@ -1459,7 +1459,7 @@ BattleAnim_SetOBPals: ; cc94b ret z ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wOBPals1) ld [rSVBK], a ld hl, wOBPals2 palette PAL_BATTLE_OB_GRAY ld de, wOBPals1 palette PAL_BATTLE_OB_GRAY diff --git a/engine/battle_anims/bg_effects.asm b/engine/battle_anims/bg_effects.asm index bb8feb1f9..3dd6e7785 100644 --- a/engine/battle_anims/bg_effects.asm +++ b/engine/battle_anims/bg_effects.asm @@ -2578,7 +2578,7 @@ BGEffects_LoadBGPal0_OBPal1: ; c8e52 (32:4e52) ld h, a ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld a, h push bc @@ -2605,7 +2605,7 @@ BGEffects_LoadBGPal1_OBPal0: ; c8e7f (32:4e7f) ld h, a ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld a, h push bc diff --git a/engine/battle_anims/functions.asm b/engine/battle_anims/functions.asm index ea9fb70b3..1a66ed51d 100755 --- a/engine/battle_anims/functions.asm +++ b/engine/battle_anims/functions.asm @@ -428,9 +428,9 @@ GetBallAnimPal: ; cd249 (33:5249) ld hl, BallColors ld a, [rSVBK] push af - ld a, $1 + ld a, BANK(CurItem) ld [rSVBK], a - ld a, [CurItem] ; CurItem + ld a, [CurItem] ld e, a pop af ld [rSVBK], a diff --git a/engine/card_flip.asm b/engine/card_flip.asm index 158f3fa05..78a734514 100755 --- a/engine/card_flip.asm +++ b/engine/card_flip.asm @@ -1649,7 +1649,7 @@ CardFlip_InitAttrPals: ; e0c37 (38:4c37) ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, .palettes ld de, wBGPals1 diff --git a/engine/color.asm b/engine/color.asm index 04b24fde9..054d74654 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -394,7 +394,7 @@ LoadStatsScreenPals: add hl, bc ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld a, [hli] ld [wBGPals1 palette 0], a @@ -504,7 +504,7 @@ GetPredefPal: LoadHLPaletteIntoDE: ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wOBPals1) ld [rSVBK], a ld c, $8 .loop @@ -520,7 +520,7 @@ LoadHLPaletteIntoDE: LoadPalette_White_Col1_Col2_Black: ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld a, LOW(palred 31 + palgreen 31 + palblue 31) @@ -572,7 +572,7 @@ ResetBGPals: ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, wBGPals1 @@ -930,7 +930,7 @@ InitCGBPals:: jr nz, .obpals_loop ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, wBGPals1 call .LoadWhitePals @@ -1251,7 +1251,7 @@ LoadMapPals: ; Switch to palettes WRAM bank ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, wBGPals1 ld b, 8 diff --git a/engine/credits.asm b/engine/credits.asm index 3dddb4126..8a5cd2c75 100644 --- a/engine/credits.asm +++ b/engine/credits.asm @@ -13,7 +13,7 @@ Credits:: ; 109847 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wPals) ld [rSVBK], a call ClearBGPalettes diff --git a/engine/crystal_intro.asm b/engine/crystal_intro.asm index 302490a3b..2c4a31af5 100755 --- a/engine/crystal_intro.asm +++ b/engine/crystal_intro.asm @@ -57,7 +57,7 @@ Copyright_GFPresents: ; e4579 ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld hl, IntroLogoGFX @@ -319,7 +319,7 @@ GameFreakLogoScene4: ; e4776 (39:4776) add hl, de ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wOBPals2) ld [rSVBK], a ld a, [hli] ld [wOBPals2 + 12], a @@ -352,7 +352,7 @@ INCBIN "gfx/splash/logo2.1bpp" CrystalIntro: ; e48ac ld a, [rSVBK] push af - ld a, 5 + ld a, BANK(wPals) ld [rSVBK], a ld a, [hInMenu] push af @@ -480,7 +480,7 @@ IntroScene1: ; e495b (39:495b) call Intro_DecompressRequest2bpp_64Tiles ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_365ad ld de, wBGPals1 @@ -553,7 +553,7 @@ IntroScene3: ; e49fd (39:49fd) call Intro_DecompressRequest2bpp_64Tiles ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_e5edd ld de, wBGPals1 @@ -619,7 +619,7 @@ IntroScene5: ; e4a7a (39:4a7a) call Intro_DecompressRequest2bpp_64Tiles ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_365ad ld de, wBGPals1 @@ -725,7 +725,7 @@ IntroScene7: ; e4b3f (39:4b3f) ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_e5edd @@ -884,7 +884,7 @@ IntroScene11: ; e4c86 (39:4c86) call Intro_DecompressRequest2bpp_64Tiles ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_365ad ld de, wBGPals1 @@ -1011,7 +1011,7 @@ IntroScene13: ; e4d6d (39:4d6d) call Intro_DecompressRequest2bpp_64Tiles ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_e5edd ld de, wBGPals1 @@ -1120,7 +1120,7 @@ IntroScene15: ; e4e40 (39:4e40) call Intro_LoadTilemap ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_e77dd ld de, wBGPals1 @@ -1194,7 +1194,7 @@ IntroScene17: ; e4ef5 (39:4ef5) call Intro_DecompressRequest2bpp_64Tiles ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_e6d6d ld de, wBGPals1 @@ -1268,7 +1268,7 @@ IntroScene19: ; e4f7e (39:4f7e) call Intro_LoadTilemap ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_e77dd ld de, wBGPals1 @@ -1438,7 +1438,7 @@ IntroScene26: ; e50bb (39:50bb) call Intro_DecompressRequest2bpp_64Tiles ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, Palette_e679d ld de, wBGPals1 @@ -1526,7 +1526,7 @@ Intro_Scene24_ApplyPaletteFade: ; e5172 (39:5172) ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a ld de, wBGPals2 ld b, 8 ; number of BG pals @@ -1617,7 +1617,7 @@ CrystalIntro_UnownFade: ; e5223 (39:5223) ld b, $0 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a push hl @@ -1722,7 +1722,7 @@ Intro_Scene20_AppearUnown: ; e5348 (39:5348) ld c, a ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a push bc @@ -1791,7 +1791,7 @@ endr ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a push hl @@ -1846,7 +1846,7 @@ endr Intro_LoadTilemap: ; e541b (39:541b) ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld hl, wDecompressScratch @@ -1946,7 +1946,7 @@ Intro_SetCGBPalUpdate: ; e549e (39:549e) Intro_ClearBGPals: ; e54a3 (39:54a3) ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a ld hl, wBGPals2 @@ -1965,7 +1965,7 @@ Intro_ClearBGPals: ; e54a3 (39:54a3) Intro_DecompressRequest2bpp_128Tiles: ; e54c2 (39:54c2) ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a push de @@ -1984,7 +1984,7 @@ Intro_DecompressRequest2bpp_128Tiles: ; e54c2 (39:54c2) Intro_DecompressRequest2bpp_255Tiles: ; e54de (39:54de) ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a push de @@ -2003,7 +2003,7 @@ Intro_DecompressRequest2bpp_255Tiles: ; e54de (39:54de) Intro_DecompressRequest2bpp_64Tiles: ; e54fa (39:54fa) ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a push de @@ -2022,7 +2022,7 @@ Intro_DecompressRequest2bpp_64Tiles: ; e54fa (39:54fa) Intro_ResetLYOverrides: ; e5516 (39:5516) ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(LYOverrides) ld [rSVBK], a ld hl, LYOverrides @@ -2039,7 +2039,7 @@ Intro_ResetLYOverrides: ; e5516 (39:5516) Intro_PerspectiveScrollBG: ; e552f (39:552f) ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(LYOverrides) ld [rSVBK], a ; Scroll the grass every frame. ; Scroll the trees every other frame and at half speed. diff --git a/engine/debug.asm b/engine/debug.asm index 1e0d042e0..8cc4809e8 100755 --- a/engine/debug.asm +++ b/engine/debug.asm @@ -155,7 +155,7 @@ Function819a7: ; 819a7 ret z ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a ld hl, Palette_819f4 ld de, wBGPals2 @@ -436,7 +436,7 @@ Function81c33: ; 81c33 jr z, .asm_81c69 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a ld hl, wBGPals2 ld de, wc608 @@ -1145,7 +1145,7 @@ Function82203: ; 82203 Function8220f: ; 8220f ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld a, [wcf64] ld l, a @@ -1198,7 +1198,7 @@ Function82236: ; 82236 call Function821d8 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a ld hl, wBGPals2 ld a, [wcf64] @@ -1228,7 +1228,7 @@ Function82236: ; 82236 Function822a3: ; 822a3 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a ld hl, wBGPals2 ld a, [wcf64] diff --git a/engine/dma_transfer.asm b/engine/dma_transfer.asm index 56e7d56da..eef2b936d 100755 --- a/engine/dma_transfer.asm +++ b/engine/dma_transfer.asm @@ -143,7 +143,7 @@ Mobile_ReloadMapPart: ; 104099 .unreferenced_104101 ld a, $1 ld [rVBK], a - ld a, $3 + ld a, BANK(w3_d800) ld [rSVBK], a ld hl, w3_d800 call HDMATransferToWRAMBank3 @@ -221,7 +221,7 @@ CallInSafeGFXMode: ; 104177 ld [hMapAnims], a ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wScratchTileMap) ld [rSVBK], a ld a, [rVBK] push af @@ -472,7 +472,7 @@ _Get2bpp:: ; 104284 ; switch to WRAM bank 6 ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wScratchTileMap) ld [rSVBK], a push bc @@ -542,7 +542,7 @@ _Get1bpp:: ; 1042b2 .bankswitch ; 1042d6 ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wScratchTileMap) ld [rSVBK], a push bc diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm index 493330e58..d60acb5b6 100755 --- a/engine/events/heal_machine_anim.asm +++ b/engine/events/heal_machine_anim.asm @@ -198,7 +198,7 @@ INCBIN "gfx/overworld/heal_machine.2bpp" .go ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wOBPals2) ld [rSVBK], a ld hl, wOBPals2 palette PAL_OW_TREE diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm index c85642ab8..510af938a 100755 --- a/engine/events/magnet_train.asm +++ b/engine/events/magnet_train.asm @@ -16,7 +16,7 @@ Special_MagnetTrain: ; 8cc04 ld h, a ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wMagnetTrain) ld [rSVBK], a ld a, h @@ -129,7 +129,7 @@ MagntTrain_LoadGFX_PlayMusic: ; 8ccc9 ld [hSCY], a ld a, [rSVBK] push af - ld a, $1 + ld a, BANK(wPlayerGender) ld [rSVBK], a farcall GetPlayerIcon pop af @@ -325,7 +325,7 @@ MagnetTrain_Jumptable: ; 8cdf7 ld b, SPRITE_ANIM_INDEX_MAGNET_TRAIN_RED ld a, [rSVBK] push af - ld a, $1 + ld a, BANK(wPlayerGender) ld [rSVBK], a ld a, [wPlayerGender] bit 0, a @@ -429,7 +429,7 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae call DelayFrame ld a, [rSVBK] push af - ld a, $1 + ld a, BANK(wEnvironment) ld [rSVBK], a ld a, [TimeOfDayPal] push af diff --git a/engine/events/poisonstep_pals.asm b/engine/events/poisonstep_pals.asm index 498ae8f18..b132b178f 100644 --- a/engine/events/poisonstep_pals.asm +++ b/engine/events/poisonstep_pals.asm @@ -26,7 +26,7 @@ LoadPoisonBGPals: ; cbcdd .cgb ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals2) ld [rSVBK], a ld hl, wBGPals2 ld c, 4 palettes diff --git a/engine/events/print_unown.asm b/engine/events/print_unown.asm index 72248a67b..4a4367e13 100644 --- a/engine/events/print_unown.asm +++ b/engine/events/print_unown.asm @@ -154,7 +154,7 @@ UnownPrinter: ; 16be4 .Load2bppToSRAM: ; 16cff ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld a, BANK(sScratch) diff --git a/engine/gbc_only.asm b/engine/gbc_only.asm index 6e26fad39..a36efe04c 100644 --- a/engine/gbc_only.asm +++ b/engine/gbc_only.asm @@ -13,7 +13,7 @@ GBCOnlyScreen: ; 4ea82 ld de, wd000 ld a, [rSVBK] push af - ld a, 0 + ld a, 0 ; this is tantamount to selecting Bank 1 ld [rSVBK], a call Decompress pop af diff --git a/engine/init_hof_credits.asm b/engine/init_hof_credits.asm index 8e3db75eb..e72ae011c 100644 --- a/engine/init_hof_credits.asm +++ b/engine/init_hof_credits.asm @@ -63,7 +63,7 @@ InitDisplayForRedCredits: ; 4e8c2 ResetDisplayBetweenHallOfFameMons: ; 4e906 ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld hl, wDecompressScratch ld bc, wScratchAttrMap - wDecompressScratch diff --git a/engine/init_map.asm b/engine/init_map.asm index e5bee971d..e1b6b9ab9 100644 --- a/engine/init_map.asm +++ b/engine/init_map.asm @@ -79,7 +79,7 @@ LoadFonts_NoOAMUpdate:: ; 64bf HDMATransfer_FillBGMap0WithBlack: ; 64db ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld a, "" ; $60 diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index 7d17b62e5..441119342 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -1019,7 +1019,7 @@ CrystalIntroSequence: ; 620b StartTitleScreen: ; 6219 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a call .TitleScreen diff --git a/engine/menu.asm b/engine/menu.asm index 6fbed2848..e5a5ed6c9 100755 --- a/engine/menu.asm +++ b/engine/menu.asm @@ -586,7 +586,7 @@ Place2DMenuCursor: ; 24329 _PushWindow:: ; 24374 ld a, [rSVBK] push af - ld a, $7 + ld a, BANK(wWindowStack) ld [rSVBK], a ld hl, wWindowStackPointer @@ -691,7 +691,7 @@ _ExitMenu:: ; 243e8 ld a, [rSVBK] push af - ld a, $7 + ld a, BANK(wWindowStack) ld [rSVBK], a call GetWindowStackTop diff --git a/engine/pic_animation.asm b/engine/pic_animation.asm index 33b770b14..e10dcc360 100644 --- a/engine/pic_animation.asm +++ b/engine/pic_animation.asm @@ -279,7 +279,7 @@ PokeAnim_StereoCry: ; d0196 PokeAnim_DeinitFrames: ; d01a9 ld a, [rSVBK] push af - ld a, $2 + ld a, BANK(wPokeAnimCoord) ld [rSVBK], a call PokeAnim_PlaceGraphic farcall HDMATransferTileMapToWRAMBank3 @@ -876,7 +876,7 @@ PokeAnim_PlaceGraphic: ; d04bd PokeAnim_SetVBank1: ; d0504 ld a, [rSVBK] push af - ld a, $2 + ld a, BANK(wPokeAnimCoord) ld [rSVBK], a xor a ld [hBGMapMode], a diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 5dc3dc2a7..5030fe5f1 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -2348,7 +2348,7 @@ Pokedex_BlackOutBG: ; 41401 (10:5401) ; Make BG palettes black so that the BG becomes all black. ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, wBGPals1 ld bc, 8 palettes diff --git a/engine/timeofdaypals.asm b/engine/timeofdaypals.asm index 0b1ea71a2..defa9e96d 100644 --- a/engine/timeofdaypals.asm +++ b/engine/timeofdaypals.asm @@ -47,8 +47,8 @@ _TimeOfDayPals:: ; 8c011 ; save wram bank ld a, [rSVBK] ld b, a -; wram bank 5 - ld a, $5 + + ld a, BANK(wBGPals1) ld [rSVBK], a ; push palette @@ -78,8 +78,8 @@ _TimeOfDayPals:: ; 8c011 ; save wram bank ld a, [rSVBK] ld d, a -; wram bank 5 - ld a, 5 + + ld a, BANK(wOBPals1) ld [rSVBK], a ; pop palette @@ -173,7 +173,7 @@ Special_FadeBlackQuickly: ; 8c0b6 FillWhiteBGColor: ; 8c0c1 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, wBGPals1 diff --git a/engine/title.asm b/engine/title.asm index 2b43c811a..1b7ae66e0 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -139,7 +139,7 @@ _TitleScreen: ; 10ed67 ld a, [rSVBK] push af ; WRAM bank 5 - ld a, 5 + ld a, BANK(wBGPals1) ld [rSVBK], a ; Update palette colors diff --git a/engine/unused_title.asm b/engine/unused_title.asm index f0b59b527..5af468e2a 100644 --- a/engine/unused_title.asm +++ b/engine/unused_title.asm @@ -63,7 +63,7 @@ UnusedTitleScreen: ; 10c000 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, UnusedTitleBG_Palettes -- cgit v1.2.3 From 5fd3bfa83210fd9885f7558d02b01fc5ea3c5ed1 Mon Sep 17 00:00:00 2001 From: Adelaide Walter Date: Wed, 3 Jan 2018 20:47:44 -0500 Subject: Clarify the purpose of writing 0 to rSVBK. --- engine/gbc_only.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/gbc_only.asm b/engine/gbc_only.asm index a36efe04c..b2207d436 100644 --- a/engine/gbc_only.asm +++ b/engine/gbc_only.asm @@ -13,7 +13,7 @@ GBCOnlyScreen: ; 4ea82 ld de, wd000 ld a, [rSVBK] push af - ld a, 0 ; this is tantamount to selecting Bank 1 + ld a, 0 ; this has the same effect as selecting bank 1 (http://gbdev.gg8.se/files/docs/mirrors/pandocs.html#videodisplay) ld [rSVBK], a call Decompress pop af -- cgit v1.2.3 From fb422e8d9c78c56db27d974baa04c7a16bf5df41 Mon Sep 17 00:00:00 2001 From: Adelaide Walter Date: Thu, 4 Jan 2018 14:53:50 -0500 Subject: Use BANK for hardcoded WRAM banks preceding FarCopyWRAM/GetFarWRAMByte calls. --- engine/battle/checkbattlescene.asm | 4 ++-- engine/color.asm | 18 +++++++++--------- engine/crystal_colors.asm | 2 +- engine/events/heal_machine_anim.asm | 2 +- engine/init_gender.asm | 2 +- engine/pic_animation.asm | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) (limited to 'engine') diff --git a/engine/battle/checkbattlescene.asm b/engine/battle/checkbattlescene.asm index b63f00907..5253c3c47 100644 --- a/engine/battle/checkbattlescene.asm +++ b/engine/battle/checkbattlescene.asm @@ -1,7 +1,7 @@ CheckBattleScene: ; 4ea44 ; Return carry if battle scene is turned off. - ld a, 0 + ld a, BANK(wLinkMode) ld hl, wLinkMode call GetFarWRAMByte cp LINK_MOBILE @@ -33,7 +33,7 @@ CheckBattleScene: ; 4ea44 ret .from_wram - ld a, $5 + ld a, BANK(w5_dc00) ld hl, w5_dc00 call GetFarWRAMByte bit 0, a diff --git a/engine/color.asm b/engine/color.asm index 054d74654..b074d2080 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -144,13 +144,13 @@ Function8b07: ld hl, .BGPal ld de, wBGPals1 ld bc, 1 palettes - ld a, $5 + ld a, BANK(wBGPals1) call FarCopyWRAM ld hl, .OBPal ld de, wOBPals1 ld bc, 1 palettes - ld a, $5 + ld a, BANK(wOBPals1) call FarCopyWRAM call ApplyPals @@ -359,7 +359,7 @@ ApplyHPBarPals: ld bc, HPBarPals add hl, bc ld bc, 4 - ld a, $5 + ld a, BANK(wBGPals2) call FarCopyWRAM ld a, $1 ld [hCGBPalUpdate], a @@ -443,7 +443,7 @@ LoadMailPalettes: .cgb ld de, wBGPals1 ld bc, 1 palettes - ld a, $5 + ld a, BANK(wBGPals1) call FarCopyWRAM call ApplyPals call WipeAttrMap @@ -460,7 +460,7 @@ Function95f0: ld hl, .Palette ld de, wBGPals1 ld bc, 1 palettes - ld a, $5 + ld a, BANK(wBGPals1) call FarCopyWRAM call ApplyPals call WipeAttrMap @@ -611,7 +611,7 @@ ApplyPals: ld hl, wBGPals1 ld de, wBGPals2 ld bc, 16 palettes - ld a, $5 + ld a, BANK(wPals) call FarCopyWRAM ret @@ -688,7 +688,7 @@ InitPartyMenuOBPals: ld hl, PartyMenuOBPals ld de, wOBPals1 ld bc, 2 palettes - ld a, $5 + ld a, BANK(wOBPals1) call FarCopyWRAM ret @@ -761,7 +761,7 @@ Function9779: mobile ld hl, BattleObjectPals ld de, wOBPals1 palette 2 ld bc, 2 palettes - ld a, $5 + ld a, BANK(wOBPals1) call FarCopyWRAM ret @@ -1318,7 +1318,7 @@ endr .morn_day ld de, wBGPals1 palette PAL_BG_ROOF + 2 ld bc, 4 - ld a, $5 + ld a, BANK(wBGPals1) call FarCopyWRAM ret diff --git a/engine/crystal_colors.asm b/engine/crystal_colors.asm index 5d2ba236c..20cd4f4a2 100755 --- a/engine/crystal_colors.asm +++ b/engine/crystal_colors.asm @@ -241,7 +241,7 @@ Function49742: ; 49742 ld hl, .Palette_49757 ld de, wBGPals1 ld bc, 8 palettes - ld a, $5 + ld a, BANK(wBGPals1) call FarCopyWRAM farcall ApplyPals ret diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm index d60acb5b6..809d11eb5 100755 --- a/engine/events/heal_machine_anim.asm +++ b/engine/events/heal_machine_anim.asm @@ -160,7 +160,7 @@ INCBIN "gfx/overworld/heal_machine.2bpp" ld hl, .palettes ld de, wOBPals2 palette PAL_OW_TREE ld bc, 1 palettes - ld a, $5 + ld a, BANK(wOBPals2) call FarCopyWRAM ld a, $1 ld [hCGBPalUpdate], a diff --git a/engine/init_gender.asm b/engine/init_gender.asm index 588709b88..2cb664072 100755 --- a/engine/init_gender.asm +++ b/engine/init_gender.asm @@ -90,7 +90,7 @@ LoadGenderScreenPal: ; 48e47 (12:4e47) ld hl, .Palette ld de, wBGPals1 ld bc, 1 palettes - ld a, $5 + ld a, BANK(wBGPals1) call FarCopyWRAM farcall ApplyPals ret diff --git a/engine/pic_animation.asm b/engine/pic_animation.asm index e10dcc360..9a6ae4a75 100644 --- a/engine/pic_animation.asm +++ b/engine/pic_animation.asm @@ -335,12 +335,12 @@ PokeAnim_InitPicAttributes: ; d01d6 ld a, d ld [wPokeAnimGraphicStartTile], a - ld a, $1 + ld a, BANK(CurPartySpecies) ld hl, CurPartySpecies call GetFarWRAMByte ld [wPokeAnimSpecies], a - ld a, $1 + ld a, BANK(UnownLetter) ld hl, UnownLetter call GetFarWRAMByte ld [wPokeAnimUnownLetter], a -- cgit v1.2.3 From 36e91c971cb3cc82927fa09f9f011aa6c3df0a23 Mon Sep 17 00:00:00 2001 From: Adelaide Walter Date: Thu, 4 Jan 2018 15:06:11 -0500 Subject: Fix stray hardcoded WRAM bank. --- engine/dma_transfer.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/dma_transfer.asm b/engine/dma_transfer.asm index eef2b936d..2ab45b00d 100755 --- a/engine/dma_transfer.asm +++ b/engine/dma_transfer.asm @@ -119,7 +119,7 @@ Mobile_ReloadMapPart: ; 104099 .unreferenced_1040da ld a, $1 ld [rVBK], a - ld a, $3 + ld a, BANK(w3_d800) ld [rSVBK], a ld de, w3_d800 ld a, [hBGMapAddress + 1] -- cgit v1.2.3 From ce985a09a7802d90519997de032720e6c5eca6d0 Mon Sep 17 00:00:00 2001 From: Adelaide Walter Date: Thu, 4 Jan 2018 16:51:50 -0500 Subject: Document switches to BANK(sScratch) via xor a --- engine/battle_anims/anim_commands.asm | 6 +++--- engine/events/print_unown.asm | 2 +- engine/events/print_unown_2.asm | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'engine') diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index b91aa8c6c..f3b2ee46d 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -975,7 +975,7 @@ BattleAnimCmd_RaiseSub: ; cc640 (33:4640) push af ld a, 1 ; unnecessary bankswitch? ld [rSVBK], a - xor a + xor a ; effectively ld a, BANK(sScratch) call GetSRAMBank GetSubstitutePic: ; cc64c @@ -1049,7 +1049,7 @@ BattleAnimCmd_MinimizeOpp: ; cc6cf (33:46cf) push af ld a, 1 ; unnecessary bankswitch? ld [rSVBK], a - xor a + xor a ; effectively ld a, BANK(sScratch) call GetSRAMBank call GetMinimizePic call Request2bpp @@ -1105,7 +1105,7 @@ BattleAnimCmd_Minimize: ; cc735 (33:4735) push af ld a, 1 ; unnecessary bankswitch? ld [rSVBK], a - xor a + xor a ; effectively ld a, BANK(sScratch) call GetSRAMBank call GetMinimizePic ld hl, vTiles0 tile $00 diff --git a/engine/events/print_unown.asm b/engine/events/print_unown.asm index 4a4367e13..3dfee282d 100644 --- a/engine/events/print_unown.asm +++ b/engine/events/print_unown.asm @@ -178,7 +178,7 @@ UnownPrinter: ; 16be4 hlcoord 1, 9 ld de, UnownDexVacantString call PlaceString - xor a + xor a ; effectively ld a, BANK(sScratch) call GetSRAMBank ld hl, sScratch ld bc, $31 tiles diff --git a/engine/events/print_unown_2.asm b/engine/events/print_unown_2.asm index c932ded38..287ae7537 100644 --- a/engine/events/print_unown_2.asm +++ b/engine/events/print_unown_2.asm @@ -1,7 +1,7 @@ RotateUnownFrontpic: ; e0000 ; something to do with Unown printer push de - xor a + xor a ; effectively ld a, BANK(sScratch) call GetSRAMBank ld hl, sScratch ld bc, 0 -- cgit v1.2.3 From e9e8bf6eb14020d4a88a7cd4bca8539a2b45803e Mon Sep 17 00:00:00 2001 From: xCrystal Date: Fri, 5 Jan 2018 11:05:01 +0100 Subject: Predef_Flag -> Predef_FlagAction --- engine/battle/ai/move.asm | 2 +- engine/battle/core.asm | 14 +++++++------- engine/evolve.asm | 2 +- engine/item_effects.asm | 4 ++-- engine/link.asm | 2 +- engine/move_mon.asm | 4 ++-- engine/mystery_gift.asm | 6 +++--- engine/npctrade.asm | 2 +- engine/pokegear.asm | 2 +- engine/predef.asm | 2 +- engine/routines/flagpredef.asm | 2 +- engine/specials.asm | 8 ++++---- engine/tmhm.asm | 2 +- 13 files changed, 26 insertions(+), 26 deletions(-) (limited to 'engine') diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm index d91ac437d..ead0fd5fa 100755 --- a/engine/battle/ai/move.asm +++ b/engine/battle/ai/move.asm @@ -92,7 +92,7 @@ AIChooseMove: ; 440ce push bc ld d, BANK(TrainerClassAttributes) - predef Predef_Flag + predef Predef_FlagAction ld d, c pop bc diff --git a/engine/battle/core.asm b/engine/battle/core.asm index b5ca19562..ff415bc75 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -2760,7 +2760,7 @@ PlayerMonFaintHappinessMod: ; 3d1aa ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG - predef Predef_Flag + predef Predef_FlagAction ld hl, EnemySubStatus3 res SUBSTATUS_IN_LOOP, [hl] xor a @@ -3357,10 +3357,10 @@ AddBattleParticipant: ; 3d581 ld hl, wBattleParticipantsNotFainted ld b, SET_FLAG push bc - predef Predef_Flag + predef Predef_FlagAction pop bc ld hl, wBattleParticipantsIncludingFainted - predef_jump Predef_Flag + predef_jump Predef_FlagAction ; 3d599 FindPkmnInOTPartyToSwitchIntoBattle: ; 3d599 @@ -4350,7 +4350,7 @@ PursuitSwitch: ; 3dc5b ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG - predef Predef_Flag + predef Predef_FlagAction call PlayerMonFaintedAnimation ld hl, BattleText_PkmnFainted jr .done_fainted @@ -6631,7 +6631,7 @@ LoadEnemyMon: ; 3e8eb ld c, a ld b, SET_FLAG ld hl, PokedexSeen - predef Predef_Flag + predef Predef_FlagAction ld hl, EnemyMonStats ld de, EnemyStats @@ -7313,7 +7313,7 @@ GiveExperiencePoints: ; 3ee3b ld c, a ld b, CHECK_FLAG ld d, $0 - predef Predef_Flag + predef Predef_FlagAction ld a, c and a pop bc @@ -7642,7 +7642,7 @@ GiveExperiencePoints: ; 3ee3b ld a, [CurPartyMon] ld c, a ld b, SET_FLAG - predef Predef_Flag + predef Predef_FlagAction pop af ld [CurPartyLevel], a diff --git a/engine/evolve.asm b/engine/evolve.asm index 4f2576f89..dbe1db5af 100755 --- a/engine/evolve.asm +++ b/engine/evolve.asm @@ -621,7 +621,7 @@ ShiftMoves: ; 4256e EvoFlagAction: ; 42577 push de ld d, $0 - predef Predef_Flag + predef Predef_FlagAction pop de ret ; 42581 diff --git a/engine/item_effects.asm b/engine/item_effects.asm index 67ea58612..7ce84a57a 100644 --- a/engine/item_effects.asm +++ b/engine/item_effects.asm @@ -1668,7 +1668,7 @@ RevivePokemon: ; f0d6 ld d, 0 ld hl, wBattleParticipantsIncludingFainted ld b, CHECK_FLAG - predef Predef_Flag + predef Predef_FlagAction ld a, c and a jr z, .skip_to_revive @@ -1677,7 +1677,7 @@ RevivePokemon: ; f0d6 ld c, a ld hl, wBattleParticipantsNotFainted ld b, SET_FLAG - predef Predef_Flag + predef Predef_FlagAction .skip_to_revive xor a diff --git a/engine/link.asm b/engine/link.asm index 66813d776..94e7f2458 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -2584,7 +2584,7 @@ Unreferenced_Function29fe4: call GetSRAMBank ld d, $0 ld b, CHECK_FLAG - predef Predef_Flag + predef Predef_FlagAction call CloseSRAM ld a, c and a diff --git a/engine/move_mon.asm b/engine/move_mon.asm index 9128eabdd..658d57611 100755 --- a/engine/move_mon.asm +++ b/engine/move_mon.asm @@ -1119,7 +1119,7 @@ Predef_GiveEgg:: ; df8c ld d, $0 ld hl, PokedexCaught ld b, RESET_FLAG - predef Predef_Flag + predef Predef_FlagAction .skip_caught_flag ; If we haven't seen this Pokemon before receiving @@ -1135,7 +1135,7 @@ Predef_GiveEgg:: ; df8c ld d, $0 ld hl, PokedexSeen ld b, RESET_FLAG - predef Predef_Flag + predef Predef_FlagAction .skip_seen_flag pop af diff --git a/engine/mystery_gift.asm b/engine/mystery_gift.asm index 6eafa2cca..27ffd97b0 100755 --- a/engine/mystery_gift.asm +++ b/engine/mystery_gift.asm @@ -1117,7 +1117,7 @@ MysteryGift_CheckAndSetDecorationAlreadyReceived: ; 105069 (41:5069) ld d, $0 ld b, CHECK_FLAG ld hl, sMysteryGiftDecorationsReceived - predef_id Predef_Flag + predef_id Predef_FlagAction push hl push bc call Predef @@ -1129,7 +1129,7 @@ MysteryGift_CheckAndSetDecorationAlreadyReceived: ; 105069 (41:5069) ret nz call GetMysteryGiftBank ld b, SET_FLAG - predef Predef_Flag + predef Predef_FlagAction call CloseSRAM xor a ret @@ -1142,7 +1142,7 @@ MysteryGift_CopyReceivedDecosToPC: ; 105091 (41:5091) ld d, $0 ld b, CHECK_FLAG ld hl, sMysteryGiftDecorationsReceived - predef Predef_Flag + predef Predef_FlagAction ld a, c and a pop bc diff --git a/engine/npctrade.asm b/engine/npctrade.asm index c1726ed04..25d47e6be 100755 --- a/engine/npctrade.asm +++ b/engine/npctrade.asm @@ -109,7 +109,7 @@ TradeFlagAction: ; fcc4a ld hl, wTradeFlags ld a, [wJumptableIndex] ld c, a - predef Predef_Flag + predef Predef_FlagAction ld a, c and a ret diff --git a/engine/pokegear.asm b/engine/pokegear.asm index 0c9a991ac..18f86c1b6 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -2331,7 +2331,7 @@ HasVisitedSpawn: ; 91c50 ld hl, wVisitedSpawns ld b, CHECK_FLAG ld d, 0 - predef Predef_Flag + predef Predef_FlagAction ld a, c ret diff --git a/engine/predef.asm b/engine/predef.asm index a8eccfd21..749084288 100644 --- a/engine/predef.asm +++ b/engine/predef.asm @@ -33,7 +33,7 @@ PredefPointers:: ; 856b add_predef Predef_LearnMove ; $0 add_predef DummyPredef1 add_predef HealParty ; this is both a special and a predef - add_predef Predef_Flag + add_predef Predef_FlagAction add_predef Predef_ComputeHPBarPixels add_predef Predef_FillPP add_predef Predef_TryAddMonToParty diff --git a/engine/routines/flagpredef.asm b/engine/routines/flagpredef.asm index 8074e9dbe..5b19950a1 100644 --- a/engine/routines/flagpredef.asm +++ b/engine/routines/flagpredef.asm @@ -1,4 +1,4 @@ -Predef_Flag: ; 4d7c1 +Predef_FlagAction: ; 4d7c1 ; Perform action b on flag c in flag array hl. ; If checking a flag, check flag array d:hl unless d is 0. diff --git a/engine/specials.asm b/engine/specials.asm index 5b4fd45ae..07709f0b2 100644 --- a/engine/specials.asm +++ b/engine/specials.asm @@ -142,7 +142,7 @@ SpecialsPointers:: ; c029 add_special Special_Function170114 add_special Special_BattleTowerBattle add_special UnusedSpecial_Function1704e1 - add_special DummySpecial17021d + add_special DummySpecial_17021d add_special Special_LoadOpponentTrainerAndPokemonWithOTSprite add_special Special_Function11ba38 add_special Special_CheckForBattleTowerRules @@ -174,7 +174,7 @@ SpecialsPointers:: ; c029 add_special Special_BeastsCheck add_special Special_MonCheck add_special Special_SetPlayerPalette - add_special DummySpecial170bd2 + add_special DummySpecial_170bd2 add_special Special_Mobile_SelectThreeMons add_special Special_Function1037eb add_special Special_Function10383c @@ -189,10 +189,10 @@ SpecialsPointers:: ; c029 add_special UnusedSpecial_FindItemInPCOrBag add_special Special_InitialSetDSTFlag add_special Special_InitialClearDSTFlag - add_special DummySpecialc224 + add_special DummySpecial_c224 ; c224 -DummySpecialc224: ; c224 +DummySpecial_c224: ; c224 ret ; c225 diff --git a/engine/tmhm.asm b/engine/tmhm.asm index d149e02d6..1b4456c88 100755 --- a/engine/tmhm.asm +++ b/engine/tmhm.asm @@ -23,7 +23,7 @@ Predef_CanLearnTMHMMove: ; 11639 ld b, CHECK_FLAG push de ld d, 0 - predef Predef_Flag + predef Predef_FlagAction pop de ret -- cgit v1.2.3 From bdd3a55333d0acd1d764327dcebb4a14d9586f05 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sat, 6 Jan 2018 18:53:30 -0500 Subject: Organize mobile/battle_tower_*.asm data and code --- engine/events/battle_tower.asm | 210 --- engine/events/battle_tower/battle_tower.asm | 1671 ++++++++++++++++++++++ engine/events/battle_tower/get_trainer_class.asm | 46 + engine/events/battle_tower/load_trainer.asm | 210 +++ engine/events/battle_tower/rules.asm | 342 +++++ engine/events/battle_tower/trainer_text.asm | 718 ++++++++++ engine/events/battle_tower_rules.asm | 342 ----- 7 files changed, 2987 insertions(+), 552 deletions(-) delete mode 100644 engine/events/battle_tower.asm create mode 100755 engine/events/battle_tower/battle_tower.asm create mode 100644 engine/events/battle_tower/get_trainer_class.asm create mode 100644 engine/events/battle_tower/load_trainer.asm create mode 100644 engine/events/battle_tower/rules.asm create mode 100755 engine/events/battle_tower/trainer_text.asm delete mode 100644 engine/events/battle_tower_rules.asm (limited to 'engine') diff --git a/engine/events/battle_tower.asm b/engine/events/battle_tower.asm deleted file mode 100644 index a0de6ee84..000000000 --- a/engine/events/battle_tower.asm +++ /dev/null @@ -1,210 +0,0 @@ -Function_LoadOpponentTrainerAndPokemons: ; 1f8000 - ld a, [rSVBK] - push af - ld a, BANK(BT_OTTrainer) - ld [rSVBK], a - - ; Fill BT_OTTrainer with zeros - xor a - ld hl, BT_OTTrainer - ld bc, BT_OTTrainerEnd - BT_OTTrainer - call ByteFill - - ; Write $ff into the Item-Slots - ld a, $ff - ld [BT_OTPkmn1Item], a - ld [BT_OTPkmn2Item], a - ld [BT_OTPkmn3Item], a - - ; Set BT_OTTrainer as start address to write the following data to - ld de, BT_OTTrainer - - ld a, [hRandomAdd] - ld b, a -.resample ; loop to find a random trainer - call Random - ld a, [hRandomAdd] - add b - ld b, a ; b contains the nr of the trainer -if DEF(CRYSTAL11) - and (1 << 7) - 1 - cp 70 -else - and (1 << 5) - 1 - cp 21 -endc - jr nc, .resample - ld b, a - - ld a, BANK(sBTTrainers) - call GetSRAMBank - - ld c, BATTLETOWER_NROFTRAINERS - ld hl, sBTTrainers -.next_trainer - ld a, [hli] - cp b - jr z, .resample - dec c - jr nz, .next_trainer ; c <= 7 initialise all 7 trainers? - - ld hl, sBTTrainers - ld a, [sNrOfBeatenBattleTowerTrainers] - ld c, a - ld a, b - ld b, 0 - add hl, bc - ld [hl], a - - call CloseSRAM - - push af -; Copy name (10 bytes) and class (1 byte) of trainer - ld hl, BattleTowerTrainers - ld bc, NAME_LENGTH - call AddNTimes - ld bc, NAME_LENGTH - call CopyBytes - - call Function_LoadRandomBattleTowerPkmn - pop af - - ld hl, BattleTowerTrainerData - ld bc, BATTLETOWER_TRAINERDATALENGTH - call AddNTimes - ld bc, BATTLETOWER_TRAINERDATALENGTH -.copy_bt_trainer_data_loop - ld a, BANK(BattleTowerTrainerData) - call GetFarByte - ld [de], a - inc hl - inc de - dec bc - ld a, b - or c - jr nz, .copy_bt_trainer_data_loop - - pop af - ld [rSVBK], a - - ret - - -Function_LoadRandomBattleTowerPkmn: ; 1f8081 - ld c, BATTLETOWER_NROFPKMNS -.loop - push bc - ld a, BANK(sBTPkmnPrevTrainer1) - call GetSRAMBank - -.FindARandomBattleTowerPkmn: - ; From Which LevelGroup are the Pkmn loaded - ; a = 1..10 - ld a, [wBTChoiceOfLvlGroup] ; [$d800] - dec a - ld hl, BattleTowerMons - ld bc, BattleTowerMons2 - BattleTowerMons1 - call AddNTimes - - ld a, [hRandomAdd] - ld b, a -.resample - call Random - ld a, [hRandomAdd] - add b - ld b, a - and $1f - cp BATTLETOWER_NRMONSPERLEVELBRACKET - jr nc, .resample - ; in register 'a' is the chosen Pkmn of the LevelGroup - - ; Check if Pkmn was already loaded before - ; Check current and the 2 previous teams - ; includes check if item is double at the current team - ld bc, PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH - call AddNTimes - ld a, [hli] - ld b, a - ld a, [hld] - ld c, a - ld a, [BT_OTPkmn1] - cp b - jr z, .FindARandomBattleTowerPkmn - ld a, [BT_OTPkmn1Item] - cp c - jr z, .FindARandomBattleTowerPkmn - ld a, [BT_OTPkmn2] - cp b - jr z, .FindARandomBattleTowerPkmn - ld a, [BT_OTPkmn2Item] - cp c - jr z, .FindARandomBattleTowerPkmn - ld a, [BT_OTPkmn3] - cp b - jr z, .FindARandomBattleTowerPkmn - ld a, [BT_OTPkmn3Item] - cp c - jr z, .FindARandomBattleTowerPkmn - ld a, [sBTPkmnPrevTrainer1] - cp b - jr z, .FindARandomBattleTowerPkmn - ld a, [sBTPkmnPrevTrainer2] - cp b - jr z, .FindARandomBattleTowerPkmn - ld a, [sBTPkmnPrevTrainer3] - cp b - jr z, .FindARandomBattleTowerPkmn - ld a, [sBTPkmnPrevPrevTrainer1] - cp b - jr z, .FindARandomBattleTowerPkmn - ld a, [sBTPkmnPrevPrevTrainer2] - cp b - jr z, .FindARandomBattleTowerPkmn - ld a, [sBTPkmnPrevPrevTrainer3] - cp b - jr z, .FindARandomBattleTowerPkmn - - ld bc, PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH - call CopyBytes - - ld a, [wNamedObjectIndexBuffer] - push af - push de - ld hl, - (PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH) - add hl, de - ld a, [hl] - ld [wNamedObjectIndexBuffer], a - ld bc, PARTYMON_STRUCT_LENGTH - add hl, bc - push hl - call GetPokemonName - ld h, d - ld l, e - pop de - ld bc, PKMN_NAME_LENGTH - call CopyBytes - - pop de - pop af - ld [wNamedObjectIndexBuffer], a - pop bc - dec c - jp nz, .loop - - ld a, [sBTPkmnPrevTrainer1] - ld [sBTPkmnPrevPrevTrainer1], a - ld a, [sBTPkmnPrevTrainer2] - ld [sBTPkmnPrevPrevTrainer2], a - ld a, [sBTPkmnPrevTrainer3] - ld [sBTPkmnPrevPrevTrainer3], a - ld a, [BT_OTPkmn1] - ld [sBTPkmnPrevTrainer1], a - ld a, [BT_OTPkmn2] - ld [sBTPkmnPrevTrainer2], a - ld a, [BT_OTPkmn3] - ld [sBTPkmnPrevTrainer3], a - call CloseSRAM - ret -; 1f814e - -INCLUDE "data/battle_tower.asm" diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm new file mode 100755 index 000000000..ca2ddd142 --- /dev/null +++ b/engine/events/battle_tower/battle_tower.asm @@ -0,0 +1,1671 @@ +BattleTowerRoomMenu: ; 1700b0 +; special + call InitBattleTowerChallengeRAM + farcall _BattleTowerRoomMenu + ret +; 1700ba + +Function1700ba: ; 1700ba + call InitBattleTowerChallengeRAM + farcall Function11811a + ret +; 1700c4 + +Function1700c4: ; 1700c4 + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a + + call Function17042c + + ld a, $5 + call GetSRAMBank + ld a, $1 + ld [$be45], a + xor a + ld [$be46], a + ld hl, w3_dffc + ld de, $aa41 + ld bc, 4 + call CopyBytes + ld hl, w3_d202Name + ld de, $aa8e + ld bc, 7 * $cc ; length of battle tower struct from japanese games? + call CopyBytes + ld hl, $aa5d ; some sort of count + ld a, [hl] + inc [hl] + inc hl + sla a + sla a + ld e, a + ld d, $0 + add hl, de + ld e, l + ld d, h + ld hl, w3_dffc + ld bc, 4 + call CopyBytes + call CloseSRAM + pop af + ld [rSVBK], a + ret +; 170114 + +Function170114: ; 170114 + call InitBattleTowerChallengeRAM + call .Function170121 + farcall Function11805f + ret +; 170121 + +.Function170121: ; 170121 + ld a, $5 + call GetSRAMBank + ld hl, $a948 + ld de, wMisc + ld bc, $f6 ; 246 + call CopyBytes + call CloseSRAM + call Function170c8b + ret +; 170139 + +Function170139: ; 170139 +; Convert the 4-digit decimal number at 5:aa41 into binary + ld a, $5 + call GetSRAMBank + ld de, $aa41 + ld h, $0 + ld l, h + ld bc, 1000 + call .DecToBin + ld bc, 100 + call .DecToBin + ld bc, 10 + call .DecToBin + ld a, [de] + ld c, a + ld b, $0 + add hl, bc + call CloseSRAM +; Store that number in wMisc + ld a, h + ld [wMisc], a + ld a, l + ld [wMisc + 1], a + ld hl, wBT_OTTempPkmn1DVs + ld a, [PlayerID] + ld [hli], a + ld a, [PlayerID + 1] + ld [hli], a + ld a, [wSecretID] + ld [hli], a + ld a, [wSecretID + 1] + ld [hli], a + ld e, l + ld d, h + ld hl, PlayerName + ld bc, NAME_LENGTH_JAPANESE - 1 + call CopyBytes + ld bc, PlayerID + ld de, wPlayerGender + farcall GetMobileOTTrainerClass + ld de, wBT_OTTempPkmn1CaughtGender + ld a, c + ld [de], a + inc de + ld a, LOW(PartyMons) + ld [wcd49], a + ld a, HIGH(PartyMons) + ld [wcd4a], a + ld a, LOW(PartyMonNicknames) + ld [wcd4b], a + ld a, HIGH(PartyMonNicknames) + ld [wcd4c], a + ld a, 3 +.CopyLoop: + push af + ld a, [wcd49] + ld l, a + ld a, [wcd4a] + ld h, a + ld bc, PARTYMON_STRUCT_LENGTH + call CopyBytes + ld a, l + ld [wcd49], a + ld a, h + ld [wcd4a], a + ld a, [wcd4b] + ld l, a + ld a, [wcd4c] + ld h, a + ld bc, $0006 + call CopyBytes + ld a, l + ld [wcd4b], a + ld a, h + ld [wcd4c], a + pop af + dec a + jr nz, .CopyLoop + ld a, $4 + call GetSRAMBank + ld hl, $a013 + ld bc, $24 + call CopyBytes + call CloseSRAM + ld a, $5 + call GetSRAMBank + ld hl, $a894 + ld bc, NAME_LENGTH_JAPANESE + call CopyBytes + ld hl, wMisc + ld de, $a948 + ld bc, $f6 + call CopyBytes + call CloseSRAM + ret +; 17020c + +.DecToBin: ; 17020c + ld a, [de] + inc de + and a + ret z + +.digit_loop + add hl, bc + dec a + jr nz, .digit_loop + ret +; 170215 + +BattleTowerBattle: ; 170215 + xor a + ld [wBattleTowerBattleEnded], a + call _BattleTowerBattle + ret +; 17021d + +EmptySpecial_17021d: ; 17021d + ret +; 17021e + +InitBattleTowerChallengeRAM: ; 17021e + xor a + ld [wBattleTowerBattleEnded], a + ld [wNrOfBeatenBattleTowerTrainers], a + ld [wcf65], a + ld [wcf66], a + ret +; 17022c + +_BattleTowerBattle: ; 17022c +.loop + call .do_dw + call DelayFrame + ld a, [wBattleTowerBattleEnded] + cp $1 + jr nz, .loop + ret +; 17023a + +.do_dw ; 17023a + ld a, [wBattleTowerBattleEnded] + ld e, a + ld d, 0 + ld hl, .dw + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp hl +; 170249 + +.dw ; 170249 + dw RunBattleTowerTrainer + dw SkipBattleTowerTrainer +; 17024d + +RunBattleTowerTrainer: ; 17024d + ld a, [Options] + push af + ld hl, Options + set BATTLE_SHIFT, [hl] ; SET MODE + + ld a, [InBattleTowerBattle] + push af + or $1 + ld [InBattleTowerBattle], a + + xor a + ld [wLinkMode], a + farcall TrainerRankings_Healings + farcall HealParty + call ReadBTTrainerParty + call Clears5_a89a + + predef StartBattle + + farcall LoadPokemonData + farcall HealParty + ld a, [wBattleResult] + ld [ScriptVar], a + and a + jr nz, .lost + ld a, BANK(sNrOfBeatenBattleTowerTrainers) + call GetSRAMBank + ld a, [sNrOfBeatenBattleTowerTrainers] + ld [wNrOfBeatenBattleTowerTrainers], a + call CloseSRAM + ld hl, StringBuffer3 + ld a, [wNrOfBeatenBattleTowerTrainers] + add "1" + ld [hli], a + ld a, "@" + ld [hl], a + +.lost + pop af + ld [InBattleTowerBattle], a + pop af + ld [Options], a + ld a, $1 + ld [wBattleTowerBattleEnded], a + ret + + +ReadBTTrainerParty: ; 1702b7 +; Initialise the BattleTower-Trainer and his Pkmn + call CopyBTTrainer_FromBT_OT_TowBT_OTTemp + +; Check the nicknames for illegal characters, and replace bad nicknames +; with their species names. + ld de, wBT_OTTempPkmn1Name ; $c643 + ld c, PKMN_NAME_LENGTH + farcall CheckStringForErrors + jr nc, .skip_mon_1 + + ld a, [wBT_OTTempPkmn1] + ld [wNamedObjectIndexBuffer], a + call GetPokemonName + ld l, e + ld h, d + ld de, wBT_OTTempPkmn1Name ; $c643 + ld bc, PKMN_NAME_LENGTH + call CopyBytes + +.skip_mon_1 + ld de, wBT_OTTempPkmn2Name ; $c67e + ld c, PKMN_NAME_LENGTH + farcall CheckStringForErrors + jr nc, .skip_mon_2 + ld a, [wBT_OTTempPkmn2] ; [$c64e] + ld [wNamedObjectIndexBuffer], a + call GetPokemonName + ld l, e + ld h, d + ld de, wBT_OTTempPkmn2Name ; $c67e + ld bc, PKMN_NAME_LENGTH + call CopyBytes + +.skip_mon_2 + ld de, wBT_OTTempPkmn3Name ; $c686 + 51 = $c6b9 + ld c, PKMN_NAME_LENGTH + farcall CheckStringForErrors + jr nc, .skip_mon_3 + ld a, [wBT_OTTempPkmn3] ; [$c689] + ld [wNamedObjectIndexBuffer], a + call GetPokemonName + ld l, e + ld h, d + ld de, wBT_OTTempPkmn3Name ; $c686 + 51 = $c6b9 + ld bc, PKMN_NAME_LENGTH + call CopyBytes + +.skip_mon_3 +; Add the terminator character to each of these names + ld a, "@" + ld [wBT_OTTempPkmn1NameEnd - 1], a ; $c64d + ld [wBT_OTTempPkmn2NameEnd - 1], a ; $c688 + ld [wBT_OTTempPkmn3NameEnd - 1], a ; $c68a + 57 = $c6c3 +; Fix errors in the movesets + call CheckBTMonMovesForErrors +; Repair the trainer name if needed, then copy it to OTPlayerName + ld de, wBT_OTTempName + ld c, NAME_LENGTH - 1 + farcall CheckStringForErrors + jr nc, .trainer_name_okay + ld hl, BT_ChrisName + jr .done_trainer_name + +.trainer_name_okay + ld hl, wBT_OTTempName ; 0xc608 + +.done_trainer_name + ld de, OTPlayerName + ld bc, NAME_LENGTH - 1 + call CopyBytes + ld a, "@" + ld [de], a + + ld hl, wBT_OTTempTrainerClass + ld a, [hli] + ld [OtherTrainerClass], a + ld a, LOW(OTPartyMonNicknames) + ld [BGMapBuffer], a + ld a, HIGH(OTPartyMonNicknames) + ld [BGMapBuffer + 1], a + + ; Copy Pkmn into Memory from the address in hl + ld de, OTPartyMon1Species + ld bc, OTPartyCount + ld a, BATTLETOWER_NROFPKMNS ; Number of Pkmn the BattleTower-Trainer has + ld [bc], a + inc bc +.otpartymon_loop + push af + ld a, [hl] + ld [bc], a + inc bc + push bc + ld bc, PARTYMON_STRUCT_LENGTH + call CopyBytes + push de + ld a, [BGMapBuffer] + ld e, a + ld a, [BGMapBuffer + 1] + ld d, a + ld bc, PKMN_NAME_LENGTH + call CopyBytes + ld a, e + ld [BGMapBuffer], a + ld a, d + ld [BGMapBuffer + 1], a + pop de + pop bc + pop af + dec a + and a + jr nz, .otpartymon_loop + ld a, -1 + ld [bc], a + ret +; 170394 + +ValidateBTParty: ; 170394 +; Check for and fix errors in party data + ld hl, wBT_OTTempPkmn1Species + ld d, BATTLETOWER_NROFPKMNS +.pkmn_loop + push de + push hl + ld b, h + ld c, l + ld a, [hl] + and a +idx = $ff +rept ($ff +- NUM_POKEMON) + jr z, .invalid + cp idx +idx = idx +- 1 +endr + jr nz, .valid + +.invalid + ld a, SMEARGLE + ld [hl], a + +.valid + ld [CurSpecies], a + call GetBaseData + ld a, $5 + call GetSRAMBank + ld a, [$b2fb] ; s5_b2fb ; max level? + call CloseSRAM + ld e, a + ld hl, MON_LEVEL + add hl, bc + ld a, [hl] + cp MIN_LEVEL + ld a, MIN_LEVEL + jr c, .load + ld a, [hl] + cp e + jr c, .dont_load + ld a, e + +.load + ld [hl], a + +.dont_load + ld [CurPartyLevel], a + ld hl, MON_MOVES + add hl, bc + ld d, NUM_MOVES - 1 + ld a, [hli] + and a + jr z, .not_move + cp NUM_ATTACKS + 1 + jr nc, .not_move + jr .valid_move + +.not_move + dec hl + ld a, POUND + ld [hli], a + xor a + ld [hli], a + ld [hli], a + ld [hl], a + jr .done_moves + +.valid_move + ld a, [hl] + cp NUM_ATTACKS + 1 + jr c, .next + ld [hl], $0 + +.next + inc hl + dec d + jr nz, .valid_move + +.done_moves + ld hl, MON_MAXHP + add hl, bc + ld d, h + ld e, l + push hl + push de + ld hl, MON_STAT_EXP - 1 + add hl, bc + ld b, $1 + predef CalcPkmnStats + pop de + pop hl + dec de + dec de + ld a, [hli] + ld [de], a + inc de + ld a, [hl] + ld [de], a + pop hl + ld bc, PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH + add hl, bc + pop de + dec d + jp nz, .pkmn_loop + ret +; 170426 + +BT_ChrisName: ; 170426 + db "CHRIS@" +; 17042c + +Function17042c: ; 17042c + ld hl, w3_d202TrainerData + ld a, BATTLETOWER_NROFTRAINERS +.loop + push af + push hl + ld c, BATTLETOWER_TRAINERDATALENGTH / 2 +.loop2 + ; First byte is a comparison value. + ld a, [hli] + ld b, a + ; Second byte is a lookup index. + ld a, [hli] + and a + jr z, .empty + cp 15 + jr nc, .copy_data + + push hl + ld hl, Unknown_170470 + dec a + ld e, a + ld d, 0 + add hl, de + ld a, [hl] + pop hl + + ; If Unknown_170470[a-1] <= b, overwrite the current trainer's data + ; with Unknown17047e, and exit the inner loop. + cp b + jr c, .copy_data + jr z, .copy_data + jr .next_iteration + +.empty + ; If a == 0 and b >= $fc, overwrite the current trainer's data with + ; Unknown17047e, and exit the inner loop. + ld a, b + cp $fc + jr nc, .copy_data + +.next_iteration + dec c + jr nz, .loop2 + jr .next_trainer + +.copy_data + pop de + push de + ld hl, Unknown_17047e + ld bc, BATTLETOWER_TRAINERDATALENGTH + call CopyBytes + +.next_trainer + pop hl + ld de, BATTLE_TOWER_STRUCT_LENGTH + add hl, de + pop af + dec a + jr nz, .loop + ret +; 170470 + +INCLUDE "data/battle_tower/unknown_levels.asm" + + +CopyBTTrainer_FromBT_OT_TowBT_OTTemp: ; 1704a2 +; copy the BattleTower-Trainer data that lies at 'BT_OTTrainer' to 'wBT_OTTemp' + ld a, [rSVBK] + push af + ld a, BANK(BT_OTTrainer) + ld [rSVBK], a + + ld hl, BT_OTTrainer + ld de, wBT_OTTemp + ld bc, BATTLE_TOWER_STRUCT_LENGTH + call CopyBytes + + pop af + ld [rSVBK], a + + ld a, BANK(sBattleTowerChallengeState) + call GetSRAMBank + ld a, BATTLETOWER_CHALLENGE_IN_PROGESS + ld [sBattleTowerChallengeState], a + ld hl, sNrOfBeatenBattleTowerTrainers + inc [hl] + call CloseSRAM +SkipBattleTowerTrainer: ; 1704c9 + ret +; 1704ca + +Function1704ca: ; 1704ca +; unreferenced mobile function + ld a, [$be46] + cp $7 + jr c, .asm_1704d3 + ld a, $6 + +.asm_1704d3 + ld hl, $afce + ld de, -$e0 +.asm_1704d9 + and a + jr z, .asm_1704e0 + add hl, de + dec a + jr .asm_1704d9 + +.asm_1704e0 + ret +; 1704e1 + +Function1704e1: ; 1704e1 +; unreferenced special + call SpeechTextBox + call FadeToMenu + call InitBattleTowerChallengeRAM + call .JumptableLoop + call CloseSubmenu + ret +; 1704f1 + +.JumptableLoop: ; 1704f1 + call ClearBGPalettes + call ClearSprites + call ClearScreen +.loop + call JoyTextDelay + ld a, [wJumptableIndex] + bit 7, a + jr nz, .done + call .DoJumptable + farcall ReloadMapPart + jr .loop + +.done + ret +; 170510 + +.DoJumptable: ; 170510 + ld a, [wJumptableIndex] + ld e, a + ld d, 0 + ld hl, .dw + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp hl +; 17051f + +.dw ; 17051f + dw .Jumptable_0 + dw .Jumptable_1 + dw .Jumptable_2 +; 170525 + +.Jumptable_0: ; 170525 + ld a, $5 + call GetSRAMBank + + ld hl, $a89c + ld de, StringBuffer3 + ld bc, $16 + call CopyBytes + + ld hl, $a8b2 + ld de, wMisc + ld bc, $0096 + call CopyBytes + + call CloseSRAM + hlcoord 1, 1 + ld de, StringBuffer3 + call PlaceString + hlcoord 1, 3 + ld de, .String_Mail + call PlaceString + hlcoord 4, 3 + ld de, StringBuffer4 + call PlaceString + hlcoord 8, 3 + ld de, .String_PastReaders + call PlaceString + call .DrawBorder + call .PlaceTextItems + jr .NextJumptableFunction + + +.Jumptable_1: + call SetPalettes + call .NextJumptableFunction + + +.Jumptable_2: + ld hl, hJoyPressed + ld a, [hl] + and A_BUTTON + jr nz, .pressed_a_or_b + ld a, [hl] + and B_BUTTON + jr nz, .pressed_a_or_b + ld a, [hl] + and D_UP + jr nz, .pressed_up + ld a, [hl] + and D_DOWN + jr nz, .pressed_down + ret + +.pressed_up + ld a, [wNrOfBeatenBattleTowerTrainers] + and a + ret z + sub 15 + ld [wNrOfBeatenBattleTowerTrainers], a + call .PlaceTextItems + ret + +.pressed_down + ld a, [wNrOfBeatenBattleTowerTrainers] + cp 60 + ret z + add 15 + ld [wNrOfBeatenBattleTowerTrainers], a + call .PlaceTextItems + ret + +.pressed_a_or_b + ld hl, wJumptableIndex + set 7, [hl] + ret + +.NextJumptableFunction: + ld hl, wJumptableIndex + inc [hl] + ret +; 1705b7 + +.DrawBorder: ; 1705b7 + hlcoord 0, 4 + ld a, $79 + ld [hli], a + ld c, SCREEN_WIDTH - 2 +.top_border_loop + ld a, $7a + ld [hli], a + dec c + jr nz, .top_border_loop + ld a, $7b + ld [hli], a + ld de, SCREEN_WIDTH + ld c, 12 +.left_border_loop + ld a, $7c + ld [hl], a + add hl, de + dec c + jr nz, .left_border_loop + ld a, $7d + ld [hli], a + ld c, SCREEN_WIDTH - 2 +.bottom_border_loop + ld a, $7a + ld [hli], a + dec c + jr nz, .bottom_border_loop + ld a, $7e + ld [hl], a + ld de, -SCREEN_WIDTH + add hl, de + ld c, 12 +.right_border_loop + ld a, $7c + ld [hl], a + add hl, de + dec c + jr nz, .right_border_loop + ret +; 1705f0 + +.PlaceTextItems: ; 1705f0 + call .ClearBox + call .PlaceUpDownArrows + ld a, $50 + ld [wcd4e], a + ld hl, wMisc + ld a, [wNrOfBeatenBattleTowerTrainers] + ld c, a + xor a + ld b, a + add hl, bc + push hl + pop bc + hlcoord 1, 6 + ld a, 6 +.loop1 + push af + push hl + ld a, 3 +.loop2 + push af + ld de, wcd49 + ld a, [bc] + and a + jr z, .fill_with_e3 +; .copy + ld a, 5 +.loop3a + push af + ld a, [bc] + ld [de], a + inc bc + inc de + pop af + dec a + jr nz, .loop3a + jr .rejoin + +.fill_with_e3 + ld a, 5 +.loop3b + push af + ld a, $e3 + ld [de], a + inc de + inc bc + pop af + dec a + jr nz, .loop3b + +.rejoin + ld de, wcd49 + push bc + call PlaceString + ld de, NAME_LENGTH_JAPANESE + add hl, de + pop bc + pop af + dec a + jr nz, .loop2 + pop hl + ld de, $28 + add hl, de + pop af + dec a + jr nz, .loop1 + ret +; 17064b + +.ClearBox: ; 17064b + hlcoord 1, 5 + xor a + ld b, 12 +.clearbox_row + ld c, SCREEN_WIDTH - 2 +.clearbox_column + ld [hli], a + dec c + jr nz, .clearbox_column + inc hl + inc hl + dec b + jr nz, .clearbox_row + ret +; 17065d + +.PlaceUpDownArrows: ; 17065d + ld a, [wNrOfBeatenBattleTowerTrainers] + and a + jr z, .nope + hlcoord 18, 5 + ld a, "▲" + ld [hl], a + +.nope + ld a, [wNrOfBeatenBattleTowerTrainers] + cp 60 + ret z + hlcoord 18, 16 + ld a, "▼" + ld [hl], a + ret +; 170676 + +.String_Mail: ; 170676 + db "ルーム@" +; 17067a + +.String_PastReaders: ; 17067a + db "れきだいりーダーいちらん@" +; 170687 + +BattleTowerAction: ; 170687 + ld a, [ScriptVar] + ld e, a + ld d, 0 + ld hl, .dw + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp hl +; 170696 + + +.dw ; 170696 (5c:4696) + dw BattleTowerAction_CheckExplanationRead ; 0x00 + dw BattleTowerAction_SetExplanationRead ; 0x01 + dw BattleTowerAction_GetChallengeState ; 0x02 + dw BattleTowerAction_SetByteToQuickSaveChallenge ; 0x03 + dw BattleTowerAction_SetByteToCancelChallenge ; 0x04 + dw Function1707ac ; 0x05 + dw Function1707f4 ; 0x06 + dw SaveBattleTowerLevelGroup ; 0x07 + dw LoadBattleTowerLevelGroup ; 0x08 + dw BattleTower_CheckSaveFileExistsAndIsYours ; 0x09 + dw Function1708b1 ; 0x0a + dw CheckMobileEventIndex ; 0x0b + dw Function1708c8 ; 0x0c + dw Function1708f0 ; 0x0d + dw BattleTowerAction_EggTicket ; 0x0e + dw Function1709aa ; 0x0f + dw Function1709bb ; 0x10 + dw Function170a9c ; 0x11 + dw Function170aa0 ; 0x12 + dw Function170aaf ; 0x13 + dw Function170abe ; 0x14 + dw Function170ad7 ; 0x15 + dw Function170807 ; 0x16 + dw Function17081d ; 0x17 + dw BattleTowerAction_LevelCheck ; 0x18 + dw BattleTowerAction_UbersCheck ; 0x19 + dw ResetBattleTowerTrainersSRAM ; 0x1a + dw BattleTower_GiveReward ; 0x1b + dw Function17071b ; 0x1c + dw Function170729 ; 0x1d + dw BattleTower_RandomlyChooseReward ; 0x1e + dw BattleTower_SaveOptions ; 0x1f + + +; Reset the save memory for BattleTower-Trainers (Counter and all 7 TrainerBytes) +ResetBattleTowerTrainersSRAM: ; 1706d6 (5c:46d6) BattleTowerAction $1a + ld a, BANK(sBTTrainers) + call GetSRAMBank + + ld a, $ff + ld hl, sBTTrainers + ld bc, BATTLETOWER_NROFTRAINERS + call ByteFill + + xor a + ld [sNrOfBeatenBattleTowerTrainers], a + + call CloseSRAM + + ret + +BattleTower_GiveReward: ; 1706ee (5c:46ee) BattleTowerAction $1b + ld a, BANK(sBattleTowerReward) + call GetSRAMBank + + ld a, [sBattleTowerReward] + call CloseSRAM + ld [ScriptVar], a + ld hl, NumItems + ld a, [hli] + cp MAX_ITEMS + ret c + ld b, MAX_ITEMS + ld a, [ScriptVar] + ld c, a +.loop + ld a, [hli] + cp c + jr nz, .next + ld a, [hl] + cp 95 + ret c +.next + inc hl + dec b + jr nz, .loop + ld a, POTION + ld [ScriptVar], a + ret + +Function17071b: ; 17071b (5c:471b) BattleTowerAction $1c + ld a, BANK(sBattleTowerChallengeState) + call GetSRAMBank + ld a, BATTLETOWER_WON_CHALLENGE + ld [sBattleTowerChallengeState], a + call CloseSRAM + ret + +Function170729: ; 170729 (5c:4729) BattleTowerAction $1d + ld a, BANK(sBattleTowerChallengeState) + call GetSRAMBank + ld a, BATTLETOWER_RECEIVED_REWARD + ld [sBattleTowerChallengeState], a + call CloseSRAM + ret + +BattleTower_SaveOptions: ; 170737 (5c:4737) BattleTowerAction $1f + farcall SaveOptions + ret + +BattleTower_RandomlyChooseReward: ; 17073e (5c:473e) BattleTowerAction $1e +; Generate a random stat boosting item. +.loop + call Random + ld a, [hRandomAdd] + and $7 + cp 6 + jr c, .okay + sub 6 +.okay + add HP_UP + cp LUCKY_PUNCH + jr z, .loop + push af + ld a, BANK(sBattleTowerReward) + call GetSRAMBank + pop af + ld [sBattleTowerReward], a + call CloseSRAM + ret + +BattleTowerAction_CheckExplanationRead: ; 17075f (5c:475f) BattleTowerAction $00 + call BattleTower_CheckSaveFileExistsAndIsYours + ld a, [ScriptVar] + and a + ret z + + ld a, BANK(sBattleTowerSaveFileFlags) + call GetSRAMBank + ld a, [sBattleTowerSaveFileFlags] + and $2 + ld [ScriptVar], a + call CloseSRAM + ret + +BattleTowerAction_GetChallengeState: ; 170778 (5c:4778) BattleTowerAction $02 + ld hl, sBattleTowerChallengeState + ld a, BANK(sBattleTowerChallengeState) + call GetSRAMBank + ld a, [hl] + ld [ScriptVar], a + call CloseSRAM + ret + +BattleTowerAction_SetExplanationRead: ; 170788 (5c:4788) BattleTowerAction $01 + ld a, BANK(sBattleTowerSaveFileFlags) + call GetSRAMBank + ld a, [sBattleTowerSaveFileFlags] + or $2 + ld [sBattleTowerSaveFileFlags], a + call CloseSRAM + ret + +BattleTowerAction_SetByteToQuickSaveChallenge: ; 170799 (5c:4799) BattleTowerAction $03 + ld c, BATTLETOWER_SAVED_AND_LEFT + jr asm_17079f + +BattleTowerAction_SetByteToCancelChallenge: ; 17079d (5c:479d) BattleTowerAction $04 + ld c, BATTLETOWER_NO_CHALLENGE +asm_17079f: ; 17079f (5c:479f) + ld a, BANK(sBattleTowerChallengeState) + call GetSRAMBank + ld a, c + ld [sBattleTowerChallengeState], a + call CloseSRAM + ret + +Function1707ac: ; 1707ac (5c:47ac) BattleTowerAction $05 + ld a, $5 + call GetSRAMBank + ld a, [$aa8c] + ld b, a + ld a, [$be46] + ld [ScriptVar], a + call CloseSRAM + and a + ret z + ld a, b + cp $2 + jr nc, .asm_1707ef + push bc + call UpdateTime + pop bc + ld a, $5 + call GetSRAMBank + ld a, [$aa8b] + call CloseSRAM + ld c, a + ld a, [CurDay] + sub c + jr c, .asm_1707e5 + cp $8 + jr nc, .asm_1707ef + ld a, b + and a + jr nz, .asm_1707ef + ret +.asm_1707e5 + ld hl, CurDay + ld a, $8c + sub c + add [hl] + cp $8 + ret c +.asm_1707ef + ld a, $8 + ld [ScriptVar], a + +Function1707f4: ; 1707f4 (5c:47f4) BattleTowerAction $06 + ld a, $5 + call GetSRAMBank + xor a + ld [$be46], a + ld [$aa8b], a + ld [$aa8c], a + call CloseSRAM + ret + +Function170807: ; 170807 (5c:4807) BattleTowerAction $16 + call UpdateTime + ld a, $5 + call GetSRAMBank + ld a, [CurDay] + ld [$b2f9], a + xor a + ld [$b2fa], a + call CloseSRAM + ret + +Function17081d: ; 17081d (5c:481d) BattleTowerAction $17 + xor a + ld [ScriptVar], a + ld a, $5 + call GetSRAMBank + ld a, [$b2f9] + ld c, a + ld a, [$b2fa] + ld b, a + call CloseSRAM + cp $2 + jr nc, .asm_170853 + push bc + call UpdateTime + pop bc + ld a, [CurDay] + sub c + jr c, .asm_170849 + cp $b + jr nc, .asm_170853 + ld a, b + and a + jr nz, .asm_170853 + ret + +.asm_170849 + ld hl, CurDay + ld a, 140 + sub c + add [hl] + cp $b + ret c +.asm_170853 + ld a, $1 + ld [ScriptVar], a + ld a, $5 + call GetSRAMBank + xor a + ld [$b2f9], a + ld [$b2fa], a + call CloseSRAM + ret + +SaveBattleTowerLevelGroup: ; 170868 (5c:4868) BattleTowerAction $07 + ld a, BANK(sBTChoiceOfLevelGroup) + call GetSRAMBank + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a + ld a, [wBTChoiceOfLvlGroup] + ld [sBTChoiceOfLevelGroup], a + pop af + ld [rSVBK], a + call CloseSRAM + ret + +LoadBattleTowerLevelGroup: ; 170881 (5c:4881) BattleTowerAction $08 ; Load level group choice + ld a, BANK(sBTChoiceOfLevelGroup) + call GetSRAMBank + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a + ld a, [sBTChoiceOfLevelGroup] + ld [wBTChoiceOfLvlGroup], a + pop af + ld [rSVBK], a + call CloseSRAM + ret + +BattleTower_CheckSaveFileExistsAndIsYours: ; 17089a BattleTowerAction $09 + ld a, [wSaveFileExists] + and a + jr z, .nope + farcall CompareLoadedAndSavedPlayerID + jr z, .yes + xor a + jr .nope + +.yes + ld a, $1 + +.nope + ld [ScriptVar], a + ret +; 1708b1 + + +Function1708b1: ; 1708b1 (5c:48b1) BattleTowerAction $0a + xor a + ld [MusicFade], a + call MaxVolume + ret + +CheckMobileEventIndex: ; 1708b9 (5c:48b9) BattleTowerAction $0b something to do with GS Ball + ld a, BANK(sMobileEventIndex) + call GetSRAMBank + ld a, [sMobileEventIndex] + ld [ScriptVar], a + call CloseSRAM + ret + +Function1708c8: ; 1708c8 (5c:48c8) BattleTowerAction $0c + call UpdateTime + ld a, $5 + call GetSRAMBank + ld a, [CurDay] + ld [$aa8b], a + xor a + ld [$aa8c], a + ld a, [$aa5d] + cp $2 + jr nc, .asm_1708ec + ld a, [CurDay] + ld [$aa48], a + ld a, $1 + ld [$aa47], a +.asm_1708ec + call CloseSRAM + ret + +Function1708f0: ; 1708f0 (5c:48f0) BattleTowerAction $0d + xor a + ld [ScriptVar], a + call UpdateTime + ld a, $5 + call GetSRAMBank + ld a, [$aa48] + ld c, a + ld a, [$aa47] + call CloseSRAM + and a + ret z + ld hl, CurDay + ld a, c + cp [hl] + jr nz, Function170923 + ld a, $5 + call GetSRAMBank + ld a, [$aa5d] + call CloseSRAM + cp $5 + ret c + ld a, $1 + ld [ScriptVar], a + ret + + +Function170923: ; 170923 + ld a, $5 + call GetSRAMBank + xor a + ld [$aa48], a + ld [$aa47], a + ld hl, $aa5d + ld bc, $0011 + call ByteFill + call CloseSRAM + ret +; 17093c + + +BattleTowerAction_EggTicket: ; 17093c (5c:493c) BattleTowerAction $0e + xor a + ld [ScriptVar], a + ld a, EGG_TICKET + ld [CurItem], a + ld hl, NumItems + call CheckItem + ret nc + ld a, [PartyCount] + ld b, 0 + ld c, a + ld hl, PartySpecies +.loop + ld a, [hli] + cp EGG + jr nz, .not_egg + push hl + ld hl, PartyMonOT + ld de, NAME_LENGTH_JAPANESE + ld a, b + and a + jr z, .skip +.loop2 + add hl, de + dec a + jr nz, .loop2 +.skip + ld de, String_1709a4 + ld a, NAME_LENGTH_JAPANESE +.compare_loop + push af + ld a, [de] + inc de + cp [hl] + inc hl + jr nz, .different + pop af + dec a + jr nz, .compare_loop +rept 4 + dec hl +endr + ld a, "@" + ld [hli], a + ld [hli], a + pop hl + ld a, EGG_TICKET + ld [CurItem], a + ld a, 1 + ld [wItemQuantityChangeBuffer], a + ld a, -1 + ld [CurItemQuantity], a + ld hl, NumItems + call TossItem + ld a, $1 + ld [ScriptVar], a + ret + +.different + pop af + pop hl +.not_egg + inc b + dec c + jr nz, .loop + ret +; 1709a4 (5c:49a4) + +String_1709a4: ; 1709a4 + db "なぞナゾ@@" + +Function1709aa: ; 1709aa (5c:49aa) BattleTowerAction $0f + ld a, [rSVBK] + push af + ld a, BANK(w3_d090) + ld [rSVBK], a + ld a, [w3_d090] + ld [ScriptVar], a + pop af + ld [rSVBK], a + ret + +Function1709bb: ; 1709bb (5c:49bb) BattleTowerAction $10 + xor a + ld [ScriptVar], a + ld a, $5 + call GetSRAMBank + ld a, [$a800] + call CloseSRAM + cp 6 + jr nc, .invalid + ld e, a + ld d, 0 + ld hl, Jumptable_1709e7 + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp hl + +.invalid + ld a, $5 + call GetSRAMBank + xor a + ld [$a800], a + call CloseSRAM + ret +; 1709e7 (5c:49e7) + +Jumptable_1709e7: ; 1709e7 + dw .NoAction + dw .NoAction + dw .DoAction1 + dw .DoAction1 + dw .Action4 + dw .Action5 +; 1709f3 + +.DoAction1: ; 1709f3 + ld a, $5 + call GetSRAMBank + ld a, $1 + ld [$a800], a + call CloseSRAM + +.NoAction: ; 170a00 + ret +; 170a01 + +.Action4: ; 170a01 + ld a, $5 + call GetSRAMBank + ld hl, $b023 + ld de, wMisc + ld bc, $0069 + call CopyBytes + ld a, [$a825] + ld [wcd30], a + ld a, [$a826] + ld [wcd31], a + call CloseSRAM + farcall Function11b6b4 + farcall Function17d0f3 + ld a, $1 + ld [ScriptVar], a + ret +; 170a33 + +.Action5: ; 170a33 + ld a, $0 + call GetSRAMBank + ld hl, wRTC + ld de, wMisc + ld bc, $0004 + call CopyBytes + call CloseSRAM + ld a, $5 + call GetSRAMBank + ld hl, $b08c + ld de, wMisc + ld c, $4 +.compare_loop + ld a, [de] + inc de + cp [hl] + jr nz, .different + inc hl + dec c + jr nz, .compare_loop + call CloseSRAM + ld a, [MapGroup] + ld b, a + ld a, [MapNumber] + ld c, a + call GetMapSceneID + ld a, d + or e + jr z, .no_scene + ld a, [de] + and a + ret nz + +.no_scene + ld a, $1 + ld [ScriptVar], a + ret + +.different + call CloseSRAM + ld a, $5 + call GetSRAMBank + xor a + ld [$a800], a + call CloseSRAM + ld [ScriptVar], a + ld a, [MapGroup] + ld b, a + ld a, [MapNumber] + ld c, a + call GetMapSceneID + ld a, d + or e + jr z, .no_scene_2 + xor a + ld [de], a + +.no_scene_2 + ret +; 170a9c + +Function170a9c: ; 170a9c (5c:4a9c) BattleTowerAction $11 + ld c, $0 + jr asm_170aa2 + +Function170aa0: ; 170aa0 (5c:4aa0) BattleTowerAction $12 + ld c, $1 +asm_170aa2: ; 170aa2 (5c:4aa2) + ld a, $5 + call GetSRAMBank + ld a, c + ld [$aa8d], a + call CloseSRAM + ret + +Function170aaf: ; 170aaf (5c:4aaf) BattleTowerAction $13 + ld a, $5 + call GetSRAMBank + ld a, [$aa8d] + ld [ScriptVar], a + call CloseSRAM + ret + +Function170abe: ; 170abe (5c:4abe) BattleTowerAction $14 + call BattleTower_CheckSaveFileExistsAndIsYours + ld a, [ScriptVar] + and a + ret z + + ld a, BANK(sBattleTowerSaveFileFlags) + call GetSRAMBank + ld a, [sBattleTowerSaveFileFlags] + and $1 + ld [ScriptVar], a + call CloseSRAM + ret + +Function170ad7: ; 170ad7 (5c:4ad7) BattleTowerAction $15 + ld a, BANK(sBattleTowerSaveFileFlags) + call GetSRAMBank + ld a, [sBattleTowerSaveFileFlags] + or $1 + ld [sBattleTowerSaveFileFlags], a + call CloseSRAM + ret + +BattleTowerAction_LevelCheck: ; 170ae8 (5c:4ae8) BattleTowerAction $18 + ld a, $5 + call GetSRAMBank + ld a, [$b2fb] + call CloseSRAM + ld c, 10 + call SimpleDivide + ld a, b + ld [wcd4f], a + xor a + ld [ScriptVar], a + farcall BattleTower_LevelCheck ; level check + ret nc + ld a, $5 + call GetSRAMBank + ld a, [$b2fb] + call CloseSRAM + ld [ScriptVar], a + ret + +BattleTowerAction_UbersCheck: ; 170b16 (5c:4b16) BattleTowerAction $19 + ld a, $5 + call GetSRAMBank + ld a, [$b2fb] + call CloseSRAM + ld c, 10 + call SimpleDivide + ld a, b + ld [wcd4f], a + xor a + ld [ScriptVar], a + farcall BattleTower_UbersCheck + ret nc + ld a, $5 + call GetSRAMBank + ld a, [$b2fb] + call CloseSRAM + ld [ScriptVar], a + ret + +Function_LoadOpponentTrainerAndPokemonsWithOTSprite: ; 0x170b44 + farcall Function_LoadOpponentTrainerAndPokemons + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a + ld hl, BT_OTTrainerClass + ld a, [hl] + dec a + ld c, a + ld b, $0 + pop af + ld [rSVBK], a + ld hl, BTTrainerClassSprites + add hl, bc + ld a, [hl] + ld [wBTTempOTSprite], a + +; Load sprite of the opponent trainer +; because s/he is chosen randomly and appears out of nowhere + ld a, [ScriptVar] + dec a + sla a + ld e, a + sla a + sla a + sla a + ld c, a + ld b, 0 + ld d, 0 + ld hl, MapObjects + add hl, bc + inc hl + ld a, [wBTTempOTSprite] + ld [hl], a + ld hl, UsedSprites + add hl, de + ld [hli], a + ld [hUsedSpriteIndex], a + ld a, [hl] + ld [hUsedSpriteTile], a + farcall GetUsedSprite + ret +; 170b90 + +INCLUDE "data/trainers/sprites.asm" + +ret_170bd2: ; 170bd2 + ret +; 170bd3 + +SpecialCheckForBattleTowerRules: ; 170bd3 + farcall CheckForBattleTowerRules + jr c, .asm_170bde + xor a + jr .asm_170be0 + +.asm_170bde + ld a, $1 + +.asm_170be0 + ld [ScriptVar], a + ret +; 170be4 diff --git a/engine/events/battle_tower/get_trainer_class.asm b/engine/events/battle_tower/get_trainer_class.asm new file mode 100644 index 000000000..37fe91c56 --- /dev/null +++ b/engine/events/battle_tower/get_trainer_class.asm @@ -0,0 +1,46 @@ +GetMobileOTTrainerClass: ; mobile function + ld h, b + ld l, c + call .GetMobileOTTrainerClass + ld c, a + ret + +.GetMobileOTTrainerClass: ; 4e930 + ld a, [hli] + xor [hl] + ld c, a + jr z, .skip_male_trainers + srl c + srl c +.male_trainer_loop + srl c + ld a, c + cp MaleTrainersEnd - MaleTrainers - 1 + jr nc, .male_trainer_loop + inc c + +.skip_male_trainers + ld a, [de] + cp $1 + ld hl, MaleTrainers + jr nz, .finished + + ld hl, FemaleTrainers + ld a, c + and a + jr z, .finished + +.female_trainer_loop + srl c + ld a, c + cp FemaleTrainersEnd - FemaleTrainers - 1 + jr nc, .female_trainer_loop + inc c + +.finished + ld b, $0 + add hl, bc + ld a, [hl] + ret + +INCLUDE "data/trainers/gendered_trainers.asm" diff --git a/engine/events/battle_tower/load_trainer.asm b/engine/events/battle_tower/load_trainer.asm new file mode 100644 index 000000000..5d8c06166 --- /dev/null +++ b/engine/events/battle_tower/load_trainer.asm @@ -0,0 +1,210 @@ +Function_LoadOpponentTrainerAndPokemons: ; 1f8000 + ld a, [rSVBK] + push af + ld a, BANK(BT_OTTrainer) + ld [rSVBK], a + + ; Fill BT_OTTrainer with zeros + xor a + ld hl, BT_OTTrainer + ld bc, BT_OTTrainerEnd - BT_OTTrainer + call ByteFill + + ; Write $ff into the Item-Slots + ld a, $ff + ld [BT_OTPkmn1Item], a + ld [BT_OTPkmn2Item], a + ld [BT_OTPkmn3Item], a + + ; Set BT_OTTrainer as start address to write the following data to + ld de, BT_OTTrainer + + ld a, [hRandomAdd] + ld b, a +.resample ; loop to find a random trainer + call Random + ld a, [hRandomAdd] + add b + ld b, a ; b contains the nr of the trainer +if DEF(CRYSTAL11) + and (1 << 7) - 1 + cp 70 +else + and (1 << 5) - 1 + cp 21 +endc + jr nc, .resample + ld b, a + + ld a, BANK(sBTTrainers) + call GetSRAMBank + + ld c, BATTLETOWER_NROFTRAINERS + ld hl, sBTTrainers +.next_trainer + ld a, [hli] + cp b + jr z, .resample + dec c + jr nz, .next_trainer ; c <= 7 initialise all 7 trainers? + + ld hl, sBTTrainers + ld a, [sNrOfBeatenBattleTowerTrainers] + ld c, a + ld a, b + ld b, 0 + add hl, bc + ld [hl], a + + call CloseSRAM + + push af +; Copy name (10 bytes) and class (1 byte) of trainer + ld hl, BattleTowerTrainers + ld bc, NAME_LENGTH + call AddNTimes + ld bc, NAME_LENGTH + call CopyBytes + + call Function_LoadRandomBattleTowerPkmn + pop af + + ld hl, BattleTowerTrainerData + ld bc, BATTLETOWER_TRAINERDATALENGTH + call AddNTimes + ld bc, BATTLETOWER_TRAINERDATALENGTH +.copy_bt_trainer_data_loop + ld a, BANK(BattleTowerTrainerData) + call GetFarByte + ld [de], a + inc hl + inc de + dec bc + ld a, b + or c + jr nz, .copy_bt_trainer_data_loop + + pop af + ld [rSVBK], a + + ret + + +Function_LoadRandomBattleTowerPkmn: ; 1f8081 + ld c, BATTLETOWER_NROFPKMNS +.loop + push bc + ld a, BANK(sBTPkmnPrevTrainer1) + call GetSRAMBank + +.FindARandomBattleTowerPkmn: + ; From Which LevelGroup are the Pkmn loaded + ; a = 1..10 + ld a, [wBTChoiceOfLvlGroup] ; [$d800] + dec a + ld hl, BattleTowerMons + ld bc, BattleTowerMons2 - BattleTowerMons1 + call AddNTimes + + ld a, [hRandomAdd] + ld b, a +.resample + call Random + ld a, [hRandomAdd] + add b + ld b, a + and $1f + cp BATTLETOWER_NRMONSPERLEVELBRACKET + jr nc, .resample + ; in register 'a' is the chosen Pkmn of the LevelGroup + + ; Check if Pkmn was already loaded before + ; Check current and the 2 previous teams + ; includes check if item is double at the current team + ld bc, PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH + call AddNTimes + ld a, [hli] + ld b, a + ld a, [hld] + ld c, a + ld a, [BT_OTPkmn1] + cp b + jr z, .FindARandomBattleTowerPkmn + ld a, [BT_OTPkmn1Item] + cp c + jr z, .FindARandomBattleTowerPkmn + ld a, [BT_OTPkmn2] + cp b + jr z, .FindARandomBattleTowerPkmn + ld a, [BT_OTPkmn2Item] + cp c + jr z, .FindARandomBattleTowerPkmn + ld a, [BT_OTPkmn3] + cp b + jr z, .FindARandomBattleTowerPkmn + ld a, [BT_OTPkmn3Item] + cp c + jr z, .FindARandomBattleTowerPkmn + ld a, [sBTPkmnPrevTrainer1] + cp b + jr z, .FindARandomBattleTowerPkmn + ld a, [sBTPkmnPrevTrainer2] + cp b + jr z, .FindARandomBattleTowerPkmn + ld a, [sBTPkmnPrevTrainer3] + cp b + jr z, .FindARandomBattleTowerPkmn + ld a, [sBTPkmnPrevPrevTrainer1] + cp b + jr z, .FindARandomBattleTowerPkmn + ld a, [sBTPkmnPrevPrevTrainer2] + cp b + jr z, .FindARandomBattleTowerPkmn + ld a, [sBTPkmnPrevPrevTrainer3] + cp b + jr z, .FindARandomBattleTowerPkmn + + ld bc, PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH + call CopyBytes + + ld a, [wNamedObjectIndexBuffer] + push af + push de + ld hl, - (PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH) + add hl, de + ld a, [hl] + ld [wNamedObjectIndexBuffer], a + ld bc, PARTYMON_STRUCT_LENGTH + add hl, bc + push hl + call GetPokemonName + ld h, d + ld l, e + pop de + ld bc, PKMN_NAME_LENGTH + call CopyBytes + + pop de + pop af + ld [wNamedObjectIndexBuffer], a + pop bc + dec c + jp nz, .loop + + ld a, [sBTPkmnPrevTrainer1] + ld [sBTPkmnPrevPrevTrainer1], a + ld a, [sBTPkmnPrevTrainer2] + ld [sBTPkmnPrevPrevTrainer2], a + ld a, [sBTPkmnPrevTrainer3] + ld [sBTPkmnPrevPrevTrainer3], a + ld a, [BT_OTPkmn1] + ld [sBTPkmnPrevTrainer1], a + ld a, [BT_OTPkmn2] + ld [sBTPkmnPrevTrainer2], a + ld a, [BT_OTPkmn3] + ld [sBTPkmnPrevTrainer3], a + call CloseSRAM + ret +; 1f814e + +INCLUDE "data/battle_tower/parties.asm" diff --git a/engine/events/battle_tower/rules.asm b/engine/events/battle_tower/rules.asm new file mode 100644 index 000000000..de6022145 --- /dev/null +++ b/engine/events/battle_tower/rules.asm @@ -0,0 +1,342 @@ +CheckForMobileBattleRules: ; 8b1e1 + ld de, .PointerTables + call BattleTower_ExecuteJumptable + ret z + call BattleTower_PleaseReturnWhenReady + scf + ret +; 8b1ed + +.PointerTables: ; 8b1ed + db 2 + dw .Functions + dw .TextPointers + +.Functions: ; 8b1f2 + dw BattleTower_CheckPartyLengthIs3 + dw BattleTower_CheckPartyHasThreeMonsThatAreNotEggs +; 8b1f6 + +.TextPointers: ; 8b1f6 + dw .ExcuseMeText + dw JumpText_NeedAtLeastThreeMon + dw JumpText_EggDoesNotQualify +; 8b1fc + +.ExcuseMeText: ; 0x8b1fc + ; Excuse me! + text_jump UnknownText_0x1c5937 + db "@" +; 0x8b201 + +CheckForBattleTowerRules: ; 8b201 + ld hl, StringBuffer2 + ld [hl], "3" + inc hl + ld [hl], "@" + ld de, .PointerTables + call BattleTower_ExecuteJumptable + ret z + call BattleTower_PleaseReturnWhenReady + scf + ret +; 8b215 + +.PointerTables: ; 8b215 + db 4 + dw .Functions + dw .TextPointers + +.Functions: ; 8b21a + dw Function_PartyCountEq3 + dw Function_PartySpeciesAreUnique + dw Function_PartyItemsAreUnique + dw Function_HasPartyAnEgg +; 8b222 + +.TextPointers: ; 8b222 + dw JumpText_ExcuseMeYoureNotReady + dw JumpText_OnlyThreePkmnMayBeEntered + dw JumpText_ThePkmnMustAllBeDifferentKinds + dw JumpText_ThePkmnMustNotHoldTheSameItems + dw JumpText_YouCantTakeAnEgg +; 8b22c + +JumpText_ExcuseMeYoureNotReady: ; 0x8b22c + ; Excuse me. You're not ready. + text_jump Text_ExcuseMeYoureNotReady + db "@" +; 0x8b231 + +BattleTower_PleaseReturnWhenReady: ; 8b231 + ld hl, .PleaseReturnWhenReady + call PrintText + ret +; 8b238 + +.PleaseReturnWhenReady: ; 0x8b238 + ; Please return when you're ready. + text_jump UnknownText_0x1c5962 + db "@" +; 0x8b23d + +JumpText_NeedAtLeastThreeMon: ; 0x8b23d + ; You need at least three #MON. + text_jump UnknownText_0x1c5983 + db "@" +; 0x8b242 + +JumpText_EggDoesNotQualify: ; 0x8b242 + ; Sorry, an EGG doesn't qualify. + text_jump UnknownText_0x1c59a3 + db "@" +; 0x8b247 + +JumpText_OnlyThreePkmnMayBeEntered: ; 0x8b247 + ; Only three #MON may be entered. + text_jump Text_OnlyThreePkmnMayBeEntered + db "@" +; 0x8b24c + +JumpText_ThePkmnMustAllBeDifferentKinds: ; 0x8b24c + ; The @ #MON must all be different kinds. + text_jump Text_ThePkmnMustAllBeDifferentKinds + db "@" +; 0x8b251 + +JumpText_ThePkmnMustNotHoldTheSameItems: ; 0x8b251 + ; The @ #MON must not hold the same items. + text_jump Text_ThePkmnMustNotHoldTheSameItems + db "@" +; 0x8b256 + +JumpText_YouCantTakeAnEgg: ; 0x8b256 + ; You can't take an EGG! + text_jump Text_YouCantTakeAnEgg + db "@" +; 0x8b25b + +BattleTower_ExecuteJumptable: ; 8b25b + ld bc, 0 +.loop + call .DoJumptableFunction + call c, .PrintFailureText + call .Next_CheckReachedEnd + jr nz, .loop + ld a, b + and a + ret +; 8b26c + +.DoJumptableFunction: ; 8b26c + push de + push bc + call .GetFunctionPointer + ld a, c + rst JumpTable + pop bc + pop de + ret +; 8b276 + +.Next_CheckReachedEnd: ; 8b276 + inc c + ld a, [de] + cp c + ret +; 8b27a + +.GetFunctionPointer: ; 8b27a + inc de + ld a, [de] + ld l, a + inc de + ld a, [de] + ld h, a + ret +; 8b281 + +.GetTextPointers: ; 8b281 + inc de + inc de + inc de + ld a, [de] + ld l, a + inc de + ld a, [de] + ld h, a + ret +; 8b28a + +.LoadTextPointer: ; 8b28a + ld a, [hli] + ld h, [hl] + ld l, a + ret +; 8b28e + +.PrintFailureText: ; 8b28e + push de + push bc + ld a, b + and a + call z, .PrintFirstText + pop bc + call .PrintNthText + ld b, $1 + pop de + ret +; 8b29d + +.PrintFirstText: ; 8b29d + push de + call .GetTextPointers + call .LoadTextPointer + call PrintText + pop de + ret +; 8b2a9 + +.PrintNthText: ; 8b2a9 + push bc + call .GetTextPointers + inc hl + inc hl + ld b, $0 + add hl, bc + add hl, bc + call .LoadTextPointer + call PrintText + pop bc + ret +; 8b2bb + +BattleTower_CheckPartyLengthIs3: ; 8b2bb + ld a, [PartyCount] + cp 3 + ret +; 8b2c1 + +BattleTower_CheckPartyHasThreeMonsThatAreNotEggs: ; 8b2c1 + ld hl, PartyCount + ld a, [hli] + ld b, $0 + ld c, a +.loop + ld a, [hli] + cp EGG + jr z, .egg + inc b + +.egg + dec c + jr nz, .loop + ld a, [PartyCount] + cp b + ret z + ld a, b + cp 3 + ret +; 8b2da + +Function_PartyCountEq3: ; 8b2da + ld a, [PartyCount] + cp 3 + ret z + scf + ret +; 8b2e2 + +Function_PartySpeciesAreUnique: ; 8b2e2 + ld hl, PartyMon1Species + call VerifyUniqueness + ret +; 8b2e9 + +VerifyUniqueness: ; 8b2e9 + ld de, PartyCount + ld a, [de] + inc de + dec a + jr z, .done + ld b, a +.loop + push hl + push de + ld c, b + call .isegg + jr z, .next + ld a, [hl] + and a + jr z, .next +.loop2 + call .nextmon + call .isegg + jr z, .next2 + cp [hl] + jr z, .gotcha + +.next2 + dec c + jr nz, .loop2 + +.next + pop de + pop hl + call .nextmon + dec b + jr nz, .loop + +.done + and a + ret + +.gotcha + pop de + pop hl + scf + ret +; 8b31a + +.nextmon ; 8b31a + push bc + ld bc, PARTYMON_STRUCT_LENGTH + add hl, bc + inc de + pop bc + ret +; 8b322 + +.isegg ; 8b322 + push bc + ld b, a + ld a, [de] + cp EGG + ld a, b + pop bc + ret +; 8b32a + +Function_PartyItemsAreUnique: ; 8b32a + ld hl, PartyMon1Item + call VerifyUniqueness + ret +; 8b331 + +Function_HasPartyAnEgg: ; 8b331 + ld hl, PartyCount + ld a, [hli] + ld c, a +.loop + ld a, [hli] + cp EGG + jr z, .found + dec c + jr nz, .loop + and a + ret + +.found + scf + ret +; 8b342 diff --git a/engine/events/battle_tower/trainer_text.asm b/engine/events/battle_tower/trainer_text.asm new file mode 100755 index 000000000..21704ff2d --- /dev/null +++ b/engine/events/battle_tower/trainer_text.asm @@ -0,0 +1,718 @@ +BattleTowerText:: ; 11c000 +; Print text c for trainer [BT_OTTrainerClass] +; 1: Intro text +; 2: Player lost +; 3: Player won + ld a, [rSVBK] + push af + ld a, BANK(BT_OTTrainerClass) + ld [rSVBK], a +if DEF(CRYSTAL11) + ld hl, BT_OTTrainerClass +else +; BUG ALERT +; Instead of loading the Trainer Class, this routine +; loads the 6th character in the Trainer's name, then +; uses it to get the gender of the trainer. +; As a consequence, the enemy trainer's dialog will +; always be sampled from the female array. + ld hl, BT_OTName + 5 +endc + ld a, [hl] + dec a + ld e, a + ld d, 0 + ld hl, BTTrainerClassGenders + add hl, de + ld a, [hl] + and a + jr nz, .female + ; generate a random number between 0 and 24 + ld a, [hRandomAdd] + and $1f + cp 25 + jr c, .okay0 + sub 25 + +.okay0 + ld hl, BTMaleTrainerTexts + jr .proceed + +.female + ; generate a random number between 0 and 14 + ld a, [hRandomAdd] + and $f + cp 15 + jr c, .okay1 + sub 15 + +.okay1 + ld hl, BTFemaleTrainerTexts + +.proceed + ld b, 0 + dec c + jr nz, .restore + ld [BT_TrainerTextIndex], a + jr .okay2 + +.restore + ld a, [BT_TrainerTextIndex] + +.okay2 + push af + add hl, bc + add hl, bc + ld a, [hli] + ld c, a + ld a, [hl] + ld h, a + ld l, c + pop af + ld c, a + ld b, 0 + add hl, bc + add hl, bc + ld a, [hli] + ld c, a + ld a, [hl] + ld l, c + ld h, a + bccoord 1, 14 + pop af + ld [rSVBK], a + call PlaceHLTextAtBC + ret +; 11c05d + +INCLUDE "mobile/fixed_words.asm" + +INCLUDE "data/trainers/genders.asm" + + +BTMaleTrainerTexts: ; 11f332 + dw .Greetings + dw .PlayerLost + dw .PlayerWon + +.Greetings: ; 11f338 + dw BTGreetingM1 + dw BTGreetingM2 + dw BTGreetingM3 + dw BTGreetingM4 + dw BTGreetingM5 + dw BTGreetingM6 + dw BTGreetingM7 + dw BTGreetingM8 + dw BTGreetingM9 + dw BTGreetingM10 + dw BTGreetingM11 + dw BTGreetingM12 + dw BTGreetingM13 + dw BTGreetingM14 + dw BTGreetingM15 + dw BTGreetingM16 + dw BTGreetingM17 + dw BTGreetingM18 + dw BTGreetingM19 + dw BTGreetingM20 + dw BTGreetingM21 + dw BTGreetingM22 + dw BTGreetingM23 + dw BTGreetingM24 + dw BTGreetingM25 + +.PlayerLost: ; 11f36a + dw BTLossM1 + dw BTLossM2 + dw BTLossM3 + dw BTLossM4 + dw BTLossM5 + dw BTLossM6 + dw BTLossM7 + dw BTLossM8 + dw BTLossM9 + dw BTLossM10 + dw BTLossM11 + dw BTLossM12 + dw BTLossM13 + dw BTLossM14 + dw BTLossM15 + dw BTLossM16 + dw BTLossM17 + dw BTLossM18 + dw BTLossM19 + dw BTLossM20 + dw BTLossM21 + dw BTLossM22 + dw BTLossM23 + dw BTLossM24 + dw BTLossM25 + +.PlayerWon: ; 11f39c + dw BTWinM1 + dw BTWinM2 + dw BTWinM3 + dw BTWinM4 + dw BTWinM5 + dw BTWinM6 + dw BTWinM7 + dw BTWinM8 + dw BTWinM9 + dw BTWinM10 + dw BTWinM11 + dw BTWinM12 + dw BTWinM13 + dw BTWinM14 + dw BTWinM15 + dw BTWinM16 + dw BTWinM17 + dw BTWinM18 + dw BTWinM19 + dw BTWinM20 + dw BTWinM21 + dw BTWinM22 + dw BTWinM23 + dw BTWinM24 + dw BTWinM25 + + +BTFemaleTrainerTexts: + dw .Greetings + dw .PlayerLost + dw .PlayerWon + +.Greetings: ; 11f3d4 + dw BTGreetingF1 + dw BTGreetingF2 + dw BTGreetingF3 + dw BTGreetingF4 + dw BTGreetingF5 + dw BTGreetingF6 + dw BTGreetingF7 + dw BTGreetingF8 + dw BTGreetingF9 + dw BTGreetingF10 + dw BTGreetingF11 + dw BTGreetingF12 + dw BTGreetingF13 + dw BTGreetingF14 + dw BTGreetingF15 + +.PlayerLost: ; 11f3f2 + dw BTLossF1 + dw BTLossF2 + dw BTLossF3 + dw BTLossF4 + dw BTLossF5 + dw BTLossF6 + dw BTLossF7 + dw BTLossF8 + dw BTLossF9 + dw BTLossF10 + dw BTLossF11 + dw BTLossF12 + dw BTLossF13 + dw BTLossF14 + dw BTLossF15 + +.PlayerWon: ; 11f410 + dw BTWinF1 + dw BTWinF2 + dw BTWinF3 + dw BTWinF4 + dw BTWinF5 + dw BTWinF6 + dw BTWinF7 + dw BTWinF8 + dw BTWinF9 + dw BTWinF10 + dw BTWinF11 + dw BTWinF12 + dw BTWinF13 + dw BTWinF14 + dw BTWinF15 + + +BTGreetingM1: ; 0x11f42e + text_jump BattleTowerText_0x1ec000 + db "@" + +BTLossM1: ; 0x11f433 + text_jump BattleTowerText_0x1ec03b + db "@" + +BTWinM1: ; 0x11f438 + text_jump UnknownText_0x1ec060 + db "@" + +BTGreetingM2: ; 0x11f43d + text_jump BattleTowerText_0x1ec080 + db "@" + +BTLossM2: ; 0x11f442 + text_jump UnknownText_0x1ec0a3 + db "@" + +BTWinM2: ; 0x11f447 + text_jump UnknownText_0x1ec0c4 + db "@" + +BTGreetingM3: ; 0x11f44c + text_jump UnknownText_0x1ec0e1 + db "@" + +BTLossM3: ; 0x11f451 + text_jump UnknownText_0x1ec108 + db "@" + +BTWinM3: ; 0x11f456 + text_jump UnknownText_0x1ec12a + db "@" + +BTGreetingM4: ; 0x11f45b + text_jump UnknownText_0x1ec14d + db "@" + +BTLossM4: ; 0x11f460 + text_jump UnknownText_0x1ec16f + db "@" + +BTWinM4: ; 0x11f465 + text_jump UnknownText_0x1ec190 + db "@" + +BTGreetingM5: ; 0x11f46a + text_jump UnknownText_0x1ec1ae + db "@" + +BTLossM5: ; 0x11f46f + text_jump UnknownText_0x1ec1d0 + db "@" + +BTWinM5: ; 0x11f474 + text_jump UnknownText_0x1ec1f4 + db "@" + +BTGreetingM6: ; 0x11f479 + text_jump UnknownText_0x1ec216 + db "@" + +BTLossM6: ; 0x11f47e + text_jump UnknownText_0x1ec238 + db "@" + +BTWinM6: ; 0x11f483 + text_jump UnknownText_0x1ec259 + db "@" + +BTGreetingM7: ; 0x11f488 + text_jump UnknownText_0x1ec27b + db "@" + +BTLossM7: ; 0x11f48d + text_jump UnknownText_0x1ec2a0 + db "@" + +BTWinM7: ; 0x11f492 + text_jump UnknownText_0x1ec2c0 + db "@" + +BTGreetingM8: ; 0x11f497 + text_jump UnknownText_0x1ec2d9 + db "@" + +BTLossM8: ; 0x11f49c + text_jump UnknownText_0x1ec2fe + db "@" + +BTWinM8: ; 0x11f4a1 + text_jump UnknownText_0x1ec320 + db "@" + +BTGreetingM9: ; 0x11f4a6 + text_jump UnknownText_0x1ec33f + db "@" + +BTLossM9: ; 0x11f4ab + text_jump UnknownText_0x1ec36c + db "@" + +BTWinM9: ; 0x11f4b0 + text_jump UnknownText_0x1ec389 + db "@" + +BTGreetingM10: ; 0x11f4b5 + text_jump UnknownText_0x1ec3ad + db "@" + +BTLossM10: ; 0x11f4ba + text_jump UnknownText_0x1ec3c5 + db "@" + +BTWinM10: ; 0x11f4bf + text_jump UnknownText_0x1ec3e5 + db "@" + +BTGreetingM11: ; 0x11f4c4 + text_jump UnknownText_0x1ec402 + db "@" + +BTLossM11: ; 0x11f4c9 + text_jump UnknownText_0x1ec411 + db "@" + +BTWinM11: ; 0x11f4ce + text_jump UnknownText_0x1ec41f + db "@" + +BTGreetingM12: ; 0x11f4d3 + text_jump UnknownText_0x1ec42e + db "@" + +BTLossM12: ; 0x11f4d8 + text_jump UnknownText_0x1ec461 + db "@" + +BTWinM12: ; 0x11f4dd + text_jump UnknownText_0x1ec4a0 + db "@" + +BTGreetingM13: ; 0x11f4e2 + text_jump UnknownText_0x1ec4d6 + db "@" + +BTLossM13: ; 0x11f4e7 + text_jump UnknownText_0x1ec4f5 + db "@" + +BTWinM13: ; 0x11f4ec + text_jump UnknownText_0x1ec512 + db "@" + +BTGreetingM14: ; 0x11f4f1 + text_jump UnknownText_0x1ec532 + db "@" + +BTLossM14: ; 0x11f4f6 + text_jump UnknownText_0x1ec54b + db "@" + +BTWinM14: ; 0x11f4fb + text_jump UnknownText_0x1ec565 + db "@" + +BTGreetingM15: ; 0x11f500 + text_jump UnknownText_0x1ec580 + db "@" + +BTLossM15: ; 0x11f505 + text_jump UnknownText_0x1ec59d + db "@" + +BTWinM15: ; 0x11f50a + text_jump UnknownText_0x1ec5b5 + db "@" + +BTGreetingM16: ; 0x11f50f + text_jump UnknownText_0x1ec5d3 + db "@" + +BTLossM16: ; 0x11f514 + text_jump UnknownText_0x1ec5ee + db "@" + +BTWinM16: ; 0x11f519 + text_jump UnknownText_0x1ec60d + db "@" + +BTGreetingM17: ; 0x11f51e + text_jump UnknownText_0x1ec631 + db "@" + +BTLossM17: ; 0x11f523 + text_jump UnknownText_0x1ec651 + db "@" + +BTWinM17: ; 0x11f528 + text_jump UnknownText_0x1ec68f + db "@" + +BTGreetingM18: ; 0x11f52d + text_jump UnknownText_0x1ec6b1 + db "@" + +BTLossM18: ; 0x11f532 + text_jump UnknownText_0x1ec6d0 + db "@" + +BTWinM18: ; 0x11f537 + text_jump UnknownText_0x1ec708 + db "@" + +BTGreetingM19: ; 0x11f53c + text_jump UnknownText_0x1ec720 + db "@" + +BTLossM19: ; 0x11f541 + text_jump UnknownText_0x1ec73e + db "@" + +BTWinM19: ; 0x11f546 + text_jump UnknownText_0x1ec75b + db "@" + +BTGreetingM20: ; 0x11f54b + text_jump UnknownText_0x1ec77f + db "@" + +BTLossM20: ; 0x11f550 + text_jump UnknownText_0x1ec798 + db "@" + +BTWinM20: ; 0x11f555 + text_jump UnknownText_0x1ec7bb + db "@" + +BTGreetingM21: ; 0x11f55a + text_jump UnknownText_0x1ec7d8 + db "@" + +BTLossM21: ; 0x11f55f + text_jump UnknownText_0x1ec818 + db "@" + +BTWinM21: ; 0x11f564 + text_jump UnknownText_0x1ec837 + db "@" + +BTGreetingM22: ; 0x11f569 + text_jump UnknownText_0x1ec858 + db "@" + +BTLossM22: ; 0x11f56e + text_jump UnknownText_0x1ec876 + db "@" + +BTWinM22: ; 0x11f573 + text_jump UnknownText_0x1ec898 + db "@" + +BTGreetingM23: ; 0x11f578 + text_jump UnknownText_0x1ec8b1 + db "@" + +BTLossM23: ; 0x11f57d + text_jump UnknownText_0x1ec8d5 + db "@" + +BTWinM23: ; 0x11f582 + text_jump UnknownText_0x1ec8f0 + db "@" + +BTGreetingM24: ; 0x11f587 + text_jump UnknownText_0x1ec911 + db "@" + +BTLossM24: ; 0x11f58c + text_jump UnknownText_0x1ec928 + db "@" + +BTWinM24: ; 0x11f591 + text_jump UnknownText_0x1ec949 + db "@" + +BTGreetingM25: ; 0x11f596 + text_jump UnknownText_0x1ec969 + db "@" + +BTLossM25: ; 0x11f59b + text_jump UnknownText_0x1ec986 + db "@" + +BTWinM25: ; 0x11f5a0 + text_jump UnknownText_0x1ec99b + db "@" + + + + +BTGreetingF1: ; 0x11f5a5 + text_jump UnknownText_0x1ec9bd + db "@" + +BTLossF1: ; 0x11f5aa + text_jump UnknownText_0x1ec9d9 + db "@" + +BTWinF1: ; 0x11f5af + text_jump UnknownText_0x1ec9f7 + db "@" + +BTGreetingF2: ; 0x11f5b4 + text_jump UnknownText_0x1eca0a + db "@" + +BTLossF2: ; 0x11f5b9 + text_jump UnknownText_0x1eca2a + db "@" + +BTWinF2: ; 0x11f5be + text_jump UnknownText_0x1eca47 + db "@" + +BTGreetingF3: ; 0x11f5c3 + text_jump UnknownText_0x1eca64 + db "@" + +BTLossF3: ; 0x11f5c8 + text_jump UnknownText_0x1eca82 + db "@" + +BTWinF3: ; 0x11f5cd + text_jump UnknownText_0x1eca9d + db "@" + +BTGreetingF4: ; 0x11f5d2 + text_jump UnknownText_0x1ecabf + db "@" + +BTLossF4: ; 0x11f5d7 + text_jump UnknownText_0x1ecade + db "@" + +BTWinF4: ; 0x11f5dc + text_jump UnknownText_0x1ecafa + db "@" + +BTGreetingF5: ; 0x11f5e1 + text_jump UnknownText_0x1ecb19 + db "@" + +BTLossF5: ; 0x11f5e6 + text_jump UnknownText_0x1ecb37 + db "@" + +BTWinF5: ; 0x11f5eb + text_jump UnknownText_0x1ecb55 + db "@" + +BTGreetingF6: ; 0x11f5f0 + text_jump UnknownText_0x1ecb70 + db "@" + +BTLossF6: ; 0x11f5f5 + text_jump UnknownText_0x1ecb92 + db "@" + +BTWinF6: ; 0x11f5fa + text_jump UnknownText_0x1ecbb6 + db "@" + +BTGreetingF7: ; 0x11f5ff + text_jump UnknownText_0x1ecbd9 + db "@" + +BTLossF7: ; 0x11f604 + text_jump UnknownText_0x1ecbf3 + db "@" + +BTWinF7: ; 0x11f609 + text_jump UnknownText_0x1ecc15 + db "@" + +BTGreetingF8: ; 0x11f60e + text_jump UnknownText_0x1ecc39 + db "@" + +BTLossF8: ; 0x11f613 + text_jump UnknownText_0x1ecc55 + db "@" + +BTWinF8: ; 0x11f618 + text_jump UnknownText_0x1ecc75 + db "@" + +BTGreetingF9: ; 0x11f61d + text_jump UnknownText_0x1ecc92 + db "@" + +BTLossF9: ; 0x11f622 + text_jump UnknownText_0x1ecca7 + db "@" + +BTWinF9: ; 0x11f627 + text_jump UnknownText_0x1eccc1 + db "@" + +BTGreetingF10: ; 0x11f62c + text_jump UnknownText_0x1eccd7 + db "@" + +BTLossF10: ; 0x11f631 + text_jump UnknownText_0x1eccef + db "@" + +BTWinF10: ; 0x11f636 + text_jump UnknownText_0x1ecd0e + db "@" + +BTGreetingF11: ; 0x11f63b + text_jump UnknownText_0x1ecd2b + db "@" + +BTLossF11: ; 0x11f640 + text_jump UnknownText_0x1ecd4d + db "@" + +BTWinF11: ; 0x11f645 + text_jump UnknownText_0x1ecd6b + db "@" + +BTGreetingF12: ; 0x11f64a + text_jump UnknownText_0x1ecd8d + db "@" + +BTLossF12: ; 0x11f64f + text_jump UnknownText_0x1ecdaf + db "@" + +BTWinF12: ; 0x11f654 + text_jump UnknownText_0x1ecdcf + db "@" + +BTGreetingF13: ; 0x11f659 + text_jump UnknownText_0x1ecded + db "@" + +BTLossF13: ; 0x11f65e + text_jump UnknownText_0x1ece0d + db "@" + +BTWinF13: ; 0x11f663 + text_jump UnknownText_0x1ece2a + db "@" + +BTGreetingF14: ; 0x11f668 + text_jump UnknownText_0x1ece4b + db "@" + +BTLossF14: ; 0x11f66d + text_jump UnknownText_0x1ece70 + db "@" + +BTWinF14: ; 0x11f672 + text_jump UnknownText_0x1ece8a + db "@" + +BTGreetingF15: ; 0x11f677 + text_jump UnknownText_0x1ecea8 + db "@" + +BTLossF15: ; 0x11f67c + text_jump UnknownText_0x1ecec9 + db "@" + +BTWinF15: ; 0x11f681 + text_jump UnknownText_0x1ecee8 + db "@" diff --git a/engine/events/battle_tower_rules.asm b/engine/events/battle_tower_rules.asm deleted file mode 100644 index de6022145..000000000 --- a/engine/events/battle_tower_rules.asm +++ /dev/null @@ -1,342 +0,0 @@ -CheckForMobileBattleRules: ; 8b1e1 - ld de, .PointerTables - call BattleTower_ExecuteJumptable - ret z - call BattleTower_PleaseReturnWhenReady - scf - ret -; 8b1ed - -.PointerTables: ; 8b1ed - db 2 - dw .Functions - dw .TextPointers - -.Functions: ; 8b1f2 - dw BattleTower_CheckPartyLengthIs3 - dw BattleTower_CheckPartyHasThreeMonsThatAreNotEggs -; 8b1f6 - -.TextPointers: ; 8b1f6 - dw .ExcuseMeText - dw JumpText_NeedAtLeastThreeMon - dw JumpText_EggDoesNotQualify -; 8b1fc - -.ExcuseMeText: ; 0x8b1fc - ; Excuse me! - text_jump UnknownText_0x1c5937 - db "@" -; 0x8b201 - -CheckForBattleTowerRules: ; 8b201 - ld hl, StringBuffer2 - ld [hl], "3" - inc hl - ld [hl], "@" - ld de, .PointerTables - call BattleTower_ExecuteJumptable - ret z - call BattleTower_PleaseReturnWhenReady - scf - ret -; 8b215 - -.PointerTables: ; 8b215 - db 4 - dw .Functions - dw .TextPointers - -.Functions: ; 8b21a - dw Function_PartyCountEq3 - dw Function_PartySpeciesAreUnique - dw Function_PartyItemsAreUnique - dw Function_HasPartyAnEgg -; 8b222 - -.TextPointers: ; 8b222 - dw JumpText_ExcuseMeYoureNotReady - dw JumpText_OnlyThreePkmnMayBeEntered - dw JumpText_ThePkmnMustAllBeDifferentKinds - dw JumpText_ThePkmnMustNotHoldTheSameItems - dw JumpText_YouCantTakeAnEgg -; 8b22c - -JumpText_ExcuseMeYoureNotReady: ; 0x8b22c - ; Excuse me. You're not ready. - text_jump Text_ExcuseMeYoureNotReady - db "@" -; 0x8b231 - -BattleTower_PleaseReturnWhenReady: ; 8b231 - ld hl, .PleaseReturnWhenReady - call PrintText - ret -; 8b238 - -.PleaseReturnWhenReady: ; 0x8b238 - ; Please return when you're ready. - text_jump UnknownText_0x1c5962 - db "@" -; 0x8b23d - -JumpText_NeedAtLeastThreeMon: ; 0x8b23d - ; You need at least three #MON. - text_jump UnknownText_0x1c5983 - db "@" -; 0x8b242 - -JumpText_EggDoesNotQualify: ; 0x8b242 - ; Sorry, an EGG doesn't qualify. - text_jump UnknownText_0x1c59a3 - db "@" -; 0x8b247 - -JumpText_OnlyThreePkmnMayBeEntered: ; 0x8b247 - ; Only three #MON may be entered. - text_jump Text_OnlyThreePkmnMayBeEntered - db "@" -; 0x8b24c - -JumpText_ThePkmnMustAllBeDifferentKinds: ; 0x8b24c - ; The @ #MON must all be different kinds. - text_jump Text_ThePkmnMustAllBeDifferentKinds - db "@" -; 0x8b251 - -JumpText_ThePkmnMustNotHoldTheSameItems: ; 0x8b251 - ; The @ #MON must not hold the same items. - text_jump Text_ThePkmnMustNotHoldTheSameItems - db "@" -; 0x8b256 - -JumpText_YouCantTakeAnEgg: ; 0x8b256 - ; You can't take an EGG! - text_jump Text_YouCantTakeAnEgg - db "@" -; 0x8b25b - -BattleTower_ExecuteJumptable: ; 8b25b - ld bc, 0 -.loop - call .DoJumptableFunction - call c, .PrintFailureText - call .Next_CheckReachedEnd - jr nz, .loop - ld a, b - and a - ret -; 8b26c - -.DoJumptableFunction: ; 8b26c - push de - push bc - call .GetFunctionPointer - ld a, c - rst JumpTable - pop bc - pop de - ret -; 8b276 - -.Next_CheckReachedEnd: ; 8b276 - inc c - ld a, [de] - cp c - ret -; 8b27a - -.GetFunctionPointer: ; 8b27a - inc de - ld a, [de] - ld l, a - inc de - ld a, [de] - ld h, a - ret -; 8b281 - -.GetTextPointers: ; 8b281 - inc de - inc de - inc de - ld a, [de] - ld l, a - inc de - ld a, [de] - ld h, a - ret -; 8b28a - -.LoadTextPointer: ; 8b28a - ld a, [hli] - ld h, [hl] - ld l, a - ret -; 8b28e - -.PrintFailureText: ; 8b28e - push de - push bc - ld a, b - and a - call z, .PrintFirstText - pop bc - call .PrintNthText - ld b, $1 - pop de - ret -; 8b29d - -.PrintFirstText: ; 8b29d - push de - call .GetTextPointers - call .LoadTextPointer - call PrintText - pop de - ret -; 8b2a9 - -.PrintNthText: ; 8b2a9 - push bc - call .GetTextPointers - inc hl - inc hl - ld b, $0 - add hl, bc - add hl, bc - call .LoadTextPointer - call PrintText - pop bc - ret -; 8b2bb - -BattleTower_CheckPartyLengthIs3: ; 8b2bb - ld a, [PartyCount] - cp 3 - ret -; 8b2c1 - -BattleTower_CheckPartyHasThreeMonsThatAreNotEggs: ; 8b2c1 - ld hl, PartyCount - ld a, [hli] - ld b, $0 - ld c, a -.loop - ld a, [hli] - cp EGG - jr z, .egg - inc b - -.egg - dec c - jr nz, .loop - ld a, [PartyCount] - cp b - ret z - ld a, b - cp 3 - ret -; 8b2da - -Function_PartyCountEq3: ; 8b2da - ld a, [PartyCount] - cp 3 - ret z - scf - ret -; 8b2e2 - -Function_PartySpeciesAreUnique: ; 8b2e2 - ld hl, PartyMon1Species - call VerifyUniqueness - ret -; 8b2e9 - -VerifyUniqueness: ; 8b2e9 - ld de, PartyCount - ld a, [de] - inc de - dec a - jr z, .done - ld b, a -.loop - push hl - push de - ld c, b - call .isegg - jr z, .next - ld a, [hl] - and a - jr z, .next -.loop2 - call .nextmon - call .isegg - jr z, .next2 - cp [hl] - jr z, .gotcha - -.next2 - dec c - jr nz, .loop2 - -.next - pop de - pop hl - call .nextmon - dec b - jr nz, .loop - -.done - and a - ret - -.gotcha - pop de - pop hl - scf - ret -; 8b31a - -.nextmon ; 8b31a - push bc - ld bc, PARTYMON_STRUCT_LENGTH - add hl, bc - inc de - pop bc - ret -; 8b322 - -.isegg ; 8b322 - push bc - ld b, a - ld a, [de] - cp EGG - ld a, b - pop bc - ret -; 8b32a - -Function_PartyItemsAreUnique: ; 8b32a - ld hl, PartyMon1Item - call VerifyUniqueness - ret -; 8b331 - -Function_HasPartyAnEgg: ; 8b331 - ld hl, PartyCount - ld a, [hli] - ld c, a -.loop - ld a, [hli] - cp EGG - jr z, .found - dec c - jr nz, .loop - and a - ret - -.found - scf - ret -; 8b342 -- cgit v1.2.3 From 2c789b64b1bfa9ec33d805d06ad3a7141e3871f1 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Sun, 7 Jan 2018 11:53:20 +0100 Subject: Predef_FlagAction -> Predef_SmallFarFlagAction --- engine/battle/ai/move.asm | 2 +- engine/battle/core.asm | 14 +++++++------- engine/evolve.asm | 2 +- engine/item_effects.asm | 4 ++-- engine/link.asm | 2 +- engine/move_mon.asm | 4 ++-- engine/mystery_gift.asm | 6 +++--- engine/npctrade.asm | 2 +- engine/pokegear.asm | 2 +- engine/predef.asm | 2 +- engine/routines/flagpredef.asm | 4 ++-- engine/tmhm.asm | 2 +- 12 files changed, 23 insertions(+), 23 deletions(-) (limited to 'engine') diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm index ead0fd5fa..b4550383a 100755 --- a/engine/battle/ai/move.asm +++ b/engine/battle/ai/move.asm @@ -92,7 +92,7 @@ AIChooseMove: ; 440ce push bc ld d, BANK(TrainerClassAttributes) - predef Predef_FlagAction + predef Predef_SmallFarFlagAction ld d, c pop bc diff --git a/engine/battle/core.asm b/engine/battle/core.asm index ff415bc75..7702a0681 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -2760,7 +2760,7 @@ PlayerMonFaintHappinessMod: ; 3d1aa ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG - predef Predef_FlagAction + predef Predef_SmallFarFlagAction ld hl, EnemySubStatus3 res SUBSTATUS_IN_LOOP, [hl] xor a @@ -3357,10 +3357,10 @@ AddBattleParticipant: ; 3d581 ld hl, wBattleParticipantsNotFainted ld b, SET_FLAG push bc - predef Predef_FlagAction + predef Predef_SmallFarFlagAction pop bc ld hl, wBattleParticipantsIncludingFainted - predef_jump Predef_FlagAction + predef_jump Predef_SmallFarFlagAction ; 3d599 FindPkmnInOTPartyToSwitchIntoBattle: ; 3d599 @@ -4350,7 +4350,7 @@ PursuitSwitch: ; 3dc5b ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG - predef Predef_FlagAction + predef Predef_SmallFarFlagAction call PlayerMonFaintedAnimation ld hl, BattleText_PkmnFainted jr .done_fainted @@ -6631,7 +6631,7 @@ LoadEnemyMon: ; 3e8eb ld c, a ld b, SET_FLAG ld hl, PokedexSeen - predef Predef_FlagAction + predef Predef_SmallFarFlagAction ld hl, EnemyMonStats ld de, EnemyStats @@ -7313,7 +7313,7 @@ GiveExperiencePoints: ; 3ee3b ld c, a ld b, CHECK_FLAG ld d, $0 - predef Predef_FlagAction + predef Predef_SmallFarFlagAction ld a, c and a pop bc @@ -7642,7 +7642,7 @@ GiveExperiencePoints: ; 3ee3b ld a, [CurPartyMon] ld c, a ld b, SET_FLAG - predef Predef_FlagAction + predef Predef_SmallFarFlagAction pop af ld [CurPartyLevel], a diff --git a/engine/evolve.asm b/engine/evolve.asm index dbe1db5af..877dd9031 100755 --- a/engine/evolve.asm +++ b/engine/evolve.asm @@ -621,7 +621,7 @@ ShiftMoves: ; 4256e EvoFlagAction: ; 42577 push de ld d, $0 - predef Predef_FlagAction + predef Predef_SmallFarFlagAction pop de ret ; 42581 diff --git a/engine/item_effects.asm b/engine/item_effects.asm index 7ce84a57a..5f346496e 100644 --- a/engine/item_effects.asm +++ b/engine/item_effects.asm @@ -1668,7 +1668,7 @@ RevivePokemon: ; f0d6 ld d, 0 ld hl, wBattleParticipantsIncludingFainted ld b, CHECK_FLAG - predef Predef_FlagAction + predef Predef_SmallFarFlagAction ld a, c and a jr z, .skip_to_revive @@ -1677,7 +1677,7 @@ RevivePokemon: ; f0d6 ld c, a ld hl, wBattleParticipantsNotFainted ld b, SET_FLAG - predef Predef_FlagAction + predef Predef_SmallFarFlagAction .skip_to_revive xor a diff --git a/engine/link.asm b/engine/link.asm index 94e7f2458..426a43a23 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -2584,7 +2584,7 @@ Unreferenced_Function29fe4: call GetSRAMBank ld d, $0 ld b, CHECK_FLAG - predef Predef_FlagAction + predef Predef_SmallFarFlagAction call CloseSRAM ld a, c and a diff --git a/engine/move_mon.asm b/engine/move_mon.asm index 658d57611..426a3ba8b 100755 --- a/engine/move_mon.asm +++ b/engine/move_mon.asm @@ -1119,7 +1119,7 @@ Predef_GiveEgg:: ; df8c ld d, $0 ld hl, PokedexCaught ld b, RESET_FLAG - predef Predef_FlagAction + predef Predef_SmallFarFlagAction .skip_caught_flag ; If we haven't seen this Pokemon before receiving @@ -1135,7 +1135,7 @@ Predef_GiveEgg:: ; df8c ld d, $0 ld hl, PokedexSeen ld b, RESET_FLAG - predef Predef_FlagAction + predef Predef_SmallFarFlagAction .skip_seen_flag pop af diff --git a/engine/mystery_gift.asm b/engine/mystery_gift.asm index 27ffd97b0..a1518352f 100755 --- a/engine/mystery_gift.asm +++ b/engine/mystery_gift.asm @@ -1117,7 +1117,7 @@ MysteryGift_CheckAndSetDecorationAlreadyReceived: ; 105069 (41:5069) ld d, $0 ld b, CHECK_FLAG ld hl, sMysteryGiftDecorationsReceived - predef_id Predef_FlagAction + predef_id Predef_SmallFarFlagAction push hl push bc call Predef @@ -1129,7 +1129,7 @@ MysteryGift_CheckAndSetDecorationAlreadyReceived: ; 105069 (41:5069) ret nz call GetMysteryGiftBank ld b, SET_FLAG - predef Predef_FlagAction + predef Predef_SmallFarFlagAction call CloseSRAM xor a ret @@ -1142,7 +1142,7 @@ MysteryGift_CopyReceivedDecosToPC: ; 105091 (41:5091) ld d, $0 ld b, CHECK_FLAG ld hl, sMysteryGiftDecorationsReceived - predef Predef_FlagAction + predef Predef_SmallFarFlagAction ld a, c and a pop bc diff --git a/engine/npctrade.asm b/engine/npctrade.asm index 25d47e6be..bd77f21c3 100755 --- a/engine/npctrade.asm +++ b/engine/npctrade.asm @@ -109,7 +109,7 @@ TradeFlagAction: ; fcc4a ld hl, wTradeFlags ld a, [wJumptableIndex] ld c, a - predef Predef_FlagAction + predef Predef_SmallFarFlagAction ld a, c and a ret diff --git a/engine/pokegear.asm b/engine/pokegear.asm index 18f86c1b6..cf58da8bf 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -2331,7 +2331,7 @@ HasVisitedSpawn: ; 91c50 ld hl, wVisitedSpawns ld b, CHECK_FLAG ld d, 0 - predef Predef_FlagAction + predef Predef_SmallFarFlagAction ld a, c ret diff --git a/engine/predef.asm b/engine/predef.asm index 749084288..62ca7b147 100644 --- a/engine/predef.asm +++ b/engine/predef.asm @@ -33,7 +33,7 @@ PredefPointers:: ; 856b add_predef Predef_LearnMove ; $0 add_predef DummyPredef1 add_predef HealParty ; this is both a special and a predef - add_predef Predef_FlagAction + add_predef Predef_SmallFarFlagAction add_predef Predef_ComputeHPBarPixels add_predef Predef_FillPP add_predef Predef_TryAddMonToParty diff --git a/engine/routines/flagpredef.asm b/engine/routines/flagpredef.asm index 5b19950a1..676960c31 100644 --- a/engine/routines/flagpredef.asm +++ b/engine/routines/flagpredef.asm @@ -1,5 +1,5 @@ -Predef_FlagAction: ; 4d7c1 -; Perform action b on flag c in flag array hl. +Predef_SmallFarFlagAction: ; 4d7c1 +; Perform action b on bit c in flag array hl. ; If checking a flag, check flag array d:hl unless d is 0. ; For longer flag arrays, see FlagAction. diff --git a/engine/tmhm.asm b/engine/tmhm.asm index 1b4456c88..11f692cb6 100755 --- a/engine/tmhm.asm +++ b/engine/tmhm.asm @@ -23,7 +23,7 @@ Predef_CanLearnTMHMMove: ; 11639 ld b, CHECK_FLAG push de ld d, 0 - predef Predef_FlagAction + predef Predef_SmallFarFlagAction pop de ret -- cgit v1.2.3 From d6f20ae74619fa4b3071867016fa7ae7253df98f Mon Sep 17 00:00:00 2001 From: Adelaide Walter Date: Mon, 8 Jan 2018 17:13:37 -0500 Subject: Use BANK for hardcoded SRAM banks (except for vestigial refs to JP's banks 4-7) --- engine/battle/checkbattlescene.asm | 2 +- engine/battle/core.asm | 2 +- engine/billspc.asm | 2 +- engine/mail_2.asm | 2 +- engine/menu.asm | 4 ++-- engine/mon_stats.asm | 2 +- engine/mystery_gift.asm | 2 +- engine/routines/emptyallsrambanks.asm | 8 ++++---- engine/rtc.asm | 2 +- engine/save.asm | 8 ++++---- 10 files changed, 17 insertions(+), 17 deletions(-) (limited to 'engine') diff --git a/engine/battle/checkbattlescene.asm b/engine/battle/checkbattlescene.asm index 5253c3c47..24d06b8c9 100644 --- a/engine/battle/checkbattlescene.asm +++ b/engine/battle/checkbattlescene.asm @@ -19,7 +19,7 @@ CheckBattleScene: ; 4ea44 and a jr nz, .from_wram - ld a, $4 + ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank ld a, [$a60c] ld c, a diff --git a/engine/battle/core.asm b/engine/battle/core.asm index bac39e76f..7649eba84 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -232,7 +232,7 @@ BattleTurn: ; 3c12f ; 3c1bf MobileFn_3c1bf: mobile - ld a, $5 + ld a, 5 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank ld hl, $a89b ; s5_a89b inc [hl] diff --git a/engine/billspc.asm b/engine/billspc.asm index f94f495c6..3d1177f83 100755 --- a/engine/billspc.asm +++ b/engine/billspc.asm @@ -2104,7 +2104,7 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 ld hl, wBillsPC_BackupScrollPosition add [hl] ld [CurPartyMon], a - ld a, $1 + ld a, BANK(sBox) call GetSRAMBank ld hl, sBoxSpecies call CopySpeciesToTemp diff --git a/engine/mail_2.asm b/engine/mail_2.asm index d66bbbbd7..886ee6e6e 100755 --- a/engine/mail_2.asm +++ b/engine/mail_2.asm @@ -69,7 +69,7 @@ ReadAnyMail: ; b9237 ld h, d ld l, e push hl - ld a, $0 + ld a, BANK(sPartyMail) call GetSRAMBank ld de, sPartyMon1MailAuthorID - sPartyMon1Mail add hl, de diff --git a/engine/menu.asm b/engine/menu.asm index e5a5ed6c9..83ee69373 100755 --- a/engine/menu.asm +++ b/engine/menu.asm @@ -730,7 +730,7 @@ Function24423: ; 24423 ld a, [VramState] bit 0, a ret z - xor a + xor a ; effectively ld a, BANK(sScratch) call GetSRAMBank hlcoord 0, 0 ld de, sScratch @@ -738,7 +738,7 @@ Function24423: ; 24423 call CopyBytes call CloseSRAM call OverworldTextModeSwitch - xor a + xor a ; effectively ld a, BANK(sScratch) call GetSRAMBank ld hl, sScratch decoord 0, 0 diff --git a/engine/mon_stats.asm b/engine/mon_stats.asm index a3039eefd..dbaf635bb 100644 --- a/engine/mon_stats.asm +++ b/engine/mon_stats.asm @@ -174,7 +174,7 @@ GetGender: ; 50bdd ; sBoxMon data is read directly from SRAM. ld a, [MonType] cp BOXMON - ld a, 1 + ld a, BANK(sBox) call z, GetSRAMBank ; Attack DV diff --git a/engine/mystery_gift.asm b/engine/mystery_gift.asm index 67ce10168..9a8c41f91 100755 --- a/engine/mystery_gift.asm +++ b/engine/mystery_gift.asm @@ -1561,7 +1561,7 @@ Function10578c: ; 10578c (41:578c) ld a, [sCrystalData + 0] ld [de], a inc de - ld a, $4 + ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank ld hl, $a603 ld bc, $8 diff --git a/engine/routines/emptyallsrambanks.asm b/engine/routines/emptyallsrambanks.asm index aa4b28e0d..8b060f3ef 100644 --- a/engine/routines/emptyallsrambanks.asm +++ b/engine/routines/emptyallsrambanks.asm @@ -1,11 +1,11 @@ EmptyAllSRAMBanks: ; 4cf1f - ld a, $0 + ld a, 0 call .EmptyBank - ld a, $1 + ld a, 1 call .EmptyBank - ld a, $2 + ld a, 2 call .EmptyBank - ld a, $3 + ld a, 3 call .EmptyBank ret diff --git a/engine/rtc.asm b/engine/rtc.asm index dc49a9630..bed0fcda4 100755 --- a/engine/rtc.asm +++ b/engine/rtc.asm @@ -146,7 +146,7 @@ Function140ae: ; 140ae farcall ClearDailyTimers farcall Function170923 ; mobile - ld a, $5 + ld a, 5 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank ld a, [$aa8c] inc a diff --git a/engine/save.asm b/engine/save.asm index af24b4d2f..a869d903e 100644 --- a/engine/save.asm +++ b/engine/save.asm @@ -418,7 +418,7 @@ EraseHallOfFame: ; 14d06 Function14d18: ; 14d18 ; XXX ; copy .Data to SRA4:a007 - ld a, $4 + ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank ld hl, .Data ld de, $a007 @@ -454,7 +454,7 @@ SaveData: ; 14d68 Function14d6c: ; 14d6c ; XXX - ld a, $4 + ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank ld a, [$a60b] ld b, $0 @@ -471,7 +471,7 @@ Function14d6c: ; 14d6c Function14d83: ; 14d83 ; XXX - ld a, $4 + ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank xor a ld [$a60c], a @@ -482,7 +482,7 @@ Function14d83: ; 14d83 Function14d93: ; 14d93 ; XXX - ld a, $7 + ld a, 7 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank xor a ld [$a000], a -- cgit v1.2.3 From 94f32db7bc4a5e4e4d8837d3110d0876146783af Mon Sep 17 00:00:00 2001 From: Adelaide Walter Date: Mon, 8 Jan 2018 22:48:58 -0500 Subject: Document hardcoded SRAM addresses. --- engine/battle/checkbattlescene.asm | 2 +- engine/battle/core.asm | 2 +- engine/mystery_gift.asm | 4 ++-- engine/rtc.asm | 8 ++++---- engine/save.asm | 29 ++++++++++++++++++++--------- 5 files changed, 28 insertions(+), 17 deletions(-) (limited to 'engine') diff --git a/engine/battle/checkbattlescene.asm b/engine/battle/checkbattlescene.asm index 24d06b8c9..a33cc62e3 100644 --- a/engine/battle/checkbattlescene.asm +++ b/engine/battle/checkbattlescene.asm @@ -21,7 +21,7 @@ CheckBattleScene: ; 4ea44 ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank - ld a, [$a60c] + ld a, [$a60c] ; address of MBC30 bank ld c, a call CloseSRAM diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 7649eba84..6d4401946 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -234,7 +234,7 @@ BattleTurn: ; 3c12f MobileFn_3c1bf: mobile ld a, 5 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank - ld hl, $a89b ; s5_a89b + ld hl, $a89b ; address of MBC30 bank inc [hl] jr nz, .finish dec hl diff --git a/engine/mystery_gift.asm b/engine/mystery_gift.asm index 9a8c41f91..ec5cdecab 100755 --- a/engine/mystery_gift.asm +++ b/engine/mystery_gift.asm @@ -1563,10 +1563,10 @@ Function10578c: ; 10578c (41:578c) inc de ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank - ld hl, $a603 + ld hl, $a603 ; address of MBC30 bank ld bc, $8 call CopyBytes - ld hl, $a007 + ld hl, $a007 ; address of MBC30 bank ld bc, $c call CopyBytes call CloseSRAM diff --git a/engine/rtc.asm b/engine/rtc.asm index bed0fcda4..b44db1c7c 100755 --- a/engine/rtc.asm +++ b/engine/rtc.asm @@ -148,12 +148,12 @@ Function140ae: ; 140ae ; mobile ld a, 5 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank - ld a, [$aa8c] + ld a, [$aa8c] ; address of MBC30 bank inc a - ld [$aa8c], a - ld a, [$b2fa] + ld [$aa8c], a ; address of MBC30 bank + ld a, [$b2fa] ; address of MBC30 bank inc a - ld [$b2fa], a + ld [$b2fa], a ; address of MBC30 bank call CloseSRAM ret diff --git a/engine/save.asm b/engine/save.asm index a869d903e..12e5964b9 100644 --- a/engine/save.asm +++ b/engine/save.asm @@ -421,7 +421,7 @@ Function14d18: ; 14d18 ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank ld hl, .Data - ld de, $a007 + ld de, $a007 ; address of MBC30 bank ld bc, .DataEnd - .Data call CopyBytes jp CloseSRAM @@ -456,7 +456,7 @@ Function14d6c: ; 14d6c ; XXX ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank - ld a, [$a60b] + ld a, [$a60b] ; address of MBC30 bank ld b, $0 and a jr z, .ok @@ -464,7 +464,7 @@ Function14d6c: ; 14d6c .ok ld a, b - ld [$a60b], a + ld [$a60b], a ; address of MBC30 bank call CloseSRAM ret ; 14d83 @@ -474,8 +474,8 @@ Function14d83: ; 14d83 ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank xor a - ld [$a60c], a - ld [$a60d], a + ld [$a60c], a ; address of MBC30 bank + ld [$a60d], a ; address of MBC30 bank call CloseSRAM ret ; 14d93 @@ -485,7 +485,7 @@ Function14d93: ; 14d93 ld a, 7 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank xor a - ld [$a000], a + ld [$a000], a ; address of MBC30 bank call CloseSRAM ret ; 14da0 @@ -873,6 +873,11 @@ VerifyBackupChecksum: ; 1507c (5:507c) _SaveData: ; 1509a + ; This is called within two scenarios: + ; a) ErasePreviousSave (the process of erasing the save from a previous game file) + ; b) unused mobile functionality + ; It is not part of a regular save. + ld a, BANK(sCrystalData) call GetSRAMBank ld hl, wCrystalData @@ -880,7 +885,11 @@ _SaveData: ; 1509a ld bc, wCrystalDataEnd - wCrystalData call CopyBytes - ; XXX SRAM bank 7 + ; This block originally had some mobile functionality, but since we're still in + ; BANK(sCrystalData), it instead overwrites the sixteen EventFlags starting at 1:a603 with + ; garbage from wd479. This isn't an issue, since ErasePreviousSave is followed by a regular + ; save that unwrites the garbage. + ld hl, wd479 ld a, [hli] ld [$a60e + 0], a @@ -897,8 +906,10 @@ _LoadData: ; 150b9 ld de, wCrystalData ld bc, wCrystalDataEnd - wCrystalData call CopyBytes - - ; XXX SRAM bank 7 + + ; This block originally had some mobile functionality to mirror _SaveData above, but instead it + ; (harmlessly) writes the aforementioned EventFlags to the unused wd479. + ld hl, wd479 ld a, [$a60e + 0] ld [hli], a -- cgit v1.2.3 From 6c5cd7a963fb2b5eed109aeef25f041eabba0004 Mon Sep 17 00:00:00 2001 From: Adelaide Walter Date: Mon, 8 Jan 2018 23:07:46 -0500 Subject: Simplify comments per Rangi's rec. --- engine/battle_anims/anim_commands.asm | 6 +++--- engine/events/print_unown.asm | 2 +- engine/events/print_unown_2.asm | 2 +- engine/menu.asm | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'engine') diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index f3b2ee46d..16c101301 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -975,7 +975,7 @@ BattleAnimCmd_RaiseSub: ; cc640 (33:4640) push af ld a, 1 ; unnecessary bankswitch? ld [rSVBK], a - xor a ; effectively ld a, BANK(sScratch) + xor a ; sScratch call GetSRAMBank GetSubstitutePic: ; cc64c @@ -1049,7 +1049,7 @@ BattleAnimCmd_MinimizeOpp: ; cc6cf (33:46cf) push af ld a, 1 ; unnecessary bankswitch? ld [rSVBK], a - xor a ; effectively ld a, BANK(sScratch) + xor a ; sScratch call GetSRAMBank call GetMinimizePic call Request2bpp @@ -1105,7 +1105,7 @@ BattleAnimCmd_Minimize: ; cc735 (33:4735) push af ld a, 1 ; unnecessary bankswitch? ld [rSVBK], a - xor a ; effectively ld a, BANK(sScratch) + xor a ; sScratch call GetSRAMBank call GetMinimizePic ld hl, vTiles0 tile $00 diff --git a/engine/events/print_unown.asm b/engine/events/print_unown.asm index 3dfee282d..771d3ea5a 100644 --- a/engine/events/print_unown.asm +++ b/engine/events/print_unown.asm @@ -178,7 +178,7 @@ UnownPrinter: ; 16be4 hlcoord 1, 9 ld de, UnownDexVacantString call PlaceString - xor a ; effectively ld a, BANK(sScratch) + xor a ; sScratch call GetSRAMBank ld hl, sScratch ld bc, $31 tiles diff --git a/engine/events/print_unown_2.asm b/engine/events/print_unown_2.asm index 287ae7537..1e0b90fc5 100644 --- a/engine/events/print_unown_2.asm +++ b/engine/events/print_unown_2.asm @@ -1,7 +1,7 @@ RotateUnownFrontpic: ; e0000 ; something to do with Unown printer push de - xor a ; effectively ld a, BANK(sScratch) + xor a ; sScratch call GetSRAMBank ld hl, sScratch ld bc, 0 diff --git a/engine/menu.asm b/engine/menu.asm index 83ee69373..f04e82ca1 100755 --- a/engine/menu.asm +++ b/engine/menu.asm @@ -730,7 +730,7 @@ Function24423: ; 24423 ld a, [VramState] bit 0, a ret z - xor a ; effectively ld a, BANK(sScratch) + xor a ; sScratch call GetSRAMBank hlcoord 0, 0 ld de, sScratch @@ -738,7 +738,7 @@ Function24423: ; 24423 call CopyBytes call CloseSRAM call OverworldTextModeSwitch - xor a ; effectively ld a, BANK(sScratch) + xor a ; sScratch call GetSRAMBank ld hl, sScratch decoord 0, 0 -- cgit v1.2.3 From 31edd7f803a9df47d76469559065af96d78f1c7d Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 00:23:48 -0500 Subject: Move text/ into data/ --- engine/phone/buenas_password.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/phone/buenas_password.asm b/engine/phone/buenas_password.asm index 858ce5540..bfcd1604c 100644 --- a/engine/phone/buenas_password.asm +++ b/engine/phone/buenas_password.asm @@ -167,4 +167,4 @@ BuenaPhoneScript_Random1: end ; a0c28 -INCLUDE "text/phone/buena.asm" +INCLUDE "data/phone_text/buena.asm" -- cgit v1.2.3 From d0a8e8e7441a5ac4eee6e40cfeb6c3e77d6aace4 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 00:36:15 -0500 Subject: =?UTF-8?q?includes.asm=20=E2=86=92=20constants.asm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/credits.asm | 2 +- engine/events.asm | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/credits.asm b/engine/credits.asm index 3dddb4126..564422db3 100644 --- a/engine/credits.asm +++ b/engine/credits.asm @@ -1,4 +1,4 @@ -INCLUDE "includes.asm" +INCLUDE "constants.asm" SECTION "Credits", ROMX diff --git a/engine/events.asm b/engine/events.asm index 7356a8910..cff7c76ed 100644 --- a/engine/events.asm +++ b/engine/events.asm @@ -1,4 +1,5 @@ -INCLUDE "includes.asm" +INCLUDE "constants.asm" + SECTION "Events", ROMX -- cgit v1.2.3 From 459d5d31640334b88cc2d82bb1b2f794d13fcbfd Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 00:45:03 -0500 Subject: =?UTF-8?q?default=5Fnames.asm=20=E2=86=92=20player=5Fnames.asm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/player_gfx.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/player_gfx.asm b/engine/player_gfx.asm index 98a54684b..6170b29cc 100644 --- a/engine/player_gfx.asm +++ b/engine/player_gfx.asm @@ -71,7 +71,7 @@ ShowPlayerNamingChoices: ; 88297 call CloseWindow ret -INCLUDE "data/default_names.asm" +INCLUDE "data/player_names.asm" GetPlayerNameArray: ; 88318 This Function is never called ld hl, PlayerName -- cgit v1.2.3 From 05e5eaf12fbb422d56615f15c3481d1cf53ed17b Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 00:51:53 -0500 Subject: Eliminate version.asm (resolves #464) --- engine/scripting.asm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engine') diff --git a/engine/scripting.asm b/engine/scripting.asm index 9a89c375a..a64ab2bd8 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -1975,12 +1975,12 @@ GetVarAction: Script_checkver: ; script command 0x18 - ld a, [Version] + ld a, [.gs_version] ld [ScriptVar], a ret -Version: - db VERSION +.gs_version: + db GS_VERSION Script_pokenamemem: ; script command 0x40 -- cgit v1.2.3 From 2f741dfa03204d4a98988ee76b241edc90f5ffc4 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 01:02:29 -0500 Subject: Remove old Python class names from script command param doc comments --- engine/scripting.asm | 446 +++++++++++++++------------------------------------ 1 file changed, 128 insertions(+), 318 deletions(-) (limited to 'engine') diff --git a/engine/scripting.asm b/engine/scripting.asm index a64ab2bd8..ae9384fde 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -255,8 +255,7 @@ StopScript: Script_callasm: ; script command 0xe -; parameters: -; asm (AsmPointerParam) +; parameters: asm call GetScriptByte ld b, a @@ -270,8 +269,7 @@ Script_callasm: Script_special: ; script command 0xf -; parameters: -; predefined_script (MultiByteParam) +; parameters: predefined_script call GetScriptByte ld e, a @@ -282,8 +280,7 @@ Script_special: Script_ptcallasm: ; script command 0x10 -; parameters: -; asm (PointerToAsmPointerParam) +; parameters: asm call GetScriptByte ld l, a @@ -300,8 +297,7 @@ Script_ptcallasm: Script_jumptextfaceplayer: ; script command 0x51 -; parameters: -; text_pointer (RawTextPointerLabelParam) +; parameters: text_pointer ld a, [ScriptBank] ld [wScriptTextBank], a @@ -315,8 +311,7 @@ Script_jumptextfaceplayer: Script_jumptext: ; script command 0x53 -; parameters: -; text_pointer (RawTextPointerLabelParam) +; parameters: text_pointer ld a, [ScriptBank] ld [wScriptTextBank], a @@ -342,8 +337,7 @@ if _CRYSTAL Script_farjumptext: ; script command 0x52 -; parameters: -; text_pointer (PointerLabelBeforeBank) +; parameters: text_pointer call GetScriptByte ld [wScriptTextBank], a @@ -360,8 +354,7 @@ endc Script_writetext: ; script command 0x4c -; parameters: -; text_pointer (RawTextPointerLabelParam) +; parameters: text_pointer call GetScriptByte ld l, a @@ -374,8 +367,7 @@ Script_writetext: Script_farwritetext: ; script command 0x4b -; parameters: -; text_pointer (PointerLabelBeforeBank) +; parameters: text_pointer call GetScriptByte ld b, a @@ -388,9 +380,7 @@ Script_farwritetext: Script_repeattext: ; script command 0x4d -; parameters: -; byte (SingleByteParam) -; byte (SingleByteParam) +; parameters: byte, byte call GetScriptByte ld l, a @@ -444,8 +434,7 @@ Script_yesorno: Script_loadmenudata: ; script command 0x4f -; parameters: -; data (MenuDataPointerParam) +; parameters: data call GetScriptByte ld l, a @@ -466,8 +455,7 @@ Script_closewindow: Script_pokepic: ; script command 0x56 -; parameters: -; pokemon (PokemonParam) +; parameters: pokemon call GetScriptByte and a @@ -512,9 +500,7 @@ Script__2dmenu: Script_battletowertext: ; script command 0xa4 -; parameters: -; pointer (PointerLabelBeforeBank) -; memory (SingleByteParam) +; parameters: pointer, memory call SetUpTextBox call GetScriptByte @@ -524,9 +510,7 @@ Script_battletowertext: Script_verbosegiveitem: ; script command 0x9e -; parameters: -; item (ItemLabelByte) -; quantity (DecimalParam) +; parameters: item, quantity call Script_giveitem call CurItemName @@ -563,9 +547,7 @@ ReceivedItemText: Script_verbosegiveitem2: ; script command 0x9f -; parameters: -; item (ItemLabelByte) -; var (SingleByteParam) +; parameters: item, var call GetScriptByte cp -1 @@ -677,9 +659,7 @@ PocketIsFullText: Script_pokemart: ; script command 0x94 -; parameters: -; dialog_id (SingleByteParam) -; mart_id (MultiByteParam) +; parameters: dialog_id, mart_id call GetScriptByte ld c, a @@ -694,8 +674,7 @@ Script_pokemart: Script_elevator: ; script command 0x95 -; parameters: -; floor_list_pointer (PointerLabelParam) +; parameters: floor_list_pointer xor a ld [ScriptVar], a @@ -713,8 +692,7 @@ Script_elevator: Script_trade: ; script command 0x96 -; parameters: -; trade_id (SingleByteParam) +; parameters: trade_id call GetScriptByte ld e, a @@ -723,8 +701,7 @@ Script_trade: Script_phonecall: ; script command 0x98 -; parameters: -; caller_name (RawTextPointerLabelParam) +; parameters: caller_name call GetScriptByte ld e, a @@ -743,8 +720,7 @@ Script_hangup: Script_askforphonenumber: ; script command 0x97 -; parameters: -; number (SingleByteParam) +; parameters: number call YesNoBox jr c, .refused @@ -766,8 +742,7 @@ Script_askforphonenumber: Script_describedecoration: ; script command 0x9a -; parameters: -; byte (SingleByteParam) +; parameters: byte call GetScriptByte ld b, a @@ -778,8 +753,7 @@ Script_describedecoration: Script_fruittree: ; script command 0x9b -; parameters: -; tree_id (SingleByteParam) +; parameters: tree_id call GetScriptByte ld [CurFruitTree], a @@ -789,10 +763,7 @@ Script_fruittree: Script_swarm: ; script command 0xa0 -; parameters: -; flag (SingleByteParam) -; map_group (MapGroupParam) -; map_id (MapIdParam) +; parameters: flag, map_group, map_id call GetScriptByte ld c, a @@ -805,8 +776,7 @@ Script_swarm: Script_trainertext: ; script command 0x62 -; parameters: -; which_text (SingleByteParam) +; parameters: which_text call GetScriptByte ld c, a @@ -835,8 +805,7 @@ Script_scripttalkafter: Script_trainerflagaction: ; script command 0x63 -; parameters: -; action (SingleByteParam) +; parameters: action xor a ld [ScriptVar], a @@ -856,9 +825,7 @@ Script_trainerflagaction: Script_winlosstext: ; script command 0x64 -; parameters: -; win_text_pointer (TextPointerLabelParam) -; loss_text_pointer (TextPointerLabelParam) +; parameters: win_text_pointer, loss_text_pointer ld hl, wWinTextPointer call GetScriptByte @@ -908,8 +875,7 @@ Script_playmapmusic: Script_playmusic: ; script command 0x7f -; parameters: -; music_pointer (MultiByteParam) +; parameters: music_pointer ld de, MUSIC_NONE call PlayMusic @@ -925,9 +891,7 @@ Script_playmusic: Script_musicfadeout: ; script command 0x81 -; parameters: -; music (MultiByteParam) -; fadetime (SingleByteParam) +; parameters: music, fadetime call GetScriptByte ld [MusicFadeID], a @@ -940,8 +904,7 @@ Script_musicfadeout: Script_playsound: ; script command 0x85 -; parameters: -; sound_pointer (MultiByteParam) +; parameters: sound_pointer call GetScriptByte ld e, a @@ -965,8 +928,7 @@ Script_warpsound: Script_cry: ; script command 0x84 -; parameters: -; cry_id (MultiByteParam) +; parameters: cry_id call GetScriptByte push af @@ -989,8 +951,7 @@ GetScriptObject: Script_setlasttalked: ; script command 0x68 -; parameters: -; object id (SingleByteParam) +; parameters: object_id call GetScriptByte call GetScriptObject @@ -999,9 +960,7 @@ Script_setlasttalked: Script_applymovement: ; script command 0x69 -; parameters: -; object id (SingleByteParam) -; data (MovementPointerLabelParam) +; parameters: object_id, data call GetScriptByte call GetScriptObject @@ -1036,10 +995,9 @@ SetFlagsForMovement_2: ret Script_applymovement2: -; apply movement to last talked ; script command 0x6a -; parameters: -; data (MovementPointerLabelParam) +; parameters: data +; apply movement to last talked ld a, [hLastTalked] ld c, a @@ -1066,9 +1024,7 @@ Script_faceplayer: Script_faceobject: ; script command 0x6c -; parameters: -; object1 (SingleByteParam) -; object2 (SingleByteParam) +; parameters: object1, object2 call GetScriptByte call GetScriptObject @@ -1098,9 +1054,7 @@ Script_faceobject: Script_spriteface: ; script command 0x76 -; parameters: -; object id (SingleByteParam) -; facing (SingleByteParam) +; parameters: object_id, facing call GetScriptByte call GetScriptObject @@ -1163,9 +1117,7 @@ ApplyObjectFacing: Script_variablesprite: ; script command 0x6d -; parameters: -; byte (SingleByteParam) -; sprite (SingleByteParam) +; parameters: byte, sprite call GetScriptByte ld e, a @@ -1178,8 +1130,7 @@ Script_variablesprite: Script_appear: ; script command 0x6f -; parameters: -; object id (SingleByteParam) +; parameters: object_id call GetScriptByte call GetScriptObject @@ -1191,8 +1142,7 @@ Script_appear: Script_disappear: ; script command 0x6e -; parameters: -; object id (SingleByteParam) +; parameters: object_id call GetScriptByte call GetScriptObject @@ -1229,9 +1179,7 @@ ApplyEventActionAppearDisappear: Script_follow: ; script command 0x70 -; parameters: -; object2 (SingleByteParam) -; object1 (SingleByteParam) +; parameters: object2, object1 call GetScriptByte call GetScriptObject @@ -1250,10 +1198,7 @@ Script_stopfollow: Script_moveobject: ; script command 0x72 -; parameters: -; object id (SingleByteParam) -; x (SingleByteParam) -; y (SingleByteParam) +; parameters: object id, x, y call GetScriptByte call GetScriptObject @@ -1269,8 +1214,7 @@ Script_moveobject: Script_writeobjectxy: ; script command 0x73 -; parameters: -; object id (SingleByteParam) +; parameters: object_id call GetScriptByte call GetScriptObject @@ -1284,9 +1228,7 @@ Script_writeobjectxy: Script_follownotexact: ; script command 0x77 -; parameters: -; object2 (SingleByteParam) -; object1 (SingleByteParam) +; parameters: object2, object1 call GetScriptByte call GetScriptObject @@ -1299,8 +1241,7 @@ Script_follownotexact: Script_loademote: ; script command 0x74 -; parameters: -; bubble (SingleByteParam) +; parameters: bubble call GetScriptByte cp -1 @@ -1313,10 +1254,7 @@ Script_loademote: Script_showemote: ; script command 0x75 -; parameters: -; bubble (SingleByteParam) -; object id (SingleByteParam) -; time (DecimalParam) +; parameters: bubble, object_id, time call GetScriptByte ld [ScriptVar], a @@ -1352,8 +1290,7 @@ ShowEmoteScript: Script_earthquake: ; script command 0x78 -; parameters: -; param (DecimalParam) +; parameters: param ld hl, EarthquakeMovement ld de, wEarthquakeMovementDataBuffer @@ -1407,9 +1344,7 @@ Script_loadmemtrainer: Script_loadwildmon: ; script command 0x5d -; parameters: -; pokemon (PokemonParam) -; level (DecimalParam) +; parameters: pokemon, level ld a, (1 << 7) ld [wBattleScriptFlags], a @@ -1421,9 +1356,7 @@ Script_loadwildmon: Script_loadtrainer: ; script command 0x5e -; parameters: -; trainer_group (TrainerGroupParam) -; trainer_id (TrainerIdParam) +; parameters: trainer_group, trainer_id ld a, (1 << 7) | 1 ld [wBattleScriptFlags], a @@ -1445,8 +1378,7 @@ Script_startbattle: Script_catchtutorial: ; script command 0x61 -; parameters: -; byte (SingleByteParam) +; parameters: byte call GetScriptByte ld [BattleType], a @@ -1498,8 +1430,7 @@ Script_reloadmap: Script_scall: ; script command 0x0 -; parameters: -; pointer (ScriptPointerLabelParam) +; parameters: pointer ld a, [ScriptBank] ld b, a @@ -1511,8 +1442,7 @@ Script_scall: Script_farscall: ; script command 0x1 -; parameters: -; pointer (ScriptPointerLabelBeforeBank) +; parameters: pointer call GetScriptByte ld b, a @@ -1524,8 +1454,7 @@ Script_farscall: Script_ptcall: ; script command 0x2 -; parameters: -; pointer (PointerLabelToScriptPointer) +; parameters: pointer call GetScriptByte ld l, a @@ -1577,8 +1506,7 @@ CallCallback:: Script_jump: ; script command 0x3 -; parameters: -; pointer (ScriptPointerLabelParam) +; parameters: pointer call GetScriptByte ld l, a @@ -1590,8 +1518,7 @@ Script_jump: Script_farjump: ; script command 0x4 -; parameters: -; pointer (ScriptPointerLabelBeforeBank) +; parameters: pointer call GetScriptByte ld b, a @@ -1603,8 +1530,7 @@ Script_farjump: Script_ptjump: ; script command 0x5 -; parameters: -; pointer (PointerLabelToScriptPointer) +; parameters: pointer call GetScriptByte ld l, a @@ -1619,8 +1545,7 @@ Script_ptjump: Script_iffalse: ; script command 0x8 -; parameters: -; pointer (ScriptPointerLabelParam) +; parameters: pointer ld a, [ScriptVar] and a @@ -1629,8 +1554,7 @@ Script_iffalse: Script_iftrue: ; script command 0x9 -; parameters: -; pointer (ScriptPointerLabelParam) +; parameters: pointer ld a, [ScriptVar] and a @@ -1639,9 +1563,7 @@ Script_iftrue: Script_if_equal: ; script command 0x6 -; parameters: -; byte (SingleByteParam) -; pointer (ScriptPointerLabelParam) +; parameters: byte, pointer call GetScriptByte ld hl, ScriptVar @@ -1651,9 +1573,7 @@ Script_if_equal: Script_if_not_equal: ; script command 0x7 -; parameters: -; byte (SingleByteParam) -; pointer (ScriptPointerLabelParam) +; parameters: byte, pointer call GetScriptByte ld hl, ScriptVar @@ -1663,9 +1583,7 @@ Script_if_not_equal: Script_if_greater_than: ; script command 0xa -; parameters: -; byte (SingleByteParam) -; pointer (ScriptPointerLabelParam) +; parameters: byte, pointer ld a, [ScriptVar] ld b, a @@ -1676,9 +1594,7 @@ Script_if_greater_than: Script_if_less_than: ; script command 0xb -; parameters: -; byte (SingleByteParam) -; pointer (ScriptPointerLabelParam) +; parameters: byte, pointer call GetScriptByte ld b, a @@ -1689,16 +1605,14 @@ Script_if_less_than: Script_jumpstd: ; script command 0xc -; parameters: -; predefined_script (MultiByteParam) +; parameters: predefined_script call StdScript jr ScriptJump Script_callstd: ; script command 0xd -; parameters: -; predefined_script (MultiByteParam) +; parameters: predefined_script call StdScript ld d, h @@ -1738,8 +1652,7 @@ ScriptJump: Script_priorityjump: ; script command 0x8d -; parameters: -; pointer (ScriptPointerLabelParam) +; parameters: pointer ld a, [ScriptBank] ld [wPriorityScriptBank], a @@ -1766,9 +1679,7 @@ Script_checkscene: Script_checkmapscene: ; script command 0x11 -; parameters: -; map_group (SingleByteParam) -; map_id (SingleByteParam) +; parameters: map_group, map_id call GetScriptByte ld b, a @@ -1789,8 +1700,7 @@ Script_checkmapscene: Script_setscene: ; script command 0x14 -; parameters: -; scene_id (SingleByteParam) +; parameters: scene_id ld a, [MapGroup] ld b, a @@ -1800,10 +1710,7 @@ Script_setscene: Script_setmapscene: ; script command 0x12 -; parameters: -; map_group (MapGroupParam) -; map_id (MapIdParam) -; scene_id (SingleByteParam) +; parameters: map_group, map_id, scene_id call GetScriptByte ld b, a @@ -1821,8 +1728,7 @@ DoScene: Script_copybytetovar: ; script command 0x19 -; parameters: -; address (RAMAddressParam) +; parameters: address call GetScriptByte ld l, a @@ -1834,8 +1740,7 @@ Script_copybytetovar: Script_copyvartobyte: ; script command 0x1a -; parameters: -; address (RAMAddressParam) +; parameters: address call GetScriptByte ld l, a @@ -1847,9 +1752,7 @@ Script_copyvartobyte: Script_loadvar: ; script command 0x1b -; parameters: -; address (RAMAddressParam) -; value (SingleByteParam) +; parameters: address, value call GetScriptByte ld l, a @@ -1861,8 +1764,7 @@ Script_loadvar: Script_writebyte: ; script command 0x15 -; parameters: -; value (SingleByteParam) +; parameters: value call GetScriptByte ld [ScriptVar], a @@ -1870,8 +1772,7 @@ Script_writebyte: Script_addvar: ; script command 0x16 -; parameters: -; value (SingleByteParam) +; parameters: value call GetScriptByte ld hl, ScriptVar @@ -1881,8 +1782,7 @@ Script_addvar: Script_random: ; script command 0x17 -; parameters: -; input (SingleByteParam) +; parameters: input call GetScriptByte ld [ScriptVar], a @@ -1935,8 +1835,7 @@ Script_random: Script_checkcode: ; script command 0x1c -; parameters: -; variable_id (SingleByteParam) +; parameters: variable_id call GetScriptByte call GetVarAction @@ -1946,8 +1845,7 @@ Script_checkcode: Script_writevarcode: ; script command 0x1d -; parameters: -; variable_id (SingleByteParam) +; parameters: variable_id call GetScriptByte call GetVarAction @@ -1957,9 +1855,7 @@ Script_writevarcode: Script_writecode: ; script command 0x1e -; parameters: -; variable_id (SingleByteParam) -; value (SingleByteParam) +; parameters: variable_id, value call GetScriptByte call GetVarAction @@ -1984,9 +1880,7 @@ Script_checkver: Script_pokenamemem: ; script command 0x40 -; parameters: -; pokemon (PokemonParam); leave $0 to draw from script var -; memory (SingleByteParam) +; parameters: pokemon (0 to use ScriptVar), memory call GetScriptByte and a @@ -2013,9 +1907,7 @@ CopyConvertedText: Script_itemtotext: ; script command 0x41 -; parameters: -; item (ItemLabelByte); use 0 to draw from ScriptVar -; memory (SingleByteParam) +; parameters: item (0 to use ScriptVar), memory call GetScriptByte and a @@ -2029,8 +1921,7 @@ Script_itemtotext: Script_mapnametotext: ; script command 0x42 -; parameters: -; memory (SingleByteParam) +; parameters: memory ld a, [MapGroup] ld b, a @@ -2046,19 +1937,14 @@ ConvertLandmarkToText: Script_landmarktotext: ; script command 0xa5 -; parameters: -; id (SingleByteParam) -; memory (SingleByteParam) +; parameters: id, memory call GetScriptByte jr ConvertLandmarkToText Script_trainertotext: ; script command 0x43 -; parameters: -; trainer_id (TrainerGroupParam) -; trainer_group (TrainerIdParam) -; memory (SingleByteParam) +; parameters: trainer_id, trainer_group, memory call GetScriptByte ld c, a @@ -2069,10 +1955,7 @@ Script_trainertotext: Script_name: ; script command 0xa7 -; parameters: -; type (SingleByteParam) -; id (SingleByteParam) -; memory (SingleByteParam) +; parameters: type, id, memory call GetScriptByte ld [wNamedObjectTypeBuffer], a @@ -2086,9 +1969,7 @@ ContinueToGetName: Script_trainerclassname: ; script command 0xa6 -; parameters: -; id (SingleByteParam) -; memory (SingleByteParam) +; parameters: id, memory ld a, TRAINER_NAME ld [wNamedObjectTypeBuffer], a @@ -2096,9 +1977,7 @@ Script_trainerclassname: Script_readmoney: ; script command 0x3d -; parameters: -; account (SingleByteParam) -; memory (SingleByteParam) +; parameters: account, memory call ResetStringBuffer1 call GetMoneyAccount @@ -2110,8 +1989,7 @@ Script_readmoney: Script_readcoins: ; script command 0x3e -; parameters: -; memory (SingleByteParam) +; parameters: memory call ResetStringBuffer1 ld hl, StringBuffer1 @@ -2123,8 +2001,7 @@ Script_readcoins: Script_RAM2MEM: ; script command 0x3f -; parameters: -; memory (SingleByteParam) +; parameters: memory call ResetStringBuffer1 ld de, ScriptVar @@ -2143,9 +2020,7 @@ ResetStringBuffer1: Script_stringtotext: ; script command 0x44 -; parameters: -; text_pointer (EncodedTextLabelParam) -; memory (SingleByteParam) +; parameters: text_pointer, memory call GetScriptByte ld e, a @@ -2159,8 +2034,7 @@ Script_stringtotext: Script_givepokeitem: ; script command 0x2f -; parameters: -; pointer (PointerParamToItemAndLetter) +; parameters: pointer call GetScriptByte ld l, a @@ -2181,8 +2055,7 @@ Script_givepokeitem: Script_checkpokeitem: ; script command 0x30 -; parameters: -; pointer (PointerParamToItemAndLetter) +; parameters: pointer call GetScriptByte ld e, a @@ -2195,9 +2068,7 @@ Script_checkpokeitem: Script_giveitem: ; script command 0x1f -; parameters: -; item (ItemLabelByte) -; quantity (SingleByteParam) +; parameters: item, quantity call GetScriptByte cp ITEM_FROM_MEM @@ -2220,9 +2091,7 @@ Script_giveitem: Script_takeitem: ; script command 0x20 -; parameters: -; item (ItemLabelByte) -; quantity (DecimalParam) +; parameters: item, quantity xor a ld [ScriptVar], a @@ -2241,8 +2110,7 @@ Script_takeitem: Script_checkitem: ; script command 0x21 -; parameters: -; item (ItemLabelByte) +; parameters: item xor a ld [ScriptVar], a @@ -2257,9 +2125,7 @@ Script_checkitem: Script_givemoney: ; script command 0x22 -; parameters: -; account (SingleByteParam) -; money (MoneyByteParam) +; parameters: account, money call GetMoneyAccount call LoadMoneyAmountToMem @@ -2268,9 +2134,7 @@ Script_givemoney: Script_takemoney: ; script command 0x23 -; parameters: -; account (SingleByteParam) -; money (MoneyByteParam) +; parameters: account, money call GetMoneyAccount call LoadMoneyAmountToMem @@ -2279,9 +2143,7 @@ Script_takemoney: Script_checkmoney: ; script command 0x24 -; parameters: -; account (SingleByteParam) -; money (MoneyByteParam) +; parameters: account, money call GetMoneyAccount call LoadMoneyAmountToMem @@ -2325,8 +2187,7 @@ LoadMoneyAmountToMem: Script_givecoins: ; script command 0x25 -; parameters: -; coins (CoinByteParam) +; parameters: coins call LoadCoinAmountToMem farcall GiveCoins @@ -2334,8 +2195,7 @@ Script_givecoins: Script_takecoins: ; script command 0x26 -; parameters: -; coins (CoinByteParam) +; parameters: coins call LoadCoinAmountToMem farcall TakeCoins @@ -2343,8 +2203,7 @@ Script_takecoins: Script_checkcoins: ; script command 0x27 -; parameters: -; coins (CoinByteParam) +; parameters: coins call LoadCoinAmountToMem farcall CheckCoins @@ -2360,8 +2219,7 @@ LoadCoinAmountToMem: Script_checktime: ; script command 0x2b -; parameters: -; time (SingleByteParam) +; parameters: time xor a ld [ScriptVar], a @@ -2375,8 +2233,7 @@ Script_checktime: Script_checkpoke: ; script command 0x2c -; parameters: -; pkmn (PokemonParam) +; parameters: pokemon xor a ld [ScriptVar], a @@ -2391,8 +2248,7 @@ Script_checkpoke: Script_addcellnum: ; script command 0x28 -; parameters: -; person (SingleByteParam) +; parameters: person xor a ld [ScriptVar], a @@ -2406,8 +2262,7 @@ Script_addcellnum: Script_delcellnum: ; script command 0x29 -; parameters: -; person (SingleByteParam) +; parameters: person xor a ld [ScriptVar], a @@ -2421,8 +2276,7 @@ Script_delcellnum: Script_checkcellnum: ; script command 0x2a -; parameters: -; person (SingleByteParam) +; parameters: person ; returns false if the cell number is not in your phone xor a @@ -2437,8 +2291,7 @@ Script_checkcellnum: Script_specialphonecall: ; script command 0x9c -; parameters: -; call_id (MultiByteParam) +; parameters: call_id call GetScriptByte ld [wSpecialPhoneCallID], a @@ -2460,13 +2313,7 @@ Script_checkphonecall: Script_givepoke: ; script command 0x2d -; parameters: -; pokemon (PokemonParam) -; level (DecimalParam) -; item (ItemLabelByte) -; trainer (DecimalParam) -; trainer_name_pointer (MultiByteParam) -; pkmn_nickname (MultiByteParam) +; parameters: pokemon, level, item, trainer, trainer_name_pointer, pkmn_nickname call GetScriptByte ld [CurPartySpecies], a @@ -2494,9 +2341,7 @@ Script_givepoke: Script_giveegg: ; script command 0x2e -; parameters: -; pkmn (PokemonParam) -; level (DecimalParam) +; parameters: pokemon, level ; if no room in the party, return 0 in ScriptVar; else, return 2 xor a ; PARTYMON @@ -2514,8 +2359,7 @@ Script_giveegg: Script_setevent: ; script command 0x33 -; parameters: -; bit_number (MultiByteParam) +; parameters: bit_number call GetScriptByte ld e, a @@ -2527,8 +2371,7 @@ Script_setevent: Script_clearevent: ; script command 0x32 -; parameters: -; bit_number (MultiByteParam) +; parameters: bit_number call GetScriptByte ld e, a @@ -2540,8 +2383,7 @@ Script_clearevent: Script_checkevent: ; script command 0x31 -; parameters: -; bit_number (MultiByteParam) +; parameters: bit_number call GetScriptByte ld e, a @@ -2559,8 +2401,7 @@ Script_checkevent: Script_setflag: ; script command 0x36 -; parameters: -; bit_number (MultiByteParam) +; parameters: bit_number call GetScriptByte ld e, a @@ -2572,8 +2413,7 @@ Script_setflag: Script_clearflag: ; script command 0x35 -; parameters: -; bit_number (MultiByteParam) +; parameters: bit_number call GetScriptByte ld e, a @@ -2585,8 +2425,7 @@ Script_clearflag: Script_checkflag: ; script command 0x34 -; parameters: -; bit_number (MultiByteParam) +; parameters: bit_number call GetScriptByte ld e, a @@ -2622,8 +2461,7 @@ Script_wildon: Script_xycompare: ; script command 0x39 -; parameters: -; pointer (MultiByteParam) +; parameters: pointer call GetScriptByte ld [wXYComparePointer], a @@ -2633,12 +2471,7 @@ Script_xycompare: Script_warpfacing: ; script command 0xa3 -; parameters: -; facing (SingleByteParam) -; map_group (MapGroupParam) -; map_id (MapIdParam) -; x (SingleByteParam) -; y (SingleByteParam) +; parameters: facing, map_group, map_id, x, y call GetScriptByte and $3 @@ -2651,11 +2484,7 @@ Script_warpfacing: Script_warp: ; script command 0x3c -; parameters: -; map_group (MapGroupParam) -; map_id (MapIdParam) -; x (SingleByteParam) -; y (SingleByteParam) +; parameters: map_group, map_id, x, y ; This seems to be some sort of error handling case. call GetScriptByte @@ -2692,10 +2521,7 @@ Script_warp: Script_warpmod: ; script command 0x3a -; parameters: -; warp_id (SingleByteParam) -; map_group (MapGroupParam) -; map_id (MapIdParam) +; parameters: warp_id, map_group, map_id call GetScriptByte ld [BackupWarpNumber], a @@ -2707,9 +2533,7 @@ Script_warpmod: Script_blackoutmod: ; script command 0x3b -; parameters: -; map_group (MapGroupParam) -; map_id (MapIdParam) +; parameters: map_group, map_id call GetScriptByte ld [wLastSpawnMapGroup], a @@ -2726,8 +2550,7 @@ Script_dontrestartmapmusic: Script_writecmdqueue: ; script command 0x7d -; parameters: -; queue_pointer (MultiByteParam) +; parameters: queue_pointer call GetScriptByte ld e, a @@ -2740,8 +2563,7 @@ Script_writecmdqueue: Script_delcmdqueue: ; script command 0x7e -; parameters: -; byte (SingleByteParam) +; parameters: byte xor a ld [ScriptVar], a @@ -2755,8 +2577,7 @@ Script_delcmdqueue: Script_changemap: ; script command 0x79 -; parameters: -; map_data_pointer (MapDataPointerParam) +; parameters: map_data_pointer call GetScriptByte ld [MapBlockDataBank], a @@ -2770,10 +2591,7 @@ Script_changemap: Script_changeblock: ; script command 0x7a -; parameters: -; x (SingleByteParam) -; y (SingleByteParam) -; block (SingleByteParam) +; parameters: x, y, block call GetScriptByte add 4 @@ -2812,8 +2630,7 @@ Script_enableevents: ; unreferenced Script_newloadmap: ; script command 0x8a -; parameters: -; which_method (SingleByteParam) +; parameters: which_method call GetScriptByte ld [hMapEntryMethod], a @@ -2836,8 +2653,7 @@ Script_textbox: Script_refreshscreen: ; script command 0x48 -; parameters: -; dummy (SingleByteParam) +; parameters: dummy call RefreshScreen call GetScriptByte @@ -2845,8 +2661,7 @@ Script_refreshscreen: Script_loadbytec2cf: ; script command 0x4a -; parameters: -; byte (SingleByteParam) +; parameters: byte call GetScriptByte ld [wc2cf], a @@ -2864,8 +2679,7 @@ Script_closetext: Script_passtoengine: ; script command 0x89 -; parameters: -; data_pointer (PointerLabelBeforeBank) +; parameters: data_pointer call GetScriptByte push af @@ -2879,8 +2693,7 @@ Script_passtoengine: Script_pause: ; script command 0x8b -; parameters: -; length (DecimalParam) +; parameters: length call GetScriptByte and a @@ -2896,8 +2709,7 @@ Script_pause: Script_deactivatefacing: ; script command 0x8c -; parameters: -; time (SingleByteParam) +; parameters: time call GetScriptByte and a @@ -2911,8 +2723,7 @@ Script_deactivatefacing: Script_ptpriorityjump: ; script command 0x8f -; parameters: -; pointer (ScriptPointerLabelParam) +; parameters: pointer call StopScript jp Script_jump @@ -3013,8 +2824,7 @@ ReturnFromCredits: Script_wait: ; script command 0xa8 -; parameters: -; unknown (SingleByteParam) +; parameters: unknown push bc call GetScriptByte -- cgit v1.2.3 From 5a73a62d9bdaa42aa3b94064a0ddba63a8e34ad2 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 15:12:49 -0500 Subject: =?UTF-8?q?Move=20battle=20engine=20data=20into=20data/=20IsJohtoG?= =?UTF-8?q?ymLeader=20=E2=86=92=20IsGymLeader?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/battle/core.asm | 105 +++++++---------------------------------- engine/battle/start_battle.asm | 6 ++- 2 files changed, 20 insertions(+), 91 deletions(-) (limited to 'engine') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 9c22331a0..c609e0bba 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -865,15 +865,7 @@ GetMovePriority: ; 3c5c5 ret ; 3c5df -MoveEffectPriorities: ; 3c5df - db EFFECT_PROTECT, 3 - db EFFECT_ENDURE, 3 - db EFFECT_PRIORITY_HIT, 2 - db EFFECT_FORCE_SWITCH, 0 - db EFFECT_COUNTER, 0 - db EFFECT_MIRROR_COAT, 0 - db -1 -; 3c5ec +INCLUDE "data/moves/effects_priorities.asm" GetMoveEffect: ; 3c5ec ld a, b @@ -2640,7 +2632,7 @@ PlayVictoryMusic: ; 3d0ea .trainer_victory ld de, MUSIC_GYM_VICTORY - call IsJohtoGymLeader + call IsGymLeader jr c, .play_music ld de, MUSIC_TRAINER_VICTORY @@ -2652,58 +2644,22 @@ PlayVictoryMusic: ; 3d0ea ret ; 3d123 -; These functions check if the current opponent is a gym leader or one of a -; few other special trainers. - -; Note: KantoGymLeaders is a subset of JohtoGymLeaders. If you wish to -; differentiate between the two, call IsKantoGymLeader first. - -; The Lance and Red entries are unused for music checks; those trainers are -; accounted for elsewhere. - IsKantoGymLeader: ; 0x3d123 ld hl, KantoGymLeaders jr IsGymLeaderCommon -IsJohtoGymLeader: ; 0x3d128 - ld hl, JohtoGymLeaders +IsGymLeader: ; 0x3d128 + ld hl, GymLeaders IsGymLeaderCommon: push de ld a, [OtherTrainerClass] - ld de, $0001 + ld de, $1 call IsInArray pop de ret ; 0x3d137 -JohtoGymLeaders: - db FALKNER - db WHITNEY - db BUGSY - db MORTY - db PRYCE - db JASMINE - db CHUCK - db CLAIR - db WILL - db BRUNO - db KAREN - db KOGA -; fallthrough -; these two entries are unused - db CHAMPION - db RED -; fallthrough -KantoGymLeaders: - db BROCK - db MISTY - db LT_SURGE - db ERIKA - db JANINE - db SABRINA - db BLAINE - db BLUE - db -1 +INCLUDE "data/trainers/leaders.asm" HandlePlayerMonFaint: ; 3d14e call FaintYourPokemon @@ -4586,12 +4542,12 @@ UseHeldStatusHealingItem: ; 3dde9 ; 3de44 .Statuses: ; 3de44 - db HELD_HEAL_POISON, 1 << PSN - db HELD_HEAL_FREEZE, 1 << FRZ - db HELD_HEAL_BURN, 1 << BRN - db HELD_HEAL_SLEEP, SLP + db HELD_HEAL_POISON, 1 << PSN + db HELD_HEAL_FREEZE, 1 << FRZ + db HELD_HEAL_BURN, 1 << BRN + db HELD_HEAL_SLEEP, SLP db HELD_HEAL_PARALYZE, 1 << PAR - db HELD_HEAL_STATUS, ALL_STATUS + db HELD_HEAL_STATUS, ALL_STATUS db $ff ; 3de51 @@ -6652,13 +6608,13 @@ CheckSleepingTreeMon: ; 3eb38 jr nz, .NotSleeping ; Get list for the time of day - ld hl, .Morn + ld hl, AsleepTreeMonsMorn ld a, [TimeOfDay] cp DAY_F jr c, .Check - ld hl, .Day + ld hl, AsleepTreeMonsDay jr z, .Check - ld hl, .Nite + ld hl, AsleepTreeMonsNite .Check: ld a, [TempEnemyMonSpecies] @@ -6671,36 +6627,7 @@ CheckSleepingTreeMon: ; 3eb38 and a ret -.Nite: - db CATERPIE - db METAPOD - db BUTTERFREE - db WEEDLE - db KAKUNA - db BEEDRILL - db SPEAROW - db EKANS - db EXEGGCUTE - db LEDYBA - db AIPOM - db -1 ; end - -.Day: - db VENONAT - db HOOTHOOT - db NOCTOWL - db SPINARAK - db HERACROSS - db -1 ; end - -.Morn: - db VENONAT - db HOOTHOOT - db NOCTOWL - db SPINARAK - db HERACROSS - db -1 ; end -; 3eb75 +INCLUDE "data/wild/treemons_asleep.asm" CheckUnownLetter: ; 3eb75 ; Return carry if the Unown letter hasn't been unlocked yet @@ -8491,7 +8418,7 @@ InitEnemyTrainer: ; 3f594 ld a, TRAINER_BATTLE ld [wBattleMode], a - call IsJohtoGymLeader + call IsGymLeader jr nc, .done xor a ld [CurPartyMon], a diff --git a/engine/battle/start_battle.asm b/engine/battle/start_battle.asm index 7f0bff96b..253169a27 100644 --- a/engine/battle/start_battle.asm +++ b/engine/battle/start_battle.asm @@ -93,7 +93,7 @@ PlayBattleMusic: ; 2ee6c cp RED jr z, .done - ; really, they should have included admins and scientists here too... + ; They should have included EXECUTIVEM, EXECUTIVEF, and SCIENTIST too... ld de, MUSIC_ROCKET_BATTLE cp GRUNTM jr z, .done @@ -104,8 +104,10 @@ PlayBattleMusic: ; 2ee6c farcall IsKantoGymLeader jr c, .done + ; IsGymLeader also counts CHAMPION, RED, and the Kanto gym leaders + ; but they have been taken care of before this ld de, MUSIC_JOHTO_GYM_LEADER_BATTLE - farcall IsJohtoGymLeader + farcall IsGymLeader jr c, .done ld de, MUSIC_RIVAL_BATTLE -- cgit v1.2.3 From a849c3557b8ee3dd2b464ccdc646aebd33d7b2a7 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 15:39:48 -0500 Subject: More comments Fix some constants --- engine/battle/core.asm | 4 ++-- engine/item_effects.asm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'engine') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index c609e0bba..8c9eecbcf 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -857,7 +857,7 @@ GetMovePriority: ; 3c5c5 cp -1 jr nz, .loop - ld a, 1 + ld a, BASE_PRIORITY ret .done @@ -4808,7 +4808,7 @@ PrintPlayerHUD: ; 3dfbf ld [de], a ld hl, BattleMonLevel ld de, TempMonLevel - ld bc, $0011 + ld bc, $11 call CopyBytes ld a, [CurBattleMon] ld hl, PartyMon1Species diff --git a/engine/item_effects.asm b/engine/item_effects.asm index 90dfdc7e0..c9c7d767f 100644 --- a/engine/item_effects.asm +++ b/engine/item_effects.asm @@ -1436,7 +1436,7 @@ RareCandy: ; ef14 call TextBox hlcoord 11, 1 - ld bc, $0004 + ld bc, 4 predef PrintTempMonStats call WaitPressAorB_BlinkCursor @@ -2572,7 +2572,7 @@ Mysteryberry: ; f5bf cp SKETCH jr z, .CantUsePPUpOnSketch - ld bc, $0015 + ld bc, MON_PP - MON_MOVES add hl, bc ld a, [hl] cp 3 << 6 ; have 3 PP Ups already been used? -- cgit v1.2.3 From 11556196ba546f5c45b97fffc2c263a79eb639b9 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 16:39:36 -0500 Subject: Consistent sine wave code formatting --- engine/battle/battle_transition.asm | 29 +++++++++++++++-------------- engine/battle_anims/functions.asm | 13 +++++++------ engine/events/celebi.asm | 19 +++++++++---------- engine/routines/sine.asm | 4 +--- engine/sprites.asm | 14 +++++++------- 5 files changed, 39 insertions(+), 40 deletions(-) (limited to 'engine') diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 85ba44072..af7bb688f 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -640,7 +640,7 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) .cgb ld hl, .daypals ld a, [TimeOfDayPal] - and (1 << 2) - 1 + and $3 cp 3 jr nz, .daytime ld hl, .nightpals @@ -754,22 +754,23 @@ WipeLYOverrides: ; 8c6d8 StartTrainerBattle_DrawSineWave: ; 8c6f7 (23:46f7) - and (1 << 6) - 1 - cp 1 << 5 - jr nc, .okay - call .DoSineWave +; a = d * sin(a * pi/32) + and %111111 + cp %100000 + jr nc, .negative + call .ApplySineWave ld a, h ret -.okay - and (1 << 5) - 1 - call .DoSineWave +.negative + and %011111 + call .ApplySineWave ld a, h - xor -1 ; cpl + xor $ff inc a ret -.DoSineWave: ; 8c70c (23:470c) +.ApplySineWave: ; 8c70c (23:470c) ld e, a ld a, d ld d, 0 @@ -780,15 +781,15 @@ StartTrainerBattle_DrawSineWave: ; 8c6f7 (23:46f7) inc hl ld d, [hl] ld hl, 0 -.loop +.multiply srl a - jr nc, .skip + jr nc, .even add hl, de -.skip +.even sla e rl d and a - jr nz, .loop + jr nz, .multiply ret ; 8c728 (23:4728) diff --git a/engine/battle_anims/functions.asm b/engine/battle_anims/functions.asm index ea9fb70b3..4b77cd77c 100755 --- a/engine/battle_anims/functions.asm +++ b/engine/battle_anims/functions.asm @@ -4083,18 +4083,19 @@ BattleAnim_IncAnonJumptableIndex: ; ce72c (33:672c) ret BattleAnim_Cosine: ; ce732 (33:6732) - add $10 +; a = d * cos(a * pi/32) + add %010000 BattleAnim_Sine: ; ce734 (33:6734) -; a = d sin a - and $3f - cp $20 +; a = d * sin(a * pi/32) + and %111111 + cp %100000 jr nc, .negative call .ApplySineWave ld a, h ret .negative - and $1f + and %011111 call .ApplySineWave ld a, h xor $ff @@ -4111,7 +4112,7 @@ BattleAnim_Sine: ; ce734 (33:6734) ld e, [hl] inc hl ld d, [hl] - ld hl, $0 + ld hl, 0 .multiply srl a jr nc, .even diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm index 1139ad3d5..22f8f00a4 100755 --- a/engine/events/celebi.asm +++ b/engine/events/celebi.asm @@ -238,27 +238,27 @@ UpdateCelebiPosition: ; 49aa2 (12:5aa2) CelebiEvent_Cosine: ; 49b3b (12:5b3b) - add $10 - and $3f - cp $20 +; a = d * cos(a * pi/32) + add %010000 + and %111111 + cp %100000 jr nc, .negative - call .SineFunction + call .ApplySineWave ld a, h ret .negative - and $1f - call .SineFunction + and %011111 + call .ApplySineWave ld a, h xor $ff inc a ret - -.SineFunction: ; 49b52 (12:5b52) +.ApplySineWave: ; 49b52 (12:5b52) ld e, a ld a, d - ld d, $0 + ld d, 0 ld hl, .sinewave add hl, de add hl, de @@ -276,7 +276,6 @@ CelebiEvent_Cosine: ; 49b3b (12:5b3b) and a jr nz, .multiply ret - ; 49b6e (12:5b6e) .sinewave ; 49b6e diff --git a/engine/routines/sine.asm b/engine/routines/sine.asm index 89a905d2e..5f56a10a8 100755 --- a/engine/routines/sine.asm +++ b/engine/routines/sine.asm @@ -7,7 +7,6 @@ _Sine:: ; 84d9 and %111111 cp %100000 jr nc, .negative - call .ApplySineWave ld a, h ret @@ -16,7 +15,7 @@ _Sine:: ; 84d9 and %011111 call .ApplySineWave ld a, h - xor -1 + xor $ff inc a ret @@ -31,7 +30,6 @@ _Sine:: ; 84d9 inc hl ld d, [hl] ld hl, 0 - ; Factor amplitude .multiply srl a diff --git a/engine/sprites.asm b/engine/sprites.asm index 740c3ef68..1ccd7b6a0 100755 --- a/engine/sprites.asm +++ b/engine/sprites.asm @@ -576,21 +576,22 @@ BrokenStdGFXPointers: ; Broken 2bpp pointers Sprites_Cosine: ; 8e72a - add $10 +; a = d * cos(a * pi/32) + add %010000 Sprites_Sine: ; 8e72c -; floor(d * sin(a * pi/32)) - and $3f - cp $20 +; a = d * sin(a * pi/32) + and %111111 + cp %100000 jr nc, .negative call .ApplySineWave ld a, h ret .negative - and $1f + and %011111 call .ApplySineWave ld a, h - xor $ff ; cpl + xor $ff inc a ret ; 8e741 @@ -610,7 +611,6 @@ Sprites_Sine: ; 8e72c srl a jr nc, .even add hl, de - .even sla e rl d -- cgit v1.2.3 From ce50d1b2cb4eebf8484cf12e6280c441ec94ae39 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 16:55:11 -0500 Subject: Clearer Battle Tower code --- engine/events/battle_tower/load_trainer.asm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'engine') diff --git a/engine/events/battle_tower/load_trainer.asm b/engine/events/battle_tower/load_trainer.asm index 5d8c06166..5389f3f2e 100644 --- a/engine/events/battle_tower/load_trainer.asm +++ b/engine/events/battle_tower/load_trainer.asm @@ -27,12 +27,11 @@ Function_LoadOpponentTrainerAndPokemons: ; 1f8000 add b ld b, a ; b contains the nr of the trainer if DEF(CRYSTAL11) - and (1 << 7) - 1 - cp 70 + and $7f else - and (1 << 5) - 1 - cp 21 + and $1f endc + cp (BattleTowerTrainersEnd - BattleTowerTrainers) / NAME_LENGTH jr nc, .resample ld b, a @@ -114,7 +113,7 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081 add b ld b, a and $1f - cp BATTLETOWER_NRMONSPERLEVELBRACKET + cp BATTLETOWER_NROFPKMNS * BATTLETOWER_NROFTRAINERS jr nc, .resample ; in register 'a' is the chosen Pkmn of the LevelGroup @@ -207,4 +206,6 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081 ret ; 1f814e +INCLUDE "data/battle_tower/classes.asm" + INCLUDE "data/battle_tower/parties.asm" -- cgit v1.2.3 From a8cf8979d9acf66d1bdf4ea115ab6a0faa8f9d34 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 17:20:47 -0500 Subject: Do a little cleanup towards issue #465 --- engine/battle/hidden_power.asm | 14 +++++++------- engine/intro_menu.asm | 2 +- engine/item_effects.asm | 20 ++++++++++---------- engine/pokedex.asm | 4 ++-- engine/scripting.asm | 2 +- engine/stats_screen.asm | 2 +- engine/title.asm | 4 ++-- 7 files changed, 24 insertions(+), 24 deletions(-) (limited to 'engine') diff --git a/engine/battle/hidden_power.asm b/engine/battle/hidden_power.asm index c75a67ab3..a1d3957e4 100644 --- a/engine/battle/hidden_power.asm +++ b/engine/battle/hidden_power.asm @@ -16,12 +16,12 @@ HiddenPowerDamage: ; fbced ; Attack ld a, [hl] swap a - and 8 + and %1000 ; Defense ld b, a ld a, [hli] - and 8 + and %1000 srl a or b @@ -29,7 +29,7 @@ HiddenPowerDamage: ; fbced ld b, a ld a, [hl] swap a - and 8 + and %1000 srl a srl a or b @@ -37,7 +37,7 @@ HiddenPowerDamage: ; fbced ; Special ld b, a ld a, [hl] - and 8 + and %1000 srl a srl a srl a @@ -52,7 +52,7 @@ HiddenPowerDamage: ; fbced ; Add Special & 3 ld b, a ld a, [hld] - and 3 + and %0011 add b ; Divide by 2 and add 30 + 1 @@ -67,12 +67,12 @@ HiddenPowerDamage: ; fbced ; Def & 3 ld a, [hl] - and 3 + and %0011 ld b, a ; + (Atk & 3) << 2 ld a, [hl] - and 3 << 4 + and %0011 << 4 swap a add a add a diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index 7d17b62e5..3a93a9b84 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -853,7 +853,7 @@ ShrinkPlayer: ; 610f ld a, [hROMBank] push af - ld a, 0 << 7 | 32 ; fade out + ld a, 32 ; fade time ld [MusicFade], a ld de, MUSIC_NONE ld a, e diff --git a/engine/item_effects.asm b/engine/item_effects.asm index c9c7d767f..b4437715c 100644 --- a/engine/item_effects.asm +++ b/engine/item_effects.asm @@ -2291,7 +2291,7 @@ PokeDoll: ; f48f inc a ld [wForcedSwitch], a ld a, [wBattleResult] - and 3 << 6 + and $c0 or $2 ld [wBattleResult], a jp UseItemText @@ -2575,7 +2575,7 @@ Mysteryberry: ; f5bf ld bc, MON_PP - MON_MOVES add hl, bc ld a, [hl] - cp 3 << 6 ; have 3 PP Ups already been used? + cp PP_UP_MASK jr c, .do_ppup .CantUsePPUpOnSketch: @@ -2586,7 +2586,7 @@ Mysteryberry: ; f5bf .do_ppup ld a, [hl] - add 1 << 6 ; increase PP Up count by 1 + add PP_UP_ONE ld [hl], a ld a, $1 ld [wd265], a @@ -2714,7 +2714,7 @@ RestorePP: ; f6e8 ld a, [wd265] ld b, a ld a, [hl] - and (1 << 6) - 1 + and PP_MASK cp b jr nc, .dont_restore @@ -2732,7 +2732,7 @@ RestorePP: ; f6e8 .restore_some ld a, [hl] - and (1 << 6) - 1 + and PP_MASK add c cp b jr nc, .restore_all @@ -2740,7 +2740,7 @@ RestorePP: ; f6e8 .restore_all ld a, [hl] - and 3 << 6 + and PP_UP_MASK or b ld [hl], a ret @@ -3125,7 +3125,7 @@ ApplyPPUp: ; f84c .use ld a, [hl] - and 3 << 6 + and PP_UP_MASK ld a, [de] ; wasted cycle call nz, ComputeMaxPP @@ -3209,7 +3209,7 @@ RestoreAllPP: ; f8b9 pop bc pop de ld a, [de] - and 3 << 6 + and PP_UP_MASK ld b, a ld a, [wd265] add b @@ -3282,7 +3282,7 @@ GetMaxPPOfMove: ; f8ec .notwild add hl, bc ld a, [hl] - and 3 << 6 + and PP_UP_MASK pop bc or b @@ -3293,7 +3293,7 @@ GetMaxPPOfMove: ; f8ec ld a, b ; this gets lost anyway call ComputeMaxPP ld a, [hl] - and (1 << 6) - 1 + and PP_MASK ld [wd265], a pop af diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 163f1afee..031998b9f 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -2422,7 +2422,7 @@ Pokedex_LoadCurrentFootprint: ; 41478 (10:5478) Pokedex_LoadAnyFootprint: ; 4147b ld a, [wd265] dec a - and ($ff ^ $07) ; $f8 ; $1f << 3 + and %11111000 srl a srl a srl a @@ -2430,7 +2430,7 @@ Pokedex_LoadAnyFootprint: ; 4147b ld d, a ld a, [wd265] dec a - and 7 + and %111 swap a ; * $10 ld l, a ld h, 0 diff --git a/engine/scripting.asm b/engine/scripting.asm index ae9384fde..b5489917b 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -898,7 +898,7 @@ Script_musicfadeout: call GetScriptByte ld [MusicFadeID + 1], a call GetScriptByte - and $7f + and $ff ^ (1 << MUSIC_FADE_IN_F) ld [MusicFade], a ret diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm index 9f632f388..23d1d2d62 100755 --- a/engine/stats_screen.asm +++ b/engine/stats_screen.asm @@ -1157,7 +1157,7 @@ CheckFaintedFrzSlp: ; 4e53f ld hl, MON_STATUS add hl, bc ld a, [hl] - and (1 << FRZ) | SLP + and 1 << FRZ | SLP jr nz, .fainted_frz_slp and a ret diff --git a/engine/title.asm b/engine/title.asm index 2380cfedf..3e4afafa2 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -237,11 +237,11 @@ SuicuneFrameIterator: ; 10eea7 inc [hl] ; Only do this once every eight frames - and (1 << 3) - 1 + and %111 ret nz ld a, c - and 3 << 3 + and %11000 sla a swap a ld e, a -- cgit v1.2.3 From cc0fd6e12c0afe9b70f55114eb3123014318e107 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 17:26:40 -0500 Subject: =?UTF-8?q?CRYSTAL11=20=E2=86=92=20=5FCRYSTAL11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/events/battle_tower/load_trainer.asm | 2 +- engine/events/battle_tower/trainer_text.asm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'engine') diff --git a/engine/events/battle_tower/load_trainer.asm b/engine/events/battle_tower/load_trainer.asm index 5389f3f2e..bf8b20a27 100644 --- a/engine/events/battle_tower/load_trainer.asm +++ b/engine/events/battle_tower/load_trainer.asm @@ -26,7 +26,7 @@ Function_LoadOpponentTrainerAndPokemons: ; 1f8000 ld a, [hRandomAdd] add b ld b, a ; b contains the nr of the trainer -if DEF(CRYSTAL11) +if DEF(_CRYSTAL11) and $7f else and $1f diff --git a/engine/events/battle_tower/trainer_text.asm b/engine/events/battle_tower/trainer_text.asm index 21704ff2d..96c91caa9 100755 --- a/engine/events/battle_tower/trainer_text.asm +++ b/engine/events/battle_tower/trainer_text.asm @@ -7,7 +7,7 @@ BattleTowerText:: ; 11c000 push af ld a, BANK(BT_OTTrainerClass) ld [rSVBK], a -if DEF(CRYSTAL11) +if DEF(_CRYSTAL11) ld hl, BT_OTTrainerClass else ; BUG ALERT @@ -16,7 +16,7 @@ else ; uses it to get the gender of the trainer. ; As a consequence, the enemy trainer's dialog will ; always be sampled from the female array. - ld hl, BT_OTName + 5 + ld hl, BT_OTName + NAME_LENGTH_JAPANESE - 1 endc ld a, [hl] dec a -- cgit v1.2.3 From feb34b49ba23151507332a6354f124f4fe7b1a4b Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 19:51:30 -0500 Subject: =?UTF-8?q?data/phone=5Ftext=20=E2=86=92=20data/phone/text?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/phone/buenas_password.asm | 2 +- engine/phone/phone.asm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'engine') diff --git a/engine/phone/buenas_password.asm b/engine/phone/buenas_password.asm index bfcd1604c..0d144afa6 100644 --- a/engine/phone/buenas_password.asm +++ b/engine/phone/buenas_password.asm @@ -167,4 +167,4 @@ BuenaPhoneScript_Random1: end ; a0c28 -INCLUDE "data/phone_text/buena.asm" +INCLUDE "data/phone/text/buena.asm" diff --git a/engine/phone/phone.asm b/engine/phone/phone.asm index 53bb519b3..9932d0f4f 100644 --- a/engine/phone/phone.asm +++ b/engine/phone/phone.asm @@ -761,9 +761,9 @@ GetCallerLocation: ; 90439 ; 9045f -INCLUDE "data/phone_contacts.asm" +INCLUDE "data/phone/phone_contacts.asm" -INCLUDE "data/phone_special.asm" +INCLUDE "data/phone/special_calls.asm" UnknownScript_0x90657: ; 0x90657 -- cgit v1.2.3 From f22485b08d5378015f3248b7a758ea0d25eb0c7d Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 22:44:06 -0500 Subject: Binary tilemaps --- engine/card_flip.asm | 5 ++- engine/color.asm | 3 +- engine/title.asm | 4 +- engine/unused_title.asm | 107 +++++++++++++++++++----------------------------- 4 files changed, 49 insertions(+), 70 deletions(-) (limited to 'engine') diff --git a/engine/card_flip.asm b/engine/card_flip.asm index 10e06b9a9..3d635a204 100755 --- a/engine/card_flip.asm +++ b/engine/card_flip.asm @@ -1,5 +1,6 @@ CARDFLIP_LIGHT_OFF EQU $ef CARDFLIP_LIGHT_ON EQU $f5 + CARDFLIP_DECK_SIZE EQU 4 * 6 _CardFlip: ; e00ee (38:40ee) @@ -25,11 +26,11 @@ _CardFlip: ; e00ee (38:40ee) ld de, vTiles0 tile $00 call Decompress ld hl, CardFlipOffButtonGFX - ld de, vTiles1 tile $6f + ld de, vTiles0 tile CARDFLIP_LIGHT_OFF ld bc, 1 tiles call CopyBytes ld hl, CardFlipOnButtonGFX - ld de, vTiles1 tile $75 + ld de, vTiles0 tile CARDFLIP_LIGHT_ON ld bc, 1 tiles call CopyBytes diff --git a/engine/color.asm b/engine/color.asm index 04b24fde9..ecf4eab68 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -1204,7 +1204,8 @@ INCLUDE "data/palettes/pal_packets.asm" PredefPals: INCLUDE "data/palettes/predef.pal" -INCLUDE "data/sgb_border_map.asm" +SGBBorderMap: +INCBIN "gfx/sgb/sgb_border.tilemap" SGBBorderPalettes: INCLUDE "data/palettes/sgb_border.pal" diff --git a/engine/title.asm b/engine/title.asm index 3e4afafa2..9d8ce1d3f 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -167,8 +167,8 @@ _TitleScreen: ; 10ed67 ; Make alternating lines come in from opposite sides -; ( This part is actually totally pointless, you can't -; see anything until these values are overwritten! ) +; (This part is actually totally pointless, you can't +; see anything until these values are overwritten!) ld b, 80 / 2 ; alternate for 80 lines ld hl, LYOverrides diff --git a/engine/unused_title.asm b/engine/unused_title.asm index f0b59b527..ac1e0ade1 100644 --- a/engine/unused_title.asm +++ b/engine/unused_title.asm @@ -103,60 +103,12 @@ INCBIN "gfx/title/old_bg.2bpp" ; 10d0b1 UnusedTitleBG_Tilemap: ; 10d0b1 -; 32x32 (tile, attributes) - db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $01,$00, $02,$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, $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, $03,$00, $04,$00, $05,$01, $06,$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, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00 - db $00,$00, $00,$00, $07,$05, $08,$05, $09,$05, $0a,$05, $0b,$00, $0c,$00, $0d,$00, $0e,$00, $0f,$01, $10,$01, $11,$01, $12,$01, $13,$05, $14,$05, $15,$05, $16,$05, $00,$00, $00,$00, $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, $17,$04, $18,$04, $19,$04, $1a,$04, $1b,$00, $1c,$00, $1d,$02, $1e,$02, $1f,$07, $20,$07, $21,$01, $22,$01, $23,$04, $24,$04, $25,$04, $26,$04, $00,$00, $00,$00, $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, $27,$04, $28,$04, $29,$04, $2a,$04, $2b,$00, $2c,$00, $2d,$03, $2e,$01, $2f,$01, $30,$01, $31,$01, $32,$01, $33,$04, $34,$04, $35,$04, $36,$04, $00,$00, $00,$00, $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, $37,$04, $38,$04, $39,$04, $3a,$04, $3b,$00, $3c,$00, $3d,$01, $00,$00, $00,$00, $3e,$07, $3f,$01, $40,$01, $41,$04, $42,$04, $43,$04, $44,$04, $00,$00, $00,$00, $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, $45,$04, $46,$04, $47,$04, $48,$04, $49,$00, $3c,$00, $4a,$01, $00,$00, $00,$00, $4b,$07, $3f,$01, $4c,$01, $4d,$06, $4e,$06, $4f,$06, $50,$06, $00,$00, $00,$00, $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, $51,$04, $52,$06, $53,$06, $54,$06, $55,$00, $3c,$00, $56,$01, $00,$00, $00,$00, $57,$07, $58,$01, $59,$01, $5a,$06, $5b,$06, $5c,$06, $5d,$06, $00,$00, $00,$00, $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, $5e,$06, $5f,$06, $60,$06, $61,$06, $62,$00, $63,$00, $64,$03, $65,$01, $66,$01, $67,$07, $68,$01, $69,$01, $26,$04, $6a,$06, $26,$04, $26,$04, $00,$00, $00,$00, $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, $6b,$00, $6c,$05, $6d,$05, $6e,$05, $6f,$00, $70,$02, $71,$02, $72,$01, $73,$00, $74,$02, $75,$01, $76,$01, $77,$05, $78,$05, $79,$05, $6b,$00, $00,$00, $00,$00, $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, $7a,$00, $7b,$00, $7c,$00, $7d,$00, $0f,$01, $7e,$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, $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, $a2,$00, $80,$00, $81,$00, $82,$00, $83,$00, $84,$07, $85,$01, $86,$01, $87,$01, $88,$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, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00 - db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $89,$00, $8a,$00, $8b,$00, $8c,$07, $8d,$01, $8e,$01, $8f,$01, $90,$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, $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, $91,$01, $92,$01, $93,$01, $94,$01, $95,$01, $00,$00, $00,$00, $00,$00, $96,$05, $97,$05, $98,$05, $00,$00, $00,$00, $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, $99,$05, $9a,$05, $9b,$05, $00,$00, $00,$00, $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, $9c,$05, $9d,$05, $9e,$05, $00,$00, $00,$00, $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, $9f,$05, $a0,$05, $a1,$05, $00,$00, $00,$00, $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, $00,$00, $00,$00, $00,$00, $00,$00, $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, $00,$00, $00,$00, $00,$00, $00,$00, $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, $00,$00, $00,$00, $00,$00, $00,$00, $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, $00,$00, $00,$00, $00,$00, $00,$00, $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, $00,$00, $00,$00, $00,$00, $00,$00, $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, $00,$00, $00,$00, $00,$00, $00,$00, $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, $00,$00, $00,$00, $00,$00, $00,$00, $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, $00,$00, $00,$00, $00,$00, $00,$00, $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, $00,$00, $00,$00, $00,$00, $00,$00, $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, $6b,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $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, $00,$00, $00,$00, $00,$00, $00,$00, $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, $00,$00, $00,$00, $00,$00, $00,$00, $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, $00,$00, $00,$00, $00,$00, $00,$00, $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, $00,$00, $00,$00, $00,$00, $00,$00, $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, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00 +; 32x32 (alternating tiles and attributes) +INCBIN "gfx/title/old_bg.tilemap" ; 10d8b1 UnusedTitleBG_Palettes: ; 10d8b1 INCLUDE "data/palettes/unused_title/bg.pal" - - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 31, 31, 31 - - RGB 31, 31, 31 - RGB 20, 04, 20 - RGB 16, 08, 16 - RGB 24, 00, 24 - -rept 54 - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 31, 31, 31 -endr ; 10dab1 UnusedTitleFG_GFX: ; 10dab1 @@ -168,23 +120,48 @@ INCLUDE "data/palettes/unused_title/ob.pal" ; 10ecb1 UnusedTitleFG_OAM: ; 10ecb1 - db $18, $38, $00, $01, $18, $40, $02, $01, $18, $48, $04, $01, $18, $50, $06, $01 - db $18, $58, $08, $01, $18, $60, $0a, $01, $18, $68, $0c, $01, $18, $70, $0e, $01 - - db $28, $38, $10, $00, $28, $40, $12, $00, $28, $48, $14, $00, $28, $50, $16, $00 - db $28, $58, $18, $00, $28, $60, $1a, $00, $28, $68, $1c, $00, $28, $70, $1e, $00 - - db $38, $38, $20, $00, $38, $40, $22, $00, $38, $48, $24, $00, $38, $50, $26, $00 - db $38, $58, $28, $00, $38, $60, $2a, $00, $38, $68, $2c, $00, $38, $70, $2e, $00 - - db $48, $38, $30, $02, $48, $40, $32, $02, $48, $48, $34, $02, $48, $50, $36, $02 - db $48, $58, $38, $02, $48, $60, $3a, $02, $48, $68, $3c, $02, $48, $70, $3e, $02 - - db $58, $38, $40, $01, $58, $40, $42, $01, $58, $48, $44, $01, $58, $50, $46, $01 - db $58, $58, $48, $01, $58, $60, $4a, $01, $58, $68, $4c, $01, $58, $70, $4e, $01 + dsprite 3, 0, 7, 0, $00, 1 + dsprite 3, 0, 8, 0, $02, 1 + dsprite 3, 0, 9, 0, $04, 1 + dsprite 3, 0, 10, 0, $06, 1 + dsprite 3, 0, 11, 0, $08, 1 + dsprite 3, 0, 12, 0, $0a, 1 + dsprite 3, 0, 13, 0, $0c, 1 + dsprite 3, 0, 14, 0, $0e, 1 + dsprite 5, 0, 7, 0, $10, 0 + dsprite 5, 0, 8, 0, $12, 0 + dsprite 5, 0, 9, 0, $14, 0 + dsprite 5, 0, 10, 0, $16, 0 + dsprite 5, 0, 11, 0, $18, 0 + dsprite 5, 0, 12, 0, $1a, 0 + dsprite 5, 0, 13, 0, $1c, 0 + dsprite 5, 0, 14, 0, $1e, 0 + dsprite 7, 0, 7, 0, $20, 0 + dsprite 7, 0, 8, 0, $22, 0 + dsprite 7, 0, 9, 0, $24, 0 + dsprite 7, 0, 10, 0, $26, 0 + dsprite 7, 0, 11, 0, $28, 0 + dsprite 7, 0, 12, 0, $2a, 0 + dsprite 7, 0, 13, 0, $2c, 0 + dsprite 7, 0, 14, 0, $2e, 0 + dsprite 9, 0, 7, 0, $30, 2 + dsprite 9, 0, 8, 0, $32, 2 + dsprite 9, 0, 9, 0, $34, 2 + dsprite 9, 0, 10, 0, $36, 2 + dsprite 9, 0, 11, 0, $38, 2 + dsprite 9, 0, 12, 0, $3a, 2 + dsprite 9, 0, 13, 0, $3c, 2 + dsprite 9, 0, 14, 0, $3e, 2 + dsprite 11, 0, 7, 0, $40, 1 + dsprite 11, 0, 8, 0, $42, 1 + dsprite 11, 0, 9, 0, $44, 1 + dsprite 11, 0, 10, 0, $46, 1 + dsprite 11, 0, 11, 0, $48, 1 + dsprite 11, 0, 12, 0, $4a, 1 + dsprite 11, 0, 13, 0, $4c, 1 + dsprite 11, 0, 14, 0, $4e, 1 ; 10ed51 - Function10ed51: ; 10ed51 call _TitleScreen .loop -- cgit v1.2.3 From 5c5f8b325fe5900a3800a976a1a31e99934f6815 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 23:21:32 -0500 Subject: Move data/palettes/ .pal files into gfx/ --- engine/card_flip.asm | 2 +- engine/cgb_layouts.asm | 4 ++-- engine/color.asm | 38 +++++++++++++++++++------------------- engine/credits.asm | 2 +- engine/crystal_colors.asm | 10 +++++----- engine/crystal_intro.asm | 14 +++++++------- engine/debug.asm | 4 ++-- engine/mon_icons.asm | 4 ++-- engine/namingscreen.asm | 2 +- engine/pokegear.asm | 2 +- engine/title.asm | 2 +- engine/unused_title.asm | 4 ++-- 12 files changed, 44 insertions(+), 44 deletions(-) (limited to 'engine') diff --git a/engine/card_flip.asm b/engine/card_flip.asm index 3d635a204..8c55991bb 100755 --- a/engine/card_flip.asm +++ b/engine/card_flip.asm @@ -1662,7 +1662,7 @@ CardFlip_InitAttrPals: ; e0c37 (38:4c37) ; e0c93 (38:4c93) .palettes ; e0c93 -INCLUDE "data/palettes/card_flip.pal" +INCLUDE "gfx/card_flip/card_flip.pal" ; e0cdb CardFlipLZ03: ; e0cdb diff --git a/engine/cgb_layouts.asm b/engine/cgb_layouts.asm index 74d476dec..97477367d 100644 --- a/engine/cgb_layouts.asm +++ b/engine/cgb_layouts.asm @@ -891,11 +891,11 @@ _CGB_PackPals: ; 93d3 ; 9439 .ChrisPackPals: ; 9439 -INCLUDE "data/palettes/pack.pal" +INCLUDE "gfx/pack/pack.pal" ; 9469 .KrisPackPals: ; 9469 -INCLUDE "data/palettes/pack_f.pal" +INCLUDE "gfx/pack/pack_f.pal" ; 9499 _CGB_Pokepic: ; 9499 diff --git a/engine/color.asm b/engine/color.asm index ecf4eab68..8bd79fd3b 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -451,7 +451,7 @@ LoadMailPalettes: ret .MailPals: -INCLUDE "data/palettes/mail.pal" +INCLUDE "gfx/mail/mail.pal" INCLUDE "engine/cgb_layouts.asm" @@ -766,7 +766,7 @@ Function9779: mobile ret BattleObjectPals: -INCLUDE "data/palettes/battle_objects.pal" +INCLUDE "gfx/battle_anims/battle_anims.pal" Function97cc: ; XXX @@ -1197,27 +1197,27 @@ SGBDelayCycles: jr nz, .wait ret -INCLUDE "data/palettes/blk_packets.asm" +INCLUDE "gfx/sgb/blk_packets.asm" -INCLUDE "data/palettes/pal_packets.asm" +INCLUDE "gfx/sgb/pal_packets.asm" PredefPals: -INCLUDE "data/palettes/predef.pal" +INCLUDE "gfx/sgb/predef.pal" SGBBorderMap: INCBIN "gfx/sgb/sgb_border.tilemap" SGBBorderPalettes: -INCLUDE "data/palettes/sgb_border.pal" +INCLUDE "gfx/sgb/sgb_border.pal" SGBBorder: INCBIN "gfx/sgb/sgb_border.2bpp" HPBarPals: -INCLUDE "data/palettes/hp_bar.pal" +INCLUDE "gfx/battle/hp_bar.pal" ExpBarPalette: -INCLUDE "data/palettes/exp_bar.pal" +INCLUDE "gfx/battle/exp_bar.pal" INCLUDE "data/pokemon/palettes.asm" @@ -1338,34 +1338,34 @@ Palette_b311: ; b311 not mobile RGB 00, 00, 00 TilesetBGPalette: -INCLUDE "data/palettes/overworld/tileset_bg.pal" +INCLUDE "gfx/tilesets/bg_tiles.pal" MapObjectPals:: -INCLUDE "data/palettes/overworld/map_objects.pal" +INCLUDE "gfx/sprites/map_objects.pal" RoofPals: -INCLUDE "data/palettes/overworld/roofs.pal" +INCLUDE "gfx/tilesets/roofs.pal" DiplomaPalettes: -INCLUDE "data/palettes/diploma.pal" +INCLUDE "gfx/diploma/diploma.pal" PartyMenuOBPals: -INCLUDE "data/palettes/party_menu.pal" +INCLUDE "gfx/icons/party_menu.pal" Palettes_b6f1: -INCLUDE "data/palettes/unknown/b6f1.pal" +INCLUDE "gfx/unknown/b6f1.pal" Palettes_b719: -INCLUDE "data/palettes/unknown/b719.pal" +INCLUDE "gfx/unknown/b719.pal" MalePokegearPals: -INCLUDE "data/palettes/pokegear.pal" +INCLUDE "gfx/pokegear/pokegear.pal" FemalePokegearPals: -INCLUDE "data/palettes/pokegear_f.pal" +INCLUDE "gfx/pokegear/pokegear_f.pal" Palettes_b789: -INCLUDE "data/palettes/unknown/b789.pal" +INCLUDE "gfx/unknown/b789.pal" SlotMachinePals: -INCLUDE "data/palettes/slot_machine.pal" +INCLUDE "gfx/slots/slots.pal" diff --git a/engine/credits.asm b/engine/credits.asm index 564422db3..5d34ba2f4 100644 --- a/engine/credits.asm +++ b/engine/credits.asm @@ -540,7 +540,7 @@ GetCreditsPalette: ; 109b2c ret CreditsPalettes: -INCLUDE "data/palettes/credits.pal" +INCLUDE "gfx/credits/credits.pal" ; 109bca Credits_LoadBorderGFX: ; 109bca (42:5bca) diff --git a/engine/crystal_colors.asm b/engine/crystal_colors.asm index 5d2ba236c..e4783619c 100755 --- a/engine/crystal_colors.asm +++ b/engine/crystal_colors.asm @@ -113,7 +113,7 @@ MG_Mobile_Layout_CreatePalBoxes: ; 49384 (12:5384) ; 493e1 (12:53e1) Palette_493e1: ; 493e1 -INCLUDE "data/palettes/mg_mobile.pal" +INCLUDE "gfx/mystery_gift/mg_mobile.pal" ; 49409 LoadOW_BGPal7:: ; 49409 @@ -126,7 +126,7 @@ LoadOW_BGPal7:: ; 49409 ; 49418 Palette_TextBG7: ; 49418 -INCLUDE "data/palettes/overworld/bg_text.pal" +INCLUDE "gfx/font/bg_text.pal" ; 49420 Function49420:: ; 49420 (12:5420) @@ -248,7 +248,7 @@ Function49742: ; 49742 ; 49757 .Palette_49757: ; 49757 -INCLUDE "data/palettes/unknown/49757.pal" +INCLUDE "gfx/unknown/49757.pal" ; 49797 _InitMG_Mobile_LinkTradePalMap: ; 49797 @@ -314,7 +314,7 @@ LoadTradeRoomBGPals: ; 49811 ; 49826 TradeRoomPalette: ; 49826 -INCLUDE "data/palettes/trade_room.pal" +INCLUDE "gfx/trade/border.pal" ; 49856 InitMG_Mobile_LinkTradePalMap: ; 49856 @@ -323,4 +323,4 @@ InitMG_Mobile_LinkTradePalMap: ; 49856 ; 4985a Unknown_4985a: ; unreferenced -INCLUDE "data/palettes/unknown/4985a.asm" +INCLUDE "gfx/unknown/4985a.asm" diff --git a/engine/crystal_intro.asm b/engine/crystal_intro.asm index 302490a3b..84ab86113 100755 --- a/engine/crystal_intro.asm +++ b/engine/crystal_intro.asm @@ -341,7 +341,7 @@ GameFreakLogoScene5: ; e47ab (39:47ab) ; e47ac (39:47ac) GameFreakLogoPalettes: ; e47ac -INCLUDE "data/palettes/crystal_intro/gamefreak_logo.pal" +INCLUDE "gfx/intro/gamefreak_logo.pal" ; e47cc GameFreakLogo: ; e47cc @@ -1550,7 +1550,7 @@ Intro_Scene24_ApplyPaletteFade: ; e5172 (39:5172) ; e519c (39:519c) .FadePals: ; e519c -INCLUDE "data/palettes/crystal_intro/fade.pal" +INCLUDE "gfx/intro/fade.pal" ; e51dc CrystalIntro_InitUnownAnim: ; e51dc (39:51dc) @@ -2088,7 +2088,7 @@ INCBIN "gfx/intro/003.tilemap.lz" ; e5edd Palette_e5edd: ; e5edd -INCLUDE "data/palettes/crystal_intro/intro_1.pal" +INCLUDE "gfx/intro/intro_1.pal" ; e5f5d IntroUnownsGFX: ; e5f5d @@ -2124,7 +2124,7 @@ INCBIN "gfx/intro/007.tilemap.lz" ; e65ad Palette_365ad: ; e65ad -INCLUDE "data/palettes/crystal_intro/intro_2.pal" +INCLUDE "gfx/intro/intro_2.pal" ; e662d IntroCrystalUnownsGFX: ; e662d @@ -2140,7 +2140,7 @@ INCBIN "gfx/intro/015.tilemap.lz" ; e679d Palette_e679d: ; e679d -INCLUDE "data/palettes/crystal_intro/intro_3.pal" +INCLUDE "gfx/intro/intro_3.pal" ; e681d IntroSuicuneCloseGFX: ; e681d @@ -2156,7 +2156,7 @@ INCBIN "gfx/intro/011.tilemap.lz" ; e6d6d Palette_e6d6d: ; e6d6d -INCLUDE "data/palettes/crystal_intro/intro_4.pal" +INCLUDE "gfx/intro/intro_4.pal" ; e6ded IntroSuicuneJumpGFX: ; e6ded @@ -2184,7 +2184,7 @@ INCBIN "gfx/intro/013.tilemap.lz" ; e77dd Palette_e77dd: ; e77dd -INCLUDE "data/palettes/crystal_intro/intro_5.pal" +INCLUDE "gfx/intro/intro_5.pal" IntroUnownBackGFX: ; e785d INCBIN "gfx/intro/unown_back.2bpp.lz" diff --git a/engine/debug.asm b/engine/debug.asm index 1e0d042e0..c1c8eb284 100755 --- a/engine/debug.asm +++ b/engine/debug.asm @@ -193,10 +193,10 @@ Function819a7: ; 819a7 ; 819f4 Palette_819f4: ; 819f4 -INCLUDE "data/palettes/debug/bg.pal" +INCLUDE "gfx/debug/bg.pal" Palette_81a34: ; 81a34 -INCLUDE "data/palettes/debug/ob.pal" +INCLUDE "gfx/debug/ob.pal" ; 81a74 Function81a74: ; 81a74 diff --git a/engine/mon_icons.asm b/engine/mon_icons.asm index 316ff3bac..660ab8512 100755 --- a/engine/mon_icons.asm +++ b/engine/mon_icons.asm @@ -307,8 +307,8 @@ GetIconGFX: ; 8e9de ret HeldItemIcons: -INCBIN "gfx/icon/mail.2bpp" -INCBIN "gfx/icon/item.2bpp" +INCBIN "gfx/icons/mail.2bpp" +INCBIN "gfx/icons/item.2bpp" ; 8ea17 GetIcon_de: ; 8ea17 diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index 177f06f73..c81934d27 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -1041,7 +1041,7 @@ _ComposeMailMessage: ; 11e75 (mail?) ; 11ef4 (4:5ef4) .MailIcon: ; 11ef4 -INCBIN "gfx/icon/mail2.2bpp" +INCBIN "gfx/icons/mail2.2bpp" ; 11f74 .initwNamingScreenMaxNameLength ; 11f74 (4:5f74) diff --git a/engine/pokegear.asm b/engine/pokegear.asm index 93ee5a79f..c8063c830 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -2834,7 +2834,7 @@ TownMapPals: ; 91f13 ret .PalMap: -INCLUDE "data/palettes/town_map_palette_map.asm" +INCLUDE "gfx/pokegear/town_map_palette_map.asm" ; 91f7b TownMapMon: ; 91f7b diff --git a/engine/title.asm b/engine/title.asm index 9d8ce1d3f..5f9ca82f7 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -399,4 +399,4 @@ INCBIN "gfx/title/crystal.2bpp.lz" ; 10fede TitleScreenPalettes: -INCLUDE "data/palettes/title.pal" +INCLUDE "gfx/title/title.pal" diff --git a/engine/unused_title.asm b/engine/unused_title.asm index ac1e0ade1..b9e31cdae 100644 --- a/engine/unused_title.asm +++ b/engine/unused_title.asm @@ -108,7 +108,7 @@ INCBIN "gfx/title/old_bg.tilemap" ; 10d8b1 UnusedTitleBG_Palettes: ; 10d8b1 -INCLUDE "data/palettes/unused_title/bg.pal" +INCLUDE "gfx/title/old_bg.pal" ; 10dab1 UnusedTitleFG_GFX: ; 10dab1 @@ -116,7 +116,7 @@ INCBIN "gfx/title/old_fg.2bpp" ; 10eab1 UnusedTitleFG_Palettes: ; 10eab1 -INCLUDE "data/palettes/unused_title/ob.pal" +INCLUDE "gfx/title/old_fg.pal" ; 10ecb1 UnusedTitleFG_OAM: ; 10ecb1 -- cgit v1.2.3 From 9af6d8d0f1cdfe13d5b6b028b7da2965fddaab67 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 23:53:58 -0500 Subject: Split tilesets/ into gfx/tilesets and data/tilesets/ --- engine/crystal_colors.asm | 2 +- engine/mapgroup_roofs.asm | 20 + engine/tileset_anims.asm | 1060 +++++++++++++++++++++++++++++++++++++++++++ engine/tileset_palettes.asm | 200 ++++++++ 4 files changed, 1281 insertions(+), 1 deletion(-) create mode 100644 engine/mapgroup_roofs.asm create mode 100644 engine/tileset_anims.asm create mode 100644 engine/tileset_palettes.asm (limited to 'engine') diff --git a/engine/crystal_colors.asm b/engine/crystal_colors.asm index e4783619c..f877c8e0a 100755 --- a/engine/crystal_colors.asm +++ b/engine/crystal_colors.asm @@ -204,7 +204,7 @@ Function49496: ; 49496 ret ; 494ac -INCLUDE "tilesets/special_palettes.asm" +INCLUDE "engine/tileset_palettes.asm" MG_Mobile_Layout02: ; 49706 ld hl, .Palette_49732 diff --git a/engine/mapgroup_roofs.asm b/engine/mapgroup_roofs.asm new file mode 100644 index 000000000..72999efc6 --- /dev/null +++ b/engine/mapgroup_roofs.asm @@ -0,0 +1,20 @@ +LoadMapGroupRoof:: ; 1c000 + ld a, [MapGroup] + ld e, a + ld d, 0 + ld hl, MapGroupRoofs + add hl, de + ld a, [hl] + cp $ff + ret z + ld hl, Roofs + ld bc, $90 + call AddNTimes + ld de, vTiles2 tile $0a + ld bc, $90 + call CopyBytes + ret +; 1c021 + + +INCLUDE "data/maps/roofs.asm" diff --git a/engine/tileset_anims.asm b/engine/tileset_anims.asm new file mode 100644 index 000000000..74679b1ee --- /dev/null +++ b/engine/tileset_anims.asm @@ -0,0 +1,1060 @@ +_AnimateTileset:: ; fc000 +; Iterate over a given pointer array of +; animation functions (one per frame). + +; Typically in wra1, vra0 + + ld a, [TilesetAnim] + ld e, a + ld a, [TilesetAnim + 1] + ld d, a + + ld a, [hTileAnimFrame] + ld l, a + inc a + ld [hTileAnimFrame], a + + ld h, 0 + add hl, hl + add hl, hl + add hl, de + +; 2-byte parameter +; All functions take input de. + ld e, [hl] + inc hl + ld d, [hl] + inc hl + +; Function address + ld a, [hli] + ld h, [hl] + ld l, a + + jp hl +; fc01b + +Tileset0Anim: ; 0xfc01b +TilesetJohto2Anim: ; 0xfc01b +TilesetKantoAnim: ; 0xfc01b + dw vTiles2 tile $14, AnimateWaterTile + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, TileAnimationPalette + dw NULL, WaitTileAnimation + dw NULL, AnimateFlowerTile + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, StandingTileFrame8 + dw NULL, DoneTileAnimation +; 0xfc047 + +TilesetParkAnim: ; 0xfc047 + dw vTiles2 tile $14, AnimateWaterTile + dw NULL, WaitTileAnimation + dw vTiles2 tile $5f, AnimateFountain + dw NULL, WaitTileAnimation + dw NULL, TileAnimationPalette + dw NULL, WaitTileAnimation + dw NULL, AnimateFlowerTile + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, StandingTileFrame8 + dw NULL, DoneTileAnimation +; 0xfc073 + +TilesetIlexForestAnim: ; 0xfc073 + dw NULL, ForestTreeLeftAnimation + dw NULL, ForestTreeRightAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, ForestTreeLeftAnimation2 + dw NULL, ForestTreeRightAnimation2 + dw NULL, AnimateFlowerTile + dw vTiles2 tile $14, AnimateWaterTile + dw NULL, TileAnimationPalette + dw NULL, StandingTileFrame8 + dw NULL, DoneTileAnimation +; 0xfc0a3 + +TilesetJohto1Anim: ; 0xfc0a3 + dw vTiles2 tile $14, AnimateWaterTile + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, TileAnimationPalette + dw NULL, WaitTileAnimation + dw NULL, AnimateFlowerTile + dw WhirlpoolFrames1, AnimateWhirlpoolTile + dw WhirlpoolFrames2, AnimateWhirlpoolTile + dw WhirlpoolFrames3, AnimateWhirlpoolTile + dw WhirlpoolFrames4, AnimateWhirlpoolTile + dw NULL, WaitTileAnimation + dw NULL, StandingTileFrame8 + dw NULL, DoneTileAnimation +; 0xfc0d7 + +UnusedTilesetAnim_fc0d7: ; 0xfc0d7 + dw vTiles2 tile $03, WriteTileToBuffer + dw wTileAnimBuffer, ScrollTileRightLeft + dw vTiles2 tile $03, WriteTileFromBuffer + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, AnimateFlowerTile + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, DoneTileAnimation +; 0xfc103 + +UnusedTilesetAnim_fc103: ; 0xfc103 + dw vTiles2 tile $14, WriteTileToBuffer + dw wTileAnimBuffer, ScrollTileRightLeft + dw vTiles2 tile $14, WriteTileFromBuffer + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, DoneTileAnimation +; 0xfc12f + +TilesetPortAnim: ; 0xfc12f + dw vTiles2 tile $14, AnimateWaterTile + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, TileAnimationPalette + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, StandingTileFrame8 + dw NULL, DoneTileAnimation +; 0xfc15f + +TilesetGym1Anim: ; 0xfc15f + dw NULL, LavaBubbleAnim2 + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, LavaBubbleAnim1 + dw NULL, WaitTileAnimation + dw NULL, StandingTileFrame8 + dw NULL, DoneTileAnimation +; 0xfc17f + +UnusedTilesetAnim_fc17f: ; 0xfc17f + dw vTiles2 tile $53, WriteTileToBuffer + dw wTileAnimBuffer, ScrollTileDown + dw wTileAnimBuffer, ScrollTileDown + dw vTiles2 tile $53, WriteTileFromBuffer + dw vTiles2 tile $03, WriteTileToBuffer + dw wTileAnimBuffer, ScrollTileRightLeft + dw vTiles2 tile $03, WriteTileFromBuffer + dw vTiles2 tile $53, WriteTileToBuffer + dw wTileAnimBuffer, ScrollTileDown + dw wTileAnimBuffer, ScrollTileDown + dw vTiles2 tile $53, WriteTileFromBuffer + dw NULL, DoneTileAnimation +; 0xfc1af + +UnusedTilesetAnim_fc1af: ; 0xfc1af + dw vTiles2 tile $54, WriteTileToBuffer + dw wTileAnimBuffer, ScrollTileDown + dw wTileAnimBuffer, ScrollTileDown + dw vTiles2 tile $54, WriteTileFromBuffer + dw NULL, WaitTileAnimation + dw vTiles2 tile $03, WriteTileToBuffer + dw wTileAnimBuffer, ScrollTileRightLeft + dw vTiles2 tile $03, WriteTileFromBuffer + dw NULL, WaitTileAnimation + dw vTiles2 tile $54, WriteTileToBuffer + dw wTileAnimBuffer, ScrollTileDown + dw wTileAnimBuffer, ScrollTileDown + dw vTiles2 tile $54, WriteTileFromBuffer + dw NULL, DoneTileAnimation +; 0xfc1e7 + +TilesetCaveAnim: ; 0xfc1e7 +TilesetWhirlIslandsAnim: ; 0xfc1e7 + dw vTiles2 tile $14, WriteTileToBuffer + dw NULL, FlickeringCaveEntrancePalette + dw wTileAnimBuffer, ScrollTileRightLeft + dw NULL, FlickeringCaveEntrancePalette + dw vTiles2 tile $14, WriteTileFromBuffer + dw NULL, FlickeringCaveEntrancePalette + dw NULL, TileAnimationPalette + dw NULL, FlickeringCaveEntrancePalette + dw vTiles2 tile $40, WriteTileToBuffer + dw NULL, FlickeringCaveEntrancePalette + dw wTileAnimBuffer, ScrollTileDown + dw NULL, FlickeringCaveEntrancePalette + dw wTileAnimBuffer, ScrollTileDown + dw NULL, FlickeringCaveEntrancePalette + dw wTileAnimBuffer, ScrollTileDown + dw NULL, FlickeringCaveEntrancePalette + dw vTiles2 tile $40, WriteTileFromBuffer + dw NULL, FlickeringCaveEntrancePalette + dw NULL, DoneTileAnimation +; 0xfc233 + +TilesetIcePathAnim: ; 0xfc233 + dw vTiles2 tile $35, WriteTileToBuffer + dw NULL, FlickeringCaveEntrancePalette + dw wTileAnimBuffer, ScrollTileRightLeft + dw NULL, FlickeringCaveEntrancePalette + dw vTiles2 tile $35, WriteTileFromBuffer + dw NULL, FlickeringCaveEntrancePalette + dw NULL, TileAnimationPalette + dw NULL, FlickeringCaveEntrancePalette + dw vTiles2 tile $31, WriteTileToBuffer + dw NULL, FlickeringCaveEntrancePalette + dw wTileAnimBuffer, ScrollTileDown + dw NULL, FlickeringCaveEntrancePalette + dw wTileAnimBuffer, ScrollTileDown + dw NULL, FlickeringCaveEntrancePalette + dw wTileAnimBuffer, ScrollTileDown + dw NULL, FlickeringCaveEntrancePalette + dw vTiles2 tile $31, WriteTileFromBuffer + dw NULL, FlickeringCaveEntrancePalette + dw NULL, DoneTileAnimation +; 0xfc27f + +TilesetSproutTowerAnim: ; 0xfc27f + dw SproutPillarTilePointer9, AnimateSproutPillarTile + dw SproutPillarTilePointer10, AnimateSproutPillarTile + dw SproutPillarTilePointer7, AnimateSproutPillarTile + dw SproutPillarTilePointer8, AnimateSproutPillarTile + dw SproutPillarTilePointer5, AnimateSproutPillarTile + dw SproutPillarTilePointer6, AnimateSproutPillarTile + dw SproutPillarTilePointer3, AnimateSproutPillarTile + dw SproutPillarTilePointer4, AnimateSproutPillarTile + dw SproutPillarTilePointer1, AnimateSproutPillarTile + dw SproutPillarTilePointer2, AnimateSproutPillarTile + dw NULL, StandingTileFrame + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, DoneTileAnimation +; 0xfc2bf + +UnusedTilesetAnim_fc2bf: ; 0xfc2bf + dw vTiles2 tile $4f, WriteTileToBuffer + dw wTileAnimBuffer, ScrollTileRightLeft + dw vTiles2 tile $4f, WriteTileFromBuffer + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, DoneTileAnimation +; 0xfc2e7 + +TilesetBattleTowerOutsideAnim: ; 0xfc2e7 +TilesetHouse1Anim: ; 0xfc2e7 +TilesetPlayersHouseAnim: ; 0xfc2e7 +TilesetPokecenterAnim: ; 0xfc2e7 +TilesetGateAnim: ; 0xfc2e7 +TilesetLabAnim: ; 0xfc2e7 +TilesetPowerPlantAnim: ; 0xfc2e7 +TilesetMartAnim: ; 0xfc2e7 +TilesetCeladonMansionAnim: ; 0xfc2e7 +TilesetGameCornerAnim: ; 0xfc2e7 +TilesetKurtsHouseAnim: ; 0xfc2e7 +TilesetTrainStationAnim: ; 0xfc2e7 +TilesetOlivineGymAnim: ; 0xfc2e7 +TilesetLighthouseAnim: ; 0xfc2e7 +TilesetPlayersHouse2FAnim: ; 0xfc2e7 +TilesetPokeComCenterAnim: ; 0xfc2e7 +TilesetBattleTowerAnim: ; 0xfc2e7 +TilesetRuinsOfAlphAnim: ; 0xfc2e7 +TilesetRadioTowerAnim: ; 0xfc2e7 +TilesetUndergroundAnim: ; 0xfc2e7 +TilesetBetaWordRoomAnim: ; 0xfc2e7 +TilesetHoOhWordRoomAnim: ; 0xfc2e7 +TilesetKabutoWordRoomAnim: ; 0xfc2e7 +TilesetOmanyteWordRoomAnim: ; 0xfc2e7 +TilesetAerodactylWordRoomAnim: ; 0xfc2e7 + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, WaitTileAnimation + dw NULL, DoneTileAnimation +; 0xfc2fb + +DoneTileAnimation: ; fc2fb +; Reset the animation command loop. + xor a + ld [hTileAnimFrame], a + +WaitTileAnimation: ; fc2fe +; Do nothing this frame. + ret +; fc2ff + +StandingTileFrame8: ; fc2ff + ld a, [TileAnimationTimer] + inc a + and %111 + ld [TileAnimationTimer], a + ret +; fc309 + + +ScrollTileRightLeft: ; fc309 +; Scroll right for 4 ticks, then left for 4 ticks. + ld a, [TileAnimationTimer] + inc a + and %111 + ld [TileAnimationTimer], a + and %100 + jr nz, ScrollTileLeft + jr ScrollTileRight +; fc318 + +ScrollTileUpDown: ; fc318 +; Scroll up for 4 ticks, then down for 4 ticks. + ld a, [TileAnimationTimer] + inc a + and %111 + ld [TileAnimationTimer], a + and %100 + jr nz, ScrollTileDown + jr ScrollTileUp +; fc327 + +ScrollTileLeft: ; fc327 + ld h, d + ld l, e + ld c, 4 +.loop +rept 4 + ld a, [hl] + rlca + ld [hli], a +endr + dec c + jr nz, .loop + ret +; fc33b + +ScrollTileRight: ; fc33b + ld h, d + ld l, e + ld c, 4 +.loop +rept 4 + ld a, [hl] + rrca + ld [hli], a +endr + dec c + jr nz, .loop + ret +; fc34f + +ScrollTileUp: ; fc34f + ld h, d + ld l, e + ld d, [hl] + inc hl + ld e, [hl] + ld bc, TILE_WIDTH * 2 - 2 + add hl, bc + ld a, TILE_WIDTH / 2 +.loop + ld c, [hl] + ld [hl], e + dec hl + ld b, [hl] + ld [hl], d + dec hl + ld e, [hl] + ld [hl], c + dec hl + ld d, [hl] + ld [hl], b + dec hl + dec a + jr nz, .loop + ret +; fc36a + +ScrollTileDown: ; fc36a + ld h, d + ld l, e + ld de, TILE_WIDTH * 2 - 2 + push hl + add hl, de + ld d, [hl] + inc hl + ld e, [hl] + pop hl + ld a, TILE_WIDTH / 2 +.loop + ld b, [hl] + ld [hl], d + inc hl + ld c, [hl] + ld [hl], e + inc hl + ld d, [hl] + ld [hl], b + inc hl + ld e, [hl] + ld [hl], c + inc hl + dec a + jr nz, .loop + ret +; fc387 + + +AnimateFountain: ; fc387 + ld hl, sp+0 + ld b, h + ld c, l + ld hl, .frames + ld a, [TileAnimationTimer] + and %111 + add a + add l + ld l, a + jr nc, .okay + inc h +.okay + ld a, [hli] + ld h, [hl] + ld l, a + ld sp, hl + ld l, e + ld h, d + jp WriteTile + +.frames + dw .frame1 + dw .frame2 + dw .frame3 + dw .frame4 + dw .frame3 + dw .frame4 + dw .frame5 + dw .frame1 + +.frame1 INCBIN "gfx/tilesets/fountain/1.2bpp" +.frame2 INCBIN "gfx/tilesets/fountain/2.2bpp" +.frame3 INCBIN "gfx/tilesets/fountain/3.2bpp" +.frame4 INCBIN "gfx/tilesets/fountain/4.2bpp" +.frame5 INCBIN "gfx/tilesets/fountain/5.2bpp" +; fc402 + + +AnimateWaterTile: ; fc402 +; Draw a water tile for the current frame in VRAM tile at de. + +; Save sp in bc (see WriteTile). + ld hl, sp+0 + ld b, h + ld c, l + + ld a, [TileAnimationTimer] + +; 4 tile graphics, updated every other frame. + and %110 + +; 2 x 8 = 16 bytes per tile + add a + add a + add a + + add LOW(WaterTileFrames) + ld l, a + ld a, 0 + adc HIGH(WaterTileFrames) + ld h, a + +; Stack now points to the start of the tile for this frame. + ld sp, hl + + ld l, e + ld h, d + + jp WriteTile +; fc41c + +WaterTileFrames: ; fc41c + INCBIN "gfx/tilesets/water/water.2bpp" +; fc45c + + +ForestTreeLeftAnimation: ; fc45c + ld hl, sp+0 + ld b, h + ld c, l + +; Only during the Celebi event. + ld a, [wCelebiEvent] + bit 2, a + jr nz, .asm_fc46c + ld hl, ForestTreeLeftFrames + jr .asm_fc47d + +.asm_fc46c + ld a, [TileAnimationTimer] + call GetForestTreeFrame + add a + add a + add a + add LOW(ForestTreeLeftFrames) + ld l, a + ld a, 0 + adc HIGH(ForestTreeLeftFrames) + ld h, a + +.asm_fc47d + ld sp, hl + ld hl, vTiles2 tile $0c + jp WriteTile +; fc484 + + +ForestTreeLeftFrames: ; fc484 + INCBIN "gfx/tilesets/forest-tree/1.2bpp" + INCBIN "gfx/tilesets/forest-tree/2.2bpp" +; fc4a4 + +ForestTreeRightFrames: ; fc4a4 + INCBIN "gfx/tilesets/forest-tree/3.2bpp" + INCBIN "gfx/tilesets/forest-tree/4.2bpp" +; fc4c4 + + +ForestTreeRightAnimation: ; fc4c4 + ld hl, sp+0 + ld b, h + ld c, l + +; Only during the Celebi event. + ld a, [wCelebiEvent] + bit 2, a + jr nz, .asm_fc4d4 + ld hl, ForestTreeRightFrames + jr .asm_fc4eb + +.asm_fc4d4 + ld a, [TileAnimationTimer] + call GetForestTreeFrame + add a + add a + add a + add LOW(ForestTreeLeftFrames) + ld l, a + ld a, 0 + adc HIGH(ForestTreeLeftFrames) + ld h, a + push bc + ld bc, ForestTreeRightFrames - ForestTreeLeftFrames + add hl, bc + pop bc + +.asm_fc4eb + ld sp, hl + ld hl, vTiles2 tile $0f + jp WriteTile +; fc4f2 + + +ForestTreeLeftAnimation2: ; fc4f2 + ld hl, sp+0 + ld b, h + ld c, l + +; Only during the Celebi event. + ld a, [wCelebiEvent] + bit 2, a + jr nz, .asm_fc502 + ld hl, ForestTreeLeftFrames + jr .asm_fc515 + +.asm_fc502 + ld a, [TileAnimationTimer] + call GetForestTreeFrame + xor 2 + add a + add a + add a + add LOW(ForestTreeLeftFrames) + ld l, a + ld a, 0 + adc HIGH(ForestTreeLeftFrames) + ld h, a + +.asm_fc515 + ld sp, hl + ld hl, vTiles2 tile $0c + jp WriteTile +; fc51c + + +ForestTreeRightAnimation2: ; fc51c + ld hl, sp+0 + ld b, h + ld c, l + +; Only during the Celebi event. + ld a, [wCelebiEvent] + bit 2, a + jr nz, .asm_fc52c + ld hl, ForestTreeRightFrames + jr .asm_fc545 + +.asm_fc52c + ld a, [TileAnimationTimer] + call GetForestTreeFrame + xor 2 + add a + add a + add a + add LOW(ForestTreeLeftFrames) + ld l, a + ld a, 0 + adc HIGH(ForestTreeLeftFrames) + ld h, a + push bc + ld bc, ForestTreeRightFrames - ForestTreeLeftFrames + add hl, bc + pop bc + +.asm_fc545 + ld sp, hl + ld hl, vTiles2 tile $0f + jp WriteTile +; fc54c + + +GetForestTreeFrame: ; fc54c +; Return 0 if a is even, or 2 if odd. + and a + jr z, .even + cp 1 + jr z, .odd + cp 2 + jr z, .even + cp 3 + jr z, .odd + cp 4 + jr z, .even + cp 5 + jr z, .odd + cp 6 + jr z, .even +.odd + ld a, 2 + scf + ret +.even + xor a + ret +; fc56d + + +AnimateFlowerTile: ; fc56d +; No parameters. + +; Save sp in bc (see WriteTile). + ld hl, sp+0 + ld b, h + ld c, l + +; Alternate tile graphic every other frame + ld a, [TileAnimationTimer] + and %10 + ld e, a + +; CGB has different color mappings for flowers. + ld a, [hCGB] + and 1 + + add e + swap a + ld e, a + ld d, 0 + ld hl, FlowerTileFrames + add hl, de + ld sp, hl + + ld hl, vTiles2 tile $03 + + jp WriteTile +; fc58c + +FlowerTileFrames: ; fc58c + INCBIN "gfx/tilesets/flower/dmg_1.2bpp" + INCBIN "gfx/tilesets/flower/cgb_1.2bpp" + INCBIN "gfx/tilesets/flower/dmg_2.2bpp" + INCBIN "gfx/tilesets/flower/cgb_2.2bpp" +; fc5cc + + +LavaBubbleAnim1: ; fc5cc +; Splash in the bottom-right corner of the fountain. + ld hl, sp+0 + ld b, h + ld c, l + ld a, [TileAnimationTimer] + and %110 + srl a + inc a + inc a + and %011 + swap a + ld e, a + ld d, 0 + ld hl, LavaBubbleFrames + add hl, de + ld sp, hl + ld hl, vTiles2 tile $5b + jp WriteTile +; fc5eb + + +LavaBubbleAnim2: ; fc5eb +; Splash in the top-left corner of the fountain. + ld hl, sp+0 + ld b, h + ld c, l + ld a, [TileAnimationTimer] + and %110 + add a + add a + add a + ld e, a + ld d, 0 + ld hl, LavaBubbleFrames + add hl, de + ld sp, hl + ld hl, vTiles2 tile $38 + jp WriteTile +; fc605 + + +LavaBubbleFrames: ; fc605 + INCBIN "gfx/tilesets/lava/1.2bpp" + INCBIN "gfx/tilesets/lava/2.2bpp" + INCBIN "gfx/tilesets/lava/3.2bpp" + INCBIN "gfx/tilesets/lava/4.2bpp" +; fc645 + + +AnimateSproutPillarTile: ; fc645 +; Read from struct at de: +; Destination (VRAM) +; Address of the first tile in the frame array + + ld hl, sp+0 + ld b, h + ld c, l + + ld a, [TileAnimationTimer] + and %111 + +; Get frame index a + ld hl, .frames + add l + ld l, a + ld a, 0 + adc h + ld h, a + ld a, [hl] + +; Destination + ld l, e + ld h, d + ld e, [hl] + inc hl + ld d, [hl] + inc hl + +; Add the frame index to the starting address + add [hl] + inc hl + ld h, [hl] + ld l, a + ld a, 0 + adc h + ld h, a + + ld sp, hl + ld l, e + ld h, d + jr WriteTile + +.frames + db $00, $10, $20, $30, $40, $30, $20, $10 +; fc673 + + +StandingTileFrame: ; fc673 + ld hl, TileAnimationTimer + inc [hl] + ret +; fc678 + + +AnimateWhirlpoolTile: ; fc678 +; Update whirlpool tile using struct at de. + +; Struct: +; VRAM address +; Address of the first tile + +; Only does one of 4 tiles at a time. + +; Save sp in bc (see WriteTile). + ld hl, sp+0 + ld b, h + ld c, l + +; de = VRAM address + ld l, e + ld h, d + ld e, [hl] + inc hl + ld d, [hl] + inc hl +; Tile address is now at hl. + +; Get the tile for this frame. + ld a, [TileAnimationTimer] + and %11 ; 4 frames x2 + swap a ; * 16 bytes per tile + + add [hl] + inc hl + ld h, [hl] + ld l, a + ld a, 0 + adc h + ld h, a + +; Stack now points to the desired frame. + ld sp, hl + + ld l, e + ld h, d + + jr WriteTile +; fc696 + + +WriteTileFromBuffer: ; fc696 +; Write tiledata at wTileAnimBuffer to de. +; wTileAnimBuffer is loaded to sp for WriteTile. + + ld hl, sp+0 + ld b, h + ld c, l + + ld hl, wTileAnimBuffer + ld sp, hl + + ld h, d + ld l, e + jr WriteTile +; fc6a2 + + +WriteTileToBuffer: ; fc6a2 +; Write tiledata de to wTileAnimBuffer. +; de is loaded to sp for WriteTile. + + ld hl, sp+0 + ld b, h + ld c, l + + ld h, d + ld l, e + ld sp, hl + + ld hl, wTileAnimBuffer + + ; fallthrough + +WriteTile: ; fc6ac +; Write one 8x8 tile ($10 bytes) from sp to hl. + +; Warning: sp is saved in bc so we can abuse pop. +; sp is restored to address bc. Save sp in bc before calling. + + pop de + ld [hl], e + inc hl + ld [hl], d + +rept 7 + pop de + inc hl + ld [hl], e + inc hl + ld [hl], d +endr + +; restore sp + ld h, b + ld l, c + ld sp, hl + ret +; fc6d7 + + +TileAnimationPalette: ; fc6d7 +; Transition between color values 0-2 for color 0 in palette 3. + +; No palette changes on DMG. + ld a, [hCGB] + and a + ret z + +; We don't want to mess with non-standard palettes. + ld a, [rBGP] ; BGP + cp %11100100 + ret nz + +; Only update on even frames. + ld a, [TileAnimationTimer] + ld l, a + and 1 ; odd + ret nz + +; Ready for BGPD input... + + ld a, (1 << rBGPI_AUTO_INCREMENT) palette PAL_BG_WATER + ld [rBGPI], a + + ld a, [rSVBK] + push af + ld a, BANK(wBGPals1) + ld [rSVBK], a + +; Update color 0 in order 0 1 2 1 + ld a, l + and %110 ; frames 0 2 4 6 + jr z, .color0 + cp %100 ; frame 4 + jr z, .color2 + +.color1 + ld hl, wBGPals1 palette PAL_BG_WATER + 2 + ld a, [hli] + ld [rBGPD], a + ld a, [hli] + ld [rBGPD], a + jr .end + +.color0 + ld hl, wBGPals1 palette PAL_BG_WATER + ld a, [hli] + ld [rBGPD], a + ld a, [hli] + ld [rBGPD], a + jr .end + +.color2 + ld hl, wBGPals1 palette PAL_BG_WATER + 4 + ld a, [hli] + ld [rBGPD], a + ld a, [hli] + ld [rBGPD], a + +.end + pop af + ld [rSVBK], a + ret +; fc71e + + +FlickeringCaveEntrancePalette: ; fc71e +; No palette changes on DMG. + ld a, [hCGB] + and a + ret z +; We don't want to mess with non-standard palettes. + ld a, [rBGP] + cp %11100100 + ret nz +; We only want to be here if we're in a dark cave. + ld a, [wTimeOfDayPalset] + cp %11111111 ; 3,3,3,3 + ret nz + + ld a, [rSVBK] + push af + ld a, BANK(wBGPals1) + ld [rSVBK], a +; Ready for BGPD input... + ld a, (1 << rBGPI_AUTO_INCREMENT) palette PAL_BG_YELLOW + ld [rBGPI], a + ld a, [hVBlankCounter] + and %10 + jr nz, .bit1set + ld hl, wBGPals1 palette PAL_BG_YELLOW + jr .okay + +.bit1set + ld hl, wBGPals1 palette PAL_BG_YELLOW + 2 + +.okay + ld a, [hli] + ld [rBGPD], a + ld a, [hli] + ld [rBGPD], a + + pop af + ld [rSVBK], a + ret +; fc750 + + +SproutPillarTilePointer1: dw vTiles2 tile $2d, SproutPillarTile1 +SproutPillarTilePointer2: dw vTiles2 tile $2f, SproutPillarTile2 +SproutPillarTilePointer3: dw vTiles2 tile $3d, SproutPillarTile3 +SproutPillarTilePointer4: dw vTiles2 tile $3f, SproutPillarTile4 +SproutPillarTilePointer5: dw vTiles2 tile $3c, SproutPillarTile5 +SproutPillarTilePointer6: dw vTiles2 tile $2c, SproutPillarTile6 +SproutPillarTilePointer7: dw vTiles2 tile $4d, SproutPillarTile7 +SproutPillarTilePointer8: dw vTiles2 tile $4f, SproutPillarTile8 +SproutPillarTilePointer9: dw vTiles2 tile $5d, SproutPillarTile9 +SproutPillarTilePointer10: dw vTiles2 tile $5f, SproutPillarTile10 + +SproutPillarTile1: INCBIN "gfx/tilesets/sprout-pillar/1.2bpp" +SproutPillarTile2: INCBIN "gfx/tilesets/sprout-pillar/2.2bpp" +SproutPillarTile3: INCBIN "gfx/tilesets/sprout-pillar/3.2bpp" +SproutPillarTile4: INCBIN "gfx/tilesets/sprout-pillar/4.2bpp" +SproutPillarTile5: INCBIN "gfx/tilesets/sprout-pillar/5.2bpp" +SproutPillarTile6: INCBIN "gfx/tilesets/sprout-pillar/6.2bpp" +SproutPillarTile7: INCBIN "gfx/tilesets/sprout-pillar/7.2bpp" +SproutPillarTile8: INCBIN "gfx/tilesets/sprout-pillar/8.2bpp" +SproutPillarTile9: INCBIN "gfx/tilesets/sprout-pillar/9.2bpp" +SproutPillarTile10: INCBIN "gfx/tilesets/sprout-pillar/10.2bpp" +; fca98 + + +WhirlpoolFrames1: dw vTiles2 tile $32, WhirlpoolTiles1 +WhirlpoolFrames2: dw vTiles2 tile $33, WhirlpoolTiles2 +WhirlpoolFrames3: dw vTiles2 tile $42, WhirlpoolTiles3 +WhirlpoolFrames4: dw vTiles2 tile $43, WhirlpoolTiles4 +; fcaa8 + +WhirlpoolTiles1: INCBIN "gfx/tilesets/whirlpool/1.2bpp" +WhirlpoolTiles2: INCBIN "gfx/tilesets/whirlpool/2.2bpp" +WhirlpoolTiles3: INCBIN "gfx/tilesets/whirlpool/3.2bpp" +WhirlpoolTiles4: INCBIN "gfx/tilesets/whirlpool/4.2bpp" +; fcba8 diff --git a/engine/tileset_palettes.asm b/engine/tileset_palettes.asm new file mode 100644 index 000000000..458d8e440 --- /dev/null +++ b/engine/tileset_palettes.asm @@ -0,0 +1,200 @@ +LoadSpecialMapPalette: ; 494ac + ld a, [wTileset] + cp TILESET_POKECOM_CENTER + jr z, .pokecom_2f + cp TILESET_BATTLE_TOWER + jr z, .battle_tower + cp TILESET_ICE_PATH + jr z, .ice_path + cp TILESET_HOUSE_1 + jr z, .house + cp TILESET_RADIO_TOWER + jr z, .radio_tower + cp TILESET_CELADON_MANSION + jr z, .mansion_mobile + jr .do_nothing + +.pokecom_2f + call LoadPokeComPalette + scf + ret + +.battle_tower + call LoadBattleTowerPalette + scf + ret + +.ice_path + ld a, [wEnvironment] + and $7 + cp INDOOR ; Hall of Fame + jr z, .do_nothing + call LoadIcePathPalette + scf + ret + +.house + call LoadHousePalette + scf + ret + +.radio_tower + call LoadRadioTowerPalette + scf + ret + +.mansion_mobile + call LoadMansionPalette + scf + ret + +.do_nothing + and a + ret +; 494f2 + +LoadPokeComPalette: ; 494f2 + ld a, BANK(wBGPals1) + ld de, wBGPals1 + ld hl, PokeComPalette + ld bc, 8 palettes + call FarCopyWRAM + ret +; 49501 + +PokeComPalette: ; 49501 +INCLUDE "gfx/tilesets/pokecom_center.pal" +; 49541 + +LoadBattleTowerPalette: ; 49541 + ld a, BANK(wBGPals1) + ld de, wBGPals1 + ld hl, BattleTowerPalette + ld bc, 8 palettes + call FarCopyWRAM + ret +; 49550 + +BattleTowerPalette: ; 49550 +INCLUDE "gfx/tilesets/battle_tower.pal" +; 49590 + +LoadIcePathPalette: ; 49590 + ld a, BANK(wBGPals1) + ld de, wBGPals1 + ld hl, IcePathPalette + ld bc, 8 palettes + call FarCopyWRAM + ret +; 4959f + +IcePathPalette: ; 4959f +INCLUDE "gfx/tilesets/ice_path.pal" +; 495df + +LoadHousePalette: ; 495df + ld a, BANK(wBGPals1) + ld de, wBGPals1 + ld hl, HousePalette + ld bc, 8 palettes + call FarCopyWRAM + ret +; 495ee + +HousePalette: ; 495ee +INCLUDE "gfx/tilesets/house_1.pal" +; 4962e + +LoadRadioTowerPalette: ; 4962e + ld a, BANK(wBGPals1) + ld de, wBGPals1 + ld hl, RadioTowerPalette + ld bc, 8 palettes + call FarCopyWRAM + ret +; 4963d + +RadioTowerPalette: ; 4963d +INCLUDE "gfx/tilesets/radio_tower.pal" +; 4967d + +MansionPalette1: ; 4967d + RGB 30, 28, 26 + RGB 19, 19, 19 + RGB 13, 13, 13 + RGB 07, 07, 07 + + RGB 30, 28, 26 + RGB 31, 19, 24 + RGB 30, 10, 06 + RGB 07, 07, 07 + + RGB 18, 24, 09 + RGB 15, 20, 01 + RGB 09, 13, 00 + RGB 07, 07, 07 + + RGB 30, 28, 26 + RGB 15, 16, 31 + RGB 09, 09, 31 + RGB 07, 07, 07 + + RGB 30, 28, 26 + RGB 31, 31, 07 + RGB 31, 16, 01 + RGB 07, 07, 07 + + RGB 26, 24, 17 + RGB 21, 17, 07 + RGB 16, 13, 03 + RGB 07, 07, 07 + +MansionPalette3: ; 496ad + RGB 30, 28, 26 + RGB 17, 19, 31 + RGB 14, 16, 31 + RGB 07, 07, 07 + + RGB 31, 31, 16 + RGB 31, 31, 16 + RGB 14, 09, 00 + RGB 00, 00, 00 +; 496bd + +MansionPalette4: ; 496bd + RGB 05, 05, 16 + RGB 08, 19, 28 + RGB 00, 00, 00 + RGB 31, 31, 31 +; 496c5 + +LoadMansionPalette: ; 496c5 + ld a, BANK(wBGPals1) + ld de, wBGPals1 + ld hl, MansionPalette1 + ld bc, 8 palettes + call FarCopyWRAM + ld a, BANK(wBGPals1) + ld de, wBGPals1 palette PAL_BG_YELLOW + ld hl, MansionPalette2 + ld bc, 1 palettes + call FarCopyWRAM + ld a, BANK(wBGPals1) + ld de, wBGPals1 palette PAL_BG_WATER + ld hl, MansionPalette3 + ld bc, 1 palettes + call FarCopyWRAM + ld a, BANK(wBGPals1) + ld de, wBGPals1 palette PAL_BG_ROOF + ld hl, MansionPalette4 + ld bc, 1 palettes + call FarCopyWRAM + ret +; 496fe + +MansionPalette2: ; 496fe + RGB 25, 24, 23 + RGB 20, 19, 19 + RGB 14, 16, 31 + RGB 07, 07, 07 +; 49706 -- cgit v1.2.3 From ee4ec65fc17a802425b606eeef59e92a9a6c9b81 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 10 Jan 2018 02:30:17 -0500 Subject: map_objects.pal is easier to find in gfx/overworld/ than gfx/sprites/ --- engine/battle/battle_transition.asm | 2 +- engine/color.asm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index af7bb688f..383674652 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -589,7 +589,7 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) dec b jr nz, .loop - call .loadpokeballgfx ; ld a, [OtherTrainerClass] \ ld de, PokeBallTransition \ ret + call .loadpokeballgfx hlcoord 2, 1 ld b, SCREEN_WIDTH - 4 diff --git a/engine/color.asm b/engine/color.asm index 8bd79fd3b..58a2c0df8 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -1341,7 +1341,7 @@ TilesetBGPalette: INCLUDE "gfx/tilesets/bg_tiles.pal" MapObjectPals:: -INCLUDE "gfx/sprites/map_objects.pal" +INCLUDE "gfx/overworld/map_objects.pal" RoofPals: INCLUDE "gfx/tilesets/roofs.pal" -- cgit v1.2.3 From 7de7441e72f12ba1518504055acdec741bf4db74 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 10 Jan 2018 02:38:45 -0500 Subject: gfx/*.asm files have INCBINs --- engine/mapgroup_roofs.asm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engine') diff --git a/engine/mapgroup_roofs.asm b/engine/mapgroup_roofs.asm index 72999efc6..2cd734234 100644 --- a/engine/mapgroup_roofs.asm +++ b/engine/mapgroup_roofs.asm @@ -5,13 +5,13 @@ LoadMapGroupRoof:: ; 1c000 ld hl, MapGroupRoofs add hl, de ld a, [hl] - cp $ff + cp -1 ret z ld hl, Roofs - ld bc, $90 + ld bc, 9 tiles call AddNTimes ld de, vTiles2 tile $0a - ld bc, $90 + ld bc, 9 tiles call CopyBytes ret ; 1c021 -- cgit v1.2.3 From 16eb97ae9cca0ce52531860c499c3346e6a2cf9e Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 10 Jan 2018 02:55:44 -0500 Subject: Constant swap explains this Battle Tower bug --- engine/events/battle_tower/load_trainer.asm | 13 ++++++++----- engine/events/battle_tower/rules.asm | 6 +++--- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'engine') diff --git a/engine/events/battle_tower/load_trainer.asm b/engine/events/battle_tower/load_trainer.asm index bf8b20a27..08571dcef 100644 --- a/engine/events/battle_tower/load_trainer.asm +++ b/engine/events/battle_tower/load_trainer.asm @@ -27,11 +27,14 @@ Function_LoadOpponentTrainerAndPokemons: ; 1f8000 add b ld b, a ; b contains the nr of the trainer if DEF(_CRYSTAL11) - and $7f + and BATTLETOWER_TRAINER_MASK + cp BATTLETOWER_NUM_UNIQUE_TRAINERS else - and $1f +; Crystal 1.0 used the wrong constants here, so only the first 21 +; trainers in BattleTowerTrainers can be sampled. + and BATTLETOWER_PKMN_MASK + cp BATTLETOWER_NUM_UNIQUE_PKMN endc - cp (BattleTowerTrainersEnd - BattleTowerTrainers) / NAME_LENGTH jr nc, .resample ld b, a @@ -112,8 +115,8 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081 ld a, [hRandomAdd] add b ld b, a - and $1f - cp BATTLETOWER_NROFPKMNS * BATTLETOWER_NROFTRAINERS + and BATTLETOWER_PKMN_MASK + cp BATTLETOWER_NUM_UNIQUE_PKMN jr nc, .resample ; in register 'a' is the chosen Pkmn of the LevelGroup diff --git a/engine/events/battle_tower/rules.asm b/engine/events/battle_tower/rules.asm index de6022145..8d037951b 100644 --- a/engine/events/battle_tower/rules.asm +++ b/engine/events/battle_tower/rules.asm @@ -213,7 +213,7 @@ BattleTower_ExecuteJumptable: ; 8b25b BattleTower_CheckPartyLengthIs3: ; 8b2bb ld a, [PartyCount] - cp 3 + cp BATTLETOWER_NROFPKMNS ret ; 8b2c1 @@ -235,13 +235,13 @@ BattleTower_CheckPartyHasThreeMonsThatAreNotEggs: ; 8b2c1 cp b ret z ld a, b - cp 3 + cp BATTLETOWER_NROFPKMNS ret ; 8b2da Function_PartyCountEq3: ; 8b2da ld a, [PartyCount] - cp 3 + cp BATTLETOWER_NROFPKMNS ret z scf ret -- cgit v1.2.3 From 22b607b664b1b350ad96340b39440c8e4296006c Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 10 Jan 2018 11:30:12 -0500 Subject: Move radio channel data into data/ --- engine/radio.asm | 136 ++++++++++++++++--------------------------------------- 1 file changed, 39 insertions(+), 97 deletions(-) (limited to 'engine') diff --git a/engine/radio.asm b/engine/radio.asm index 42db63ab0..54cee3894 100644 --- a/engine/radio.asm +++ b/engine/radio.asm @@ -28,6 +28,7 @@ PlayRadioShow: jp hl RadioJumptable: +; entries correspond to constants/radio_constants.asm dw OaksPkmnTalk1 ; $00 dw PokedexShow1 ; $01 dw BenMonMusic1 ; $02 @@ -203,11 +204,11 @@ OaksPkmnTalk4: ; Choose a random route, and a random Pokemon from that route. .sample call Random - and $1f - cp $f ; so wasteful + and %11111 + cp (OaksPkmnTalkRoutesEnd - OaksPkmnTalkRoutes) / 2 jr nc, .sample ; We now have a number between 0 and 14. - ld hl, .routes + ld hl, OaksPkmnTalkRoutes ld c, a ld b, 0 add hl, bc @@ -239,14 +240,15 @@ OaksPkmnTalk4: jr .loop .done + ; Point hl to the list of morning Pokémon., skipping percentages rept 4 inc hl endr ; Generate a number, either 0, 1, or 2, to choose a time of day. .loop2 call Random - and 3 - cp 3 + and $3 + cp DARKNESS_F jr z, .loop2 ld bc, 2 * NUM_GRASSMON @@ -273,6 +275,7 @@ endr ld de, wMonOrItemNameBuffer ld bc, PKMN_NAME_LENGTH call CopyBytes + ; Now that we've chosen our wild Pokemon, ; let's recover the map index info and get its name. pop bc @@ -289,22 +292,7 @@ endr ld a, OAKS_POKEMON_TALK jp PrintRadioLine -.routes - map ROUTE_29 - map ROUTE_46 - map ROUTE_30 - map ROUTE_32 - map ROUTE_34 - map ROUTE_35 - map ROUTE_37 - map ROUTE_38 - map ROUTE_39 - map ROUTE_42 - map ROUTE_43 - map ROUTE_44 - map ROUTE_45 - map ROUTE_36 - map ROUTE_31 +INCLUDE "data/radio/oaks_pkmn_talk_routes.asm" OaksPkmnTalk5: ld hl, OPT_OakText2 @@ -361,7 +349,7 @@ OPT_MaryText1: OaksPkmnTalk8: call Random - and $f + and $f ; 0-15 are all the valid indexes into .Descriptors ld e, a ld d, 0 ld hl, .Descriptors @@ -473,7 +461,7 @@ OaksPkmnTalk8: OaksPkmnTalk9: call Random - and $f + and $f ; 0-15 are all the valid indexes into .Descriptors ld e, a ld d, 0 ld hl, .Descriptors @@ -652,7 +640,7 @@ OaksPkmnTalk14: ld hl, wRadioTextDelay dec [hl] ret nz - ld de, $1d + ld de, MUSIC_POKEMON_TALK callfar RadioMusicRestartDE ld hl, .terminator call PrintText @@ -1146,7 +1134,7 @@ PeoplePlaces2: PeoplePlaces3: ld hl, PnP_Text3 call Random - cp $7b ; 48 percent + cp 49 percent - 1 ld a, PLACES_AND_PEOPLE_4 ; People jr c, .ok ld a, PLACES_AND_PEOPLE_6 ; Places @@ -1175,15 +1163,15 @@ PeoplePlaces4: ; People cp NUM_TRAINER_CLASSES - 1 jr nc, PeoplePlaces4 push af - ld hl, .E4Names + ld hl, PnP_HiddenPeople ld a, [wStatusFlags] bit 6, a ; ENGINE_CREDITS_SKIP jr z, .ok - ld hl, .KantoLeaderNames + ld hl, PnP_HiddenPeople_BeatE4 ld a, [wKantoBadges] - cp %11111111 + cp %11111111 ; all badges jr nz, .ok - ld hl, .MiscNames + ld hl, PnP_HiddenPeople_BeatKanto .ok pop af ld c, a @@ -1203,10 +1191,7 @@ PeoplePlaces4: ; People ld a, PLACES_AND_PEOPLE_5 jp NextRadioLine -.E4Names: db WILL, BRUNO, KAREN, KOGA, CHAMPION -.KantoLeaderNames: db BROCK, MISTY, LT_SURGE, ERIKA, JANINE, SABRINA, BLAINE, BLUE -.MiscNames: db RIVAL1, POKEMON_PROF, CAL, RIVAL2, RED - db -1 +INCLUDE "data/radio/pnp_hidden_people.asm" PnP_Text4: ; @ @ @ @@ -1215,7 +1200,7 @@ PnP_Text4: PeoplePlaces5: call Random - and $f + and $f ; 0-15 are all the valid indexes into .Descriptors ld e, a ld d, 0 ld hl, .Descriptors @@ -1225,11 +1210,11 @@ PeoplePlaces5: ld h, [hl] ld l, a call Random - cp $a ; 6.25 percent + cp 4 percent ld a, PLACES_AND_PEOPLE jr c, .ok call Random - cp $7b ; 48 percent + cp 49 percent - 1 ld a, PLACES_AND_PEOPLE_4 ; People jr c, .ok ld a, PLACES_AND_PEOPLE_6 ; Places @@ -1336,9 +1321,9 @@ PnP_odd: PeoplePlaces6: ; Places call Random - cp 9 + cp (PnP_HiddenPlacesEnd - PnP_HiddenPlaces) / 2 jr nc, PeoplePlaces6 - ld hl, .Maps + ld hl, PnP_HiddenPlaces ld c, a ld b, 0 add hl, bc @@ -1353,16 +1338,7 @@ PeoplePlaces6: ; Places ld a, PLACES_AND_PEOPLE_7 jp NextRadioLine -.Maps: - map PALLET_TOWN - map ROUTE_22 - map PEWTER_CITY - map CERULEAN_POLICE_STATION - map ROUTE_12 - map ROUTE_11 - map ROUTE_16 - map ROUTE_14 - map CINNABAR_POKECENTER_2F_BETA +INCLUDE "data/radio/pnp_hidden_places.asm" PnP_Text5: ; @ @ @@ -1371,7 +1347,7 @@ PnP_Text5: PeoplePlaces7: call Random - and $f + and $f ; 0-15 are all the valid indexes into .Descriptors ld e, a ld d, 0 ld hl, .Descriptors @@ -1386,7 +1362,7 @@ PeoplePlaces7: ld a, PLACES_AND_PEOPLE jr c, .ok call Random - cp 1 + 48 percent + cp 49 percent - 1 ld a, PLACES_AND_PEOPLE_4 ; People jr c, .ok ld a, PLACES_AND_PEOPLE_6 ; Places @@ -1572,7 +1548,7 @@ BuenasPassword4: ld a, [wBuenasPassword] ; If we already generated the password today, we don't need to generate a new one. ld hl, wWeeklyFlags - bit 7, [hl] + bit 7, [hl] ; ENGINE_BUENAS_PASSWORD jr nz, .AlreadyGotIt ; There are only 11 groups to choose from. .greater_than_11 @@ -1586,7 +1562,7 @@ BuenasPassword4: ; For each group, choose one of the three passwords. .greater_than_three call Random - and $3 + maskbits NUM_PASSWORDS_PER_CATEGORY cp NUM_PASSWORDS_PER_CATEGORY jr nc, .greater_than_three ; The high nybble of wBuenasPassword will now contain the password group index, and the low nybble contains the actual password. @@ -1594,7 +1570,7 @@ BuenasPassword4: ld [wBuenasPassword], a ; Set the flag so that we don't generate a new password this week. ld hl, wWeeklyFlags - set 7, [hl] + set 7, [hl] ; ENGINE_BUENAS_PASSWORD .AlreadyGotIt: ld c, a call GetBuenasPassword @@ -1608,7 +1584,7 @@ GetBuenasPassword: ld a, c swap a and $f - ld hl, PasswordTable + ld hl, BuenasPasswordTable ld d, 0 ld e, a add hl, de @@ -1640,11 +1616,11 @@ GetBuenasPassword: ret .StringFunctionJumpTable: - dw .Mon - dw .Item - dw .Move - dw .RawString - +; entries correspond to BUENA_* constants + dw .Mon ; BUENA_MON + dw .Item ; BUENA_ITEM + dw .Move ; BUENA_MOVE + dw .RawString ; BUENA_STRING .Mon: call .GetTheIndex @@ -1693,30 +1669,7 @@ GetBuenasPassword: ld de, StringBuffer1 ret -PasswordTable: - dw .JohtoStarters - dw .Beverages - dw .HealingItems - dw .Balls - dw .Pokemon1 - dw .Pokemon2 - dw .JohtoTowns - dw .Types - dw .Moves - dw .XItems - dw .RadioStations - ; string type, points, option 1, option 2, option 3 -.JohtoStarters: db BUENA_MON, 10, CYNDAQUIL, TOTODILE, CHIKORITA -.Beverages: db BUENA_ITEM, 12, FRESH_WATER, SODA_POP, LEMONADE -.HealingItems: db BUENA_ITEM, 12, POTION, ANTIDOTE, PARLYZ_HEAL -.Balls: db BUENA_ITEM, 12, POKE_BALL, GREAT_BALL, ULTRA_BALL -.Pokemon1: db BUENA_MON, 10, PIKACHU, RATTATA, GEODUDE -.Pokemon2: db BUENA_MON, 10, HOOTHOOT, SPINARAK, DROWZEE -.JohtoTowns: db BUENA_STRING, 16, "NEW BARK TOWN@", "CHERRYGROVE CITY@", "AZALEA TOWN@" -.Types: db BUENA_STRING, 6, "FLYING@", "BUG@", "GRASS@" -.Moves: db BUENA_MOVE, 12, TACKLE, GROWL, MUD_SLAP -.XItems: db BUENA_ITEM, 12, X_ATTACK, X_DEFEND, X_SPEED -.RadioStations: db BUENA_STRING, 13, "#MON Talk@", "#MON Music@", "Lucky Channel@" +INCLUDE "data/radio/buenas_passwords.asm" BuenasPassword5: ld hl, BuenaRadioText5 @@ -1738,14 +1691,14 @@ BuenasPassword7: BuenasPasswordAfterMidnight: push hl ld hl, wWeeklyFlags - res 7, [hl] + res 7, [hl] ; ENGINE_BUENAS_PASSWORD pop hl ld a, BUENAS_PASSWORD_8 jp NextRadioLine BuenasPassword8: ld hl, wWeeklyFlags - res 7, [hl] + res 7, [hl] ; ENGINE_BUENAS_PASSWORD ld hl, BuenaRadioMidnightText10 ld a, BUENAS_PASSWORD_9 jp NextRadioLine @@ -1958,18 +1911,7 @@ StartRadioStation: callfar RadioMusicRestartDE ret -RadioChannelSongs: - dw MUSIC_POKEMON_TALK - dw MUSIC_POKEMON_CENTER - dw MUSIC_TITLE - dw MUSIC_GAME_CORNER - dw MUSIC_BUENAS_PASSWORD - dw MUSIC_VIRIDIAN_CITY - dw MUSIC_BICYCLE - dw MUSIC_ROCKET_OVERTURE - dw MUSIC_POKE_FLUTE_CHANNEL - dw MUSIC_RUINS_OF_ALPH_RADIO - dw MUSIC_LAKE_OF_RAGE_ROCKET_RADIO +INCLUDE "data/radio/channel_music.asm" NextRadioLine: push af -- cgit v1.2.3 From cc95d1208d4a6b8291a5430a8d652a9337074788 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 10 Jan 2018 11:57:28 -0500 Subject: Use maskbits more, and clarify its usage --- engine/radio.asm | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) (limited to 'engine') diff --git a/engine/radio.asm b/engine/radio.asm index 54cee3894..06cc3a59a 100644 --- a/engine/radio.asm +++ b/engine/radio.asm @@ -348,11 +348,13 @@ OPT_MaryText1: db "@" OaksPkmnTalk8: + ; 0-15 are all valid indexes into .Adverbs, + ; so no need for a retry loop call Random - and $f ; 0-15 are all the valid indexes into .Descriptors + maskbits NUM_OAKS_MON_TALK_ADVERBS +- 1 ld e, a ld d, 0 - ld hl, .Descriptors + ld hl, .Adverbs add hl, de add hl, de ld a, [hli] @@ -361,7 +363,8 @@ OaksPkmnTalk8: ld a, OAKS_POKEMON_TALK_9 jp NextRadioLine -.Descriptors: +.Adverbs: +; there are NUM_OAKS_MON_TALK_ADVERBS entries dw .sweetadorably dw .wigglyslickly dw .aptlynamed @@ -460,11 +463,13 @@ OaksPkmnTalk8: db "@" OaksPkmnTalk9: + ; 0-15 are all valid indexes into .Adjectives, + ; so no need for a retry loop call Random - and $f ; 0-15 are all the valid indexes into .Descriptors + maskbits NUM_OAKS_MON_TALK_ADJECTIVES +- 1 ld e, a ld d, 0 - ld hl, .Descriptors + ld hl, .Adjectives add hl, de add hl, de ld a, [hli] @@ -481,7 +486,8 @@ OaksPkmnTalk9: .ok jp NextRadioLine -.Descriptors: +.Adjectives: +; there are NUM_OAKS_MON_TALK_ADJECTIVES entries dw .cute dw .weird dw .pleasant @@ -1158,7 +1164,7 @@ PnP_Text3: PeoplePlaces4: ; People call Random - and $7f + maskbits NUM_TRAINER_CLASSES +- 1 inc a cp NUM_TRAINER_CLASSES - 1 jr nc, PeoplePlaces4 @@ -1199,11 +1205,13 @@ PnP_Text4: db "@" PeoplePlaces5: + ; 0-15 are all valid indexes into .Adjectives, + ; so no need for a retry loop call Random - and $f ; 0-15 are all the valid indexes into .Descriptors + maskbits NUM_PNP_PEOPLE_ADJECTIVES +- 1 ld e, a ld d, 0 - ld hl, .Descriptors + ld hl, .Adjectives add hl, de add hl, de ld a, [hli] @@ -1221,7 +1229,8 @@ PeoplePlaces5: .ok jp NextRadioLine -.Descriptors: +.Adjectives: +; there are NUM_PNP_PEOPLE_ADJECTIVES entries dw PnP_cute dw PnP_lazy dw PnP_happy @@ -1346,11 +1355,13 @@ PnP_Text5: db "@" PeoplePlaces7: + ; 0-15 are all valid indexes into .Adjectives, + ; so no need for a retry loop call Random - and $f ; 0-15 are all the valid indexes into .Descriptors + maskbits NUM_PNP_PLACES_ADJECTIVES +- 1 ld e, a ld d, 0 - ld hl, .Descriptors + ld hl, .Adjectives add hl, de add hl, de ld a, [hli] @@ -1369,7 +1380,8 @@ PeoplePlaces7: .ok jp PrintRadioLine -.Descriptors: +.Adjectives: +; there are NUM_PNP_PLACES_ADJECTIVES entries dw PnP_cute dw PnP_lazy dw PnP_happy @@ -1553,7 +1565,7 @@ BuenasPassword4: ; There are only 11 groups to choose from. .greater_than_11 call Random - maskbits NUM_PASSWORD_CATEGORIES + maskbits NUM_PASSWORD_CATEGORIES +- 1 cp NUM_PASSWORD_CATEGORIES jr nc, .greater_than_11 ; Store it in the high nybble of e. @@ -1562,7 +1574,7 @@ BuenasPassword4: ; For each group, choose one of the three passwords. .greater_than_three call Random - maskbits NUM_PASSWORDS_PER_CATEGORY + maskbits NUM_PASSWORDS_PER_CATEGORY +- 1 cp NUM_PASSWORDS_PER_CATEGORY jr nc, .greater_than_three ; The high nybble of wBuenasPassword will now contain the password group index, and the low nybble contains the actual password. -- cgit v1.2.3 From 417937cffc2a7c3cfac49f3b00caf1a856d0a925 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 10 Jan 2018 13:47:57 -0500 Subject: Resolve #461 --- engine/battle/core.asm | 24 +-- engine/battle/sliding_intro.asm | 4 +- engine/battle/trainer_huds.asm | 18 +- engine/battle_anims/anim_commands.asm | 8 +- engine/battle_anims/core.asm | 314 ++++++++++++++++++++++++++++++++++ engine/battle_anims/engine.asm | 314 ---------------------------------- engine/billspc.asm | 12 +- engine/card_flip.asm | 16 +- engine/debug.asm | 12 +- engine/events/celebi.asm | 18 +- engine/events/field_moves.asm | 22 +-- engine/events/heal_machine_anim.asm | 14 +- engine/evolution_animation.asm | 10 +- engine/intro_menu.asm | 13 +- engine/map_objects.asm | 17 +- engine/mystery_gift.asm | 32 ++-- engine/pokedex.asm | 20 +-- engine/pokedex_2.asm | 10 +- engine/pokegear.asm | 43 ++--- engine/routines/loadpushoam.asm | 2 +- engine/routines/switchpartymons.asm | 10 +- engine/slot_machine.asm | 44 ++--- engine/sprites.asm | 20 +-- engine/title.asm | 22 +-- engine/trainer_card.asm | 31 ++-- engine/unown_puzzle.asm | 10 +- engine/unused_title.asm | 6 +- 27 files changed, 534 insertions(+), 532 deletions(-) create mode 100755 engine/battle_anims/core.asm delete mode 100755 engine/battle_anims/engine.asm (limited to 'engine') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 8c9eecbcf..ca0c73643 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -9329,27 +9329,27 @@ CopyBackpic: ; 3fc30 ; 3fc5b .LoadTrainerBackpicAsOAM: ; 3fc5b - ld hl, Sprites + ld hl, Sprite01 xor a ld [hMapObjectIndexBuffer], a - ld b, $6 - ld e, 21 * 8 + ld b, 6 + ld e, (SCREEN_WIDTH + 1) * TILE_WIDTH .outer_loop - ld c, $3 - ld d, 8 * 8 + ld c, 3 + ld d, 8 * TILE_WIDTH .inner_loop - ld [hl], d + ld [hl], d ; y inc hl - ld [hl], e + ld [hl], e ; x inc hl ld a, [hMapObjectIndexBuffer] - ld [hli], a + ld [hli], a ; tile id inc a ld [hMapObjectIndexBuffer], a - ld a, $1 - ld [hli], a + ld a, PAL_BATTLE_OB_PLAYER + ld [hli], a ; attributes ld a, d - add $8 + add 1 * TILE_WIDTH ld d, a dec c jr nz, .inner_loop @@ -9357,7 +9357,7 @@ CopyBackpic: ; 3fc30 add $3 ld [hMapObjectIndexBuffer], a ld a, e - add $8 + add 1 * TILE_WIDTH ld e, a dec b jr nz, .outer_loop diff --git a/engine/battle/sliding_intro.asm b/engine/battle/sliding_intro.asm index ed78add8e..120b0acc6 100755 --- a/engine/battle/sliding_intro.asm +++ b/engine/battle/sliding_intro.asm @@ -60,9 +60,9 @@ BattleIntroSlidingPics: ; 4e980 ; 4e9d6 .subfunction3 ; 4e9d6 - ld hl, Sprites + 1 ; x pixel + ld hl, Sprite01XCoord ld c, $12 ; 18 - ld de, $4 + ld de, SPRITEOAMSTRUCT_LENGTH .loop3 dec [hl] dec [hl] diff --git a/engine/battle/trainer_huds.asm b/engine/battle/trainer_huds.asm index b236fc56b..179cc806d 100755 --- a/engine/battle/trainer_huds.asm +++ b/engine/battle/trainer_huds.asm @@ -28,7 +28,7 @@ ShowPlayerMonsRemaining: ; 2c01c ld [hl], a ld a, 8 ld [wPlaceBallsDirection], a - ld hl, Sprites + ld hl, Sprite01 jp LoadTrainerHudOAM ; 2c03a @@ -44,7 +44,7 @@ ShowOTTrainerMonsRemaining: ; 2c03a ld [hl], 4 * 8 ld a, -8 ld [wPlaceBallsDirection], a - ld hl, Sprites + PARTY_LENGTH * 4 + ld hl, Sprite07 jp LoadTrainerHudOAM ; 2c059 @@ -193,7 +193,7 @@ LinkBattle_TrainerHuds: ; 2c10d ld [hl], 8 * 8 ld a, $8 ld [wPlaceBallsDirection], a - ld hl, Sprites + ld hl, Sprite01 call LoadTrainerHudOAM ld hl, OTPartyMon1HP @@ -203,7 +203,7 @@ LinkBattle_TrainerHuds: ; 2c10d ld a, 10 * 8 ld [hli], a ld [hl], 13 * 8 - ld hl, Sprites + PARTY_LENGTH * 4 + ld hl, Sprite07 jp LoadTrainerHudOAM ; 2c143 @@ -212,13 +212,13 @@ LoadTrainerHudOAM: ; 2c143 ld c, PARTY_LENGTH .loop ld a, [wPlaceBallsY] - ld [hli], a + ld [hli], a ; y ld a, [wPlaceBallsX] - ld [hli], a + ld [hli], a ; x ld a, [de] - ld [hli], a - ld a, $3 - ld [hli], a + ld [hli], a ; tile id + ld a, PAL_BATTLE_OB_YELLOW + ld [hli], a ; attributes ld a, [wPlaceBallsX] ld b, a ld a, [wPlaceBallsDirection] diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index 27d57e68f..b81911a88 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -258,15 +258,15 @@ BattleAnim_ClearCGB_OAMFlags: ; cc23d bit 3, a jr z, .delete - ld hl, Sprites + 3 - ld c, (SpritesEnd - Sprites) / 4 + ld hl, Sprite01Attributes + ld c, NUM_SPRITE_OAM_STRUCTS .loop ld a, [hl] and $f0 ld [hli], a +rept SPRITEOAMSTRUCT_LENGTH +- 1 inc hl - inc hl - inc hl +endr dec c jr nz, .loop ret diff --git a/engine/battle_anims/core.asm b/engine/battle_anims/core.asm new file mode 100755 index 000000000..55adeae8c --- /dev/null +++ b/engine/battle_anims/core.asm @@ -0,0 +1,314 @@ +QueueBattleAnimation: ; cc9a1 (33:49a1) + ld hl, ActiveAnimObjects + ld e, 10 +.loop + ld a, [hl] + and a + jr z, .done + ld bc, BATTLEANIMSTRUCT_LENGTH + add hl, bc + dec e + jr nz, .loop + scf + ret + +.done + ld c, l + ld b, h + ld hl, wNumActiveBattleAnims + inc [hl] + call InitBattleAnimation + ret + +DeinitBattleAnimation: ; cc9bd + ld hl, BATTLEANIMSTRUCT_INDEX + add hl, bc + ld [hl], $0 + ret + +; cc9c4 + +InitBattleAnimation: ; cc9c4 (33:49c4) + ld a, [wBattleAnimTemp0] + ld e, a + ld d, 0 + ld hl, BattleAnimObjects +rept 6 + add hl, de +endr + ld e, l + ld d, h + ld hl, BATTLEANIMSTRUCT_INDEX + add hl, bc + ld a, [wNumActiveBattleAnims] + ld [hli], a ; Index + ld a, [de] + inc de + ld [hli], a ; 01 + ld a, [de] + inc de + ld [hli], a ; 02 + ld a, [de] + inc de + ld [hli], a ; Frameset ID + ld a, [de] + inc de + ld [hli], a ; Function + ld a, [de] + inc de + ld [hli], a ; 05 + ld a, [de] + call GetBattleAnimTileOffset + ld [hli], a ; Tile ID + ld a, [wBattleAnimTemp1] + ld [hli], a ; X Coord + ld a, [wBattleAnimTemp2] + ld [hli], a ; Y Coord + xor a + ld [hli], a ; X Offset + ld [hli], a ; Y Offset + ld a, [wBattleAnimTemp3] + ld [hli], a ; 0b + xor a + ld [hli], a ; 0c + dec a + ld [hli], a ; 0d + xor a + ld [hli], a ; 0e + ld [hli], a ; 0f + ld [hl], a ; 10 + ret + +BattleAnimOAMUpdate: ; cca09 + call InitBattleAnimBuffer + call GetBattleAnimFrame + cp -3 + jp z, .done + cp -4 + jp z, .delete + push af + ld hl, wBattleAnimTempOAMFlags + ld a, [wBattleAnimTempAddSubFlags] + xor [hl] + and $e0 + ld [hl], a + pop af + push bc + call GetBattleAnimOAMPointer + ld a, [wBattleAnimTempTileID] + add [hl] + ld [wBattleAnimTempTileID], a + inc hl + ld a, [hli] + ld c, a + ld a, [hli] + ld h, [hl] + ld l, a + ld a, [wBattleAnimOAMPointerLo] + ld e, a + ld d, HIGH(Sprites) +.loop + ld a, [wBattleAnimTempYCoord] + ld b, a + ld a, [wBattleAnimTempYOffset] + add b + ld b, a + push hl + ld a, [hl] + ld hl, wBattleAnimTempOAMFlags + bit 6, [hl] + jr z, .no_yflip + add $8 + xor $ff + inc a + +.no_yflip + pop hl + add b + ld [de], a + inc hl + inc de + ld a, [wBattleAnimTempXCoord] + ld b, a + ld a, [wBattleAnimTempXOffset] + add b + ld b, a + push hl + ld a, [hl] + ld hl, wBattleAnimTempOAMFlags + bit 5, [hl] + jr z, .no_xflip + add $8 + xor $ff + inc a + +.no_xflip + pop hl + add b + ld [de], a + inc hl + inc de + ld a, [wBattleAnimTempTileID] + add $31 + add [hl] + ld [de], a + inc hl + inc de + ld a, [wBattleAnimTempOAMFlags] + ld b, a + ld a, [hl] + xor b + and $e0 + ld b, a + ld a, [hl] + and $10 + or b + ld b, a + ld a, [wBattleAnimTempPalette] + and $f + or b + ld [de], a + inc hl + inc de + ld a, e + ld [wBattleAnimOAMPointerLo], a + cp $a0 + jr nc, .exit_set_carry + dec c + jr nz, .loop + pop bc + jr .done + +.delete + call DeinitBattleAnimation + +.done + and a + ret + +.exit_set_carry + pop bc + scf + ret + +; ccaaa + +InitBattleAnimBuffer: ; ccaaa + ld hl, BATTLEANIMSTRUCT_01 + add hl, bc + ld a, [hl] + and %10000000 + ld [wBattleAnimTempOAMFlags], a + xor a + ld [wBattleAnimTempAddSubFlags], a + ld hl, BATTLEANIMSTRUCT_PALETTE + add hl, bc + ld a, [hl] + ld [wBattleAnimTempPalette], a + ld hl, BATTLEANIMSTRUCT_02 + add hl, bc + ld a, [hl] + ld [wBattleAnimTempField02], a + ld hl, BATTLEANIMSTRUCT_TILEID + add hl, bc + ld a, [hli] + ld [wBattleAnimTempTileID], a + ld a, [hli] + ld [wBattleAnimTempXCoord], a + ld a, [hli] + ld [wBattleAnimTempYCoord], a + ld a, [hli] + ld [wBattleAnimTempXOffset], a + ld a, [hli] + ld [wBattleAnimTempYOffset], a + ld a, [hBattleTurn] + and a + ret z + ld hl, BATTLEANIMSTRUCT_01 + add hl, bc + ld a, [hl] + ld [wBattleAnimTempOAMFlags], a + bit 0, [hl] + ret z + ld hl, BATTLEANIMSTRUCT_XCOORD + add hl, bc + ld a, [hli] + ld d, a + ld a, (-10 * 8) + 4 + sub d + ld [wBattleAnimTempXCoord], a + ld a, [hli] + ld d, a + ld a, [wBattleAnimTempField02] + cp $ff + jr nz, .check_kinesis_softboiled_milkdrink + ld a, 5 * 8 + add d + jr .done + +.check_kinesis_softboiled_milkdrink + sub d + push af + ld a, [FXAnimID + 1] + or a + jr nz, .no_sub + ld a, [FXAnimID] + cp KINESIS + jr z, .kinesis + cp SOFTBOILED + jr z, .softboiled + cp MILK_DRINK + jr nz, .no_sub +.kinesis +.softboiled +.milk_drink + pop af + sub 1 * 8 + jr .done + +.no_sub + pop af +.done + ld [wBattleAnimTempYCoord], a + ld a, [hli] + xor $ff + inc a + ld [wBattleAnimTempXOffset], a + ret + +; ccb31 + +GetBattleAnimTileOffset: ; ccb31 (33:4b31) + push hl + push bc + ld hl, wBattleAnimTileDict + ld b, a + ld c, 10 / 2 +.loop + ld a, [hli] + cp b + jr z, .load + inc hl + dec c + jr nz, .loop + xor a + jr .done + +.load + ld a, [hl] +.done + pop bc + pop hl + ret + +_ExecuteBGEffects: ; ccb48 + callfar ExecuteBGEffects + ret + +; ccb4f + +_QueueBGEffect: ; ccb4f (33:4b4f) + callfar QueueBGEffect + ret + +; ccb56 (33:4b56) diff --git a/engine/battle_anims/engine.asm b/engine/battle_anims/engine.asm deleted file mode 100755 index 55adeae8c..000000000 --- a/engine/battle_anims/engine.asm +++ /dev/null @@ -1,314 +0,0 @@ -QueueBattleAnimation: ; cc9a1 (33:49a1) - ld hl, ActiveAnimObjects - ld e, 10 -.loop - ld a, [hl] - and a - jr z, .done - ld bc, BATTLEANIMSTRUCT_LENGTH - add hl, bc - dec e - jr nz, .loop - scf - ret - -.done - ld c, l - ld b, h - ld hl, wNumActiveBattleAnims - inc [hl] - call InitBattleAnimation - ret - -DeinitBattleAnimation: ; cc9bd - ld hl, BATTLEANIMSTRUCT_INDEX - add hl, bc - ld [hl], $0 - ret - -; cc9c4 - -InitBattleAnimation: ; cc9c4 (33:49c4) - ld a, [wBattleAnimTemp0] - ld e, a - ld d, 0 - ld hl, BattleAnimObjects -rept 6 - add hl, de -endr - ld e, l - ld d, h - ld hl, BATTLEANIMSTRUCT_INDEX - add hl, bc - ld a, [wNumActiveBattleAnims] - ld [hli], a ; Index - ld a, [de] - inc de - ld [hli], a ; 01 - ld a, [de] - inc de - ld [hli], a ; 02 - ld a, [de] - inc de - ld [hli], a ; Frameset ID - ld a, [de] - inc de - ld [hli], a ; Function - ld a, [de] - inc de - ld [hli], a ; 05 - ld a, [de] - call GetBattleAnimTileOffset - ld [hli], a ; Tile ID - ld a, [wBattleAnimTemp1] - ld [hli], a ; X Coord - ld a, [wBattleAnimTemp2] - ld [hli], a ; Y Coord - xor a - ld [hli], a ; X Offset - ld [hli], a ; Y Offset - ld a, [wBattleAnimTemp3] - ld [hli], a ; 0b - xor a - ld [hli], a ; 0c - dec a - ld [hli], a ; 0d - xor a - ld [hli], a ; 0e - ld [hli], a ; 0f - ld [hl], a ; 10 - ret - -BattleAnimOAMUpdate: ; cca09 - call InitBattleAnimBuffer - call GetBattleAnimFrame - cp -3 - jp z, .done - cp -4 - jp z, .delete - push af - ld hl, wBattleAnimTempOAMFlags - ld a, [wBattleAnimTempAddSubFlags] - xor [hl] - and $e0 - ld [hl], a - pop af - push bc - call GetBattleAnimOAMPointer - ld a, [wBattleAnimTempTileID] - add [hl] - ld [wBattleAnimTempTileID], a - inc hl - ld a, [hli] - ld c, a - ld a, [hli] - ld h, [hl] - ld l, a - ld a, [wBattleAnimOAMPointerLo] - ld e, a - ld d, HIGH(Sprites) -.loop - ld a, [wBattleAnimTempYCoord] - ld b, a - ld a, [wBattleAnimTempYOffset] - add b - ld b, a - push hl - ld a, [hl] - ld hl, wBattleAnimTempOAMFlags - bit 6, [hl] - jr z, .no_yflip - add $8 - xor $ff - inc a - -.no_yflip - pop hl - add b - ld [de], a - inc hl - inc de - ld a, [wBattleAnimTempXCoord] - ld b, a - ld a, [wBattleAnimTempXOffset] - add b - ld b, a - push hl - ld a, [hl] - ld hl, wBattleAnimTempOAMFlags - bit 5, [hl] - jr z, .no_xflip - add $8 - xor $ff - inc a - -.no_xflip - pop hl - add b - ld [de], a - inc hl - inc de - ld a, [wBattleAnimTempTileID] - add $31 - add [hl] - ld [de], a - inc hl - inc de - ld a, [wBattleAnimTempOAMFlags] - ld b, a - ld a, [hl] - xor b - and $e0 - ld b, a - ld a, [hl] - and $10 - or b - ld b, a - ld a, [wBattleAnimTempPalette] - and $f - or b - ld [de], a - inc hl - inc de - ld a, e - ld [wBattleAnimOAMPointerLo], a - cp $a0 - jr nc, .exit_set_carry - dec c - jr nz, .loop - pop bc - jr .done - -.delete - call DeinitBattleAnimation - -.done - and a - ret - -.exit_set_carry - pop bc - scf - ret - -; ccaaa - -InitBattleAnimBuffer: ; ccaaa - ld hl, BATTLEANIMSTRUCT_01 - add hl, bc - ld a, [hl] - and %10000000 - ld [wBattleAnimTempOAMFlags], a - xor a - ld [wBattleAnimTempAddSubFlags], a - ld hl, BATTLEANIMSTRUCT_PALETTE - add hl, bc - ld a, [hl] - ld [wBattleAnimTempPalette], a - ld hl, BATTLEANIMSTRUCT_02 - add hl, bc - ld a, [hl] - ld [wBattleAnimTempField02], a - ld hl, BATTLEANIMSTRUCT_TILEID - add hl, bc - ld a, [hli] - ld [wBattleAnimTempTileID], a - ld a, [hli] - ld [wBattleAnimTempXCoord], a - ld a, [hli] - ld [wBattleAnimTempYCoord], a - ld a, [hli] - ld [wBattleAnimTempXOffset], a - ld a, [hli] - ld [wBattleAnimTempYOffset], a - ld a, [hBattleTurn] - and a - ret z - ld hl, BATTLEANIMSTRUCT_01 - add hl, bc - ld a, [hl] - ld [wBattleAnimTempOAMFlags], a - bit 0, [hl] - ret z - ld hl, BATTLEANIMSTRUCT_XCOORD - add hl, bc - ld a, [hli] - ld d, a - ld a, (-10 * 8) + 4 - sub d - ld [wBattleAnimTempXCoord], a - ld a, [hli] - ld d, a - ld a, [wBattleAnimTempField02] - cp $ff - jr nz, .check_kinesis_softboiled_milkdrink - ld a, 5 * 8 - add d - jr .done - -.check_kinesis_softboiled_milkdrink - sub d - push af - ld a, [FXAnimID + 1] - or a - jr nz, .no_sub - ld a, [FXAnimID] - cp KINESIS - jr z, .kinesis - cp SOFTBOILED - jr z, .softboiled - cp MILK_DRINK - jr nz, .no_sub -.kinesis -.softboiled -.milk_drink - pop af - sub 1 * 8 - jr .done - -.no_sub - pop af -.done - ld [wBattleAnimTempYCoord], a - ld a, [hli] - xor $ff - inc a - ld [wBattleAnimTempXOffset], a - ret - -; ccb31 - -GetBattleAnimTileOffset: ; ccb31 (33:4b31) - push hl - push bc - ld hl, wBattleAnimTileDict - ld b, a - ld c, 10 / 2 -.loop - ld a, [hli] - cp b - jr z, .load - inc hl - dec c - jr nz, .loop - xor a - jr .done - -.load - ld a, [hl] -.done - pop bc - pop hl - ret - -_ExecuteBGEffects: ; ccb48 - callfar ExecuteBGEffects - ret - -; ccb4f - -_QueueBGEffect: ; ccb4f (33:4b4f) - callfar QueueBGEffect - ret - -; ccb56 (33:4b56) diff --git a/engine/billspc.asm b/engine/billspc.asm index 2319bbdfc..4e4722ded 100755 --- a/engine/billspc.asm +++ b/engine/billspc.asm @@ -1502,7 +1502,7 @@ BillsPC_UpdateSelectionCursor: ; e2e01 (38:6e01) .place_cursor ld hl, .OAM - ld de, Sprites + ld de, Sprite01 .loop ld a, [hl] cp -1 @@ -1512,9 +1512,9 @@ BillsPC_UpdateSelectionCursor: ; e2e01 (38:6e01) swap a add [hl] inc hl - ld [de], a + ld [de], a ; y inc de -rept 3 +rept SPRITEOAMSTRUCT_LENGTH +- 1 ld a, [hli] ld [de], a inc de @@ -1552,7 +1552,7 @@ endr BillsPC_UpdateInsertCursor: ; e2e8c ld hl, .OAM - ld de, Sprites + ld de, Sprite01 .loop ld a, [hl] cp -1 @@ -1562,9 +1562,9 @@ BillsPC_UpdateInsertCursor: ; e2e8c swap a add [hl] inc hl - ld [de], a + ld [de], a ; y inc de -rept 3 +rept SPRITEOAMSTRUCT_LENGTH +- 1 ld a, [hli] ld [de], a inc de diff --git a/engine/card_flip.asm b/engine/card_flip.asm index 8c55991bb..2bb610e95 100755 --- a/engine/card_flip.asm +++ b/engine/card_flip.asm @@ -594,23 +594,23 @@ CardFlip_CopyToBox: ; e04f7 (38:44f7) ; e0509 (38:4509) CardFlip_CopyOAM: ; e0509 - ld de, Sprites + ld de, Sprite01 ld a, [hli] .loop push af ld a, [hli] add b - ld [de], a + ld [de], a ; y inc de ld a, [hli] add c - ld [de], a + ld [de], a ; x inc de ld a, [hli] - ld [de], a + ld [de], a ; tile id inc de ld a, [hli] - ld [de], a + ld [de], a ; attributes inc de pop af dec a @@ -619,11 +619,11 @@ CardFlip_CopyOAM: ; e0509 ; e0521 CardFlip_ShiftDigitsLeftTwoPixels: ; e0521 (38:4521) - ld de, vTiles1 tile ("0" & $7f) - ld hl, vTiles1 tile ("0" & $7f) + 2 + ld de, vTiles0 tile "0" + ld hl, vTiles0 tile "0" + 2 ld bc, 10 tiles - 2 call CopyBytes - ld hl, vTiles1 tile $7f + 1 tiles - 2 + ld hl, vTiles0 tile "9" + 1 tiles - 2 xor a ld [hli], a ld [hl], a diff --git a/engine/debug.asm b/engine/debug.asm index c1c8eb284..d95676db8 100755 --- a/engine/debug.asm +++ b/engine/debug.asm @@ -1016,17 +1016,17 @@ Function81f5e: ; 81f5e .asm_81fb7 ld a, b - ld [hli], a + ld [hli], a ; y ld a, [de] add a add a - add $18 - ld [hli], a + add 3 * TILE_WIDTH + ld [hli], a ; x xor a - ld [hli], a + ld [hli], a ; tile id ld a, c - ld [hli], a - ld a, $10 + ld [hli], a ; attributes + ld a, 2 * TILE_WIDTH add b ld b, a inc c diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm index 22f8f00a4..e4ed0df57 100755 --- a/engine/events/celebi.asm +++ b/engine/events/celebi.asm @@ -43,26 +43,26 @@ Special_CelebiShrineEvent: ; 4989a .done pop af ld [VramState], a - call .RefreshPlayerSprite_ClearAllOthers + call .RestorePlayerSprite_DespawnLeaves call CelebiEvent_SetBattleType ret ; 498f9 -.RefreshPlayerSprite_ClearAllOthers: ; 498f9 - ld hl, Sprites + 2 +.RestorePlayerSprite_DespawnLeaves: ; 498f9 + ld hl, Sprite01TileID xor a - ld c, $4 + ld c, 4 .OAMloop: - ld [hli], a - inc hl - inc hl + ld [hli], a ; tile id +rept SPRITEOAMSTRUCT_LENGTH +- 1 inc hl +endr inc a dec c jr nz, .OAMloop - ld hl, Sprites + 4 * 4 - ld bc, 36 * 4 + ld hl, Sprite05 + ld bc, SpritesEnd - Sprite05 xor a call ByteFill ret diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm index a1a2e2e79..7f28bca56 100755 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -62,8 +62,8 @@ ShakeHeadbuttTree: ; 8c80a xor a ld [hBGMapMode], a farcall ClearSpriteAnims - ld hl, Sprites + 36 * 4 - ld bc, SpritesEnd - (Sprites + 36 * 4) + ld hl, Sprite37 + ld bc, SpritesEnd - Sprite37 xor a call ByteFill ld de, Font @@ -393,19 +393,19 @@ FlyToAnim: ; 8cb33 ret .RestorePlayerSprite_DespawnLeaves: ; 8cb82 (23:4b82) - ld hl, Sprites + 2 ; Tile ID + ld hl, Sprite01TileID xor a - ld c, $4 -.loop2 - ld [hli], a - inc hl - inc hl + ld c, 4 +.OAMloop + ld [hli], a ; tile id +rept SPRITEOAMSTRUCT_LENGTH +- 1 inc hl +endr inc a dec c - jr nz, .loop2 - ld hl, Sprites + 4 * 4 - ld bc, SpritesEnd - (Sprites + 4 * 4) + jr nz, .OAMloop + ld hl, Sprite05 + ld bc, SpritesEnd - Sprite05 xor a call ByteFill ret diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm index 493330e58..dac46d2e2 100755 --- a/engine/events/heal_machine_anim.asm +++ b/engine/events/heal_machine_anim.asm @@ -73,20 +73,20 @@ HealMachineAnim: ; 12324 call .LoadPalettes ld de, .HealMachineGFX ld hl, vTiles0 tile $7c - lb bc, BANK(.HealMachineGFX), $2 + lb bc, BANK(.HealMachineGFX), 2 call Request2bpp ret ; 12393 .PC_LoadBallsOntoMachine: ; 12393 - ld hl, Sprites + $80 + ld hl, Sprite33 ld de, .PC_ElmsLab_OAM call .PlaceHealingMachineTile call .PlaceHealingMachineTile jr .LoadBallsOntoMachine .HOF_LoadBallsOntoMachine: ; 123a1 - ld hl, Sprites + $80 + ld hl, Sprite33 ld de, .HOF_OAM .LoadBallsOntoMachine: ; 123a7 @@ -249,17 +249,17 @@ INCBIN "gfx/overworld/heal_machine.2bpp" ld a, [de] add c inc de - ld [hli], a + ld [hli], a ; y ld a, [de] add b inc de - ld [hli], a + ld [hli], a ; x ld a, [de] inc de - ld [hli], a + ld [hli], a ; tile id ld a, [de] inc de - ld [hli], a + ld [hli], a ; attributes pop bc ret ; 124c1 diff --git a/engine/evolution_animation.asm b/engine/evolution_animation.asm index 1fa55c10a..d9def496c 100755 --- a/engine/evolution_animation.asm +++ b/engine/evolution_animation.asm @@ -346,15 +346,15 @@ EvolutionAnimation: ; 4e5e1 inc a and $7 ld b, a - ld hl, Sprites + 3 ; attributes - ld c, 40 + ld hl, Sprite01Attributes + ld c, NUM_SPRITE_OAM_STRUCTS .loop6 ld a, [hl] or b - ld [hli], a - inc hl - inc hl + ld [hli], a ; attributes +rept SPRITEOAMSTRUCT_LENGTH +- 1 inc hl +endr dec c jr nz, .loop6 pop bc diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index 3a93a9b84..8d482f53e 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -971,7 +971,7 @@ Intro_PlacePlayerSprite: ; 61cd ld hl, vTiles0 call Request2bpp - ld hl, Sprites + ld hl, Sprite01 ld de, .sprites ld a, [de] inc de @@ -980,19 +980,19 @@ Intro_PlacePlayerSprite: ; 61cd .loop ld a, [de] inc de - ld [hli], a + ld [hli], a ; y ld a, [de] inc de - ld [hli], a + ld [hli], a ; x ld a, [de] inc de - ld [hli], a + ld [hli], a ; tile id - ld b, 0 + ld b, PAL_OW_RED ld a, [wPlayerGender] bit 0, a jr z, .male - ld b, 1 + ld b, PAL_OW_BLUE .male ld a, b @@ -1004,6 +1004,7 @@ Intro_PlacePlayerSprite: ; 61cd .sprites ; 61fe db 4 + ; y pxl, x pxl, tile offset db 9 * 8 + 4, 9 * 8, 0 db 9 * 8 + 4, 10 * 8, 1 db 10 * 8 + 4, 9 * 8, 2 diff --git a/engine/map_objects.asm b/engine/map_objects.asm index fe3c13a13..a0dadf9a5 100644 --- a/engine/map_objects.asm +++ b/engine/map_objects.asm @@ -2793,6 +2793,7 @@ Function5903: ; 5903 db SPRITEMOVEDATA_STANDING_LEFT db SPRITEMOVEDATA_STANDING_RIGHT ; 5920 + _UpdateSprites:: ; 5920 ld a, [VramState] bit 0, a @@ -2814,18 +2815,18 @@ _UpdateSprites:: ; 5920 bit 1, a ld b, LOW(SpritesEnd) jr z, .ok - ld b, 28 * 4 + ld b, 28 * SPRITEOAMSTRUCT_LENGTH .ok ld a, [hUsedSpriteIndex] cp b ret nc ld l, a ld h, HIGH(Sprites) - ld de, 4 + ld de, SPRITEOAMSTRUCT_LENGTH ld a, b - ld c, SCREEN_HEIGHT_PX + 16 + ld c, SCREEN_HEIGHT_PX + 2 * TILE_WIDTH .loop - ld [hl], c + ld [hl], c ; y add hl, de cp l jr nz, .loop @@ -3042,12 +3043,12 @@ PRIORITY_HIGH EQU $30 ld a, [hFFC0] add [hl] inc hl - ld [bc], a + ld [bc], a ; y inc c ld a, [hFFBF] add [hl] inc hl - ld [bc], a + ld [bc], a ; x inc c ld e, [hl] inc hl @@ -3058,7 +3059,7 @@ PRIORITY_HIGH EQU $30 .nope1 add [hl] inc hl - ld [bc], a + ld [bc], a ; tile id inc c ld a, e bit 1, a @@ -3068,7 +3069,7 @@ PRIORITY_HIGH EQU $30 .nope2 and %11110000 or d - ld [bc], a + ld [bc], a ; attributes inc c ld a, [hUsedSpriteTile] dec a diff --git a/engine/mystery_gift.asm b/engine/mystery_gift.asm index 03dff98e5..00ed74ea0 100755 --- a/engine/mystery_gift.asm +++ b/engine/mystery_gift.asm @@ -1456,33 +1456,33 @@ Function105688: ; 105688 (41:5688) jr asm_105726 Function1056eb: ; 1056eb (41:56eb) - ld c, $10 -.asm_1056ed - ld hl, Sprites - ld b, $8 -.asm_1056f2 + ld c, 16 +.loop + ld hl, Sprite01YCoord + ld b, 8 +.dec_y_loop dec [hl] -rept 4 +rept SPRITEOAMSTRUCT_LENGTH inc hl endr dec b - jr nz, .asm_1056f2 - ld hl, Sprites + $20 - ld b, $8 -.asm_1056ff + jr nz, .dec_y_loop + ld hl, Sprite09YCoord + ld b, 8 +.inc_y_loop inc [hl] -rept 4 +rept SPRITEOAMSTRUCT_LENGTH inc hl endr dec b - jr nz, .asm_1056ff + jr nz, .inc_y_loop dec c ret z push bc ld c, 4 call DelayFrames pop bc - jr .asm_1056ed + jr .loop Function105712: ; 105712 (41:5712) call Function105777 @@ -1580,7 +1580,7 @@ Function1057d7: ; 1057d7 (41:57d7) ld a, BANK(MysteryGiftJP_GFX) lb bc, 4, 0 call FarCopyBytes - ld hl, MysteryGiftJP_GFX + $400 + ld hl, MysteryGiftJP_GFX + $40 tiles ld de, vTiles0 tile $00 ld a, BANK(MysteryGiftJP_GFX) ld bc, $80 @@ -1656,9 +1656,9 @@ Function1057d7: ; 1057d7 (41:57d7) ld [hl], $3c hlcoord 17, 15 ld [hl], $3e - ld de, Sprites + ld de, Sprite01 ld hl, .OAM_data - ld bc, $40 + ld bc, 16 * SPRITEOAMSTRUCT_LENGTH call CopyBytes call EnableLCD call WaitBGMap diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 031998b9f..0e67ba7c6 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -2050,7 +2050,7 @@ Pokedex_PutOldModeCursorOAM: ; 41157 (10:5157) dsprite 5, 0, 19, -2, $32, 7 | X_FLIP | Y_FLIP dsprite 5, 0, 20, -2, $31, 7 | X_FLIP | Y_FLIP dsprite 4, 0, 20, -2, $30, 7 | X_FLIP | Y_FLIP - db $ff + db -1 .CursorAtTopOAM: ; 411c8 ; OAM data for when the cursor is at the top of the list. The tiles at the top @@ -2079,7 +2079,7 @@ Pokedex_PutOldModeCursorOAM: ; 41157 (10:5157) dsprite 5, 0, 19, -2, $32, 7 | X_FLIP | Y_FLIP dsprite 5, 0, 20, -2, $31, 7 | X_FLIP | Y_FLIP dsprite 4, 0, 20, -2, $30, 7 | X_FLIP | Y_FLIP - db $ff + db -1 Pokedex_PutNewModeABCModeCursorOAM: ; 41229 (10:5229) ld hl, .CursorOAM @@ -2107,7 +2107,7 @@ Pokedex_PutNewModeABCModeCursorOAM: ; 41229 (10:5229) dsprite 5, 3, 18, 0, $32, 7 | X_FLIP | Y_FLIP dsprite 5, 3, 19, 0, $31, 7 | X_FLIP | Y_FLIP dsprite 4, 3, 19, 0, $30, 7 | X_FLIP | Y_FLIP - db $ff + db -1 Pokedex_UpdateSearchResultsCursorOAM: ; 41281 (10:5281) ld a, [wCurrentDexMode] @@ -2142,28 +2142,28 @@ Pokedex_UpdateSearchResultsCursorOAM: ; 41281 (10:5281) dsprite 5, 3, 19, -2, $32, 7 | X_FLIP | Y_FLIP dsprite 5, 3, 20, -2, $31, 7 | X_FLIP | Y_FLIP dsprite 4, 3, 20, -2, $30, 7 | X_FLIP | Y_FLIP - db $ff + db -1 Pokedex_LoadCursorOAM: ; 412f1 (10:52f1) - ld de, Sprites + ld de, Sprite01 .loop ld a, [hl] - cp $ff + cp -1 ret z ld a, [wDexListingCursor] and $7 swap a - add [hl] + add [hl] ; y inc hl ld [de], a inc de - ld a, [hli] + ld a, [hli] ; x ld [de], a inc de - ld a, [hli] + ld a, [hli] ; tile id ld [de], a inc de - ld a, [hli] + ld a, [hli] ; attributes ld [de], a inc de jr .loop diff --git a/engine/pokedex_2.asm b/engine/pokedex_2.asm index f796338fb..df0771e07 100644 --- a/engine/pokedex_2.asm +++ b/engine/pokedex_2.asm @@ -41,15 +41,15 @@ AnimateDexSearchSlowpoke: ; 441cf DoDexSearchSlowpokeFrame: ; 44207 ld a, [wDexSearchSlowpokeFrame] ld hl, .SlowpokeSpriteData - ld de, Sprites + ld de, Sprite01 .loop ld a, [hli] cp -1 ret z - ld [de], a + ld [de], a ; y inc de ld a, [hli] - ld [de], a + ld [de], a ; x inc de ld a, [wDexSearchSlowpokeFrame] ld b, a @@ -57,10 +57,10 @@ DoDexSearchSlowpokeFrame: ; 44207 add b add [hl] inc hl - ld [de], a + ld [de], a ; tile id inc de ld a, [hli] - ld [de], a + ld [de], a ; attributes inc de jr .loop diff --git a/engine/pokegear.asm b/engine/pokegear.asm index c8063c830..944082d80 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -2596,7 +2596,7 @@ _Area: ; 91d11 ld e, a farcall FindNest ; load nest landmarks into TileMap[0,0] decoord 0, 0 - ld hl, Sprites + ld hl, Sprite01 .nestloop ld a, [de] and a @@ -2609,14 +2609,14 @@ _Area: ; 91d11 ; load into OAM ld a, d sub 4 - ld [hli], a + ld [hli], a ; y ld a, e sub 4 - ld [hli], a - ld a, $7f ; nest icon in this context - ld [hli], a + ld [hli], a ; x + ld a, $7f ; nest icon + ld [hli], a ; tile id xor a - ld [hli], a + ld [hli], a ; attributes ; next pop de inc de @@ -2640,37 +2640,37 @@ _Area: ; 91d11 ld c, e ld b, d ld de, .PlayerOAM - ld hl, Sprites + ld hl, Sprite01 .ShowPlayerLoop: ld a, [de] cp $80 jr z, .clear_oam add b - ld [hli], a + ld [hli], a ; y inc de ld a, [de] add c - ld [hli], a + ld [hli], a ; x inc de ld a, [de] add $78 ; where the player's sprite is loaded - ld [hli], a + ld [hli], a ; tile id inc de push bc - ld c, 0 ; RED + ld c, PAL_OW_RED ld a, [wPlayerGender] bit 0, a - jr z, .got_gender - inc c ; BLUE -.got_gender + jr z, .male + inc c ; PAL_OW_BLUE +.male ld a, c - ld [hli], a + ld [hli], a ; attributes pop bc jr .ShowPlayerLoop .clear_oam - ld hl, Sprites + 4 * 4 - ld bc, SpritesEnd - (Sprites + 4 * 4) + ld hl, Sprite05 + ld bc, SpritesEnd - Sprite05 xor a call ByteFill ret @@ -2678,10 +2678,11 @@ _Area: ; 91d11 ; 91e9c .PlayerOAM: ; 91e9c - db -1 * 8, -1 * 8, 0 ; top left - db -1 * 8, 0 * 8, 1 ; top right - db 0 * 8, -1 * 8, 2 ; bottom left - db 0 * 8, 0 * 8, 3 ; bottom right + ; y pxl, x pxl, tile offset + db -1 * 8, -1 * 8, 0 ; top left + db -1 * 8, 0 * 8, 1 ; top right + db 0 * 8, -1 * 8, 2 ; bottom left + db 0 * 8, 0 * 8, 3 ; bottom right db $80 ; terminator ; 91ea9 diff --git a/engine/routines/loadpushoam.asm b/engine/routines/loadpushoam.asm index 6af0ddf6d..c07c06d0f 100644 --- a/engine/routines/loadpushoam.asm +++ b/engine/routines/loadpushoam.asm @@ -13,7 +13,7 @@ LoadPushOAM:: ; 4031 .PushOAM: ; 403f ld a, HIGH(Sprites) ld [rDMA], a - ld a, (SpritesEnd - Sprites) / 4 ; 40 + ld a, NUM_SPRITE_OAM_STRUCTS .pushoam_loop dec a jr nz, .pushoam_loop diff --git a/engine/routines/switchpartymons.asm b/engine/routines/switchpartymons.asm index cde9c82b2..1379dff9c 100644 --- a/engine/routines/switchpartymons.asm +++ b/engine/routines/switchpartymons.asm @@ -25,13 +25,13 @@ _SwitchPartyMons: ld a, " " call ByteFill pop af - ld hl, Sprites - ld bc, $10 + ld hl, Sprite01 + ld bc, 4 * SPRITEOAMSTRUCT_LENGTH call AddNTimes - ld de, $4 - ld c, $4 + ld de, SPRITEOAMSTRUCT_LENGTH + ld c, 4 .gfx_loop - ld [hl], $a0 + ld [hl], SCREEN_WIDTH_PX ; y (off-screen) add hl, de dec c jr nz, .gfx_loop diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index aea08f16a..a4da2d3ad 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -260,15 +260,15 @@ Function9282c: ; 9282c inc [hl] and $7 ret nz - ld hl, Sprites + 16 * 4 + 2 - ld c, 40 - 16 + ld hl, Sprite17TileID + ld c, NUM_SPRITE_OAM_STRUCTS - 16 .loop ld a, [hl] - xor $20 - ld [hli], a - inc hl - inc hl + xor %00100000 + ld [hli], a ; tile id +rept SPRITEOAMSTRUCT_LENGTH +- 1 inc hl +endr dec c jr nz, .loop ret @@ -670,7 +670,7 @@ Slots_InitReelTiles: ; 92a98 (24:6a98) ld bc, wReel1 ld hl, REEL_OAM_ADDR add hl, bc - ld de, Sprites + 16 * 4 + ld de, Sprite17 ld [hl], e inc hl ld [hl], d @@ -688,7 +688,7 @@ Slots_InitReelTiles: ; 92a98 (24:6a98) ld bc, wReel2 ld hl, REEL_OAM_ADDR add hl, bc - ld de, Sprites + 24 * 4 + ld de, Sprite25 ld [hl], e inc hl ld [hl], d @@ -706,7 +706,7 @@ Slots_InitReelTiles: ; 92a98 (24:6a98) ld bc, wReel3 ld hl, REEL_OAM_ADDR add hl, bc - ld de, Sprites + 32 * 4 + ld de, Sprite33 ld [hl], e inc hl ld [hl], d @@ -821,34 +821,34 @@ Slots_UpdateReelPositionAndOAM: ; 92b53 (24:6b53) ld l, a .loop ld a, [wCurrReelYCoord] - ld [hli], a + ld [hli], a ; y ld a, [wCurrReelXCoord] - ld [hli], a + ld [hli], a ; x ld a, [de] - ld [hli], a + ld [hli], a ; tile id srl a srl a - set 7, a - ld [hli], a + set OAM_PRIORITY, a + ld [hli], a ; attributes ld a, [wCurrReelYCoord] - ld [hli], a + ld [hli], a ; y ld a, [wCurrReelXCoord] - add 1 * 8 - ld [hli], a + add 1 * TILE_WIDTH + ld [hli], a ; x ld a, [de] inc a inc a - ld [hli], a + ld [hli], a ; tile id srl a srl a - set 7, a - ld [hli], a + set OAM_PRIORITY, a + ld [hli], a ; attributes inc de ld a, [wCurrReelYCoord] - sub 2 * 8 + sub 2 * TILE_WIDTH ld [wCurrReelYCoord], a - cp 2 * 8 + cp 2 * TILE_WIDTH jr nz, .loop ret diff --git a/engine/sprites.asm b/engine/sprites.asm index 1ccd7b6a0..2bd06387b 100755 --- a/engine/sprites.asm +++ b/engine/sprites.asm @@ -100,11 +100,11 @@ DoNextFrameForFirst16Sprites: ; 8cfa8 (23:4fa8) ld a, [wCurrSpriteOAMAddr] ld l, a - ld h, HIGH(Sprites + 16 * 4) + ld h, HIGH(Sprite17) .loop2 ; Clear (Sprites + [wCurrSpriteOAMAddr] --> Sprites + $40) ld a, l - cp LOW(Sprites + 16 * 4) + cp LOW(Sprite17) jr nc, .done xor a ld [hli], a @@ -650,8 +650,8 @@ AnimateEndOfExpBar: ; 8e79d ; 8e7c6 .AnimateFrame: ; 8e7c6 - ld hl, Sprites - ld c, $8 + ld hl, Sprite01 + ld c, 8 ; number of animated circles .anim_loop ld a, c and a @@ -669,8 +669,8 @@ AnimateEndOfExpBar: ; 8e79d call Sprites_Sine pop hl pop de - add 13 * 8 - ld [hli], a + add 13 * TILE_WIDTH + ld [hli], a ; y pop af push de @@ -678,13 +678,13 @@ AnimateEndOfExpBar: ; 8e79d call Sprites_Cosine pop hl pop de - add 10 * 8 + 4 - ld [hli], a + add 10 * TILE_WIDTH + 4 + ld [hli], a ; x ld a, $0 - ld [hli], a + ld [hli], a ; tile id ld a, PAL_BATTLE_OB_BLUE - ld [hli], a + ld [hli], a ; attributes jr .anim_loop ; 8e7f4 diff --git a/engine/title.asm b/engine/title.asm index 5f9ca82f7..d3cb7f4c8 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -323,7 +323,7 @@ DrawTitleGraphic: ; 10eeef ; 10ef06 InitializeBackground: ; 10ef06 - ld hl, Sprites + ld hl, Sprite01 ld d, -$22 ld e, $0 ld c, 5 @@ -344,17 +344,17 @@ InitializeBackground: ; 10ef06 ld b, $40 .loop2 ld a, d - ld [hli], a + ld [hli], a ; y ld a, b - ld [hli], a + ld [hli], a ; x add $8 ld b, a ld a, e - ld [hli], a + ld [hli], a ; tile id inc e inc e - ld a, $80 - ld [hli], a + ld a, 0 | BEHIND_BG + ld [hli], a ; attributes dec c jr nz, .loop2 ret @@ -366,9 +366,9 @@ AnimateTitleCrystal: ; 10ef32 ; Stop at y=6 ; y is really from the bottom of the sprite, which is two tiles high - ld hl, Sprites + ld hl, Sprite01YCoord ld a, [hl] - cp 6 + $10 + cp 6 + 2 * TILE_WIDTH ret z ; Move all 30 parts of the crystal down by 2 @@ -376,10 +376,10 @@ AnimateTitleCrystal: ; 10ef32 .loop ld a, [hl] add 2 - ld [hli], a - inc hl - inc hl + ld [hli], a ; y +rept SPRITEOAMSTRUCT_LENGTH +- 1 inc hl +endr dec c jr nz, .loop diff --git a/engine/trainer_card.asm b/engine/trainer_card.asm index 87cab0103..990158a41 100755 --- a/engine/trainer_card.asm +++ b/engine/trainer_card.asm @@ -470,8 +470,8 @@ TrainerCard_Page2_3_OAMUpdate: ; 25448 (9:5448) ld d, a ld a, [de] ld c, a - ld de, Sprites - ld b, 8 + ld de, Sprite01 + ld b, NUM_JOHTO_BADGES .loop srl c push bc @@ -512,27 +512,27 @@ TrainerCard_Page2_3_OAMUpdate: ; 25448 (9:5448) ld hl, .facing2 .loop2 ld a, [hli] - cp $ff + cp -1 ret z add b - ld [de], a + ld [de], a ; y inc de ld a, [hli] add c - ld [de], a + ld [de], a ; x inc de ld a, [wcf65] and $7f add [hl] - ld [de], a + ld [de], a ; tile id inc hl inc de ld a, [wcf66] add [hl] - ld [de], a + ld [de], a ; attributes inc hl inc de jr .loop2 @@ -540,18 +540,17 @@ TrainerCard_Page2_3_OAMUpdate: ; 25448 (9:5448) ; 254a7 (9:54a7) .facing1 ; 254a7 - ; y, x, tile, OAM attributes - db 0, 0, 0, 0 - db 0, 8, 1, 0 - db 8, 0, 2, 0 - db 8, 8, 3, 0 + dsprite 0, 0, 0, 0, $00, 0 + dsprite 0, 0, 1, 0, $01, 0 + dsprite 1, 0, 0, 0, $02, 0 + dsprite 1, 0, 1, 0, $03, 0 db -1 .facing2 ; 254b8 - db 0, 0, 1, X_FLIP - db 0, 8, 0, X_FLIP - db 8, 0, 3, X_FLIP - db 8, 8, 2, X_FLIP + dsprite 0, 0, 0, 0, $01, 0 | X_FLIP + dsprite 0, 0, 1, 0, $00, 0 | X_FLIP + dsprite 1, 0, 0, 0, $03, 0 | X_FLIP + dsprite 1, 0, 1, 0, $02, 0 | X_FLIP db -1 TrainerCard_JohtoBadgesOAM: ; 254c9 diff --git a/engine/unown_puzzle.asm b/engine/unown_puzzle.asm index aaad8eb4d..2074fb314 100755 --- a/engine/unown_puzzle.asm +++ b/engine/unown_puzzle.asm @@ -549,25 +549,25 @@ RedrawUnownPuzzlePieces: ; e14d9 ld hl, .OAM_NotHoldingPiece .load - ld de, Sprites + ld de, Sprite01 .loop ld a, [hli] cp -1 ret z add b - ld [de], a + ld [de], a ; y inc de ld a, [hli] add c - ld [de], a + ld [de], a ; x inc de ld a, [wd002] add [hl] - ld [de], a + ld [de], a ; tile id inc hl inc de ld a, [hli] - ld [de], a + ld [de], a ; attributes inc de jr .loop ; e150f diff --git a/engine/unused_title.asm b/engine/unused_title.asm index b9e31cdae..7856ceb40 100644 --- a/engine/unused_title.asm +++ b/engine/unused_title.asm @@ -32,7 +32,7 @@ UnusedTitleScreen: ; 10c000 ld hl, UnusedTitleBG_Tilemap debgcoord 0, 0 - ld bc, 32 * 32 + ld bc, BG_MAP_WIDTH * BG_MAP_HEIGHT .copy ld a, 0 ld [rVBK], a @@ -49,8 +49,8 @@ UnusedTitleScreen: ; 10c000 jr nz, .copy ld hl, UnusedTitleFG_OAM - ld de, Sprites - ld bc, $a0 + ld de, Sprite01 + ld bc, SPRITEOAMSTRUCT_LENGTH * NUM_SPRITE_OAM_STRUCTS call CopyBytes call EnableLCD -- cgit v1.2.3 From bc79f17b9dff053ce5613e4008596a55a6110d66 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 10 Jan 2018 13:59:07 -0500 Subject: More maskbits --- engine/events/battle_tower/load_trainer.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engine') diff --git a/engine/events/battle_tower/load_trainer.asm b/engine/events/battle_tower/load_trainer.asm index 08571dcef..67c9d2232 100644 --- a/engine/events/battle_tower/load_trainer.asm +++ b/engine/events/battle_tower/load_trainer.asm @@ -27,12 +27,12 @@ Function_LoadOpponentTrainerAndPokemons: ; 1f8000 add b ld b, a ; b contains the nr of the trainer if DEF(_CRYSTAL11) - and BATTLETOWER_TRAINER_MASK + maskbits BATTLETOWER_NUM_UNIQUE_TRAINERS cp BATTLETOWER_NUM_UNIQUE_TRAINERS else -; Crystal 1.0 used the wrong constants here, so only the first 21 +; Crystal 1.0 used the wrong constant here, so only the first 21 ; trainers in BattleTowerTrainers can be sampled. - and BATTLETOWER_PKMN_MASK + maskbits BATTLETOWER_NUM_UNIQUE_PKMN cp BATTLETOWER_NUM_UNIQUE_PKMN endc jr nc, .resample @@ -115,7 +115,7 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081 ld a, [hRandomAdd] add b ld b, a - and BATTLETOWER_PKMN_MASK + maskbits BATTLETOWER_NUM_UNIQUE_PKMN cp BATTLETOWER_NUM_UNIQUE_PKMN jr nc, .resample ; in register 'a' is the chosen Pkmn of the LevelGroup -- cgit v1.2.3 From 28d5169a119ece438cc39b442adaa018b9a376e3 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 10 Jan 2018 14:03:11 -0500 Subject: maskbits +- 1 --- engine/events/battle_tower/load_trainer.asm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engine') diff --git a/engine/events/battle_tower/load_trainer.asm b/engine/events/battle_tower/load_trainer.asm index 67c9d2232..c84020e9d 100644 --- a/engine/events/battle_tower/load_trainer.asm +++ b/engine/events/battle_tower/load_trainer.asm @@ -27,12 +27,12 @@ Function_LoadOpponentTrainerAndPokemons: ; 1f8000 add b ld b, a ; b contains the nr of the trainer if DEF(_CRYSTAL11) - maskbits BATTLETOWER_NUM_UNIQUE_TRAINERS + maskbits BATTLETOWER_NUM_UNIQUE_TRAINERS +- 1 cp BATTLETOWER_NUM_UNIQUE_TRAINERS else ; Crystal 1.0 used the wrong constant here, so only the first 21 ; trainers in BattleTowerTrainers can be sampled. - maskbits BATTLETOWER_NUM_UNIQUE_PKMN + maskbits BATTLETOWER_NUM_UNIQUE_PKMN +- 1 cp BATTLETOWER_NUM_UNIQUE_PKMN endc jr nc, .resample @@ -115,7 +115,7 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081 ld a, [hRandomAdd] add b ld b, a - maskbits BATTLETOWER_NUM_UNIQUE_PKMN + maskbits BATTLETOWER_NUM_UNIQUE_PKMN +- 1 cp BATTLETOWER_NUM_UNIQUE_PKMN jr nc, .resample ; in register 'a' is the chosen Pkmn of the LevelGroup -- cgit v1.2.3 From c8575823a0e3694cba7c63e7ef468c55bb301804 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 10 Jan 2018 17:30:27 -0500 Subject: Battle data goes in data/battle/ TreeMons, like fish groups, have constants --- engine/battle/effect_commands.asm | 132 +++++++++++--------------------------- engine/events_3.asm | 25 ++++---- engine/link.asm | 4 +- engine/warp_connection.asm | 9 ++- 4 files changed, 61 insertions(+), 109 deletions(-) (limited to 'engine') diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index f86f90479..f9a8ba63e 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -64,7 +64,7 @@ DoMove: ; 3402c inc hl ld [de], a inc de - cp $ff + cp -1 jr nz, .GetMoveEffect ; Start at the first command. @@ -138,7 +138,7 @@ BattleCommand_CheckTurn: ; 34084 ld [AlreadyFailed], a ld [wSomeoneIsRampaging], a - ld a, 10 ; 1.0 + ld a, EFFECTIVE ld [TypeModifier], a ld a, [hBattleTurn] @@ -282,7 +282,7 @@ CheckPlayerTurn: ; 50% chance of hitting itself call BattleRandom - cp $80 + cp 50 percent + 1 jr nc, .not_confused ; clear confusion-dependent substatus @@ -311,7 +311,7 @@ CheckPlayerTurn: ; 50% chance of infatuation call BattleRandom - cp $80 + cp 50 percent + 1 jr c, .not_infatuated ld hl, InfatuationText @@ -345,7 +345,7 @@ CheckPlayerTurn: ; 25% chance to be fully paralyzed call BattleRandom - cp $3f + cp 25 percent ret nc ld hl, FullyParalyzedText @@ -457,6 +457,8 @@ CheckEnemyTurn: ; 3421f ld hl, EnemyMonStatus bit FRZ, [hl] jr z, .not_frozen + + ; Flame Wheel and Sacred Fire thaw the user. ld a, [CurEnemyMove] cp FLAME_WHEEL jr z, .not_frozen @@ -611,7 +613,7 @@ CheckEnemyTurn: ; 3421f ; 25% chance to be fully paralyzed call BattleRandom - cp $3f + cp 25 percent ret nc ld hl, FullyParalyzedText @@ -989,6 +991,7 @@ IgnoreSleepOnly: ; 3451f ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar + ; Snore and Sleep Talk bypass sleep. cp SNORE jr z, .CheckSleep cp SLEEP_TALK @@ -1172,7 +1175,7 @@ BattleCommand_DoTurn: ; 34555 db EFFECT_ROLLOUT db EFFECT_BIDE db EFFECT_RAMPAGE - db $ff + db -1 ; 3460b CheckMimicUsed: ; 3460b @@ -1266,7 +1269,7 @@ BattleCommand_Critical: ; 34631 ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar ld de, 1 - ld hl, .Criticals + ld hl, CriticalHitMoves push bc call IsInArray pop bc @@ -1288,7 +1291,7 @@ BattleCommand_Critical: ; 34631 inc c .Tally: - ld hl, .Chances + ld hl, CriticalHitChances ld b, 0 add hl, bc call BattleRandom @@ -1298,12 +1301,7 @@ BattleCommand_Critical: ; 34631 ld [CriticalHit], a ret -.Criticals: - db KARATE_CHOP, RAZOR_WIND, RAZOR_LEAF, CRABHAMMER, SLASH, AEROBLAST, CROSS_CHOP, $ff -.Chances: - ; 6.25% 12.1% 24.6% 33.2% 49.6% 49.6% 49.6% - db $11, $20, $40, $55, $80, $80, $80 - ; 0 1 2 3 4 5 6 +INCLUDE "data/battle/critical_hits.asm" ; 346b2 @@ -1433,11 +1431,11 @@ BattleCommand_Stab: ; 346d2 .TypesLoop: ld a, [hli] - cp $ff + cp -1 jr z, .end ; foresight - cp $fe + cp -2 jr nz, .SkipForesightCheck ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVar @@ -1562,9 +1560,9 @@ CheckTypeMatchup: ; 347d3 ld hl, TypeMatchups .TypesLoop: ld a, [hli] - cp $ff + cp -1 jr z, .End - cp $fe + cp -2 jr nz, .Next ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVar @@ -1640,7 +1638,7 @@ BattleCommand_ResetTypeMatchup: ; 34833 INCLUDE "engine/battle/ai/switch.asm" -INCLUDE "data/type_matchups.asm" +INCLUDE "data/battle/type_matchups.asm" BattleCommand_DamageVariation: ; 34cfd ; damagevariation @@ -1675,7 +1673,7 @@ BattleCommand_DamageVariation: ; 34cfd .loop call BattleRandom rrca - cp $d9 ; 85% + cp 85 percent + 1 jr c, .loop ld [hMultiplier], a @@ -1756,7 +1754,7 @@ BattleCommand_CheckHit: ; 34d32 .skip_brightpowder ld a, b - cp $ff + cp -1 jr z, .Hit call BattleRandom @@ -1954,7 +1952,7 @@ BattleCommand_CheckHit: ; 34d32 .skip_foresight_check ; subtract evasion from 14 - ld a, 14 + ld a, MAX_STAT_LEVEL + 1 sub c ld c, a ; store the base move accuracy for math ops @@ -1969,7 +1967,7 @@ BattleCommand_CheckHit: ; 34d32 .accuracy_loop ; look up the multiplier from the table push bc - ld hl, .AccProb + ld hl, AccuracyLevelMultipliers dec b sla b ld c, b @@ -2013,21 +2011,7 @@ BattleCommand_CheckHit: ; 34d32 ld [hl], a ret -.AccProb: - db 33, 100 ; 33% -6 - db 36, 100 ; 36% -5 - db 43, 100 ; 43% -4 - db 50, 100 ; 50% -3 - db 60, 100 ; 60% -2 - db 75, 100 ; 75% -1 - db 1, 1 ; 100% 0 - db 133, 100 ; 133% +1 - db 166, 100 ; 166% +2 - db 2, 1 ; 200% +3 - db 233, 100 ; 233% +4 - db 133, 50 ; 266% +5 - db 3, 1 ; 300% +6 - +INCLUDE "data/battle/accuracy_multipliers.asm" ; 34ecc @@ -2199,7 +2183,7 @@ BattleCommand_HitTargetNoSub: ; 34f60 xor 1 ld [wKickCounter], a ld a, [de] - cp $1 + cp 1 push af ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar @@ -2438,7 +2422,7 @@ GetFailureResultText: ; 350e4 ld hl, AttackMissedText ld de, AttackMissed2Text ld a, [CriticalHit] - cp $ff + cp -1 jr nz, .got_text ld hl, UnaffectedText .got_text @@ -3519,7 +3503,7 @@ BattleCommand_DamageCalc: ; 35612 .NextItem: ld a, [hli] - cp $ff + cp -1 jr z, .DoneItem ; Item effect @@ -3657,26 +3641,7 @@ BattleCommand_DamageCalc: ; 35612 ; 35703 -TypeBoostItems: ; 35703 - db HELD_NORMAL_BOOST, NORMAL ; Pink/Polkadot Bow - db HELD_FIGHTING_BOOST, FIGHTING ; Blackbelt - db HELD_FLYING_BOOST, FLYING ; Sharp Beak - db HELD_POISON_BOOST, POISON ; Poison Barb - db HELD_GROUND_BOOST, GROUND ; Soft Sand - db HELD_ROCK_BOOST, ROCK ; Hard Stone - db HELD_BUG_BOOST, BUG ; Silverpowder - db HELD_GHOST_BOOST, GHOST ; Spell Tag - db HELD_FIRE_BOOST, FIRE ; Charcoal - db HELD_WATER_BOOST, WATER ; Mystic Water - db HELD_GRASS_BOOST, GRASS ; Miracle Seed - db HELD_ELECTRIC_BOOST, ELECTRIC ; Magnet - db HELD_PSYCHIC_BOOST, PSYCHIC ; Twistedspoon - db HELD_ICE_BOOST, ICE ; Nevermeltice - db HELD_DRAGON_BOOST, DRAGON ; Dragon Scale - db HELD_DARK_BOOST, DARK ; Blackglasses - db HELD_STEEL_BOOST, STEEL ; Metal Coat - db $ff -; 35726 +INCLUDE "data/battle/type_boost_items.asm" BattleCommand_ConstantDamage: ; 35726 @@ -4671,7 +4636,7 @@ BattleCommand_FalseSwipe: ; 35c94 ld [de], a .okay ld a, [CriticalHit] - cp $2 + cp 2 jr nz, .carry xor a ld [CriticalHit], a @@ -5049,7 +5014,7 @@ BattleCommand_SleepTarget: ; 35e5c jr nz, .dont_fail call BattleRandom - cp $40 ; 25% + cp 25 percent + 1 ; 25% chance AI fails ret c .dont_fail @@ -5149,7 +5114,7 @@ BattleCommand_Poison: ; 35f2c jr nz, .mimic_random call BattleRandom - cp $40 ; 25% chance AI fails + cp 25 percent + 1 ; 25% chance AI fails jr c, .failed .mimic_random @@ -5827,7 +5792,7 @@ BattleCommand_StatDown: ; 362e3 inc b .ComputerMiss: -; Computer opponents have a 1/4 chance of failing. +; Computer opponents have a 25% chance of failing. ld a, [hBattleTurn] and a jr z, .DidntMiss @@ -5852,7 +5817,7 @@ BattleCommand_StatDown: ; 362e3 jr z, .DidntMiss call BattleRandom - cp $40 + cp 25 percent + 1 ; 25% chance AI fails jr c, .Failed .DidntMiss: @@ -6104,7 +6069,7 @@ BattleCommand_StatDownFailText: ; 3646a GetStatName: ; 3648f - ld hl, .names + ld hl, StatNames ld c, "@" .CheckName: dec b @@ -6120,33 +6085,10 @@ GetStatName: ; 3648f ld bc, StringBuffer3 - StringBuffer2 jp CopyBytes -.names - db "ATTACK@" - db "DEFENSE@" - db "SPEED@" - db "SPCL.ATK@" - db "SPCL.DEF@" - db "ACCURACY@" - db "EVASION@" - db "ABILITY@" -; 364e6 - - -StatLevelMultipliers: ; 364e6 - db 25, 100 ; 0.25x - db 28, 100 ; 0.28x - db 33, 100 ; 0.33x - db 40, 100 ; 0.40x - db 50, 100 ; 0.50x - db 66, 100 ; 0.66x - db 1, 1 ; 1.00x - db 15, 10 ; 1.50x - db 2, 1 ; 2.00x - db 25, 10 ; 2.50x - db 3, 1 ; 3.00x - db 35, 10 ; 3.50x - db 4, 1 ; 4.00x -; 36500 +INCLUDE "data/battle/stat_names.asm" + + +INCLUDE "data/battle/stat_multipliers.asm" BattleCommand_AllStatsUp: ; 36500 diff --git a/engine/events_3.asm b/engine/events_3.asm index 5ee113a95..b39714d27 100755 --- a/engine/events_3.asm +++ b/engine/events_3.asm @@ -1,13 +1,11 @@ ReturnFromMapSetupScript:: ; b8000 xor a ld [hBGMapMode], a - ; For some reson, GameFreak chose to use a farcall here instead of just falling through. - ; No other function in the game references the function at 2E:400A, here labeled - ; ReturnFromMapSetupScript.inefficient_farcall. farcall .inefficient_farcall ; this is a waste of 6 ROM bytes and 6 stack bytes ret ; b800a +; should have just been a fallthrough .inefficient_farcall ; b800a ld a, [MapGroup] ld b, a @@ -70,6 +68,7 @@ ReturnFromMapSetupScript:: ; b8000 ; b8070 .CheckSpecialMap: ; b8070 +; These landmarks do not get pop-up signs. cp -1 ret z cp SPECIAL_MAP @@ -401,6 +400,7 @@ RockMonEncounter: ; b8219 call GetTreeMons jr nc, .no_battle + ; 40% chance of an encounter ld a, 10 call RandomRange cp 4 @@ -461,7 +461,7 @@ GetTreeMons: ; b82d2 ; Return the address of TreeMon table a in hl. ; Return nc if table a doesn't exist. - cp 8 + cp NUM_TREEMON_SETS jr nc, .quit and a @@ -491,15 +491,16 @@ GetTreeMon: ; b83e5 push hl call GetTreeScore pop hl - and a + and a ; TREEMON_SCORE_BAD jr z, .bad - cp 1 + cp TREEMON_SCORE_GOOD jr z, .good - cp 2 + cp TREEMON_SCORE_RARE jr z, .rare ret .bad + ; 10% chance of an encounter ld a, 10 call RandomRange and a @@ -507,6 +508,7 @@ GetTreeMon: ; b83e5 jr SelectTreeMon .good + ; 50% chance of an encounter ld a, 10 call RandomRange cp 5 @@ -514,6 +516,7 @@ GetTreeMon: ; b83e5 jr SelectTreeMon .rare + ; 80% chance of an encounter ld a, 10 call RandomRange cp 8 @@ -542,7 +545,7 @@ SelectTreeMon: ; b841f .ok ld a, [hli] - cp $ff + cp -1 jr z, NoTreeMon ld a, [hli] @@ -575,15 +578,15 @@ GetTreeScore: ; b8443 jr c, .good .bad - xor a + xor a ; TREEMON_SCORE_BAD ret .good - ld a, 1 + ld a, TREEMON_SCORE_GOOD ret .rare - ld a, 2 + ld a, TREEMON_SCORE_RARE ret ; b8466 diff --git a/engine/link.asm b/engine/link.asm index e45f62dfd..779c288e8 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -2045,12 +2045,12 @@ Special_CheckTimeCapsuleCompatibility: ; 29bfb ; If any party Pokemon was introduced in the generation 2 games, don't let it in. ld hl, PartySpecies - ld b, PARTY_LENGTH ; 6 + ld b, PARTY_LENGTH .loop ld a, [hli] cp -1 jr z, .checkitem - cp CHIKORITA ; MEW + 1 ; 151 + 1 + cp MEW + 1 jr nc, .mon_too_new dec b jr nz, .loop diff --git a/engine/warp_connection.asm b/engine/warp_connection.asm index a0784caac..3a7292633 100755 --- a/engine/warp_connection.asm +++ b/engine/warp_connection.asm @@ -174,8 +174,11 @@ LoadWarpData: ; 1046c6 call GetAnyMapEnvironment call CheckIndoorMap ret nz + +; MOUNT_MOON_SQUARE and TIN_TOWER_ROOF are outdoor maps within indoor maps. +; Dig and Escape Rope should not take you to them. ld a, [wPrevMapGroup] - cp GROUP_MOUNT_MOON_SQUARE + cp GROUP_MOUNT_MOON_SQUARE ; GROUP_TIN_TOWER_ROOF jr nz, .not_mt_moon_or_tin_tower ld a, [wPrevMapNumber] cp MAP_MOUNT_MOON_SQUARE @@ -183,6 +186,7 @@ LoadWarpData: ; 1046c6 cp MAP_TIN_TOWER_ROOF ret z .not_mt_moon_or_tin_tower + ld a, [wPrevWarp] ld [wDigWarpNumber], a ld a, [wPrevMapGroup] @@ -206,6 +210,8 @@ LoadWarpData: ; 1046c6 ld b, a ld a, [wNextMapNumber] ld c, a + +; Respawn in Pokémon Centers. call GetAnyMapTileset ld a, c cp TILESET_POKECENTER @@ -214,6 +220,7 @@ LoadWarpData: ; 1046c6 jr z, .pokecenter_pokecom ret .pokecenter_pokecom + ld a, [wPrevMapGroup] ld [wLastSpawnMapGroup], a ld a, [wPrevMapNumber] -- cgit v1.2.3 From d91e42ca5e3796108b01df9e6535e84892cbf9cc Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 10 Jan 2018 18:10:01 -0500 Subject: Group some mutually edited files in data/sprites/ --- engine/color.asm | 2 +- engine/map_objects.asm | 4 ++-- engine/overworld.asm | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'engine') diff --git a/engine/color.asm b/engine/color.asm index 58a2c0df8..76729187a 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -1341,7 +1341,7 @@ TilesetBGPalette: INCLUDE "gfx/tilesets/bg_tiles.pal" MapObjectPals:: -INCLUDE "gfx/overworld/map_objects.pal" +INCLUDE "gfx/overworld/map_sprites.pal" RoofPals: INCLUDE "gfx/tilesets/roofs.pal" diff --git a/engine/map_objects.asm b/engine/map_objects.asm index a0dadf9a5..c65843254 100644 --- a/engine/map_objects.asm +++ b/engine/map_objects.asm @@ -1,6 +1,6 @@ -INCLUDE "data/facings.asm" +INCLUDE "data/sprites/facings.asm" -INCLUDE "data/map_objects.asm" +INCLUDE "data/sprites/map_objects.asm" ; 4357 diff --git a/engine/overworld.asm b/engine/overworld.asm index 68b8adaed..bd373db66 100755 --- a/engine/overworld.asm +++ b/engine/overworld.asm @@ -719,10 +719,10 @@ LoadEmote:: ; 1442f ; 1444d -INCLUDE "data/emotes.asm" +INCLUDE "data/sprites/emotes.asm" -INCLUDE "data/sprite_mons.asm" +INCLUDE "data/sprites/sprite_mons.asm" INCLUDE "data/maps/outdoor_sprites.asm" -INCLUDE "data/sprites.asm" +INCLUDE "data/sprites/sprites.asm" -- cgit v1.2.3 From 0a3b251dcb710a8319d6633122d92a983bcefd1c Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 10 Jan 2018 22:53:42 -0500 Subject: Arrays end with -1, not $ff --- engine/battle/ai/items.asm | 2 +- engine/battle/ai/scoring.asm | 24 +++---- engine/battle/core.asm | 4 +- engine/battle/effect_commands/present.asm | 4 +- engine/battle/misc.asm | 54 +++++++-------- engine/battle/used_move_text.asm | 105 +----------------------------- engine/events/crystal_unown.asm | 4 +- engine/item_effects.asm | 2 +- engine/namingscreen.asm | 4 +- engine/overworld.asm | 6 +- engine/slot_machine.asm | 44 +++++++------ 11 files changed, 79 insertions(+), 174 deletions(-) (limited to 'engine') diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm index 09595077a..d0867fb33 100644 --- a/engine/battle/ai/items.asm +++ b/engine/battle/ai/items.asm @@ -291,7 +291,7 @@ AI_Items: ; 39196 dbw X_DEFEND, .XDefend dbw X_SPEED, .XSpeed dbw X_SPECIAL, .XSpecial - db $ff + db -1 ; end ; 381be .FullHeal: ; 381be diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm index 44194d6f7..73284435a 100644 --- a/engine/battle/ai/scoring.asm +++ b/engine/battle/ai/scoring.asm @@ -68,7 +68,7 @@ AI_Basic: ; 38591 db EFFECT_TOXIC db EFFECT_POISON db EFFECT_PARALYZE - db $ff + db -1 ; end ; 385e0 @@ -400,7 +400,7 @@ AI_Smart: ; 386be dbw EFFECT_SOLARBEAM, AI_Smart_Solarbeam dbw EFFECT_THUNDER, AI_Smart_Thunder dbw EFFECT_FLY, AI_Smart_Fly - db $ff + db -1 ; end ; 387e3 @@ -1553,7 +1553,7 @@ AI_Smart_Encore: ; 38c3b db AEROBLAST db COTTON_SPORE db POWDER_SNOW - db $ff + db -1 ; end ; 38ca4 @@ -2214,7 +2214,7 @@ AI_Smart_Sandstorm: ; 38f7a db ROCK db GROUND db STEEL - db $ff + db -1 ; end ; 38fac @@ -2533,7 +2533,7 @@ RainDanceMoves: ; 390e7 db CRABHAMMER db OCTAZOOKA db WHIRLPOOL - db $ff + db -1 ; end ; 390f3 @@ -2622,7 +2622,7 @@ SunnyDayMoves: ; 39134 db SACRED_FIRE db MORNING_SUN db SYNTHESIS - db $ff + db -1 ; end ; 3913d @@ -3125,7 +3125,7 @@ UsefulMoves: ; 39301 db FIRE_BLAST db SOFTBOILED db SUPER_FANG - db $ff + db -1 ; end ; 39315 @@ -3209,7 +3209,7 @@ AI_Opportunist: ; 39315 db CONVERSION db SUBSTITUTE db FLAME_WHEEL - db $ff + db -1 ; end ; 39369 @@ -3324,7 +3324,7 @@ AI_Aggressive: ; 39369 db EFFECT_RAMPAGE db EFFECT_MULTI_HIT db EFFECT_DOUBLE_HIT - db $ff + db -1 ; end ; 393e7 @@ -3350,7 +3350,7 @@ AIDamageCalc: ; 393e7 db EFFECT_STATIC_DAMAGE db EFFECT_LEVEL_DAMAGE db EFFECT_PSYWAVE - db $ff + db -1 ; end ; 39418 @@ -3406,7 +3406,7 @@ AI_Cautious: ; 39418 db CONVERSION db SUBSTITUTE db SPIKES - db $ff + db -1 ; end ; 39453 @@ -3544,7 +3544,7 @@ endr .RiskyMoves: db EFFECT_SELFDESTRUCT db EFFECT_OHKO - db $ff + db -1 ; end ; 39502 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index ca0c73643..5b5b3562e 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -4548,7 +4548,7 @@ UseHeldStatusHealingItem: ; 3dde9 db HELD_HEAL_SLEEP, SLP db HELD_HEAL_PARALYZE, 1 << PAR db HELD_HEAL_STATUS, ALL_STATUS - db $ff + db -1 ; end ; 3de51 UseConfusionHealingItem: ; 3de51 @@ -4672,7 +4672,7 @@ HandleStatBoostingHeldItems: ; 3de97 dbw HELD_SP_DEFENSE_UP, BattleCommand_SpecialDefenseUp dbw HELD_ACCURACY_UP, BattleCommand_AccuracyUp dbw HELD_EVASION_UP, BattleCommand_EvasionUp - db $ff + db -1 ; end ; 3df12 GetPartymonItem: ; 3df12 diff --git a/engine/battle/effect_commands/present.asm b/engine/battle/effect_commands/present.asm index 819294f8c..2b358e8b9 100755 --- a/engine/battle/effect_commands/present.asm +++ b/engine/battle/effect_commands/present.asm @@ -31,7 +31,7 @@ BattleCommand_Present: ; 37874 ld c, 0 .next ld a, [hli] - cp $ff + cp -1 jr z, .heal_effect ; 378a4 $11 cp b jr nc, .got_power ; 378a7 $4 @@ -89,5 +89,5 @@ BattleCommand_Present: ; 37874 db 40 percent, 40 db 70 percent + 1, 80 db 80 percent, 120 - db $ff + db -1 ; end ; 3790e diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm index c78e9fd84..a41d31d9a 100644 --- a/engine/battle/misc.asm +++ b/engine/battle/misc.asm @@ -146,15 +146,15 @@ DoWeatherModifiers: ; fbda4 ret .WeatherTypeModifiers: - db WEATHER_RAIN, WATER, 15 - db WEATHER_RAIN, FIRE, 05 - db WEATHER_SUN, FIRE, 15 - db WEATHER_SUN, WATER, 05 - db $ff + db WEATHER_RAIN, WATER, MORE_EFFECTIVE + db WEATHER_RAIN, FIRE, NOT_VERY_EFFECTIVE + db WEATHER_SUN, FIRE, MORE_EFFECTIVE + db WEATHER_SUN, WATER, NOT_VERY_EFFECTIVE + db -1 ; end .WeatherMoveModifiers: - db WEATHER_RAIN, EFFECT_SOLARBEAM, 05 - db $ff + db WEATHER_RAIN, EFFECT_SOLARBEAM, NOT_VERY_EFFECTIVE + db -1 ; end ; fbe24 @@ -183,7 +183,7 @@ DoBadgeTypeBoosts: ; fbe24 .CheckBadge: ld a, [hl] - cp $ff + cp -1 jr z, .done srl b @@ -236,22 +236,24 @@ DoBadgeTypeBoosts: ; fbe24 ret .BadgeTypes: - db FLYING ; zephyrbadge - db BUG ; hivebadge - db NORMAL ; plainbadge - db GHOST ; fogbadge - db STEEL ; mineralbadge - db FIGHTING ; stormbadge - db ICE ; glacierbadge - db DRAGON ; risingbadge - - db ROCK ; boulderbadge - db WATER ; cascadebadge - db ELECTRIC ; thunderbadge - db GRASS ; rainbowbadge - db POISON ; soulbadge - db PSYCHIC ; marshbadge - db FIRE ; volcanobadge - db GROUND ; earthbadge - db $ff +; entries correspond to wJohtoBadges constants + db FLYING ; ZEPHYRBADGE + db BUG ; HIVEBADGE + db NORMAL ; PLAINBADGE + db GHOST ; FOGBADGE + db STEEL ; MINERALBADGE + db FIGHTING ; STORMBADGE + db ICE ; GLACIERBADGE + db DRAGON ; RISINGBADGE + ; fallthrough +; entries correspond to wKantoBadges constants + db ROCK ; BOULDERBADGE + db WATER ; CASCADEBADGE + db ELECTRIC ; THUNDERBADGE + db GRASS ; RAINBOWBADGE + db POISON ; SOULBADGE + db PSYCHIC ; MARSHBADGE + db FIRE ; VOLCANOBADGE + db GROUND ; EARTHBADGE + db -1 ; end ; fbe91 diff --git a/engine/battle/used_move_text.asm b/engine/battle/used_move_text.asm index ce9e51359..1b5aa564c 100755 --- a/engine/battle/used_move_text.asm +++ b/engine/battle/used_move_text.asm @@ -157,12 +157,12 @@ GetMoveGrammar: ; 105e5c .loop ld a, [hli] ; end of table? - cp $ff + cp -1 jr z, .end ; match? cp c jr z, .end -; advance grammar type at $00 +; advance grammar type at 0 and a jr nz, .loop ; next grammar type @@ -179,106 +179,7 @@ GetMoveGrammar: ; 105e5c ret ; 105e7a -MoveGrammar: ; 105e7a -; made redundant in localization -; each move is given an identifier for what usedmovetext to use (0-4): - -; 0 - db SWORDS_DANCE - db GROWTH - db STRENGTH - db HARDEN - db MINIMIZE - db SMOKESCREEN - db WITHDRAW - db DEFENSE_CURL - db EGG_BOMB - db SMOG - db BONE_CLUB - db FLASH - db SPLASH - db ACID_ARMOR - db BONEMERANG - db REST - db SHARPEN - db SUBSTITUTE - db MIND_READER - db SNORE - db PROTECT - db SPIKES - db ENDURE - db ROLLOUT - db SWAGGER - db SLEEP_TALK - db HIDDEN_POWER - db PSYCH_UP - db EXTREMESPEED - db 0 ; end set - -; 1 - db RECOVER - db TELEPORT - db BIDE - db SELFDESTRUCT - db AMNESIA - db FLAIL - db 0 ; end set - -; 2 - db MEDITATE - db AGILITY - db MIMIC - db DOUBLE_TEAM - db BARRAGE - db TRANSFORM - db STRUGGLE - db SCARY_FACE - db 0 ; end set - -; 3 - db POUND - db SCRATCH - db VICEGRIP - db WING_ATTACK - db FLY - db BIND - db SLAM - db HORN_ATTACK - db WRAP - db THRASH - db TAIL_WHIP - db LEER - db BITE - db GROWL - db ROAR - db SING - db PECK - db ABSORB - db STRING_SHOT - db EARTHQUAKE - db FISSURE - db DIG - db TOXIC - db SCREECH - db METRONOME - db LICK - db CLAMP - db CONSTRICT - db POISON_GAS - db BUBBLE - db SLASH - db SPIDER_WEB - db NIGHTMARE - db CURSE - db FORESIGHT - db CHARM - db ATTRACT - db ROCK_SMASH - db 0 ; end set - -; all other moves = 4 - db $ff ; end -; 105ed0 +INCLUDE "data/moves/grammar.asm" UpdateUsedMoves: ; 105ed0 diff --git a/engine/events/crystal_unown.asm b/engine/events/crystal_unown.asm index 09d44bb9a..ce9673ee7 100644 --- a/engine/events/crystal_unown.asm +++ b/engine/events/crystal_unown.asm @@ -137,7 +137,7 @@ Special_DisplayUnownWords: ; 8ae68 .loop2 ld a, [de] inc de - cp $ff + cp -1 jr nz, .loop2 dec c jr nz, .loop2 @@ -175,7 +175,7 @@ endc db x shift endr - db $ff + db -1 ; end ENDM .UnownText: ; 8aebc diff --git a/engine/item_effects.asm b/engine/item_effects.asm index b4437715c..026541b6f 100644 --- a/engine/item_effects.asm +++ b/engine/item_effects.asm @@ -748,7 +748,7 @@ BallMultiplierFunctionTable: dbw MOON_BALL, MoonBallMultiplier dbw LOVE_BALL, LoveBallMultiplier dbw PARK_BALL, ParkBallMultiplier - db $ff + db -1 ; end UltraBallMultiplier: ; multiply catch rate by 2 diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index c81934d27..0e059613b 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -774,12 +774,12 @@ Dakutens: ; Dummied out db "サザ", "シジ", "スズ", "セゼ", "ソゾ" db "タダ", "チヂ", "ツヅ", "テデ", "トド" db "ハバ", "ヒビ", "フブ", "へべ", "ホボ" - db $ff + db -1 ; end Handakutens: ; Dummied out db "はぱ", "ひぴ", "ふぷ", "へぺ", "ほぽ" db "ハパ", "ヒピ", "フプ", "へぺ", "ホポ" - db $ff + db -1 ; end ; 11bbc diff --git a/engine/overworld.asm b/engine/overworld.asm index bd373db66..b4825290c 100755 --- a/engine/overworld.asm +++ b/engine/overworld.asm @@ -77,7 +77,7 @@ GetPlayerSprite: ; 14183 cp c jr z, .good inc hl - cp $ff + cp -1 jr nz, .loop ; Any player state not in the array defaults to Chris's sprite. @@ -100,14 +100,14 @@ GetPlayerSprite: ; 14183 db PLAYER_BIKE, SPRITE_CHRIS_BIKE db PLAYER_SURF, SPRITE_SURF db PLAYER_SURF_PIKA, SPRITE_SURFING_PIKACHU - db $ff + db -1 ; end .Kris: db PLAYER_NORMAL, SPRITE_KRIS db PLAYER_BIKE, SPRITE_KRIS_BIKE db PLAYER_SURF, SPRITE_SURF db PLAYER_SURF_PIKA, SPRITE_SURFING_PIKACHU - db $ff + db -1 ; end ; 141c9 diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index a4da2d3ad..c47e5261e 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -1,11 +1,13 @@ -SLOTS_NOBIAS EQU -1 -SLOTS_NOMATCH EQU -1 -SLOTS_SEVEN EQU $00 +SLOTS_NO_BIAS EQU -1 +SLOTS_NO_MATCH EQU -1 + +SLOTS_SEVEN EQU $00 SLOTS_POKEBALL EQU $04 -SLOTS_CHERRY EQU $08 -SLOTS_PIKACHU EQU $0c +SLOTS_CHERRY EQU $08 +SLOTS_PIKACHU EQU $0c SLOTS_SQUIRTLE EQU $10 -SLOTS_STARYU EQU $14 +SLOTS_STARYU EQU $14 + REEL_SIZE EQU 15 ; Constants for slot_reel offsets (see macros/wram.asm) @@ -148,7 +150,7 @@ _SlotMachine: ld [hl], $40 xor a ; SLOTS_INIT ld [wJumptableIndex], a - ld a, SLOTS_NOBIAS + ld a, SLOTS_NO_BIAS ld [wSlotBias], a ld de, MUSIC_GAME_CORNER call PlayMusic @@ -309,7 +311,7 @@ SlotsAction_Init: ; 9287e (24:687e) xor a ld [wFirstTwoReelsMatching], a ld [wFirstTwoReelsMatchingSevens], a - ld a, SLOTS_NOMATCH + ld a, SLOTS_NO_MATCH ld [wSlotMatched], a ret @@ -417,7 +419,7 @@ SlotsAction_WaitStopReel3: ; 9293a (24:693a) SlotsAction_FlashIfWin: ; 92955 (24:6955) ld a, [wSlotMatched] - cp SLOTS_NOMATCH + cp SLOTS_NO_MATCH jr nz, .GotIt call SlotsAction_Next call SlotsAction_Next @@ -587,7 +589,7 @@ Slots_StopReel2: ; 92a2e (24:6a2e) ld a, [wSlotBias] and a jr z, .skip - cp SLOTS_NOBIAS + cp SLOTS_NO_BIAS jr nz, .dont_jump .skip call .CheckReel1ForASeven @@ -997,7 +999,7 @@ ReelAction_StopReel1: ; 92c5e ; even if the current bet won't allow lining it up. ld a, [wSlotBias] - cp SLOTS_NOBIAS + cp SLOTS_NO_BIAS jr z, .NoBias ld hl, REEL_MANIP_COUNTER add hl, bc @@ -1043,7 +1045,7 @@ ReelAction_StopReel2: ; 92c86 jr z, .NoBias .nope ld a, [wSlotBias] - cp SLOTS_NOBIAS + cp SLOTS_NO_BIAS jr z, .NoBias ld hl, REEL_MANIP_COUNTER add hl, bc @@ -1079,7 +1081,7 @@ ReelAction_StopReel3: ; 92ca9 .NoMatch: ld a, [wSlotBias] - cp SLOTS_NOBIAS + cp SLOTS_NO_BIAS jr z, .NoBias ld hl, REEL_MANIP_COUNTER add hl, bc @@ -1532,7 +1534,7 @@ Slots_CheckMatchedFirstTwoReels: ; 92e94 ; 92f1d Slots_CheckMatchedAllThreeReels: ; 92f1d - ld a, SLOTS_NOMATCH + ld a, SLOTS_NO_MATCH ld [wSlotMatched], a call Slots_GetCurrentReelState call Slots_CopyReelState @@ -1552,7 +1554,7 @@ Slots_CheckMatchedAllThreeReels: ; 92f1d .return ld a, [wSlotMatched] - cp SLOTS_NOMATCH + cp SLOTS_NO_MATCH jr nz, .matched_nontrivial and a ret @@ -1753,7 +1755,7 @@ Slots_InitBias: ; 93002 (24:7002) db $14, SLOTS_SQUIRTLE ; 5/128 db $28, SLOTS_PIKACHU ; 5/64 db $30, SLOTS_CHERRY ; 1/32 - db $ff, SLOTS_NOBIAS ; everything else + db $ff, SLOTS_NO_BIAS ; everything else ; 93031 .Lucky: ; 93031 @@ -1763,7 +1765,7 @@ Slots_InitBias: ; 93002 (24:7002) db $10, SLOTS_SQUIRTLE ; 1/32 db $1e, SLOTS_PIKACHU ; 7/128 db $50, SLOTS_CHERRY ; 25/128 - db $ff, SLOTS_NOBIAS ; everything else + db $ff, SLOTS_NO_BIAS ; everything else ; 9303f Slots_IlluminateBetLights: ; 9303f (24:703f) @@ -1924,7 +1926,7 @@ Slots_AskPlayAgain: ; 930e9 (24:70e9) Slots_GetPayout: ; 93124 (24:7124) ld a, [wSlotMatched] - cp SLOTS_NOMATCH + cp SLOTS_NO_MATCH jr z, .no_win srl a ld e, a @@ -1957,7 +1959,7 @@ Slots_GetPayout: ; 93124 (24:7124) Slots_PayoutText: ; 93158 (24:7158) ld a, [wSlotMatched] - cp SLOTS_NOMATCH + cp SLOTS_NO_MATCH jr nz, .MatchedSomething ld hl, .Text_Darn call PrintText @@ -2047,7 +2049,7 @@ endr call Random and %0010100 ret z ; 25% chance to stick with seven symbol bias - ld a, SLOTS_NOBIAS + ld a, SLOTS_NO_BIAS ld [wSlotBias], a ret @@ -2055,7 +2057,7 @@ endr call Random and %0011100 ret z ; 12.5% chance to stick with seven symbol bias - ld a, SLOTS_NOBIAS + ld a, SLOTS_NO_BIAS ld [wSlotBias], a ret -- cgit v1.2.3 From cc8dac5a22a4f9307dd2f94e4bf29ee5b132c0b7 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 11 Jan 2018 00:25:14 -0500 Subject: Use constants and data for Unown chamber events --- engine/events/crystal_unown.asm | 324 ---------------------------------------- engine/events/unown_walls.asm | 267 +++++++++++++++++++++++++++++++++ engine/unown_puzzle.asm | 9 +- 3 files changed, 272 insertions(+), 328 deletions(-) delete mode 100644 engine/events/crystal_unown.asm create mode 100644 engine/events/unown_walls.asm (limited to 'engine') diff --git a/engine/events/crystal_unown.asm b/engine/events/crystal_unown.asm deleted file mode 100644 index ce9673ee7..000000000 --- a/engine/events/crystal_unown.asm +++ /dev/null @@ -1,324 +0,0 @@ -SpecialHoOhChamber: ; 0x8addb - ld hl, PartySpecies - ld a, [hl] - cp HO_OH ; is Ho-oh the first Pokémon in the party? - jr nz, .done ; if not, we're done - call GetSecondaryMapHeaderPointer - ld de, EVENT_WALL_OPENED_IN_HO_OH_CHAMBER - ld b, SET_FLAG - call EventFlagAction -.done - ret -; 0x8adef - -SpecialOmanyteChamber: ; 8adef - call GetSecondaryMapHeaderPointer - ld de, EVENT_WALL_OPENED_IN_OMANYTE_CHAMBER - ld b, CHECK_FLAG - call EventFlagAction - ld a, c - and a - jr nz, .nope - - ld a, WATER_STONE - ld [CurItem], a - ld hl, NumItems - call CheckItem - jr c, .open - - ld a, [PartyCount] - ld b, a - inc b -.loop - dec b - jr z, .nope - ld a, b - dec a - ld [CurPartyMon], a - push bc - ld a, MON_ITEM - call GetPartyParamLocation - pop bc - ld a, [hl] - cp WATER_STONE - jr nz, .loop - -.open - call GetSecondaryMapHeaderPointer - ld de, EVENT_WALL_OPENED_IN_OMANYTE_CHAMBER - ld b, SET_FLAG - call EventFlagAction - -.nope - ret -; 8ae30 - -SpecialAerodactylChamber: ; 8ae30 - push de - push bc - - call GetSecondaryMapHeaderPointer - ld a, h - cp HIGH(RuinsOfAlphAerodactylChamber_SecondMapHeader) - jr nz, .nope - ld a, l - cp LOW(RuinsOfAlphAerodactylChamber_SecondMapHeader) - jr nz, .nope - - ld de, EVENT_WALL_OPENED_IN_AERODACTYL_CHAMBER - ld b, SET_FLAG - call EventFlagAction - - scf - jr .done - -.nope - and a - -.done - pop bc - pop de - ret -; 8ae4e - -SpecialKabutoChamber: ; 8ae4e - push hl - push de - - call GetSecondaryMapHeaderPointer - ld a, h - cp HIGH(RuinsOfAlphKabutoChamber_SecondMapHeader) - jr nz, .done - ld a, l - cp LOW(RuinsOfAlphKabutoChamber_SecondMapHeader) - jr nz, .done - - ld de, EVENT_WALL_OPENED_IN_KABUTO_CHAMBER - ld b, SET_FLAG - call EventFlagAction - -.done - pop de - pop hl - ret -; 8ae68 - -Special_DisplayUnownWords: ; 8ae68 - ld a, [ScriptVar] - ld hl, .MenuDataHeaders_UnownWalls - and a - jr z, .load - - ld d, $0 - ld e, $5 -.loop - add hl, de - dec a - jr nz, .loop - -.load - call LoadMenuDataHeader - xor a - ld [hBGMapMode], a - call MenuBox - call UpdateSprites - call ApplyTilemap - call MenuBoxCoord2Tile - inc hl - ld d, 0 - ld e, SCREEN_WIDTH - add hl, de - add hl, de - ld a, [ScriptVar] - ld c, a - ld de, .UnownText - and a - jr z, .copy -.loop2 - ld a, [de] - inc de - cp -1 - jr nz, .loop2 - dec c - jr nz, .loop2 -.copy - call .CopyWord - ld bc, AttrMap - TileMap - add hl, bc - call .FillAttr - call WaitBGMap2 - call JoyWaitAorB - call PlayClickSFX - call CloseWindow - ret -; 8aebc - -unownwall: MACRO -rept _NARG -if \1 == "-" -x = $64 -else -if \1 >= "Y" -x = 2 * (\1 - "Y") + $60 -else -if \1 >= "Q" -x = 2 * (\1 - "Q") + $40 -else -if \1 >= "I" -x = 2 * (\1 - "I") + $20 -else -x = 2 * (\1 - "A") -endc -endc -endc -endc - db x -shift -endr - db -1 ; end -ENDM - -.UnownText: ; 8aebc -;.UnownText_Escape: - ; db $08, $44, $04, $00, $2e, $08, $ff - unownwall "E", "S", "C", "A", "P", "E" -;.UnownText_Light: - ; db $26, $20, $0c, $0e, $46, $ff - unownwall "L", "I", "G", "H", "T" -;.UnownText_Water: - ; db $4c, $00, $46, $08, $42, $ff - unownwall "W", "A", "T", "E", "R" -;.UnownText_Ho_Oh: - ; db $0e, $2c, $64, $2c, $0e, $ff - unownwall "H", "O", "-", "O", "H" -; 8aed5 - -.MenuDataHeaders_UnownWalls: ; 0x8aed5 -;.MenuDataHeader_Escape: - db $40 ; flags - db 04, 03 ; start coords - db 09, 16 ; end coords -;.MenuDataHeader_Light: - db $40 ; flags - db 04, 04 ; start coords - db 09, 15 ; end coords -;.MenuDataHeader_Water: - db $40 ; flags - db 04, 04 ; start coords - db 09, 15 ; end coords -;.MenuDataHeader_Ho_Oh: - db $40 ; flags - db 04, 04 ; start coords - db 09, 15 ; end coords -; 8aee9 - -.FillAttr: ; 8aee9 - ld a, [de] - cp $ff - ret z - cp $60 - ld a, VRAM_BANK_1 | PAL_BG_BROWN - jr c, .got_pal - ld a, PAL_BG_BROWN - -.got_pal - call .PlaceSquare - inc hl - inc hl - inc de - jr .FillAttr -; 8aefd - -.PlaceSquare: ; 8aefd - push hl - ld [hli], a - ld [hld], a - ld b, 0 - ld c, SCREEN_WIDTH - add hl, bc - ld [hli], a - ld [hl], a - pop hl - ret -; 8af09 - -.CopyWord: ; 8af09 - push hl - push de -.word_loop - ld a, [de] - cp $ff - jr z, .word_done - ld c, a - call .ConvertChar - inc hl - inc hl - inc de - jr .word_loop - -.word_done - pop de - pop hl - ret -; 8af1c - -.ConvertChar: ; 8af1c - push hl - ld a, c - cp $60 - jr z, .Tile60 - cp $62 - jr z, .Tile62 - cp $64 - jr z, .Tile64 - ld [hli], a - inc a - ld [hld], a - dec a - ld b, 0 - ld c, SCREEN_WIDTH - add hl, bc - ld c, $10 - add c - ld [hli], a - inc a - ld [hl], a - pop hl - ret - -.Tile60: - ld [hl], $5b - inc hl - ld [hl], $5c - ld bc, SCREEN_WIDTH - 1 - add hl, bc - ld [hl], $4d - inc hl - ld [hl], $5d - pop hl - ret - -.Tile62: - ld [hl], $4e - inc hl - ld [hl], $4f - ld bc, SCREEN_WIDTH - 1 - add hl, bc - ld [hl], $5e - inc hl - ld [hl], $5f - pop hl - ret - -.Tile64: - ld [hl], $2 - inc hl - ld [hl], $3 - ld bc, SCREEN_WIDTH - 1 - add hl, bc - ld [hl], $3 - inc hl - ld [hl], $2 - pop hl - ret -; 8af6b diff --git a/engine/events/unown_walls.asm b/engine/events/unown_walls.asm new file mode 100644 index 000000000..d4e6083c4 --- /dev/null +++ b/engine/events/unown_walls.asm @@ -0,0 +1,267 @@ +SpecialHoOhChamber: ; 0x8addb + ld hl, PartySpecies + ld a, [hl] + cp HO_OH ; is Ho-oh the first Pokémon in the party? + jr nz, .done ; if not, we're done + call GetSecondaryMapHeaderPointer + ld de, EVENT_WALL_OPENED_IN_HO_OH_CHAMBER + ld b, SET_FLAG + call EventFlagAction +.done + ret +; 0x8adef + +SpecialOmanyteChamber: ; 8adef + call GetSecondaryMapHeaderPointer + ld de, EVENT_WALL_OPENED_IN_OMANYTE_CHAMBER + ld b, CHECK_FLAG + call EventFlagAction + ld a, c + and a + jr nz, .nope + + ld a, WATER_STONE + ld [CurItem], a + ld hl, NumItems + call CheckItem + jr c, .open + + ld a, [PartyCount] + ld b, a + inc b +.loop + dec b + jr z, .nope + ld a, b + dec a + ld [CurPartyMon], a + push bc + ld a, MON_ITEM + call GetPartyParamLocation + pop bc + ld a, [hl] + cp WATER_STONE + jr nz, .loop + +.open + call GetSecondaryMapHeaderPointer + ld de, EVENT_WALL_OPENED_IN_OMANYTE_CHAMBER + ld b, SET_FLAG + call EventFlagAction + +.nope + ret +; 8ae30 + +SpecialAerodactylChamber: ; 8ae30 + push de + push bc + + call GetSecondaryMapHeaderPointer + ld a, h + cp HIGH(RuinsOfAlphAerodactylChamber_SecondMapHeader) + jr nz, .nope + ld a, l + cp LOW(RuinsOfAlphAerodactylChamber_SecondMapHeader) + jr nz, .nope + + ld de, EVENT_WALL_OPENED_IN_AERODACTYL_CHAMBER + ld b, SET_FLAG + call EventFlagAction + + scf + jr .done + +.nope + and a + +.done + pop bc + pop de + ret +; 8ae4e + +SpecialKabutoChamber: ; 8ae4e + push hl + push de + + call GetSecondaryMapHeaderPointer + ld a, h + cp HIGH(RuinsOfAlphKabutoChamber_SecondMapHeader) + jr nz, .done + ld a, l + cp LOW(RuinsOfAlphKabutoChamber_SecondMapHeader) + jr nz, .done + + ld de, EVENT_WALL_OPENED_IN_KABUTO_CHAMBER + ld b, SET_FLAG + call EventFlagAction + +.done + pop de + pop hl + ret +; 8ae68 + +Special_DisplayUnownWords: ; 8ae68 + ld a, [ScriptVar] + ld hl, MenuDataHeaders_UnownWalls + and a + jr z, .load + + ld d, $0 + ld e, $5 +.loop + add hl, de + dec a + jr nz, .loop + +.load + call LoadMenuDataHeader + xor a + ld [hBGMapMode], a + call MenuBox + call UpdateSprites + call ApplyTilemap + call MenuBoxCoord2Tile + inc hl + ld d, 0 + ld e, SCREEN_WIDTH + add hl, de + add hl, de + ld a, [ScriptVar] + ld c, a + ld de, UnownWalls + and a + jr z, .copy +.loop2 + ld a, [de] + inc de + cp -1 + jr nz, .loop2 + dec c + jr nz, .loop2 +.copy + call _DisplayUnownWords_CopyWord + ld bc, AttrMap - TileMap + add hl, bc + call _DisplayUnownWords_FillAttr + call WaitBGMap2 + call JoyWaitAorB + call PlayClickSFX + call CloseWindow + ret +; 8aebc + +INCLUDE "data/unown_walls.asm" + +_DisplayUnownWords_FillAttr: ; 8aee9 + ld a, [de] + cp $ff + ret z + cp $60 + ld a, VRAM_BANK_1 | PAL_BG_BROWN + jr c, .got_pal + ld a, PAL_BG_BROWN + +.got_pal + call .PlaceSquare + inc hl + inc hl + inc de + jr _DisplayUnownWords_FillAttr +; 8aefd + +.PlaceSquare: ; 8aefd + push hl + ld [hli], a + ld [hld], a + ld b, 0 + ld c, SCREEN_WIDTH + add hl, bc + ld [hli], a + ld [hl], a + pop hl + ret +; 8af09 + +_DisplayUnownWords_CopyWord: ; 8af09 + push hl + push de +.word_loop + ld a, [de] + cp $ff + jr z, .word_done + ld c, a + call .ConvertChar + inc hl + inc hl + inc de + jr .word_loop + +.word_done + pop de + pop hl + ret +; 8af1c + +.ConvertChar: ; 8af1c + push hl + ld a, c + cp $60 + jr z, .Tile60 + cp $62 + jr z, .Tile62 + cp $64 + jr z, .Tile64 + ld [hli], a + inc a + ld [hld], a + dec a + ld b, 0 + ld c, SCREEN_WIDTH + add hl, bc + ld c, $10 + add c + ld [hli], a + inc a + ld [hl], a + pop hl + ret + +.Tile60: + ld [hl], $5b + inc hl + ld [hl], $5c + ld bc, SCREEN_WIDTH - 1 + add hl, bc + ld [hl], $4d + inc hl + ld [hl], $5d + pop hl + ret + +.Tile62: + ld [hl], $4e + inc hl + ld [hl], $4f + ld bc, SCREEN_WIDTH - 1 + add hl, bc + ld [hl], $5e + inc hl + ld [hl], $5f + pop hl + ret + +.Tile64: + ld [hl], $2 + inc hl + ld [hl], $3 + ld bc, SCREEN_WIDTH - 1 + add hl, bc + ld [hl], $3 + inc hl + ld [hl], $2 + pop hl + ret +; 8af6b diff --git a/engine/unown_puzzle.asm b/engine/unown_puzzle.asm index 2074fb314..429bfaefd 100755 --- a/engine/unown_puzzle.asm +++ b/engine/unown_puzzle.asm @@ -157,7 +157,7 @@ PlaceStartCancelBoxBorder: ; e128d ld a, $f3 ld [hli], a ld bc, 10 - ld a, $ef + ld a, PUZZLE_VOID call ByteFill hlcoord 15, 16 ld a, $f3 @@ -218,7 +218,7 @@ UnownPuzzleJumptable: ; e12ca ld a, [hl] cp 1 puzcoord 0 ret c - sub $6 + sub 6 ld [hl], a jr .done_joypad @@ -235,7 +235,7 @@ UnownPuzzleJumptable: ; e12ca ret z cp 5 puzcoord 0 ret nc - add $6 + add 6 ld [hl], a jr .done_joypad @@ -835,7 +835,7 @@ INCBIN "gfx/unown_puzzle/tile_borders.2bpp" LoadUnownPuzzlePiecesGFX: ; e17a3 ld a, [ScriptVar] - and 3 + maskbits NUM_UNOWN_PUZZLES +- 1 ld e, a ld d, 0 ld hl, .LZPointers @@ -851,6 +851,7 @@ LoadUnownPuzzlePiecesGFX: ; e17a3 ; e17bd .LZPointers: ; e17bd +; entries correspond to UNOWNPUZZLE_* constants dw KabutoPuzzleLZ dw OmanytePuzzleLZ dw AerodactylPuzzleLZ -- cgit v1.2.3 From b45f89f80c62d22cbc2a4b38ae63a2da67878ee4 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 11 Jan 2018 01:45:27 -0500 Subject: More constants and data tables --- engine/events/elevator.asm | 58 +++--------------------------------- engine/events/magnet_train.asm | 31 ++++++-------------- engine/events/poisonstep_pals.asm | 1 - engine/events/std_scripts.asm | 5 ++-- engine/item_effects.asm | 51 ++++---------------------------- engine/map_objects.asm | 2 ++ engine/menu_2.asm | 12 ++------ engine/namingscreen.asm | 16 +--------- engine/party_menu.asm | 62 ++++++++++++++++++++++++++------------- engine/phone/phone.asm | 14 ++++----- engine/pokedex.asm | 53 ++++++--------------------------- engine/pokegear.asm | 2 +- engine/sgb_layouts.asm | 48 ++++++------------------------ engine/types.asm | 4 +-- 14 files changed, 95 insertions(+), 264 deletions(-) (limited to 'engine') diff --git a/engine/events/elevator.asm b/engine/events/elevator.asm index 9170b642d..35e95fa3c 100755 --- a/engine/events/elevator.asm +++ b/engine/events/elevator.asm @@ -200,12 +200,12 @@ Elevator_MenuData2: ; 0x13558 db 4, 0 ; rows, columns db 1 ; horizontal spacing dbw 0, CurElevator - dba GetElevatorFlorStrings + dba GetElevatorFloorStrings dba NULL dba NULL ; 13568 -GetElevatorFlorStrings: ; 13568 +GetElevatorFloorStrings: ; 13568 ld a, [MenuSelection] GetFloorString: ; 1356b push de @@ -220,7 +220,7 @@ FloorToString: ; 13575 push de ld e, a ld d, 0 - ld hl, .floors + ld hl, ElevatorFloorNames add hl, de add hl, de ld a, [hli] @@ -230,54 +230,4 @@ FloorToString: ; 13575 ret ; 13583 -.floors - dw .b4f - dw .b3f - dw .b2f - dw .b1f - dw ._1f - dw ._2f - dw ._3f - dw ._4f - dw ._5f - dw ._6f - dw ._7f - dw ._8f - dw ._9f - dw ._10f - dw ._11f - dw .roof - -.b4f - db "B4F@" -.b3f - db "B3F@" -.b2f - db "B2F@" -.b1f - db "B1F@" -._1f - db "1F@" -._2f - db "2F@" -._3f - db "3F@" -._4f - db "4F@" -._5f - db "5F@" -._6f - db "6F@" -._7f - db "7F@" -._8f - db "8F@" -._9f - db "9F@" -._10f - db "10F@" -._11f - db "11F@" -.roof - db "ROOF@" -; 135db +INCLUDE "data/elevator_floors.asm" diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm index c85642ab8..a4b523d1e 100755 --- a/engine/events/magnet_train.asm +++ b/engine/events/magnet_train.asm @@ -220,8 +220,7 @@ GetMagnetTrainBGTiles: ; 8cd74 ; 8cd82 MagnetTrainBGTiles: ; 8cd82 -; Alternating tiles for each line -; of the Magnet Train tilemap. +; Alternating tiles for each line of the Magnet Train tilemap. db $4c, $4d ; bush db $5c, $5d ; bush db $4c, $4d ; bush @@ -263,25 +262,25 @@ SetMagnetTrainPals: ; 8cdc3 ; bushes hlbgcoord 0, 0 ld bc, 4 * BG_MAP_WIDTH - ld a, $2 + ld a, PAL_BG_GREEN call ByteFill ; train hlbgcoord 0, 4 ld bc, 10 * BG_MAP_WIDTH - xor a + xor a ; PAL_BG_GRAY call ByteFill ; more bushes hlbgcoord 0, 14 ld bc, 4 * BG_MAP_WIDTH - ld a, $2 + ld a, PAL_BG_GREEN call ByteFill ; train window hlbgcoord 7, 8 ld bc, 6 - ld a, $4 + ld a, PAL_BG_YELLOW call ByteFill ld a, $0 @@ -459,23 +458,11 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae ; 8ceff MagnetTrainTilemap1: - db $1f, $05, $06, $0a, $0a - db $0a, $09, $0a, $0a, $0a - db $0a, $0a, $0a, $09, $0a - db $0a, $0a, $0b, $0c, $1f + db $1f, $05, $06, $0a, $0a, $0a, $09, $0a, $0a, $0a, $0a, $0a, $0a, $09, $0a, $0a, $0a, $0b, $0c, $1f MagnetTrainTilemap2: - db $14, $15, $16, $1a, $1a - db $1a, $19, $1a, $1a, $1a - db $1a, $1a, $1a, $19, $1a - db $1a, $1a, $1b, $1c, $1d + db $14, $15, $16, $1a, $1a, $1a, $19, $1a, $1a, $1a, $1a, $1a, $1a, $19, $1a, $1a, $1a, $1b, $1c, $1d MagnetTrainTilemap3: - db $24, $25, $26, $27, $07 - db $2f, $29, $28, $28, $28 - db $28, $28, $28, $29, $07 - db $2f, $2a, $2b, $2c, $2d + db $24, $25, $26, $27, $07, $2f, $29, $28, $28, $28, $28, $28, $28, $29, $07, $2f, $2a, $2b, $2c, $2d MagnetTrainTilemap4: - db $20, $1f, $2e, $1f, $17 - db $00, $2e, $1f, $1f, $1f - db $1f, $1f, $1f, $2e, $17 - db $00, $1f, $2e, $1f, $0f + db $20, $1f, $2e, $1f, $17, $00, $2e, $1f, $1f, $1f, $1f, $1f, $1f, $2e, $17, $00, $1f, $2e, $1f, $0f ; 8cf4f diff --git a/engine/events/poisonstep_pals.asm b/engine/events/poisonstep_pals.asm index 498ae8f18..10a254ceb 100644 --- a/engine/events/poisonstep_pals.asm +++ b/engine/events/poisonstep_pals.asm @@ -31,7 +31,6 @@ LoadPoisonBGPals: ; cbcdd ld hl, wBGPals2 ld c, 4 palettes .loop -; RGB 28, 21, 31 ld a, LOW(palred 28 + palgreen 21 + palblue 31) ld [hli], a ld a, HIGH(palred 28 + palgreen 21 + palblue 31) diff --git a/engine/events/std_scripts.asm b/engine/events/std_scripts.asm index 297725c60..da2d38138 100644 --- a/engine/events/std_scripts.asm +++ b/engine/events/std_scripts.asm @@ -1,4 +1,5 @@ StdScripts:: +; entries correspond to constants/std_constants.asm dba PokecenterNurseScript dba DifficultBookshelfScript dba PictureBookshelfScript @@ -1818,7 +1819,7 @@ CoinVendor_IntroScript: ; 0xbcde0 ; 0xbcdf7 .Buy50: ; 0xbcdf7 - checkcoins 9949 + checkcoins MAX_COINS - 50 if_equal $0, .CoinCaseFull checkmoney $0, 1000 if_equal $2, .NotEnoughMoney @@ -1832,7 +1833,7 @@ CoinVendor_IntroScript: ; 0xbcde0 ; 0xbce1b .Buy500: ; 0xbce1b - checkcoins 9499 + checkcoins MAX_COINS - 500 if_equal $0, .CoinCaseFull checkmoney $0, 10000 if_equal $2, .NotEnoughMoney diff --git a/engine/item_effects.asm b/engine/item_effects.asm index 026541b6f..7c71cf08a 100644 --- a/engine/item_effects.asm +++ b/engine/item_effects.asm @@ -1576,7 +1576,7 @@ HealStatus: ; f030 (3:7030) GetItemHealingAction: ; f058 (3:7058) push hl ld a, [CurItem] - ld hl, .healingactions + ld hl, StatusHealingActions ld bc, 3 .next cp [hl] @@ -1595,24 +1595,7 @@ GetItemHealingAction: ; f058 (3:7058) ret ; f071 (3:7071) -.healingactions ; f071 -; item, party menu action text, status - db ANTIDOTE, PARTYMENUTEXT_HEAL_PSN, 1 << PSN - db BURN_HEAL, PARTYMENUTEXT_HEAL_BRN, 1 << BRN - db ICE_HEAL, PARTYMENUTEXT_HEAL_FRZ, 1 << FRZ - db AWAKENING, PARTYMENUTEXT_HEAL_SLP, SLP - db PARLYZ_HEAL, PARTYMENUTEXT_HEAL_PAR, 1 << PAR - db FULL_HEAL, PARTYMENUTEXT_HEAL_ALL, %11111111 - db FULL_RESTORE, PARTYMENUTEXT_HEAL_ALL, %11111111 - db HEAL_POWDER, PARTYMENUTEXT_HEAL_ALL, %11111111 - db PSNCUREBERRY, PARTYMENUTEXT_HEAL_PSN, 1 << PSN - db PRZCUREBERRY, PARTYMENUTEXT_HEAL_PAR, 1 << PAR - db BURNT_BERRY, PARTYMENUTEXT_HEAL_FRZ, 1 << FRZ - db ICE_BERRY, PARTYMENUTEXT_HEAL_BRN, 1 << BRN - db MINT_BERRY, PARTYMENUTEXT_HEAL_SLP, SLP - db MIRACLEBERRY, PARTYMENUTEXT_HEAL_ALL, %11111111 - db -1, 0, 0 -; f09e +INCLUDE "data/items/heal_status.asm" StatusHealer_Jumptable: ; f09e (3:709e) ld hl, .dw @@ -2118,7 +2101,7 @@ GetOneFifthMaxHP: ; f378 (3:7378) GetHealingItemAmount: ; f395 (3:7395) push hl ld a, [CurItem] - ld hl, .Healing + ld hl, HealingHPAmounts ld d, a .next ld a, [hli] @@ -2140,24 +2123,7 @@ GetHealingItemAmount: ; f395 (3:7395) ret ; f3af (3:73af) -.Healing: ; f3af - dbw FRESH_WATER, 50 - dbw SODA_POP, 60 - dbw LEMONADE, 80 - dbw HYPER_POTION, 200 - dbw SUPER_POTION, 50 - dbw POTION, 20 - dbw MAX_POTION, MAX_STAT_VALUE - dbw FULL_RESTORE, MAX_STAT_VALUE - dbw MOOMOO_MILK, 100 - dbw BERRY, 10 - dbw GOLD_BERRY, 30 - dbw ENERGYPOWDER, 50 - dbw ENERGY_ROOT, 200 - dbw RAGECANDYBAR, 20 - dbw BERRY_JUICE, 20 - dbw -1, 0 -; f3df +INCLUDE "data/items/heal_hp.asm" Softboiled_MilkDrinkFunction: ; f3df (3:73df) ; Softboiled/Milk Drink in the field @@ -2328,7 +2294,7 @@ XSpecial: ; f4c5 call UseItemText ld a, [CurItem] - ld hl, .x_item_table + ld hl, XItemStats .loop cp [hl] @@ -2357,12 +2323,7 @@ XSpecial: ; f4c5 ret ; f504 -.x_item_table ; f504 - db X_ATTACK, ATTACK - db X_DEFEND, DEFENSE - db X_SPEED, SPEED - db X_SPECIAL, SP_ATTACK -; f50c +INCLUDE "data/items/x_stats.asm" PokeFlute: ; f50c diff --git a/engine/map_objects.asm b/engine/map_objects.asm index c65843254..503dac46d 100644 --- a/engine/map_objects.asm +++ b/engine/map_objects.asm @@ -392,6 +392,7 @@ StepVectors: ; 4700 db -4, 0, 4, 4 db 4, 0, 4, 4 ; 4730 + GetStepVectorSign: ; 4730 add a ret z ; 0 or 128 @@ -400,6 +401,7 @@ GetStepVectorSign: ; 4730 ld a, -1 ret ; 129 - 255 ; 4738 + UpdatePlayerStep: ; 4738 ld hl, OBJECT_DIRECTION_WALKING add hl, bc diff --git a/engine/menu_2.asm b/engine/menu_2.asm index d88b75152..fc1b511b0 100644 --- a/engine/menu_2.asm +++ b/engine/menu_2.asm @@ -216,7 +216,7 @@ FindApricornsInBag: ; 24c64 ld bc, 10 call ByteFill - ld hl, .ApricornBalls + ld hl, ApricornBalls .loop ld a, [hl] cp -1 @@ -252,12 +252,4 @@ FindApricornsInBag: ; 24c64 pop hl ret -.ApricornBalls: ; 24ca0 - db RED_APRICORN, LEVEL_BALL - db BLU_APRICORN, LURE_BALL - db YLW_APRICORN, MOON_BALL - db GRN_APRICORN, FRIEND_BALL - db WHT_APRICORN, FAST_BALL - db BLK_APRICORN, HEAVY_BALL - db PNK_APRICORN, LOVE_BALL - db -1 +INCLUDE "data/items/apricorn_balls.asm" diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index 0e059613b..e0de37c5f 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -765,21 +765,7 @@ NamingScreen_AdvanceCursor_CheckEndOfString: ; 11b27 ; 11b56 -Dakutens: ; Dummied out - db "かが", "きぎ", "くぐ", "けげ", "こご" - db "さざ", "しじ", "すず", "せぜ", "そぞ" - db "ただ", "ちぢ", "つづ", "てで", "とど" - db "はば", "ひび", "ふぶ", "へべ", "ほぼ" - db "カガ", "キギ", "クグ", "ケゲ", "コゴ" - db "サザ", "シジ", "スズ", "セゼ", "ソゾ" - db "タダ", "チヂ", "ツヅ", "テデ", "トド" - db "ハバ", "ヒビ", "フブ", "へべ", "ホボ" - db -1 ; end - -Handakutens: ; Dummied out - db "はぱ", "ひぴ", "ふぷ", "へぺ", "ほぽ" - db "ハパ", "ヒピ", "フプ", "へぺ", "ホポ" - db -1 ; end +INCLUDE "data/unused_text/dakutens.asm" ; 11bbc diff --git a/engine/party_menu.asm b/engine/party_menu.asm index 0415e29e4..911ec01d8 100644 --- a/engine/party_menu.asm +++ b/engine/party_menu.asm @@ -1,3 +1,15 @@ +; WritePartyMenuTilemap.Jumptable indexes + const_def + const PARTYMENUQUALITY_NICKNAMES + const PARTYMENUQUALITY_HP_BAR + const PARTYMENUQUALITY_HP_DIGITS + const PARTYMENUQUALITY_LEVEL + const PARTYMENUQUALITY_STATUS + const PARTYMENUQUALITY_TMHM_COMPAT + const PARTYMENUQUALITY_EVO_STONE_COMPAT + const PARTYMENUQUALITY_GENDER + const PARTYMENUQUALITY_MOBILE_SELECTION + SelectMonFromParty: ; 50000 call DisableSpriteUpdates xor a @@ -57,16 +69,16 @@ WritePartyMenuTilemap: ; 0x5005f ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, " " call ByteFill ; blank the tilemap - call GetPartyMenuTilemapPointers ; This reads from a pointer table??? + call GetPartyMenuQualityIndexes .loop ld a, [hli] - cp $ff - jr z, .end ; 0x5007a $8 + cp -1 + jr z, .end push hl ld hl, .Jumptable rst JumpTable pop hl - jr .loop ; 0x50082 $f3 + jr .loop .end pop af ld [Options], a @@ -74,6 +86,7 @@ WritePartyMenuTilemap: ; 0x5005f ; 0x50089 .Jumptable: ; 50089 +; entries correspond to PARTYMENUQUALITY_* constants dw PlacePartyNicknames dw PlacePartyHPBar dw PlacePartyMenuHPDigits @@ -598,7 +611,7 @@ PartyMenuCheckEgg: ; 50389 ret ; 50396 -GetPartyMenuTilemapPointers: ; 50396 +GetPartyMenuQualityIndexes: ; 50396 ld a, [PartyMenuActionText] and $f0 jr nz, .skip @@ -620,23 +633,32 @@ GetPartyMenuTilemapPointers: ; 50396 ; 503b2 .Pointers: ; 503b2 - dw .Default - dw .Default - dw .Default - dw .TMHM - dw .Default - dw .EvoStone - dw .Gender - dw .Gender - dw .Default - dw .Mobile +; entries correspond to PARTYMENUACTION_* constants + dw .Default ; PARTYMENUACTION_CHOOSE_POKEMON + dw .Default ; PARTYMENUACTION_HEALING_ITEM + dw .Default ; PARTYMENUACTION_SWITCH + dw .TMHM ; PARTYMENUACTION_TEACH_TMHM + dw .Default ; PARTYMENUACTION_MOVE + dw .EvoStone ; PARTYMENUACTION_EVO_STONE + dw .Gender ; PARTYMENUACTION_GIVE_MON + dw .Gender ; PARTYMENUACTION_GIVE_MON_FEMALE + dw .Default ; PARTYMENUACTION_GIVE_ITEM + dw .Mobile ; PARTYMENUACTION_MOBILE ; 503c6 -.Default: db 0, 1, 2, 3, 4, $ff -.TMHM: db 0, 5, 3, 4, $ff -.EvoStone: db 0, 6, 3, 4, $ff -.Gender: db 0, 7, 3, 4, $ff -.Mobile: db 0, 8, 3, 4, $ff +partymenuqualities: MACRO +rept _NARG + db PARTYMENUQUALITY_\1 +shift +endr + db -1 ; end +ENDM + +.Default: partymenuqualities NICKNAMES, HP_BAR, HP_DIGITS, LEVEL, STATUS +.TMHM: partymenuqualities NICKNAMES, TMHM_COMPAT, LEVEL, STATUS +.EvoStone: partymenuqualities NICKNAMES, EVO_STONE_COMPAT, LEVEL, STATUS +.Gender: partymenuqualities NICKNAMES, GENDER, LEVEL, STATUS +.Mobile: partymenuqualities NICKNAMES, MOBILE_SELECTION, LEVEL, STATUS ; 503e0 diff --git a/engine/phone/phone.asm b/engine/phone/phone.asm index 9932d0f4f..9a22ff143 100644 --- a/engine/phone/phone.asm +++ b/engine/phone/phone.asm @@ -75,20 +75,20 @@ GetRemainingSpaceInPhoneList: ; 90040 cp -1 jr z, .done cp c - jr z, .elm_or_mom + jr z, .continue + push bc push hl ld c, a call _CheckCellNum - jr c, .elm_or_mom_in_list + jr c, .permanent ld hl, Buffer1 inc [hl] - -.elm_or_mom_in_list +.permanent pop hl pop bc -.elm_or_mom +.continue jr .loop .done @@ -98,9 +98,7 @@ GetRemainingSpaceInPhoneList: ; 90040 ret ; 90066 -PermanentNumbers: ; 90066 - db PHONECONTACT_MOM, PHONECONTACT_ELM, -1 -; 90069 +INCLUDE "data/phone/permanent_numbers.asm" FarPlaceString: ; 90069 diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 0e67ba7c6..8f39a742d 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -1794,7 +1794,7 @@ Pokedex_PrevSearchMonType: ; 40f65 ld hl, wDexSearchMonType1 ld a, [hl] - cp $1 + cp 1 jr z, .wrap_around dec [hl] jr .done @@ -1808,7 +1808,7 @@ Pokedex_PrevSearchMonType: ; 40f65 jr .done .wrap_around - ld [hl], $11 + ld [hl], NUM_TYPES - 1 .done scf @@ -1821,18 +1821,18 @@ Pokedex_NextSearchMonType: ; 40f84 ld hl, wDexSearchMonType1 ld a, [hl] - cp $11 + cp NUM_TYPES - 1 jr nc, .type1_wrap_around inc [hl] jr .done .type1_wrap_around - ld [hl], $1 + ld [hl], 1 jr .done .type2 ld hl, wDexSearchMonType2 ld a, [hl] - cp $11 + cp NUM_TYPES - 1 jr nc, .type2_wrap_around inc [hl] jr .done @@ -1864,7 +1864,7 @@ Pokedex_PlaceTypeString: ; 40fcd (10:4fcd) push hl ld e, a ld d, 0 - ld hl, .TypeStrings + ld hl, PokedexTypeSearchStrings rept 9 add hl, de endr @@ -1874,25 +1874,7 @@ endr call PlaceString ret -.TypeStrings: ; 40fe4 - db " ---- @" - db " NORMAL @" - db " FIRE @" - db " WATER @" - db " GRASS @" - db "ELECTRIC@" - db " ICE @" - db "FIGHTING@" - db " POISON @" - db " GROUND @" - db " FLYING @" - db "PSYCHIC @" - db " BUG @" - db " ROCK @" - db " GHOST @" - db " DRAGON @" - db " DARK @" - db " STEEL @" +INCLUDE "data/types/search_strings.asm" Pokedex_SearchForMons: ; 41086 ld a, [wDexSearchMonType2] @@ -1907,7 +1889,7 @@ Pokedex_SearchForMons: ; 41086 dec a ld e, a ld d, 0 - ld hl, .TypeConversionTable + ld hl, PokedexTypeSearchConversionTable add hl, de ld a, [hl] ld [wDexConvertedMonType], a @@ -1969,24 +1951,7 @@ Pokedex_SearchForMons: ; 41086 .done ret -.TypeConversionTable: ; 410f6 - db NORMAL - db FIRE - db WATER - db GRASS - db ELECTRIC - db ICE - db FIGHTING - db POISON - db GROUND - db FLYING - db PSYCHIC - db BUG - db ROCK - db GHOST - db DRAGON - db DARK - db STEEL +INCLUDE "data/types/search_types.asm" Pokedex_DisplayTypeNotFoundMessage: ; 41107 xor a diff --git a/engine/pokegear.asm b/engine/pokegear.asm index 944082d80..20910c0d5 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -1510,7 +1510,7 @@ UpdateRadioStation: ; 9166f (24:566f) ; 916ad RadioChannels: -; frequencies and the shows that play on them. +; entries correspond to constants/radio_constants.asm ; frequency value given here = 4 × ingame_frequency − 2 dbw 16, .PkmnTalkAndPokedexShow diff --git a/engine/sgb_layouts.asm b/engine/sgb_layouts.asm index 36dbde84c..8e79e33f9 100644 --- a/engine/sgb_layouts.asm +++ b/engine/sgb_layouts.asm @@ -18,7 +18,7 @@ Predef_LoadSGBLayout: ; 864c ld a, [hli] ld h, [hl] ld l, a - ld de, .Finish + ld de, _LoadSGBLayout_ReturnFromJumpTable push de jp hl ; 866f @@ -389,15 +389,13 @@ endr jr z, .partymon ; Egg ld hl, wSGBPals + 3 - ; RGB 7, 7, 7 - ld [hl], $e7 + ld [hl], LOW(palred 7 + palgreen 7 + palblue 7) inc hl - ld [hl], $1c + ld [hl], HIGH(palred 7 + palgreen 7 + palblue 7) inc hl - ; RGB 2, 3, 3 - ld [hl], $62 + ld [hl], LOW(palred 2 + palgreen 3 + palblue 3) inc hl - ld [hl], $c + ld [hl], HIGH(palred 2 + palgreen 3 + palblue 3) jr .done .partymon @@ -576,7 +574,7 @@ endr ld a, [MapGroup] ld e, a ld d, 0 - ld hl, .SGBRoofPalInds + ld hl, MapGroupRoofSGBPalInds add hl, de ld a, [hl] ret @@ -598,37 +596,9 @@ endr ret ; 8a45 -.SGBRoofPalInds: ; 8a45 - db $00 ; Unused - db $12 ; Olivine - db $14 ; Mahogany - db $18 ; Various Dungeons - db $11 ; Ecruteak - db $15 ; Blackthorn - db $09 ; Cinnabar - db $04 ; Cerulean - db $0f ; Azalea - db $16 ; Lake Of Rage - db $0e ; Violet - db $10 ; Goldenrod - db $06 ; Vermilion - db $01 ; Palette - db $03 ; Pewter - db $06 ; Fast Ship - db $0b ; Indigo Plateau - db $08 ; Fuchsia - db $05 ; Lavender - db $17 ; Silver Cave Outside - db $08 ; Pokemon Center 2F - db $07 ; Celadon - db $13 ; Cianwood - db $02 ; Viridian - db $0c ; New Bark - db $0a ; Saffron - db $0d ; Cherrygrove -; 8a60 - -.Finish: ; 8a60 +INCLUDE "data/maps/sgb_roofs.asm" + +_LoadSGBLayout_ReturnFromJumpTable: ; 8a60 push de call PushSGBPals_ pop hl diff --git a/engine/types.asm b/engine/types.asm index 375bfe434..ade1aaa4a 100644 --- a/engine/types.asm +++ b/engine/types.asm @@ -96,6 +96,4 @@ GetTypeName: ; 50964 ; 5097b -INCLUDE "data/type_names.asm" - -; 50a28 +INCLUDE "data/types/names.asm" -- cgit v1.2.3 From 2d0506ecf9daa96f42cbfc1ee4fd612020241dd5 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 11 Jan 2018 01:54:49 -0500 Subject: Group item and deco data more --- engine/mystery_gift_2.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/mystery_gift_2.asm b/engine/mystery_gift_2.asm index 1d180f714..0baaabef3 100755 --- a/engine/mystery_gift_2.asm +++ b/engine/mystery_gift_2.asm @@ -147,6 +147,6 @@ MysteryGiftFallbackItem: ; 2c722 (b:4722) ; 2c725 (b:4725) -INCLUDE "data/mystery_gift_items.asm" +INCLUDE "data/items/mystery_gift_items.asm" -INCLUDE "data/mystery_gift_decos.asm" +INCLUDE "data/decorations/mystery_gift_decos.asm" -- cgit v1.2.3 From 1a2bc578418612d074bd275c34a57e61b3d016b2 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 11 Jan 2018 02:35:46 -0500 Subject: =?UTF-8?q?Event=20script=E2=80=93related=20constants=20go=20in=20?= =?UTF-8?q?constants/script=5Fconstants.asm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/variables.asm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'engine') diff --git a/engine/variables.asm b/engine/variables.asm index 1b418ea3c..56c49f085 100755 --- a/engine/variables.asm +++ b/engine/variables.asm @@ -35,9 +35,10 @@ _GetVarAction:: ; 80648 (20:4648) ; 80671 (20:4671) .VarActionTable: ; 80671 -; RETVAR_STRBUF2: copy [de] to StringBuffer2 -; RETVAR_ADDR_DE: return address in de -; RETVAR_EXECUTE: call function +; entries correspond to VAR_* constants + ; RETVAR_STRBUF2: copy [de] to StringBuffer2 + ; RETVAR_ADDR_DE: return address in de + ; RETVAR_EXECUTE: call function dwb StringBuffer2, RETVAR_STRBUF2 dwb PartyCount, RETVAR_STRBUF2 dwb .BattleResult, RETVAR_EXECUTE @@ -125,7 +126,7 @@ _GetVarAction:: ; 80648 (20:4648) ret z inc b ld a, b - cp 26 + cp NUM_UNOWN jr c, .loop ret ; 80715 -- cgit v1.2.3 From a436bbc23bb7ba723a7f897ddbe9d25830169612 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 11 Jan 2018 02:54:07 -0500 Subject: Move party menu qualities to data/ --- engine/party_menu.asm | 47 ++++------------------------------------------- 1 file changed, 4 insertions(+), 43 deletions(-) (limited to 'engine') diff --git a/engine/party_menu.asm b/engine/party_menu.asm index 911ec01d8..77f0457e2 100644 --- a/engine/party_menu.asm +++ b/engine/party_menu.asm @@ -1,15 +1,3 @@ -; WritePartyMenuTilemap.Jumptable indexes - const_def - const PARTYMENUQUALITY_NICKNAMES - const PARTYMENUQUALITY_HP_BAR - const PARTYMENUQUALITY_HP_DIGITS - const PARTYMENUQUALITY_LEVEL - const PARTYMENUQUALITY_STATUS - const PARTYMENUQUALITY_TMHM_COMPAT - const PARTYMENUQUALITY_EVO_STONE_COMPAT - const PARTYMENUQUALITY_GENDER - const PARTYMENUQUALITY_MOBILE_SELECTION - SelectMonFromParty: ; 50000 call DisableSpriteUpdates xor a @@ -62,7 +50,7 @@ WritePartyMenuTilemap: ; 0x5005f ld hl, Options ld a, [hl] push af - set 4, [hl] ; Disable text delay + set NO_TEXT_SCROLL, [hl] xor a ld [hBGMapMode], a hlcoord 0, 0 @@ -619,7 +607,7 @@ GetPartyMenuQualityIndexes: ; 50396 and $f ld e, a ld d, 0 - ld hl, .Pointers + ld hl, PartyMenuQualityPointers add hl, de add hl, de ld a, [hli] @@ -628,38 +616,11 @@ GetPartyMenuQualityIndexes: ; 50396 ret .skip - ld hl, .Default + ld hl, PartyMenuQualityPointers.Default ret ; 503b2 -.Pointers: ; 503b2 -; entries correspond to PARTYMENUACTION_* constants - dw .Default ; PARTYMENUACTION_CHOOSE_POKEMON - dw .Default ; PARTYMENUACTION_HEALING_ITEM - dw .Default ; PARTYMENUACTION_SWITCH - dw .TMHM ; PARTYMENUACTION_TEACH_TMHM - dw .Default ; PARTYMENUACTION_MOVE - dw .EvoStone ; PARTYMENUACTION_EVO_STONE - dw .Gender ; PARTYMENUACTION_GIVE_MON - dw .Gender ; PARTYMENUACTION_GIVE_MON_FEMALE - dw .Default ; PARTYMENUACTION_GIVE_ITEM - dw .Mobile ; PARTYMENUACTION_MOBILE -; 503c6 - -partymenuqualities: MACRO -rept _NARG - db PARTYMENUQUALITY_\1 -shift -endr - db -1 ; end -ENDM - -.Default: partymenuqualities NICKNAMES, HP_BAR, HP_DIGITS, LEVEL, STATUS -.TMHM: partymenuqualities NICKNAMES, TMHM_COMPAT, LEVEL, STATUS -.EvoStone: partymenuqualities NICKNAMES, EVO_STONE_COMPAT, LEVEL, STATUS -.Gender: partymenuqualities NICKNAMES, GENDER, LEVEL, STATUS -.Mobile: partymenuqualities NICKNAMES, MOBILE_SELECTION, LEVEL, STATUS -; 503e0 +INCLUDE "data/party_menu_qualities.asm" InitPartyMenuGFX: ; 503e0 -- cgit v1.2.3 From 94d6a327218fc56753238b424df208245092d96c Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 11 Jan 2018 12:00:01 -0500 Subject: Use maskbits some more --- engine/battle/ai/move.asm | 4 +- engine/battle/battle_transition.asm | 4 +- engine/battle/core.asm | 21 ++-- engine/battle/effect_commands.asm | 43 ++++--- engine/battle_anims/anim_commands.asm | 4 +- engine/billspc.asm | 6 +- engine/caught_data.asm | 18 +-- engine/color.asm | 6 +- engine/credits.asm | 8 +- engine/crystal_intro.asm | 12 +- engine/events/buena.asm | 4 +- engine/events/bug_contest/contest_2.asm | 25 ++-- engine/events/bug_contest/judging.asm | 35 +++--- engine/events/fish.asm | 2 +- engine/events/magnet_train.asm | 2 +- engine/events/poisonstep_pals.asm | 4 +- engine/events/poke_seer.asm | 28 ++--- engine/intro_menu.asm | 2 +- engine/item_effects.asm | 8 +- engine/landmarks.asm | 4 +- engine/map_objects.asm | 2 +- engine/mystery_gift_2.asm | 12 +- engine/npc_movement.asm | 44 +++---- engine/npctrade.asm | 35 ++---- engine/pack.asm | 141 +++++++++++---------- engine/player_movement.asm | 8 +- engine/player_object.asm | 2 +- engine/player_step.asm | 4 +- engine/pokedex.asm | 25 ++-- engine/pokedex_2.asm | 8 +- engine/pokegear.asm | 210 ++++++++++++++++++-------------- engine/radio.asm | 8 +- engine/routines/drawkrispackgfx.asm | 8 +- engine/scripting.asm | 4 +- engine/stats_screen.asm | 43 ++++--- engine/time.asm | 8 +- engine/trade_animation.asm | 38 ++++-- engine/wildmons.asm | 16 +-- 38 files changed, 446 insertions(+), 410 deletions(-) (limited to 'engine') diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm index 11586c0da..72ed6983b 100755 --- a/engine/battle/ai/move.asm +++ b/engine/battle/ai/move.asm @@ -56,7 +56,7 @@ AIChooseMove: ; 440ce inc hl ld a, [de] inc de - and $3f + and PP_MASK jr nz, .CheckMovePP ld [hl], 80 jr .CheckMovePP @@ -186,7 +186,7 @@ AIChooseMove: ; 440ce .ChooseMove: ld hl, Buffer1 call Random - and 3 + maskbits NUM_MOVES +- 1 ld c, a ld b, 0 add hl, bc diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 383674652..4c05112ac 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -640,8 +640,8 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) .cgb ld hl, .daypals ld a, [TimeOfDayPal] - and $3 - cp 3 + maskbits NUM_DAYTIMES +- 1 + cp DARKNESS_F jr nz, .daytime ld hl, .nightpals .daytime diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 5b5b3562e..35d2098bc 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -730,7 +730,7 @@ HandleEncore: ; 3c4df ld b, 0 add hl, bc ld a, [hl] - and $3f + and PP_MASK ret nz .end_player_encore @@ -754,7 +754,7 @@ HandleEncore: ; 3c4df ld b, 0 add hl, bc ld a, [hl] - and $3f + and PP_MASK ret nz .end_enemy_encore @@ -1401,7 +1401,7 @@ HandleMysteryberry: ; 3c93c and a jr z, .quit ld a, [de] - and $3f + and PP_MASK jr z, .restore inc hl inc de @@ -5650,7 +5650,7 @@ MoveSelectionScreen: ; 3e4bc ld b, 0 add hl, bc ld a, [hl] - and $3f + and PP_MASK jr z, .no_pp_left ld a, [PlayerDisableCount] swap a @@ -5849,7 +5849,7 @@ MoveInfoBox: ; 3e6c8 ld hl, BattleMonPP add hl, bc ld a, [hl] - and $3f + and PP_MASK ld [StringBuffer1], a call .PrintPP @@ -5912,7 +5912,7 @@ CheckPlayerHasUsableMoves: ; 3e786 or [hl] inc hl or [hl] - and $3f + and PP_MASK ret nz jr .force_struggle @@ -5934,8 +5934,7 @@ CheckPlayerHasUsableMoves: ; 3e786 .done ; Bug: this will result in a move with PP Up confusing the game. - ; Replace with "and $3f" to fix. - and a + and a ; should be "and PP_MASK" ret nz .force_struggle @@ -6014,7 +6013,7 @@ ParseEnemyAction: ; 3e7c1 cp [hl] jr z, .disabled ld a, [de] - and $3f + and PP_MASK jr nz, .enough_pp .disabled @@ -6032,7 +6031,7 @@ ParseEnemyAction: ; 3e7c1 .loop2 ld hl, EnemyMonMoves call BattleRandom - and 3 ; TODO factor in NUM_MOVES + maskbits NUM_MOVES +- 1 ld c, a ld b, 0 add hl, bc @@ -6049,7 +6048,7 @@ ParseEnemyAction: ; 3e7c1 add hl, bc ld b, a ld a, [hl] - and $3f + and PP_MASK jr z, .loop2 ld a, c ld [CurEnemyMoveNum], a diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index f9a8ba63e..68184ce30 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -846,19 +846,20 @@ BattleCommand_CheckObedience: ; 343db .DoNothing: + ; 4 random choices call BattleRandom - and 3 + and %11 ld hl, LoafingAroundText - and a + and a ; 0 jr z, .Print ld hl, WontObeyText - dec a + dec a ; 1 jr z, .Print ld hl, TurnedAwayText - dec a + dec a ; 2 jr z, .Print ld hl, IgnoredOrdersText @@ -888,7 +889,7 @@ BattleCommand_CheckObedience: ; 343db .GetTotalPP: ld a, [hli] - and $3f ; exclude pp up + and PP_MASK add b ld b, a @@ -911,7 +912,7 @@ BattleCommand_CheckObedience: ; 343db ; Can't use another move if only one move has PP. ld a, [hl] - and $3f + and PP_MASK cp b jr z, .DoNothing @@ -931,7 +932,7 @@ BattleCommand_CheckObedience: ; 343db .RandomMove: call BattleRandom - and 3 ; TODO NUM_MOVES + maskbits NUM_MOVES +- 1 cp b jr nc, .RandomMove @@ -947,7 +948,7 @@ BattleCommand_CheckObedience: ; 343db ld d, 0 add hl, de ld a, [hl] - and $3f + and PP_MASK jr z, .RandomMove @@ -1118,7 +1119,7 @@ BattleCommand_DoTurn: ; 34555 ld b, 0 add hl, bc ld a, [hl] - and $3f + and PP_MASK jr z, .out_of_pp dec [hl] ld b, 0 @@ -3906,7 +3907,7 @@ BattleCommand_Encore: ; 35864 ld bc, BattleMonPP - BattleMonMoves - 1 add hl, bc ld a, [hl] - and $3f + and PP_MASK jp z, .failed ld a, [AttackMissed] and a @@ -4386,7 +4387,7 @@ BattleCommand_SleepTalk: ; 35b33 .sample_move push hl call BattleRandom - and 3 ; TODO factor in NUM_MOVES + maskbits NUM_MOVES +- 1 ld c, a ld b, 0 add hl, bc @@ -4550,17 +4551,18 @@ BattleCommand_Spite: ; 35c0f add hl, bc pop bc ld a, [hl] - and $3f + and PP_MASK jr z, .failed push bc call GetMoveName + ; lose 2-5 PP call BattleRandom - and 3 + and %11 inc a inc a ld b, a ld a, [hl] - and $3f + and PP_MASK cp b jr nc, .deplete_pp ld b, a @@ -6208,13 +6210,12 @@ BattleCommand_TriStatusChance: ; 3658f call BattleCommand_EffectChance -; 1/3 chance of each status .loop + ; 1/3 chance of each status call BattleRandom swap a - and 3 + and %11 jr z, .loop -; jump dec a ld hl, .ptrs rst JumpTable @@ -7392,7 +7393,8 @@ BattleCommand_TrapTarget: ; 36c2d bit SUBSTATUS_SUBSTITUTE, a ret nz call BattleRandom - and 3 + ; trapped for 2-5 turns + and %11 inc a inc a inc a @@ -7590,8 +7592,9 @@ BattleCommand_FinishConfusingTarget: ; 36d70 .got_confuse_count set SUBSTATUS_CONFUSED, [hl] + ; confused for 2-5 turns call BattleRandom - and 3 + and %11 inc a inc a ld [bc], a @@ -8201,7 +8204,7 @@ BattleCommand_Conversion: ; 3707f .done .loop3 call BattleRandom - and 3 ; TODO factor in NUM_MOVES + maskbits NUM_MOVES +- 1 ld c, a ld b, 0 ld hl, StringBuffer1 diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index b81911a88..2d5a53aa0 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -1207,7 +1207,7 @@ BattleAnimCmd_Sound: ; cc7cd (33:47cd) srl a ld [wSFXDuration], a call .GetCryTrack - and 3 + maskbits NUM_NOISE_CHANS +- 1 ld [CryTracks], a ; CryTracks ld e, a @@ -1244,7 +1244,7 @@ BattleAnimCmd_Sound: ; cc7cd (33:47cd) BattleAnimCmd_Cry: ; cc807 (33:4807) call GetBattleAnimByte - and 3 + maskbits NUM_NOISE_CHANS +- 1 ld e, a ld d, 0 ld hl, .CryData diff --git a/engine/billspc.asm b/engine/billspc.asm index 4e4722ded..00bd49f06 100755 --- a/engine/billspc.asm +++ b/engine/billspc.asm @@ -136,7 +136,7 @@ _DepositPKMN: ; e2391 (38:6391) jp c, BillsPCDepositFuncCancel ld a, [wMenuCursorY] dec a - and $3 + and %11 ld e, a ld d, 0 ld hl, BillsPCDepositJumptable @@ -401,7 +401,7 @@ BillsPC_Withdraw: ; e2675 (38:6675) jp c, .cancel ld a, [wMenuCursorY] dec a - and 3 + and %11 ld e, a ld d, 0 ld hl, .dw @@ -663,7 +663,7 @@ _MovePKMNWithoutMail: ; e2759 jp c, .Cancel ld a, [wMenuCursorY] dec a - and 3 + and %11 ld e, a ld d, 0 ld hl, .Jumptable2 diff --git a/engine/caught_data.asm b/engine/caught_data.asm index 1f8b8cac4..534e318a4 100644 --- a/engine/caught_data.asm +++ b/engine/caught_data.asm @@ -7,17 +7,17 @@ CheckPartyFullAfterContest: ; 4d9e5 call GetBaseData ld hl, PartyCount ld a, [hl] - cp 6 + cp PARTY_LENGTH jp nc, .TryAddToBox inc a ld [hl], a ld c, a - ld b, $0 + ld b, 0 add hl, bc ld a, [wContestMon] ld [hli], a ld [CurSpecies], a - ld a, $ff + ld a, -1 ld [hl], a ld hl, PartyMon1Species ld a, [PartyCount] @@ -75,8 +75,8 @@ CheckPartyFullAfterContest: ; 4d9e5 ld hl, PartyMon1CaughtLocation call GetPartyLocation ld a, [hl] - and $80 - ld b, $13 + and CAUGHT_GENDER_MASK + ld b, NATIONAL_PARK or b ld [hl], a xor a @@ -135,8 +135,8 @@ CheckPartyFullAfterContest: ; 4d9e5 call GetSRAMBank ld hl, sBoxMon1CaughtLocation ld a, [hl] - and $80 - ld b, $13 + and CAUGHT_GENDER_MASK + ld b, NATIONAL_PARK or b ld [hl], a call CloseSRAM @@ -227,7 +227,7 @@ SetGiftPartyMonCaughtData: ; 4dba3 SetGiftMonCaughtData: ; 4dbaf xor a ld [hli], a - ld a, $7e + ld a, GIFT_LOCATION rrc b or b ld [hl], a @@ -239,7 +239,7 @@ SetEggMonCaughtData: ; 4dbb8 (13:5bb8) call GetPartyLocation ld a, [CurPartyLevel] push af - ld a, $1 + ld a, CAUGHT_EGG_LEVEL ld [CurPartyLevel], a call SetBoxmonOrEggmonCaughtData pop af diff --git a/engine/color.asm b/engine/color.asm index 76729187a..adcb2d23d 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -1240,7 +1240,7 @@ LoadMapPals: ld l, a ; Futher refine by time of day ld a, [TimeOfDayPal] - and 3 + maskbits NUM_DAYTIMES +- 1 add a add a add a @@ -1286,7 +1286,7 @@ LoadMapPals: .got_pals ld a, [TimeOfDayPal] - and 3 + maskbits NUM_DAYTIMES +- 1 ld bc, 8 palettes ld hl, MapObjectPals call AddNTimes @@ -1310,7 +1310,7 @@ LoadMapPals: ld de, RoofPals add hl, de ld a, [TimeOfDayPal] - and 3 + maskbits NUM_DAYTIMES +- 1 cp NITE_F jr c, .morn_day rept 4 diff --git a/engine/credits.asm b/engine/credits.asm index 5d34ba2f4..0df0d9f7b 100644 --- a/engine/credits.asm +++ b/engine/credits.asm @@ -504,7 +504,7 @@ GetCreditsPalette: ; 109b2c .GetPalAddress: ; Each set of palette data is 24 bytes long. ld a, [wCreditsBorderMon] ; scene - and 3 + and %11 add a add a ; * 8 add a @@ -549,13 +549,13 @@ Credits_LoadBorderGFX: ; 109bca (42:5bca) cp $ff jr z, .init - and 3 + and %11 ld e, a inc a - and 3 + and %11 ld [hl], a ld a, [wCreditsBorderMon] - and 3 + and %11 add a add a add e diff --git a/engine/crystal_intro.asm b/engine/crystal_intro.asm index 84ab86113..0d86533c1 100755 --- a/engine/crystal_intro.asm +++ b/engine/crystal_intro.asm @@ -247,10 +247,10 @@ GameFreakLogoScene2: ; e470d (39:470d) ld hl, SPRITEANIMSTRUCT_0D add hl, bc ld a, [hl] - and $3f - cp $20 + and %111111 + cp %100000 jr nc, .asm_e4723 - add $20 + add %100000 .asm_e4723 ld e, a farcall BattleAnim_Sine_e @@ -1604,12 +1604,12 @@ CrystalIntro_UnownFade: ; e5223 (39:5223) inc hl inc hl ld a, [wcf65] - and $3f - cp $1f + and %111111 + cp %011111 jr z, .okay jr c, .okay ld c, a - ld a, $3f + ld a, %111111 sub c .okay diff --git a/engine/events/buena.asm b/engine/events/buena.asm index 1227593eb..3987487a9 100644 --- a/engine/events/buena.asm +++ b/engine/events/buena.asm @@ -17,7 +17,7 @@ SpecialBuenasPassword: ; 8af6b ld a, [MenuSelection] ld c, a ld a, [wBuenasPassword] - and $3 + maskbits NUM_PASSWORDS_PER_CATEGORY +- 1 cp c jr nz, .wrong ld b, $1 @@ -46,7 +46,7 @@ SpecialBuenasPassword: ; 8af6b ; 0x8afb4 .PasswordIndices: ; 8afb8 - db 3 + db NUM_PASSWORDS_PER_CATEGORY db 0, 1, 2 db -1 diff --git a/engine/events/bug_contest/contest_2.asm b/engine/events/bug_contest/contest_2.asm index 493c69d0c..eff531c50 100755 --- a/engine/events/bug_contest/contest_2.asm +++ b/engine/events/bug_contest/contest_2.asm @@ -2,7 +2,7 @@ Special_SelectRandomBugContestContestants: ; 139a8 ; Select five random people to participate in the current contest. ; First we have to make sure that any old data is cleared away. - ld c, 10 ; Number of people to choose from. + ld c, NUM_BUG_CONTESTANTS ld hl, BugCatchingContestantEventFlagTable .loop1 push bc @@ -26,9 +26,9 @@ Special_SelectRandomBugContestContestants: ; 139a8 .next ; Choose a flag at uniform random to be set. call Random - cp 250 + cp $ff / NUM_BUG_CONTESTANTS * NUM_BUG_CONTESTANTS jr nc, .next - ld c, 25 + ld c, $ff / NUM_BUG_CONTESTANTS call SimpleDivide ld e, b ld d, 0 @@ -59,7 +59,7 @@ Special_SelectRandomBugContestContestants: ; 139a8 Special_CheckBugContestContestantFlag: ; 139ed ; Checks the flag of the Bug Catching Contestant whose index is loaded in a. -; Bug: If a >= 10 when this is called, it will read beyond the table. +; Bug: If a >= NUM_BUG_CONTESTANTS when this is called, it will read beyond the table. ld hl, BugCatchingContestantEventFlagTable ld e, a @@ -74,18 +74,7 @@ Special_CheckBugContestContestantFlag: ; 139ed ret ; 139fe -BugCatchingContestantEventFlagTable: ; 139fe - dw EVENT_BUG_CATCHING_CONTESTANT_1A - dw EVENT_BUG_CATCHING_CONTESTANT_2A - dw EVENT_BUG_CATCHING_CONTESTANT_3A - dw EVENT_BUG_CATCHING_CONTESTANT_4A - dw EVENT_BUG_CATCHING_CONTESTANT_5A - dw EVENT_BUG_CATCHING_CONTESTANT_6A - dw EVENT_BUG_CATCHING_CONTESTANT_7A - dw EVENT_BUG_CATCHING_CONTESTANT_8A - dw EVENT_BUG_CATCHING_CONTESTANT_9A - dw EVENT_BUG_CATCHING_CONTESTANT_10A -; 13a12 +INCLUDE "data/bug_contest_flags.asm" ContestDropOffMons: ; 13a12 ld hl, PartyMon1HP @@ -101,7 +90,7 @@ ContestDropOffMons: ; 13a12 ld a, [hl] ld [wBugContestSecondPartySpecies], a ; ... and replacing it with the terminator byte - ld [hl], $ff + ld [hl], -1 xor a ld [ScriptVar], a ret @@ -118,7 +107,7 @@ ContestReturnMons: ; 13a31 ld a, [wBugContestSecondPartySpecies] ld [hl], a ; Restore the party count, which must be recomputed. - ld b, $1 + ld b, 1 .loop ld a, [hli] cp -1 diff --git a/engine/events/bug_contest/judging.asm b/engine/events/bug_contest/judging.asm index 901ae88fa..1db8cd6c6 100755 --- a/engine/events/bug_contest/judging.asm +++ b/engine/events/bug_contest/judging.asm @@ -77,9 +77,8 @@ BugContest_ThirdPlaceScoreText: ; 0x1372b ; 0x13730 LoadContestantName: ; 13730 - -; If a = 0, get your name. - dec a +; If a = 1, get your name. + dec a ; BUG_CONTEST_PLAYER jr z, .player ; Find the pointer for the trainer class of the Bug Catching Contestant whose ID is in a. ld c, a @@ -141,11 +140,11 @@ INCLUDE "data/bug_contest_winners.asm" BugContest_GetPlayersResult: ; 13807 ld hl, wBugContestThirdPlaceWinnerID - ld de, -4 - ld b, 3 + ld de, - BUG_CONTESTANT_SIZE + ld b, 3 ; 3rd, 2nd, or 1st .loop ld a, [hl] - cp 1 ; Player + cp BUG_CONTEST_PLAYER jr z, .done add hl, de dec b @@ -159,7 +158,7 @@ BugContest_JudgeContestants: ; 13819 call ClearContestResults call ComputeAIContestantScores ld hl, wBugContestTempWinnerID - ld a, 1 ; Player + ld a, BUG_CONTEST_PLAYER ld [hli], a ld a, [wContestMon] ld [hli], a @@ -190,11 +189,11 @@ DetermineContestWinners: ; 1383e jr c, .not_first_place ld hl, wBugContestSecondPlaceWinnerID ld de, wBugContestThirdPlaceWinnerID - ld bc, 4 + ld bc, BUG_CONTESTANT_SIZE call CopyBytes ld hl, wBugContestFirstPlaceWinnerID ld de, wBugContestSecondPlaceWinnerID - ld bc, 4 + ld bc, BUG_CONTESTANT_SIZE call CopyBytes ld hl, wBugContestFirstPlaceWinnerID call CopyTempContestant @@ -208,7 +207,7 @@ DetermineContestWinners: ; 1383e jr c, .not_second_place ld hl, wBugContestSecondPlaceWinnerID ld de, wBugContestThirdPlaceWinnerID - ld bc, 4 + ld bc, BUG_CONTESTANT_SIZE call CopyBytes ld hl, wBugContestSecondPlaceWinnerID call CopyTempContestant @@ -230,7 +229,7 @@ DetermineContestWinners: ; 1383e CopyTempContestant: ; 138a0 ; Could've just called CopyBytes. ld de, wBugContestTempWinnerID -rept 3 +rept BUG_CONTESTANT_SIZE +- 1 ld a, [de] inc de ld [hli], a @@ -264,6 +263,7 @@ ComputeAIContestantScores: ; 138b0 inc hl inc hl .loop2 + ; 0, 1, or 2 for 1st, 2nd, or 3rd call Random and 3 cp 3 @@ -278,8 +278,9 @@ ComputeAIContestantScores: ; 138b0 ld a, [hli] ld h, [hl] ld l, a + ; randomly perturb score call Random - and 7 + and %111 ld c, a ld b, 0 add hl, bc @@ -294,7 +295,7 @@ ComputeAIContestantScores: ; 138b0 .done inc e ld a, e - cp 10 + cp NUM_BUG_CONTESTANTS jr nz, .loop ret ; 13900 @@ -337,26 +338,26 @@ ContestScore: ; 13900 ; DVs ld a, [wContestMonDVs + 0] ld b, a - and 2 + and %0010 add a add a ld c, a swap b ld a, b - and 2 + and %0010 add a add c ld d, a ld a, [wContestMonDVs + 1] ld b, a - and 2 + and %0010 ld c, a swap b ld a, b - and 2 + and %0010 srl a add c add c diff --git a/engine/events/fish.asm b/engine/events/fish.asm index 9d1ea63ae..05bd7f530 100644 --- a/engine/events/fish.asm +++ b/engine/events/fish.asm @@ -80,7 +80,7 @@ rept 4 endr ld a, [TimeOfDay] - and 3 + maskbits NUM_DAYTIMES +- 1 cp NITE_F jr c, .time_species inc hl diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm index a4b523d1e..fb05ff7f6 100755 --- a/engine/events/magnet_train.asm +++ b/engine/events/magnet_train.asm @@ -435,7 +435,7 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae ld a, [wEnvironment] push af ld a, [TimeOfDay] - and $3 + maskbits NUM_DAYTIMES +- 1 ld [TimeOfDayPal], a ld a, $1 ld [wEnvironment], a diff --git a/engine/events/poisonstep_pals.asm b/engine/events/poisonstep_pals.asm index 10a254ceb..9aad8a9d8 100644 --- a/engine/events/poisonstep_pals.asm +++ b/engine/events/poisonstep_pals.asm @@ -10,8 +10,8 @@ LoadPoisonBGPals: ; cbcdd and a jr nz, .cgb ld a, [TimeOfDayPal] - and $3 - cp $3 + maskbits NUM_DAYTIMES +- 1 + cp DARKNESS_F ld a, %00000000 jr z, .convert_pals ld a, %10101010 diff --git a/engine/events/poke_seer.asm b/engine/events/poke_seer.asm index d6e335298..4a7b3e081 100644 --- a/engine/events/poke_seer.asm +++ b/engine/events/poke_seer.asm @@ -20,7 +20,7 @@ SpecialPokeSeer: ; 4f0bc call PrintSeerText call JoyWaitAorB - ld b, $6 + ld b, PARTY_LENGTH farcall SelectMonFromParty jr c, .cancel @@ -163,11 +163,11 @@ GetCaughtLevel: ; 4f18c call ByteFill ; caught level - ; Limited to between 1 and 63 for some reason. + ; Limited to between 1 and 63 since it's a 6-bit quantity. ld a, [wSeerCaughtData] - and $3f + and CAUGHT_LEVEL_MASK jr z, .unknown - cp 1 ; hatched from an egg + cp CAUGHT_EGG_LEVEL ; egg marker value jr nz, .print ld a, EGG_LEVEL ; egg hatch level @@ -193,7 +193,7 @@ GetCaughtLevel: ; 4f18c GetCaughtTime: ; 4f1c5 ld a, [wSeerCaughtData] - and $c0 + and CAUGHT_TIME_MASK jr z, .none rlca @@ -233,11 +233,11 @@ UnknownCaughtData: ; 4f1f8 GetCaughtLocation: ; 4f20a ld a, [wSeerCaughtGender] - and $7f + and CAUGHT_LOCATION_MASK jr z, .Unknown - cp $7f + cp EVENT_LOCATION jr z, .event - cp $7e + cp GIFT_LOCATION jr z, .fail ld e, a farcall GetLandmarkName @@ -440,22 +440,22 @@ GetCaughtGender: ; 4f301 add hl, bc ld a, [hl] - and $7f + and CAUGHT_LOCATION_MASK jr z, .genderless - cp $7f + cp EVENT_LOCATION jr z, .genderless ld a, [hl] - and $80 + and CAUGHT_GENDER_MASK jr nz, .male - ld c, 1 + ld c, CAUGHT_BY_GIRL ret .male - ld c, 2 + ld c, CAUGHT_BY_BOY ret .genderless - ld c, 0 + ld c, CAUGHT_BY_UNKNOWN ret ; 4f31c diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index 8d482f53e..08e004e1b 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -1333,7 +1333,7 @@ ResetClock: ; 6392 Function639b: ; unreferenced ; If bit 0 or 1 of [wTitleScreenTimer] is set, we don't need to be here. ld a, [wTitleScreenTimer] - and $3 + and %00000011 ret nz ld bc, SpriteAnim10 ld hl, SPRITEANIMSTRUCT_FRAME diff --git a/engine/item_effects.asm b/engine/item_effects.asm index 7c71cf08a..f5c5e76d1 100644 --- a/engine/item_effects.asm +++ b/engine/item_effects.asm @@ -775,7 +775,7 @@ GetPokedexEntryBank: ld a, [EnemyMonSpecies] rlca rlca - and 3 + maskbits NUM_DEX_ENTRY_BANKS +- 1 ld hl, .PokedexEntryBanks ld d, 0 ld e, a @@ -786,12 +786,6 @@ GetPokedexEntryBank: ret .PokedexEntryBanks: - -GLOBAL PokedexEntries1 -GLOBAL PokedexEntries2 -GLOBAL PokedexEntries3 -GLOBAL PokedexEntries4 - db BANK(PokedexEntries1) db BANK(PokedexEntries2) db BANK(PokedexEntries3) diff --git a/engine/landmarks.asm b/engine/landmarks.asm index 75605bbd9..452bd2e92 100644 --- a/engine/landmarks.asm +++ b/engine/landmarks.asm @@ -80,8 +80,8 @@ RegionCheck: ; 0x1caea1 jr c, .kanto .johto - ld e, 0 + ld e, JOHTO_REGION ret .kanto - ld e, 1 + ld e, KANTO_REGION ret diff --git a/engine/map_objects.asm b/engine/map_objects.asm index 503dac46d..a50650863 100644 --- a/engine/map_objects.asm +++ b/engine/map_objects.asm @@ -894,7 +894,7 @@ MapObjectMovementPattern: ; 47dd ld hl, OBJECT_DIRECTION_WALKING add hl, de ld a, [hl] - and 3 + maskbits NUM_DIRECTIONS +- 1 ld d, 1 * 8 + 6 cp DOWN jr z, .ok_13 diff --git a/engine/mystery_gift_2.asm b/engine/mystery_gift_2.asm index 0baaabef3..72767aa17 100755 --- a/engine/mystery_gift_2.asm +++ b/engine/mystery_gift_2.asm @@ -29,7 +29,7 @@ PrepMysteryGiftDataToSend: ; 2c642 (b:4642) inc de ; wc80f call CloseSRAM call Random - and $1 + and 1 ld [de], a inc de ; wc810 call .RandomSample @@ -59,10 +59,10 @@ PrepMysteryGiftDataToSend: ; 2c642 (b:4642) .RandomSample: ; 2c6ac (b:46ac) push de call Random - cp $19 ; 10 percent + cp 10 percent jr c, .tenpercent call Random - and $7 + and %111 ld d, a rl d ld e, $80 @@ -80,10 +80,10 @@ PrepMysteryGiftDataToSend: ; 2c642 (b:4642) .tenpercent call Random - cp $32 ; 20 percent + cp 20 percent - 1 jr c, .twopercent call Random - and $3 + and %011 ld d, a rl d ld e, $80 @@ -102,7 +102,7 @@ PrepMysteryGiftDataToSend: ; 2c642 (b:4642) .twopercent call Random - cp $32 ; 50 ; 20 percent + cp 20 percent - 1 jr c, .pointfourpercent ld a, b swap a diff --git a/engine/npc_movement.asm b/engine/npc_movement.asm index a2508e0f6..dfccc4330 100755 --- a/engine/npc_movement.asm +++ b/engine/npc_movement.asm @@ -70,14 +70,14 @@ Function6f07: ; 6f07 ld e, [hl] ld hl, OBJECT_PALETTE add hl, bc - bit 7, [hl] + bit OAM_PRIORITY, [hl] jp nz, Function6fa1 ld hl, OBJECT_NEXT_TILE add hl, bc ld a, [hl] ld d, a call GetTileCollision - and a ; land + and a ; LANDTILE jr z, Function6f3e scf ret @@ -106,7 +106,7 @@ Function6f3e: ; 6f3e ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld a, [hl] - and 3 + maskbits NUM_DIRECTIONS +- 1 ld e, a ld d, 0 ld hl, .data_6f5b @@ -131,7 +131,7 @@ Function6f5f: ; 6f5f push af ld hl, OBJECT_DIRECTION_WALKING add hl, bc - and 3 + maskbits NUM_DIRECTIONS +- 1 ld e, a ld d, 0 ld hl, .data_6f7b @@ -178,49 +178,49 @@ Function6fa1: ; 6fa1 ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld a, [hl] - and 3 - jr z, .asm_6fb2 + maskbits NUM_DIRECTIONS +- 1 + jr z, .down dec a - jr z, .asm_6fb7 + jr z, .up dec a - jr z, .asm_6fbb - jr .asm_6fbf + jr z, .left + jr .right -.asm_6fb2 +.down inc e push de inc d - jr .asm_6fc2 + jr .continue -.asm_6fb7 +.up push de inc d - jr .asm_6fc2 + jr .continue -.asm_6fbb +.left push de inc e - jr .asm_6fc2 + jr .continue -.asm_6fbf +.right inc d push de inc e -.asm_6fc2 +.continue call GetCoordTile call GetTileCollision pop de - and a ; land - jr nz, .asm_6fd7 + and a ; LANDTILE + jr nz, .not_land call GetCoordTile call GetTileCollision - and a ; land - jr nz, .asm_6fd7 + and a ; LANDTILE + jr nz, .not_land xor a ret -.asm_6fd7 +.not_land scf ret ; 6fd9 diff --git a/engine/npctrade.asm b/engine/npctrade.asm index 1455dce62..1328efa4c 100755 --- a/engine/npctrade.asm +++ b/engine/npctrade.asm @@ -1,11 +1,3 @@ -; Trade dialogs - const_def - const TRADE_INTRO - const TRADE_CANCEL - const TRADE_WRONG - const TRADE_COMPLETE - const TRADE_AFTER - NPCTrade:: ; fcba8 ld a, e ld [wJumptableIndex], a @@ -83,9 +75,9 @@ CheckTradeGender: ; fcc23 ld e, TRADE_GENDER call GetTradeAttribute ld a, [hl] - and a + and a ; TRADE_EITHER_GENDER jr z, .matching - cp 1 + cp TRADE_MALE_ONLY jr z, .check_male farcall GetGender @@ -178,10 +170,10 @@ DoNPCTrade: ; fcc63 ld e, TRADE_DIALOG call GetTradeAttribute ld a, [hl] - cp 3 - ld a, 1 + cp TRADE_DIALOG_GIRL + ld a, CAUGHT_BY_GIRL jr c, .okay - ld a, 2 + ld a, CAUGHT_BY_BOY .okay ld [wOTTrademonCaughtData], a @@ -400,7 +392,7 @@ GetTradeMonNames: ; fce1b and a ret z - cp 1 + cp TRADE_MALE_ONLY ld a, "♂" jr z, .done ld a, "♀" @@ -433,31 +425,28 @@ PrintTradeText: ; fcf38 ; fcf53 TradeTexts: ; fcf53 -; intro +; entries correspond to TRADE_* × TRADE_DIALOG_* constants +; TRADE_INTRO dw TradeIntroText1 dw TradeIntroText2 dw TradeIntroText3 dw TradeIntroText4 - -; cancel +; TRADE_CANCEL dw TradeCancelText1 dw TradeCancelText2 dw TradeCancelText3 dw TradeCancelText4 - -; wrong mon +; TRADE_WRONG dw TradeWrongText1 dw TradeWrongText2 dw TradeWrongText3 dw TradeWrongText4 - -; completed +; TRADE_COMPLETE dw TradeCompleteText1 dw TradeCompleteText2 dw TradeCompleteText3 dw TradeCompleteText4 - -; after +; TRADE_AFTER dw TradeAfterText1 dw TradeAfterText2 dw TradeAfterText3 diff --git a/engine/pack.asm b/engine/pack.asm index 047924cb0..ea2a06cb9 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -1,3 +1,17 @@ +; Pack.Jumptable and BattlePack.Jumptable indexes + const_def + const PACKSTATE_INITGFX ; 0 + const PACKSTATE_INITITEMSPOCKET ; 1 + const PACKSTATE_ITEMSPOCKETMENU ; 2 + const PACKSTATE_INITBALLSPOCKET ; 3 + const PACKSTATE_BALLSPOCKETMENU ; 4 + const PACKSTATE_INITKEYITEMSPOCKET ; 5 + const PACKSTATE_KEYITEMSPOCKETMENU ; 6 + const PACKSTATE_INITTMHMPOCKET ; 7 + const PACKSTATE_TMHMPOCKETMENU ; 8 + const PACKSTATE_QUITNOSCRIPT ; 9 + const PACKSTATE_QUITRUNSCRIPT ; 10 + Pack: ; 10000 ld hl, Options set NO_TEXT_SCROLL, [hl] @@ -28,6 +42,7 @@ Pack: ; 10000 ; 10030 .Jumptable: ; 10030 (4:4030) +; entries correspond to PACKSTATE_* constants dw .InitGFX ; 0 dw .InitItemsPocket ; 1 dw .ItemsPocketMenu ; 2 @@ -50,7 +65,7 @@ Pack: ; 10000 ret .InitItemsPocket: ; 10056 (4:4056) - xor a + xor a ; ITEM_POCKET ld [wCurrPocket], a call ClearPocketList call DrawPocketName @@ -70,15 +85,15 @@ Pack: ; 10000 ld [wItemsPocketScrollPosition], a ld a, [wMenuCursorY] ld [wItemsPocketCursor], a - ld b, $7 - ld c, $3 + ld b, PACKSTATE_INITTMHMPOCKET ; left + ld c, PACKSTATE_INITBALLSPOCKET ; right call Pack_InterpretJoypad ret c call .ItemBallsKey_LoadSubmenu ret .InitKeyItemsPocket: ; 10094 (4:4094) - ld a, $2 + ld a, KEY_ITEM_POCKET ld [wCurrPocket], a call ClearPocketList call DrawPocketName @@ -98,15 +113,15 @@ Pack: ; 10000 ld [wKeyItemsPocketScrollPosition], a ld a, [wMenuCursorY] ld [wKeyItemsPocketCursor], a - ld b, $3 - ld c, $7 + ld b, PACKSTATE_INITBALLSPOCKET ; left + ld c, PACKSTATE_INITTMHMPOCKET ; right call Pack_InterpretJoypad ret c call .ItemBallsKey_LoadSubmenu ret .InitTMHMPocket: ; 100d3 (4:40d3) - ld a, $3 + ld a, TM_HM_POCKET ld [wCurrPocket], a call ClearPocketList call DrawPocketName @@ -118,8 +133,8 @@ Pack: ; 10000 .TMHMPocketMenu: ; 100e8 (4:40e8) farcall TMHMPocket - ld b, $5 - ld c, $1 + ld b, PACKSTATE_INITKEYITEMSPOCKET ; left + ld c, PACKSTATE_INITITEMSPOCKET ; right call Pack_InterpretJoypad ret c farcall _CheckTossableItem @@ -162,7 +177,6 @@ Pack: ; 10000 ; 0x10137 .Jumptable1: ; 10137 - dw .UseItem dw QuitItemSubmenu @@ -211,7 +225,7 @@ Pack: ; 10000 ret .InitBallsPocket: ; 10186 (4:4186) - ld a, $1 + ld a, BALL_POCKET ld [wCurrPocket], a call ClearPocketList call DrawPocketName @@ -231,8 +245,8 @@ Pack: ; 10000 ld [wBallsPocketScrollPosition], a ld a, [wMenuCursorY] ld [wBallsPocketCursor], a - ld b, $1 - ld c, $5 + ld b, PACKSTATE_INITITEMSPOCKET ; left + ld c, PACKSTATE_INITKEYITEMSPOCKET ; right call Pack_InterpretJoypad ret c call .ItemBallsKey_LoadSubmenu @@ -327,7 +341,6 @@ MenuDataHeader_UsableKeyItem: ; 0x10249 ; 0x1026a Jumptable_UseGiveTossRegisterQuit: ; 1026a - dw UseItem dw GiveItem dw TossMenu @@ -353,7 +366,6 @@ MenuDataHeader_UsableItem: ; 0x10274 ; 0x10291 Jumptable_UseGiveTossQuit: ; 10291 - dw UseItem dw GiveItem dw TossMenu @@ -376,7 +388,6 @@ MenuDataHeader_UnusableItem: ; 0x10299 ; 0x102ac Jumptable_UseQuit: ; 102ac - dw UseItem dw QuitItemSubmenu ; 102b0 @@ -398,7 +409,6 @@ MenuDataHeader_UnusableKeyItem: ; 0x102b0 ; 0x102c7 Jumptable_UseRegisterQuit: ; 102c7 - dw UseItem dw RegisterItem dw QuitItemSubmenu @@ -422,7 +432,6 @@ MenuDataHeader_HoldableKeyItem: ; 0x102cd ; 0x102ea Jumptable_GiveTossRegisterQuit: ; 102ea - dw GiveItem dw TossMenu dw RegisterItem @@ -446,7 +455,6 @@ MenuDataHeader_HoldableItem: ; 0x102f2 ; 0x1030b Jumptable_GiveTossQuit: ; 1030b - dw GiveItem dw TossMenu dw QuitItemSubmenu @@ -462,14 +470,14 @@ UseItem: ; 10311 ; 1031f .dw ; 1031f (4:431f) - +; entries correspond to ITEMMENU_* constants + dw .Oak ; ITEMMENU_NOUSE dw .Oak dw .Oak dw .Oak - dw .Oak - dw .Current - dw .Party - dw .Field + dw .Current ; ITEMMENU_CURRENT + dw .Party ; ITEMMENU_PARTY + dw .Field ; ITEMMENU_CLOSE ; 1035c .Oak: ; 1032d (4:432d) @@ -503,7 +511,7 @@ UseItem: ; 10311 ld a, [wItemEffectSucceeded] and a jr z, .Oak - ld a, $a + ld a, PACKSTATE_QUITRUNSCRIPT ld [wJumptableIndex], a ret ; 10364 (4:4364) @@ -537,11 +545,11 @@ TossMenu: ; 10364 ResetPocketCursorPositions: ; 1039d ; unreferenced ld a, [wCurrPocket] - and a + and a ; ITEM_POCKET jr z, .items - dec a + dec a ; BALL_POCKET jr z, .balls - dec a + dec a ; KEY_ITEM_POCKET jr z, .key ret @@ -693,6 +701,7 @@ BattlePack: ; 10493 ; 104c3 .Jumptable: ; 104c3 (4:44c3) +; entries correspond to PACKSTATE_* constants dw .InitGFX ; 0 dw .InitItemsPocket ; 1 dw .ItemsPocketMenu ; 2 @@ -715,7 +724,7 @@ BattlePack: ; 10493 ret .InitItemsPocket: ; 104e9 (4:44e9) - xor a + xor a ; ITEM_POCKET ld [wCurrPocket], a call ClearPocketList call DrawPocketName @@ -735,15 +744,15 @@ BattlePack: ; 10493 ld [wItemsPocketScrollPosition], a ld a, [wMenuCursorY] ld [wItemsPocketCursor], a - ld b, $7 - ld c, $3 + ld b, PACKSTATE_INITTMHMPOCKET ; left + ld c, PACKSTATE_INITBALLSPOCKET ; right call Pack_InterpretJoypad ret c call ItemSubmenu ret .InitKeyItemsPocket: ; 10527 (4:4527) - ld a, $2 + ld a, KEY_ITEM_POCKET ld [wCurrPocket], a call ClearPocketList call DrawPocketName @@ -763,15 +772,15 @@ BattlePack: ; 10493 ld [wKeyItemsPocketScrollPosition], a ld a, [wMenuCursorY] ld [wKeyItemsPocketCursor], a - ld b, $3 - ld c, $7 + ld b, PACKSTATE_INITBALLSPOCKET ; left + ld c, PACKSTATE_INITTMHMPOCKET ; right call Pack_InterpretJoypad ret c call ItemSubmenu ret .InitTMHMPocket: ; 10566 (4:4566) - ld a, $3 + ld a, TM_HM_POCKET ld [wCurrPocket], a call ClearPocketList call DrawPocketName @@ -785,8 +794,8 @@ BattlePack: ; 10493 .TMHMPocketMenu: ; 10581 (4:4581) farcall TMHMPocket - ld b, $5 - ld c, $1 + ld b, PACKSTATE_INITKEYITEMSPOCKET ; left + ld c, PACKSTATE_INITITEMSPOCKET ; right call Pack_InterpretJoypad ret c xor a @@ -794,7 +803,7 @@ BattlePack: ; 10493 ret .InitBallsPocket: ; 10594 (4:4594) - ld a, $1 + ld a, BALL_POCKET ld [wCurrPocket], a call ClearPocketList call DrawPocketName @@ -814,8 +823,8 @@ BattlePack: ; 10493 ld [wBallsPocketScrollPosition], a ld a, [wMenuCursorY] ld [wBallsPocketCursor], a - ld b, $1 - ld c, $5 + ld b, PACKSTATE_INITITEMSPOCKET ; left + ld c, PACKSTATE_INITKEYITEMSPOCKET ; right call Pack_InterpretJoypad ret c call ItemSubmenu @@ -893,13 +902,14 @@ TMHMSubmenu: ; 105dc (4:45dc) ret .ItemFunctionJumptable: ; 10637 (4:4637) +; entries correspond to ITEMMENU_* constants + dw .Oak ; ITEMMENU_NOUSE dw .Oak dw .Oak dw .Oak - dw .Oak - dw .Unused - dw .BattleField - dw .BattleOnly + dw .Unused ; ITEMMENU_CURRENT + dw .BattleField ; ITEMMENU_PARTY + dw .BattleOnly ; ITEMMENU_CLOSE .Oak: ; 10645 (4:4645) ld hl, Text_ThisIsntTheTime @@ -937,7 +947,7 @@ TMHMSubmenu: ; 105dc (4:45dc) cp $2 jr z, .didnt_use_item .quit_run_script ; 1067e (4:467e) - ld a, 10 + ld a, PACKSTATE_QUITRUNSCRIPT ld [wJumptableIndex], a ret @@ -954,7 +964,7 @@ InitPackBuffers: ; 1068a xor a ld [wJumptableIndex], a ld a, [wLastPocket] - and $3 + maskbits NUM_POCKETS +- 1 ld [wCurrPocket], a inc a add a @@ -997,13 +1007,14 @@ DepositSellPack: ; 106be ; 106d1 .Jumptable: ; 106d1 (4:46d1) +; entries correspond to *_POCKET constants dw .ItemsPocket dw .BallsPocket dw .KeyItemsPocket dw .TMHMPocket .ItemsPocket: ; 106d9 (4:46d9) - xor a + xor a ; ITEM_POCKET call InitPocket ld hl, PC_Mart_ItemsPocketMenuDataHeader call CopyMenuDataHeader @@ -1019,7 +1030,7 @@ DepositSellPack: ; 106be ret .KeyItemsPocket: ; 106ff (4:46ff) - ld a, 2 + ld a, KEY_ITEM_POCKET call InitPocket ld hl, PC_Mart_KeyItemsPocketMenuDataHeader call CopyMenuDataHeader @@ -1035,7 +1046,7 @@ DepositSellPack: ; 106be ret .TMHMPocket: ; 10726 (4:4726) - ld a, 3 + ld a, TM_HM_POCKET call InitPocket call WaitBGMap_DrawPackGFX farcall TMHMPocket @@ -1044,7 +1055,7 @@ DepositSellPack: ; 106be ret .BallsPocket: ; 1073b (4:473b) - ld a, 1 + ld a, BALL_POCKET call InitPocket ld hl, PC_Mart_BallsPocketMenuDataHeader call CopyMenuDataHeader @@ -1098,7 +1109,7 @@ DepositSellTutorial_InterpretJoypad: ; 1076f .d_left ld a, [wJumptableIndex] dec a - and $3 + maskbits NUM_POCKETS +- 1 ld [wJumptableIndex], a push de ld de, SFX_SWITCH_POCKETS @@ -1110,7 +1121,7 @@ DepositSellTutorial_InterpretJoypad: ; 1076f .d_right ld a, [wJumptableIndex] inc a - and $3 + maskbits NUM_POCKETS +- 1 ld [wJumptableIndex], a push de ld de, SFX_SWITCH_POCKETS @@ -1144,14 +1155,14 @@ TutorialPack: ; 107bb ; 107e1 .dw ; 107e1 (4:47e1) - +; entries correspond to *_POCKET constants dw .Items dw .Balls dw .KeyItems dw .TMHM .Items: ; 107e9 (4:47e9) - xor a + xor a ; ITEM_POCKET ld hl, .ItemsMenuDataHeader jr .DisplayPocket @@ -1175,7 +1186,7 @@ TutorialPack: ; 107bb ; 10807 .KeyItems: ; 10807 (4:4807) - ld a, 2 + ld a, KEY_ITEM_POCKET ld hl, .KeyItemsMenuDataHeader jr .DisplayPocket @@ -1199,7 +1210,7 @@ TutorialPack: ; 107bb ; 10826 .TMHM: ; 10826 (4:4826) - ld a, 3 + ld a, TM_HM_POCKET call InitPocket call WaitBGMap_DrawPackGFX farcall TMHMPocket @@ -1208,7 +1219,7 @@ TutorialPack: ; 107bb ret .Balls: ; 1083b (4:483b) - ld a, 1 + ld a, BALL_POCKET ld hl, .BallsMenuDataHeader jr .DisplayPocket @@ -1283,7 +1294,7 @@ WaitBGMap_DrawPackGFX: ; 1089a (4:489a) call WaitBGMap DrawPackGFX: ; 1089d ld a, [wCurrPocket] - and $3 + maskbits NUM_POCKETS +- 1 ld e, a ld d, $0 ld a, [BattleType] @@ -1310,10 +1321,10 @@ DrawPackGFX: ; 1089d ; 108cc PackGFXPointers: ; 108cc - dw PackGFX + (15 tiles) * 1 - dw PackGFX + (15 tiles) * 3 - dw PackGFX + (15 tiles) * 0 - dw PackGFX + (15 tiles) * 2 + dw PackGFX + (15 tiles) * 1 ; ITEM_POCKET + dw PackGFX + (15 tiles) * 3 ; BALL_POCKET + dw PackGFX + (15 tiles) * 0 ; KEY_ITEM_POCKET + dw PackGFX + (15 tiles) * 2 ; TM_HM_POCKET ; 108d4 Pack_InterpretJoypad: ; 108d4 (4:48d4) @@ -1344,7 +1355,7 @@ Pack_InterpretJoypad: ; 108d4 (4:48d4) ret .b_button - ld a, 9 + ld a, PACKSTATE_QUITNOSCRIPT ld [wJumptableIndex], a scf ret @@ -1489,15 +1500,19 @@ DrawPocketName: ; 109bb ; 109e1 .tilemap ; 109e1 +; ITEM_POCKET db $00, $04, $04, $04, $01 ; top border db $06, $07, $08, $09, $0a ; Items db $02, $05, $05, $05, $03 ; bottom border +; BALL_POCKET db $00, $04, $04, $04, $01 ; top border db $15, $16, $17, $18, $19 ; Balls db $02, $05, $05, $05, $03 ; bottom border +; KEY_ITEM_POCKET db $00, $04, $04, $04, $01 ; top border db $0b, $0c, $0d, $0e, $0f ; Key Items db $02, $05, $05, $05, $03 ; bottom border +; TM_HM_POCKET db $00, $04, $04, $04, $01 ; top border db $10, $11, $12, $13, $14 ; TM/HM db $02, $05, $05, $05, $03 ; bottom border diff --git a/engine/player_movement.asm b/engine/player_movement.asm index fa7cc84a5..49fb23f3a 100755 --- a/engine/player_movement.asm +++ b/engine/player_movement.asm @@ -140,7 +140,7 @@ DoPlayerMovement:: ; 80000 .water ld a, c - and 3 + maskbits NUM_DIRECTIONS +- 1 ld c, a ld b, 0 ld hl, .water_table @@ -244,7 +244,7 @@ DoPlayerMovement:: ; 80000 ld a, [PlayerDirection] rrca rrca - and 3 + maskbits NUM_DIRECTIONS +- 1 cp e jr z, .not_turning @@ -430,7 +430,7 @@ DoPlayerMovement:: ; 80000 ld a, [PlayerDirection] rrca rrca - and 3 + maskbits NUM_DIRECTIONS +- 1 cp e jr nz, .not_warp call WarpCheck @@ -559,7 +559,7 @@ DoPlayerMovement:: ; 80000 cp 0 ret z - and 3 + maskbits NUM_DIRECTIONS +- 1 ld e, a ld d, 0 ld hl, .forced_dpad diff --git a/engine/player_object.asm b/engine/player_object.asm index 6d5cb7e84..50cabadf6 100755 --- a/engine/player_object.asm +++ b/engine/player_object.asm @@ -589,7 +589,7 @@ Special_SurfStartStep: ; 8379 ld a, [PlayerDirection] srl a srl a - and 3 + maskbits NUM_DIRECTIONS +- 1 ld e, a ld d, 0 ld hl, .movement_data diff --git a/engine/player_step.asm b/engine/player_step.asm index 996a9b422..fb00a1b81 100755 --- a/engine/player_step.asm +++ b/engine/player_step.asm @@ -154,7 +154,7 @@ UpdateOverworldMap: ; d536 (3:5536) jr nc, .not_overflowed ld a, [wBGMapAnchor + 1] inc a - and $3 + and %11 or HIGH(vBGMap0) ld [wBGMapAnchor + 1], a .not_overflowed @@ -185,7 +185,7 @@ UpdateOverworldMap: ; d536 (3:5536) jr nc, .not_underflowed ld a, [wBGMapAnchor + 1] dec a - and $3 + and %11 or HIGH(vBGMap0) ld [wBGMapAnchor + 1], a .not_underflowed diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 8f39a742d..7fe3852ed 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -1,3 +1,4 @@ +; Pokedex_RunJumptable.Jumptable indexes const_def const DEXSTATE_MAIN_SCR const DEXSTATE_UPDATE_MAIN_SCR @@ -185,6 +186,7 @@ Pokedex_RunJumptable: ; 4010b jp hl .Jumptable: ; 40115 (10:4115) +; entries correspond to DEXSTATE_* constants dw Pokedex_InitMainScreen dw Pokedex_UpdateMainScreen dw Pokedex_InitDexEntryScreen @@ -739,7 +741,7 @@ Pokedex_InitSearchResultsScreen: ; 4050a (10:450a) farcall DrawPokedexSearchResultsWindow call Pokedex_PlaceSearchResultsTypeStrings call Pokedex_UpdateSearchResultsCursorOAM - ld a, $ff + ld a, -1 ld [CurPartySpecies], a ld a, SCGB_POKEDEX call Pokedex_GetSGBLayout @@ -1123,13 +1125,14 @@ Pokedex_DrawMainScreenBG: ; 4074c (10:474c) ret String_SEEN: ; 407e1 - db "SEEN", $ff + db "SEEN", -1 String_OWN: ; 407e6 - db "OWN", $ff + db "OWN", -1 String_SELECT_OPTION: ; 407ea db $3b, $48, $49, $4a, $44, $45, $46, $47 ; SELECT > OPTION + ; fallthrough String_START_SEARCH: ; 407f2 - db $3c, $3b, $41, $42, $43, $4b, $4c, $4d, $4e, $3c, $ff ; START > SEARCH + db $3c, $3b, $41, $42, $43, $4b, $4c, $4d, $4e, $3c, -1 ; START > SEARCH Pokedex_DrawDexEntryScreenBG: ; 407fd call Pokedex_FillBackgroundColor2 @@ -1164,13 +1167,13 @@ Pokedex_DrawDexEntryScreenBG: ; 407fd ret .Unused: ; 4084f - db $5c, $5d, $ff ; No. + db $5c, $5d, -1 ; No. .Height: ; 40852 - db "HT ?", $5e, "??", $5f, $ff ; HT ?'??" + db "HT ?", $5e, "??", $5f, -1 ; HT ?'??" .Weight: ; 4085c - db "WT ???lb", $ff ; WT ???lb + db "WT ???lb", -1 ; WT ???lb .MenuItems: ; 40867 - db $3b, " PAGE AREA CRY PRNT", $ff + db $3b, " PAGE AREA CRY PRNT", -1 Pokedex_DrawOptionScreenBG: ; 4087c (10:487c) call Pokedex_FillBackgroundColor2 @@ -1195,7 +1198,7 @@ Pokedex_DrawOptionScreenBG: ; 4087c (10:487c) ret .Title: ; 408b2 - db $3b, " OPTION ", $3c, $ff + db $3b, " OPTION ", $3c, -1 .Modes: ; 408bd db "NEW #DEX MODE" @@ -1229,10 +1232,10 @@ Pokedex_DrawSearchScreenBG: ; 408f0 (10:48f0) ret .Title: ; 4092a - db $3b, " SEARCH ", $3c, $ff + db $3b, " SEARCH ", $3c, -1 .TypeLeftRightArrows: ; 40935 - db $3d, " ", $3e, $ff + db $3d, " ", $3e, -1 .Types: ; 40940 db "TYPE1" diff --git a/engine/pokedex_2.asm b/engine/pokedex_2.asm index df0771e07..4a5a08803 100644 --- a/engine/pokedex_2.asm +++ b/engine/pokedex_2.asm @@ -230,7 +230,7 @@ GetDexEntryPointer: ; 44333 push de rlca rlca - and $3 + maskbits NUM_DEX_ENTRY_BANKS +- 1 ld hl, .PokedexEntryBanks ld d, 0 ld e, a @@ -241,12 +241,6 @@ GetDexEntryPointer: ; 44333 ret .PokedexEntryBanks: ; 44351 - -GLOBAL PokedexEntries1 -GLOBAL PokedexEntries2 -GLOBAL PokedexEntries3 -GLOBAL PokedexEntries4 - db BANK(PokedexEntries1) db BANK(PokedexEntries2) db BANK(PokedexEntries3) diff --git a/engine/pokegear.asm b/engine/pokegear.asm index 20910c0d5..4141b08fa 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -1,3 +1,27 @@ +; Pokégear cards + const_def + const POKEGEARCARD_CLOCK ; 0 + const POKEGEARCARD_MAP ; 1 + const POKEGEARCARD_PHONE ; 2 + const POKEGEARCARD_RADIO ; 3 +NUM_POKEGEAR_CARDS EQU const_value + +; PokegearJumptable.Jumptable indexes + const_def + const POKEGEARSTATE_CLOCKINIT ; 0 + const POKEGEARSTATE_CLOCKJOYPAD ; 1 + const POKEGEARSTATE_MAPCHECKREGION ; 2 + const POKEGEARSTATE_JOHTOMAPINIT ; 3 + const POKEGEARSTATE_JOHTOMAPJOYPAD ; 4 + const POKEGEARSTATE_KANTOMAPINIT ; 5 + const POKEGEARSTATE_KANTOMAPJOYPAD ; 6 + const POKEGEARSTATE_PHONEINIT ; 7 + const POKEGEARSTATE_PHONEJOYPAD ; 8 + const POKEGEARSTATE_MAKEPHONECALL ; 9 + const POKEGEARSTATE_FINISHPHONECALL ; a + const POKEGEARSTATE_RADIOINIT ; b + const POKEGEARSTATE_RADIOJOYPAD ; c + PokeGear: ; 90b8d (24:4b8d) ld hl, Options ld a, [hl] @@ -163,7 +187,10 @@ AnimatePokegearModeIndicatorArrow: ; 90d41 (24:4d41) ; 90d52 (24:4d52) .XCoords: ; 90d52 - db $00, $10, $20, $30 + db $00 ; POKEGEARCARD_CLOCK + db $10 ; POKEGEARCARD_MAP + db $20 ; POKEGEARCARD_PHONE + db $30 ; POKEGEARCARD_RADIO ; 90d56 TownMap_GetCurrentLandmark: ; 90d56 @@ -210,7 +237,7 @@ TownMap_InitCursorAndPlayerIconPositions: ; 90d70 (24:4d70) ret Pokegear_InitJumptableIndices: ; 90d9e (24:4d9e) - ld a, $0 + ld a, POKEGEARSTATE_CLOCKINIT ld [wJumptableIndex], a xor a ld [wcf64], a @@ -224,7 +251,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8) ld a, $4f call ByteFill ld a, [wcf64] - and $3 + maskbits NUM_POKEGEAR_CARDS +- 1 add a ld e, a ld d, 0 @@ -260,6 +287,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8) xor a .finish ld [hWY], a + ; swap region maps ld a, [wcf65] and 1 xor 1 @@ -281,6 +309,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8) ; 90e12 (24:4e12) .Jumptable: ; 90e12 +; entries correspond to POKEGEARCARD_* constants dw .Clock dw .Map dw .Phone @@ -319,12 +348,12 @@ InitPokegearTilemap: ; 90da8 (24:4da8) ld e, 1 .ok farcall PokegearMap - ld a, $7 + ld a, $07 ld bc, $12 hlcoord 1, 2 call ByteFill hlcoord 0, 2 - ld [hl], $6 + ld [hl], $06 hlcoord 19, 2 ld [hl], $17 ld a, [wPokegearMapCursorLandmark] @@ -382,13 +411,13 @@ Pokegear_FinishTilemap: ; 90eb0 (24:4eb0) call ByteFill ld de, wPokegearFlags ld a, [de] - bit 0, a + bit 0, a ; ENGINE_MAP_CARD call nz, .PlaceMapIcon ld a, [de] - bit 2, a + bit 2, a ; ENGINE_PHONE_CARD call nz, .PlacePhoneIcon ld a, [de] - bit 1, a + bit 1, a ; ENGINE_RADIO_CARD call nz, .PlaceRadioIcon hlcoord 0, 0 ld a, $46 @@ -433,6 +462,7 @@ PokegearJumptable: ; 90f04 (24:4f04) jp hl .Jumptable: ; 90f13 (24:4f13) +; entries correspond to POKEGEARSTATE_* constants dw PokegearClock_Init dw PokegearClock_Joypad dw PokegearMap_CheckRegion @@ -460,32 +490,32 @@ PokegearClock_Joypad: ; 90f3e (24:4f3e) call .UpdateClock ld hl, hJoyLast ld a, [hl] - and A_BUTTON + B_BUTTON + START + SELECT + and A_BUTTON | B_BUTTON | START | SELECT jr nz, .quit ld a, [hl] and D_RIGHT ret z ld a, [wPokegearFlags] - bit 0, a + bit 0, a ; ENGINE_MAP_CARD jr z, .no_map_card - ld c, $2 - ld b, $1 + ld c, POKEGEARSTATE_MAPCHECKREGION + ld b, POKEGEARCARD_MAP jr .done .no_map_card ld a, [wPokegearFlags] - bit 2, a + bit 2, a ; ENGINE_PHONE_CARD jr z, .no_phone_card - ld c, $7 - ld b, $2 + ld c, POKEGEARSTATE_PHONEINIT + ld b, POKEGEARCARD_PHONE jr .done .no_phone_card ld a, [wPokegearFlags] - bit 1, a + bit 1, a ; ENGINE_RADIO_CARD ret z - ld c, $b - ld b, $3 + ld c, POKEGEARSTATE_RADIOINIT + ld b, POKEGEARCARD_RADIO .done call Pokegear_SwitchPage ret @@ -535,12 +565,12 @@ PokegearMap_CheckRegion: ; 90fb4 (24:4fb4) cp KANTO_LANDMARK jr nc, .kanto .johto - ld a, 3 + ld a, POKEGEARSTATE_JOHTOMAPINIT jr .done ret .kanto - ld a, 5 + ld a, POKEGEARSTATE_KANTOMAPINIT .done ld [wJumptableIndex], a call ExitPokegearRadio_HandleMusic @@ -583,23 +613,23 @@ PokegearMap_ContinueMap: ; 90ff2 (24:4ff2) .right ld a, [wPokegearFlags] - bit 2, a + bit 2, a ; ENGINE_PHONE_CARD jr z, .no_phone - ld c, $7 - ld b, $2 + ld c, POKEGEARSTATE_PHONEINIT + ld b, POKEGEARCARD_PHONE jr .done .no_phone ld a, [wPokegearFlags] - bit 1, a + bit 1, a ; ENGINE_RADIO_CARD ret z - ld c, $b - ld b, $3 + ld c, POKEGEARSTATE_RADIOINIT + ld b, POKEGEARCARD_RADIO jr .done .left - ld c, $0 - ld b, $0 + ld c, POKEGEARSTATE_CLOCKINIT + ld b, POKEGEARCARD_CLOCK .done call Pokegear_SwitchPage ret @@ -657,7 +687,7 @@ PokegearMap_InitPlayerIcon: ; 9106a depixel 0, 0 ld b, SPRITE_ANIM_INDEX_RED_WALK ld a, [wPlayerGender] - bit 0, a + bit 0, a ; ENGINE_PLAYER_IS_FEMALE jr z, .got_gender ld b, SPRITE_ANIM_INDEX_BLUE_WALK .got_gender @@ -688,7 +718,7 @@ PokegearMap_InitCursor: ; 91098 call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $4 + ld [hl], $04 ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID add hl, bc ld [hl], SPRITE_ANIM_SEQ_NULL @@ -734,7 +764,7 @@ PokegearMap_UpdateCursorPosition: ; 910d4 TownMap_GetKantoLandmarkLimits: ; 910e8 ld a, [wStatusFlags] - bit 6, a + bit 6, a ; ENGINE_CREDITS_SKIP jr z, .not_hof ld d, ROUTE_28 ld e, PALLET_TOWN @@ -754,7 +784,7 @@ PokegearRadio_Init: ; 910f9 (24:50f9) call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $8 + ld [hl], $08 call _UpdateRadioStation ld hl, wJumptableIndex inc [hl] @@ -780,23 +810,23 @@ PokegearRadio_Joypad: ; 91112 (24:5112) .left ld a, [wPokegearFlags] - bit 2, a + bit 2, a ; ENGINE_PHONE_CARD jr z, .no_phone - ld c, $7 - ld b, $2 + ld c, POKEGEARSTATE_PHONEINIT + ld b, POKEGEARCARD_PHONE jr .switch_page .no_phone ld a, [wPokegearFlags] - bit 0, a + bit 0, a ; ENGINE_MAP_CARD jr z, .no_map - ld c, $2 - ld b, $1 + ld c, POKEGEARSTATE_MAPCHECKREGION + ld b, POKEGEARCARD_MAP jr .switch_page .no_map - ld c, $0 - ld b, $0 + ld c, POKEGEARSTATE_CLOCKINIT + ld b, POKEGEARCARD_CLOCK .switch_page call Pokegear_SwitchPage ret @@ -839,23 +869,23 @@ PokegearPhone_Joypad: ; 91171 (24:5171) .left ld a, [wPokegearFlags] - bit 0, a + bit 0, a ; ENGINE_MAP_CARD jr z, .no_map - ld c, $2 - ld b, $1 + ld c, POKEGEARSTATE_MAPCHECKREGION + ld b, POKEGEARCARD_MAP jr .switch_page .no_map - ld c, $0 - ld b, $0 + ld c, POKEGEARSTATE_CLOCKINIT + ld b, POKEGEARCARD_CLOCK jr .switch_page .right ld a, [wPokegearFlags] - bit 1, a + bit 1, a ; ENGINE_RADIO_CARD ret z - ld c, $b - ld b, $3 + ld c, POKEGEARSTATE_RADIOINIT + ld b, POKEGEARCARD_RADIO .switch_page call Pokegear_SwitchPage ret @@ -891,7 +921,7 @@ PokegearPhone_Joypad: ; 91171 (24:5171) ret .quit_submenu - ld a, $8 + ld a, POKEGEARSTATE_PHONEJOYPAD ld [wJumptableIndex], a ret @@ -931,7 +961,7 @@ PokegearPhone_MakePhoneCall: ; 911eb (24:51eb) farcall Phone_NoSignal ld hl, .OutOfServiceArea call PrintText - ld a, $8 + ld a, POKEGEARSTATE_PHONEJOYPAD ld [wJumptableIndex], a ld hl, PokegearText_WhomToCall call PrintText @@ -958,7 +988,7 @@ PokegearPhone_FinishPhoneCall: ; 91256 (24:5256) and A_BUTTON | B_BUTTON ret z farcall HangUp - ld a, $8 + ld a, POKEGEARSTATE_PHONEJOYPAD ld [wJumptableIndex], a ld hl, PokegearText_WhomToCall call PrintText @@ -993,7 +1023,7 @@ PokegearPhone_GetDPad: ; 9126d (24:526d) .down ld hl, wPokegearPhoneCursorPosition ld a, [hl] - cp $3 + cp 3 jr nc, .scroll_page_down inc [hl] jr .done_joypad_same_page @@ -1001,7 +1031,7 @@ PokegearPhone_GetDPad: ; 9126d (24:526d) .scroll_page_down ld hl, wPokegearPhoneScrollPosition ld a, [hl] - cp $6 + cp 6 ret nc inc [hl] jr .done_joypad_update_page @@ -1075,7 +1105,7 @@ PokegearPhone_UpdateDisplayList: ; 912d8 (24:52d8) ld a, [wPokegearPhoneLoadNameBuffer] inc a ld [wPokegearPhoneLoadNameBuffer], a - cp $4 + cp 4 jr c, .loop call PokegearPhone_UpdateCursor ret @@ -1337,9 +1367,9 @@ Pokegear_SwitchPage: ; 91480 (24:5480) ExitPokegearRadio_HandleMusic: ; 91492 ld a, [wPokegearRadioMusicPlaying] - cp $fe + cp RESTART_MAP_MUSIC jr z, .restart_map_music - cp $ff + cp ENTER_MAP_MUSIC call z, EnterMapMusic xor a ld [wPokegearRadioMusicPlaying], a @@ -1364,11 +1394,11 @@ DeleteSpriteAnimStruct2ToEnd: ; 914ab (24:54ab) Pokegear_LoadTilemapRLE: ; 914bb (24:54bb) ; Format: repeat count, tile ID - ; Terminated with $FF + ; Terminated with -1 hlcoord 0, 0 .loop ld a, [de] - cp $ff + cp -1 ret z ld b, a inc de @@ -1560,7 +1590,7 @@ RadioChannels: call .InJohto jr c, .NoSignal ld a, [wPokegearFlags] - bit 3, a + bit 3, a ; ENGINE_EXPN_CARD jr z, .NoSignal jp LoadStation_PlacesAndPeople @@ -1568,7 +1598,7 @@ RadioChannels: call .InJohto jr c, .NoSignal ld a, [wPokegearFlags] - bit 3, a + bit 3, a ; ENGINE_EXPN_CARD jr z, .NoSignal jp LoadStation_LetsAllSing @@ -1576,14 +1606,14 @@ RadioChannels: call .InJohto jr c, .NoSignal ld a, [wPokegearFlags] - bit 3, a + bit 3, a ; ENGINE_EXPN_CARD jr z, .NoSignal jp LoadStation_PokeFluteRadio .EvolutionRadio: ; This station airs in the Lake of Rage area when Rocket are still in Mahogany. ld a, [wStatusFlags] - bit 4, a + bit 4, a ; ENGINE_ROCKET_SIGNAL_ON_CH20 jr z, .NoSignal ld a, [wPokegearMapPlayerIconLandmark] cp MAHOGANY_TOWN @@ -1669,7 +1699,7 @@ LoadStation_BuenasPassword: ; 917a5 (24:57a5) call Radio_BackUpFarCallParams ld de, NotBuenasPasswordName ld a, [wStatusFlags2] - bit 0, a + bit 0, a ; ENGINE_ROCKETS_IN_RADIO_TOWER ret z ld de, BuenasPasswordName ret @@ -1768,7 +1798,7 @@ RadioMusicRestartDE: ; 91854 (24:5854) RadioMusicRestartPokemonChannel: ; 91868 (24:5868) push de - ld a, $fe + ld a, RESTART_MAP_MUSIC ld [wPokegearRadioMusicPlaying], a ld de, MUSIC_NONE call PlayMusic @@ -1799,7 +1829,7 @@ NoRadioStation: ; 91888 (24:5888) NoRadioMusic: ; 9189d (24:589d) ld de, MUSIC_NONE call PlayMusic - ld a, $ff + ld a, ENTER_MAP_MUSIC ld [wPokegearRadioMusicPlaying], a ret @@ -1810,7 +1840,7 @@ NoRadioName: ; 918a9 (24:58a9) lb bc, 3, 18 call ClearBox hlcoord 0, 12 - ld bc, $412 + lb bc, 4, 18 call TextBox ret @@ -1966,26 +1996,26 @@ _TownMap: ; 9191c ld a, [wTownMapPlayerIconLandmark] cp KANTO_LANDMARK jr nc, .kanto2 - ld e, $0 + ld e, JOHTO_REGION jr .okay_tilemap .kanto2 - ld e, $1 + ld e, KANTO_REGION .okay_tilemap farcall PokegearMap - ld a, $7 + ld a, $07 ld bc, 6 hlcoord 1, 0 call ByteFill hlcoord 0, 0 - ld [hl], $6 + ld [hl], $06 hlcoord 7, 0 ld [hl], $17 hlcoord 7, 1 ld [hl], $16 hlcoord 7, 2 ld [hl], $26 - ld a, $7 + ld a, $07 ld bc, NAME_LENGTH hlcoord 8, 2 call ByteFill @@ -2001,7 +2031,7 @@ PlayRadio: ; 91a53 ld hl, Options ld a, [hl] push af - set 4, [hl] + set NO_TEXT_SCROLL, [hl] call .PlayStation ld c, 100 call DelayFrames @@ -2031,10 +2061,10 @@ PlayRadio: ; 91a53 ; 91a87 .PlayStation: ; 91a87 - ld a, -1 - ld [EnemyTurnsTaken], a + ld a, ENTER_MAP_MUSIC + ld [wPokegearRadioMusicPlaying], a ld hl, .StationPointers - ld d, $0 + ld d, 0 add hl, de add hl, de ld a, [hli] @@ -2063,6 +2093,7 @@ PlayRadio: ; 91a53 ; 91ab9 .StationPointers: ; 91ab9 +; entries correspond to radio station constants dw .OakOrPnP dw LoadStation_OaksPokemonTalk dw LoadStation_PokedexShow @@ -2286,7 +2317,7 @@ TownMapBubble: ; 91bb5 GetMapCursorCoordinates: ; 91c17 ld a, [wTownMapPlayerIconLandmark] ld l, a - ld h, $0 + ld h, 0 add hl, hl ld de, Flypoints add hl, de @@ -2296,10 +2327,10 @@ GetMapCursorCoordinates: ; 91c17 ld c, a ld a, [wTownMapCursorCoordinates + 1] ld b, a - ld hl, $4 + ld hl, 4 add hl, bc ld [hl], e - ld hl, $5 + ld hl, 5 add hl, bc ld [hl], d ret @@ -2477,7 +2508,7 @@ _Area: ; 91d11 call SetPalettes xor a ld [hBGMapMode], a - xor a ; Johto + xor a ; JOHTO_REGION call .GetAndPlaceNest .loop call JoyTextDelay @@ -2524,13 +2555,13 @@ _Area: ; 91d11 call ClearSprites ld a, $90 ld [hWY], a - xor a ; Johto + xor a ; JOHTO_REGION call .GetAndPlaceNest ret .right ld a, [wStatusFlags] - bit 6, a ; hall of fame + bit 6, a ; ENGINE_CREDITS_SKIP ret z ld a, [hWY] and a @@ -2538,7 +2569,7 @@ _Area: ; 91d11 call ClearSprites xor a ld [hWY], a - ld a, 1 ; Kanto + ld a, KANTO_REGION call .GetAndPlaceNest ret @@ -2791,12 +2822,11 @@ TownMapPals: ; 91f13 ; Current tile ld a, [hli] push hl -; HP/borders use palette 0 +; The palette map covers tiles $00 to $5f; $60 and above use palette 0 cp $60 jr nc, .pal0 -; The palette data is condensed to nybbles, -; least-significant first. +; The palette data is condensed to nybbles, least-significant first. ld hl, .PalMap srl a jr c, .odd @@ -2807,7 +2837,7 @@ TownMapPals: ; 91f13 adc 0 ld h, a ld a, [hl] - and %111 + and PALETTE_MASK jr .update .odd @@ -2819,7 +2849,7 @@ TownMapPals: ; 91f13 ld h, a ld a, [hl] swap a - and %111 + and PALETTE_MASK jr .update .pal0 @@ -2839,7 +2869,7 @@ INCLUDE "gfx/pokegear/town_map_palette_map.asm" ; 91f7b TownMapMon: ; 91f7b -; Draw the FlyMon icon at town map location in +; Draw the FlyMon icon at town map location ; Get FlyMon species ld a, [CurPartyMon] @@ -2850,7 +2880,7 @@ TownMapMon: ; 91f7b ld a, [hl] ld [wd265], a ; Get FlyMon icon - ld e, 8 ; starting tile in VRAM + ld e, $08 ; starting tile in VRAM farcall GetSpeciesIcon ; Animation/palette depixel 0, 0 @@ -2858,7 +2888,7 @@ TownMapMon: ; 91f7b call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $8 + ld [hl], $08 ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID add hl, bc ld [hl], SPRITE_ANIM_SEQ_NULL diff --git a/engine/radio.asm b/engine/radio.asm index 06cc3a59a..de19a289c 100644 --- a/engine/radio.asm +++ b/engine/radio.asm @@ -247,7 +247,7 @@ endr ; Generate a number, either 0, 1, or 2, to choose a time of day. .loop2 call Random - and $3 + maskbits NUM_DAYTIMES +- 1 cp DARKNESS_F jr z, .loop2 @@ -692,8 +692,8 @@ PokedexShow_GetDexEntryBank: dec a rlca rlca - and 3 - ld hl, .pokedexbanks + maskbits NUM_DEX_ENTRY_BANKS +- 1 + ld hl, .PokedexEntryBanks ld d, 0 ld e, a add hl, de @@ -702,7 +702,7 @@ PokedexShow_GetDexEntryBank: pop hl ret -.pokedexbanks +.PokedexEntryBanks db BANK(PokedexEntries1) db BANK(PokedexEntries2) db BANK(PokedexEntries3) diff --git a/engine/routines/drawkrispackgfx.asm b/engine/routines/drawkrispackgfx.asm index 457dd7110..54a21e447 100644 --- a/engine/routines/drawkrispackgfx.asm +++ b/engine/routines/drawkrispackgfx.asm @@ -11,10 +11,10 @@ DrawKrisPackGFX: ; 48e81 ret PackFGFXPointers: ; 48e93 - dw PackFGFX + (15 tiles) * 1 - dw PackFGFX + (15 tiles) * 3 - dw PackFGFX + (15 tiles) * 0 - dw PackFGFX + (15 tiles) * 2 + dw PackFGFX + (15 tiles) * 1 ; ITEM_POCKET + dw PackFGFX + (15 tiles) * 3 ; BALL_POCKET + dw PackFGFX + (15 tiles) * 0 ; KEY_ITEM_POCKET + dw PackFGFX + (15 tiles) * 2 ; TM_HM_POCKET PackFGFX: ; 48e9b INCBIN "gfx/pack/pack_f.2bpp" diff --git a/engine/scripting.asm b/engine/scripting.asm index b5489917b..a7650351a 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -614,7 +614,7 @@ GetPocketName: ld a, [wItemAttributeParamBuffer] dec a ld hl, .Pockets - and 3 + maskbits NUM_POCKETS +- 1 add a ld e, a ld d, 0 @@ -2474,7 +2474,7 @@ Script_warpfacing: ; parameters: facing, map_group, map_id, x, y call GetScriptByte - and $3 + maskbits NUM_DIRECTIONS +- 1 ld c, a ld a, [wPlayerSpriteSetupFlags] set 5, a diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm index 23d1d2d62..8f16c5d71 100755 --- a/engine/stats_screen.asm +++ b/engine/stats_screen.asm @@ -1,3 +1,9 @@ +const_value set 1 + const PINK_PAGE ; 1 + const GREEN_PAGE ; 2 + const BLUE_PAGE ; 3 +NUM_STAT_PAGES EQU const_value +- 1 + BattleStatsScreenInit: ; 4dc7b (13:5c7b) ld a, [wLinkMode] cp LINK_MOBILE @@ -58,12 +64,12 @@ StatsScreenMain: ; 0x4dcd2 ; stupid interns ld [wcf64], a ld a, [wcf64] - and $fc - or $1 + and %11111100 + or 1 ld [wcf64], a .loop ; 4dce3 ld a, [wJumptableIndex] - and $7f + and $ff ^ (1 << 7) ld hl, StatsScreenPointerTable rst JumpTable call StatsScreen_WaitAnim ; check for keys? @@ -79,13 +85,13 @@ StatsScreenMobile: ; 4dcf7 ; stupid interns ld [wcf64], a ld a, [wcf64] - and $fc - or $1 + and %11111100 + or 1 ld [wcf64], a .loop farcall Mobile_SetOverworldDelay ld a, [wJumptableIndex] - and $7f + and $ff ^ (1 << 7) ld hl, StatsScreenPointerTable rst JumpTable call StatsScreen_WaitAnim @@ -277,7 +283,7 @@ StatsScreen_GetJoypad: ; 4de2c (13:5e2c) StatsScreen_JoypadAction: ; 4de54 (13:5e54) push af ld a, [wcf64] - and $3 + maskbits NUM_STAT_PAGES +- 1 ld c, a pop af bit B_BUTTON_F, a @@ -335,20 +341,20 @@ StatsScreen_JoypadAction: ; 4de54 (13:5e54) .a_button ld a, c - cp $3 + cp BLUE_PAGE ; last page jr z, .b_button .d_right inc c - ld a, $3 + ld a, BLUE_PAGE ; last page cp c jr nc, .set_page - ld c, $1 + ld c, PINK_PAGE ; first page jr .set_page .d_left dec c jr nz, .set_page - ld c, $3 + ld c, BLUE_PAGE ; last page jr .set_page .done @@ -507,7 +513,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) .ClearBox: ; 4dfda (13:5fda) ld a, [wcf64] - and $3 + maskbits NUM_STAT_PAGES +- 1 ld c, a call StatsScreen_LoadPageIndicators hlcoord 0, 8 @@ -517,7 +523,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) .LoadPals: ; 4dfed (13:5fed) ld a, [wcf64] - and $3 + maskbits NUM_STAT_PAGES +- 1 ld c, a farcall LoadStatsScreenPals call DelayFrame @@ -527,13 +533,14 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) .PageTilemap: ; 4e002 (13:6002) ld a, [wcf64] - and $3 + maskbits NUM_STAT_PAGES +- 1 dec a ld hl, .Jumptable rst JumpTable ret .Jumptable: ; 4e00d (13:600d) +; entries correspond to *_PAGE constants dw .PinkPage dw .GreenPage dw .BluePage @@ -1089,13 +1096,13 @@ StatsScreen_LoadPageIndicators: ; 4e4cd (13:64cd) ld a, $36 call .load_square ld a, c - cp $2 + cp GREEN_PAGE ld a, $3a - hlcoord 13, 5 + hlcoord 13, 5 ; PINK_PAGE (< GREEN_PAGE) jr c, .load_square - hlcoord 15, 5 + hlcoord 15, 5 ; GREEN_PAGE (= GREEN_PAGE) jr z, .load_square - hlcoord 17, 5 + hlcoord 17, 5 ; BLUE_PAGE (> GREEN_PAGE) .load_square ; 4e4f7 (13:64f7) push bc ld [hli], a diff --git a/engine/time.asm b/engine/time.asm index 799a24f49..03687eee9 100755 --- a/engine/time.asm +++ b/engine/time.asm @@ -133,16 +133,16 @@ endr Special_SampleKenjiBreakCountdown: ; 11485 ; Generate a random number between 3 and 6 call Random - and 3 + and %11 add 3 ld [wKenjiBreakTimer], a ret ; 11490 StartBugContestTimer: ; 11490 - ld a, 20 + ld a, BUG_CONTEST_MINUTES ld [wBugContestMinsRemaining], a - ld a, 0 + ld a, BUG_CONTEST_SECONDS ld [wBugContestSecsRemaining], a call UpdateTime ld hl, wBugContestStartTime @@ -252,7 +252,7 @@ RestartLuckyNumberCountdown: ; 1152b ld a, FRIDAY sub c jr z, .friday_saturday - jr nc, .earlier ; should've done "ret nc" + jr nc, .earlier ; could have done "ret nc" .friday_saturday add 7 diff --git a/engine/trade_animation.asm b/engine/trade_animation.asm index d5b97d563..f5bd375d1 100755 --- a/engine/trade_animation.asm +++ b/engine/trade_animation.asm @@ -1,3 +1,14 @@ +TRADEANIM_RIGHT_ARROW EQU $ed +TRADEANIM_LEFT_ARROW EQU $ee + +; TradeAnim_TubeAnimJumptable.Jumptable indexes + const_def + const TRADEANIMSTATE_0 ; 0 + const TRADEANIMSTATE_1 ; 1 + const TRADEANIMSTATE_2 ; 2 + const TRADEANIMSTATE_3 ; 3 +TRADEANIMJUMPTABLE_LENGTH EQU const_value + TradeAnimation: ; 28f24 xor a ld [wcf66], a @@ -165,13 +176,13 @@ RunTradeAnimScript: ; 28fa1 ld de, vTiles2 tile $31 call Decompress ld hl, TradeArrowGFX - ld de, vTiles1 tile $6d - ld bc, $10 + ld de, vTiles0 tile TRADEANIM_RIGHT_ARROW + ld bc, 1 tiles ld a, BANK(TradeArrowGFX) call FarCopyBytes - ld hl, TradeArrowGFX + $10 - ld de, vTiles1 tile $6e - ld bc, $10 + ld hl, TradeArrowGFX + 1 tiles + ld de, vTiles0 tile TRADEANIM_LEFT_ARROW + ld bc, 1 tiles ld a, BANK(TradeArrowGFX) call FarCopyBytes xor a @@ -317,7 +328,7 @@ TradeAnim_End: ; 29123 ; 29129 TradeAnim_TubeToOT1: ; 29129 - ld a, $ed ; >>>>>>>> + ld a, TRADEANIM_RIGHT_ARROW call TradeAnim_PlaceTrademonStatsOnTubeAnim ld a, [wLinkTradeSendmonSpecies] ld [wd265], a @@ -327,11 +338,11 @@ TradeAnim_TubeToOT1: ; 29129 jr TradeAnim_InitTubeAnim TradeAnim_TubeToPlayer1: ; 2913c - ld a, $ee ; <<<<<<<< + ld a, TRADEANIM_LEFT_ARROW call TradeAnim_PlaceTrademonStatsOnTubeAnim ld a, [wLinkTradeGetmonSpecies] ld [wd265], a - ld a, $2 + ld a, TRADEANIMSTATE_2 depixel 9, 18, 4, 4 ld b, $4 TradeAnim_InitTubeAnim: ; 2914e @@ -400,7 +411,7 @@ TradeAnim_TubeToOT2: ; 291af ld [hSCX], a cp $50 ret nz - ld a, $1 + ld a, TRADEANIMSTATE_1 call TradeAnim_TubeAnimJumptable call TradeAnim_IncrementJumptableIndex ret @@ -414,7 +425,7 @@ TradeAnim_TubeToOT3: ; 291c4 ld [hSCX], a cp $a0 ret nz - ld a, $2 + ld a, TRADEANIMSTATE_2 call TradeAnim_TubeAnimJumptable call TradeAnim_IncrementJumptableIndex ret @@ -440,7 +451,7 @@ TradeAnim_TubeToPlayer3: ; 291e8 ld [hSCX], a cp $b0 ret nz - ld a, $1 + ld a, TRADEANIMSTATE_1 call TradeAnim_TubeAnimJumptable call TradeAnim_IncrementJumptableIndex ret @@ -454,7 +465,7 @@ TradeAnim_TubeToPlayer4: ; 291fd ld [hSCX], a cp $60 ret nz - xor a + xor a ; TRADEANIMSTATE_0 call TradeAnim_TubeAnimJumptable call TradeAnim_IncrementJumptableIndex ret @@ -541,7 +552,7 @@ TradeAnim_GetTrademonSFX: ; 29277 ; 29281 TradeAnim_TubeAnimJumptable: ; 29281 - and 3 + maskbits TRADEANIMJUMPTABLE_LENGTH +- 1 ld e, a ld d, 0 ld hl, .Jumptable @@ -554,6 +565,7 @@ TradeAnim_TubeAnimJumptable: ; 29281 ; 2928f .Jumptable: ; 2928f +; entries correspond to TRADEANIMSTATE_* constants dw .Zero dw .One dw .Two diff --git a/engine/wildmons.asm b/engine/wildmons.asm index dc62093b8..33e66ce07 100755 --- a/engine/wildmons.asm +++ b/engine/wildmons.asm @@ -678,9 +678,9 @@ UpdateRoamMons: ; 2a30d ld l, e ; Choose which map to warp to. call Random - and $1f ; 1/8n chance it moves to a completely random map, where n is the number of roaming connections from the current map. + and %00011111 ; 1/8n chance it moves to a completely random map, where n is the number of roaming connections from the current map. jr z, JumpRoamMon - and 3 + and %11 cp [hl] jr nc, .update_loop ; invalid index, try again inc hl @@ -739,10 +739,10 @@ JumpRoamMons: ; 2a394 JumpRoamMon: ; 2a3cd .loop ld hl, RoamMaps -.innerloop1 ; This loop is completely unnecessary. - call Random ; Choose a random number - and $f ; Take the lower nybble only. This gives a number between 0 and 15. - cp $10 ; If the number is greater than or equal to 16, loop back and try again. +.innerloop1 ; This loop is completely unnecessary. + call Random ; Choose a random number. + maskbits $10 - 1 ; Mask the number to limit it between 0 and 15. + cp $10 ; If the number is not less than 16, try again. jr nc, .innerloop1 ; I'm sure you can guess why this check is bogus. inc a ld b, a @@ -825,7 +825,7 @@ RandomUnseenWildMon: ; 2a4ab call AddNTimes .randloop1 call Random - and $3 + and %11 jr z, .randloop1 dec a ld c, a @@ -902,7 +902,7 @@ RandomPhoneWildMon: ; 2a51f .done call Random - and $3 + and %11 ld c, a ld b, $0 add hl, bc -- cgit v1.2.3 From fd0a78d708f6e4e9f6489f951f07e3e9478d773d Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 11 Jan 2018 14:43:18 -0500 Subject: Trainer card has state constants and WRAM labels --- engine/trainer_card.asm | 117 ++++++++++++++++++++++++++---------------------- 1 file changed, 64 insertions(+), 53 deletions(-) (limited to 'engine') diff --git a/engine/trainer_card.asm b/engine/trainer_card.asm index 990158a41..82c6bd199 100755 --- a/engine/trainer_card.asm +++ b/engine/trainer_card.asm @@ -1,3 +1,13 @@ +; TrainerCard.Jumptable indexes + const_def + const TRAINERCARDSTATE_PAGE1_LOADGFX ; 0 + const TRAINERCARDSTATE_PAGE1_JOYPAD ; 1 + const TRAINERCARDSTATE_PAGE2_LOADGFX ; 2 + const TRAINERCARDSTATE_PAGE2_JOYPAD ; 3 + const TRAINERCARDSTATE_PAGE3_LOADGFX ; 4 + const TRAINERCARDSTATE_PAGE3_JOYPAD ; 5 + const TRAINERCARDSTATE_QUIT ; 6 + TrainerCard: ; 25105 ld a, [VramState] push af @@ -6,7 +16,7 @@ TrainerCard: ; 25105 ld hl, Options ld a, [hl] push af - set 4, [hl] + set NO_TEXT_SCROLL, [hl] call .InitRAM .loop call UpdateTime @@ -61,17 +71,18 @@ TrainerCard: ; 25105 call SetPalettes call WaitBGMap ld hl, wJumptableIndex - xor a - ld [hli], a - ld [hli], a - ld [hli], a - ld [hl], a + xor a ; TRAINERCARDSTATE_PAGE1_LOADGFX + ld [hli], a ; wJumptableIndex + ld [hli], a ; wTrainerCardBadgeFrameCounter + ld [hli], a ; wTrainerCardBadgeTileID + ld [hl], a ; wTrainerCardBadgeAttributes ret .RunJumptable: ; 2518e (9:518e) jumptable .Jumptable, wJumptableIndex .Jumptable: ; 2519d (9:519d) +; entries correspond to TRAINERCARDSTATE_* constants dw TrainerCard_Page1_LoadGFX dw TrainerCard_Page1_Joypad dw TrainerCard_Page2_LoadGFX @@ -113,7 +124,7 @@ TrainerCard_Page1_Joypad: ; 251d7 (9:51d7) ret .pressed_right_a - ld a, $2 + ld a, TRAINERCARDSTATE_PAGE2_LOADGFX ld [wJumptableIndex], a ret @@ -122,7 +133,7 @@ TrainerCard_Page1_Joypad: ; 251d7 (9:51d7) ld a, [wKantoBadges] and a ret z - ld a, $4 + ld a, TRAINERCARDSTATE_PAGE3_LOADGFX ld [wJumptableIndex], a ret @@ -159,7 +170,7 @@ TrainerCard_Page2_Joypad: ; 25221 (9:5221) ret .d_left - ld a, $0 + ld a, TRAINERCARDSTATE_PAGE1_LOADGFX ld [wJumptableIndex], a ret @@ -168,12 +179,12 @@ TrainerCard_Page2_Joypad: ; 25221 (9:5221) ld a, [wKantoBadges] and a ret z - ld a, $4 + ld a, TRAINERCARDSTATE_PAGE3_LOADGFX ld [wJumptableIndex], a ret .Quit: - ld a, $6 + ld a, TRAINERCARDSTATE_QUIT ld [wJumptableIndex], a ret @@ -208,12 +219,12 @@ TrainerCard_Page3_Joypad: ; 25279 (9:5279) ret .left - ld a, $2 + ld a, TRAINERCARDSTATE_PAGE2_LOADGFX ld [wJumptableIndex], a ret .right - ld a, $0 + ld a, TRAINERCARDSTATE_PAGE1_LOADGFX ld [wJumptableIndex], a ret @@ -256,10 +267,10 @@ TrainerCard_PrintTopHalfOfCard: ; 25299 (9:5299) next "MONEY@" .ID_No: ; 252f9 - db $27, $28, $ff ; ID NO + db $27, $28, -1 ; ID NO .HorizontalDivider: ; 252fc - db $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $26, $ff ; ____________> + db $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $26, -1 ; ____________> ; 2530a TrainerCard_Page1_PrintDexCaught_GameTime: ; 2530a (9:530a) @@ -281,7 +292,7 @@ TrainerCard_Page1_PrintDexCaught_GameTime: ; 2530a (9:530a) ld de, .StatusTilemap call TrainerCardSetup_PlaceTilemapString ld a, [wStatusFlags] - bit 0, a + bit 0, a ; ENGINE_POKEDEX ret nz hlcoord 1, 9 lb bc, 2, 17 @@ -296,7 +307,7 @@ TrainerCard_Page1_PrintDexCaught_GameTime: ; 2530a (9:530a) db " BADGES▶@" .StatusTilemap: ; 25366 - db $29, $2a, $2b, $2c, $2d, $ff + db $29, $2a, $2b, $2c, $2d, -1 ; 2536c TrainerCard_Page2_3_InitObjectsAndStrings: ; 2536c (9:536c) @@ -324,7 +335,7 @@ endr dec c jr nz, .loop2 xor a - ld [wcf64], a + ld [wTrainerCardBadgeFrameCounter], a ld hl, TrainerCard_JohtoBadgesOAM call TrainerCard_Page2_3_OAMUpdate ret @@ -332,20 +343,20 @@ endr ; 253a2 (9:53a2) .BadgesTilemap: ; 253a2 - db $79, $7a, $7b, $7c, $7d, $ff ; "BADGES" + db $79, $7a, $7b, $7c, $7d, -1 ; "BADGES" ; 253a8 TrainerCardSetup_PlaceTilemapString: ; 253a8 (9:53a8) .loop ld a, [de] - cp $ff + cp -1 ret z ld [hli], a inc de jr .loop TrainerCard_InitBorder: ; 253b0 (9:53b0) - ld e, 20 + ld e, SCREEN_WIDTH .loop1 ld a, $23 ld [hli], a @@ -354,7 +365,7 @@ TrainerCard_InitBorder: ; 253b0 (9:53b0) ld a, $23 ld [hli], a - ld e, 17 + ld e, SCREEN_HEIGHT - 1 ld a, " " .loop2 ld [hli], a @@ -369,7 +380,7 @@ TrainerCard_InitBorder: ; 253b0 (9:53b0) ld a, $23 ld [hli], a - ld e, 18 + ld e, SCREEN_HEIGHT ld a, " " .loop4 ld [hli], a @@ -386,7 +397,7 @@ TrainerCard_InitBorder: ; 253b0 (9:53b0) ld a, $24 ld [hli], a - ld e, 17 + ld e, SCREEN_HEIGHT - 1 ld a, " " .loop5 ld [hli], a @@ -394,7 +405,7 @@ TrainerCard_InitBorder: ; 253b0 (9:53b0) jr nz, .loop5 ld a, $23 ld [hli], a - ld e, 20 + ld e, SCREEN_WIDTH .loop6 ld a, $23 ld [hli], a @@ -453,12 +464,12 @@ TrainerCard_Page1_PrintGameTime: ; 25415 (9:5415) TrainerCard_Page2_3_AnimateBadges: ; 25438 (9:5438) ld a, [hVBlankCounter] - and $7 + and %111 ret nz - ld a, [wcf64] + ld a, [wTrainerCardBadgeFrameCounter] inc a - and $7 - ld [wcf64], a + and %111 + ld [wTrainerCardBadgeFrameCounter], a jr TrainerCard_Page2_3_OAMUpdate TrainerCard_Page2_3_OAMUpdate: ; 25448 (9:5448) @@ -482,15 +493,15 @@ TrainerCard_Page2_3_OAMUpdate: ; 25448 (9:5448) ld a, [hli] ; x ld c, a ld a, [hli] ; pal - ld [wcf66], a - ld a, [wcf64] + ld [wTrainerCardBadgeAttributes], a + ld a, [wTrainerCardBadgeFrameCounter] add l ld l, a ld a, 0 adc h ld h, a ld a, [hl] - ld [wcf65], a + ld [wTrainerCardBadgeTileID], a call .PrepOAM pop hl .skip_badge @@ -502,8 +513,8 @@ TrainerCard_Page2_3_OAMUpdate: ; 25448 (9:5448) ret .PrepOAM: ; 2547b (9:547b) - ld a, [wcf65] - and $80 + ld a, [wTrainerCardBadgeTileID] + and 1 << 7 jr nz, .xflip ld hl, .facing1 jr .loop2 @@ -523,14 +534,14 @@ TrainerCard_Page2_3_OAMUpdate: ; 25448 (9:5448) ld [de], a ; x inc de - ld a, [wcf65] - and $7f + ld a, [wTrainerCardBadgeTileID] + and $ff ^ (1 << 7) add [hl] ld [de], a ; tile id inc hl inc de - ld a, [wcf66] + ld a, [wTrainerCardBadgeAttributes] add [hl] ld [de], a ; attributes inc hl @@ -564,44 +575,44 @@ TrainerCard_JohtoBadgesOAM: ; 254c9 ; Zephyrbadge db $68, $18, 0 - db $00, $20, $24, $20 | $80 - db $00, $20, $24, $20 | $80 + db $00, $20, $24, $20 | (1 << 7) + db $00, $20, $24, $20 | (1 << 7) ; Hivebadge db $68, $38, 0 - db $04, $20, $24, $20 | $80 - db $04, $20, $24, $20 | $80 + db $04, $20, $24, $20 | (1 << 7) + db $04, $20, $24, $20 | (1 << 7) ; Plainbadge db $68, $58, 0 - db $08, $20, $24, $20 | $80 - db $08, $20, $24, $20 | $80 + db $08, $20, $24, $20 | (1 << 7) + db $08, $20, $24, $20 | (1 << 7) ; Fogbadge db $68, $78, 0 - db $0c, $20, $24, $20 | $80 - db $0c, $20, $24, $20 | $80 + db $0c, $20, $24, $20 | (1 << 7) + db $0c, $20, $24, $20 | (1 << 7) ; Mineralbadge db $80, $38, 0 - db $10, $20, $24, $20 | $80 - db $10, $20, $24, $20 | $80 + db $10, $20, $24, $20 | (1 << 7) + db $10, $20, $24, $20 | (1 << 7) ; Stormbadge db $80, $18, 0 - db $14, $20, $24, $20 | $80 - db $14, $20, $24, $20 | $80 + db $14, $20, $24, $20 | (1 << 7) + db $14, $20, $24, $20 | (1 << 7) ; Glacierbadge db $80, $58, 0 - db $18, $20, $24, $20 | $80 - db $18, $20, $24, $20 | $80 + db $18, $20, $24, $20 | (1 << 7) + db $18, $20, $24, $20 | (1 << 7) ; Risingbadge ; X-flips on alternate cycles. db $80, $78, 0 - db $1c, $20, $24, $20 | $80 - db $1c | $80, $20, $24, $20 | $80 + db $1c, $20, $24, $20 | (1 << 7) + db $1c | (1 << 7), $20, $24, $20 | (1 << 7) ; 25523 CardStatusGFX: INCBIN "gfx/trainer_card/card_status.2bpp" -- cgit v1.2.3 From 17f34cb29c1aeb1bb623e587e3e4cf1f1fc295fb Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 11 Jan 2018 15:36:11 -0500 Subject: Disambiguate some uses of wcf64/5/6 --- engine/breeding.asm | 6 ++--- engine/crystal_intro.asm | 54 ++++++++++++++++++++--------------------- engine/events/celebi.asm | 4 +-- engine/events/field_moves.asm | 18 +++++++------- engine/events/halloffame.asm | 12 ++++----- engine/events/magnet_train.asm | 30 +++++++++++------------ engine/events/mom.asm | 4 +-- engine/events/pokecenter_pc.asm | 2 +- engine/mart.asm | 2 +- engine/namingscreen.asm | 8 +++--- engine/pack.asm | 43 ++++++++++++++++---------------- engine/pokedex.asm | 34 +++++++++++++------------- engine/pokegear.asm | 24 +++++++++--------- engine/start_menu.asm | 2 +- engine/trade_animation.asm | 30 +++++++++++------------ 15 files changed, 137 insertions(+), 136 deletions(-) (limited to 'engine') diff --git a/engine/breeding.asm b/engine/breeding.asm index 6674f288d..df8b36e6a 100755 --- a/engine/breeding.asm +++ b/engine/breeding.asm @@ -726,11 +726,11 @@ EggHatch_AnimationSequence: ; 1728f (5:728f) ld c, 80 call DelayFrames xor a - ld [wcf64], a + ld [wFrameCounter], a ld a, [hSCX] ld b, a .outerloop - ld hl, wcf64 + ld hl, wFrameCounter ld a, [hl] inc [hl] cp 8 @@ -791,7 +791,7 @@ Hatch_LoadFrontpicPal: ; 17363 (5:7363) jp GetSGBLayout EggHatch_CrackShell: ; 1736d (5:736d) - ld a, [wcf64] + ld a, [wFrameCounter] dec a and $7 cp $7 diff --git a/engine/crystal_intro.asm b/engine/crystal_intro.asm index 0d86533c1..7ce19004a 100755 --- a/engine/crystal_intro.asm +++ b/engine/crystal_intro.asm @@ -94,7 +94,7 @@ Copyright_GFPresents: ; e4579 xor a ld [wJumptableIndex], a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a ld [hSCX], a ld [hSCY], a ld a, $1 @@ -146,7 +146,7 @@ PlaceGameFreakPresents_0: ; e468c ; e468d PlaceGameFreakPresents_1: ; e468d - ld hl, wcf65 + ld hl, wIntroSceneTimer ld a, [hl] cp $20 jr nc, .PlaceGameFreak @@ -173,7 +173,7 @@ PlaceGameFreakPresents_1: ; e468d ; e46ba PlaceGameFreakPresents_2: ; e46ba - ld hl, wcf65 + ld hl, wIntroSceneTimer ld a, [hl] cp $40 jr nc, .place_presents @@ -197,7 +197,7 @@ PlaceGameFreakPresents_2: ; e46ba ; e46dd PlaceGameFreakPresents_3: ; e46dd - ld hl, wcf65 + ld hl, wIntroSceneTimer ld a, [hl] cp $80 jr nc, .finish @@ -503,7 +503,7 @@ IntroScene1: ; e495b (39:495b) call Intro_SetCGBPalUpdate xor a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret @@ -523,7 +523,7 @@ IntroScene2: ; e49d6 (39:49d6) call PlaySFX pop af .DontPlaySound: - ld [wcf65], a + ld [wIntroSceneTimer], a xor a call CrystalIntro_UnownFade ret @@ -642,7 +642,7 @@ IntroScene5: ; e4a7a (39:4a7a) call Intro_SetCGBPalUpdate xor a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret @@ -669,7 +669,7 @@ IntroScene6: ; e4af7 (39:4af7) call PlaySFX pop af .NoUnown: - ld [wcf65], a + ld [wIntroSceneTimer], a xor a call CrystalIntro_UnownFade ret @@ -682,7 +682,7 @@ IntroScene6: ; e4af7 (39:4af7) call PlaySFX pop af .StopUnown: - ld [wcf65], a + ld [wIntroSceneTimer], a ld a, $1 call CrystalIntro_UnownFade ret @@ -758,7 +758,7 @@ IntroScene7: ; e4b3f (39:4b3f) call Intro_SetCGBPalUpdate xor a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret @@ -907,7 +907,7 @@ IntroScene11: ; e4c86 (39:4c86) call Intro_SetCGBPalUpdate xor a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret @@ -925,7 +925,7 @@ IntroScene12: ; e4cfa (39:4cfa) ld c, a and $1f sla a - ld [wcf65], a + ld [wIntroSceneTimer], a ld a, c and $e0 srl a @@ -939,7 +939,7 @@ IntroScene12: ; e4cfa (39:4cfa) and $f sla a sla a - ld [wcf65], a + ld [wIntroSceneTimer], a ld a, c and $70 or $40 @@ -1041,7 +1041,7 @@ IntroScene13: ; e4d6d (39:4d6d) call Intro_SetCGBPalUpdate xor a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret @@ -1068,7 +1068,7 @@ IntroScene14: ; e4dfa (39:4dfa) .asm_e4e1a ld a, $1 - ld [wcf65], a + ld [wIntroSceneTimer], a ld a, [wGlobalAnimXOffset] cp $88 jr c, .asm_e4e2c @@ -1150,7 +1150,7 @@ IntroScene15: ; e4e40 (39:4e40) call _InitSpriteAnimStruct xor a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret @@ -1217,7 +1217,7 @@ IntroScene17: ; e4ef5 (39:4ef5) call Intro_SetCGBPalUpdate xor a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret @@ -1299,7 +1299,7 @@ IntroScene19: ; e4f7e (39:4f7e) call _InitSpriteAnimStruct xor a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret @@ -1331,7 +1331,7 @@ IntroScene20: ; e5019 (39:5019) and $1c srl a srl a - ld [wcf65], a + ld [wIntroSceneTimer], a xor a call Intro_Scene20_AppearUnown ret @@ -1341,7 +1341,7 @@ IntroScene20: ; e5019 (39:5019) and $1c srl a srl a - ld [wcf65], a + ld [wIntroSceneTimer], a ld a, 1 call Intro_Scene20_AppearUnown ret @@ -1358,7 +1358,7 @@ IntroScene21: ; e505d (39:505d) xor a ld [hBGMapMode], a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret @@ -1461,13 +1461,13 @@ IntroScene26: ; e50bb (39:50bb) call Intro_SetCGBPalUpdate xor a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret IntroScene27: ; e512d (39:512d) ; Spell out C R Y S T A L with Unown. - ld hl, wcf65 + ld hl, wIntroSceneTimer inc [hl] ld hl, wIntroSceneFrameCounter ld a, [hl] @@ -1477,7 +1477,7 @@ IntroScene27: ; e512d (39:512d) ld c, a and $f - ld [wcf65], a + ld [wIntroSceneTimer], a ld a, c and $70 swap a @@ -1603,7 +1603,7 @@ CrystalIntro_UnownFade: ; e5223 (39:5223) add hl, de inc hl inc hl - ld a, [wcf65] + ld a, [wIntroSceneTimer] and %111111 cp %011111 jr z, .okay @@ -1714,7 +1714,7 @@ Intro_Scene20_AppearUnown: ; e5348 (39:5348) ld hl, .pal2 .got_pointer - ld a, [wcf65] + ld a, [wIntroSceneTimer] and $7 add a add a @@ -1784,7 +1784,7 @@ Intro_FadeUnownWordPals: ; e539d (39:539d) rept 4 inc hl endr - ld a, [wcf65] + ld a, [wIntroSceneTimer] add a ld c, a ld b, $0 diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm index e4ed0df57..e61bdec8f 100755 --- a/engine/events/celebi.asm +++ b/engine/events/celebi.asm @@ -19,7 +19,7 @@ Special_CelebiShrineEvent: ; 4989a ld a, $80 ld [hl], a ld a, 160 ; frame count - ld [wcf64], a + ld [wFrameCounter], a ld d, $0 .loop ld a, [wJumptableIndex] @@ -86,7 +86,7 @@ LoadCelebiGFX: ; 49912 ; 49935 CelebiEvent_CountDown: ; 49935 - ld hl, wcf64 + ld hl, wFrameCounter ld a, [hl] and a jr z, .done diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm index 7f28bca56..efa1403be 100755 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -39,13 +39,13 @@ ShakeHeadbuttTree: ; 8c80a ld [wCurrSpriteOAMAddr], a farcall DoNextFrameForAllSprites call HideHeadbuttTree - ld a, $20 - ld [wcf64], a + ld a, 32 + ld [wFrameCounter], a call WaitSFX ld de, SFX_SANDSTORM call PlaySFX .loop - ld hl, wcf64 + ld hl, wFrameCounter ld a, [hl] and a jr z, .done @@ -188,7 +188,7 @@ Cut_SpawnAnimateTree: ; 8ca23 (23:4a23) add hl, bc ld [hl], $84 ld a, 32 - ld [wcf64], a + ld [wFrameCounter], a ; Cut_StartWaiting ld hl, wJumptableIndex inc [hl] @@ -206,7 +206,7 @@ Cut_SpawnAnimateLeaves: ; 8ca3c (23:4a3c) ld a, $30 call Cut_SpawnLeaf ld a, 32 ; frames - ld [wcf64], a + ld [wFrameCounter], a ; Cut_StartWaiting ld hl, wJumptableIndex inc [hl] @@ -220,7 +220,7 @@ Cut_StartWaiting: ; 8ca5c (23:4a5c) inc [hl] Cut_WaitAnimSFX: ; 8ca64 (23:4a64) - ld hl, wcf64 + ld hl, wFrameCounter ld a, [hl] and a jr z, .finished @@ -336,7 +336,7 @@ FlyFromAnim: ; 8caed add hl, bc ld [hl], SPRITE_ANIM_SEQ_FLY_FROM ld a, 128 - ld [wcf64], a + ld [wFrameCounter], a .loop ld a, [wJumptableIndex] bit 7, a @@ -374,7 +374,7 @@ FlyToAnim: ; 8cb33 add hl, bc ld [hl], 11 * 8 ld a, 64 - ld [wcf64], a + ld [wFrameCounter], a .loop ld a, [wJumptableIndex] bit 7, a @@ -431,7 +431,7 @@ FlyFunction_InitGFX: ; 8cb9b (23:4b9b) FlyFunction_FrameTimer: ; 8cbc8 (23:4bc8) call .SpawnLeaf - ld hl, wcf64 + ld hl, wFrameCounter ld a, [hl] and a jr z, .exit diff --git a/engine/events/halloffame.asm b/engine/events/halloffame.asm index f1981c2fd..768ea9e58 100755 --- a/engine/events/halloffame.asm +++ b/engine/events/halloffame.asm @@ -92,9 +92,9 @@ AnimateHallOfFame: ; 864c3 ld de, MUSIC_HALL_OF_FAME call HallOfFame_PlayMusicDE xor a - ld [wcf64], a + ld [wHallOfFameMonCounter], a .loop - ld a, [wcf64] + ld a, [wHallOfFameMonCounter] cp PARTY_LENGTH jr nc, .done ld hl, wHallOfFameTempMon1 @@ -108,7 +108,7 @@ AnimateHallOfFame: ; 864c3 pop hl call .DisplayNewHallOfFamer jr c, .done - ld hl, wcf64 + ld hl, wHallOfFameMonCounter inc [hl] jr .loop @@ -321,7 +321,7 @@ _HallOfFamePC: ; 86650 .DisplayTeam: xor a - ld [wcf64], a + ld [wHallOfFameMonCounter], a .next call .DisplayMonAndStrings jr c, .start_button @@ -341,7 +341,7 @@ _HallOfFamePC: ; 86650 jr .loop .a_button - ld hl, wcf64 + ld hl, wHallOfFameMonCounter inc [hl] jr .next @@ -356,7 +356,7 @@ _HallOfFamePC: ; 86650 .DisplayMonAndStrings: ; Print the number of times the player has entered the Hall of Fame. ; If that number is above 200, print "HOF Master!" instead. - ld a, [wcf64] + ld a, [wHallOfFameMonCounter] cp PARTY_LENGTH jr nc, .fail ld hl, wHallOfFameTempMon1 diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm index fb05ff7f6..fd936f902 100755 --- a/engine/events/magnet_train.asm +++ b/engine/events/magnet_train.asm @@ -86,20 +86,20 @@ Special_MagnetTrain: ; 8cc04 MagnetTrain_UpdateLYOverrides: ; 8cc99 ld hl, LYOverridesBackup ld c, $2f - ld a, [wcf64] + ld a, [wMagnetTrainOffset] add a ld [hSCX], a call .loadloop ld c, $30 - ld a, [wcf65] + ld a, [wMagnetTrainPosition] call .loadloop ld c, $31 - ld a, [wcf64] + ld a, [wMagnetTrainOffset] add a call .loadloop ld a, [wMagnetTrainDirection] ld d, a - ld hl, wcf64 + ld hl, wMagnetTrainOffset ld a, [hl] add d add d @@ -147,11 +147,11 @@ MagntTrain_LoadGFX_PlayMusic: ; 8ccc9 call MagnetTrain_InitLYOverrides ld hl, wJumptableIndex xor a - ld [hli], a + ld [hli], a ; wJumptableIndex ld a, [wMagnetTrainInitPosition] - ld [hli], a - ld [hli], a - ld [hli], a + ld [hli], a ; wMagnetTrainOffset + ld [hli], a ; wMagnetTrainPosition + ld [hli], a ; wMagnetTrainWaitCounter ld de, MUSIC_MAGNET_TRAIN call PlayMusic2 ret @@ -341,13 +341,13 @@ MagnetTrain_Jumptable: ; 8cdf7 ld [hl], $0 call .Next ld a, $80 - ld [wcf66], a + ld [wMagnetTrainWaitCounter], a ret ; 8ce47 .MoveTrain1: ; 8ce47 ld hl, wMagnetTrainHoldPosition - ld a, [wcf65] + ld a, [wMagnetTrainPosition] cp [hl] jr z, .PrepareToHoldTrain ld e, a @@ -355,7 +355,7 @@ MagnetTrain_Jumptable: ; 8cdf7 xor $ff inc a add e - ld [wcf65], a + ld [wMagnetTrainPosition], a ld hl, wGlobalAnimXOffset ld a, [wMagnetTrainDirection] add [hl] @@ -365,12 +365,12 @@ MagnetTrain_Jumptable: ; 8cdf7 .PrepareToHoldTrain: call .Next ld a, $80 - ld [wcf66], a + ld [wMagnetTrainWaitCounter], a ret ; 8ce6d .WaitScene: ; 8ce6d - ld hl, wcf66 + ld hl, wMagnetTrainWaitCounter ld a, [hl] and a jr z, .DoneWaiting @@ -384,7 +384,7 @@ MagnetTrain_Jumptable: ; 8cdf7 .MoveTrain2: ; 8ce7a ld hl, wMagnetTrainFinalPosition - ld a, [wcf65] + ld a, [wMagnetTrainPosition] cp [hl] jr z, .PrepareToFinishAnim ld e, a @@ -395,7 +395,7 @@ MagnetTrain_Jumptable: ; 8cdf7 ld a, e add d add d - ld [wcf65], a + ld [wMagnetTrainPosition], a ld hl, wGlobalAnimXOffset ld a, [wMagnetTrainDirection] ld d, a diff --git a/engine/events/mom.asm b/engine/events/mom.asm index 6e3c7b320..296f3ad6f 100644 --- a/engine/events/mom.asm +++ b/engine/events/mom.asm @@ -146,7 +146,7 @@ Special_BankOfMom: ; 16218 ld [hli], a ld [hl], a ld a, $5 - ld [wcf64], a + ld [wMomBankDigitCursorPosition], a call LoadStandardMenuDataHeader call Mom_SetUpDepositMenu call Mom_Wait10Frames @@ -213,7 +213,7 @@ Special_BankOfMom: ; 16218 ld [hli], a ld [hl], a ld a, $5 - ld [wcf64], a + ld [wMomBankDigitCursorPosition], a call LoadStandardMenuDataHeader call Mom_SetUpWithdrawMenu call Mom_Wait10Frames diff --git a/engine/events/pokecenter_pc.asm b/engine/events/pokecenter_pc.asm index 7045dc1c8..8d0300aa4 100755 --- a/engine/events/pokecenter_pc.asm +++ b/engine/events/pokecenter_pc.asm @@ -421,7 +421,7 @@ KrisDepositItemMenu: ; 0x1588b farcall DepositSellInitPackBuffers .loop farcall DepositSellPack - ld a, [wcf66] + ld a, [wPackUsedItem] and a jr z, .close call .TryDepositItem diff --git a/engine/mart.asm b/engine/mart.asm index 4a8d9e17b..96423cfec 100755 --- a/engine/mart.asm +++ b/engine/mart.asm @@ -785,7 +785,7 @@ SellMenu: ; 15eb3 farcall DepositSellInitPackBuffers .loop farcall DepositSellPack - ld a, [wcf66] + ld a, [wPackUsedItem] and a jp z, .quit call .TryToSellItem diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index e0de37c5f..c2d7b9c1a 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -490,7 +490,7 @@ NamingScreenJoypadLoop: ; 11915 ret .select - ld hl, wcf64 + ld hl, wNamingScreenLetterCase ld a, [hl] xor 1 ld [hl], a @@ -922,7 +922,7 @@ LoadNamingScreenGFX: ; 11c51 ld [hSCX], a ld [wGlobalAnimXOffset], a ld [wJumptableIndex], a - ld [wcf64], a + ld [wNamingScreenLetterCase], a ld [hBGMapMode], a ld [wNamingScreenCurrNameLength], a ld a, $7 @@ -1218,9 +1218,9 @@ INCBIN "gfx/icons/mail2.2bpp" ret .select - ld hl, wcf64 + ld hl, wNamingScreenLetterCase ld a, [hl] - xor $1 + xor 1 ld [hl], a jr nz, .switch_to_lowercase ld de, MailEntry_Uppercase diff --git a/engine/pack.asm b/engine/pack.asm index ea2a06cb9..323592d39 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -59,7 +59,7 @@ Pack: ; 10000 xor a ld [hBGMapMode], a call Pack_InitGFX - ld a, [wcf64] + ld a, [wPackJumptableIndex] ld [wJumptableIndex], a call Pack_InitColors ret @@ -634,7 +634,7 @@ GiveItem: ; 103fd .give ld a, [wJumptableIndex] push af - ld a, [wcf64] + ld a, [wPackJumptableIndex] push af call GetCurNick ld hl, StringBuffer1 @@ -643,7 +643,7 @@ GiveItem: ; 103fd call CopyBytes call TryGiveItemToPartymon pop af - ld [wcf64], a + ld [wPackJumptableIndex], a pop af ld [wJumptableIndex], a .finish @@ -718,7 +718,7 @@ BattlePack: ; 10493 xor a ld [hBGMapMode], a call Pack_InitGFX - ld a, [wcf64] + ld a, [wPackJumptableIndex] ld [wJumptableIndex], a call Pack_InitColors ret @@ -963,15 +963,16 @@ TMHMSubmenu: ; 105dc (4:45dc) InitPackBuffers: ; 1068a xor a ld [wJumptableIndex], a + ; pocket id -> jumptable index ld a, [wLastPocket] maskbits NUM_POCKETS +- 1 ld [wCurrPocket], a inc a add a dec a - ld [wcf64], a - xor a - ld [wcf66], a + ld [wPackJumptableIndex], a + xor a ; FALSE + ld [wPackUsedItem], a xor a ld [wSwitchItem], a ret @@ -980,10 +981,10 @@ InitPackBuffers: ; 1068a DepositSellInitPackBuffers: ; 106a5 xor a ld [hBGMapMode], a - ld [wJumptableIndex], a - ld [wcf64], a - ld [wCurrPocket], a - ld [wcf66], a + ld [wJumptableIndex], a ; PACKSTATE_INITGFX + ld [wPackJumptableIndex], a ; PACKSTATE_INITGFX + ld [wCurrPocket], a ; ITEM_POCKET + ld [wPackUsedItem], a ld [wSwitchItem], a call Pack_InitGFX call Pack_InitColors @@ -1096,13 +1097,13 @@ DepositSellTutorial_InterpretJoypad: ; 1076f .a_button ld a, TRUE - ld [wcf66], a + ld [wPackUsedItem], a and a ret .b_button - xor a - ld [wcf66], a + xor a ; FALSE + ld [wPackUsedItem], a and a ret @@ -1141,8 +1142,8 @@ TutorialPack: ; 107bb call .RunJumptable call DepositSellTutorial_InterpretJoypad jr c, .loop - xor a - ld [wcf66], a + xor a ; FALSE + ld [wPackUsedItem], a ret ; 107d7 @@ -1269,15 +1270,15 @@ Pack_GetJumptablePointer: ; 1086b Pack_QuitNoScript: ; 10874 (4:4874) ld hl, wJumptableIndex set 7, [hl] - xor a - ld [wcf66], a + xor a ; FALSE + ld [wPackUsedItem], a ret Pack_QuitRunScript: ; 1087e (4:487e) ld hl, wJumptableIndex set 7, [hl] ld a, TRUE - ld [wcf66], a + ld [wPackUsedItem], a ret Pack_PrintTextNoScroll: ; 10889 (4:4889) @@ -1363,7 +1364,7 @@ Pack_InterpretJoypad: ; 108d4 (4:48d4) .d_left ld a, b ld [wJumptableIndex], a - ld [wcf64], a + ld [wPackJumptableIndex], a push de ld de, SFX_SWITCH_POCKETS call PlaySFX @@ -1374,7 +1375,7 @@ Pack_InterpretJoypad: ; 108d4 (4:48d4) .d_right ld a, c ld [wJumptableIndex], a - ld [wcf64], a + ld [wPackJumptableIndex], a push de ld de, SFX_SWITCH_POCKETS call PlaySFX diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 7fe3852ed..69a51c792 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -87,8 +87,8 @@ InitPokedex: ; 40063 xor a ld [wJumptableIndex], a - ld [wDexEntryPrevJumptableIndex], a - ld [wcf65], a + ld [wPrevDexEntryJumptableIndex], a + ld [wPrevDexEntryBackup], a ld [wcf66], a call Pokedex_CheckUnlockedUnownMode @@ -119,7 +119,7 @@ Pokedex_CheckUnlockedUnownMode: ; 400a2 Pokedex_InitCursorPosition: ; 400b4 ld hl, wPokedexOrder - ld a, [wLastDexEntry] + ld a, [wPrevDexEntry] and a jr z, .done cp NUM_POKEMON + 1 @@ -291,7 +291,7 @@ Pokedex_UpdateMainScreen: ; 401ae (10:41ae) ld a, DEXSTATE_DEX_ENTRY_SCR ld [wJumptableIndex], a ld a, DEXSTATE_MAIN_SCR - ld [wDexEntryPrevJumptableIndex], a + ld [wPrevDexEntryJumptableIndex], a ret .select @@ -332,7 +332,7 @@ Pokedex_InitDexEntryScreen: ; 40217 (10:4217) call Pokedex_DrawDexEntryScreenBG call Pokedex_InitArrowCursor call Pokedex_GetSelectedMon - ld [wLastDexEntry], a + ld [wPrevDexEntry], a farcall DisplayDexEntry call Pokedex_DrawFootprint call WaitBGMap @@ -377,7 +377,7 @@ Pokedex_UpdateDexEntryScreen: ; 40258 (10:4258) .max_volume call MaxVolume - ld a, [wDexEntryPrevJumptableIndex] + ld a, [wPrevDexEntryJumptableIndex] ld [wJumptableIndex], a ret @@ -386,7 +386,7 @@ Pokedex_Page: ; 40292 xor $1 ld [wPokedexStatus], a call Pokedex_GetSelectedMon - ld [wLastDexEntry], a + ld [wPrevDexEntry], a farcall DisplayDexEntry call WaitBGMap ret @@ -402,7 +402,7 @@ Pokedex_ReinitDexEntryScreen: ; 402aa (10:42aa) call Pokedex_InitArrowCursor call Pokedex_LoadCurrentFootprint call Pokedex_GetSelectedMon - ld [wLastDexEntry], a + ld [wPrevDexEntry], a farcall DisplayDexEntry call Pokedex_DrawFootprint call Pokedex_LoadSelectedMonTiles @@ -475,9 +475,9 @@ DexEntryScreen_MenuActionJumptable: ; 402f2 call Pokedex_ApplyPrintPals xor a ld [hSCX], a - ld a, [wcf65] + ld a, [wPrevDexEntryBackup] push af - ld a, [wDexEntryPrevJumptableIndex] + ld a, [wPrevDexEntryJumptableIndex] push af ld a, [wJumptableIndex] push af @@ -485,9 +485,9 @@ DexEntryScreen_MenuActionJumptable: ; 402f2 pop af ld [wJumptableIndex], a pop af - ld [wDexEntryPrevJumptableIndex], a + ld [wPrevDexEntryJumptableIndex], a pop af - ld [wcf65], a + ld [wPrevDexEntryBackup], a call ClearBGPalettes call DisableLCD call Pokedex_LoadInvertedFont @@ -697,8 +697,8 @@ Pokedex_UpdateSearchScreen: ; 40471 (10:4471) ld [wDexListingScrollOffsetBackup], a ld a, [wDexListingCursor] ld [wDexListingCursorBackup], a - ld a, [wLastDexEntry] - ld [wcf65], a + ld a, [wPrevDexEntry] + ld [wPrevDexEntryBackup], a xor a ld [wDexListingScrollOffset], a ld [wDexListingCursor], a @@ -773,7 +773,7 @@ Pokedex_UpdateSearchResultsScreen: ; 40562 (10:4562) ld a, DEXSTATE_DEX_ENTRY_SCR ld [wJumptableIndex], a ld a, DEXSTATE_SEARCH_RESULTS_SCR - ld [wDexEntryPrevJumptableIndex], a + ld [wPrevDexEntryJumptableIndex], a ret .return_to_search_screen @@ -781,8 +781,8 @@ Pokedex_UpdateSearchResultsScreen: ; 40562 (10:4562) ld [wDexListingScrollOffset], a ld a, [wDexListingCursorBackup] ld [wDexListingCursor], a - ld a, [wcf65] - ld [wLastDexEntry], a + ld a, [wPrevDexEntryBackup] + ld [wPrevDexEntry], a call Pokedex_BlackOutBG call ClearSprites call Pokedex_OrderMonsByMode diff --git a/engine/pokegear.asm b/engine/pokegear.asm index 4141b08fa..ee993749e 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -87,9 +87,9 @@ PokeGear: ; 90b8d (24:4b8d) ld [rLCDC], a call TownMap_InitCursorAndPlayerIconPositions xor a - ld [wJumptableIndex], a - ld [wcf64], a - ld [wcf65], a + ld [wJumptableIndex], a ; POKEGEARSTATE_CLOCKINIT + ld [wPokegearCard], a ; POKEGEARCARD_CLOCK + ld [wPokegearMapRegion], a ; JOHTO_REGION ld [wcf66], a ld [wPokegearPhoneScrollPosition], a ld [wPokegearPhoneCursorPosition], a @@ -173,7 +173,7 @@ InitPokegearModeIndicatorArrow: ; 90d32 (24:4d32) ret AnimatePokegearModeIndicatorArrow: ; 90d41 (24:4d41) - ld hl, wcf64 + ld hl, wPokegearCard ld e, [hl] ld d, 0 ld hl, .XCoords @@ -239,8 +239,8 @@ TownMap_InitCursorAndPlayerIconPositions: ; 90d70 (24:4d70) Pokegear_InitJumptableIndices: ; 90d9e (24:4d9e) ld a, POKEGEARSTATE_CLOCKINIT ld [wJumptableIndex], a - xor a - ld [wcf64], a + xor a ; POKEGEARCARD_CLOCK + ld [wPokegearCard], a ret InitPokegearTilemap: ; 90da8 (24:4da8) @@ -250,7 +250,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8) ld bc, TileMapEnd - TileMap ld a, $4f call ByteFill - ld a, [wcf64] + ld a, [wPokegearCard] maskbits NUM_POKEGEAR_CARDS +- 1 add a ld e, a @@ -267,7 +267,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8) .return_from_jumptable call Pokegear_FinishTilemap farcall TownMapPals - ld a, [wcf65] + ld a, [wPokegearMapRegion] and a jr nz, .kanto_0 xor a ; LOW(vBGMap0) @@ -288,10 +288,10 @@ InitPokegearTilemap: ; 90da8 (24:4da8) .finish ld [hWY], a ; swap region maps - ld a, [wcf65] - and 1 + ld a, [wPokegearMapRegion] + maskbits NUM_REGIONS +- 1 xor 1 - ld [wcf65], a + ld [wPokegearMapRegion], a ret .UpdateBGMap: ; 90e00 (24:4e00) @@ -1361,7 +1361,7 @@ Pokegear_SwitchPage: ; 91480 (24:5480) ld a, c ld [wJumptableIndex], a ld a, b - ld [wcf64], a + ld [wPokegearCard], a call DeleteSpriteAnimStruct2ToEnd ret diff --git a/engine/start_menu.asm b/engine/start_menu.asm index 913bf3780..91d6caff9 100755 --- a/engine/start_menu.asm +++ b/engine/start_menu.asm @@ -503,7 +503,7 @@ StartMenu_Pack: ; 1295b call FadeToMenu farcall Pack - ld a, [wcf66] + ld a, [wPackUsedItem] and a jr nz, .used_item call CloseSubmenu diff --git a/engine/trade_animation.asm b/engine/trade_animation.asm index f5bd375d1..b6711ac61 100755 --- a/engine/trade_animation.asm +++ b/engine/trade_animation.asm @@ -398,8 +398,8 @@ TradeAnim_InitTubeAnim: ; 2914e call DmgToCgbObjPal0 call TradeAnim_IncrementJumptableIndex - ld a, $5c - ld [wcf64], a + ld a, 92 + ld [wFrameCounter], a ret ; 291af @@ -486,8 +486,8 @@ TradeAnim_TubeToPlayer5: ; 29211 TradeAnim_TubeToOT6: TradeAnim_TubeToPlayer6: ; 29220 - ld a, $80 - ld [wcf64], a + ld a, 128 + ld [wFrameCounter], a call TradeAnim_IncrementJumptableIndex ret @@ -522,7 +522,7 @@ TradeAnim_TubeToOT7: TradeAnim_TubeToPlayer2: TradeAnim_TubeToPlayer7: ; 2925d call TradeAnim_FlashBGPals - ld hl, wcf64 + ld hl, wFrameCounter ld a, [hl] and a jr z, .done @@ -1126,8 +1126,8 @@ TradeAnim_RockingBall: ; 2961b ld a, SPRITE_ANIM_INDEX_TRADE_POKE_BALL call _InitSpriteAnimStruct call TradeAnim_AdvanceScriptPointer - ld a, $20 - ld [wcf64], a + ld a, 32 + ld [wFrameCounter], a ret ; 2962c @@ -1143,8 +1143,8 @@ TradeAnim_DropBall: ; 2962c add hl, bc ld [hl], $dc call TradeAnim_AdvanceScriptPointer - ld a, $38 - ld [wcf64], a + ld a, 56 + ld [wFrameCounter], a ret ; 29649 @@ -1154,8 +1154,8 @@ TradeAnim_Poof: ; 29649 ld a, SPRITE_ANIM_INDEX_TRADE_POOF call _InitSpriteAnimStruct call TradeAnim_AdvanceScriptPointer - ld a, $10 - ld [wcf64], a + ld a, 16 + ld [wFrameCounter], a ld de, SFX_BALL_POOF call PlaySFX ret @@ -1169,8 +1169,8 @@ TradeAnim_BulgeThroughTube: ; 29660 ld a, SPRITE_ANIM_INDEX_TRADE_TUBE_BULGE call _InitSpriteAnimStruct call TradeAnim_AdvanceScriptPointer - ld a, $40 - ld [wcf64], a + ld a, 64 + ld [wFrameCounter], a ret ; 29676 @@ -1547,7 +1547,7 @@ LoadTradeBubbleGFX: ; 2985a ; 29879 TradeAnim_WaitAnim: ; 29879 - ld hl, wcf64 + ld hl, wFrameCounter ld a, [hl] and a jr z, .done @@ -1561,7 +1561,7 @@ TradeAnim_WaitAnim: ; 29879 ; 29886 TradeAnim_WaitAnim2: ; 29886 - ld hl, wcf64 + ld hl, wFrameCounter ld a, [hl] and a jr z, .done -- cgit v1.2.3 From 177341425cb959ee75f41e6d43c7e6a47d6aef59 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 11 Jan 2018 21:14:35 -0500 Subject: Use charmap frame characters --- engine/events/battle_tower/battle_tower.asm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'engine') diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm index ca2ddd142..5a132a2cb 100755 --- a/engine/events/battle_tower/battle_tower.asm +++ b/engine/events/battle_tower/battle_tower.asm @@ -750,39 +750,39 @@ Function1704e1: ; 1704e1 .DrawBorder: ; 1705b7 hlcoord 0, 4 - ld a, $79 + ld a, "┌" ld [hli], a ld c, SCREEN_WIDTH - 2 .top_border_loop - ld a, $7a + ld a, "─" ld [hli], a dec c jr nz, .top_border_loop - ld a, $7b + ld a, "┐" ld [hli], a ld de, SCREEN_WIDTH ld c, 12 .left_border_loop - ld a, $7c + ld a, "│" ld [hl], a add hl, de dec c jr nz, .left_border_loop - ld a, $7d + ld a, "└" ld [hli], a ld c, SCREEN_WIDTH - 2 .bottom_border_loop - ld a, $7a + ld a, "─" ld [hli], a dec c jr nz, .bottom_border_loop - ld a, $7e + ld a, "┘" ld [hl], a ld de, -SCREEN_WIDTH add hl, de ld c, 12 .right_border_loop - ld a, $7c + ld a, "│" ld [hl], a add hl, de dec c -- cgit v1.2.3 From 163f3e0c3f56831b5255b31045798ac950098faa Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 11 Jan 2018 22:16:17 -0500 Subject: Local UI tiles don't belong in charmap Separate 1bpp font tiles from gfx/mobile/phone_tiles.png --- engine/namingscreen.asm | 54 +++++++++++++++++++++++++++---------------------- engine/print_party.asm | 13 +++++++----- engine/stats_screen.asm | 28 ++++++++++++------------- engine/timeset.asm | 11 ++++++---- 4 files changed, 59 insertions(+), 47 deletions(-) (limited to 'engine') diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index c2d7b9c1a..7ef5669db 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -1,3 +1,9 @@ +NAMINGSCREEN_CURSOR EQU $7e + +NAMINGSCREEN_BORDER EQUS "\"\"" ; $60 +NAMINGSCREEN_MIDDLELINE EQUS "\"→\"" ; $eb +NAMINGSCREEN_UNDERLINE EQUS "\"\"" ; $f2 + _NamingScreen: ; 0x116b7 call DisableSpriteUpdates call NamingScreen @@ -287,7 +293,7 @@ NamingScreen_InitText: ; 118a8 call WaitTop hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT - ld a, $60 + ld a, NAMINGSCREEN_BORDER call ByteFill hlcoord 1, 1 lb bc, 6, 18 @@ -729,7 +735,7 @@ NamingScreen_AdvanceCursor_CheckEndOfString: ; 11b27 ld a, [hl] cp "@" jr z, .end_of_string - ld [hl], $f2 + ld [hl], NAMINGSCREEN_UNDERLINE and a ret @@ -776,12 +782,12 @@ NamingScreen_DeleteCharacter: ; 11bbc (4:5bbc) ret z dec [hl] call NamingScreen_GetTextCursorPosition - ld [hl], $f2 + ld [hl], NAMINGSCREEN_UNDERLINE inc hl ld a, [hl] - cp $f2 + cp NAMINGSCREEN_UNDERLINE ret nz - ld [hl], $eb + ld [hl], NAMINGSCREEN_MIDDLELINE ret NamingScreen_GetTextCursorPosition: ; 11bd0 (4:5bd0) @@ -800,17 +806,17 @@ NamingScreen_GetTextCursorPosition: ; 11bd0 (4:5bd0) ; 11be0 NamingScreen_InitNameEntry: ; 11be0 -; load $f2, ($eb * [wNamingScreenMaxNameLength]), $50 into the dw address at wNamingScreenDestinationPointer +; load NAMINGSCREEN_UNDERLINE, (NAMINGSCREEN_MIDDLELINE * [wNamingScreenMaxNameLength]), "@" into the dw address at wNamingScreenDestinationPointer ld hl, wNamingScreenDestinationPointer ld a, [hli] ld h, [hl] ld l, a - ld [hl], $f2 + ld [hl], NAMINGSCREEN_UNDERLINE inc hl ld a, [wNamingScreenMaxNameLength] dec a ld c, a - ld a, $eb + ld a, NAMINGSCREEN_MIDDLELINE .loop ld [hli], a dec c @@ -829,9 +835,9 @@ NamingScreen_StoreEntry: ; 11bf7 (4:5bf7) ld c, a .loop ld a, [hl] - cp $eb + cp NAMINGSCREEN_MIDDLELINE jr z, .terminator - cp $f2 + cp NAMINGSCREEN_UNDERLINE jr nz, .not_terminator .terminator ld [hl], "@" @@ -891,22 +897,22 @@ LoadNamingScreenGFX: ; 11c51 call LoadFontsExtra ld de, NamingScreenGFX_MiddleLine - ld hl, vTiles1 tile $6b + ld hl, vTiles0 tile NAMINGSCREEN_MIDDLELINE lb bc, BANK(NamingScreenGFX_MiddleLine), 1 call Get1bpp ld de, NamingScreenGFX_UnderLine - ld hl, vTiles1 tile $72 + ld hl, vTiles0 tile NAMINGSCREEN_UNDERLINE lb bc, BANK(NamingScreenGFX_UnderLine), 1 call Get1bpp - ld de, vTiles2 tile $60 + ld de, vTiles2 tile NAMINGSCREEN_BORDER ld hl, NamingScreenGFX_Border ld bc, 1 tiles ld a, BANK(NamingScreenGFX_Border) call FarCopyBytes - ld de, vTiles0 tile $7e + ld de, vTiles0 tile NAMINGSCREEN_CURSOR ld hl, NamingScreenGFX_Cursor ld bc, 2 tiles ld a, BANK(NamingScreenGFX_Cursor) @@ -915,7 +921,7 @@ LoadNamingScreenGFX: ; 11c51 ld a, $5 ld hl, wSpriteAnimDict + 9 * 2 ld [hli], a - ld [hl], $7e + ld [hl], NAMINGSCREEN_CURSOR xor a ld [hSCY], a ld [wGlobalAnimYOffset], a @@ -1019,9 +1025,9 @@ _ComposeMailMessage: ; 11e75 (mail?) ld e, [hl] inc hl ld d, [hl] - ld hl, $10 + ld hl, MAIL_LINE_LENGTH add hl, de - ld [hl], $4e + ld [hl], "" ret ; 11ef4 (4:5ef4) @@ -1046,7 +1052,7 @@ INCBIN "gfx/icons/mail2.2bpp" call WaitTop hlcoord 0, 0 ld bc, 6 * SCREEN_WIDTH - ld a, $60 ; border + ld a, NAMINGSCREEN_BORDER call ByteFill hlcoord 0, 6 ld bc, 12 * SCREEN_WIDTH @@ -1176,13 +1182,13 @@ INCBIN "gfx/icons/mail2.2bpp" jr c, .start ld hl, wNamingScreenCurrNameLength ld a, [hl] - cp $10 + cp MAIL_LINE_LENGTH ret nz inc [hl] call NamingScreen_GetTextCursorPosition - ld [hl], $f2 + ld [hl], NAMINGSCREEN_UNDERLINE dec hl - ld [hl], $4e + ld [hl], "" ret .start @@ -1202,13 +1208,13 @@ INCBIN "gfx/icons/mail2.2bpp" call NamingScreen_DeleteCharacter ld hl, wNamingScreenCurrNameLength ld a, [hl] - cp $10 + cp MAIL_LINE_LENGTH ret nz dec [hl] call NamingScreen_GetTextCursorPosition - ld [hl], $f2 + ld [hl], NAMINGSCREEN_UNDERLINE inc hl - ld [hl], $4e + ld [hl], "" ret .finished diff --git a/engine/print_party.asm b/engine/print_party.asm index f2420dfe8..ce624b013 100755 --- a/engine/print_party.asm +++ b/engine/print_party.asm @@ -1,3 +1,6 @@ +PRINTPARTY_HP EQUS "\"◀\"" ; $71 +PRINTPARTY_SHINY EQUS "\"\"" ; $3f + PrintPage1: ; 1dc1b0 hlcoord 0, 0 decoord 0, 0, wPrinterTileMapBuffer @@ -141,17 +144,17 @@ PrintPartyMonPage1: ; 1dc381 call LoadFontsBattleExtra ld de, GBPrinterHPIcon - ld hl, vTiles2 tile $71 + ld hl, vTiles2 tile PRINTPARTY_HP lb bc, BANK(GBPrinterHPIcon), 1 call Request1bpp ld de, GBPrinterLvIcon - ld hl, vTiles2 tile $6e + ld hl, vTiles2 tile "" lb bc, BANK(GBPrinterLvIcon), 1 call Request1bpp ld de, ShinyIconGFX - ld hl, vTiles2 tile $3f + ld hl, vTiles2 tile PRINTPARTY_SHINY lb bc, BANK(ShinyIconGFX), 1 call Get2bpp @@ -166,7 +169,7 @@ PrintPartyMonPage1: ; 1dc381 ld a, [TempMonLevel] call PrintLevel_Force3Digits hlcoord 12, 2 - ld [hl], "◀" ; Filled left triangle + ld [hl], PRINTPARTY_HP inc hl ld de, TempMonMaxHP lb bc, 2, 3 @@ -330,7 +333,7 @@ Function1dc52c: ; 1dc52c farcall CheckShininess ret nc hlcoord 18, 2 - ld [hl], "" + ld [hl], PRINTPARTY_SHINY ret ; 1dc550 diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm index 8f16c5d71..fbe562d9c 100755 --- a/engine/stats_screen.asm +++ b/engine/stats_screen.asm @@ -459,7 +459,7 @@ Function4df7f: ; 4df7f ld bc, SCREEN_WIDTH ld d, SCREEN_HEIGHT .loop - ld a, "|" + ld a, $31 ; vertical divider ld [hl], a add hl, bc dec d @@ -470,7 +470,7 @@ Function4df7f: ; 4df7f StatsScreen_PlaceHorizontalDivider: ; 4df8f (13:5f8f) hlcoord 0, 7 ld b, SCREEN_WIDTH - ld a, "_" + ld a, $62 ; horizontal divider (empty HP/exp bar) .loop ld [hli], a dec b @@ -489,7 +489,7 @@ StatsScreen_PlaceShinyIcon: ; 4dfa6 (13:5fa6) farcall CheckShininess ret nc hlcoord 19, 0 - ld [hl], "" + ld [hl], $3f ; shiny icon ret StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) @@ -550,7 +550,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ld b, $0 predef DrawPlayerHP hlcoord 8, 9 - ld [hl], $41 + ld [hl], $41 ; right HP/exp bar end cap ld de, .Status_Type hlcoord 0, 12 call PlaceString @@ -562,7 +562,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) and $f0 jr z, .NotImmuneToPkrs hlcoord 8, 8 - ld [hl], "." + ld [hl], "." ; Pokérus immunity dot .NotImmuneToPkrs: ld a, [MonType] cp BOXMON @@ -588,7 +588,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) hlcoord 9, 8 ld de, SCREEN_WIDTH ld b, 10 - ld a, "|" + ld a, $31 ; vertical divider .vertical_divider ld [hl], a add hl, de @@ -620,9 +620,9 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ld de, TempMonExp + 2 predef FillInExpBar hlcoord 10, 16 - ld [hl], $40 + ld [hl], $40 ; left exp bar end cap hlcoord 19, 16 - ld [hl], $41 + ld [hl], $41 ; right exp bar end cap ret .PrintNextLevel: ; 4e0d3 (13:60d3) @@ -748,7 +748,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) hlcoord 10, 8 ld de, SCREEN_WIDTH ld b, 10 - ld a, "|" + ld a, $31 ; vertical divider .BluePageVerticalDivider: ld [hl], a add hl, de @@ -1087,17 +1087,17 @@ StatsScreen_AnimateEgg: ; 4e497 (13:6497) StatsScreen_LoadPageIndicators: ; 4e4cd (13:64cd) hlcoord 13, 5 - ld a, $36 + ld a, $36 ; first of 4 small square tiles call .load_square hlcoord 15, 5 - ld a, $36 + ld a, $36 ; """ call .load_square hlcoord 17, 5 - ld a, $36 + ld a, $36 ; """ call .load_square ld a, c cp GREEN_PAGE - ld a, $3a + ld a, $3a ; first of 4 large square tiles hlcoord 13, 5 ; PINK_PAGE (< GREEN_PAGE) jr c, .load_square hlcoord 15, 5 ; GREEN_PAGE (= GREEN_PAGE) @@ -1120,7 +1120,7 @@ StatsScreen_LoadPageIndicators: ; 4e4cd (13:64cd) CopyNickname: ; 4e505 (13:6505) ld de, StringBuffer1 ld bc, PKMN_NAME_LENGTH - jr .okay ; uuterly pointless + jr .okay ; utterly pointless .okay ld a, [MonType] cp BOXMON diff --git a/engine/timeset.asm b/engine/timeset.asm index f05e31ab5..b97103ed1 100755 --- a/engine/timeset.asm +++ b/engine/timeset.asm @@ -1,3 +1,6 @@ +TIMESET_UP_ARROW EQUS "\"♂\"" ; $ef +TIMESET_DOWN_ARROW EQUS "\"♀\"" ; $f5 + InitClock: ; 90672 (24:4672) ; Ask the player to set the time. ld a, [hInMenu] @@ -410,11 +413,11 @@ Special_SetDayOfWeek: ; 90913 ld a, $1 ld [hInMenu], a ld de, TimeSetUpArrowGFX - ld hl, vTiles1 tile $6f + ld hl, vTiles0 tile TIMESET_UP_ARROW lb bc, BANK(TimeSetUpArrowGFX), 1 call Request1bpp ld de, TimeSetDownArrowGFX - ld hl, vTiles1 tile $75 + ld hl, vTiles0 tile TIMESET_DOWN_ARROW lb bc, BANK(TimeSetDownArrowGFX), 1 call Request1bpp xor a @@ -431,9 +434,9 @@ Special_SetDayOfWeek: ; 90913 ld c, 9 call TextBox hlcoord 14, 3 - ld [hl], "♂" ; gets overwritten with special up arrow + ld [hl], TIMESET_UP_ARROW hlcoord 14, 6 - ld [hl], "♀" ; gets overwritten with special down arrow + ld [hl], TIMESET_DOWN_ARROW hlcoord 10, 5 call .PlaceWeekdayString call ApplyTilemap -- cgit v1.2.3 From af4001132e3ead7da12faaf6e2a09b548fb98490 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 11 Jan 2018 23:50:44 -0500 Subject: Break up engine/events_3.asm --- engine/card_flip.asm | 248 ++++++------ engine/events.asm | 1 + engine/events/checkforhiddenitems.asm | 85 +++++ engine/events/map_name_sign.asm | 274 ++++++++++++++ engine/events/treemons.asm | 285 ++++++++++++++ engine/events_3.asm | 692 ---------------------------------- engine/title.asm | 2 +- 7 files changed, 770 insertions(+), 817 deletions(-) create mode 100644 engine/events/checkforhiddenitems.asm create mode 100644 engine/events/map_name_sign.asm create mode 100755 engine/events/treemons.asm delete mode 100755 engine/events_3.asm (limited to 'engine') diff --git a/engine/card_flip.asm b/engine/card_flip.asm index 2bb610e95..1940cc850 100755 --- a/engine/card_flip.asm +++ b/engine/card_flip.asm @@ -1472,145 +1472,145 @@ ENDM .SingleTile: ; e0a41 db 6 - dsprite 0, 0, -1, 7, $00, 0 | BEHIND_BG - dsprite 0, 0, 0, 0, $02, 0 | BEHIND_BG - dsprite 0, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 0, 5, -1, 7, $00, 0 | Y_FLIP | BEHIND_BG - dsprite 0, 5, 0, 0, $02, 0 | Y_FLIP | BEHIND_BG - dsprite 0, 5, 1, 0, $03, 0 | BEHIND_BG + dsprite 0, 0, -1, 7, $00, 0 | PRIORITY + dsprite 0, 0, 0, 0, $02, 0 | PRIORITY + dsprite 0, 0, 1, 0, $03, 0 | PRIORITY + dsprite 0, 5, -1, 7, $00, 0 | Y_FLIP | PRIORITY + dsprite 0, 5, 0, 0, $02, 0 | Y_FLIP | PRIORITY + dsprite 0, 5, 1, 0, $03, 0 | PRIORITY .PokeGroup: ; e0a5a db 26 - dsprite 0, 0, -1, 7, $00, 0 | BEHIND_BG - dsprite 0, 0, 0, 0, $02, 0 | BEHIND_BG - dsprite 0, 0, 1, 0, $00, 0 | X_FLIP | BEHIND_BG - dsprite 1, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 1, 0, 1, 0, $01, 0 | X_FLIP | BEHIND_BG - dsprite 2, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 2, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 3, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 3, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 4, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 4, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 5, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 5, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 6, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 6, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 7, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 7, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 8, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 8, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 9, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 9, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 10, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 10, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 10, 1, -1, 7, $00, 0 | Y_FLIP | BEHIND_BG - dsprite 10, 1, 0, 0, $02, 0 | Y_FLIP | BEHIND_BG - dsprite 10, 1, 1, 0, $03, 0 | BEHIND_BG + dsprite 0, 0, -1, 7, $00, 0 | PRIORITY + dsprite 0, 0, 0, 0, $02, 0 | PRIORITY + dsprite 0, 0, 1, 0, $00, 0 | X_FLIP | PRIORITY + dsprite 1, 0, -1, 7, $01, 0 | PRIORITY + dsprite 1, 0, 1, 0, $01, 0 | X_FLIP | PRIORITY + dsprite 2, 0, -1, 7, $01, 0 | PRIORITY + dsprite 2, 0, 1, 0, $03, 0 | PRIORITY + dsprite 3, 0, -1, 7, $01, 0 | PRIORITY + dsprite 3, 0, 1, 0, $03, 0 | PRIORITY + dsprite 4, 0, -1, 7, $01, 0 | PRIORITY + dsprite 4, 0, 1, 0, $03, 0 | PRIORITY + dsprite 5, 0, -1, 7, $01, 0 | PRIORITY + dsprite 5, 0, 1, 0, $03, 0 | PRIORITY + dsprite 6, 0, -1, 7, $01, 0 | PRIORITY + dsprite 6, 0, 1, 0, $03, 0 | PRIORITY + dsprite 7, 0, -1, 7, $01, 0 | PRIORITY + dsprite 7, 0, 1, 0, $03, 0 | PRIORITY + dsprite 8, 0, -1, 7, $01, 0 | PRIORITY + dsprite 8, 0, 1, 0, $03, 0 | PRIORITY + dsprite 9, 0, -1, 7, $01, 0 | PRIORITY + dsprite 9, 0, 1, 0, $03, 0 | PRIORITY + dsprite 10, 0, -1, 7, $01, 0 | PRIORITY + dsprite 10, 0, 1, 0, $03, 0 | PRIORITY + dsprite 10, 1, -1, 7, $00, 0 | Y_FLIP | PRIORITY + dsprite 10, 1, 0, 0, $02, 0 | Y_FLIP | PRIORITY + dsprite 10, 1, 1, 0, $03, 0 | PRIORITY .NumGroup: ; e0ac3 db 20 - dsprite 0, 0, -1, 7, $00, 0 | BEHIND_BG - dsprite 0, 0, 0, 0, $02, 0 | BEHIND_BG - dsprite 0, 0, 1, 0, $02, 0 | BEHIND_BG - dsprite 0, 0, 2, 0, $03, 0 | BEHIND_BG - dsprite 0, 0, 3, 0, $02, 0 | BEHIND_BG - dsprite 0, 0, 4, 0, $03, 0 | BEHIND_BG - dsprite 0, 0, 5, 0, $02, 0 | BEHIND_BG - dsprite 0, 0, 6, 0, $03, 0 | BEHIND_BG - dsprite 0, 0, 7, 0, $02, 0 | BEHIND_BG - dsprite 0, 0, 8, 0, $03, 0 | BEHIND_BG - dsprite 0, 5, -1, 7, $00, 0 | Y_FLIP | BEHIND_BG - dsprite 0, 5, 0, 0, $02, 0 | Y_FLIP | BEHIND_BG - dsprite 0, 5, 1, 0, $02, 0 | Y_FLIP | BEHIND_BG - dsprite 0, 5, 2, 0, $03, 0 | BEHIND_BG - dsprite 0, 5, 3, 0, $02, 0 | Y_FLIP | BEHIND_BG - dsprite 0, 5, 4, 0, $03, 0 | BEHIND_BG - dsprite 0, 5, 5, 0, $02, 0 | Y_FLIP | BEHIND_BG - dsprite 0, 5, 6, 0, $03, 0 | BEHIND_BG - dsprite 0, 5, 7, 0, $02, 0 | Y_FLIP | BEHIND_BG - dsprite 0, 5, 8, 0, $03, 0 | BEHIND_BG + dsprite 0, 0, -1, 7, $00, 0 | PRIORITY + dsprite 0, 0, 0, 0, $02, 0 | PRIORITY + dsprite 0, 0, 1, 0, $02, 0 | PRIORITY + dsprite 0, 0, 2, 0, $03, 0 | PRIORITY + dsprite 0, 0, 3, 0, $02, 0 | PRIORITY + dsprite 0, 0, 4, 0, $03, 0 | PRIORITY + dsprite 0, 0, 5, 0, $02, 0 | PRIORITY + dsprite 0, 0, 6, 0, $03, 0 | PRIORITY + dsprite 0, 0, 7, 0, $02, 0 | PRIORITY + dsprite 0, 0, 8, 0, $03, 0 | PRIORITY + dsprite 0, 5, -1, 7, $00, 0 | Y_FLIP | PRIORITY + dsprite 0, 5, 0, 0, $02, 0 | Y_FLIP | PRIORITY + dsprite 0, 5, 1, 0, $02, 0 | Y_FLIP | PRIORITY + dsprite 0, 5, 2, 0, $03, 0 | PRIORITY + dsprite 0, 5, 3, 0, $02, 0 | Y_FLIP | PRIORITY + dsprite 0, 5, 4, 0, $03, 0 | PRIORITY + dsprite 0, 5, 5, 0, $02, 0 | Y_FLIP | PRIORITY + dsprite 0, 5, 6, 0, $03, 0 | PRIORITY + dsprite 0, 5, 7, 0, $02, 0 | Y_FLIP | PRIORITY + dsprite 0, 5, 8, 0, $03, 0 | PRIORITY .NumGroupPair: ; e0b14 db 30 - dsprite 0, 0, 0, 0, $00, 0 | BEHIND_BG - dsprite 0, 0, 1, 0, $02, 0 | BEHIND_BG - dsprite 0, 0, 2, 0, $02, 0 | BEHIND_BG - dsprite 0, 0, 3, 0, $03, 0 | BEHIND_BG - dsprite 0, 0, 4, 0, $02, 0 | BEHIND_BG - dsprite 0, 0, 5, 0, $03, 0 | BEHIND_BG - dsprite 0, 0, 6, 0, $02, 0 | BEHIND_BG - dsprite 0, 0, 7, 0, $03, 0 | BEHIND_BG - dsprite 0, 0, 8, 0, $02, 0 | BEHIND_BG - dsprite 0, 0, 9, 0, $03, 0 | BEHIND_BG - dsprite 1, 0, 0, 0, $01, 0 | BEHIND_BG - dsprite 1, 0, 3, 0, $03, 0 | BEHIND_BG - dsprite 1, 0, 5, 0, $03, 0 | BEHIND_BG - dsprite 1, 0, 7, 0, $03, 0 | BEHIND_BG - dsprite 1, 0, 9, 0, $03, 0 | BEHIND_BG - dsprite 2, 0, 0, 0, $01, 0 | BEHIND_BG - dsprite 2, 0, 3, 0, $03, 0 | BEHIND_BG - dsprite 2, 0, 5, 0, $03, 0 | BEHIND_BG - dsprite 2, 0, 7, 0, $03, 0 | BEHIND_BG - dsprite 2, 0, 9, 0, $03, 0 | BEHIND_BG - dsprite 2, 1, 0, 0, $00, 0 | Y_FLIP | BEHIND_BG - dsprite 2, 1, 1, 0, $02, 0 | Y_FLIP | BEHIND_BG - dsprite 2, 1, 2, 0, $02, 0 | Y_FLIP | BEHIND_BG - dsprite 2, 1, 3, 0, $03, 0 | BEHIND_BG - dsprite 2, 1, 4, 0, $03, 0 | BEHIND_BG - dsprite 2, 1, 5, 0, $03, 0 | BEHIND_BG - dsprite 2, 1, 6, 0, $03, 0 | BEHIND_BG - dsprite 2, 1, 7, 0, $03, 0 | BEHIND_BG - dsprite 2, 1, 8, 0, $03, 0 | BEHIND_BG - dsprite 2, 1, 9, 0, $03, 0 | BEHIND_BG + dsprite 0, 0, 0, 0, $00, 0 | PRIORITY + dsprite 0, 0, 1, 0, $02, 0 | PRIORITY + dsprite 0, 0, 2, 0, $02, 0 | PRIORITY + dsprite 0, 0, 3, 0, $03, 0 | PRIORITY + dsprite 0, 0, 4, 0, $02, 0 | PRIORITY + dsprite 0, 0, 5, 0, $03, 0 | PRIORITY + dsprite 0, 0, 6, 0, $02, 0 | PRIORITY + dsprite 0, 0, 7, 0, $03, 0 | PRIORITY + dsprite 0, 0, 8, 0, $02, 0 | PRIORITY + dsprite 0, 0, 9, 0, $03, 0 | PRIORITY + dsprite 1, 0, 0, 0, $01, 0 | PRIORITY + dsprite 1, 0, 3, 0, $03, 0 | PRIORITY + dsprite 1, 0, 5, 0, $03, 0 | PRIORITY + dsprite 1, 0, 7, 0, $03, 0 | PRIORITY + dsprite 1, 0, 9, 0, $03, 0 | PRIORITY + dsprite 2, 0, 0, 0, $01, 0 | PRIORITY + dsprite 2, 0, 3, 0, $03, 0 | PRIORITY + dsprite 2, 0, 5, 0, $03, 0 | PRIORITY + dsprite 2, 0, 7, 0, $03, 0 | PRIORITY + dsprite 2, 0, 9, 0, $03, 0 | PRIORITY + dsprite 2, 1, 0, 0, $00, 0 | Y_FLIP | PRIORITY + dsprite 2, 1, 1, 0, $02, 0 | Y_FLIP | PRIORITY + dsprite 2, 1, 2, 0, $02, 0 | Y_FLIP | PRIORITY + dsprite 2, 1, 3, 0, $03, 0 | PRIORITY + dsprite 2, 1, 4, 0, $03, 0 | PRIORITY + dsprite 2, 1, 5, 0, $03, 0 | PRIORITY + dsprite 2, 1, 6, 0, $03, 0 | PRIORITY + dsprite 2, 1, 7, 0, $03, 0 | PRIORITY + dsprite 2, 1, 8, 0, $03, 0 | PRIORITY + dsprite 2, 1, 9, 0, $03, 0 | PRIORITY .PokeGroupPair: ; e0b8d db 38 - dsprite 0, 0, -1, 7, $00, 0 | BEHIND_BG - dsprite 0, 0, 3, 0, $00, 0 | X_FLIP | BEHIND_BG - dsprite 1, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 1, 0, 3, 0, $01, 0 | X_FLIP | BEHIND_BG - dsprite 2, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 2, 0, 3, 0, $01, 0 | X_FLIP | BEHIND_BG - dsprite 3, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 3, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 3, 0, 3, 0, $03, 0 | BEHIND_BG - dsprite 4, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 4, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 4, 0, 3, 0, $03, 0 | BEHIND_BG - dsprite 5, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 5, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 5, 0, 3, 0, $03, 0 | BEHIND_BG - dsprite 6, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 6, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 6, 0, 3, 0, $03, 0 | BEHIND_BG - dsprite 7, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 7, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 7, 0, 3, 0, $03, 0 | BEHIND_BG - dsprite 8, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 8, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 8, 0, 3, 0, $03, 0 | BEHIND_BG - dsprite 9, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 9, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 9, 0, 3, 0, $03, 0 | BEHIND_BG - dsprite 10, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 10, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 10, 0, 3, 0, $03, 0 | BEHIND_BG - dsprite 11, 0, -1, 7, $01, 0 | BEHIND_BG - dsprite 11, 0, 1, 0, $03, 0 | BEHIND_BG - dsprite 11, 0, 3, 0, $03, 0 | BEHIND_BG - dsprite 11, 1, -1, 7, $00, 0 | Y_FLIP | BEHIND_BG - dsprite 11, 1, 0, 0, $02, 0 | Y_FLIP | BEHIND_BG - dsprite 11, 1, 1, 0, $03, 0 | Y_FLIP | BEHIND_BG - dsprite 11, 1, 2, 0, $02, 0 | Y_FLIP | BEHIND_BG - dsprite 11, 1, 3, 0, $03, 0 | X_FLIP | Y_FLIP | BEHIND_BG + dsprite 0, 0, -1, 7, $00, 0 | PRIORITY + dsprite 0, 0, 3, 0, $00, 0 | X_FLIP | PRIORITY + dsprite 1, 0, -1, 7, $01, 0 | PRIORITY + dsprite 1, 0, 3, 0, $01, 0 | X_FLIP | PRIORITY + dsprite 2, 0, -1, 7, $01, 0 | PRIORITY + dsprite 2, 0, 3, 0, $01, 0 | X_FLIP | PRIORITY + dsprite 3, 0, -1, 7, $01, 0 | PRIORITY + dsprite 3, 0, 1, 0, $03, 0 | PRIORITY + dsprite 3, 0, 3, 0, $03, 0 | PRIORITY + dsprite 4, 0, -1, 7, $01, 0 | PRIORITY + dsprite 4, 0, 1, 0, $03, 0 | PRIORITY + dsprite 4, 0, 3, 0, $03, 0 | PRIORITY + dsprite 5, 0, -1, 7, $01, 0 | PRIORITY + dsprite 5, 0, 1, 0, $03, 0 | PRIORITY + dsprite 5, 0, 3, 0, $03, 0 | PRIORITY + dsprite 6, 0, -1, 7, $01, 0 | PRIORITY + dsprite 6, 0, 1, 0, $03, 0 | PRIORITY + dsprite 6, 0, 3, 0, $03, 0 | PRIORITY + dsprite 7, 0, -1, 7, $01, 0 | PRIORITY + dsprite 7, 0, 1, 0, $03, 0 | PRIORITY + dsprite 7, 0, 3, 0, $03, 0 | PRIORITY + dsprite 8, 0, -1, 7, $01, 0 | PRIORITY + dsprite 8, 0, 1, 0, $03, 0 | PRIORITY + dsprite 8, 0, 3, 0, $03, 0 | PRIORITY + dsprite 9, 0, -1, 7, $01, 0 | PRIORITY + dsprite 9, 0, 1, 0, $03, 0 | PRIORITY + dsprite 9, 0, 3, 0, $03, 0 | PRIORITY + dsprite 10, 0, -1, 7, $01, 0 | PRIORITY + dsprite 10, 0, 1, 0, $03, 0 | PRIORITY + dsprite 10, 0, 3, 0, $03, 0 | PRIORITY + dsprite 11, 0, -1, 7, $01, 0 | PRIORITY + dsprite 11, 0, 1, 0, $03, 0 | PRIORITY + dsprite 11, 0, 3, 0, $03, 0 | PRIORITY + dsprite 11, 1, -1, 7, $00, 0 | Y_FLIP | PRIORITY + dsprite 11, 1, 0, 0, $02, 0 | Y_FLIP | PRIORITY + dsprite 11, 1, 1, 0, $03, 0 | Y_FLIP | PRIORITY + dsprite 11, 1, 2, 0, $02, 0 | Y_FLIP | PRIORITY + dsprite 11, 1, 3, 0, $03, 0 | X_FLIP | Y_FLIP | PRIORITY .Impossible: ; e0c26 db 4 - dsprite 0, 0, 0, 0, $00, 0 | BEHIND_BG - dsprite 0, 0, 1, 0, $00, 0 | X_FLIP | BEHIND_BG - dsprite 1, 0, 0, 0, $00, 0 | Y_FLIP | BEHIND_BG - dsprite 1, 0, 1, 0, $00, 0 | X_FLIP | Y_FLIP | BEHIND_BG + dsprite 0, 0, 0, 0, $00, 0 | PRIORITY + dsprite 0, 0, 1, 0, $00, 0 | X_FLIP | PRIORITY + dsprite 1, 0, 0, 0, $00, 0 | Y_FLIP | PRIORITY + dsprite 1, 0, 1, 0, $00, 0 | X_FLIP | Y_FLIP | PRIORITY ; e0c37 CardFlip_InitAttrPals: ; e0c37 (38:4c37) diff --git a/engine/events.asm b/engine/events.asm index cff7c76ed..400f1c9a4 100644 --- a/engine/events.asm +++ b/engine/events.asm @@ -1106,4 +1106,5 @@ ChangeDirectionScript: ; 9 ; 96c56 INCLUDE "engine/scripting.asm" + INCLUDE "engine/events_2.asm" diff --git a/engine/events/checkforhiddenitems.asm b/engine/events/checkforhiddenitems.asm new file mode 100644 index 000000000..3c13412d8 --- /dev/null +++ b/engine/events/checkforhiddenitems.asm @@ -0,0 +1,85 @@ +CheckForHiddenItems: ; b8172 +; Checks to see if there are hidden items on the screen that have not yet been found. If it finds one, returns carry. + call GetMapScriptHeaderBank + ld [Buffer1], a +; Get the coordinate of the bottom right corner of the screen, and load it in Buffer3/Buffer4. + ld a, [XCoord] + add SCREEN_WIDTH / 4 + ld [Buffer4], a + ld a, [YCoord] + add SCREEN_HEIGHT / 4 + ld [Buffer3], a +; Get the pointer for the first BG event header in the map... + ld hl, wCurrMapBGEventHeaderPointer + ld a, [hli] + ld h, [hl] + ld l, a +; ... before even checking to see if there are any BG events on this map. + ld a, [wCurrMapBGEventCount] + and a + jr z, .nobgeventitems +; For i = 1:wCurrMapBGEventCount... +.loop +; Store the counter in Buffer2, and store the BG event header pointer in the stack. + ld [Buffer2], a + push hl +; Get the Y coordinate of the BG event. + call .GetFarByte + ld e, a +; Is the Y coordinate of the BG event on the screen? If not, go to the next BG event. + ld a, [Buffer3] + sub e + jr c, .next + cp SCREEN_HEIGHT / 2 + jr nc, .next +; Is the X coordinate of the BG event on the screen? If not, go to the next BG event. + call .GetFarByte + ld d, a + ld a, [Buffer4] + sub d + jr c, .next + cp SCREEN_WIDTH / 2 + jr nc, .next +; Is this BG event a hidden item? If not, go to the next BG event. + call .GetFarByte + cp BGEVENT_ITEM + jr nz, .next +; Has this item already been found? If not, set off the Itemfinder. + ld a, [Buffer1] + call GetFarHalfword + ld a, [Buffer1] + call GetFarHalfword + ld d, h + ld e, l + ld b, CHECK_FLAG + call EventFlagAction + ld a, c + and a + jr z, .itemnearby + +.next +; Restore the BG event header pointer and increment it by the length of a BG event header. + pop hl + ld bc, 5 + add hl, bc +; Restore the BG event counter and decrement it. If it hits zero, there are no hidden items in range. + ld a, [Buffer2] + dec a + jr nz, .loop + +.nobgeventitems + xor a + ret + +.itemnearby + pop hl + scf + ret +; b81e2 + +.GetFarByte: ; b81e2 + ld a, [Buffer1] + call GetFarByte + inc hl + ret +; b81ea diff --git a/engine/events/map_name_sign.asm b/engine/events/map_name_sign.asm new file mode 100644 index 000000000..b20d74ee4 --- /dev/null +++ b/engine/events/map_name_sign.asm @@ -0,0 +1,274 @@ +MAP_NAME_SIGN_START EQU $60 + +ReturnFromMapSetupScript:: ; b8000 + xor a + ld [hBGMapMode], a + farcall .inefficient_farcall ; this is a waste of 6 ROM bytes and 6 stack bytes + ret +; b800a + +; should have just been a fallthrough +.inefficient_farcall ; b800a + ld a, [MapGroup] + ld b, a + ld a, [MapNumber] + ld c, a + call GetWorldMapLocation + ld [wCurrentLandmark], a + call .CheckNationalParkGate + jr z, .nationalparkgate + + call GetMapEnvironment + cp GATE + jr nz, .not_gate + +.nationalparkgate + ld a, -1 + ld [wCurrentLandmark], a + +.not_gate + ld hl, wEnteredMapFromContinue + bit 1, [hl] + res 1, [hl] + jr nz, .dont_do_map_sign + + call .CheckMovingWithinLandmark + jr z, .dont_do_map_sign + ld a, [wCurrentLandmark] + ld [wPreviousLandmark], a + + call .CheckSpecialMap + jr z, .dont_do_map_sign + +; Display for 60 frames + ld a, 60 + ld [wLandmarkSignTimer], a + call LoadMapNameSignGFX + call InitMapNameFrame + farcall HDMATransfer_OnlyTopFourRows + ret + +.dont_do_map_sign + ld a, [wCurrentLandmark] + ld [wPreviousLandmark], a + ld a, $90 + ld [rWY], a + ld [hWY], a + xor a + ld [hLCDCPointer], a + ret +; b8064 + +.CheckMovingWithinLandmark: ; b8064 + ld a, [wCurrentLandmark] + ld c, a + ld a, [wPreviousLandmark] + cp c + ret z + cp SPECIAL_MAP + ret +; b8070 + +.CheckSpecialMap: ; b8070 +; These landmarks do not get pop-up signs. + cp -1 + ret z + cp SPECIAL_MAP + ret z + cp RADIO_TOWER + ret z + cp LAV_RADIO_TOWER + ret z + cp UNDERGROUND_PATH + ret z + cp INDIGO_PLATEAU + ret z + cp POWER_PLANT + ret z + ld a, $1 + and a + ret +; b8089 + +.CheckNationalParkGate: ; b8089 + ld a, [MapGroup] + cp GROUP_ROUTE_35_NATIONAL_PARK_GATE + ret nz + ld a, [MapNumber] + cp MAP_ROUTE_35_NATIONAL_PARK_GATE + ret z + cp MAP_ROUTE_36_NATIONAL_PARK_GATE + ret +; b8098 + + +PlaceMapNameSign:: ; b8098 (2e:4098) + ld hl, wLandmarkSignTimer + ld a, [hl] + and a + jr z, .disappear + dec [hl] + cp 60 + ret z + cp 59 + jr nz, .skip2 + call InitMapNameFrame + call PlaceMapNameCenterAlign + farcall HDMATransfer_OnlyTopFourRows +.skip2 + ld a, $80 + ld a, $70 + ld [rWY], a + ld [hWY], a + ret + +.disappear + ld a, $90 + ld [rWY], a + ld [hWY], a + xor a + ld [hLCDCPointer], a + ret + + +LoadMapNameSignGFX: ; b80c6 + ld de, MapEntryFrameGFX + ld hl, vTiles2 tile MAP_NAME_SIGN_START + lb bc, BANK(MapEntryFrameGFX), 14 + call Get2bpp + ret +; b80d3 + +InitMapNameFrame: ; b80d3 + hlcoord 0, 0 + ld b, 2 + ld c, 18 + call InitMapSignAttrMap + call PlaceMapNameFrame + ret +; b80e1 + + +PlaceMapNameCenterAlign: ; b80e1 (2e:40e1) + ld a, [wCurrentLandmark] + ld e, a + farcall GetLandmarkName + call .GetNameLength + ld a, SCREEN_WIDTH + sub c + srl a + ld b, $0 + ld c, a + hlcoord 0, 2 + add hl, bc + ld de, StringBuffer1 + call PlaceString + ret + +.GetNameLength: ; b8101 (2e:4101) + ld c, 0 + push hl + ld hl, StringBuffer1 +.loop + ld a, [hli] + cp "@" + jr z, .stop + cp "%" + jr z, .loop + inc c + jr .loop +.stop + pop hl + ret + + +InitMapSignAttrMap: ; b8115 + ld de, AttrMap - TileMap + add hl, de + inc b + inc b + inc c + inc c + ld a, PAL_BG_TEXT | PRIORITY +.loop + push bc + push hl +.inner_loop + ld [hli], a + dec c + jr nz, .inner_loop + pop hl + ld de, SCREEN_WIDTH + add hl, de + pop bc + dec b + jr nz, .loop + ret +; b812f + +PlaceMapNameFrame: ; b812f + hlcoord 0, 0 + ; top left + ld a, MAP_NAME_SIGN_START + 1 + ld [hli], a + ; top row + ld a, MAP_NAME_SIGN_START + 2 + call .FillTopBottom + ; top right + ld a, MAP_NAME_SIGN_START + 4 + ld [hli], a + ; left, first line + ld a, MAP_NAME_SIGN_START + 5 + ld [hli], a + ; first line + call .FillMiddle + ; right, first line + ld a, MAP_NAME_SIGN_START + 11 + ld [hli], a + ; left, second line + ld a, MAP_NAME_SIGN_START + 6 + ld [hli], a + ; second line + call .FillMiddle + ; right, second line + ld a, MAP_NAME_SIGN_START + 12 + ld [hli], a + ; bottom left + ld a, MAP_NAME_SIGN_START + 7 + ld [hli], a + ; bottom + ld a, MAP_NAME_SIGN_START + 8 + call .FillTopBottom + ; bottom right + ld a, MAP_NAME_SIGN_START + 10 + ld [hl], a + ret +; b815b + +.FillMiddle: ; b815b + ld c, SCREEN_WIDTH - 2 + ld a, MAP_NAME_SIGN_START + 13 +.loop + ld [hli], a + dec c + jr nz, .loop + ret +; b8164 + +.FillTopBottom: ; b8164 + ld c, 5 + jr .enterloop + +.continueloop + ld [hli], a + ld [hli], a + +.enterloop + inc a + ld [hli], a + ld [hli], a + dec a + dec c + jr nz, .continueloop + ret +; b8172 diff --git a/engine/events/treemons.asm b/engine/events/treemons.asm new file mode 100755 index 000000000..2a8ce4882 --- /dev/null +++ b/engine/events/treemons.asm @@ -0,0 +1,285 @@ +TreeMonEncounter: ; b81ea + farcall TrainerRankings_TreeEncounters + + xor a + ld [TempWildMonSpecies], a + ld [CurPartyLevel], a + + ld hl, TreeMonMaps + call GetTreeMonSet + jr nc, .no_battle + + call GetTreeMons + jr nc, .no_battle + + call GetTreeMon + jr nc, .no_battle + + ld a, BATTLETYPE_TREE + ld [BattleType], a + ld a, 1 + ld [ScriptVar], a + ret + +.no_battle + xor a + ld [ScriptVar], a + ret +; b8219 + +RockMonEncounter: ; b8219 + + xor a + ld [TempWildMonSpecies], a + ld [CurPartyLevel], a + + ld hl, RockMonMaps + call GetTreeMonSet + jr nc, .no_battle + + call GetTreeMons + jr nc, .no_battle + + ; 40% chance of an encounter + ld a, 10 + call RandomRange + cp 4 + jr nc, .no_battle + + call SelectTreeMon + jr nc, .no_battle + + ret + +.no_battle + xor a + ret +; b823e + + db $05 ; ???? + +GetTreeMonSet: ; b823f +; Return carry and treemon set in a +; if the current map is in table hl. + ld a, [MapNumber] + ld e, a + ld a, [MapGroup] + ld d, a +.loop + ld a, [hli] + cp -1 + jr z, .not_in_table + + cp d + jr nz, .skip2 + + ld a, [hli] + cp e + jr nz, .skip1 + + jr .in_table + +.skip2 + inc hl +.skip1 + inc hl + jr .loop + +.not_in_table + xor a + ret + +.in_table + ld a, [hl] + scf + ret +; b825e + +INCLUDE "data/wild/treemon_maps.asm" + +GetTreeMons: ; b82d2 +; Return the address of TreeMon table a in hl. +; Return nc if table a doesn't exist. + + cp NUM_TREEMON_SETS + jr nc, .quit + + and a + jr z, .quit + + ld e, a + ld d, 0 + ld hl, TreeMons + add hl, de + add hl, de + + ld a, [hli] + ld h, [hl] + ld l, a + + scf + ret + +.quit + xor a + ret +; b82e8 + +INCLUDE "data/wild/treemons.asm" + +GetTreeMon: ; b83e5 + push hl + call GetTreeScore + pop hl + and a ; TREEMON_SCORE_BAD + jr z, .bad + cp TREEMON_SCORE_GOOD + jr z, .good + cp TREEMON_SCORE_RARE + jr z, .rare + ret + +.bad + ; 10% chance of an encounter + ld a, 10 + call RandomRange + and a + jr nz, NoTreeMon + jr SelectTreeMon + +.good + ; 50% chance of an encounter + ld a, 10 + call RandomRange + cp 5 + jr nc, NoTreeMon + jr SelectTreeMon + +.rare + ; 80% chance of an encounter + ld a, 10 + call RandomRange + cp 8 + jr nc, NoTreeMon + jr .skip +.skip + ld a, [hli] + cp -1 + jr nz, .skip + call SelectTreeMon + ret +; b841f + +SelectTreeMon: ; b841f +; Read a TreeMons table and pick one monster at random. + + ld a, 100 + call RandomRange +.loop + sub [hl] + jr c, .ok + inc hl + inc hl + inc hl + jr .loop + +.ok + ld a, [hli] + cp -1 + jr z, NoTreeMon + + ld a, [hli] + ld [TempWildMonSpecies], a + ld a, [hl] + ld [CurPartyLevel], a + scf + ret + +NoTreeMon: ; b843b + xor a + ld [TempWildMonSpecies], a + ld [CurPartyLevel], a + ret +; b8443 + +GetTreeScore: ; b8443 + call .CoordScore + ld [Buffer1], a + call .OTIDScore + ld [Buffer2], a + ld c, a + ld a, [Buffer1] + sub c + jr z, .rare + jr nc, .ok + add 10 +.ok + cp 5 + jr c, .good + +.bad + xor a ; TREEMON_SCORE_BAD + ret + +.good + ld a, TREEMON_SCORE_GOOD + ret + +.rare + ld a, TREEMON_SCORE_RARE + ret +; b8466 + +.CoordScore: ; b8466 + call GetFacingTileCoord + ld hl, 0 + ld c, e + ld b, 0 + ld a, d + + and a + jr z, .next +.loop + add hl, bc + dec a + jr nz, .loop +.next + + add hl, bc + ld c, d + add hl, bc + + ld a, h + ld [hDividend], a + ld a, l + ld [hDividend + 1], a + ld a, 5 + ld [hDivisor], a + ld b, 2 + call Divide + + ld a, [hQuotient + 1] + ld [hDividend], a + ld a, [hQuotient + 2] + ld [hDividend + 1], a + ld a, 10 + ld [hDivisor], a + ld b, 2 + call Divide + + ld a, [hQuotient + 3] + ret +; b849d + +.OTIDScore: ; b849d + ld a, [PlayerID] + ld [hDividend], a + ld a, [PlayerID + 1] + ld [hDividend + 1], a + ld a, 10 + ld [hDivisor], a + ld b, 2 + call Divide + ld a, [hQuotient + 3] + ret +; b84b3 diff --git a/engine/events_3.asm b/engine/events_3.asm deleted file mode 100755 index b39714d27..000000000 --- a/engine/events_3.asm +++ /dev/null @@ -1,692 +0,0 @@ -ReturnFromMapSetupScript:: ; b8000 - xor a - ld [hBGMapMode], a - farcall .inefficient_farcall ; this is a waste of 6 ROM bytes and 6 stack bytes - ret -; b800a - -; should have just been a fallthrough -.inefficient_farcall ; b800a - ld a, [MapGroup] - ld b, a - ld a, [MapNumber] - ld c, a - call GetWorldMapLocation - ld [wCurrentLandmark], a - call .CheckNationalParkGate - jr z, .nationalparkgate - - call GetMapEnvironment - cp GATE - jr nz, .not_gate - -.nationalparkgate - ld a, -1 - ld [wCurrentLandmark], a - -.not_gate - ld hl, wEnteredMapFromContinue - bit 1, [hl] - res 1, [hl] - jr nz, .dont_do_map_sign - - call .CheckMovingWithinLandmark - jr z, .dont_do_map_sign - ld a, [wCurrentLandmark] - ld [wPreviousLandmark], a - - call .CheckSpecialMap - jr z, .dont_do_map_sign - -; Display for 60 frames - ld a, 60 - ld [wLandmarkSignTimer], a - call LoadMapNameSignGFX - call InitMapNameFrame - farcall HDMATransfer_OnlyTopFourRows - ret - -.dont_do_map_sign - ld a, [wCurrentLandmark] - ld [wPreviousLandmark], a - ld a, $90 - ld [rWY], a - ld [hWY], a - xor a - ld [hLCDCPointer], a - ret -; b8064 - -.CheckMovingWithinLandmark: ; b8064 - ld a, [wCurrentLandmark] - ld c, a - ld a, [wPreviousLandmark] - cp c - ret z - cp SPECIAL_MAP - ret -; b8070 - -.CheckSpecialMap: ; b8070 -; These landmarks do not get pop-up signs. - cp -1 - ret z - cp SPECIAL_MAP - ret z - cp RADIO_TOWER - ret z - cp LAV_RADIO_TOWER - ret z - cp UNDERGROUND_PATH - ret z - cp INDIGO_PLATEAU - ret z - cp POWER_PLANT - ret z - ld a, $1 - and a - ret -; b8089 - -.CheckNationalParkGate: ; b8089 - ld a, [MapGroup] - cp GROUP_ROUTE_35_NATIONAL_PARK_GATE - ret nz - ld a, [MapNumber] - cp MAP_ROUTE_35_NATIONAL_PARK_GATE - ret z - cp MAP_ROUTE_36_NATIONAL_PARK_GATE - ret -; b8098 - - -PlaceMapNameSign:: ; b8098 (2e:4098) - ld hl, wLandmarkSignTimer - ld a, [hl] - and a - jr z, .disappear - dec [hl] - cp 60 - ret z - cp 59 - jr nz, .skip2 - call InitMapNameFrame - call PlaceMapNameCenterAlign - farcall HDMATransfer_OnlyTopFourRows -.skip2 - ld a, $80 - ld a, $70 - ld [rWY], a - ld [hWY], a - ret - -.disappear - ld a, $90 - ld [rWY], a - ld [hWY], a - xor a - ld [hLCDCPointer], a - ret - - -LoadMapNameSignGFX: ; b80c6 - ld de, MapEntryFrameGFX - ld hl, vTiles2 tile $60 - lb bc, BANK(MapEntryFrameGFX), $e - call Get2bpp - ret -; b80d3 - -InitMapNameFrame: ; b80d3 - hlcoord 0, 0 - ld b, 2 - ld c, 18 - call InitMapSignAttrMap - call PlaceMapNameFrame - ret -; b80e1 - - -PlaceMapNameCenterAlign: ; b80e1 (2e:40e1) - ld a, [wCurrentLandmark] - ld e, a - farcall GetLandmarkName - call .GetNameLength - ld a, SCREEN_WIDTH - sub c - srl a - ld b, $0 - ld c, a - hlcoord 0, 2 - add hl, bc - ld de, StringBuffer1 - call PlaceString - ret - -.GetNameLength: ; b8101 (2e:4101) - ld c, 0 - push hl - ld hl, StringBuffer1 -.loop - ld a, [hli] - cp "@" - jr z, .stop - cp "%" - jr z, .loop - inc c - jr .loop -.stop - pop hl - ret - - -InitMapSignAttrMap: ; b8115 - ld de, AttrMap - TileMap - add hl, de - inc b - inc b - inc c - inc c - ld a, $87 -.loop - push bc - push hl -.inner_loop - ld [hli], a - dec c - jr nz, .inner_loop - pop hl - ld de, SCREEN_WIDTH - add hl, de - pop bc - dec b - jr nz, .loop - ret -; b812f - -PlaceMapNameFrame: ; b812f - hlcoord 0, 0 - ; top left - ld a, $61 - ld [hli], a - ; top row - ld a, $62 - call .FillTopBottom - ; top right - ld a, $64 - ld [hli], a - ; left, first line - ld a, $65 - ld [hli], a - ; first line - call .FillMiddle - ; right, first line - ld a, $6b - ld [hli], a - ; left, second line - ld a, $66 - ld [hli], a - ; second line - call .FillMiddle - ; right, second line - ld a, $6c - ld [hli], a - ; bottom left - ld a, $67 - ld [hli], a - ; bottom - ld a, $68 - call .FillTopBottom - ; bottom right - ld a, $6a - ld [hl], a - ret -; b815b - -.FillMiddle: ; b815b - ld c, 18 - ld a, $6d -.loop - ld [hli], a - dec c - jr nz, .loop - ret -; b8164 - -.FillTopBottom: ; b8164 - ld c, 5 - jr .enterloop - -.continueloop - ld [hli], a - ld [hli], a - -.enterloop - inc a - ld [hli], a - ld [hli], a - dec a - dec c - jr nz, .continueloop - ret -; b8172 - -CheckForHiddenItems: ; b8172 -; Checks to see if there are hidden items on the screen that have not yet been found. If it finds one, returns carry. - call GetMapScriptHeaderBank - ld [Buffer1], a -; Get the coordinate of the bottom right corner of the screen, and load it in Buffer3/Buffer4. - ld a, [XCoord] - add SCREEN_WIDTH / 4 - ld [Buffer4], a - ld a, [YCoord] - add SCREEN_HEIGHT / 4 - ld [Buffer3], a -; Get the pointer for the first BG event header in the map... - ld hl, wCurrMapBGEventHeaderPointer - ld a, [hli] - ld h, [hl] - ld l, a -; ... before even checking to see if there are any BG events on this map. - ld a, [wCurrMapBGEventCount] - and a - jr z, .nobgeventitems -; For i = 1:wCurrMapBGEventCount... -.loop -; Store the counter in Buffer2, and store the BG event header pointer in the stack. - ld [Buffer2], a - push hl -; Get the Y coordinate of the BG event. - call .GetFarByte - ld e, a -; Is the Y coordinate of the BG event on the screen? If not, go to the next BG event. - ld a, [Buffer3] - sub e - jr c, .next - cp SCREEN_HEIGHT / 2 - jr nc, .next -; Is the X coordinate of the BG event on the screen? If not, go to the next BG event. - call .GetFarByte - ld d, a - ld a, [Buffer4] - sub d - jr c, .next - cp SCREEN_WIDTH / 2 - jr nc, .next -; Is this BG event a hidden item? If not, go to the next BG event. - call .GetFarByte - cp BGEVENT_ITEM - jr nz, .next -; Has this item already been found? If not, set off the Itemfinder. - ld a, [Buffer1] - call GetFarHalfword - ld a, [Buffer1] - call GetFarHalfword - ld d, h - ld e, l - ld b, CHECK_FLAG - call EventFlagAction - ld a, c - and a - jr z, .itemnearby - -.next -; Restore the BG event header pointer and increment it by the length of a BG event header. - pop hl - ld bc, 5 - add hl, bc -; Restore the BG event counter and decrement it. If it hits zero, there are no hidden items in range. - ld a, [Buffer2] - dec a - jr nz, .loop - -.nobgeventitems - xor a - ret - -.itemnearby - pop hl - scf - ret -; b81e2 - -.GetFarByte: ; b81e2 - ld a, [Buffer1] - call GetFarByte - inc hl - ret -; b81ea - - -TreeMonEncounter: ; b81ea - farcall TrainerRankings_TreeEncounters - - xor a - ld [TempWildMonSpecies], a - ld [CurPartyLevel], a - - ld hl, TreeMonMaps - call GetTreeMonSet - jr nc, .no_battle - - call GetTreeMons - jr nc, .no_battle - - call GetTreeMon - jr nc, .no_battle - - ld a, BATTLETYPE_TREE - ld [BattleType], a - ld a, 1 - ld [ScriptVar], a - ret - -.no_battle - xor a - ld [ScriptVar], a - ret -; b8219 - -RockMonEncounter: ; b8219 - - xor a - ld [TempWildMonSpecies], a - ld [CurPartyLevel], a - - ld hl, RockMonMaps - call GetTreeMonSet - jr nc, .no_battle - - call GetTreeMons - jr nc, .no_battle - - ; 40% chance of an encounter - ld a, 10 - call RandomRange - cp 4 - jr nc, .no_battle - - call SelectTreeMon - jr nc, .no_battle - - ret - -.no_battle - xor a - ret -; b823e - - db $05 ; ???? - -GetTreeMonSet: ; b823f -; Return carry and treemon set in a -; if the current map is in table hl. - ld a, [MapNumber] - ld e, a - ld a, [MapGroup] - ld d, a -.loop - ld a, [hli] - cp -1 - jr z, .not_in_table - - cp d - jr nz, .skip2 - - ld a, [hli] - cp e - jr nz, .skip1 - - jr .in_table - -.skip2 - inc hl -.skip1 - inc hl - jr .loop - -.not_in_table - xor a - ret - -.in_table - ld a, [hl] - scf - ret -; b825e - -INCLUDE "data/wild/treemon_maps.asm" - -GetTreeMons: ; b82d2 -; Return the address of TreeMon table a in hl. -; Return nc if table a doesn't exist. - - cp NUM_TREEMON_SETS - jr nc, .quit - - and a - jr z, .quit - - ld e, a - ld d, 0 - ld hl, TreeMons - add hl, de - add hl, de - - ld a, [hli] - ld h, [hl] - ld l, a - - scf - ret - -.quit - xor a - ret -; b82e8 - -INCLUDE "data/wild/treemons.asm" - -GetTreeMon: ; b83e5 - push hl - call GetTreeScore - pop hl - and a ; TREEMON_SCORE_BAD - jr z, .bad - cp TREEMON_SCORE_GOOD - jr z, .good - cp TREEMON_SCORE_RARE - jr z, .rare - ret - -.bad - ; 10% chance of an encounter - ld a, 10 - call RandomRange - and a - jr nz, NoTreeMon - jr SelectTreeMon - -.good - ; 50% chance of an encounter - ld a, 10 - call RandomRange - cp 5 - jr nc, NoTreeMon - jr SelectTreeMon - -.rare - ; 80% chance of an encounter - ld a, 10 - call RandomRange - cp 8 - jr nc, NoTreeMon - jr .skip -.skip - ld a, [hli] - cp -1 - jr nz, .skip - call SelectTreeMon - ret -; b841f - -SelectTreeMon: ; b841f -; Read a TreeMons table and pick one monster at random. - - ld a, 100 - call RandomRange -.loop - sub [hl] - jr c, .ok - inc hl - inc hl - inc hl - jr .loop - -.ok - ld a, [hli] - cp -1 - jr z, NoTreeMon - - ld a, [hli] - ld [TempWildMonSpecies], a - ld a, [hl] - ld [CurPartyLevel], a - scf - ret - -NoTreeMon: ; b843b - xor a - ld [TempWildMonSpecies], a - ld [CurPartyLevel], a - ret -; b8443 - -GetTreeScore: ; b8443 - call .CoordScore - ld [Buffer1], a - call .OTIDScore - ld [Buffer2], a - ld c, a - ld a, [Buffer1] - sub c - jr z, .rare - jr nc, .ok - add 10 -.ok - cp 5 - jr c, .good - -.bad - xor a ; TREEMON_SCORE_BAD - ret - -.good - ld a, TREEMON_SCORE_GOOD - ret - -.rare - ld a, TREEMON_SCORE_RARE - ret -; b8466 - -.CoordScore: ; b8466 - call GetFacingTileCoord - ld hl, 0 - ld c, e - ld b, 0 - ld a, d - - and a - jr z, .next -.loop - add hl, bc - dec a - jr nz, .loop -.next - - add hl, bc - ld c, d - add hl, bc - - ld a, h - ld [hDividend], a - ld a, l - ld [hDividend + 1], a - ld a, 5 - ld [hDivisor], a - ld b, 2 - call Divide - - ld a, [hQuotient + 1] - ld [hDividend], a - ld a, [hQuotient + 2] - ld [hDividend + 1], a - ld a, 10 - ld [hDivisor], a - ld b, 2 - call Divide - - ld a, [hQuotient + 3] - ret -; b849d - -.OTIDScore: ; b849d - ld a, [PlayerID] - ld [hDividend], a - ld a, [PlayerID + 1] - ld [hDividend + 1], a - ld a, 10 - ld [hDivisor], a - ld b, 2 - call Divide - ld a, [hQuotient + 3] - ret -; b84b3 - -LoadFishingGFX: ; b84b3 - ld a, [rVBK] - push af - ld a, $1 - ld [rVBK], a - - ld de, FishingGFX - ld a, [wPlayerGender] - bit 0, a - jr z, .got_gender - ld de, KrisFishingGFX -.got_gender - - ld hl, vTiles0 tile $02 - call .LoadGFX - ld hl, vTiles0 tile $06 - call .LoadGFX - ld hl, vTiles0 tile $0a - call .LoadGFX - ld hl, vTiles1 tile $7c - call .LoadGFX - - pop af - ld [rVBK], a - ret -; b84e3 - -.LoadGFX: ; b84e3 - lb bc, BANK(FishingGFX), 2 - push de - call Get2bpp - pop de - ld hl, 2 tiles - add hl, de - ld d, h - ld e, l - ret -; b84f2 - -FishingGFX: ; b84f2 -INCBIN "gfx/overworld/chris_fish.2bpp" -; b8582 - -KrisFishingGFX: ; b8582 -INCBIN "gfx/overworld/kris_fish.2bpp" -; b8612 diff --git a/engine/title.asm b/engine/title.asm index d3cb7f4c8..bf6ea79bf 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -353,7 +353,7 @@ InitializeBackground: ; 10ef06 ld [hli], a ; tile id inc e inc e - ld a, 0 | BEHIND_BG + ld a, 0 | PRIORITY ld [hli], a ; attributes dec c jr nz, .loop2 -- cgit v1.2.3 From d83aefb30af180eae03bbd65878e8de45166f3d0 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 12 Jan 2018 01:40:20 -0500 Subject: Use more constants in scripts --- engine/caught_data.asm | 6 +- engine/decorations.asm | 5 +- engine/events/daycare.asm | 4 +- engine/events/fruit_trees.asm | 2 +- engine/events/happiness_egg.asm | 2 +- engine/events/heal_machine_anim.asm | 1 + engine/events/kurt.asm | 2 +- engine/events/magikarp.asm | 8 +- engine/events/misc_scripts_2.asm | 2 +- engine/events/move_tutor.asm | 7 +- engine/events/special.asm | 23 +- engine/events/std_scripts.asm | 61 +++-- engine/events/whiteout.asm | 2 +- engine/mail.asm | 10 +- engine/phone/phone.asm | 2 +- engine/phone/phone_scripts.asm | 526 ++++++++++++++++++------------------ engine/scripting.asm | 40 +-- engine/specials.asm | 6 +- 18 files changed, 357 insertions(+), 352 deletions(-) (limited to 'engine') diff --git a/engine/caught_data.asm b/engine/caught_data.asm index 534e318a4..694d1bb74 100644 --- a/engine/caught_data.asm +++ b/engine/caught_data.asm @@ -81,7 +81,7 @@ CheckPartyFullAfterContest: ; 4d9e5 ld [hl], a xor a ld [wContestMon], a - and a + and a ; BUGCONTEST_CAUGHT_MON ld [ScriptVar], a ret @@ -142,12 +142,12 @@ CheckPartyFullAfterContest: ; 4d9e5 call CloseSRAM xor a ld [wContestMon], a - ld a, $1 + ld a, BUGCONTEST_BOXED_MON ld [ScriptVar], a ret .DidntCatchAnything: ; 4db35 - ld a, $2 + ld a, BUGCONTEST_NO_CATCH ld [ScriptVar], a ret diff --git a/engine/decorations.asm b/engine/decorations.asm index c1b703fb6..bd9eb0251 100755 --- a/engine/decorations.asm +++ b/engine/decorations.asm @@ -1061,12 +1061,13 @@ INCLUDE "data/decorations/decorations.asm" DescribeDecoration:: ; 26f59 ld a, b - ld hl, JumpTable_DecorationDesc + ld hl, .JumpTable rst JumpTable ret ; 26f5f -JumpTable_DecorationDesc: ; 26f5f +.JumpTable: ; 26f5f +; entries correspond to DECODESC_* constants dw DecorationDesc_Poster dw DecorationDesc_LeftOrnament dw DecorationDesc_RightOrnament diff --git a/engine/events/daycare.asm b/engine/events/daycare.asm index 6395a40fb..ed6e16e87 100755 --- a/engine/events/daycare.asm +++ b/engine/events/daycare.asm @@ -465,14 +465,14 @@ Special_DayCareManOutside: ; 16936 .Load0: call PrintText - xor a + xor a ; FALSE ld [ScriptVar], a ret .PartyFull: ld hl, .PartyFullText call PrintText - ld a, $1 + ld a, TRUE ld [ScriptVar], a ret ; 16993 diff --git a/engine/events/fruit_trees.asm b/engine/events/fruit_trees.asm index d0b0bac15..768bedb0b 100644 --- a/engine/events/fruit_trees.asm +++ b/engine/events/fruit_trees.asm @@ -2,7 +2,7 @@ FruitTreeScript:: ; 44000 callasm GetCurTreeFruit opentext copybytetovar CurFruit - itemtotext $0, $0 + itemtotext USE_SCRIPT_VAR, MEM_BUFFER_0 writetext FruitBearingTreeText buttonsound callasm TryResetFruitTrees diff --git a/engine/events/happiness_egg.asm b/engine/events/happiness_egg.asm index a4ae8b7e6..df58c7143 100755 --- a/engine/events/happiness_egg.asm +++ b/engine/events/happiness_egg.asm @@ -21,7 +21,7 @@ CheckFirstMonIsEgg: ; 71ac ld a, [PartySpecies] ld [wd265], a cp EGG - ld a, $1 + ld a, 1 jr z, .egg xor a diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm index dac46d2e2..0f20d76b6 100755 --- a/engine/events/heal_machine_anim.asm +++ b/engine/events/heal_machine_anim.asm @@ -47,6 +47,7 @@ HealMachineAnim: ; 12324 ; 12365 .Pointers: ; 12365 +; entries correspond to HEALMACHINE_* constants dw .Pokecenter dw .ElmLab dw .HallOfFame diff --git a/engine/events/kurt.asm b/engine/events/kurt.asm index 9bc06a613..3cabfd6f1 100644 --- a/engine/events/kurt.asm +++ b/engine/events/kurt.asm @@ -76,7 +76,7 @@ Kurt_SelectApricorn: ; 88055 jr nz, .done .nope - xor a + xor a ; FALSE .done ld c, a diff --git a/engine/events/magikarp.asm b/engine/events/magikarp.asm index 68e8baad7..336d27e79 100644 --- a/engine/events/magikarp.asm +++ b/engine/events/magikarp.asm @@ -52,22 +52,22 @@ Special_CheckMagikarpLength: ; fbb32 ld hl, PartyMonOT call SkipNames call CopyBytes - ld a, 3 + ld a, MAGIKARPLENGTH_BEAT_RECORD ld [ScriptVar], a ret .not_long_enough - ld a, 2 + ld a, MAGIKARPLENGTH_TOO_SHORT ld [ScriptVar], a ret .declined - ld a, 1 + ld a, MAGIKARPLENGTH_REFUSED ld [ScriptVar], a ret .not_magikarp - xor a + xor a ; MAGIKARPLENGTH_NOT_MAGIKARP ld [ScriptVar], a ret ; fbba9 diff --git a/engine/events/misc_scripts_2.asm b/engine/events/misc_scripts_2.asm index c4c51d5e6..29416a9e5 100644 --- a/engine/events/misc_scripts_2.asm +++ b/engine/events/misc_scripts_2.asm @@ -13,7 +13,7 @@ RepelWoreOffScript:: ; 0x13619 HiddenItemScript:: ; 0x13625 opentext copybytetovar EngineBuffer3 - itemtotext 0, 0 + itemtotext USE_SCRIPT_VAR, MEM_BUFFER_0 writetext .found_text giveitem ITEM_FROM_MEM iffalse .bag_full diff --git a/engine/events/move_tutor.asm b/engine/events/move_tutor.asm index a15ecaf93..802b9ef21 100644 --- a/engine/events/move_tutor.asm +++ b/engine/events/move_tutor.asm @@ -22,7 +22,7 @@ Special_MoveTutor: ; 4925b .enter_loop call CheckCanLearnMoveTutorMove jr nc, .loop - xor a + xor a ; FALSE ld [ScriptVar], a jr .quit @@ -35,10 +35,11 @@ Special_MoveTutor: ; 4925b .GetMoveTutorMove: ; 492a5 ld a, [ScriptVar] - cp 1 + cp MOVETUTOR_FLAMETHROWER jr z, .flamethrower - cp 2 + cp MOVETUTOR_THUNDERBOLT jr z, .thunderbolt + ; MOVETUTOR_ICE_BEAM ld a, ICE_BEAM ret diff --git a/engine/events/special.asm b/engine/events/special.asm index 939db4a25..9bd83f068 100755 --- a/engine/events/special.asm +++ b/engine/events/special.asm @@ -1,3 +1,5 @@ +MANIA_OT_ID EQU 00518 + SpecialGiveShuckle: ; 7305 ; Adding to the party. @@ -32,9 +34,9 @@ SpecialGiveShuckle: ; 7305 ; OT ID. ld hl, PartyMon1ID call AddNTimes - ld a, $2 + ld a, HIGH(MANIA_OT_ID) ld [hli], a - ld [hl], $6 + ld [hl], LOW(MANIA_OT_ID) ; Nickname. ld a, [PartyCount] @@ -54,8 +56,7 @@ SpecialGiveShuckle: ; 7305 ; Engine flag for this event. ld hl, wDailyFlags - set 5, [hl] -; setflag ENGINE_SHUCKLE_GIVEN + set 5, [hl] ; ENGINE_SHUCKLE_GIVEN ld a, 1 ld [ScriptVar], a ret @@ -85,10 +86,10 @@ SpecialReturnShuckle: ; 737e ; OT ID ld a, [hli] - cp HIGH(00518) + cp HIGH(MANIA_OT_ID) jr nz, .DontReturn ld a, [hl] - cp LOW(00518) + cp LOW(MANIA_OT_ID) jr nz, .DontReturn ; OT @@ -115,28 +116,28 @@ SpecialReturnShuckle: ; 737e call AddNTimes ld a, [hl] cp 150 - ld a, $3 + ld a, SHUCKIE_HAPPY jr nc, .HappyToStayWithYou xor a ; take from pc ld [wPokemonWithdrawDepositParameter], a callfar RemoveMonFromPartyOrBox - ld a, $2 + ld a, SHUCKIE_RETURNED .HappyToStayWithYou: ld [ScriptVar], a ret .refused - ld a, $1 + ld a, SHUCKIE_REFUSED ld [ScriptVar], a ret .DontReturn: - xor a + xor a ; SHUCKIE_WRONG_MON ld [ScriptVar], a ret .fainted - ld a, $4 + ld a, SHUCKIE_FAINTED ld [ScriptVar], a ret diff --git a/engine/events/std_scripts.asm b/engine/events/std_scripts.asm index da2d38138..708165046 100644 --- a/engine/events/std_scripts.asm +++ b/engine/events/std_scripts.asm @@ -113,7 +113,7 @@ PokecenterNurseScript: pause 10 special HealParty playmusic MUSIC_NONE - writebyte 0 ; Machine is at a Pokemon Center + writebyte HEALMACHINE_POKECENTER special HealMachineAnim pause 30 special RestartMapMusic @@ -251,25 +251,25 @@ DayToTextScript: if_equal THURSDAY, .Thursday if_equal FRIDAY, .Friday if_equal SATURDAY, .Saturday - stringtotext .SundayText, 0 + stringtotext .SundayText, MEM_BUFFER_0 end .Monday: - stringtotext .MondayText, 0 + stringtotext .MondayText, MEM_BUFFER_0 end .Tuesday: - stringtotext .TuesdayText, 0 + stringtotext .TuesdayText, MEM_BUFFER_0 end .Wednesday: - stringtotext .WednesdayText, 0 + stringtotext .WednesdayText, MEM_BUFFER_0 end .Thursday: - stringtotext .ThursdayText, 0 + stringtotext .ThursdayText, MEM_BUFFER_0 end .Friday: - stringtotext .FridayText, 0 + stringtotext .FridayText, MEM_BUFFER_0 end .Saturday: - stringtotext .SaturdayText, 0 + stringtotext .SaturdayText, MEM_BUFFER_0 end .SundayText: db "SUNDAY@" @@ -298,7 +298,7 @@ RadioTowerRocketsScript: clearevent EVENT_USED_THE_CARD_KEY_IN_THE_RADIO_TOWER setevent EVENT_MAHOGANY_TOWN_POKEFAN_M_BLOCKS_EAST specialphonecall SPECIALCALL_WEIRDBROADCAST - setmapscene MAHOGANY_TOWN, $1 + setmapscene MAHOGANY_TOWN, 1 end BugContestResultsWarpScript: @@ -307,7 +307,7 @@ BugContestResultsWarpScript: setevent EVENT_ROUTE_36_NATIONAL_PARK_GATE_OFFICER_CONTEST_DAY clearevent EVENT_ROUTE_36_NATIONAL_PARK_GATE_OFFICER_NOT_CONTEST_DAY setevent EVENT_WARPED_FROM_ROUTE_35_NATIONAL_PARK_GATE - warp ROUTE_36_NATIONAL_PARK_GATE, $0, $4 + warp ROUTE_36_NATIONAL_PARK_GATE, 0, 4 applymovement PLAYER, Movement_ContestResults_WalkAfterWarp BugContestResultsScript: @@ -321,7 +321,7 @@ BugContestResultsScript: farwritetext ContestResults_ReadyToJudgeText waitbutton special BugContestJudging - RAM2MEM $0 + vartomem MEM_BUFFER_0 if_equal 1, BugContestResults_FirstPlace if_equal 2, BugContestResults_SecondPlace if_equal 3, BugContestResults_ThirdPlace @@ -349,14 +349,15 @@ BugContestResults_FinishUp special ContestReturnMons BugContestResults_DidNotLeaveMons special CheckPartyFullAfterContest - if_equal $0, BugContestResults_CleanUp - if_equal $2, BugContestResults_CleanUp + if_equal BUGCONTEST_CAUGHT_MON, BugContestResults_CleanUp + if_equal BUGCONTEST_NO_CATCH, BugContestResults_CleanUp + ; BUGCONTEST_BOXED_MON farwritetext ContestResults_PartyFullText waitbutton BugContestResults_CleanUp closetext - setscene $0 - setmapscene ROUTE_35_NATIONAL_PARK_GATE, $0 + setscene 0 + setmapscene ROUTE_35_NATIONAL_PARK_GATE, 0 setevent EVENT_BUG_CATCHING_CONTESTANT_1A setevent EVENT_BUG_CATCHING_CONTESTANT_2A setevent EVENT_BUG_CATCHING_CONTESTANT_3A @@ -384,7 +385,7 @@ BugContestResults_CleanUp BugContestResults_FirstPlace ; 0xbc31e setevent EVENT_GAVE_KURT_APRICORNS - itemtotext SUN_STONE, $1 + itemtotext SUN_STONE, MEM_BUFFER_1 farwritetext ContestResults_PlayerWonAPrizeText waitbutton verbosegiveitem SUN_STONE @@ -393,7 +394,7 @@ BugContestResults_FirstPlace ; 0xbc31e ; 0xbc332 BugContestResults_SecondPlace ; 0xbc332 - itemtotext EVERSTONE, $1 + itemtotext EVERSTONE, MEM_BUFFER_1 farwritetext ContestResults_PlayerWonAPrizeText waitbutton verbosegiveitem EVERSTONE @@ -402,7 +403,7 @@ BugContestResults_SecondPlace ; 0xbc332 ; 0xbc343 BugContestResults_ThirdPlace ; 0xbc343 - itemtotext GOLD_BERRY, $1 + itemtotext GOLD_BERRY, MEM_BUFFER_1 farwritetext ContestResults_PlayerWonAPrizeText waitbutton verbosegiveitem GOLD_BERRY @@ -1759,7 +1760,7 @@ RematchGiftFScript: end GymStatue1Script: - mapnametotext $0 + mapnametotext MEM_BUFFER_0 opentext farwritetext GymStatue_CityGymText waitbutton @@ -1767,7 +1768,7 @@ GymStatue1Script: end GymStatue2Script: - mapnametotext $0 + mapnametotext MEM_BUFFER_0 opentext farwritetext GymStatue_CityGymText buttonsound @@ -1813,18 +1814,18 @@ CoinVendor_IntroScript: ; 0xbcde0 loadmenudata .MenuDataHeader verticalmenu closewindow - if_equal $1, .Buy50 - if_equal $2, .Buy500 + if_equal 1, .Buy50 + if_equal 2, .Buy500 jump .Cancel ; 0xbcdf7 .Buy50: ; 0xbcdf7 checkcoins MAX_COINS - 50 - if_equal $0, .CoinCaseFull - checkmoney $0, 1000 - if_equal $2, .NotEnoughMoney + if_equal HAVE_MORE, .CoinCaseFull + checkmoney YOUR_MONEY, 1000 + if_equal HAVE_LESS, .NotEnoughMoney givecoins 50 - takemoney $0, 1000 + takemoney YOUR_MONEY, 1000 waitsfx playsound SFX_TRANSACTION farwritetext CoinVendor_Buy50CoinsText @@ -1834,11 +1835,11 @@ CoinVendor_IntroScript: ; 0xbcde0 .Buy500: ; 0xbce1b checkcoins MAX_COINS - 500 - if_equal $0, .CoinCaseFull - checkmoney $0, 10000 - if_equal $2, .NotEnoughMoney + if_equal HAVE_MORE, .CoinCaseFull + checkmoney YOUR_MONEY, 10000 + if_equal HAVE_LESS, .NotEnoughMoney givecoins 500 - takemoney $0, 10000 + takemoney YOUR_MONEY, 10000 waitsfx playsound SFX_TRANSACTION farwritetext CoinVendor_Buy500CoinsText diff --git a/engine/events/whiteout.asm b/engine/events/whiteout.asm index a9d6f900e..14a7066f1 100755 --- a/engine/events/whiteout.asm +++ b/engine/events/whiteout.asm @@ -4,7 +4,7 @@ Script_BattleWhiteout:: ; 0x124c1 ; 0x124c8 Script_OverworldWhiteout:: ; 0x124c8 - refreshscreen $0 + refreshscreen callasm OverworldBGMap Script_Whiteout: ; 0x124ce diff --git a/engine/mail.asm b/engine/mail.asm index 0335a6dfe..c860693be 100755 --- a/engine/mail.asm +++ b/engine/mail.asm @@ -128,7 +128,7 @@ CheckPokeItem:: ; 44654 push bc push de farcall SelectMonFromParty - ld a, $2 + ld a, POKEMAIL_REFUSED jr c, .pop_return ld a, [CurPartyMon] @@ -137,7 +137,7 @@ CheckPokeItem:: ; 44654 call AddNTimes ld d, [hl] farcall ItemIsMail - ld a, $3 + ld a, POKEMAIL_NO_MAIL jr nc, .pop_return ld a, BANK(sPartyMail) @@ -162,7 +162,7 @@ CheckPokeItem:: ; 44654 cp "@" jr z, .done cp c - ld a, $0 + ld a, POKEMAIL_WRONG_MAIL jr nz, .close_sram_return inc hl inc de @@ -173,12 +173,12 @@ CheckPokeItem:: ; 44654 .done farcall CheckCurPartyMonFainted - ld a, $4 + ld a, POKEMAIL_LAST_MON jr c, .close_sram_return xor a ld [wPokemonWithdrawDepositParameter], a farcall RemoveMonFromPartyOrBox - ld a, $1 + ld a, POKEMAIL_CORRECT .close_sram_return call CloseSRAM diff --git a/engine/phone/phone.asm b/engine/phone/phone.asm index 9a22ff143..630249bf2 100644 --- a/engine/phone/phone.asm +++ b/engine/phone/phone.asm @@ -437,7 +437,7 @@ WrongNumber: ; 90233 ; 90241 Script_ReceivePhoneCall: ; 0x90241 - refreshscreen $0 + refreshscreen callasm RingTwice_StartCall ptcall wPhoneScriptPointer waitbutton diff --git a/engine/phone/phone_scripts.asm b/engine/phone/phone_scripts.asm index 62eb4ac87..c34113437 100644 --- a/engine/phone/phone_scripts.asm +++ b/engine/phone/phone_scripts.asm @@ -20,10 +20,10 @@ MomPhoneScript: ; 0xbceaa iftrue MomPhoneHangUpScript farwritetext MomPhoneGreetingText buttonsound - mapnametotext $0 + mapnametotext MEM_BUFFER_0 checkcode VAR_ROOFPALETTE - if_equal $1, MomPhonePalette1 - if_equal $2, MomPhonePalette2 + if_equal 1, MomPhonePalette1 + if_equal 2, MomPhonePalette2 jump MomPhoneOther MomPhoneLandmark: ; 0xbcedf @@ -53,13 +53,13 @@ MomPhonePalette1: ; 0xbcee7 jump MomSavingMoney .violet ; 0xbcf15 - landmarktotext SPROUT_TOWER, 1 + landmarktotext SPROUT_TOWER, MEM_BUFFER_1 jump MomPhoneLandmark .azalea ; 0xbcf1b - landmarktotext SLOWPOKE_WELL, 1 + landmarktotext SLOWPOKE_WELL, MEM_BUFFER_1 jump MomPhoneLandmark .goldenrod ; 0xbcf21 - landmarktotext RADIO_TOWER, 1 + landmarktotext RADIO_TOWER, MEM_BUFFER_1 jump MomPhoneLandmark MomPhonePalette2: ; 0xbcf27 @@ -75,17 +75,17 @@ MomPhoneOther: ; 0xbcf2f MomSavingMoney: ; 0xbcf37 checkflag ENGINE_MOM_SAVING_MONEY iffalse MomIsNotSaving - checkmoney $1, 0 - if_equal $0, MomSavingHasMoney + checkmoney MOMS_MONEY, 0 + if_equal HAVE_MORE, MomSavingHasMoney jump MomSavingButBroke MomIsNotSaving: ; 0xbcf49 - checkmoney $1, 0 - if_equal $0, MomHasMoney + checkmoney MOMS_MONEY, 0 + if_equal HAVE_MORE, MomHasMoney jump MomHasNoMoney MomSavingHasMoney: ; 0xbcf55 - readmoney $1, $0 + readmoney MOMS_MONEY, MEM_BUFFER_0 farwritetext MomCheckBalanceText yesorno iftrue MomPhoneSaveMoneyScript @@ -104,7 +104,7 @@ MomHasNoMoney: ; 0xbcf6e jump MomPhoneWontSaveMoneyScript MomHasMoney: ; 0xbcf79 - readmoney $1, $0 + readmoney MOMS_MONEY, MEM_BUFFER_0 farwritetext MomYouveSavedText yesorno iftrue MomPhoneSaveMoneyScript @@ -172,9 +172,9 @@ BillPhoneScript1: ; 0xbcfc5 farwritetext BillPhoneGeneriText buttonsound checkcode VAR_BOXSPACE - RAM2MEM $0 - if_equal $0, .full - if_less_than $6, .nearlyfull + vartomem MEM_BUFFER_0 + if_equal 0, .full + if_less_than PARTY_LENGTH, .nearlyfull farwritetext BillPhoneNotFullText end @@ -195,7 +195,7 @@ BillPhoneScript2: ; 0xbd007 ElmPhoneScript1: ; 0xbd00d checkcode VAR_SPECIALPHONECALL - if_equal $1, .pokerus + if_equal SPECIALCALL_POKERUS, .pokerus checkevent EVENT_SHOWED_TOGEPI_TO_ELM iftrue .discovery checkevent EVENT_GOT_TOGEPI_EGG_FROM_ELMS_AIDE @@ -242,8 +242,8 @@ ElmPhoneScript1: ; 0xbd00d end .discovery ; 0xbd069 - random $2 - if_equal $0, .nextdiscovery + random 2 + if_equal 0, .nextdiscovery farwritetext ElmPhoneDiscovery1Text end @@ -258,11 +258,11 @@ ElmPhoneScript1: ; 0xbd00d ElmPhoneScript2: ; 0xbd081 checkcode VAR_SPECIALPHONECALL - if_equal $2, .disaster - if_equal $3, .assistant - if_equal $4, .rocket - if_equal $5, .gift - if_equal $8, .gift + if_equal SPECIALCALL_ROBBED, .disaster + if_equal SPECIALCALL_ASSISTANT, .assistant + if_equal SPECIALCALL_WEIRDBROADCAST, .rocket + if_equal SPECIALCALL_SSTICKET, .gift + if_equal SPECIALCALL_MASTERBALL, .gift farwritetext ElmPhonePokerusText specialphonecall SPECIALCALL_NONE end @@ -299,7 +299,7 @@ ElmPhoneScript2: ; 0xbd081 ; Jack JackPhoneScript1: - trainertotext SCHOOLBOY, JACK1, $0 + trainertotext SCHOOLBOY, JACK1, MEM_BUFFER_0 checkflag ENGINE_JACK iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Male @@ -314,31 +314,31 @@ JackPhoneScript1: farjump JackPhoneTips .WantsBattle: - landmarktotext NATIONAL_PARK, $2 + landmarktotext NATIONAL_PARK, MEM_BUFFER_2 farjump JackWantsBattleScript JackPhoneScript2: - trainertotext SCHOOLBOY, JACK1, $0 + trainertotext SCHOOLBOY, JACK1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male farscall PhoneScript_Random2 - if_equal $0, JackBattleTrivia + if_equal 0, JackBattleTrivia checkflag ENGINE_JACK iftrue .WaitingForBattle checkflag ENGINE_JACK_MONDAY_MORNING iftrue .WaitingForBattle farscall PhoneScript_Random2 - if_equal $0, JackWantsToBattle + if_equal 0, JackWantsToBattle .WaitingForBattle: farscall PhoneScript_Random3 - if_equal $0, JackFindsRare + if_equal 0, JackFindsRare farjump Phone_GenericCall_Male JackMondayMorning: setflag ENGINE_JACK_MONDAY_MORNING JackWantsToBattle: - landmarktotext NATIONAL_PARK, $2 + landmarktotext NATIONAL_PARK, MEM_BUFFER_2 setflag ENGINE_JACK farjump PhoneScript_WantsToBattle_Male @@ -351,36 +351,36 @@ JackBattleTrivia: ; Beverly BeverlyPhoneScript1: - trainertotext POKEFANF, BEVERLY1, $0 + trainertotext POKEFANF, BEVERLY1, MEM_BUFFER_0 farscall PhoneScript_AnswerPhone_Female checkflag ENGINE_BEVERLY_HAS_NUGGET iftrue .HasNugget farjump UnknownScript_0xa0900 .HasNugget: - landmarktotext NATIONAL_PARK, $2 + landmarktotext NATIONAL_PARK, MEM_BUFFER_2 farjump UnknownScript_0xa0aa5 BeverlyPhoneScript2: - trainertotext POKEFANF, BEVERLY1, $0 + trainertotext POKEFANF, BEVERLY1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Female checkflag ENGINE_BEVERLY_HAS_NUGGET iftrue .HasNugget farscall PhoneScript_Random4 - if_equal $0, .FoundNugget + if_equal 0, .FoundNugget .HasNugget: farjump Phone_GenericCall_Female .FoundNugget: setflag ENGINE_BEVERLY_HAS_NUGGET - landmarktotext NATIONAL_PARK, $2 + landmarktotext NATIONAL_PARK, MEM_BUFFER_2 farjump PhoneScript_FoundItem_Female ; Huey HueyPhoneScript1: - trainertotext SAILOR, HUEY1, $0 + trainertotext SAILOR, HUEY1, MEM_BUFFER_0 checkflag ENGINE_HUEY iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Male @@ -396,19 +396,19 @@ HueyPhoneScript1: farjump UnknownScript_0xa0908 .WantsBattle: - landmarktotext LIGHTHOUSE, $2 + landmarktotext LIGHTHOUSE, MEM_BUFFER_2 farjump HueyWantsBattleScript HueyPhoneScript2: - trainertotext SAILOR, HUEY1, $0 + trainertotext SAILOR, HUEY1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male checkflag ENGINE_HUEY iftrue .Flavor checkflag ENGINE_HUEY_WEDNESDAY_NIGHT iftrue .Flavor farscall PhoneScript_Random3 - if_equal $0, HueyWantsBattle - if_equal $1, HueyWantsBattle + if_equal 0, HueyWantsBattle + if_equal 1, HueyWantsBattle .Flavor: farjump PhoneScript_MonFlavorText @@ -417,14 +417,14 @@ HueyWednesdayNight: setflag ENGINE_HUEY_WEDNESDAY_NIGHT HueyWantsBattle: - landmarktotext LIGHTHOUSE, $2 + landmarktotext LIGHTHOUSE, MEM_BUFFER_2 setflag ENGINE_HUEY farjump PhoneScript_WantsToBattle_Male ; Gaven GavenPhoneScript1: - trainertotext COOLTRAINERM, GAVEN3, $0 + trainertotext COOLTRAINERM, GAVEN3, MEM_BUFFER_0 checkflag ENGINE_GAVEN iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Male @@ -439,29 +439,29 @@ GavenPhoneScript1: farjump UnknownScript_0xa0910 .WantsBattle: - landmarktotext ROUTE_26, $2 + landmarktotext ROUTE_26, MEM_BUFFER_2 farjump UnknownScript_0xa0a37 GavenPhoneScript2: - trainertotext COOLTRAINERM, GAVEN3, $0 + trainertotext COOLTRAINERM, GAVEN3, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male checkflag ENGINE_GAVEN iftrue .WaitingForBattle checkflag ENGINE_GAVEN_THURSDAY_MORNING iftrue .WaitingForBattle farscall PhoneScript_Random2 - if_equal $0, GavenWantsRematch + if_equal 0, GavenWantsRematch .WaitingForBattle: farscall PhoneScript_Random3 - if_equal $0, GavenFoundRare + if_equal 0, GavenFoundRare farjump Phone_GenericCall_Male GavenThursdayMorning: setflag ENGINE_GAVEN_THURSDAY_MORNING GavenWantsRematch: - landmarktotext ROUTE_26, $2 + landmarktotext ROUTE_26, MEM_BUFFER_2 setflag ENGINE_GAVEN farjump PhoneScript_WantsToBattle_Male @@ -471,7 +471,7 @@ GavenFoundRare: ; Beth BethPhoneScript1: - trainertotext COOLTRAINERF, BETH1, $0 + trainertotext COOLTRAINERF, BETH1, MEM_BUFFER_0 checkflag ENGINE_BETH iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Female @@ -486,18 +486,18 @@ BethPhoneScript1: farjump UnknownScript_0xa0918 .WantsBattle: - landmarktotext ROUTE_26, $2 + landmarktotext ROUTE_26, MEM_BUFFER_2 farjump BethBattleReminderScript BethPhoneScript2: - trainertotext COOLTRAINERF, BETH1, $0 + trainertotext COOLTRAINERF, BETH1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Female checkflag ENGINE_BETH iftrue .Generic checkflag ENGINE_BETH_FRIDAY_AFTERNOON iftrue .Generic farscall PhoneScript_Random2 - if_equal $0, BethWantsBattle + if_equal 0, BethWantsBattle .Generic: farjump Phone_GenericCall_Female @@ -506,14 +506,14 @@ BethFridayAfternoon: setflag ENGINE_BETH_FRIDAY_AFTERNOON BethWantsBattle: - landmarktotext ROUTE_26, $2 + landmarktotext ROUTE_26, MEM_BUFFER_2 setflag ENGINE_BETH farjump PhoneScript_WantsToBattle_Female ; Jose JosePhoneScript1: - trainertotext BIRD_KEEPER, JOSE2, $0 + trainertotext BIRD_KEEPER, JOSE2, MEM_BUFFER_0 checkflag ENGINE_JOSE iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Male @@ -530,15 +530,15 @@ JosePhoneScript1: farjump UnknownScript_0xa0920 .WantsBattle: - landmarktotext ROUTE_27, $2 + landmarktotext ROUTE_27, MEM_BUFFER_2 farjump UnknownScript_0xa0a41 .HasItem: - landmarktotext ROUTE_27, $2 + landmarktotext ROUTE_27, MEM_BUFFER_2 farjump UnknownScript_0xa0a41 JosePhoneScript2: - trainertotext BIRD_KEEPER, JOSE2, $0 + trainertotext BIRD_KEEPER, JOSE2, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male checkflag ENGINE_JOSE iftrue .Generic @@ -547,20 +547,20 @@ JosePhoneScript2: checkflag ENGINE_JOSE_HAS_STAR_PIECE iftrue .Generic farscall PhoneScript_Random3 - if_equal $0, JoseWantsBattle + if_equal 0, JoseWantsBattle farscall PhoneScript_Random3 - if_equal $0, JoseHasStarPiece + if_equal 0, JoseHasStarPiece .Generic: farscall PhoneScript_Random3 - if_equal $0, JoseFoundRare + if_equal 0, JoseFoundRare farjump Phone_GenericCall_Male JoseSaturdayNight: setflag ENGINE_JOSE_SATURDAY_NIGHT JoseWantsBattle: - landmarktotext ROUTE_27, $2 + landmarktotext ROUTE_27, MEM_BUFFER_2 setflag ENGINE_JOSE farjump PhoneScript_WantsToBattle_Male @@ -569,13 +569,13 @@ JoseFoundRare: JoseHasStarPiece: setflag ENGINE_JOSE_HAS_STAR_PIECE - landmarktotext ROUTE_27, $2 + landmarktotext ROUTE_27, MEM_BUFFER_2 farjump PhoneScript_FoundItem_Male ; Reena ReenaPhoneScript1: - trainertotext COOLTRAINERF, REENA1, $0 + trainertotext COOLTRAINERF, REENA1, MEM_BUFFER_0 checkflag ENGINE_REENA iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Female @@ -590,18 +590,18 @@ ReenaPhoneScript1: farjump UnknownScript_0xa0928 .WantsBattle: - landmarktotext ROUTE_27, $2 + landmarktotext ROUTE_27, MEM_BUFFER_2 farjump UnknownScript_0xa0a46 ReenaPhoneScript2: - trainertotext COOLTRAINERF, REENA1, $0 + trainertotext COOLTRAINERF, REENA1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Female checkflag ENGINE_REENA iftrue .Generic checkflag ENGINE_REENA_SUNDAY_MORNING iftrue .Generic farscall PhoneScript_Random2 - if_equal $0, ReenaWantsBattle + if_equal 0, ReenaWantsBattle .Generic: farjump Phone_GenericCall_Female @@ -610,14 +610,14 @@ ReenaSundayMorning: setflag ENGINE_REENA_SUNDAY_MORNING ReenaWantsBattle: - landmarktotext ROUTE_27, $2 + landmarktotext ROUTE_27, MEM_BUFFER_2 setflag ENGINE_REENA farjump PhoneScript_WantsToBattle_Female ; Joey JoeyPhoneScript1: - trainertotext YOUNGSTER, JOEY1, $0 + trainertotext YOUNGSTER, JOEY1, MEM_BUFFER_0 checkflag ENGINE_JOEY iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Male @@ -633,19 +633,19 @@ JoeyPhoneScript1: farjump UnknownScript_0xa0930 .WantsBattle: - landmarktotext ROUTE_30, $2 + landmarktotext ROUTE_30, MEM_BUFFER_2 farjump UnknownScript_0xa0a4b JoeyPhoneScript2: - trainertotext YOUNGSTER, JOEY1, $0 + trainertotext YOUNGSTER, JOEY1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male checkflag ENGINE_JOEY iftrue .Generic checkflag ENGINE_JOEY_MONDAY_AFTERNOON iftrue .Generic farscall PhoneScript_Random3 - if_equal $0, JoeyWantsBattle - if_equal $1, JoeyWantsBattle + if_equal 0, JoeyWantsBattle + if_equal 1, JoeyWantsBattle .Generic: farjump Phone_GenericCall_Male @@ -654,14 +654,14 @@ JoeyMondayAfternoon: setflag ENGINE_JOEY_MONDAY_AFTERNOON JoeyWantsBattle: - landmarktotext ROUTE_30, $2 + landmarktotext ROUTE_30, MEM_BUFFER_2 setflag ENGINE_JOEY farjump PhoneScript_WantsToBattle_Male ; Wade WadePhoneScript1: - trainertotext BUG_CATCHER, WADE1, $0 + trainertotext BUG_CATCHER, WADE1, MEM_BUFFER_0 checkflag ENGINE_WADE iftrue WadeWantsBattle farscall PhoneScript_AnswerPhone_Male @@ -676,7 +676,7 @@ WadePhoneScript1: .NotTuesday: farscall PhoneScript_Random2 - if_equal $0, .NoContest + if_equal 0, .NoContest checkflag ENGINE_DAILY_BUG_CONTEST iftrue .NoContest checkcode VAR_WEEKDAY @@ -691,18 +691,18 @@ WadeContestToday: farjump PhoneScript_BugCatchingContest WadeWantsBattle: - landmarktotext ROUTE_31, $2 + landmarktotext ROUTE_31, MEM_BUFFER_2 farjump UnknownScript_0xa0a50 WadeHasItem: - landmarktotext ROUTE_31, $2 + landmarktotext ROUTE_31, MEM_BUFFER_2 farjump UnknownScript_0xa0ab5 WadePhoneScript2: - trainertotext BUG_CATCHER, WADE1, $0 + trainertotext BUG_CATCHER, WADE1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male farscall PhoneScript_Random2 - if_equal $0, .NoContest + if_equal 0, .NoContest checkflag ENGINE_DAILY_BUG_CONTEST iftrue .NoContest checkcode VAR_WEEKDAY @@ -718,15 +718,15 @@ WadePhoneScript2: checkflag ENGINE_WADE_HAS_ITEM iftrue .next farscall PhoneScript_Random2 - if_equal $0, WadeHasItem2 + if_equal 0, WadeHasItem2 checkflag ENGINE_FLYPOINT_GOLDENROD iffalse .next farscall PhoneScript_Random2 - if_equal $0, WadeWantsBattle2 + if_equal 0, WadeWantsBattle2 .next: farscall PhoneScript_Random3 - if_equal $0, WadeFoundRare + if_equal 0, WadeFoundRare farjump Phone_GenericCall_Male Wade_ContestToday: @@ -736,7 +736,7 @@ WadeTuesdayNight: setflag ENGINE_WADE_TUESDAY_NIGHT WadeWantsBattle2: - landmarktotext ROUTE_31, $2 + landmarktotext ROUTE_31, MEM_BUFFER_2 setflag ENGINE_WADE farjump PhoneScript_WantsToBattle_Male @@ -745,16 +745,16 @@ WadeFoundRare: WadeHasItem2: setflag ENGINE_WADE_HAS_ITEM - landmarktotext ROUTE_31, $2 + landmarktotext ROUTE_31, MEM_BUFFER_2 clearevent EVENT_WADE_HAS_BERRY clearevent EVENT_WADE_HAS_PSNCUREBERRY clearevent EVENT_WADE_HAS_PRZCUREBERRY clearevent EVENT_WADE_HAS_BITTER_BERRY - random $4 - if_equal $0, .Berry - if_equal $1, .PsnCureBerry - if_equal $2, .PrzCureBerry - if_equal $3, .Bitterberry + random 4 + if_equal 0, .Berry + if_equal 1, .PsnCureBerry + if_equal 2, .PrzCureBerry + if_equal 3, .Bitterberry .Berry: setevent EVENT_WADE_HAS_BERRY @@ -777,7 +777,7 @@ WadeHasItem2: ; Ralph RalphPhoneScript1: - trainertotext FISHER, RALPH1, $0 + trainertotext FISHER, RALPH1, MEM_BUFFER_0 checkflag ENGINE_RALPH iftrue Ralph_Rematch farscall PhoneScript_AnswerPhone_Male @@ -793,15 +793,15 @@ Ralph_CheckSwarm: farjump UnknownScript_0xa0940 Ralph_Rematch: - landmarktotext ROUTE_32, $2 + landmarktotext ROUTE_32, MEM_BUFFER_2 farjump UnknownScript_0xa0a55 Ralph_ReportSwarm: - landmarktotext ROUTE_32, $2 + landmarktotext ROUTE_32, MEM_BUFFER_2 farjump UnknownScript_0xa0af5 RalphPhoneScript2: - trainertotext FISHER, RALPH1, $0 + trainertotext FISHER, RALPH1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male checkflag ENGINE_FLYPOINT_GOLDENROD iffalse Ralph_CheckSwarm2 @@ -810,16 +810,16 @@ RalphPhoneScript2: checkflag ENGINE_RALPH_WEDNESDAY_MORNING iftrue Ralph_CheckSwarm2 farscall PhoneScript_Random2 - if_equal $0, Ralph_FightMe + if_equal 0, Ralph_FightMe Ralph_CheckSwarm2: farscall PhoneScript_Random5 - if_equal $0, Ralph_SetUpSwarm + if_equal 0, Ralph_SetUpSwarm farjump Phone_GenericCall_Male Ralph_WednesdayMorning: setflag ENGINE_RALPH_WEDNESDAY_MORNING Ralph_FightMe: - landmarktotext ROUTE_32, $2 + landmarktotext ROUTE_32, MEM_BUFFER_2 setflag ENGINE_RALPH farjump PhoneScript_WantsToBattle_Male @@ -827,8 +827,8 @@ Ralph_SetUpSwarm: checkflag ENGINE_SPECIAL_WILDDATA iftrue .Generic setflag ENGINE_SPECIAL_WILDDATA - pokenamemem QWILFISH, $1 - landmarktotext ROUTE_32, $2 + pokenamemem QWILFISH, MEM_BUFFER_1 + landmarktotext ROUTE_32, MEM_BUFFER_2 writebyte FISHSWARM_QWILFISH special Special_ActivateFishingSwarm farjump UnknownScript_0xa05d6 @@ -839,7 +839,7 @@ Ralph_SetUpSwarm: ; Liz LizPhoneScript1: - trainertotext PICNICKER, LIZ1, $0 + trainertotext PICNICKER, LIZ1, MEM_BUFFER_0 checkflag ENGINE_LIZ iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Female @@ -855,13 +855,13 @@ LizPhoneScript1: farjump UnknownScript_0xa0948 .WantsBattle: - landmarktotext ROUTE_32, $2 + landmarktotext ROUTE_32, MEM_BUFFER_2 farjump UnknownScript_0xa0a5a LizPhoneScript2: - trainertotext PICNICKER, LIZ1, $0 + trainertotext PICNICKER, LIZ1, MEM_BUFFER_0 farscall PhoneScript_Random4 - if_equal $0, LizWrongNumber + if_equal 0, LizWrongNumber farscall PhoneScript_GreetPhone_Female checkflag ENGINE_LIZ iftrue .next @@ -870,11 +870,11 @@ LizPhoneScript2: .next: farscall PhoneScript_Random2 - if_equal $0, LizGossip + if_equal 0, LizGossip checkflag ENGINE_FLYPOINT_GOLDENROD iffalse .Generic farscall PhoneScript_Random2 - if_equal $0, LizWantsBattle + if_equal 0, LizWantsBattle .Generic: farjump Phone_GenericCall_Female @@ -883,7 +883,7 @@ LizThursdayAfternoon: setflag ENGINE_LIZ_THURSDAY_AFTERNOON LizWantsBattle: - landmarktotext ROUTE_32, $2 + landmarktotext ROUTE_32, MEM_BUFFER_2 setflag ENGINE_LIZ farjump PhoneScript_WantsToBattle_Female @@ -891,51 +891,51 @@ LizWrongNumber: farjump LizWrongNumberScript LizGossip: - random $9 - if_equal $0, .CoolTrainerM - if_equal $1, .Beauty - if_equal $2, .Grunt - if_equal $3, .Teacher - if_equal $4, .SwimmerF - if_equal $5, .KimonoGirl - if_equal $6, .Skier - if_equal $7, .Medium - if_equal $8, .PokefanM + random 9 + if_equal 0, .CoolTrainerM + if_equal 1, .Beauty + if_equal 2, .Grunt + if_equal 3, .Teacher + if_equal 4, .SwimmerF + if_equal 5, .KimonoGirl + if_equal 6, .Skier + if_equal 7, .Medium + if_equal 8, .PokefanM .CoolTrainerM: - trainerclassname COOLTRAINERM, $1 + trainerclassname COOLTRAINERM, NICK jump LizGossipScript .Beauty: - trainerclassname BEAUTY, $1 + trainerclassname BEAUTY, VICTORIA jump LizGossipScript .Grunt: - trainerclassname GRUNTM, $1 + trainerclassname GRUNTM, GRUNTM_1 jump LizGossipScript .Teacher: - trainerclassname TEACHER, $1 + trainerclassname TEACHER, COLETTE jump LizGossipScript .SwimmerF: - trainerclassname SWIMMERF, $1 + trainerclassname SWIMMERF, ELAINE jump LizGossipScript .KimonoGirl: - trainerclassname KIMONO_GIRL, $1 + trainerclassname KIMONO_GIRL, NAOKO1 jump LizGossipScript .Skier: - trainerclassname SKIER, $1 + trainerclassname SKIER, ROXANNE jump LizGossipScript .Medium: - trainerclassname MEDIUM, $1 + trainerclassname MEDIUM, MARTHA jump LizGossipScript .PokefanM: - trainerclassname POKEFANM, $1 + trainerclassname POKEFANM, WILLIAM jump LizGossipScript LizGossipScript: @@ -944,7 +944,7 @@ LizGossipScript: ; Anthony AnthonyPhoneScript1: - trainertotext HIKER, ANTHONY2, $0 + trainertotext HIKER, ANTHONY2, MEM_BUFFER_0 checkflag ENGINE_ANTHONY iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Male @@ -961,15 +961,15 @@ AnthonyPhoneScript1: farjump UnknownScript_0xa0950 .WantsBattle: - landmarktotext ROUTE_33, $2 + landmarktotext ROUTE_33, MEM_BUFFER_2 farjump UnknownScript_0xa0a5f .AlreadySwarming: - landmarktotext ROUTE_33, $2 + landmarktotext ROUTE_33, MEM_BUFFER_2 farjump UnknownScript_0xa0afa AnthonyPhoneScript2: - trainertotext HIKER, ANTHONY2, $0 + trainertotext HIKER, ANTHONY2, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male checkflag ENGINE_FLYPOINT_GOLDENROD iffalse .TriesSwarm @@ -978,18 +978,18 @@ AnthonyPhoneScript2: checkflag ENGINE_ANTHONY_FRIDAY_NIGHT iftrue .TriesSwarm farscall PhoneScript_Random2 - if_equal $0, AnthonyWantsBattle + if_equal 0, AnthonyWantsBattle .TriesSwarm: farscall PhoneScript_Random5 - if_equal $0, AnthonyTriesDunsparceSwarm + if_equal 0, AnthonyTriesDunsparceSwarm farjump Phone_GenericCall_Male AnthonyFridayNight: setflag ENGINE_ANTHONY_FRIDAY_NIGHT AnthonyWantsBattle: - landmarktotext ROUTE_33, $2 + landmarktotext ROUTE_33, MEM_BUFFER_2 setflag ENGINE_ANTHONY farjump PhoneScript_WantsToBattle_Male @@ -997,9 +997,9 @@ AnthonyTriesDunsparceSwarm: checkflag ENGINE_DUNSPARCE_SWARM iftrue .Generic setflag ENGINE_DUNSPARCE_SWARM - pokenamemem DUNSPARCE, $1 + pokenamemem DUNSPARCE, MEM_BUFFER_1 swarm SWARM_DUNSPARCE, DARK_CAVE_VIOLET_ENTRANCE - landmarktotext DARK_CAVE, $2 + landmarktotext DARK_CAVE, MEM_BUFFER_2 farjump UnknownScript_0xa05de .Generic: @@ -1008,7 +1008,7 @@ AnthonyTriesDunsparceSwarm: ; Todd ToddPhoneScript1: - trainertotext CAMPER, TODD1, $0 + trainertotext CAMPER, TODD1, MEM_BUFFER_0 checkflag ENGINE_TODD iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Male @@ -1025,14 +1025,14 @@ ToddPhoneScript1: farjump UnknownScript_0xa0958 .WantsBattle: - landmarktotext ROUTE_34, $2 + landmarktotext ROUTE_34, MEM_BUFFER_2 farjump UnknownScript_0xa0a64 .SaleOn: farjump UnknownScript_0xa0b04 ToddPhoneScript2: - trainertotext CAMPER, TODD1, $0 + trainertotext CAMPER, TODD1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male checkflag ENGINE_TODD iftrue .TryForSale @@ -1041,22 +1041,22 @@ ToddPhoneScript2: checkflag ENGINE_FLYPOINT_GOLDENROD iffalse ToddNoGoldenrod farscall PhoneScript_Random2 - if_equal $0, ToddWantsBattle + if_equal 0, ToddWantsBattle .TryForSale: farscall PhoneScript_Random2 - if_equal $0, ToddDeptStoreSale + if_equal 0, ToddDeptStoreSale ToddNoGoldenrod: farscall PhoneScript_Random3 - if_equal $0, ToddFoundRare + if_equal 0, ToddFoundRare farjump Phone_GenericCall_Male ToddSaturdayMorning: setflag ENGINE_TODD_SATURDAY_MORNING ToddWantsBattle: - landmarktotext ROUTE_34, $2 + landmarktotext ROUTE_34, MEM_BUFFER_2 setflag ENGINE_TODD farjump PhoneScript_WantsToBattle_Male @@ -1070,7 +1070,7 @@ ToddDeptStoreSale: ; Gina GinaPhoneScript1: - trainertotext PICNICKER, GINA1, $0 + trainertotext PICNICKER, GINA1, MEM_BUFFER_0 checkflag ENGINE_GINA iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Female @@ -1092,15 +1092,15 @@ GinaPhoneScript1: farjump UnknownScript_0xa05c6 .WantsBattle: - landmarktotext ROUTE_34, $2 + landmarktotext ROUTE_34, MEM_BUFFER_2 farjump UnknownScript_0xa0a69 .HasLeafStone: - landmarktotext ROUTE_34, $2 + landmarktotext ROUTE_34, MEM_BUFFER_2 farjump UnknownScript_0xa0abd GinaPhoneScript2: - trainertotext PICNICKER, GINA1, $0 + trainertotext PICNICKER, GINA1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Female checkflag ENGINE_ROCKETS_IN_RADIO_TOWER iftrue GinaRockets @@ -1113,15 +1113,15 @@ GinaPhoneScript2: checkevent EVENT_GINA_GAVE_LEAF_STONE iftrue .GaveLeafStone farscall PhoneScript_Random2 - if_equal $0, GinaHasLeafStone + if_equal 0, GinaHasLeafStone .GaveLeafStone: farscall PhoneScript_Random11 - if_equal $0, GinaHasLeafStone + if_equal 0, GinaHasLeafStone checkflag ENGINE_FLYPOINT_GOLDENROD iffalse .Generic farscall PhoneScript_Random3 - if_equal $0, GinaWantsBattle + if_equal 0, GinaWantsBattle .Generic: farjump Phone_GenericCall_Female @@ -1130,7 +1130,7 @@ GinaSundayDay: setflag ENGINE_GINA_SUNDAY_AFTERNOON GinaWantsBattle: - landmarktotext ROUTE_34, $2 + landmarktotext ROUTE_34, MEM_BUFFER_2 setflag ENGINE_GINA farjump PhoneScript_WantsToBattle_Female @@ -1139,13 +1139,13 @@ GinaRockets: GinaHasLeafStone: setflag ENGINE_GINA_HAS_LEAF_STONE - landmarktotext ROUTE_34, $2 + landmarktotext ROUTE_34, MEM_BUFFER_2 farjump PhoneScript_FoundItem_Female ; Irwin IrwinPhoneScript1: - trainertotext JUGGLER, IRWIN1, $0 + trainertotext JUGGLER, IRWIN1, MEM_BUFFER_0 farscall PhoneScript_AnswerPhone_Male checkflag ENGINE_ROCKETS_IN_RADIO_TOWER iftrue .Rockets @@ -1155,7 +1155,7 @@ IrwinPhoneScript1: farjump IrwinRocketRumor IrwinPhoneScript2: - trainertotext JUGGLER, IRWIN1, $0 + trainertotext JUGGLER, IRWIN1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male checkflag ENGINE_ROCKETS_IN_RADIO_TOWER iftrue .Rockets @@ -1167,7 +1167,7 @@ IrwinPhoneScript2: ; Arnie ArniePhoneScript1: - trainertotext BUG_CATCHER, ARNIE1, $0 + trainertotext BUG_CATCHER, ARNIE1, MEM_BUFFER_0 checkflag ENGINE_ARNIE iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Male @@ -1184,35 +1184,35 @@ ArniePhoneScript1: farjump UnknownScript_0xa0968 .WantsBattle: - landmarktotext ROUTE_35, $2 + landmarktotext ROUTE_35, MEM_BUFFER_2 farjump UnknownScript_0xa0a6e .AlreadySwarming: - landmarktotext ROUTE_35, $2 + landmarktotext ROUTE_35, MEM_BUFFER_2 farjump UnknownScript_0xa0aff ArniePhoneScript2: - trainertotext BUG_CATCHER, ARNIE1, $0 + trainertotext BUG_CATCHER, ARNIE1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male checkflag ENGINE_ARNIE iftrue .Swarm checkflag ENGINE_ARNIE_TUESDAY_MORNING iftrue .Swarm farscall PhoneScript_Random2 - if_equal $0, ArnieWantsBattle + if_equal 0, ArnieWantsBattle .Swarm: farscall PhoneScript_Random5 - if_equal $0, ArnieYanmaSwarm + if_equal 0, ArnieYanmaSwarm farscall PhoneScript_Random3 - if_equal $0, ArnieFoundRare + if_equal 0, ArnieFoundRare farjump Phone_GenericCall_Male ArnieTuesdayMorning: setflag ENGINE_ARNIE_TUESDAY_MORNING ArnieWantsBattle: - landmarktotext ROUTE_35, $2 + landmarktotext ROUTE_35, MEM_BUFFER_2 setflag ENGINE_ARNIE farjump PhoneScript_WantsToBattle_Male @@ -1220,9 +1220,9 @@ ArnieYanmaSwarm: ; start swarm checkflag ENGINE_YANMA_SWARM iftrue ArnieYanmaAlreadySwarming setflag ENGINE_YANMA_SWARM - pokenamemem YANMA, $1 + pokenamemem YANMA, MEM_BUFFER_1 swarm SWARM_YANMA, ROUTE_35 - landmarktotext ROUTE_35, $2 + landmarktotext ROUTE_35, MEM_BUFFER_2 farjump UnknownScript_0xa05ce ArnieFoundRare: @@ -1234,7 +1234,7 @@ ArnieYanmaAlreadySwarming: ; Alan AlanPhoneScript1: - trainertotext SCHOOLBOY, ALAN1, $0 + trainertotext SCHOOLBOY, ALAN1, MEM_BUFFER_0 checkflag ENGINE_ALAN iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Male @@ -1251,15 +1251,15 @@ AlanPhoneScript1: farjump UnknownScript_0xa0970 .WantsBattle: - landmarktotext ROUTE_36, $2 + landmarktotext ROUTE_36, MEM_BUFFER_2 farjump UnknownScript_0xa0a73 .FireStone: - landmarktotext ROUTE_36, $2 + landmarktotext ROUTE_36, MEM_BUFFER_2 farjump UnknownScript_0xa0ac5 AlanPhoneScript2: - trainertotext SCHOOLBOY, ALAN1, $0 + trainertotext SCHOOLBOY, ALAN1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male checkflag ENGINE_ALAN iftrue AlanGenericCall @@ -1268,15 +1268,15 @@ AlanPhoneScript2: checkflag ENGINE_ALAN_HAS_FIRE_STONE iftrue AlanGenericCall farscall PhoneScript_Random3 - if_equal $0, AlanWantsBattle + if_equal 0, AlanWantsBattle checkevent EVENT_ALAN_GAVE_FIRE_STONE iftrue .FireStone farscall PhoneScript_Random2 - if_equal $0, AlanHasFireStone + if_equal 0, AlanHasFireStone .FireStone: farscall PhoneScript_Random11 - if_equal $0, AlanHasFireStone + if_equal 0, AlanHasFireStone AlanGenericCall: farjump Phone_GenericCall_Male @@ -1285,19 +1285,19 @@ AlanWednesdayDay: setflag ENGINE_ALAN_WEDNESDAY_AFTERNOON AlanWantsBattle: - landmarktotext ROUTE_36, $2 + landmarktotext ROUTE_36, MEM_BUFFER_2 setflag ENGINE_ALAN farjump PhoneScript_WantsToBattle_Male AlanHasFireStone: setflag ENGINE_ALAN_HAS_FIRE_STONE - landmarktotext ROUTE_36, $2 + landmarktotext ROUTE_36, MEM_BUFFER_2 farjump PhoneScript_FoundItem_Male ; Dana DanaPhoneScript1: - trainertotext LASS, DANA1, $0 + trainertotext LASS, DANA1, MEM_BUFFER_0 checkflag ENGINE_DANA iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Female @@ -1314,15 +1314,15 @@ DanaPhoneScript1: farjump UnknownScript_0xa0978 .WantsBattle: - landmarktotext ROUTE_38, $2 + landmarktotext ROUTE_38, MEM_BUFFER_2 farjump UnknownScript_0xa0a78 .HasThunderstone: - landmarktotext ROUTE_38, $2 + landmarktotext ROUTE_38, MEM_BUFFER_2 farjump UnknownScript_0xa0acd DanaPhoneScript2: - trainertotext LASS, DANA1, $0 + trainertotext LASS, DANA1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Female checkflag ENGINE_DANA iftrue .Generic @@ -1331,26 +1331,26 @@ DanaPhoneScript2: checkflag ENGINE_DANA_HAS_THUNDERSTONE iftrue .Generic farscall PhoneScript_Random3 - if_equal $0, DanaWantsBattle + if_equal 0, DanaWantsBattle checkevent EVENT_DANA_GAVE_THUNDERSTONE iftrue .Thunderstone farscall PhoneScript_Random2 - if_equal $0, DanaHasThunderstone + if_equal 0, DanaHasThunderstone .Thunderstone: farscall PhoneScript_Random11 - if_equal $0, DanaHasThunderstone + if_equal 0, DanaHasThunderstone .Generic: farscall PhoneScript_Random3 - if_equal $0, DanaFoundRare + if_equal 0, DanaFoundRare farjump Phone_GenericCall_Female DanaThursdayNight: setflag ENGINE_DANA_THURSDAY_NIGHT DanaWantsBattle: - landmarktotext ROUTE_38, $2 + landmarktotext ROUTE_38, MEM_BUFFER_2 setflag ENGINE_DANA farjump PhoneScript_WantsToBattle_Female @@ -1359,13 +1359,13 @@ DanaFoundRare: DanaHasThunderstone: setflag ENGINE_DANA_HAS_THUNDERSTONE - landmarktotext ROUTE_38, $2 + landmarktotext ROUTE_38, MEM_BUFFER_2 farjump PhoneScript_FoundItem_Female ; Chad ChadPhoneScript1: - trainertotext SCHOOLBOY, CHAD1, $0 + trainertotext SCHOOLBOY, CHAD1, MEM_BUFFER_0 checkflag ENGINE_CHAD iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Male @@ -1380,31 +1380,31 @@ ChadPhoneScript1: farjump UnknownScript_0xa0980 .WantsBattle: - landmarktotext ROUTE_38, $2 + landmarktotext ROUTE_38, MEM_BUFFER_2 farjump UnknownScript_0xa0a7d ChadPhoneScript2: - trainertotext SCHOOLBOY, CHAD1, $0 + trainertotext SCHOOLBOY, CHAD1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male farscall PhoneScript_Random2 - if_equal $0, ChadOakGossip + if_equal 0, ChadOakGossip checkflag ENGINE_CHAD iftrue .Generic checkflag ENGINE_CHAD_FRIDAY_MORNING iftrue .Generic farscall PhoneScript_Random2 - if_equal $0, ChadWantsBattle + if_equal 0, ChadWantsBattle .Generic: farscall PhoneScript_Random3 - if_equal $0, ChadFoundRare + if_equal 0, ChadFoundRare farjump Phone_GenericCall_Male ChadFridayMorning: setflag ENGINE_CHAD_FRIDAY_MORNING ChadWantsBattle: - landmarktotext ROUTE_38, $2 + landmarktotext ROUTE_38, MEM_BUFFER_2 setflag ENGINE_CHAD farjump PhoneScript_WantsToBattle_Male @@ -1415,12 +1415,12 @@ ChadOakGossip: farjump ChadOakGossipScript DerekPhoneScript1: - trainertotext POKEFANM, DEREK1, $0 + trainertotext POKEFANM, DEREK1, MEM_BUFFER_0 farscall PhoneScript_AnswerPhone_Male checkflag ENGINE_DEREK_HAS_NUGGET iftrue .Nugget farscall PhoneScript_Random2 - if_equal $0, .NoContest + if_equal 0, .NoContest checkflag ENGINE_DAILY_BUG_CONTEST iftrue .NoContest checkcode VAR_WEEKDAY @@ -1435,14 +1435,14 @@ DerekPhoneScript1: farjump PhoneScript_BugCatchingContest .Nugget: - landmarktotext ROUTE_39, $2 + landmarktotext ROUTE_39, MEM_BUFFER_2 farjump UnknownScript_0xa0ad5 DerekPhoneScript2: - trainertotext POKEFANM, DEREK1, $0 + trainertotext POKEFANM, DEREK1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male farscall PhoneScript_Random2 - if_equal $0, .NoContest + if_equal 0, .NoContest checkflag ENGINE_DAILY_BUG_CONTEST iftrue .NoContest checkcode VAR_WEEKDAY @@ -1452,7 +1452,7 @@ DerekPhoneScript2: .NoContest: farscall PhoneScript_Random4 - if_equal $0, .Nugget + if_equal 0, .Nugget farjump Phone_GenericCall_Male .ContestToday: @@ -1460,11 +1460,11 @@ DerekPhoneScript2: .Nugget: setflag ENGINE_DEREK_HAS_NUGGET - landmarktotext ROUTE_39, $2 + landmarktotext ROUTE_39, MEM_BUFFER_2 farjump PhoneScript_FoundItem_Male TullyPhoneScript1: - trainertotext FISHER, TULLY1, $0 + trainertotext FISHER, TULLY1, MEM_BUFFER_0 checkflag ENGINE_TULLY iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Male @@ -1481,15 +1481,15 @@ TullyPhoneScript1: farjump UnknownScript_0xa0990 .WantsBattle: - landmarktotext ROUTE_42, $2 + landmarktotext ROUTE_42, MEM_BUFFER_2 farjump UnknownScript_0xa0a82 TullyHasWaterStone: - landmarktotext ROUTE_42, $2 + landmarktotext ROUTE_42, MEM_BUFFER_2 farjump UnknownScript_0xa0add TullyPhoneScript2: - trainertotext FISHER, TULLY1, $0 + trainertotext FISHER, TULLY1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male checkflag ENGINE_TULLY iftrue .Generic @@ -1498,15 +1498,15 @@ TullyPhoneScript2: checkflag ENGINE_TULLY_HAS_WATER_STONE iftrue .Generic farscall PhoneScript_Random3 - if_equal $0, TullyWantsBattle + if_equal 0, TullyWantsBattle checkevent EVENT_TULLY_GAVE_WATER_STONE iftrue .WaterStone farscall PhoneScript_Random2 - if_equal $0, TullyFoundWaterStone + if_equal 0, TullyFoundWaterStone .WaterStone: farscall PhoneScript_Random11 - if_equal $0, TullyFoundWaterStone + if_equal 0, TullyFoundWaterStone .Generic: farjump Phone_GenericCall_Male @@ -1515,17 +1515,17 @@ TullySundayNight: setflag ENGINE_TULLY_SUNDAY_NIGHT TullyWantsBattle: - landmarktotext ROUTE_42, $2 + landmarktotext ROUTE_42, MEM_BUFFER_2 setflag ENGINE_TULLY farjump PhoneScript_WantsToBattle_Male TullyFoundWaterStone: setflag ENGINE_TULLY_HAS_WATER_STONE - landmarktotext ROUTE_42, $2 + landmarktotext ROUTE_42, MEM_BUFFER_2 farjump PhoneScript_FoundItem_Male BrentPhoneScript1: - trainertotext POKEMANIAC, BRENT1, $0 + trainertotext POKEMANIAC, BRENT1, MEM_BUFFER_0 checkflag ENGINE_BRENT iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Male @@ -1540,20 +1540,20 @@ BrentPhoneScript1: farjump UnknownScript_0xa0998 .WantsBattle: - landmarktotext ROUTE_43, $2 + landmarktotext ROUTE_43, MEM_BUFFER_2 farjump UnknownScript_0xa0a87 BrentPhoneScript2: - trainertotext POKEMANIAC, BRENT1, $0 + trainertotext POKEMANIAC, BRENT1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male farscall PhoneScript_Random2 - if_equal $0, BrentBillTrivia + if_equal 0, BrentBillTrivia checkflag ENGINE_BRENT iftrue .Generic checkflag ENGINE_BRENT_MONDAY_MORNING iftrue .Generic farscall PhoneScript_Random2 - if_equal $0, BrentWantsBattle + if_equal 0, BrentWantsBattle .Generic: farjump Phone_GenericCall_Male @@ -1562,7 +1562,7 @@ BrentMondayMorning: setflag ENGINE_BRENT_MONDAY_MORNING BrentWantsBattle: - landmarktotext ROUTE_43, $2 + landmarktotext ROUTE_43, MEM_BUFFER_2 setflag ENGINE_BRENT farjump PhoneScript_WantsToBattle_Male @@ -1570,7 +1570,7 @@ BrentBillTrivia: farjump BrentBillTriviaScript TiffanyPhoneScript1: - trainertotext PICNICKER, TIFFANY3, $0 + trainertotext PICNICKER, TIFFANY3, MEM_BUFFER_0 checkflag ENGINE_TIFFANY iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Female @@ -1587,17 +1587,17 @@ TiffanyPhoneScript1: farjump UnknownScript_0xa09a0 .WantsBattle: - landmarktotext ROUTE_43, $2 + landmarktotext ROUTE_43, MEM_BUFFER_2 farjump UnknownScript_0xa0a8c .HasItem: - landmarktotext ROUTE_43, $2 + landmarktotext ROUTE_43, MEM_BUFFER_2 farjump UnknownScript_0xa0ae5 TiffanyPhoneScript2: - trainertotext PICNICKER, TIFFANY3, $0 + trainertotext PICNICKER, TIFFANY3, MEM_BUFFER_0 farscall PhoneScript_Random4 - if_equal $0, TiffanysFamilyMembers + if_equal 0, TiffanysFamilyMembers farscall PhoneScript_GreetPhone_Female checkflag ENGINE_TIFFANY iftrue TiffanyGenericCall @@ -1606,15 +1606,15 @@ TiffanyPhoneScript2: checkflag ENGINE_TIFFANY_HAS_PINK_BOW iftrue TiffanyGenericCall farscall PhoneScript_Random3 - if_equal $0, TiffanyWantsBattle + if_equal 0, TiffanyWantsBattle checkevent EVENT_TIFFANY_GAVE_PINK_BOW iftrue .PinkBow farscall PhoneScript_Random2 - if_equal $0, TiffanyHasPinkBow + if_equal 0, TiffanyHasPinkBow .PinkBow: farscall PhoneScript_Random11 - if_equal $0, TiffanyHasPinkBow + if_equal 0, TiffanyHasPinkBow TiffanyGenericCall: farjump Phone_GenericCall_Female @@ -1623,41 +1623,41 @@ TiffanyTuesdayAfternoon: setflag ENGINE_TIFFANY_TUESDAY_AFTERNOON TiffanyWantsBattle: - landmarktotext ROUTE_43, $2 + landmarktotext ROUTE_43, MEM_BUFFER_2 setflag ENGINE_TIFFANY farjump PhoneScript_WantsToBattle_Female TiffanysFamilyMembers: - random $6 - if_equal $0, .Grandma - if_equal $1, .Grandpa - if_equal $2, .Mom - if_equal $3, .Dad - if_equal $4, .Sister - if_equal $5, .Brother + random 6 + if_equal 0, .Grandma + if_equal 1, .Grandpa + if_equal 2, .Mom + if_equal 3, .Dad + if_equal 4, .Sister + if_equal 5, .Brother .Grandma: - stringtotext GrandmaString, $1 + stringtotext GrandmaString, MEM_BUFFER_1 jump TiffanysPoorClefairy .Grandpa: - stringtotext GrandpaString, $1 + stringtotext GrandpaString, MEM_BUFFER_1 jump TiffanysPoorClefairy .Mom: - stringtotext MomString, $1 + stringtotext MomString, MEM_BUFFER_1 jump TiffanysPoorClefairy .Dad: - stringtotext DadString, $1 + stringtotext DadString, MEM_BUFFER_1 jump TiffanysPoorClefairy .Sister: - stringtotext SisterString, $1 + stringtotext SisterString, MEM_BUFFER_1 jump TiffanysPoorClefairy .Brother: - stringtotext BrotherString, $1 + stringtotext BrotherString, MEM_BUFFER_1 jump TiffanysPoorClefairy TiffanysPoorClefairy: @@ -1665,13 +1665,13 @@ TiffanysPoorClefairy: TiffanyHasPinkBow: setflag ENGINE_TIFFANY_HAS_PINK_BOW - landmarktotext ROUTE_43, $2 + landmarktotext ROUTE_43, MEM_BUFFER_2 farjump PhoneScript_FoundItem_Female ; Vance VancePhoneScript1: - trainertotext BIRD_KEEPER, VANCE1, $0 + trainertotext BIRD_KEEPER, VANCE1, MEM_BUFFER_0 checkflag ENGINE_VANCE iftrue VanceWantsBattle farscall PhoneScript_AnswerPhone_Male @@ -1686,19 +1686,19 @@ VancePhoneScript1: farjump VanceLookingForward VanceWantsBattle: - landmarktotext ROUTE_44, $2 + landmarktotext ROUTE_44, MEM_BUFFER_2 farjump VanceHurryHurry VancePhoneScript2: - trainertotext BIRD_KEEPER, VANCE1, $0 + trainertotext BIRD_KEEPER, VANCE1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male checkflag ENGINE_VANCE iftrue .WantsBattle checkflag ENGINE_VANCE_WEDNESDAY_NIGHT iftrue .WantsBattle farscall PhoneScript_Random3 - if_equal $0, VanceWantsRematch - if_equal $1, VanceWantsRematch + if_equal 0, VanceWantsRematch + if_equal 1, VanceWantsRematch .WantsBattle: farjump Phone_GenericCall_Male @@ -1707,12 +1707,12 @@ VanceWednesdayNight: setflag ENGINE_VANCE_WEDNESDAY_NIGHT VanceWantsRematch: - landmarktotext ROUTE_44, $2 + landmarktotext ROUTE_44, MEM_BUFFER_2 setflag ENGINE_VANCE farjump PhoneScript_WantsToBattle_Male WiltonPhoneScript1: - trainertotext FISHER, WILTON1, $0 + trainertotext FISHER, WILTON1, MEM_BUFFER_0 checkflag ENGINE_WILTON iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Male @@ -1729,15 +1729,15 @@ WiltonPhoneScript1: farjump WiltonHaventFoundAnything .WantsBattle: - landmarktotext ROUTE_44, $2 + landmarktotext ROUTE_44, MEM_BUFFER_2 farjump WiltonNotBiting .HasItem: - landmarktotext ROUTE_44, $2 + landmarktotext ROUTE_44, MEM_BUFFER_2 farjump WiltonWantThis WiltonPhoneScript2: - trainertotext FISHER, WILTON1, $0 + trainertotext FISHER, WILTON1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male checkflag ENGINE_WILTON iftrue .GenericCall @@ -1746,9 +1746,9 @@ WiltonPhoneScript2: checkflag ENGINE_WILTON_HAS_ITEM iftrue .GenericCall farscall PhoneScript_Random2 - if_equal $0, WiltonWantsBattle + if_equal 0, WiltonWantsBattle farscall PhoneScript_Random2 - if_equal $0, WiltonHasItem + if_equal 0, WiltonHasItem .GenericCall: farjump Phone_GenericCall_Male @@ -1757,20 +1757,20 @@ WiltonThursdayMorning: setflag ENGINE_WILTON_THURSDAY_MORNING WiltonWantsBattle: - landmarktotext ROUTE_44, $2 + landmarktotext ROUTE_44, MEM_BUFFER_2 setflag ENGINE_WILTON farjump PhoneScript_WantsToBattle_Male WiltonHasItem: setflag ENGINE_WILTON_HAS_ITEM - landmarktotext ROUTE_44, $2 + landmarktotext ROUTE_44, MEM_BUFFER_2 clearevent EVENT_WILTON_HAS_ULTRA_BALL clearevent EVENT_WILTON_HAS_GREAT_BALL clearevent EVENT_WILTON_HAS_POKE_BALL - random $5 - if_equal $0, .UltraBall - random $3 - if_equal $0, .GreatBall + random 5 + if_equal 0, .UltraBall + random 3 + if_equal 0, .GreatBall jump .PokeBall .UltraBall: @@ -1790,19 +1790,19 @@ WiltonHasItem: ; Kenji KenjiPhoneScript1: - trainertotext BLACKBELT_T, KENJI3, $0 + trainertotext BLACKBELT_T, KENJI3, MEM_BUFFER_0 farscall PhoneScript_AnswerPhone_Male farjump KenjiAnswerPhoneScript KenjiPhoneScript2: - trainertotext BLACKBELT_T, KENJI3, $0 + trainertotext BLACKBELT_T, KENJI3, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male farjump KenjiCallingPhoneScript ; Parry ParryPhoneScript1: - trainertotext HIKER, PARRY1, $0 + trainertotext HIKER, PARRY1, MEM_BUFFER_0 checkflag ENGINE_PARRY iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Male @@ -1817,19 +1817,19 @@ ParryPhoneScript1: farjump ParryBattleWithMe .WantsBattle: - landmarktotext ROUTE_45, $2 + landmarktotext ROUTE_45, MEM_BUFFER_2 farjump ParryHaventYouGottenTo ParryPhoneScript2: - trainertotext HIKER, PARRY1, $0 + trainertotext HIKER, PARRY1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Male checkflag ENGINE_PARRY iftrue .GenericCall checkflag ENGINE_PARRY_FRIDAY_AFTERNOON iftrue .GenericCall farscall PhoneScript_Random2 - if_equal $0, ParryWantsBattle - if_equal $1, ParryWantsBattle + if_equal 0, ParryWantsBattle + if_equal 1, ParryWantsBattle .GenericCall: farjump Phone_GenericCall_Male @@ -1838,14 +1838,14 @@ ParryFridayDay: setflag ENGINE_PARRY_FRIDAY_AFTERNOON ParryWantsBattle: - landmarktotext ROUTE_45, $2 + landmarktotext ROUTE_45, MEM_BUFFER_2 setflag ENGINE_PARRY farjump PhoneScript_WantsToBattle_Male ; Erin ErinPhoneScript1: - trainertotext PICNICKER, ERIN1, $0 + trainertotext PICNICKER, ERIN1, MEM_BUFFER_0 checkflag ENGINE_ERIN iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Female @@ -1860,19 +1860,19 @@ ErinPhoneScript1: farjump ErinWorkingHardScript .WantsBattle: - landmarktotext ROUTE_46, $2 + landmarktotext ROUTE_46, MEM_BUFFER_2 farjump ErinComeBattleScript ErinPhoneScript2: - trainertotext PICNICKER, ERIN1, $0 + trainertotext PICNICKER, ERIN1, MEM_BUFFER_0 farscall PhoneScript_GreetPhone_Female checkflag ENGINE_ERIN iftrue .GenericCall checkflag ENGINE_ERIN_SATURDAY_NIGHT iftrue .GenericCall farscall PhoneScript_Random3 - if_equal $0, ErinWantsBattle - if_equal $1, ErinWantsBattle + if_equal 0, ErinWantsBattle + if_equal 1, ErinWantsBattle .GenericCall: farjump Phone_GenericCall_Female @@ -1881,6 +1881,6 @@ ErinSaturdayNight: setflag ENGINE_ERIN_SATURDAY_NIGHT ErinWantsBattle: - landmarktotext ROUTE_46, $2 + landmarktotext ROUTE_46, MEM_BUFFER_2 setflag ENGINE_ERIN farjump PhoneScript_WantsToBattle_Female diff --git a/engine/scripting.asm b/engine/scripting.asm index a7650351a..c2cfe8e15 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -128,7 +128,7 @@ ScriptCommandTable: dw Script_warp ; 3c dw Script_readmoney ; 3d dw Script_readcoins ; 3e - dw Script_RAM2MEM ; 3f + dw Script_vartomem ; 3f dw Script_pokenamemem ; 40 dw Script_itemtotext ; 41 dw Script_mapnametotext ; 42 @@ -728,14 +728,14 @@ Script_askforphonenumber: ld c, a farcall AddPhoneNumber jr c, .phonefull - xor a + xor a ; PHONE_CONTACT_GOT jr .done .phonefull - ld a, 1 + ld a, PHONE_CONTACTS_FULL jr .done .refused call GetScriptByte - ld a, 2 + ld a, PHONE_CONTACT_REFUSED .done ld [ScriptVar], a ret @@ -1880,7 +1880,7 @@ Script_checkver: Script_pokenamemem: ; script command 0x40 -; parameters: pokemon (0 to use ScriptVar), memory +; parameters: pokemon (0 aka USE_SCRIPT_VAR to use ScriptVar), memory call GetScriptByte and a @@ -1893,7 +1893,7 @@ Script_pokenamemem: ConvertMemToText: call GetScriptByte - cp 3 + cp NUM_MEM_BUFFERS jr c, .ok xor a .ok @@ -1907,10 +1907,10 @@ CopyConvertedText: Script_itemtotext: ; script command 0x41 -; parameters: item (0 to use ScriptVar), memory +; parameters: item (0 aka USE_SCRIPT_VAR to use ScriptVar), memory call GetScriptByte - and a + and a ; USE_SCRIPT_VAR jr nz, .ok ld a, [ScriptVar] .ok @@ -1999,7 +1999,7 @@ Script_readcoins: ld de, StringBuffer1 jp ConvertMemToText -Script_RAM2MEM: +Script_vartomem: ; script command 0x3f ; parameters: memory @@ -2150,15 +2150,15 @@ Script_checkmoney: farcall CompareMoney CompareMoneyAction: - jr c, .two - jr z, .one - ld a, 0 + jr c, .less + jr z, .exact + ld a, HAVE_MORE jr .done -.one - ld a, 1 +.exact + ld a, HAVE_AMOUNT jr .done -.two - ld a, 2 +.less + ld a, HAVE_LESS .done ld [ScriptVar], a ret @@ -2166,9 +2166,9 @@ CompareMoneyAction: GetMoneyAccount: call GetScriptByte and a - ld de, Money + ld de, Money ; YOUR_MONEY ret z - ld de, wMomsMoney + ld de, wMomsMoney ; MOMS_MONEY ret LoadMoneyAmountToMem: @@ -2431,7 +2431,7 @@ Script_checkflag: ld e, a call GetScriptByte ld d, a - ld b, 2 ; check + ld b, CHECK_FLAG call _EngineFlagAction ld a, c and a @@ -2667,7 +2667,7 @@ Script_loadbytec2cf: ld [wc2cf], a ret - ld c, c ; XXX + db $49 ; XXX Script_closetext: ; script command 0x49 diff --git a/engine/specials.asm b/engine/specials.asm index cd2394b96..a08f1ac85 100644 --- a/engine/specials.asm +++ b/engine/specials.asm @@ -603,13 +603,13 @@ SpecialGameboyCheck: ; c478 jr nz, .sgb .gb - xor a + xor a ; GBCHECK_GB jr .done .sgb - ld a, 1 + ld a, GBCHECK_SGB jr .done .cgb - ld a, 2 + ld a, GBCHECK_CGB .done ld [ScriptVar], a ret -- cgit v1.2.3 From c6a4d35d57670e73d5011bf09e6ee6345dd77f3f Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 12 Jan 2018 02:56:14 -0500 Subject: npc_sprites.pal matches PAL_NPC constants --- engine/color.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/color.asm b/engine/color.asm index adcb2d23d..891441116 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -1341,7 +1341,7 @@ TilesetBGPalette: INCLUDE "gfx/tilesets/bg_tiles.pal" MapObjectPals:: -INCLUDE "gfx/overworld/map_sprites.pal" +INCLUDE "gfx/overworld/npc_sprites.pal" RoofPals: INCLUDE "gfx/tilesets/roofs.pal" -- cgit v1.2.3 From bdc95598d7796d2802295f221d08eef3abb68cec Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 12 Jan 2018 03:07:48 -0500 Subject: Easier to find palette data --- engine/sgb_layouts.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/sgb_layouts.asm b/engine/sgb_layouts.asm index 8e79e33f9..64acbc69e 100644 --- a/engine/sgb_layouts.asm +++ b/engine/sgb_layouts.asm @@ -596,7 +596,7 @@ endr ret ; 8a45 -INCLUDE "data/maps/sgb_roofs.asm" +INCLUDE "gfx/sgb/roof_pal_inds.asm" _LoadSGBLayout_ReturnFromJumpTable: ; 8a60 push de -- cgit v1.2.3 From 0e1148fb2c754c579284b609c4edbfd676c8d044 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 12 Jan 2018 03:15:58 -0500 Subject: Move code out of data/ --- engine/routines/printitemdescription.asm | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 engine/routines/printitemdescription.asm (limited to 'engine') diff --git a/engine/routines/printitemdescription.asm b/engine/routines/printitemdescription.asm new file mode 100644 index 000000000..e6d087dae --- /dev/null +++ b/engine/routines/printitemdescription.asm @@ -0,0 +1,31 @@ +PrintItemDescription: ; 0x1c8955 +; Print the description for item [CurSpecies] at de. + + ld a, [CurSpecies] + cp TM01 + jr c, .not_a_tm + + ld [CurItem], a + push de + farcall GetTMHMItemMove + pop hl + ld a, [wd265] + ld [CurSpecies], a + predef PrintMoveDesc + ret + +.not_a_tm + push de + ld hl, ItemDescriptions + ld a, [CurSpecies] + dec a + ld c, a + ld b, 0 + add hl, bc + add hl, bc + ld e, [hl] + inc hl + ld d, [hl] + pop hl + jp PlaceString +; 0x1c8987 -- cgit v1.2.3 From 5b7773b7d3ddf1addd99588cc5c41cd81ecdc402 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Fri, 12 Jan 2018 12:15:44 +0100 Subject: Label frameset 09 It seems to be used as the "big" text entry cursor (i.e. for the bottom 3 buttons in the text entry screen). It is never referenced explicitly, instead used when adding 1 to SPRITEANIMSTRUCT_0E, in NamingScreen_AnimateCursor. --- engine/namingscreen.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index 177f06f73..b4abb8550 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -562,10 +562,10 @@ NamingScreen_AnimateCursor: ; 11a3b (4:5a3b) .ok cp d ld de, .LetterEntries - ld a, $0 + ld a, $0 ; SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR jr nz, .ok2 ld de, .CaseDelEnd - ld a, $1 + ld a, $1 ; SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR_BIG .ok2 ld hl, SPRITEANIMSTRUCT_0E add hl, bc -- cgit v1.2.3 From 960783cdf4e6bf57be049e5d0cc7fcec6f107711 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 12 Jan 2018 13:47:04 -0500 Subject: Label more ANIM_OBJ_* constants --- engine/battle_anims/bg_effects.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/battle_anims/bg_effects.asm b/engine/battle_anims/bg_effects.asm index bb8feb1f9..f63257df7 100644 --- a/engine/battle_anims/bg_effects.asm +++ b/engine/battle_anims/bg_effects.asm @@ -506,13 +506,13 @@ BattleBGEffect_HeadFollow: ; c8281 (32:4281) push bc call BGEffect_CheckBattleTurn jr nz, .player_turn - ld a, ANIM_OBJ_BA + ld a, ANIM_OBJ_PLAYERHEADFOLLOW ld [wBattleAnimTemp0], a ld a, 16 * 8 + 4 jr .okay .player_turn - ld a, ANIM_OBJ_BB + ld a, ANIM_OBJ_ENEMYHEADFOLLOW ld [wBattleAnimTemp0], a ld a, 6 * 8 .okay -- cgit v1.2.3 From 31caeeba3c85821fa733c3e714ede2f62ed89517 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 12 Jan 2018 14:41:42 -0500 Subject: Separate more palettes into gfx/**/*.pal files --- engine/cgb_layouts.asm | 54 +++++++----------------------------------- engine/crystal_colors.asm | 2 +- engine/tileset_palettes.asm | 57 ++++----------------------------------------- 3 files changed, 13 insertions(+), 100 deletions(-) (limited to 'engine') diff --git a/engine/cgb_layouts.asm b/engine/cgb_layouts.asm index 97477367d..74b1f04bb 100644 --- a/engine/cgb_layouts.asm +++ b/engine/cgb_layouts.asm @@ -258,30 +258,11 @@ _CGB_StatsScreenHPPals: ; 8edb ; 8f52 StatsScreenPagePals: ; 8f52 -; pink - RGB 31, 31, 31 - RGB 31, 19, 31 - RGB 31, 15, 31 - RGB 00, 00, 00 -; green - RGB 31, 31, 31 - RGB 21, 31, 14 - RGB 17, 31, 00 - RGB 00, 00, 00 -; blue - RGB 31, 31, 31 - RGB 17, 31, 31 - RGB 17, 31, 31 - RGB 00, 00, 00 +INCLUDE "gfx/stats/pages.pal" ; 8f6a StatsScreenPals: ; 8f6a -; pink - RGB 31, 19, 31 -; green - RGB 21, 31, 14 -; blue - RGB 17, 31, 31 +INCLUDE "gfx/stats/stats.pal" ; 8f70 _CGB_Pokedex: ; 8f70 @@ -319,16 +300,11 @@ _CGB_Pokedex: ; 8f70 ; 8fba .PokedexQuestionMarkPalette: ; 8fba - RGB 11, 23, 00 - RGB 07, 17, 00 - RGB 06, 16, 03 - RGB 05, 12, 01 +INCLUDE "gfx/pokedex/question_mark.pal" +; 8fc2 .PokedexCursorPalette: ; 8fc2 - RGB 00, 00, 00 - RGB 11, 23, 00 - RGB 07, 17, 00 - RGB 00, 00, 00 +INCLUDE "gfx/pokedex/cursor.pal" ; 8fca _CGB_BillsPC: ; 8fca @@ -385,10 +361,7 @@ _CGB_BillsPC: ; 8fca ; 9036 .BillsPCOrangePalette: ; 9036 - RGB 31, 15, 00 - RGB 23, 12, 00 - RGB 15, 07, 00 - RGB 00, 00, 00 +INCLUDE "gfx/pc/orange.pal" ; 903e _CGB_PokedexUnownMode: ; 903e @@ -970,10 +943,7 @@ _CGB_GamefreakLogo: ; 94fa ; 9521 .Palette: ; 9521 - RGB 31, 31, 31 - RGB 13, 11, 00 - RGB 23, 12, 28 - RGB 00, 00, 00 +INCLUDE "gfx/splash/logo.pal" ; 9529 _CGB_PlayerOrMonFrontpicPals: ; 9529 @@ -1059,13 +1029,5 @@ _CGB_MysteryGift: ; 9591 ; 95e0 .Palettes: ; 95e0 - RGB 31, 31, 31 - RGB 16, 31, 14 - RGB 05, 14, 21 - RGB 05, 13, 10 - - RGB 31, 31, 31 - RGB 11, 21, 25 - RGB 05, 14, 21 - RGB 00, 03, 19 +INCLUDE "gfx/mystery_gift/mystery_gift.pal" ; 95f0 diff --git a/engine/crystal_colors.asm b/engine/crystal_colors.asm index f877c8e0a..c8f0b17cc 100755 --- a/engine/crystal_colors.asm +++ b/engine/crystal_colors.asm @@ -130,7 +130,7 @@ INCLUDE "gfx/font/bg_text.pal" ; 49420 Function49420:: ; 49420 (12:5420) - ld hl, MansionPalette4 + ld hl, MansionPalette1 + 8 palettes ld de, wBGPals1 palette PAL_BG_ROOF ld bc, 1 palettes ld a, BANK(wBGPals1) diff --git a/engine/tileset_palettes.asm b/engine/tileset_palettes.asm index 458d8e440..9aba2f20e 100644 --- a/engine/tileset_palettes.asm +++ b/engine/tileset_palettes.asm @@ -119,53 +119,7 @@ INCLUDE "gfx/tilesets/radio_tower.pal" ; 4967d MansionPalette1: ; 4967d - RGB 30, 28, 26 - RGB 19, 19, 19 - RGB 13, 13, 13 - RGB 07, 07, 07 - - RGB 30, 28, 26 - RGB 31, 19, 24 - RGB 30, 10, 06 - RGB 07, 07, 07 - - RGB 18, 24, 09 - RGB 15, 20, 01 - RGB 09, 13, 00 - RGB 07, 07, 07 - - RGB 30, 28, 26 - RGB 15, 16, 31 - RGB 09, 09, 31 - RGB 07, 07, 07 - - RGB 30, 28, 26 - RGB 31, 31, 07 - RGB 31, 16, 01 - RGB 07, 07, 07 - - RGB 26, 24, 17 - RGB 21, 17, 07 - RGB 16, 13, 03 - RGB 07, 07, 07 - -MansionPalette3: ; 496ad - RGB 30, 28, 26 - RGB 17, 19, 31 - RGB 14, 16, 31 - RGB 07, 07, 07 - - RGB 31, 31, 16 - RGB 31, 31, 16 - RGB 14, 09, 00 - RGB 00, 00, 00 -; 496bd - -MansionPalette4: ; 496bd - RGB 05, 05, 16 - RGB 08, 19, 28 - RGB 00, 00, 00 - RGB 31, 31, 31 +INCLUDE "gfx/tilesets/celadon_mansion_1.pal" ; 496c5 LoadMansionPalette: ; 496c5 @@ -181,20 +135,17 @@ LoadMansionPalette: ; 496c5 call FarCopyWRAM ld a, BANK(wBGPals1) ld de, wBGPals1 palette PAL_BG_WATER - ld hl, MansionPalette3 + ld hl, MansionPalette1 + 6 palettes ld bc, 1 palettes call FarCopyWRAM ld a, BANK(wBGPals1) ld de, wBGPals1 palette PAL_BG_ROOF - ld hl, MansionPalette4 + ld hl, MansionPalette1 + 8 palettes ld bc, 1 palettes call FarCopyWRAM ret ; 496fe MansionPalette2: ; 496fe - RGB 25, 24, 23 - RGB 20, 19, 19 - RGB 14, 16, 31 - RGB 07, 07, 07 +INCLUDE "gfx/tilesets/celadon_mansion_2.pal" ; 49706 -- cgit v1.2.3 From f1e1b26138daabc15b83f5a8ce7f6e513749f5a8 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 12 Jan 2018 14:54:00 -0500 Subject: More gfx/**/*.pal files --- engine/battle/battle_transition.asm | 11 +++-------- engine/events/heal_machine_anim.asm | 7 ++----- engine/init_gender.asm | 5 +---- 3 files changed, 6 insertions(+), 17 deletions(-) (limited to 'engine') diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 4c05112ac..16c9df2c1 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -691,17 +691,12 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) ; 8c6a1 (23:46a1) .daypals ; 8c6a1 - RGB 31, 18, 29 - RGB 31, 11, 15 - RGB 31, 05, 05 - RGB 07, 07, 07 +INCLUDE "gfx/overworld/trainer_battle_day.pal" ; 8c6a9 .nightpals ; 8c6a9 - RGB 31, 18, 29 - RGB 31, 05, 05 - RGB 31, 05, 05 - RGB 31, 05, 05 +INCLUDE "gfx/overworld/trainer_battle_nite.pal" +; 8c6b1 .loadpokeballgfx ld a, [OtherTrainerClass] diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm index 0f20d76b6..bd7ba792d 100755 --- a/engine/events/heal_machine_anim.asm +++ b/engine/events/heal_machine_anim.asm @@ -169,14 +169,11 @@ INCBIN "gfx/overworld/heal_machine.2bpp" ; 12451 .palettes ; 12451 - RGB 31, 31, 31 - RGB 31, 19, 10 - RGB 31, 07, 01 - RGB 00, 00, 00 +INCLUDE "gfx/overworld/heal_machine.pal" ; 12459 .FlashPalettes8Times: ; 12459 - ld c, $8 + ld c, 8 .palette_loop push bc call .FlashPalettes diff --git a/engine/init_gender.asm b/engine/init_gender.asm index 588709b88..f38139b2e 100755 --- a/engine/init_gender.asm +++ b/engine/init_gender.asm @@ -97,10 +97,7 @@ LoadGenderScreenPal: ; 48e47 (12:4e47) ; 48e5c (12:4e5c) .Palette: ; 48e5c - RGB 31, 31, 31 - RGB 09, 30, 31 - RGB 01, 11, 31 - RGB 00, 00, 00 +INCLUDE "gfx/intro/gender_screen.pal" ; 48e64 LoadGenderScreenLightBlueTile: ; 48e64 (12:4e64) -- cgit v1.2.3 From 0197e6f23c0db6baf11aa1e610521f78b6352605 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sat, 13 Jan 2018 15:22:16 -0500 Subject: Don't split stats gfx in three --- engine/print_party.asm | 11 +++++------ engine/stats_screen.asm | 6 +++--- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'engine') diff --git a/engine/print_party.asm b/engine/print_party.asm index ce624b013..819f38759 100755 --- a/engine/print_party.asm +++ b/engine/print_party.asm @@ -1,5 +1,4 @@ -PRINTPARTY_HP EQUS "\"◀\"" ; $71 -PRINTPARTY_SHINY EQUS "\"\"" ; $3f +PRINTPARTY_HP EQUS "\"◀\"" ; $71 PrintPage1: ; 1dc1b0 hlcoord 0, 0 @@ -153,9 +152,9 @@ PrintPartyMonPage1: ; 1dc381 lb bc, BANK(GBPrinterLvIcon), 1 call Request1bpp - ld de, ShinyIconGFX - ld hl, vTiles2 tile PRINTPARTY_SHINY - lb bc, BANK(ShinyIconGFX), 1 + ld de, StatsScreenPageTilesGFX + 14 tiles ; shiny icon + ld hl, vTiles2 tile "" + lb bc, BANK(StatsScreenPageTilesGFX), 1 call Get2bpp xor a @@ -333,7 +332,7 @@ Function1dc52c: ; 1dc52c farcall CheckShininess ret nc hlcoord 18, 2 - ld [hl], PRINTPARTY_SHINY + ld [hl], "" ret ; 1dc550 diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm index fbe562d9c..c0963d766 100755 --- a/engine/stats_screen.asm +++ b/engine/stats_screen.asm @@ -489,7 +489,7 @@ StatsScreen_PlaceShinyIcon: ; 4dfa6 (13:5fa6) farcall CheckShininess ret nc hlcoord 19, 0 - ld [hl], $3f ; shiny icon + ld [hl], "" ret StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) @@ -958,7 +958,7 @@ StatsScreen_LoadTextBoxSpaceGFX: ; 4e307 (13:6307) ld [rVBK], a ld de, TextBoxSpaceGFX lb bc, BANK(TextBoxSpaceGFX), 1 - ld hl, vTiles2 tile $7f + ld hl, vTiles2 tile " " call Get2bpp pop af ld [rVBK], a @@ -971,7 +971,7 @@ StatsScreen_LoadTextBoxSpaceGFX: ; 4e307 (13:6307) ; unreferenced Unknown_4e32a: ; 4e32a -; A blank tile? +; An unused space tile? ds 16 ; 4e33a -- cgit v1.2.3 From 2ab60fa8a49dfe9e20ebb620471ba4c2ca64a4aa Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sat, 13 Jan 2018 16:38:14 -0500 Subject: menu_coords macro for (x1, y1, x2, y2) order (see issue #440) --- engine/battle/menu.asm | 9 ++---- engine/billspc.asm | 15 ++++------ engine/billspctop.asm | 3 +- engine/buy_sell_toss.asm | 9 ++---- engine/decorations.asm | 12 +++----- engine/delete_save_change_clock.asm | 6 ++-- engine/events/buena.asm | 12 +++----- engine/events/elevator.asm | 3 +- engine/events/kurt.asm | 13 +++++---- engine/events/mom.asm | 3 +- engine/events/move_tutor.asm | 3 +- engine/events/pokecenter_pc.asm | 6 ++-- engine/events/pokepic.asm | 3 +- engine/events/std_scripts.asm | 3 +- engine/init_gender.asm | 3 +- engine/intro_menu.asm | 6 ++-- engine/mail.asm | 6 ++-- engine/main_menu.asm | 3 +- engine/mart.asm | 6 ++-- engine/menu_2.asm | 6 ++-- engine/mon_menu.asm | 6 ++-- engine/pack.asm | 57 +++++++++++++------------------------ engine/slot_machine.asm | 3 +- engine/start_menu.asm | 12 +++----- 24 files changed, 72 insertions(+), 136 deletions(-) (limited to 'engine') diff --git a/engine/battle/menu.asm b/engine/battle/menu.asm index 07d3e6081..e44d92f83 100755 --- a/engine/battle/menu.asm +++ b/engine/battle/menu.asm @@ -34,8 +34,7 @@ Function24f19: ; 24f19 BattleMenuDataHeader: ; 24f2c db $40 ; flags - db 12, 08 ; start coords - db 17, 19 ; end coords + menu_coords 8, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw MenuData_0x24f34 db 1 ; default option ; 24f34 @@ -57,8 +56,7 @@ Strings24f3d: ; 0x24f3d MenuDataHeader_0x24f4e: ; 24f4e db $40 ; flags - db 12, 00 ; start coords - db 17, 19 ; end coords + menu_coords 0, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw MenuData_0x24f56 db 1 ; default option ; 24f56 @@ -88,8 +86,7 @@ Function24f7c: ; 24f7c MenuDataHeader_0x24f89: ; 24f89 db $40 ; flags - db 12, 02 ; start coords - db 17, 19 ; end coords + menu_coords 2, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw MenuData_0x24f91 db 1 ; default option ; 24f91 diff --git a/engine/billspc.asm b/engine/billspc.asm index 00bd49f06..7be68ba36 100755 --- a/engine/billspc.asm +++ b/engine/billspc.asm @@ -230,8 +230,7 @@ BillsPCDepositFuncCancel: ; e2537 (38:6537) BillsPCDepositMenuDataHeader: ; 0xe253d (38:653d) db $40 ; flags - db 04, 09 ; start coords - db 13, 19 ; end coords + menu_coords 9, 4, SCREEN_WIDTH - 1, 13 dw .MenuData2 db 1 ; default option ; 0xe2545 @@ -491,8 +490,7 @@ BillsPC_Withdraw: ; e2675 (38:6675) .MenuDataHeader: ; 0xe2731 db $40 ; flags - db 04, 09 ; start coords - db 13, 19 ; end coords + menu_coords 9, 4, SCREEN_WIDTH - 1, 13 dw .MenuData db 1 ; default option ; 0xe2739 @@ -715,8 +713,7 @@ _MovePKMNWithoutMail: ; e2759 .MenuDataHeader: ; 0xe28c3 db $40 ; flags - db 04, 09 ; start coords - db 13, 19 ; end coords + menu_coords 9, 4, SCREEN_WIDTH - 1, 13 dw .MenuData2 db 1 ; default option ; 0xe28cb @@ -2334,8 +2331,7 @@ BillsPC_ClearTilemap: ; e35e2 (38:75e2) _ChangeBox_menudataheader: ; 0xe35f1 db $40 ; flags - db 05, 01 ; start coords - db 12, 09 ; end coords + menu_coords 1, 5, 9, 12 dw .menudata2 db 1 ; default option ; 0xe35f9 @@ -2563,8 +2559,7 @@ BillsPC_ChangeBoxSubmenu: ; e36f9 (38:76f9) .MenuDataHeader: ; 0xe377b db $40 ; flags - db 04, 11 ; start coords - db 13, 19 ; end coords + menu_coords 11, 4, SCREEN_WIDTH - 1, 13 dw .MenuData2 db 1 ; default option ; 0xe3783 diff --git a/engine/billspctop.asm b/engine/billspctop.asm index c36cbe45d..0d2ba5e9d 100755 --- a/engine/billspctop.asm +++ b/engine/billspctop.asm @@ -70,8 +70,7 @@ _BillsPC: ; e3fd .MenuDataHeader: ; 0xe46f db $40 ; flags - db 00, 00 ; start coords - db 17, 19 ; end coords + menu_coords 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw .MenuData2 db 1 ; default option diff --git a/engine/buy_sell_toss.asm b/engine/buy_sell_toss.asm index 37bee86b1..b46fc1c27 100755 --- a/engine/buy_sell_toss.asm +++ b/engine/buy_sell_toss.asm @@ -215,24 +215,21 @@ BuySell_DisplaySubtotal: ; 250d1 TossItem_MenuDataHeader: ; 0x250ed db $40 ; flags - db 09, 15 ; start coords - db 11, 19 ; end coords + menu_coords 15, 9, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw ret_25097 db 0 ; default option ; 0x250f5 BuyItem_MenuDataHeader: ; 0x250f5 db $40 ; flags - db 15, 07 ; start coords - db 17, 19 ; end coords + menu_coords 7, 15, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw DisplayPurchasePrice db -1 ; default option ; 0x250fd SellItem_MenuDataHeader: ; 0x250fd db $40 ; flags - db 15, 07 ; start coords - db 17, 19 ; end coords + menu_coords 7, 15, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw DisplaySellingPrice db 0 ; default option ; 0x25105 diff --git a/engine/decorations.asm b/engine/decorations.asm index bd9eb0251..92ede0db6 100755 --- a/engine/decorations.asm +++ b/engine/decorations.asm @@ -38,8 +38,7 @@ _KrisDecorationMenu: ; 0x2675c .MenuDataHeader: ; 0x2679a db $40 ; flags - db 00, 05 ; start coords - db 17, 19 ; end coords + menu_coords 5, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw .MenuData2 db 1 ; default option ; 0x267a2 @@ -424,8 +423,7 @@ PopulateDecoCategoryMenu: ; 2695b .NonscrollingMenuDataHeader: ; 0x269b5 db $40 ; flags - db 00, 00 ; start coords - db 17, 19 ; end coords + menu_coords 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw .NonscrollingMenuData2 db 1 ; default option ; 0x269bd @@ -440,8 +438,7 @@ PopulateDecoCategoryMenu: ; 2695b .ScrollingMenuDataHeader: ; 0x269c5 db $40 ; flags - db 01, 01 ; start coords - db 16, 18 ; end coords + menu_coords 1, 1, SCREEN_WIDTH - 2, SCREEN_HEIGHT - 2 dw .ScrollingMenuData2 db 1 ; default option ; 0x269cd @@ -952,8 +949,7 @@ QueryWhichSide: ; 26e9a MenuDataHeader_0x26eab: ; 0x26eab db $40 ; flags - db 00, 00 ; start coords - db 07, 13 ; end coords + menu_coords 0, 0, 13, 7 dw MenuData2_0x26eb3 db 1 ; default option ; 0x26eb3 diff --git a/engine/delete_save_change_clock.asm b/engine/delete_save_change_clock.asm index e77874e1c..6e9a37b71 100755 --- a/engine/delete_save_change_clock.asm +++ b/engine/delete_save_change_clock.asm @@ -48,8 +48,7 @@ _ResetClock: ; 4d3b1 .NoYes_MenuDataHeader: ; 0x4d40d db $00 ; flags - db 07, 14 ; start coords - db 11, 19 ; end coords + menu_coords 14, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .NoYes_MenuData2 db 1 ; default option @@ -286,8 +285,7 @@ _DeleteSaveData: ; 4d54c .NoYesMenuDataHeader: ; 0x4d585 db $00 ; flags - db 07, 14 ; start coords - db 11, 19 ; end coords + menu_coords 14, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData2 db 1 ; default option diff --git a/engine/events/buena.asm b/engine/events/buena.asm index 3987487a9..cfe543a19 100644 --- a/engine/events/buena.asm +++ b/engine/events/buena.asm @@ -30,8 +30,7 @@ SpecialBuenasPassword: ; 8af6b .MenuDataHeader: ; 0x8afa9 db $40 ; flags - db 00, 00 ; start coords - db 07, 10 ; end coords + menu_coords 0, 0, 10, 7 dw .MenuData2 db 1 ; default option ; 0x8afb1 @@ -226,8 +225,7 @@ PrintBlueCardBalance: ; 8b097 BlueCardBalanceMenuDataHeader: ; 0x8b0d1 db $40 ; flags - db 11, 00 ; start coords - db 13, 11 ; end coords + menu_coords 0, 11, 11, 13 ; 8b0d6 Buena_PlacePrizeMenuBox: ; 8b0d6 @@ -238,8 +236,7 @@ Buena_PlacePrizeMenuBox: ; 8b0d6 .menudataheader ; 0x8b0dd db $40 ; flags - db 00, 00 ; start coords - db 11, 17 ; end coords + menu_coords 0, 0, 17, TEXTBOX_Y - 1 ; 8b0e2 Buena_PrizeMenu: ; 8b0e2 @@ -271,8 +268,7 @@ Buena_PrizeMenu: ; 8b0e2 .MenuDataHeader: ; 0x8b113 db $40 ; flags - db 01, 01 ; start coords - db 09, 16 ; end coords + menu_coords 1, 1, 16, 9 dw .MenuData2 db 1 ; default option ; 0x8b11b diff --git a/engine/events/elevator.asm b/engine/events/elevator.asm index 35e95fa3c..77e74b11e 100755 --- a/engine/events/elevator.asm +++ b/engine/events/elevator.asm @@ -189,8 +189,7 @@ Elevator_GetCurrentFloorString: ; 1353f Elevator_MenuDataHeader: ; 0x13550 db $40 ; flags - db 01, 12 ; start coords - db 09, 18 ; end coords + menu_coords 12, 1, 18, 9 dw Elevator_MenuData2 db 1 ; default option ; 0x13558 diff --git a/engine/events/kurt.asm b/engine/events/kurt.asm index 3cabfd6f1..8ab28cddf 100644 --- a/engine/events/kurt.asm +++ b/engine/events/kurt.asm @@ -85,13 +85,12 @@ Kurt_SelectApricorn: ; 88055 .MenuDataHeader: ; 0x88086 db $40 ; flags - db 01, 01 ; start coords - db 10, 13 ; end coords + menu_coords 1, 1, 13, 10 dw .MenuData2 db 1 ; default option ; 0x8808e - db 0 + db 0 ; XXX .MenuData2: ; 0x8808f db $10 ; flags @@ -160,10 +159,12 @@ Kurt_SelectQuantity: ; 880c2 .MenuDataHeader: ; 0x8810d db $40 ; flags - db 09, 06 ; start coords - db 12, 19 ; end coords + menu_coords 6, 9, SCREEN_WIDTH - 1, 12 - db 0, 0, -1, 0 ; XXX + ; XXX + dw 0 + db -1 + db 0 .PlaceApricornName: ; 88116 call MenuBoxCoord2Tile diff --git a/engine/events/mom.asm b/engine/events/mom.asm index 296f3ad6f..8a61a57d8 100644 --- a/engine/events/mom.asm +++ b/engine/events/mom.asm @@ -729,8 +729,7 @@ Mom_HeldString: ; 166b0 MenuDataHeader_0x166b5: ; 0x166b5 db $40 ; flags - db 00, 00 ; start coords - db 10, 10 ; end coords + menu_coords 0, 0, 10, 10 dw MenuData2_0x166bd db 1 ; default option ; 0x166bd diff --git a/engine/events/move_tutor.asm b/engine/events/move_tutor.asm index 802b9ef21..7b475c169 100644 --- a/engine/events/move_tutor.asm +++ b/engine/events/move_tutor.asm @@ -100,5 +100,4 @@ CheckCanLearnMoveTutorMove: ; 492b9 .MenuDataHeader: ; 0x4930a db $40 ; flags - db 12, 00 ; start coords - db 17, 19 ; end coords + menu_coords 0, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 diff --git a/engine/events/pokecenter_pc.asm b/engine/events/pokecenter_pc.asm index 8d0300aa4..f7c8a01a3 100755 --- a/engine/events/pokecenter_pc.asm +++ b/engine/events/pokecenter_pc.asm @@ -28,8 +28,7 @@ PokemonCenterPC: ; 1559a .TopMenu: db $48 ; flags - db 00, 00 ; start coords - db 12, 15 ; end coords + menu_coords 0, 0, 15, 12 dw .MenuData2 db 1 ; default option @@ -621,8 +620,7 @@ PCItemsJoypad: ; 0x15985 .PCItemsMenuData: db %01000000 - db 1, 4 ; start coords - db 10, 18 ; end coords + menu_coords 4, 1, 18, 10 dw .MenuData2 db 1 ; default option diff --git a/engine/events/pokepic.asm b/engine/events/pokepic.asm index 82016403b..aa950b255 100755 --- a/engine/events/pokepic.asm +++ b/engine/events/pokepic.asm @@ -43,7 +43,6 @@ ClosePokepic:: ; 24528 PokepicMenuDataHeader: ; 0x24547 db $40 ; flags - db 04, 06 ; start coords - db 13, 14 ; end coords + menu_coords 6, 4, 14, 13 dw NULL db 1 ; default option diff --git a/engine/events/std_scripts.asm b/engine/events/std_scripts.asm index 708165046..6e76c6189 100644 --- a/engine/events/std_scripts.asm +++ b/engine/events/std_scripts.asm @@ -1871,8 +1871,7 @@ CoinVendor_IntroScript: ; 0xbcde0 .MenuDataHeader: db $40 ; flags - db 04, 00 ; start coords - db 11, 15 ; end coords + menu_coords 0, 4, 15, TEXTBOX_Y - 1 dw .MenuData2 db 1 ; default option diff --git a/engine/init_gender.asm b/engine/init_gender.asm index f38139b2e..2c1a5a2ef 100755 --- a/engine/init_gender.asm +++ b/engine/init_gender.asm @@ -45,8 +45,7 @@ InitGender: ; 48dcb (12:4dcb) .MenuDataHeader: ; 0x48dfc db $40 ; flags - db 04, 06 ; start coords - db 09, 12 ; end coords + menu_coords 6, 4, 12, 9 dw .MenuData2 db 1 ; default option ; 0x48e04 diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index 08e004e1b..31e19778c 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -554,8 +554,7 @@ Continue_LoadMenuHeader: ; 5ebf .MenuDataHeader_Dex: ; 5ed9 db $40 ; flags - db 00, 00 ; start coords - db 09, 15 ; end coords + menu_coords 0, 0, 15, 9 dw .MenuData2_Dex db 1 ; default option ; 5ee1 @@ -571,8 +570,7 @@ Continue_LoadMenuHeader: ; 5ebf .MenuDataHeader_NoDex: ; 5efb db $40 ; flags - db 00, 00 ; start coords - db 09, 15 ; end coords + menu_coords 0, 0, 15, 9 dw .MenuData2_NoDex db 1 ; default option ; 5f03 diff --git a/engine/mail.asm b/engine/mail.asm index c860693be..c2ecb7548 100755 --- a/engine/mail.asm +++ b/engine/mail.asm @@ -559,8 +559,7 @@ MailboxPC: ; 0x44806 .TopMenuDataHeader: ; 0x4494c db %01000000 ; flags - db 1, 8 ; start coords - db 10, 18 ; end coords + menu_coords 8, 1, SCREEN_WIDTH - 2, 10 dw .TopMenuData2 db 1 ; default option @@ -575,8 +574,7 @@ MailboxPC: ; 0x44806 .SubMenuDataHeader: ; 0x44964 db %01000000 ; flags - db 0, 0 ; start coords - db 9, 13 ; end coords + menu_coords 0, 0, 13, 9 dw .SubMenuData2 db 1 ; default option diff --git a/engine/main_menu.asm b/engine/main_menu.asm index cbd516cd7..92a3da6bb 100755 --- a/engine/main_menu.asm +++ b/engine/main_menu.asm @@ -31,8 +31,7 @@ MainMenu: ; 49cdc .MenuDataHeader: ; 49d14 db $40 ; flags - db 00, 00 ; start coords - db 07, 16 ; end coords + menu_coords 0, 0, 16, 7 dw .MenuData2 db 1 ; default option ; 49d1c diff --git a/engine/mart.asm b/engine/mart.asm index 96423cfec..d4af8fb61 100755 --- a/engine/mart.asm +++ b/engine/mart.asm @@ -618,8 +618,7 @@ Text_Mart_CostsThisMuch: ; 0x15e13 MenuDataHeader_Buy: ; 0x15e18 db $40 ; flags - db 03, 01 ; start coords - db 11, 19 ; end coords + menu_coords 1, 3, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .menudata2 db 1 ; default option ; 0x15e20 @@ -903,8 +902,7 @@ Text_Mart_HowMayIHelpYou: ; 0x15f83 MenuDataHeader_BuySell: ; 0x15f88 db $40 ; flags - db 00, 00 ; start coords - db 08, 07 ; end coords + menu_coords 0, 0, 7, 8 dw .menudata2 db 1 ; default option ; 0x15f90 diff --git a/engine/menu_2.asm b/engine/menu_2.asm index fc1b511b0..cbced7320 100644 --- a/engine/menu_2.asm +++ b/engine/menu_2.asm @@ -54,15 +54,13 @@ PlaceMoneyDataHeader: ; 24b01 MenuDataHeader_0x24b15: ; 0x24b15 db $40 ; flags - db 00, 11 ; start coords - db 02, 19 ; end coords + menu_coords 11, 0, SCREEN_WIDTH - 1, 2 dw NULL db 1 ; default option MenuDataHeader_0x24b1d: ; 0x24b1d db $40 ; flags - db 11, 00 ; start coords - db 13, 08 ; end coords + menu_coords 0, 11, 8, 13 dw NULL db 1 ; default option diff --git a/engine/mon_menu.asm b/engine/mon_menu.asm index e3570ab70..7dc2a2393 100755 --- a/engine/mon_menu.asm +++ b/engine/mon_menu.asm @@ -56,8 +56,7 @@ MonSubmenu: ; 24d19 .MenuDataHeader: ; 24d3f db $40 ; tile backup - db 00, 06 ; start coords - db 17, 19 ; end coords + menu_coords 6, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw 0 db 1 ; default option ; 24d47 @@ -326,8 +325,7 @@ BattleMonMenu: ; 24e99 MenuDataHeader_0x24ed4: ; 24ed4 db $00 ; flags - db 11, 11 ; start coords - db 17, 19 ; end coords + menu_coords 11, 11, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw MenuData2_0x24edc db 1 ; default option ; 24edc diff --git a/engine/pack.asm b/engine/pack.asm index 323592d39..7dd900617 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -163,8 +163,7 @@ Pack: ; 10000 ; 10124 (4:4124) .MenuDataHeader1: ; 0x10124 db $40 ; flags - db 07, 13 ; start coords - db 11, 19 ; end coords + menu_coords 13, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData2_1 db 1 ; default option ; 0x1012c @@ -184,8 +183,7 @@ Pack: ; 10000 .MenuDataHeader2: ; 0x1013b db $40 ; flags - db 05, 13 ; start coords - db 11, 19 ; end coords + menu_coords 13, 5, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData2_2 db 1 ; default option ; 0x10143 @@ -324,8 +322,7 @@ Pack: ; 10000 ; 10249 (4:4249) MenuDataHeader_UsableKeyItem: ; 0x10249 db $40 ; flags - db 01, 13 ; start coords - db 11, 19 ; end coords + menu_coords 13, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData2 db 1 ; default option ; 0x10251 @@ -350,8 +347,7 @@ Jumptable_UseGiveTossRegisterQuit: ; 1026a MenuDataHeader_UsableItem: ; 0x10274 db $40 ; flags - db 03, 13 ; start coords - db 11, 19 ; end coords + menu_coords 13, 3, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData2 db 1 ; default option ; 0x1027c @@ -374,8 +370,7 @@ Jumptable_UseGiveTossQuit: ; 10291 MenuDataHeader_UnusableItem: ; 0x10299 db %01000000 ; flags - db 07, 13 ; start coords - db 11, 19 ; end coords + menu_coords 13, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData2 db 1 ; default option ; 0x102a1 @@ -394,8 +389,7 @@ Jumptable_UseQuit: ; 102ac MenuDataHeader_UnusableKeyItem: ; 0x102b0 db %01000000 ; flags - db 05, 13 ; start coords - db 11, 19 ; end coords + menu_coords 13, 5, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData2 db 1 ; default option ; 0x102b8 @@ -416,8 +410,7 @@ Jumptable_UseRegisterQuit: ; 102c7 MenuDataHeader_HoldableKeyItem: ; 0x102cd db $40 ; flags - db 03, 13 ; start coords - db 11, 19 ; end coords + menu_coords 13, 3, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData2 db 1 ; default option ; 0x102d5 @@ -440,8 +433,7 @@ Jumptable_GiveTossRegisterQuit: ; 102ea MenuDataHeader_HoldableItem: ; 0x102f2 db $40 ; flags - db 05, 13 ; start coords - db 11, 19 ; end coords + menu_coords 13, 5, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData2 db 1 ; default option ; 0x102fa @@ -858,8 +850,7 @@ TMHMSubmenu: ; 105dc (4:45dc) ; 10601 (4:4601) .UsableMenuDataHeader: ; 0x10601 db $40 ; flags - db 07, 13 ; start coords - db 11, 19 ; end coords + menu_coords 13, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .UsableMenuData2 db 1 ; default option ; 0x10609 @@ -878,8 +869,7 @@ TMHMSubmenu: ; 105dc (4:45dc) .UnusableMenuDataHeader: ; 0x10618 db $40 ; flags - db 09, 13 ; start coords - db 11, 19 ; end coords + menu_coords 13, 9, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .UnusableMenuData2 db 1 ; default option ; 0x10620 @@ -1170,8 +1160,7 @@ TutorialPack: ; 107bb ; 107ef (4:47ef) .ItemsMenuDataHeader: ; 0x107ef db $40 ; flags - db 01, 07 ; start coords - db 11, 19 ; end coords + menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .ItemsMenuData2 db 1 ; default option ; 0x107f7 @@ -1194,8 +1183,7 @@ TutorialPack: ; 107bb ; 1080e (4:480e) .KeyItemsMenuDataHeader: ; 0x1080e db $40 ; flags - db 01, 07 ; start coords - db 11, 19 ; end coords + menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .KeyItemsMenuData2 db 1 ; default option ; 0x10816 @@ -1227,8 +1215,7 @@ TutorialPack: ; 107bb ; 10842 (4:4842) .BallsMenuDataHeader: ; 0x10842 db $40 ; flags - db 01, 07 ; start coords - db 11, 19 ; end coords + menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .BallsMenuData2 db 1 ; default option ; 0x1084a @@ -1553,8 +1540,7 @@ Pack_InitColors: ; 10a40 ItemsPocketMenuDataHeader: ; 0x10a4f db $40 ; flags - db 01, 07 ; start coords - db 11, 19 ; end coords + menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData2 db 1 ; default option ; 0x10a57 @@ -1571,8 +1557,7 @@ ItemsPocketMenuDataHeader: ; 0x10a4f PC_Mart_ItemsPocketMenuDataHeader: ; 0x10a67 db $40 ; flags - db 01, 07 ; start coords - db 11, 19 ; end coords + menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData2 db 1 ; default option ; 0x10a6f @@ -1589,8 +1574,7 @@ PC_Mart_ItemsPocketMenuDataHeader: ; 0x10a67 KeyItemsPocketMenuDataHeader: ; 0x10a7f db $40 ; flags - db 01, 07 ; start coords - db 11, 19 ; end coords + menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData2 db 1 ; default option ; 0x10a87 @@ -1607,8 +1591,7 @@ KeyItemsPocketMenuDataHeader: ; 0x10a7f PC_Mart_KeyItemsPocketMenuDataHeader: ; 0x10a97 db $40 ; flags - db 01, 07 ; start coords - db 11, 19 ; end coords + menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData2 db 1 ; default option ; 0x10a9f @@ -1625,8 +1608,7 @@ PC_Mart_KeyItemsPocketMenuDataHeader: ; 0x10a97 BallsPocketMenuDataHeader: ; 0x10aaf db $40 ; flags - db 01, 07 ; start coords - db 11, 19 ; end coords + menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData2 db 1 ; default option ; 0x10ab7 @@ -1643,8 +1625,7 @@ BallsPocketMenuDataHeader: ; 0x10aaf PC_Mart_BallsPocketMenuDataHeader: ; 0x10ac7 db $40 ; flags - db 01, 07 ; start coords - db 11, 19 ; end coords + menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData2 db 1 ; default option ; 0x10acf diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index c47e5261e..d8086a5be 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -1871,8 +1871,7 @@ Slots_AskBet: ; 9307c (24:707c) .MenuDataHeader: ; 0x930d6 db $40 ; flags - db 10, 14 ; start coords - db 17, 19 ; end coords + menu_coords 14, 10, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw .MenuData2 db 1 ; default option ; 0x930de diff --git a/engine/start_menu.asm b/engine/start_menu.asm index 91d6caff9..efb7b80f9 100755 --- a/engine/start_menu.asm +++ b/engine/start_menu.asm @@ -153,15 +153,13 @@ StartMenu:: ; 125cd .MenuDataHeader: db $40 ; tile backup - db 0, 10 ; start coords - db 17, 19 ; end coords + menu_coords 10, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw .MenuData db 1 ; default selection .ContestMenuDataHeader: db $40 ; tile backup - db 2, 10 ; start coords - db 17, 19 ; end coords + menu_coords 10, 2, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw .MenuData db 1 ; default selection @@ -977,8 +975,7 @@ TakePartyItem: ; 12c60 GiveTakeItemMenuData: ; 12c9b db %01010000 - db 12, 12 ; start coords - db 17, 19 ; end coords + menu_coords 12, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw .Items db 1 ; default option @@ -1166,8 +1163,7 @@ MonMailAction: ; 12d45 .MenuDataHeader: db $40 ; flags - db 10, 12 ; start coords - db 17, 19 ; end coords + menu_coords 12, 10, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw .MenuData2 db 1 ; default option ; 0x12dd1 -- cgit v1.2.3 From 066cc91b136b7266288b832bfa212123400ed758 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Sat, 30 Dec 2017 12:23:20 +0100 Subject: Fix some MenuData2 labels Gave them better names, moved the flags out of the union, and documented the w2DMenuFlags1. --- engine/menu.asm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'engine') diff --git a/engine/menu.asm b/engine/menu.asm index 6fbed2848..636b26dbf 100755 --- a/engine/menu.asm +++ b/engine/menu.asm @@ -110,14 +110,14 @@ Mobile_GetMenuSelection: ; 24098 ret ; 240cd -GetMenuNumberOfColumns: ; 240cd - ld a, [wMenuData2Items] +Get2DMenuNumberOfColumns: ; 240cd + ld a, [wMenuData2_2DMenuDimensions] and $f ret ; 240d3 -GetMenuNumberOfRows: ; 240d3 - ld a, [wMenuData2Items] +Get2DMenuNumberOfRows: ; 240d3 + ld a, [wMenuData2_2DMenuDimensions] swap a and $f ret @@ -130,19 +130,19 @@ Place2DMenuItemStrings: ; 240db ld d, [hl] call GetMenuTextStartCoord call Coord2Tile - call GetMenuNumberOfRows + call Get2DMenuNumberOfRows ld b, a .row push bc push hl - call GetMenuNumberOfColumns + call Get2DMenuNumberOfColumns ld c, a .col push bc ld a, [wMenuData2_2DMenuItemStringsBank] call Place2DMenuItemName inc de - ld a, [wMenuData2Spacing] + ld a, [wMenuData2_2DMenuSpacing] ld c, a ld b, 0 add hl, bc @@ -174,9 +174,9 @@ Init2DMenuCursorPosition: ; 2411a (9:411a) dec c ld a, c ld [w2DMenuCursorInitX], a - call GetMenuNumberOfRows + call Get2DMenuNumberOfRows ld [w2DMenuNumRows], a - call GetMenuNumberOfColumns + call Get2DMenuNumberOfColumns ld [w2DMenuNumCols], a call .InitFlags_a call .InitFlags_b @@ -238,7 +238,7 @@ Init2DMenuCursorPosition: ; 2411a (9:411a) ; 2418a .InitFlags_b: ; 2418a - ld a, [wMenuData2Spacing] + ld a, [wMenuData2_2DMenuSpacing] or $20 ld [w2DMenuCursorOffsets], a ret -- cgit v1.2.3 From 11d67567d2c0182864a755a7bebcff0f29e877d6 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Sun, 14 Jan 2018 11:59:56 +0100 Subject: Use constants for menu flags Added a bunch of constants for the bitflags of each kind of menu. Some are slightly vague or too long, but I'm not sure how to else name them. --- engine/battle/menu.asm | 12 ++++++------ engine/billspc.asm | 16 ++++++++-------- engine/billspctop.asm | 4 ++-- engine/buy_sell_toss.asm | 6 +++--- engine/decorations.asm | 16 ++++++++-------- engine/delete_save_change_clock.asm | 8 ++++---- engine/events/buena.asm | 12 ++++++------ engine/events/crystal_unown.asm | 8 ++++---- engine/events/elevator.asm | 4 ++-- engine/events/kurt.asm | 11 ++++++----- engine/events/mom.asm | 4 ++-- engine/events/move_tutor.asm | 2 +- engine/events/pokecenter_pc.asm | 12 ++++++------ engine/events/pokepic.asm | 2 +- engine/events/std_scripts.asm | 4 ++-- engine/init_gender.asm | 4 ++-- engine/intro_menu.asm | 8 ++++---- engine/mail.asm | 8 ++++---- engine/main_menu.asm | 4 ++-- engine/mart.asm | 8 ++++---- engine/menu_2.asm | 4 ++-- engine/mon_menu.asm | 6 +++--- engine/pack.asm | 32 ++++++++++++++++---------------- engine/slot_machine.asm | 4 ++-- engine/start_menu.asm | 10 +++++----- 25 files changed, 105 insertions(+), 104 deletions(-) (limited to 'engine') diff --git a/engine/battle/menu.asm b/engine/battle/menu.asm index 07d3e6081..ccca4402a 100755 --- a/engine/battle/menu.asm +++ b/engine/battle/menu.asm @@ -33,7 +33,7 @@ Function24f19: ; 24f19 ; 24f2c BattleMenuDataHeader: ; 24f2c - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 12, 08 ; start coords db 17, 19 ; end coords dw MenuData_0x24f34 @@ -41,7 +41,7 @@ BattleMenuDataHeader: ; 24f2c ; 24f34 MenuData_0x24f34: ; 0x24f34 - db $81 ; flags + db STATICMENU_CURSOR | STATICMENU_DISABLE_B ; flags dn 2, 2 ; rows, columns db 6 ; spacing dba Strings24f3d @@ -56,7 +56,7 @@ Strings24f3d: ; 0x24f3d ; 24f4e MenuDataHeader_0x24f4e: ; 24f4e - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 12, 00 ; start coords db 17, 19 ; end coords dw MenuData_0x24f56 @@ -64,7 +64,7 @@ MenuDataHeader_0x24f4e: ; 24f4e ; 24f56 MenuData_0x24f56: ; 24f56 - db $81 ; flags + db STATICMENU_CURSOR | STATICMENU_DISABLE_B ; flags dn 2, 2 ; rows, columns db 11 ; spacing dba Strings24f5f @@ -87,7 +87,7 @@ Function24f7c: ; 24f7c ; 24f89 MenuDataHeader_0x24f89: ; 24f89 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 12, 02 ; start coords db 17, 19 ; end coords dw MenuData_0x24f91 @@ -95,7 +95,7 @@ MenuDataHeader_0x24f89: ; 24f89 ; 24f91 MenuData_0x24f91: ; 24f91 - db $81 ; flags + db STATICMENU_CURSOR | STATICMENU_DISABLE_B ; flags dn 2, 2 ; rows, columns db 12 ; spacing dba Strings24f9a diff --git a/engine/billspc.asm b/engine/billspc.asm index f94f495c6..10034c806 100755 --- a/engine/billspc.asm +++ b/engine/billspc.asm @@ -229,7 +229,7 @@ BillsPCDepositFuncCancel: ; e2537 (38:6537) ; e253d (38:653d) BillsPCDepositMenuDataHeader: ; 0xe253d (38:653d) - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 04, 09 ; start coords db 13, 19 ; end coords dw .MenuData2 @@ -237,7 +237,7 @@ BillsPCDepositMenuDataHeader: ; 0xe253d (38:653d) ; 0xe2545 .MenuData2: ; 0xe2545 (38:6545) - db $80 ; flags + db STATICMENU_CURSOR ; flags db 4 ; items db "DEPOSIT@" db "STATS@" @@ -490,7 +490,7 @@ BillsPC_Withdraw: ; e2675 (38:6675) ; e2731 (38:6731) .MenuDataHeader: ; 0xe2731 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 04, 09 ; start coords db 13, 19 ; end coords dw .MenuData @@ -498,7 +498,7 @@ BillsPC_Withdraw: ; e2675 (38:6675) ; 0xe2739 .MenuData: ; 0xe2739 - db $80 ; flags + db STATICMENU_CURSOR ; flags db 4 ; items db "WITHDRAW@" db "STATS@" @@ -714,7 +714,7 @@ _MovePKMNWithoutMail: ; e2759 ; e28c3 .MenuDataHeader: ; 0xe28c3 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 04, 09 ; start coords db 13, 19 ; end coords dw .MenuData2 @@ -722,7 +722,7 @@ _MovePKMNWithoutMail: ; e2759 ; 0xe28cb .MenuData2: ; 0xe28cb - db $80 ; flags + db STATICMENU_CURSOR ; flags db 3 ; items db "MOVE@" db "STATS@" @@ -2562,7 +2562,7 @@ BillsPC_ChangeBoxSubmenu: ; e36f9 (38:76f9) hlcoord 11, 7 ; XXX .MenuDataHeader: ; 0xe377b - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 04, 11 ; start coords db 13, 19 ; end coords dw .MenuData2 @@ -2570,7 +2570,7 @@ BillsPC_ChangeBoxSubmenu: ; e36f9 (38:76f9) ; 0xe3783 .MenuData2: ; 0xe3783 - db $80 ; flags + db STATICMENU_CURSOR ; flags db 4 ; items db "SWITCH@" db "NAME@" diff --git a/engine/billspctop.asm b/engine/billspctop.asm index c36cbe45d..f5ee3d7d8 100755 --- a/engine/billspctop.asm +++ b/engine/billspctop.asm @@ -69,14 +69,14 @@ _BillsPC: ; e3fd ret .MenuDataHeader: ; 0xe46f - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 00, 00 ; start coords db 17, 19 ; end coords dw .MenuData2 db 1 ; default option .MenuData2: ; 0xe477 - db $80 ; flags + db STATICMENU_CURSOR ; flags db 0 ; items dw .items dw PlaceMenuStrings diff --git a/engine/buy_sell_toss.asm b/engine/buy_sell_toss.asm index 37bee86b1..358ef4f30 100755 --- a/engine/buy_sell_toss.asm +++ b/engine/buy_sell_toss.asm @@ -214,7 +214,7 @@ BuySell_DisplaySubtotal: ; 250d1 ; 250ed TossItem_MenuDataHeader: ; 0x250ed - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 09, 15 ; start coords db 11, 19 ; end coords dw ret_25097 @@ -222,7 +222,7 @@ TossItem_MenuDataHeader: ; 0x250ed ; 0x250f5 BuyItem_MenuDataHeader: ; 0x250f5 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 15, 07 ; start coords db 17, 19 ; end coords dw DisplayPurchasePrice @@ -230,7 +230,7 @@ BuyItem_MenuDataHeader: ; 0x250f5 ; 0x250fd SellItem_MenuDataHeader: ; 0x250fd - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 15, 07 ; start coords db 17, 19 ; end coords dw DisplaySellingPrice diff --git a/engine/decorations.asm b/engine/decorations.asm index c1b703fb6..72a4d1aee 100755 --- a/engine/decorations.asm +++ b/engine/decorations.asm @@ -37,7 +37,7 @@ _KrisDecorationMenu: ; 0x2675c ; 0x2679a .MenuDataHeader: ; 0x2679a - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 00, 05 ; start coords db 17, 19 ; end coords dw .MenuData2 @@ -45,7 +45,7 @@ _KrisDecorationMenu: ; 0x2675c ; 0x267a2 .MenuData2: ; 0x267a2 - db $a0 ; flags + db STATICMENU_CURSOR | STATICMENU_WRAP ; flags db 0 ; items dw wd002 dw PlaceNthMenuStrings @@ -423,7 +423,7 @@ PopulateDecoCategoryMenu: ; 2695b ; 0x269b5 .NonscrollingMenuDataHeader: ; 0x269b5 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 00, 00 ; start coords db 17, 19 ; end coords dw .NonscrollingMenuData2 @@ -431,7 +431,7 @@ PopulateDecoCategoryMenu: ; 2695b ; 0x269bd .NonscrollingMenuData2: ; 0x269bd - db $a0 ; flags + db STATICMENU_CURSOR | STATICMENU_WRAP ; flags db 0 ; items dw wd002 dw DecorationMenuFunction @@ -439,7 +439,7 @@ PopulateDecoCategoryMenu: ; 2695b ; 0x269c5 .ScrollingMenuDataHeader: ; 0x269c5 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 01, 01 ; start coords db 16, 18 ; end coords dw .ScrollingMenuData2 @@ -447,7 +447,7 @@ PopulateDecoCategoryMenu: ; 2695b ; 0x269cd .ScrollingMenuData2: ; 0x269cd - db $10 ; flags + db SCROLLINGMENU_DISPLAY_ARROWS ; flags db 8, 0 ; rows, columns db 1 ; horizontal spacing dbw 0, wd002 ; text pointer @@ -951,7 +951,7 @@ QueryWhichSide: ; 26e9a ; 26eab MenuDataHeader_0x26eab: ; 0x26eab - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 00, 00 ; start coords db 07, 13 ; end coords dw MenuData2_0x26eb3 @@ -959,7 +959,7 @@ MenuDataHeader_0x26eab: ; 0x26eab ; 0x26eb3 MenuData2_0x26eb3: ; 0x26eb3 - db $80 ; flags + db STATICMENU_CURSOR ; flags db 3 ; items db "RIGHT SIDE@" db "LEFT SIDE@" diff --git a/engine/delete_save_change_clock.asm b/engine/delete_save_change_clock.asm index e77874e1c..b00c1ccc4 100755 --- a/engine/delete_save_change_clock.asm +++ b/engine/delete_save_change_clock.asm @@ -47,14 +47,14 @@ _ResetClock: ; 4d3b1 db "@" .NoYes_MenuDataHeader: ; 0x4d40d - db $00 ; flags + db 0 ; flags db 07, 14 ; start coords db 11, 19 ; end coords dw .NoYes_MenuData2 db 1 ; default option .NoYes_MenuData2: ; 0x4d415 - db $c0 ; flags + db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 2 ; items db "NO@" db "YES@" @@ -285,14 +285,14 @@ _DeleteSaveData: ; 4d54c db "@" .NoYesMenuDataHeader: ; 0x4d585 - db $00 ; flags + db 0 ; flags db 07, 14 ; start coords db 11, 19 ; end coords dw .MenuData2 db 1 ; default option .MenuData2: ; 0x4d58d - db $c0 ; flags + db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 2 ; items db "NO@" db "YES@" diff --git a/engine/events/buena.asm b/engine/events/buena.asm index 1227593eb..6070895fe 100644 --- a/engine/events/buena.asm +++ b/engine/events/buena.asm @@ -29,7 +29,7 @@ SpecialBuenasPassword: ; 8af6b ; 8afa9 .MenuDataHeader: ; 0x8afa9 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 00, 00 ; start coords db 07, 10 ; end coords dw .MenuData2 @@ -39,7 +39,7 @@ SpecialBuenasPassword: ; 8af6b db 0 .MenuData2: ; 0x8afb2 - db $81 ; flags + db STATICMENU_CURSOR | STATICMENU_DISABLE_B ; flags db 0 ; items dw .PasswordIndices dw .PlacePasswordChoices @@ -225,7 +225,7 @@ PrintBlueCardBalance: ; 8b097 ; 8b0d1 BlueCardBalanceMenuDataHeader: ; 0x8b0d1 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 11, 00 ; start coords db 13, 11 ; end coords ; 8b0d6 @@ -237,7 +237,7 @@ Buena_PlacePrizeMenuBox: ; 8b0d6 ; 8b0dd .menudataheader ; 0x8b0dd - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 00, 00 ; start coords db 11, 17 ; end coords ; 8b0e2 @@ -270,7 +270,7 @@ Buena_PrizeMenu: ; 8b0e2 ; 8b113 .MenuDataHeader: ; 0x8b113 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 01, 01 ; start coords db 09, 16 ; end coords dw .MenuData2 @@ -280,7 +280,7 @@ Buena_PrizeMenu: ; 8b0e2 db 0 .MenuData2: ; 0x8b11c - db $10 ; flags + db SCROLLINGMENU_DISPLAY_ARROWS ; flags db 4, 13 ; rows, columns db 1 ; spacing dba .indices diff --git a/engine/events/crystal_unown.asm b/engine/events/crystal_unown.asm index 09d44bb9a..54196498b 100644 --- a/engine/events/crystal_unown.asm +++ b/engine/events/crystal_unown.asm @@ -195,19 +195,19 @@ ENDM .MenuDataHeaders_UnownWalls: ; 0x8aed5 ;.MenuDataHeader_Escape: - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 04, 03 ; start coords db 09, 16 ; end coords ;.MenuDataHeader_Light: - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 04, 04 ; start coords db 09, 15 ; end coords ;.MenuDataHeader_Water: - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 04, 04 ; start coords db 09, 15 ; end coords ;.MenuDataHeader_Ho_Oh: - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 04, 04 ; start coords db 09, 15 ; end coords ; 8aee9 diff --git a/engine/events/elevator.asm b/engine/events/elevator.asm index 9170b642d..e936976bb 100755 --- a/engine/events/elevator.asm +++ b/engine/events/elevator.asm @@ -188,7 +188,7 @@ Elevator_GetCurrentFloorString: ; 1353f ; 13550 Elevator_MenuDataHeader: ; 0x13550 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 01, 12 ; start coords db 09, 18 ; end coords dw Elevator_MenuData2 @@ -196,7 +196,7 @@ Elevator_MenuDataHeader: ; 0x13550 ; 0x13558 Elevator_MenuData2: ; 0x13558 - db $10 ; flags + db SCROLLINGMENU_DISPLAY_ARROWS ; flags db 4, 0 ; rows, columns db 1 ; horizontal spacing dbw 0, CurElevator diff --git a/engine/events/kurt.asm b/engine/events/kurt.asm index 9bc06a613..4f3343dd1 100644 --- a/engine/events/kurt.asm +++ b/engine/events/kurt.asm @@ -84,7 +84,7 @@ Kurt_SelectApricorn: ; 88055 ; 88086 .MenuDataHeader: ; 0x88086 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 01, 01 ; start coords db 10, 13 ; end coords dw .MenuData2 @@ -94,7 +94,7 @@ Kurt_SelectApricorn: ; 88055 db 0 .MenuData2: ; 0x8808f - db $10 ; flags + db SCROLLINGMENU_DISPLAY_ARROWS ; flags db 4, 7 db 1 dbw 0, Buffer1 @@ -159,11 +159,12 @@ Kurt_SelectQuantity: ; 880c2 ; 8810d .MenuDataHeader: ; 0x8810d - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 09, 06 ; start coords db 12, 19 ; end coords - - db 0, 0, -1, 0 ; XXX + dw NULL + db -1 ; default option + db 0 .PlaceApricornName: ; 88116 call MenuBoxCoord2Tile diff --git a/engine/events/mom.asm b/engine/events/mom.asm index 6e3c7b320..061c12f8f 100644 --- a/engine/events/mom.asm +++ b/engine/events/mom.asm @@ -728,7 +728,7 @@ Mom_HeldString: ; 166b0 ; 166b5 MenuDataHeader_0x166b5: ; 0x166b5 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 00, 00 ; start coords db 10, 10 ; end coords dw MenuData2_0x166bd @@ -736,7 +736,7 @@ MenuDataHeader_0x166b5: ; 0x166b5 ; 0x166bd MenuData2_0x166bd: ; 0x166bd - db $80 ; flags + db STATICMENU_CURSOR ; flags db 4 ; items db "GET@" db "SAVE@" diff --git a/engine/events/move_tutor.asm b/engine/events/move_tutor.asm index a15ecaf93..5082364e0 100644 --- a/engine/events/move_tutor.asm +++ b/engine/events/move_tutor.asm @@ -98,6 +98,6 @@ CheckCanLearnMoveTutorMove: ; 492b9 ret .MenuDataHeader: ; 0x4930a - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 12, 00 ; start coords db 17, 19 ; end coords diff --git a/engine/events/pokecenter_pc.asm b/engine/events/pokecenter_pc.asm index 7045dc1c8..5d2dd35df 100755 --- a/engine/events/pokecenter_pc.asm +++ b/engine/events/pokecenter_pc.asm @@ -27,14 +27,14 @@ PokemonCenterPC: ; 1559a ret .TopMenu: - db $48 ; flags + db MENU_BACKUP_TILES | MENU_NO_CLICK_SFX ; flags db 00, 00 ; start coords db 12, 15 ; end coords dw .MenuData2 db 1 ; default option .MenuData2: - db $a0 ; flags + db STATICMENU_CURSOR | STATICMENU_WRAP ; flags db 0 ; items dw .WhichPC dw PlaceNthMenuStrings @@ -232,14 +232,14 @@ Function15715: ; 15715 ; 15736 KrissPCMenuData: ; 0x15736 - db %01000000 + db MENU_BACKUP_TILES ; flags db 0, 0 ; top left corner coords (y, x) db 12, 15 ; bottom right corner coords (y, x) dw .KrissPCMenuData2 db 1 ; default selected option .KrissPCMenuData2: - db %10100000 ; bit7 + db STATICMENU_CURSOR | STATICMENU_WRAP ; flags db 0 ; # items? dw .KrissPCMenuList1 dw PlaceNthMenuStrings @@ -620,14 +620,14 @@ PCItemsJoypad: ; 0x15985 ret .PCItemsMenuData: - db %01000000 + db MENU_BACKUP_TILES db 1, 4 ; start coords db 10, 18 ; end coords dw .MenuData2 db 1 ; default option .MenuData2: - db %10110000 + db SCROLLINGMENU_ENABLE_SELECT | SCROLLINGMENU_ENABLE_FUNCTION3 | SCROLLINGMENU_DISPLAY_ARROWS ; flags db 4, 8 ; rows/cols? db 2 ; horizontal spacing? dbw 0, PCItems diff --git a/engine/events/pokepic.asm b/engine/events/pokepic.asm index 82016403b..854e73d01 100755 --- a/engine/events/pokepic.asm +++ b/engine/events/pokepic.asm @@ -42,7 +42,7 @@ ClosePokepic:: ; 24528 ret PokepicMenuDataHeader: ; 0x24547 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 04, 06 ; start coords db 13, 14 ; end coords dw NULL diff --git a/engine/events/std_scripts.asm b/engine/events/std_scripts.asm index 297725c60..315e80d17 100644 --- a/engine/events/std_scripts.asm +++ b/engine/events/std_scripts.asm @@ -1868,14 +1868,14 @@ CoinVendor_IntroScript: ; 0xbcde0 .MenuDataHeader: - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 04, 00 ; start coords db 11, 15 ; end coords dw .MenuData2 db 1 ; default option .MenuData2: - db $80 ; flags + db STATICMENU_CURSOR ; flags db 3 ; items db " 50 : ¥1000@" db "500 : ¥10000@" diff --git a/engine/init_gender.asm b/engine/init_gender.asm index 588709b88..92be6c371 100755 --- a/engine/init_gender.asm +++ b/engine/init_gender.asm @@ -44,7 +44,7 @@ InitGender: ; 48dcb (12:4dcb) ; 48dfc (12:4dfc) .MenuDataHeader: ; 0x48dfc - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 04, 06 ; start coords db 09, 12 ; end coords dw .MenuData2 @@ -52,7 +52,7 @@ InitGender: ; 48dcb (12:4dcb) ; 0x48e04 .MenuData2: ; 0x48e04 - db $a1 ; flags + db STATICMENU_CURSOR | STATICMENU_WRAP | STATICMENU_DISABLE_B ; flags db 2 ; items db "Boy@" db "Girl@" diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index 7d17b62e5..a91327b1c 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -553,7 +553,7 @@ Continue_LoadMenuHeader: ; 5ebf ; 5ed9 .MenuDataHeader_Dex: ; 5ed9 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 00, 00 ; start coords db 09, 15 ; end coords dw .MenuData2_Dex @@ -561,7 +561,7 @@ Continue_LoadMenuHeader: ; 5ebf ; 5ee1 .MenuData2_Dex: ; 5ee1 - db $00 ; flags + db 0 ; flags db 4 ; items db "PLAYER@" db "BADGES@" @@ -570,7 +570,7 @@ Continue_LoadMenuHeader: ; 5ebf ; 5efb .MenuDataHeader_NoDex: ; 5efb - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 00, 00 ; start coords db 09, 15 ; end coords dw .MenuData2_NoDex @@ -578,7 +578,7 @@ Continue_LoadMenuHeader: ; 5ebf ; 5f03 .MenuData2_NoDex: ; 5f03 - db $00 ; flags + db 0 ; flags db 4 ; items db "PLAYER @" db "BADGES@" diff --git a/engine/mail.asm b/engine/mail.asm index 0335a6dfe..04c31af17 100755 --- a/engine/mail.asm +++ b/engine/mail.asm @@ -558,14 +558,14 @@ MailboxPC: ; 0x44806 ret .TopMenuDataHeader: ; 0x4494c - db %01000000 ; flags + db MENU_BACKUP_TILES ; flags db 1, 8 ; start coords db 10, 18 ; end coords dw .TopMenuData2 db 1 ; default option .TopMenuData2: - db %00010000 ; flags + db SCROLLINGMENU_DISPLAY_ARROWS ; flags db 4, 0 ; rows/columns? db 1 ; horizontal spacing? dbw 0, wMailboxCount ; text pointer @@ -574,14 +574,14 @@ MailboxPC: ; 0x44806 dba NULL .SubMenuDataHeader: ; 0x44964 - db %01000000 ; flags + db MENU_BACKUP_TILES ; flags db 0, 0 ; start coords db 9, 13 ; end coords dw .SubMenuData2 db 1 ; default option .SubMenuData2: - db %10000000 ; flags + db STATICMENU_CURSOR ; flags db 4 ; items db "READ MAIL@" db "PUT IN PACK@" diff --git a/engine/main_menu.asm b/engine/main_menu.asm index cbd516cd7..1f6686d1f 100755 --- a/engine/main_menu.asm +++ b/engine/main_menu.asm @@ -30,7 +30,7 @@ MainMenu: ; 49cdc ; 49d14 .MenuDataHeader: ; 49d14 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 00, 00 ; start coords db 07, 16 ; end coords dw .MenuData2 @@ -38,7 +38,7 @@ MainMenu: ; 49cdc ; 49d1c .MenuData2: ; 49d1c - db $80 ; flags + db STATICMENU_CURSOR ; flags db 0 ; items dw MainMenuItems dw PlaceMenuStrings diff --git a/engine/mart.asm b/engine/mart.asm index 4a8d9e17b..44f3b087b 100755 --- a/engine/mart.asm +++ b/engine/mart.asm @@ -617,7 +617,7 @@ Text_Mart_CostsThisMuch: ; 0x15e13 ; 0x15e18 MenuDataHeader_Buy: ; 0x15e18 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 03, 01 ; start coords db 11, 19 ; end coords dw .menudata2 @@ -625,7 +625,7 @@ MenuDataHeader_Buy: ; 0x15e18 ; 0x15e20 .menudata2 ; 0x15e20 - db $30 ; pointers + db SCROLLINGMENU_DISPLAY_ARROWS | SCROLLINGMENU_ENABLE_FUNCTION3 ; flags db 4, 8 ; rows, columns db 1 ; horizontal spacing dbw 0, CurMart @@ -902,7 +902,7 @@ Text_Mart_HowMayIHelpYou: ; 0x15f83 ; 0x15f88 MenuDataHeader_BuySell: ; 0x15f88 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 00, 00 ; start coords db 08, 07 ; end coords dw .menudata2 @@ -910,7 +910,7 @@ MenuDataHeader_BuySell: ; 0x15f88 ; 0x15f90 .menudata2 ; 0x15f90 - db $80 ; strings + db STATICMENU_CURSOR ; strings db 3 ; items db "BUY@" db "SELL@" diff --git a/engine/menu_2.asm b/engine/menu_2.asm index d88b75152..d3eb499bf 100644 --- a/engine/menu_2.asm +++ b/engine/menu_2.asm @@ -53,14 +53,14 @@ PlaceMoneyDataHeader: ; 24b01 ret MenuDataHeader_0x24b15: ; 0x24b15 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 00, 11 ; start coords db 02, 19 ; end coords dw NULL db 1 ; default option MenuDataHeader_0x24b1d: ; 0x24b1d - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 11, 00 ; start coords db 13, 08 ; end coords dw NULL diff --git a/engine/mon_menu.asm b/engine/mon_menu.asm index e3570ab70..dfd11e42a 100755 --- a/engine/mon_menu.asm +++ b/engine/mon_menu.asm @@ -55,7 +55,7 @@ MonSubmenu: ; 24d19 ; 24d3f .MenuDataHeader: ; 24d3f - db $40 ; tile backup + db MENU_BACKUP_TILES ; tile backup db 00, 06 ; start coords db 17, 19 ; end coords dw 0 @@ -325,7 +325,7 @@ BattleMonMenu: ; 24e99 ; 24ed4 MenuDataHeader_0x24ed4: ; 24ed4 - db $00 ; flags + db 0 ; flags db 11, 11 ; start coords db 17, 19 ; end coords dw MenuData2_0x24edc @@ -333,7 +333,7 @@ MenuDataHeader_0x24ed4: ; 24ed4 ; 24edc MenuData2_0x24edc: ; 24edc - db $c0 ; flags + db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 3 ; items db "SWITCH@" db "STATS@" diff --git a/engine/pack.asm b/engine/pack.asm index 047924cb0..3e6470faf 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -147,7 +147,7 @@ Pack: ; 10000 ; 10124 (4:4124) .MenuDataHeader1: ; 0x10124 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 07, 13 ; start coords db 11, 19 ; end coords dw .MenuData2_1 @@ -155,7 +155,7 @@ Pack: ; 10000 ; 0x1012c .MenuData2_1: ; 0x1012c - db $c0 ; flags + db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 2 ; items db "USE@" db "QUIT@" @@ -169,7 +169,7 @@ Pack: ; 10000 ; 1013b .MenuDataHeader2: ; 0x1013b - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 05, 13 ; start coords db 11, 19 ; end coords dw .MenuData2_2 @@ -177,7 +177,7 @@ Pack: ; 10000 ; 0x10143 .MenuData2_2: ; 0x10143 - db $c0 ; flags + db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 3 ; items db "USE@" db "GIVE@" @@ -309,7 +309,7 @@ Pack: ; 10000 ; 10249 (4:4249) MenuDataHeader_UsableKeyItem: ; 0x10249 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 01, 13 ; start coords db 11, 19 ; end coords dw .MenuData2 @@ -317,7 +317,7 @@ MenuDataHeader_UsableKeyItem: ; 0x10249 ; 0x10251 .MenuData2: ; 0x10251 - db $c0 ; flags + db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 5 ; items db "USE@" db "GIVE@" @@ -336,7 +336,7 @@ Jumptable_UseGiveTossRegisterQuit: ; 1026a ; 10274 MenuDataHeader_UsableItem: ; 0x10274 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 03, 13 ; start coords db 11, 19 ; end coords dw .MenuData2 @@ -344,7 +344,7 @@ MenuDataHeader_UsableItem: ; 0x10274 ; 0x1027c .MenuData2: ; 0x1027c - db $c0 ; flags + db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 4 ; items db "USE@" db "GIVE@" @@ -361,7 +361,7 @@ Jumptable_UseGiveTossQuit: ; 10291 ; 10299 MenuDataHeader_UnusableItem: ; 0x10299 - db %01000000 ; flags + db MENU_BACKUP_TILES ; flags db 07, 13 ; start coords db 11, 19 ; end coords dw .MenuData2 @@ -369,7 +369,7 @@ MenuDataHeader_UnusableItem: ; 0x10299 ; 0x102a1 .MenuData2: ; 0x102a1 - db $c0 ; flags + db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 2 ; items db "USE@" db "QUIT@" @@ -382,7 +382,7 @@ Jumptable_UseQuit: ; 102ac ; 102b0 MenuDataHeader_UnusableKeyItem: ; 0x102b0 - db %01000000 ; flags + db MENU_BACKUP_TILES ; flags db 05, 13 ; start coords db 11, 19 ; end coords dw .MenuData2 @@ -390,7 +390,7 @@ MenuDataHeader_UnusableKeyItem: ; 0x102b0 ; 0x102b8 .MenuData2: ; 0x102b8 - db $c0 ; flags + db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 3 ; items db "USE@" db "SEL@" @@ -405,7 +405,7 @@ Jumptable_UseRegisterQuit: ; 102c7 ; 102cd MenuDataHeader_HoldableKeyItem: ; 0x102cd - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 03, 13 ; start coords db 11, 19 ; end coords dw .MenuData2 @@ -413,7 +413,7 @@ MenuDataHeader_HoldableKeyItem: ; 0x102cd ; 0x102d5 .MenuData2: ; 0x102d5 - db $c0 ; flags + db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 4 ; items db "GIVE@" db "TOSS@" @@ -430,7 +430,7 @@ Jumptable_GiveTossRegisterQuit: ; 102ea ; 102f2 MenuDataHeader_HoldableItem: ; 0x102f2 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 05, 13 ; start coords db 11, 19 ; end coords dw .MenuData2 @@ -438,7 +438,7 @@ MenuDataHeader_HoldableItem: ; 0x102f2 ; 0x102fa .MenuData2: ; 0x102fa - db $c0 ; flags + db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 3 ; items db "GIVE@" db "TOSS@" diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index aea08f16a..17552878d 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -1868,7 +1868,7 @@ Slots_AskBet: ; 9307c (24:707c) ; 0x930d6 .MenuDataHeader: ; 0x930d6 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 10, 14 ; start coords db 17, 19 ; end coords dw .MenuData2 @@ -1876,7 +1876,7 @@ Slots_AskBet: ; 9307c (24:707c) ; 0x930de .MenuData2: ; 0x930de - db $80 ; flags + db STATICMENU_CURSOR ; flags db 3 ; items db " 3@" db " 2@" diff --git a/engine/start_menu.asm b/engine/start_menu.asm index 913bf3780..a07e8ff4a 100755 --- a/engine/start_menu.asm +++ b/engine/start_menu.asm @@ -152,21 +152,21 @@ StartMenu:: ; 125cd .MenuDataHeader: - db $40 ; tile backup + db MENU_BACKUP_TILES ; flags db 0, 10 ; start coords db 17, 19 ; end coords dw .MenuData db 1 ; default selection .ContestMenuDataHeader: - db $40 ; tile backup + db MENU_BACKUP_TILES ; flags db 2, 10 ; start coords db 17, 19 ; end coords dw .MenuData db 1 ; default selection .MenuData: - db %10101000 ; x padding, wrap around, start can close + db STATICMENU_CURSOR | STATICMENU_WRAP | STATICMENU_ENABLE_START ; flags dn 0, 0 ; rows, columns dw MenuItemsList dw .MenuString @@ -1165,7 +1165,7 @@ MonMailAction: ; 12d45 .MenuDataHeader: - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 10, 12 ; start coords db 17, 19 ; end coords dw .MenuData2 @@ -1173,7 +1173,7 @@ MonMailAction: ; 12d45 ; 0x12dd1 .MenuData2: - db $80 ; flags + db STATICMENU_CURSOR ; flags db 3 ; items db "READ@" db "TAKE@" -- cgit v1.2.3 From eb3102200f66e3aa1688e4e52429fcac4b0272fa Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sun, 14 Jan 2018 19:26:55 -0500 Subject: More Battle Tower map script constants, fewer raw hex values --- engine/battle/core.asm | 4 ++-- engine/events/battle_tower/battle_tower.asm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'engine') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 35d2098bc..a604bc37a 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -2452,7 +2452,7 @@ WinTrainerBattle: ; 3cfa4 ld c, 40 call DelayFrames call EmptyBattleTextBox - ld c, $3 + ld c, BATTLETOWERTEXT_LOSS_TEXT farcall BattleTowerText call WaitPressAorB_BlinkCursor ld hl, wPayDayMoney @@ -3022,7 +3022,7 @@ LostBattle: ; 3d38e call DelayFrames call EmptyBattleTextBox - ld c, 2 + ld c, BATTLETOWERTEXT_WIN_TEXT farcall BattleTowerText call WaitPressAorB_BlinkCursor call ClearTileMap diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm index 5a132a2cb..d3a292811 100755 --- a/engine/events/battle_tower/battle_tower.asm +++ b/engine/events/battle_tower/battle_tower.asm @@ -1659,11 +1659,11 @@ ret_170bd2: ; 170bd2 SpecialCheckForBattleTowerRules: ; 170bd3 farcall CheckForBattleTowerRules jr c, .asm_170bde - xor a + xor a ; FALSE jr .asm_170be0 .asm_170bde - ld a, $1 + ld a, TRUE .asm_170be0 ld [ScriptVar], a -- cgit v1.2.3 From 7a09fc9f750aec50dd568226083b279004ffe155 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sun, 14 Jan 2018 19:43:35 -0500 Subject: GFX tile sizes in decimal --- engine/battle_anims/anim_commands.asm | 4 ++-- engine/credits.asm | 6 +++--- engine/crystal_intro.asm | 2 +- engine/debug.asm | 4 ++-- engine/events/celebi.asm | 16 +++++++++------- engine/intro_menu.asm | 2 +- engine/namingscreen.asm | 2 +- engine/pokedex.asm | 2 +- engine/pokedex_3.asm | 2 +- engine/pokegear.asm | 4 ++-- engine/trade_animation.asm | 8 ++++---- engine/trainer_card.asm | 8 ++++---- 12 files changed, 31 insertions(+), 29 deletions(-) (limited to 'engine') diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index 2d5a53aa0..fde4d2969 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -1077,7 +1077,7 @@ GetMinimizePic: ; cc6e7 (33:46e7) call CopyMinimizePic ld hl, vTiles2 tile $00 ld de, sScratch - lb bc, BANK(GetMinimizePic), $31 + lb bc, BANK(GetMinimizePic), 7 * 7 ret .player @@ -1085,7 +1085,7 @@ GetMinimizePic: ; cc6e7 (33:46e7) call CopyMinimizePic ld hl, vTiles2 tile $31 ld de, sScratch - lb bc, BANK(GetMinimizePic), $24 + lb bc, BANK(GetMinimizePic), 6 * 6 ret CopyMinimizePic: ; cc719 (33:4719) diff --git a/engine/credits.asm b/engine/credits.asm index 0df0d9f7b..a805ea565 100644 --- a/engine/credits.asm +++ b/engine/credits.asm @@ -34,17 +34,17 @@ Credits:: ; 109847 ld de, CreditsBorderGFX ld hl, vTiles2 tile $20 - lb bc, BANK(CreditsBorderGFX), $09 + lb bc, BANK(CreditsBorderGFX), 9 call Request2bpp ld de, CopyrightGFX ld hl, vTiles2 tile $60 - lb bc, BANK(CopyrightGFX), $1d + lb bc, BANK(CopyrightGFX), 29 call Request2bpp ld de, TheEndGFX ld hl, vTiles2 tile $40 - lb bc, BANK(TheEndGFX), $10 + lb bc, BANK(TheEndGFX), 16 call Request2bpp ld a, $ff diff --git a/engine/crystal_intro.asm b/engine/crystal_intro.asm index 7ce19004a..dd1ea506c 100755 --- a/engine/crystal_intro.asm +++ b/engine/crystal_intro.asm @@ -52,7 +52,7 @@ Copyright_GFPresents: ; e4579 .GetGFLogoGFX: ; e45e8 ld de, GameFreakLogo ld hl, vTiles2 - lb bc, BANK(GameFreakLogo), $1c + lb bc, BANK(GameFreakLogo), 28 call Get1bpp ld a, [rSVBK] diff --git a/engine/debug.asm b/engine/debug.asm index d95676db8..c36652148 100755 --- a/engine/debug.asm +++ b/engine/debug.asm @@ -1061,9 +1061,9 @@ TilesetColorTest: call WaitBGMap2 xor a ld [hBGMapMode], a - ld de, DebugColorTestGFX + $10 + ld de, DebugColorTestGFX + 1 tiles ld hl, vTiles2 tile $6a - lb bc, BANK(DebugColorTestGFX), $16 + lb bc, BANK(DebugColorTestGFX), 22 call Request2bpp ld de, DebugColorTestGFX ld hl, vTiles1 diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm index e61bdec8f..58509f383 100755 --- a/engine/events/celebi.asm +++ b/engine/events/celebi.asm @@ -1,3 +1,5 @@ +SPECIALCELEBIEVENT_CELEBI EQU $84 + Special_CelebiShrineEvent: ; 4989a call DelayFrame ld a, [VramState] @@ -10,7 +12,7 @@ Special_CelebiShrineEvent: ; 4989a call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $84 + ld [hl], SPECIALCELEBIEVENT_CELEBI ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID add hl, bc ld [hl], SPRITE_ANIM_SEQ_CELEBI @@ -76,8 +78,8 @@ LoadCelebiGFX: ; 49912 lb bc, BANK(SpecialCelebiLeafGFX), 4 call Request2bpp ld de, SpecialCelebiGFX - ld hl, vTiles0 tile $84 - lb bc, BANK(SpecialCelebiGFX), $10 + ld hl, vTiles0 tile SPECIALCELEBIEVENT_CELEBI + lb bc, BANK(SpecialCelebiGFX), 4 * 4 call Request2bpp xor a ld [wJumptableIndex], a @@ -306,22 +308,22 @@ GetCelebiSpriteTile: ; 49bae .Frame1: - ld a, $84 + ld a, SPECIALCELEBIEVENT_CELEBI jr .load_tile .Frame2: - ld a, $88 + ld a, SPECIALCELEBIEVENT_CELEBI + 4 jr .load_tile .Frame3: - ld a, $8c + ld a, SPECIALCELEBIEVENT_CELEBI + 8 jr .load_tile .Frame4: - ld a, $90 + ld a, SPECIALCELEBIEVENT_CELEBI + 12 .load_tile ld hl, SPRITEANIMSTRUCT_TILE_ID diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index 31e19778c..b92ddc22e 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -1376,7 +1376,7 @@ Copyright: ; 63e2 call LoadFontsExtra ld de, CopyrightGFX ld hl, vTiles2 tile $60 - lb bc, BANK(CopyrightGFX), $1d + lb bc, BANK(CopyrightGFX), 29 call Request2bpp hlcoord 2, 7 ld de, CopyrightString diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index 9d915dc9e..98a64c775 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -182,7 +182,7 @@ NamingScreen: ; 116c1 .Box: ; 117f5 (4:57f5) ld de, PokeBallSpriteGFX ld hl, vTiles0 tile $00 - lb bc, BANK(PokeBallSpriteGFX), $4 + lb bc, BANK(PokeBallSpriteGFX), 4 call Request2bpp xor a ld hl, wSpriteAnimDict diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 69a51c792..243b85613 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -829,7 +829,7 @@ Pokedex_UpdateUnownMode: ; 405df (10:45df) .decompress ld hl, PokedexLZ ld de, vTiles2 tile $31 - lb bc, BANK(PokedexLZ), $3a + lb bc, BANK(PokedexLZ), 58 call DecompressRequest2bpp .done diff --git a/engine/pokedex_3.asm b/engine/pokedex_3.asm index 482f55799..dc52f83d3 100644 --- a/engine/pokedex_3.asm +++ b/engine/pokedex_3.asm @@ -7,7 +7,7 @@ LoadSGBPokedexGFX: ; 1ddf1c LoadSGBPokedexGFX2: ; 1ddf26 (77:5f26) ld hl, SGBPokedexGFX_LZ ld de, vTiles2 tile $31 - lb bc, BANK(SGBPokedexGFX_LZ), $3a + lb bc, BANK(SGBPokedexGFX_LZ), 58 call DecompressRequest2bpp ret diff --git a/engine/pokegear.asm b/engine/pokegear.asm index ee993749e..29946a47d 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -116,7 +116,7 @@ Pokegear_LoadGFX: ; 90c4e ld a, BANK(TownMapGFX) call FarDecompress ld hl, PokegearGFX - ld de, vTiles2 + $30 tiles + ld de, vTiles2 tile $30 ld a, BANK(PokegearGFX) call FarDecompress ld hl, PokegearSpritesGFX @@ -2944,7 +2944,7 @@ TownMapPlayerIcon: ; 91fa6 LoadTownMapGFX: ; 91ff2 ld hl, TownMapGFX ld de, vTiles2 - lb bc, BANK(TownMapGFX), $30 + lb bc, BANK(TownMapGFX), 48 call DecompressRequest2bpp ret diff --git a/engine/trade_animation.asm b/engine/trade_animation.asm index b6711ac61..e63d95cd7 100755 --- a/engine/trade_animation.asm +++ b/engine/trade_animation.asm @@ -1512,15 +1512,15 @@ LoadTradeBallAndCableGFX: ; 2982b call DelayFrame ld de, TradeBallGFX ld hl, vTiles0 tile $62 - lb bc, BANK(TradeBallGFX), $6 + lb bc, BANK(TradeBallGFX), 6 call Request2bpp ld de, TradePoofGFX ld hl, vTiles0 tile $68 - lb bc, BANK(TradePoofGFX), $c + lb bc, BANK(TradePoofGFX), 12 call Request2bpp ld de, TradeCableGFX ld hl, vTiles0 tile $74 - lb bc, BANK(TradeCableGFX), $4 + lb bc, BANK(TradeCableGFX), 4 call Request2bpp xor a ld hl, wSpriteAnimDict @@ -1536,7 +1536,7 @@ LoadTradeBubbleGFX: ; 2985a callfar LoadMenuMonIcon ld de, TradeBubbleGFX ld hl, vTiles0 tile $72 - lb bc, BANK(TradeBubbleGFX), $4 + lb bc, BANK(TradeBubbleGFX), 4 call Request2bpp xor a ld hl, wSpriteAnimDict diff --git a/engine/trainer_card.asm b/engine/trainer_card.asm index 82c6bd199..5f48d2e5d 100755 --- a/engine/trainer_card.asm +++ b/engine/trainer_card.asm @@ -147,11 +147,11 @@ TrainerCard_Page2_LoadGFX: ; 251f4 (9:51f4) call WaitBGMap ld de, LeaderGFX ld hl, vTiles2 tile $29 - lb bc, BANK(LeaderGFX), $56 + lb bc, BANK(LeaderGFX), 86 call Request2bpp ld de, BadgeGFX ld hl, vTiles0 tile $00 - lb bc, BANK(BadgeGFX), $2c + lb bc, BANK(BadgeGFX), 44 call Request2bpp call TrainerCard_Page2_3_InitObjectsAndStrings call TrainerCard_IncrementJumptable @@ -196,11 +196,11 @@ TrainerCard_Page3_LoadGFX: ; 2524c (9:524c) call WaitBGMap ld de, LeaderGFX2 ld hl, vTiles2 tile $29 - lb bc, BANK(LeaderGFX2), $56 + lb bc, BANK(LeaderGFX2), 86 call Request2bpp ld de, BadgeGFX2 ld hl, vTiles0 tile $00 - lb bc, BANK(BadgeGFX2), $2c + lb bc, BANK(BadgeGFX2), 44 call Request2bpp call TrainerCard_Page2_3_InitObjectsAndStrings call TrainerCard_IncrementJumptable -- cgit v1.2.3 From 8e1e583640fcb82cb8d6327a0174a892b4ba0ad2 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sun, 14 Jan 2018 20:58:49 -0500 Subject: Close #470 (JOHTO_POKEMON) --- engine/link.asm | 2 +- engine/pic_animation.asm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/link.asm b/engine/link.asm index 779c288e8..bbb151965 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -2050,7 +2050,7 @@ Special_CheckTimeCapsuleCompatibility: ; 29bfb ld a, [hli] cp -1 jr z, .checkitem - cp MEW + 1 + cp JOHTO_POKEMON jr nc, .mon_too_new dec b jr nz, .loop diff --git a/engine/pic_animation.asm b/engine/pic_animation.asm index 33b770b14..4617c5f70 100644 --- a/engine/pic_animation.asm +++ b/engine/pic_animation.asm @@ -1024,7 +1024,7 @@ GetMonFramesPointer: ; d05ce ld hl, UnownFramesPointers jr z, .got_frames ld a, [wPokeAnimSpecies] - cp CHIKORITA + cp JOHTO_POKEMON ld b, BANK(FramesPointers) ld c, BANK(KantoFrames) ld hl, FramesPointers -- cgit v1.2.3 From fe3ef73a8c2d22da6067bdeab1686a24d527a65e Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Mon, 15 Jan 2018 00:44:40 -0500 Subject: Group unused data --- engine/namingscreen.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index f16f7176f..75d25179c 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -771,7 +771,7 @@ NamingScreen_AdvanceCursor_CheckEndOfString: ; 11b27 ; 11b56 -INCLUDE "data/unused_text/dakutens.asm" +INCLUDE "data/unused/dakutens.asm" ; 11bbc -- cgit v1.2.3 From 911c1320a29b7fd746fd7573ec562d8e21ca3001 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Mon, 15 Jan 2018 01:10:56 -0500 Subject: Document PredefPals still used by CGB layouts --- engine/color.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/color.asm b/engine/color.asm index 7376cdf1a..e2c227d63 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -466,7 +466,7 @@ Unreferenced_Function95f0: CopyFourPalettes: ld de, wBGPals1 - ld c, $4 + ld c, 4 CopyPalettes: .loop -- cgit v1.2.3 From 9bb584798e0b54a5f953665288165af86524a47c Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Mon, 15 Jan 2018 10:55:44 -0500 Subject: =?UTF-8?q?=5FSpecial=5FBugContestJudging=20=E2=86=92=20=5FBugCont?= =?UTF-8?q?estJudging;=20HOF=5FPredef=5FAnimateFrontpic=20=E2=86=92=20Pred?= =?UTF-8?q?ef=5FHOF=5FAnimateFrontpic=20(close=20#473)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/events/bug_contest/judging.asm | 2 +- engine/events/halloffame.asm | 4 ++-- engine/pic_animation.asm | 2 +- engine/predef.asm | 2 +- engine/specials.asm | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'engine') diff --git a/engine/events/bug_contest/judging.asm b/engine/events/bug_contest/judging.asm index 8681feb8d..a8cb80efe 100755 --- a/engine/events/bug_contest/judging.asm +++ b/engine/events/bug_contest/judging.asm @@ -1,4 +1,4 @@ -_Special_BugContestJudging: ; 1369d +_BugContestJudging: ; 1369d call ContestScore farcall StubbedTrainerRankings_BugContestScore call BugContest_JudgeContestants diff --git a/engine/events/halloffame.asm b/engine/events/halloffame.asm index c3e90b597..6b01ee831 100755 --- a/engine/events/halloffame.asm +++ b/engine/events/halloffame.asm @@ -130,7 +130,7 @@ AnimateHallOfFame: ; 864c3 call WaitBGMap decoord 6, 5 ld c, $6 - predef HOF_Predef_AnimateFrontpic + predef Predef_HOF_AnimateFrontpic ld c, 60 call DelayFrames and a @@ -403,7 +403,7 @@ _HallOfFamePC: ; 86650 call SetPalettes decoord 6, 5 ld c, $6 - predef HOF_Predef_AnimateFrontpic + predef Predef_HOF_AnimateFrontpic and a ret diff --git a/engine/pic_animation.asm b/engine/pic_animation.asm index 062998e5f..6f38967fe 100644 --- a/engine/pic_animation.asm +++ b/engine/pic_animation.asm @@ -1114,7 +1114,7 @@ UnusedPredef48: ; d0669 Predef 48 ld a, $1 ld [wBoxAlignment], a -HOF_Predef_AnimateFrontpic: ; d066e Predef 49 +Predef_HOF_AnimateFrontpic: ; d066e Predef 49 call AnimateMon_CheckIfPokemon jr c, .fail ld h, d diff --git a/engine/predef.asm b/engine/predef.asm index 62ca7b147..da18611e8 100644 --- a/engine/predef.asm +++ b/engine/predef.asm @@ -103,6 +103,6 @@ PredefPointers:: ; 856b add_predef Predef_LoadMonAnimation add_predef Predef_AnimateFrontpic add_predef UnusedPredef48 ; $48 - add_predef HOF_Predef_AnimateFrontpic + add_predef Predef_HOF_AnimateFrontpic dbw $ff, InexplicablyEmptyFunction ; ??? ; 864c diff --git a/engine/specials.asm b/engine/specials.asm index cb8eb3a6b..5ce412093 100644 --- a/engine/specials.asm +++ b/engine/specials.asm @@ -364,7 +364,7 @@ Special_GetMysteryGiftItem: ; c309 ; 0xc34a Special_BugContestJudging: ; c34a - farcall _Special_BugContestJudging + farcall _BugContestJudging ld a, b ld [ScriptVar], a ret -- cgit v1.2.3 From 9180362211cf465c52798124baa5c5c06ba1d332 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Mon, 15 Jan 2018 11:06:17 -0500 Subject: Move code out of gfx/ (close #474) --- engine/events/loadfishinggfx.asm | 46 ++++ engine/load_font.asm | 156 +++++++++++ engine/load_pics.asm | 494 ++++++++++++++++++++++++++++++++++ engine/routines/loadoverworldfont.asm | 17 ++ 4 files changed, 713 insertions(+) create mode 100644 engine/events/loadfishinggfx.asm create mode 100644 engine/load_font.asm create mode 100755 engine/load_pics.asm create mode 100644 engine/routines/loadoverworldfont.asm (limited to 'engine') diff --git a/engine/events/loadfishinggfx.asm b/engine/events/loadfishinggfx.asm new file mode 100644 index 000000000..f67c51d8b --- /dev/null +++ b/engine/events/loadfishinggfx.asm @@ -0,0 +1,46 @@ +LoadFishingGFX: ; b84b3 + ld a, [rVBK] + push af + ld a, $1 + ld [rVBK], a + + ld de, FishingGFX + ld a, [wPlayerGender] + bit 0, a + jr z, .got_gender + ld de, KrisFishingGFX +.got_gender + + ld hl, vTiles0 tile $02 + call .LoadGFX + ld hl, vTiles0 tile $06 + call .LoadGFX + ld hl, vTiles0 tile $0a + call .LoadGFX + ld hl, vTiles1 tile $7c + call .LoadGFX + + pop af + ld [rVBK], a + ret +; b84e3 + +.LoadGFX: ; b84e3 + lb bc, BANK(FishingGFX), 2 + push de + call Get2bpp + pop de + ld hl, 2 tiles + add hl, de + ld d, h + ld e, l + ret +; b84f2 + +FishingGFX: ; b84f2 +INCBIN "gfx/overworld/chris_fish.2bpp" +; b8582 + +KrisFishingGFX: ; b8582 +INCBIN "gfx/overworld/kris_fish.2bpp" +; b8612 diff --git a/engine/load_font.asm b/engine/load_font.asm new file mode 100644 index 000000000..347a85746 --- /dev/null +++ b/engine/load_font.asm @@ -0,0 +1,156 @@ +INCLUDE "gfx/font.asm" + +; This and the following two functions are unreferenced. +; Debug, perhaps? +Unreferenced_fb434: + db 0 + +Unreferenced_Functionfb435: ; 4b435 + ld a, [Unreferenced_fb434] + and a + jp nz, Get1bpp_2 + jp Get1bpp +; fb43f + +Unreferenced_Functionfb43f: ; fb43f + ld a, [Unreferenced_fb434] + and a + jp nz, Get2bpp_2 + jp Get2bpp +; End unreferenced block +; fb449 + +_LoadStandardFont:: ; fb449 + ld de, Font + ld hl, vTiles1 + lb bc, BANK(Font), 128 ; "A" to "9" + ld a, [rLCDC] + bit rLCDC_ENABLE, a + jp z, Copy1bpp + + ld de, Font + ld hl, vTiles1 + lb bc, BANK(Font), 32 ; "A" to "]" + call Get1bpp_2 + ld de, Font + 32 * LEN_1BPP_TILE + ld hl, vTiles1 tile $20 + lb bc, BANK(Font), 32 ; "a" to $bf + call Get1bpp_2 + ld de, Font + 64 * LEN_1BPP_TILE + ld hl, vTiles1 tile $40 + lb bc, BANK(Font), 32 ; "Ä" to "←" + call Get1bpp_2 + ld de, Font + 96 * LEN_1BPP_TILE + ld hl, vTiles1 tile $60 + lb bc, BANK(Font), 32 ; "'" to "9" + call Get1bpp_2 + ret +; fb48a + +_LoadFontsExtra1:: ; fb48a + ld de, FontsExtra_SolidBlackGFX + ld hl, vTiles2 tile "" ; $60 + lb bc, BANK(FontsExtra_SolidBlackGFX), 1 + call Get1bpp_2 + ld de, PokegearPhoneIconGFX + ld hl, vTiles2 tile "" ; $62 + lb bc, BANK(PokegearPhoneIconGFX), 1 + call Get2bpp_2 + ld de, FontExtra tile 3 + ld hl, vTiles2 tile "" + lb bc, BANK(FontExtra), 22 ; "" to "ぉ" + call Get2bpp_2 + jr LoadFrame +; fb4b0 + +_LoadFontsExtra2:: ; fb4b0 + ld de, FontsExtra2_UpArrowGFX + ld hl, vTiles2 tile "▲" ; $61 + ld b, BANK(FontsExtra2_UpArrowGFX) + ld c, 1 + call Get2bpp_2 + ret +; fb4be + +_LoadFontsBattleExtra:: ; fb4be + ld de, FontBattleExtra + ld hl, vTiles2 tile $60 + lb bc, BANK(FontBattleExtra), 25 + call Get2bpp_2 + jr LoadFrame +; fb4cc + +LoadFrame: ; fb4cc + ld a, [TextBoxFrame] + maskbits NUM_FRAMES +- 1 + ld bc, 6 * LEN_1BPP_TILE + ld hl, Frames + call AddNTimes + ld d, h + ld e, l + ld hl, vTiles2 tile "┌" ; $79 + lb bc, BANK(Frames), 6 ; "┌" to "┘" + call Get1bpp_2 + ld hl, vTiles2 tile " " ; $7f + ld de, TextBoxSpaceGFX + lb bc, BANK(TextBoxSpaceGFX), 1 + call Get1bpp_2 + ret +; fb4f2 + +LoadBattleFontsHPBar: ; fb4f2 + ld de, FontBattleExtra + ld hl, vTiles2 tile $60 + lb bc, BANK(FontBattleExtra), 12 + call Get2bpp_2 + ld hl, vTiles2 tile $70 + ld de, FontBattleExtra tile 16 + lb bc, BANK(FontBattleExtra), 3 ; "<ど>" to "『" + call Get2bpp_2 + call LoadFrame + +LoadHPBar: ; fb50d + ld de, EnemyHPBarBorderGFX + ld hl, vTiles2 tile $6c + lb bc, BANK(EnemyHPBarBorderGFX), 4 + call Get1bpp_2 + ld de, HPExpBarBorderGFX + ld hl, vTiles2 tile $73 + lb bc, BANK(HPExpBarBorderGFX), 6 + call Get1bpp_2 + ld de, ExpBarGFX + ld hl, vTiles2 tile $55 + lb bc, BANK(ExpBarGFX), 9 + call Get2bpp_2 + ld de, MobilePhoneTilesGFX tile 7 ; mobile phone icon + ld hl, vTiles2 tile $5e + lb bc, BANK(MobilePhoneTilesGFX), 2 + call Get2bpp_2 + ret +; fb53e + +StatsScreen_LoadFont: ; fb53e + call _LoadFontsBattleExtra + ld de, EnemyHPBarBorderGFX + ld hl, vTiles2 tile $6c + lb bc, BANK(EnemyHPBarBorderGFX), 4 + call Get1bpp_2 + ld de, HPExpBarBorderGFX + ld hl, vTiles2 tile $78 + lb bc, BANK(HPExpBarBorderGFX), 1 + call Get1bpp_2 + ld de, HPExpBarBorderGFX + 3 * LEN_1BPP_TILE + ld hl, vTiles2 tile $76 + lb bc, BANK(HPExpBarBorderGFX), 2 + call Get1bpp_2 + ld de, ExpBarGFX + ld hl, vTiles2 tile $55 + lb bc, BANK(ExpBarGFX), 8 + call Get2bpp_2 +LoadStatsScreenPageTilesGFX: ; fb571 + ld de, StatsScreenPageTilesGFX + ld hl, vTiles2 tile $31 + lb bc, BANK(StatsScreenPageTilesGFX), 17 + call Get2bpp_2 + ret +; fb57e diff --git a/engine/load_pics.asm b/engine/load_pics.asm new file mode 100755 index 000000000..14ec463cc --- /dev/null +++ b/engine/load_pics.asm @@ -0,0 +1,494 @@ +Predef_GetUnownLetter: ; 51040 +; Return Unown letter in UnownLetter based on DVs at hl + +; Take the middle 2 bits of each DV and place them in order: +; atk def spd spc +; .ww..xx. .yy..zz. + + ; atk + ld a, [hl] + and %01100000 + sla a + ld b, a + ; def + ld a, [hli] + and %00000110 + swap a + srl a + or b + ld b, a + + ; spd + ld a, [hl] + and %01100000 + swap a + sla a + or b + ld b, a + ; spc + ld a, [hl] + and %00000110 + srl a + or b + +; Divide by 10 to get 0-25 + ld [hDividend + 3], a + xor a + ld [hDividend], a + ld [hDividend + 1], a + ld [hDividend + 2], a + ld a, 10 + ld [hDivisor], a + ld b, 4 + call Divide + +; Increment to get 1-26 + ld a, [hQuotient + 2] + inc a + ld [UnownLetter], a + ret + +Predef_GetMonFrontpic: ; 51077 + ld a, [CurPartySpecies] + ld [CurSpecies], a + call IsAPokemon + ret c + ld a, [rSVBK] + push af + call _GetFrontpic + pop af + ld [rSVBK], a + ret + +Predef_GetAnimatedFrontpic: ; 5108b + ld a, [CurPartySpecies] + ld [CurSpecies], a + call IsAPokemon + ret c + ld a, [rSVBK] + push af + xor a + ld [hBGMapMode], a + call _GetFrontpic + call GetAnimatedFrontpic + pop af + ld [rSVBK], a + ret + +_GetFrontpic: ; 510a5 + push de + call GetBaseData + ld a, [BasePicSize] + and $f + ld b, a + push bc + call GetFrontpicPointer + ld a, BANK(wDecompressEnemyFrontpic) + ld [rSVBK], a + ld a, b + ld de, wDecompressEnemyFrontpic + call FarDecompress + pop bc + ld hl, wDecompressScratch + ld de, wDecompressEnemyFrontpic + call PadFrontpic + pop hl + push hl + ld de, wDecompressScratch + ld c, 7 * 7 + ld a, [hROMBank] + ld b, a + call Get2bpp + pop hl + ret + +GetFrontpicPointer: ; 510d7 +GLOBAL PokemonPicPointers, UnownPicPointers + + ld a, [CurPartySpecies] + cp UNOWN + jr z, .unown + ld a, [CurPartySpecies] + ld d, BANK(PokemonPicPointers) + jr .ok + +.unown + ld a, [UnownLetter] + ld d, BANK(UnownPicPointers) + +.ok + ld hl, PokemonPicPointers ; UnownPicPointers + dec a + ld bc, 6 + call AddNTimes + ld a, d + call GetFarByte + call FixPicBank + push af + inc hl + ld a, d + call GetFarHalfword + pop bc + ret + +GetAnimatedFrontpic: ; 51103 + ld a, BANK(vTiles3) + ld [rVBK], a + push hl + ld de, wDecompressScratch + ld c, 7 * 7 + ld a, [hROMBank] + ld b, a + call Get2bpp + pop hl + ld de, 7 * 7 tiles + add hl, de + push hl + ld a, BANK(BasePicSize) + ld hl, BasePicSize + call GetFarWRAMByte + pop hl + and $f + ld de, wDecompressEnemyFrontpic + 5 * 5 tiles + ld c, 5 * 5 + cp 5 + jr z, .got_dims + ld de, wDecompressEnemyFrontpic + 6 * 6 tiles + ld c, 6 * 6 + cp 6 + jr z, .got_dims + ld de, wDecompressEnemyFrontpic + 7 * 7 tiles + ld c, 7 * 7 +.got_dims + + push hl + push bc + call LoadFrontpicTiles + pop bc + pop hl + ld de, wDecompressScratch + ld a, [hROMBank] + ld b, a + call Get2bpp + xor a + ld [rVBK], a + ret + +LoadFrontpicTiles: ; 5114f + ld hl, wDecompressScratch + swap c + ld a, c + and $f + ld b, a + ld a, c + and $f0 + ld c, a + push bc + call LoadFrontpic + pop bc +.loop + push bc + ld c, 0 + call LoadFrontpic + pop bc + dec b + jr nz, .loop + ret + +Predef_GetMonBackpic: ; 5116c + ld a, [CurPartySpecies] + call IsAPokemon + ret c + + ld a, [CurPartySpecies] + ld b, a + ld a, [UnownLetter] + ld c, a + ld a, [rSVBK] + push af + ld a, BANK(wDecompressScratch) + ld [rSVBK], a + push de + + ; These are assumed to be at the same + ; address in their respective banks. + GLOBAL PokemonPicPointers, UnownPicPointers + ld hl, PokemonPicPointers ; UnownPicPointers + ld a, b + ld d, BANK(PokemonPicPointers) + cp UNOWN + jr nz, .ok + ld a, c + ld d, BANK(UnownPicPointers) +.ok + dec a + ld bc, 6 + call AddNTimes + ld bc, 3 + add hl, bc + ld a, d + call GetFarByte + call FixPicBank + push af + inc hl + ld a, d + call GetFarHalfword + ld de, wDecompressScratch + pop af + call FarDecompress + ld hl, wDecompressScratch + ld c, 6 * 6 + call FixBackpicAlignment + pop hl + ld de, wDecompressScratch + ld a, [hROMBank] + ld b, a + call Get2bpp + pop af + ld [rSVBK], a + ret + +FixPicBank: ; 511c5 +; This is a thing for some reason. + +PICS_FIX EQU $36 +GLOBAL PICS_FIX + + push hl + push bc + sub BANK(Pics_1) - PICS_FIX + ld c, a + ld b, 0 + ld hl, .PicsBanks + add hl, bc + ld a, [hl] + pop bc + pop hl + ret + +.PicsBanks: ; 511d4 + db BANK(Pics_1) + 0 + db BANK(Pics_1) + 1 + db BANK(Pics_1) + 2 + db BANK(Pics_1) + 3 + db BANK(Pics_1) + 4 + db BANK(Pics_1) + 5 + db BANK(Pics_1) + 6 + db BANK(Pics_1) + 7 + db BANK(Pics_1) + 8 + db BANK(Pics_1) + 9 + db BANK(Pics_1) + 10 + db BANK(Pics_1) + 11 + db BANK(Pics_1) + 12 + db BANK(Pics_1) + 13 + db BANK(Pics_1) + 14 + db BANK(Pics_1) + 15 + db BANK(Pics_1) + 16 + db BANK(Pics_1) + 17 + db BANK(Pics_1) + 18 + db BANK(Pics_1) + 19 + db BANK(Pics_1) + 20 + db BANK(Pics_1) + 21 + db BANK(Pics_1) + 22 + db BANK(Pics_1) + 23 + +Function511ec: ; 511ec + ld a, c + push de + ld hl, PokemonPicPointers + dec a + ld bc, 6 + call AddNTimes + ld a, BANK(PokemonPicPointers) + call GetFarByte + call FixPicBank + push af + inc hl + ld a, BANK(PokemonPicPointers) + call GetFarHalfword + pop af + pop de + call FarDecompress + ret + +Predef_GetTrainerPic: ; 5120d + ld a, [TrainerClass] + and a + ret z + cp NUM_TRAINER_CLASSES + ret nc + call WaitBGMap + xor a + ld [hBGMapMode], a + ld hl, TrainerPicPointers + ld a, [TrainerClass] + dec a + ld bc, 3 + call AddNTimes + ld a, [rSVBK] + push af + ld a, BANK(wDecompressScratch) + ld [rSVBK], a + push de + ld a, BANK(TrainerPicPointers) + call GetFarByte + call FixPicBank + push af + inc hl + ld a, BANK(TrainerPicPointers) + call GetFarHalfword + pop af + ld de, wDecompressScratch + call FarDecompress + pop hl + ld de, wDecompressScratch + ld c, 7 * 7 + ld a, [hROMBank] + ld b, a + call Get2bpp + pop af + ld [rSVBK], a + call WaitBGMap + ld a, $1 + ld [hBGMapMode], a + ret + +Predef_Decompress: ; 5125d +; Decompress lz data from b:hl to scratch space at 6:d000, then copy it to address de. + + ld a, [rSVBK] + push af + ld a, BANK(wDecompressScratch) + ld [rSVBK], a + + push de + push bc + ld a, b + ld de, wDecompressScratch + call FarDecompress + pop bc + ld de, wDecompressScratch + pop hl + ld a, [hROMBank] + ld b, a + call Get2bpp + + pop af + ld [rSVBK], a + ret + +FixBackpicAlignment: ; 5127c + push de + push bc + ld a, [wBoxAlignment] + and a + jr z, .keep_dims + ld a, c + cp 7 * 7 + ld de, 7 * 7 tiles + jr z, .got_dims + cp 6 * 6 + ld de, 6 * 6 tiles + jr z, .got_dims + ld de, 5 * 5 tiles + +.got_dims + ld a, [hl] + ld b, 0 + ld c, 8 +.loop + rra + rl b + dec c + jr nz, .loop + ld a, b + ld [hli], a + dec de + ld a, e + or d + jr nz, .got_dims + +.keep_dims + pop bc + pop de + ret + +PadFrontpic: ; 512ab + ld a, b + cp 6 + jr z, .six + cp 5 + jr z, .five + +.seven_loop + ld c, $70 + call LoadFrontpic + dec b + jr nz, .seven_loop + ret + +.six + ld c, $70 + xor a + call .Fill +.six_loop + ld c, $10 + xor a + call .Fill + ld c, $60 + call LoadFrontpic + dec b + jr nz, .six_loop + ret + +.five + ld c, $70 + xor a + call .Fill +.five_loop + ld c, $20 + xor a + call .Fill + ld c, $50 + call LoadFrontpic + dec b + jr nz, .five_loop + ld c, $70 + xor a + call .Fill + ret + +.Fill: + ld [hli], a + dec c + jr nz, .Fill + ret + +LoadFrontpic: ; 512f2 + ld a, [wBoxAlignment] + and a + jr nz, .x_flip +.left_loop + ld a, [de] + inc de + ld [hli], a + dec c + jr nz, .left_loop + ret + +.x_flip + push bc +.right_loop + ld a, [de] + inc de + ld b, a + xor a +rept 8 + rr b + rla +endr + ld [hli], a + dec c + jr nz, .right_loop + pop bc + ret diff --git a/engine/routines/loadoverworldfont.asm b/engine/routines/loadoverworldfont.asm new file mode 100644 index 000000000..f23f01c4e --- /dev/null +++ b/engine/routines/loadoverworldfont.asm @@ -0,0 +1,17 @@ +LoadOverworldFont:: ; 106594 + ld de, .OverworldFontGFX + ld hl, vTiles1 + lb bc, BANK(.OverworldFontGFX), $80 + call Get2bpp + ld de, .OverworldFontSpaceGFX + ld hl, vTiles2 tile " " + lb bc, BANK(.OverworldFontSpaceGFX), 1 + call Get2bpp + ret +; 1065ad + +.OverworldFontGFX: +INCBIN "gfx/font/overworld.2bpp" + +.OverworldFontSpaceGFX: +INCBIN "gfx/font/overworld_space.2bpp" -- cgit v1.2.3 From 6c7e88513a9b759584de2b50c5b67ecf94203607 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Mon, 15 Jan 2018 14:11:11 -0500 Subject: Long lists of db/dw series with struct-defining macros belong in data/ --- engine/predef.asm | 81 +----------------------- engine/specials.asm | 178 +--------------------------------------------------- 2 files changed, 2 insertions(+), 257 deletions(-) (limited to 'engine') diff --git a/engine/predef.asm b/engine/predef.asm index da18611e8..6c8c2c5f2 100644 --- a/engine/predef.asm +++ b/engine/predef.asm @@ -26,83 +26,4 @@ GetPredefPointer:: ; 854b ret ; 856b -PredefPointers:: ; 856b -; $4b Predef pointers -; address, bank - - add_predef Predef_LearnMove ; $0 - add_predef DummyPredef1 - add_predef HealParty ; this is both a special and a predef - add_predef Predef_SmallFarFlagAction - add_predef Predef_ComputeHPBarPixels - add_predef Predef_FillPP - add_predef Predef_TryAddMonToParty - add_predef Predef_AddTempmonToParty - add_predef Predef_SendGetPkmnIntoFromBox - add_predef Predef_SendPkmnIntoBox - add_predef Predef_GiveEgg - add_predef Predef_AnimateHPBar - add_predef Predef_CalcPkmnStats - add_predef Predef_CalcPkmnStatC - add_predef Predef_CanLearnTMHMMove - add_predef Predef_GetTMHMMove - add_predef Predef_LinkTextbox ; $ 10 - add_predef Predef_PrintMoveDesc - add_predef Predef_UpdatePlayerHUD - add_predef Predef_PlaceGraphic - add_predef Predef_CheckPlayerPartyForFitPkmn - add_predef Predef_UpdateEnemyHUD - add_predef Predef_StartBattle - add_predef Predef_FillInExpBar - add_predef Predef_GetBattleMonBackpic ; $18 - add_predef Predef_GetEnemyMonFrontpic - add_predef Predef_LearnLevelMoves - add_predef Predef_FillMoves - add_predef Predef_EvolveAfterBattle - add_predef Predef_TradeAnimationPlayer2 - add_predef Predef_TradeAnimation - add_predef Predef_CopyPkmnToTempMon - add_predef Predef_ListMoves ; $20 - add_predef Predef_PlaceNonFaintStatus - add_predef UnusedPredef22 - add_predef Predef_ListMovePP - add_predef Predef_GetGender - add_predef Predef_StatsScreenInit - add_predef Predef_DrawPlayerHP - add_predef Predef_DrawEnemyHP - add_predef Predef_PrintTempMonStats ; $28 - add_predef Predef_GetTypeName - add_predef Predef_PrintMoveType - add_predef Predef_PrintType - add_predef Predef_PrintMonTypes - add_predef Predef_GetUnownLetter - add_predef Predef_LoadPoisonBGPals - add_predef DummyPredef2F - add_predef Predef_InitSGBBorder ; $30 - add_predef Predef_LoadSGBLayout - add_predef Predef_Pokedex_GetArea - add_predef UnusedPredef_CheckContestMon - add_predef Predef_DoBattleTransition - add_predef DummyPredef35 - add_predef DummyPredef36 - add_predef Predef_PlayBattleAnim - add_predef DummyPredef38 ; $38 - add_predef DummyPredef39 - add_predef DummyPredef3A - add_predef Predef_PartyMonItemName - add_predef Predef_GetMonFrontpic - add_predef Predef_GetMonBackpic - add_predef Predef_GetAnimatedFrontpic - add_predef Predef_GetTrainerPic - add_predef Predef_Decompress ; $40 - add_predef Predef_CheckTypeMatchup - add_predef Predef_ConvertMon_1to2 - add_predef Predef_NewPokedexEntry - add_predef UnusedPredef_AnimateMon_Slow_Normal - add_predef Predef_PlaceStatusString - add_predef Predef_LoadMonAnimation - add_predef Predef_AnimateFrontpic - add_predef UnusedPredef48 ; $48 - add_predef Predef_HOF_AnimateFrontpic - dbw $ff, InexplicablyEmptyFunction ; ??? -; 864c +INCLUDE "data/predef_pointers.asm" diff --git a/engine/specials.asm b/engine/specials.asm index 5ce412093..03d3be19a 100644 --- a/engine/specials.asm +++ b/engine/specials.asm @@ -14,183 +14,7 @@ Special:: ; c01b ret ; c029 -SpecialsPointers:: ; c029 - add_special Special_WarpToSpawnPoint - -; Communications - add_special Special_SetBitsForLinkTradeRequest - add_special Special_WaitForLinkedFriend - add_special Special_CheckLinkTimeout - add_special Special_TryQuickSave - add_special Special_CheckBothSelectedSameRoom - add_special Special_FailedLinkToPast - add_special Special_CloseLink - add_special Special_WaitForOtherPlayerToExit - add_special Special_SetBitsForBattleRequest - add_special Special_SetBitsForTimeCapsuleRequest - add_special Special_CheckTimeCapsuleCompatibility - add_special Special_EnterTimeCapsule - add_special Special_TradeCenter - add_special Special_Colosseum - add_special Special_TimeCapsule - add_special Special_CableClubCheckWhichChris - add_special Special_CheckMysteryGift - add_special Special_GetMysteryGiftItem - add_special Special_UnlockMysteryGift - -; Map Events - add_special Special_BugContestJudging - add_special Special_CheckPartyFullAfterContest - add_special Special_ContestDropOffMons - add_special Special_ContestReturnMons - add_special Special_GiveParkBalls - add_special Special_CheckMagikarpLength - add_special Special_MagikarpHouseSign - add_special HealParty ; this is both a special and a predef - add_special Special_PokemonCenterPC - add_special Special_KrissHousePC - add_special Special_DayCareMan - add_special Special_DayCareLady - add_special Special_DayCareManOutside - add_special Special_MoveDeletion - add_special Special_BankOfMom - add_special Special_MagnetTrain - add_special Special_NameRival - add_special Special_SetDayOfWeek - add_special Special_TownMap - add_special Special_UnownPrinter - add_special Special_MapRadio - add_special Special_UnownPuzzle - add_special Special_SlotMachine - add_special Special_CardFlip - add_special Special_DummyNonfunctionalGameCornerGame - add_special Special_ClearBGPalettesBufferScreen - add_special Special_FadeOutPalettes - add_special Special_BattleTowerFade - add_special Special_FadeBlackQuickly - add_special Special_FadeInPalettes - add_special Special_FadeInQuickly - add_special ReloadSpritesNoPalettes ; bank 0 - add_special ClearBGPalettes ; bank 0 - add_special UpdateTimePals ; bank 0 - add_special ClearTileMap ; bank 0 - add_special UpdateSprites ; bank 0 - add_special ReplaceKrisSprite ; bank 0 - add_special Special_GameCornerPrizeMonCheckDex - add_special UnusedSpecial_SeenMon - add_special WaitSFX ; bank 0 - add_special PlayMapMusic ; bank 0 - add_special RestartMapMusic ; bank 0 - add_special Special_HealMachineAnim - add_special Special_SurfStartStep - add_special Special_FindGreaterThanThatLevel - add_special Special_FindAtLeastThatHappy - add_special Special_FindThatSpecies - add_special Special_FindThatSpeciesYourTrainerID - add_special UnusedSpecial_CheckUnusedTwoDayTimer - add_special Special_DayCareMon1 - add_special Special_DayCareMon2 - add_special Special_SelectRandomBugContestContestants - add_special Special_ActivateFishingSwarm - add_special Special_ToggleMaptileDecorations - add_special Special_ToggleDecorationsVisibility - add_special Special_GiveShuckle - add_special Special_ReturnShuckle - add_special Special_BillsGrandfather - add_special Special_CheckPokerus - add_special Special_DisplayCoinCaseBalance - add_special Special_DisplayMoneyAndCoinBalance - add_special Special_PlaceMoneyTopRight - add_special Special_CheckForLuckyNumberWinners - add_special Special_CheckLuckyNumberShowFlag - add_special Special_ResetLuckyNumberShowFlag - add_special Special_PrintTodaysLuckyNumber - add_special Special_SelectApricornForKurt - add_special Special_NameRater - add_special Special_DisplayLinkRecord - add_special Special_GetFirstPokemonHappiness - add_special Special_CheckFirstMonIsEgg - add_special Special_RandomUnseenWildMon - add_special Special_RandomPhoneWildMon - add_special Special_RandomPhoneMon - add_special Special_LoadUsedSpritesGFX - add_special Special_PlaySlowCry - add_special Special_SnorlaxAwake - add_special Special_YoungerHaircutBrother - add_special Special_OlderHaircutBrother - add_special Special_DaisyMassage - add_special Special_PlayCurMonCry - add_special Special_ProfOaksPCBoot - add_special Special_GameboyCheck - add_special Special_TrainerHouse - add_special Special_PhotoStudio - add_special Special_InitRoamMons - add_special Special_FadeOutMusic - add_special Special_Diploma - add_special Special_PrintDiploma - - ; Crystal - add_special Special_Function11ac3e - add_special Special_Function11b444 - add_special Special_Function11b5e8 - add_special Special_Function11b7e5 - add_special Special_Function11b879 - add_special Special_Function11b920 - add_special Special_Function11b93b - add_special Special_BattleTowerRoomMenu - add_special Special_Function1700ba - add_special Special_Function170114 - add_special Special_BattleTowerBattle - add_special UnusedSpecial_Function1704e1 - add_special DummySpecial_17021d - add_special Special_LoadOpponentTrainerAndPokemonWithOTSprite - add_special Special_Function11ba38 - add_special Special_CheckForBattleTowerRules - add_special Special_GiveOddEgg - add_special Reset ; bank 0 - add_special Special_Function1011f1 - add_special Special_Function101220 - add_special Special_Function101225 - add_special Special_Function101231 - add_special Special_MoveTutor - add_special Special_OmanyteChamber - add_special Special_Function11c1ab - add_special Special_BattleTowerAction - add_special Special_DisplayUnownWords - add_special Special_Menu_ChallengeExplanationCancel - add_special Special_Function17d2b6 - add_special Special_Function17d2ce - add_special Special_BattleTowerMobileError - add_special Special_AskMobileOrCable - add_special Special_HoOhChamber - add_special Special_Function102142 - add_special Special_CelebiShrineEvent - add_special Special_CheckCaughtCelebi - add_special Special_PokeSeer - add_special Special_BuenasPassword - add_special Special_BuenaPrize - add_special Special_Dratini - add_special Special_SampleKenjiBreakCountdown - add_special Special_BeastsCheck - add_special Special_MonCheck - add_special Special_SetPlayerPalette - add_special DummySpecial_170bd2 - add_special Special_Mobile_SelectThreeMons - add_special Special_Function1037eb - add_special Special_Function10383c - add_special Special_StubbedTrainerRankings_Healings - add_special Special_RefreshSprites - add_special Special_Function1037c2 - add_special Special_Mobile_DummyReturnFalse - add_special Special_Function103780 - add_special Special_Function10387b - add_special Special_AskRememberPassword - add_special Special_LoadMapPalettes - add_special UnusedSpecial_FindItemInPCOrBag - add_special Special_InitialSetDSTFlag - add_special Special_InitialClearDSTFlag - add_special DummySpecial_c224 -; c224 +INCLUDE "data/special_pointers.asm" DummySpecial_c224: ; c224 ret -- cgit v1.2.3 From 2b823389208c7c3691109ad751ccc39aa2408387 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Mon, 15 Jan 2018 22:00:56 -0500 Subject: Phone data 0/7 are time masks --- engine/phone/phone.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/phone/phone.asm b/engine/phone/phone.asm index be18c569e..a4dd42faf 100644 --- a/engine/phone/phone.asm +++ b/engine/phone/phone.asm @@ -163,7 +163,7 @@ CheckPhoneContactTimeOfDay: ; 900ad (24:40ad) farcall CheckTime pop af - and MORN | DAY | NITE + and ANYTIME and c pop de -- cgit v1.2.3 From 80480821142d7a7b16dd2b1a98a213e7b389af0f Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 16 Jan 2018 14:30:10 -0500 Subject: Remove Predef_ prefix from routines listed in PredefPointers --- engine/battle/ai/items.asm | 4 +- engine/battle/ai/move.asm | 2 +- engine/battle/ai/scoring.asm | 2 +- engine/battle/ai/switch.asm | 16 +-- engine/battle/anim_hp_bar.asm | 10 +- engine/battle/battle_transition.asm | 2 +- engine/battle/core.asm | 148 ++++++++++++------------- engine/battle/effect_commands.asm | 40 +++---- engine/battle/effect_commands/attract.asm | 4 +- engine/battle/misc.asm | 2 +- engine/battle/read_trainer_party.asm | 8 +- engine/battle/returntobattle_useball.asm | 4 +- engine/battle/start_battle.asm | 2 +- engine/battle_anims/anim_commands.asm | 20 ++-- engine/billspc.asm | 14 +-- engine/breeding.asm | 26 ++--- engine/color.asm | 4 +- engine/debug.asm | 12 +- engine/events/battle_tower/battle_tower.asm | 4 +- engine/events/catch_tutorial.asm | 2 +- engine/events/daycare.asm | 10 +- engine/events/halloffame.asm | 18 +-- engine/events/move_tutor.asm | 4 +- engine/events/poisonstep.asm | 4 +- engine/events/poisonstep_pals.asm | 2 +- engine/events/pokecenter_pc.asm | 4 +- engine/events/pokepic.asm | 4 +- engine/events/print_unown.asm | 6 +- engine/events/special.asm | 2 +- engine/evolution_animation.asm | 4 +- engine/evolve.asm | 18 +-- engine/health.asm | 4 +- engine/intro_menu.asm | 10 +- engine/item_effects.asm | 30 ++--- engine/learn.asm | 4 +- engine/link.asm | 44 ++++---- engine/link_2.asm | 8 +- engine/link_trade.asm | 20 ++-- engine/load_pics.asm | 34 +++--- engine/mart.asm | 4 +- engine/mon_stats.asm | 26 ++--- engine/move_mon.asm | 58 +++++----- engine/mystery_gift.asm | 6 +- engine/namingscreen.asm | 2 +- engine/npctrade.asm | 10 +- engine/party_menu.asm | 8 +- engine/pic_animation.asm | 30 ++--- engine/player_gfx.asm | 6 +- engine/pokedex.asm | 8 +- engine/pokegear.asm | 4 +- engine/print_party.asm | 8 +- engine/printer.asm | 2 +- engine/routines/correcterrorsinplayerparty.asm | 2 +- engine/routines/flagpredef.asm | 2 +- engine/routines/newpokedexentry.asm | 2 +- engine/routines/placegraphic.asm | 3 +- engine/routines/placewaitingtext.asm | 2 +- engine/routines/printitemdescription.asm | 2 +- engine/routines/trademonfrontpic.asm | 6 +- engine/scripting.asm | 4 +- engine/sgb_layouts.asm | 2 +- engine/specials.asm | 2 +- engine/start_menu.asm | 22 ++-- engine/stats_screen.asm | 36 +++--- engine/tempmon.asm | 4 +- engine/time_capsule_2.asm | 2 +- engine/tmhm.asm | 6 +- engine/tmhm2.asm | 16 +-- engine/trade_animation.asm | 10 +- engine/trainer_card.asm | 2 +- engine/types.asm | 10 +- 71 files changed, 433 insertions(+), 430 deletions(-) (limited to 'engine') diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm index 5bdc070ec..d0867fb33 100644 --- a/engine/battle/ai/items.asm +++ b/engine/battle/ai/items.asm @@ -545,7 +545,7 @@ AI_Items: ; 39196 AIUpdateHUD: ; 38387 call UpdateEnemyMonInParty - farcall Predef_UpdateEnemyHUD + farcall UpdateEnemyHUD ld a, $1 ld [hBGMapMode], a ld hl, wEnemyItemState @@ -664,7 +664,7 @@ EnemyPotionFinish: ; 38436 xor a ld [wWhichHPBar], a call AIUsedItemSound - predef Predef_AnimateHPBar + predef AnimateHPBar jp AIUpdateHUD diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm index d04fb9930..27a8ad5a5 100755 --- a/engine/battle/ai/move.asm +++ b/engine/battle/ai/move.asm @@ -92,7 +92,7 @@ AIChooseMove: ; 440ce push bc ld d, BANK(TrainerClassAttributes) - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction ld d, c pop bc diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm index c1d175c38..73284435a 100644 --- a/engine/battle/ai/scoring.asm +++ b/engine/battle/ai/scoring.asm @@ -1488,7 +1488,7 @@ AI_Smart_Encore: ; 38c3b push hl ld a, [wEnemyMoveStruct + MOVE_TYPE] ld hl, EnemyMonType1 - predef Predef_CheckTypeMatchup + predef CheckTypeMatchup pop hl ld a, [wd265] diff --git a/engine/battle/ai/switch.asm b/engine/battle/ai/switch.asm index cb278676e..c2f83fa1f 100755 --- a/engine/battle/ai/switch.asm +++ b/engine/battle/ai/switch.asm @@ -28,7 +28,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e inc hl call GetMoveByte ld hl, EnemyMonType - call Predef_CheckTypeMatchup + call CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 ; 1.0 + 0.1 jr nc, .super_effective @@ -73,7 +73,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e ld a, [BattleMonType1] ld b, a ld hl, EnemyMonType1 - call Predef_CheckTypeMatchup + call CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 ; 1.0 + 0.1 jr c, .ok @@ -82,7 +82,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e ld a, [BattleMonType2] cp b jr z, .ok2 - call Predef_CheckTypeMatchup + call CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 ; 1.0 + 0.1 jr c, .ok2 @@ -123,7 +123,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e inc hl call GetMoveByte ld hl, BattleMonType1 - call Predef_CheckTypeMatchup + call CheckTypeMatchup ld a, [wTypeMatchup] ; immune @@ -390,7 +390,7 @@ FindEnemyMonsImmuneToLastCounterMove: ; 34a2a inc hl call GetMoveByte ld hl, BaseType - call Predef_CheckTypeMatchup + call CheckTypeMatchup ld a, [wTypeMatchup] and a jr nz, .next @@ -481,7 +481,7 @@ FindEnemyMonsWithASuperEffectiveMove: ; 34aa7 inc hl call GetMoveByte ld hl, BattleMonType1 - call Predef_CheckTypeMatchup + call CheckTypeMatchup ; if immune or not very effective: continue ld a, [wTypeMatchup] @@ -585,7 +585,7 @@ FindEnemyMonsThatResistPlayer: ; 34b20 .skip_move ld a, [BattleMonType1] ld hl, BaseType - call Predef_CheckTypeMatchup + call CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 jr nc, .dont_choose_mon @@ -593,7 +593,7 @@ FindEnemyMonsThatResistPlayer: ; 34b20 .check_type ld hl, BaseType - call Predef_CheckTypeMatchup + call CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 jr nc, .dont_choose_mon diff --git a/engine/battle/anim_hp_bar.asm b/engine/battle/anim_hp_bar.asm index d67a46a70..71276d27e 100755 --- a/engine/battle/anim_hp_bar.asm +++ b/engine/battle/anim_hp_bar.asm @@ -67,7 +67,7 @@ _AnimateHPBar: ; d627 ld a, [hli] ld b, a pop hl - call Predef_ComputeHPBarPixels + call ComputeHPBarPixels ld a, e ld [wCurHPBarPixels], a @@ -79,7 +79,7 @@ _AnimateHPBar: ; d627 ld e, a ld a, [wCurHPAnimMaxHP + 1] ld d, a - call Predef_ComputeHPBarPixels + call ComputeHPBarPixels ld a, e ld [wNewHPBarPixels], a @@ -183,11 +183,11 @@ LongAnim_UpdateVariables: ; d6f5 ld c, a ld a, [hli] ld b, a - ; This routine is buggy. The result from Predef_ComputeHPBarPixels is stored + ; This routine is buggy. The result from ComputeHPBarPixels is stored ; in e. However, the pop de opcode deletes this result before it is even ; used. The game then proceeds as though it never deleted that output. ; To fix, uncomment the line below. - call Predef_ComputeHPBarPixels + call ComputeHPBarPixels ; ld a, e pop bc pop de @@ -227,7 +227,7 @@ LongHPBarAnim_UpdateTiles: ; d749 ld e, a ld a, [wCurHPAnimMaxHP + 1] ld d, a - call Predef_ComputeHPBarPixels + call ComputeHPBarPixels ld c, e ld d, HP_BAR_LENGTH ld a, [wWhichHPBar] diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index f035867b5..1409ddc37 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -1,4 +1,4 @@ -Predef_DoBattleTransition: ; 8c20f +DoBattleTransition: ; 8c20f call .InitGFX ld a, [rBGP] ld [wBGP], a diff --git a/engine/battle/core.asm b/engine/battle/core.asm index cf9c821b7..5d79f5fd5 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -47,7 +47,7 @@ DoBattle: ; 3c000 .player_2 call LoadTileMapToTempTileMap - call Predef_CheckPlayerPartyForFitPkmn + call CheckPlayerPartyForFitPkmn ld a, d and a jp z, LostBattle @@ -1278,7 +1278,7 @@ HandleWrap: ; 3c874 xor a ld [wNumHits], a ld [FXAnimID + 1], a - predef Predef_PlayBattleAnim + predef PlayBattleAnim call SwitchTurnCore .skip_anim @@ -2040,7 +2040,7 @@ UpdateHPBar: ; 3cd3c .ok push bc ld [wWhichHPBar], a - predef Predef_AnimateHPBar + predef AnimateHPBar pop bc ret ; 3cd55 @@ -2054,7 +2054,7 @@ HandleEnemyMonFaint: ; 3cd55 xor a ld [wWhichMonFaintedFirst], a call UpdateBattleStateAndExperienceAfterEnemyFaint - call Predef_CheckPlayerPartyForFitPkmn + call CheckPlayerPartyForFitPkmn ld a, d and a jp z, LostBattle @@ -2062,7 +2062,7 @@ HandleEnemyMonFaint: ; 3cd55 ld hl, BattleMonHP ld a, [hli] or [hl] - call nz, Predef_UpdatePlayerHUD + call nz, UpdatePlayerHUD ld a, $1 ld [hBGMapMode], a @@ -2186,7 +2186,7 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01 call PlayerMonFaintHappinessMod .player_mon_did_not_faint - call Predef_CheckPlayerPartyForFitPkmn + call CheckPlayerPartyForFitPkmn ld a, d and a ret z @@ -2670,7 +2670,7 @@ HandlePlayerMonFaint: ; 3d14e ld a, $1 ld [wWhichMonFaintedFirst], a call PlayerMonFaintHappinessMod - call Predef_CheckPlayerPartyForFitPkmn + call CheckPlayerPartyForFitPkmn ld a, d and a jp z, LostBattle @@ -2716,7 +2716,7 @@ PlayerMonFaintHappinessMod: ; 3d1aa ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction ld hl, EnemySubStatus3 res SUBSTATUS_IN_LOOP, [hl] xor a @@ -3313,10 +3313,10 @@ AddBattleParticipant: ; 3d581 ld hl, wBattleParticipantsNotFainted ld b, SET_FLAG push bc - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction pop bc ld hl, wBattleParticipantsIncludingFainted - predef_jump Predef_SmallFarFlagAction + predef_jump SmallFarFlagAction ; 3d599 FindPkmnInOTPartyToSwitchIntoBattle: ; 3d599 @@ -3534,7 +3534,7 @@ LoadEnemyPkmnToSwitchTo: ; 3d6ca and a jr nz, .skip_unown ld hl, EnemyMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter ld a, [UnownLetter] ld [wFirstUnownSeen], a .skip_unown @@ -3644,8 +3644,8 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 call GetBaseData ld a, OTPARTYMON ld [MonType], a - predef Predef_CopyPkmnToTempMon - call Predef_GetEnemyMonFrontpic + predef CopyPkmnToTempMon + call GetEnemyMonFrontpic xor a ld [wNumHits], a @@ -3670,7 +3670,7 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 hlcoord 12, 0 ld d, $0 ld e, ANIM_MON_SLOW - predef Predef_AnimateFrontpic + predef AnimateFrontpic jr .skip_cry .cry_no_anim @@ -3680,7 +3680,7 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 call PlayStereoCry .skip_cry - call Predef_UpdateEnemyHUD + call UpdateEnemyHUD ld a, $1 ld [hBGMapMode], a ret @@ -3721,7 +3721,7 @@ ResetEnemyStatLevels: ; 3d867 ret ; 3d873 -Predef_CheckPlayerPartyForFitPkmn: ; 3d873 +CheckPlayerPartyForFitPkmn: ; 3d873 ; Has the player any Pkmn in his Party that can fight? ld a, [PartyCount] ld e, a @@ -4124,7 +4124,7 @@ SwitchPlayerMon: ; 3db32 SendOutPlayerMon: ; 3db5f ld hl, BattleMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter hlcoord 1, 5 ld b, 7 ld c, 8 @@ -4132,7 +4132,7 @@ SendOutPlayerMon: ; 3db5f call WaitBGMap xor a ld [hBGMapMode], a - call Predef_GetBattleMonBackpic + call GetBattleMonBackpic xor a ld [hGraphicStartTile], a ld [wBattleMenuCursorBuffer], a @@ -4172,7 +4172,7 @@ SendOutPlayerMon: ; 3db5f call PlayStereoCry .statused - call Predef_UpdatePlayerHUD + call UpdatePlayerHUD ld a, $1 ld [hBGMapMode], a ret @@ -4218,13 +4218,13 @@ BreakAttraction: ; 3dc18 SpikesDamage: ; 3dc23 ld hl, PlayerScreens ld de, BattleMonType - ld bc, Predef_UpdatePlayerHUD + ld bc, UpdatePlayerHUD ld a, [hBattleTurn] and a jr z, .ok ld hl, EnemyScreens ld de, EnemyMonType - ld bc, Predef_UpdateEnemyHUD + ld bc, UpdateEnemyHUD .ok bit SCREENS_SPIKES, [hl] @@ -4306,7 +4306,7 @@ PursuitSwitch: ; 3dc5b ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction call PlayerMonFaintedAnimation ld hl, BattleText_PkmnFainted jr .done_fainted @@ -4455,7 +4455,7 @@ HandleHPHealingItem: ; 3dd2f .got_hp_bar_coords ld [wWhichHPBar], a - predef Predef_AnimateHPBar + predef AnimateHPBar UseOpponentItem: call RefreshBattleHuds callfar GetOpponentItem @@ -4478,7 +4478,7 @@ ItemRecoveryAnim: ; 3ddc8 xor a ld [wNumHits], a ld [FXAnimID + 1], a - predef Predef_PlayBattleAnim + predef PlayBattleAnim call SwitchTurnCore pop bc pop de @@ -4708,7 +4708,7 @@ UpdateBattleHUDs: ; 3df2c ret ; 3df48 -Predef_UpdatePlayerHUD:: ; 3df48 +UpdatePlayerHUD:: ; 3df48 push hl push de push bc @@ -4741,7 +4741,7 @@ DrawPlayerHUD: ; 3df58 ld b, 1 xor a ; PARTYMON ld [MonType], a - predef Predef_DrawPlayerHP + predef DrawPlayerHP ; Exp bar push de @@ -4754,7 +4754,7 @@ DrawPlayerHUD: ; 3df58 hlcoord 10, 11 ld a, [TempMonLevel] ld b, a - call Predef_FillInExpBar + call FillInExpBar pop de ret ; 3df98 @@ -4823,7 +4823,7 @@ PrintPlayerHUD: ; 3dfbf ld a, TEMPMON ld [MonType], a - callfar Predef_GetGender + callfar GetGender ld a, " " jr c, .got_gender_char ld a, "♂" @@ -4837,7 +4837,7 @@ PrintPlayerHUD: ; 3dfbf push af ; back up gender push hl ld de, BattleMonStatus - predef Predef_PlaceNonFaintStatus + predef PlaceNonFaintStatus pop hl pop bc ret nz @@ -4852,7 +4852,7 @@ PrintPlayerHUD: ; 3dfbf jp PrintLevel ; 3e036 -Predef_UpdateEnemyHUD:: ; 3e036 +UpdateEnemyHUD:: ; 3e036 push hl push de push bc @@ -4901,7 +4901,7 @@ DrawEnemyHUD: ; 3e043 ld a, TEMPMON ld [MonType], a - callfar Predef_GetGender + callfar GetGender ld a, " " jr c, .got_gender ld a, "♂" @@ -4916,7 +4916,7 @@ DrawEnemyHUD: ; 3e043 push af push hl ld de, EnemyMonStatus - predef Predef_PlaceNonFaintStatus + predef PlaceNonFaintStatus pop hl pop bc jr nz, .skip_level @@ -5141,8 +5141,8 @@ BattleMenu_Pack: ; 3e1c7 call ClearPalettes call DelayFrame call _LoadBattleFontsHPBar - call Predef_GetBattleMonBackpic - call Predef_GetEnemyMonFrontpic + call GetBattleMonBackpic + call GetEnemyMonFrontpic call ExitMenu call WaitBGMap call FinishBattleAnim @@ -5174,10 +5174,10 @@ BattleMenu_Pack: ; 3e1c7 ld a, [BattleType] cp BATTLETYPE_TUTORIAL jr z, .tutorial2 - call Predef_GetBattleMonBackpic + call GetBattleMonBackpic .tutorial2 - call Predef_GetEnemyMonFrontpic + call GetEnemyMonFrontpic ld a, $1 ld [wMenuCursorY], a call ExitMenu @@ -5531,7 +5531,7 @@ MoveSelectionScreen: ; 3e4bc .got_start_coord ld a, SCREEN_WIDTH ld [Buffer1], a - predef Predef_ListMoves + predef ListMoves ld b, 5 ld a, [wMoveSelectionMenuType] @@ -5864,7 +5864,7 @@ MoveInfoBox: ; 3e6c8 ld a, [wPlayerMoveStruct + MOVE_ANIM] ld b, a hlcoord 2, 10 - predef Predef_PrintMoveType + predef PrintMoveType .done ret @@ -6319,7 +6319,7 @@ LoadEnemyMon: ; 3e8eb ; Get letter based on DVs ld hl, EnemyMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter ; Can't use any letters that haven't been unlocked ; If combined with forced shiny battletype, causes an infinite loop call CheckUnownLetter @@ -6408,7 +6408,7 @@ LoadEnemyMon: ; 3e8eb ld de, EnemyMonMaxHP ld b, FALSE ld hl, EnemyMonDVs - (MON_DVS - MON_STAT_EXP + 1) ; LinkBattleRNs + 7 ; ? - predef Predef_CalcPkmnStats + predef CalcPkmnStats ; If we're in a trainer battle, ; get the rest of the parameters from the party struct @@ -6523,7 +6523,7 @@ LoadEnemyMon: ; 3e8eb ; Make sure the predef knows this isn't a partymon ld [wEvolutionOldSpecies], a ; Fill moves based on level - predef Predef_FillMoves + predef FillMoves .PP: ; Trainer battle? @@ -6534,7 +6534,7 @@ LoadEnemyMon: ; 3e8eb ; Fill wild PP ld hl, EnemyMonMoves ld de, EnemyMonPP - predef Predef_FillPP + predef FillPP jr .Finish .TrainerPP: @@ -6587,7 +6587,7 @@ LoadEnemyMon: ; 3e8eb ld c, a ld b, SET_FLAG ld hl, PokedexSeen - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction ld hl, EnemyMonStats ld de, EnemyStats @@ -6715,7 +6715,7 @@ BattleWinSlideInEnemyTrainerFrontpic: ; 3ebd8 ld a, [OtherTrainerClass] ld [TrainerClass], a ld de, vTiles2 - callfar Predef_GetTrainerPic + callfar GetTrainerPic hlcoord 19, 0 ld c, 0 @@ -7192,7 +7192,7 @@ Call_PlayBattleAnim: ; 3ee17 ld a, d ld [FXAnimID + 1], a call WaitBGMap - predef_jump Predef_PlayBattleAnim + predef_jump PlayBattleAnim ; 3ee27 FinishBattleAnim: ; 3ee27 @@ -7240,7 +7240,7 @@ GiveExperiencePoints: ; 3ee3b ld c, a ld b, CHECK_FLAG ld d, $0 - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction ld a, c and a pop bc @@ -7418,7 +7418,7 @@ GiveExperiencePoints: ; 3ee3b .not_max_exp xor a ; PARTYMON ld [MonType], a - predef Predef_CopyPkmnToTempMon + predef CopyPkmnToTempMon callfar CalcLevel pop bc ld hl, MON_LEVEL @@ -7455,7 +7455,7 @@ GiveExperiencePoints: ; 3ee3b add hl, bc push bc ld b, TRUE - predef Predef_CalcPkmnStats + predef CalcPkmnStats pop bc pop de ld hl, MON_MAXHP + 1 @@ -7508,7 +7508,7 @@ GiveExperiencePoints: ; 3ee3b call ApplyStatLevelMultiplierOnAllStats callfar ApplyStatusEffectOnPlayerStats callfar BadgeStatBoosts - callfar Predef_UpdatePlayerHUD + callfar UpdatePlayerHUD call EmptyBattleTextBox call LoadTileMapToTempTileMap ld a, $1 @@ -7531,14 +7531,14 @@ GiveExperiencePoints: ; 3ee3b .skip_animation2 xor a ; PARTYMON ld [MonType], a - predef Predef_CopyPkmnToTempMon + predef CopyPkmnToTempMon hlcoord 9, 0 ld b, $a ld c, $9 call TextBox hlcoord 11, 1 ld bc, 4 - predef Predef_PrintTempMonStats + predef PrintTempMonStats ld c, $1e call DelayFrames call WaitPressAorB_BlinkCursor @@ -7558,7 +7558,7 @@ GiveExperiencePoints: ; 3ee3b ld a, b ld [CurPartyLevel], a push bc - predef Predef_LearnLevelMoves + predef LearnLevelMoves pop bc ld a, b cp c @@ -7569,7 +7569,7 @@ GiveExperiencePoints: ; 3ee3b ld a, [CurPartyMon] ld c, a ld b, SET_FLAG - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction pop af ld [CurPartyLevel], a @@ -7691,7 +7691,7 @@ AnimateExpBar: ; 3f136 ld [wd002], a xor a ; PARTYMON ld [MonType], a - predef Predef_CopyPkmnToTempMon + predef CopyPkmnToTempMon ld a, [TempMonLevel] ld b, a ld e, a @@ -8062,7 +8062,7 @@ Unreferenced_HandleSafariAngerEatingStatus: jp StdBattleTextBox ; 3f390 -Predef_FillInExpBar: ; 3f390 +FillInExpBar: ; 3f390 push hl call CalcExpBar pop hl @@ -8204,7 +8204,7 @@ PlaceExpBar: ; 3f41c ret ; 3f43d -Predef_GetBattleMonBackpic: ; 3f43d +GetBattleMonBackpic: ; 3f43d ld a, [PlayerSubStatus4] bit SUBSTATUS_SUBSTITUTE, a ld hl, BattleAnimCmd_RaiseSub @@ -8220,9 +8220,9 @@ DropPlayerSub: ; 3f447 ld a, [BattleMonSpecies] ld [CurPartySpecies], a ld hl, BattleMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter ld de, vTiles2 tile $31 - predef Predef_GetMonBackpic + predef GetMonBackpic pop af ld [CurPartySpecies], a ret @@ -8240,7 +8240,7 @@ GetBattleMonBackpic_DoAnim: ; 3f46f ret ; 3f47c -Predef_GetEnemyMonFrontpic: ; 3f47c +GetEnemyMonFrontpic: ; 3f47c ld a, [EnemySubStatus4] bit SUBSTATUS_SUBSTITUTE, a ld hl, BattleAnimCmd_RaiseSub @@ -8259,9 +8259,9 @@ DropEnemySub: ; 3f486 ld [CurPartySpecies], a call GetBaseData ld hl, EnemyMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter ld de, vTiles2 - predef Predef_GetAnimatedFrontpic + predef GetAnimatedFrontpic pop af ld [CurPartySpecies], a ret @@ -8278,7 +8278,7 @@ GetEnemyMonFrontpic_DoAnim: ; 3f4b4 ret ; 3f4c1 -Predef_StartBattle: ; 3f4c1 +StartBattle: ; 3f4c1 ; This check prevents you from entering a battle without any Pokemon. ; Those using walk-through-walls to bypass getting a Pokemon experience ; the effects of this check. @@ -8337,7 +8337,7 @@ BattleIntro: ; 3f4dd call ClearSprites ld a, [wBattleMode] cp WILD_BATTLE - call z, Predef_UpdateEnemyHUD + call z, UpdateEnemyHUD ld a, $1 ld [hBGMapMode], a ret @@ -8402,14 +8402,14 @@ InitEnemyTrainer: ; 3f594 .ok ld de, vTiles2 - callfar Predef_GetTrainerPic + callfar GetTrainerPic xor a ld [hGraphicStartTile], a dec a ld [wEnemyItemState], a hlcoord 12, 0 lb bc, 7, 7 - predef Predef_PlaceGraphic + predef PlaceGraphic ld a, -1 ld [CurOTMon], a ld a, TRAINER_BATTLE @@ -8455,7 +8455,7 @@ InitEnemyWildmon: ; 3f607 ld bc, NUM_MOVES call CopyBytes ld hl, EnemyMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter ld a, [CurPartySpecies] cp UNOWN jr nz, .skip_unown @@ -8466,13 +8466,13 @@ InitEnemyWildmon: ; 3f607 ld [wFirstUnownSeen], a .skip_unown ld de, vTiles2 - predef Predef_GetAnimatedFrontpic + predef GetAnimatedFrontpic xor a ld [TrainerClass], a ld [hGraphicStartTile], a hlcoord 12, 0 lb bc, 7, 7 - predef Predef_PlaceGraphic + predef PlaceGraphic ret ; 3f662 @@ -8551,7 +8551,7 @@ ExitBattle: ; 3f69e call CheckPayDay xor a ld [wForceEvolution], a - predef Predef_EvolveAfterBattle + predef EvolveAfterBattle farcall GivePokerusAndConvertBerries ret ; 3f6d0 @@ -9225,7 +9225,7 @@ InitBattleDisplay: ; 3fb6c ld [hGraphicStartTile], a hlcoord 2, 6 lb bc, 6, 6 - predef Predef_PlaceGraphic + predef PlaceGraphic xor a ld [hWY], a ld [rWY], a @@ -9297,8 +9297,8 @@ GetTrainerBackpic: ; 3fbff .Decompress: ld de, vTiles2 tile $31 - ld c, $31 - predef Predef_Decompress + ld c, 7 * 7 + predef DecompressGet2bpp ret ; 3fc30 @@ -9320,7 +9320,7 @@ CopyBackpic: ; 3fc30 ld [hGraphicStartTile], a hlcoord 2, 6 lb bc, 6, 6 - predef Predef_PlaceGraphic + predef PlaceGraphic ret ; 3fc5b @@ -9400,7 +9400,7 @@ BattleStartMessage: ; 3fc8b hlcoord 12, 0 ld d, $0 ld e, ANIM_MON_NORMAL - predef Predef_AnimateFrontpic + predef AnimateFrontpic jr .skip_cry ; cry is played during the animation .cry_no_anim diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index c46ded638..801ce211e 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -182,7 +182,7 @@ CheckPlayerTurn: call StdBattleTextBox call CantMove call UpdateBattleMonInParty - ld hl, Predef_UpdatePlayerHUD + ld hl, UpdatePlayerHUD call CallBattleCore ld a, $1 ld [hBGMapMode], a @@ -433,7 +433,7 @@ CheckEnemyTurn: ; 3421f call StdBattleTextBox call CantMove call UpdateEnemyMonInParty - ld hl, Predef_UpdateEnemyHUD + ld hl, UpdateEnemyHUD call CallBattleCore ld a, $1 ld [hBGMapMode], a @@ -672,7 +672,7 @@ HitConfusion: ; 343a5 and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND call z, PlayFXAnimID - ld hl, Predef_UpdatePlayerHUD + ld hl, UpdatePlayerHUD call CallBattleCore ld a, $1 ld [hBGMapMode], a @@ -1538,11 +1538,11 @@ BattleCheckTypeMatchup: ; 347c8 ld hl, EnemyMonType1 ld a, [hBattleTurn] and a - jr z, Predef_CheckTypeMatchup + jr z, CheckTypeMatchup ld hl, BattleMonType1 -Predef_CheckTypeMatchup: ; 347d3 +CheckTypeMatchup: ; 347d3 ; There is an incorrect assumption about this function made in the AI related code: when -; the AI calls Predef_CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing +; the AI calls CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing ; the offensive type in a will make this function do the right thing. Since a is overwritten, ; this assumption is incorrect. A simple fix would be to load the move type for the ; current move into a in BattleCheckTypeMatchup, before falling through, which is @@ -2621,7 +2621,7 @@ BattleCommand_CheckDestinyBond: ; 351c0 ld [Buffer6], a ld h, b ld l, c - predef Predef_AnimateHPBar + predef AnimateHPBar call RefreshBattleHuds call BattleCommand_SwitchTurn @@ -4015,7 +4015,7 @@ BattleCommand_PainSplit: ; 35926 ld a, $1 ld [wWhichHPBar], a hlcoord 10, 9 - predef Predef_AnimateHPBar + predef AnimateHPBar ld hl, EnemyMonHP ld a, [hli] ld [Buffer4], a @@ -4030,7 +4030,7 @@ BattleCommand_PainSplit: ; 35926 ld [wWhichHPBar], a call ResetDamage hlcoord 2, 2 - predef Predef_AnimateHPBar + predef AnimateHPBar farcall _UpdateBattleHUDs ld hl, SharedPainText @@ -4172,7 +4172,7 @@ BattleCommand_Conversion2: ; 359e6 ld a, [hl] ld [wNamedObjectIndexBuffer], a - predef Predef_GetTypeName + predef GetTypeName ld hl, TransformedTypeText jp StdBattleTextBox @@ -4711,7 +4711,7 @@ PlayFXAnimID: ; 35d08 ld c, 3 call DelayFrames - callfar Predef_PlayBattleAnim + callfar PlayBattleAnim ret @@ -4773,7 +4773,7 @@ EnemyHurtItself: ; 35d1c hlcoord 2, 2 xor a ld [wWhichHPBar], a - predef Predef_AnimateHPBar + predef AnimateHPBar .did_no_damage jp RefreshBattleHuds @@ -4833,7 +4833,7 @@ PlayerHurtItself: ; 35d7e hlcoord 10, 9 ld a, $1 ld [wWhichHPBar], a - predef Predef_AnimateHPBar + predef AnimateHPBar .did_no_damage jp RefreshBattleHuds @@ -5301,7 +5301,7 @@ SapHealth: ; 36011 xor a .hp_bar ld [wWhichHPBar], a - predef Predef_AnimateHPBar + predef AnimateHPBar call RefreshBattleHuds jp UpdateBattleMonInParty @@ -6239,11 +6239,11 @@ BattleCommand_Curl: ; 365a7 BattleCommand_RaiseSubNoAnim: ; 365af - ld hl, Predef_GetBattleMonBackpic + ld hl, GetBattleMonBackpic ld a, [hBattleTurn] and a jr z, .PlayerTurn - ld hl, Predef_GetEnemyMonFrontpic + ld hl, GetEnemyMonFrontpic .PlayerTurn: xor a ld [hBGMapMode], a @@ -7525,7 +7525,7 @@ BattleCommand_Recoil: ; 36cb2 xor a .animate_hp_bar ld [wWhichHPBar], a - predef Predef_AnimateHPBar + predef AnimateHPBar call RefreshBattleHuds ld hl, RecoilText jp StdBattleTextBox @@ -8227,7 +8227,7 @@ BattleCommand_Conversion: ; 3707f inc de ld [de], a ld [wNamedObjectIndexBuffer], a - farcall Predef_GetTypeName + farcall GetTypeName call AnimateCurrentMove ld hl, TransformedTypeText jp StdBattleTextBox @@ -9856,7 +9856,7 @@ PlayUserBattleAnim: ; 37e47 push hl push de push bc - callfar Predef_PlayBattleAnim + callfar PlayBattleAnim pop bc pop de pop hl @@ -9878,7 +9878,7 @@ PlayOpponentBattleAnim: ; 37e54 push bc call BattleCommand_SwitchTurn - callfar Predef_PlayBattleAnim + callfar PlayBattleAnim call BattleCommand_SwitchTurn pop bc diff --git a/engine/battle/effect_commands/attract.asm b/engine/battle/effect_commands/attract.asm index fc73d234c..0a6d7c975 100755 --- a/engine/battle/effect_commands/attract.asm +++ b/engine/battle/effect_commands/attract.asm @@ -35,7 +35,7 @@ CheckOppositeGender: ; 377f5 xor a ld [MonType], a - farcall Predef_GetGender + farcall GetGender jr c, .genderless_samegender ld b, 1 @@ -58,7 +58,7 @@ CheckOppositeGender: ; 377f5 ld [TempMonDVs + 1], a ld a, 3 ld [MonType], a - farcall Predef_GetGender + farcall GetGender pop bc jr c, .genderless_samegender diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm index 40c472e50..a41d31d9a 100644 --- a/engine/battle/misc.asm +++ b/engine/battle/misc.asm @@ -33,7 +33,7 @@ AppearUser: ; fbd77 (3e:7d77) ld a, $31 .okay ld [hGraphicStartTile], a - predef Predef_PlaceGraphic + predef PlaceGraphic FinishAppearDisappearUser: ; fbd91 (3e:7d91) ld a, $1 ld [hBGMapMode], a diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index 4f3dc8e55..a09c6dd08 100755 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -103,7 +103,7 @@ TrainerType1: ; 397eb ld a, OTPARTYMON ld [MonType], a push hl - predef Predef_TryAddMonToParty + predef TryAddMonToParty pop hl jr .loop ; 39806 @@ -124,7 +124,7 @@ TrainerType2: ; 39806 ld [MonType], a push hl - predef Predef_TryAddMonToParty + predef TryAddMonToParty ld a, [OTPartyCount] dec a ld hl, OTPartyMon1Moves @@ -200,7 +200,7 @@ TrainerType3: ; 39871 ld a, OTPARTYMON ld [MonType], a push hl - predef Predef_TryAddMonToParty + predef TryAddMonToParty ld a, [OTPartyCount] dec a ld hl, OTPartyMon1Item @@ -231,7 +231,7 @@ TrainerType4: ; 3989d ld [MonType], a push hl - predef Predef_TryAddMonToParty + predef TryAddMonToParty ld a, [OTPartyCount] dec a ld hl, OTPartyMon1Item diff --git a/engine/battle/returntobattle_useball.asm b/engine/battle/returntobattle_useball.asm index 4254d24f4..e6e33f900 100644 --- a/engine/battle/returntobattle_useball.asm +++ b/engine/battle/returntobattle_useball.asm @@ -4,13 +4,13 @@ _ReturnToBattle_UseBall: ; 2715c ld a, [BattleType] cp BATTLETYPE_TUTORIAL jr z, .gettutorialbackpic - farcall Predef_GetBattleMonBackpic + farcall GetBattleMonBackpic jr .continue .gettutorialbackpic farcall GetTrainerBackpic .continue - farcall Predef_GetEnemyMonFrontpic + farcall GetEnemyMonFrontpic farcall _LoadBattleFontsHPBar call GetMemSGBLayout call CloseWindow diff --git a/engine/battle/start_battle.asm b/engine/battle/start_battle.asm index b97eda1b3..e1377eec0 100644 --- a/engine/battle/start_battle.asm +++ b/engine/battle/start_battle.asm @@ -33,7 +33,7 @@ FindFirstAliveMonAndStartBattle: ; 2ee2f add hl, de ld a, [hl] ld [BattleMonLevel], a - predef Predef_DoBattleTransition + predef DoBattleTransition farcall _LoadBattleFontsHPBar ld a, 1 ld [hBGMapMode], a diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index ee13fbd96..d19e7210a 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -1,6 +1,6 @@ ; Battle animation command interpreter. -Predef_PlayBattleAnim: ; cc0d6 +PlayBattleAnim: ; cc0d6 ld a, [rSVBK] push af @@ -167,7 +167,7 @@ BattleAnimRestoreHuds: ; cc1bb ld [rSVBK], a ld hl, UpdateBattleHuds - ld a, BANK(Predef_UpdatePlayerHUD) + ld a, BANK(UpdatePlayerHUD) rst FarCall ; Why not "call UpdateBattleHuds"? pop af @@ -928,18 +928,18 @@ BattleAnimCmd_Transform: ; cc5dc (33:45dc) ld a, [TempBattleMonSpecies] ; TempBattleMonSpecies ld [CurPartySpecies], a ; CurPartySpecies ld hl, BattleMonDVs ; BattleMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter ld de, vTiles0 tile $00 - predef Predef_GetMonFrontpic + predef GetMonFrontpic jr .done .player ld a, [TempEnemyMonSpecies] ; TempEnemyMonSpecies ld [CurPartySpecies], a ; CurPartySpecies ld hl, EnemyMonDVs ; EnemyMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter ld de, vTiles0 tile $00 - predef Predef_GetMonBackpic + predef GetMonBackpic .done pop af @@ -1155,16 +1155,16 @@ BattleAnimCmd_BeatUp: ; cc776 (33:4776) jr z, .player ld hl, BattleMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter ld de, vTiles2 tile $00 - predef Predef_GetMonFrontpic + predef GetMonFrontpic jr .done .player ld hl, EnemyMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter ld de, vTiles2 tile $31 - predef Predef_GetMonBackpic + predef GetMonBackpic .done pop af diff --git a/engine/billspc.asm b/engine/billspc.asm index 596679118..baf0ee643 100755 --- a/engine/billspc.asm +++ b/engine/billspc.asm @@ -1095,10 +1095,10 @@ PCMonInfo: ; e2ac6 (38:6ac6) ld [CurPartySpecies], a ld [CurSpecies], a ld hl, TempMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter call GetBaseData ld de, vTiles2 tile $00 - predef Predef_GetMonFrontpic + predef GetMonFrontpic xor a ld [wBillsPC_MonHasMail], a ld a, [CurPartySpecies] @@ -1115,7 +1115,7 @@ PCMonInfo: ; e2ac6 (38:6ac6) ld a, $3 ld [MonType], a - farcall Predef_GetGender + farcall GetGender jr c, .skip_gender ld a, "♂" jr nz, .printgender @@ -1698,7 +1698,7 @@ BillsPC_StatsScreen: ; e2f7e (38:6f7e) call BillsPC_CopyMon ld a, $3 ld [MonType], a - predef Predef_StatsScreenInit + predef StatsScreenInit call BillsPC_InitGFX call MaxVolume ret @@ -1726,7 +1726,7 @@ StatsScreenDPad: ; e2f95 (38:6f95) ld [CurPartySpecies], a ld [CurSpecies], a ld hl, TempMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter call GetBaseData call BillsPC_CopyMon .pressed_a_b_right_left @@ -1819,7 +1819,7 @@ DepositPokemon: ; e307c (38:707c) call GetNick ld a, PC_DEPOSIT ld [wPokemonWithdrawDepositParameter], a - predef Predef_SendGetPkmnIntoFromBox + predef SendGetPkmnIntoFromBox jr c, .asm_boxisfull xor a ld [wPokemonWithdrawDepositParameter], a @@ -1874,7 +1874,7 @@ TryWithdrawPokemon: ; e30fa (38:70fa) call CloseSRAM xor a ld [wPokemonWithdrawDepositParameter], a - predef Predef_SendGetPkmnIntoFromBox + predef SendGetPkmnIntoFromBox jr c, .PartyFull ld a, PC_DEPOSIT ld [wPokemonWithdrawDepositParameter], a diff --git a/engine/breeding.asm b/engine/breeding.asm index e86cf5832..9fe0b8986 100755 --- a/engine/breeding.asm +++ b/engine/breeding.asm @@ -10,7 +10,7 @@ CheckBreedmonCompatibility: ; 16e1d ld [TempMonDVs + 1], a ld a, TEMPMON ld [MonType], a - predef Predef_GetGender + predef GetGender jr c, .genderless ld b, $1 jr nz, .breedmon2 @@ -26,7 +26,7 @@ CheckBreedmonCompatibility: ; 16e1d ld [TempMonDVs + 1], a ld a, $3 ld [MonType], a - predef Predef_GetGender + predef GetGender pop bc jr c, .genderless ld a, $1 @@ -289,7 +289,7 @@ HatchEggs: ; 16f70 (5:6f70) ld bc, MON_STAT_EXP - 1 add hl, bc ld b, $0 - predef Predef_CalcPkmnStats + predef CalcPkmnStats pop bc ld hl, MON_MAXHP add hl, bc @@ -514,7 +514,7 @@ GLOBAL EggMoves cp b jr nz, .loop5 ld [wPutativeTMHMMove], a - predef Predef_CanLearnTMHMMove + predef CanLearnTMHMMove ld a, c and a jr z, .done @@ -559,7 +559,7 @@ LoadEggMove: ; 17169 ld [hl], b ld hl, wEggMonMoves ld de, wEggMonPP - predef Predef_FillPP + predef FillPP pop bc pop de ret @@ -590,7 +590,7 @@ GetHeritableMoves: ; 17197 ld [TempMonDVs + 1], a ld a, TEMPMON ld [MonType], a - predef Predef_GetGender + predef GetGender jr c, .inherit_mon2_moves jr nz, .inherit_mon2_moves jr .inherit_mon1_moves @@ -606,7 +606,7 @@ GetHeritableMoves: ; 17197 ld [TempMonDVs + 1], a ld a, TEMPMON ld [MonType], a - predef Predef_GetGender + predef GetGender jr c, .inherit_mon1_moves jr nz, .inherit_mon1_moves @@ -647,9 +647,9 @@ GetEggFrontpic: ; 17224 (5:7224) ld [CurSpecies], a call GetBaseData ld hl, BattleMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter pop de - predef_jump Predef_GetMonFrontpic + predef_jump GetMonFrontpic GetHatchlingFrontpic: ; 1723c (5:723c) push de @@ -657,9 +657,9 @@ GetHatchlingFrontpic: ; 1723c (5:723c) ld [CurSpecies], a call GetBaseData ld hl, BattleMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter pop de - predef_jump Predef_GetAnimatedFrontpic + predef_jump GetAnimatedFrontpic Hatch_UpdateFrontpicBGMapCenter: ; 17254 (5:7254) push af @@ -677,7 +677,7 @@ Hatch_UpdateFrontpicBGMapCenter: ; 17254 (5:7254) ld a, c ld [hGraphicStartTile], a lb bc, 7, 7 - predef Predef_PlaceGraphic + predef PlaceGraphic pop af call Hatch_LoadFrontpicPal call SetPalettes @@ -779,7 +779,7 @@ EggHatch_AnimationSequence: ; 1728f (5:728f) hlcoord 6, 3 ld d, $0 ld e, ANIM_MON_HATCH - predef Predef_AnimateFrontpic + predef AnimateFrontpic pop af ld [CurSpecies], a ret diff --git a/engine/color.asm b/engine/color.asm index e2c227d63..b95d0a2f4 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -43,7 +43,7 @@ CheckShininess: and a ret -UnusedPredef_CheckContestMon: +Unused_CheckContestMon: ; Check a mon's DVs at hl in the bug catching contest. ; Return carry if its DVs are good enough to place in the contest. @@ -855,7 +855,7 @@ PushSGBPals: jr nz, .loop ret -Predef_InitSGBBorder: +InitSGBBorder: call CheckCGB ret nz ; SGB/DMG only diff --git a/engine/debug.asm b/engine/debug.asm index a23e9d674..710091779 100755 --- a/engine/debug.asm +++ b/engine/debug.asm @@ -315,12 +315,12 @@ Function81adb: ; 81adb hlcoord 12, 3 call _PrepMonFrontpic ld de, vTiles2 tile $31 - predef Predef_GetMonBackpic + predef GetMonBackpic ld a, $31 ld [hGraphicStartTile], a hlcoord 2, 4 lb bc, 6, 6 - predef Predef_PlaceGraphic + predef PlaceGraphic ld a, [wd003] and a jr z, .asm_81b66 @@ -346,13 +346,13 @@ Function81adb: ; 81adb hlcoord 4, 1 call PlaceString ld de, vTiles2 - callfar Predef_GetTrainerPic + callfar GetTrainerPic xor a ld [TempEnemyMonSpecies], a ld [hGraphicStartTile], a hlcoord 2, 3 lb bc, 7, 7 - predef Predef_PlaceGraphic + predef PlaceGraphic .asm_81ba9 ld a, $1 @@ -739,7 +739,7 @@ Function81df4: ; 81df4 ld a, [wd004] inc a ld [wd265], a - predef Predef_GetTMHMMove + predef GetTMHMMove ld a, [wd265] ld [wPutativeTMHMMove], a call GetMoveName @@ -748,7 +748,7 @@ Function81df4: ; 81df4 ld a, [wd004] call Function81e55 ld [CurItem], a - predef Predef_CanLearnTMHMMove + predef CanLearnTMHMMove ld a, c and a ld de, String_81e46 diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm index 93b283d27..bb2c23ca2 100755 --- a/engine/events/battle_tower/battle_tower.asm +++ b/engine/events/battle_tower/battle_tower.asm @@ -248,7 +248,7 @@ RunBattleTowerTrainer: ; 17024d call ReadBTTrainerParty call Clears5_a89a - predef Predef_StartBattle + predef StartBattle farcall LoadPokemonData farcall HealParty @@ -484,7 +484,7 @@ endr ld hl, MON_STAT_EXP - 1 add hl, bc ld b, $1 - predef Predef_CalcPkmnStats + predef CalcPkmnStats pop de pop hl dec de diff --git a/engine/events/catch_tutorial.asm b/engine/events/catch_tutorial.asm index d91af65fe..b9352ccd6 100644 --- a/engine/events/catch_tutorial.asm +++ b/engine/events/catch_tutorial.asm @@ -41,7 +41,7 @@ CatchTutorial:: ; 4e554 ld hl, .AutoInput ld a, BANK(.AutoInput) call StartAutoInput - callfar Predef_StartBattle + callfar StartBattle call StopAutoInput pop af diff --git a/engine/events/daycare.asm b/engine/events/daycare.asm index 6310787ac..ed6e16e87 100755 --- a/engine/events/daycare.asm +++ b/engine/events/daycare.asm @@ -565,7 +565,7 @@ DayCare_GiveEgg: ; 169ac pop hl push bc ld b, $0 - predef Predef_CalcPkmnStats + predef CalcPkmnStats pop bc ld hl, MON_HP add hl, bc @@ -639,7 +639,7 @@ DayCare_InitBreeding: ; 16a3b cp DITTO ld a, $0 jr z, .LoadWhichBreedmonIsTheMother - farcall Predef_GetGender + farcall GetGender ld a, $0 jr z, .LoadWhichBreedmonIsTheMother inc a @@ -684,7 +684,7 @@ DayCare_InitBreeding: ; 16a3b ld de, wEggMonMoves xor a ld [Buffer1], a - predef Predef_FillMoves + predef FillMoves farcall InitEggMoves ld hl, wEggMonID ld a, [PlayerID] @@ -726,7 +726,7 @@ DayCare_InitBreeding: ; 16a3b ld a, TEMPMON ld [MonType], a push hl - farcall Predef_GetGender + farcall GetGender pop hl ld de, wBreedMon1DVs ld bc, wBreedMon2DVs @@ -770,7 +770,7 @@ DayCare_InitBreeding: ; 16a3b call CopyBytes ld hl, wEggMonMoves ld de, wEggMonPP - predef Predef_FillPP + predef FillPP ld hl, wMonOrItemNameBuffer ld de, StringBuffer1 ld bc, NAME_LENGTH diff --git a/engine/events/halloffame.asm b/engine/events/halloffame.asm index 6b01ee831..ce6e5ddc7 100755 --- a/engine/events/halloffame.asm +++ b/engine/events/halloffame.asm @@ -130,7 +130,7 @@ AnimateHallOfFame: ; 864c3 call WaitBGMap decoord 6, 5 ld c, $6 - predef Predef_HOF_AnimateFrontpic + predef HOF_AnimateFrontpic ld c, 60 call DelayFrames and a @@ -244,18 +244,18 @@ AnimateHOFMonEntrance: ; 865b5 ld a, [hli] ld [TempMonDVs + 1], a ld hl, TempMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, " " call ByteFill ld de, vTiles2 tile $31 - predef Predef_GetMonBackpic + predef GetMonBackpic ld a, $31 ld [hGraphicStartTile], a hlcoord 6, 6 lb bc, 6, 6 - predef Predef_PlaceGraphic + predef PlaceGraphic ld a, $d0 ld [hSCY], a ld a, $90 @@ -403,7 +403,7 @@ _HallOfFamePC: ; 86650 call SetPalettes decoord 6, 5 ld c, $6 - predef Predef_HOF_AnimateFrontpic + predef HOF_AnimateFrontpic and a ret @@ -478,7 +478,7 @@ DisplayHOFMon: ; 86748 ld [CurPartySpecies], a ld [wd265], a ld hl, TempMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter xor a ld [wBoxAlignment], a hlcoord 6, 5 @@ -499,7 +499,7 @@ DisplayHOFMon: ; 86748 call PlaceString ld a, TEMPMON ld [MonType], a - farcall Predef_GetGender + farcall GetGender ld a, " " jr c, .got_gender ld a, "♂" @@ -546,7 +546,7 @@ HOF_AnimatePlayerPic: ; 86810 ld [hGraphicStartTile], a hlcoord 6, 6 lb bc, 6, 6 - predef Predef_PlaceGraphic + predef PlaceGraphic ld a, $d0 ld [hSCY], a ld a, $90 @@ -570,7 +570,7 @@ HOF_AnimatePlayerPic: ; 86810 ld [hGraphicStartTile], a hlcoord 12, 5 lb bc, 7, 7 - predef Predef_PlaceGraphic + predef PlaceGraphic ld a, $c0 ld [hSCX], a call WaitBGMap diff --git a/engine/events/move_tutor.asm b/engine/events/move_tutor.asm index 8bb29f9ae..be5f37564 100644 --- a/engine/events/move_tutor.asm +++ b/engine/events/move_tutor.asm @@ -55,7 +55,7 @@ CheckCanLearnMoveTutorMove: ; 492b9 ld hl, .MenuDataHeader call LoadMenuDataHeader - predef Predef_CanLearnTMHMMove + predef CanLearnTMHMMove push bc ld a, [CurPartyMon] @@ -79,7 +79,7 @@ CheckCanLearnMoveTutorMove: ; 492b9 callfar KnowsMove jr c, .didnt_learn - predef Predef_LearnMove + predef LearnMove ld a, b and a jr z, .didnt_learn diff --git a/engine/events/poisonstep.asm b/engine/events/poisonstep.asm index 366ad1c03..00c7477bc 100755 --- a/engine/events/poisonstep.asm +++ b/engine/events/poisonstep.asm @@ -104,7 +104,7 @@ DoPoisonStep:: ; 505da ld de, SFX_POISON call PlaySFX ld b, $2 - predef Predef_LoadPoisonBGPals + predef LoadPoisonBGPals call DelayFrame ret ; 50669 @@ -145,7 +145,7 @@ DoPoisonStep:: ; 505da ld a, [PartyCount] cp [hl] jr nz, .party_loop - predef Predef_CheckPlayerPartyForFitPkmn + predef CheckPlayerPartyForFitPkmn ld a, d ld [ScriptVar], a ret diff --git a/engine/events/poisonstep_pals.asm b/engine/events/poisonstep_pals.asm index 326629138..c0d4c5ace 100644 --- a/engine/events/poisonstep_pals.asm +++ b/engine/events/poisonstep_pals.asm @@ -1,4 +1,4 @@ -Predef_LoadPoisonBGPals: ; cbcdd +LoadPoisonBGPals: ; cbcdd call .LoadPals ld a, [hCGB] and a diff --git a/engine/events/pokecenter_pc.asm b/engine/events/pokecenter_pc.asm index 61d7346df..75d2d5392 100755 --- a/engine/events/pokecenter_pc.asm +++ b/engine/events/pokecenter_pc.asm @@ -353,7 +353,7 @@ KrisWithdrawItemMenu: ; 0x157d1 ld [CurItemQuantity], a ld hl, PCItems call TossItem - predef Predef_PartyMonItemName + predef PartyMonItemName ld hl, .WithdrewText call MenuTextBox xor a @@ -517,7 +517,7 @@ KrisDepositItemMenu: ; 0x1588b ld [CurItemQuantity], a ld hl, NumItems call TossItem - predef Predef_PartyMonItemName + predef PartyMonItemName ld hl, .DepositText call PrintText ret diff --git a/engine/events/pokepic.asm b/engine/events/pokepic.asm index 1a433cb25..e9e14bbf4 100755 --- a/engine/events/pokepic.asm +++ b/engine/events/pokepic.asm @@ -12,7 +12,7 @@ Pokepic:: ; 244e3 ld [CurSpecies], a call GetBaseData ld de, vTiles1 - predef Predef_GetMonFrontpic + predef GetMonFrontpic ld a, [wMenuBorderTopCoord] inc a ld b, a @@ -23,7 +23,7 @@ Pokepic:: ; 244e3 ld a, $80 ld [hGraphicStartTile], a lb bc, 7, 7 - predef Predef_PlaceGraphic + predef PlaceGraphic call WaitBGMap ret diff --git a/engine/events/print_unown.asm b/engine/events/print_unown.asm index 41f2bab9c..771d3ea5a 100644 --- a/engine/events/print_unown.asm +++ b/engine/events/print_unown.asm @@ -140,13 +140,13 @@ UnownPrinter: ; 16be4 xor a ld [wBoxAlignment], a ld de, vTiles2 - predef Predef_GetMonFrontpic + predef GetMonFrontpic call .Load2bppToSRAM hlcoord 1, 6 xor a ld [hGraphicStartTile], a lb bc, 7, 7 - predef Predef_PlaceGraphic + predef PlaceGraphic ld de, vTiles2 tile $31 farcall RotateUnownFrontpic ret @@ -228,6 +228,6 @@ PlaceUnownPrinterFrontpic: ; 16dac ld a, $31 ld [hGraphicStartTile], a lb bc, 7, 7 - predef Predef_PlaceGraphic + predef PlaceGraphic ret ; 16dc7 diff --git a/engine/events/special.asm b/engine/events/special.asm index 62e0a620e..6238acc44 100755 --- a/engine/events/special.asm +++ b/engine/events/special.asm @@ -12,7 +12,7 @@ Special_GiveShuckle: ; 7305 ld a, 15 ld [CurPartyLevel], a - predef Predef_TryAddMonToParty + predef TryAddMonToParty jr nc, .NotGiven ; Caught data. diff --git a/engine/evolution_animation.asm b/engine/evolution_animation.asm index 365f4e729..8c3a191bb 100755 --- a/engine/evolution_animation.asm +++ b/engine/evolution_animation.asm @@ -122,7 +122,7 @@ EvolutionAnimation: ; 4e5e1 hlcoord 7, 2 ld d, $0 ld e, ANIM_MON_EVOLVE - predef Predef_AnimateFrontpic + predef AnimateFrontpic pop af ld [CurPartySpecies], a @@ -168,7 +168,7 @@ EvolutionAnimation: ; 4e5e1 ld a, $1 ld [wBoxAlignment], a ld de, vTiles2 - predef Predef_GetAnimatedFrontpic + predef GetAnimatedFrontpic xor a ld [wBoxAlignment], a ret diff --git a/engine/evolve.asm b/engine/evolve.asm index 877dd9031..aac0c68eb 100755 --- a/engine/evolve.asm +++ b/engine/evolve.asm @@ -6,7 +6,7 @@ EvolvePokemon: ; 421d8 ld c, a ld b, SET_FLAG call EvoFlagAction -Predef_EvolveAfterBattle: ; 421e6 +EvolveAfterBattle: ; 421e6 xor a ld [wMonTriedToEvolve], a dec a @@ -55,7 +55,7 @@ EvolveAfterBattle_MasterLoop push hl xor a ld [MonType], a - predef Predef_CopyPkmnToTempMon + predef CopyPkmnToTempMon pop hl .loop @@ -265,7 +265,7 @@ EvolveAfterBattle_MasterLoop ld hl, TempMonExp + 2 ld de, TempMonMaxHP ld b, $1 - predef Predef_CalcPkmnStats + predef CalcPkmnStats ld a, [CurPartyMon] ld hl, PartyMons @@ -301,7 +301,7 @@ EvolveAfterBattle_MasterLoop ld [wd265], a xor a ld [MonType], a - call Predef_LearnLevelMoves + call LearnLevelMoves ld a, [wd265] dec a call SetSeenAndCaughtMon @@ -311,7 +311,7 @@ EvolveAfterBattle_MasterLoop jr nz, .skip_unown ld hl, TempMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter callfar UpdateUnownDex .skip_unown @@ -429,7 +429,7 @@ Text_WhatEvolving: ; 0x42482 ; 0x42487 -Predef_LearnLevelMoves: ; 42487 +LearnLevelMoves: ; 42487 ld a, [wd265] ld [CurPartySpecies], a dec a @@ -484,7 +484,7 @@ Predef_LearnLevelMoves: ; 42487 ld [wd265], a call GetMoveName call CopyName1 - predef Predef_LearnMove + predef LearnMove pop hl jr .find_move @@ -495,7 +495,7 @@ Predef_LearnLevelMoves: ; 42487 ; 424e1 -Predef_FillMoves: ; 424e1 +FillMoves: ; 424e1 ; Fill in moves at de for CurPartySpecies at CurPartyLevel push hl @@ -621,7 +621,7 @@ ShiftMoves: ; 4256e EvoFlagAction: ; 42577 push de ld d, $0 - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction pop de ret ; 42581 diff --git a/engine/health.asm b/engine/health.asm index eba75ddf4..0f7ba156d 100755 --- a/engine/health.asm +++ b/engine/health.asm @@ -52,7 +52,7 @@ HealPartyMon: ; c677 farcall RestoreAllPP ret -Predef_ComputeHPBarPixels: ; c699 +ComputeHPBarPixels: ; c699 ; e = bc * (6 * 8) / de ld a, b or c @@ -103,7 +103,7 @@ Predef_ComputeHPBarPixels: ; c699 ld e, 0 ret -Predef_AnimateHPBar: ; c6e0 +AnimateHPBar: ; c6e0 call WaitBGMap call _AnimateHPBar call WaitBGMap diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index fa9cd1a92..57d6eb6ce 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -941,24 +941,24 @@ Intro_WipeInFrontpic: ; 6182 Intro_PrepTrainerPic: ; 619c ld de, vTiles2 - farcall Predef_GetTrainerPic + farcall GetTrainerPic xor a ld [hGraphicStartTile], a hlcoord 6, 4 lb bc, 7, 7 - predef Predef_PlaceGraphic + predef PlaceGraphic ret ; 61b4 ShrinkFrame: ; 61b4 ld de, vTiles2 - ld c, $31 - predef Predef_Decompress + ld c, 7 * 7 + predef DecompressGet2bpp xor a ld [hGraphicStartTile], a hlcoord 6, 4 lb bc, 7, 7 - predef Predef_PlaceGraphic + predef PlaceGraphic ret ; 61cd diff --git a/engine/item_effects.asm b/engine/item_effects.asm index a15e01247..b072d9e1a 100644 --- a/engine/item_effects.asm +++ b/engine/item_effects.asm @@ -415,7 +415,7 @@ ParkBall: ; e8a2 ld [hBattleTurn], a ld [Buffer2], a ld [wNumHits], a - predef Predef_PlayBattleAnim + predef PlayBattleAnim ld a, [wWildMon] and a @@ -547,7 +547,7 @@ ParkBall: ; e8a2 ld a, [EnemyMonSpecies] ld [wd265], a - predef Predef_NewPokedexEntry + predef NewPokedexEntry .skip_pokedex ld a, [BattleType] @@ -567,7 +567,7 @@ ParkBall: ; e8a2 ld [MonType], a call ClearSprites - predef Predef_TryAddMonToParty + predef TryAddMonToParty farcall SetCaughtData @@ -623,7 +623,7 @@ ParkBall: ; e8a2 .SendToPC: call ClearSprites - predef Predef_SendPkmnIntoBox + predef SendPkmnIntoBox farcall SetBoxMonCaughtData @@ -979,7 +979,7 @@ LoveBallMultiplier: ld [MonType], a ld a, [CurBattleMon] ld [CurPartyMon], a - farcall Predef_GetGender + farcall GetGender jr c, .done1 ; no effect on genderless ld d, 0 ; male @@ -993,7 +993,7 @@ LoveBallMultiplier: ld [CurPartySpecies], a ld a, WILDMON ld [MonType], a - farcall Predef_GetGender + farcall GetGender jr c, .done2 ; no effect on genderless ld d, 0 ; male @@ -1283,7 +1283,7 @@ UpdateStatsAfterItem: ; ee8c ld a, MON_STAT_EXP - 1 call GetPartyParamLocation ld b, $1 - predef_jump Predef_CalcPkmnStats + predef_jump CalcPkmnStats ; ee9f RareCandy_StatBooster_ExitMenu: ; ee9f @@ -1422,7 +1422,7 @@ RareCandy: ; ef14 xor a ; PARTYMON ld [MonType], a - predef Predef_CopyPkmnToTempMon + predef CopyPkmnToTempMon hlcoord 9, 0 ld b, 10 @@ -1431,7 +1431,7 @@ RareCandy: ; ef14 hlcoord 11, 1 ld bc, 4 - predef Predef_PrintTempMonStats + predef PrintTempMonStats call WaitPressAorB_BlinkCursor @@ -1439,7 +1439,7 @@ RareCandy: ; ef14 ld [MonType], a ld a, [CurPartySpecies] ld [wd265], a - predef Predef_LearnLevelMoves + predef LearnLevelMoves xor a ld [wForceEvolution], a @@ -1645,7 +1645,7 @@ RevivePokemon: ; f0d6 ld d, 0 ld hl, wBattleParticipantsIncludingFainted ld b, CHECK_FLAG - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction ld a, c and a jr z, .skip_to_revive @@ -1654,7 +1654,7 @@ RevivePokemon: ; f0d6 ld c, a ld hl, wBattleParticipantsNotFainted ld b, SET_FLAG - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction .skip_to_revive xor a @@ -1821,7 +1821,7 @@ HealHP_SFX_GFX: ; f1db (3:71db) call AddNTimes ld a, $2 ld [wWhichHPBar], a - predef_jump Predef_AnimateHPBar + predef_jump AnimateHPBar UseItem_SelectMon: ; f1f9 (3:71f9) call .SelectMon @@ -2912,7 +2912,7 @@ UseBallInTrainerBattle: ; f7a0 ld [wBattleAnimParam], a ld [hBattleTurn], a ld [wNumHits], a - predef Predef_PlayBattleAnim + predef PlayBattleAnim ld hl, BlockedTheBallText call PrintText ld hl, DontBeAThiefText @@ -3059,7 +3059,7 @@ ApplyPPUp: ; f84c call GetPartyParamLocation push hl ld de, Buffer1 - predef Predef_FillPP + predef FillPP pop hl ld bc, MON_PP - MON_MOVES add hl, bc diff --git a/engine/learn.asm b/engine/learn.asm index ceb814650..d2751235f 100755 --- a/engine/learn.asm +++ b/engine/learn.asm @@ -1,4 +1,4 @@ -Predef_LearnMove: ; 6508 +LearnMove: ; 6508 call LoadTileMapToTempTileMap ld a, [CurPartyMon] ld hl, PartyMonNicknames @@ -144,7 +144,7 @@ ForgetMove: ; 65d3 hlcoord 5 + 2, 2 + 2 ld a, SCREEN_WIDTH * 2 ld [Buffer1], a - predef Predef_ListMoves + predef ListMoves ; wMenuData3 ld a, $4 ld [w2DMenuCursorInitY], a diff --git a/engine/link.asm b/engine/link.asm index 0f17f1305..daa986c67 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -150,7 +150,7 @@ TimeCapsule: ; 2805d ld [wd265], a push hl push de - callfar Predef_ConvertMon_1to2 + callfar ConvertMon_1to2 pop de pop hl ld a, [wd265] @@ -449,7 +449,7 @@ Gen2ToGen2LinkComms: ; 28177 pop af ld [rIF], a - predef Predef_StartBattle + predef StartBattle ld a, [rIF] ld h, a @@ -786,7 +786,7 @@ Link_PrepPartyData_Gen1: ; 28499 add hl, bc ld c, STAT_SATK ld b, TRUE - predef Predef_CalcPkmnStatC + predef CalcPkmnStatC pop bc pop de @@ -986,7 +986,7 @@ Function2868a: ; 2868a push bc push de ld [wd265], a - callfar Predef_ConvertMon_1to2 + callfar ConvertMon_1to2 pop de pop bc ld a, [wd265] @@ -1065,7 +1065,7 @@ Function2868a: ; 2868a add hl, bc ld c, STAT_SATK ld b, TRUE - predef Predef_CalcPkmnStatC + predef CalcPkmnStatC pop bc pop hl ld a, [hQuotient + 1] @@ -1078,7 +1078,7 @@ Function2868a: ; 2868a add hl, bc ld c, STAT_SDEF ld b, TRUE - predef Predef_CalcPkmnStatC + predef CalcPkmnStatC pop bc pop hl ld a, [hQuotient + 1] @@ -1355,7 +1355,7 @@ Function28926: ; 28926 hlcoord 0, 15 ld b, 1 ld c, 18 - call Predef_LinkTextbox + call LinkTextboxAtHL hlcoord 2, 16 ld de, .String_Stats_Trade call PlaceString @@ -1464,7 +1464,7 @@ Function28926: ; 28926 hlcoord 0, 12 ld b, 4 ld c, 18 - call Predef_LinkTextbox + call LinkTextboxAtHL farcall Link_WaitBGMap ld hl, .Text_CantTradeLastMon bccoord 1, 14 @@ -1486,7 +1486,7 @@ Function28926: ; 28926 hlcoord 0, 12 ld b, 4 ld c, 18 - call Predef_LinkTextbox + call LinkTextboxAtHL farcall Link_WaitBGMap ld hl, .Text_Abnormal bccoord 1, 14 @@ -1496,7 +1496,7 @@ Function28926: ; 28926 hlcoord 0, 12 ld b, 4 ld c, 18 - call Predef_LinkTextbox + call LinkTextboxAtHL hlcoord 1, 14 ld de, String_TooBadTheTradeWasCanceled call PlaceString @@ -1641,7 +1641,7 @@ LinkTrade: ; 28b87 hlcoord 0, 12 ld b, $4 ld c, $12 - call Predef_LinkTextbox + call LinkTextboxAtHL farcall Link_WaitBGMap ld a, [wd002] ld hl, PartySpecies @@ -1670,7 +1670,7 @@ LinkTrade: ; 28b87 hlcoord 10, 7 ld b, 3 ld c, 7 - call Predef_LinkTextbox + call LinkTextboxAtHL ld de, String28eab hlcoord 12, 8 call PlaceString @@ -1710,7 +1710,7 @@ LinkTrade: ; 28b87 hlcoord 0, 12 ld b, 4 ld c, 18 - call Predef_LinkTextbox + call LinkTextboxAtHL hlcoord 1, 14 ld de, String_TooBadTheTradeWasCanceled call PlaceString @@ -1727,7 +1727,7 @@ LinkTrade: ; 28b87 hlcoord 0, 12 ld b, 4 ld c, 18 - call Predef_LinkTextbox + call LinkTextboxAtHL hlcoord 1, 14 ld de, String_TooBadTheTradeWasCanceled call PlaceString @@ -1884,11 +1884,11 @@ LinkTrade: ; 28b87 ld a, [hLinkPlayerNumber] cp $1 jr z, .player_2 - predef Predef_TradeAnimation + predef TradeAnimation jr .done_animation .player_2 - predef Predef_TradeAnimationPlayer2 + predef TradeAnimationPlayer2 .done_animation pop af @@ -1906,7 +1906,7 @@ LinkTrade: ; 28b87 ld de, TempMonSpecies ld bc, PARTYMON_STRUCT_LENGTH call CopyBytes - predef Predef_AddTempmonToParty + predef AddTempmonToParty ld a, [PartyCount] dec a ld [CurPartyMon], a @@ -1957,7 +1957,7 @@ LinkTrade: ; 28b87 hlcoord 0, 12 ld b, 4 ld c, 18 - call Predef_LinkTextbox + call LinkTextboxAtHL hlcoord 1, 14 ld de, String28ebd call PlaceString @@ -1994,7 +1994,7 @@ String_TooBadTheTradeWasCanceled: ; 28ece next "was canceled!@" -Predef_LinkTextbox: ; 28eef +LinkTextboxAtHL: ; 28eef ld d, h ld e, l farcall LinkTextbox @@ -2016,11 +2016,11 @@ Unreferenced_Function28f09: ; 28f09 hlcoord 0, 0 ld b, 6 ld c, 18 - call Predef_LinkTextbox + call LinkTextboxAtHL hlcoord 0, 8 ld b, 6 ld c, 18 - call Predef_LinkTextbox + call LinkTextboxAtHL farcall PlaceTradePartnerNamesAndParty ret ; 28f24 @@ -2577,7 +2577,7 @@ Unreferenced_Function29fe4: call GetSRAMBank ld d, $0 ld b, CHECK_FLAG - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction call CloseSRAM ld a, c and a diff --git a/engine/link_2.asm b/engine/link_2.asm index 03b95b39a..866126cd2 100644 --- a/engine/link_2.asm +++ b/engine/link_2.asm @@ -3,7 +3,7 @@ LinkMonStatsScreen: ; 4d319 dec a ld [CurPartyMon], a call LowVolume - predef Predef_StatsScreenInit + predef StatsScreenInit ld a, [CurPartyMon] inc a ld [wMenuCursorY], a @@ -30,13 +30,14 @@ LinkTextbox2: ; 4d35b call .PlaceBorder pop hl pop bc + ld de, AttrMap - TileMap add hl, de inc b inc b inc c inc c - ld a, $7 + ld a, PAL_BG_TEXT .row push bc push hl @@ -51,6 +52,7 @@ LinkTextbox2: ; 4d35b dec b jr nz, .row ret +; 4d37e .PlaceBorder: ; 4d37e push hl @@ -75,12 +77,14 @@ LinkTextbox2: ; 4d35b add hl, de dec b jr nz, .loop + ld a, "┐" ld [hli], a ld a, "│" call .PlaceRow ld [hl], "└" ret +; 4d3ab .PlaceRow: ; 4d3ab ld d, c diff --git a/engine/link_trade.asm b/engine/link_trade.asm index f85403a29..ae84a7beb 100755 --- a/engine/link_trade.asm +++ b/engine/link_trade.asm @@ -48,7 +48,7 @@ _LinkTextbox: ; 16d61d ld l, e push bc push hl - call .draw_border + call .PlaceBorder pop hl pop bc @@ -58,7 +58,7 @@ _LinkTextbox: ; 16d61d inc b inc c inc c - ld a, $7 + ld a, PAL_BG_TEXT .row push bc push hl @@ -75,12 +75,12 @@ _LinkTextbox: ; 16d61d ret ; 16d640 -.draw_border ; 16d640 +.PlaceBorder ; 16d640 push hl ld a, $30 ld [hli], a inc a - call .fill_row + call .PlaceRow inc a ld [hl], a pop hl @@ -91,7 +91,7 @@ _LinkTextbox: ; 16d61d ld a, $33 ld [hli], a ld a, " " - call .fill_row + call .PlaceRow ld [hl], $34 pop hl ld de, SCREEN_WIDTH @@ -102,17 +102,17 @@ _LinkTextbox: ; 16d61d ld a, $35 ld [hli], a ld a, $36 - call .fill_row + call .PlaceRow ld [hl], $37 ret ; 16d66d -.fill_row ; 16d66d +.PlaceRow ; 16d66d ld d, c -.loop4 +.row_loop ld [hli], a dec d - jr nz, .loop4 + jr nz, .row_loop ret ; 16d673 @@ -181,7 +181,7 @@ Function16d6e1: ; 16d6e1 hlcoord 4, 10 ld b, 1 ld c, 10 - predef Predef_LinkTextbox + predef LinkTextboxAtHL hlcoord 5, 11 ld de, .Waiting call PlaceString diff --git a/engine/load_pics.asm b/engine/load_pics.asm index 14ec463cc..5d3becf42 100755 --- a/engine/load_pics.asm +++ b/engine/load_pics.asm @@ -1,4 +1,4 @@ -Predef_GetUnownLetter: ; 51040 +GetUnownLetter: ; 51040 ; Return Unown letter in UnownLetter based on DVs at hl ; Take the middle 2 bits of each DV and place them in order: @@ -37,7 +37,7 @@ Predef_GetUnownLetter: ; 51040 ld [hDividend], a ld [hDividend + 1], a ld [hDividend + 2], a - ld a, 10 + ld a, $ff / NUM_UNOWN + 1 ld [hDivisor], a ld b, 4 call Divide @@ -48,7 +48,7 @@ Predef_GetUnownLetter: ; 51040 ld [UnownLetter], a ret -Predef_GetMonFrontpic: ; 51077 +GetMonFrontpic: ; 51077 ld a, [CurPartySpecies] ld [CurSpecies], a call IsAPokemon @@ -60,7 +60,7 @@ Predef_GetMonFrontpic: ; 51077 ld [rSVBK], a ret -Predef_GetAnimatedFrontpic: ; 5108b +GetAnimatedFrontpic: ; 5108b ld a, [CurPartySpecies] ld [CurSpecies], a call IsAPokemon @@ -70,7 +70,7 @@ Predef_GetAnimatedFrontpic: ; 5108b xor a ld [hBGMapMode], a call _GetFrontpic - call GetAnimatedFrontpic + call GetAnimatedEnemyFrontpic pop af ld [rSVBK], a ret @@ -131,7 +131,7 @@ GLOBAL PokemonPicPointers, UnownPicPointers pop bc ret -GetAnimatedFrontpic: ; 51103 +GetAnimatedEnemyFrontpic: ; 51103 ld a, BANK(vTiles3) ld [rVBK], a push hl @@ -184,18 +184,18 @@ LoadFrontpicTiles: ; 5114f and $f0 ld c, a push bc - call LoadFrontpic + call LoadOrientedFrontpic pop bc .loop push bc ld c, 0 - call LoadFrontpic + call LoadOrientedFrontpic pop bc dec b jr nz, .loop ret -Predef_GetMonBackpic: ; 5116c +GetMonBackpic: ; 5116c ld a, [CurPartySpecies] call IsAPokemon ret c @@ -210,8 +210,7 @@ Predef_GetMonBackpic: ; 5116c ld [rSVBK], a push de - ; These are assumed to be at the same - ; address in their respective banks. + ; These are assumed to be at the same address in their respective banks. GLOBAL PokemonPicPointers, UnownPicPointers ld hl, PokemonPicPointers ; UnownPicPointers ld a, b @@ -311,7 +310,7 @@ Function511ec: ; 511ec call FarDecompress ret -Predef_GetTrainerPic: ; 5120d +GetTrainerPic: ; 5120d ld a, [TrainerClass] and a ret z @@ -353,7 +352,7 @@ Predef_GetTrainerPic: ; 5120d ld [hBGMapMode], a ret -Predef_Decompress: ; 5125d +DecompressGet2bpp: ; 5125d ; Decompress lz data from b:hl to scratch space at 6:d000, then copy it to address de. ld a, [rSVBK] @@ -414,6 +413,7 @@ FixBackpicAlignment: ; 5127c ret PadFrontpic: ; 512ab +; pads frontpic to fill 7x7 box ld a, b cp 6 jr z, .six @@ -422,7 +422,7 @@ PadFrontpic: ; 512ab .seven_loop ld c, $70 - call LoadFrontpic + call LoadOrientedFrontpic dec b jr nz, .seven_loop ret @@ -436,7 +436,7 @@ PadFrontpic: ; 512ab xor a call .Fill ld c, $60 - call LoadFrontpic + call LoadOrientedFrontpic dec b jr nz, .six_loop ret @@ -450,7 +450,7 @@ PadFrontpic: ; 512ab xor a call .Fill ld c, $50 - call LoadFrontpic + call LoadOrientedFrontpic dec b jr nz, .five_loop ld c, $70 @@ -464,7 +464,7 @@ PadFrontpic: ; 512ab jr nz, .Fill ret -LoadFrontpic: ; 512f2 +LoadOrientedFrontpic: ; 512f2 ld a, [wBoxAlignment] and a jr nz, .x_flip diff --git a/engine/mart.asm b/engine/mart.asm index 2f1b9c6a6..f4b89bd22 100755 --- a/engine/mart.asm +++ b/engine/mart.asm @@ -525,7 +525,7 @@ StandardMartAskPurchaseQuantity: ; 15d97 MartConfirmPurchase: ; 15d97 - predef Predef_PartyMonItemName + predef PartyMonItemName ld a, MARTTEXT_COSTS_THIS_MUCH call LoadBuyMenuText call YesNoBox @@ -863,7 +863,7 @@ SellMenu: ; 15eb3 ld a, [wMartItemID] ld hl, NumItems call TossItem - predef Predef_PartyMonItemName + predef PartyMonItemName hlcoord 1, 14 lb bc, 3, 18 call ClearBox diff --git a/engine/mon_stats.asm b/engine/mon_stats.asm index a297b7760..7a493c591 100644 --- a/engine/mon_stats.asm +++ b/engine/mon_stats.asm @@ -1,8 +1,8 @@ -Predef_DrawPlayerHP: ; 50b0a +DrawPlayerHP: ; 50b0a ld a, $1 jr DrawHP -Predef_DrawEnemyHP: ; 50b0e +DrawEnemyHP: ; 50b0e ld a, $2 DrawHP: ; 50b10 @@ -43,7 +43,7 @@ DrawHP: ; 50b10 ld c, e .not_boxmon - predef Predef_ComputeHPBarPixels + predef ComputeHPBarPixels ld a, 6 ld d, a ld c, a @@ -82,7 +82,7 @@ DrawHP: ; 50b10 pop de ret -Predef_PrintTempMonStats: ; 50b7b +PrintTempMonStats: ; 50b7b ; Print TempMon's stats at hl, with spacing bc. push bc push hl @@ -121,7 +121,7 @@ Predef_PrintTempMonStats: ; 50b7b next "SPEED" next "@" -Predef_GetGender: ; 50bdd +GetGender: ; 50bdd ; Return the gender of a given monster (CurPartyMon/CurOTMon/CurWildMon). ; When calling this function, a should be set to an appropriate MonType value. @@ -235,7 +235,7 @@ Predef_GetGender: ; 50bdd scf ret -Predef_ListMovePP: ; 50c50 +ListMovePP: ; 50c50 ld a, [wNumMoves] inc a ld c, a @@ -335,7 +335,7 @@ Unreferenced_Function50cd0: ; 50cd0 jr nz, .loop ret -UnusedPredef22: +Unused_PlaceEnemyHPLevel: push hl push hl ld hl, PartyMonNicknames @@ -343,7 +343,7 @@ UnusedPredef22: call GetNick pop hl call PlaceString - call Predef_CopyPkmnToTempMon + call CopyPkmnToTempMon pop hl ld a, [CurPartySpecies] cp EGG @@ -352,7 +352,7 @@ UnusedPredef22: ld bc, -12 add hl, bc ld b, $0 - call Predef_DrawEnemyHP + call DrawEnemyHP pop hl ld bc, 5 add hl, bc @@ -363,7 +363,7 @@ UnusedPredef22: .egg ret -Predef_PlaceStatusString: ; 50d0a +PlaceStatusString: ; 50d0a push de inc de inc de @@ -373,7 +373,7 @@ Predef_PlaceStatusString: ; 50d0a ld a, [de] or b pop de - jr nz, Predef_PlaceNonFaintStatus + jr nz, PlaceNonFaintStatus push de ld de, FntString call CopyStatusString @@ -396,7 +396,7 @@ CopyStatusString: ; 50d25 ld [hl], a ret -Predef_PlaceNonFaintStatus: ; 50d2e +PlaceNonFaintStatus: ; 50d2e push de ld a, [de] ld de, PsnString @@ -430,7 +430,7 @@ BrnString: db "BRN@" FrzString: db "FRZ@" ParString: db "PAR@" -Predef_ListMoves: ; 50d6f +ListMoves: ; 50d6f ; List moves at hl, spaced every [Buffer1] tiles. ld de, wListMoves_MoveIndicesBuffer ld b, $0 diff --git a/engine/move_mon.asm b/engine/move_mon.asm index 426a3ba8b..91ac2f207 100755 --- a/engine/move_mon.asm +++ b/engine/move_mon.asm @@ -1,4 +1,4 @@ -Predef_TryAddMonToParty: ; d88c +TryAddMonToParty: ; d88c ; Check if to copy wild Pkmn or generate new Pkmn ; Whose is it? ld de, PartyCount @@ -120,7 +120,7 @@ GeneratePartyMonStats: ; d906 endr ld [hl], a ld [Buffer1], a - predef Predef_FillMoves + predef FillMoves .next pop de @@ -195,7 +195,7 @@ endr push de inc hl inc hl - call Predef_FillPP + call FillPP pop de pop hl rept 4 @@ -224,7 +224,7 @@ endr ld a, $1 ld c, a ld b, FALSE - call Predef_CalcPkmnStatC + call CalcPkmnStatC ld a, [hProduct + 2] ld [de], a inc de @@ -297,7 +297,7 @@ endr ld bc, MON_STAT_EXP - 1 add hl, bc ld b, $0 ; if b = 1, then stat calculation takes stat exp into account. - call Predef_CalcPkmnStats + call CalcPkmnStats .next3 ld a, [MonType] @@ -311,7 +311,7 @@ endr dec a ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes - predef Predef_GetUnownLetter + predef GetUnownLetter callfar UpdateUnownDex .done @@ -319,7 +319,7 @@ endr ret ; da6d -Predef_FillPP: ; da6d +FillPP: ; da6d push bc ld b, NUM_MOVES .loop @@ -350,7 +350,7 @@ Predef_FillPP: ; da6d ret ; da96 -Predef_AddTempmonToParty: ; da96 +AddTempmonToParty: ; da96 ld hl, PartyCount ld a, [hl] cp PARTY_LENGTH @@ -422,7 +422,7 @@ Predef_AddTempmonToParty: ; da96 dec a ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes - predef Predef_GetUnownLetter + predef GetUnownLetter callfar UpdateUnownDex ld a, [wFirstUnownSeen] and a @@ -434,7 +434,7 @@ Predef_AddTempmonToParty: ; da96 and a ret -Predef_SendGetPkmnIntoFromBox: ; db3f +SendGetPkmnIntoFromBox: ; db3f ; Sents/Gets Pkmn into/from Box depending on Parameter ; wPokemonWithdrawDepositParameter == 0: get Pkmn into Party ; wPokemonWithdrawDepositParameter == 1: sent Pkmn into Box @@ -597,7 +597,7 @@ Predef_SendGetPkmnIntoFromBox: ; db3f srl a add $2 ld [MonType], a - predef Predef_CopyPkmnToTempMon + predef CopyPkmnToTempMon callfar CalcLevel ld a, d ld [CurPartyLevel], a @@ -617,7 +617,7 @@ Predef_SendGetPkmnIntoFromBox: ; db3f push bc ld b, $1 - call Predef_CalcPkmnStats + call CalcPkmnStats pop bc ld a, [wPokemonWithdrawDepositParameter] @@ -830,7 +830,7 @@ Functiondd64: ; dd64 add hl, bc push bc ld b, $1 - call Predef_CalcPkmnStats + call CalcPkmnStats ld hl, PartyMon1Moves ld a, [PartyCount] dec a @@ -840,7 +840,7 @@ Functiondd64: ; dd64 ld e, l ld a, $1 ld [Buffer1], a - predef Predef_FillMoves + predef FillMoves ld a, [PartyCount] dec a ld [CurPartyMon], a @@ -904,7 +904,7 @@ DepositBreedmon: ; de44 ld bc, BOXMON_STRUCT_LENGTH jp CopyBytes -Predef_SendPkmnIntoBox: ; de6e +SendPkmnIntoBox: ; de6e ; Sends the Pkmn into one of Bills Boxes ; the data comes mainly from 'EnemyMon:' ld a, BANK(sBoxCount) @@ -1010,7 +1010,7 @@ Predef_SendPkmnIntoBox: ; de6e cp UNOWN jr nz, .not_unown ld hl, sBoxMon1DVs - predef Predef_GetUnownLetter + predef GetUnownLetter callfar UpdateUnownDex .not_unown @@ -1086,7 +1086,7 @@ ShiftBoxMon: ; df47 ret ; df8c -Predef_GiveEgg:: ; df8c +GiveEgg:: ; df8c ld a, [CurPartySpecies] push af callfar GetPreEvolution @@ -1094,7 +1094,7 @@ Predef_GiveEgg:: ; df8c ld a, [CurPartySpecies] dec a -; Predef_TryAddMonToParty sets Seen and Caught flags +; TryAddMonToParty sets Seen and Caught flags ; when it is successful. This routine will make ; sure that we aren't newly setting flags. push af @@ -1104,11 +1104,11 @@ Predef_GiveEgg:: ; df8c call CheckSeenMon push bc - call Predef_TryAddMonToParty + call TryAddMonToParty ; If we haven't caught this Pokemon before receiving ; the Egg, reset the flag that was just set by -; Predef_TryAddMonToParty. +; TryAddMonToParty. pop bc ld a, c and a @@ -1119,12 +1119,12 @@ Predef_GiveEgg:: ; df8c ld d, $0 ld hl, PokedexCaught ld b, RESET_FLAG - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction .skip_caught_flag ; If we haven't seen this Pokemon before receiving ; the Egg, reset the flag that was just set by -; Predef_TryAddMonToParty. +; TryAddMonToParty. pop bc ld a, c and a @@ -1135,7 +1135,7 @@ Predef_GiveEgg:: ; df8c ld d, $0 ld hl, PokedexSeen ld b, RESET_FLAG - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction .skip_seen_flag pop af @@ -1360,7 +1360,7 @@ ComputeNPCTrademonStats: ; e134 ld a, MON_STAT_EXP - 1 call GetPartyParamLocation ld b, $1 - call Predef_CalcPkmnStats + call CalcPkmnStats pop de ld a, MON_HP call GetPartyParamLocation @@ -1372,7 +1372,7 @@ ComputeNPCTrademonStats: ; e134 ret ; e167 -Predef_CalcPkmnStats: ; e167 +CalcPkmnStats: ; e167 ; Calculates all 6 Stats of a Pkmn ; b: Take into account stat EXP if TRUE ; 'c' counts from 1-6 and points with 'BaseStats' to the base value @@ -1382,7 +1382,7 @@ Predef_CalcPkmnStats: ; e167 ld c, $0 .loop inc c - call Predef_CalcPkmnStatC + call CalcPkmnStatC ld a, [hMultiplicand + 1] ld [de], a inc de @@ -1395,7 +1395,7 @@ Predef_CalcPkmnStats: ; e167 ret ; e17b -Predef_CalcPkmnStatC: ; e17b +CalcPkmnStatC: ; e17b ; 'c' is 1-6 and points to the BaseStat ; 1: HP ; 2: Attack @@ -1596,7 +1596,7 @@ GivePoke:: ; e277 push bc xor a ; PARTYMON ld [MonType], a - call Predef_TryAddMonToParty + call TryAddMonToParty jr nc, .failed ld hl, PartyMonNicknames ld a, [PartyCount] @@ -1626,7 +1626,7 @@ GivePoke:: ; e277 ld a, [CurPartySpecies] ld [TempEnemyMonSpecies], a callfar LoadEnemyMon - call Predef_SendPkmnIntoBox + call SendPkmnIntoBox jp nc, .FailedToGiveMon ld a, BOXMON ld [MonType], a diff --git a/engine/mystery_gift.asm b/engine/mystery_gift.asm index 0f5265bf7..db2713ff4 100755 --- a/engine/mystery_gift.asm +++ b/engine/mystery_gift.asm @@ -1117,7 +1117,7 @@ MysteryGift_CheckAndSetDecorationAlreadyReceived: ; 105069 (41:5069) ld d, $0 ld b, CHECK_FLAG ld hl, sMysteryGiftDecorationsReceived - predef_id Predef_SmallFarFlagAction + predef_id SmallFarFlagAction push hl push bc call Predef @@ -1129,7 +1129,7 @@ MysteryGift_CheckAndSetDecorationAlreadyReceived: ; 105069 (41:5069) ret nz call GetMysteryGiftBank ld b, SET_FLAG - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction call CloseSRAM xor a ret @@ -1142,7 +1142,7 @@ MysteryGift_CopyReceivedDecosToPC: ; 105091 (41:5091) ld d, $0 ld b, CHECK_FLAG ld hl, sMysteryGiftDecorationsReceived - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction ld a, c and a pop bc diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index 75d25179c..d983d0251 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -109,7 +109,7 @@ NamingScreen: ; 116c1 inc de hlcoord 5, 4 call PlaceString - farcall Predef_GetGender + farcall GetGender jr c, .genderless ld a, "♂" jr nz, .place_gender diff --git a/engine/npctrade.asm b/engine/npctrade.asm index 7e3fa4683..a9055a15d 100755 --- a/engine/npctrade.asm +++ b/engine/npctrade.asm @@ -59,7 +59,7 @@ NPCTrade:: ; fcba8 push af ld a, [wcf64] push af - predef Predef_TradeAnimation + predef TradeAnimation pop af ld [wcf64], a pop af @@ -80,12 +80,12 @@ CheckTradeGender: ; fcc23 cp TRADE_MALE_ONLY jr z, .check_male - farcall Predef_GetGender + farcall GetGender jr nz, .not_matching jr .matching .check_male - farcall Predef_GetGender + farcall GetGender jr z, .not_matching .matching @@ -101,7 +101,7 @@ TradeFlagAction: ; fcc4a ld hl, wTradeFlags ld a, [wJumptableIndex] ld c, a - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction ld a, c and a ret @@ -188,7 +188,7 @@ DoNPCTrade: ; fcc63 ld [MonType], a ld [wPokemonWithdrawDepositParameter], a callfar RemoveMonFromPartyOrBox - predef Predef_TryAddMonToParty + predef TryAddMonToParty ld e, TRADE_DIALOG call GetTradeAttribute diff --git a/engine/party_menu.asm b/engine/party_menu.asm index 1efcfe417..612f1d0e0 100644 --- a/engine/party_menu.asm +++ b/engine/party_menu.asm @@ -189,7 +189,7 @@ PlacePartymonHPBar: ; 50117 ld d, a ld a, [hli] ld e, a - predef Predef_ComputeHPBarPixels + predef ComputeHPBarPixels ret ; 50138 @@ -298,7 +298,7 @@ PlacePartyMonStatus: ; 501b2 ld e, l ld d, h pop hl - call Predef_PlaceStatusString + call PlaceStatusString .next pop hl @@ -330,7 +330,7 @@ PlacePartyMonTMHMCompatibility: ; 501e0 add hl, de ld a, [hl] ld [CurPartySpecies], a - predef Predef_CanLearnTMHMMove + predef CanLearnTMHMMove pop hl call .PlaceAbleNotAble call PlaceString @@ -469,7 +469,7 @@ PlacePartyMonGender: ; 502b1 ld [CurPartyMon], a xor a ld [MonType], a - call Predef_GetGender + call GetGender ld de, .unknown jr c, .got_gender ld de, .male diff --git a/engine/pic_animation.asm b/engine/pic_animation.asm index 6f38967fe..18c68ded9 100644 --- a/engine/pic_animation.asm +++ b/engine/pic_animation.asm @@ -1,54 +1,54 @@ ; Pic animation arrangement. -UnusedPredef_AnimateMon_Slow_Normal: ; d0000 +Unused_AnimateMon_Slow_Normal: ; d0000 hlcoord 12, 0 ld a, [wBattleMode] cp WILD_BATTLE jr z, .wild ld e, ANIM_MON_SLOW ld d, $0 - call Predef_AnimateFrontpic + call AnimateFrontpic ret .wild ld e, ANIM_MON_NORMAL ld d, $0 - call Predef_AnimateFrontpic + call AnimateFrontpic ret ; d001a AnimateMon_Menu: ; d001a ld e, ANIM_MON_MENU ld d, $0 - call Predef_AnimateFrontpic + call AnimateFrontpic ret ; d0022 AnimateMon_Trade: ; d0022 ld e, ANIM_MON_TRADE ld d, $0 - call Predef_AnimateFrontpic + call AnimateFrontpic ret ; d002a AnimateMon_Evolve: ; d002a ld e, ANIM_MON_EVOLVE ld d, $0 - call Predef_AnimateFrontpic + call AnimateFrontpic ret ; d0032 AnimateMon_Hatch: ; d0032 ld e, ANIM_MON_HATCH ld d, $0 - call Predef_AnimateFrontpic + call AnimateFrontpic ret ; d003a AnimateMon_Unused: ; d003a ld e, ANIM_MON_UNUSED ld d, $0 - call Predef_AnimateFrontpic + call AnimateFrontpic ret ; d0042 @@ -86,10 +86,10 @@ PokeAnims: ; d0042 .Egg2: pokeanim Idle, Play -Predef_AnimateFrontpic: ; d008e +AnimateFrontpic: ; d008e call AnimateMon_CheckIfPokemon ret c - call Predef_LoadMonAnimation + call LoadMonAnimation .loop call SetUpPokeAnim push af @@ -99,7 +99,7 @@ Predef_AnimateFrontpic: ; d008e ret ; d00a3 -Predef_LoadMonAnimation: ; d00a3 +LoadMonAnimation: ; d00a3 push hl ld c, e ld b, 0 @@ -1110,11 +1110,11 @@ PokeAnim_GetSpeciesOrUnown: ; d065c ret ; d0669 -UnusedPredef48: ; d0669 Predef 48 +Unused_HOF_AnimateAlignedFrontpic: ; d0669 ld a, $1 ld [wBoxAlignment], a -Predef_HOF_AnimateFrontpic: ; d066e Predef 49 +HOF_AnimateFrontpic: ; d066e call AnimateMon_CheckIfPokemon jr c, .fail ld h, d @@ -1122,12 +1122,12 @@ Predef_HOF_AnimateFrontpic: ; d066e Predef 49 push bc push hl ld de, vTiles2 - predef Predef_GetAnimatedFrontpic + predef GetAnimatedFrontpic pop hl pop bc ld d, 0 ld e, c - call Predef_AnimateFrontpic + call AnimateFrontpic xor a ld [wBoxAlignment], a ret diff --git a/engine/player_gfx.asm b/engine/player_gfx.asm index 8da7ad564..ac63b050f 100644 --- a/engine/player_gfx.asm +++ b/engine/player_gfx.asm @@ -30,7 +30,7 @@ MovePlayerPic: ; 88266 xor a ld [hBGMapMode], a lb bc, 7, 7 - predef Predef_PlaceGraphic + predef PlaceGraphic xor a ld [hBGMapThird], a call WaitBGMap @@ -141,7 +141,7 @@ GetChrisBackpic: ; 88830 ld b, BANK(ChrisBackpic) ld de, vTiles2 tile $31 ld c, 7 * 7 - predef Predef_Decompress + predef DecompressGet2bpp ret HOF_LoadTrainerFrontpic: ; 88840 @@ -203,7 +203,7 @@ DrawIntroPlayerPic: ; 88874 ld [hGraphicStartTile], a hlcoord 6, 4 lb bc, 7, 7 - predef Predef_PlaceGraphic + predef PlaceGraphic ret ChrisPic: ; 888a9 diff --git a/engine/pokedex.asm b/engine/pokedex.asm index fb16f83d1..a68794f9f 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -443,7 +443,7 @@ DexEntryScreen_MenuActionJumptable: ; 402f2 call Pokedex_GetSelectedMon ld a, [wDexCurrentLocation] ld e, a - predef Predef_Pokedex_GetArea + predef Pokedex_GetArea call Pokedex_BlackOutBG call DelayFrame xor a @@ -2367,7 +2367,7 @@ Pokedex_LoadSelectedMonTiles: ; 4143b ld [CurPartySpecies], a call GetBaseData ld de, vTiles2 - predef Predef_GetMonFrontpic + predef GetMonFrontpic ret .QuestionMark: @@ -2520,7 +2520,7 @@ Pokedex_LoadUnownFrontpicTiles: ; 41a58 (10:5a58) ld [CurPartySpecies], a call GetBaseData ld de, vTiles2 tile $00 - predef Predef_GetMonFrontpic + predef GetMonFrontpic pop af ld [UnownLetter], a ret @@ -2550,7 +2550,7 @@ _NewPokedexEntry: ; 41a7f call WaitBGMap call GetBaseData ld de, vTiles2 - predef Predef_GetMonFrontpic + predef GetMonFrontpic ld a, SCGB_POKEDEX call Pokedex_GetSGBLayout ld a, [CurPartySpecies] diff --git a/engine/pokegear.asm b/engine/pokegear.asm index 6f9192f19..d8fa30b54 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -2362,7 +2362,7 @@ HasVisitedSpawn: ; 91c50 ld hl, wVisitedSpawns ld b, CHECK_FLAG ld d, 0 - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction ld a, c ret @@ -2471,7 +2471,7 @@ FlyMap: ; 91c90 ; 91d11 -Predef_Pokedex_GetArea: ; 91d11 +Pokedex_GetArea: ; 91d11 ; e: Current landmark ld a, [wTownMapPlayerIconLandmark] push af diff --git a/engine/print_party.asm b/engine/print_party.asm index 28f7a7c53..819f38759 100755 --- a/engine/print_party.asm +++ b/engine/print_party.asm @@ -159,7 +159,7 @@ PrintPartyMonPage1: ; 1dc381 xor a ld [MonType], a - farcall Predef_CopyPkmnToTempMon + farcall CopyPkmnToTempMon hlcoord 0, 7 ld b, 9 ld c, 18 @@ -215,7 +215,7 @@ PrintPartyMonPage1: ; 1dc381 call Function1dc51a call Function1dc52c ld hl, TempMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter ld hl, wBoxAlignment xor a ld [hl], a @@ -243,7 +243,7 @@ PrintPartyMonPage2: ; 1dc47b call LoadFontsBattleExtra xor a ld [MonType], a - farcall Predef_CopyPkmnToTempMon + farcall CopyPkmnToTempMon hlcoord 0, 0 ld b, 15 ld c, 18 @@ -318,7 +318,7 @@ Function1dc51a: ; 1dc51a ; 1dc52c Function1dc52c: ; 1dc52c - farcall Predef_GetGender + farcall GetGender ld a, " " jr c, .got_gender ld a, "♂" diff --git a/engine/printer.asm b/engine/printer.asm index 0e0696e2b..002620606 100755 --- a/engine/printer.asm +++ b/engine/printer.asm @@ -860,7 +860,7 @@ Printer_GetMonGender: ; 8498a (21:498a) ld [CurPartyMon], a ld a, TEMPMON ld [MonType], a - farcall Predef_GetGender + farcall GetGender ld a, " " jr c, .got_gender ld a, "♂" diff --git a/engine/routines/correcterrorsinplayerparty.asm b/engine/routines/correcterrorsinplayerparty.asm index fcc2f36af..639e5c544 100644 --- a/engine/routines/correcterrorsinplayerparty.asm +++ b/engine/routines/correcterrorsinplayerparty.asm @@ -90,7 +90,7 @@ Unreferenced_CorrectErrorsInPlayerParty: ld hl, MON_STAT_EXP - 1 add hl, bc ld b, $1 - predef Predef_CalcPkmnStats + predef CalcPkmnStats pop hl ld bc, PARTYMON_STRUCT_LENGTH add hl, bc diff --git a/engine/routines/flagpredef.asm b/engine/routines/flagpredef.asm index 676960c31..2a6d91ee1 100644 --- a/engine/routines/flagpredef.asm +++ b/engine/routines/flagpredef.asm @@ -1,4 +1,4 @@ -Predef_SmallFarFlagAction: ; 4d7c1 +SmallFarFlagAction: ; 4d7c1 ; Perform action b on bit c in flag array hl. ; If checking a flag, check flag array d:hl unless d is 0. diff --git a/engine/routines/newpokedexentry.asm b/engine/routines/newpokedexentry.asm index c52188f6e..acf9fca7b 100644 --- a/engine/routines/newpokedexentry.asm +++ b/engine/routines/newpokedexentry.asm @@ -1,4 +1,4 @@ -Predef_NewPokedexEntry: ; fb877 +NewPokedexEntry: ; fb877 ld a, [hMapAnims] push af xor a diff --git a/engine/routines/placegraphic.asm b/engine/routines/placegraphic.asm index 28b69fc23..21b914950 100644 --- a/engine/routines/placegraphic.asm +++ b/engine/routines/placegraphic.asm @@ -1,7 +1,6 @@ -Predef_PlaceGraphic: ; 2ef6e +PlaceGraphic: ; 2ef6e ; Fill wBoxAlignment-aligned box width b height c ; with iterating tile starting from hGraphicStartTile at hl. -; Predef $13 ld de, SCREEN_WIDTH diff --git a/engine/routines/placewaitingtext.asm b/engine/routines/placewaitingtext.asm index 37fc2a056..9b2260722 100644 --- a/engine/routines/placewaitingtext.asm +++ b/engine/routines/placewaitingtext.asm @@ -11,7 +11,7 @@ PlaceWaitingText:: ; 4000 jr .proceed .notinbattle - predef Predef_LinkTextbox + predef LinkTextboxAtHL .proceed hlcoord 4, 11 diff --git a/engine/routines/printitemdescription.asm b/engine/routines/printitemdescription.asm index 4da061fda..e6d087dae 100644 --- a/engine/routines/printitemdescription.asm +++ b/engine/routines/printitemdescription.asm @@ -11,7 +11,7 @@ PrintItemDescription: ; 0x1c8955 pop hl ld a, [wd265] ld [CurSpecies], a - predef Predef_PrintMoveDesc + predef PrintMoveDesc ret .not_a_tm diff --git a/engine/routines/trademonfrontpic.asm b/engine/routines/trademonfrontpic.asm index 2d05a1c04..e9611553b 100644 --- a/engine/routines/trademonfrontpic.asm +++ b/engine/routines/trademonfrontpic.asm @@ -4,13 +4,13 @@ GetTrademonFrontpic: ; 4d7fd ld de, vTiles2 push de push af - predef Predef_GetUnownLetter + predef GetUnownLetter pop af ld [CurPartySpecies], a ld [CurSpecies], a call GetBaseData pop de - predef Predef_GetAnimatedFrontpic + predef GetAnimatedFrontpic ret AnimateTrademonFrontpic: ; 4d81e @@ -34,5 +34,5 @@ AnimateTrademonFrontpic: ; 4d81e hlcoord 7, 2 ld d, $0 ld e, ANIM_MON_TRADE - predef Predef_AnimateFrontpic + predef AnimateFrontpic ret diff --git a/engine/scripting.asm b/engine/scripting.asm index 5e06c2ef8..f4bd6eaad 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -1370,7 +1370,7 @@ Script_startbattle: ; script command 0x5f call BufferScreen - predef Predef_StartBattle + predef StartBattle ld a, [wBattleResult] and $3f ld [ScriptVar], a @@ -2351,7 +2351,7 @@ Script_giveegg: ld [CurPartySpecies], a call GetScriptByte ld [CurPartyLevel], a - farcall Predef_GiveEgg + farcall GiveEgg ret nc ld a, 2 ld [ScriptVar], a diff --git a/engine/sgb_layouts.asm b/engine/sgb_layouts.asm index 02055377a..ac02b2376 100644 --- a/engine/sgb_layouts.asm +++ b/engine/sgb_layouts.asm @@ -1,4 +1,4 @@ -Predef_LoadSGBLayout: ; 864c +LoadSGBLayout: ; 864c call CheckCGB jp nz, LoadSGBLayoutCGB diff --git a/engine/specials.asm b/engine/specials.asm index 03d3be19a..be1c37f88 100644 --- a/engine/specials.asm +++ b/engine/specials.asm @@ -38,7 +38,7 @@ Special_GameCornerPrizeMonCheckDex: ; c230 call FadeToMenu ld a, [ScriptVar] ld [wd265], a - farcall Predef_NewPokedexEntry + farcall NewPokedexEntry call ExitAllMenus ret ; c252 diff --git a/engine/start_menu.asm b/engine/start_menu.asm index 78de950b8..8f29b2c2d 100755 --- a/engine/start_menu.asm +++ b/engine/start_menu.asm @@ -591,7 +591,7 @@ HasNoItems: ; 129d5 TossItemFromPC: ; 129f4 push de - call Predef_PartyMonItemName + call PartyMonItemName farcall _CheckTossableItem ld a, [wItemAttributeParamBuffer] and a @@ -614,7 +614,7 @@ TossItemFromPC: ; 129f4 pop hl ld a, [CurItemQuantity] call TossItem - call Predef_PartyMonItemName + call PartyMonItemName ld hl, .TossedThisMany call MenuTextBox call ExitMenu @@ -666,7 +666,7 @@ CantUseItemText: ; 12a67 ; 12a6c -Predef_PartyMonItemName: ; 12a6c +PartyMonItemName: ; 12a6c ld a, [CurItem] ld [wd265], a call GetItemName @@ -860,7 +860,7 @@ GiveTakePartyMonItem: ; 12b60 TryGiveItemToPartymon: ; 12bd9 call SpeechTextBox - call Predef_PartyMonItemName + call PartyMonItemName call GetPartyItemLocation ld a, [hl] and a @@ -1221,7 +1221,7 @@ OpenPartyStats: ; 12e00 xor a ld [MonType], a call LowVolume - predef Predef_StatsScreenInit + predef StatsScreenInit call MaxVolume call Call_ExitMenu ld a, 0 @@ -1788,7 +1788,7 @@ SetUpMoveScreenBG: ; 13172 hlcoord 5, 1 call PlaceString push bc - farcall Predef_CopyPkmnToTempMon + farcall CopyPkmnToTempMon pop hl call PrintLevel ld hl, PlayerHPPal @@ -1805,7 +1805,7 @@ SetUpMoveList: ; 131ef ld [hBGMapMode], a ld [wMoveSwapBuffer], a ld [MonType], a - predef Predef_CopyPkmnToTempMon + predef CopyPkmnToTempMon ld hl, TempMonMoves ld de, wListMoves_MoveIndicesBuffer ld bc, NUM_MOVES @@ -1813,9 +1813,9 @@ SetUpMoveList: ; 131ef ld a, SCREEN_WIDTH * 2 ld [Buffer1], a hlcoord 2, 3 - predef Predef_ListMoves + predef ListMoves hlcoord 10, 4 - predef Predef_ListMovePP + predef ListMovePP call WaitBGMap call SetPalettes ld a, [wNumMoves] @@ -1859,7 +1859,7 @@ PlaceMoveData: ; 13256 ld a, [CurMove] ld b, a hlcoord 2, 12 - predef Predef_PrintMoveType + predef PrintMoveType ld a, [CurMove] dec a ld hl, Moves + MOVE_POWER @@ -1882,7 +1882,7 @@ PlaceMoveData: ; 13256 .description hlcoord 1, 14 - predef Predef_PrintMoveDesc + predef PrintMoveDesc ld a, $1 ld [hBGMapMode], a ret diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm index 6bceaa1e9..a1744c42d 100755 --- a/engine/stats_screen.asm +++ b/engine/stats_screen.asm @@ -7,14 +7,14 @@ NUM_STAT_PAGES EQU const_value +- 1 BattleStatsScreenInit: ; 4dc7b (13:5c7b) ld a, [wLinkMode] cp LINK_MOBILE - jr nz, Predef_StatsScreenInit + jr nz, StatsScreenInit ld a, [wBattleMode] and a - jr z, Predef_StatsScreenInit + jr z, StatsScreenInit jr _MobileStatsScreenInit -Predef_StatsScreenInit: ; 4dc8a +StatsScreenInit: ; 4dc8a ld hl, StatsScreenMain jr StatsScreenInit_gotaddress @@ -240,7 +240,7 @@ StatsScreen_CopyToTempMon: ; 4ddf2 (13:5df2) jr .done .breedmon - farcall Predef_CopyPkmnToTempMon + farcall CopyPkmnToTempMon ld a, [CurPartySpecies] cp EGG jr z, .done @@ -425,7 +425,7 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea) ld a, [hli] ld d, a ld e, [hl] - farcall Predef_ComputeHPBarPixels + farcall ComputeHPBarPixels ld hl, wCurHPPal call SetHPPal ld b, SCGB_STATS_SCREEN_HP_PALS @@ -435,7 +435,7 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea) .PlaceGenderChar: ; 4df66 (13:5f66) push hl - farcall Predef_GetGender + farcall GetGender pop hl ret c ld a, "♂" @@ -547,7 +547,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) .PinkPage: ; 4e013 (13:6013) hlcoord 0, 9 ld b, $0 - predef Predef_DrawPlayerHP + predef DrawPlayerHP hlcoord 8, 9 ld [hl], $41 ; right HP/exp bar end cap ld de, .Status_Type @@ -569,7 +569,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) hlcoord 6, 13 push hl ld de, TempMonStatus - predef Predef_PlaceStatusString + predef PlaceStatusString pop hl jr nz, .done_status jr .StatusOK @@ -583,7 +583,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) call PlaceString .done_status hlcoord 1, 15 - predef Predef_PrintMonTypes + predef PrintMonTypes hlcoord 9, 8 ld de, SCREEN_WIDTH ld b, 10 @@ -617,7 +617,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ld a, [TempMonLevel] ld b, a ld de, TempMonExp + 2 - predef Predef_FillInExpBar + predef FillInExpBar hlcoord 10, 16 ld [hl], $40 ; left exp bar end cap hlcoord 19, 16 @@ -710,11 +710,11 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) hlcoord 8, 10 ld a, SCREEN_WIDTH * 2 ld [Buffer1], a - predef Predef_ListMoves + predef ListMoves hlcoord 12, 11 ld a, SCREEN_WIDTH * 2 ld [Buffer1], a - predef Predef_ListMovePP + predef ListMovePP ret .GetItemName: ; 4e189 (13:6189) @@ -755,7 +755,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) jr nz, .BluePageVerticalDivider hlcoord 11, 8 ld bc, 6 - predef Predef_PrintTempMonStats + predef PrintTempMonStats ret .PlaceOTInfo: ; 4e1cc (13:61cc) @@ -808,7 +808,7 @@ OTString: ; 4e222 StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) ld hl, TempMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter call StatsScreen_GetAnimationParam jr c, .egg and a @@ -870,11 +870,11 @@ StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) ret c call StatsScreen_LoadTextBoxSpaceGFX ld de, vTiles2 tile $00 - predef Predef_GetAnimatedFrontpic + predef GetAnimatedFrontpic hlcoord 0, 0 ld d, $0 ld e, ANIM_MON_MENU - predef Predef_LoadMonAnimation + predef LoadMonAnimation ld hl, wcf64 set 6, [hl] ret @@ -1074,11 +1074,11 @@ StatsScreen_AnimateEgg: ; 4e497 (13:6497) ld [wBoxAlignment], a call StatsScreen_LoadTextBoxSpaceGFX ld de, vTiles2 tile $00 - predef Predef_GetAnimatedFrontpic + predef GetAnimatedFrontpic pop de hlcoord 0, 0 ld d, $0 - predef Predef_LoadMonAnimation + predef LoadMonAnimation ld hl, wcf64 set 6, [hl] ret diff --git a/engine/tempmon.asm b/engine/tempmon.asm index abd85a9ec..be989d14b 100644 --- a/engine/tempmon.asm +++ b/engine/tempmon.asm @@ -1,4 +1,4 @@ -Predef_CopyPkmnToTempMon: ; 5084a +CopyPkmnToTempMon: ; 5084a ; gets the BaseData of a Pkmn ; and copys the PkmnStructure to TempMon @@ -51,7 +51,7 @@ _TempMonStatsCalculation: ; 50893 add hl, bc push bc ld b, $1 - predef Predef_CalcPkmnStats + predef CalcPkmnStats pop bc ld hl, MON_HP add hl, bc diff --git a/engine/time_capsule_2.asm b/engine/time_capsule_2.asm index c114e6952..0378ed697 100644 --- a/engine/time_capsule_2.asm +++ b/engine/time_capsule_2.asm @@ -18,7 +18,7 @@ ConvertMon_2to1: ; fb8f1 ret ; fb908 -Predef_ConvertMon_1to2: ; fb908 +ConvertMon_1to2: ; fb908 ; Takes the Gen-1 Pokemon number stored in wd265 and returns the corresponding value from Pokered_MonIndices in wd265. push bc push hl diff --git a/engine/tmhm.asm b/engine/tmhm.asm index 11f692cb6..1cdbe1fff 100755 --- a/engine/tmhm.asm +++ b/engine/tmhm.asm @@ -1,4 +1,4 @@ -Predef_CanLearnTMHMMove: ; 11639 +CanLearnTMHMMove: ; 11639 ld a, [CurPartySpecies] ld [CurSpecies], a call GetBaseData @@ -23,7 +23,7 @@ Predef_CanLearnTMHMMove: ; 11639 ld b, CHECK_FLAG push de ld d, 0 - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction pop de ret @@ -33,7 +33,7 @@ Predef_CanLearnTMHMMove: ; 11639 ret ; 1166a -Predef_GetTMHMMove: ; 1166a +GetTMHMMove: ; 1166a ld a, [wd265] dec a ld hl, TMHMMoves diff --git a/engine/tmhm2.asm b/engine/tmhm2.asm index ddc27da07..e000ef6ba 100755 --- a/engine/tmhm2.asm +++ b/engine/tmhm2.asm @@ -38,7 +38,7 @@ ConvertCurItemIntoCurTMHM: ; 2c7a7 (b:47a7) GetTMHMItemMove: ; 2c7b6 (b:47b6) call ConvertCurItemIntoCurTMHM - predef Predef_GetTMHMMove + predef GetTMHMMove ret AskTeachTMHM: ; 2c7bf (b:47bf) @@ -118,7 +118,7 @@ ChooseMonToLearnTMHM_NoRefresh: ; 2c80a ; 2c867 TeachTMHM: ; 2c867 - predef Predef_CanLearnTMHMMove + predef CanLearnTMHMMove push bc ld a, [CurPartyMon] @@ -141,7 +141,7 @@ TeachTMHM: ; 2c867 callfar KnowsMove jr c, .nope - predef Predef_LearnMove + predef LearnMove ld a, b and a jr z, .nope @@ -258,11 +258,11 @@ TMHM_ShowTMMoveDescription: ; 2c946 (b:4946) cp NUM_TMS + NUM_HMS + 1 jr nc, TMHM_JoypadLoop ld [wd265], a - predef Predef_GetTMHMMove + predef GetTMHMMove ld a, [wd265] ld [CurSpecies], a hlcoord 1, 14 - call Predef_PrintMoveDesc + call PrintMoveDesc jp TMHM_JoypadLoop TMHM_ChooseTMorHM: ; 2c974 (b:4974) @@ -386,7 +386,7 @@ TMHM_DisplayPocketItems: ; 2c9e2 (b:49e2) pop af ld [wd265], a .okay - predef Predef_GetTMHMMove + predef GetTMHMMove ld a, [wd265] ld [wPutativeTMHMMove], a call GetMoveName @@ -451,7 +451,7 @@ Unreferenced_Function2ca95: ; 2ca95 pop hl ld bc, 3 add hl, bc - predef Predef_GetTMHMMove + predef GetTMHMMove ld a, [wd265] ld [wPutativeTMHMMove], a call GetMoveName @@ -572,7 +572,7 @@ CountTMsHMs: ; 2cb2a (b:4b2a) ld [wd265], a ret -Predef_PrintMoveDesc: ; 2cb3e +PrintMoveDesc: ; 2cb3e push hl ld hl, MoveDescriptions ld a, [CurSpecies] diff --git a/engine/trade_animation.asm b/engine/trade_animation.asm index 2ded0807a..f5e83048b 100755 --- a/engine/trade_animation.asm +++ b/engine/trade_animation.asm @@ -9,7 +9,7 @@ TRADEANIM_LEFT_ARROW EQU $ee const TRADEANIMSTATE_3 ; 3 TRADEANIMJUMPTABLE_LENGTH EQU const_value -Predef_TradeAnimation: ; 28f24 +TradeAnimation: ; 28f24 xor a ld [wcf66], a ld hl, wPlayerTrademonSenderName @@ -60,7 +60,7 @@ Predef_TradeAnimation: ; 28f24 tradeanim_scroll_out_right tradeanim_end -Predef_TradeAnimationPlayer2: ; 28f63 +TradeAnimationPlayer2: ; 28f63 xor a ld [wcf66], a ld hl, wOTTrademonSenderName @@ -883,13 +883,13 @@ TradeAnim_AnimateFrontpic: ; 29487 TradeAnim_GetFrontpic: ; 29491 push de push af - predef Predef_GetUnownLetter + predef GetUnownLetter pop af ld [CurPartySpecies], a ld [CurSpecies], a call GetBaseData pop de - predef Predef_GetMonFrontpic + predef GetMonFrontpic ret ; 294a9 @@ -923,7 +923,7 @@ TradeAnim_ShowFrontpic: ; 294c3 xor a ld [hGraphicStartTile], a lb bc, 7, 7 - predef Predef_PlaceGraphic + predef PlaceGraphic call WaitBGMap ret diff --git a/engine/trainer_card.asm b/engine/trainer_card.asm index c80553ecd..6d59660f7 100755 --- a/engine/trainer_card.asm +++ b/engine/trainer_card.asm @@ -254,7 +254,7 @@ TrainerCard_PrintTopHalfOfCard: ; 25299 (9:5299) lb bc, 5, 7 xor a ld [hGraphicStartTile], a - predef Predef_PlaceGraphic + predef PlaceGraphic ret ; 252ec (9:52ec) diff --git a/engine/types.asm b/engine/types.asm index 0cd52eda7..ade1aaa4a 100644 --- a/engine/types.asm +++ b/engine/types.asm @@ -1,4 +1,4 @@ -Predef_PrintMonTypes: ; 5090d +PrintMonTypes: ; 5090d ; Print one or both types of [CurSpecies] ; on the stats screen at hl. @@ -24,7 +24,7 @@ Predef_PrintMonTypes: ; 5090d .Print: ld b, a - jr Predef_PrintType + jr PrintType .hide_type_2 ; Erase any type name that was here before. @@ -40,7 +40,7 @@ Predef_PrintMonTypes: ; 5090d ; 5093a -Predef_PrintMoveType: ; 5093a +PrintMoveType: ; 5093a ; Print the type of move b at hl. push hl @@ -58,7 +58,7 @@ Predef_PrintMoveType: ; 5093a ld b, a -Predef_PrintType: ; 50953 +PrintType: ; 50953 ; Print type b at hl. ld a, b @@ -78,7 +78,7 @@ Predef_PrintType: ; 50953 ; 50964 -Predef_GetTypeName: ; 50964 +GetTypeName: ; 50964 ; Copy the name of type [wd265] to StringBuffer1. ld a, [wd265] -- cgit v1.2.3 From 7b3de85a06e81d14ac0c73e8f9e1ab8e4a474beb Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 16 Jan 2018 17:27:50 -0500 Subject: Avoid "+- 1" at every maskbits --- engine/battle/ai/move.asm | 2 +- engine/battle/battle_transition.asm | 2 +- engine/battle/core.asm | 2 +- engine/battle/effect_commands.asm | 6 +++--- engine/battle_anims/anim_commands.asm | 4 ++-- engine/color.asm | 6 +++--- engine/events/battle_tower/load_trainer.asm | 6 +++--- engine/events/buena.asm | 2 +- engine/events/fish.asm | 2 +- engine/events/magnet_train.asm | 2 +- engine/events/poisonstep_pals.asm | 2 +- engine/item_effects.asm | 2 +- engine/load_font.asm | 2 +- engine/map_objects.asm | 2 +- engine/npc_movement.asm | 6 +++--- engine/pack.asm | 8 ++++---- engine/player_movement.asm | 8 ++++---- engine/player_object.asm | 2 +- engine/pokedex_2.asm | 2 +- engine/pokegear.asm | 4 ++-- engine/radio.asm | 18 +++++++++--------- engine/scripting.asm | 4 ++-- engine/stats_screen.asm | 8 ++++---- engine/trade_animation.asm | 2 +- engine/unown_puzzle.asm | 2 +- engine/wildmons.asm | 10 +++++----- 26 files changed, 58 insertions(+), 58 deletions(-) (limited to 'engine') diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm index 27a8ad5a5..7ccb20972 100755 --- a/engine/battle/ai/move.asm +++ b/engine/battle/ai/move.asm @@ -186,7 +186,7 @@ AIChooseMove: ; 440ce .ChooseMove: ld hl, Buffer1 call Random - maskbits NUM_MOVES +- 1 + maskbits NUM_MOVES ld c, a ld b, 0 add hl, bc diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 1409ddc37..452339e81 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -640,7 +640,7 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) .cgb ld hl, .daypals ld a, [TimeOfDayPal] - maskbits NUM_DAYTIMES +- 1 + maskbits NUM_DAYTIMES cp DARKNESS_F jr nz, .daytime ld hl, .nightpals diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 5d79f5fd5..e1c5f331f 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -6031,7 +6031,7 @@ ParseEnemyAction: ; 3e7c1 .loop2 ld hl, EnemyMonMoves call BattleRandom - maskbits NUM_MOVES +- 1 + maskbits NUM_MOVES ld c, a ld b, 0 add hl, bc diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index 801ce211e..c1bc3752a 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -932,7 +932,7 @@ BattleCommand_CheckObedience: ; 343db .RandomMove: call BattleRandom - maskbits NUM_MOVES +- 1 + maskbits NUM_MOVES cp b jr nc, .RandomMove @@ -4387,7 +4387,7 @@ BattleCommand_SleepTalk: ; 35b33 .sample_move push hl call BattleRandom - maskbits NUM_MOVES +- 1 + maskbits NUM_MOVES ld c, a ld b, 0 add hl, bc @@ -8204,7 +8204,7 @@ BattleCommand_Conversion: ; 3707f .done .loop3 call BattleRandom - maskbits NUM_MOVES +- 1 + maskbits NUM_MOVES ld c, a ld b, 0 ld hl, StringBuffer1 diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index d19e7210a..07ab82d95 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -1206,7 +1206,7 @@ BattleAnimCmd_Sound: ; cc7cd (33:47cd) srl a ld [wSFXDuration], a call .GetCryTrack - maskbits NUM_NOISE_CHANS +- 1 + maskbits NUM_NOISE_CHANS ld [CryTracks], a ; CryTracks ld e, a @@ -1243,7 +1243,7 @@ BattleAnimCmd_Sound: ; cc7cd (33:47cd) BattleAnimCmd_Cry: ; cc807 (33:4807) call GetBattleAnimByte - maskbits NUM_NOISE_CHANS +- 1 + maskbits NUM_NOISE_CHANS ld e, a ld d, 0 ld hl, .CryData diff --git a/engine/color.asm b/engine/color.asm index b95d0a2f4..cc12ffaf8 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -1230,7 +1230,7 @@ LoadMapPals: ld l, a ; Futher refine by time of day ld a, [TimeOfDayPal] - maskbits NUM_DAYTIMES +- 1 + maskbits NUM_DAYTIMES add a add a add a @@ -1276,7 +1276,7 @@ LoadMapPals: .got_pals ld a, [TimeOfDayPal] - maskbits NUM_DAYTIMES +- 1 + maskbits NUM_DAYTIMES ld bc, 8 palettes ld hl, MapObjectPals call AddNTimes @@ -1300,7 +1300,7 @@ LoadMapPals: ld de, RoofPals add hl, de ld a, [TimeOfDayPal] - maskbits NUM_DAYTIMES +- 1 + maskbits NUM_DAYTIMES cp NITE_F jr c, .morn_day rept 4 diff --git a/engine/events/battle_tower/load_trainer.asm b/engine/events/battle_tower/load_trainer.asm index 006e0afa3..7c229219f 100644 --- a/engine/events/battle_tower/load_trainer.asm +++ b/engine/events/battle_tower/load_trainer.asm @@ -27,12 +27,12 @@ Function_LoadOpponentTrainerAndPokemons: ; 1f8000 add b ld b, a ; b contains the nr of the trainer if DEF(_CRYSTAL11) - maskbits BATTLETOWER_NUM_UNIQUE_TRAINERS +- 1 + maskbits BATTLETOWER_NUM_UNIQUE_TRAINERS cp BATTLETOWER_NUM_UNIQUE_TRAINERS else ; Crystal 1.0 used the wrong constant here, so only the first 21 ; trainers in BattleTowerTrainers can be sampled. - maskbits BATTLETOWER_NUM_UNIQUE_PKMN +- 1 + maskbits BATTLETOWER_NUM_UNIQUE_PKMN cp BATTLETOWER_NUM_UNIQUE_PKMN endc jr nc, .resample @@ -115,7 +115,7 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081 ld a, [hRandomAdd] add b ld b, a - maskbits BATTLETOWER_NUM_UNIQUE_PKMN +- 1 + maskbits BATTLETOWER_NUM_UNIQUE_PKMN cp BATTLETOWER_NUM_UNIQUE_PKMN jr nc, .resample ; in register 'a' is the chosen Pkmn of the LevelGroup diff --git a/engine/events/buena.asm b/engine/events/buena.asm index cd0ecc98d..d5a80ef2e 100644 --- a/engine/events/buena.asm +++ b/engine/events/buena.asm @@ -17,7 +17,7 @@ Special_BuenasPassword: ; 8af6b ld a, [MenuSelection] ld c, a ld a, [wBuenasPassword] - maskbits NUM_PASSWORDS_PER_CATEGORY +- 1 + maskbits NUM_PASSWORDS_PER_CATEGORY cp c jr nz, .wrong ld b, $1 diff --git a/engine/events/fish.asm b/engine/events/fish.asm index 05bd7f530..39644847d 100644 --- a/engine/events/fish.asm +++ b/engine/events/fish.asm @@ -80,7 +80,7 @@ rept 4 endr ld a, [TimeOfDay] - maskbits NUM_DAYTIMES +- 1 + maskbits NUM_DAYTIMES cp NITE_F jr c, .time_species inc hl diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm index c2ff36135..232372dbd 100755 --- a/engine/events/magnet_train.asm +++ b/engine/events/magnet_train.asm @@ -435,7 +435,7 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae ld a, [wEnvironment] push af ld a, [TimeOfDay] - maskbits NUM_DAYTIMES +- 1 + maskbits NUM_DAYTIMES ld [TimeOfDayPal], a ld a, $1 ld [wEnvironment], a diff --git a/engine/events/poisonstep_pals.asm b/engine/events/poisonstep_pals.asm index c0d4c5ace..5b5b642ce 100644 --- a/engine/events/poisonstep_pals.asm +++ b/engine/events/poisonstep_pals.asm @@ -10,7 +10,7 @@ LoadPoisonBGPals: ; cbcdd and a jr nz, .cgb ld a, [TimeOfDayPal] - maskbits NUM_DAYTIMES +- 1 + maskbits NUM_DAYTIMES cp DARKNESS_F ld a, %00000000 jr z, .convert_pals diff --git a/engine/item_effects.asm b/engine/item_effects.asm index b072d9e1a..29815a56e 100644 --- a/engine/item_effects.asm +++ b/engine/item_effects.asm @@ -775,7 +775,7 @@ GetPokedexEntryBank: ld a, [EnemyMonSpecies] rlca rlca - maskbits NUM_DEX_ENTRY_BANKS +- 1 + maskbits NUM_DEX_ENTRY_BANKS ld hl, .PokedexEntryBanks ld d, 0 ld e, a diff --git a/engine/load_font.asm b/engine/load_font.asm index 347a85746..af64b69f6 100644 --- a/engine/load_font.asm +++ b/engine/load_font.asm @@ -82,7 +82,7 @@ _LoadFontsBattleExtra:: ; fb4be LoadFrame: ; fb4cc ld a, [TextBoxFrame] - maskbits NUM_FRAMES +- 1 + maskbits NUM_FRAMES ld bc, 6 * LEN_1BPP_TILE ld hl, Frames call AddNTimes diff --git a/engine/map_objects.asm b/engine/map_objects.asm index 0f04a0a16..5899ba49d 100644 --- a/engine/map_objects.asm +++ b/engine/map_objects.asm @@ -893,7 +893,7 @@ MapObjectMovementPattern: ; 47dd ld hl, OBJECT_DIRECTION_WALKING add hl, de ld a, [hl] - maskbits NUM_DIRECTIONS +- 1 + maskbits NUM_DIRECTIONS ld d, 1 * 8 + 6 cp DOWN jr z, .ok_13 diff --git a/engine/npc_movement.asm b/engine/npc_movement.asm index 71583408e..e8b353fa6 100755 --- a/engine/npc_movement.asm +++ b/engine/npc_movement.asm @@ -106,7 +106,7 @@ Function6f3e: ; 6f3e ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld a, [hl] - maskbits NUM_DIRECTIONS +- 1 + maskbits NUM_DIRECTIONS ld e, a ld d, 0 ld hl, .data_6f5b @@ -131,7 +131,7 @@ Function6f5f: ; 6f5f push af ld hl, OBJECT_DIRECTION_WALKING add hl, bc - maskbits NUM_DIRECTIONS +- 1 + maskbits NUM_DIRECTIONS ld e, a ld d, 0 ld hl, .data_6f7b @@ -178,7 +178,7 @@ Function6fa1: ; 6fa1 ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld a, [hl] - maskbits NUM_DIRECTIONS +- 1 + maskbits NUM_DIRECTIONS jr z, .down dec a jr z, .up diff --git a/engine/pack.asm b/engine/pack.asm index c013994a0..1d9f4e70b 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -954,7 +954,7 @@ InitPackBuffers: ; 1068a ld [wJumptableIndex], a ; pocket id -> jumptable index ld a, [wLastPocket] - maskbits NUM_POCKETS +- 1 + maskbits NUM_POCKETS ld [wCurrPocket], a inc a add a @@ -1099,7 +1099,7 @@ DepositSellTutorial_InterpretJoypad: ; 1076f .d_left ld a, [wJumptableIndex] dec a - maskbits NUM_POCKETS +- 1 + maskbits NUM_POCKETS ld [wJumptableIndex], a push de ld de, SFX_SWITCH_POCKETS @@ -1111,7 +1111,7 @@ DepositSellTutorial_InterpretJoypad: ; 1076f .d_right ld a, [wJumptableIndex] inc a - maskbits NUM_POCKETS +- 1 + maskbits NUM_POCKETS ld [wJumptableIndex], a push de ld de, SFX_SWITCH_POCKETS @@ -1281,7 +1281,7 @@ WaitBGMap_DrawPackGFX: ; 1089a (4:489a) call WaitBGMap DrawPackGFX: ; 1089d ld a, [wCurrPocket] - maskbits NUM_POCKETS +- 1 + maskbits NUM_POCKETS ld e, a ld d, $0 ld a, [BattleType] diff --git a/engine/player_movement.asm b/engine/player_movement.asm index e475bf6a4..d6d10aea1 100755 --- a/engine/player_movement.asm +++ b/engine/player_movement.asm @@ -140,7 +140,7 @@ DoPlayerMovement:: ; 80000 .water ld a, c - maskbits NUM_DIRECTIONS +- 1 + maskbits NUM_DIRECTIONS ld c, a ld b, 0 ld hl, .water_table @@ -244,7 +244,7 @@ DoPlayerMovement:: ; 80000 ld a, [PlayerDirection] rrca rrca - maskbits NUM_DIRECTIONS +- 1 + maskbits NUM_DIRECTIONS cp e jr z, .not_turning @@ -430,7 +430,7 @@ DoPlayerMovement:: ; 80000 ld a, [PlayerDirection] rrca rrca - maskbits NUM_DIRECTIONS +- 1 + maskbits NUM_DIRECTIONS cp e jr nz, .not_warp call WarpCheck @@ -559,7 +559,7 @@ DoPlayerMovement:: ; 80000 cp 0 ret z - maskbits NUM_DIRECTIONS +- 1 + maskbits NUM_DIRECTIONS ld e, a ld d, 0 ld hl, .forced_dpad diff --git a/engine/player_object.asm b/engine/player_object.asm index 50cabadf6..b630078a2 100755 --- a/engine/player_object.asm +++ b/engine/player_object.asm @@ -589,7 +589,7 @@ Special_SurfStartStep: ; 8379 ld a, [PlayerDirection] srl a srl a - maskbits NUM_DIRECTIONS +- 1 + maskbits NUM_DIRECTIONS ld e, a ld d, 0 ld hl, .movement_data diff --git a/engine/pokedex_2.asm b/engine/pokedex_2.asm index 4a5a08803..3831d2ae9 100644 --- a/engine/pokedex_2.asm +++ b/engine/pokedex_2.asm @@ -230,7 +230,7 @@ GetDexEntryPointer: ; 44333 push de rlca rlca - maskbits NUM_DEX_ENTRY_BANKS +- 1 + maskbits NUM_DEX_ENTRY_BANKS ld hl, .PokedexEntryBanks ld d, 0 ld e, a diff --git a/engine/pokegear.asm b/engine/pokegear.asm index d8fa30b54..37640311e 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -251,7 +251,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8) ld a, $4f call ByteFill ld a, [wPokegearCard] - maskbits NUM_POKEGEAR_CARDS +- 1 + maskbits NUM_POKEGEAR_CARDS add a ld e, a ld d, 0 @@ -289,7 +289,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8) ld [hWY], a ; swap region maps ld a, [wPokegearMapRegion] - maskbits NUM_REGIONS +- 1 + maskbits NUM_REGIONS xor 1 ld [wPokegearMapRegion], a ret diff --git a/engine/radio.asm b/engine/radio.asm index de19a289c..bfc95404e 100644 --- a/engine/radio.asm +++ b/engine/radio.asm @@ -247,7 +247,7 @@ endr ; Generate a number, either 0, 1, or 2, to choose a time of day. .loop2 call Random - maskbits NUM_DAYTIMES +- 1 + maskbits NUM_DAYTIMES cp DARKNESS_F jr z, .loop2 @@ -351,7 +351,7 @@ OaksPkmnTalk8: ; 0-15 are all valid indexes into .Adverbs, ; so no need for a retry loop call Random - maskbits NUM_OAKS_MON_TALK_ADVERBS +- 1 + maskbits NUM_OAKS_MON_TALK_ADVERBS ld e, a ld d, 0 ld hl, .Adverbs @@ -466,7 +466,7 @@ OaksPkmnTalk9: ; 0-15 are all valid indexes into .Adjectives, ; so no need for a retry loop call Random - maskbits NUM_OAKS_MON_TALK_ADJECTIVES +- 1 + maskbits NUM_OAKS_MON_TALK_ADJECTIVES ld e, a ld d, 0 ld hl, .Adjectives @@ -692,7 +692,7 @@ PokedexShow_GetDexEntryBank: dec a rlca rlca - maskbits NUM_DEX_ENTRY_BANKS +- 1 + maskbits NUM_DEX_ENTRY_BANKS ld hl, .PokedexEntryBanks ld d, 0 ld e, a @@ -1164,7 +1164,7 @@ PnP_Text3: PeoplePlaces4: ; People call Random - maskbits NUM_TRAINER_CLASSES +- 1 + maskbits NUM_TRAINER_CLASSES inc a cp NUM_TRAINER_CLASSES - 1 jr nc, PeoplePlaces4 @@ -1208,7 +1208,7 @@ PeoplePlaces5: ; 0-15 are all valid indexes into .Adjectives, ; so no need for a retry loop call Random - maskbits NUM_PNP_PEOPLE_ADJECTIVES +- 1 + maskbits NUM_PNP_PEOPLE_ADJECTIVES ld e, a ld d, 0 ld hl, .Adjectives @@ -1358,7 +1358,7 @@ PeoplePlaces7: ; 0-15 are all valid indexes into .Adjectives, ; so no need for a retry loop call Random - maskbits NUM_PNP_PLACES_ADJECTIVES +- 1 + maskbits NUM_PNP_PLACES_ADJECTIVES ld e, a ld d, 0 ld hl, .Adjectives @@ -1565,7 +1565,7 @@ BuenasPassword4: ; There are only 11 groups to choose from. .greater_than_11 call Random - maskbits NUM_PASSWORD_CATEGORIES +- 1 + maskbits NUM_PASSWORD_CATEGORIES cp NUM_PASSWORD_CATEGORIES jr nc, .greater_than_11 ; Store it in the high nybble of e. @@ -1574,7 +1574,7 @@ BuenasPassword4: ; For each group, choose one of the three passwords. .greater_than_three call Random - maskbits NUM_PASSWORDS_PER_CATEGORY +- 1 + maskbits NUM_PASSWORDS_PER_CATEGORY cp NUM_PASSWORDS_PER_CATEGORY jr nc, .greater_than_three ; The high nybble of wBuenasPassword will now contain the password group index, and the low nybble contains the actual password. diff --git a/engine/scripting.asm b/engine/scripting.asm index f4bd6eaad..87415135d 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -614,7 +614,7 @@ GetPocketName: ld a, [wItemAttributeParamBuffer] dec a ld hl, .Pockets - maskbits NUM_POCKETS +- 1 + maskbits NUM_POCKETS add a ld e, a ld d, 0 @@ -2474,7 +2474,7 @@ Script_warpfacing: ; parameters: facing, map_group, map_id, x, y call GetScriptByte - maskbits NUM_DIRECTIONS +- 1 + maskbits NUM_DIRECTIONS ld c, a ld a, [wPlayerSpriteSetupFlags] set 5, a diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm index a1744c42d..1e3fb8a77 100755 --- a/engine/stats_screen.asm +++ b/engine/stats_screen.asm @@ -283,7 +283,7 @@ StatsScreen_GetJoypad: ; 4de2c (13:5e2c) StatsScreen_JoypadAction: ; 4de54 (13:5e54) push af ld a, [wcf64] - maskbits NUM_STAT_PAGES +- 1 + maskbits NUM_STAT_PAGES ld c, a pop af bit B_BUTTON_F, a @@ -512,7 +512,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) .ClearBox: ; 4dfda (13:5fda) ld a, [wcf64] - maskbits NUM_STAT_PAGES +- 1 + maskbits NUM_STAT_PAGES ld c, a call StatsScreen_LoadPageIndicators hlcoord 0, 8 @@ -522,7 +522,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) .LoadPals: ; 4dfed (13:5fed) ld a, [wcf64] - maskbits NUM_STAT_PAGES +- 1 + maskbits NUM_STAT_PAGES ld c, a farcall LoadStatsScreenPals call DelayFrame @@ -532,7 +532,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) .PageTilemap: ; 4e002 (13:6002) ld a, [wcf64] - maskbits NUM_STAT_PAGES +- 1 + maskbits NUM_STAT_PAGES dec a ld hl, .Jumptable rst JumpTable diff --git a/engine/trade_animation.asm b/engine/trade_animation.asm index f5e83048b..08b30b132 100755 --- a/engine/trade_animation.asm +++ b/engine/trade_animation.asm @@ -552,7 +552,7 @@ TradeAnim_GetTrademonSFX: ; 29277 ; 29281 TradeAnim_TubeAnimJumptable: ; 29281 - maskbits TRADEANIMJUMPTABLE_LENGTH +- 1 + maskbits TRADEANIMJUMPTABLE_LENGTH ld e, a ld d, 0 ld hl, .Jumptable diff --git a/engine/unown_puzzle.asm b/engine/unown_puzzle.asm index 429bfaefd..8a032db42 100755 --- a/engine/unown_puzzle.asm +++ b/engine/unown_puzzle.asm @@ -835,7 +835,7 @@ INCBIN "gfx/unown_puzzle/tile_borders.2bpp" LoadUnownPuzzlePiecesGFX: ; e17a3 ld a, [ScriptVar] - maskbits NUM_UNOWN_PUZZLES +- 1 + maskbits NUM_UNOWN_PUZZLES ld e, a ld d, 0 ld hl, .LZPointers diff --git a/engine/wildmons.asm b/engine/wildmons.asm index 287ffe6ac..1425c7636 100755 --- a/engine/wildmons.asm +++ b/engine/wildmons.asm @@ -739,11 +739,11 @@ JumpRoamMons: ; 2a394 JumpRoamMon: ; 2a3cd .loop ld hl, RoamMaps -.innerloop1 ; This loop is completely unnecessary. - call Random ; Choose a random number. - maskbits $10 - 1 ; Mask the number to limit it between 0 and 15. - cp $10 ; If the number is not less than 16, try again. - jr nc, .innerloop1 ; I'm sure you can guess why this check is bogus. +.innerloop1 ; This loop happens to be unnecessary. + call Random ; Choose a random number. + maskbits NUM_ROAMMON_MAPS ; Mask the number to limit it between 0 and 15. + cp NUM_ROAMMON_MAPS ; If the number is not less than 16, try again. + jr nc, .innerloop1 ; I'm sure you can guess why this check is bogus. inc a ld b, a .innerloop2 ; Loop to get hl to the address of the chosen roam map. -- cgit v1.2.3 From 50ce0a219ef291099aa3aa43a177bcea2807d97b Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 16 Jan 2018 17:36:12 -0500 Subject: Fewer hard-coded values --- engine/wildmons.asm | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'engine') diff --git a/engine/wildmons.asm b/engine/wildmons.asm index 1425c7636..6634d7586 100755 --- a/engine/wildmons.asm +++ b/engine/wildmons.asm @@ -212,7 +212,7 @@ TryWildEncounter:: ; 2a0e7 GetMapEncounterRate: ; 2a111 ld hl, wMornEncounterRate call CheckOnWater - ld a, 3 + ld a, wWaterEncounterRate - wMornEncounterRate jr z, .ok ld a, [TimeOfDay] .ok @@ -571,7 +571,7 @@ CheckEncounterRoamMon: ; 2a2ce ld hl, wRoamMon1MapGroup ld c, a ld b, 0 - ld a, 7 ; length of the RoamMon struct + ld a, 7 ; length of the roam_struct call AddNTimes ld a, d cp [hl] @@ -821,7 +821,7 @@ Special_RandomUnseenWildMon: ; 2a4ab ld bc, 5 + 4 * 2 ; Location of the level of the 5th wild Pokemon in that map add hl, bc ld a, [TimeOfDay] - ld bc, 7 * 2 + ld bc, NUM_GRASSMON * 2 call AddNTimes .randloop1 call Random @@ -893,7 +893,7 @@ Special_RandomPhoneWildMon: ; 2a51f add hl, bc ld a, [TimeOfDay] inc a - ld bc, 7 * 2 + ld bc, NUM_GRASSMON * 2 .loop dec a jr z, .done @@ -952,16 +952,17 @@ Special_RandomPhoneMon: ; 2a567 ld a, BANK(Trainers) call GetFarByte inc hl - ld bc, 2 - cp 0 + ld bc, 2 ; level, species + cp TRAINERTYPE_NORMAL jr z, .got_mon_length - ld bc, 2 + NUM_MOVES - cp 1 + ld bc, 2 + NUM_MOVES ; level, species, moves + cp TRAINERTYPE_MOVES jr z, .got_mon_length - ld bc, 2 + 1 - cp 2 + ld bc, 2 + 1 ; level, species, item + cp TRAINERTYPE_ITEM jr z, .got_mon_length - ld bc, 2 + 1 + NUM_MOVES + ; TRAINERTYPE_ITEM_MOVES + ld bc, 2 + 1 + NUM_MOVES ; level, species, item, moves .got_mon_length ld e, 0 @@ -977,7 +978,7 @@ Special_RandomPhoneMon: ; 2a567 .rand call Random - and 7 + maskbits PARTY_LENGTH cp e jr nc, .rand -- cgit v1.2.3 From 5407d8de920b779d760d88153d8e314a687d100e Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 16 Jan 2018 17:59:05 -0500 Subject: =?UTF-8?q?Cleaner=20Pok=C3=A9dex=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/crystal_colors.asm | 1 - engine/pokedex.asm | 100 +++++++++++++++++++----------------- engine/pokedex_2.asm | 2 +- engine/routines/getsquareroot.asm | 14 ++--- engine/routines/newpokedexentry.asm | 6 +-- 5 files changed, 64 insertions(+), 59 deletions(-) (limited to 'engine') diff --git a/engine/crystal_colors.asm b/engine/crystal_colors.asm index 31344791e..9fd01aac0 100755 --- a/engine/crystal_colors.asm +++ b/engine/crystal_colors.asm @@ -23,7 +23,6 @@ GetMysteryGift_MobileAdapterLayout: ; 4930f (mobile) ; 49330 (12:5330) .dw ; 49330 - dw MG_Mobile_Layout00 dw MG_Mobile_Layout01 dw MG_Mobile_Layout02 diff --git a/engine/pokedex.asm b/engine/pokedex.asm index a68794f9f..4c257e424 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -15,6 +15,9 @@ const DEXSTATE_UPDATE_UNOWN_MODE const DEXSTATE_EXIT +POKDEX_SCX EQU 5 +GLOBAL POKDEX_SCX + Pokedex: ; 40000 ld a, [hWX] @@ -230,7 +233,7 @@ Pokedex_InitMainScreen: ; 4013c (10:413c) call Pokedex_SetBGMapMode_3ifDMG_4ifCGB call Pokedex_ResetBGMapMode call Pokedex_DrawMainScreenBG - ld a, $5 + ld a, POKDEX_SCX ld [hSCX], a ld a, [wCurrentDexMode] @@ -323,7 +326,7 @@ Pokedex_UpdateMainScreen: ; 401ae (10:41ae) Pokedex_InitDexEntryScreen: ; 40217 (10:4217) call LowVolume - xor a + xor a ; page 1 ld [wPokedexStatus], a xor a ld [hBGMapMode], a @@ -383,7 +386,7 @@ Pokedex_UpdateDexEntryScreen: ; 40258 (10:4258) Pokedex_Page: ; 40292 ld a, [wPokedexStatus] - xor $1 + xor 1 ; toggle page ld [wPokedexStatus], a call Pokedex_GetSelectedMon ld [wPrevDexEntry], a @@ -394,7 +397,7 @@ Pokedex_Page: ; 40292 Pokedex_ReinitDexEntryScreen: ; 402aa (10:42aa) ; Reinitialize the Pokédex entry screen after changing the selected mon. call Pokedex_BlackOutBG - xor a + xor a ; page 1 ld [wPokedexStatus], a xor a ld [hBGMapMode], a @@ -419,10 +422,10 @@ Pokedex_ReinitDexEntryScreen: ; 402aa (10:42aa) DexEntryScreen_ArrowCursorData: ; 402e8 db D_RIGHT | D_LEFT, 4 - dwcoord 1, 17 - dwcoord 6, 17 - dwcoord 11, 17 - dwcoord 15, 17 + dwcoord 1, 17 ; PAGE + dwcoord 6, 17 ; AREA + dwcoord 11, 17 ; CRY + dwcoord 15, 17 ; PRNT DexEntryScreen_MenuActionJumptable: ; 402f2 @@ -450,7 +453,7 @@ DexEntryScreen_MenuActionJumptable: ; 402f2 ld [hBGMapMode], a ld a, $90 ld [hWY], a - ld a, $5 + ld a, POKDEX_SCX ld [hSCX], a call DelayFrame call Pokedex_RedisplayDexEntry @@ -494,7 +497,7 @@ DexEntryScreen_MenuActionJumptable: ; 402f2 call Pokedex_RedisplayDexEntry call EnableLCD call WaitBGMap - ld a, $5 + ld a, POKDEX_SCX ld [hSCX], a call Pokedex_ApplyUsualPals ret @@ -555,16 +558,16 @@ Pokedex_UpdateOptionScreen: ; 403be (10:43be) .NoUnownModeArrowCursorData: ; 403f3 db D_UP | D_DOWN, 3 - dwcoord 2, 4 - dwcoord 2, 6 - dwcoord 2, 8 + dwcoord 2, 4 ; NEW + dwcoord 2, 6 ; OLD + dwcoord 2, 8 ; ABC .ArrowCursorData: ; 403fb db D_UP | D_DOWN, 4 - dwcoord 2, 4 - dwcoord 2, 6 - dwcoord 2, 8 - dwcoord 2, 10 + dwcoord 2, 4 ; NEW + dwcoord 2, 6 ; OLD + dwcoord 2, 8 ; ABC + dwcoord 2, 10 ; UNOWN .MenuActionJumptable: ; 40405 (10:4405) dw .MenuAction_NewMode @@ -657,10 +660,10 @@ Pokedex_UpdateSearchScreen: ; 40471 (10:4471) .ArrowCursorData: ; 4049e db D_UP | D_DOWN, 4 - dwcoord 2, 4 - dwcoord 2, 6 - dwcoord 2, 13 - dwcoord 2, 15 + dwcoord 2, 4 ; TYPE 1 + dwcoord 2, 6 ; TYPE 2 + dwcoord 2, 13 ; BEGIN SEARCH + dwcoord 2, 15 ; CANCEL .MenuActionJumptable: ; 404a8 dw .MenuAction_MonSearchType @@ -730,7 +733,7 @@ Pokedex_InitSearchResultsScreen: ; 4050a (10:450a) call Pokedex_SetBGMapMode3 call Pokedex_ResetBGMapMode call Pokedex_DrawSearchResultsScreenBG - ld a, $5 + ld a, POKDEX_SCX ld [hSCX], a ld a, $4a ld [hWX], a @@ -1345,33 +1348,34 @@ endr ret UnownModeLetterAndCursorCoords: ; 40a3e +; entries correspond to Unown forms ; letter, cursor - dwcoord 4,11, 3,11 - dwcoord 4,10, 3,10 - dwcoord 4, 9, 3, 9 - dwcoord 4, 8, 3, 8 - dwcoord 4, 7, 3, 7 - dwcoord 4, 6, 3, 6 - dwcoord 4, 5, 3, 5 - dwcoord 4, 4, 3, 4 - dwcoord 4, 3, 3, 2 - dwcoord 5, 3, 5, 2 - dwcoord 6, 3, 6, 2 - dwcoord 7, 3, 7, 2 - dwcoord 8, 3, 8, 2 - dwcoord 9, 3, 9, 2 - dwcoord 10, 3, 10, 2 - dwcoord 11, 3, 11, 2 - dwcoord 12, 3, 12, 2 - dwcoord 13, 3, 13, 2 - dwcoord 14, 3, 15, 2 - dwcoord 14, 4, 15, 4 - dwcoord 14, 5, 15, 5 - dwcoord 14, 6, 15, 6 - dwcoord 14, 7, 15, 7 - dwcoord 14, 8, 15, 8 - dwcoord 14, 9, 15, 9 - dwcoord 14,10, 15,10 + dwcoord 4,11, 3,11 ; A + dwcoord 4,10, 3,10 ; B + dwcoord 4, 9, 3, 9 ; C + dwcoord 4, 8, 3, 8 ; D + dwcoord 4, 7, 3, 7 ; E + dwcoord 4, 6, 3, 6 ; F + dwcoord 4, 5, 3, 5 ; G + dwcoord 4, 4, 3, 4 ; H + dwcoord 4, 3, 3, 2 ; I + dwcoord 5, 3, 5, 2 ; J + dwcoord 6, 3, 6, 2 ; K + dwcoord 7, 3, 7, 2 ; L + dwcoord 8, 3, 8, 2 ; M + dwcoord 9, 3, 9, 2 ; N + dwcoord 10, 3, 10, 2 ; O + dwcoord 11, 3, 11, 2 ; P + dwcoord 12, 3, 12, 2 ; Q + dwcoord 13, 3, 13, 2 ; R + dwcoord 14, 3, 15, 2 ; S + dwcoord 14, 4, 15, 4 ; T + dwcoord 14, 5, 15, 5 ; U + dwcoord 14, 6, 15, 6 ; V + dwcoord 14, 7, 15, 7 ; W + dwcoord 14, 8, 15, 8 ; X + dwcoord 14, 9, 15, 9 ; Y + dwcoord 14,10, 15,10 ; Z Pokedex_FillBackgroundColor2: ; 40aa6 hlcoord 0, 0 diff --git a/engine/pokedex_2.asm b/engine/pokedex_2.asm index 3831d2ae9..4dd608ac0 100644 --- a/engine/pokedex_2.asm +++ b/engine/pokedex_2.asm @@ -182,7 +182,7 @@ DisplayDexEntry: ; 4424d call FarString pop bc ld a, [wPokedexStatus] - or a + or a ; check for page 2 ret z ; Page 2 diff --git a/engine/routines/getsquareroot.asm b/engine/routines/getsquareroot.asm index 0ba2e50a5..412fd04ff 100644 --- a/engine/routines/getsquareroot.asm +++ b/engine/routines/getsquareroot.asm @@ -1,3 +1,5 @@ +NUM_SQUARE_ROOTS EQU 255 + GetSquareRoot: ; 13b87 ; Return the square root of de in b. @@ -10,7 +12,7 @@ GetSquareRoot: ; 13b87 ; Make sure we don't go past the end of the table. inc b ld a, b - cp $ff + cp NUM_SQUARE_ROOTS ret z ; Iterate over the table until b**2 >= de. @@ -23,8 +25,8 @@ GetSquareRoot: ; 13b87 ret .Squares: ; 13b98 -root = 1 - rept $ff - dw root * root -root = root + 1 - endr +x = 1 +rept NUM_SQUARE_ROOTS + dw x * x +x = x + 1 +endr diff --git a/engine/routines/newpokedexentry.asm b/engine/routines/newpokedexentry.asm index acf9fca7b..122688eff 100644 --- a/engine/routines/newpokedexentry.asm +++ b/engine/routines/newpokedexentry.asm @@ -11,13 +11,13 @@ NewPokedexEntry: ; fb877 ld a, [wPokedexStatus] push af ld a, [hSCX] - add $5 + add POKDEX_SCX ld [hSCX], a xor a ld [wPokedexStatus], a farcall _NewPokedexEntry call WaitPressAorB_BlinkCursor - ld a, $1 + ld a, 1 ; page 2 ld [wPokedexStatus], a farcall DisplayDexEntry call WaitPressAorB_BlinkCursor @@ -26,7 +26,7 @@ NewPokedexEntry: ; fb877 call MaxVolume call RotateThreePalettesRight ld a, [hSCX] - add -5 ; 251 ; NUM_POKEMON + add -POKDEX_SCX ld [hSCX], a call .ReturnFromDexRegistration pop af -- cgit v1.2.3 From 01ba6bed889be703dbeaf8fa9be56f1b782606a1 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 16 Jan 2018 18:07:06 -0500 Subject: Move code out of data/ --- engine/types.asm | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/types.asm b/engine/types.asm index ade1aaa4a..e0235aff1 100644 --- a/engine/types.asm +++ b/engine/types.asm @@ -35,7 +35,7 @@ PrintMonTypes: ; 5090d ld [hl], a inc bc add hl, bc - ld bc, 5 + ld bc, NAME_LENGTH_JAPANESE - 1 jp ByteFill ; 5093a @@ -91,9 +91,32 @@ GetTypeName: ; 50964 ld h, [hl] ld l, a ld de, StringBuffer1 - ld bc, 13 + ld bc, MOVE_NAME_LENGTH jp CopyBytes ; 5097b INCLUDE "data/types/names.asm" + + +Unreferenced_GetGen1TrainerClassName: ; 50a28 + ld hl, Gen1TrainerClassNames + ld a, [TrainerClass] + dec a + ld c, a + ld b, 0 + add hl, bc + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + ld de, StringBuffer1 +.copy + ld a, [hli] + ld [de], a + inc de + cp "@" + jr nz, .copy + ret + +INCLUDE "data/unused/gen_1_trainer_names.asm" -- cgit v1.2.3 From bf074f359886707d2ffb2e0b525b03dc7af0fe29 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 16 Jan 2018 22:57:19 -0500 Subject: =?UTF-8?q?map=5Fheader=20=E2=86=92=20map=5Fdef;=20map=5Fheader=5F?= =?UTF-8?q?2=20=E2=86=92=20map=5Fdata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/events.asm | 24 ++++++++++++------------ engine/events/checkforhiddenitems.asm | 10 +++++----- engine/events/mom_phone.asm | 2 +- engine/events/unown_walls.asm | 18 +++++++++--------- engine/events_2.asm | 2 +- engine/intro_menu.asm | 4 ++-- engine/phone/phone.asm | 4 ++-- engine/player_gfx.asm | 4 ++-- engine/pokegear.asm | 4 ++-- engine/save.asm | 24 ++++++++++++------------ engine/scripting.asm | 6 +++--- engine/unown_puzzle.asm | 4 ++-- engine/warp_connection.asm | 2 +- 13 files changed, 54 insertions(+), 54 deletions(-) (limited to 'engine') diff --git a/engine/events.asm b/engine/events.asm index f95e9ab12..96108730a 100644 --- a/engine/events.asm +++ b/engine/events.asm @@ -396,7 +396,7 @@ CheckTileEvent: ; 96874 ld a, [hli] ld h, [hl] ld l, a - call GetMapScriptHeaderBank + call GetMapScriptsBank call CallScript ret ; 968c7 @@ -450,7 +450,7 @@ RunSceneScript: ; 968ec ld e, a ld d, 0 - ld hl, wCurrMapSceneScriptHeaderPointer + ld hl, wCurrMapSceneScriptsPointer ld a, [hli] ld h, [hl] ld l, a @@ -458,9 +458,9 @@ rept 4 add hl, de endr - call GetMapScriptHeaderBank + call GetMapScriptsBank call GetFarHalfword - call GetMapScriptHeaderBank + call GetMapScriptsBank call CallScript ld hl, ScriptFlags @@ -635,7 +635,7 @@ TryObjectEvent: ; 969b5 ld a, [hli] ld h, [hl] ld l, a - call GetMapScriptHeaderBank + call GetMapScriptsBank call CallScript ret ; 96a12 @@ -646,7 +646,7 @@ TryObjectEvent: ; 969b5 ld a, [hli] ld h, [hl] ld l, a - call GetMapScriptHeaderBank + call GetMapScriptsBank ld de, EngineBuffer1 ld bc, 2 call FarCopyBytes @@ -731,7 +731,7 @@ TryBGEvent: ; 96a38 ld a, [hli] ld h, [hl] ld l, a - call GetMapScriptHeaderBank + call GetMapScriptsBank call CallScript scf ret @@ -740,7 +740,7 @@ TryBGEvent: ; 96a38 call CheckBGEventFlag jp nz, .dontread call PlayTalkObject - call GetMapScriptHeaderBank + call GetMapScriptsBank ld de, EngineBuffer1 ld bc, 3 call FarCopyBytes @@ -753,7 +753,7 @@ TryBGEvent: ; 96a38 .copy call CheckBGEventFlag jr nz, .dontread - call GetMapScriptHeaderBank + call GetMapScriptsBank ld de, EngineBuffer1 ld bc, 3 call FarCopyBytes @@ -774,9 +774,9 @@ TryBGEvent: ; 96a38 pop hl inc hl inc hl - call GetMapScriptHeaderBank + call GetMapScriptsBank call GetFarHalfword - call GetMapScriptHeaderBank + call GetMapScriptsBank call CallScript scf ret @@ -792,7 +792,7 @@ CheckBGEventFlag: ; 96ad8 ld h, [hl] ld l, a push hl - call GetMapScriptHeaderBank + call GetMapScriptsBank call GetFarHalfword ld e, l ld d, h diff --git a/engine/events/checkforhiddenitems.asm b/engine/events/checkforhiddenitems.asm index 3c13412d8..3cad2b821 100644 --- a/engine/events/checkforhiddenitems.asm +++ b/engine/events/checkforhiddenitems.asm @@ -1,6 +1,6 @@ CheckForHiddenItems: ; b8172 ; Checks to see if there are hidden items on the screen that have not yet been found. If it finds one, returns carry. - call GetMapScriptHeaderBank + call GetMapScriptsBank ld [Buffer1], a ; Get the coordinate of the bottom right corner of the screen, and load it in Buffer3/Buffer4. ld a, [XCoord] @@ -9,8 +9,8 @@ CheckForHiddenItems: ; b8172 ld a, [YCoord] add SCREEN_HEIGHT / 4 ld [Buffer3], a -; Get the pointer for the first BG event header in the map... - ld hl, wCurrMapBGEventHeaderPointer +; Get the pointer for the first bg_event in the map... + ld hl, wCurrMapBGEventsPointer ld a, [hli] ld h, [hl] ld l, a @@ -20,7 +20,7 @@ CheckForHiddenItems: ; b8172 jr z, .nobgeventitems ; For i = 1:wCurrMapBGEventCount... .loop -; Store the counter in Buffer2, and store the BG event header pointer in the stack. +; Store the counter in Buffer2, and store the bg_event pointer in the stack. ld [Buffer2], a push hl ; Get the Y coordinate of the BG event. @@ -58,7 +58,7 @@ CheckForHiddenItems: ; b8172 jr z, .itemnearby .next -; Restore the BG event header pointer and increment it by the length of a BG event header. +; Restore the bg_event pointer and increment it by the length of a bg_event. pop hl ld bc, 5 add hl, bc diff --git a/engine/events/mom_phone.asm b/engine/events/mom_phone.asm index 50496e663..d12bf0155 100755 --- a/engine/events/mom_phone.asm +++ b/engine/events/mom_phone.asm @@ -9,7 +9,7 @@ MomTriesToBuySomething:: ; fcfec ld a, [wMapReentryScriptQueueFlag] and a ret nz - call GetMapHeaderPhoneServiceNybble + call GetMapPhoneService and a ret nz xor a diff --git a/engine/events/unown_walls.asm b/engine/events/unown_walls.asm index af7e80bf0..4d59a2f7a 100644 --- a/engine/events/unown_walls.asm +++ b/engine/events/unown_walls.asm @@ -3,7 +3,7 @@ Special_HoOhChamber: ; 0x8addb ld a, [hl] cp HO_OH ; is Ho-oh the first Pokémon in the party? jr nz, .done ; if not, we're done - call GetSecondaryMapHeaderPointer + call GetMapDataPointer ; pointless? ld de, EVENT_WALL_OPENED_IN_HO_OH_CHAMBER ld b, SET_FLAG call EventFlagAction @@ -12,7 +12,7 @@ Special_HoOhChamber: ; 0x8addb ; 0x8adef Special_OmanyteChamber: ; 8adef - call GetSecondaryMapHeaderPointer + call GetMapDataPointer ; pointless? ld de, EVENT_WALL_OPENED_IN_OMANYTE_CHAMBER ld b, CHECK_FLAG call EventFlagAction @@ -44,7 +44,7 @@ Special_OmanyteChamber: ; 8adef jr nz, .loop .open - call GetSecondaryMapHeaderPointer + call GetMapDataPointer ; pointless? ld de, EVENT_WALL_OPENED_IN_OMANYTE_CHAMBER ld b, SET_FLAG call EventFlagAction @@ -57,12 +57,12 @@ SpecialAerodactylChamber: ; 8ae30 push de push bc - call GetSecondaryMapHeaderPointer + call GetMapDataPointer ld a, h - cp HIGH(RuinsOfAlphAerodactylChamber_SecondMapHeader) + cp HIGH(RuinsOfAlphAerodactylChamber_MapData) jr nz, .nope ld a, l - cp LOW(RuinsOfAlphAerodactylChamber_SecondMapHeader) + cp LOW(RuinsOfAlphAerodactylChamber_MapData) jr nz, .nope ld de, EVENT_WALL_OPENED_IN_AERODACTYL_CHAMBER @@ -85,12 +85,12 @@ SpecialKabutoChamber: ; 8ae4e push hl push de - call GetSecondaryMapHeaderPointer + call GetMapDataPointer ld a, h - cp HIGH(RuinsOfAlphKabutoChamber_SecondMapHeader) + cp HIGH(RuinsOfAlphKabutoChamber_MapData) jr nz, .done ld a, l - cp LOW(RuinsOfAlphKabutoChamber_SecondMapHeader) + cp LOW(RuinsOfAlphKabutoChamber_MapData) jr nz, .done ld de, EVENT_WALL_OPENED_IN_KABUTO_CHAMBER diff --git a/engine/events_2.asm b/engine/events_2.asm index e4458d9aa..1149c2431 100644 --- a/engine/events_2.asm +++ b/engine/events_2.asm @@ -274,7 +274,7 @@ DoBikeStep:: ; 97db3 ; If we're not in an area of phone service, we don't ; have to be here. - call GetMapHeaderPhoneServiceNybble + call GetMapPhoneService and a jr nz, .NoCall diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index 57d6eb6ce..15c2a4cbb 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -542,10 +542,10 @@ Continue_LoadMenuHeader: ; 5ebf ld hl, .MenuDataHeader_Dex ld a, [wStatusFlags] bit 0, a ; pokedex - jr nz, .pokedex_header + jr nz, .show_menu ld hl, .MenuDataHeader_NoDex -.pokedex_header +.show_menu call _OffsetMenuDataHeader call MenuBox call PlaceVerticalMenuItems diff --git a/engine/phone/phone.asm b/engine/phone/phone.asm index a4dd42faf..6a9644872 100644 --- a/engine/phone/phone.asm +++ b/engine/phone/phone.asm @@ -131,7 +131,7 @@ CheckPhoneCall:: ; 90074 (24:4074) cp b jr nz, .no_call - call GetMapHeaderPhoneServiceNybble + call GetMapPhoneService and a jr nz, .no_call @@ -328,7 +328,7 @@ Function90199: ; 90199 (24:4199) and a jr nz, .OutOfArea ; If you're in an area without phone service, don't do the call - call GetMapHeaderPhoneServiceNybble + call GetMapPhoneService and a jr nz, .OutOfArea ; If the person can't take a call at that time, don't do the call diff --git a/engine/player_gfx.asm b/engine/player_gfx.asm index ac63b050f..21929e32c 100644 --- a/engine/player_gfx.asm +++ b/engine/player_gfx.asm @@ -56,11 +56,11 @@ MovePlayerPic: ; 88266 jr .loop ShowPlayerNamingChoices: ; 88297 - ld hl, ChrisNameMenuHeader + ld hl, ChrisNameMenuDataHeader ld a, [wPlayerGender] bit 0, a jr z, .GotGender - ld hl, KrisNameMenuHeader + ld hl, KrisNameMenuDataHeader .GotGender: call LoadMenuDataHeader call VerticalMenu diff --git a/engine/pokegear.asm b/engine/pokegear.asm index 37640311e..5bb63b897 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -393,7 +393,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8) hlcoord 17, 2 inc a ld [hli], a - call GetMapHeaderPhoneServiceNybble + call GetMapPhoneService and a ret nz hlcoord 18, 2 @@ -926,7 +926,7 @@ PokegearPhone_Joypad: ; 91171 (24:5171) ret PokegearPhone_MakePhoneCall: ; 911eb (24:51eb) - call GetMapHeaderPhoneServiceNybble + call GetMapPhoneService and a jr nz, .no_service ld hl, Options diff --git a/engine/save.asm b/engine/save.asm index d9f48d62c..8c2ac7413 100644 --- a/engine/save.asm +++ b/engine/save.asm @@ -525,9 +525,9 @@ SavePlayerData: ; 14dd7 ld de, sPlayerData ld bc, wPlayerDataEnd - wPlayerData call CopyBytes - ld hl, wMapData - ld de, sMapData - ld bc, wMapDataEnd - wMapData + ld hl, wCurrMapData + ld de, sCurrMapData + ld bc, wCurrMapDataEnd - wCurrMapData call CopyBytes jp CloseSRAM ; 14df7 @@ -592,9 +592,9 @@ SaveBackupPlayerData: ; 14e55 ld de, sBackupPlayerData ld bc, wPlayerDataEnd - wPlayerData call CopyBytes - ld hl, wMapData - ld de, sBackupMapData - ld bc, wMapDataEnd - wMapData + ld hl, wCurrMapData + ld de, sBackupCurrMapData + ld bc, wCurrMapDataEnd - wCurrMapData call CopyBytes call CloseSRAM ret @@ -777,9 +777,9 @@ LoadPlayerData: ; 14fd7 (5:4fd7) ld de, wPlayerData ld bc, wPlayerDataEnd - wPlayerData call CopyBytes - ld hl, sMapData - ld de, wMapData - ld bc, wMapDataEnd - wMapData + ld hl, sCurrMapData + ld de, wCurrMapData + ld bc, wCurrMapDataEnd - wCurrMapData call CopyBytes call CloseSRAM ld a, BANK(sBattleTowerChallengeState) @@ -833,9 +833,9 @@ LoadBackupPlayerData: ; 15046 (5:5046) ld de, wPlayerData ld bc, wPlayerDataEnd - wPlayerData call CopyBytes - ld hl, sBackupMapData - ld de, wMapData - ld bc, wMapDataEnd - wMapData + ld hl, sBackupCurrMapData + ld de, wCurrMapData + ld bc, wCurrMapDataEnd - wCurrMapData call CopyBytes call CloseSRAM ret diff --git a/engine/scripting.asm b/engine/scripting.asm index 87415135d..769a8311c 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -2580,11 +2580,11 @@ Script_changemap: ; parameters: map_data_pointer call GetScriptByte - ld [MapBlockDataBank], a + ld [MapBlocksBank], a call GetScriptByte - ld [MapBlockDataPointer], a + ld [MapBlocksPointer], a call GetScriptByte - ld [MapBlockDataPointer + 1], a + ld [MapBlocksPointer + 1], a call ChangeMap call BufferScreen ret diff --git a/engine/unown_puzzle.asm b/engine/unown_puzzle.asm index 8a032db42..36f6dacd2 100755 --- a/engine/unown_puzzle.asm +++ b/engine/unown_puzzle.asm @@ -763,7 +763,7 @@ endr ; e16c7 UnownPuzzle_AddPuzzlePieceBorders: ; e16c7 - ld hl, GFXHeaders + ld hl, PuzzlePieceBorderData ld a, 8 .loop push af @@ -819,7 +819,7 @@ endr ret ; e1703 -GFXHeaders: ; e1703 +PuzzlePieceBorderData: ; e1703 dw .TileBordersGFX + 0 tiles, vTiles0 tile $00 dw .TileBordersGFX + 1 tiles, vTiles0 tile $01 dw .TileBordersGFX + 2 tiles, vTiles0 tile $02 diff --git a/engine/warp_connection.asm b/engine/warp_connection.asm index 28908e793..c2cb6ed10 100755 --- a/engine/warp_connection.asm +++ b/engine/warp_connection.asm @@ -11,7 +11,7 @@ InitCommandQueue: ; 1045c4 farcall ClearCmdQueue ld a, MAPCALLBACK_CMDQUEUE call RunMapCallback - call GetMapHeaderTimeOfDayNybble + call GetMapTimeOfDay ld [wMapTimeOfDay], a ret -- cgit v1.2.3 From 6d20cf3e80780af15ed15acea2f7feac1ffd9705 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 16 Jan 2018 23:47:45 -0500 Subject: =?UTF-8?q?"CryHeader"=20=E2=86=92=20"Cry";=20"Cry"=20=E2=86=92=20?= =?UTF-8?q?"MonCry"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/battle_anims/anim_commands.asm | 4 ++-- engine/billspc.asm | 6 +++--- engine/breeding.asm | 4 ++-- engine/events/daycare.asm | 30 ++++++++++++++++-------------- engine/evolution_animation.asm | 4 ++-- engine/intro_menu.asm | 2 +- engine/pic_animation.asm | 4 ++-- engine/pokedex.asm | 8 ++++---- engine/routines/playslowcry.asm | 4 ++-- engine/scripting.asm | 2 +- engine/specials.asm | 2 +- engine/stats_screen.asm | 2 +- engine/trade_animation.asm | 2 +- 13 files changed, 38 insertions(+), 36 deletions(-) (limited to 'engine') diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index 07ab82d95..0bbedf909 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -1272,7 +1272,7 @@ endr .done_cry_tracks push hl - call LoadCryHeader + call LoadCry pop hl jr c, .done @@ -1309,7 +1309,7 @@ endr ld a, 1 ld [wStereoPanningMask], a - callfar _PlayCryHeader + callfar _PlayCry .done pop af diff --git a/engine/billspc.asm b/engine/billspc.asm index baf0ee643..458192c3c 100755 --- a/engine/billspc.asm +++ b/engine/billspc.asm @@ -1825,7 +1825,7 @@ DepositPokemon: ; e307c (38:707c) ld [wPokemonWithdrawDepositParameter], a farcall RemoveMonFromPartyOrBox ld a, [CurPartySpecies] - call PlayCry + call PlayMonCry hlcoord 0, 0 lb bc, 15, 8 call ClearBox @@ -1880,7 +1880,7 @@ TryWithdrawPokemon: ; e30fa (38:70fa) ld [wPokemonWithdrawDepositParameter], a farcall RemoveMonFromPartyOrBox ld a, [CurPartySpecies] - call PlayCry + call PlayMonCry hlcoord 0, 0 lb bc, 15, 8 call ClearBox @@ -1934,7 +1934,7 @@ ReleasePKMN_ByePKMN: ; e3180 (38:7180) jr c, .skip_cry ld e, c ld d, b - call PlayCryHeader + call PlayCry .skip_cry ld a, [CurPartySpecies] diff --git a/engine/breeding.asm b/engine/breeding.asm index 9fe0b8986..489154f71 100755 --- a/engine/breeding.asm +++ b/engine/breeding.asm @@ -891,7 +891,7 @@ Special_DayCareMon1: ; 17421 ld hl, DayCareMon1Text call PrintText ld a, [wBreedMon1Species] - call PlayCry + call PlayMonCry ld a, [wDayCareLady] bit 0, a jr z, DayCareMonCursor @@ -904,7 +904,7 @@ Special_DayCareMon2: ; 17440 ld hl, DayCareMon2Text call PrintText ld a, [wBreedMon2Species] - call PlayCry + call PlayMonCry ld a, [wDayCareMan] bit 0, a jr z, DayCareMonCursor diff --git a/engine/events/daycare.asm b/engine/events/daycare.asm index ed6e16e87..a7eb565bb 100755 --- a/engine/events/daycare.asm +++ b/engine/events/daycare.asm @@ -1,3 +1,4 @@ +; PrintDayCareText.TextTable indexes const_def const DAYCARETEXT_MAN_INTRO const DAYCARETEXT_MAN_EGG @@ -13,12 +14,12 @@ const DAYCARETEXT_GENIUSES const DAYCARETEXT_ASK_WITHDRAW const DAYCARETEXT_WITHDRAW + const DAYCARETEXT_GOT_BACK const DAYCARETEXT_TOO_SOON const DAYCARETEXT_PARTY_FULL const DAYCARETEXT_NOT_ENOUGH_MONEY const DAYCARETEXT_OH_FINE const DAYCARETEXT_COME_AGAIN - const DAYCARETEXT_13 Special_DayCareMan: ; 166d6 ld hl, wDayCareMan @@ -44,7 +45,7 @@ Special_DayCareMan: ; 166d6 call DayCare_AskWithdrawBreedMon jr c, .print_text farcall RetrievePokemonFromDayCareMan - call DayCare_TakeMoney_PlayCry + call DayCare_GetBackMonForMoney ld hl, wDayCareMan res 0, [hl] res 5, [hl] @@ -54,7 +55,7 @@ Special_DayCareMan: ; 166d6 call PrintDayCareText .cancel - ld a, DAYCARETEXT_13 + ld a, DAYCARETEXT_COME_AGAIN call PrintDayCareText ret ; 1672a @@ -83,7 +84,7 @@ Special_DayCareLady: ; 1672a call DayCare_AskWithdrawBreedMon jr c, .print_text farcall RetrievePokemonFromDayCareLady - call DayCare_TakeMoney_PlayCry + call DayCare_GetBackMonForMoney ld hl, wDayCareLady res 0, [hl] ld hl, wDayCareMan @@ -94,7 +95,7 @@ Special_DayCareLady: ; 1672a call PrintDayCareText .cancel - ld a, DAYCARETEXT_13 + ld a, DAYCARETEXT_COME_AGAIN call PrintDayCareText ret ; 16781 @@ -145,7 +146,7 @@ DayCareAskDepositPokemon: ; 16798 ret .Declined: - ld a, DAYCARETEXT_COME_AGAIN + ld a, DAYCARETEXT_OH_FINE scf ret @@ -180,7 +181,7 @@ DayCare_DepositPokemonText: ; 167f6 ld a, DAYCARETEXT_DEPOSIT call PrintDayCareText ld a, [CurPartySpecies] - call PlayCry + call PlayMonCry ld a, DAYCARETEXT_COME_BACK_LATER call PrintDayCareText ret @@ -190,7 +191,7 @@ DayCare_AskWithdrawBreedMon: ; 16807 ld a, [StringBuffer2 + 1] and a jr nz, .grew_at_least_one_level - ld a, DAYCARETEXT_PARTY_FULL + ld a, DAYCARETEXT_TOO_SOON call PrintDayCareText call YesNoBox jr c, .refused @@ -218,30 +219,30 @@ DayCare_AskWithdrawBreedMon: ; 16807 ret .refused - ld a, DAYCARETEXT_COME_AGAIN + ld a, DAYCARETEXT_OH_FINE scf ret .not_enough_money - ld a, DAYCARETEXT_OH_FINE + ld a, DAYCARETEXT_NOT_ENOUGH_MONEY scf ret .PartyFull: - ld a, DAYCARETEXT_NOT_ENOUGH_MONEY + ld a, DAYCARETEXT_PARTY_FULL scf ret ; 16850 -DayCare_TakeMoney_PlayCry: ; 16850 +DayCare_GetBackMonForMoney: ; 16850 ld bc, StringBuffer2 + 2 ld de, Money farcall TakeMoney ld a, DAYCARETEXT_WITHDRAW call PrintDayCareText ld a, [CurPartySpecies] - call PlayCry - ld a, DAYCARETEXT_TOO_SOON + call PlayMonCry + ld a, DAYCARETEXT_GOT_BACK call PrintDayCareText ret ; 1686d @@ -283,6 +284,7 @@ PrintDayCareText: ; 1689b ; 168aa .TextTable: ; 168aa +; entries correspond to DAYCARETEXT_* constants dw .DayCareManIntro ; 00 dw .DayCareManOddEgg ; 01 dw .DayCareLadyIntro ; 02 diff --git a/engine/evolution_animation.asm b/engine/evolution_animation.asm index 8c3a191bb..2e6e82e25 100755 --- a/engine/evolution_animation.asm +++ b/engine/evolution_animation.asm @@ -80,7 +80,7 @@ EvolutionAnimation: ; 4e5e1 jr c, .skip_cry ld a, [wEvolutionOldSpecies] - call PlayCry + call PlayMonCry .skip_cry ld de, MUSIC_EVOLUTION @@ -148,7 +148,7 @@ EvolutionAnimation: ; 4e5e1 ret c ld a, [PlayerHPPal] - call PlayCry + call PlayMonCry ret ; 4e703 diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index 15c2a4cbb..a26ac1f81 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -754,7 +754,7 @@ OakText2: ; 0x604a text_jump _OakText2 start_asm ld a, WOOPER - call PlayCry + call PlayMonCry call WaitSFX ld hl, OakText3 ret diff --git a/engine/pic_animation.asm b/engine/pic_animation.asm index 18c68ded9..4317d96f8 100644 --- a/engine/pic_animation.asm +++ b/engine/pic_animation.asm @@ -249,7 +249,7 @@ PokeAnim_Finish: ; d0171 PokeAnim_Cry: ; d017a ld a, [wPokeAnimSpecies] - call _PlayCry + call _PlayMonCry ld a, [wPokeAnimSceneIndex] inc a ld [wPokeAnimSceneIndex], a @@ -258,7 +258,7 @@ PokeAnim_Cry: ; d017a PokeAnim_CryNoWait: ; d0188 ld a, [wPokeAnimSpecies] - call PlayCry2 + call PlayMonCry2 ld a, [wPokeAnimSceneIndex] inc a ld [wPokeAnimSceneIndex], a diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 4c257e424..4d7096c0e 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -346,7 +346,7 @@ Pokedex_InitDexEntryScreen: ; 40217 (10:4217) ld a, SCGB_POKEDEX call Pokedex_GetSGBLayout ld a, [CurPartySpecies] - call PlayCry + call PlayMonCry call Pokedex_IncrementDexPointer ret @@ -415,7 +415,7 @@ Pokedex_ReinitDexEntryScreen: ; 402aa (10:42aa) ld a, SCGB_POKEDEX call Pokedex_GetSGBLayout ld a, [CurPartySpecies] - call PlayCry + call PlayMonCry ld hl, wJumptableIndex dec [hl] ret @@ -471,7 +471,7 @@ DexEntryScreen_MenuActionJumptable: ; 402f2 call GetCryIndex ld e, c ld d, b - call PlayCryHeader + call PlayCry ret .Print: ; 4034f @@ -2558,7 +2558,7 @@ _NewPokedexEntry: ; 41a7f ld a, SCGB_POKEDEX call Pokedex_GetSGBLayout ld a, [CurPartySpecies] - call PlayCry + call PlayMonCry ret diff --git a/engine/routines/playslowcry.asm b/engine/routines/playslowcry.asm index 636741bcf..545629e51 100644 --- a/engine/routines/playslowcry.asm +++ b/engine/routines/playslowcry.asm @@ -1,6 +1,6 @@ Special_PlaySlowCry: ; fb841 ld a, [ScriptVar] - call LoadCryHeader + call LoadCry jr c, .done ld hl, CryPitch @@ -23,7 +23,7 @@ Special_PlaySlowCry: ; fb841 ld [CryLength], a ld a, h ld [CryLength + 1], a - farcall _PlayCryHeader + farcall _PlayCry call WaitSFX .done diff --git a/engine/scripting.asm b/engine/scripting.asm index 769a8311c..84590f3c0 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -938,7 +938,7 @@ Script_cry: jr nz, .ok ld a, [ScriptVar] .ok - call PlayCry + call PlayMonCry ret GetScriptObject: diff --git a/engine/specials.asm b/engine/specials.asm index be1c37f88..965e3d58b 100644 --- a/engine/specials.asm +++ b/engine/specials.asm @@ -413,7 +413,7 @@ Special_SnorlaxAwake: ; 0xc43d Special_PlayCurMonCry: ; c472 ld a, [CurPartySpecies] - jp PlayCry + jp PlayMonCry ; c478 diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm index 1e3fb8a77..f51f57a77 100755 --- a/engine/stats_screen.asm +++ b/engine/stats_screen.asm @@ -829,7 +829,7 @@ StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) call SetPalettes call .AnimateMon ld a, [CurPartySpecies] - call PlayCry2 + call PlayMonCry2 ret .AnimateMon: ; 4e253 (13:6253) diff --git a/engine/trade_animation.asm b/engine/trade_animation.asm index 08b30b132..54faa988f 100755 --- a/engine/trade_animation.asm +++ b/engine/trade_animation.asm @@ -847,7 +847,7 @@ TradeAnim_ShowGivemonData: ; 2942e jr c, .skip_cry ld e, c ld d, b - call PlayCryHeader + call PlayCry .skip_cry call TradeAnim_AdvanceScriptPointer -- cgit v1.2.3 From b1c808f9f85c215340daccf7dc8eaa3832f15ba6 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 17 Jan 2018 14:50:34 -0500 Subject: Rename some tilesets (close #467) --- engine/tileset_anims.asm | 88 ++++++++++++++++++++++----------------------- engine/tileset_palettes.asm | 10 +++--- 2 files changed, 49 insertions(+), 49 deletions(-) (limited to 'engine') diff --git a/engine/tileset_anims.asm b/engine/tileset_anims.asm index 74679b1ee..5113ae9a3 100644 --- a/engine/tileset_anims.asm +++ b/engine/tileset_anims.asm @@ -35,7 +35,7 @@ _AnimateTileset:: ; fc000 ; fc01b Tileset0Anim: ; 0xfc01b -TilesetJohto2Anim: ; 0xfc01b +TilesetJohtoModernAnim: ; 0xfc01b TilesetKantoAnim: ; 0xfc01b dw vTiles2 tile $14, AnimateWaterTile dw NULL, WaitTileAnimation @@ -64,7 +64,7 @@ TilesetParkAnim: ; 0xfc047 dw NULL, DoneTileAnimation ; 0xfc073 -TilesetIlexForestAnim: ; 0xfc073 +TilesetForestAnim: ; 0xfc073 dw NULL, ForestTreeLeftAnimation dw NULL, ForestTreeRightAnimation dw NULL, WaitTileAnimation @@ -79,7 +79,7 @@ TilesetIlexForestAnim: ; 0xfc073 dw NULL, DoneTileAnimation ; 0xfc0a3 -TilesetJohto1Anim: ; 0xfc0a3 +TilesetJohtoAnim: ; 0xfc0a3 dw vTiles2 tile $14, AnimateWaterTile dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation @@ -138,7 +138,7 @@ TilesetPortAnim: ; 0xfc12f dw NULL, DoneTileAnimation ; 0xfc15f -TilesetGym1Anim: ; 0xfc15f +TilesetEliteFourRoomAnim: ; 0xfc15f dw NULL, LavaBubbleAnim2 dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation @@ -182,7 +182,7 @@ UnusedTilesetAnim_fc1af: ; 0xfc1af ; 0xfc1e7 TilesetCaveAnim: ; 0xfc1e7 -TilesetWhirlIslandsAnim: ; 0xfc1e7 +TilesetDarkCaveAnim: ; 0xfc1e7 dw vTiles2 tile $14, WriteTileToBuffer dw NULL, FlickeringCaveEntrancePalette dw wTileAnimBuffer, ScrollTileRightLeft @@ -226,17 +226,17 @@ TilesetIcePathAnim: ; 0xfc233 dw NULL, DoneTileAnimation ; 0xfc27f -TilesetSproutTowerAnim: ; 0xfc27f - dw SproutPillarTilePointer9, AnimateSproutPillarTile - dw SproutPillarTilePointer10, AnimateSproutPillarTile - dw SproutPillarTilePointer7, AnimateSproutPillarTile - dw SproutPillarTilePointer8, AnimateSproutPillarTile - dw SproutPillarTilePointer5, AnimateSproutPillarTile - dw SproutPillarTilePointer6, AnimateSproutPillarTile - dw SproutPillarTilePointer3, AnimateSproutPillarTile - dw SproutPillarTilePointer4, AnimateSproutPillarTile - dw SproutPillarTilePointer1, AnimateSproutPillarTile - dw SproutPillarTilePointer2, AnimateSproutPillarTile +TilesetTowerAnim: ; 0xfc27f + dw TowerPillarTilePointer9, AnimateTowerPillarTile + dw TowerPillarTilePointer10, AnimateTowerPillarTile + dw TowerPillarTilePointer7, AnimateTowerPillarTile + dw TowerPillarTilePointer8, AnimateTowerPillarTile + dw TowerPillarTilePointer5, AnimateTowerPillarTile + dw TowerPillarTilePointer6, AnimateTowerPillarTile + dw TowerPillarTilePointer3, AnimateTowerPillarTile + dw TowerPillarTilePointer4, AnimateTowerPillarTile + dw TowerPillarTilePointer1, AnimateTowerPillarTile + dw TowerPillarTilePointer2, AnimateTowerPillarTile dw NULL, StandingTileFrame dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation @@ -259,20 +259,20 @@ UnusedTilesetAnim_fc2bf: ; 0xfc2bf ; 0xfc2e7 TilesetBattleTowerOutsideAnim: ; 0xfc2e7 -TilesetHouse1Anim: ; 0xfc2e7 +TilesetHouseAnim: ; 0xfc2e7 TilesetPlayersHouseAnim: ; 0xfc2e7 TilesetPokecenterAnim: ; 0xfc2e7 TilesetGateAnim: ; 0xfc2e7 TilesetLabAnim: ; 0xfc2e7 -TilesetPowerPlantAnim: ; 0xfc2e7 +TilesetFacilityAnim: ; 0xfc2e7 TilesetMartAnim: ; 0xfc2e7 -TilesetCeladonMansionAnim: ; 0xfc2e7 +TilesetMansionAnim: ; 0xfc2e7 TilesetGameCornerAnim: ; 0xfc2e7 -TilesetKurtsHouseAnim: ; 0xfc2e7 +TilesetTraditionalHouseAnim: ; 0xfc2e7 TilesetTrainStationAnim: ; 0xfc2e7 -TilesetOlivineGymAnim: ; 0xfc2e7 +TilesetChampionsRoomAnim: ; 0xfc2e7 TilesetLighthouseAnim: ; 0xfc2e7 -TilesetPlayersHouse2FAnim: ; 0xfc2e7 +TilesetPlayersRoomAnim: ; 0xfc2e7 TilesetPokeComCenterAnim: ; 0xfc2e7 TilesetBattleTowerAnim: ; 0xfc2e7 TilesetRuinsOfAlphAnim: ; 0xfc2e7 @@ -754,7 +754,7 @@ LavaBubbleFrames: ; fc605 ; fc645 -AnimateSproutPillarTile: ; fc645 +AnimateTowerPillarTile: ; fc645 ; Read from struct at de: ; Destination (VRAM) ; Address of the first tile in the frame array @@ -1023,27 +1023,27 @@ FlickeringCaveEntrancePalette: ; fc71e ; fc750 -SproutPillarTilePointer1: dw vTiles2 tile $2d, SproutPillarTile1 -SproutPillarTilePointer2: dw vTiles2 tile $2f, SproutPillarTile2 -SproutPillarTilePointer3: dw vTiles2 tile $3d, SproutPillarTile3 -SproutPillarTilePointer4: dw vTiles2 tile $3f, SproutPillarTile4 -SproutPillarTilePointer5: dw vTiles2 tile $3c, SproutPillarTile5 -SproutPillarTilePointer6: dw vTiles2 tile $2c, SproutPillarTile6 -SproutPillarTilePointer7: dw vTiles2 tile $4d, SproutPillarTile7 -SproutPillarTilePointer8: dw vTiles2 tile $4f, SproutPillarTile8 -SproutPillarTilePointer9: dw vTiles2 tile $5d, SproutPillarTile9 -SproutPillarTilePointer10: dw vTiles2 tile $5f, SproutPillarTile10 - -SproutPillarTile1: INCBIN "gfx/tilesets/sprout-pillar/1.2bpp" -SproutPillarTile2: INCBIN "gfx/tilesets/sprout-pillar/2.2bpp" -SproutPillarTile3: INCBIN "gfx/tilesets/sprout-pillar/3.2bpp" -SproutPillarTile4: INCBIN "gfx/tilesets/sprout-pillar/4.2bpp" -SproutPillarTile5: INCBIN "gfx/tilesets/sprout-pillar/5.2bpp" -SproutPillarTile6: INCBIN "gfx/tilesets/sprout-pillar/6.2bpp" -SproutPillarTile7: INCBIN "gfx/tilesets/sprout-pillar/7.2bpp" -SproutPillarTile8: INCBIN "gfx/tilesets/sprout-pillar/8.2bpp" -SproutPillarTile9: INCBIN "gfx/tilesets/sprout-pillar/9.2bpp" -SproutPillarTile10: INCBIN "gfx/tilesets/sprout-pillar/10.2bpp" +TowerPillarTilePointer1: dw vTiles2 tile $2d, TowerPillarTile1 +TowerPillarTilePointer2: dw vTiles2 tile $2f, TowerPillarTile2 +TowerPillarTilePointer3: dw vTiles2 tile $3d, TowerPillarTile3 +TowerPillarTilePointer4: dw vTiles2 tile $3f, TowerPillarTile4 +TowerPillarTilePointer5: dw vTiles2 tile $3c, TowerPillarTile5 +TowerPillarTilePointer6: dw vTiles2 tile $2c, TowerPillarTile6 +TowerPillarTilePointer7: dw vTiles2 tile $4d, TowerPillarTile7 +TowerPillarTilePointer8: dw vTiles2 tile $4f, TowerPillarTile8 +TowerPillarTilePointer9: dw vTiles2 tile $5d, TowerPillarTile9 +TowerPillarTilePointer10: dw vTiles2 tile $5f, TowerPillarTile10 + +TowerPillarTile1: INCBIN "gfx/tilesets/tower-pillar/1.2bpp" +TowerPillarTile2: INCBIN "gfx/tilesets/tower-pillar/2.2bpp" +TowerPillarTile3: INCBIN "gfx/tilesets/tower-pillar/3.2bpp" +TowerPillarTile4: INCBIN "gfx/tilesets/tower-pillar/4.2bpp" +TowerPillarTile5: INCBIN "gfx/tilesets/tower-pillar/5.2bpp" +TowerPillarTile6: INCBIN "gfx/tilesets/tower-pillar/6.2bpp" +TowerPillarTile7: INCBIN "gfx/tilesets/tower-pillar/7.2bpp" +TowerPillarTile8: INCBIN "gfx/tilesets/tower-pillar/8.2bpp" +TowerPillarTile9: INCBIN "gfx/tilesets/tower-pillar/9.2bpp" +TowerPillarTile10: INCBIN "gfx/tilesets/tower-pillar/10.2bpp" ; fca98 diff --git a/engine/tileset_palettes.asm b/engine/tileset_palettes.asm index 9aba2f20e..5a2190fc7 100644 --- a/engine/tileset_palettes.asm +++ b/engine/tileset_palettes.asm @@ -6,11 +6,11 @@ LoadSpecialMapPalette: ; 494ac jr z, .battle_tower cp TILESET_ICE_PATH jr z, .ice_path - cp TILESET_HOUSE_1 + cp TILESET_HOUSE jr z, .house cp TILESET_RADIO_TOWER jr z, .radio_tower - cp TILESET_CELADON_MANSION + cp TILESET_MANSION jr z, .mansion_mobile jr .do_nothing @@ -102,7 +102,7 @@ LoadHousePalette: ; 495df ; 495ee HousePalette: ; 495ee -INCLUDE "gfx/tilesets/house_1.pal" +INCLUDE "gfx/tilesets/house.pal" ; 4962e LoadRadioTowerPalette: ; 4962e @@ -119,7 +119,7 @@ INCLUDE "gfx/tilesets/radio_tower.pal" ; 4967d MansionPalette1: ; 4967d -INCLUDE "gfx/tilesets/celadon_mansion_1.pal" +INCLUDE "gfx/tilesets/mansion_1.pal" ; 496c5 LoadMansionPalette: ; 496c5 @@ -147,5 +147,5 @@ LoadMansionPalette: ; 496c5 ; 496fe MansionPalette2: ; 496fe -INCLUDE "gfx/tilesets/celadon_mansion_2.pal" +INCLUDE "gfx/tilesets/mansion_2.pal" ; 49706 -- cgit v1.2.3 From 4161ec98b4ab19863ae35502c9959892effbf6ea Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 17 Jan 2018 22:37:04 -0500 Subject: Partially document SGB data from pokered --- engine/cgb_layouts.asm | 28 ++++++++++++++-------------- engine/color.asm | 48 ++++++++++++++++++++++++------------------------ engine/sgb_layouts.asm | 48 ++++++++++++++++++++++++------------------------ 3 files changed, 62 insertions(+), 62 deletions(-) (limited to 'engine') diff --git a/engine/cgb_layouts.asm b/engine/cgb_layouts.asm index 70429a453..43e0d6e12 100644 --- a/engine/cgb_layouts.asm +++ b/engine/cgb_layouts.asm @@ -267,7 +267,7 @@ INCLUDE "gfx/stats/stats.pal" _CGB_Pokedex: ; 8f70 ld de, wBGPals1 - ld a, $1d + ld a, PREDEFPAL_1D call GetPredefPal call LoadHLPaletteIntoDE ; dex interface palette ld a, [CurPartySpecies] @@ -309,7 +309,7 @@ INCLUDE "gfx/pokedex/cursor.pal" _CGB_BillsPC: ; 8fca ld de, wBGPals1 - ld a, $1d + ld a, PREDEFPAL_1D call GetPredefPal call LoadHLPaletteIntoDE ld a, [CurPartySpecies] @@ -366,7 +366,7 @@ INCLUDE "gfx/pc/orange.pal" _CGB_PokedexUnownMode: ; 903e ld de, wBGPals1 - ld a, $1d + ld a, PREDEFPAL_1D call GetPredefPal call LoadHLPaletteIntoDE ld a, [CurPartySpecies] @@ -444,7 +444,7 @@ _CGB06: ; 90f8 call CopyFourPalettes call WipeAttrMap ld de, wOBPals1 - ld a, $3c + ld a, PREDEFPAL_3C call GetPredefPal call LoadHLPaletteIntoDE hlcoord 0, 6, AttrMap @@ -508,12 +508,12 @@ _CGB07: ; 9122 .Function9166: ; 9166 ld de, wBGPals1 - ld a, $38 + ld a, PREDEFPAL_38 call GetPredefPal call LoadHLPaletteIntoDE ld de, wOBPals1 - ld a, $39 + ld a, PREDEFPAL_39 call GetPredefPal call LoadHLPaletteIntoDE call WipeAttrMap @@ -524,7 +524,7 @@ _CGB07: ; 9122 ld hl, PalPacket_9c36 + 1 call CopyFourPalettes ld de, wOBPals1 - ld a, $3a + ld a, PREDEFPAL_3A call GetPredefPal call LoadHLPaletteIntoDE call WipeAttrMap @@ -579,7 +579,7 @@ _CGB_Evolution: ; 91e4 ld a, c and a jr z, .pokemon - ld a, $1a + ld a, PREDEFPAL_1A call GetPredefPal call LoadHLPaletteIntoDE jr .got_palette @@ -640,7 +640,7 @@ _CGB_UnownPuzzle: ; 925e ld hl, PalPacket_9bc6 + 1 call CopyFourPalettes ld de, wOBPals1 - ld a, $4c + ld a, PREDEFPAL_4C call GetPredefPal call LoadHLPaletteIntoDE ld a, [rSVBK] @@ -685,7 +685,7 @@ _CGB_TrainerCard: ; 9289 ld a, PRYCE call GetTrainerPalettePointer call LoadPalette_White_Col1_Col2_Black - ld a, $24 + ld a, PREDEFPAL_24 call GetPredefPal call LoadHLPaletteIntoDE @@ -767,7 +767,7 @@ _CGB_TrainerCard: ; 9289 _CGB_MoveList: ; 9373 ld de, wBGPals1 - ld a, $10 + ld a, PREDEFPAL_10 call GetPredefPal call LoadHLPaletteIntoDE ld a, [PlayerHPPal] @@ -803,7 +803,7 @@ _CGB0f: ; 93a6 _CGB_PokedexSearchOption: ; 93ba ld de, wBGPals1 - ld a, $1d + ld a, PREDEFPAL_1D call GetPredefPal call LoadHLPaletteIntoDE call WipeAttrMap @@ -927,7 +927,7 @@ _CGB13: ; 94d0 _CGB_GamefreakLogo: ; 94fa ld de, wBGPals1 - ld a, $4e + ld a, PREDEFPAL_4E call GetPredefPal call LoadHLPaletteIntoDE ld hl, .Palette @@ -977,7 +977,7 @@ _CGB_TradeTube: ; 9555 ld a, BANK(wOBPals1) call FarCopyWRAM ld de, wOBPals1 palette 7 - ld a, $1c + ld a, PREDEFPAL_1C call GetPredefPal call LoadHLPaletteIntoDE call WipeAttrMap diff --git a/engine/color.asm b/engine/color.asm index cc12ffaf8..7a237b6be 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -187,7 +187,7 @@ Unreferenced_Function8b4d: .cgb ld de, wOBPals1 - ld a, $3b + ld a, PREDEFPAL_3B call GetPredefPal jp LoadHLPaletteIntoDE @@ -202,7 +202,7 @@ Unreferenced_Function8b67: .cgb ld de, wOBPals1 - ld a, $3c + ld a, PREDEFPAL_3C call GetPredefPal jp LoadHLPaletteIntoDE @@ -765,10 +765,10 @@ Unreferenced_Function97cc: ret z ld a, $90 ld [rOBPI], a - ld a, $1c + ld a, PREDEFPAL_1C call GetPredefPal call .PushPalette - ld a, $21 + ld a, PREDEFPAL_21 call GetPredefPal call .PushPalette ret @@ -878,7 +878,7 @@ InitSGBBorder: call PushSGBBorder call SGBDelayCycles call SGB_ClearVRAM - ld hl, PalPacket_9d66 + ld hl, MaskEnCancelPacket call PushSGBPals .skip @@ -943,7 +943,7 @@ InitCGBPals:: ret _InitSGBBorderPals: - ld hl, .PalPacketPointerTable + ld hl, .PacketPointerTable ld c, 9 .loop push bc @@ -959,27 +959,27 @@ _InitSGBBorderPals: jr nz, .loop ret -.PalPacketPointerTable: - dw PalPacket_9d56 - dw PalPacket_9d76 - dw PalPacket_9d86 - dw PalPacket_9d96 - dw PalPacket_9da6 - dw PalPacket_9db6 - dw PalPacket_9dc6 - dw PalPacket_9dd6 - dw PalPacket_9de6 +.PacketPointerTable: + dw MaskEnFreezePacket + dw DataSndPacket1 + dw DataSndPacket2 + dw DataSndPacket3 + dw DataSndPacket4 + dw DataSndPacket5 + dw DataSndPacket6 + dw DataSndPacket7 + dw DataSndPacket8 Unreferenced_Function9911: di xor a ld [rJOYP], a - ld hl, PalPacket_9d56 + ld hl, MaskEnFreezePacket call PushSGBPals call PushSGBBorder call SGBDelayCycles call SGB_ClearVRAM - ld hl, PalPacket_9d66 + ld hl, MaskEnCancelPacket call PushSGBPals ei ret @@ -1005,7 +1005,7 @@ SGB_ClearVRAM: ret PushSGBBorderPalsAndWait: - ld hl, PalPacket_9d26 + ld hl, MltReq2Packet call PushSGBPals call SGBDelayCycles ld a, [rJOYP] @@ -1050,7 +1050,7 @@ endr ret .FinalPush: - ld hl, PalPacket_9d16 + ld hl, MltReq1Packet call PushSGBPals jp SGBDelayCycles @@ -1065,7 +1065,7 @@ SGBBorder_PushBGPals: call DrawDefaultTiles ld a, LCDC_DEFAULT ld [rLCDC], a - ld hl, PalPacket_9d06 + ld hl, PalTrnPacket call PushSGBPals xor a ld [rBGP], a @@ -1099,7 +1099,7 @@ SGBBorder_MorePalPushing: call DrawDefaultTiles ld a, LCDC_DEFAULT ld [rLCDC], a - ld hl, PalPacket_9d46 + ld hl, PctTrnPacket call PushSGBPals xor a ld [rBGP], a @@ -1123,7 +1123,7 @@ SGBBorder_YetMorePalPushing: call DrawDefaultTiles ld a, LCDC_DEFAULT ld [rLCDC], a - ld hl, PalPacket_9d36 + ld hl, ChrTrnPacket call PushSGBPals xor a ld [rBGP], a @@ -1188,8 +1188,8 @@ SGBDelayCycles: ret INCLUDE "gfx/sgb/blk_packets.asm" - INCLUDE "gfx/sgb/pal_packets.asm" +INCLUDE "gfx/sgb/data_snd_packets.asm" PredefPals: INCLUDE "gfx/sgb/predef.pal" diff --git a/engine/sgb_layouts.asm b/engine/sgb_layouts.asm index ac02b2376..79c2f1aa9 100644 --- a/engine/sgb_layouts.asm +++ b/engine/sgb_layouts.asm @@ -113,22 +113,22 @@ LoadSGBLayout: ; 864c call GetBattlemonBackpicPalettePointer ld a, [hli] - ld [wSGBPals + $13], a + ld [wSGBPals + 19], a ld a, [hli] - ld [wSGBPals + $14], a + ld [wSGBPals + 20], a ld a, [hli] - ld [wSGBPals + $15], a + ld [wSGBPals + 21], a ld a, [hl] - ld [wSGBPals + $16], a + ld [wSGBPals + 22], a call GetEnemyFrontpicPalettePointer ld a, [hli] - ld [wSGBPals + $19], a + ld [wSGBPals + 25], a ld a, [hli] - ld [wSGBPals + $1a], a + ld [wSGBPals + 26], a ld a, [hli] - ld [wSGBPals + $1b], a + ld [wSGBPals + 27], a ld a, [hl] - ld [wSGBPals + $1c], a + ld [wSGBPals + 28], a ld hl, wSGBPals ld de, wSGBPals + $10 @@ -210,13 +210,13 @@ LoadSGBLayout: ; 864c ld bc, $10 call CopyBytes ld hl, wSGBPals + 3 - ld [hl], $9f + ld [hl], LOW(palred 31 + palgreen 20 + palblue 10) inc hl - ld [hl], $2a + ld [hl], HIGH(palred 31 + palgreen 20 + palblue 10) inc hl - ld [hl], $5a + ld [hl], LOW(palred 26 + palgreen 10 + palblue 6) inc hl - ld [hl], $19 + ld [hl], HIGH(palred 26 + palgreen 10 + palblue 6) ld a, [CurPartySpecies] call GetMonPalettePointer_ ld a, [hli] @@ -238,13 +238,13 @@ LoadSGBLayout: ; 864c ld bc, $10 call CopyBytes ld hl, wSGBPals + 3 - ld [hl], $9f + ld [hl], LOW(palred 31 + palgreen 20 + palblue 10) inc hl - ld [hl], $2a + ld [hl], HIGH(palred 31 + palgreen 20 + palblue 10) inc hl - ld [hl], $5a + ld [hl], LOW(palred 26 + palgreen 10 + palblue 6) inc hl - ld [hl], $19 + ld [hl], HIGH(palred 26 + palgreen 10 + palblue 6) ld a, [CurPartySpecies] ld bc, TempMonDVs call GetPlayerOrMonPalettePointer @@ -273,13 +273,13 @@ LoadSGBLayout: ; 864c ld bc, $10 call CopyBytes ld hl, wSGBPals + 3 - ld [hl], $9f + ld [hl], LOW(palred 31 + palgreen 20 + palblue 10) inc hl - ld [hl], $2a + ld [hl], HIGH(palred 31 + palgreen 20 + palblue 10) inc hl - ld [hl], $5a + ld [hl], LOW(palred 26 + palgreen 10 + palblue 6) inc hl - ld [hl], $19 + ld [hl], HIGH(palred 26 + palgreen 10 + palblue 6) ld hl, wSGBPals ld de, BlkPacket_9a86 ret @@ -579,19 +579,19 @@ endr ret .route - ld a, $00 + ld a, PREDEFPAL_00 ret .cave - ld a, $18 + ld a, PREDEFPAL_18 ret .perm5 - ld a, $06 + ld a, PREDEFPAL_06 ret .gate - ld a, $03 + ld a, PREDEFPAL_03 ret ; 8a45 -- cgit v1.2.3 From c5d9ecae9c343677150273b810703a1fd8d9d87a Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 17 Jan 2018 22:48:57 -0500 Subject: More SGB documentation --- engine/cgb_layouts.asm | 2 +- engine/sgb_layouts.asm | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'engine') diff --git a/engine/cgb_layouts.asm b/engine/cgb_layouts.asm index 43e0d6e12..e87297828 100644 --- a/engine/cgb_layouts.asm +++ b/engine/cgb_layouts.asm @@ -767,7 +767,7 @@ _CGB_TrainerCard: ; 9289 _CGB_MoveList: ; 9373 ld de, wBGPals1 - ld a, PREDEFPAL_10 + ld a, PREDEFPAL_GOLDENROD call GetPredefPal call LoadHLPaletteIntoDE ld a, [PlayerHPPal] diff --git a/engine/sgb_layouts.asm b/engine/sgb_layouts.asm index 79c2f1aa9..faad5e672 100644 --- a/engine/sgb_layouts.asm +++ b/engine/sgb_layouts.asm @@ -555,7 +555,7 @@ endr ld a, [TimeOfDayPal] cp NITE_F jr c, .morn_day - ld a, $19 + ld a, PREDEFPAL_NITE ret .morn_day @@ -583,15 +583,15 @@ endr ret .cave - ld a, PREDEFPAL_18 + ld a, PREDEFPAL_DUNGEONS ret .perm5 - ld a, PREDEFPAL_06 + ld a, PREDEFPAL_VERMILION ret .gate - ld a, PREDEFPAL_03 + ld a, PREDEFPAL_PEWTER ret ; 8a45 -- cgit v1.2.3 From 0306e94cc3365fb7b28e3bb6e1ccccb1e6b8b449 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 18 Jan 2018 00:16:03 -0500 Subject: More SGB documentation --- engine/cgb_layouts.asm | 90 +++++++++++++++++++------------------- engine/color.asm | 20 ++++----- engine/sgb_layouts.asm | 116 ++++++++++++++++++++++++------------------------- 3 files changed, 113 insertions(+), 113 deletions(-) (limited to 'engine') diff --git a/engine/cgb_layouts.asm b/engine/cgb_layouts.asm index e87297828..908762520 100644 --- a/engine/cgb_layouts.asm +++ b/engine/cgb_layouts.asm @@ -40,12 +40,12 @@ LoadSGBLayoutCGB: ; 8d59 dw _CGB_Pokedex dw _CGB_SlotMachine dw _CGB06 - dw _CGB07 + dw _CGB_GSIntro dw _CGB_Diploma dw _CGB_MapPals dw _CGB_PartyMenu dw _CGB_Evolution - dw _CGB0c + dw _CGB_GSTitleScreen dw _CGB0d dw _CGB_MoveList dw _CGB0f @@ -58,7 +58,7 @@ LoadSGBLayoutCGB: ; 8d59 dw _CGB_PokedexUnownMode dw _CGB_BillsPC dw _CGB_UnownPuzzle - dw _CGB_GamefreakLogo ; called before copyright + dw _CGB_GamefreakLogo dw _CGB_PlayerOrMonFrontpicPals dw _CGB_TradeTube dw _CGB_TrainerOrMonFrontpicPals @@ -67,15 +67,15 @@ LoadSGBLayoutCGB: ; 8d59 ; 8db8 _CGB_BattleGrayscale: ; 8db8 - ld hl, PalPacket_9c66 + 1 + ld hl, PalPacket_BattleGrayscale + 1 ld de, wBGPals1 ld c, 4 call CopyPalettes - ld hl, PalPacket_9c66 + 1 + ld hl, PalPacket_BattleGrayscale + 1 ld de, wBGPals1 palette PAL_BATTLE_BG_EXP ld c, 4 call CopyPalettes - ld hl, PalPacket_9c66 + 1 + ld hl, PalPacket_BattleGrayscale + 1 ld de, wOBPals1 ld c, 2 call CopyPalettes @@ -267,7 +267,7 @@ INCLUDE "gfx/stats/stats.pal" _CGB_Pokedex: ; 8f70 ld de, wBGPals1 - ld a, PREDEFPAL_1D + ld a, PREDEFPAL_POKEDEX call GetPredefPal call LoadHLPaletteIntoDE ; dex interface palette ld a, [CurPartySpecies] @@ -309,7 +309,7 @@ INCLUDE "gfx/pokedex/cursor.pal" _CGB_BillsPC: ; 8fca ld de, wBGPals1 - ld a, PREDEFPAL_1D + ld a, PREDEFPAL_POKEDEX call GetPredefPal call LoadHLPaletteIntoDE ld a, [CurPartySpecies] @@ -366,7 +366,7 @@ INCLUDE "gfx/pc/orange.pal" _CGB_PokedexUnownMode: ; 903e ld de, wBGPals1 - ld a, PREDEFPAL_1D + ld a, PREDEFPAL_POKEDEX call GetPredefPal call LoadHLPaletteIntoDE ld a, [CurPartySpecies] @@ -440,11 +440,11 @@ _CGB_SlotMachine: ; 906e ; 90f8 _CGB06: ; 90f8 - ld hl, PalPacket_9ca6 + 1 + ld hl, PalPacket_SCGB_06 + 1 call CopyFourPalettes call WipeAttrMap ld de, wOBPals1 - ld a, PREDEFPAL_3C + ld a, PREDEFPAL_GS_INTRO_CHARIZARD_BG call GetPredefPal call LoadHLPaletteIntoDE hlcoord 0, 6, AttrMap @@ -458,7 +458,7 @@ _CGB06: ; 90f8 ret ; 9122 -_CGB07: ; 9122 +_CGB_GSIntro: ; 9122 ld b, 0 ld hl, .Jumptable add hl, bc @@ -470,16 +470,16 @@ _CGB07: ; 9122 ; 912d .Jumptable: ; 912d - dw .Function9133 - dw .Function9166 - dw .Function9180 + dw .ShellderLaprasScene + dw .JigglypuffPikachuScene + dw .StartersCharizardScene ; 9133 -.Function9133: ; 9133 - ld hl, .Palette_914e +.ShellderLaprasScene: ; 9133 + ld hl, .ShellderLaprasBGPalette ld de, wBGPals1 call LoadHLPaletteIntoDE - ld hl, .Palette_9156 + ld hl, .ShellderLaprasOBPals ld de, wOBPals1 ld bc, 2 palettes ld a, BANK(wOBPals1) @@ -488,13 +488,13 @@ _CGB07: ; 9122 ret ; 914e -.Palette_914e: ; 914e +.ShellderLaprasBGPalette: ; 914e RGB 19, 31, 19 RGB 18, 23, 31 RGB 11, 21, 28 RGB 04, 16, 24 -.Palette_9156: ; 9156 +.ShellderLaprasOBPals: ; 9156 RGB 29, 29, 29 RGB 20, 19, 20 RGB 19, 06, 04 @@ -506,25 +506,25 @@ _CGB07: ; 9122 RGB 03, 04, 06 ; 9166 -.Function9166: ; 9166 +.JigglypuffPikachuScene: ; 9166 ld de, wBGPals1 - ld a, PREDEFPAL_38 + ld a, PREDEFPAL_GS_INTRO_JIGGLYPUFF_PIKACHU_BG call GetPredefPal call LoadHLPaletteIntoDE ld de, wOBPals1 - ld a, PREDEFPAL_39 + ld a, PREDEFPAL_GS_INTRO_JIGGLYPUFF_PIKACHU_OB call GetPredefPal call LoadHLPaletteIntoDE call WipeAttrMap ret ; 9180 -.Function9180: ; 9180 - ld hl, PalPacket_9c36 + 1 +.StartersCharizardScene: ; 9180 + ld hl, PalPacket_Pack + 1 call CopyFourPalettes ld de, wOBPals1 - ld a, PREDEFPAL_3A + ld a, PREDEFPAL_GS_INTRO_CHARIZARD_OB call GetPredefPal call LoadHLPaletteIntoDE call WipeAttrMap @@ -532,7 +532,7 @@ _CGB07: ; 9122 ; 9195 _CGB11: ; 9195 - ld hl, Palettes_b789 + ld hl, Palettes_SCGB_11 ld de, wBGPals1 ld bc, 5 palettes ld a, BANK(wBGPals1) @@ -550,7 +550,7 @@ _CGB_Diploma: ; 91ad ld a, BANK(wBGPals1) call FarCopyWRAM - ld hl, PalPacket_9cb6 + 1 + ld hl, PalPacket_Diploma + 1 call CopyFourPalettes call WipeAttrMap call ApplyAttrMap @@ -565,7 +565,7 @@ _CGB_MapPals: ; 91c8 ; 91d1 _CGB_PartyMenu: ; 91d1 - ld hl, PalPacket_9c56 + 1 + ld hl, PalPacket_PartyMenu + 1 call CopyFourPalettes call InitPartyMenuBGPal0 call InitPartyMenuBGPal7 @@ -579,7 +579,7 @@ _CGB_Evolution: ; 91e4 ld a, c and a jr z, .pokemon - ld a, PREDEFPAL_1A + ld a, PREDEFPAL_BLACKOUT call GetPredefPal call LoadHLPaletteIntoDE jr .got_palette @@ -609,13 +609,13 @@ _CGB_Evolution: ; 91e4 ret ; 9228 -_CGB0c: ; 9228 - ld hl, Palettes_b6f1 +_CGB_GSTitleScreen: ; 9228 + ld hl, UnusedGSTitleBGPals ld de, wBGPals1 ld bc, 5 palettes ld a, BANK(wBGPals1) call FarCopyWRAM - ld hl, Palettes_b719 + ld hl, UnusedGSTitleOBPals ld de, wOBPals1 ld bc, 2 palettes ld a, BANK(wOBPals1) @@ -629,7 +629,7 @@ _CGB0c: ; 9228 ; 9251 _CGB0d: ; 9251 - ld hl, PalPacket_9cb6 + 1 + ld hl, PalPacket_Diploma + 1 call CopyFourPalettes call WipeAttrMap call ApplyAttrMap @@ -637,10 +637,10 @@ _CGB0d: ; 9251 ; 925e _CGB_UnownPuzzle: ; 925e - ld hl, PalPacket_9bc6 + 1 + ld hl, PalPacket_UnownPuzzle + 1 call CopyFourPalettes ld de, wOBPals1 - ld a, PREDEFPAL_4C + ld a, PREDEFPAL_UNOWN_PUZZLE call GetPredefPal call LoadHLPaletteIntoDE ld a, [rSVBK] @@ -648,9 +648,9 @@ _CGB_UnownPuzzle: ; 925e ld a, BANK(wOBPals1) ld [rSVBK], a ld hl, wOBPals1 - ld a, $1f + ld a, LOW(palred 31 + palgreen 0 + palblue 0) ld [hli], a - ld a, $0 + ld a, HIGH(palred 31 + palgreen 0 + palblue 0) ld [hl], a pop af ld [rSVBK], a @@ -685,7 +685,7 @@ _CGB_TrainerCard: ; 9289 ld a, PRYCE call GetTrainerPalettePointer call LoadPalette_White_Col1_Col2_Black - ld a, PREDEFPAL_24 + ld a, PREDEFPAL_BADGE call GetPredefPal call LoadHLPaletteIntoDE @@ -791,7 +791,7 @@ _CGB_MoveList: ; 9373 ; 93a6 _CGB0f: ; 93a6 - ld hl, PalPacket_9c46 + 1 + ld hl, PalPacket_SCGB_0F + 1 call CopyFourPalettes call WipeAttrMap call ApplyAttrMap @@ -803,7 +803,7 @@ _CGB0f: ; 93a6 _CGB_PokedexSearchOption: ; 93ba ld de, wBGPals1 - ld a, PREDEFPAL_1D + ld a, PREDEFPAL_POKEDEX call GetPredefPal call LoadHLPaletteIntoDE call WipeAttrMap @@ -907,7 +907,7 @@ _CGB_Pokepic: ; 9499 ; 94d0 _CGB13: ; 94d0 - ld hl, PalPacket_9ba6 + 1 + ld hl, PalPacket_SCGB_13 + 1 call CopyFourPalettes call WipeAttrMap hlcoord 0, 4, AttrMap @@ -927,7 +927,7 @@ _CGB13: ; 94d0 _CGB_GamefreakLogo: ; 94fa ld de, wBGPals1 - ld a, PREDEFPAL_4E + ld a, PREDEFPAL_GAMEFREAK_LOGO call GetPredefPal call LoadHLPaletteIntoDE ld hl, .Palette @@ -969,7 +969,7 @@ _CGB1e: ; 9542 ; 9555 _CGB_TradeTube: ; 9555 - ld hl, PalPacket_9cc6 + 1 + ld hl, PalPacket_TradeTube + 1 call CopyFourPalettes ld hl, PartyMenuOBPals ld de, wOBPals1 @@ -977,7 +977,7 @@ _CGB_TradeTube: ; 9555 ld a, BANK(wOBPals1) call FarCopyWRAM ld de, wOBPals1 palette 7 - ld a, PREDEFPAL_1C + ld a, PREDEFPAL_TRADE_TUBE call GetPredefPal call LoadHLPaletteIntoDE call WipeAttrMap diff --git a/engine/color.asm b/engine/color.asm index 7a237b6be..5dea3311a 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -101,7 +101,7 @@ Unreferenced_Function8aa4: ret InitPartyMenuPalettes: - ld hl, PalPacket_9c56 + 1 + ld hl, PalPacket_PartyMenu + 1 call CopyFourPalettes call InitPartyMenuOBPals call WipeAttrMap @@ -182,7 +182,7 @@ Unreferenced_Function8b4d: ld a, [hSGB] and a ret z - ld hl, PalPacket_9c26 + ld hl, PalPacket_Function8b4d jp PushSGBPals_ .cgb @@ -197,12 +197,12 @@ Unreferenced_Function8b67: ld a, [hSGB] and a ret z - ld hl, PalPacket_9c36 + ld hl, PalPacket_Pack jp PushSGBPals_ .cgb ld de, wOBPals1 - ld a, PREDEFPAL_3C + ld a, PREDEFPAL_GS_INTRO_CHARIZARD_BG call GetPredefPal jp LoadHLPaletteIntoDE @@ -765,7 +765,7 @@ Unreferenced_Function97cc: ret z ld a, $90 ld [rOBPI], a - ld a, PREDEFPAL_1C + ld a, PREDEFPAL_TRADE_TUBE call GetPredefPal call .PushPalette ld a, PREDEFPAL_21 @@ -1342,11 +1342,11 @@ INCLUDE "gfx/diploma/diploma.pal" PartyMenuOBPals: INCLUDE "gfx/icons/party_menu.pal" -Palettes_b6f1: -INCLUDE "gfx/unknown/b6f1.pal" +UnusedGSTitleBGPals: +INCLUDE "gfx/title/unused_gs_bg.pal" -Palettes_b719: -INCLUDE "gfx/unknown/b719.pal" +UnusedGSTitleOBPals: +INCLUDE "gfx/title/unused_gs_fg.pal" MalePokegearPals: INCLUDE "gfx/pokegear/pokegear.pal" @@ -1354,7 +1354,7 @@ INCLUDE "gfx/pokegear/pokegear.pal" FemalePokegearPals: INCLUDE "gfx/pokegear/pokegear_f.pal" -Palettes_b789: +Palettes_SCGB_11: INCLUDE "gfx/unknown/b789.pal" SlotMachinePals: diff --git a/engine/sgb_layouts.asm b/engine/sgb_layouts.asm index faad5e672..a2d0201a2 100644 --- a/engine/sgb_layouts.asm +++ b/engine/sgb_layouts.asm @@ -30,12 +30,12 @@ LoadSGBLayout: ; 864c dw .SGB_Pokedex dw .SGB_SlotMachine dw .SGB06 - dw .SGB07 + dw .SGB_GSIntro dw .SGB_Diploma dw .SGB_MapPals dw .SGB_PartyMenu dw .SGB_Evolution - dw .SGB0c + dw .SGB_GSTitleScreen dw .SGB0d dw .SGB_MoveList dw .SGB0f @@ -48,7 +48,7 @@ LoadSGBLayout: ; 864c dw .SGB_PokedexUnownMode dw .SGB_BillsPC dw .SGB_UnownPuzzle - dw .SGB19 + dw .SGB_GamefreakLogo dw .SGB_PlayerOrMonFrontpicPals dw .SGB_TradeTube dw .SGB_TrainerOrMonFrontpicPals @@ -57,18 +57,18 @@ LoadSGBLayout: ; 864c ; 86ad .SGB_BattleGrayscale: ; 86ad - ld hl, PalPacket_9c66 - ld de, BlkPacket_9aa6 + ld hl, PalPacket_BattleGrayscale + ld de, BlkPacket_Battle ret ; 86b4 .SGB_BattleColors: ; 86b4 - ld hl, BlkPacket_9aa6 + ld hl, BlkPacket_Battle call PushSGBPals_ ld hl, PalPacket_9ce6 ld de, wSGBPals - ld bc, $10 + ld bc, PALPACKET_LENGTH call CopyBytes ld a, [PlayerHPPal] @@ -106,8 +106,8 @@ LoadSGBLayout: ; 864c ld [wSGBPals + 12], a ld hl, PalPacket_9cf6 - ld de, wSGBPals + $10 - ld bc, $10 + ld de, wSGBPals + PALPACKET_LENGTH + ld bc, PALPACKET_LENGTH call CopyBytes call GetBattlemonBackpicPalettePointer @@ -131,7 +131,7 @@ LoadSGBLayout: ; 864c ld [wSGBPals + 28], a ld hl, wSGBPals - ld de, wSGBPals + $10 + ld de, wSGBPals + PALPACKET_LENGTH ld a, SCGB_BATTLE_COLORS ld [SGBPredef], a ret @@ -140,7 +140,7 @@ LoadSGBLayout: ; 864c .SGB_MoveList: ; 873c ld hl, PalPacket_9bd6 ld de, wSGBPals - ld bc, $10 + ld bc, PALPACKET_LENGTH call CopyBytes ld hl, wSGBPals + 1 @@ -149,15 +149,15 @@ LoadSGBLayout: ; 864c inc hl ld a, [PlayerHPPal] - add $2f + add PREDEFPAL_HP_GREEN ld [hl], a ld hl, wSGBPals - ld de, BlkPacket_9ad6 + ld de, BlkPacket_MoveList ret ; 875c .SGB_PokegearPals: ; 875c - ld hl, PalPacket_9c76 + ld hl, PalPacket_Pokegear ld de, BlkPacket_9a86 ret ; 8763 @@ -165,7 +165,7 @@ LoadSGBLayout: ; 864c .SGB_StatsScreenHPPals: ; 8763 ld hl, PalPacket_9ce6 ld de, wSGBPals - ld bc, $10 + ld bc, PALPACKET_LENGTH call CopyBytes ld a, [wCurHPPal] ld l, a @@ -194,12 +194,12 @@ LoadSGBLayout: ; 864c ld a, [hl] ld [wSGBPals + 12], a ld hl, wSGBPals - ld de, BlkPacket_9ac6 + ld de, BlkPacket_StatsScreen ret ; 87ab .SGB_PartyMenu: ; 87ab - ld hl, PalPacket_9c56 + ld hl, PalPacket_PartyMenu ld de, wSGBPals + 1 ret ; 87b2 @@ -207,7 +207,7 @@ LoadSGBLayout: ; 864c .SGB_Pokedex: ; 87b2 ld hl, PalPacket_9ce6 ld de, wSGBPals - ld bc, $10 + ld bc, PALPACKET_LENGTH call CopyBytes ld hl, wSGBPals + 3 ld [hl], LOW(palred 31 + palgreen 20 + palblue 10) @@ -228,14 +228,14 @@ LoadSGBLayout: ; 864c ld a, [hl] ld [wSGBPals + 12], a ld hl, wSGBPals - ld de, BlkPacket_9ae6 + ld de, BlkPacket_Pokedex_PC ret ; 87e9 .SGB_BillsPC: ; 87e9 ld hl, PalPacket_9ce6 ld de, wSGBPals - ld bc, $10 + ld bc, PALPACKET_LENGTH call CopyBytes ld hl, wSGBPals + 3 ld [hl], LOW(palred 31 + palgreen 20 + palblue 10) @@ -257,20 +257,20 @@ LoadSGBLayout: ; 864c ld a, [hl] ld [wSGBPals + 12], a ld hl, wSGBPals - ld de, BlkPacket_9ae6 + ld de, BlkPacket_Pokedex_PC ret ; 8823 .SGB_PokedexUnownMode: ; 8823 call .SGB_Pokedex - ld de, BlkPacket_9af6 + ld de, BlkPacket_PokedexUnownMode ret ; 882a .SGB_PokedexSearchOption: ; 882a ld hl, PalPacket_9ce6 ld de, wSGBPals - ld bc, $10 + ld bc, PALPACKET_LENGTH call CopyBytes ld hl, wSGBPals + 3 ld [hl], LOW(palred 31 + palgreen 20 + palblue 10) @@ -286,33 +286,33 @@ LoadSGBLayout: ; 864c ; 884b .SGB_PackPals: ; 884b - ld hl, PalPacket_9c36 + ld hl, PalPacket_Pack ld de, BlkPacket_9a86 ret ; 8852 .SGB_SlotMachine: ; 8852 - ld hl, PalPacket_9c96 - ld de, BlkPacket_9b06 + ld hl, PalPacket_SlotMachine + ld de, BlkPacket_SlotMachine ret ; 8859 .SGB06: ; 8859 - ld hl, PalPacket_9ca6 - ld de, BlkPacket_9b76 + ld hl, PalPacket_SCGB_06 + ld de, BlkPacket_SCGB_06 ret ; 8860 .SGB_Diploma: .SGB_MysteryGift: ; 8860 - ld hl, PalPacket_9cb6 + ld hl, PalPacket_Diploma ld de, BlkPacket_9a86 ret ; 8867 -.SGB07: ; 8867 +.SGB_GSIntro: ; 8867 ld b, 0 - ld hl, .BlkPacketTable_SGB07 + ld hl, .BlkPacketTable_GSIntro rept 4 add hl, bc endr @@ -326,38 +326,38 @@ endr ret ; 8878 -.BlkPacketTable_SGB07: ; 8878 - dw BlkPacket_9a86, PalPacket_9be6 - dw BlkPacket_9a96, PalPacket_9c06 - dw BlkPacket_9a86, PalPacket_9c16 +.BlkPacketTable_GSIntro: ; 8878 + dw BlkPacket_9a86, PalPacket_GSIntroShellderLapras + dw BlkPacket_GSIntroJigglypuffPikachu, PalPacket_GSIntroJigglypuffPikachu + dw BlkPacket_9a86, PalPacket_GSIntroCharizard ; 8884 -.SGB0c: ; 8884 - ld hl, PalPacket_9b96 - ld de, BlkPacket_9b56 +.SGB_GSTitleScreen: ; 8884 + ld hl, PalPacket_GSTitleScreen + ld de, BlkPacket_GSTitleScreen ld a, SCGB_DIPLOMA ld [SGBPredef], a ret ; 8890 .SGB13: ; 8890 - ld hl, PalPacket_9ba6 - ld de, BlkPacket_9b86 + ld hl, PalPacket_SCGB_13 + ld de, BlkPacket_SCGB_13 ret ; 8897 .SGB0f: ; 8897 - ld hl, PalPacket_9c46 + ld hl, PalPacket_SCGB_0F ld de, BlkPacket_9a86 ret ; 889e .SGB11: ; 889e ld hl, BlkPacket_9a86 - ld de, PlayerLightScreenCount - ld bc, $10 + ld de, PlayerLightScreenCount ; ??? + ld bc, PALPACKET_LENGTH call CopyBytes - ld hl, PalPacket_9bb6 + ld hl, PalPacket_SCGB_11 ld de, BlkPacket_9a86 ret ; 88b1 @@ -365,7 +365,7 @@ endr .SGB_MapPals: ; 88b1 ld hl, PalPacket_9bd6 ld de, wSGBPals - ld bc, $10 + ld bc, PALPACKET_LENGTH call CopyBytes call .GetMapPalsIndex ld hl, wSGBPals + 1 @@ -380,7 +380,7 @@ endr push bc ld hl, PalPacket_9ce6 ld de, wSGBPals - ld bc, $10 + ld bc, PALPACKET_LENGTH call CopyBytes pop bc ld a, c @@ -423,13 +423,13 @@ endr .SGB0d: .SGB_TrainerCard: ; 891a - ld hl, PalPacket_9cb6 + ld hl, PalPacket_Diploma ld de, BlkPacket_9a86 ret ; 8921 .SGB_UnownPuzzle: ; 8921 - ld hl, PalPacket_9bc6 + ld hl, PalPacket_UnownPuzzle ld de, BlkPacket_9a86 ret ; 8928 @@ -437,11 +437,11 @@ endr .SGB12: ; 8928 ld hl, PalPacket_9bd6 ld de, wSGBPals - ld bc, $10 + ld bc, PALPACKET_LENGTH call CopyBytes ld hl, BlkPacket_9a86 - ld de, wSGBPals + $10 - ld bc, $10 + ld de, wSGBPals + PALPACKET_LENGTH + ld bc, PALPACKET_LENGTH call CopyBytes call .GetMapPalsIndex ld hl, wSGBPals + 1 @@ -460,14 +460,14 @@ endr ld a, [wMenuBorderBottomCoord] ld [hl], a ld hl, wSGBPals - ld de, wSGBPals + $10 + ld de, wSGBPals + PALPACKET_LENGTH ret ; 8969 .SGB1e: ; 8969 ld hl, PalPacket_9ce6 ld de, wSGBPals - ld bc, $10 + ld bc, PALPACKET_LENGTH call CopyBytes ld a, [CurPartySpecies] ld l, a @@ -497,8 +497,8 @@ endr ret ; 89a6 -.SGB19: ; 89a6 - ld hl, PalPacket_9cd6 +.SGB_GamefreakLogo: ; 89a6 + ld hl, PalPacket_GamefreakLogo ld de, BlkPacket_9a86 ret ; 89ad @@ -506,7 +506,7 @@ endr .SGB_PlayerOrMonFrontpicPals: ; 89ad ld hl, PalPacket_9ce6 ld de, wSGBPals - ld bc, $10 + ld bc, PALPACKET_LENGTH call CopyBytes ld a, [CurPartySpecies] ld bc, TempMonDVs @@ -525,7 +525,7 @@ endr ; 89d9 .SGB_TradeTube: ; 89d9 - ld hl, PalPacket_9cc6 + ld hl, PalPacket_TradeTube ld de, BlkPacket_9a86 ret ; 89e0 @@ -533,7 +533,7 @@ endr .SGB_TrainerOrMonFrontpicPals: ; 89e0 ld hl, PalPacket_9ce6 ld de, wSGBPals - ld bc, $10 + ld bc, PALPACKET_LENGTH call CopyBytes ld a, [CurPartySpecies] ld bc, TempMonDVs -- cgit v1.2.3 From 23f2c056e8286f2a5d43b88eeb84c6afa229c134 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 18 Jan 2018 00:57:06 -0500 Subject: Heal machine jumptable index constants --- engine/events/heal_machine_anim.asm | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'engine') diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm index da3b845e5..067b2f554 100755 --- a/engine/events/heal_machine_anim.asm +++ b/engine/events/heal_machine_anim.asm @@ -1,3 +1,12 @@ +; Special_HealMachineAnim.Jumptable indexes + const_def + const HEALMACHINESTATE_LOADGFX + const HEALMACHINESTATE_PCLOADBALLS + const HEALMACHINESTATE_HOFLOADBALLS + const HEALMACHINESTATE_PLAYMUSIC + const HEALMACHINESTATE_HOFPLAYSFX + const HEALMACHINESTATE_FINISH + Special_HealMachineAnim: ; 12324 ; If you have no Pokemon, don't change the buffer. This can lead to some glitchy effects if you have no Pokemon. ld a, [PartyCount] @@ -36,7 +45,7 @@ Special_HealMachineAnim: ; 12324 ld [Buffer3], a add hl, de ld a, [hl] - cp 5 + cp HEALMACHINESTATE_FINISH jr z, .finish ld hl, .Jumptable rst JumpTable @@ -53,15 +62,23 @@ Special_HealMachineAnim: ; 12324 dw .HallOfFame ; 1236b +healmachineanimseq: MACRO +rept _NARG + db HEALMACHINESTATE_\1 + shift +endr +ENDM + .Pokecenter: ; 1236b - db 0, 1, 3, 5 + healmachineanimseq LOADGFX, PCLOADBALLS, PLAYMUSIC, FINISH .ElmLab: ; 1236f - db 0, 1, 3, 5 + healmachineanimseq LOADGFX, PCLOADBALLS, PLAYMUSIC, FINISH .HallOfFame: ; 12373 - db 0, 2, 4, 5 + healmachineanimseq LOADGFX, HOFLOADBALLS, HOFPLAYSFX, FINISH ; 12377 .Jumptable: ; 12377 +; entries correspond to HEALMACHINESTATE_* constants dw .LoadGFX dw .PC_LoadBallsOntoMachine dw .HOF_LoadBallsOntoMachine @@ -239,7 +256,7 @@ INCLUDE "gfx/overworld/heal_machine.pal" push bc ld a, [Buffer1] bcpixel 2, 4 - cp $1 ; ElmsLab + cp HEALMACHINE_ELMS_LAB jr z, .okay bcpixel 0, 0 -- cgit v1.2.3 From 95c0c31c8ff8e1149a9b959e04ea27e337e929b4 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 18 Jan 2018 01:25:19 -0500 Subject: Eliminate wd000 --- engine/color.asm | 6 +++--- engine/gbc_only.asm | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'engine') diff --git a/engine/color.asm b/engine/color.asm index 5dea3311a..827a49184 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -891,13 +891,13 @@ InitCGBPals:: call CheckCGB ret z ; CGB only - ld a, $1 + ld a, BANK(vTiles3) ld [rVBK], a - ld hl, vTiles0 + ld hl, vTiles3 ld bc, $200 tiles xor a call ByteFill - ld a, $0 + ld a, BANK(vTiles0) ld [rVBK], a ld a, 1 << rBGPI_AUTO_INCREMENT ld [rBGPI], a diff --git a/engine/gbc_only.asm b/engine/gbc_only.asm index b2207d436..9aa8a0d1a 100644 --- a/engine/gbc_only.asm +++ b/engine/gbc_only.asm @@ -10,16 +10,16 @@ GBCOnlyScreen: ; 4ea82 call ClearTileMap ld hl, GBCOnlyGFX - ld de, wd000 + ld de, wDecompressBuffer ld a, [rSVBK] push af - ld a, 0 ; this has the same effect as selecting bank 1 (http://gbdev.gg8.se/files/docs/mirrors/pandocs.html#videodisplay) + ld a, 0 ; this has the same effect as selecting bank 1 ld [rSVBK], a call Decompress pop af ld [rSVBK], a - ld de, wd000 + ld de, wDecompressBuffer ld hl, vTiles2 lb bc, BANK(GBCOnlyGFX), $54 call Get2bpp -- cgit v1.2.3 From 226d1812b34dad7ee0bb758c4c4970a731c9c79e Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 18 Jan 2018 11:16:24 -0500 Subject: Only graphics data goes in gfx/ Introduce PALRGB_WHITE constant for $7fff --- engine/color.asm | 18 +++++++++--------- engine/init_hof_credits.asm | 4 ++-- engine/sgb_layouts.asm | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'engine') diff --git a/engine/color.asm b/engine/color.asm index 827a49184..870dfd85b 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -514,10 +514,10 @@ LoadPalette_White_Col1_Col2_Black: ld a, BANK(wBGPals1) ld [rSVBK], a - ld a, LOW(palred 31 + palgreen 31 + palblue 31) + ld a, LOW(PALRGB_WHITE) ld [de], a inc de - ld a, HIGH(palred 31 + palgreen 31 + palblue 31) + ld a, HIGH(PALRGB_WHITE) ld [de], a inc de @@ -903,9 +903,9 @@ InitCGBPals:: ld [rBGPI], a ld c, 4 * 8 .bgpals_loop - ld a, LOW(palred 31 + palgreen 31 + palblue 31) + ld a, LOW(PALRGB_WHITE) ld [rBGPD], a - ld a, HIGH(palred 31 + palgreen 31 + palblue 31) + ld a, HIGH(PALRGB_WHITE) ld [rBGPD], a dec c jr nz, .bgpals_loop @@ -913,9 +913,9 @@ InitCGBPals:: ld [rOBPI], a ld c, 4 * 8 .obpals_loop - ld a, LOW(palred 31 + palgreen 31 + palblue 31) + ld a, LOW(PALRGB_WHITE) ld [rOBPD], a - ld a, HIGH(palred 31 + palgreen 31 + palblue 31) + ld a, HIGH(PALRGB_WHITE) ld [rOBPD], a dec c jr nz, .obpals_loop @@ -934,9 +934,9 @@ InitCGBPals:: .LoadWhitePals: ld c, 4 * 16 .loop - ld a, LOW(palred 31 + palgreen 31 + palblue 31) + ld a, LOW(PALRGB_WHITE) ld [hli], a - ld a, HIGH(palred 31 + palgreen 31 + palblue 31) + ld a, HIGH(PALRGB_WHITE) ld [hli], a dec c jr nz, .loop @@ -1189,7 +1189,7 @@ SGBDelayCycles: INCLUDE "gfx/sgb/blk_packets.asm" INCLUDE "gfx/sgb/pal_packets.asm" -INCLUDE "gfx/sgb/data_snd_packets.asm" +INCLUDE "data/sgb_ctrl_packets.asm" PredefPals: INCLUDE "gfx/sgb/predef.pal" diff --git a/engine/init_hof_credits.asm b/engine/init_hof_credits.asm index e72ae011c..d8eb7670a 100644 --- a/engine/init_hof_credits.asm +++ b/engine/init_hof_credits.asm @@ -46,9 +46,9 @@ InitDisplayForRedCredits: ; 4e8c2 ld hl, wBGPals1 ld c, 4 tiles .load_white_palettes - ld a, LOW(palred 31 + palgreen 31 + palblue 31) + ld a, LOW(PALRGB_WHITE) ld [hli], a - ld a, HIGH(palred 31 + palgreen 31 + palblue 31) + ld a, HIGH(PALRGB_WHITE) ld [hli], a dec c jr nz, .load_white_palettes diff --git a/engine/sgb_layouts.asm b/engine/sgb_layouts.asm index a2d0201a2..bc9f35c27 100644 --- a/engine/sgb_layouts.asm +++ b/engine/sgb_layouts.asm @@ -595,7 +595,7 @@ endr ret ; 8a45 -INCLUDE "gfx/sgb/roof_pal_inds.asm" +INCLUDE "data/maps/sgb_roof_pal_inds.asm" _LoadSGBLayout_ReturnFromJumpTable: ; 8a60 push de -- cgit v1.2.3 From 22fd1221f5189e9d1d4e1ebd2146f7aaf77f2e3a Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 18 Jan 2018 11:37:05 -0500 Subject: More .pal files --- engine/cgb_layouts.asm | 8 ++++---- engine/color.asm | 16 +++++----------- 2 files changed, 9 insertions(+), 15 deletions(-) (limited to 'engine') diff --git a/engine/cgb_layouts.asm b/engine/cgb_layouts.asm index 908762520..775db1b70 100644 --- a/engine/cgb_layouts.asm +++ b/engine/cgb_layouts.asm @@ -158,9 +158,9 @@ _CGB_FinishBattleScreenLayout: ; 8e23 InitPartyMenuBGPal7: ; 8e85 farcall Function100dc0 Mobile_InitPartyMenuBGPal7: ; 8e8b - ld hl, Palette_b311 + ld hl, PartyMenuBGPalette jr nc, .not_mobile - ld hl, Palette_b309 + ld hl, PartyMenuBGMobilePalette .not_mobile ld de, wBGPals1 palette 7 ld bc, 1 palettes @@ -171,9 +171,9 @@ Mobile_InitPartyMenuBGPal7: ; 8e8b InitPartyMenuBGPal0: ; 8e9f farcall Function100dc0 - ld hl, Palette_b311 + ld hl, PartyMenuBGPalette jr nc, .not_mobile - ld hl, Palette_b309 + ld hl, PartyMenuBGMobilePalette .not_mobile ld de, wBGPals1 palette 0 ld bc, 1 palettes diff --git a/engine/color.asm b/engine/color.asm index 870dfd85b..bdac2b97f 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -1315,17 +1315,11 @@ endr INCLUDE "data/maps/environment_colors.asm" -Palette_b309: ; b309 mobile - RGB 31, 31, 31 - RGB 31, 19, 24 - RGB 30, 10, 06 - RGB 00, 00, 00 +PartyMenuBGMobilePalette: +INCLUDE "gfx/stats/party_menu_bg_mobile.pal" -Palette_b311: ; b311 not mobile - RGB 31, 31, 31 - RGB 17, 19, 31 - RGB 14, 16, 31 - RGB 00, 00, 00 +PartyMenuBGPalette: +INCLUDE "gfx/stats/party_menu_bg.pal" TilesetBGPalette: INCLUDE "gfx/tilesets/bg_tiles.pal" @@ -1340,7 +1334,7 @@ DiplomaPalettes: INCLUDE "gfx/diploma/diploma.pal" PartyMenuOBPals: -INCLUDE "gfx/icons/party_menu.pal" +INCLUDE "gfx/stats/party_menu_ob.pal" UnusedGSTitleBGPals: INCLUDE "gfx/title/unused_gs_bg.pal" -- cgit v1.2.3 From f556ab9a4cce5e5164799c2f66eff41c986c508e Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 18 Jan 2018 12:03:58 -0500 Subject: Comment on RIVAL1 item --- engine/battle/core.asm | 1 + 1 file changed, 1 insertion(+) (limited to 'engine') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index e1c5f331f..189ebf195 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -8394,6 +8394,7 @@ InitEnemyTrainer: ; 3f594 callfar GetTrainerAttributes callfar ReadTrainerParty + ; RIVAL1's first mon has no held item ld a, [TrainerClass] cp RIVAL1 jr nz, .ok -- cgit v1.2.3 From 69ace7f48d441a0af3360a991ace8f70379e48dc Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 18 Jan 2018 12:31:19 -0500 Subject: Identify leftover SGB palettes from R/B --- engine/cgb_layouts.asm | 2 +- engine/color.asm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/cgb_layouts.asm b/engine/cgb_layouts.asm index 775db1b70..96289a4c7 100644 --- a/engine/cgb_layouts.asm +++ b/engine/cgb_layouts.asm @@ -685,7 +685,7 @@ _CGB_TrainerCard: ; 9289 ld a, PRYCE call GetTrainerPalettePointer call LoadPalette_White_Col1_Col2_Black - ld a, PREDEFPAL_BADGE + ld a, PREDEFPAL_CGB_BADGE call GetPredefPal call LoadHLPaletteIntoDE diff --git a/engine/color.asm b/engine/color.asm index bdac2b97f..d8814bf3a 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -768,7 +768,7 @@ Unreferenced_Function97cc: ld a, PREDEFPAL_TRADE_TUBE call GetPredefPal call .PushPalette - ld a, PREDEFPAL_21 + ld a, PREDEFPAL_RB_GREENMON call GetPredefPal call .PushPalette ret -- cgit v1.2.3 From 3bf8325edddb03753fa63f0dfb39cedcd1d2faca Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 18 Jan 2018 15:06:43 -0500 Subject: More accurate constant/label names --- engine/cgb_layouts.asm | 4 ++-- engine/color.asm | 2 +- engine/sgb_layouts.asm | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'engine') diff --git a/engine/cgb_layouts.asm b/engine/cgb_layouts.asm index 96289a4c7..84fb6c9de 100644 --- a/engine/cgb_layouts.asm +++ b/engine/cgb_layouts.asm @@ -444,7 +444,7 @@ _CGB06: ; 90f8 call CopyFourPalettes call WipeAttrMap ld de, wOBPals1 - ld a, PREDEFPAL_GS_INTRO_CHARIZARD_BG + ld a, PREDEFPAL_PACK call GetPredefPal call LoadHLPaletteIntoDE hlcoord 0, 6, AttrMap @@ -524,7 +524,7 @@ _CGB_GSIntro: ; 9122 ld hl, PalPacket_Pack + 1 call CopyFourPalettes ld de, wOBPals1 - ld a, PREDEFPAL_GS_INTRO_CHARIZARD_OB + ld a, PREDEFPAL_GS_INTRO_STARTERS_TRANSITION call GetPredefPal call LoadHLPaletteIntoDE call WipeAttrMap diff --git a/engine/color.asm b/engine/color.asm index d8814bf3a..d0dd0c3c8 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -202,7 +202,7 @@ Unreferenced_Function8b67: .cgb ld de, wOBPals1 - ld a, PREDEFPAL_GS_INTRO_CHARIZARD_BG + ld a, PREDEFPAL_PACK call GetPredefPal jp LoadHLPaletteIntoDE diff --git a/engine/sgb_layouts.asm b/engine/sgb_layouts.asm index bc9f35c27..5f2b8e12e 100644 --- a/engine/sgb_layouts.asm +++ b/engine/sgb_layouts.asm @@ -329,7 +329,7 @@ endr .BlkPacketTable_GSIntro: ; 8878 dw BlkPacket_9a86, PalPacket_GSIntroShellderLapras dw BlkPacket_GSIntroJigglypuffPikachu, PalPacket_GSIntroJigglypuffPikachu - dw BlkPacket_9a86, PalPacket_GSIntroCharizard + dw BlkPacket_9a86, PalPacket_GSIntroStartersTransition ; 8884 .SGB_GSTitleScreen: ; 8884 -- cgit v1.2.3 From 72c4f9e04a33925f99d685e68f580ee29f865e22 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 18 Jan 2018 15:58:55 -0500 Subject: More constants, related to map objects --- engine/map_objects.asm | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'engine') diff --git a/engine/map_objects.asm b/engine/map_objects.asm index 5899ba49d..30407c64d 100644 --- a/engine/map_objects.asm +++ b/engine/map_objects.asm @@ -2089,6 +2089,7 @@ SpawnShadow: ; 5529 ; vtile, palette, movement db $00, PAL_OW_SILVER, SPRITEMOVEDATA_SHADOW ; 5538 + SpawnStrengthBoulderDust: ; 5538 push bc ld de, .BoulderDustObject @@ -2100,6 +2101,7 @@ SpawnStrengthBoulderDust: ; 5538 .BoulderDustObject: db $00, PAL_OW_SILVER, SPRITEMOVEDATA_BOULDERDUST ; 5547 + SpawnEmote: ; 5547 push bc ld de, .EmoteObject @@ -2111,6 +2113,7 @@ SpawnEmote: ; 5547 .EmoteObject: db $00, PAL_OW_SILVER, SPRITEMOVEDATA_EMOTE ; 5556 + ShakeGrass: ; 5556 push bc ld de, .data_5562 @@ -2122,6 +2125,7 @@ ShakeGrass: ; 5556 .data_5562 db $00, PAL_OW_TREE, SPRITEMOVEDATA_GRASS ; 5565 + ShakeScreen: ; 5565 push bc push af @@ -2359,7 +2363,7 @@ Function56a3: ; 56a3 cp d jr z, .equal_x jr nc, .nope - add $b + add MAPOBJECT_SCREEN_WIDTH - 1 cp d jr c, .nope .equal_x @@ -2367,7 +2371,7 @@ Function56a3: ; 56a3 cp e jr z, .equal_y jr nc, .nope - add $a + add MAPOBJECT_SCREEN_HEIGHT - 1 cp e jr c, .nope .equal_y @@ -2406,7 +2410,7 @@ Function56cd: ; 56cd srl a cp SCREEN_WIDTH jr c, .ok3 - sub $20 + sub BG_MAP_WIDTH .ok3 ld [hUsedSpriteIndex], a ld a, [wPlayerBGMapOffsetY] @@ -2433,9 +2437,9 @@ Function56cd: ; 56cd srl a srl a srl a - cp $12 + cp SCREEN_HEIGHT jr c, .ok6 - sub $20 + sub BG_MAP_HEIGHT .ok6 ld [hUsedSpriteTile], a ld hl, OBJECT_PALETTE @@ -2457,21 +2461,21 @@ Function56cd: ; 56cd ld a, [hUsedSpriteTile] add e dec a - cp $12 + cp SCREEN_HEIGHT jr nc, .ok9 ld b, a .next ld a, [hUsedSpriteIndex] add d dec a - cp $14 + cp SCREEN_WIDTH jr nc, .ok8 ld c, a push bc call Coord2Tile pop bc ld a, [hl] - cp $60 + cp MAPOBJECT_VISIBLE_TILE_LIMIT jr nc, .nope .ok8 dec d @@ -2876,10 +2880,12 @@ ApplyBGMapAnchorToObjects: ; 5958 ret ; 5991 -InitSprites: ; 5991 + PRIORITY_LOW EQU $10 PRIORITY_NORM EQU $20 PRIORITY_HIGH EQU $30 + +InitSprites: ; 5991 call .DeterminePriorities ld c, PRIORITY_HIGH call .InitSpritesByPriority @@ -3069,7 +3075,7 @@ PRIORITY_HIGH EQU $30 ld a, [hFFC2] or e .nope2 - and %11110000 + and OBP_NUM | X_FLIP | Y_FLIP | PRIORITY or d ld [bc], a ; attributes inc c -- cgit v1.2.3 From 2acaa96cf16ce953a7149f300d54e5440abc27d8 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 18 Jan 2018 18:34:20 -0500 Subject: More charmap and home/text.asm documentation for JP chars --- engine/map_objects.asm | 4 +++- engine/radio.asm | 4 ++-- engine/routines/checknickerrors.asm | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'engine') diff --git a/engine/map_objects.asm b/engine/map_objects.asm index 30407c64d..00ce599e3 100644 --- a/engine/map_objects.asm +++ b/engine/map_objects.asm @@ -2474,8 +2474,10 @@ Function56cd: ; 56cd push bc call Coord2Tile pop bc +; NPCs disappear if standing on tile $60-$7f (or $e0-$ff), +; since those IDs are for text characters and textbox frames. ld a, [hl] - cp MAPOBJECT_VISIBLE_TILE_LIMIT + cp FIRST_REGULAR_TEXT_CHAR jr nc, .nope .ok8 dec d diff --git a/engine/radio.asm b/engine/radio.asm index bfc95404e..54da69255 100644 --- a/engine/radio.asm +++ b/engine/radio.asm @@ -134,7 +134,7 @@ PrintRadioLine: cp 2 jr nc, .print inc hl - ld [hl], "" + ld [hl], TX_START inc a ld [wNumRadioLinesPrinted], a cp 2 @@ -813,7 +813,7 @@ CopyDexEntryPart1: ld bc, SCREEN_WIDTH - 1 call FarCopyBytes ld hl, wPokedexShowPointerAddr - ld [hl], "" + ld [hl], TX_START inc hl ld [hl], "" inc hl diff --git a/engine/routines/checknickerrors.asm b/engine/routines/checknickerrors.asm index 1cedca420..65efd7b94 100644 --- a/engine/routines/checknickerrors.asm +++ b/engine/routines/checknickerrors.asm @@ -64,10 +64,10 @@ CheckNickErrors:: ; 669f ; table defining which characters are actually text commands ; format: ; ≥ < - db "", TX_BOX + 1 + db TX_START, TX_BOX + 1 db "", $18 + 1 - db $1d, "%" + 1 - db $35, "" + 1 + db "", "%" + 1 + db "", "" + 1 db "", "" + 1 db "", "" + 1 db "", "┘" + 1 -- cgit v1.2.3 From a3beba1e64bcdd71ade4595b37b033e74d87a78c Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 18 Jan 2018 20:40:32 -0500 Subject: Use Japanese charmap definitions in strings --- engine/debug.asm | 88 ++++++++++++++++++----------- engine/events/bug_contest/display_stats.asm | 4 +- engine/phone/phone.asm | 2 +- engine/start_menu.asm | 4 +- engine/trade_animation.asm | 14 +++-- 5 files changed, 71 insertions(+), 41 deletions(-) (limited to 'engine') diff --git a/engine/debug.asm b/engine/debug.asm index 710091779..dcfb1b4cf 100755 --- a/engine/debug.asm +++ b/engine/debug.asm @@ -1,3 +1,27 @@ +const_value set $6a + const DEBUGTEST_UP_ARROW ; $6a + const DEBUGTEST_TICKS ; $6b + const DEBUGTEST_WHITE ; $6c + const DEBUGTEST_LIGHT ; $6d + const DEBUGTEST_DARK ; $6e + const DEBUGTEST_BLACK ; $6f + const DEBUGTEST_0 ; $70 + const DEBUGTEST_1 ; $71 + const DEBUGTEST_2 ; $72 + const DEBUGTEST_3 ; $73 + const DEBUGTEST_4 ; $74 + const DEBUGTEST_5 ; $75 + const DEBUGTEST_6 ; $76 + const DEBUGTEST_7 ; $77 + const DEBUGTEST_8 ; $78 + const DEBUGTEST_9 ; $79 + const DEBUGTEST_A ; $7a + const DEBUGTEST_B ; $7b + const DEBUGTEST_C ; $7c + const DEBUGTEST_D ; $7d + const DEBUGTEST_E ; $7e + const DEBUGTEST_F ; $7f + ColorTest: ; 818ac ; A debug menu to test monster and trainer palettes at runtime. @@ -127,13 +151,13 @@ Function81948: ; 81948 ; 8197c Function8197c: ; 8197c - ld hl, DebugColorTestGFX + $10 - ld de, vTiles2 tile $6a - ld bc, $160 + ld hl, DebugColorTestGFX + 1 tiles + ld de, vTiles2 tile DEBUGTEST_UP_ARROW + ld bc, 22 tiles call CopyBytes ld hl, DebugColorTestGFX ld de, vTiles0 - ld bc, $10 + ld bc, 1 tiles call CopyBytes call LoadStandardFont ld hl, vTiles1 @@ -278,19 +302,19 @@ Function81adb: ; 81adb ld [hBGMapMode], a hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT - ld a, $6f + ld a, DEBUGTEST_BLACK call ByteFill hlcoord 1, 3 lb bc, 7, 18 - ld a, $6c + ld a, DEBUGTEST_WHITE call Bank20_FillBoxWithByte hlcoord 11, 0 lb bc, 2, 3 - ld a, $6d + ld a, DEBUGTEST_LIGHT call Bank20_FillBoxWithByte hlcoord 16, 0 lb bc, 2, 3 - ld a, $6e + ld a, DEBUGTEST_DARK call Bank20_FillBoxWithByte call Function81bc0 call Function81bf4 @@ -360,9 +384,9 @@ Function81adb: ; 81adb ret ; 81baf -String_81baf: db "レア", $6f, $6f, "@" ; rare (shiny) +String_81baf: db "レアぅぅ@" ; rare (shiny) String_81bb4: db "ノーマル@" ; normal -String_81bb9: db $7a, "きりかえ▶@" ; (A) switches +String_81bb9: db DEBUGTEST_A, "きりかえ▶@" ; (A) switches ; 81bc0 Function81bc0: ; 81bc0 @@ -380,10 +404,10 @@ Function81bc0: ; 81bc0 Function81bde: ; 81bde push af - ld a, $6a + ld a, DEBUGTEST_UP_ARROW ld [hli], a ld bc, $f - ld a, $6b + ld a, DEBUGTEST_TICKS call ByteFill ld l, e ld h, d @@ -458,11 +482,11 @@ Function81c33: ; 81c33 .asm_81c69 ld hl, wSGBPals - ld a, $1 + ld a, 1 ld [hli], a - ld a, $ff + ld a, LOW(PALRGB_WHITE) ld [hli], a - ld a, $7f + ld a, HIGH(PALRGB_WHITE) ld [hli], a ld a, [wc608] ld [hli], a @@ -506,7 +530,7 @@ Function81ca7: ; 81ca7 Function81cbc: ; 81cbc and $f - add $70 + add DEBUGTEST_0 ld [hld], a ret ; 81cc2 @@ -657,7 +681,7 @@ Function81d89: ; 81d89 Function81d8e: ; 81d8e hlcoord 0, 10 ld bc, $a0 - ld a, $6f + ld a, DEBUGTEST_BLACK call ByteFill hlcoord 2, 12 ld de, String_81fcd @@ -777,8 +801,8 @@ Function81e55: ; 81e55 ; 81e5e Function81e5e: ; 81e5e - ld bc, $a - ld a, $6f + ld bc, 10 + ld a, DEBUGTEST_BLACK call ByteFill ret ; 81e67 @@ -864,9 +888,9 @@ Function81eca: ; 81eca Function81ee3: ; 81ee3 .asm_81ee3 - ld a, $ff + ld a, LOW(PALRGB_WHITE) ld [hli], a - ld a, $7f + ld a, HIGH(PALRGB_WHITE) ld [hli], a ld a, [de] inc de @@ -968,7 +992,7 @@ Function81f1d: ; 81f1d ; 81f5e Function81f5e: ; 81f5e - ld a, $6f + ld a, DEBUGTEST_BLACK hlcoord 10, 0 ld [hl], a hlcoord 15, 0 @@ -1039,8 +1063,8 @@ Function81f5e: ; 81f5e String_81fcd: ; 81fcd db "おわりますか?" ; Are you finished? - next "はい", $f2, $f2, $f2, $7a ; YES (A) - next "いいえ", $f2, $f2, $7b ; NO (B) + next "はい", DEBUGTEST_A ; YES...(A) + next "いいえ", DEBUGTEST_B ; NO..(B) db "@" ; 81fe3 @@ -1062,7 +1086,7 @@ TilesetColorTest: xor a ld [hBGMapMode], a ld de, DebugColorTestGFX + 1 tiles - ld hl, vTiles2 tile $6a + ld hl, vTiles2 tile DEBUGTEST_UP_ARROW lb bc, BANK(DebugColorTestGFX), 22 call Request2bpp ld de, DebugColorTestGFX @@ -1073,23 +1097,23 @@ TilesetColorTest: ld [hBGMapAddress + 1], a hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT - ld a, $6f + ld a, DEBUGTEST_BLACK call ByteFill hlcoord 0, 0, AttrMap ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $7 call ByteFill ld de, $15 - ld a, $6c + ld a, DEBUGTEST_WHITE call Function821d2 ld de, $1a - ld a, $6d + ld a, DEBUGTEST_LIGHT call Function821d2 ld de, $1f - ld a, $6e + ld a, DEBUGTEST_DARK call Function821d2 ld de, $24 - ld a, $6f + ld a, DEBUGTEST_BLACK call Function821d2 call Function821f4 call Function8220f @@ -1134,10 +1158,10 @@ Function821f4: ; 821f4 hlcoord 2, 8 Function82203: ; 82203 - ld a, $6a + ld a, DEBUGTEST_UP_ARROW ld [hli], a ld bc, $10 - 1 - ld a, $6b + ld a, DEBUGTEST_TICKS call ByteFill ret ; 8220f diff --git a/engine/events/bug_contest/display_stats.asm b/engine/events/bug_contest/display_stats.asm index 0e2567c28..92b89a38f 100644 --- a/engine/events/bug_contest/display_stats.asm +++ b/engine/events/bug_contest/display_stats.asm @@ -82,9 +82,9 @@ DisplayCaughtContestMonStats: ; cc000 .Health: db "HEALTH@" .Stock: - db " STOCK ", $4a, " @" + db " STOCK @" .This: - db " THIS ", $4a, " @" + db " THIS @" SwitchMonText: ; cc0c2 ; Switch #MON? diff --git a/engine/phone/phone.asm b/engine/phone/phone.asm index 6a9644872..b2dc30dac 100644 --- a/engine/phone/phone.asm +++ b/engine/phone/phone.asm @@ -717,7 +717,7 @@ NonTrainerCallerNames: ; 903d6 .bill db "BILL:@" .elm db "PROF.ELM:@" .bikeshop db "BIKE SHOP:@" -.buena db "BUENA:", $22, " DISC JOCKEY@" +.buena db "BUENA: DISC JOCKEY@" ; 90423 Phone_GetTrainerName: ; 90423 (24:4423) diff --git a/engine/start_menu.asm b/engine/start_menu.asm index 8f29b2c2d..88b7ee853 100755 --- a/engine/start_menu.asm +++ b/engine/start_menu.asm @@ -188,13 +188,13 @@ StartMenu:: ; 125cd .SaveString: db "SAVE@" .OptionString: db "OPTION@" .ExitString: db "EXIT@" -.PokegearString: db $24, "GEAR@" +.PokegearString: db "GEAR@" .QuitString: db "QUIT@" .PokedexDesc: db "#MON" next "database@" -.PartyDesc: db "Party ", $4a +.PartyDesc: db "Party " next "status@" .PackDesc: db "Contains" diff --git a/engine/trade_animation.asm b/engine/trade_animation.asm index 54faa988f..d662a7894 100755 --- a/engine/trade_animation.asm +++ b/engine/trade_animation.asm @@ -1585,7 +1585,7 @@ Unreferenced_DebugTrade: ; 29893 ld a, [hli] ld [wPlayerTrademonSpecies], a ld de, wPlayerTrademonSenderName - ld c, 11 + 2 ; jp: 6 + 2 + ld c, NAME_LENGTH + 2 ; JP: NAME_LENGTH_JAPANESE + 2 .loop1 ld a, [hli] ld [de], a @@ -1596,7 +1596,7 @@ Unreferenced_DebugTrade: ; 29893 ld a, [hli] ld [wOTTrademonSpecies], a ld de, wOTTrademonSenderName - ld c, 11 + 2 ; jp: 6 + 2 + ld c, NAME_LENGTH + 2 ; JP: NAME_LENGTH_JAPANESE + 2 .loop2 ld a, [hli] ld [de], a @@ -1607,9 +1607,15 @@ Unreferenced_DebugTrade: ; 29893 ; 298b5 +debugtrade: MACRO +; species, ot name, ot id (?) + db \1, \2 + dw \3 +ENDM + .DebugTradeData: ; 298b5 - db VENUSAUR, "ゲーフり@@", $23, $01 ; GAME FREAK - db CHARIZARD, "クりーチャ@", $56, $04 ; Creatures Inc. + debugtrade VENUSAUR, "ゲーフり@@", $0123 ; GAME FREAK + debugtrade CHARIZARD, "クりーチャ@", $0456 ; Creatures Inc. ; 298c7 -- cgit v1.2.3 From 17336221e62e36e31069785622c69cf9e3582b7e Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 18 Jan 2018 21:15:59 -0500 Subject: newline before para --- engine/stats_screen.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm index f51f57a77..11c3b33a3 100755 --- a/engine/stats_screen.asm +++ b/engine/stats_screen.asm @@ -1088,10 +1088,10 @@ StatsScreen_LoadPageIndicators: ; 4e4cd (13:64cd) ld a, $36 ; first of 4 small square tiles call .load_square hlcoord 15, 5 - ld a, $36 ; """ + ld a, $36 ; " " " " call .load_square hlcoord 17, 5 - ld a, $36 ; """ + ld a, $36 ; " " " " call .load_square ld a, c cp GREEN_PAGE -- cgit v1.2.3 From a9f8aeb94efa833c562b435854ca169f81184db8 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 18 Jan 2018 21:48:52 -0500 Subject: Remove trailing whitespace --- engine/save.asm | 8 ++++---- engine/timeofdaypals.asm | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'engine') diff --git a/engine/save.asm b/engine/save.asm index 8c2ac7413..4291754e9 100644 --- a/engine/save.asm +++ b/engine/save.asm @@ -873,7 +873,7 @@ _SaveData: ; 1509a ; a) ErasePreviousSave (the process of erasing the save from a previous game file) ; b) unused mobile functionality ; It is not part of a regular save. - + ld a, BANK(sCrystalData) call GetSRAMBank ld hl, wCrystalData @@ -885,7 +885,7 @@ _SaveData: ; 1509a ; BANK(sCrystalData), it instead overwrites the sixteen EventFlags starting at 1:a603 with ; garbage from wd479. This isn't an issue, since ErasePreviousSave is followed by a regular ; save that unwrites the garbage. - + ld hl, wd479 ld a, [hli] ld [$a60e + 0], a @@ -902,10 +902,10 @@ _LoadData: ; 150b9 ld de, wCrystalData ld bc, wCrystalDataEnd - wCrystalData call CopyBytes - + ; This block originally had some mobile functionality to mirror _SaveData above, but instead it ; (harmlessly) writes the aforementioned EventFlags to the unused wd479. - + ld hl, wd479 ld a, [$a60e + 0] ld [hli], a diff --git a/engine/timeofdaypals.asm b/engine/timeofdaypals.asm index 2f24dcb95..6dfa5657a 100644 --- a/engine/timeofdaypals.asm +++ b/engine/timeofdaypals.asm @@ -47,7 +47,7 @@ _TimeOfDayPals:: ; 8c011 ; save wram bank ld a, [rSVBK] ld b, a - + ld a, BANK(wBGPals1) ld [rSVBK], a @@ -78,7 +78,7 @@ _TimeOfDayPals:: ; 8c011 ; save wram bank ld a, [rSVBK] ld d, a - + ld a, BANK(wOBPals1) ld [rSVBK], a -- cgit v1.2.3 From 2c7ca13194be53a6e4707c7bdcfe83d80e35515f Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 18 Jan 2018 22:30:30 -0500 Subject: Disambiguate "%" and "" --- engine/routines/checknickerrors.asm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'engine') diff --git a/engine/routines/checknickerrors.asm b/engine/routines/checknickerrors.asm index 65efd7b94..70cc8d058 100644 --- a/engine/routines/checknickerrors.asm +++ b/engine/routines/checknickerrors.asm @@ -64,11 +64,11 @@ CheckNickErrors:: ; 669f ; table defining which characters are actually text commands ; format: ; ≥ < - db TX_START, TX_BOX + 1 - db "", $18 + 1 - db "", "%" + 1 - db "", "" + 1 - db "", "" + 1 - db "", "" + 1 - db "", "┘" + 1 + db TX_START, TX_BOX + 1 + db "", "" + 1 + db "", "" + 1 + db "", "" + 1 + db "", "" + 1 + db "", "" + 1 + db "", "┘" + 1 db -1 ; end -- cgit v1.2.3 From 25048bd12dfb1f7182be32f1dba24616c6175377 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 19 Jan 2018 00:16:08 -0500 Subject: =?UTF-8?q?wiggle=20=E2=86=92=20wobble?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/sprite_anims.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/sprite_anims.asm b/engine/sprite_anims.asm index 29af03d89..9353b71c9 100755 --- a/engine/sprite_anims.asm +++ b/engine/sprite_anims.asm @@ -430,7 +430,7 @@ DoAnimFrame: ; 8d24b ; 8d493 .TradePokeBall_zero ; 8d493 - ld a, SPRITE_ANIM_FRAMESET_TRADE_POKE_BALL_WIGGLE + ld a, SPRITE_ANIM_FRAMESET_TRADE_POKE_BALL_WOBBLE call _ReinitSpriteAnimFrame ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX -- cgit v1.2.3 From 9576740b7023d67da0da0cbe9bd2a66a0ea74eea Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 19 Jan 2018 00:29:05 -0500 Subject: clean up GetName/NamesPointers --- engine/pack.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/pack.asm b/engine/pack.asm index 1d9f4e70b..f6f67845b 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -1705,7 +1705,7 @@ TextJump_YouCantUseItInABattle: ; 0x10b11 db "@" ; 0x10b16 -PackMenuGFX:: +PackMenuGFX: INCBIN "gfx/pack/pack_menu.2bpp" PackGFX: INCBIN "gfx/pack/pack.2bpp" -- cgit v1.2.3 From e69544b61f5014b77852567efc3b78bc56982a20 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 19 Jan 2018 02:30:19 -0500 Subject: More Unicode --- engine/init_map.asm | 2 +- engine/load_font.asm | 4 ++-- engine/namingscreen.asm | 2 +- engine/phone/phone.asm | 4 ++-- engine/print_party.asm | 4 ++-- engine/stats_screen.asm | 2 +- engine/warp_connection.asm | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) (limited to 'engine') diff --git a/engine/init_map.asm b/engine/init_map.asm index e1b6b9ab9..0ea2379d2 100644 --- a/engine/init_map.asm +++ b/engine/init_map.asm @@ -82,7 +82,7 @@ HDMATransfer_FillBGMap0WithBlack: ; 64db ld a, BANK(wDecompressScratch) ld [rSVBK], a - ld a, "" ; $60 + ld a, "■" ld hl, wDecompressScratch ld bc, wScratchAttrMap - wDecompressScratch call ByteFill diff --git a/engine/load_font.asm b/engine/load_font.asm index af64b69f6..3dd692968 100644 --- a/engine/load_font.asm +++ b/engine/load_font.asm @@ -49,11 +49,11 @@ _LoadStandardFont:: ; fb449 _LoadFontsExtra1:: ; fb48a ld de, FontsExtra_SolidBlackGFX - ld hl, vTiles2 tile "" ; $60 + ld hl, vTiles2 tile "■" ; $60 lb bc, BANK(FontsExtra_SolidBlackGFX), 1 call Get1bpp_2 ld de, PokegearPhoneIconGFX - ld hl, vTiles2 tile "" ; $62 + ld hl, vTiles2 tile "☎" ; $62 lb bc, BANK(PokegearPhoneIconGFX), 1 call Get2bpp_2 ld de, FontExtra tile 3 diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index d983d0251..0fc6e5125 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -1,6 +1,6 @@ NAMINGSCREEN_CURSOR EQU $7e -NAMINGSCREEN_BORDER EQUS "\"\"" ; $60 +NAMINGSCREEN_BORDER EQUS "\"■\"" ; $60 NAMINGSCREEN_MIDDLELINE EQUS "\"→\"" ; $eb NAMINGSCREEN_UNDERLINE EQUS "\"\"" ; $f2 diff --git a/engine/phone/phone.asm b/engine/phone/phone.asm index b2dc30dac..f402e9102 100644 --- a/engine/phone/phone.asm +++ b/engine/phone/phone.asm @@ -516,7 +516,7 @@ Phone_FirstOfTwoRings: ; 902b3 Phone_CallerTextboxWithName2: ; 902c9 call Phone_CallerTextbox hlcoord 1, 2 - ld [hl], "" + ld [hl], "☎" inc hl inc hl ld a, [PhoneScriptBank] @@ -616,7 +616,7 @@ Function90363: ; 90363 (24:4363) push bc call Phone_CallerTextbox hlcoord 1, 1 - ld [hl], "" + ld [hl], "☎" inc hl inc hl ld d, h diff --git a/engine/print_party.asm b/engine/print_party.asm index 819f38759..7c23528f3 100755 --- a/engine/print_party.asm +++ b/engine/print_party.asm @@ -153,7 +153,7 @@ PrintPartyMonPage1: ; 1dc381 call Request1bpp ld de, StatsScreenPageTilesGFX + 14 tiles ; shiny icon - ld hl, vTiles2 tile "" + ld hl, vTiles2 tile "⁂" lb bc, BANK(StatsScreenPageTilesGFX), 1 call Get2bpp @@ -332,7 +332,7 @@ Function1dc52c: ; 1dc52c farcall CheckShininess ret nc hlcoord 18, 2 - ld [hl], "" + ld [hl], "⁂" ret ; 1dc550 diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm index 11c3b33a3..cb677ada4 100755 --- a/engine/stats_screen.asm +++ b/engine/stats_screen.asm @@ -488,7 +488,7 @@ StatsScreen_PlaceShinyIcon: ; 4dfa6 (13:5fa6) farcall CheckShininess ret nc hlcoord 19, 0 - ld [hl], "" + ld [hl], "⁂" ret StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) diff --git a/engine/warp_connection.asm b/engine/warp_connection.asm index c2cb6ed10..e15809c04 100755 --- a/engine/warp_connection.asm +++ b/engine/warp_connection.asm @@ -261,7 +261,7 @@ LoadMapTimeOfDay: ; 104750 pop af ld [rVBK], a - ld a, "" + ld a, "■" ld bc, vBGMap1 - vBGMap0 hlbgcoord 0, 0 call ByteFill -- cgit v1.2.3 From 0c6338836d714f464bfcaa0c8c5b8c76e6f4958d Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 19 Jan 2018 14:49:43 -0500 Subject: Resolve #471 (although link code still needs more cleanup, like its WRAM labels) --- engine/battle/core.asm | 42 ++++---- engine/link.asm | 286 +++++++++++++++++++++++++------------------------ engine/link_2.asm | 2 +- engine/link_trade.asm | 2 +- 4 files changed, 168 insertions(+), 164 deletions(-) (limited to 'engine') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 189ebf195..9ec9cc63e 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -26,7 +26,7 @@ DoBattle: ; 3c000 and a jr z, .not_linked - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $2 jr z, .player_2 @@ -97,7 +97,7 @@ DoBattle: ; 3c000 ld a, [wLinkMode] and a jr z, .not_linked_2 - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $2 jr nz, .not_linked_2 xor a @@ -251,7 +251,7 @@ Stubbed_Function3c1bf: ; 3c1d6 HandleBetweenTurnEffects: ; 3c1d6 - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .CheckEnemyFirst call CheckFaint_PlayerThenEnemy @@ -350,7 +350,7 @@ CheckFaint_EnemyThenPlayer: ; 3c25c ; 3c27c HandleBerserkGene: ; 3c27c - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .reverse @@ -458,7 +458,7 @@ DetermineMoveOrder: ; 3c314 ld a, [wPlayerAction] cp $2 jr nz, .switch - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $2 jr z, .player_2 @@ -515,7 +515,7 @@ DetermineMoveOrder: ; 3c314 jp .enemy_first .both_have_quick_claw - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $2 jr z, .player_2b call BattleRandom @@ -545,7 +545,7 @@ DetermineMoveOrder: ; 3c314 jp .enemy_first .speed_tie - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $2 jr z, .player_2c call BattleRandom @@ -709,7 +709,7 @@ ParsePlayerAction: ; 3c434 ; 3c4df HandleEncore: ; 3c4df - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .player_1 call .do_player @@ -1161,7 +1161,7 @@ ResidualDamage: ; 3c716 ; 3c801 HandlePerishSong: ; 3c801 - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .EnemyFirst call SetPlayerTurn @@ -1230,7 +1230,7 @@ HandlePerishSong: ; 3c801 ; 3c874 HandleWrap: ; 3c874 - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .EnemyFirst call SetPlayerTurn @@ -1302,7 +1302,7 @@ SwitchTurnCore: ; 3c8e4 ; 3c8eb HandleLeftovers: ; 3c8eb - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .DoEnemyFirst call SetPlayerTurn @@ -1352,7 +1352,7 @@ HandleLeftovers: ; 3c8eb ; 3c93c HandleMysteryberry: ; 3c93c - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .DoEnemyFirst call SetPlayerTurn @@ -1491,7 +1491,7 @@ HandleMysteryberry: ; 3c93c ; 3ca26 HandleFutureSight: ; 3ca26 - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .enemy_first call SetPlayerTurn @@ -1550,7 +1550,7 @@ HandleFutureSight: ; 3ca26 ; 3ca8f HanleDefrost: ; 3ca8f - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .enemy_first call .do_player_turn @@ -1610,7 +1610,7 @@ HanleDefrost: ; 3ca8f ; 3cafb HandleSafeguard: ; 3cafb - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .player1 call .CheckPlayer @@ -1647,7 +1647,7 @@ HandleSafeguard: ; 3cafb jp StdBattleTextBox HandleScreens: ; 3cb36 - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp 1 jr z, .Both call .CheckPlayer @@ -1731,7 +1731,7 @@ HandleWeather: ; 3cb9e cp WEATHER_SANDSTORM ret nz - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp 1 jr z, .enemy_first @@ -2115,7 +2115,7 @@ HandleEnemyMonFaint: ; 3cd55 ; 3cdca DoubleSwitch: ; 3cdca - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .player_1 call ClearSprites @@ -4350,7 +4350,7 @@ RecallPlayerMon: ; 3dce6 ; 3dcf9 HandleHealingItems: ; 3dcf9 - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .player_1 call SetPlayerTurn @@ -4595,7 +4595,7 @@ UseConfusionHealingItem: ; 3de51 HandleStatBoostingHeldItems: ; 3de97 ; The effects handled here are not used in-game. - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .player_1 call .DoPlayer @@ -5374,7 +5374,7 @@ PlayerSwitch: ; 3e3ad ret .dont_run - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .player_1 call BattleMonEntrance diff --git a/engine/link.asm b/engine/link.asm index daa986c67..0de4eab2d 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -28,9 +28,9 @@ LinkCommunications: ; 28000 call SetTradeRoomBGPals call WaitBGMap2 ld hl, wcf5d - xor a + xor a ; LOW($5000) ld [hli], a - ld [hl], $50 + ld [hl], HIGH($5000) ld a, [wLinkMode] cp LINK_TIMECAPSULE jp nz, Gen2ToGen2LinkComms @@ -42,29 +42,31 @@ TimeCapsule: ; 2805d xor a ld [wPlayerLinkAction], a call WaitLinkTransfer - ld a, [hLinkPlayerNumber] - cp $2 + ld a, [hSerialConnectionStatus] + cp USING_INTERNAL_CLOCK jr nz, .player_1 + ld c, 3 call DelayFrames xor a ld [hSerialSend], a - ld a, $1 + ld a, (0 << rSC_ON) | 1 ld [rSC], a - ld a, $81 + ld a, (1 << rSC_ON) | 1 ld [rSC], a + call DelayFrame xor a ld [hSerialSend], a - ld a, $1 + ld a, (0 << rSC_ON) | 1 ld [rSC], a - ld a, $81 + ld a, (1 << rSC_ON) | 1 ld [rSC], a .player_1 ld de, MUSIC_NONE call PlayMusic - ld c, $3 + ld c, 3 call DelayFrames xor a ld [rIF], a @@ -73,19 +75,19 @@ TimeCapsule: ; 2805d ld hl, wd1f3 ld de, EnemyMonSpecies ld bc, $11 - call Function75f - ld a, $fe + call Serial_ExchangeBytes + ld a, SERIAL_NO_DATA_BYTE ld [de], a ld hl, wLinkData ld de, OTPlayerName ld bc, $1a8 - call Function75f - ld a, $fe + call Serial_ExchangeBytes + ld a, SERIAL_NO_DATA_BYTE ld [de], a ld hl, wMisc ld de, wPlayerTrademonSpecies ld bc, wPlayerTrademonSpecies - wMisc - call Function75f + call Serial_ExchangeBytes xor a ld [rIF], a ld a, $1d @@ -107,25 +109,25 @@ TimeCapsule: ; 2805d call Link_CopyOTData ld de, wPlayerTrademonSpecies ld hl, wTimeCapsulePartyMon1Species - ld c, $2 + ld c, 2 .loop ld a, [de] inc de and a jr z, .loop - cp $fd + cp SERIAL_PREAMBLE_BYTE jr z, .loop - cp $fe + cp SERIAL_NO_DATA_BYTE jr z, .loop - cp $ff + cp SERIAL_PATCH_LIST_PART_TERMINATOR jr z, .next push hl push bc - ld b, $0 + ld b, 0 dec a ld c, a add hl, bc - ld a, $fe + ld a, SERIAL_NO_DATA_BYTE ld [hl], a pop bc pop hl @@ -168,8 +170,8 @@ TimeCapsule: ; 2805d ld [wUnusedD102 + 1], a ld de, MUSIC_NONE call PlayMusic - ld a, [hLinkPlayerNumber] - cp $2 + ld a, [hSerialConnectionStatus] + cp USING_INTERNAL_CLOCK ld c, 66 call z, DelayFrames ld de, MUSIC_ROUTE_30 @@ -185,23 +187,25 @@ Gen2ToGen2LinkComms: ; 28177 ld a, [ScriptVar] and a jp z, LinkTimeout - ld a, [hLinkPlayerNumber] - cp $2 + ld a, [hSerialConnectionStatus] + cp USING_INTERNAL_CLOCK jr nz, .Player1 + ld c, 3 call DelayFrames xor a ld [hSerialSend], a - ld a, $1 + ld a, (0 << rSC_ON) | 1 ld [rSC], a - ld a, $81 + ld a, (1 << rSC_ON) | 1 ld [rSC], a + call DelayFrame xor a ld [hSerialSend], a - ld a, $1 + ld a, (0 << rSC_ON) | 1 ld [rSC], a - ld a, $81 + ld a, (1 << rSC_ON) | 1 ld [rSC], a .Player1: @@ -216,26 +220,26 @@ Gen2ToGen2LinkComms: ; 28177 ld hl, wd1f3 ld de, EnemyMonSpecies ld bc, $11 - call Function75f - ld a, $fe + call Serial_ExchangeBytes + ld a, SERIAL_NO_DATA_BYTE ld [de], a ld hl, wLinkData ld de, OTPlayerName ld bc, $1c2 - call Function75f - ld a, $fe + call Serial_ExchangeBytes + ld a, SERIAL_NO_DATA_BYTE ld [de], a ld hl, wMisc ld de, wPlayerTrademonSpecies ld bc, $c8 - call Function75f + call Serial_ExchangeBytes ld a, [wLinkMode] cp LINK_TRADECENTER jr nz, .not_trading ld hl, wc9f4 ld de, wcb84 ld bc, $186 - call Function283f2 + call ExchangeBytes .not_trading xor a @@ -252,25 +256,25 @@ Gen2ToGen2LinkComms: ; 28177 call Link_CopyOTData ld de, wPlayerTrademonSpecies ld hl, wLinkPlayerPartyMon1Species - ld c, $2 + ld c, 2 .loop1 ld a, [de] inc de and a jr z, .loop1 - cp $fd + cp SERIAL_PREAMBLE_BYTE jr z, .loop1 - cp $fe + cp SERIAL_NO_DATA_BYTE jr z, .loop1 - cp $ff + cp SERIAL_PATCH_LIST_PART_TERMINATOR jr z, .next1 push hl push bc - ld b, $0 + ld b, 0 dec a ld c, a add hl, bc - ld a, $fe + ld a, SERIAL_NO_DATA_BYTE ld [hl], a pop bc pop hl @@ -286,13 +290,13 @@ Gen2ToGen2LinkComms: ; 28177 ld hl, wcb84 .loop2 ld a, [hli] - cp $20 + cp MAIL_MSG_LENGTH jr nz, .loop2 .loop3 ld a, [hli] - cp $fe + cp SERIAL_NO_DATA_BYTE jr z, .loop3 - cp $20 + cp MAIL_MSG_LENGTH jr z, .loop3 dec hl ld de, wcb84 @@ -302,9 +306,9 @@ Gen2ToGen2LinkComms: ; 28177 ld bc, $c6 ; 198 .loop4 ld a, [hl] - cp $21 + cp MAIL_MSG_LENGTH + 1 jr nz, .okay1 - ld [hl], $fe + ld [hl], SERIAL_NO_DATA_BYTE .okay1 inc hl dec bc @@ -315,14 +319,14 @@ Gen2ToGen2LinkComms: ; 28177 .loop5 ld a, [de] inc de - cp $ff + cp SERIAL_PATCH_LIST_PART_TERMINATOR jr z, .start_copying_mail ld hl, wcc4a dec a ld b, $0 ld c, a add hl, bc - ld [hl], $fe + ld [hl], SERIAL_NO_DATA_BYTE jr .loop5 .start_copying_mail @@ -395,7 +399,7 @@ Gen2ToGen2LinkComms: ; 28177 ld bc, NAME_LENGTH call CopyBytes ld de, OTPartyCount - ld bc, 8 + ld bc, 1 + PARTY_LENGTH + 1 call CopyBytes ld de, OTPlayerID ld bc, 2 @@ -409,8 +413,8 @@ Gen2ToGen2LinkComms: ; 28177 ld [wUnusedD102 + 1], a ld de, MUSIC_NONE call PlayMusic - ld a, [hLinkPlayerNumber] - cp $2 + ld a, [hSerialConnectionStatus] + cp USING_INTERNAL_CLOCK ld c, 66 call z, DelayFrames ld a, [wLinkMode] @@ -423,8 +427,8 @@ Gen2ToGen2LinkComms: ; 28177 ld hl, Options ld a, [hl] push af - and $20 - or $3 + and 1 << STEREO + or TEXT_DELAY_MED ld [hl], a ld hl, OTPlayerName ld de, OTClassName @@ -510,28 +514,28 @@ LinkTimeout: ; 283b2 db "@" ; 0x283f2 -Function283f2: ; 283f2 - ld a, $1 - ld [hFFCC], a +ExchangeBytes: ; 283f2 + ld a, TRUE + ld [hSerialIgnoringInitialData], a .loop ld a, [hl] ld [hSerialSend], a - call Function78a + call Serial_ExchangeByte push bc ld b, a inc hl - ld a, $30 + ld a, 48 .delay_cycles dec a jr nz, .delay_cycles - ld a, [hFFCC] + ld a, [hSerialIgnoringInitialData] and a ld a, b pop bc jr z, .load dec hl xor a - ld [hFFCC], a + ld [hSerialIgnoringInitialData], a jr .loop .load @@ -563,7 +567,7 @@ ClearLinkData: ; 28426 FixDataForLinkTransfer: ; 28434 ld hl, wd1f3 - ld a, $fd + ld a, SERIAL_PREAMBLE_BYTE ld b, LinkBattleRNs - wd1f3 .loop1 ld [hli], a @@ -572,13 +576,13 @@ FixDataForLinkTransfer: ; 28434 ld b, TempEnemyMonSpecies - LinkBattleRNs .loop2 call Random - cp $fd + cp SERIAL_PREAMBLE_BYTE jr nc, .loop2 ld [hli], a dec b jr nz, .loop2 ld hl, wMisc - ld a, $fd + ld a, SERIAL_PREAMBLE_BYTE ld [hli], a ld [hli], a ld [hli], a @@ -594,7 +598,7 @@ FixDataForLinkTransfer: ; 28434 .loop4 inc c ld a, c - cp $fd + cp SERIAL_PREAMBLE_BYTE jr z, .next1 ld a, b dec a @@ -613,31 +617,31 @@ FixDataForLinkTransfer: ; 28434 .next2 inc hl ld a, [hl] - cp $fe + cp SERIAL_NO_DATA_BYTE jr nz, .loop4 ld a, c ld [de], a inc de - ld [hl], $ff + ld [hl], SERIAL_PATCH_LIST_PART_TERMINATOR jr .loop4 .next1 - ld a, $ff + ld a, SERIAL_PATCH_LIST_PART_TERMINATOR ld [de], a inc de lb bc, 1, 0 jr .loop4 .done - ld a, $ff + ld a, SERIAL_PATCH_LIST_PART_TERMINATOR ld [de], a ret ; 28499 Link_PrepPartyData_Gen1: ; 28499 ld de, wLinkData - ld a, $fd - ld b, 6 + ld a, SERIAL_PREAMBLE_BYTE + ld b, PARTY_LENGTH .loop1 ld [de], a inc de @@ -804,8 +808,8 @@ Link_PrepPartyData_Gen1: ; 28499 Link_PrepPartyData_Gen2: ; 28595 ld de, wLinkData - ld a, $fd - ld b, 6 + ld a, SERIAL_PREAMBLE_BYTE + ld b, PARTY_LENGTH .loop1 ld [de], a inc de @@ -907,7 +911,7 @@ Link_PrepPartyData_Gen2: ; 28595 ld bc, PARTY_LENGTH * (sPartyMon1MailAuthor - sPartyMon1Mail) .loop5 ld a, [hl] - cp $fe + cp SERIAL_NO_DATA_BYTE jr nz, .skip2 ld [hl], sPartyMon1MailAuthor - sPartyMon1Mail @@ -924,9 +928,9 @@ Link_PrepPartyData_Gen2: ; 28595 .loop6 inc c ld a, [hl] - cp $fe + cp SERIAL_NO_DATA_BYTE jr nz, .skip3 - ld [hl], $ff + ld [hl], SERIAL_PATCH_LIST_PART_TERMINATOR ld a, c ld [de], a inc de @@ -935,13 +939,13 @@ Link_PrepPartyData_Gen2: ; 28595 inc hl dec b jr nz, .loop6 - ld a, $ff + ld a, SERIAL_PATCH_LIST_PART_TERMINATOR ld [de], a ret ; 28682 Function28682: ; 28682 - ld c, $5 + ld c, 5 .loop ld [de], a inc de @@ -1129,7 +1133,7 @@ INCLUDE "data/items/catch_rate_items.asm" Link_CopyOTData: ; 2879e .loop ld a, [hli] - cp $fe + cp SERIAL_NO_DATA_BYTE jr z, .loop ld [de], a inc de @@ -1141,8 +1145,8 @@ Link_CopyOTData: ; 2879e ; 287ab Link_CopyRandomNumbers: ; 287ab - ld a, [hLinkPlayerNumber] - cp $2 + ld a, [hSerialConnectionStatus] + cp USING_INTERNAL_CLOCK ret z ld hl, EnemyMonSpecies call Link_FindFirstNonControlCharacter_AllowZero @@ -1150,9 +1154,9 @@ Link_CopyRandomNumbers: ; 287ab ld c, 10 .loop ld a, [hli] - cp $fe + cp SERIAL_NO_DATA_BYTE jr z, .loop - cp $fd + cp SERIAL_PREAMBLE_BYTE jr z, .loop ld [de], a inc de @@ -1166,9 +1170,9 @@ Link_FindFirstNonControlCharacter_SkipZero: ; 287ca ld a, [hli] and a jr z, .loop - cp $fd + cp SERIAL_PREAMBLE_BYTE jr z, .loop - cp $fe + cp SERIAL_NO_DATA_BYTE jr z, .loop dec hl ret @@ -1177,9 +1181,9 @@ Link_FindFirstNonControlCharacter_SkipZero: ; 287ca Link_FindFirstNonControlCharacter_AllowZero: ; 287d8 .loop ld a, [hli] - cp $fd + cp SERIAL_PREAMBLE_BYTE jr z, .loop - cp $fe + cp SERIAL_NO_DATA_BYTE jr z, .loop dec hl ret @@ -1219,7 +1223,7 @@ LinkTrade_OTPartyMenu: ; 28803 ld [wMenuCursorX], a ln a, 1, 0 ld [w2DMenuCursorOffsets], a - ld a, $20 + ld a, MENU_UNUSED_3 ld [w2DMenuFlags1], a xor a ld [w2DMenuFlags2], a @@ -1231,7 +1235,7 @@ LinkTradeOTPartymonMenuLoop: ; 28835 jp z, LinkTradePartiesMenuMasterLoop bit A_BUTTON_F, a jr z, .not_a_button - ld a, $1 + ld a, INIT_ENEMYOT_LIST ld [wInitListType], a callfar InitList ld hl, OTPartyMon1Species @@ -1284,7 +1288,7 @@ LinkTrade_PlayerPartyMenu: ; 2888b ld [wMenuCursorX], a ln a, 1, 0 ld [w2DMenuCursorOffsets], a - ld a, $20 + ld a, MENU_UNUSED_3 ld [w2DMenuFlags1], a xor a ld [w2DMenuFlags2], a @@ -1424,7 +1428,7 @@ Function28926: ; 28926 .show_stats pop af ld [wMenuCursorY], a - ld a, $4 + ld a, INIT_PLAYEROT_LIST ld [wInitListType], a callfar InitList farcall LinkMonStatsScreen @@ -1478,7 +1482,7 @@ Function28926: ; 28926 ld a, [wd003] ld hl, OTPartySpecies ld c, a - ld b, $0 + ld b, 0 add hl, bc ld a, [hl] ld [wd265], a @@ -1583,9 +1587,9 @@ Function28b22: ; 28b22 xor a ld [rSB], a ld [hSerialSend], a - ld a, $1 + ld a, (0 << rSC_ON) | 1 ld [rSC], a - ld a, $81 + ld a, (1 << rSC_ON) | 1 ld [rSC], a ret ; 28b42 @@ -1639,14 +1643,14 @@ LinkTrade: ; 28b87 ld [wcf57], a ld [wOtherPlayerLinkAction], a hlcoord 0, 12 - ld b, $4 - ld c, $12 + ld b, 4 + ld c, 18 call LinkTextboxAtHL farcall Link_WaitBGMap ld a, [wd002] ld hl, PartySpecies ld c, a - ld b, $0 + ld b, 0 add hl, bc ld a, [hl] ld [wd265], a @@ -1658,7 +1662,7 @@ LinkTrade: ; 28b87 ld a, [wd003] ld hl, OTPartySpecies ld c, a - ld b, $0 + ld b, 0 add hl, bc ld a, [hl] ld [wd265], a @@ -1749,7 +1753,7 @@ LinkTrade: ; 28b87 .asm_28c96 inc c ld a, c - cp $6 + cp PARTY_LENGTH jr z, .asm_28ca6 push bc ld bc, MAIL_STRUCT_LENGTH @@ -1778,7 +1782,7 @@ LinkTrade: ; 28b87 call CopyBytes ld a, [wd002] ld hl, PartySpecies - ld b, $0 + ld b, 0 ld c, a add hl, bc ld a, [hl] @@ -1818,7 +1822,7 @@ LinkTrade: ; 28b87 call CopyBytes ld a, [wd003] ld hl, OTPartySpecies - ld b, $0 + ld b, 0 ld c, a add hl, bc ld a, [hl] @@ -1854,7 +1858,7 @@ LinkTrade: ; 28b87 ld a, [wd002] ld [CurPartyMon], a ld hl, PartySpecies - ld b, $0 + ld b, 0 ld c, a add hl, bc ld a, [hl] @@ -1865,12 +1869,12 @@ LinkTrade: ; 28b87 ld a, [PartyCount] dec a ld [CurPartyMon], a - ld a, $1 + ld a, TRUE ld [wForceEvolution], a ld a, [wd003] push af ld hl, OTPartySpecies - ld b, $0 + ld b, 0 ld c, a add hl, bc ld a, [hl] @@ -1881,8 +1885,8 @@ LinkTrade: ; 28b87 call LoadFontsBattleExtra ld b, SCGB_DIPLOMA call GetSGBLayout - ld a, [hLinkPlayerNumber] - cp $1 + ld a, [hSerialConnectionStatus] + cp USING_EXTERNAL_CLOCK jr z, .player_2 predef TradeAnimation jr .done_animation @@ -1895,7 +1899,7 @@ LinkTrade: ; 28b87 ld c, a ld [CurPartyMon], a ld hl, OTPartySpecies - ld d, $0 + ld d, 0 ld e, a add hl, de ld a, [hl] @@ -1936,7 +1940,7 @@ LinkTrade: ; 28b87 ld a, b ld [wPlayerLinkAction], a push bc - call Function862 + call Serial_PrintWaitingTextAndSyncAndExchangeNybble pop bc ld a, [wLinkMode] cp LINK_TIMECAPSULE @@ -2113,7 +2117,7 @@ Function29c67: ; 29c67 sub b ld c, a inc c - ld b, $0 + ld b, 0 ld hl, PartyCount add hl, bc ld a, [hl] @@ -2140,24 +2144,24 @@ Special_WaitForOtherPlayerToExit: ; 29c92 ld c, 3 call DelayFrames ld a, -1 - ld [hLinkPlayerNumber], a + ld [hSerialConnectionStatus], a xor a ld [rSB], a ld [hSerialReceive], a - ld a, $1 + ld a, (0 << rSC_ON) | 1 ld [rSC], a - ld a, $81 + ld a, (1 << rSC_ON) | 1 ld [rSC], a ld c, 3 call DelayFrames xor a ld [rSB], a ld [hSerialReceive], a - ld a, $0 + ld a, (0 << rSC_ON) | 0 ld [rSC], a - ld a, $80 + ld a, (1 << rSC_ON) | 0 ld [rSC], a - ld c, $3 + ld c, 3 call DelayFrames xor a ld [rSB], a @@ -2166,7 +2170,7 @@ Special_WaitForOtherPlayerToExit: ; 29c92 ld c, 3 call DelayFrames ld a, -1 - ld [hLinkPlayerNumber], a + ld [hSerialConnectionStatus], a ld a, [rIF] push af xor a @@ -2203,9 +2207,9 @@ Special_SetBitsForTimeCapsuleRequest: ; 29cfa ld [rSB], a xor a ld [hSerialReceive], a - ld a, $0 + ld a, (0 << rSC_ON) | 0 ld [rSC], a - ld a, $80 + ld a, (1 << rSC_ON) | 0 ld [rSC], a xor a ; LINK_TIMECAPSULE - 1 ld [wPlayerLinkAction], a @@ -2221,9 +2225,9 @@ Special_WaitForLinkedFriend: ; 29d11 ld [rSB], a xor a ld [hSerialReceive], a - ld a, $0 + ld a, (0 << rSC_ON) | 0 ld [rSC], a - ld a, $80 + ld a, (1 << rSC_ON) | 0 ld [rSC], a call DelayFrame call DelayFrame @@ -2235,20 +2239,20 @@ Special_WaitForLinkedFriend: ; 29d11 ld a, $ff ld [wLinkTimeoutFrames], a .loop - ld a, [hLinkPlayerNumber] - cp $2 + ld a, [hSerialConnectionStatus] + cp USING_INTERNAL_CLOCK jr z, .connected - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .connected - ld a, -1 - ld [hLinkPlayerNumber], a + ld a, CONNECTION_NOT_ESTABLISHED + ld [hSerialConnectionStatus], a ld a, $2 ld [rSB], a xor a ld [hSerialReceive], a - ld a, $0 + ld a, (0 << rSC_ON) | 0 ld [rSC], a - ld a, $80 + ld a, (1 << rSC_ON) | 0 ld [rSC], a ld a, [wLinkTimeoutFrames] dec a @@ -2262,9 +2266,9 @@ Special_WaitForLinkedFriend: ; 29d11 .not_done ld a, $1 ld [rSB], a - ld a, $1 + ld a, (0 << rSC_ON) | 1 ld [rSC], a - ld a, $81 + ld a, (1 << rSC_ON) | 1 ld [rSC], a call DelayFrame jr .loop @@ -2357,7 +2361,7 @@ Function29dba: ; 29dba Link_CheckCommunicationError: ; 29e0c xor a - ld [hFFCA], a + ld [hSerialReceivedNewData], a ld a, [wLinkTimeoutFrames] ld h, a ld a, [wLinkTimeoutFrames + 1] @@ -2409,7 +2413,7 @@ Link_CheckCommunicationError: ; 29e0c .ConvertDW: ; 29e53 ; [wLinkTimeoutFrames] = ((hl - $100) / 4) + $100 - ; = (hl / 4) + $c0 + ; = (hl / 4) + $c0 dec h srl h rr l @@ -2427,9 +2431,9 @@ Special_TryQuickSave: ; 29e66 ld a, [wd265] push af farcall Link_SaveGame - ld a, $1 + ld a, TRUE jr nc, .return_result - xor a + xor a ; FALSE .return_result ld [ScriptVar], a ld c, 30 @@ -2456,12 +2460,12 @@ Special_CheckBothSelectedSameRoom: ; 29e82 ld [wLinkMode], a xor a ld [hVBlank], a - ld a, $1 + ld a, TRUE ld [ScriptVar], a ret .fail - xor a + xor a ; FALSE ld [ScriptVar], a ret ; 29eaf @@ -2517,8 +2521,8 @@ Special_FailedLinkToPast: ; 29efa Link_ResetSerialRegistersAfterLinkClosure: ; 29f04 ld c, 3 call DelayFrames - ld a, -1 - ld [hLinkPlayerNumber], a + ld a, CONNECTION_NOT_ESTABLISHED + ld [hSerialConnectionStatus], a ld a, $2 ld [rSB], a xor a @@ -2536,7 +2540,7 @@ Link_EnsureSync: ; 29f17 call DelayFrame call DelayFrame .receive_loop - call Function83b + call Serial_ExchangeLinkMenuSelection ld a, [wOtherPlayerLinkMode] ld b, a and $f0 @@ -2557,11 +2561,11 @@ Link_EnsureSync: ; 29f17 ; 29f47 Special_CableClubCheckWhichChris: ; 29f47 - ld a, [hLinkPlayerNumber] - cp $1 - ld a, $1 + ld a, [hSerialConnectionStatus] + cp USING_EXTERNAL_CLOCK + ld a, TRUE jr z, .yes - dec a + dec a ; FALSE .yes ld [ScriptVar], a @@ -2575,7 +2579,7 @@ INCBIN "gfx/trade/unused_gen_1_border_tiles.2bpp" Unreferenced_Function29fe4: ld a, BANK(sPartyMail) call GetSRAMBank - ld d, $0 + ld d, FALSE ld b, CHECK_FLAG predef SmallFarFlagAction call CloseSRAM diff --git a/engine/link_2.asm b/engine/link_2.asm index 866126cd2..7923f9c9d 100644 --- a/engine/link_2.asm +++ b/engine/link_2.asm @@ -56,7 +56,7 @@ LinkTextbox2: ; 4d35b .PlaceBorder: ; 4d37e push hl - ld a, $76 + ld a, "ぁ" ; $76 ld [hli], a inc a call .PlaceRow diff --git a/engine/link_trade.asm b/engine/link_trade.asm index ae84a7beb..9a7a2e3d7 100755 --- a/engine/link_trade.asm +++ b/engine/link_trade.asm @@ -139,7 +139,7 @@ _LoadTradeScreenBorder: ; 16d696 LinkComms_LoadPleaseWaitTextboxBorderGFX: ; 16d69a ld de, LinkCommsBorderGFX + $30 tiles - ld hl, vTiles2 tile $76 + ld hl, vTiles2 tile "ぁ" lb bc, BANK(LinkCommsBorderGFX), 8 call Get2bpp ret -- cgit v1.2.3 From b199f6cfbff81cec3e62351ae4aaa6edce0270d5 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 19 Jan 2018 19:31:45 -0500 Subject: Use hSerialConnectionStatus constants elsewhere --- engine/battle/core.asm | 42 +++++++++++++++++++++--------------------- engine/link.asm | 4 ++-- 2 files changed, 23 insertions(+), 23 deletions(-) (limited to 'engine') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 9ec9cc63e..e8abea583 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -27,7 +27,7 @@ DoBattle: ; 3c000 jr z, .not_linked ld a, [hSerialConnectionStatus] - cp $2 + cp USING_INTERNAL_CLOCK jr z, .player_2 .not_linked @@ -98,7 +98,7 @@ DoBattle: ; 3c000 and a jr z, .not_linked_2 ld a, [hSerialConnectionStatus] - cp $2 + cp USING_INTERNAL_CLOCK jr nz, .not_linked_2 xor a ld [wEnemySwitchMonIndex], a @@ -252,7 +252,7 @@ Stubbed_Function3c1bf: HandleBetweenTurnEffects: ; 3c1d6 ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .CheckEnemyFirst call CheckFaint_PlayerThenEnemy ret c @@ -351,7 +351,7 @@ CheckFaint_EnemyThenPlayer: ; 3c25c HandleBerserkGene: ; 3c27c ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .reverse call .player @@ -459,7 +459,7 @@ DetermineMoveOrder: ; 3c314 cp $2 jr nz, .switch ld a, [hSerialConnectionStatus] - cp $2 + cp USING_INTERNAL_CLOCK jr z, .player_2 call BattleRandom @@ -516,7 +516,7 @@ DetermineMoveOrder: ; 3c314 .both_have_quick_claw ld a, [hSerialConnectionStatus] - cp $2 + cp USING_INTERNAL_CLOCK jr z, .player_2b call BattleRandom cp c @@ -546,7 +546,7 @@ DetermineMoveOrder: ; 3c314 .speed_tie ld a, [hSerialConnectionStatus] - cp $2 + cp USING_INTERNAL_CLOCK jr z, .player_2c call BattleRandom cp 1 + (50 percent) @@ -710,7 +710,7 @@ ParsePlayerAction: ; 3c434 HandleEncore: ; 3c4df ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .player_1 call .do_player jr .do_enemy @@ -1162,7 +1162,7 @@ ResidualDamage: ; 3c716 HandlePerishSong: ; 3c801 ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .EnemyFirst call SetPlayerTurn call .do_it @@ -1231,7 +1231,7 @@ HandlePerishSong: ; 3c801 HandleWrap: ; 3c874 ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .EnemyFirst call SetPlayerTurn call .do_it @@ -1303,7 +1303,7 @@ SwitchTurnCore: ; 3c8e4 HandleLeftovers: ; 3c8eb ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .DoEnemyFirst call SetPlayerTurn call .do_it @@ -1353,7 +1353,7 @@ HandleLeftovers: ; 3c8eb HandleMysteryberry: ; 3c93c ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .DoEnemyFirst call SetPlayerTurn call .do_it @@ -1492,7 +1492,7 @@ HandleMysteryberry: ; 3c93c HandleFutureSight: ; 3ca26 ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .enemy_first call SetPlayerTurn call .do_it @@ -1551,7 +1551,7 @@ HandleFutureSight: ; 3ca26 HanleDefrost: ; 3ca8f ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .enemy_first call .do_player_turn jr .do_enemy_turn @@ -1611,7 +1611,7 @@ HanleDefrost: ; 3ca8f HandleSafeguard: ; 3cafb ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .player1 call .CheckPlayer jr .CheckEnemy @@ -1648,7 +1648,7 @@ HandleSafeguard: ; 3cafb HandleScreens: ; 3cb36 ld a, [hSerialConnectionStatus] - cp 1 + cp USING_EXTERNAL_CLOCK jr z, .Both call .CheckPlayer jr .CheckEnemy @@ -1732,7 +1732,7 @@ HandleWeather: ; 3cb9e ret nz ld a, [hSerialConnectionStatus] - cp 1 + cp USING_EXTERNAL_CLOCK jr z, .enemy_first .player_first @@ -2116,7 +2116,7 @@ HandleEnemyMonFaint: ; 3cd55 DoubleSwitch: ; 3cdca ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .player_1 call ClearSprites hlcoord 1, 0 @@ -4351,7 +4351,7 @@ RecallPlayerMon: ; 3dce6 HandleHealingItems: ; 3dcf9 ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .player_1 call SetPlayerTurn call HandleHPHealingItem @@ -4596,7 +4596,7 @@ UseConfusionHealingItem: ; 3de51 HandleStatBoostingHeldItems: ; 3de97 ; The effects handled here are not used in-game. ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .player_1 call .DoPlayer jp .DoEnemy @@ -5375,7 +5375,7 @@ PlayerSwitch: ; 3e3ad .dont_run ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .player_1 call BattleMonEntrance call EnemyMonEntrance diff --git a/engine/link.asm b/engine/link.asm index 0de4eab2d..19559798d 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -2143,7 +2143,7 @@ Special_EnterTimeCapsule: ; 29c7b Special_WaitForOtherPlayerToExit: ; 29c92 ld c, 3 call DelayFrames - ld a, -1 + ld a, CONNECTION_NOT_ESTABLISHED ld [hSerialConnectionStatus], a xor a ld [rSB], a @@ -2169,7 +2169,7 @@ Special_WaitForOtherPlayerToExit: ; 29c92 ld [rSC], a ld c, 3 call DelayFrames - ld a, -1 + ld a, CONNECTION_NOT_ESTABLISHED ld [hSerialConnectionStatus], a ld a, [rIF] push af -- cgit v1.2.3 From ddec0ee305f25bc9941e19e16c79f499c5e95c23 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 19 Jan 2018 20:48:33 -0500 Subject: More Japanese characters --- engine/debug.asm | 2 +- engine/link_2.asm | 2 +- engine/link_trade.asm | 2 +- engine/load_font.asm | 8 ++++---- engine/routines/checknickerrors.asm | 14 +++++++------- 5 files changed, 14 insertions(+), 14 deletions(-) (limited to 'engine') diff --git a/engine/debug.asm b/engine/debug.asm index dcfb1b4cf..f58891987 100755 --- a/engine/debug.asm +++ b/engine/debug.asm @@ -384,7 +384,7 @@ Function81adb: ; 81adb ret ; 81baf -String_81baf: db "レアぅぅ@" ; rare (shiny) +String_81baf: db "レア", DEBUGTEST_BLACK, DEBUGTEST_BLACK, "@" ; rare (shiny) String_81bb4: db "ノーマル@" ; normal String_81bb9: db DEBUGTEST_A, "きりかえ▶@" ; (A) switches ; 81bc0 diff --git a/engine/link_2.asm b/engine/link_2.asm index 7923f9c9d..866126cd2 100644 --- a/engine/link_2.asm +++ b/engine/link_2.asm @@ -56,7 +56,7 @@ LinkTextbox2: ; 4d35b .PlaceBorder: ; 4d37e push hl - ld a, "ぁ" ; $76 + ld a, $76 ld [hli], a inc a call .PlaceRow diff --git a/engine/link_trade.asm b/engine/link_trade.asm index 9a7a2e3d7..ae84a7beb 100755 --- a/engine/link_trade.asm +++ b/engine/link_trade.asm @@ -139,7 +139,7 @@ _LoadTradeScreenBorder: ; 16d696 LinkComms_LoadPleaseWaitTextboxBorderGFX: ; 16d69a ld de, LinkCommsBorderGFX + $30 tiles - ld hl, vTiles2 tile "ぁ" + ld hl, vTiles2 tile $76 lb bc, BANK(LinkCommsBorderGFX), 8 call Get2bpp ret diff --git a/engine/load_font.asm b/engine/load_font.asm index 3dd692968..345fa6ff6 100644 --- a/engine/load_font.asm +++ b/engine/load_font.asm @@ -56,7 +56,7 @@ _LoadFontsExtra1:: ; fb48a ld hl, vTiles2 tile "☎" ; $62 lb bc, BANK(PokegearPhoneIconGFX), 1 call Get2bpp_2 - ld de, FontExtra tile 3 + ld de, FontExtra + 3 tiles ; "" ld hl, vTiles2 tile "" lb bc, BANK(FontExtra), 22 ; "" to "ぉ" call Get2bpp_2 @@ -104,8 +104,8 @@ LoadBattleFontsHPBar: ; fb4f2 lb bc, BANK(FontBattleExtra), 12 call Get2bpp_2 ld hl, vTiles2 tile $70 - ld de, FontBattleExtra tile 16 - lb bc, BANK(FontBattleExtra), 3 ; "<ど>" to "『" + ld de, FontBattleExtra + 16 tiles ; "" + lb bc, BANK(FontBattleExtra), 3 ; "" to "『" call Get2bpp_2 call LoadFrame @@ -122,7 +122,7 @@ LoadHPBar: ; fb50d ld hl, vTiles2 tile $55 lb bc, BANK(ExpBarGFX), 9 call Get2bpp_2 - ld de, MobilePhoneTilesGFX tile 7 ; mobile phone icon + ld de, MobilePhoneTilesGFX + 7 tiles ; mobile phone icon ld hl, vTiles2 tile $5e lb bc, BANK(MobilePhoneTilesGFX), 2 call Get2bpp_2 diff --git a/engine/routines/checknickerrors.asm b/engine/routines/checknickerrors.asm index 70cc8d058..245c28586 100644 --- a/engine/routines/checknickerrors.asm +++ b/engine/routines/checknickerrors.asm @@ -64,11 +64,11 @@ CheckNickErrors:: ; 669f ; table defining which characters are actually text commands ; format: ; ≥ < - db TX_START, TX_BOX + 1 - db "", "" + 1 - db "", "" + 1 - db "", "" + 1 - db "", "" + 1 - db "", "" + 1 - db "", "┘" + 1 + db TX_START, TX_BOX + 1 + db "", "" + 1 + db "", "" + 1 + db "", "" + 1 + db "", "" + 1 + db "", "" + 1 + db "", "┘" + 1 db -1 ; end -- cgit v1.2.3 From b071dd364f715165d6eec99ebbd1e4aed4b84bde Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 19 Jan 2018 21:49:16 -0500 Subject: =?UTF-8?q?Japanese=20characters=20in=20Japanese=20text=20(e.g.=20?= =?UTF-8?q?"=E3=82=A9"=20not=20","=20for=20$f4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/battle/menu.asm | 2 +- engine/debug.asm | 2 +- engine/dummy_game.asm | 2 +- engine/mart.asm | 2 +- engine/menu_2.asm | 6 +++--- engine/mystery_gift.asm | 4 ++-- engine/namingscreen.asm | 4 ++-- engine/party_menu.asm | 6 +++--- 8 files changed, 14 insertions(+), 14 deletions(-) (limited to 'engine') diff --git a/engine/battle/menu.asm b/engine/battle/menu.asm index dd3d4ef07..c97cd7854 100755 --- a/engine/battle/menu.asm +++ b/engine/battle/menu.asm @@ -70,7 +70,7 @@ MenuData_0x24f56: ; 24f56 ; 24f5f Strings24f5f: ; 24f5f - db "サファりボール× @" ; "SAFARI BALL× @" + db "サファりボール×  @" ; "SAFARI BALL× @" db "エサをなげる@" ; "THROW BAIT" db "いしをなげる@" ; "THROW ROCK" db "にげる@" ; "RUN" diff --git a/engine/debug.asm b/engine/debug.asm index f58891987..c15481926 100755 --- a/engine/debug.asm +++ b/engine/debug.asm @@ -1062,7 +1062,7 @@ Function81f5e: ; 81f5e ; 81fcd String_81fcd: ; 81fcd - db "おわりますか?" ; Are you finished? + db "おわりますか?" ; Are you finished? next "はい", DEBUGTEST_A ; YES...(A) next "いいえ", DEBUGTEST_B ; NO..(B) db "@" diff --git a/engine/dummy_game.asm b/engine/dummy_game.asm index aecaa7425..6d7e12196 100755 --- a/engine/dummy_game.asm +++ b/engine/dummy_game.asm @@ -482,7 +482,7 @@ DummyGame_InitStrings: ; e2152 .japstr1 db "とったもの@" .japstr2 - db "あと かい@" + db "あと かい@" ; e2183 DummyGame_Card2Coord: ; e2183 diff --git a/engine/mart.asm b/engine/mart.asm index f4b89bd22..d4c0b623b 100755 --- a/engine/mart.asm +++ b/engine/mart.asm @@ -892,7 +892,7 @@ Text_Mart_ICanPayThisMuch: ; 0x15f78 ; 0x15f7d .UnusedString15f7d: ; 15f7d - db "!ダミー!@" + db "!ダミー!@" Text_Mart_HowMayIHelpYou: ; 0x15f83 ; Welcome! How may I help you? diff --git a/engine/menu_2.asm b/engine/menu_2.asm index 94be32eab..c8c4ebf5d 100644 --- a/engine/menu_2.asm +++ b/engine/menu_2.asm @@ -139,9 +139,9 @@ Unreferenced_Function24b8f: ; 24b8f ret .slash_500 ; 24bcf - db "/500@" + db "/500@" .booru_ko ; 24bd4 - db "ボール こ@" + db "ボール   こ@" StartMenu_DrawBugContestStatusBox: ; 24bdc hlcoord 0, 0 @@ -195,7 +195,7 @@ StartMenu_PrintBugContestStatus: ; 24be7 ret .Balls_JP: ; 24c43 - db "ボール こ@" + db "ボール   こ@" .CAUGHT: ; 24c4b db "CAUGHT@" .Balls_EN: ; 24c52 diff --git a/engine/mystery_gift.asm b/engine/mystery_gift.asm index db2713ff4..fccdcfcbc 100755 --- a/engine/mystery_gift.asm +++ b/engine/mystery_gift.asm @@ -1504,9 +1504,9 @@ asm_105726: ; 105726 (41:5726) String_10572e: ; 10572e db "エーボタン¯おすと" - next "つうしんおこなわれるよ!" + next "つうしんおこなわれるよ!" next "ビーボタン¯おすと" - next "つうしん¯ちゅうし します" + next "つうしん¯ちゅうし します" db "@" ; 10575e diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index 0fc6e5125..331fff37c 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -217,7 +217,7 @@ NamingScreen: ; 116c1 ; 11839 (4:5839) .oTomodachi_no_namae_sutoringu ; 11839 - db "おともだち の なまえは?@" + db "おともだち の なまえは?@" ; 11847 @@ -1044,7 +1044,7 @@ INCBIN "gfx/icons/mail2.2bpp" ; 11f7a (4:5f7a) .UnusedString11f7a: - db "メールを かいてね@" + db "メールを かいてね@" ; 11f84 diff --git a/engine/party_menu.asm b/engine/party_menu.asm index 612f1d0e0..33186170a 100644 --- a/engine/party_menu.asm +++ b/engine/party_menu.asm @@ -574,16 +574,16 @@ PlacePartyMonMobileBattleSelection: ; 50307 ; 5036b .String_Banme: ; 5036b - db " ばんめ @" ; Place + db " ばんめ  @" ; Place ; 50372 .String_Sanka_Shinai: ; 50372 db "さんかしない@" ; Cancel ; 50379 .String_Kettei_Yameru: ; 50379 - db "けってい やめる@" ; Quit + db "けってい  やめる@" ; Quit ; 50383 .Strings_1_2_3: ; 50383 - db "1@", "2@", "3@" ; 1st, 2nd, 3rd + db "1@", "2@", "3@" ; 1st, 2nd, 3rd ; 50389 -- cgit v1.2.3 From 8127d1fbcfccb7cd5c3e210699dd540e370b6634 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sat, 20 Jan 2018 12:05:16 -0500 Subject: Rename BATTLETOWER_NROF constants --- engine/events/battle_tower/battle_tower.asm | 8 ++++---- engine/events/battle_tower/load_trainer.asm | 4 ++-- engine/events/battle_tower/rules.asm | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'engine') diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm index bb2c23ca2..dcf4d5ccf 100755 --- a/engine/events/battle_tower/battle_tower.asm +++ b/engine/events/battle_tower/battle_tower.asm @@ -363,7 +363,7 @@ ReadBTTrainerParty: ; 1702b7 ; Copy Pkmn into Memory from the address in hl ld de, OTPartyMon1Species ld bc, OTPartyCount - ld a, BATTLETOWER_NROFPKMNS ; Number of Pkmn the BattleTower-Trainer has + ld a, BATTLETOWER_PARTY_SIZE ld [bc], a inc bc .otpartymon_loop @@ -399,7 +399,7 @@ ReadBTTrainerParty: ; 1702b7 ValidateBTParty: ; 170394 ; Check for and fix errors in party data ld hl, wBT_OTTempPkmn1Species - ld d, BATTLETOWER_NROFPKMNS + ld d, BATTLETOWER_PARTY_SIZE .pkmn_loop push de push hl @@ -509,7 +509,7 @@ BT_ChrisName: ; 170426 Function17042c: ; 17042c ld hl, w3_d202TrainerData - ld a, BATTLETOWER_NROFTRAINERS + ld a, BATTLETOWER_STREAK_SIZE .loop push af push hl @@ -956,7 +956,7 @@ ResetBattleTowerTrainersSRAM: ; 1706d6 (5c:46d6) BattleTowerAction $1a ld a, $ff ld hl, sBTTrainers - ld bc, BATTLETOWER_NROFTRAINERS + ld bc, BATTLETOWER_STREAK_SIZE call ByteFill xor a diff --git a/engine/events/battle_tower/load_trainer.asm b/engine/events/battle_tower/load_trainer.asm index 7c229219f..a7a978311 100644 --- a/engine/events/battle_tower/load_trainer.asm +++ b/engine/events/battle_tower/load_trainer.asm @@ -41,7 +41,7 @@ endc ld a, BANK(sBTTrainers) call GetSRAMBank - ld c, BATTLETOWER_NROFTRAINERS + ld c, BATTLETOWER_STREAK_SIZE ld hl, sBTTrainers .next_trainer ld a, [hli] @@ -93,7 +93,7 @@ endc Function_LoadRandomBattleTowerPkmn: ; 1f8081 - ld c, BATTLETOWER_NROFPKMNS + ld c, BATTLETOWER_PARTY_SIZE .loop push bc ld a, BANK(sBTPkmnPrevTrainer1) diff --git a/engine/events/battle_tower/rules.asm b/engine/events/battle_tower/rules.asm index 8d037951b..b41c51078 100644 --- a/engine/events/battle_tower/rules.asm +++ b/engine/events/battle_tower/rules.asm @@ -213,7 +213,7 @@ BattleTower_ExecuteJumptable: ; 8b25b BattleTower_CheckPartyLengthIs3: ; 8b2bb ld a, [PartyCount] - cp BATTLETOWER_NROFPKMNS + cp BATTLETOWER_PARTY_SIZE ret ; 8b2c1 @@ -235,13 +235,13 @@ BattleTower_CheckPartyHasThreeMonsThatAreNotEggs: ; 8b2c1 cp b ret z ld a, b - cp BATTLETOWER_NROFPKMNS + cp BATTLETOWER_PARTY_SIZE ret ; 8b2da Function_PartyCountEq3: ; 8b2da ld a, [PartyCount] - cp BATTLETOWER_NROFPKMNS + cp BATTLETOWER_PARTY_SIZE ret z scf ret -- cgit v1.2.3 From 05382d3e3c03616d6edf21833e89a8264a8cd10a Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sat, 20 Jan 2018 12:25:55 -0500 Subject: PARTY_LENGTH; MON_NAME; sgb_border.bin --- engine/battle/core.asm | 8 ++++---- engine/billspc.asm | 16 ++++++++-------- engine/breeding.asm | 4 ++-- engine/caught_data.asm | 4 ++-- engine/color.asm | 3 ++- engine/events/battle_tower/battle_tower.asm | 24 ++++++++++++------------ engine/events/battle_tower/load_trainer.asm | 12 ++++++------ engine/events/battle_tower/rules.asm | 6 +++--- engine/events/daycare.asm | 4 ++-- engine/events/halloffame.asm | 6 +++--- engine/events/name_rater.asm | 10 +++++----- engine/events/odd_egg.asm | 4 ++-- engine/events/poke_seer.asm | 4 ++-- engine/events/special.asm | 2 +- engine/evolve.asm | 4 ++-- engine/item_effects.asm | 6 +++--- engine/learn.asm | 2 +- engine/link.asm | 6 +++--- engine/link_trade.asm | 4 ++-- engine/move_mon.asm | 22 +++++++++++----------- engine/move_mon_wo_mail.asm | 4 ++-- engine/namingscreen.asm | 2 +- engine/npctrade.asm | 2 +- engine/pack.asm | 2 +- engine/party_menu.asm | 2 +- engine/pokegear.asm | 2 +- engine/printer.asm | 8 ++++---- engine/radio.asm | 2 +- engine/routines/checknickerrors.asm | 2 +- engine/routines/correcterrorsinplayerparty.asm | 2 +- engine/routines/initlist.asm | 2 +- engine/start_menu.asm | 2 +- engine/stats_screen.asm | 2 +- engine/wildmons.asm | 4 ++-- 34 files changed, 95 insertions(+), 94 deletions(-) (limited to 'engine') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index e8abea583..1a58b3df5 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -3989,7 +3989,7 @@ InitBattleMon: ; 3da0d ld a, [CurBattleMon] call SkipNames ld de, BattleMonNick - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes ld hl, BattleMonAttack ld de, PlayerStats @@ -4074,7 +4074,7 @@ InitEnemyMon: ; 3dabd ld a, [CurPartyMon] call SkipNames ld de, EnemyMonNick - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes ld hl, EnemyMonAttack ld de, EnemyStats @@ -6578,7 +6578,7 @@ LoadEnemyMon: ; 3e8eb ; Update enemy nick ld hl, StringBuffer1 ld de, EnemyMonNick - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes ; Saw this mon @@ -7766,7 +7766,7 @@ AnimateExpBar: ; 3f136 call PrintPlayerHUD ld hl, BattleMonNick ld de, StringBuffer1 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes call TerminateExpBarSound ld de, SFX_HIT_END_OF_EXP_BAR diff --git a/engine/billspc.asm b/engine/billspc.asm index 458192c3c..5fa590c41 100755 --- a/engine/billspc.asm +++ b/engine/billspc.asm @@ -1331,11 +1331,11 @@ BillsPC_RefreshTextboxes: ; e2c2c (38:6c2c) jr z, .boxfail ld bc, sBoxMonNicknames - sBox add hl, bc - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH ld a, e call AddNTimes ld de, StringBuffer1 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes call CloseSRAM pop hl @@ -1357,11 +1357,11 @@ BillsPC_RefreshTextboxes: ; e2c2c (38:6c2c) and a jr z, .partyfail ld hl, PartyMonNicknames - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH ld a, e call AddNTimes ld de, StringBuffer1 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes pop hl ld de, StringBuffer1 @@ -1383,11 +1383,11 @@ BillsPC_RefreshTextboxes: ; e2c2c (38:6c2c) and a jr z, .sBoxFail ld hl, sBoxMonNicknames - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH ld a, e call AddNTimes ld de, StringBuffer1 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes call CloseSRAM pop hl @@ -2171,11 +2171,11 @@ CopySpeciesToTemp: ; e3357 (38:7357) ret CopyNicknameToTemp: ; e3363 (38:7363) - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH ld a, [CurPartyMon] call AddNTimes ld de, wBufferMonNick - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes ret diff --git a/engine/breeding.asm b/engine/breeding.asm index 489154f71..b16747089 100755 --- a/engine/breeding.asm +++ b/engine/breeding.asm @@ -320,7 +320,7 @@ HatchEggs: ; 16f70 (5:6f70) call PrintText ld a, [CurPartyMon] ld hl, PartyMonNicknames - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call AddNTimes ld d, h ld e, l @@ -345,7 +345,7 @@ HatchEggs: ; 16f70 (5:6f70) .nonickname ld hl, StringBuffer1 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes .next ; 1707d (5:707d) diff --git a/engine/caught_data.asm b/engine/caught_data.asm index 56ef8a839..9310b7b90 100644 --- a/engine/caught_data.asm +++ b/engine/caught_data.asm @@ -42,7 +42,7 @@ Special_CheckPartyFullAfterContest: ; 4d9e5 call GetPokemonName ld hl, StringBuffer1 ld de, wMonOrItemNameBuffer - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes call GiveANickname_YesNo jr c, .Party_SkipNickname @@ -120,7 +120,7 @@ Special_CheckPartyFullAfterContest: ; 4d9e5 ld a, BANK(sBoxMonNicknames) call GetSRAMBank ld de, sBoxMonNicknames - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes call CloseSRAM diff --git a/engine/color.asm b/engine/color.asm index d0dd0c3c8..485125821 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -1195,7 +1195,8 @@ PredefPals: INCLUDE "gfx/sgb/predef.pal" SGBBorderMap: -INCBIN "gfx/sgb/sgb_border.tilemap" +; interleaved tile ids and palette ids +INCBIN "gfx/sgb/sgb_border.bin" SGBBorderPalettes: INCLUDE "gfx/sgb/sgb_border.pal" diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm index dcf4d5ccf..94a29cdab 100755 --- a/engine/events/battle_tower/battle_tower.asm +++ b/engine/events/battle_tower/battle_tower.asm @@ -285,7 +285,7 @@ ReadBTTrainerParty: ; 1702b7 ; Check the nicknames for illegal characters, and replace bad nicknames ; with their species names. ld de, wBT_OTTempPkmn1Name ; $c643 - ld c, PKMN_NAME_LENGTH + ld c, MON_NAME_LENGTH farcall CheckStringForErrors jr nc, .skip_mon_1 @@ -295,12 +295,12 @@ ReadBTTrainerParty: ; 1702b7 ld l, e ld h, d ld de, wBT_OTTempPkmn1Name ; $c643 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes .skip_mon_1 ld de, wBT_OTTempPkmn2Name ; $c67e - ld c, PKMN_NAME_LENGTH + ld c, MON_NAME_LENGTH farcall CheckStringForErrors jr nc, .skip_mon_2 ld a, [wBT_OTTempPkmn2] ; [$c64e] @@ -309,12 +309,12 @@ ReadBTTrainerParty: ; 1702b7 ld l, e ld h, d ld de, wBT_OTTempPkmn2Name ; $c67e - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes .skip_mon_2 ld de, wBT_OTTempPkmn3Name ; $c686 + 51 = $c6b9 - ld c, PKMN_NAME_LENGTH + ld c, MON_NAME_LENGTH farcall CheckStringForErrors jr nc, .skip_mon_3 ld a, [wBT_OTTempPkmn3] ; [$c689] @@ -323,7 +323,7 @@ ReadBTTrainerParty: ; 1702b7 ld l, e ld h, d ld de, wBT_OTTempPkmn3Name ; $c686 + 51 = $c6b9 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes .skip_mon_3 @@ -363,7 +363,7 @@ ReadBTTrainerParty: ; 1702b7 ; Copy Pkmn into Memory from the address in hl ld de, OTPartyMon1Species ld bc, OTPartyCount - ld a, BATTLETOWER_PARTY_SIZE + ld a, BATTLETOWER_PARTY_LENGTH ld [bc], a inc bc .otpartymon_loop @@ -379,7 +379,7 @@ ReadBTTrainerParty: ; 1702b7 ld e, a ld a, [BGMapBuffer + 1] ld d, a - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes ld a, e ld [BGMapBuffer], a @@ -399,7 +399,7 @@ ReadBTTrainerParty: ; 1702b7 ValidateBTParty: ; 170394 ; Check for and fix errors in party data ld hl, wBT_OTTempPkmn1Species - ld d, BATTLETOWER_PARTY_SIZE + ld d, BATTLETOWER_PARTY_LENGTH .pkmn_loop push de push hl @@ -495,7 +495,7 @@ endr ld a, [hl] ld [de], a pop hl - ld bc, PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH + ld bc, PARTYMON_STRUCT_LENGTH + MON_NAME_LENGTH add hl, bc pop de dec d @@ -509,7 +509,7 @@ BT_ChrisName: ; 170426 Function17042c: ; 17042c ld hl, w3_d202TrainerData - ld a, BATTLETOWER_STREAK_SIZE + ld a, BATTLETOWER_STREAK_LENGTH .loop push af push hl @@ -956,7 +956,7 @@ ResetBattleTowerTrainersSRAM: ; 1706d6 (5c:46d6) BattleTowerAction $1a ld a, $ff ld hl, sBTTrainers - ld bc, BATTLETOWER_STREAK_SIZE + ld bc, BATTLETOWER_STREAK_LENGTH call ByteFill xor a diff --git a/engine/events/battle_tower/load_trainer.asm b/engine/events/battle_tower/load_trainer.asm index a7a978311..e0e4a5ca1 100644 --- a/engine/events/battle_tower/load_trainer.asm +++ b/engine/events/battle_tower/load_trainer.asm @@ -41,7 +41,7 @@ endc ld a, BANK(sBTTrainers) call GetSRAMBank - ld c, BATTLETOWER_STREAK_SIZE + ld c, BATTLETOWER_STREAK_LENGTH ld hl, sBTTrainers .next_trainer ld a, [hli] @@ -93,7 +93,7 @@ endc Function_LoadRandomBattleTowerPkmn: ; 1f8081 - ld c, BATTLETOWER_PARTY_SIZE + ld c, BATTLETOWER_PARTY_LENGTH .loop push bc ld a, BANK(sBTPkmnPrevTrainer1) @@ -123,7 +123,7 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081 ; Check if Pkmn was already loaded before ; Check current and the 2 previous teams ; includes check if item is double at the current team - ld bc, PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH + ld bc, PARTYMON_STRUCT_LENGTH + MON_NAME_LENGTH call AddNTimes ld a, [hli] ld b, a @@ -166,13 +166,13 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081 cp b jr z, .FindARandomBattleTowerPkmn - ld bc, PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH + ld bc, PARTYMON_STRUCT_LENGTH + MON_NAME_LENGTH call CopyBytes ld a, [wNamedObjectIndexBuffer] push af push de - ld hl, - (PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH) + ld hl, - (PARTYMON_STRUCT_LENGTH + MON_NAME_LENGTH) add hl, de ld a, [hl] ld [wNamedObjectIndexBuffer], a @@ -183,7 +183,7 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081 ld h, d ld l, e pop de - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes pop de diff --git a/engine/events/battle_tower/rules.asm b/engine/events/battle_tower/rules.asm index b41c51078..0e994c27e 100644 --- a/engine/events/battle_tower/rules.asm +++ b/engine/events/battle_tower/rules.asm @@ -213,7 +213,7 @@ BattleTower_ExecuteJumptable: ; 8b25b BattleTower_CheckPartyLengthIs3: ; 8b2bb ld a, [PartyCount] - cp BATTLETOWER_PARTY_SIZE + cp BATTLETOWER_PARTY_LENGTH ret ; 8b2c1 @@ -235,13 +235,13 @@ BattleTower_CheckPartyHasThreeMonsThatAreNotEggs: ; 8b2c1 cp b ret z ld a, b - cp BATTLETOWER_PARTY_SIZE + cp BATTLETOWER_PARTY_LENGTH ret ; 8b2da Function_PartyCountEq3: ; 8b2da ld a, [PartyCount] - cp BATTLETOWER_PARTY_SIZE + cp BATTLETOWER_PARTY_LENGTH ret z scf ret diff --git a/engine/events/daycare.asm b/engine/events/daycare.asm index a7eb565bb..f65464a8d 100755 --- a/engine/events/daycare.asm +++ b/engine/events/daycare.asm @@ -531,7 +531,7 @@ DayCare_GiveEgg: ; 169ac ld [hl], a ld hl, PartyMonNicknames - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call DayCare_GetCurrentPartyMember ld hl, wEggNick call CopyBytes @@ -620,7 +620,7 @@ DayCare_InitBreeding: ; 16a3b ld bc, wEggMonEnd - wEggMon call ByteFill ld hl, wEggNick - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call ByteFill ld hl, wEggOT ld bc, NAME_LENGTH diff --git a/engine/events/halloffame.asm b/engine/events/halloffame.asm index ce6e5ddc7..dbd3a2d5a 100755 --- a/engine/events/halloffame.asm +++ b/engine/events/halloffame.asm @@ -208,9 +208,9 @@ GetHallOfFameParty: ; 8653f push bc ld a, c ld hl, PartyMonNicknames - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call AddNTimes - ld bc, PKMN_NAME_LENGTH - 1 + ld bc, MON_NAME_LENGTH - 1 call CopyBytes pop bc @@ -460,7 +460,7 @@ DisplayHOFMon: ; 86748 ld a, [hli] ld [TempMonLevel], a ld de, StringBuffer2 - ld bc, PKMN_NAME_LENGTH - 1 + ld bc, MON_NAME_LENGTH - 1 call CopyBytes ld a, "@" ld [StringBuffer2 + 10], a diff --git a/engine/events/name_rater.asm b/engine/events/name_rater.asm index 771c5090a..796647f48 100644 --- a/engine/events/name_rater.asm +++ b/engine/events/name_rater.asm @@ -45,13 +45,13 @@ NameRater: ; fb6ed jr c, .samename ; Copy the new name from StringBuffer2 ld hl, PartyMonNicknames - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH ld a, [CurPartyMon] call AddNTimes ld e, l ld d, h ld hl, StringBuffer2 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes ld hl, NameRaterEvenBetterText @@ -115,7 +115,7 @@ CheckIfMonIsYourOT: ; fb78a IsNewNameEmpty: ; fb7be ; Checks to see if the nickname loaded in StringBuffer2 is empty. If so, return carry. ld hl, StringBuffer2 - ld c, PKMN_NAME_LENGTH - 1 + ld c, MON_NAME_LENGTH - 1 .loop ld a, [hli] cp "@" @@ -137,7 +137,7 @@ IsNewNameEmpty: ; fb7be CompareNewToOld: ; fb7d3 ; Compares the nickname in StringBuffer2 to the previous nickname. If they are the same, return carry. ld hl, PartyMonNicknames - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH ld a, [CurPartyMon] call AddNTimes push hl @@ -178,7 +178,7 @@ GetNicknameLength: ; fb802 ret z inc c ld a, c - cp PKMN_NAME_LENGTH - 1 + cp MON_NAME_LENGTH - 1 jr nz, .loop ret ; fb80f diff --git a/engine/events/odd_egg.asm b/engine/events/odd_egg.asm index 4cbeb34dc..de3107804 100644 --- a/engine/events/odd_egg.asm +++ b/engine/events/odd_egg.asm @@ -43,7 +43,7 @@ GiveOddEgg: ; 1fb4b6 call AddNTimes ld de, OddEggSpecies - ld bc, PARTYMON_STRUCT_LENGTH + 2 * PKMN_NAME_LENGTH + ld bc, PARTYMON_STRUCT_LENGTH + 2 * MON_NAME_LENGTH call CopyBytes ld a, EGG_TICKET @@ -73,7 +73,7 @@ GiveOddEgg: ; 1fb4b6 ; load Odd Egg Name in wTempOddEggNickname ld hl, .Odd ld de, wTempOddEggNickname - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes ; load pointer to wTempOddEggNickname in wMobileMonOTNamePointerBuffer diff --git a/engine/events/poke_seer.asm b/engine/events/poke_seer.asm index c7e6bd5ee..fb9c6d9f9 100644 --- a/engine/events/poke_seer.asm +++ b/engine/events/poke_seer.asm @@ -148,10 +148,10 @@ ReadCaughtData: ; 4f134 GetCaughtName: ; 4f176 ld a, [CurPartyMon] ld hl, PartyMonNicknames - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call AddNTimes ld de, wSeerNickname - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes ret ; 4f18c diff --git a/engine/events/special.asm b/engine/events/special.asm index 6238acc44..128e7af29 100755 --- a/engine/events/special.asm +++ b/engine/events/special.asm @@ -228,7 +228,7 @@ Data_DaisyMassage: ; 746b CopyPokemonName_Buffer1_Buffer3: ; 746e ld hl, StringBuffer1 ld de, StringBuffer3 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH jp CopyBytes DummyPredef1: ; 747a diff --git a/engine/evolve.asm b/engine/evolve.asm index aac0c68eb..2e72320d4 100755 --- a/engine/evolve.asm +++ b/engine/evolve.asm @@ -371,7 +371,7 @@ UpdateSpeciesNameIfNotNicknamed: ; 42414 jr nz, .loop ld a, [CurPartyMon] - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH ld hl, PartyMonNicknames call AddNTimes push hl @@ -380,7 +380,7 @@ UpdateSpeciesNameIfNotNicknamed: ; 42414 call GetPokemonName ld hl, StringBuffer1 pop de - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH jp CopyBytes ; 42454 diff --git a/engine/item_effects.asm b/engine/item_effects.asm index 29815a56e..c2bdd1f61 100644 --- a/engine/item_effects.asm +++ b/engine/item_effects.asm @@ -599,7 +599,7 @@ ParkBall: ; e8a2 dec a ld [CurPartyMon], a ld hl, PartyMonNicknames - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call AddNTimes ld d, h @@ -668,7 +668,7 @@ ParkBall: ; e8a2 ld hl, wMonOrItemNameBuffer ld de, sBoxMonNicknames - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes ld hl, sBoxMonNicknames @@ -683,7 +683,7 @@ ParkBall: ; e8a2 ld hl, sBoxMonNicknames ld de, wMonOrItemNameBuffer - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes call CloseSRAM diff --git a/engine/learn.asm b/engine/learn.asm index d2751235f..2f1038d7f 100755 --- a/engine/learn.asm +++ b/engine/learn.asm @@ -5,7 +5,7 @@ LearnMove: ; 6508 call GetNick ld hl, StringBuffer1 ld de, wMonOrItemNameBuffer - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes .loop diff --git a/engine/link.asm b/engine/link.asm index 19559798d..86a593284 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -831,7 +831,7 @@ Link_PrepPartyData_Gen2: ; 28595 ld bc, PARTY_LENGTH * NAME_LENGTH call CopyBytes ld hl, PartyMonNicknames - ld bc, PARTY_LENGTH * PKMN_NAME_LENGTH + ld bc, PARTY_LENGTH * MON_NAME_LENGTH call CopyBytes ; Okay, we did all that. Now, are we in the trade center? @@ -978,7 +978,7 @@ Function2868a: ; 2868a ld bc, PARTY_LENGTH * NAME_LENGTH call CopyBytes ld de, OTPartyMonNicknames - ld bc, PARTY_LENGTH * PKMN_NAME_LENGTH + ld bc, PARTY_LENGTH * MON_NAME_LENGTH jp CopyBytes ; 286ba @@ -1657,7 +1657,7 @@ LinkTrade: ; 28b87 call GetPokemonName ld hl, StringBuffer1 ld de, wd004 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes ld a, [wd003] ld hl, OTPartySpecies diff --git a/engine/link_trade.asm b/engine/link_trade.asm index ae84a7beb..504dc6d95 100755 --- a/engine/link_trade.asm +++ b/engine/link_trade.asm @@ -283,7 +283,7 @@ LinkTradeMenu: ; 16d70c ld [hl], a push hl push bc - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH add hl, bc ld [hl], a pop bc @@ -335,7 +335,7 @@ LinkTradeMenu: ; 16d70c ld [hl], $1f push hl push bc - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH add hl, bc ld [hl], $1f pop bc diff --git a/engine/move_mon.asm b/engine/move_mon.asm index 91ac2f207..52894359e 100755 --- a/engine/move_mon.asm +++ b/engine/move_mon.asm @@ -60,7 +60,7 @@ TryAddMonToParty: ; d88c ld d, h ld e, l ld hl, StringBuffer1 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes .skipnickname @@ -397,7 +397,7 @@ AddTempmonToParty: ; da96 ld hl, OTPartyMonNicknames ld a, [CurPartyMon] call SkipNames - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes ld a, [CurPartySpecies] @@ -583,7 +583,7 @@ SendGetPkmnIntoFromBox: ; db3f call SkipNames .okay12 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes pop hl @@ -943,7 +943,7 @@ SendPkmnIntoBox: ; de6e ld de, sBoxMonNicknames ld hl, StringBuffer1 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes ld hl, EnemyMon @@ -1044,7 +1044,7 @@ ShiftBoxMon: ; df47 call .shift ld hl, sBoxMonNicknames - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call .shift ld hl, sBoxMons @@ -1240,7 +1240,7 @@ RemoveMonFromPartyOrBox: ; e039 ; Shift the OT names ld d, h ld e, l - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH add hl, bc ld bc, PartyMonNicknames ld a, [wPokemonWithdrawDepositParameter] @@ -1283,12 +1283,12 @@ RemoveMonFromPartyOrBox: ; e039 jr z, .party6 ld hl, sBoxMonNicknames .party6 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH ld a, [CurPartyMon] call AddNTimes ld d, h ld e, l - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH add hl, bc ld bc, PartyMonNicknamesEnd ld a, [wPokemonWithdrawDepositParameter] @@ -1652,7 +1652,7 @@ GivePoke:: ; e277 call GetPokemonName ld hl, StringBuffer1 ld de, wMonOrItemNameBuffer - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes pop af and a @@ -1664,7 +1664,7 @@ GivePoke:: ; e277 push hl ld a, [ScriptBank] call GetFarHalfword - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH ld a, [ScriptBank] call FarCopyBytes pop hl @@ -1764,7 +1764,7 @@ GivePoke:: ; e277 call GetSRAMBank ld hl, wMonOrItemNameBuffer ld de, sBoxMonNicknames - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes call CloseSRAM ld b, $1 diff --git a/engine/move_mon_wo_mail.asm b/engine/move_mon_wo_mail.asm index c96823d28..e5e1d6e49 100755 --- a/engine/move_mon_wo_mail.asm +++ b/engine/move_mon_wo_mail.asm @@ -7,7 +7,7 @@ InsertPokemonIntoBox: ; 51322 dec a ld [wd265], a ld hl, sBoxMonNicknames - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH ld de, wBufferMonNick call InsertDataIntoBoxOrParty ld a, [sBoxCount] @@ -44,7 +44,7 @@ InsertPokemonIntoParty: ; 5138b dec a ld [wd265], a ld hl, PartyMonNicknames - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH ld de, wBufferMonNick call InsertDataIntoBoxOrParty ld a, [PartyCount] diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index 331fff37c..f9832dd98 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -254,7 +254,7 @@ NamingScreen: ; 116c1 ret .StoreMonIconParams: ; 1187b (4:587b) - ld a, PKMN_NAME_LENGTH - 1 + ld a, MON_NAME_LENGTH - 1 hlcoord 5, 6 jr .StoreParams diff --git a/engine/npctrade.asm b/engine/npctrade.asm index a9055a15d..40f6dd638 100755 --- a/engine/npctrade.asm +++ b/engine/npctrade.asm @@ -206,7 +206,7 @@ DoNPCTrade: ; fcc63 call CopyTradeName ld hl, PartyMonNicknames - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call Trade_GetAttributeOfLastPartymon ld hl, wOTTrademonNickname call CopyTradeName diff --git a/engine/pack.asm b/engine/pack.asm index f6f67845b..f9c7490af 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -630,7 +630,7 @@ GiveItem: ; 103fd call GetCurNick ld hl, StringBuffer1 ld de, wMonOrItemNameBuffer - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes call TryGiveItemToPartymon pop af diff --git a/engine/party_menu.asm b/engine/party_menu.asm index 33186170a..5ef9b50de 100644 --- a/engine/party_menu.asm +++ b/engine/party_menu.asm @@ -524,7 +524,7 @@ PlacePartyMonMobileBattleSelection: ; 50307 dec c jr nz, .loop ld a, l - ld e, PKMN_NAME_LENGTH + ld e, MON_NAME_LENGTH sub e ld l, a ld a, h diff --git a/engine/pokegear.asm b/engine/pokegear.asm index 5bb63b897..f65f394be 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -2093,7 +2093,7 @@ PlayRadio: ; 91a53 ; 91ab9 .StationPointers: ; 91ab9 -; entries correspond to radio station constants +; entries correspond to MAPRADIO_* constants dw .OakOrPnP dw LoadStation_OaksPokemonTalk dw LoadStation_PokedexShow diff --git a/engine/printer.asm b/engine/printer.asm index 002620606..4479d5d0b 100755 --- a/engine/printer.asm +++ b/engine/printer.asm @@ -774,10 +774,10 @@ Printer_PrintBoxListSegment: ; 848e7 (21:48e7) pop hl jr z, .ok2 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH add hl, bc call Printer_GetMonGender - ld bc, SCREEN_WIDTH - PKMN_NAME_LENGTH + ld bc, SCREEN_WIDTH - MON_NAME_LENGTH add hl, bc ld a, "/" ld [hli], a @@ -795,7 +795,7 @@ Printer_PrintBoxListSegment: ; 848e7 (21:48e7) ld h, a ld bc, sBoxMonNicknames - sBox add hl, bc - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH ld a, [wWhichBoxMonToPrint] call AddNTimes ld e, l @@ -806,7 +806,7 @@ Printer_PrintBoxListSegment: ; 848e7 (21:48e7) call PlaceString pop hl - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH add hl, bc push hl ld a, [wAddrOfBoxToPrint] diff --git a/engine/radio.asm b/engine/radio.asm index 54da69255..df0d81679 100644 --- a/engine/radio.asm +++ b/engine/radio.asm @@ -273,7 +273,7 @@ endr call GetPokemonName ld hl, StringBuffer1 ld de, wMonOrItemNameBuffer - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes ; Now that we've chosen our wild Pokemon, diff --git a/engine/routines/checknickerrors.asm b/engine/routines/checknickerrors.asm index 245c28586..87ebd6bb3 100644 --- a/engine/routines/checknickerrors.asm +++ b/engine/routines/checknickerrors.asm @@ -6,7 +6,7 @@ CheckNickErrors:: ; 669f push bc push de - ld b, PKMN_NAME_LENGTH + ld b, MON_NAME_LENGTH .checkchar ; end of nick? diff --git a/engine/routines/correcterrorsinplayerparty.asm b/engine/routines/correcterrorsinplayerparty.asm index 639e5c544..42e550900 100644 --- a/engine/routines/correcterrorsinplayerparty.asm +++ b/engine/routines/correcterrorsinplayerparty.asm @@ -128,7 +128,7 @@ Unreferenced_CorrectErrorsInPlayerParty: ld hl, StringBuffer1 .got_nickname pop de - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes pop bc diff --git a/engine/routines/initlist.asm b/engine/routines/initlist.asm index e2b7235ab..b7260e552 100644 --- a/engine/routines/initlist.asm +++ b/engine/routines/initlist.asm @@ -21,7 +21,7 @@ InitList: ; 50db9 jr nz, .check_item_name ld hl, CurMart ld de, PokemonNames - ld a, PKMN_NAME + ld a, MON_NAME jr .done .check_item_name diff --git a/engine/start_menu.asm b/engine/start_menu.asm index 88b7ee853..c0c4a38a3 100755 --- a/engine/start_menu.asm +++ b/engine/start_menu.asm @@ -798,7 +798,7 @@ GiveTakePartyMonItem: ; 12b60 call GetCurNick ld hl, StringBuffer1 ld de, wMonOrItemNameBuffer - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes ld a, [wMenuCursorY] cp 1 diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm index cb677ada4..a65cecc8a 100755 --- a/engine/stats_screen.asm +++ b/engine/stats_screen.asm @@ -1117,7 +1117,7 @@ StatsScreen_LoadPageIndicators: ; 4e4cd (13:64cd) CopyNickname: ; 4e505 (13:6505) ld de, StringBuffer1 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH jr .okay ; utterly pointless .okay ld a, [MonType] diff --git a/engine/wildmons.asm b/engine/wildmons.asm index 6634d7586..50d4ea250 100755 --- a/engine/wildmons.asm +++ b/engine/wildmons.asm @@ -913,7 +913,7 @@ Special_RandomPhoneWildMon: ; 2a51f call GetPokemonName ld hl, StringBuffer1 ld de, StringBuffer4 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH jp CopyBytes ; 2a567 @@ -997,7 +997,7 @@ Special_RandomPhoneMon: ; 2a567 call GetPokemonName ld hl, StringBuffer1 ld de, StringBuffer4 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH jp CopyBytes ; 2a5e9 -- cgit v1.2.3 From 732bb36c8661afdaca765604c75437089930738c Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sat, 20 Jan 2018 14:10:31 -0500 Subject: Scale addresses with PARTY_LENGTH --- engine/battle/trainer_huds.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/battle/trainer_huds.asm b/engine/battle/trainer_huds.asm index 179cc806d..317e72214 100755 --- a/engine/battle/trainer_huds.asm +++ b/engine/battle/trainer_huds.asm @@ -44,7 +44,7 @@ ShowOTTrainerMonsRemaining: ; 2c03a ld [hl], 4 * 8 ld a, -8 ld [wPlaceBallsDirection], a - ld hl, Sprite07 + ld hl, Sprite01 + PARTY_LENGTH * SPRITEOAMSTRUCT_LENGTH jp LoadTrainerHudOAM ; 2c059 @@ -203,7 +203,7 @@ LinkBattle_TrainerHuds: ; 2c10d ld a, 10 * 8 ld [hli], a ld [hl], 13 * 8 - ld hl, Sprite07 + ld hl, Sprite01 + PARTY_LENGTH * SPRITEOAMSTRUCT_LENGTH jp LoadTrainerHudOAM ; 2c143 -- cgit v1.2.3 From a8eb44b6e3b2e376491c68efe4a67e8f1badb0e8 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sun, 21 Jan 2018 13:58:16 -0500 Subject: Separate new_game graphics --- engine/crystal_cgb.asm | 325 ++++++++++ engine/crystal_colors.asm | 325 ---------- engine/init_gender.asm | 4 +- engine/naming_screen.asm | 1467 +++++++++++++++++++++++++++++++++++++++++++++ engine/namingscreen.asm | 1467 --------------------------------------------- engine/timeset.asm | 6 +- 6 files changed, 1797 insertions(+), 1797 deletions(-) create mode 100755 engine/crystal_cgb.asm delete mode 100755 engine/crystal_colors.asm create mode 100755 engine/naming_screen.asm delete mode 100755 engine/namingscreen.asm (limited to 'engine') diff --git a/engine/crystal_cgb.asm b/engine/crystal_cgb.asm new file mode 100755 index 000000000..9fd01aac0 --- /dev/null +++ b/engine/crystal_cgb.asm @@ -0,0 +1,325 @@ +GetMysteryGift_MobileAdapterLayout: ; 4930f (mobile) + ld a, b + cp SCGB_RAM + jr nz, .not_ram + ld a, [SGBPredef] +.not_ram + push af + farcall ResetBGPals + pop af + ld l, a + ld h, 0 + add hl, hl + ld de, .dw + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + ld de, .done + push de + jp hl +.done + ret +; 49330 (12:5330) + +.dw ; 49330 + dw MG_Mobile_Layout00 + dw MG_Mobile_Layout01 + dw MG_Mobile_Layout02 +; 49336 + +MG_Mobile_Layout_FillBox: ; 49336 +.row + push bc + push hl +.col + 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 +; 49346 + +MG_Mobile_Layout_WipeAttrMap: ; 49346 (12:5346) + hlcoord 0, 0, AttrMap + ld bc, SCREEN_HEIGHT * SCREEN_WIDTH + xor a + call ByteFill + ret + +MG_Mobile_Layout_LoadPals: ; 49351 (12:5351) + ld de, wBGPals1 + ld hl, Palette_493e1 + ld bc, 5 palettes + ld a, BANK(wBGPals1) + call FarCopyWRAM + ld de, wBGPals1 palette PAL_BG_TEXT + ld hl, Palette_TextBG7 + ld bc, 1 palettes + ld a, BANK(wBGPals1) + call FarCopyWRAM + ret + +MG_Mobile_Layout00: ; 4936e (12:536e) + call MG_Mobile_Layout_LoadPals + call MG_Mobile_Layout_WipeAttrMap + call MG_Mobile_Layout_CreatePalBoxes + farcall ApplyAttrMap + farcall ApplyPals + ret + +MG_Mobile_Layout_CreatePalBoxes: ; 49384 (12:5384) + hlcoord 0, 0, AttrMap + lb bc, 4, 1 + ld a, $1 + call MG_Mobile_Layout_FillBox + lb bc, 2, 1 + ld a, $2 + call MG_Mobile_Layout_FillBox + lb bc, 6, 1 + ld a, $3 + call MG_Mobile_Layout_FillBox + hlcoord 1, 0, AttrMap + ld a, $1 + lb bc, 3, 18 + call MG_Mobile_Layout_FillBox + lb bc, 2, 18 + ld a, $2 + call MG_Mobile_Layout_FillBox + lb bc, 12, 18 + ld a, $3 + call MG_Mobile_Layout_FillBox + hlcoord 19, 0, AttrMap + lb bc, 4, 1 + ld a, $1 + call MG_Mobile_Layout_FillBox + lb bc, 2, 1 + ld a, $2 + call MG_Mobile_Layout_FillBox + lb bc, 6, 1 + ld a, $3 + call MG_Mobile_Layout_FillBox + hlcoord 0, 12, AttrMap + ld bc, 6 * SCREEN_WIDTH + ld a, $7 + call ByteFill + ret +; 493e1 (12:53e1) + +Palette_493e1: ; 493e1 +INCLUDE "gfx/mystery_gift/mg_mobile.pal" +; 49409 + +LoadOW_BGPal7:: ; 49409 + ld hl, Palette_TextBG7 + ld de, wBGPals1 palette PAL_BG_TEXT + ld bc, 1 palettes + ld a, BANK(wBGPals1) + call FarCopyWRAM + ret +; 49418 + +Palette_TextBG7: ; 49418 +INCLUDE "gfx/font/bg_text.pal" +; 49420 + +Function49420:: ; 49420 (12:5420) + ld hl, MansionPalette1 + 8 palettes + ld de, wBGPals1 palette PAL_BG_ROOF + ld bc, 1 palettes + ld a, BANK(wBGPals1) + call FarCopyWRAM + ret +; 4942f (12:542f) + +MG_Mobile_Layout01: ; 4942f + call MG_Mobile_Layout_LoadPals + ld de, wBGPals1 palette PAL_BG_TEXT + ld hl, .Palette_49478 + ld bc, 1 palettes + ld a, BANK(wBGPals1) + call FarCopyWRAM + call MG_Mobile_Layout_WipeAttrMap + hlcoord 0, 0, AttrMap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT + xor a + call ByteFill + hlcoord 0, 14, AttrMap + ld bc, 4 * SCREEN_WIDTH + ld a, $7 + call ByteFill + ld a, [wd002] + bit 6, a + jr z, .asm_49464 + call Function49480 + jr .asm_49467 + +.asm_49464 + call Function49496 + +.asm_49467 + farcall ApplyAttrMap + farcall ApplyPals + ld a, $1 + ld [hCGBPalUpdate], a + ret +; 49478 + +.Palette_49478: ; 49478 + RGB 31, 31, 31 + RGB 26, 31, 00 + RGB 20, 16, 03 + RGB 00, 00, 00 +; 49480 + +Function49480: ; 49480 + hlcoord 0, 0, AttrMap + lb bc, 4, SCREEN_WIDTH + ld a, $7 + call MG_Mobile_Layout_FillBox + hlcoord 0, 2, AttrMap + ld a, $4 + ld [hl], a + hlcoord 19, 2, AttrMap + ld [hl], a + ret +; 49496 + +Function49496: ; 49496 + hlcoord 0, 0, AttrMap + lb bc, 2, SCREEN_WIDTH + ld a, $7 + call MG_Mobile_Layout_FillBox + hlcoord 0, 1, AttrMap + ld a, $4 + ld [hl], a + hlcoord 19, 1, AttrMap + ld [hl], a + ret +; 494ac + +INCLUDE "engine/tileset_palettes.asm" + +MG_Mobile_Layout02: ; 49706 + ld hl, .Palette_49732 + ld de, wBGPals1 + ld bc, 1 palettes + ld a, BANK(wBGPals1) + call FarCopyWRAM + farcall ApplyPals + call MG_Mobile_Layout_WipeAttrMap + farcall ApplyAttrMap + ld hl, .Palette_4973a + ld de, wOBPals1 + ld bc, 1 palettes + ld a, BANK(wOBPals1) + call FarCopyWRAM + ret +; 49732 + +.Palette_49732: ; 49732 + RGB 31, 31, 31 + RGB 23, 16, 07 + RGB 23, 07, 07 + RGB 03, 07, 20 +; 4973a + +.Palette_4973a: ; 4973a + RGB 00, 00, 00 + RGB 07, 05, 31 + RGB 14, 18, 31 + RGB 31, 31, 31 +; 49742 + +Function49742: ; 49742 + ld hl, .Palette_49757 + ld de, wBGPals1 + ld bc, 8 palettes + ld a, BANK(wBGPals1) + call FarCopyWRAM + farcall ApplyPals + ret +; 49757 + +.Palette_49757: ; 49757 +INCLUDE "gfx/unknown/49757.pal" +; 49797 + +_InitMG_Mobile_LinkTradePalMap: ; 49797 + hlcoord 0, 0, AttrMap + lb bc, 16, 2 + ld a, $4 + call MG_Mobile_Layout_FillBox + ld a, $3 + ldcoord_a 0, 1, AttrMap + ldcoord_a 0, 14, AttrMap + hlcoord 2, 0, AttrMap + lb bc, 8, 18 + ld a, $5 + call MG_Mobile_Layout_FillBox + hlcoord 2, 8, AttrMap + lb bc, 8, 18 + ld a, $6 + call MG_Mobile_Layout_FillBox + hlcoord 0, 16, AttrMap + lb bc, 2, SCREEN_WIDTH + ld a, $4 + call MG_Mobile_Layout_FillBox + ld a, $3 + lb bc, 6, 1 + hlcoord 6, 1, AttrMap + call MG_Mobile_Layout_FillBox + ld a, $3 + lb bc, 6, 1 + hlcoord 17, 1, AttrMap + call MG_Mobile_Layout_FillBox + ld a, $3 + lb bc, 6, 1 + hlcoord 6, 9, AttrMap + call MG_Mobile_Layout_FillBox + ld a, $3 + lb bc, 6, 1 + hlcoord 17, 9, AttrMap + call MG_Mobile_Layout_FillBox + ld a, $2 + hlcoord 2, 16, AttrMap + ld [hli], a + ld a, $7 + ld [hli], a + ld [hli], a + ld [hli], a + ld a, $2 + ld [hl], a + hlcoord 2, 17, AttrMap + ld a, $3 + ld bc, 6 + call ByteFill + ret +; 49811 + +LoadTradeRoomBGPals: ; 49811 + ld hl, TradeRoomPalette + ld de, wBGPals1 palette PAL_BG_GREEN + ld bc, 6 palettes + ld a, BANK(wBGPals1) + call FarCopyWRAM + farcall ApplyPals + ret +; 49826 + +TradeRoomPalette: ; 49826 +INCLUDE "gfx/trade/border.pal" +; 49856 + +InitMG_Mobile_LinkTradePalMap: ; 49856 + call _InitMG_Mobile_LinkTradePalMap + ret +; 4985a + +; unused +INCLUDE "gfx/unknown/4985a.asm" diff --git a/engine/crystal_colors.asm b/engine/crystal_colors.asm deleted file mode 100755 index 9fd01aac0..000000000 --- a/engine/crystal_colors.asm +++ /dev/null @@ -1,325 +0,0 @@ -GetMysteryGift_MobileAdapterLayout: ; 4930f (mobile) - ld a, b - cp SCGB_RAM - jr nz, .not_ram - ld a, [SGBPredef] -.not_ram - push af - farcall ResetBGPals - pop af - ld l, a - ld h, 0 - add hl, hl - ld de, .dw - add hl, de - ld a, [hli] - ld h, [hl] - ld l, a - ld de, .done - push de - jp hl -.done - ret -; 49330 (12:5330) - -.dw ; 49330 - dw MG_Mobile_Layout00 - dw MG_Mobile_Layout01 - dw MG_Mobile_Layout02 -; 49336 - -MG_Mobile_Layout_FillBox: ; 49336 -.row - push bc - push hl -.col - 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 -; 49346 - -MG_Mobile_Layout_WipeAttrMap: ; 49346 (12:5346) - hlcoord 0, 0, AttrMap - ld bc, SCREEN_HEIGHT * SCREEN_WIDTH - xor a - call ByteFill - ret - -MG_Mobile_Layout_LoadPals: ; 49351 (12:5351) - ld de, wBGPals1 - ld hl, Palette_493e1 - ld bc, 5 palettes - ld a, BANK(wBGPals1) - call FarCopyWRAM - ld de, wBGPals1 palette PAL_BG_TEXT - ld hl, Palette_TextBG7 - ld bc, 1 palettes - ld a, BANK(wBGPals1) - call FarCopyWRAM - ret - -MG_Mobile_Layout00: ; 4936e (12:536e) - call MG_Mobile_Layout_LoadPals - call MG_Mobile_Layout_WipeAttrMap - call MG_Mobile_Layout_CreatePalBoxes - farcall ApplyAttrMap - farcall ApplyPals - ret - -MG_Mobile_Layout_CreatePalBoxes: ; 49384 (12:5384) - hlcoord 0, 0, AttrMap - lb bc, 4, 1 - ld a, $1 - call MG_Mobile_Layout_FillBox - lb bc, 2, 1 - ld a, $2 - call MG_Mobile_Layout_FillBox - lb bc, 6, 1 - ld a, $3 - call MG_Mobile_Layout_FillBox - hlcoord 1, 0, AttrMap - ld a, $1 - lb bc, 3, 18 - call MG_Mobile_Layout_FillBox - lb bc, 2, 18 - ld a, $2 - call MG_Mobile_Layout_FillBox - lb bc, 12, 18 - ld a, $3 - call MG_Mobile_Layout_FillBox - hlcoord 19, 0, AttrMap - lb bc, 4, 1 - ld a, $1 - call MG_Mobile_Layout_FillBox - lb bc, 2, 1 - ld a, $2 - call MG_Mobile_Layout_FillBox - lb bc, 6, 1 - ld a, $3 - call MG_Mobile_Layout_FillBox - hlcoord 0, 12, AttrMap - ld bc, 6 * SCREEN_WIDTH - ld a, $7 - call ByteFill - ret -; 493e1 (12:53e1) - -Palette_493e1: ; 493e1 -INCLUDE "gfx/mystery_gift/mg_mobile.pal" -; 49409 - -LoadOW_BGPal7:: ; 49409 - ld hl, Palette_TextBG7 - ld de, wBGPals1 palette PAL_BG_TEXT - ld bc, 1 palettes - ld a, BANK(wBGPals1) - call FarCopyWRAM - ret -; 49418 - -Palette_TextBG7: ; 49418 -INCLUDE "gfx/font/bg_text.pal" -; 49420 - -Function49420:: ; 49420 (12:5420) - ld hl, MansionPalette1 + 8 palettes - ld de, wBGPals1 palette PAL_BG_ROOF - ld bc, 1 palettes - ld a, BANK(wBGPals1) - call FarCopyWRAM - ret -; 4942f (12:542f) - -MG_Mobile_Layout01: ; 4942f - call MG_Mobile_Layout_LoadPals - ld de, wBGPals1 palette PAL_BG_TEXT - ld hl, .Palette_49478 - ld bc, 1 palettes - ld a, BANK(wBGPals1) - call FarCopyWRAM - call MG_Mobile_Layout_WipeAttrMap - hlcoord 0, 0, AttrMap - ld bc, SCREEN_WIDTH * SCREEN_HEIGHT - xor a - call ByteFill - hlcoord 0, 14, AttrMap - ld bc, 4 * SCREEN_WIDTH - ld a, $7 - call ByteFill - ld a, [wd002] - bit 6, a - jr z, .asm_49464 - call Function49480 - jr .asm_49467 - -.asm_49464 - call Function49496 - -.asm_49467 - farcall ApplyAttrMap - farcall ApplyPals - ld a, $1 - ld [hCGBPalUpdate], a - ret -; 49478 - -.Palette_49478: ; 49478 - RGB 31, 31, 31 - RGB 26, 31, 00 - RGB 20, 16, 03 - RGB 00, 00, 00 -; 49480 - -Function49480: ; 49480 - hlcoord 0, 0, AttrMap - lb bc, 4, SCREEN_WIDTH - ld a, $7 - call MG_Mobile_Layout_FillBox - hlcoord 0, 2, AttrMap - ld a, $4 - ld [hl], a - hlcoord 19, 2, AttrMap - ld [hl], a - ret -; 49496 - -Function49496: ; 49496 - hlcoord 0, 0, AttrMap - lb bc, 2, SCREEN_WIDTH - ld a, $7 - call MG_Mobile_Layout_FillBox - hlcoord 0, 1, AttrMap - ld a, $4 - ld [hl], a - hlcoord 19, 1, AttrMap - ld [hl], a - ret -; 494ac - -INCLUDE "engine/tileset_palettes.asm" - -MG_Mobile_Layout02: ; 49706 - ld hl, .Palette_49732 - ld de, wBGPals1 - ld bc, 1 palettes - ld a, BANK(wBGPals1) - call FarCopyWRAM - farcall ApplyPals - call MG_Mobile_Layout_WipeAttrMap - farcall ApplyAttrMap - ld hl, .Palette_4973a - ld de, wOBPals1 - ld bc, 1 palettes - ld a, BANK(wOBPals1) - call FarCopyWRAM - ret -; 49732 - -.Palette_49732: ; 49732 - RGB 31, 31, 31 - RGB 23, 16, 07 - RGB 23, 07, 07 - RGB 03, 07, 20 -; 4973a - -.Palette_4973a: ; 4973a - RGB 00, 00, 00 - RGB 07, 05, 31 - RGB 14, 18, 31 - RGB 31, 31, 31 -; 49742 - -Function49742: ; 49742 - ld hl, .Palette_49757 - ld de, wBGPals1 - ld bc, 8 palettes - ld a, BANK(wBGPals1) - call FarCopyWRAM - farcall ApplyPals - ret -; 49757 - -.Palette_49757: ; 49757 -INCLUDE "gfx/unknown/49757.pal" -; 49797 - -_InitMG_Mobile_LinkTradePalMap: ; 49797 - hlcoord 0, 0, AttrMap - lb bc, 16, 2 - ld a, $4 - call MG_Mobile_Layout_FillBox - ld a, $3 - ldcoord_a 0, 1, AttrMap - ldcoord_a 0, 14, AttrMap - hlcoord 2, 0, AttrMap - lb bc, 8, 18 - ld a, $5 - call MG_Mobile_Layout_FillBox - hlcoord 2, 8, AttrMap - lb bc, 8, 18 - ld a, $6 - call MG_Mobile_Layout_FillBox - hlcoord 0, 16, AttrMap - lb bc, 2, SCREEN_WIDTH - ld a, $4 - call MG_Mobile_Layout_FillBox - ld a, $3 - lb bc, 6, 1 - hlcoord 6, 1, AttrMap - call MG_Mobile_Layout_FillBox - ld a, $3 - lb bc, 6, 1 - hlcoord 17, 1, AttrMap - call MG_Mobile_Layout_FillBox - ld a, $3 - lb bc, 6, 1 - hlcoord 6, 9, AttrMap - call MG_Mobile_Layout_FillBox - ld a, $3 - lb bc, 6, 1 - hlcoord 17, 9, AttrMap - call MG_Mobile_Layout_FillBox - ld a, $2 - hlcoord 2, 16, AttrMap - ld [hli], a - ld a, $7 - ld [hli], a - ld [hli], a - ld [hli], a - ld a, $2 - ld [hl], a - hlcoord 2, 17, AttrMap - ld a, $3 - ld bc, 6 - call ByteFill - ret -; 49811 - -LoadTradeRoomBGPals: ; 49811 - ld hl, TradeRoomPalette - ld de, wBGPals1 palette PAL_BG_GREEN - ld bc, 6 palettes - ld a, BANK(wBGPals1) - call FarCopyWRAM - farcall ApplyPals - ret -; 49826 - -TradeRoomPalette: ; 49826 -INCLUDE "gfx/trade/border.pal" -; 49856 - -InitMG_Mobile_LinkTradePalMap: ; 49856 - call _InitMG_Mobile_LinkTradePalMap - ret -; 4985a - -; unused -INCLUDE "gfx/unknown/4985a.asm" diff --git a/engine/init_gender.asm b/engine/init_gender.asm index 540a0b63f..76b1640d9 100755 --- a/engine/init_gender.asm +++ b/engine/init_gender.asm @@ -96,7 +96,7 @@ LoadGenderScreenPal: ; 48e47 (12:4e47) ; 48e5c (12:4e5c) .Palette: ; 48e5c -INCLUDE "gfx/intro/gender_screen.pal" +INCLUDE "gfx/new_game/gender_screen.pal" ; 48e64 LoadGenderScreenLightBlueTile: ; 48e64 (12:4e64) @@ -108,4 +108,4 @@ LoadGenderScreenLightBlueTile: ; 48e64 (12:4e64) ; 48e71 (12:4e71) .LightBlueTile: ; 48e71 -INCBIN "gfx/intro/gender_screen.2bpp" +INCBIN "gfx/new_game/gender_screen.2bpp" diff --git a/engine/naming_screen.asm b/engine/naming_screen.asm new file mode 100755 index 000000000..b53a3b09d --- /dev/null +++ b/engine/naming_screen.asm @@ -0,0 +1,1467 @@ +NAMINGSCREEN_CURSOR EQU $7e + +NAMINGSCREEN_BORDER EQUS "\"■\"" ; $60 +NAMINGSCREEN_MIDDLELINE EQUS "\"→\"" ; $eb +NAMINGSCREEN_UNDERLINE EQUS "\"\"" ; $f2 + +_NamingScreen: ; 0x116b7 + call DisableSpriteUpdates + call NamingScreen + call ReturnToMapWithSpeechTextbox + ret + +; 0x116c1 + +NamingScreen: ; 116c1 + ld hl, wNamingScreenDestinationPointer + ld [hl], e + inc hl + ld [hl], d + ld hl, wNamingScreenType + ld [hl], b + ld hl, Options + ld a, [hl] + push af + set NO_TEXT_SCROLL, [hl] + ld a, [hMapAnims] + push af + xor a + ld [hMapAnims], a + ld a, [hInMenu] + push af + ld a, $1 + ld [hInMenu], a + call .SetUpNamingScreen + call DelayFrame +.loop + call NamingScreenJoypadLoop + jr nc, .loop + pop af + ld [hInMenu], a + pop af + ld [hMapAnims], a + pop af + ld [Options], a + call ClearJoypad + ret + +; 116f8 + +.SetUpNamingScreen: ; 116f8 + call ClearBGPalettes + ld b, SCGB_DIPLOMA + call GetSGBLayout + call DisableLCD + call LoadNamingScreenGFX + call NamingScreen_InitText + ld a, LCDC_DEFAULT + ld [rLCDC], a + call .GetNamingScreenSetup + call WaitBGMap + call WaitTop + call SetPalettes + call NamingScreen_InitNameEntry + ret + +; 1171d + +.GetNamingScreenSetup: ; 1171d + ld a, [wNamingScreenType] + and 7 + 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 + +; 1172e + +.Jumptable: ; 1172e (4:572e) + dw .Pokemon + dw .Player + dw .Rival + dw .Mom + dw .Box + dw .Tomodachi + dw .Pokemon + dw .Pokemon + +.Pokemon: ; 1173e (4:573e) + ld a, [CurPartySpecies] + ld [wd265], a + ld hl, LoadMenuMonIcon + ld a, BANK(LoadMenuMonIcon) + ld e, $1 + rst FarCall ; ; indirect jump to LoadMenuMonIcon (8e83f (23:683f)) + ld a, [CurPartySpecies] + ld [wd265], a + call GetPokemonName + hlcoord 5, 2 + call PlaceString + ld l, c + ld h, b + ld de, .NicknameStrings + call PlaceString + inc de + hlcoord 5, 4 + call PlaceString + farcall GetGender + jr c, .genderless + ld a, "♂" + jr nz, .place_gender + ld a, "♀" +.place_gender + hlcoord 1, 2 + ld [hl], a +.genderless + call .StoreMonIconParams + ret + +; 11780 (4:5780) + +.NicknameStrings: ; 11780 + db "'S@" + db "NICKNAME?@" + +; 1178d + +.Player: ; 1178d (4:578d) + farcall GetPlayerIcon + call .LoadSprite + hlcoord 5, 2 + ld de, .PlayerNameString + call PlaceString + call .StoreSpriteIconParams + ret + +; 117a3 (4:57a3) + +.PlayerNameString: ; 117a3 + db "YOUR NAME?@" + +; 117ae + +.Rival: ; 117ae (4:57ae) + ld de, SilverSpriteGFX + ld b, BANK(SilverSpriteGFX) + call .LoadSprite + hlcoord 5, 2 + ld de, .RivalNameString + call PlaceString + call .StoreSpriteIconParams + ret + +; 117c3 (4:57c3) + +.RivalNameString: ; 117c3 + db "RIVAL'S NAME?@" + +; 117d1 + +.Mom: ; 117d1 (4:57d1) + ld de, MomSpriteGFX + ld b, BANK(MomSpriteGFX) + call .LoadSprite + hlcoord 5, 2 + ld de, .MomNameString + call PlaceString + call .StoreSpriteIconParams + ret + +; 117e6 (4:57e6) + +.MomNameString: ; 117e6 + db "MOTHER'S NAME?@" + +; 117f5 + +.Box: ; 117f5 (4:57f5) + ld de, PokeBallSpriteGFX + ld hl, vTiles0 tile $00 + lb bc, BANK(PokeBallSpriteGFX), 4 + call Request2bpp + xor a + ld hl, wSpriteAnimDict + ld [hli], a + ld [hl], a + depixel 4, 4, 4, 0 + ld a, SPRITE_ANIM_INDEX_RED_WALK + call _InitSpriteAnimStruct + ld hl, SPRITEANIMSTRUCT_FRAMESET_ID + add hl, bc + ld [hl], $0 + hlcoord 5, 2 + ld de, .BoxNameString + call PlaceString + call .StoreBoxIconParams + ret + +; 11822 (4:5822) + +.BoxNameString: ; 11822 + db "BOX NAME?@" + +; 1182c + +.Tomodachi: ; 1182c (4:582c) + hlcoord 3, 2 + ld de, .oTomodachi_no_namae_sutoringu + call PlaceString + call .StoreSpriteIconParams + ret + +; 11839 (4:5839) + +.oTomodachi_no_namae_sutoringu ; 11839 + db "おともだち の なまえは?@" + +; 11847 + +.LoadSprite: ; 11847 (4:5847) + push de + ld hl, vTiles0 tile $00 + ld c, $4 + push bc + call Request2bpp + pop bc + ld hl, 12 tiles + add hl, de + ld e, l + ld d, h + ld hl, vTiles0 tile $04 + call Request2bpp + xor a + ld hl, wSpriteAnimDict + ld [hli], a + ld [hl], a + pop de + ld b, SPRITE_ANIM_INDEX_RED_WALK + ld a, d + cp HIGH(KrisSpriteGFX) + jr nz, .not_kris + ld a, e + cp LOW(KrisSpriteGFX) + jr nz, .not_kris + ld b, SPRITE_ANIM_INDEX_BLUE_WALK +.not_kris + ld a, b + depixel 4, 4, 4, 0 + call _InitSpriteAnimStruct + ret + +.StoreMonIconParams: ; 1187b (4:587b) + ld a, MON_NAME_LENGTH - 1 + hlcoord 5, 6 + jr .StoreParams + +.StoreSpriteIconParams: ; 11882 (4:5882) + ld a, PLAYER_NAME_LENGTH - 1 + hlcoord 5, 6 + jr .StoreParams + +.StoreBoxIconParams: ; 11889 (4:5889) + ld a, BOX_NAME_LENGTH - 1 + hlcoord 5, 4 + jr .StoreParams + +.StoreParams: ; 11890 (4:5890) + ld [wNamingScreenMaxNameLength], a + ld a, l + ld [wNamingScreenStringEntryCoord], a + ld a, h + ld [wNamingScreenStringEntryCoord + 1], a + ret + +NamingScreen_IsTargetBox: ; 1189c + push bc + push af + ld a, [wNamingScreenType] + sub $3 + ld b, a + pop af + dec b + pop bc + ret + +; 118a8 + +NamingScreen_InitText: ; 118a8 + call WaitTop + hlcoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT + ld a, NAMINGSCREEN_BORDER + call ByteFill + hlcoord 1, 1 + lb bc, 6, 18 + call NamingScreen_IsTargetBox + jr nz, .not_box + lb bc, 4, 18 + +.not_box + call ClearBox + ld de, NameInputUpper +NamingScreen_ApplyTextInputMode: ; 118ca + call NamingScreen_IsTargetBox + jr nz, .not_box + ld hl, BoxNameInputLower - NameInputLower + add hl, de + ld d, h + ld e, l + +.not_box + push de + hlcoord 1, 8 + lb bc, 7, 18 + call NamingScreen_IsTargetBox + jr nz, .not_box_2 + hlcoord 1, 6 + lb bc, 9, 18 + +.not_box_2 + call ClearBox + hlcoord 1, 16 + lb bc, 1, 18 + call ClearBox + pop de + hlcoord 2, 8 + ld b, $5 + call NamingScreen_IsTargetBox + jr nz, .row + hlcoord 2, 6 + ld b, $6 + +.row + ld c, $11 +.col + ld a, [de] + ld [hli], a + inc de + dec c + jr nz, .col + push de + ld de, 2 * SCREEN_WIDTH - $11 + add hl, de + pop de + dec b + jr nz, .row + ret + +; 11915 + +NamingScreenJoypadLoop: ; 11915 + call JoyTextDelay + ld a, [wJumptableIndex] + bit 7, a + jr nz, .quit + call .RunJumptable + farcall PlaySpriteAnimationsAndDelayFrame + call .UpdateStringEntry + call DelayFrame + and a + ret + +.quit + callfar ClearSpriteAnims + call ClearSprites + xor a + ld [hSCX], a + ld [hSCY], a + scf + ret + +; 11940 + +.UpdateStringEntry: ; 11940 + xor a + ld [hBGMapMode], a + hlcoord 1, 5 + call NamingScreen_IsTargetBox + jr nz, .got_coords + hlcoord 1, 3 + +.got_coords + lb bc, 1, 18 + call ClearBox + ld hl, wNamingScreenDestinationPointer + ld e, [hl] + inc hl + ld d, [hl] + ld hl, wNamingScreenStringEntryCoord + ld a, [hli] + ld h, [hl] + ld l, a + call PlaceString + ld a, $1 + ld [hBGMapMode], a + ret + +; 11968 + +.RunJumptable: ; 11968 + ld a, [wJumptableIndex] + 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 + +; 11977 + +.Jumptable: ; 11977 (4:5977) + dw .InitCursor + dw .ReadButtons + +.InitCursor: ; 1197b (4:597b) + depixel 10, 3 + call NamingScreen_IsTargetBox + jr nz, .got_cursor_position + ld d, 8 * 8 +.got_cursor_position + ld a, SPRITE_ANIM_INDEX_NAMING_SCREEN_CURSOR + call _InitSpriteAnimStruct + ld a, c + ld [wNamingScreenCursorObjectPointer], a + ld a, b + ld [wNamingScreenCursorObjectPointer + 1], a + ld hl, SPRITEANIMSTRUCT_FRAMESET_ID + add hl, bc + ld a, [hl] + ld hl, SPRITEANIMSTRUCT_0E + add hl, bc + ld [hl], a + ld hl, wJumptableIndex + inc [hl] + ret + +.ReadButtons: ; 119a1 (4:59a1) + ld hl, hJoyPressed ; $ffa7 + ld a, [hl] + and A_BUTTON + jr nz, .a + ld a, [hl] + and B_BUTTON + jr nz, .b + ld a, [hl] + and START + jr nz, .start + ld a, [hl] + and SELECT + jr nz, .select + ret + +.a + call .GetCursorPosition + cp $1 + jr z, .select + cp $2 + jr z, .b + cp $3 + jr z, .end + call NamingScreen_GetLastCharacter + call NamingScreen_TryAddCharacter + ret nc + +.start + ld hl, wNamingScreenCursorObjectPointer + ld c, [hl] + inc hl + ld b, [hl] + ld hl, SPRITEANIMSTRUCT_0C + add hl, bc + ld [hl], $8 + ld hl, SPRITEANIMSTRUCT_0D + add hl, bc + ld [hl], $4 + call NamingScreen_IsTargetBox + ret nz + inc [hl] + ret + +.b + call NamingScreen_DeleteCharacter + ret + +.end + call NamingScreen_StoreEntry + ld hl, wJumptableIndex + set 7, [hl] + ret + +.select + ld hl, wNamingScreenLetterCase + ld a, [hl] + xor 1 + ld [hl], a + jr z, .upper + ld de, NameInputLower + call NamingScreen_ApplyTextInputMode + ret + +.upper + ld de, NameInputUpper + call NamingScreen_ApplyTextInputMode + ret + +.GetCursorPosition: ; 11a0b (4:5a0b) + ld hl, wNamingScreenCursorObjectPointer + ld c, [hl] + inc hl + ld b, [hl] + +NamingScreen_GetCursorPosition: ; 11a11 (4:5a11) + ld hl, SPRITEANIMSTRUCT_0D + add hl, bc + ld a, [hl] + push bc + ld b, $4 + call NamingScreen_IsTargetBox + jr nz, .not_box + inc b +.not_box + cp b + pop bc + jr nz, .not_bottom_row + ld hl, SPRITEANIMSTRUCT_0C + add hl, bc + ld a, [hl] + cp $3 + jr c, .case_switch + cp $6 + jr c, .delete + ld a, $3 + ret + +.case_switch + ld a, $1 + ret + +.delete + ld a, $2 + ret + +.not_bottom_row + xor a + ret + +NamingScreen_AnimateCursor: ; 11a3b (4:5a3b) + call .GetDPad + ld hl, SPRITEANIMSTRUCT_0D + add hl, bc + ld a, [hl] + ld e, a + swap e + ld hl, SPRITEANIMSTRUCT_YOFFSET + add hl, bc + ld [hl], e + ld d, $4 + call NamingScreen_IsTargetBox + jr nz, .ok + inc d +.ok + cp d + ld de, .LetterEntries + ld a, SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR - SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR ; 0 + jr nz, .ok2 + ld de, .CaseDelEnd + ld a, SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR_BIG - SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR ; 1 +.ok2 + ld hl, SPRITEANIMSTRUCT_0E + add hl, bc + add [hl] ; default SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR + ld hl, SPRITEANIMSTRUCT_FRAMESET_ID + add hl, bc + ld [hl], a + ld hl, SPRITEANIMSTRUCT_0C + add hl, bc + ld l, [hl] + ld h, $0 + add hl, de + ld a, [hl] + ld hl, SPRITEANIMSTRUCT_XOFFSET + add hl, bc + ld [hl], a + ret + +; 11a79 (4:5a79) + +.LetterEntries: ; 11a79 + db $00, $10, $20, $30, $40, $50, $60, $70, $80 + +.CaseDelEnd: ; 11a82 + db $00, $00, $00, $30, $30, $30, $60, $60, $60 + +; 11a8b + +.GetDPad: ; 11a8b (4:5a8b) + ld hl, hJoyLast + ld a, [hl] + and D_UP + jr nz, .up + ld a, [hl] + and D_DOWN + jr nz, .down + ld a, [hl] + and D_LEFT + jr nz, .left + ld a, [hl] + and D_RIGHT + jr nz, .right + ret + +.right + call NamingScreen_GetCursorPosition + and a + jr nz, .asm_11ab7 + ld hl, SPRITEANIMSTRUCT_0C + add hl, bc + ld a, [hl] + cp $8 + jr nc, .asm_11ab4 + inc [hl] + ret + +.asm_11ab4 + ld [hl], $0 + ret + +.asm_11ab7 + cp $3 + jr nz, .asm_11abc + xor a +.asm_11abc + ld e, a + add a + add e + ld hl, SPRITEANIMSTRUCT_0C + add hl, bc + ld [hl], a + ret + +.left + call NamingScreen_GetCursorPosition + and a + jr nz, .asm_11ad8 + ld hl, SPRITEANIMSTRUCT_0C + add hl, bc + ld a, [hl] + and a + jr z, .asm_11ad5 + dec [hl] + ret + +.asm_11ad5 + ld [hl], $8 + ret + +.asm_11ad8 + cp $1 + jr nz, .asm_11ade + ld a, $4 +.asm_11ade + dec a + dec a + ld e, a + add a + add e + ld hl, SPRITEANIMSTRUCT_0C + add hl, bc + ld [hl], a + ret + +.down + ld hl, SPRITEANIMSTRUCT_0D + add hl, bc + ld a, [hl] + call NamingScreen_IsTargetBox + jr nz, .asm_11af9 + cp $5 + jr nc, .asm_11aff + inc [hl] + ret + +.asm_11af9 + cp $4 + jr nc, .asm_11aff + inc [hl] + ret + +.asm_11aff + ld [hl], $0 + ret + +.up + ld hl, SPRITEANIMSTRUCT_0D + add hl, bc + ld a, [hl] + and a + jr z, .asm_11b0c + dec [hl] + ret + +.asm_11b0c + ld [hl], $4 + call NamingScreen_IsTargetBox + ret nz + inc [hl] + ret + +NamingScreen_TryAddCharacter: ; 11b14 (4:5b14) + ld a, [wNamingScreenLastCharacter] ; lost +MailComposition_TryAddCharacter: ; 11b17 (4:5b17) + ld a, [wNamingScreenMaxNameLength] + ld c, a + ld a, [wNamingScreenCurrNameLength] + cp c + ret nc + + ld a, [wNamingScreenLastCharacter] + +NamingScreen_LoadNextCharacter: ; 11b23 + call NamingScreen_GetTextCursorPosition + ld [hl], a + +NamingScreen_AdvanceCursor_CheckEndOfString: ; 11b27 + ld hl, wNamingScreenCurrNameLength + inc [hl] + call NamingScreen_GetTextCursorPosition + ld a, [hl] + cp "@" + jr z, .end_of_string + ld [hl], NAMINGSCREEN_UNDERLINE + and a + ret + +.end_of_string + scf + ret + +; 11b39 (4:5b39) + +; unused + ld a, [wNamingScreenCurrNameLength] + and a + ret z + push hl + ld hl, wNamingScreenCurrNameLength + dec [hl] + call NamingScreen_GetTextCursorPosition + ld c, [hl] + pop hl + +.loop + ld a, [hli] + cp $ff + jr z, NamingScreen_AdvanceCursor_CheckEndOfString + cp c + jr z, .done + inc hl + jr .loop + +.done + ld a, [hl] + jr NamingScreen_LoadNextCharacter + +; 11b56 + +INCLUDE "data/unused/dakutens.asm" + +; 11bbc + +NamingScreen_DeleteCharacter: ; 11bbc (4:5bbc) + ld hl, wNamingScreenCurrNameLength + ld a, [hl] + and a + ret z + dec [hl] + call NamingScreen_GetTextCursorPosition + ld [hl], NAMINGSCREEN_UNDERLINE + inc hl + ld a, [hl] + cp NAMINGSCREEN_UNDERLINE + ret nz + ld [hl], NAMINGSCREEN_MIDDLELINE + ret + +NamingScreen_GetTextCursorPosition: ; 11bd0 (4:5bd0) + push af + ld hl, wNamingScreenDestinationPointer + ld a, [hli] + ld h, [hl] + ld l, a + ld a, [wNamingScreenCurrNameLength] + ld e, a + ld d, 0 + add hl, de + pop af + ret + +; 11be0 + +NamingScreen_InitNameEntry: ; 11be0 +; load NAMINGSCREEN_UNDERLINE, (NAMINGSCREEN_MIDDLELINE * [wNamingScreenMaxNameLength]), "@" into the dw address at wNamingScreenDestinationPointer + ld hl, wNamingScreenDestinationPointer + ld a, [hli] + ld h, [hl] + ld l, a + ld [hl], NAMINGSCREEN_UNDERLINE + inc hl + ld a, [wNamingScreenMaxNameLength] + dec a + ld c, a + ld a, NAMINGSCREEN_MIDDLELINE +.loop + ld [hli], a + dec c + jr nz, .loop + ld [hl], "@" + ret + +; 11bf7 + +NamingScreen_StoreEntry: ; 11bf7 (4:5bf7) + ld hl, wNamingScreenDestinationPointer + ld a, [hli] + ld h, [hl] + ld l, a + ld a, [wNamingScreenMaxNameLength] + ld c, a +.loop + ld a, [hl] + cp NAMINGSCREEN_MIDDLELINE + jr z, .terminator + cp NAMINGSCREEN_UNDERLINE + jr nz, .not_terminator +.terminator + ld [hl], "@" +.not_terminator + inc hl + dec c + jr nz, .loop + ret + +NamingScreen_GetLastCharacter: ; 11c11 (4:5c11) + ld hl, wNamingScreenCursorObjectPointer + ld c, [hl] + inc hl + ld b, [hl] + ld hl, SPRITEANIMSTRUCT_XOFFSET + add hl, bc + ld a, [hl] + ld hl, SPRITEANIMSTRUCT_XCOORD + add hl, bc + add [hl] + sub $8 + srl a + srl a + srl a + ld e, a + ld hl, SPRITEANIMSTRUCT_YOFFSET + add hl, bc + ld a, [hl] + ld hl, SPRITEANIMSTRUCT_YCOORD + add hl, bc + add [hl] + sub $10 + srl a + srl a + srl a + ld d, a + hlcoord 0, 0 + ld bc, SCREEN_WIDTH +.loop + ld a, d + and a + jr z, .done + add hl, bc + dec d + jr .loop + +.done + add hl, de + ld a, [hl] + ld [wNamingScreenLastCharacter], a + ret + +LoadNamingScreenGFX: ; 11c51 + call ClearSprites + callfar ClearSpriteAnims + call LoadStandardFont + call LoadFontsExtra + + ld de, NamingScreenGFX_MiddleLine + ld hl, vTiles0 tile NAMINGSCREEN_MIDDLELINE + lb bc, BANK(NamingScreenGFX_MiddleLine), 1 + call Get1bpp + + ld de, NamingScreenGFX_UnderLine + ld hl, vTiles0 tile NAMINGSCREEN_UNDERLINE + lb bc, BANK(NamingScreenGFX_UnderLine), 1 + call Get1bpp + + ld de, vTiles2 tile NAMINGSCREEN_BORDER + ld hl, NamingScreenGFX_Border + ld bc, 1 tiles + ld a, BANK(NamingScreenGFX_Border) + call FarCopyBytes + + ld de, vTiles0 tile NAMINGSCREEN_CURSOR + ld hl, NamingScreenGFX_Cursor + ld bc, 2 tiles + ld a, BANK(NamingScreenGFX_Cursor) + call FarCopyBytes + + ld a, $5 + ld hl, wSpriteAnimDict + 9 * 2 + ld [hli], a + ld [hl], NAMINGSCREEN_CURSOR + xor a + ld [hSCY], a + ld [wGlobalAnimYOffset], a + ld [hSCX], a + ld [wGlobalAnimXOffset], a + ld [wJumptableIndex], a + ld [wNamingScreenLetterCase], a + ld [hBGMapMode], a + ld [wNamingScreenCurrNameLength], a + ld a, $7 + ld [hWX], a + ret + +; 11cb7 + +NamingScreenGFX_Border: ; 11cb7 +INCBIN "gfx/naming_screen/border.2bpp" +; 11cc7 + +NamingScreenGFX_Cursor: ; 11cc7 +INCBIN "gfx/naming_screen/cursor.2bpp" +; 11ce7 + +INCLUDE "data/name_input_chars.asm" +; 11e5d + +NamingScreenGFX_End: ; unused +INCBIN "gfx/naming_screen/end.1bpp" +; 11e6d + +NamingScreenGFX_MiddleLine: +INCBIN "gfx/naming_screen/middle_line.1bpp" +; 11e6d + +NamingScreenGFX_UnderLine: ; 11e6d +INCBIN "gfx/naming_screen/underline.1bpp" +; 11e75 + +_ComposeMailMessage: ; 11e75 (mail?) + ld hl, wNamingScreenDestinationPointer + ld [hl], e + inc hl + ld [hl], d + ld a, [hMapAnims] + push af + xor a + ld [hMapAnims], a + ld a, [hInMenu] + push af + ld a, $1 + ld [hInMenu], a + call .InitBlankMail + call DelayFrame + +.loop + call .DoMailEntry + jr nc, .loop + + pop af + ld [hInMenu], a + pop af + ld [hMapAnims], a + ret + +.InitBlankMail: ; 11e9a (4:5e9a) + call ClearBGPalettes + call DisableLCD + call LoadNamingScreenGFX + ld de, vTiles0 tile $00 + ld hl, .MailIcon + ld bc, 8 tiles + ld a, BANK(.MailIcon) + call FarCopyBytes + xor a + ld hl, wSpriteAnimDict + ld [hli], a + ld [hl], a + + ; init mail icon + depixel 3, 2 + ld a, SPRITE_ANIM_INDEX_PARTY_MON + call _InitSpriteAnimStruct + + ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID + add hl, bc + ld [hl], $0 + call .InitCharset + ld a, LCDC_DEFAULT + ld [rLCDC], a + call .initwNamingScreenMaxNameLength + ld b, SCGB_DIPLOMA + call GetSGBLayout + call WaitBGMap + call WaitTop + ld a, %11100100 + call DmgToCgbBGPals + ld a, %11100100 + call DmgToCgbObjPal0 + call NamingScreen_InitNameEntry + ld hl, wNamingScreenDestinationPointer + ld e, [hl] + inc hl + ld d, [hl] + ld hl, MAIL_LINE_LENGTH + add hl, de + ld [hl], "" + ret + +; 11ef4 (4:5ef4) + +.MailIcon: ; 11ef4 +INCBIN "gfx/icons/mail_big.2bpp" +; 11f74 + +.initwNamingScreenMaxNameLength ; 11f74 (4:5f74) + ld a, MAIL_MSG_LENGTH + 1 + ld [wNamingScreenMaxNameLength], a + ret + +; 11f7a (4:5f7a) + +.UnusedString11f7a: + db "メールを かいてね@" + +; 11f84 + +.InitCharset: ; 11f84 (4:5f84) + call WaitTop + hlcoord 0, 0 + ld bc, 6 * SCREEN_WIDTH + ld a, NAMINGSCREEN_BORDER + call ByteFill + hlcoord 0, 6 + ld bc, 12 * SCREEN_WIDTH + ld a, " " + call ByteFill + hlcoord 1, 1 + lb bc, 4, SCREEN_WIDTH - 2 + call ClearBox + ld de, MailEntry_Uppercase + +.PlaceMailCharset: ; 11fa9 (4:5fa9) + hlcoord 1, 7 + ld b, 6 +.next + ld c, SCREEN_WIDTH - 1 +.loop_ + ld a, [de] + ld [hli], a + inc de + dec c + jr nz, .loop_ + push de + ld de, SCREEN_WIDTH + 1 + add hl, de + pop de + dec b + jr nz, .next + ret + +.DoMailEntry: ; 11fc0 (4:5fc0) + call JoyTextDelay + ld a, [wJumptableIndex] + bit 7, a + jr nz, .exit_mail + call .DoJumptable + farcall PlaySpriteAnimationsAndDelayFrame + call .Update + call DelayFrame + and a + ret + +.exit_mail + callfar ClearSpriteAnims + call ClearSprites + xor a + ld [hSCX], a + ld [hSCY], a + scf + ret + +.Update: ; 11feb (4:5feb) + xor a + ld [hBGMapMode], a + hlcoord 1, 1 + lb bc, 4, 18 + call ClearBox + ld hl, wNamingScreenDestinationPointer + ld e, [hl] + inc hl + ld d, [hl] + hlcoord 2, 2 + call PlaceString + ld a, $1 + ld [hBGMapMode], a + ret + +.DoJumptable: ; 12008 (4:6008) + ld a, [wJumptableIndex] + 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: ; 12017 (4:6017) + dw .init_blinking_cursor + dw .process_joypad + +.init_blinking_cursor ; 1201b (4:601b) + depixel 9, 2 + ld a, SPRITE_ANIM_INDEX_COMPOSE_MAIL_CURSOR + call _InitSpriteAnimStruct + ld a, c + ld [wNamingScreenCursorObjectPointer], a + ld a, b + ld [wNamingScreenCursorObjectPointer + 1], a + ld hl, SPRITEANIMSTRUCT_FRAMESET_ID + add hl, bc + ld a, [hl] + ld hl, SPRITEANIMSTRUCT_0E + add hl, bc + ld [hl], a + ld hl, wJumptableIndex + inc [hl] + ret + +.process_joypad ; 1203a (4:603a) + ld hl, hJoyPressed ; $ffa7 + ld a, [hl] + and A_BUTTON + jr nz, .a + ld a, [hl] + and B_BUTTON + jr nz, .b + ld a, [hl] + and START + jr nz, .start + ld a, [hl] + and SELECT + jr nz, .select + ret + +.a + call NamingScreen_PressedA_GetCursorCommand + cp $1 + jr z, .select + cp $2 + jr z, .b + cp $3 + jr z, .finished + call NamingScreen_GetLastCharacter + call MailComposition_TryAddLastCharacter + jr c, .start + ld hl, wNamingScreenCurrNameLength + ld a, [hl] + cp MAIL_LINE_LENGTH + ret nz + inc [hl] + call NamingScreen_GetTextCursorPosition + ld [hl], NAMINGSCREEN_UNDERLINE + dec hl + ld [hl], "" + ret + +.start + ld hl, wNamingScreenCursorObjectPointer + ld c, [hl] + inc hl + ld b, [hl] + ld hl, SPRITEANIMSTRUCT_0C + add hl, bc + ld [hl], $9 + ld hl, SPRITEANIMSTRUCT_0D + add hl, bc + ld [hl], $5 + ret + +.b + call NamingScreen_DeleteCharacter + ld hl, wNamingScreenCurrNameLength + ld a, [hl] + cp MAIL_LINE_LENGTH + ret nz + dec [hl] + call NamingScreen_GetTextCursorPosition + ld [hl], NAMINGSCREEN_UNDERLINE + inc hl + ld [hl], "" + ret + +.finished + call NamingScreen_StoreEntry + ld hl, wJumptableIndex + set 7, [hl] + ret + +.select + ld hl, wNamingScreenLetterCase + ld a, [hl] + xor 1 + ld [hl], a + jr nz, .switch_to_lowercase + ld de, MailEntry_Uppercase + call .PlaceMailCharset + ret + +.switch_to_lowercase + ld de, MailEntry_Lowercase + call .PlaceMailCharset + ret + +; called from engine/sprite_anims.asm + +ComposeMail_AnimateCursor: ; 120c1 (4:60c1) + call .GetDPad + ld hl, SPRITEANIMSTRUCT_0D + add hl, bc + ld a, [hl] + ld e, a + swap e + ld hl, SPRITEANIMSTRUCT_YOFFSET + add hl, bc + ld [hl], e + cp $5 + ld de, .LetterEntries + ld a, 0 + jr nz, .got_pointer + ld de, .CaseDelEnd + ld a, 1 +.got_pointer + ld hl, SPRITEANIMSTRUCT_0E + add hl, bc + add [hl] + ld hl, SPRITEANIMSTRUCT_FRAMESET_ID + add hl, bc + ld [hl], a + ld hl, SPRITEANIMSTRUCT_0C + add hl, bc + ld l, [hl] + ld h, 0 + add hl, de + ld a, [hl] + ld hl, SPRITEANIMSTRUCT_XOFFSET + add hl, bc + ld [hl], a + ret + +; 120f8 (4:60f8) + +.LetterEntries: ; 120f8 + db $00, $10, $20, $30, $40, $50, $60, $70, $80, $90 + +.CaseDelEnd: ; 12102 + db $00, $00, $00, $30, $30, $30, $60, $60, $60, $60 + +; 1210c + +.GetDPad: ; 1210c (4:610c) + ld hl, hJoyLast + ld a, [hl] + and D_UP + jr nz, .up + ld a, [hl] + and D_DOWN + jr nz, .down + ld a, [hl] + and D_LEFT + jr nz, .left + ld a, [hl] + and D_RIGHT + jr nz, .right + ret + +.right + call ComposeMail_GetCursorPosition + and a + jr nz, .case_del_done_right + ld hl, SPRITEANIMSTRUCT_0C + add hl, bc + ld a, [hl] + cp $9 + jr nc, .wrap_around_letter_right + inc [hl] + ret + +.wrap_around_letter_right + ld [hl], $0 + ret + +.case_del_done_right + cp $3 + jr nz, .wrap_around_command_right + xor a +.wrap_around_command_right + ld e, a + add a + add e + ld hl, SPRITEANIMSTRUCT_0C + add hl, bc + ld [hl], a + ret + +.left + call ComposeMail_GetCursorPosition + and a + jr nz, .caps_del_done_left + ld hl, SPRITEANIMSTRUCT_0C + add hl, bc + ld a, [hl] + and a + jr z, .wrap_around_letter_left + dec [hl] + ret + +.wrap_around_letter_left + ld [hl], $9 + ret + +.caps_del_done_left + cp $1 + jr nz, .wrap_around_command_left + ld a, $4 +.wrap_around_command_left + dec a + dec a + ld e, a + add a + add e + ld hl, SPRITEANIMSTRUCT_0C + add hl, bc + ld [hl], a + ret + +.down + ld hl, SPRITEANIMSTRUCT_0D + add hl, bc + ld a, [hl] + cp $5 + jr nc, .wrap_around_down + inc [hl] + ret + +.wrap_around_down + ld [hl], $0 + ret + +.up + ld hl, SPRITEANIMSTRUCT_0D + add hl, bc + ld a, [hl] + and a + jr z, .wrap_around_up + dec [hl] + ret + +.wrap_around_up + ld [hl], $5 + ret + +NamingScreen_PressedA_GetCursorCommand: ; 12185 (4:6185) + ld hl, wNamingScreenCursorObjectPointer + ld c, [hl] + inc hl + ld b, [hl] + +ComposeMail_GetCursorPosition: ; 1218b (4:618b) + ld hl, SPRITEANIMSTRUCT_0D + add hl, bc + ld a, [hl] + cp $5 + jr nz, .letter + ld hl, SPRITEANIMSTRUCT_0C + add hl, bc + ld a, [hl] + cp $3 + jr c, .case + cp $6 + jr c, .del + ld a, $3 + ret + +.case + ld a, $1 + ret + +.del + ld a, $2 + ret + +.letter + xor a + ret + +MailComposition_TryAddLastCharacter: ; 121ac (4:61ac) + ld a, [wNamingScreenLastCharacter] + jp MailComposition_TryAddCharacter + +; 121b2 (4:61b2) + +; unused + ld a, [wNamingScreenCurrNameLength] + and a + ret z + cp $11 + jr nz, .asm_121c3 + push hl + ld hl, wNamingScreenCurrNameLength + dec [hl] + dec [hl] + jr .asm_121c8 + +.asm_121c3 + push hl + ld hl, wNamingScreenCurrNameLength + dec [hl] + +.asm_121c8 + call NamingScreen_GetTextCursorPosition + ld c, [hl] + pop hl +.asm_121cd + ld a, [hli] + cp $ff + jp z, NamingScreen_AdvanceCursor_CheckEndOfString + cp c + jr z, .asm_121d9 + inc hl + jr .asm_121cd + +.asm_121d9 + ld a, [hl] + jp NamingScreen_LoadNextCharacter + +; 121dd + +INCLUDE "data/mail_input_chars.asm" + +; 122c1 diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm deleted file mode 100755 index f9832dd98..000000000 --- a/engine/namingscreen.asm +++ /dev/null @@ -1,1467 +0,0 @@ -NAMINGSCREEN_CURSOR EQU $7e - -NAMINGSCREEN_BORDER EQUS "\"■\"" ; $60 -NAMINGSCREEN_MIDDLELINE EQUS "\"→\"" ; $eb -NAMINGSCREEN_UNDERLINE EQUS "\"\"" ; $f2 - -_NamingScreen: ; 0x116b7 - call DisableSpriteUpdates - call NamingScreen - call ReturnToMapWithSpeechTextbox - ret - -; 0x116c1 - -NamingScreen: ; 116c1 - ld hl, wNamingScreenDestinationPointer - ld [hl], e - inc hl - ld [hl], d - ld hl, wNamingScreenType - ld [hl], b - ld hl, Options - ld a, [hl] - push af - set NO_TEXT_SCROLL, [hl] - ld a, [hMapAnims] - push af - xor a - ld [hMapAnims], a - ld a, [hInMenu] - push af - ld a, $1 - ld [hInMenu], a - call .SetUpNamingScreen - call DelayFrame -.loop - call NamingScreenJoypadLoop - jr nc, .loop - pop af - ld [hInMenu], a - pop af - ld [hMapAnims], a - pop af - ld [Options], a - call ClearJoypad - ret - -; 116f8 - -.SetUpNamingScreen: ; 116f8 - call ClearBGPalettes - ld b, SCGB_DIPLOMA - call GetSGBLayout - call DisableLCD - call LoadNamingScreenGFX - call NamingScreen_InitText - ld a, LCDC_DEFAULT - ld [rLCDC], a - call .GetNamingScreenSetup - call WaitBGMap - call WaitTop - call SetPalettes - call NamingScreen_InitNameEntry - ret - -; 1171d - -.GetNamingScreenSetup: ; 1171d - ld a, [wNamingScreenType] - and 7 - 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 - -; 1172e - -.Jumptable: ; 1172e (4:572e) - dw .Pokemon - dw .Player - dw .Rival - dw .Mom - dw .Box - dw .Tomodachi - dw .Pokemon - dw .Pokemon - -.Pokemon: ; 1173e (4:573e) - ld a, [CurPartySpecies] - ld [wd265], a - ld hl, LoadMenuMonIcon - ld a, BANK(LoadMenuMonIcon) - ld e, $1 - rst FarCall ; ; indirect jump to LoadMenuMonIcon (8e83f (23:683f)) - ld a, [CurPartySpecies] - ld [wd265], a - call GetPokemonName - hlcoord 5, 2 - call PlaceString - ld l, c - ld h, b - ld de, .NicknameStrings - call PlaceString - inc de - hlcoord 5, 4 - call PlaceString - farcall GetGender - jr c, .genderless - ld a, "♂" - jr nz, .place_gender - ld a, "♀" -.place_gender - hlcoord 1, 2 - ld [hl], a -.genderless - call .StoreMonIconParams - ret - -; 11780 (4:5780) - -.NicknameStrings: ; 11780 - db "'S@" - db "NICKNAME?@" - -; 1178d - -.Player: ; 1178d (4:578d) - farcall GetPlayerIcon - call .LoadSprite - hlcoord 5, 2 - ld de, .PlayerNameString - call PlaceString - call .StoreSpriteIconParams - ret - -; 117a3 (4:57a3) - -.PlayerNameString: ; 117a3 - db "YOUR NAME?@" - -; 117ae - -.Rival: ; 117ae (4:57ae) - ld de, SilverSpriteGFX - ld b, BANK(SilverSpriteGFX) - call .LoadSprite - hlcoord 5, 2 - ld de, .RivalNameString - call PlaceString - call .StoreSpriteIconParams - ret - -; 117c3 (4:57c3) - -.RivalNameString: ; 117c3 - db "RIVAL'S NAME?@" - -; 117d1 - -.Mom: ; 117d1 (4:57d1) - ld de, MomSpriteGFX - ld b, BANK(MomSpriteGFX) - call .LoadSprite - hlcoord 5, 2 - ld de, .MomNameString - call PlaceString - call .StoreSpriteIconParams - ret - -; 117e6 (4:57e6) - -.MomNameString: ; 117e6 - db "MOTHER'S NAME?@" - -; 117f5 - -.Box: ; 117f5 (4:57f5) - ld de, PokeBallSpriteGFX - ld hl, vTiles0 tile $00 - lb bc, BANK(PokeBallSpriteGFX), 4 - call Request2bpp - xor a - ld hl, wSpriteAnimDict - ld [hli], a - ld [hl], a - depixel 4, 4, 4, 0 - ld a, SPRITE_ANIM_INDEX_RED_WALK - call _InitSpriteAnimStruct - ld hl, SPRITEANIMSTRUCT_FRAMESET_ID - add hl, bc - ld [hl], $0 - hlcoord 5, 2 - ld de, .BoxNameString - call PlaceString - call .StoreBoxIconParams - ret - -; 11822 (4:5822) - -.BoxNameString: ; 11822 - db "BOX NAME?@" - -; 1182c - -.Tomodachi: ; 1182c (4:582c) - hlcoord 3, 2 - ld de, .oTomodachi_no_namae_sutoringu - call PlaceString - call .StoreSpriteIconParams - ret - -; 11839 (4:5839) - -.oTomodachi_no_namae_sutoringu ; 11839 - db "おともだち の なまえは?@" - -; 11847 - -.LoadSprite: ; 11847 (4:5847) - push de - ld hl, vTiles0 tile $00 - ld c, $4 - push bc - call Request2bpp - pop bc - ld hl, 12 tiles - add hl, de - ld e, l - ld d, h - ld hl, vTiles0 tile $04 - call Request2bpp - xor a - ld hl, wSpriteAnimDict - ld [hli], a - ld [hl], a - pop de - ld b, SPRITE_ANIM_INDEX_RED_WALK - ld a, d - cp HIGH(KrisSpriteGFX) - jr nz, .not_kris - ld a, e - cp LOW(KrisSpriteGFX) - jr nz, .not_kris - ld b, SPRITE_ANIM_INDEX_BLUE_WALK -.not_kris - ld a, b - depixel 4, 4, 4, 0 - call _InitSpriteAnimStruct - ret - -.StoreMonIconParams: ; 1187b (4:587b) - ld a, MON_NAME_LENGTH - 1 - hlcoord 5, 6 - jr .StoreParams - -.StoreSpriteIconParams: ; 11882 (4:5882) - ld a, PLAYER_NAME_LENGTH - 1 - hlcoord 5, 6 - jr .StoreParams - -.StoreBoxIconParams: ; 11889 (4:5889) - ld a, BOX_NAME_LENGTH - 1 - hlcoord 5, 4 - jr .StoreParams - -.StoreParams: ; 11890 (4:5890) - ld [wNamingScreenMaxNameLength], a - ld a, l - ld [wNamingScreenStringEntryCoord], a - ld a, h - ld [wNamingScreenStringEntryCoord + 1], a - ret - -NamingScreen_IsTargetBox: ; 1189c - push bc - push af - ld a, [wNamingScreenType] - sub $3 - ld b, a - pop af - dec b - pop bc - ret - -; 118a8 - -NamingScreen_InitText: ; 118a8 - call WaitTop - hlcoord 0, 0 - ld bc, SCREEN_WIDTH * SCREEN_HEIGHT - ld a, NAMINGSCREEN_BORDER - call ByteFill - hlcoord 1, 1 - lb bc, 6, 18 - call NamingScreen_IsTargetBox - jr nz, .not_box - lb bc, 4, 18 - -.not_box - call ClearBox - ld de, NameInputUpper -NamingScreen_ApplyTextInputMode: ; 118ca - call NamingScreen_IsTargetBox - jr nz, .not_box - ld hl, BoxNameInputLower - NameInputLower - add hl, de - ld d, h - ld e, l - -.not_box - push de - hlcoord 1, 8 - lb bc, 7, 18 - call NamingScreen_IsTargetBox - jr nz, .not_box_2 - hlcoord 1, 6 - lb bc, 9, 18 - -.not_box_2 - call ClearBox - hlcoord 1, 16 - lb bc, 1, 18 - call ClearBox - pop de - hlcoord 2, 8 - ld b, $5 - call NamingScreen_IsTargetBox - jr nz, .row - hlcoord 2, 6 - ld b, $6 - -.row - ld c, $11 -.col - ld a, [de] - ld [hli], a - inc de - dec c - jr nz, .col - push de - ld de, 2 * SCREEN_WIDTH - $11 - add hl, de - pop de - dec b - jr nz, .row - ret - -; 11915 - -NamingScreenJoypadLoop: ; 11915 - call JoyTextDelay - ld a, [wJumptableIndex] - bit 7, a - jr nz, .quit - call .RunJumptable - farcall PlaySpriteAnimationsAndDelayFrame - call .UpdateStringEntry - call DelayFrame - and a - ret - -.quit - callfar ClearSpriteAnims - call ClearSprites - xor a - ld [hSCX], a - ld [hSCY], a - scf - ret - -; 11940 - -.UpdateStringEntry: ; 11940 - xor a - ld [hBGMapMode], a - hlcoord 1, 5 - call NamingScreen_IsTargetBox - jr nz, .got_coords - hlcoord 1, 3 - -.got_coords - lb bc, 1, 18 - call ClearBox - ld hl, wNamingScreenDestinationPointer - ld e, [hl] - inc hl - ld d, [hl] - ld hl, wNamingScreenStringEntryCoord - ld a, [hli] - ld h, [hl] - ld l, a - call PlaceString - ld a, $1 - ld [hBGMapMode], a - ret - -; 11968 - -.RunJumptable: ; 11968 - ld a, [wJumptableIndex] - 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 - -; 11977 - -.Jumptable: ; 11977 (4:5977) - dw .InitCursor - dw .ReadButtons - -.InitCursor: ; 1197b (4:597b) - depixel 10, 3 - call NamingScreen_IsTargetBox - jr nz, .got_cursor_position - ld d, 8 * 8 -.got_cursor_position - ld a, SPRITE_ANIM_INDEX_NAMING_SCREEN_CURSOR - call _InitSpriteAnimStruct - ld a, c - ld [wNamingScreenCursorObjectPointer], a - ld a, b - ld [wNamingScreenCursorObjectPointer + 1], a - ld hl, SPRITEANIMSTRUCT_FRAMESET_ID - add hl, bc - ld a, [hl] - ld hl, SPRITEANIMSTRUCT_0E - add hl, bc - ld [hl], a - ld hl, wJumptableIndex - inc [hl] - ret - -.ReadButtons: ; 119a1 (4:59a1) - ld hl, hJoyPressed ; $ffa7 - ld a, [hl] - and A_BUTTON - jr nz, .a - ld a, [hl] - and B_BUTTON - jr nz, .b - ld a, [hl] - and START - jr nz, .start - ld a, [hl] - and SELECT - jr nz, .select - ret - -.a - call .GetCursorPosition - cp $1 - jr z, .select - cp $2 - jr z, .b - cp $3 - jr z, .end - call NamingScreen_GetLastCharacter - call NamingScreen_TryAddCharacter - ret nc - -.start - ld hl, wNamingScreenCursorObjectPointer - ld c, [hl] - inc hl - ld b, [hl] - ld hl, SPRITEANIMSTRUCT_0C - add hl, bc - ld [hl], $8 - ld hl, SPRITEANIMSTRUCT_0D - add hl, bc - ld [hl], $4 - call NamingScreen_IsTargetBox - ret nz - inc [hl] - ret - -.b - call NamingScreen_DeleteCharacter - ret - -.end - call NamingScreen_StoreEntry - ld hl, wJumptableIndex - set 7, [hl] - ret - -.select - ld hl, wNamingScreenLetterCase - ld a, [hl] - xor 1 - ld [hl], a - jr z, .upper - ld de, NameInputLower - call NamingScreen_ApplyTextInputMode - ret - -.upper - ld de, NameInputUpper - call NamingScreen_ApplyTextInputMode - ret - -.GetCursorPosition: ; 11a0b (4:5a0b) - ld hl, wNamingScreenCursorObjectPointer - ld c, [hl] - inc hl - ld b, [hl] - -NamingScreen_GetCursorPosition: ; 11a11 (4:5a11) - ld hl, SPRITEANIMSTRUCT_0D - add hl, bc - ld a, [hl] - push bc - ld b, $4 - call NamingScreen_IsTargetBox - jr nz, .not_box - inc b -.not_box - cp b - pop bc - jr nz, .not_bottom_row - ld hl, SPRITEANIMSTRUCT_0C - add hl, bc - ld a, [hl] - cp $3 - jr c, .case_switch - cp $6 - jr c, .delete - ld a, $3 - ret - -.case_switch - ld a, $1 - ret - -.delete - ld a, $2 - ret - -.not_bottom_row - xor a - ret - -NamingScreen_AnimateCursor: ; 11a3b (4:5a3b) - call .GetDPad - ld hl, SPRITEANIMSTRUCT_0D - add hl, bc - ld a, [hl] - ld e, a - swap e - ld hl, SPRITEANIMSTRUCT_YOFFSET - add hl, bc - ld [hl], e - ld d, $4 - call NamingScreen_IsTargetBox - jr nz, .ok - inc d -.ok - cp d - ld de, .LetterEntries - ld a, SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR - SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR ; 0 - jr nz, .ok2 - ld de, .CaseDelEnd - ld a, SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR_BIG - SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR ; 1 -.ok2 - ld hl, SPRITEANIMSTRUCT_0E - add hl, bc - add [hl] ; default SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR - ld hl, SPRITEANIMSTRUCT_FRAMESET_ID - add hl, bc - ld [hl], a - ld hl, SPRITEANIMSTRUCT_0C - add hl, bc - ld l, [hl] - ld h, $0 - add hl, de - ld a, [hl] - ld hl, SPRITEANIMSTRUCT_XOFFSET - add hl, bc - ld [hl], a - ret - -; 11a79 (4:5a79) - -.LetterEntries: ; 11a79 - db $00, $10, $20, $30, $40, $50, $60, $70, $80 - -.CaseDelEnd: ; 11a82 - db $00, $00, $00, $30, $30, $30, $60, $60, $60 - -; 11a8b - -.GetDPad: ; 11a8b (4:5a8b) - ld hl, hJoyLast - ld a, [hl] - and D_UP - jr nz, .up - ld a, [hl] - and D_DOWN - jr nz, .down - ld a, [hl] - and D_LEFT - jr nz, .left - ld a, [hl] - and D_RIGHT - jr nz, .right - ret - -.right - call NamingScreen_GetCursorPosition - and a - jr nz, .asm_11ab7 - ld hl, SPRITEANIMSTRUCT_0C - add hl, bc - ld a, [hl] - cp $8 - jr nc, .asm_11ab4 - inc [hl] - ret - -.asm_11ab4 - ld [hl], $0 - ret - -.asm_11ab7 - cp $3 - jr nz, .asm_11abc - xor a -.asm_11abc - ld e, a - add a - add e - ld hl, SPRITEANIMSTRUCT_0C - add hl, bc - ld [hl], a - ret - -.left - call NamingScreen_GetCursorPosition - and a - jr nz, .asm_11ad8 - ld hl, SPRITEANIMSTRUCT_0C - add hl, bc - ld a, [hl] - and a - jr z, .asm_11ad5 - dec [hl] - ret - -.asm_11ad5 - ld [hl], $8 - ret - -.asm_11ad8 - cp $1 - jr nz, .asm_11ade - ld a, $4 -.asm_11ade - dec a - dec a - ld e, a - add a - add e - ld hl, SPRITEANIMSTRUCT_0C - add hl, bc - ld [hl], a - ret - -.down - ld hl, SPRITEANIMSTRUCT_0D - add hl, bc - ld a, [hl] - call NamingScreen_IsTargetBox - jr nz, .asm_11af9 - cp $5 - jr nc, .asm_11aff - inc [hl] - ret - -.asm_11af9 - cp $4 - jr nc, .asm_11aff - inc [hl] - ret - -.asm_11aff - ld [hl], $0 - ret - -.up - ld hl, SPRITEANIMSTRUCT_0D - add hl, bc - ld a, [hl] - and a - jr z, .asm_11b0c - dec [hl] - ret - -.asm_11b0c - ld [hl], $4 - call NamingScreen_IsTargetBox - ret nz - inc [hl] - ret - -NamingScreen_TryAddCharacter: ; 11b14 (4:5b14) - ld a, [wNamingScreenLastCharacter] ; lost -MailComposition_TryAddCharacter: ; 11b17 (4:5b17) - ld a, [wNamingScreenMaxNameLength] - ld c, a - ld a, [wNamingScreenCurrNameLength] - cp c - ret nc - - ld a, [wNamingScreenLastCharacter] - -NamingScreen_LoadNextCharacter: ; 11b23 - call NamingScreen_GetTextCursorPosition - ld [hl], a - -NamingScreen_AdvanceCursor_CheckEndOfString: ; 11b27 - ld hl, wNamingScreenCurrNameLength - inc [hl] - call NamingScreen_GetTextCursorPosition - ld a, [hl] - cp "@" - jr z, .end_of_string - ld [hl], NAMINGSCREEN_UNDERLINE - and a - ret - -.end_of_string - scf - ret - -; 11b39 (4:5b39) - -; unused - ld a, [wNamingScreenCurrNameLength] - and a - ret z - push hl - ld hl, wNamingScreenCurrNameLength - dec [hl] - call NamingScreen_GetTextCursorPosition - ld c, [hl] - pop hl - -.loop - ld a, [hli] - cp $ff - jr z, NamingScreen_AdvanceCursor_CheckEndOfString - cp c - jr z, .done - inc hl - jr .loop - -.done - ld a, [hl] - jr NamingScreen_LoadNextCharacter - -; 11b56 - -INCLUDE "data/unused/dakutens.asm" - -; 11bbc - -NamingScreen_DeleteCharacter: ; 11bbc (4:5bbc) - ld hl, wNamingScreenCurrNameLength - ld a, [hl] - and a - ret z - dec [hl] - call NamingScreen_GetTextCursorPosition - ld [hl], NAMINGSCREEN_UNDERLINE - inc hl - ld a, [hl] - cp NAMINGSCREEN_UNDERLINE - ret nz - ld [hl], NAMINGSCREEN_MIDDLELINE - ret - -NamingScreen_GetTextCursorPosition: ; 11bd0 (4:5bd0) - push af - ld hl, wNamingScreenDestinationPointer - ld a, [hli] - ld h, [hl] - ld l, a - ld a, [wNamingScreenCurrNameLength] - ld e, a - ld d, 0 - add hl, de - pop af - ret - -; 11be0 - -NamingScreen_InitNameEntry: ; 11be0 -; load NAMINGSCREEN_UNDERLINE, (NAMINGSCREEN_MIDDLELINE * [wNamingScreenMaxNameLength]), "@" into the dw address at wNamingScreenDestinationPointer - ld hl, wNamingScreenDestinationPointer - ld a, [hli] - ld h, [hl] - ld l, a - ld [hl], NAMINGSCREEN_UNDERLINE - inc hl - ld a, [wNamingScreenMaxNameLength] - dec a - ld c, a - ld a, NAMINGSCREEN_MIDDLELINE -.loop - ld [hli], a - dec c - jr nz, .loop - ld [hl], "@" - ret - -; 11bf7 - -NamingScreen_StoreEntry: ; 11bf7 (4:5bf7) - ld hl, wNamingScreenDestinationPointer - ld a, [hli] - ld h, [hl] - ld l, a - ld a, [wNamingScreenMaxNameLength] - ld c, a -.loop - ld a, [hl] - cp NAMINGSCREEN_MIDDLELINE - jr z, .terminator - cp NAMINGSCREEN_UNDERLINE - jr nz, .not_terminator -.terminator - ld [hl], "@" -.not_terminator - inc hl - dec c - jr nz, .loop - ret - -NamingScreen_GetLastCharacter: ; 11c11 (4:5c11) - ld hl, wNamingScreenCursorObjectPointer - ld c, [hl] - inc hl - ld b, [hl] - ld hl, SPRITEANIMSTRUCT_XOFFSET - add hl, bc - ld a, [hl] - ld hl, SPRITEANIMSTRUCT_XCOORD - add hl, bc - add [hl] - sub $8 - srl a - srl a - srl a - ld e, a - ld hl, SPRITEANIMSTRUCT_YOFFSET - add hl, bc - ld a, [hl] - ld hl, SPRITEANIMSTRUCT_YCOORD - add hl, bc - add [hl] - sub $10 - srl a - srl a - srl a - ld d, a - hlcoord 0, 0 - ld bc, SCREEN_WIDTH -.loop - ld a, d - and a - jr z, .done - add hl, bc - dec d - jr .loop - -.done - add hl, de - ld a, [hl] - ld [wNamingScreenLastCharacter], a - ret - -LoadNamingScreenGFX: ; 11c51 - call ClearSprites - callfar ClearSpriteAnims - call LoadStandardFont - call LoadFontsExtra - - ld de, NamingScreenGFX_MiddleLine - ld hl, vTiles0 tile NAMINGSCREEN_MIDDLELINE - lb bc, BANK(NamingScreenGFX_MiddleLine), 1 - call Get1bpp - - ld de, NamingScreenGFX_UnderLine - ld hl, vTiles0 tile NAMINGSCREEN_UNDERLINE - lb bc, BANK(NamingScreenGFX_UnderLine), 1 - call Get1bpp - - ld de, vTiles2 tile NAMINGSCREEN_BORDER - ld hl, NamingScreenGFX_Border - ld bc, 1 tiles - ld a, BANK(NamingScreenGFX_Border) - call FarCopyBytes - - ld de, vTiles0 tile NAMINGSCREEN_CURSOR - ld hl, NamingScreenGFX_Cursor - ld bc, 2 tiles - ld a, BANK(NamingScreenGFX_Cursor) - call FarCopyBytes - - ld a, $5 - ld hl, wSpriteAnimDict + 9 * 2 - ld [hli], a - ld [hl], NAMINGSCREEN_CURSOR - xor a - ld [hSCY], a - ld [wGlobalAnimYOffset], a - ld [hSCX], a - ld [wGlobalAnimXOffset], a - ld [wJumptableIndex], a - ld [wNamingScreenLetterCase], a - ld [hBGMapMode], a - ld [wNamingScreenCurrNameLength], a - ld a, $7 - ld [hWX], a - ret - -; 11cb7 - -NamingScreenGFX_Border: ; 11cb7 -INCBIN "gfx/namingscreen/border.2bpp" -; 11cc7 - -NamingScreenGFX_Cursor: ; 11cc7 -INCBIN "gfx/namingscreen/cursor.2bpp" -; 11ce7 - -INCLUDE "data/name_input_chars.asm" -; 11e5d - -NamingScreenGFX_End: ; unused -INCBIN "gfx/namingscreen/end.1bpp" -; 11e6d - -NamingScreenGFX_MiddleLine: -INCBIN "gfx/namingscreen/middle_line.1bpp" -; 11e6d - -NamingScreenGFX_UnderLine: ; 11e6d -INCBIN "gfx/namingscreen/underline.1bpp" -; 11e75 - -_ComposeMailMessage: ; 11e75 (mail?) - ld hl, wNamingScreenDestinationPointer - ld [hl], e - inc hl - ld [hl], d - ld a, [hMapAnims] - push af - xor a - ld [hMapAnims], a - ld a, [hInMenu] - push af - ld a, $1 - ld [hInMenu], a - call .InitBlankMail - call DelayFrame - -.loop - call .DoMailEntry - jr nc, .loop - - pop af - ld [hInMenu], a - pop af - ld [hMapAnims], a - ret - -.InitBlankMail: ; 11e9a (4:5e9a) - call ClearBGPalettes - call DisableLCD - call LoadNamingScreenGFX - ld de, vTiles0 tile $00 - ld hl, .MailIcon - ld bc, 8 tiles - ld a, BANK(.MailIcon) - call FarCopyBytes - xor a - ld hl, wSpriteAnimDict - ld [hli], a - ld [hl], a - - ; init mail icon - depixel 3, 2 - ld a, SPRITE_ANIM_INDEX_PARTY_MON - call _InitSpriteAnimStruct - - ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID - add hl, bc - ld [hl], $0 - call .InitCharset - ld a, LCDC_DEFAULT - ld [rLCDC], a - call .initwNamingScreenMaxNameLength - ld b, SCGB_DIPLOMA - call GetSGBLayout - call WaitBGMap - call WaitTop - ld a, %11100100 - call DmgToCgbBGPals - ld a, %11100100 - call DmgToCgbObjPal0 - call NamingScreen_InitNameEntry - ld hl, wNamingScreenDestinationPointer - ld e, [hl] - inc hl - ld d, [hl] - ld hl, MAIL_LINE_LENGTH - add hl, de - ld [hl], "" - ret - -; 11ef4 (4:5ef4) - -.MailIcon: ; 11ef4 -INCBIN "gfx/icons/mail2.2bpp" -; 11f74 - -.initwNamingScreenMaxNameLength ; 11f74 (4:5f74) - ld a, MAIL_MSG_LENGTH + 1 - ld [wNamingScreenMaxNameLength], a - ret - -; 11f7a (4:5f7a) - -.UnusedString11f7a: - db "メールを かいてね@" - -; 11f84 - -.InitCharset: ; 11f84 (4:5f84) - call WaitTop - hlcoord 0, 0 - ld bc, 6 * SCREEN_WIDTH - ld a, NAMINGSCREEN_BORDER - call ByteFill - hlcoord 0, 6 - ld bc, 12 * SCREEN_WIDTH - ld a, " " - call ByteFill - hlcoord 1, 1 - lb bc, 4, SCREEN_WIDTH - 2 - call ClearBox - ld de, MailEntry_Uppercase - -.PlaceMailCharset: ; 11fa9 (4:5fa9) - hlcoord 1, 7 - ld b, 6 -.next - ld c, SCREEN_WIDTH - 1 -.loop_ - ld a, [de] - ld [hli], a - inc de - dec c - jr nz, .loop_ - push de - ld de, SCREEN_WIDTH + 1 - add hl, de - pop de - dec b - jr nz, .next - ret - -.DoMailEntry: ; 11fc0 (4:5fc0) - call JoyTextDelay - ld a, [wJumptableIndex] - bit 7, a - jr nz, .exit_mail - call .DoJumptable - farcall PlaySpriteAnimationsAndDelayFrame - call .Update - call DelayFrame - and a - ret - -.exit_mail - callfar ClearSpriteAnims - call ClearSprites - xor a - ld [hSCX], a - ld [hSCY], a - scf - ret - -.Update: ; 11feb (4:5feb) - xor a - ld [hBGMapMode], a - hlcoord 1, 1 - lb bc, 4, 18 - call ClearBox - ld hl, wNamingScreenDestinationPointer - ld e, [hl] - inc hl - ld d, [hl] - hlcoord 2, 2 - call PlaceString - ld a, $1 - ld [hBGMapMode], a - ret - -.DoJumptable: ; 12008 (4:6008) - ld a, [wJumptableIndex] - 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: ; 12017 (4:6017) - dw .init_blinking_cursor - dw .process_joypad - -.init_blinking_cursor ; 1201b (4:601b) - depixel 9, 2 - ld a, SPRITE_ANIM_INDEX_COMPOSE_MAIL_CURSOR - call _InitSpriteAnimStruct - ld a, c - ld [wNamingScreenCursorObjectPointer], a - ld a, b - ld [wNamingScreenCursorObjectPointer + 1], a - ld hl, SPRITEANIMSTRUCT_FRAMESET_ID - add hl, bc - ld a, [hl] - ld hl, SPRITEANIMSTRUCT_0E - add hl, bc - ld [hl], a - ld hl, wJumptableIndex - inc [hl] - ret - -.process_joypad ; 1203a (4:603a) - ld hl, hJoyPressed ; $ffa7 - ld a, [hl] - and A_BUTTON - jr nz, .a - ld a, [hl] - and B_BUTTON - jr nz, .b - ld a, [hl] - and START - jr nz, .start - ld a, [hl] - and SELECT - jr nz, .select - ret - -.a - call NamingScreen_PressedA_GetCursorCommand - cp $1 - jr z, .select - cp $2 - jr z, .b - cp $3 - jr z, .finished - call NamingScreen_GetLastCharacter - call MailComposition_TryAddLastCharacter - jr c, .start - ld hl, wNamingScreenCurrNameLength - ld a, [hl] - cp MAIL_LINE_LENGTH - ret nz - inc [hl] - call NamingScreen_GetTextCursorPosition - ld [hl], NAMINGSCREEN_UNDERLINE - dec hl - ld [hl], "" - ret - -.start - ld hl, wNamingScreenCursorObjectPointer - ld c, [hl] - inc hl - ld b, [hl] - ld hl, SPRITEANIMSTRUCT_0C - add hl, bc - ld [hl], $9 - ld hl, SPRITEANIMSTRUCT_0D - add hl, bc - ld [hl], $5 - ret - -.b - call NamingScreen_DeleteCharacter - ld hl, wNamingScreenCurrNameLength - ld a, [hl] - cp MAIL_LINE_LENGTH - ret nz - dec [hl] - call NamingScreen_GetTextCursorPosition - ld [hl], NAMINGSCREEN_UNDERLINE - inc hl - ld [hl], "" - ret - -.finished - call NamingScreen_StoreEntry - ld hl, wJumptableIndex - set 7, [hl] - ret - -.select - ld hl, wNamingScreenLetterCase - ld a, [hl] - xor 1 - ld [hl], a - jr nz, .switch_to_lowercase - ld de, MailEntry_Uppercase - call .PlaceMailCharset - ret - -.switch_to_lowercase - ld de, MailEntry_Lowercase - call .PlaceMailCharset - ret - -; called from engine/sprite_anims.asm - -ComposeMail_AnimateCursor: ; 120c1 (4:60c1) - call .GetDPad - ld hl, SPRITEANIMSTRUCT_0D - add hl, bc - ld a, [hl] - ld e, a - swap e - ld hl, SPRITEANIMSTRUCT_YOFFSET - add hl, bc - ld [hl], e - cp $5 - ld de, .LetterEntries - ld a, 0 - jr nz, .got_pointer - ld de, .CaseDelEnd - ld a, 1 -.got_pointer - ld hl, SPRITEANIMSTRUCT_0E - add hl, bc - add [hl] - ld hl, SPRITEANIMSTRUCT_FRAMESET_ID - add hl, bc - ld [hl], a - ld hl, SPRITEANIMSTRUCT_0C - add hl, bc - ld l, [hl] - ld h, 0 - add hl, de - ld a, [hl] - ld hl, SPRITEANIMSTRUCT_XOFFSET - add hl, bc - ld [hl], a - ret - -; 120f8 (4:60f8) - -.LetterEntries: ; 120f8 - db $00, $10, $20, $30, $40, $50, $60, $70, $80, $90 - -.CaseDelEnd: ; 12102 - db $00, $00, $00, $30, $30, $30, $60, $60, $60, $60 - -; 1210c - -.GetDPad: ; 1210c (4:610c) - ld hl, hJoyLast - ld a, [hl] - and D_UP - jr nz, .up - ld a, [hl] - and D_DOWN - jr nz, .down - ld a, [hl] - and D_LEFT - jr nz, .left - ld a, [hl] - and D_RIGHT - jr nz, .right - ret - -.right - call ComposeMail_GetCursorPosition - and a - jr nz, .case_del_done_right - ld hl, SPRITEANIMSTRUCT_0C - add hl, bc - ld a, [hl] - cp $9 - jr nc, .wrap_around_letter_right - inc [hl] - ret - -.wrap_around_letter_right - ld [hl], $0 - ret - -.case_del_done_right - cp $3 - jr nz, .wrap_around_command_right - xor a -.wrap_around_command_right - ld e, a - add a - add e - ld hl, SPRITEANIMSTRUCT_0C - add hl, bc - ld [hl], a - ret - -.left - call ComposeMail_GetCursorPosition - and a - jr nz, .caps_del_done_left - ld hl, SPRITEANIMSTRUCT_0C - add hl, bc - ld a, [hl] - and a - jr z, .wrap_around_letter_left - dec [hl] - ret - -.wrap_around_letter_left - ld [hl], $9 - ret - -.caps_del_done_left - cp $1 - jr nz, .wrap_around_command_left - ld a, $4 -.wrap_around_command_left - dec a - dec a - ld e, a - add a - add e - ld hl, SPRITEANIMSTRUCT_0C - add hl, bc - ld [hl], a - ret - -.down - ld hl, SPRITEANIMSTRUCT_0D - add hl, bc - ld a, [hl] - cp $5 - jr nc, .wrap_around_down - inc [hl] - ret - -.wrap_around_down - ld [hl], $0 - ret - -.up - ld hl, SPRITEANIMSTRUCT_0D - add hl, bc - ld a, [hl] - and a - jr z, .wrap_around_up - dec [hl] - ret - -.wrap_around_up - ld [hl], $5 - ret - -NamingScreen_PressedA_GetCursorCommand: ; 12185 (4:6185) - ld hl, wNamingScreenCursorObjectPointer - ld c, [hl] - inc hl - ld b, [hl] - -ComposeMail_GetCursorPosition: ; 1218b (4:618b) - ld hl, SPRITEANIMSTRUCT_0D - add hl, bc - ld a, [hl] - cp $5 - jr nz, .letter - ld hl, SPRITEANIMSTRUCT_0C - add hl, bc - ld a, [hl] - cp $3 - jr c, .case - cp $6 - jr c, .del - ld a, $3 - ret - -.case - ld a, $1 - ret - -.del - ld a, $2 - ret - -.letter - xor a - ret - -MailComposition_TryAddLastCharacter: ; 121ac (4:61ac) - ld a, [wNamingScreenLastCharacter] - jp MailComposition_TryAddCharacter - -; 121b2 (4:61b2) - -; unused - ld a, [wNamingScreenCurrNameLength] - and a - ret z - cp $11 - jr nz, .asm_121c3 - push hl - ld hl, wNamingScreenCurrNameLength - dec [hl] - dec [hl] - jr .asm_121c8 - -.asm_121c3 - push hl - ld hl, wNamingScreenCurrNameLength - dec [hl] - -.asm_121c8 - call NamingScreen_GetTextCursorPosition - ld c, [hl] - pop hl -.asm_121cd - ld a, [hli] - cp $ff - jp z, NamingScreen_AdvanceCursor_CheckEndOfString - cp c - jr z, .asm_121d9 - inc hl - jr .asm_121cd - -.asm_121d9 - ld a, [hl] - jp NamingScreen_LoadNextCharacter - -; 121dd - -INCLUDE "data/mail_input_chars.asm" - -; 122c1 diff --git a/engine/timeset.asm b/engine/timeset.asm index b97103ed1..67aa9973e 100755 --- a/engine/timeset.asm +++ b/engine/timeset.asm @@ -400,11 +400,11 @@ OakText_ResponseToSetTime: ; 0x908b8 ; 0x908fb TimeSetBackgroundGFX: ; 908fb -INCBIN "gfx/timeset/background.1bpp" +INCBIN "gfx/new_game/timeset_bg.1bpp" TimeSetUpArrowGFX: ; 90903 -INCBIN "gfx/timeset/up_arrow.1bpp" +INCBIN "gfx/new_game/up_arrow.1bpp" TimeSetDownArrowGFX: ; 9090b -INCBIN "gfx/timeset/down_arrow.1bpp" +INCBIN "gfx/new_game/down_arrow.1bpp" ; 90913 Special_SetDayOfWeek: ; 90913 -- cgit v1.2.3 From 81ba6c848aaada66cf2026ba765a48c98893431a Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sun, 21 Jan 2018 14:05:32 -0500 Subject: cgb layouts --- engine/crystal_cgb.asm | 325 --------------------------------------------- engine/crystal_layouts.asm | 325 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 325 insertions(+), 325 deletions(-) delete mode 100755 engine/crystal_cgb.asm create mode 100755 engine/crystal_layouts.asm (limited to 'engine') diff --git a/engine/crystal_cgb.asm b/engine/crystal_cgb.asm deleted file mode 100755 index 9fd01aac0..000000000 --- a/engine/crystal_cgb.asm +++ /dev/null @@ -1,325 +0,0 @@ -GetMysteryGift_MobileAdapterLayout: ; 4930f (mobile) - ld a, b - cp SCGB_RAM - jr nz, .not_ram - ld a, [SGBPredef] -.not_ram - push af - farcall ResetBGPals - pop af - ld l, a - ld h, 0 - add hl, hl - ld de, .dw - add hl, de - ld a, [hli] - ld h, [hl] - ld l, a - ld de, .done - push de - jp hl -.done - ret -; 49330 (12:5330) - -.dw ; 49330 - dw MG_Mobile_Layout00 - dw MG_Mobile_Layout01 - dw MG_Mobile_Layout02 -; 49336 - -MG_Mobile_Layout_FillBox: ; 49336 -.row - push bc - push hl -.col - 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 -; 49346 - -MG_Mobile_Layout_WipeAttrMap: ; 49346 (12:5346) - hlcoord 0, 0, AttrMap - ld bc, SCREEN_HEIGHT * SCREEN_WIDTH - xor a - call ByteFill - ret - -MG_Mobile_Layout_LoadPals: ; 49351 (12:5351) - ld de, wBGPals1 - ld hl, Palette_493e1 - ld bc, 5 palettes - ld a, BANK(wBGPals1) - call FarCopyWRAM - ld de, wBGPals1 palette PAL_BG_TEXT - ld hl, Palette_TextBG7 - ld bc, 1 palettes - ld a, BANK(wBGPals1) - call FarCopyWRAM - ret - -MG_Mobile_Layout00: ; 4936e (12:536e) - call MG_Mobile_Layout_LoadPals - call MG_Mobile_Layout_WipeAttrMap - call MG_Mobile_Layout_CreatePalBoxes - farcall ApplyAttrMap - farcall ApplyPals - ret - -MG_Mobile_Layout_CreatePalBoxes: ; 49384 (12:5384) - hlcoord 0, 0, AttrMap - lb bc, 4, 1 - ld a, $1 - call MG_Mobile_Layout_FillBox - lb bc, 2, 1 - ld a, $2 - call MG_Mobile_Layout_FillBox - lb bc, 6, 1 - ld a, $3 - call MG_Mobile_Layout_FillBox - hlcoord 1, 0, AttrMap - ld a, $1 - lb bc, 3, 18 - call MG_Mobile_Layout_FillBox - lb bc, 2, 18 - ld a, $2 - call MG_Mobile_Layout_FillBox - lb bc, 12, 18 - ld a, $3 - call MG_Mobile_Layout_FillBox - hlcoord 19, 0, AttrMap - lb bc, 4, 1 - ld a, $1 - call MG_Mobile_Layout_FillBox - lb bc, 2, 1 - ld a, $2 - call MG_Mobile_Layout_FillBox - lb bc, 6, 1 - ld a, $3 - call MG_Mobile_Layout_FillBox - hlcoord 0, 12, AttrMap - ld bc, 6 * SCREEN_WIDTH - ld a, $7 - call ByteFill - ret -; 493e1 (12:53e1) - -Palette_493e1: ; 493e1 -INCLUDE "gfx/mystery_gift/mg_mobile.pal" -; 49409 - -LoadOW_BGPal7:: ; 49409 - ld hl, Palette_TextBG7 - ld de, wBGPals1 palette PAL_BG_TEXT - ld bc, 1 palettes - ld a, BANK(wBGPals1) - call FarCopyWRAM - ret -; 49418 - -Palette_TextBG7: ; 49418 -INCLUDE "gfx/font/bg_text.pal" -; 49420 - -Function49420:: ; 49420 (12:5420) - ld hl, MansionPalette1 + 8 palettes - ld de, wBGPals1 palette PAL_BG_ROOF - ld bc, 1 palettes - ld a, BANK(wBGPals1) - call FarCopyWRAM - ret -; 4942f (12:542f) - -MG_Mobile_Layout01: ; 4942f - call MG_Mobile_Layout_LoadPals - ld de, wBGPals1 palette PAL_BG_TEXT - ld hl, .Palette_49478 - ld bc, 1 palettes - ld a, BANK(wBGPals1) - call FarCopyWRAM - call MG_Mobile_Layout_WipeAttrMap - hlcoord 0, 0, AttrMap - ld bc, SCREEN_WIDTH * SCREEN_HEIGHT - xor a - call ByteFill - hlcoord 0, 14, AttrMap - ld bc, 4 * SCREEN_WIDTH - ld a, $7 - call ByteFill - ld a, [wd002] - bit 6, a - jr z, .asm_49464 - call Function49480 - jr .asm_49467 - -.asm_49464 - call Function49496 - -.asm_49467 - farcall ApplyAttrMap - farcall ApplyPals - ld a, $1 - ld [hCGBPalUpdate], a - ret -; 49478 - -.Palette_49478: ; 49478 - RGB 31, 31, 31 - RGB 26, 31, 00 - RGB 20, 16, 03 - RGB 00, 00, 00 -; 49480 - -Function49480: ; 49480 - hlcoord 0, 0, AttrMap - lb bc, 4, SCREEN_WIDTH - ld a, $7 - call MG_Mobile_Layout_FillBox - hlcoord 0, 2, AttrMap - ld a, $4 - ld [hl], a - hlcoord 19, 2, AttrMap - ld [hl], a - ret -; 49496 - -Function49496: ; 49496 - hlcoord 0, 0, AttrMap - lb bc, 2, SCREEN_WIDTH - ld a, $7 - call MG_Mobile_Layout_FillBox - hlcoord 0, 1, AttrMap - ld a, $4 - ld [hl], a - hlcoord 19, 1, AttrMap - ld [hl], a - ret -; 494ac - -INCLUDE "engine/tileset_palettes.asm" - -MG_Mobile_Layout02: ; 49706 - ld hl, .Palette_49732 - ld de, wBGPals1 - ld bc, 1 palettes - ld a, BANK(wBGPals1) - call FarCopyWRAM - farcall ApplyPals - call MG_Mobile_Layout_WipeAttrMap - farcall ApplyAttrMap - ld hl, .Palette_4973a - ld de, wOBPals1 - ld bc, 1 palettes - ld a, BANK(wOBPals1) - call FarCopyWRAM - ret -; 49732 - -.Palette_49732: ; 49732 - RGB 31, 31, 31 - RGB 23, 16, 07 - RGB 23, 07, 07 - RGB 03, 07, 20 -; 4973a - -.Palette_4973a: ; 4973a - RGB 00, 00, 00 - RGB 07, 05, 31 - RGB 14, 18, 31 - RGB 31, 31, 31 -; 49742 - -Function49742: ; 49742 - ld hl, .Palette_49757 - ld de, wBGPals1 - ld bc, 8 palettes - ld a, BANK(wBGPals1) - call FarCopyWRAM - farcall ApplyPals - ret -; 49757 - -.Palette_49757: ; 49757 -INCLUDE "gfx/unknown/49757.pal" -; 49797 - -_InitMG_Mobile_LinkTradePalMap: ; 49797 - hlcoord 0, 0, AttrMap - lb bc, 16, 2 - ld a, $4 - call MG_Mobile_Layout_FillBox - ld a, $3 - ldcoord_a 0, 1, AttrMap - ldcoord_a 0, 14, AttrMap - hlcoord 2, 0, AttrMap - lb bc, 8, 18 - ld a, $5 - call MG_Mobile_Layout_FillBox - hlcoord 2, 8, AttrMap - lb bc, 8, 18 - ld a, $6 - call MG_Mobile_Layout_FillBox - hlcoord 0, 16, AttrMap - lb bc, 2, SCREEN_WIDTH - ld a, $4 - call MG_Mobile_Layout_FillBox - ld a, $3 - lb bc, 6, 1 - hlcoord 6, 1, AttrMap - call MG_Mobile_Layout_FillBox - ld a, $3 - lb bc, 6, 1 - hlcoord 17, 1, AttrMap - call MG_Mobile_Layout_FillBox - ld a, $3 - lb bc, 6, 1 - hlcoord 6, 9, AttrMap - call MG_Mobile_Layout_FillBox - ld a, $3 - lb bc, 6, 1 - hlcoord 17, 9, AttrMap - call MG_Mobile_Layout_FillBox - ld a, $2 - hlcoord 2, 16, AttrMap - ld [hli], a - ld a, $7 - ld [hli], a - ld [hli], a - ld [hli], a - ld a, $2 - ld [hl], a - hlcoord 2, 17, AttrMap - ld a, $3 - ld bc, 6 - call ByteFill - ret -; 49811 - -LoadTradeRoomBGPals: ; 49811 - ld hl, TradeRoomPalette - ld de, wBGPals1 palette PAL_BG_GREEN - ld bc, 6 palettes - ld a, BANK(wBGPals1) - call FarCopyWRAM - farcall ApplyPals - ret -; 49826 - -TradeRoomPalette: ; 49826 -INCLUDE "gfx/trade/border.pal" -; 49856 - -InitMG_Mobile_LinkTradePalMap: ; 49856 - call _InitMG_Mobile_LinkTradePalMap - ret -; 4985a - -; unused -INCLUDE "gfx/unknown/4985a.asm" diff --git a/engine/crystal_layouts.asm b/engine/crystal_layouts.asm new file mode 100755 index 000000000..9fd01aac0 --- /dev/null +++ b/engine/crystal_layouts.asm @@ -0,0 +1,325 @@ +GetMysteryGift_MobileAdapterLayout: ; 4930f (mobile) + ld a, b + cp SCGB_RAM + jr nz, .not_ram + ld a, [SGBPredef] +.not_ram + push af + farcall ResetBGPals + pop af + ld l, a + ld h, 0 + add hl, hl + ld de, .dw + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + ld de, .done + push de + jp hl +.done + ret +; 49330 (12:5330) + +.dw ; 49330 + dw MG_Mobile_Layout00 + dw MG_Mobile_Layout01 + dw MG_Mobile_Layout02 +; 49336 + +MG_Mobile_Layout_FillBox: ; 49336 +.row + push bc + push hl +.col + 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 +; 49346 + +MG_Mobile_Layout_WipeAttrMap: ; 49346 (12:5346) + hlcoord 0, 0, AttrMap + ld bc, SCREEN_HEIGHT * SCREEN_WIDTH + xor a + call ByteFill + ret + +MG_Mobile_Layout_LoadPals: ; 49351 (12:5351) + ld de, wBGPals1 + ld hl, Palette_493e1 + ld bc, 5 palettes + ld a, BANK(wBGPals1) + call FarCopyWRAM + ld de, wBGPals1 palette PAL_BG_TEXT + ld hl, Palette_TextBG7 + ld bc, 1 palettes + ld a, BANK(wBGPals1) + call FarCopyWRAM + ret + +MG_Mobile_Layout00: ; 4936e (12:536e) + call MG_Mobile_Layout_LoadPals + call MG_Mobile_Layout_WipeAttrMap + call MG_Mobile_Layout_CreatePalBoxes + farcall ApplyAttrMap + farcall ApplyPals + ret + +MG_Mobile_Layout_CreatePalBoxes: ; 49384 (12:5384) + hlcoord 0, 0, AttrMap + lb bc, 4, 1 + ld a, $1 + call MG_Mobile_Layout_FillBox + lb bc, 2, 1 + ld a, $2 + call MG_Mobile_Layout_FillBox + lb bc, 6, 1 + ld a, $3 + call MG_Mobile_Layout_FillBox + hlcoord 1, 0, AttrMap + ld a, $1 + lb bc, 3, 18 + call MG_Mobile_Layout_FillBox + lb bc, 2, 18 + ld a, $2 + call MG_Mobile_Layout_FillBox + lb bc, 12, 18 + ld a, $3 + call MG_Mobile_Layout_FillBox + hlcoord 19, 0, AttrMap + lb bc, 4, 1 + ld a, $1 + call MG_Mobile_Layout_FillBox + lb bc, 2, 1 + ld a, $2 + call MG_Mobile_Layout_FillBox + lb bc, 6, 1 + ld a, $3 + call MG_Mobile_Layout_FillBox + hlcoord 0, 12, AttrMap + ld bc, 6 * SCREEN_WIDTH + ld a, $7 + call ByteFill + ret +; 493e1 (12:53e1) + +Palette_493e1: ; 493e1 +INCLUDE "gfx/mystery_gift/mg_mobile.pal" +; 49409 + +LoadOW_BGPal7:: ; 49409 + ld hl, Palette_TextBG7 + ld de, wBGPals1 palette PAL_BG_TEXT + ld bc, 1 palettes + ld a, BANK(wBGPals1) + call FarCopyWRAM + ret +; 49418 + +Palette_TextBG7: ; 49418 +INCLUDE "gfx/font/bg_text.pal" +; 49420 + +Function49420:: ; 49420 (12:5420) + ld hl, MansionPalette1 + 8 palettes + ld de, wBGPals1 palette PAL_BG_ROOF + ld bc, 1 palettes + ld a, BANK(wBGPals1) + call FarCopyWRAM + ret +; 4942f (12:542f) + +MG_Mobile_Layout01: ; 4942f + call MG_Mobile_Layout_LoadPals + ld de, wBGPals1 palette PAL_BG_TEXT + ld hl, .Palette_49478 + ld bc, 1 palettes + ld a, BANK(wBGPals1) + call FarCopyWRAM + call MG_Mobile_Layout_WipeAttrMap + hlcoord 0, 0, AttrMap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT + xor a + call ByteFill + hlcoord 0, 14, AttrMap + ld bc, 4 * SCREEN_WIDTH + ld a, $7 + call ByteFill + ld a, [wd002] + bit 6, a + jr z, .asm_49464 + call Function49480 + jr .asm_49467 + +.asm_49464 + call Function49496 + +.asm_49467 + farcall ApplyAttrMap + farcall ApplyPals + ld a, $1 + ld [hCGBPalUpdate], a + ret +; 49478 + +.Palette_49478: ; 49478 + RGB 31, 31, 31 + RGB 26, 31, 00 + RGB 20, 16, 03 + RGB 00, 00, 00 +; 49480 + +Function49480: ; 49480 + hlcoord 0, 0, AttrMap + lb bc, 4, SCREEN_WIDTH + ld a, $7 + call MG_Mobile_Layout_FillBox + hlcoord 0, 2, AttrMap + ld a, $4 + ld [hl], a + hlcoord 19, 2, AttrMap + ld [hl], a + ret +; 49496 + +Function49496: ; 49496 + hlcoord 0, 0, AttrMap + lb bc, 2, SCREEN_WIDTH + ld a, $7 + call MG_Mobile_Layout_FillBox + hlcoord 0, 1, AttrMap + ld a, $4 + ld [hl], a + hlcoord 19, 1, AttrMap + ld [hl], a + ret +; 494ac + +INCLUDE "engine/tileset_palettes.asm" + +MG_Mobile_Layout02: ; 49706 + ld hl, .Palette_49732 + ld de, wBGPals1 + ld bc, 1 palettes + ld a, BANK(wBGPals1) + call FarCopyWRAM + farcall ApplyPals + call MG_Mobile_Layout_WipeAttrMap + farcall ApplyAttrMap + ld hl, .Palette_4973a + ld de, wOBPals1 + ld bc, 1 palettes + ld a, BANK(wOBPals1) + call FarCopyWRAM + ret +; 49732 + +.Palette_49732: ; 49732 + RGB 31, 31, 31 + RGB 23, 16, 07 + RGB 23, 07, 07 + RGB 03, 07, 20 +; 4973a + +.Palette_4973a: ; 4973a + RGB 00, 00, 00 + RGB 07, 05, 31 + RGB 14, 18, 31 + RGB 31, 31, 31 +; 49742 + +Function49742: ; 49742 + ld hl, .Palette_49757 + ld de, wBGPals1 + ld bc, 8 palettes + ld a, BANK(wBGPals1) + call FarCopyWRAM + farcall ApplyPals + ret +; 49757 + +.Palette_49757: ; 49757 +INCLUDE "gfx/unknown/49757.pal" +; 49797 + +_InitMG_Mobile_LinkTradePalMap: ; 49797 + hlcoord 0, 0, AttrMap + lb bc, 16, 2 + ld a, $4 + call MG_Mobile_Layout_FillBox + ld a, $3 + ldcoord_a 0, 1, AttrMap + ldcoord_a 0, 14, AttrMap + hlcoord 2, 0, AttrMap + lb bc, 8, 18 + ld a, $5 + call MG_Mobile_Layout_FillBox + hlcoord 2, 8, AttrMap + lb bc, 8, 18 + ld a, $6 + call MG_Mobile_Layout_FillBox + hlcoord 0, 16, AttrMap + lb bc, 2, SCREEN_WIDTH + ld a, $4 + call MG_Mobile_Layout_FillBox + ld a, $3 + lb bc, 6, 1 + hlcoord 6, 1, AttrMap + call MG_Mobile_Layout_FillBox + ld a, $3 + lb bc, 6, 1 + hlcoord 17, 1, AttrMap + call MG_Mobile_Layout_FillBox + ld a, $3 + lb bc, 6, 1 + hlcoord 6, 9, AttrMap + call MG_Mobile_Layout_FillBox + ld a, $3 + lb bc, 6, 1 + hlcoord 17, 9, AttrMap + call MG_Mobile_Layout_FillBox + ld a, $2 + hlcoord 2, 16, AttrMap + ld [hli], a + ld a, $7 + ld [hli], a + ld [hli], a + ld [hli], a + ld a, $2 + ld [hl], a + hlcoord 2, 17, AttrMap + ld a, $3 + ld bc, 6 + call ByteFill + ret +; 49811 + +LoadTradeRoomBGPals: ; 49811 + ld hl, TradeRoomPalette + ld de, wBGPals1 palette PAL_BG_GREEN + ld bc, 6 palettes + ld a, BANK(wBGPals1) + call FarCopyWRAM + farcall ApplyPals + ret +; 49826 + +TradeRoomPalette: ; 49826 +INCLUDE "gfx/trade/border.pal" +; 49856 + +InitMG_Mobile_LinkTradePalMap: ; 49856 + call _InitMG_Mobile_LinkTradePalMap + ret +; 4985a + +; unused +INCLUDE "gfx/unknown/4985a.asm" -- cgit v1.2.3 From 5db31feba93b10a2d629cf88a9ca7096d4b1c9ae Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sun, 21 Jan 2018 16:53:19 -0500 Subject: POKEDEX_SCX --- engine/pokedex.asm | 12 ++++++------ engine/routines/newpokedexentry.asm | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'engine') diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 4d7096c0e..e96d0a7d7 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -15,8 +15,8 @@ const DEXSTATE_UPDATE_UNOWN_MODE const DEXSTATE_EXIT -POKDEX_SCX EQU 5 -GLOBAL POKDEX_SCX +POKEDEX_SCX EQU 5 +GLOBAL POKEDEX_SCX Pokedex: ; 40000 @@ -233,7 +233,7 @@ Pokedex_InitMainScreen: ; 4013c (10:413c) call Pokedex_SetBGMapMode_3ifDMG_4ifCGB call Pokedex_ResetBGMapMode call Pokedex_DrawMainScreenBG - ld a, POKDEX_SCX + ld a, POKEDEX_SCX ld [hSCX], a ld a, [wCurrentDexMode] @@ -453,7 +453,7 @@ DexEntryScreen_MenuActionJumptable: ; 402f2 ld [hBGMapMode], a ld a, $90 ld [hWY], a - ld a, POKDEX_SCX + ld a, POKEDEX_SCX ld [hSCX], a call DelayFrame call Pokedex_RedisplayDexEntry @@ -497,7 +497,7 @@ DexEntryScreen_MenuActionJumptable: ; 402f2 call Pokedex_RedisplayDexEntry call EnableLCD call WaitBGMap - ld a, POKDEX_SCX + ld a, POKEDEX_SCX ld [hSCX], a call Pokedex_ApplyUsualPals ret @@ -733,7 +733,7 @@ Pokedex_InitSearchResultsScreen: ; 4050a (10:450a) call Pokedex_SetBGMapMode3 call Pokedex_ResetBGMapMode call Pokedex_DrawSearchResultsScreenBG - ld a, POKDEX_SCX + ld a, POKEDEX_SCX ld [hSCX], a ld a, $4a ld [hWX], a diff --git a/engine/routines/newpokedexentry.asm b/engine/routines/newpokedexentry.asm index 122688eff..d6b755200 100644 --- a/engine/routines/newpokedexentry.asm +++ b/engine/routines/newpokedexentry.asm @@ -11,7 +11,7 @@ NewPokedexEntry: ; fb877 ld a, [wPokedexStatus] push af ld a, [hSCX] - add POKDEX_SCX + add POKEDEX_SCX ld [hSCX], a xor a ld [wPokedexStatus], a @@ -26,7 +26,7 @@ NewPokedexEntry: ; fb877 call MaxVolume call RotateThreePalettesRight ld a, [hSCX] - add -POKDEX_SCX + add -POKEDEX_SCX ld [hSCX], a call .ReturnFromDexRegistration pop af -- cgit v1.2.3 From 5e4fa42fa7e2405760efc77f8c2e7167e67990ac Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sun, 21 Jan 2018 17:45:56 -0500 Subject: Unrelated routine gets its own file --- .../unreferenced_getgen1trainerclassname.asm | 21 ++++++++++++++++++++ engine/types.asm | 23 ---------------------- 2 files changed, 21 insertions(+), 23 deletions(-) create mode 100644 engine/routines/unreferenced_getgen1trainerclassname.asm (limited to 'engine') diff --git a/engine/routines/unreferenced_getgen1trainerclassname.asm b/engine/routines/unreferenced_getgen1trainerclassname.asm new file mode 100644 index 000000000..64c55ed84 --- /dev/null +++ b/engine/routines/unreferenced_getgen1trainerclassname.asm @@ -0,0 +1,21 @@ +Unreferenced_GetGen1TrainerClassName: ; 50a28 + ld hl, Gen1TrainerClassNames + ld a, [TrainerClass] + dec a + ld c, a + ld b, 0 + add hl, bc + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + ld de, StringBuffer1 +.copy + ld a, [hli] + ld [de], a + inc de + cp "@" + jr nz, .copy + ret + +INCLUDE "data/unused/gen_1_trainer_names.asm" diff --git a/engine/types.asm b/engine/types.asm index e0235aff1..931e98b92 100644 --- a/engine/types.asm +++ b/engine/types.asm @@ -97,26 +97,3 @@ GetTypeName: ; 50964 INCLUDE "data/types/names.asm" - - -Unreferenced_GetGen1TrainerClassName: ; 50a28 - ld hl, Gen1TrainerClassNames - ld a, [TrainerClass] - dec a - ld c, a - ld b, 0 - add hl, bc - add hl, bc - ld a, [hli] - ld h, [hl] - ld l, a - ld de, StringBuffer1 -.copy - ld a, [hli] - ld [de], a - inc de - cp "@" - jr nz, .copy - ret - -INCLUDE "data/unused/gen_1_trainer_names.asm" -- cgit v1.2.3 From 7f54df58bfb00564874f8b6b3acef52a9aff7442 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sun, 21 Jan 2018 18:00:23 -0500 Subject: Group engine/pokedex files --- engine/pokedex.asm | 2592 ----------------------------------- engine/pokedex/newpokedexentry.asm | 52 + engine/pokedex/pokedex.asm | 2592 +++++++++++++++++++++++++++++++++++ engine/pokedex/pokedex_2.asm | 280 ++++ engine/pokedex/pokedex_3.asm | 162 +++ engine/pokedex/unown_dex.asm | 52 + engine/pokedex_2.asm | 280 ---- engine/pokedex_3.asm | 162 --- engine/routines/newpokedexentry.asm | 52 - engine/unown_dex.asm | 52 - 10 files changed, 3138 insertions(+), 3138 deletions(-) delete mode 100644 engine/pokedex.asm create mode 100644 engine/pokedex/newpokedexentry.asm create mode 100644 engine/pokedex/pokedex.asm create mode 100644 engine/pokedex/pokedex_2.asm create mode 100644 engine/pokedex/pokedex_3.asm create mode 100755 engine/pokedex/unown_dex.asm delete mode 100644 engine/pokedex_2.asm delete mode 100644 engine/pokedex_3.asm delete mode 100644 engine/routines/newpokedexentry.asm delete mode 100755 engine/unown_dex.asm (limited to 'engine') diff --git a/engine/pokedex.asm b/engine/pokedex.asm deleted file mode 100644 index e96d0a7d7..000000000 --- a/engine/pokedex.asm +++ /dev/null @@ -1,2592 +0,0 @@ -; Pokedex_RunJumptable.Jumptable indexes - const_def - const DEXSTATE_MAIN_SCR - const DEXSTATE_UPDATE_MAIN_SCR - const DEXSTATE_DEX_ENTRY_SCR - const DEXSTATE_UPDATE_DEX_ENTRY_SCR - const DEXSTATE_REINIT_DEX_ENTRY_SCR - const DEXSTATE_SEARCH_SCR - const DEXSTATE_UPDATE_SEARCH_SCR - const DEXSTATE_OPTION_SCR - const DEXSTATE_UPDATE_OPTION_SCR - const DEXSTATE_SEARCH_RESULTS_SCR - const DEXSTATE_UPDATE_SEARCH_RESULTS_SCR - const DEXSTATE_UNOWN_MODE - const DEXSTATE_UPDATE_UNOWN_MODE - const DEXSTATE_EXIT - -POKEDEX_SCX EQU 5 -GLOBAL POKEDEX_SCX - -Pokedex: ; 40000 - - ld a, [hWX] - ld l, a - ld a, [hWY] - ld h, a - push hl - ld a, [hSCX] - push af - ld hl, Options - ld a, [hl] - push af - set NO_TEXT_SCROLL, [hl] - ld a, [VramState] - push af - xor a - ld [VramState], a - ld a, [hInMenu] - push af - ld a, $1 - ld [hInMenu], a - - xor a - ld [hMapAnims], a - call InitPokedex - call DelayFrame - -.main - call JoyTextDelay - ld a, [wJumptableIndex] - bit 7, a - jr nz, .exit - call Pokedex_RunJumptable - call DelayFrame - jr .main - -.exit - ld de, SFX_READ_TEXT_2 - call PlaySFX - call WaitSFX - call ClearSprites - ld a, [wCurrentDexMode] - ld [wLastDexMode], a - - pop af - ld [hInMenu], a - pop af - ld [VramState], a - pop af - ld [Options], a - pop af - ld [hSCX], a - pop hl - ld a, l - ld [hWX], a - ld a, h - ld [hWY], a - ret - -InitPokedex: ; 40063 - call ClearBGPalettes - call ClearSprites - call ClearTileMap - call Pokedex_LoadGFX - - ld hl, wPokedexDataStart - ld bc, wPokedexDataEnd - wPokedexDataStart - xor a - call ByteFill - - xor a - ld [wJumptableIndex], a - ld [wPrevDexEntryJumptableIndex], a - ld [wPrevDexEntryBackup], a - ld [wcf66], a - - call Pokedex_CheckUnlockedUnownMode - - ld a, [wLastDexMode] - ld [wCurrentDexMode], a - - call Pokedex_OrderMonsByMode - call Pokedex_InitCursorPosition - call Pokedex_GetLandmark - farcall DrawDexEntryScreenRightEdge - call Pokedex_ResetBGMapMode - ret - -Pokedex_CheckUnlockedUnownMode: ; 400a2 - ld a, [wStatusFlags] - bit 1, a - jr nz, .unlocked - - xor a - ld [wUnlockedUnownMode], a - ret - -.unlocked - ld a, TRUE - ld [wUnlockedUnownMode], a - ret - -Pokedex_InitCursorPosition: ; 400b4 - ld hl, wPokedexOrder - ld a, [wPrevDexEntry] - and a - jr z, .done - cp NUM_POKEMON + 1 - jr nc, .done - - ld b, a - ld a, [wDexListingEnd] - cp $8 - jr c, .only_one_page - - sub $7 - ld c, a -.loop1 - ld a, b - cp [hl] - jr z, .done - inc hl - ld a, [wDexListingScrollOffset] - inc a - ld [wDexListingScrollOffset], a - dec c - jr nz, .loop1 - -.only_one_page - ld c, $7 -.loop2 - ld a, b - cp [hl] - jr z, .done - inc hl - ld a, [wDexListingCursor] - inc a - ld [wDexListingCursor], a - dec c - jr nz, .loop2 - -.done - ret - -Pokedex_GetLandmark: ; 400ed - ld a, [MapGroup] - ld b, a - ld a, [MapNumber] - ld c, a - call GetWorldMapLocation - - cp SPECIAL_MAP - jr nz, .load - - ld a, [BackupMapGroup] - ld b, a - ld a, [BackupMapNumber] - ld c, a - call GetWorldMapLocation - -.load - ld [wDexCurrentLocation], a - ret - -Pokedex_RunJumptable: ; 4010b - ld a, [wJumptableIndex] - ld hl, .Jumptable - call Pokedex_LoadPointer - jp hl - -.Jumptable: ; 40115 (10:4115) -; entries correspond to DEXSTATE_* constants - dw Pokedex_InitMainScreen - dw Pokedex_UpdateMainScreen - dw Pokedex_InitDexEntryScreen - dw Pokedex_UpdateDexEntryScreen - dw Pokedex_ReinitDexEntryScreen - dw Pokedex_InitSearchScreen - dw Pokedex_UpdateSearchScreen - dw Pokedex_InitOptionScreen - dw Pokedex_UpdateOptionScreen - dw Pokedex_InitSearchResultsScreen - dw Pokedex_UpdateSearchResultsScreen - dw Pokedex_InitUnownMode - dw Pokedex_UpdateUnownMode - dw Pokedex_Exit - -Pokedex_IncrementDexPointer: ; 40131 (10:4131) - ld hl, wJumptableIndex - inc [hl] - ret - -Pokedex_Exit: ; 40136 (10:4136) - ld hl, wJumptableIndex - set 7, [hl] - ret - -Pokedex_InitMainScreen: ; 4013c (10:413c) - xor a - ld [hBGMapMode], a - call ClearSprites - xor a - hlcoord 0, 0, AttrMap - ld bc, SCREEN_HEIGHT * SCREEN_WIDTH - call ByteFill - farcall DrawPokedexListWindow - hlcoord 0, 17 - ld de, String_START_SEARCH - call Pokedex_PlaceString - ld a, 7 - ld [wDexListingHeight], a - call Pokedex_PrintListing - call Pokedex_SetBGMapMode_3ifDMG_4ifCGB - call Pokedex_ResetBGMapMode - call Pokedex_DrawMainScreenBG - ld a, POKEDEX_SCX - ld [hSCX], a - - ld a, [wCurrentDexMode] - cp DEXMODE_OLD - ld a, $4a - jr z, .okay - ld a, $47 -.okay - ld [hWX], a - xor a - ld [hWY], a - call WaitBGMap - - call Pokedex_ResetBGMapMode - ld a, -1 - ld [CurPartySpecies], a - ld a, SCGB_POKEDEX - call Pokedex_GetSGBLayout - call Pokedex_UpdateCursorOAM - farcall DrawPokedexListWindow - hlcoord 0, 17 - ld de, String_START_SEARCH - call Pokedex_PlaceString - ld a, 7 - ld [wDexListingHeight], a - call Pokedex_PrintListing - call Pokedex_IncrementDexPointer - ret - -Pokedex_UpdateMainScreen: ; 401ae (10:41ae) - ld hl, hJoyPressed - ld a, [hl] - and B_BUTTON - jr nz, .b - ld a, [hl] - and A_BUTTON - jr nz, .a - ld a, [hl] - and SELECT - jr nz, .select - ld a, [hl] - and START - jr nz, .start - call Pokedex_ListingHandleDPadInput - ret nc - call Pokedex_UpdateCursorOAM - xor a - ld [hBGMapMode], a - call Pokedex_PrintListing - call Pokedex_SetBGMapMode3 - call Pokedex_ResetBGMapMode - ret - -.a - call Pokedex_GetSelectedMon - call Pokedex_CheckSeen - ret z - ld a, DEXSTATE_DEX_ENTRY_SCR - ld [wJumptableIndex], a - ld a, DEXSTATE_MAIN_SCR - ld [wPrevDexEntryJumptableIndex], a - ret - -.select - call Pokedex_BlackOutBG - ld a, DEXSTATE_OPTION_SCR - ld [wJumptableIndex], a - xor a - ld [hSCX], a - ld a, $a7 - ld [hWX], a - call DelayFrame - ret - -.start - call Pokedex_BlackOutBG - ld a, DEXSTATE_SEARCH_SCR - ld [wJumptableIndex], a - xor a - ld [hSCX], a - ld a, $a7 - ld [hWX], a - call DelayFrame - ret - -.b - ld a, DEXSTATE_EXIT - ld [wJumptableIndex], a - ret - -Pokedex_InitDexEntryScreen: ; 40217 (10:4217) - call LowVolume - xor a ; page 1 - ld [wPokedexStatus], a - xor a - ld [hBGMapMode], a - call ClearSprites - call Pokedex_LoadCurrentFootprint - call Pokedex_DrawDexEntryScreenBG - call Pokedex_InitArrowCursor - call Pokedex_GetSelectedMon - ld [wPrevDexEntry], a - farcall DisplayDexEntry - call Pokedex_DrawFootprint - call WaitBGMap - ld a, $a7 - ld [hWX], a - call Pokedex_GetSelectedMon - ld [CurPartySpecies], a - ld a, SCGB_POKEDEX - call Pokedex_GetSGBLayout - ld a, [CurPartySpecies] - call PlayMonCry - call Pokedex_IncrementDexPointer - ret - -Pokedex_UpdateDexEntryScreen: ; 40258 (10:4258) - ld de, DexEntryScreen_ArrowCursorData - call Pokedex_MoveArrowCursor - ld hl, hJoyPressed - ld a, [hl] - and B_BUTTON - jr nz, .return_to_prev_screen - ld a, [hl] - and A_BUTTON - jr nz, .do_menu_action - call Pokedex_NextOrPreviousDexEntry - ret nc - call Pokedex_IncrementDexPointer - ret - -.do_menu_action - ld a, [wDexArrowCursorPosIndex] - ld hl, DexEntryScreen_MenuActionJumptable - call Pokedex_LoadPointer - jp hl - -.return_to_prev_screen - ld a, [LastVolume] - and a - jr z, .max_volume - ld a, $77 - ld [LastVolume], a - -.max_volume - call MaxVolume - ld a, [wPrevDexEntryJumptableIndex] - ld [wJumptableIndex], a - ret - -Pokedex_Page: ; 40292 - ld a, [wPokedexStatus] - xor 1 ; toggle page - ld [wPokedexStatus], a - call Pokedex_GetSelectedMon - ld [wPrevDexEntry], a - farcall DisplayDexEntry - call WaitBGMap - ret - -Pokedex_ReinitDexEntryScreen: ; 402aa (10:42aa) -; Reinitialize the Pokédex entry screen after changing the selected mon. - call Pokedex_BlackOutBG - xor a ; page 1 - ld [wPokedexStatus], a - xor a - ld [hBGMapMode], a - call Pokedex_DrawDexEntryScreenBG - call Pokedex_InitArrowCursor - call Pokedex_LoadCurrentFootprint - call Pokedex_GetSelectedMon - ld [wPrevDexEntry], a - farcall DisplayDexEntry - call Pokedex_DrawFootprint - call Pokedex_LoadSelectedMonTiles - call WaitBGMap - call Pokedex_GetSelectedMon - ld [CurPartySpecies], a - ld a, SCGB_POKEDEX - call Pokedex_GetSGBLayout - ld a, [CurPartySpecies] - call PlayMonCry - ld hl, wJumptableIndex - dec [hl] - ret - -DexEntryScreen_ArrowCursorData: ; 402e8 - db D_RIGHT | D_LEFT, 4 - dwcoord 1, 17 ; PAGE - dwcoord 6, 17 ; AREA - dwcoord 11, 17 ; CRY - dwcoord 15, 17 ; PRNT - - -DexEntryScreen_MenuActionJumptable: ; 402f2 - dw Pokedex_Page - dw .Area - dw .Cry - dw .Print - -.Area: ; 402fa - call Pokedex_BlackOutBG - xor a - ld [hSCX], a - call DelayFrame - ld a, $7 - ld [hWX], a - ld a, $90 - ld [hWY], a - call Pokedex_GetSelectedMon - ld a, [wDexCurrentLocation] - ld e, a - predef Pokedex_GetArea - call Pokedex_BlackOutBG - call DelayFrame - xor a - ld [hBGMapMode], a - ld a, $90 - ld [hWY], a - ld a, POKEDEX_SCX - ld [hSCX], a - call DelayFrame - call Pokedex_RedisplayDexEntry - call Pokedex_LoadSelectedMonTiles - call WaitBGMap - call Pokedex_GetSelectedMon - ld [CurPartySpecies], a - ld a, SCGB_POKEDEX - call Pokedex_GetSGBLayout - ret - -.Cry: ; 40340 - call Pokedex_GetSelectedMon - ld a, [wd265] - call GetCryIndex - ld e, c - ld d, b - call PlayCry - ret - -.Print: ; 4034f - call Pokedex_ApplyPrintPals - xor a - ld [hSCX], a - ld a, [wPrevDexEntryBackup] - push af - ld a, [wPrevDexEntryJumptableIndex] - push af - ld a, [wJumptableIndex] - push af - farcall PrintDexEntry - pop af - ld [wJumptableIndex], a - pop af - ld [wPrevDexEntryJumptableIndex], a - pop af - ld [wPrevDexEntryBackup], a - call ClearBGPalettes - call DisableLCD - call Pokedex_LoadInvertedFont - call Pokedex_RedisplayDexEntry - call EnableLCD - call WaitBGMap - ld a, POKEDEX_SCX - ld [hSCX], a - call Pokedex_ApplyUsualPals - ret - -Pokedex_RedisplayDexEntry: ; 4038d - call Pokedex_DrawDexEntryScreenBG - call Pokedex_GetSelectedMon - farcall DisplayDexEntry - call Pokedex_DrawFootprint - ret - -Pokedex_InitOptionScreen: ; 4039d (10:439d) - xor a - ld [hBGMapMode], a - call ClearSprites - call Pokedex_DrawOptionScreenBG - call Pokedex_InitArrowCursor - ld a, [wCurrentDexMode] ; Index of the topmost visible item in a scrolling menu ??? - ld [wDexArrowCursorPosIndex], a - call Pokedex_DisplayModeDescription - call WaitBGMap - ld a, SCGB_POKEDEX_SEARCH_OPTION - call Pokedex_GetSGBLayout - call Pokedex_IncrementDexPointer - ret - -Pokedex_UpdateOptionScreen: ; 403be (10:43be) - ld a, [wUnlockedUnownMode] - and a - jr nz, .okay - ld de, .NoUnownModeArrowCursorData - jr .okay2 -.okay - ld de, .ArrowCursorData -.okay2 - call Pokedex_MoveArrowCursor - call c, Pokedex_DisplayModeDescription - ld hl, hJoyPressed - ld a, [hl] - and SELECT | B_BUTTON - jr nz, .return_to_main_screen - ld a, [hl] - and A_BUTTON - jr nz, .do_menu_action - ret - -.do_menu_action - ld a, [wDexArrowCursorPosIndex] - ld hl, .MenuActionJumptable - call Pokedex_LoadPointer - jp hl - -.return_to_main_screen - call Pokedex_BlackOutBG - ld a, DEXSTATE_MAIN_SCR - ld [wJumptableIndex], a - ret - -.NoUnownModeArrowCursorData: ; 403f3 - db D_UP | D_DOWN, 3 - dwcoord 2, 4 ; NEW - dwcoord 2, 6 ; OLD - dwcoord 2, 8 ; ABC - -.ArrowCursorData: ; 403fb - db D_UP | D_DOWN, 4 - dwcoord 2, 4 ; NEW - dwcoord 2, 6 ; OLD - dwcoord 2, 8 ; ABC - dwcoord 2, 10 ; UNOWN - -.MenuActionJumptable: ; 40405 (10:4405) - dw .MenuAction_NewMode - dw .MenuAction_OldMode - dw .MenuAction_ABCMode - dw .MenuAction_UnownMode - -.MenuAction_NewMode: ; 4040d (10:440d) - ld b, DEXMODE_NEW - jr .ChangeMode - -.MenuAction_OldMode: ; 40411 (10:4411) - ld b, DEXMODE_OLD - jr .ChangeMode - -.MenuAction_ABCMode: ; 40415 (10:4415) - ld b, DEXMODE_ABC - -.ChangeMode: ; 40417 (10:4417) - ld a, [wCurrentDexMode] - cp b - jr z, .skip_changing_mode ; Skip if new mode is same as current. - - ld a, b - ld [wCurrentDexMode], a - call Pokedex_OrderMonsByMode - call Pokedex_DisplayChangingModesMessage - xor a - ld [wDexListingScrollOffset], a - ld [wDexListingCursor], a - call Pokedex_InitCursorPosition - -.skip_changing_mode - call Pokedex_BlackOutBG - ld a, DEXSTATE_MAIN_SCR - ld [wJumptableIndex], a - ret - -.MenuAction_UnownMode: ; 4043a (10:443a) - call Pokedex_BlackOutBG - ld a, DEXSTATE_UNOWN_MODE - ld [wJumptableIndex], a - ret - -Pokedex_InitSearchScreen: ; 40443 (10:4443) - xor a - ld [hBGMapMode], a - call ClearSprites - call Pokedex_DrawSearchScreenBG - call Pokedex_InitArrowCursor - ld a, NORMAL + 1 - ld [wDexSearchMonType1], a - xor a - ld [wDexSearchMonType2], a - call Pokedex_PlaceSearchScreenTypeStrings - xor a - ld [wDexSearchSlowpokeFrame], a - farcall DoDexSearchSlowpokeFrame - call WaitBGMap - ld a, SCGB_POKEDEX_SEARCH_OPTION - call Pokedex_GetSGBLayout - call Pokedex_IncrementDexPointer - ret - -Pokedex_UpdateSearchScreen: ; 40471 (10:4471) - ld de, .ArrowCursorData - call Pokedex_MoveArrowCursor - call Pokedex_UpdateSearchMonType - call c, Pokedex_PlaceSearchScreenTypeStrings - ld hl, hJoyPressed - ld a, [hl] - and START | B_BUTTON - jr nz, .cancel - ld a, [hl] - and A_BUTTON - jr nz, .do_menu_action - ret - -.do_menu_action - ld a, [wDexArrowCursorPosIndex] - ld hl, .MenuActionJumptable - call Pokedex_LoadPointer - jp hl - -.cancel - call Pokedex_BlackOutBG - ld a, DEXSTATE_MAIN_SCR - ld [wJumptableIndex], a - ret - -.ArrowCursorData: ; 4049e - db D_UP | D_DOWN, 4 - dwcoord 2, 4 ; TYPE 1 - dwcoord 2, 6 ; TYPE 2 - dwcoord 2, 13 ; BEGIN SEARCH - dwcoord 2, 15 ; CANCEL - -.MenuActionJumptable: ; 404a8 - dw .MenuAction_MonSearchType - dw .MenuAction_MonSearchType - dw .MenuAction_BeginSearch - dw .MenuAction_Cancel - -.MenuAction_MonSearchType: ; 404b0 - call Pokedex_NextSearchMonType - call Pokedex_PlaceSearchScreenTypeStrings - ret - -.MenuAction_BeginSearch: ; 404b7 - call Pokedex_SearchForMons - farcall AnimateDexSearchSlowpoke - ld a, [wDexSearchResultCount] - and a - jr nz, .show_search_results - -; No mon with matching types was found. - call Pokedex_OrderMonsByMode - call Pokedex_DisplayTypeNotFoundMessage - xor a - ld [hBGMapMode], a - call Pokedex_DrawSearchScreenBG - call Pokedex_InitArrowCursor - call Pokedex_PlaceSearchScreenTypeStrings - call WaitBGMap - ret - -.show_search_results - ld [wDexListingEnd], a - ld a, [wDexListingScrollOffset] - ld [wDexListingScrollOffsetBackup], a - ld a, [wDexListingCursor] - ld [wDexListingCursorBackup], a - ld a, [wPrevDexEntry] - ld [wPrevDexEntryBackup], a - xor a - ld [wDexListingScrollOffset], a - ld [wDexListingCursor], a - call Pokedex_BlackOutBG - ld a, DEXSTATE_SEARCH_RESULTS_SCR - ld [wJumptableIndex], a - ret - -.MenuAction_Cancel: ; 40501 - call Pokedex_BlackOutBG - ld a, DEXSTATE_MAIN_SCR - ld [wJumptableIndex], a - ret - -Pokedex_InitSearchResultsScreen: ; 4050a (10:450a) - xor a - ld [hBGMapMode], a - xor a - hlcoord 0, 0, AttrMap - ld bc, SCREEN_WIDTH * SCREEN_HEIGHT - call ByteFill - call Pokedex_SetBGMapMode4 - call Pokedex_ResetBGMapMode - farcall DrawPokedexSearchResultsWindow - call Pokedex_PlaceSearchResultsTypeStrings - ld a, 4 - ld [wDexListingHeight], a - call Pokedex_PrintListing - call Pokedex_SetBGMapMode3 - call Pokedex_ResetBGMapMode - call Pokedex_DrawSearchResultsScreenBG - ld a, POKEDEX_SCX - ld [hSCX], a - ld a, $4a - ld [hWX], a - xor a - ld [hWY], a - call WaitBGMap - call Pokedex_ResetBGMapMode - farcall DrawPokedexSearchResultsWindow - call Pokedex_PlaceSearchResultsTypeStrings - call Pokedex_UpdateSearchResultsCursorOAM - ld a, -1 - ld [CurPartySpecies], a - ld a, SCGB_POKEDEX - call Pokedex_GetSGBLayout - call Pokedex_IncrementDexPointer - ret - -Pokedex_UpdateSearchResultsScreen: ; 40562 (10:4562) - ld hl, hJoyPressed - ld a, [hl] - and B_BUTTON - jr nz, .return_to_search_screen - ld a, [hl] - and A_BUTTON - jr nz, .go_to_dex_entry - call Pokedex_ListingHandleDPadInput - ret nc - call Pokedex_UpdateSearchResultsCursorOAM - xor a - ld [hBGMapMode], a - call Pokedex_PrintListing - call Pokedex_SetBGMapMode3 - call Pokedex_ResetBGMapMode - ret - -.go_to_dex_entry - call Pokedex_GetSelectedMon - call Pokedex_CheckSeen - ret z - ld a, DEXSTATE_DEX_ENTRY_SCR - ld [wJumptableIndex], a - ld a, DEXSTATE_SEARCH_RESULTS_SCR - ld [wPrevDexEntryJumptableIndex], a - ret - -.return_to_search_screen - ld a, [wDexListingScrollOffsetBackup] - ld [wDexListingScrollOffset], a - ld a, [wDexListingCursorBackup] - ld [wDexListingCursor], a - ld a, [wPrevDexEntryBackup] - ld [wPrevDexEntry], a - call Pokedex_BlackOutBG - call ClearSprites - call Pokedex_OrderMonsByMode - ld a, DEXSTATE_SEARCH_SCR - ld [wJumptableIndex], a - xor a - ld [hSCX], a - ld a, $a7 - ld [hWX], a - ret - -Pokedex_InitUnownMode: ; 405bd (10:45bd) - call Pokedex_LoadUnownFont - call Pokedex_DrawUnownModeBG - xor a - ld [wDexCurrentUnownIndex], a - call Pokedex_LoadUnownFrontpicTiles - call Pokedex_UnownModePlaceCursor - farcall PrintUnownWord - call WaitBGMap - ld a, SCGB_POKEDEX_UNOWN_MODE - call Pokedex_GetSGBLayout - call Pokedex_IncrementDexPointer - ret - -Pokedex_UpdateUnownMode: ; 405df (10:45df) - ld hl, hJoyPressed - ld a, [hl] - and A_BUTTON | B_BUTTON - jr nz, .a_b - call Pokedex_UnownModeHandleDPadInput - ret - -.a_b - call Pokedex_BlackOutBG - ld a, DEXSTATE_OPTION_SCR - ld [wJumptableIndex], a - call DelayFrame - call Pokedex_CheckSGB - jr nz, .decompress - farcall LoadSGBPokedexGFX2 - jr .done - -.decompress - ld hl, PokedexLZ - ld de, vTiles2 tile $31 - lb bc, BANK(PokedexLZ), 58 - call DecompressRequest2bpp - -.done - ret - -Pokedex_UnownModeHandleDPadInput: ; 40610 (10:4610) - ld hl, hJoyLast - ld a, [hl] - and D_RIGHT - jr nz, .right - ld a, [hl] - and D_LEFT - jr nz, .left - ret - -.right - ld a, [wDexUnownCount] - ld e, a - ld hl, wDexCurrentUnownIndex - ld a, [hl] - inc a - cp e - ret nc - ld a, [hl] - inc [hl] - jr .update - -.left - ld hl, wDexCurrentUnownIndex - ld a, [hl] - and a - ret z - ld a, [hl] - dec [hl] - -.update - push af - xor a - ld [hBGMapMode], a - pop af - call Pokedex_UnownModeEraseCursor - call Pokedex_LoadUnownFrontpicTiles - call Pokedex_UnownModePlaceCursor - farcall PrintUnownWord - ld a, $1 - ld [hBGMapMode], a - call DelayFrame - call DelayFrame - ret - -Pokedex_UnownModeEraseCursor: ; 40654 (10:4654) - ld c, " " - jr Pokedex_UnownModeUpdateCursorGfx - -Pokedex_UnownModePlaceCursor: ; 40658 (10:4658) - ld a, [wDexCurrentUnownIndex] - ld c, $5a ; diamond cursor - -Pokedex_UnownModeUpdateCursorGfx: ; 4065d (10:465d) - ld e, a - ld d, 0 - ld hl, UnownModeLetterAndCursorCoords + 2 -rept 4 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - ld [hl], c - ret - -Pokedex_NextOrPreviousDexEntry: ; 4066c (10:466c) - ld a, [wDexListingCursor] - ld [wBackupDexListingCursor], a - ld a, [wDexListingScrollOffset] - ld [wBackupDexListingPage], a - ld hl, hJoyLast - ld a, [hl] - and D_UP - jr nz, .up - ld a, [hl] - and D_DOWN - jr nz, .down - and a - ret - -.up - ld a, [wDexListingHeight] - ld d, a - ld a, [wDexListingEnd] - ld e, a - call Pokedex_ListingMoveCursorUp - jr nc, .nope - call Pokedex_GetSelectedMon - call Pokedex_CheckSeen - jr nz, .yep - jr .up - -.down - ld a, [wDexListingHeight] - ld d, a - ld a, [wDexListingEnd] - ld e, a - call Pokedex_ListingMoveCursorDown - jr nc, .nope - call Pokedex_GetSelectedMon - call Pokedex_CheckSeen - jr nz, .yep - jr .down - -.yep - scf - ret - -.nope - ld a, [wBackupDexListingCursor] - ld [wDexListingCursor], a - ld a, [wBackupDexListingPage] - ld [wDexListingScrollOffset], a - and a - ret - -Pokedex_ListingHandleDPadInput: ; 406c5 (10:46c5) -; Handles D-pad input for a list of Pokémon. - ld a, [wDexListingHeight] - ld d, a - ld a, [wDexListingEnd] - ld e, a - ld hl, hJoyLast - ld a, [hl] - and D_UP - jr nz, Pokedex_ListingMoveCursorUp - ld a, [hl] - and D_DOWN - jr nz, Pokedex_ListingMoveCursorDown - ld a, d - cp e - jr nc, Pokedex_ListingPosStayedSame - ld a, [hl] - and D_LEFT - jr nz, Pokedex_ListingMoveUpOnePage - ld a, [hl] - and D_RIGHT - jr nz, Pokedex_ListingMoveDownOnePage - jr Pokedex_ListingPosStayedSame - -Pokedex_ListingMoveCursorUp: ; 406ea (10:46ea) - ld hl, wDexListingCursor - ld a, [hl] - and a - jr z, .try_scrolling - dec [hl] - jr Pokedex_ListingPosChanged -.try_scrolling - ld hl, wDexListingScrollOffset - ld a, [hl] - and a - jr z, Pokedex_ListingPosStayedSame - dec [hl] - jr Pokedex_ListingPosChanged - -Pokedex_ListingMoveCursorDown: ; 406fe (10:46fe) - ld hl, wDexListingCursor - ld a, [hl] - inc a - cp e - jr nc, Pokedex_ListingPosStayedSame - cp d - jr nc, .try_scrolling - inc [hl] - jr Pokedex_ListingPosChanged -.try_scrolling - ld hl, wDexListingScrollOffset - add [hl] - cp e - jr nc, Pokedex_ListingPosStayedSame - inc [hl] - jr Pokedex_ListingPosChanged - -Pokedex_ListingMoveUpOnePage: ; 40716 (10:4716) - ld hl, wDexListingScrollOffset - ld a, [hl] - and a - jr z, Pokedex_ListingPosStayedSame - cp d - jr nc, .not_near_top -; If we're already less than page away from the top, go to the top. - xor a - ld [hl], a - jr Pokedex_ListingPosChanged -.not_near_top - sub d - ld [hl], a - jr Pokedex_ListingPosChanged - -Pokedex_ListingMoveDownOnePage: ; 40728 (10:4728) -; When moving down a page, the return value always report a change in position. - ld hl, wDexListingScrollOffset - ld a, d - add a - add [hl] - jr c, .near_bottom - cp e - jr c, .not_near_bottom -.near_bottom - ld a, e - sub d - ld [hl], a - jr Pokedex_ListingPosChanged -.not_near_bottom - ld a, [hl] - add d - ld [hl], a - jr Pokedex_ListingPosChanged - -Pokedex_ListingPosStayedSame: ; 4073d (10:473d) - and a - ret - -Pokedex_ListingPosChanged: ; 4073f (10:473f) - scf - ret - -Pokedex_FillColumn: ; 40741 -; Fills a column starting at HL, going downwards. -; B is the height of the column and A is the tile it's filled with. - push de - ld de, SCREEN_WIDTH -.loop - ld [hl], a - add hl, de - dec b - jr nz, .loop - pop de - ret - - -Pokedex_DrawMainScreenBG: ; 4074c (10:474c) -; Draws the left sidebar and the bottom bar on the main screen. - hlcoord 0, 17 - ld de, String_START_SEARCH - call Pokedex_PlaceString - ld a, $32 - hlcoord 0, 0 - ld bc, SCREEN_WIDTH * SCREEN_HEIGHT - call ByteFill - hlcoord 0, 0 - lb bc, 7, 7 - call Pokedex_PlaceBorder - hlcoord 0, 9 - lb bc, 6, 7 - call Pokedex_PlaceBorder - hlcoord 1, 11 - ld de, String_SEEN - call Pokedex_PlaceString - ld hl, PokedexSeen - ld b, EndPokedexSeen - PokedexSeen - call CountSetBits - ld de, wd265 - hlcoord 5, 12 - lb bc, 1, 3 - call PrintNum - hlcoord 1, 14 - ld de, String_OWN - call Pokedex_PlaceString - ld hl, PokedexCaught - ld b, EndPokedexCaught - PokedexCaught - call CountSetBits - ld de, wd265 - hlcoord 5, 15 - lb bc, 1, 3 - call PrintNum - hlcoord 1, 17 - ld de, String_SELECT_OPTION - call Pokedex_PlaceString - hlcoord 8, 1 - ld b, 7 - ld a, $5a - call Pokedex_FillColumn - hlcoord 8, 10 - ld b, 6 - ld a, $5a - call Pokedex_FillColumn - hlcoord 8, 0 - ld [hl], $59 - hlcoord 8, 8 - ld [hl], $53 - hlcoord 8, 9 - ld [hl], $54 - hlcoord 8, 16 - ld [hl], $5b - call Pokedex_PlaceFrontpicTopLeftCorner - ret - -String_SEEN: ; 407e1 - db "SEEN", -1 -String_OWN: ; 407e6 - db "OWN", -1 -String_SELECT_OPTION: ; 407ea - db $3b, $48, $49, $4a, $44, $45, $46, $47 ; SELECT > OPTION - ; fallthrough -String_START_SEARCH: ; 407f2 - db $3c, $3b, $41, $42, $43, $4b, $4c, $4d, $4e, $3c, -1 ; START > SEARCH - -Pokedex_DrawDexEntryScreenBG: ; 407fd - call Pokedex_FillBackgroundColor2 - hlcoord 0, 0 - lb bc, 15, 18 - call Pokedex_PlaceBorder - hlcoord 19, 0 - ld [hl], $34 - hlcoord 19, 1 - ld a, " " - ld b, 15 - call Pokedex_FillColumn - ld [hl], $39 - hlcoord 1, 10 - ld bc, 19 - ld a, $61 - call ByteFill - hlcoord 1, 17 - ld bc, 18 - ld a, " " - call ByteFill - hlcoord 9, 7 - ld de, .Height - call Pokedex_PlaceString - hlcoord 9, 9 - ld de, .Weight - call Pokedex_PlaceString - hlcoord 0, 17 - ld de, .MenuItems - call Pokedex_PlaceString - call Pokedex_PlaceFrontpicTopLeftCorner - ret - -.Unused: ; 4084f - db $5c, $5d, -1 ; No. -.Height: ; 40852 - db "HT ?", $5e, "??", $5f, -1 ; HT ?'??" -.Weight: ; 4085c - db "WT ???lb", -1 ; WT ???lb -.MenuItems: ; 40867 - db $3b, " PAGE AREA CRY PRNT", -1 - -Pokedex_DrawOptionScreenBG: ; 4087c (10:487c) - call Pokedex_FillBackgroundColor2 - hlcoord 0, 2 - lb bc, 8, 18 - call Pokedex_PlaceBorder - hlcoord 0, 12 - lb bc, 4, 18 - call Pokedex_PlaceBorder - hlcoord 0, 1 - ld de, .Title - call Pokedex_PlaceString - hlcoord 3, 4 - ld de, .Modes - call PlaceString - ld a, [wUnlockedUnownMode] - and a - ret z - hlcoord 3, 10 - ld de, .UnownMode - call PlaceString - ret - -.Title: ; 408b2 - db $3b, " OPTION ", $3c, -1 - -.Modes: ; 408bd - db "NEW #DEX MODE" - next "OLD #DEX MODE" - next "A to Z MODE" - db "@" - -.UnownMode: ; 408e5 - db "UNOWN MODE@" - -Pokedex_DrawSearchScreenBG: ; 408f0 (10:48f0) - call Pokedex_FillBackgroundColor2 - hlcoord 0, 2 - lb bc, 14, 18 - call Pokedex_PlaceBorder - hlcoord 0, 1 - ld de, .Title - call Pokedex_PlaceString - hlcoord 8, 4 - ld de, .TypeLeftRightArrows - call Pokedex_PlaceString - hlcoord 8, 6 - ld de, .TypeLeftRightArrows - call Pokedex_PlaceString - hlcoord 3, 4 - ld de, .Types - call PlaceString - hlcoord 3, 13 - ld de, .Menu - call PlaceString - ret - -.Title: ; 4092a - db $3b, " SEARCH ", $3c, -1 - -.TypeLeftRightArrows: ; 40935 - db $3d, " ", $3e, -1 - -.Types: ; 40940 - db "TYPE1" - next "TYPE2" - db "@" - -.Menu: ; 4094c - db "BEGIN SEARCH!!" - next "CANCEL" - db "@" - -Pokedex_DrawSearchResultsScreenBG: ; 40962 (10:4962) - call Pokedex_FillBackgroundColor2 - hlcoord 0, 0 - lb bc, 7, 7 - call Pokedex_PlaceBorder - hlcoord 0, 11 - lb bc, 5, 18 - call Pokedex_PlaceBorder - hlcoord 1, 12 - ld de, .BottomWindowText - call PlaceString - ld de, wDexSearchResultCount - hlcoord 1, 16 - lb bc, 1, 3 - call PrintNum - hlcoord 8, 0 - ld [hl], $59 - hlcoord 8, 1 - ld b, 7 - ld a, $5a - call Pokedex_FillColumn - hlcoord 8, 8 - ld [hl], $53 - hlcoord 8, 9 - ld [hl], $69 - hlcoord 8, 10 - ld [hl], $6a - call Pokedex_PlaceFrontpicTopLeftCorner - ret - -.BottomWindowText: ; 409ae - db "SEARCH RESULTS" - next " TYPE" - next " FOUND!" - db "@" - -Pokedex_PlaceSearchResultsTypeStrings: ; 409cf (10:49cf) - ld a, [wDexSearchMonType1] - hlcoord 0, 14 - call Pokedex_PlaceTypeString - ld a, [wDexSearchMonType1] - ld b, a - ld a, [wDexSearchMonType2] - and a - jr z, .done - cp b - jr z, .done - hlcoord 2, 15 - call Pokedex_PlaceTypeString - hlcoord 1, 15 - ld [hl], "/" -.done - ret - -Pokedex_DrawUnownModeBG: ; 409f1 (10:49f1) - call Pokedex_FillBackgroundColor2 - hlcoord 2, 1 - lb bc, 10, 13 - call Pokedex_PlaceBorder - hlcoord 2, 14 - lb bc, 1, 13 - call Pokedex_PlaceBorder - hlcoord 2, 15 - ld [hl], $3d - hlcoord 16, 15 - ld [hl], $3e - hlcoord 6, 5 - call Pokedex_PlaceFrontpicAtHL - ld de, 0 - ld b, 0 - ld c, 26 -.loop - ld hl, UnownDex - add hl, de - ld a, [hl] - and a - jr z, .done - push af - ld hl, UnownModeLetterAndCursorCoords -rept 4 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - pop af - add $40 - 1 ; Unown A - ld [hl], a - inc de - inc b - dec c - jr nz, .loop -.done - ld a, b - ld [wDexUnownCount], a - ret - -UnownModeLetterAndCursorCoords: ; 40a3e -; entries correspond to Unown forms -; letter, cursor - dwcoord 4,11, 3,11 ; A - dwcoord 4,10, 3,10 ; B - dwcoord 4, 9, 3, 9 ; C - dwcoord 4, 8, 3, 8 ; D - dwcoord 4, 7, 3, 7 ; E - dwcoord 4, 6, 3, 6 ; F - dwcoord 4, 5, 3, 5 ; G - dwcoord 4, 4, 3, 4 ; H - dwcoord 4, 3, 3, 2 ; I - dwcoord 5, 3, 5, 2 ; J - dwcoord 6, 3, 6, 2 ; K - dwcoord 7, 3, 7, 2 ; L - dwcoord 8, 3, 8, 2 ; M - dwcoord 9, 3, 9, 2 ; N - dwcoord 10, 3, 10, 2 ; O - dwcoord 11, 3, 11, 2 ; P - dwcoord 12, 3, 12, 2 ; Q - dwcoord 13, 3, 13, 2 ; R - dwcoord 14, 3, 15, 2 ; S - dwcoord 14, 4, 15, 4 ; T - dwcoord 14, 5, 15, 5 ; U - dwcoord 14, 6, 15, 6 ; V - dwcoord 14, 7, 15, 7 ; W - dwcoord 14, 8, 15, 8 ; X - dwcoord 14, 9, 15, 9 ; Y - dwcoord 14,10, 15,10 ; Z - -Pokedex_FillBackgroundColor2: ; 40aa6 - hlcoord 0, 0 - ld a, $32 - ld bc, SCREEN_WIDTH * SCREEN_HEIGHT - call ByteFill - ret - -Pokedex_PlaceFrontpicTopLeftCorner: ; 40ab2 - hlcoord 1, 1 -Pokedex_PlaceFrontpicAtHL: ; 40ab5 - xor a - ld b, $7 -.row - ld c, $7 - push af - push hl -.col - ld [hli], a - add $7 - dec c - jr nz, .col - pop hl - ld de, SCREEN_WIDTH - add hl, de - pop af - inc a - dec b - jr nz, .row - ret - -Pokedex_PlaceString: ; 40acd -.loop - ld a, [de] - cp -1 - ret z - inc de - ld [hli], a - jr .loop - - -Pokedex_PlaceBorder: ; 40ad5 - push hl - ld a, $33 - ld [hli], a - ld d, $34 - call .FillRow - ld a, $35 - ld [hl], a - pop hl - ld de, SCREEN_WIDTH - add hl, de -.loop - push hl - ld a, $36 - ld [hli], a - ld d, $7f - call .FillRow - ld a, $37 - ld [hl], a - pop hl - ld de, SCREEN_WIDTH - add hl, de - dec b - jr nz, .loop - ld a, $38 - ld [hli], a - ld d, $39 - call .FillRow - ld a, $3a - ld [hl], a - ret - -.FillRow: ; 40b06 - ld e, c -.row_loop - ld a, e - and a - ret z - ld a, d - ld [hli], a - dec e - jr .row_loop - - -Pokedex_PrintListing: ; 40b0f (10:4b0f) -; Prints the list of Pokémon on the main Pokédex screen. - -; This check is completely useless. - ld a, [wCurrentDexMode] - cp DEXMODE_OLD - jr z, .okay - ld c, 11 - jr .resume -.okay - ld c, 11 -; End useless check - -.resume -; Clear (2 * [wDexListingHeight] + 1) by 11 box starting at 0,1 - hlcoord 0, 1 - ld a, [wDexListingHeight] - add a - inc a - ld b, a - ld a, " " - call Pokedex_FillBox - -; Load de with wPokedexOrder + [wDexListingScrollOffset] - ld a, [wDexListingScrollOffset] - ld e, a - ld d, $0 - ld hl, wPokedexOrder - add hl, de - ld e, l - ld d, h - hlcoord 0, 2 - ld a, [wDexListingHeight] -.loop - push af - ld a, [de] - ld [wd265], a - push de - push hl - call .PrintEntry - pop hl - ld de, 2 * SCREEN_WIDTH - add hl, de - pop de - inc de - pop af - dec a - jr nz, .loop - call Pokedex_LoadSelectedMonTiles - ret - -.PrintEntry: ; 40b55 (10:4b55) -; Prints one entry in the list of Pokémon on the main Pokédex screen. - and a - ret z - call Pokedex_PrintNumberIfOldMode - call Pokedex_PlaceDefaultStringIfNotSeen - ret c - call Pokedex_PlaceCaughtSymbolIfCaught - push hl - call GetPokemonName - pop hl - call PlaceString - ret - -Pokedex_PrintNumberIfOldMode: ; 40b6a (10:4b6a) - ld a, [wCurrentDexMode] - cp DEXMODE_OLD - jr z, .printnum - ret - -.printnum - push hl - ld de, -SCREEN_WIDTH - add hl, de - ld de, wd265 - lb bc, PRINTNUM_LEADINGZEROS | 1, 3 - call PrintNum - pop hl - ret - -Pokedex_PlaceCaughtSymbolIfCaught: ; 40b82 (10:4b82) - call Pokedex_CheckCaught - jr nz, .place_caught_symbol - inc hl - ret - -.place_caught_symbol - ld a, $4f - ld [hli], a - ret - -Pokedex_PlaceDefaultStringIfNotSeen: ; 40b8d (10:4b8d) - call Pokedex_CheckSeen - ret nz - inc hl - ld de, .NameNotSeen - call PlaceString - scf - ret - -.NameNotSeen: ; 40b9a - db "-----@" - -Pokedex_DrawFootprint: ; 40ba0 - hlcoord 18, 1 - ld a, $62 - ld [hli], a - inc a - ld [hl], a - hlcoord 18, 2 - ld a, $64 - ld [hli], a - inc a - ld [hl], a - ret - - -Pokedex_GetSelectedMon: ; 40bb1 -; Gets the species of the currently selected Pokémon. This corresponds to the -; position of the cursor in the main listing, but this function can be used -; on all Pokédex screens. - ld a, [wDexListingCursor] - ld hl, wDexListingScrollOffset - add [hl] - ld e, a - ld d, $0 - ld hl, wPokedexOrder - add hl, de - ld a, [hl] - ld [wd265], a - ret - - -Pokedex_CheckCaught: ; 40bc4 (10:4bc4) - push de - push hl - ld a, [wd265] - dec a - call CheckCaughtMon - pop hl - pop de - ret - - -Pokedex_CheckSeen: ; 40bd0 - push de - push hl - ld a, [wd265] - dec a - call CheckSeenMon - pop hl - pop de - ret - - - -Pokedex_OrderMonsByMode: ; 40bdc - ld hl, wPokedexOrder - ld bc, wPokedexOrderEnd - wPokedexOrder - xor a - call ByteFill - ld a, [wCurrentDexMode] - ld hl, .Jumptable - call Pokedex_LoadPointer - jp hl - -.Jumptable: ; 40bf0 (10:4bf0) - dw .NewMode - dw .OldMode - dw Pokedex_ABCMode - -.NewMode: ; 40bf6 (10:4bf6) - ld de, NewPokedexOrder - ld hl, wPokedexOrder - ld c, NUM_POKEMON -.loopnew - ld a, [de] - inc de - ld [hli], a - dec c - jr nz, .loopnew - call .FindLastSeen - ret - -.OldMode: ; 40c08 (10:4c08) - ld hl, wPokedexOrder - ld a, $1 - ld c, NUM_POKEMON -.loopold - ld [hli], a - inc a - dec c - jr nz, .loopold - call .FindLastSeen - ret - -.FindLastSeen: ; 40c18 (10:4c18) - ld hl, wPokedexOrder + NUM_POKEMON - 1 - ld d, NUM_POKEMON - ld e, d -.loopfindend - ld a, [hld] - ld [wd265], a - call Pokedex_CheckSeen - jr nz, .foundend - dec d - dec e - jr nz, .loopfindend -.foundend - ld a, d - ld [wDexListingEnd], a - ret - -Pokedex_ABCMode: ; 40c30 - xor a - ld [wDexListingEnd], a - ld hl, wPokedexOrder - ld de, AlphabeticalPokedexOrder - ld c, NUM_POKEMON -.loop1abc - push bc - ld a, [de] - ld [wd265], a - call Pokedex_CheckSeen - jr z, .skipabc - ld a, [wd265] - ld [hli], a - ld a, [wDexListingEnd] - inc a - ld [wDexListingEnd], a - -.skipabc - inc de - pop bc - dec c - jr nz, .loop1abc - ld a, [wDexListingEnd] - ld c, 0 -.loop2abc - cp NUM_POKEMON - jr z, .doneabc - ld [hl], c - inc hl - inc a - jr .loop2abc - -.doneabc - ret - - -INCLUDE "data/pokemon/dex_order_alpha.asm" - -INCLUDE "data/pokemon/dex_order_new.asm" - - -Pokedex_DisplayModeDescription: ; 40e5b - xor a - ld [hBGMapMode], a - hlcoord 0, 12 - lb bc, 4, 18 - call Pokedex_PlaceBorder - ld a, [wDexArrowCursorPosIndex] - ld hl, .Modes - call Pokedex_LoadPointer - ld e, l - ld d, h - hlcoord 1, 14 - call PlaceString - ld a, $1 - ld [hBGMapMode], a - ret - -.Modes: ; 40e7d - dw .NewMode - dw .OldMode - dw .ABCMode - dw .UnownMode - -.NewMode: ; 40e85 - db " are listed by" - next "evolution type.@" - -.OldMode: ; 40ea6 - db " are listed by" - next "official type.@" - -.ABCMode: ; 40ec6 - db " are listed" - next "alphabetically.@" - -.UnownMode: ; 40ee4 - db "UNOWN are listed" - next "in catching order.@" - -Pokedex_DisplayChangingModesMessage: ; 40f08 (10:4f08) - xor a - ld [hBGMapMode], a - hlcoord 0, 12 - lb bc, 4, 18 - call Pokedex_PlaceBorder - ld de, String_ChangingModesPleaseWait - hlcoord 1, 14 - call PlaceString - ld a, $1 - ld [hBGMapMode], a - ld c, 64 - call DelayFrames - ld de, SFX_CHANGE_DEX_MODE - call PlaySFX - ld c, 64 - call DelayFrames - ret - -String_ChangingModesPleaseWait: ; 40f32 - db "Changing modes." - next "Please wait.@" - -Pokedex_UpdateSearchMonType: ; 40f4f (10:4f4f) - ld a, [wDexArrowCursorPosIndex] - cp 2 - jr nc, .no_change - ld hl, hJoyLast - ld a, [hl] - and D_LEFT - jr nz, Pokedex_PrevSearchMonType - ld a, [hl] - and D_RIGHT - jr nz, Pokedex_NextSearchMonType -.no_change - and a - ret - -Pokedex_PrevSearchMonType: ; 40f65 - ld a, [wDexArrowCursorPosIndex] - and a - jr nz, .type2 - - ld hl, wDexSearchMonType1 - ld a, [hl] - cp 1 - jr z, .wrap_around - dec [hl] - jr .done - -.type2 - ld hl, wDexSearchMonType2 - ld a, [hl] - and a - jr z, .wrap_around - dec [hl] - jr .done - -.wrap_around - ld [hl], NUM_TYPES - 1 - -.done - scf - ret - -Pokedex_NextSearchMonType: ; 40f84 - ld a, [wDexArrowCursorPosIndex] - and a - jr nz, .type2 - - ld hl, wDexSearchMonType1 - ld a, [hl] - cp NUM_TYPES - 1 - jr nc, .type1_wrap_around - inc [hl] - jr .done -.type1_wrap_around - ld [hl], 1 - jr .done - -.type2 - ld hl, wDexSearchMonType2 - ld a, [hl] - cp NUM_TYPES - 1 - jr nc, .type2_wrap_around - inc [hl] - jr .done -.type2_wrap_around - ld [hl], 0 - -.done - scf - ret - -Pokedex_PlaceSearchScreenTypeStrings: ; 40fa8 (10:4fa8) - xor a - ld [hBGMapMode], a - hlcoord 9, 3 - lb bc, 4, 8 - ld a, " " - call Pokedex_FillBox - ld a, [wDexSearchMonType1] - hlcoord 9, 4 - call Pokedex_PlaceTypeString - ld a, [wDexSearchMonType2] - hlcoord 9, 6 - call Pokedex_PlaceTypeString - ld a, $1 - ld [hBGMapMode], a - ret - -Pokedex_PlaceTypeString: ; 40fcd (10:4fcd) - push hl - ld e, a - ld d, 0 - ld hl, PokedexTypeSearchStrings -rept 9 - add hl, de -endr - ld e, l - ld d, h - pop hl - call PlaceString - ret - -INCLUDE "data/types/search_strings.asm" - -Pokedex_SearchForMons: ; 41086 - ld a, [wDexSearchMonType2] - and a - call nz, .Search - ld a, [wDexSearchMonType1] - and a - call nz, .Search - ret - -.Search: ; 41095 - dec a - ld e, a - ld d, 0 - ld hl, PokedexTypeSearchConversionTable - add hl, de - ld a, [hl] - ld [wDexConvertedMonType], a - ld hl, wPokedexOrder - ld de, wPokedexOrder - ld c, NUM_POKEMON - xor a - ld [wDexSearchResultCount], a -.loop - push bc - ld a, [hl] - and a - jr z, .next_mon - ld [wd265], a - ld [CurSpecies], a - call Pokedex_CheckCaught - jr z, .next_mon - push hl - push de - call GetBaseData - pop de - pop hl - ld a, [wDexConvertedMonType] - ld b, a - ld a, [BaseType1] - cp b - jr z, .match_found - ld a, [BaseType2] - cp b - jr nz, .next_mon - -.match_found - ld a, [wd265] - ld [de], a - inc de - ld a, [wDexSearchResultCount] - inc a - ld [wDexSearchResultCount], a - -.next_mon - inc hl - pop bc - dec c - jr nz, .loop - - ld l, e - ld h, d - ld a, [wDexSearchResultCount] - ld c, 0 - -.zero_remaining_mons - cp NUM_POKEMON - jr z, .done - ld [hl], c - inc hl - inc a - jr .zero_remaining_mons - -.done - ret - -INCLUDE "data/types/search_types.asm" - -Pokedex_DisplayTypeNotFoundMessage: ; 41107 - xor a - ld [hBGMapMode], a - hlcoord 0, 12 - lb bc, 4, 18 - call Pokedex_PlaceBorder - ld de, .TypeNotFound - hlcoord 1, 14 - call PlaceString - ld a, $1 - ld [hBGMapMode], a - ld c, $80 - call DelayFrames - ret - -.TypeNotFound: ; 41126 - db "The specified type" - next "was not found.@" - -Pokedex_UpdateCursorOAM: ; 41148 (10:5148) - ld a, [wCurrentDexMode] - cp DEXMODE_OLD - jp z, Pokedex_PutOldModeCursorOAM - call Pokedex_PutNewModeABCModeCursorOAM - call Pokedex_PutScrollbarOAM - ret - -Pokedex_PutOldModeCursorOAM: ; 41157 (10:5157) - ld hl, .CursorOAM - ld a, [wDexListingCursor] - or a - jr nz, .okay - ld hl, .CursorAtTopOAM -.okay - call Pokedex_LoadCursorOAM - ret - -.CursorOAM: ; 41167 - dsprite 3, 0, 9, -1, $30, 7 - dsprite 2, 0, 9, -1, $31, 7 - dsprite 2, 0, 10, -1, $32, 7 - dsprite 2, 0, 11, -1, $32, 7 - dsprite 2, 0, 12, -1, $32, 7 - dsprite 2, 0, 13, -1, $33, 7 - dsprite 2, 0, 16, -2, $33, 7 | X_FLIP - dsprite 2, 0, 17, -2, $32, 7 | X_FLIP - dsprite 2, 0, 18, -2, $32, 7 | X_FLIP - dsprite 2, 0, 19, -2, $32, 7 | X_FLIP - dsprite 2, 0, 20, -2, $31, 7 | X_FLIP - dsprite 3, 0, 20, -2, $30, 7 | X_FLIP - dsprite 4, 0, 9, -1, $30, 7 | Y_FLIP - dsprite 5, 0, 9, -1, $31, 7 | Y_FLIP - dsprite 5, 0, 10, -1, $32, 7 | Y_FLIP - dsprite 5, 0, 11, -1, $32, 7 | Y_FLIP - dsprite 5, 0, 12, -1, $32, 7 | Y_FLIP - dsprite 5, 0, 13, -1, $33, 7 | Y_FLIP - dsprite 5, 0, 16, -2, $33, 7 | X_FLIP | Y_FLIP - dsprite 5, 0, 17, -2, $32, 7 | X_FLIP | Y_FLIP - dsprite 5, 0, 18, -2, $32, 7 | X_FLIP | Y_FLIP - dsprite 5, 0, 19, -2, $32, 7 | X_FLIP | Y_FLIP - dsprite 5, 0, 20, -2, $31, 7 | X_FLIP | Y_FLIP - dsprite 4, 0, 20, -2, $30, 7 | X_FLIP | Y_FLIP - db -1 - -.CursorAtTopOAM: ; 411c8 -; OAM data for when the cursor is at the top of the list. The tiles at the top -; are cut off so they don't show up outside the list area. - dsprite 3, 0, 9, -1, $30, 7 - dsprite 2, 0, 9, -1, $34, 7 - dsprite 2, 0, 10, -1, $35, 7 - dsprite 2, 0, 11, -1, $35, 7 - dsprite 2, 0, 12, -1, $35, 7 - dsprite 2, 0, 13, -1, $36, 7 - dsprite 2, 0, 16, -2, $36, 7 | X_FLIP - dsprite 2, 0, 17, -2, $35, 7 | X_FLIP - dsprite 2, 0, 18, -2, $35, 7 | X_FLIP - dsprite 2, 0, 19, -2, $35, 7 | X_FLIP - dsprite 2, 0, 20, -2, $34, 7 | X_FLIP - dsprite 3, 0, 20, -2, $30, 7 | X_FLIP - dsprite 4, 0, 9, -1, $30, 7 | Y_FLIP - dsprite 5, 0, 9, -1, $31, 7 | Y_FLIP - dsprite 5, 0, 10, -1, $32, 7 | Y_FLIP - dsprite 5, 0, 11, -1, $32, 7 | Y_FLIP - dsprite 5, 0, 12, -1, $32, 7 | Y_FLIP - dsprite 5, 0, 13, -1, $33, 7 | Y_FLIP - dsprite 5, 0, 16, -2, $33, 7 | X_FLIP | Y_FLIP - dsprite 5, 0, 17, -2, $32, 7 | X_FLIP | Y_FLIP - dsprite 5, 0, 18, -2, $32, 7 | X_FLIP | Y_FLIP - dsprite 5, 0, 19, -2, $32, 7 | X_FLIP | Y_FLIP - dsprite 5, 0, 20, -2, $31, 7 | X_FLIP | Y_FLIP - dsprite 4, 0, 20, -2, $30, 7 | X_FLIP | Y_FLIP - db -1 - -Pokedex_PutNewModeABCModeCursorOAM: ; 41229 (10:5229) - ld hl, .CursorOAM - call Pokedex_LoadCursorOAM - ret - -.CursorOAM: ; 41230 - dsprite 3, 3, 9, -1, $30, 7 - dsprite 2, 3, 9, -1, $31, 7 - dsprite 2, 3, 10, -1, $32, 7 - dsprite 2, 3, 11, -1, $32, 7 - dsprite 2, 3, 12, -1, $33, 7 - dsprite 2, 3, 16, 0, $33, 7 | X_FLIP - dsprite 2, 3, 17, 0, $32, 7 | X_FLIP - dsprite 2, 3, 18, 0, $32, 7 | X_FLIP - dsprite 2, 3, 19, 0, $31, 7 | X_FLIP - dsprite 3, 3, 19, 0, $30, 7 | X_FLIP - dsprite 4, 3, 9, -1, $30, 7 | Y_FLIP - dsprite 5, 3, 9, -1, $31, 7 | Y_FLIP - dsprite 5, 3, 10, -1, $32, 7 | Y_FLIP - dsprite 5, 3, 11, -1, $32, 7 | Y_FLIP - dsprite 5, 3, 12, -1, $33, 7 | Y_FLIP - dsprite 5, 3, 16, 0, $33, 7 | X_FLIP | Y_FLIP - dsprite 5, 3, 17, 0, $32, 7 | X_FLIP | Y_FLIP - dsprite 5, 3, 18, 0, $32, 7 | X_FLIP | Y_FLIP - dsprite 5, 3, 19, 0, $31, 7 | X_FLIP | Y_FLIP - dsprite 4, 3, 19, 0, $30, 7 | X_FLIP | Y_FLIP - db -1 - -Pokedex_UpdateSearchResultsCursorOAM: ; 41281 (10:5281) - ld a, [wCurrentDexMode] - cp DEXMODE_OLD - jp z, Pokedex_PutOldModeCursorOAM - ld hl, .CursorOAM - call Pokedex_LoadCursorOAM - ret - -.CursorOAM: ; 41290 - dsprite 3, 3, 9, -1, $30, 7 - dsprite 2, 3, 9, -1, $31, 7 - dsprite 2, 3, 10, -1, $32, 7 - dsprite 2, 3, 11, -1, $32, 7 - dsprite 2, 3, 12, -1, $32, 7 - dsprite 2, 3, 13, -1, $33, 7 - dsprite 2, 3, 16, -2, $33, 7 | X_FLIP - dsprite 2, 3, 17, -2, $32, 7 | X_FLIP - dsprite 2, 3, 18, -2, $32, 7 | X_FLIP - dsprite 2, 3, 19, -2, $32, 7 | X_FLIP - dsprite 2, 3, 20, -2, $31, 7 | X_FLIP - dsprite 3, 3, 20, -2, $30, 7 | X_FLIP - dsprite 4, 3, 9, -1, $30, 7 | Y_FLIP - dsprite 5, 3, 9, -1, $31, 7 | Y_FLIP - dsprite 5, 3, 10, -1, $32, 7 | Y_FLIP - dsprite 5, 3, 11, -1, $32, 7 | Y_FLIP - dsprite 5, 3, 12, -1, $32, 7 | Y_FLIP - dsprite 5, 3, 13, -1, $33, 7 | Y_FLIP - dsprite 5, 3, 16, -2, $33, 7 | X_FLIP | Y_FLIP - dsprite 5, 3, 17, -2, $32, 7 | X_FLIP | Y_FLIP - dsprite 5, 3, 18, -2, $32, 7 | X_FLIP | Y_FLIP - dsprite 5, 3, 19, -2, $32, 7 | X_FLIP | Y_FLIP - dsprite 5, 3, 20, -2, $31, 7 | X_FLIP | Y_FLIP - dsprite 4, 3, 20, -2, $30, 7 | X_FLIP | Y_FLIP - db -1 - -Pokedex_LoadCursorOAM: ; 412f1 (10:52f1) - ld de, Sprite01 -.loop - ld a, [hl] - cp -1 - ret z - ld a, [wDexListingCursor] - and $7 - swap a - add [hl] ; y - inc hl - ld [de], a - inc de - ld a, [hli] ; x - ld [de], a - inc de - ld a, [hli] ; tile id - ld [de], a - inc de - ld a, [hli] ; attributes - ld [de], a - inc de - jr .loop - -Pokedex_PutScrollbarOAM: ; 4130e (10:530e) -; Writes the OAM data for the scrollbar in the new mode and ABC mode. - push de - ld a, [wDexListingEnd] - dec a - ld e, a - ld a, [wDexListingCursor] - ld hl, wDexListingScrollOffset - add [hl] - cp e - jr z, .asm_4133f - ld hl, $0 - ld bc, $79 - call AddNTimes - ld e, l - ld d, h - ld b, $0 - ld a, d - or e - jr z, .asm_41341 - ld a, [wDexListingEnd] - ld c, a -.asm_41333 - ld a, e - sub c - ld e, a - ld a, d - sbc $0 - ld d, a - jr c, .asm_41341 - inc b - jr .asm_41333 -.asm_4133f - ld b, $79 -.asm_41341 - ld a, $14 - add b - pop hl - ld [hli], a - ld a, $a1 - ld [hli], a - ld a, $f - ld [hli], a - ld [hl], $0 - ret - -Pokedex_InitArrowCursor: ; 4134f (10:534f) - xor a - ld [wDexArrowCursorPosIndex], a - ld [wDexArrowCursorDelayCounter], a - ld [wDexArrowCursorBlinkCounter], a - ret - -Pokedex_MoveArrowCursor: ; 4135a (10:535a) -; bc = [de] - 1 - ld a, [de] - ld b, a - inc de - ld a, [de] - dec a - ld c, a - inc de - call Pokedex_BlinkArrowCursor - - ld hl, hJoyPressed - ld a, [hl] - and D_LEFT | D_UP - and b - jr nz, .move_left_or_up - ld a, [hl] - and D_RIGHT | D_DOWN - and b - jr nz, .move_right_or_down - ld a, [hl] - and SELECT - and b - jr nz, .select - call Pokedex_ArrowCursorDelay - jr c, .no_action - ld hl, hJoyLast - ld a, [hl] - and D_LEFT | D_UP - and b - jr nz, .move_left_or_up - ld a, [hl] - and D_RIGHT | D_DOWN - and b - jr nz, .move_right_or_down - jr .no_action - -.move_left_or_up - ld a, [wDexArrowCursorPosIndex] - and a - jr z, .no_action - call Pokedex_GetArrowCursorPos - ld [hl], " " - ld hl, wDexArrowCursorPosIndex - dec [hl] - jr .update_cursor_pos - -.move_right_or_down - ld a, [wDexArrowCursorPosIndex] - cp c - jr nc, .no_action - call Pokedex_GetArrowCursorPos - ld [hl], " " - ld hl, wDexArrowCursorPosIndex - inc [hl] - -.update_cursor_pos - call Pokedex_GetArrowCursorPos - ld [hl], "▶" - ld a, 12 - ld [wDexArrowCursorDelayCounter], a - xor a - ld [wDexArrowCursorBlinkCounter], a - scf - ret - -.no_action - and a - ret - -.select - call Pokedex_GetArrowCursorPos - ld [hl], " " - ld a, [wDexArrowCursorPosIndex] - cp c - jr c, .update - ld a, -1 -.update - inc a - ld [wDexArrowCursorPosIndex], a - jr .update_cursor_pos - -Pokedex_GetArrowCursorPos: ; 413d4 (10:53d4) - ld a, [wDexArrowCursorPosIndex] - add a - ld l, a - ld h, 0 - add hl, de - ld a, [hli] - ld h, [hl] - ld l, a - ret - -Pokedex_BlinkArrowCursor: ; 413e0 (10:53e0) - ld hl, wDexArrowCursorBlinkCounter - ld a, [hl] - inc [hl] - and $8 - jr z, .blink_on - call Pokedex_GetArrowCursorPos - ld [hl], " " - ret - -.blink_on - call Pokedex_GetArrowCursorPos - ld [hl], "▶" - ret - -Pokedex_ArrowCursorDelay: ; 413f5 (10:53f5) -; Updates the delay counter set when moving the arrow cursor. -; Returns whether the delay is active in carry. - ld hl, wDexArrowCursorDelayCounter - ld a, [hl] - and a - ret z - - dec [hl] - scf - ret - -Pokedex_FillBox: ; 413fe (10:53fe) - jp FillBoxWithByte - -Pokedex_BlackOutBG: ; 41401 (10:5401) -; Make BG palettes black so that the BG becomes all black. - ld a, [rSVBK] - push af - ld a, BANK(wBGPals1) - ld [rSVBK], a - ld hl, wBGPals1 - ld bc, 8 palettes - xor a - call ByteFill - pop af - ld [rSVBK], a - -Pokedex_ApplyPrintPals: ; 41415 - ld a, $ff - call DmgToCgbBGPals - ld a, $ff - call DmgToCgbObjPal0 - call DelayFrame - ret - -Pokedex_GetSGBLayout: ; 41423 - ld b, a - call GetSGBLayout - -Pokedex_ApplyUsualPals: ; 41427 -; This applies the palettes used for most Pokédex screens. - ld a, $e4 - call DmgToCgbBGPals - ld a, $e0 - call DmgToCgbObjPal0 - ret - - -Pokedex_LoadPointer: ; 41432 - ld e, a - ld d, 0 - add hl, de - add hl, de - ld a, [hli] - ld h, [hl] - ld l, a - ret - -Pokedex_LoadSelectedMonTiles: ; 4143b -; Loads the tiles of the currently selected Pokémon. - call Pokedex_GetSelectedMon - call Pokedex_CheckSeen - jr z, .QuestionMark - ld a, [wFirstUnownSeen] - ld [UnownLetter], a - ld a, [wd265] - ld [CurPartySpecies], a - call GetBaseData - ld de, vTiles2 - predef GetMonFrontpic - ret - -.QuestionMark: - ld a, BANK(sScratch) - call GetSRAMBank - farcall LoadQuestionMarkPic - ld hl, vTiles2 - ld de, sScratch - ld c, 7 * 7 - ld a, [hROMBank] - ld b, a - call Get2bpp - call CloseSRAM - ret - - -Pokedex_LoadCurrentFootprint: ; 41478 (10:5478) - call Pokedex_GetSelectedMon - -Pokedex_LoadAnyFootprint: ; 4147b - ld a, [wd265] - dec a - and %11111000 - srl a - srl a - srl a - ld e, 0 - ld d, a - ld a, [wd265] - dec a - and %111 - swap a ; * $10 - ld l, a - ld h, 0 - add hl, de - ld de, Footprints - add hl, de - - push hl - ld e, l - ld d, h - ld hl, vTiles2 tile $62 - lb bc, BANK(Footprints), 2 - call Request1bpp - pop hl - - ; Whoever was editing footprints forgot to fix their - ; tile editor. Now each bottom half is 8 tiles off. - ld de, 8 tiles - add hl, de - - ld e, l - ld d, h - ld hl, vTiles2 tile $64 - lb bc, BANK(Footprints), 2 - call Request1bpp - - ret - - -Pokedex_LoadGFX: ; 414b7 - call DisableLCD - ld hl, vTiles2 - ld bc, $31 tiles - xor a - call ByteFill - call Pokedex_LoadInvertedFont - call LoadFontsExtra - ld hl, vTiles2 tile $60 - ld bc, $20 tiles - call Pokedex_InvertTiles - call Pokedex_CheckSGB - jr nz, .LoadPokedexLZ - farcall LoadSGBPokedexGFX - jr .LoadPokedexSlowpokeLZ - -.LoadPokedexLZ: - ld hl, PokedexLZ - ld de, vTiles2 tile $31 - call Decompress - -.LoadPokedexSlowpokeLZ: - ld hl, PokedexSlowpokeLZ - ld de, vTiles0 - call Decompress - ld a, 6 - call SkipMusic - call EnableLCD - ret - -Pokedex_LoadInvertedFont: ; 414fb - call LoadStandardFont - ld hl, vTiles1 - ld bc, $80 tiles - -Pokedex_InvertTiles: ; 41504 -.loop - ld a, [hl] - xor $ff - ld [hli], a - dec bc - ld a, b - or c - jr nz, .loop - ret - -PokedexLZ: ; 4150e -INCBIN "gfx/pokedex/pokedex.2bpp.lz" - -PokedexSlowpokeLZ: ; 416b0 -INCBIN "gfx/pokedex/slowpoke.2bpp.lz" - -Pokedex_CheckSGB: ; 41a24 - ld a, [hCGB] - or a - ret nz - ld a, [hSGB] - dec a - ret - -Pokedex_LoadUnownFont: ; 41a2c - ld a, BANK(sScratch) - call GetSRAMBank - ld hl, UnownFont - ld de, sScratch + $188 - ld bc, 39 tiles - ld a, BANK(UnownFont) - call FarCopyBytes - ld hl, sScratch + $188 - ld bc, 27 tiles - call Pokedex_InvertTiles - ld de, sScratch + $188 - ld hl, vTiles2 tile $40 - lb bc, BANK(Pokedex_LoadUnownFont), 27 - call Request2bpp - call CloseSRAM - ret - -Pokedex_LoadUnownFrontpicTiles: ; 41a58 (10:5a58) - ld a, [UnownLetter] - push af - ld a, [wDexCurrentUnownIndex] - ld e, a - ld d, 0 - ld hl, UnownDex - add hl, de - ld a, [hl] - ld [UnownLetter], a - ld a, UNOWN - ld [CurPartySpecies], a - call GetBaseData - ld de, vTiles2 tile $00 - predef GetMonFrontpic - pop af - ld [UnownLetter], a - ret - -_NewPokedexEntry: ; 41a7f - xor a - ld [hBGMapMode], a - farcall DrawDexEntryScreenRightEdge - call Pokedex_ResetBGMapMode - call DisableLCD - call LoadStandardFont - call LoadFontsExtra - call Pokedex_LoadGFX - call Pokedex_LoadAnyFootprint - ld a, [wd265] - ld [CurPartySpecies], a - call Pokedex_DrawDexEntryScreenBG - call Pokedex_DrawFootprint - hlcoord 0, 17 - ld [hl], $3b - inc hl - ld bc, 19 - ld a, " " - call ByteFill - farcall DisplayDexEntry - call EnableLCD - call WaitBGMap - call GetBaseData - ld de, vTiles2 - predef GetMonFrontpic - ld a, SCGB_POKEDEX - call Pokedex_GetSGBLayout - ld a, [CurPartySpecies] - call PlayMonCry - ret - - -Pokedex_SetBGMapMode3: ; 41ad7 (10:5ad7) - ld a, $3 - ld [hBGMapMode], a - ld c, 4 - call DelayFrames - ret - -Pokedex_SetBGMapMode4: ; 41ae1 (10:5ae1) - ld a, $4 - ld [hBGMapMode], a - ld c, 4 - call DelayFrames - ret - -Pokedex_SetBGMapMode_3ifDMG_4ifCGB: ; 41aeb (10:5aeb) - ld a, [hCGB] - and a - jr z, .DMG - call Pokedex_SetBGMapMode4 -.DMG: - call Pokedex_SetBGMapMode3 - ret - - -Pokedex_ResetBGMapMode: ; 41af7 - xor a - ld [hBGMapMode], a - ret diff --git a/engine/pokedex/newpokedexentry.asm b/engine/pokedex/newpokedexentry.asm new file mode 100644 index 000000000..d6b755200 --- /dev/null +++ b/engine/pokedex/newpokedexentry.asm @@ -0,0 +1,52 @@ +NewPokedexEntry: ; fb877 + ld a, [hMapAnims] + push af + xor a + ld [hMapAnims], a + call LowVolume + call ClearBGPalettes + call ClearTileMap + call UpdateSprites + call ClearSprites + ld a, [wPokedexStatus] + push af + ld a, [hSCX] + add POKEDEX_SCX + ld [hSCX], a + xor a + ld [wPokedexStatus], a + farcall _NewPokedexEntry + call WaitPressAorB_BlinkCursor + ld a, 1 ; page 2 + ld [wPokedexStatus], a + farcall DisplayDexEntry + call WaitPressAorB_BlinkCursor + pop af + ld [wPokedexStatus], a + call MaxVolume + call RotateThreePalettesRight + ld a, [hSCX] + add -POKEDEX_SCX + ld [hSCX], a + call .ReturnFromDexRegistration + pop af + ld [hMapAnims], a + ret +; fb8c8 + +.ReturnFromDexRegistration: ; fb8c8 + call ClearTileMap + call LoadFontsExtra + call LoadStandardFont + farcall Pokedex_PlaceFrontpicTopLeftCorner + call WaitBGMap2 + farcall GetEnemyMonDVs + ld a, [hli] + ld [TempMonDVs], a + ld a, [hl] + ld [TempMonDVs + 1], a + ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS + call GetSGBLayout + call SetPalettes + ret +; fb8f1 diff --git a/engine/pokedex/pokedex.asm b/engine/pokedex/pokedex.asm new file mode 100644 index 000000000..e96d0a7d7 --- /dev/null +++ b/engine/pokedex/pokedex.asm @@ -0,0 +1,2592 @@ +; Pokedex_RunJumptable.Jumptable indexes + const_def + const DEXSTATE_MAIN_SCR + const DEXSTATE_UPDATE_MAIN_SCR + const DEXSTATE_DEX_ENTRY_SCR + const DEXSTATE_UPDATE_DEX_ENTRY_SCR + const DEXSTATE_REINIT_DEX_ENTRY_SCR + const DEXSTATE_SEARCH_SCR + const DEXSTATE_UPDATE_SEARCH_SCR + const DEXSTATE_OPTION_SCR + const DEXSTATE_UPDATE_OPTION_SCR + const DEXSTATE_SEARCH_RESULTS_SCR + const DEXSTATE_UPDATE_SEARCH_RESULTS_SCR + const DEXSTATE_UNOWN_MODE + const DEXSTATE_UPDATE_UNOWN_MODE + const DEXSTATE_EXIT + +POKEDEX_SCX EQU 5 +GLOBAL POKEDEX_SCX + +Pokedex: ; 40000 + + ld a, [hWX] + ld l, a + ld a, [hWY] + ld h, a + push hl + ld a, [hSCX] + push af + ld hl, Options + ld a, [hl] + push af + set NO_TEXT_SCROLL, [hl] + ld a, [VramState] + push af + xor a + ld [VramState], a + ld a, [hInMenu] + push af + ld a, $1 + ld [hInMenu], a + + xor a + ld [hMapAnims], a + call InitPokedex + call DelayFrame + +.main + call JoyTextDelay + ld a, [wJumptableIndex] + bit 7, a + jr nz, .exit + call Pokedex_RunJumptable + call DelayFrame + jr .main + +.exit + ld de, SFX_READ_TEXT_2 + call PlaySFX + call WaitSFX + call ClearSprites + ld a, [wCurrentDexMode] + ld [wLastDexMode], a + + pop af + ld [hInMenu], a + pop af + ld [VramState], a + pop af + ld [Options], a + pop af + ld [hSCX], a + pop hl + ld a, l + ld [hWX], a + ld a, h + ld [hWY], a + ret + +InitPokedex: ; 40063 + call ClearBGPalettes + call ClearSprites + call ClearTileMap + call Pokedex_LoadGFX + + ld hl, wPokedexDataStart + ld bc, wPokedexDataEnd - wPokedexDataStart + xor a + call ByteFill + + xor a + ld [wJumptableIndex], a + ld [wPrevDexEntryJumptableIndex], a + ld [wPrevDexEntryBackup], a + ld [wcf66], a + + call Pokedex_CheckUnlockedUnownMode + + ld a, [wLastDexMode] + ld [wCurrentDexMode], a + + call Pokedex_OrderMonsByMode + call Pokedex_InitCursorPosition + call Pokedex_GetLandmark + farcall DrawDexEntryScreenRightEdge + call Pokedex_ResetBGMapMode + ret + +Pokedex_CheckUnlockedUnownMode: ; 400a2 + ld a, [wStatusFlags] + bit 1, a + jr nz, .unlocked + + xor a + ld [wUnlockedUnownMode], a + ret + +.unlocked + ld a, TRUE + ld [wUnlockedUnownMode], a + ret + +Pokedex_InitCursorPosition: ; 400b4 + ld hl, wPokedexOrder + ld a, [wPrevDexEntry] + and a + jr z, .done + cp NUM_POKEMON + 1 + jr nc, .done + + ld b, a + ld a, [wDexListingEnd] + cp $8 + jr c, .only_one_page + + sub $7 + ld c, a +.loop1 + ld a, b + cp [hl] + jr z, .done + inc hl + ld a, [wDexListingScrollOffset] + inc a + ld [wDexListingScrollOffset], a + dec c + jr nz, .loop1 + +.only_one_page + ld c, $7 +.loop2 + ld a, b + cp [hl] + jr z, .done + inc hl + ld a, [wDexListingCursor] + inc a + ld [wDexListingCursor], a + dec c + jr nz, .loop2 + +.done + ret + +Pokedex_GetLandmark: ; 400ed + ld a, [MapGroup] + ld b, a + ld a, [MapNumber] + ld c, a + call GetWorldMapLocation + + cp SPECIAL_MAP + jr nz, .load + + ld a, [BackupMapGroup] + ld b, a + ld a, [BackupMapNumber] + ld c, a + call GetWorldMapLocation + +.load + ld [wDexCurrentLocation], a + ret + +Pokedex_RunJumptable: ; 4010b + ld a, [wJumptableIndex] + ld hl, .Jumptable + call Pokedex_LoadPointer + jp hl + +.Jumptable: ; 40115 (10:4115) +; entries correspond to DEXSTATE_* constants + dw Pokedex_InitMainScreen + dw Pokedex_UpdateMainScreen + dw Pokedex_InitDexEntryScreen + dw Pokedex_UpdateDexEntryScreen + dw Pokedex_ReinitDexEntryScreen + dw Pokedex_InitSearchScreen + dw Pokedex_UpdateSearchScreen + dw Pokedex_InitOptionScreen + dw Pokedex_UpdateOptionScreen + dw Pokedex_InitSearchResultsScreen + dw Pokedex_UpdateSearchResultsScreen + dw Pokedex_InitUnownMode + dw Pokedex_UpdateUnownMode + dw Pokedex_Exit + +Pokedex_IncrementDexPointer: ; 40131 (10:4131) + ld hl, wJumptableIndex + inc [hl] + ret + +Pokedex_Exit: ; 40136 (10:4136) + ld hl, wJumptableIndex + set 7, [hl] + ret + +Pokedex_InitMainScreen: ; 4013c (10:413c) + xor a + ld [hBGMapMode], a + call ClearSprites + xor a + hlcoord 0, 0, AttrMap + ld bc, SCREEN_HEIGHT * SCREEN_WIDTH + call ByteFill + farcall DrawPokedexListWindow + hlcoord 0, 17 + ld de, String_START_SEARCH + call Pokedex_PlaceString + ld a, 7 + ld [wDexListingHeight], a + call Pokedex_PrintListing + call Pokedex_SetBGMapMode_3ifDMG_4ifCGB + call Pokedex_ResetBGMapMode + call Pokedex_DrawMainScreenBG + ld a, POKEDEX_SCX + ld [hSCX], a + + ld a, [wCurrentDexMode] + cp DEXMODE_OLD + ld a, $4a + jr z, .okay + ld a, $47 +.okay + ld [hWX], a + xor a + ld [hWY], a + call WaitBGMap + + call Pokedex_ResetBGMapMode + ld a, -1 + ld [CurPartySpecies], a + ld a, SCGB_POKEDEX + call Pokedex_GetSGBLayout + call Pokedex_UpdateCursorOAM + farcall DrawPokedexListWindow + hlcoord 0, 17 + ld de, String_START_SEARCH + call Pokedex_PlaceString + ld a, 7 + ld [wDexListingHeight], a + call Pokedex_PrintListing + call Pokedex_IncrementDexPointer + ret + +Pokedex_UpdateMainScreen: ; 401ae (10:41ae) + ld hl, hJoyPressed + ld a, [hl] + and B_BUTTON + jr nz, .b + ld a, [hl] + and A_BUTTON + jr nz, .a + ld a, [hl] + and SELECT + jr nz, .select + ld a, [hl] + and START + jr nz, .start + call Pokedex_ListingHandleDPadInput + ret nc + call Pokedex_UpdateCursorOAM + xor a + ld [hBGMapMode], a + call Pokedex_PrintListing + call Pokedex_SetBGMapMode3 + call Pokedex_ResetBGMapMode + ret + +.a + call Pokedex_GetSelectedMon + call Pokedex_CheckSeen + ret z + ld a, DEXSTATE_DEX_ENTRY_SCR + ld [wJumptableIndex], a + ld a, DEXSTATE_MAIN_SCR + ld [wPrevDexEntryJumptableIndex], a + ret + +.select + call Pokedex_BlackOutBG + ld a, DEXSTATE_OPTION_SCR + ld [wJumptableIndex], a + xor a + ld [hSCX], a + ld a, $a7 + ld [hWX], a + call DelayFrame + ret + +.start + call Pokedex_BlackOutBG + ld a, DEXSTATE_SEARCH_SCR + ld [wJumptableIndex], a + xor a + ld [hSCX], a + ld a, $a7 + ld [hWX], a + call DelayFrame + ret + +.b + ld a, DEXSTATE_EXIT + ld [wJumptableIndex], a + ret + +Pokedex_InitDexEntryScreen: ; 40217 (10:4217) + call LowVolume + xor a ; page 1 + ld [wPokedexStatus], a + xor a + ld [hBGMapMode], a + call ClearSprites + call Pokedex_LoadCurrentFootprint + call Pokedex_DrawDexEntryScreenBG + call Pokedex_InitArrowCursor + call Pokedex_GetSelectedMon + ld [wPrevDexEntry], a + farcall DisplayDexEntry + call Pokedex_DrawFootprint + call WaitBGMap + ld a, $a7 + ld [hWX], a + call Pokedex_GetSelectedMon + ld [CurPartySpecies], a + ld a, SCGB_POKEDEX + call Pokedex_GetSGBLayout + ld a, [CurPartySpecies] + call PlayMonCry + call Pokedex_IncrementDexPointer + ret + +Pokedex_UpdateDexEntryScreen: ; 40258 (10:4258) + ld de, DexEntryScreen_ArrowCursorData + call Pokedex_MoveArrowCursor + ld hl, hJoyPressed + ld a, [hl] + and B_BUTTON + jr nz, .return_to_prev_screen + ld a, [hl] + and A_BUTTON + jr nz, .do_menu_action + call Pokedex_NextOrPreviousDexEntry + ret nc + call Pokedex_IncrementDexPointer + ret + +.do_menu_action + ld a, [wDexArrowCursorPosIndex] + ld hl, DexEntryScreen_MenuActionJumptable + call Pokedex_LoadPointer + jp hl + +.return_to_prev_screen + ld a, [LastVolume] + and a + jr z, .max_volume + ld a, $77 + ld [LastVolume], a + +.max_volume + call MaxVolume + ld a, [wPrevDexEntryJumptableIndex] + ld [wJumptableIndex], a + ret + +Pokedex_Page: ; 40292 + ld a, [wPokedexStatus] + xor 1 ; toggle page + ld [wPokedexStatus], a + call Pokedex_GetSelectedMon + ld [wPrevDexEntry], a + farcall DisplayDexEntry + call WaitBGMap + ret + +Pokedex_ReinitDexEntryScreen: ; 402aa (10:42aa) +; Reinitialize the Pokédex entry screen after changing the selected mon. + call Pokedex_BlackOutBG + xor a ; page 1 + ld [wPokedexStatus], a + xor a + ld [hBGMapMode], a + call Pokedex_DrawDexEntryScreenBG + call Pokedex_InitArrowCursor + call Pokedex_LoadCurrentFootprint + call Pokedex_GetSelectedMon + ld [wPrevDexEntry], a + farcall DisplayDexEntry + call Pokedex_DrawFootprint + call Pokedex_LoadSelectedMonTiles + call WaitBGMap + call Pokedex_GetSelectedMon + ld [CurPartySpecies], a + ld a, SCGB_POKEDEX + call Pokedex_GetSGBLayout + ld a, [CurPartySpecies] + call PlayMonCry + ld hl, wJumptableIndex + dec [hl] + ret + +DexEntryScreen_ArrowCursorData: ; 402e8 + db D_RIGHT | D_LEFT, 4 + dwcoord 1, 17 ; PAGE + dwcoord 6, 17 ; AREA + dwcoord 11, 17 ; CRY + dwcoord 15, 17 ; PRNT + + +DexEntryScreen_MenuActionJumptable: ; 402f2 + dw Pokedex_Page + dw .Area + dw .Cry + dw .Print + +.Area: ; 402fa + call Pokedex_BlackOutBG + xor a + ld [hSCX], a + call DelayFrame + ld a, $7 + ld [hWX], a + ld a, $90 + ld [hWY], a + call Pokedex_GetSelectedMon + ld a, [wDexCurrentLocation] + ld e, a + predef Pokedex_GetArea + call Pokedex_BlackOutBG + call DelayFrame + xor a + ld [hBGMapMode], a + ld a, $90 + ld [hWY], a + ld a, POKEDEX_SCX + ld [hSCX], a + call DelayFrame + call Pokedex_RedisplayDexEntry + call Pokedex_LoadSelectedMonTiles + call WaitBGMap + call Pokedex_GetSelectedMon + ld [CurPartySpecies], a + ld a, SCGB_POKEDEX + call Pokedex_GetSGBLayout + ret + +.Cry: ; 40340 + call Pokedex_GetSelectedMon + ld a, [wd265] + call GetCryIndex + ld e, c + ld d, b + call PlayCry + ret + +.Print: ; 4034f + call Pokedex_ApplyPrintPals + xor a + ld [hSCX], a + ld a, [wPrevDexEntryBackup] + push af + ld a, [wPrevDexEntryJumptableIndex] + push af + ld a, [wJumptableIndex] + push af + farcall PrintDexEntry + pop af + ld [wJumptableIndex], a + pop af + ld [wPrevDexEntryJumptableIndex], a + pop af + ld [wPrevDexEntryBackup], a + call ClearBGPalettes + call DisableLCD + call Pokedex_LoadInvertedFont + call Pokedex_RedisplayDexEntry + call EnableLCD + call WaitBGMap + ld a, POKEDEX_SCX + ld [hSCX], a + call Pokedex_ApplyUsualPals + ret + +Pokedex_RedisplayDexEntry: ; 4038d + call Pokedex_DrawDexEntryScreenBG + call Pokedex_GetSelectedMon + farcall DisplayDexEntry + call Pokedex_DrawFootprint + ret + +Pokedex_InitOptionScreen: ; 4039d (10:439d) + xor a + ld [hBGMapMode], a + call ClearSprites + call Pokedex_DrawOptionScreenBG + call Pokedex_InitArrowCursor + ld a, [wCurrentDexMode] ; Index of the topmost visible item in a scrolling menu ??? + ld [wDexArrowCursorPosIndex], a + call Pokedex_DisplayModeDescription + call WaitBGMap + ld a, SCGB_POKEDEX_SEARCH_OPTION + call Pokedex_GetSGBLayout + call Pokedex_IncrementDexPointer + ret + +Pokedex_UpdateOptionScreen: ; 403be (10:43be) + ld a, [wUnlockedUnownMode] + and a + jr nz, .okay + ld de, .NoUnownModeArrowCursorData + jr .okay2 +.okay + ld de, .ArrowCursorData +.okay2 + call Pokedex_MoveArrowCursor + call c, Pokedex_DisplayModeDescription + ld hl, hJoyPressed + ld a, [hl] + and SELECT | B_BUTTON + jr nz, .return_to_main_screen + ld a, [hl] + and A_BUTTON + jr nz, .do_menu_action + ret + +.do_menu_action + ld a, [wDexArrowCursorPosIndex] + ld hl, .MenuActionJumptable + call Pokedex_LoadPointer + jp hl + +.return_to_main_screen + call Pokedex_BlackOutBG + ld a, DEXSTATE_MAIN_SCR + ld [wJumptableIndex], a + ret + +.NoUnownModeArrowCursorData: ; 403f3 + db D_UP | D_DOWN, 3 + dwcoord 2, 4 ; NEW + dwcoord 2, 6 ; OLD + dwcoord 2, 8 ; ABC + +.ArrowCursorData: ; 403fb + db D_UP | D_DOWN, 4 + dwcoord 2, 4 ; NEW + dwcoord 2, 6 ; OLD + dwcoord 2, 8 ; ABC + dwcoord 2, 10 ; UNOWN + +.MenuActionJumptable: ; 40405 (10:4405) + dw .MenuAction_NewMode + dw .MenuAction_OldMode + dw .MenuAction_ABCMode + dw .MenuAction_UnownMode + +.MenuAction_NewMode: ; 4040d (10:440d) + ld b, DEXMODE_NEW + jr .ChangeMode + +.MenuAction_OldMode: ; 40411 (10:4411) + ld b, DEXMODE_OLD + jr .ChangeMode + +.MenuAction_ABCMode: ; 40415 (10:4415) + ld b, DEXMODE_ABC + +.ChangeMode: ; 40417 (10:4417) + ld a, [wCurrentDexMode] + cp b + jr z, .skip_changing_mode ; Skip if new mode is same as current. + + ld a, b + ld [wCurrentDexMode], a + call Pokedex_OrderMonsByMode + call Pokedex_DisplayChangingModesMessage + xor a + ld [wDexListingScrollOffset], a + ld [wDexListingCursor], a + call Pokedex_InitCursorPosition + +.skip_changing_mode + call Pokedex_BlackOutBG + ld a, DEXSTATE_MAIN_SCR + ld [wJumptableIndex], a + ret + +.MenuAction_UnownMode: ; 4043a (10:443a) + call Pokedex_BlackOutBG + ld a, DEXSTATE_UNOWN_MODE + ld [wJumptableIndex], a + ret + +Pokedex_InitSearchScreen: ; 40443 (10:4443) + xor a + ld [hBGMapMode], a + call ClearSprites + call Pokedex_DrawSearchScreenBG + call Pokedex_InitArrowCursor + ld a, NORMAL + 1 + ld [wDexSearchMonType1], a + xor a + ld [wDexSearchMonType2], a + call Pokedex_PlaceSearchScreenTypeStrings + xor a + ld [wDexSearchSlowpokeFrame], a + farcall DoDexSearchSlowpokeFrame + call WaitBGMap + ld a, SCGB_POKEDEX_SEARCH_OPTION + call Pokedex_GetSGBLayout + call Pokedex_IncrementDexPointer + ret + +Pokedex_UpdateSearchScreen: ; 40471 (10:4471) + ld de, .ArrowCursorData + call Pokedex_MoveArrowCursor + call Pokedex_UpdateSearchMonType + call c, Pokedex_PlaceSearchScreenTypeStrings + ld hl, hJoyPressed + ld a, [hl] + and START | B_BUTTON + jr nz, .cancel + ld a, [hl] + and A_BUTTON + jr nz, .do_menu_action + ret + +.do_menu_action + ld a, [wDexArrowCursorPosIndex] + ld hl, .MenuActionJumptable + call Pokedex_LoadPointer + jp hl + +.cancel + call Pokedex_BlackOutBG + ld a, DEXSTATE_MAIN_SCR + ld [wJumptableIndex], a + ret + +.ArrowCursorData: ; 4049e + db D_UP | D_DOWN, 4 + dwcoord 2, 4 ; TYPE 1 + dwcoord 2, 6 ; TYPE 2 + dwcoord 2, 13 ; BEGIN SEARCH + dwcoord 2, 15 ; CANCEL + +.MenuActionJumptable: ; 404a8 + dw .MenuAction_MonSearchType + dw .MenuAction_MonSearchType + dw .MenuAction_BeginSearch + dw .MenuAction_Cancel + +.MenuAction_MonSearchType: ; 404b0 + call Pokedex_NextSearchMonType + call Pokedex_PlaceSearchScreenTypeStrings + ret + +.MenuAction_BeginSearch: ; 404b7 + call Pokedex_SearchForMons + farcall AnimateDexSearchSlowpoke + ld a, [wDexSearchResultCount] + and a + jr nz, .show_search_results + +; No mon with matching types was found. + call Pokedex_OrderMonsByMode + call Pokedex_DisplayTypeNotFoundMessage + xor a + ld [hBGMapMode], a + call Pokedex_DrawSearchScreenBG + call Pokedex_InitArrowCursor + call Pokedex_PlaceSearchScreenTypeStrings + call WaitBGMap + ret + +.show_search_results + ld [wDexListingEnd], a + ld a, [wDexListingScrollOffset] + ld [wDexListingScrollOffsetBackup], a + ld a, [wDexListingCursor] + ld [wDexListingCursorBackup], a + ld a, [wPrevDexEntry] + ld [wPrevDexEntryBackup], a + xor a + ld [wDexListingScrollOffset], a + ld [wDexListingCursor], a + call Pokedex_BlackOutBG + ld a, DEXSTATE_SEARCH_RESULTS_SCR + ld [wJumptableIndex], a + ret + +.MenuAction_Cancel: ; 40501 + call Pokedex_BlackOutBG + ld a, DEXSTATE_MAIN_SCR + ld [wJumptableIndex], a + ret + +Pokedex_InitSearchResultsScreen: ; 4050a (10:450a) + xor a + ld [hBGMapMode], a + xor a + hlcoord 0, 0, AttrMap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT + call ByteFill + call Pokedex_SetBGMapMode4 + call Pokedex_ResetBGMapMode + farcall DrawPokedexSearchResultsWindow + call Pokedex_PlaceSearchResultsTypeStrings + ld a, 4 + ld [wDexListingHeight], a + call Pokedex_PrintListing + call Pokedex_SetBGMapMode3 + call Pokedex_ResetBGMapMode + call Pokedex_DrawSearchResultsScreenBG + ld a, POKEDEX_SCX + ld [hSCX], a + ld a, $4a + ld [hWX], a + xor a + ld [hWY], a + call WaitBGMap + call Pokedex_ResetBGMapMode + farcall DrawPokedexSearchResultsWindow + call Pokedex_PlaceSearchResultsTypeStrings + call Pokedex_UpdateSearchResultsCursorOAM + ld a, -1 + ld [CurPartySpecies], a + ld a, SCGB_POKEDEX + call Pokedex_GetSGBLayout + call Pokedex_IncrementDexPointer + ret + +Pokedex_UpdateSearchResultsScreen: ; 40562 (10:4562) + ld hl, hJoyPressed + ld a, [hl] + and B_BUTTON + jr nz, .return_to_search_screen + ld a, [hl] + and A_BUTTON + jr nz, .go_to_dex_entry + call Pokedex_ListingHandleDPadInput + ret nc + call Pokedex_UpdateSearchResultsCursorOAM + xor a + ld [hBGMapMode], a + call Pokedex_PrintListing + call Pokedex_SetBGMapMode3 + call Pokedex_ResetBGMapMode + ret + +.go_to_dex_entry + call Pokedex_GetSelectedMon + call Pokedex_CheckSeen + ret z + ld a, DEXSTATE_DEX_ENTRY_SCR + ld [wJumptableIndex], a + ld a, DEXSTATE_SEARCH_RESULTS_SCR + ld [wPrevDexEntryJumptableIndex], a + ret + +.return_to_search_screen + ld a, [wDexListingScrollOffsetBackup] + ld [wDexListingScrollOffset], a + ld a, [wDexListingCursorBackup] + ld [wDexListingCursor], a + ld a, [wPrevDexEntryBackup] + ld [wPrevDexEntry], a + call Pokedex_BlackOutBG + call ClearSprites + call Pokedex_OrderMonsByMode + ld a, DEXSTATE_SEARCH_SCR + ld [wJumptableIndex], a + xor a + ld [hSCX], a + ld a, $a7 + ld [hWX], a + ret + +Pokedex_InitUnownMode: ; 405bd (10:45bd) + call Pokedex_LoadUnownFont + call Pokedex_DrawUnownModeBG + xor a + ld [wDexCurrentUnownIndex], a + call Pokedex_LoadUnownFrontpicTiles + call Pokedex_UnownModePlaceCursor + farcall PrintUnownWord + call WaitBGMap + ld a, SCGB_POKEDEX_UNOWN_MODE + call Pokedex_GetSGBLayout + call Pokedex_IncrementDexPointer + ret + +Pokedex_UpdateUnownMode: ; 405df (10:45df) + ld hl, hJoyPressed + ld a, [hl] + and A_BUTTON | B_BUTTON + jr nz, .a_b + call Pokedex_UnownModeHandleDPadInput + ret + +.a_b + call Pokedex_BlackOutBG + ld a, DEXSTATE_OPTION_SCR + ld [wJumptableIndex], a + call DelayFrame + call Pokedex_CheckSGB + jr nz, .decompress + farcall LoadSGBPokedexGFX2 + jr .done + +.decompress + ld hl, PokedexLZ + ld de, vTiles2 tile $31 + lb bc, BANK(PokedexLZ), 58 + call DecompressRequest2bpp + +.done + ret + +Pokedex_UnownModeHandleDPadInput: ; 40610 (10:4610) + ld hl, hJoyLast + ld a, [hl] + and D_RIGHT + jr nz, .right + ld a, [hl] + and D_LEFT + jr nz, .left + ret + +.right + ld a, [wDexUnownCount] + ld e, a + ld hl, wDexCurrentUnownIndex + ld a, [hl] + inc a + cp e + ret nc + ld a, [hl] + inc [hl] + jr .update + +.left + ld hl, wDexCurrentUnownIndex + ld a, [hl] + and a + ret z + ld a, [hl] + dec [hl] + +.update + push af + xor a + ld [hBGMapMode], a + pop af + call Pokedex_UnownModeEraseCursor + call Pokedex_LoadUnownFrontpicTiles + call Pokedex_UnownModePlaceCursor + farcall PrintUnownWord + ld a, $1 + ld [hBGMapMode], a + call DelayFrame + call DelayFrame + ret + +Pokedex_UnownModeEraseCursor: ; 40654 (10:4654) + ld c, " " + jr Pokedex_UnownModeUpdateCursorGfx + +Pokedex_UnownModePlaceCursor: ; 40658 (10:4658) + ld a, [wDexCurrentUnownIndex] + ld c, $5a ; diamond cursor + +Pokedex_UnownModeUpdateCursorGfx: ; 4065d (10:465d) + ld e, a + ld d, 0 + ld hl, UnownModeLetterAndCursorCoords + 2 +rept 4 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + ld [hl], c + ret + +Pokedex_NextOrPreviousDexEntry: ; 4066c (10:466c) + ld a, [wDexListingCursor] + ld [wBackupDexListingCursor], a + ld a, [wDexListingScrollOffset] + ld [wBackupDexListingPage], a + ld hl, hJoyLast + ld a, [hl] + and D_UP + jr nz, .up + ld a, [hl] + and D_DOWN + jr nz, .down + and a + ret + +.up + ld a, [wDexListingHeight] + ld d, a + ld a, [wDexListingEnd] + ld e, a + call Pokedex_ListingMoveCursorUp + jr nc, .nope + call Pokedex_GetSelectedMon + call Pokedex_CheckSeen + jr nz, .yep + jr .up + +.down + ld a, [wDexListingHeight] + ld d, a + ld a, [wDexListingEnd] + ld e, a + call Pokedex_ListingMoveCursorDown + jr nc, .nope + call Pokedex_GetSelectedMon + call Pokedex_CheckSeen + jr nz, .yep + jr .down + +.yep + scf + ret + +.nope + ld a, [wBackupDexListingCursor] + ld [wDexListingCursor], a + ld a, [wBackupDexListingPage] + ld [wDexListingScrollOffset], a + and a + ret + +Pokedex_ListingHandleDPadInput: ; 406c5 (10:46c5) +; Handles D-pad input for a list of Pokémon. + ld a, [wDexListingHeight] + ld d, a + ld a, [wDexListingEnd] + ld e, a + ld hl, hJoyLast + ld a, [hl] + and D_UP + jr nz, Pokedex_ListingMoveCursorUp + ld a, [hl] + and D_DOWN + jr nz, Pokedex_ListingMoveCursorDown + ld a, d + cp e + jr nc, Pokedex_ListingPosStayedSame + ld a, [hl] + and D_LEFT + jr nz, Pokedex_ListingMoveUpOnePage + ld a, [hl] + and D_RIGHT + jr nz, Pokedex_ListingMoveDownOnePage + jr Pokedex_ListingPosStayedSame + +Pokedex_ListingMoveCursorUp: ; 406ea (10:46ea) + ld hl, wDexListingCursor + ld a, [hl] + and a + jr z, .try_scrolling + dec [hl] + jr Pokedex_ListingPosChanged +.try_scrolling + ld hl, wDexListingScrollOffset + ld a, [hl] + and a + jr z, Pokedex_ListingPosStayedSame + dec [hl] + jr Pokedex_ListingPosChanged + +Pokedex_ListingMoveCursorDown: ; 406fe (10:46fe) + ld hl, wDexListingCursor + ld a, [hl] + inc a + cp e + jr nc, Pokedex_ListingPosStayedSame + cp d + jr nc, .try_scrolling + inc [hl] + jr Pokedex_ListingPosChanged +.try_scrolling + ld hl, wDexListingScrollOffset + add [hl] + cp e + jr nc, Pokedex_ListingPosStayedSame + inc [hl] + jr Pokedex_ListingPosChanged + +Pokedex_ListingMoveUpOnePage: ; 40716 (10:4716) + ld hl, wDexListingScrollOffset + ld a, [hl] + and a + jr z, Pokedex_ListingPosStayedSame + cp d + jr nc, .not_near_top +; If we're already less than page away from the top, go to the top. + xor a + ld [hl], a + jr Pokedex_ListingPosChanged +.not_near_top + sub d + ld [hl], a + jr Pokedex_ListingPosChanged + +Pokedex_ListingMoveDownOnePage: ; 40728 (10:4728) +; When moving down a page, the return value always report a change in position. + ld hl, wDexListingScrollOffset + ld a, d + add a + add [hl] + jr c, .near_bottom + cp e + jr c, .not_near_bottom +.near_bottom + ld a, e + sub d + ld [hl], a + jr Pokedex_ListingPosChanged +.not_near_bottom + ld a, [hl] + add d + ld [hl], a + jr Pokedex_ListingPosChanged + +Pokedex_ListingPosStayedSame: ; 4073d (10:473d) + and a + ret + +Pokedex_ListingPosChanged: ; 4073f (10:473f) + scf + ret + +Pokedex_FillColumn: ; 40741 +; Fills a column starting at HL, going downwards. +; B is the height of the column and A is the tile it's filled with. + push de + ld de, SCREEN_WIDTH +.loop + ld [hl], a + add hl, de + dec b + jr nz, .loop + pop de + ret + + +Pokedex_DrawMainScreenBG: ; 4074c (10:474c) +; Draws the left sidebar and the bottom bar on the main screen. + hlcoord 0, 17 + ld de, String_START_SEARCH + call Pokedex_PlaceString + ld a, $32 + hlcoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT + call ByteFill + hlcoord 0, 0 + lb bc, 7, 7 + call Pokedex_PlaceBorder + hlcoord 0, 9 + lb bc, 6, 7 + call Pokedex_PlaceBorder + hlcoord 1, 11 + ld de, String_SEEN + call Pokedex_PlaceString + ld hl, PokedexSeen + ld b, EndPokedexSeen - PokedexSeen + call CountSetBits + ld de, wd265 + hlcoord 5, 12 + lb bc, 1, 3 + call PrintNum + hlcoord 1, 14 + ld de, String_OWN + call Pokedex_PlaceString + ld hl, PokedexCaught + ld b, EndPokedexCaught - PokedexCaught + call CountSetBits + ld de, wd265 + hlcoord 5, 15 + lb bc, 1, 3 + call PrintNum + hlcoord 1, 17 + ld de, String_SELECT_OPTION + call Pokedex_PlaceString + hlcoord 8, 1 + ld b, 7 + ld a, $5a + call Pokedex_FillColumn + hlcoord 8, 10 + ld b, 6 + ld a, $5a + call Pokedex_FillColumn + hlcoord 8, 0 + ld [hl], $59 + hlcoord 8, 8 + ld [hl], $53 + hlcoord 8, 9 + ld [hl], $54 + hlcoord 8, 16 + ld [hl], $5b + call Pokedex_PlaceFrontpicTopLeftCorner + ret + +String_SEEN: ; 407e1 + db "SEEN", -1 +String_OWN: ; 407e6 + db "OWN", -1 +String_SELECT_OPTION: ; 407ea + db $3b, $48, $49, $4a, $44, $45, $46, $47 ; SELECT > OPTION + ; fallthrough +String_START_SEARCH: ; 407f2 + db $3c, $3b, $41, $42, $43, $4b, $4c, $4d, $4e, $3c, -1 ; START > SEARCH + +Pokedex_DrawDexEntryScreenBG: ; 407fd + call Pokedex_FillBackgroundColor2 + hlcoord 0, 0 + lb bc, 15, 18 + call Pokedex_PlaceBorder + hlcoord 19, 0 + ld [hl], $34 + hlcoord 19, 1 + ld a, " " + ld b, 15 + call Pokedex_FillColumn + ld [hl], $39 + hlcoord 1, 10 + ld bc, 19 + ld a, $61 + call ByteFill + hlcoord 1, 17 + ld bc, 18 + ld a, " " + call ByteFill + hlcoord 9, 7 + ld de, .Height + call Pokedex_PlaceString + hlcoord 9, 9 + ld de, .Weight + call Pokedex_PlaceString + hlcoord 0, 17 + ld de, .MenuItems + call Pokedex_PlaceString + call Pokedex_PlaceFrontpicTopLeftCorner + ret + +.Unused: ; 4084f + db $5c, $5d, -1 ; No. +.Height: ; 40852 + db "HT ?", $5e, "??", $5f, -1 ; HT ?'??" +.Weight: ; 4085c + db "WT ???lb", -1 ; WT ???lb +.MenuItems: ; 40867 + db $3b, " PAGE AREA CRY PRNT", -1 + +Pokedex_DrawOptionScreenBG: ; 4087c (10:487c) + call Pokedex_FillBackgroundColor2 + hlcoord 0, 2 + lb bc, 8, 18 + call Pokedex_PlaceBorder + hlcoord 0, 12 + lb bc, 4, 18 + call Pokedex_PlaceBorder + hlcoord 0, 1 + ld de, .Title + call Pokedex_PlaceString + hlcoord 3, 4 + ld de, .Modes + call PlaceString + ld a, [wUnlockedUnownMode] + and a + ret z + hlcoord 3, 10 + ld de, .UnownMode + call PlaceString + ret + +.Title: ; 408b2 + db $3b, " OPTION ", $3c, -1 + +.Modes: ; 408bd + db "NEW #DEX MODE" + next "OLD #DEX MODE" + next "A to Z MODE" + db "@" + +.UnownMode: ; 408e5 + db "UNOWN MODE@" + +Pokedex_DrawSearchScreenBG: ; 408f0 (10:48f0) + call Pokedex_FillBackgroundColor2 + hlcoord 0, 2 + lb bc, 14, 18 + call Pokedex_PlaceBorder + hlcoord 0, 1 + ld de, .Title + call Pokedex_PlaceString + hlcoord 8, 4 + ld de, .TypeLeftRightArrows + call Pokedex_PlaceString + hlcoord 8, 6 + ld de, .TypeLeftRightArrows + call Pokedex_PlaceString + hlcoord 3, 4 + ld de, .Types + call PlaceString + hlcoord 3, 13 + ld de, .Menu + call PlaceString + ret + +.Title: ; 4092a + db $3b, " SEARCH ", $3c, -1 + +.TypeLeftRightArrows: ; 40935 + db $3d, " ", $3e, -1 + +.Types: ; 40940 + db "TYPE1" + next "TYPE2" + db "@" + +.Menu: ; 4094c + db "BEGIN SEARCH!!" + next "CANCEL" + db "@" + +Pokedex_DrawSearchResultsScreenBG: ; 40962 (10:4962) + call Pokedex_FillBackgroundColor2 + hlcoord 0, 0 + lb bc, 7, 7 + call Pokedex_PlaceBorder + hlcoord 0, 11 + lb bc, 5, 18 + call Pokedex_PlaceBorder + hlcoord 1, 12 + ld de, .BottomWindowText + call PlaceString + ld de, wDexSearchResultCount + hlcoord 1, 16 + lb bc, 1, 3 + call PrintNum + hlcoord 8, 0 + ld [hl], $59 + hlcoord 8, 1 + ld b, 7 + ld a, $5a + call Pokedex_FillColumn + hlcoord 8, 8 + ld [hl], $53 + hlcoord 8, 9 + ld [hl], $69 + hlcoord 8, 10 + ld [hl], $6a + call Pokedex_PlaceFrontpicTopLeftCorner + ret + +.BottomWindowText: ; 409ae + db "SEARCH RESULTS" + next " TYPE" + next " FOUND!" + db "@" + +Pokedex_PlaceSearchResultsTypeStrings: ; 409cf (10:49cf) + ld a, [wDexSearchMonType1] + hlcoord 0, 14 + call Pokedex_PlaceTypeString + ld a, [wDexSearchMonType1] + ld b, a + ld a, [wDexSearchMonType2] + and a + jr z, .done + cp b + jr z, .done + hlcoord 2, 15 + call Pokedex_PlaceTypeString + hlcoord 1, 15 + ld [hl], "/" +.done + ret + +Pokedex_DrawUnownModeBG: ; 409f1 (10:49f1) + call Pokedex_FillBackgroundColor2 + hlcoord 2, 1 + lb bc, 10, 13 + call Pokedex_PlaceBorder + hlcoord 2, 14 + lb bc, 1, 13 + call Pokedex_PlaceBorder + hlcoord 2, 15 + ld [hl], $3d + hlcoord 16, 15 + ld [hl], $3e + hlcoord 6, 5 + call Pokedex_PlaceFrontpicAtHL + ld de, 0 + ld b, 0 + ld c, 26 +.loop + ld hl, UnownDex + add hl, de + ld a, [hl] + and a + jr z, .done + push af + ld hl, UnownModeLetterAndCursorCoords +rept 4 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + pop af + add $40 - 1 ; Unown A + ld [hl], a + inc de + inc b + dec c + jr nz, .loop +.done + ld a, b + ld [wDexUnownCount], a + ret + +UnownModeLetterAndCursorCoords: ; 40a3e +; entries correspond to Unown forms +; letter, cursor + dwcoord 4,11, 3,11 ; A + dwcoord 4,10, 3,10 ; B + dwcoord 4, 9, 3, 9 ; C + dwcoord 4, 8, 3, 8 ; D + dwcoord 4, 7, 3, 7 ; E + dwcoord 4, 6, 3, 6 ; F + dwcoord 4, 5, 3, 5 ; G + dwcoord 4, 4, 3, 4 ; H + dwcoord 4, 3, 3, 2 ; I + dwcoord 5, 3, 5, 2 ; J + dwcoord 6, 3, 6, 2 ; K + dwcoord 7, 3, 7, 2 ; L + dwcoord 8, 3, 8, 2 ; M + dwcoord 9, 3, 9, 2 ; N + dwcoord 10, 3, 10, 2 ; O + dwcoord 11, 3, 11, 2 ; P + dwcoord 12, 3, 12, 2 ; Q + dwcoord 13, 3, 13, 2 ; R + dwcoord 14, 3, 15, 2 ; S + dwcoord 14, 4, 15, 4 ; T + dwcoord 14, 5, 15, 5 ; U + dwcoord 14, 6, 15, 6 ; V + dwcoord 14, 7, 15, 7 ; W + dwcoord 14, 8, 15, 8 ; X + dwcoord 14, 9, 15, 9 ; Y + dwcoord 14,10, 15,10 ; Z + +Pokedex_FillBackgroundColor2: ; 40aa6 + hlcoord 0, 0 + ld a, $32 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT + call ByteFill + ret + +Pokedex_PlaceFrontpicTopLeftCorner: ; 40ab2 + hlcoord 1, 1 +Pokedex_PlaceFrontpicAtHL: ; 40ab5 + xor a + ld b, $7 +.row + ld c, $7 + push af + push hl +.col + ld [hli], a + add $7 + dec c + jr nz, .col + pop hl + ld de, SCREEN_WIDTH + add hl, de + pop af + inc a + dec b + jr nz, .row + ret + +Pokedex_PlaceString: ; 40acd +.loop + ld a, [de] + cp -1 + ret z + inc de + ld [hli], a + jr .loop + + +Pokedex_PlaceBorder: ; 40ad5 + push hl + ld a, $33 + ld [hli], a + ld d, $34 + call .FillRow + ld a, $35 + ld [hl], a + pop hl + ld de, SCREEN_WIDTH + add hl, de +.loop + push hl + ld a, $36 + ld [hli], a + ld d, $7f + call .FillRow + ld a, $37 + ld [hl], a + pop hl + ld de, SCREEN_WIDTH + add hl, de + dec b + jr nz, .loop + ld a, $38 + ld [hli], a + ld d, $39 + call .FillRow + ld a, $3a + ld [hl], a + ret + +.FillRow: ; 40b06 + ld e, c +.row_loop + ld a, e + and a + ret z + ld a, d + ld [hli], a + dec e + jr .row_loop + + +Pokedex_PrintListing: ; 40b0f (10:4b0f) +; Prints the list of Pokémon on the main Pokédex screen. + +; This check is completely useless. + ld a, [wCurrentDexMode] + cp DEXMODE_OLD + jr z, .okay + ld c, 11 + jr .resume +.okay + ld c, 11 +; End useless check + +.resume +; Clear (2 * [wDexListingHeight] + 1) by 11 box starting at 0,1 + hlcoord 0, 1 + ld a, [wDexListingHeight] + add a + inc a + ld b, a + ld a, " " + call Pokedex_FillBox + +; Load de with wPokedexOrder + [wDexListingScrollOffset] + ld a, [wDexListingScrollOffset] + ld e, a + ld d, $0 + ld hl, wPokedexOrder + add hl, de + ld e, l + ld d, h + hlcoord 0, 2 + ld a, [wDexListingHeight] +.loop + push af + ld a, [de] + ld [wd265], a + push de + push hl + call .PrintEntry + pop hl + ld de, 2 * SCREEN_WIDTH + add hl, de + pop de + inc de + pop af + dec a + jr nz, .loop + call Pokedex_LoadSelectedMonTiles + ret + +.PrintEntry: ; 40b55 (10:4b55) +; Prints one entry in the list of Pokémon on the main Pokédex screen. + and a + ret z + call Pokedex_PrintNumberIfOldMode + call Pokedex_PlaceDefaultStringIfNotSeen + ret c + call Pokedex_PlaceCaughtSymbolIfCaught + push hl + call GetPokemonName + pop hl + call PlaceString + ret + +Pokedex_PrintNumberIfOldMode: ; 40b6a (10:4b6a) + ld a, [wCurrentDexMode] + cp DEXMODE_OLD + jr z, .printnum + ret + +.printnum + push hl + ld de, -SCREEN_WIDTH + add hl, de + ld de, wd265 + lb bc, PRINTNUM_LEADINGZEROS | 1, 3 + call PrintNum + pop hl + ret + +Pokedex_PlaceCaughtSymbolIfCaught: ; 40b82 (10:4b82) + call Pokedex_CheckCaught + jr nz, .place_caught_symbol + inc hl + ret + +.place_caught_symbol + ld a, $4f + ld [hli], a + ret + +Pokedex_PlaceDefaultStringIfNotSeen: ; 40b8d (10:4b8d) + call Pokedex_CheckSeen + ret nz + inc hl + ld de, .NameNotSeen + call PlaceString + scf + ret + +.NameNotSeen: ; 40b9a + db "-----@" + +Pokedex_DrawFootprint: ; 40ba0 + hlcoord 18, 1 + ld a, $62 + ld [hli], a + inc a + ld [hl], a + hlcoord 18, 2 + ld a, $64 + ld [hli], a + inc a + ld [hl], a + ret + + +Pokedex_GetSelectedMon: ; 40bb1 +; Gets the species of the currently selected Pokémon. This corresponds to the +; position of the cursor in the main listing, but this function can be used +; on all Pokédex screens. + ld a, [wDexListingCursor] + ld hl, wDexListingScrollOffset + add [hl] + ld e, a + ld d, $0 + ld hl, wPokedexOrder + add hl, de + ld a, [hl] + ld [wd265], a + ret + + +Pokedex_CheckCaught: ; 40bc4 (10:4bc4) + push de + push hl + ld a, [wd265] + dec a + call CheckCaughtMon + pop hl + pop de + ret + + +Pokedex_CheckSeen: ; 40bd0 + push de + push hl + ld a, [wd265] + dec a + call CheckSeenMon + pop hl + pop de + ret + + + +Pokedex_OrderMonsByMode: ; 40bdc + ld hl, wPokedexOrder + ld bc, wPokedexOrderEnd - wPokedexOrder + xor a + call ByteFill + ld a, [wCurrentDexMode] + ld hl, .Jumptable + call Pokedex_LoadPointer + jp hl + +.Jumptable: ; 40bf0 (10:4bf0) + dw .NewMode + dw .OldMode + dw Pokedex_ABCMode + +.NewMode: ; 40bf6 (10:4bf6) + ld de, NewPokedexOrder + ld hl, wPokedexOrder + ld c, NUM_POKEMON +.loopnew + ld a, [de] + inc de + ld [hli], a + dec c + jr nz, .loopnew + call .FindLastSeen + ret + +.OldMode: ; 40c08 (10:4c08) + ld hl, wPokedexOrder + ld a, $1 + ld c, NUM_POKEMON +.loopold + ld [hli], a + inc a + dec c + jr nz, .loopold + call .FindLastSeen + ret + +.FindLastSeen: ; 40c18 (10:4c18) + ld hl, wPokedexOrder + NUM_POKEMON - 1 + ld d, NUM_POKEMON + ld e, d +.loopfindend + ld a, [hld] + ld [wd265], a + call Pokedex_CheckSeen + jr nz, .foundend + dec d + dec e + jr nz, .loopfindend +.foundend + ld a, d + ld [wDexListingEnd], a + ret + +Pokedex_ABCMode: ; 40c30 + xor a + ld [wDexListingEnd], a + ld hl, wPokedexOrder + ld de, AlphabeticalPokedexOrder + ld c, NUM_POKEMON +.loop1abc + push bc + ld a, [de] + ld [wd265], a + call Pokedex_CheckSeen + jr z, .skipabc + ld a, [wd265] + ld [hli], a + ld a, [wDexListingEnd] + inc a + ld [wDexListingEnd], a + +.skipabc + inc de + pop bc + dec c + jr nz, .loop1abc + ld a, [wDexListingEnd] + ld c, 0 +.loop2abc + cp NUM_POKEMON + jr z, .doneabc + ld [hl], c + inc hl + inc a + jr .loop2abc + +.doneabc + ret + + +INCLUDE "data/pokemon/dex_order_alpha.asm" + +INCLUDE "data/pokemon/dex_order_new.asm" + + +Pokedex_DisplayModeDescription: ; 40e5b + xor a + ld [hBGMapMode], a + hlcoord 0, 12 + lb bc, 4, 18 + call Pokedex_PlaceBorder + ld a, [wDexArrowCursorPosIndex] + ld hl, .Modes + call Pokedex_LoadPointer + ld e, l + ld d, h + hlcoord 1, 14 + call PlaceString + ld a, $1 + ld [hBGMapMode], a + ret + +.Modes: ; 40e7d + dw .NewMode + dw .OldMode + dw .ABCMode + dw .UnownMode + +.NewMode: ; 40e85 + db " are listed by" + next "evolution type.@" + +.OldMode: ; 40ea6 + db " are listed by" + next "official type.@" + +.ABCMode: ; 40ec6 + db " are listed" + next "alphabetically.@" + +.UnownMode: ; 40ee4 + db "UNOWN are listed" + next "in catching order.@" + +Pokedex_DisplayChangingModesMessage: ; 40f08 (10:4f08) + xor a + ld [hBGMapMode], a + hlcoord 0, 12 + lb bc, 4, 18 + call Pokedex_PlaceBorder + ld de, String_ChangingModesPleaseWait + hlcoord 1, 14 + call PlaceString + ld a, $1 + ld [hBGMapMode], a + ld c, 64 + call DelayFrames + ld de, SFX_CHANGE_DEX_MODE + call PlaySFX + ld c, 64 + call DelayFrames + ret + +String_ChangingModesPleaseWait: ; 40f32 + db "Changing modes." + next "Please wait.@" + +Pokedex_UpdateSearchMonType: ; 40f4f (10:4f4f) + ld a, [wDexArrowCursorPosIndex] + cp 2 + jr nc, .no_change + ld hl, hJoyLast + ld a, [hl] + and D_LEFT + jr nz, Pokedex_PrevSearchMonType + ld a, [hl] + and D_RIGHT + jr nz, Pokedex_NextSearchMonType +.no_change + and a + ret + +Pokedex_PrevSearchMonType: ; 40f65 + ld a, [wDexArrowCursorPosIndex] + and a + jr nz, .type2 + + ld hl, wDexSearchMonType1 + ld a, [hl] + cp 1 + jr z, .wrap_around + dec [hl] + jr .done + +.type2 + ld hl, wDexSearchMonType2 + ld a, [hl] + and a + jr z, .wrap_around + dec [hl] + jr .done + +.wrap_around + ld [hl], NUM_TYPES - 1 + +.done + scf + ret + +Pokedex_NextSearchMonType: ; 40f84 + ld a, [wDexArrowCursorPosIndex] + and a + jr nz, .type2 + + ld hl, wDexSearchMonType1 + ld a, [hl] + cp NUM_TYPES - 1 + jr nc, .type1_wrap_around + inc [hl] + jr .done +.type1_wrap_around + ld [hl], 1 + jr .done + +.type2 + ld hl, wDexSearchMonType2 + ld a, [hl] + cp NUM_TYPES - 1 + jr nc, .type2_wrap_around + inc [hl] + jr .done +.type2_wrap_around + ld [hl], 0 + +.done + scf + ret + +Pokedex_PlaceSearchScreenTypeStrings: ; 40fa8 (10:4fa8) + xor a + ld [hBGMapMode], a + hlcoord 9, 3 + lb bc, 4, 8 + ld a, " " + call Pokedex_FillBox + ld a, [wDexSearchMonType1] + hlcoord 9, 4 + call Pokedex_PlaceTypeString + ld a, [wDexSearchMonType2] + hlcoord 9, 6 + call Pokedex_PlaceTypeString + ld a, $1 + ld [hBGMapMode], a + ret + +Pokedex_PlaceTypeString: ; 40fcd (10:4fcd) + push hl + ld e, a + ld d, 0 + ld hl, PokedexTypeSearchStrings +rept 9 + add hl, de +endr + ld e, l + ld d, h + pop hl + call PlaceString + ret + +INCLUDE "data/types/search_strings.asm" + +Pokedex_SearchForMons: ; 41086 + ld a, [wDexSearchMonType2] + and a + call nz, .Search + ld a, [wDexSearchMonType1] + and a + call nz, .Search + ret + +.Search: ; 41095 + dec a + ld e, a + ld d, 0 + ld hl, PokedexTypeSearchConversionTable + add hl, de + ld a, [hl] + ld [wDexConvertedMonType], a + ld hl, wPokedexOrder + ld de, wPokedexOrder + ld c, NUM_POKEMON + xor a + ld [wDexSearchResultCount], a +.loop + push bc + ld a, [hl] + and a + jr z, .next_mon + ld [wd265], a + ld [CurSpecies], a + call Pokedex_CheckCaught + jr z, .next_mon + push hl + push de + call GetBaseData + pop de + pop hl + ld a, [wDexConvertedMonType] + ld b, a + ld a, [BaseType1] + cp b + jr z, .match_found + ld a, [BaseType2] + cp b + jr nz, .next_mon + +.match_found + ld a, [wd265] + ld [de], a + inc de + ld a, [wDexSearchResultCount] + inc a + ld [wDexSearchResultCount], a + +.next_mon + inc hl + pop bc + dec c + jr nz, .loop + + ld l, e + ld h, d + ld a, [wDexSearchResultCount] + ld c, 0 + +.zero_remaining_mons + cp NUM_POKEMON + jr z, .done + ld [hl], c + inc hl + inc a + jr .zero_remaining_mons + +.done + ret + +INCLUDE "data/types/search_types.asm" + +Pokedex_DisplayTypeNotFoundMessage: ; 41107 + xor a + ld [hBGMapMode], a + hlcoord 0, 12 + lb bc, 4, 18 + call Pokedex_PlaceBorder + ld de, .TypeNotFound + hlcoord 1, 14 + call PlaceString + ld a, $1 + ld [hBGMapMode], a + ld c, $80 + call DelayFrames + ret + +.TypeNotFound: ; 41126 + db "The specified type" + next "was not found.@" + +Pokedex_UpdateCursorOAM: ; 41148 (10:5148) + ld a, [wCurrentDexMode] + cp DEXMODE_OLD + jp z, Pokedex_PutOldModeCursorOAM + call Pokedex_PutNewModeABCModeCursorOAM + call Pokedex_PutScrollbarOAM + ret + +Pokedex_PutOldModeCursorOAM: ; 41157 (10:5157) + ld hl, .CursorOAM + ld a, [wDexListingCursor] + or a + jr nz, .okay + ld hl, .CursorAtTopOAM +.okay + call Pokedex_LoadCursorOAM + ret + +.CursorOAM: ; 41167 + dsprite 3, 0, 9, -1, $30, 7 + dsprite 2, 0, 9, -1, $31, 7 + dsprite 2, 0, 10, -1, $32, 7 + dsprite 2, 0, 11, -1, $32, 7 + dsprite 2, 0, 12, -1, $32, 7 + dsprite 2, 0, 13, -1, $33, 7 + dsprite 2, 0, 16, -2, $33, 7 | X_FLIP + dsprite 2, 0, 17, -2, $32, 7 | X_FLIP + dsprite 2, 0, 18, -2, $32, 7 | X_FLIP + dsprite 2, 0, 19, -2, $32, 7 | X_FLIP + dsprite 2, 0, 20, -2, $31, 7 | X_FLIP + dsprite 3, 0, 20, -2, $30, 7 | X_FLIP + dsprite 4, 0, 9, -1, $30, 7 | Y_FLIP + dsprite 5, 0, 9, -1, $31, 7 | Y_FLIP + dsprite 5, 0, 10, -1, $32, 7 | Y_FLIP + dsprite 5, 0, 11, -1, $32, 7 | Y_FLIP + dsprite 5, 0, 12, -1, $32, 7 | Y_FLIP + dsprite 5, 0, 13, -1, $33, 7 | Y_FLIP + dsprite 5, 0, 16, -2, $33, 7 | X_FLIP | Y_FLIP + dsprite 5, 0, 17, -2, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 0, 18, -2, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 0, 19, -2, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 0, 20, -2, $31, 7 | X_FLIP | Y_FLIP + dsprite 4, 0, 20, -2, $30, 7 | X_FLIP | Y_FLIP + db -1 + +.CursorAtTopOAM: ; 411c8 +; OAM data for when the cursor is at the top of the list. The tiles at the top +; are cut off so they don't show up outside the list area. + dsprite 3, 0, 9, -1, $30, 7 + dsprite 2, 0, 9, -1, $34, 7 + dsprite 2, 0, 10, -1, $35, 7 + dsprite 2, 0, 11, -1, $35, 7 + dsprite 2, 0, 12, -1, $35, 7 + dsprite 2, 0, 13, -1, $36, 7 + dsprite 2, 0, 16, -2, $36, 7 | X_FLIP + dsprite 2, 0, 17, -2, $35, 7 | X_FLIP + dsprite 2, 0, 18, -2, $35, 7 | X_FLIP + dsprite 2, 0, 19, -2, $35, 7 | X_FLIP + dsprite 2, 0, 20, -2, $34, 7 | X_FLIP + dsprite 3, 0, 20, -2, $30, 7 | X_FLIP + dsprite 4, 0, 9, -1, $30, 7 | Y_FLIP + dsprite 5, 0, 9, -1, $31, 7 | Y_FLIP + dsprite 5, 0, 10, -1, $32, 7 | Y_FLIP + dsprite 5, 0, 11, -1, $32, 7 | Y_FLIP + dsprite 5, 0, 12, -1, $32, 7 | Y_FLIP + dsprite 5, 0, 13, -1, $33, 7 | Y_FLIP + dsprite 5, 0, 16, -2, $33, 7 | X_FLIP | Y_FLIP + dsprite 5, 0, 17, -2, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 0, 18, -2, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 0, 19, -2, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 0, 20, -2, $31, 7 | X_FLIP | Y_FLIP + dsprite 4, 0, 20, -2, $30, 7 | X_FLIP | Y_FLIP + db -1 + +Pokedex_PutNewModeABCModeCursorOAM: ; 41229 (10:5229) + ld hl, .CursorOAM + call Pokedex_LoadCursorOAM + ret + +.CursorOAM: ; 41230 + dsprite 3, 3, 9, -1, $30, 7 + dsprite 2, 3, 9, -1, $31, 7 + dsprite 2, 3, 10, -1, $32, 7 + dsprite 2, 3, 11, -1, $32, 7 + dsprite 2, 3, 12, -1, $33, 7 + dsprite 2, 3, 16, 0, $33, 7 | X_FLIP + dsprite 2, 3, 17, 0, $32, 7 | X_FLIP + dsprite 2, 3, 18, 0, $32, 7 | X_FLIP + dsprite 2, 3, 19, 0, $31, 7 | X_FLIP + dsprite 3, 3, 19, 0, $30, 7 | X_FLIP + dsprite 4, 3, 9, -1, $30, 7 | Y_FLIP + dsprite 5, 3, 9, -1, $31, 7 | Y_FLIP + dsprite 5, 3, 10, -1, $32, 7 | Y_FLIP + dsprite 5, 3, 11, -1, $32, 7 | Y_FLIP + dsprite 5, 3, 12, -1, $33, 7 | Y_FLIP + dsprite 5, 3, 16, 0, $33, 7 | X_FLIP | Y_FLIP + dsprite 5, 3, 17, 0, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 3, 18, 0, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 3, 19, 0, $31, 7 | X_FLIP | Y_FLIP + dsprite 4, 3, 19, 0, $30, 7 | X_FLIP | Y_FLIP + db -1 + +Pokedex_UpdateSearchResultsCursorOAM: ; 41281 (10:5281) + ld a, [wCurrentDexMode] + cp DEXMODE_OLD + jp z, Pokedex_PutOldModeCursorOAM + ld hl, .CursorOAM + call Pokedex_LoadCursorOAM + ret + +.CursorOAM: ; 41290 + dsprite 3, 3, 9, -1, $30, 7 + dsprite 2, 3, 9, -1, $31, 7 + dsprite 2, 3, 10, -1, $32, 7 + dsprite 2, 3, 11, -1, $32, 7 + dsprite 2, 3, 12, -1, $32, 7 + dsprite 2, 3, 13, -1, $33, 7 + dsprite 2, 3, 16, -2, $33, 7 | X_FLIP + dsprite 2, 3, 17, -2, $32, 7 | X_FLIP + dsprite 2, 3, 18, -2, $32, 7 | X_FLIP + dsprite 2, 3, 19, -2, $32, 7 | X_FLIP + dsprite 2, 3, 20, -2, $31, 7 | X_FLIP + dsprite 3, 3, 20, -2, $30, 7 | X_FLIP + dsprite 4, 3, 9, -1, $30, 7 | Y_FLIP + dsprite 5, 3, 9, -1, $31, 7 | Y_FLIP + dsprite 5, 3, 10, -1, $32, 7 | Y_FLIP + dsprite 5, 3, 11, -1, $32, 7 | Y_FLIP + dsprite 5, 3, 12, -1, $32, 7 | Y_FLIP + dsprite 5, 3, 13, -1, $33, 7 | Y_FLIP + dsprite 5, 3, 16, -2, $33, 7 | X_FLIP | Y_FLIP + dsprite 5, 3, 17, -2, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 3, 18, -2, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 3, 19, -2, $32, 7 | X_FLIP | Y_FLIP + dsprite 5, 3, 20, -2, $31, 7 | X_FLIP | Y_FLIP + dsprite 4, 3, 20, -2, $30, 7 | X_FLIP | Y_FLIP + db -1 + +Pokedex_LoadCursorOAM: ; 412f1 (10:52f1) + ld de, Sprite01 +.loop + ld a, [hl] + cp -1 + ret z + ld a, [wDexListingCursor] + and $7 + swap a + add [hl] ; y + inc hl + ld [de], a + inc de + ld a, [hli] ; x + ld [de], a + inc de + ld a, [hli] ; tile id + ld [de], a + inc de + ld a, [hli] ; attributes + ld [de], a + inc de + jr .loop + +Pokedex_PutScrollbarOAM: ; 4130e (10:530e) +; Writes the OAM data for the scrollbar in the new mode and ABC mode. + push de + ld a, [wDexListingEnd] + dec a + ld e, a + ld a, [wDexListingCursor] + ld hl, wDexListingScrollOffset + add [hl] + cp e + jr z, .asm_4133f + ld hl, $0 + ld bc, $79 + call AddNTimes + ld e, l + ld d, h + ld b, $0 + ld a, d + or e + jr z, .asm_41341 + ld a, [wDexListingEnd] + ld c, a +.asm_41333 + ld a, e + sub c + ld e, a + ld a, d + sbc $0 + ld d, a + jr c, .asm_41341 + inc b + jr .asm_41333 +.asm_4133f + ld b, $79 +.asm_41341 + ld a, $14 + add b + pop hl + ld [hli], a + ld a, $a1 + ld [hli], a + ld a, $f + ld [hli], a + ld [hl], $0 + ret + +Pokedex_InitArrowCursor: ; 4134f (10:534f) + xor a + ld [wDexArrowCursorPosIndex], a + ld [wDexArrowCursorDelayCounter], a + ld [wDexArrowCursorBlinkCounter], a + ret + +Pokedex_MoveArrowCursor: ; 4135a (10:535a) +; bc = [de] - 1 + ld a, [de] + ld b, a + inc de + ld a, [de] + dec a + ld c, a + inc de + call Pokedex_BlinkArrowCursor + + ld hl, hJoyPressed + ld a, [hl] + and D_LEFT | D_UP + and b + jr nz, .move_left_or_up + ld a, [hl] + and D_RIGHT | D_DOWN + and b + jr nz, .move_right_or_down + ld a, [hl] + and SELECT + and b + jr nz, .select + call Pokedex_ArrowCursorDelay + jr c, .no_action + ld hl, hJoyLast + ld a, [hl] + and D_LEFT | D_UP + and b + jr nz, .move_left_or_up + ld a, [hl] + and D_RIGHT | D_DOWN + and b + jr nz, .move_right_or_down + jr .no_action + +.move_left_or_up + ld a, [wDexArrowCursorPosIndex] + and a + jr z, .no_action + call Pokedex_GetArrowCursorPos + ld [hl], " " + ld hl, wDexArrowCursorPosIndex + dec [hl] + jr .update_cursor_pos + +.move_right_or_down + ld a, [wDexArrowCursorPosIndex] + cp c + jr nc, .no_action + call Pokedex_GetArrowCursorPos + ld [hl], " " + ld hl, wDexArrowCursorPosIndex + inc [hl] + +.update_cursor_pos + call Pokedex_GetArrowCursorPos + ld [hl], "▶" + ld a, 12 + ld [wDexArrowCursorDelayCounter], a + xor a + ld [wDexArrowCursorBlinkCounter], a + scf + ret + +.no_action + and a + ret + +.select + call Pokedex_GetArrowCursorPos + ld [hl], " " + ld a, [wDexArrowCursorPosIndex] + cp c + jr c, .update + ld a, -1 +.update + inc a + ld [wDexArrowCursorPosIndex], a + jr .update_cursor_pos + +Pokedex_GetArrowCursorPos: ; 413d4 (10:53d4) + ld a, [wDexArrowCursorPosIndex] + add a + ld l, a + ld h, 0 + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + ret + +Pokedex_BlinkArrowCursor: ; 413e0 (10:53e0) + ld hl, wDexArrowCursorBlinkCounter + ld a, [hl] + inc [hl] + and $8 + jr z, .blink_on + call Pokedex_GetArrowCursorPos + ld [hl], " " + ret + +.blink_on + call Pokedex_GetArrowCursorPos + ld [hl], "▶" + ret + +Pokedex_ArrowCursorDelay: ; 413f5 (10:53f5) +; Updates the delay counter set when moving the arrow cursor. +; Returns whether the delay is active in carry. + ld hl, wDexArrowCursorDelayCounter + ld a, [hl] + and a + ret z + + dec [hl] + scf + ret + +Pokedex_FillBox: ; 413fe (10:53fe) + jp FillBoxWithByte + +Pokedex_BlackOutBG: ; 41401 (10:5401) +; Make BG palettes black so that the BG becomes all black. + ld a, [rSVBK] + push af + ld a, BANK(wBGPals1) + ld [rSVBK], a + ld hl, wBGPals1 + ld bc, 8 palettes + xor a + call ByteFill + pop af + ld [rSVBK], a + +Pokedex_ApplyPrintPals: ; 41415 + ld a, $ff + call DmgToCgbBGPals + ld a, $ff + call DmgToCgbObjPal0 + call DelayFrame + ret + +Pokedex_GetSGBLayout: ; 41423 + ld b, a + call GetSGBLayout + +Pokedex_ApplyUsualPals: ; 41427 +; This applies the palettes used for most Pokédex screens. + ld a, $e4 + call DmgToCgbBGPals + ld a, $e0 + call DmgToCgbObjPal0 + ret + + +Pokedex_LoadPointer: ; 41432 + ld e, a + ld d, 0 + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + ret + +Pokedex_LoadSelectedMonTiles: ; 4143b +; Loads the tiles of the currently selected Pokémon. + call Pokedex_GetSelectedMon + call Pokedex_CheckSeen + jr z, .QuestionMark + ld a, [wFirstUnownSeen] + ld [UnownLetter], a + ld a, [wd265] + ld [CurPartySpecies], a + call GetBaseData + ld de, vTiles2 + predef GetMonFrontpic + ret + +.QuestionMark: + ld a, BANK(sScratch) + call GetSRAMBank + farcall LoadQuestionMarkPic + ld hl, vTiles2 + ld de, sScratch + ld c, 7 * 7 + ld a, [hROMBank] + ld b, a + call Get2bpp + call CloseSRAM + ret + + +Pokedex_LoadCurrentFootprint: ; 41478 (10:5478) + call Pokedex_GetSelectedMon + +Pokedex_LoadAnyFootprint: ; 4147b + ld a, [wd265] + dec a + and %11111000 + srl a + srl a + srl a + ld e, 0 + ld d, a + ld a, [wd265] + dec a + and %111 + swap a ; * $10 + ld l, a + ld h, 0 + add hl, de + ld de, Footprints + add hl, de + + push hl + ld e, l + ld d, h + ld hl, vTiles2 tile $62 + lb bc, BANK(Footprints), 2 + call Request1bpp + pop hl + + ; Whoever was editing footprints forgot to fix their + ; tile editor. Now each bottom half is 8 tiles off. + ld de, 8 tiles + add hl, de + + ld e, l + ld d, h + ld hl, vTiles2 tile $64 + lb bc, BANK(Footprints), 2 + call Request1bpp + + ret + + +Pokedex_LoadGFX: ; 414b7 + call DisableLCD + ld hl, vTiles2 + ld bc, $31 tiles + xor a + call ByteFill + call Pokedex_LoadInvertedFont + call LoadFontsExtra + ld hl, vTiles2 tile $60 + ld bc, $20 tiles + call Pokedex_InvertTiles + call Pokedex_CheckSGB + jr nz, .LoadPokedexLZ + farcall LoadSGBPokedexGFX + jr .LoadPokedexSlowpokeLZ + +.LoadPokedexLZ: + ld hl, PokedexLZ + ld de, vTiles2 tile $31 + call Decompress + +.LoadPokedexSlowpokeLZ: + ld hl, PokedexSlowpokeLZ + ld de, vTiles0 + call Decompress + ld a, 6 + call SkipMusic + call EnableLCD + ret + +Pokedex_LoadInvertedFont: ; 414fb + call LoadStandardFont + ld hl, vTiles1 + ld bc, $80 tiles + +Pokedex_InvertTiles: ; 41504 +.loop + ld a, [hl] + xor $ff + ld [hli], a + dec bc + ld a, b + or c + jr nz, .loop + ret + +PokedexLZ: ; 4150e +INCBIN "gfx/pokedex/pokedex.2bpp.lz" + +PokedexSlowpokeLZ: ; 416b0 +INCBIN "gfx/pokedex/slowpoke.2bpp.lz" + +Pokedex_CheckSGB: ; 41a24 + ld a, [hCGB] + or a + ret nz + ld a, [hSGB] + dec a + ret + +Pokedex_LoadUnownFont: ; 41a2c + ld a, BANK(sScratch) + call GetSRAMBank + ld hl, UnownFont + ld de, sScratch + $188 + ld bc, 39 tiles + ld a, BANK(UnownFont) + call FarCopyBytes + ld hl, sScratch + $188 + ld bc, 27 tiles + call Pokedex_InvertTiles + ld de, sScratch + $188 + ld hl, vTiles2 tile $40 + lb bc, BANK(Pokedex_LoadUnownFont), 27 + call Request2bpp + call CloseSRAM + ret + +Pokedex_LoadUnownFrontpicTiles: ; 41a58 (10:5a58) + ld a, [UnownLetter] + push af + ld a, [wDexCurrentUnownIndex] + ld e, a + ld d, 0 + ld hl, UnownDex + add hl, de + ld a, [hl] + ld [UnownLetter], a + ld a, UNOWN + ld [CurPartySpecies], a + call GetBaseData + ld de, vTiles2 tile $00 + predef GetMonFrontpic + pop af + ld [UnownLetter], a + ret + +_NewPokedexEntry: ; 41a7f + xor a + ld [hBGMapMode], a + farcall DrawDexEntryScreenRightEdge + call Pokedex_ResetBGMapMode + call DisableLCD + call LoadStandardFont + call LoadFontsExtra + call Pokedex_LoadGFX + call Pokedex_LoadAnyFootprint + ld a, [wd265] + ld [CurPartySpecies], a + call Pokedex_DrawDexEntryScreenBG + call Pokedex_DrawFootprint + hlcoord 0, 17 + ld [hl], $3b + inc hl + ld bc, 19 + ld a, " " + call ByteFill + farcall DisplayDexEntry + call EnableLCD + call WaitBGMap + call GetBaseData + ld de, vTiles2 + predef GetMonFrontpic + ld a, SCGB_POKEDEX + call Pokedex_GetSGBLayout + ld a, [CurPartySpecies] + call PlayMonCry + ret + + +Pokedex_SetBGMapMode3: ; 41ad7 (10:5ad7) + ld a, $3 + ld [hBGMapMode], a + ld c, 4 + call DelayFrames + ret + +Pokedex_SetBGMapMode4: ; 41ae1 (10:5ae1) + ld a, $4 + ld [hBGMapMode], a + ld c, 4 + call DelayFrames + ret + +Pokedex_SetBGMapMode_3ifDMG_4ifCGB: ; 41aeb (10:5aeb) + ld a, [hCGB] + and a + jr z, .DMG + call Pokedex_SetBGMapMode4 +.DMG: + call Pokedex_SetBGMapMode3 + ret + + +Pokedex_ResetBGMapMode: ; 41af7 + xor a + ld [hBGMapMode], a + ret diff --git a/engine/pokedex/pokedex_2.asm b/engine/pokedex/pokedex_2.asm new file mode 100644 index 000000000..4dd608ac0 --- /dev/null +++ b/engine/pokedex/pokedex_2.asm @@ -0,0 +1,280 @@ +AnimateDexSearchSlowpoke: ; 441cf + ld hl, .FrameIDs + ld b, 25 +.loop + ld a, [hli] + + ; Wrap around + cp $fe + jr nz, .ok + ld hl, .FrameIDs + ld a, [hli] +.ok + + ld [wDexSearchSlowpokeFrame], a + ld a, [hli] + ld c, a + push bc + push hl + call DoDexSearchSlowpokeFrame + pop hl + pop bc + call DelayFrames + dec b + jr nz, .loop + xor a + ld [wDexSearchSlowpokeFrame], a + call DoDexSearchSlowpokeFrame + ld c, 32 + call DelayFrames + ret + +.FrameIDs: ; 441fc + ; frame ID, duration + db 0, 7 + db 1, 7 + db 2, 7 + db 3, 7 + db 4, 7 + db -2 + +DoDexSearchSlowpokeFrame: ; 44207 + ld a, [wDexSearchSlowpokeFrame] + ld hl, .SlowpokeSpriteData + ld de, Sprite01 +.loop + ld a, [hli] + cp -1 + ret z + ld [de], a ; y + inc de + ld a, [hli] + ld [de], a ; x + inc de + ld a, [wDexSearchSlowpokeFrame] + ld b, a + add a + add b + add [hl] + inc hl + ld [de], a ; tile id + inc de + ld a, [hli] + ld [de], a ; attributes + inc de + jr .loop + +.SlowpokeSpriteData: ; 44228 + dsprite 11, 0, 9, 0, $00, 0 + dsprite 11, 0, 10, 0, $01, 0 + dsprite 11, 0, 11, 0, $02, 0 + dsprite 12, 0, 9, 0, $10, 0 + dsprite 12, 0, 10, 0, $11, 0 + dsprite 12, 0, 11, 0, $12, 0 + dsprite 13, 0, 9, 0, $20, 0 + dsprite 13, 0, 10, 0, $21, 0 + dsprite 13, 0, 11, 0, $22, 0 + db -1 + +DisplayDexEntry: ; 4424d + call GetPokemonName + hlcoord 9, 3 + call PlaceString ; mon species + ld a, [wd265] + ld b, a + call GetDexEntryPointer + ld a, b + push af + hlcoord 9, 5 + call FarString ; dex species + ld h, b + ld l, c + push de +; Print dex number + hlcoord 2, 8 + ld a, $5c ; No + ld [hli], a + ld a, $5d ; . + ld [hli], a + ld de, wd265 + lb bc, PRINTNUM_LEADINGZEROS | 1, 3 + call PrintNum +; Check to see if we caught it. Get out of here if we haven't. + ld a, [wd265] + dec a + call CheckCaughtMon + pop hl + pop bc + ret z +; Get the height of the Pokemon. + ld a, [CurPartySpecies] + ld [CurSpecies], a + inc hl + ld a, b + push af + push hl + call GetFarHalfword + ld d, l + ld e, h + pop hl + inc hl + inc hl + ld a, d + or e + jr z, .skip_height + push hl + push de + ld hl, sp+$0 + ld d, h + ld e, l + hlcoord 12, 7 + lb bc, 2, PRINTNUM_MONEY | 4 + call PrintNum + hlcoord 14, 7 + ld [hl], $5e ; ft symbol + pop af + pop hl + +.skip_height + pop af + push af + inc hl + push hl + dec hl + call GetFarHalfword + ld d, l + ld e, h + ld a, e + or d + jr z, .skip_weight + push de + ld hl, sp+$0 + ld d, h + ld e, l + hlcoord 11, 9 + lb bc, 2, PRINTNUM_RIGHTALIGN | 5 + call PrintNum + pop de + +.skip_weight +; Page 1 + lb bc, 5, SCREEN_WIDTH - 2 + hlcoord 2, 11 + call ClearBox + hlcoord 1, 10 + ld bc, SCREEN_WIDTH - 1 + ld a, $61 ; horizontal divider + call ByteFill + ; page number + hlcoord 1, 9 + ld [hl], $55 + inc hl + ld [hl], $55 + hlcoord 1, 10 + ld [hl], $56 ; P. + inc hl + ld [hl], $57 ; 1 + pop de + inc de + pop af + hlcoord 2, 11 + push af + call FarString + pop bc + ld a, [wPokedexStatus] + or a ; check for page 2 + ret z + +; Page 2 + push bc + push de + lb bc, 5, SCREEN_WIDTH - 2 + hlcoord 2, 11 + call ClearBox + hlcoord 1, 10 + ld bc, SCREEN_WIDTH - 1 + ld a, $61 + call ByteFill + ; page number + hlcoord 1, 9 + ld [hl], $55 + inc hl + ld [hl], $55 + hlcoord 1, 10 + ld [hl], $56 ; P. + inc hl + ld [hl], $58 ; 2 + pop de + inc de + pop af + hlcoord 2, 11 + call FarString + ret + +String_44331: ; 44331 + db "#@" + +GetDexEntryPointer: ; 44333 +; return dex entry pointer b:de + push hl + ld hl, PokedexDataPointerTable + ld a, b + dec a + ld d, 0 + ld e, a + add hl, de + add hl, de + ld e, [hl] + inc hl + ld d, [hl] + push de + rlca + rlca + maskbits NUM_DEX_ENTRY_BANKS + ld hl, .PokedexEntryBanks + ld d, 0 + ld e, a + add hl, de + ld b, [hl] + pop de + pop hl + ret + +.PokedexEntryBanks: ; 44351 + db BANK(PokedexEntries1) + db BANK(PokedexEntries2) + db BANK(PokedexEntries3) + db BANK(PokedexEntries4) + +GetDexEntryPagePointer: ; 44355 + call GetDexEntryPointer ; b:de + push hl + ld h, d + ld l, e +; skip species name +.loop1 + ld a, b + call GetFarByte + inc hl + cp "@" + jr nz, .loop1 +; skip height and weight +rept 4 + inc hl +endr +; if c != 1: skip entry + dec c + jr z, .done +; skip entry +.loop2 + ld a, b + call GetFarByte + inc hl + cp "@" + jr nz, .loop2 + +.done + ld d, h + ld e, l + pop hl + ret diff --git a/engine/pokedex/pokedex_3.asm b/engine/pokedex/pokedex_3.asm new file mode 100644 index 000000000..dc52f83d3 --- /dev/null +++ b/engine/pokedex/pokedex_3.asm @@ -0,0 +1,162 @@ +LoadSGBPokedexGFX: ; 1ddf1c + ld hl, SGBPokedexGFX_LZ + ld de, vTiles2 tile $31 + call Decompress + ret + +LoadSGBPokedexGFX2: ; 1ddf26 (77:5f26) + ld hl, SGBPokedexGFX_LZ + ld de, vTiles2 tile $31 + lb bc, BANK(SGBPokedexGFX_LZ), 58 + call DecompressRequest2bpp + ret + +SGBPokedexGFX_LZ: ; 1ddf33 +INCBIN "gfx/pokedex/sgb.2bpp.lz" + +LoadQuestionMarkPic: ; 1de0d7 + ld hl, .QuestionMarkLZ + ld de, sScratch + call Decompress + ret + +.QuestionMarkLZ: ; 1de0e1 +INCBIN "gfx/pokemon/questionmark/front.2bpp.lz" + +DrawPokedexListWindow: ; 1de171 (77:6171) + ld a, $32 + hlcoord 0, 17 + ld bc, 12 + call ByteFill + hlcoord 0, 1 + lb bc, 15, 11 + call ClearBox + ld a, $34 + hlcoord 0, 0 + ld bc, 11 + call ByteFill + ld a, $39 + hlcoord 0, 16 + ld bc, 11 + call ByteFill + hlcoord 5, 0 + ld [hl], $3f + hlcoord 5, 16 + ld [hl], $40 + ld a, [wCurrentDexMode] + cp DEXMODE_OLD + jr z, .OldMode +; scroll bar + hlcoord 11, 0 + ld [hl], $50 + ld a, $51 + hlcoord 11, 1 + ld b, SCREEN_HEIGHT - 3 + call Bank77_FillColumn + ld [hl], $52 + jr .Done + +.OldMode: +; no scroll bar + hlcoord 11, 0 + ld [hl], $66 + ld a, $67 + hlcoord 11, 1 + ld b, SCREEN_HEIGHT - 3 + call Bank77_FillColumn + ld [hl], $68 +.Done: + ret + +DrawPokedexSearchResultsWindow: ; 1de1d1 (77:61d1) + ld a, $34 + hlcoord 0, 0 + ld bc, 11 + call ByteFill + ld a, $39 + hlcoord 0, 10 + ld bc, 11 + call ByteFill + hlcoord 5, 0 + ld [hl], $3f + hlcoord 5, 10 + ld [hl], $40 + hlcoord 11, 0 + ld [hl], $66 + ld a, $67 + hlcoord 11, 1 + ld b, SCREEN_HEIGHT / 2 + call Bank77_FillColumn + ld [hl], $68 + ld a, $34 + hlcoord 0, 11 + ld bc, 11 + call ByteFill + ld a, $39 + hlcoord 0, 17 + ld bc, 11 + call ByteFill + hlcoord 11, 11 + ld [hl], $66 + ld a, $67 + hlcoord 11, 12 + ld b, 5 + call Bank77_FillColumn + ld [hl], $68 + hlcoord 0, 12 + lb bc, 5, 11 + call ClearBox + ld de, .esults_D + hlcoord 0, 12 + call PlaceString + ret + +.esults_D ; 1de23c +; (SEARCH R) + db "ESULTS" + next "" +; (### FOUN) + next "D!@" + +DrawDexEntryScreenRightEdge: ; 1de247 + ld a, [hBGMapAddress] + ld l, a + ld a, [hBGMapAddress + 1] + ld h, a + push hl + inc hl + ld a, l + ld [hBGMapAddress], a + ld a, h + ld [hBGMapAddress + 1], a + hlcoord 19, 0 + ld [hl], $66 + hlcoord 19, 1 + ld a, $67 + ld b, 15 + call Bank77_FillColumn + ld [hl], $68 + hlcoord 19, 17 + ld [hl], $3c + xor a + ld b, SCREEN_HEIGHT + hlcoord 19, 0, AttrMap + call Bank77_FillColumn + call WaitBGMap2 + pop hl + ld a, l + ld [hBGMapAddress], a + ld a, h + ld [hBGMapAddress + 1], a + ret + +Bank77_FillColumn: ; 1de27f + push de + ld de, SCREEN_WIDTH +.loop + ld [hl], a + add hl, de + dec b + jr nz, .loop + pop de + ret diff --git a/engine/pokedex/unown_dex.asm b/engine/pokedex/unown_dex.asm new file mode 100755 index 000000000..dc6db9dc6 --- /dev/null +++ b/engine/pokedex/unown_dex.asm @@ -0,0 +1,52 @@ +UpdateUnownDex: ; fba18 + ld a, [UnownLetter] + ld c, a + ld b, NUM_UNOWN + ld hl, UnownDex +.loop + ld a, [hli] + and a + jr z, .done + cp c + ret z + dec b + jr nz, .loop + ret + +.done + dec hl + ld [hl], c + ret +; fba2e + +PrintUnownWord: ; fba2e (3e:7a2e) + hlcoord 4, 15 + ld bc, 12 + ld a, " " + call ByteFill + ld a, [wDexCurrentUnownIndex] + ld e, a + ld d, 0 + ld hl, UnownDex + add hl, de + ld a, [hl] + ld e, a + ld d, 0 + ld hl, UnownWords + add hl, de + add hl, de + ld a, [hli] + ld e, a + ld d, [hl] + hlcoord 4, 15 +.loop + ld a, [de] + cp -1 + ret z + inc de + ld [hli], a + jr .loop +; fba5a (3e:7a5a) + + +INCLUDE "data/unown_words.asm" diff --git a/engine/pokedex_2.asm b/engine/pokedex_2.asm deleted file mode 100644 index 4dd608ac0..000000000 --- a/engine/pokedex_2.asm +++ /dev/null @@ -1,280 +0,0 @@ -AnimateDexSearchSlowpoke: ; 441cf - ld hl, .FrameIDs - ld b, 25 -.loop - ld a, [hli] - - ; Wrap around - cp $fe - jr nz, .ok - ld hl, .FrameIDs - ld a, [hli] -.ok - - ld [wDexSearchSlowpokeFrame], a - ld a, [hli] - ld c, a - push bc - push hl - call DoDexSearchSlowpokeFrame - pop hl - pop bc - call DelayFrames - dec b - jr nz, .loop - xor a - ld [wDexSearchSlowpokeFrame], a - call DoDexSearchSlowpokeFrame - ld c, 32 - call DelayFrames - ret - -.FrameIDs: ; 441fc - ; frame ID, duration - db 0, 7 - db 1, 7 - db 2, 7 - db 3, 7 - db 4, 7 - db -2 - -DoDexSearchSlowpokeFrame: ; 44207 - ld a, [wDexSearchSlowpokeFrame] - ld hl, .SlowpokeSpriteData - ld de, Sprite01 -.loop - ld a, [hli] - cp -1 - ret z - ld [de], a ; y - inc de - ld a, [hli] - ld [de], a ; x - inc de - ld a, [wDexSearchSlowpokeFrame] - ld b, a - add a - add b - add [hl] - inc hl - ld [de], a ; tile id - inc de - ld a, [hli] - ld [de], a ; attributes - inc de - jr .loop - -.SlowpokeSpriteData: ; 44228 - dsprite 11, 0, 9, 0, $00, 0 - dsprite 11, 0, 10, 0, $01, 0 - dsprite 11, 0, 11, 0, $02, 0 - dsprite 12, 0, 9, 0, $10, 0 - dsprite 12, 0, 10, 0, $11, 0 - dsprite 12, 0, 11, 0, $12, 0 - dsprite 13, 0, 9, 0, $20, 0 - dsprite 13, 0, 10, 0, $21, 0 - dsprite 13, 0, 11, 0, $22, 0 - db -1 - -DisplayDexEntry: ; 4424d - call GetPokemonName - hlcoord 9, 3 - call PlaceString ; mon species - ld a, [wd265] - ld b, a - call GetDexEntryPointer - ld a, b - push af - hlcoord 9, 5 - call FarString ; dex species - ld h, b - ld l, c - push de -; Print dex number - hlcoord 2, 8 - ld a, $5c ; No - ld [hli], a - ld a, $5d ; . - ld [hli], a - ld de, wd265 - lb bc, PRINTNUM_LEADINGZEROS | 1, 3 - call PrintNum -; Check to see if we caught it. Get out of here if we haven't. - ld a, [wd265] - dec a - call CheckCaughtMon - pop hl - pop bc - ret z -; Get the height of the Pokemon. - ld a, [CurPartySpecies] - ld [CurSpecies], a - inc hl - ld a, b - push af - push hl - call GetFarHalfword - ld d, l - ld e, h - pop hl - inc hl - inc hl - ld a, d - or e - jr z, .skip_height - push hl - push de - ld hl, sp+$0 - ld d, h - ld e, l - hlcoord 12, 7 - lb bc, 2, PRINTNUM_MONEY | 4 - call PrintNum - hlcoord 14, 7 - ld [hl], $5e ; ft symbol - pop af - pop hl - -.skip_height - pop af - push af - inc hl - push hl - dec hl - call GetFarHalfword - ld d, l - ld e, h - ld a, e - or d - jr z, .skip_weight - push de - ld hl, sp+$0 - ld d, h - ld e, l - hlcoord 11, 9 - lb bc, 2, PRINTNUM_RIGHTALIGN | 5 - call PrintNum - pop de - -.skip_weight -; Page 1 - lb bc, 5, SCREEN_WIDTH - 2 - hlcoord 2, 11 - call ClearBox - hlcoord 1, 10 - ld bc, SCREEN_WIDTH - 1 - ld a, $61 ; horizontal divider - call ByteFill - ; page number - hlcoord 1, 9 - ld [hl], $55 - inc hl - ld [hl], $55 - hlcoord 1, 10 - ld [hl], $56 ; P. - inc hl - ld [hl], $57 ; 1 - pop de - inc de - pop af - hlcoord 2, 11 - push af - call FarString - pop bc - ld a, [wPokedexStatus] - or a ; check for page 2 - ret z - -; Page 2 - push bc - push de - lb bc, 5, SCREEN_WIDTH - 2 - hlcoord 2, 11 - call ClearBox - hlcoord 1, 10 - ld bc, SCREEN_WIDTH - 1 - ld a, $61 - call ByteFill - ; page number - hlcoord 1, 9 - ld [hl], $55 - inc hl - ld [hl], $55 - hlcoord 1, 10 - ld [hl], $56 ; P. - inc hl - ld [hl], $58 ; 2 - pop de - inc de - pop af - hlcoord 2, 11 - call FarString - ret - -String_44331: ; 44331 - db "#@" - -GetDexEntryPointer: ; 44333 -; return dex entry pointer b:de - push hl - ld hl, PokedexDataPointerTable - ld a, b - dec a - ld d, 0 - ld e, a - add hl, de - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - push de - rlca - rlca - maskbits NUM_DEX_ENTRY_BANKS - ld hl, .PokedexEntryBanks - ld d, 0 - ld e, a - add hl, de - ld b, [hl] - pop de - pop hl - ret - -.PokedexEntryBanks: ; 44351 - db BANK(PokedexEntries1) - db BANK(PokedexEntries2) - db BANK(PokedexEntries3) - db BANK(PokedexEntries4) - -GetDexEntryPagePointer: ; 44355 - call GetDexEntryPointer ; b:de - push hl - ld h, d - ld l, e -; skip species name -.loop1 - ld a, b - call GetFarByte - inc hl - cp "@" - jr nz, .loop1 -; skip height and weight -rept 4 - inc hl -endr -; if c != 1: skip entry - dec c - jr z, .done -; skip entry -.loop2 - ld a, b - call GetFarByte - inc hl - cp "@" - jr nz, .loop2 - -.done - ld d, h - ld e, l - pop hl - ret diff --git a/engine/pokedex_3.asm b/engine/pokedex_3.asm deleted file mode 100644 index dc52f83d3..000000000 --- a/engine/pokedex_3.asm +++ /dev/null @@ -1,162 +0,0 @@ -LoadSGBPokedexGFX: ; 1ddf1c - ld hl, SGBPokedexGFX_LZ - ld de, vTiles2 tile $31 - call Decompress - ret - -LoadSGBPokedexGFX2: ; 1ddf26 (77:5f26) - ld hl, SGBPokedexGFX_LZ - ld de, vTiles2 tile $31 - lb bc, BANK(SGBPokedexGFX_LZ), 58 - call DecompressRequest2bpp - ret - -SGBPokedexGFX_LZ: ; 1ddf33 -INCBIN "gfx/pokedex/sgb.2bpp.lz" - -LoadQuestionMarkPic: ; 1de0d7 - ld hl, .QuestionMarkLZ - ld de, sScratch - call Decompress - ret - -.QuestionMarkLZ: ; 1de0e1 -INCBIN "gfx/pokemon/questionmark/front.2bpp.lz" - -DrawPokedexListWindow: ; 1de171 (77:6171) - ld a, $32 - hlcoord 0, 17 - ld bc, 12 - call ByteFill - hlcoord 0, 1 - lb bc, 15, 11 - call ClearBox - ld a, $34 - hlcoord 0, 0 - ld bc, 11 - call ByteFill - ld a, $39 - hlcoord 0, 16 - ld bc, 11 - call ByteFill - hlcoord 5, 0 - ld [hl], $3f - hlcoord 5, 16 - ld [hl], $40 - ld a, [wCurrentDexMode] - cp DEXMODE_OLD - jr z, .OldMode -; scroll bar - hlcoord 11, 0 - ld [hl], $50 - ld a, $51 - hlcoord 11, 1 - ld b, SCREEN_HEIGHT - 3 - call Bank77_FillColumn - ld [hl], $52 - jr .Done - -.OldMode: -; no scroll bar - hlcoord 11, 0 - ld [hl], $66 - ld a, $67 - hlcoord 11, 1 - ld b, SCREEN_HEIGHT - 3 - call Bank77_FillColumn - ld [hl], $68 -.Done: - ret - -DrawPokedexSearchResultsWindow: ; 1de1d1 (77:61d1) - ld a, $34 - hlcoord 0, 0 - ld bc, 11 - call ByteFill - ld a, $39 - hlcoord 0, 10 - ld bc, 11 - call ByteFill - hlcoord 5, 0 - ld [hl], $3f - hlcoord 5, 10 - ld [hl], $40 - hlcoord 11, 0 - ld [hl], $66 - ld a, $67 - hlcoord 11, 1 - ld b, SCREEN_HEIGHT / 2 - call Bank77_FillColumn - ld [hl], $68 - ld a, $34 - hlcoord 0, 11 - ld bc, 11 - call ByteFill - ld a, $39 - hlcoord 0, 17 - ld bc, 11 - call ByteFill - hlcoord 11, 11 - ld [hl], $66 - ld a, $67 - hlcoord 11, 12 - ld b, 5 - call Bank77_FillColumn - ld [hl], $68 - hlcoord 0, 12 - lb bc, 5, 11 - call ClearBox - ld de, .esults_D - hlcoord 0, 12 - call PlaceString - ret - -.esults_D ; 1de23c -; (SEARCH R) - db "ESULTS" - next "" -; (### FOUN) - next "D!@" - -DrawDexEntryScreenRightEdge: ; 1de247 - ld a, [hBGMapAddress] - ld l, a - ld a, [hBGMapAddress + 1] - ld h, a - push hl - inc hl - ld a, l - ld [hBGMapAddress], a - ld a, h - ld [hBGMapAddress + 1], a - hlcoord 19, 0 - ld [hl], $66 - hlcoord 19, 1 - ld a, $67 - ld b, 15 - call Bank77_FillColumn - ld [hl], $68 - hlcoord 19, 17 - ld [hl], $3c - xor a - ld b, SCREEN_HEIGHT - hlcoord 19, 0, AttrMap - call Bank77_FillColumn - call WaitBGMap2 - pop hl - ld a, l - ld [hBGMapAddress], a - ld a, h - ld [hBGMapAddress + 1], a - ret - -Bank77_FillColumn: ; 1de27f - push de - ld de, SCREEN_WIDTH -.loop - ld [hl], a - add hl, de - dec b - jr nz, .loop - pop de - ret diff --git a/engine/routines/newpokedexentry.asm b/engine/routines/newpokedexentry.asm deleted file mode 100644 index d6b755200..000000000 --- a/engine/routines/newpokedexentry.asm +++ /dev/null @@ -1,52 +0,0 @@ -NewPokedexEntry: ; fb877 - ld a, [hMapAnims] - push af - xor a - ld [hMapAnims], a - call LowVolume - call ClearBGPalettes - call ClearTileMap - call UpdateSprites - call ClearSprites - ld a, [wPokedexStatus] - push af - ld a, [hSCX] - add POKEDEX_SCX - ld [hSCX], a - xor a - ld [wPokedexStatus], a - farcall _NewPokedexEntry - call WaitPressAorB_BlinkCursor - ld a, 1 ; page 2 - ld [wPokedexStatus], a - farcall DisplayDexEntry - call WaitPressAorB_BlinkCursor - pop af - ld [wPokedexStatus], a - call MaxVolume - call RotateThreePalettesRight - ld a, [hSCX] - add -POKEDEX_SCX - ld [hSCX], a - call .ReturnFromDexRegistration - pop af - ld [hMapAnims], a - ret -; fb8c8 - -.ReturnFromDexRegistration: ; fb8c8 - call ClearTileMap - call LoadFontsExtra - call LoadStandardFont - farcall Pokedex_PlaceFrontpicTopLeftCorner - call WaitBGMap2 - farcall GetEnemyMonDVs - ld a, [hli] - ld [TempMonDVs], a - ld a, [hl] - ld [TempMonDVs + 1], a - ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS - call GetSGBLayout - call SetPalettes - ret -; fb8f1 diff --git a/engine/unown_dex.asm b/engine/unown_dex.asm deleted file mode 100755 index dc6db9dc6..000000000 --- a/engine/unown_dex.asm +++ /dev/null @@ -1,52 +0,0 @@ -UpdateUnownDex: ; fba18 - ld a, [UnownLetter] - ld c, a - ld b, NUM_UNOWN - ld hl, UnownDex -.loop - ld a, [hli] - and a - jr z, .done - cp c - ret z - dec b - jr nz, .loop - ret - -.done - dec hl - ld [hl], c - ret -; fba2e - -PrintUnownWord: ; fba2e (3e:7a2e) - hlcoord 4, 15 - ld bc, 12 - ld a, " " - call ByteFill - ld a, [wDexCurrentUnownIndex] - ld e, a - ld d, 0 - ld hl, UnownDex - add hl, de - ld a, [hl] - ld e, a - ld d, 0 - ld hl, UnownWords - add hl, de - add hl, de - ld a, [hli] - ld e, a - ld d, [hl] - hlcoord 4, 15 -.loop - ld a, [de] - cp -1 - ret z - inc de - ld [hli], a - jr .loop -; fba5a (3e:7a5a) - - -INCLUDE "data/unown_words.asm" -- cgit v1.2.3 From 5ddea59ec5637f51637af321bd41c855493f21b5 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sun, 21 Jan 2018 20:10:38 -0500 Subject: wGBCOnlyDecompressBuffer --- engine/gbc_only.asm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engine') diff --git a/engine/gbc_only.asm b/engine/gbc_only.asm index 9aa8a0d1a..badd953aa 100644 --- a/engine/gbc_only.asm +++ b/engine/gbc_only.asm @@ -10,7 +10,7 @@ GBCOnlyScreen: ; 4ea82 call ClearTileMap ld hl, GBCOnlyGFX - ld de, wDecompressBuffer + ld de, wGBCOnlyDecompressBuffer ld a, [rSVBK] push af ld a, 0 ; this has the same effect as selecting bank 1 @@ -19,9 +19,9 @@ GBCOnlyScreen: ; 4ea82 pop af ld [rSVBK], a - ld de, wDecompressBuffer + ld de, wGBCOnlyDecompressBuffer ld hl, vTiles2 - lb bc, BANK(GBCOnlyGFX), $54 + lb bc, BANK(GBCOnlyGFX), 84 call Get2bpp ld de, Font -- cgit v1.2.3