summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpikalaxalt <PikalaxALT@gmail.com>2016-05-31 15:55:39 -0400
committerpikalaxalt <PikalaxALT@gmail.com>2016-05-31 15:55:39 -0400
commit439efda1ba940b010786be1186007355adf23965 (patch)
tree0becd0b5980b180a0abd11377d1ed35ae3814bda
parent45cb263360f3242db5538367ebf8035632d97534 (diff)
Champion's room; resolve predefs
-rw-r--r--constants.asm1
-rwxr-xr-xconstants/hide_show_constants.asm4
-rw-r--r--constants/predef_constants.asm101
-rwxr-xr-xdata/hide_show_data.asm488
-rw-r--r--data/map_header_banks.asm2
-rw-r--r--data/map_header_pointers.asm2
-rw-r--r--engine/bank3d.asm546
-rw-r--r--engine/battle/bank3d_battle.asm4
-rw-r--r--engine/overworld/item.asm2
-rw-r--r--engine/overworld/missable_objects.asm8
-rw-r--r--engine/overworld/try_pushing_boulder.asm1
-rwxr-xr-xengine/predefs.asm221
-rw-r--r--home.asm10
-rw-r--r--home/overworld.asm2084
-rw-r--r--macros.asm10
-rwxr-xr-xmain.asm27
-rwxr-xr-xscripts/gary.asm26
17 files changed, 1726 insertions, 1811 deletions
diff --git a/constants.asm b/constants.asm
index ba2d76c6..b4e27a91 100644
--- a/constants.asm
+++ b/constants.asm
@@ -27,7 +27,6 @@ INCLUDE "constants/credits_constants.asm"
INCLUDE "constants/music_constants.asm"
INCLUDE "constants/tilesets.asm"
INCLUDE "constants/starter_mons.asm"
-INCLUDE "constants/predef_constants.asm"
INCLUDE "constants/event_constants.asm"
INCLUDE "constants/event_macros.asm"
INCLUDE "constants/pikachu_emotion_constants.asm" \ No newline at end of file
diff --git a/constants/hide_show_constants.asm b/constants/hide_show_constants.asm
index f41477a5..4297bc2e 100755
--- a/constants/hide_show_constants.asm
+++ b/constants/hide_show_constants.asm
@@ -224,9 +224,9 @@ const_value SET $8d
const HS_UNKNOWN_DUNGEON_3_ITEM_2 ; D7
const HS_VICTORY_ROAD_1_ITEM_1 ; D8
const HS_VICTORY_ROAD_1_ITEM_2 ; D9
- const HS_CHAMPIONS_ROOM_OAK ; DA
-const_value SET $df
+const_value SET $de
+ const HS_CHAMPIONS_ROOM_OAK ; DE
const HS_SEAFOAM_ISLANDS_1_BOULDER_1 ; DF
const HS_SEAFOAM_ISLANDS_1_BOULDER_2 ; E0
const HS_SEAFOAM_ISLANDS_2_BOULDER_1 ; E1
diff --git a/constants/predef_constants.asm b/constants/predef_constants.asm
deleted file mode 100644
index 76ff24a9..00000000
--- a/constants/predef_constants.asm
+++ /dev/null
@@ -1,101 +0,0 @@
-const_value = 0
-
- predef_const DrawPlayerHUDAndHPBar
- predef_const CopyUncompressedPicToTilemap
- predef_const AnimateSendingOutMon
- predef_const ScaleSpriteByTwo
- predef_const LoadMonBackPic
- predef_const CopyDownscaledMonTiles
- predef_const LoadMissableObjects
- predef_const HealParty
- predef_const MoveAnimation; 08 play move animation
- predef_const DivideBCDPredef
- predef_const DivideBCDPredef2
- predef_const AddBCDPredef
- predef_const SubBCDPredef
- predef_const DivideBCDPredef3
- predef_const DivideBCDPredef4
- predef_const InitPlayerData
- predef_const FlagActionPredef ; 10
- predef_const HideObject ; 11
- predef_const IsObjectHidden
- predef_const ApplyOutOfBattlePoisonDamage
- predef_const AnyPartyAlive
- predef_const ShowObject
- predef_const ShowObject2
- predef_const ReplaceTileBlock
- predef_const InitPlayerData2 ; 18
- predef_const LoadTilesetHeader
- predef_const LearnMoveFromLevelUp
- predef_const LearnMove
- predef_const GetQuantityOfItemInBag
- predef_const CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; for these two, the bank number is actually 0
- predef_const GiveItem
- predef_const InvertBGPal_4Frames
- predef_const FindPathToPlayer
- predef_const PredefShakeScreenVertically
- predef_const CalcPositionOfPlayerRelativeToNPC
- predef_const ConvertNPCMovementDirectionsToJoypadMasks
- predef_const PredefShakeScreenHorizontally
- predef_const UpdateHPBar
- predef_const HPBarLength
- predef_const Diploma_TextBoxBorder
- predef_const DoubleOrHalveSelectedStats
- predef_const ShowPokedexMenu
- predef_const EvolutionAfterBattle
- predef_const SaveSAVtoSRAM0
- predef_const InitOpponent
- predef_const CableClub_Run
- predef_const DrawBadges
- predef_const ExternalClockTradeAnim
- predef_const BattleTransition
- predef_const CopyTileIDsFromList
- predef_const PlayIntro
- predef_const Func_79869
- predef_const FlashScreen
- predef_const GetTileAndCoordsInFrontOfPlayer
- predef_const StatusScreen
- predef_const StatusScreen2
- predef_const InternalClockTradeAnim
- predef_const TrainerEngage
- predef_const IndexToPokedex
- predef_const DisplayPicCenteredOrUpperRight; 3B display pic?
- predef_const UsedCut
- predef_const ShowPokedexData
- predef_const WriteMonMoves
- predef_const SaveSAV
- predef_const LoadSGB
- predef_const MarkTownVisitedAndLoadMissableObjects
- predef_const SetPartyMonTypes
- predef_const CanLearnTM
- predef_const TMToMove
- predef_const _RunPaletteCommand
- predef_const StarterDex ; 46
- predef_const _AddPartyMon
- predef_const UpdateHPBar2
- predef_const DrawEnemyHUDAndHPBar
- predef_const LoadTownMap_Nest
- predef_const PrintMonType
- predef_const EmotionBubble; 4C player exclamation
- predef_const EmptyFunc3; return immediately
- predef_const AskName
- predef_const PewterGuys
- predef_const SaveSAVtoSRAM2
- predef_const LoadSAVCheckSum2
- predef_const LoadSAV
- predef_const SaveSAVtoSRAM1
- predef_const DoInGameTradeDialogue ; 54 initiate trade
- predef_const HallOfFamePC
- predef_const DisplayDexRating
- predef_const _LeaveMapAnim ; wrong bank
- predef_const EnterMapAnim ; wrong bank
- predef_const GetTileTwoStepsInFrontOfPlayer
- predef_const CheckForCollisionWhenPushingBoulder
- predef_const PrintStrengthTxt
- predef_const PickUpItem
- predef_const PrintMoveType
- predef_const LoadMovePPs
- predef_const DrawHP ; 5F
- predef_const DrawHP2
- predef_const Func_1c9c6
- predef_const OaksAideScript
diff --git a/data/hide_show_data.asm b/data/hide_show_data.asm
index 71a76e47..2387218b 100755
--- a/data/hide_show_data.asm
+++ b/data/hide_show_data.asm
@@ -1,7 +1,7 @@
; data for default hidden/shown
; objects for each map ($00-$F8)
-; Table of 2-Byte pointers, one pointer per map,
+; Table of 2-Byte pointers, one pointer per map,
; goes up to Map_F7, ends with $FFFF.
; points to table listing all missable object in the area
MapHSPointers: ; c69b (3:469b)
@@ -267,327 +267,327 @@ MapHSPointers: ; c69b (3:469b)
; This Data is loaded into RAM at wd5ce-$D5F?. (wMissableObjectList)
; These constants come from the bytes for Predef functions:
-Hide equ $11
-Show equ $15
+Hide EQU $11 ; (HideObjectPredef - PredefPointers) / 3
+Show EQU $15 ; (ShowObjectPredef - PredefPointers) / 3
MapHSXX: ; c88f (3:488f)
- db $FF,$FF,$FF
+ db $FF, $FF, $FF
MapHS00: ; c892 (3:4892)
- db PALLET_TOWN,$01,Hide
+ db PALLET_TOWN, $01, Hide
MapHS01: ; c895 (3:4895)
- db VIRIDIAN_CITY,$05,Show
- db VIRIDIAN_CITY,$07,Hide
- db VIRIDIAN_CITY,$08,Hide
+ db VIRIDIAN_CITY, $05, Show
+ db VIRIDIAN_CITY, $07, Hide
+ db VIRIDIAN_CITY, $08, Hide
MapHS02: ; c89e (3:489e)
- db PEWTER_CITY,$03,Show
- db PEWTER_CITY,$05,Show
+ db PEWTER_CITY, $03, Show
+ db PEWTER_CITY, $05, Show
MapHS03: ; c8a4 (3:48a4)
- db CERULEAN_CITY,$01,Hide
- db CERULEAN_CITY,$02,Show
- db CERULEAN_CITY,$06,Hide
- db CERULEAN_CITY,$0A,Show
- db CERULEAN_CITY,$0B,Show
+ db CERULEAN_CITY, $01, Hide
+ db CERULEAN_CITY, $02, Show
+ db CERULEAN_CITY, $06, Hide
+ db CERULEAN_CITY, $0A, Show
+ db CERULEAN_CITY, $0B, Show
MapHS0A: ; c8b3 (3:48b3)
- db SAFFRON_CITY,$01,Show
- db SAFFRON_CITY,$02,Show
- db SAFFRON_CITY,$03,Show
- db SAFFRON_CITY,$04,Show
- db SAFFRON_CITY,$05,Show
- db SAFFRON_CITY,$06,Show
- db SAFFRON_CITY,$07,Show
- db SAFFRON_CITY,$08,Hide
- db SAFFRON_CITY,$09,Hide
- db SAFFRON_CITY,$0A,Hide
- db SAFFRON_CITY,$0B,Hide
- db SAFFRON_CITY,$0C,Hide
- db SAFFRON_CITY,$0D,Hide
- db SAFFRON_CITY,$0E,Show
- db SAFFRON_CITY,$0F,Hide
+ db SAFFRON_CITY, $01, Show
+ db SAFFRON_CITY, $02, Show
+ db SAFFRON_CITY, $03, Show
+ db SAFFRON_CITY, $04, Show
+ db SAFFRON_CITY, $05, Show
+ db SAFFRON_CITY, $06, Show
+ db SAFFRON_CITY, $07, Show
+ db SAFFRON_CITY, $08, Hide
+ db SAFFRON_CITY, $09, Hide
+ db SAFFRON_CITY, $0A, Hide
+ db SAFFRON_CITY, $0B, Hide
+ db SAFFRON_CITY, $0C, Hide
+ db SAFFRON_CITY, $0D, Hide
+ db SAFFRON_CITY, $0E, Show
+ db SAFFRON_CITY, $0F, Hide
MapHS0D: ; c8e0 (3:48e0)
- db ROUTE_2,$01,Show
- db ROUTE_2,$02,Show
+ db ROUTE_2, $01, Show
+ db ROUTE_2, $02, Show
MapHS0F: ; c8e6 (3:48e6)
- db ROUTE_4,$03,Show
+ db ROUTE_4, $03, Show
MapHS14: ; c8e9 (3:48e9)
- db ROUTE_9,$0A,Show
+ db ROUTE_9, $0A, Show
MapHS17: ; c8ec (3:48ec)
- db ROUTE_12,$01,Show
- db ROUTE_12,$09,Show
- db ROUTE_12,$0A,Show
+ db ROUTE_12, $01, Show
+ db ROUTE_12, $09, Show
+ db ROUTE_12, $0A, Show
MapHS1A: ; c8f5 (3:48f5)
- db ROUTE_15,$0B,Show
+ db ROUTE_15, $0B, Show
MapHS1B: ; c8f8 (3:48f8)
- db ROUTE_16,$07,Show
+ db ROUTE_16, $07, Show
MapHS21: ; c8fb (3:48fb)
- db ROUTE_22,$01,Hide
- db ROUTE_22,$02,Hide
+ db ROUTE_22, $01, Hide
+ db ROUTE_22, $02, Hide
MapHS23: ; c901 (3:4901)
- db ROUTE_24,$01,Show
- db ROUTE_24,$08,Show
+ db ROUTE_24, $01, Show
+ db ROUTE_24, $08, Show
MapHS24: ; c907 (3:4907)
- db ROUTE_25,$0A,Show
+ db ROUTE_25, $0A, Show
MapHS27: ; c90a (3:490a)
- db BLUES_HOUSE,$01,Show
- db BLUES_HOUSE,$02,Hide
- db BLUES_HOUSE,$03,Show
+ db BLUES_HOUSE, $01, Show
+ db BLUES_HOUSE, $02, Hide
+ db BLUES_HOUSE, $03, Show
MapHS28: ; c913 (3:4913)
- db OAKS_LAB,$01,Show
- db OAKS_LAB,$02,Show
- db OAKS_LAB,$03,Hide
- db OAKS_LAB,$04,Show
- db OAKS_LAB,$05,Show
- db OAKS_LAB,$06,Hide
+ db OAKS_LAB, $01, Show
+ db OAKS_LAB, $02, Show
+ db OAKS_LAB, $03, Hide
+ db OAKS_LAB, $04, Show
+ db OAKS_LAB, $05, Show
+ db OAKS_LAB, $06, Hide
MapHS2D: ; c925 (3:4925)
- db VIRIDIAN_GYM,$01,Show
- db VIRIDIAN_GYM,$0B,Show
+ db VIRIDIAN_GYM, $01, Show
+ db VIRIDIAN_GYM, $0B, Show
MapHS34: ; c92b (3:492b)
- db MUSEUM_1F,$05,Show
+ db MUSEUM_1F, $05, Show
MapHS3F: ; c92e (3:492e) ; bulbasaur adoption house
- db CERULEAN_HOUSE_1,$02,Show
+ db CERULEAN_HOUSE_1, $02, Show
MapHSE4: ; c931 (3:4931)
- db UNKNOWN_DUNGEON_1,$01,Show
- db UNKNOWN_DUNGEON_1,$02,Show
- db UNKNOWN_DUNGEON_1,$03,Show
- db UNKNOWN_DUNGEON_1,$04,Show
+ db UNKNOWN_DUNGEON_1, $01, Show
+ db UNKNOWN_DUNGEON_1, $02, Show
+ db UNKNOWN_DUNGEON_1, $03, Show
+ db UNKNOWN_DUNGEON_1, $04, Show
MapHS8F: ; c93d (3:493d)
- db POKEMONTOWER_2,$01,Show
+ db POKEMONTOWER_2, $01, Show
MapHS90: ; c940 (3:4940)
- db POKEMONTOWER_3,$04,Show
+ db POKEMONTOWER_3, $04, Show
MapHS91: ; c943 (3:4943)
- db POKEMONTOWER_4,$04,Show
- db POKEMONTOWER_4,$05,Show
- db POKEMONTOWER_4,$06,Show
+ db POKEMONTOWER_4, $04, Show
+ db POKEMONTOWER_4, $05, Show
+ db POKEMONTOWER_4, $06, Show
MapHS92: ; c94c (3:494c)
- db POKEMONTOWER_5,$06,Show
+ db POKEMONTOWER_5, $06, Show
MapHS93: ; c94f (3:494f)
- db POKEMONTOWER_6,$04,Show
- db POKEMONTOWER_6,$05,Show
+ db POKEMONTOWER_6, $04, Show
+ db POKEMONTOWER_6, $05, Show
MapHS94: ; c955 (3:4955)
- db POKEMONTOWER_7,$01,Hide ; jessie & james?
- db POKEMONTOWER_7,$02,Hide
- db POKEMONTOWER_7,$03,Show
+ db POKEMONTOWER_7, $01, Hide ; jessie & james?
+ db POKEMONTOWER_7, $02, Hide
+ db POKEMONTOWER_7, $03, Show
MapHS95: ; c95e (3:495e)
- db LAVENDER_HOUSE_1,$05,Hide
+ db LAVENDER_HOUSE_1, $05, Hide
MapHS84: ; c961 (3:4961)
- db CELADON_MANSION_5,$02,Show
+ db CELADON_MANSION_5, $02, Show
MapHS87: ; c964 (3:4964)
- db GAME_CORNER,$0B,Show
+ db GAME_CORNER, $0B, Show
MapHS9B: ; c967 (3:4967)
- db FUCHSIA_HOUSE_2,$02,Show
+ db FUCHSIA_HOUSE_2, $02, Show
MapHSA5: ; c96a (3:496a)
- db MANSION_1,$02,Show
- db MANSION_1,$03,Show
+ db MANSION_1, $02, Show
+ db MANSION_1, $03, Show
MapHSB1: ; c970 (3:4970)
- db FIGHTING_DOJO,$06,Show
- db FIGHTING_DOJO,$07,Show
+ db FIGHTING_DOJO, $06, Show
+ db FIGHTING_DOJO, $07, Show
MapHSB5: ; c976 (3:4976)
- db SILPH_CO_1F,$01,Hide
+ db SILPH_CO_1F, $01, Hide
MapHS53: ; c979 (3:4979)
- db POWER_PLANT,$01,Show
- db POWER_PLANT,$02,Show
- db POWER_PLANT,$03,Show
- db POWER_PLANT,$04,Show
- db POWER_PLANT,$05,Show
- db POWER_PLANT,$06,Show
- db POWER_PLANT,$07,Show
- db POWER_PLANT,$08,Show
- db POWER_PLANT,$09,Show
- db POWER_PLANT,$0A,Show
- db POWER_PLANT,$0B,Show
- db POWER_PLANT,$0C,Show
- db POWER_PLANT,$0D,Show
- db POWER_PLANT,$0E,Show
+ db POWER_PLANT, $01, Show
+ db POWER_PLANT, $02, Show
+ db POWER_PLANT, $03, Show
+ db POWER_PLANT, $04, Show
+ db POWER_PLANT, $05, Show
+ db POWER_PLANT, $06, Show
+ db POWER_PLANT, $07, Show
+ db POWER_PLANT, $08, Show
+ db POWER_PLANT, $09, Show
+ db POWER_PLANT, $0A, Show
+ db POWER_PLANT, $0B, Show
+ db POWER_PLANT, $0C, Show
+ db POWER_PLANT, $0D, Show
+ db POWER_PLANT, $0E, Show
MapHSC2: ; c9a3 (3:49a3)
- db VICTORY_ROAD_2,$06,Show
- db VICTORY_ROAD_2,$07,Show
- db VICTORY_ROAD_2,$08,Show
- db VICTORY_ROAD_2,$09,Show
- db VICTORY_ROAD_2,$0A,Show
- db VICTORY_ROAD_2,$0D,Show
+ db VICTORY_ROAD_2, $06, Show
+ db VICTORY_ROAD_2, $07, Show
+ db VICTORY_ROAD_2, $08, Show
+ db VICTORY_ROAD_2, $09, Show
+ db VICTORY_ROAD_2, $0A, Show
+ db VICTORY_ROAD_2, $0D, Show
MapHS58: ; c9b5 (3:49b5)
- db BILLS_HOUSE,$01,Show
- db BILLS_HOUSE,$02,Hide
- db BILLS_HOUSE,$03,Hide
+ db BILLS_HOUSE, $01, Show
+ db BILLS_HOUSE, $02, Hide
+ db BILLS_HOUSE, $03, Hide
MapHS33: ; c9be (3:49be)
- db VIRIDIAN_FOREST,$07,Show
- db VIRIDIAN_FOREST,$08,Show
- db VIRIDIAN_FOREST,$09,Show
+ db VIRIDIAN_FOREST, $07, Show
+ db VIRIDIAN_FOREST, $08, Show
+ db VIRIDIAN_FOREST, $09, Show
MapHS3B: ; c9c7 (3:49c7)
- db MT_MOON_1,$08,Show
- db MT_MOON_1,$09,Show
- db MT_MOON_1,$0A,Show
- db MT_MOON_1,$0B,Show
- db MT_MOON_1,$0C,Show
- db MT_MOON_1,$0D,Show
+ db MT_MOON_1, $08, Show
+ db MT_MOON_1, $09, Show
+ db MT_MOON_1, $0A, Show
+ db MT_MOON_1, $0B, Show
+ db MT_MOON_1, $0C, Show
+ db MT_MOON_1, $0D, Show
MapHS3D: ; c9d9 (3:49d9)
- db MT_MOON_3,$02,Hide
- db MT_MOON_3,$06,Hide
- db MT_MOON_3,$07,Show
- db MT_MOON_3,$08,Show
- db MT_MOON_3,$09,Show
- db MT_MOON_3,$0A,Show
+ db MT_MOON_3, $02, Hide
+ db MT_MOON_3, $06, Hide
+ db MT_MOON_3, $07, Show
+ db MT_MOON_3, $08, Show
+ db MT_MOON_3, $09, Show
+ db MT_MOON_3, $0A, Show
MapHS60: ; c9eb (3:49eb)
- db SS_ANNE_2,$02,Hide
+ db SS_ANNE_2, $02, Hide
MapHS66: ; c9ee (3:49ee)
- db SS_ANNE_8,$0A,Show
+ db SS_ANNE_8, $0A, Show
MapHS67: ; c9f1 (3:49f1)
- db SS_ANNE_9,$06,Show
- db SS_ANNE_9,$09,Show
+ db SS_ANNE_9, $06, Show
+ db SS_ANNE_9, $09, Show
MapHS68: ; c9f7 (3:49f7)
- db SS_ANNE_10,$09,Show
- db SS_ANNE_10,$0A,Show
- db SS_ANNE_10,$0B,Show
+ db SS_ANNE_10, $09, Show
+ db SS_ANNE_10, $0A, Show
+ db SS_ANNE_10, $0B, Show
MapHSC6: ; ca00 (3:4a00)
- db VICTORY_ROAD_3,$05,Show
- db VICTORY_ROAD_3,$06,Show
- db VICTORY_ROAD_3,$0A,Show
+ db VICTORY_ROAD_3, $05, Show
+ db VICTORY_ROAD_3, $06, Show
+ db VICTORY_ROAD_3, $0A, Show
MapHSC7: ; ca09 (3:4a09)
- db ROCKET_HIDEOUT_1,$06,Show
- db ROCKET_HIDEOUT_1,$07,Show
+ db ROCKET_HIDEOUT_1, $06, Show
+ db ROCKET_HIDEOUT_1, $07, Show
MapHSC8: ; ca0f (3:4a0f)
- db ROCKET_HIDEOUT_2,$02,Show
- db ROCKET_HIDEOUT_2,$03,Show
- db ROCKET_HIDEOUT_2,$04,Show
- db ROCKET_HIDEOUT_2,$05,Show
+ db ROCKET_HIDEOUT_2, $02, Show
+ db ROCKET_HIDEOUT_2, $03, Show
+ db ROCKET_HIDEOUT_2, $04, Show
+ db ROCKET_HIDEOUT_2, $05, Show
MapHSC9: ; ca1b (3:4a1b)
- db ROCKET_HIDEOUT_3,$03,Show
- db ROCKET_HIDEOUT_3,$04,Show
+ db ROCKET_HIDEOUT_3, $03, Show
+ db ROCKET_HIDEOUT_3, $04, Show
MapHSCA: ; ca21 (3:4a21)
- db ROCKET_HIDEOUT_4,$01,Show
- db ROCKET_HIDEOUT_4,$02,Hide
- db ROCKET_HIDEOUT_4,$03,Hide
- db ROCKET_HIDEOUT_4,$05,Show
- db ROCKET_HIDEOUT_4,$06,Show
- db ROCKET_HIDEOUT_4,$07,Show
- db ROCKET_HIDEOUT_4,$08,Hide
- db ROCKET_HIDEOUT_4,$09,Hide
+ db ROCKET_HIDEOUT_4, $01, Show
+ db ROCKET_HIDEOUT_4, $02, Hide
+ db ROCKET_HIDEOUT_4, $03, Hide
+ db ROCKET_HIDEOUT_4, $05, Show
+ db ROCKET_HIDEOUT_4, $06, Show
+ db ROCKET_HIDEOUT_4, $07, Show
+ db ROCKET_HIDEOUT_4, $08, Hide
+ db ROCKET_HIDEOUT_4, $09, Hide
MapHSCF: ; ca39 (3:4a39)
- db SILPH_CO_2F,$01,Show
- db SILPH_CO_2F,$02,Show
- db SILPH_CO_2F,$03,Show
- db SILPH_CO_2F,$04,Show
- db SILPH_CO_2F,$05,Show
+ db SILPH_CO_2F, $01, Show
+ db SILPH_CO_2F, $02, Show
+ db SILPH_CO_2F, $03, Show
+ db SILPH_CO_2F, $04, Show
+ db SILPH_CO_2F, $05, Show
MapHSD0: ; ca48 (3:4a48)
- db SILPH_CO_3F,$02,Show
- db SILPH_CO_3F,$03,Show
- db SILPH_CO_3F,$04,Show
+ db SILPH_CO_3F, $02, Show
+ db SILPH_CO_3F, $03, Show
+ db SILPH_CO_3F, $04, Show
MapHSD1: ; ca51 (3:4a51)
- db SILPH_CO_4F,$02,Show
- db SILPH_CO_4F,$03,Show
- db SILPH_CO_4F,$04,Show
- db SILPH_CO_4F,$05,Show
- db SILPH_CO_4F,$06,Show
- db SILPH_CO_4F,$07,Show
+ db SILPH_CO_4F, $02, Show
+ db SILPH_CO_4F, $03, Show
+ db SILPH_CO_4F, $04, Show
+ db SILPH_CO_4F, $05, Show
+ db SILPH_CO_4F, $06, Show
+ db SILPH_CO_4F, $07, Show
MapHSD2: ; ca63 (3:4a63)
- db SILPH_CO_5F,$02,Show
- db SILPH_CO_5F,$03,Show
- db SILPH_CO_5F,$04,Show
- db SILPH_CO_5F,$05,Show
- db SILPH_CO_5F,$06,Show
- db SILPH_CO_5F,$07,Show
- db SILPH_CO_5F,$08,Show
+ db SILPH_CO_5F, $02, Show
+ db SILPH_CO_5F, $03, Show
+ db SILPH_CO_5F, $04, Show
+ db SILPH_CO_5F, $05, Show
+ db SILPH_CO_5F, $06, Show
+ db SILPH_CO_5F, $07, Show
+ db SILPH_CO_5F, $08, Show
MapHSD3: ; ca78 (3:4a78)
- db SILPH_CO_6F,$06,Show
- db SILPH_CO_6F,$07,Show
- db SILPH_CO_6F,$08,Show
- db SILPH_CO_6F,$09,Show
- db SILPH_CO_6F,$0A,Show
+ db SILPH_CO_6F, $06, Show
+ db SILPH_CO_6F, $07, Show
+ db SILPH_CO_6F, $08, Show
+ db SILPH_CO_6F, $09, Show
+ db SILPH_CO_6F, $0A, Show
MapHSD4: ; ca87 (3:4a87)
- db SILPH_CO_7F,$05,Show
- db SILPH_CO_7F,$06,Show
- db SILPH_CO_7F,$07,Show
- db SILPH_CO_7F,$08,Show
- db SILPH_CO_7F,$09,Show
- db SILPH_CO_7F,$0A,Show
- db SILPH_CO_7F,$0B,Show
- db SILPH_CO_7F,$0C,Show
+ db SILPH_CO_7F, $05, Show
+ db SILPH_CO_7F, $06, Show
+ db SILPH_CO_7F, $07, Show
+ db SILPH_CO_7F, $08, Show
+ db SILPH_CO_7F, $09, Show
+ db SILPH_CO_7F, $0A, Show
+ db SILPH_CO_7F, $0B, Show
+ db SILPH_CO_7F, $0C, Show
MapHSD5: ; ca9f (3:4a9f)
- db SILPH_CO_8F,$02,Show
- db SILPH_CO_8F,$03,Show
- db SILPH_CO_8F,$04,Show
+ db SILPH_CO_8F, $02, Show
+ db SILPH_CO_8F, $03, Show
+ db SILPH_CO_8F, $04, Show
MapHSE9: ; caa8 (3:4aa8)
- db SILPH_CO_9F,$02,Show
- db SILPH_CO_9F,$03,Show
- db SILPH_CO_9F,$04,Show
+ db SILPH_CO_9F, $02, Show
+ db SILPH_CO_9F, $03, Show
+ db SILPH_CO_9F, $04, Show
MapHSEA: ; cab1 (3:4ab1)
- db SILPH_CO_10F,$01,Show
- db SILPH_CO_10F,$02,Show
- db SILPH_CO_10F,$03,Show
- db SILPH_CO_10F,$04,Show
- db SILPH_CO_10F,$05,Show
- db SILPH_CO_10F,$06,Show
+ db SILPH_CO_10F, $01, Show
+ db SILPH_CO_10F, $02, Show
+ db SILPH_CO_10F, $03, Show
+ db SILPH_CO_10F, $04, Show
+ db SILPH_CO_10F, $05, Show
+ db SILPH_CO_10F, $06, Show
MapHSEB: ; cac3 (3:4ac3)
- db SILPH_CO_11F,$03,Show
- db SILPH_CO_11F,$04,Show
- db SILPH_CO_11F,$05,Show
- db SILPH_CO_11F,$06,Show
+ db SILPH_CO_11F, $03, Show
+ db SILPH_CO_11F, $04, Show
+ db SILPH_CO_11F, $05, Show
+ db SILPH_CO_11F, $06, Show
MapHSF4: ; cacf (3:4acf)
- db $F4,$02,Show
+ db $F4, $02, Show
MapHSD6: ; cad2 (3:4ad2)
- db MANSION_2,$02,Show
+ db MANSION_2, $02, Show
MapHSD7: ; cad5 (3:4ad5)
- db MANSION_3,$03,Show
- db MANSION_3,$04,Show
+ db MANSION_3, $03, Show
+ db MANSION_3, $04, Show
MapHSD8: ; cadb (3:4adb)
- db MANSION_4,$03,Show
- db MANSION_4,$04,Show
- db MANSION_4,$05,Show
- db MANSION_4,$06,Show
- db MANSION_4,$08,Show
+ db MANSION_4, $03, Show
+ db MANSION_4, $04, Show
+ db MANSION_4, $05, Show
+ db MANSION_4, $06, Show
+ db MANSION_4, $08, Show
MapHSD9: ; caea (3:4aea)
- db SAFARI_ZONE_EAST,$01,Show
- db SAFARI_ZONE_EAST,$02,Show
- db SAFARI_ZONE_EAST,$03,Show
- db SAFARI_ZONE_EAST,$04,Show
+ db SAFARI_ZONE_EAST, $01, Show
+ db SAFARI_ZONE_EAST, $02, Show
+ db SAFARI_ZONE_EAST, $03, Show
+ db SAFARI_ZONE_EAST, $04, Show
MapHSDA: ; caf6 (3:4af6)
- db SAFARI_ZONE_NORTH,$01,Show
- db SAFARI_ZONE_NORTH,$02,Show
+ db SAFARI_ZONE_NORTH, $01, Show
+ db SAFARI_ZONE_NORTH, $02, Show
MapHSDB: ; cafc (3:4afc)
- db SAFARI_ZONE_WEST,$01,Show
- db SAFARI_ZONE_WEST,$02,Show
- db SAFARI_ZONE_WEST,$03,Show
- db SAFARI_ZONE_WEST,$04,Show
+ db SAFARI_ZONE_WEST, $01, Show
+ db SAFARI_ZONE_WEST, $02, Show
+ db SAFARI_ZONE_WEST, $03, Show
+ db SAFARI_ZONE_WEST, $04, Show
MapHSDC: ; cb08 (3:4b08)
- db SAFARI_ZONE_CENTER,$01,Show
+ db SAFARI_ZONE_CENTER, $01, Show
MapHSE2: ; cb0b (3:4b0b)
- db UNKNOWN_DUNGEON_2,$01,Show
- db UNKNOWN_DUNGEON_2,$02,Show
- db UNKNOWN_DUNGEON_2,$03,Show
- db UNKNOWN_DUNGEON_2,$04,Show
+ db UNKNOWN_DUNGEON_2, $01, Show
+ db UNKNOWN_DUNGEON_2, $02, Show
+ db UNKNOWN_DUNGEON_2, $03, Show
+ db UNKNOWN_DUNGEON_2, $04, Show
MapHSE3: ; cb17 (3:4b17)
- db UNKNOWN_DUNGEON_3,$01,Show
- db UNKNOWN_DUNGEON_3,$02,Show
- db UNKNOWN_DUNGEON_3,$03,Show
- db UNKNOWN_DUNGEON_3,$04,Show
- db UNKNOWN_DUNGEON_3,$05,Show
+ db UNKNOWN_DUNGEON_3, $01, Show
+ db UNKNOWN_DUNGEON_3, $02, Show
+ db UNKNOWN_DUNGEON_3, $03, Show
+ db UNKNOWN_DUNGEON_3, $04, Show
+ db UNKNOWN_DUNGEON_3, $05, Show
MapHS6C: ; cb26 (3:4b26)
- db VICTORY_ROAD_1,$03,Show
- db VICTORY_ROAD_1,$04,Show
+ db VICTORY_ROAD_1, $03, Show
+ db VICTORY_ROAD_1, $04, Show
MapHS78: ; cb2c (3:4b2c)
- db CHAMPIONS_ROOM,$02,Hide
+ db CHAMPIONS_ROOM, $02, Hide
MapHSC0: ; cb2f (3:4b2f)
- db SEAFOAM_ISLANDS_1,$01,Show
- db SEAFOAM_ISLANDS_1,$02,Show
+ db SEAFOAM_ISLANDS_1, $01, Show
+ db SEAFOAM_ISLANDS_1, $02, Show
MapHS9F: ; cb35 (3:4b35)
- db SEAFOAM_ISLANDS_2,$01,Hide
- db SEAFOAM_ISLANDS_2,$02,Hide
+ db SEAFOAM_ISLANDS_2, $01, Hide
+ db SEAFOAM_ISLANDS_2, $02, Hide
MapHSA0: ; cb3b (3:4b3b)
- db SEAFOAM_ISLANDS_3,$01,Hide
- db SEAFOAM_ISLANDS_3,$02,Hide
+ db SEAFOAM_ISLANDS_3, $01, Hide
+ db SEAFOAM_ISLANDS_3, $02, Hide
MapHSA1: ; cb41 (3:4b41)
- db SEAFOAM_ISLANDS_4,$02,Show
- db SEAFOAM_ISLANDS_4,$03,Show
- db SEAFOAM_ISLANDS_4,$05,Hide
- db SEAFOAM_ISLANDS_4,$06,Hide
+ db SEAFOAM_ISLANDS_4, $02, Show
+ db SEAFOAM_ISLANDS_4, $03, Show
+ db SEAFOAM_ISLANDS_4, $05, Hide
+ db SEAFOAM_ISLANDS_4, $06, Hide
MapHSA2: ; cb4d (3:4b4d)
- db SEAFOAM_ISLANDS_5,$01,Hide
- db SEAFOAM_ISLANDS_5,$02,Hide
- db SEAFOAM_ISLANDS_5,$03,Show
+ db SEAFOAM_ISLANDS_5, $01, Hide
+ db SEAFOAM_ISLANDS_5, $02, Hide
+ db SEAFOAM_ISLANDS_5, $03, Show
MapHS27Copy: ; cb56 (3:4b56)
; doesn't seem to be referenced
- db BLUES_HOUSE,$01,Show
- db BLUES_HOUSE,$02,Hide
- db BLUES_HOUSE,$03,Show
+ db BLUES_HOUSE, $01, Show
+ db BLUES_HOUSE, $02, Hide
+ db BLUES_HOUSE, $03, Show
- db $FF,$01,Show \ No newline at end of file
+ db $FF, $01, Show \ No newline at end of file
diff --git a/data/map_header_banks.asm b/data/map_header_banks.asm
index 20b1e875..047dcc87 100644
--- a/data/map_header_banks.asm
+++ b/data/map_header_banks.asm
@@ -120,7 +120,7 @@ MapHeaderBanks:: ; fc3e4 (3f:43e4)
db $1d ; unused
db BANK(HallofFameRoom_h)
db $18 ; db BANK(UndergroundPathNS_h)
- db $1d ; db BANK(Gary_h)
+ db BANK(Gary_h)
db $18 ; db BANK(UndergroundPathWE_h)
db $11 ; db BANK(CeladonMart1_h)
db $15 ; db BANK(CeladonMart2_h)
diff --git a/data/map_header_pointers.asm b/data/map_header_pointers.asm
index cbaa5da9..10db2aba 100644
--- a/data/map_header_pointers.asm
+++ b/data/map_header_pointers.asm
@@ -120,7 +120,7 @@ MapHeaderPointers:: ; fc1f2 (3f:41f2)
dw Lance_h ; unused
dw HallofFameRoom_h
dw $5f31 ; dw UndergroundPathNS_h
- dw $57a0 ; dw Gary_h ;id=120
+ dw Gary_h ;id=120
dw $5f55 ; dw UndergroundPathWE_h
dw $42b7 ; dw CeladonMart1_h
dw $60d9 ; dw CeladonMart2_h
diff --git a/engine/bank3d.asm b/engine/bank3d.asm
index 61fc8ed1..97e7fda6 100644
--- a/engine/bank3d.asm
+++ b/engine/bank3d.asm
@@ -4,25 +4,25 @@ INCLUDE "engine/battle/unused_stats_functions.asm"
INCLUDE "engine/battle/scroll_draw_trainer_pic.asm"
Func_f429f:: ; f429f (3d:429f)
- coord hl, 0,5
- ld c,$0
+ coord hl, 0, 5
+ ld c, $0
.asm_f42a4
inc c
- ld a,c
+ ld a, c
cp $9
ret z
- ld d,$5b
+ ld d, $5b
push bc
push hl
.asm_f42ad
call Func_f42c2
dec hl
- ld a,d
+ ld a, d
sub $7
- ld d,a
+ ld d, a
dec c
- jr nz,.asm_f42ad
- ld c,$2
+ jr nz, .asm_f42ad
+ ld c, $2
call DelayFrames
pop hl
pop bc
@@ -33,19 +33,19 @@ Func_f42c2:: ; f42c2 (3d:f42c2)
push hl
push de
push bc
- ld e,$7
+ ld e, $7
.loop
- ld a,d
+ ld a, d
cp $31
- jr nc,.asm_f42ce
- ld a,$7f
+ jr nc, .asm_f42ce
+ ld a, $7f
.asm_f42ce
- ld [hl],a
- ld bc,$14
- add hl,bc
+ ld [hl], a
+ ld bc, $14
+ add hl, bc
inc d
dec e
- jr nz,.loop
+ jr nz, .loop
pop bc
pop de
pop hl
@@ -144,17 +144,17 @@ ModifyPikachuHappiness:: ; f430a (3d:430a)
HappinessChangeTable: ; f4385 (3d:4385)
; Increase
- db 5, 3, 2 ; Gained a level
- db 5, 3, 2 ; HP restore
- db 1, 1, 0 ; Used X item
- db 3, 2, 1 ; Challenged Gym Leader
- db 1, 1, 0 ; Teach TM/HM
- db 2, 1, 1 ; Walking around
+ db 5, 3, 2 ; Gained a level
+ db 5, 3, 2 ; HP restore
+ db 1, 1, 0 ; Used X item
+ db 3, 2, 1 ; Challenged Gym Leader
+ db 1, 1, 0 ; Teach TM/HM
+ db 2, 1, 1 ; Walking around
; Decrease
- db -3, -3, -5 ; Deposited
- db -1, -1, -1 ; Fainted in battle
- db -5, -5, -10 ; Fainted due to Poison outside of battle
- db -5, -5, -10 ; Unknown (d = 10)
+ db -3, -3, -5 ; Deposited
+ db -1, -1, -1 ; Fainted in battle
+ db -5, -5, -10 ; Fainted due to Poison outside of battle
+ db -5, -5, -10 ; Unknown (d = 10)
db -10, -10, -20 ; Unknown (d = 11)
PikachuMoods: ; f43a6 (3d:43a6)
@@ -177,124 +177,124 @@ OldManPic:: INCBIN "pic/trainer/oldman.pic"
ProfOakPicBack:: INCBIN "pic/ytrainer/prof.oakb.pic"
Func_f453f:: ; f453f (3d:453f)
- ld hl,PokemonLogoGraphics
- ld de,vChars2
- ld bc,$730
- ld a,BANK(PokemonLogoGraphics) ; redundant because this function is in bank3d
+ ld hl, PokemonLogoGraphics
+ ld de, vChars2
+ ld bc, $730
+ ld a, BANK(PokemonLogoGraphics) ; redundant because this function is in bank3d
call FarCopyData
- ld hl,YellowLogoGraphics+$230
- ld de,vChars0+$fd0
- ld bc,$30
- ld a,BANK(YellowLogoGraphics)
+ ld hl, YellowLogoGraphics+$230
+ ld de, vChars0+$fd0
+ ld bc, $30
+ ld a, BANK(YellowLogoGraphics)
call FarCopyData
- ld hl,YellowLogoGraphics+$260
- ld de,vChars1
- ld bc,$400
- ld a,BANK(YellowLogoGraphics)
+ ld hl, YellowLogoGraphics+$260
+ ld de, vChars1
+ ld bc, $400
+ ld a, BANK(YellowLogoGraphics)
call FarCopyData
- ld hl,YellowLogoGraphics+$660
- ld de,vChars0+$f00
- ld bc,$c0
- ld a,BANK(YellowLogoGraphics)
+ ld hl, YellowLogoGraphics+$660
+ ld de, vChars0+$f00
+ ld bc, $c0
+ ld a, BANK(YellowLogoGraphics)
call FarCopyData
ret
Func_f4578:: ; f4578 (3d:4578)
- coord hl, 2,1
- ld de,Pointer_f45f9
- ld bc,7 << 8 | 16 ; 16x7 (xy)
+ coord hl, 2, 1
+ ld de, Pointer_f45f9
+ ld bc, 7 << 8 | 16 ; 16x7 (xy)
call CopyScreenArea
ret
Func_f4585:: ; f4585 (3d:4585)
- coord hl, 6,4
- ld de,Pointer_f4673
- ld bc,4 << 8 | 7 ; 7x4 (xy)
+ coord hl, 6, 4
+ ld de, Pointer_f4673
+ ld bc, 4 << 8 | 7 ; 7x4 (xy)
call CopyScreenArea
- coord hl, 9,8
- ld [hl],$64
+ coord hl, 9, 8
+ ld [hl], $64
inc hl
- ld [hl],$65
+ ld [hl], $65
ret
Func_f459a:: ; f459a (3d:459a)
- coord hl, 4,8
- ld de,Pointer_f468f
- ld bc,9 << 8 | 12 ; 12x9 (xy)
+ coord hl, 4, 8
+ ld de, Pointer_f468f
+ ld bc, 9 << 8 | 12 ; 12x9 (xy)
call CopyScreenArea
- coord hl, 16,10
- ld [hl],$96
- coord hl, 16,11
- ld [hl],$9d
- coord hl, 16,12
- ld [hl],$a7
- coord hl, 16,13
- ld [hl],$b1
- ld hl,Pointer_f45c7
- ld de,wOAMBuffer
- ld bc,$20
+ coord hl, 16, 10
+ ld [hl], $96
+ coord hl, 16, 11
+ ld [hl], $9d
+ coord hl, 16, 12
+ ld [hl], $a7
+ coord hl, 16, 13
+ ld [hl], $b1
+ ld hl, Pointer_f45c7
+ ld de, wOAMBuffer
+ ld bc, $20
call CopyData
ret
Pointer_f45c7: ; f45c7 (3d:45c7)
- db $60,$40,$f1,$22
- db $60,$48,$f0,$22
- db $68,$40,$f3,$22
- db $68,$48,$f2,$22
- db $60,$60,$f0,$02
- db $60,$68,$f1,$02
- db $68,$60,$f2,$02
- db $68,$68,$f3,$02
+ db $60, $40, $f1, $22
+ db $60, $48, $f0, $22
+ db $68, $40, $f3, $22
+ db $68, $48, $f2, $22
+ db $60, $60, $f0, $02
+ db $60, $68, $f1, $02
+ db $68, $60, $f2, $02
+ db $68, $68, $f3, $02
CopyScreenArea:: ; f45e7 (3d:45e7)
; copy cxb (xy) screen area from de to hl
push bc
push hl
.loop
- ld a,[de]
+ ld a, [de]
inc de
- ld [hli],a
+ ld [hli], a
dec c
- jr nz,.loop
+ jr nz, .loop
pop hl
- ld bc,$14
- add hl,bc
+ ld bc, $14
+ add hl, bc
pop bc
dec b
- jr nz,CopyScreenArea
+ jr nz, CopyScreenArea
ret
Pointer_f45f9: ; f45f9 (3d:45f9)
; 16x7 (xy)
- db $f4,$f4,$f4,$f4,$f4,$f4,$49,$f4,$72,$30,$f4,$f4,$f4,$f4,$f4,$f4
- db $fd,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0a,$0b,$f4,$0d,$0e,$0f
- db $10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1a,$1b,$1c,$1d,$1e,$1f
- db $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2a,$2b,$2c,$2d,$2e,$2f
- db $f4,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3a,$3b,$3c,$3d,$3e,$3f
- db $f4,$41,$42,$43,$44,$45,$46,$47,$48,$f4,$4a,$4b,$4c,$4d,$4e,$4f
- db $f4,$6a,$6b,$6c,$6d,$f4,$f4,$f4,$f4,$f4,$f4,$6e,$6f,$70,$71,$f4
+ db $f4, $f4, $f4, $f4, $f4, $f4, $49, $f4, $72, $30, $f4, $f4, $f4, $f4, $f4, $f4
+ db $fd, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $f4, $0d, $0e, $0f
+ db $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $1a, $1b, $1c, $1d, $1e, $1f
+ db $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $2a, $2b, $2c, $2d, $2e, $2f
+ db $f4, $31, $32, $33, $34, $35, $36, $37, $38, $39, $3a, $3b, $3c, $3d, $3e, $3f
+ db $f4, $41, $42, $43, $44, $45, $46, $47, $48, $f4, $4a, $4b, $4c, $4d, $4e, $4f
+ db $f4, $6a, $6b, $6c, $6d, $f4, $f4, $f4, $f4, $f4, $f4, $6e, $6f, $70, $71, $f4
Pointer_f4669:: ; f4669 (3d:4669)
- db $47,$48,$49,$4a,$4b,$4c,$4d,$4e,$4f,$5f
+ db $47, $48, $49, $4a, $4b, $4c, $4d, $4e, $4f, $5f
Pointer_f4673:: ; f4673 (3d:4673)
; 7x4 (xy)
- db $24,$25,$66,$67,$68,$69,$2a
- db $50,$51,$52,$53,$54,$55,$56
- db $57,$58,$59,$5a,$5b,$5c,$5d
- db $6d,$5e,$5f,$60,$61,$62,$63
+ db $24, $25, $66, $67, $68, $69, $2a
+ db $50, $51, $52, $53, $54, $55, $56
+ db $57, $58, $59, $5a, $5b, $5c, $5d
+ db $6d, $5e, $5f, $60, $61, $62, $63
Pointer_f468f:: ; f468f (3d:468f)
; 12x9 (xy)
- db $80,$81,$82,$83,$00,$00,$00,$00,$84,$85,$86,$87
- db $88,$89,$8a,$8b,$8c,$8d,$8d,$8e,$8f,$8a,$90,$91
- db $00,$92,$93,$8a,$8a,$8a,$8a,$8a,$8a,$94,$95,$00
- db $00,$00,$97,$8a,$8a,$98,$99,$8a,$8a,$9a,$9b,$9c
- db $00,$00,$9e,$9f,$a0,$a1,$a2,$a3,$a4,$a5,$a6,$8a
- db $00,$a8,$a9,$aa,$8a,$ab,$ac,$8a,$ad,$ae,$af,$b0
- db $00,$b2,$b3,$b4,$8a,$8a,$8a,$8a,$b5,$b6,$b7,$b8
- db $00,$b9,$ba,$8a,$8a,$8a,$8a,$8a,$8a,$bb,$bc,$00
- db $00,$00,$bd,$8a,$8a,$8a,$8a,$8a,$8a,$be,$bf,$00
+ db $80, $81, $82, $83, $00, $00, $00, $00, $84, $85, $86, $87
+ db $88, $89, $8a, $8b, $8c, $8d, $8d, $8e, $8f, $8a, $90, $91
+ db $00, $92, $93, $8a, $8a, $8a, $8a, $8a, $8a, $94, $95, $00
+ db $00, $00, $97, $8a, $8a, $98, $99, $8a, $8a, $9a, $9b, $9c
+ db $00, $00, $9e, $9f, $a0, $a1, $a2, $a3, $a4, $a5, $a6, $8a
+ db $00, $a8, $a9, $aa, $8a, $ab, $ac, $8a, $ad, $ae, $af, $b0
+ db $00, $b2, $b3, $b4, $8a, $8a, $8a, $8a, $b5, $b6, $b7, $b8
+ db $00, $b9, $ba, $8a, $8a, $8a, $8a, $8a, $8a, $bb, $bc, $00
+ db $00, $00, $bd, $8a, $8a, $8a, $8a, $8a, $8a, $be, $bf, $00
; f46f9 (3d:46f9)
PokemonLogoGraphics: INCBIN "gfx/pokemon_logo.2bpp"
@@ -304,146 +304,146 @@ INCLUDE "engine/menu/link_menu.asm"
HandleMenuInputDouble:: ; f5a40 (3d:5a40)
xor a
- ld [wPartyMenuAnimMonEnabled],a
+ ld [wPartyMenuAnimMonEnabled], a
HandleMenuInputPokemonSelectionDouble:: ; f5a44 (3d:5a44)
- ld a,[H_DOWNARROWBLINKCNT1]
+ ld a, [H_DOWNARROWBLINKCNT1]
push af
- ld a,[H_DOWNARROWBLINKCNT2]
+ ld a, [H_DOWNARROWBLINKCNT2]
push af ; save existing values on stack
xor a
- ld [H_DOWNARROWBLINKCNT1],a ; blinking down arrow timing value 1
- ld a,$06
- ld [H_DOWNARROWBLINKCNT2],a ; blinking down arrow timing value 2
+ ld [H_DOWNARROWBLINKCNT1], a ; blinking down arrow timing value 1
+ ld a, $06
+ ld [H_DOWNARROWBLINKCNT2], a ; blinking down arrow timing value 2
.loop1
xor a
- ld [wAnimCounter],a ; counter for pokemon shaking animation
+ ld [wAnimCounter], a ; counter for pokemon shaking animation
call Func_f5ab0
call JoypadLowSensitivity
- ld a,[hJoy5]
+ ld a, [hJoy5]
and a ; was a key pressed?
- jr nz,.keyPressed
+ jr nz, .keyPressed
pop af
- ld [H_DOWNARROWBLINKCNT2],a
+ ld [H_DOWNARROWBLINKCNT2], a
pop af
- ld [H_DOWNARROWBLINKCNT1],a ; restore previous values
+ ld [H_DOWNARROWBLINKCNT1], a ; restore previous values
xor a
- ld [wMenuWrappingEnabled],a ; disable menu wrapping
+ ld [wMenuWrappingEnabled], a ; disable menu wrapping
ret
.keyPressed
xor a
- ld [wCheckFor180DegreeTurn],a
- ld a,[hJoy5]
- ld b,a
- bit 6,a ; pressed Up key?
- jr z,.checkIfDownPressed
+ ld [wCheckFor180DegreeTurn], a
+ ld a, [hJoy5]
+ ld b, a
+ bit 6, a ; pressed Up key?
+ jr z, .checkIfDownPressed
.upPressed
- ld a,[wCurrentMenuItem] ; selected menu item
+ ld a, [wCurrentMenuItem] ; selected menu item
and a ; already at the top of the menu?
- jr z,.checkOtherKeys
+ jr z, .checkOtherKeys
.notAtTop
dec a
- ld [wCurrentMenuItem],a ; move selected menu item up one space
+ ld [wCurrentMenuItem], a ; move selected menu item up one space
jr .checkOtherKeys
.checkIfDownPressed
- bit 7,a
- jr z,.checkOtherKeys
+ bit 7, a
+ jr z, .checkOtherKeys
.downPressed
- ld a,[wCurrentMenuItem]
+ ld a, [wCurrentMenuItem]
inc a
- ld c,a
- ld a,[wMaxMenuItem]
+ ld c, a
+ ld a, [wMaxMenuItem]
cp c
- jr c,.checkOtherKeys
- ld a,c
- ld [wCurrentMenuItem],a
+ jr c, .checkOtherKeys
+ ld a, c
+ ld [wCurrentMenuItem], a
.checkOtherKeys
- ld a,[wMenuWatchedKeys]
+ ld a, [wMenuWatchedKeys]
and b ; does the menu care about any of the pressed keys?
- jp z,.loop1
+ jp z, .loop1
.checkIfAButtonOrBButtonPressed
- ld a,[hJoy5]
+ ld a, [hJoy5]
and A_BUTTON | B_BUTTON
- jr z,.skipPlayingSound
+ jr z, .skipPlayingSound
.AButtonOrBButtonPressed
ld a, $90 ; (SFX_02_40 - SFX_Headers_02) / 3
call PlaySound ; play sound
.skipPlayingSound
pop af
- ld [H_DOWNARROWBLINKCNT2],a
+ ld [H_DOWNARROWBLINKCNT2], a
pop af
- ld [H_DOWNARROWBLINKCNT1],a ; restore previous values
- ld a,[hJoy5]
+ ld [H_DOWNARROWBLINKCNT1], a ; restore previous values
+ ld a, [hJoy5]
ret
Func_f5ab0:: ; f5ab0 (3d:5ab0)
- ld a,[wTopMenuItemY]
+ ld a, [wTopMenuItemY]
and a
- jr z,.asm_f5ac0
- coord hl, 0,0
- ld bc,$14
+ jr z, .asm_f5ac0
+ coord hl, 0, 0
+ ld bc, $14
.loop
- add hl,bc
+ add hl, bc
dec a
- jr nz,.loop
+ jr nz, .loop
.asm_f5ac0
- ld a,[wTopMenuItemX]
- ld b,$0
- ld c,a
- add hl,bc
+ ld a, [wTopMenuItemX]
+ ld b, $0
+ ld c, a
+ add hl, bc
push hl
- ld a,[wLastMenuItem]
+ ld a, [wLastMenuItem]
and a
- jr z,.asm_f5ad5
- ld bc,$28
+ jr z, .asm_f5ad5
+ ld bc, $28
.loop2
- add hl,bc
+ add hl, bc
dec a
- jr nz,.loop2
+ jr nz, .loop2
.asm_f5ad5
- ld a,[hl]
+ ld a, [hl]
cp "▶"
- jr nz,.asm_f5ade
- ld a,[wTileBehindCursor]
- ld [hl],a
+ jr nz, .asm_f5ade
+ ld a, [wTileBehindCursor]
+ ld [hl], a
.asm_f5ade
pop hl
- ld a,[wCurrentMenuItem]
+ ld a, [wCurrentMenuItem]
and a
- jr z,.asm_f5aec
- ld bc,$28
+ jr z, .asm_f5aec
+ ld bc, $28
.loop3
- add hl,bc
+ add hl, bc
dec a
- jr nz,.loop3
+ jr nz, .loop3
.asm_f5aec
- ld a,[hl]
+ ld a, [hl]
cp "▶"
- jr z,.asm_f5af4
- ld [wTileBehindCursor],a
+ jr z, .asm_f5af4
+ ld [wTileBehindCursor], a
.asm_f5af4
- ld a,"▶"
- ld [hl],a
- ld a,l
- ld [wMenuCursorLocation],a
- ld a,h
- ld [wMenuCursorLocation+1],a
- ld a,[wCurrentMenuItem]
- ld [wLastMenuItem],a
+ ld a, "▶"
+ ld [hl], a
+ ld a, l
+ ld [wMenuCursorLocation], a
+ ld a, h
+ ld [wMenuCursorLocation+1], a
+ ld a, [wCurrentMenuItem]
+ ld [wLastMenuItem], a
ret
-Func_f5b06:: ; f5b06 (3d:5b06)
- ld hl,wd728
- set 0,[hl]
- ld hl,Text_f5b17
+PrintStrengthTxt:: ; f5b06 (3d:5b06)
+ ld hl, wd728
+ set 0, [hl]
+ ld hl, Text_f5b17
call PrintText
- ld hl,Text_f5b28
+ ld hl, Text_f5b28
jp PrintText
Text_f5b17:: ; f5b17 (3d:5b17)
TX_FAR _UsedStrengthText ; 2d:417e
db $08 ; asm
- ld a,[wcf91]
+ ld a, [wcf91]
call PlayCry
call Delay3
jp TextScriptEnd
@@ -453,31 +453,31 @@ Text_f5b28:: ; f5b28 (3d:5b28)
db "@"
CheckForForcedBikeSurf:: ; f5b2d (3d:5b2d)
- ld hl,wd728
- set 1,[hl]
- ld a,[wd732]
- bit 5,a
- jr nz,.asm_f5b59
- ld a,[wCurMap]
+ ld hl, wd728
+ set 1, [hl]
+ ld a, [wd732]
+ bit 5, a
+ jr nz, .asm_f5b59
+ ld a, [wCurMap]
cp SEAFOAM_ISLANDS_5
ret nz
CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE
ret z
- ld hl,CoordsData_f5b64
+ ld hl, CoordsData_f5b64
call ArePlayerCoordsInArray
ret nc
- ld hl,wd728
- res 1,[hl]
- ld hl,CurrentTooFastText
+ ld hl, wd728
+ res 1, [hl]
+ ld hl, CurrentTooFastText
jp PrintText
.asm_f5b59
- ld hl,wd728
- res 1,[hl]
- ld hl,CyclingIsFunText
+ ld hl, wd728
+ res 1, [hl]
+ ld hl, CyclingIsFunText
jp PrintText
CoordsData_f5b64:: ; f5b64 (3d:5b64)
- db 11,07
+ db 11, 07
db $ff
CurrentTooFastText:: ; f5b67 (3d:5b67)
@@ -489,82 +489,82 @@ CyclingIsFunText:: ; f5b6c (3d:5b6c)
db "@"
AddItemToInventory_:: ; f5b70 (3d:5b70)
- ld a,[wItemQuantity] ; a = item quantity
+ ld a, [wItemQuantity] ; a = item quantity
push af
push bc
push de
push hl
push hl
- ld d,50 ; PC box can hold 50 items
- ld a,wNumBagItems & $FF
+ ld d, 50 ; PC box can hold 50 items
+ ld a, wNumBagItems & $FF
cp l
- jr nz,.checkIfInventoryFull
- ld a,wNumBagItems >> 8
+ jr nz, .checkIfInventoryFull
+ ld a, wNumBagItems >> 8
cp h
- jr nz,.checkIfInventoryFull
+ jr nz, .checkIfInventoryFull
; if the destination is the bag
- ld d,20 ; bag can hold 20 items
+ ld d, 20 ; bag can hold 20 items
.checkIfInventoryFull
- ld a,[hl]
+ ld a, [hl]
sub d
- ld d,a
- ld a,[hli]
+ ld d, a
+ ld a, [hli]
and a
- jr z,.addNewItem
+ jr z, .addNewItem
.notAtEndOfInventory
- ld a,[hli]
- ld b,a ; b = ID of current item in table
- ld a,[wcf91] ; a = ID of item being added
+ ld a, [hli]
+ ld b, a ; b = ID of current item in table
+ ld a, [wcf91] ; a = ID of item being added
cp b ; does the current item in the table match the item being added?
- jp z,.increaseItemQuantity ; if so, increase the item's quantity
+ jp z, .increaseItemQuantity ; if so, increase the item's quantity
inc hl
.loop
- ld a,[hl]
- cp a,$ff ; is it the end of the table?
+ ld a, [hl]
+ cp a, $ff ; is it the end of the table?
jr nz, .notAtEndOfInventory
.addNewItem ; add an item not yet in the inventory
pop hl
- ld a,d
+ ld a, d
and a ; is there room for a new item slot?
- jr z,.done
+ jr z, .done
; if there is room
inc [hl] ; increment the number of items in the inventory
- ld a,[hl] ; the number of items will be the index of the new item
+ ld a, [hl] ; the number of items will be the index of the new item
add a
dec a
- ld c,a
- ld b,0
- add hl,bc ; hl = address to store the item
- ld a,[wcf91]
- ld [hli],a ; store item ID
- ld a,[wItemQuantity]
- ld [hli],a ; store item quantity
- ld [hl],$ff ; store terminator
+ ld c, a
+ ld b, 0
+ add hl, bc ; hl = address to store the item
+ ld a, [wcf91]
+ ld [hli], a ; store item ID
+ ld a, [wItemQuantity]
+ ld [hli], a ; store item quantity
+ ld [hl], $ff ; store terminator
jp .success
.increaseItemQuantity ; increase the quantity of an item already in the inventory
- ld a,[wItemQuantity]
- ld b,a ; b = quantity to add
- ld a,[hl] ; a = existing item quantity
+ ld a, [wItemQuantity]
+ ld b, a ; b = quantity to add
+ ld a, [hl] ; a = existing item quantity
add b ; a = new item quantity
- cp a,100
- jp c,.storeNewQuantity ; if the new quantity is less than 100, store it
-; if the new quantity is greater than or equal to 100,
+ cp a, 100
+ jp c, .storeNewQuantity ; if the new quantity is less than 100, store it
+; if the new quantity is greater than or equal to 100,
; try to max out the current slot and add the rest in a new slot
- sub a,99
- ld [wItemQuantity],a ; a = amount left over (to put in the new slot)
- ld a,d
+ sub a, 99
+ ld [wItemQuantity], a ; a = amount left over (to put in the new slot)
+ ld a, d
and a ; is there room for a new item slot?
- jr z,.increaseItemQuantityFailed
+ jr z, .increaseItemQuantityFailed
; if so, store 99 in the current slot and store the rest in a new slot
- ld a,99
- ld [hli],a
+ ld a, 99
+ ld [hli], a
jp .loop
.increaseItemQuantityFailed
pop hl
and a
jr .done
.storeNewQuantity
- ld [hl],a
+ ld [hl], a
pop hl
.success
scf
@@ -573,8 +573,8 @@ AddItemToInventory_:: ; f5b70 (3d:5b70)
pop de
pop bc
pop bc
- ld a,b
- ld [wItemQuantity],a ; restore the initial value from when the function was called
+ ld a, b
+ ld [wItemQuantity], a ; restore the initial value from when the function was called
ret
; function to remove an item (in varying quantities) from the player's bag or PC box
@@ -585,49 +585,49 @@ AddItemToInventory_:: ; f5b70 (3d:5b70)
RemoveItemFromInventory_: ; f5be1 (3d:5be1)
push hl
inc hl
- ld a,[wWhichPokemon] ; index (within the inventory) of the item being removed
+ ld a, [wWhichPokemon] ; index (within the inventory) of the item being removed
add a
add l
- ld l,a
- jr nc,.noCarry
+ ld l, a
+ jr nc, .noCarry
inc h
.noCarry
inc hl
- ld a,[wItemQuantity] ; quantity being removed
- ld e,a
- ld a,[hl] ; a = current quantity
+ ld a, [wItemQuantity] ; quantity being removed
+ ld e, a
+ ld a, [hl] ; a = current quantity
sub e
- ld [hld],a ; store new quantity
- ld [wMaxItemQuantity],a
+ ld [hld], a ; store new quantity
+ ld [wMaxItemQuantity], a
and a
- jr nz,.skipMovingUpSlots
-; if the remaining quantity is 0,
+ jr nz, .skipMovingUpSlots
+; if the remaining quantity is 0,
; remove the emptied item slot and move up all the following item slots
.moveSlotsUp
- ld e,l
- ld d,h
+ ld e, l
+ ld d, h
inc de
inc de ; de = address of the slot following the emptied one
.loop ; loop to move up the following slots
- ld a,[de]
+ ld a, [de]
inc de
- ld [hli],a
- cp a,$ff
- jr nz,.loop
+ ld [hli], a
+ cp a, $ff
+ jr nz, .loop
; update menu info
xor a
- ld [wListScrollOffset],a
- ld [wCurrentMenuItem],a
- ld [wBagSavedMenuItem],a
- ld [wSavedListScrollOffset],a
+ ld [wListScrollOffset], a
+ ld [wCurrentMenuItem], a
+ ld [wBagSavedMenuItem], a
+ ld [wSavedListScrollOffset], a
pop hl
- ld a,[hl] ; a = number of items in inventory
+ ld a, [hl] ; a = number of items in inventory
dec a ; decrement the number of items
- ld [hl],a ; store new number of items
- ld [wListCount],a
- cp a,2
- jr c,.done
- ld [wMaxMenuItem],a
+ ld [hl], a ; store new number of items
+ ld [wListCount], a
+ cp a, 2
+ jr c, .done
+ ld [wMaxMenuItem], a
jr .done
.skipMovingUpSlots
pop hl
@@ -641,43 +641,43 @@ CircleTile: INCBIN "gfx/circle_tile.2bpp"
BadgeNumbersTileGraphics: INCBIN "gfx/badge_numbers.2bpp"
ReadSuperRodData:: ; f5ea4 (3d:5ea4)
- ld a,[wCurMap]
- ld c,a
- ld hl,FishingSlots
+ ld a, [wCurMap]
+ ld c, a
+ ld hl, FishingSlots
.loop
- ld a,[hli]
+ ld a, [hli]
cp $ff
- jr z,.notfound
+ jr z, .notfound
cp c
- jr z,.found
- ld de,$8
- add hl,de
+ jr z, .found
+ ld de, $8
+ add hl, de
jr .loop
.found
call GenerateRandomFishingEncounter
ret
.notfound
- ld de,$0
+ ld de, $0
ret
GenerateRandomFishingEncounter: ; f5ec1 (3d:5ec1)
call Random
cp $66
- jr c,.asm_f5ed6
+ jr c, .asm_f5ed6
inc hl
inc hl
cp $b2
- jr c,.asm_f5ed6
+ jr c, .asm_f5ed6
inc hl
inc hl
cp $e5
- jr c,.asm_f5ed6
+ jr c, .asm_f5ed6
inc hl
inc hl
.asm_f5ed6
- ld e,[hl]
+ ld e, [hl]
inc hl
- ld d,[hl]
+ ld d, [hl]
ret
INCLUDE "data/super_rod.asm"
diff --git a/engine/battle/bank3d_battle.asm b/engine/battle/bank3d_battle.asm
index 7f8854a4..4fd37bc4 100644
--- a/engine/battle/bank3d_battle.asm
+++ b/engine/battle/bank3d_battle.asm
@@ -187,7 +187,7 @@ LoadMonBackPic: ; f6178 (3d:6178)
ld b, a
jp CopyVideoData
-Func_f61a6: ; f61a6 (3d:f61a6)
+AnimateSendingOutMon: ; f61a6 (3d:f61a6)
ld a, [wPredefRegisters]
ld h, a
ld a, [wPredefRegisters + 1]
@@ -227,7 +227,7 @@ Func_f61a6: ; f61a6 (3d:f61a6)
add $31
jr CopyUncompressedPicToHL
-Func_f61f9: ; f61f9 (3d:61f9)
+CopyUncompressedPicToTilemap: ; f61f9 (3d:61f9)
ld a, [wPredefRegisters]
ld h, a
ld a, [wPredefRegisters + 1]
diff --git a/engine/overworld/item.asm b/engine/overworld/item.asm
index f4f46535..e421a946 100644
--- a/engine/overworld/item.asm
+++ b/engine/overworld/item.asm
@@ -51,4 +51,4 @@ FoundItemText: ; 4d9a (1:4d9a)
NoMoreRoomForItemText: ; 4da0 (1:4da0)
TX_FAR _NoMoreRoomForItemText
- db "@" \ No newline at end of file
+ db "@"
diff --git a/engine/overworld/missable_objects.asm b/engine/overworld/missable_objects.asm
index 65305d30..1cc15be5 100644
--- a/engine/overworld/missable_objects.asm
+++ b/engine/overworld/missable_objects.asm
@@ -30,17 +30,17 @@ MarkTownVisitedAndLoadMissableObjects: ; ef93 (3:6f93)
ld a, h
ld [H_DIVIDEND], a
ld a, l
- ld [H_DIVIDEND+1], a
+ ld [H_DIVIDEND + 1], a
xor a
- ld [H_DIVIDEND+2], a
- ld [H_DIVIDEND+3], a
+ ld [H_DIVIDEND + 2], a
+ ld [H_DIVIDEND + 3], a
ld a, $3
ld [H_DIVISOR], a
ld b, $2
call Divide ; divide difference by 3, resulting in the global offset (number of missable items before ours)
ld a, [wCurMap]
ld b, a
- ld a, [H_DIVIDEND+3]
+ ld a, [H_DIVIDEND + 3]
ld c, a ; store global offset in c
ld de, wMissableObjectList
pop hl
diff --git a/engine/overworld/try_pushing_boulder.asm b/engine/overworld/try_pushing_boulder.asm
index d978a083..89e83ff9 100644
--- a/engine/overworld/try_pushing_boulder.asm
+++ b/engine/overworld/try_pushing_boulder.asm
@@ -2,6 +2,7 @@ TryPushingBoulder: ; f0a1 (3:70a1)
ld a, [wd728]
bit 0, a ; using Strength?
ret z
+Func_f0a7: ; f0a7 (3:70a7)
; where LoadMissableObjects predef points to now
ld a, [wFlags_0xcd60]
bit 1, a ; has boulder dust animation from previous push played yet?
diff --git a/engine/predefs.asm b/engine/predefs.asm
index 3ec98577..98a5b2d2 100755
--- a/engine/predefs.asm
+++ b/engine/predefs.asm
@@ -1,8 +1,8 @@
GetPredefPointer: ; f67ed (3d:67ed)
-; Store the contents of the register
-; pairs (hl, de, bc) at wPredefRegisters.
-; Then put the bank and address of predef
-; wPredefID in [wPredefBank] and hl.
+ ; Store the contents of the register
+ ; pairs (hl, de, bc) at wPredefRegisters.
+ ; Then put the bank and address of predef
+ ; wPredefID in [wPredefBank] and hl.
ld a,h
ld [wPredefRegisters],a
@@ -35,11 +35,11 @@ GetPredefPointer: ; f67ed (3d:67ed)
ld d,h
ld e,l
- ; get bank of predef routine
+ ; get bank of predef routine
ld a,[de]
ld [wPredefBank],a
- ; get pointer
+ ; get pointer
inc de
ld a,[de]
ld l,a
@@ -50,104 +50,111 @@ GetPredefPointer: ; f67ed (3d:67ed)
ret
PredefPointers:: ; f681d (3d:681d)
-; these are pointers to ASM routines.
-; they appear to be used in overworld map scripts.
- dbw BANK(DrawPlayerHUDAndHPBar), DrawPlayerHUDAndHPBar ; add_predef DrawPlayerHUDAndHPBar
- dbw $3d, $61f9 ; add_predef CopyUncompressedPicToTilemap
- dbw $3d, $61a6 ; add_predef Func_3f073
- dbw $0b, $7d79 ; add_predef ScaleSpriteByTwo
- dbw $3d, $6178 ; add_predef LoadMonBackPic
- dbw $1e, $5c16 ; add_predef CopyDownscaledMonTiles
- dbw $03, $70a7 ; add_predef LoadMissableObjects
- dbw $03, $752b ; add_predef HealParty
- dbw $1e, $4d97 ; add_predef MoveAnimation; 08 play move animation
- dbw $03, $75a4 ; add_predef DivideBCDPredef
- dbw $03, $75a4 ; add_predef DivideBCDPredef2
- dbw $03, $76a3 ; add_predef AddBCDPredef
- dbw $03, $76bc ; add_predef SubBCDPredef
- dbw $03, $75a4 ; add_predef DivideBCDPredef3
- dbw $03, $75a4 ; add_predef DivideBCDPredef4
- dbw $03, $76d6 ; add_predef InitPlayerData
- dbw $03, $74ec ; add_predef FlagActionPredef
- dbw $03, $7053 ; add_predef HideObject
- dbw $03, $7022 ; add_predef IsObjectHidden
- dbw $03, $43de ; add_predef ApplyOutOfBattlePoisonDamage
- dbw $0f, $4ae8 ; add_predef AnyPartyAlive
- dbw $03, $7044 ; add_predef ShowObject
- dbw $03, $7044 ; add_predef ShowObject2
- dbw $03, $6d1b ; add_predef ReplaceTileBlock
- dbw $03, $76d6 ; add_predef InitPlayerData2
- dbw $03, $44f4 ; add_predef LoadTilesetHeader
- dbw $0e, $700c ; add_predef LearnMoveFromLevelUp
- dbw $01, $6bc8 ; add_predef LearnMove
- dbw $03, $7735 ; add_predef IsItemInBag_
- dbw $03, $3ef9 ; dbw $03,CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; for these two, the ba
- dbw $03, $3e3f ; dbw $03,GiveItem
- dbw $0a, $7d4c ; add_predef InvertBGPal_4Frames
- dbw $03, $774a ; add_predef FindPathToPlayer
- dbw $0a, $7d67 ; add_predef Func_480ff
- dbw $03, $77b9 ; add_predef CalcPositionOfPlayerRelativeToNPC
- dbw $03, $7830 ; add_predef ConvertNPCMovementDirectionsToJoypadMasks
- dbw $0a, $7d8d ; add_predef Func_48125
- dbw $03, $78ad ; add_predef UpdateHPBar
- dbw $03, $786c ; add_predef HPBarLength
- dbw $01, $5b64 ; add_predef Diploma_TextBoxBorder
- dbw $0f, $6e8e ; add_predef DoubleOrHalveSelectedStats
- dbw $10, $4000 ; add_predef ShowPokedexMenu
- dbw $0e, $6dc6 ; add_predef EvolutionAfterBattle
- dbw $1c, $7ae5 ; add_predef SaveSAVtoSRAM0
- dbw $3d, $5ff8 ; add_predef InitOpponent
- dbw $01, $5b13 ; add_predef CableClub_Run
- dbw $03, $6880 ; add_predef DrawBadges
- dbw $10, $53f6 ; add_predef ExternalClockTradeAnim
- dbw $1c, $49d7 ; add_predef BattleTransition
- dbw $1e, $5f7b ; add_predef CopyTileIDsFromList
- dbw $10, $5997 ; add_predef PlayIntro
- dbw $1e, $59c5 ; add_predef Func_79869
- dbw $1c, $4bd0 ; add_predef FlashScreen
- dbw $03, $42d1 ; add_predef GetTileAndCoordsInFrontOfPlayer
- dbw $04, $54cc ; add_predef StatusScreen
- dbw $04, $56fb ; add_predef StatusScreen2
- dbw $10, $53e5 ; add_predef InternalClockTradeAnim
- dbw $15, $685b ; add_predef TrainerEngage
- dbw $10, $509d ; add_predef IndexToPokedex
- dbw $01, $600d ; add_predef DisplayPicCenteredOrUpperRight; 3B display pic?
- dbw $03, $6dd1 ; add_predef UsedCut
- dbw $10, $4312 ; add_predef ShowPokedexData
- dbw $0e, $713f ; add_predef WriteMonMoves
- dbw $1c, $7a67 ; add_predef SaveSAV
- dbw $1c, $61f8 ; add_predef LoadSGB
- dbw $03, $6f93 ; add_predef MarkTownVisitedAndLoadMissableObjects
- dbw $17, $5b93 ; add_predef SetPartyMonTypes
- dbw $04, $62f0 ; add_predef CanLearnTM
- dbw $04, $631d ; add_predef TMToMove
- dbw $1c, $5eb3 ; add_predef Func_71ddf
- dbw $17, $40d4 ; add_predef StarterDex ; 46
- dbw $03, $7161 ; add_predef _AddPartyMon
- dbw $03, $78ad ; add_predef UpdateHPBar2
- dbw $0f, $4eb1 ; add_predef DrawEnemyHUDAndHPBar
- dbw $1c, $4fe4 ; add_predef LoadTownMap_Nest
- dbw $09, $7d20 ; add_predef PrintMonType
- dbw $10, $516f ; add_predef EmotionBubble; 4C player exclamation
- dbw $01, $5b63 ; add_predef EmptyFunc3; return immediately
- dbw $01, $625d ; add_predef AskName
- dbw $06, $66e5 ; add_predef PewterGuys
- dbw $1c, $7b56 ; add_predef SaveSAVtoSRAM2
- dbw $1c, $7a24 ; add_predef LoadSAVCheckSum2
- dbw $1c, $7959 ; add_predef LoadSAV
- dbw $1c, $7b32 ; add_predef SaveSAVtoSRAM1
- dbw $1c, $5b86 ; add_predef DoInGameTradeDialogue ; 54 initiate trade
- dbw $3c, $4f26 ; add_predef HallOfFamePC
- dbw $11, $4169 ; add_predef DisplayDexRating
- dbw $1e, $4615 ; dbw $1E, _LeaveMapAnim ; wrong bank
- dbw $1e, $4567 ; dbw $1E, EnterMapAnim ; wrong bank
- dbw $03, $4309 ; add_predef GetTileTwoStepsInFrontOfPlayer
- dbw $03, $4356 ; add_predef CheckForCollisionWhenPushingBoulder
- dbw $3d, $5b06 ; add_predef PrintStrengthTxt
- dbw $01, $4d55 ; add_predef PickupItem
- dbw $09, $7d4d ; add_predef PrintMoveType
- dbw $03, $72f9 ; add_predef LoadMovePPs
- dbw $04, $5468 ; add_predef DrawHP ; 5F
- dbw $04, $546f ; add_predef DrawHP2
- dbw $07, $4264 ; add_predef Func_1c9c6
- dbw $16, $4ecc ; add_predef OaksAideScript
+ ; these are pointers to ASM routines.
+ ; they appear to be used in overworld map scripts.
+ const_def
+ add_predef DrawPlayerHUDAndHPBar
+ add_predef CopyUncompressedPicToTilemap
+ add_predef AnimateSendingOutMon
+ add_predef ScaleSpriteByTwo
+ add_predef LoadMonBackPic
+ add_predef CopyDownscaledMonTiles
+ add_predef Func_f0a7
+ add_predef HealParty
+ add_predef MoveAnimation ; 08 play move animation (1e:4d97)
+ add_predef DivideBCDPredef
+ add_predef DivideBCDPredef2
+ add_predef AddBCDPredef
+ add_predef SubBCDPredef
+ add_predef DivideBCDPredef3
+ add_predef DivideBCDPredef4
+ add_predef InitPlayerData
+ add_predef FlagActionPredef
+ add_predef HideObject
+ add_predef IsObjectHidden
+ add_predef ApplyOutOfBattlePoisonDamage
+ add_predef AnyPartyAlive
+ add_predef ShowObject
+ add_predef ShowObject2
+ add_predef ReplaceTileBlock
+ add_predef InitPlayerData2
+ add_predef LoadTilesetHeader
+ add_predef LearnMoveFromLevelUp
+ add_predef LearnMove
+ add_predef GetQuantityOfItemInBag
+
+ predef_const CheckForHiddenObjectOrBookshelfOrCardKeyDoor
+ predef_const GiveItem
+ dbw $03, CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; home bank
+ dbw $03, GiveItem ; home bank
+
+ add_predef InvertBGPal_4Frames
+ add_predef FindPathToPlayer
+ add_predef PredefShakeScreenVertically
+ add_predef CalcPositionOfPlayerRelativeToNPC
+ add_predef ConvertNPCMovementDirectionsToJoypadMasks
+ add_predef PredefShakeScreenHorizontally
+ add_predef UpdateHPBar
+ add_predef HPBarLength
+ add_predef Diploma_TextBoxBorder
+ add_predef DoubleOrHalveSelectedStats
+ add_predef ShowPokedexMenu
+ add_predef EvolutionAfterBattle
+ add_predef SaveSAVtoSRAM0
+ add_predef InitOpponent
+ add_predef CableClub_Run
+ add_predef DrawBadges
+ add_predef ExternalClockTradeAnim
+ add_predef BattleTransition
+ add_predef CopyTileIDsFromList
+ add_predef PlayIntro
+ add_predef GetMoveSoundB
+ add_predef FlashScreen
+ add_predef GetTileAndCoordsInFrontOfPlayer
+ add_predef StatusScreen
+ add_predef StatusScreen2
+ add_predef InternalClockTradeAnim
+ add_predef TrainerEngage
+ add_predef IndexToPokedex
+ add_predef DisplayPicCenteredOrUpperRight ; 3B display pic? (01:600d)
+ add_predef UsedCut
+ add_predef ShowPokedexData
+ add_predef WriteMonMoves
+ add_predef SaveSAV
+ add_predef LoadSGB
+ add_predef MarkTownVisitedAndLoadMissableObjects
+ add_predef SetPartyMonTypes
+ add_predef CanLearnTM
+ add_predef TMToMove
+ add_predef _RunPaletteCommand
+ add_predef StarterDex ; 46 (17:40d4)
+ add_predef _AddPartyMon
+ add_predef UpdateHPBar2
+ add_predef DrawEnemyHUDAndHPBar
+ add_predef LoadTownMap_Nest
+ add_predef PrintMonType
+ add_predef EmotionBubble ; 4C player exclamation (10:516f)
+ add_predef EmptyFunc3 ; return immediately (01:5b63)
+ add_predef AskName
+ add_predef PewterGuys
+ add_predef SaveSAVtoSRAM2
+ add_predef LoadSAV2
+ add_predef LoadSAV
+ add_predef SaveSAVtoSRAM1
+ add_predef DoInGameTradeDialogue ; 54 initiate trade (1c:5b86)
+ add_predef HallOfFamePC
+ add_predef DisplayDexRating
+ predef_const _LeaveMapAnim
+ predef_const EnterMapAnim
+ dbw $1E, _LeaveMapAnim ; wrong bank
+ dbw $1E, EnterMapAnim ; wrong bank
+ add_predef GetTileTwoStepsInFrontOfPlayer
+ add_predef CheckForCollisionWhenPushingBoulder
+ add_predef PrintStrengthTxt
+ add_predef PickUpItem
+ add_predef PrintMoveType
+ add_predef LoadMovePPs
+ add_predef DrawHP ; 5F (04:5468)
+ add_predef DrawHP2
+ add_predef DisplayElevatorFloorMenu
+ add_predef OaksAideScript
diff --git a/home.asm b/home.asm
index 19a5b6fc..11a0dcc0 100644
--- a/home.asm
+++ b/home.asm
@@ -2739,7 +2739,7 @@ PlayTrainerMusic:: ; 3379 (0:3379)
xor a
ld [wAudioFadeOutControl], a
call StopAllMusic ; stop music
- ld a, $1f ; BANK(Music_MeetEvilTrainer)
+ ld a, BANK(Music_MeetEvilTrainer)
ld [wAudioROMBank], a
ld [wAudioSavedROMBank], a
ld a, [wEngagedTrainerClass]
@@ -2751,7 +2751,7 @@ PlayTrainerMusic:: ; 3379 (0:3379)
jr z, .noEvilTrainer
cp b
jr nz, .evilTrainerListLoop
- ld a, $f5 ; MUSIC_MEET_EVIL_TRAINER
+ ld a, MUSIC_MEET_EVIL_TRAINER
jr .PlaySound
.noEvilTrainer
ld hl, FemaleTrainerList
@@ -2761,10 +2761,10 @@ PlayTrainerMusic:: ; 3379 (0:3379)
jr z, .maleTrainer
cp b
jr nz, .femaleTrainerListLoop
- ld a, $f8 ; MUSIC_MEET_FEMALE_TRAINER
+ ld a, MUSIC_MEET_FEMALE_TRAINER
jr .PlaySound
.maleTrainer
- ld a, $fb ; MUSIC_MEET_MALE_TRAINER
+ ld a, MUSIC_MEET_MALE_TRAINER
.PlaySound
ld [wNewSoundID], a
jp PlaySound
@@ -3515,7 +3515,7 @@ GetItemPrice:: ; 37d2 (0:37d2)
push af
ld a, [wListMenuID]
cp MOVESLISTMENU
- ld a, $1 ; BANK(ItemPrices)
+ ld a, BANK(ItemPrices)
jr nz, .asm_37e0
ld a, $f ; hardcoded Bank
.asm_37e0
diff --git a/home/overworld.asm b/home/overworld.asm
index 21f5c1c8..1368dc9d 100644
--- a/home/overworld.asm
+++ b/home/overworld.asm
@@ -47,308 +47,308 @@ OverworldLoopLessDelay:: ; 0245 (0:0245)
call IsSurfingPikachuInParty
call LoadGBPal
call HandleMidJump
- ld a,[wWalkCounter]
+ ld a, [wWalkCounter]
and a
- jp nz,.moveAhead ; if the player sprite has not yet completed the walking animation
+ jp nz, .moveAhead ; if the player sprite has not yet completed the walking animation
call JoypadOverworld ; get joypad state (which is possibly simulated)
callba SafariZoneCheck ; 7:6321
- ld a,[wSafariZoneGameOver]
+ ld a, [wSafariZoneGameOver]
and a
- jp nz,WarpFound2
- ld hl,wd72d
- bit 3,[hl]
- res 3,[hl]
- jp nz,WarpFound2
- ld a,[wd732]
- and a,1 << 4 | 1 << 3 ; fly warp or dungeon warp
- jp nz,HandleFlyWarpOrDungeonWarp
- ld a,[wCurOpponent]
+ jp nz, WarpFound2
+ ld hl, wd72d
+ bit 3, [hl]
+ res 3, [hl]
+ jp nz, WarpFound2
+ ld a, [wd732]
+ and 1 << 4 | 1 << 3 ; fly warp or dungeon warp
+ jp nz, HandleFlyWarpOrDungeonWarp
+ ld a, [wCurOpponent]
and a
- jp nz,.newBattle
- ld a,[wd730]
- bit 7,a ; are we simulating button presses?
- jr z,.notSimulating
- ld a,[hJoyHeld]
+ jp nz, .newBattle
+ ld a, [wd730]
+ bit 7, a ; are we simulating button presses?
+ jr z, .notSimulating
+ ld a, [hJoyHeld]
jr .checkIfStartIsPressed
.notSimulating
- ld a,[hJoyPressed]
+ ld a, [hJoyPressed]
.checkIfStartIsPressed
- bit 3,a ; start button
- jr z,.startButtonNotPressed
+ bit 3, a ; start button
+ jr z, .startButtonNotPressed
; if START is pressed
xor a
- ld [hSpriteIndexOrTextID],a ; start menu text ID
+ ld [hSpriteIndexOrTextID], a ; start menu text ID
jp .displayDialogue
.startButtonNotPressed
- bit 0,a ; A button
- jp z,.checkIfDownButtonIsPressed
+ bit 0, a ; A button
+ jp z, .checkIfDownButtonIsPressed
; if A is pressed
- ld a,[wd730]
- bit 2,a
- jp nz,.noDirectionButtonsPressed
+ ld a, [wd730]
+ bit 2, a
+ jp nz, .noDirectionButtonsPressed
call IsPlayerCharacterBeingControlledByGame
- jr nz,.checkForOpponent
+ jr nz, .checkForOpponent
call CheckForHiddenObjectOrBookshelfOrCardKeyDoor
- ld a,[$ffeb]
+ ld a, [$ffeb]
and a
- jp z,OverworldLoop ; jump if a hidden object or bookshelf was found, but not if a card key door was found
+ jp z, OverworldLoop ; jump if a hidden object or bookshelf was found, but not if a card key door was found
xor a
- ld [wd436],a ; new yellow address
+ ld [wd436], a ; new yellow address
call IsSpriteOrSignInFrontOfPlayer
call Func_0ffe
- ld a,[hSpriteIndexOrTextID]
+ ld a, [hSpriteIndexOrTextID]
and a
- jp z,OverworldLoop
+ jp z, OverworldLoop
.displayDialogue
predef GetTileAndCoordsInFrontOfPlayer
call UpdateSprites
- ld a,[wFlags_0xcd60]
- bit 2,a
- jr nz,.checkForOpponent
- bit 0,a
- jr nz,.checkForOpponent
+ ld a, [wFlags_0xcd60]
+ bit 2, a
+ jr nz, .checkForOpponent
+ bit 0, a
+ jr nz, .checkForOpponent
aCoord 8, 9
- ld [wTilePlayerStandingOn],a ; unused?
+ ld [wTilePlayerStandingOn], a ; unused?
call DisplayTextID ; display either the start menu or the NPC/sign text
- ld a,[wEnteringCableClub]
+ ld a, [wEnteringCableClub]
and a
- jr z,.checkForOpponent
+ jr z, .checkForOpponent
xor a
- ld [wLinkTimeoutCounter],a
+ ld [wLinkTimeoutCounter], a
jp EnterMap
; predef LoadSAV
-; ld a,[wCurMap]
-; ld [wDestinationMap],a
+; ld a, [wCurMap]
+; ld [wDestinationMap], a
; call SpecialWarpIn
-; ld a,[wCurMap]
+; ld a, [wCurMap]
; call SwitchToMapRomBank ; switch to the ROM bank of the current map
-; ld hl,wCurMapTileset
-; set 7,[hl]
+; ld hl, wCurMapTileset
+; set 7, [hl]
.checkForOpponent
- ld a,[wCurOpponent]
+ ld a, [wCurOpponent]
and a
- jp nz,.newBattle
+ jp nz, .newBattle
jp OverworldLoop
.noDirectionButtonsPressed
call UpdateSprites ; 231c
- ld hl,wFlags_0xcd60
- res 2,[hl]
+ ld hl, wFlags_0xcd60
+ res 2, [hl]
xor a
ld [wd435], a
ld a, $1
- ld [wCheckFor180DegreeTurn],a
- ld a,[wPlayerMovingDirection] ; the direction that was pressed last time
+ ld [wCheckFor180DegreeTurn], a
+ ld a, [wPlayerMovingDirection] ; the direction that was pressed last time
and a
jr z, .overworldloop
; if a direction was pressed last time
- ld [wPlayerLastStopDirection],a ; save the last direction
+ ld [wPlayerLastStopDirection], a ; save the last direction
xor a
- ld [wPlayerMovingDirection],a ; zero the direction
+ ld [wPlayerMovingDirection], a ; zero the direction
.overworldloop
jp OverworldLoop
.checkIfDownButtonIsPressed
- ld a,[hJoyHeld] ; current joypad state
- bit 7,a ; down button
- jr z,.checkIfUpButtonIsPressed
- ld a,1
- ld [wSpriteStateData1 + 3],a ; delta Y
- ld a,PLAYER_DIR_DOWN
+ ld a, [hJoyHeld] ; current joypad state
+ bit 7, a ; down button
+ jr z, .checkIfUpButtonIsPressed
+ ld a, 1
+ ld [wSpriteStateData1 + 3], a ; delta Y
+ ld a, PLAYER_DIR_DOWN
jr .handleDirectionButtonPress
.checkIfUpButtonIsPressed
- bit 6,a ; up button
- jr z,.checkIfLeftButtonIsPressed
- ld a,-1
- ld [wSpriteStateData1 + 3],a ; delta Y
- ld a,PLAYER_DIR_UP
+ bit 6, a ; up button
+ jr z, .checkIfLeftButtonIsPressed
+ ld a, -1
+ ld [wSpriteStateData1 + 3], a ; delta Y
+ ld a, PLAYER_DIR_UP
jr .handleDirectionButtonPress
.checkIfLeftButtonIsPressed
- bit 5,a ; left button
- jr z,.checkIfRightButtonIsPressed
- ld a,-1
- ld [wSpriteStateData1 + 5],a ; delta X
- ld a,PLAYER_DIR_LEFT
+ bit 5, a ; left button
+ jr z, .checkIfRightButtonIsPressed
+ ld a, -1
+ ld [wSpriteStateData1 + 5], a ; delta X
+ ld a, PLAYER_DIR_LEFT
jr .handleDirectionButtonPress
.checkIfRightButtonIsPressed
- bit 4,a ; right button
- jr z,.noDirectionButtonsPressed
- ld a,$1
- ld [wSpriteStateData1 + 5],a
- ld a,$1
+ bit 4, a ; right button
+ jr z, .noDirectionButtonsPressed
+ ld a, $1
+ ld [wSpriteStateData1 + 5], a
+ ld a, $1
.handleDirectionButtonPress
- ld [wPlayerDirection],a ; new direction
- ld a,[wd730]
- bit 7,a ; are we simulating button presses?
- jr nz,.noDirectionChange ; ignore direction changes if we are
- ld a,[wCheckFor180DegreeTurn]
+ ld [wPlayerDirection], a ; new direction
+ ld a, [wd730]
+ bit 7, a ; are we simulating button presses?
+ jr nz, .noDirectionChange ; ignore direction changes if we are
+ ld a, [wCheckFor180DegreeTurn]
and a
- jr z,.noDirectionChange
- ld a,[wPlayerDirection] ; new direction
- ld b,a
- ld a,[wPlayerLastStopDirection] ; old direction
+ jr z, .noDirectionChange
+ ld a, [wPlayerDirection] ; new direction
+ ld b, a
+ ld a, [wPlayerLastStopDirection] ; old direction
cp b
- jr z,.noDirectionChange
- ld a,$8
- ld [wd435],a
+ jr z, .noDirectionChange
+ ld a, $8
+ ld [wd435], a
; unlike in red/blue, yellow does not have the 180 degrees odd code
- ld hl,wFlags_0xcd60
- set 2,[hl]
+ ld hl, wFlags_0xcd60
+ set 2, [hl]
xor a
- ld [wCheckFor180DegreeTurn],a
- ld a,[wPlayerDirection]
- ld [wPlayerMovingDirection],a
+ ld [wCheckFor180DegreeTurn], a
+ ld a, [wPlayerDirection]
+ ld [wPlayerMovingDirection], a
call NewBattle
- jp c,.battleOccurred
+ jp c, .battleOccurred
jp OverworldLoop
.noDirectionChange
- ld a,[wPlayerDirection] ; current direction
- ld [wPlayerMovingDirection],a ; save direction
+ ld a, [wPlayerDirection] ; current direction
+ ld [wPlayerMovingDirection], a ; save direction
call UpdateSprites
- ld a,[wWalkBikeSurfState]
- cp a,$02 ; surfing
- jr z,.surfing
+ ld a, [wWalkBikeSurfState]
+ cp $02 ; surfing
+ jr z, .surfing
; not surfing
call CollisionCheckOnLand
- jr nc,.noCollision
+ jr nc, .noCollision
; collision occurred
push hl
- ld hl,wd736
- bit 2,[hl] ; standing on warp flag
+ ld hl, wd736
+ bit 2, [hl] ; standing on warp flag
pop hl
- jp z,OverworldLoop
+ jp z, OverworldLoop
; collision occurred while standing on a warp
push hl
call ExtraWarpCheck ; sets carry if there is a potential to warp
pop hl
- jp c,CheckWarpsCollision
+ jp c, CheckWarpsCollision
jp OverworldLoop
.surfing
call CollisionCheckOnWater
- jp c,OverworldLoop
+ jp c, OverworldLoop
.noCollision
- ld a,$08
- ld [wWalkCounter],a
+ ld a, $08
+ ld [wWalkCounter], a
callab Func_fcc08
jr .moveAhead2
.moveAhead
call IsSpinning
call UpdateSprites ; move sprites
.moveAhead2
- ld hl,wFlags_0xcd60
- res 2,[hl]
+ ld hl, wFlags_0xcd60
+ res 2, [hl]
xor a
- ld [wd435],a
+ ld [wd435], a
call DoBikeSpeedup
call AdvancePlayerSprite
- ld a,[wWalkCounter]
+ ld a, [wWalkCounter]
and a
- jp nz,CheckMapConnections ; it seems like this check will never succeed (the other place where CheckMapConnections is run works)
+ jp nz, CheckMapConnections ; it seems like this check will never succeed (the other place where CheckMapConnections is run works)
; walking animation finished
call StepCountCheck
- ld a,[wd790]
- bit 7,a ; in the safari zone?
- jr z,.notSafariZone
+ ld a, [wd790]
+ bit 7, a ; in the safari zone?
+ jr z, .notSafariZone
callba SafariZoneCheckSteps
- ld a,[wSafariZoneGameOver]
+ ld a, [wSafariZoneGameOver]
and a
- jp nz,WarpFound2
+ jp nz, WarpFound2
.notSafariZone
- ld a,[wIsInBattle]
+ ld a, [wIsInBattle]
and a
- jp nz,CheckWarpsNoCollision
+ jp nz, CheckWarpsNoCollision
predef ApplyOutOfBattlePoisonDamage ; also increment daycare mon exp
- ld a,[wOutOfBattleBlackout]
+ ld a, [wOutOfBattleBlackout]
and a
- jp nz,HandleBlackOut ; if all pokemon fainted
+ jp nz, HandleBlackOut ; if all pokemon fainted
.newBattle
call NewBattle
- ld hl,wd736
- res 2,[hl] ; standing on warp flag
- jp nc,CheckWarpsNoCollision ; check for warps if there was no battle
+ ld hl, wd736
+ res 2, [hl] ; standing on warp flag
+ jp nc, CheckWarpsNoCollision ; check for warps if there was no battle
.battleOccurred
- ld hl,wd72d
- res 6,[hl]
- ld hl,wFlags_D733
- res 3,[hl]
- ld hl,wd126
- set 5,[hl]
- set 6,[hl]
+ ld hl, wd72d
+ res 6, [hl]
+ ld hl, wFlags_D733
+ res 3, [hl]
+ ld hl, wd126
+ set 5, [hl]
+ set 6, [hl]
xor a
- ld [hJoyHeld],a
- ld a,[wCurMap]
- cp a,CINNABAR_GYM
- jr nz,.notCinnabarGym
- ld hl,wd79b
- set 7,[hl]
+ ld [hJoyHeld], a
+ ld a, [wCurMap]
+ cp CINNABAR_GYM
+ jr nz, .notCinnabarGym
+ ld hl, wd79b
+ set 7, [hl]
.notCinnabarGym
- ld hl,wd72e
- set 5,[hl]
- ld a,[wCurMap]
- cp a,OAKS_LAB
- jp z,.noFaintCheck ; no blacking out if the player lost to the rival in Oak's lab
+ ld hl, wd72e
+ set 5, [hl]
+ ld a, [wCurMap]
+ cp OAKS_LAB
+ jp z, .noFaintCheck ; no blacking out if the player lost to the rival in Oak's lab
callab AnyPartyAlive
- ld a,d
+ ld a, d
and a
- jr z,AllPokemonFainted
+ jr z, AllPokemonFainted
.noFaintCheck
- ld c,10
+ ld c, 10
call DelayFrames
jp EnterMap
StepCountCheck:: ; 0457 (0:0457)
- ld a,[wd730]
- bit 7,a
- jr nz,.doneStepCounting ; if button presses are being simulated, don't count steps
+ ld a, [wd730]
+ bit 7, a
+ jr nz, .doneStepCounting ; if button presses are being simulated, don't count steps
; step counting
- ld hl,wStepCounter
+ ld hl, wStepCounter
dec [hl]
- ld a,[wd72c]
- bit 0,a
- jr z,.doneStepCounting
- ld hl,wNumberOfNoRandomBattleStepsLeft
+ ld a, [wd72c]
+ bit 0, a
+ jr z, .doneStepCounting
+ ld hl, wNumberOfNoRandomBattleStepsLeft
dec [hl]
- jr nz,.doneStepCounting
- ld hl,wd72c
- res 0,[hl] ; indicate that the player has stepped thrice since the last battle
+ jr nz, .doneStepCounting
+ ld hl, wd72c
+ res 0, [hl] ; indicate that the player has stepped thrice since the last battle
.doneStepCounting
ret
AllPokemonFainted:: ; 0475 (0:0475)
- ld a,$ff
- ld [wIsInBattle],a
+ ld a, $ff
+ ld [wIsInBattle], a
call RunMapScript
jp HandleBlackOut
; function to determine if there will be a battle and execute it (either a trainer battle or wild battle)
; sets carry if a battle occurred and unsets carry if not
NewBattle:: ; 0480 (0:0480)
- ld a,[wd72d]
- bit 4,a
- jr nz,.noBattle
+ ld a, [wd72d]
+ bit 4, a
+ jr nz, .noBattle
call IsPlayerCharacterBeingControlledByGame
- jr nz,.noBattle ; no battle if the player character is under the game's control
- ld a,[wd72e]
- bit 4,a
- jr nz,.noBattle
+ jr nz, .noBattle ; no battle if the player character is under the game's control
+ ld a, [wd72e]
+ bit 4, a
+ jr nz, .noBattle
jpba InitBattle ; 3d:5ff2
.noBattle
and a
ret
DoBikeSpeedup:: ; 049d (0:049d)
- ld a,[wWalkBikeSurfState]
+ ld a, [wWalkBikeSurfState]
dec a ; riding a bike?
ret nz
- ld a,[wd736]
- bit 6,a
+ ld a, [wd736]
+ bit 6, a
ret nz
- ld a,[wNPCMovementScriptPointerTableNum]
+ ld a, [wNPCMovementScriptPointerTableNum]
and a
ret nz
- ld a,[wCurMap]
+ ld a, [wCurMap]
cp ROUTE_17 ; cycling road
- jr nz,.goFaster
- ld a,[hJoyHeld]
- and a,D_UP | D_LEFT | D_RIGHT
+ jr nz, .goFaster
+ ld a, [hJoyHeld]
+ and D_UP | D_LEFT | D_RIGHT
ret nz
.goFaster
call AdvancePlayerSprite
@@ -356,51 +356,51 @@ DoBikeSpeedup:: ; 049d (0:049d)
; check if the player has stepped onto a warp after having not collided
CheckWarpsNoCollision:: ; 04bd (0:04bd)
- ld a,[wNumberOfWarps]
+ ld a, [wNumberOfWarps]
and a
- jp z,CheckMapConnections
- ld b,0
- ld a,[wNumberOfWarps]
- ld c,a
- ld a,[wYCoord]
- ld d,a
- ld a,[wXCoord]
- ld e,a
- ld hl,wWarpEntries
+ jp z, CheckMapConnections
+ ld b, 0
+ ld a, [wNumberOfWarps]
+ ld c, a
+ ld a, [wYCoord]
+ ld d, a
+ ld a, [wXCoord]
+ ld e, a
+ ld hl, wWarpEntries
CheckWarpsNoCollisionLoop:: ; 04d5 (0:04d5)
- ld a,[hli] ; check if the warp's Y position matches
+ ld a, [hli] ; check if the warp's Y position matches
cp d
- jr nz,CheckWarpsNoCollisionRetry1
- ld a,[hli] ; check if the warp's X position matches
+ jr nz, CheckWarpsNoCollisionRetry1
+ ld a, [hli] ; check if the warp's X position matches
cp e
- jr nz,CheckWarpsNoCollisionRetry2
+ jr nz, CheckWarpsNoCollisionRetry2
; if a match was found
push hl
push bc
- ld hl,wd736
- set 2,[hl] ; standing on warp flag
+ ld hl, wd736
+ set 2, [hl] ; standing on warp flag
callba IsPlayerStandingOnDoorTileOrWarpTile
pop bc
pop hl
- jr c,WarpFound1 ; jump if standing on door or warp
+ jr c, WarpFound1 ; jump if standing on door or warp
push hl
push bc
call ExtraWarpCheck
pop bc
pop hl
- jr nc,CheckWarpsNoCollisionRetry2
+ jr nc, CheckWarpsNoCollisionRetry2
; if the extra check passed
- ld a,[wFlags_D733]
- bit 2,a
- jr nz,WarpFound1
+ ld a, [wFlags_D733]
+ bit 2, a
+ jr nz, WarpFound1
push de
push bc
call Joypad
pop bc
pop de
- ld a,[hJoyHeld]
- and a,D_DOWN | D_UP | D_LEFT | D_RIGHT
- jr z,CheckWarpsNoCollisionRetry2 ; if directional buttons aren't being pressed, do not pass through the warp
+ ld a, [hJoyHeld]
+ and D_DOWN | D_UP | D_LEFT | D_RIGHT
+ jr z, CheckWarpsNoCollisionRetry2 ; if directional buttons aren't being pressed, do not pass through the warp
jr WarpFound1
CheckWarpsNoCollisionRetry1:: ; 050f (0:050f)
@@ -411,29 +411,29 @@ CheckWarpsNoCollisionRetry2:: ; 0510 (0:0510)
ContinueCheckWarpsNoCollisionLoop:: ; 0512 (0:0512)
inc b ; increment warp number
dec c ; decrement number of warps
- jp nz,CheckWarpsNoCollisionLoop
+ jp nz, CheckWarpsNoCollisionLoop
jp CheckMapConnections
; check if the player has stepped onto a warp after having collided
CheckWarpsCollision:: ; 051a (0:051a)
- ld a,[wNumberOfWarps]
- ld c,a
- ld hl,wWarpEntries
+ ld a, [wNumberOfWarps]
+ ld c, a
+ ld hl, wWarpEntries
.loop
- ld a,[hli] ; Y coordinate of warp
- ld b,a
- ld a,[wYCoord]
+ ld a, [hli] ; Y coordinate of warp
+ ld b, a
+ ld a, [wYCoord]
cp b
- jr nz,.retry1
- ld a,[hli] ; X coordinate of warp
- ld b,a
- ld a,[wXCoord]
+ jr nz, .retry1
+ ld a, [hli] ; X coordinate of warp
+ ld b, a
+ ld a, [wXCoord]
cp b
- jr nz,.retry2
- ld a,[hli]
- ld [wDestinationWarpID],a
- ld a,[hl]
- ld [hWarpDestinationMap],a
+ jr nz, .retry2
+ ld a, [hli]
+ ld [wDestinationWarpID], a
+ ld a, [hl]
+ ld [hWarpDestinationMap], a
jr WarpFound2
.retry1
inc hl
@@ -441,34 +441,34 @@ CheckWarpsCollision:: ; 051a (0:051a)
inc hl
inc hl
dec c
- jr nz,.loop
+ jr nz, .loop
jp OverworldLoop
WarpFound1:: ; 0543 (0:0543)
- ld a,[hli]
- ld [wDestinationWarpID],a
- ld a,[hli]
- ld [hWarpDestinationMap],a
+ ld a, [hli]
+ ld [wDestinationWarpID], a
+ ld a, [hli]
+ ld [hWarpDestinationMap], a
WarpFound2:: ; 054a (0:054a)
- ld a,[wNumberOfWarps]
+ ld a, [wNumberOfWarps]
sub c
- ld [wWarpedFromWhichWarp],a ; save ID of used warp
- ld a,[wCurMap]
- ld [wWarpedFromWhichMap],a
+ ld [wWarpedFromWhichWarp], a ; save ID of used warp
+ ld a, [wCurMap]
+ ld [wWarpedFromWhichMap], a
call CheckIfInOutsideMap
- jr nz,.indoorMaps
+ jr nz, .indoorMaps
; this is for handling "outside" maps that can't have the 0xFF destination map
- ld a,[wCurMap]
- ld [wLastMap],a
- ld a,[wCurMapWidth]
- ld [wUnusedD366],a ; not read
- ld a,[hWarpDestinationMap]
- ld [wCurMap],a
- cp a,ROCK_TUNNEL_1
- jr nz,.notRockTunnel
- ld a,$06
- ld [wMapPalOffset],a
+ ld a, [wCurMap]
+ ld [wLastMap], a
+ ld a, [wCurMapWidth]
+ ld [wUnusedD366], a ; not read
+ ld a, [hWarpDestinationMap]
+ ld [wCurMap], a
+ cp ROCK_TUNNEL_1
+ jr nz, .notRockTunnel
+ ld a, $06
+ ld [wMapPalOffset], a
call GBFadeOutToBlack
.notRockTunnel
callab Func_fc5fa ; 3f:45fa
@@ -476,175 +476,175 @@ WarpFound2:: ; 054a (0:054a)
jr .done
; for maps that can have the 0xFF destination map, which means to return to the outside map; not all these maps are necessarily indoors, though
.indoorMaps
- ld a,[hWarpDestinationMap] ; destination map
- cp a,$ff
- jr z,.goBackOutside
+ ld a, [hWarpDestinationMap] ; destination map
+ cp $ff
+ jr z, .goBackOutside
; if not going back to the previous map
- ld [wCurMap],a
+ ld [wCurMap], a
callba IsPlayerStandingOnWarpPadOrHole
- ld a,[wStandingOnWarpPadOrHole]
+ ld a, [wStandingOnWarpPadOrHole]
dec a ; is the player on a warp pad?
- jr nz,.notWarpPad
+ jr nz, .notWarpPad
; if the player is on a warp pad
call LeaveMapAnim
- ld hl,wd732
- set 3,[hl]
+ ld hl, wd732
+ set 3, [hl]
jr .skipMapChangeSound
.notWarpPad
call PlayMapChangeSound
.skipMapChangeSound
- ld hl,wd736
- res 0,[hl]
- res 1,[hl]
+ ld hl, wd736
+ res 0, [hl]
+ res 1, [hl]
callab Func_fc65b ; 3f:465b
jr .done
.goBackOutside
callab Func_fc69a ; 3f:469a
- ld a,[wLastMap]
- ld [wCurMap],a
+ ld a, [wLastMap]
+ ld [wCurMap], a
call PlayMapChangeSound
xor a
- ld [wMapPalOffset],a
+ ld [wMapPalOffset], a
.done
- ld hl,wd736
- set 0,[hl] ; have the player's sprite step out from the door (if there is one)
+ ld hl, wd736
+ set 0, [hl] ; have the player's sprite step out from the door (if there is one)
call IgnoreInputForHalfSecond
jp EnterMap
; if no matching warp was found
CheckMapConnections:: ; 05db (0:05db)
.checkWestMap
- ld a,[wXCoord]
- cp a,$ff
- jr nz,.checkEastMap
- ld a,[W_MAPCONN3PTR]
- ld [wCurMap],a
- ld a,[wWestConnectedMapXAlignment] ; new X coordinate upon entering west map
- ld [wXCoord],a
- ld a,[wYCoord]
- ld c,a
- ld a,[wWestConnectedMapYAlignment] ; Y adjustment upon entering west map
+ ld a, [wXCoord]
+ cp $ff
+ jr nz, .checkEastMap
+ ld a, [W_MAPCONN3PTR]
+ ld [wCurMap], a
+ ld a, [wWestConnectedMapXAlignment] ; new X coordinate upon entering west map
+ ld [wXCoord], a
+ ld a, [wYCoord]
+ ld c, a
+ ld a, [wWestConnectedMapYAlignment] ; Y adjustment upon entering west map
add c
- ld c,a
- ld [wYCoord],a
- ld a,[wWestConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for Y position
- ld l,a
- ld a,[wWestConnectedMapViewPointer + 1]
- ld h,a
+ ld c, a
+ ld [wYCoord], a
+ ld a, [wWestConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for Y position
+ ld l, a
+ ld a, [wWestConnectedMapViewPointer + 1]
+ ld h, a
srl c
- jr z,.savePointer1
+ jr z, .savePointer1
.pointerAdjustmentLoop1
- ld a,[wWestConnectedMapWidth] ; width of connected map
- add a,MAP_BORDER * 2
- ld e,a
- ld d,0
- ld b,0
- add hl,de
+ ld a, [wWestConnectedMapWidth] ; width of connected map
+ add MAP_BORDER * 2
+ ld e, a
+ ld d, 0
+ ld b, 0
+ add hl, de
dec c
- jr nz,.pointerAdjustmentLoop1
+ jr nz, .pointerAdjustmentLoop1
.savePointer1
- ld a,l
- ld [wCurrentTileBlockMapViewPointer],a ; pointer to upper left corner of current tile block map section
- ld a,h
- ld [wCurrentTileBlockMapViewPointer + 1],a
+ ld a, l
+ ld [wCurrentTileBlockMapViewPointer], a ; pointer to upper left corner of current tile block map section
+ ld a, h
+ ld [wCurrentTileBlockMapViewPointer + 1], a
jp .loadNewMap
.checkEastMap
- ld b,a
- ld a,[wCurrentMapWidth2] ; map width
+ ld b, a
+ ld a, [wCurrentMapWidth2] ; map width
cp b
- jr nz,.checkNorthMap
- ld a,[W_MAPCONN4PTR]
- ld [wCurMap],a
- ld a,[wEastConnectedMapXAlignment] ; new X coordinate upon entering east map
- ld [wXCoord],a
- ld a,[wYCoord]
- ld c,a
- ld a,[wEastConnectedMapYAlignment] ; Y adjustment upon entering east map
+ jr nz, .checkNorthMap
+ ld a, [W_MAPCONN4PTR]
+ ld [wCurMap], a
+ ld a, [wEastConnectedMapXAlignment] ; new X coordinate upon entering east map
+ ld [wXCoord], a
+ ld a, [wYCoord]
+ ld c, a
+ ld a, [wEastConnectedMapYAlignment] ; Y adjustment upon entering east map
add c
- ld c,a
- ld [wYCoord],a
- ld a,[wEastConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for Y position
- ld l,a
- ld a,[wEastConnectedMapViewPointer + 1]
- ld h,a
+ ld c, a
+ ld [wYCoord], a
+ ld a, [wEastConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for Y position
+ ld l, a
+ ld a, [wEastConnectedMapViewPointer + 1]
+ ld h, a
srl c
- jr z,.savePointer2
+ jr z, .savePointer2
.pointerAdjustmentLoop2
- ld a,[wEastConnectedMapWidth]
- add a,MAP_BORDER * 2
- ld e,a
- ld d,0
- ld b,0
- add hl,de
+ ld a, [wEastConnectedMapWidth]
+ add MAP_BORDER * 2
+ ld e, a
+ ld d, 0
+ ld b, 0
+ add hl, de
dec c
- jr nz,.pointerAdjustmentLoop2
+ jr nz, .pointerAdjustmentLoop2
.savePointer2
- ld a,l
- ld [wCurrentTileBlockMapViewPointer],a ; pointer to upper left corner of current tile block map section
- ld a,h
- ld [wCurrentTileBlockMapViewPointer + 1],a
+ ld a, l
+ ld [wCurrentTileBlockMapViewPointer], a ; pointer to upper left corner of current tile block map section
+ ld a, h
+ ld [wCurrentTileBlockMapViewPointer + 1], a
jp .loadNewMap
.checkNorthMap
- ld a,[wYCoord]
- cp a,$ff
- jr nz,.checkSouthMap
- ld a,[W_MAPCONN1PTR]
- ld [wCurMap],a
- ld a,[wNorthConnectedMapYAlignment] ; new Y coordinate upon entering north map
- ld [wYCoord],a
- ld a,[wXCoord]
- ld c,a
- ld a,[wNorthConnectedMapXAlignment] ; X adjustment upon entering north map
+ ld a, [wYCoord]
+ cp $ff
+ jr nz, .checkSouthMap
+ ld a, [W_MAPCONN1PTR]
+ ld [wCurMap], a
+ ld a, [wNorthConnectedMapYAlignment] ; new Y coordinate upon entering north map
+ ld [wYCoord], a
+ ld a, [wXCoord]
+ ld c, a
+ ld a, [wNorthConnectedMapXAlignment] ; X adjustment upon entering north map
add c
- ld c,a
- ld [wXCoord],a
- ld a,[wNorthConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for X position
- ld l,a
- ld a,[wNorthConnectedMapViewPointer + 1]
- ld h,a
- ld b,0
+ ld c, a
+ ld [wXCoord], a
+ ld a, [wNorthConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for X position
+ ld l, a
+ ld a, [wNorthConnectedMapViewPointer + 1]
+ ld h, a
+ ld b, 0
srl c
- add hl,bc
- ld a,l
- ld [wCurrentTileBlockMapViewPointer],a ; pointer to upper left corner of current tile block map section
- ld a,h
- ld [wCurrentTileBlockMapViewPointer + 1],a
+ add hl, bc
+ ld a, l
+ ld [wCurrentTileBlockMapViewPointer], a ; pointer to upper left corner of current tile block map section
+ ld a, h
+ ld [wCurrentTileBlockMapViewPointer + 1], a
jp .loadNewMap
.checkSouthMap
- ld b,a
- ld a,[wCurrentMapHeight2]
+ ld b, a
+ ld a, [wCurrentMapHeight2]
cp b
- jr nz,.didNotEnterConnectedMap
- ld a,[W_MAPCONN2PTR]
- ld [wCurMap],a
- ld a,[wSouthConnectedMapYAlignment] ; new Y coordinate upon entering south map
- ld [wYCoord],a
- ld a,[wXCoord]
- ld c,a
- ld a,[wSouthConnectedMapXAlignment] ; X adjustment upon entering south map
+ jr nz, .didNotEnterConnectedMap
+ ld a, [W_MAPCONN2PTR]
+ ld [wCurMap], a
+ ld a, [wSouthConnectedMapYAlignment] ; new Y coordinate upon entering south map
+ ld [wYCoord], a
+ ld a, [wXCoord]
+ ld c, a
+ ld a, [wSouthConnectedMapXAlignment] ; X adjustment upon entering south map
add c
- ld c,a
- ld [wXCoord],a
- ld a,[wSouthConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for X position
- ld l,a
- ld a,[wSouthConnectedMapViewPointer + 1]
- ld h,a
- ld b,0
+ ld c, a
+ ld [wXCoord], a
+ ld a, [wSouthConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for X position
+ ld l, a
+ ld a, [wSouthConnectedMapViewPointer + 1]
+ ld h, a
+ ld b, 0
srl c
- add hl,bc
- ld a,l
- ld [wCurrentTileBlockMapViewPointer],a ; pointer to upper left corner of current tile block map section
- ld a,h
- ld [wCurrentTileBlockMapViewPointer + 1],a
+ add hl, bc
+ ld a, l
+ ld [wCurrentTileBlockMapViewPointer], a ; pointer to upper left corner of current tile block map section
+ ld a, h
+ ld [wCurrentTileBlockMapViewPointer + 1], a
.loadNewMap ; 06ce (0:06ce)
; load the connected map that was entered
- ld hl,wPikachuOverworldStateFlags
- set 4,[hl]
- ld a,$2
- ld [wd431],a
+ ld hl, wPikachuOverworldStateFlags
+ set 4, [hl]
+ ld a, $2
+ ld [wd431], a
call LoadMapHeader ; 0dab (0:0dab)
call PlayDefaultMusicFadeOutCurrent ; music
- ld b,SET_PAL_OVERWORLD
+ ld b, SET_PAL_OVERWORLD
call RunPaletteCommand
; Since the sprite set shouldn't change, this will just update VRAM slots at
; $C2XE without loading any tile patterns.
@@ -656,21 +656,21 @@ CheckMapConnections:: ; 05db (0:05db)
; function to play a sound when changing maps
PlayMapChangeSound:: ; 06ef (0:06ef)
- ld a,[wCurMapTileset]
+ ld a, [wCurMapTileset]
cp FACILITY
- jr z,.didNotGoThroughDoor
+ jr z, .didNotGoThroughDoor
cp CEMETERY
- jr z,.didNotGoThroughDoor
+ jr z, .didNotGoThroughDoor
aCoord 8, 8 ; upper left tile of the 4x4 square the player's sprite is standing on
cp UNDERGROUND ; door tile in tileset 0
- jr nz,.didNotGoThroughDoor
+ jr nz, .didNotGoThroughDoor
ld a, $ad ; SFX_GO_INSIDE
jr .playSound
.didNotGoThroughDoor
ld a, $b5 ; SFX_GO_OUTSIDE
.playSound
call PlaySound
- ld a,[wMapPalOffset]
+ ld a, [wMapPalOffset]
and a
ret nz
jp GBFadeOutToBlack
@@ -721,9 +721,9 @@ ExtraWarpCheck:: ; 071a (0:071a)
MapEntryAfterBattle:: ; 0750 (0:0750)
callba IsPlayerStandingOnWarp ; for enabling warp testing after collisions
- ld a,[wMapPalOffset]
+ ld a, [wMapPalOffset]
and a
- jp z,GBFadeInFromWhite
+ jp z, GBFadeInFromWhite
jp LoadGBPal
HandleBlackOut:: ; 0762 (0:0762)
@@ -773,9 +773,9 @@ Func_07c4:: ; 07c4 (0:07c4)
and a
ret z
xor a
- ld [wWalkBikeSurfState],a
- ld hl,wd732
- bit 4,[hl]
+ ld [wWalkBikeSurfState], a
+ ld hl, wd732
+ bit 4, [hl]
ret z
call PlayDefaultMusic
ret
@@ -797,7 +797,7 @@ LoadPlayerSpriteGraphics:: ; 07d7 (0:07d7)
jr .startWalking
.ridingBike
- ; If the bike can't be used,
+ ; If the bike can't be used,
; start walking instead.
call IsBikeRidingAllowed
jr c, .determineGraphics
@@ -819,7 +819,7 @@ LoadPlayerSpriteGraphics:: ; 07d7 (0:07d7)
jp LoadWalkingPlayerSpriteGraphics
IsBikeRidingAllowed:: ; 0805 (0:0805)
-; The bike can be used on Route 23 and Indigo Plateau,
+; The bike can be used on Route 23 and Indigo Plateau,
; or maps with tilesets in BikeRidingTilesets.
; Return carry if biking is allowed.
@@ -849,208 +849,208 @@ INCLUDE "data/bike_riding_tilesets.asm"
; load the tile pattern data of the current tileset into VRAM
LoadTilesetTilePatternData:: ; 0828 (0:0828)
- ld a,[wTilesetGFXPtr]
- ld l,a
- ld a,[wTilesetGFXPtr + 1]
- ld h,a
- ld de,vTileset
- ld bc,$600
- ld a,[wTilesetBank]
+ ld a, [wTilesetGFXPtr]
+ ld l, a
+ ld a, [wTilesetGFXPtr + 1]
+ ld h, a
+ ld de, vTileset
+ ld bc, $600
+ ld a, [wTilesetBank]
jp FarCopyData
; this loads the current maps complete tile map (which references blocks, not individual tiles) to C6E8
; it can also load partial tile maps of connected maps into a border of length 3 around the current map
LoadTileBlockMap:: ; 083c (0:083c)
; fill C6E8-CBFB with the background tile
- ld hl,wOverworldMap
- ld bc,$0514
- ld a,[wMapBackgroundTile] ; background tile number
+ ld hl, wOverworldMap
+ ld bc, $0514
+ ld a, [wMapBackgroundTile] ; background tile number
call FillMemory
; load tile map of current map (made of tile block IDs)
; a 3-byte border at the edges of the map is kept so that there is space for map connections
- ld hl,wOverworldMap
- ld a,[wCurMapWidth]
- ld [hMapWidth],a
- add a,MAP_BORDER * 2 ; east and west
- ld [hMapStride],a ; map width + border
- ld b,0
- ld c,a
+ ld hl, wOverworldMap
+ ld a, [wCurMapWidth]
+ ld [hMapWidth], a
+ add MAP_BORDER * 2 ; east and west
+ ld [hMapStride], a ; map width + border
+ ld b, 0
+ ld c, a
; make space for north border (next 3 lines)
- add hl,bc
- add hl,bc
- add hl,bc
- ld c,MAP_BORDER
- add hl,bc ; this puts us past the (west) border
- ld a,[W_MAPDATAPTR] ; tile map pointer
- ld e,a
- ld a,[W_MAPDATAPTR + 1]
- ld d,a ; de = tile map pointer
- ld a,[wCurMapHeight]
- ld b,a
+ add hl, bc
+ add hl, bc
+ add hl, bc
+ ld c, MAP_BORDER
+ add hl, bc ; this puts us past the (west) border
+ ld a, [W_MAPDATAPTR] ; tile map pointer
+ ld e, a
+ ld a, [W_MAPDATAPTR + 1]
+ ld d, a ; de = tile map pointer
+ ld a, [wCurMapHeight]
+ ld b, a
.rowLoop ; copy one row each iteration
push hl
- ld a,[hMapWidth] ; map width (without border)
- ld c,a
+ ld a, [hMapWidth] ; map width (without border)
+ ld c, a
.rowInnerLoop
- ld a,[de]
+ ld a, [de]
inc de
- ld [hli],a
+ ld [hli], a
dec c
- jr nz,.rowInnerLoop
+ jr nz, .rowInnerLoop
; add the map width plus the border to the base address of the current row to get the next row's address
pop hl
- ld a,[hMapStride] ; map width + border
+ ld a, [hMapStride] ; map width + border
add l
- ld l,a
- jr nc,.noCarry
+ ld l, a
+ jr nc, .noCarry
inc h
.noCarry
dec b
- jr nz,.rowLoop
+ jr nz, .rowLoop
.northConnection
- ld a,[W_MAPCONN1PTR]
- cp a,$ff
- jr z,.southConnection
+ ld a, [W_MAPCONN1PTR]
+ cp $ff
+ jr z, .southConnection
call SwitchToMapRomBank
- ld a,[wNorthConnectionStripSrc]
- ld l,a
- ld a,[wNorthConnectionStripSrc + 1]
- ld h,a
- ld a,[wNorthConnectionStripDest]
- ld e,a
- ld a,[wNorthConnectionStripDest + 1]
- ld d,a
- ld a,[wNorthConnectionStripWidth]
- ld [hNorthSouthConnectionStripWidth],a
- ld a,[wNorthConnectedMapWidth]
- ld [hNorthSouthConnectedMapWidth],a
+ ld a, [wNorthConnectionStripSrc]
+ ld l, a
+ ld a, [wNorthConnectionStripSrc + 1]
+ ld h, a
+ ld a, [wNorthConnectionStripDest]
+ ld e, a
+ ld a, [wNorthConnectionStripDest + 1]
+ ld d, a
+ ld a, [wNorthConnectionStripWidth]
+ ld [hNorthSouthConnectionStripWidth], a
+ ld a, [wNorthConnectedMapWidth]
+ ld [hNorthSouthConnectedMapWidth], a
call LoadNorthSouthConnectionsTileMap
.southConnection
- ld a,[W_MAPCONN2PTR]
- cp a,$ff
- jr z,.westConnection
+ ld a, [W_MAPCONN2PTR]
+ cp $ff
+ jr z, .westConnection
call SwitchToMapRomBank
- ld a,[wSouthConnectionStripSrc]
- ld l,a
- ld a,[wSouthConnectionStripSrc + 1]
- ld h,a
- ld a,[wSouthConnectionStripDest]
- ld e,a
- ld a,[wSouthConnectionStripDest + 1]
- ld d,a
- ld a,[wSouthConnectionStripWidth]
- ld [hNorthSouthConnectionStripWidth],a
- ld a,[wSouthConnectedMapWidth]
- ld [hNorthSouthConnectedMapWidth],a
+ ld a, [wSouthConnectionStripSrc]
+ ld l, a
+ ld a, [wSouthConnectionStripSrc + 1]
+ ld h, a
+ ld a, [wSouthConnectionStripDest]
+ ld e, a
+ ld a, [wSouthConnectionStripDest + 1]
+ ld d, a
+ ld a, [wSouthConnectionStripWidth]
+ ld [hNorthSouthConnectionStripWidth], a
+ ld a, [wSouthConnectedMapWidth]
+ ld [hNorthSouthConnectedMapWidth], a
call LoadNorthSouthConnectionsTileMap
.westConnection
- ld a,[W_MAPCONN3PTR]
- cp a,$ff
- jr z,.eastConnection
+ ld a, [W_MAPCONN3PTR]
+ cp $ff
+ jr z, .eastConnection
call SwitchToMapRomBank
- ld a,[wWestConnectionStripSrc]
- ld l,a
- ld a,[wWestConnectionStripSrc + 1]
- ld h,a
- ld a,[wWestConnectionStripDest]
- ld e,a
- ld a,[wWestConnectionStripDest + 1]
- ld d,a
- ld a,[wWestConnectionStripHeight]
- ld b,a
- ld a,[wWestConnectedMapWidth]
- ld [hEastWestConnectedMapWidth],a
+ ld a, [wWestConnectionStripSrc]
+ ld l, a
+ ld a, [wWestConnectionStripSrc + 1]
+ ld h, a
+ ld a, [wWestConnectionStripDest]
+ ld e, a
+ ld a, [wWestConnectionStripDest + 1]
+ ld d, a
+ ld a, [wWestConnectionStripHeight]
+ ld b, a
+ ld a, [wWestConnectedMapWidth]
+ ld [hEastWestConnectedMapWidth], a
call LoadEastWestConnectionsTileMap
.eastConnection
- ld a,[W_MAPCONN4PTR]
- cp a,$ff
- jr z,.done
+ ld a, [W_MAPCONN4PTR]
+ cp $ff
+ jr z, .done
call SwitchToMapRomBank
- ld a,[wEastConnectionStripSrc]
- ld l,a
- ld a,[wEastConnectionStripSrc + 1]
- ld h,a
- ld a,[wEastConnectionStripDest]
- ld e,a
- ld a,[wEastConnectionStripDest + 1]
- ld d,a
- ld a,[wEastConnectionStripHeight]
- ld b,a
- ld a,[wEastConnectedMapWidth]
- ld [hEastWestConnectedMapWidth],a
+ ld a, [wEastConnectionStripSrc]
+ ld l, a
+ ld a, [wEastConnectionStripSrc + 1]
+ ld h, a
+ ld a, [wEastConnectionStripDest]
+ ld e, a
+ ld a, [wEastConnectionStripDest + 1]
+ ld d, a
+ ld a, [wEastConnectionStripHeight]
+ ld b, a
+ ld a, [wEastConnectedMapWidth]
+ ld [hEastWestConnectedMapWidth], a
call LoadEastWestConnectionsTileMap
.done
ret
LoadNorthSouthConnectionsTileMap:: ; 0919 (0:0919)
- ld c,MAP_BORDER
+ ld c, MAP_BORDER
.loop
push de
push hl
- ld a,[hNorthSouthConnectionStripWidth]
- ld b,a
+ ld a, [hNorthSouthConnectionStripWidth]
+ ld b, a
.innerLoop
- ld a,[hli]
- ld [de],a
+ ld a, [hli]
+ ld [de], a
inc de
dec b
- jr nz,.innerLoop
+ jr nz, .innerLoop
pop hl
pop de
- ld a,[hNorthSouthConnectedMapWidth]
+ ld a, [hNorthSouthConnectedMapWidth]
add l
- ld l,a
- jr nc,.noCarry1
+ ld l, a
+ jr nc, .noCarry1
inc h
.noCarry1
- ld a,[wCurMapWidth]
- add a,MAP_BORDER * 2
+ ld a, [wCurMapWidth]
+ add MAP_BORDER * 2
add e
- ld e,a
- jr nc,.noCarry2
+ ld e, a
+ jr nc, .noCarry2
inc d
.noCarry2
dec c
- jr nz,.loop
+ jr nz, .loop
ret
LoadEastWestConnectionsTileMap:: ; 093d (0:093d)
push hl
push de
- ld c,MAP_BORDER
+ ld c, MAP_BORDER
.innerLoop
- ld a,[hli]
- ld [de],a
+ ld a, [hli]
+ ld [de], a
inc de
dec c
- jr nz,.innerLoop
+ jr nz, .innerLoop
pop de
pop hl
- ld a,[hEastWestConnectedMapWidth]
+ ld a, [hEastWestConnectedMapWidth]
add l
- ld l,a
- jr nc,.noCarry1
+ ld l, a
+ jr nc, .noCarry1
inc h
.noCarry1
- ld a,[wCurMapWidth]
- add a,MAP_BORDER * 2
+ ld a, [wCurMapWidth]
+ add MAP_BORDER * 2
add e
- ld e,a
- jr nc,.noCarry2
+ ld e, a
+ jr nc, .noCarry2
inc d
.noCarry2
dec b
- jr nz,LoadEastWestConnectionsTileMap
+ jr nz, LoadEastWestConnectionsTileMap
ret
; function to check if there is a sign or sprite in front of the player
; if so, carry is set. otherwise, carry is cleared
IsSpriteOrSignInFrontOfPlayer:: ; 095e (0:095e)
xor a
- ld [hSpriteIndexOrTextID],a
- ld a,[wNumSigns]
+ ld [hSpriteIndexOrTextID], a
+ ld a, [wNumSigns]
and a
- jr z,.extendRangeOverCounter
+ jr z, .extendRangeOverCounter
; if there are signs
predef GetTileAndCoordsInFrontOfPlayer ; get the coordinates in front of the player in de
call SignLoop
@@ -1058,191 +1058,191 @@ IsSpriteOrSignInFrontOfPlayer:: ; 095e (0:095e)
.extendRangeOverCounter
; check if the player is front of a counter in a pokemon center, pokemart, etc. and if so, extend the range at which he can talk to the NPC
predef GetTileAndCoordsInFrontOfPlayer ; get the tile in front of the player in c
- ld hl,W_TILESETTALKINGOVERTILES ; list of tiles that extend talking range (counter tiles)
- ld b,3
- ld d,$20 ; talking range in pixels (long range)
+ ld hl, W_TILESETTALKINGOVERTILES ; list of tiles that extend talking range (counter tiles)
+ ld b, 3
+ ld d, $20 ; talking range in pixels (long range)
.counterTilesLoop
- ld a,[hli]
+ ld a, [hli]
cp c
- jr z,IsSpriteInFrontOfPlayer2 ; jumps if the tile in front of the player is a counter tile
+ jr z, IsSpriteInFrontOfPlayer2 ; jumps if the tile in front of the player is a counter tile
dec b
- jr nz,.counterTilesLoop
+ jr nz, .counterTilesLoop
; sets carry flag if a sprite is in front of the player, resets if not
IsSpriteInFrontOfPlayer:: ; 0983 (0:0983)
- ld d,$10 ; talking range in pixels (normal range)
+ ld d, $10 ; talking range in pixels (normal range)
IsSpriteInFrontOfPlayer2:: ; 0985 (0:0985)
- lb bc,$3c, $40 ; Y and X position of player sprite
- ld a,[wSpriteStateData1 + 9] ; direction the player is facing
+ lb bc, $3c, $40 ; Y and X position of player sprite
+ ld a, [wSpriteStateData1 + 9] ; direction the player is facing
.checkIfPlayerFacingUp
cp SPRITE_FACING_UP
- jr nz,.checkIfPlayerFacingDown
+ jr nz, .checkIfPlayerFacingDown
; facing up
- ld a,b
+ ld a, b
sub d
- ld b,a
- ld a,PLAYER_DIR_UP
+ ld b, a
+ ld a, PLAYER_DIR_UP
jr .doneCheckingDirection
.checkIfPlayerFacingDown
cp SPRITE_FACING_DOWN
- jr nz,.checkIfPlayerFacingRight
+ jr nz, .checkIfPlayerFacingRight
; facing down
- ld a,b
+ ld a, b
add d
- ld b,a
- ld a,PLAYER_DIR_DOWN
+ ld b, a
+ ld a, PLAYER_DIR_DOWN
jr .doneCheckingDirection
.checkIfPlayerFacingRight
cp SPRITE_FACING_RIGHT
- jr nz,.playerFacingLeft
+ jr nz, .playerFacingLeft
; facing right
- ld a,c
+ ld a, c
add d
- ld c,a
- ld a,PLAYER_DIR_RIGHT
+ ld c, a
+ ld a, PLAYER_DIR_RIGHT
jr .doneCheckingDirection
.playerFacingLeft
; facing left
- ld a,c
+ ld a, c
sub d
- ld c,a
- ld a,PLAYER_DIR_LEFT
+ ld c, a
+ ld a, PLAYER_DIR_LEFT
.doneCheckingDirection
- ld [wPlayerDirection],a
- ld hl,wSpriteStateData1 + $10
+ ld [wPlayerDirection], a
+ ld hl, wSpriteStateData1 + $10
; yellow does not have the "if sprites are existant" check
- ld e,$01
- ld d,$f
+ ld e, $01
+ ld d, $f
.spriteLoop
push hl
- ld a,[hli] ; image (0 if no sprite)
+ ld a, [hli] ; image (0 if no sprite)
and a
- jr z,.nextSprite
+ jr z, .nextSprite
inc l
- ld a,[hli] ; sprite visibility
+ ld a, [hli] ; sprite visibility
inc a
- jr z,.nextSprite
+ jr z, .nextSprite
inc l
- ld a,[hli] ; Y location
+ ld a, [hli] ; Y location
cp b
- jr nz,.nextSprite
+ jr nz, .nextSprite
inc l
- ld a,[hl] ; X location
+ ld a, [hl] ; X location
cp c
- jr z,.foundSpriteInFrontOfPlayer
+ jr z, .foundSpriteInFrontOfPlayer
.nextSprite
pop hl
- ld a,l
- add a,$10
- ld l,a
+ ld a, l
+ add $10
+ ld l, a
inc e
dec d
- jr nz,.spriteLoop
+ jr nz, .spriteLoop
xor a
ret
.foundSpriteInFrontOfPlayer
pop hl
- ld a,l
- and a,$f0
+ ld a, l
+ and $f0
inc a
- ld l,a
- set 7,[hl]
- ld a,e
- ld [hSpriteIndexOrTextID],a
- ld a,[hSpriteIndexOrTextID] ; possible useless read because a already has the value of the read address
- cp a,$f
- jr nz,.dontwritetowd436
- ld a,$FF
- ld [wd436],a
+ ld l, a
+ set 7, [hl]
+ ld a, e
+ ld [hSpriteIndexOrTextID], a
+ ld a, [hSpriteIndexOrTextID] ; possible useless read because a already has the value of the read address
+ cp $f
+ jr nz, .dontwritetowd436
+ ld a, $FF
+ ld [wd436], a
.dontwritetowd436
scf
ret
SignLoop:: ; 09f2 (0:09f2)
; search if a player is facing a sign
- ld hl,wSignCoords ; start of sign coordinates
- ld a,[wNumSigns] ; number of signs in the map
- ld b,a
- ld c,$00
+ ld hl, wSignCoords ; start of sign coordinates
+ ld a, [wNumSigns] ; number of signs in the map
+ ld b, a
+ ld c, $00
.signLoop
inc c
- ld a,[hli] ; sign Y
+ ld a, [hli] ; sign Y
cp d
- jr z,.yCoordMatched
+ jr z, .yCoordMatched
inc hl
jr .retry
.yCoordMatched
- ld a,[hli] ; sign X
+ ld a, [hli] ; sign X
cp e
- jr nz,.retry
+ jr nz, .retry
.xCoordMatched
; found sign
push hl
push bc
- ld hl,wSignTextIDs ; start of sign text ID's
- ld b,$00
+ ld hl, wSignTextIDs ; start of sign text ID's
+ ld b, $00
dec c
- add hl,bc
- ld a,[hl]
- ld [hSpriteIndexOrTextID],a ; store sign text ID
+ add hl, bc
+ ld a, [hl]
+ ld [hSpriteIndexOrTextID], a ; store sign text ID
pop bc
pop hl
scf
ret
.retry
dec b
- jr nz,.signLoop
+ jr nz, .signLoop
xor a
ret
; function to check if the player will jump down a ledge and check if the tile ahead is passable (when not surfing)
; sets the carry flag if there is a collision, and unsets it if there isn't a collision
CollisionCheckOnLand:: ; 0a1c (0:0a1c)
- ld a,[wd736]
- bit 6,a ; is the player jumping?
- jr nz,.noCollision
+ ld a, [wd736]
+ bit 6, a ; is the player jumping?
+ jr nz, .noCollision
; if not jumping a ledge
- ld a,[wSimulatedJoypadStatesIndex]
+ ld a, [wSimulatedJoypadStatesIndex]
and a
- jr nz,.noCollision ; no collisions when the player's movements are being controlled by the game
- ld a,[wPlayerDirection] ; the direction that the player is trying to go in
- ld d,a
- ld a,[wSpriteStateData1 + 12] ; the player sprite's collision data (bit field) (set in the sprite movement code)
+ jr nz, .noCollision ; no collisions when the player's movements are being controlled by the game
+ ld a, [wPlayerDirection] ; the direction that the player is trying to go in
+ ld d, a
+ ld a, [wSpriteStateData1 + 12] ; the player sprite's collision data (bit field) (set in the sprite movement code)
and d ; check if a sprite is in the direction the player is trying to go
nop ; ??? why is this in the code
- jr nz,.collision
+ jr nz, .collision
xor a
- ld [hSpriteIndexOrTextID],a
+ ld [hSpriteIndexOrTextID], a
call IsSpriteInFrontOfPlayer ; check for sprite collisions again? when does the above check fail to detect a sprite collision?
- jr nc,.asm_0a5c
- res 7,[hl]
- ld a,[hSpriteIndexOrTextID]
+ jr nc, .asm_0a5c
+ res 7, [hl]
+ ld a, [hSpriteIndexOrTextID]
and a ; was there a sprite collision?
- jr z,.asm_0a5c
+ jr z, .asm_0a5c
; if no sprite collision
cp $f
- jr nz,.collision
+ jr nz, .collision
call CheckPikachuFollowingPlayer
- jr nz,.collision
- ld a,[hJoyHeld]
+ jr nz, .collision
+ ld a, [hJoyHeld]
and $2
- jr nz,.asm_0a5c
- ld hl,wd435
- ld a,[hl]
+ jr nz, .asm_0a5c
+ ld hl, wd435
+ ld a, [hl]
and a
- jr z,.asm_0a5c
+ jr z, .asm_0a5c
dec [hl]
- jr nz,.collision
+ jr nz, .collision
.asm_0a5c
- ld hl,TilePairCollisionsLand
+ ld hl, TilePairCollisionsLand
call CheckForJumpingAndTilePairCollisions
- jr c,.collision
+ jr c, .collision
call CheckTilePassable
- jr nc,.noCollision
+ jr nc, .noCollision
.collision
- ld a,[wChannelSoundIDs + CH4]
+ ld a, [wChannelSoundIDs + CH4]
cp $b4 ; SFX_COLLISION ; check if collision sound is already playing
- jr z,.setCarry
+ jr z, .setCarry
ld a, $b4 ; SFX_COLLISION
call PlaySound ; play collision sound (if it's not already playing)
.setCarry
@@ -1256,8 +1256,8 @@ CollisionCheckOnLand:: ; 0a1c (0:0a1c)
; clears carry if it is, sets carry if not
CheckTilePassable:: ; 0a79 (0:0a79)
predef GetTileAndCoordsInFrontOfPlayer ; get tile in front of player
- ld a,[wTileInFrontOfPlayer] ; tile in front of player
- ld c,a
+ ld a, [wTileInFrontOfPlayer] ; tile in front of player
+ ld c, a
call IsTilePassable
ret
@@ -1276,53 +1276,53 @@ CheckForJumpingAndTilePairCollisions:: ; 0a86 (0:0a86)
pop de
pop hl
and a
- ld a,[wd736]
- bit 6,a ; is the player jumping?
+ ld a, [wd736]
+ bit 6, a ; is the player jumping?
ret nz
; if not jumping
CheckForTilePairCollisions2:: ; 0aa0 (0:0aa0)
aCoord 8, 9 ; tile the player is on
- ld [wTilePlayerStandingOn],a
+ ld [wTilePlayerStandingOn], a
CheckForTilePairCollisions:: ; 0aa6 (0:0aa6)
- ld a,[wTileInFrontOfPlayer]
- ld c,a
+ ld a, [wTileInFrontOfPlayer]
+ ld c, a
.tilePairCollisionLoop
- ld a,[wCurMapTileset] ; tileset number
- ld b,a
- ld a,[hli]
- cp a,$ff
- jr z,.noMatch
+ ld a, [wCurMapTileset] ; tileset number
+ ld b, a
+ ld a, [hli]
+ cp $ff
+ jr z, .noMatch
cp b
- jr z,.tilesetMatches
+ jr z, .tilesetMatches
inc hl
.retry
inc hl
jr .tilePairCollisionLoop
.tilesetMatches
- ld a,[wTilePlayerStandingOn] ; tile the player is on
- ld b,a
- ld a,[hl]
+ ld a, [wTilePlayerStandingOn] ; tile the player is on
+ ld b, a
+ ld a, [hl]
cp b
- jr z,.currentTileMatchesFirstInPair
+ jr z, .currentTileMatchesFirstInPair
inc hl
- ld a,[hl]
+ ld a, [hl]
cp b
- jr z,.currentTileMatchesSecondInPair
+ jr z, .currentTileMatchesSecondInPair
jr .retry
.currentTileMatchesFirstInPair
inc hl
- ld a,[hl]
+ ld a, [hl]
cp c
- jr z,.foundMatch
+ jr z, .foundMatch
jr .tilePairCollisionLoop
.currentTileMatchesSecondInPair
dec hl
- ld a,[hli]
+ ld a, [hli]
cp c
inc hl
- jr nz,.tilePairCollisionLoop
+ jr nz, .tilePairCollisionLoop
.foundMatch
scf
ret
@@ -1357,26 +1357,26 @@ TilePairCollisionsWater:: ; 0afc (0:0afc)
; this builds a tile map from the tile block map based on the current X/Y coordinates of the player's character
LoadCurrentMapView:: ; 0b06 (0:0b06)
- ld a,[H_LOADEDROMBANK]
+ ld a, [H_LOADEDROMBANK]
push af
- ld a,[wTilesetBank] ; tile data ROM bank
+ ld a, [wTilesetBank] ; tile data ROM bank
call BankswitchCommon ; switch to ROM bank that contains tile data
- ld a,[wCurrentTileBlockMapViewPointer] ; address of upper left corner of current map view
- ld e,a
- ld a,[wCurrentTileBlockMapViewPointer + 1]
- ld d,a
- ld hl,wTileMapBackup
- ld b,$05
+ ld a, [wCurrentTileBlockMapViewPointer] ; address of upper left corner of current map view
+ ld e, a
+ ld a, [wCurrentTileBlockMapViewPointer + 1]
+ ld d, a
+ ld hl, wTileMapBackup
+ ld b, $05
.rowLoop ; each loop iteration fills in one row of tile blocks
push hl
push de
- ld c,$06
+ ld c, $06
.rowInnerLoop ; loop to draw each tile block of the current row
push bc
push de
push hl
- ld a,[de]
- ld c,a ; tile block number
+ ld a, [de]
+ ld c, a ; tile block number
call DrawTileBlock
pop hl
pop de
@@ -1387,73 +1387,73 @@ LoadCurrentMapView:: ; 0b06 (0:0b06)
inc hl
inc de
dec c
- jr nz,.rowInnerLoop
+ jr nz, .rowInnerLoop
; update tile block map pointer to next row's address
pop de
- ld a,[wCurMapWidth]
- add a,MAP_BORDER * 2
+ ld a, [wCurMapWidth]
+ add MAP_BORDER * 2
add e
- ld e,a
- jr nc,.noCarry
+ ld e, a
+ jr nc, .noCarry
inc d
.noCarry
; update tile map pointer to next row's address
pop hl
- ld a,$60
+ ld a, $60
add l
- ld l,a
- jr nc,.noCarry2
+ ld l, a
+ jr nc, .noCarry2
inc h
.noCarry2
dec b
- jr nz,.rowLoop
- ld hl,wTileMapBackup
- ld bc,$0000
+ jr nz, .rowLoop
+ ld hl, wTileMapBackup
+ ld bc, $0000
.adjustForYCoordWithinTileBlock
- ld a,[wYBlockCoord]
+ ld a, [wYBlockCoord]
and a
- jr z,.adjustForXCoordWithinTileBlock
- ld bc,$0030
- add hl,bc
+ jr z, .adjustForXCoordWithinTileBlock
+ ld bc, $0030
+ add hl, bc
.adjustForXCoordWithinTileBlock
- ld a,[wXBlockCoord]
+ ld a, [wXBlockCoord]
and a
- jr z,.copyToVisibleAreaBuffer
- ld bc,$0002
- add hl,bc
+ jr z, .copyToVisibleAreaBuffer
+ ld bc, $0002
+ add hl, bc
.copyToVisibleAreaBuffer
coord de, 0, 0 ; base address for the tiles that are directly transferred to VRAM during V-blank
ld b, SCREEN_HEIGHT
.rowLoop2
ld c, SCREEN_WIDTH
.rowInnerLoop2
- ld a,[hli]
- ld [de],a
+ ld a, [hli]
+ ld [de], a
inc de
dec c
- jr nz,.rowInnerLoop2
- ld a,$04
+ jr nz, .rowInnerLoop2
+ ld a, $04
add l
- ld l,a
- jr nc,.noCarry3
+ ld l, a
+ jr nc, .noCarry3
inc h
.noCarry3
dec b
- jr nz,.rowLoop2
+ jr nz, .rowLoop2
pop af
call BankswitchCommon ; restore previous ROM bank
ret
AdvancePlayerSprite:: ; 0b7f (0:0b7f)
- ld a,[wUpdateSpritesEnabled]
+ ld a, [wUpdateSpritesEnabled]
push af
- ld a,$FF
- ld [wUpdateSpritesEnabled],a
+ ld a, $FF
+ ld [wUpdateSpritesEnabled], a
ld hl, _AdvancePlayerSprite ; 3c:410c
ld b, BANK(_AdvancePlayerSprite)
call Bankswitch
pop af
- ld [wUpdateSpritesEnabled],a
+ ld [wUpdateSpritesEnabled], a
ret
; the following 6 functions are used to tell the V-blank handler to redraw
@@ -1462,140 +1462,140 @@ AdvancePlayerSprite:: ; 0b7f (0:0b7f)
ScheduleNorthRowRedraw:: ; 0b95 (0:0b95)
coord hl, 0, 0
call CopyToRedrawRowOrColumnSrcTiles
- ld a,[wMapViewVRAMPointer]
- ld [hRedrawRowOrColumnDest],a
- ld a,[wMapViewVRAMPointer + 1]
- ld [hRedrawRowOrColumnDest + 1],a
- ld a,REDRAW_ROW
- ld [hRedrawRowOrColumnMode],a
+ ld a, [wMapViewVRAMPointer]
+ ld [hRedrawRowOrColumnDest], a
+ ld a, [wMapViewVRAMPointer + 1]
+ ld [hRedrawRowOrColumnDest + 1], a
+ ld a, REDRAW_ROW
+ ld [hRedrawRowOrColumnMode], a
ret
CopyToRedrawRowOrColumnSrcTiles:: ; 0baa (0:0baa)
- ld de,wRedrawRowOrColumnSrcTiles
- ld c,2 * SCREEN_WIDTH
+ ld de, wRedrawRowOrColumnSrcTiles
+ ld c, 2 * SCREEN_WIDTH
.loop
- ld a,[hli]
- ld [de],a
+ ld a, [hli]
+ ld [de], a
inc de
dec c
- jr nz,.loop
+ jr nz, .loop
ret
ScheduleSouthRowRedraw:: ; 0bb6 (0:0bb6)
coord hl, 0, 16
call CopyToRedrawRowOrColumnSrcTiles
- ld a,[wMapViewVRAMPointer]
- ld l,a
- ld a,[wMapViewVRAMPointer + 1]
- ld h,a
- ld bc,$0200
- add hl,bc
- ld a,h
- and a,$03
- or a,$98
- ld [hRedrawRowOrColumnDest + 1],a
- ld a,l
- ld [hRedrawRowOrColumnDest],a
- ld a,REDRAW_ROW
- ld [hRedrawRowOrColumnMode],a
+ ld a, [wMapViewVRAMPointer]
+ ld l, a
+ ld a, [wMapViewVRAMPointer + 1]
+ ld h, a
+ ld bc, $0200
+ add hl, bc
+ ld a, h
+ and $03
+ or $98
+ ld [hRedrawRowOrColumnDest + 1], a
+ ld a, l
+ ld [hRedrawRowOrColumnDest], a
+ ld a, REDRAW_ROW
+ ld [hRedrawRowOrColumnMode], a
ret
ScheduleEastColumnRedraw:: ; 0bd6 (0:0bd7)
coord hl, 18, 0
call ScheduleColumnRedrawHelper
- ld a,[wMapViewVRAMPointer]
- ld c,a
- and a,$e0
- ld b,a
- ld a,c
- add a,18
- and a,$1f
+ ld a, [wMapViewVRAMPointer]
+ ld c, a
+ and $e0
+ ld b, a
+ ld a, c
+ add 18
+ and $1f
or b
- ld [hRedrawRowOrColumnDest],a
- ld a,[wMapViewVRAMPointer + 1]
- ld [hRedrawRowOrColumnDest + 1],a
- ld a,REDRAW_COL
- ld [hRedrawRowOrColumnMode],a
+ ld [hRedrawRowOrColumnDest], a
+ ld a, [wMapViewVRAMPointer + 1]
+ ld [hRedrawRowOrColumnDest + 1], a
+ ld a, REDRAW_COL
+ ld [hRedrawRowOrColumnMode], a
ret
ScheduleColumnRedrawHelper:: ; 0bf6 (0:0bf6)
- ld de,wRedrawRowOrColumnSrcTiles
- ld c,SCREEN_HEIGHT
+ ld de, wRedrawRowOrColumnSrcTiles
+ ld c, SCREEN_HEIGHT
.loop
- ld a,[hli]
- ld [de],a
+ ld a, [hli]
+ ld [de], a
inc de
- ld a,[hl]
- ld [de],a
+ ld a, [hl]
+ ld [de], a
inc de
- ld a,19
+ ld a, 19
add l
- ld l,a
- jr nc,.noCarry
+ ld l, a
+ jr nc, .noCarry
inc h
.noCarry
dec c
- jr nz,.loop
+ jr nz, .loop
ret
ScheduleWestColumnRedraw:: ; 0c0c (0:0c0c)
coord hl, 0, 0
call ScheduleColumnRedrawHelper
- ld a,[wMapViewVRAMPointer]
- ld [hRedrawRowOrColumnDest],a
- ld a,[wMapViewVRAMPointer + 1]
- ld [hRedrawRowOrColumnDest + 1],a
- ld a,REDRAW_COL
- ld [hRedrawRowOrColumnMode],a
+ ld a, [wMapViewVRAMPointer]
+ ld [hRedrawRowOrColumnDest], a
+ ld a, [wMapViewVRAMPointer + 1]
+ ld [hRedrawRowOrColumnDest + 1], a
+ ld a, REDRAW_COL
+ ld [hRedrawRowOrColumnMode], a
ret
; function to write the tiles that make up a tile block to memory
; Input: c = tile block ID, hl = destination address
DrawTileBlock:: ; 0c21 (0:0c21)
push hl
- ld a,[W_TILESETBLOCKSPTR] ; pointer to tiles
- ld l,a
- ld a,[W_TILESETBLOCKSPTR + 1]
- ld h,a
- ld a,c
+ ld a, [W_TILESETBLOCKSPTR] ; pointer to tiles
+ ld l, a
+ ld a, [W_TILESETBLOCKSPTR + 1]
+ ld h, a
+ ld a, c
swap a
- ld b,a
- and a,$f0
- ld c,a
- ld a,b
- and a,$0f
- ld b,a ; bc = tile block ID * 0x10
- add hl,bc
- ld d,h
- ld e,l ; de = address of the tile block's tiles
+ ld b, a
+ and $f0
+ ld c, a
+ ld a, b
+ and $0f
+ ld b, a ; bc = tile block ID * 0x10
+ add hl, bc
+ ld d, h
+ ld e, l ; de = address of the tile block's tiles
pop hl
- ld c,$04 ; 4 loop iterations
+ ld c, $04 ; 4 loop iterations
.loop ; each loop iteration, write 4 tile numbers
push bc
- ld a,[de]
- ld [hli],a
+ ld a, [de]
+ ld [hli], a
inc de
- ld a,[de]
- ld [hli],a
+ ld a, [de]
+ ld [hli], a
inc de
- ld a,[de]
- ld [hli],a
+ ld a, [de]
+ ld [hli], a
inc de
- ld a,[de]
- ld [hl],a
+ ld a, [de]
+ ld [hl], a
inc de
- ld bc,$0015
- add hl,bc
+ ld bc, $0015
+ add hl, bc
pop bc
dec c
- jr nz,.loop
+ jr nz, .loop
ret
; function to update joypad state and simulate button presses
JoypadOverworld:: ; 0c51 (0:0c51)
xor a
- ld [wSpriteStateData1 + 3],a
- ld [wSpriteStateData1 + 5],a
+ ld [wSpriteStateData1 + 3], a
+ ld [wSpriteStateData1 + 5], a
call RunMapScript
call Joypad
call ForceBikeDown
@@ -1603,66 +1603,66 @@ JoypadOverworld:: ; 0c51 (0:0c51)
ret
ForceBikeDown:: ; 0c65 (0:0c65)
- ld a,[wFlags_D733]
- bit 3,a ; check if a trainer wants a challenge
+ ld a, [wFlags_D733]
+ bit 3, a ; check if a trainer wants a challenge
ret nz
- ld a,[wCurMap]
- cp a,ROUTE_17 ; Cycling Road
+ ld a, [wCurMap]
+ cp ROUTE_17 ; Cycling Road
ret nz
- ld a,[hJoyHeld]
- and a,D_DOWN | D_UP | D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON
+ ld a, [hJoyHeld]
+ and D_DOWN | D_UP | D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON
ret nz
- ld a,D_DOWN
- ld [hJoyHeld],a ; on the cycling road, if there isn't a trainer and the player isn't pressing buttons, simulate a down press
+ ld a, D_DOWN
+ ld [hJoyHeld], a ; on the cycling road, if there isn't a trainer and the player isn't pressing buttons, simulate a down press
ret
AreInputsSimulated:: ; 0c7b (0:0c7b)
- ld a,[wd730]
- bit 7,a
+ ld a, [wd730]
+ bit 7, a
ret z
; if simulating button presses
- ld a,[hJoyHeld]
- ld b,a
- ld a,[wOverrideSimulatedJoypadStatesMask] ; bit mask for button presses that override simulated ones
+ ld a, [hJoyHeld]
+ ld b, a
+ ld a, [wOverrideSimulatedJoypadStatesMask] ; bit mask for button presses that override simulated ones
and b
ret nz ; return if the simulated button presses are overridden
call GetSimulatedInput
- jr nc,.doneSimulating
- ld [hJoyHeld],a ; store simulated button press in joypad state
+ jr nc, .doneSimulating
+ ld [hJoyHeld], a ; store simulated button press in joypad state
and a
ret nz
- ld [hJoyPressed],a
- ld [hJoyReleased],a
+ ld [hJoyPressed], a
+ ld [hJoyReleased], a
ret
; if done simulating button presses
.doneSimulating
xor a
- ld [wWastedByteCD3A],a
- ld [wSimulatedJoypadStatesIndex],a
- ld [wSimulatedJoypadStatesEnd],a
- ld [wJoyIgnore],a
- ld [hJoyHeld],a
- ld hl,wd736
- ld a,[hl]
- and a,$f8
- ld [hl],a
- ld hl,wd730
- res 7,[hl]
+ ld [wWastedByteCD3A], a
+ ld [wSimulatedJoypadStatesIndex], a
+ ld [wSimulatedJoypadStatesEnd], a
+ ld [wJoyIgnore], a
+ ld [hJoyHeld], a
+ ld hl, wd736
+ ld a, [hl]
+ and $f8
+ ld [hl], a
+ ld hl, wd730
+ res 7, [hl]
ret
GetSimulatedInput:: ; 0cb3 (0:0cb3)
- ld hl,wSimulatedJoypadStatesIndex
+ ld hl, wSimulatedJoypadStatesIndex
dec [hl]
- ld a,[hl]
- cp a,$ff
- jr z,.endofsimulatedinputs ; if the end of the simulated button presses has been reached
+ ld a, [hl]
+ cp $ff
+ jr z, .endofsimulatedinputs ; if the end of the simulated button presses has been reached
push de
- ld e,a
- ld d,$0
- ld hl,wSimulatedJoypadStatesEnd
- add hl,de
- ld a,[hl]
+ ld e, a
+ ld d, $0
+ ld hl, wSimulatedJoypadStatesEnd
+ add hl, de
+ ld a, [hl]
pop de
scf
ret
@@ -1676,33 +1676,33 @@ GetSimulatedInput:: ; 0cb3 (0:0cb3)
; It seems that this function has a bug in it, but due to luck, it doesn't
; show up. After detecting a sprite collision, it jumps to the code that
; checks if the next tile is passable instead of just directly jumping to the
-; "collision detected" code. However, it doesn't store the next tile in c,
-; so the old value of c is used. 2429 is always called before this function,
+; "collision detected" code. However, it doesn't store the next tile in c,
+; so the old value of c is used. 2429 is always called before this function,
; and 2429 always sets c to 0xF0. There is no 0xF0 background tile, so it
; is considered impassable and it is detected as a collision.
CollisionCheckOnWater:: ; 0cca (0:0cca)
- ld a,[wd730]
- bit 7,a
- jp nz,.noCollision ; return and clear carry if button presses are being simulated
- ld a,[wPlayerDirection] ; the direction that the player is trying to go in
- ld d,a
- ld a,[wSpriteStateData1 + 12] ; the player sprite's collision data (bit field) (set in the sprite movement code)
+ ld a, [wd730]
+ bit 7, a
+ jp nz, .noCollision ; return and clear carry if button presses are being simulated
+ ld a, [wPlayerDirection] ; the direction that the player is trying to go in
+ ld d, a
+ ld a, [wSpriteStateData1 + 12] ; the player sprite's collision data (bit field) (set in the sprite movement code)
and d ; check if a sprite is in the direction the player is trying to go
- jr nz,.collision ; bug?
- ld hl,TilePairCollisionsWater
+ jr nz, .collision ; bug?
+ ld hl, TilePairCollisionsWater
call CheckForJumpingAndTilePairCollisions
- jr c,.collision
+ jr c, .collision
predef GetTileAndCoordsInFrontOfPlayer ; get tile in front of player (puts it in c and [wTileInFrontOfPlayer])
callab IsNextTileShoreOrWater ; 3:6808
- jr c,.noCollision
- ld a,[wTileInFrontOfPlayer] ; tile in front of player
- ld c,a
+ jr c, .noCollision
+ ld a, [wTileInFrontOfPlayer] ; tile in front of player
+ ld c, a
call IsTilePassable
- jr nc,.stopSurfing
+ jr nc, .stopSurfing
.collision
- ld a,[wChannelSoundIDs + CH4]
+ ld a, [wChannelSoundIDs + CH4]
cp $b4 ; SFX_COLLISION
- jr z,.setCarry
+ jr z, .setCarry
ld a, $b4 ; SFX_COLLISION
call PlaySound ; play collision sound (if it's not already playing)
.setCarry
@@ -1714,12 +1714,12 @@ CollisionCheckOnWater:: ; 0cca (0:0cca)
jr nz, .noCollision ; keep surfing if it's not the boarding platform tile
jr .stopSurfing ; if it is the boarding platform tile, stop surfing
.stopSurfing ; based game freak
- ld a,$3
- ld [wd431],a
- ld hl,wPikachuOverworldStateFlags
- set 5,[hl]
+ ld a, $3
+ ld [wd431], a
+ ld hl, wPikachuOverworldStateFlags
+ set 5, [hl]
xor a
- ld [wWalkBikeSurfState],a
+ ld [wWalkBikeSurfState], a
call LoadPlayerSpriteGraphics
call PlayDefaultMusic
jr .noCollision
@@ -1734,22 +1734,22 @@ RunMapScript:: ; 0d2c (0:0d2c)
push de
push bc
callba TryPushingBoulder
- ld a,[wFlags_0xcd60]
- bit 1,a ; play boulder dust animation
- jr z,.afterBoulderEffect
+ ld a, [wFlags_0xcd60]
+ bit 1, a ; play boulder dust animation
+ jr z, .afterBoulderEffect
callba DoBoulderDustAnimation
.afterBoulderEffect
pop bc
pop de
pop hl
call RunNPCMovementScript
- ld a,[wCurMap] ; current map number
+ ld a, [wCurMap] ; current map number
call SwitchToMapRomBank ; change to the ROM bank the map's data is in
- ld hl,W_MAPSCRIPTPTR
- ld a,[hli]
- ld h,[hl]
- ld l,a
- ld de,.return
+ ld hl, W_MAPSCRIPTPTR
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, .return
push de
jp [hl] ; jump to script
.return
@@ -1758,38 +1758,38 @@ RunMapScript:: ; 0d2c (0:0d2c)
LoadWalkingPlayerSpriteGraphics:: ; 0d5e (0:0d5e)
; new sprite copy stuff
xor a
- ld [wd473],a
- ld b,BANK(RedSprite)
- ld de,RedSprite ; $4180
+ ld [wd473], a
+ ld b, BANK(RedSprite)
+ ld de, RedSprite ; $4180
jr LoadPlayerSpriteGraphicsCommon
LoadSurfingPlayerSpriteGraphics2:: ; 0d69 (0:0d69)
- ld a,[wd473]
+ ld a, [wd473]
and a
- jr z,.asm_0d75
+ jr z, .asm_0d75
dec a
- jr z,LoadSurfingPlayerSpriteGraphics
+ jr z, LoadSurfingPlayerSpriteGraphics
dec a
- jr z,.asm_0d7c
+ jr z, .asm_0d7c
.asm_0d75
- ld a,[wd472]
- bit 6,a
- jr z,LoadSurfingPlayerSpriteGraphics
+ ld a, [wd472]
+ bit 6, a
+ jr z, LoadSurfingPlayerSpriteGraphics
.asm_0d7c
- ld b,BANK(SurfingPikachuSprite)
- ld de,SurfingPikachuSprite ; 3f:6def
+ ld b, BANK(SurfingPikachuSprite)
+ ld de, SurfingPikachuSprite ; 3f:6def
jr LoadPlayerSpriteGraphicsCommon
LoadSurfingPlayerSpriteGraphics:: ; 0d83 (0:0d83)
- ld b,BANK(RedSprite) ; not sure, but probably same bank (5)
- ld de,SeelSprite
+ ld b, BANK(RedSprite) ; not sure, but probably same bank (5)
+ ld de, SeelSprite
jr LoadPlayerSpriteGraphicsCommon
LoadBikePlayerSpriteGraphics:: ; 0d8a (0:0d8a)
- ld b,BANK(RedCyclingSprite)
- ld de,RedCyclingSprite
+ ld b, BANK(RedCyclingSprite)
+ ld de, RedCyclingSprite
LoadPlayerSpriteGraphicsCommon:: ; 0d8f (0:0d8f)
- ld hl,vNPCSprites
+ ld hl, vNPCSprites
push de
push hl
push bc
@@ -1798,14 +1798,14 @@ LoadPlayerSpriteGraphicsCommon:: ; 0d8f (0:0d8f)
pop bc
pop hl
pop de
- ld a,$c0
+ ld a, $c0
add e
- ld e,a
- jr nc,.noCarry
+ ld e, a
+ jr nc, .noCarry
inc d
.noCarry
- set 3,h
- ld c,$c
+ set 3, h
+ ld c, $c
jp CopyVideoData
; function to load data from the map header
@@ -1814,125 +1814,125 @@ LoadMapHeader:: ; 0dab (0:0dab)
jr .asm_0dbd
callba Func_f0a55 ; 3c:4a55
.asm_0dbd
- ld a,[wCurMapTileset]
- ld [wUnusedD119],a
- ld a,[wCurMap]
+ ld a, [wCurMapTileset]
+ ld [wUnusedD119], a
+ ld a, [wCurMap]
call SwitchToMapRomBank
- ld a,[wCurMapTileset]
- ld b,a
- res 7,a
- ld [wCurMapTileset],a
- ld [hPreviousTileset],a
- bit 7,b
+ ld a, [wCurMapTileset]
+ ld b, a
+ res 7, a
+ ld [wCurMapTileset], a
+ ld [hPreviousTileset], a
+ bit 7, b
ret nz
call GetMapHeaderPointer
; copy the first 10 bytes (the fixed area) of the map data to D367-D370
- ld de,wCurMapTileset
- ld c,$0a
+ ld de, wCurMapTileset
+ ld c, $0a
.copyFixedHeaderLoop
- ld a,[hli]
- ld [de],a
+ ld a, [hli]
+ ld [de], a
inc de
dec c
- jr nz,.copyFixedHeaderLoop
+ jr nz, .copyFixedHeaderLoop
; initialize all the connected maps to disabled at first, before loading the actual values
- ld a,$ff
- ld [W_MAPCONN1PTR],a
- ld [W_MAPCONN2PTR],a
- ld [W_MAPCONN3PTR],a
- ld [W_MAPCONN4PTR],a
+ ld a, $ff
+ ld [W_MAPCONN1PTR], a
+ ld [W_MAPCONN2PTR], a
+ ld [W_MAPCONN3PTR], a
+ ld [W_MAPCONN4PTR], a
; copy connection data (if any) to WRAM
- ld a,[W_MAPCONNECTIONS]
- ld b,a
+ ld a, [W_MAPCONNECTIONS]
+ ld b, a
.checkNorth
- bit 3,b
- jr z,.checkSouth
- ld de,W_MAPCONN1PTR
+ bit 3, b
+ jr z, .checkSouth
+ ld de, W_MAPCONN1PTR
call CopyMapConnectionHeader
.checkSouth
- bit 2,b
- jr z,.checkWest
- ld de,W_MAPCONN2PTR
+ bit 2, b
+ jr z, .checkWest
+ ld de, W_MAPCONN2PTR
call CopyMapConnectionHeader
.checkWest
- bit 1,b
- jr z,.checkEast
- ld de,W_MAPCONN3PTR
+ bit 1, b
+ jr z, .checkEast
+ ld de, W_MAPCONN3PTR
call CopyMapConnectionHeader
.checkEast
- bit 0,b
- jr z,.getObjectDataPointer
- ld de,W_MAPCONN4PTR
+ bit 0, b
+ jr z, .getObjectDataPointer
+ ld de, W_MAPCONN4PTR
call CopyMapConnectionHeader
.getObjectDataPointer
- ld a,[hli]
- ld [wObjectDataPointerTemp],a
- ld a,[hli]
- ld [wObjectDataPointerTemp + 1],a
+ ld a, [hli]
+ ld [wObjectDataPointerTemp], a
+ ld a, [hli]
+ ld [wObjectDataPointerTemp + 1], a
push hl
- ld a,[wObjectDataPointerTemp]
- ld l,a
- ld a,[wObjectDataPointerTemp + 1]
- ld h,a ; hl = base of object data
- ld de,wMapBackgroundTile
- ld a,[hli]
- ld [de],a
+ ld a, [wObjectDataPointerTemp]
+ ld l, a
+ ld a, [wObjectDataPointerTemp + 1]
+ ld h, a ; hl = base of object data
+ ld de, wMapBackgroundTile
+ ld a, [hli]
+ ld [de], a
.loadWarpData
- ld a,[hli]
- ld [wNumberOfWarps],a
+ ld a, [hli]
+ ld [wNumberOfWarps], a
and a
- jr z,.loadSignData
- ld c,a
- ld de,wWarpEntries
+ jr z, .loadSignData
+ ld c, a
+ ld de, wWarpEntries
.warpLoop ; one warp per loop iteration
- ld b,$04
+ ld b, $04
.warpInnerLoop
- ld a,[hli]
- ld [de],a
+ ld a, [hli]
+ ld [de], a
inc de
dec b
- jr nz,.warpInnerLoop
+ jr nz, .warpInnerLoop
dec c
- jr nz,.warpLoop
+ jr nz, .warpLoop
.loadSignData
- ld a,[hli] ; number of signs
- ld [wNumSigns],a
+ ld a, [hli] ; number of signs
+ ld [wNumSigns], a
and a ; are there any signs?
- jr z,.loadSpriteData ; if not, skip this
+ jr z, .loadSpriteData ; if not, skip this
call CopySignData ; 0eb3 (0:0eb3)
.loadSpriteData
- ld a,[wd72e]
- bit 5,a ; did a battle happen immediately before this?
- jr nz,.finishUp ; if so, skip this because battles don't destroy this data
+ ld a, [wd72e]
+ bit 5, a ; did a battle happen immediately before this?
+ jr nz, .finishUp ; if so, skip this because battles don't destroy this data
call InitSprites
.finishUp
predef LoadTilesetHeader
- ld a,[wd72e]
- bit 5,a ; did a battle happen immediately before this?
- jr nz,.asm_0e73
+ ld a, [wd72e]
+ bit 5, a ; did a battle happen immediately before this?
+ jr nz, .asm_0e73
callab Func_fc4fa ; 3f:44fa
.asm_0e73
callab LoadWildData ; 3:4b62
pop hl ; restore hl from before going to the warp/sign/sprite data (this value was saved for seemingly no purpose)
- ld a,[wCurMapHeight] ; map height in 4x4 tile blocks
+ ld a, [wCurMapHeight] ; map height in 4x4 tile blocks
add a ; double it
- ld [wCurrentMapHeight2],a ; store map height in 2x2 tile blocks
- ld a,[wCurMapWidth] ; map width in 4x4 tile blocks
+ ld [wCurrentMapHeight2], a ; store map height in 2x2 tile blocks
+ ld a, [wCurMapWidth] ; map width in 4x4 tile blocks
add a ; double it
- ld [wCurrentMapWidth2],a ; map width in 2x2 tile blocks
- ld a,[wCurMap]
- ld c,a
- ld b,$00
- ld a,[H_LOADEDROMBANK]
+ ld [wCurrentMapWidth2], a ; map width in 2x2 tile blocks
+ ld a, [wCurMap]
+ ld c, a
+ ld b, $00
+ ld a, [H_LOADEDROMBANK]
push af
switchbank MapSongBanks
ld hl, MapSongBanks ; 3f:4000
- add hl,bc
- add hl,bc
- ld a,[hli]
- ld [wMapMusicSoundID],a ; music 1
- ld a,[hl]
- ld [wMapMusicROMBank],a ; music 2
+ add hl, bc
+ add hl, bc
+ ld a, [hli]
+ ld [wMapMusicSoundID], a ; music 1
+ ld a, [hl]
+ ld [wMapMusicROMBank], a ; music 2
pop af
call BankswitchCommon
ret
@@ -1940,38 +1940,38 @@ LoadMapHeader:: ; 0dab (0:0dab)
; function to copy map connection data from ROM to WRAM
; Input: hl = source, de = destination
CopyMapConnectionHeader:: ; 0eaa (0:0eaa)
- ld c,$0b
+ ld c, $0b
.loop
- ld a,[hli]
- ld [de],a
+ ld a, [hli]
+ ld [de], a
inc de
dec c
- jr nz,.loop
+ jr nz, .loop
ret
CopySignData:: ; 0eb3 (0:0eb3)
- ld de,wSignCoords ; start of sign coords
- ld bc,wSignTextIDs ; start of sign text ids
- ld a,[wNumSigns] ; number of signs
+ ld de, wSignCoords ; start of sign coords
+ ld bc, wSignTextIDs ; start of sign text ids
+ ld a, [wNumSigns] ; number of signs
.signcopyloop
push af
- ld a,[hli]
- ld [de],a ; copy y coord
+ ld a, [hli]
+ ld [de], a ; copy y coord
inc de
- ld a,[hli]
- ld [de],a ; copy x coord
+ ld a, [hli]
+ ld [de], a ; copy x coord
inc de
- ld a,[hli]
- ld [bc],a ; copy sign text id
+ ld a, [hli]
+ ld [bc], a ; copy sign text id
inc bc
pop af
dec a
- jr nz,.signcopyloop
+ jr nz, .signcopyloop
ret
; function to load map data
LoadMapData:: ; 1241 (0:1241)
- ld a,[H_LOADEDROMBANK]
+ ld a, [H_LOADEDROMBANK]
push af
call DisableLCD
call ResetMapVariables
@@ -1980,18 +1980,18 @@ LoadMapData:: ; 1241 (0:1241)
call InitMapSprites ; load tile pattern data for sprites
call LoadScreenRelatedData
call CopyMapViewToVRAM
- ld a,$01
- ld [wUpdateSpritesEnabled],a
+ ld a, $01
+ ld [wUpdateSpritesEnabled], a
call EnableLCD
- ld b,$09
+ ld b, $09
call RunPaletteCommand
call LoadPlayerSpriteGraphics
- ld a,[wd732]
- and a,1 << 4 | 1 << 3 ; fly warp or dungeon warp
- jr nz,.restoreRomBank
- ld a,[wFlags_D733]
- bit 1,a
- jr nz,.restoreRomBank
+ ld a, [wd732]
+ and 1 << 4 | 1 << 3 ; fly warp or dungeon warp
+ jr nz, .restoreRomBank
+ ld a, [wFlags_D733]
+ bit 1, a
+ jr nz, .restoreRomBank
call UpdateMusic6Times ; music related
call PlayDefaultMusicFadeOutCurrent ; music related
.restoreRomBank
@@ -2006,15 +2006,15 @@ LoadScreenRelatedData:: ; 0f0c (0:0f0c)
ret
Func_0f16:: ; 0f16 (0:0f16)
- ld a,[H_LOADEDROMBANK]
+ ld a, [H_LOADEDROMBANK]
push af
call DisableLCD
call ResetMapVariables
- ld a,[wCurMap]
+ ld a, [wCurMap]
call SwitchToMapRomBank
call LoadScreenRelatedData
call CopyMapViewToVRAM
- ld de,vBGMap1
+ ld de, vBGMap1
call CopyMapViewToVRAM2
call EnableLCD
call ReloadMapSpriteTilePatterns
@@ -2022,9 +2022,9 @@ Func_0f16:: ; 0f16 (0:0f16)
call BankswitchCommon
jr asm_0f4d
Func_0f3d:: ; 0f3d (0:0f3d)
- ld a,[H_LOADEDROMBANK]
+ ld a, [H_LOADEDROMBANK]
push af
- ld a,[wCurMap]
+ ld a, [wCurMap]
call SwitchToMapRomBank
call LoadTileBlockMap
pop af
@@ -2034,40 +2034,40 @@ asm_0f4d: ; 0f4d (0:0f4d)
ret ; useless?
ResetMapVariables:: ; 0f56 (0:0f56)
- ld a,$98
- ld [wMapViewVRAMPointer + 1],a
+ ld a, $98
+ ld [wMapViewVRAMPointer + 1], a
xor a
- ld [wMapViewVRAMPointer],a
- ld [hSCY],a
- ld [hSCX],a
- ld [wWalkCounter],a
- ld [wUnusedD119],a
- ld [wSpriteSetID],a
- ld [wWalkBikeSurfStateCopy],a
+ ld [wMapViewVRAMPointer], a
+ ld [hSCY], a
+ ld [hSCX], a
+ ld [wWalkCounter], a
+ ld [wUnusedD119], a
+ ld [wSpriteSetID], a
+ ld [wWalkBikeSurfStateCopy], a
ret
CopyMapViewToVRAM:: ; 0f70 (0:0f70)
; copy current map view to VRAM
- ld de,vBGMap0
+ ld de, vBGMap0
CopyMapViewToVRAM2: ; 0f73 (0:0f73)
- ld hl,wTileMap
- ld b,18
+ ld hl, wTileMap
+ ld b, 18
.vramCopyLoop
- ld c,20
+ ld c, 20
.vramCopyInnerLoop
- ld a,[hli]
- ld [de],a
+ ld a, [hli]
+ ld [de], a
inc e
dec c
- jr nz,.vramCopyInnerLoop
- ld a,32 - 20 ; total vram map width in tiles - screen width in tiles
+ jr nz, .vramCopyInnerLoop
+ ld a, 32 - 20 ; total vram map width in tiles - screen width in tiles
add e
- ld e,a
- jr nc,.noCarry
+ ld e, a
+ jr nc, .noCarry
inc d
.noCarry
dec b
- jr nz,.vramCopyLoop
+ jr nz, .vramCopyLoop
ret
; function to switch to the ROM bank that a map is stored in
@@ -2075,35 +2075,35 @@ CopyMapViewToVRAM2: ; 0f73 (0:0f73)
SwitchToMapRomBank:: ; 0f8b (0:0f8b)
push hl
push bc
- ld c,a
- ld b,$00
- ld a,BANK(MapHeaderBanks)
+ ld c, a
+ ld b, $00
+ ld a, BANK(MapHeaderBanks)
call BankswitchHome ; switch to ROM bank 3F
- ld hl,MapHeaderBanks
- add hl,bc
- ld a,[hl]
- ld [$ffe8],a ; save map ROM bank
+ ld hl, MapHeaderBanks
+ add hl, bc
+ ld a, [hl]
+ ld [$ffe8], a ; save map ROM bank
call BankswitchBack
- ld a,[$ffe8]
+ ld a, [$ffe8]
call BankswitchCommon
pop bc
pop hl
ret
GetMapHeaderPointer:: ; 0fa7 (0:0fa7)
- ld a,[H_LOADEDROMBANK]
+ ld a, [H_LOADEDROMBANK]
push af
switchbank MapHeaderPointers ; 3f:41f2
push de
- ld a,[wCurMap]
- ld e,a
- ld d,$0
- ld hl,MapHeaderPointers
- add hl,de
- add hl,de
- ld a,[hli]
- ld h,[hl]
- ld l,a
+ ld a, [wCurMap]
+ ld e, a
+ ld d, $0
+ ld hl, MapHeaderPointers
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
pop de
pop af
jp BankswitchCommon
@@ -2131,15 +2131,15 @@ ForceBikeOrSurf:: ; 0fd6 (0:0fd6)
; Handle the player jumping down
; a ledge in the overworld.
HandleMidJump:: ; 0fe1 (0:0fe1)
- ld a,[wd736]
- bit 6,a ; jumping down a ledge?
+ ld a, [wd736]
+ bit 6, a ; jumping down a ledge?
ret z
callba _HandleMidJump
ret
IsSpinning:: ; 0ff0 (0:0ff0)
- ld a,[wd736]
- bit 7,a
+ ld a, [wd736]
+ bit 7, a
ret z ; no spinning
jpba LoadSpinnerArrowTiles ; spin while moving
@@ -2147,140 +2147,140 @@ Func_0ffe:: ; 0ffe (0:0ffe)
jpab IsPlayerTalkingToPikachu
InitSprites:: ; 1006 (0:1006)
- ld a,[hli]
- ld [wNumSprites],a ; save the number of sprites
+ ld a, [hli]
+ ld [wNumSprites], a ; save the number of sprites
push hl
push de
push bc
call ZeroSpriteStateData
call DisableRegularSprites
- ld hl,wMapSpriteData
- ld bc,$20
+ ld hl, wMapSpriteData
+ ld bc, $20
xor a
call FillMemory
pop bc
pop de
pop hl
- ld a,[wNumSprites]
+ ld a, [wNumSprites]
and a ; are sprites existant?
ret z ; don't copy sprite data if not
- ld b,a
- ld c,$0
- ld de,wSpriteStateData1 + $10
+ ld b, a
+ ld c, $0
+ ld de, wSpriteStateData1 + $10
; copy sprite stuff?
.loadSpriteLoop
- ld a,[hli]
- ld [de],a ; store picture ID at C1X0
+ ld a, [hli]
+ ld [de], a ; store picture ID at C1X0
inc d
- ld a,e
+ ld a, e
add $4
- ld e,a
- ld a,[hli]
- ld [de],a ; store Y position at C2X4
+ ld e, a
+ ld a, [hli]
+ ld [de], a ; store Y position at C2X4
inc e
- ld a,[hli]
- ld [de],a ; store X position at C2X5
+ ld a, [hli]
+ ld [de], a ; store X position at C2X5
inc e
- ld a,[hli]
- ld [de],a ; store movement byte 1 at C2X6
- ld a,[hli]
- ld [$ff8d],a ; save movement byte 2
- ld a,[hli]
- ld [$ff8e],a ; save text ID and flags byte
+ ld a, [hli]
+ ld [de], a ; store movement byte 1 at C2X6
+ ld a, [hli]
+ ld [$ff8d], a ; save movement byte 2
+ ld a, [hli]
+ ld [$ff8e], a ; save text ID and flags byte
push bc
call LoadSprite
pop bc
dec d
- ld a,e
- add a,$a
- ld e,a
+ ld a, e
+ add $a
+ ld e, a
inc c
inc c
dec b
- jr nz,.loadSpriteLoop
+ jr nz, .loadSpriteLoop
ret
ZeroSpriteStateData:: ; 1050 (0:1050)
; zero C110-C1EF and C210-C2EF
-; C1F0-C1FF and C2F0-C2FF is probably used for Pikachu
- ld hl,wSpriteStateData1 + $10
- ld de,wSpriteStateData2 + $10
+; C1F0-C1FF and C2F0-C2FF is used for Pikachu
+ ld hl, wSpriteStateData1 + $10
+ ld de, wSpriteStateData2 + $10
xor a
- ld b,$e0
+ ld b, 14 * $10
.loop
- ld [hli],a
- ld [de],a
+ ld [hli], a
+ ld [de], a
inc e
dec b
- jr nz,.loop
+ jr nz, .loop
ret
DisableRegularSprites:: ; 1060 (0:1060)
; initialize all C100-C1FF sprite entries to disabled (other than player's and pikachu)
- ld hl,wSpriteStateData1 + $12
- ld de,$10
- ld c,$e
+ ld hl, wSpriteStateData1 + 1 * $10 + 2
+ ld de, $10
+ ld c, $e
.loop
- ld [hl],$ff
- add hl,de
+ ld [hl], $ff
+ add hl, de
dec c
- jr nz,.loop
+ jr nz, .loop
ret
LoadSprite:: ; 106f (0:106f)
push hl
- ld b,$0
- ld hl,wMapSpriteData
- add hl,bc
- ld a,[$ff8d]
- ld [hli],a ; store movement byte 2 in byte 0 of sprite entry
- ld a,[$ff8e]
- ld [hl],a ; this appears pointless, since the value is overwritten immediately after
- ld a,[$ff8e]
- ld [$ff8d],a
- and a,$3f
- ld [hl],a ; store text ID in byte 1 of sprite entry
+ ld b, $0
+ ld hl, wMapSpriteData
+ add hl, bc
+ ld a, [$ff8d]
+ ld [hli], a ; store movement byte 2 in byte 0 of sprite entry
+ ld a, [$ff8e]
+ ld [hl], a ; this appears pointless, since the value is overwritten immediately after
+ ld a, [$ff8e]
+ ld [$ff8d], a
+ and $3f
+ ld [hl], a ; store text ID in byte 1 of sprite entry
pop hl
- ld a,[$ff8d]
- bit 6,a
- jr nz,.trainerSprite
- bit 7,a
- jr nz,.itemBallSprite
+ ld a, [$ff8d]
+ bit 6, a
+ jr nz, .trainerSprite
+ bit 7, a
+ jr nz, .itemBallSprite
; for regular sprites
push hl
- ld hl,wMapSpriteExtraData
- add hl,bc
+ ld hl, wMapSpriteExtraData
+ add hl, bc
; zero both bytes, since regular sprites don't use this extra space
xor a
- ld [hli],a
- ld [hl],a
+ ld [hli], a
+ ld [hl], a
pop hl
ret
.trainerSprite
- ld a,[hli]
- ld [$ff8d],a ; save trainer class
- ld a,[hli]
- ld [$ff8e],a ; save trainer number (within class)
+ ld a, [hli]
+ ld [$ff8d], a ; save trainer class
+ ld a, [hli]
+ ld [$ff8e], a ; save trainer number (within class)
push hl
- ld hl,wMapSpriteExtraData
- add hl,bc
- ld a,[$ff8d]
- ld [hli],a ; store trainer class in byte 0 of the entry
- ld a,[$ff8e]
- ld [hl],a ; store trainer number in byte 1 of the entry
+ ld hl, wMapSpriteExtraData
+ add hl, bc
+ ld a, [$ff8d]
+ ld [hli], a ; store trainer class in byte 0 of the entry
+ ld a, [$ff8e]
+ ld [hl], a ; store trainer number in byte 1 of the entry
pop hl
ret
.itemBallSprite
- ld a,[hli]
- ld [$ff8d],a ; save item number
+ ld a, [hli]
+ ld [$ff8d], a ; save item number
push hl
- ld hl,wMapSpriteExtraData
- add hl,bc
- ld a,[$ff8d]
- ld [hli],a ; store item number in byte 0 of the entry
+ ld hl, wMapSpriteExtraData
+ add hl, bc
+ ld a, [$ff8d]
+ ld [hli], a ; store item number in byte 0 of the entry
xor a
- ld [hl],a ; zero byte 1, since it is not used
+ ld [hl], a ; zero byte 1, since it is not used
pop hl
ret ; end of home/overworld.asm = 10b9 (0:10b9)
diff --git a/macros.asm b/macros.asm
index 54fba2d3..8f01702a 100644
--- a/macros.asm
+++ b/macros.asm
@@ -355,6 +355,10 @@ TX_CABLE_CLUB_RECEPTIONIST EQUS "db $f6"
TX_POKECENTER_NURSE EQUS "db $ff"
; Predef macro.
+predef_const: MACRO
+ const \1PredefID
+ ENDM
+
add_predef: MACRO
\1Predef::
db BANK(\1)
@@ -362,7 +366,7 @@ add_predef: MACRO
ENDM
predef_id: MACRO
- ld a, (\1Predef) ; - PredefPointers) / 3
+ ld a, (\1Predef - PredefPointers) / 3
ENDM
predef: MACRO
@@ -374,10 +378,6 @@ predef_jump: MACRO
predef_id \1
jp Predef
ENDM
-
-predef_const: MACRO
- const \1Predef
- ENDM
tx_pre_const: MACRO
const \1_id
diff --git a/main.asm b/main.asm
index 8518bfb6..ea865e42 100755
--- a/main.asm
+++ b/main.asm
@@ -1268,7 +1268,7 @@ INCLUDE "data/mapHeaders/redshouse2f.asm"
INCLUDE "scripts/redshouse2f.asm"
INCLUDE "data/mapObjects/redshouse2f.asm"
-Func_5c0d4:
+StarterDex:
ld a, %01001011
ld [wPokedexOwned], a
predef ShowPokedexData
@@ -1363,7 +1363,20 @@ INCBIN "maps/victoryroad1.blk"
INCLUDE "engine/evolution.asm"
- dr $5db93,$5dbae
+SetPartyMonTypes::
+ call GetPredefRegisters
+ ld bc, 5
+ add hl, bc
+ ld a, [wd11e]
+ ld [wd0b5], a
+ push hl
+ call GetMonHeader
+ pop hl
+ ld a, [wMonHType1]
+ ld [hli], a
+ ld a, [wMonHType2]
+ ld [hl], a
+ ret
INCLUDE "engine/hidden_object_functions17.asm"
@@ -1499,8 +1512,14 @@ INCLUDE "data/mapObjects/pewtermart.asm"
dr $7453d,$74726
INCLUDE "engine/menu/vending_machine.asm"
-
- dr $74851,$75dfe
+ dr $74851,$757a0
+
+INCLUDE "data/mapHeaders/gary.asm"
+INCLUDE "scripts/gary.asm"
+INCLUDE "data/mapObjects/gary.asm"
+GaryBlocks:
+INCBIN "maps/gary.blk"
+ dr $759ef,$75dfe
INCLUDE "engine/menu/league_pc.asm"
diff --git a/scripts/gary.asm b/scripts/gary.asm
index 64734c58..290bd753 100755
--- a/scripts/gary.asm
+++ b/scripts/gary.asm
@@ -2,7 +2,8 @@ GaryScript: ; 75f1d (1d:5f1d)
call EnableAutoTextBoxDrawing
ld hl, GaryScriptPointers
ld a, [W_GARYCURSCRIPT]
- jp JumpTable
+ call JumpTable
+ ret
GaryScript_75f29: ; 75f29 (1d:5f29)
xor a
@@ -40,9 +41,9 @@ GaryScript1: ; 75f48 (1d:5f48)
ret
RLEMovement75f63: ; 75f63 (1d:5f63)
- db D_UP,1
- db D_RIGHT,1
- db D_UP,3
+ db D_UP, 1
+ db D_RIGHT, 1
+ db D_UP, 3
db $ff
GaryScript2: ; 75f6a (1d:5f6a)
@@ -69,18 +70,7 @@ GaryScript2: ; 75f6a (1d:5f6a)
; select which team to use during the encounter
ld a, [W_RIVALSTARTER]
- cp STARTER2
- jr nz, .NotSquirtle
- ld a, $1
- jr .done
-.NotSquirtle
- cp STARTER3
- jr nz, .Charmander
- ld a, $2
- jr .done
-.Charmander
- ld a, $3
-.done
+ add $0 ; Wow GameFreak
ld [wTrainerNo], a
xor a
@@ -217,8 +207,8 @@ GaryScript9: ; 76099 (1d:6099)
ret
RLEMovement760b4: ; 760b4 (1d:60b4)
- db D_UP,4
- db D_LEFT,1
+ db D_UP, 4
+ db D_LEFT, 1
db $ff
GaryScript10: ; 760b9 (1d:60b9)